From: support Date: Tue, 31 Jan 2023 17:15:28 +0000 (+0000) Subject: Built motion from commit d69f4380.|2.6.29 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=b3ef220ff368e4e21f40e00068b390d7ebfc7c69;p=motion2.git Built motion from commit d69f4380.|2.6.29 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 08178dc..8a101b3 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-31T16:54:25.985Z", + "time": "2023-01-31T17:07:51.702Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index ffc2a3a..e570d15 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-31T16:54:25.985Z", + "time": "2023-01-31T17:07:51.702Z", "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 604c4c2..26f217b 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 _0xe2fa=['urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','VIRTUAL','getDataValue','action','STRING','contactManager','integration','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'];(function(_0x24c940,_0x546a7c){var _0x257afe=function(_0x2063af){while(--_0x2063af){_0x24c940['push'](_0x24c940['shift']());}};_0x257afe(++_0x546a7c);}(_0xe2fa,0x6f));var _0xae2f=function(_0x32f86c,_0x601e54){_0x32f86c=_0x32f86c-0x0;var _0x461db5=_0xe2fa[_0x32f86c];return _0x461db5;};'use strict';var Sequelize=require(_0xae2f('0x0'));module['exports']={'name':{'type':Sequelize[_0xae2f('0x1')],'get':function(_0x1bd78f){return this[_0xae2f('0x2')](_0xae2f('0x3'));}},'action':{'type':Sequelize[_0xae2f('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xae2f('0x5'),_0xae2f('0x6'),'motionbar',_0xae2f('0x7'),_0xae2f('0x8'),'browser',_0xae2f('0x9'),_0xae2f('0xa')]],'msg':_0xae2f('0xb')}},'comment':_0xae2f('0xb')},'data1':{'type':Sequelize[_0xae2f('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[_0xae2f('0x4')](0x1000),'comment':_0xae2f('0xc')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xae2f('0xd')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0xae2f('0xe')},'data5':{'type':Sequelize[_0xae2f('0x4')](0x1000),'comments':_0xae2f('0xf')},'data6':{'type':Sequelize['STRING'],'comments':_0xae2f('0x10')},'data7':{'type':Sequelize[_0xae2f('0x11')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0xd3d3=['STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','integration','motionbar','jscripty','browser','bot'];(function(_0x51f196,_0x1bf1ca){var _0x27a604=function(_0x257ac0){while(--_0x257ac0){_0x51f196['push'](_0x51f196['shift']());}};_0x27a604(++_0x1bf1ca);}(_0xd3d3,0xa1));var _0x3d3d=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0xd3d3[_0x556bb1];return _0x45455f;};'use strict';var Sequelize=require(_0x3d3d('0x0'));module[_0x3d3d('0x1')]={'name':{'type':Sequelize[_0x3d3d('0x2')],'get':function(_0xab1f39){return this[_0x3d3d('0x3')](_0x3d3d('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x3d3d('0x5'),_0x3d3d('0x6'),_0x3d3d('0x7'),'urlForward',_0x3d3d('0x8'),_0x3d3d('0x9'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x3d3d('0xa')](0x1000),'comment':_0x3d3d('0xb')},'data2':{'type':Sequelize[_0x3d3d('0xa')](0x1000),'comment':_0x3d3d('0xc')},'data3':{'type':Sequelize[_0x3d3d('0xa')](0x1000),'comment':_0x3d3d('0xd')},'data4':{'type':Sequelize[_0x3d3d('0xa')](0x1000),'comments':_0x3d3d('0xe')},'data5':{'type':Sequelize[_0x3d3d('0xa')](0x1000),'comments':_0x3d3d('0xf')},'data6':{'type':Sequelize[_0x3d3d('0xa')],'comments':_0x3d3d('0x10')},'data7':{'type':Sequelize[_0x3d3d('0x11')],'comments':_0x3d3d('0x12')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index cc7c88c..40e396a 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 _0xc025=['util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','body','find','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x372a8e,_0x16a38d){var _0x39aa2d=function(_0x5e7ba7){while(--_0x5e7ba7){_0x372a8e['push'](_0x372a8e['shift']());}};_0x39aa2d(++_0x16a38d);}(_0xc025,0x156));var _0x5c02=function(_0x2fe4b5,_0x439480){_0x2fe4b5=_0x2fe4b5-0x0;var _0x2b9c0b=_0xc025[_0x2fe4b5];return _0x2b9c0b;};'use strict';var emlformat=require(_0x5c02('0x0'));var rimraf=require(_0x5c02('0x1'));var zipdir=require(_0x5c02('0x2'));var jsonpatch=require(_0x5c02('0x3'));var rp=require(_0x5c02('0x4'));var moment=require(_0x5c02('0x5'));var BPromise=require(_0x5c02('0x6'));var Mustache=require(_0x5c02('0x7'));var util=require(_0x5c02('0x8'));var path=require('path');var sox=require(_0x5c02('0x9'));var csv=require(_0x5c02('0xa'));var ejs=require(_0x5c02('0xb'));var fs=require('fs');var fs_extra=require(_0x5c02('0xc'));var _=require(_0x5c02('0xd'));var squel=require(_0x5c02('0xe'));var crypto=require(_0x5c02('0xf'));var jsforce=require(_0x5c02('0x10'));var deskjs=require(_0x5c02('0x11'));var toCsv=require(_0x5c02('0xa'));var querystring=require(_0x5c02('0x12'));var Papa=require(_0x5c02('0x13'));var Redis=require(_0x5c02('0x14'));var authService=require(_0x5c02('0x15'));var qs=require(_0x5c02('0x16'));var as=require(_0x5c02('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c02('0x18'))(_0x5c02('0x19'));var utils=require(_0x5c02('0x1a'));var config=require(_0x5c02('0x1b'));var licenseUtil=require(_0x5c02('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4565ef,_0x28e32e){_0x28e32e=_0x28e32e||0xcc;return function(_0x378ae1){if(_0x378ae1){return _0x4565ef[_0x5c02('0x1d')](_0x28e32e);}return _0x4565ef[_0x5c02('0x1e')](_0x28e32e)[_0x5c02('0x1f')]();};}function respondWithResult(_0xc119d5,_0x94cf84){_0x94cf84=_0x94cf84||0xc8;return function(_0x15fb2d){if(_0x15fb2d){return _0xc119d5[_0x5c02('0x1e')](_0x94cf84)[_0x5c02('0x20')](_0x15fb2d);}};}function respondWithFilteredResult(_0x38be45,_0x3d8265){return function(_0x1a02b5){if(_0x1a02b5){var _0x2ce57b=typeof _0x3d8265['offset']===_0x5c02('0x21')&&typeof _0x3d8265['limit']===_0x5c02('0x21');var _0x179c91=_0x1a02b5['count'];var _0x1f43c5=_0x2ce57b?0x0:_0x3d8265[_0x5c02('0x22')];var _0x12cb7f=_0x2ce57b?_0x1a02b5['count']:_0x3d8265[_0x5c02('0x22')]+_0x3d8265[_0x5c02('0x23')];var _0x27ffe6;if(_0x12cb7f>=_0x179c91){_0x12cb7f=_0x179c91;_0x27ffe6=0xc8;}else{_0x27ffe6=0xce;}_0x38be45[_0x5c02('0x1e')](_0x27ffe6);return _0x38be45['set'](_0x5c02('0x24'),_0x1f43c5+'-'+_0x12cb7f+'/'+_0x179c91)[_0x5c02('0x20')](_0x1a02b5);}return null;};}function patchUpdates(_0x3594a6){return function(_0x264f08){try{jsonpatch[_0x5c02('0x25')](_0x264f08,_0x3594a6,!![]);}catch(_0x59fade){return BPromise[_0x5c02('0x26')](_0x59fade);}return _0x264f08[_0x5c02('0x27')]();};}function saveUpdates(_0x38d305,_0x5968a4){return function(_0x12afdd){if(_0x12afdd){return _0x12afdd[_0x5c02('0x28')](_0x38d305)[_0x5c02('0x29')](function(_0x59b8ad){return _0x59b8ad;});}return null;};}function removeEntity(_0x4c3258,_0x583e8e){return function(_0x948d48){if(_0x948d48){return _0x948d48[_0x5c02('0x2a')]()[_0x5c02('0x29')](function(){_0x4c3258['status'](0xcc)[_0x5c02('0x1f')]();});}};}function handleEntityNotFound(_0x424720,_0x148df8){return function(_0x558e1a){if(!_0x558e1a){_0x424720['sendStatus'](0x194);}return _0x558e1a;};}function handleError(_0x2dc3f3,_0x3bd7bf){_0x3bd7bf=_0x3bd7bf||0x1f4;return function(_0xded84b){logger[_0x5c02('0x2b')](_0xded84b[_0x5c02('0x2c')]);if(_0xded84b['name']){delete _0xded84b[_0x5c02('0x2d')];}_0x2dc3f3[_0x5c02('0x1e')](_0x3bd7bf)['send'](_0xded84b);};}exports['update']=function(_0x1fda31,_0x2afd72){if(_0x1fda31[_0x5c02('0x2e')]['id']){delete _0x1fda31['body']['id'];}return db['Action'][_0x5c02('0x2f')]({'where':{'id':_0x1fda31['params']['id']}})[_0x5c02('0x29')](handleEntityNotFound(_0x2afd72,null))[_0x5c02('0x29')](saveUpdates(_0x1fda31[_0x5c02('0x2e')],null))[_0x5c02('0x29')](respondWithResult(_0x2afd72,null))[_0x5c02('0x30')](handleError(_0x2afd72,null));};exports[_0x5c02('0x2a')]=function(_0x5dad99,_0x46d18c){return db['Action'][_0x5c02('0x2f')]({'where':{'id':_0x5dad99[_0x5c02('0x31')]['id']}})[_0x5c02('0x29')](handleEntityNotFound(_0x46d18c,null))[_0x5c02('0x29')](removeEntity(_0x46d18c,null))[_0x5c02('0x30')](handleError(_0x46d18c,null));}; \ No newline at end of file +var _0x606d=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x606d,0x17d));var _0xd606=function(_0x5c2999,_0x6f472b){_0x5c2999=_0x5c2999-0x0;var _0x11dbbc=_0x606d[_0x5c2999];return _0x11dbbc;};'use strict';var emlformat=require(_0xd606('0x0'));var rimraf=require(_0xd606('0x1'));var zipdir=require(_0xd606('0x2'));var jsonpatch=require(_0xd606('0x3'));var rp=require(_0xd606('0x4'));var moment=require(_0xd606('0x5'));var BPromise=require(_0xd606('0x6'));var Mustache=require(_0xd606('0x7'));var util=require(_0xd606('0x8'));var path=require(_0xd606('0x9'));var sox=require(_0xd606('0xa'));var csv=require('to-csv');var ejs=require(_0xd606('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd606('0xc'));var squel=require(_0xd606('0xd'));var crypto=require(_0xd606('0xe'));var jsforce=require(_0xd606('0xf'));var deskjs=require(_0xd606('0x10'));var toCsv=require(_0xd606('0x11'));var querystring=require(_0xd606('0x12'));var Papa=require(_0xd606('0x13'));var Redis=require(_0xd606('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xd606('0x15'));var as=require(_0xd606('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd606('0x17'))(_0xd606('0x18'));var utils=require(_0xd606('0x19'));var config=require(_0xd606('0x1a'));var licenseUtil=require(_0xd606('0x1b'));var db=require(_0xd606('0x1c'))['db'];function respondWithStatusCode(_0x22c243,_0x139b7b){_0x139b7b=_0x139b7b||0xcc;return function(_0x1a662f){if(_0x1a662f){return _0x22c243[_0xd606('0x1d')](_0x139b7b);}return _0x22c243[_0xd606('0x1e')](_0x139b7b)['end']();};}function respondWithResult(_0x42689d,_0x2c2f05){_0x2c2f05=_0x2c2f05||0xc8;return function(_0x4da2cb){if(_0x4da2cb){return _0x42689d[_0xd606('0x1e')](_0x2c2f05)[_0xd606('0x1f')](_0x4da2cb);}};}function respondWithFilteredResult(_0x518af1,_0x266ee1){return function(_0x27c6df){if(_0x27c6df){var _0x1e662a=typeof _0x266ee1['offset']===_0xd606('0x20')&&typeof _0x266ee1['limit']==='undefined';var _0x1cded9=_0x27c6df[_0xd606('0x21')];var _0x54ee3d=_0x1e662a?0x0:_0x266ee1[_0xd606('0x22')];var _0x45a9ee=_0x1e662a?_0x27c6df[_0xd606('0x21')]:_0x266ee1[_0xd606('0x22')]+_0x266ee1['limit'];var _0x34aca8;if(_0x45a9ee>=_0x1cded9){_0x45a9ee=_0x1cded9;_0x34aca8=0xc8;}else{_0x34aca8=0xce;}_0x518af1[_0xd606('0x1e')](_0x34aca8);return _0x518af1['set'](_0xd606('0x23'),_0x54ee3d+'-'+_0x45a9ee+'/'+_0x1cded9)[_0xd606('0x1f')](_0x27c6df);}return null;};}function patchUpdates(_0x2193e1){return function(_0x6a601c){try{jsonpatch['apply'](_0x6a601c,_0x2193e1,!![]);}catch(_0x56bfb8){return BPromise[_0xd606('0x24')](_0x56bfb8);}return _0x6a601c[_0xd606('0x25')]();};}function saveUpdates(_0x4c70e6,_0x57e130){return function(_0x434915){if(_0x434915){return _0x434915[_0xd606('0x26')](_0x4c70e6)[_0xd606('0x27')](function(_0x84e84b){return _0x84e84b;});}return null;};}function removeEntity(_0x508a9b,_0x297457){return function(_0xa2b2d6){if(_0xa2b2d6){return _0xa2b2d6[_0xd606('0x28')]()[_0xd606('0x27')](function(){_0x508a9b[_0xd606('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x173b46,_0x538015){return function(_0x1ffad4){if(!_0x1ffad4){_0x173b46['sendStatus'](0x194);}return _0x1ffad4;};}function handleError(_0x41b355,_0x119621){_0x119621=_0x119621||0x1f4;return function(_0x16555c){logger[_0xd606('0x29')](_0x16555c[_0xd606('0x2a')]);if(_0x16555c[_0xd606('0x2b')]){delete _0x16555c[_0xd606('0x2b')];}_0x41b355['status'](_0x119621)[_0xd606('0x2c')](_0x16555c);};}exports[_0xd606('0x26')]=function(_0x20fd84,_0x33015d){if(_0x20fd84[_0xd606('0x2d')]['id']){delete _0x20fd84[_0xd606('0x2d')]['id'];}return db[_0xd606('0x2e')][_0xd606('0x2f')]({'where':{'id':_0x20fd84[_0xd606('0x30')]['id']}})[_0xd606('0x27')](handleEntityNotFound(_0x33015d,null))[_0xd606('0x27')](saveUpdates(_0x20fd84[_0xd606('0x2d')],null))['then'](respondWithResult(_0x33015d,null))[_0xd606('0x31')](handleError(_0x33015d,null));};exports[_0xd606('0x28')]=function(_0x33db88,_0x304bfa){return db[_0xd606('0x2e')][_0xd606('0x2f')]({'where':{'id':_0x33db88[_0xd606('0x30')]['id']}})[_0xd606('0x27')](handleEntityNotFound(_0x304bfa,null))['then'](removeEntity(_0x304bfa,null))[_0xd606('0x31')](handleError(_0x304bfa,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 024ce73..c169aac 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 _0xd0be=['moment','bluebird','request-promise','path','exports','define','Action','tools_actions','lodash','util','../../config/logger','api'];(function(_0x491bdf,_0x21701b){var _0x492af7=function(_0x57a2bd){while(--_0x57a2bd){_0x491bdf['push'](_0x491bdf['shift']());}};_0x492af7(++_0x21701b);}(_0xd0be,0x1a0));var _0xed0b=function(_0x109946,_0x3494b7){_0x109946=_0x109946-0x0;var _0x4ed20b=_0xd0be[_0x109946];return _0x4ed20b;};'use strict';var _=require(_0xed0b('0x0'));var util=require(_0xed0b('0x1'));var logger=require(_0xed0b('0x2'))(_0xed0b('0x3'));var moment=require(_0xed0b('0x4'));var BPromise=require(_0xed0b('0x5'));var rp=require(_0xed0b('0x6'));var fs=require('fs');var path=require(_0xed0b('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./action.attributes');module[_0xed0b('0x8')]=function(_0x12e73f,_0x160d7a){return _0x12e73f[_0xed0b('0x9')](_0xed0b('0xa'),attributes,{'tableName':_0xed0b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d14=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','Action','tools_actions'];(function(_0x1e4a08,_0x9e4ec9){var _0xbd0325=function(_0xb10125){while(--_0xb10125){_0x1e4a08['push'](_0x1e4a08['shift']());}};_0xbd0325(++_0x9e4ec9);}(_0x8d14,0x15f));var _0x48d1=function(_0x3e60cb,_0x818200){_0x3e60cb=_0x3e60cb-0x0;var _0x265023=_0x8d14[_0x3e60cb];return _0x265023;};'use strict';var _=require(_0x48d1('0x0'));var util=require(_0x48d1('0x1'));var logger=require(_0x48d1('0x2'))(_0x48d1('0x3'));var moment=require(_0x48d1('0x4'));var BPromise=require(_0x48d1('0x5'));var rp=require(_0x48d1('0x6'));var fs=require('fs');var path=require(_0x48d1('0x7'));var rimraf=require(_0x48d1('0x8'));var config=require(_0x48d1('0x9'));var attributes=require(_0x48d1('0xa'));module['exports']=function(_0x2bab3b,_0x35ed60){return _0x2bab3b['define'](_0x48d1('0xb'),attributes,{'tableName':_0x48d1('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 464a845..d4b66d8 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 _0x7fbe=['request','then','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x160b36,_0x31321f){var _0x21d2e4=function(_0x2185b4){while(--_0x2185b4){_0x160b36['push'](_0x160b36['shift']());}};_0x21d2e4(++_0x31321f);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x247ca4,_0x1e7ec5){_0x247ca4=_0x247ca4-0x0;var _0x432c92=_0x7fbe[_0x247ca4];return _0x432c92;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x4975,0x86));var _0x5497=function(_0x33dd77,_0x445412){_0x33dd77=_0x33dd77-0x0;var _0x1c24f2=_0x4975[_0x33dd77];return _0x1c24f2;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('Action,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 6fd0079..9cf3b6b 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 _0x0905=['multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated','update','delete','/:id','destroy','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0905,0x177));var _0x5090=function(_0x149f91,_0x114519){_0x149f91=_0x149f91-0x0;var _0x1ed87b=_0x0905[_0x149f91];return _0x1ed87b;};'use strict';var multer=require(_0x5090('0x0'));var util=require('util');var path=require(_0x5090('0x1'));var timeout=require(_0x5090('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5090('0x3'));var auth=require(_0x5090('0x4'));var interaction=require(_0x5090('0x5'));var config=require(_0x5090('0x6'));var controller=require(_0x5090('0x7'));router[_0x5090('0x8')]('/:id',auth[_0x5090('0x9')](),controller[_0x5090('0xa')]);router[_0x5090('0xb')](_0x5090('0xc'),auth['isAuthenticated'](),controller[_0x5090('0xd')]);module[_0x5090('0xe')]=router; \ No newline at end of file +var _0xc1a8=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','delete','destroy','exports'];(function(_0x13e320,_0x32b0a7){var _0x57209a=function(_0x161ab3){while(--_0x161ab3){_0x13e320['push'](_0x13e320['shift']());}};_0x57209a(++_0x32b0a7);}(_0xc1a8,0xc4));var _0x8c1a=function(_0x144c0c,_0x113cfe){_0x144c0c=_0x144c0c-0x0;var _0x436221=_0xc1a8[_0x144c0c];return _0x436221;};'use strict';var multer=require('multer');var util=require(_0x8c1a('0x0'));var path=require('path');var timeout=require(_0x8c1a('0x1'));var express=require(_0x8c1a('0x2'));var router=express[_0x8c1a('0x3')]();var fs_extra=require(_0x8c1a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8c1a('0x5'));var config=require(_0x8c1a('0x6'));var controller=require(_0x8c1a('0x7'));router[_0x8c1a('0x8')](_0x8c1a('0x9'),auth[_0x8c1a('0xa')](),controller['update']);router[_0x8c1a('0xb')](_0x8c1a('0x9'),auth[_0x8c1a('0xa')](),controller[_0x8c1a('0xc')]);module[_0x8c1a('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index aa52a8a..5c3f7d1 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.attributes.js +++ b/server/api/analyticCustomReport/analyticCustomReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8958=['TEXT','exports'];(function(_0x1a422a,_0x3468fd){var _0x4dcab4=function(_0x24b700){while(--_0x24b700){_0x1a422a['push'](_0x1a422a['shift']());}};_0x4dcab4(++_0x3468fd);}(_0x8958,0x93));var _0x8895=function(_0x2a281a,_0x5007cf){_0x2a281a=_0x2a281a-0x0;var _0x4fc65c=_0x8958[_0x2a281a];return _0x4fc65c;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x8895('0x1')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x8ef6=['STRING','TEXT','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8ef6,0xf2));var _0x68ef=function(_0x51b2ed,_0x44731f){_0x51b2ed=_0x51b2ed-0x0;var _0x383953=_0x8ef6[_0x51b2ed];return _0x383953;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'name':{'type':Sequelize[_0x68ef('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x68ef('0x2')]},'parent':{'type':Sequelize[_0x68ef('0x2')]},'table':{'type':Sequelize[_0x68ef('0x2')]},'conditions':{'type':Sequelize[_0x68ef('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index a6089bc..2bd9bdd 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 _0xd5b0=['output','web','fullPath','%s-%s.%s','randomstring','generate','csv','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','countTable','QueryTypes','SELECT','run','runReport','left_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','getFields','debug','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','CustomReports','UserProfileResource','destroy','error','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticCustomReport','count','includeAll','include','findAll','rows','catch','rawAttributes','length','create','user','get','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','params','preview','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','operator','rules','group','field','condition','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','join','right_join','cross_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','HOUR(%s)','IS\x20NOT\x20EMPTY','value','ValidationErrorItem','select','alias'];(function(_0x2b2f03,_0x5d1bf9){var _0x2ebb53=function(_0x4ba391){while(--_0x4ba391){_0x2b2f03['push'](_0x2b2f03['shift']());}};_0x2ebb53(++_0x5d1bf9);}(_0xd5b0,0x16e));var _0x0d5b=function(_0x1adde8,_0x5c21f4){_0x1adde8=_0x1adde8-0x0;var _0x130c0c=_0xd5b0[_0x1adde8];return _0x130c0c;};'use strict';var emlformat=require(_0x0d5b('0x0'));var rimraf=require(_0x0d5b('0x1'));var zipdir=require(_0x0d5b('0x2'));var jsonpatch=require(_0x0d5b('0x3'));var rp=require('request-promise');var moment=require(_0x0d5b('0x4'));var BPromise=require(_0x0d5b('0x5'));var Mustache=require(_0x0d5b('0x6'));var util=require(_0x0d5b('0x7'));var path=require(_0x0d5b('0x8'));var sox=require(_0x0d5b('0x9'));var csv=require(_0x0d5b('0xa'));var ejs=require(_0x0d5b('0xb'));var fs=require('fs');var fs_extra=require(_0x0d5b('0xc'));var _=require(_0x0d5b('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0d5b('0xe'));var deskjs=require(_0x0d5b('0xf'));var toCsv=require(_0x0d5b('0xa'));var querystring=require(_0x0d5b('0x10'));var Papa=require(_0x0d5b('0x11'));var Redis=require(_0x0d5b('0x12'));var authService=require(_0x0d5b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0d5b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d5b('0x15'))(_0x0d5b('0x16'));var utils=require(_0x0d5b('0x17'));var config=require(_0x0d5b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d5b('0x19'))['db'];var dbH=require(_0x0d5b('0x19'))[_0x0d5b('0x1a')];function respondWithStatusCode(_0x492fee,_0x27a607){_0x27a607=_0x27a607||0xcc;return function(_0x4d5318){if(_0x4d5318){return _0x492fee[_0x0d5b('0x1b')](_0x27a607);}return _0x492fee['status'](_0x27a607)['end']();};}function respondWithResult(_0x54f76a,_0x141e6d){_0x141e6d=_0x141e6d||0xc8;return function(_0x4a14dc){if(_0x4a14dc){return _0x54f76a[_0x0d5b('0x1c')](_0x141e6d)[_0x0d5b('0x1d')](_0x4a14dc);}};}function respondWithFilteredResult(_0x981056,_0x12bb02){return function(_0x26541f){if(_0x26541f){var _0x115c11=typeof _0x12bb02[_0x0d5b('0x1e')]===_0x0d5b('0x1f')&&typeof _0x12bb02[_0x0d5b('0x20')]===_0x0d5b('0x1f');var _0x2eeb00=_0x26541f['count'];var _0x5414e7=_0x115c11?0x0:_0x12bb02[_0x0d5b('0x1e')];var _0x142bf5=_0x115c11?_0x26541f['count']:_0x12bb02[_0x0d5b('0x1e')]+_0x12bb02[_0x0d5b('0x20')];var _0x12f491;if(_0x142bf5>=_0x2eeb00){_0x142bf5=_0x2eeb00;_0x12f491=0xc8;}else{_0x12f491=0xce;}_0x981056[_0x0d5b('0x1c')](_0x12f491);return _0x981056[_0x0d5b('0x21')](_0x0d5b('0x22'),_0x5414e7+'-'+_0x142bf5+'/'+_0x2eeb00)[_0x0d5b('0x1d')](_0x26541f);}return null;};}function patchUpdates(_0x3b82bb){return function(_0x3d92ae){try{jsonpatch[_0x0d5b('0x23')](_0x3d92ae,_0x3b82bb,!![]);}catch(_0x16738b){return BPromise[_0x0d5b('0x24')](_0x16738b);}return _0x3d92ae[_0x0d5b('0x25')]();};}function saveUpdates(_0xe3a6a1,_0x27da74){return function(_0x44c1c3){if(_0x44c1c3){return _0x44c1c3['update'](_0xe3a6a1)[_0x0d5b('0x26')](function(_0x18bfef){return _0x18bfef;});}return null;};}function removeEntity(_0x17dae9,_0x1a218b){return function(_0xef6611){if(_0xef6611){return _0xef6611['destroy']()[_0x0d5b('0x26')](function(){var _0x3401c4=_0xef6611['get']({'plain':!![]});var _0x41acbd=_0x0d5b('0x27');return db[_0x0d5b('0x28')][_0x0d5b('0x29')]({'where':{'type':_0x41acbd,'resourceId':_0x3401c4['id']}})[_0x0d5b('0x26')](function(){return _0xef6611;});})[_0x0d5b('0x26')](function(){_0x17dae9[_0x0d5b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e95c6,_0x35a027){return function(_0x46a59a){if(!_0x46a59a){_0x3e95c6[_0x0d5b('0x1b')](0x194);}return _0x46a59a;};}function handleError(_0x203ba7,_0x2a1ec9){_0x2a1ec9=_0x2a1ec9||0x1f4;return function(_0x599e22){logger[_0x0d5b('0x2a')](_0x599e22['stack']);if(_0x599e22[_0x0d5b('0x2b')]){delete _0x599e22[_0x0d5b('0x2b')];}_0x203ba7[_0x0d5b('0x1c')](_0x2a1ec9)[_0x0d5b('0x2c')](_0x599e22);};}exports[_0x0d5b('0x2d')]=function(_0x3d1cf0,_0x238f63){var _0x94f2c3={},_0x48d78e={},_0x3efe2e={'count':0x0,'rows':[]};var _0x364a7a=_[_0x0d5b('0x2e')](db['AnalyticCustomReport']['rawAttributes'],function(_0x58f84e){return{'name':_0x58f84e[_0x0d5b('0x2f')],'type':_0x58f84e['type'][_0x0d5b('0x30')]};});_0x48d78e[_0x0d5b('0x31')]=_[_0x0d5b('0x2e')](_0x364a7a,'name');_0x48d78e[_0x0d5b('0x32')]=_[_0x0d5b('0x33')](_0x3d1cf0[_0x0d5b('0x32')]);_0x48d78e[_0x0d5b('0x34')]=_[_0x0d5b('0x35')](_0x48d78e[_0x0d5b('0x31')],_0x48d78e[_0x0d5b('0x32')]);_0x94f2c3[_0x0d5b('0x36')]=_[_0x0d5b('0x35')](_0x48d78e[_0x0d5b('0x31')],qs['fields'](_0x3d1cf0['query'][_0x0d5b('0x37')]));_0x94f2c3['attributes']=_0x94f2c3['attributes']['length']?_0x94f2c3[_0x0d5b('0x36')]:_0x48d78e[_0x0d5b('0x31')];if(!_0x3d1cf0[_0x0d5b('0x32')][_0x0d5b('0x38')](_0x0d5b('0x39'))){_0x94f2c3[_0x0d5b('0x20')]=qs[_0x0d5b('0x20')](_0x3d1cf0[_0x0d5b('0x32')][_0x0d5b('0x20')]);_0x94f2c3['offset']=qs[_0x0d5b('0x1e')](_0x3d1cf0[_0x0d5b('0x32')][_0x0d5b('0x1e')]);}_0x94f2c3[_0x0d5b('0x3a')]=qs[_0x0d5b('0x3b')](_0x3d1cf0['query'][_0x0d5b('0x3b')]);_0x94f2c3[_0x0d5b('0x3c')]=qs[_0x0d5b('0x34')](_[_0x0d5b('0x3d')](_0x3d1cf0[_0x0d5b('0x32')],_0x48d78e['filters']),_0x364a7a);if(_0x3d1cf0['query'][_0x0d5b('0x3e')]){_0x94f2c3[_0x0d5b('0x3c')]=_[_0x0d5b('0x3f')](_0x94f2c3[_0x0d5b('0x3c')],{'$or':_[_0x0d5b('0x2e')](_0x364a7a,function(_0x32bc2f){if(_0x32bc2f['type']!==_0x0d5b('0x40')){var _0x38f975={};_0x38f975[_0x32bc2f[_0x0d5b('0x2b')]]={'$like':'%'+_0x3d1cf0[_0x0d5b('0x32')][_0x0d5b('0x3e')]+'%'};return _0x38f975;}})});}_0x94f2c3=_[_0x0d5b('0x3f')]({},_0x94f2c3,_0x3d1cf0[_0x0d5b('0x41')]);var _0x1fa9b2={'where':_0x94f2c3['where']};return db[_0x0d5b('0x42')][_0x0d5b('0x43')](_0x1fa9b2)[_0x0d5b('0x26')](function(_0x5550d0){_0x3efe2e[_0x0d5b('0x43')]=_0x5550d0;if(_0x3d1cf0[_0x0d5b('0x32')][_0x0d5b('0x44')]){_0x94f2c3[_0x0d5b('0x45')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x0d5b('0x46')](_0x94f2c3);})[_0x0d5b('0x26')](function(_0x33afd2){_0x3efe2e[_0x0d5b('0x47')]=_0x33afd2;return _0x3efe2e;})['then'](respondWithFilteredResult(_0x238f63,_0x94f2c3))[_0x0d5b('0x48')](handleError(_0x238f63,null));};exports['show']=function(_0x88302c,_0x1ea931){var _0x4d9740={'raw':![],'where':{'id':_0x88302c['params']['id']}},_0x3df094={};_0x3df094[_0x0d5b('0x31')]=_[_0x0d5b('0x33')](db[_0x0d5b('0x42')][_0x0d5b('0x49')]);_0x3df094[_0x0d5b('0x32')]=_[_0x0d5b('0x33')](_0x88302c[_0x0d5b('0x32')]);_0x3df094[_0x0d5b('0x34')]=_[_0x0d5b('0x35')](_0x3df094[_0x0d5b('0x31')],_0x3df094[_0x0d5b('0x32')]);_0x4d9740[_0x0d5b('0x36')]=_[_0x0d5b('0x35')](_0x3df094[_0x0d5b('0x31')],qs['fields'](_0x88302c[_0x0d5b('0x32')][_0x0d5b('0x37')]));_0x4d9740[_0x0d5b('0x36')]=_0x4d9740[_0x0d5b('0x36')][_0x0d5b('0x4a')]?_0x4d9740[_0x0d5b('0x36')]:_0x3df094[_0x0d5b('0x31')];if(_0x88302c[_0x0d5b('0x32')][_0x0d5b('0x44')]){_0x4d9740[_0x0d5b('0x45')]=[{'all':!![]}];}_0x4d9740=_[_0x0d5b('0x3f')]({},_0x4d9740,_0x88302c[_0x0d5b('0x41')]);return db[_0x0d5b('0x42')]['find'](_0x4d9740)[_0x0d5b('0x26')](handleEntityNotFound(_0x1ea931,null))[_0x0d5b('0x26')](respondWithResult(_0x1ea931,null))[_0x0d5b('0x48')](handleError(_0x1ea931,null));};exports[_0x0d5b('0x4b')]=function(_0x4a5aec,_0x2e6a1b){return db[_0x0d5b('0x42')]['create'](_0x4a5aec['body'],{})[_0x0d5b('0x26')](function(_0x7bec64){var _0x5018d0=_0x4a5aec[_0x0d5b('0x4c')][_0x0d5b('0x4d')]({'plain':!![]});if(!_0x5018d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5018d0[_0x0d5b('0x4e')]===_0x0d5b('0x4c')){var _0x4fccc2=_0x7bec64[_0x0d5b('0x4d')]({'plain':!![]});var _0x3390bf=_0x0d5b('0x4f');return db[_0x0d5b('0x50')]['find']({'where':{'name':_0x3390bf,'userProfileId':_0x5018d0[_0x0d5b('0x51')]},'raw':!![]})[_0x0d5b('0x26')](function(_0x2f304a){if(_0x2f304a&&_0x2f304a[_0x0d5b('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x4fccc2['name'],'resourceId':_0x4fccc2['id'],'type':'CustomReports','sectionId':_0x2f304a['id']},{})['then'](function(){return _0x7bec64;});}else{return _0x7bec64;}})[_0x0d5b('0x48')](function(_0x46b42f){logger['error'](_0x0d5b('0x53'),_0x46b42f);throw _0x46b42f;});}return _0x7bec64;})['then'](respondWithResult(_0x2e6a1b,0xc9))[_0x0d5b('0x48')](handleError(_0x2e6a1b,null));};exports[_0x0d5b('0x54')]=function(_0x1cce54,_0x489fa0){if(_0x1cce54[_0x0d5b('0x55')]['id']){delete _0x1cce54[_0x0d5b('0x55')]['id'];}return db[_0x0d5b('0x42')][_0x0d5b('0x56')]({'where':{'id':_0x1cce54[_0x0d5b('0x57')]['id']}})[_0x0d5b('0x26')](handleEntityNotFound(_0x489fa0,null))['then'](saveUpdates(_0x1cce54[_0x0d5b('0x55')],null))[_0x0d5b('0x26')](respondWithResult(_0x489fa0,null))['catch'](handleError(_0x489fa0,null));};exports[_0x0d5b('0x29')]=function(_0x1c2f3e,_0x2b2f81){return db[_0x0d5b('0x42')][_0x0d5b('0x56')]({'where':{'id':_0x1c2f3e[_0x0d5b('0x57')]['id']}})['then'](handleEntityNotFound(_0x2b2f81,null))['then'](removeEntity(_0x2b2f81,null))['catch'](handleError(_0x2b2f81,null));};exports[_0x0d5b('0x58')]=function(_0x59e308,_0x40e915){var _0x4c40e6=0xa;var _0x84f091=['join','left_join','right_join','cross_join'];var _0x362c8a={'SUM':_0x0d5b('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x0d5b('0x5a'),'MIN':_0x0d5b('0x5b'),'AVG':_0x0d5b('0x5c'),'GROUP_CONCAT':_0x0d5b('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x0d5b('0x5e')};var _0x84c09={'SEC_TO_TIME':_0x0d5b('0x5f'),'DATE':_0x0d5b('0x60'),'HOUR':'HOUR(%s)','ROUND':_0x0d5b('0x61'),'UNIX_TIMESTAMP':_0x0d5b('0x62')};var _0x296779=function(_0x235186){return!_[_0x0d5b('0x63')]([_0x0d5b('0x64'),_0x0d5b('0x65'),_0x0d5b('0x66'),'IS\x20NOT\x20EMPTY'],_0x235186);};var _0xe7a090=function(_0x472f4d){if(!_0x472f4d||!_0x472f4d['rules'][_0x0d5b('0x4a')]){return'';}for(var _0x45998b='(',_0x1a6b9b=0x0;_0x1a6b9b<_0x472f4d['rules'][_0x0d5b('0x4a')];_0x1a6b9b+=0x1){_0x1a6b9b>0x0&&(_0x45998b+='\x20'+_0x472f4d[_0x0d5b('0x67')]+'\x20');_0x45998b+=_0x472f4d[_0x0d5b('0x68')][_0x1a6b9b][_0x0d5b('0x69')]?_0xe7a090(_0x472f4d[_0x0d5b('0x68')][_0x1a6b9b][_0x0d5b('0x69')]):_0x472f4d[_0x0d5b('0x68')][_0x1a6b9b][_0x0d5b('0x6a')]+'\x20'+_0x472f4d[_0x0d5b('0x68')][_0x1a6b9b][_0x0d5b('0x6b')]+(_0x296779(_0x472f4d[_0x0d5b('0x68')][_0x1a6b9b][_0x0d5b('0x6b')])?'\x20'+_0x472f4d[_0x0d5b('0x68')][_0x1a6b9b]['value']:'');}return _0x45998b+')';};var _0x20aa2d={'where':{'id':_0x59e308['params']['id']}},_0x21a5ec,_0x1a62d6,_0x261e51,_0x5efcaa,_0x21cdf9;_0x20aa2d=_[_0x0d5b('0x3f')]({},_0x20aa2d,_0x59e308[_0x0d5b('0x41')]);return db[_0x0d5b('0x42')][_0x0d5b('0x56')](_0x20aa2d)['then'](function(_0x53a252){if(_0x53a252){_0x21a5ec=_0x53a252;return _0x53a252['getFields']();}return null;})[_0x0d5b('0x26')](function(_0x3f2cc9){if(_0x3f2cc9){if(!_0x3f2cc9[_0x0d5b('0x4a')]){throw new db[(_0x0d5b('0x6c'))]['ValidationErrorItem'](_0x0d5b('0x6d'),0x193);}_0x1a62d6=_0x3f2cc9;return db[_0x0d5b('0x6e')][_0x0d5b('0x46')]({'raw':!![]});}return null;})['then'](function(_0x16d3bd){if(_0x16d3bd){_0x261e51=_[_0x0d5b('0x6f')](_0x16d3bd,'id');var _0x1b6123;var _0x3ac2e5=squel['select']();_0x3ac2e5[_0x0d5b('0x70')](_0x21a5ec[_0x0d5b('0x71')]);for(var _0xef2771=0x0;_0xef2771<_0x1a62d6['length'];_0xef2771+=0x1){_0x1b6123=_0x1a62d6[_0xef2771][_0x0d5b('0x72')]?_0x261e51[_0x1a62d6[_0xef2771][_0x0d5b('0x72')]][_0x0d5b('0x73')]:_0x1a62d6[_0xef2771][_0x0d5b('0x6a')];_0x1b6123=_0x1a62d6[_0xef2771][_0x0d5b('0x74')]?_[_0x0d5b('0x75')](_0x362c8a[_0x1a62d6[_0xef2771]['function']],'%s',_0x1b6123):_0x1b6123;_0x1b6123=_0x1a62d6[_0xef2771][_0x0d5b('0x76')]?_[_0x0d5b('0x75')](_0x84c09[_0x1a62d6[_0xef2771][_0x0d5b('0x76')]],'%s',_0x1b6123):_0x1b6123;if(_0x1a62d6[_0xef2771][_0x0d5b('0x77')]){_0x3ac2e5[_0x0d5b('0x69')](_0x1b6123);}_0x1a62d6[_0xef2771][_0x0d5b('0x78')]&&_0x3ac2e5['order'](_0x1b6123,_0x1a62d6[_0xef2771][_0x0d5b('0x78')]===_0x0d5b('0x79')?![]:!![]);_0x3ac2e5['field'](_0x1b6123,_0x1a62d6[_0xef2771]['alias']||_0x1b6123);}if(_0x21a5ec[_0x0d5b('0x7a')]){_0x21a5ec[_0x0d5b('0x7a')]=JSON[_0x0d5b('0x7b')](_0x21a5ec[_0x0d5b('0x7a')]);for(var _0x49c8df=0x0;_0x49c8df<_0x21a5ec[_0x0d5b('0x7a')]['length'];_0x49c8df+=0x1){if(_0x21a5ec['joins'][_0x49c8df][_0x0d5b('0x7c')]&&_[_0x0d5b('0x63')](_0x84f091,_0x21a5ec['joins'][_0x49c8df][_0x0d5b('0x7c')])&&_0x21a5ec[_0x0d5b('0x7a')][_0x49c8df][_0x0d5b('0x7d')]&&_0x21a5ec[_0x0d5b('0x7a')][_0x49c8df][_0x0d5b('0x7e')]&&_0x21a5ec[_0x0d5b('0x7a')][_0x49c8df][_0x0d5b('0x7f')]){_0x3ac2e5[_0x21a5ec[_0x0d5b('0x7a')][_0x49c8df]['type']](_0x21a5ec[_0x0d5b('0x7a')][_0x49c8df][_0x0d5b('0x7e')],null,util[_0x0d5b('0x76')](_0x0d5b('0x80'),_0x21a5ec['table'],_0x21a5ec[_0x0d5b('0x7a')][_0x49c8df]['parentKey'],_0x21a5ec[_0x0d5b('0x7a')][_0x49c8df]['foreignTable'],_0x21a5ec[_0x0d5b('0x7a')][_0x49c8df][_0x0d5b('0x7f')]));}}}if(_0x21a5ec[_0x0d5b('0x81')]){_0x21a5ec[_0x0d5b('0x81')]=JSON[_0x0d5b('0x7b')](_0x21a5ec[_0x0d5b('0x81')]);_0x3ac2e5[_0x0d5b('0x3c')](_0xe7a090(_0x21a5ec[_0x0d5b('0x81')][_0x0d5b('0x69')]));}_0x21cdf9=_0x3ac2e5[_0x0d5b('0x82')]();_0x3ac2e5[_0x0d5b('0x20')](_0x4c40e6);_0x3ac2e5['offset'](0x0);logger['debug'](_0x0d5b('0x83'),_0x3ac2e5[_0x0d5b('0x84')]());return dbH[_0x0d5b('0x85')]['query'](_0x3ac2e5[_0x0d5b('0x84')](),{'type':dbH[_0x0d5b('0x85')]['QueryTypes']['SELECT']});}})[_0x0d5b('0x26')](respondWithResult(_0x40e915,null))['catch'](handleError(_0x40e915,null));};function runReport(_0x228fab,_0x4bea7f,_0x30f175){var _0x6fee9a=_0x4bea7f[_0x0d5b('0x2b')];var _0x1a058a=0xa;var _0x3edfcf=[_0x0d5b('0x86'),'left_join',_0x0d5b('0x87'),_0x0d5b('0x88')];var _0x5a175a={'SUM':_0x0d5b('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x0d5b('0x5a'),'MIN':_0x0d5b('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x0d5b('0x5d'),'GROUP_CONCAT ASC':_0x0d5b('0x89'),'GROUP_CONCAT DESC':_0x0d5b('0x5e')};var _0x161602={'SEC_TO_TIME':_0x0d5b('0x5f'),'DATE':'DATE(%s)','HOUR':_0x0d5b('0x8a'),'ROUND':_0x0d5b('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x31198f=function(_0x57952d){return!_[_0x0d5b('0x63')]([_0x0d5b('0x64'),_0x0d5b('0x65'),'IS\x20EMPTY',_0x0d5b('0x8b')],_0x57952d);};var _0x4628d6=function(_0x38fbcd){if(!_0x38fbcd||!_0x38fbcd[_0x0d5b('0x68')][_0x0d5b('0x4a')]){return'';}for(var _0x13b923='(',_0x5bf374=0x0;_0x5bf374<_0x38fbcd[_0x0d5b('0x68')][_0x0d5b('0x4a')];_0x5bf374+=0x1){_0x5bf374>0x0&&(_0x13b923+='\x20'+_0x38fbcd['operator']+'\x20');_0x13b923+=_0x38fbcd[_0x0d5b('0x68')][_0x5bf374][_0x0d5b('0x69')]?_0x4628d6(_0x38fbcd['rules'][_0x5bf374]['group']):_0x38fbcd[_0x0d5b('0x68')][_0x5bf374][_0x0d5b('0x6a')]+'\x20'+_0x38fbcd[_0x0d5b('0x68')][_0x5bf374][_0x0d5b('0x6b')]+(_0x31198f(_0x38fbcd[_0x0d5b('0x68')][_0x5bf374][_0x0d5b('0x6b')])?'\x20'+_0x38fbcd[_0x0d5b('0x68')][_0x5bf374][_0x0d5b('0x8c')]:'');}return _0x13b923+')';};var _0x549718={'where':{'id':_0x228fab['id']}},_0x1a2624,_0x57ca00,_0x4c8277,_0x4b1c07,_0x4ecf3e;_0x549718=_[_0x0d5b('0x3f')]({},_0x549718,_0x30f175);return db[_0x0d5b('0x42')][_0x0d5b('0x56')](_0x549718)[_0x0d5b('0x26')](function(_0x4bde8e){if(_0x4bde8e){_0x1a2624=_0x4bde8e;return _0x4bde8e['getFields']();}return null;})[_0x0d5b('0x26')](function(_0x18b36d){if(_0x18b36d){if(!_0x18b36d[_0x0d5b('0x4a')]){throw new db['Sequelize'][(_0x0d5b('0x8d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x57ca00=_0x18b36d;return db['AnalyticMetric'][_0x0d5b('0x46')]({'raw':!![]});}return null;})['then'](function(_0x5771a0){if(_0x5771a0){_0x4c8277=_[_0x0d5b('0x6f')](_0x5771a0,'id');var _0x15d1b6;var _0x233fc9=squel[_0x0d5b('0x8e')]();_0x233fc9['from'](_0x1a2624[_0x0d5b('0x71')]);for(var _0x4a476f=0x0;_0x4a476f<_0x57ca00[_0x0d5b('0x4a')];_0x4a476f+=0x1){_0x15d1b6=_0x57ca00[_0x4a476f]['MetricId']?_0x4c8277[_0x57ca00[_0x4a476f][_0x0d5b('0x72')]][_0x0d5b('0x73')]:_0x57ca00[_0x4a476f][_0x0d5b('0x6a')];_0x15d1b6=_0x57ca00[_0x4a476f][_0x0d5b('0x74')]?_['replace'](_0x5a175a[_0x57ca00[_0x4a476f][_0x0d5b('0x74')]],'%s',_0x15d1b6):_0x15d1b6;_0x15d1b6=_0x57ca00[_0x4a476f][_0x0d5b('0x76')]?_[_0x0d5b('0x75')](_0x161602[_0x57ca00[_0x4a476f][_0x0d5b('0x76')]],'%s',_0x15d1b6):_0x15d1b6;if(_0x57ca00[_0x4a476f][_0x0d5b('0x77')]){_0x233fc9[_0x0d5b('0x69')](_0x15d1b6);}_0x57ca00[_0x4a476f][_0x0d5b('0x78')]&&_0x233fc9['order'](_0x15d1b6,_0x57ca00[_0x4a476f][_0x0d5b('0x78')]==='DESC'?![]:!![]);_0x233fc9['field'](_0x15d1b6,_0x57ca00[_0x4a476f][_0x0d5b('0x8f')]||_0x15d1b6);}if(_0x1a2624['joins']){_0x1a2624[_0x0d5b('0x7a')]=JSON['parse'](_0x1a2624['joins']);for(var _0x369711=0x0;_0x369711<_0x1a2624[_0x0d5b('0x7a')][_0x0d5b('0x4a')];_0x369711+=0x1){if(_0x1a2624['joins'][_0x369711][_0x0d5b('0x7c')]&&_[_0x0d5b('0x63')](_0x3edfcf,_0x1a2624['joins'][_0x369711][_0x0d5b('0x7c')])&&_0x1a2624['joins'][_0x369711][_0x0d5b('0x7d')]&&_0x1a2624[_0x0d5b('0x7a')][_0x369711]['foreignTable']&&_0x1a2624[_0x0d5b('0x7a')][_0x369711][_0x0d5b('0x7f')]){_0x233fc9[_0x1a2624['joins'][_0x369711][_0x0d5b('0x7c')]](_0x1a2624[_0x0d5b('0x7a')][_0x369711][_0x0d5b('0x7e')],null,util[_0x0d5b('0x76')](_0x0d5b('0x80'),_0x1a2624[_0x0d5b('0x71')],_0x1a2624[_0x0d5b('0x7a')][_0x369711][_0x0d5b('0x7d')],_0x1a2624[_0x0d5b('0x7a')][_0x369711][_0x0d5b('0x7e')],_0x1a2624[_0x0d5b('0x7a')][_0x369711][_0x0d5b('0x7f')]));}}}if(_0x1a2624[_0x0d5b('0x81')]){_0x1a2624['conditions']=JSON['parse'](_0x1a2624[_0x0d5b('0x81')]);_0x233fc9[_0x0d5b('0x3c')](_0x4628d6(_0x1a2624[_0x0d5b('0x81')][_0x0d5b('0x69')]));}_0x4ecf3e=_0x233fc9[_0x0d5b('0x82')]();_0x233fc9[_0x0d5b('0x20')](_0x1a058a);_0x233fc9[_0x0d5b('0x1e')](0x0);return;}})[_0x0d5b('0x26')](function(){if(_0x4bea7f[_0x0d5b('0x90')]===_0x0d5b('0x91')){return null;}var _0x55031b=_[_0x0d5b('0x3f')](_0x4bea7f,{'name':_0x4bea7f[_0x0d5b('0x92')]||_0x4bea7f['name']||_0x1a2624[_0x0d5b('0x2b')],'basename':_0x6fee9a,'savename':util[_0x0d5b('0x76')](_0x0d5b('0x93'),_0x4bea7f[_0x0d5b('0x2b')]||_0x1a2624[_0x0d5b('0x2b')],require(_0x0d5b('0x94'))[_0x0d5b('0x95')](0x4),_0x4bea7f[_0x0d5b('0x90')]||_0x0d5b('0x96')),'reportId':_0x1a2624['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0x0d5b('0x4b')](_0x55031b,{'raw':!![]});})[_0x0d5b('0x26')](function(_0x32b69c){if(_0x1a2624['table']==='cdr'){_0x4ecf3e[_0x0d5b('0x3c')](_0x1a2624['table']+_0x0d5b('0x97'),_0x4bea7f[_0x0d5b('0x98')],_0x4bea7f[_0x0d5b('0x99')]);}else{_0x4ecf3e[_0x0d5b('0x3c')](_0x1a2624[_0x0d5b('0x71')]+_0x0d5b('0x9a'),_0x4bea7f[_0x0d5b('0x98')],_0x4bea7f[_0x0d5b('0x99')]);}if(_0x32b69c){logger[_0x0d5b('0x9b')]('Run\x20Query:',_0x4ecf3e[_0x0d5b('0x84')]());require(_0x0d5b('0x9c'))[_0x0d5b('0x9d')](path[_0x0d5b('0x86')](__dirname,_0x0d5b('0x9e'),_0x32b69c[_0x0d5b('0x90')]),[_0x32b69c['id'],_0x4ecf3e[_0x0d5b('0x84')](),path['join'](__dirname,_0x0d5b('0x9f'),_0x32b69c['savename']),_0x6fee9a]);return _0x32b69c;}else{var _0x3e13bf=squel[_0x0d5b('0x8e')]();_0x3e13bf[_0x0d5b('0x70')]('('+_0x4ecf3e[_0x0d5b('0x84')]()+')',_0x0d5b('0xa0'));_0x3e13bf[_0x0d5b('0x6a')]('COUNT(*)','count');_0x4ecf3e[_0x0d5b('0x20')](_0x4bea7f[_0x0d5b('0x20')]||_0x1a058a);_0x4ecf3e[_0x0d5b('0x1e')](_0x4bea7f[_0x0d5b('0x1e')]||0x0);return dbH[_0x0d5b('0x85')][_0x0d5b('0x32')](_0x3e13bf[_0x0d5b('0x84')](),{'type':dbH['sequelize'][_0x0d5b('0xa1')]['SELECT']})[_0x0d5b('0x26')](function(_0x290efc){if(!_0x290efc['length']){_0x4b1c07=0x0;}else{_0x4b1c07=_0x290efc[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x4ecf3e[_0x0d5b('0x84')](),{'type':dbH[_0x0d5b('0x85')]['QueryTypes'][_0x0d5b('0xa2')]});})[_0x0d5b('0x26')](function(_0x1dfaa7){return{'rows':_0x1dfaa7||[],'count':_0x4b1c07};});}});}exports[_0x0d5b('0xa3')]=function(_0x20a2f6,_0x574246){return runReport(_0x20a2f6[_0x0d5b('0x57')],_0x20a2f6['query'],_0x20a2f6[_0x0d5b('0x41')])['then'](respondWithResult(_0x574246,null))[_0x0d5b('0x48')](handleError(_0x574246,null));};exports[_0x0d5b('0xa4')]=runReport;exports[_0x0d5b('0x32')]=function(_0x11f67e,_0x57d77e){var _0x157424=0xa;var _0x1b8330=[_0x0d5b('0x86'),_0x0d5b('0xa5'),_0x0d5b('0x87'),_0x0d5b('0x88')];var _0x4f5708={'SUM':'SUM(%s)','COUNT':_0x0d5b('0xa6'),'COUNT DISTINCT':_0x0d5b('0xa7'),'MAX':_0x0d5b('0x5a'),'MIN':_0x0d5b('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x0d5b('0x5e')};var _0x783c61={'SEC_TO_TIME':_0x0d5b('0x5f'),'DATE':_0x0d5b('0x60'),'HOUR':_0x0d5b('0x8a'),'ROUND':_0x0d5b('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x30cd2a=function(_0x2e4173){return!_[_0x0d5b('0x63')]([_0x0d5b('0x64'),'IS\x20NOT\x20NULL',_0x0d5b('0x66'),'IS\x20NOT\x20EMPTY'],_0x2e4173);};var _0x12585f=function(_0x1de99f){if(!_0x1de99f||!_0x1de99f[_0x0d5b('0x68')][_0x0d5b('0x4a')]){return'';}for(var _0x3f299e='(',_0x1d9e58=0x0;_0x1d9e58<_0x1de99f[_0x0d5b('0x68')][_0x0d5b('0x4a')];_0x1d9e58+=0x1){_0x1d9e58>0x0&&(_0x3f299e+='\x20'+_0x1de99f[_0x0d5b('0x67')]+'\x20');_0x3f299e+=_0x1de99f[_0x0d5b('0x68')][_0x1d9e58][_0x0d5b('0x69')]?_0x12585f(_0x1de99f[_0x0d5b('0x68')][_0x1d9e58]['group']):_0x1de99f['rules'][_0x1d9e58][_0x0d5b('0x6a')]+'\x20'+_0x1de99f[_0x0d5b('0x68')][_0x1d9e58][_0x0d5b('0x6b')]+(_0x30cd2a(_0x1de99f[_0x0d5b('0x68')][_0x1d9e58][_0x0d5b('0x6b')])?'\x20'+_0x1de99f['rules'][_0x1d9e58][_0x0d5b('0x8c')]:'');}return _0x3f299e+')';};var _0x466f77={'where':{'id':_0x11f67e[_0x0d5b('0x57')]['id']}},_0x390552,_0x4d3072,_0x154afe,_0x41fa47,_0x209d60;_0x466f77=_[_0x0d5b('0x3f')]({},_0x466f77,_0x11f67e[_0x0d5b('0x41')]);return db[_0x0d5b('0x42')][_0x0d5b('0x56')](_0x466f77)[_0x0d5b('0x26')](function(_0x14261a){if(_0x14261a){_0x390552=_0x14261a;return _0x14261a[_0x0d5b('0xa8')]();}return null;})[_0x0d5b('0x26')](function(_0x540218){if(_0x540218){if(!_0x540218['length']){throw new db[(_0x0d5b('0x6c'))][(_0x0d5b('0x8d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4d3072=_0x540218;return db[_0x0d5b('0x6e')][_0x0d5b('0x46')]({'raw':!![]});}return null;})[_0x0d5b('0x26')](function(_0x27636f){if(_0x27636f){_0x154afe=_[_0x0d5b('0x6f')](_0x27636f,'id');var _0x37b0d8;var _0x44ace2=squel['select']();_0x44ace2[_0x0d5b('0x70')](_0x390552[_0x0d5b('0x71')]);for(var _0x211695=0x0;_0x211695<_0x4d3072[_0x0d5b('0x4a')];_0x211695+=0x1){_0x37b0d8=_0x4d3072[_0x211695][_0x0d5b('0x72')]?_0x154afe[_0x4d3072[_0x211695]['MetricId']][_0x0d5b('0x73')]:_0x4d3072[_0x211695][_0x0d5b('0x6a')];_0x37b0d8=_0x4d3072[_0x211695][_0x0d5b('0x74')]?_[_0x0d5b('0x75')](_0x4f5708[_0x4d3072[_0x211695][_0x0d5b('0x74')]],'%s',_0x37b0d8):_0x37b0d8;_0x37b0d8=_0x4d3072[_0x211695]['format']?_[_0x0d5b('0x75')](_0x783c61[_0x4d3072[_0x211695]['format']],'%s',_0x37b0d8):_0x37b0d8;if(_0x4d3072[_0x211695][_0x0d5b('0x77')]){_0x44ace2[_0x0d5b('0x69')](_0x37b0d8);}_0x4d3072[_0x211695]['orderBy']&&_0x44ace2[_0x0d5b('0x3a')](_0x37b0d8,_0x4d3072[_0x211695][_0x0d5b('0x78')]==='DESC'?![]:!![]);_0x44ace2[_0x0d5b('0x6a')](_0x37b0d8,_0x4d3072[_0x211695][_0x0d5b('0x8f')]||_0x37b0d8);}if(_0x390552[_0x0d5b('0x7a')]){_0x390552[_0x0d5b('0x7a')]=JSON[_0x0d5b('0x7b')](_0x390552[_0x0d5b('0x7a')]);for(var _0xa214d4=0x0;_0xa214d4<_0x390552[_0x0d5b('0x7a')][_0x0d5b('0x4a')];_0xa214d4+=0x1){if(_0x390552[_0x0d5b('0x7a')][_0xa214d4][_0x0d5b('0x7c')]&&_['includes'](_0x1b8330,_0x390552[_0x0d5b('0x7a')][_0xa214d4][_0x0d5b('0x7c')])&&_0x390552['joins'][_0xa214d4][_0x0d5b('0x7d')]&&_0x390552['joins'][_0xa214d4][_0x0d5b('0x7e')]&&_0x390552[_0x0d5b('0x7a')][_0xa214d4][_0x0d5b('0x7f')]){_0x44ace2[_0x390552[_0x0d5b('0x7a')][_0xa214d4][_0x0d5b('0x7c')]](_0x390552[_0x0d5b('0x7a')][_0xa214d4][_0x0d5b('0x7e')],null,util[_0x0d5b('0x76')](_0x0d5b('0x80'),_0x390552[_0x0d5b('0x71')],_0x390552[_0x0d5b('0x7a')][_0xa214d4][_0x0d5b('0x7d')],_0x390552[_0x0d5b('0x7a')][_0xa214d4][_0x0d5b('0x7e')],_0x390552[_0x0d5b('0x7a')][_0xa214d4][_0x0d5b('0x7f')]));}}}if(_0x390552[_0x0d5b('0x81')]){_0x390552[_0x0d5b('0x81')]=JSON['parse'](_0x390552[_0x0d5b('0x81')]);_0x44ace2[_0x0d5b('0x3c')](_0x12585f(_0x390552[_0x0d5b('0x81')][_0x0d5b('0x69')]));}_0x209d60=_0x44ace2[_0x0d5b('0x82')]();_0x44ace2['limit'](_0x157424);_0x44ace2[_0x0d5b('0x1e')](0x0);logger[_0x0d5b('0xa9')]('Limited\x20Query:',_0x44ace2[_0x0d5b('0x84')]());return dbH[_0x0d5b('0x85')][_0x0d5b('0x32')](_0x44ace2[_0x0d5b('0x84')](),{'type':dbH[_0x0d5b('0x85')][_0x0d5b('0xa1')]['SELECT']});}})[_0x0d5b('0x26')](function(){return{'sql':_0x209d60['toString']()};})['then'](respondWithResult(_0x57d77e,null))['catch'](handleError(_0x57d77e,null));}; \ No newline at end of file +var _0xab39=['sendStatus','end','status','json','undefined','offset','count','limit','set','apply','reject','save','update','then','get','CustomReports','UserProfileResource','destroy','stack','name','index','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','nolimit','order','sort','filters','where','merge','map','VIRTUAL','options','AnalyticCustomReport','includeAll','include','findAll','catch','show','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','length','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','metric','function','replace','format','groupBy','orderBy','DESC','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','toString','sequelize','QueryTypes','left_join','SEC_TO_TIME(%s)','DATE(%s)','IS\x20EMPTY','MetricId','alias','output','web','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','child_process','join','../../components/export/','countTable','COUNT(*)','SELECT','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','HOUR(%s)','value','Limited\x20Query:','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','dbH'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0xab39,0x12d));var _0x9ab3=function(_0xc5821d,_0x4c0d9b){_0xc5821d=_0xc5821d-0x0;var _0x6dfa58=_0xab39[_0xc5821d];return _0x6dfa58;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ab3('0x0'));var zipdir=require(_0x9ab3('0x1'));var jsonpatch=require(_0x9ab3('0x2'));var rp=require(_0x9ab3('0x3'));var moment=require(_0x9ab3('0x4'));var BPromise=require(_0x9ab3('0x5'));var Mustache=require(_0x9ab3('0x6'));var util=require('util');var path=require('path');var sox=require(_0x9ab3('0x7'));var csv=require(_0x9ab3('0x8'));var ejs=require(_0x9ab3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9ab3('0xa'));var squel=require(_0x9ab3('0xb'));var crypto=require('crypto');var jsforce=require(_0x9ab3('0xc'));var deskjs=require(_0x9ab3('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9ab3('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9ab3('0xf'));var qs=require(_0x9ab3('0x10'));var as=require(_0x9ab3('0x11'));var hardwareService=require(_0x9ab3('0x12'));var logger=require(_0x9ab3('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x9ab3('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0x9ab3('0x15'))[_0x9ab3('0x16')];function respondWithStatusCode(_0x51b694,_0x118a19){_0x118a19=_0x118a19||0xcc;return function(_0x552f2e){if(_0x552f2e){return _0x51b694[_0x9ab3('0x17')](_0x118a19);}return _0x51b694['status'](_0x118a19)[_0x9ab3('0x18')]();};}function respondWithResult(_0x3e70d5,_0x1f51b7){_0x1f51b7=_0x1f51b7||0xc8;return function(_0xae2a17){if(_0xae2a17){return _0x3e70d5[_0x9ab3('0x19')](_0x1f51b7)[_0x9ab3('0x1a')](_0xae2a17);}};}function respondWithFilteredResult(_0x330c6d,_0x4204ac){return function(_0x800c21){if(_0x800c21){var _0x40bcbe=typeof _0x4204ac['offset']===_0x9ab3('0x1b')&&typeof _0x4204ac['limit']===_0x9ab3('0x1b');var _0x391628=_0x800c21['count'];var _0x83a222=_0x40bcbe?0x0:_0x4204ac[_0x9ab3('0x1c')];var _0x3dd0ae=_0x40bcbe?_0x800c21[_0x9ab3('0x1d')]:_0x4204ac[_0x9ab3('0x1c')]+_0x4204ac[_0x9ab3('0x1e')];var _0x6fdd12;if(_0x3dd0ae>=_0x391628){_0x3dd0ae=_0x391628;_0x6fdd12=0xc8;}else{_0x6fdd12=0xce;}_0x330c6d[_0x9ab3('0x19')](_0x6fdd12);return _0x330c6d[_0x9ab3('0x1f')]('Content-Range',_0x83a222+'-'+_0x3dd0ae+'/'+_0x391628)[_0x9ab3('0x1a')](_0x800c21);}return null;};}function patchUpdates(_0x75852e){return function(_0x39ad68){try{jsonpatch[_0x9ab3('0x20')](_0x39ad68,_0x75852e,!![]);}catch(_0x37b544){return BPromise[_0x9ab3('0x21')](_0x37b544);}return _0x39ad68[_0x9ab3('0x22')]();};}function saveUpdates(_0x2f3a19,_0x293da6){return function(_0x25e450){if(_0x25e450){return _0x25e450[_0x9ab3('0x23')](_0x2f3a19)[_0x9ab3('0x24')](function(_0x320f06){return _0x320f06;});}return null;};}function removeEntity(_0x2459c7,_0x4e5b85){return function(_0x310ebb){if(_0x310ebb){return _0x310ebb['destroy']()[_0x9ab3('0x24')](function(){var _0x112672=_0x310ebb[_0x9ab3('0x25')]({'plain':!![]});var _0x16c687=_0x9ab3('0x26');return db[_0x9ab3('0x27')][_0x9ab3('0x28')]({'where':{'type':_0x16c687,'resourceId':_0x112672['id']}})['then'](function(){return _0x310ebb;});})[_0x9ab3('0x24')](function(){_0x2459c7[_0x9ab3('0x19')](0xcc)[_0x9ab3('0x18')]();});}};}function handleEntityNotFound(_0x2a90a6,_0x443f45){return function(_0x67f2b5){if(!_0x67f2b5){_0x2a90a6[_0x9ab3('0x17')](0x194);}return _0x67f2b5;};}function handleError(_0x53a5da,_0x2decfb){_0x2decfb=_0x2decfb||0x1f4;return function(_0x40efdc){logger['error'](_0x40efdc[_0x9ab3('0x29')]);if(_0x40efdc[_0x9ab3('0x2a')]){delete _0x40efdc['name'];}_0x53a5da['status'](_0x2decfb)['send'](_0x40efdc);};}exports[_0x9ab3('0x2b')]=function(_0x29ac63,_0x4448c8){var _0x564e72={},_0x33e718={},_0x343b02={'count':0x0,'rows':[]};var _0x383737=_['map'](db['AnalyticCustomReport'][_0x9ab3('0x2c')],function(_0x2d00a3){return{'name':_0x2d00a3[_0x9ab3('0x2d')],'type':_0x2d00a3[_0x9ab3('0x2e')][_0x9ab3('0x2f')]};});_0x33e718[_0x9ab3('0x30')]=_['map'](_0x383737,_0x9ab3('0x2a'));_0x33e718['query']=_[_0x9ab3('0x31')](_0x29ac63[_0x9ab3('0x32')]);_0x33e718['filters']=_[_0x9ab3('0x33')](_0x33e718[_0x9ab3('0x30')],_0x33e718[_0x9ab3('0x32')]);_0x564e72['attributes']=_[_0x9ab3('0x33')](_0x33e718[_0x9ab3('0x30')],qs[_0x9ab3('0x34')](_0x29ac63[_0x9ab3('0x32')][_0x9ab3('0x34')]));_0x564e72[_0x9ab3('0x35')]=_0x564e72[_0x9ab3('0x35')]['length']?_0x564e72[_0x9ab3('0x35')]:_0x33e718['model'];if(!_0x29ac63['query']['hasOwnProperty'](_0x9ab3('0x36'))){_0x564e72['limit']=qs[_0x9ab3('0x1e')](_0x29ac63[_0x9ab3('0x32')][_0x9ab3('0x1e')]);_0x564e72[_0x9ab3('0x1c')]=qs[_0x9ab3('0x1c')](_0x29ac63[_0x9ab3('0x32')]['offset']);}_0x564e72[_0x9ab3('0x37')]=qs[_0x9ab3('0x38')](_0x29ac63[_0x9ab3('0x32')][_0x9ab3('0x38')]);_0x564e72['where']=qs[_0x9ab3('0x39')](_['pick'](_0x29ac63[_0x9ab3('0x32')],_0x33e718[_0x9ab3('0x39')]),_0x383737);if(_0x29ac63[_0x9ab3('0x32')]['filter']){_0x564e72[_0x9ab3('0x3a')]=_[_0x9ab3('0x3b')](_0x564e72[_0x9ab3('0x3a')],{'$or':_[_0x9ab3('0x3c')](_0x383737,function(_0x19f6e6){if(_0x19f6e6[_0x9ab3('0x2e')]!==_0x9ab3('0x3d')){var _0x165d71={};_0x165d71[_0x19f6e6[_0x9ab3('0x2a')]]={'$like':'%'+_0x29ac63[_0x9ab3('0x32')]['filter']+'%'};return _0x165d71;}})});}_0x564e72=_[_0x9ab3('0x3b')]({},_0x564e72,_0x29ac63[_0x9ab3('0x3e')]);var _0x3b673c={'where':_0x564e72[_0x9ab3('0x3a')]};return db[_0x9ab3('0x3f')][_0x9ab3('0x1d')](_0x3b673c)[_0x9ab3('0x24')](function(_0xb2a179){_0x343b02[_0x9ab3('0x1d')]=_0xb2a179;if(_0x29ac63[_0x9ab3('0x32')][_0x9ab3('0x40')]){_0x564e72[_0x9ab3('0x41')]=[{'all':!![]}];}return db[_0x9ab3('0x3f')][_0x9ab3('0x42')](_0x564e72);})[_0x9ab3('0x24')](function(_0x714746){_0x343b02['rows']=_0x714746;return _0x343b02;})[_0x9ab3('0x24')](respondWithFilteredResult(_0x4448c8,_0x564e72))[_0x9ab3('0x43')](handleError(_0x4448c8,null));};exports[_0x9ab3('0x44')]=function(_0x1990f0,_0x412119){var _0xecdcaf={'raw':![],'where':{'id':_0x1990f0[_0x9ab3('0x45')]['id']}},_0x3b74dc={};_0x3b74dc[_0x9ab3('0x30')]=_[_0x9ab3('0x31')](db[_0x9ab3('0x3f')][_0x9ab3('0x2c')]);_0x3b74dc[_0x9ab3('0x32')]=_['keys'](_0x1990f0[_0x9ab3('0x32')]);_0x3b74dc[_0x9ab3('0x39')]=_[_0x9ab3('0x33')](_0x3b74dc[_0x9ab3('0x30')],_0x3b74dc[_0x9ab3('0x32')]);_0xecdcaf['attributes']=_['intersection'](_0x3b74dc['model'],qs[_0x9ab3('0x34')](_0x1990f0[_0x9ab3('0x32')]['fields']));_0xecdcaf[_0x9ab3('0x35')]=_0xecdcaf[_0x9ab3('0x35')]['length']?_0xecdcaf[_0x9ab3('0x35')]:_0x3b74dc[_0x9ab3('0x30')];if(_0x1990f0[_0x9ab3('0x32')][_0x9ab3('0x40')]){_0xecdcaf[_0x9ab3('0x41')]=[{'all':!![]}];}_0xecdcaf=_['merge']({},_0xecdcaf,_0x1990f0['options']);return db[_0x9ab3('0x3f')][_0x9ab3('0x46')](_0xecdcaf)[_0x9ab3('0x24')](handleEntityNotFound(_0x412119,null))['then'](respondWithResult(_0x412119,null))[_0x9ab3('0x43')](handleError(_0x412119,null));};exports['create']=function(_0x5e29f4,_0x5d1673){return db[_0x9ab3('0x3f')]['create'](_0x5e29f4[_0x9ab3('0x47')],{})[_0x9ab3('0x24')](function(_0x21eb47){var _0x39a30f=_0x5e29f4[_0x9ab3('0x48')][_0x9ab3('0x25')]({'plain':!![]});if(!_0x39a30f)throw new Error(_0x9ab3('0x49'));if(_0x39a30f[_0x9ab3('0x4a')]===_0x9ab3('0x48')){var _0x147249=_0x21eb47[_0x9ab3('0x25')]({'plain':!![]});var _0x14d01e=_0x9ab3('0x4b');return db[_0x9ab3('0x4c')][_0x9ab3('0x46')]({'where':{'name':_0x14d01e,'userProfileId':_0x39a30f[_0x9ab3('0x4d')]},'raw':!![]})[_0x9ab3('0x24')](function(_0x5a1fd3){if(_0x5a1fd3&&_0x5a1fd3[_0x9ab3('0x4e')]===0x0){return db[_0x9ab3('0x27')][_0x9ab3('0x4f')]({'name':_0x147249[_0x9ab3('0x2a')],'resourceId':_0x147249['id'],'type':'CustomReports','sectionId':_0x5a1fd3['id']},{})[_0x9ab3('0x24')](function(){return _0x21eb47;});}else{return _0x21eb47;}})['catch'](function(_0x171897){logger[_0x9ab3('0x50')](_0x9ab3('0x51'),_0x171897);throw _0x171897;});}return _0x21eb47;})['then'](respondWithResult(_0x5d1673,0xc9))[_0x9ab3('0x43')](handleError(_0x5d1673,null));};exports['update']=function(_0x2e6ed7,_0x5c1c54){if(_0x2e6ed7['body']['id']){delete _0x2e6ed7[_0x9ab3('0x47')]['id'];}return db[_0x9ab3('0x3f')][_0x9ab3('0x46')]({'where':{'id':_0x2e6ed7['params']['id']}})[_0x9ab3('0x24')](handleEntityNotFound(_0x5c1c54,null))[_0x9ab3('0x24')](saveUpdates(_0x2e6ed7[_0x9ab3('0x47')],null))[_0x9ab3('0x24')](respondWithResult(_0x5c1c54,null))[_0x9ab3('0x43')](handleError(_0x5c1c54,null));};exports['destroy']=function(_0x335cd6,_0x2105a0){return db['AnalyticCustomReport'][_0x9ab3('0x46')]({'where':{'id':_0x335cd6[_0x9ab3('0x45')]['id']}})[_0x9ab3('0x24')](handleEntityNotFound(_0x2105a0,null))[_0x9ab3('0x24')](removeEntity(_0x2105a0,null))[_0x9ab3('0x43')](handleError(_0x2105a0,null));};exports[_0x9ab3('0x52')]=function(_0xdf11c4,_0x2314ef){var _0x371f6e=0xa;var _0x337ff7=['join','left_join',_0x9ab3('0x53'),_0x9ab3('0x54')];var _0x1e71b9={'SUM':_0x9ab3('0x55'),'COUNT':_0x9ab3('0x56'),'COUNT DISTINCT':_0x9ab3('0x57'),'MAX':_0x9ab3('0x58'),'MIN':_0x9ab3('0x59'),'AVG':_0x9ab3('0x5a'),'GROUP_CONCAT':_0x9ab3('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9ab3('0x5c')};var _0x7180b3={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x9ab3('0x5d'),'UNIX_TIMESTAMP':_0x9ab3('0x5e')};var _0xb51172=function(_0x19298f){return!_[_0x9ab3('0x5f')]([_0x9ab3('0x60'),_0x9ab3('0x61'),'IS\x20EMPTY',_0x9ab3('0x62')],_0x19298f);};var _0x3d9bb7=function(_0x4b3c0c){if(!_0x4b3c0c||!_0x4b3c0c['rules'][_0x9ab3('0x63')]){return'';}for(var _0x7453e2='(',_0x5d9dfc=0x0;_0x5d9dfc<_0x4b3c0c[_0x9ab3('0x64')][_0x9ab3('0x63')];_0x5d9dfc+=0x1){_0x5d9dfc>0x0&&(_0x7453e2+='\x20'+_0x4b3c0c[_0x9ab3('0x65')]+'\x20');_0x7453e2+=_0x4b3c0c[_0x9ab3('0x64')][_0x5d9dfc][_0x9ab3('0x66')]?_0x3d9bb7(_0x4b3c0c[_0x9ab3('0x64')][_0x5d9dfc][_0x9ab3('0x66')]):_0x4b3c0c[_0x9ab3('0x64')][_0x5d9dfc][_0x9ab3('0x67')]+'\x20'+_0x4b3c0c[_0x9ab3('0x64')][_0x5d9dfc][_0x9ab3('0x68')]+(_0xb51172(_0x4b3c0c[_0x9ab3('0x64')][_0x5d9dfc][_0x9ab3('0x68')])?'\x20'+_0x4b3c0c[_0x9ab3('0x64')][_0x5d9dfc]['value']:'');}return _0x7453e2+')';};var _0x588004={'where':{'id':_0xdf11c4[_0x9ab3('0x45')]['id']}},_0x5b7fd7,_0x4290ef,_0x67706d,_0x49a1fd,_0x45ee65;_0x588004=_[_0x9ab3('0x3b')]({},_0x588004,_0xdf11c4[_0x9ab3('0x3e')]);return db['AnalyticCustomReport'][_0x9ab3('0x46')](_0x588004)['then'](function(_0x8f9864){if(_0x8f9864){_0x5b7fd7=_0x8f9864;return _0x8f9864[_0x9ab3('0x69')]();}return null;})[_0x9ab3('0x24')](function(_0x4e7247){if(_0x4e7247){if(!_0x4e7247[_0x9ab3('0x63')]){throw new db[(_0x9ab3('0x6a'))][(_0x9ab3('0x6b'))](_0x9ab3('0x6c'),0x193);}_0x4290ef=_0x4e7247;return db[_0x9ab3('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x9ab3('0x24')](function(_0x2589e8){if(_0x2589e8){_0x67706d=_[_0x9ab3('0x6e')](_0x2589e8,'id');var _0x3eb0c2;var _0x265af5=squel[_0x9ab3('0x6f')]();_0x265af5[_0x9ab3('0x70')](_0x5b7fd7[_0x9ab3('0x71')]);for(var _0x30aeee=0x0;_0x30aeee<_0x4290ef['length'];_0x30aeee+=0x1){_0x3eb0c2=_0x4290ef[_0x30aeee]['MetricId']?_0x67706d[_0x4290ef[_0x30aeee]['MetricId']][_0x9ab3('0x72')]:_0x4290ef[_0x30aeee][_0x9ab3('0x67')];_0x3eb0c2=_0x4290ef[_0x30aeee][_0x9ab3('0x73')]?_[_0x9ab3('0x74')](_0x1e71b9[_0x4290ef[_0x30aeee][_0x9ab3('0x73')]],'%s',_0x3eb0c2):_0x3eb0c2;_0x3eb0c2=_0x4290ef[_0x30aeee][_0x9ab3('0x75')]?_[_0x9ab3('0x74')](_0x7180b3[_0x4290ef[_0x30aeee][_0x9ab3('0x75')]],'%s',_0x3eb0c2):_0x3eb0c2;if(_0x4290ef[_0x30aeee][_0x9ab3('0x76')]){_0x265af5[_0x9ab3('0x66')](_0x3eb0c2);}_0x4290ef[_0x30aeee][_0x9ab3('0x77')]&&_0x265af5['order'](_0x3eb0c2,_0x4290ef[_0x30aeee][_0x9ab3('0x77')]===_0x9ab3('0x78')?![]:!![]);_0x265af5[_0x9ab3('0x67')](_0x3eb0c2,_0x4290ef[_0x30aeee]['alias']||_0x3eb0c2);}if(_0x5b7fd7['joins']){_0x5b7fd7[_0x9ab3('0x79')]=JSON['parse'](_0x5b7fd7[_0x9ab3('0x79')]);for(var _0x311c3f=0x0;_0x311c3f<_0x5b7fd7[_0x9ab3('0x79')][_0x9ab3('0x63')];_0x311c3f+=0x1){if(_0x5b7fd7[_0x9ab3('0x79')][_0x311c3f][_0x9ab3('0x2e')]&&_[_0x9ab3('0x5f')](_0x337ff7,_0x5b7fd7['joins'][_0x311c3f][_0x9ab3('0x2e')])&&_0x5b7fd7['joins'][_0x311c3f][_0x9ab3('0x7a')]&&_0x5b7fd7[_0x9ab3('0x79')][_0x311c3f][_0x9ab3('0x7b')]&&_0x5b7fd7[_0x9ab3('0x79')][_0x311c3f][_0x9ab3('0x7c')]){_0x265af5[_0x5b7fd7[_0x9ab3('0x79')][_0x311c3f]['type']](_0x5b7fd7[_0x9ab3('0x79')][_0x311c3f]['foreignTable'],null,util['format'](_0x9ab3('0x7d'),_0x5b7fd7[_0x9ab3('0x71')],_0x5b7fd7[_0x9ab3('0x79')][_0x311c3f][_0x9ab3('0x7a')],_0x5b7fd7[_0x9ab3('0x79')][_0x311c3f][_0x9ab3('0x7b')],_0x5b7fd7[_0x9ab3('0x79')][_0x311c3f][_0x9ab3('0x7c')]));}}}if(_0x5b7fd7[_0x9ab3('0x7e')]){_0x5b7fd7[_0x9ab3('0x7e')]=JSON[_0x9ab3('0x7f')](_0x5b7fd7['conditions']);_0x265af5['where'](_0x3d9bb7(_0x5b7fd7[_0x9ab3('0x7e')][_0x9ab3('0x66')]));}_0x45ee65=_0x265af5[_0x9ab3('0x80')]();_0x265af5[_0x9ab3('0x1e')](_0x371f6e);_0x265af5[_0x9ab3('0x1c')](0x0);logger[_0x9ab3('0x81')]('Limited\x20Query:',_0x265af5[_0x9ab3('0x82')]());return dbH[_0x9ab3('0x83')][_0x9ab3('0x32')](_0x265af5[_0x9ab3('0x82')](),{'type':dbH[_0x9ab3('0x83')][_0x9ab3('0x84')]['SELECT']});}})[_0x9ab3('0x24')](respondWithResult(_0x2314ef,null))[_0x9ab3('0x43')](handleError(_0x2314ef,null));};function runReport(_0x347f12,_0x4c9dc0,_0x21599d){var _0xaf6320=_0x4c9dc0[_0x9ab3('0x2a')];var _0x490468=0xa;var _0x272081=['join',_0x9ab3('0x85'),_0x9ab3('0x53'),'cross_join'];var _0x15f50f={'SUM':_0x9ab3('0x55'),'COUNT':_0x9ab3('0x56'),'COUNT DISTINCT':_0x9ab3('0x57'),'MAX':_0x9ab3('0x58'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x9ab3('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x55c1fa={'SEC_TO_TIME':_0x9ab3('0x86'),'DATE':_0x9ab3('0x87'),'HOUR':'HOUR(%s)','ROUND':_0x9ab3('0x5d'),'UNIX_TIMESTAMP':_0x9ab3('0x5e')};var _0x5417e7=function(_0x10a199){return!_[_0x9ab3('0x5f')](['IS\x20NULL',_0x9ab3('0x61'),_0x9ab3('0x88'),'IS\x20NOT\x20EMPTY'],_0x10a199);};var _0x4c5b1c=function(_0x10f63c){if(!_0x10f63c||!_0x10f63c[_0x9ab3('0x64')]['length']){return'';}for(var _0x5138e6='(',_0x2cfe8d=0x0;_0x2cfe8d<_0x10f63c[_0x9ab3('0x64')][_0x9ab3('0x63')];_0x2cfe8d+=0x1){_0x2cfe8d>0x0&&(_0x5138e6+='\x20'+_0x10f63c[_0x9ab3('0x65')]+'\x20');_0x5138e6+=_0x10f63c['rules'][_0x2cfe8d][_0x9ab3('0x66')]?_0x4c5b1c(_0x10f63c['rules'][_0x2cfe8d][_0x9ab3('0x66')]):_0x10f63c[_0x9ab3('0x64')][_0x2cfe8d][_0x9ab3('0x67')]+'\x20'+_0x10f63c[_0x9ab3('0x64')][_0x2cfe8d][_0x9ab3('0x68')]+(_0x5417e7(_0x10f63c[_0x9ab3('0x64')][_0x2cfe8d][_0x9ab3('0x68')])?'\x20'+_0x10f63c[_0x9ab3('0x64')][_0x2cfe8d]['value']:'');}return _0x5138e6+')';};var _0x2e9e97={'where':{'id':_0x347f12['id']}},_0x2e16b6,_0x186aa,_0xf7b80e,_0x249dc9,_0x29103c;_0x2e9e97=_['merge']({},_0x2e9e97,_0x21599d);return db['AnalyticCustomReport'][_0x9ab3('0x46')](_0x2e9e97)[_0x9ab3('0x24')](function(_0x35fc08){if(_0x35fc08){_0x2e16b6=_0x35fc08;return _0x35fc08['getFields']();}return null;})[_0x9ab3('0x24')](function(_0x2d5d6e){if(_0x2d5d6e){if(!_0x2d5d6e[_0x9ab3('0x63')]){throw new db[(_0x9ab3('0x6a'))]['ValidationErrorItem'](_0x9ab3('0x6c'),0x193);}_0x186aa=_0x2d5d6e;return db['AnalyticMetric'][_0x9ab3('0x42')]({'raw':!![]});}return null;})[_0x9ab3('0x24')](function(_0x1e8a66){if(_0x1e8a66){_0xf7b80e=_[_0x9ab3('0x6e')](_0x1e8a66,'id');var _0x53ff76;var _0x3d9074=squel[_0x9ab3('0x6f')]();_0x3d9074[_0x9ab3('0x70')](_0x2e16b6['table']);for(var _0x486c5f=0x0;_0x486c5f<_0x186aa[_0x9ab3('0x63')];_0x486c5f+=0x1){_0x53ff76=_0x186aa[_0x486c5f][_0x9ab3('0x89')]?_0xf7b80e[_0x186aa[_0x486c5f]['MetricId']][_0x9ab3('0x72')]:_0x186aa[_0x486c5f]['field'];_0x53ff76=_0x186aa[_0x486c5f]['function']?_[_0x9ab3('0x74')](_0x15f50f[_0x186aa[_0x486c5f][_0x9ab3('0x73')]],'%s',_0x53ff76):_0x53ff76;_0x53ff76=_0x186aa[_0x486c5f][_0x9ab3('0x75')]?_['replace'](_0x55c1fa[_0x186aa[_0x486c5f]['format']],'%s',_0x53ff76):_0x53ff76;if(_0x186aa[_0x486c5f][_0x9ab3('0x76')]){_0x3d9074[_0x9ab3('0x66')](_0x53ff76);}_0x186aa[_0x486c5f][_0x9ab3('0x77')]&&_0x3d9074[_0x9ab3('0x37')](_0x53ff76,_0x186aa[_0x486c5f][_0x9ab3('0x77')]===_0x9ab3('0x78')?![]:!![]);_0x3d9074[_0x9ab3('0x67')](_0x53ff76,_0x186aa[_0x486c5f][_0x9ab3('0x8a')]||_0x53ff76);}if(_0x2e16b6[_0x9ab3('0x79')]){_0x2e16b6['joins']=JSON['parse'](_0x2e16b6[_0x9ab3('0x79')]);for(var _0x1f3fa3=0x0;_0x1f3fa3<_0x2e16b6[_0x9ab3('0x79')][_0x9ab3('0x63')];_0x1f3fa3+=0x1){if(_0x2e16b6[_0x9ab3('0x79')][_0x1f3fa3][_0x9ab3('0x2e')]&&_[_0x9ab3('0x5f')](_0x272081,_0x2e16b6[_0x9ab3('0x79')][_0x1f3fa3][_0x9ab3('0x2e')])&&_0x2e16b6[_0x9ab3('0x79')][_0x1f3fa3]['parentKey']&&_0x2e16b6[_0x9ab3('0x79')][_0x1f3fa3][_0x9ab3('0x7b')]&&_0x2e16b6[_0x9ab3('0x79')][_0x1f3fa3]['foreignKey']){_0x3d9074[_0x2e16b6['joins'][_0x1f3fa3][_0x9ab3('0x2e')]](_0x2e16b6[_0x9ab3('0x79')][_0x1f3fa3][_0x9ab3('0x7b')],null,util[_0x9ab3('0x75')](_0x9ab3('0x7d'),_0x2e16b6['table'],_0x2e16b6[_0x9ab3('0x79')][_0x1f3fa3]['parentKey'],_0x2e16b6[_0x9ab3('0x79')][_0x1f3fa3][_0x9ab3('0x7b')],_0x2e16b6[_0x9ab3('0x79')][_0x1f3fa3][_0x9ab3('0x7c')]));}}}if(_0x2e16b6[_0x9ab3('0x7e')]){_0x2e16b6[_0x9ab3('0x7e')]=JSON[_0x9ab3('0x7f')](_0x2e16b6['conditions']);_0x3d9074[_0x9ab3('0x3a')](_0x4c5b1c(_0x2e16b6[_0x9ab3('0x7e')][_0x9ab3('0x66')]));}_0x29103c=_0x3d9074[_0x9ab3('0x80')]();_0x3d9074[_0x9ab3('0x1e')](_0x490468);_0x3d9074[_0x9ab3('0x1c')](0x0);return;}})[_0x9ab3('0x24')](function(){if(_0x4c9dc0[_0x9ab3('0x8b')]===_0x9ab3('0x8c')){return null;}var _0x5df223=_['merge'](_0x4c9dc0,{'name':_0x4c9dc0[_0x9ab3('0x8d')]||_0x4c9dc0[_0x9ab3('0x2a')]||_0x2e16b6[_0x9ab3('0x2a')],'basename':_0xaf6320,'savename':util[_0x9ab3('0x75')]('%s-%s.%s',_0x4c9dc0[_0x9ab3('0x2a')]||_0x2e16b6['name'],require(_0x9ab3('0x8e'))[_0x9ab3('0x8f')](0x4),_0x4c9dc0['output']||_0x9ab3('0x90')),'reportId':_0x2e16b6['id'],'reportType':_0x9ab3('0x91')});return db[_0x9ab3('0x92')][_0x9ab3('0x4f')](_0x5df223,{'raw':!![]});})[_0x9ab3('0x24')](function(_0x33246e){if(_0x2e16b6[_0x9ab3('0x71')]==='cdr'){_0x29103c[_0x9ab3('0x3a')](_0x2e16b6['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4c9dc0[_0x9ab3('0x93')],_0x4c9dc0[_0x9ab3('0x94')]);}else{_0x29103c[_0x9ab3('0x3a')](_0x2e16b6[_0x9ab3('0x71')]+_0x9ab3('0x95'),_0x4c9dc0[_0x9ab3('0x93')],_0x4c9dc0['endDate']);}if(_0x33246e){logger['info']('Run\x20Query:',_0x29103c['toString']());require(_0x9ab3('0x96'))['fork'](path[_0x9ab3('0x97')](__dirname,_0x9ab3('0x98'),_0x33246e['output']),[_0x33246e['id'],_0x29103c[_0x9ab3('0x82')](),path[_0x9ab3('0x97')](__dirname,'../../files/reports',_0x33246e['savename']),_0xaf6320]);return _0x33246e;}else{var _0x4559f6=squel[_0x9ab3('0x6f')]();_0x4559f6[_0x9ab3('0x70')]('('+_0x29103c[_0x9ab3('0x82')]()+')',_0x9ab3('0x99'));_0x4559f6[_0x9ab3('0x67')](_0x9ab3('0x9a'),_0x9ab3('0x1d'));_0x29103c[_0x9ab3('0x1e')](_0x4c9dc0['limit']||_0x490468);_0x29103c[_0x9ab3('0x1c')](_0x4c9dc0['offset']||0x0);return dbH[_0x9ab3('0x83')][_0x9ab3('0x32')](_0x4559f6['toString'](),{'type':dbH[_0x9ab3('0x83')][_0x9ab3('0x84')]['SELECT']})[_0x9ab3('0x24')](function(_0x4e85a4){if(!_0x4e85a4[_0x9ab3('0x63')]){_0x249dc9=0x0;}else{_0x249dc9=_0x4e85a4[0x0]['count']||0x0;}return dbH[_0x9ab3('0x83')]['query'](_0x29103c[_0x9ab3('0x82')](),{'type':dbH[_0x9ab3('0x83')][_0x9ab3('0x84')][_0x9ab3('0x9b')]});})[_0x9ab3('0x24')](function(_0x59fc1d){return{'rows':_0x59fc1d||[],'count':_0x249dc9};});}});}exports[_0x9ab3('0x9c')]=function(_0x3600fa,_0x5acfe9){return runReport(_0x3600fa[_0x9ab3('0x45')],_0x3600fa[_0x9ab3('0x32')],_0x3600fa[_0x9ab3('0x3e')])[_0x9ab3('0x24')](respondWithResult(_0x5acfe9,null))['catch'](handleError(_0x5acfe9,null));};exports[_0x9ab3('0x9d')]=runReport;exports[_0x9ab3('0x32')]=function(_0x372b76,_0x4a7da5){var _0xa20dc8=0xa;var _0x136bf8=[_0x9ab3('0x97'),_0x9ab3('0x85'),_0x9ab3('0x53'),_0x9ab3('0x54')];var _0x487e74={'SUM':_0x9ab3('0x55'),'COUNT':_0x9ab3('0x56'),'COUNT DISTINCT':_0x9ab3('0x57'),'MAX':_0x9ab3('0x58'),'MIN':_0x9ab3('0x59'),'AVG':_0x9ab3('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x9ab3('0x9e'),'GROUP_CONCAT DESC':_0x9ab3('0x5c')};var _0x54e586={'SEC_TO_TIME':_0x9ab3('0x86'),'DATE':_0x9ab3('0x87'),'HOUR':_0x9ab3('0x9f'),'ROUND':_0x9ab3('0x5d'),'UNIX_TIMESTAMP':_0x9ab3('0x5e')};var _0x105bbf=function(_0x27b886){return!_['includes'](['IS\x20NULL',_0x9ab3('0x61'),'IS\x20EMPTY',_0x9ab3('0x62')],_0x27b886);};var _0x1ac119=function(_0x39b731){if(!_0x39b731||!_0x39b731[_0x9ab3('0x64')][_0x9ab3('0x63')]){return'';}for(var _0x3eecc3='(',_0x443b08=0x0;_0x443b08<_0x39b731[_0x9ab3('0x64')][_0x9ab3('0x63')];_0x443b08+=0x1){_0x443b08>0x0&&(_0x3eecc3+='\x20'+_0x39b731[_0x9ab3('0x65')]+'\x20');_0x3eecc3+=_0x39b731[_0x9ab3('0x64')][_0x443b08][_0x9ab3('0x66')]?_0x1ac119(_0x39b731[_0x9ab3('0x64')][_0x443b08][_0x9ab3('0x66')]):_0x39b731['rules'][_0x443b08][_0x9ab3('0x67')]+'\x20'+_0x39b731['rules'][_0x443b08]['condition']+(_0x105bbf(_0x39b731[_0x9ab3('0x64')][_0x443b08][_0x9ab3('0x68')])?'\x20'+_0x39b731[_0x9ab3('0x64')][_0x443b08][_0x9ab3('0xa0')]:'');}return _0x3eecc3+')';};var _0xc392af={'where':{'id':_0x372b76[_0x9ab3('0x45')]['id']}},_0xb71c1f,_0x410554,_0x3069eb,_0x4009a6,_0x376cc1;_0xc392af=_['merge']({},_0xc392af,_0x372b76[_0x9ab3('0x3e')]);return db['AnalyticCustomReport'][_0x9ab3('0x46')](_0xc392af)[_0x9ab3('0x24')](function(_0x31b415){if(_0x31b415){_0xb71c1f=_0x31b415;return _0x31b415[_0x9ab3('0x69')]();}return null;})[_0x9ab3('0x24')](function(_0x513664){if(_0x513664){if(!_0x513664['length']){throw new db[(_0x9ab3('0x6a'))][(_0x9ab3('0x6b'))](_0x9ab3('0x6c'),0x193);}_0x410554=_0x513664;return db[_0x9ab3('0x6d')][_0x9ab3('0x42')]({'raw':!![]});}return null;})[_0x9ab3('0x24')](function(_0x6d57df){if(_0x6d57df){_0x3069eb=_[_0x9ab3('0x6e')](_0x6d57df,'id');var _0x9cc32d;var _0x34dc7e=squel['select']();_0x34dc7e[_0x9ab3('0x70')](_0xb71c1f['table']);for(var _0x2793a1=0x0;_0x2793a1<_0x410554[_0x9ab3('0x63')];_0x2793a1+=0x1){_0x9cc32d=_0x410554[_0x2793a1][_0x9ab3('0x89')]?_0x3069eb[_0x410554[_0x2793a1][_0x9ab3('0x89')]][_0x9ab3('0x72')]:_0x410554[_0x2793a1]['field'];_0x9cc32d=_0x410554[_0x2793a1][_0x9ab3('0x73')]?_[_0x9ab3('0x74')](_0x487e74[_0x410554[_0x2793a1]['function']],'%s',_0x9cc32d):_0x9cc32d;_0x9cc32d=_0x410554[_0x2793a1][_0x9ab3('0x75')]?_[_0x9ab3('0x74')](_0x54e586[_0x410554[_0x2793a1][_0x9ab3('0x75')]],'%s',_0x9cc32d):_0x9cc32d;if(_0x410554[_0x2793a1]['groupBy']){_0x34dc7e[_0x9ab3('0x66')](_0x9cc32d);}_0x410554[_0x2793a1]['orderBy']&&_0x34dc7e[_0x9ab3('0x37')](_0x9cc32d,_0x410554[_0x2793a1][_0x9ab3('0x77')]==='DESC'?![]:!![]);_0x34dc7e[_0x9ab3('0x67')](_0x9cc32d,_0x410554[_0x2793a1][_0x9ab3('0x8a')]||_0x9cc32d);}if(_0xb71c1f[_0x9ab3('0x79')]){_0xb71c1f[_0x9ab3('0x79')]=JSON[_0x9ab3('0x7f')](_0xb71c1f['joins']);for(var _0x7a38b8=0x0;_0x7a38b8<_0xb71c1f['joins']['length'];_0x7a38b8+=0x1){if(_0xb71c1f['joins'][_0x7a38b8][_0x9ab3('0x2e')]&&_[_0x9ab3('0x5f')](_0x136bf8,_0xb71c1f[_0x9ab3('0x79')][_0x7a38b8][_0x9ab3('0x2e')])&&_0xb71c1f[_0x9ab3('0x79')][_0x7a38b8][_0x9ab3('0x7a')]&&_0xb71c1f[_0x9ab3('0x79')][_0x7a38b8][_0x9ab3('0x7b')]&&_0xb71c1f['joins'][_0x7a38b8][_0x9ab3('0x7c')]){_0x34dc7e[_0xb71c1f[_0x9ab3('0x79')][_0x7a38b8][_0x9ab3('0x2e')]](_0xb71c1f['joins'][_0x7a38b8][_0x9ab3('0x7b')],null,util['format'](_0x9ab3('0x7d'),_0xb71c1f[_0x9ab3('0x71')],_0xb71c1f[_0x9ab3('0x79')][_0x7a38b8]['parentKey'],_0xb71c1f[_0x9ab3('0x79')][_0x7a38b8][_0x9ab3('0x7b')],_0xb71c1f[_0x9ab3('0x79')][_0x7a38b8][_0x9ab3('0x7c')]));}}}if(_0xb71c1f[_0x9ab3('0x7e')]){_0xb71c1f[_0x9ab3('0x7e')]=JSON[_0x9ab3('0x7f')](_0xb71c1f[_0x9ab3('0x7e')]);_0x34dc7e[_0x9ab3('0x3a')](_0x1ac119(_0xb71c1f[_0x9ab3('0x7e')][_0x9ab3('0x66')]));}_0x376cc1=_0x34dc7e[_0x9ab3('0x80')]();_0x34dc7e['limit'](_0xa20dc8);_0x34dc7e[_0x9ab3('0x1c')](0x0);logger[_0x9ab3('0x81')](_0x9ab3('0xa1'),_0x34dc7e[_0x9ab3('0x82')]());return dbH[_0x9ab3('0x83')][_0x9ab3('0x32')](_0x34dc7e[_0x9ab3('0x82')](),{'type':dbH['sequelize'][_0x9ab3('0x84')][_0x9ab3('0x9b')]});}})['then'](function(){return{'sql':_0x376cc1[_0x9ab3('0x82')]()};})['then'](respondWithResult(_0x4a7da5,null))['catch'](handleError(_0x4a7da5,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index fa2a4e9..a757f36 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 _0x2e94=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash'];(function(_0x1b1462,_0x49a3b7){var _0x2d705a=function(_0x265c12){while(--_0x265c12){_0x1b1462['push'](_0x1b1462['shift']());}};_0x2d705a(++_0x49a3b7);}(_0x2e94,0x1b1));var _0x42e9=function(_0x513507,_0x1ea38d){_0x513507=_0x513507-0x0;var _0x3418c6=_0x2e94[_0x513507];return _0x3418c6;};'use strict';var _=require(_0x42e9('0x0'));var util=require(_0x42e9('0x1'));var logger=require(_0x42e9('0x2'))(_0x42e9('0x3'));var moment=require(_0x42e9('0x4'));var BPromise=require(_0x42e9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x42e9('0x6'));var rimraf=require(_0x42e9('0x7'));var config=require(_0x42e9('0x8'));var attributes=require(_0x42e9('0x9'));module[_0x42e9('0xa')]=function(_0x47641d,_0x2d40fd){return _0x47641d[_0x42e9('0xb')](_0x42e9('0xc'),attributes,{'tableName':_0x42e9('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd848=['lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticCustomReport'];(function(_0xd4f62,_0x4cf744){var _0x167496=function(_0x7046ef){while(--_0x7046ef){_0xd4f62['push'](_0xd4f62['shift']());}};_0x167496(++_0x4cf744);}(_0xd848,0x172));var _0x8d84=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0xd848[_0x725a4c];return _0x37b2cc;};'use strict';var _=require(_0x8d84('0x0'));var util=require('util');var logger=require(_0x8d84('0x1'))('api');var moment=require(_0x8d84('0x2'));var BPromise=require('bluebird');var rp=require(_0x8d84('0x3'));var fs=require('fs');var path=require(_0x8d84('0x4'));var rimraf=require(_0x8d84('0x5'));var config=require(_0x8d84('0x6'));var attributes=require('./analyticCustomReport.attributes');module[_0x8d84('0x7')]=function(_0x3ebd9f,_0x1c78e0){return _0x3ebd9f[_0x8d84('0x8')](_0x8d84('0x9'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 235b505..cbc2750 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 _0x84f4=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result'];(function(_0x3bf925,_0x4dd8e4){var _0x2128a1=function(_0x4d2049){while(--_0x4d2049){_0x3bf925['push'](_0x3bf925['shift']());}};_0x2128a1(++_0x4dd8e4);}(_0x84f4,0xc8));var _0x484f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84f4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x484f('0x0'));var util=require(_0x484f('0x1'));var moment=require(_0x484f('0x2'));var BPromise=require('bluebird');var rs=require(_0x484f('0x3'));var fs=require('fs');var Redis=require(_0x484f('0x4'));var db=require(_0x484f('0x5'))['db'];var utils=require(_0x484f('0x6'));var logger=require('../../config/logger')(_0x484f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x484f('0x8')][_0x484f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43202a,_0x2b0931,_0x4836f6){return new BPromise(function(_0x4c7f13,_0x24270d){return client['request'](_0x43202a,_0x4836f6)['then'](function(_0x506551){logger[_0x484f('0xa')](_0x484f('0xb'),_0x2b0931,'request\x20sent');logger[_0x484f('0xc')](_0x484f('0xd'),_0x2b0931,'request\x20sent',JSON[_0x484f('0xe')](_0x506551));if(_0x506551['error']){if(_0x506551['error'][_0x484f('0xf')]===0x1f4){logger[_0x484f('0x10')](_0x484f('0xb'),_0x2b0931,_0x506551[_0x484f('0x10')][_0x484f('0x11')]);return _0x24270d(_0x506551['error']['message']);}logger[_0x484f('0x10')](_0x484f('0xb'),_0x2b0931,_0x506551['error'][_0x484f('0x11')]);return _0x4c7f13(_0x506551[_0x484f('0x10')][_0x484f('0x11')]);}else{logger[_0x484f('0xa')](_0x484f('0xb'),_0x2b0931,_0x484f('0x12'));_0x4c7f13(_0x506551[_0x484f('0x13')][_0x484f('0x11')]);}})['catch'](function(_0x4d7313){logger['error'](_0x484f('0xb'),_0x2b0931,_0x4d7313);_0x24270d(_0x4d7313);});});} \ No newline at end of file +var _0xfbb4=['util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash'];(function(_0x58ea32,_0x17c124){var _0x28273e=function(_0x8899ac){while(--_0x8899ac){_0x58ea32['push'](_0x58ea32['shift']());}};_0x28273e(++_0x17c124);}(_0xfbb4,0x11d));var _0x4fbb=function(_0x150d71,_0x4248ac){_0x150d71=_0x150d71-0x0;var _0xb16309=_0xfbb4[_0x150d71];return _0xb16309;};'use strict';var _=require(_0x4fbb('0x0'));var util=require(_0x4fbb('0x1'));var moment=require(_0x4fbb('0x2'));var BPromise=require(_0x4fbb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4fbb('0x4'));var db=require(_0x4fbb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4fbb('0x6'));var config=require('../../config/environment');var jayson=require(_0x4fbb('0x7'));var client=jayson[_0x4fbb('0x8')][_0x4fbb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54f522,_0x23f396,_0x3b6838){return new BPromise(function(_0x5448b3,_0x4b654e){return client[_0x4fbb('0xa')](_0x54f522,_0x3b6838)[_0x4fbb('0xb')](function(_0x45a890){logger['info'](_0x4fbb('0xc'),_0x23f396,_0x4fbb('0xd'));logger[_0x4fbb('0xe')](_0x4fbb('0xf'),_0x23f396,'request\x20sent',JSON[_0x4fbb('0x10')](_0x45a890));if(_0x45a890[_0x4fbb('0x11')]){if(_0x45a890['error'][_0x4fbb('0x12')]===0x1f4){logger[_0x4fbb('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x23f396,_0x45a890['error'][_0x4fbb('0x13')]);return _0x4b654e(_0x45a890[_0x4fbb('0x11')][_0x4fbb('0x13')]);}logger[_0x4fbb('0x11')](_0x4fbb('0xc'),_0x23f396,_0x45a890[_0x4fbb('0x11')][_0x4fbb('0x13')]);return _0x5448b3(_0x45a890[_0x4fbb('0x11')][_0x4fbb('0x13')]);}else{logger[_0x4fbb('0x14')](_0x4fbb('0xc'),_0x23f396,'request\x20sent');_0x5448b3(_0x45a890['result'][_0x4fbb('0x13')]);}})[_0x4fbb('0x15')](function(_0x482131){logger[_0x4fbb('0x11')](_0x4fbb('0xc'),_0x23f396,_0x482131);_0x4b654e(_0x482131);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index a1ff239..be3436f 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 _0xecf9=['post','create','put','update','exports','multer','path','express','Router','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','/:id','/:id/preview','preview','/:id/run','run','/:id/query'];(function(_0x7d293c,_0x3e8749){var _0x170c93=function(_0x169089){while(--_0x169089){_0x7d293c['push'](_0x7d293c['shift']());}};_0x170c93(++_0x3e8749);}(_0xecf9,0x64));var _0x9ecf=function(_0x865ddc,_0x39b273){_0x865ddc=_0x865ddc-0x0;var _0x5c6527=_0xecf9[_0x865ddc];return _0x5c6527;};'use strict';var multer=require(_0x9ecf('0x0'));var util=require('util');var path=require(_0x9ecf('0x1'));var timeout=require('connect-timeout');var express=require(_0x9ecf('0x2'));var router=express[_0x9ecf('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9ecf('0x4'));var controller=require(_0x9ecf('0x5'));router[_0x9ecf('0x6')]('/',auth[_0x9ecf('0x7')](),controller['index']);router[_0x9ecf('0x6')](_0x9ecf('0x8'),auth['isAuthenticated'](),controller['show']);router['get'](_0x9ecf('0x9'),auth[_0x9ecf('0x7')](),controller[_0x9ecf('0xa')]);router[_0x9ecf('0x6')](_0x9ecf('0xb'),auth['isAuthenticated'](),controller[_0x9ecf('0xc')]);router[_0x9ecf('0x6')](_0x9ecf('0xd'),auth[_0x9ecf('0x7')](),controller['query']);router[_0x9ecf('0xe')]('/',auth[_0x9ecf('0x7')](),controller[_0x9ecf('0xf')]);router[_0x9ecf('0x10')](_0x9ecf('0x8'),auth[_0x9ecf('0x7')](),controller[_0x9ecf('0x11')]);router['delete'](_0x9ecf('0x8'),auth[_0x9ecf('0x7')](),controller['destroy']);module[_0x9ecf('0x12')]=router; \ No newline at end of file +var _0x17aa=['create','update','delete','destroy','multer','util','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','/:id/query'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0x17aa,0xd0));var _0xa17a=function(_0x5ac555,_0x391cf2){_0x5ac555=_0x5ac555-0x0;var _0x318588=_0x17aa[_0x5ac555];return _0x318588;};'use strict';var multer=require(_0xa17a('0x0'));var util=require(_0xa17a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa17a('0x2'));var auth=require(_0xa17a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa17a('0x4'));var controller=require(_0xa17a('0x5'));router['get']('/',auth[_0xa17a('0x6')](),controller[_0xa17a('0x7')]);router[_0xa17a('0x8')](_0xa17a('0x9'),auth[_0xa17a('0x6')](),controller[_0xa17a('0xa')]);router[_0xa17a('0x8')](_0xa17a('0xb'),auth[_0xa17a('0x6')](),controller['preview']);router[_0xa17a('0x8')]('/:id/run',auth['isAuthenticated'](),controller['run']);router[_0xa17a('0x8')](_0xa17a('0xc'),auth['isAuthenticated'](),controller['query']);router['post']('/',auth[_0xa17a('0x6')](),controller[_0xa17a('0xd')]);router['put'](_0xa17a('0x9'),auth['isAuthenticated'](),controller[_0xa17a('0xe')]);router[_0xa17a('0xf')](_0xa17a('0x9'),auth[_0xa17a('0x6')](),controller[_0xa17a('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index c4678ad..a599ab3 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 _0x7dfd=['STRING','TEXT','sequelize','exports'];(function(_0x120ea,_0x42f799){var _0xd2ddaf=function(_0x4cbc7c){while(--_0x4cbc7c){_0x120ea['push'](_0x120ea['shift']());}};_0xd2ddaf(++_0x42f799);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'name':{'type':Sequelize[_0xd7df('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd7df('0x2')]},'parent':{'type':Sequelize[_0xd7df('0x2')]},'table':{'type':Sequelize[_0xd7df('0x2')]},'conditions':{'type':Sequelize[_0xd7df('0x3')]},'joins':{'type':Sequelize[_0xd7df('0x3')]}}; \ No newline at end of file +var _0xabce=['exports','STRING','TEXT','sequelize'];(function(_0x289daa,_0x13325f){var _0x14f874=function(_0x5894ad){while(--_0x5894ad){_0x289daa['push'](_0x289daa['shift']());}};_0x14f874(++_0x13325f);}(_0xabce,0x103));var _0xeabc=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xabce[_0x5e3b04];return _0x1fc44d;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'name':{'type':Sequelize[_0xeabc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xeabc('0x2')]},'parent':{'type':Sequelize[_0xeabc('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xeabc('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 628a148..20642cc 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda19=['ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','field','function','replace','groupBy','orderBy','order','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','operator','Sequelize','metric','format','DESC','parse','parentKey','web','output','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','run','runReport','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','status','json','offset','undefined','limit','count','set','apply','update','then','DefaultReports','destroy','end','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','merge','includeAll','include','findAll','show','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','value','options','find','getFields'];(function(_0x320f33,_0x1db212){var _0x217d1e=function(_0x3c068){while(--_0x3c068){_0x320f33['push'](_0x320f33['shift']());}};_0x217d1e(++_0x1db212);}(_0xda19,0xd5));var _0x9da1=function(_0x1624f4,_0x5e19e6){_0x1624f4=_0x1624f4-0x0;var _0x1d4c97=_0xda19[_0x1624f4];return _0x1d4c97;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9da1('0x0'));var zipdir=require(_0x9da1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9da1('0x2'));var moment=require('moment');var BPromise=require(_0x9da1('0x3'));var Mustache=require('mustache');var util=require(_0x9da1('0x4'));var path=require(_0x9da1('0x5'));var sox=require(_0x9da1('0x6'));var csv=require(_0x9da1('0x7'));var ejs=require(_0x9da1('0x8'));var fs=require('fs');var fs_extra=require(_0x9da1('0x9'));var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var as=require(_0x9da1('0x11'));var hardwareService=require(_0x9da1('0x12'));var logger=require(_0x9da1('0x13'))(_0x9da1('0x14'));var utils=require(_0x9da1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9da1('0x16'))['db'];var dbH=require('../../mysqldb')[_0x9da1('0x17')];function respondWithStatusCode(_0x1d93f8,_0xd2d225){_0xd2d225=_0xd2d225||0xcc;return function(_0x1ffa2a){if(_0x1ffa2a){return _0x1d93f8['sendStatus'](_0xd2d225);}return _0x1d93f8[_0x9da1('0x18')](_0xd2d225)['end']();};}function respondWithResult(_0x4d17e1,_0x40ba9d){_0x40ba9d=_0x40ba9d||0xc8;return function(_0x479ccd){if(_0x479ccd){return _0x4d17e1[_0x9da1('0x18')](_0x40ba9d)[_0x9da1('0x19')](_0x479ccd);}};}function respondWithFilteredResult(_0x37653d,_0x1a1a6b){return function(_0x7f1a64){if(_0x7f1a64){var _0x514d8e=typeof _0x1a1a6b[_0x9da1('0x1a')]===_0x9da1('0x1b')&&typeof _0x1a1a6b[_0x9da1('0x1c')]===_0x9da1('0x1b');var _0xfb278d=_0x7f1a64[_0x9da1('0x1d')];var _0x497676=_0x514d8e?0x0:_0x1a1a6b['offset'];var _0x17205d=_0x514d8e?_0x7f1a64[_0x9da1('0x1d')]:_0x1a1a6b[_0x9da1('0x1a')]+_0x1a1a6b[_0x9da1('0x1c')];var _0x40a967;if(_0x17205d>=_0xfb278d){_0x17205d=_0xfb278d;_0x40a967=0xc8;}else{_0x40a967=0xce;}_0x37653d[_0x9da1('0x18')](_0x40a967);return _0x37653d[_0x9da1('0x1e')]('Content-Range',_0x497676+'-'+_0x17205d+'/'+_0xfb278d)[_0x9da1('0x19')](_0x7f1a64);}return null;};}function patchUpdates(_0x554845){return function(_0x9c3b37){try{jsonpatch[_0x9da1('0x1f')](_0x9c3b37,_0x554845,!![]);}catch(_0x1fc065){return BPromise['reject'](_0x1fc065);}return _0x9c3b37['save']();};}function saveUpdates(_0x14793b,_0x3e6f85){return function(_0x16ee0c){if(_0x16ee0c){return _0x16ee0c[_0x9da1('0x20')](_0x14793b)[_0x9da1('0x21')](function(_0x165b73){return _0x165b73;});}return null;};}function removeEntity(_0x4c60aa,_0x2413fe){return function(_0x3bfa40){if(_0x3bfa40){return _0x3bfa40['destroy']()[_0x9da1('0x21')](function(){var _0x3f5680=_0x3bfa40['get']({'plain':!![]});var _0x2fd49c=_0x9da1('0x22');return db['UserProfileResource'][_0x9da1('0x23')]({'where':{'type':_0x2fd49c,'resourceId':_0x3f5680['id']}})[_0x9da1('0x21')](function(){return _0x3bfa40;});})['then'](function(){_0x4c60aa['status'](0xcc)[_0x9da1('0x24')]();});}};}function handleEntityNotFound(_0x47055e,_0x5eca5b){return function(_0x27c6e2){if(!_0x27c6e2){_0x47055e['sendStatus'](0x194);}return _0x27c6e2;};}function handleError(_0x5a6f2d,_0x5a59c2){_0x5a59c2=_0x5a59c2||0x1f4;return function(_0x31b826){logger[_0x9da1('0x25')](_0x31b826[_0x9da1('0x26')]);if(_0x31b826[_0x9da1('0x27')]){delete _0x31b826[_0x9da1('0x27')];}_0x5a6f2d['status'](_0x5a59c2)[_0x9da1('0x28')](_0x31b826);};}exports['index']=function(_0x1feae0,_0x235ced){var _0x5b38b3={},_0xc29ba8={},_0x2eb48f={'count':0x0,'rows':[]};var _0x4f318b=_[_0x9da1('0x29')](db[_0x9da1('0x2a')][_0x9da1('0x2b')],function(_0x2b2b48){return{'name':_0x2b2b48['fieldName'],'type':_0x2b2b48['type'][_0x9da1('0x2c')]};});_0xc29ba8[_0x9da1('0x2d')]=_[_0x9da1('0x29')](_0x4f318b,_0x9da1('0x27'));_0xc29ba8[_0x9da1('0x2e')]=_['keys'](_0x1feae0[_0x9da1('0x2e')]);_0xc29ba8[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xc29ba8[_0x9da1('0x2d')],_0xc29ba8[_0x9da1('0x2e')]);_0x5b38b3[_0x9da1('0x31')]=_['intersection'](_0xc29ba8[_0x9da1('0x2d')],qs['fields'](_0x1feae0['query'][_0x9da1('0x32')]));_0x5b38b3['attributes']=_0x5b38b3[_0x9da1('0x31')][_0x9da1('0x33')]?_0x5b38b3[_0x9da1('0x31')]:_0xc29ba8[_0x9da1('0x2d')];if(!_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x34')](_0x9da1('0x35'))){_0x5b38b3[_0x9da1('0x1c')]=qs['limit'](_0x1feae0[_0x9da1('0x2e')]['limit']);_0x5b38b3[_0x9da1('0x1a')]=qs['offset'](_0x1feae0['query'][_0x9da1('0x1a')]);}_0x5b38b3['order']=qs[_0x9da1('0x36')](_0x1feae0[_0x9da1('0x2e')]['sort']);_0x5b38b3[_0x9da1('0x37')]=qs[_0x9da1('0x2f')](_[_0x9da1('0x38')](_0x1feae0[_0x9da1('0x2e')],_0xc29ba8['filters']),_0x4f318b);if(_0x1feae0[_0x9da1('0x2e')]['filter']){_0x5b38b3[_0x9da1('0x37')]=_['merge'](_0x5b38b3[_0x9da1('0x37')],{'$or':_[_0x9da1('0x29')](_0x4f318b,function(_0x58e165){if(_0x58e165[_0x9da1('0x39')]!==_0x9da1('0x3a')){var _0x394acf={};_0x394acf[_0x58e165['name']]={'$like':'%'+_0x1feae0['query']['filter']+'%'};return _0x394acf;}})});}_0x5b38b3=_[_0x9da1('0x3b')]({},_0x5b38b3,_0x1feae0['options']);var _0x5b215c={'where':_0x5b38b3[_0x9da1('0x37')]};return db[_0x9da1('0x2a')][_0x9da1('0x1d')](_0x5b215c)['then'](function(_0x42dbd8){_0x2eb48f[_0x9da1('0x1d')]=_0x42dbd8;if(_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x3c')]){_0x5b38b3[_0x9da1('0x3d')]=[{'all':!![]}];}return db[_0x9da1('0x2a')][_0x9da1('0x3e')](_0x5b38b3);})['then'](function(_0x467350){_0x2eb48f['rows']=_0x467350;return _0x2eb48f;})[_0x9da1('0x21')](respondWithFilteredResult(_0x235ced,_0x5b38b3))['catch'](handleError(_0x235ced,null));};exports[_0x9da1('0x3f')]=function(_0x40d848,_0x599211){var _0x265366={'raw':!![],'where':{'id':_0x40d848['params']['id']}},_0xfeec5f={};_0xfeec5f[_0x9da1('0x2d')]=_['keys'](db[_0x9da1('0x2a')][_0x9da1('0x2b')]);_0xfeec5f['query']=_['keys'](_0x40d848[_0x9da1('0x2e')]);_0xfeec5f[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],_0xfeec5f[_0x9da1('0x2e')]);_0x265366[_0x9da1('0x31')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],qs['fields'](_0x40d848[_0x9da1('0x2e')][_0x9da1('0x32')]));_0x265366[_0x9da1('0x31')]=_0x265366['attributes'][_0x9da1('0x33')]?_0x265366[_0x9da1('0x31')]:_0xfeec5f[_0x9da1('0x2d')];if(_0x40d848['query'][_0x9da1('0x3c')]){_0x265366[_0x9da1('0x3d')]=[{'all':!![]}];}_0x265366=_[_0x9da1('0x3b')]({},_0x265366,_0x40d848['options']);return db[_0x9da1('0x2a')]['find'](_0x265366)['then'](handleEntityNotFound(_0x599211,null))[_0x9da1('0x21')](respondWithResult(_0x599211,null))[_0x9da1('0x40')](handleError(_0x599211,null));};exports['create']=function(_0x712d10,_0x2066d2){return db['AnalyticDefaultReport'][_0x9da1('0x41')](_0x712d10[_0x9da1('0x42')],{})[_0x9da1('0x21')](function(_0x3a529d){var _0x4780ca=_0x712d10[_0x9da1('0x43')][_0x9da1('0x44')]({'plain':!![]});if(!_0x4780ca)throw new Error(_0x9da1('0x45'));if(_0x4780ca[_0x9da1('0x46')]==='user'){var _0x147c65=_0x3a529d[_0x9da1('0x44')]({'plain':!![]});var _0x34a203=_0x9da1('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x34a203,'userProfileId':_0x4780ca[_0x9da1('0x48')]},'raw':!![]})[_0x9da1('0x21')](function(_0x3870dd){if(_0x3870dd&&_0x3870dd[_0x9da1('0x49')]===0x0){return db[_0x9da1('0x4a')][_0x9da1('0x41')]({'name':_0x147c65[_0x9da1('0x27')],'resourceId':_0x147c65['id'],'type':_0x9da1('0x22'),'sectionId':_0x3870dd['id']},{})[_0x9da1('0x21')](function(){return _0x3a529d;});}else{return _0x3a529d;}})[_0x9da1('0x40')](function(_0x868167){logger[_0x9da1('0x25')](_0x9da1('0x4b'),_0x868167);throw _0x868167;});}return _0x3a529d;})[_0x9da1('0x21')](respondWithResult(_0x2066d2,0xc9))['catch'](handleError(_0x2066d2,null));};exports[_0x9da1('0x20')]=function(_0x1fbb5d,_0x4d241a){if(_0x1fbb5d[_0x9da1('0x42')]['id']){delete _0x1fbb5d['body']['id'];}return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x1fbb5d[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x4d241a,null))[_0x9da1('0x21')](saveUpdates(_0x1fbb5d[_0x9da1('0x42')],null))[_0x9da1('0x21')](respondWithResult(_0x4d241a,null))[_0x9da1('0x40')](handleError(_0x4d241a,null));};exports[_0x9da1('0x23')]=function(_0x343b05,_0x170351){return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x343b05[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x170351,null))[_0x9da1('0x21')](removeEntity(_0x170351,null))[_0x9da1('0x40')](handleError(_0x170351,null));};exports[_0x9da1('0x4d')]=function(_0x4607a9,_0x2020d0){var _0x3c01c3=0xa;var _0xfa8d3f=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),_0x9da1('0x50')];var _0x5bda2a={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0xc27b00={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x27ac84=function(_0x10ebc9){return!_[_0x9da1('0x5c')]([_0x9da1('0x5d'),_0x9da1('0x5e'),_0x9da1('0x5f'),'IS\x20NOT\x20EMPTY'],_0x10ebc9);};var _0x5f5dc2=function(_0x454a68){if(!_0x454a68||!_0x454a68['rules']['length']){return'';}for(var _0x5b4a05='(',_0x6f86c3=0x0;_0x6f86c3<_0x454a68['rules'][_0x9da1('0x33')];_0x6f86c3+=0x1){_0x6f86c3>0x0&&(_0x5b4a05+='\x20'+_0x454a68['operator']+'\x20');_0x5b4a05+=_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x61')]?_0x5f5dc2(_0x454a68['rules'][_0x6f86c3][_0x9da1('0x61')]):_0x454a68[_0x9da1('0x60')][_0x6f86c3]['field']+'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x62')]+(_0x27ac84(_0x454a68['rules'][_0x6f86c3]['condition'])?'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x63')]:'');}return _0x5b4a05+')';};var _0x21d00c={'where':{'id':_0x4607a9['params']['id']}},_0x3ca531,_0x236b01,_0x44d7fe,_0x5cb102,_0x3d2c25;_0x21d00c=_['merge']({},_0x21d00c,_0x4607a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0x21d00c)[_0x9da1('0x21')](function(_0x3382b1){if(_0x3382b1){_0x3ca531=_0x3382b1;return _0x3382b1[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x1f2a4b){if(_0x1f2a4b){if(!_0x1f2a4b[_0x9da1('0x33')]){throw new db['Sequelize'][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x236b01=_0x1f2a4b;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x491fcb){if(_0x491fcb){_0x44d7fe=_[_0x9da1('0x6a')](_0x491fcb,'id');var _0x13fadd;var _0x419f78=squel[_0x9da1('0x6b')]();_0x419f78[_0x9da1('0x6c')](_0x3ca531[_0x9da1('0x6d')]);for(var _0x55a6d2=0x0;_0x55a6d2<_0x236b01[_0x9da1('0x33')];_0x55a6d2+=0x1){_0x13fadd=_0x236b01[_0x55a6d2]['MetricId']?_0x44d7fe[_0x236b01[_0x55a6d2][_0x9da1('0x6e')]]['metric']:_0x236b01[_0x55a6d2][_0x9da1('0x6f')];_0x13fadd=_0x236b01[_0x55a6d2][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x5bda2a[_0x236b01[_0x55a6d2][_0x9da1('0x70')]],'%s',_0x13fadd):_0x13fadd;_0x13fadd=_0x236b01[_0x55a6d2]['format']?_['replace'](_0xc27b00[_0x236b01[_0x55a6d2]['format']],'%s',_0x13fadd):_0x13fadd;if(_0x236b01[_0x55a6d2][_0x9da1('0x72')]){_0x419f78[_0x9da1('0x61')](_0x13fadd);}_0x236b01[_0x55a6d2][_0x9da1('0x73')]&&_0x419f78[_0x9da1('0x74')](_0x13fadd,_0x236b01[_0x55a6d2]['orderBy']==='DESC'?![]:!![]);_0x419f78[_0x9da1('0x6f')](_0x13fadd,_0x236b01[_0x55a6d2][_0x9da1('0x75')]||_0x13fadd);}if(_0x3ca531[_0x9da1('0x76')]){_0x3ca531['joins']=JSON['parse'](_0x3ca531[_0x9da1('0x76')]);for(var _0x1deb93=0x0;_0x1deb93<_0x3ca531[_0x9da1('0x76')]['length'];_0x1deb93+=0x1){if(_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0xfa8d3f,_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x39')])&&_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey']&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')]&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x78')]){_0x419f78[_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]](_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0x3ca531[_0x9da1('0x6d')],_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey'],_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],_0x3ca531['joins'][_0x1deb93][_0x9da1('0x78')]));}}}if(_0x3ca531['conditions']){_0x3ca531[_0x9da1('0x7a')]=JSON['parse'](_0x3ca531[_0x9da1('0x7a')]);_0x419f78[_0x9da1('0x37')](_0x5f5dc2(_0x3ca531[_0x9da1('0x7a')][_0x9da1('0x61')]));}_0x3d2c25=_0x419f78[_0x9da1('0x7b')]();_0x419f78[_0x9da1('0x1c')](_0x3c01c3);_0x419f78[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x419f78[_0x9da1('0x7e')]());return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x419f78[_0x9da1('0x7e')](),{'type':dbH['sequelize'][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](respondWithResult(_0x2020d0,null))[_0x9da1('0x40')](handleError(_0x2020d0,null));};function runReport(_0x162597,_0x4f39bc,_0x1ca102){var _0x2eb5e6=_0x4f39bc['name'];var _0x4a4cda=0xa;var _0x84f8d8=[_0x9da1('0x4e'),_0x9da1('0x82'),_0x9da1('0x4f'),_0x9da1('0x50')];var _0x4701b3={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x3a0a84={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':_0x9da1('0x83'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9da1('0x84')};var _0x354c5a=function(_0x53ab6a){return!_[_0x9da1('0x5c')](['IS\x20NULL',_0x9da1('0x5e'),'IS\x20EMPTY',_0x9da1('0x85')],_0x53ab6a);};var _0x106bd9=function(_0x347cb8){if(!_0x347cb8||!_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x3e331a='(',_0x1f785c=0x0;_0x1f785c<_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')];_0x1f785c+=0x1){_0x1f785c>0x0&&(_0x3e331a+='\x20'+_0x347cb8[_0x9da1('0x86')]+'\x20');_0x3e331a+=_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x61')]?_0x106bd9(_0x347cb8['rules'][_0x1f785c][_0x9da1('0x61')]):_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x6f')]+'\x20'+_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x62')]+(_0x354c5a(_0x347cb8[_0x9da1('0x60')][_0x1f785c]['condition'])?'\x20'+_0x347cb8['rules'][_0x1f785c][_0x9da1('0x63')]:'');}return _0x3e331a+')';};var _0xdecc82={'where':{'id':_0x162597['id']}},_0xe12dd7,_0x4cd85f,_0x4bf74c,_0x28335d,_0x175b4b;_0xdecc82=_[_0x9da1('0x3b')]({},_0xdecc82,_0x1ca102);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xdecc82)[_0x9da1('0x21')](function(_0x5561f0){if(_0x5561f0){_0xe12dd7=_0x5561f0;return _0x5561f0[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x5a64fd){if(_0x5a64fd){if(!_0x5a64fd['length']){throw new db[(_0x9da1('0x87'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4cd85f=_0x5a64fd;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x18ae08){if(_0x18ae08){_0x4bf74c=_[_0x9da1('0x6a')](_0x18ae08,'id');var _0x30065d;var _0x40a2ef=squel[_0x9da1('0x6b')]();_0x40a2ef['from'](_0xe12dd7['table']);for(var _0xd10ba4=0x0;_0xd10ba4<_0x4cd85f[_0x9da1('0x33')];_0xd10ba4+=0x1){_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]?_0x4bf74c[_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]][_0x9da1('0x88')]:_0x4cd85f[_0xd10ba4][_0x9da1('0x6f')];_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x4701b3[_0x4cd85f[_0xd10ba4]['function']],'%s',_0x30065d):_0x30065d;_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]?_['replace'](_0x3a0a84[_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]],'%s',_0x30065d):_0x30065d;if(_0x4cd85f[_0xd10ba4][_0x9da1('0x72')]){_0x40a2ef[_0x9da1('0x61')](_0x30065d);}_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]&&_0x40a2ef[_0x9da1('0x74')](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]===_0x9da1('0x8a')?![]:!![]);_0x40a2ef['field'](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x75')]||_0x30065d);}if(_0xe12dd7['joins']){_0xe12dd7[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0xe12dd7[_0x9da1('0x76')]);for(var _0x22b679=0x0;_0x22b679<_0xe12dd7['joins'][_0x9da1('0x33')];_0x22b679+=0x1){if(_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0x84f8d8,_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')])&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]){_0x40a2ef[_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]](_0xe12dd7['joins'][_0x22b679][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0xe12dd7['table'],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]));}}}if(_0xe12dd7[_0x9da1('0x7a')]){_0xe12dd7[_0x9da1('0x7a')]=JSON['parse'](_0xe12dd7[_0x9da1('0x7a')]);_0x40a2ef[_0x9da1('0x37')](_0x106bd9(_0xe12dd7['conditions'][_0x9da1('0x61')]));}_0x175b4b=_0x40a2ef[_0x9da1('0x7b')]();_0x40a2ef[_0x9da1('0x1c')](_0x4a4cda);_0x40a2ef['offset'](0x0);return;}})['then'](function(){if(_0x4f39bc['output']===_0x9da1('0x8d')){return null;}var _0x3b17aa=_[_0x9da1('0x3b')](_0x4f39bc,{'name':_0x4f39bc['fullPath']||_0x4f39bc['name']||_0xe12dd7[_0x9da1('0x27')],'basename':_0x2eb5e6,'savename':util[_0x9da1('0x89')]('%s-%s.%s',_0x4f39bc[_0x9da1('0x27')]||_0xe12dd7['name'],require('randomstring')['generate'](0x4),_0x4f39bc[_0x9da1('0x8e')]||_0x9da1('0x8f')),'reportId':_0xe12dd7['id'],'reportType':_0x9da1('0x90')});return db[_0x9da1('0x91')][_0x9da1('0x41')](_0x3b17aa,{'raw':!![]});})[_0x9da1('0x21')](function(_0x2aac99){if(_0xe12dd7[_0x9da1('0x6d')]===_0x9da1('0x92')){_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc['startDate'],_0x4f39bc['endDate']);}else{_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc[_0x9da1('0x93')],_0x4f39bc[_0x9da1('0x94')]);}if(_0x2aac99){logger[_0x9da1('0x95')](_0x9da1('0x96'),_0x175b4b[_0x9da1('0x7e')]());require(_0x9da1('0x97'))[_0x9da1('0x98')](path[_0x9da1('0x4e')](__dirname,'../../components/export/',_0x2aac99[_0x9da1('0x8e')]),[_0x2aac99['id'],_0x175b4b[_0x9da1('0x7e')](),path[_0x9da1('0x4e')](__dirname,_0x9da1('0x99'),_0x2aac99[_0x9da1('0x9a')]),_0x2eb5e6]);return _0x2aac99;}else{var _0x5ad3f8=squel[_0x9da1('0x6b')]();_0x5ad3f8['from']('('+_0x175b4b[_0x9da1('0x7e')]()+')',_0x9da1('0x9b'));_0x5ad3f8[_0x9da1('0x6f')]('COUNT(*)','count');_0x175b4b[_0x9da1('0x1c')](_0x4f39bc[_0x9da1('0x1c')]||_0x4a4cda);_0x175b4b[_0x9da1('0x1a')](_0x4f39bc['offset']||0x0);return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x5ad3f8['toString'](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')]['SELECT']})['then'](function(_0x489b3f){if(!_0x489b3f[_0x9da1('0x33')]){_0x28335d=0x0;}else{_0x28335d=_0x489b3f[0x0]['count']||0x0;}return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x175b4b[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});})['then'](function(_0x355a71){return{'rows':_0x355a71||[],'count':_0x28335d};});}});}exports[_0x9da1('0x9c')]=function(_0x492e1a,_0x449a17){return runReport(_0x492e1a[_0x9da1('0x4c')],_0x492e1a[_0x9da1('0x2e')],_0x492e1a[_0x9da1('0x64')])['then'](respondWithResult(_0x449a17,null))[_0x9da1('0x40')](handleError(_0x449a17,null));};exports[_0x9da1('0x9d')]=runReport;exports[_0x9da1('0x2e')]=function(_0x8280a9,_0x374754){var _0x1e466a=0xa;var _0x3f9133=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),'cross_join'];var _0x3dd3e0={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x52e4a6={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4aa903=function(_0x55d7f2){return!_['includes'](['IS\x20NULL',_0x9da1('0x5e'),_0x9da1('0x5f'),_0x9da1('0x85')],_0x55d7f2);};var _0x3212ad=function(_0x5ac65b){if(!_0x5ac65b||!_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x21a99d='(',_0xd19a7c=0x0;_0xd19a7c<_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')];_0xd19a7c+=0x1){_0xd19a7c>0x0&&(_0x21a99d+='\x20'+_0x5ac65b[_0x9da1('0x86')]+'\x20');_0x21a99d+=_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]?_0x3212ad(_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]):_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x6f')]+'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c]['condition']+(_0x4aa903(_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x62')])?'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x63')]:'');}return _0x21a99d+')';};var _0xb14af1={'where':{'id':_0x8280a9[_0x9da1('0x4c')]['id']}},_0x245566,_0x5b2591,_0x3c51e3,_0x54b83d,_0x23bf86;_0xb14af1=_['merge']({},_0xb14af1,_0x8280a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xb14af1)[_0x9da1('0x21')](function(_0x4bb140){if(_0x4bb140){_0x245566=_0x4bb140;return _0x4bb140[_0x9da1('0x66')]();}return null;})['then'](function(_0x47cbdd){if(_0x47cbdd){if(!_0x47cbdd['length']){throw new db[(_0x9da1('0x87'))][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x5b2591=_0x47cbdd;return db['AnalyticMetric'][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x5e1e24){if(_0x5e1e24){_0x3c51e3=_[_0x9da1('0x6a')](_0x5e1e24,'id');var _0x49ddec;var _0x407218=squel['select']();_0x407218['from'](_0x245566['table']);for(var _0x316fee=0x0;_0x316fee<_0x5b2591['length'];_0x316fee+=0x1){_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x6e')]?_0x3c51e3[_0x5b2591[_0x316fee][_0x9da1('0x6e')]]['metric']:_0x5b2591[_0x316fee]['field'];_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x70')]?_['replace'](_0x3dd3e0[_0x5b2591[_0x316fee][_0x9da1('0x70')]],'%s',_0x49ddec):_0x49ddec;_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x89')]?_['replace'](_0x52e4a6[_0x5b2591[_0x316fee]['format']],'%s',_0x49ddec):_0x49ddec;if(_0x5b2591[_0x316fee][_0x9da1('0x72')]){_0x407218[_0x9da1('0x61')](_0x49ddec);}_0x5b2591[_0x316fee][_0x9da1('0x73')]&&_0x407218[_0x9da1('0x74')](_0x49ddec,_0x5b2591[_0x316fee]['orderBy']==='DESC'?![]:!![]);_0x407218[_0x9da1('0x6f')](_0x49ddec,_0x5b2591[_0x316fee][_0x9da1('0x75')]||_0x49ddec);}if(_0x245566[_0x9da1('0x76')]){_0x245566[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0x245566['joins']);for(var _0x56ec7d=0x0;_0x56ec7d<_0x245566[_0x9da1('0x76')][_0x9da1('0x33')];_0x56ec7d+=0x1){if(_0x245566['joins'][_0x56ec7d][_0x9da1('0x39')]&&_['includes'](_0x3f9133,_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')])&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x8c')]&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')]&&_0x245566['joins'][_0x56ec7d][_0x9da1('0x78')]){_0x407218[_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')]](_0x245566[_0x9da1('0x76')][_0x56ec7d]['foreignTable'],null,util[_0x9da1('0x89')](_0x9da1('0x79'),_0x245566[_0x9da1('0x6d')],_0x245566['joins'][_0x56ec7d]['parentKey'],_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')],_0x245566['joins'][_0x56ec7d]['foreignKey']));}}}if(_0x245566[_0x9da1('0x7a')]){_0x245566[_0x9da1('0x7a')]=JSON[_0x9da1('0x8b')](_0x245566[_0x9da1('0x7a')]);_0x407218[_0x9da1('0x37')](_0x3212ad(_0x245566['conditions'][_0x9da1('0x61')]));}_0x23bf86=_0x407218['clone']();_0x407218[_0x9da1('0x1c')](_0x1e466a);_0x407218[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x407218['toString']());return dbH['sequelize'][_0x9da1('0x2e')](_0x407218[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](function(){return{'sql':_0x23bf86['toString']()};})[_0x9da1('0x21')](respondWithResult(_0x374754,null))[_0x9da1('0x40')](handleError(_0x374754,null));}; \ No newline at end of file +var _0x7a54=['options','AnalyticDefaultReport','includeAll','include','show','keys','attributes','create','body','user','role','get','Reports','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','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)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','field','function','replace','format','orderBy','DESC','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','debug','toString','sequelize','QueryTypes','SELECT','join','left_join','COUNT(DISTINCT\x20%s)','MAX(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','operator','groupBy','alias','output','web','fullPath','%s-%s.%s','generate','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','getFields','clone','Limited\x20Query:','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','dbH','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','save','then','destroy','DefaultReports','error','stack','name','index','map','fieldName','model','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge'];(function(_0x4503df,_0xfec122){var _0x3f1b2b=function(_0x32b1de){while(--_0x32b1de){_0x4503df['push'](_0x4503df['shift']());}};_0x3f1b2b(++_0xfec122);}(_0x7a54,0x106));var _0x47a5=function(_0x221fe8,_0x3cffc0){_0x221fe8=_0x221fe8-0x0;var _0x58456f=_0x7a54[_0x221fe8];return _0x58456f;};'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'];var dbH=require(_0x47a5('0x15'))[_0x47a5('0x16')];function respondWithStatusCode(_0x5beb89,_0x44bd3e){_0x44bd3e=_0x44bd3e||0xcc;return function(_0x221b54){if(_0x221b54){return _0x5beb89[_0x47a5('0x17')](_0x44bd3e);}return _0x5beb89[_0x47a5('0x18')](_0x44bd3e)[_0x47a5('0x19')]();};}function respondWithResult(_0x620ee9,_0x3c6c46){_0x3c6c46=_0x3c6c46||0xc8;return function(_0x190faa){if(_0x190faa){return _0x620ee9['status'](_0x3c6c46)[_0x47a5('0x1a')](_0x190faa);}};}function respondWithFilteredResult(_0x11faf5,_0x3b001e){return function(_0x2a2cbb){if(_0x2a2cbb){var _0x1ef44c=typeof _0x3b001e['offset']==='undefined'&&typeof _0x3b001e[_0x47a5('0x1b')]==='undefined';var _0x5247fd=_0x2a2cbb[_0x47a5('0x1c')];var _0xaf70a6=_0x1ef44c?0x0:_0x3b001e[_0x47a5('0x1d')];var _0x1ef371=_0x1ef44c?_0x2a2cbb[_0x47a5('0x1c')]:_0x3b001e[_0x47a5('0x1d')]+_0x3b001e[_0x47a5('0x1b')];var _0xe3c618;if(_0x1ef371>=_0x5247fd){_0x1ef371=_0x5247fd;_0xe3c618=0xc8;}else{_0xe3c618=0xce;}_0x11faf5[_0x47a5('0x18')](_0xe3c618);return _0x11faf5['set'](_0x47a5('0x1e'),_0xaf70a6+'-'+_0x1ef371+'/'+_0x5247fd)[_0x47a5('0x1a')](_0x2a2cbb);}return null;};}function patchUpdates(_0x47cf3c){return function(_0x2b0360){try{jsonpatch[_0x47a5('0x1f')](_0x2b0360,_0x47cf3c,!![]);}catch(_0x36874d){return BPromise['reject'](_0x36874d);}return _0x2b0360[_0x47a5('0x20')]();};}function saveUpdates(_0x2f142b,_0x23db32){return function(_0x7a9f9e){if(_0x7a9f9e){return _0x7a9f9e['update'](_0x2f142b)[_0x47a5('0x21')](function(_0x385687){return _0x385687;});}return null;};}function removeEntity(_0x513981,_0x28747d){return function(_0xc4cd63){if(_0xc4cd63){return _0xc4cd63[_0x47a5('0x22')]()[_0x47a5('0x21')](function(){var _0x3abd6a=_0xc4cd63['get']({'plain':!![]});var _0x53078a=_0x47a5('0x23');return db['UserProfileResource'][_0x47a5('0x22')]({'where':{'type':_0x53078a,'resourceId':_0x3abd6a['id']}})['then'](function(){return _0xc4cd63;});})[_0x47a5('0x21')](function(){_0x513981[_0x47a5('0x18')](0xcc)[_0x47a5('0x19')]();});}};}function handleEntityNotFound(_0x1dac65,_0x21f296){return function(_0x3ba0b7){if(!_0x3ba0b7){_0x1dac65[_0x47a5('0x17')](0x194);}return _0x3ba0b7;};}function handleError(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0x1f4;return function(_0x361bfa){logger[_0x47a5('0x24')](_0x361bfa[_0x47a5('0x25')]);if(_0x361bfa[_0x47a5('0x26')]){delete _0x361bfa['name'];}_0x136b14[_0x47a5('0x18')](_0x16631f)['send'](_0x361bfa);};}exports[_0x47a5('0x27')]=function(_0x9ac908,_0x16901f){var _0x4d6b57={},_0x256650={},_0x625952={'count':0x0,'rows':[]};var _0x39b50b=_[_0x47a5('0x28')](db['AnalyticDefaultReport']['rawAttributes'],function(_0x6f9a12){return{'name':_0x6f9a12[_0x47a5('0x29')],'type':_0x6f9a12['type']['key']};});_0x256650[_0x47a5('0x2a')]=_[_0x47a5('0x28')](_0x39b50b,'name');_0x256650[_0x47a5('0x2b')]=_['keys'](_0x9ac908[_0x47a5('0x2b')]);_0x256650[_0x47a5('0x2c')]=_['intersection'](_0x256650['model'],_0x256650[_0x47a5('0x2b')]);_0x4d6b57['attributes']=_[_0x47a5('0x2d')](_0x256650[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x9ac908['query'][_0x47a5('0x2e')]));_0x4d6b57['attributes']=_0x4d6b57['attributes'][_0x47a5('0x2f')]?_0x4d6b57['attributes']:_0x256650[_0x47a5('0x2a')];if(!_0x9ac908['query'][_0x47a5('0x30')](_0x47a5('0x31'))){_0x4d6b57[_0x47a5('0x1b')]=qs[_0x47a5('0x1b')](_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x1b')]);_0x4d6b57[_0x47a5('0x1d')]=qs[_0x47a5('0x1d')](_0x9ac908[_0x47a5('0x2b')]['offset']);}_0x4d6b57[_0x47a5('0x32')]=qs[_0x47a5('0x33')](_0x9ac908['query'][_0x47a5('0x33')]);_0x4d6b57[_0x47a5('0x34')]=qs[_0x47a5('0x2c')](_['pick'](_0x9ac908[_0x47a5('0x2b')],_0x256650[_0x47a5('0x2c')]),_0x39b50b);if(_0x9ac908['query'][_0x47a5('0x35')]){_0x4d6b57[_0x47a5('0x34')]=_['merge'](_0x4d6b57['where'],{'$or':_['map'](_0x39b50b,function(_0x12d9f2){if(_0x12d9f2['type']!==_0x47a5('0x36')){var _0x1f9631={};_0x1f9631[_0x12d9f2[_0x47a5('0x26')]]={'$like':'%'+_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x35')]+'%'};return _0x1f9631;}})});}_0x4d6b57=_[_0x47a5('0x37')]({},_0x4d6b57,_0x9ac908[_0x47a5('0x38')]);var _0x1f3d01={'where':_0x4d6b57[_0x47a5('0x34')]};return db[_0x47a5('0x39')][_0x47a5('0x1c')](_0x1f3d01)[_0x47a5('0x21')](function(_0x23d6d8){_0x625952['count']=_0x23d6d8;if(_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x3a')]){_0x4d6b57[_0x47a5('0x3b')]=[{'all':!![]}];}return db[_0x47a5('0x39')]['findAll'](_0x4d6b57);})[_0x47a5('0x21')](function(_0x528ef3){_0x625952['rows']=_0x528ef3;return _0x625952;})['then'](respondWithFilteredResult(_0x16901f,_0x4d6b57))['catch'](handleError(_0x16901f,null));};exports[_0x47a5('0x3c')]=function(_0x5ec4e5,_0x2bb502){var _0x3a740b={'raw':!![],'where':{'id':_0x5ec4e5['params']['id']}},_0x448610={};_0x448610[_0x47a5('0x2a')]=_[_0x47a5('0x3d')](db['AnalyticDefaultReport']['rawAttributes']);_0x448610[_0x47a5('0x2b')]=_['keys'](_0x5ec4e5[_0x47a5('0x2b')]);_0x448610[_0x47a5('0x2c')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],_0x448610[_0x47a5('0x2b')]);_0x3a740b[_0x47a5('0x3e')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x5ec4e5[_0x47a5('0x2b')][_0x47a5('0x2e')]));_0x3a740b[_0x47a5('0x3e')]=_0x3a740b[_0x47a5('0x3e')][_0x47a5('0x2f')]?_0x3a740b[_0x47a5('0x3e')]:_0x448610[_0x47a5('0x2a')];if(_0x5ec4e5['query'][_0x47a5('0x3a')]){_0x3a740b[_0x47a5('0x3b')]=[{'all':!![]}];}_0x3a740b=_['merge']({},_0x3a740b,_0x5ec4e5['options']);return db[_0x47a5('0x39')]['find'](_0x3a740b)[_0x47a5('0x21')](handleEntityNotFound(_0x2bb502,null))[_0x47a5('0x21')](respondWithResult(_0x2bb502,null))['catch'](handleError(_0x2bb502,null));};exports['create']=function(_0x3d85cc,_0x52d409){return db[_0x47a5('0x39')][_0x47a5('0x3f')](_0x3d85cc[_0x47a5('0x40')],{})[_0x47a5('0x21')](function(_0x44fe8a){var _0x26acd2=_0x3d85cc[_0x47a5('0x41')]['get']({'plain':!![]});if(!_0x26acd2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26acd2[_0x47a5('0x42')]===_0x47a5('0x41')){var _0x1163e3=_0x44fe8a[_0x47a5('0x43')]({'plain':!![]});var _0x2c7020=_0x47a5('0x44');return db[_0x47a5('0x45')]['find']({'where':{'name':_0x2c7020,'userProfileId':_0x26acd2[_0x47a5('0x46')]},'raw':!![]})[_0x47a5('0x21')](function(_0x5f6a){if(_0x5f6a&&_0x5f6a['autoAssociation']===0x0){return db[_0x47a5('0x47')]['create']({'name':_0x1163e3[_0x47a5('0x26')],'resourceId':_0x1163e3['id'],'type':_0x47a5('0x23'),'sectionId':_0x5f6a['id']},{})[_0x47a5('0x21')](function(){return _0x44fe8a;});}else{return _0x44fe8a;}})[_0x47a5('0x48')](function(_0x588551){logger[_0x47a5('0x24')](_0x47a5('0x49'),_0x588551);throw _0x588551;});}return _0x44fe8a;})[_0x47a5('0x21')](respondWithResult(_0x52d409,0xc9))[_0x47a5('0x48')](handleError(_0x52d409,null));};exports[_0x47a5('0x4a')]=function(_0x6a53b3,_0x24e9f4){if(_0x6a53b3['body']['id']){delete _0x6a53b3[_0x47a5('0x40')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x6a53b3[_0x47a5('0x4c')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x24e9f4,null))[_0x47a5('0x21')](saveUpdates(_0x6a53b3['body'],null))[_0x47a5('0x21')](respondWithResult(_0x24e9f4,null))[_0x47a5('0x48')](handleError(_0x24e9f4,null));};exports[_0x47a5('0x22')]=function(_0x53871e,_0x4c5ed){return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x53871e['params']['id']}})['then'](handleEntityNotFound(_0x4c5ed,null))[_0x47a5('0x21')](removeEntity(_0x4c5ed,null))[_0x47a5('0x48')](handleError(_0x4c5ed,null));};exports['preview']=function(_0x4cf792,_0x6d6b2b){var _0x4d6a82=0xa;var _0x16bb8a=['join','left_join',_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x53eedf={'SUM':_0x47a5('0x4f'),'COUNT':_0x47a5('0x50'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x199621={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':'HOUR(%s)','ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x485e3c=function(_0x470da6){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),_0x47a5('0x5a'),'IS\x20EMPTY',_0x47a5('0x5b')],_0x470da6);};var _0x5d1550=function(_0x5cbe97){if(!_0x5cbe97||!_0x5cbe97['rules']['length']){return'';}for(var _0x212d92='(',_0x6cd4ea=0x0;_0x6cd4ea<_0x5cbe97[_0x47a5('0x5c')]['length'];_0x6cd4ea+=0x1){_0x6cd4ea>0x0&&(_0x212d92+='\x20'+_0x5cbe97['operator']+'\x20');_0x212d92+=_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]?_0x5d1550(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]):_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['field']+'\x20'+_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['condition']+(_0x485e3c(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5e')])?'\x20'+_0x5cbe97['rules'][_0x6cd4ea][_0x47a5('0x5f')]:'');}return _0x212d92+')';};var _0x345104={'where':{'id':_0x4cf792[_0x47a5('0x4c')]['id']}},_0x132854,_0x3e8274,_0x2d6494,_0x215634,_0x35cca8;_0x345104=_['merge']({},_0x345104,_0x4cf792[_0x47a5('0x38')]);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x345104)[_0x47a5('0x21')](function(_0x396cb0){if(_0x396cb0){_0x132854=_0x396cb0;return _0x396cb0['getFields']();}return null;})[_0x47a5('0x21')](function(_0xdfcecc){if(_0xdfcecc){if(!_0xdfcecc[_0x47a5('0x2f')]){throw new db[(_0x47a5('0x60'))][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x3e8274=_0xdfcecc;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x44cb90){if(_0x44cb90){_0x2d6494=_[_0x47a5('0x65')](_0x44cb90,'id');var _0x44fda9;var _0x3c0006=squel[_0x47a5('0x66')]();_0x3c0006[_0x47a5('0x67')](_0x132854['table']);for(var _0x42dd7d=0x0;_0x42dd7d<_0x3e8274[_0x47a5('0x2f')];_0x42dd7d+=0x1){_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x68')]?_0x2d6494[_0x3e8274[_0x42dd7d]['MetricId']][_0x47a5('0x69')]:_0x3e8274[_0x42dd7d][_0x47a5('0x6a')];_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6b')]?_[_0x47a5('0x6c')](_0x53eedf[_0x3e8274[_0x42dd7d]['function']],'%s',_0x44fda9):_0x44fda9;_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]?_['replace'](_0x199621[_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]],'%s',_0x44fda9):_0x44fda9;if(_0x3e8274[_0x42dd7d]['groupBy']){_0x3c0006[_0x47a5('0x5d')](_0x44fda9);}_0x3e8274[_0x42dd7d]['orderBy']&&_0x3c0006[_0x47a5('0x32')](_0x44fda9,_0x3e8274[_0x42dd7d][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x3c0006['field'](_0x44fda9,_0x3e8274[_0x42dd7d]['alias']||_0x44fda9);}if(_0x132854['joins']){_0x132854[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x70')]);for(var _0x117510=0x0;_0x117510<_0x132854['joins'][_0x47a5('0x2f')];_0x117510+=0x1){if(_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')]&&_[_0x47a5('0x58')](_0x16bb8a,_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')])&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]){_0x3c0006[_0x132854['joins'][_0x117510][_0x47a5('0x72')]](_0x132854['joins'][_0x117510][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x132854[_0x47a5('0x77')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]));}}}if(_0x132854[_0x47a5('0x78')]){_0x132854[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x78')]);_0x3c0006[_0x47a5('0x34')](_0x5d1550(_0x132854['conditions']['group']));}_0x35cca8=_0x3c0006['clone']();_0x3c0006['limit'](_0x4d6a82);_0x3c0006[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')]('Limited\x20Query:',_0x3c0006[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')][_0x47a5('0x2b')](_0x3c0006[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](respondWithResult(_0x6d6b2b,null))[_0x47a5('0x48')](handleError(_0x6d6b2b,null));};function runReport(_0x1ffe3c,_0x24a6c1,_0x5e5f16){var _0x18fa31=_0x24a6c1[_0x47a5('0x26')];var _0x420671=0xa;var _0x4f35ff=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),'cross_join'];var _0x19dc8c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x592322={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':'DATE(%s)','HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0xb16bdd=function(_0x53ea2b){return!_[_0x47a5('0x58')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0x53ea2b);};var _0x5b91f7=function(_0x1926bd){if(!_0x1926bd||!_0x1926bd[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x4c25ec='(',_0x280372=0x0;_0x280372<_0x1926bd['rules'][_0x47a5('0x2f')];_0x280372+=0x1){_0x280372>0x0&&(_0x4c25ec+='\x20'+_0x1926bd[_0x47a5('0x85')]+'\x20');_0x4c25ec+=_0x1926bd[_0x47a5('0x5c')][_0x280372]['group']?_0x5b91f7(_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5d')]):_0x1926bd[_0x47a5('0x5c')][_0x280372]['field']+'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition']+(_0xb16bdd(_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition'])?'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5f')]:'');}return _0x4c25ec+')';};var _0x20a742={'where':{'id':_0x1ffe3c['id']}},_0x211fbf,_0x51738b,_0x42fcce,_0x2ae130,_0x23c393;_0x20a742=_[_0x47a5('0x37')]({},_0x20a742,_0x5e5f16);return db[_0x47a5('0x39')]['find'](_0x20a742)['then'](function(_0x569550){if(_0x569550){_0x211fbf=_0x569550;return _0x569550['getFields']();}return null;})[_0x47a5('0x21')](function(_0xa8809a){if(_0xa8809a){if(!_0xa8809a[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x51738b=_0xa8809a;return db['AnalyticMetric'][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x19acfa){if(_0x19acfa){_0x42fcce=_[_0x47a5('0x65')](_0x19acfa,'id');var _0x58dacd;var _0x4b5353=squel[_0x47a5('0x66')]();_0x4b5353[_0x47a5('0x67')](_0x211fbf['table']);for(var _0x27d422=0x0;_0x27d422<_0x51738b[_0x47a5('0x2f')];_0x27d422+=0x1){_0x58dacd=_0x51738b[_0x27d422]['MetricId']?_0x42fcce[_0x51738b[_0x27d422][_0x47a5('0x68')]][_0x47a5('0x69')]:_0x51738b[_0x27d422][_0x47a5('0x6a')];_0x58dacd=_0x51738b[_0x27d422]['function']?_[_0x47a5('0x6c')](_0x19dc8c[_0x51738b[_0x27d422]['function']],'%s',_0x58dacd):_0x58dacd;_0x58dacd=_0x51738b[_0x27d422][_0x47a5('0x6d')]?_['replace'](_0x592322[_0x51738b[_0x27d422][_0x47a5('0x6d')]],'%s',_0x58dacd):_0x58dacd;if(_0x51738b[_0x27d422][_0x47a5('0x86')]){_0x4b5353['group'](_0x58dacd);}_0x51738b[_0x27d422][_0x47a5('0x6e')]&&_0x4b5353['order'](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x4b5353[_0x47a5('0x6a')](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x87')]||_0x58dacd);}if(_0x211fbf['joins']){_0x211fbf[_0x47a5('0x70')]=JSON['parse'](_0x211fbf['joins']);for(var _0x2bb2df=0x0;_0x2bb2df<_0x211fbf[_0x47a5('0x70')][_0x47a5('0x2f')];_0x2bb2df+=0x1){if(_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]&&_['includes'](_0x4f35ff,_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')])&&_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x73')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x74')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]){_0x4b5353[_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]](_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x211fbf[_0x47a5('0x77')],_0x211fbf[_0x47a5('0x70')][_0x2bb2df]['parentKey'],_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]));}}}if(_0x211fbf[_0x47a5('0x78')]){_0x211fbf[_0x47a5('0x78')]=JSON['parse'](_0x211fbf['conditions']);_0x4b5353[_0x47a5('0x34')](_0x5b91f7(_0x211fbf[_0x47a5('0x78')]['group']));}_0x23c393=_0x4b5353['clone']();_0x4b5353[_0x47a5('0x1b')](_0x420671);_0x4b5353[_0x47a5('0x1d')](0x0);return;}})['then'](function(){if(_0x24a6c1[_0x47a5('0x88')]===_0x47a5('0x89')){return null;}var _0x4c9e6a=_[_0x47a5('0x37')](_0x24a6c1,{'name':_0x24a6c1[_0x47a5('0x8a')]||_0x24a6c1[_0x47a5('0x26')]||_0x211fbf[_0x47a5('0x26')],'basename':_0x18fa31,'savename':util[_0x47a5('0x6d')](_0x47a5('0x8b'),_0x24a6c1['name']||_0x211fbf['name'],require('randomstring')[_0x47a5('0x8c')](0x4),_0x24a6c1[_0x47a5('0x88')]||'csv'),'reportId':_0x211fbf['id'],'reportType':_0x47a5('0x8d')});return db[_0x47a5('0x8e')][_0x47a5('0x3f')](_0x4c9e6a,{'raw':!![]});})[_0x47a5('0x21')](function(_0xcdbfd7){if(_0x211fbf['table']===_0x47a5('0x8f')){_0x23c393['where'](_0x211fbf['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x24a6c1[_0x47a5('0x90')],_0x24a6c1['endDate']);}else{_0x23c393[_0x47a5('0x34')](_0x211fbf[_0x47a5('0x77')]+_0x47a5('0x91'),_0x24a6c1['startDate'],_0x24a6c1[_0x47a5('0x92')]);}if(_0xcdbfd7){logger[_0x47a5('0x93')](_0x47a5('0x94'),_0x23c393[_0x47a5('0x7a')]());require(_0x47a5('0x95'))['fork'](path[_0x47a5('0x7e')](__dirname,_0x47a5('0x96'),_0xcdbfd7['output']),[_0xcdbfd7['id'],_0x23c393[_0x47a5('0x7a')](),path[_0x47a5('0x7e')](__dirname,_0x47a5('0x97'),_0xcdbfd7[_0x47a5('0x98')]),_0x18fa31]);return _0xcdbfd7;}else{var _0x3c117a=squel[_0x47a5('0x66')]();_0x3c117a['from']('('+_0x23c393[_0x47a5('0x7a')]()+')',_0x47a5('0x99'));_0x3c117a['field'](_0x47a5('0x9a'),_0x47a5('0x1c'));_0x23c393[_0x47a5('0x1b')](_0x24a6c1[_0x47a5('0x1b')]||_0x420671);_0x23c393['offset'](_0x24a6c1['offset']||0x0);return dbH['sequelize']['query'](_0x3c117a[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]})[_0x47a5('0x21')](function(_0x6bc37b){if(!_0x6bc37b[_0x47a5('0x2f')]){_0x2ae130=0x0;}else{_0x2ae130=_0x6bc37b[0x0][_0x47a5('0x1c')]||0x0;}return dbH['sequelize'][_0x47a5('0x2b')](_0x23c393[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')]['SELECT']});})['then'](function(_0x3770ae){return{'rows':_0x3770ae||[],'count':_0x2ae130};});}});}exports['run']=function(_0x4cb8e4,_0x1b6a5c){return runReport(_0x4cb8e4[_0x47a5('0x4c')],_0x4cb8e4['query'],_0x4cb8e4[_0x47a5('0x38')])[_0x47a5('0x21')](respondWithResult(_0x1b6a5c,null))[_0x47a5('0x48')](handleError(_0x1b6a5c,null));};exports['runReport']=runReport;exports[_0x47a5('0x2b')]=function(_0xee23c7,_0x48a491){var _0x1172fd=0xa;var _0x280b7b=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x482c87={'SUM':_0x47a5('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':_0x47a5('0x9b')};var _0x151540={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0x1b3e82=function(_0xa2045c){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),'IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0xa2045c);};var _0x591bde=function(_0x55d955){if(!_0x55d955||!_0x55d955[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x2ccf21='(',_0x2ff467=0x0;_0x2ff467<_0x55d955['rules'][_0x47a5('0x2f')];_0x2ff467+=0x1){_0x2ff467>0x0&&(_0x2ccf21+='\x20'+_0x55d955[_0x47a5('0x85')]+'\x20');_0x2ccf21+=_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]?_0x591bde(_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]):_0x55d955[_0x47a5('0x5c')][_0x2ff467]['field']+'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')]+(_0x1b3e82(_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')])?'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5f')]:'');}return _0x2ccf21+')';};var _0x8b4354={'where':{'id':_0xee23c7[_0x47a5('0x4c')]['id']}},_0x134c1a,_0x2bc7ae,_0x49cb8c,_0x220557,_0x11f07b;_0x8b4354=_['merge']({},_0x8b4354,_0xee23c7['options']);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x8b4354)[_0x47a5('0x21')](function(_0xfccf9c){if(_0xfccf9c){_0x134c1a=_0xfccf9c;return _0xfccf9c[_0x47a5('0x9c')]();}return null;})[_0x47a5('0x21')](function(_0x1c0323){if(_0x1c0323){if(!_0x1c0323[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2bc7ae=_0x1c0323;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})['then'](function(_0x48d4cf){if(_0x48d4cf){_0x49cb8c=_[_0x47a5('0x65')](_0x48d4cf,'id');var _0x41d2da;var _0x530387=squel[_0x47a5('0x66')]();_0x530387[_0x47a5('0x67')](_0x134c1a[_0x47a5('0x77')]);for(var _0x44567e=0x0;_0x44567e<_0x2bc7ae['length'];_0x44567e+=0x1){_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x68')]?_0x49cb8c[_0x2bc7ae[_0x44567e]['MetricId']]['metric']:_0x2bc7ae[_0x44567e]['field'];_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]?_['replace'](_0x482c87[_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]],'%s',_0x41d2da):_0x41d2da;_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]?_[_0x47a5('0x6c')](_0x151540[_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]],'%s',_0x41d2da):_0x41d2da;if(_0x2bc7ae[_0x44567e][_0x47a5('0x86')]){_0x530387[_0x47a5('0x5d')](_0x41d2da);}_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]&&_0x530387[_0x47a5('0x32')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x530387[_0x47a5('0x6a')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x87')]||_0x41d2da);}if(_0x134c1a[_0x47a5('0x70')]){_0x134c1a[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x134c1a['joins']);for(var _0xdd95c8=0x0;_0xdd95c8<_0x134c1a[_0x47a5('0x70')][_0x47a5('0x2f')];_0xdd95c8+=0x1){if(_0x134c1a[_0x47a5('0x70')][_0xdd95c8]['type']&&_[_0x47a5('0x58')](_0x280b7b,_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x72')])&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x73')]&&_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x74')]&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]){_0x530387[_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x72')]](_0x134c1a['joins'][_0xdd95c8]['foreignTable'],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x134c1a[_0x47a5('0x77')],_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x73')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x74')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]));}}}if(_0x134c1a[_0x47a5('0x78')]){_0x134c1a[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x134c1a['conditions']);_0x530387['where'](_0x591bde(_0x134c1a[_0x47a5('0x78')][_0x47a5('0x5d')]));}_0x11f07b=_0x530387[_0x47a5('0x9d')]();_0x530387[_0x47a5('0x1b')](_0x1172fd);_0x530387[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')](_0x47a5('0x9e'),_0x530387[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')]['query'](_0x530387['toString'](),{'type':dbH[_0x47a5('0x7b')]['QueryTypes'][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](function(){return{'sql':_0x11f07b[_0x47a5('0x7a')]()};})['then'](respondWithResult(_0x48a491,null))[_0x47a5('0x48')](handleError(_0x48a491,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index fa39dee..8293d9d 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 _0xc6f3=['api','moment','bluebird','request-promise','path','exports','define','analytics_default_reports','lodash','util','../../config/logger'];(function(_0x4cea63,_0x2cc3c2){var _0x3a4698=function(_0x1370ee){while(--_0x1370ee){_0x4cea63['push'](_0x4cea63['shift']());}};_0x3a4698(++_0x2cc3c2);}(_0xc6f3,0x189));var _0x3c6f=function(_0x83e917,_0x1791a1){_0x83e917=_0x83e917-0x0;var _0x40af5a=_0xc6f3[_0x83e917];return _0x40af5a;};'use strict';var _=require(_0x3c6f('0x0'));var util=require(_0x3c6f('0x1'));var logger=require(_0x3c6f('0x2'))(_0x3c6f('0x3'));var moment=require(_0x3c6f('0x4'));var BPromise=require(_0x3c6f('0x5'));var rp=require(_0x3c6f('0x6'));var fs=require('fs');var path=require(_0x3c6f('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0x3c6f('0x8')]=function(_0x4031e5,_0x15f7cd){return _0x4031e5[_0x3c6f('0x9')]('AnalyticDefaultReport',attributes,{'tableName':_0x3c6f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3cbf=['exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','api','bluebird','path','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3cbf,0x138));var _0xf3cb=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0x3cbf[_0x4f5108];return _0x2d56ca;};'use strict';var _=require(_0xf3cb('0x0'));var util=require(_0xf3cb('0x1'));var logger=require('../../config/logger')(_0xf3cb('0x2'));var moment=require('moment');var BPromise=require(_0xf3cb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf3cb('0x4'));var rimraf=require('rimraf');var config=require(_0xf3cb('0x5'));var attributes=require(_0xf3cb('0x6'));module[_0xf3cb('0x7')]=function(_0xe652e7,_0x2760ba){return _0xe652e7[_0xf3cb('0x8')](_0xf3cb('0x9'),attributes,{'tableName':_0xf3cb('0xa'),'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 2f5b3ca..22c05cd 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 _0xa36a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x54fba3,_0x25b7b9){var _0x58bc3a=function(_0x3fbe51){while(--_0x3fbe51){_0x54fba3['push'](_0x54fba3['shift']());}};_0x58bc3a(++_0x25b7b9);}(_0xa36a,0x10f));var _0xaa36=function(_0xbf6d36,_0x1eede8){_0xbf6d36=_0xbf6d36-0x0;var _0x149745=_0xa36a[_0xbf6d36];return _0x149745;};'use strict';var _=require('lodash');var util=require(_0xaa36('0x0'));var moment=require(_0xaa36('0x1'));var BPromise=require(_0xaa36('0x2'));var rs=require(_0xaa36('0x3'));var fs=require('fs');var Redis=require(_0xaa36('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa36('0x5'));var logger=require(_0xaa36('0x6'))(_0xaa36('0x7'));var config=require(_0xaa36('0x8'));var jayson=require(_0xaa36('0x9'));var client=jayson[_0xaa36('0xa')][_0xaa36('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42bb56,_0x5705ee,_0xffd647){return new BPromise(function(_0x588f1c,_0x4abc3b){return client[_0xaa36('0xc')](_0x42bb56,_0xffd647)[_0xaa36('0xd')](function(_0x4acd15){logger[_0xaa36('0xe')](_0xaa36('0xf'),_0x5705ee,_0xaa36('0x10'));logger[_0xaa36('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x5705ee,_0xaa36('0x10'),JSON['stringify'](_0x4acd15));if(_0x4acd15[_0xaa36('0x12')]){if(_0x4acd15[_0xaa36('0x12')][_0xaa36('0x13')]===0x1f4){logger[_0xaa36('0x12')](_0xaa36('0xf'),_0x5705ee,_0x4acd15['error'][_0xaa36('0x14')]);return _0x4abc3b(_0x4acd15['error']['message']);}logger['error'](_0xaa36('0xf'),_0x5705ee,_0x4acd15[_0xaa36('0x12')][_0xaa36('0x14')]);return _0x588f1c(_0x4acd15[_0xaa36('0x12')][_0xaa36('0x14')]);}else{logger[_0xaa36('0xe')](_0xaa36('0xf'),_0x5705ee,_0xaa36('0x10'));_0x588f1c(_0x4acd15[_0xaa36('0x15')]['message']);}})[_0xaa36('0x16')](function(_0x31412a){logger[_0xaa36('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5705ee,_0x31412a);_0x4abc3b(_0x31412a);});});} \ No newline at end of file +var _0x8cad=['info','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0x8cad,0x192));var _0xd8ca=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x8cad[_0x1477ef];return _0x164acd;};'use strict';var _=require(_0xd8ca('0x0'));var util=require(_0xd8ca('0x1'));var moment=require('moment');var BPromise=require(_0xd8ca('0x2'));var rs=require(_0xd8ca('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8ca('0x4'))['db'];var utils=require(_0xd8ca('0x5'));var logger=require(_0xd8ca('0x6'))(_0xd8ca('0x7'));var config=require('../../config/environment');var jayson=require(_0xd8ca('0x8'));var client=jayson[_0xd8ca('0x9')][_0xd8ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xac32dc,_0x4e4b23,_0x1f7bcc){return new BPromise(function(_0x242e8e,_0x5130c2){return client['request'](_0xac32dc,_0x1f7bcc)[_0xd8ca('0xb')](function(_0x28c2ee){logger['info'](_0xd8ca('0xc'),_0x4e4b23,_0xd8ca('0xd'));logger[_0xd8ca('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x4e4b23,_0xd8ca('0xd'),JSON[_0xd8ca('0xf')](_0x28c2ee));if(_0x28c2ee[_0xd8ca('0x10')]){if(_0x28c2ee['error']['code']===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x4e4b23,_0x28c2ee[_0xd8ca('0x10')][_0xd8ca('0x11')]);return _0x5130c2(_0x28c2ee[_0xd8ca('0x10')]['message']);}logger[_0xd8ca('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4e4b23,_0x28c2ee['error'][_0xd8ca('0x11')]);return _0x242e8e(_0x28c2ee[_0xd8ca('0x10')][_0xd8ca('0x11')]);}else{logger[_0xd8ca('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4e4b23,_0xd8ca('0xd'));_0x242e8e(_0x28c2ee[_0xd8ca('0x13')][_0xd8ca('0x11')]);}})['catch'](function(_0x1b64f9){logger['error'](_0xd8ca('0xc'),_0x4e4b23,_0x1b64f9);_0x5130c2(_0x1b64f9);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 5e7e21a..3ad4a82 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 _0x6798=['show','/:id/preview','isAuthenticated','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','/:id'];(function(_0x429758,_0x93e7fa){var _0x352eda=function(_0x1a4c9f){while(--_0x1a4c9f){_0x429758['push'](_0x429758['shift']());}};_0x352eda(++_0x93e7fa);}(_0x6798,0x1a5));var _0x8679=function(_0x2df67c,_0x5eaa2e){_0x2df67c=_0x2df67c-0x0;var _0x4abed7=_0x6798[_0x2df67c];return _0x4abed7;};'use strict';var multer=require(_0x8679('0x0'));var util=require(_0x8679('0x1'));var path=require(_0x8679('0x2'));var timeout=require(_0x8679('0x3'));var express=require(_0x8679('0x4'));var router=express[_0x8679('0x5')]();var fs_extra=require(_0x8679('0x6'));var auth=require(_0x8679('0x7'));var interaction=require(_0x8679('0x8'));var config=require(_0x8679('0x9'));var controller=require(_0x8679('0xa'));router[_0x8679('0xb')]('/',auth['isAuthenticated'](),controller[_0x8679('0xc')]);router['get'](_0x8679('0xd'),auth['isAuthenticated'](),controller[_0x8679('0xe')]);router[_0x8679('0xb')](_0x8679('0xf'),auth[_0x8679('0x10')](),controller[_0x8679('0x11')]);router[_0x8679('0xb')](_0x8679('0x12'),auth[_0x8679('0x10')](),controller[_0x8679('0x13')]);router['get'](_0x8679('0x14'),auth[_0x8679('0x10')](),controller[_0x8679('0x15')]);router[_0x8679('0x16')]('/',auth[_0x8679('0x10')](),controller[_0x8679('0x17')]);router[_0x8679('0x18')](_0x8679('0xd'),auth['isAuthenticated'](),controller[_0x8679('0x19')]);router[_0x8679('0x1a')](_0x8679('0xd'),auth['isAuthenticated'](),controller[_0x8679('0x1b')]);module[_0x8679('0x1c')]=router; \ No newline at end of file +var _0x3994=['connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','run','/:id/query','query','post','create','put','exports','multer','util','path'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x3994,0x123));var _0x4399=function(_0x2a1b14,_0x1ce310){_0x2a1b14=_0x2a1b14-0x0;var _0x3c6e35=_0x3994[_0x2a1b14];return _0x3c6e35;};'use strict';var multer=require(_0x4399('0x0'));var util=require(_0x4399('0x1'));var path=require(_0x4399('0x2'));var timeout=require(_0x4399('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4399('0x4'));var auth=require(_0x4399('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4399('0x6'));var controller=require('./analyticDefaultReport.controller');router[_0x4399('0x7')]('/',auth[_0x4399('0x8')](),controller[_0x4399('0x9')]);router[_0x4399('0x7')](_0x4399('0xa'),auth[_0x4399('0x8')](),controller[_0x4399('0xb')]);router['get'](_0x4399('0xc'),auth['isAuthenticated'](),controller['preview']);router['get'](_0x4399('0xd'),auth[_0x4399('0x8')](),controller[_0x4399('0xe')]);router[_0x4399('0x7')](_0x4399('0xf'),auth[_0x4399('0x8')](),controller[_0x4399('0x10')]);router[_0x4399('0x11')]('/',auth['isAuthenticated'](),controller[_0x4399('0x12')]);router[_0x4399('0x13')](_0x4399('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x4399('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x4399('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 55eef48..f0c5be2 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 _0x4b05=['DATE','Loading','scheduled','manual','INTEGER','UNSIGNED','sequelize','exports','STRING','ENUM','xlsx'];(function(_0x1a7c3f,_0x259e8a){var _0x49f75c=function(_0x5cfe75){while(--_0x5cfe75){_0x1a7c3f['push'](_0x1a7c3f['shift']());}};_0x49f75c(++_0x259e8a);}(_0x4b05,0x1d4));var _0x54b0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4b05[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x54b0('0x0'));var moment=require('moment');module[_0x54b0('0x1')]={'name':{'type':Sequelize[_0x54b0('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x54b0('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x54b0('0x3')]('csv','pdf',_0x54b0('0x4')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x54b0('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x54b0('0x5')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x54b0('0x6')},'type':{'type':Sequelize[_0x54b0('0x3')]('manual',_0x54b0('0x7')),'allowNull':![],'defaultValue':_0x54b0('0x8')},'reportId':{'type':Sequelize[_0x54b0('0x9')](0xb)[_0x54b0('0xa')]},'reportType':{'type':Sequelize[_0x54b0('0x2')]}}; \ No newline at end of file +var _0xaf3c=['sequelize','moment','exports','STRING','ENUM','pdf','xlsx','csv','DATE','scheduled','manual','INTEGER','UNSIGNED'];(function(_0x15810c,_0x30cdb7){var _0x5b0e60=function(_0x25b67c){while(--_0x25b67c){_0x15810c['push'](_0x15810c['shift']());}};_0x5b0e60(++_0x30cdb7);}(_0xaf3c,0xd0));var _0xcaf3=function(_0x23bc40,_0x3e33a5){_0x23bc40=_0x23bc40-0x0;var _0x16e124=_0xaf3c[_0x23bc40];return _0x16e124;};'use strict';var Sequelize=require(_0xcaf3('0x0'));var moment=require(_0xcaf3('0x1'));module[_0xcaf3('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xcaf3('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xcaf3('0x4')]('csv',_0xcaf3('0x5'),_0xcaf3('0x6')),'allowNull':![],'defaultValue':_0xcaf3('0x7')},'savename':{'type':Sequelize[_0xcaf3('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xcaf3('0x8')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xcaf3('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xcaf3('0x4')]('manual',_0xcaf3('0x9')),'allowNull':![],'defaultValue':_0xcaf3('0xa')},'reportId':{'type':Sequelize[_0xcaf3('0xb')](0xb)[_0xcaf3('0xc')]},'reportType':{'type':Sequelize[_0xcaf3('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index fd839f4..99e8fa2 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 _0x1111=['squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','ExtractedReports','UserProfileResource','status','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','type','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','catch','params','length','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','existsSync','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','join','format','%s.%s','output','toLowerCase','eml-format','zip-dir','request-promise','util','path','to-csv','ejs','lodash'];(function(_0x48ecd2,_0x481ad3){var _0x5a4457=function(_0xdd9abd){while(--_0xdd9abd){_0x48ecd2['push'](_0x48ecd2['shift']());}};_0x5a4457(++_0x481ad3);}(_0x1111,0xb0));var _0x1111=function(_0xc4abcf,_0x1fd9bc){_0xc4abcf=_0xc4abcf-0x0;var _0x45164c=_0x1111[_0xc4abcf];return _0x45164c;};'use strict';var emlformat=require(_0x1111('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1111('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1111('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1111('0x3'));var path=require(_0x1111('0x4'));var sox=require('sox');var csv=require(_0x1111('0x5'));var ejs=require(_0x1111('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1111('0x7'));var squel=require(_0x1111('0x8'));var crypto=require(_0x1111('0x9'));var jsforce=require(_0x1111('0xa'));var deskjs=require(_0x1111('0xb'));var toCsv=require(_0x1111('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1111('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x1111('0xd'));var hardwareService=require(_0x1111('0xe'));var logger=require(_0x1111('0xf'))(_0x1111('0x10'));var utils=require(_0x1111('0x11'));var config=require(_0x1111('0x12'));var licenseUtil=require(_0x1111('0x13'));var db=require(_0x1111('0x14'))['db'];function respondWithStatusCode(_0x48bd46,_0x8e36b1){_0x8e36b1=_0x8e36b1||0xcc;return function(_0x5c1bbb){if(_0x5c1bbb){return _0x48bd46[_0x1111('0x15')](_0x8e36b1);}return _0x48bd46['status'](_0x8e36b1)[_0x1111('0x16')]();};}function respondWithResult(_0x150444,_0x360061){_0x360061=_0x360061||0xc8;return function(_0x433f75){if(_0x433f75){return _0x150444['status'](_0x360061)[_0x1111('0x17')](_0x433f75);}};}function respondWithFilteredResult(_0x7144b2,_0x5e6250){return function(_0x180299){if(_0x180299){var _0x26bb88=typeof _0x5e6250[_0x1111('0x18')]===_0x1111('0x19')&&typeof _0x5e6250[_0x1111('0x1a')]==='undefined';var _0xf652f1=_0x180299[_0x1111('0x1b')];var _0x5c0b14=_0x26bb88?0x0:_0x5e6250[_0x1111('0x18')];var _0x538f46=_0x26bb88?_0x180299[_0x1111('0x1b')]:_0x5e6250[_0x1111('0x18')]+_0x5e6250[_0x1111('0x1a')];var _0x5c975d;if(_0x538f46>=_0xf652f1){_0x538f46=_0xf652f1;_0x5c975d=0xc8;}else{_0x5c975d=0xce;}_0x7144b2['status'](_0x5c975d);return _0x7144b2[_0x1111('0x1c')](_0x1111('0x1d'),_0x5c0b14+'-'+_0x538f46+'/'+_0xf652f1)[_0x1111('0x17')](_0x180299);}return null;};}function patchUpdates(_0x338d26){return function(_0x554aff){try{jsonpatch['apply'](_0x554aff,_0x338d26,!![]);}catch(_0x3aa386){return BPromise[_0x1111('0x1e')](_0x3aa386);}return _0x554aff[_0x1111('0x1f')]();};}function saveUpdates(_0x495d4c,_0x1a1577){return function(_0x257d44){if(_0x257d44){return _0x257d44[_0x1111('0x20')](_0x495d4c)[_0x1111('0x21')](function(_0x4231c0){return _0x4231c0;});}return null;};}function removeEntity(_0x5ca17c,_0x10716f){return function(_0x26c6e4){if(_0x26c6e4){return _0x26c6e4[_0x1111('0x22')]()['then'](function(){var _0x26dd3e=_0x26c6e4['get']({'plain':!![]});var _0x211078=_0x1111('0x23');return db[_0x1111('0x24')][_0x1111('0x22')]({'where':{'type':_0x211078,'resourceId':_0x26dd3e['id']}})[_0x1111('0x21')](function(){return _0x26c6e4;});})[_0x1111('0x21')](function(){_0x5ca17c[_0x1111('0x25')](0xcc)[_0x1111('0x16')]();});}};}function handleEntityNotFound(_0x1195b5,_0x584477){return function(_0x4feaec){if(!_0x4feaec){_0x1195b5['sendStatus'](0x194);}return _0x4feaec;};}function handleError(_0x1ed4f2,_0x1206d9){_0x1206d9=_0x1206d9||0x1f4;return function(_0x5af580){logger[_0x1111('0x26')](_0x5af580[_0x1111('0x27')]);if(_0x5af580[_0x1111('0x28')]){delete _0x5af580[_0x1111('0x28')];}_0x1ed4f2[_0x1111('0x25')](_0x1206d9)[_0x1111('0x29')](_0x5af580);};}exports[_0x1111('0x2a')]=function(_0x10b2c7,_0x216b7e){var _0xf465c5={},_0x56e774={},_0x35ce36={'count':0x0,'rows':[]};var _0x96691e=_[_0x1111('0x2b')](db[_0x1111('0x2c')][_0x1111('0x2d')],function(_0x59b59){return{'name':_0x59b59['fieldName'],'type':_0x59b59[_0x1111('0x2e')]['key']};});_0x56e774[_0x1111('0x2f')]=_['map'](_0x96691e,_0x1111('0x28'));_0x56e774['query']=_[_0x1111('0x30')](_0x10b2c7[_0x1111('0x31')]);_0x56e774['filters']=_[_0x1111('0x32')](_0x56e774[_0x1111('0x2f')],_0x56e774[_0x1111('0x31')]);_0xf465c5[_0x1111('0x33')]=_[_0x1111('0x32')](_0x56e774[_0x1111('0x2f')],qs[_0x1111('0x34')](_0x10b2c7['query']['fields']));_0xf465c5[_0x1111('0x33')]=_0xf465c5[_0x1111('0x33')]['length']?_0xf465c5[_0x1111('0x33')]:_0x56e774[_0x1111('0x2f')];if(!_0x10b2c7[_0x1111('0x31')][_0x1111('0x35')](_0x1111('0x36'))){_0xf465c5[_0x1111('0x1a')]=qs[_0x1111('0x1a')](_0x10b2c7['query'][_0x1111('0x1a')]);_0xf465c5[_0x1111('0x18')]=qs['offset'](_0x10b2c7['query']['offset']);}_0xf465c5[_0x1111('0x37')]=qs['sort'](_0x10b2c7['query']['sort']);_0xf465c5[_0x1111('0x38')]=qs[_0x1111('0x39')](_[_0x1111('0x3a')](_0x10b2c7[_0x1111('0x31')],_0x56e774[_0x1111('0x39')]),_0x96691e);if(_0x10b2c7[_0x1111('0x31')][_0x1111('0x3b')]){_0xf465c5['where']=_[_0x1111('0x3c')](_0xf465c5[_0x1111('0x38')],{'$or':_['map'](_0x96691e,function(_0x13ede2){if(_0x13ede2[_0x1111('0x2e')]!==_0x1111('0x3d')){var _0x4ea504={};_0x4ea504[_0x13ede2[_0x1111('0x28')]]={'$like':'%'+_0x10b2c7[_0x1111('0x31')][_0x1111('0x3b')]+'%'};return _0x4ea504;}})});}_0xf465c5=_[_0x1111('0x3c')]({},_0xf465c5,_0x10b2c7[_0x1111('0x3e')]);var _0x51f8e4={'where':_0xf465c5[_0x1111('0x38')]};return db[_0x1111('0x2c')][_0x1111('0x1b')](_0x51f8e4)[_0x1111('0x21')](function(_0x298ee7){_0x35ce36[_0x1111('0x1b')]=_0x298ee7;if(_0x10b2c7['query']['includeAll']){_0xf465c5[_0x1111('0x3f')]=[{'all':!![]}];}return db[_0x1111('0x2c')][_0x1111('0x40')](_0xf465c5);})[_0x1111('0x21')](function(_0x34d82b){_0x35ce36['rows']=_0x34d82b;return _0x35ce36;})[_0x1111('0x21')](respondWithFilteredResult(_0x216b7e,_0xf465c5))[_0x1111('0x41')](handleError(_0x216b7e,null));};exports['show']=function(_0x53db32,_0x3a926e){var _0x40b216={'raw':!![],'where':{'id':_0x53db32[_0x1111('0x42')]['id']}},_0x7d5305={};_0x7d5305[_0x1111('0x2f')]=_['keys'](db[_0x1111('0x2c')][_0x1111('0x2d')]);_0x7d5305[_0x1111('0x31')]=_[_0x1111('0x30')](_0x53db32[_0x1111('0x31')]);_0x7d5305[_0x1111('0x39')]=_[_0x1111('0x32')](_0x7d5305['model'],_0x7d5305[_0x1111('0x31')]);_0x40b216[_0x1111('0x33')]=_[_0x1111('0x32')](_0x7d5305[_0x1111('0x2f')],qs[_0x1111('0x34')](_0x53db32[_0x1111('0x31')][_0x1111('0x34')]));_0x40b216[_0x1111('0x33')]=_0x40b216['attributes'][_0x1111('0x43')]?_0x40b216[_0x1111('0x33')]:_0x7d5305[_0x1111('0x2f')];if(_0x53db32[_0x1111('0x31')][_0x1111('0x44')]){_0x40b216['include']=[{'all':!![]}];}_0x40b216=_[_0x1111('0x3c')]({},_0x40b216,_0x53db32['options']);return db[_0x1111('0x2c')][_0x1111('0x45')](_0x40b216)[_0x1111('0x21')](handleEntityNotFound(_0x3a926e,null))[_0x1111('0x21')](respondWithResult(_0x3a926e,null))[_0x1111('0x41')](handleError(_0x3a926e,null));};exports[_0x1111('0x46')]=function(_0x209c84,_0x458692){return db[_0x1111('0x2c')][_0x1111('0x46')](_0x209c84[_0x1111('0x47')],{})['then'](function(_0x32bda3){var _0x9ea314=_0x209c84[_0x1111('0x48')][_0x1111('0x49')]({'plain':!![]});if(!_0x9ea314)throw new Error(_0x1111('0x4a'));if(_0x9ea314['role']===_0x1111('0x48')){var _0x1f3fca=_0x32bda3[_0x1111('0x49')]({'plain':!![]});var _0x133c81='ExtractedReports';return db[_0x1111('0x4b')][_0x1111('0x45')]({'where':{'name':_0x133c81,'userProfileId':_0x9ea314['userProfileId']},'raw':!![]})[_0x1111('0x21')](function(_0x4f039c){if(_0x4f039c&&_0x4f039c[_0x1111('0x4c')]===0x0){return db[_0x1111('0x24')]['create']({'name':_0x1f3fca[_0x1111('0x28')],'resourceId':_0x1f3fca['id'],'type':_0x4f039c[_0x1111('0x28')],'sectionId':_0x4f039c['id']},{})[_0x1111('0x21')](function(){return _0x32bda3;});}else{return _0x32bda3;}})['catch'](function(_0x5666f1){logger[_0x1111('0x26')](_0x1111('0x4d'),_0x5666f1);throw _0x5666f1;});}return _0x32bda3;})[_0x1111('0x21')](respondWithResult(_0x458692,0xc9))[_0x1111('0x41')](handleError(_0x458692,null));};exports['update']=function(_0x2d598f,_0x48a35d){if(_0x2d598f[_0x1111('0x47')]['id']){delete _0x2d598f[_0x1111('0x47')]['id'];}return db[_0x1111('0x2c')]['find']({'where':{'id':_0x2d598f['params']['id']}})[_0x1111('0x21')](handleEntityNotFound(_0x48a35d,null))['then'](saveUpdates(_0x2d598f[_0x1111('0x47')],null))[_0x1111('0x21')](respondWithResult(_0x48a35d,null))[_0x1111('0x41')](handleError(_0x48a35d,null));};exports[_0x1111('0x22')]=function(_0x5cb1f6,_0x4763da){return db[_0x1111('0x2c')][_0x1111('0x45')]({'where':{'id':_0x5cb1f6[_0x1111('0x42')]['id']}})['then'](handleEntityNotFound(_0x4763da,null))['then'](removeEntity(_0x4763da,null))[_0x1111('0x41')](handleError(_0x4763da,null));};exports['download']=function(_0x57ae2d,_0x2129df,_0x2c89b2){return db[_0x1111('0x2c')]['find']({'where':{'id':_0x57ae2d[_0x1111('0x42')]['id']},'attributes':['name',_0x1111('0x4e'),_0x1111('0x4f'),'output'],'raw':!![]})[_0x1111('0x21')](handleEntityNotFound(_0x2129df,null))[_0x1111('0x21')](function(_0x19305e){if(_0x19305e){if(!fs[_0x1111('0x50')](path['join'](config[_0x1111('0x51')],_0x1111('0x52'),_0x19305e[_0x1111('0x4f')]))){throw new db['Sequelize'][(_0x1111('0x53'))](_0x1111('0x54'));}if(_0x57ae2d[_0x1111('0x31')][_0x1111('0x55')]){return _0x2129df[_0x1111('0x15')](0xc8);}return _0x2129df[_0x1111('0x56')](path[_0x1111('0x57')](config[_0x1111('0x51')],_0x1111('0x52'),_0x19305e[_0x1111('0x4f')]),util[_0x1111('0x58')](_0x1111('0x59'),_0x19305e[_0x1111('0x4e')]||_0x19305e['name'],_0x19305e[_0x1111('0x5a')][_0x1111('0x5b')]()));}})[_0x1111('0x41')](handleError(_0x2129df,null));}; \ No newline at end of file +var _0x7efb=['fields','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','includeAll','include','catch','keys','length','find','create','user','role','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','download','basename','savename','output','existsSync','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','join','server/files/reports','format','%s.%s','toLowerCase','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','stack','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','model','query','filters','intersection','attributes'];(function(_0x3656e2,_0x22b321){var _0x2f7928=function(_0x1d30ad){while(--_0x1d30ad){_0x3656e2['push'](_0x3656e2['shift']());}};_0x2f7928(++_0x22b321);}(_0x7efb,0x19d));var _0xb7ef=function(_0x3ae2fc,_0x557711){_0x3ae2fc=_0x3ae2fc-0x0;var _0x231239=_0x7efb[_0x3ae2fc];return _0x231239;};'use strict';var emlformat=require(_0xb7ef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb7ef('0x1'));var jsonpatch=require(_0xb7ef('0x2'));var rp=require(_0xb7ef('0x3'));var moment=require(_0xb7ef('0x4'));var BPromise=require(_0xb7ef('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xb7ef('0x6'));var csv=require(_0xb7ef('0x7'));var ejs=require(_0xb7ef('0x8'));var fs=require('fs');var fs_extra=require(_0xb7ef('0x9'));var _=require(_0xb7ef('0xa'));var squel=require(_0xb7ef('0xb'));var crypto=require('crypto');var jsforce=require(_0xb7ef('0xc'));var deskjs=require(_0xb7ef('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb7ef('0xe'));var Redis=require(_0xb7ef('0xf'));var authService=require(_0xb7ef('0x10'));var qs=require(_0xb7ef('0x11'));var as=require(_0xb7ef('0x12'));var hardwareService=require(_0xb7ef('0x13'));var logger=require(_0xb7ef('0x14'))(_0xb7ef('0x15'));var utils=require('../../config/utils');var config=require(_0xb7ef('0x16'));var licenseUtil=require(_0xb7ef('0x17'));var db=require(_0xb7ef('0x18'))['db'];function respondWithStatusCode(_0x38513e,_0x54601c){_0x54601c=_0x54601c||0xcc;return function(_0x662c7e){if(_0x662c7e){return _0x38513e[_0xb7ef('0x19')](_0x54601c);}return _0x38513e[_0xb7ef('0x1a')](_0x54601c)[_0xb7ef('0x1b')]();};}function respondWithResult(_0x50d42f,_0x5496bd){_0x5496bd=_0x5496bd||0xc8;return function(_0x40a6f1){if(_0x40a6f1){return _0x50d42f[_0xb7ef('0x1a')](_0x5496bd)['json'](_0x40a6f1);}};}function respondWithFilteredResult(_0x322860,_0x2e8f65){return function(_0x2d6003){if(_0x2d6003){var _0x4e2979=typeof _0x2e8f65[_0xb7ef('0x1c')]===_0xb7ef('0x1d')&&typeof _0x2e8f65[_0xb7ef('0x1e')]===_0xb7ef('0x1d');var _0x276b7c=_0x2d6003[_0xb7ef('0x1f')];var _0x385bf9=_0x4e2979?0x0:_0x2e8f65['offset'];var _0x2b32cb=_0x4e2979?_0x2d6003['count']:_0x2e8f65[_0xb7ef('0x1c')]+_0x2e8f65[_0xb7ef('0x1e')];var _0x37a56e;if(_0x2b32cb>=_0x276b7c){_0x2b32cb=_0x276b7c;_0x37a56e=0xc8;}else{_0x37a56e=0xce;}_0x322860['status'](_0x37a56e);return _0x322860['set'](_0xb7ef('0x20'),_0x385bf9+'-'+_0x2b32cb+'/'+_0x276b7c)['json'](_0x2d6003);}return null;};}function patchUpdates(_0x4a8275){return function(_0x460d94){try{jsonpatch[_0xb7ef('0x21')](_0x460d94,_0x4a8275,!![]);}catch(_0x54247e){return BPromise[_0xb7ef('0x22')](_0x54247e);}return _0x460d94[_0xb7ef('0x23')]();};}function saveUpdates(_0x320d29,_0x1b07f0){return function(_0x14729c){if(_0x14729c){return _0x14729c[_0xb7ef('0x24')](_0x320d29)[_0xb7ef('0x25')](function(_0x36e212){return _0x36e212;});}return null;};}function removeEntity(_0x25922e,_0xb839bd){return function(_0x42d871){if(_0x42d871){return _0x42d871[_0xb7ef('0x26')]()['then'](function(){var _0xb992cd=_0x42d871[_0xb7ef('0x27')]({'plain':!![]});var _0xfca596='ExtractedReports';return db['UserProfileResource'][_0xb7ef('0x26')]({'where':{'type':_0xfca596,'resourceId':_0xb992cd['id']}})[_0xb7ef('0x25')](function(){return _0x42d871;});})[_0xb7ef('0x25')](function(){_0x25922e[_0xb7ef('0x1a')](0xcc)[_0xb7ef('0x1b')]();});}};}function handleEntityNotFound(_0x20f463,_0x4bbd52){return function(_0x2b78a7){if(!_0x2b78a7){_0x20f463[_0xb7ef('0x19')](0x194);}return _0x2b78a7;};}function handleError(_0x48afc5,_0x40610b){_0x40610b=_0x40610b||0x1f4;return function(_0x17585a){logger['error'](_0x17585a[_0xb7ef('0x28')]);if(_0x17585a[_0xb7ef('0x29')]){delete _0x17585a[_0xb7ef('0x29')];}_0x48afc5[_0xb7ef('0x1a')](_0x40610b)[_0xb7ef('0x2a')](_0x17585a);};}exports['index']=function(_0x52938d,_0x2f017c){var _0x230b12={},_0x27359b={},_0x4fb8cc={'count':0x0,'rows':[]};var _0x2abb66=_[_0xb7ef('0x2b')](db[_0xb7ef('0x2c')][_0xb7ef('0x2d')],function(_0x453c76){return{'name':_0x453c76[_0xb7ef('0x2e')],'type':_0x453c76['type']['key']};});_0x27359b[_0xb7ef('0x2f')]=_[_0xb7ef('0x2b')](_0x2abb66,_0xb7ef('0x29'));_0x27359b[_0xb7ef('0x30')]=_['keys'](_0x52938d[_0xb7ef('0x30')]);_0x27359b[_0xb7ef('0x31')]=_[_0xb7ef('0x32')](_0x27359b[_0xb7ef('0x2f')],_0x27359b[_0xb7ef('0x30')]);_0x230b12[_0xb7ef('0x33')]=_[_0xb7ef('0x32')](_0x27359b[_0xb7ef('0x2f')],qs[_0xb7ef('0x34')](_0x52938d[_0xb7ef('0x30')][_0xb7ef('0x34')]));_0x230b12[_0xb7ef('0x33')]=_0x230b12['attributes']['length']?_0x230b12[_0xb7ef('0x33')]:_0x27359b[_0xb7ef('0x2f')];if(!_0x52938d[_0xb7ef('0x30')][_0xb7ef('0x35')](_0xb7ef('0x36'))){_0x230b12[_0xb7ef('0x1e')]=qs[_0xb7ef('0x1e')](_0x52938d[_0xb7ef('0x30')][_0xb7ef('0x1e')]);_0x230b12[_0xb7ef('0x1c')]=qs['offset'](_0x52938d[_0xb7ef('0x30')]['offset']);}_0x230b12['order']=qs['sort'](_0x52938d[_0xb7ef('0x30')][_0xb7ef('0x37')]);_0x230b12[_0xb7ef('0x38')]=qs['filters'](_['pick'](_0x52938d['query'],_0x27359b[_0xb7ef('0x31')]),_0x2abb66);if(_0x52938d['query'][_0xb7ef('0x39')]){_0x230b12['where']=_[_0xb7ef('0x3a')](_0x230b12[_0xb7ef('0x38')],{'$or':_[_0xb7ef('0x2b')](_0x2abb66,function(_0x47e3ef){if(_0x47e3ef[_0xb7ef('0x3b')]!==_0xb7ef('0x3c')){var _0x2c1c48={};_0x2c1c48[_0x47e3ef[_0xb7ef('0x29')]]={'$like':'%'+_0x52938d[_0xb7ef('0x30')][_0xb7ef('0x39')]+'%'};return _0x2c1c48;}})});}_0x230b12=_[_0xb7ef('0x3a')]({},_0x230b12,_0x52938d['options']);var _0x194d11={'where':_0x230b12[_0xb7ef('0x38')]};return db['AnalyticExtractedReport'][_0xb7ef('0x1f')](_0x194d11)[_0xb7ef('0x25')](function(_0x5852ec){_0x4fb8cc['count']=_0x5852ec;if(_0x52938d[_0xb7ef('0x30')][_0xb7ef('0x3d')]){_0x230b12[_0xb7ef('0x3e')]=[{'all':!![]}];}return db[_0xb7ef('0x2c')]['findAll'](_0x230b12);})['then'](function(_0x22d8f3){_0x4fb8cc['rows']=_0x22d8f3;return _0x4fb8cc;})[_0xb7ef('0x25')](respondWithFilteredResult(_0x2f017c,_0x230b12))[_0xb7ef('0x3f')](handleError(_0x2f017c,null));};exports['show']=function(_0x460ed6,_0x1630b0){var _0x48bb57={'raw':!![],'where':{'id':_0x460ed6['params']['id']}},_0x2c3432={};_0x2c3432['model']=_[_0xb7ef('0x40')](db[_0xb7ef('0x2c')]['rawAttributes']);_0x2c3432[_0xb7ef('0x30')]=_['keys'](_0x460ed6['query']);_0x2c3432[_0xb7ef('0x31')]=_[_0xb7ef('0x32')](_0x2c3432[_0xb7ef('0x2f')],_0x2c3432['query']);_0x48bb57[_0xb7ef('0x33')]=_[_0xb7ef('0x32')](_0x2c3432[_0xb7ef('0x2f')],qs[_0xb7ef('0x34')](_0x460ed6['query'][_0xb7ef('0x34')]));_0x48bb57[_0xb7ef('0x33')]=_0x48bb57['attributes'][_0xb7ef('0x41')]?_0x48bb57[_0xb7ef('0x33')]:_0x2c3432[_0xb7ef('0x2f')];if(_0x460ed6[_0xb7ef('0x30')][_0xb7ef('0x3d')]){_0x48bb57[_0xb7ef('0x3e')]=[{'all':!![]}];}_0x48bb57=_['merge']({},_0x48bb57,_0x460ed6['options']);return db[_0xb7ef('0x2c')][_0xb7ef('0x42')](_0x48bb57)[_0xb7ef('0x25')](handleEntityNotFound(_0x1630b0,null))[_0xb7ef('0x25')](respondWithResult(_0x1630b0,null))['catch'](handleError(_0x1630b0,null));};exports[_0xb7ef('0x43')]=function(_0x1f66e7,_0xdbbc3c){return db['AnalyticExtractedReport'][_0xb7ef('0x43')](_0x1f66e7['body'],{})['then'](function(_0x10e709){var _0x59e1b6=_0x1f66e7[_0xb7ef('0x44')]['get']({'plain':!![]});if(!_0x59e1b6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59e1b6[_0xb7ef('0x45')]===_0xb7ef('0x44')){var _0x2bdb4a=_0x10e709[_0xb7ef('0x27')]({'plain':!![]});var _0x4e70f4=_0xb7ef('0x46');return db[_0xb7ef('0x47')]['find']({'where':{'name':_0x4e70f4,'userProfileId':_0x59e1b6[_0xb7ef('0x48')]},'raw':!![]})[_0xb7ef('0x25')](function(_0x1c975e){if(_0x1c975e&&_0x1c975e[_0xb7ef('0x49')]===0x0){return db[_0xb7ef('0x4a')][_0xb7ef('0x43')]({'name':_0x2bdb4a['name'],'resourceId':_0x2bdb4a['id'],'type':_0x1c975e[_0xb7ef('0x29')],'sectionId':_0x1c975e['id']},{})[_0xb7ef('0x25')](function(){return _0x10e709;});}else{return _0x10e709;}})[_0xb7ef('0x3f')](function(_0xf82cfb){logger[_0xb7ef('0x4b')](_0xb7ef('0x4c'),_0xf82cfb);throw _0xf82cfb;});}return _0x10e709;})[_0xb7ef('0x25')](respondWithResult(_0xdbbc3c,0xc9))['catch'](handleError(_0xdbbc3c,null));};exports[_0xb7ef('0x24')]=function(_0x56167c,_0xe0e98d){if(_0x56167c[_0xb7ef('0x4d')]['id']){delete _0x56167c[_0xb7ef('0x4d')]['id'];}return db[_0xb7ef('0x2c')][_0xb7ef('0x42')]({'where':{'id':_0x56167c[_0xb7ef('0x4e')]['id']}})[_0xb7ef('0x25')](handleEntityNotFound(_0xe0e98d,null))[_0xb7ef('0x25')](saveUpdates(_0x56167c[_0xb7ef('0x4d')],null))[_0xb7ef('0x25')](respondWithResult(_0xe0e98d,null))['catch'](handleError(_0xe0e98d,null));};exports[_0xb7ef('0x26')]=function(_0x494ae1,_0x1dd02d){return db[_0xb7ef('0x2c')][_0xb7ef('0x42')]({'where':{'id':_0x494ae1[_0xb7ef('0x4e')]['id']}})[_0xb7ef('0x25')](handleEntityNotFound(_0x1dd02d,null))[_0xb7ef('0x25')](removeEntity(_0x1dd02d,null))[_0xb7ef('0x3f')](handleError(_0x1dd02d,null));};exports[_0xb7ef('0x4f')]=function(_0x4ba6ea,_0x54111,_0x6e10da){return db['AnalyticExtractedReport'][_0xb7ef('0x42')]({'where':{'id':_0x4ba6ea['params']['id']},'attributes':['name',_0xb7ef('0x50'),_0xb7ef('0x51'),_0xb7ef('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x54111,null))[_0xb7ef('0x25')](function(_0x44ef60){if(_0x44ef60){if(!fs[_0xb7ef('0x53')](path['join'](config[_0xb7ef('0x54')],'server/files/reports',_0x44ef60['savename']))){throw new db[(_0xb7ef('0x55'))][(_0xb7ef('0x56'))](_0xb7ef('0x57'));}if(_0x4ba6ea[_0xb7ef('0x30')]['exists']){return _0x54111[_0xb7ef('0x19')](0xc8);}return _0x54111[_0xb7ef('0x4f')](path[_0xb7ef('0x58')](config['root'],_0xb7ef('0x59'),_0x44ef60[_0xb7ef('0x51')]),util[_0xb7ef('0x5a')](_0xb7ef('0x5b'),_0x44ef60[_0xb7ef('0x50')]||_0x44ef60[_0xb7ef('0x29')],_0x44ef60[_0xb7ef('0x52')][_0xb7ef('0x5c')]()));}})[_0xb7ef('0x3f')](handleError(_0x54111,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index e3aac59..293375c 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 _0xe78d=['./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','request-promise'];(function(_0x5bc204,_0x4c5881){var _0x3eadd9=function(_0x23320d){while(--_0x23320d){_0x5bc204['push'](_0x5bc204['shift']());}};_0x3eadd9(++_0x4c5881);}(_0xe78d,0xcc));var _0xde78=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0xe78d[_0x648163];return _0x199d4d;};'use strict';var _=require(_0xde78('0x0'));var util=require(_0xde78('0x1'));var logger=require(_0xde78('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xde78('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xde78('0x4'));module[_0xde78('0x5')]=function(_0x56e1cd,_0x39deae){return _0x56e1cd['define'](_0xde78('0x6'),attributes,{'tableName':_0xde78('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6793=['request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','api','moment'];(function(_0x41f007,_0x3f6dfb){var _0x2d458b=function(_0xe877ec){while(--_0xe877ec){_0x41f007['push'](_0x41f007['shift']());}};_0x2d458b(++_0x3f6dfb);}(_0x6793,0x76));var _0x3679=function(_0x536f4a,_0x360afe){_0x536f4a=_0x536f4a-0x0;var _0x242497=_0x6793[_0x536f4a];return _0x242497;};'use strict';var _=require(_0x3679('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3679('0x1'));var moment=require(_0x3679('0x2'));var BPromise=require('bluebird');var rp=require(_0x3679('0x3'));var fs=require('fs');var path=require(_0x3679('0x4'));var rimraf=require(_0x3679('0x5'));var config=require(_0x3679('0x6'));var attributes=require(_0x3679('0x7'));module[_0x3679('0x8')]=function(_0x3828af,_0x1b8092){return _0x3828af[_0x3679('0x9')](_0x3679('0xa'),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 e0d80e1..51c2769 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 _0x6084=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird'];(function(_0x534be4,_0x6b028d){var _0x24aece=function(_0x3505fb){while(--_0x3505fb){_0x534be4['push'](_0x534be4['shift']());}};_0x24aece(++_0x6b028d);}(_0x6084,0x155));var _0x4608=function(_0x184493,_0x140a20){_0x184493=_0x184493-0x0;var _0x1faa06=_0x6084[_0x184493];return _0x1faa06;};'use strict';var _=require(_0x4608('0x0'));var util=require(_0x4608('0x1'));var moment=require(_0x4608('0x2'));var BPromise=require(_0x4608('0x3'));var rs=require(_0x4608('0x4'));var fs=require('fs');var Redis=require(_0x4608('0x5'));var db=require(_0x4608('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4608('0x7'));var config=require(_0x4608('0x8'));var jayson=require(_0x4608('0x9'));var client=jayson[_0x4608('0xa')][_0x4608('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x443408,_0x260997,_0xf6b619){return new BPromise(function(_0x20deef,_0x59b3ad){return client['request'](_0x443408,_0xf6b619)['then'](function(_0x485d22){logger[_0x4608('0xc')](_0x4608('0xd'),_0x260997,'request\x20sent');logger[_0x4608('0xe')](_0x4608('0xf'),_0x260997,'request\x20sent',JSON[_0x4608('0x10')](_0x485d22));if(_0x485d22[_0x4608('0x11')]){if(_0x485d22[_0x4608('0x11')][_0x4608('0x12')]===0x1f4){logger[_0x4608('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x260997,_0x485d22[_0x4608('0x11')][_0x4608('0x13')]);return _0x59b3ad(_0x485d22[_0x4608('0x11')][_0x4608('0x13')]);}logger[_0x4608('0x11')](_0x4608('0xd'),_0x260997,_0x485d22['error'][_0x4608('0x13')]);return _0x20deef(_0x485d22[_0x4608('0x11')][_0x4608('0x13')]);}else{logger[_0x4608('0xc')](_0x4608('0xd'),_0x260997,_0x4608('0x14'));_0x20deef(_0x485d22[_0x4608('0x15')][_0x4608('0x13')]);}})[_0x4608('0x16')](function(_0x1eb348){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x260997,_0x1eb348);_0x59b3ad(_0x1eb348);});});} \ No newline at end of file +var _0xe265=['request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','info','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0x402b1f,_0x3df329){var _0x5d22f2=function(_0x5f17c3){while(--_0x5f17c3){_0x402b1f['push'](_0x402b1f['shift']());}};_0x5d22f2(++_0x3df329);}(_0xe265,0x111));var _0x5e26=function(_0x35a048,_0x276593){_0x35a048=_0x35a048-0x0;var _0x1cbf96=_0xe265[_0x35a048];return _0x1cbf96;};'use strict';var _=require(_0x5e26('0x0'));var util=require(_0x5e26('0x1'));var moment=require('moment');var BPromise=require(_0x5e26('0x2'));var rs=require(_0x5e26('0x3'));var fs=require('fs');var Redis=require(_0x5e26('0x4'));var db=require(_0x5e26('0x5'))['db'];var utils=require(_0x5e26('0x6'));var logger=require('../../config/logger')(_0x5e26('0x7'));var config=require(_0x5e26('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5e26('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d4b28,_0x5495d5,_0x11b07){return new BPromise(function(_0x423519,_0x1969e6){return client['request'](_0x1d4b28,_0x11b07)['then'](function(_0x166885){logger[_0x5e26('0xa')](_0x5e26('0xb'),_0x5495d5,_0x5e26('0xc'));logger[_0x5e26('0xd')](_0x5e26('0xe'),_0x5495d5,_0x5e26('0xc'),JSON['stringify'](_0x166885));if(_0x166885[_0x5e26('0xf')]){if(_0x166885[_0x5e26('0xf')]['code']===0x1f4){logger[_0x5e26('0xf')](_0x5e26('0xb'),_0x5495d5,_0x166885[_0x5e26('0xf')][_0x5e26('0x10')]);return _0x1969e6(_0x166885[_0x5e26('0xf')]['message']);}logger[_0x5e26('0xf')](_0x5e26('0xb'),_0x5495d5,_0x166885[_0x5e26('0xf')][_0x5e26('0x10')]);return _0x423519(_0x166885['error'][_0x5e26('0x10')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x5495d5,_0x5e26('0xc'));_0x423519(_0x166885[_0x5e26('0x11')]['message']);}})[_0x5e26('0x12')](function(_0x221bf5){logger[_0x5e26('0xf')](_0x5e26('0xb'),_0x5495d5,_0x221bf5);_0x1969e6(_0x221bf5);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 99ab568..bac741b 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 _0xdda9=['post','create','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','/:id','show','/:id/download'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xdda9,0x1aa));var _0x9dda=function(_0x345b6f,_0x54e0b7){_0x345b6f=_0x345b6f-0x0;var _0x719a56=_0xdda9[_0x345b6f];return _0x719a56;};'use strict';var multer=require(_0x9dda('0x0'));var util=require(_0x9dda('0x1'));var path=require(_0x9dda('0x2'));var timeout=require('connect-timeout');var express=require(_0x9dda('0x3'));var router=express[_0x9dda('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9dda('0x5'));var interaction=require(_0x9dda('0x6'));var config=require(_0x9dda('0x7'));var controller=require(_0x9dda('0x8'));router[_0x9dda('0x9')]('/',auth[_0x9dda('0xa')](),controller['index']);router[_0x9dda('0x9')](_0x9dda('0xb'),auth[_0x9dda('0xa')](),controller[_0x9dda('0xc')]);router[_0x9dda('0x9')](_0x9dda('0xd'),auth[_0x9dda('0xa')](),controller['download']);router[_0x9dda('0xe')]('/',auth['isAuthenticated'](),controller[_0x9dda('0xf')]);router[_0x9dda('0x10')](_0x9dda('0xb'),auth[_0x9dda('0xa')](),controller[_0x9dda('0x11')]);router[_0x9dda('0x12')](_0x9dda('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x9dda('0x13')]=router; \ No newline at end of file +var _0xd4a2=['./analyticExtractedReport.controller','isAuthenticated','get','/:id','/:id/download','download','post','create','put','destroy','exports','path','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xd4a2,0xbb));var _0x2d4a=function(_0x19ed81,_0x483983){_0x19ed81=_0x19ed81-0x0;var _0x335549=_0xd4a2[_0x19ed81];return _0x335549;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2d4a('0x0'));var timeout=require('connect-timeout');var express=require(_0x2d4a('0x1'));var router=express[_0x2d4a('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2d4a('0x3'));var config=require(_0x2d4a('0x4'));var controller=require(_0x2d4a('0x5'));router['get']('/',auth[_0x2d4a('0x6')](),controller['index']);router[_0x2d4a('0x7')](_0x2d4a('0x8'),auth[_0x2d4a('0x6')](),controller['show']);router[_0x2d4a('0x7')](_0x2d4a('0x9'),auth[_0x2d4a('0x6')](),controller[_0x2d4a('0xa')]);router[_0x2d4a('0xb')]('/',auth['isAuthenticated'](),controller[_0x2d4a('0xc')]);router[_0x2d4a('0xd')]('/:id',auth[_0x2d4a('0x6')](),controller['update']);router['delete'](_0x2d4a('0x8'),auth[_0x2d4a('0x6')](),controller[_0x2d4a('0xe')]);module[_0x2d4a('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index af6a359..20e40c7 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 _0x6388=['BOOLEAN','exports','STRING'];(function(_0x305821,_0x46c446){var _0x53795d=function(_0x4c5873){while(--_0x4c5873){_0x305821['push'](_0x305821['shift']());}};_0x53795d(++_0x46c446);}(_0x6388,0x79));var _0x8638=function(_0x2081a7,_0x4f4eee){_0x2081a7=_0x2081a7-0x0;var _0x538f4e=_0x6388[_0x2081a7];return _0x538f4e;};'use strict';var Sequelize=require('sequelize');module[_0x8638('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x8638('0x1')]},'function':{'type':Sequelize[_0x8638('0x1')]},'format':{'type':Sequelize[_0x8638('0x1')]},'groupBy':{'type':Sequelize[_0x8638('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x8638('0x1')]},'custom':{'type':Sequelize[_0x8638('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xdcba=['exports','STRING','BOOLEAN','sequelize'];(function(_0x233e6f,_0x4019ac){var _0x1deeb0=function(_0x43f942){while(--_0x43f942){_0x233e6f['push'](_0x233e6f['shift']());}};_0x1deeb0(++_0x4019ac);}(_0xdcba,0xeb));var _0xadcb=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0xdcba[_0x31a371];return _0x2a5bd6;};'use strict';var Sequelize=require(_0xadcb('0x0'));module[_0xadcb('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xadcb('0x2')]},'function':{'type':Sequelize[_0xadcb('0x2')]},'format':{'type':Sequelize[_0xadcb('0x2')]},'groupBy':{'type':Sequelize[_0xadcb('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xadcb('0x2')]},'custom':{'type':Sequelize[_0xadcb('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index a82ef01..d7512ca 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 _0x2797=['bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','reject','then','destroy','end','error','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','findAll','rows','show','params','find','body','bulkCreate','catch','update'];(function(_0x1a4203,_0x3593b7){var _0x450540=function(_0x2eaf0b){while(--_0x2eaf0b){_0x1a4203['push'](_0x1a4203['shift']());}};_0x450540(++_0x3593b7);}(_0x2797,0x1cf));var _0x7279=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x2797[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x7279('0x0'));var rimraf=require(_0x7279('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7279('0x2'));var rp=require(_0x7279('0x3'));var moment=require(_0x7279('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7279('0x5'));var path=require(_0x7279('0x6'));var sox=require('sox');var csv=require(_0x7279('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7279('0x8'));var _=require(_0x7279('0x9'));var squel=require('squel');var crypto=require(_0x7279('0xa'));var jsforce=require(_0x7279('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7279('0xc'));var Papa=require(_0x7279('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7279('0xe'));var as=require(_0x7279('0xf'));var hardwareService=require(_0x7279('0x10'));var logger=require(_0x7279('0x11'))('api');var utils=require(_0x7279('0x12'));var config=require(_0x7279('0x13'));var licenseUtil=require(_0x7279('0x14'));var db=require(_0x7279('0x15'))['db'];function respondWithStatusCode(_0x565029,_0x1384d3){_0x1384d3=_0x1384d3||0xcc;return function(_0x406da0){if(_0x406da0){return _0x565029[_0x7279('0x16')](_0x1384d3);}return _0x565029[_0x7279('0x17')](_0x1384d3)['end']();};}function respondWithResult(_0x3534b3,_0x220c72){_0x220c72=_0x220c72||0xc8;return function(_0x2b7352){if(_0x2b7352){return _0x3534b3['status'](_0x220c72)[_0x7279('0x18')](_0x2b7352);}};}function respondWithFilteredResult(_0x434cad,_0x2037ad){return function(_0x167586){if(_0x167586){var _0x4aaac3=typeof _0x2037ad[_0x7279('0x19')]==='undefined'&&typeof _0x2037ad[_0x7279('0x1a')]===_0x7279('0x1b');var _0x495a7e=_0x167586['count'];var _0x5e34ed=_0x4aaac3?0x0:_0x2037ad[_0x7279('0x19')];var _0x285959=_0x4aaac3?_0x167586[_0x7279('0x1c')]:_0x2037ad[_0x7279('0x19')]+_0x2037ad[_0x7279('0x1a')];var _0x5e1167;if(_0x285959>=_0x495a7e){_0x285959=_0x495a7e;_0x5e1167=0xc8;}else{_0x5e1167=0xce;}_0x434cad[_0x7279('0x17')](_0x5e1167);return _0x434cad[_0x7279('0x1d')]('Content-Range',_0x5e34ed+'-'+_0x285959+'/'+_0x495a7e)[_0x7279('0x18')](_0x167586);}return null;};}function patchUpdates(_0x4950a6){return function(_0x105aa4){try{jsonpatch['apply'](_0x105aa4,_0x4950a6,!![]);}catch(_0x16ddce){return BPromise[_0x7279('0x1e')](_0x16ddce);}return _0x105aa4['save']();};}function saveUpdates(_0x19eb87,_0x3aa4b2){return function(_0x3f299f){if(_0x3f299f){return _0x3f299f['update'](_0x19eb87)[_0x7279('0x1f')](function(_0x2bf232){return _0x2bf232;});}return null;};}function removeEntity(_0x17d23a,_0x3e2503){return function(_0x4af7d5){if(_0x4af7d5){return _0x4af7d5[_0x7279('0x20')]()[_0x7279('0x1f')](function(){_0x17d23a[_0x7279('0x17')](0xcc)[_0x7279('0x21')]();});}};}function handleEntityNotFound(_0x566d61,_0x2b52df){return function(_0x85048e){if(!_0x85048e){_0x566d61[_0x7279('0x16')](0x194);}return _0x85048e;};}function handleError(_0x7509e2,_0x5ab212){_0x5ab212=_0x5ab212||0x1f4;return function(_0x4cde72){logger[_0x7279('0x22')](_0x4cde72['stack']);if(_0x4cde72[_0x7279('0x23')]){delete _0x4cde72[_0x7279('0x23')];}_0x7509e2[_0x7279('0x17')](_0x5ab212)[_0x7279('0x24')](_0x4cde72);};}exports[_0x7279('0x25')]=function(_0x3bd8db,_0x3259b2){var _0x14a90d={},_0xe03af={},_0x565d51={'count':0x0,'rows':[]};var _0x48c50c=_[_0x7279('0x26')](db[_0x7279('0x27')][_0x7279('0x28')],function(_0x49d7c8){return{'name':_0x49d7c8[_0x7279('0x29')],'type':_0x49d7c8[_0x7279('0x2a')][_0x7279('0x2b')]};});_0xe03af[_0x7279('0x2c')]=_[_0x7279('0x26')](_0x48c50c,_0x7279('0x23'));_0xe03af[_0x7279('0x2d')]=_[_0x7279('0x2e')](_0x3bd8db[_0x7279('0x2d')]);_0xe03af[_0x7279('0x2f')]=_[_0x7279('0x30')](_0xe03af[_0x7279('0x2c')],_0xe03af[_0x7279('0x2d')]);_0x14a90d['attributes']=_[_0x7279('0x30')](_0xe03af[_0x7279('0x2c')],qs[_0x7279('0x31')](_0x3bd8db[_0x7279('0x2d')][_0x7279('0x31')]));_0x14a90d[_0x7279('0x32')]=_0x14a90d[_0x7279('0x32')][_0x7279('0x33')]?_0x14a90d[_0x7279('0x32')]:_0xe03af[_0x7279('0x2c')];if(!_0x3bd8db[_0x7279('0x2d')][_0x7279('0x34')](_0x7279('0x35'))){_0x14a90d[_0x7279('0x1a')]=qs[_0x7279('0x1a')](_0x3bd8db['query'][_0x7279('0x1a')]);_0x14a90d[_0x7279('0x19')]=qs['offset'](_0x3bd8db[_0x7279('0x2d')]['offset']);}_0x14a90d['order']=qs[_0x7279('0x36')](_0x3bd8db[_0x7279('0x2d')][_0x7279('0x36')]);_0x14a90d[_0x7279('0x37')]=qs[_0x7279('0x2f')](_['pick'](_0x3bd8db['query'],_0xe03af[_0x7279('0x2f')]),_0x48c50c);if(_0x3bd8db[_0x7279('0x2d')][_0x7279('0x38')]){_0x14a90d[_0x7279('0x37')]=_[_0x7279('0x39')](_0x14a90d[_0x7279('0x37')],{'$or':_['map'](_0x48c50c,function(_0x1df610){if(_0x1df610[_0x7279('0x2a')]!=='VIRTUAL'){var _0x356e36={};_0x356e36[_0x1df610[_0x7279('0x23')]]={'$like':'%'+_0x3bd8db[_0x7279('0x2d')]['filter']+'%'};return _0x356e36;}})});}_0x14a90d=_[_0x7279('0x39')]({},_0x14a90d,_0x3bd8db[_0x7279('0x3a')]);var _0x3f3471={'where':_0x14a90d['where']};return db[_0x7279('0x27')][_0x7279('0x1c')](_0x3f3471)[_0x7279('0x1f')](function(_0x13ba96){_0x565d51['count']=_0x13ba96;if(_0x3bd8db[_0x7279('0x2d')][_0x7279('0x3b')]){_0x14a90d['include']=[{'all':!![]}];}return db[_0x7279('0x27')][_0x7279('0x3c')](_0x14a90d);})[_0x7279('0x1f')](function(_0x2971b7){_0x565d51[_0x7279('0x3d')]=_0x2971b7;return _0x565d51;})[_0x7279('0x1f')](respondWithFilteredResult(_0x3259b2,_0x14a90d))['catch'](handleError(_0x3259b2,null));};exports[_0x7279('0x3e')]=function(_0x7defeb,_0x52f817){var _0x14a369={'raw':![],'where':{'id':_0x7defeb[_0x7279('0x3f')]['id']}},_0x2dbbb2={};_0x2dbbb2['model']=_[_0x7279('0x2e')](db['AnalyticFieldReport'][_0x7279('0x28')]);_0x2dbbb2[_0x7279('0x2d')]=_[_0x7279('0x2e')](_0x7defeb['query']);_0x2dbbb2[_0x7279('0x2f')]=_[_0x7279('0x30')](_0x2dbbb2['model'],_0x2dbbb2[_0x7279('0x2d')]);_0x14a369[_0x7279('0x32')]=_['intersection'](_0x2dbbb2[_0x7279('0x2c')],qs[_0x7279('0x31')](_0x7defeb[_0x7279('0x2d')][_0x7279('0x31')]));_0x14a369[_0x7279('0x32')]=_0x14a369['attributes']['length']?_0x14a369[_0x7279('0x32')]:_0x2dbbb2[_0x7279('0x2c')];if(_0x7defeb[_0x7279('0x2d')]['includeAll']){_0x14a369['include']=[{'all':!![]}];}_0x14a369=_[_0x7279('0x39')]({},_0x14a369,_0x7defeb[_0x7279('0x3a')]);return db['AnalyticFieldReport'][_0x7279('0x40')](_0x14a369)[_0x7279('0x1f')](handleEntityNotFound(_0x52f817,null))[_0x7279('0x1f')](respondWithResult(_0x52f817,null))['catch'](handleError(_0x52f817,null));};exports['create']=function(_0x1ba3ad,_0x4e4f33){return db[_0x7279('0x27')]['create'](_0x1ba3ad[_0x7279('0x41')],{})['then'](respondWithResult(_0x4e4f33,0xc9))['catch'](handleError(_0x4e4f33,null));};exports[_0x7279('0x42')]=function(_0x51bc41,_0x9f83f3){return db['AnalyticFieldReport'][_0x7279('0x42')](_0x51bc41[_0x7279('0x41')],{'raw':![],'individualHooks':!![]})[_0x7279('0x1f')](respondWithResult(_0x9f83f3,0xc9))[_0x7279('0x43')](handleError(_0x9f83f3,null));};exports[_0x7279('0x44')]=function(_0x103bc7,_0x4eb919){if(_0x103bc7[_0x7279('0x41')]['id']){delete _0x103bc7[_0x7279('0x41')]['id'];}return db[_0x7279('0x27')]['find']({'where':{'id':_0x103bc7['params']['id']}})['then'](handleEntityNotFound(_0x4eb919,null))[_0x7279('0x1f')](saveUpdates(_0x103bc7[_0x7279('0x41')],null))['then'](respondWithResult(_0x4eb919,null))['catch'](handleError(_0x4eb919,null));};exports[_0x7279('0x20')]=function(_0x5ebdce,_0x4b5bad){return db[_0x7279('0x27')][_0x7279('0x40')]({'where':{'id':_0x5ebdce['params']['id']}})['then'](handleEntityNotFound(_0x4b5bad,null))[_0x7279('0x1f')](removeEntity(_0x4b5bad,null))[_0x7279('0x43')](handleError(_0x4b5bad,null));};exports[_0x7279('0x45')]=function(_0x557549,_0x537612){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x557549[_0x7279('0x2d')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x7279('0x1f')](respondWithResult(_0x537612,0xcc))[_0x7279('0x43')](handleError(_0x537612,null));};exports[_0x7279('0x46')]=function(_0x298ffa,_0x49f596,_0x56e736){return db[_0x7279('0x47')][_0x7279('0x48')]({'where':{'id':_0x298ffa[_0x7279('0x3f')]['id']}})[_0x7279('0x1f')](handleEntityNotFound(_0x49f596,null))[_0x7279('0x1f')](function(_0xf1a567){if(_0xf1a567){return db[_0x7279('0x49')][_0x7279('0x4a')](function(_0x29c818){return db[_0x7279('0x27')][_0x7279('0x20')]({'where':{'CustomReportId':_0x298ffa[_0x7279('0x3f')]['id']},'transaction':_0x29c818})['then'](function(_0x10da7d){var _0x197700=_[_0x7279('0x26')](_0x298ffa[_0x7279('0x41')],function(_0x43c5df){delete _0x43c5df['id'];_0x43c5df[_0x7279('0x4b')]=_0x298ffa[_0x7279('0x3f')]['id'];return _0x43c5df;});return db['AnalyticFieldReport']['bulkCreate'](_0x197700,{'transaction':_0x29c818});});})[_0x7279('0x1f')](function(){return db[_0x7279('0x27')][_0x7279('0x3c')]({'where':{'CustomReportId':_0x298ffa[_0x7279('0x3f')]['id']}});});}})[_0x7279('0x1f')](respondWithResult(_0x49f596,null))[_0x7279('0x43')](handleError(_0x49f596,null));}; \ No newline at end of file +var _0x0c7f=['bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','AnalyticFieldReport','include','findAll','rows','catch','show','params','includeAll','find','create','body','bulkCreate','ids','AnalyticCustomReport','findOne','sequelize','CustomReportId','eml-format','rimraf','fast-json-patch'];(function(_0x55a141,_0x261839){var _0x53ac06=function(_0x54a738){while(--_0x54a738){_0x55a141['push'](_0x55a141['shift']());}};_0x53ac06(++_0x261839);}(_0x0c7f,0x13d));var _0xf0c7=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0c7f[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0xf0c7('0x0'));var rimraf=require(_0xf0c7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf0c7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0c7('0x3'));var Mustache=require(_0xf0c7('0x4'));var util=require(_0xf0c7('0x5'));var path=require(_0xf0c7('0x6'));var sox=require('sox');var csv=require(_0xf0c7('0x7'));var ejs=require(_0xf0c7('0x8'));var fs=require('fs');var fs_extra=require(_0xf0c7('0x9'));var _=require(_0xf0c7('0xa'));var squel=require(_0xf0c7('0xb'));var crypto=require(_0xf0c7('0xc'));var jsforce=require(_0xf0c7('0xd'));var deskjs=require(_0xf0c7('0xe'));var toCsv=require(_0xf0c7('0x7'));var querystring=require(_0xf0c7('0xf'));var Papa=require(_0xf0c7('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf0c7('0x11'));var as=require(_0xf0c7('0x12'));var hardwareService=require(_0xf0c7('0x13'));var logger=require('../../config/logger')(_0xf0c7('0x14'));var utils=require(_0xf0c7('0x15'));var config=require(_0xf0c7('0x16'));var licenseUtil=require(_0xf0c7('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34f6c1,_0x154592){_0x154592=_0x154592||0xcc;return function(_0x4b670b){if(_0x4b670b){return _0x34f6c1[_0xf0c7('0x18')](_0x154592);}return _0x34f6c1[_0xf0c7('0x19')](_0x154592)[_0xf0c7('0x1a')]();};}function respondWithResult(_0x374ce1,_0x412e22){_0x412e22=_0x412e22||0xc8;return function(_0x183ba2){if(_0x183ba2){return _0x374ce1[_0xf0c7('0x19')](_0x412e22)[_0xf0c7('0x1b')](_0x183ba2);}};}function respondWithFilteredResult(_0x2c9f2b,_0x5a0668){return function(_0x292b12){if(_0x292b12){var _0x388f10=typeof _0x5a0668[_0xf0c7('0x1c')]===_0xf0c7('0x1d')&&typeof _0x5a0668['limit']===_0xf0c7('0x1d');var _0x38a2c4=_0x292b12[_0xf0c7('0x1e')];var _0x2019bc=_0x388f10?0x0:_0x5a0668['offset'];var _0x459d36=_0x388f10?_0x292b12[_0xf0c7('0x1e')]:_0x5a0668['offset']+_0x5a0668[_0xf0c7('0x1f')];var _0x1529d9;if(_0x459d36>=_0x38a2c4){_0x459d36=_0x38a2c4;_0x1529d9=0xc8;}else{_0x1529d9=0xce;}_0x2c9f2b['status'](_0x1529d9);return _0x2c9f2b['set']('Content-Range',_0x2019bc+'-'+_0x459d36+'/'+_0x38a2c4)[_0xf0c7('0x1b')](_0x292b12);}return null;};}function patchUpdates(_0x4c260b){return function(_0x1e8b5f){try{jsonpatch[_0xf0c7('0x20')](_0x1e8b5f,_0x4c260b,!![]);}catch(_0x506a77){return BPromise[_0xf0c7('0x21')](_0x506a77);}return _0x1e8b5f[_0xf0c7('0x22')]();};}function saveUpdates(_0x77c5f1,_0x28a332){return function(_0x14bbf8){if(_0x14bbf8){return _0x14bbf8[_0xf0c7('0x23')](_0x77c5f1)[_0xf0c7('0x24')](function(_0x1c62b2){return _0x1c62b2;});}return null;};}function removeEntity(_0x3ad817,_0x34e4de){return function(_0x134073){if(_0x134073){return _0x134073[_0xf0c7('0x25')]()[_0xf0c7('0x24')](function(){_0x3ad817[_0xf0c7('0x19')](0xcc)[_0xf0c7('0x1a')]();});}};}function handleEntityNotFound(_0x472974,_0x1da411){return function(_0x215e18){if(!_0x215e18){_0x472974[_0xf0c7('0x18')](0x194);}return _0x215e18;};}function handleError(_0x47633b,_0x364a1c){_0x364a1c=_0x364a1c||0x1f4;return function(_0x264193){logger[_0xf0c7('0x26')](_0x264193[_0xf0c7('0x27')]);if(_0x264193[_0xf0c7('0x28')]){delete _0x264193[_0xf0c7('0x28')];}_0x47633b[_0xf0c7('0x19')](_0x364a1c)['send'](_0x264193);};}exports[_0xf0c7('0x29')]=function(_0x16da20,_0x4ec466){var _0x4a15c1={},_0x12577b={},_0x45df0a={'count':0x0,'rows':[]};var _0x16288f=_[_0xf0c7('0x2a')](db['AnalyticFieldReport'][_0xf0c7('0x2b')],function(_0x51d2bc){return{'name':_0x51d2bc[_0xf0c7('0x2c')],'type':_0x51d2bc[_0xf0c7('0x2d')][_0xf0c7('0x2e')]};});_0x12577b[_0xf0c7('0x2f')]=_[_0xf0c7('0x2a')](_0x16288f,_0xf0c7('0x28'));_0x12577b[_0xf0c7('0x30')]=_[_0xf0c7('0x31')](_0x16da20[_0xf0c7('0x30')]);_0x12577b[_0xf0c7('0x32')]=_['intersection'](_0x12577b[_0xf0c7('0x2f')],_0x12577b[_0xf0c7('0x30')]);_0x4a15c1[_0xf0c7('0x33')]=_[_0xf0c7('0x34')](_0x12577b['model'],qs[_0xf0c7('0x35')](_0x16da20['query'][_0xf0c7('0x35')]));_0x4a15c1[_0xf0c7('0x33')]=_0x4a15c1['attributes'][_0xf0c7('0x36')]?_0x4a15c1[_0xf0c7('0x33')]:_0x12577b[_0xf0c7('0x2f')];if(!_0x16da20[_0xf0c7('0x30')][_0xf0c7('0x37')]('nolimit')){_0x4a15c1['limit']=qs['limit'](_0x16da20[_0xf0c7('0x30')][_0xf0c7('0x1f')]);_0x4a15c1['offset']=qs['offset'](_0x16da20[_0xf0c7('0x30')][_0xf0c7('0x1c')]);}_0x4a15c1[_0xf0c7('0x38')]=qs[_0xf0c7('0x39')](_0x16da20['query'][_0xf0c7('0x39')]);_0x4a15c1[_0xf0c7('0x3a')]=qs[_0xf0c7('0x32')](_[_0xf0c7('0x3b')](_0x16da20['query'],_0x12577b[_0xf0c7('0x32')]),_0x16288f);if(_0x16da20[_0xf0c7('0x30')]['filter']){_0x4a15c1[_0xf0c7('0x3a')]=_[_0xf0c7('0x3c')](_0x4a15c1[_0xf0c7('0x3a')],{'$or':_[_0xf0c7('0x2a')](_0x16288f,function(_0x3fc5a5){if(_0x3fc5a5[_0xf0c7('0x2d')]!=='VIRTUAL'){var _0x186d20={};_0x186d20[_0x3fc5a5[_0xf0c7('0x28')]]={'$like':'%'+_0x16da20[_0xf0c7('0x30')][_0xf0c7('0x3d')]+'%'};return _0x186d20;}})});}_0x4a15c1=_[_0xf0c7('0x3c')]({},_0x4a15c1,_0x16da20[_0xf0c7('0x3e')]);var _0x1fe5a9={'where':_0x4a15c1[_0xf0c7('0x3a')]};return db[_0xf0c7('0x3f')][_0xf0c7('0x1e')](_0x1fe5a9)[_0xf0c7('0x24')](function(_0x45808b){_0x45df0a['count']=_0x45808b;if(_0x16da20[_0xf0c7('0x30')]['includeAll']){_0x4a15c1[_0xf0c7('0x40')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xf0c7('0x41')](_0x4a15c1);})[_0xf0c7('0x24')](function(_0x48747e){_0x45df0a[_0xf0c7('0x42')]=_0x48747e;return _0x45df0a;})[_0xf0c7('0x24')](respondWithFilteredResult(_0x4ec466,_0x4a15c1))[_0xf0c7('0x43')](handleError(_0x4ec466,null));};exports[_0xf0c7('0x44')]=function(_0x10b253,_0x50c077){var _0x1e6d0e={'raw':![],'where':{'id':_0x10b253[_0xf0c7('0x45')]['id']}},_0xfd9026={};_0xfd9026['model']=_[_0xf0c7('0x31')](db[_0xf0c7('0x3f')][_0xf0c7('0x2b')]);_0xfd9026[_0xf0c7('0x30')]=_[_0xf0c7('0x31')](_0x10b253[_0xf0c7('0x30')]);_0xfd9026[_0xf0c7('0x32')]=_['intersection'](_0xfd9026[_0xf0c7('0x2f')],_0xfd9026[_0xf0c7('0x30')]);_0x1e6d0e['attributes']=_[_0xf0c7('0x34')](_0xfd9026['model'],qs['fields'](_0x10b253[_0xf0c7('0x30')]['fields']));_0x1e6d0e[_0xf0c7('0x33')]=_0x1e6d0e[_0xf0c7('0x33')][_0xf0c7('0x36')]?_0x1e6d0e[_0xf0c7('0x33')]:_0xfd9026['model'];if(_0x10b253[_0xf0c7('0x30')][_0xf0c7('0x46')]){_0x1e6d0e[_0xf0c7('0x40')]=[{'all':!![]}];}_0x1e6d0e=_[_0xf0c7('0x3c')]({},_0x1e6d0e,_0x10b253[_0xf0c7('0x3e')]);return db[_0xf0c7('0x3f')][_0xf0c7('0x47')](_0x1e6d0e)[_0xf0c7('0x24')](handleEntityNotFound(_0x50c077,null))[_0xf0c7('0x24')](respondWithResult(_0x50c077,null))['catch'](handleError(_0x50c077,null));};exports[_0xf0c7('0x48')]=function(_0x39805e,_0x40ae08){return db['AnalyticFieldReport']['create'](_0x39805e[_0xf0c7('0x49')],{})[_0xf0c7('0x24')](respondWithResult(_0x40ae08,0xc9))[_0xf0c7('0x43')](handleError(_0x40ae08,null));};exports[_0xf0c7('0x4a')]=function(_0x1c267c,_0x5aab36){return db[_0xf0c7('0x3f')][_0xf0c7('0x4a')](_0x1c267c[_0xf0c7('0x49')],{'raw':![],'individualHooks':!![]})[_0xf0c7('0x24')](respondWithResult(_0x5aab36,0xc9))[_0xf0c7('0x43')](handleError(_0x5aab36,null));};exports[_0xf0c7('0x23')]=function(_0x3947d5,_0x10848e){if(_0x3947d5[_0xf0c7('0x49')]['id']){delete _0x3947d5[_0xf0c7('0x49')]['id'];}return db[_0xf0c7('0x3f')]['find']({'where':{'id':_0x3947d5[_0xf0c7('0x45')]['id']}})['then'](handleEntityNotFound(_0x10848e,null))[_0xf0c7('0x24')](saveUpdates(_0x3947d5['body'],null))[_0xf0c7('0x24')](respondWithResult(_0x10848e,null))[_0xf0c7('0x43')](handleError(_0x10848e,null));};exports['destroy']=function(_0x18231f,_0x5a26b6){return db[_0xf0c7('0x3f')][_0xf0c7('0x47')]({'where':{'id':_0x18231f[_0xf0c7('0x45')]['id']}})[_0xf0c7('0x24')](handleEntityNotFound(_0x5a26b6,null))[_0xf0c7('0x24')](removeEntity(_0x5a26b6,null))[_0xf0c7('0x43')](handleError(_0x5a26b6,null));};exports['bulkDestroy']=function(_0x1be862,_0x194c06){return db[_0xf0c7('0x3f')][_0xf0c7('0x25')]({'where':{'id':_0x1be862[_0xf0c7('0x30')][_0xf0c7('0x4b')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x194c06,0xcc))[_0xf0c7('0x43')](handleError(_0x194c06,null));};exports['addFields']=function(_0x98df5,_0x1e44d6,_0x5f047b){return db[_0xf0c7('0x4c')][_0xf0c7('0x4d')]({'where':{'id':_0x98df5[_0xf0c7('0x45')]['id']}})[_0xf0c7('0x24')](handleEntityNotFound(_0x1e44d6,null))[_0xf0c7('0x24')](function(_0x30c77c){if(_0x30c77c){return db[_0xf0c7('0x4e')]['transaction'](function(_0x331a64){return db[_0xf0c7('0x3f')][_0xf0c7('0x25')]({'where':{'CustomReportId':_0x98df5[_0xf0c7('0x45')]['id']},'transaction':_0x331a64})[_0xf0c7('0x24')](function(_0x48bf3c){var _0x2ac323=_[_0xf0c7('0x2a')](_0x98df5[_0xf0c7('0x49')],function(_0x27364b){delete _0x27364b['id'];_0x27364b[_0xf0c7('0x4f')]=_0x98df5[_0xf0c7('0x45')]['id'];return _0x27364b;});return db[_0xf0c7('0x3f')]['bulkCreate'](_0x2ac323,{'transaction':_0x331a64});});})[_0xf0c7('0x24')](function(){return db['AnalyticFieldReport'][_0xf0c7('0x41')]({'where':{'CustomReportId':_0x98df5['params']['id']}});});}})['then'](respondWithResult(_0x1e44d6,null))['catch'](handleError(_0x1e44d6,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index c436f68..58a1666 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 _0xd26b=['exports','define','AnalyticFieldReport','analytics_report_fields','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes'];(function(_0x2dd293,_0x1afb28){var _0x43db4e=function(_0x128142){while(--_0x128142){_0x2dd293['push'](_0x2dd293['shift']());}};_0x43db4e(++_0x1afb28);}(_0xd26b,0x1e5));var _0xbd26=function(_0x35fc62,_0x2b5f7){_0x35fc62=_0x35fc62-0x0;var _0xd54e91=_0xd26b[_0x35fc62];return _0xd54e91;};'use strict';var _=require('lodash');var util=require(_0xbd26('0x0'));var logger=require(_0xbd26('0x1'))(_0xbd26('0x2'));var moment=require(_0xbd26('0x3'));var BPromise=require(_0xbd26('0x4'));var rp=require(_0xbd26('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd26('0x6'));var config=require(_0xbd26('0x7'));var attributes=require(_0xbd26('0x8'));module[_0xbd26('0x9')]=function(_0x419ea9,_0x41dea9){return _0x419ea9[_0xbd26('0xa')](_0xbd26('0xb'),attributes,{'tableName':_0xbd26('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b15=['rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x4416ea,_0x252686){var _0x4b3cbe=function(_0x343505){while(--_0x343505){_0x4416ea['push'](_0x4416ea['shift']());}};_0x4b3cbe(++_0x252686);}(_0x6b15,0x1a7));var _0x56b1=function(_0x531535,_0x39872c){_0x531535=_0x531535-0x0;var _0x3f1563=_0x6b15[_0x531535];return _0x3f1563;};'use strict';var _=require(_0x56b1('0x0'));var util=require(_0x56b1('0x1'));var logger=require(_0x56b1('0x2'))(_0x56b1('0x3'));var moment=require('moment');var BPromise=require(_0x56b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x56b1('0x5'));var rimraf=require(_0x56b1('0x6'));var config=require(_0x56b1('0x7'));var attributes=require(_0x56b1('0x8'));module[_0x56b1('0x9')]=function(_0x5b2e45,_0x10ee05){return _0x5b2e45[_0x56b1('0xa')](_0x56b1('0xb'),attributes,{'tableName':_0x56b1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 44cbddd..f94af49 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 _0x301c=['moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','request\x20sent','catch','util'];(function(_0x211fef,_0x4ab716){var _0x5447bf=function(_0x306ea3){while(--_0x306ea3){_0x211fef['push'](_0x211fef['shift']());}};_0x5447bf(++_0x4ab716);}(_0x301c,0x1a3));var _0xc301=function(_0x23b3e0,_0x802d57){_0x23b3e0=_0x23b3e0-0x0;var _0x122558=_0x301c[_0x23b3e0];return _0x122558;};'use strict';var _=require('lodash');var util=require(_0xc301('0x0'));var moment=require(_0xc301('0x1'));var BPromise=require('bluebird');var rs=require(_0xc301('0x2'));var fs=require('fs');var Redis=require(_0xc301('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc301('0x4'));var logger=require(_0xc301('0x5'))('rpc');var config=require(_0xc301('0x6'));var jayson=require(_0xc301('0x7'));var client=jayson[_0xc301('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34854f,_0x1566a5,_0x22fe60){return new BPromise(function(_0x52ca25,_0x1aa4a2){return client[_0xc301('0x9')](_0x34854f,_0x22fe60)[_0xc301('0xa')](function(_0x106e91){logger[_0xc301('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1566a5,'request\x20sent');logger[_0xc301('0xc')](_0xc301('0xd'),_0x1566a5,'request\x20sent',JSON[_0xc301('0xe')](_0x106e91));if(_0x106e91[_0xc301('0xf')]){if(_0x106e91[_0xc301('0xf')][_0xc301('0x10')]===0x1f4){logger[_0xc301('0xf')](_0xc301('0x11'),_0x1566a5,_0x106e91['error'][_0xc301('0x12')]);return _0x1aa4a2(_0x106e91['error'][_0xc301('0x12')]);}logger['error'](_0xc301('0x11'),_0x1566a5,_0x106e91[_0xc301('0xf')][_0xc301('0x12')]);return _0x52ca25(_0x106e91[_0xc301('0xf')][_0xc301('0x12')]);}else{logger[_0xc301('0xb')](_0xc301('0x11'),_0x1566a5,_0xc301('0x13'));_0x52ca25(_0x106e91['result']['message']);}})[_0xc301('0x14')](function(_0x53cd74){logger[_0xc301('0xf')](_0xc301('0x11'),_0x1566a5,_0x53cd74);_0x1aa4a2(_0x53cd74);});});} \ No newline at end of file +var _0x6163=['debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x6163,0x183));var _0x3616=function(_0x39ad37,_0x34f987){_0x39ad37=_0x39ad37-0x0;var _0x4c1eae=_0x6163[_0x39ad37];return _0x4c1eae;};'use strict';var _=require(_0x3616('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3616('0x1'));var rs=require(_0x3616('0x2'));var fs=require('fs');var Redis=require(_0x3616('0x3'));var db=require(_0x3616('0x4'))['db'];var utils=require(_0x3616('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3616('0x6'));var client=jayson[_0x3616('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x384e30,_0x274bb4,_0x3e42a2){return new BPromise(function(_0x317021,_0x10b2d6){return client[_0x3616('0x8')](_0x384e30,_0x3e42a2)[_0x3616('0x9')](function(_0x554740){logger[_0x3616('0xa')]('AnalyticFieldReport,\x20%s,\x20%s',_0x274bb4,_0x3616('0xb'));logger[_0x3616('0xc')](_0x3616('0xd'),_0x274bb4,_0x3616('0xb'),JSON['stringify'](_0x554740));if(_0x554740['error']){if(_0x554740[_0x3616('0xe')][_0x3616('0xf')]===0x1f4){logger[_0x3616('0xe')](_0x3616('0x10'),_0x274bb4,_0x554740[_0x3616('0xe')][_0x3616('0x11')]);return _0x10b2d6(_0x554740[_0x3616('0xe')][_0x3616('0x11')]);}logger[_0x3616('0xe')](_0x3616('0x10'),_0x274bb4,_0x554740[_0x3616('0xe')][_0x3616('0x11')]);return _0x317021(_0x554740[_0x3616('0xe')][_0x3616('0x11')]);}else{logger[_0x3616('0xa')](_0x3616('0x10'),_0x274bb4,'request\x20sent');_0x317021(_0x554740['result'][_0x3616('0x11')]);}})[_0x3616('0x12')](function(_0x29c7fd){logger[_0x3616('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x274bb4,_0x29c7fd);_0x10b2d6(_0x29c7fd);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index cf25bdb..f87b1da 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(_0x33e293,_0x44ff9c){var _0x546165=function(_0x3b2354){while(--_0x3b2354){_0x33e293['push'](_0x33e293['shift']());}};_0x546165(++_0x44ff9c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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(_0x550bfd,_0x4611a3){var _0x6579c4=function(_0xe7f789){while(--_0xe7f789){_0x550bfd['push'](_0x550bfd['shift']());}};_0x6579c4(++_0x4611a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 656e78a..3c099c5 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 _0xfb3f=['STRING','sequelize','exports','name'];(function(_0x5d1af0,_0x5f125d){var _0x1187d1=function(_0x552a45){while(--_0x552a45){_0x5d1af0['push'](_0x5d1af0['shift']());}};_0x1187d1(++_0x5f125d);}(_0xfb3f,0xd9));var _0xffb3=function(_0x206145,_0x1cb5d6){_0x206145=_0x206145-0x0;var _0x453b55=_0xfb3f[_0x206145];return _0x453b55;};'use strict';var Sequelize=require(_0xffb3('0x0'));module[_0xffb3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xffb3('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xffb3('0x3')]}}; \ No newline at end of file +var _0x74b1=['STRING','sequelize','exports','name'];(function(_0x36873c,_0x4f1c4f){var _0x5082dd=function(_0x44c7c4){while(--_0x44c7c4){_0x36873c['push'](_0x36873c['shift']());}};_0x5082dd(++_0x4f1c4f);}(_0x74b1,0xb5));var _0x174b=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x74b1[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require(_0x174b('0x0'));module[_0x174b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x174b('0x2')},'table':{'type':Sequelize[_0x174b('0x3')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x174b('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 41978dd..016269e 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','AnalyticMetric','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xe20ac4,_0x3b9e32){var _0x1ccb8f=function(_0x235ce0){while(--_0x235ce0){_0xe20ac4['push'](_0xe20ac4['shift']());}};_0x1ccb8f(++_0x3b9e32);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5aa70e,_0x194819){_0x5aa70e=_0x5aa70e-0x0;var _0x484723=_0x8ef6[_0x5aa70e];return _0x484723;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xcc;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0x1b')](_0x454ef4);}return _0x1e117a['status'](_0x454ef4)[_0x68ef('0x1c')]();};}function respondWithResult(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0xc8;return function(_0x47fbb5){if(_0x47fbb5){return _0xc50cce[_0x68ef('0x1d')](_0x2657c5)[_0x68ef('0x1e')](_0x47fbb5);}};}function respondWithFilteredResult(_0x24682d,_0x5005ba){return function(_0x35493d){if(_0x35493d){var _0x37c4cc=typeof _0x5005ba[_0x68ef('0x1f')]===_0x68ef('0x20')&&typeof _0x5005ba['limit']===_0x68ef('0x20');var _0x54139e=_0x35493d['count'];var _0x2633c1=_0x37c4cc?0x0:_0x5005ba[_0x68ef('0x1f')];var _0x4ade0d=_0x37c4cc?_0x35493d['count']:_0x5005ba[_0x68ef('0x1f')]+_0x5005ba[_0x68ef('0x21')];var _0x318514;if(_0x4ade0d>=_0x54139e){_0x4ade0d=_0x54139e;_0x318514=0xc8;}else{_0x318514=0xce;}_0x24682d['status'](_0x318514);return _0x24682d[_0x68ef('0x22')](_0x68ef('0x23'),_0x2633c1+'-'+_0x4ade0d+'/'+_0x54139e)[_0x68ef('0x1e')](_0x35493d);}return null;};}function patchUpdates(_0x5b246b){return function(_0x3c46d4){try{jsonpatch[_0x68ef('0x24')](_0x3c46d4,_0x5b246b,!![]);}catch(_0x5af19f){return BPromise[_0x68ef('0x25')](_0x5af19f);}return _0x3c46d4[_0x68ef('0x26')]();};}function saveUpdates(_0x19aa3d,_0x5ddec7){return function(_0x59723c){if(_0x59723c){return _0x59723c['update'](_0x19aa3d)[_0x68ef('0x27')](function(_0x2023f2){return _0x2023f2;});}return null;};}function removeEntity(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(_0x438b4c){return _0x438b4c[_0x68ef('0x28')]()[_0x68ef('0x27')](function(){var _0x49374f=_0x438b4c[_0x68ef('0x29')]({'plain':!![]});var _0x13280b='Metrics';return db[_0x68ef('0x2a')]['destroy']({'where':{'type':_0x13280b,'resourceId':_0x49374f['id']}})['then'](function(){return _0x438b4c;});})['then'](function(){_0x312cc9[_0x68ef('0x1d')](0xcc)[_0x68ef('0x1c')]();});}};}function handleEntityNotFound(_0x123041,_0x29518e){return function(_0x52e67e){if(!_0x52e67e){_0x123041['sendStatus'](0x194);}return _0x52e67e;};}function handleError(_0x1cbe4f,_0x28907a){_0x28907a=_0x28907a||0x1f4;return function(_0x7bf96){logger[_0x68ef('0x2b')](_0x7bf96[_0x68ef('0x2c')]);if(_0x7bf96[_0x68ef('0x2d')]){delete _0x7bf96[_0x68ef('0x2d')];}_0x1cbe4f[_0x68ef('0x1d')](_0x28907a)['send'](_0x7bf96);};}exports[_0x68ef('0x2e')]=function(_0x4314bd,_0x132d9e){var _0x4c25aa={},_0x370a8f={},_0x523120={'count':0x0,'rows':[]};var _0x133788=_[_0x68ef('0x2f')](db['AnalyticMetric']['rawAttributes'],function(_0x159395){return{'name':_0x159395[_0x68ef('0x30')],'type':_0x159395['type'][_0x68ef('0x31')]};});_0x370a8f[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0x133788,_0x68ef('0x2d'));_0x370a8f['query']=_[_0x68ef('0x33')](_0x4314bd[_0x68ef('0x34')]);_0x370a8f['filters']=_[_0x68ef('0x35')](_0x370a8f['model'],_0x370a8f[_0x68ef('0x34')]);_0x4c25aa[_0x68ef('0x36')]=_['intersection'](_0x370a8f[_0x68ef('0x32')],qs['fields'](_0x4314bd[_0x68ef('0x34')]['fields']));_0x4c25aa[_0x68ef('0x36')]=_0x4c25aa[_0x68ef('0x36')][_0x68ef('0x37')]?_0x4c25aa['attributes']:_0x370a8f[_0x68ef('0x32')];if(!_0x4314bd['query'][_0x68ef('0x38')]('nolimit')){_0x4c25aa[_0x68ef('0x21')]=qs[_0x68ef('0x21')](_0x4314bd[_0x68ef('0x34')][_0x68ef('0x21')]);_0x4c25aa[_0x68ef('0x1f')]=qs[_0x68ef('0x1f')](_0x4314bd['query'][_0x68ef('0x1f')]);}_0x4c25aa[_0x68ef('0x39')]=qs[_0x68ef('0x3a')](_0x4314bd['query'][_0x68ef('0x3a')]);_0x4c25aa[_0x68ef('0x3b')]=qs[_0x68ef('0x3c')](_['pick'](_0x4314bd['query'],_0x370a8f[_0x68ef('0x3c')]),_0x133788);if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x3d')]){_0x4c25aa[_0x68ef('0x3b')]=_[_0x68ef('0x3e')](_0x4c25aa[_0x68ef('0x3b')],{'$or':_[_0x68ef('0x2f')](_0x133788,function(_0x5b1246){if(_0x5b1246[_0x68ef('0x3f')]!==_0x68ef('0x40')){var _0x2f6ee0={};_0x2f6ee0[_0x5b1246[_0x68ef('0x2d')]]={'$like':'%'+_0x4314bd['query'][_0x68ef('0x3d')]+'%'};return _0x2f6ee0;}})});}_0x4c25aa=_[_0x68ef('0x3e')]({},_0x4c25aa,_0x4314bd[_0x68ef('0x41')]);var _0x410c10={'where':_0x4c25aa[_0x68ef('0x3b')]};return db[_0x68ef('0x42')]['count'](_0x410c10)[_0x68ef('0x27')](function(_0x3f7699){_0x523120[_0x68ef('0x43')]=_0x3f7699;if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x44')]){_0x4c25aa[_0x68ef('0x45')]=[{'all':!![]}];}return db[_0x68ef('0x42')][_0x68ef('0x46')](_0x4c25aa);})[_0x68ef('0x27')](function(_0x531096){_0x523120[_0x68ef('0x47')]=_0x531096;return _0x523120;})[_0x68ef('0x27')](respondWithFilteredResult(_0x132d9e,_0x4c25aa))[_0x68ef('0x48')](handleError(_0x132d9e,null));};exports[_0x68ef('0x49')]=function(_0xdeacf2,_0x183377){var _0xcac58f={'raw':!![],'where':{'id':_0xdeacf2[_0x68ef('0x4a')]['id']}},_0x576767={};_0x576767['model']=_[_0x68ef('0x33')](db[_0x68ef('0x42')][_0x68ef('0x4b')]);_0x576767[_0x68ef('0x34')]=_['keys'](_0xdeacf2[_0x68ef('0x34')]);_0x576767['filters']=_[_0x68ef('0x35')](_0x576767['model'],_0x576767[_0x68ef('0x34')]);_0xcac58f[_0x68ef('0x36')]=_[_0x68ef('0x35')](_0x576767['model'],qs['fields'](_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x4c')]));_0xcac58f['attributes']=_0xcac58f['attributes']['length']?_0xcac58f[_0x68ef('0x36')]:_0x576767[_0x68ef('0x32')];if(_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x44')]){_0xcac58f[_0x68ef('0x45')]=[{'all':!![]}];}_0xcac58f=_['merge']({},_0xcac58f,_0xdeacf2['options']);return db[_0x68ef('0x42')][_0x68ef('0x4d')](_0xcac58f)[_0x68ef('0x27')](handleEntityNotFound(_0x183377,null))[_0x68ef('0x27')](respondWithResult(_0x183377,null))['catch'](handleError(_0x183377,null));};exports[_0x68ef('0x4e')]=function(_0x474e5a,_0x1c9b6f){return db[_0x68ef('0x42')]['create'](_0x474e5a['body'],{})[_0x68ef('0x27')](function(_0x3c3074){var _0x566e7c=_0x474e5a[_0x68ef('0x4f')][_0x68ef('0x29')]({'plain':!![]});if(!_0x566e7c)throw new Error(_0x68ef('0x50'));if(_0x566e7c[_0x68ef('0x51')]===_0x68ef('0x4f')){var _0x4f0f77=_0x3c3074[_0x68ef('0x29')]({'plain':!![]});var _0x3984ca=_0x68ef('0x52');return db['UserProfileSection'][_0x68ef('0x4d')]({'where':{'name':_0x3984ca,'userProfileId':_0x566e7c[_0x68ef('0x53')]},'raw':!![]})[_0x68ef('0x27')](function(_0x50ef1f){if(_0x50ef1f&&_0x50ef1f[_0x68ef('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f0f77[_0x68ef('0x2d')],'resourceId':_0x4f0f77['id'],'type':_0x50ef1f['name'],'sectionId':_0x50ef1f['id']},{})[_0x68ef('0x27')](function(){return _0x3c3074;});}else{return _0x3c3074;}})[_0x68ef('0x48')](function(_0x53ebd){logger[_0x68ef('0x2b')](_0x68ef('0x55'),_0x53ebd);throw _0x53ebd;});}return _0x3c3074;})[_0x68ef('0x27')](respondWithResult(_0x1c9b6f,0xc9))[_0x68ef('0x48')](handleError(_0x1c9b6f,null));};exports[_0x68ef('0x56')]=function(_0x2b35f4,_0x247915){if(_0x2b35f4['body']['id']){delete _0x2b35f4['body']['id'];}return db[_0x68ef('0x42')][_0x68ef('0x4d')]({'where':{'id':_0x2b35f4[_0x68ef('0x4a')]['id']}})[_0x68ef('0x27')](handleEntityNotFound(_0x247915,null))[_0x68ef('0x27')](saveUpdates(_0x2b35f4[_0x68ef('0x57')],null))[_0x68ef('0x27')](respondWithResult(_0x247915,null))[_0x68ef('0x48')](handleError(_0x247915,null));};exports[_0x68ef('0x28')]=function(_0x4c2e9c,_0x5685bb){return db[_0x68ef('0x42')]['find']({'where':{'id':_0x4c2e9c[_0x68ef('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5685bb,null))[_0x68ef('0x27')](removeEntity(_0x5685bb,null))[_0x68ef('0x48')](handleError(_0x5685bb,null));}; \ No newline at end of file +var _0x81bd=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','AnalyticMetric','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Metrics','stack','name','send','index','map','fieldName','query','keys'];(function(_0x192bc9,_0x4408c7){var _0x48397b=function(_0x2e03e6){while(--_0x2e03e6){_0x192bc9['push'](_0x192bc9['shift']());}};_0x48397b(++_0x4408c7);}(_0x81bd,0x7c));var _0xd81b=function(_0x54e81a,_0x4ba69d){_0x54e81a=_0x54e81a-0x0;var _0x937fe=_0x81bd[_0x54e81a];return _0x937fe;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21dfff,_0x57f71d){_0x57f71d=_0x57f71d||0xcc;return function(_0x3f2405){if(_0x3f2405){return _0x21dfff[_0xd81b('0x1b')](_0x57f71d);}return _0x21dfff['status'](_0x57f71d)[_0xd81b('0x1c')]();};}function respondWithResult(_0x47dd04,_0x13dd00){_0x13dd00=_0x13dd00||0xc8;return function(_0x41bf7a){if(_0x41bf7a){return _0x47dd04[_0xd81b('0x1d')](_0x13dd00)[_0xd81b('0x1e')](_0x41bf7a);}};}function respondWithFilteredResult(_0x128162,_0x552215){return function(_0x1c620d){if(_0x1c620d){var _0x27b7a0=typeof _0x552215['offset']===_0xd81b('0x1f')&&typeof _0x552215[_0xd81b('0x20')]===_0xd81b('0x1f');var _0x15e860=_0x1c620d[_0xd81b('0x21')];var _0xc49b8d=_0x27b7a0?0x0:_0x552215[_0xd81b('0x22')];var _0x3d4d34=_0x27b7a0?_0x1c620d[_0xd81b('0x21')]:_0x552215[_0xd81b('0x22')]+_0x552215[_0xd81b('0x20')];var _0x453952;if(_0x3d4d34>=_0x15e860){_0x3d4d34=_0x15e860;_0x453952=0xc8;}else{_0x453952=0xce;}_0x128162[_0xd81b('0x1d')](_0x453952);return _0x128162[_0xd81b('0x23')](_0xd81b('0x24'),_0xc49b8d+'-'+_0x3d4d34+'/'+_0x15e860)[_0xd81b('0x1e')](_0x1c620d);}return null;};}function patchUpdates(_0x5f101a){return function(_0x4d566e){try{jsonpatch[_0xd81b('0x25')](_0x4d566e,_0x5f101a,!![]);}catch(_0x1b7876){return BPromise[_0xd81b('0x26')](_0x1b7876);}return _0x4d566e['save']();};}function saveUpdates(_0x19ed0e,_0x6571a6){return function(_0x542ee2){if(_0x542ee2){return _0x542ee2[_0xd81b('0x27')](_0x19ed0e)[_0xd81b('0x28')](function(_0x1670cd){return _0x1670cd;});}return null;};}function removeEntity(_0x1ad65c,_0x279176){return function(_0xcb4f91){if(_0xcb4f91){return _0xcb4f91[_0xd81b('0x29')]()[_0xd81b('0x28')](function(){var _0x341aec=_0xcb4f91[_0xd81b('0x2a')]({'plain':!![]});var _0x2ccedf=_0xd81b('0x2b');return db['UserProfileResource'][_0xd81b('0x29')]({'where':{'type':_0x2ccedf,'resourceId':_0x341aec['id']}})[_0xd81b('0x28')](function(){return _0xcb4f91;});})[_0xd81b('0x28')](function(){_0x1ad65c[_0xd81b('0x1d')](0xcc)[_0xd81b('0x1c')]();});}};}function handleEntityNotFound(_0x2d0d02,_0x3e28dd){return function(_0x73dc09){if(!_0x73dc09){_0x2d0d02[_0xd81b('0x1b')](0x194);}return _0x73dc09;};}function handleError(_0x483a3d,_0x469cc4){_0x469cc4=_0x469cc4||0x1f4;return function(_0x4e2eff){logger['error'](_0x4e2eff[_0xd81b('0x2c')]);if(_0x4e2eff[_0xd81b('0x2d')]){delete _0x4e2eff['name'];}_0x483a3d['status'](_0x469cc4)[_0xd81b('0x2e')](_0x4e2eff);};}exports[_0xd81b('0x2f')]=function(_0x1b1434,_0x289f54){var _0x1a1572={},_0x4654ba={},_0x5527ed={'count':0x0,'rows':[]};var _0x37d381=_[_0xd81b('0x30')](db['AnalyticMetric']['rawAttributes'],function(_0x165892){return{'name':_0x165892[_0xd81b('0x31')],'type':_0x165892['type']['key']};});_0x4654ba['model']=_[_0xd81b('0x30')](_0x37d381,_0xd81b('0x2d'));_0x4654ba[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x1b1434[_0xd81b('0x32')]);_0x4654ba[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x4654ba['model'],_0x4654ba[_0xd81b('0x32')]);_0x1a1572['attributes']=_[_0xd81b('0x35')](_0x4654ba[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x37')]));_0x1a1572[_0xd81b('0x38')]=_0x1a1572[_0xd81b('0x38')][_0xd81b('0x39')]?_0x1a1572[_0xd81b('0x38')]:_0x4654ba[_0xd81b('0x36')];if(!_0x1b1434[_0xd81b('0x32')][_0xd81b('0x3a')](_0xd81b('0x3b'))){_0x1a1572['limit']=qs['limit'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x20')]);_0x1a1572[_0xd81b('0x22')]=qs['offset'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x22')]);}_0x1a1572['order']=qs[_0xd81b('0x3c')](_0x1b1434[_0xd81b('0x32')]['sort']);_0x1a1572[_0xd81b('0x3d')]=qs['filters'](_[_0xd81b('0x3e')](_0x1b1434[_0xd81b('0x32')],_0x4654ba[_0xd81b('0x34')]),_0x37d381);if(_0x1b1434[_0xd81b('0x32')]['filter']){_0x1a1572[_0xd81b('0x3d')]=_[_0xd81b('0x3f')](_0x1a1572[_0xd81b('0x3d')],{'$or':_[_0xd81b('0x30')](_0x37d381,function(_0x3abd60){if(_0x3abd60[_0xd81b('0x40')]!==_0xd81b('0x41')){var _0x532ada={};_0x532ada[_0x3abd60[_0xd81b('0x2d')]]={'$like':'%'+_0x1b1434[_0xd81b('0x32')][_0xd81b('0x42')]+'%'};return _0x532ada;}})});}_0x1a1572=_['merge']({},_0x1a1572,_0x1b1434[_0xd81b('0x43')]);var _0x3a05f4={'where':_0x1a1572[_0xd81b('0x3d')]};return db[_0xd81b('0x44')][_0xd81b('0x21')](_0x3a05f4)['then'](function(_0x3dfba7){_0x5527ed[_0xd81b('0x21')]=_0x3dfba7;if(_0x1b1434[_0xd81b('0x32')][_0xd81b('0x45')]){_0x1a1572[_0xd81b('0x46')]=[{'all':!![]}];}return db[_0xd81b('0x44')][_0xd81b('0x47')](_0x1a1572);})[_0xd81b('0x28')](function(_0x4405a8){_0x5527ed[_0xd81b('0x48')]=_0x4405a8;return _0x5527ed;})[_0xd81b('0x28')](respondWithFilteredResult(_0x289f54,_0x1a1572))['catch'](handleError(_0x289f54,null));};exports[_0xd81b('0x49')]=function(_0x2778b3,_0x25824e){var _0xa5e391={'raw':!![],'where':{'id':_0x2778b3[_0xd81b('0x4a')]['id']}},_0x1e6654={};_0x1e6654[_0xd81b('0x36')]=_[_0xd81b('0x33')](db['AnalyticMetric']['rawAttributes']);_0x1e6654[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x2778b3[_0xd81b('0x32')]);_0x1e6654[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],_0x1e6654[_0xd81b('0x32')]);_0xa5e391[_0xd81b('0x38')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x2778b3[_0xd81b('0x32')]['fields']));_0xa5e391[_0xd81b('0x38')]=_0xa5e391[_0xd81b('0x38')][_0xd81b('0x39')]?_0xa5e391[_0xd81b('0x38')]:_0x1e6654[_0xd81b('0x36')];if(_0x2778b3[_0xd81b('0x32')][_0xd81b('0x45')]){_0xa5e391[_0xd81b('0x46')]=[{'all':!![]}];}_0xa5e391=_[_0xd81b('0x3f')]({},_0xa5e391,_0x2778b3['options']);return db[_0xd81b('0x44')][_0xd81b('0x4b')](_0xa5e391)[_0xd81b('0x28')](handleEntityNotFound(_0x25824e,null))[_0xd81b('0x28')](respondWithResult(_0x25824e,null))['catch'](handleError(_0x25824e,null));};exports[_0xd81b('0x4c')]=function(_0x151127,_0x15030b){return db[_0xd81b('0x44')][_0xd81b('0x4c')](_0x151127[_0xd81b('0x4d')],{})[_0xd81b('0x28')](function(_0x43d7ce){var _0x133a76=_0x151127['user']['get']({'plain':!![]});if(!_0x133a76)throw new Error(_0xd81b('0x4e'));if(_0x133a76[_0xd81b('0x4f')]===_0xd81b('0x50')){var _0x4da281=_0x43d7ce[_0xd81b('0x2a')]({'plain':!![]});var _0x3d6ab3=_0xd81b('0x2b');return db[_0xd81b('0x51')]['find']({'where':{'name':_0x3d6ab3,'userProfileId':_0x133a76[_0xd81b('0x52')]},'raw':!![]})[_0xd81b('0x28')](function(_0x1b523c){if(_0x1b523c&&_0x1b523c[_0xd81b('0x53')]===0x0){return db[_0xd81b('0x54')]['create']({'name':_0x4da281[_0xd81b('0x2d')],'resourceId':_0x4da281['id'],'type':_0x1b523c[_0xd81b('0x2d')],'sectionId':_0x1b523c['id']},{})['then'](function(){return _0x43d7ce;});}else{return _0x43d7ce;}})[_0xd81b('0x55')](function(_0x315bd5){logger[_0xd81b('0x56')](_0xd81b('0x57'),_0x315bd5);throw _0x315bd5;});}return _0x43d7ce;})[_0xd81b('0x28')](respondWithResult(_0x15030b,0xc9))[_0xd81b('0x55')](handleError(_0x15030b,null));};exports[_0xd81b('0x27')]=function(_0x22f588,_0x3ed626){if(_0x22f588[_0xd81b('0x4d')]['id']){delete _0x22f588[_0xd81b('0x4d')]['id'];}return db['AnalyticMetric'][_0xd81b('0x4b')]({'where':{'id':_0x22f588['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x3ed626,null))[_0xd81b('0x28')](saveUpdates(_0x22f588[_0xd81b('0x4d')],null))[_0xd81b('0x28')](respondWithResult(_0x3ed626,null))[_0xd81b('0x55')](handleError(_0x3ed626,null));};exports[_0xd81b('0x29')]=function(_0x5c196a,_0x2d978d){return db[_0xd81b('0x44')]['find']({'where':{'id':_0x5c196a['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x2d978d,null))['then'](removeEntity(_0x2d978d,null))[_0xd81b('0x55')](handleError(_0x2d978d,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index a469812..e471550 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 _0x86b8=['moment','request-promise','path','rimraf','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger'];(function(_0x2c476f,_0x3e9821){var _0x2724d6=function(_0x116945){while(--_0x116945){_0x2c476f['push'](_0x2c476f['shift']());}};_0x2724d6(++_0x3e9821);}(_0x86b8,0x15d));var _0x886b=function(_0xb98a59,_0x216efe){_0xb98a59=_0xb98a59-0x0;var _0x471b3c=_0x86b8[_0xb98a59];return _0x471b3c;};'use strict';var _=require(_0x886b('0x0'));var util=require(_0x886b('0x1'));var logger=require(_0x886b('0x2'))('api');var moment=require(_0x886b('0x3'));var BPromise=require('bluebird');var rp=require(_0x886b('0x4'));var fs=require('fs');var path=require(_0x886b('0x5'));var rimraf=require(_0x886b('0x6'));var config=require('../../config/environment');var attributes=require(_0x886b('0x7'));module['exports']=function(_0x5b5ff5,_0x2c32bc){return _0x5b5ff5[_0x886b('0x8')](_0x886b('0x9'),attributes,{'tableName':_0x886b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeecc=['analytics_metrics','lodash','util','../../config/logger','api','bluebird','../../config/environment','./analyticMetric.attributes','exports','define'];(function(_0x203c98,_0x9fc1be){var _0xf385cd=function(_0xfc8980){while(--_0xfc8980){_0x203c98['push'](_0x203c98['shift']());}};_0xf385cd(++_0x9fc1be);}(_0xeecc,0x12d));var _0xceec=function(_0x409f7c,_0x4c3d64){_0x409f7c=_0x409f7c-0x0;var _0xa52259=_0xeecc[_0x409f7c];return _0xa52259;};'use strict';var _=require(_0xceec('0x0'));var util=require(_0xceec('0x1'));var logger=require(_0xceec('0x2'))(_0xceec('0x3'));var moment=require('moment');var BPromise=require(_0xceec('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xceec('0x5'));var attributes=require(_0xceec('0x6'));module[_0xceec('0x7')]=function(_0x2ae233,_0x5889fb){return _0x2ae233[_0xceec('0x8')]('AnalyticMetric',attributes,{'tableName':_0xceec('0x9'),'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 010b145..713cff4 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 _0x2848=['http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client'];(function(_0x17b0d4,_0x377add){var _0x2d02c7=function(_0x56e627){while(--_0x56e627){_0x17b0d4['push'](_0x17b0d4['shift']());}};_0x2d02c7(++_0x377add);}(_0x2848,0x1c5));var _0x8284=function(_0x307f2e,_0x1f6354){_0x307f2e=_0x307f2e-0x0;var _0x53f860=_0x2848[_0x307f2e];return _0x53f860;};'use strict';var _=require(_0x8284('0x0'));var util=require(_0x8284('0x1'));var moment=require(_0x8284('0x2'));var BPromise=require('bluebird');var rs=require(_0x8284('0x3'));var fs=require('fs');var Redis=require(_0x8284('0x4'));var db=require(_0x8284('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8284('0x6'));var jayson=require(_0x8284('0x7'));var client=jayson[_0x8284('0x8')][_0x8284('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18a667,_0x1329bb,_0x4aaf46){return new BPromise(function(_0xf7caa9,_0x410624){return client[_0x8284('0xa')](_0x18a667,_0x4aaf46)[_0x8284('0xb')](function(_0x247bc2){logger['info'](_0x8284('0xc'),_0x1329bb,_0x8284('0xd'));logger[_0x8284('0xe')](_0x8284('0xf'),_0x1329bb,'request\x20sent',JSON['stringify'](_0x247bc2));if(_0x247bc2[_0x8284('0x10')]){if(_0x247bc2['error'][_0x8284('0x11')]===0x1f4){logger[_0x8284('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x1329bb,_0x247bc2[_0x8284('0x10')][_0x8284('0x12')]);return _0x410624(_0x247bc2[_0x8284('0x10')][_0x8284('0x12')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x1329bb,_0x247bc2[_0x8284('0x10')][_0x8284('0x12')]);return _0xf7caa9(_0x247bc2[_0x8284('0x10')]['message']);}else{logger[_0x8284('0x13')](_0x8284('0xc'),_0x1329bb,_0x8284('0xd'));_0xf7caa9(_0x247bc2[_0x8284('0x14')][_0x8284('0x12')]);}})[_0x8284('0x15')](function(_0x24f353){logger['error'](_0x8284('0xc'),_0x1329bb,_0x24f353);_0x410624(_0x24f353);});});} \ No newline at end of file +var _0x816f=['request\x20sent','stringify','error','message','result','catch','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s'];(function(_0x29465d,_0x28fb5f){var _0xef6c27=function(_0x5bf206){while(--_0x5bf206){_0x29465d['push'](_0x29465d['shift']());}};_0xef6c27(++_0x28fb5f);}(_0x816f,0x1be));var _0xf816=function(_0x1b8d76,_0x1460b6){_0x1b8d76=_0x1b8d76-0x0;var _0x21a0d4=_0x816f[_0x1b8d76];return _0x21a0d4;};'use strict';var _=require('lodash');var util=require(_0xf816('0x0'));var moment=require(_0xf816('0x1'));var BPromise=require('bluebird');var rs=require(_0xf816('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf816('0x3'));var logger=require(_0xf816('0x4'))(_0xf816('0x5'));var config=require(_0xf816('0x6'));var jayson=require(_0xf816('0x7'));var client=jayson[_0xf816('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x387919,_0x5b0569,_0x21e98f){return new BPromise(function(_0x44c010,_0x3d5b0c){return client[_0xf816('0x9')](_0x387919,_0x21e98f)['then'](function(_0x182c07){logger[_0xf816('0xa')](_0xf816('0xb'),_0x5b0569,'request\x20sent');logger[_0xf816('0xc')](_0xf816('0xd'),_0x5b0569,_0xf816('0xe'),JSON[_0xf816('0xf')](_0x182c07));if(_0x182c07[_0xf816('0x10')]){if(_0x182c07[_0xf816('0x10')]['code']===0x1f4){logger[_0xf816('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x5b0569,_0x182c07[_0xf816('0x10')]['message']);return _0x3d5b0c(_0x182c07['error'][_0xf816('0x11')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x5b0569,_0x182c07[_0xf816('0x10')][_0xf816('0x11')]);return _0x44c010(_0x182c07[_0xf816('0x10')]['message']);}else{logger[_0xf816('0xa')](_0xf816('0xb'),_0x5b0569,'request\x20sent');_0x44c010(_0x182c07[_0xf816('0x12')]['message']);}})[_0xf816('0x13')](function(_0x3cb6d0){logger['error'](_0xf816('0xb'),_0x5b0569,_0x3cb6d0);_0x3d5b0c(_0x3cb6d0);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index f860651..8ee1e30 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 _0x7d10=['create','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x5729f4,_0x1bfce9){var _0x267ebc=function(_0x219bfd){while(--_0x219bfd){_0x5729f4['push'](_0x5729f4['shift']());}};_0x267ebc(++_0x1bfce9);}(_0x7d10,0x1ce));var _0x07d1=function(_0x5d8875,_0x7ee30){_0x5d8875=_0x5d8875-0x0;var _0x4b2d42=_0x7d10[_0x5d8875];return _0x4b2d42;};'use strict';var multer=require('multer');var util=require(_0x07d1('0x0'));var path=require(_0x07d1('0x1'));var timeout=require('connect-timeout');var express=require(_0x07d1('0x2'));var router=express[_0x07d1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x07d1('0x4'));var interaction=require(_0x07d1('0x5'));var config=require('../../config/environment');var controller=require(_0x07d1('0x6'));router[_0x07d1('0x7')]('/',auth[_0x07d1('0x8')](),controller[_0x07d1('0x9')]);router['get'](_0x07d1('0xa'),auth[_0x07d1('0x8')](),controller[_0x07d1('0xb')]);router[_0x07d1('0xc')]('/',auth[_0x07d1('0x8')](),controller[_0x07d1('0xd')]);router[_0x07d1('0xe')](_0x07d1('0xa'),auth[_0x07d1('0x8')](),controller[_0x07d1('0xf')]);router[_0x07d1('0x10')](_0x07d1('0xa'),auth[_0x07d1('0x8')](),controller[_0x07d1('0x11')]);module[_0x07d1('0x12')]=router; \ No newline at end of file +var _0xe767=['connect-timeout','express','Router','fs-extra','../../config/environment','get','index','/:id','isAuthenticated','show','post','update','delete','exports','util','path'];(function(_0x271f82,_0x5aac38){var _0x1289d4=function(_0xfb423a){while(--_0xfb423a){_0x271f82['push'](_0x271f82['shift']());}};_0x1289d4(++_0x5aac38);}(_0xe767,0x11e));var _0x7e76=function(_0x431c56,_0x218aa8){_0x431c56=_0x431c56-0x0;var _0x54a49b=_0xe767[_0x431c56];return _0x54a49b;};'use strict';var multer=require('multer');var util=require(_0x7e76('0x0'));var path=require(_0x7e76('0x1'));var timeout=require(_0x7e76('0x2'));var express=require(_0x7e76('0x3'));var router=express[_0x7e76('0x4')]();var fs_extra=require(_0x7e76('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7e76('0x6'));var controller=require('./analyticMetric.controller');router[_0x7e76('0x7')]('/',auth['isAuthenticated'](),controller[_0x7e76('0x8')]);router[_0x7e76('0x7')](_0x7e76('0x9'),auth[_0x7e76('0xa')](),controller[_0x7e76('0xb')]);router[_0x7e76('0xc')]('/',auth[_0x7e76('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7e76('0xd')]);router[_0x7e76('0xe')](_0x7e76('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x7e76('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 3df5d1b..4c1d971 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 _0xb6f6=['exports','TEXT','sequelize'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xb6f6,0x18e));var _0x6b6f=function(_0x4d3c2b,_0x452139){_0x4d3c2b=_0x4d3c2b-0x0;var _0x42df4d=_0xb6f6[_0x4d3c2b];return _0x42df4d;};'use strict';var Sequelize=require(_0x6b6f('0x0'));module[_0x6b6f('0x1')]={'tree':{'type':Sequelize[_0x6b6f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xf339=['exports','TEXT'];(function(_0x193461,_0x42ce71){var _0x4c237c=function(_0x544492){while(--_0x544492){_0x193461['push'](_0x193461['shift']());}};_0x4c237c(++_0x42ce71);}(_0xf339,0x12c));var _0x9f33=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf339[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module[_0x9f33('0x0')]={'tree':{'type':Sequelize[_0x9f33('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index fba43d1..92696a7 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 _0x4e65=['apply','reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','include','findAll','catch','show','params','keys','includeAll','options','find','create','body','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/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'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4e65,0x19b));var _0x54e6=function(_0x25442e,_0x5844c3){_0x25442e=_0x25442e-0x0;var _0x15077d=_0x4e65[_0x25442e];return _0x15077d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x54e6('0x0'));var moment=require(_0x54e6('0x1'));var BPromise=require(_0x54e6('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x54e6('0x3'));var sox=require(_0x54e6('0x4'));var csv=require(_0x54e6('0x5'));var ejs=require(_0x54e6('0x6'));var fs=require('fs');var fs_extra=require(_0x54e6('0x7'));var _=require(_0x54e6('0x8'));var squel=require(_0x54e6('0x9'));var crypto=require(_0x54e6('0xa'));var jsforce=require(_0x54e6('0xb'));var deskjs=require(_0x54e6('0xc'));var toCsv=require(_0x54e6('0x5'));var querystring=require(_0x54e6('0xd'));var Papa=require(_0x54e6('0xe'));var Redis=require(_0x54e6('0xf'));var authService=require(_0x54e6('0x10'));var qs=require(_0x54e6('0x11'));var as=require(_0x54e6('0x12'));var hardwareService=require(_0x54e6('0x13'));var logger=require(_0x54e6('0x14'))('api');var utils=require(_0x54e6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x54e6('0x16'));var db=require(_0x54e6('0x17'))['db'];function respondWithStatusCode(_0x455224,_0x51ce76){_0x51ce76=_0x51ce76||0xcc;return function(_0x5c4655){if(_0x5c4655){return _0x455224[_0x54e6('0x18')](_0x51ce76);}return _0x455224[_0x54e6('0x19')](_0x51ce76)[_0x54e6('0x1a')]();};}function respondWithResult(_0x26f76c,_0x466248){_0x466248=_0x466248||0xc8;return function(_0x4295b8){if(_0x4295b8){return _0x26f76c[_0x54e6('0x19')](_0x466248)[_0x54e6('0x1b')](_0x4295b8);}};}function respondWithFilteredResult(_0x1ac10d,_0x375bbc){return function(_0x3d98dc){if(_0x3d98dc){var _0x5c88a2=typeof _0x375bbc[_0x54e6('0x1c')]===_0x54e6('0x1d')&&typeof _0x375bbc[_0x54e6('0x1e')]===_0x54e6('0x1d');var _0x2a3a35=_0x3d98dc[_0x54e6('0x1f')];var _0x59422a=_0x5c88a2?0x0:_0x375bbc[_0x54e6('0x1c')];var _0x513a43=_0x5c88a2?_0x3d98dc[_0x54e6('0x1f')]:_0x375bbc[_0x54e6('0x1c')]+_0x375bbc[_0x54e6('0x1e')];var _0x338d42;if(_0x513a43>=_0x2a3a35){_0x513a43=_0x2a3a35;_0x338d42=0xc8;}else{_0x338d42=0xce;}_0x1ac10d[_0x54e6('0x19')](_0x338d42);return _0x1ac10d['set'](_0x54e6('0x20'),_0x59422a+'-'+_0x513a43+'/'+_0x2a3a35)['json'](_0x3d98dc);}return null;};}function patchUpdates(_0x5144b7){return function(_0x20606b){try{jsonpatch[_0x54e6('0x21')](_0x20606b,_0x5144b7,!![]);}catch(_0x373de3){return BPromise[_0x54e6('0x22')](_0x373de3);}return _0x20606b[_0x54e6('0x23')]();};}function saveUpdates(_0x36a8b4,_0x3fbae1){return function(_0x49c315){if(_0x49c315){return _0x49c315[_0x54e6('0x24')](_0x36a8b4)[_0x54e6('0x25')](function(_0x245a38){return _0x245a38;});}return null;};}function removeEntity(_0x36ff3d,_0x28f674){return function(_0x2d3912){if(_0x2d3912){return _0x2d3912[_0x54e6('0x26')]()[_0x54e6('0x25')](function(){_0x36ff3d[_0x54e6('0x19')](0xcc)[_0x54e6('0x1a')]();});}};}function handleEntityNotFound(_0x5b1e65,_0x1eb9cd){return function(_0x25825c){if(!_0x25825c){_0x5b1e65[_0x54e6('0x18')](0x194);}return _0x25825c;};}function handleError(_0x4227c2,_0x4ed08b){_0x4ed08b=_0x4ed08b||0x1f4;return function(_0x5cf126){logger[_0x54e6('0x27')](_0x5cf126[_0x54e6('0x28')]);if(_0x5cf126[_0x54e6('0x29')]){delete _0x5cf126[_0x54e6('0x29')];}_0x4227c2[_0x54e6('0x19')](_0x4ed08b)[_0x54e6('0x2a')](_0x5cf126);};}exports[_0x54e6('0x2b')]=function(_0x4256bf,_0x27c09d){var _0x1be29e={},_0x966fc4={},_0x4a775b={'count':0x0,'rows':[]};var _0x28f4b4=_[_0x54e6('0x2c')](db[_0x54e6('0x2d')][_0x54e6('0x2e')],function(_0x5011e6){return{'name':_0x5011e6['fieldName'],'type':_0x5011e6[_0x54e6('0x2f')][_0x54e6('0x30')]};});_0x966fc4[_0x54e6('0x31')]=_[_0x54e6('0x2c')](_0x28f4b4,_0x54e6('0x29'));_0x966fc4[_0x54e6('0x32')]=_['keys'](_0x4256bf[_0x54e6('0x32')]);_0x966fc4[_0x54e6('0x33')]=_[_0x54e6('0x34')](_0x966fc4[_0x54e6('0x31')],_0x966fc4[_0x54e6('0x32')]);_0x1be29e['attributes']=_[_0x54e6('0x34')](_0x966fc4[_0x54e6('0x31')],qs[_0x54e6('0x35')](_0x4256bf[_0x54e6('0x32')][_0x54e6('0x35')]));_0x1be29e[_0x54e6('0x36')]=_0x1be29e[_0x54e6('0x36')][_0x54e6('0x37')]?_0x1be29e[_0x54e6('0x36')]:_0x966fc4['model'];if(!_0x4256bf[_0x54e6('0x32')][_0x54e6('0x38')]('nolimit')){_0x1be29e['limit']=qs['limit'](_0x4256bf[_0x54e6('0x32')]['limit']);_0x1be29e[_0x54e6('0x1c')]=qs[_0x54e6('0x1c')](_0x4256bf[_0x54e6('0x32')][_0x54e6('0x1c')]);}_0x1be29e[_0x54e6('0x39')]=qs[_0x54e6('0x3a')](_0x4256bf['query']['sort']);_0x1be29e[_0x54e6('0x3b')]=qs[_0x54e6('0x33')](_[_0x54e6('0x3c')](_0x4256bf['query'],_0x966fc4[_0x54e6('0x33')]),_0x28f4b4);if(_0x4256bf[_0x54e6('0x32')]['filter']){_0x1be29e[_0x54e6('0x3b')]=_['merge'](_0x1be29e[_0x54e6('0x3b')],{'$or':_[_0x54e6('0x2c')](_0x28f4b4,function(_0x46b39b){if(_0x46b39b[_0x54e6('0x2f')]!==_0x54e6('0x3d')){var _0x33eadd={};_0x33eadd[_0x46b39b[_0x54e6('0x29')]]={'$like':'%'+_0x4256bf['query']['filter']+'%'};return _0x33eadd;}})});}_0x1be29e=_[_0x54e6('0x3e')]({},_0x1be29e,_0x4256bf['options']);var _0x205d74={'where':_0x1be29e[_0x54e6('0x3b')]};return db[_0x54e6('0x2d')]['count'](_0x205d74)[_0x54e6('0x25')](function(_0x155ba0){_0x4a775b['count']=_0x155ba0;if(_0x4256bf[_0x54e6('0x32')]['includeAll']){_0x1be29e[_0x54e6('0x3f')]=[{'all':!![]}];}return db[_0x54e6('0x2d')][_0x54e6('0x40')](_0x1be29e);})[_0x54e6('0x25')](function(_0x12c914){_0x4a775b['rows']=_0x12c914;return _0x4a775b;})[_0x54e6('0x25')](respondWithFilteredResult(_0x27c09d,_0x1be29e))[_0x54e6('0x41')](handleError(_0x27c09d,null));};exports[_0x54e6('0x42')]=function(_0x1a411f,_0xd514fa){var _0x582902={'raw':!![],'where':{'id':_0x1a411f[_0x54e6('0x43')]['id']}},_0x281b47={};_0x281b47[_0x54e6('0x31')]=_[_0x54e6('0x44')](db[_0x54e6('0x2d')][_0x54e6('0x2e')]);_0x281b47[_0x54e6('0x32')]=_[_0x54e6('0x44')](_0x1a411f[_0x54e6('0x32')]);_0x281b47[_0x54e6('0x33')]=_[_0x54e6('0x34')](_0x281b47[_0x54e6('0x31')],_0x281b47[_0x54e6('0x32')]);_0x582902[_0x54e6('0x36')]=_[_0x54e6('0x34')](_0x281b47[_0x54e6('0x31')],qs[_0x54e6('0x35')](_0x1a411f[_0x54e6('0x32')][_0x54e6('0x35')]));_0x582902[_0x54e6('0x36')]=_0x582902['attributes'][_0x54e6('0x37')]?_0x582902[_0x54e6('0x36')]:_0x281b47['model'];if(_0x1a411f[_0x54e6('0x32')][_0x54e6('0x45')]){_0x582902[_0x54e6('0x3f')]=[{'all':!![]}];}_0x582902=_[_0x54e6('0x3e')]({},_0x582902,_0x1a411f[_0x54e6('0x46')]);return db[_0x54e6('0x2d')][_0x54e6('0x47')](_0x582902)[_0x54e6('0x25')](handleEntityNotFound(_0xd514fa,null))[_0x54e6('0x25')](respondWithResult(_0xd514fa,null))[_0x54e6('0x41')](handleError(_0xd514fa,null));};exports[_0x54e6('0x48')]=function(_0x1601f1,_0x190b2e){return db['AnalyticTreeReport']['create'](_0x1601f1[_0x54e6('0x49')],{})['then'](respondWithResult(_0x190b2e,0xc9))[_0x54e6('0x41')](handleError(_0x190b2e,null));};exports['update']=function(_0x3e3aa3,_0x21829a){if(_0x3e3aa3['body']['id']){delete _0x3e3aa3['body']['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x3e3aa3['params']['id']}})[_0x54e6('0x25')](handleEntityNotFound(_0x21829a,null))['then'](saveUpdates(_0x3e3aa3['body'],null))[_0x54e6('0x25')](respondWithResult(_0x21829a,null))[_0x54e6('0x41')](handleError(_0x21829a,null));};exports[_0x54e6('0x26')]=function(_0x347373,_0x169714){return db[_0x54e6('0x2d')][_0x54e6('0x47')]({'where':{'id':_0x347373[_0x54e6('0x43')]['id']}})['then'](handleEntityNotFound(_0x169714,null))[_0x54e6('0x25')](removeEntity(_0x169714,null))[_0x54e6('0x41')](handleError(_0x169714,null));}; \ No newline at end of file +var _0x9c54=['path','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','undefined','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','AnalyticTreeReport','count','findAll','catch','includeAll','include','options','create','update','body','find','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x5952df,_0x13a460){var _0x1b5ad4=function(_0x4c0e56){while(--_0x4c0e56){_0x5952df['push'](_0x5952df['shift']());}};_0x1b5ad4(++_0x13a460);}(_0x9c54,0xc4));var _0x49c5=function(_0x2a36a8,_0x49399c){_0x2a36a8=_0x2a36a8-0x0;var _0x38d25d=_0x9c54[_0x2a36a8];return _0x38d25d;};'use strict';var emlformat=require(_0x49c5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x49c5('0x1'));var jsonpatch=require(_0x49c5('0x2'));var rp=require(_0x49c5('0x3'));var moment=require('moment');var BPromise=require(_0x49c5('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c5('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x49c5('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x49c5('0x7'));var deskjs=require(_0x49c5('0x8'));var toCsv=require('to-csv');var querystring=require(_0x49c5('0x9'));var Papa=require(_0x49c5('0xa'));var Redis=require(_0x49c5('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x49c5('0xc'));var as=require(_0x49c5('0xd'));var hardwareService=require(_0x49c5('0xe'));var logger=require(_0x49c5('0xf'))(_0x49c5('0x10'));var utils=require(_0x49c5('0x11'));var config=require(_0x49c5('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49ce20,_0x5f14d1){_0x5f14d1=_0x5f14d1||0xcc;return function(_0x3684ab){if(_0x3684ab){return _0x49ce20[_0x49c5('0x13')](_0x5f14d1);}return _0x49ce20[_0x49c5('0x14')](_0x5f14d1)[_0x49c5('0x15')]();};}function respondWithResult(_0x1f8266,_0x3c5404){_0x3c5404=_0x3c5404||0xc8;return function(_0x60af00){if(_0x60af00){return _0x1f8266[_0x49c5('0x14')](_0x3c5404)['json'](_0x60af00);}};}function respondWithFilteredResult(_0x5abe8a,_0x3d9b28){return function(_0x568ab5){if(_0x568ab5){var _0x437610=typeof _0x3d9b28[_0x49c5('0x16')]==='undefined'&&typeof _0x3d9b28[_0x49c5('0x17')]===_0x49c5('0x18');var _0x2b598d=_0x568ab5['count'];var _0x368808=_0x437610?0x0:_0x3d9b28[_0x49c5('0x16')];var _0x4792e2=_0x437610?_0x568ab5['count']:_0x3d9b28[_0x49c5('0x16')]+_0x3d9b28[_0x49c5('0x17')];var _0x27dea3;if(_0x4792e2>=_0x2b598d){_0x4792e2=_0x2b598d;_0x27dea3=0xc8;}else{_0x27dea3=0xce;}_0x5abe8a[_0x49c5('0x14')](_0x27dea3);return _0x5abe8a['set'](_0x49c5('0x19'),_0x368808+'-'+_0x4792e2+'/'+_0x2b598d)[_0x49c5('0x1a')](_0x568ab5);}return null;};}function patchUpdates(_0x96661){return function(_0x1d9c3e){try{jsonpatch[_0x49c5('0x1b')](_0x1d9c3e,_0x96661,!![]);}catch(_0x74862b){return BPromise[_0x49c5('0x1c')](_0x74862b);}return _0x1d9c3e[_0x49c5('0x1d')]();};}function saveUpdates(_0x56df66,_0x458340){return function(_0x3c9a72){if(_0x3c9a72){return _0x3c9a72['update'](_0x56df66)[_0x49c5('0x1e')](function(_0x4a4944){return _0x4a4944;});}return null;};}function removeEntity(_0x264f09,_0x48f704){return function(_0x563f0d){if(_0x563f0d){return _0x563f0d[_0x49c5('0x1f')]()['then'](function(){_0x264f09['status'](0xcc)[_0x49c5('0x15')]();});}};}function handleEntityNotFound(_0x493d1f,_0x3ea5b1){return function(_0xa5c91d){if(!_0xa5c91d){_0x493d1f[_0x49c5('0x13')](0x194);}return _0xa5c91d;};}function handleError(_0x12a6df,_0x3d82fb){_0x3d82fb=_0x3d82fb||0x1f4;return function(_0xb0ede7){logger[_0x49c5('0x20')](_0xb0ede7[_0x49c5('0x21')]);if(_0xb0ede7[_0x49c5('0x22')]){delete _0xb0ede7[_0x49c5('0x22')];}_0x12a6df['status'](_0x3d82fb)[_0x49c5('0x23')](_0xb0ede7);};}exports['index']=function(_0x416301,_0x13fd86){var _0x2aaf40={},_0x14edaf={},_0x1edb28={'count':0x0,'rows':[]};var _0x597c01=_[_0x49c5('0x24')](db['AnalyticTreeReport'][_0x49c5('0x25')],function(_0x2fb7a2){return{'name':_0x2fb7a2[_0x49c5('0x26')],'type':_0x2fb7a2['type']['key']};});_0x14edaf[_0x49c5('0x27')]=_[_0x49c5('0x24')](_0x597c01,_0x49c5('0x22'));_0x14edaf['query']=_[_0x49c5('0x28')](_0x416301['query']);_0x14edaf[_0x49c5('0x29')]=_['intersection'](_0x14edaf[_0x49c5('0x27')],_0x14edaf[_0x49c5('0x2a')]);_0x2aaf40[_0x49c5('0x2b')]=_[_0x49c5('0x2c')](_0x14edaf[_0x49c5('0x27')],qs[_0x49c5('0x2d')](_0x416301[_0x49c5('0x2a')][_0x49c5('0x2d')]));_0x2aaf40[_0x49c5('0x2b')]=_0x2aaf40[_0x49c5('0x2b')][_0x49c5('0x2e')]?_0x2aaf40[_0x49c5('0x2b')]:_0x14edaf[_0x49c5('0x27')];if(!_0x416301['query'][_0x49c5('0x2f')](_0x49c5('0x30'))){_0x2aaf40['limit']=qs[_0x49c5('0x17')](_0x416301[_0x49c5('0x2a')]['limit']);_0x2aaf40[_0x49c5('0x16')]=qs[_0x49c5('0x16')](_0x416301[_0x49c5('0x2a')][_0x49c5('0x16')]);}_0x2aaf40[_0x49c5('0x31')]=qs[_0x49c5('0x32')](_0x416301['query'][_0x49c5('0x32')]);_0x2aaf40[_0x49c5('0x33')]=qs['filters'](_[_0x49c5('0x34')](_0x416301['query'],_0x14edaf[_0x49c5('0x29')]),_0x597c01);if(_0x416301[_0x49c5('0x2a')]['filter']){_0x2aaf40[_0x49c5('0x33')]=_[_0x49c5('0x35')](_0x2aaf40[_0x49c5('0x33')],{'$or':_[_0x49c5('0x24')](_0x597c01,function(_0x5558cf){if(_0x5558cf[_0x49c5('0x36')]!=='VIRTUAL'){var _0x18f4cd={};_0x18f4cd[_0x5558cf[_0x49c5('0x22')]]={'$like':'%'+_0x416301[_0x49c5('0x2a')]['filter']+'%'};return _0x18f4cd;}})});}_0x2aaf40=_[_0x49c5('0x35')]({},_0x2aaf40,_0x416301['options']);var _0x22f142={'where':_0x2aaf40[_0x49c5('0x33')]};return db[_0x49c5('0x37')][_0x49c5('0x38')](_0x22f142)['then'](function(_0x58f108){_0x1edb28[_0x49c5('0x38')]=_0x58f108;if(_0x416301['query']['includeAll']){_0x2aaf40['include']=[{'all':!![]}];}return db[_0x49c5('0x37')][_0x49c5('0x39')](_0x2aaf40);})[_0x49c5('0x1e')](function(_0x57caa5){_0x1edb28['rows']=_0x57caa5;return _0x1edb28;})[_0x49c5('0x1e')](respondWithFilteredResult(_0x13fd86,_0x2aaf40))[_0x49c5('0x3a')](handleError(_0x13fd86,null));};exports['show']=function(_0x51982f,_0x9de9d8){var _0x15271c={'raw':!![],'where':{'id':_0x51982f['params']['id']}},_0x3f9b1d={};_0x3f9b1d[_0x49c5('0x27')]=_['keys'](db[_0x49c5('0x37')][_0x49c5('0x25')]);_0x3f9b1d['query']=_[_0x49c5('0x28')](_0x51982f[_0x49c5('0x2a')]);_0x3f9b1d[_0x49c5('0x29')]=_[_0x49c5('0x2c')](_0x3f9b1d[_0x49c5('0x27')],_0x3f9b1d[_0x49c5('0x2a')]);_0x15271c[_0x49c5('0x2b')]=_[_0x49c5('0x2c')](_0x3f9b1d[_0x49c5('0x27')],qs[_0x49c5('0x2d')](_0x51982f[_0x49c5('0x2a')][_0x49c5('0x2d')]));_0x15271c[_0x49c5('0x2b')]=_0x15271c[_0x49c5('0x2b')][_0x49c5('0x2e')]?_0x15271c[_0x49c5('0x2b')]:_0x3f9b1d[_0x49c5('0x27')];if(_0x51982f[_0x49c5('0x2a')][_0x49c5('0x3b')]){_0x15271c[_0x49c5('0x3c')]=[{'all':!![]}];}_0x15271c=_[_0x49c5('0x35')]({},_0x15271c,_0x51982f[_0x49c5('0x3d')]);return db['AnalyticTreeReport']['find'](_0x15271c)[_0x49c5('0x1e')](handleEntityNotFound(_0x9de9d8,null))[_0x49c5('0x1e')](respondWithResult(_0x9de9d8,null))['catch'](handleError(_0x9de9d8,null));};exports[_0x49c5('0x3e')]=function(_0x1bedbc,_0x42c0fa){return db[_0x49c5('0x37')][_0x49c5('0x3e')](_0x1bedbc['body'],{})[_0x49c5('0x1e')](respondWithResult(_0x42c0fa,0xc9))['catch'](handleError(_0x42c0fa,null));};exports[_0x49c5('0x3f')]=function(_0x4564ac,_0x55ddc1){if(_0x4564ac['body']['id']){delete _0x4564ac[_0x49c5('0x40')]['id'];}return db[_0x49c5('0x37')][_0x49c5('0x41')]({'where':{'id':_0x4564ac['params']['id']}})['then'](handleEntityNotFound(_0x55ddc1,null))['then'](saveUpdates(_0x4564ac[_0x49c5('0x40')],null))['then'](respondWithResult(_0x55ddc1,null))[_0x49c5('0x3a')](handleError(_0x55ddc1,null));};exports[_0x49c5('0x1f')]=function(_0x248e33,_0x3e8c0d){return db['AnalyticTreeReport']['find']({'where':{'id':_0x248e33[_0x49c5('0x42')]['id']}})[_0x49c5('0x1e')](handleEntityNotFound(_0x3e8c0d,null))['then'](removeEntity(_0x3e8c0d,null))[_0x49c5('0x3a')](handleError(_0x3e8c0d,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 22ecec6..8a59ed1 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 _0x18f3=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees'];(function(_0x100f05,_0x2de0fa){var _0x2bcde1=function(_0x1e564d){while(--_0x1e564d){_0x100f05['push'](_0x100f05['shift']());}};_0x2bcde1(++_0x2de0fa);}(_0x18f3,0x7e));var _0x318f=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x18f3[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x318f('0x0'));var util=require(_0x318f('0x1'));var logger=require(_0x318f('0x2'))(_0x318f('0x3'));var moment=require(_0x318f('0x4'));var BPromise=require(_0x318f('0x5'));var rp=require(_0x318f('0x6'));var fs=require('fs');var path=require(_0x318f('0x7'));var rimraf=require('rimraf');var config=require(_0x318f('0x8'));var attributes=require(_0x318f('0x9'));module[_0x318f('0xa')]=function(_0x5df83b,_0x55e201){return _0x5df83b[_0x318f('0xb')](_0x318f('0xc'),attributes,{'tableName':_0x318f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c91=['define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','exports'];(function(_0x31f3aa,_0x5164dc){var _0x25649b=function(_0x154a79){while(--_0x154a79){_0x31f3aa['push'](_0x31f3aa['shift']());}};_0x25649b(++_0x5164dc);}(_0x1c91,0x142));var _0x11c9=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x1c91[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x11c9('0x0'));var util=require(_0x11c9('0x1'));var logger=require(_0x11c9('0x2'))('api');var moment=require(_0x11c9('0x3'));var BPromise=require(_0x11c9('0x4'));var rp=require(_0x11c9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x11c9('0x6'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module[_0x11c9('0x7')]=function(_0x48f20b,_0x37b762){return _0x48f20b[_0x11c9('0x8')](_0x11c9('0x9'),attributes,{'tableName':_0x11c9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 94a752f..76e9e61 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x116ff8,_0x3b830c){var _0x2d5f4b=function(_0x59cdbd){while(--_0x59cdbd){_0x116ff8['push'](_0x116ff8['shift']());}};_0x2d5f4b(++_0x3b830c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc4aa[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x43d39b,_0x5e8c83){var _0x58ea99=function(_0x3c75d5){while(--_0x3c75d5){_0x43d39b['push'](_0x43d39b['shift']());}};_0x58ea99(++_0x5e8c83);}(_0x5f2f,0x73));var _0xf5f2=function(_0x57ae2d,_0x11175c){_0x57ae2d=_0x57ae2d-0x0;var _0x17c46a=_0x5f2f[_0x57ae2d];return _0x17c46a;};'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')]('AnalyticTreeReport,\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/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 3df6a01..19011f2 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 _0x497c=['get','isAuthenticated','index','/:id','show','create','put','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1e4991,_0x5073ee){var _0x36b6b7=function(_0xbb056c){while(--_0xbb056c){_0x1e4991['push'](_0x1e4991['shift']());}};_0x36b6b7(++_0x5073ee);}(_0x497c,0x15d));var _0xc497=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x497c[_0x42bdad];return _0x122626;};'use strict';var multer=require(_0xc497('0x0'));var util=require(_0xc497('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc497('0x2'));var router=express[_0xc497('0x3')]();var fs_extra=require(_0xc497('0x4'));var auth=require(_0xc497('0x5'));var interaction=require(_0xc497('0x6'));var config=require(_0xc497('0x7'));var controller=require('./analyticTreeReport.controller');router[_0xc497('0x8')]('/',auth[_0xc497('0x9')](),controller[_0xc497('0xa')]);router[_0xc497('0x8')](_0xc497('0xb'),auth[_0xc497('0x9')](),controller[_0xc497('0xc')]);router['post']('/',auth[_0xc497('0x9')](),controller[_0xc497('0xd')]);router[_0xc497('0xe')](_0xc497('0xb'),auth[_0xc497('0x9')](),controller['update']);router[_0xc497('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc497('0x10')]=router; \ No newline at end of file +var _0x244b=['exports','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','delete','/:id','destroy'];(function(_0x14cbc9,_0x2df49e){var _0x42c5b3=function(_0xf003b7){while(--_0xf003b7){_0x14cbc9['push'](_0x14cbc9['shift']());}};_0x42c5b3(++_0x2df49e);}(_0x244b,0x1d1));var _0xb244=function(_0x5b3936,_0x532c5f){_0x5b3936=_0x5b3936-0x0;var _0x2de8da=_0x244b[_0x5b3936];return _0x2de8da;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb244('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb244('0x1')]();var fs_extra=require(_0xb244('0x2'));var auth=require(_0xb244('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb244('0x4'));var controller=require('./analyticTreeReport.controller');router[_0xb244('0x5')]('/',auth[_0xb244('0x6')](),controller[_0xb244('0x7')]);router['get']('/:id',auth[_0xb244('0x6')](),controller[_0xb244('0x8')]);router[_0xb244('0x9')]('/',auth[_0xb244('0x6')](),controller[_0xb244('0xa')]);router[_0xb244('0xb')]('/:id',auth[_0xb244('0x6')](),controller['update']);router[_0xb244('0xc')](_0xb244('0xd'),auth['isAuthenticated'](),controller[_0xb244('0xe')]);module[_0xb244('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 0ec2867..887aeed 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 _0x85d8=['sequelize','exports','STRING'];(function(_0x2dca9b,_0x1af4d9){var _0x464de8=function(_0x25c125){while(--_0x25c125){_0x2dca9b['push'](_0x2dca9b['shift']());}};_0x464de8(++_0x1af4d9);}(_0x85d8,0x1b0));var _0x885d=function(_0x1c076a,_0x132502){_0x1c076a=_0x1c076a-0x0;var _0x400bec=_0x85d8[_0x1c076a];return _0x400bec;};'use strict';var Sequelize=require(_0x885d('0x0'));module[_0x885d('0x1')]={'name':{'type':Sequelize[_0x885d('0x2')]},'basename':{'type':Sequelize[_0x885d('0x2')]},'type':{'type':Sequelize[_0x885d('0x2')]}}; \ No newline at end of file +var _0x92bc=['STRING','sequelize','exports'];(function(_0x18284b,_0x152ce2){var _0x14bb72=function(_0xe70932){while(--_0xe70932){_0x18284b['push'](_0x18284b['shift']());}};_0x14bb72(++_0x152ce2);}(_0x92bc,0x106));var _0xc92b=function(_0x33e259,_0x4d6b41){_0x33e259=_0x33e259-0x0;var _0x457fd5=_0x92bc[_0x33e259];return _0x457fd5;};'use strict';var Sequelize=require(_0xc92b('0x0'));module[_0xc92b('0x1')]={'name':{'type':Sequelize[_0xc92b('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index ab4a89c..3164417 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 _0x0ddb=['omit','updatedAt','body','createdAt','find','create','file','originalname','basename','filename','findOne','join','root','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','params','options','clone','get'];(function(_0x2a029c,_0x4ccbb5){var _0x92750c=function(_0x4959f9){while(--_0x4959f9){_0x2a029c['push'](_0x2a029c['shift']());}};_0x92750c(++_0x4ccbb5);}(_0x0ddb,0x110));var _0xb0dd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0ddb[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xb0dd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb0dd('0x1'));var jsonpatch=require(_0xb0dd('0x2'));var rp=require(_0xb0dd('0x3'));var moment=require(_0xb0dd('0x4'));var BPromise=require(_0xb0dd('0x5'));var Mustache=require(_0xb0dd('0x6'));var util=require(_0xb0dd('0x7'));var path=require(_0xb0dd('0x8'));var sox=require(_0xb0dd('0x9'));var csv=require(_0xb0dd('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb0dd('0xb'));var _=require(_0xb0dd('0xc'));var squel=require(_0xb0dd('0xd'));var crypto=require(_0xb0dd('0xe'));var jsforce=require(_0xb0dd('0xf'));var deskjs=require(_0xb0dd('0x10'));var toCsv=require(_0xb0dd('0xa'));var querystring=require(_0xb0dd('0x11'));var Papa=require(_0xb0dd('0x12'));var Redis=require(_0xb0dd('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb0dd('0x14'));var as=require(_0xb0dd('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb0dd('0x16'))(_0xb0dd('0x17'));var utils=require(_0xb0dd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb0dd('0x19'));var db=require(_0xb0dd('0x1a'))['db'];function respondWithStatusCode(_0xcf7191,_0x24feb6){_0x24feb6=_0x24feb6||0xcc;return function(_0x4a9c41){if(_0x4a9c41){return _0xcf7191[_0xb0dd('0x1b')](_0x24feb6);}return _0xcf7191[_0xb0dd('0x1c')](_0x24feb6)[_0xb0dd('0x1d')]();};}function respondWithResult(_0x787d64,_0x1d804b){_0x1d804b=_0x1d804b||0xc8;return function(_0xeaacb1){if(_0xeaacb1){return _0x787d64[_0xb0dd('0x1c')](_0x1d804b)[_0xb0dd('0x1e')](_0xeaacb1);}};}function respondWithFilteredResult(_0xb5a38c,_0x3363a5){return function(_0x7a6eec){if(_0x7a6eec){var _0x2ed655=typeof _0x3363a5[_0xb0dd('0x1f')]===_0xb0dd('0x20')&&typeof _0x3363a5[_0xb0dd('0x21')]===_0xb0dd('0x20');var _0x5b4d1e=_0x7a6eec[_0xb0dd('0x22')];var _0x593010=_0x2ed655?0x0:_0x3363a5[_0xb0dd('0x1f')];var _0x290d7d=_0x2ed655?_0x7a6eec[_0xb0dd('0x22')]:_0x3363a5[_0xb0dd('0x1f')]+_0x3363a5[_0xb0dd('0x21')];var _0x336751;if(_0x290d7d>=_0x5b4d1e){_0x290d7d=_0x5b4d1e;_0x336751=0xc8;}else{_0x336751=0xce;}_0xb5a38c[_0xb0dd('0x1c')](_0x336751);return _0xb5a38c[_0xb0dd('0x23')](_0xb0dd('0x24'),_0x593010+'-'+_0x290d7d+'/'+_0x5b4d1e)[_0xb0dd('0x1e')](_0x7a6eec);}return null;};}function patchUpdates(_0x5d5507){return function(_0x4c8efe){try{jsonpatch['apply'](_0x4c8efe,_0x5d5507,!![]);}catch(_0x3a4cb3){return BPromise['reject'](_0x3a4cb3);}return _0x4c8efe['save']();};}function saveUpdates(_0x5ecfe7,_0x361a1e){return function(_0x554de3){if(_0x554de3){return _0x554de3[_0xb0dd('0x25')](_0x5ecfe7)[_0xb0dd('0x26')](function(_0x4f6661){return _0x4f6661;});}return null;};}function removeEntity(_0x2081a8,_0x20c197){return function(_0x1ad31c){if(_0x1ad31c){return _0x1ad31c['destroy']()[_0xb0dd('0x26')](function(){_0x2081a8[_0xb0dd('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46d9da,_0x1fc9fd){return function(_0x187a18){if(!_0x187a18){_0x46d9da[_0xb0dd('0x1b')](0x194);}return _0x187a18;};}function handleError(_0x51ac1b,_0x394898){_0x394898=_0x394898||0x1f4;return function(_0x5365d6){logger['error'](_0x5365d6[_0xb0dd('0x27')]);if(_0x5365d6[_0xb0dd('0x28')]){delete _0x5365d6[_0xb0dd('0x28')];}_0x51ac1b[_0xb0dd('0x1c')](_0x394898)[_0xb0dd('0x29')](_0x5365d6);};}exports[_0xb0dd('0x2a')]=function(_0x38f416,_0x50425e){var _0x106c9b={},_0x463c34={},_0x3b2907={'count':0x0,'rows':[]};var _0x55d9cc=_[_0xb0dd('0x2b')](db[_0xb0dd('0x2c')][_0xb0dd('0x2d')],function(_0x4df711){return{'name':_0x4df711[_0xb0dd('0x2e')],'type':_0x4df711[_0xb0dd('0x2f')][_0xb0dd('0x30')]};});_0x463c34[_0xb0dd('0x31')]=_[_0xb0dd('0x2b')](_0x55d9cc,_0xb0dd('0x28'));_0x463c34['query']=_[_0xb0dd('0x32')](_0x38f416[_0xb0dd('0x33')]);_0x463c34[_0xb0dd('0x34')]=_[_0xb0dd('0x35')](_0x463c34['model'],_0x463c34['query']);_0x106c9b[_0xb0dd('0x36')]=_[_0xb0dd('0x35')](_0x463c34[_0xb0dd('0x31')],qs['fields'](_0x38f416[_0xb0dd('0x33')][_0xb0dd('0x37')]));_0x106c9b['attributes']=_0x106c9b[_0xb0dd('0x36')][_0xb0dd('0x38')]?_0x106c9b[_0xb0dd('0x36')]:_0x463c34[_0xb0dd('0x31')];if(!_0x38f416['query']['hasOwnProperty']('nolimit')){_0x106c9b[_0xb0dd('0x21')]=qs['limit'](_0x38f416['query'][_0xb0dd('0x21')]);_0x106c9b[_0xb0dd('0x1f')]=qs[_0xb0dd('0x1f')](_0x38f416[_0xb0dd('0x33')][_0xb0dd('0x1f')]);}_0x106c9b[_0xb0dd('0x39')]=qs['sort'](_0x38f416[_0xb0dd('0x33')][_0xb0dd('0x3a')]);_0x106c9b[_0xb0dd('0x3b')]=qs['filters'](_[_0xb0dd('0x3c')](_0x38f416[_0xb0dd('0x33')],_0x463c34['filters']),_0x55d9cc);if(_0x38f416[_0xb0dd('0x33')][_0xb0dd('0x3d')]){_0x106c9b[_0xb0dd('0x3b')]=_[_0xb0dd('0x3e')](_0x106c9b['where'],{'$or':_['map'](_0x55d9cc,function(_0x30b6d7){if(_0x30b6d7['type']!==_0xb0dd('0x3f')){var _0x56a240={};_0x56a240[_0x30b6d7[_0xb0dd('0x28')]]={'$like':'%'+_0x38f416['query'][_0xb0dd('0x3d')]+'%'};return _0x56a240;}})});}_0x106c9b=_[_0xb0dd('0x3e')]({},_0x106c9b,_0x38f416['options']);var _0x561f7a={'where':_0x106c9b[_0xb0dd('0x3b')]};return db[_0xb0dd('0x2c')][_0xb0dd('0x22')](_0x561f7a)['then'](function(_0x1dced4){_0x3b2907[_0xb0dd('0x22')]=_0x1dced4;if(_0x38f416['query'][_0xb0dd('0x40')]){_0x106c9b[_0xb0dd('0x41')]=[{'all':!![]}];}return db[_0xb0dd('0x2c')]['findAll'](_0x106c9b);})[_0xb0dd('0x26')](function(_0x11dc9f){_0x3b2907['rows']=_0x11dc9f;return _0x3b2907;})['then'](respondWithFilteredResult(_0x50425e,_0x106c9b))[_0xb0dd('0x42')](handleError(_0x50425e,null));};exports[_0xb0dd('0x43')]=function(_0xd8b59e,_0x2a108b){var _0x350601={'raw':!![],'where':{'id':_0xd8b59e[_0xb0dd('0x44')]['id']}},_0x2e6971={};_0x2e6971[_0xb0dd('0x31')]=_[_0xb0dd('0x32')](db['Attachment'][_0xb0dd('0x2d')]);_0x2e6971[_0xb0dd('0x33')]=_[_0xb0dd('0x32')](_0xd8b59e[_0xb0dd('0x33')]);_0x2e6971[_0xb0dd('0x34')]=_[_0xb0dd('0x35')](_0x2e6971[_0xb0dd('0x31')],_0x2e6971[_0xb0dd('0x33')]);_0x350601[_0xb0dd('0x36')]=_[_0xb0dd('0x35')](_0x2e6971[_0xb0dd('0x31')],qs['fields'](_0xd8b59e[_0xb0dd('0x33')][_0xb0dd('0x37')]));_0x350601[_0xb0dd('0x36')]=_0x350601['attributes'][_0xb0dd('0x38')]?_0x350601[_0xb0dd('0x36')]:_0x2e6971['model'];if(_0xd8b59e[_0xb0dd('0x33')][_0xb0dd('0x40')]){_0x350601['include']=[{'all':!![]}];}_0x350601=_[_0xb0dd('0x3e')]({},_0x350601,_0xd8b59e[_0xb0dd('0x45')]);return db[_0xb0dd('0x2c')]['find'](_0x350601)[_0xb0dd('0x26')](handleEntityNotFound(_0x2a108b,null))[_0xb0dd('0x26')](respondWithResult(_0x2a108b,null))['catch'](handleError(_0x2a108b,null));};exports[_0xb0dd('0x46')]=function(_0x1811a7,_0x3bfae1){var _0x50a175={'where':{'id':_0x1811a7[_0xb0dd('0x44')]['id']}},_0x401cd6={};_0x401cd6[_0xb0dd('0x31')]=_['keys'](db[_0xb0dd('0x2c')][_0xb0dd('0x2d')]);_0x50a175[_0xb0dd('0x36')]=_[_0xb0dd('0x35')](_0x401cd6[_0xb0dd('0x31')],qs[_0xb0dd('0x37')](_0x1811a7[_0xb0dd('0x33')][_0xb0dd('0x37')]));_0x50a175['attributes']=_0x50a175[_0xb0dd('0x36')][_0xb0dd('0x38')]?_0x50a175[_0xb0dd('0x36')]:_0x401cd6[_0xb0dd('0x31')];if(_0x1811a7[_0xb0dd('0x33')][_0xb0dd('0x40')]){_0x50a175[_0xb0dd('0x41')]=[{'all':!![]}];}_0x50a175=_['merge']({},_0x50a175,_0x1811a7[_0xb0dd('0x45')]);return db[_0xb0dd('0x2c')]['find'](_0x50a175)['then'](handleEntityNotFound(_0x3bfae1,null))[_0xb0dd('0x26')](function(_0x8f8895){if(_0x8f8895){var _0x231155=_0x8f8895[_0xb0dd('0x47')]({'plain':!![]});_0x231155=qs[_0xb0dd('0x48')](_0x231155,['id','createdAt',_0xb0dd('0x49')]);_0x1811a7[_0xb0dd('0x4a')]=_[_0xb0dd('0x48')](_0x1811a7[_0xb0dd('0x4a')],['id',_0xb0dd('0x4b'),_0xb0dd('0x49')]);return db[_0xb0dd('0x2c')]['create'](_[_0xb0dd('0x3e')](_0x231155,_0x1811a7[_0xb0dd('0x4a')]),{'include':_0x1811a7[_0xb0dd('0x33')][_0xb0dd('0x40')]?[{'all':!![]}]:undefined});}})[_0xb0dd('0x26')](respondWithResult(_0x3bfae1,0xc9))[_0xb0dd('0x42')](handleError(_0x3bfae1,null));};exports[_0xb0dd('0x25')]=function(_0x37b954,_0x5c0c24){if(_0x37b954[_0xb0dd('0x4a')]['id']){delete _0x37b954['body']['id'];}return db['Attachment'][_0xb0dd('0x4c')]({'where':{'id':_0x37b954['params']['id']}})[_0xb0dd('0x26')](handleEntityNotFound(_0x5c0c24,null))['then'](saveUpdates(_0x37b954[_0xb0dd('0x4a')],null))['then'](respondWithResult(_0x5c0c24,null))[_0xb0dd('0x42')](handleError(_0x5c0c24,null));};exports['destroy']=function(_0x2345af,_0x466f2a){return db[_0xb0dd('0x2c')][_0xb0dd('0x4c')]({'where':{'id':_0x2345af[_0xb0dd('0x44')]['id']}})[_0xb0dd('0x26')](handleEntityNotFound(_0x466f2a,null))[_0xb0dd('0x26')](removeEntity(_0x466f2a,null))[_0xb0dd('0x42')](handleError(_0x466f2a,null));};exports[_0xb0dd('0x4d')]=function(_0xbae9f8,_0x4f33ed,_0x3cf542){_0xbae9f8['body']['name']=_0xbae9f8[_0xb0dd('0x4e')][_0xb0dd('0x4f')];_0xbae9f8[_0xb0dd('0x4a')][_0xb0dd('0x50')]=_0xbae9f8['file'][_0xb0dd('0x51')];_0xbae9f8['body']['type']=_0xbae9f8[_0xb0dd('0x4e')]['mimetype'];return db[_0xb0dd('0x2c')][_0xb0dd('0x4d')](_0xbae9f8[_0xb0dd('0x4a')])['then'](respondWithResult(_0x4f33ed,0xc9))['catch'](handleError(_0x4f33ed,null));};exports['download']=function(_0x27fcef,_0x387f81,_0xca3c3f){return db[_0xb0dd('0x2c')][_0xb0dd('0x52')]({'where':{'id':_0x27fcef[_0xb0dd('0x44')]['id']},'raw':!![]})[_0xb0dd('0x26')](handleEntityNotFound(_0x387f81,null))[_0xb0dd('0x26')](function(_0x4c18a3){if(_0x4c18a3){var _0x41bc64=_0x4c18a3['ChatOfflineMessageId']!==null;var _0x1b30ed=path[_0xb0dd('0x53')](config[_0xb0dd('0x54')],'server/files/attachments/');if(_0x41bc64){_0x1b30ed=path[_0xb0dd('0x53')](_0x1b30ed,'offline-chat/');}var _0x18bfa9=path['join'](_0x1b30ed,_0x4c18a3[_0xb0dd('0x50')]);return _0x387f81[_0xb0dd('0x55')](_0x18bfa9);}})[_0xb0dd('0x42')](handleError(_0x387f81,null));}; \ No newline at end of file +var _0x0d0d=['rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','clone','get','createdAt','updatedAt','body','omit','update','destroy','create','file','originalname','basename','filename','mimetype','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','download','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','error','name','map','Attachment'];(function(_0x597581,_0x77bc55){var _0x97faf5=function(_0x42b9d1){while(--_0x42b9d1){_0x597581['push'](_0x597581['shift']());}};_0x97faf5(++_0x77bc55);}(_0x0d0d,0x131));var _0xd0d0=function(_0x4cf414,_0x11eb8f){_0x4cf414=_0x4cf414-0x0;var _0x36c273=_0x0d0d[_0x4cf414];return _0x36c273;};'use strict';var emlformat=require(_0xd0d0('0x0'));var rimraf=require(_0xd0d0('0x1'));var zipdir=require(_0xd0d0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd0d0('0x3'));var BPromise=require(_0xd0d0('0x4'));var Mustache=require('mustache');var util=require(_0xd0d0('0x5'));var path=require(_0xd0d0('0x6'));var sox=require(_0xd0d0('0x7'));var csv=require(_0xd0d0('0x8'));var ejs=require(_0xd0d0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd0d0('0xa'));var squel=require(_0xd0d0('0xb'));var crypto=require(_0xd0d0('0xc'));var jsforce=require(_0xd0d0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd0d0('0x8'));var querystring=require(_0xd0d0('0xe'));var Papa=require(_0xd0d0('0xf'));var Redis=require('ioredis');var authService=require(_0xd0d0('0x10'));var qs=require(_0xd0d0('0x11'));var as=require(_0xd0d0('0x12'));var hardwareService=require(_0xd0d0('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd0d0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd0d0('0x15'))['db'];function respondWithStatusCode(_0x3dc0a4,_0xddaa5a){_0xddaa5a=_0xddaa5a||0xcc;return function(_0x4d6639){if(_0x4d6639){return _0x3dc0a4[_0xd0d0('0x16')](_0xddaa5a);}return _0x3dc0a4[_0xd0d0('0x17')](_0xddaa5a)[_0xd0d0('0x18')]();};}function respondWithResult(_0x2e44ae,_0x34a6f4){_0x34a6f4=_0x34a6f4||0xc8;return function(_0x305926){if(_0x305926){return _0x2e44ae['status'](_0x34a6f4)[_0xd0d0('0x19')](_0x305926);}};}function respondWithFilteredResult(_0x332679,_0x515618){return function(_0x536cc5){if(_0x536cc5){var _0x30da02=typeof _0x515618[_0xd0d0('0x1a')]===_0xd0d0('0x1b')&&typeof _0x515618[_0xd0d0('0x1c')]==='undefined';var _0x48429c=_0x536cc5[_0xd0d0('0x1d')];var _0x2f295a=_0x30da02?0x0:_0x515618[_0xd0d0('0x1a')];var _0x2a5296=_0x30da02?_0x536cc5[_0xd0d0('0x1d')]:_0x515618[_0xd0d0('0x1a')]+_0x515618[_0xd0d0('0x1c')];var _0x41b8f8;if(_0x2a5296>=_0x48429c){_0x2a5296=_0x48429c;_0x41b8f8=0xc8;}else{_0x41b8f8=0xce;}_0x332679['status'](_0x41b8f8);return _0x332679['set'](_0xd0d0('0x1e'),_0x2f295a+'-'+_0x2a5296+'/'+_0x48429c)[_0xd0d0('0x19')](_0x536cc5);}return null;};}function patchUpdates(_0x215892){return function(_0x3f06cf){try{jsonpatch[_0xd0d0('0x1f')](_0x3f06cf,_0x215892,!![]);}catch(_0x4c7b1a){return BPromise[_0xd0d0('0x20')](_0x4c7b1a);}return _0x3f06cf[_0xd0d0('0x21')]();};}function saveUpdates(_0x222d28,_0x107b32){return function(_0x279054){if(_0x279054){return _0x279054['update'](_0x222d28)[_0xd0d0('0x22')](function(_0x3e1c1b){return _0x3e1c1b;});}return null;};}function removeEntity(_0x7e7bc4,_0xa01c95){return function(_0x32e5d0){if(_0x32e5d0){return _0x32e5d0['destroy']()['then'](function(){_0x7e7bc4['status'](0xcc)[_0xd0d0('0x18')]();});}};}function handleEntityNotFound(_0x56926e,_0x5da739){return function(_0x194a2b){if(!_0x194a2b){_0x56926e[_0xd0d0('0x16')](0x194);}return _0x194a2b;};}function handleError(_0x552c9e,_0x34216b){_0x34216b=_0x34216b||0x1f4;return function(_0x7f3083){logger[_0xd0d0('0x23')](_0x7f3083['stack']);if(_0x7f3083['name']){delete _0x7f3083[_0xd0d0('0x24')];}_0x552c9e[_0xd0d0('0x17')](_0x34216b)['send'](_0x7f3083);};}exports['index']=function(_0x157409,_0xd4cf05){var _0x42f739={},_0x396b75={},_0x46d9e5={'count':0x0,'rows':[]};var _0x240367=_[_0xd0d0('0x25')](db[_0xd0d0('0x26')][_0xd0d0('0x27')],function(_0xa2d678){return{'name':_0xa2d678[_0xd0d0('0x28')],'type':_0xa2d678[_0xd0d0('0x29')]['key']};});_0x396b75[_0xd0d0('0x2a')]=_[_0xd0d0('0x25')](_0x240367,_0xd0d0('0x24'));_0x396b75[_0xd0d0('0x2b')]=_[_0xd0d0('0x2c')](_0x157409[_0xd0d0('0x2b')]);_0x396b75['filters']=_[_0xd0d0('0x2d')](_0x396b75[_0xd0d0('0x2a')],_0x396b75[_0xd0d0('0x2b')]);_0x42f739[_0xd0d0('0x2e')]=_['intersection'](_0x396b75['model'],qs['fields'](_0x157409['query'][_0xd0d0('0x2f')]));_0x42f739['attributes']=_0x42f739[_0xd0d0('0x2e')][_0xd0d0('0x30')]?_0x42f739[_0xd0d0('0x2e')]:_0x396b75['model'];if(!_0x157409[_0xd0d0('0x2b')]['hasOwnProperty'](_0xd0d0('0x31'))){_0x42f739[_0xd0d0('0x1c')]=qs['limit'](_0x157409[_0xd0d0('0x2b')][_0xd0d0('0x1c')]);_0x42f739['offset']=qs[_0xd0d0('0x1a')](_0x157409['query'][_0xd0d0('0x1a')]);}_0x42f739[_0xd0d0('0x32')]=qs[_0xd0d0('0x33')](_0x157409['query'][_0xd0d0('0x33')]);_0x42f739[_0xd0d0('0x34')]=qs[_0xd0d0('0x35')](_['pick'](_0x157409[_0xd0d0('0x2b')],_0x396b75[_0xd0d0('0x35')]),_0x240367);if(_0x157409['query'][_0xd0d0('0x36')]){_0x42f739['where']=_[_0xd0d0('0x37')](_0x42f739[_0xd0d0('0x34')],{'$or':_['map'](_0x240367,function(_0x3b54c7){if(_0x3b54c7[_0xd0d0('0x29')]!==_0xd0d0('0x38')){var _0x425964={};_0x425964[_0x3b54c7['name']]={'$like':'%'+_0x157409[_0xd0d0('0x2b')][_0xd0d0('0x36')]+'%'};return _0x425964;}})});}_0x42f739=_['merge']({},_0x42f739,_0x157409[_0xd0d0('0x39')]);var _0x3a1620={'where':_0x42f739[_0xd0d0('0x34')]};return db[_0xd0d0('0x26')][_0xd0d0('0x1d')](_0x3a1620)[_0xd0d0('0x22')](function(_0x308229){_0x46d9e5[_0xd0d0('0x1d')]=_0x308229;if(_0x157409[_0xd0d0('0x2b')]['includeAll']){_0x42f739['include']=[{'all':!![]}];}return db[_0xd0d0('0x26')][_0xd0d0('0x3a')](_0x42f739);})[_0xd0d0('0x22')](function(_0x21b14c){_0x46d9e5[_0xd0d0('0x3b')]=_0x21b14c;return _0x46d9e5;})[_0xd0d0('0x22')](respondWithFilteredResult(_0xd4cf05,_0x42f739))[_0xd0d0('0x3c')](handleError(_0xd4cf05,null));};exports[_0xd0d0('0x3d')]=function(_0x306db3,_0x4f71a7){var _0x5dbb97={'raw':!![],'where':{'id':_0x306db3[_0xd0d0('0x3e')]['id']}},_0x549041={};_0x549041[_0xd0d0('0x2a')]=_[_0xd0d0('0x2c')](db[_0xd0d0('0x26')][_0xd0d0('0x27')]);_0x549041[_0xd0d0('0x2b')]=_[_0xd0d0('0x2c')](_0x306db3[_0xd0d0('0x2b')]);_0x549041[_0xd0d0('0x35')]=_['intersection'](_0x549041['model'],_0x549041[_0xd0d0('0x2b')]);_0x5dbb97[_0xd0d0('0x2e')]=_['intersection'](_0x549041[_0xd0d0('0x2a')],qs[_0xd0d0('0x2f')](_0x306db3['query']['fields']));_0x5dbb97[_0xd0d0('0x2e')]=_0x5dbb97[_0xd0d0('0x2e')][_0xd0d0('0x30')]?_0x5dbb97[_0xd0d0('0x2e')]:_0x549041['model'];if(_0x306db3[_0xd0d0('0x2b')][_0xd0d0('0x3f')]){_0x5dbb97[_0xd0d0('0x40')]=[{'all':!![]}];}_0x5dbb97=_['merge']({},_0x5dbb97,_0x306db3[_0xd0d0('0x39')]);return db[_0xd0d0('0x26')][_0xd0d0('0x41')](_0x5dbb97)['then'](handleEntityNotFound(_0x4f71a7,null))[_0xd0d0('0x22')](respondWithResult(_0x4f71a7,null))[_0xd0d0('0x3c')](handleError(_0x4f71a7,null));};exports[_0xd0d0('0x42')]=function(_0x169648,_0x107ff6){var _0x1f20f8={'where':{'id':_0x169648['params']['id']}},_0x72b7c3={};_0x72b7c3[_0xd0d0('0x2a')]=_[_0xd0d0('0x2c')](db[_0xd0d0('0x26')]['rawAttributes']);_0x1f20f8['attributes']=_[_0xd0d0('0x2d')](_0x72b7c3[_0xd0d0('0x2a')],qs[_0xd0d0('0x2f')](_0x169648['query'][_0xd0d0('0x2f')]));_0x1f20f8[_0xd0d0('0x2e')]=_0x1f20f8['attributes'][_0xd0d0('0x30')]?_0x1f20f8['attributes']:_0x72b7c3[_0xd0d0('0x2a')];if(_0x169648[_0xd0d0('0x2b')][_0xd0d0('0x3f')]){_0x1f20f8[_0xd0d0('0x40')]=[{'all':!![]}];}_0x1f20f8=_[_0xd0d0('0x37')]({},_0x1f20f8,_0x169648['options']);return db[_0xd0d0('0x26')][_0xd0d0('0x41')](_0x1f20f8)[_0xd0d0('0x22')](handleEntityNotFound(_0x107ff6,null))[_0xd0d0('0x22')](function(_0x5b0392){if(_0x5b0392){var _0x2d1778=_0x5b0392[_0xd0d0('0x43')]({'plain':!![]});_0x2d1778=qs['omit'](_0x2d1778,['id',_0xd0d0('0x44'),_0xd0d0('0x45')]);_0x169648[_0xd0d0('0x46')]=_[_0xd0d0('0x47')](_0x169648['body'],['id',_0xd0d0('0x44'),_0xd0d0('0x45')]);return db[_0xd0d0('0x26')]['create'](_[_0xd0d0('0x37')](_0x2d1778,_0x169648['body']),{'include':_0x169648[_0xd0d0('0x2b')][_0xd0d0('0x3f')]?[{'all':!![]}]:undefined});}})[_0xd0d0('0x22')](respondWithResult(_0x107ff6,0xc9))[_0xd0d0('0x3c')](handleError(_0x107ff6,null));};exports[_0xd0d0('0x48')]=function(_0x5e7b87,_0x3f8f79){if(_0x5e7b87['body']['id']){delete _0x5e7b87[_0xd0d0('0x46')]['id'];}return db[_0xd0d0('0x26')][_0xd0d0('0x41')]({'where':{'id':_0x5e7b87['params']['id']}})['then'](handleEntityNotFound(_0x3f8f79,null))[_0xd0d0('0x22')](saveUpdates(_0x5e7b87[_0xd0d0('0x46')],null))[_0xd0d0('0x22')](respondWithResult(_0x3f8f79,null))[_0xd0d0('0x3c')](handleError(_0x3f8f79,null));};exports[_0xd0d0('0x49')]=function(_0x519b2d,_0x49f6cc){return db[_0xd0d0('0x26')][_0xd0d0('0x41')]({'where':{'id':_0x519b2d[_0xd0d0('0x3e')]['id']}})[_0xd0d0('0x22')](handleEntityNotFound(_0x49f6cc,null))['then'](removeEntity(_0x49f6cc,null))[_0xd0d0('0x3c')](handleError(_0x49f6cc,null));};exports[_0xd0d0('0x4a')]=function(_0x155eba,_0x327a08,_0xe4c69b){_0x155eba[_0xd0d0('0x46')][_0xd0d0('0x24')]=_0x155eba[_0xd0d0('0x4b')][_0xd0d0('0x4c')];_0x155eba['body'][_0xd0d0('0x4d')]=_0x155eba[_0xd0d0('0x4b')][_0xd0d0('0x4e')];_0x155eba[_0xd0d0('0x46')][_0xd0d0('0x29')]=_0x155eba[_0xd0d0('0x4b')][_0xd0d0('0x4f')];return db[_0xd0d0('0x26')][_0xd0d0('0x4a')](_0x155eba[_0xd0d0('0x46')])[_0xd0d0('0x22')](respondWithResult(_0x327a08,0xc9))[_0xd0d0('0x3c')](handleError(_0x327a08,null));};exports['download']=function(_0x4ef1bd,_0x54eaef,_0x1e6140){return db[_0xd0d0('0x26')][_0xd0d0('0x50')]({'where':{'id':_0x4ef1bd[_0xd0d0('0x3e')]['id']},'raw':!![]})[_0xd0d0('0x22')](handleEntityNotFound(_0x54eaef,null))['then'](function(_0x3e7671){if(_0x3e7671){var _0x10d13b=_0x3e7671[_0xd0d0('0x51')]!==null;var _0x3e3521=path[_0xd0d0('0x52')](config[_0xd0d0('0x53')],_0xd0d0('0x54'));if(_0x10d13b){_0x3e3521=path[_0xd0d0('0x52')](_0x3e3521,'offline-chat/');}var _0x54c3c3=path[_0xd0d0('0x52')](_0x3e3521,_0x3e7671[_0xd0d0('0x4d')]);return _0x54eaef[_0xd0d0('0x55')](_0x54c3c3);}})['catch'](handleError(_0x54eaef,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index fb83db8..9046777 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 _0xf747=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./attachment.attributes','exports','Attachment'];(function(_0x2c725b,_0x13d632){var _0x5975d1=function(_0x11e028){while(--_0x11e028){_0x2c725b['push'](_0x2c725b['shift']());}};_0x5975d1(++_0x13d632);}(_0xf747,0x1b8));var _0x7f74=function(_0xa5e586,_0x5ba4f8){_0xa5e586=_0xa5e586-0x0;var _0x45f86f=_0xf747[_0xa5e586];return _0x45f86f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7f74('0x0'))(_0x7f74('0x1'));var moment=require(_0x7f74('0x2'));var BPromise=require(_0x7f74('0x3'));var rp=require(_0x7f74('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f74('0x5'));var config=require(_0x7f74('0x6'));var attributes=require(_0x7f74('0x7'));module[_0x7f74('0x8')]=function(_0xcda41d,_0x13b560){return _0xcda41d['define'](_0x7f74('0x9'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc055=['exports','define','attachments','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./attachment.attributes'];(function(_0x395ae0,_0x2291e6){var _0x299eca=function(_0x588807){while(--_0x588807){_0x395ae0['push'](_0x395ae0['shift']());}};_0x299eca(++_0x2291e6);}(_0xc055,0x12f));var _0x5c05=function(_0x2ff762,_0x342c0b){_0x2ff762=_0x2ff762-0x0;var _0x158b02=_0xc055[_0x2ff762];return _0x158b02;};'use strict';var _=require(_0x5c05('0x0'));var util=require('util');var logger=require(_0x5c05('0x1'))(_0x5c05('0x2'));var moment=require(_0x5c05('0x3'));var BPromise=require(_0x5c05('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c05('0x5'));var rimraf=require(_0x5c05('0x6'));var config=require(_0x5c05('0x7'));var attributes=require(_0x5c05('0x8'));module[_0x5c05('0x9')]=function(_0x30ec75,_0xbbcd0b){return _0x30ec75[_0x5c05('0xa')]('Attachment',attributes,{'tableName':_0x5c05('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 d8b161c..c051c67 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 _0xb469=['options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','Attachment,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','CreateAttachment','create','body'];(function(_0x38d0f5,_0x1457c2){var _0x5b91d1=function(_0x28c2dd){while(--_0x28c2dd){_0x38d0f5['push'](_0x38d0f5['shift']());}};_0x5b91d1(++_0x1457c2);}(_0xb469,0x13b));var _0x9b46=function(_0x21fac4,_0x10896e){_0x21fac4=_0x21fac4-0x0;var _0x1a13e3=_0xb469[_0x21fac4];return _0x1a13e3;};'use strict';var _=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var moment=require(_0x9b46('0x2'));var BPromise=require(_0x9b46('0x3'));var rs=require(_0x9b46('0x4'));var fs=require('fs');var Redis=require(_0x9b46('0x5'));var db=require(_0x9b46('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b46('0x7'))(_0x9b46('0x8'));var config=require('../../config/environment');var jayson=require(_0x9b46('0x9'));var client=jayson[_0x9b46('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b2dd3,_0x5bd834,_0x4c1ed9){return new BPromise(function(_0x34c0de,_0x545b6c){return client[_0x9b46('0xb')](_0x1b2dd3,_0x4c1ed9)[_0x9b46('0xc')](function(_0x43a112){logger['info'](_0x9b46('0xd'),_0x5bd834,'request\x20sent');logger[_0x9b46('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x5bd834,_0x9b46('0xf'),JSON['stringify'](_0x43a112));if(_0x43a112[_0x9b46('0x10')]){if(_0x43a112[_0x9b46('0x10')]['code']===0x1f4){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112['error'][_0x9b46('0x11')]);return _0x545b6c(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);return _0x34c0de(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}else{logger[_0x9b46('0x12')](_0x9b46('0xd'),_0x5bd834,_0x9b46('0xf'));_0x34c0de(_0x43a112[_0x9b46('0x13')]['message']);}})['catch'](function(_0x52c1b8){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x52c1b8);_0x545b6c(_0x52c1b8);});});}exports[_0x9b46('0x14')]=function(_0x5c5cc9){var _0x5dd7bd=this;return new Promise(function(_0x3d9efa,_0x4ccfd0){return db['Attachment'][_0x9b46('0x15')](_0x5c5cc9[_0x9b46('0x16')],{'raw':_0x5c5cc9['options']?_0x5c5cc9[_0x9b46('0x17')][_0x9b46('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x55aece){logger[_0x9b46('0x12')](_0x9b46('0x14'),_0x5c5cc9);logger[_0x9b46('0xe')]('CreateAttachment',_0x5c5cc9,JSON['stringify'](_0x55aece));_0x3d9efa(_0x55aece);})[_0x9b46('0x19')](function(_0x51d2ca){logger[_0x9b46('0x10')](_0x9b46('0x14'),_0x51d2ca['message'],_0x5c5cc9);_0x4ccfd0(_0x5dd7bd[_0x9b46('0x10')](0x1f4,_0x51d2ca['message']));});});}; \ No newline at end of file +var _0xa74f=['then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateAttachment','Attachment','body','options','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0xa74f,0x9a));var _0xfa74=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0xa74f[_0x576266];return _0x18234f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa74('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa74('0x1'));var db=require(_0xfa74('0x2'))['db'];var utils=require(_0xfa74('0x3'));var logger=require(_0xfa74('0x4'))('rpc');var config=require(_0xfa74('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfa74('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x9ddbd2,_0x3ac32e,_0x2d9fa9){return new BPromise(function(_0x287921,_0x344e04){return client['request'](_0x9ddbd2,_0x2d9fa9)[_0xfa74('0x7')](function(_0x37d4d8){logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,'request\x20sent');logger[_0xfa74('0xa')](_0xfa74('0xb'),_0x3ac32e,'request\x20sent',JSON[_0xfa74('0xc')](_0x37d4d8));if(_0x37d4d8[_0xfa74('0xd')]){if(_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xe')]===0x1f4){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x344e04(_0x37d4d8[_0xfa74('0xd')]['message']);}logger[_0xfa74('0xd')](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x287921(_0x37d4d8[_0xfa74('0xd')]['message']);}else{logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,_0xfa74('0x10'));_0x287921(_0x37d4d8[_0xfa74('0x11')][_0xfa74('0xf')]);}})[_0xfa74('0x12')](function(_0x3b9e32){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x3b9e32);_0x344e04(_0x3b9e32);});});}exports[_0xfa74('0x13')]=function(_0x51dda1){var _0x4928b6=this;return new Promise(function(_0x31d3c1,_0x25a36b){return db[_0xfa74('0x14')]['create'](_0x51dda1[_0xfa74('0x15')],{'raw':_0x51dda1[_0xfa74('0x16')]?_0x51dda1[_0xfa74('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xfa74('0x7')](function(_0x302eb4){logger[_0xfa74('0x8')]('CreateAttachment',_0x51dda1);logger['debug'](_0xfa74('0x13'),_0x51dda1,JSON[_0xfa74('0xc')](_0x302eb4));_0x31d3c1(_0x302eb4);})[_0xfa74('0x12')](function(_0xeaaa19){logger[_0xfa74('0xd')]('CreateAttachment',_0xeaaa19['message'],_0x51dda1);_0x25a36b(_0x4928b6[_0xfa74('0xd')](0x1f4,_0xeaaa19['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 8c28784..2b175a8 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0xf33958,_0x28f389){var _0x48b29d=function(_0x915198){while(--_0x915198){_0xf33958['push'](_0xf33958['shift']());}};_0x48b29d(++_0x28f389);}(_0x5f2f,0x73));var _0xf5f2=function(_0x322529,_0x3156c1){_0x322529=_0x322529-0x0;var _0x44d4b5=_0x5f2f[_0x322529];return _0x44d4b5;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdb28,0x106));var _0x8db2=function(_0x12fcbf,_0x1d70b2){_0x12fcbf=_0x12fcbf-0x0;var _0x5f293a=_0xdb28[_0x12fcbf];return _0x5f293a;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index dc58243..4dbe70a 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 _0xc986=['use','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','error','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','salt','role','disabled','blocked','blockedAt','online','admin','user','agent','domain','then','add','minutes','clearBlockUser','getLicense','catch','status','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc986,0xce));var _0x6c98=function(_0x4311cb,_0x31de6e){_0x4311cb=_0x4311cb-0x0;var _0x24e041=_0xc986[_0x4311cb];return _0x24e041;};'use strict';var passport=require(_0x6c98('0x0'));var LocalStrategy=require(_0x6c98('0x1'))[_0x6c98('0x2')];var moment=require(_0x6c98('0x3'));var ActiveDirectory=require(_0x6c98('0x4'));var BPromise=require(_0x6c98('0x5'));var util=require(_0x6c98('0x6'));var db=require(_0x6c98('0x7'))['db'];var authService=require(_0x6c98('0x8'));var utils=require('../../config/utils');var config=require(_0x6c98('0x9'));var logger=require(_0x6c98('0xa'))(_0x6c98('0xb'));function isActiveDirectoryConfigured(_0x36212f){var _0x22f884=![];if(typeof _0x36212f[_0x6c98('0xc')]!==_0x6c98('0xd')){_0x22f884=_0x36212f[_0x6c98('0xc')][_0x6c98('0xe')]&&_0x36212f['activedirectory'][_0x6c98('0xf')]&&_0x36212f[_0x6c98('0xc')]['domain'];}return _0x22f884;}function adAuthenticate(_0x375764,_0x49d6f6,_0x2a10ab){return new BPromise(function(_0x5613ab,_0x434fa5){try{var _0x1f0e55=new ActiveDirectory(_0x375764);_0x1f0e55['authenticate'](_0x49d6f6,_0x2a10ab,function(_0x5901d1,_0x3a1eac){if(_0x5901d1){logger[_0x6c98('0x10')]('Error\x20authenticate\x20%s:\x20%s',_0x49d6f6,util['inspect'](_0x5901d1,{'showHidden':![],'depth':null}));_0x434fa5(_0x6c98('0x11'));}else if(!_0x3a1eac){logger['error']('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x49d6f6);_0x434fa5('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5613ab(_0x3a1eac);}});}catch(_0x39d8b1){_0x434fa5(_0x39d8b1);}});}function ActiveDirectoryAuthenticate(_0x5e5af4,_0x1c9b6d,_0x29f04c,_0x56981c){var _0x400deb,_0x21f790;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x6c98('0x12'),_0x1c9b6d);return _0x56981c(null,![],{'message':_0x6c98('0x11')});}return db[_0x6c98('0x13')]['findOne']({'where':{'id':0x1},'attributes':[_0x6c98('0x14'),_0x6c98('0x15')],'raw':!![]})['then'](function(_0x1a5f29){_0x400deb=_0x1a5f29;if(!_0x400deb[_0x6c98('0x14')]){logger[_0x6c98('0x10')](_0x6c98('0x16'),_0x1c9b6d);throw new Error(_0x6c98('0x11'));}return _0x5e5af4[_0x6c98('0x17')]({'attributes':['id',_0x6c98('0x18'),_0x6c98('0x19'),_0x6c98('0x1a'),_0x6c98('0x1b'),_0x6c98('0x1c'),_0x6c98('0x1d'),_0x6c98('0x1e'),_0x6c98('0x1f')],'where':{'name':_0x1c9b6d,'role':{'$or':[_0x6c98('0x20'),_0x6c98('0x21'),_0x6c98('0x22')]},'adSsoEnabled':!![]}});})['then'](function(_0x4b41c2){if(!_0x4b41c2||_0x4b41c2&&_0x4b41c2[_0x6c98('0x18')]!==_0x1c9b6d){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x21f790=_0x4b41c2;var _0x432734=_0x21f790['name']+'@'+config['activedirectory'][_0x6c98('0x23')];return adAuthenticate(config[_0x6c98('0xc')],_0x432734,_0x29f04c);})[_0x6c98('0x24')](function(_0x2e92aa){if(_0x21f790['disabled']){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x400deb[_0x6c98('0x15')]>0x0){if(_0x21f790[_0x6c98('0x1d')]){if(moment(_0x21f790[_0x6c98('0x1e')])[_0x6c98('0x25')](_0x400deb['blockDuration'],_0x6c98('0x26'))>moment()){throw new Error(_0x6c98('0x11'));}return utils[_0x6c98('0x27')](_0x21f790,0x0,![],null)['then'](function(){return utils['getLicense'](_0x21f790);})[_0x6c98('0x24')](function(){return _0x56981c(null,_0x21f790);});}else{return utils[_0x6c98('0x28')](_0x21f790)[_0x6c98('0x24')](function(){return _0x56981c(null,_0x21f790);});}}else{return utils[_0x6c98('0x28')](_0x21f790)[_0x6c98('0x24')](function(){return _0x56981c(null,_0x21f790);});}})[_0x6c98('0x29')](function(_0x3ee555){return _0x56981c(null,![],_0x3ee555);});}function handleError(_0x2a9655,_0x18887c,_0x5f0706){return _0x2a9655[_0x6c98('0x2a')](_0x18887c||0x1f4)['send']({'message':_0x5f0706?_0x5f0706['message']||_0x5f0706:''});}exports[_0x6c98('0x2b')]=function(_0x27ea10,_0x2713c1,_0x5da8b2){passport[_0x6c98('0x2c')](_0x6c98('0x2d'),function(_0x56cb73,_0x219906,_0xe21e03){var _0x37d031=_0x56cb73||_0xe21e03;if(_0x37d031){return handleError(_0x2713c1,0x191,_0x37d031);}if(!_0x219906){return handleError(_0x2713c1,0x194,{'message':_0x6c98('0x2e')});}else{var _0x371364={'payload':{'id':_0x219906['id'],'role':_0x219906[_0x6c98('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0x6c98('0x2f')](_0x371364)[_0x6c98('0x24')](function(_0xe7dd02){_0x2713c1[_0x6c98('0x30')]({'id':_0x219906['id'],'token':_0xe7dd02,'statusCall':'','isAlreadyLogged':_0x219906[_0x6c98('0x1f')]});});}})(_0x27ea10,_0x2713c1,_0x5da8b2);};passport[_0x6c98('0x31')](_0x6c98('0x2d'),new LocalStrategy({'usernameField':_0x6c98('0x18'),'passwordField':_0x6c98('0x19')},function(_0x5419b5,_0xfd614d,_0x4e3d94){return ActiveDirectoryAuthenticate(db[_0x6c98('0x32')],_0x5419b5,_0xfd614d,_0x4e3d94);})); \ No newline at end of file +var _0x988f=['undefined','activedirectory','url','domain','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','admin','user','agent','minutes','clearBlockUser','getLicense','catch','send','message','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','use','User','passport','Strategy','activedirectory2','bluebird','util','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','api'];(function(_0x146edd,_0x2be255){var _0x46079b=function(_0x20ad8c){while(--_0x20ad8c){_0x146edd['push'](_0x146edd['shift']());}};_0x46079b(++_0x2be255);}(_0x988f,0x89));var _0xf988=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x988f[_0x5bd426];return _0x23a7eb;};'use strict';var passport=require(_0xf988('0x0'));var LocalStrategy=require('passport-local')[_0xf988('0x1')];var moment=require('moment');var ActiveDirectory=require(_0xf988('0x2'));var BPromise=require(_0xf988('0x3'));var util=require(_0xf988('0x4'));var db=require(_0xf988('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xf988('0x6'));var config=require(_0xf988('0x7'));var logger=require(_0xf988('0x8'))(_0xf988('0x9'));function isActiveDirectoryConfigured(_0x56d597){var _0x432118=![];if(typeof _0x56d597['activedirectory']!==_0xf988('0xa')){_0x432118=_0x56d597[_0xf988('0xb')]['baseDN']&&_0x56d597[_0xf988('0xb')][_0xf988('0xc')]&&_0x56d597[_0xf988('0xb')][_0xf988('0xd')];}return _0x432118;}function adAuthenticate(_0x4e4860,_0x3b2079,_0xcac103){return new BPromise(function(_0x17d8cb,_0x4fd1ba){try{var _0x8898fd=new ActiveDirectory(_0x4e4860);_0x8898fd['authenticate'](_0x3b2079,_0xcac103,function(_0x4f57a4,_0x216efa){if(_0x4f57a4){logger['error'](_0xf988('0xe'),_0x3b2079,util[_0xf988('0xf')](_0x4f57a4,{'showHidden':![],'depth':null}));_0x4fd1ba(_0xf988('0x10'));}else if(!_0x216efa){logger['error'](_0xf988('0x11'),_0x3b2079);_0x4fd1ba('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x17d8cb(_0x216efa);}});}catch(_0x5db67d){_0x4fd1ba(_0x5db67d);}});}function ActiveDirectoryAuthenticate(_0x5c840d,_0xfcfab7,_0x562130,_0x137773){var _0x48754d,_0x5463d3;if(!isActiveDirectoryConfigured(config)){logger[_0xf988('0x12')](_0xf988('0x13'),_0xfcfab7);return _0x137773(null,![],{'message':_0xf988('0x10')});}return db[_0xf988('0x14')][_0xf988('0x15')]({'where':{'id':0x1},'attributes':[_0xf988('0x16'),_0xf988('0x17')],'raw':!![]})[_0xf988('0x18')](function(_0x2ccad3){_0x48754d=_0x2ccad3;if(!_0x48754d[_0xf988('0x16')]){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0xfcfab7);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x5c840d[_0xf988('0x15')]({'attributes':['id',_0xf988('0x19'),_0xf988('0x1a'),_0xf988('0x1b'),_0xf988('0x1c'),_0xf988('0x1d'),_0xf988('0x1e'),_0xf988('0x1f'),'online'],'where':{'name':_0xfcfab7,'role':{'$or':[_0xf988('0x20'),_0xf988('0x21'),_0xf988('0x22')]},'adSsoEnabled':!![]}});})[_0xf988('0x18')](function(_0x5f1569){if(!_0x5f1569||_0x5f1569&&_0x5f1569['name']!==_0xfcfab7){throw new Error(_0xf988('0x10'));}_0x5463d3=_0x5f1569;var _0x3e8404=_0x5463d3[_0xf988('0x19')]+'@'+config[_0xf988('0xb')][_0xf988('0xd')];return adAuthenticate(config[_0xf988('0xb')],_0x3e8404,_0x562130);})[_0xf988('0x18')](function(_0x49b817){if(_0x5463d3[_0xf988('0x1d')]){throw new Error(_0xf988('0x10'));}if(_0x48754d[_0xf988('0x17')]>0x0){if(_0x5463d3[_0xf988('0x1e')]){if(moment(_0x5463d3[_0xf988('0x1f')])['add'](_0x48754d[_0xf988('0x17')],_0xf988('0x23'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xf988('0x24')](_0x5463d3,0x0,![],null)[_0xf988('0x18')](function(){return utils[_0xf988('0x25')](_0x5463d3);})['then'](function(){return _0x137773(null,_0x5463d3);});}else{return utils[_0xf988('0x25')](_0x5463d3)[_0xf988('0x18')](function(){return _0x137773(null,_0x5463d3);});}}else{return utils[_0xf988('0x25')](_0x5463d3)['then'](function(){return _0x137773(null,_0x5463d3);});}})[_0xf988('0x26')](function(_0x32fe7f){return _0x137773(null,![],_0x32fe7f);});}function handleError(_0x328902,_0x45ba4e,_0x53845a){return _0x328902['status'](_0x45ba4e||0x1f4)[_0xf988('0x27')]({'message':_0x53845a?_0x53845a[_0xf988('0x28')]||_0x53845a:''});}exports[_0xf988('0x29')]=function(_0x3b84e1,_0x5079af,_0x52071e){passport[_0xf988('0x2a')](_0xf988('0x2b'),function(_0x8ba3d8,_0x4da0f1,_0x1a8eb1){var _0x515c19=_0x8ba3d8||_0x1a8eb1;if(_0x515c19){return handleError(_0x5079af,0x191,_0x515c19);}if(!_0x4da0f1){return handleError(_0x5079af,0x194,{'message':_0xf988('0x2c')});}else{var _0x5e9850={'payload':{'id':_0x4da0f1['id'],'role':_0x4da0f1['role']},'options':{'expiresIn':0x15180}};return authService[_0xf988('0x2d')](_0x5e9850)[_0xf988('0x18')](function(_0x285674){_0x5079af['json']({'id':_0x4da0f1['id'],'token':_0x285674,'statusCall':'','isAlreadyLogged':_0x4da0f1[_0xf988('0x2e')]});});}})(_0x3b84e1,_0x5079af,_0x52071e);};passport[_0xf988('0x2f')]('ad-login',new LocalStrategy({'usernameField':_0xf988('0x19'),'passwordField':'password'},function(_0x3718ed,_0x3877af,_0x5c3b19){return ActiveDirectoryAuthenticate(db[_0xf988('0x30')],_0x3718ed,_0x3877af,_0x5c3b19);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index df0efb4..3bf7f43 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 _0x8c91=['./authActiveDirectory.controller','post','login','express'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0x8c91,0x107));var _0x18c9=function(_0x46a977,_0x51abc2){_0x46a977=_0x46a977-0x0;var _0x43f9d1=_0x8c91[_0x46a977];return _0x43f9d1;};'use strict';var express=require(_0x18c9('0x0'));var router=express['Router']();var controller=require(_0x18c9('0x1'));router[_0x18c9('0x2')]('/',controller[_0x18c9('0x3')]);module['exports']=router; \ No newline at end of file +var _0x8672=['express','Router','./authActiveDirectory.controller','exports'];(function(_0x19f424,_0x5b593d){var _0x369d21=function(_0x471715){while(--_0x471715){_0x19f424['push'](_0x19f424['shift']());}};_0x369d21(++_0x5b593d);}(_0x8672,0x108));var _0x2867=function(_0x1e5c12,_0x22c559){_0x1e5c12=_0x1e5c12-0x0;var _0x3dc5ef=_0x8672[_0x1e5c12];return _0x3dc5ef;};'use strict';var express=require(_0x2867('0x0'));var router=express[_0x2867('0x1')]();var controller=require(_0x2867('0x2'));router['post']('/',controller['login']);module[_0x2867('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index c7032d5..60c82aa 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x148da8,_0x24f110){var _0xa1d647=function(_0x22951d){while(--_0x22951d){_0x148da8['push'](_0x148da8['shift']());}};_0xa1d647(++_0x24f110);}(_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 +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(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x7a54,0x106));var _0x47a5=function(_0x570f02,_0x287850){_0x570f02=_0x570f02-0x0;var _0x260673=_0x7a54[_0x570f02];return _0x260673;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 33dc23e..4fcde39 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 _0xd2bb=['callback','isMiddleware','setTokenCookie','exports','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login'];(function(_0x18fbfd,_0x1f0d8a){var _0xc546bc=function(_0xff0b28){while(--_0xff0b28){_0x18fbfd['push'](_0x18fbfd['shift']());}};_0xc546bc(++_0x1f0d8a);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x54362f,_0x58cef5){_0x54362f=_0x54362f-0x0;var _0x58d5f6=_0xd2bb[_0x54362f];return _0x58d5f6;};'use strict';var express=require('express');var passport=require(_0xbd2b('0x0'));var router=express['Router']();var controller=require(_0xbd2b('0x1'));var userController=require(_0xbd2b('0x2'));var authService=require(_0xbd2b('0x3'));router[_0xbd2b('0x4')]('/',controller[_0xbd2b('0x5')]);router[_0xbd2b('0x4')]('/callback',controller[_0xbd2b('0x6')],authService[_0xbd2b('0x7')],userController[_0xbd2b('0x5')],authService[_0xbd2b('0x8')]);module[_0xbd2b('0x9')]=router; \ No newline at end of file +var _0x5b78=['../../components/auth/service','login','get','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router'];(function(_0x598161,_0x80c017){var _0x5666af=function(_0x139666){while(--_0x139666){_0x598161['push'](_0x598161['shift']());}};_0x5666af(++_0x80c017);}(_0x5b78,0xfa));var _0x85b7=function(_0x5dd1ef,_0x50ddd9){_0x5dd1ef=_0x5dd1ef-0x0;var _0x222d63=_0x5b78[_0x5dd1ef];return _0x222d63;};'use strict';var express=require(_0x85b7('0x0'));var passport=require(_0x85b7('0x1'));var router=express[_0x85b7('0x2')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0x85b7('0x3'));router['get']('/',controller[_0x85b7('0x4')]);router[_0x85b7('0x5')](_0x85b7('0x6'),controller[_0x85b7('0x7')],authService[_0x85b7('0x8')],userController[_0x85b7('0x4')],authService[_0x85b7('0x9')]);module[_0x85b7('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 2dcfc34..402ba5d 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 _0xd268=['salt','disabled','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','add','minutes','clearBlockUser','getLicense','catch','MailAccount','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','error','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','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','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://','host','/reset/','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','password'];(function(_0x25751d,_0x424de6){var _0x2ce2e4=function(_0x2d36d3){while(--_0x2d36d3){_0x25751d['push'](_0x25751d['shift']());}};_0x2ce2e4(++_0x424de6);}(_0xd268,0xf6));var _0x8d26=function(_0x3306f3,_0x18e885){_0x3306f3=_0x3306f3-0x0;var _0x3424c=_0xd268[_0x3306f3];return _0x3424c;};'use strict';var util=require(_0x8d26('0x0'));var passport=require(_0x8d26('0x1'));var LocalStrategy=require(_0x8d26('0x2'))[_0x8d26('0x3')];var jayson=require(_0x8d26('0x4'));var _=require('lodash');var rs=require('randomstring');var moment=require(_0x8d26('0x5'));var db=require(_0x8d26('0x6'))['db'];var authService=require(_0x8d26('0x7'));var utils=require(_0x8d26('0x8'));var client=jayson[_0x8d26('0x9')][_0x8d26('0xa')]({'port':0x232b});function localAuthenticate(_0xf007ff,_0xa2a925,_0x4f7875,_0x3f73f4){var _0x38a036,_0x5a076b;return db[_0x8d26('0xb')]['findOne']({'where':{'id':0x1},'attributes':[_0x8d26('0xc'),_0x8d26('0xd')],'raw':!![]})[_0x8d26('0xe')](function(_0x1a7a63){_0x38a036=_0x1a7a63;return _0xf007ff[_0x8d26('0xf')]({'attributes':['id',_0x8d26('0x10'),_0x8d26('0x11'),_0x8d26('0x12'),'role',_0x8d26('0x13'),'blocked',_0x8d26('0x14'),_0x8d26('0x15')],'where':{'name':_0xa2a925,'role':{'$or':[_0x8d26('0x16'),_0x8d26('0x17'),_0x8d26('0x18')]}}});})[_0x8d26('0xe')](function(_0x35c4c4){if(!_0x35c4c4||_0x35c4c4&&_0x35c4c4[_0x8d26('0x10')]!==_0xa2a925){throw new Error(_0x8d26('0x19'));}else{_0x5a076b=_0x35c4c4;return _0x5a076b;}})[_0x8d26('0xe')](function(){_0x5a076b[_0x8d26('0x1a')](_0x4f7875,function(_0x2eba40,_0x1a9e60){var _0x1a338e=_0x5a076b[_0x8d26('0x15')]+0x1;if(_0x2eba40){return _0x3f73f4(_0x2eba40);}else if(!_0x1a9e60){if(_0x5a076b[_0x8d26('0x13')]){return _0x3f73f4(null,![],{'message':_0x8d26('0x19')});}else if(_0x38a036[_0x8d26('0xc')]>0x0){if(_0x5a076b[_0x8d26('0x1b')]){if(_0x38a036['blockDuration']>0x0){if(moment(_0x5a076b[_0x8d26('0x14')])[_0x8d26('0x1c')](_0x38a036['blockDuration'],_0x8d26('0x1d'))>moment()){return _0x3f73f4(null,![],{'message':_0x8d26('0x19')});}else{return utils[_0x8d26('0x1e')](_0x5a076b,_0x1a338e,![],null)['then'](function(){return _0x3f73f4(null,![],{'message':_0x8d26('0x19')});});}}else{return _0x3f73f4(null,![],{'message':_0x8d26('0x19')});}}else{if(_0x1a338e>=_0x38a036[_0x8d26('0xc')]){return utils[_0x8d26('0x1e')](_0x5a076b,0x0,!![],moment())[_0x8d26('0xe')](function(){return _0x3f73f4(null,![],{'message':_0x8d26('0x19')});});}else{return utils[_0x8d26('0x1e')](_0x5a076b,_0x1a338e,![],null)[_0x8d26('0xe')](function(){return _0x3f73f4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x3f73f4(null,![],{'message':_0x8d26('0x19')});}}else{if(_0x5a076b[_0x8d26('0x13')]){return _0x3f73f4(null,![],{'message':_0x8d26('0x19')});}else if(_0x38a036['allowedLoginAttempts']>0x0){if(_0x5a076b[_0x8d26('0x1b')]){if(_0x38a036[_0x8d26('0xd')]>0x0){if(moment(_0x5a076b[_0x8d26('0x14')])[_0x8d26('0x1c')](_0x38a036[_0x8d26('0xd')],_0x8d26('0x1d'))>moment()){return _0x3f73f4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x5a076b,0x0,![],null)[_0x8d26('0xe')](function(){return utils[_0x8d26('0x1f')](_0x5a076b);})[_0x8d26('0xe')](function(){return _0x3f73f4(null,_0x5a076b);});}}else{return _0x3f73f4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x8d26('0x1e')](_0x5a076b,0x0,![],null)[_0x8d26('0xe')](function(){return utils['getLicense'](_0x5a076b);})['then'](function(){return _0x3f73f4(null,_0x5a076b);})[_0x8d26('0x20')](function(_0x27aa72){return _0x3f73f4(null,![],_0x27aa72);});}}else{if(_0x5a076b['blocked']){return _0x3f73f4(null,![],{'message':_0x8d26('0x19')});}else{return utils[_0x8d26('0x1f')](_0x5a076b)[_0x8d26('0xe')](function(){return _0x3f73f4(null,_0x5a076b);});}}}});})[_0x8d26('0x20')](function(_0x342f4a){return _0x3f73f4(null,![],_0x342f4a);});}function sendServiceMail(_0x1869ff){return db[_0x8d26('0x21')]['find']({'where':{'service':!![]},'attributes':['id',_0x8d26('0x10'),_0x8d26('0x22')],'include':[{'model':db[_0x8d26('0x23')],'as':_0x8d26('0x24'),'include':[{'model':db[_0x8d26('0x25')],'as':_0x8d26('0x25')}]}]})[_0x8d26('0xe')](function(_0x309bb9){if(!_0x309bb9){throw new Error(_0x8d26('0x26'));}var _0x53654b=_0x309bb9[_0x8d26('0x27')]();var _0x16b6e8={'account':_0x53654b,'message':_['merge']({'from':util[_0x8d26('0x28')](_0x8d26('0x29'),_0x309bb9['name'],_0x309bb9[_0x8d26('0x22')]||_0x309bb9[_0x8d26('0x24')][_0x8d26('0x17')])},_0x1869ff)};return client[_0x8d26('0x2a')](_0x8d26('0x2b'),_0x16b6e8);})[_0x8d26('0xe')](function(_0x6ee775){if(_0x6ee775['error']){throw new Error(util[_0x8d26('0x28')](_0x8d26('0x2c'),_0x6ee775['error'][_0x8d26('0x2d')]||JSON[_0x8d26('0x2e')](_0x6ee775[_0x8d26('0x2f')])));}return!![];});}function handleError(_0x5730df,_0x26e2be,_0xca0756){return _0x5730df[_0x8d26('0x30')](_0x26e2be||0x1f4)[_0x8d26('0x31')]({'message':_0xca0756?_0xca0756[_0x8d26('0x2d')]||_0xca0756:''});}exports[_0x8d26('0x32')]=function(_0x407eb1,_0x204405,_0x58f412){passport[_0x8d26('0x1a')](_0x8d26('0x33'),function(_0x19582a,_0x5b53d9,_0x12f2e0){var _0x43aba6=_0x19582a||_0x12f2e0;if(_0x43aba6){return handleError(_0x204405,0x191,_0x43aba6);}if(!_0x5b53d9){return handleError(_0x204405,0x194,{'message':_0x8d26('0x34')});}else{var _0x1b738e={'payload':{'id':_0x5b53d9['id'],'role':_0x5b53d9[_0x8d26('0x35')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1b738e)['then'](function(_0x22a351){_0x204405[_0x8d26('0x36')]({'id':_0x5b53d9['id'],'token':_0x22a351,'statusCall':'','isAlreadyLogged':_0x5b53d9[_0x8d26('0x37')]});});}})(_0x407eb1,_0x204405,_0x58f412);};exports[_0x8d26('0x38')]=function(_0x539bb6,_0x309bcc){if(!_0x539bb6[_0x8d26('0x39')][_0x8d26('0x22')]){return handleError(_0x309bcc,0x1f4,{'message':_0x8d26('0x3a')});}var _0x2d392b=rs[_0x8d26('0x3b')]();_0x539bb6['body'][_0x8d26('0x22')]=_0x539bb6['body'][_0x8d26('0x22')][_0x8d26('0x3c')]()[_0x8d26('0x3d')]();var _0x55290c;return db[_0x8d26('0xb')][_0x8d26('0xf')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x8d26('0xe')](function(_0x44599c){_0x55290c=_0x44599c;return db[_0x8d26('0x3e')][_0x8d26('0x3f')]({'where':{'email':_0x539bb6[_0x8d26('0x39')][_0x8d26('0x22')]}});})[_0x8d26('0xe')](function(_0x407a61){if(!_0x407a61){throw new Error(_0x8d26('0x40'));}if(_0x407a61[_0x8d26('0x13')]){throw new Error(_0x8d26('0x41'));}if(_0x407a61['blocked']){if(moment(_0x407a61['blockedAt'])[_0x8d26('0x1c')](_0x55290c[_0x8d26('0xd')],'minutes')>moment()){throw new Error(_0x8d26('0x42'));}else{_0x407a61[_0x8d26('0x1b')]=![];_0x407a61[_0x8d26('0x14')]=null;}}_0x407a61[_0x8d26('0x43')]=_0x2d392b;_0x407a61['resetPasswordExpires']=Date[_0x8d26('0x44')]()+0x36ee80;return _0x407a61[_0x8d26('0x45')]();})[_0x8d26('0xe')](function(){return sendServiceMail({'to':_0x539bb6[_0x8d26('0x39')][_0x8d26('0x22')],'subject':_0x8d26('0x46'),'text':_0x8d26('0x47')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x8d26('0x48')+_0x539bb6['headers'][_0x8d26('0x49')]+_0x8d26('0x4a')+_0x2d392b+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x8d26('0xe')](function(){_0x309bcc[_0x8d26('0x30')](0xc8)[_0x8d26('0x31')]({'message':_0x8d26('0x4b')});})['catch'](function(_0x3878d1){return handleError(_0x309bcc,0x1f4,_0x3878d1);});};exports[_0x8d26('0x4c')]=function(_0x2be56e,_0x386db7){return db[_0x8d26('0x3e')]['find']({'where':{'resetPasswordToken':_0x2be56e[_0x8d26('0x4d')][_0x8d26('0x4e')],'resetPasswordExpires':{'$gt':Date[_0x8d26('0x44')]()}}})[_0x8d26('0xe')](function(_0x5d387b){if(!_0x5d387b){throw new Error(_0x8d26('0x4f'));}return db[_0x8d26('0xb')][_0x8d26('0xf')]({'attributes':['id',_0x8d26('0x50'),_0x8d26('0x51'),_0x8d26('0x52')]})[_0x8d26('0xe')](function(_0x5a145e){if(_0x5a145e[_0x8d26('0x50')])authService[_0x8d26('0x53')](_0x2be56e[_0x8d26('0x39')][_0x8d26('0x11')]);if(!_0x5a145e[_0x8d26('0x51')]||!_0x5d387b['previousPasswords'])return _0x5d387b;authService[_0x8d26('0x54')](_0x2be56e[_0x8d26('0x39')][_0x8d26('0x11')],_0x5d387b['previousPasswords'],_0x5a145e['passwordHistoryLimit']);return _0x5d387b;})[_0x8d26('0xe')](function(){_0x5d387b['password']=_0x2be56e[_0x8d26('0x39')][_0x8d26('0x11')];_0x5d387b['resetPasswordToken']=null;_0x5d387b[_0x8d26('0x55')]=null;return _0x5d387b[_0x8d26('0x45')]();});})[_0x8d26('0xe')](function(){_0x386db7['status'](0xc8)[_0x8d26('0x31')]({'message':_0x8d26('0x56')});})[_0x8d26('0x20')](function(_0x10f08c){return handleError(_0x386db7,0x1f4,_0x10f08c);});};passport[_0x8d26('0x57')](_0x8d26('0x33'),new LocalStrategy({'usernameField':_0x8d26('0x10'),'passwordField':_0x8d26('0x11')},function(_0x1941aa,_0x1fe4d9,_0x1e5cdb){return localAuthenticate(db[_0x8d26('0x3e')],_0x1941aa,_0x1fe4d9,_0x1e5cdb);})); \ No newline at end of file +var _0x66b1=['Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','params','token','now','Setting','findOne','securePassword','enforcePasswordHistory','validatePasswordPattern','password','validatePasswordHistory','previousPasswords','passwordHistoryLimit','resetPasswordToken','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','allowedLoginAttempts','blockDuration','name','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','add','minutes','clearBlockUser','getLicense','catch','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','Smtp','SendMail','error','message','stringify','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','json','forgot','body'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x66b1,0xce));var _0x166b=function(_0x49548f,_0x5393e1){_0x49548f=_0x49548f-0x0;var _0x5792e7=_0x66b1[_0x49548f];return _0x5792e7;};'use strict';var util=require(_0x166b('0x0'));var passport=require(_0x166b('0x1'));var LocalStrategy=require(_0x166b('0x2'))[_0x166b('0x3')];var jayson=require(_0x166b('0x4'));var _=require(_0x166b('0x5'));var rs=require(_0x166b('0x6'));var moment=require(_0x166b('0x7'));var db=require(_0x166b('0x8'))['db'];var authService=require(_0x166b('0x9'));var utils=require(_0x166b('0xa'));var client=jayson[_0x166b('0xb')]['http']({'port':0x232b});function localAuthenticate(_0x177d3c,_0x8fcac,_0xdc41fa,_0x440dc9){var _0xdca853,_0x380f2b;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x166b('0xc'),_0x166b('0xd')],'raw':!![]})['then'](function(_0x20c39c){_0xdca853=_0x20c39c;return _0x177d3c['findOne']({'attributes':['id',_0x166b('0xe'),'password','salt','role',_0x166b('0xf'),_0x166b('0x10'),_0x166b('0x11'),_0x166b('0x12')],'where':{'name':_0x8fcac,'role':{'$or':[_0x166b('0x13'),_0x166b('0x14'),_0x166b('0x15')]}}});})['then'](function(_0xf784ce){if(!_0xf784ce||_0xf784ce&&_0xf784ce[_0x166b('0xe')]!==_0x8fcac){throw new Error(_0x166b('0x16'));}else{_0x380f2b=_0xf784ce;return _0x380f2b;}})[_0x166b('0x17')](function(){_0x380f2b['authenticate'](_0xdc41fa,function(_0x4baf31,_0x40281e){var _0x205ac9=_0x380f2b['loginAttempts']+0x1;if(_0x4baf31){return _0x440dc9(_0x4baf31);}else if(!_0x40281e){if(_0x380f2b[_0x166b('0xf')]){return _0x440dc9(null,![],{'message':_0x166b('0x16')});}else if(_0xdca853['allowedLoginAttempts']>0x0){if(_0x380f2b[_0x166b('0x10')]){if(_0xdca853[_0x166b('0xd')]>0x0){if(moment(_0x380f2b[_0x166b('0x11')])[_0x166b('0x18')](_0xdca853['blockDuration'],_0x166b('0x19'))>moment()){return _0x440dc9(null,![],{'message':_0x166b('0x16')});}else{return utils['clearBlockUser'](_0x380f2b,_0x205ac9,![],null)[_0x166b('0x17')](function(){return _0x440dc9(null,![],{'message':_0x166b('0x16')});});}}else{return _0x440dc9(null,![],{'message':_0x166b('0x16')});}}else{if(_0x205ac9>=_0xdca853[_0x166b('0xc')]){return utils[_0x166b('0x1a')](_0x380f2b,0x0,!![],moment())['then'](function(){return _0x440dc9(null,![],{'message':_0x166b('0x16')});});}else{return utils['clearBlockUser'](_0x380f2b,_0x205ac9,![],null)[_0x166b('0x17')](function(){return _0x440dc9(null,![],{'message':_0x166b('0x16')});});}}}else{return _0x440dc9(null,![],{'message':_0x166b('0x16')});}}else{if(_0x380f2b[_0x166b('0xf')]){return _0x440dc9(null,![],{'message':_0x166b('0x16')});}else if(_0xdca853[_0x166b('0xc')]>0x0){if(_0x380f2b['blocked']){if(_0xdca853[_0x166b('0xd')]>0x0){if(moment(_0x380f2b[_0x166b('0x11')])[_0x166b('0x18')](_0xdca853[_0x166b('0xd')],_0x166b('0x19'))>moment()){return _0x440dc9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x166b('0x1a')](_0x380f2b,0x0,![],null)[_0x166b('0x17')](function(){return utils[_0x166b('0x1b')](_0x380f2b);})[_0x166b('0x17')](function(){return _0x440dc9(null,_0x380f2b);});}}else{return _0x440dc9(null,![],{'message':_0x166b('0x16')});}}else{return utils[_0x166b('0x1a')](_0x380f2b,0x0,![],null)[_0x166b('0x17')](function(){return utils[_0x166b('0x1b')](_0x380f2b);})['then'](function(){return _0x440dc9(null,_0x380f2b);})[_0x166b('0x1c')](function(_0xe3d34b){return _0x440dc9(null,![],_0xe3d34b);});}}else{if(_0x380f2b[_0x166b('0x10')]){return _0x440dc9(null,![],{'message':_0x166b('0x16')});}else{return utils[_0x166b('0x1b')](_0x380f2b)[_0x166b('0x17')](function(){return _0x440dc9(null,_0x380f2b);});}}}});})[_0x166b('0x1c')](function(_0x269796){return _0x440dc9(null,![],_0x269796);});}function sendServiceMail(_0x268476){return db['MailAccount'][_0x166b('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x166b('0xe'),_0x166b('0x1e')],'include':[{'model':db[_0x166b('0x1f')],'as':'Smtp','include':[{'model':db[_0x166b('0x20')],'as':_0x166b('0x20')}]}]})['then'](function(_0x5bfde3){if(!_0x5bfde3){throw new Error(_0x166b('0x21'));}var _0x19a8dd=_0x5bfde3[_0x166b('0x22')]();var _0xd53a6f={'account':_0x19a8dd,'message':_[_0x166b('0x23')]({'from':util[_0x166b('0x24')](_0x166b('0x25'),_0x5bfde3[_0x166b('0xe')],_0x5bfde3[_0x166b('0x1e')]||_0x5bfde3[_0x166b('0x26')]['user'])},_0x268476)};return client['request'](_0x166b('0x27'),_0xd53a6f);})['then'](function(_0x4dbae3){if(_0x4dbae3[_0x166b('0x28')]){throw new Error(util[_0x166b('0x24')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x4dbae3[_0x166b('0x28')][_0x166b('0x29')]||JSON[_0x166b('0x2a')](_0x4dbae3[_0x166b('0x28')])));}return!![];});}function handleError(_0x5b9820,_0xd0ae9a,_0x1667df){return _0x5b9820['status'](_0xd0ae9a||0x1f4)[_0x166b('0x2b')]({'message':_0x1667df?_0x1667df[_0x166b('0x29')]||_0x1667df:''});}exports[_0x166b('0x2c')]=function(_0x4f2677,_0x38bf1a,_0x5720e6){passport[_0x166b('0x2d')](_0x166b('0x2e'),function(_0x366836,_0x29a6d8,_0x378256){var _0xb98749=_0x366836||_0x378256;if(_0xb98749){return handleError(_0x38bf1a,0x191,_0xb98749);}if(!_0x29a6d8){return handleError(_0x38bf1a,0x194,{'message':_0x166b('0x2f')});}else{var _0x1de469={'payload':{'id':_0x29a6d8['id'],'role':_0x29a6d8[_0x166b('0x30')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1de469)[_0x166b('0x17')](function(_0x4e3a60){_0x38bf1a[_0x166b('0x31')]({'id':_0x29a6d8['id'],'token':_0x4e3a60,'statusCall':'','isAlreadyLogged':_0x29a6d8['online']});});}})(_0x4f2677,_0x38bf1a,_0x5720e6);};exports[_0x166b('0x32')]=function(_0x255be7,_0x2ea8a6){if(!_0x255be7[_0x166b('0x33')][_0x166b('0x1e')]){return handleError(_0x2ea8a6,0x1f4,{'message':_0x166b('0x34')});}var _0x3f7c68=rs[_0x166b('0x35')]();_0x255be7[_0x166b('0x33')][_0x166b('0x1e')]=_0x255be7[_0x166b('0x33')][_0x166b('0x1e')][_0x166b('0x36')]()[_0x166b('0x37')]();var _0x2f64ae;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})['then'](function(_0x8ceafb){_0x2f64ae=_0x8ceafb;return db[_0x166b('0x38')][_0x166b('0x1d')]({'where':{'email':_0x255be7[_0x166b('0x33')]['email']}});})[_0x166b('0x17')](function(_0x383d46){if(!_0x383d46){throw new Error(_0x166b('0x39'));}if(_0x383d46['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x383d46[_0x166b('0x10')]){if(moment(_0x383d46[_0x166b('0x11')])[_0x166b('0x18')](_0x2f64ae[_0x166b('0xd')],_0x166b('0x19'))>moment()){throw new Error(_0x166b('0x3a'));}else{_0x383d46[_0x166b('0x10')]=![];_0x383d46['blockedAt']=null;}}_0x383d46['resetPasswordToken']=_0x3f7c68;_0x383d46[_0x166b('0x3b')]=Date['now']()+0x36ee80;return _0x383d46[_0x166b('0x3c')]();})[_0x166b('0x17')](function(){return sendServiceMail({'to':_0x255be7[_0x166b('0x33')][_0x166b('0x1e')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x166b('0x3d')+_0x166b('0x3e')+_0x166b('0x3f')+_0x255be7[_0x166b('0x40')][_0x166b('0x41')]+_0x166b('0x42')+_0x3f7c68+'\x0a\x0a'+_0x166b('0x43')});})[_0x166b('0x17')](function(){_0x2ea8a6[_0x166b('0x44')](0xc8)[_0x166b('0x2b')]({'message':_0x166b('0x45')});})[_0x166b('0x1c')](function(_0x5096f8){return handleError(_0x2ea8a6,0x1f4,_0x5096f8);});};exports[_0x166b('0x46')]=function(_0x12b3fc,_0x1904ff){return db[_0x166b('0x38')][_0x166b('0x1d')]({'where':{'resetPasswordToken':_0x12b3fc[_0x166b('0x47')][_0x166b('0x48')],'resetPasswordExpires':{'$gt':Date[_0x166b('0x49')]()}}})[_0x166b('0x17')](function(_0x3dabd0){if(!_0x3dabd0){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x166b('0x4a')][_0x166b('0x4b')]({'attributes':['id',_0x166b('0x4c'),_0x166b('0x4d'),'passwordHistoryLimit']})[_0x166b('0x17')](function(_0x2f7d1c){if(_0x2f7d1c['securePassword'])authService[_0x166b('0x4e')](_0x12b3fc[_0x166b('0x33')][_0x166b('0x4f')]);if(!_0x2f7d1c[_0x166b('0x4d')]||!_0x3dabd0['previousPasswords'])return _0x3dabd0;authService[_0x166b('0x50')](_0x12b3fc[_0x166b('0x33')]['password'],_0x3dabd0[_0x166b('0x51')],_0x2f7d1c[_0x166b('0x52')]);return _0x3dabd0;})[_0x166b('0x17')](function(){_0x3dabd0['password']=_0x12b3fc['body'][_0x166b('0x4f')];_0x3dabd0[_0x166b('0x53')]=null;_0x3dabd0[_0x166b('0x3b')]=null;return _0x3dabd0[_0x166b('0x3c')]();});})[_0x166b('0x17')](function(){_0x1904ff['status'](0xc8)['send']({'message':_0x166b('0x54')});})[_0x166b('0x1c')](function(_0x19ebd3){return handleError(_0x1904ff,0x1f4,_0x19ebd3);});};passport[_0x166b('0x55')](_0x166b('0x2e'),new LocalStrategy({'usernameField':_0x166b('0xe'),'passwordField':_0x166b('0x4f')},function(_0x17eb97,_0x3fddba,_0x224703){return localAuthenticate(db[_0x166b('0x38')],_0x17eb97,_0x3fddba,_0x224703);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index d282579..bda692f 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 _0xa539=['Router','./authLocal.controller','post','login','forgot','reset','express'];(function(_0x5b5cde,_0x1f7c5f){var _0x364ad2=function(_0x4a1172){while(--_0x4a1172){_0x5b5cde['push'](_0x5b5cde['shift']());}};_0x364ad2(++_0x1f7c5f);}(_0xa539,0x1e9));var _0x9a53=function(_0x26befe,_0x4d1ed0){_0x26befe=_0x26befe-0x0;var _0xce4d34=_0xa539[_0x26befe];return _0xce4d34;};'use strict';var express=require(_0x9a53('0x0'));var router=express[_0x9a53('0x1')]();var controller=require(_0x9a53('0x2'));router[_0x9a53('0x3')]('/',controller[_0x9a53('0x4')]);router[_0x9a53('0x3')]('/forgot',controller[_0x9a53('0x5')]);router['post']('/reset/:token',controller[_0x9a53('0x6')]);module['exports']=router; \ No newline at end of file +var _0x635b=['./authLocal.controller','post','login','/reset/:token','reset','Router'];(function(_0x1c0a25,_0x227201){var _0x4ddd7e=function(_0x59f4ac){while(--_0x59f4ac){_0x1c0a25['push'](_0x1c0a25['shift']());}};_0x4ddd7e(++_0x227201);}(_0x635b,0x95));var _0xb635=function(_0x59dd92,_0x48d8d6){_0x59dd92=_0x59dd92-0x0;var _0x5c760f=_0x635b[_0x59dd92];return _0x5c760f;};'use strict';var express=require('express');var router=express[_0xb635('0x0')]();var controller=require(_0xb635('0x1'));router[_0xb635('0x2')]('/',controller[_0xb635('0x3')]);router['post']('/forgot',controller['forgot']);router[_0xb635('0x2')](_0xb635('0x4'),controller[_0xb635('0x5')]);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 a467096..125d47b 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 _0x607d=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x28726b,_0xf6c945){var _0x3e19c9=function(_0x5505f4){while(--_0x5505f4){_0x28726b['push'](_0x28726b['shift']());}};_0x3e19c9(++_0xf6c945);}(_0x607d,0x159));var _0xd607=function(_0x12e9fe,_0x69b722){_0x12e9fe=_0x12e9fe-0x0;var _0x39ff19=_0x607d[_0x12e9fe];return _0x39ff19;};'use strict';var Sequelize=require(_0xd607('0x0'));module[_0xd607('0x1')]={'name':{'type':Sequelize[_0xd607('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd607('0x2')]},'status':{'type':Sequelize[_0xd607('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xd607('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xf65a=['INTEGER','STRING','BOOLEAN'];(function(_0x3744fa,_0x1af90b){var _0x525f35=function(_0x151b59){while(--_0x151b59){_0x3744fa['push'](_0x3744fa['shift']());}};_0x525f35(++_0x1af90b);}(_0xf65a,0x6a));var _0xaf65=function(_0x310e75,_0x28a4fe){_0x310e75=_0x310e75-0x0;var _0x20e5fc=_0xf65a[_0x310e75];return _0x20e5fc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xaf65('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0xaf65('0x0')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xaf65('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xaf65('0x2')],'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 020b050..548f44b 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 _0x1a43=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','pick','nolimit','addActions','getActions','Action','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','save','update','destroy','then','error','stack','name','send','map','Automation','rawAttributes'];(function(_0x2c9a1a,_0x9f98e6){var _0x193560=function(_0x1d98fe){while(--_0x1d98fe){_0x2c9a1a['push'](_0x2c9a1a['shift']());}};_0x193560(++_0x9f98e6);}(_0x1a43,0x16f));var _0x31a4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a43[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x31a4('0x0'));var zipdir=require(_0x31a4('0x1'));var jsonpatch=require(_0x31a4('0x2'));var rp=require(_0x31a4('0x3'));var moment=require(_0x31a4('0x4'));var BPromise=require(_0x31a4('0x5'));var Mustache=require(_0x31a4('0x6'));var util=require('util');var path=require(_0x31a4('0x7'));var sox=require(_0x31a4('0x8'));var csv=require('to-csv');var ejs=require(_0x31a4('0x9'));var fs=require('fs');var fs_extra=require(_0x31a4('0xa'));var _=require(_0x31a4('0xb'));var squel=require(_0x31a4('0xc'));var crypto=require(_0x31a4('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x31a4('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x31a4('0xf'));var qs=require(_0x31a4('0x10'));var as=require(_0x31a4('0x11'));var hardwareService=require(_0x31a4('0x12'));var logger=require(_0x31a4('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x31a4('0x14'));var licenseUtil=require(_0x31a4('0x15'));var db=require(_0x31a4('0x16'))['db'];function respondWithStatusCode(_0x23ff56,_0x551f6b){_0x551f6b=_0x551f6b||0xcc;return function(_0x1aa52b){if(_0x1aa52b){return _0x23ff56[_0x31a4('0x17')](_0x551f6b);}return _0x23ff56[_0x31a4('0x18')](_0x551f6b)[_0x31a4('0x19')]();};}function respondWithResult(_0x2cd40a,_0x3b6006){_0x3b6006=_0x3b6006||0xc8;return function(_0x4a5df1){if(_0x4a5df1){return _0x2cd40a[_0x31a4('0x18')](_0x3b6006)[_0x31a4('0x1a')](_0x4a5df1);}};}function respondWithFilteredResult(_0x592502,_0x2f2417){return function(_0xbe5291){if(_0xbe5291){var _0x5b1366=typeof _0x2f2417[_0x31a4('0x1b')]==='undefined'&&typeof _0x2f2417[_0x31a4('0x1c')]===_0x31a4('0x1d');var _0x1210de=_0xbe5291['count'];var _0x17c1b8=_0x5b1366?0x0:_0x2f2417[_0x31a4('0x1b')];var _0x422a94=_0x5b1366?_0xbe5291[_0x31a4('0x1e')]:_0x2f2417[_0x31a4('0x1b')]+_0x2f2417[_0x31a4('0x1c')];var _0x176229;if(_0x422a94>=_0x1210de){_0x422a94=_0x1210de;_0x176229=0xc8;}else{_0x176229=0xce;}_0x592502[_0x31a4('0x18')](_0x176229);return _0x592502[_0x31a4('0x1f')]('Content-Range',_0x17c1b8+'-'+_0x422a94+'/'+_0x1210de)['json'](_0xbe5291);}return null;};}function patchUpdates(_0x2f6628){return function(_0x6efbe8){try{jsonpatch['apply'](_0x6efbe8,_0x2f6628,!![]);}catch(_0x4c90f8){return BPromise['reject'](_0x4c90f8);}return _0x6efbe8[_0x31a4('0x20')]();};}function saveUpdates(_0x544a72,_0x26bd7f){return function(_0x9e47fd){if(_0x9e47fd){return _0x9e47fd[_0x31a4('0x21')](_0x544a72)['then'](function(_0x1b2fdd){return _0x1b2fdd;});}return null;};}function removeEntity(_0x1a98ee,_0x493a79){return function(_0x40d5dc){if(_0x40d5dc){return _0x40d5dc[_0x31a4('0x22')]()[_0x31a4('0x23')](function(){_0x1a98ee[_0x31a4('0x18')](0xcc)[_0x31a4('0x19')]();});}};}function handleEntityNotFound(_0x4fe565,_0x5df76f){return function(_0x274605){if(!_0x274605){_0x4fe565['sendStatus'](0x194);}return _0x274605;};}function handleError(_0x250dfd,_0x35a41c){_0x35a41c=_0x35a41c||0x1f4;return function(_0x363552){logger[_0x31a4('0x24')](_0x363552[_0x31a4('0x25')]);if(_0x363552[_0x31a4('0x26')]){delete _0x363552['name'];}_0x250dfd[_0x31a4('0x18')](_0x35a41c)[_0x31a4('0x27')](_0x363552);};}exports['index']=function(_0x607c95,_0x3e5972){var _0x45e59d={},_0x369812={},_0xfaddb={'count':0x0,'rows':[]};var _0x229ee4=_[_0x31a4('0x28')](db[_0x31a4('0x29')][_0x31a4('0x2a')],function(_0x1db709){return{'name':_0x1db709['fieldName'],'type':_0x1db709['type'][_0x31a4('0x2b')]};});_0x369812[_0x31a4('0x2c')]=_[_0x31a4('0x28')](_0x229ee4,'name');_0x369812[_0x31a4('0x2d')]=_[_0x31a4('0x2e')](_0x607c95[_0x31a4('0x2d')]);_0x369812[_0x31a4('0x2f')]=_[_0x31a4('0x30')](_0x369812[_0x31a4('0x2c')],_0x369812[_0x31a4('0x2d')]);_0x45e59d[_0x31a4('0x31')]=_['intersection'](_0x369812[_0x31a4('0x2c')],qs['fields'](_0x607c95[_0x31a4('0x2d')][_0x31a4('0x32')]));_0x45e59d[_0x31a4('0x31')]=_0x45e59d[_0x31a4('0x31')][_0x31a4('0x33')]?_0x45e59d[_0x31a4('0x31')]:_0x369812[_0x31a4('0x2c')];if(!_0x607c95[_0x31a4('0x2d')][_0x31a4('0x34')]('nolimit')){_0x45e59d[_0x31a4('0x1c')]=qs[_0x31a4('0x1c')](_0x607c95[_0x31a4('0x2d')][_0x31a4('0x1c')]);_0x45e59d['offset']=qs['offset'](_0x607c95[_0x31a4('0x2d')][_0x31a4('0x1b')]);}_0x45e59d[_0x31a4('0x35')]=qs['sort'](_0x607c95[_0x31a4('0x2d')][_0x31a4('0x36')]);_0x45e59d[_0x31a4('0x37')]=qs[_0x31a4('0x2f')](_['pick'](_0x607c95[_0x31a4('0x2d')],_0x369812[_0x31a4('0x2f')]),_0x229ee4);if(_0x607c95[_0x31a4('0x2d')][_0x31a4('0x38')]){_0x45e59d['where']=_[_0x31a4('0x39')](_0x45e59d[_0x31a4('0x37')],{'$or':_[_0x31a4('0x28')](_0x229ee4,function(_0x137b82){if(_0x137b82[_0x31a4('0x3a')]!==_0x31a4('0x3b')){var _0x29de97={};_0x29de97[_0x137b82['name']]={'$like':'%'+_0x607c95[_0x31a4('0x2d')][_0x31a4('0x38')]+'%'};return _0x29de97;}})});}_0x45e59d=_['merge']({},_0x45e59d,_0x607c95[_0x31a4('0x3c')]);var _0x3bbdb7={'where':_0x45e59d[_0x31a4('0x37')]};return db[_0x31a4('0x29')][_0x31a4('0x1e')](_0x3bbdb7)[_0x31a4('0x23')](function(_0x44d8aa){_0xfaddb['count']=_0x44d8aa;if(_0x607c95[_0x31a4('0x2d')][_0x31a4('0x3d')]){_0x45e59d[_0x31a4('0x3e')]=[{'all':!![]}];}return db[_0x31a4('0x29')][_0x31a4('0x3f')](_0x45e59d);})[_0x31a4('0x23')](function(_0x120f9d){_0xfaddb[_0x31a4('0x40')]=_0x120f9d;return _0xfaddb;})[_0x31a4('0x23')](respondWithFilteredResult(_0x3e5972,_0x45e59d))[_0x31a4('0x41')](handleError(_0x3e5972,null));};exports[_0x31a4('0x42')]=function(_0x1e93e6,_0x57d9a7){var _0x1e9278={'raw':![],'where':{'id':_0x1e93e6[_0x31a4('0x43')]['id']}},_0x27b491={};_0x27b491[_0x31a4('0x2c')]=_[_0x31a4('0x2e')](db[_0x31a4('0x29')]['rawAttributes']);_0x27b491['query']=_[_0x31a4('0x2e')](_0x1e93e6['query']);_0x27b491[_0x31a4('0x2f')]=_[_0x31a4('0x30')](_0x27b491[_0x31a4('0x2c')],_0x27b491[_0x31a4('0x2d')]);_0x1e9278['attributes']=_['intersection'](_0x27b491['model'],qs[_0x31a4('0x32')](_0x1e93e6[_0x31a4('0x2d')][_0x31a4('0x32')]));_0x1e9278['attributes']=_0x1e9278['attributes'][_0x31a4('0x33')]?_0x1e9278[_0x31a4('0x31')]:_0x27b491[_0x31a4('0x2c')];if(_0x1e93e6['query'][_0x31a4('0x3d')]){_0x1e9278[_0x31a4('0x3e')]=[{'all':!![]}];}_0x1e9278=_[_0x31a4('0x39')]({},_0x1e9278,_0x1e93e6[_0x31a4('0x3c')]);return db[_0x31a4('0x29')][_0x31a4('0x44')](_0x1e9278)[_0x31a4('0x23')](handleEntityNotFound(_0x57d9a7,null))[_0x31a4('0x23')](respondWithResult(_0x57d9a7,null))[_0x31a4('0x41')](handleError(_0x57d9a7,null));};exports[_0x31a4('0x45')]=function(_0xfff068,_0x516b65){return db[_0x31a4('0x29')][_0x31a4('0x45')](_0xfff068[_0x31a4('0x46')],{})['then'](respondWithResult(_0x516b65,0xc9))[_0x31a4('0x41')](handleError(_0x516b65,null));};exports['update']=function(_0x477517,_0xf8d58a){if(_0x477517[_0x31a4('0x46')]['id']){delete _0x477517['body']['id'];}return db[_0x31a4('0x29')][_0x31a4('0x44')]({'where':{'id':_0x477517[_0x31a4('0x43')]['id']}})[_0x31a4('0x23')](handleEntityNotFound(_0xf8d58a,null))[_0x31a4('0x23')](saveUpdates(_0x477517[_0x31a4('0x46')],null))[_0x31a4('0x23')](respondWithResult(_0xf8d58a,null))[_0x31a4('0x41')](handleError(_0xf8d58a,null));};exports['destroy']=function(_0x19c3a2,_0x503224){return db['Automation'][_0x31a4('0x44')]({'where':{'id':_0x19c3a2[_0x31a4('0x43')]['id']}})[_0x31a4('0x23')](handleEntityNotFound(_0x503224,null))[_0x31a4('0x23')](removeEntity(_0x503224,null))[_0x31a4('0x41')](handleError(_0x503224,null));};exports[_0x31a4('0x47')]=function(_0x5e02e0,_0x119728,_0x4dbbe0){return db[_0x31a4('0x48')]['find']({'where':{'id':_0x5e02e0[_0x31a4('0x43')]['id']}})[_0x31a4('0x23')](handleEntityNotFound(_0x119728,null))['then'](function(_0x4ffa2f){if(_0x4ffa2f){return _0x4ffa2f[_0x31a4('0x47')](_0x5e02e0[_0x31a4('0x46')][_0x31a4('0x49')],_[_0x31a4('0x4a')](_0x5e02e0[_0x31a4('0x46')],[_0x31a4('0x49'),'id'])||{});}})['then'](respondWithResult(_0x119728,null))['catch'](handleError(_0x119728,null));};exports[_0x31a4('0x4b')]=function(_0x1e3df4,_0x45bcd5,_0xbb0a67){var _0x21214e={};var _0x444753={};var _0x1f3f3d;var _0x45d897;return db[_0x31a4('0x29')][_0x31a4('0x4c')]({'where':{'id':_0x1e3df4[_0x31a4('0x43')]['id']}})[_0x31a4('0x23')](handleEntityNotFound(_0x45bcd5,null))['then'](function(_0x1f6788){if(_0x1f6788){_0x1f3f3d=_0x1f6788;_0x444753['model']=_[_0x31a4('0x2e')](db[_0x31a4('0x48')][_0x31a4('0x2a')]);_0x444753[_0x31a4('0x2d')]=_[_0x31a4('0x2e')](_0x1e3df4[_0x31a4('0x2d')]);_0x444753['filters']=_[_0x31a4('0x30')](_0x444753[_0x31a4('0x2c')],_0x444753[_0x31a4('0x2d')]);_0x21214e[_0x31a4('0x31')]=_[_0x31a4('0x30')](_0x444753[_0x31a4('0x2c')],qs[_0x31a4('0x32')](_0x1e3df4[_0x31a4('0x2d')][_0x31a4('0x32')]));_0x21214e[_0x31a4('0x31')]=_0x21214e['attributes']['length']?_0x21214e[_0x31a4('0x31')]:_0x444753['model'];_0x21214e[_0x31a4('0x35')]=qs[_0x31a4('0x36')](_0x1e3df4[_0x31a4('0x2d')][_0x31a4('0x36')]);_0x21214e[_0x31a4('0x37')]=qs[_0x31a4('0x2f')](_[_0x31a4('0x4d')](_0x1e3df4['query'],_0x444753[_0x31a4('0x2f')]));if(_0x1e3df4[_0x31a4('0x2d')][_0x31a4('0x38')]){_0x21214e[_0x31a4('0x37')]=_[_0x31a4('0x39')](_0x21214e[_0x31a4('0x37')],{'$or':_[_0x31a4('0x28')](_0x21214e['attributes'],function(_0x5dcbda){var _0x259527={};_0x259527[_0x5dcbda]={'$like':'%'+_0x1e3df4[_0x31a4('0x2d')][_0x31a4('0x38')]+'%'};return _0x259527;})});}_0x21214e=_[_0x31a4('0x39')]({},_0x21214e,_0x1e3df4[_0x31a4('0x3c')]);return _0x1f3f3d['getConditions'](_0x21214e);}})['then'](function(_0x556df9){if(_0x556df9){_0x45d897=_0x556df9[_0x31a4('0x33')];if(!_0x1e3df4[_0x31a4('0x2d')][_0x31a4('0x34')](_0x31a4('0x4e'))){_0x21214e['limit']=qs[_0x31a4('0x1c')](_0x1e3df4[_0x31a4('0x2d')]['limit']);_0x21214e[_0x31a4('0x1b')]=qs['offset'](_0x1e3df4[_0x31a4('0x2d')][_0x31a4('0x1b')]);}return _0x1f3f3d[_0x31a4('0x4b')](_0x21214e);}})[_0x31a4('0x23')](function(_0x550d39){if(_0x550d39){return _0x550d39?{'count':_0x45d897,'rows':_0x550d39}:null;}})[_0x31a4('0x23')](respondWithResult(_0x45bcd5,null))[_0x31a4('0x41')](handleError(_0x45bcd5,null));};exports[_0x31a4('0x4f')]=function(_0x14a61d,_0x4cf52e,_0x47683b){return db['Action'][_0x31a4('0x44')]({'where':{'id':_0x14a61d[_0x31a4('0x43')]['id']}})[_0x31a4('0x23')](handleEntityNotFound(_0x4cf52e,null))[_0x31a4('0x23')](function(_0x5efc30){if(_0x5efc30){return _0x5efc30[_0x31a4('0x4f')](_0x14a61d[_0x31a4('0x46')][_0x31a4('0x49')],_[_0x31a4('0x4a')](_0x14a61d['body'],[_0x31a4('0x49'),'id'])||{});}})['then'](respondWithResult(_0x4cf52e,null))[_0x31a4('0x41')](handleError(_0x4cf52e,null));};exports[_0x31a4('0x50')]=function(_0x151154,_0x374e95,_0x45f60f){var _0x5c603c={};var _0xee09d6={};var _0x2da7a2;var _0x4ec002;return db[_0x31a4('0x29')][_0x31a4('0x4c')]({'where':{'id':_0x151154[_0x31a4('0x43')]['id']}})[_0x31a4('0x23')](handleEntityNotFound(_0x374e95,null))[_0x31a4('0x23')](function(_0x3d8db1){if(_0x3d8db1){_0x2da7a2=_0x3d8db1;_0xee09d6[_0x31a4('0x2c')]=_[_0x31a4('0x2e')](db[_0x31a4('0x51')][_0x31a4('0x2a')]);_0xee09d6[_0x31a4('0x2d')]=_[_0x31a4('0x2e')](_0x151154[_0x31a4('0x2d')]);_0xee09d6[_0x31a4('0x2f')]=_[_0x31a4('0x30')](_0xee09d6[_0x31a4('0x2c')],_0xee09d6[_0x31a4('0x2d')]);_0x5c603c[_0x31a4('0x31')]=_[_0x31a4('0x30')](_0xee09d6[_0x31a4('0x2c')],qs[_0x31a4('0x32')](_0x151154[_0x31a4('0x2d')][_0x31a4('0x32')]));_0x5c603c['attributes']=_0x5c603c[_0x31a4('0x31')][_0x31a4('0x33')]?_0x5c603c[_0x31a4('0x31')]:_0xee09d6[_0x31a4('0x2c')];_0x5c603c[_0x31a4('0x35')]=qs[_0x31a4('0x36')](_0x151154[_0x31a4('0x2d')][_0x31a4('0x36')]);_0x5c603c['where']=qs[_0x31a4('0x2f')](_[_0x31a4('0x4d')](_0x151154['query'],_0xee09d6[_0x31a4('0x2f')]));if(_0x151154['query'][_0x31a4('0x38')]){_0x5c603c['where']=_['merge'](_0x5c603c['where'],{'$or':_[_0x31a4('0x28')](_0x5c603c[_0x31a4('0x31')],function(_0x3968a7){var _0x389b48={};_0x389b48[_0x3968a7]={'$like':'%'+_0x151154[_0x31a4('0x2d')][_0x31a4('0x38')]+'%'};return _0x389b48;})});}_0x5c603c=_['merge']({},_0x5c603c,_0x151154[_0x31a4('0x3c')]);return _0x2da7a2[_0x31a4('0x50')](_0x5c603c);}})[_0x31a4('0x23')](function(_0x1c4c12){if(_0x1c4c12){_0x4ec002=_0x1c4c12[_0x31a4('0x33')];if(!_0x151154['query'][_0x31a4('0x34')](_0x31a4('0x4e'))){_0x5c603c[_0x31a4('0x1c')]=qs['limit'](_0x151154[_0x31a4('0x2d')][_0x31a4('0x1c')]);_0x5c603c[_0x31a4('0x1b')]=qs[_0x31a4('0x1b')](_0x151154[_0x31a4('0x2d')][_0x31a4('0x1b')]);}return _0x2da7a2[_0x31a4('0x50')](_0x5c603c);}})[_0x31a4('0x23')](function(_0x46cd77){if(_0x46cd77){return _0x46cd77?{'count':_0x4ec002,'rows':_0x46cd77}:null;}})[_0x31a4('0x23')](respondWithResult(_0x374e95,null))[_0x31a4('0x41')](handleError(_0x374e95,null));}; \ No newline at end of file +var _0xf6f4=['name','send','index','map','Automation','rawAttributes','fieldName','key','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','destroy','Condition','ids','omit','getConditions','findOne','length','Action','find','getActions','rimraf','zip-dir','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','reject','save','update','then','end','error','stack'];(function(_0x133e8d,_0x4648f1){var _0x10ce55=function(_0x13e8bd){while(--_0x13e8bd){_0x133e8d['push'](_0x133e8d['shift']());}};_0x10ce55(++_0x4648f1);}(_0xf6f4,0x7e));var _0x4f6f=function(_0x33516c,_0x4a31c0){_0x33516c=_0x33516c-0x0;var _0x49d901=_0xf6f4[_0x33516c];return _0x49d901;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4f6f('0x0'));var zipdir=require(_0x4f6f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4f6f('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4f6f('0x3'));var util=require('util');var path=require(_0x4f6f('0x4'));var sox=require(_0x4f6f('0x5'));var csv=require(_0x4f6f('0x6'));var ejs=require(_0x4f6f('0x7'));var fs=require('fs');var fs_extra=require(_0x4f6f('0x8'));var _=require(_0x4f6f('0x9'));var squel=require('squel');var crypto=require(_0x4f6f('0xa'));var jsforce=require(_0x4f6f('0xb'));var deskjs=require(_0x4f6f('0xc'));var toCsv=require(_0x4f6f('0x6'));var querystring=require(_0x4f6f('0xd'));var Papa=require(_0x4f6f('0xe'));var Redis=require(_0x4f6f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4f6f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f6f('0x11'));var logger=require('../../config/logger')(_0x4f6f('0x12'));var utils=require(_0x4f6f('0x13'));var config=require(_0x4f6f('0x14'));var licenseUtil=require(_0x4f6f('0x15'));var db=require(_0x4f6f('0x16'))['db'];function respondWithStatusCode(_0x909807,_0x108a55){_0x108a55=_0x108a55||0xcc;return function(_0x4c7578){if(_0x4c7578){return _0x909807[_0x4f6f('0x17')](_0x108a55);}return _0x909807[_0x4f6f('0x18')](_0x108a55)['end']();};}function respondWithResult(_0xac9d26,_0x5dd246){_0x5dd246=_0x5dd246||0xc8;return function(_0x80cfdd){if(_0x80cfdd){return _0xac9d26[_0x4f6f('0x18')](_0x5dd246)[_0x4f6f('0x19')](_0x80cfdd);}};}function respondWithFilteredResult(_0x46a423,_0x1ea1be){return function(_0x59b91a){if(_0x59b91a){var _0x3252e4=typeof _0x1ea1be['offset']===_0x4f6f('0x1a')&&typeof _0x1ea1be[_0x4f6f('0x1b')]===_0x4f6f('0x1a');var _0x386621=_0x59b91a[_0x4f6f('0x1c')];var _0xf2a3f0=_0x3252e4?0x0:_0x1ea1be[_0x4f6f('0x1d')];var _0x228991=_0x3252e4?_0x59b91a[_0x4f6f('0x1c')]:_0x1ea1be[_0x4f6f('0x1d')]+_0x1ea1be[_0x4f6f('0x1b')];var _0x1bbcf3;if(_0x228991>=_0x386621){_0x228991=_0x386621;_0x1bbcf3=0xc8;}else{_0x1bbcf3=0xce;}_0x46a423['status'](_0x1bbcf3);return _0x46a423[_0x4f6f('0x1e')]('Content-Range',_0xf2a3f0+'-'+_0x228991+'/'+_0x386621)['json'](_0x59b91a);}return null;};}function patchUpdates(_0x101da9){return function(_0x5f33e1){try{jsonpatch['apply'](_0x5f33e1,_0x101da9,!![]);}catch(_0x194a02){return BPromise[_0x4f6f('0x1f')](_0x194a02);}return _0x5f33e1[_0x4f6f('0x20')]();};}function saveUpdates(_0x20b3c6,_0x86fe09){return function(_0x275a10){if(_0x275a10){return _0x275a10[_0x4f6f('0x21')](_0x20b3c6)[_0x4f6f('0x22')](function(_0x2491a6){return _0x2491a6;});}return null;};}function removeEntity(_0x1b011d,_0x246468){return function(_0x4953da){if(_0x4953da){return _0x4953da['destroy']()[_0x4f6f('0x22')](function(){_0x1b011d[_0x4f6f('0x18')](0xcc)[_0x4f6f('0x23')]();});}};}function handleEntityNotFound(_0x10f957,_0x41ab72){return function(_0x34af92){if(!_0x34af92){_0x10f957[_0x4f6f('0x17')](0x194);}return _0x34af92;};}function handleError(_0x2ab28b,_0xffe88e){_0xffe88e=_0xffe88e||0x1f4;return function(_0x477e11){logger[_0x4f6f('0x24')](_0x477e11[_0x4f6f('0x25')]);if(_0x477e11[_0x4f6f('0x26')]){delete _0x477e11['name'];}_0x2ab28b[_0x4f6f('0x18')](_0xffe88e)[_0x4f6f('0x27')](_0x477e11);};}exports[_0x4f6f('0x28')]=function(_0x44f278,_0x437404){var _0x244c10={},_0x5f48a7={},_0x4a5eb5={'count':0x0,'rows':[]};var _0x157d4f=_[_0x4f6f('0x29')](db[_0x4f6f('0x2a')][_0x4f6f('0x2b')],function(_0x15a515){return{'name':_0x15a515[_0x4f6f('0x2c')],'type':_0x15a515['type'][_0x4f6f('0x2d')]};});_0x5f48a7['model']=_[_0x4f6f('0x29')](_0x157d4f,_0x4f6f('0x26'));_0x5f48a7['query']=_['keys'](_0x44f278['query']);_0x5f48a7[_0x4f6f('0x2e')]=_[_0x4f6f('0x2f')](_0x5f48a7[_0x4f6f('0x30')],_0x5f48a7[_0x4f6f('0x31')]);_0x244c10[_0x4f6f('0x32')]=_[_0x4f6f('0x2f')](_0x5f48a7[_0x4f6f('0x30')],qs[_0x4f6f('0x33')](_0x44f278[_0x4f6f('0x31')][_0x4f6f('0x33')]));_0x244c10[_0x4f6f('0x32')]=_0x244c10[_0x4f6f('0x32')]['length']?_0x244c10['attributes']:_0x5f48a7[_0x4f6f('0x30')];if(!_0x44f278[_0x4f6f('0x31')][_0x4f6f('0x34')](_0x4f6f('0x35'))){_0x244c10[_0x4f6f('0x1b')]=qs['limit'](_0x44f278[_0x4f6f('0x31')]['limit']);_0x244c10[_0x4f6f('0x1d')]=qs['offset'](_0x44f278[_0x4f6f('0x31')]['offset']);}_0x244c10[_0x4f6f('0x36')]=qs['sort'](_0x44f278['query'][_0x4f6f('0x37')]);_0x244c10['where']=qs[_0x4f6f('0x2e')](_[_0x4f6f('0x38')](_0x44f278[_0x4f6f('0x31')],_0x5f48a7['filters']),_0x157d4f);if(_0x44f278[_0x4f6f('0x31')][_0x4f6f('0x39')]){_0x244c10[_0x4f6f('0x3a')]=_[_0x4f6f('0x3b')](_0x244c10[_0x4f6f('0x3a')],{'$or':_[_0x4f6f('0x29')](_0x157d4f,function(_0x1ee07d){if(_0x1ee07d[_0x4f6f('0x3c')]!=='VIRTUAL'){var _0x5ee576={};_0x5ee576[_0x1ee07d['name']]={'$like':'%'+_0x44f278[_0x4f6f('0x31')][_0x4f6f('0x39')]+'%'};return _0x5ee576;}})});}_0x244c10=_[_0x4f6f('0x3b')]({},_0x244c10,_0x44f278[_0x4f6f('0x3d')]);var _0x2c21ed={'where':_0x244c10[_0x4f6f('0x3a')]};return db[_0x4f6f('0x2a')]['count'](_0x2c21ed)['then'](function(_0x50fed1){_0x4a5eb5['count']=_0x50fed1;if(_0x44f278[_0x4f6f('0x31')][_0x4f6f('0x3e')]){_0x244c10[_0x4f6f('0x3f')]=[{'all':!![]}];}return db[_0x4f6f('0x2a')][_0x4f6f('0x40')](_0x244c10);})[_0x4f6f('0x22')](function(_0x535d4a){_0x4a5eb5[_0x4f6f('0x41')]=_0x535d4a;return _0x4a5eb5;})[_0x4f6f('0x22')](respondWithFilteredResult(_0x437404,_0x244c10))[_0x4f6f('0x42')](handleError(_0x437404,null));};exports[_0x4f6f('0x43')]=function(_0xd77523,_0xc4424b){var _0x378017={'raw':![],'where':{'id':_0xd77523[_0x4f6f('0x44')]['id']}},_0x3aef94={};_0x3aef94[_0x4f6f('0x30')]=_[_0x4f6f('0x45')](db['Automation'][_0x4f6f('0x2b')]);_0x3aef94[_0x4f6f('0x31')]=_['keys'](_0xd77523['query']);_0x3aef94[_0x4f6f('0x2e')]=_[_0x4f6f('0x2f')](_0x3aef94['model'],_0x3aef94[_0x4f6f('0x31')]);_0x378017[_0x4f6f('0x32')]=_[_0x4f6f('0x2f')](_0x3aef94['model'],qs[_0x4f6f('0x33')](_0xd77523['query'][_0x4f6f('0x33')]));_0x378017['attributes']=_0x378017[_0x4f6f('0x32')]['length']?_0x378017['attributes']:_0x3aef94[_0x4f6f('0x30')];if(_0xd77523[_0x4f6f('0x31')]['includeAll']){_0x378017[_0x4f6f('0x3f')]=[{'all':!![]}];}_0x378017=_[_0x4f6f('0x3b')]({},_0x378017,_0xd77523['options']);return db[_0x4f6f('0x2a')]['find'](_0x378017)[_0x4f6f('0x22')](handleEntityNotFound(_0xc4424b,null))[_0x4f6f('0x22')](respondWithResult(_0xc4424b,null))[_0x4f6f('0x42')](handleError(_0xc4424b,null));};exports[_0x4f6f('0x46')]=function(_0x1767e4,_0x36291c){return db[_0x4f6f('0x2a')][_0x4f6f('0x46')](_0x1767e4['body'],{})[_0x4f6f('0x22')](respondWithResult(_0x36291c,0xc9))[_0x4f6f('0x42')](handleError(_0x36291c,null));};exports['update']=function(_0x5182e0,_0xd61e8d){if(_0x5182e0[_0x4f6f('0x47')]['id']){delete _0x5182e0['body']['id'];}return db[_0x4f6f('0x2a')]['find']({'where':{'id':_0x5182e0[_0x4f6f('0x44')]['id']}})['then'](handleEntityNotFound(_0xd61e8d,null))[_0x4f6f('0x22')](saveUpdates(_0x5182e0[_0x4f6f('0x47')],null))['then'](respondWithResult(_0xd61e8d,null))[_0x4f6f('0x42')](handleError(_0xd61e8d,null));};exports[_0x4f6f('0x48')]=function(_0x220fb0,_0x34fff2){return db[_0x4f6f('0x2a')]['find']({'where':{'id':_0x220fb0[_0x4f6f('0x44')]['id']}})[_0x4f6f('0x22')](handleEntityNotFound(_0x34fff2,null))[_0x4f6f('0x22')](removeEntity(_0x34fff2,null))[_0x4f6f('0x42')](handleError(_0x34fff2,null));};exports['addConditions']=function(_0x324485,_0x3c1cd3,_0x4fa7b9){return db[_0x4f6f('0x49')]['find']({'where':{'id':_0x324485[_0x4f6f('0x44')]['id']}})['then'](handleEntityNotFound(_0x3c1cd3,null))[_0x4f6f('0x22')](function(_0x3910cf){if(_0x3910cf){return _0x3910cf['addConditions'](_0x324485[_0x4f6f('0x47')][_0x4f6f('0x4a')],_[_0x4f6f('0x4b')](_0x324485[_0x4f6f('0x47')],[_0x4f6f('0x4a'),'id'])||{});}})[_0x4f6f('0x22')](respondWithResult(_0x3c1cd3,null))[_0x4f6f('0x42')](handleError(_0x3c1cd3,null));};exports[_0x4f6f('0x4c')]=function(_0x1cd7c7,_0x92195c,_0x41fb71){var _0x1efb25={};var _0x16aa5={};var _0x40bcac;var _0x581aed;return db['Automation'][_0x4f6f('0x4d')]({'where':{'id':_0x1cd7c7[_0x4f6f('0x44')]['id']}})['then'](handleEntityNotFound(_0x92195c,null))['then'](function(_0xd9a41d){if(_0xd9a41d){_0x40bcac=_0xd9a41d;_0x16aa5[_0x4f6f('0x30')]=_[_0x4f6f('0x45')](db[_0x4f6f('0x49')][_0x4f6f('0x2b')]);_0x16aa5[_0x4f6f('0x31')]=_[_0x4f6f('0x45')](_0x1cd7c7[_0x4f6f('0x31')]);_0x16aa5[_0x4f6f('0x2e')]=_[_0x4f6f('0x2f')](_0x16aa5[_0x4f6f('0x30')],_0x16aa5['query']);_0x1efb25[_0x4f6f('0x32')]=_[_0x4f6f('0x2f')](_0x16aa5[_0x4f6f('0x30')],qs[_0x4f6f('0x33')](_0x1cd7c7[_0x4f6f('0x31')]['fields']));_0x1efb25['attributes']=_0x1efb25[_0x4f6f('0x32')][_0x4f6f('0x4e')]?_0x1efb25[_0x4f6f('0x32')]:_0x16aa5[_0x4f6f('0x30')];_0x1efb25[_0x4f6f('0x36')]=qs[_0x4f6f('0x37')](_0x1cd7c7[_0x4f6f('0x31')]['sort']);_0x1efb25['where']=qs['filters'](_[_0x4f6f('0x38')](_0x1cd7c7['query'],_0x16aa5[_0x4f6f('0x2e')]));if(_0x1cd7c7[_0x4f6f('0x31')]['filter']){_0x1efb25[_0x4f6f('0x3a')]=_[_0x4f6f('0x3b')](_0x1efb25[_0x4f6f('0x3a')],{'$or':_[_0x4f6f('0x29')](_0x1efb25[_0x4f6f('0x32')],function(_0x3ebf3f){var _0x467fa4={};_0x467fa4[_0x3ebf3f]={'$like':'%'+_0x1cd7c7[_0x4f6f('0x31')]['filter']+'%'};return _0x467fa4;})});}_0x1efb25=_['merge']({},_0x1efb25,_0x1cd7c7['options']);return _0x40bcac['getConditions'](_0x1efb25);}})[_0x4f6f('0x22')](function(_0x5f3938){if(_0x5f3938){_0x581aed=_0x5f3938['length'];if(!_0x1cd7c7[_0x4f6f('0x31')][_0x4f6f('0x34')]('nolimit')){_0x1efb25[_0x4f6f('0x1b')]=qs['limit'](_0x1cd7c7[_0x4f6f('0x31')]['limit']);_0x1efb25[_0x4f6f('0x1d')]=qs[_0x4f6f('0x1d')](_0x1cd7c7[_0x4f6f('0x31')]['offset']);}return _0x40bcac['getConditions'](_0x1efb25);}})[_0x4f6f('0x22')](function(_0x4ea4a1){if(_0x4ea4a1){return _0x4ea4a1?{'count':_0x581aed,'rows':_0x4ea4a1}:null;}})['then'](respondWithResult(_0x92195c,null))['catch'](handleError(_0x92195c,null));};exports['addActions']=function(_0x1fd48d,_0x282611,_0x33a075){return db[_0x4f6f('0x4f')][_0x4f6f('0x50')]({'where':{'id':_0x1fd48d[_0x4f6f('0x44')]['id']}})[_0x4f6f('0x22')](handleEntityNotFound(_0x282611,null))[_0x4f6f('0x22')](function(_0x1161d6){if(_0x1161d6){return _0x1161d6['addActions'](_0x1fd48d[_0x4f6f('0x47')]['ids'],_[_0x4f6f('0x4b')](_0x1fd48d[_0x4f6f('0x47')],[_0x4f6f('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x282611,null))[_0x4f6f('0x42')](handleError(_0x282611,null));};exports[_0x4f6f('0x51')]=function(_0x2b3713,_0x4d7269,_0x1f8110){var _0x5cae74={};var _0x5b8bdf={};var _0x395b10;var _0x53ad10;return db['Automation']['findOne']({'where':{'id':_0x2b3713[_0x4f6f('0x44')]['id']}})[_0x4f6f('0x22')](handleEntityNotFound(_0x4d7269,null))['then'](function(_0x29e5d9){if(_0x29e5d9){_0x395b10=_0x29e5d9;_0x5b8bdf['model']=_[_0x4f6f('0x45')](db[_0x4f6f('0x4f')][_0x4f6f('0x2b')]);_0x5b8bdf[_0x4f6f('0x31')]=_[_0x4f6f('0x45')](_0x2b3713[_0x4f6f('0x31')]);_0x5b8bdf[_0x4f6f('0x2e')]=_[_0x4f6f('0x2f')](_0x5b8bdf[_0x4f6f('0x30')],_0x5b8bdf[_0x4f6f('0x31')]);_0x5cae74['attributes']=_[_0x4f6f('0x2f')](_0x5b8bdf[_0x4f6f('0x30')],qs['fields'](_0x2b3713[_0x4f6f('0x31')]['fields']));_0x5cae74['attributes']=_0x5cae74[_0x4f6f('0x32')]['length']?_0x5cae74[_0x4f6f('0x32')]:_0x5b8bdf[_0x4f6f('0x30')];_0x5cae74[_0x4f6f('0x36')]=qs[_0x4f6f('0x37')](_0x2b3713[_0x4f6f('0x31')]['sort']);_0x5cae74[_0x4f6f('0x3a')]=qs['filters'](_[_0x4f6f('0x38')](_0x2b3713[_0x4f6f('0x31')],_0x5b8bdf['filters']));if(_0x2b3713[_0x4f6f('0x31')]['filter']){_0x5cae74[_0x4f6f('0x3a')]=_[_0x4f6f('0x3b')](_0x5cae74[_0x4f6f('0x3a')],{'$or':_[_0x4f6f('0x29')](_0x5cae74['attributes'],function(_0x2a43f7){var _0x17cefe={};_0x17cefe[_0x2a43f7]={'$like':'%'+_0x2b3713[_0x4f6f('0x31')][_0x4f6f('0x39')]+'%'};return _0x17cefe;})});}_0x5cae74=_[_0x4f6f('0x3b')]({},_0x5cae74,_0x2b3713['options']);return _0x395b10['getActions'](_0x5cae74);}})[_0x4f6f('0x22')](function(_0x297272){if(_0x297272){_0x53ad10=_0x297272[_0x4f6f('0x4e')];if(!_0x2b3713[_0x4f6f('0x31')][_0x4f6f('0x34')]('nolimit')){_0x5cae74[_0x4f6f('0x1b')]=qs['limit'](_0x2b3713[_0x4f6f('0x31')][_0x4f6f('0x1b')]);_0x5cae74[_0x4f6f('0x1d')]=qs['offset'](_0x2b3713['query'][_0x4f6f('0x1d')]);}return _0x395b10[_0x4f6f('0x51')](_0x5cae74);}})['then'](function(_0x3976fc){if(_0x3976fc){return _0x3976fc?{'count':_0x53ad10,'rows':_0x3976fc}:null;}})['then'](respondWithResult(_0x4d7269,null))[_0x4f6f('0x42')](handleError(_0x4d7269,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 43366d0..6373510 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 _0x8f94=['exports','define','Automation','lodash','util','api','request-promise','path','rimraf','../../config/environment','./automation.attributes'];(function(_0x366af1,_0x28ca1a){var _0x112627=function(_0xe0bebc){while(--_0xe0bebc){_0x366af1['push'](_0x366af1['shift']());}};_0x112627(++_0x28ca1a);}(_0x8f94,0x1bb));var _0x48f9=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x8f94[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x48f9('0x0'));var util=require(_0x48f9('0x1'));var logger=require('../../config/logger')(_0x48f9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x48f9('0x3'));var fs=require('fs');var path=require(_0x48f9('0x4'));var rimraf=require(_0x48f9('0x5'));var config=require(_0x48f9('0x6'));var attributes=require(_0x48f9('0x7'));module[_0x48f9('0x8')]=function(_0x515a81,_0x3f466f){return _0x515a81[_0x48f9('0x9')](_0x48f9('0xa'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x875a=['moment','bluebird','path','rimraf','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','api'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x875a,0x14d));var _0xa875=function(_0x570177,_0x356318){_0x570177=_0x570177-0x0;var _0x32f1f2=_0x875a[_0x570177];return _0x32f1f2;};'use strict';var _=require(_0xa875('0x0'));var util=require(_0xa875('0x1'));var logger=require('../../config/logger')(_0xa875('0x2'));var moment=require(_0xa875('0x3'));var BPromise=require(_0xa875('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa875('0x5'));var rimraf=require(_0xa875('0x6'));var config=require('../../config/environment');var attributes=require(_0xa875('0x7'));module[_0xa875('0x8')]=function(_0x3bd91a,_0x39c16c){return _0x3bd91a[_0xa875('0x9')](_0xa875('0xa'),attributes,{'tableName':_0xa875('0xb'),'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 294923d..1d29c2b 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 _0xad07=['util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x3062d3,_0x148b2f){var _0x388b0e=function(_0x233451){while(--_0x233451){_0x3062d3['push'](_0x3062d3['shift']());}};_0x388b0e(++_0x148b2f);}(_0xad07,0xe3));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7ad0('0x0'));var util=require(_0x7ad0('0x1'));var moment=require('moment');var BPromise=require(_0x7ad0('0x2'));var rs=require(_0x7ad0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7ad0('0x4'));var logger=require(_0x7ad0('0x5'))(_0x7ad0('0x6'));var config=require('../../config/environment');var jayson=require(_0x7ad0('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d09f9,_0x458ffd,_0x533282){return new BPromise(function(_0x50b4e7,_0x8684e2){return client[_0x7ad0('0x8')](_0x2d09f9,_0x533282)['then'](function(_0x5afa7c){logger[_0x7ad0('0x9')](_0x7ad0('0xa'),_0x458ffd,_0x7ad0('0xb'));logger['debug'](_0x7ad0('0xc'),_0x458ffd,_0x7ad0('0xb'),JSON[_0x7ad0('0xd')](_0x5afa7c));if(_0x5afa7c[_0x7ad0('0xe')]){if(_0x5afa7c[_0x7ad0('0xe')][_0x7ad0('0xf')]===0x1f4){logger[_0x7ad0('0xe')](_0x7ad0('0xa'),_0x458ffd,_0x5afa7c[_0x7ad0('0xe')]['message']);return _0x8684e2(_0x5afa7c[_0x7ad0('0xe')][_0x7ad0('0x10')]);}logger[_0x7ad0('0xe')](_0x7ad0('0xa'),_0x458ffd,_0x5afa7c['error']['message']);return _0x50b4e7(_0x5afa7c[_0x7ad0('0xe')][_0x7ad0('0x10')]);}else{logger[_0x7ad0('0x9')](_0x7ad0('0xa'),_0x458ffd,_0x7ad0('0xb'));_0x50b4e7(_0x5afa7c[_0x7ad0('0x11')][_0x7ad0('0x10')]);}})[_0x7ad0('0x12')](function(_0x52c802){logger[_0x7ad0('0xe')](_0x7ad0('0xa'),_0x458ffd,_0x52c802);_0x8684e2(_0x52c802);});});} \ No newline at end of file +var _0x937d=['rpc','jayson/promise','client','http','request','then','info','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Automation,\x20%s,\x20%s','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x137e50,_0x1a1c67){var _0x4a6360=function(_0x35dd55){while(--_0x35dd55){_0x137e50['push'](_0x137e50['shift']());}};_0x4a6360(++_0x1a1c67);}(_0x937d,0x1f4));var _0xd937=function(_0x2109f2,_0x3d5cbf){_0x2109f2=_0x2109f2-0x0;var _0x38e2d1=_0x937d[_0x2109f2];return _0x38e2d1;};'use strict';var _=require(_0xd937('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd937('0x1'));var fs=require('fs');var Redis=require(_0xd937('0x2'));var db=require(_0xd937('0x3'))['db'];var utils=require(_0xd937('0x4'));var logger=require(_0xd937('0x5'))(_0xd937('0x6'));var config=require('../../config/environment');var jayson=require(_0xd937('0x7'));var client=jayson[_0xd937('0x8')][_0xd937('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f6cd9,_0x2454f9,_0x4dc790){return new BPromise(function(_0x490b1d,_0x372dff){return client[_0xd937('0xa')](_0x4f6cd9,_0x4dc790)[_0xd937('0xb')](function(_0xa97338){logger[_0xd937('0xc')]('Automation,\x20%s,\x20%s',_0x2454f9,_0xd937('0xd'));logger['debug'](_0xd937('0xe'),_0x2454f9,'request\x20sent',JSON[_0xd937('0xf')](_0xa97338));if(_0xa97338[_0xd937('0x10')]){if(_0xa97338[_0xd937('0x10')][_0xd937('0x11')]===0x1f4){logger[_0xd937('0x10')]('Automation,\x20%s,\x20%s',_0x2454f9,_0xa97338[_0xd937('0x10')][_0xd937('0x12')]);return _0x372dff(_0xa97338[_0xd937('0x10')][_0xd937('0x12')]);}logger[_0xd937('0x10')](_0xd937('0x13'),_0x2454f9,_0xa97338[_0xd937('0x10')][_0xd937('0x12')]);return _0x490b1d(_0xa97338[_0xd937('0x10')][_0xd937('0x12')]);}else{logger['info'](_0xd937('0x13'),_0x2454f9,_0xd937('0xd'));_0x490b1d(_0xa97338[_0xd937('0x14')]['message']);}})[_0xd937('0x15')](function(_0x16d2ba){logger[_0xd937('0x10')]('Automation,\x20%s,\x20%s',_0x2454f9,_0x16d2ba);_0x372dff(_0x16d2ba);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 38f0345..26eb341 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 _0xc9df=['exports','util','path','connect-timeout','get','isAuthenticated','index','/:id','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','put','update','delete'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc9df,0x121));var _0xfc9d=function(_0x1b7541,_0x222c38){_0x1b7541=_0x1b7541-0x0;var _0x2b8e5a=_0xc9df[_0x1b7541];return _0x2b8e5a;};'use strict';var multer=require('multer');var util=require(_0xfc9d('0x0'));var path=require(_0xfc9d('0x1'));var timeout=require(_0xfc9d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./automation.controller');router[_0xfc9d('0x3')]('/',auth[_0xfc9d('0x4')](),controller[_0xfc9d('0x5')]);router[_0xfc9d('0x3')](_0xfc9d('0x6'),auth[_0xfc9d('0x4')](),controller['show']);router[_0xfc9d('0x3')](_0xfc9d('0x7'),auth[_0xfc9d('0x4')](),controller[_0xfc9d('0x8')]);router[_0xfc9d('0x3')](_0xfc9d('0x9'),auth[_0xfc9d('0x4')](),controller[_0xfc9d('0xa')]);router[_0xfc9d('0xb')]('/',auth[_0xfc9d('0x4')](),controller[_0xfc9d('0xc')]);router[_0xfc9d('0xb')](_0xfc9d('0x7'),auth[_0xfc9d('0x4')](),controller[_0xfc9d('0xd')]);router[_0xfc9d('0xb')]('/:id/actions',auth[_0xfc9d('0x4')](),controller['addActions']);router[_0xfc9d('0xe')]('/:id',auth[_0xfc9d('0x4')](),controller[_0xfc9d('0xf')]);router[_0xfc9d('0x10')](_0xfc9d('0x6'),auth[_0xfc9d('0x4')](),controller['destroy']);module[_0xfc9d('0x11')]=router; \ No newline at end of file +var _0x58ef=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','post','addConditions','/:id/actions','addActions','delete'];(function(_0x13ff53,_0x5e1424){var _0x290228=function(_0x3e3133){while(--_0x3e3133){_0x13ff53['push'](_0x13ff53['shift']());}};_0x290228(++_0x5e1424);}(_0x58ef,0x1ce));var _0xf58e=function(_0x4fdcff,_0x11a8d6){_0x4fdcff=_0x4fdcff-0x0;var _0x576122=_0x58ef[_0x4fdcff];return _0x576122;};'use strict';var multer=require(_0xf58e('0x0'));var util=require('util');var path=require(_0xf58e('0x1'));var timeout=require(_0xf58e('0x2'));var express=require(_0xf58e('0x3'));var router=express[_0xf58e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf58e('0x5'));var interaction=require(_0xf58e('0x6'));var config=require(_0xf58e('0x7'));var controller=require(_0xf58e('0x8'));router[_0xf58e('0x9')]('/',auth[_0xf58e('0xa')](),controller[_0xf58e('0xb')]);router[_0xf58e('0x9')](_0xf58e('0xc'),auth['isAuthenticated'](),controller[_0xf58e('0xd')]);router['get'](_0xf58e('0xe'),auth[_0xf58e('0xa')](),controller[_0xf58e('0xf')]);router[_0xf58e('0x9')]('/:id/actions',auth[_0xf58e('0xa')](),controller['getActions']);router[_0xf58e('0x10')]('/',auth[_0xf58e('0xa')](),controller['create']);router[_0xf58e('0x10')](_0xf58e('0xe'),auth[_0xf58e('0xa')](),controller[_0xf58e('0x11')]);router[_0xf58e('0x10')](_0xf58e('0x12'),auth[_0xf58e('0xa')](),controller[_0xf58e('0x13')]);router['put'](_0xf58e('0xc'),auth[_0xf58e('0xa')](),controller['update']);router[_0xf58e('0x14')](_0xf58e('0xc'),auth[_0xf58e('0xa')](),controller[_0xf58e('0x15')]);module[_0xf58e('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 147a20b..c02f565 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 _0x9632=['Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)'];(function(_0x30c38d,_0x4a57c4){var _0xd3d6b3=function(_0x5c359b){while(--_0x5c359b){_0x30c38d['push'](_0x30c38d['shift']());}};_0xd3d6b3(++_0x4a57c4);}(_0x9632,0x109));var _0x2963=function(_0x5d1c9d,_0x10c32b){_0x5d1c9d=_0x5d1c9d-0x0;var _0x182740=_0x9632[_0x5d1c9d];return _0x182740;};'use strict';var Sequelize=require(_0x2963('0x0'));module[_0x2963('0x1')]={'name':{'type':Sequelize[_0x2963('0x2')],'unique':_0x2963('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x2963('0x4')](_0x2963('0x5')),'allowNull':![],'defaultValue':_0x2963('0x5')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2963('0x6')},'limitCalls':{'type':Sequelize[_0x2963('0x7')](0x4)[_0x2963('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x2963('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x2963('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x2963('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x2963('0x7')](0x3)[_0x2963('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2963('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2963('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2963('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x2963('0x7')](0x3)[_0x2963('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x2963('0x7')](0x5)[_0x2963('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2963('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2963('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x2963('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2963('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2963('0xd')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2963('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x2963('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2963('0x2')],'defaultValue':_0x2963('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x2963('0x4')](_0x2963('0xf'),_0x2963('0x10'),_0x2963('0x11')),'defaultValue':_0x2963('0xf')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2963('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x2963('0x7')](0x9)[_0x2963('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x2963('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2963('0x7')](0x9)[_0x2963('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x2963('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2963('0x7')](0x9)[_0x2963('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2963('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0x2963('0x7')](0x9)[_0x2963('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2963('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x2963('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2963('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2963('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2963('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x2963('0x7')](0x9)[_0x2963('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2963('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x2963('0x4')]('DESC',_0x2963('0x19')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x2963('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x2963('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2963('0x1a')},'dialCutDigit':{'type':Sequelize[_0x2963('0x7')](0x3)[_0x2963('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2963('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x2963('0x7')](0x3)[_0x2963('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2963('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2963('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2963('0x1d')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2963('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x2963('0x7')](0x5)[_0x2963('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2963('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2963('0x7')](0x3)[_0x2963('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x2963('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2963('0x20')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2963('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2963('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x2963('0x7')](0x5)[_0x2963('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2963('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2963('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2963('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2963('0x7')](0x5)[_0x2963('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2963('0x24')}}; \ No newline at end of file +var _0xc26f=['#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ivr','STRING','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\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','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\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)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x28efcb,_0x976815){var _0x9fcee8=function(_0x46bd8a){while(--_0x46bd8a){_0x28efcb['push'](_0x28efcb['shift']());}};_0x9fcee8(++_0x976815);}(_0xc26f,0xdd));var _0xfc26=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xc26f[_0x2c7618];return _0x5ce3f0;};'use strict';var Sequelize=require(_0xfc26('0x0'));module[_0xfc26('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfc26('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':_0xfc26('0x3')},'description':{'type':Sequelize[_0xfc26('0x4')]},'active':{'type':Sequelize[_0xfc26('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xfc26('0x6')](0x4)[_0xfc26('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xfc26('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xfc26('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0xfc26('0x6')](0x3)[_0xfc26('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xfc26('0x6')](0x3)[_0xfc26('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfc26('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfc26('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xfc26('0x6')](0x3)[_0xfc26('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xfc26('0x6')](0x5)[_0xfc26('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xfc26('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xfc26('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfc26('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfc26('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xfc26('0x6')](0x3)[_0xfc26('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xfc26('0xd')},'dialTimezone':{'type':Sequelize[_0xfc26('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xfc26('0x4')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xfc26('0xe')](_0xfc26('0xf'),'never',_0xfc26('0x10')),'defaultValue':_0xfc26('0xf')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xfc26('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0xfc26('0x6')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xfc26('0x12')},'dialAMDGreeting':{'type':Sequelize[_0xfc26('0x6')](0x9)[_0xfc26('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xfc26('0x6')](0x9)[_0xfc26('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xfc26('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xfc26('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfc26('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0xfc26('0x6')](0x9)[_0xfc26('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xfc26('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xfc26('0x6')](0x9)[_0xfc26('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xfc26('0x6')](0x9)[_0xfc26('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xfc26('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xfc26('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xfc26('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfc26('0x17')},'dialOrderByScheduledAt':{'type':Sequelize[_0xfc26('0xe')](_0xfc26('0x18'),_0xfc26('0x19')),'defaultValue':_0xfc26('0x18')},'dialPrefix':{'type':Sequelize[_0xfc26('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xfc26('0x6')](0x3)[_0xfc26('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfc26('0x1a')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xfc26('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfc26('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xfc26('0x6')](0x3)[_0xfc26('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfc26('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xfc26('0x6')](0x5)[_0xfc26('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xfc26('0x6')](0x3)[_0xfc26('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfc26('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0xfc26('0x6')](0x5)[_0xfc26('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfc26('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfc26('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfc26('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xfc26('0x6')](0x5)[_0xfc26('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfc26('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0xfc26('0x6')](0x3)[_0xfc26('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfc26('0x21')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfc26('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfc26('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xfc26('0x6')](0x3)[_0xfc26('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xfc26('0x6')](0x5)[_0xfc26('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfc26('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 86d944a..a6d3231 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 _0xaf4c=['insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','field','NOW()','scheduledAt','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','toString','onlyIfOpen','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','removeLists','getBlackLists','CmList','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','all','removeBlackLists','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','save','update','destroy','then','get','IvrCampaigns','UserProfileResource','end','stack','name','send','index','Campaign','type','key','model','map','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','fields','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','error','getHoppers','CmHopper','order','CampaignId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','format','addLists','ids','spread','dialCheckDuplicateType','always'];(function(_0x7c231a,_0x23595c){var _0x33fcaa=function(_0x1708a2){while(--_0x1708a2){_0x7c231a['push'](_0x7c231a['shift']());}};_0x33fcaa(++_0x23595c);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0x2aa517,_0x438f4e){_0x2aa517=_0x2aa517-0x0;var _0xe57d50=_0xaf4c[_0x2aa517];return _0xe57d50;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcaf4('0x0'));var zipdir=require(_0xcaf4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcaf4('0x2'));var moment=require(_0xcaf4('0x3'));var BPromise=require(_0xcaf4('0x4'));var Mustache=require('mustache');var util=require(_0xcaf4('0x5'));var path=require(_0xcaf4('0x6'));var sox=require(_0xcaf4('0x7'));var csv=require('to-csv');var ejs=require(_0xcaf4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcaf4('0x9'));var squel=require(_0xcaf4('0xa'));var crypto=require(_0xcaf4('0xb'));var jsforce=require(_0xcaf4('0xc'));var deskjs=require(_0xcaf4('0xd'));var toCsv=require(_0xcaf4('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcaf4('0xf'));var authService=require(_0xcaf4('0x10'));var qs=require(_0xcaf4('0x11'));var as=require(_0xcaf4('0x12'));var hardwareService=require(_0xcaf4('0x13'));var logger=require(_0xcaf4('0x14'))(_0xcaf4('0x15'));var utils=require(_0xcaf4('0x16'));var config=require(_0xcaf4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcaf4('0x18'))['db'];function respondWithStatusCode(_0x41486c,_0x4d270c){_0x4d270c=_0x4d270c||0xcc;return function(_0x308173){if(_0x308173){return _0x41486c[_0xcaf4('0x19')](_0x4d270c);}return _0x41486c[_0xcaf4('0x1a')](_0x4d270c)['end']();};}function respondWithResult(_0x3738b7,_0x2ad48b){_0x2ad48b=_0x2ad48b||0xc8;return function(_0x593c44){if(_0x593c44){return _0x3738b7[_0xcaf4('0x1a')](_0x2ad48b)['json'](_0x593c44);}};}function respondWithFilteredResult(_0x2a1243,_0x191f38){return function(_0x67532a){if(_0x67532a){var _0x1ec93e=typeof _0x191f38[_0xcaf4('0x1b')]===_0xcaf4('0x1c')&&typeof _0x191f38['limit']===_0xcaf4('0x1c');var _0x488bac=_0x67532a[_0xcaf4('0x1d')];var _0x5bb3b5=_0x1ec93e?0x0:_0x191f38[_0xcaf4('0x1b')];var _0x36c34c=_0x1ec93e?_0x67532a[_0xcaf4('0x1d')]:_0x191f38['offset']+_0x191f38['limit'];var _0x1ddae3;if(_0x36c34c>=_0x488bac){_0x36c34c=_0x488bac;_0x1ddae3=0xc8;}else{_0x1ddae3=0xce;}_0x2a1243[_0xcaf4('0x1a')](_0x1ddae3);return _0x2a1243[_0xcaf4('0x1e')](_0xcaf4('0x1f'),_0x5bb3b5+'-'+_0x36c34c+'/'+_0x488bac)[_0xcaf4('0x20')](_0x67532a);}return null;};}function patchUpdates(_0x596997){return function(_0x42d129){try{jsonpatch[_0xcaf4('0x21')](_0x42d129,_0x596997,!![]);}catch(_0x3f6172){return BPromise['reject'](_0x3f6172);}return _0x42d129[_0xcaf4('0x22')]();};}function saveUpdates(_0x2b500b,_0x39ff5d){return function(_0x5b6525){if(_0x5b6525){return _0x5b6525[_0xcaf4('0x23')](_0x2b500b)['then'](function(_0x2be740){return _0x2be740;});}return null;};}function removeEntity(_0x3fb28a,_0x1d9f77){return function(_0x5e4af3){if(_0x5e4af3){return _0x5e4af3[_0xcaf4('0x24')]()[_0xcaf4('0x25')](function(){var _0x116349=_0x5e4af3[_0xcaf4('0x26')]({'plain':!![]});var _0x4c3485=_0xcaf4('0x27');return db[_0xcaf4('0x28')]['destroy']({'where':{'type':_0x4c3485,'resourceId':_0x116349['id']}})[_0xcaf4('0x25')](function(){return _0x5e4af3;});})[_0xcaf4('0x25')](function(){_0x3fb28a[_0xcaf4('0x1a')](0xcc)[_0xcaf4('0x29')]();});}};}function handleEntityNotFound(_0x25beed,_0x1dbe80){return function(_0x10765c){if(!_0x10765c){_0x25beed['sendStatus'](0x194);}return _0x10765c;};}function handleError(_0x4183e2,_0x16b3b8){_0x16b3b8=_0x16b3b8||0x1f4;return function(_0x237077){logger['error'](_0x237077[_0xcaf4('0x2a')]);if(_0x237077[_0xcaf4('0x2b')]){delete _0x237077[_0xcaf4('0x2b')];}_0x4183e2[_0xcaf4('0x1a')](_0x16b3b8)[_0xcaf4('0x2c')](_0x237077);};}exports[_0xcaf4('0x2d')]=function(_0x31322d,_0x52ee2a){var _0x8126a7={},_0x5c355e={},_0x5af341={'count':0x0,'rows':[]};var _0x6f6cae=_['map'](db[_0xcaf4('0x2e')]['rawAttributes'],function(_0xf616c7){return{'name':_0xf616c7['fieldName'],'type':_0xf616c7[_0xcaf4('0x2f')][_0xcaf4('0x30')]};});_0x5c355e[_0xcaf4('0x31')]=_[_0xcaf4('0x32')](_0x6f6cae,_0xcaf4('0x2b'));_0x5c355e[_0xcaf4('0x33')]=_[_0xcaf4('0x34')](_0x31322d[_0xcaf4('0x33')]);_0x5c355e['filters']=_[_0xcaf4('0x35')](_0x5c355e[_0xcaf4('0x31')],_0x5c355e[_0xcaf4('0x33')]);_0x8126a7[_0xcaf4('0x36')]=_[_0xcaf4('0x35')](_0x5c355e['model'],qs['fields'](_0x31322d['query']['fields']));_0x8126a7['attributes']=_0x8126a7[_0xcaf4('0x36')][_0xcaf4('0x37')]?_0x8126a7[_0xcaf4('0x36')]:_0x5c355e['model'];if(!_0x31322d[_0xcaf4('0x33')][_0xcaf4('0x38')](_0xcaf4('0x39'))){_0x8126a7[_0xcaf4('0x3a')]=qs['limit'](_0x31322d['query']['limit']);_0x8126a7['offset']=qs['offset'](_0x31322d[_0xcaf4('0x33')][_0xcaf4('0x1b')]);}_0x8126a7['order']=qs[_0xcaf4('0x3b')](_0x31322d[_0xcaf4('0x33')]['sort']);_0x8126a7[_0xcaf4('0x3c')]=qs[_0xcaf4('0x3d')](_[_0xcaf4('0x3e')](_0x31322d['query'],_0x5c355e['filters']),_0x6f6cae);if(_0x31322d[_0xcaf4('0x33')][_0xcaf4('0x3f')]){_0x8126a7[_0xcaf4('0x3c')]=_[_0xcaf4('0x40')](_0x8126a7['where'],{'$or':_[_0xcaf4('0x32')](_0x6f6cae,function(_0x23c725){if(_0x23c725[_0xcaf4('0x2f')]!=='VIRTUAL'){var _0x3c4d63={};_0x3c4d63[_0x23c725[_0xcaf4('0x2b')]]={'$like':'%'+_0x31322d[_0xcaf4('0x33')][_0xcaf4('0x3f')]+'%'};return _0x3c4d63;}})});}_0x8126a7=_[_0xcaf4('0x40')]({},_0x8126a7,_0x31322d[_0xcaf4('0x41')]);var _0x4dccd1={'where':_0x8126a7['where']};return db[_0xcaf4('0x2e')][_0xcaf4('0x1d')](_0x4dccd1)['then'](function(_0xda0fde){_0x5af341[_0xcaf4('0x1d')]=_0xda0fde;if(_0x31322d[_0xcaf4('0x33')][_0xcaf4('0x42')]){_0x8126a7[_0xcaf4('0x43')]=[{'all':!![]}];}return db['Campaign'][_0xcaf4('0x44')](_0x8126a7);})[_0xcaf4('0x25')](function(_0x340566){_0x5af341[_0xcaf4('0x45')]=_0x340566;return _0x5af341;})[_0xcaf4('0x25')](respondWithFilteredResult(_0x52ee2a,_0x8126a7))['catch'](handleError(_0x52ee2a,null));};exports[_0xcaf4('0x46')]=function(_0x35962e,_0x26c963){var _0x5bc6e2={'raw':![],'where':{'id':_0x35962e[_0xcaf4('0x47')]['id']}},_0x34d8ea={};_0x34d8ea['model']=_[_0xcaf4('0x34')](db[_0xcaf4('0x2e')][_0xcaf4('0x48')]);_0x34d8ea['query']=_[_0xcaf4('0x34')](_0x35962e[_0xcaf4('0x33')]);_0x34d8ea[_0xcaf4('0x3d')]=_[_0xcaf4('0x35')](_0x34d8ea[_0xcaf4('0x31')],_0x34d8ea[_0xcaf4('0x33')]);_0x5bc6e2[_0xcaf4('0x36')]=_['intersection'](_0x34d8ea[_0xcaf4('0x31')],qs[_0xcaf4('0x49')](_0x35962e[_0xcaf4('0x33')][_0xcaf4('0x49')]));_0x5bc6e2[_0xcaf4('0x36')]=_0x5bc6e2[_0xcaf4('0x36')][_0xcaf4('0x37')]?_0x5bc6e2[_0xcaf4('0x36')]:_0x34d8ea[_0xcaf4('0x31')];if(_0x35962e['query']['includeAll']){_0x5bc6e2[_0xcaf4('0x43')]=[{'all':!![]}];}_0x5bc6e2=_[_0xcaf4('0x40')]({},_0x5bc6e2,_0x35962e[_0xcaf4('0x41')]);return db[_0xcaf4('0x2e')]['find'](_0x5bc6e2)['then'](handleEntityNotFound(_0x26c963,null))[_0xcaf4('0x25')](respondWithResult(_0x26c963,null))[_0xcaf4('0x4a')](handleError(_0x26c963,null));};exports['create']=function(_0x179d26,_0x37a2ba){return db[_0xcaf4('0x2e')][_0xcaf4('0x4b')](_0x179d26[_0xcaf4('0x4c')],{})[_0xcaf4('0x25')](function(_0x6efd8d){var _0x3f32a5=_0x179d26['user']['get']({'plain':!![]});if(!_0x3f32a5)throw new Error(_0xcaf4('0x4d'));if(_0x3f32a5[_0xcaf4('0x4e')]===_0xcaf4('0x4f')){var _0x4f2e01=_0x6efd8d[_0xcaf4('0x26')]({'plain':!![]});var _0x2d35be='IvrCampaigns';return db[_0xcaf4('0x50')][_0xcaf4('0x51')]({'where':{'name':_0x2d35be,'userProfileId':_0x3f32a5[_0xcaf4('0x52')]},'raw':!![]})[_0xcaf4('0x25')](function(_0x403922){if(_0x403922&&_0x403922[_0xcaf4('0x53')]===0x0){return db['UserProfileResource'][_0xcaf4('0x4b')]({'name':_0x4f2e01[_0xcaf4('0x2b')],'resourceId':_0x4f2e01['id'],'type':_0x403922['name'],'sectionId':_0x403922['id']},{})[_0xcaf4('0x25')](function(){return _0x6efd8d;});}else{return _0x6efd8d;}})['catch'](function(_0x51c928){logger['error'](_0xcaf4('0x54'),_0x51c928);throw _0x51c928;});}return _0x6efd8d;})[_0xcaf4('0x25')](respondWithResult(_0x37a2ba,0xc9))[_0xcaf4('0x4a')](handleError(_0x37a2ba,null));};exports[_0xcaf4('0x55')]=function(_0x35de1f,_0x2b1ee7){var _0x5d5b92={'where':{'id':_0x35de1f[_0xcaf4('0x47')]['id']}},_0x561864={};_0x561864[_0xcaf4('0x31')]=_['keys'](db[_0xcaf4('0x2e')][_0xcaf4('0x48')]);_0x5d5b92[_0xcaf4('0x36')]=_[_0xcaf4('0x35')](_0x561864[_0xcaf4('0x31')],qs[_0xcaf4('0x49')](_0x35de1f['query'][_0xcaf4('0x49')]));_0x5d5b92['attributes']=_0x5d5b92['attributes'][_0xcaf4('0x37')]?_0x5d5b92['attributes']:_0x561864[_0xcaf4('0x31')];if(_0x35de1f['query'][_0xcaf4('0x42')]){_0x5d5b92[_0xcaf4('0x43')]=[{'all':!![]}];}_0x5d5b92=_[_0xcaf4('0x40')]({},_0x5d5b92,_0x35de1f['options']);return db[_0xcaf4('0x2e')][_0xcaf4('0x51')](_0x5d5b92)[_0xcaf4('0x25')](handleEntityNotFound(_0x2b1ee7,null))[_0xcaf4('0x25')](function(_0x3ead01){if(_0x3ead01){var _0xae6cbc=_0x3ead01[_0xcaf4('0x26')]({'plain':!![]});_0xae6cbc=qs[_0xcaf4('0x56')](_0xae6cbc,['id',_0xcaf4('0x57'),'updatedAt']);_0x35de1f[_0xcaf4('0x4c')]=_['omit'](_0x35de1f[_0xcaf4('0x4c')],['id',_0xcaf4('0x57'),_0xcaf4('0x58')]);return db[_0xcaf4('0x2e')][_0xcaf4('0x4b')](_[_0xcaf4('0x40')](_0xae6cbc,_0x35de1f[_0xcaf4('0x4c')]),{'include':_0x35de1f[_0xcaf4('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0xcaf4('0x25')](function(_0x20448){var _0xb26e05=_0x35de1f[_0xcaf4('0x4f')][_0xcaf4('0x26')]({'plain':!![]});if(!_0xb26e05)throw new Error(_0xcaf4('0x4d'));if(_0xb26e05[_0xcaf4('0x4e')]===_0xcaf4('0x4f')){var _0x568e8c=_0x20448[_0xcaf4('0x26')]({'plain':!![]});var _0x386f09=_0xcaf4('0x27');return db[_0xcaf4('0x50')][_0xcaf4('0x51')]({'where':{'name':_0x386f09,'userProfileId':_0xb26e05[_0xcaf4('0x52')]},'raw':!![]})[_0xcaf4('0x25')](function(_0x2449d8){if(_0x2449d8&&_0x2449d8[_0xcaf4('0x53')]===0x0){return db[_0xcaf4('0x28')][_0xcaf4('0x4b')]({'name':_0x568e8c[_0xcaf4('0x2b')],'resourceId':_0x568e8c['id'],'type':_0x2449d8['name'],'sectionId':_0x2449d8['id']},{})[_0xcaf4('0x25')](function(){return _0x20448;});}else{return _0x20448;}})[_0xcaf4('0x4a')](function(_0x1b000b){logger[_0xcaf4('0x59')](_0xcaf4('0x54'),_0x1b000b);throw _0x1b000b;});}return _0x20448;});}})['then'](respondWithResult(_0x2b1ee7,0xc9))[_0xcaf4('0x4a')](handleError(_0x2b1ee7,null));};exports[_0xcaf4('0x23')]=function(_0x429b7a,_0x1a6f19){if(_0x429b7a[_0xcaf4('0x4c')]['id']){delete _0x429b7a['body']['id'];}return db['Campaign'][_0xcaf4('0x51')]({'where':{'id':_0x429b7a[_0xcaf4('0x47')]['id']}})[_0xcaf4('0x25')](handleEntityNotFound(_0x1a6f19,null))['then'](saveUpdates(_0x429b7a[_0xcaf4('0x4c')],null))[_0xcaf4('0x25')](respondWithResult(_0x1a6f19,null))['catch'](handleError(_0x1a6f19,null));};exports[_0xcaf4('0x24')]=function(_0x4b50e0,_0x3e6417){return db['Campaign'][_0xcaf4('0x51')]({'where':{'id':_0x4b50e0[_0xcaf4('0x47')]['id']}})['then'](handleEntityNotFound(_0x3e6417,null))[_0xcaf4('0x25')](removeEntity(_0x3e6417,null))['catch'](handleError(_0x3e6417,null));};exports[_0xcaf4('0x5a')]=function(_0x29eede,_0x23cac1,_0x5483e0){var _0x43a6a8={'raw':!![],'where':{}};var _0x492310={};var _0x435b23={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x29eede['params']['id']}})[_0xcaf4('0x25')](handleEntityNotFound(_0x23cac1,null))[_0xcaf4('0x25')](function(_0x3c00b1){if(_0x3c00b1){_0x492310['model']=_[_0xcaf4('0x34')](db[_0xcaf4('0x5b')][_0xcaf4('0x48')]);_0x492310[_0xcaf4('0x33')]=_[_0xcaf4('0x34')](_0x29eede['query']);_0x492310['filters']=_[_0xcaf4('0x35')](_0x492310[_0xcaf4('0x31')],_0x492310[_0xcaf4('0x33')]);_0x43a6a8[_0xcaf4('0x36')]=_['intersection'](_0x492310[_0xcaf4('0x31')],qs[_0xcaf4('0x49')](_0x29eede[_0xcaf4('0x33')][_0xcaf4('0x49')]));_0x43a6a8[_0xcaf4('0x36')]=_0x43a6a8['attributes'][_0xcaf4('0x37')]?_0x43a6a8[_0xcaf4('0x36')]:_0x492310['model'];if(!_0x29eede[_0xcaf4('0x33')]['hasOwnProperty']('nolimit')){_0x43a6a8[_0xcaf4('0x3a')]=qs[_0xcaf4('0x3a')](_0x29eede[_0xcaf4('0x33')][_0xcaf4('0x3a')]);_0x43a6a8[_0xcaf4('0x1b')]=qs[_0xcaf4('0x1b')](_0x29eede[_0xcaf4('0x33')][_0xcaf4('0x1b')]);}_0x43a6a8[_0xcaf4('0x5c')]=qs['sort'](_0x29eede[_0xcaf4('0x33')][_0xcaf4('0x3b')]);_0x43a6a8['where']=qs[_0xcaf4('0x3d')](_[_0xcaf4('0x3e')](_0x29eede[_0xcaf4('0x33')],_0x492310[_0xcaf4('0x3d')]));_0x43a6a8[_0xcaf4('0x3c')][_0xcaf4('0x5d')]=_0x3c00b1['id'];if(_0x29eede['query'][_0xcaf4('0x3f')]){_0x43a6a8[_0xcaf4('0x3c')]=_[_0xcaf4('0x40')](_0x43a6a8[_0xcaf4('0x3c')],{'$or':_['map'](_0x43a6a8['attributes'],function(_0x418b8f){var _0x3c0a35={};_0x3c0a35[_0x418b8f]={'$like':'%'+_0x29eede[_0xcaf4('0x33')][_0xcaf4('0x3f')]+'%'};return _0x3c0a35;})});}_0x43a6a8=_[_0xcaf4('0x40')]({},_0x43a6a8,_0x29eede['options']);return db[_0xcaf4('0x5b')]['count']({'where':_0x43a6a8[_0xcaf4('0x3c')]})[_0xcaf4('0x25')](function(_0x207eb0){_0x435b23['count']=_0x207eb0;if(_0x29eede[_0xcaf4('0x33')][_0xcaf4('0x42')]){_0x43a6a8[_0xcaf4('0x43')]=[{'all':!![]}];}return db[_0xcaf4('0x5b')][_0xcaf4('0x44')](_0x43a6a8);})[_0xcaf4('0x25')](function(_0xe0196f){_0x435b23[_0xcaf4('0x45')]=_0xe0196f;return _0x435b23;});}})[_0xcaf4('0x25')](respondWithFilteredResult(_0x23cac1,_0x43a6a8))[_0xcaf4('0x4a')](handleError(_0x23cac1,null));};exports[_0xcaf4('0x5e')]=function(_0x2cc17d,_0x46f320,_0x59d266){var _0x149e4a={'raw':!![],'where':{}};var _0x1ecdb6={};var _0x4d7668={'count':0x0,'rows':[]};return db[_0xcaf4('0x2e')][_0xcaf4('0x5f')]({'where':{'id':_0x2cc17d['params']['id']}})['then'](handleEntityNotFound(_0x46f320,null))[_0xcaf4('0x25')](function(_0x21644f){if(_0x21644f){_0x1ecdb6[_0xcaf4('0x31')]=_['keys'](db[_0xcaf4('0x60')][_0xcaf4('0x48')]);_0x1ecdb6[_0xcaf4('0x33')]=_[_0xcaf4('0x34')](_0x2cc17d[_0xcaf4('0x33')]);_0x1ecdb6[_0xcaf4('0x3d')]=_[_0xcaf4('0x35')](_0x1ecdb6[_0xcaf4('0x31')],_0x1ecdb6[_0xcaf4('0x33')]);_0x149e4a[_0xcaf4('0x36')]=_[_0xcaf4('0x35')](_0x1ecdb6[_0xcaf4('0x31')],qs['fields'](_0x2cc17d[_0xcaf4('0x33')][_0xcaf4('0x49')]));_0x149e4a[_0xcaf4('0x36')]=_0x149e4a[_0xcaf4('0x36')][_0xcaf4('0x37')]?_0x149e4a[_0xcaf4('0x36')]:_0x1ecdb6[_0xcaf4('0x31')];if(!_0x2cc17d[_0xcaf4('0x33')][_0xcaf4('0x38')](_0xcaf4('0x39'))){_0x149e4a[_0xcaf4('0x3a')]=qs[_0xcaf4('0x3a')](_0x2cc17d[_0xcaf4('0x33')][_0xcaf4('0x3a')]);_0x149e4a[_0xcaf4('0x1b')]=qs[_0xcaf4('0x1b')](_0x2cc17d['query']['offset']);}_0x149e4a['order']=qs[_0xcaf4('0x3b')](_0x2cc17d['query'][_0xcaf4('0x3b')]);_0x149e4a['where']=qs[_0xcaf4('0x3d')](_[_0xcaf4('0x3e')](_0x2cc17d[_0xcaf4('0x33')],_0x1ecdb6['filters']));_0x149e4a[_0xcaf4('0x3c')][_0xcaf4('0x5d')]=_0x21644f['id'];if(_0x2cc17d[_0xcaf4('0x33')][_0xcaf4('0x3f')]){_0x149e4a['where']=_[_0xcaf4('0x40')](_0x149e4a[_0xcaf4('0x3c')],{'$or':_[_0xcaf4('0x32')](_0x149e4a[_0xcaf4('0x36')],function(_0x55dbdd){var _0x3cf7ea={};_0x3cf7ea[_0x55dbdd]={'$like':'%'+_0x2cc17d['query'][_0xcaf4('0x3f')]+'%'};return _0x3cf7ea;})});}_0x149e4a=_['merge']({},_0x149e4a,_0x2cc17d[_0xcaf4('0x41')]);return db[_0xcaf4('0x60')][_0xcaf4('0x1d')]({'where':_0x149e4a[_0xcaf4('0x3c')]})[_0xcaf4('0x25')](function(_0x176a40){_0x4d7668['count']=_0x176a40;if(_0x2cc17d[_0xcaf4('0x33')][_0xcaf4('0x42')]){_0x149e4a['include']=[{'all':!![]}];}return db[_0xcaf4('0x60')][_0xcaf4('0x44')](_0x149e4a);})[_0xcaf4('0x25')](function(_0x15db07){_0x4d7668[_0xcaf4('0x45')]=_0x15db07;return _0x4d7668;});}})['then'](respondWithFilteredResult(_0x46f320,_0x149e4a))[_0xcaf4('0x4a')](handleError(_0x46f320,null));};exports[_0xcaf4('0x61')]=function(_0x1b8535,_0x2fa962,_0x1750b6){var _0x5b2008={'raw':!![],'where':{}};var _0xe12ec9={};var _0x381b84={'count':0x0,'rows':[]};return db[_0xcaf4('0x2e')]['findOne']({'where':{'id':_0x1b8535[_0xcaf4('0x47')]['id']}})[_0xcaf4('0x25')](handleEntityNotFound(_0x2fa962,null))[_0xcaf4('0x25')](function(_0x3bdf46){if(_0x3bdf46){_0xe12ec9[_0xcaf4('0x31')]=_['keys'](db[_0xcaf4('0x62')][_0xcaf4('0x48')]);_0xe12ec9[_0xcaf4('0x33')]=_['keys'](_0x1b8535[_0xcaf4('0x33')]);_0xe12ec9['filters']=_['intersection'](_0xe12ec9[_0xcaf4('0x31')],_0xe12ec9[_0xcaf4('0x33')]);_0x5b2008[_0xcaf4('0x36')]=_[_0xcaf4('0x35')](_0xe12ec9[_0xcaf4('0x31')],qs[_0xcaf4('0x49')](_0x1b8535['query'][_0xcaf4('0x49')]));_0x5b2008[_0xcaf4('0x36')]=_0x5b2008[_0xcaf4('0x36')]['length']?_0x5b2008[_0xcaf4('0x36')]:_0xe12ec9[_0xcaf4('0x31')];if(!_0x1b8535[_0xcaf4('0x33')][_0xcaf4('0x38')](_0xcaf4('0x39'))){_0x5b2008[_0xcaf4('0x3a')]=qs[_0xcaf4('0x3a')](_0x1b8535['query'][_0xcaf4('0x3a')]);_0x5b2008[_0xcaf4('0x1b')]=qs[_0xcaf4('0x1b')](_0x1b8535[_0xcaf4('0x33')]['offset']);}_0x5b2008[_0xcaf4('0x5c')]=qs[_0xcaf4('0x3b')](_0x1b8535[_0xcaf4('0x33')][_0xcaf4('0x3b')]);_0x5b2008['where']=qs[_0xcaf4('0x3d')](_['pick'](_0x1b8535[_0xcaf4('0x33')],_0xe12ec9['filters']));_0x5b2008[_0xcaf4('0x3c')]['CampaignId']=_0x3bdf46['id'];if(_0x1b8535[_0xcaf4('0x33')][_0xcaf4('0x3f')]){_0x5b2008[_0xcaf4('0x3c')]=_[_0xcaf4('0x40')](_0x5b2008[_0xcaf4('0x3c')],{'$or':_['map'](_0x5b2008[_0xcaf4('0x36')],function(_0x4bd8a2){var _0x90f42e={};_0x90f42e[_0x4bd8a2]={'$like':'%'+_0x1b8535[_0xcaf4('0x33')]['filter']+'%'};return _0x90f42e;})});}_0x5b2008=_[_0xcaf4('0x40')]({},_0x5b2008,_0x1b8535[_0xcaf4('0x41')]);return db[_0xcaf4('0x62')][_0xcaf4('0x1d')]({'where':_0x5b2008['where']})[_0xcaf4('0x25')](function(_0x4edae1){_0x381b84[_0xcaf4('0x1d')]=_0x4edae1;if(_0x1b8535[_0xcaf4('0x33')][_0xcaf4('0x42')]){_0x5b2008[_0xcaf4('0x43')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xcaf4('0x44')](_0x5b2008);})[_0xcaf4('0x25')](function(_0x530431){_0x381b84[_0xcaf4('0x45')]=_0x530431;return _0x381b84;});}})[_0xcaf4('0x25')](respondWithFilteredResult(_0x2fa962,_0x5b2008))[_0xcaf4('0x4a')](handleError(_0x2fa962,null));};exports['getHopperBlacks']=function(_0x138958,_0x431e0e,_0x402f02){var _0xc96ebc={'raw':!![],'where':{}};var _0x2cd15b={};var _0x54d692={'count':0x0,'rows':[]};return db[_0xcaf4('0x2e')]['findOne']({'where':{'id':_0x138958[_0xcaf4('0x47')]['id']}})['then'](handleEntityNotFound(_0x431e0e,null))[_0xcaf4('0x25')](function(_0x252da0){if(_0x252da0){_0x2cd15b[_0xcaf4('0x31')]=_['keys'](db['CmHopperBlack'][_0xcaf4('0x48')]);_0x2cd15b['query']=_[_0xcaf4('0x34')](_0x138958[_0xcaf4('0x33')]);_0x2cd15b['filters']=_['intersection'](_0x2cd15b['model'],_0x2cd15b[_0xcaf4('0x33')]);_0xc96ebc[_0xcaf4('0x36')]=_[_0xcaf4('0x35')](_0x2cd15b[_0xcaf4('0x31')],qs['fields'](_0x138958[_0xcaf4('0x33')][_0xcaf4('0x49')]));_0xc96ebc[_0xcaf4('0x36')]=_0xc96ebc['attributes'][_0xcaf4('0x37')]?_0xc96ebc[_0xcaf4('0x36')]:_0x2cd15b['model'];if(!_0x138958[_0xcaf4('0x33')][_0xcaf4('0x38')](_0xcaf4('0x39'))){_0xc96ebc[_0xcaf4('0x3a')]=qs['limit'](_0x138958['query'][_0xcaf4('0x3a')]);_0xc96ebc['offset']=qs[_0xcaf4('0x1b')](_0x138958['query'][_0xcaf4('0x1b')]);}_0xc96ebc[_0xcaf4('0x5c')]=qs[_0xcaf4('0x3b')](_0x138958['query']['sort']);_0xc96ebc[_0xcaf4('0x3c')]=qs[_0xcaf4('0x3d')](_[_0xcaf4('0x3e')](_0x138958[_0xcaf4('0x33')],_0x2cd15b[_0xcaf4('0x3d')]));_0xc96ebc[_0xcaf4('0x3c')]['CampaignId']=_0x252da0['id'];if(_0x138958[_0xcaf4('0x33')]['filter']){_0xc96ebc['where']=_[_0xcaf4('0x40')](_0xc96ebc[_0xcaf4('0x3c')],{'$or':_[_0xcaf4('0x32')](_0xc96ebc[_0xcaf4('0x36')],function(_0x46b4bf){var _0x4e0d2c={};_0x4e0d2c[_0x46b4bf]={'$like':'%'+_0x138958[_0xcaf4('0x33')][_0xcaf4('0x3f')]+'%'};return _0x4e0d2c;})});}_0xc96ebc=_[_0xcaf4('0x40')]({},_0xc96ebc,_0x138958[_0xcaf4('0x41')]);return db['CmHopperBlack']['count']({'where':_0xc96ebc['where']})[_0xcaf4('0x25')](function(_0x29e138){_0x54d692[_0xcaf4('0x1d')]=_0x29e138;if(_0x138958[_0xcaf4('0x33')][_0xcaf4('0x42')]){_0xc96ebc[_0xcaf4('0x43')]=[{'all':!![]}];}return db[_0xcaf4('0x63')]['findAll'](_0xc96ebc);})['then'](function(_0x590d2b){_0x54d692[_0xcaf4('0x45')]=_0x590d2b;return _0x54d692;});}})[_0xcaf4('0x25')](respondWithFilteredResult(_0x431e0e,_0xc96ebc))[_0xcaf4('0x4a')](handleError(_0x431e0e,null));};exports[_0xcaf4('0x64')]=function(_0x5c4171,_0x32cfb2,_0x1487b9){var _0x309191={};var _0x53bdb9={};var _0x308a7c;var _0x148716;return db['Campaign']['findOne']({'where':{'id':_0x5c4171[_0xcaf4('0x47')]['id']}})[_0xcaf4('0x25')](handleEntityNotFound(_0x32cfb2,null))[_0xcaf4('0x25')](function(_0x44b2e4){if(_0x44b2e4){_0x308a7c=_0x44b2e4;_0x53bdb9[_0xcaf4('0x31')]=_[_0xcaf4('0x34')](db['CmList'][_0xcaf4('0x48')]);_0x53bdb9[_0xcaf4('0x33')]=_['keys'](_0x5c4171[_0xcaf4('0x33')]);_0x53bdb9[_0xcaf4('0x3d')]=_[_0xcaf4('0x35')](_0x53bdb9[_0xcaf4('0x31')],_0x53bdb9[_0xcaf4('0x33')]);_0x309191[_0xcaf4('0x36')]=_['intersection'](_0x53bdb9[_0xcaf4('0x31')],qs['fields'](_0x5c4171[_0xcaf4('0x33')][_0xcaf4('0x49')]));_0x309191[_0xcaf4('0x36')]=_0x309191[_0xcaf4('0x36')][_0xcaf4('0x37')]?_0x309191[_0xcaf4('0x36')]:_0x53bdb9[_0xcaf4('0x31')];_0x309191[_0xcaf4('0x5c')]=qs[_0xcaf4('0x3b')](_0x5c4171[_0xcaf4('0x33')][_0xcaf4('0x3b')]);_0x309191[_0xcaf4('0x3c')]=qs['filters'](_['pick'](_0x5c4171[_0xcaf4('0x33')],_0x53bdb9['filters']));if(_0x5c4171[_0xcaf4('0x33')]['filter']){_0x309191[_0xcaf4('0x3c')]=_[_0xcaf4('0x40')](_0x309191[_0xcaf4('0x3c')],{'$or':_['map'](_0x309191[_0xcaf4('0x36')],function(_0x2245e4){var _0x5dc7b2={};_0x5dc7b2[_0x2245e4]={'$like':'%'+_0x5c4171[_0xcaf4('0x33')][_0xcaf4('0x3f')]+'%'};return _0x5dc7b2;})});}_0x309191=_['merge']({},_0x309191,_0x5c4171[_0xcaf4('0x41')]);return _0x308a7c[_0xcaf4('0x64')](_0x309191);}})[_0xcaf4('0x25')](function(_0x1b80b7){if(_0x1b80b7){_0x148716=_0x1b80b7[_0xcaf4('0x37')];if(!_0x5c4171['query'][_0xcaf4('0x38')](_0xcaf4('0x39'))){_0x309191[_0xcaf4('0x3a')]=qs[_0xcaf4('0x3a')](_0x5c4171[_0xcaf4('0x33')][_0xcaf4('0x3a')]);_0x309191[_0xcaf4('0x1b')]=qs[_0xcaf4('0x1b')](_0x5c4171[_0xcaf4('0x33')]['offset']);}return _0x308a7c['getLists'](_0x309191);}})[_0xcaf4('0x25')](function(_0x40501e){if(_0x40501e){return _0x40501e?{'count':_0x148716,'rows':_0x40501e}:null;}})[_0xcaf4('0x25')](respondWithResult(_0x32cfb2,null))[_0xcaf4('0x4a')](handleError(_0x32cfb2,null));};exports['addLists']=function(_0x4883a7,_0x50a084,_0x5c637a){var _0x30dbc4,_0x8ecf2b;var _0x5d0083=[];var _0x347677=moment()[_0xcaf4('0x65')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xcaf4('0x2e')][_0xcaf4('0x51')]({'where':{'id':_0x4883a7[_0xcaf4('0x47')]['id']}})[_0xcaf4('0x25')](handleEntityNotFound(_0x50a084,null))[_0xcaf4('0x25')](function(_0x13f732){if(_0x13f732){_0x8ecf2b=_0x13f732;return _0x13f732[_0xcaf4('0x66')](_0x4883a7['body'][_0xcaf4('0x67')],_[_0xcaf4('0x56')](_0x4883a7[_0xcaf4('0x4c')],[_0xcaf4('0x67'),'id'])||{});}return null;})[_0xcaf4('0x68')](function(_0x254e96){var _0x20c0ba;var _0x4b5a90;_0x30dbc4=_0x254e96||[];var _0x45a62f=[];if(_0x254e96){for(var _0x147637=0x0;_0x147637<_0x254e96[_0xcaf4('0x37')];_0x147637+=0x1){var _0x2a0b3c=_0x254e96[_0x147637][_0xcaf4('0x26')]({'plain':!![]});_0x8ecf2b[_0xcaf4('0x69')]=_0x4883a7[_0xcaf4('0x4c')][_0xcaf4('0x69')]?_0x4883a7[_0xcaf4('0x4c')][_0xcaf4('0x69')]:_0x8ecf2b[_0xcaf4('0x69')];switch(_0x8ecf2b['dialCheckDuplicateType']){case _0xcaf4('0x6a'):_0x20c0ba=squel[_0xcaf4('0x6b')]()[_0xcaf4('0x6c')](_0xcaf4('0x6d'))[_0xcaf4('0x6e')]([_0xcaf4('0x6f'),'scheduledAt',_0xcaf4('0x70'),_0xcaf4('0x71'),_0xcaf4('0x5d'),_0xcaf4('0x57'),_0xcaf4('0x58')],squel[_0xcaf4('0x72')]()[_0xcaf4('0x73')](_0xcaf4('0x6f'),_0xcaf4('0x6f'))[_0xcaf4('0x73')](_0xcaf4('0x74'),_0xcaf4('0x75'))[_0xcaf4('0x73')]('id','ContactId')[_0xcaf4('0x73')](_0x2a0b3c[_0xcaf4('0x76')]['toString'](),_0xcaf4('0x71'))['field'](_0x4883a7[_0xcaf4('0x47')]['id']['toString'](),'CampaignId')[_0xcaf4('0x73')]('\x27'+_0x347677+'\x27',_0xcaf4('0x57'))['field']('\x27'+_0x347677+'\x27',_0xcaf4('0x58'))[_0xcaf4('0x77')](_0xcaf4('0x78'))['where'](_0xcaf4('0x79'))[_0xcaf4('0x3c')](_0xcaf4('0x7a'),_0x2a0b3c['CmListId']['toString']())[_0xcaf4('0x3c')](_0xcaf4('0x7b'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xcaf4('0x72')]()['field'](_0xcaf4('0x7c'))[_0xcaf4('0x77')]('cm_hopper_final')[_0xcaf4('0x3c')](_0xcaf4('0x7d'),_0x4883a7['params']['id']['toString']()))[_0xcaf4('0x3c')](_0xcaf4('0x7e'),squel[_0xcaf4('0x72')]()['field'](_0xcaf4('0x7f'))['from'](_0xcaf4('0x6d'))[_0xcaf4('0x3c')]('CampaignId\x20=\x20?',_0x4883a7[_0xcaf4('0x47')]['id'][_0xcaf4('0x80')]())))[_0xcaf4('0x80')]();break;case _0xcaf4('0x81'):_0x20c0ba=squel[_0xcaf4('0x6b')]()['into']('cm_hopper')[_0xcaf4('0x6e')]([_0xcaf4('0x6f'),'scheduledAt','ContactId',_0xcaf4('0x71'),'CampaignId',_0xcaf4('0x57'),'updatedAt'],squel[_0xcaf4('0x72')]()[_0xcaf4('0x73')]('phone',_0xcaf4('0x6f'))[_0xcaf4('0x73')](_0xcaf4('0x74'),'scheduledAt')[_0xcaf4('0x73')]('id',_0xcaf4('0x70'))[_0xcaf4('0x73')](_0x2a0b3c['CmListId'][_0xcaf4('0x80')](),'ListId')[_0xcaf4('0x73')](_0x4883a7[_0xcaf4('0x47')]['id'][_0xcaf4('0x80')](),_0xcaf4('0x5d'))['field']('\x27'+_0x347677+'\x27',_0xcaf4('0x57'))[_0xcaf4('0x73')]('\x27'+_0x347677+'\x27','updatedAt')['from'](_0xcaf4('0x78'))[_0xcaf4('0x3c')](_0xcaf4('0x79'))['where'](_0xcaf4('0x7a'),_0x2a0b3c[_0xcaf4('0x76')]['toString']())[_0xcaf4('0x3c')](_0xcaf4('0x7b'))[_0xcaf4('0x3c')](_0xcaf4('0x7e'),squel[_0xcaf4('0x72')]()[_0xcaf4('0x73')](_0xcaf4('0x7f'))[_0xcaf4('0x77')](_0xcaf4('0x6d'))[_0xcaf4('0x3c')](_0xcaf4('0x7d'),_0x4883a7[_0xcaf4('0x47')]['id']['toString']())))[_0xcaf4('0x80')]();break;default:_0x20c0ba=squel[_0xcaf4('0x6b')]()[_0xcaf4('0x6c')](_0xcaf4('0x6d'))[_0xcaf4('0x6e')]([_0xcaf4('0x6f'),_0xcaf4('0x75'),_0xcaf4('0x70'),_0xcaf4('0x71'),'CampaignId','createdAt',_0xcaf4('0x58')],squel[_0xcaf4('0x72')]()[_0xcaf4('0x73')](_0xcaf4('0x6f'),'phone')['field']('NOW()',_0xcaf4('0x75'))['field']('id',_0xcaf4('0x70'))['field'](_0x2a0b3c['CmListId'][_0xcaf4('0x80')](),_0xcaf4('0x71'))[_0xcaf4('0x73')](_0x4883a7[_0xcaf4('0x47')]['id'][_0xcaf4('0x80')](),_0xcaf4('0x5d'))[_0xcaf4('0x73')]('\x27'+_0x347677+'\x27','createdAt')[_0xcaf4('0x73')]('\x27'+_0x347677+'\x27',_0xcaf4('0x58'))[_0xcaf4('0x77')]('cm_contacts')[_0xcaf4('0x3c')](_0xcaf4('0x79'))[_0xcaf4('0x3c')](_0xcaf4('0x7a'),_0x2a0b3c['CmListId'][_0xcaf4('0x80')]())[_0xcaf4('0x3c')](_0xcaf4('0x7b')))[_0xcaf4('0x80')]();}_0x4b5a90=squel[_0xcaf4('0x6b')]()['into']('cm_hopper_additional_phones')[_0xcaf4('0x6e')]([_0xcaf4('0x82'),_0xcaf4('0x75'),_0xcaf4('0x6f'),_0xcaf4('0x83'),_0xcaf4('0x57'),_0xcaf4('0x58')],squel['select']()['field'](_0xcaf4('0x84'),'id')[_0xcaf4('0x73')](_0xcaf4('0x74'),_0xcaf4('0x75'))['field'](_0xcaf4('0x85'),_0xcaf4('0x6f'))['field'](_0xcaf4('0x86'),_0xcaf4('0x83'))[_0xcaf4('0x73')]('\x27'+_0x347677+'\x27',_0xcaf4('0x57'))[_0xcaf4('0x73')]('\x27'+_0x347677+'\x27','updatedAt')[_0xcaf4('0x77')](_0xcaf4('0x87'),'ci')[_0xcaf4('0x88')]('cm_hopper','h',_0xcaf4('0x89'))[_0xcaf4('0x3c')](_0xcaf4('0x8a'),_0x2a0b3c['CmListId'][_0xcaf4('0x80')]())[_0xcaf4('0x3c')](_0xcaf4('0x8b'),_0x4883a7[_0xcaf4('0x47')]['id'][_0xcaf4('0x80')]())[_0xcaf4('0x3c')](_0xcaf4('0x8c'),_0x347677))['toString']();_0x45a62f[_0xcaf4('0x8d')](db[_0xcaf4('0x8e')][_0xcaf4('0x33')](_0x20c0ba));_0x5d0083['push'](db[_0xcaf4('0x8e')][_0xcaf4('0x33')](_0x4b5a90));}return BPromise['all'](_0x45a62f);}})[_0xcaf4('0x25')](function(){return BPromise['all'](_0x5d0083);})[_0xcaf4('0x25')](function(){return _0x30dbc4;})[_0xcaf4('0x25')](respondWithResult(_0x50a084,null))[_0xcaf4('0x4a')](handleError(_0x50a084,null));};exports['removeLists']=function(_0x1edfa8,_0x1b3b10,_0x1aae7e){return db[_0xcaf4('0x2e')]['find']({'where':{'id':_0x1edfa8[_0xcaf4('0x47')]['id']}})[_0xcaf4('0x25')](handleEntityNotFound(_0x1b3b10,null))[_0xcaf4('0x25')](function(_0x391fbd){if(_0x391fbd){return _0x391fbd[_0xcaf4('0x8f')](_0x1edfa8[_0xcaf4('0x33')][_0xcaf4('0x67')]);}})[_0xcaf4('0x25')](function(_0x4fbb96){if(_0x4fbb96){return db[_0xcaf4('0x5b')][_0xcaf4('0x24')]({'where':{'ListId':_0x1edfa8['query']['ids'],'CampaignId':_0x1edfa8[_0xcaf4('0x47')]['id']}})[_0xcaf4('0x25')](function(){return _0x4fbb96;});}})[_0xcaf4('0x25')](respondWithStatusCode(_0x1b3b10,null))[_0xcaf4('0x4a')](handleError(_0x1b3b10,null));};exports[_0xcaf4('0x90')]=function(_0x1c94ee,_0x243a7e,_0x499e6b){var _0x1fe7da={};var _0x425cf0={};var _0x4e574b;var _0x286ada;return db['Campaign'][_0xcaf4('0x5f')]({'where':{'id':_0x1c94ee[_0xcaf4('0x47')]['id']}})[_0xcaf4('0x25')](handleEntityNotFound(_0x243a7e,null))[_0xcaf4('0x25')](function(_0x543888){if(_0x543888){_0x4e574b=_0x543888;_0x425cf0[_0xcaf4('0x31')]=_['keys'](db[_0xcaf4('0x91')]['rawAttributes']);_0x425cf0[_0xcaf4('0x33')]=_[_0xcaf4('0x34')](_0x1c94ee[_0xcaf4('0x33')]);_0x425cf0[_0xcaf4('0x3d')]=_[_0xcaf4('0x35')](_0x425cf0[_0xcaf4('0x31')],_0x425cf0[_0xcaf4('0x33')]);_0x1fe7da[_0xcaf4('0x36')]=_[_0xcaf4('0x35')](_0x425cf0['model'],qs[_0xcaf4('0x49')](_0x1c94ee[_0xcaf4('0x33')][_0xcaf4('0x49')]));_0x1fe7da['attributes']=_0x1fe7da[_0xcaf4('0x36')][_0xcaf4('0x37')]?_0x1fe7da['attributes']:_0x425cf0['model'];_0x1fe7da[_0xcaf4('0x5c')]=qs['sort'](_0x1c94ee[_0xcaf4('0x33')][_0xcaf4('0x3b')]);_0x1fe7da['where']=qs[_0xcaf4('0x3d')](_[_0xcaf4('0x3e')](_0x1c94ee['query'],_0x425cf0['filters']));if(_0x1c94ee[_0xcaf4('0x33')]['filter']){_0x1fe7da[_0xcaf4('0x3c')]=_[_0xcaf4('0x40')](_0x1fe7da[_0xcaf4('0x3c')],{'$or':_['map'](_0x1fe7da[_0xcaf4('0x36')],function(_0x185212){var _0x1dd862={};_0x1dd862[_0x185212]={'$like':'%'+_0x1c94ee[_0xcaf4('0x33')][_0xcaf4('0x3f')]+'%'};return _0x1dd862;})});}_0x1fe7da=_[_0xcaf4('0x40')]({},_0x1fe7da,_0x1c94ee[_0xcaf4('0x41')]);return _0x4e574b[_0xcaf4('0x90')](_0x1fe7da);}})[_0xcaf4('0x25')](function(_0x592e3e){if(_0x592e3e){_0x286ada=_0x592e3e[_0xcaf4('0x37')];if(!_0x1c94ee['query'][_0xcaf4('0x38')]('nolimit')){_0x1fe7da[_0xcaf4('0x3a')]=qs[_0xcaf4('0x3a')](_0x1c94ee[_0xcaf4('0x33')][_0xcaf4('0x3a')]);_0x1fe7da[_0xcaf4('0x1b')]=qs[_0xcaf4('0x1b')](_0x1c94ee[_0xcaf4('0x33')][_0xcaf4('0x1b')]);}return _0x4e574b[_0xcaf4('0x90')](_0x1fe7da);}})[_0xcaf4('0x25')](function(_0xd418f2){if(_0xd418f2){return _0xd418f2?{'count':_0x286ada,'rows':_0xd418f2}:null;}})['then'](respondWithResult(_0x243a7e,null))['catch'](handleError(_0x243a7e,null));};exports[_0xcaf4('0x92')]=function(_0x2e1e65,_0x26215b,_0x529a83){var _0x40b539,_0x5bfdf3;var _0x516eab=[];var _0x44a7e2=moment()[_0xcaf4('0x65')](_0xcaf4('0x93'));return db[_0xcaf4('0x2e')][_0xcaf4('0x51')]({'where':{'id':_0x2e1e65[_0xcaf4('0x47')]['id']}})['then'](handleEntityNotFound(_0x26215b,null))['then'](function(_0x696778){if(_0x696778){_0x5bfdf3=_0x696778;return _0x696778['addBlackLists'](_0x2e1e65[_0xcaf4('0x4c')][_0xcaf4('0x67')],_[_0xcaf4('0x56')](_0x2e1e65[_0xcaf4('0x4c')],[_0xcaf4('0x67'),'id'])||{});}return null;})['spread'](function(_0x2b4492){var _0x5974a5;var _0x797c4e;_0x40b539=_0x2b4492||[];var _0x37cdd6=[];if(_0x2b4492){for(var _0x1f53d5=0x0;_0x1f53d5<_0x2b4492[_0xcaf4('0x37')];_0x1f53d5+=0x1){var _0x2e1246=_0x2b4492[_0x1f53d5][_0xcaf4('0x26')]({'plain':!![]});_0x5974a5=squel['insert']()[_0xcaf4('0x6c')]('cm_hopper_black')['fromQuery']([_0xcaf4('0x6f'),'ContactId','ListId',_0xcaf4('0x5d'),'createdAt',_0xcaf4('0x58')],squel[_0xcaf4('0x72')]()[_0xcaf4('0x73')](_0xcaf4('0x6f'),'phone')[_0xcaf4('0x73')]('id',_0xcaf4('0x70'))[_0xcaf4('0x73')](_0x2e1246['CmListId']['toString'](),_0xcaf4('0x71'))[_0xcaf4('0x73')](_0x2e1e65[_0xcaf4('0x47')]['id'][_0xcaf4('0x80')](),_0xcaf4('0x5d'))[_0xcaf4('0x73')](_0xcaf4('0x74'),_0xcaf4('0x57'))[_0xcaf4('0x73')](_0xcaf4('0x74'),_0xcaf4('0x58'))[_0xcaf4('0x77')](_0xcaf4('0x78'))['where'](_0xcaf4('0x79'))[_0xcaf4('0x3c')](_0xcaf4('0x7a'),_0x2e1246[_0xcaf4('0x76')][_0xcaf4('0x80')]())[_0xcaf4('0x3c')](_0xcaf4('0x7b')))[_0xcaf4('0x80')]();_0x37cdd6[_0xcaf4('0x8d')](db[_0xcaf4('0x8e')]['query'](_0x5974a5));}return BPromise[_0xcaf4('0x94')](_0x37cdd6);}})[_0xcaf4('0x25')](function(){return _0x40b539;})[_0xcaf4('0x25')](respondWithResult(_0x26215b,null))[_0xcaf4('0x4a')](handleError(_0x26215b,null));};exports['removeBlackLists']=function(_0xb8de73,_0x186b59,_0x933066){return db[_0xcaf4('0x2e')][_0xcaf4('0x51')]({'where':{'id':_0xb8de73[_0xcaf4('0x47')]['id']}})['then'](handleEntityNotFound(_0x186b59,null))[_0xcaf4('0x25')](function(_0x596f41){if(_0x596f41){return _0x596f41[_0xcaf4('0x95')](_0xb8de73[_0xcaf4('0x33')][_0xcaf4('0x67')]);}})[_0xcaf4('0x25')](function(_0x264222){if(_0x264222){return db[_0xcaf4('0x63')]['destroy']({'where':{'ListId':_0xb8de73[_0xcaf4('0x33')][_0xcaf4('0x67')],'CampaignId':_0xb8de73['params']['id']}})[_0xcaf4('0x25')](function(){return _0x264222;});}})[_0xcaf4('0x25')](respondWithStatusCode(_0x186b59,null))[_0xcaf4('0x4a')](handleError(_0x186b59,null));}; \ No newline at end of file +var _0x5523=['sequelize','all','removeLists','getBlackLists','addBlackLists','omit','insert','cm_hopper_black','removeBlackLists','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','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','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','IvrCampaigns','UserProfileResource','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Campaign','include','findAll','rows','catch','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','includeAll','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getHoppers','findOne','CmHopper','nolimit','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','ListId','select','phone','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','ContactId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','scheduledAt','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push'];(function(_0x44ea42,_0x1de248){var _0x47ec5b=function(_0x4f4448){while(--_0x4f4448){_0x44ea42['push'](_0x44ea42['shift']());}};_0x47ec5b(++_0x1de248);}(_0x5523,0x137));var _0x3552=function(_0x1242d8,_0x4bc485){_0x1242d8=_0x1242d8-0x0;var _0x22e9cd=_0x5523[_0x1242d8];return _0x22e9cd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3552('0x0'));var jsonpatch=require(_0x3552('0x1'));var rp=require(_0x3552('0x2'));var moment=require(_0x3552('0x3'));var BPromise=require(_0x3552('0x4'));var Mustache=require(_0x3552('0x5'));var util=require(_0x3552('0x6'));var path=require(_0x3552('0x7'));var sox=require(_0x3552('0x8'));var csv=require(_0x3552('0x9'));var ejs=require(_0x3552('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3552('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3552('0xc'));var toCsv=require(_0x3552('0x9'));var querystring=require(_0x3552('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3552('0xe'));var qs=require(_0x3552('0xf'));var as=require(_0x3552('0x10'));var hardwareService=require(_0x3552('0x11'));var logger=require(_0x3552('0x12'))(_0x3552('0x13'));var utils=require(_0x3552('0x14'));var config=require(_0x3552('0x15'));var licenseUtil=require(_0x3552('0x16'));var db=require(_0x3552('0x17'))['db'];function respondWithStatusCode(_0xae728b,_0x549df0){_0x549df0=_0x549df0||0xcc;return function(_0x295d0d){if(_0x295d0d){return _0xae728b[_0x3552('0x18')](_0x549df0);}return _0xae728b[_0x3552('0x19')](_0x549df0)['end']();};}function respondWithResult(_0x538549,_0x123c8e){_0x123c8e=_0x123c8e||0xc8;return function(_0x3e90fc){if(_0x3e90fc){return _0x538549[_0x3552('0x19')](_0x123c8e)[_0x3552('0x1a')](_0x3e90fc);}};}function respondWithFilteredResult(_0x50813d,_0x3b9f0a){return function(_0x268d39){if(_0x268d39){var _0x31dd12=typeof _0x3b9f0a[_0x3552('0x1b')]==='undefined'&&typeof _0x3b9f0a[_0x3552('0x1c')]===_0x3552('0x1d');var _0xcc111c=_0x268d39['count'];var _0x2375c9=_0x31dd12?0x0:_0x3b9f0a[_0x3552('0x1b')];var _0x586e1f=_0x31dd12?_0x268d39[_0x3552('0x1e')]:_0x3b9f0a[_0x3552('0x1b')]+_0x3b9f0a[_0x3552('0x1c')];var _0x42fe33;if(_0x586e1f>=_0xcc111c){_0x586e1f=_0xcc111c;_0x42fe33=0xc8;}else{_0x42fe33=0xce;}_0x50813d['status'](_0x42fe33);return _0x50813d[_0x3552('0x1f')](_0x3552('0x20'),_0x2375c9+'-'+_0x586e1f+'/'+_0xcc111c)['json'](_0x268d39);}return null;};}function patchUpdates(_0x26984c){return function(_0x443bab){try{jsonpatch[_0x3552('0x21')](_0x443bab,_0x26984c,!![]);}catch(_0x404b40){return BPromise[_0x3552('0x22')](_0x404b40);}return _0x443bab['save']();};}function saveUpdates(_0x2fe62c,_0x4ea201){return function(_0x42a3d3){if(_0x42a3d3){return _0x42a3d3['update'](_0x2fe62c)[_0x3552('0x23')](function(_0x3ddfb3){return _0x3ddfb3;});}return null;};}function removeEntity(_0x5355e4,_0x1f80b5){return function(_0x534c68){if(_0x534c68){return _0x534c68[_0x3552('0x24')]()['then'](function(){var _0x1972b7=_0x534c68['get']({'plain':!![]});var _0x11c23f=_0x3552('0x25');return db[_0x3552('0x26')][_0x3552('0x24')]({'where':{'type':_0x11c23f,'resourceId':_0x1972b7['id']}})[_0x3552('0x23')](function(){return _0x534c68;});})[_0x3552('0x23')](function(){_0x5355e4[_0x3552('0x19')](0xcc)[_0x3552('0x27')]();});}};}function handleEntityNotFound(_0x5028e1,_0x5d93f6){return function(_0x7d75aa){if(!_0x7d75aa){_0x5028e1['sendStatus'](0x194);}return _0x7d75aa;};}function handleError(_0x29dc07,_0x43d239){_0x43d239=_0x43d239||0x1f4;return function(_0x914ffc){logger[_0x3552('0x28')](_0x914ffc[_0x3552('0x29')]);if(_0x914ffc['name']){delete _0x914ffc[_0x3552('0x2a')];}_0x29dc07[_0x3552('0x19')](_0x43d239)[_0x3552('0x2b')](_0x914ffc);};}exports[_0x3552('0x2c')]=function(_0x212185,_0x52220d){var _0x32b45f={},_0x144d92={},_0x4bbe07={'count':0x0,'rows':[]};var _0xa8952e=_['map'](db['Campaign'][_0x3552('0x2d')],function(_0xe41ad6){return{'name':_0xe41ad6[_0x3552('0x2e')],'type':_0xe41ad6[_0x3552('0x2f')][_0x3552('0x30')]};});_0x144d92[_0x3552('0x31')]=_[_0x3552('0x32')](_0xa8952e,_0x3552('0x2a'));_0x144d92['query']=_['keys'](_0x212185['query']);_0x144d92[_0x3552('0x33')]=_[_0x3552('0x34')](_0x144d92['model'],_0x144d92['query']);_0x32b45f[_0x3552('0x35')]=_[_0x3552('0x34')](_0x144d92[_0x3552('0x31')],qs[_0x3552('0x36')](_0x212185[_0x3552('0x37')][_0x3552('0x36')]));_0x32b45f[_0x3552('0x35')]=_0x32b45f['attributes'][_0x3552('0x38')]?_0x32b45f[_0x3552('0x35')]:_0x144d92[_0x3552('0x31')];if(!_0x212185[_0x3552('0x37')][_0x3552('0x39')]('nolimit')){_0x32b45f[_0x3552('0x1c')]=qs['limit'](_0x212185[_0x3552('0x37')]['limit']);_0x32b45f[_0x3552('0x1b')]=qs[_0x3552('0x1b')](_0x212185[_0x3552('0x37')][_0x3552('0x1b')]);}_0x32b45f[_0x3552('0x3a')]=qs[_0x3552('0x3b')](_0x212185[_0x3552('0x37')][_0x3552('0x3b')]);_0x32b45f[_0x3552('0x3c')]=qs[_0x3552('0x33')](_[_0x3552('0x3d')](_0x212185[_0x3552('0x37')],_0x144d92['filters']),_0xa8952e);if(_0x212185[_0x3552('0x37')][_0x3552('0x3e')]){_0x32b45f[_0x3552('0x3c')]=_[_0x3552('0x3f')](_0x32b45f[_0x3552('0x3c')],{'$or':_['map'](_0xa8952e,function(_0x36d84b){if(_0x36d84b['type']!==_0x3552('0x40')){var _0x1e8d10={};_0x1e8d10[_0x36d84b['name']]={'$like':'%'+_0x212185[_0x3552('0x37')][_0x3552('0x3e')]+'%'};return _0x1e8d10;}})});}_0x32b45f=_[_0x3552('0x3f')]({},_0x32b45f,_0x212185[_0x3552('0x41')]);var _0xaab25d={'where':_0x32b45f[_0x3552('0x3c')]};return db[_0x3552('0x42')][_0x3552('0x1e')](_0xaab25d)[_0x3552('0x23')](function(_0x142da0){_0x4bbe07[_0x3552('0x1e')]=_0x142da0;if(_0x212185[_0x3552('0x37')]['includeAll']){_0x32b45f[_0x3552('0x43')]=[{'all':!![]}];}return db[_0x3552('0x42')][_0x3552('0x44')](_0x32b45f);})[_0x3552('0x23')](function(_0x45973b){_0x4bbe07[_0x3552('0x45')]=_0x45973b;return _0x4bbe07;})[_0x3552('0x23')](respondWithFilteredResult(_0x52220d,_0x32b45f))[_0x3552('0x46')](handleError(_0x52220d,null));};exports['show']=function(_0x1631d0,_0x3e9921){var _0x200fe8={'raw':![],'where':{'id':_0x1631d0[_0x3552('0x47')]['id']}},_0x38290f={};_0x38290f[_0x3552('0x31')]=_[_0x3552('0x48')](db['Campaign'][_0x3552('0x2d')]);_0x38290f[_0x3552('0x37')]=_[_0x3552('0x48')](_0x1631d0[_0x3552('0x37')]);_0x38290f[_0x3552('0x33')]=_[_0x3552('0x34')](_0x38290f[_0x3552('0x31')],_0x38290f[_0x3552('0x37')]);_0x200fe8['attributes']=_[_0x3552('0x34')](_0x38290f[_0x3552('0x31')],qs[_0x3552('0x36')](_0x1631d0[_0x3552('0x37')][_0x3552('0x36')]));_0x200fe8[_0x3552('0x35')]=_0x200fe8[_0x3552('0x35')][_0x3552('0x38')]?_0x200fe8[_0x3552('0x35')]:_0x38290f['model'];if(_0x1631d0[_0x3552('0x37')]['includeAll']){_0x200fe8[_0x3552('0x43')]=[{'all':!![]}];}_0x200fe8=_[_0x3552('0x3f')]({},_0x200fe8,_0x1631d0['options']);return db['Campaign'][_0x3552('0x49')](_0x200fe8)[_0x3552('0x23')](handleEntityNotFound(_0x3e9921,null))['then'](respondWithResult(_0x3e9921,null))[_0x3552('0x46')](handleError(_0x3e9921,null));};exports[_0x3552('0x4a')]=function(_0x68222b,_0x71ca89){return db[_0x3552('0x42')]['create'](_0x68222b[_0x3552('0x4b')],{})[_0x3552('0x23')](function(_0x40c412){var _0x4eff7a=_0x68222b[_0x3552('0x4c')][_0x3552('0x4d')]({'plain':!![]});if(!_0x4eff7a)throw new Error(_0x3552('0x4e'));if(_0x4eff7a[_0x3552('0x4f')]===_0x3552('0x4c')){var _0x2f94e4=_0x40c412[_0x3552('0x4d')]({'plain':!![]});var _0x3b78b8=_0x3552('0x25');return db[_0x3552('0x50')][_0x3552('0x49')]({'where':{'name':_0x3b78b8,'userProfileId':_0x4eff7a[_0x3552('0x51')]},'raw':!![]})['then'](function(_0x1bfc84){if(_0x1bfc84&&_0x1bfc84[_0x3552('0x52')]===0x0){return db[_0x3552('0x26')][_0x3552('0x4a')]({'name':_0x2f94e4[_0x3552('0x2a')],'resourceId':_0x2f94e4['id'],'type':_0x1bfc84['name'],'sectionId':_0x1bfc84['id']},{})['then'](function(){return _0x40c412;});}else{return _0x40c412;}})[_0x3552('0x46')](function(_0x42c63d){logger[_0x3552('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42c63d);throw _0x42c63d;});}return _0x40c412;})['then'](respondWithResult(_0x71ca89,0xc9))['catch'](handleError(_0x71ca89,null));};exports[_0x3552('0x53')]=function(_0x4ad6e5,_0x5daef7){var _0xc7d21e={'where':{'id':_0x4ad6e5[_0x3552('0x47')]['id']}},_0x2e43eb={};_0x2e43eb[_0x3552('0x31')]=_['keys'](db[_0x3552('0x42')][_0x3552('0x2d')]);_0xc7d21e[_0x3552('0x35')]=_[_0x3552('0x34')](_0x2e43eb[_0x3552('0x31')],qs[_0x3552('0x36')](_0x4ad6e5['query'][_0x3552('0x36')]));_0xc7d21e[_0x3552('0x35')]=_0xc7d21e[_0x3552('0x35')][_0x3552('0x38')]?_0xc7d21e['attributes']:_0x2e43eb[_0x3552('0x31')];if(_0x4ad6e5[_0x3552('0x37')][_0x3552('0x54')]){_0xc7d21e[_0x3552('0x43')]=[{'all':!![]}];}_0xc7d21e=_[_0x3552('0x3f')]({},_0xc7d21e,_0x4ad6e5[_0x3552('0x41')]);return db['Campaign'][_0x3552('0x49')](_0xc7d21e)['then'](handleEntityNotFound(_0x5daef7,null))['then'](function(_0x2a7d99){if(_0x2a7d99){var _0x306e98=_0x2a7d99[_0x3552('0x4d')]({'plain':!![]});_0x306e98=qs['omit'](_0x306e98,['id','createdAt','updatedAt']);_0x4ad6e5['body']=_['omit'](_0x4ad6e5[_0x3552('0x4b')],['id',_0x3552('0x55'),_0x3552('0x56')]);return db[_0x3552('0x42')][_0x3552('0x4a')](_[_0x3552('0x3f')](_0x306e98,_0x4ad6e5['body']),{'include':_0x4ad6e5['query']['includeAll']?[{'all':!![]}]:undefined})[_0x3552('0x23')](function(_0x318e4c){var _0x4a40a3=_0x4ad6e5['user'][_0x3552('0x4d')]({'plain':!![]});if(!_0x4a40a3)throw new Error(_0x3552('0x4e'));if(_0x4a40a3['role']==='user'){var _0x1039b0=_0x318e4c[_0x3552('0x4d')]({'plain':!![]});var _0x28e503='IvrCampaigns';return db[_0x3552('0x50')][_0x3552('0x49')]({'where':{'name':_0x28e503,'userProfileId':_0x4a40a3['userProfileId']},'raw':!![]})['then'](function(_0x5e1181){if(_0x5e1181&&_0x5e1181['autoAssociation']===0x0){return db[_0x3552('0x26')][_0x3552('0x4a')]({'name':_0x1039b0[_0x3552('0x2a')],'resourceId':_0x1039b0['id'],'type':_0x5e1181[_0x3552('0x2a')],'sectionId':_0x5e1181['id']},{})[_0x3552('0x23')](function(){return _0x318e4c;});}else{return _0x318e4c;}})['catch'](function(_0x4eaaa8){logger['error'](_0x3552('0x57'),_0x4eaaa8);throw _0x4eaaa8;});}return _0x318e4c;});}})['then'](respondWithResult(_0x5daef7,0xc9))[_0x3552('0x46')](handleError(_0x5daef7,null));};exports[_0x3552('0x58')]=function(_0x8a4545,_0x4bf9ff){if(_0x8a4545[_0x3552('0x4b')]['id']){delete _0x8a4545[_0x3552('0x4b')]['id'];}return db[_0x3552('0x42')]['find']({'where':{'id':_0x8a4545[_0x3552('0x47')]['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x4bf9ff,null))[_0x3552('0x23')](saveUpdates(_0x8a4545['body'],null))[_0x3552('0x23')](respondWithResult(_0x4bf9ff,null))['catch'](handleError(_0x4bf9ff,null));};exports[_0x3552('0x24')]=function(_0x4e37d0,_0x571322){return db[_0x3552('0x42')]['find']({'where':{'id':_0x4e37d0['params']['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x571322,null))[_0x3552('0x23')](removeEntity(_0x571322,null))[_0x3552('0x46')](handleError(_0x571322,null));};exports[_0x3552('0x59')]=function(_0x763317,_0x1da9c0,_0x1d345c){var _0x4702bc={'raw':!![],'where':{}};var _0x27aa33={};var _0x1eacba={'count':0x0,'rows':[]};return db[_0x3552('0x42')][_0x3552('0x5a')]({'where':{'id':_0x763317['params']['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x1da9c0,null))[_0x3552('0x23')](function(_0x185a1a){if(_0x185a1a){_0x27aa33[_0x3552('0x31')]=_[_0x3552('0x48')](db[_0x3552('0x5b')]['rawAttributes']);_0x27aa33['query']=_[_0x3552('0x48')](_0x763317[_0x3552('0x37')]);_0x27aa33[_0x3552('0x33')]=_[_0x3552('0x34')](_0x27aa33[_0x3552('0x31')],_0x27aa33['query']);_0x4702bc[_0x3552('0x35')]=_[_0x3552('0x34')](_0x27aa33[_0x3552('0x31')],qs[_0x3552('0x36')](_0x763317[_0x3552('0x37')][_0x3552('0x36')]));_0x4702bc[_0x3552('0x35')]=_0x4702bc[_0x3552('0x35')][_0x3552('0x38')]?_0x4702bc[_0x3552('0x35')]:_0x27aa33[_0x3552('0x31')];if(!_0x763317[_0x3552('0x37')]['hasOwnProperty'](_0x3552('0x5c'))){_0x4702bc[_0x3552('0x1c')]=qs[_0x3552('0x1c')](_0x763317[_0x3552('0x37')]['limit']);_0x4702bc[_0x3552('0x1b')]=qs['offset'](_0x763317[_0x3552('0x37')][_0x3552('0x1b')]);}_0x4702bc['order']=qs['sort'](_0x763317[_0x3552('0x37')][_0x3552('0x3b')]);_0x4702bc[_0x3552('0x3c')]=qs['filters'](_['pick'](_0x763317[_0x3552('0x37')],_0x27aa33[_0x3552('0x33')]));_0x4702bc[_0x3552('0x3c')][_0x3552('0x5d')]=_0x185a1a['id'];if(_0x763317[_0x3552('0x37')]['filter']){_0x4702bc[_0x3552('0x3c')]=_[_0x3552('0x3f')](_0x4702bc[_0x3552('0x3c')],{'$or':_[_0x3552('0x32')](_0x4702bc[_0x3552('0x35')],function(_0x17d06f){var _0x49f6ba={};_0x49f6ba[_0x17d06f]={'$like':'%'+_0x763317[_0x3552('0x37')]['filter']+'%'};return _0x49f6ba;})});}_0x4702bc=_[_0x3552('0x3f')]({},_0x4702bc,_0x763317[_0x3552('0x41')]);return db[_0x3552('0x5b')]['count']({'where':_0x4702bc[_0x3552('0x3c')]})['then'](function(_0x497a35){_0x1eacba[_0x3552('0x1e')]=_0x497a35;if(_0x763317[_0x3552('0x37')]['includeAll']){_0x4702bc['include']=[{'all':!![]}];}return db[_0x3552('0x5b')]['findAll'](_0x4702bc);})['then'](function(_0x1a43b4){_0x1eacba['rows']=_0x1a43b4;return _0x1eacba;});}})[_0x3552('0x23')](respondWithFilteredResult(_0x1da9c0,_0x4702bc))[_0x3552('0x46')](handleError(_0x1da9c0,null));};exports['getHopperHistories']=function(_0x2960a2,_0x53bf9e,_0x39efa7){var _0x3db63d={'raw':!![],'where':{}};var _0x1566ab={};var _0x46c6f1={'count':0x0,'rows':[]};return db[_0x3552('0x42')][_0x3552('0x5a')]({'where':{'id':_0x2960a2[_0x3552('0x47')]['id']}})['then'](handleEntityNotFound(_0x53bf9e,null))[_0x3552('0x23')](function(_0x336b58){if(_0x336b58){_0x1566ab['model']=_['keys'](db['CmHopperHistory'][_0x3552('0x2d')]);_0x1566ab[_0x3552('0x37')]=_[_0x3552('0x48')](_0x2960a2[_0x3552('0x37')]);_0x1566ab[_0x3552('0x33')]=_[_0x3552('0x34')](_0x1566ab[_0x3552('0x31')],_0x1566ab[_0x3552('0x37')]);_0x3db63d['attributes']=_[_0x3552('0x34')](_0x1566ab[_0x3552('0x31')],qs[_0x3552('0x36')](_0x2960a2['query'][_0x3552('0x36')]));_0x3db63d[_0x3552('0x35')]=_0x3db63d[_0x3552('0x35')][_0x3552('0x38')]?_0x3db63d[_0x3552('0x35')]:_0x1566ab['model'];if(!_0x2960a2['query']['hasOwnProperty'](_0x3552('0x5c'))){_0x3db63d[_0x3552('0x1c')]=qs[_0x3552('0x1c')](_0x2960a2[_0x3552('0x37')]['limit']);_0x3db63d[_0x3552('0x1b')]=qs['offset'](_0x2960a2[_0x3552('0x37')][_0x3552('0x1b')]);}_0x3db63d['order']=qs[_0x3552('0x3b')](_0x2960a2[_0x3552('0x37')]['sort']);_0x3db63d['where']=qs[_0x3552('0x33')](_[_0x3552('0x3d')](_0x2960a2['query'],_0x1566ab[_0x3552('0x33')]));_0x3db63d[_0x3552('0x3c')][_0x3552('0x5d')]=_0x336b58['id'];if(_0x2960a2[_0x3552('0x37')][_0x3552('0x3e')]){_0x3db63d[_0x3552('0x3c')]=_['merge'](_0x3db63d[_0x3552('0x3c')],{'$or':_[_0x3552('0x32')](_0x3db63d[_0x3552('0x35')],function(_0x88b8a2){var _0x45f44a={};_0x45f44a[_0x88b8a2]={'$like':'%'+_0x2960a2['query'][_0x3552('0x3e')]+'%'};return _0x45f44a;})});}_0x3db63d=_[_0x3552('0x3f')]({},_0x3db63d,_0x2960a2[_0x3552('0x41')]);return db[_0x3552('0x5e')][_0x3552('0x1e')]({'where':_0x3db63d[_0x3552('0x3c')]})[_0x3552('0x23')](function(_0xe4f31d){_0x46c6f1[_0x3552('0x1e')]=_0xe4f31d;if(_0x2960a2[_0x3552('0x37')][_0x3552('0x54')]){_0x3db63d[_0x3552('0x43')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x3552('0x44')](_0x3db63d);})[_0x3552('0x23')](function(_0x4044c5){_0x46c6f1[_0x3552('0x45')]=_0x4044c5;return _0x46c6f1;});}})[_0x3552('0x23')](respondWithFilteredResult(_0x53bf9e,_0x3db63d))[_0x3552('0x46')](handleError(_0x53bf9e,null));};exports[_0x3552('0x5f')]=function(_0x15ed73,_0x44ec6c,_0x126b96){var _0x36c4af={'raw':!![],'where':{}};var _0x38f38f={};var _0x29a239={'count':0x0,'rows':[]};return db[_0x3552('0x42')][_0x3552('0x5a')]({'where':{'id':_0x15ed73[_0x3552('0x47')]['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x44ec6c,null))['then'](function(_0x411efc){if(_0x411efc){_0x38f38f[_0x3552('0x31')]=_[_0x3552('0x48')](db['CmHopperFinal'][_0x3552('0x2d')]);_0x38f38f['query']=_[_0x3552('0x48')](_0x15ed73[_0x3552('0x37')]);_0x38f38f[_0x3552('0x33')]=_[_0x3552('0x34')](_0x38f38f['model'],_0x38f38f[_0x3552('0x37')]);_0x36c4af['attributes']=_[_0x3552('0x34')](_0x38f38f['model'],qs[_0x3552('0x36')](_0x15ed73[_0x3552('0x37')][_0x3552('0x36')]));_0x36c4af[_0x3552('0x35')]=_0x36c4af['attributes'][_0x3552('0x38')]?_0x36c4af[_0x3552('0x35')]:_0x38f38f[_0x3552('0x31')];if(!_0x15ed73[_0x3552('0x37')][_0x3552('0x39')](_0x3552('0x5c'))){_0x36c4af[_0x3552('0x1c')]=qs[_0x3552('0x1c')](_0x15ed73['query'][_0x3552('0x1c')]);_0x36c4af[_0x3552('0x1b')]=qs['offset'](_0x15ed73['query'][_0x3552('0x1b')]);}_0x36c4af[_0x3552('0x3a')]=qs[_0x3552('0x3b')](_0x15ed73['query'][_0x3552('0x3b')]);_0x36c4af['where']=qs[_0x3552('0x33')](_['pick'](_0x15ed73[_0x3552('0x37')],_0x38f38f[_0x3552('0x33')]));_0x36c4af['where'][_0x3552('0x5d')]=_0x411efc['id'];if(_0x15ed73[_0x3552('0x37')][_0x3552('0x3e')]){_0x36c4af[_0x3552('0x3c')]=_['merge'](_0x36c4af[_0x3552('0x3c')],{'$or':_[_0x3552('0x32')](_0x36c4af[_0x3552('0x35')],function(_0x1c7c22){var _0x4edd90={};_0x4edd90[_0x1c7c22]={'$like':'%'+_0x15ed73[_0x3552('0x37')][_0x3552('0x3e')]+'%'};return _0x4edd90;})});}_0x36c4af=_[_0x3552('0x3f')]({},_0x36c4af,_0x15ed73[_0x3552('0x41')]);return db[_0x3552('0x60')][_0x3552('0x1e')]({'where':_0x36c4af[_0x3552('0x3c')]})['then'](function(_0x193c08){_0x29a239[_0x3552('0x1e')]=_0x193c08;if(_0x15ed73['query']['includeAll']){_0x36c4af['include']=[{'all':!![]}];}return db[_0x3552('0x60')][_0x3552('0x44')](_0x36c4af);})[_0x3552('0x23')](function(_0x17f128){_0x29a239[_0x3552('0x45')]=_0x17f128;return _0x29a239;});}})[_0x3552('0x23')](respondWithFilteredResult(_0x44ec6c,_0x36c4af))[_0x3552('0x46')](handleError(_0x44ec6c,null));};exports[_0x3552('0x61')]=function(_0x7f2bff,_0x41e1e1,_0x32e57c){var _0x231360={'raw':!![],'where':{}};var _0x4ff5b9={};var _0xfa805d={'count':0x0,'rows':[]};return db[_0x3552('0x42')]['findOne']({'where':{'id':_0x7f2bff['params']['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x41e1e1,null))[_0x3552('0x23')](function(_0x5d2a92){if(_0x5d2a92){_0x4ff5b9[_0x3552('0x31')]=_[_0x3552('0x48')](db[_0x3552('0x62')]['rawAttributes']);_0x4ff5b9[_0x3552('0x37')]=_['keys'](_0x7f2bff[_0x3552('0x37')]);_0x4ff5b9['filters']=_[_0x3552('0x34')](_0x4ff5b9[_0x3552('0x31')],_0x4ff5b9[_0x3552('0x37')]);_0x231360[_0x3552('0x35')]=_[_0x3552('0x34')](_0x4ff5b9[_0x3552('0x31')],qs[_0x3552('0x36')](_0x7f2bff[_0x3552('0x37')]['fields']));_0x231360['attributes']=_0x231360[_0x3552('0x35')][_0x3552('0x38')]?_0x231360[_0x3552('0x35')]:_0x4ff5b9['model'];if(!_0x7f2bff['query']['hasOwnProperty'](_0x3552('0x5c'))){_0x231360[_0x3552('0x1c')]=qs[_0x3552('0x1c')](_0x7f2bff[_0x3552('0x37')][_0x3552('0x1c')]);_0x231360[_0x3552('0x1b')]=qs['offset'](_0x7f2bff[_0x3552('0x37')]['offset']);}_0x231360[_0x3552('0x3a')]=qs[_0x3552('0x3b')](_0x7f2bff[_0x3552('0x37')][_0x3552('0x3b')]);_0x231360[_0x3552('0x3c')]=qs[_0x3552('0x33')](_[_0x3552('0x3d')](_0x7f2bff[_0x3552('0x37')],_0x4ff5b9[_0x3552('0x33')]));_0x231360['where']['CampaignId']=_0x5d2a92['id'];if(_0x7f2bff[_0x3552('0x37')][_0x3552('0x3e')]){_0x231360[_0x3552('0x3c')]=_[_0x3552('0x3f')](_0x231360['where'],{'$or':_[_0x3552('0x32')](_0x231360[_0x3552('0x35')],function(_0x119bf3){var _0x4e2f1b={};_0x4e2f1b[_0x119bf3]={'$like':'%'+_0x7f2bff['query'][_0x3552('0x3e')]+'%'};return _0x4e2f1b;})});}_0x231360=_['merge']({},_0x231360,_0x7f2bff['options']);return db[_0x3552('0x62')][_0x3552('0x1e')]({'where':_0x231360[_0x3552('0x3c')]})[_0x3552('0x23')](function(_0x3006b0){_0xfa805d[_0x3552('0x1e')]=_0x3006b0;if(_0x7f2bff[_0x3552('0x37')][_0x3552('0x54')]){_0x231360[_0x3552('0x43')]=[{'all':!![]}];}return db[_0x3552('0x62')]['findAll'](_0x231360);})[_0x3552('0x23')](function(_0x26c443){_0xfa805d['rows']=_0x26c443;return _0xfa805d;});}})[_0x3552('0x23')](respondWithFilteredResult(_0x41e1e1,_0x231360))[_0x3552('0x46')](handleError(_0x41e1e1,null));};exports[_0x3552('0x63')]=function(_0x702218,_0x4b8860,_0x3492b1){var _0x48f184={};var _0x1da704={};var _0x172bde;var _0x1b6bc7;return db['Campaign'][_0x3552('0x5a')]({'where':{'id':_0x702218[_0x3552('0x47')]['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x4b8860,null))[_0x3552('0x23')](function(_0x12fb89){if(_0x12fb89){_0x172bde=_0x12fb89;_0x1da704[_0x3552('0x31')]=_[_0x3552('0x48')](db[_0x3552('0x64')][_0x3552('0x2d')]);_0x1da704[_0x3552('0x37')]=_[_0x3552('0x48')](_0x702218[_0x3552('0x37')]);_0x1da704[_0x3552('0x33')]=_['intersection'](_0x1da704[_0x3552('0x31')],_0x1da704[_0x3552('0x37')]);_0x48f184[_0x3552('0x35')]=_['intersection'](_0x1da704[_0x3552('0x31')],qs[_0x3552('0x36')](_0x702218[_0x3552('0x37')][_0x3552('0x36')]));_0x48f184[_0x3552('0x35')]=_0x48f184[_0x3552('0x35')][_0x3552('0x38')]?_0x48f184[_0x3552('0x35')]:_0x1da704[_0x3552('0x31')];_0x48f184['order']=qs[_0x3552('0x3b')](_0x702218[_0x3552('0x37')][_0x3552('0x3b')]);_0x48f184[_0x3552('0x3c')]=qs[_0x3552('0x33')](_[_0x3552('0x3d')](_0x702218['query'],_0x1da704[_0x3552('0x33')]));if(_0x702218[_0x3552('0x37')][_0x3552('0x3e')]){_0x48f184['where']=_[_0x3552('0x3f')](_0x48f184['where'],{'$or':_['map'](_0x48f184['attributes'],function(_0x52d5ea){var _0x288e8b={};_0x288e8b[_0x52d5ea]={'$like':'%'+_0x702218[_0x3552('0x37')]['filter']+'%'};return _0x288e8b;})});}_0x48f184=_[_0x3552('0x3f')]({},_0x48f184,_0x702218[_0x3552('0x41')]);return _0x172bde[_0x3552('0x63')](_0x48f184);}})[_0x3552('0x23')](function(_0x131ce0){if(_0x131ce0){_0x1b6bc7=_0x131ce0[_0x3552('0x38')];if(!_0x702218[_0x3552('0x37')][_0x3552('0x39')](_0x3552('0x5c'))){_0x48f184[_0x3552('0x1c')]=qs[_0x3552('0x1c')](_0x702218[_0x3552('0x37')][_0x3552('0x1c')]);_0x48f184['offset']=qs[_0x3552('0x1b')](_0x702218[_0x3552('0x37')][_0x3552('0x1b')]);}return _0x172bde[_0x3552('0x63')](_0x48f184);}})[_0x3552('0x23')](function(_0x12b567){if(_0x12b567){return _0x12b567?{'count':_0x1b6bc7,'rows':_0x12b567}:null;}})[_0x3552('0x23')](respondWithResult(_0x4b8860,null))[_0x3552('0x46')](handleError(_0x4b8860,null));};exports['addLists']=function(_0x155529,_0xfdec5c,_0x5e585d){var _0x35a9bc,_0x2b6424;var _0xe15d9b=[];var _0x47d898=moment()[_0x3552('0x65')](_0x3552('0x66'));return db['Campaign'][_0x3552('0x49')]({'where':{'id':_0x155529[_0x3552('0x47')]['id']}})[_0x3552('0x23')](handleEntityNotFound(_0xfdec5c,null))['then'](function(_0x38d246){if(_0x38d246){_0x2b6424=_0x38d246;return _0x38d246[_0x3552('0x67')](_0x155529[_0x3552('0x4b')][_0x3552('0x68')],_['omit'](_0x155529[_0x3552('0x4b')],['ids','id'])||{});}return null;})[_0x3552('0x69')](function(_0xdc0ec3){var _0x392eb4;var _0x5dd02a;_0x35a9bc=_0xdc0ec3||[];var _0x46d1be=[];if(_0xdc0ec3){for(var _0x10638a=0x0;_0x10638a<_0xdc0ec3[_0x3552('0x38')];_0x10638a+=0x1){var _0x3721db=_0xdc0ec3[_0x10638a][_0x3552('0x4d')]({'plain':!![]});_0x2b6424[_0x3552('0x6a')]=_0x155529['body']['dialCheckDuplicateType']?_0x155529[_0x3552('0x4b')]['dialCheckDuplicateType']:_0x2b6424[_0x3552('0x6a')];switch(_0x2b6424[_0x3552('0x6a')]){case _0x3552('0x6b'):_0x392eb4=squel['insert']()[_0x3552('0x6c')](_0x3552('0x6d'))[_0x3552('0x6e')](['phone','scheduledAt','ContactId',_0x3552('0x6f'),_0x3552('0x5d'),_0x3552('0x55'),'updatedAt'],squel[_0x3552('0x70')]()['field'](_0x3552('0x71'),_0x3552('0x71'))[_0x3552('0x72')](_0x3552('0x73'),'scheduledAt')['field']('id','ContactId')[_0x3552('0x72')](_0x3721db['CmListId'][_0x3552('0x74')](),'ListId')[_0x3552('0x72')](_0x155529['params']['id'][_0x3552('0x74')](),_0x3552('0x5d'))['field']('\x27'+_0x47d898+'\x27',_0x3552('0x55'))[_0x3552('0x72')]('\x27'+_0x47d898+'\x27',_0x3552('0x56'))[_0x3552('0x75')](_0x3552('0x76'))[_0x3552('0x3c')](_0x3552('0x77'))[_0x3552('0x3c')]('ListId\x20=\x20?',_0x3721db[_0x3552('0x78')][_0x3552('0x74')]())[_0x3552('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x3552('0x3c')](_0x3552('0x79'),squel[_0x3552('0x70')]()[_0x3552('0x72')]('COALESCE(calleridnum,\x27\x27)')[_0x3552('0x75')]('cm_hopper_final')[_0x3552('0x3c')]('CampaignId\x20=\x20?',_0x155529[_0x3552('0x47')]['id'][_0x3552('0x74')]()))['where'](_0x3552('0x79'),squel[_0x3552('0x70')]()[_0x3552('0x72')](_0x3552('0x7a'))['from'](_0x3552('0x6d'))[_0x3552('0x3c')](_0x3552('0x7b'),_0x155529[_0x3552('0x47')]['id'][_0x3552('0x74')]())))[_0x3552('0x74')]();break;case _0x3552('0x7c'):_0x392eb4=squel['insert']()['into'](_0x3552('0x6d'))[_0x3552('0x6e')]([_0x3552('0x71'),'scheduledAt',_0x3552('0x7d'),'ListId','CampaignId',_0x3552('0x55'),_0x3552('0x56')],squel['select']()['field'](_0x3552('0x71'),'phone')[_0x3552('0x72')]('NOW()','scheduledAt')[_0x3552('0x72')]('id','ContactId')[_0x3552('0x72')](_0x3721db[_0x3552('0x78')][_0x3552('0x74')](),_0x3552('0x6f'))['field'](_0x155529[_0x3552('0x47')]['id'][_0x3552('0x74')](),_0x3552('0x5d'))['field']('\x27'+_0x47d898+'\x27',_0x3552('0x55'))[_0x3552('0x72')]('\x27'+_0x47d898+'\x27',_0x3552('0x56'))['from'](_0x3552('0x76'))[_0x3552('0x3c')](_0x3552('0x77'))[_0x3552('0x3c')](_0x3552('0x7e'),_0x3721db[_0x3552('0x78')][_0x3552('0x74')]())['where'](_0x3552('0x7f'))['where'](_0x3552('0x79'),squel[_0x3552('0x70')]()[_0x3552('0x72')](_0x3552('0x7a'))[_0x3552('0x75')](_0x3552('0x6d'))['where'](_0x3552('0x7b'),_0x155529[_0x3552('0x47')]['id'][_0x3552('0x74')]())))[_0x3552('0x74')]();break;default:_0x392eb4=squel['insert']()[_0x3552('0x6c')](_0x3552('0x6d'))['fromQuery']([_0x3552('0x71'),_0x3552('0x80'),_0x3552('0x7d'),'ListId',_0x3552('0x5d'),_0x3552('0x55'),_0x3552('0x56')],squel[_0x3552('0x70')]()['field'](_0x3552('0x71'),_0x3552('0x71'))[_0x3552('0x72')]('NOW()','scheduledAt')['field']('id',_0x3552('0x7d'))[_0x3552('0x72')](_0x3721db[_0x3552('0x78')][_0x3552('0x74')](),_0x3552('0x6f'))[_0x3552('0x72')](_0x155529[_0x3552('0x47')]['id'][_0x3552('0x74')](),_0x3552('0x5d'))[_0x3552('0x72')]('\x27'+_0x47d898+'\x27',_0x3552('0x55'))[_0x3552('0x72')]('\x27'+_0x47d898+'\x27',_0x3552('0x56'))[_0x3552('0x75')]('cm_contacts')[_0x3552('0x3c')](_0x3552('0x77'))[_0x3552('0x3c')]('ListId\x20=\x20?',_0x3721db[_0x3552('0x78')][_0x3552('0x74')]())['where'](_0x3552('0x7f')))[_0x3552('0x74')]();}_0x5dd02a=squel['insert']()['into'](_0x3552('0x81'))[_0x3552('0x6e')]([_0x3552('0x82'),_0x3552('0x80'),'phone',_0x3552('0x83'),_0x3552('0x55'),'updatedAt'],squel[_0x3552('0x70')]()[_0x3552('0x72')](_0x3552('0x84'),'id')[_0x3552('0x72')]('NOW()',_0x3552('0x80'))[_0x3552('0x72')](_0x3552('0x85'),_0x3552('0x71'))[_0x3552('0x72')](_0x3552('0x86'),_0x3552('0x83'))[_0x3552('0x72')]('\x27'+_0x47d898+'\x27',_0x3552('0x55'))[_0x3552('0x72')]('\x27'+_0x47d898+'\x27',_0x3552('0x56'))[_0x3552('0x75')](_0x3552('0x87'),'ci')[_0x3552('0x88')](_0x3552('0x6d'),'h',_0x3552('0x89'))[_0x3552('0x3c')](_0x3552('0x8a'),_0x3721db[_0x3552('0x78')][_0x3552('0x74')]())[_0x3552('0x3c')](_0x3552('0x8b'),_0x155529[_0x3552('0x47')]['id'][_0x3552('0x74')]())[_0x3552('0x3c')](_0x3552('0x8c'),_0x47d898))['toString']();_0x46d1be[_0x3552('0x8d')](db[_0x3552('0x8e')][_0x3552('0x37')](_0x392eb4));_0xe15d9b[_0x3552('0x8d')](db['sequelize'][_0x3552('0x37')](_0x5dd02a));}return BPromise[_0x3552('0x8f')](_0x46d1be);}})[_0x3552('0x23')](function(){return BPromise[_0x3552('0x8f')](_0xe15d9b);})[_0x3552('0x23')](function(){return _0x35a9bc;})[_0x3552('0x23')](respondWithResult(_0xfdec5c,null))['catch'](handleError(_0xfdec5c,null));};exports[_0x3552('0x90')]=function(_0x22f37a,_0x5809c2,_0x367601){return db['Campaign'][_0x3552('0x49')]({'where':{'id':_0x22f37a['params']['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x5809c2,null))[_0x3552('0x23')](function(_0x407720){if(_0x407720){return _0x407720[_0x3552('0x90')](_0x22f37a[_0x3552('0x37')][_0x3552('0x68')]);}})[_0x3552('0x23')](function(_0x100c3e){if(_0x100c3e){return db[_0x3552('0x5b')]['destroy']({'where':{'ListId':_0x22f37a['query']['ids'],'CampaignId':_0x22f37a[_0x3552('0x47')]['id']}})[_0x3552('0x23')](function(){return _0x100c3e;});}})[_0x3552('0x23')](respondWithStatusCode(_0x5809c2,null))[_0x3552('0x46')](handleError(_0x5809c2,null));};exports[_0x3552('0x91')]=function(_0x2fd053,_0xbdd748,_0x3cca8e){var _0x2e65fe={};var _0x3258be={};var _0x505bdf;var _0x1297a7;return db['Campaign'][_0x3552('0x5a')]({'where':{'id':_0x2fd053[_0x3552('0x47')]['id']}})[_0x3552('0x23')](handleEntityNotFound(_0xbdd748,null))[_0x3552('0x23')](function(_0x39d646){if(_0x39d646){_0x505bdf=_0x39d646;_0x3258be['model']=_[_0x3552('0x48')](db[_0x3552('0x64')]['rawAttributes']);_0x3258be[_0x3552('0x37')]=_[_0x3552('0x48')](_0x2fd053[_0x3552('0x37')]);_0x3258be[_0x3552('0x33')]=_[_0x3552('0x34')](_0x3258be[_0x3552('0x31')],_0x3258be[_0x3552('0x37')]);_0x2e65fe['attributes']=_[_0x3552('0x34')](_0x3258be[_0x3552('0x31')],qs[_0x3552('0x36')](_0x2fd053[_0x3552('0x37')]['fields']));_0x2e65fe['attributes']=_0x2e65fe[_0x3552('0x35')]['length']?_0x2e65fe['attributes']:_0x3258be[_0x3552('0x31')];_0x2e65fe[_0x3552('0x3a')]=qs[_0x3552('0x3b')](_0x2fd053[_0x3552('0x37')][_0x3552('0x3b')]);_0x2e65fe[_0x3552('0x3c')]=qs[_0x3552('0x33')](_[_0x3552('0x3d')](_0x2fd053[_0x3552('0x37')],_0x3258be[_0x3552('0x33')]));if(_0x2fd053[_0x3552('0x37')][_0x3552('0x3e')]){_0x2e65fe[_0x3552('0x3c')]=_[_0x3552('0x3f')](_0x2e65fe[_0x3552('0x3c')],{'$or':_[_0x3552('0x32')](_0x2e65fe[_0x3552('0x35')],function(_0x1d949e){var _0x818236={};_0x818236[_0x1d949e]={'$like':'%'+_0x2fd053[_0x3552('0x37')][_0x3552('0x3e')]+'%'};return _0x818236;})});}_0x2e65fe=_['merge']({},_0x2e65fe,_0x2fd053[_0x3552('0x41')]);return _0x505bdf[_0x3552('0x91')](_0x2e65fe);}})[_0x3552('0x23')](function(_0x44cd4e){if(_0x44cd4e){_0x1297a7=_0x44cd4e[_0x3552('0x38')];if(!_0x2fd053[_0x3552('0x37')][_0x3552('0x39')]('nolimit')){_0x2e65fe[_0x3552('0x1c')]=qs[_0x3552('0x1c')](_0x2fd053[_0x3552('0x37')]['limit']);_0x2e65fe[_0x3552('0x1b')]=qs[_0x3552('0x1b')](_0x2fd053[_0x3552('0x37')][_0x3552('0x1b')]);}return _0x505bdf['getBlackLists'](_0x2e65fe);}})[_0x3552('0x23')](function(_0x298650){if(_0x298650){return _0x298650?{'count':_0x1297a7,'rows':_0x298650}:null;}})[_0x3552('0x23')](respondWithResult(_0xbdd748,null))[_0x3552('0x46')](handleError(_0xbdd748,null));};exports[_0x3552('0x92')]=function(_0x1c12a3,_0x3c8eb2,_0x6bf543){var _0x4e2c47,_0x3f162a;var _0x3350fb=[];var _0x4c7e23=moment()[_0x3552('0x65')](_0x3552('0x66'));return db[_0x3552('0x42')][_0x3552('0x49')]({'where':{'id':_0x1c12a3[_0x3552('0x47')]['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x3c8eb2,null))[_0x3552('0x23')](function(_0xe92ed0){if(_0xe92ed0){_0x3f162a=_0xe92ed0;return _0xe92ed0[_0x3552('0x92')](_0x1c12a3['body'][_0x3552('0x68')],_[_0x3552('0x93')](_0x1c12a3['body'],[_0x3552('0x68'),'id'])||{});}return null;})[_0x3552('0x69')](function(_0x1d31e8){var _0x24fef4;var _0x58fc52;_0x4e2c47=_0x1d31e8||[];var _0x4e59c9=[];if(_0x1d31e8){for(var _0x273202=0x0;_0x273202<_0x1d31e8[_0x3552('0x38')];_0x273202+=0x1){var _0x55febe=_0x1d31e8[_0x273202]['get']({'plain':!![]});_0x24fef4=squel[_0x3552('0x94')]()[_0x3552('0x6c')](_0x3552('0x95'))[_0x3552('0x6e')](['phone',_0x3552('0x7d'),'ListId',_0x3552('0x5d'),_0x3552('0x55'),'updatedAt'],squel['select']()[_0x3552('0x72')]('phone',_0x3552('0x71'))[_0x3552('0x72')]('id',_0x3552('0x7d'))['field'](_0x55febe[_0x3552('0x78')][_0x3552('0x74')](),_0x3552('0x6f'))[_0x3552('0x72')](_0x1c12a3[_0x3552('0x47')]['id'][_0x3552('0x74')](),'CampaignId')[_0x3552('0x72')](_0x3552('0x73'),_0x3552('0x55'))[_0x3552('0x72')](_0x3552('0x73'),_0x3552('0x56'))['from'](_0x3552('0x76'))[_0x3552('0x3c')](_0x3552('0x77'))['where']('ListId\x20=\x20?',_0x55febe[_0x3552('0x78')][_0x3552('0x74')]())[_0x3552('0x3c')](_0x3552('0x7f')))[_0x3552('0x74')]();_0x4e59c9['push'](db['sequelize'][_0x3552('0x37')](_0x24fef4));}return BPromise[_0x3552('0x8f')](_0x4e59c9);}})[_0x3552('0x23')](function(){return _0x4e2c47;})[_0x3552('0x23')](respondWithResult(_0x3c8eb2,null))['catch'](handleError(_0x3c8eb2,null));};exports[_0x3552('0x96')]=function(_0x29acd0,_0x4c6ee0,_0x317239){return db[_0x3552('0x42')][_0x3552('0x49')]({'where':{'id':_0x29acd0[_0x3552('0x47')]['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x4c6ee0,null))[_0x3552('0x23')](function(_0x59cf51){if(_0x59cf51){return _0x59cf51[_0x3552('0x96')](_0x29acd0[_0x3552('0x37')][_0x3552('0x68')]);}})[_0x3552('0x23')](function(_0x42cd52){if(_0x42cd52){return db['CmHopperBlack'][_0x3552('0x24')]({'where':{'ListId':_0x29acd0[_0x3552('0x37')]['ids'],'CampaignId':_0x29acd0[_0x3552('0x47')]['id']}})['then'](function(){return _0x42cd52;});}})[_0x3552('0x23')](respondWithStatusCode(_0x4c6ee0,null))[_0x3552('0x46')](handleError(_0x4c6ee0,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 579172e..aca9b4d 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(_0x169ed3,_0x113a9f){var _0x5b35b0=function(_0x165cbd){while(--_0x165cbd){_0x169ed3['push'](_0x169ed3['shift']());}};_0x5b35b0(++_0x113a9f);}(_0x7a54,0x106));var _0x47a5=function(_0x4d5714,_0x548170){_0x4d5714=_0x4d5714-0x0;var _0x5be678=_0x7a54[_0x4d5714];return _0x5be678;};'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(_0xbc88bc,_0x10ea66){var _0x548858=function(_0x178473){while(--_0x178473){_0xbc88bc['push'](_0xbc88bc['shift']());}};_0x548858(++_0x10ea66);}(_0x7a54,0x106));var _0x47a5=function(_0xb91ce5,_0xe73ce1){_0xb91ce5=_0xb91ce5-0x0;var _0x4a9cd7=_0x7a54[_0xb91ce5];return _0x4a9cd7;};'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 9e54efd..6b2a6ef 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 _0xeebe=['jayson/promise','client','http','request','then','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','Campaign,\x20%s,\x20%s','info','result','catch','GetCampaign','Campaign','findAll','options','attributes','limit','map','include','model','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5a1e54,_0x13dbf7){var _0x4fe1b2=function(_0x3a7133){while(--_0x3a7133){_0x5a1e54['push'](_0x5a1e54['shift']());}};_0x4fe1b2(++_0x13dbf7);}(_0xeebe,0xff));var _0xeeeb=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xeebe[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0xeeeb('0x0'));var util=require('util');var moment=require(_0xeeeb('0x1'));var BPromise=require('bluebird');var rs=require(_0xeeeb('0x2'));var fs=require('fs');var Redis=require(_0xeeeb('0x3'));var db=require(_0xeeeb('0x4'))['db'];var utils=require(_0xeeeb('0x5'));var logger=require(_0xeeeb('0x6'))(_0xeeeb('0x7'));var config=require(_0xeeeb('0x8'));var jayson=require(_0xeeeb('0x9'));var client=jayson[_0xeeeb('0xa')][_0xeeeb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46c645,_0x3083ab,_0x41847e){return new BPromise(function(_0x1f88ea,_0xc3e1ba){return client[_0xeeeb('0xc')](_0x46c645,_0x41847e)[_0xeeeb('0xd')](function(_0x426a82){logger['info']('Campaign,\x20%s,\x20%s',_0x3083ab,_0xeeeb('0xe'));logger[_0xeeeb('0xf')](_0xeeeb('0x10'),_0x3083ab,'request\x20sent',JSON[_0xeeeb('0x11')](_0x426a82));if(_0x426a82[_0xeeeb('0x12')]){if(_0x426a82[_0xeeeb('0x12')]['code']===0x1f4){logger[_0xeeeb('0x12')]('Campaign,\x20%s,\x20%s',_0x3083ab,_0x426a82['error'][_0xeeeb('0x13')]);return _0xc3e1ba(_0x426a82[_0xeeeb('0x12')][_0xeeeb('0x13')]);}logger[_0xeeeb('0x12')](_0xeeeb('0x14'),_0x3083ab,_0x426a82[_0xeeeb('0x12')][_0xeeeb('0x13')]);return _0x1f88ea(_0x426a82[_0xeeeb('0x12')][_0xeeeb('0x13')]);}else{logger[_0xeeeb('0x15')](_0xeeeb('0x14'),_0x3083ab,_0xeeeb('0xe'));_0x1f88ea(_0x426a82[_0xeeeb('0x16')][_0xeeeb('0x13')]);}})[_0xeeeb('0x17')](function(_0x1b1d02){logger[_0xeeeb('0x12')](_0xeeeb('0x14'),_0x3083ab,_0x1b1d02);_0xc3e1ba(_0x1b1d02);});});}exports[_0xeeeb('0x18')]=function(_0x2db8b1){var _0x37efe6=this;return new Promise(function(_0x1af658,_0x2dba71){return db[_0xeeeb('0x19')][_0xeeeb('0x1a')]({'raw':_0x2db8b1[_0xeeeb('0x1b')]?_0x2db8b1[_0xeeeb('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2db8b1[_0xeeeb('0x1b')]?_0x2db8b1['options']['where']||null:null,'attributes':_0x2db8b1['options']?_0x2db8b1['options'][_0xeeeb('0x1c')]||null:null,'limit':_0x2db8b1[_0xeeeb('0x1b')]?_0x2db8b1[_0xeeeb('0x1b')][_0xeeeb('0x1d')]||null:null,'include':_0x2db8b1[_0xeeeb('0x1b')]?_0x2db8b1['options']['include']?_[_0xeeeb('0x1e')](_0x2db8b1[_0xeeeb('0x1b')][_0xeeeb('0x1f')],function(_0x70ce3c){return{'model':db[_0x70ce3c[_0xeeeb('0x20')]],'as':_0x70ce3c['as'],'attributes':_0x70ce3c['attributes'],'include':_0x70ce3c[_0xeeeb('0x1f')]?_[_0xeeeb('0x1e')](_0x70ce3c['include'],function(_0x495a08){return{'model':db[_0x495a08[_0xeeeb('0x20')]],'as':_0x495a08['as'],'attributes':_0x495a08[_0xeeeb('0x1c')],'include':_0x495a08[_0xeeeb('0x1f')]?_[_0xeeeb('0x1e')](_0x495a08[_0xeeeb('0x1f')],function(_0x192698){return{'model':db[_0x192698[_0xeeeb('0x20')]],'as':_0x192698['as'],'attributes':_0x192698[_0xeeeb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xeeeb('0xd')](function(_0x25e359){logger[_0xeeeb('0x15')]('GetCampaign',_0x2db8b1);logger['debug'](_0xeeeb('0x18'),_0x2db8b1,JSON[_0xeeeb('0x11')](_0x25e359));_0x1af658(_0x25e359);})[_0xeeeb('0x17')](function(_0x49e349){logger[_0xeeeb('0x12')](_0xeeeb('0x18'),_0x49e349['message'],_0x2db8b1);_0x2dba71(_0x37efe6[_0xeeeb('0x12')](0x1f4,_0x49e349[_0xeeeb('0x13')]));});});}; \ No newline at end of file +var _0x6f0d=['catch','GetCampaign','Campaign','findAll','options','where','attributes','limit','include','model','map','debug','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x59b9e2,_0x346785){var _0x534de9=function(_0x40b205){while(--_0x40b205){_0x59b9e2['push'](_0x59b9e2['shift']());}};_0x534de9(++_0x346785);}(_0x6f0d,0x16c));var _0xd6f0=function(_0xe90cb2,_0x5cea7a){_0xe90cb2=_0xe90cb2-0x0;var _0x3bc95a=_0x6f0d[_0xe90cb2];return _0x3bc95a;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('Campaign,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});}exports[_0xd6f0('0x15')]=function(_0x2e71bd){var _0x1862a9=this;return new Promise(function(_0x23ab6c,_0x17e7c6){return db[_0xd6f0('0x16')][_0xd6f0('0x17')]({'raw':_0x2e71bd[_0xd6f0('0x18')]?_0x2e71bd[_0xd6f0('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2e71bd['options']?_0x2e71bd[_0xd6f0('0x18')][_0xd6f0('0x19')]||null:null,'attributes':_0x2e71bd[_0xd6f0('0x18')]?_0x2e71bd['options'][_0xd6f0('0x1a')]||null:null,'limit':_0x2e71bd[_0xd6f0('0x18')]?_0x2e71bd['options'][_0xd6f0('0x1b')]||null:null,'include':_0x2e71bd['options']?_0x2e71bd[_0xd6f0('0x18')][_0xd6f0('0x1c')]?_['map'](_0x2e71bd[_0xd6f0('0x18')][_0xd6f0('0x1c')],function(_0x5ea2dd){return{'model':db[_0x5ea2dd[_0xd6f0('0x1d')]],'as':_0x5ea2dd['as'],'attributes':_0x5ea2dd[_0xd6f0('0x1a')],'include':_0x5ea2dd[_0xd6f0('0x1c')]?_['map'](_0x5ea2dd[_0xd6f0('0x1c')],function(_0x3dc166){return{'model':db[_0x3dc166['model']],'as':_0x3dc166['as'],'attributes':_0x3dc166[_0xd6f0('0x1a')],'include':_0x3dc166['include']?_[_0xd6f0('0x1e')](_0x3dc166[_0xd6f0('0x1c')],function(_0x1630dc){return{'model':db[_0x1630dc[_0xd6f0('0x1d')]],'as':_0x1630dc['as'],'attributes':_0x1630dc[_0xd6f0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd6f0('0xa')](function(_0x12d6ec){logger[_0xd6f0('0xb')]('GetCampaign',_0x2e71bd);logger[_0xd6f0('0x1f')](_0xd6f0('0x15'),_0x2e71bd,JSON['stringify'](_0x12d6ec));_0x23ab6c(_0x12d6ec);})[_0xd6f0('0x14')](function(_0x385947){logger[_0xd6f0('0x10')](_0xd6f0('0x15'),_0x385947[_0xd6f0('0x12')],_0x2e71bd);_0x17e7c6(_0x1862a9[_0xd6f0('0x10')](0x1f4,_0x385947[_0xd6f0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 197a2e9..a66a036 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 _0x0a0b=['/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','clone','addLists','addBlackLists','update','delete','destroy','removeLists','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x0a0b,0x71));var _0xb0a0=function(_0x7025b0,_0x9533f1){_0x7025b0=_0x7025b0-0x0;var _0x6e444c=_0x0a0b[_0x7025b0];return _0x6e444c;};'use strict';var multer=require(_0xb0a0('0x0'));var util=require(_0xb0a0('0x1'));var path=require(_0xb0a0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb0a0('0x3')]();var fs_extra=require(_0xb0a0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb0a0('0x5'));var config=require(_0xb0a0('0x6'));var controller=require(_0xb0a0('0x7'));router[_0xb0a0('0x8')]('/',auth[_0xb0a0('0x9')](),controller[_0xb0a0('0xa')]);router[_0xb0a0('0x8')](_0xb0a0('0xb'),auth['isAuthenticated'](),controller[_0xb0a0('0xc')]);router[_0xb0a0('0x8')]('/:id/hoppers',auth[_0xb0a0('0x9')](),controller[_0xb0a0('0xd')]);router[_0xb0a0('0x8')](_0xb0a0('0xe'),auth[_0xb0a0('0x9')](),controller[_0xb0a0('0xf')]);router[_0xb0a0('0x8')](_0xb0a0('0x10'),auth[_0xb0a0('0x9')](),controller['getHopperFinals']);router[_0xb0a0('0x8')](_0xb0a0('0x11'),auth['isAuthenticated'](),controller[_0xb0a0('0x12')]);router[_0xb0a0('0x8')](_0xb0a0('0x13'),auth['isAuthenticated'](),controller[_0xb0a0('0x14')]);router[_0xb0a0('0x8')](_0xb0a0('0x15'),auth[_0xb0a0('0x9')](),controller['getBlackLists']);router[_0xb0a0('0x16')]('/',auth[_0xb0a0('0x9')](),controller[_0xb0a0('0x17')]);router[_0xb0a0('0x16')]('/:id/clone',auth[_0xb0a0('0x9')](),controller[_0xb0a0('0x18')]);router[_0xb0a0('0x16')](_0xb0a0('0x13'),auth[_0xb0a0('0x9')](),controller[_0xb0a0('0x19')]);router[_0xb0a0('0x16')]('/:id/blacklists',auth[_0xb0a0('0x9')](),controller[_0xb0a0('0x1a')]);router['put'](_0xb0a0('0xb'),auth[_0xb0a0('0x9')](),controller[_0xb0a0('0x1b')]);router[_0xb0a0('0x1c')](_0xb0a0('0xb'),auth['isAuthenticated'](),controller[_0xb0a0('0x1d')]);router['delete'](_0xb0a0('0x13'),auth[_0xb0a0('0x9')](),controller[_0xb0a0('0x1e')]);router[_0xb0a0('0x1c')](_0xb0a0('0x15'),auth[_0xb0a0('0x9')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file +var _0x5010=['addLists','/:id/blacklists','addBlackLists','/:id','update','delete','destroy','removeBlackLists','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','isAuthenticated','show','get','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/lists','getBlackLists','post','create','/:id/clone','clone'];(function(_0x1f1ad0,_0x330eaf){var _0x352af5=function(_0x23a97f){while(--_0x23a97f){_0x1f1ad0['push'](_0x1f1ad0['shift']());}};_0x352af5(++_0x330eaf);}(_0x5010,0x1c9));var _0x0501=function(_0x14435f,_0x45ea68){_0x14435f=_0x14435f-0x0;var _0x348321=_0x5010[_0x14435f];return _0x348321;};'use strict';var multer=require(_0x0501('0x0'));var util=require(_0x0501('0x1'));var path=require(_0x0501('0x2'));var timeout=require(_0x0501('0x3'));var express=require(_0x0501('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0501('0x5'));var interaction=require(_0x0501('0x6'));var config=require(_0x0501('0x7'));var controller=require('./campaign.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0501('0x8')]);router['get']('/:id',auth[_0x0501('0x9')](),controller[_0x0501('0xa')]);router[_0x0501('0xb')](_0x0501('0xc'),auth[_0x0501('0x9')](),controller['getHoppers']);router[_0x0501('0xb')](_0x0501('0xd'),auth[_0x0501('0x9')](),controller[_0x0501('0xe')]);router[_0x0501('0xb')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router[_0x0501('0xb')](_0x0501('0xf'),auth[_0x0501('0x9')](),controller[_0x0501('0x10')]);router[_0x0501('0xb')](_0x0501('0x11'),auth[_0x0501('0x9')](),controller['getLists']);router[_0x0501('0xb')]('/:id/blacklists',auth[_0x0501('0x9')](),controller[_0x0501('0x12')]);router[_0x0501('0x13')]('/',auth[_0x0501('0x9')](),controller[_0x0501('0x14')]);router[_0x0501('0x13')](_0x0501('0x15'),auth[_0x0501('0x9')](),controller[_0x0501('0x16')]);router[_0x0501('0x13')](_0x0501('0x11'),auth['isAuthenticated'](),controller[_0x0501('0x17')]);router[_0x0501('0x13')](_0x0501('0x18'),auth[_0x0501('0x9')](),controller[_0x0501('0x19')]);router['put'](_0x0501('0x1a'),auth[_0x0501('0x9')](),controller[_0x0501('0x1b')]);router[_0x0501('0x1c')](_0x0501('0x1a'),auth[_0x0501('0x9')](),controller[_0x0501('0x1d')]);router[_0x0501('0x1c')](_0x0501('0x11'),auth[_0x0501('0x9')](),controller['removeLists']);router['delete']('/:id/blacklists',auth['isAuthenticated'](),controller[_0x0501('0x1e')]);module[_0x0501('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index c5db0af..d6344ca 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 _0x8da5=['TEXT','medium','VIRTUAL','getDataValue','key','sequelize','exports','STRING'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0x8da5,0x1dd));var _0x58da=function(_0x114469,_0x235c48){_0x114469=_0x114469-0x0;var _0x216ac6=_0x8da5[_0x114469];return _0x216ac6;};'use strict';var Sequelize=require(_0x58da('0x0'));module[_0x58da('0x1')]={'key':{'type':Sequelize[_0x58da('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x58da('0x3')],'length':_0x58da('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x58da('0x5')],'get':function(){return this[_0x58da('0x6')](_0x58da('0x7'));}}}; \ No newline at end of file +var _0xb7cb=['sequelize','TEXT','medium','STRING','getDataValue'];(function(_0x787ef0,_0x5f165f){var _0x21b092=function(_0x3c123e){while(--_0x3c123e){_0x787ef0['push'](_0x787ef0['shift']());}};_0x21b092(++_0x5f165f);}(_0xb7cb,0x145));var _0xbb7c=function(_0x4a705c,_0x5196c3){_0x4a705c=_0x4a705c-0x0;var _0x3e1195=_0xb7cb[_0x4a705c];return _0x3e1195;};'use strict';var Sequelize=require(_0xbb7c('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xbb7c('0x1')],'length':_0xbb7c('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xbb7c('0x3')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xbb7c('0x4')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index e1f4d85..9f25089 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 _0xe18b=['SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','destroy','get','UserProfileResource','then','stack','name','send','index','map','CannedAnswer','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','options','where','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','update','body','create','key','MailAccountId'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xe18b,0x1d9));var _0xbe18=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe18b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xbe18('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe18('0x1'));var jsonpatch=require(_0xbe18('0x2'));var rp=require(_0xbe18('0x3'));var moment=require(_0xbe18('0x4'));var BPromise=require(_0xbe18('0x5'));var Mustache=require(_0xbe18('0x6'));var util=require(_0xbe18('0x7'));var path=require('path');var sox=require(_0xbe18('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe18('0x9'));var _=require(_0xbe18('0xa'));var squel=require('squel');var crypto=require(_0xbe18('0xb'));var jsforce=require(_0xbe18('0xc'));var deskjs=require(_0xbe18('0xd'));var toCsv=require(_0xbe18('0xe'));var querystring=require('querystring');var Papa=require(_0xbe18('0xf'));var Redis=require('ioredis');var authService=require(_0xbe18('0x10'));var qs=require(_0xbe18('0x11'));var as=require(_0xbe18('0x12'));var hardwareService=require(_0xbe18('0x13'));var logger=require(_0xbe18('0x14'))(_0xbe18('0x15'));var utils=require(_0xbe18('0x16'));var config=require(_0xbe18('0x17'));var licenseUtil=require(_0xbe18('0x18'));var db=require(_0xbe18('0x19'))['db'];function respondWithStatusCode(_0x129c64,_0x25a310){_0x25a310=_0x25a310||0xcc;return function(_0x20f797){if(_0x20f797){return _0x129c64[_0xbe18('0x1a')](_0x25a310);}return _0x129c64[_0xbe18('0x1b')](_0x25a310)[_0xbe18('0x1c')]();};}function respondWithResult(_0xb8db17,_0x111675){_0x111675=_0x111675||0xc8;return function(_0x29b6ed){if(_0x29b6ed){return _0xb8db17['status'](_0x111675)[_0xbe18('0x1d')](_0x29b6ed);}};}function respondWithFilteredResult(_0x1eacb4,_0x45d98c){return function(_0xa4054f){if(_0xa4054f){var _0x48028b=typeof _0x45d98c[_0xbe18('0x1e')]===_0xbe18('0x1f')&&typeof _0x45d98c[_0xbe18('0x20')]===_0xbe18('0x1f');var _0x1555a3=_0xa4054f[_0xbe18('0x21')];var _0x4bfff0=_0x48028b?0x0:_0x45d98c['offset'];var _0x128830=_0x48028b?_0xa4054f[_0xbe18('0x21')]:_0x45d98c[_0xbe18('0x1e')]+_0x45d98c[_0xbe18('0x20')];var _0x5f0659;if(_0x128830>=_0x1555a3){_0x128830=_0x1555a3;_0x5f0659=0xc8;}else{_0x5f0659=0xce;}_0x1eacb4[_0xbe18('0x1b')](_0x5f0659);return _0x1eacb4[_0xbe18('0x22')](_0xbe18('0x23'),_0x4bfff0+'-'+_0x128830+'/'+_0x1555a3)[_0xbe18('0x1d')](_0xa4054f);}return null;};}function patchUpdates(_0x59a8ad){return function(_0xcbf855){try{jsonpatch['apply'](_0xcbf855,_0x59a8ad,!![]);}catch(_0x6d4cfd){return BPromise['reject'](_0x6d4cfd);}return _0xcbf855[_0xbe18('0x24')]();};}function saveUpdates(_0xd03aba,_0x1afc5a){return function(_0x34b489){if(_0x34b489){return _0x34b489['update'](_0xd03aba)['then'](function(_0x4d593d){return _0x4d593d;});}return null;};}function removeEntity(_0x1e6e42,_0x55821f){return function(_0x4a827b){if(_0x4a827b){return _0x4a827b[_0xbe18('0x25')]()['then'](function(){var _0x58c47d=_0x4a827b[_0xbe18('0x26')]({'plain':!![]});var _0x9ce77e='CannedAnswers';return db[_0xbe18('0x27')]['destroy']({'where':{'type':_0x9ce77e,'resourceId':_0x58c47d['id']}})[_0xbe18('0x28')](function(){return _0x4a827b;});})[_0xbe18('0x28')](function(){_0x1e6e42[_0xbe18('0x1b')](0xcc)[_0xbe18('0x1c')]();});}};}function handleEntityNotFound(_0x4dc5d5,_0x55a1a8){return function(_0x4cf71d){if(!_0x4cf71d){_0x4dc5d5[_0xbe18('0x1a')](0x194);}return _0x4cf71d;};}function handleError(_0x25aa7c,_0x230718){_0x230718=_0x230718||0x1f4;return function(_0x2c6588){logger['error'](_0x2c6588[_0xbe18('0x29')]);if(_0x2c6588[_0xbe18('0x2a')]){delete _0x2c6588[_0xbe18('0x2a')];}_0x25aa7c[_0xbe18('0x1b')](_0x230718)[_0xbe18('0x2b')](_0x2c6588);};}exports[_0xbe18('0x2c')]=function(_0x490986,_0x1f4e9f){var _0x52c0c1={},_0x108631={},_0x2c7f74={'count':0x0,'rows':[]};var _0x253063=_[_0xbe18('0x2d')](db[_0xbe18('0x2e')]['rawAttributes'],function(_0x3dad60){return{'name':_0x3dad60[_0xbe18('0x2f')],'type':_0x3dad60[_0xbe18('0x30')]['key']};});_0x108631[_0xbe18('0x31')]=_['map'](_0x253063,_0xbe18('0x2a'));_0x108631[_0xbe18('0x32')]=_[_0xbe18('0x33')](_0x490986[_0xbe18('0x32')]);_0x108631[_0xbe18('0x34')]=_['intersection'](_0x108631[_0xbe18('0x31')],_0x108631[_0xbe18('0x32')]);_0x52c0c1['attributes']=_[_0xbe18('0x35')](_0x108631[_0xbe18('0x31')],qs[_0xbe18('0x36')](_0x490986[_0xbe18('0x32')][_0xbe18('0x36')]));_0x52c0c1[_0xbe18('0x37')]=_0x52c0c1[_0xbe18('0x37')][_0xbe18('0x38')]?_0x52c0c1['attributes']:_0x108631['model'];if(!_0x490986['query'][_0xbe18('0x39')](_0xbe18('0x3a'))){_0x52c0c1[_0xbe18('0x20')]=qs[_0xbe18('0x20')](_0x490986[_0xbe18('0x32')]['limit']);_0x52c0c1[_0xbe18('0x1e')]=qs['offset'](_0x490986[_0xbe18('0x32')]['offset']);}_0x52c0c1[_0xbe18('0x3b')]=qs[_0xbe18('0x3c')](_0x490986[_0xbe18('0x32')][_0xbe18('0x3c')]);_0x52c0c1['where']=qs[_0xbe18('0x34')](_['pick'](_0x490986['query'],_0x108631[_0xbe18('0x34')]),_0x253063);if(_0x490986[_0xbe18('0x32')][_0xbe18('0x3d')]){_0x52c0c1['where']=_['merge'](_0x52c0c1['where'],{'$or':[{'key':{'$like':'%'+_0x490986['query'][_0xbe18('0x3d')]+'%'}},{'value':{'$like':'%'+_0x490986[_0xbe18('0x32')][_0xbe18('0x3d')]+'%'}}]});}_0x52c0c1=_[_0xbe18('0x3e')]({},_0x52c0c1,_0x490986[_0xbe18('0x3f')]);var _0x1c664d={'where':_0x52c0c1[_0xbe18('0x40')]};return db[_0xbe18('0x2e')][_0xbe18('0x21')](_0x1c664d)[_0xbe18('0x28')](function(_0x1ad5f6){_0x2c7f74['count']=_0x1ad5f6;if(_0x490986[_0xbe18('0x32')][_0xbe18('0x41')]){_0x52c0c1[_0xbe18('0x42')]=[{'all':!![]}];}return db[_0xbe18('0x2e')][_0xbe18('0x43')](_0x52c0c1);})[_0xbe18('0x28')](function(_0x4cbbc0){_0x2c7f74[_0xbe18('0x44')]=_0x4cbbc0;return _0x2c7f74;})[_0xbe18('0x28')](respondWithFilteredResult(_0x1f4e9f,_0x52c0c1))[_0xbe18('0x45')](handleError(_0x1f4e9f,null));};exports[_0xbe18('0x46')]=function(_0x46def4,_0x1fe281){var _0x7c3800={'raw':!![],'where':{'id':_0x46def4[_0xbe18('0x47')]['id']}},_0x10e4cf={};_0x10e4cf[_0xbe18('0x31')]=_[_0xbe18('0x33')](db[_0xbe18('0x2e')][_0xbe18('0x48')]);_0x10e4cf[_0xbe18('0x32')]=_[_0xbe18('0x33')](_0x46def4[_0xbe18('0x32')]);_0x10e4cf[_0xbe18('0x34')]=_[_0xbe18('0x35')](_0x10e4cf[_0xbe18('0x31')],_0x10e4cf['query']);_0x7c3800[_0xbe18('0x37')]=_[_0xbe18('0x35')](_0x10e4cf[_0xbe18('0x31')],qs['fields'](_0x46def4[_0xbe18('0x32')][_0xbe18('0x36')]));_0x7c3800['attributes']=_0x7c3800[_0xbe18('0x37')][_0xbe18('0x38')]?_0x7c3800[_0xbe18('0x37')]:_0x10e4cf[_0xbe18('0x31')];if(_0x46def4[_0xbe18('0x32')][_0xbe18('0x41')]){_0x7c3800[_0xbe18('0x42')]=[{'all':!![]}];}_0x7c3800=_[_0xbe18('0x3e')]({},_0x7c3800,_0x46def4[_0xbe18('0x3f')]);return db[_0xbe18('0x2e')][_0xbe18('0x49')](_0x7c3800)[_0xbe18('0x28')](handleEntityNotFound(_0x1fe281,null))[_0xbe18('0x28')](respondWithResult(_0x1fe281,null))[_0xbe18('0x45')](handleError(_0x1fe281,null));};exports[_0xbe18('0x4a')]=function(_0x2e5a39,_0x1e0afa){if(_0x2e5a39[_0xbe18('0x4b')]['id']){delete _0x2e5a39[_0xbe18('0x4b')]['id'];}return db[_0xbe18('0x2e')]['find']({'where':{'id':_0x2e5a39[_0xbe18('0x47')]['id']}})['then'](handleEntityNotFound(_0x1e0afa,null))['then'](saveUpdates(_0x2e5a39[_0xbe18('0x4b')],null))[_0xbe18('0x28')](respondWithResult(_0x1e0afa,null))[_0xbe18('0x45')](handleError(_0x1e0afa,null));};exports[_0xbe18('0x25')]=function(_0x142ee5,_0x4d18c0){return db[_0xbe18('0x2e')][_0xbe18('0x49')]({'where':{'id':_0x142ee5['params']['id']}})[_0xbe18('0x28')](handleEntityNotFound(_0x4d18c0,null))[_0xbe18('0x28')](removeEntity(_0x4d18c0,null))['catch'](handleError(_0x4d18c0,null));};exports[_0xbe18('0x4c')]=function(_0x103b06,_0x2a7eab){var _0x1b1c1f={'key':_0x103b06['body'][_0xbe18('0x4d')]};if(_0x103b06[_0xbe18('0x4b')][_0xbe18('0x4e')]){_0x1b1c1f[_0xbe18('0x4e')]=_0x103b06[_0xbe18('0x4b')]['MailAccountId'];}else if(_0x103b06[_0xbe18('0x4b')][_0xbe18('0x4f')]){_0x1b1c1f['SmsAccountId']=_0x103b06[_0xbe18('0x4b')][_0xbe18('0x4f')];}else if(_0x103b06['body']['OpenchannelAccountId']){_0x1b1c1f[_0xbe18('0x50')]=_0x103b06[_0xbe18('0x4b')][_0xbe18('0x50')];}else if(_0x103b06[_0xbe18('0x4b')]['ChatWebsiteId']){_0x1b1c1f[_0xbe18('0x51')]=_0x103b06[_0xbe18('0x4b')][_0xbe18('0x51')];}return db[_0xbe18('0x2e')][_0xbe18('0x49')]({'where':_0x1b1c1f})[_0xbe18('0x28')](function(_0x3d189c){if(_0x3d189c){throw new db[(_0xbe18('0x52'))][(_0xbe18('0x53'))](_0xbe18('0x54'));}return db[_0xbe18('0x2e')][_0xbe18('0x4c')](_0x103b06['body']);})[_0xbe18('0x28')](function(_0x2fe3ad){var _0x2d729b=_0x103b06['user'][_0xbe18('0x26')]({'plain':!![]});if(!_0x2d729b)throw new Error(_0xbe18('0x55'));if(_0x2d729b[_0xbe18('0x56')]==='user'){var _0x30d33d=_0x2fe3ad[_0xbe18('0x26')]({'plain':!![]});return db[_0xbe18('0x57')][_0xbe18('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x2d729b[_0xbe18('0x58')]},'raw':!![]})['then'](function(_0x15605e){if(_0x15605e&&_0x15605e[_0xbe18('0x59')]===0x0){return db[_0xbe18('0x27')][_0xbe18('0x4c')]({'name':_0x30d33d[_0xbe18('0x2a')],'resourceId':_0x30d33d['id'],'type':_0x15605e[_0xbe18('0x2a')],'sectionId':_0x15605e['id']},{})[_0xbe18('0x28')](function(){return _0x2fe3ad;});}else{return _0x2fe3ad;}})[_0xbe18('0x45')](function(_0x5d8b82){logger[_0xbe18('0x5a')](_0xbe18('0x5b'),_0x5d8b82);throw _0x5d8b82;});}return _0x2fe3ad;})[_0xbe18('0x28')](respondWithResult(_0x2a7eab,0xc9))[_0xbe18('0x45')](handleError(_0x2a7eab,null));}; \ No newline at end of file +var _0x27ba=['sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','catch','show','params','rawAttributes','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x16db15,_0x28b93f){var _0x15c33f=function(_0x46397b){while(--_0x46397b){_0x16db15['push'](_0x16db15['shift']());}};_0x15c33f(++_0x28b93f);}(_0x27ba,0x9a));var _0xa27b=function(_0x4edec6,_0x1693d4){_0x4edec6=_0x4edec6-0x0;var _0x3a9d90=_0x27ba[_0x4edec6];return _0x3a9d90;};'use strict';var emlformat=require(_0xa27b('0x0'));var rimraf=require(_0xa27b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa27b('0x2'));var rp=require(_0xa27b('0x3'));var moment=require('moment');var BPromise=require(_0xa27b('0x4'));var Mustache=require(_0xa27b('0x5'));var util=require(_0xa27b('0x6'));var path=require(_0xa27b('0x7'));var sox=require(_0xa27b('0x8'));var csv=require(_0xa27b('0x9'));var ejs=require(_0xa27b('0xa'));var fs=require('fs');var fs_extra=require(_0xa27b('0xb'));var _=require(_0xa27b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa27b('0xd'));var deskjs=require(_0xa27b('0xe'));var toCsv=require(_0xa27b('0x9'));var querystring=require(_0xa27b('0xf'));var Papa=require(_0xa27b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa27b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa27b('0x12'))(_0xa27b('0x13'));var utils=require(_0xa27b('0x14'));var config=require(_0xa27b('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55c413,_0x10fb74){_0x10fb74=_0x10fb74||0xcc;return function(_0x20f306){if(_0x20f306){return _0x55c413[_0xa27b('0x16')](_0x10fb74);}return _0x55c413[_0xa27b('0x17')](_0x10fb74)[_0xa27b('0x18')]();};}function respondWithResult(_0x412e41,_0x3ae769){_0x3ae769=_0x3ae769||0xc8;return function(_0xa22910){if(_0xa22910){return _0x412e41[_0xa27b('0x17')](_0x3ae769)[_0xa27b('0x19')](_0xa22910);}};}function respondWithFilteredResult(_0x2f0f56,_0xabb0f0){return function(_0x153123){if(_0x153123){var _0x3d8d3d=typeof _0xabb0f0[_0xa27b('0x1a')]==='undefined'&&typeof _0xabb0f0[_0xa27b('0x1b')]===_0xa27b('0x1c');var _0x739e0c=_0x153123['count'];var _0x281ba5=_0x3d8d3d?0x0:_0xabb0f0[_0xa27b('0x1a')];var _0x1ed430=_0x3d8d3d?_0x153123[_0xa27b('0x1d')]:_0xabb0f0[_0xa27b('0x1a')]+_0xabb0f0[_0xa27b('0x1b')];var _0x30e696;if(_0x1ed430>=_0x739e0c){_0x1ed430=_0x739e0c;_0x30e696=0xc8;}else{_0x30e696=0xce;}_0x2f0f56[_0xa27b('0x17')](_0x30e696);return _0x2f0f56[_0xa27b('0x1e')](_0xa27b('0x1f'),_0x281ba5+'-'+_0x1ed430+'/'+_0x739e0c)[_0xa27b('0x19')](_0x153123);}return null;};}function patchUpdates(_0x4e8931){return function(_0x372df7){try{jsonpatch[_0xa27b('0x20')](_0x372df7,_0x4e8931,!![]);}catch(_0xecf4fc){return BPromise[_0xa27b('0x21')](_0xecf4fc);}return _0x372df7[_0xa27b('0x22')]();};}function saveUpdates(_0x2a9ada,_0x1ff726){return function(_0x5d6d17){if(_0x5d6d17){return _0x5d6d17[_0xa27b('0x23')](_0x2a9ada)[_0xa27b('0x24')](function(_0x1c3ad1){return _0x1c3ad1;});}return null;};}function removeEntity(_0x116ba3,_0x2a8a7f){return function(_0xf10c82){if(_0xf10c82){return _0xf10c82[_0xa27b('0x25')]()[_0xa27b('0x24')](function(){var _0x2744c5=_0xf10c82[_0xa27b('0x26')]({'plain':!![]});var _0x3523c0=_0xa27b('0x27');return db[_0xa27b('0x28')][_0xa27b('0x25')]({'where':{'type':_0x3523c0,'resourceId':_0x2744c5['id']}})[_0xa27b('0x24')](function(){return _0xf10c82;});})[_0xa27b('0x24')](function(){_0x116ba3[_0xa27b('0x17')](0xcc)[_0xa27b('0x18')]();});}};}function handleEntityNotFound(_0x3e9c97,_0x102113){return function(_0x4403ad){if(!_0x4403ad){_0x3e9c97[_0xa27b('0x16')](0x194);}return _0x4403ad;};}function handleError(_0x5ca03e,_0xed3d14){_0xed3d14=_0xed3d14||0x1f4;return function(_0x598f18){logger[_0xa27b('0x29')](_0x598f18[_0xa27b('0x2a')]);if(_0x598f18[_0xa27b('0x2b')]){delete _0x598f18['name'];}_0x5ca03e[_0xa27b('0x17')](_0xed3d14)[_0xa27b('0x2c')](_0x598f18);};}exports[_0xa27b('0x2d')]=function(_0x51a4d1,_0x23c357){var _0xec78d9={},_0x37b55f={},_0x2da74e={'count':0x0,'rows':[]};var _0xdf1342=_[_0xa27b('0x2e')](db[_0xa27b('0x2f')]['rawAttributes'],function(_0x52c6b6){return{'name':_0x52c6b6[_0xa27b('0x30')],'type':_0x52c6b6[_0xa27b('0x31')][_0xa27b('0x32')]};});_0x37b55f[_0xa27b('0x33')]=_[_0xa27b('0x2e')](_0xdf1342,_0xa27b('0x2b'));_0x37b55f[_0xa27b('0x34')]=_[_0xa27b('0x35')](_0x51a4d1[_0xa27b('0x34')]);_0x37b55f[_0xa27b('0x36')]=_[_0xa27b('0x37')](_0x37b55f[_0xa27b('0x33')],_0x37b55f[_0xa27b('0x34')]);_0xec78d9[_0xa27b('0x38')]=_[_0xa27b('0x37')](_0x37b55f[_0xa27b('0x33')],qs[_0xa27b('0x39')](_0x51a4d1[_0xa27b('0x34')][_0xa27b('0x39')]));_0xec78d9[_0xa27b('0x38')]=_0xec78d9['attributes'][_0xa27b('0x3a')]?_0xec78d9[_0xa27b('0x38')]:_0x37b55f['model'];if(!_0x51a4d1[_0xa27b('0x34')][_0xa27b('0x3b')](_0xa27b('0x3c'))){_0xec78d9[_0xa27b('0x1b')]=qs[_0xa27b('0x1b')](_0x51a4d1[_0xa27b('0x34')][_0xa27b('0x1b')]);_0xec78d9[_0xa27b('0x1a')]=qs[_0xa27b('0x1a')](_0x51a4d1[_0xa27b('0x34')]['offset']);}_0xec78d9[_0xa27b('0x3d')]=qs['sort'](_0x51a4d1['query'][_0xa27b('0x3e')]);_0xec78d9[_0xa27b('0x3f')]=qs[_0xa27b('0x36')](_[_0xa27b('0x40')](_0x51a4d1[_0xa27b('0x34')],_0x37b55f[_0xa27b('0x36')]),_0xdf1342);if(_0x51a4d1['query'][_0xa27b('0x41')]){_0xec78d9['where']=_[_0xa27b('0x42')](_0xec78d9['where'],{'$or':[{'key':{'$like':'%'+_0x51a4d1[_0xa27b('0x34')]['filter']+'%'}},{'value':{'$like':'%'+_0x51a4d1[_0xa27b('0x34')]['filter']+'%'}}]});}_0xec78d9=_['merge']({},_0xec78d9,_0x51a4d1['options']);var _0x8d0224={'where':_0xec78d9['where']};return db[_0xa27b('0x2f')][_0xa27b('0x1d')](_0x8d0224)[_0xa27b('0x24')](function(_0x18e3db){_0x2da74e[_0xa27b('0x1d')]=_0x18e3db;if(_0x51a4d1[_0xa27b('0x34')][_0xa27b('0x43')]){_0xec78d9[_0xa27b('0x44')]=[{'all':!![]}];}return db[_0xa27b('0x2f')]['findAll'](_0xec78d9);})[_0xa27b('0x24')](function(_0x201274){_0x2da74e['rows']=_0x201274;return _0x2da74e;})['then'](respondWithFilteredResult(_0x23c357,_0xec78d9))[_0xa27b('0x45')](handleError(_0x23c357,null));};exports[_0xa27b('0x46')]=function(_0x54f657,_0xc5fcce){var _0x54902f={'raw':!![],'where':{'id':_0x54f657[_0xa27b('0x47')]['id']}},_0x3ae194={};_0x3ae194[_0xa27b('0x33')]=_[_0xa27b('0x35')](db[_0xa27b('0x2f')][_0xa27b('0x48')]);_0x3ae194[_0xa27b('0x34')]=_[_0xa27b('0x35')](_0x54f657[_0xa27b('0x34')]);_0x3ae194['filters']=_['intersection'](_0x3ae194[_0xa27b('0x33')],_0x3ae194[_0xa27b('0x34')]);_0x54902f[_0xa27b('0x38')]=_[_0xa27b('0x37')](_0x3ae194[_0xa27b('0x33')],qs[_0xa27b('0x39')](_0x54f657['query'][_0xa27b('0x39')]));_0x54902f[_0xa27b('0x38')]=_0x54902f['attributes']['length']?_0x54902f[_0xa27b('0x38')]:_0x3ae194['model'];if(_0x54f657[_0xa27b('0x34')][_0xa27b('0x43')]){_0x54902f[_0xa27b('0x44')]=[{'all':!![]}];}_0x54902f=_['merge']({},_0x54902f,_0x54f657['options']);return db[_0xa27b('0x2f')][_0xa27b('0x49')](_0x54902f)[_0xa27b('0x24')](handleEntityNotFound(_0xc5fcce,null))[_0xa27b('0x24')](respondWithResult(_0xc5fcce,null))[_0xa27b('0x45')](handleError(_0xc5fcce,null));};exports[_0xa27b('0x23')]=function(_0x5038fc,_0x56e462){if(_0x5038fc[_0xa27b('0x4a')]['id']){delete _0x5038fc['body']['id'];}return db['CannedAnswer'][_0xa27b('0x49')]({'where':{'id':_0x5038fc['params']['id']}})[_0xa27b('0x24')](handleEntityNotFound(_0x56e462,null))['then'](saveUpdates(_0x5038fc[_0xa27b('0x4a')],null))[_0xa27b('0x24')](respondWithResult(_0x56e462,null))[_0xa27b('0x45')](handleError(_0x56e462,null));};exports[_0xa27b('0x25')]=function(_0x7ee351,_0x36b13b){return db[_0xa27b('0x2f')][_0xa27b('0x49')]({'where':{'id':_0x7ee351[_0xa27b('0x47')]['id']}})['then'](handleEntityNotFound(_0x36b13b,null))['then'](removeEntity(_0x36b13b,null))[_0xa27b('0x45')](handleError(_0x36b13b,null));};exports[_0xa27b('0x4b')]=function(_0x45e36c,_0x40161a){var _0x1b9b77={'key':_0x45e36c[_0xa27b('0x4a')][_0xa27b('0x32')]};if(_0x45e36c[_0xa27b('0x4a')][_0xa27b('0x4c')]){_0x1b9b77[_0xa27b('0x4c')]=_0x45e36c[_0xa27b('0x4a')][_0xa27b('0x4c')];}else if(_0x45e36c['body'][_0xa27b('0x4d')]){_0x1b9b77[_0xa27b('0x4d')]=_0x45e36c[_0xa27b('0x4a')][_0xa27b('0x4d')];}else if(_0x45e36c[_0xa27b('0x4a')]['OpenchannelAccountId']){_0x1b9b77[_0xa27b('0x4e')]=_0x45e36c[_0xa27b('0x4a')]['OpenchannelAccountId'];}else if(_0x45e36c['body'][_0xa27b('0x4f')]){_0x1b9b77['ChatWebsiteId']=_0x45e36c[_0xa27b('0x4a')]['ChatWebsiteId'];}return db[_0xa27b('0x2f')][_0xa27b('0x49')]({'where':_0x1b9b77})[_0xa27b('0x24')](function(_0x1e9314){if(_0x1e9314){throw new db[(_0xa27b('0x50'))][(_0xa27b('0x51'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xa27b('0x2f')][_0xa27b('0x4b')](_0x45e36c[_0xa27b('0x4a')]);})[_0xa27b('0x24')](function(_0x4ece3f){var _0x1a83bf=_0x45e36c[_0xa27b('0x52')]['get']({'plain':!![]});if(!_0x1a83bf)throw new Error(_0xa27b('0x53'));if(_0x1a83bf['role']===_0xa27b('0x52')){var _0x4ff0a6=_0x4ece3f['get']({'plain':!![]});return db[_0xa27b('0x54')][_0xa27b('0x49')]({'where':{'name':_0xa27b('0x27'),'userProfileId':_0x1a83bf[_0xa27b('0x55')]},'raw':!![]})[_0xa27b('0x24')](function(_0x44d370){if(_0x44d370&&_0x44d370[_0xa27b('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x4ff0a6[_0xa27b('0x2b')],'resourceId':_0x4ff0a6['id'],'type':_0x44d370[_0xa27b('0x2b')],'sectionId':_0x44d370['id']},{})[_0xa27b('0x24')](function(){return _0x4ece3f;});}else{return _0x4ece3f;}})[_0xa27b('0x45')](function(_0xe9d494){logger['error'](_0xa27b('0x57'),_0xe9d494);throw _0xe9d494;});}return _0x4ece3f;})[_0xa27b('0x24')](respondWithResult(_0x40161a,0xc9))['catch'](handleError(_0x40161a,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 2b7dbfb..c4533c4 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 _0x6910=['exports','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x6910,0x1cc));var _0x0691=function(_0x39cd3c,_0xa21102){_0x39cd3c=_0x39cd3c-0x0;var _0x47a0ae=_0x6910[_0x39cd3c];return _0x47a0ae;};'use strict';var _=require(_0x0691('0x0'));var util=require(_0x0691('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0691('0x2'));var BPromise=require(_0x0691('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0691('0x4'));var rimraf=require(_0x0691('0x5'));var config=require(_0x0691('0x6'));var attributes=require(_0x0691('0x7'));module[_0x0691('0x8')]=function(_0x16f626,_0x1a8b82){return _0x16f626[_0x0691('0x9')](_0x0691('0xa'),attributes,{'tableName':_0x0691('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0691('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbde8=['utf8mb4','bluebird','request-promise','./cannedAnswer.attributes','exports','define'];(function(_0x58a008,_0x26ac76){var _0x3074b0=function(_0xc9e0b){while(--_0xc9e0b){_0x58a008['push'](_0x58a008['shift']());}};_0x3074b0(++_0x26ac76);}(_0xbde8,0xd9));var _0x8bde=function(_0x26d386,_0x1660c0){_0x26d386=_0x26d386-0x0;var _0x4ef9a8=_0xbde8[_0x26d386];return _0x4ef9a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8bde('0x0'));var rp=require(_0x8bde('0x1'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8bde('0x2'));module[_0x8bde('0x3')]=function(_0x36474e,_0x8543df){return _0x36474e[_0x8bde('0x4')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8bde('0x5'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index de0a5b6..408c0f8 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(_0x4b1bf7,_0x342159){var _0x402192=function(_0x4bfc15){while(--_0x4bfc15){_0x4b1bf7['push'](_0x4b1bf7['shift']());}};_0x402192(++_0x342159);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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(_0x2c3b09,_0x34bfd7){var _0x50e2f2=function(_0xdfe44c){while(--_0xdfe44c){_0x2c3b09['push'](_0x2c3b09['shift']());}};_0x50e2f2(++_0x34bfd7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 bd7c16c..1fd6ef2 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 _0x29d8=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','create','put','exports'];(function(_0x46ae74,_0x5ec39d){var _0x1e9860=function(_0x3f5bb9){while(--_0x3f5bb9){_0x46ae74['push'](_0x46ae74['shift']());}};_0x1e9860(++_0x5ec39d);}(_0x29d8,0xfc));var _0x829d=function(_0x3f602f,_0x56b053){_0x3f602f=_0x3f602f-0x0;var _0x41912c=_0x29d8[_0x3f602f];return _0x41912c;};'use strict';var multer=require('multer');var util=require(_0x829d('0x0'));var path=require(_0x829d('0x1'));var timeout=require(_0x829d('0x2'));var express=require(_0x829d('0x3'));var router=express[_0x829d('0x4')]();var fs_extra=require(_0x829d('0x5'));var auth=require(_0x829d('0x6'));var interaction=require(_0x829d('0x7'));var config=require(_0x829d('0x8'));var controller=require('./cannedAnswer.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x829d('0x9')]);router[_0x829d('0xa')](_0x829d('0xb'),auth[_0x829d('0xc')](),controller[_0x829d('0xd')]);router[_0x829d('0xe')]('/',auth[_0x829d('0xc')](),controller[_0x829d('0xf')]);router[_0x829d('0x10')](_0x829d('0xb'),auth[_0x829d('0xc')](),controller['update']);router['delete'](_0x829d('0xb'),auth[_0x829d('0xc')](),controller['destroy']);module[_0x829d('0x11')]=router; \ No newline at end of file +var _0x6066=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','/:id','update','delete','destroy','exports','multer','util'];(function(_0xf4f343,_0x41fe4a){var _0x4cda68=function(_0x3850e6){while(--_0x3850e6){_0xf4f343['push'](_0xf4f343['shift']());}};_0x4cda68(++_0x41fe4a);}(_0x6066,0x166));var _0x6606=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x6066[_0x5c9307];return _0x373e29;};'use strict';var multer=require(_0x6606('0x0'));var util=require(_0x6606('0x1'));var path=require(_0x6606('0x2'));var timeout=require(_0x6606('0x3'));var express=require(_0x6606('0x4'));var router=express[_0x6606('0x5')]();var fs_extra=require(_0x6606('0x6'));var auth=require(_0x6606('0x7'));var interaction=require(_0x6606('0x8'));var config=require(_0x6606('0x9'));var controller=require('./cannedAnswer.controller');router[_0x6606('0xa')]('/',auth[_0x6606('0xb')](),controller[_0x6606('0xc')]);router[_0x6606('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x6606('0xd')]);router[_0x6606('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6606('0xf'),auth[_0x6606('0xb')](),controller[_0x6606('0x10')]);router[_0x6606('0x11')]('/:id',auth[_0x6606('0xb')](),controller[_0x6606('0x12')]);module[_0x6606('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 48f21d0..edeab2f 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 _0xbfcc=['INTEGER','sequelize','1970-01-01\x2000:00:01','STRING'];(function(_0xdb9a1b,_0x108ace){var _0x59082a=function(_0x301fe8){while(--_0x301fe8){_0xdb9a1b['push'](_0xdb9a1b['shift']());}};_0x59082a(++_0x108ace);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x382c73,_0x199cab){_0x382c73=_0x382c73-0x0;var _0x1dd0bf=_0xbfcc[_0x382c73];return _0x1dd0bf;};'use strict';var Sequelize=require(_0xcbfc('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xcbfc('0x1')},'clid':{'type':Sequelize[_0xcbfc('0x2')]},'src':{'type':Sequelize[_0xcbfc('0x2')]},'dst':{'type':Sequelize[_0xcbfc('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xcbfc('0x2')]},'duration':{'type':Sequelize[_0xcbfc('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xcbfc('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xcbfc('0x2')]},'userfield':{'type':Sequelize[_0xcbfc('0x2')]},'uniqueid':{'type':Sequelize[_0xcbfc('0x2')]},'linkedid':{'type':Sequelize[_0xcbfc('0x2')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xcbfc('0x2')]},'type':{'type':Sequelize[_0xcbfc('0x2')]},'tag':{'type':Sequelize[_0xcbfc('0x2')]}}; \ No newline at end of file +var _0x6f0d=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','exports'];(function(_0x563c43,_0x58ddc5){var _0x34e96e=function(_0x12c6d8){while(--_0x12c6d8){_0x563c43['push'](_0x563c43['shift']());}};_0x34e96e(++_0x58ddc5);}(_0x6f0d,0x16c));var _0xd6f0=function(_0xf83592,_0x3c1233){_0xf83592=_0xf83592-0x0;var _0x5da488=_0x6f0d[_0xf83592];return _0x5da488;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'calldate':{'type':Sequelize[_0xd6f0('0x1')],'allowNull':![],'defaultValue':_0xd6f0('0x2')},'clid':{'type':Sequelize[_0xd6f0('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xd6f0('0x3')]},'dcontext':{'type':Sequelize[_0xd6f0('0x3')]},'channel':{'type':Sequelize[_0xd6f0('0x3')]},'dstchannel':{'type':Sequelize[_0xd6f0('0x3')]},'lastapp':{'type':Sequelize[_0xd6f0('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xd6f0('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd6f0('0x3')]},'amaflags':{'type':Sequelize[_0xd6f0('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xd6f0('0x3')]},'userfield':{'type':Sequelize[_0xd6f0('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xd6f0('0x3')]},'peeraccount':{'type':Sequelize[_0xd6f0('0x3')]},'type':{'type':Sequelize[_0xd6f0('0x3')]},'tag':{'type':Sequelize[_0xd6f0('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 7a5f1e6..5403159 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 _0xab86=['fieldName','type','key','model','keys','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','filters','pick','merge','filter','options','includeAll','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','moment','mustache','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/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','then','destroy','sendStatus','stack','name','send','map','Cdr','rawAttributes'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xab86,0x13e));var _0x6ab8=function(_0x4ee744,_0x182161){_0x4ee744=_0x4ee744-0x0;var _0xd35f8=_0xab86[_0x4ee744];return _0xd35f8;};'use strict';var emlformat=require(_0x6ab8('0x0'));var rimraf=require(_0x6ab8('0x1'));var zipdir=require(_0x6ab8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6ab8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6ab8('0x4'));var util=require('util');var path=require(_0x6ab8('0x5'));var sox=require(_0x6ab8('0x6'));var csv=require(_0x6ab8('0x7'));var ejs=require(_0x6ab8('0x8'));var fs=require('fs');var fs_extra=require(_0x6ab8('0x9'));var _=require(_0x6ab8('0xa'));var squel=require(_0x6ab8('0xb'));var crypto=require(_0x6ab8('0xc'));var jsforce=require(_0x6ab8('0xd'));var deskjs=require(_0x6ab8('0xe'));var toCsv=require(_0x6ab8('0x7'));var querystring=require(_0x6ab8('0xf'));var Papa=require(_0x6ab8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6ab8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ab8('0x12'));var logger=require(_0x6ab8('0x13'))(_0x6ab8('0x14'));var utils=require('../../config/utils');var config=require(_0x6ab8('0x15'));var licenseUtil=require(_0x6ab8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44d1d9,_0x1b9b34){_0x1b9b34=_0x1b9b34||0xcc;return function(_0x408ce1){if(_0x408ce1){return _0x44d1d9['sendStatus'](_0x1b9b34);}return _0x44d1d9[_0x6ab8('0x17')](_0x1b9b34)[_0x6ab8('0x18')]();};}function respondWithResult(_0x60b50,_0x968bac){_0x968bac=_0x968bac||0xc8;return function(_0x1c83a1){if(_0x1c83a1){return _0x60b50[_0x6ab8('0x17')](_0x968bac)[_0x6ab8('0x19')](_0x1c83a1);}};}function respondWithFilteredResult(_0x2043bb,_0x293389){return function(_0x5218e9){if(_0x5218e9){var _0x1f64a3=typeof _0x293389[_0x6ab8('0x1a')]===_0x6ab8('0x1b')&&typeof _0x293389['limit']===_0x6ab8('0x1b');var _0x35b790=_0x5218e9['count'];var _0x543726=_0x1f64a3?0x0:_0x293389[_0x6ab8('0x1a')];var _0x57cd18=_0x1f64a3?_0x5218e9[_0x6ab8('0x1c')]:_0x293389[_0x6ab8('0x1a')]+_0x293389[_0x6ab8('0x1d')];var _0x4e0fbd;if(_0x57cd18>=_0x35b790){_0x57cd18=_0x35b790;_0x4e0fbd=0xc8;}else{_0x4e0fbd=0xce;}_0x2043bb[_0x6ab8('0x17')](_0x4e0fbd);return _0x2043bb[_0x6ab8('0x1e')](_0x6ab8('0x1f'),_0x543726+'-'+_0x57cd18+'/'+_0x35b790)[_0x6ab8('0x19')](_0x5218e9);}return null;};}function patchUpdates(_0x5227c6){return function(_0x301004){try{jsonpatch[_0x6ab8('0x20')](_0x301004,_0x5227c6,!![]);}catch(_0x520cd8){return BPromise['reject'](_0x520cd8);}return _0x301004['save']();};}function saveUpdates(_0x190af2,_0x46cfdc){return function(_0xe2d5d8){if(_0xe2d5d8){return _0xe2d5d8['update'](_0x190af2)[_0x6ab8('0x21')](function(_0x433f37){return _0x433f37;});}return null;};}function removeEntity(_0x50fc50,_0x503f94){return function(_0x8af7e9){if(_0x8af7e9){return _0x8af7e9[_0x6ab8('0x22')]()['then'](function(){_0x50fc50[_0x6ab8('0x17')](0xcc)[_0x6ab8('0x18')]();});}};}function handleEntityNotFound(_0x24e400,_0x3d614b){return function(_0x3ddaeb){if(!_0x3ddaeb){_0x24e400[_0x6ab8('0x23')](0x194);}return _0x3ddaeb;};}function handleError(_0x2e098f,_0x1e26ed){_0x1e26ed=_0x1e26ed||0x1f4;return function(_0x5a1be3){logger['error'](_0x5a1be3[_0x6ab8('0x24')]);if(_0x5a1be3['name']){delete _0x5a1be3[_0x6ab8('0x25')];}_0x2e098f[_0x6ab8('0x17')](_0x1e26ed)[_0x6ab8('0x26')](_0x5a1be3);};}exports['index']=function(_0x525687,_0x4871e3){var _0x79dbd3={},_0x14e822={},_0x3723a7={'count':0x0,'rows':[]};var _0x2f14ea=_[_0x6ab8('0x27')](db[_0x6ab8('0x28')][_0x6ab8('0x29')],function(_0x4eda0b){return{'name':_0x4eda0b[_0x6ab8('0x2a')],'type':_0x4eda0b[_0x6ab8('0x2b')][_0x6ab8('0x2c')]};});_0x14e822[_0x6ab8('0x2d')]=_[_0x6ab8('0x27')](_0x2f14ea,'name');_0x14e822['query']=_[_0x6ab8('0x2e')](_0x525687['query']);_0x14e822['filters']=_[_0x6ab8('0x2f')](_0x14e822[_0x6ab8('0x2d')],_0x14e822['query']);_0x79dbd3[_0x6ab8('0x30')]=_['intersection'](_0x14e822[_0x6ab8('0x2d')],qs[_0x6ab8('0x31')](_0x525687['query']['fields']));_0x79dbd3[_0x6ab8('0x30')]=_0x79dbd3[_0x6ab8('0x30')][_0x6ab8('0x32')]?_0x79dbd3[_0x6ab8('0x30')]:_0x14e822[_0x6ab8('0x2d')];if(!_0x525687[_0x6ab8('0x33')][_0x6ab8('0x34')](_0x6ab8('0x35'))){_0x79dbd3['limit']=qs[_0x6ab8('0x1d')](_0x525687[_0x6ab8('0x33')][_0x6ab8('0x1d')]);_0x79dbd3[_0x6ab8('0x1a')]=qs[_0x6ab8('0x1a')](_0x525687[_0x6ab8('0x33')]['offset']);}_0x79dbd3[_0x6ab8('0x36')]=qs[_0x6ab8('0x37')](_0x525687[_0x6ab8('0x33')]['sort']);_0x79dbd3['where']=qs[_0x6ab8('0x38')](_[_0x6ab8('0x39')](_0x525687[_0x6ab8('0x33')],_0x14e822[_0x6ab8('0x38')]),_0x2f14ea);if(_0x525687[_0x6ab8('0x33')]['filter']){_0x79dbd3['where']=_[_0x6ab8('0x3a')](_0x79dbd3['where'],{'$or':_[_0x6ab8('0x27')](_0x2f14ea,function(_0x9ca6ed){if(_0x9ca6ed['type']!=='VIRTUAL'){var _0x8d76aa={};_0x8d76aa[_0x9ca6ed[_0x6ab8('0x25')]]={'$like':'%'+_0x525687[_0x6ab8('0x33')][_0x6ab8('0x3b')]+'%'};return _0x8d76aa;}})});}_0x79dbd3=_[_0x6ab8('0x3a')]({},_0x79dbd3,_0x525687[_0x6ab8('0x3c')]);var _0xef0ce5={'where':_0x79dbd3['where']};return db['Cdr'][_0x6ab8('0x1c')](_0xef0ce5)[_0x6ab8('0x21')](function(_0x146f43){_0x3723a7[_0x6ab8('0x1c')]=_0x146f43;if(_0x525687['query'][_0x6ab8('0x3d')]){_0x79dbd3['include']=[{'all':!![]}];}return db['Cdr'][_0x6ab8('0x3e')](_0x79dbd3);})[_0x6ab8('0x21')](function(_0x45735d){_0x3723a7[_0x6ab8('0x3f')]=_0x45735d;return _0x3723a7;})[_0x6ab8('0x21')](respondWithFilteredResult(_0x4871e3,_0x79dbd3))[_0x6ab8('0x40')](handleError(_0x4871e3,null));};exports[_0x6ab8('0x41')]=function(_0xf3abb8,_0x2494c3){var _0x45c70d={'raw':!![],'where':{'id':_0xf3abb8[_0x6ab8('0x42')]['id']}},_0xc32c6e={};_0xc32c6e['model']=_[_0x6ab8('0x2e')](db[_0x6ab8('0x28')][_0x6ab8('0x29')]);_0xc32c6e[_0x6ab8('0x33')]=_['keys'](_0xf3abb8[_0x6ab8('0x33')]);_0xc32c6e['filters']=_[_0x6ab8('0x2f')](_0xc32c6e[_0x6ab8('0x2d')],_0xc32c6e['query']);_0x45c70d[_0x6ab8('0x30')]=_[_0x6ab8('0x2f')](_0xc32c6e['model'],qs[_0x6ab8('0x31')](_0xf3abb8[_0x6ab8('0x33')][_0x6ab8('0x31')]));_0x45c70d[_0x6ab8('0x30')]=_0x45c70d[_0x6ab8('0x30')]['length']?_0x45c70d['attributes']:_0xc32c6e['model'];if(_0xf3abb8[_0x6ab8('0x33')][_0x6ab8('0x3d')]){_0x45c70d['include']=[{'all':!![]}];}_0x45c70d=_[_0x6ab8('0x3a')]({},_0x45c70d,_0xf3abb8[_0x6ab8('0x3c')]);return db[_0x6ab8('0x28')][_0x6ab8('0x43')](_0x45c70d)[_0x6ab8('0x21')](handleEntityNotFound(_0x2494c3,null))[_0x6ab8('0x21')](respondWithResult(_0x2494c3,null))['catch'](handleError(_0x2494c3,null));};exports[_0x6ab8('0x44')]=function(_0x74de32,_0x4b00cc){return db[_0x6ab8('0x28')][_0x6ab8('0x44')](_0x74de32[_0x6ab8('0x45')],{})['then'](respondWithResult(_0x4b00cc,0xc9))['catch'](handleError(_0x4b00cc,null));};exports[_0x6ab8('0x46')]=function(_0x4c27fa,_0x31965e){if(_0x4c27fa['body']['id']){delete _0x4c27fa[_0x6ab8('0x45')]['id'];}return db[_0x6ab8('0x28')][_0x6ab8('0x43')]({'where':{'id':_0x4c27fa[_0x6ab8('0x42')]['id']}})[_0x6ab8('0x21')](handleEntityNotFound(_0x31965e,null))[_0x6ab8('0x21')](saveUpdates(_0x4c27fa['body'],null))['then'](respondWithResult(_0x31965e,null))['catch'](handleError(_0x31965e,null));};exports[_0x6ab8('0x22')]=function(_0x54708b,_0xce83a3){return db[_0x6ab8('0x28')][_0x6ab8('0x43')]({'where':{'id':_0x54708b[_0x6ab8('0x42')]['id']}})[_0x6ab8('0x21')](handleEntityNotFound(_0xce83a3,null))[_0x6ab8('0x21')](removeEntity(_0xce83a3,null))[_0x6ab8('0x40')](handleError(_0xce83a3,null));};exports[_0x6ab8('0x47')]=function(_0x4d4e88,_0x1a372b){return db[_0x6ab8('0x28')][_0x6ab8('0x47')]()[_0x6ab8('0x21')](respondWithResult(_0x1a372b,null))['catch'](handleError(_0x1a372b,null));}; \ No newline at end of file +var _0xfd0f=['moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','sendStatus','error','name','send','index','Cdr','rawAttributes','fieldName','type','key','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','map','VIRTUAL','options','findAll','catch','show','params','keys','intersection','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0xb4f654,_0x33ce4b){var _0x521323=function(_0x531016){while(--_0x531016){_0xb4f654['push'](_0xb4f654['shift']());}};_0x521323(++_0x33ce4b);}(_0xfd0f,0x1b8));var _0xffd0=function(_0x2e8f3c,_0x228eda){_0x2e8f3c=_0x2e8f3c-0x0;var _0x8db30=_0xfd0f[_0x2e8f3c];return _0x8db30;};'use strict';var emlformat=require(_0xffd0('0x0'));var rimraf=require(_0xffd0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xffd0('0x2'));var rp=require(_0xffd0('0x3'));var moment=require(_0xffd0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xffd0('0x5'));var util=require('util');var path=require(_0xffd0('0x6'));var sox=require(_0xffd0('0x7'));var csv=require(_0xffd0('0x8'));var ejs=require(_0xffd0('0x9'));var fs=require('fs');var fs_extra=require(_0xffd0('0xa'));var _=require(_0xffd0('0xb'));var squel=require(_0xffd0('0xc'));var crypto=require(_0xffd0('0xd'));var jsforce=require(_0xffd0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xffd0('0x8'));var querystring=require(_0xffd0('0xf'));var Papa=require(_0xffd0('0x10'));var Redis=require(_0xffd0('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xffd0('0x12'));var hardwareService=require(_0xffd0('0x13'));var logger=require(_0xffd0('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xffd0('0x15'));var licenseUtil=require(_0xffd0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa6e1ad,_0xaf12c1){_0xaf12c1=_0xaf12c1||0xcc;return function(_0x2ca16d){if(_0x2ca16d){return _0xa6e1ad['sendStatus'](_0xaf12c1);}return _0xa6e1ad[_0xffd0('0x17')](_0xaf12c1)[_0xffd0('0x18')]();};}function respondWithResult(_0x5be5aa,_0x3cf549){_0x3cf549=_0x3cf549||0xc8;return function(_0x48fc60){if(_0x48fc60){return _0x5be5aa['status'](_0x3cf549)[_0xffd0('0x19')](_0x48fc60);}};}function respondWithFilteredResult(_0x5c799c,_0x321ceb){return function(_0x2e030d){if(_0x2e030d){var _0x15e710=typeof _0x321ceb[_0xffd0('0x1a')]===_0xffd0('0x1b')&&typeof _0x321ceb['limit']==='undefined';var _0x285c52=_0x2e030d[_0xffd0('0x1c')];var _0x2e9463=_0x15e710?0x0:_0x321ceb[_0xffd0('0x1a')];var _0x409b90=_0x15e710?_0x2e030d[_0xffd0('0x1c')]:_0x321ceb[_0xffd0('0x1a')]+_0x321ceb[_0xffd0('0x1d')];var _0x684579;if(_0x409b90>=_0x285c52){_0x409b90=_0x285c52;_0x684579=0xc8;}else{_0x684579=0xce;}_0x5c799c[_0xffd0('0x17')](_0x684579);return _0x5c799c[_0xffd0('0x1e')](_0xffd0('0x1f'),_0x2e9463+'-'+_0x409b90+'/'+_0x285c52)[_0xffd0('0x19')](_0x2e030d);}return null;};}function patchUpdates(_0x19c523){return function(_0x3deed6){try{jsonpatch[_0xffd0('0x20')](_0x3deed6,_0x19c523,!![]);}catch(_0x5219ca){return BPromise['reject'](_0x5219ca);}return _0x3deed6[_0xffd0('0x21')]();};}function saveUpdates(_0x13c117,_0x4fbb72){return function(_0x4f3cb3){if(_0x4f3cb3){return _0x4f3cb3[_0xffd0('0x22')](_0x13c117)['then'](function(_0x10467e){return _0x10467e;});}return null;};}function removeEntity(_0x329864,_0x2c8d64){return function(_0x38f25f){if(_0x38f25f){return _0x38f25f[_0xffd0('0x23')]()[_0xffd0('0x24')](function(){_0x329864[_0xffd0('0x17')](0xcc)[_0xffd0('0x18')]();});}};}function handleEntityNotFound(_0x2e3046,_0x169036){return function(_0x278ba8){if(!_0x278ba8){_0x2e3046[_0xffd0('0x25')](0x194);}return _0x278ba8;};}function handleError(_0x24f135,_0x481c52){_0x481c52=_0x481c52||0x1f4;return function(_0x480322){logger[_0xffd0('0x26')](_0x480322['stack']);if(_0x480322['name']){delete _0x480322[_0xffd0('0x27')];}_0x24f135[_0xffd0('0x17')](_0x481c52)[_0xffd0('0x28')](_0x480322);};}exports[_0xffd0('0x29')]=function(_0x3f5423,_0x22c7fb){var _0x4f8d9c={},_0x14ded1={},_0x4e7367={'count':0x0,'rows':[]};var _0x5c4adb=_['map'](db[_0xffd0('0x2a')][_0xffd0('0x2b')],function(_0x3b71ac){return{'name':_0x3b71ac[_0xffd0('0x2c')],'type':_0x3b71ac[_0xffd0('0x2d')][_0xffd0('0x2e')]};});_0x14ded1['model']=_['map'](_0x5c4adb,'name');_0x14ded1[_0xffd0('0x2f')]=_['keys'](_0x3f5423[_0xffd0('0x2f')]);_0x14ded1[_0xffd0('0x30')]=_['intersection'](_0x14ded1[_0xffd0('0x31')],_0x14ded1['query']);_0x4f8d9c['attributes']=_['intersection'](_0x14ded1[_0xffd0('0x31')],qs[_0xffd0('0x32')](_0x3f5423[_0xffd0('0x2f')][_0xffd0('0x32')]));_0x4f8d9c[_0xffd0('0x33')]=_0x4f8d9c['attributes'][_0xffd0('0x34')]?_0x4f8d9c[_0xffd0('0x33')]:_0x14ded1['model'];if(!_0x3f5423[_0xffd0('0x2f')][_0xffd0('0x35')](_0xffd0('0x36'))){_0x4f8d9c[_0xffd0('0x1d')]=qs[_0xffd0('0x1d')](_0x3f5423[_0xffd0('0x2f')]['limit']);_0x4f8d9c[_0xffd0('0x1a')]=qs[_0xffd0('0x1a')](_0x3f5423['query'][_0xffd0('0x1a')]);}_0x4f8d9c[_0xffd0('0x37')]=qs['sort'](_0x3f5423[_0xffd0('0x2f')][_0xffd0('0x38')]);_0x4f8d9c['where']=qs[_0xffd0('0x30')](_['pick'](_0x3f5423[_0xffd0('0x2f')],_0x14ded1[_0xffd0('0x30')]),_0x5c4adb);if(_0x3f5423['query'][_0xffd0('0x39')]){_0x4f8d9c[_0xffd0('0x3a')]=_[_0xffd0('0x3b')](_0x4f8d9c[_0xffd0('0x3a')],{'$or':_[_0xffd0('0x3c')](_0x5c4adb,function(_0x158efc){if(_0x158efc[_0xffd0('0x2d')]!==_0xffd0('0x3d')){var _0x1cdd8f={};_0x1cdd8f[_0x158efc[_0xffd0('0x27')]]={'$like':'%'+_0x3f5423[_0xffd0('0x2f')][_0xffd0('0x39')]+'%'};return _0x1cdd8f;}})});}_0x4f8d9c=_[_0xffd0('0x3b')]({},_0x4f8d9c,_0x3f5423[_0xffd0('0x3e')]);var _0x5aa4d3={'where':_0x4f8d9c[_0xffd0('0x3a')]};return db[_0xffd0('0x2a')]['count'](_0x5aa4d3)[_0xffd0('0x24')](function(_0xea6cbd){_0x4e7367[_0xffd0('0x1c')]=_0xea6cbd;if(_0x3f5423[_0xffd0('0x2f')]['includeAll']){_0x4f8d9c['include']=[{'all':!![]}];}return db[_0xffd0('0x2a')][_0xffd0('0x3f')](_0x4f8d9c);})[_0xffd0('0x24')](function(_0xc0aa){_0x4e7367['rows']=_0xc0aa;return _0x4e7367;})[_0xffd0('0x24')](respondWithFilteredResult(_0x22c7fb,_0x4f8d9c))[_0xffd0('0x40')](handleError(_0x22c7fb,null));};exports[_0xffd0('0x41')]=function(_0x3bd3e3,_0x237a71){var _0x46833e={'raw':!![],'where':{'id':_0x3bd3e3[_0xffd0('0x42')]['id']}},_0x9558c0={};_0x9558c0[_0xffd0('0x31')]=_[_0xffd0('0x43')](db[_0xffd0('0x2a')][_0xffd0('0x2b')]);_0x9558c0[_0xffd0('0x2f')]=_[_0xffd0('0x43')](_0x3bd3e3[_0xffd0('0x2f')]);_0x9558c0[_0xffd0('0x30')]=_[_0xffd0('0x44')](_0x9558c0[_0xffd0('0x31')],_0x9558c0[_0xffd0('0x2f')]);_0x46833e[_0xffd0('0x33')]=_[_0xffd0('0x44')](_0x9558c0['model'],qs[_0xffd0('0x32')](_0x3bd3e3[_0xffd0('0x2f')][_0xffd0('0x32')]));_0x46833e[_0xffd0('0x33')]=_0x46833e[_0xffd0('0x33')][_0xffd0('0x34')]?_0x46833e[_0xffd0('0x33')]:_0x9558c0[_0xffd0('0x31')];if(_0x3bd3e3[_0xffd0('0x2f')]['includeAll']){_0x46833e[_0xffd0('0x45')]=[{'all':!![]}];}_0x46833e=_[_0xffd0('0x3b')]({},_0x46833e,_0x3bd3e3[_0xffd0('0x3e')]);return db[_0xffd0('0x2a')][_0xffd0('0x46')](_0x46833e)['then'](handleEntityNotFound(_0x237a71,null))['then'](respondWithResult(_0x237a71,null))['catch'](handleError(_0x237a71,null));};exports[_0xffd0('0x47')]=function(_0xcae782,_0x5b3515){return db[_0xffd0('0x2a')][_0xffd0('0x47')](_0xcae782[_0xffd0('0x48')],{})[_0xffd0('0x24')](respondWithResult(_0x5b3515,0xc9))[_0xffd0('0x40')](handleError(_0x5b3515,null));};exports[_0xffd0('0x22')]=function(_0x3b70a7,_0x2c0ffd){if(_0x3b70a7[_0xffd0('0x48')]['id']){delete _0x3b70a7[_0xffd0('0x48')]['id'];}return db[_0xffd0('0x2a')][_0xffd0('0x46')]({'where':{'id':_0x3b70a7[_0xffd0('0x42')]['id']}})['then'](handleEntityNotFound(_0x2c0ffd,null))['then'](saveUpdates(_0x3b70a7[_0xffd0('0x48')],null))[_0xffd0('0x24')](respondWithResult(_0x2c0ffd,null))[_0xffd0('0x40')](handleError(_0x2c0ffd,null));};exports['destroy']=function(_0x35b42e,_0x4bde7d){return db[_0xffd0('0x2a')][_0xffd0('0x46')]({'where':{'id':_0x35b42e[_0xffd0('0x42')]['id']}})[_0xffd0('0x24')](handleEntityNotFound(_0x4bde7d,null))['then'](removeEntity(_0x4bde7d,null))['catch'](handleError(_0x4bde7d,null));};exports['describe']=function(_0x2a0302,_0x24a18d){return db[_0xffd0('0x2a')][_0xffd0('0x49')]()[_0xffd0('0x24')](respondWithResult(_0x24a18d,null))[_0xffd0('0x40')](handleError(_0x24a18d,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 791b121..9960df1 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(_0x2144c5,_0x2c6a84){var _0x23b17c=function(_0x55110a){while(--_0x55110a){_0x2144c5['push'](_0x2144c5['shift']());}};_0x23b17c(++_0x2c6a84);}(_0x7a54,0x106));var _0x47a5=function(_0x4575fa,_0x43f15b){_0x4575fa=_0x4575fa-0x0;var _0x4194d3=_0x7a54[_0x4575fa];return _0x4194d3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x5087ea,_0x2330fc){var _0x4f1ffd=function(_0x406932){while(--_0x406932){_0x5087ea['push'](_0x5087ea['shift']());}};_0x4f1ffd(++_0x2330fc);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 9bec3c7..a0b525f 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 _0xfbc9=['message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','Cdr,\x20%s,\x20%s'];(function(_0x2801ce,_0x56a486){var _0x6b7f1d=function(_0x53b7f1){while(--_0x53b7f1){_0x2801ce['push'](_0x2801ce['shift']());}};_0x6b7f1d(++_0x56a486);}(_0xfbc9,0x137));var _0x9fbc=function(_0x51b5a2,_0x2f25ea){_0x51b5a2=_0x51b5a2-0x0;var _0x501cb1=_0xfbc9[_0x51b5a2];return _0x501cb1;};'use strict';var _=require('lodash');var util=require(_0x9fbc('0x0'));var moment=require(_0x9fbc('0x1'));var BPromise=require('bluebird');var rs=require(_0x9fbc('0x2'));var fs=require('fs');var Redis=require(_0x9fbc('0x3'));var db=require(_0x9fbc('0x4'))['db'];var utils=require(_0x9fbc('0x5'));var logger=require(_0x9fbc('0x6'))(_0x9fbc('0x7'));var config=require(_0x9fbc('0x8'));var jayson=require(_0x9fbc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a6fea,_0x365b23,_0x24659d){return new BPromise(function(_0x2d6ad5,_0x1c627e){return client[_0x9fbc('0xa')](_0x1a6fea,_0x24659d)[_0x9fbc('0xb')](function(_0x4a2bd3){logger[_0x9fbc('0xc')]('Cdr,\x20%s,\x20%s',_0x365b23,_0x9fbc('0xd'));logger[_0x9fbc('0xe')](_0x9fbc('0xf'),_0x365b23,_0x9fbc('0xd'),JSON[_0x9fbc('0x10')](_0x4a2bd3));if(_0x4a2bd3[_0x9fbc('0x11')]){if(_0x4a2bd3[_0x9fbc('0x11')]['code']===0x1f4){logger[_0x9fbc('0x11')](_0x9fbc('0x12'),_0x365b23,_0x4a2bd3[_0x9fbc('0x11')][_0x9fbc('0x13')]);return _0x1c627e(_0x4a2bd3[_0x9fbc('0x11')][_0x9fbc('0x13')]);}logger[_0x9fbc('0x11')](_0x9fbc('0x12'),_0x365b23,_0x4a2bd3['error'][_0x9fbc('0x13')]);return _0x2d6ad5(_0x4a2bd3[_0x9fbc('0x11')]['message']);}else{logger['info'](_0x9fbc('0x12'),_0x365b23,_0x9fbc('0xd'));_0x2d6ad5(_0x4a2bd3[_0x9fbc('0x14')]['message']);}})[_0x9fbc('0x15')](function(_0x263a31){logger[_0x9fbc('0x11')](_0x9fbc('0x12'),_0x365b23,_0x263a31);_0x1c627e(_0x263a31);});});} \ No newline at end of file +var _0xd68f=['message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x5405cc,_0x4fa564){var _0x367541=function(_0x27362d){while(--_0x27362d){_0x5405cc['push'](_0x5405cc['shift']());}};_0x367541(++_0x4fa564);}(_0xd68f,0x15c));var _0xfd68=function(_0x1ef5a3,_0x3d44d8){_0x1ef5a3=_0x1ef5a3-0x0;var _0x50c3a3=_0xd68f[_0x1ef5a3];return _0x50c3a3;};'use strict';var _=require('lodash');var util=require(_0xfd68('0x0'));var moment=require('moment');var BPromise=require(_0xfd68('0x1'));var rs=require(_0xfd68('0x2'));var fs=require('fs');var Redis=require(_0xfd68('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd68('0x4'));var logger=require('../../config/logger')(_0xfd68('0x5'));var config=require(_0xfd68('0x6'));var jayson=require(_0xfd68('0x7'));var client=jayson[_0xfd68('0x8')][_0xfd68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5afde6,_0x2a82a8,_0x5a795f){return new BPromise(function(_0x112008,_0x2860dd){return client[_0xfd68('0xa')](_0x5afde6,_0x5a795f)[_0xfd68('0xb')](function(_0x28ccff){logger[_0xfd68('0xc')](_0xfd68('0xd'),_0x2a82a8,_0xfd68('0xe'));logger[_0xfd68('0xf')](_0xfd68('0x10'),_0x2a82a8,_0xfd68('0xe'),JSON[_0xfd68('0x11')](_0x28ccff));if(_0x28ccff['error']){if(_0x28ccff['error'][_0xfd68('0x12')]===0x1f4){logger[_0xfd68('0x13')](_0xfd68('0xd'),_0x2a82a8,_0x28ccff['error'][_0xfd68('0x14')]);return _0x2860dd(_0x28ccff['error'][_0xfd68('0x14')]);}logger[_0xfd68('0x13')](_0xfd68('0xd'),_0x2a82a8,_0x28ccff['error'][_0xfd68('0x14')]);return _0x112008(_0x28ccff['error'][_0xfd68('0x14')]);}else{logger[_0xfd68('0xc')](_0xfd68('0xd'),_0x2a82a8,_0xfd68('0xe'));_0x112008(_0x28ccff[_0xfd68('0x15')]['message']);}})[_0xfd68('0x16')](function(_0x3a0ea9){logger[_0xfd68('0x13')](_0xfd68('0xd'),_0x2a82a8,_0x3a0ea9);_0x2860dd(_0x3a0ea9);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 2b31bd4..d2d5f8c 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x3a3afe,_0x15da25){var _0x262dab=function(_0x364a7f){while(--_0x364a7f){_0x3a3afe['push'](_0x3a3afe['shift']());}};_0x262dab(++_0x15da25);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0xa3463d,_0x32f8da){var _0x50fd67=function(_0xb984fd){while(--_0xb984fd){_0xa3463d['push'](_0xa3463d['shift']());}};_0x50fd67(++_0x32f8da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 61ffe17..f29c825 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 _0xba30=['TEXT','STRING','*,*,*,*','sequelize','exports','noop'];(function(_0x5b35ee,_0xc2726b){var _0x54eb10=function(_0x2470f3){while(--_0x2470f3){_0x5b35ee['push'](_0x5b35ee['shift']());}};_0x54eb10(++_0xc2726b);}(_0xba30,0x189));var _0x0ba3=function(_0x4258c7,_0x3fec4c){_0x4258c7=_0x4258c7-0x0;var _0x3c5d58=_0xba30[_0x4258c7];return _0x3c5d58;};'use strict';var Sequelize=require(_0x0ba3('0x0'));module[_0x0ba3('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0ba3('0x2')},'appdata':{'type':Sequelize[_0x0ba3('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0ba3('0x4')],'defaultValue':_0x0ba3('0x5')}}; \ No newline at end of file +var _0xff9f=['INTEGER','STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x575057,_0x14baf3){var _0x49dbc8=function(_0x23599a){while(--_0x23599a){_0x575057['push'](_0x575057['shift']());}};_0x49dbc8(++_0x14baf3);}(_0xff9f,0x130));var _0xfff9=function(_0x3b3210,_0x25e8ed){_0x3b3210=_0x3b3210-0x0;var _0x5b5484=_0xff9f[_0x3b3210];return _0x5b5484;};'use strict';var Sequelize=require(_0xfff9('0x0'));module[_0xfff9('0x1')]={'priority':{'type':Sequelize[_0xfff9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xfff9('0x3')],'allowNull':![],'defaultValue':_0xfff9('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xfff9('0x3')]},'interval':{'type':Sequelize[_0xfff9('0x3')],'defaultValue':_0xfff9('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 5e5c480..8ef57bf 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 _0x282b=['rawAttributes','query','filters','attributes','intersection','length','include','merge','find','body','ChatApplication','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','error','name','send','params','model','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x282b,0xec));var _0xb282=function(_0x37474e,_0x463cad){_0x37474e=_0x37474e-0x0;var _0x200d1a=_0x282b[_0x37474e];return _0x200d1a;};'use strict';var emlformat=require(_0xb282('0x0'));var rimraf=require(_0xb282('0x1'));var zipdir=require(_0xb282('0x2'));var jsonpatch=require(_0xb282('0x3'));var rp=require(_0xb282('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb282('0x5'));var util=require('util');var path=require(_0xb282('0x6'));var sox=require(_0xb282('0x7'));var csv=require(_0xb282('0x8'));var ejs=require(_0xb282('0x9'));var fs=require('fs');var fs_extra=require(_0xb282('0xa'));var _=require(_0xb282('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb282('0xc'));var deskjs=require(_0xb282('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb282('0xe'));var Papa=require(_0xb282('0xf'));var Redis=require(_0xb282('0x10'));var authService=require(_0xb282('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb282('0x12'));var logger=require(_0xb282('0x13'))(_0xb282('0x14'));var utils=require(_0xb282('0x15'));var config=require(_0xb282('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x338bdb,_0xc08746){_0xc08746=_0xc08746||0xcc;return function(_0x40d7b8){if(_0x40d7b8){return _0x338bdb[_0xb282('0x17')](_0xc08746);}return _0x338bdb[_0xb282('0x18')](_0xc08746)['end']();};}function respondWithResult(_0x34c595,_0x5adf7f){_0x5adf7f=_0x5adf7f||0xc8;return function(_0xe1d53){if(_0xe1d53){return _0x34c595[_0xb282('0x18')](_0x5adf7f)['json'](_0xe1d53);}};}function respondWithFilteredResult(_0x525cfa,_0x5bc7c3){return function(_0x13cea1){if(_0x13cea1){var _0x350676=typeof _0x5bc7c3[_0xb282('0x19')]===_0xb282('0x1a')&&typeof _0x5bc7c3[_0xb282('0x1b')]==='undefined';var _0x191a31=_0x13cea1[_0xb282('0x1c')];var _0xca5f12=_0x350676?0x0:_0x5bc7c3[_0xb282('0x19')];var _0x3f8a3f=_0x350676?_0x13cea1['count']:_0x5bc7c3['offset']+_0x5bc7c3[_0xb282('0x1b')];var _0x2cdeb1;if(_0x3f8a3f>=_0x191a31){_0x3f8a3f=_0x191a31;_0x2cdeb1=0xc8;}else{_0x2cdeb1=0xce;}_0x525cfa['status'](_0x2cdeb1);return _0x525cfa[_0xb282('0x1d')](_0xb282('0x1e'),_0xca5f12+'-'+_0x3f8a3f+'/'+_0x191a31)[_0xb282('0x1f')](_0x13cea1);}return null;};}function patchUpdates(_0x438dbe){return function(_0x1c3084){try{jsonpatch['apply'](_0x1c3084,_0x438dbe,!![]);}catch(_0x1de407){return BPromise[_0xb282('0x20')](_0x1de407);}return _0x1c3084[_0xb282('0x21')]();};}function saveUpdates(_0x4b79d7,_0x437d66){return function(_0x2a7ef8){if(_0x2a7ef8){return _0x2a7ef8[_0xb282('0x22')](_0x4b79d7)[_0xb282('0x23')](function(_0x680095){return _0x680095;});}return null;};}function removeEntity(_0x56645f,_0x4d624f){return function(_0x360f15){if(_0x360f15){return _0x360f15[_0xb282('0x24')]()['then'](function(){_0x56645f['status'](0xcc)[_0xb282('0x25')]();});}};}function handleEntityNotFound(_0x114f77,_0x3451e5){return function(_0x3c4018){if(!_0x3c4018){_0x114f77[_0xb282('0x17')](0x194);}return _0x3c4018;};}function handleError(_0x2b1303,_0x5b1d3d){_0x5b1d3d=_0x5b1d3d||0x1f4;return function(_0xa0d7fb){logger[_0xb282('0x26')](_0xa0d7fb['stack']);if(_0xa0d7fb[_0xb282('0x27')]){delete _0xa0d7fb[_0xb282('0x27')];}_0x2b1303[_0xb282('0x18')](_0x5b1d3d)[_0xb282('0x28')](_0xa0d7fb);};}exports['show']=function(_0x1520b1,_0x1fb89f){var _0xe337b8={'raw':!![],'where':{'id':_0x1520b1[_0xb282('0x29')]['id']}},_0x433ad5={};_0x433ad5[_0xb282('0x2a')]=_[_0xb282('0x2b')](db['ChatApplication'][_0xb282('0x2c')]);_0x433ad5[_0xb282('0x2d')]=_[_0xb282('0x2b')](_0x1520b1[_0xb282('0x2d')]);_0x433ad5[_0xb282('0x2e')]=_['intersection'](_0x433ad5[_0xb282('0x2a')],_0x433ad5['query']);_0xe337b8[_0xb282('0x2f')]=_[_0xb282('0x30')](_0x433ad5[_0xb282('0x2a')],qs['fields'](_0x1520b1[_0xb282('0x2d')]['fields']));_0xe337b8[_0xb282('0x2f')]=_0xe337b8[_0xb282('0x2f')][_0xb282('0x31')]?_0xe337b8[_0xb282('0x2f')]:_0x433ad5[_0xb282('0x2a')];if(_0x1520b1[_0xb282('0x2d')]['includeAll']){_0xe337b8[_0xb282('0x32')]=[{'all':!![]}];}_0xe337b8=_[_0xb282('0x33')]({},_0xe337b8,_0x1520b1['options']);return db['ChatApplication'][_0xb282('0x34')](_0xe337b8)[_0xb282('0x23')](handleEntityNotFound(_0x1fb89f,null))[_0xb282('0x23')](respondWithResult(_0x1fb89f,null))['catch'](handleError(_0x1fb89f,null));};exports['update']=function(_0x4ad54b,_0x27073b){if(_0x4ad54b[_0xb282('0x35')]['id']){delete _0x4ad54b[_0xb282('0x35')]['id'];}return db[_0xb282('0x36')][_0xb282('0x34')]({'where':{'id':_0x4ad54b[_0xb282('0x29')]['id']}})[_0xb282('0x23')](handleEntityNotFound(_0x27073b,null))['then'](saveUpdates(_0x4ad54b[_0xb282('0x35')],null))['then'](respondWithResult(_0x27073b,null))[_0xb282('0x37')](handleError(_0x27073b,null));};exports[_0xb282('0x24')]=function(_0x3514cf,_0x4f6cf1){return db[_0xb282('0x36')]['find']({'where':{'id':_0x3514cf[_0xb282('0x29')]['id']}})[_0xb282('0x23')](handleEntityNotFound(_0x4f6cf1,null))[_0xb282('0x23')](removeEntity(_0x4f6cf1,null))[_0xb282('0x37')](handleError(_0x4f6cf1,null));}; \ No newline at end of file +var _0x2083=['destroy','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','attributes','fields','length','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','update','then'];(function(_0x480be1,_0x2d6b76){var _0x2e042a=function(_0x3d8216){while(--_0x3d8216){_0x480be1['push'](_0x480be1['shift']());}};_0x2e042a(++_0x2d6b76);}(_0x2083,0x137));var _0x3208=function(_0x520875,_0x12052f){_0x520875=_0x520875-0x0;var _0x139d00=_0x2083[_0x520875];return _0x139d00;};'use strict';var emlformat=require(_0x3208('0x0'));var rimraf=require(_0x3208('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3208('0x2'));var rp=require(_0x3208('0x3'));var moment=require(_0x3208('0x4'));var BPromise=require(_0x3208('0x5'));var Mustache=require(_0x3208('0x6'));var util=require(_0x3208('0x7'));var path=require(_0x3208('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3208('0x9'));var _=require(_0x3208('0xa'));var squel=require(_0x3208('0xb'));var crypto=require(_0x3208('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3208('0xd'));var toCsv=require(_0x3208('0xe'));var querystring=require(_0x3208('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3208('0x10'));var qs=require(_0x3208('0x11'));var as=require(_0x3208('0x12'));var hardwareService=require(_0x3208('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3208('0x14'));var config=require(_0x3208('0x15'));var licenseUtil=require(_0x3208('0x16'));var db=require(_0x3208('0x17'))['db'];function respondWithStatusCode(_0x174620,_0x394883){_0x394883=_0x394883||0xcc;return function(_0xf232e5){if(_0xf232e5){return _0x174620[_0x3208('0x18')](_0x394883);}return _0x174620[_0x3208('0x19')](_0x394883)[_0x3208('0x1a')]();};}function respondWithResult(_0x3deca8,_0x14c24f){_0x14c24f=_0x14c24f||0xc8;return function(_0xa5067){if(_0xa5067){return _0x3deca8[_0x3208('0x19')](_0x14c24f)['json'](_0xa5067);}};}function respondWithFilteredResult(_0x2f1eaf,_0x153cf8){return function(_0x41cdcf){if(_0x41cdcf){var _0x1ef359=typeof _0x153cf8[_0x3208('0x1b')]==='undefined'&&typeof _0x153cf8[_0x3208('0x1c')]===_0x3208('0x1d');var _0x4c1e4d=_0x41cdcf[_0x3208('0x1e')];var _0x3590c5=_0x1ef359?0x0:_0x153cf8[_0x3208('0x1b')];var _0x28e291=_0x1ef359?_0x41cdcf[_0x3208('0x1e')]:_0x153cf8[_0x3208('0x1b')]+_0x153cf8['limit'];var _0x3d44bd;if(_0x28e291>=_0x4c1e4d){_0x28e291=_0x4c1e4d;_0x3d44bd=0xc8;}else{_0x3d44bd=0xce;}_0x2f1eaf[_0x3208('0x19')](_0x3d44bd);return _0x2f1eaf[_0x3208('0x1f')](_0x3208('0x20'),_0x3590c5+'-'+_0x28e291+'/'+_0x4c1e4d)[_0x3208('0x21')](_0x41cdcf);}return null;};}function patchUpdates(_0x46b227){return function(_0x468cca){try{jsonpatch['apply'](_0x468cca,_0x46b227,!![]);}catch(_0x42d97a){return BPromise[_0x3208('0x22')](_0x42d97a);}return _0x468cca['save']();};}function saveUpdates(_0x28d665,_0x361d1c){return function(_0x3c6e34){if(_0x3c6e34){return _0x3c6e34[_0x3208('0x23')](_0x28d665)[_0x3208('0x24')](function(_0x2ce30e){return _0x2ce30e;});}return null;};}function removeEntity(_0x4673c2,_0x523d75){return function(_0x54aa98){if(_0x54aa98){return _0x54aa98[_0x3208('0x25')]()[_0x3208('0x24')](function(){_0x4673c2[_0x3208('0x19')](0xcc)[_0x3208('0x1a')]();});}};}function handleEntityNotFound(_0x14e491,_0x21dc00){return function(_0x47a021){if(!_0x47a021){_0x14e491[_0x3208('0x18')](0x194);}return _0x47a021;};}function handleError(_0x125ae3,_0x270c69){_0x270c69=_0x270c69||0x1f4;return function(_0x10e471){logger['error'](_0x10e471[_0x3208('0x26')]);if(_0x10e471[_0x3208('0x27')]){delete _0x10e471[_0x3208('0x27')];}_0x125ae3['status'](_0x270c69)[_0x3208('0x28')](_0x10e471);};}exports[_0x3208('0x29')]=function(_0xf9e10c,_0x22b561){var _0x283193={'raw':!![],'where':{'id':_0xf9e10c[_0x3208('0x2a')]['id']}},_0x2b153f={};_0x2b153f[_0x3208('0x2b')]=_[_0x3208('0x2c')](db[_0x3208('0x2d')][_0x3208('0x2e')]);_0x2b153f[_0x3208('0x2f')]=_[_0x3208('0x2c')](_0xf9e10c[_0x3208('0x2f')]);_0x2b153f['filters']=_['intersection'](_0x2b153f[_0x3208('0x2b')],_0x2b153f[_0x3208('0x2f')]);_0x283193[_0x3208('0x30')]=_['intersection'](_0x2b153f[_0x3208('0x2b')],qs[_0x3208('0x31')](_0xf9e10c['query'][_0x3208('0x31')]));_0x283193[_0x3208('0x30')]=_0x283193[_0x3208('0x30')][_0x3208('0x32')]?_0x283193[_0x3208('0x30')]:_0x2b153f[_0x3208('0x2b')];if(_0xf9e10c[_0x3208('0x2f')][_0x3208('0x33')]){_0x283193[_0x3208('0x34')]=[{'all':!![]}];}_0x283193=_[_0x3208('0x35')]({},_0x283193,_0xf9e10c[_0x3208('0x36')]);return db[_0x3208('0x2d')][_0x3208('0x37')](_0x283193)['then'](handleEntityNotFound(_0x22b561,null))[_0x3208('0x24')](respondWithResult(_0x22b561,null))[_0x3208('0x38')](handleError(_0x22b561,null));};exports['update']=function(_0x93b8cd,_0x17f0f6){if(_0x93b8cd[_0x3208('0x39')]['id']){delete _0x93b8cd[_0x3208('0x39')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x93b8cd[_0x3208('0x2a')]['id']}})['then'](handleEntityNotFound(_0x17f0f6,null))[_0x3208('0x24')](saveUpdates(_0x93b8cd[_0x3208('0x39')],null))[_0x3208('0x24')](respondWithResult(_0x17f0f6,null))[_0x3208('0x38')](handleError(_0x17f0f6,null));};exports[_0x3208('0x25')]=function(_0x1588f4,_0x7544fc){return db[_0x3208('0x2d')][_0x3208('0x37')]({'where':{'id':_0x1588f4['params']['id']}})[_0x3208('0x24')](handleEntityNotFound(_0x7544fc,null))['then'](removeEntity(_0x7544fc,null))[_0x3208('0x38')](handleError(_0x7544fc,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index c568c1e..46543f0 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 _0x0c48=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatApplication.attributes','exports','define','ChatApplication','chat_applications'];(function(_0x15ce40,_0x3df9af){var _0xedf0d9=function(_0x37a96a){while(--_0x37a96a){_0x15ce40['push'](_0x15ce40['shift']());}};_0xedf0d9(++_0x3df9af);}(_0x0c48,0xd3));var _0x80c4=function(_0x3d35e5,_0x44b351){_0x3d35e5=_0x3d35e5-0x0;var _0xf9e901=_0x0c48[_0x3d35e5];return _0xf9e901;};'use strict';var _=require(_0x80c4('0x0'));var util=require(_0x80c4('0x1'));var logger=require(_0x80c4('0x2'))(_0x80c4('0x3'));var moment=require(_0x80c4('0x4'));var BPromise=require(_0x80c4('0x5'));var rp=require(_0x80c4('0x6'));var fs=require('fs');var path=require(_0x80c4('0x7'));var rimraf=require(_0x80c4('0x8'));var config=require('../../config/environment');var attributes=require(_0x80c4('0x9'));module[_0x80c4('0xa')]=function(_0x2ab2bc,_0x1c5753){return _0x2ab2bc[_0x80c4('0xb')](_0x80c4('0xc'),attributes,{'tableName':_0x80c4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x80c4('0xe')});}; \ No newline at end of file +var _0xb07f=['path','rimraf','../../config/environment','./chatApplication.attributes','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb07f,0x109));var _0xfb07=function(_0x5ec686,_0x45adfe){_0x5ec686=_0x5ec686-0x0;var _0x366ba2=_0xb07f[_0x5ec686];return _0x366ba2;};'use strict';var _=require(_0xfb07('0x0'));var util=require(_0xfb07('0x1'));var logger=require(_0xfb07('0x2'))(_0xfb07('0x3'));var moment=require(_0xfb07('0x4'));var BPromise=require(_0xfb07('0x5'));var rp=require(_0xfb07('0x6'));var fs=require('fs');var path=require(_0xfb07('0x7'));var rimraf=require(_0xfb07('0x8'));var config=require(_0xfb07('0x9'));var attributes=require(_0xfb07('0xa'));module['exports']=function(_0x3c79a9,_0x934f98){return _0x3c79a9[_0xfb07('0xb')](_0xfb07('0xc'),attributes,{'tableName':_0xfb07('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfb07('0xe'),'collate':_0xfb07('0xf')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index f62e448..64bd69b 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 _0x5df1=['../../config/utils','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','message','ChatApplication,\x20%s,\x20%s','catch','bluebird','randomstring','ioredis'];(function(_0x594d9d,_0x264beb){var _0x483050=function(_0x533812){while(--_0x533812){_0x594d9d['push'](_0x594d9d['shift']());}};_0x483050(++_0x264beb);}(_0x5df1,0x140));var _0x15df=function(_0x566733,_0x490df8){_0x566733=_0x566733-0x0;var _0x4a3fe9=_0x5df1[_0x566733];return _0x4a3fe9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x15df('0x0'));var rs=require(_0x15df('0x1'));var fs=require('fs');var Redis=require(_0x15df('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x15df('0x3'));var logger=require('../../config/logger')(_0x15df('0x4'));var config=require('../../config/environment');var jayson=require(_0x15df('0x5'));var client=jayson['client'][_0x15df('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3dedba,_0x40caec,_0xadcdfe){return new BPromise(function(_0xfb82f2,_0x305e26){return client[_0x15df('0x7')](_0x3dedba,_0xadcdfe)[_0x15df('0x8')](function(_0x278774){logger[_0x15df('0x9')]('ChatApplication,\x20%s,\x20%s',_0x40caec,_0x15df('0xa'));logger[_0x15df('0xb')](_0x15df('0xc'),_0x40caec,_0x15df('0xa'),JSON['stringify'](_0x278774));if(_0x278774[_0x15df('0xd')]){if(_0x278774[_0x15df('0xd')]['code']===0x1f4){logger[_0x15df('0xd')]('ChatApplication,\x20%s,\x20%s',_0x40caec,_0x278774[_0x15df('0xd')][_0x15df('0xe')]);return _0x305e26(_0x278774[_0x15df('0xd')]['message']);}logger['error'](_0x15df('0xf'),_0x40caec,_0x278774[_0x15df('0xd')][_0x15df('0xe')]);return _0xfb82f2(_0x278774[_0x15df('0xd')][_0x15df('0xe')]);}else{logger[_0x15df('0x9')](_0x15df('0xf'),_0x40caec,'request\x20sent');_0xfb82f2(_0x278774['result']['message']);}})[_0x15df('0x10')](function(_0xcbc58c){logger['error']('ChatApplication,\x20%s,\x20%s',_0x40caec,_0xcbc58c);_0x305e26(_0xcbc58c);});});} \ No newline at end of file +var _0x39ed=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','error','ChatApplication,\x20%s,\x20%s','message','info','result','util'];(function(_0xc9f76d,_0x5f0387){var _0x378ed9=function(_0x13d37d){while(--_0x13d37d){_0xc9f76d['push'](_0xc9f76d['shift']());}};_0x378ed9(++_0x5f0387);}(_0x39ed,0x1c7));var _0xd39e=function(_0x42f319,_0x3f7841){_0x42f319=_0x42f319-0x0;var _0x202dc0=_0x39ed[_0x42f319];return _0x202dc0;};'use strict';var _=require('lodash');var util=require(_0xd39e('0x0'));var moment=require(_0xd39e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd39e('0x2'));var db=require(_0xd39e('0x3'))['db'];var utils=require(_0xd39e('0x4'));var logger=require(_0xd39e('0x5'))(_0xd39e('0x6'));var config=require(_0xd39e('0x7'));var jayson=require(_0xd39e('0x8'));var client=jayson[_0xd39e('0x9')][_0xd39e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d23a7,_0x52dd02,_0x356ebe){return new BPromise(function(_0x46c656,_0x31d316){return client[_0xd39e('0xb')](_0x3d23a7,_0x356ebe)[_0xd39e('0xc')](function(_0x380264){logger['info']('ChatApplication,\x20%s,\x20%s',_0x52dd02,'request\x20sent');logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x52dd02,_0xd39e('0xd'),JSON['stringify'](_0x380264));if(_0x380264[_0xd39e('0xe')]){if(_0x380264[_0xd39e('0xe')]['code']===0x1f4){logger[_0xd39e('0xe')](_0xd39e('0xf'),_0x52dd02,_0x380264[_0xd39e('0xe')][_0xd39e('0x10')]);return _0x31d316(_0x380264['error'][_0xd39e('0x10')]);}logger[_0xd39e('0xe')](_0xd39e('0xf'),_0x52dd02,_0x380264['error']['message']);return _0x46c656(_0x380264['error'][_0xd39e('0x10')]);}else{logger[_0xd39e('0x11')]('ChatApplication,\x20%s,\x20%s',_0x52dd02,'request\x20sent');_0x46c656(_0x380264[_0xd39e('0x12')][_0xd39e('0x10')]);}})['catch'](function(_0x1a7865){logger[_0xd39e('0xe')](_0xd39e('0xf'),_0x52dd02,_0x1a7865);_0x31d316(_0x1a7865);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 61a9f17..a4c1540 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 _0x83ae=['delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put','update'];(function(_0x529abc,_0x17b97e){var _0x453afa=function(_0x536263){while(--_0x536263){_0x529abc['push'](_0x529abc['shift']());}};_0x453afa(++_0x17b97e);}(_0x83ae,0x13d));var _0xe83a=function(_0x44f1ad,_0xf7ddae){_0x44f1ad=_0x44f1ad-0x0;var _0x2cbc0f=_0x83ae[_0x44f1ad];return _0x2cbc0f;};'use strict';var multer=require('multer');var util=require(_0xe83a('0x0'));var path=require('path');var timeout=require(_0xe83a('0x1'));var express=require(_0xe83a('0x2'));var router=express[_0xe83a('0x3')]();var fs_extra=require(_0xe83a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe83a('0x5'));var config=require(_0xe83a('0x6'));var controller=require('./chatApplication.controller');router[_0xe83a('0x7')](_0xe83a('0x8'),auth[_0xe83a('0x9')](),controller[_0xe83a('0xa')]);router[_0xe83a('0xb')](_0xe83a('0x8'),auth['isAuthenticated'](),controller[_0xe83a('0xc')]);router[_0xe83a('0xd')](_0xe83a('0x8'),auth[_0xe83a('0x9')](),controller['destroy']);module[_0xe83a('0xe')]=router; \ No newline at end of file +var _0x0792=['update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show'];(function(_0x569910,_0x3e1f78){var _0x5a66e4=function(_0x5c51b1){while(--_0x5c51b1){_0x569910['push'](_0x569910['shift']());}};_0x5a66e4(++_0x3e1f78);}(_0x0792,0x1e4));var _0x2079=function(_0x28d31d,_0x57a4e6){_0x28d31d=_0x28d31d-0x0;var _0x2df7c1=_0x0792[_0x28d31d];return _0x2df7c1;};'use strict';var multer=require('multer');var util=require(_0x2079('0x0'));var path=require(_0x2079('0x1'));var timeout=require(_0x2079('0x2'));var express=require(_0x2079('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2079('0x4'));var interaction=require(_0x2079('0x5'));var config=require(_0x2079('0x6'));var controller=require(_0x2079('0x7'));router[_0x2079('0x8')](_0x2079('0x9'),auth[_0x2079('0xa')](),controller[_0x2079('0xb')]);router['put'](_0x2079('0x9'),auth[_0x2079('0xa')](),controller[_0x2079('0xc')]);router[_0x2079('0xd')](_0x2079('0x9'),auth[_0x2079('0xa')](),controller[_0x2079('0xe')]);module[_0x2079('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 b5e8d7c..a661bae 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 _0xc11e=['STRING','BOOLEAN','sequelize'];(function(_0x2dc96f,_0x459058){var _0xd012da=function(_0x38d032){while(--_0x38d032){_0x2dc96f['push'](_0x2dc96f['shift']());}};_0xd012da(++_0x459058);}(_0xc11e,0xf8));var _0xec11=function(_0x254761,_0x550307){_0x254761=_0x254761-0x0;var _0x4236de=_0xc11e[_0x254761];return _0x4236de;};'use strict';var Sequelize=require(_0xec11('0x0'));module['exports']={'name':{'type':Sequelize[_0xec11('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xec11('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8165=['STRING','BOOLEAN','sequelize','exports'];(function(_0x195ecf,_0x2fb8e2){var _0x6b2116=function(_0x593d7e){while(--_0x593d7e){_0x195ecf['push'](_0x195ecf['shift']());}};_0x6b2116(++_0x2fb8e2);}(_0x8165,0x96));var _0x5816=function(_0x49b612,_0x5d13e9){_0x49b612=_0x49b612-0x0;var _0x25cc81=_0x8165[_0x49b612];return _0x25cc81;};'use strict';var Sequelize=require(_0x5816('0x0'));module[_0x5816('0x1')]={'name':{'type':Sequelize[_0x5816('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5816('0x2')]},'write':{'type':Sequelize[_0x5816('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 b42474d..2cc1aad 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 _0x9b7b=['util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','ChatGroup','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','rows','catch','show','params','rawAttributes','includeAll','include','options','find','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','User','order','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','format','eml-format','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x44d134,_0x3102bc){var _0x491931=function(_0x58b5e1){while(--_0x58b5e1){_0x44d134['push'](_0x44d134['shift']());}};_0x491931(++_0x3102bc);}(_0x9b7b,0xbe));var _0xb9b7=function(_0x1e4c5a,_0x29719e){_0x1e4c5a=_0x1e4c5a-0x0;var _0x48ab55=_0x9b7b[_0x1e4c5a];return _0x48ab55;};'use strict';var emlformat=require(_0xb9b7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb9b7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9b7('0x2'));var moment=require(_0xb9b7('0x3'));var BPromise=require(_0xb9b7('0x4'));var Mustache=require(_0xb9b7('0x5'));var util=require(_0xb9b7('0x6'));var path=require('path');var sox=require(_0xb9b7('0x7'));var csv=require(_0xb9b7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb9b7('0x9'));var _=require(_0xb9b7('0xa'));var squel=require(_0xb9b7('0xb'));var crypto=require(_0xb9b7('0xc'));var jsforce=require(_0xb9b7('0xd'));var deskjs=require(_0xb9b7('0xe'));var toCsv=require(_0xb9b7('0x8'));var querystring=require('querystring');var Papa=require(_0xb9b7('0xf'));var Redis=require(_0xb9b7('0x10'));var authService=require(_0xb9b7('0x11'));var qs=require(_0xb9b7('0x12'));var as=require(_0xb9b7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9b7('0x14'))(_0xb9b7('0x15'));var utils=require('../../config/utils');var config=require(_0xb9b7('0x16'));var licenseUtil=require(_0xb9b7('0x17'));var db=require(_0xb9b7('0x18'))['db'];config[_0xb9b7('0x19')]=_[_0xb9b7('0x1a')](config[_0xb9b7('0x19')],{'host':_0xb9b7('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb9b7('0x19')]));require(_0xb9b7('0x1c'))[_0xb9b7('0x1d')](socket);function respondWithStatusCode(_0x58e134,_0x625150){_0x625150=_0x625150||0xcc;return function(_0x5d89ae){if(_0x5d89ae){return _0x58e134[_0xb9b7('0x1e')](_0x625150);}return _0x58e134[_0xb9b7('0x1f')](_0x625150)[_0xb9b7('0x20')]();};}function respondWithResult(_0x59a6a1,_0x1061a3){_0x1061a3=_0x1061a3||0xc8;return function(_0x381b47){if(_0x381b47){return _0x59a6a1[_0xb9b7('0x1f')](_0x1061a3)[_0xb9b7('0x21')](_0x381b47);}};}function respondWithFilteredResult(_0x2c9e9e,_0x5a5d75){return function(_0x1a15ca){if(_0x1a15ca){var _0x1b0038=typeof _0x5a5d75[_0xb9b7('0x22')]==='undefined'&&typeof _0x5a5d75[_0xb9b7('0x23')]===_0xb9b7('0x24');var _0x38945e=_0x1a15ca[_0xb9b7('0x25')];var _0x24ee53=_0x1b0038?0x0:_0x5a5d75[_0xb9b7('0x22')];var _0x57a479=_0x1b0038?_0x1a15ca[_0xb9b7('0x25')]:_0x5a5d75[_0xb9b7('0x22')]+_0x5a5d75[_0xb9b7('0x23')];var _0x2a0e41;if(_0x57a479>=_0x38945e){_0x57a479=_0x38945e;_0x2a0e41=0xc8;}else{_0x2a0e41=0xce;}_0x2c9e9e[_0xb9b7('0x1f')](_0x2a0e41);return _0x2c9e9e[_0xb9b7('0x26')]('Content-Range',_0x24ee53+'-'+_0x57a479+'/'+_0x38945e)[_0xb9b7('0x21')](_0x1a15ca);}return null;};}function patchUpdates(_0x2edab0){return function(_0x352410){try{jsonpatch[_0xb9b7('0x27')](_0x352410,_0x2edab0,!![]);}catch(_0x1b1e76){return BPromise[_0xb9b7('0x28')](_0x1b1e76);}return _0x352410[_0xb9b7('0x29')]();};}function saveUpdates(_0x778bc5,_0x4ee10e){return function(_0x124f39){if(_0x124f39){return _0x124f39[_0xb9b7('0x2a')](_0x778bc5)[_0xb9b7('0x2b')](function(_0x1f5050){return _0x1f5050;});}return null;};}function removeEntity(_0x2f974c,_0x5d544c){return function(_0x52f279){if(_0x52f279){return _0x52f279[_0xb9b7('0x2c')]()['then'](function(){_0x2f974c[_0xb9b7('0x1f')](0xcc)[_0xb9b7('0x20')]();});}};}function handleEntityNotFound(_0x1778cc,_0xd66f61){return function(_0x4d6ded){if(!_0x4d6ded){_0x1778cc[_0xb9b7('0x1e')](0x194);}return _0x4d6ded;};}function handleError(_0x33610c,_0x39f46b){_0x39f46b=_0x39f46b||0x1f4;return function(_0x19d1c6){logger[_0xb9b7('0x2d')](_0x19d1c6[_0xb9b7('0x2e')]);if(_0x19d1c6[_0xb9b7('0x2f')]){delete _0x19d1c6['name'];}_0x33610c[_0xb9b7('0x1f')](_0x39f46b)['send'](_0x19d1c6);};}exports[_0xb9b7('0x30')]=function(_0x22803d,_0x297cca){var _0x4b3f52={},_0x1d2132={},_0x3d6ae2={'count':0x0,'rows':[]};var _0xb4bc31=_[_0xb9b7('0x31')](db[_0xb9b7('0x32')]['rawAttributes'],function(_0x6f1bdf){return{'name':_0x6f1bdf[_0xb9b7('0x33')],'type':_0x6f1bdf[_0xb9b7('0x34')][_0xb9b7('0x35')]};});_0x1d2132[_0xb9b7('0x36')]=_[_0xb9b7('0x31')](_0xb4bc31,_0xb9b7('0x2f'));_0x1d2132['query']=_[_0xb9b7('0x37')](_0x22803d[_0xb9b7('0x38')]);_0x1d2132[_0xb9b7('0x39')]=_[_0xb9b7('0x3a')](_0x1d2132[_0xb9b7('0x36')],_0x1d2132['query']);_0x4b3f52[_0xb9b7('0x3b')]=_[_0xb9b7('0x3a')](_0x1d2132[_0xb9b7('0x36')],qs[_0xb9b7('0x3c')](_0x22803d['query']['fields']));_0x4b3f52['attributes']=_0x4b3f52[_0xb9b7('0x3b')][_0xb9b7('0x3d')]?_0x4b3f52['attributes']:_0x1d2132[_0xb9b7('0x36')];if(!_0x22803d[_0xb9b7('0x38')][_0xb9b7('0x3e')](_0xb9b7('0x3f'))){_0x4b3f52[_0xb9b7('0x23')]=qs[_0xb9b7('0x23')](_0x22803d['query'][_0xb9b7('0x23')]);_0x4b3f52[_0xb9b7('0x22')]=qs[_0xb9b7('0x22')](_0x22803d[_0xb9b7('0x38')][_0xb9b7('0x22')]);}_0x4b3f52['order']=qs[_0xb9b7('0x40')](_0x22803d[_0xb9b7('0x38')][_0xb9b7('0x40')]);_0x4b3f52[_0xb9b7('0x41')]=qs['filters'](_[_0xb9b7('0x42')](_0x22803d[_0xb9b7('0x38')],_0x1d2132[_0xb9b7('0x39')]),_0xb4bc31);if(_0x22803d[_0xb9b7('0x38')][_0xb9b7('0x43')]){_0x4b3f52['where']=_[_0xb9b7('0x44')](_0x4b3f52[_0xb9b7('0x41')],{'$or':_['map'](_0xb4bc31,function(_0x58eea1){if(_0x58eea1['type']!==_0xb9b7('0x45')){var _0x227391={};_0x227391[_0x58eea1['name']]={'$like':'%'+_0x22803d[_0xb9b7('0x38')][_0xb9b7('0x43')]+'%'};return _0x227391;}})});}_0x4b3f52=_[_0xb9b7('0x44')]({},_0x4b3f52,_0x22803d['options']);var _0x19f50e={'where':_0x4b3f52['where']};return db[_0xb9b7('0x32')][_0xb9b7('0x25')](_0x19f50e)[_0xb9b7('0x2b')](function(_0x4aacc8){_0x3d6ae2[_0xb9b7('0x25')]=_0x4aacc8;if(_0x22803d['query']['includeAll']){_0x4b3f52['include']=[{'all':!![]}];}return db[_0xb9b7('0x32')]['findAll'](_0x4b3f52);})[_0xb9b7('0x2b')](function(_0x416f24){_0x3d6ae2[_0xb9b7('0x46')]=_0x416f24;return _0x3d6ae2;})[_0xb9b7('0x2b')](respondWithFilteredResult(_0x297cca,_0x4b3f52))[_0xb9b7('0x47')](handleError(_0x297cca,null));};exports[_0xb9b7('0x48')]=function(_0x5b9d55,_0xdedb47){var _0x3d5c83={'raw':!![],'where':{'id':_0x5b9d55[_0xb9b7('0x49')]['id']}},_0x47679b={};_0x47679b[_0xb9b7('0x36')]=_['keys'](db[_0xb9b7('0x32')][_0xb9b7('0x4a')]);_0x47679b['query']=_[_0xb9b7('0x37')](_0x5b9d55[_0xb9b7('0x38')]);_0x47679b[_0xb9b7('0x39')]=_[_0xb9b7('0x3a')](_0x47679b['model'],_0x47679b['query']);_0x3d5c83[_0xb9b7('0x3b')]=_['intersection'](_0x47679b[_0xb9b7('0x36')],qs['fields'](_0x5b9d55[_0xb9b7('0x38')][_0xb9b7('0x3c')]));_0x3d5c83['attributes']=_0x3d5c83['attributes'][_0xb9b7('0x3d')]?_0x3d5c83[_0xb9b7('0x3b')]:_0x47679b[_0xb9b7('0x36')];if(_0x5b9d55['query'][_0xb9b7('0x4b')]){_0x3d5c83[_0xb9b7('0x4c')]=[{'all':!![]}];}_0x3d5c83=_[_0xb9b7('0x44')]({},_0x3d5c83,_0x5b9d55[_0xb9b7('0x4d')]);return db['ChatGroup'][_0xb9b7('0x4e')](_0x3d5c83)['then'](handleEntityNotFound(_0xdedb47,null))['then'](respondWithResult(_0xdedb47,null))['catch'](handleError(_0xdedb47,null));};exports[_0xb9b7('0x4f')]=function(_0x28a0dc,_0x1d0a11){return db[_0xb9b7('0x32')][_0xb9b7('0x4f')](_0x28a0dc[_0xb9b7('0x50')],{})[_0xb9b7('0x2b')](respondWithResult(_0x1d0a11,0xc9))[_0xb9b7('0x47')](handleError(_0x1d0a11,null));};exports[_0xb9b7('0x2a')]=function(_0x28280d,_0x392fa7){if(_0x28280d['body']['id']){delete _0x28280d[_0xb9b7('0x50')]['id'];}return db[_0xb9b7('0x32')]['find']({'where':{'id':_0x28280d[_0xb9b7('0x49')]['id']}})['then'](handleEntityNotFound(_0x392fa7,null))[_0xb9b7('0x2b')](saveUpdates(_0x28280d[_0xb9b7('0x50')],null))[_0xb9b7('0x2b')](respondWithResult(_0x392fa7,null))[_0xb9b7('0x47')](handleError(_0x392fa7,null));};exports[_0xb9b7('0x2c')]=function(_0x40c509,_0x1ba77c){return db[_0xb9b7('0x32')][_0xb9b7('0x4e')]({'where':{'id':_0x40c509[_0xb9b7('0x49')]['id']}})[_0xb9b7('0x2b')](handleEntityNotFound(_0x1ba77c,null))['then'](removeEntity(_0x1ba77c,null))[_0xb9b7('0x47')](handleError(_0x1ba77c,null));};exports[_0xb9b7('0x51')]=function(_0x29bc2a,_0x48c3c8){return db[_0xb9b7('0x32')][_0xb9b7('0x51')]()['then'](respondWithResult(_0x48c3c8,null))[_0xb9b7('0x47')](handleError(_0x48c3c8,null));};exports[_0xb9b7('0x52')]=function(_0x2c770d,_0xb04914,_0x8d67a2){return db[_0xb9b7('0x53')][_0xb9b7('0x25')]({'where':{'ChatGroupId':_0x2c770d[_0xb9b7('0x49')]['id'],'ToId':_0x2c770d[_0xb9b7('0x54')]['id'],'read':![]}})[_0xb9b7('0x2b')](function(_0x2efc4e){return{'id':_['toInteger'](_0x2c770d[_0xb9b7('0x49')]['id']),'count':_0x2efc4e};})['then'](respondWithResult(_0xb04914,null))[_0xb9b7('0x47')](handleError(_0xb04914,null));};exports[_0xb9b7('0x55')]=function(_0x2cae72,_0x37d219,_0x58c2f6){return db['ChatGroup'][_0xb9b7('0x4e')]({'where':{'id':_0x2cae72[_0xb9b7('0x49')]['id']}})['then'](handleEntityNotFound(_0x37d219,null))[_0xb9b7('0x2b')](function(_0x238fbb){if(_0x238fbb){return _0x238fbb[_0xb9b7('0x55')](_0x2cae72[_0xb9b7('0x50')][_0xb9b7('0x56')],_[_0xb9b7('0x57')](_0x2cae72[_0xb9b7('0x50')],[_0xb9b7('0x56'),'id'])||{});}})[_0xb9b7('0x2b')](respondWithResult(_0x37d219,null))[_0xb9b7('0x47')](handleError(_0x37d219,null));};exports[_0xb9b7('0x58')]=function(_0x4d6671,_0x180819,_0x2b6ea3){var _0x5c47b0={};var _0x3170c2={};var _0x38acf5;var _0x2404dc;return db[_0xb9b7('0x32')]['findOne']({'where':{'id':_0x4d6671['params']['id']}})[_0xb9b7('0x2b')](handleEntityNotFound(_0x180819,null))[_0xb9b7('0x2b')](function(_0x35ce39){if(_0x35ce39){_0x38acf5=_0x35ce39;_0x3170c2[_0xb9b7('0x36')]=_['keys'](db[_0xb9b7('0x59')][_0xb9b7('0x4a')]);_0x3170c2[_0xb9b7('0x38')]=_['keys'](_0x4d6671['query']);_0x3170c2['filters']=_[_0xb9b7('0x3a')](_0x3170c2[_0xb9b7('0x36')],_0x3170c2[_0xb9b7('0x38')]);_0x5c47b0[_0xb9b7('0x3b')]=_[_0xb9b7('0x3a')](_0x3170c2[_0xb9b7('0x36')],qs[_0xb9b7('0x3c')](_0x4d6671[_0xb9b7('0x38')][_0xb9b7('0x3c')]));_0x5c47b0[_0xb9b7('0x3b')]=_0x5c47b0[_0xb9b7('0x3b')][_0xb9b7('0x3d')]?_0x5c47b0['attributes']:_0x3170c2[_0xb9b7('0x36')];_0x5c47b0[_0xb9b7('0x5a')]=qs['sort'](_0x4d6671['query']['sort']);_0x5c47b0['where']=qs[_0xb9b7('0x39')](_[_0xb9b7('0x42')](_0x4d6671[_0xb9b7('0x38')],_0x3170c2[_0xb9b7('0x39')]));if(_0x4d6671[_0xb9b7('0x38')][_0xb9b7('0x43')]){_0x5c47b0['where']=_[_0xb9b7('0x44')](_0x5c47b0[_0xb9b7('0x41')],{'$or':_['map'](_0x5c47b0['attributes'],function(_0x427c03){var _0x5a5e8a={};_0x5a5e8a[_0x427c03]={'$like':'%'+_0x4d6671[_0xb9b7('0x38')][_0xb9b7('0x43')]+'%'};return _0x5a5e8a;})});}_0x5c47b0=_[_0xb9b7('0x44')]({},_0x5c47b0,_0x4d6671['options']);return _0x38acf5['getMembers'](_0x5c47b0);}})['then'](function(_0x4db6e9){if(_0x4db6e9){_0x2404dc=_0x4db6e9['length'];if(!_0x4d6671['query']['hasOwnProperty'](_0xb9b7('0x3f'))){_0x5c47b0[_0xb9b7('0x23')]=qs['limit'](_0x4d6671[_0xb9b7('0x38')][_0xb9b7('0x23')]);_0x5c47b0['offset']=qs[_0xb9b7('0x22')](_0x4d6671[_0xb9b7('0x38')][_0xb9b7('0x22')]);}return _0x38acf5[_0xb9b7('0x58')](_0x5c47b0);}})[_0xb9b7('0x2b')](function(_0x2447da){if(_0x2447da){return _0x2447da?{'count':_0x2404dc,'rows':_0x2447da}:null;}})[_0xb9b7('0x2b')](respondWithResult(_0x180819,null))[_0xb9b7('0x47')](handleError(_0x180819,null));};exports[_0xb9b7('0x5b')]=function(_0x328132,_0x484a95,_0x55d86f){return db[_0xb9b7('0x32')][_0xb9b7('0x4e')]({'where':{'id':_0x328132[_0xb9b7('0x49')]['id']}})[_0xb9b7('0x2b')](handleEntityNotFound(_0x484a95,null))[_0xb9b7('0x2b')](function(_0x321a41){if(_0x321a41){return _0x321a41[_0xb9b7('0x5b')](_0x328132[_0xb9b7('0x38')]['ids']);}})[_0xb9b7('0x2b')](respondWithStatusCode(_0x484a95,null))['catch'](handleError(_0x484a95,null));};exports[_0xb9b7('0x5c')]=function(_0x378435,_0x4137c3,_0x3cecea){if(_0x378435[_0xb9b7('0x50')]['id']){delete _0x378435['body']['id'];}return db['ChatGroup'][_0xb9b7('0x4e')]({'where':{'id':_0x378435[_0xb9b7('0x49')]['id']}})[_0xb9b7('0x2b')](handleEntityNotFound(_0x4137c3,null))[_0xb9b7('0x2b')](function(_0x8076b9){if(_0x8076b9){_0x378435[_0xb9b7('0x50')][_0xb9b7('0x5d')]=_0x8076b9['id'];return db[_0xb9b7('0x53')][_0xb9b7('0x4f')](_0x378435[_0xb9b7('0x50')]);}})[_0xb9b7('0x2b')](respondWithResult(_0x4137c3,null))[_0xb9b7('0x47')](handleError(_0x4137c3,null));};exports[_0xb9b7('0x5e')]=function(_0x3595b6,_0x1b2940,_0x4bf7c9){var _0x922a66={};var _0x5c1f1d={};var _0x4d0203;var _0x11c443;return db['ChatGroup'][_0xb9b7('0x5f')]({'where':{'id':_0x3595b6[_0xb9b7('0x49')]['id']}})[_0xb9b7('0x2b')](handleEntityNotFound(_0x1b2940,null))[_0xb9b7('0x2b')](function(_0x59daeb){if(_0x59daeb){_0x4d0203=_0x59daeb;_0x5c1f1d[_0xb9b7('0x36')]=_[_0xb9b7('0x37')](db[_0xb9b7('0x53')][_0xb9b7('0x4a')]);_0x5c1f1d[_0xb9b7('0x38')]=_[_0xb9b7('0x37')](_0x3595b6[_0xb9b7('0x38')]);_0x5c1f1d[_0xb9b7('0x39')]=_[_0xb9b7('0x3a')](_0x5c1f1d[_0xb9b7('0x36')],_0x5c1f1d[_0xb9b7('0x38')]);_0x922a66[_0xb9b7('0x3b')]=_[_0xb9b7('0x3a')](_0x5c1f1d[_0xb9b7('0x36')],qs[_0xb9b7('0x3c')](_0x3595b6['query'][_0xb9b7('0x3c')]));_0x922a66[_0xb9b7('0x3b')]=_0x922a66[_0xb9b7('0x3b')]['length']?_0x922a66['attributes']:_0x5c1f1d[_0xb9b7('0x36')];_0x922a66[_0xb9b7('0x5a')]=qs[_0xb9b7('0x40')](_0x3595b6[_0xb9b7('0x38')][_0xb9b7('0x40')]);_0x922a66[_0xb9b7('0x41')]=qs[_0xb9b7('0x39')](_[_0xb9b7('0x42')](_0x3595b6['query'],_0x5c1f1d[_0xb9b7('0x39')]));if(_0x3595b6['query'][_0xb9b7('0x43')]){_0x922a66[_0xb9b7('0x41')]=_[_0xb9b7('0x44')](_0x922a66[_0xb9b7('0x41')],{'$or':_[_0xb9b7('0x31')](_0x922a66['attributes'],function(_0x16aede){var _0x237585={};_0x237585[_0x16aede]={'$like':'%'+_0x3595b6['query'][_0xb9b7('0x43')]+'%'};return _0x237585;})});}if(_0x3595b6[_0xb9b7('0x38')][_0xb9b7('0x60')]){var _0x3fb764=_0x3595b6[_0xb9b7('0x38')][_0xb9b7('0x60')]['split'](',');var _0xc2b578={};_0xc2b578[_0x3fb764[0x0]]={'$gte':moment(_0x3fb764[0x1])[_0xb9b7('0x61')]('YYYY-MM-DD\x20HH:mm:ss')};_0x922a66[_0xb9b7('0x41')]=_[_0xb9b7('0x44')](_0x922a66['where'],_0xc2b578);}_0x922a66=_[_0xb9b7('0x44')]({},_0x922a66,_0x3595b6[_0xb9b7('0x4d')]);return _0x4d0203[_0xb9b7('0x5e')](_0x922a66);}})[_0xb9b7('0x2b')](function(_0x28c149){if(_0x28c149){_0x11c443=_0x28c149['length'];if(!_0x3595b6[_0xb9b7('0x38')]['hasOwnProperty'](_0xb9b7('0x3f'))){_0x922a66[_0xb9b7('0x23')]=qs[_0xb9b7('0x23')](_0x3595b6[_0xb9b7('0x38')][_0xb9b7('0x23')]);_0x922a66[_0xb9b7('0x22')]=qs['offset'](_0x3595b6[_0xb9b7('0x38')][_0xb9b7('0x22')]);}return _0x4d0203['getMessages'](_0x922a66);}})['then'](function(_0x4d87ce){if(_0x4d87ce){return _0x4d87ce?{'count':_0x11c443,'rows':_0x4d87ce}:null;}})[_0xb9b7('0x2b')](respondWithResult(_0x1b2940,null))['catch'](handleError(_0x1b2940,null));}; \ No newline at end of file +var _0xf361=['key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','rows','show','keys','create','body','catch','find','describe','getUnread','ChatInternalMessage','user','toInteger','params','addMembers','ids','omit','getMembers','hasOwnProperty','removeMembers','addMessage','pick','$gte','split','format','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','type'];(function(_0x56b0d6,_0x53fa34){var _0x14c5ee=function(_0x39b1d5){while(--_0x39b1d5){_0x56b0d6['push'](_0x56b0d6['shift']());}};_0x14c5ee(++_0x53fa34);}(_0xf361,0x14e));var _0x1f36=function(_0x58bc18,_0x31bf4d){_0x58bc18=_0x58bc18-0x0;var _0x4f308c=_0xf361[_0x58bc18];return _0x4f308c;};'use strict';var emlformat=require(_0x1f36('0x0'));var rimraf=require(_0x1f36('0x1'));var zipdir=require(_0x1f36('0x2'));var jsonpatch=require(_0x1f36('0x3'));var rp=require('request-promise');var moment=require(_0x1f36('0x4'));var BPromise=require(_0x1f36('0x5'));var Mustache=require('mustache');var util=require(_0x1f36('0x6'));var path=require(_0x1f36('0x7'));var sox=require(_0x1f36('0x8'));var csv=require(_0x1f36('0x9'));var ejs=require(_0x1f36('0xa'));var fs=require('fs');var fs_extra=require(_0x1f36('0xb'));var _=require(_0x1f36('0xc'));var squel=require('squel');var crypto=require(_0x1f36('0xd'));var jsforce=require(_0x1f36('0xe'));var deskjs=require(_0x1f36('0xf'));var toCsv=require(_0x1f36('0x9'));var querystring=require(_0x1f36('0x10'));var Papa=require(_0x1f36('0x11'));var Redis=require(_0x1f36('0x12'));var authService=require(_0x1f36('0x13'));var qs=require(_0x1f36('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f36('0x15'));var logger=require(_0x1f36('0x16'))('api');var utils=require(_0x1f36('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1f36('0x18'))['db'];config[_0x1f36('0x19')]=_[_0x1f36('0x1a')](config[_0x1f36('0x19')],{'host':_0x1f36('0x1b'),'port':0x18eb});var socket=require(_0x1f36('0x1c'))(new Redis(config[_0x1f36('0x19')]));require(_0x1f36('0x1d'))['register'](socket);function respondWithStatusCode(_0x5d411e,_0x395d2e){_0x395d2e=_0x395d2e||0xcc;return function(_0x57ccab){if(_0x57ccab){return _0x5d411e[_0x1f36('0x1e')](_0x395d2e);}return _0x5d411e['status'](_0x395d2e)[_0x1f36('0x1f')]();};}function respondWithResult(_0x2549a6,_0x270ad1){_0x270ad1=_0x270ad1||0xc8;return function(_0x4e4889){if(_0x4e4889){return _0x2549a6[_0x1f36('0x20')](_0x270ad1)[_0x1f36('0x21')](_0x4e4889);}};}function respondWithFilteredResult(_0x3573b6,_0x412938){return function(_0x2192a8){if(_0x2192a8){var _0x53736e=typeof _0x412938[_0x1f36('0x22')]===_0x1f36('0x23')&&typeof _0x412938['limit']===_0x1f36('0x23');var _0x4975b4=_0x2192a8[_0x1f36('0x24')];var _0x2c62e3=_0x53736e?0x0:_0x412938['offset'];var _0x3ea011=_0x53736e?_0x2192a8[_0x1f36('0x24')]:_0x412938[_0x1f36('0x22')]+_0x412938[_0x1f36('0x25')];var _0x3ade35;if(_0x3ea011>=_0x4975b4){_0x3ea011=_0x4975b4;_0x3ade35=0xc8;}else{_0x3ade35=0xce;}_0x3573b6[_0x1f36('0x20')](_0x3ade35);return _0x3573b6['set'](_0x1f36('0x26'),_0x2c62e3+'-'+_0x3ea011+'/'+_0x4975b4)[_0x1f36('0x21')](_0x2192a8);}return null;};}function patchUpdates(_0x2e7f0c){return function(_0x2911ef){try{jsonpatch[_0x1f36('0x27')](_0x2911ef,_0x2e7f0c,!![]);}catch(_0x20acff){return BPromise[_0x1f36('0x28')](_0x20acff);}return _0x2911ef[_0x1f36('0x29')]();};}function saveUpdates(_0x32e47d,_0x4a862d){return function(_0x52392f){if(_0x52392f){return _0x52392f[_0x1f36('0x2a')](_0x32e47d)[_0x1f36('0x2b')](function(_0x288041){return _0x288041;});}return null;};}function removeEntity(_0x4cca9a,_0x7f0dcf){return function(_0x31b5b1){if(_0x31b5b1){return _0x31b5b1[_0x1f36('0x2c')]()['then'](function(){_0x4cca9a[_0x1f36('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9a4fdb,_0x1613c3){return function(_0x4ef8d7){if(!_0x4ef8d7){_0x9a4fdb[_0x1f36('0x1e')](0x194);}return _0x4ef8d7;};}function handleError(_0x435e0d,_0x307bdb){_0x307bdb=_0x307bdb||0x1f4;return function(_0x3d87a2){logger[_0x1f36('0x2d')](_0x3d87a2[_0x1f36('0x2e')]);if(_0x3d87a2[_0x1f36('0x2f')]){delete _0x3d87a2[_0x1f36('0x2f')];}_0x435e0d[_0x1f36('0x20')](_0x307bdb)[_0x1f36('0x30')](_0x3d87a2);};}exports[_0x1f36('0x31')]=function(_0x5664bc,_0x14d5b9){var _0xacf805={},_0x147708={},_0x2170cf={'count':0x0,'rows':[]};var _0x369c52=_[_0x1f36('0x32')](db[_0x1f36('0x33')][_0x1f36('0x34')],function(_0x2cbac7){return{'name':_0x2cbac7['fieldName'],'type':_0x2cbac7[_0x1f36('0x35')][_0x1f36('0x36')]};});_0x147708[_0x1f36('0x37')]=_[_0x1f36('0x32')](_0x369c52,_0x1f36('0x2f'));_0x147708[_0x1f36('0x38')]=_['keys'](_0x5664bc['query']);_0x147708['filters']=_[_0x1f36('0x39')](_0x147708['model'],_0x147708[_0x1f36('0x38')]);_0xacf805[_0x1f36('0x3a')]=_[_0x1f36('0x39')](_0x147708[_0x1f36('0x37')],qs[_0x1f36('0x3b')](_0x5664bc[_0x1f36('0x38')][_0x1f36('0x3b')]));_0xacf805[_0x1f36('0x3a')]=_0xacf805[_0x1f36('0x3a')][_0x1f36('0x3c')]?_0xacf805[_0x1f36('0x3a')]:_0x147708[_0x1f36('0x37')];if(!_0x5664bc[_0x1f36('0x38')]['hasOwnProperty'](_0x1f36('0x3d'))){_0xacf805[_0x1f36('0x25')]=qs[_0x1f36('0x25')](_0x5664bc['query'][_0x1f36('0x25')]);_0xacf805[_0x1f36('0x22')]=qs['offset'](_0x5664bc[_0x1f36('0x38')][_0x1f36('0x22')]);}_0xacf805[_0x1f36('0x3e')]=qs[_0x1f36('0x3f')](_0x5664bc['query']['sort']);_0xacf805[_0x1f36('0x40')]=qs['filters'](_['pick'](_0x5664bc[_0x1f36('0x38')],_0x147708[_0x1f36('0x41')]),_0x369c52);if(_0x5664bc[_0x1f36('0x38')][_0x1f36('0x42')]){_0xacf805[_0x1f36('0x40')]=_['merge'](_0xacf805[_0x1f36('0x40')],{'$or':_[_0x1f36('0x32')](_0x369c52,function(_0xe46e15){if(_0xe46e15[_0x1f36('0x35')]!==_0x1f36('0x43')){var _0x32240f={};_0x32240f[_0xe46e15['name']]={'$like':'%'+_0x5664bc[_0x1f36('0x38')][_0x1f36('0x42')]+'%'};return _0x32240f;}})});}_0xacf805=_[_0x1f36('0x44')]({},_0xacf805,_0x5664bc[_0x1f36('0x45')]);var _0x3fdc1b={'where':_0xacf805[_0x1f36('0x40')]};return db[_0x1f36('0x33')][_0x1f36('0x24')](_0x3fdc1b)[_0x1f36('0x2b')](function(_0x42da63){_0x2170cf['count']=_0x42da63;if(_0x5664bc['query'][_0x1f36('0x46')]){_0xacf805[_0x1f36('0x47')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0xacf805);})[_0x1f36('0x2b')](function(_0x563bca){_0x2170cf[_0x1f36('0x48')]=_0x563bca;return _0x2170cf;})['then'](respondWithFilteredResult(_0x14d5b9,_0xacf805))['catch'](handleError(_0x14d5b9,null));};exports[_0x1f36('0x49')]=function(_0x5c401a,_0x2c19a0){var _0x2cea8f={'raw':!![],'where':{'id':_0x5c401a['params']['id']}},_0x203dea={};_0x203dea['model']=_[_0x1f36('0x4a')](db[_0x1f36('0x33')][_0x1f36('0x34')]);_0x203dea['query']=_[_0x1f36('0x4a')](_0x5c401a[_0x1f36('0x38')]);_0x203dea[_0x1f36('0x41')]=_[_0x1f36('0x39')](_0x203dea[_0x1f36('0x37')],_0x203dea['query']);_0x2cea8f[_0x1f36('0x3a')]=_[_0x1f36('0x39')](_0x203dea[_0x1f36('0x37')],qs[_0x1f36('0x3b')](_0x5c401a[_0x1f36('0x38')]['fields']));_0x2cea8f[_0x1f36('0x3a')]=_0x2cea8f['attributes'][_0x1f36('0x3c')]?_0x2cea8f['attributes']:_0x203dea['model'];if(_0x5c401a['query']['includeAll']){_0x2cea8f[_0x1f36('0x47')]=[{'all':!![]}];}_0x2cea8f=_[_0x1f36('0x44')]({},_0x2cea8f,_0x5c401a['options']);return db['ChatGroup']['find'](_0x2cea8f)[_0x1f36('0x2b')](handleEntityNotFound(_0x2c19a0,null))[_0x1f36('0x2b')](respondWithResult(_0x2c19a0,null))['catch'](handleError(_0x2c19a0,null));};exports[_0x1f36('0x4b')]=function(_0xceca55,_0xcc4280){return db['ChatGroup'][_0x1f36('0x4b')](_0xceca55[_0x1f36('0x4c')],{})[_0x1f36('0x2b')](respondWithResult(_0xcc4280,0xc9))[_0x1f36('0x4d')](handleError(_0xcc4280,null));};exports[_0x1f36('0x2a')]=function(_0x354f5b,_0x11360c){if(_0x354f5b[_0x1f36('0x4c')]['id']){delete _0x354f5b[_0x1f36('0x4c')]['id'];}return db[_0x1f36('0x33')][_0x1f36('0x4e')]({'where':{'id':_0x354f5b['params']['id']}})[_0x1f36('0x2b')](handleEntityNotFound(_0x11360c,null))[_0x1f36('0x2b')](saveUpdates(_0x354f5b[_0x1f36('0x4c')],null))[_0x1f36('0x2b')](respondWithResult(_0x11360c,null))['catch'](handleError(_0x11360c,null));};exports[_0x1f36('0x2c')]=function(_0x56ed50,_0x3d5a3c){return db[_0x1f36('0x33')][_0x1f36('0x4e')]({'where':{'id':_0x56ed50['params']['id']}})[_0x1f36('0x2b')](handleEntityNotFound(_0x3d5a3c,null))[_0x1f36('0x2b')](removeEntity(_0x3d5a3c,null))[_0x1f36('0x4d')](handleError(_0x3d5a3c,null));};exports[_0x1f36('0x4f')]=function(_0x5272a7,_0x8318ac){return db[_0x1f36('0x33')][_0x1f36('0x4f')]()[_0x1f36('0x2b')](respondWithResult(_0x8318ac,null))[_0x1f36('0x4d')](handleError(_0x8318ac,null));};exports[_0x1f36('0x50')]=function(_0x45295d,_0x4b53a0,_0x1e98e4){return db[_0x1f36('0x51')][_0x1f36('0x24')]({'where':{'ChatGroupId':_0x45295d['params']['id'],'ToId':_0x45295d[_0x1f36('0x52')]['id'],'read':![]}})[_0x1f36('0x2b')](function(_0x3b9b76){return{'id':_[_0x1f36('0x53')](_0x45295d[_0x1f36('0x54')]['id']),'count':_0x3b9b76};})[_0x1f36('0x2b')](respondWithResult(_0x4b53a0,null))[_0x1f36('0x4d')](handleError(_0x4b53a0,null));};exports[_0x1f36('0x55')]=function(_0x484c13,_0x2332a8,_0x1788a7){return db[_0x1f36('0x33')][_0x1f36('0x4e')]({'where':{'id':_0x484c13[_0x1f36('0x54')]['id']}})['then'](handleEntityNotFound(_0x2332a8,null))['then'](function(_0x3cbc76){if(_0x3cbc76){return _0x3cbc76[_0x1f36('0x55')](_0x484c13[_0x1f36('0x4c')][_0x1f36('0x56')],_[_0x1f36('0x57')](_0x484c13[_0x1f36('0x4c')],[_0x1f36('0x56'),'id'])||{});}})[_0x1f36('0x2b')](respondWithResult(_0x2332a8,null))['catch'](handleError(_0x2332a8,null));};exports[_0x1f36('0x58')]=function(_0x34abc4,_0x302ea3,_0x1c1275){var _0x170e8c={};var _0x40c4a8={};var _0xc1c420;var _0x340787;return db[_0x1f36('0x33')]['findOne']({'where':{'id':_0x34abc4['params']['id']}})[_0x1f36('0x2b')](handleEntityNotFound(_0x302ea3,null))[_0x1f36('0x2b')](function(_0x380b73){if(_0x380b73){_0xc1c420=_0x380b73;_0x40c4a8[_0x1f36('0x37')]=_[_0x1f36('0x4a')](db['User'][_0x1f36('0x34')]);_0x40c4a8[_0x1f36('0x38')]=_[_0x1f36('0x4a')](_0x34abc4['query']);_0x40c4a8[_0x1f36('0x41')]=_['intersection'](_0x40c4a8[_0x1f36('0x37')],_0x40c4a8[_0x1f36('0x38')]);_0x170e8c[_0x1f36('0x3a')]=_[_0x1f36('0x39')](_0x40c4a8[_0x1f36('0x37')],qs[_0x1f36('0x3b')](_0x34abc4[_0x1f36('0x38')][_0x1f36('0x3b')]));_0x170e8c[_0x1f36('0x3a')]=_0x170e8c['attributes'][_0x1f36('0x3c')]?_0x170e8c[_0x1f36('0x3a')]:_0x40c4a8[_0x1f36('0x37')];_0x170e8c[_0x1f36('0x3e')]=qs[_0x1f36('0x3f')](_0x34abc4[_0x1f36('0x38')][_0x1f36('0x3f')]);_0x170e8c['where']=qs[_0x1f36('0x41')](_['pick'](_0x34abc4['query'],_0x40c4a8['filters']));if(_0x34abc4[_0x1f36('0x38')][_0x1f36('0x42')]){_0x170e8c[_0x1f36('0x40')]=_[_0x1f36('0x44')](_0x170e8c['where'],{'$or':_[_0x1f36('0x32')](_0x170e8c[_0x1f36('0x3a')],function(_0x1f2c82){var _0x579f76={};_0x579f76[_0x1f2c82]={'$like':'%'+_0x34abc4['query']['filter']+'%'};return _0x579f76;})});}_0x170e8c=_[_0x1f36('0x44')]({},_0x170e8c,_0x34abc4[_0x1f36('0x45')]);return _0xc1c420['getMembers'](_0x170e8c);}})['then'](function(_0x2c9090){if(_0x2c9090){_0x340787=_0x2c9090[_0x1f36('0x3c')];if(!_0x34abc4[_0x1f36('0x38')][_0x1f36('0x59')](_0x1f36('0x3d'))){_0x170e8c[_0x1f36('0x25')]=qs[_0x1f36('0x25')](_0x34abc4['query'][_0x1f36('0x25')]);_0x170e8c['offset']=qs[_0x1f36('0x22')](_0x34abc4['query'][_0x1f36('0x22')]);}return _0xc1c420['getMembers'](_0x170e8c);}})['then'](function(_0x1c2c4b){if(_0x1c2c4b){return _0x1c2c4b?{'count':_0x340787,'rows':_0x1c2c4b}:null;}})[_0x1f36('0x2b')](respondWithResult(_0x302ea3,null))['catch'](handleError(_0x302ea3,null));};exports[_0x1f36('0x5a')]=function(_0x3108cd,_0x373764,_0x1384ae){return db['ChatGroup'][_0x1f36('0x4e')]({'where':{'id':_0x3108cd['params']['id']}})[_0x1f36('0x2b')](handleEntityNotFound(_0x373764,null))[_0x1f36('0x2b')](function(_0x14dd9b){if(_0x14dd9b){return _0x14dd9b[_0x1f36('0x5a')](_0x3108cd[_0x1f36('0x38')][_0x1f36('0x56')]);}})[_0x1f36('0x2b')](respondWithStatusCode(_0x373764,null))[_0x1f36('0x4d')](handleError(_0x373764,null));};exports[_0x1f36('0x5b')]=function(_0x106464,_0x590823,_0x383032){if(_0x106464[_0x1f36('0x4c')]['id']){delete _0x106464['body']['id'];}return db['ChatGroup']['find']({'where':{'id':_0x106464['params']['id']}})[_0x1f36('0x2b')](handleEntityNotFound(_0x590823,null))['then'](function(_0x18caa9){if(_0x18caa9){_0x106464[_0x1f36('0x4c')]['ChatGroupId']=_0x18caa9['id'];return db['ChatInternalMessage'][_0x1f36('0x4b')](_0x106464['body']);}})[_0x1f36('0x2b')](respondWithResult(_0x590823,null))['catch'](handleError(_0x590823,null));};exports['getMessages']=function(_0x2da71d,_0x1e09f0,_0x5845ef){var _0x23b743={};var _0x59e375={};var _0x18b678;var _0x4bc3fe;return db[_0x1f36('0x33')]['findOne']({'where':{'id':_0x2da71d[_0x1f36('0x54')]['id']}})[_0x1f36('0x2b')](handleEntityNotFound(_0x1e09f0,null))[_0x1f36('0x2b')](function(_0x4f1fc0){if(_0x4f1fc0){_0x18b678=_0x4f1fc0;_0x59e375[_0x1f36('0x37')]=_[_0x1f36('0x4a')](db[_0x1f36('0x51')][_0x1f36('0x34')]);_0x59e375[_0x1f36('0x38')]=_[_0x1f36('0x4a')](_0x2da71d[_0x1f36('0x38')]);_0x59e375[_0x1f36('0x41')]=_['intersection'](_0x59e375[_0x1f36('0x37')],_0x59e375[_0x1f36('0x38')]);_0x23b743['attributes']=_[_0x1f36('0x39')](_0x59e375['model'],qs[_0x1f36('0x3b')](_0x2da71d[_0x1f36('0x38')][_0x1f36('0x3b')]));_0x23b743[_0x1f36('0x3a')]=_0x23b743[_0x1f36('0x3a')][_0x1f36('0x3c')]?_0x23b743[_0x1f36('0x3a')]:_0x59e375['model'];_0x23b743['order']=qs[_0x1f36('0x3f')](_0x2da71d[_0x1f36('0x38')][_0x1f36('0x3f')]);_0x23b743['where']=qs['filters'](_[_0x1f36('0x5c')](_0x2da71d[_0x1f36('0x38')],_0x59e375[_0x1f36('0x41')]));if(_0x2da71d[_0x1f36('0x38')][_0x1f36('0x42')]){_0x23b743[_0x1f36('0x40')]=_[_0x1f36('0x44')](_0x23b743[_0x1f36('0x40')],{'$or':_[_0x1f36('0x32')](_0x23b743[_0x1f36('0x3a')],function(_0x2971a7){var _0x74498c={};_0x74498c[_0x2971a7]={'$like':'%'+_0x2da71d[_0x1f36('0x38')][_0x1f36('0x42')]+'%'};return _0x74498c;})});}if(_0x2da71d[_0x1f36('0x38')][_0x1f36('0x5d')]){var _0x3daff3=_0x2da71d[_0x1f36('0x38')][_0x1f36('0x5d')][_0x1f36('0x5e')](',');var _0x5ded4e={};_0x5ded4e[_0x3daff3[0x0]]={'$gte':moment(_0x3daff3[0x1])[_0x1f36('0x5f')]('YYYY-MM-DD\x20HH:mm:ss')};_0x23b743['where']=_[_0x1f36('0x44')](_0x23b743[_0x1f36('0x40')],_0x5ded4e);}_0x23b743=_['merge']({},_0x23b743,_0x2da71d[_0x1f36('0x45')]);return _0x18b678['getMessages'](_0x23b743);}})[_0x1f36('0x2b')](function(_0x3ec668){if(_0x3ec668){_0x4bc3fe=_0x3ec668[_0x1f36('0x3c')];if(!_0x2da71d[_0x1f36('0x38')][_0x1f36('0x59')](_0x1f36('0x3d'))){_0x23b743['limit']=qs[_0x1f36('0x25')](_0x2da71d[_0x1f36('0x38')]['limit']);_0x23b743[_0x1f36('0x22')]=qs[_0x1f36('0x22')](_0x2da71d['query'][_0x1f36('0x22')]);}return _0x18b678[_0x1f36('0x60')](_0x23b743);}})[_0x1f36('0x2b')](function(_0x45f2f5){if(_0x45f2f5){return _0x45f2f5?{'count':_0x4bc3fe,'rows':_0x45f2f5}:null;}})['then'](respondWithResult(_0x1e09f0,null))[_0x1f36('0x4d')](handleError(_0x1e09f0,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index de0cf1c..3dfaee1 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 _0x4877=['hasOwnProperty','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','remove','emit'];(function(_0xc18e64,_0x346648){var _0x32d487=function(_0x28775e){while(--_0x28775e){_0xc18e64['push'](_0xc18e64['shift']());}};_0x32d487(++_0x346648);}(_0x4877,0x80));var _0x7487=function(_0x2297d6,_0x44771d){_0x2297d6=_0x2297d6-0x0;var _0xcdb1a4=_0x4877[_0x2297d6];return _0xcdb1a4;};'use strict';var EventEmitter=require(_0x7487('0x0'));var ChatGroup=require(_0x7487('0x1'))['db'][_0x7487('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x7487('0x3')](0x0);var events={'afterCreate':_0x7487('0x4'),'afterUpdate':'update','afterDestroy':_0x7487('0x5')};function emitEvent(_0xc61f96){return function(_0x14efa2,_0x19a0d4,_0x2a3581){ChatGroupEvents[_0x7487('0x6')](_0xc61f96+':'+_0x14efa2['id'],_0x14efa2);ChatGroupEvents['emit'](_0xc61f96,_0x14efa2);_0x2a3581(null);};}for(var e in events){if(events[_0x7487('0x7')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x7487('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x1d71=['events','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x3dfeb9,_0x553ae6){var _0x5c79ca=function(_0x3e41a9){while(--_0x3e41a9){_0x3dfeb9['push'](_0x3dfeb9['shift']());}};_0x5c79ca(++_0x553ae6);}(_0x1d71,0x154));var _0x11d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d71[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x11d7('0x0'));var ChatGroup=require(_0x11d7('0x1'))['db'][_0x11d7('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x11d7('0x3')](0x0);var events={'afterCreate':_0x11d7('0x4'),'afterUpdate':_0x11d7('0x5'),'afterDestroy':_0x11d7('0x6')};function emitEvent(_0x552673){return function(_0x424800,_0x4e3656,_0x32f6cb){ChatGroupEvents['emit'](_0x552673+':'+_0x424800['id'],_0x424800);ChatGroupEvents[_0x11d7('0x7')](_0x552673,_0x424800);_0x32f6cb(null);};}for(var e in events){if(events[_0x11d7('0x8')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x11d7('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 48236f4..766bc98 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 _0xa034=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./chatGroup.attributes','define','ChatGroup','lodash'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xa034,0xe5));var _0x4a03=function(_0x2319bf,_0x1c0127){_0x2319bf=_0x2319bf-0x0;var _0x2f3ada=_0xa034[_0x2319bf];return _0x2f3ada;};'use strict';var _=require(_0x4a03('0x0'));var util=require('util');var logger=require(_0x4a03('0x1'))(_0x4a03('0x2'));var moment=require(_0x4a03('0x3'));var BPromise=require(_0x4a03('0x4'));var rp=require(_0x4a03('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4a03('0x6'));var attributes=require(_0x4a03('0x7'));module['exports']=function(_0x17e59c,_0x39987a){return _0x17e59c[_0x4a03('0x8')](_0x4a03('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcdf3=['define','ChatGroup','chat_groups','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatGroup.attributes','exports'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0xcdf3,0xed));var _0x3cdf=function(_0xc18a91,_0x167dc1){_0xc18a91=_0xc18a91-0x0;var _0x48c2e6=_0xcdf3[_0xc18a91];return _0x48c2e6;};'use strict';var _=require('lodash');var util=require(_0x3cdf('0x0'));var logger=require(_0x3cdf('0x1'))(_0x3cdf('0x2'));var moment=require(_0x3cdf('0x3'));var BPromise=require(_0x3cdf('0x4'));var rp=require(_0x3cdf('0x5'));var fs=require('fs');var path=require(_0x3cdf('0x6'));var rimraf=require('rimraf');var config=require(_0x3cdf('0x7'));var attributes=require(_0x3cdf('0x8'));module[_0x3cdf('0x9')]=function(_0x5c0113,_0x3c6317){return _0x5c0113[_0x3cdf('0xa')](_0x3cdf('0xb'),attributes,{'tableName':_0x3cdf('0xc'),'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 9760f39..cee26a1 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 _0x14d8=['ChatGroup,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','request','then','info'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x14d8,0x19d));var _0x814d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x14d8[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x814d('0x0'));var util=require(_0x814d('0x1'));var moment=require('moment');var BPromise=require(_0x814d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x814d('0x3'));var db=require(_0x814d('0x4'))['db'];var utils=require(_0x814d('0x5'));var logger=require(_0x814d('0x6'))(_0x814d('0x7'));var config=require('../../config/environment');var jayson=require(_0x814d('0x8'));var client=jayson[_0x814d('0x9')][_0x814d('0xa')]({'port':0x232a});config[_0x814d('0xb')]=_[_0x814d('0xc')](config[_0x814d('0xb')],{'host':_0x814d('0xd'),'port':0x18eb});var socket=require(_0x814d('0xe'))(new Redis(config[_0x814d('0xb')]));require(_0x814d('0xf'))['register'](socket);function respondWithRpcPromise(_0x10771d,_0x2f2efc,_0x13d1f6){return new BPromise(function(_0x21d598,_0x1e3e4a){return client[_0x814d('0x10')](_0x10771d,_0x13d1f6)[_0x814d('0x11')](function(_0xec8c9){logger[_0x814d('0x12')](_0x814d('0x13'),_0x2f2efc,_0x814d('0x14'));logger[_0x814d('0x15')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x2f2efc,_0x814d('0x14'),JSON['stringify'](_0xec8c9));if(_0xec8c9[_0x814d('0x16')]){if(_0xec8c9[_0x814d('0x16')][_0x814d('0x17')]===0x1f4){logger[_0x814d('0x16')](_0x814d('0x13'),_0x2f2efc,_0xec8c9[_0x814d('0x16')][_0x814d('0x18')]);return _0x1e3e4a(_0xec8c9['error'][_0x814d('0x18')]);}logger['error'](_0x814d('0x13'),_0x2f2efc,_0xec8c9['error']['message']);return _0x21d598(_0xec8c9[_0x814d('0x16')]['message']);}else{logger[_0x814d('0x12')](_0x814d('0x13'),_0x2f2efc,'request\x20sent');_0x21d598(_0xec8c9[_0x814d('0x19')]['message']);}})[_0x814d('0x1a')](function(_0x33097c){logger[_0x814d('0x16')](_0x814d('0x13'),_0x2f2efc,_0x33097c);_0x1e3e4a(_0x33097c);});});} \ No newline at end of file +var _0xa631=['bluebird','ioredis','../../config/logger','rpc','../../config/environment','defaults','redis','localhost','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment'];(function(_0x162003,_0x2e2322){var _0x1be39a=function(_0x2cd83e){while(--_0x2cd83e){_0x162003['push'](_0x162003['shift']());}};_0x1be39a(++_0x2e2322);}(_0xa631,0xe4));var _0x1a63=function(_0x3936e3,_0x4758fe){_0x3936e3=_0x3936e3-0x0;var _0x3ea0f5=_0xa631[_0x3936e3];return _0x3ea0f5;};'use strict';var _=require('lodash');var util=require(_0x1a63('0x0'));var moment=require(_0x1a63('0x1'));var BPromise=require(_0x1a63('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a63('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1a63('0x4'))(_0x1a63('0x5'));var config=require(_0x1a63('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x1a63('0x7')](config[_0x1a63('0x8')],{'host':_0x1a63('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1a63('0xa'))[_0x1a63('0xb')](socket);function respondWithRpcPromise(_0x1e9e87,_0x334902,_0x38b2be){return new BPromise(function(_0x58dd88,_0x430c4f){return client[_0x1a63('0xc')](_0x1e9e87,_0x38b2be)[_0x1a63('0xd')](function(_0x121a94){logger['info'](_0x1a63('0xe'),_0x334902,_0x1a63('0xf'));logger[_0x1a63('0x10')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x334902,_0x1a63('0xf'),JSON['stringify'](_0x121a94));if(_0x121a94[_0x1a63('0x11')]){if(_0x121a94[_0x1a63('0x11')][_0x1a63('0x12')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x334902,_0x121a94[_0x1a63('0x11')][_0x1a63('0x13')]);return _0x430c4f(_0x121a94[_0x1a63('0x11')][_0x1a63('0x13')]);}logger[_0x1a63('0x11')]('ChatGroup,\x20%s,\x20%s',_0x334902,_0x121a94[_0x1a63('0x11')]['message']);return _0x58dd88(_0x121a94[_0x1a63('0x11')][_0x1a63('0x13')]);}else{logger[_0x1a63('0x14')](_0x1a63('0xe'),_0x334902,_0x1a63('0xf'));_0x58dd88(_0x121a94[_0x1a63('0x15')][_0x1a63('0x13')]);}})[_0x1a63('0x16')](function(_0x3feaa5){logger[_0x1a63('0x11')]('ChatGroup,\x20%s,\x20%s',_0x334902,_0x3feaa5);_0x430c4f(_0x3feaa5);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 344a2e1..3aa656c 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 _0x598f=['length','chatGroup:','./chatGroup.events','save','update','emit','removeListener','register'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x598f,0x152));var _0xf598=function(_0x491443,_0x1fb679){_0x491443=_0x491443-0x0;var _0x3fd00a=_0x598f[_0x491443];return _0x3fd00a;};'use strict';var ChatGroupEvents=require(_0xf598('0x0'));var events=[_0xf598('0x1'),'remove',_0xf598('0x2')];function createListener(_0x16d29a,_0x2f3d6f){return function(_0x97148c){_0x2f3d6f[_0xf598('0x3')](_0x16d29a,_0x97148c);};}function removeListener(_0x4bd7cf,_0x3443bf){return function(){ChatGroupEvents[_0xf598('0x4')](_0x4bd7cf,_0x3443bf);};}exports[_0xf598('0x5')]=function(_0x11961f){for(var _0x1c3291=0x0,_0x430e44=events[_0xf598('0x6')];_0x1c3291<_0x430e44;_0x1c3291++){var _0xd53e5d=events[_0x1c3291];var _0x295043=createListener(_0xf598('0x7')+_0xd53e5d,_0x11961f);ChatGroupEvents['on'](_0xd53e5d,_0x295043);}}; \ No newline at end of file +var _0x74ab=['save','remove','update','emit','removeListener','length'];(function(_0xf91841,_0x182ae3){var _0x4b9c44=function(_0x2e216e){while(--_0x2e216e){_0xf91841['push'](_0xf91841['shift']());}};_0x4b9c44(++_0x182ae3);}(_0x74ab,0x114));var _0xb74a=function(_0x3dcc46,_0xa5335e){_0x3dcc46=_0x3dcc46-0x0;var _0x4ef9a7=_0x74ab[_0x3dcc46];return _0x4ef9a7;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xb74a('0x0'),_0xb74a('0x1'),_0xb74a('0x2')];function createListener(_0x49baba,_0x421cda){return function(_0x4b2361){_0x421cda[_0xb74a('0x3')](_0x49baba,_0x4b2361);};}function removeListener(_0xfb6e08,_0x16797a){return function(){ChatGroupEvents[_0xb74a('0x4')](_0xfb6e08,_0x16797a);};}exports['register']=function(_0x4ae37e){for(var _0x404f39=0x0,_0x6cea38=events[_0xb74a('0x5')];_0x404f39<_0x6cea38;_0x404f39++){var _0x386170=events[_0x404f39];var _0x318476=createListener('chatGroup:'+_0x386170,_0x4ae37e);ChatGroupEvents['on'](_0x386170,_0x318476);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index e871078..babcb15 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 _0xe1ba=['../../components/auth/service','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','addMessage','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x481317,_0xf38bda){var _0x18ae45=function(_0x48fe1a){while(--_0x48fe1a){_0x481317['push'](_0x481317['shift']());}};_0x18ae45(++_0xf38bda);}(_0xe1ba,0x1ab));var _0xae1b=function(_0x5db65f,_0xf89cc8){_0x5db65f=_0x5db65f-0x0;var _0x34fb4b=_0xe1ba[_0x5db65f];return _0x34fb4b;};'use strict';var multer=require(_0xae1b('0x0'));var util=require(_0xae1b('0x1'));var path=require('path');var timeout=require(_0xae1b('0x2'));var express=require('express');var router=express[_0xae1b('0x3')]();var fs_extra=require(_0xae1b('0x4'));var auth=require(_0xae1b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xae1b('0x6'));router[_0xae1b('0x7')]('/',auth[_0xae1b('0x8')](),controller[_0xae1b('0x9')]);router[_0xae1b('0x7')](_0xae1b('0xa'),auth[_0xae1b('0x8')](),controller['describe']);router['get'](_0xae1b('0xb'),auth['isAuthenticated'](),controller[_0xae1b('0xc')]);router[_0xae1b('0x7')](_0xae1b('0xd'),auth[_0xae1b('0x8')](),controller[_0xae1b('0xe')]);router['get'](_0xae1b('0xf'),auth[_0xae1b('0x8')](),controller[_0xae1b('0x10')]);router[_0xae1b('0x7')](_0xae1b('0x11'),auth[_0xae1b('0x8')](),controller['getMessages']);router[_0xae1b('0x12')]('/',auth[_0xae1b('0x8')](),controller[_0xae1b('0x13')]);router['post']('/:id/members',auth[_0xae1b('0x8')](),controller[_0xae1b('0x14')]);router[_0xae1b('0x12')](_0xae1b('0x11'),auth[_0xae1b('0x8')](),controller[_0xae1b('0x15')]);router[_0xae1b('0x16')](_0xae1b('0xb'),auth[_0xae1b('0x8')](),controller[_0xae1b('0x17')]);router[_0xae1b('0x18')](_0xae1b('0xb'),auth[_0xae1b('0x8')](),controller[_0xae1b('0x19')]);router[_0xae1b('0x18')](_0xae1b('0xf'),auth[_0xae1b('0x8')](),controller['removeMembers']);module[_0xae1b('0x1a')]=router; \ No newline at end of file +var _0x3e4b=['addMessage','put','update','delete','removeMembers','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','getUnread','getMembers','/:id/messages','getMessages','post','create','/:id/members','addMembers'];(function(_0x51276e,_0x28b616){var _0x1f5f30=function(_0x3ab106){while(--_0x3ab106){_0x51276e['push'](_0x51276e['shift']());}};_0x1f5f30(++_0x28b616);}(_0x3e4b,0xf8));var _0xb3e4=function(_0x4df5e3,_0x3433ff){_0x4df5e3=_0x4df5e3-0x0;var _0x13696c=_0x3e4b[_0x4df5e3];return _0x13696c;};'use strict';var multer=require(_0xb3e4('0x0'));var util=require(_0xb3e4('0x1'));var path=require(_0xb3e4('0x2'));var timeout=require(_0xb3e4('0x3'));var express=require(_0xb3e4('0x4'));var router=express['Router']();var fs_extra=require(_0xb3e4('0x5'));var auth=require(_0xb3e4('0x6'));var interaction=require(_0xb3e4('0x7'));var config=require('../../config/environment');var controller=require('./chatGroup.controller');router[_0xb3e4('0x8')]('/',auth[_0xb3e4('0x9')](),controller[_0xb3e4('0xa')]);router['get'](_0xb3e4('0xb'),auth[_0xb3e4('0x9')](),controller['describe']);router['get'](_0xb3e4('0xc'),auth[_0xb3e4('0x9')](),controller[_0xb3e4('0xd')]);router[_0xb3e4('0x8')]('/:id/unread',auth[_0xb3e4('0x9')](),controller[_0xb3e4('0xe')]);router[_0xb3e4('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0xb3e4('0xf')]);router[_0xb3e4('0x8')](_0xb3e4('0x10'),auth[_0xb3e4('0x9')](),controller[_0xb3e4('0x11')]);router[_0xb3e4('0x12')]('/',auth[_0xb3e4('0x9')](),controller[_0xb3e4('0x13')]);router[_0xb3e4('0x12')](_0xb3e4('0x14'),auth['isAuthenticated'](),controller[_0xb3e4('0x15')]);router['post'](_0xb3e4('0x10'),auth['isAuthenticated'](),controller[_0xb3e4('0x16')]);router[_0xb3e4('0x17')](_0xb3e4('0xc'),auth[_0xb3e4('0x9')](),controller[_0xb3e4('0x18')]);router[_0xb3e4('0x19')](_0xb3e4('0xc'),auth[_0xb3e4('0x9')](),controller['destroy']);router['delete'](_0xb3e4('0x14'),auth[_0xb3e4('0x9')](),controller[_0xb3e4('0x1a')]);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 de03b3e..b947370 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 _0x93c1=['INTEGER','ENUM','star','TEXT','STRING','long','DATE','out','BOOLEAN','sequelize'];(function(_0x4eb95d,_0x4a13f6){var _0x5ed323=function(_0x405e23){while(--_0x405e23){_0x4eb95d['push'](_0x4eb95d['shift']());}};_0x5ed323(++_0x4a13f6);}(_0x93c1,0x1f3));var _0x193c=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x93c1[_0x1abb09];return _0xea1c07;};'use strict';var Sequelize=require(_0x193c('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x193c('0x1')]},'ratingType':{'type':Sequelize[_0x193c('0x2')](_0x193c('0x3'),'thumb'),'defaultValue':_0x193c('0x3')},'ratingMessage':{'type':Sequelize[_0x193c('0x4')]},'pathTranscript':{'type':Sequelize[_0x193c('0x4')]},'mailTranscript':{'type':Sequelize[_0x193c('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x193c('0x5')]},'thirdDisposition':{'type':Sequelize[_0x193c('0x5')]},'note':{'type':Sequelize[_0x193c('0x5')]},'browserName':{'type':Sequelize[_0x193c('0x5')]},'browserVersion':{'type':Sequelize[_0x193c('0x5')]},'osName':{'type':Sequelize[_0x193c('0x5')]},'osVersion':{'type':Sequelize[_0x193c('0x5')]},'deviceModel':{'type':Sequelize[_0x193c('0x5')]},'deviceVendor':{'type':Sequelize[_0x193c('0x5')]},'deviceType':{'type':Sequelize[_0x193c('0x5')]},'referer':{'type':Sequelize[_0x193c('0x4')]},'customerIp':{'type':Sequelize[_0x193c('0x5')]},'formData':{'type':Sequelize['TEXT'](_0x193c('0x6'))},'read1stAt':{'type':Sequelize[_0x193c('0x7')]},'lastMsgAt':{'type':Sequelize[_0x193c('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x193c('0x2')]('in',_0x193c('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x193c('0x5')]},'customerPort':{'type':Sequelize[_0x193c('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x193c('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x193c('0x9')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x76b4=['INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','out','sequelize','exports','BOOLEAN'];(function(_0x7d5d57,_0x16ca45){var _0x39a632=function(_0x3a3ff9){while(--_0x3a3ff9){_0x7d5d57['push'](_0x7d5d57['shift']());}};_0x39a632(++_0x16ca45);}(_0x76b4,0x111));var _0x476b=function(_0x2a8584,_0x78d071){_0x2a8584=_0x2a8584-0x0;var _0xadaebb=_0x76b4[_0x2a8584];return _0xadaebb;};'use strict';var Sequelize=require(_0x476b('0x0'));module[_0x476b('0x1')]={'closed':{'type':Sequelize[_0x476b('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x476b('0x3')]},'ratingType':{'type':Sequelize[_0x476b('0x4')](_0x476b('0x5'),_0x476b('0x6')),'defaultValue':_0x476b('0x5')},'ratingMessage':{'type':Sequelize[_0x476b('0x7')]},'pathTranscript':{'type':Sequelize[_0x476b('0x7')]},'mailTranscript':{'type':Sequelize[_0x476b('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x476b('0x9')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x476b('0x8')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x476b('0x8')]},'browserName':{'type':Sequelize[_0x476b('0x8')]},'browserVersion':{'type':Sequelize[_0x476b('0x8')]},'osName':{'type':Sequelize[_0x476b('0x8')]},'osVersion':{'type':Sequelize[_0x476b('0x8')]},'deviceModel':{'type':Sequelize[_0x476b('0x8')]},'deviceVendor':{'type':Sequelize[_0x476b('0x8')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x476b('0x7')]},'customerIp':{'type':Sequelize[_0x476b('0x8')]},'formData':{'type':Sequelize[_0x476b('0x7')](_0x476b('0xa'))},'read1stAt':{'type':Sequelize[_0x476b('0x9')]},'lastMsgAt':{'type':Sequelize[_0x476b('0x9')]},'lastMsgDirection':{'type':Sequelize[_0x476b('0x4')]('in',_0x476b('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x476b('0x8')]},'customerPort':{'type':Sequelize[_0x476b('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x476b('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0x476b('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x476b('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 9109d45..f9ecaae 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 _0x56f0=['spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','server','attachments','transcript-%d-%s.zip','firstName','lastName','direction','read','Owner','mkdirSync','Chat','Account','N.A.','toString','closedAt','browserName','osName','referer','customerIp','customerPort','existsSync','createReadStream','pipe','createWriteStream','value','renderFile','downloadInteraction.ejs','transcript-','err','rimraf','zip-dir','request-promise','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','client','http','request','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','ChatInteraction,\x20%s,\x20%s','message','status','end','json','offset','limit','count','update','then','destroy','stack','name','send','body','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','find','create','describe','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Sequelize','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','attachmentDownload','Unauthorized','Attachment','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsiteId','CmContact','format','%s%d','agentAlias','System','ContactId','agentIdentifier','website_alias','agent_alias','User','alias','createdAt','MM/DD/YYYY\x20HH:mm:ss','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','order','sort','where','ChatInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','hasOwnProperty','pick','secret','options','includeAgent','push','rows','setTags'];(function(_0x590b63,_0x14debb){var _0x3c9380=function(_0x58fc67){while(--_0x58fc67){_0x590b63['push'](_0x590b63['shift']());}};_0x3c9380(++_0x14debb);}(_0x56f0,0xf3));var _0x056f=function(_0x166953,_0x214d3a){_0x166953=_0x166953-0x0;var _0x4a8baf=_0x56f0[_0x166953];return _0x4a8baf;};'use strict';var rimraf=require(_0x056f('0x0'));var zipdir=require(_0x056f('0x1'));var rp=require(_0x056f('0x2'));var moment=require(_0x056f('0x3'));var BPromise=require(_0x056f('0x4'));var Mustache=require('mustache');var util=require(_0x056f('0x5'));var path=require(_0x056f('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x056f('0x7'));var Redis=require(_0x056f('0x8'));var interaction=require(_0x056f('0x9'));var qs=require(_0x056f('0xa'));var pdf=require(_0x056f('0xb'));var logger=require(_0x056f('0xc'))('api');var config=require(_0x056f('0xd'));var db=require(_0x056f('0xe'))['db'];config['redis']=_[_0x056f('0xf')](config[_0x056f('0x10')],{'host':_0x056f('0x11'),'port':0x18eb});var socket=require(_0x056f('0x12'))(new Redis(config[_0x056f('0x10')]));require(_0x056f('0x13'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x056f('0x14')][_0x056f('0x15')]({'port':0x232b});var client9004=jayson[_0x056f('0x14')][_0x056f('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x337c19,_0x4915f4,_0x5adc36,_0xb4c2b9){return new BPromise(function(_0x82ec7,_0x5db0c4){var _0x378ed4=_0xb4c2b9||client;return _0x378ed4[_0x056f('0x16')](_0x337c19,_0x5adc36)['then'](function(_0x4524c2){logger[_0x056f('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x4915f4,_0x056f('0x18'));logger['debug'](_0x056f('0x19'),_0x4915f4,_0x056f('0x18'),JSON[_0x056f('0x1a')](_0x4524c2));if(_0x4524c2['error']){if(_0x4524c2['error']['code']===0x1f4){logger[_0x056f('0x1b')](_0x056f('0x1c'),_0x4915f4,_0x4524c2[_0x056f('0x1b')][_0x056f('0x1d')]);return _0x5db0c4(_0x4524c2[_0x056f('0x1b')][_0x056f('0x1d')]);}logger[_0x056f('0x1b')](_0x056f('0x1c'),_0x4915f4,_0x4524c2[_0x056f('0x1b')][_0x056f('0x1d')]);return _0x82ec7(_0x4524c2[_0x056f('0x1b')]['message']);}else{logger[_0x056f('0x17')](_0x056f('0x1c'),_0x4915f4,_0x056f('0x18'));_0x82ec7(_0x4524c2['result']['message']);}})['catch'](function(_0x14c016){logger[_0x056f('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x4915f4,_0x14c016);_0x5db0c4(_0x14c016);});});}function respondWithStatusCode(_0x5d8927,_0x498898){_0x498898=_0x498898||0xcc;return function(_0x5745af){if(_0x5745af){return _0x5d8927['sendStatus'](_0x498898);}return _0x5d8927[_0x056f('0x1e')](_0x498898)[_0x056f('0x1f')]();};}function respondWithResult(_0x3638fd,_0x17b4bd){_0x17b4bd=_0x17b4bd||0xc8;return function(_0x9be413){if(_0x9be413){return _0x3638fd['status'](_0x17b4bd)[_0x056f('0x20')](_0x9be413);}};}function respondWithFilteredResult(_0x56f8a9,_0x1eacbd){return function(_0x52817e){if(_0x52817e){var _0xd2dbaf=typeof _0x1eacbd[_0x056f('0x21')]==='undefined'&&typeof _0x1eacbd[_0x056f('0x22')]==='undefined';var _0x5161f4=_0x52817e[_0x056f('0x23')];var _0x2573c5=_0xd2dbaf?0x0:_0x1eacbd[_0x056f('0x21')];var _0x174752=_0xd2dbaf?_0x52817e[_0x056f('0x23')]:_0x1eacbd[_0x056f('0x21')]+_0x1eacbd[_0x056f('0x22')];var _0x215a76;if(_0x174752>=_0x5161f4){_0x174752=_0x5161f4;_0x215a76=0xc8;}else{_0x215a76=0xce;}_0x56f8a9[_0x056f('0x1e')](_0x215a76);return _0x56f8a9['set']('Content-Range',_0x2573c5+'-'+_0x174752+'/'+_0x5161f4)[_0x056f('0x20')](_0x52817e);}return null;};}function saveUpdates(_0x3dd29e){return function(_0x539f39){if(_0x539f39){return _0x539f39[_0x056f('0x24')](_0x3dd29e)[_0x056f('0x25')](function(_0x4bb68d){return _0x4bb68d;});}return null;};}function removeEntity(_0x58ef12){return function(_0x26274a){if(_0x26274a){return _0x26274a[_0x056f('0x26')]()['then'](function(){_0x58ef12['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2401df){return function(_0xa23765){if(!_0xa23765){_0x2401df['sendStatus'](0x194);}return _0xa23765;};}function handleError(_0x43ba59,_0x40b71c){_0x40b71c=_0x40b71c||0x1f4;return function(_0x38a1ec){logger['error'](_0x38a1ec[_0x056f('0x27')]);if(_0x38a1ec[_0x056f('0x28')]){delete _0x38a1ec[_0x056f('0x28')];}_0x43ba59[_0x056f('0x1e')](_0x40b71c)[_0x056f('0x29')](_0x38a1ec);};}function getMustacheRender(_0x25a34c,_0x2d52b0){return Mustache['render'](_0x25a34c,_['merge'](_0x2d52b0[_0x056f('0x2a')],{'contact':_0x2d52b0[_0x056f('0x2b')],'message':_0x2d52b0[_0x056f('0x1d')],'agent':_0x2d52b0[_0x056f('0x2c')],'interaction':_0x2d52b0[_0x056f('0x2d')],'account':_0x2d52b0[_0x056f('0x2e')]}))||'';}exports[_0x056f('0x2f')]=function(_0x20f2f8,_0x42e192){var _0x2ca8f0={};var _0x91114d=_[_0x056f('0x30')](db[_0x056f('0x31')][_0x056f('0x32')],function(_0x7cd0b5){return{'name':_0x7cd0b5[_0x056f('0x33')],'type':_0x7cd0b5[_0x056f('0x34')][_0x056f('0x35')]};});_0x2ca8f0=qs[_0x056f('0x36')](_0x91114d,_0x20f2f8);return interaction[_0x056f('0x37')](_0x056f('0x38'),_0x20f2f8[_0x056f('0x39')],_0x20f2f8['user'],_0x2ca8f0,_0x91114d)[_0x056f('0x25')](respondWithFilteredResult(_0x42e192,_0x2ca8f0))[_0x056f('0x3a')](handleError(_0x42e192,null));};exports[_0x056f('0x3b')]=function(_0x1c56a1,_0x9a05d8){var _0x545654={'raw':![],'where':{'id':_0x1c56a1[_0x056f('0x3c')]['id']}},_0x3909fe={};_0x3909fe[_0x056f('0x3d')]=_[_0x056f('0x3e')](db[_0x056f('0x31')][_0x056f('0x32')]);_0x3909fe[_0x056f('0x39')]=_['keys'](_0x1c56a1['query']);_0x3909fe[_0x056f('0x3f')]=_[_0x056f('0x40')](_0x3909fe['model'],_0x3909fe[_0x056f('0x39')]);_0x545654['attributes']=_[_0x056f('0x40')](_0x3909fe['model'],qs[_0x056f('0x41')](_0x1c56a1[_0x056f('0x39')][_0x056f('0x41')]));_0x545654[_0x056f('0x42')]=_0x545654[_0x056f('0x42')][_0x056f('0x43')]?_0x545654['attributes']:_0x3909fe[_0x056f('0x3d')];if(_0x1c56a1['query'][_0x056f('0x44')]){_0x545654[_0x056f('0x45')]=[{'all':!![]}];}_0x545654=_[_0x056f('0x46')]({},_0x545654,_0x1c56a1['options']);return db[_0x056f('0x31')][_0x056f('0x47')](_0x545654)[_0x056f('0x25')](handleEntityNotFound(_0x9a05d8,null))['then'](respondWithResult(_0x9a05d8,null))[_0x056f('0x3a')](handleError(_0x9a05d8,null));};exports[_0x056f('0x48')]=function(_0x2f612c,_0x35ea0d){return db[_0x056f('0x31')][_0x056f('0x48')](_0x2f612c[_0x056f('0x2a')],{})[_0x056f('0x25')](respondWithResult(_0x35ea0d,0xc9))[_0x056f('0x3a')](handleError(_0x35ea0d,null));};exports[_0x056f('0x24')]=function(_0x1d36ef,_0x2473c3){if(_0x1d36ef[_0x056f('0x2a')]['id']){delete _0x1d36ef['body']['id'];}return db[_0x056f('0x31')]['find']({'where':{'id':_0x1d36ef[_0x056f('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2473c3,null))['then'](saveUpdates(_0x1d36ef[_0x056f('0x2a')],null))['then'](respondWithResult(_0x2473c3,null))[_0x056f('0x3a')](handleError(_0x2473c3,null));};exports[_0x056f('0x26')]=function(_0x41e50b,_0xf8c909){return db[_0x056f('0x31')][_0x056f('0x47')]({'where':{'id':_0x41e50b[_0x056f('0x3c')]['id']}})['then'](handleEntityNotFound(_0xf8c909,null))['then'](removeEntity(_0xf8c909,null))[_0x056f('0x3a')](handleError(_0xf8c909,null));};exports[_0x056f('0x49')]=function(_0x135c8c,_0xa660f6){return db[_0x056f('0x31')][_0x056f('0x49')]()['then'](respondWithResult(_0xa660f6,null))['catch'](handleError(_0xa660f6,null));};exports['createVidaooSession']=function(_0x3f0d69,_0x3a00d7){var _0x406b2e=_0x3f0d69[_0x056f('0x3c')]['id'];var _0x1577eb;var _0x2a58fb;var _0x401aea;return db[_0x056f('0x31')]['findOne']({'where':{'id':_0x406b2e}})[_0x056f('0x25')](function(_0x25f3d8){_0x1577eb=_0x25f3d8;return db[_0x056f('0x4a')][_0x056f('0x4b')]({'where':{'id':_0x25f3d8['ChatWebsiteId']},'attributes':['id',_0x056f('0x4c'),_0x056f('0x4d'),_0x056f('0x4e'),_0x056f('0x4f'),_0x056f('0x50')],'raw':!![]});})[_0x056f('0x25')](function(_0x25a8a3){if(_0x25a8a3&&_0x25a8a3['vidaooApiKey']&&_0x25a8a3['vidaooEscalation']){_0x2a58fb=_0x25a8a3;var _0x13fce2={'interaction':{'id':_0x406b2e},'agent':{'id':_0x3f0d69[_0x056f('0x51')]['id'],'name':_0x3f0d69[_0x056f('0x51')][_0x056f('0x28')],'fullname':_0x3f0d69[_0x056f('0x51')][_0x056f('0x52')],'email':_0x3f0d69[_0x056f('0x51')][_0x056f('0x53')]},'contact':_0x3f0d69[_0x056f('0x2a')][_0x056f('0x2b')],'account':_0x3f0d69[_0x056f('0x2a')][_0x056f('0x2e')]};var _0x2d4a54={'rejectUnauthorized':![],'method':_0x056f('0x54'),'url':_0x056f('0x55'),'headers':{'X-APIKEY':_0x25a8a3[_0x056f('0x4c')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3f0d69[_0x056f('0x51')][_0x056f('0x53')]],'buttons':null,'topic':_0x2a58fb[_0x056f('0x4e')],'note':_[_0x056f('0x56')](_0x2a58fb[_0x056f('0x4f')])?null:getMustacheRender(_0x2a58fb[_0x056f('0x4f')],_0x13fce2),'metadata':null},'redirect':_0x056f('0x57'),'json':!![]};try{if(!_[_0x056f('0x56')](_0x2a58fb['vidaooMetadata'])){var _0x3d1f23=getMustacheRender(_0x2a58fb[_0x056f('0x50')],_0x13fce2);var _0x22747a=JSON['parse'](_0x3d1f23);_0x2d4a54[_0x056f('0x2a')][_0x056f('0x58')]=_0x22747a;}}catch(_0x41f031){throw new db['Sequelize'][(_0x056f('0x59'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x2d4a54);}else{throw new db['Sequelize'][(_0x056f('0x59'))](_0x056f('0x5a'));}})[_0x056f('0x25')](function(_0xa922ec){_0x401aea=_0xa922ec;if(_0x401aea['id']){var _0x57f9f4={'body':_0x401aea['join_url'],'ChatWebsiteId':_0x2a58fb['id'],'ChatInteractionId':_0x1577eb['id'],'direction':_0x056f('0x5b'),'UserId':_0x3f0d69[_0x056f('0x51')]['id']};return db[_0x056f('0x5c')][_0x056f('0x48')](_0x57f9f4,{});}else{throw new db[(_0x056f('0x5d'))]['ValidationError'](_0x056f('0x5e'));}})[_0x056f('0x25')](function(){return _0x1577eb[_0x056f('0x5f')]({'vidaooSessionId':_0x401aea['id']});})['then'](respondWithResult(_0x3a00d7,null))['catch'](handleError(_0x3a00d7,null));};exports[_0x056f('0x60')]=function(_0x4078d6,_0x66d7c5){if(_0x4078d6[_0x056f('0x2a')]['id']){delete _0x4078d6['body']['id'];}return db[_0x056f('0x31')][_0x056f('0x47')]({'where':{'id':_0x4078d6[_0x056f('0x3c')]['id']},'include':[{'model':db['CmContact'],'as':_0x056f('0x61')}]})[_0x056f('0x25')](handleEntityNotFound(_0x66d7c5,null))['then'](saveUpdates(_0x4078d6[_0x056f('0x2a')],null))[_0x056f('0x25')](respondWithResult(_0x66d7c5,null))['catch'](handleError(_0x66d7c5,null));};exports[_0x056f('0x62')]=function(_0x460efe,_0x2a10dc){if(_0x460efe[_0x056f('0x2a')]['id']){delete _0x460efe[_0x056f('0x2a')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x460efe[_0x056f('0x3c')]['id']}})[_0x056f('0x25')](function(_0x3c4375){if(!_0x3c4375){logger['error'](_0x056f('0x63'),_0x056f('0x62'),0x194,_0x056f('0x64'));_0x2a10dc[_0x056f('0x65')](0x194);}else{if(_0x3c4375[_0x056f('0x66')]){throw new db[(_0x056f('0x5d'))]['ValidationError'](_0x056f('0x67'));}}return _0x3c4375;})[_0x056f('0x25')](function(_0x94624e){if(_0x94624e){return _0x94624e[_0x056f('0x24')]({'closed':_0x460efe[_0x056f('0x2a')][_0x056f('0x68')],'disposition':_0x460efe[_0x056f('0x2a')][_0x056f('0x69')]})[_0x056f('0x25')](function(_0x575a71){return _0x575a71;});}})[_0x056f('0x25')](function(){return respondWithRpcPromise(_0x056f('0x6a'),_0x056f('0x62'),_0x460efe[_0x056f('0x2a')],client9004);})[_0x056f('0x25')](respondWithResult(_0x2a10dc,null))[_0x056f('0x3a')](handleError(_0x2a10dc,null));};exports[_0x056f('0x6b')]=function(_0x38fe3d,_0x24e615){_0x38fe3d[_0x056f('0x2a')]['name']=_0x38fe3d[_0x056f('0x6c')][_0x056f('0x6d')];_0x38fe3d[_0x056f('0x2a')][_0x056f('0x6e')]=_0x38fe3d['file'][_0x056f('0x6f')];_0x38fe3d[_0x056f('0x2a')][_0x056f('0x34')]=_0x38fe3d[_0x056f('0x6c')][_0x056f('0x70')];return db['Attachment'][_0x056f('0x48')](_0x38fe3d[_0x056f('0x2a')])[_0x056f('0x25')](respondWithResult(_0x24e615,0xc9))['catch'](handleError(_0x24e615,null));};exports[_0x056f('0x71')]=function(_0x52b1bf,_0x4db8c9){return db[_0x056f('0x31')][_0x056f('0x4b')]({'where':{'id':_0x52b1bf[_0x056f('0x3c')]['id']},'raw':!![]})[_0x056f('0x25')](handleEntityNotFound(_0x4db8c9,null))[_0x056f('0x25')](function(_0x51c231){if(_0x51c231){if(_0x51c231[_0x056f('0x68')]){return _0x4db8c9['status'](0x193)[_0x056f('0x20')]({'status':0x193,'message':_0x056f('0x72')});}return db[_0x056f('0x73')][_0x056f('0x4b')]({'where':{'id':_0x52b1bf[_0x056f('0x39')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x4db8c9,null));}})[_0x056f('0x25')](function(_0x428d14){if(_0x428d14){var _0x51ac9c=_0x428d14[_0x056f('0x74')]!==null;var _0x55a5de=path[_0x056f('0x75')](config[_0x056f('0x76')],_0x056f('0x77'));if(_0x51ac9c){_0x55a5de=path['join'](_0x55a5de,_0x056f('0x78'));}var _0x9c0e6a=path[_0x056f('0x75')](_0x55a5de,_0x428d14[_0x056f('0x6e')]);return _0x4db8c9[_0x056f('0x79')](_0x9c0e6a);}})[_0x056f('0x3a')](handleError(_0x4db8c9,null));};exports[_0x056f('0x7a')]=function(_0x40d0d3,_0x38216e){var _0x2a7969=null;var _0x3c721c=null;var _0x49ddff=null;if(_0x40d0d3[_0x056f('0x2a')]['id']){delete _0x40d0d3[_0x056f('0x2a')]['id'];}if(_0x40d0d3[_0x056f('0x2a')][_0x056f('0x7b')]){_0x49ddff=path['join'](config[_0x056f('0x76')],'server/files/chat/upload/',util['format'](_0x056f('0x7c'),Date[_0x056f('0x7d')]()));_0x40d0d3[_0x056f('0x2a')][_0x056f('0x7e')]=_0x49ddff;}return db[_0x056f('0x31')][_0x056f('0x47')]({'where':{'id':_0x40d0d3[_0x056f('0x3c')]['id']},'include':[{'model':db[_0x056f('0x5c')],'as':_0x056f('0x7f'),'include':[{'model':db['User'],'as':'User'}]}]})[_0x056f('0x25')](handleEntityNotFound(_0x38216e,null))['then'](saveUpdates(_0x40d0d3[_0x056f('0x2a')],null))[_0x056f('0x25')](function(_0x5c3634){if(_0x5c3634){_0x2a7969=_0x5c3634;return db[_0x056f('0x4a')]['find']({'where':{'id':_0x2a7969[_0x056f('0x80')]}});}})['then'](function(_0x57125f){if(_0x57125f){_0x3c721c=_0x57125f;return db[_0x056f('0x81')][_0x056f('0x47')]({'where':{'id':_0x2a7969['ContactId']}});}})[_0x056f('0x25')](function(_0x9b090e){if(_0x9b090e){if(_0x49ddff){var _0x2e2b20=null;for(var _0x521e6f=0x1;_0x521e6f<_0x2a7969[_0x056f('0x7f')][_0x056f('0x43')];++_0x521e6f){_0x2e2b20=_0x2a7969['Messages'][_0x521e6f];var _0x58cca8=_0x2e2b20['UserId']?util[_0x056f('0x82')](_0x056f('0x83'),_0x3c721c[_0x056f('0x84')],_0x2e2b20[_0x056f('0x66')]):_0x056f('0x85');var _0x379eb5=_0x40d0d3[_0x056f('0x2a')]['customer']||util[_0x056f('0x82')](_0x056f('0x83'),'Visitor',_0x2e2b20[_0x056f('0x86')]);switch(_0x3c721c[_0x056f('0x87')]){case _0x056f('0x88'):_0x58cca8=_0x2e2b20[_0x056f('0x66')]?util[_0x056f('0x82')](_0x056f('0x83'),_0x3c721c['agentAlias'],_0x2e2b20[_0x056f('0x66')]):'System';break;case _0x056f('0x89'):_0x58cca8=_0x2e2b20[_0x056f('0x66')]?_0x2e2b20[_0x056f('0x8a')][_0x056f('0x8b')]||_0x2e2b20[_0x056f('0x8a')][_0x056f('0x52')]:_0x056f('0x85');break;case'agent_fullname':_0x58cca8=_0x2e2b20['UserId']?_0x2e2b20[_0x056f('0x8a')][_0x056f('0x52')]:_0x056f('0x85');break;default:_0x58cca8=_0x2e2b20['UserId']?util[_0x056f('0x82')]('%s%d',_0x3c721c['agentAlias'],_0x2e2b20[_0x056f('0x66')]):_0x056f('0x85');}var _0x590ed4=util[_0x056f('0x82')]('[%s]\x20%s:\x20%s\x0a',moment(_0x2e2b20[_0x056f('0x8c')])[_0x056f('0x82')](_0x056f('0x8d')),_0x2e2b20['direction']==='in'?_0x379eb5:_0x58cca8,_0x2e2b20[_0x056f('0x2a')]);if(!_0x2e2b20['secret']){fs[_0x056f('0x8e')](_0x49ddff,_0x590ed4);}}return db[_0x056f('0x8f')][_0x056f('0x4b')]({'where':{'service':!![]},'include':[{'model':db[_0x056f('0x90')],'as':_0x056f('0x91'),'raw':!![],'include':[{'model':db[_0x056f('0x92')],'as':_0x056f('0x92'),'raw':!![]}]}]});}}})[_0x056f('0x25')](function(_0x50f680){if(!_0x50f680||!_0x50f680[_0x056f('0x91')]||!_0x40d0d3[_0x056f('0x2a')])return _0x2a7969;var _0x12b548=_0x50f680[_0x056f('0x93')]();return respondWithRpcPromise(_0x056f('0x94'),_0x056f('0x95'),{'account':_0x12b548,'message':{'from':util['format'](_0x056f('0x96'),_0x50f680[_0x056f('0x28')],_0x50f680[_0x056f('0x53')]||_0x50f680[_0x056f('0x91')]['user']),'to':_0x40d0d3[_0x056f('0x2a')][_0x056f('0x7b')],'subject':_0x056f('0x97'),'text':util['format'](_0x056f('0x98'),_0x40d0d3['body'][_0x056f('0x7b')]),'attachments':[{'path':_0x49ddff}]}})[_0x056f('0x25')](function(){return _0x2a7969;})[_0x056f('0x3a')](function(_0x18cc76){logger['error'](_0x18cc76);});})['then'](respondWithStatusCode(_0x38216e,0xc8))[_0x056f('0x3a')](handleError(_0x38216e,null));};exports[_0x056f('0x99')]=function(_0x4780ce,_0x2d826f){return db[_0x056f('0x5c')]['find']({'where':{'id':_0x4780ce['params']['id']}})[_0x056f('0x25')](handleEntityNotFound(_0x2d826f,null))[_0x056f('0x25')](function(_0x29c66a){if(_0x29c66a){return _0x29c66a[_0x056f('0x99')](_0x4780ce[_0x056f('0x2a')][_0x056f('0x9a')],_[_0x056f('0x9b')](_0x4780ce['body'],[_0x056f('0x9a'),'id'])||{});}})['then'](respondWithResult(_0x2d826f,null))[_0x056f('0x3a')](handleError(_0x2d826f,null));};exports[_0x056f('0x9c')]=function(_0x2de2a3,_0x39b4ff){var _0x503d7c={'raw':![],'where':{}};var _0x26629d={};var _0x5f143a={'count':0x0,'rows':[]};return db[_0x056f('0x31')][_0x056f('0x4b')]({'where':{'id':_0x2de2a3[_0x056f('0x3c')]['id']}})['then'](handleEntityNotFound(_0x39b4ff,null))[_0x056f('0x25')](function(_0x8c3a9f){if(_0x8c3a9f){_0x26629d['model']=_['keys'](db[_0x056f('0x5c')][_0x056f('0x32')]);_0x26629d['query']=_[_0x056f('0x3e')](_0x2de2a3[_0x056f('0x39')]);_0x26629d[_0x056f('0x3f')]=_['intersection'](_0x26629d[_0x056f('0x3d')],_0x26629d[_0x056f('0x39')]);_0x503d7c[_0x056f('0x42')]=_[_0x056f('0x40')](_0x26629d[_0x056f('0x3d')],qs[_0x056f('0x41')](_0x2de2a3['query'][_0x056f('0x41')]));_0x503d7c[_0x056f('0x42')]=_0x503d7c[_0x056f('0x42')]['length']?_0x503d7c['attributes']:_0x26629d[_0x056f('0x3d')];if(!_0x2de2a3[_0x056f('0x39')]['hasOwnProperty']('nolimit')){_0x503d7c[_0x056f('0x22')]=qs[_0x056f('0x22')](_0x2de2a3[_0x056f('0x39')][_0x056f('0x22')]);_0x503d7c[_0x056f('0x21')]=qs[_0x056f('0x21')](_0x2de2a3[_0x056f('0x39')][_0x056f('0x21')]);}_0x503d7c[_0x056f('0x9d')]=qs[_0x056f('0x9e')](_0x2de2a3[_0x056f('0x39')][_0x056f('0x9e')]);_0x503d7c[_0x056f('0x9f')]=qs['filters'](_['pick'](_0x2de2a3['query'],_0x26629d['filters']));_0x503d7c[_0x056f('0x9f')][_0x056f('0xa0')]=_0x8c3a9f['id'];if(_0x2de2a3[_0x056f('0x39')][_0x056f('0xa1')]){_0x503d7c[_0x056f('0x9f')]=_[_0x056f('0x46')](_0x503d7c[_0x056f('0x9f')],{'$or':_[_0x056f('0x30')](_0x503d7c[_0x056f('0x42')],function(_0x3f4110){var _0x5916c3={};_0x5916c3[_0x3f4110]={'$like':'%'+_0x2de2a3['query'][_0x056f('0xa1')]+'%'};return _0x5916c3;})});}if(_0x2de2a3[_0x056f('0x39')][_0x056f('0xa2')]){var _0xee1a5=_0x2de2a3[_0x056f('0x39')][_0x056f('0xa2')]['split'](',');var _0x263129={};_0x263129[_0xee1a5[0x0]]={'$gte':moment(_0xee1a5[0x1])[_0x056f('0x82')](_0x056f('0xa3'))};_0x503d7c[_0x056f('0x9f')]=_[_0x056f('0x46')](_0x503d7c[_0x056f('0x9f')],_0x263129);}_0x503d7c=_[_0x056f('0x46')]({},_0x503d7c,_0x2de2a3['options']);return db['ChatMessage']['count']({'where':_0x503d7c[_0x056f('0x9f')]})[_0x056f('0x25')](function(_0x2dc499){_0x5f143a[_0x056f('0x23')]=_0x2dc499;if(_0x2de2a3[_0x056f('0x39')][_0x056f('0x44')]){_0x503d7c[_0x056f('0x45')]=[{'all':!![]}];}return db[_0x056f('0x5c')][_0x056f('0x37')](_0x503d7c);})[_0x056f('0x25')](function(_0x32c21a){_0x5f143a['rows']=_0x32c21a;return _0x5f143a;});}})[_0x056f('0x25')](respondWithFilteredResult(_0x39b4ff,_0x503d7c))[_0x056f('0x3a')](handleError(_0x39b4ff,null));};exports[_0x056f('0xa4')]=function(_0x169286,_0x5ce4de){var _0x3b96c6={'where':{}},_0x746dd9={},_0x3f6ce7={'count':0x0,'rows':[]};return db[_0x056f('0x31')][_0x056f('0x4b')]({'where':{'id':_0x169286['params']['id']}})[_0x056f('0x25')](handleEntityNotFound(_0x5ce4de,null))[_0x056f('0x25')](function(_0x2da4bc){if(_0x2da4bc){_0x746dd9[_0x056f('0x3d')]=_[_0x056f('0x3e')](db[_0x056f('0x5c')][_0x056f('0x32')]);_0x746dd9[_0x056f('0x39')]=_[_0x056f('0x3e')](_0x169286['query']);_0x746dd9[_0x056f('0x3f')]=_[_0x056f('0x40')](_0x746dd9[_0x056f('0x3d')],_0x746dd9['query']);_0x3b96c6[_0x056f('0x42')]=_[_0x056f('0x40')](_0x746dd9['model'],qs[_0x056f('0x41')](_0x169286[_0x056f('0x39')][_0x056f('0x41')]));_0x3b96c6[_0x056f('0x42')]=_0x3b96c6[_0x056f('0x42')][_0x056f('0x43')]?_0x3b96c6[_0x056f('0x42')]:_0x746dd9[_0x056f('0x3d')];if(!_0x169286[_0x056f('0x39')][_0x056f('0xa5')]('nolimit')){_0x3b96c6[_0x056f('0x22')]=qs['limit'](_0x169286['query'][_0x056f('0x22')]);_0x3b96c6[_0x056f('0x21')]=qs[_0x056f('0x21')](_0x169286['query'][_0x056f('0x21')]);}_0x3b96c6['order']=qs['sort'](_0x169286[_0x056f('0x39')][_0x056f('0x9e')]);_0x3b96c6['where']=qs[_0x056f('0x3f')](_[_0x056f('0xa6')](_0x169286[_0x056f('0x39')],_0x746dd9[_0x056f('0x3f')]));_0x3b96c6[_0x056f('0x9f')]['ChatInteractionId']=_0x2da4bc['id'];if(_0x169286[_0x056f('0x39')][_0x056f('0xa1')]){_0x3b96c6[_0x056f('0x9f')]=_[_0x056f('0x46')](_0x3b96c6[_0x056f('0x9f')],{'$or':_[_0x056f('0x30')](_0x3b96c6[_0x056f('0x42')],function(_0xf3fa8){var _0x387cfa={};_0x387cfa[_0xf3fa8]={'$like':'%'+_0x169286[_0x056f('0x39')][_0x056f('0xa1')]+'%'};return _0x387cfa;})});}_0x3b96c6[_0x056f('0x9f')][_0x056f('0xa7')]=![];if(_0x169286['query']['id']){_0x3b96c6['where']['id']={'$gt':_0x169286[_0x056f('0x39')]['id']};}_0x3b96c6=_['merge']({},_0x3b96c6,_0x169286[_0x056f('0xa8')]);return db['ChatMessage']['count']({'where':_0x3b96c6[_0x056f('0x9f')]})[_0x056f('0x25')](function(_0x2a2f94){_0x3f6ce7[_0x056f('0x23')]=_0x2a2f94;_0x3b96c6[_0x056f('0x45')]=[];if(_0x169286[_0x056f('0x39')][_0x056f('0xa9')]){_0x3b96c6[_0x056f('0x45')][_0x056f('0xaa')]({'model':db[_0x056f('0x8a')],'as':'User','attributes':['id',_0x056f('0x52'),'alias']});}if(_0x169286['query'][_0x056f('0x44')]){_0x3b96c6[_0x056f('0x45')]=[{'all':!![]}];}return db[_0x056f('0x5c')][_0x056f('0x37')](_0x3b96c6);})[_0x056f('0x25')](function(_0x2414c3){_0x3f6ce7[_0x056f('0xab')]=_0x2414c3;return _0x3f6ce7;});}})[_0x056f('0x25')](respondWithFilteredResult(_0x5ce4de,_0x3b96c6))[_0x056f('0x3a')](handleError(_0x5ce4de,null));};exports['addTags']=function(_0x1d9890,_0x1fcc48){return db[_0x056f('0x31')][_0x056f('0x47')]({'where':{'id':_0x1d9890[_0x056f('0x3c')]['id']}})[_0x056f('0x25')](handleEntityNotFound(_0x1fcc48,null))['then'](function(_0x3ce3cf){if(_0x3ce3cf){return _0x3ce3cf[_0x056f('0xac')](_0x1d9890[_0x056f('0x2a')][_0x056f('0x9a')],_[_0x056f('0x9b')](_0x1d9890[_0x056f('0x2a')],[_0x056f('0x9a'),'id'])||{})[_0x056f('0xad')](function(){return db[_0x056f('0xae')]['findAll']({'attributes':['id','name',_0x056f('0xaf')],'where':{'id':_0x1d9890[_0x056f('0x2a')][_0x056f('0x9a')]}});})[_0x056f('0x25')](function(_0x32dd06){socket[_0x056f('0xb0')](_0x056f('0xb1'),{'id':Number(_0x1d9890['params']['id']),'tags':_0x32dd06||[]});return{'id':Number(_0x1d9890['params']['id']),'tags':_0x32dd06||[]};});}})[_0x056f('0x25')](respondWithResult(_0x1fcc48,null))[_0x056f('0x3a')](handleError(_0x1fcc48,null));};exports[_0x056f('0xb2')]=function(_0x37a9df,_0x585bfa){return db['ChatInteraction']['find']({'where':{'id':_0x37a9df['params']['id']}})['then'](handleEntityNotFound(_0x585bfa,null))[_0x056f('0x25')](function(_0x2f2641){if(_0x2f2641){return _0x2f2641[_0x056f('0xb2')](_0x37a9df[_0x056f('0x39')][_0x056f('0x9a')]);}})[_0x056f('0x25')](respondWithStatusCode(_0x585bfa,null))['catch'](handleError(_0x585bfa,null));};exports[_0x056f('0x79')]=function(_0x13b7f0,_0x2f8459){var _0x299918=moment()[_0x056f('0xb3')]()['toString']();var _0x21183b=path[_0x056f('0x75')](config[_0x056f('0x76')],_0x056f('0xb4'),'files','tmp');var _0x172a7d=path[_0x056f('0x75')](config[_0x056f('0x76')],'server','files',_0x056f('0xb5'));var _0x359f18=path[_0x056f('0x75')](_0x21183b,_0x299918);var _0x17502f=util[_0x056f('0x82')](_0x056f('0xb6'),_0x13b7f0[_0x056f('0x3c')]['id'],_0x299918);var _0x5acbe1=path[_0x056f('0x75')](_0x21183b,_0x17502f);var _0x54ac8d=[];_0x54ac8d[_0x056f('0xaa')]({'model':db['User'],'as':_0x056f('0x8a'),'attributes':['id',_0x056f('0x52')],'raw':!![]});_0x54ac8d[_0x056f('0xaa')]({'model':db['CmContact'],'as':_0x056f('0x61'),'attributes':['id',_0x056f('0xb7'),_0x056f('0xb8')],'raw':!![]});if(_0x13b7f0['query'][_0x056f('0xb5')]){_0x54ac8d[_0x056f('0xaa')]({'model':db[_0x056f('0x73')],'as':'Attachment','raw':!![]});}var _0x23b716=[{'model':db[_0x056f('0x5c')],'as':_0x056f('0x7f'),'attributes':['id','body',_0x056f('0x8c'),_0x056f('0xb9'),_0x056f('0xa7'),_0x056f('0xba')],'include':_0x54ac8d}];_0x23b716[_0x056f('0xaa')]({'model':db['ChatWebsite'],'as':'Account','attributes':['id',_0x056f('0x28')]});_0x23b716[_0x056f('0xaa')]({'model':db[_0x056f('0x8a')],'as':_0x056f('0xbb'),'attributes':['id',_0x056f('0x52')]});return db[_0x056f('0x31')][_0x056f('0x47')]({'where':{'id':_0x13b7f0[_0x056f('0x3c')]['id']},'include':_0x23b716})[_0x056f('0x25')](handleEntityNotFound(_0x2f8459,null))[_0x056f('0x25')](function(_0x44a04e){if(_0x44a04e){var _0x164cf1=_0x44a04e['get']({'plain':!![]});fs[_0x056f('0xbc')](_0x359f18);var _0x46e458={'channel':_0x056f('0xbd'),'account':_0x164cf1[_0x056f('0xbe')][_0x056f('0x28')],'agent':_0x164cf1[_0x056f('0xbb')]?_0x164cf1[_0x056f('0xbb')][_0x056f('0x52')]:_0x056f('0xbf'),'createdAt':moment(_0x164cf1[_0x056f('0x8c')])[_0x056f('0x82')]('YYYY-MM-DD\x20HH:mm:ss')[_0x056f('0xc0')](),'closedAt':_0x164cf1[_0x056f('0x68')]?moment(_0x164cf1[_0x056f('0xc1')])[_0x056f('0x82')](_0x056f('0xa3'))[_0x056f('0xc0')]():'','disposition':_0x164cf1[_0x056f('0x69')],'chatInfo':{'browser':_0x164cf1[_0x056f('0xc2')],'os':_0x164cf1[_0x056f('0xc3')],'referer':_0x164cf1[_0x056f('0xc4')],'customerIp':_0x164cf1[_0x056f('0xc5')],'customerPort':_0x164cf1['customerPort']?_0x164cf1[_0x056f('0xc6')]:_0x056f('0xbf')},'messages':_(_0x164cf1[_0x056f('0x7f')])['tail']()[_0x056f('0xa1')]({'secret':![]})[_0x056f('0x30')](function(_0x18c7a9){if(_0x18c7a9[_0x056f('0x73')]){var _0x334ced=path[_0x056f('0x75')](_0x172a7d,_0x18c7a9['Attachment'][_0x056f('0x6e')]);if(fs[_0x056f('0xc7')](_0x334ced)){fs[_0x056f('0xc8')](_0x334ced)[_0x056f('0xc9')](fs[_0x056f('0xca')](path[_0x056f('0x75')](_0x359f18,_0x18c7a9[_0x056f('0x73')][_0x056f('0x6e')])));}}return{'date':moment(_0x18c7a9[_0x056f('0x8c')])[_0x056f('0x82')](_0x056f('0xa3'))[_0x056f('0xc0')](),'sender':_0x18c7a9[_0x056f('0xb9')]==='out'?_0x18c7a9['User']?_0x18c7a9[_0x056f('0x8a')][_0x056f('0x52')]:_0x056f('0x85'):_0x18c7a9[_0x056f('0x61')][_0x056f('0xb7')]+(_0x18c7a9[_0x056f('0x61')][_0x056f('0xb8')]?'\x20'+_0x18c7a9[_0x056f('0x61')][_0x056f('0xb8')]:''),'body':_0x18c7a9[_0x056f('0x73')]?_0x18c7a9[_0x056f('0x73')][_0x056f('0x6e')]:_0x18c7a9[_0x056f('0x2a')],'direction':_0x18c7a9[_0x056f('0xb9')]===_0x056f('0x5b')?'A':'C','secret':_0x18c7a9['secret'],'read':_0x18c7a9[_0x056f('0xba')],'attachment':_0x18c7a9[_0x056f('0x73')]};})[_0x056f('0xcb')]()};return ejs[_0x056f('0xcc')](path[_0x056f('0x75')](config[_0x056f('0x76')],_0x056f('0xb4'),'views',_0x056f('0xcd')),{'interaction':_0x46e458})[_0x056f('0x25')](function(_0x29b62f){var _0x2c684b=path[_0x056f('0x75')](_0x359f18,_0x056f('0xce')+_0x164cf1['id']+'-'+_0x299918+'.pdf');var _0x2700c5={'path':_0x2c684b,'channel':'Chat','interactionId':_0x164cf1['id']};return pdf['createPdfFromHTML'](_0x29b62f,_0x2700c5);})[_0x056f('0x25')](function(){return new Promise(function(_0x31096b,_0x2dfe5a){zipdir(_0x359f18,{'saveTo':_0x5acbe1},function(_0x4c316c,_0x1027a4){if(_0x4c316c)return _0x2dfe5a(_0x4c316c);return _0x31096b(_0x1027a4);});})[_0x056f('0x25')](function(){return new BPromise(function(_0x390230,_0x575680){rimraf(_0x359f18,function(_0x32f7ef){if(_0x32f7ef)_0x575680(_0x32f7ef);return _0x390230();});});})[_0x056f('0x25')](function(){return _0x2f8459['download'](_0x5acbe1,_0x17502f,function(_0x495482){if(_0x495482){logger[_0x056f('0x1b')](_0x056f('0xcf'),_0x495482);}else{fs['unlinkSync'](_0x5acbe1);}});});});}else{return _0x2f8459['sendStatus'](0xc8);}})[_0x056f('0x3a')](handleError(_0x2f8459,null));}; \ No newline at end of file +var _0xa511=['appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ChatMessage','ids','hasOwnProperty','nolimit','order','sort','pick','where','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','ChatInteractionId','includeAgent','push','rows','omit','spread','Tag','emit','chatInteractionTags:save','removeTags','download','unix','toString','files','tmp','server','transcript-%d-%s.zip','firstName','lastName','attachments','read','Account','get','mkdirSync','Chat','Owner','osName','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.ejs','.pdf','err','unlinkSync','zip-dir','moment','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','update','stack','name','merge','body','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','user','show','params','keys','filters','intersection','model','attributes','fields','includeAll','include','options','create','find','destroy','describe','createVidaooSession','ChatWebsite','findOne','ChatWebsiteId','vidaooEscalation','email','POST','vidaooApiKey','vidaooTopic','isNull','vidaooNote','follow','vidaooMetadata','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','sendStatus','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','User','Messages','length','%s%d','System','customer','Visitor','ContactId','agentIdentifier','website_alias','agentAlias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret'];(function(_0xc25e9b,_0x36a365){var _0x57478d=function(_0x58e857){while(--_0x58e857){_0xc25e9b['push'](_0xc25e9b['shift']());}};_0x57478d(++_0x36a365);}(_0xa511,0x118));var _0x1a51=function(_0x1087b8,_0x1ff7e9){_0x1087b8=_0x1087b8-0x0;var _0x36f8d3=_0xa511[_0x1087b8];return _0x36f8d3;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x1a51('0x0'));var rp=require('request-promise');var moment=require(_0x1a51('0x1'));var BPromise=require(_0x1a51('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1a51('0x3'));var ejs=require(_0x1a51('0x4'));var fs=require('fs');var _=require(_0x1a51('0x5'));var Redis=require(_0x1a51('0x6'));var interaction=require(_0x1a51('0x7'));var qs=require(_0x1a51('0x8'));var pdf=require(_0x1a51('0x9'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x1a51('0xa'))['db'];config[_0x1a51('0xb')]=_[_0x1a51('0xc')](config[_0x1a51('0xb')],{'host':_0x1a51('0xd'),'port':0x18eb});var socket=require(_0x1a51('0xe'))(new Redis(config[_0x1a51('0xb')]));require(_0x1a51('0xf'))[_0x1a51('0x10')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x4f1e2f,_0x41e478,_0x4cad05,_0x9701d2){return new BPromise(function(_0x2c4941,_0x2ef0ec){var _0x21d3f0=_0x9701d2||client;return _0x21d3f0[_0x1a51('0x11')](_0x4f1e2f,_0x4cad05)[_0x1a51('0x12')](function(_0x5d5641){logger[_0x1a51('0x13')](_0x1a51('0x14'),_0x41e478,'request\x20sent');logger[_0x1a51('0x15')](_0x1a51('0x16'),_0x41e478,'request\x20sent',JSON[_0x1a51('0x17')](_0x5d5641));if(_0x5d5641[_0x1a51('0x18')]){if(_0x5d5641[_0x1a51('0x18')][_0x1a51('0x19')]===0x1f4){logger[_0x1a51('0x18')](_0x1a51('0x14'),_0x41e478,_0x5d5641[_0x1a51('0x18')][_0x1a51('0x1a')]);return _0x2ef0ec(_0x5d5641['error'][_0x1a51('0x1a')]);}logger[_0x1a51('0x18')](_0x1a51('0x14'),_0x41e478,_0x5d5641[_0x1a51('0x18')][_0x1a51('0x1a')]);return _0x2c4941(_0x5d5641['error'][_0x1a51('0x1a')]);}else{logger[_0x1a51('0x13')](_0x1a51('0x14'),_0x41e478,_0x1a51('0x1b'));_0x2c4941(_0x5d5641[_0x1a51('0x1c')]['message']);}})[_0x1a51('0x1d')](function(_0x495fe2){logger[_0x1a51('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x41e478,_0x495fe2);_0x2ef0ec(_0x495fe2);});});}function respondWithStatusCode(_0x368d3f,_0xc201c9){_0xc201c9=_0xc201c9||0xcc;return function(_0x323c39){if(_0x323c39){return _0x368d3f['sendStatus'](_0xc201c9);}return _0x368d3f[_0x1a51('0x1e')](_0xc201c9)[_0x1a51('0x1f')]();};}function respondWithResult(_0xec7c92,_0x18a9ee){_0x18a9ee=_0x18a9ee||0xc8;return function(_0x48c020){if(_0x48c020){return _0xec7c92[_0x1a51('0x1e')](_0x18a9ee)[_0x1a51('0x20')](_0x48c020);}};}function respondWithFilteredResult(_0x99a5bb,_0x8368b1){return function(_0x2d43fb){if(_0x2d43fb){var _0x2bb2e8=typeof _0x8368b1[_0x1a51('0x21')]===_0x1a51('0x22')&&typeof _0x8368b1[_0x1a51('0x23')]===_0x1a51('0x22');var _0xfdb00b=_0x2d43fb[_0x1a51('0x24')];var _0x109102=_0x2bb2e8?0x0:_0x8368b1['offset'];var _0xaba287=_0x2bb2e8?_0x2d43fb[_0x1a51('0x24')]:_0x8368b1['offset']+_0x8368b1[_0x1a51('0x23')];var _0x3313cf;if(_0xaba287>=_0xfdb00b){_0xaba287=_0xfdb00b;_0x3313cf=0xc8;}else{_0x3313cf=0xce;}_0x99a5bb['status'](_0x3313cf);return _0x99a5bb[_0x1a51('0x25')](_0x1a51('0x26'),_0x109102+'-'+_0xaba287+'/'+_0xfdb00b)['json'](_0x2d43fb);}return null;};}function saveUpdates(_0x36b948){return function(_0x22e600){if(_0x22e600){return _0x22e600[_0x1a51('0x27')](_0x36b948)[_0x1a51('0x12')](function(_0x3dc16c){return _0x3dc16c;});}return null;};}function removeEntity(_0xbce725){return function(_0x2f5961){if(_0x2f5961){return _0x2f5961['destroy']()[_0x1a51('0x12')](function(){_0xbce725[_0x1a51('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bce9a){return function(_0xa162ff){if(!_0xa162ff){_0x3bce9a['sendStatus'](0x194);}return _0xa162ff;};}function handleError(_0x407a86,_0xde645d){_0xde645d=_0xde645d||0x1f4;return function(_0x1624fd){logger[_0x1a51('0x18')](_0x1624fd[_0x1a51('0x28')]);if(_0x1624fd[_0x1a51('0x29')]){delete _0x1624fd[_0x1a51('0x29')];}_0x407a86[_0x1a51('0x1e')](_0xde645d)['send'](_0x1624fd);};}function getMustacheRender(_0x295364,_0x2bd6df){return Mustache['render'](_0x295364,_[_0x1a51('0x2a')](_0x2bd6df[_0x1a51('0x2b')],{'contact':_0x2bd6df[_0x1a51('0x2c')],'message':_0x2bd6df[_0x1a51('0x1a')],'agent':_0x2bd6df[_0x1a51('0x2d')],'interaction':_0x2bd6df[_0x1a51('0x2e')],'account':_0x2bd6df[_0x1a51('0x2f')]}))||'';}exports[_0x1a51('0x30')]=function(_0x317aa5,_0x199f65){var _0x4ef964={};var _0x144aca=_[_0x1a51('0x31')](db[_0x1a51('0x32')][_0x1a51('0x33')],function(_0x469fbd){return{'name':_0x469fbd[_0x1a51('0x34')],'type':_0x469fbd[_0x1a51('0x35')][_0x1a51('0x36')]};});_0x4ef964=qs[_0x1a51('0x37')](_0x144aca,_0x317aa5);return interaction[_0x1a51('0x38')](_0x1a51('0x39'),_0x317aa5[_0x1a51('0x3a')],_0x317aa5[_0x1a51('0x3b')],_0x4ef964,_0x144aca)[_0x1a51('0x12')](respondWithFilteredResult(_0x199f65,_0x4ef964))[_0x1a51('0x1d')](handleError(_0x199f65,null));};exports[_0x1a51('0x3c')]=function(_0x41e7e9,_0x56033a){var _0x4467a5={'raw':![],'where':{'id':_0x41e7e9[_0x1a51('0x3d')]['id']}},_0x172ded={};_0x172ded['model']=_[_0x1a51('0x3e')](db['ChatInteraction']['rawAttributes']);_0x172ded['query']=_[_0x1a51('0x3e')](_0x41e7e9[_0x1a51('0x3a')]);_0x172ded[_0x1a51('0x3f')]=_[_0x1a51('0x40')](_0x172ded[_0x1a51('0x41')],_0x172ded['query']);_0x4467a5[_0x1a51('0x42')]=_[_0x1a51('0x40')](_0x172ded[_0x1a51('0x41')],qs[_0x1a51('0x43')](_0x41e7e9[_0x1a51('0x3a')]['fields']));_0x4467a5[_0x1a51('0x42')]=_0x4467a5[_0x1a51('0x42')]['length']?_0x4467a5[_0x1a51('0x42')]:_0x172ded['model'];if(_0x41e7e9[_0x1a51('0x3a')][_0x1a51('0x44')]){_0x4467a5[_0x1a51('0x45')]=[{'all':!![]}];}_0x4467a5=_[_0x1a51('0x2a')]({},_0x4467a5,_0x41e7e9[_0x1a51('0x46')]);return db[_0x1a51('0x32')]['find'](_0x4467a5)[_0x1a51('0x12')](handleEntityNotFound(_0x56033a,null))[_0x1a51('0x12')](respondWithResult(_0x56033a,null))[_0x1a51('0x1d')](handleError(_0x56033a,null));};exports[_0x1a51('0x47')]=function(_0x3c7cba,_0x57281d){return db[_0x1a51('0x32')][_0x1a51('0x47')](_0x3c7cba[_0x1a51('0x2b')],{})[_0x1a51('0x12')](respondWithResult(_0x57281d,0xc9))[_0x1a51('0x1d')](handleError(_0x57281d,null));};exports[_0x1a51('0x27')]=function(_0x43f04a,_0x5291bb){if(_0x43f04a[_0x1a51('0x2b')]['id']){delete _0x43f04a[_0x1a51('0x2b')]['id'];}return db[_0x1a51('0x32')][_0x1a51('0x48')]({'where':{'id':_0x43f04a[_0x1a51('0x3d')]['id']}})[_0x1a51('0x12')](handleEntityNotFound(_0x5291bb,null))['then'](saveUpdates(_0x43f04a[_0x1a51('0x2b')],null))['then'](respondWithResult(_0x5291bb,null))[_0x1a51('0x1d')](handleError(_0x5291bb,null));};exports[_0x1a51('0x49')]=function(_0x4ba659,_0x471513){return db[_0x1a51('0x32')][_0x1a51('0x48')]({'where':{'id':_0x4ba659['params']['id']}})[_0x1a51('0x12')](handleEntityNotFound(_0x471513,null))[_0x1a51('0x12')](removeEntity(_0x471513,null))[_0x1a51('0x1d')](handleError(_0x471513,null));};exports[_0x1a51('0x4a')]=function(_0x1f4657,_0x5bd6a6){return db[_0x1a51('0x32')][_0x1a51('0x4a')]()[_0x1a51('0x12')](respondWithResult(_0x5bd6a6,null))[_0x1a51('0x1d')](handleError(_0x5bd6a6,null));};exports[_0x1a51('0x4b')]=function(_0x2b393a,_0x53a132){var _0x44bff3=_0x2b393a[_0x1a51('0x3d')]['id'];var _0x1e14b2;var _0x52abd0;var _0x2a73cb;return db[_0x1a51('0x32')]['findOne']({'where':{'id':_0x44bff3}})['then'](function(_0x33d0af){_0x1e14b2=_0x33d0af;return db[_0x1a51('0x4c')][_0x1a51('0x4d')]({'where':{'id':_0x33d0af[_0x1a51('0x4e')]},'attributes':['id','vidaooApiKey',_0x1a51('0x4f'),'vidaooTopic','vidaooNote','vidaooMetadata'],'raw':!![]});})[_0x1a51('0x12')](function(_0x558558){if(_0x558558&&_0x558558['vidaooApiKey']&&_0x558558[_0x1a51('0x4f')]){_0x52abd0=_0x558558;var _0x405e91={'interaction':{'id':_0x44bff3},'agent':{'id':_0x2b393a[_0x1a51('0x3b')]['id'],'name':_0x2b393a['user'][_0x1a51('0x29')],'fullname':_0x2b393a[_0x1a51('0x3b')]['fullname'],'email':_0x2b393a[_0x1a51('0x3b')][_0x1a51('0x50')]},'contact':_0x2b393a[_0x1a51('0x2b')][_0x1a51('0x2c')],'account':_0x2b393a[_0x1a51('0x2b')][_0x1a51('0x2f')]};var _0x17c100={'rejectUnauthorized':![],'method':_0x1a51('0x51'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x558558[_0x1a51('0x52')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2b393a[_0x1a51('0x3b')][_0x1a51('0x50')]],'buttons':null,'topic':_0x52abd0[_0x1a51('0x53')],'note':_[_0x1a51('0x54')](_0x52abd0[_0x1a51('0x55')])?null:getMustacheRender(_0x52abd0['vidaooNote'],_0x405e91),'metadata':null},'redirect':_0x1a51('0x56'),'json':!![]};try{if(!_[_0x1a51('0x54')](_0x52abd0[_0x1a51('0x57')])){var _0xa92f5c=getMustacheRender(_0x52abd0['vidaooMetadata'],_0x405e91);var _0x477dac=JSON[_0x1a51('0x58')](_0xa92f5c);_0x17c100[_0x1a51('0x2b')][_0x1a51('0x59')]=_0x477dac;}}catch(_0x1bd04f){throw new db[(_0x1a51('0x5a'))][(_0x1a51('0x5b'))](_0x1a51('0x5c'));}return rp(_0x17c100);}else{throw new db['Sequelize'][(_0x1a51('0x5b'))](_0x1a51('0x5d'));}})[_0x1a51('0x12')](function(_0x1f57ee){_0x2a73cb=_0x1f57ee;if(_0x2a73cb['id']){var _0x1cf212={'body':_0x2a73cb['join_url'],'ChatWebsiteId':_0x52abd0['id'],'ChatInteractionId':_0x1e14b2['id'],'direction':'out','UserId':_0x2b393a['user']['id']};return db['ChatMessage'][_0x1a51('0x47')](_0x1cf212,{});}else{throw new db['Sequelize']['ValidationError'](_0x1a51('0x5e'));}})[_0x1a51('0x12')](function(){return _0x1e14b2[_0x1a51('0x5f')]({'vidaooSessionId':_0x2a73cb['id']});})[_0x1a51('0x12')](respondWithResult(_0x53a132,null))[_0x1a51('0x1d')](handleError(_0x53a132,null));};exports[_0x1a51('0x60')]=function(_0x277c2b,_0x10f930){if(_0x277c2b[_0x1a51('0x2b')]['id']){delete _0x277c2b[_0x1a51('0x2b')]['id'];}return db[_0x1a51('0x32')][_0x1a51('0x48')]({'where':{'id':_0x277c2b[_0x1a51('0x3d')]['id']},'include':[{'model':db[_0x1a51('0x61')],'as':_0x1a51('0x62')}]})[_0x1a51('0x12')](handleEntityNotFound(_0x10f930,null))[_0x1a51('0x12')](saveUpdates(_0x277c2b[_0x1a51('0x2b')],null))[_0x1a51('0x12')](respondWithResult(_0x10f930,null))[_0x1a51('0x1d')](handleError(_0x10f930,null));};exports['abandon']=function(_0x356b04,_0x5e805a){if(_0x356b04['body']['id']){delete _0x356b04[_0x1a51('0x2b')]['id'];}return db['ChatInteraction'][_0x1a51('0x48')]({'where':{'id':_0x356b04[_0x1a51('0x3d')]['id']}})[_0x1a51('0x12')](function(_0x31432b){if(!_0x31432b){logger['error'](_0x1a51('0x63'),_0x1a51('0x64'),0x194,_0x1a51('0x65'));_0x5e805a[_0x1a51('0x66')](0x194);}else{if(_0x31432b[_0x1a51('0x67')]){throw new db[(_0x1a51('0x5a'))]['ValidationError'](_0x1a51('0x68'));}}return _0x31432b;})[_0x1a51('0x12')](function(_0x13ea7d){if(_0x13ea7d){return _0x13ea7d[_0x1a51('0x27')]({'closed':_0x356b04['body'][_0x1a51('0x69')],'disposition':_0x356b04[_0x1a51('0x2b')][_0x1a51('0x6a')]})[_0x1a51('0x12')](function(_0x570739){return _0x570739;});}})[_0x1a51('0x12')](function(){return respondWithRpcPromise(_0x1a51('0x6b'),_0x1a51('0x64'),_0x356b04[_0x1a51('0x2b')],client9004);})[_0x1a51('0x12')](respondWithResult(_0x5e805a,null))[_0x1a51('0x1d')](handleError(_0x5e805a,null));};exports[_0x1a51('0x6c')]=function(_0x42aa6f,_0x2ae4c8){_0x42aa6f['body'][_0x1a51('0x29')]=_0x42aa6f[_0x1a51('0x6d')][_0x1a51('0x6e')];_0x42aa6f[_0x1a51('0x2b')][_0x1a51('0x6f')]=_0x42aa6f['file'][_0x1a51('0x70')];_0x42aa6f['body'][_0x1a51('0x35')]=_0x42aa6f[_0x1a51('0x6d')][_0x1a51('0x71')];return db[_0x1a51('0x72')][_0x1a51('0x47')](_0x42aa6f[_0x1a51('0x2b')])[_0x1a51('0x12')](respondWithResult(_0x2ae4c8,0xc9))[_0x1a51('0x1d')](handleError(_0x2ae4c8,null));};exports[_0x1a51('0x73')]=function(_0x46591a,_0x2258d8){return db[_0x1a51('0x32')][_0x1a51('0x4d')]({'where':{'id':_0x46591a[_0x1a51('0x3d')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2258d8,null))[_0x1a51('0x12')](function(_0x371007){if(_0x371007){if(_0x371007[_0x1a51('0x69')]){return _0x2258d8[_0x1a51('0x1e')](0x193)[_0x1a51('0x20')]({'status':0x193,'message':_0x1a51('0x74')});}return db[_0x1a51('0x72')][_0x1a51('0x4d')]({'where':{'id':_0x46591a[_0x1a51('0x3a')][_0x1a51('0x75')]},'raw':!![]})[_0x1a51('0x12')](handleEntityNotFound(_0x2258d8,null));}})[_0x1a51('0x12')](function(_0x496d2b){if(_0x496d2b){var _0x20aff8=_0x496d2b[_0x1a51('0x76')]!==null;var _0x59be21=path[_0x1a51('0x77')](config[_0x1a51('0x78')],_0x1a51('0x79'));if(_0x20aff8){_0x59be21=path[_0x1a51('0x77')](_0x59be21,'offline-chat/');}var _0x3bd852=path[_0x1a51('0x77')](_0x59be21,_0x496d2b[_0x1a51('0x6f')]);return _0x2258d8['download'](_0x3bd852);}})[_0x1a51('0x1d')](handleError(_0x2258d8,null));};exports[_0x1a51('0x7a')]=function(_0x237a8c,_0x486a55){var _0x5e50da=null;var _0x591378=null;var _0xed4cb1=null;if(_0x237a8c[_0x1a51('0x2b')]['id']){delete _0x237a8c['body']['id'];}if(_0x237a8c[_0x1a51('0x2b')][_0x1a51('0x7b')]){_0xed4cb1=path[_0x1a51('0x77')](config[_0x1a51('0x78')],_0x1a51('0x7c'),util[_0x1a51('0x7d')](_0x1a51('0x7e'),Date[_0x1a51('0x7f')]()));_0x237a8c[_0x1a51('0x2b')][_0x1a51('0x80')]=_0xed4cb1;}return db[_0x1a51('0x32')][_0x1a51('0x48')]({'where':{'id':_0x237a8c[_0x1a51('0x3d')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db['User'],'as':_0x1a51('0x81')}]}]})[_0x1a51('0x12')](handleEntityNotFound(_0x486a55,null))['then'](saveUpdates(_0x237a8c['body'],null))[_0x1a51('0x12')](function(_0x1918bf){if(_0x1918bf){_0x5e50da=_0x1918bf;return db['ChatWebsite'][_0x1a51('0x48')]({'where':{'id':_0x5e50da[_0x1a51('0x4e')]}});}})[_0x1a51('0x12')](function(_0x38db36){if(_0x38db36){_0x591378=_0x38db36;return db[_0x1a51('0x61')][_0x1a51('0x48')]({'where':{'id':_0x5e50da['ContactId']}});}})[_0x1a51('0x12')](function(_0x45416c){if(_0x45416c){if(_0xed4cb1){var _0x41c580=null;for(var _0x3d2320=0x1;_0x3d2320<_0x5e50da[_0x1a51('0x82')][_0x1a51('0x83')];++_0x3d2320){_0x41c580=_0x5e50da[_0x1a51('0x82')][_0x3d2320];var _0x269c82=_0x41c580[_0x1a51('0x67')]?util[_0x1a51('0x7d')](_0x1a51('0x84'),_0x591378['agentAlias'],_0x41c580['UserId']):_0x1a51('0x85');var _0x397137=_0x237a8c[_0x1a51('0x2b')][_0x1a51('0x86')]||util['format'](_0x1a51('0x84'),_0x1a51('0x87'),_0x41c580[_0x1a51('0x88')]);switch(_0x591378[_0x1a51('0x89')]){case _0x1a51('0x8a'):_0x269c82=_0x41c580[_0x1a51('0x67')]?util[_0x1a51('0x7d')](_0x1a51('0x84'),_0x591378[_0x1a51('0x8b')],_0x41c580['UserId']):'System';break;case'agent_alias':_0x269c82=_0x41c580[_0x1a51('0x67')]?_0x41c580['User'][_0x1a51('0x8c')]||_0x41c580['User'][_0x1a51('0x8d')]:_0x1a51('0x85');break;case _0x1a51('0x8e'):_0x269c82=_0x41c580[_0x1a51('0x67')]?_0x41c580['User'][_0x1a51('0x8d')]:'System';break;default:_0x269c82=_0x41c580[_0x1a51('0x67')]?util[_0x1a51('0x7d')](_0x1a51('0x84'),_0x591378[_0x1a51('0x8b')],_0x41c580[_0x1a51('0x67')]):_0x1a51('0x85');}var _0x2ad976=util[_0x1a51('0x7d')](_0x1a51('0x8f'),moment(_0x41c580[_0x1a51('0x90')])[_0x1a51('0x7d')](_0x1a51('0x91')),_0x41c580[_0x1a51('0x92')]==='in'?_0x397137:_0x269c82,_0x41c580[_0x1a51('0x2b')]);if(!_0x41c580[_0x1a51('0x93')]){fs[_0x1a51('0x94')](_0xed4cb1,_0x2ad976);}}return db[_0x1a51('0x95')][_0x1a51('0x4d')]({'where':{'service':!![]},'include':[{'model':db[_0x1a51('0x96')],'as':_0x1a51('0x97'),'raw':!![],'include':[{'model':db[_0x1a51('0x98')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x1a51('0x12')](function(_0x394980){if(!_0x394980||!_0x394980[_0x1a51('0x97')]||!_0x237a8c['body'])return _0x5e50da;var _0x4d51e4=_0x394980[_0x1a51('0x99')]();return respondWithRpcPromise(_0x1a51('0x9a'),'sendMail',{'account':_0x4d51e4,'message':{'from':util[_0x1a51('0x7d')](_0x1a51('0x9b'),_0x394980[_0x1a51('0x29')],_0x394980[_0x1a51('0x50')]||_0x394980[_0x1a51('0x97')]['user']),'to':_0x237a8c[_0x1a51('0x2b')]['mailTranscript'],'subject':_0x1a51('0x9c'),'text':util[_0x1a51('0x7d')](_0x1a51('0x9d'),_0x237a8c[_0x1a51('0x2b')][_0x1a51('0x7b')]),'attachments':[{'path':_0xed4cb1}]}})[_0x1a51('0x12')](function(){return _0x5e50da;})[_0x1a51('0x1d')](function(_0x340fca){logger[_0x1a51('0x18')](_0x340fca);});})[_0x1a51('0x12')](respondWithStatusCode(_0x486a55,0xc8))[_0x1a51('0x1d')](handleError(_0x486a55,null));};exports[_0x1a51('0x9e')]=function(_0x3e4f16,_0x2b0b76){return db[_0x1a51('0x9f')][_0x1a51('0x48')]({'where':{'id':_0x3e4f16['params']['id']}})[_0x1a51('0x12')](handleEntityNotFound(_0x2b0b76,null))[_0x1a51('0x12')](function(_0x145165){if(_0x145165){return _0x145165[_0x1a51('0x9e')](_0x3e4f16[_0x1a51('0x2b')][_0x1a51('0xa0')],_['omit'](_0x3e4f16[_0x1a51('0x2b')],['ids','id'])||{});}})[_0x1a51('0x12')](respondWithResult(_0x2b0b76,null))[_0x1a51('0x1d')](handleError(_0x2b0b76,null));};exports['getMessages']=function(_0x2c69cd,_0x504862){var _0x3c28a8={'raw':![],'where':{}};var _0x4fd43a={};var _0x404784={'count':0x0,'rows':[]};return db[_0x1a51('0x32')][_0x1a51('0x4d')]({'where':{'id':_0x2c69cd[_0x1a51('0x3d')]['id']}})[_0x1a51('0x12')](handleEntityNotFound(_0x504862,null))[_0x1a51('0x12')](function(_0x3131ff){if(_0x3131ff){_0x4fd43a[_0x1a51('0x41')]=_[_0x1a51('0x3e')](db[_0x1a51('0x9f')][_0x1a51('0x33')]);_0x4fd43a['query']=_[_0x1a51('0x3e')](_0x2c69cd[_0x1a51('0x3a')]);_0x4fd43a[_0x1a51('0x3f')]=_[_0x1a51('0x40')](_0x4fd43a[_0x1a51('0x41')],_0x4fd43a['query']);_0x3c28a8['attributes']=_[_0x1a51('0x40')](_0x4fd43a['model'],qs['fields'](_0x2c69cd[_0x1a51('0x3a')][_0x1a51('0x43')]));_0x3c28a8['attributes']=_0x3c28a8[_0x1a51('0x42')][_0x1a51('0x83')]?_0x3c28a8['attributes']:_0x4fd43a[_0x1a51('0x41')];if(!_0x2c69cd[_0x1a51('0x3a')][_0x1a51('0xa1')](_0x1a51('0xa2'))){_0x3c28a8[_0x1a51('0x23')]=qs['limit'](_0x2c69cd[_0x1a51('0x3a')][_0x1a51('0x23')]);_0x3c28a8[_0x1a51('0x21')]=qs[_0x1a51('0x21')](_0x2c69cd['query'][_0x1a51('0x21')]);}_0x3c28a8[_0x1a51('0xa3')]=qs['sort'](_0x2c69cd[_0x1a51('0x3a')][_0x1a51('0xa4')]);_0x3c28a8['where']=qs[_0x1a51('0x3f')](_[_0x1a51('0xa5')](_0x2c69cd['query'],_0x4fd43a[_0x1a51('0x3f')]));_0x3c28a8[_0x1a51('0xa6')]['ChatInteractionId']=_0x3131ff['id'];if(_0x2c69cd[_0x1a51('0x3a')]['filter']){_0x3c28a8[_0x1a51('0xa6')]=_['merge'](_0x3c28a8['where'],{'$or':_['map'](_0x3c28a8[_0x1a51('0x42')],function(_0x32e612){var _0x3f1a4c={};_0x3f1a4c[_0x32e612]={'$like':'%'+_0x2c69cd[_0x1a51('0x3a')][_0x1a51('0xa7')]+'%'};return _0x3f1a4c;})});}if(_0x2c69cd[_0x1a51('0x3a')][_0x1a51('0xa8')]){var _0x14b761=_0x2c69cd[_0x1a51('0x3a')][_0x1a51('0xa8')][_0x1a51('0xa9')](',');var _0x3bb013={};_0x3bb013[_0x14b761[0x0]]={'$gte':moment(_0x14b761[0x1])['format'](_0x1a51('0xaa'))};_0x3c28a8[_0x1a51('0xa6')]=_['merge'](_0x3c28a8[_0x1a51('0xa6')],_0x3bb013);}_0x3c28a8=_[_0x1a51('0x2a')]({},_0x3c28a8,_0x2c69cd[_0x1a51('0x46')]);return db[_0x1a51('0x9f')]['count']({'where':_0x3c28a8[_0x1a51('0xa6')]})[_0x1a51('0x12')](function(_0x250732){_0x404784[_0x1a51('0x24')]=_0x250732;if(_0x2c69cd[_0x1a51('0x3a')]['includeAll']){_0x3c28a8[_0x1a51('0x45')]=[{'all':!![]}];}return db[_0x1a51('0x9f')][_0x1a51('0x38')](_0x3c28a8);})[_0x1a51('0x12')](function(_0x3296f4){_0x404784['rows']=_0x3296f4;return _0x404784;});}})[_0x1a51('0x12')](respondWithFilteredResult(_0x504862,_0x3c28a8))[_0x1a51('0x1d')](handleError(_0x504862,null));};exports[_0x1a51('0xab')]=function(_0x28f604,_0x4ebfc5){var _0x5b9ddc={'where':{}},_0x16688b={},_0x2ed851={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x1a51('0x4d')]({'where':{'id':_0x28f604[_0x1a51('0x3d')]['id']}})[_0x1a51('0x12')](handleEntityNotFound(_0x4ebfc5,null))[_0x1a51('0x12')](function(_0x2af528){if(_0x2af528){_0x16688b[_0x1a51('0x41')]=_[_0x1a51('0x3e')](db[_0x1a51('0x9f')]['rawAttributes']);_0x16688b[_0x1a51('0x3a')]=_[_0x1a51('0x3e')](_0x28f604[_0x1a51('0x3a')]);_0x16688b[_0x1a51('0x3f')]=_[_0x1a51('0x40')](_0x16688b[_0x1a51('0x41')],_0x16688b[_0x1a51('0x3a')]);_0x5b9ddc[_0x1a51('0x42')]=_[_0x1a51('0x40')](_0x16688b[_0x1a51('0x41')],qs['fields'](_0x28f604[_0x1a51('0x3a')][_0x1a51('0x43')]));_0x5b9ddc[_0x1a51('0x42')]=_0x5b9ddc[_0x1a51('0x42')][_0x1a51('0x83')]?_0x5b9ddc[_0x1a51('0x42')]:_0x16688b['model'];if(!_0x28f604[_0x1a51('0x3a')]['hasOwnProperty'](_0x1a51('0xa2'))){_0x5b9ddc['limit']=qs[_0x1a51('0x23')](_0x28f604[_0x1a51('0x3a')][_0x1a51('0x23')]);_0x5b9ddc[_0x1a51('0x21')]=qs[_0x1a51('0x21')](_0x28f604[_0x1a51('0x3a')][_0x1a51('0x21')]);}_0x5b9ddc['order']=qs[_0x1a51('0xa4')](_0x28f604['query']['sort']);_0x5b9ddc[_0x1a51('0xa6')]=qs[_0x1a51('0x3f')](_[_0x1a51('0xa5')](_0x28f604[_0x1a51('0x3a')],_0x16688b[_0x1a51('0x3f')]));_0x5b9ddc[_0x1a51('0xa6')][_0x1a51('0xac')]=_0x2af528['id'];if(_0x28f604[_0x1a51('0x3a')][_0x1a51('0xa7')]){_0x5b9ddc[_0x1a51('0xa6')]=_['merge'](_0x5b9ddc[_0x1a51('0xa6')],{'$or':_[_0x1a51('0x31')](_0x5b9ddc[_0x1a51('0x42')],function(_0x42cdba){var _0x4e8315={};_0x4e8315[_0x42cdba]={'$like':'%'+_0x28f604[_0x1a51('0x3a')][_0x1a51('0xa7')]+'%'};return _0x4e8315;})});}_0x5b9ddc[_0x1a51('0xa6')][_0x1a51('0x93')]=![];if(_0x28f604[_0x1a51('0x3a')]['id']){_0x5b9ddc[_0x1a51('0xa6')]['id']={'$gt':_0x28f604[_0x1a51('0x3a')]['id']};}_0x5b9ddc=_[_0x1a51('0x2a')]({},_0x5b9ddc,_0x28f604['options']);return db[_0x1a51('0x9f')][_0x1a51('0x24')]({'where':_0x5b9ddc['where']})[_0x1a51('0x12')](function(_0x3579f7){_0x2ed851['count']=_0x3579f7;_0x5b9ddc['include']=[];if(_0x28f604['query'][_0x1a51('0xad')]){_0x5b9ddc[_0x1a51('0x45')][_0x1a51('0xae')]({'model':db[_0x1a51('0x81')],'as':_0x1a51('0x81'),'attributes':['id',_0x1a51('0x8d'),'alias']});}if(_0x28f604['query'][_0x1a51('0x44')]){_0x5b9ddc['include']=[{'all':!![]}];}return db[_0x1a51('0x9f')]['findAll'](_0x5b9ddc);})['then'](function(_0xb9bd68){_0x2ed851[_0x1a51('0xaf')]=_0xb9bd68;return _0x2ed851;});}})[_0x1a51('0x12')](respondWithFilteredResult(_0x4ebfc5,_0x5b9ddc))[_0x1a51('0x1d')](handleError(_0x4ebfc5,null));};exports['addTags']=function(_0x1adfce,_0x4bc3ea){return db['ChatInteraction'][_0x1a51('0x48')]({'where':{'id':_0x1adfce[_0x1a51('0x3d')]['id']}})[_0x1a51('0x12')](handleEntityNotFound(_0x4bc3ea,null))['then'](function(_0x4aafd2){if(_0x4aafd2){return _0x4aafd2['setTags'](_0x1adfce[_0x1a51('0x2b')][_0x1a51('0xa0')],_[_0x1a51('0xb0')](_0x1adfce[_0x1a51('0x2b')],[_0x1a51('0xa0'),'id'])||{})[_0x1a51('0xb1')](function(){return db[_0x1a51('0xb2')][_0x1a51('0x38')]({'attributes':['id','name','color'],'where':{'id':_0x1adfce[_0x1a51('0x2b')][_0x1a51('0xa0')]}});})[_0x1a51('0x12')](function(_0x4dd84b){socket[_0x1a51('0xb3')](_0x1a51('0xb4'),{'id':Number(_0x1adfce[_0x1a51('0x3d')]['id']),'tags':_0x4dd84b||[]});return{'id':Number(_0x1adfce[_0x1a51('0x3d')]['id']),'tags':_0x4dd84b||[]};});}})['then'](respondWithResult(_0x4bc3ea,null))[_0x1a51('0x1d')](handleError(_0x4bc3ea,null));};exports[_0x1a51('0xb5')]=function(_0x12463a,_0x2f2c04){return db[_0x1a51('0x32')][_0x1a51('0x48')]({'where':{'id':_0x12463a[_0x1a51('0x3d')]['id']}})[_0x1a51('0x12')](handleEntityNotFound(_0x2f2c04,null))[_0x1a51('0x12')](function(_0x178f1e){if(_0x178f1e){return _0x178f1e[_0x1a51('0xb5')](_0x12463a[_0x1a51('0x3a')][_0x1a51('0xa0')]);}})[_0x1a51('0x12')](respondWithStatusCode(_0x2f2c04,null))['catch'](handleError(_0x2f2c04,null));};exports[_0x1a51('0xb6')]=function(_0x1f8691,_0x3ab212){var _0xa21924=moment()[_0x1a51('0xb7')]()[_0x1a51('0xb8')]();var _0x3029f0=path['join'](config[_0x1a51('0x78')],'server',_0x1a51('0xb9'),_0x1a51('0xba'));var _0x54f02e=path[_0x1a51('0x77')](config[_0x1a51('0x78')],_0x1a51('0xbb'),_0x1a51('0xb9'),'attachments');var _0x86d338=path[_0x1a51('0x77')](_0x3029f0,_0xa21924);var _0x275a4a=util['format'](_0x1a51('0xbc'),_0x1f8691['params']['id'],_0xa21924);var _0x3e33bf=path[_0x1a51('0x77')](_0x3029f0,_0x275a4a);var _0x54055b=[];_0x54055b[_0x1a51('0xae')]({'model':db[_0x1a51('0x81')],'as':'User','attributes':['id',_0x1a51('0x8d')],'raw':!![]});_0x54055b['push']({'model':db[_0x1a51('0x61')],'as':_0x1a51('0x62'),'attributes':['id',_0x1a51('0xbd'),_0x1a51('0xbe')],'raw':!![]});if(_0x1f8691['query'][_0x1a51('0xbf')]){_0x54055b[_0x1a51('0xae')]({'model':db[_0x1a51('0x72')],'as':_0x1a51('0x72'),'raw':!![]});}var _0x3df752=[{'model':db[_0x1a51('0x9f')],'as':'Messages','attributes':['id','body',_0x1a51('0x90'),_0x1a51('0x92'),_0x1a51('0x93'),_0x1a51('0xc0')],'include':_0x54055b}];_0x3df752[_0x1a51('0xae')]({'model':db['ChatWebsite'],'as':_0x1a51('0xc1'),'attributes':['id',_0x1a51('0x29')]});_0x3df752[_0x1a51('0xae')]({'model':db[_0x1a51('0x81')],'as':'Owner','attributes':['id',_0x1a51('0x8d')]});return db['ChatInteraction'][_0x1a51('0x48')]({'where':{'id':_0x1f8691[_0x1a51('0x3d')]['id']},'include':_0x3df752})[_0x1a51('0x12')](handleEntityNotFound(_0x3ab212,null))['then'](function(_0x8ae0c0){if(_0x8ae0c0){var _0x4a27f5=_0x8ae0c0[_0x1a51('0xc2')]({'plain':!![]});fs[_0x1a51('0xc3')](_0x86d338);var _0x4ccb97={'channel':_0x1a51('0xc4'),'account':_0x4a27f5[_0x1a51('0xc1')][_0x1a51('0x29')],'agent':_0x4a27f5[_0x1a51('0xc5')]?_0x4a27f5[_0x1a51('0xc5')][_0x1a51('0x8d')]:'N.A.','createdAt':moment(_0x4a27f5[_0x1a51('0x90')])[_0x1a51('0x7d')](_0x1a51('0xaa'))[_0x1a51('0xb8')](),'closedAt':_0x4a27f5[_0x1a51('0x69')]?moment(_0x4a27f5['closedAt'])[_0x1a51('0x7d')](_0x1a51('0xaa'))['toString']():'','disposition':_0x4a27f5[_0x1a51('0x6a')],'chatInfo':{'browser':_0x4a27f5['browserName'],'os':_0x4a27f5[_0x1a51('0xc6')],'referer':_0x4a27f5['referer'],'customerIp':_0x4a27f5[_0x1a51('0xc7')],'customerPort':_0x4a27f5[_0x1a51('0xc8')]?_0x4a27f5[_0x1a51('0xc8')]:_0x1a51('0xc9')},'messages':_(_0x4a27f5['Messages'])[_0x1a51('0xca')]()[_0x1a51('0xa7')]({'secret':![]})[_0x1a51('0x31')](function(_0x1b1cea){if(_0x1b1cea[_0x1a51('0x72')]){var _0x255324=path[_0x1a51('0x77')](_0x54f02e,_0x1b1cea[_0x1a51('0x72')][_0x1a51('0x6f')]);if(fs[_0x1a51('0xcb')](_0x255324)){fs[_0x1a51('0xcc')](_0x255324)[_0x1a51('0xcd')](fs[_0x1a51('0xce')](path['join'](_0x86d338,_0x1b1cea[_0x1a51('0x72')]['basename'])));}}return{'date':moment(_0x1b1cea[_0x1a51('0x90')])[_0x1a51('0x7d')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1a51('0xb8')](),'sender':_0x1b1cea[_0x1a51('0x92')]===_0x1a51('0xcf')?_0x1b1cea[_0x1a51('0x81')]?_0x1b1cea['User'][_0x1a51('0x8d')]:_0x1a51('0x85'):_0x1b1cea['Contact'][_0x1a51('0xbd')]+(_0x1b1cea[_0x1a51('0x62')][_0x1a51('0xbe')]?'\x20'+_0x1b1cea['Contact'][_0x1a51('0xbe')]:''),'body':_0x1b1cea[_0x1a51('0x72')]?_0x1b1cea[_0x1a51('0x72')][_0x1a51('0x6f')]:_0x1b1cea[_0x1a51('0x2b')],'direction':_0x1b1cea[_0x1a51('0x92')]===_0x1a51('0xcf')?'A':'C','secret':_0x1b1cea['secret'],'read':_0x1b1cea[_0x1a51('0xc0')],'attachment':_0x1b1cea['Attachment']};})['value']()};return ejs[_0x1a51('0xd0')](path[_0x1a51('0x77')](config[_0x1a51('0x78')],'server',_0x1a51('0xd1'),_0x1a51('0xd2')),{'interaction':_0x4ccb97})[_0x1a51('0x12')](function(_0x7c395c){var _0x437f30=path[_0x1a51('0x77')](_0x86d338,'transcript-'+_0x4a27f5['id']+'-'+_0xa21924+_0x1a51('0xd3'));var _0x19beaf={'path':_0x437f30,'channel':_0x1a51('0xc4'),'interactionId':_0x4a27f5['id']};return pdf['createPdfFromHTML'](_0x7c395c,_0x19beaf);})[_0x1a51('0x12')](function(){return new Promise(function(_0x4a3d82,_0x5cce50){zipdir(_0x86d338,{'saveTo':_0x3e33bf},function(_0x49dc39,_0x1fbc4a){if(_0x49dc39)return _0x5cce50(_0x49dc39);return _0x4a3d82(_0x1fbc4a);});})['then'](function(){return new BPromise(function(_0x164d6a,_0x195490){rimraf(_0x86d338,function(_0xe0d1fc){if(_0xe0d1fc)_0x195490(_0xe0d1fc);return _0x164d6a();});});})[_0x1a51('0x12')](function(){return _0x3ab212[_0x1a51('0xb6')](_0x3e33bf,_0x275a4a,function(_0x447d24){if(_0x447d24){logger[_0x1a51('0x18')](_0x1a51('0xd4'),_0x447d24);}else{fs[_0x1a51('0xd5')](_0x3e33bf);}});});});}else{return _0x3ab212[_0x1a51('0x66')](0xc8);}})[_0x1a51('0x1d')](handleError(_0x3ab212,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 77b37e5..a8d2773 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 _0xf8b1=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','update','remove','getUsers','setDataValue','unreadMessages','length','catch'];(function(_0x3efeee,_0xc23a72){var _0x440224=function(_0x458066){while(--_0x458066){_0x3efeee['push'](_0x3efeee['shift']());}};_0x440224(++_0xc23a72);}(_0xf8b1,0xd5));var _0x1f8b=function(_0x53a36c,_0x406b76){_0x53a36c=_0x53a36c-0x0;var _0x461476=_0xf8b1[_0x53a36c];return _0x461476;};'use strict';var EventEmitter=require(_0x1f8b('0x0'));var ChatInteraction=require(_0x1f8b('0x1'))['db'][_0x1f8b('0x2')];var ChatMessage=require(_0x1f8b('0x1'))['db'][_0x1f8b('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1f8b('0x4'),'afterDestroy':_0x1f8b('0x5')};function emitEvent(_0x3ebe17){return function(_0x14f1bf,_0x4363ab,_0x35aab){_0x14f1bf[_0x1f8b('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1fc183){_0x14f1bf[_0x1f8b('0x7')]('Users',_0x1fc183['map'](function(_0x32bc53){return{'id':_0x32bc53['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x14f1bf['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x46abd1){_0x14f1bf[_0x1f8b('0x7')](_0x1f8b('0x8'),_0x46abd1[_0x1f8b('0x9')]);ChatInteractionEvents['emit'](_0x3ebe17+':'+_0x14f1bf['id'],_0x14f1bf);ChatInteractionEvents['emit'](_0x3ebe17,_0x14f1bf);_0x35aab(null);})[_0x1f8b('0xa')](_0x35aab(null));};}for(var e in events){if(events[_0x1f8b('0xb')](e)){var event=events[e];ChatInteraction[_0x1f8b('0xc')](e,emitEvent(event));}}module[_0x1f8b('0xd')]=ChatInteractionEvents; \ No newline at end of file +var _0x945f=['exports','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','update','getUsers','then','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x28ba79,_0x64bbf8){var _0x15cdc0=function(_0x40d5b9){while(--_0x40d5b9){_0x28ba79['push'](_0x28ba79['shift']());}};_0x15cdc0(++_0x64bbf8);}(_0x945f,0x10f));var _0xf945=function(_0x3bca35,_0x6bc87d){_0x3bca35=_0x3bca35-0x0;var _0x5c568c=_0x945f[_0x3bca35];return _0x5c568c;};'use strict';var EventEmitter=require(_0xf945('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xf945('0x1')];var ChatMessage=require(_0xf945('0x2'))['db'][_0xf945('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xf945('0x4')](0x0);var events={'afterCreate':_0xf945('0x5'),'afterUpdate':_0xf945('0x6'),'afterDestroy':'remove'};function emitEvent(_0x1d9f4f){return function(_0x366794,_0x52e94a,_0x44346a){_0x366794[_0xf945('0x7')]({'attributes':['id'],'raw':!![]})[_0xf945('0x8')](function(_0x2a329c){_0x366794['setDataValue'](_0xf945('0x9'),_0x2a329c[_0xf945('0xa')](function(_0x43e560){return{'id':_0x43e560['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x366794['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xca078c){_0x366794['setDataValue'](_0xf945('0xb'),_0xca078c[_0xf945('0xc')]);ChatInteractionEvents[_0xf945('0xd')](_0x1d9f4f+':'+_0x366794['id'],_0x366794);ChatInteractionEvents[_0xf945('0xd')](_0x1d9f4f,_0x366794);_0x44346a(null);})[_0xf945('0xe')](_0x44346a(null));};}for(var e in events){if(events[_0xf945('0xf')](e)){var event=events[e];ChatInteraction[_0xf945('0x10')](e,emitEvent(event));}}module[_0xf945('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 1d41ce8..309d1ca 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 _0x228a=['api','bluebird','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x228a,0x1d0));var _0xa228=function(_0x1295a2,_0x2ebafe){_0x1295a2=_0x1295a2-0x0;var _0x48124b=_0x228a[_0x1295a2];return _0x48124b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa228('0x0'))(_0xa228('0x1'));var moment=require('moment');var BPromise=require(_0xa228('0x2'));var rp=require(_0xa228('0x3'));var fs=require('fs');var path=require(_0xa228('0x4'));var rimraf=require('rimraf');var config=require(_0xa228('0x5'));var attributes=require(_0xa228('0x6'));module[_0xa228('0x7')]=function(_0x53bcf8,_0x3faaaa){return _0x53bcf8[_0xa228('0x8')](_0xa228('0x9'),attributes,{'tableName':_0xa228('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x410ba6,_0x115827,_0x41336c){if(_0x410ba6[_0xa228('0xb')](_0xa228('0xc'))){_0x410ba6['closedAt']=moment()[_0xa228('0xd')](_0xa228('0xe'));}_0x41336c(null,_0x410ba6);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xcefa=['changed','closed','closedAt','format','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','ChatInteraction','chat_interactions'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcefa,0x1c5));var _0xacef=function(_0x5e2489,_0x2fd8be){_0x5e2489=_0x5e2489-0x0;var _0xa87596=_0xcefa[_0x5e2489];return _0xa87596;};'use strict';var _=require(_0xacef('0x0'));var util=require('util');var logger=require(_0xacef('0x1'))(_0xacef('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xacef('0x3'));var fs=require('fs');var path=require(_0xacef('0x4'));var rimraf=require(_0xacef('0x5'));var config=require(_0xacef('0x6'));var attributes=require('./chatInteraction.attributes');module[_0xacef('0x7')]=function(_0x54d564,_0x4231f5){return _0x54d564[_0xacef('0x8')](_0xacef('0x9'),attributes,{'tableName':_0xacef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x30017c,_0x11d84d,_0x492870){if(_0x30017c[_0xacef('0xb')](_0xacef('0xc'))){_0x30017c[_0xacef('0xd')]=moment()[_0xacef('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x492870(null,_0x30017c);}},'charset':'utf8mb4','collate':_0xacef('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 0e53562..1b9eae5 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 _0xc653=['find','addTags','ids','AddTags','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToChatInteraction'];(function(_0x23bd35,_0x412e54){var _0x572010=function(_0x51c935){while(--_0x51c935){_0x23bd35['push'](_0x23bd35['shift']());}};_0x572010(++_0x412e54);}(_0xc653,0x144));var _0x3c65=function(_0x42be10,_0x44767f){_0x42be10=_0x42be10-0x0;var _0x4322ce=_0xc653[_0x42be10];return _0x4322ce;};'use strict';var _=require(_0x3c65('0x0'));var util=require(_0x3c65('0x1'));var moment=require(_0x3c65('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c65('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3c65('0x4'))(_0x3c65('0x5'));var config=require(_0x3c65('0x6'));var jayson=require(_0x3c65('0x7'));var client=jayson['client'][_0x3c65('0x8')]({'port':0x232a});config['redis']=_[_0x3c65('0x9')](config[_0x3c65('0xa')],{'host':_0x3c65('0xb'),'port':0x18eb});var socket=require(_0x3c65('0xc'))(new Redis(config[_0x3c65('0xa')]));require(_0x3c65('0xd'))[_0x3c65('0xe')](socket);function respondWithRpcPromise(_0x4b40ad,_0x4de28d,_0x3752e3){return new BPromise(function(_0x3bcf55,_0x3f6dc4){return client[_0x3c65('0xf')](_0x4b40ad,_0x3752e3)[_0x3c65('0x10')](function(_0x505c32){logger[_0x3c65('0x11')](_0x3c65('0x12'),_0x4de28d,'request\x20sent');logger['debug'](_0x3c65('0x13'),_0x4de28d,_0x3c65('0x14'),JSON[_0x3c65('0x15')](_0x505c32));if(_0x505c32['error']){if(_0x505c32[_0x3c65('0x16')]['code']===0x1f4){logger[_0x3c65('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x4de28d,_0x505c32[_0x3c65('0x16')][_0x3c65('0x17')]);return _0x3f6dc4(_0x505c32[_0x3c65('0x16')][_0x3c65('0x17')]);}logger['error'](_0x3c65('0x12'),_0x4de28d,_0x505c32[_0x3c65('0x16')]['message']);return _0x3bcf55(_0x505c32['error'][_0x3c65('0x17')]);}else{logger[_0x3c65('0x11')](_0x3c65('0x12'),_0x4de28d,_0x3c65('0x14'));_0x3bcf55(_0x505c32['result'][_0x3c65('0x17')]);}})[_0x3c65('0x18')](function(_0x54b32f){logger[_0x3c65('0x16')](_0x3c65('0x12'),_0x4de28d,_0x54b32f);_0x3f6dc4(_0x54b32f);});});}exports[_0x3c65('0x19')]=function(_0x313eed){var _0x5b7fe9=this;return new Promise(function(_0x543638,_0x297744){return db[_0x3c65('0x1a')][_0x3c65('0x1b')](_0x313eed[_0x3c65('0x1c')],{'raw':_0x313eed[_0x3c65('0x1d')]?_0x313eed[_0x3c65('0x1d')][_0x3c65('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x313eed[_0x3c65('0x1d')]?_0x313eed[_0x3c65('0x1d')][_0x3c65('0x1f')]||null:null,'attributes':_0x313eed[_0x3c65('0x1d')]?_0x313eed[_0x3c65('0x1d')][_0x3c65('0x20')]||null:null,'limit':_0x313eed[_0x3c65('0x1d')]?_0x313eed[_0x3c65('0x1d')][_0x3c65('0x21')]||null:null})[_0x3c65('0x10')](function(_0x173cc7){logger[_0x3c65('0x11')](_0x3c65('0x19'),_0x313eed);logger[_0x3c65('0x22')](_0x3c65('0x19'),_0x313eed,JSON[_0x3c65('0x15')](_0x173cc7));_0x543638(_0x173cc7);})[_0x3c65('0x18')](function(_0x4cf1d4){logger[_0x3c65('0x16')]('UpdateChatInteraction',_0x4cf1d4[_0x3c65('0x17')],_0x313eed);_0x297744(_0x5b7fe9[_0x3c65('0x16')](0x1f4,_0x4cf1d4[_0x3c65('0x17')]));});});};exports[_0x3c65('0x23')]=function(_0x97fffc){return new Promise(function(_0x8c03ba,_0x248853){return db[_0x3c65('0x1a')][_0x3c65('0x24')]({'where':_0x97fffc[_0x3c65('0x1d')]?_0x97fffc[_0x3c65('0x1d')][_0x3c65('0x1f')]||null:null})[_0x3c65('0x10')](function(_0x2b073e){if(_0x2b073e){return _0x2b073e[_0x3c65('0x25')](_0x97fffc[_0x3c65('0x1c')][_0x3c65('0x26')],_['omit'](_0x97fffc[_0x3c65('0x1c')],[_0x3c65('0x26'),'id'])||{});}})['spread'](function(_0x3a9ab1){logger[_0x3c65('0x11')](_0x3c65('0x27'),_0x97fffc);logger[_0x3c65('0x22')](_0x3c65('0x27'),_0x97fffc,JSON[_0x3c65('0x15')](_0x3a9ab1));_0x8c03ba(_0x3a9ab1);})[_0x3c65('0x18')](function(_0xa35b90){logger[_0x3c65('0x16')](_0x3c65('0x27'),_0xa35b90[_0x3c65('0x17')],_0x97fffc);_0x248853(_this[_0x3c65('0x16')](0x1f4,_0xa35b90[_0x3c65('0x17')]));});});}; \ No newline at end of file +var _0x2a00=['message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','find','addTags','ids','spread','AddTags','lodash','ioredis','../../config/logger','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a00,0xe9));var _0x02a0=function(_0xe19f31,_0x43c71d){_0xe19f31=_0xe19f31-0x0;var _0x5b6bd4=_0x2a00[_0xe19f31];return _0x5b6bd4;};'use strict';var _=require(_0x02a0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x02a0('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x02a0('0x2'))('rpc');var config=require(_0x02a0('0x3'));var jayson=require(_0x02a0('0x4'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x02a0('0x5')],{'host':_0x02a0('0x6'),'port':0x18eb});var socket=require(_0x02a0('0x7'))(new Redis(config[_0x02a0('0x5')]));require('./chatInteraction.socket')[_0x02a0('0x8')](socket);function respondWithRpcPromise(_0x10016c,_0x4bab49,_0xea46f6){return new BPromise(function(_0xd8c104,_0x7abcbd){return client[_0x02a0('0x9')](_0x10016c,_0xea46f6)[_0x02a0('0xa')](function(_0x3ba2ce){logger[_0x02a0('0xb')]('ChatInteraction,\x20%s,\x20%s',_0x4bab49,_0x02a0('0xc'));logger[_0x02a0('0xd')](_0x02a0('0xe'),_0x4bab49,_0x02a0('0xc'),JSON[_0x02a0('0xf')](_0x3ba2ce));if(_0x3ba2ce[_0x02a0('0x10')]){if(_0x3ba2ce[_0x02a0('0x10')][_0x02a0('0x11')]===0x1f4){logger[_0x02a0('0x10')](_0x02a0('0x12'),_0x4bab49,_0x3ba2ce[_0x02a0('0x10')]['message']);return _0x7abcbd(_0x3ba2ce['error'][_0x02a0('0x13')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x4bab49,_0x3ba2ce[_0x02a0('0x10')][_0x02a0('0x13')]);return _0xd8c104(_0x3ba2ce[_0x02a0('0x10')][_0x02a0('0x13')]);}else{logger[_0x02a0('0xb')](_0x02a0('0x12'),_0x4bab49,_0x02a0('0xc'));_0xd8c104(_0x3ba2ce[_0x02a0('0x14')][_0x02a0('0x13')]);}})[_0x02a0('0x15')](function(_0x1fffb1){logger[_0x02a0('0x10')](_0x02a0('0x12'),_0x4bab49,_0x1fffb1);_0x7abcbd(_0x1fffb1);});});}exports[_0x02a0('0x16')]=function(_0x3e6ed4){var _0x5dae10=this;return new Promise(function(_0x29c08e,_0x495ef3){return db[_0x02a0('0x17')][_0x02a0('0x18')](_0x3e6ed4[_0x02a0('0x19')],{'raw':_0x3e6ed4[_0x02a0('0x1a')]?_0x3e6ed4['options'][_0x02a0('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e6ed4[_0x02a0('0x1a')]?_0x3e6ed4[_0x02a0('0x1a')][_0x02a0('0x1c')]||null:null,'attributes':_0x3e6ed4[_0x02a0('0x1a')]?_0x3e6ed4['options'][_0x02a0('0x1d')]||null:null,'limit':_0x3e6ed4[_0x02a0('0x1a')]?_0x3e6ed4[_0x02a0('0x1a')][_0x02a0('0x1e')]||null:null})['then'](function(_0x2ebbb4){logger[_0x02a0('0xb')](_0x02a0('0x16'),_0x3e6ed4);logger[_0x02a0('0xd')](_0x02a0('0x16'),_0x3e6ed4,JSON[_0x02a0('0xf')](_0x2ebbb4));_0x29c08e(_0x2ebbb4);})['catch'](function(_0x4b7ab2){logger[_0x02a0('0x10')]('UpdateChatInteraction',_0x4b7ab2['message'],_0x3e6ed4);_0x495ef3(_0x5dae10[_0x02a0('0x10')](0x1f4,_0x4b7ab2['message']));});});};exports['AddTagsToChatInteraction']=function(_0x5ddbb7){return new Promise(function(_0x327939,_0x55592e){return db[_0x02a0('0x17')][_0x02a0('0x1f')]({'where':_0x5ddbb7['options']?_0x5ddbb7['options']['where']||null:null})[_0x02a0('0xa')](function(_0x3c6e64){if(_0x3c6e64){return _0x3c6e64[_0x02a0('0x20')](_0x5ddbb7[_0x02a0('0x19')][_0x02a0('0x21')],_['omit'](_0x5ddbb7[_0x02a0('0x19')],['ids','id'])||{});}})[_0x02a0('0x22')](function(_0x5c4265){logger['info'](_0x02a0('0x23'),_0x5ddbb7);logger[_0x02a0('0xd')](_0x02a0('0x23'),_0x5ddbb7,JSON['stringify'](_0x5c4265));_0x327939(_0x5c4265);})['catch'](function(_0x5d3c79){logger[_0x02a0('0x10')]('AddTags',_0x5d3c79[_0x02a0('0x13')],_0x5ddbb7);_0x55592e(_this['error'](0x1f4,_0x5d3c79['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index b5935bc..4987c66 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 _0x422c=['removeListener','register','length','chatInteraction:','./chatInteraction.events','save','emit'];(function(_0x23d2a6,_0x2ca613){var _0x2beae9=function(_0x292e9a){while(--_0x292e9a){_0x23d2a6['push'](_0x23d2a6['shift']());}};_0x2beae9(++_0x2ca613);}(_0x422c,0x1ee));var _0xc422=function(_0x5bbcbe,_0x43078b){_0x5bbcbe=_0x5bbcbe-0x0;var _0xb77120=_0x422c[_0x5bbcbe];return _0xb77120;};'use strict';var ChatInteractionEvents=require(_0xc422('0x0'));var events=[_0xc422('0x1'),'remove','update'];function createListener(_0x55cdad,_0x2d88b5){return function(_0x2fb911){_0x2d88b5[_0xc422('0x2')](_0x55cdad,_0x2fb911);};}function removeListener(_0x588269,_0xf914c0){return function(){ChatInteractionEvents[_0xc422('0x3')](_0x588269,_0xf914c0);};}exports[_0xc422('0x4')]=function(_0x54ffc3){for(var _0x53757f=0x0,_0x564f0c=events[_0xc422('0x5')];_0x53757f<_0x564f0c;_0x53757f++){var _0x26a298=events[_0x53757f];var _0x43a2e1=createListener(_0xc422('0x6')+_0x26a298,_0x54ffc3);ChatInteractionEvents['on'](_0x26a298,_0x43a2e1);}}; \ No newline at end of file +var _0x2732=['./chatInteraction.events','save','remove','removeListener','register','length','chatInteraction:'];(function(_0x264cc5,_0x8405fa){var _0x37b740=function(_0x43fc90){while(--_0x43fc90){_0x264cc5['push'](_0x264cc5['shift']());}};_0x37b740(++_0x8405fa);}(_0x2732,0x1ce));var _0x2273=function(_0x39cca2,_0x121bae){_0x39cca2=_0x39cca2-0x0;var _0x1bd97c=_0x2732[_0x39cca2];return _0x1bd97c;};'use strict';var ChatInteractionEvents=require(_0x2273('0x0'));var events=[_0x2273('0x1'),_0x2273('0x2'),'update'];function createListener(_0x8db313,_0x4bd497){return function(_0x2ae490){_0x4bd497['emit'](_0x8db313,_0x2ae490);};}function removeListener(_0x1630d6,_0x2b134a){return function(){ChatInteractionEvents[_0x2273('0x3')](_0x1630d6,_0x2b134a);};}exports[_0x2273('0x4')]=function(_0x3f1e21){for(var _0x30821c=0x0,_0x32e458=events[_0x2273('0x5')];_0x30821c<_0x32e458;_0x30821c++){var _0x23db54=events[_0x30821c];var _0x3e6e32=createListener(_0x2273('0x6')+_0x23db54,_0x3f1e21);ChatInteractionEvents['on'](_0x23db54,_0x3e6e32);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 39c0d96..f4c0002 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 _0xdece=['/:id/attachment_upload','file','attachmentUpload','/:id/tags','tracked','chatinteraction:addtags','addTags','/:id','chat','chatinteraction:update','update','put','/:id/custom_update','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','download','post','create','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','format','%s-%s','now'];(function(_0x194684,_0x23859b){var _0x508fd6=function(_0x2a6a56){while(--_0x2a6a56){_0x194684['push'](_0x194684['shift']());}};_0x508fd6(++_0x23859b);}(_0xdece,0x1c6));var _0xedec=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xdece[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0xedec('0x0'));var util=require(_0xedec('0x1'));var path=require(_0xedec('0x2'));var timeout=require(_0xedec('0x3'));var express=require(_0xedec('0x4'));var router=express[_0xedec('0x5')]();var fs_extra=require(_0xedec('0x6'));var auth=require(_0xedec('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xedec('0x8'));var controller=require(_0xedec('0x9'));router[_0xedec('0xa')]('/',auth[_0xedec('0xb')](),controller[_0xedec('0xc')]);router[_0xedec('0xa')](_0xedec('0xd'),auth[_0xedec('0xb')](),controller[_0xedec('0xe')]);router[_0xedec('0xa')]('/:id',auth[_0xedec('0xf')](),controller[_0xedec('0x10')]);router[_0xedec('0xa')](_0xedec('0x11'),auth[_0xedec('0xf')](),controller[_0xedec('0x12')]);router[_0xedec('0xa')](_0xedec('0x13'),auth[_0xedec('0xb')](),controller['getMessages']);router[_0xedec('0xa')](_0xedec('0x14'),auth[_0xedec('0xf')](),controller['getMyMessages']);router[_0xedec('0xa')]('/:id/download',auth[_0xedec('0xb')](),controller[_0xedec('0x15')]);router[_0xedec('0x16')]('/',auth[_0xedec('0xb')](),controller[_0xedec('0x17')]);router[_0xedec('0x16')](_0xedec('0x18'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xedec('0x19')]({'destination':function(_0x3cdab7,_0x3946a5,_0x34d310){_0x34d310(null,path[_0xedec('0x1a')](config[_0xedec('0x1b')],_0xedec('0x1c')));},'filename':function(_0x329a06,_0x436234,_0x5dbedd){_0x5dbedd(null,util[_0xedec('0x1d')](_0xedec('0x1e'),Date[_0xedec('0x1f')](),_0x436234['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xedec('0x16')](_0xedec('0x20'),upload['single'](_0xedec('0x21')),controller[_0xedec('0x22')]);router['post'](_0xedec('0x13'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0xedec('0x16')](_0xedec('0x23'),auth['isAuthenticated'](),interaction[_0xedec('0x24')]('chat',_0xedec('0x25')),controller[_0xedec('0x26')]);router['put'](_0xedec('0x27'),auth['isAuthenticated'](),interaction[_0xedec('0x24')](_0xedec('0x28'),_0xedec('0x29')),controller[_0xedec('0x2a')]);router[_0xedec('0x2b')](_0xedec('0x2c'),controller['customUpdate']);router['put'](_0xedec('0x2d'),auth['isChatInteractionAuthorized'](),controller[_0xedec('0x2e')]);router[_0xedec('0x2b')](_0xedec('0x2f'),controller[_0xedec('0x30')]);router[_0xedec('0x31')](_0xedec('0x27'),auth[_0xedec('0xb')](),interaction[_0xedec('0x24')](_0xedec('0x28'),_0xedec('0x32')),controller[_0xedec('0x33')]);router[_0xedec('0x31')](_0xedec('0x23'),auth[_0xedec('0xb')](),controller[_0xedec('0x34')]);module[_0xedec('0x35')]=router; \ No newline at end of file +var _0x7cee=['tracked','chat','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','diskStorage','join','root','format','%s-%s','now','originalname','/:id/attachment_upload','single','file','attachmentUpload','addMessage'];(function(_0x5410df,_0xcae0a1){var _0x1ded36=function(_0x241688){while(--_0x241688){_0x5410df['push'](_0x5410df['shift']());}};_0x1ded36(++_0xcae0a1);}(_0x7cee,0x19f));var _0xe7ce=function(_0x5216e0,_0x4f8cb9){_0x5216e0=_0x5216e0-0x0;var _0x5b3f40=_0x7cee[_0x5216e0];return _0x5b3f40;};'use strict';var multer=require('multer');var util=require(_0xe7ce('0x0'));var path=require(_0xe7ce('0x1'));var timeout=require('connect-timeout');var express=require(_0xe7ce('0x2'));var router=express[_0xe7ce('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe7ce('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe7ce('0x5'));var controller=require(_0xe7ce('0x6'));router[_0xe7ce('0x7')]('/',auth[_0xe7ce('0x8')](),controller[_0xe7ce('0x9')]);router[_0xe7ce('0x7')](_0xe7ce('0xa'),auth['isAuthenticated'](),controller[_0xe7ce('0xb')]);router[_0xe7ce('0x7')](_0xe7ce('0xc'),auth[_0xe7ce('0xd')](),controller[_0xe7ce('0xe')]);router[_0xe7ce('0x7')]('/:id/attachment_download',auth[_0xe7ce('0xd')](),controller['attachmentDownload']);router[_0xe7ce('0x7')](_0xe7ce('0xf'),auth[_0xe7ce('0x8')](),controller[_0xe7ce('0x10')]);router[_0xe7ce('0x7')](_0xe7ce('0x11'),auth[_0xe7ce('0xd')](),controller[_0xe7ce('0x12')]);router['get'](_0xe7ce('0x13'),auth[_0xe7ce('0x8')](),controller[_0xe7ce('0x14')]);router['post']('/',auth[_0xe7ce('0x8')](),controller[_0xe7ce('0x15')]);router[_0xe7ce('0x16')]('/:id/vidaoo',auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xe7ce('0x17')]({'destination':function(_0xd85f69,_0x5b4242,_0x4c7560){_0x4c7560(null,path[_0xe7ce('0x18')](config[_0xe7ce('0x19')],'server/files/attachments/'));},'filename':function(_0x3200cf,_0x19a84a,_0x3d3b3e){_0x3d3b3e(null,util[_0xe7ce('0x1a')](_0xe7ce('0x1b'),Date[_0xe7ce('0x1c')](),_0x19a84a[_0xe7ce('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xe7ce('0x1e'),upload[_0xe7ce('0x1f')](_0xe7ce('0x20')),controller[_0xe7ce('0x21')]);router['post'](_0xe7ce('0xf'),auth[_0xe7ce('0xd')](),controller[_0xe7ce('0x22')]);router[_0xe7ce('0x16')]('/:id/tags',auth[_0xe7ce('0x8')](),interaction[_0xe7ce('0x23')](_0xe7ce('0x24'),'chatinteraction:addtags'),controller['addTags']);router[_0xe7ce('0x25')]('/:id',auth['isAuthenticated'](),interaction[_0xe7ce('0x23')](_0xe7ce('0x24'),'chatinteraction:update'),controller['update']);router[_0xe7ce('0x25')](_0xe7ce('0x26'),controller[_0xe7ce('0x27')]);router['put'](_0xe7ce('0x28'),auth[_0xe7ce('0xd')](),controller[_0xe7ce('0x29')]);router[_0xe7ce('0x25')](_0xe7ce('0x2a'),controller[_0xe7ce('0x2b')]);router[_0xe7ce('0x2c')](_0xe7ce('0xc'),auth[_0xe7ce('0x8')](),interaction[_0xe7ce('0x23')](_0xe7ce('0x24'),_0xe7ce('0x2d')),controller[_0xe7ce('0x2e')]);router[_0xe7ce('0x2c')](_0xe7ce('0x2f'),auth[_0xe7ce('0x8')](),controller[_0xe7ce('0x30')]);module[_0xe7ce('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 06513ea..4dd8626 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 _0x46f6=['BOOLEAN','sequelize','exports','medium'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x46f6,0x1ad));var _0x646f=function(_0x37332e,_0x5f4812){_0x37332e=_0x37332e-0x0;var _0x5958e5=_0x46f6[_0x37332e];return _0x5958e5;};'use strict';var Sequelize=require(_0x646f('0x0'));module[_0x646f('0x1')]={'body':{'type':Sequelize['TEXT'](_0x646f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x646f('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7c4f=['exports','BOOLEAN'];(function(_0x4e80f7,_0x2d8f73){var _0x50201f=function(_0x4a38c5){while(--_0x4a38c5){_0x4e80f7['push'](_0x4e80f7['shift']());}};_0x50201f(++_0x2d8f73);}(_0x7c4f,0x176));var _0xf7c4=function(_0x2fff5a,_0x45c3e5){_0x2fff5a=_0x2fff5a-0x0;var _0x46cbb7=_0x7c4f[_0x2fff5a];return _0x46cbb7;};'use strict';var Sequelize=require('sequelize');module[_0xf7c4('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xf7c4('0x1')],'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 0501787..cd46f5b 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 _0x06d4=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','stack','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','update','describe','get','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','role','userpic','internal','online','lastLoginAt','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','isEmpty','resourceId','push','createdAt','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x119d9e,_0x16d98f){var _0xc56ad=function(_0x11271e){while(--_0x11271e){_0x119d9e['push'](_0x119d9e['shift']());}};_0xc56ad(++_0x16d98f);}(_0x06d4,0x144));var _0x406d=function(_0x45b575,_0x432ab5){_0x45b575=_0x45b575-0x0;var _0x374a45=_0x06d4[_0x45b575];return _0x374a45;};'use strict';var emlformat=require(_0x406d('0x0'));var rimraf=require(_0x406d('0x1'));var zipdir=require(_0x406d('0x2'));var jsonpatch=require(_0x406d('0x3'));var rp=require(_0x406d('0x4'));var moment=require(_0x406d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x406d('0x6'));var path=require(_0x406d('0x7'));var sox=require(_0x406d('0x8'));var csv=require(_0x406d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x406d('0xa'));var _=require(_0x406d('0xb'));var squel=require(_0x406d('0xc'));var crypto=require('crypto');var jsforce=require(_0x406d('0xd'));var deskjs=require(_0x406d('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x406d('0xf'));var Redis=require(_0x406d('0x10'));var authService=require(_0x406d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x406d('0x12'));var hardwareService=require(_0x406d('0x13'));var logger=require(_0x406d('0x14'))(_0x406d('0x15'));var utils=require(_0x406d('0x16'));var config=require(_0x406d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x406d('0x18'))['db'];config[_0x406d('0x19')]=_[_0x406d('0x1a')](config[_0x406d('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x406d('0x1b'))(new Redis(config[_0x406d('0x19')]));require(_0x406d('0x1c'))[_0x406d('0x1d')](socket);function respondWithStatusCode(_0x536e1d,_0x60e4a3){_0x60e4a3=_0x60e4a3||0xcc;return function(_0x334e15){if(_0x334e15){return _0x536e1d[_0x406d('0x1e')](_0x60e4a3);}return _0x536e1d[_0x406d('0x1f')](_0x60e4a3)[_0x406d('0x20')]();};}function respondWithResult(_0x3d9d4c,_0x23735d){_0x23735d=_0x23735d||0xc8;return function(_0x11037b){if(_0x11037b){return _0x3d9d4c['status'](_0x23735d)[_0x406d('0x21')](_0x11037b);}};}function respondWithFilteredResult(_0x54abde,_0x20bef8){return function(_0x3d36fb){if(_0x3d36fb){var _0x3b7aef=typeof _0x20bef8[_0x406d('0x22')]==='undefined'&&typeof _0x20bef8[_0x406d('0x23')]===_0x406d('0x24');var _0x56849a=_0x3d36fb[_0x406d('0x25')];var _0x5dd76f=_0x3b7aef?0x0:_0x20bef8['offset'];var _0x5f4d7e=_0x3b7aef?_0x3d36fb[_0x406d('0x25')]:_0x20bef8['offset']+_0x20bef8['limit'];var _0x5e7679;if(_0x5f4d7e>=_0x56849a){_0x5f4d7e=_0x56849a;_0x5e7679=0xc8;}else{_0x5e7679=0xce;}_0x54abde['status'](_0x5e7679);return _0x54abde[_0x406d('0x26')](_0x406d('0x27'),_0x5dd76f+'-'+_0x5f4d7e+'/'+_0x56849a)[_0x406d('0x21')](_0x3d36fb);}return null;};}function patchUpdates(_0x4e6d27){return function(_0x448019){try{jsonpatch['apply'](_0x448019,_0x4e6d27,!![]);}catch(_0x2907e1){return BPromise[_0x406d('0x28')](_0x2907e1);}return _0x448019[_0x406d('0x29')]();};}function saveUpdates(_0x58673e,_0x7ab3c7){return function(_0x1d6788){if(_0x1d6788){return _0x1d6788['update'](_0x58673e)[_0x406d('0x2a')](function(_0x530a41){return _0x530a41;});}return null;};}function removeEntity(_0x2dfda1,_0x1b023f){return function(_0x40e274){if(_0x40e274){return _0x40e274[_0x406d('0x2b')]()[_0x406d('0x2a')](function(){_0x2dfda1[_0x406d('0x1f')](0xcc)[_0x406d('0x20')]();});}};}function handleEntityNotFound(_0x40808e,_0x76cb64){return function(_0x1556cf){if(!_0x1556cf){_0x40808e[_0x406d('0x1e')](0x194);}return _0x1556cf;};}function handleError(_0x5b2c04,_0x55b4f8){_0x55b4f8=_0x55b4f8||0x1f4;return function(_0x403218){logger['error'](_0x403218[_0x406d('0x2c')]);if(_0x403218[_0x406d('0x2d')]){delete _0x403218['name'];}_0x5b2c04[_0x406d('0x1f')](_0x55b4f8)[_0x406d('0x2e')](_0x403218);};}exports[_0x406d('0x2f')]=function(_0x13ca04,_0x1fbf93){var _0xd4331={},_0x49424d={},_0xf04450={'count':0x0,'rows':[]};var _0x3ab101=_['map'](db[_0x406d('0x30')][_0x406d('0x31')],function(_0x5efab5){return{'name':_0x5efab5[_0x406d('0x32')],'type':_0x5efab5[_0x406d('0x33')][_0x406d('0x34')]};});_0x49424d[_0x406d('0x35')]=_['map'](_0x3ab101,_0x406d('0x2d'));_0x49424d[_0x406d('0x36')]=_[_0x406d('0x37')](_0x13ca04['query']);_0x49424d[_0x406d('0x38')]=_['intersection'](_0x49424d['model'],_0x49424d[_0x406d('0x36')]);_0xd4331[_0x406d('0x39')]=_[_0x406d('0x3a')](_0x49424d[_0x406d('0x35')],qs['fields'](_0x13ca04[_0x406d('0x36')][_0x406d('0x3b')]));_0xd4331[_0x406d('0x39')]=_0xd4331[_0x406d('0x39')][_0x406d('0x3c')]?_0xd4331['attributes']:_0x49424d[_0x406d('0x35')];if(!_0x13ca04['query'][_0x406d('0x3d')](_0x406d('0x3e'))){_0xd4331[_0x406d('0x23')]=qs[_0x406d('0x23')](_0x13ca04[_0x406d('0x36')][_0x406d('0x23')]);_0xd4331[_0x406d('0x22')]=qs['offset'](_0x13ca04[_0x406d('0x36')]['offset']);}_0xd4331[_0x406d('0x3f')]=qs[_0x406d('0x40')](_0x13ca04[_0x406d('0x36')][_0x406d('0x40')]);_0xd4331[_0x406d('0x41')]=qs[_0x406d('0x38')](_[_0x406d('0x42')](_0x13ca04['query'],_0x49424d['filters']),_0x3ab101);if(_0x13ca04[_0x406d('0x36')][_0x406d('0x43')]){_0xd4331[_0x406d('0x41')]=_[_0x406d('0x44')](_0xd4331[_0x406d('0x41')],{'$or':_[_0x406d('0x45')](_0x3ab101,function(_0x26acf3){if(_0x26acf3['type']!==_0x406d('0x46')){var _0x206490={};_0x206490[_0x26acf3[_0x406d('0x2d')]]={'$like':'%'+_0x13ca04[_0x406d('0x36')][_0x406d('0x43')]+'%'};return _0x206490;}})});}_0xd4331=_[_0x406d('0x44')]({},_0xd4331,_0x13ca04[_0x406d('0x47')]);var _0x272d77={'where':_0xd4331[_0x406d('0x41')]};return db['ChatInternalMessage'][_0x406d('0x25')](_0x272d77)[_0x406d('0x2a')](function(_0x153e6f){_0xf04450[_0x406d('0x25')]=_0x153e6f;if(_0x13ca04[_0x406d('0x36')][_0x406d('0x48')]){_0xd4331['include']=[{'all':!![]}];}return db[_0x406d('0x30')][_0x406d('0x49')](_0xd4331);})[_0x406d('0x2a')](function(_0x4b7d01){_0xf04450[_0x406d('0x4a')]=_0x4b7d01;return _0xf04450;})[_0x406d('0x2a')](respondWithFilteredResult(_0x1fbf93,_0xd4331))[_0x406d('0x4b')](handleError(_0x1fbf93,null));};exports[_0x406d('0x4c')]=function(_0x448d1f,_0x2669e6){var _0xf5c89f={'raw':!![],'where':{'id':_0x448d1f[_0x406d('0x4d')]['id']}},_0x226204={};_0x226204[_0x406d('0x35')]=_[_0x406d('0x37')](db[_0x406d('0x30')]['rawAttributes']);_0x226204[_0x406d('0x36')]=_[_0x406d('0x37')](_0x448d1f[_0x406d('0x36')]);_0x226204[_0x406d('0x38')]=_[_0x406d('0x3a')](_0x226204['model'],_0x226204[_0x406d('0x36')]);_0xf5c89f[_0x406d('0x39')]=_[_0x406d('0x3a')](_0x226204['model'],qs[_0x406d('0x3b')](_0x448d1f[_0x406d('0x36')][_0x406d('0x3b')]));_0xf5c89f[_0x406d('0x39')]=_0xf5c89f[_0x406d('0x39')][_0x406d('0x3c')]?_0xf5c89f[_0x406d('0x39')]:_0x226204[_0x406d('0x35')];if(_0x448d1f[_0x406d('0x36')]['includeAll']){_0xf5c89f['include']=[{'all':!![]}];}_0xf5c89f=_[_0x406d('0x44')]({},_0xf5c89f,_0x448d1f[_0x406d('0x47')]);return db[_0x406d('0x30')][_0x406d('0x4e')](_0xf5c89f)['then'](handleEntityNotFound(_0x2669e6,null))[_0x406d('0x2a')](respondWithResult(_0x2669e6,null))['catch'](handleError(_0x2669e6,null));};exports[_0x406d('0x4f')]=function(_0x1a7695,_0x1a9049){return db['ChatInternalMessage'][_0x406d('0x4f')](_0x1a7695[_0x406d('0x50')],{})[_0x406d('0x2a')](respondWithResult(_0x1a9049,0xc9))[_0x406d('0x4b')](handleError(_0x1a9049,null));};exports[_0x406d('0x51')]=function(_0x49c180,_0x412482){if(_0x49c180[_0x406d('0x50')]['id']){delete _0x49c180['body']['id'];}return db[_0x406d('0x30')][_0x406d('0x4e')]({'where':{'id':_0x49c180['params']['id']}})[_0x406d('0x2a')](handleEntityNotFound(_0x412482,null))[_0x406d('0x2a')](saveUpdates(_0x49c180[_0x406d('0x50')],null))[_0x406d('0x2a')](respondWithResult(_0x412482,null))[_0x406d('0x4b')](handleError(_0x412482,null));};exports[_0x406d('0x2b')]=function(_0x1ce485,_0x260c3a){return db[_0x406d('0x30')][_0x406d('0x4e')]({'where':{'id':_0x1ce485[_0x406d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x260c3a,null))['then'](removeEntity(_0x260c3a,null))[_0x406d('0x4b')](handleError(_0x260c3a,null));};exports[_0x406d('0x52')]=function(_0x20aa41,_0x2b296a){return db[_0x406d('0x30')][_0x406d('0x52')]()[_0x406d('0x2a')](respondWithResult(_0x2b296a,null))['catch'](handleError(_0x2b296a,null));};function wrapUser(_0x2351a7){return function(_0xd52c32){var _0x978484=_0x2351a7[_0x406d('0x53')]({'plain':!![]});_0x978484['messages']=[];if(_0xd52c32){_0x978484['lastMessageAt']=_0xd52c32['createdAt'];_0x978484[_0x406d('0x54')]=_0xd52c32;}else{_0x978484[_0x406d('0x55')]=moment(0x0)[_0x406d('0x56')](_0x406d('0x57'));_0x978484[_0x406d('0x54')]={};}return _0x978484;};}exports[_0x406d('0x58')]=function(_0x3d7d1d,_0x3a410d,_0x249639){var _0x231e67=[];return db[_0x406d('0x59')][_0x406d('0x49')]({'where':{'role':[_0x406d('0x5a'),_0x406d('0x5b'),_0x406d('0x5c')]},'attributes':['id','fullname','name',_0x406d('0x5d'),_0x406d('0x5e'),_0x406d('0x5f'),_0x406d('0x60'),_0x406d('0x61'),'allowmessenger',_0x406d('0x62')],'order':qs[_0x406d('0x40')]('-online'),'include':[{'model':db[_0x406d('0x63')],'as':_0x406d('0x64'),'attributes':['id',_0x406d('0x2d'),_0x406d('0x33')],'through':{'attributes':[]}}]})[_0x406d('0x2a')](function(_0x4be8a0){if(_0x4be8a0){var _0x461f53=_0x3d7d1d[_0x406d('0x5c')][_0x406d('0x53')]({'plain':!![]});if(!_0x461f53)throw new Error(_0x406d('0x65'));if(_0x461f53[_0x406d('0x5d')]===_0x406d('0x5c')){return db[_0x406d('0x66')][_0x406d('0x4e')]({'where':{'name':_0x406d('0x67'),'userProfileId':_0x461f53[_0x406d('0x68')]},'raw':!![]})['then'](function(_0x5a86cc){if(_0x5a86cc){if(_0x5a86cc['autoAssociation']===0x0){return db['UserProfileResource'][_0x406d('0x49')]({'where':{'sectionId':_0x5a86cc['id']},'raw':!![]})[_0x406d('0x2a')](function(_0x21ea3a){var _0xd03e2b=[];if(_[_0x406d('0x69')](_0x21ea3a)){_0xd03e2b=_[_0x406d('0x43')](_0x4be8a0,function(_0x15f64b){if(_0x15f64b[_0x406d('0x5d')]!==_0x406d('0x5a')){return _0x15f64b;}});return _0xd03e2b;}else{for(var _0x579370=0x0;_0x579370<_0x4be8a0['length'];_0x579370++){var _0x20252c=_0x4be8a0[_0x579370];if(_0x20252c['role']===_0x406d('0x5a')){var _0x25650d=_[_0x406d('0x4e')](_0x21ea3a,function(_0x2633ab){return _0x2633ab[_0x406d('0x6a')]===_0x20252c['id'];});if(_0x25650d)_0xd03e2b[_0x406d('0x6b')](_0x20252c);}else{_0xd03e2b['push'](_0x20252c);}}return _0xd03e2b;}});}else{return _0x4be8a0;}}else{var _0x49bf29=_[_0x406d('0x43')](_0x4be8a0,function(_0x3bff06){if(_0x3bff06[_0x406d('0x5d')]!==_0x406d('0x5a')){return _0x3bff06;}});return _0x49bf29;}});}else{return _0x4be8a0;}}})[_0x406d('0x2a')](function(_0x3a7fe0){var _0x60ca91=[];if(_0x3a7fe0){_0x231e67=_0x3a7fe0;for(var _0x1541fa=0x0;_0x1541fa<_0x3a7fe0['length'];_0x1541fa+=0x1){_0x231e67[_0x1541fa]['messages']=[];_0x60ca91['push'](db['ChatInternalMessage'][_0x406d('0x4e')]({'where':{'FromId':[_0x3d7d1d['user']['id'],_0x3a7fe0[_0x1541fa]['id']],'ToId':[_0x3d7d1d[_0x406d('0x5c')]['id'],_0x3a7fe0[_0x1541fa]['id']],'ChatGroupId':null},'attributes':['id',_0x406d('0x6c'),_0x406d('0x6d'),_0x406d('0x6e'),_0x406d('0x6f'),_0x406d('0x50')],'order':qs['sort'](_0x406d('0x70')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x3a7fe0[_0x1541fa])));}return BPromise[_0x406d('0x71')](_0x60ca91);}return[];})[_0x406d('0x2a')](function(_0x102842){return{'rows':_0x102842,'count':_0x102842[_0x406d('0x3c')]};})[_0x406d('0x2a')](respondWithResult(_0x3a410d,null))[_0x406d('0x4b')](handleError(_0x3a410d,null));}; \ No newline at end of file +var _0x8bac=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','find','create','body','params','destroy','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','user','role','userpic','internal','online','lastLoginAt','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','isEmpty','agent','push','FromId','ToId','read','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring'];(function(_0x58f378,_0x328667){var _0x1afed1=function(_0x5502f6){while(--_0x5502f6){_0x58f378['push'](_0x58f378['shift']());}};_0x1afed1(++_0x328667);}(_0x8bac,0xcd));var _0xc8ba=function(_0x20bc10,_0x35bed9){_0x20bc10=_0x20bc10-0x0;var _0x3bd5ce=_0x8bac[_0x20bc10];return _0x3bd5ce;};'use strict';var emlformat=require(_0xc8ba('0x0'));var rimraf=require(_0xc8ba('0x1'));var zipdir=require(_0xc8ba('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc8ba('0x3'));var moment=require(_0xc8ba('0x4'));var BPromise=require(_0xc8ba('0x5'));var Mustache=require(_0xc8ba('0x6'));var util=require(_0xc8ba('0x7'));var path=require(_0xc8ba('0x8'));var sox=require(_0xc8ba('0x9'));var csv=require(_0xc8ba('0xa'));var ejs=require(_0xc8ba('0xb'));var fs=require('fs');var fs_extra=require(_0xc8ba('0xc'));var _=require(_0xc8ba('0xd'));var squel=require(_0xc8ba('0xe'));var crypto=require('crypto');var jsforce=require(_0xc8ba('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc8ba('0xa'));var querystring=require(_0xc8ba('0x10'));var Papa=require(_0xc8ba('0x11'));var Redis=require(_0xc8ba('0x12'));var authService=require(_0xc8ba('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc8ba('0x14'));var hardwareService=require(_0xc8ba('0x15'));var logger=require(_0xc8ba('0x16'))(_0xc8ba('0x17'));var utils=require(_0xc8ba('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc8ba('0x19'));var db=require(_0xc8ba('0x1a'))['db'];config[_0xc8ba('0x1b')]=_['defaults'](config[_0xc8ba('0x1b')],{'host':_0xc8ba('0x1c'),'port':0x18eb});var socket=require(_0xc8ba('0x1d'))(new Redis(config['redis']));require(_0xc8ba('0x1e'))[_0xc8ba('0x1f')](socket);function respondWithStatusCode(_0xe5cf1b,_0x897bc9){_0x897bc9=_0x897bc9||0xcc;return function(_0x32be15){if(_0x32be15){return _0xe5cf1b[_0xc8ba('0x20')](_0x897bc9);}return _0xe5cf1b[_0xc8ba('0x21')](_0x897bc9)['end']();};}function respondWithResult(_0x71b7ff,_0xcfe164){_0xcfe164=_0xcfe164||0xc8;return function(_0x181944){if(_0x181944){return _0x71b7ff[_0xc8ba('0x21')](_0xcfe164)['json'](_0x181944);}};}function respondWithFilteredResult(_0x493048,_0x2f1318){return function(_0x16310e){if(_0x16310e){var _0x440c43=typeof _0x2f1318[_0xc8ba('0x22')]===_0xc8ba('0x23')&&typeof _0x2f1318[_0xc8ba('0x24')]===_0xc8ba('0x23');var _0x5824b7=_0x16310e[_0xc8ba('0x25')];var _0x3df9cc=_0x440c43?0x0:_0x2f1318[_0xc8ba('0x22')];var _0x5bf9cb=_0x440c43?_0x16310e[_0xc8ba('0x25')]:_0x2f1318[_0xc8ba('0x22')]+_0x2f1318[_0xc8ba('0x24')];var _0x36e823;if(_0x5bf9cb>=_0x5824b7){_0x5bf9cb=_0x5824b7;_0x36e823=0xc8;}else{_0x36e823=0xce;}_0x493048[_0xc8ba('0x21')](_0x36e823);return _0x493048[_0xc8ba('0x26')](_0xc8ba('0x27'),_0x3df9cc+'-'+_0x5bf9cb+'/'+_0x5824b7)['json'](_0x16310e);}return null;};}function patchUpdates(_0x5c41e1){return function(_0x6f1e74){try{jsonpatch[_0xc8ba('0x28')](_0x6f1e74,_0x5c41e1,!![]);}catch(_0xe71fb9){return BPromise[_0xc8ba('0x29')](_0xe71fb9);}return _0x6f1e74[_0xc8ba('0x2a')]();};}function saveUpdates(_0x82ef5b,_0x11bec0){return function(_0x30a338){if(_0x30a338){return _0x30a338[_0xc8ba('0x2b')](_0x82ef5b)[_0xc8ba('0x2c')](function(_0x49c955){return _0x49c955;});}return null;};}function removeEntity(_0x3eef25,_0x5d9324){return function(_0x36db80){if(_0x36db80){return _0x36db80['destroy']()['then'](function(){_0x3eef25[_0xc8ba('0x21')](0xcc)[_0xc8ba('0x2d')]();});}};}function handleEntityNotFound(_0x4335c8,_0x2376f9){return function(_0xc6885e){if(!_0xc6885e){_0x4335c8['sendStatus'](0x194);}return _0xc6885e;};}function handleError(_0x3f6dc0,_0x5aafb6){_0x5aafb6=_0x5aafb6||0x1f4;return function(_0x564161){logger[_0xc8ba('0x2e')](_0x564161[_0xc8ba('0x2f')]);if(_0x564161['name']){delete _0x564161[_0xc8ba('0x30')];}_0x3f6dc0[_0xc8ba('0x21')](_0x5aafb6)[_0xc8ba('0x31')](_0x564161);};}exports['index']=function(_0x26b978,_0x18244b){var _0x2d1796={},_0xd54216={},_0x34866f={'count':0x0,'rows':[]};var _0x4e1b30=_['map'](db[_0xc8ba('0x32')][_0xc8ba('0x33')],function(_0x1629fe){return{'name':_0x1629fe[_0xc8ba('0x34')],'type':_0x1629fe[_0xc8ba('0x35')][_0xc8ba('0x36')]};});_0xd54216[_0xc8ba('0x37')]=_['map'](_0x4e1b30,_0xc8ba('0x30'));_0xd54216[_0xc8ba('0x38')]=_[_0xc8ba('0x39')](_0x26b978[_0xc8ba('0x38')]);_0xd54216['filters']=_['intersection'](_0xd54216['model'],_0xd54216['query']);_0x2d1796[_0xc8ba('0x3a')]=_[_0xc8ba('0x3b')](_0xd54216[_0xc8ba('0x37')],qs[_0xc8ba('0x3c')](_0x26b978[_0xc8ba('0x38')][_0xc8ba('0x3c')]));_0x2d1796[_0xc8ba('0x3a')]=_0x2d1796[_0xc8ba('0x3a')][_0xc8ba('0x3d')]?_0x2d1796['attributes']:_0xd54216['model'];if(!_0x26b978[_0xc8ba('0x38')][_0xc8ba('0x3e')]('nolimit')){_0x2d1796[_0xc8ba('0x24')]=qs[_0xc8ba('0x24')](_0x26b978[_0xc8ba('0x38')][_0xc8ba('0x24')]);_0x2d1796[_0xc8ba('0x22')]=qs[_0xc8ba('0x22')](_0x26b978[_0xc8ba('0x38')][_0xc8ba('0x22')]);}_0x2d1796[_0xc8ba('0x3f')]=qs[_0xc8ba('0x40')](_0x26b978[_0xc8ba('0x38')][_0xc8ba('0x40')]);_0x2d1796[_0xc8ba('0x41')]=qs[_0xc8ba('0x42')](_[_0xc8ba('0x43')](_0x26b978[_0xc8ba('0x38')],_0xd54216[_0xc8ba('0x42')]),_0x4e1b30);if(_0x26b978[_0xc8ba('0x38')][_0xc8ba('0x44')]){_0x2d1796['where']=_['merge'](_0x2d1796[_0xc8ba('0x41')],{'$or':_[_0xc8ba('0x45')](_0x4e1b30,function(_0xb5236c){if(_0xb5236c[_0xc8ba('0x35')]!==_0xc8ba('0x46')){var _0x1346c5={};_0x1346c5[_0xb5236c[_0xc8ba('0x30')]]={'$like':'%'+_0x26b978[_0xc8ba('0x38')]['filter']+'%'};return _0x1346c5;}})});}_0x2d1796=_[_0xc8ba('0x47')]({},_0x2d1796,_0x26b978[_0xc8ba('0x48')]);var _0x168199={'where':_0x2d1796[_0xc8ba('0x41')]};return db['ChatInternalMessage']['count'](_0x168199)[_0xc8ba('0x2c')](function(_0x5e7659){_0x34866f[_0xc8ba('0x25')]=_0x5e7659;if(_0x26b978[_0xc8ba('0x38')][_0xc8ba('0x49')]){_0x2d1796[_0xc8ba('0x4a')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xc8ba('0x4b')](_0x2d1796);})[_0xc8ba('0x2c')](function(_0x36e510){_0x34866f[_0xc8ba('0x4c')]=_0x36e510;return _0x34866f;})['then'](respondWithFilteredResult(_0x18244b,_0x2d1796))[_0xc8ba('0x4d')](handleError(_0x18244b,null));};exports['show']=function(_0xa3f3f9,_0x48288b){var _0x389438={'raw':!![],'where':{'id':_0xa3f3f9['params']['id']}},_0x550ee7={};_0x550ee7[_0xc8ba('0x37')]=_['keys'](db['ChatInternalMessage']['rawAttributes']);_0x550ee7['query']=_[_0xc8ba('0x39')](_0xa3f3f9[_0xc8ba('0x38')]);_0x550ee7[_0xc8ba('0x42')]=_[_0xc8ba('0x3b')](_0x550ee7[_0xc8ba('0x37')],_0x550ee7[_0xc8ba('0x38')]);_0x389438[_0xc8ba('0x3a')]=_[_0xc8ba('0x3b')](_0x550ee7[_0xc8ba('0x37')],qs['fields'](_0xa3f3f9['query'][_0xc8ba('0x3c')]));_0x389438['attributes']=_0x389438['attributes']['length']?_0x389438[_0xc8ba('0x3a')]:_0x550ee7[_0xc8ba('0x37')];if(_0xa3f3f9[_0xc8ba('0x38')][_0xc8ba('0x49')]){_0x389438[_0xc8ba('0x4a')]=[{'all':!![]}];}_0x389438=_[_0xc8ba('0x47')]({},_0x389438,_0xa3f3f9[_0xc8ba('0x48')]);return db['ChatInternalMessage'][_0xc8ba('0x4e')](_0x389438)[_0xc8ba('0x2c')](handleEntityNotFound(_0x48288b,null))[_0xc8ba('0x2c')](respondWithResult(_0x48288b,null))[_0xc8ba('0x4d')](handleError(_0x48288b,null));};exports['create']=function(_0x37580c,_0x1f0e8f){return db['ChatInternalMessage'][_0xc8ba('0x4f')](_0x37580c[_0xc8ba('0x50')],{})[_0xc8ba('0x2c')](respondWithResult(_0x1f0e8f,0xc9))['catch'](handleError(_0x1f0e8f,null));};exports[_0xc8ba('0x2b')]=function(_0x557dbb,_0x4b387c){if(_0x557dbb[_0xc8ba('0x50')]['id']){delete _0x557dbb['body']['id'];}return db[_0xc8ba('0x32')][_0xc8ba('0x4e')]({'where':{'id':_0x557dbb[_0xc8ba('0x51')]['id']}})['then'](handleEntityNotFound(_0x4b387c,null))[_0xc8ba('0x2c')](saveUpdates(_0x557dbb['body'],null))[_0xc8ba('0x2c')](respondWithResult(_0x4b387c,null))[_0xc8ba('0x4d')](handleError(_0x4b387c,null));};exports[_0xc8ba('0x52')]=function(_0x520a1a,_0x59d06b){return db['ChatInternalMessage']['find']({'where':{'id':_0x520a1a[_0xc8ba('0x51')]['id']}})['then'](handleEntityNotFound(_0x59d06b,null))['then'](removeEntity(_0x59d06b,null))[_0xc8ba('0x4d')](handleError(_0x59d06b,null));};exports[_0xc8ba('0x53')]=function(_0x3d3bdf,_0xa475d){return db[_0xc8ba('0x32')][_0xc8ba('0x53')]()[_0xc8ba('0x2c')](respondWithResult(_0xa475d,null))[_0xc8ba('0x4d')](handleError(_0xa475d,null));};function wrapUser(_0x1b3136){return function(_0x505f03){var _0x47308a=_0x1b3136[_0xc8ba('0x54')]({'plain':!![]});_0x47308a[_0xc8ba('0x55')]=[];if(_0x505f03){_0x47308a[_0xc8ba('0x56')]=_0x505f03[_0xc8ba('0x57')];_0x47308a[_0xc8ba('0x58')]=_0x505f03;}else{_0x47308a[_0xc8ba('0x56')]=moment(0x0)[_0xc8ba('0x59')](_0xc8ba('0x5a'));_0x47308a[_0xc8ba('0x58')]={};}return _0x47308a;};}exports['getUsers']=function(_0x2dd4ad,_0x551cd1,_0x3370ac){var _0x591980=[];return db[_0xc8ba('0x5b')]['findAll']({'where':{'role':['agent','admin',_0xc8ba('0x5c')]},'attributes':['id','fullname',_0xc8ba('0x30'),_0xc8ba('0x5d'),_0xc8ba('0x5e'),_0xc8ba('0x5f'),_0xc8ba('0x60'),_0xc8ba('0x61'),'allowmessenger','showWebBar'],'order':qs[_0xc8ba('0x40')](_0xc8ba('0x62')),'include':[{'model':db[_0xc8ba('0x63')],'as':_0xc8ba('0x64'),'attributes':['id',_0xc8ba('0x30'),'type'],'through':{'attributes':[]}}]})[_0xc8ba('0x2c')](function(_0x1e6a6e){if(_0x1e6a6e){var _0x30821f=_0x2dd4ad['user'][_0xc8ba('0x54')]({'plain':!![]});if(!_0x30821f)throw new Error(_0xc8ba('0x65'));if(_0x30821f[_0xc8ba('0x5d')]===_0xc8ba('0x5c')){return db[_0xc8ba('0x66')][_0xc8ba('0x4e')]({'where':{'name':'Agents','userProfileId':_0x30821f[_0xc8ba('0x67')]},'raw':!![]})[_0xc8ba('0x2c')](function(_0x50d6c5){if(_0x50d6c5){if(_0x50d6c5[_0xc8ba('0x68')]===0x0){return db['UserProfileResource'][_0xc8ba('0x4b')]({'where':{'sectionId':_0x50d6c5['id']},'raw':!![]})[_0xc8ba('0x2c')](function(_0x584d88){var _0x21bb06=[];if(_[_0xc8ba('0x69')](_0x584d88)){_0x21bb06=_[_0xc8ba('0x44')](_0x1e6a6e,function(_0x48f864){if(_0x48f864[_0xc8ba('0x5d')]!==_0xc8ba('0x6a')){return _0x48f864;}});return _0x21bb06;}else{for(var _0x239ed2=0x0;_0x239ed2<_0x1e6a6e[_0xc8ba('0x3d')];_0x239ed2++){var _0x275200=_0x1e6a6e[_0x239ed2];if(_0x275200[_0xc8ba('0x5d')]===_0xc8ba('0x6a')){var _0x1a733d=_[_0xc8ba('0x4e')](_0x584d88,function(_0x583ed1){return _0x583ed1['resourceId']===_0x275200['id'];});if(_0x1a733d)_0x21bb06[_0xc8ba('0x6b')](_0x275200);}else{_0x21bb06[_0xc8ba('0x6b')](_0x275200);}}return _0x21bb06;}});}else{return _0x1e6a6e;}}else{var _0x5df769=_[_0xc8ba('0x44')](_0x1e6a6e,function(_0x66d029){if(_0x66d029[_0xc8ba('0x5d')]!=='agent'){return _0x66d029;}});return _0x5df769;}});}else{return _0x1e6a6e;}}})[_0xc8ba('0x2c')](function(_0x3ca7b7){var _0x4e45ea=[];if(_0x3ca7b7){_0x591980=_0x3ca7b7;for(var _0x3f8273=0x0;_0x3f8273<_0x3ca7b7[_0xc8ba('0x3d')];_0x3f8273+=0x1){_0x591980[_0x3f8273][_0xc8ba('0x55')]=[];_0x4e45ea[_0xc8ba('0x6b')](db['ChatInternalMessage'][_0xc8ba('0x4e')]({'where':{'FromId':[_0x2dd4ad[_0xc8ba('0x5c')]['id'],_0x3ca7b7[_0x3f8273]['id']],'ToId':[_0x2dd4ad['user']['id'],_0x3ca7b7[_0x3f8273]['id']],'ChatGroupId':null},'attributes':['id',_0xc8ba('0x57'),_0xc8ba('0x6c'),_0xc8ba('0x6d'),_0xc8ba('0x6e'),_0xc8ba('0x50')],'order':qs[_0xc8ba('0x40')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xc8ba('0x2c')](wrapUser(_0x3ca7b7[_0x3f8273])));}return BPromise['all'](_0x4e45ea);}return[];})[_0xc8ba('0x2c')](function(_0xc7df54){return{'rows':_0xc7df54,'count':_0xc7df54['length']};})[_0xc8ba('0x2c')](respondWithResult(_0x551cd1,null))[_0xc8ba('0x4d')](handleError(_0x551cd1,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 16d26ad..2509e63 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 _0xadbb=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','ChatInternalMessage'];(function(_0x136835,_0xe1ee2a){var _0x5b0b13=function(_0x4bcedb){while(--_0x4bcedb){_0x136835['push'](_0x136835['shift']());}};_0x5b0b13(++_0xe1ee2a);}(_0xadbb,0x66));var _0xbadb=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xadbb[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0xbadb('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xbadb('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xbadb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbadb('0x3'),'afterDestroy':'remove'};function emitEvent(_0xd80010){return function(_0x115f32,_0x460a9e,_0x564684){ChatInternalMessageEvents[_0xbadb('0x4')](_0xd80010+':'+_0x115f32['id'],_0x115f32);ChatInternalMessageEvents[_0xbadb('0x4')](_0xd80010,_0x115f32);_0x564684(null);};}for(var e in events){if(events[_0xbadb('0x5')](e)){var event=events[e];ChatInternalMessage[_0xbadb('0x6')](e,emitEvent(event));}}module[_0xbadb('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x91c5=['hasOwnProperty','exports','../../mysqldb','save','emit'];(function(_0x28060b,_0x4fab74){var _0x6d9d3e=function(_0x94ccc6){while(--_0x94ccc6){_0x28060b['push'](_0x28060b['shift']());}};_0x6d9d3e(++_0x4fab74);}(_0x91c5,0x124));var _0x591c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x91c5[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x591c('0x0'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x591c('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x548412){return function(_0x5a07a2,_0xf2fd33,_0x16f04b){ChatInternalMessageEvents['emit'](_0x548412+':'+_0x5a07a2['id'],_0x5a07a2);ChatInternalMessageEvents[_0x591c('0x2')](_0x548412,_0x5a07a2);_0x16f04b(null);};}for(var e in events){if(events[_0x591c('0x3')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x591c('0x4')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 4bedd74..9c8e9a6 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 _0x95d3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x95d3,0x1a0));var _0x395d=function(_0x168ecb,_0xd51f15){_0x168ecb=_0x168ecb-0x0;var _0x375aa8=_0x95d3[_0x168ecb];return _0x375aa8;};'use strict';var _=require(_0x395d('0x0'));var util=require(_0x395d('0x1'));var logger=require(_0x395d('0x2'))(_0x395d('0x3'));var moment=require(_0x395d('0x4'));var BPromise=require(_0x395d('0x5'));var rp=require(_0x395d('0x6'));var fs=require('fs');var path=require(_0x395d('0x7'));var rimraf=require(_0x395d('0x8'));var config=require(_0x395d('0x9'));var attributes=require(_0x395d('0xa'));module['exports']=function(_0x4021bc,_0x5006ba){return _0x4021bc['define'](_0x395d('0xb'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x395d('0xc'),'collate':_0x395d('0xd')});}; \ No newline at end of file +var _0x8b6a=['utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4'];(function(_0x295d25,_0x4ec193){var _0x50bd17=function(_0x4a905b){while(--_0x4a905b){_0x295d25['push'](_0x295d25['shift']());}};_0x50bd17(++_0x4ec193);}(_0x8b6a,0xd3));var _0xa8b6=function(_0xd70247,_0x2bfce7){_0xd70247=_0xd70247-0x0;var _0x961e16=_0x8b6a[_0xd70247];return _0x961e16;};'use strict';var _=require(_0xa8b6('0x0'));var util=require(_0xa8b6('0x1'));var logger=require(_0xa8b6('0x2'))('api');var moment=require(_0xa8b6('0x3'));var BPromise=require(_0xa8b6('0x4'));var rp=require(_0xa8b6('0x5'));var fs=require('fs');var path=require(_0xa8b6('0x6'));var rimraf=require(_0xa8b6('0x7'));var config=require(_0xa8b6('0x8'));var attributes=require(_0xa8b6('0x9'));module[_0xa8b6('0xa')]=function(_0x521d14,_0x1fc8cc){return _0x521d14[_0xa8b6('0xb')]('ChatInternalMessage',attributes,{'tableName':_0xa8b6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa8b6('0xd'),'collate':_0xa8b6('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 689d54e..61b128e 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 _0x9bef=['../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9bef,0x133));var _0xf9be=function(_0x28b2c2,_0x278d72){_0x28b2c2=_0x28b2c2-0x0;var _0x1957ea=_0x9bef[_0x28b2c2];return _0x1957ea;};'use strict';var _=require(_0xf9be('0x0'));var util=require(_0xf9be('0x1'));var moment=require('moment');var BPromise=require(_0xf9be('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf9be('0x3'));var db=require(_0xf9be('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf9be('0x5'))('rpc');var config=require(_0xf9be('0x6'));var jayson=require(_0xf9be('0x7'));var client=jayson['client'][_0xf9be('0x8')]({'port':0x232a});config[_0xf9be('0x9')]=_[_0xf9be('0xa')](config[_0xf9be('0x9')],{'host':_0xf9be('0xb'),'port':0x18eb});var socket=require(_0xf9be('0xc'))(new Redis(config[_0xf9be('0x9')]));require(_0xf9be('0xd'))['register'](socket);function respondWithRpcPromise(_0x41a401,_0x5ec3e4,_0x471f02){return new BPromise(function(_0x33c615,_0x5ac324){return client[_0xf9be('0xe')](_0x41a401,_0x471f02)[_0xf9be('0xf')](function(_0x266245){logger[_0xf9be('0x10')](_0xf9be('0x11'),_0x5ec3e4,'request\x20sent');logger[_0xf9be('0x12')](_0xf9be('0x13'),_0x5ec3e4,_0xf9be('0x14'),JSON['stringify'](_0x266245));if(_0x266245[_0xf9be('0x15')]){if(_0x266245[_0xf9be('0x15')][_0xf9be('0x16')]===0x1f4){logger[_0xf9be('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x5ec3e4,_0x266245[_0xf9be('0x15')][_0xf9be('0x17')]);return _0x5ac324(_0x266245[_0xf9be('0x15')][_0xf9be('0x17')]);}logger['error'](_0xf9be('0x11'),_0x5ec3e4,_0x266245['error'][_0xf9be('0x17')]);return _0x33c615(_0x266245['error'][_0xf9be('0x17')]);}else{logger[_0xf9be('0x10')](_0xf9be('0x11'),_0x5ec3e4,'request\x20sent');_0x33c615(_0x266245[_0xf9be('0x18')][_0xf9be('0x17')]);}})[_0xf9be('0x19')](function(_0x20f3c3){logger[_0xf9be('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x5ec3e4,_0x20f3c3);_0x5ac324(_0x20f3c3);});});} \ No newline at end of file +var _0xc1f1=['result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc1f1,0x122));var _0x1c1f=function(_0x8a917c,_0x19c5f6){_0x8a917c=_0x8a917c-0x0;var _0x2c704e=_0xc1f1[_0x8a917c];return _0x2c704e;};'use strict';var _=require('lodash');var util=require(_0x1c1f('0x0'));var moment=require(_0x1c1f('0x1'));var BPromise=require('bluebird');var rs=require(_0x1c1f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c1f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c1f('0x4'))('rpc');var config=require(_0x1c1f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1c1f('0x6')][_0x1c1f('0x7')]({'port':0x232a});config[_0x1c1f('0x8')]=_[_0x1c1f('0x9')](config[_0x1c1f('0x8')],{'host':_0x1c1f('0xa'),'port':0x18eb});var socket=require(_0x1c1f('0xb'))(new Redis(config['redis']));require(_0x1c1f('0xc'))['register'](socket);function respondWithRpcPromise(_0x13ae18,_0x38a582,_0x28bd49){return new BPromise(function(_0xa76d01,_0x207407){return client[_0x1c1f('0xd')](_0x13ae18,_0x28bd49)[_0x1c1f('0xe')](function(_0x5b7ed8){logger['info'](_0x1c1f('0xf'),_0x38a582,_0x1c1f('0x10'));logger[_0x1c1f('0x11')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x38a582,_0x1c1f('0x10'),JSON[_0x1c1f('0x12')](_0x5b7ed8));if(_0x5b7ed8[_0x1c1f('0x13')]){if(_0x5b7ed8[_0x1c1f('0x13')]['code']===0x1f4){logger['error'](_0x1c1f('0xf'),_0x38a582,_0x5b7ed8[_0x1c1f('0x13')][_0x1c1f('0x14')]);return _0x207407(_0x5b7ed8[_0x1c1f('0x13')][_0x1c1f('0x14')]);}logger[_0x1c1f('0x13')](_0x1c1f('0xf'),_0x38a582,_0x5b7ed8[_0x1c1f('0x13')]['message']);return _0xa76d01(_0x5b7ed8['error'][_0x1c1f('0x14')]);}else{logger[_0x1c1f('0x15')](_0x1c1f('0xf'),_0x38a582,_0x1c1f('0x10'));_0xa76d01(_0x5b7ed8[_0x1c1f('0x16')][_0x1c1f('0x14')]);}})[_0x1c1f('0x17')](function(_0x4653a6){logger['error'](_0x1c1f('0xf'),_0x38a582,_0x4653a6);_0x207407(_0x4653a6);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index df59716..73181c9 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 _0xaba8=['emit','removeListener','length','./chatInternalMessage.events','save','update'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xaba8,0xf3));var _0x8aba=function(_0x31c78d,_0x594960){_0x31c78d=_0x31c78d-0x0;var _0x4fc2cb=_0xaba8[_0x31c78d];return _0x4fc2cb;};'use strict';var ChatInternalMessageEvents=require(_0x8aba('0x0'));var events=[_0x8aba('0x1'),'remove',_0x8aba('0x2')];function createListener(_0x4f7755,_0x3360a3){return function(_0x3b74fd){_0x3360a3[_0x8aba('0x3')](_0x4f7755,_0x3b74fd);};}function removeListener(_0x45b50e,_0x35bfd4){return function(){ChatInternalMessageEvents[_0x8aba('0x4')](_0x45b50e,_0x35bfd4);};}exports['register']=function(_0xbc255f){for(var _0x32da5d=0x0,_0x3f5a03=events[_0x8aba('0x5')];_0x32da5d<_0x3f5a03;_0x32da5d++){var _0x47ab86=events[_0x32da5d];var _0x4c053f=createListener('chatInternalMessage:'+_0x47ab86,_0xbc255f);ChatInternalMessageEvents['on'](_0x47ab86,_0x4c053f);}}; \ No newline at end of file +var _0x01cb=['emit','removeListener','register','chatInternalMessage:','./chatInternalMessage.events','save','update'];(function(_0x96302f,_0x1122f2){var _0x157d9d=function(_0x3167a5){while(--_0x3167a5){_0x96302f['push'](_0x96302f['shift']());}};_0x157d9d(++_0x1122f2);}(_0x01cb,0x12a));var _0xb01c=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0x01cb[_0x562f3b];return _0x1edd55;};'use strict';var ChatInternalMessageEvents=require(_0xb01c('0x0'));var events=[_0xb01c('0x1'),'remove',_0xb01c('0x2')];function createListener(_0x5a144d,_0x1f7f3e){return function(_0x21f970){_0x1f7f3e[_0xb01c('0x3')](_0x5a144d,_0x21f970);};}function removeListener(_0x4f18c4,_0x13c674){return function(){ChatInternalMessageEvents[_0xb01c('0x4')](_0x4f18c4,_0x13c674);};}exports[_0xb01c('0x5')]=function(_0x40368b){for(var _0x491b59=0x0,_0x579467=events['length'];_0x491b59<_0x579467;_0x491b59++){var _0x4fa078=events[_0x491b59];var _0x123055=createListener(_0xb01c('0x6')+_0x4fa078,_0x40368b);ChatInternalMessageEvents['on'](_0x4fa078,_0x123055);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 8174caa..b16db15 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 _0xc850=['create','put','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','/describe','get','/users','getUsers','/:id'];(function(_0x2b76c9,_0x46eaee){var _0x230b98=function(_0x27b704){while(--_0x27b704){_0x2b76c9['push'](_0x2b76c9['shift']());}};_0x230b98(++_0x46eaee);}(_0xc850,0xe0));var _0x0c85=function(_0x32d999,_0x8a4ca9){_0x32d999=_0x32d999-0x0;var _0x280400=_0xc850[_0x32d999];return _0x280400;};'use strict';var multer=require(_0x0c85('0x0'));var util=require(_0x0c85('0x1'));var path=require(_0x0c85('0x2'));var timeout=require('connect-timeout');var express=require(_0x0c85('0x3'));var router=express[_0x0c85('0x4')]();var fs_extra=require(_0x0c85('0x5'));var auth=require(_0x0c85('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0c85('0x7'));var controller=require(_0x0c85('0x8'));router['get']('/',auth[_0x0c85('0x9')](),controller[_0x0c85('0xa')]);router['get'](_0x0c85('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x0c85('0xc')](_0x0c85('0xd'),auth[_0x0c85('0x9')](),controller[_0x0c85('0xe')]);router[_0x0c85('0xc')](_0x0c85('0xf'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x0c85('0x10')]);router[_0x0c85('0x11')](_0x0c85('0xf'),controller['update']);router[_0x0c85('0x12')](_0x0c85('0xf'),auth[_0x0c85('0x9')](),controller[_0x0c85('0x13')]);module['exports']=router; \ No newline at end of file +var _0xab4d=['isAuthenticated','index','/describe','describe','/users','/:id','show','create','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./chatInternalMessage.controller','get'];(function(_0x203b6f,_0x3a2cff){var _0x4b5f21=function(_0x1ee263){while(--_0x1ee263){_0x203b6f['push'](_0x203b6f['shift']());}};_0x4b5f21(++_0x3a2cff);}(_0xab4d,0x199));var _0xdab4=function(_0x5528c3,_0x35a416){_0x5528c3=_0x5528c3-0x0;var _0x47ec1b=_0xab4d[_0x5528c3];return _0x47ec1b;};'use strict';var multer=require(_0xdab4('0x0'));var util=require(_0xdab4('0x1'));var path=require(_0xdab4('0x2'));var timeout=require(_0xdab4('0x3'));var express=require(_0xdab4('0x4'));var router=express['Router']();var fs_extra=require(_0xdab4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdab4('0x6'));var config=require('../../config/environment');var controller=require(_0xdab4('0x7'));router[_0xdab4('0x8')]('/',auth[_0xdab4('0x9')](),controller[_0xdab4('0xa')]);router[_0xdab4('0x8')](_0xdab4('0xb'),auth['isAuthenticated'](),controller[_0xdab4('0xc')]);router[_0xdab4('0x8')](_0xdab4('0xd'),auth[_0xdab4('0x9')](),controller['getUsers']);router[_0xdab4('0x8')](_0xdab4('0xe'),auth[_0xdab4('0x9')](),controller[_0xdab4('0xf')]);router['post']('/',auth[_0xdab4('0x9')](),controller[_0xdab4('0x10')]);router['put']('/:id',controller['update']);router[_0xdab4('0x11')](_0xdab4('0xe'),auth['isAuthenticated'](),controller[_0xdab4('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 3078ff5..23da55f 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 _0xda3f=['DATE','exports','TEXT','ENUM','out'];(function(_0x3f6089,_0x224162){var _0x5df5fe=function(_0x40517f){while(--_0x40517f){_0x3f6089['push'](_0x3f6089['shift']());}};_0x5df5fe(++_0x224162);}(_0xda3f,0xec));var _0xfda3=function(_0x8b620d,_0x305311){_0x8b620d=_0x8b620d-0x0;var _0xc50733=_0xda3f[_0x8b620d];return _0xc50733;};'use strict';var Sequelize=require('sequelize');module[_0xfda3('0x0')]={'body':{'type':Sequelize[_0xfda3('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xfda3('0x2')]('in','out'),'defaultValue':_0xfda3('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xfda3('0x4')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xfda3('0x1')]}}; \ No newline at end of file +var _0xd4dc=['ENUM','out','STRING','sequelize','TEXT','medium','BOOLEAN'];(function(_0x41b828,_0x8eabb){var _0x4ac853=function(_0x160e08){while(--_0x160e08){_0x41b828['push'](_0x41b828['shift']());}};_0x4ac853(++_0x8eabb);}(_0xd4dc,0xff));var _0xcd4d=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xd4dc[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0xcd4d('0x0'));module['exports']={'body':{'type':Sequelize[_0xcd4d('0x1')](_0xcd4d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xcd4d('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xcd4d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcd4d('0x4')]('in',_0xcd4d('0x5')),'defaultValue':_0xcd4d('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xcd4d('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 5303829..125d44a 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 _0xae34=['findAll','rows','show','params','includeAll','find','create','body','destroy','describe','../../config/logger','chat-interactions','accept','chat','read','readAt','UserId','user','agent','get','ChatInteraction','ChatInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','format','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','contact','rejectmessage','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','end','sendStatus','stack','name','send','index','map','ChatMessage','rawAttributes','type','key','model','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include'];(function(_0x4551f6,_0x48151b){var _0x581dc2=function(_0x1842af){while(--_0x1842af){_0x4551f6['push'](_0x4551f6['shift']());}};_0x581dc2(++_0x48151b);}(_0xae34,0xbe));var _0x4ae3=function(_0x2f1e5f,_0x2d9ca9){_0x2f1e5f=_0x2f1e5f-0x0;var _0x16328c=_0xae34[_0x2f1e5f];return _0x16328c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ae3('0x0'));var zipdir=require(_0x4ae3('0x1'));var jsonpatch=require(_0x4ae3('0x2'));var rp=require('request-promise');var moment=require(_0x4ae3('0x3'));var BPromise=require(_0x4ae3('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4ae3('0x5'));var sox=require(_0x4ae3('0x6'));var csv=require('to-csv');var ejs=require(_0x4ae3('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ae3('0x8'));var squel=require(_0x4ae3('0x9'));var crypto=require(_0x4ae3('0xa'));var jsforce=require(_0x4ae3('0xb'));var deskjs=require(_0x4ae3('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4ae3('0xd'));var Papa=require('papaparse');var Redis=require(_0x4ae3('0xe'));var authService=require(_0x4ae3('0xf'));var qs=require(_0x4ae3('0x10'));var as=require(_0x4ae3('0x11'));var hardwareService=require(_0x4ae3('0x12'));var logger=require('../../config/logger')(_0x4ae3('0x13'));var utils=require(_0x4ae3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4ae3('0x15'));var db=require(_0x4ae3('0x16'))['db'];config[_0x4ae3('0x17')]=_[_0x4ae3('0x18')](config[_0x4ae3('0x17')],{'host':_0x4ae3('0x19'),'port':0x18eb});var socket=require(_0x4ae3('0x1a'))(new Redis(config[_0x4ae3('0x17')]));require(_0x4ae3('0x1b'))[_0x4ae3('0x1c')](socket);var jayson=require(_0x4ae3('0x1d'));var client=jayson[_0x4ae3('0x1e')][_0x4ae3('0x1f')]({'port':0x232c});var client9002=jayson[_0x4ae3('0x1e')][_0x4ae3('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x56c7f3,_0x28bdd2,_0x29a6aa,_0x3e7836){return new BPromise(function(_0x32b06b,_0x1f44aa){var _0x4c0bfd=_0x3e7836||client;return _0x4c0bfd[_0x4ae3('0x20')](_0x56c7f3,_0x29a6aa)['then'](function(_0x23583e){logger[_0x4ae3('0x21')](_0x4ae3('0x22'),_0x28bdd2,_0x4ae3('0x23'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x28bdd2,'request\x20sent',JSON[_0x4ae3('0x24')](_0x23583e));if(_0x23583e[_0x4ae3('0x25')]){if(_0x23583e[_0x4ae3('0x25')]['code']===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x28bdd2,_0x23583e['error']['message']);return _0x1f44aa(_0x23583e[_0x4ae3('0x25')][_0x4ae3('0x26')]);}logger[_0x4ae3('0x25')](_0x4ae3('0x22'),_0x28bdd2,_0x23583e[_0x4ae3('0x25')][_0x4ae3('0x26')]);return _0x32b06b(_0x23583e[_0x4ae3('0x25')][_0x4ae3('0x26')]);}else{logger[_0x4ae3('0x21')](_0x4ae3('0x22'),_0x28bdd2,_0x4ae3('0x23'));_0x32b06b(_0x23583e[_0x4ae3('0x27')][_0x4ae3('0x26')]);}})[_0x4ae3('0x28')](function(_0x5469cf){logger['error']('ChatMessage,\x20%s,\x20%s',_0x28bdd2,_0x5469cf);_0x1f44aa(_0x5469cf);});});}function respondWithStatusCode(_0xc7a3d8,_0x40ce02){_0x40ce02=_0x40ce02||0xcc;return function(_0x40a069){if(_0x40a069){return _0xc7a3d8['sendStatus'](_0x40ce02);}return _0xc7a3d8[_0x4ae3('0x29')](_0x40ce02)['end']();};}function respondWithResult(_0x45a55e,_0x17e634){_0x17e634=_0x17e634||0xc8;return function(_0x479f31){if(_0x479f31){return _0x45a55e[_0x4ae3('0x29')](_0x17e634)[_0x4ae3('0x2a')](_0x479f31);}};}function respondWithFilteredResult(_0x107fe6,_0x2d9b16){return function(_0x312e00){if(_0x312e00){var _0xeed231=typeof _0x2d9b16['offset']==='undefined'&&typeof _0x2d9b16['limit']===_0x4ae3('0x2b');var _0x8221a6=_0x312e00[_0x4ae3('0x2c')];var _0x4d4ac8=_0xeed231?0x0:_0x2d9b16[_0x4ae3('0x2d')];var _0x3044f7=_0xeed231?_0x312e00['count']:_0x2d9b16[_0x4ae3('0x2d')]+_0x2d9b16[_0x4ae3('0x2e')];var _0x28efe8;if(_0x3044f7>=_0x8221a6){_0x3044f7=_0x8221a6;_0x28efe8=0xc8;}else{_0x28efe8=0xce;}_0x107fe6['status'](_0x28efe8);return _0x107fe6[_0x4ae3('0x2f')](_0x4ae3('0x30'),_0x4d4ac8+'-'+_0x3044f7+'/'+_0x8221a6)[_0x4ae3('0x2a')](_0x312e00);}return null;};}function patchUpdates(_0x9f0ef){return function(_0x5a99dc){try{jsonpatch[_0x4ae3('0x31')](_0x5a99dc,_0x9f0ef,!![]);}catch(_0x596cec){return BPromise[_0x4ae3('0x32')](_0x596cec);}return _0x5a99dc['save']();};}function saveUpdates(_0x35917b,_0x26e75f){return function(_0x3e206f){if(_0x3e206f){return _0x3e206f[_0x4ae3('0x33')](_0x35917b)['then'](function(_0x38529e){return _0x38529e;});}return null;};}function removeEntity(_0x2bf544,_0x21adb6){return function(_0x3f6f57){if(_0x3f6f57){return _0x3f6f57['destroy']()[_0x4ae3('0x34')](function(){_0x2bf544['status'](0xcc)[_0x4ae3('0x35')]();});}};}function handleEntityNotFound(_0x168d08,_0x3610ed){return function(_0x3aae99){if(!_0x3aae99){_0x168d08[_0x4ae3('0x36')](0x194);}return _0x3aae99;};}function handleError(_0xd45f1e,_0x5edb71){_0x5edb71=_0x5edb71||0x1f4;return function(_0x505adb){logger[_0x4ae3('0x25')](_0x505adb[_0x4ae3('0x37')]);if(_0x505adb[_0x4ae3('0x38')]){delete _0x505adb[_0x4ae3('0x38')];}_0xd45f1e[_0x4ae3('0x29')](_0x5edb71)[_0x4ae3('0x39')](_0x505adb);};}exports[_0x4ae3('0x3a')]=function(_0x2049d8,_0x41b64b){var _0x363bba={},_0x531cea={},_0x167db6={'count':0x0,'rows':[]};var _0x5d61a3=_[_0x4ae3('0x3b')](db[_0x4ae3('0x3c')][_0x4ae3('0x3d')],function(_0x71dba0){return{'name':_0x71dba0['fieldName'],'type':_0x71dba0[_0x4ae3('0x3e')][_0x4ae3('0x3f')]};});_0x531cea[_0x4ae3('0x40')]=_[_0x4ae3('0x3b')](_0x5d61a3,_0x4ae3('0x38'));_0x531cea['query']=_[_0x4ae3('0x41')](_0x2049d8['query']);_0x531cea[_0x4ae3('0x42')]=_[_0x4ae3('0x43')](_0x531cea['model'],_0x531cea['query']);_0x363bba['attributes']=_['intersection'](_0x531cea[_0x4ae3('0x40')],qs[_0x4ae3('0x44')](_0x2049d8[_0x4ae3('0x45')][_0x4ae3('0x44')]));_0x363bba[_0x4ae3('0x46')]=_0x363bba['attributes'][_0x4ae3('0x47')]?_0x363bba[_0x4ae3('0x46')]:_0x531cea[_0x4ae3('0x40')];if(!_0x2049d8[_0x4ae3('0x45')][_0x4ae3('0x48')](_0x4ae3('0x49'))){_0x363bba['limit']=qs[_0x4ae3('0x2e')](_0x2049d8['query'][_0x4ae3('0x2e')]);_0x363bba['offset']=qs[_0x4ae3('0x2d')](_0x2049d8[_0x4ae3('0x45')]['offset']);}_0x363bba['order']=qs['sort'](_0x2049d8[_0x4ae3('0x45')][_0x4ae3('0x4a')]);_0x363bba[_0x4ae3('0x4b')]=qs[_0x4ae3('0x42')](_[_0x4ae3('0x4c')](_0x2049d8[_0x4ae3('0x45')],_0x531cea[_0x4ae3('0x42')]),_0x5d61a3);if(_0x2049d8[_0x4ae3('0x45')][_0x4ae3('0x4d')]){_0x363bba[_0x4ae3('0x4b')]=_[_0x4ae3('0x4e')](_0x363bba['where'],{'$or':_[_0x4ae3('0x3b')](_0x5d61a3,function(_0x37466f){if(_0x37466f[_0x4ae3('0x3e')]!==_0x4ae3('0x4f')){var _0xb1377={};_0xb1377[_0x37466f[_0x4ae3('0x38')]]={'$like':'%'+_0x2049d8[_0x4ae3('0x45')][_0x4ae3('0x4d')]+'%'};return _0xb1377;}})});}_0x363bba=_[_0x4ae3('0x4e')]({},_0x363bba,_0x2049d8[_0x4ae3('0x50')]);var _0xe5e3ce={'where':_0x363bba[_0x4ae3('0x4b')]};return db[_0x4ae3('0x3c')][_0x4ae3('0x2c')](_0xe5e3ce)[_0x4ae3('0x34')](function(_0xf7ce81){_0x167db6['count']=_0xf7ce81;if(_0x2049d8['query']['includeAll']){_0x363bba[_0x4ae3('0x51')]=[{'all':!![]}];}return db['ChatMessage'][_0x4ae3('0x52')](_0x363bba);})[_0x4ae3('0x34')](function(_0x2aeed2){_0x167db6[_0x4ae3('0x53')]=_0x2aeed2;return _0x167db6;})['then'](respondWithFilteredResult(_0x41b64b,_0x363bba))['catch'](handleError(_0x41b64b,null));};exports[_0x4ae3('0x54')]=function(_0x25ac51,_0x49eb5f){var _0x2c9a37={'raw':!![],'where':{'id':_0x25ac51[_0x4ae3('0x55')]['id']}},_0x2d00b4={};_0x2d00b4[_0x4ae3('0x40')]=_[_0x4ae3('0x41')](db[_0x4ae3('0x3c')][_0x4ae3('0x3d')]);_0x2d00b4['query']=_['keys'](_0x25ac51[_0x4ae3('0x45')]);_0x2d00b4[_0x4ae3('0x42')]=_['intersection'](_0x2d00b4[_0x4ae3('0x40')],_0x2d00b4[_0x4ae3('0x45')]);_0x2c9a37[_0x4ae3('0x46')]=_['intersection'](_0x2d00b4[_0x4ae3('0x40')],qs[_0x4ae3('0x44')](_0x25ac51['query'][_0x4ae3('0x44')]));_0x2c9a37[_0x4ae3('0x46')]=_0x2c9a37[_0x4ae3('0x46')][_0x4ae3('0x47')]?_0x2c9a37[_0x4ae3('0x46')]:_0x2d00b4['model'];if(_0x25ac51[_0x4ae3('0x45')][_0x4ae3('0x56')]){_0x2c9a37[_0x4ae3('0x51')]=[{'all':!![]}];}_0x2c9a37=_[_0x4ae3('0x4e')]({},_0x2c9a37,_0x25ac51[_0x4ae3('0x50')]);return db[_0x4ae3('0x3c')][_0x4ae3('0x57')](_0x2c9a37)[_0x4ae3('0x34')](handleEntityNotFound(_0x49eb5f,null))['then'](respondWithResult(_0x49eb5f,null))[_0x4ae3('0x28')](handleError(_0x49eb5f,null));};exports[_0x4ae3('0x58')]=function(_0x2ac874,_0x53e9d6){return db[_0x4ae3('0x3c')][_0x4ae3('0x58')](_0x2ac874[_0x4ae3('0x59')],{})['then'](respondWithResult(_0x53e9d6,0xc9))[_0x4ae3('0x28')](handleError(_0x53e9d6,null));};exports[_0x4ae3('0x33')]=function(_0x23159e,_0x450bd3){if(_0x23159e[_0x4ae3('0x59')]['id']){delete _0x23159e[_0x4ae3('0x59')]['id'];}return db[_0x4ae3('0x3c')][_0x4ae3('0x57')]({'where':{'id':_0x23159e[_0x4ae3('0x55')]['id']}})[_0x4ae3('0x34')](handleEntityNotFound(_0x450bd3,null))[_0x4ae3('0x34')](saveUpdates(_0x23159e[_0x4ae3('0x59')],null))[_0x4ae3('0x34')](respondWithResult(_0x450bd3,null))[_0x4ae3('0x28')](handleError(_0x450bd3,null));};exports[_0x4ae3('0x5a')]=function(_0x3bd136,_0x7f1f35){return db[_0x4ae3('0x3c')][_0x4ae3('0x57')]({'where':{'id':_0x3bd136['params']['id']}})[_0x4ae3('0x34')](handleEntityNotFound(_0x7f1f35,null))['then'](removeEntity(_0x7f1f35,null))[_0x4ae3('0x28')](handleError(_0x7f1f35,null));};exports[_0x4ae3('0x5b')]=function(_0x529b56,_0x20f1f2){return db[_0x4ae3('0x3c')][_0x4ae3('0x5b')]()[_0x4ae3('0x34')](respondWithResult(_0x20f1f2,null))[_0x4ae3('0x28')](handleError(_0x20f1f2,null));};var interaction_log=require(_0x4ae3('0x5c'))(_0x4ae3('0x5d'));exports[_0x4ae3('0x5e')]=function(_0x30dea3,_0x22c7cf,_0x2d4599){var _0x5f277b={'agent':{},'channel':_0x4ae3('0x5f')};if(_0x30dea3[_0x4ae3('0x59')]['id']){delete _0x30dea3[_0x4ae3('0x59')]['id'];}_0x30dea3[_0x4ae3('0x59')][_0x4ae3('0x60')]=!![];_0x30dea3[_0x4ae3('0x59')][_0x4ae3('0x61')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x30dea3[_0x4ae3('0x59')][_0x4ae3('0x62')]=_0x30dea3[_0x4ae3('0x59')][_0x4ae3('0x62')]||_0x30dea3[_0x4ae3('0x63')]['id'];_0x5f277b[_0x4ae3('0x64')]['id']=_0x30dea3[_0x4ae3('0x59')][_0x4ae3('0x62')];return db['ChatMessage'][_0x4ae3('0x57')]({'where':{'id':_0x30dea3['params']['id'],'UserId':null}})[_0x4ae3('0x34')](handleEntityNotFound(_0x22c7cf,null))[_0x4ae3('0x34')](saveUpdates(_0x30dea3[_0x4ae3('0x59')],null))['then'](function(_0x37fece){if(_0x37fece){_0x5f277b[_0x4ae3('0x26')]=_0x37fece[_0x4ae3('0x65')]({'plain':!![]});return db[_0x4ae3('0x66')]['find']({'where':{'id':_0x37fece[_0x4ae3('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x22c7cf,null))[_0x4ae3('0x34')](function(_0xdc42d1){if(_0xdc42d1){return _0xdc42d1['update']({'UserId':_0x30dea3[_0x4ae3('0x59')][_0x4ae3('0x62')],'read1stAt':_['isNil'](_0xdc42d1[_0x4ae3('0x68')])?moment()['format'](_0x4ae3('0x69')):undefined});}return null;})[_0x4ae3('0x34')](function(_0x2048f9){if(_0x2048f9){_0x5f277b[_0x4ae3('0x6a')]=_0x2048f9['get']({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x30dea3['user']['id'],_0x30dea3[_0x4ae3('0x63')][_0x4ae3('0x38')],_0x30dea3[_0x4ae3('0x63')][_0x4ae3('0x6b')],_0x5f277b['interaction']['id'],_0x30dea3[_0x4ae3('0x59')]?JSON[_0x4ae3('0x24')](_0x30dea3['body']):'null');return respondWithRpcPromise(_0x4ae3('0x6c'),_0x4ae3('0x6d'),_0x5f277b);}return null;})[_0x4ae3('0x34')](function(_0x2fa4cf){var _0x42e636=_0x4ae3('0x6e')+_0x2fa4cf[_0x4ae3('0x26')][_0x4ae3('0x6f')];return db[_0x4ae3('0x70')][_0x4ae3('0x45')](_0x42e636,{'type':db[_0x4ae3('0x71')][_0x4ae3('0x72')][_0x4ae3('0x73')],'raw':!![]})[_0x4ae3('0x34')](function(_0x33529c){return _0x33529c;});})[_0x4ae3('0x34')](function(_0x3491b4){if(_0x3491b4){_0x5f277b[_0x4ae3('0x26')]['contact']=_0x3491b4[0x0];if(!_0x30dea3[_0x4ae3('0x59')][_0x4ae3('0x62')])return;return db[_0x4ae3('0x74')]['find']({'where':{'id':_0x30dea3[_0x4ae3('0x59')]['UserId'],'role':_0x4ae3('0x64')},'attributes':['id',_0x4ae3('0x38'),_0x4ae3('0x75'),_0x4ae3('0x76'),_0x4ae3('0x77')],'raw':!![]});}return null;})[_0x4ae3('0x34')](function(_0x67eb75){if(!_0x67eb75)return null;_0x5f277b[_0x4ae3('0x26')][_0x4ae3('0x64')]=_0x67eb75;return _0x5f277b;})['then'](function(_0x26ddf0){if(_0x26ddf0){if(_0x30dea3[_0x4ae3('0x59')][_0x4ae3('0x78')]){_0x5f277b['message'][_0x4ae3('0x79')]=util[_0x4ae3('0x7a')](_0x4ae3('0x7b'),_0x30dea3['user'][_0x4ae3('0x38')]);_0x5f277b[_0x4ae3('0x26')]['channel']=_0x5f277b[_0x4ae3('0x7c')];_0x5f277b['message'][_0x4ae3('0x7d')]=_0x5f277b[_0x4ae3('0x7c')];_0x5f277b[_0x4ae3('0x26')][_0x4ae3('0x7e')]=_0x4ae3('0x5e');return respondWithRpcPromise(_0x4ae3('0x7f'),_0x4ae3('0x7f'),{'event':_0x4ae3('0x80'),'message':_[_0x4ae3('0x4e')](_0x5f277b[_0x4ae3('0x26')],JSON[_0x4ae3('0x81')](_0x5f277b[_0x4ae3('0x6a')][_0x4ae3('0x82')]))},client9002)['then'](function(){return _0x5f277b;});}return _0x5f277b;}return null;})['then'](respondWithResult(_0x22c7cf,null))[_0x4ae3('0x28')](handleError(_0x22c7cf,null));};var interaction_log=require(_0x4ae3('0x5c'))(_0x4ae3('0x5d'));exports['reject']=function(_0x49920a,_0x875762,_0x34bdcc){var _0x3ee91a={'agent':{},'channel':_0x4ae3('0x5f')};if(_0x49920a[_0x4ae3('0x59')]['id']){delete _0x49920a[_0x4ae3('0x59')]['id'];}_0x49920a[_0x4ae3('0x59')][_0x4ae3('0x62')]=_0x49920a['body'][_0x4ae3('0x62')]||_0x49920a['user']['id'];_0x3ee91a[_0x4ae3('0x64')]['id']=_0x49920a[_0x4ae3('0x59')]['UserId'];return db[_0x4ae3('0x3c')][_0x4ae3('0x57')]({'where':{'id':_0x49920a[_0x4ae3('0x55')]['id'],'UserId':null}})[_0x4ae3('0x34')](handleEntityNotFound(_0x875762,null))[_0x4ae3('0x34')](function(_0x16344a){if(_0x16344a){_0x3ee91a[_0x4ae3('0x26')]=_0x16344a['get']({'plain':!![]});return db[_0x4ae3('0x66')][_0x4ae3('0x57')]({'where':{'id':_0x16344a[_0x4ae3('0x67')]}});}return null;})[_0x4ae3('0x34')](handleEntityNotFound(_0x875762,null))['then'](function(_0x41ab4f){if(_0x41ab4f){_0x3ee91a[_0x4ae3('0x6a')]=_0x41ab4f[_0x4ae3('0x65')]({'plain':!![]});interaction_log[_0x4ae3('0x21')](_0x4ae3('0x83'),_0x49920a[_0x4ae3('0x63')]['id'],_0x49920a[_0x4ae3('0x63')][_0x4ae3('0x38')],_0x49920a[_0x4ae3('0x63')][_0x4ae3('0x6b')],_0x3ee91a[_0x4ae3('0x6a')]['id'],_0x49920a[_0x4ae3('0x59')]?JSON['stringify'](_0x49920a[_0x4ae3('0x59')]):_0x4ae3('0x84'));return respondWithRpcPromise('RejectMessage',_0x4ae3('0x85'),_0x3ee91a);}return null;})[_0x4ae3('0x34')](function(_0x594fa1){var _0x4c5db7=_0x4ae3('0x6e')+_0x594fa1[_0x4ae3('0x26')][_0x4ae3('0x6f')];return db['sequelize'][_0x4ae3('0x45')](_0x4c5db7,{'type':db['Sequelize'][_0x4ae3('0x72')][_0x4ae3('0x73')],'raw':!![]})[_0x4ae3('0x34')](function(_0x3a9ddf){return _0x3a9ddf;});})[_0x4ae3('0x34')](function(_0x2315c6){if(_0x2315c6){_0x3ee91a[_0x4ae3('0x26')][_0x4ae3('0x86')]=_0x2315c6[0x0];if(!_0x49920a[_0x4ae3('0x59')][_0x4ae3('0x62')])return;return db[_0x4ae3('0x74')][_0x4ae3('0x57')]({'where':{'id':_0x49920a[_0x4ae3('0x59')]['UserId'],'role':_0x4ae3('0x64')},'attributes':['id',_0x4ae3('0x38'),_0x4ae3('0x75'),_0x4ae3('0x76'),_0x4ae3('0x77')],'raw':!![]});}return null;})[_0x4ae3('0x34')](function(_0x1eea37){if(!_0x1eea37)return null;_0x3ee91a[_0x4ae3('0x26')][_0x4ae3('0x64')]=_0x1eea37;return _0x3ee91a;})['then'](function(_0x2c1718){if(_0x2c1718){_0x2c1718[_0x4ae3('0x26')][_0x4ae3('0x79')]=util[_0x4ae3('0x7a')]('SIP/%s',_0x49920a[_0x4ae3('0x63')]['name']);_0x2c1718[_0x4ae3('0x26')][_0x4ae3('0x7c')]=_0x3ee91a[_0x4ae3('0x7c')];_0x2c1718[_0x4ae3('0x26')][_0x4ae3('0x7d')]=_0x3ee91a['channel'];_0x2c1718[_0x4ae3('0x26')][_0x4ae3('0x7e')]=_0x4ae3('0x32');respondWithRpcPromise(_0x4ae3('0x7f'),_0x4ae3('0x7f'),{'event':_0x4ae3('0x87'),'message':_[_0x4ae3('0x4e')](_0x3ee91a[_0x4ae3('0x26')],JSON[_0x4ae3('0x81')](_0x3ee91a['interaction'][_0x4ae3('0x82')]))},client9002);return _0x3ee91a;}return null;})['then'](respondWithResult(_0x875762,null))[_0x4ae3('0x28')](handleError(_0x875762,null));}; \ No newline at end of file +var _0xd4a0=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','undefined','count','limit','set','Content-Range','save','update','end','name','send','index','map','ChatMessage','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','create','body','find','params','describe','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','User','manual','channel','motionChannel','event','EventManager','acceptmessage','merge','parse','interaction','chat-interactions','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','QueryTypes','contact','fullname','email','internal','interface','formData'];(function(_0x1f61b1,_0x354916){var _0x10e5a8=function(_0x4cef18){while(--_0x4cef18){_0x1f61b1['push'](_0x1f61b1['shift']());}};_0x10e5a8(++_0x354916);}(_0xd4a0,0x82));var _0x0d4a=function(_0x4beaa7,_0xb8da5d){_0x4beaa7=_0x4beaa7-0x0;var _0x277369=_0xd4a0[_0x4beaa7];return _0x277369;};'use strict';var emlformat=require(_0x0d4a('0x0'));var rimraf=require(_0x0d4a('0x1'));var zipdir=require(_0x0d4a('0x2'));var jsonpatch=require(_0x0d4a('0x3'));var rp=require(_0x0d4a('0x4'));var moment=require(_0x0d4a('0x5'));var BPromise=require(_0x0d4a('0x6'));var Mustache=require(_0x0d4a('0x7'));var util=require(_0x0d4a('0x8'));var path=require(_0x0d4a('0x9'));var sox=require('sox');var csv=require(_0x0d4a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0d4a('0xb'));var squel=require('squel');var crypto=require(_0x0d4a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0d4a('0xd'));var toCsv=require(_0x0d4a('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0d4a('0xe'));var authService=require(_0x0d4a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0d4a('0x10'));var hardwareService=require(_0x0d4a('0x11'));var logger=require(_0x0d4a('0x12'))('api');var utils=require(_0x0d4a('0x13'));var config=require(_0x0d4a('0x14'));var licenseUtil=require(_0x0d4a('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0d4a('0x16')](config[_0x0d4a('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x0d4a('0x18'))(new Redis(config[_0x0d4a('0x17')]));require('./chatMessage.socket')[_0x0d4a('0x19')](socket);var jayson=require(_0x0d4a('0x1a'));var client=jayson[_0x0d4a('0x1b')][_0x0d4a('0x1c')]({'port':0x232c});var client9002=jayson[_0x0d4a('0x1b')][_0x0d4a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xb313c3,_0x28dc4d,_0x4f408f,_0x4eb8ca){return new BPromise(function(_0x369b8e,_0x3962b2){var _0x4a2b2f=_0x4eb8ca||client;return _0x4a2b2f[_0x0d4a('0x1d')](_0xb313c3,_0x4f408f)[_0x0d4a('0x1e')](function(_0x2a0ddc){logger[_0x0d4a('0x1f')](_0x0d4a('0x20'),_0x28dc4d,_0x0d4a('0x21'));logger['debug'](_0x0d4a('0x22'),_0x28dc4d,_0x0d4a('0x21'),JSON[_0x0d4a('0x23')](_0x2a0ddc));if(_0x2a0ddc[_0x0d4a('0x24')]){if(_0x2a0ddc[_0x0d4a('0x24')][_0x0d4a('0x25')]===0x1f4){logger[_0x0d4a('0x24')](_0x0d4a('0x20'),_0x28dc4d,_0x2a0ddc['error']['message']);return _0x3962b2(_0x2a0ddc[_0x0d4a('0x24')][_0x0d4a('0x26')]);}logger['error'](_0x0d4a('0x20'),_0x28dc4d,_0x2a0ddc[_0x0d4a('0x24')][_0x0d4a('0x26')]);return _0x369b8e(_0x2a0ddc['error'][_0x0d4a('0x26')]);}else{logger[_0x0d4a('0x1f')](_0x0d4a('0x20'),_0x28dc4d,'request\x20sent');_0x369b8e(_0x2a0ddc['result'][_0x0d4a('0x26')]);}})[_0x0d4a('0x27')](function(_0x243ea8){logger[_0x0d4a('0x24')](_0x0d4a('0x20'),_0x28dc4d,_0x243ea8);_0x3962b2(_0x243ea8);});});}function respondWithStatusCode(_0x5f0200,_0x41f750){_0x41f750=_0x41f750||0xcc;return function(_0x457406){if(_0x457406){return _0x5f0200[_0x0d4a('0x28')](_0x41f750);}return _0x5f0200[_0x0d4a('0x29')](_0x41f750)['end']();};}function respondWithResult(_0x54e512,_0x1c0a41){_0x1c0a41=_0x1c0a41||0xc8;return function(_0x28d4c8){if(_0x28d4c8){return _0x54e512['status'](_0x1c0a41)['json'](_0x28d4c8);}};}function respondWithFilteredResult(_0xd48b5,_0x35719d){return function(_0x464c9b){if(_0x464c9b){var _0x40f5f2=typeof _0x35719d['offset']==='undefined'&&typeof _0x35719d['limit']===_0x0d4a('0x2a');var _0x2339e9=_0x464c9b[_0x0d4a('0x2b')];var _0x8b47a=_0x40f5f2?0x0:_0x35719d['offset'];var _0x277998=_0x40f5f2?_0x464c9b[_0x0d4a('0x2b')]:_0x35719d['offset']+_0x35719d[_0x0d4a('0x2c')];var _0x36f868;if(_0x277998>=_0x2339e9){_0x277998=_0x2339e9;_0x36f868=0xc8;}else{_0x36f868=0xce;}_0xd48b5[_0x0d4a('0x29')](_0x36f868);return _0xd48b5[_0x0d4a('0x2d')](_0x0d4a('0x2e'),_0x8b47a+'-'+_0x277998+'/'+_0x2339e9)['json'](_0x464c9b);}return null;};}function patchUpdates(_0x492c9d){return function(_0x18bfe7){try{jsonpatch['apply'](_0x18bfe7,_0x492c9d,!![]);}catch(_0x23fd6c){return BPromise['reject'](_0x23fd6c);}return _0x18bfe7[_0x0d4a('0x2f')]();};}function saveUpdates(_0x2558e0,_0x320b6d){return function(_0x2b82a5){if(_0x2b82a5){return _0x2b82a5[_0x0d4a('0x30')](_0x2558e0)[_0x0d4a('0x1e')](function(_0x5e53e4){return _0x5e53e4;});}return null;};}function removeEntity(_0x5c30fe,_0x21c21e){return function(_0xe275dd){if(_0xe275dd){return _0xe275dd['destroy']()[_0x0d4a('0x1e')](function(){_0x5c30fe['status'](0xcc)[_0x0d4a('0x31')]();});}};}function handleEntityNotFound(_0x535753,_0x3ea136){return function(_0x52c4de){if(!_0x52c4de){_0x535753[_0x0d4a('0x28')](0x194);}return _0x52c4de;};}function handleError(_0x674554,_0x1255ba){_0x1255ba=_0x1255ba||0x1f4;return function(_0x1e0579){logger['error'](_0x1e0579['stack']);if(_0x1e0579[_0x0d4a('0x32')]){delete _0x1e0579[_0x0d4a('0x32')];}_0x674554[_0x0d4a('0x29')](_0x1255ba)[_0x0d4a('0x33')](_0x1e0579);};}exports[_0x0d4a('0x34')]=function(_0x3cc75f,_0x45de9b){var _0x3912e3={},_0x1f58a7={},_0x4ae409={'count':0x0,'rows':[]};var _0x512419=_[_0x0d4a('0x35')](db[_0x0d4a('0x36')]['rawAttributes'],function(_0x31da36){return{'name':_0x31da36['fieldName'],'type':_0x31da36[_0x0d4a('0x37')][_0x0d4a('0x38')]};});_0x1f58a7[_0x0d4a('0x39')]=_[_0x0d4a('0x35')](_0x512419,'name');_0x1f58a7[_0x0d4a('0x3a')]=_[_0x0d4a('0x3b')](_0x3cc75f[_0x0d4a('0x3a')]);_0x1f58a7[_0x0d4a('0x3c')]=_[_0x0d4a('0x3d')](_0x1f58a7[_0x0d4a('0x39')],_0x1f58a7[_0x0d4a('0x3a')]);_0x3912e3[_0x0d4a('0x3e')]=_[_0x0d4a('0x3d')](_0x1f58a7['model'],qs[_0x0d4a('0x3f')](_0x3cc75f['query'][_0x0d4a('0x3f')]));_0x3912e3[_0x0d4a('0x3e')]=_0x3912e3['attributes'][_0x0d4a('0x40')]?_0x3912e3['attributes']:_0x1f58a7[_0x0d4a('0x39')];if(!_0x3cc75f[_0x0d4a('0x3a')][_0x0d4a('0x41')](_0x0d4a('0x42'))){_0x3912e3[_0x0d4a('0x2c')]=qs[_0x0d4a('0x2c')](_0x3cc75f['query']['limit']);_0x3912e3[_0x0d4a('0x43')]=qs[_0x0d4a('0x43')](_0x3cc75f[_0x0d4a('0x3a')][_0x0d4a('0x43')]);}_0x3912e3[_0x0d4a('0x44')]=qs[_0x0d4a('0x45')](_0x3cc75f['query'][_0x0d4a('0x45')]);_0x3912e3[_0x0d4a('0x46')]=qs[_0x0d4a('0x3c')](_[_0x0d4a('0x47')](_0x3cc75f['query'],_0x1f58a7['filters']),_0x512419);if(_0x3cc75f[_0x0d4a('0x3a')][_0x0d4a('0x48')]){_0x3912e3['where']=_['merge'](_0x3912e3['where'],{'$or':_['map'](_0x512419,function(_0x38d080){if(_0x38d080[_0x0d4a('0x37')]!==_0x0d4a('0x49')){var _0x5bdbf1={};_0x5bdbf1[_0x38d080['name']]={'$like':'%'+_0x3cc75f['query'][_0x0d4a('0x48')]+'%'};return _0x5bdbf1;}})});}_0x3912e3=_['merge']({},_0x3912e3,_0x3cc75f[_0x0d4a('0x4a')]);var _0x44eee4={'where':_0x3912e3['where']};return db[_0x0d4a('0x36')][_0x0d4a('0x2b')](_0x44eee4)[_0x0d4a('0x1e')](function(_0x26e3cf){_0x4ae409['count']=_0x26e3cf;if(_0x3cc75f[_0x0d4a('0x3a')][_0x0d4a('0x4b')]){_0x3912e3[_0x0d4a('0x4c')]=[{'all':!![]}];}return db['ChatMessage'][_0x0d4a('0x4d')](_0x3912e3);})[_0x0d4a('0x1e')](function(_0x266a7c){_0x4ae409[_0x0d4a('0x4e')]=_0x266a7c;return _0x4ae409;})[_0x0d4a('0x1e')](respondWithFilteredResult(_0x45de9b,_0x3912e3))[_0x0d4a('0x27')](handleError(_0x45de9b,null));};exports[_0x0d4a('0x4f')]=function(_0x45675b,_0xdffe03){var _0x573e98={'raw':!![],'where':{'id':_0x45675b['params']['id']}},_0x3c9060={};_0x3c9060['model']=_['keys'](db[_0x0d4a('0x36')][_0x0d4a('0x50')]);_0x3c9060['query']=_[_0x0d4a('0x3b')](_0x45675b[_0x0d4a('0x3a')]);_0x3c9060[_0x0d4a('0x3c')]=_['intersection'](_0x3c9060[_0x0d4a('0x39')],_0x3c9060[_0x0d4a('0x3a')]);_0x573e98['attributes']=_[_0x0d4a('0x3d')](_0x3c9060[_0x0d4a('0x39')],qs['fields'](_0x45675b[_0x0d4a('0x3a')]['fields']));_0x573e98['attributes']=_0x573e98[_0x0d4a('0x3e')][_0x0d4a('0x40')]?_0x573e98[_0x0d4a('0x3e')]:_0x3c9060['model'];if(_0x45675b[_0x0d4a('0x3a')][_0x0d4a('0x4b')]){_0x573e98[_0x0d4a('0x4c')]=[{'all':!![]}];}_0x573e98=_['merge']({},_0x573e98,_0x45675b[_0x0d4a('0x4a')]);return db[_0x0d4a('0x36')]['find'](_0x573e98)[_0x0d4a('0x1e')](handleEntityNotFound(_0xdffe03,null))[_0x0d4a('0x1e')](respondWithResult(_0xdffe03,null))['catch'](handleError(_0xdffe03,null));};exports[_0x0d4a('0x51')]=function(_0x345a57,_0xe56bd4){return db[_0x0d4a('0x36')][_0x0d4a('0x51')](_0x345a57[_0x0d4a('0x52')],{})[_0x0d4a('0x1e')](respondWithResult(_0xe56bd4,0xc9))[_0x0d4a('0x27')](handleError(_0xe56bd4,null));};exports[_0x0d4a('0x30')]=function(_0x3aea0c,_0x449ec0){if(_0x3aea0c[_0x0d4a('0x52')]['id']){delete _0x3aea0c[_0x0d4a('0x52')]['id'];}return db[_0x0d4a('0x36')]['find']({'where':{'id':_0x3aea0c['params']['id']}})['then'](handleEntityNotFound(_0x449ec0,null))[_0x0d4a('0x1e')](saveUpdates(_0x3aea0c[_0x0d4a('0x52')],null))[_0x0d4a('0x1e')](respondWithResult(_0x449ec0,null))[_0x0d4a('0x27')](handleError(_0x449ec0,null));};exports['destroy']=function(_0x14f741,_0x225fa1){return db[_0x0d4a('0x36')][_0x0d4a('0x53')]({'where':{'id':_0x14f741[_0x0d4a('0x54')]['id']}})[_0x0d4a('0x1e')](handleEntityNotFound(_0x225fa1,null))[_0x0d4a('0x1e')](removeEntity(_0x225fa1,null))['catch'](handleError(_0x225fa1,null));};exports[_0x0d4a('0x55')]=function(_0x4c163a,_0x1ff5e8){return db[_0x0d4a('0x36')]['describe']()[_0x0d4a('0x1e')](respondWithResult(_0x1ff5e8,null))[_0x0d4a('0x27')](handleError(_0x1ff5e8,null));};var interaction_log=require(_0x0d4a('0x12'))('chat-interactions');exports[_0x0d4a('0x56')]=function(_0x53a584,_0x1dc621,_0xe50a6){var _0x260a17={'agent':{},'channel':_0x0d4a('0x57')};if(_0x53a584[_0x0d4a('0x52')]['id']){delete _0x53a584['body']['id'];}_0x53a584[_0x0d4a('0x52')][_0x0d4a('0x58')]=!![];_0x53a584['body'][_0x0d4a('0x59')]=moment()[_0x0d4a('0x5a')](_0x0d4a('0x5b'));_0x53a584[_0x0d4a('0x52')]['UserId']=_0x53a584[_0x0d4a('0x52')][_0x0d4a('0x5c')]||_0x53a584[_0x0d4a('0x5d')]['id'];_0x260a17[_0x0d4a('0x5e')]['id']=_0x53a584[_0x0d4a('0x52')][_0x0d4a('0x5c')];return db[_0x0d4a('0x36')][_0x0d4a('0x53')]({'where':{'id':_0x53a584[_0x0d4a('0x54')]['id'],'UserId':null}})[_0x0d4a('0x1e')](handleEntityNotFound(_0x1dc621,null))['then'](saveUpdates(_0x53a584[_0x0d4a('0x52')],null))[_0x0d4a('0x1e')](function(_0x2dfa2b){if(_0x2dfa2b){_0x260a17[_0x0d4a('0x26')]=_0x2dfa2b[_0x0d4a('0x5f')]({'plain':!![]});return db[_0x0d4a('0x60')][_0x0d4a('0x53')]({'where':{'id':_0x2dfa2b[_0x0d4a('0x61')]}});}return null;})[_0x0d4a('0x1e')](handleEntityNotFound(_0x1dc621,null))[_0x0d4a('0x1e')](function(_0x149d1f){if(_0x149d1f){return _0x149d1f[_0x0d4a('0x30')]({'UserId':_0x53a584[_0x0d4a('0x52')]['UserId'],'read1stAt':_[_0x0d4a('0x62')](_0x149d1f[_0x0d4a('0x63')])?moment()[_0x0d4a('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x895bbd){if(_0x895bbd){_0x260a17['interaction']=_0x895bbd['get']({'plain':!![]});interaction_log[_0x0d4a('0x1f')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x53a584['user']['id'],_0x53a584[_0x0d4a('0x5d')][_0x0d4a('0x32')],_0x53a584[_0x0d4a('0x5d')][_0x0d4a('0x64')],_0x260a17['interaction']['id'],_0x53a584[_0x0d4a('0x52')]?JSON[_0x0d4a('0x23')](_0x53a584[_0x0d4a('0x52')]):_0x0d4a('0x65'));return respondWithRpcPromise('AcceptMessage',_0x0d4a('0x66'),_0x260a17);}return null;})['then'](function(_0x5191ed){var _0x7102ac=_0x0d4a('0x67')+_0x5191ed['message'][_0x0d4a('0x68')];return db['sequelize'][_0x0d4a('0x3a')](_0x7102ac,{'type':db[_0x0d4a('0x69')]['QueryTypes'][_0x0d4a('0x6a')],'raw':!![]})[_0x0d4a('0x1e')](function(_0x1826ce){return _0x1826ce;});})[_0x0d4a('0x1e')](function(_0x54ba05){if(_0x54ba05){_0x260a17[_0x0d4a('0x26')]['contact']=_0x54ba05[0x0];if(!_0x53a584[_0x0d4a('0x52')][_0x0d4a('0x5c')])return;return db[_0x0d4a('0x6b')]['find']({'where':{'id':_0x53a584[_0x0d4a('0x52')][_0x0d4a('0x5c')],'role':'agent'},'attributes':['id',_0x0d4a('0x32'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x0d4a('0x1e')](function(_0x1dea88){if(!_0x1dea88)return null;_0x260a17[_0x0d4a('0x26')]['agent']=_0x1dea88;return _0x260a17;})[_0x0d4a('0x1e')](function(_0x5cba3e){if(_0x5cba3e){if(_0x53a584[_0x0d4a('0x52')][_0x0d4a('0x6c')]){_0x260a17[_0x0d4a('0x26')]['interface']=util['format']('SIP/%s',_0x53a584['user'][_0x0d4a('0x32')]);_0x260a17[_0x0d4a('0x26')][_0x0d4a('0x6d')]=_0x260a17[_0x0d4a('0x6d')];_0x260a17[_0x0d4a('0x26')][_0x0d4a('0x6e')]=_0x260a17[_0x0d4a('0x6d')];_0x260a17['message'][_0x0d4a('0x6f')]='accept';return respondWithRpcPromise(_0x0d4a('0x70'),'EventManager',{'event':_0x0d4a('0x71'),'message':_[_0x0d4a('0x72')](_0x260a17['message'],JSON[_0x0d4a('0x73')](_0x260a17[_0x0d4a('0x74')]['formData']))},client9002)[_0x0d4a('0x1e')](function(){return _0x260a17;});}return _0x260a17;}return null;})[_0x0d4a('0x1e')](respondWithResult(_0x1dc621,null))[_0x0d4a('0x27')](handleError(_0x1dc621,null));};var interaction_log=require(_0x0d4a('0x12'))(_0x0d4a('0x75'));exports[_0x0d4a('0x76')]=function(_0x5de208,_0x178234,_0x4faef8){var _0x463a8b={'agent':{},'channel':_0x0d4a('0x57')};if(_0x5de208[_0x0d4a('0x52')]['id']){delete _0x5de208[_0x0d4a('0x52')]['id'];}_0x5de208[_0x0d4a('0x52')][_0x0d4a('0x5c')]=_0x5de208['body'][_0x0d4a('0x5c')]||_0x5de208[_0x0d4a('0x5d')]['id'];_0x463a8b[_0x0d4a('0x5e')]['id']=_0x5de208['body'][_0x0d4a('0x5c')];return db[_0x0d4a('0x36')][_0x0d4a('0x53')]({'where':{'id':_0x5de208[_0x0d4a('0x54')]['id'],'UserId':null}})[_0x0d4a('0x1e')](handleEntityNotFound(_0x178234,null))[_0x0d4a('0x1e')](function(_0x27a548){if(_0x27a548){_0x463a8b[_0x0d4a('0x26')]=_0x27a548[_0x0d4a('0x5f')]({'plain':!![]});return db[_0x0d4a('0x60')][_0x0d4a('0x53')]({'where':{'id':_0x27a548[_0x0d4a('0x61')]}});}return null;})[_0x0d4a('0x1e')](handleEntityNotFound(_0x178234,null))[_0x0d4a('0x1e')](function(_0x37066a){if(_0x37066a){_0x463a8b[_0x0d4a('0x74')]=_0x37066a[_0x0d4a('0x5f')]({'plain':!![]});interaction_log[_0x0d4a('0x1f')](_0x0d4a('0x77'),_0x5de208['user']['id'],_0x5de208['user'][_0x0d4a('0x32')],_0x5de208['user'][_0x0d4a('0x64')],_0x463a8b[_0x0d4a('0x74')]['id'],_0x5de208[_0x0d4a('0x52')]?JSON[_0x0d4a('0x23')](_0x5de208[_0x0d4a('0x52')]):_0x0d4a('0x65'));return respondWithRpcPromise(_0x0d4a('0x78'),_0x0d4a('0x79'),_0x463a8b);}return null;})[_0x0d4a('0x1e')](function(_0x527a5c){var _0x212de1=_0x0d4a('0x67')+_0x527a5c[_0x0d4a('0x26')]['ContactId'];return db[_0x0d4a('0x7a')][_0x0d4a('0x3a')](_0x212de1,{'type':db[_0x0d4a('0x69')][_0x0d4a('0x7b')][_0x0d4a('0x6a')],'raw':!![]})[_0x0d4a('0x1e')](function(_0x1e2b69){return _0x1e2b69;});})[_0x0d4a('0x1e')](function(_0x113575){if(_0x113575){_0x463a8b[_0x0d4a('0x26')][_0x0d4a('0x7c')]=_0x113575[0x0];if(!_0x5de208['body'][_0x0d4a('0x5c')])return;return db[_0x0d4a('0x6b')][_0x0d4a('0x53')]({'where':{'id':_0x5de208['body'][_0x0d4a('0x5c')],'role':'agent'},'attributes':['id','name',_0x0d4a('0x7d'),_0x0d4a('0x7e'),_0x0d4a('0x7f')],'raw':!![]});}return null;})[_0x0d4a('0x1e')](function(_0x172f0c){if(!_0x172f0c)return null;_0x463a8b['message'][_0x0d4a('0x5e')]=_0x172f0c;return _0x463a8b;})[_0x0d4a('0x1e')](function(_0x4a4fc1){if(_0x4a4fc1){_0x4a4fc1[_0x0d4a('0x26')][_0x0d4a('0x80')]=util[_0x0d4a('0x5a')]('SIP/%s',_0x5de208[_0x0d4a('0x5d')][_0x0d4a('0x32')]);_0x4a4fc1[_0x0d4a('0x26')]['channel']=_0x463a8b[_0x0d4a('0x6d')];_0x4a4fc1[_0x0d4a('0x26')][_0x0d4a('0x6e')]=_0x463a8b[_0x0d4a('0x6d')];_0x4a4fc1[_0x0d4a('0x26')][_0x0d4a('0x6f')]=_0x0d4a('0x76');respondWithRpcPromise('EventManager',_0x0d4a('0x70'),{'event':'rejectmessage','message':_['merge'](_0x463a8b[_0x0d4a('0x26')],JSON[_0x0d4a('0x73')](_0x463a8b[_0x0d4a('0x74')][_0x0d4a('0x81')]))},client9002);return _0x463a8b;}return null;})[_0x0d4a('0x1e')](respondWithResult(_0x178234,null))[_0x0d4a('0x27')](handleError(_0x178234,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index e36944f..7331999 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 _0x213b=['save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','ChatMessage'];(function(_0x4ea6af,_0x4aa32e){var _0x4cb1e6=function(_0xc9edd0){while(--_0xc9edd0){_0x4ea6af['push'](_0x4ea6af['shift']());}};_0x4cb1e6(++_0x4aa32e);}(_0x213b,0x1a6));var _0xb213=function(_0x49bd2d,_0x249bea){_0x49bd2d=_0x49bd2d-0x0;var _0x740d0b=_0x213b[_0x49bd2d];return _0x740d0b;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xb213('0x0'))['db'][_0xb213('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb213('0x2'),'afterUpdate':_0xb213('0x3'),'afterDestroy':_0xb213('0x4')};function emitEvent(_0xd891c5){return function(_0x352302,_0x54fdde,_0x3a43ab){ChatMessageEvents[_0xb213('0x5')](_0xd891c5+':'+_0x352302['id'],_0x352302);ChatMessageEvents[_0xb213('0x5')](_0xd891c5,_0x352302);_0x3a43ab(null);};}for(var e in events){if(events[_0xb213('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xb213('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0xa887=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4c6337,_0x341ce9){var _0x40cfb8=function(_0xf31763){while(--_0xf31763){_0x4c6337['push'](_0x4c6337['shift']());}};_0x40cfb8(++_0x341ce9);}(_0xa887,0xfc));var _0x7a88=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa887[_0x134c2e];return _0x2825db;};'use strict';var EventEmitter=require(_0x7a88('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x7a88('0x1')](0x0);var events={'afterCreate':_0x7a88('0x2'),'afterUpdate':_0x7a88('0x3'),'afterDestroy':_0x7a88('0x4')};function emitEvent(_0x3c7e54){return function(_0x2b4e55,_0x592280,_0x40da6b){ChatMessageEvents[_0x7a88('0x5')](_0x3c7e54+':'+_0x2b4e55['id'],_0x2b4e55);ChatMessageEvents[_0x7a88('0x5')](_0x3c7e54,_0x2b4e55);_0x40da6b(null);};}for(var e in events){if(events[_0x7a88('0x6')](e)){var event=events[e];ChatMessage[_0x7a88('0x7')](e,emitEvent(event));}}module[_0x7a88('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index e9a69fe..c25c77d 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 _0x3515=['exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','./chatMessage.attributes'];(function(_0x1f6112,_0x170dd9){var _0x1f696f=function(_0x191634){while(--_0x191634){_0x1f6112['push'](_0x1f6112['shift']());}};_0x1f696f(++_0x170dd9);}(_0x3515,0x1d9));var _0x5351=function(_0x468364,_0x1c9285){_0x468364=_0x468364-0x0;var _0x29efeb=_0x3515[_0x468364];return _0x29efeb;};'use strict';var _=require(_0x5351('0x0'));var util=require(_0x5351('0x1'));var logger=require(_0x5351('0x2'))('api');var moment=require(_0x5351('0x3'));var BPromise=require(_0x5351('0x4'));var rp=require(_0x5351('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5351('0x6'));module[_0x5351('0x7')]=function(_0x6ae49,_0x3973df){return _0x6ae49[_0x5351('0x8')](_0x5351('0x9'),attributes,{'tableName':_0x5351('0xa'),'paranoid':![],'indexes':[{'name':_0x5351('0xb'),'fields':[_0x5351('0xc')],'type':_0x5351('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3677c9,_0xdb7118,_0x1a05dd){var _0x4c70c3=_0x6ae49[_0x5351('0xe')];var _0xe4fc91=_0x3677c9['get']({'plain':!![]});if(_0xe4fc91[_0x5351('0xf')]['toLowerCase']()==='in'||_0xe4fc91[_0x5351('0xf')][_0x5351('0x10')]()===_0x5351('0x11')&&!_0xe4fc91[_0x5351('0x12')]&&!_[_0x5351('0x13')](_0xe4fc91[_0x5351('0x14')])){_0x4c70c3[_0x5351('0x15')][_0x5351('0x16')]({'where':{'id':_0xe4fc91[_0x5351('0x17')]}})[_0x5351('0x18')](function(_0xc0ad54){if(_0xc0ad54){_0xc0ad54['update']({'lastMsgAt':_0xe4fc91[_0x5351('0x19')],'lastMsgDirection':_0xe4fc91[_0x5351('0xf')][_0x5351('0x10')]()});}})[_0x5351('0x1a')](function(_0x29133b){console[_0x5351('0x1b')](_0x29133b);});}_0x1a05dd();}},'charset':_0x5351('0x1c'),'collate':_0x5351('0x1d')});}; \ No newline at end of file +var _0xab0a=['../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','secret','UserId','ChatInteraction','findOne','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x2c2f0b,_0x257bd8){var _0x3b137d=function(_0x4b60fb){while(--_0x4b60fb){_0x2c2f0b['push'](_0x2c2f0b['shift']());}};_0x3b137d(++_0x257bd8);}(_0xab0a,0x1f0));var _0xaab0=function(_0x2ebb21,_0x4bb59a){_0x2ebb21=_0x2ebb21-0x0;var _0x52302f=_0xab0a[_0x2ebb21];return _0x52302f;};'use strict';var _=require(_0xaab0('0x0'));var util=require(_0xaab0('0x1'));var logger=require(_0xaab0('0x2'))(_0xaab0('0x3'));var moment=require(_0xaab0('0x4'));var BPromise=require(_0xaab0('0x5'));var rp=require(_0xaab0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaab0('0x7'));var config=require(_0xaab0('0x8'));var attributes=require(_0xaab0('0x9'));module[_0xaab0('0xa')]=function(_0xc81bc0,_0xdf9a5){return _0xc81bc0[_0xaab0('0xb')](_0xaab0('0xc'),attributes,{'tableName':_0xaab0('0xd'),'paranoid':![],'indexes':[{'name':_0xaab0('0xe'),'fields':[_0xaab0('0xf')],'type':_0xaab0('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xeb5b3e,_0x5ac9f1,_0x1da1ad){var _0x88dbaa=_0xc81bc0[_0xaab0('0x11')];var _0x890c6a=_0xeb5b3e['get']({'plain':!![]});if(_0x890c6a[_0xaab0('0x12')]['toLowerCase']()==='in'||_0x890c6a[_0xaab0('0x12')]['toLowerCase']()==='out'&&!_0x890c6a[_0xaab0('0x13')]&&!_['isNil'](_0x890c6a[_0xaab0('0x14')])){_0x88dbaa[_0xaab0('0x15')][_0xaab0('0x16')]({'where':{'id':_0x890c6a['ChatInteractionId']}})['then'](function(_0x176ead){if(_0x176ead){_0x176ead[_0xaab0('0x17')]({'lastMsgAt':_0x890c6a[_0xaab0('0x18')],'lastMsgDirection':_0x890c6a[_0xaab0('0x12')]['toLowerCase']()});}})[_0xaab0('0x19')](function(_0x5780f4){console[_0xaab0('0x1a')](_0x5780f4);});}_0x1da1ad();}},'charset':_0xaab0('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 57a5f7e..34432aa 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 _0xc03c=['localhost','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatMessage','ChatMessage','create','body','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x548105,_0x42b075){var _0x14bf6a=function(_0x1972b6){while(--_0x1972b6){_0x548105['push'](_0x548105['shift']());}};_0x14bf6a(++_0x42b075);}(_0xc03c,0xae));var _0xcc03=function(_0xec034,_0x16c358){_0xec034=_0xec034-0x0;var _0x2c5a19=_0xc03c[_0xec034];return _0x2c5a19;};'use strict';var _=require(_0xcc03('0x0'));var util=require('util');var moment=require(_0xcc03('0x1'));var BPromise=require(_0xcc03('0x2'));var rs=require(_0xcc03('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc03('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc03('0x5'))(_0xcc03('0x6'));var config=require(_0xcc03('0x7'));var jayson=require(_0xcc03('0x8'));var client=jayson[_0xcc03('0x9')][_0xcc03('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xcc03('0xb')],{'host':_0xcc03('0xc'),'port':0x18eb});var socket=require(_0xcc03('0xd'))(new Redis(config[_0xcc03('0xb')]));require('./chatMessage.socket')[_0xcc03('0xe')](socket);function respondWithRpcPromise(_0x118b5b,_0x1d9aa2,_0x531544){return new BPromise(function(_0x196601,_0x4c51e1){return client[_0xcc03('0xf')](_0x118b5b,_0x531544)[_0xcc03('0x10')](function(_0x14d99e){logger[_0xcc03('0x11')](_0xcc03('0x12'),_0x1d9aa2,_0xcc03('0x13'));logger[_0xcc03('0x14')](_0xcc03('0x15'),_0x1d9aa2,'request\x20sent',JSON[_0xcc03('0x16')](_0x14d99e));if(_0x14d99e['error']){if(_0x14d99e[_0xcc03('0x17')]['code']===0x1f4){logger[_0xcc03('0x17')]('ChatMessage,\x20%s,\x20%s',_0x1d9aa2,_0x14d99e[_0xcc03('0x17')][_0xcc03('0x18')]);return _0x4c51e1(_0x14d99e[_0xcc03('0x17')][_0xcc03('0x18')]);}logger[_0xcc03('0x17')](_0xcc03('0x12'),_0x1d9aa2,_0x14d99e[_0xcc03('0x17')][_0xcc03('0x18')]);return _0x196601(_0x14d99e['error'][_0xcc03('0x18')]);}else{logger[_0xcc03('0x11')](_0xcc03('0x12'),_0x1d9aa2,_0xcc03('0x13'));_0x196601(_0x14d99e[_0xcc03('0x19')][_0xcc03('0x18')]);}})[_0xcc03('0x1a')](function(_0x41cf4a){logger['error'](_0xcc03('0x12'),_0x1d9aa2,_0x41cf4a);_0x4c51e1(_0x41cf4a);});});}exports[_0xcc03('0x1b')]=function(_0x5ed3d7){var _0x2ad5eb=this;return new Promise(function(_0x52faf7,_0x53ad01){return db[_0xcc03('0x1c')][_0xcc03('0x1d')](_0x5ed3d7[_0xcc03('0x1e')],{'raw':_0x5ed3d7['options']?_0x5ed3d7['options']['raw']===undefined?!![]:![]:!![]})[_0xcc03('0x10')](function(_0x32c93d){logger[_0xcc03('0x11')](_0xcc03('0x1b'),_0x5ed3d7);logger[_0xcc03('0x14')](_0xcc03('0x1b'),_0x5ed3d7,JSON[_0xcc03('0x16')](_0x32c93d));_0x52faf7(_0x32c93d);})['catch'](function(_0x32189c){logger[_0xcc03('0x17')]('CreateChatMessage',_0x32189c[_0xcc03('0x18')],_0x5ed3d7);_0x53ad01(_0x2ad5eb[_0xcc03('0x17')](0x1f4,_0x32189c[_0xcc03('0x18')]));});});}; \ No newline at end of file +var _0x4e87=['redis','defaults','localhost','socket.io-emitter','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','ChatMessage','create','options','CreateChatMessage','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4e87,0x1e6));var _0x74e8=function(_0x5a66ef,_0x32c4ec){_0x5a66ef=_0x5a66ef-0x0;var _0x4f2ec7=_0x4e87[_0x5a66ef];return _0x4f2ec7;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x74e8('0x0'));var fs=require('fs');var Redis=require(_0x74e8('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x74e8('0x2'));var logger=require(_0x74e8('0x3'))('rpc');var config=require(_0x74e8('0x4'));var jayson=require(_0x74e8('0x5'));var client=jayson[_0x74e8('0x6')][_0x74e8('0x7')]({'port':0x232a});config[_0x74e8('0x8')]=_[_0x74e8('0x9')](config[_0x74e8('0x8')],{'host':_0x74e8('0xa'),'port':0x18eb});var socket=require(_0x74e8('0xb'))(new Redis(config[_0x74e8('0x8')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x78c24a,_0x5bb709,_0x1e270d){return new BPromise(function(_0x5b5bd0,_0x2f5ae2){return client['request'](_0x78c24a,_0x1e270d)[_0x74e8('0xc')](function(_0xc7bb51){logger[_0x74e8('0xd')](_0x74e8('0xe'),_0x5bb709,_0x74e8('0xf'));logger[_0x74e8('0x10')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x5bb709,_0x74e8('0xf'),JSON[_0x74e8('0x11')](_0xc7bb51));if(_0xc7bb51[_0x74e8('0x12')]){if(_0xc7bb51[_0x74e8('0x12')]['code']===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x5bb709,_0xc7bb51[_0x74e8('0x12')][_0x74e8('0x13')]);return _0x2f5ae2(_0xc7bb51[_0x74e8('0x12')][_0x74e8('0x13')]);}logger[_0x74e8('0x12')](_0x74e8('0xe'),_0x5bb709,_0xc7bb51[_0x74e8('0x12')][_0x74e8('0x13')]);return _0x5b5bd0(_0xc7bb51[_0x74e8('0x12')][_0x74e8('0x13')]);}else{logger['info'](_0x74e8('0xe'),_0x5bb709,_0x74e8('0xf'));_0x5b5bd0(_0xc7bb51[_0x74e8('0x14')][_0x74e8('0x13')]);}})[_0x74e8('0x15')](function(_0x58fa62){logger[_0x74e8('0x12')]('ChatMessage,\x20%s,\x20%s',_0x5bb709,_0x58fa62);_0x2f5ae2(_0x58fa62);});});}exports['CreateChatMessage']=function(_0x44289e){var _0x223e60=this;return new Promise(function(_0x20bad3,_0x1bac92){return db[_0x74e8('0x16')][_0x74e8('0x17')](_0x44289e['body'],{'raw':_0x44289e[_0x74e8('0x18')]?_0x44289e[_0x74e8('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x74e8('0xc')](function(_0x28b7dc){logger['info'](_0x74e8('0x19'),_0x44289e);logger[_0x74e8('0x10')]('CreateChatMessage',_0x44289e,JSON[_0x74e8('0x11')](_0x28b7dc));_0x20bad3(_0x28b7dc);})['catch'](function(_0x4d007e){logger['error']('CreateChatMessage',_0x4d007e['message'],_0x44289e);_0x1bac92(_0x223e60[_0x74e8('0x12')](0x1f4,_0x4d007e[_0x74e8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 6ba58ea..45b236b 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 _0xf3be=['chatMessage:','./chatMessage.events','save','remove','update','removeListener','register','length'];(function(_0x500785,_0x15e5ff){var _0x1f8bcc=function(_0x406983){while(--_0x406983){_0x500785['push'](_0x500785['shift']());}};_0x1f8bcc(++_0x15e5ff);}(_0xf3be,0x1e1));var _0xef3b=function(_0x3cdd6e,_0x576843){_0x3cdd6e=_0x3cdd6e-0x0;var _0x44d22d=_0xf3be[_0x3cdd6e];return _0x44d22d;};'use strict';var ChatMessageEvents=require(_0xef3b('0x0'));var events=[_0xef3b('0x1'),_0xef3b('0x2'),_0xef3b('0x3')];function createListener(_0x4d8b04,_0x373397){return function(_0x4ea3cf){_0x373397['emit'](_0x4d8b04,_0x4ea3cf);};}function removeListener(_0x55f249,_0x4bfc98){return function(){ChatMessageEvents[_0xef3b('0x4')](_0x55f249,_0x4bfc98);};}exports[_0xef3b('0x5')]=function(_0x48f499){for(var _0x3dfcc2=0x0,_0x3f7873=events[_0xef3b('0x6')];_0x3dfcc2<_0x3f7873;_0x3dfcc2++){var _0x19191a=events[_0x3dfcc2];var _0x47069a=createListener(_0xef3b('0x7')+_0x19191a,_0x48f499);ChatMessageEvents['on'](_0x19191a,_0x47069a);}}; \ No newline at end of file +var _0x9d92=['update','emit','removeListener','register','length','chatMessage:','./chatMessage.events'];(function(_0x19b164,_0x7d644b){var _0x2bebb0=function(_0x35f0e3){while(--_0x35f0e3){_0x19b164['push'](_0x19b164['shift']());}};_0x2bebb0(++_0x7d644b);}(_0x9d92,0xdf));var _0x29d9=function(_0xfb0cfd,_0x500179){_0xfb0cfd=_0xfb0cfd-0x0;var _0x2fd8aa=_0x9d92[_0xfb0cfd];return _0x2fd8aa;};'use strict';var ChatMessageEvents=require(_0x29d9('0x0'));var events=['save','remove',_0x29d9('0x1')];function createListener(_0x3d33ba,_0x48fe57){return function(_0x3dbd9e){_0x48fe57[_0x29d9('0x2')](_0x3d33ba,_0x3dbd9e);};}function removeListener(_0x18371b,_0x6e12eb){return function(){ChatMessageEvents[_0x29d9('0x3')](_0x18371b,_0x6e12eb);};}exports[_0x29d9('0x4')]=function(_0x27d032){for(var _0x52932b=0x0,_0x209595=events[_0x29d9('0x5')];_0x52932b<_0x209595;_0x52932b++){var _0x392265=events[_0x52932b];var _0x5aeb53=createListener(_0x29d9('0x6')+_0x392265,_0x27d032);ChatMessageEvents['on'](_0x392265,_0x5aeb53);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index d53d9b4..e37c6f2 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 _0xd689=['chatmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','tracked','chat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd689,0x142));var _0x9d68=function(_0xabd0bc,_0x203b56){_0xabd0bc=_0xabd0bc-0x0;var _0xdbde42=_0xd689[_0xabd0bc];return _0xdbde42;};'use strict';var multer=require(_0x9d68('0x0'));var util=require(_0x9d68('0x1'));var path=require(_0x9d68('0x2'));var timeout=require('connect-timeout');var express=require(_0x9d68('0x3'));var router=express[_0x9d68('0x4')]();var fs_extra=require(_0x9d68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9d68('0x6'));var config=require('../../config/environment');var controller=require('./chatMessage.controller');router['get']('/',auth[_0x9d68('0x7')](),controller[_0x9d68('0x8')]);router[_0x9d68('0x9')](_0x9d68('0xa'),auth[_0x9d68('0x7')](),controller[_0x9d68('0xb')]);router[_0x9d68('0x9')](_0x9d68('0xc'),auth[_0x9d68('0x7')](),controller[_0x9d68('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x9d68('0xe')](_0x9d68('0xf'),_0x9d68('0x10')),controller['create']);router[_0x9d68('0x11')]('/:id',controller[_0x9d68('0x12')]);router[_0x9d68('0x11')](_0x9d68('0x13'),auth[_0x9d68('0x7')](),controller[_0x9d68('0x14')]);router['put'](_0x9d68('0x15'),auth[_0x9d68('0x7')](),controller[_0x9d68('0x16')]);router[_0x9d68('0x17')]('/:id',auth[_0x9d68('0x7')](),controller[_0x9d68('0x18')]);module[_0x9d68('0x19')]=router; \ No newline at end of file +var _0xfb5f=['chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','/describe','isAuthenticated','/:id','show','post','tracked','chat'];(function(_0x2e8322,_0x1e296b){var _0x6fa1c7=function(_0x166737){while(--_0x166737){_0x2e8322['push'](_0x2e8322['shift']());}};_0x6fa1c7(++_0x1e296b);}(_0xfb5f,0xb9));var _0xffb5=function(_0x4e5578,_0x48a64e){_0x4e5578=_0x4e5578-0x0;var _0x392ded=_0xfb5f[_0x4e5578];return _0x392ded;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xffb5('0x0'));var express=require(_0xffb5('0x1'));var router=express[_0xffb5('0x2')]();var fs_extra=require(_0xffb5('0x3'));var auth=require(_0xffb5('0x4'));var interaction=require(_0xffb5('0x5'));var config=require('../../config/environment');var controller=require(_0xffb5('0x6'));router[_0xffb5('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xffb5('0x8'),auth[_0xffb5('0x9')](),controller['describe']);router[_0xffb5('0x7')](_0xffb5('0xa'),auth[_0xffb5('0x9')](),controller[_0xffb5('0xb')]);router[_0xffb5('0xc')]('/',auth[_0xffb5('0x9')](),interaction[_0xffb5('0xd')](_0xffb5('0xe'),_0xffb5('0xf')),controller[_0xffb5('0x10')]);router[_0xffb5('0x11')]('/:id',controller[_0xffb5('0x12')]);router[_0xffb5('0x11')](_0xffb5('0x13'),auth[_0xffb5('0x9')](),controller[_0xffb5('0x14')]);router[_0xffb5('0x11')](_0xffb5('0x15'),auth[_0xffb5('0x9')](),controller[_0xffb5('0x16')]);router['delete'](_0xffb5('0xa'),auth[_0xffb5('0x9')](),controller[_0xffb5('0x17')]);module[_0xffb5('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 9d021bc..29eb928 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['medium','TEXT','exports'];(function(_0xf7328,_0x310f3a){var _0x2591d8=function(_0x188c22){while(--_0x188c22){_0xf7328['push'](_0xf7328['shift']());}};_0x2591d8(++_0x310f3a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0xadb5=['medium','TEXT','exports'];(function(_0x492dcc,_0x36d0dd){var _0x387c79=function(_0x35ccc5){while(--_0x35ccc5){_0x492dcc['push'](_0x492dcc['shift']());}};_0x387c79(++_0x36d0dd);}(_0xadb5,0xad));var _0x5adb=function(_0x425752,_0x54eb71){_0x425752=_0x425752-0x0;var _0x2ecc4d=_0xadb5[_0x425752];return _0x2ecc4d;};'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 a0dcf51..0786be9 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(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x7a54,0x106));var _0x47a5=function(_0x5880e7,_0x42bd79){_0x5880e7=_0x5880e7-0x0;var _0x276be9=_0x7a54[_0x5880e7];return _0x276be9;};'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(_0x4efd84,_0x46bb20){var _0x1afcf5=function(_0x4e4d68){while(--_0x4e4d68){_0x4efd84['push'](_0x4efd84['shift']());}};_0x1afcf5(++_0x46bb20);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 77cd316..996ca9f 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 _0xf1a0=['update','remove','emit','hasOwnProperty','ChatOfflineMessage','setMaxListeners'];(function(_0x56c75c,_0x51cece){var _0x51a8e6=function(_0x557b44){while(--_0x557b44){_0x56c75c['push'](_0x56c75c['shift']());}};_0x51a8e6(++_0x51cece);}(_0xf1a0,0x1a2));var _0x0f1a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf1a0[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require('../../mysqldb')['db'][_0x0f1a('0x0')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x0f1a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0f1a('0x2'),'afterDestroy':_0x0f1a('0x3')};function emitEvent(_0x191f4c){return function(_0x3130c4,_0x376586,_0x106cac){ChatOfflineMessageEvents[_0x0f1a('0x4')](_0x191f4c+':'+_0x3130c4['id'],_0x3130c4);ChatOfflineMessageEvents['emit'](_0x191f4c,_0x3130c4);_0x106cac(null);};}for(var e in events){if(events[_0x0f1a('0x5')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0xf6ff=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x1d3264,_0x58afe9){var _0x36960b=function(_0x503acd){while(--_0x503acd){_0x1d3264['push'](_0x1d3264['shift']());}};_0x36960b(++_0x58afe9);}(_0xf6ff,0x11b));var _0xff6f=function(_0x468d07,_0x1ab22a){_0x468d07=_0x468d07-0x0;var _0x290d82=_0xf6ff[_0x468d07];return _0x290d82;};'use strict';var EventEmitter=require(_0xff6f('0x0'));var ChatOfflineMessage=require(_0xff6f('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xff6f('0x2')](0x0);var events={'afterCreate':_0xff6f('0x3'),'afterUpdate':'update','afterDestroy':_0xff6f('0x4')};function emitEvent(_0x4f6861){return function(_0x2bc3eb,_0x48936f,_0x43a1f1){ChatOfflineMessageEvents['emit'](_0x4f6861+':'+_0x2bc3eb['id'],_0x2bc3eb);ChatOfflineMessageEvents['emit'](_0x4f6861,_0x2bc3eb);_0x43a1f1(null);};}for(var e in events){if(events[_0xff6f('0x5')](e)){var event=events[e];ChatOfflineMessage[_0xff6f('0x6')](e,emitEvent(event));}}module[_0xff6f('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index fb185b1..520db83 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 _0x4915=['utf8mb4','utf8mb4_unicode_ci','exports','define'];(function(_0x11155f,_0x57b687){var _0xd07e48=function(_0x592615){while(--_0x592615){_0x11155f['push'](_0x11155f['shift']());}};_0xd07e48(++_0x57b687);}(_0x4915,0x11e));var _0x5491=function(_0x57f5a8,_0x3edbf0){_0x57f5a8=_0x57f5a8-0x0;var _0x116b7a=_0x4915[_0x57f5a8];return _0x116b7a;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x5491('0x0')]=function(_0x6152c){return _0x6152c[_0x5491('0x1')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5491('0x2'),'collate':_0x5491('0x3')});}; \ No newline at end of file +var _0x1b8d=['utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x1b8d,0xc6));var _0xd1b8=function(_0x5ab5bd,_0x12c446){_0x5ab5bd=_0x5ab5bd-0x0;var _0x3dddd8=_0x1b8d[_0x5ab5bd];return _0x3dddd8;};'use strict';var attributes=require(_0xd1b8('0x0'));module[_0xd1b8('0x1')]=function(_0x2bb041){return _0x2bb041[_0xd1b8('0x2')](_0xd1b8('0x3'),attributes,{'tableName':_0xd1b8('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd1b8('0x5'),'collate':_0xd1b8('0x6')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 39e5005..bceb111 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 _0xb81d=['code','error','message','result','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x9c0784,_0x5a69c5){var _0x4e35d7=function(_0x55d54a){while(--_0x55d54a){_0x9c0784['push'](_0x9c0784['shift']());}};_0x4e35d7(++_0x5a69c5);}(_0xb81d,0x14e));var _0xdb81=function(_0x3d12d7,_0xae281f){_0x3d12d7=_0x3d12d7-0x0;var _0x4b64ad=_0xb81d[_0x3d12d7];return _0x4b64ad;};'use strict';var _=require(_0xdb81('0x0'));var util=require('util');var moment=require(_0xdb81('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb81('0x2'));var db=require(_0xdb81('0x3'))['db'];var utils=require(_0xdb81('0x4'));var logger=require(_0xdb81('0x5'))(_0xdb81('0x6'));var config=require(_0xdb81('0x7'));var jayson=require(_0xdb81('0x8'));var client=jayson[_0xdb81('0x9')][_0xdb81('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ce56d,_0x597e43,_0x15c2e1){return new BPromise(function(_0x2103c1,_0x2cfd61){return client[_0xdb81('0xb')](_0x5ce56d,_0x15c2e1)[_0xdb81('0xc')](function(_0x339e9b){logger[_0xdb81('0xd')](_0xdb81('0xe'),_0x597e43,_0xdb81('0xf'));logger[_0xdb81('0x10')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x597e43,_0xdb81('0xf'),JSON[_0xdb81('0x11')](_0x339e9b));if(_0x339e9b['error']){if(_0x339e9b['error'][_0xdb81('0x12')]===0x1f4){logger[_0xdb81('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x597e43,_0x339e9b[_0xdb81('0x13')][_0xdb81('0x14')]);return _0x2cfd61(_0x339e9b[_0xdb81('0x13')][_0xdb81('0x14')]);}logger['error'](_0xdb81('0xe'),_0x597e43,_0x339e9b[_0xdb81('0x13')][_0xdb81('0x14')]);return _0x2103c1(_0x339e9b[_0xdb81('0x13')][_0xdb81('0x14')]);}else{logger[_0xdb81('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x597e43,'request\x20sent');_0x2103c1(_0x339e9b[_0xdb81('0x15')]['message']);}})['catch'](function(_0x219a5d){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x597e43,_0x219a5d);_0x2cfd61(_0x219a5d);});});} \ No newline at end of file +var _0x1aca=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x21ea5f,_0x148ebe){var _0x26a391=function(_0x40c81b){while(--_0x40c81b){_0x21ea5f['push'](_0x21ea5f['shift']());}};_0x26a391(++_0x148ebe);}(_0x1aca,0x19f));var _0xa1ac=function(_0x29e327,_0x2b6ea9){_0x29e327=_0x29e327-0x0;var _0x3dac9e=_0x1aca[_0x29e327];return _0x3dac9e;};'use strict';var _=require('lodash');var util=require(_0xa1ac('0x0'));var moment=require(_0xa1ac('0x1'));var BPromise=require(_0xa1ac('0x2'));var rs=require(_0xa1ac('0x3'));var fs=require('fs');var Redis=require(_0xa1ac('0x4'));var db=require(_0xa1ac('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1ac('0x6'))(_0xa1ac('0x7'));var config=require('../../config/environment');var jayson=require(_0xa1ac('0x8'));var client=jayson[_0xa1ac('0x9')][_0xa1ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b8bc6,_0x2dc3f2,_0x2b6712){return new BPromise(function(_0x38c2d0,_0x8d8d2a){return client[_0xa1ac('0xb')](_0x1b8bc6,_0x2b6712)[_0xa1ac('0xc')](function(_0x33d63f){logger[_0xa1ac('0xd')](_0xa1ac('0xe'),_0x2dc3f2,_0xa1ac('0xf'));logger[_0xa1ac('0x10')](_0xa1ac('0x11'),_0x2dc3f2,'request\x20sent',JSON[_0xa1ac('0x12')](_0x33d63f));if(_0x33d63f[_0xa1ac('0x13')]){if(_0x33d63f['error']['code']===0x1f4){logger[_0xa1ac('0x13')](_0xa1ac('0xe'),_0x2dc3f2,_0x33d63f[_0xa1ac('0x13')][_0xa1ac('0x14')]);return _0x8d8d2a(_0x33d63f[_0xa1ac('0x13')][_0xa1ac('0x14')]);}logger['error'](_0xa1ac('0xe'),_0x2dc3f2,_0x33d63f[_0xa1ac('0x13')]['message']);return _0x38c2d0(_0x33d63f[_0xa1ac('0x13')][_0xa1ac('0x14')]);}else{logger['info'](_0xa1ac('0xe'),_0x2dc3f2,'request\x20sent');_0x38c2d0(_0x33d63f[_0xa1ac('0x15')][_0xa1ac('0x14')]);}})[_0xa1ac('0x16')](function(_0x4e217e){logger[_0xa1ac('0x13')](_0xa1ac('0xe'),_0x2dc3f2,_0x4e217e);_0x8d8d2a(_0x4e217e);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 3323ef5..756eb43 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 _0x4223=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x4223,0x1b9));var _0x3422=function(_0x30ea2a,_0x4c1168){_0x30ea2a=_0x30ea2a-0x0;var _0x73ecb7=_0x4223[_0x30ea2a];return _0x73ecb7;};'use strict';var multer=require(_0x3422('0x0'));var util=require('util');var path=require(_0x3422('0x1'));var timeout=require(_0x3422('0x2'));var express=require(_0x3422('0x3'));var router=express[_0x3422('0x4')]();var fs_extra=require(_0x3422('0x5'));var auth=require(_0x3422('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3422('0x7'));var controller=require(_0x3422('0x8'));router[_0x3422('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3422('0x9')]('/describe',auth[_0x3422('0xa')](),controller[_0x3422('0xb')]);router[_0x3422('0x9')](_0x3422('0xc'),auth['isAuthenticated'](),controller[_0x3422('0xd')]);router[_0x3422('0xe')]('/',auth[_0x3422('0xa')](),controller[_0x3422('0xf')]);router[_0x3422('0x10')](_0x3422('0xc'),auth['isAuthenticated'](),controller[_0x3422('0x11')]);router[_0x3422('0x12')]('/:id',auth[_0x3422('0xa')](),controller['destroy']);module[_0x3422('0x13')]=router; \ No newline at end of file +var _0x4503=['index','get','/describe','describe','/:id','show','post','create','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated'];(function(_0x52a6e3,_0x4a73b4){var _0x8910d0=function(_0x57e5ef){while(--_0x57e5ef){_0x52a6e3['push'](_0x52a6e3['shift']());}};_0x8910d0(++_0x4a73b4);}(_0x4503,0x197));var _0x3450=function(_0x556400,_0x23b4e7){_0x556400=_0x556400-0x0;var _0x50992c=_0x4503[_0x556400];return _0x50992c;};'use strict';var multer=require(_0x3450('0x0'));var util=require(_0x3450('0x1'));var path=require(_0x3450('0x2'));var timeout=require('connect-timeout');var express=require(_0x3450('0x3'));var router=express[_0x3450('0x4')]();var fs_extra=require(_0x3450('0x5'));var auth=require(_0x3450('0x6'));var interaction=require(_0x3450('0x7'));var config=require(_0x3450('0x8'));var controller=require(_0x3450('0x9'));router['get']('/',auth[_0x3450('0xa')](),controller[_0x3450('0xb')]);router[_0x3450('0xc')](_0x3450('0xd'),auth[_0x3450('0xa')](),controller[_0x3450('0xe')]);router[_0x3450('0xc')](_0x3450('0xf'),auth[_0x3450('0xa')](),controller[_0x3450('0x10')]);router[_0x3450('0x11')]('/',auth[_0x3450('0xa')](),controller[_0x3450('0x12')]);router[_0x3450('0x13')](_0x3450('0xf'),auth[_0x3450('0xa')](),controller[_0x3450('0x14')]);router[_0x3450('0x15')](_0x3450('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 3dde79b..17913d8 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 _0x574f=['timeout','mouseOver','sequelize'];(function(_0x49e7d9,_0x14425d){var _0x57e4c1=function(_0x398929){while(--_0x398929){_0x49e7d9['push'](_0x49e7d9['shift']());}};_0x57e4c1(++_0x14425d);}(_0x574f,0x16a));var _0xf574=function(_0x16a2e8,_0x59c3a9){_0x16a2e8=_0x16a2e8-0x0;var _0x5de2a3=_0x574f[_0x16a2e8];return _0x5de2a3;};'use strict';var Sequelize=require(_0xf574('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0xf574('0x1')),'defaultValue':_0xf574('0x2')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xf26b=['mouseOver','timeout','STRING','INTEGER','sequelize','ENUM'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xf26b,0xdc));var _0xbf26=function(_0x240187,_0x74f5f8){_0x240187=_0x240187-0x0;var _0x3747ac=_0xf26b[_0x240187];return _0x3747ac;};'use strict';var Sequelize=require(_0xbf26('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xbf26('0x1')](_0xbf26('0x2'),_0xbf26('0x3')),'defaultValue':_0xbf26('0x2')},'selector':{'type':Sequelize[_0xbf26('0x4')]},'timeout':{'type':Sequelize[_0xbf26('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 959aafe..b4cfbd2 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 _0x44ae=['name','send','show','model','rawAttributes','keys','filters','intersection','attributes','query','length','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','stack'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x44ae,0x17d));var _0xe44a=function(_0x4684af,_0x34880f){_0x4684af=_0x4684af-0x0;var _0x3bb413=_0x44ae[_0x4684af];return _0x3bb413;};'use strict';var emlformat=require(_0xe44a('0x0'));var rimraf=require(_0xe44a('0x1'));var zipdir=require(_0xe44a('0x2'));var jsonpatch=require(_0xe44a('0x3'));var rp=require('request-promise');var moment=require(_0xe44a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe44a('0x5'));var util=require(_0xe44a('0x6'));var path=require(_0xe44a('0x7'));var sox=require(_0xe44a('0x8'));var csv=require(_0xe44a('0x9'));var ejs=require(_0xe44a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe44a('0xb'));var squel=require(_0xe44a('0xc'));var crypto=require(_0xe44a('0xd'));var jsforce=require(_0xe44a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe44a('0x9'));var querystring=require(_0xe44a('0xf'));var Papa=require(_0xe44a('0x10'));var Redis=require(_0xe44a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe44a('0x12'));var as=require(_0xe44a('0x13'));var hardwareService=require(_0xe44a('0x14'));var logger=require(_0xe44a('0x15'))(_0xe44a('0x16'));var utils=require(_0xe44a('0x17'));var config=require(_0xe44a('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f1150,_0x306f7a){_0x306f7a=_0x306f7a||0xcc;return function(_0xbfc286){if(_0xbfc286){return _0x5f1150[_0xe44a('0x19')](_0x306f7a);}return _0x5f1150['status'](_0x306f7a)[_0xe44a('0x1a')]();};}function respondWithResult(_0x3ab707,_0x3656b2){_0x3656b2=_0x3656b2||0xc8;return function(_0x14c1a8){if(_0x14c1a8){return _0x3ab707[_0xe44a('0x1b')](_0x3656b2)[_0xe44a('0x1c')](_0x14c1a8);}};}function respondWithFilteredResult(_0x1d491a,_0x575d79){return function(_0x1ec698){if(_0x1ec698){var _0x96dee=typeof _0x575d79['offset']==='undefined'&&typeof _0x575d79['limit']==='undefined';var _0x959455=_0x1ec698[_0xe44a('0x1d')];var _0x2a33b6=_0x96dee?0x0:_0x575d79['offset'];var _0x20fdc7=_0x96dee?_0x1ec698[_0xe44a('0x1d')]:_0x575d79[_0xe44a('0x1e')]+_0x575d79[_0xe44a('0x1f')];var _0x1fcfce;if(_0x20fdc7>=_0x959455){_0x20fdc7=_0x959455;_0x1fcfce=0xc8;}else{_0x1fcfce=0xce;}_0x1d491a[_0xe44a('0x1b')](_0x1fcfce);return _0x1d491a['set'](_0xe44a('0x20'),_0x2a33b6+'-'+_0x20fdc7+'/'+_0x959455)['json'](_0x1ec698);}return null;};}function patchUpdates(_0x295ceb){return function(_0x6656a8){try{jsonpatch[_0xe44a('0x21')](_0x6656a8,_0x295ceb,!![]);}catch(_0x2663bb){return BPromise[_0xe44a('0x22')](_0x2663bb);}return _0x6656a8[_0xe44a('0x23')]();};}function saveUpdates(_0x37992e,_0x4e9bab){return function(_0x203889){if(_0x203889){return _0x203889['update'](_0x37992e)[_0xe44a('0x24')](function(_0x2b53b9){return _0x2b53b9;});}return null;};}function removeEntity(_0x444c93,_0x26eba0){return function(_0x1bc4e9){if(_0x1bc4e9){return _0x1bc4e9[_0xe44a('0x25')]()[_0xe44a('0x24')](function(){_0x444c93[_0xe44a('0x1b')](0xcc)[_0xe44a('0x1a')]();});}};}function handleEntityNotFound(_0x2d91b7,_0x43ef28){return function(_0x46c16b){if(!_0x46c16b){_0x2d91b7[_0xe44a('0x19')](0x194);}return _0x46c16b;};}function handleError(_0xc69e9d,_0x5574f8){_0x5574f8=_0x5574f8||0x1f4;return function(_0x8fbbbf){logger['error'](_0x8fbbbf[_0xe44a('0x26')]);if(_0x8fbbbf[_0xe44a('0x27')]){delete _0x8fbbbf['name'];}_0xc69e9d[_0xe44a('0x1b')](_0x5574f8)[_0xe44a('0x28')](_0x8fbbbf);};}exports[_0xe44a('0x29')]=function(_0x4c6690,_0xf02b86){var _0x5091c3={'raw':!![],'where':{'id':_0x4c6690['params']['id']}},_0x1cb6c7={};_0x1cb6c7[_0xe44a('0x2a')]=_['keys'](db['ChatProactiveAction'][_0xe44a('0x2b')]);_0x1cb6c7['query']=_[_0xe44a('0x2c')](_0x4c6690['query']);_0x1cb6c7[_0xe44a('0x2d')]=_[_0xe44a('0x2e')](_0x1cb6c7[_0xe44a('0x2a')],_0x1cb6c7['query']);_0x5091c3[_0xe44a('0x2f')]=_[_0xe44a('0x2e')](_0x1cb6c7['model'],qs['fields'](_0x4c6690[_0xe44a('0x30')]['fields']));_0x5091c3['attributes']=_0x5091c3[_0xe44a('0x2f')][_0xe44a('0x31')]?_0x5091c3[_0xe44a('0x2f')]:_0x1cb6c7[_0xe44a('0x2a')];if(_0x4c6690[_0xe44a('0x30')][_0xe44a('0x32')]){_0x5091c3[_0xe44a('0x33')]=[{'all':!![]}];}_0x5091c3=_[_0xe44a('0x34')]({},_0x5091c3,_0x4c6690[_0xe44a('0x35')]);return db[_0xe44a('0x36')][_0xe44a('0x37')](_0x5091c3)[_0xe44a('0x24')](handleEntityNotFound(_0xf02b86,null))[_0xe44a('0x24')](respondWithResult(_0xf02b86,null))[_0xe44a('0x38')](handleError(_0xf02b86,null));};exports[_0xe44a('0x39')]=function(_0x198683,_0x537c05){return db[_0xe44a('0x36')][_0xe44a('0x39')](_0x198683['body'],{})[_0xe44a('0x24')](respondWithResult(_0x537c05,0xc9))[_0xe44a('0x38')](handleError(_0x537c05,null));};exports['update']=function(_0x542144,_0x18cd1a){if(_0x542144[_0xe44a('0x3a')]['id']){delete _0x542144[_0xe44a('0x3a')]['id'];}return db[_0xe44a('0x36')][_0xe44a('0x37')]({'where':{'id':_0x542144[_0xe44a('0x3b')]['id']}})['then'](handleEntityNotFound(_0x18cd1a,null))[_0xe44a('0x24')](saveUpdates(_0x542144[_0xe44a('0x3a')],null))[_0xe44a('0x24')](respondWithResult(_0x18cd1a,null))[_0xe44a('0x38')](handleError(_0x18cd1a,null));};exports[_0xe44a('0x25')]=function(_0x3fede5,_0x4cca58){return db[_0xe44a('0x36')]['find']({'where':{'id':_0x3fede5[_0xe44a('0x3b')]['id']}})[_0xe44a('0x24')](handleEntityNotFound(_0x4cca58,null))[_0xe44a('0x24')](removeEntity(_0x4cca58,null))['catch'](handleError(_0x4cca58,null));}; \ No newline at end of file +var _0x79d3=['moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','params','model','ChatProactiveAction','rawAttributes','keys','query','filters','intersection','attributes','fields','length','includeAll','include','options','find','catch','create','body','eml-format','zip-dir','request-promise'];(function(_0x2ce75b,_0x12cb5e){var _0x523f98=function(_0x22a013){while(--_0x22a013){_0x2ce75b['push'](_0x2ce75b['shift']());}};_0x523f98(++_0x12cb5e);}(_0x79d3,0x15f));var _0x379d=function(_0x7577b9,_0x4fe21c){_0x7577b9=_0x7577b9-0x0;var _0x2660c8=_0x79d3[_0x7577b9];return _0x2660c8;};'use strict';var emlformat=require(_0x379d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x379d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x379d('0x2'));var moment=require(_0x379d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x379d('0x4'));var util=require(_0x379d('0x5'));var path=require(_0x379d('0x6'));var sox=require(_0x379d('0x7'));var csv=require(_0x379d('0x8'));var ejs=require(_0x379d('0x9'));var fs=require('fs');var fs_extra=require(_0x379d('0xa'));var _=require('lodash');var squel=require(_0x379d('0xb'));var crypto=require('crypto');var jsforce=require(_0x379d('0xc'));var deskjs=require(_0x379d('0xd'));var toCsv=require(_0x379d('0x8'));var querystring=require('querystring');var Papa=require(_0x379d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x379d('0xf'));var hardwareService=require(_0x379d('0x10'));var logger=require(_0x379d('0x11'))('api');var utils=require(_0x379d('0x12'));var config=require(_0x379d('0x13'));var licenseUtil=require(_0x379d('0x14'));var db=require(_0x379d('0x15'))['db'];function respondWithStatusCode(_0x490c4a,_0x98a42c){_0x98a42c=_0x98a42c||0xcc;return function(_0x3aef39){if(_0x3aef39){return _0x490c4a[_0x379d('0x16')](_0x98a42c);}return _0x490c4a[_0x379d('0x17')](_0x98a42c)[_0x379d('0x18')]();};}function respondWithResult(_0x16976a,_0x4ae1a0){_0x4ae1a0=_0x4ae1a0||0xc8;return function(_0x47bf1b){if(_0x47bf1b){return _0x16976a[_0x379d('0x17')](_0x4ae1a0)['json'](_0x47bf1b);}};}function respondWithFilteredResult(_0x13ed31,_0x14df5d){return function(_0x1414f4){if(_0x1414f4){var _0x1290c9=typeof _0x14df5d['offset']===_0x379d('0x19')&&typeof _0x14df5d['limit']==='undefined';var _0x489343=_0x1414f4[_0x379d('0x1a')];var _0xe53ada=_0x1290c9?0x0:_0x14df5d[_0x379d('0x1b')];var _0x1ff2d2=_0x1290c9?_0x1414f4[_0x379d('0x1a')]:_0x14df5d[_0x379d('0x1b')]+_0x14df5d[_0x379d('0x1c')];var _0x2b7f18;if(_0x1ff2d2>=_0x489343){_0x1ff2d2=_0x489343;_0x2b7f18=0xc8;}else{_0x2b7f18=0xce;}_0x13ed31[_0x379d('0x17')](_0x2b7f18);return _0x13ed31['set'](_0x379d('0x1d'),_0xe53ada+'-'+_0x1ff2d2+'/'+_0x489343)[_0x379d('0x1e')](_0x1414f4);}return null;};}function patchUpdates(_0x186b3e){return function(_0x3de79d){try{jsonpatch[_0x379d('0x1f')](_0x3de79d,_0x186b3e,!![]);}catch(_0x27c1cf){return BPromise[_0x379d('0x20')](_0x27c1cf);}return _0x3de79d[_0x379d('0x21')]();};}function saveUpdates(_0x316f99,_0x449981){return function(_0x14a249){if(_0x14a249){return _0x14a249[_0x379d('0x22')](_0x316f99)[_0x379d('0x23')](function(_0x177df1){return _0x177df1;});}return null;};}function removeEntity(_0x372d76,_0x59da46){return function(_0x3c5109){if(_0x3c5109){return _0x3c5109[_0x379d('0x24')]()['then'](function(){_0x372d76[_0x379d('0x17')](0xcc)[_0x379d('0x18')]();});}};}function handleEntityNotFound(_0x2c1d0d,_0x22639c){return function(_0x428072){if(!_0x428072){_0x2c1d0d[_0x379d('0x16')](0x194);}return _0x428072;};}function handleError(_0x3eeff0,_0x5e6855){_0x5e6855=_0x5e6855||0x1f4;return function(_0x7d6cc3){logger[_0x379d('0x25')](_0x7d6cc3[_0x379d('0x26')]);if(_0x7d6cc3[_0x379d('0x27')]){delete _0x7d6cc3[_0x379d('0x27')];}_0x3eeff0['status'](_0x5e6855)[_0x379d('0x28')](_0x7d6cc3);};}exports['show']=function(_0x487d72,_0x3aa77b){var _0x141a00={'raw':!![],'where':{'id':_0x487d72[_0x379d('0x29')]['id']}},_0xb93461={};_0xb93461[_0x379d('0x2a')]=_['keys'](db[_0x379d('0x2b')][_0x379d('0x2c')]);_0xb93461['query']=_[_0x379d('0x2d')](_0x487d72[_0x379d('0x2e')]);_0xb93461[_0x379d('0x2f')]=_[_0x379d('0x30')](_0xb93461[_0x379d('0x2a')],_0xb93461[_0x379d('0x2e')]);_0x141a00[_0x379d('0x31')]=_['intersection'](_0xb93461[_0x379d('0x2a')],qs[_0x379d('0x32')](_0x487d72['query']['fields']));_0x141a00[_0x379d('0x31')]=_0x141a00[_0x379d('0x31')][_0x379d('0x33')]?_0x141a00[_0x379d('0x31')]:_0xb93461[_0x379d('0x2a')];if(_0x487d72['query'][_0x379d('0x34')]){_0x141a00[_0x379d('0x35')]=[{'all':!![]}];}_0x141a00=_['merge']({},_0x141a00,_0x487d72[_0x379d('0x36')]);return db['ChatProactiveAction'][_0x379d('0x37')](_0x141a00)['then'](handleEntityNotFound(_0x3aa77b,null))[_0x379d('0x23')](respondWithResult(_0x3aa77b,null))[_0x379d('0x38')](handleError(_0x3aa77b,null));};exports[_0x379d('0x39')]=function(_0x51c395,_0x277e53){return db['ChatProactiveAction'][_0x379d('0x39')](_0x51c395[_0x379d('0x3a')],{})[_0x379d('0x23')](respondWithResult(_0x277e53,0xc9))[_0x379d('0x38')](handleError(_0x277e53,null));};exports[_0x379d('0x22')]=function(_0x461661,_0x10b28d){if(_0x461661[_0x379d('0x3a')]['id']){delete _0x461661[_0x379d('0x3a')]['id'];}return db['ChatProactiveAction'][_0x379d('0x37')]({'where':{'id':_0x461661[_0x379d('0x29')]['id']}})[_0x379d('0x23')](handleEntityNotFound(_0x10b28d,null))['then'](saveUpdates(_0x461661[_0x379d('0x3a')],null))[_0x379d('0x23')](respondWithResult(_0x10b28d,null))['catch'](handleError(_0x10b28d,null));};exports[_0x379d('0x24')]=function(_0x39b5a3,_0x338f61){return db[_0x379d('0x2b')][_0x379d('0x37')]({'where':{'id':_0x39b5a3[_0x379d('0x29')]['id']}})[_0x379d('0x23')](handleEntityNotFound(_0x338f61,null))[_0x379d('0x23')](removeEntity(_0x338f61,null))[_0x379d('0x38')](handleError(_0x338f61,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 6cc27e7..16dd5ef 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 _0xcf28=['./chatProactiveAction.attributes','define','ChatProactiveAction','chat_proactive_actions','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x20fd15,_0x53f495){var _0x64905e=function(_0x4e3ad0){while(--_0x4e3ad0){_0x20fd15['push'](_0x20fd15['shift']());}};_0x64905e(++_0x53f495);}(_0xcf28,0xae));var _0x8cf2=function(_0x23b473,_0x96549d){_0x23b473=_0x23b473-0x0;var _0x536bd5=_0xcf28[_0x23b473];return _0x536bd5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8cf2('0x0'));var moment=require(_0x8cf2('0x1'));var BPromise=require('bluebird');var rp=require(_0x8cf2('0x2'));var fs=require('fs');var path=require(_0x8cf2('0x3'));var rimraf=require(_0x8cf2('0x4'));var config=require(_0x8cf2('0x5'));var attributes=require(_0x8cf2('0x6'));module['exports']=function(_0x432f88,_0x37e3ae){return _0x432f88[_0x8cf2('0x7')](_0x8cf2('0x8'),attributes,{'tableName':_0x8cf2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1559=['request-promise','path','rimraf','./chatProactiveAction.attributes','exports','chat_proactive_actions','lodash','util','../../config/logger','moment','bluebird'];(function(_0x36284b,_0x2b7436){var _0x23c34a=function(_0x14f579){while(--_0x14f579){_0x36284b['push'](_0x36284b['shift']());}};_0x23c34a(++_0x2b7436);}(_0x1559,0x7f));var _0x9155=function(_0x4f4e4b,_0x46ea73){_0x4f4e4b=_0x4f4e4b-0x0;var _0x23a628=_0x1559[_0x4f4e4b];return _0x23a628;};'use strict';var _=require(_0x9155('0x0'));var util=require(_0x9155('0x1'));var logger=require(_0x9155('0x2'))('api');var moment=require(_0x9155('0x3'));var BPromise=require(_0x9155('0x4'));var rp=require(_0x9155('0x5'));var fs=require('fs');var path=require(_0x9155('0x6'));var rimraf=require(_0x9155('0x7'));var config=require('../../config/environment');var attributes=require(_0x9155('0x8'));module[_0x9155('0x9')]=function(_0x31ac6d,_0x504cab){return _0x31ac6d['define']('ChatProactiveAction',attributes,{'tableName':_0x9155('0xa'),'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 d30c1fc..37a6c41 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 _0x1180=['error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5adcce,_0x10dc8b){var _0x129eb4=function(_0x45a294){while(--_0x45a294){_0x5adcce['push'](_0x5adcce['shift']());}};_0x129eb4(++_0x10dc8b);}(_0x1180,0x7c));var _0x0118=function(_0x15b544,_0x2815cb){_0x15b544=_0x15b544-0x0;var _0x4bab81=_0x1180[_0x15b544];return _0x4bab81;};'use strict';var _=require(_0x0118('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0118('0x1'));var rs=require(_0x0118('0x2'));var fs=require('fs');var Redis=require(_0x0118('0x3'));var db=require(_0x0118('0x4'))['db'];var utils=require(_0x0118('0x5'));var logger=require(_0x0118('0x6'))(_0x0118('0x7'));var config=require(_0x0118('0x8'));var jayson=require(_0x0118('0x9'));var client=jayson['client'][_0x0118('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x87cd9f,_0x14898a,_0xeec794){return new BPromise(function(_0x11b82f,_0x31ea58){return client[_0x0118('0xb')](_0x87cd9f,_0xeec794)['then'](function(_0x4a01f3){logger[_0x0118('0xc')](_0x0118('0xd'),_0x14898a,_0x0118('0xe'));logger[_0x0118('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x14898a,_0x0118('0xe'),JSON['stringify'](_0x4a01f3));if(_0x4a01f3[_0x0118('0x10')]){if(_0x4a01f3[_0x0118('0x10')][_0x0118('0x11')]===0x1f4){logger['error'](_0x0118('0xd'),_0x14898a,_0x4a01f3['error']['message']);return _0x31ea58(_0x4a01f3['error'][_0x0118('0x12')]);}logger[_0x0118('0x10')](_0x0118('0xd'),_0x14898a,_0x4a01f3['error'][_0x0118('0x12')]);return _0x11b82f(_0x4a01f3['error'][_0x0118('0x12')]);}else{logger[_0x0118('0xc')](_0x0118('0xd'),_0x14898a,_0x0118('0xe'));_0x11b82f(_0x4a01f3['result'][_0x0118('0x12')]);}})[_0x0118('0x13')](function(_0x35b775){logger[_0x0118('0x10')](_0x0118('0xd'),_0x14898a,_0x35b775);_0x31ea58(_0x35b775);});});} \ No newline at end of file +var _0xeae7=['ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xeae7,0xfb));var _0x7eae=function(_0x4849f6,_0x104836){_0x4849f6=_0x4849f6-0x0;var _0x1a3dcd=_0xeae7[_0x4849f6];return _0x1a3dcd;};'use strict';var _=require('lodash');var util=require(_0x7eae('0x0'));var moment=require('moment');var BPromise=require(_0x7eae('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7eae('0x2'));var db=require(_0x7eae('0x3'))['db'];var utils=require(_0x7eae('0x4'));var logger=require(_0x7eae('0x5'))(_0x7eae('0x6'));var config=require(_0x7eae('0x7'));var jayson=require(_0x7eae('0x8'));var client=jayson[_0x7eae('0x9')][_0x7eae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x329cc7,_0x2ac021,_0x166dd3){return new BPromise(function(_0x2bbf1d,_0x40fcf9){return client[_0x7eae('0xb')](_0x329cc7,_0x166dd3)[_0x7eae('0xc')](function(_0x8daa17){logger['info'](_0x7eae('0xd'),_0x2ac021,'request\x20sent');logger[_0x7eae('0xe')](_0x7eae('0xf'),_0x2ac021,_0x7eae('0x10'),JSON[_0x7eae('0x11')](_0x8daa17));if(_0x8daa17[_0x7eae('0x12')]){if(_0x8daa17[_0x7eae('0x12')][_0x7eae('0x13')]===0x1f4){logger[_0x7eae('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x2ac021,_0x8daa17[_0x7eae('0x12')][_0x7eae('0x14')]);return _0x40fcf9(_0x8daa17['error'][_0x7eae('0x14')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x2ac021,_0x8daa17[_0x7eae('0x12')][_0x7eae('0x14')]);return _0x2bbf1d(_0x8daa17[_0x7eae('0x12')]['message']);}else{logger[_0x7eae('0x15')]('ChatProactiveAction,\x20%s,\x20%s',_0x2ac021,_0x7eae('0x10'));_0x2bbf1d(_0x8daa17['result'][_0x7eae('0x14')]);}})['catch'](function(_0x420d6b){logger[_0x7eae('0x12')](_0x7eae('0xd'),_0x2ac021,_0x420d6b);_0x40fcf9(_0x420d6b);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index c4b2184..598814e 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 _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','create','put','update','delete','exports','multer','util'];(function(_0x30b865,_0x19049f){var _0x5c0a2c=function(_0x18b1df){while(--_0x18b1df){_0x30b865['push'](_0x30b865['shift']());}};_0x5c0a2c(++_0x19049f);}(_0xf494,0x1c6));var _0x4f49=function(_0x3c013a,_0x3ee6ab){_0x3c013a=_0x3c013a-0x0;var _0x373dca=_0xf494[_0x3c013a];return _0x373dca;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')](_0x4f49('0xb'),auth[_0x4f49('0xc')](),controller[_0x4f49('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4f49('0xe')]);router[_0x4f49('0xf')](_0x4f49('0xb'),auth[_0x4f49('0xc')](),controller[_0x4f49('0x10')]);router[_0x4f49('0x11')](_0x4f49('0xb'),auth[_0x4f49('0xc')](),controller['destroy']);module[_0x4f49('0x12')]=router; \ No newline at end of file +var _0x2675=['../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','delete','exports','multer','express','Router'];(function(_0x1e9329,_0x371687){var _0x4c6806=function(_0x1f2195){while(--_0x1f2195){_0x1e9329['push'](_0x1e9329['shift']());}};_0x4c6806(++_0x371687);}(_0x2675,0x75));var _0x5267=function(_0x1805ff,_0x19ce4e){_0x1805ff=_0x1805ff-0x0;var _0x28312f=_0x2675[_0x1805ff];return _0x28312f;};'use strict';var multer=require(_0x5267('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5267('0x1'));var router=express[_0x5267('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5267('0x3'));var interaction=require(_0x5267('0x4'));var config=require('../../config/environment');var controller=require(_0x5267('0x5'));router[_0x5267('0x6')](_0x5267('0x7'),auth[_0x5267('0x8')](),controller[_0x5267('0x9')]);router[_0x5267('0xa')]('/',auth['isAuthenticated'](),controller[_0x5267('0xb')]);router[_0x5267('0xc')]('/:id',auth[_0x5267('0x8')](),controller['update']);router[_0x5267('0xd')](_0x5267('0x7'),auth[_0x5267('0x8')](),controller['destroy']);module[_0x5267('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index d997b35..10e6103 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 _0x1af5=['name','STRING','ENUM','rrmemory','roundrobin','sequelize'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x1af5,0x155));var _0x51af=function(_0x2840a9,_0x31d469){_0x2840a9=_0x2840a9-0x0;var _0xf509c6=_0x1af5[_0x2840a9];return _0xf509c6;};'use strict';var Sequelize=require(_0x51af('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x51af('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x51af('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x51af('0x3')](_0x51af('0x4'),'beepall',_0x51af('0x5'))}}; \ No newline at end of file +var _0x9a4a=['exports','STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x22f72b,_0x3082dd){var _0x3cbf1c=function(_0x3f8e87){while(--_0x3f8e87){_0x22f72b['push'](_0x22f72b['shift']());}};_0x3cbf1c(++_0x3082dd);}(_0x9a4a,0x1e2));var _0xa9a4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9a4a[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xa9a4('0x0'));module[_0xa9a4('0x1')]={'name':{'type':Sequelize[_0xa9a4('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa9a4('0x2')]},'timeout':{'type':Sequelize[_0xa9a4('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa9a4('0x4')](_0xa9a4('0x5'),'beepall',_0xa9a4('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 9c889cc..5d573e3 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 _0xcba0=['from','team_has_chat_queues','join','user_has_teams','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','forEach','addAgents','spread','removeAgents','isArray','userChatQueue:remove','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','destroy','then','get','ChatQueues','UserProfileResource','error','stack','name','send','index','map','ChatQueue','type','key','where','include','query','findAll','rows','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','describe','getMembers','UserChatQueue','hasOwnProperty','nolimit','sort','pick','ChatQueueId','filter','options','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','format','%s/%s','getTeams','findOne','rawAttributes','order','addTeams','ids','Team','voicePause','flatMap','Agents','transaction','each','emit','userChatQueue:save','removeTeams','field','tq.TeamId'];(function(_0x1ebfc7,_0x2797db){var _0x1627b8=function(_0x59ceee){while(--_0x59ceee){_0x1ebfc7['push'](_0x1ebfc7['shift']());}};_0x1627b8(++_0x2797db);}(_0xcba0,0x177));var _0x0cba=function(_0x3ca086,_0x19a822){_0x3ca086=_0x3ca086-0x0;var _0x337a8c=_0xcba0[_0x3ca086];return _0x337a8c;};'use strict';var BPromise=require(_0x0cba('0x0'));var util=require(_0x0cba('0x1'));var _=require('lodash');var squel=require(_0x0cba('0x2'));var Redis=require(_0x0cba('0x3'));var qs=require(_0x0cba('0x4'));var logger=require('../../config/logger')(_0x0cba('0x5'));var config=require(_0x0cba('0x6'));var db=require(_0x0cba('0x7'))['db'];config[_0x0cba('0x8')]=_[_0x0cba('0x9')](config['redis'],{'host':_0x0cba('0xa'),'port':0x18eb});var socket=require(_0x0cba('0xb'))(new Redis(config[_0x0cba('0x8')]));require('./chatQueue.socket')[_0x0cba('0xc')](socket);function respondWithStatusCode(_0x43deff,_0x27582c){_0x27582c=_0x27582c||0xcc;return function(_0x491b7d){if(_0x491b7d){return _0x43deff[_0x0cba('0xd')](_0x27582c);}return _0x43deff[_0x0cba('0xe')](_0x27582c)[_0x0cba('0xf')]();};}function respondWithResult(_0x28cea8,_0x2c1abe){_0x2c1abe=_0x2c1abe||0xc8;return function(_0xb62714){if(_0xb62714){return _0x28cea8[_0x0cba('0xe')](_0x2c1abe)[_0x0cba('0x10')](_0xb62714);}};}function respondWithFilteredResult(_0x2c5884,_0x3a23cc){return function(_0x208cab){if(_0x208cab){var _0x40dfc3=typeof _0x3a23cc[_0x0cba('0x11')]==='undefined'&&typeof _0x3a23cc[_0x0cba('0x12')]===_0x0cba('0x13');var _0x54e1e1=_0x208cab[_0x0cba('0x14')];var _0x34978c=_0x40dfc3?0x0:_0x3a23cc[_0x0cba('0x11')];var _0x22cded=_0x40dfc3?_0x208cab['count']:_0x3a23cc['offset']+_0x3a23cc[_0x0cba('0x12')];var _0x2af7f5;if(_0x22cded>=_0x54e1e1){_0x22cded=_0x54e1e1;_0x2af7f5=0xc8;}else{_0x2af7f5=0xce;}_0x2c5884[_0x0cba('0xe')](_0x2af7f5);return _0x2c5884[_0x0cba('0x15')](_0x0cba('0x16'),_0x34978c+'-'+_0x22cded+'/'+_0x54e1e1)[_0x0cba('0x10')](_0x208cab);}return null;};}function saveUpdates(_0x1db233){return function(_0x45def){if(_0x45def){return _0x45def[_0x0cba('0x17')](_0x1db233)['then'](function(_0x3b99bc){return _0x3b99bc;});}return null;};}function removeEntity(_0x1809be){return function(_0x495054){if(_0x495054){return _0x495054[_0x0cba('0x18')]()[_0x0cba('0x19')](function(){var _0x3a928d=_0x495054[_0x0cba('0x1a')]({'plain':!![]});var _0x470d86=_0x0cba('0x1b');return db[_0x0cba('0x1c')][_0x0cba('0x18')]({'where':{'type':_0x470d86,'resourceId':_0x3a928d['id']}})[_0x0cba('0x19')](function(){return _0x495054;});})[_0x0cba('0x19')](function(){_0x1809be[_0x0cba('0xe')](0xcc)[_0x0cba('0xf')]();});}};}function handleEntityNotFound(_0x1158ba){return function(_0x17d4a7){if(!_0x17d4a7){_0x1158ba[_0x0cba('0xd')](0x194);}return _0x17d4a7;};}function handleError(_0x3699eb,_0x5aa48f){_0x5aa48f=_0x5aa48f||0x1f4;return function(_0x5983cc){logger[_0x0cba('0x1d')](_0x5983cc[_0x0cba('0x1e')]);if(_0x5983cc[_0x0cba('0x1f')]){delete _0x5983cc[_0x0cba('0x1f')];}_0x3699eb[_0x0cba('0xe')](_0x5aa48f)[_0x0cba('0x20')](_0x5983cc);};}exports[_0x0cba('0x21')]=function(_0x34ab49,_0x3b4477){var _0x29ddcf={};var _0x49219d={'count':0x0,'rows':[]};var _0x3c67ad=_[_0x0cba('0x22')](db[_0x0cba('0x23')]['rawAttributes'],function(_0x2f87dd){return{'name':_0x2f87dd['fieldName'],'type':_0x2f87dd[_0x0cba('0x24')][_0x0cba('0x25')]};});_0x29ddcf=qs['getOptions'](_0x3c67ad,_0x34ab49);var _0x119fa9={'where':_0x29ddcf[_0x0cba('0x26')]};return db[_0x0cba('0x23')][_0x0cba('0x14')](_0x119fa9)[_0x0cba('0x19')](function(_0x454b24){_0x49219d[_0x0cba('0x14')]=_0x454b24;_0x29ddcf[_0x0cba('0x27')]=qs[_0x0cba('0x27')](_0x34ab49[_0x0cba('0x28')]);return db['ChatQueue'][_0x0cba('0x29')](_0x29ddcf);})['then'](function(_0x1947b6){_0x49219d[_0x0cba('0x2a')]=_0x1947b6;return _0x49219d;})[_0x0cba('0x19')](respondWithFilteredResult(_0x3b4477,_0x29ddcf))['catch'](handleError(_0x3b4477,null));};exports[_0x0cba('0x2b')]=function(_0xfb4eee,_0x16eda2){var _0x59b170={'raw':!![],'where':{'id':_0xfb4eee[_0x0cba('0x2c')]['id']}},_0x339287={};_0x339287[_0x0cba('0x2d')]=_[_0x0cba('0x2e')](db[_0x0cba('0x23')]['rawAttributes']);_0x339287[_0x0cba('0x28')]=_[_0x0cba('0x2e')](_0xfb4eee['query']);_0x339287[_0x0cba('0x2f')]=_[_0x0cba('0x30')](_0x339287['model'],_0x339287[_0x0cba('0x28')]);_0x59b170[_0x0cba('0x31')]=_[_0x0cba('0x30')](_0x339287['model'],qs[_0x0cba('0x32')](_0xfb4eee['query'][_0x0cba('0x32')]));_0x59b170[_0x0cba('0x31')]=_0x59b170[_0x0cba('0x31')][_0x0cba('0x33')]?_0x59b170[_0x0cba('0x31')]:_0x339287['model'];if(_0xfb4eee[_0x0cba('0x28')][_0x0cba('0x34')]){_0x59b170[_0x0cba('0x27')]=[{'all':!![]}];}_0x59b170=_[_0x0cba('0x35')]({},_0x59b170,_0xfb4eee['options']);return db['ChatQueue'][_0x0cba('0x36')](_0x59b170)[_0x0cba('0x19')](handleEntityNotFound(_0x16eda2,null))['then'](respondWithResult(_0x16eda2,null))[_0x0cba('0x37')](handleError(_0x16eda2,null));};exports[_0x0cba('0x38')]=function(_0x460a28,_0x4d5eca){return db[_0x0cba('0x23')][_0x0cba('0x38')](_0x460a28[_0x0cba('0x39')],{})[_0x0cba('0x19')](function(_0x570e94){var _0x1e3b34=_0x460a28[_0x0cba('0x3a')][_0x0cba('0x1a')]({'plain':!![]});if(!_0x1e3b34)throw new Error(_0x0cba('0x3b'));if(_0x1e3b34[_0x0cba('0x3c')]===_0x0cba('0x3a')){var _0xc85079=_0x570e94['get']({'plain':!![]});var _0xdb6b56=_0x0cba('0x1b');return db['UserProfileSection'][_0x0cba('0x36')]({'where':{'name':_0xdb6b56,'userProfileId':_0x1e3b34[_0x0cba('0x3d')]},'raw':!![]})[_0x0cba('0x19')](function(_0x3826e5){if(_0x3826e5&&_0x3826e5['autoAssociation']===0x0){return db[_0x0cba('0x1c')][_0x0cba('0x38')]({'name':_0xc85079[_0x0cba('0x1f')],'resourceId':_0xc85079['id'],'type':_0x3826e5[_0x0cba('0x1f')],'sectionId':_0x3826e5['id']},{})[_0x0cba('0x19')](function(){return _0x570e94;});}else{return _0x570e94;}})[_0x0cba('0x37')](function(_0x1516df){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1516df);throw _0x1516df;});}return _0x570e94;})[_0x0cba('0x19')](respondWithResult(_0x4d5eca,0xc9))['catch'](handleError(_0x4d5eca,null));};exports[_0x0cba('0x17')]=function(_0x74f945,_0xd2eb0c){if(_0x74f945[_0x0cba('0x39')]['id']){delete _0x74f945[_0x0cba('0x39')]['id'];}return db['ChatQueue'][_0x0cba('0x36')]({'where':{'id':_0x74f945[_0x0cba('0x2c')]['id']}})[_0x0cba('0x19')](handleEntityNotFound(_0xd2eb0c,null))['then'](saveUpdates(_0x74f945[_0x0cba('0x39')],null))['then'](respondWithResult(_0xd2eb0c,null))[_0x0cba('0x37')](handleError(_0xd2eb0c,null));};exports[_0x0cba('0x18')]=function(_0x1ba136,_0x2fcf2e){return db[_0x0cba('0x23')]['find']({'where':{'id':_0x1ba136[_0x0cba('0x2c')]['id']}})[_0x0cba('0x19')](handleEntityNotFound(_0x2fcf2e,null))[_0x0cba('0x19')](removeEntity(_0x2fcf2e,null))['catch'](handleError(_0x2fcf2e,null));};exports[_0x0cba('0x3e')]=function(_0x2f462e,_0x2e0cff){return db[_0x0cba('0x23')][_0x0cba('0x3e')]()[_0x0cba('0x19')](respondWithResult(_0x2e0cff,null))['catch'](handleError(_0x2e0cff,null));};exports[_0x0cba('0x3f')]=function(_0x36ad4f,_0x32ae34){var _0x47aaeb={'raw':!![],'where':{}},_0x2b73d5={},_0x22ae07;return db[_0x0cba('0x23')]['findOne']({'where':{'id':_0x36ad4f[_0x0cba('0x2c')]['id']}})[_0x0cba('0x19')](handleEntityNotFound(_0x32ae34,null))[_0x0cba('0x19')](function(_0x15db8c){if(_0x15db8c){_0x22ae07=_0x15db8c[_0x0cba('0x1a')]({'plain':!![]});_0x2b73d5[_0x0cba('0x2d')]=_['keys'](db[_0x0cba('0x40')]['rawAttributes']);_0x2b73d5['query']=_[_0x0cba('0x2e')](_0x36ad4f[_0x0cba('0x28')]);_0x2b73d5[_0x0cba('0x2f')]=_[_0x0cba('0x30')](_0x2b73d5[_0x0cba('0x2d')],_0x2b73d5['query']);_0x47aaeb[_0x0cba('0x31')]=_['intersection'](_0x2b73d5['model'],qs[_0x0cba('0x32')](_0x36ad4f[_0x0cba('0x28')][_0x0cba('0x32')]));_0x47aaeb[_0x0cba('0x31')]=_0x47aaeb[_0x0cba('0x31')]['length']?_0x47aaeb[_0x0cba('0x31')]:_0x2b73d5[_0x0cba('0x2d')];if(!_0x36ad4f[_0x0cba('0x28')][_0x0cba('0x41')](_0x0cba('0x42'))){_0x47aaeb[_0x0cba('0x12')]=qs['limit'](_0x36ad4f[_0x0cba('0x28')][_0x0cba('0x12')]);_0x47aaeb[_0x0cba('0x11')]=qs['offset'](_0x36ad4f[_0x0cba('0x28')]['offset']);}_0x47aaeb['order']=qs[_0x0cba('0x43')](_0x36ad4f[_0x0cba('0x28')][_0x0cba('0x43')]);_0x47aaeb[_0x0cba('0x26')]=qs[_0x0cba('0x2f')](_[_0x0cba('0x44')](_0x36ad4f[_0x0cba('0x28')],_0x2b73d5[_0x0cba('0x2f')]));_0x47aaeb['where'][_0x0cba('0x45')]=_0x15db8c['id'];if(_0x36ad4f['query'][_0x0cba('0x46')]){_0x47aaeb[_0x0cba('0x26')]=_[_0x0cba('0x35')](_0x47aaeb[_0x0cba('0x26')],{'$or':_[_0x0cba('0x22')](_0x47aaeb['attributes'],function(_0x5d86db){var _0x5caadd={};_0x5caadd[_0x5d86db]={'$like':'%'+_0x36ad4f[_0x0cba('0x28')][_0x0cba('0x46')]+'%'};return _0x5caadd;})});}_0x47aaeb=_[_0x0cba('0x35')]({},_0x47aaeb,_0x36ad4f[_0x0cba('0x47')]);return db[_0x0cba('0x40')][_0x0cba('0x29')](_0x47aaeb);}})[_0x0cba('0x19')](function(_0x981392){if(_0x981392){return db[_0x0cba('0x48')][_0x0cba('0x49')]({'where':{'id':_['map'](_0x981392,'UserId'),'role':_0x0cba('0x4a')},'attributes':['id',_0x0cba('0x1f'),_0x0cba('0x4b'),_0x0cba('0x4c'),_0x0cba('0x4d')]});}})[_0x0cba('0x19')](function(_0x31fe7f){if(_0x31fe7f){return{'count':_0x31fe7f[_0x0cba('0x14')],'rows':_[_0x0cba('0x22')](_0x31fe7f[_0x0cba('0x2a')],function(_0x527dff){return{'membername':_0x527dff[_0x0cba('0x1f')],'UserId':_0x527dff['id'],'queue_name':_0x22ae07[_0x0cba('0x1f')],'ChatQueueId':_0x22ae07['id'],'interface':util[_0x0cba('0x4e')](_0x0cba('0x4f'),'SIP',_0x527dff[_0x0cba('0x1f')]),'penalty':0x0,'paused':_0x527dff[_0x0cba('0x4b')],'createdAt':_0x527dff[_0x0cba('0x4d')],'updatedAt':_0x527dff[_0x0cba('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0cba('0x19')](respondWithFilteredResult(_0x32ae34,_0x47aaeb))[_0x0cba('0x37')](handleError(_0x32ae34,null));};exports[_0x0cba('0x50')]=function(_0x39f23c,_0x46e419){var _0x4689c0={};var _0x4aad64={};var _0x48b35d;var _0x532236;return db[_0x0cba('0x23')][_0x0cba('0x51')]({'where':{'id':_0x39f23c[_0x0cba('0x2c')]['id']}})['then'](handleEntityNotFound(_0x46e419,null))[_0x0cba('0x19')](function(_0x31e1d0){if(_0x31e1d0){_0x48b35d=_0x31e1d0;_0x4aad64[_0x0cba('0x2d')]=_[_0x0cba('0x2e')](db['Team'][_0x0cba('0x52')]);_0x4aad64[_0x0cba('0x28')]=_[_0x0cba('0x2e')](_0x39f23c[_0x0cba('0x28')]);_0x4aad64[_0x0cba('0x2f')]=_[_0x0cba('0x30')](_0x4aad64['model'],_0x4aad64[_0x0cba('0x28')]);_0x4689c0[_0x0cba('0x31')]=_[_0x0cba('0x30')](_0x4aad64[_0x0cba('0x2d')],qs[_0x0cba('0x32')](_0x39f23c['query'][_0x0cba('0x32')]));_0x4689c0[_0x0cba('0x31')]=_0x4689c0[_0x0cba('0x31')][_0x0cba('0x33')]?_0x4689c0[_0x0cba('0x31')]:_0x4aad64[_0x0cba('0x2d')];_0x4689c0[_0x0cba('0x53')]=qs['sort'](_0x39f23c[_0x0cba('0x28')]['sort']);_0x4689c0['where']=qs[_0x0cba('0x2f')](_[_0x0cba('0x44')](_0x39f23c[_0x0cba('0x28')],_0x4aad64[_0x0cba('0x2f')]));if(_0x39f23c[_0x0cba('0x28')][_0x0cba('0x46')]){_0x4689c0[_0x0cba('0x26')]=_['merge'](_0x4689c0[_0x0cba('0x26')],{'$or':_['map'](_0x4689c0[_0x0cba('0x31')],function(_0x25090e){var _0x4c5dc2={};_0x4c5dc2[_0x25090e]={'$like':'%'+_0x39f23c[_0x0cba('0x28')]['filter']+'%'};return _0x4c5dc2;})});}_0x4689c0=_[_0x0cba('0x35')]({},_0x4689c0,_0x39f23c[_0x0cba('0x47')]);return _0x48b35d[_0x0cba('0x50')](_0x4689c0);}})[_0x0cba('0x19')](function(_0x337d49){if(_0x337d49){_0x532236=_0x337d49[_0x0cba('0x33')];if(!_0x39f23c[_0x0cba('0x28')][_0x0cba('0x41')](_0x0cba('0x42'))){_0x4689c0[_0x0cba('0x12')]=qs[_0x0cba('0x12')](_0x39f23c[_0x0cba('0x28')][_0x0cba('0x12')]);_0x4689c0[_0x0cba('0x11')]=qs[_0x0cba('0x11')](_0x39f23c[_0x0cba('0x28')]['offset']);}return _0x48b35d[_0x0cba('0x50')](_0x4689c0);}})[_0x0cba('0x19')](function(_0x394fc1){if(_0x394fc1){return _0x394fc1?{'count':_0x532236,'rows':_0x394fc1}:null;}})[_0x0cba('0x19')](respondWithResult(_0x46e419,null))[_0x0cba('0x37')](handleError(_0x46e419,null));};exports[_0x0cba('0x54')]=function(_0x51d085,_0x35bebe){var _0xbd4c3b=_0x51d085[_0x0cba('0x39')][_0x0cba('0x55')];return db[_0x0cba('0x56')][_0x0cba('0x29')]({'where':{'id':_0xbd4c3b},'attributes':['id'],'include':[{'model':db[_0x0cba('0x48')],'as':'Agents','attributes':['id',_0x0cba('0x1f'),'online',_0x0cba('0x57'),'interface'],'raw':!![]}]})[_0x0cba('0x19')](function(_0x382f86){if(_0x382f86){var _0x1196b6=_[_0x0cba('0x58')](_0x382f86,function(_0x47da1f){var _0x15a756=_0x47da1f[_0x0cba('0x1a')]({'plain':!![]});return _0x15a756[_0x0cba('0x59')];});return db[_0x0cba('0x23')][_0x0cba('0x36')]({'where':{'id':_0x51d085[_0x0cba('0x2c')]['id']}})[_0x0cba('0x19')](function(_0x34e1d0){return db['sequelize'][_0x0cba('0x5a')](function(_0x8646df){return _0x34e1d0[_0x0cba('0x54')](_0xbd4c3b,{'transaction':_0x8646df})[_0x0cba('0x19')](function(){return BPromise[_0x0cba('0x5b')](_0x1196b6,function(_0x5765e3){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x5765e3['id'],'ChatQueueId':_0x51d085['params']['id']},'transaction':_0x8646df});});})[_0x0cba('0x19')](function(){_0x1196b6['forEach'](function(_0xc1f5cc){socket[_0x0cba('0x5c')](_0x0cba('0x5d'),{'UserId':_0xc1f5cc['id'],'ChatQueueId':_0x34e1d0['id']});});});});});}})[_0x0cba('0x19')](respondWithStatusCode(_0x35bebe,null))[_0x0cba('0x37')](handleError(_0x35bebe,null));};exports[_0x0cba('0x5e')]=function(_0x3b2fe0,_0x2223aa){return db[_0x0cba('0x56')][_0x0cba('0x29')]({'where':{'id':_0x3b2fe0[_0x0cba('0x28')][_0x0cba('0x55')]},'attributes':['id'],'include':[{'model':db[_0x0cba('0x48')],'as':_0x0cba('0x59'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2223aa,null))[_0x0cba('0x19')](function(_0x12ee73){var _0x142437=_['map'](_0x12ee73,'id');var _0x31f225=[];var _0x3a349d=[];var _0x2205a3=squel['select']();_0x2205a3[_0x0cba('0x5f')](_0x0cba('0x60'))[_0x0cba('0x61')](_0x0cba('0x62'),'tq')[_0x0cba('0x63')](_0x0cba('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0cba('0x26')]('ChatQueueId\x20=\x20?',_0x3b2fe0[_0x0cba('0x2c')]['id']);for(var _0x563097=0x0;_0x563097<_0x12ee73[_0x0cba('0x33')];_0x563097+=0x1){let _0x24ba1d=_0x12ee73[_0x563097];for(var _0x4c1b27=0x0;_0x4c1b27<_0x24ba1d[_0x0cba('0x59')][_0x0cba('0x33')];_0x4c1b27+=0x1){let _0x2d224f=_0x24ba1d[_0x0cba('0x59')][_0x4c1b27];var _0x4635ee=_0x2205a3['clone']();_0x4635ee[_0x0cba('0x26')]('ut.UserId\x20=\x20?',_0x2d224f['id']);_0x3a349d[_0x0cba('0x65')](db[_0x0cba('0x66')][_0x0cba('0x28')](_0x4635ee['toString'](),{'type':db[_0x0cba('0x66')][_0x0cba('0x67')][_0x0cba('0x68')]})['then'](function(_0x3d0b57){if(_0x3d0b57[_0x0cba('0x33')]===0x1){return _0x2d224f['id'];}else{var _0x22d9a=_[_0x0cba('0x69')](_['map'](_0x3d0b57,_0x0cba('0x6a')),function(_0x4c27fb){return _[_0x0cba('0x6b')](_0x142437,_0x4c27fb);});if(_0x22d9a){return _0x2d224f['id'];}}}));}}return BPromise['all'](_0x3a349d)['then'](function(_0x2e44fe){_0x31f225=_(_0x31f225)[_0x0cba('0x6c')](_0x2e44fe)[_0x0cba('0x6d')]()[_0x0cba('0x6e')]();return db['ChatQueue'][_0x0cba('0x36')]({'where':{'id':_0x3b2fe0[_0x0cba('0x2c')]['id']}})['then'](function(_0x3c70d0){return db[_0x0cba('0x66')]['transaction'](function(_0x57d213){return _0x3c70d0['removeTeams'](_0x3b2fe0[_0x0cba('0x28')][_0x0cba('0x55')],{'transaction':_0x57d213})[_0x0cba('0x19')](function(){if(!_['isEmpty'](_0x31f225)){return _0x3c70d0['removeAgents'](_0x31f225,{'transaction':_0x57d213});}})[_0x0cba('0x19')](function(){_0x31f225[_0x0cba('0x6f')](function(_0x5e0f06){socket[_0x0cba('0x5c')]('userChatQueue:remove',{'UserId':_0x5e0f06,'ChatQueueId':_0x3c70d0['id']});});});});});});})['then'](respondWithStatusCode(_0x2223aa,null))[_0x0cba('0x37')](handleError(_0x2223aa,null));};exports[_0x0cba('0x70')]=function(_0x312fdf,_0x4c12f7){return db[_0x0cba('0x23')][_0x0cba('0x36')]({'where':{'id':_0x312fdf[_0x0cba('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4c12f7,null))['then'](function(_0x481e79){if(_0x481e79){return _0x481e79['addAgents'](_0x312fdf[_0x0cba('0x39')][_0x0cba('0x55')],_['omit'](_0x312fdf[_0x0cba('0x39')],[_0x0cba('0x55'),'id'])||{})[_0x0cba('0x71')](function(_0x53c1ee){for(var _0x5606fb=0x0;_0x5606fb<_0x312fdf[_0x0cba('0x39')]['ids'][_0x0cba('0x33')];_0x5606fb+=0x1){socket[_0x0cba('0x5c')](_0x0cba('0x5d'),{'UserId':Number(_0x312fdf[_0x0cba('0x39')][_0x0cba('0x55')][_0x5606fb]),'ChatQueueId':Number(_0x312fdf['params']['id'])});}return _0x53c1ee;});}})[_0x0cba('0x19')](respondWithResult(_0x4c12f7,null))[_0x0cba('0x37')](handleError(_0x4c12f7,null));};exports['removeAgents']=function(_0x57e8a8,_0x54fcc6){return db[_0x0cba('0x23')][_0x0cba('0x36')]({'where':{'id':_0x57e8a8['params']['id']}})[_0x0cba('0x19')](handleEntityNotFound(_0x54fcc6,null))[_0x0cba('0x19')](function(_0x85b62f){if(_0x85b62f){return _0x85b62f[_0x0cba('0x72')](_0x57e8a8[_0x0cba('0x28')][_0x0cba('0x55')])[_0x0cba('0x19')](function(){if(_[_0x0cba('0x73')](_0x57e8a8[_0x0cba('0x28')]['ids'])){for(var _0x32a2c4=0x0;_0x32a2c4<_0x57e8a8[_0x0cba('0x28')][_0x0cba('0x55')]['length'];_0x32a2c4+=0x1){socket[_0x0cba('0x5c')](_0x0cba('0x74'),{'UserId':Number(_0x57e8a8[_0x0cba('0x28')][_0x0cba('0x55')][_0x32a2c4]),'ChatQueueId':Number(_0x57e8a8['params']['id'])});}}else{socket[_0x0cba('0x5c')](_0x0cba('0x74'),{'UserId':Number(_0x57e8a8[_0x0cba('0x28')]['ids']),'ChatQueueId':Number(_0x57e8a8[_0x0cba('0x2c')]['id'])});}});}})['then'](respondWithStatusCode(_0x54fcc6,null))[_0x0cba('0x37')](handleError(_0x54fcc6,null));};exports[_0x0cba('0x75')]=function(_0x442b82,_0x42a031){var _0x352e95={};var _0x32d63b={};var _0x1db180;var _0x435518;return db[_0x0cba('0x23')]['findOne']({'where':{'id':_0x442b82['params']['id']}})[_0x0cba('0x19')](handleEntityNotFound(_0x42a031,null))[_0x0cba('0x19')](function(_0x4d70b8){if(_0x4d70b8){_0x1db180=_0x4d70b8;_0x32d63b[_0x0cba('0x2d')]=_[_0x0cba('0x2e')](db[_0x0cba('0x48')][_0x0cba('0x52')]);_0x32d63b[_0x0cba('0x28')]=_['keys'](_0x442b82[_0x0cba('0x28')]);_0x32d63b[_0x0cba('0x2f')]=_[_0x0cba('0x30')](_0x32d63b[_0x0cba('0x2d')],_0x32d63b[_0x0cba('0x28')]);_0x352e95[_0x0cba('0x31')]=_['intersection'](_0x32d63b[_0x0cba('0x2d')],qs['fields'](_0x442b82['query'][_0x0cba('0x32')]));_0x352e95[_0x0cba('0x31')]=_0x352e95['attributes'][_0x0cba('0x33')]?_0x352e95['attributes']:_0x32d63b[_0x0cba('0x2d')];_0x352e95[_0x0cba('0x53')]=qs[_0x0cba('0x43')](_0x442b82['query'][_0x0cba('0x43')]);_0x352e95[_0x0cba('0x26')]=qs[_0x0cba('0x2f')](_[_0x0cba('0x44')](_0x442b82[_0x0cba('0x28')],_0x32d63b[_0x0cba('0x2f')]));if(_0x442b82[_0x0cba('0x28')][_0x0cba('0x46')]){_0x352e95['where']=_[_0x0cba('0x35')](_0x352e95['where'],{'$or':_['map'](_0x352e95['attributes'],function(_0x25f699){var _0x1d288c={};_0x1d288c[_0x25f699]={'$like':'%'+_0x442b82[_0x0cba('0x28')]['filter']+'%'};return _0x1d288c;})});}_0x352e95=_[_0x0cba('0x35')]({},_0x352e95,_0x442b82['options']);return _0x1db180['getAgents'](_0x352e95);}})['then'](function(_0x1d886a){if(_0x1d886a){_0x435518=_0x1d886a['length'];if(!_0x442b82[_0x0cba('0x28')][_0x0cba('0x41')](_0x0cba('0x42'))){_0x352e95[_0x0cba('0x12')]=qs['limit'](_0x442b82[_0x0cba('0x28')][_0x0cba('0x12')]);_0x352e95[_0x0cba('0x11')]=qs[_0x0cba('0x11')](_0x442b82[_0x0cba('0x28')][_0x0cba('0x11')]);}return _0x1db180['getAgents'](_0x352e95);}})[_0x0cba('0x19')](function(_0x3f3d09){if(_0x3f3d09){return _0x3f3d09?{'count':_0x435518,'rows':_0x3f3d09}:null;}})[_0x0cba('0x19')](respondWithResult(_0x42a031,null))['catch'](handleError(_0x42a031,null));}; \ No newline at end of file +var _0x46fa=['field','tq.TeamId','from','join','user_has_teams','clone','toString','SELECT','every','includes','all','union','compact','value','removeAgents','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','./chatQueue.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','then','destroy','get','ChatQueues','sendStatus','error','stack','name','send','ChatQueue','rawAttributes','fieldName','type','getOptions','where','include','findAll','rows','show','params','query','keys','intersection','model','attributes','fields','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','update','describe','getMembers','findOne','UserChatQueue','filters','hasOwnProperty','nolimit','sort','pick','ChatQueueId','filter','map','options','User','findAndCountAll','UserId','agent','createdAt','format','%s/%s','SIP','chatPause','updatedAt','getTeams','Team','addTeams','ids','online','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select'];(function(_0x5d56da,_0x4bb02e){var _0x5ce34b=function(_0x12ca52){while(--_0x12ca52){_0x5d56da['push'](_0x5d56da['shift']());}};_0x5ce34b(++_0x4bb02e);}(_0x46fa,0x183));var _0xa46f=function(_0x3a01ab,_0x7ece7a){_0x3a01ab=_0x3a01ab-0x0;var _0x3e08ed=_0x46fa[_0x3a01ab];return _0x3e08ed;};'use strict';var BPromise=require(_0xa46f('0x0'));var util=require(_0xa46f('0x1'));var _=require(_0xa46f('0x2'));var squel=require(_0xa46f('0x3'));var Redis=require(_0xa46f('0x4'));var qs=require(_0xa46f('0x5'));var logger=require(_0xa46f('0x6'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xa46f('0x7')]=_[_0xa46f('0x8')](config[_0xa46f('0x7')],{'host':_0xa46f('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa46f('0x7')]));require(_0xa46f('0xa'))[_0xa46f('0xb')](socket);function respondWithStatusCode(_0x557bb2,_0x39f33f){_0x39f33f=_0x39f33f||0xcc;return function(_0x5036ac){if(_0x5036ac){return _0x557bb2['sendStatus'](_0x39f33f);}return _0x557bb2[_0xa46f('0xc')](_0x39f33f)[_0xa46f('0xd')]();};}function respondWithResult(_0x47b368,_0x355688){_0x355688=_0x355688||0xc8;return function(_0x1aaade){if(_0x1aaade){return _0x47b368[_0xa46f('0xc')](_0x355688)[_0xa46f('0xe')](_0x1aaade);}};}function respondWithFilteredResult(_0x3e9888,_0x5e5ecf){return function(_0x18f429){if(_0x18f429){var _0x19ed39=typeof _0x5e5ecf[_0xa46f('0xf')]==='undefined'&&typeof _0x5e5ecf[_0xa46f('0x10')]===_0xa46f('0x11');var _0xa9e318=_0x18f429[_0xa46f('0x12')];var _0x2005de=_0x19ed39?0x0:_0x5e5ecf[_0xa46f('0xf')];var _0x11d35e=_0x19ed39?_0x18f429[_0xa46f('0x12')]:_0x5e5ecf['offset']+_0x5e5ecf[_0xa46f('0x10')];var _0x3b10db;if(_0x11d35e>=_0xa9e318){_0x11d35e=_0xa9e318;_0x3b10db=0xc8;}else{_0x3b10db=0xce;}_0x3e9888[_0xa46f('0xc')](_0x3b10db);return _0x3e9888[_0xa46f('0x13')](_0xa46f('0x14'),_0x2005de+'-'+_0x11d35e+'/'+_0xa9e318)[_0xa46f('0xe')](_0x18f429);}return null;};}function saveUpdates(_0x159ff2){return function(_0x1addc3){if(_0x1addc3){return _0x1addc3['update'](_0x159ff2)[_0xa46f('0x15')](function(_0x5cb4cc){return _0x5cb4cc;});}return null;};}function removeEntity(_0x2d573d){return function(_0x313301){if(_0x313301){return _0x313301[_0xa46f('0x16')]()[_0xa46f('0x15')](function(){var _0x266241=_0x313301[_0xa46f('0x17')]({'plain':!![]});var _0x7f05a4=_0xa46f('0x18');return db['UserProfileResource'][_0xa46f('0x16')]({'where':{'type':_0x7f05a4,'resourceId':_0x266241['id']}})['then'](function(){return _0x313301;});})[_0xa46f('0x15')](function(){_0x2d573d[_0xa46f('0xc')](0xcc)[_0xa46f('0xd')]();});}};}function handleEntityNotFound(_0x145bac){return function(_0x11b74d){if(!_0x11b74d){_0x145bac[_0xa46f('0x19')](0x194);}return _0x11b74d;};}function handleError(_0x5dd510,_0x1801ce){_0x1801ce=_0x1801ce||0x1f4;return function(_0x56c03a){logger[_0xa46f('0x1a')](_0x56c03a[_0xa46f('0x1b')]);if(_0x56c03a[_0xa46f('0x1c')]){delete _0x56c03a[_0xa46f('0x1c')];}_0x5dd510[_0xa46f('0xc')](_0x1801ce)[_0xa46f('0x1d')](_0x56c03a);};}exports['index']=function(_0x494ce4,_0x27c866){var _0x80d7fe={};var _0x2f667e={'count':0x0,'rows':[]};var _0x3253b2=_['map'](db[_0xa46f('0x1e')][_0xa46f('0x1f')],function(_0x48d89c){return{'name':_0x48d89c[_0xa46f('0x20')],'type':_0x48d89c[_0xa46f('0x21')]['key']};});_0x80d7fe=qs[_0xa46f('0x22')](_0x3253b2,_0x494ce4);var _0x3b6a25={'where':_0x80d7fe[_0xa46f('0x23')]};return db[_0xa46f('0x1e')][_0xa46f('0x12')](_0x3b6a25)[_0xa46f('0x15')](function(_0x5c557c){_0x2f667e['count']=_0x5c557c;_0x80d7fe[_0xa46f('0x24')]=qs[_0xa46f('0x24')](_0x494ce4['query']);return db[_0xa46f('0x1e')][_0xa46f('0x25')](_0x80d7fe);})[_0xa46f('0x15')](function(_0x259e90){_0x2f667e[_0xa46f('0x26')]=_0x259e90;return _0x2f667e;})[_0xa46f('0x15')](respondWithFilteredResult(_0x27c866,_0x80d7fe))['catch'](handleError(_0x27c866,null));};exports[_0xa46f('0x27')]=function(_0x468941,_0x1f12fd){var _0x278872={'raw':!![],'where':{'id':_0x468941[_0xa46f('0x28')]['id']}},_0x282931={};_0x282931['model']=_['keys'](db[_0xa46f('0x1e')]['rawAttributes']);_0x282931[_0xa46f('0x29')]=_[_0xa46f('0x2a')](_0x468941[_0xa46f('0x29')]);_0x282931['filters']=_[_0xa46f('0x2b')](_0x282931[_0xa46f('0x2c')],_0x282931[_0xa46f('0x29')]);_0x278872[_0xa46f('0x2d')]=_[_0xa46f('0x2b')](_0x282931[_0xa46f('0x2c')],qs[_0xa46f('0x2e')](_0x468941[_0xa46f('0x29')][_0xa46f('0x2e')]));_0x278872[_0xa46f('0x2d')]=_0x278872['attributes'][_0xa46f('0x2f')]?_0x278872[_0xa46f('0x2d')]:_0x282931[_0xa46f('0x2c')];if(_0x468941[_0xa46f('0x29')][_0xa46f('0x30')]){_0x278872[_0xa46f('0x24')]=[{'all':!![]}];}_0x278872=_[_0xa46f('0x31')]({},_0x278872,_0x468941['options']);return db[_0xa46f('0x1e')][_0xa46f('0x32')](_0x278872)[_0xa46f('0x15')](handleEntityNotFound(_0x1f12fd,null))['then'](respondWithResult(_0x1f12fd,null))['catch'](handleError(_0x1f12fd,null));};exports['create']=function(_0x3f77ab,_0x4007aa){return db[_0xa46f('0x1e')][_0xa46f('0x33')](_0x3f77ab[_0xa46f('0x34')],{})[_0xa46f('0x15')](function(_0x2afafb){var _0x20587f=_0x3f77ab[_0xa46f('0x35')][_0xa46f('0x17')]({'plain':!![]});if(!_0x20587f)throw new Error(_0xa46f('0x36'));if(_0x20587f['role']==='user'){var _0x2cf2f4=_0x2afafb[_0xa46f('0x17')]({'plain':!![]});var _0x10d00f='ChatQueues';return db[_0xa46f('0x37')][_0xa46f('0x32')]({'where':{'name':_0x10d00f,'userProfileId':_0x20587f[_0xa46f('0x38')]},'raw':!![]})[_0xa46f('0x15')](function(_0x371f6e){if(_0x371f6e&&_0x371f6e[_0xa46f('0x39')]===0x0){return db[_0xa46f('0x3a')][_0xa46f('0x33')]({'name':_0x2cf2f4['name'],'resourceId':_0x2cf2f4['id'],'type':_0x371f6e[_0xa46f('0x1c')],'sectionId':_0x371f6e['id']},{})[_0xa46f('0x15')](function(){return _0x2afafb;});}else{return _0x2afafb;}})[_0xa46f('0x3b')](function(_0x14c205){logger[_0xa46f('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14c205);throw _0x14c205;});}return _0x2afafb;})[_0xa46f('0x15')](respondWithResult(_0x4007aa,0xc9))[_0xa46f('0x3b')](handleError(_0x4007aa,null));};exports[_0xa46f('0x3c')]=function(_0x469009,_0x56203f){if(_0x469009[_0xa46f('0x34')]['id']){delete _0x469009['body']['id'];}return db['ChatQueue'][_0xa46f('0x32')]({'where':{'id':_0x469009['params']['id']}})[_0xa46f('0x15')](handleEntityNotFound(_0x56203f,null))[_0xa46f('0x15')](saveUpdates(_0x469009[_0xa46f('0x34')],null))[_0xa46f('0x15')](respondWithResult(_0x56203f,null))[_0xa46f('0x3b')](handleError(_0x56203f,null));};exports[_0xa46f('0x16')]=function(_0x5cb1f2,_0xf833db){return db[_0xa46f('0x1e')][_0xa46f('0x32')]({'where':{'id':_0x5cb1f2[_0xa46f('0x28')]['id']}})[_0xa46f('0x15')](handleEntityNotFound(_0xf833db,null))[_0xa46f('0x15')](removeEntity(_0xf833db,null))['catch'](handleError(_0xf833db,null));};exports['describe']=function(_0x480da2,_0x27dca5){return db[_0xa46f('0x1e')][_0xa46f('0x3d')]()['then'](respondWithResult(_0x27dca5,null))[_0xa46f('0x3b')](handleError(_0x27dca5,null));};exports[_0xa46f('0x3e')]=function(_0x281725,_0x442e55){var _0x153b50={'raw':!![],'where':{}},_0x4b6dd0={},_0x3757e8;return db[_0xa46f('0x1e')][_0xa46f('0x3f')]({'where':{'id':_0x281725['params']['id']}})[_0xa46f('0x15')](handleEntityNotFound(_0x442e55,null))[_0xa46f('0x15')](function(_0x412651){if(_0x412651){_0x3757e8=_0x412651[_0xa46f('0x17')]({'plain':!![]});_0x4b6dd0[_0xa46f('0x2c')]=_[_0xa46f('0x2a')](db[_0xa46f('0x40')]['rawAttributes']);_0x4b6dd0['query']=_[_0xa46f('0x2a')](_0x281725[_0xa46f('0x29')]);_0x4b6dd0[_0xa46f('0x41')]=_[_0xa46f('0x2b')](_0x4b6dd0[_0xa46f('0x2c')],_0x4b6dd0['query']);_0x153b50[_0xa46f('0x2d')]=_[_0xa46f('0x2b')](_0x4b6dd0['model'],qs[_0xa46f('0x2e')](_0x281725[_0xa46f('0x29')][_0xa46f('0x2e')]));_0x153b50[_0xa46f('0x2d')]=_0x153b50[_0xa46f('0x2d')][_0xa46f('0x2f')]?_0x153b50[_0xa46f('0x2d')]:_0x4b6dd0[_0xa46f('0x2c')];if(!_0x281725[_0xa46f('0x29')][_0xa46f('0x42')](_0xa46f('0x43'))){_0x153b50['limit']=qs['limit'](_0x281725[_0xa46f('0x29')][_0xa46f('0x10')]);_0x153b50[_0xa46f('0xf')]=qs[_0xa46f('0xf')](_0x281725['query'][_0xa46f('0xf')]);}_0x153b50['order']=qs[_0xa46f('0x44')](_0x281725[_0xa46f('0x29')][_0xa46f('0x44')]);_0x153b50['where']=qs['filters'](_[_0xa46f('0x45')](_0x281725[_0xa46f('0x29')],_0x4b6dd0[_0xa46f('0x41')]));_0x153b50[_0xa46f('0x23')][_0xa46f('0x46')]=_0x412651['id'];if(_0x281725[_0xa46f('0x29')][_0xa46f('0x47')]){_0x153b50[_0xa46f('0x23')]=_[_0xa46f('0x31')](_0x153b50[_0xa46f('0x23')],{'$or':_[_0xa46f('0x48')](_0x153b50[_0xa46f('0x2d')],function(_0x41a521){var _0x8c88dc={};_0x8c88dc[_0x41a521]={'$like':'%'+_0x281725[_0xa46f('0x29')][_0xa46f('0x47')]+'%'};return _0x8c88dc;})});}_0x153b50=_[_0xa46f('0x31')]({},_0x153b50,_0x281725[_0xa46f('0x49')]);return db[_0xa46f('0x40')][_0xa46f('0x25')](_0x153b50);}})[_0xa46f('0x15')](function(_0x50e9b0){if(_0x50e9b0){return db[_0xa46f('0x4a')][_0xa46f('0x4b')]({'where':{'id':_['map'](_0x50e9b0,_0xa46f('0x4c')),'role':_0xa46f('0x4d')},'attributes':['id',_0xa46f('0x1c'),'chatPause','updatedAt',_0xa46f('0x4e')]});}})[_0xa46f('0x15')](function(_0x57574b){if(_0x57574b){return{'count':_0x57574b['count'],'rows':_['map'](_0x57574b[_0xa46f('0x26')],function(_0x528944){return{'membername':_0x528944[_0xa46f('0x1c')],'UserId':_0x528944['id'],'queue_name':_0x3757e8[_0xa46f('0x1c')],'ChatQueueId':_0x3757e8['id'],'interface':util[_0xa46f('0x4f')](_0xa46f('0x50'),_0xa46f('0x51'),_0x528944['name']),'penalty':0x0,'paused':_0x528944[_0xa46f('0x52')],'createdAt':_0x528944[_0xa46f('0x4e')],'updatedAt':_0x528944[_0xa46f('0x53')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa46f('0x15')](respondWithFilteredResult(_0x442e55,_0x153b50))['catch'](handleError(_0x442e55,null));};exports[_0xa46f('0x54')]=function(_0x21d4cb,_0x5a331e){var _0x1104f4={};var _0x48cc8a={};var _0x27f1f8;var _0x5a12ba;return db[_0xa46f('0x1e')]['findOne']({'where':{'id':_0x21d4cb[_0xa46f('0x28')]['id']}})['then'](handleEntityNotFound(_0x5a331e,null))['then'](function(_0x462b52){if(_0x462b52){_0x27f1f8=_0x462b52;_0x48cc8a[_0xa46f('0x2c')]=_[_0xa46f('0x2a')](db[_0xa46f('0x55')][_0xa46f('0x1f')]);_0x48cc8a[_0xa46f('0x29')]=_[_0xa46f('0x2a')](_0x21d4cb['query']);_0x48cc8a[_0xa46f('0x41')]=_[_0xa46f('0x2b')](_0x48cc8a[_0xa46f('0x2c')],_0x48cc8a[_0xa46f('0x29')]);_0x1104f4[_0xa46f('0x2d')]=_['intersection'](_0x48cc8a['model'],qs[_0xa46f('0x2e')](_0x21d4cb[_0xa46f('0x29')][_0xa46f('0x2e')]));_0x1104f4[_0xa46f('0x2d')]=_0x1104f4[_0xa46f('0x2d')]['length']?_0x1104f4['attributes']:_0x48cc8a[_0xa46f('0x2c')];_0x1104f4['order']=qs[_0xa46f('0x44')](_0x21d4cb[_0xa46f('0x29')][_0xa46f('0x44')]);_0x1104f4[_0xa46f('0x23')]=qs[_0xa46f('0x41')](_[_0xa46f('0x45')](_0x21d4cb['query'],_0x48cc8a[_0xa46f('0x41')]));if(_0x21d4cb['query'][_0xa46f('0x47')]){_0x1104f4[_0xa46f('0x23')]=_[_0xa46f('0x31')](_0x1104f4[_0xa46f('0x23')],{'$or':_['map'](_0x1104f4[_0xa46f('0x2d')],function(_0x517934){var _0x20c4a8={};_0x20c4a8[_0x517934]={'$like':'%'+_0x21d4cb[_0xa46f('0x29')][_0xa46f('0x47')]+'%'};return _0x20c4a8;})});}_0x1104f4=_[_0xa46f('0x31')]({},_0x1104f4,_0x21d4cb[_0xa46f('0x49')]);return _0x27f1f8[_0xa46f('0x54')](_0x1104f4);}})[_0xa46f('0x15')](function(_0x2f182c){if(_0x2f182c){_0x5a12ba=_0x2f182c[_0xa46f('0x2f')];if(!_0x21d4cb[_0xa46f('0x29')]['hasOwnProperty'](_0xa46f('0x43'))){_0x1104f4[_0xa46f('0x10')]=qs['limit'](_0x21d4cb['query'][_0xa46f('0x10')]);_0x1104f4[_0xa46f('0xf')]=qs[_0xa46f('0xf')](_0x21d4cb[_0xa46f('0x29')][_0xa46f('0xf')]);}return _0x27f1f8[_0xa46f('0x54')](_0x1104f4);}})[_0xa46f('0x15')](function(_0xde476d){if(_0xde476d){return _0xde476d?{'count':_0x5a12ba,'rows':_0xde476d}:null;}})['then'](respondWithResult(_0x5a331e,null))['catch'](handleError(_0x5a331e,null));};exports[_0xa46f('0x56')]=function(_0x5a24b3,_0x75d68f){var _0x3134ad=_0x5a24b3[_0xa46f('0x34')][_0xa46f('0x57')];return db['Team']['findAll']({'where':{'id':_0x3134ad},'attributes':['id'],'include':[{'model':db[_0xa46f('0x4a')],'as':'Agents','attributes':['id',_0xa46f('0x1c'),_0xa46f('0x58'),_0xa46f('0x59'),_0xa46f('0x5a')],'raw':!![]}]})[_0xa46f('0x15')](function(_0xae0b67){if(_0xae0b67){var _0x102be9=_['flatMap'](_0xae0b67,function(_0x2b51c3){var _0x1b3b77=_0x2b51c3[_0xa46f('0x17')]({'plain':!![]});return _0x1b3b77[_0xa46f('0x5b')];});return db[_0xa46f('0x1e')][_0xa46f('0x32')]({'where':{'id':_0x5a24b3[_0xa46f('0x28')]['id']}})[_0xa46f('0x15')](function(_0x50711c){return db[_0xa46f('0x5c')][_0xa46f('0x5d')](function(_0x51af43){return _0x50711c[_0xa46f('0x56')](_0x3134ad,{'transaction':_0x51af43})['then'](function(){return BPromise[_0xa46f('0x5e')](_0x102be9,function(_0x7dde82){return db[_0xa46f('0x40')][_0xa46f('0x5f')]({'where':{'UserId':_0x7dde82['id'],'ChatQueueId':_0x5a24b3[_0xa46f('0x28')]['id']},'transaction':_0x51af43});});})['then'](function(){_0x102be9[_0xa46f('0x60')](function(_0x403cac){socket[_0xa46f('0x61')](_0xa46f('0x62'),{'UserId':_0x403cac['id'],'ChatQueueId':_0x50711c['id']});});});});});}})['then'](respondWithStatusCode(_0x75d68f,null))['catch'](handleError(_0x75d68f,null));};exports[_0xa46f('0x63')]=function(_0x15d496,_0x4f3d43){return db['Team'][_0xa46f('0x25')]({'where':{'id':_0x15d496['query'][_0xa46f('0x57')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa46f('0x5b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4f3d43,null))[_0xa46f('0x15')](function(_0x2040d8){var _0x3c4cc3=_['map'](_0x2040d8,'id');var _0x370898=[];var _0x24be10=[];var _0x9f4e66=squel[_0xa46f('0x64')]();_0x9f4e66[_0xa46f('0x65')](_0xa46f('0x66'))[_0xa46f('0x67')]('team_has_chat_queues','tq')[_0xa46f('0x68')](_0xa46f('0x69'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa46f('0x23')]('ChatQueueId\x20=\x20?',_0x15d496[_0xa46f('0x28')]['id']);for(var _0x254a77=0x0;_0x254a77<_0x2040d8[_0xa46f('0x2f')];_0x254a77+=0x1){let _0x17287a=_0x2040d8[_0x254a77];for(var _0x5ccfc2=0x0;_0x5ccfc2<_0x17287a[_0xa46f('0x5b')][_0xa46f('0x2f')];_0x5ccfc2+=0x1){let _0x227ff3=_0x17287a[_0xa46f('0x5b')][_0x5ccfc2];var _0x5d0772=_0x9f4e66[_0xa46f('0x6a')]();_0x5d0772[_0xa46f('0x23')]('ut.UserId\x20=\x20?',_0x227ff3['id']);_0x24be10['push'](db[_0xa46f('0x5c')][_0xa46f('0x29')](_0x5d0772[_0xa46f('0x6b')](),{'type':db[_0xa46f('0x5c')]['QueryTypes'][_0xa46f('0x6c')]})[_0xa46f('0x15')](function(_0x3c5783){if(_0x3c5783[_0xa46f('0x2f')]===0x1){return _0x227ff3['id'];}else{var _0x4c3d70=_[_0xa46f('0x6d')](_[_0xa46f('0x48')](_0x3c5783,'TeamId'),function(_0x2f6585){return _[_0xa46f('0x6e')](_0x3c4cc3,_0x2f6585);});if(_0x4c3d70){return _0x227ff3['id'];}}}));}}return BPromise[_0xa46f('0x6f')](_0x24be10)[_0xa46f('0x15')](function(_0x175533){_0x370898=_(_0x370898)[_0xa46f('0x70')](_0x175533)[_0xa46f('0x71')]()[_0xa46f('0x72')]();return db['ChatQueue'][_0xa46f('0x32')]({'where':{'id':_0x15d496[_0xa46f('0x28')]['id']}})['then'](function(_0x3318f1){return db[_0xa46f('0x5c')][_0xa46f('0x5d')](function(_0x1f871d){return _0x3318f1[_0xa46f('0x63')](_0x15d496['query'][_0xa46f('0x57')],{'transaction':_0x1f871d})['then'](function(){if(!_['isEmpty'](_0x370898)){return _0x3318f1[_0xa46f('0x73')](_0x370898,{'transaction':_0x1f871d});}})[_0xa46f('0x15')](function(){_0x370898[_0xa46f('0x60')](function(_0x348f50){socket[_0xa46f('0x61')]('userChatQueue:remove',{'UserId':_0x348f50,'ChatQueueId':_0x3318f1['id']});});});});});});})[_0xa46f('0x15')](respondWithStatusCode(_0x4f3d43,null))['catch'](handleError(_0x4f3d43,null));};exports[_0xa46f('0x74')]=function(_0x179211,_0x39aa8c){return db[_0xa46f('0x1e')][_0xa46f('0x32')]({'where':{'id':_0x179211[_0xa46f('0x28')]['id']}})[_0xa46f('0x15')](handleEntityNotFound(_0x39aa8c,null))[_0xa46f('0x15')](function(_0x14e997){if(_0x14e997){return _0x14e997[_0xa46f('0x74')](_0x179211[_0xa46f('0x34')][_0xa46f('0x57')],_[_0xa46f('0x75')](_0x179211[_0xa46f('0x34')],['ids','id'])||{})[_0xa46f('0x76')](function(_0x30d0d7){for(var _0x1fa32b=0x0;_0x1fa32b<_0x179211[_0xa46f('0x34')][_0xa46f('0x57')]['length'];_0x1fa32b+=0x1){socket[_0xa46f('0x61')](_0xa46f('0x62'),{'UserId':Number(_0x179211[_0xa46f('0x34')][_0xa46f('0x57')][_0x1fa32b]),'ChatQueueId':Number(_0x179211[_0xa46f('0x28')]['id'])});}return _0x30d0d7;});}})['then'](respondWithResult(_0x39aa8c,null))[_0xa46f('0x3b')](handleError(_0x39aa8c,null));};exports[_0xa46f('0x73')]=function(_0x28ace5,_0x230117){return db['ChatQueue'][_0xa46f('0x32')]({'where':{'id':_0x28ace5[_0xa46f('0x28')]['id']}})[_0xa46f('0x15')](handleEntityNotFound(_0x230117,null))[_0xa46f('0x15')](function(_0x5ab6e7){if(_0x5ab6e7){return _0x5ab6e7[_0xa46f('0x73')](_0x28ace5[_0xa46f('0x29')][_0xa46f('0x57')])[_0xa46f('0x15')](function(){if(_[_0xa46f('0x77')](_0x28ace5[_0xa46f('0x29')]['ids'])){for(var _0x3bd26b=0x0;_0x3bd26b<_0x28ace5['query'][_0xa46f('0x57')][_0xa46f('0x2f')];_0x3bd26b+=0x1){socket[_0xa46f('0x61')](_0xa46f('0x78'),{'UserId':Number(_0x28ace5['query']['ids'][_0x3bd26b]),'ChatQueueId':Number(_0x28ace5[_0xa46f('0x28')]['id'])});}}else{socket['emit'](_0xa46f('0x78'),{'UserId':Number(_0x28ace5[_0xa46f('0x29')][_0xa46f('0x57')]),'ChatQueueId':Number(_0x28ace5['params']['id'])});}});}})[_0xa46f('0x15')](respondWithStatusCode(_0x230117,null))['catch'](handleError(_0x230117,null));};exports[_0xa46f('0x79')]=function(_0x130a7d,_0x5bfb2e){var _0x410b19={};var _0x9793c1={};var _0x1ee7ec;var _0x455295;return db[_0xa46f('0x1e')][_0xa46f('0x3f')]({'where':{'id':_0x130a7d['params']['id']}})[_0xa46f('0x15')](handleEntityNotFound(_0x5bfb2e,null))['then'](function(_0x4d8423){if(_0x4d8423){_0x1ee7ec=_0x4d8423;_0x9793c1[_0xa46f('0x2c')]=_['keys'](db['User'][_0xa46f('0x1f')]);_0x9793c1['query']=_[_0xa46f('0x2a')](_0x130a7d[_0xa46f('0x29')]);_0x9793c1[_0xa46f('0x41')]=_[_0xa46f('0x2b')](_0x9793c1[_0xa46f('0x2c')],_0x9793c1['query']);_0x410b19[_0xa46f('0x2d')]=_[_0xa46f('0x2b')](_0x9793c1[_0xa46f('0x2c')],qs[_0xa46f('0x2e')](_0x130a7d['query']['fields']));_0x410b19[_0xa46f('0x2d')]=_0x410b19[_0xa46f('0x2d')][_0xa46f('0x2f')]?_0x410b19[_0xa46f('0x2d')]:_0x9793c1['model'];_0x410b19['order']=qs[_0xa46f('0x44')](_0x130a7d[_0xa46f('0x29')][_0xa46f('0x44')]);_0x410b19[_0xa46f('0x23')]=qs['filters'](_[_0xa46f('0x45')](_0x130a7d['query'],_0x9793c1[_0xa46f('0x41')]));if(_0x130a7d[_0xa46f('0x29')][_0xa46f('0x47')]){_0x410b19['where']=_[_0xa46f('0x31')](_0x410b19[_0xa46f('0x23')],{'$or':_[_0xa46f('0x48')](_0x410b19[_0xa46f('0x2d')],function(_0x408b83){var _0x28c04a={};_0x28c04a[_0x408b83]={'$like':'%'+_0x130a7d[_0xa46f('0x29')][_0xa46f('0x47')]+'%'};return _0x28c04a;})});}_0x410b19=_[_0xa46f('0x31')]({},_0x410b19,_0x130a7d[_0xa46f('0x49')]);return _0x1ee7ec['getAgents'](_0x410b19);}})[_0xa46f('0x15')](function(_0x2f7068){if(_0x2f7068){_0x455295=_0x2f7068[_0xa46f('0x2f')];if(!_0x130a7d['query'][_0xa46f('0x42')](_0xa46f('0x43'))){_0x410b19['limit']=qs[_0xa46f('0x10')](_0x130a7d[_0xa46f('0x29')][_0xa46f('0x10')]);_0x410b19[_0xa46f('0xf')]=qs['offset'](_0x130a7d[_0xa46f('0x29')]['offset']);}return _0x1ee7ec['getAgents'](_0x410b19);}})['then'](function(_0x382476){if(_0x382476){return _0x382476?{'count':_0x455295,'rows':_0x382476}:null;}})[_0xa46f('0x15')](respondWithResult(_0x5bfb2e,null))[_0xa46f('0x3b')](handleError(_0x5bfb2e,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index abbb962..fe0405a 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 _0xb5cd=['ChatQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2889c3,_0x58a387){var _0x687c09=function(_0x363844){while(--_0x363844){_0x2889c3['push'](_0x2889c3['shift']());}};_0x687c09(++_0x58a387);}(_0xb5cd,0x134));var _0xdb5c=function(_0x3147f0,_0x4eba6e){_0x3147f0=_0x3147f0-0x0;var _0x546863=_0xb5cd[_0x3147f0];return _0x546863;};'use strict';var EventEmitter=require(_0xdb5c('0x0'));var ChatQueue=require(_0xdb5c('0x1'))['db'][_0xdb5c('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xdb5c('0x3')](0x0);var events={'afterCreate':_0xdb5c('0x4'),'afterUpdate':'update','afterDestroy':_0xdb5c('0x5')};function emitEvent(_0x1bdadc){return function(_0x3b013f,_0x1dcc3c,_0x27199a){ChatQueueEvents[_0xdb5c('0x6')](_0x1bdadc+':'+_0x3b013f['id'],_0x3b013f);ChatQueueEvents['emit'](_0x1bdadc,_0x3b013f);_0x27199a(null);};}for(var e in events){if(events[_0xdb5c('0x7')](e)){var event=events[e];ChatQueue[_0xdb5c('0x8')](e,emitEvent(event));}}module[_0xdb5c('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0x868a=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x868a,0x14f));var _0xa868=function(_0x2de8fd,_0x3fbf24){_0x2de8fd=_0x2de8fd-0x0;var _0x19f877=_0x868a[_0x2de8fd];return _0x19f877;};'use strict';var EventEmitter=require(_0xa868('0x0'));var ChatQueue=require(_0xa868('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xa868('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa868('0x3'),'afterDestroy':_0xa868('0x4')};function emitEvent(_0x39b154){return function(_0x58bbe2,_0x5d6dca,_0x3bb148){ChatQueueEvents['emit'](_0x39b154+':'+_0x58bbe2['id'],_0x58bbe2);ChatQueueEvents[_0xa868('0x5')](_0x39b154,_0x58bbe2);_0x3bb148(null);};}for(var e in events){if(events[_0xa868('0x6')](e)){var event=events[e];ChatQueue[_0xa868('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 89aea55..40be657 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 _0x1536=['ChatQueue','chat_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes','exports','define'];(function(_0x966628,_0x1a6b89){var _0x18e4a1=function(_0x5817fa){while(--_0x5817fa){_0x966628['push'](_0x966628['shift']());}};_0x18e4a1(++_0x1a6b89);}(_0x1536,0x16e));var _0x6153=function(_0xfb5a95,_0x208590){_0xfb5a95=_0xfb5a95-0x0;var _0x418486=_0x1536[_0xfb5a95];return _0x418486;};'use strict';var _=require(_0x6153('0x0'));var util=require(_0x6153('0x1'));var logger=require(_0x6153('0x2'))('api');var moment=require(_0x6153('0x3'));var BPromise=require(_0x6153('0x4'));var rp=require(_0x6153('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6153('0x6'));var config=require(_0x6153('0x7'));var attributes=require(_0x6153('0x8'));module[_0x6153('0x9')]=function(_0x10f38b,_0x289b97){return _0x10f38b[_0x6153('0xa')](_0x6153('0xb'),attributes,{'tableName':_0x6153('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc40=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','util'];(function(_0x2614b1,_0x458bdb){var _0x2dd254=function(_0x15635a){while(--_0x15635a){_0x2614b1['push'](_0x2614b1['shift']());}};_0x2dd254(++_0x458bdb);}(_0xbc40,0x12a));var _0x0bc4=function(_0x3db443,_0x159906){_0x3db443=_0x3db443-0x0;var _0x72c74f=_0xbc40[_0x3db443];return _0x72c74f;};'use strict';var _=require('lodash');var util=require(_0x0bc4('0x0'));var logger=require('../../config/logger')(_0x0bc4('0x1'));var moment=require(_0x0bc4('0x2'));var BPromise=require(_0x0bc4('0x3'));var rp=require(_0x0bc4('0x4'));var fs=require('fs');var path=require(_0x0bc4('0x5'));var rimraf=require(_0x0bc4('0x6'));var config=require(_0x0bc4('0x7'));var attributes=require(_0x0bc4('0x8'));module[_0x0bc4('0x9')]=function(_0x5d0d35,_0x435bfd){return _0x5d0d35[_0x0bc4('0xa')](_0x0bc4('0xb'),attributes,{'tableName':_0x0bc4('0xc'),'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 54bc737..222cb79 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 _0x689b=['attributes','limit','include','model','map','GetChatQueue','ShowChatQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','ChatQueue','raw','options','where'];(function(_0x38ea36,_0x4790c5){var _0x4c8cdd=function(_0x59dbf0){while(--_0x59dbf0){_0x38ea36['push'](_0x38ea36['shift']());}};_0x4c8cdd(++_0x4790c5);}(_0x689b,0xeb));var _0xb689=function(_0x3346ff,_0x417a52){_0x3346ff=_0x3346ff-0x0;var _0x466585=_0x689b[_0x3346ff];return _0x466585;};'use strict';var _=require(_0xb689('0x0'));var util=require(_0xb689('0x1'));var moment=require(_0xb689('0x2'));var BPromise=require(_0xb689('0x3'));var rs=require(_0xb689('0x4'));var fs=require('fs');var Redis=require(_0xb689('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb689('0x6'))(_0xb689('0x7'));var config=require(_0xb689('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb689('0x9')][_0xb689('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb689('0xb')],{'host':_0xb689('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb689('0xb')]));require(_0xb689('0xd'))[_0xb689('0xe')](socket);function respondWithRpcPromise(_0x3e2f74,_0x2394b9,_0xe35a91){return new BPromise(function(_0x5d3ad6,_0x201e5){return client['request'](_0x3e2f74,_0xe35a91)[_0xb689('0xf')](function(_0x29ddfa){logger[_0xb689('0x10')](_0xb689('0x11'),_0x2394b9,'request\x20sent');logger[_0xb689('0x12')](_0xb689('0x13'),_0x2394b9,'request\x20sent',JSON[_0xb689('0x14')](_0x29ddfa));if(_0x29ddfa[_0xb689('0x15')]){if(_0x29ddfa[_0xb689('0x15')][_0xb689('0x16')]===0x1f4){logger[_0xb689('0x15')](_0xb689('0x11'),_0x2394b9,_0x29ddfa['error'][_0xb689('0x17')]);return _0x201e5(_0x29ddfa[_0xb689('0x15')][_0xb689('0x17')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x2394b9,_0x29ddfa['error']['message']);return _0x5d3ad6(_0x29ddfa['error'][_0xb689('0x17')]);}else{logger[_0xb689('0x10')]('ChatQueue,\x20%s,\x20%s',_0x2394b9,_0xb689('0x18'));_0x5d3ad6(_0x29ddfa[_0xb689('0x19')]['message']);}})[_0xb689('0x1a')](function(_0x4ea72c){logger[_0xb689('0x15')](_0xb689('0x11'),_0x2394b9,_0x4ea72c);_0x201e5(_0x4ea72c);});});}exports['GetChatQueue']=function(_0x49e094){var _0x2ab40e=this;return new Promise(function(_0x550f5f,_0x54f0db){return db[_0xb689('0x1b')]['findAll']({'raw':_0x49e094['options']?_0x49e094['options'][_0xb689('0x1c')]===undefined?!![]:![]:!![],'where':_0x49e094['options']?_0x49e094[_0xb689('0x1d')][_0xb689('0x1e')]||null:null,'attributes':_0x49e094[_0xb689('0x1d')]?_0x49e094[_0xb689('0x1d')][_0xb689('0x1f')]||null:null,'limit':_0x49e094[_0xb689('0x1d')]?_0x49e094[_0xb689('0x1d')][_0xb689('0x20')]||null:null,'include':_0x49e094[_0xb689('0x1d')]?_0x49e094[_0xb689('0x1d')][_0xb689('0x21')]?_['map'](_0x49e094[_0xb689('0x1d')][_0xb689('0x21')],function(_0x32d8ee){return{'model':db[_0x32d8ee[_0xb689('0x22')]],'as':_0x32d8ee['as'],'attributes':_0x32d8ee[_0xb689('0x1f')],'include':_0x32d8ee[_0xb689('0x21')]?_[_0xb689('0x23')](_0x32d8ee['include'],function(_0x413c56){return{'model':db[_0x413c56[_0xb689('0x22')]],'as':_0x413c56['as'],'attributes':_0x413c56[_0xb689('0x1f')],'include':_0x413c56[_0xb689('0x21')]?_[_0xb689('0x23')](_0x413c56[_0xb689('0x21')],function(_0x189fd4){return{'model':db[_0x189fd4[_0xb689('0x22')]],'as':_0x189fd4['as'],'attributes':_0x189fd4[_0xb689('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb689('0xf')](function(_0x456b01){logger['info'](_0xb689('0x24'),_0x49e094);logger[_0xb689('0x12')](_0xb689('0x24'),_0x49e094,JSON['stringify'](_0x456b01));_0x550f5f(_0x456b01);})[_0xb689('0x1a')](function(_0x305809){logger[_0xb689('0x15')](_0xb689('0x24'),_0x305809[_0xb689('0x17')],_0x49e094);_0x54f0db(_0x2ab40e[_0xb689('0x15')](0x1f4,_0x305809[_0xb689('0x17')]));});});};exports[_0xb689('0x25')]=function(_0x39e36f){var _0xf07dd1=this;return new Promise(function(_0x100bfe,_0x6a2c39){return db[_0xb689('0x1b')]['find']({'raw':_0x39e36f[_0xb689('0x1d')]?_0x39e36f[_0xb689('0x1d')][_0xb689('0x1c')]===undefined?!![]:![]:!![],'where':_0x39e36f[_0xb689('0x1d')]?_0x39e36f[_0xb689('0x1d')]['where']||null:null,'attributes':_0x39e36f[_0xb689('0x1d')]?_0x39e36f[_0xb689('0x1d')]['attributes']||null:null,'include':_0x39e36f['options']?_0x39e36f[_0xb689('0x1d')][_0xb689('0x21')]?_[_0xb689('0x23')](_0x39e36f[_0xb689('0x1d')]['include'],function(_0x329e30){return{'model':db[_0x329e30[_0xb689('0x22')]],'as':_0x329e30['as'],'attributes':_0x329e30['attributes'],'include':_0x329e30[_0xb689('0x21')]?_[_0xb689('0x23')](_0x329e30[_0xb689('0x21')],function(_0xa23009){return{'model':db[_0xa23009[_0xb689('0x22')]],'as':_0xa23009['as'],'attributes':_0xa23009[_0xb689('0x1f')],'include':_0xa23009[_0xb689('0x21')]?_[_0xb689('0x23')](_0xa23009[_0xb689('0x21')],function(_0x578a90){return{'model':db[_0x578a90[_0xb689('0x22')]],'as':_0x578a90['as'],'attributes':_0x578a90['attributes']};}):[]};}):[]};}):[]:[]})[_0xb689('0xf')](function(_0x442384){logger[_0xb689('0x10')]('ShowChatQueue',_0x39e36f);logger[_0xb689('0x12')]('ShowChatQueue',_0x39e36f,JSON[_0xb689('0x14')](_0x442384));_0x100bfe(_0x442384);})[_0xb689('0x1a')](function(_0x5f2956){logger[_0xb689('0x15')]('ShowChatQueue',_0x5f2956['message'],_0x39e36f);_0x6a2c39(_0xf07dd1['error'](0x1f4,_0x5f2956[_0xb689('0x17')]));});});}; \ No newline at end of file +var _0xc48e=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatQueue.socket','register','then','info','request\x20sent','stringify','error','code','message','ChatQueue,\x20%s,\x20%s','result','GetChatQueue','options','raw','include','map','model','attributes','catch','ShowChatQueue','ChatQueue','find','where','debug','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0xb6a690,_0x196fc5){var _0x1a3b81=function(_0x44280b){while(--_0x44280b){_0xb6a690['push'](_0xb6a690['shift']());}};_0x1a3b81(++_0x196fc5);}(_0xc48e,0xd7));var _0xec48=function(_0x4240c1,_0x4888c6){_0x4240c1=_0x4240c1-0x0;var _0x223126=_0xc48e[_0x4240c1];return _0x223126;};'use strict';var _=require(_0xec48('0x0'));var util=require('util');var moment=require(_0xec48('0x1'));var BPromise=require('bluebird');var rs=require(_0xec48('0x2'));var fs=require('fs');var Redis=require(_0xec48('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xec48('0x4'))(_0xec48('0x5'));var config=require(_0xec48('0x6'));var jayson=require(_0xec48('0x7'));var client=jayson[_0xec48('0x8')][_0xec48('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xec48('0xa')],{'host':_0xec48('0xb'),'port':0x18eb});var socket=require(_0xec48('0xc'))(new Redis(config[_0xec48('0xa')]));require(_0xec48('0xd'))[_0xec48('0xe')](socket);function respondWithRpcPromise(_0x3322ed,_0x45fa35,_0x1e99a6){return new BPromise(function(_0x167974,_0x2027ee){return client['request'](_0x3322ed,_0x1e99a6)[_0xec48('0xf')](function(_0x148cf9){logger[_0xec48('0x10')]('ChatQueue,\x20%s,\x20%s',_0x45fa35,_0xec48('0x11'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x45fa35,_0xec48('0x11'),JSON[_0xec48('0x12')](_0x148cf9));if(_0x148cf9[_0xec48('0x13')]){if(_0x148cf9[_0xec48('0x13')][_0xec48('0x14')]===0x1f4){logger[_0xec48('0x13')]('ChatQueue,\x20%s,\x20%s',_0x45fa35,_0x148cf9[_0xec48('0x13')][_0xec48('0x15')]);return _0x2027ee(_0x148cf9[_0xec48('0x13')][_0xec48('0x15')]);}logger['error'](_0xec48('0x16'),_0x45fa35,_0x148cf9['error']['message']);return _0x167974(_0x148cf9[_0xec48('0x13')][_0xec48('0x15')]);}else{logger[_0xec48('0x10')](_0xec48('0x16'),_0x45fa35,_0xec48('0x11'));_0x167974(_0x148cf9[_0xec48('0x17')][_0xec48('0x15')]);}})['catch'](function(_0x858d1e){logger['error'](_0xec48('0x16'),_0x45fa35,_0x858d1e);_0x2027ee(_0x858d1e);});});}exports[_0xec48('0x18')]=function(_0x573828){var _0x106a86=this;return new Promise(function(_0x183bc5,_0x5e7cb6){return db['ChatQueue']['findAll']({'raw':_0x573828['options']?_0x573828[_0xec48('0x19')][_0xec48('0x1a')]===undefined?!![]:![]:!![],'where':_0x573828['options']?_0x573828[_0xec48('0x19')]['where']||null:null,'attributes':_0x573828[_0xec48('0x19')]?_0x573828['options']['attributes']||null:null,'limit':_0x573828[_0xec48('0x19')]?_0x573828[_0xec48('0x19')]['limit']||null:null,'include':_0x573828[_0xec48('0x19')]?_0x573828[_0xec48('0x19')][_0xec48('0x1b')]?_[_0xec48('0x1c')](_0x573828[_0xec48('0x19')]['include'],function(_0x190a13){return{'model':db[_0x190a13[_0xec48('0x1d')]],'as':_0x190a13['as'],'attributes':_0x190a13['attributes'],'include':_0x190a13[_0xec48('0x1b')]?_['map'](_0x190a13['include'],function(_0x5c2270){return{'model':db[_0x5c2270[_0xec48('0x1d')]],'as':_0x5c2270['as'],'attributes':_0x5c2270[_0xec48('0x1e')],'include':_0x5c2270[_0xec48('0x1b')]?_[_0xec48('0x1c')](_0x5c2270['include'],function(_0x2426ed){return{'model':db[_0x2426ed[_0xec48('0x1d')]],'as':_0x2426ed['as'],'attributes':_0x2426ed[_0xec48('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xec48('0xf')](function(_0x25f498){logger['info']('GetChatQueue',_0x573828);logger['debug'](_0xec48('0x18'),_0x573828,JSON[_0xec48('0x12')](_0x25f498));_0x183bc5(_0x25f498);})[_0xec48('0x1f')](function(_0x34e423){logger[_0xec48('0x13')](_0xec48('0x18'),_0x34e423['message'],_0x573828);_0x5e7cb6(_0x106a86['error'](0x1f4,_0x34e423['message']));});});};exports[_0xec48('0x20')]=function(_0x59c734){var _0x602776=this;return new Promise(function(_0x3ccaaa,_0x35edea){return db[_0xec48('0x21')][_0xec48('0x22')]({'raw':_0x59c734[_0xec48('0x19')]?_0x59c734[_0xec48('0x19')][_0xec48('0x1a')]===undefined?!![]:![]:!![],'where':_0x59c734[_0xec48('0x19')]?_0x59c734[_0xec48('0x19')][_0xec48('0x23')]||null:null,'attributes':_0x59c734['options']?_0x59c734[_0xec48('0x19')][_0xec48('0x1e')]||null:null,'include':_0x59c734['options']?_0x59c734['options'][_0xec48('0x1b')]?_[_0xec48('0x1c')](_0x59c734[_0xec48('0x19')][_0xec48('0x1b')],function(_0x1a7d90){return{'model':db[_0x1a7d90['model']],'as':_0x1a7d90['as'],'attributes':_0x1a7d90[_0xec48('0x1e')],'include':_0x1a7d90[_0xec48('0x1b')]?_[_0xec48('0x1c')](_0x1a7d90[_0xec48('0x1b')],function(_0x1465b2){return{'model':db[_0x1465b2[_0xec48('0x1d')]],'as':_0x1465b2['as'],'attributes':_0x1465b2['attributes'],'include':_0x1465b2['include']?_[_0xec48('0x1c')](_0x1465b2[_0xec48('0x1b')],function(_0x407943){return{'model':db[_0x407943[_0xec48('0x1d')]],'as':_0x407943['as'],'attributes':_0x407943[_0xec48('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xec48('0xf')](function(_0x361ad8){logger[_0xec48('0x10')](_0xec48('0x20'),_0x59c734);logger[_0xec48('0x24')]('ShowChatQueue',_0x59c734,JSON[_0xec48('0x12')](_0x361ad8));_0x3ccaaa(_0x361ad8);})[_0xec48('0x1f')](function(_0x406c62){logger['error'](_0xec48('0x20'),_0x406c62['message'],_0x59c734);_0x35edea(_0x602776['error'](0x1f4,_0x406c62[_0xec48('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 7910f37..83c2aa9 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 _0xb332=['emit','register','./chatQueue.events','remove','update'];(function(_0x1034bb,_0x4e20b3){var _0x453fdb=function(_0x455356){while(--_0x455356){_0x1034bb['push'](_0x1034bb['shift']());}};_0x453fdb(++_0x4e20b3);}(_0xb332,0xd9));var _0x2b33=function(_0x214266,_0x1f6f52){_0x214266=_0x214266-0x0;var _0x568f75=_0xb332[_0x214266];return _0x568f75;};'use strict';var ChatQueueEvents=require(_0x2b33('0x0'));var events=['save',_0x2b33('0x1'),_0x2b33('0x2')];function createListener(_0x5ee720,_0xf8c6a7){return function(_0x548a70){_0xf8c6a7[_0x2b33('0x3')](_0x5ee720,_0x548a70);};}function removeListener(_0x4c6634,_0x34b111){return function(){ChatQueueEvents['removeListener'](_0x4c6634,_0x34b111);};}exports[_0x2b33('0x4')]=function(_0x22d66){for(var _0x478214=0x0,_0x461d44=events['length'];_0x478214<_0x461d44;_0x478214++){var _0x5ccf2d=events[_0x478214];var _0x4302b7=createListener('chatQueue:'+_0x5ccf2d,_0x22d66);ChatQueueEvents['on'](_0x5ccf2d,_0x4302b7);}}; \ No newline at end of file +var _0x8d0e=['save','remove','update','emit','removeListener','length','chatQueue:','./chatQueue.events'];(function(_0x398d63,_0x3ae789){var _0x1077af=function(_0x145d74){while(--_0x145d74){_0x398d63['push'](_0x398d63['shift']());}};_0x1077af(++_0x3ae789);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x4a9cdc,_0x579008){_0x4a9cdc=_0x4a9cdc-0x0;var _0x43648a=_0x8d0e[_0x4a9cdc];return _0x43648a;};'use strict';var ChatQueueEvents=require(_0xe8d0('0x0'));var events=[_0xe8d0('0x1'),_0xe8d0('0x2'),_0xe8d0('0x3')];function createListener(_0x2eae0c,_0x3584ab){return function(_0x15521e){_0x3584ab[_0xe8d0('0x4')](_0x2eae0c,_0x15521e);};}function removeListener(_0x32cee9,_0x579cb9){return function(){ChatQueueEvents[_0xe8d0('0x5')](_0x32cee9,_0x579cb9);};}exports['register']=function(_0x560dab){for(var _0x2e2985=0x0,_0x92483d=events[_0xe8d0('0x6')];_0x2e2985<_0x92483d;_0x2e2985++){var _0xcc03d0=events[_0x2e2985];var _0x2b6dce=createListener(_0xe8d0('0x7')+_0xcc03d0,_0x560dab);ChatQueueEvents['on'](_0xcc03d0,_0x2b6dce);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 7d44302..5363ef8 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 _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x1b129f,_0x3d1089){var _0x26606a=function(_0x1b8277){while(--_0x1b8277){_0x1b129f['push'](_0x1b129f['shift']());}};_0x26606a(++_0x3d1089);}(_0x7217,0x19e));var _0x7721=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x7217[_0x521929];return _0x632436;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=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(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1e175d,_0x41ff45){_0x1e175d=_0x1e175d-0x0;var _0x3a3ce5=_0x5fc3[_0x1e175d];return _0x3a3ce5;};'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 e33f193..48afc4f 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 _0x0d7b=['STRING','DATE','moment','sequelize','exports'];(function(_0x2c6120,_0x1f3e60){var _0x5fb114=function(_0x45a72d){while(--_0x45a72d){_0x2c6120['push'](_0x2c6120['shift']());}};_0x5fb114(++_0x1f3e60);}(_0x0d7b,0x1ec));var _0xb0d7=function(_0x852060,_0x590cc8){_0x852060=_0x852060-0x0;var _0x2fb01a=_0x0d7b[_0x852060];return _0x2fb01a;};'use strict';var moment=require(_0xb0d7('0x0'));var Sequelize=require(_0xb0d7('0x1'));module[_0xb0d7('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb0d7('0x3')]},'joinAt':{'type':Sequelize[_0xb0d7('0x4')]},'leaveAt':{'type':Sequelize[_0xb0d7('0x4')]},'acceptAt':{'type':Sequelize[_0xb0d7('0x4')]},'exitAt':{'type':Sequelize[_0xb0d7('0x4')]},'reason':{'type':Sequelize[_0xb0d7('0x3')]}}; \ No newline at end of file +var _0xf19b=['exports','STRING','DATE','sequelize'];(function(_0x41b195,_0x5b610e){var _0x94740f=function(_0x870200){while(--_0x870200){_0x41b195['push'](_0x41b195['shift']());}};_0x94740f(++_0x5b610e);}(_0xf19b,0x197));var _0xbf19=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xf19b[_0xefd519];return _0x4bb882;};'use strict';var moment=require('moment');var Sequelize=require(_0xbf19('0x0'));module[_0xbf19('0x1')]={'uniqueid':{'type':Sequelize[_0xbf19('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xbf19('0x2')]},'joinAt':{'type':Sequelize[_0xbf19('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xbf19('0x3')]},'exitAt':{'type':Sequelize[_0xbf19('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 609c0b3..d1e13d1 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 _0x8411=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','length','find','catch','body','describe','zip-dir','fast-json-patch','bluebird','mustache','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/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x5b4c44,_0x2e495e){var _0x58485a=function(_0x13299b){while(--_0x13299b){_0x5b4c44['push'](_0x5b4c44['shift']());}};_0x58485a(++_0x2e495e);}(_0x8411,0x118));var _0x1841=function(_0x34e0db,_0x17cc56){_0x34e0db=_0x34e0db-0x0;var _0x2fc3af=_0x8411[_0x34e0db];return _0x2fc3af;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1841('0x0'));var jsonpatch=require(_0x1841('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1841('0x2'));var Mustache=require(_0x1841('0x3'));var util=require(_0x1841('0x4'));var path=require(_0x1841('0x5'));var sox=require(_0x1841('0x6'));var csv=require('to-csv');var ejs=require(_0x1841('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1841('0x8'));var squel=require(_0x1841('0x9'));var crypto=require(_0x1841('0xa'));var jsforce=require(_0x1841('0xb'));var deskjs=require(_0x1841('0xc'));var toCsv=require(_0x1841('0xd'));var querystring=require(_0x1841('0xe'));var Papa=require(_0x1841('0xf'));var Redis=require(_0x1841('0x10'));var authService=require(_0x1841('0x11'));var qs=require(_0x1841('0x12'));var as=require(_0x1841('0x13'));var hardwareService=require(_0x1841('0x14'));var logger=require(_0x1841('0x15'))(_0x1841('0x16'));var utils=require(_0x1841('0x17'));var config=require(_0x1841('0x18'));var licenseUtil=require(_0x1841('0x19'));var db=require(_0x1841('0x1a'))['db'];function respondWithStatusCode(_0x5d47ac,_0x36438a){_0x36438a=_0x36438a||0xcc;return function(_0x3bfd6f){if(_0x3bfd6f){return _0x5d47ac[_0x1841('0x1b')](_0x36438a);}return _0x5d47ac['status'](_0x36438a)['end']();};}function respondWithResult(_0x415393,_0x443172){_0x443172=_0x443172||0xc8;return function(_0x4c9df4){if(_0x4c9df4){return _0x415393[_0x1841('0x1c')](_0x443172)[_0x1841('0x1d')](_0x4c9df4);}};}function respondWithFilteredResult(_0x3e7e22,_0x287c5e){return function(_0x1e7426){if(_0x1e7426){var _0x224ff2=typeof _0x287c5e['offset']===_0x1841('0x1e')&&typeof _0x287c5e[_0x1841('0x1f')]===_0x1841('0x1e');var _0x34a235=_0x1e7426[_0x1841('0x20')];var _0x16917f=_0x224ff2?0x0:_0x287c5e[_0x1841('0x21')];var _0xeeb608=_0x224ff2?_0x1e7426[_0x1841('0x20')]:_0x287c5e[_0x1841('0x21')]+_0x287c5e[_0x1841('0x1f')];var _0xe44718;if(_0xeeb608>=_0x34a235){_0xeeb608=_0x34a235;_0xe44718=0xc8;}else{_0xe44718=0xce;}_0x3e7e22[_0x1841('0x1c')](_0xe44718);return _0x3e7e22[_0x1841('0x22')]('Content-Range',_0x16917f+'-'+_0xeeb608+'/'+_0x34a235)[_0x1841('0x1d')](_0x1e7426);}return null;};}function patchUpdates(_0x234fb4){return function(_0x31eb0b){try{jsonpatch[_0x1841('0x23')](_0x31eb0b,_0x234fb4,!![]);}catch(_0x5201b3){return BPromise[_0x1841('0x24')](_0x5201b3);}return _0x31eb0b[_0x1841('0x25')]();};}function saveUpdates(_0x4068f0,_0x1ed975){return function(_0x12e1d4){if(_0x12e1d4){return _0x12e1d4[_0x1841('0x26')](_0x4068f0)[_0x1841('0x27')](function(_0x3a546b){return _0x3a546b;});}return null;};}function removeEntity(_0x381c46,_0xb65ca6){return function(_0x168d29){if(_0x168d29){return _0x168d29[_0x1841('0x28')]()[_0x1841('0x27')](function(){_0x381c46['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x137170,_0x4ddeef){return function(_0x1e7491){if(!_0x1e7491){_0x137170[_0x1841('0x1b')](0x194);}return _0x1e7491;};}function handleError(_0xce0a33,_0x16646c){_0x16646c=_0x16646c||0x1f4;return function(_0x272e0e){logger[_0x1841('0x29')](_0x272e0e[_0x1841('0x2a')]);if(_0x272e0e[_0x1841('0x2b')]){delete _0x272e0e[_0x1841('0x2b')];}_0xce0a33[_0x1841('0x1c')](_0x16646c)['send'](_0x272e0e);};}exports['index']=function(_0x2e9f75,_0x2a65e7){var _0x4eddde={},_0x1f0985={},_0x302824={'count':0x0,'rows':[]};var _0x336e60=_[_0x1841('0x2c')](db[_0x1841('0x2d')][_0x1841('0x2e')],function(_0x5181f5){return{'name':_0x5181f5[_0x1841('0x2f')],'type':_0x5181f5[_0x1841('0x30')][_0x1841('0x31')]};});_0x1f0985[_0x1841('0x32')]=_[_0x1841('0x2c')](_0x336e60,_0x1841('0x2b'));_0x1f0985['query']=_[_0x1841('0x33')](_0x2e9f75[_0x1841('0x34')]);_0x1f0985['filters']=_[_0x1841('0x35')](_0x1f0985['model'],_0x1f0985['query']);_0x4eddde[_0x1841('0x36')]=_[_0x1841('0x35')](_0x1f0985[_0x1841('0x32')],qs[_0x1841('0x37')](_0x2e9f75['query'][_0x1841('0x37')]));_0x4eddde[_0x1841('0x36')]=_0x4eddde[_0x1841('0x36')]['length']?_0x4eddde[_0x1841('0x36')]:_0x1f0985[_0x1841('0x32')];if(!_0x2e9f75[_0x1841('0x34')][_0x1841('0x38')](_0x1841('0x39'))){_0x4eddde[_0x1841('0x1f')]=qs['limit'](_0x2e9f75[_0x1841('0x34')][_0x1841('0x1f')]);_0x4eddde['offset']=qs[_0x1841('0x21')](_0x2e9f75['query'][_0x1841('0x21')]);}_0x4eddde[_0x1841('0x3a')]=qs['sort'](_0x2e9f75[_0x1841('0x34')][_0x1841('0x3b')]);_0x4eddde[_0x1841('0x3c')]=qs[_0x1841('0x3d')](_[_0x1841('0x3e')](_0x2e9f75['query'],_0x1f0985[_0x1841('0x3d')]),_0x336e60);if(_0x2e9f75[_0x1841('0x34')][_0x1841('0x3f')]){_0x4eddde[_0x1841('0x3c')]=_[_0x1841('0x40')](_0x4eddde['where'],{'$or':_[_0x1841('0x2c')](_0x336e60,function(_0x548003){if(_0x548003[_0x1841('0x30')]!==_0x1841('0x41')){var _0x4ff7d6={};_0x4ff7d6[_0x548003['name']]={'$like':'%'+_0x2e9f75[_0x1841('0x34')][_0x1841('0x3f')]+'%'};return _0x4ff7d6;}})});}_0x4eddde=_[_0x1841('0x40')]({},_0x4eddde,_0x2e9f75[_0x1841('0x42')]);var _0x19d1a8={'where':_0x4eddde[_0x1841('0x3c')]};return db[_0x1841('0x2d')][_0x1841('0x20')](_0x19d1a8)[_0x1841('0x27')](function(_0x49ef2c){_0x302824[_0x1841('0x20')]=_0x49ef2c;if(_0x2e9f75['query'][_0x1841('0x43')]){_0x4eddde[_0x1841('0x44')]=[{'all':!![]}];}return db[_0x1841('0x2d')][_0x1841('0x45')](_0x4eddde);})[_0x1841('0x27')](function(_0x31be49){_0x302824['rows']=_0x31be49;return _0x302824;})[_0x1841('0x27')](respondWithFilteredResult(_0x2a65e7,_0x4eddde))['catch'](handleError(_0x2a65e7,null));};exports['show']=function(_0x4ea565,_0x5bdd80){var _0x59efe8={'raw':!![],'where':{'id':_0x4ea565[_0x1841('0x46')]['id']}},_0x347d8a={};_0x347d8a['model']=_[_0x1841('0x33')](db['ChatQueueReport'][_0x1841('0x2e')]);_0x347d8a[_0x1841('0x34')]=_[_0x1841('0x33')](_0x4ea565[_0x1841('0x34')]);_0x347d8a[_0x1841('0x3d')]=_[_0x1841('0x35')](_0x347d8a['model'],_0x347d8a[_0x1841('0x34')]);_0x59efe8[_0x1841('0x36')]=_[_0x1841('0x35')](_0x347d8a[_0x1841('0x32')],qs['fields'](_0x4ea565[_0x1841('0x34')][_0x1841('0x37')]));_0x59efe8['attributes']=_0x59efe8[_0x1841('0x36')][_0x1841('0x47')]?_0x59efe8[_0x1841('0x36')]:_0x347d8a[_0x1841('0x32')];if(_0x4ea565[_0x1841('0x34')]['includeAll']){_0x59efe8[_0x1841('0x44')]=[{'all':!![]}];}_0x59efe8=_['merge']({},_0x59efe8,_0x4ea565[_0x1841('0x42')]);return db[_0x1841('0x2d')][_0x1841('0x48')](_0x59efe8)[_0x1841('0x27')](handleEntityNotFound(_0x5bdd80,null))['then'](respondWithResult(_0x5bdd80,null))[_0x1841('0x49')](handleError(_0x5bdd80,null));};exports['create']=function(_0x1c8db7,_0x4ad200){return db[_0x1841('0x2d')]['create'](_0x1c8db7[_0x1841('0x4a')],{})['then'](respondWithResult(_0x4ad200,0xc9))[_0x1841('0x49')](handleError(_0x4ad200,null));};exports[_0x1841('0x26')]=function(_0x3a450e,_0xfd65cf){if(_0x3a450e[_0x1841('0x4a')]['id']){delete _0x3a450e[_0x1841('0x4a')]['id'];}return db[_0x1841('0x2d')][_0x1841('0x48')]({'where':{'id':_0x3a450e[_0x1841('0x46')]['id']}})[_0x1841('0x27')](handleEntityNotFound(_0xfd65cf,null))[_0x1841('0x27')](saveUpdates(_0x3a450e[_0x1841('0x4a')],null))[_0x1841('0x27')](respondWithResult(_0xfd65cf,null))[_0x1841('0x49')](handleError(_0xfd65cf,null));};exports[_0x1841('0x28')]=function(_0x4a196a,_0x29130d){return db['ChatQueueReport'][_0x1841('0x48')]({'where':{'id':_0x4a196a[_0x1841('0x46')]['id']}})[_0x1841('0x27')](handleEntityNotFound(_0x29130d,null))['then'](removeEntity(_0x29130d,null))[_0x1841('0x49')](handleError(_0x29130d,null));};exports[_0x1841('0x4b')]=function(_0x5d19b7,_0x4ac281){return db[_0x1841('0x2d')][_0x1841('0x4b')]()[_0x1841('0x27')](respondWithResult(_0x4ac281,null))[_0x1841('0x49')](handleError(_0x4ac281,null));}; \ No newline at end of file +var _0x7676=['name','send','map','ChatQueueReport','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','catch','show','params','keys','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7676,0xb8));var _0x6767=function(_0x132271,_0x31cc98){_0x132271=_0x132271-0x0;var _0x1eefac=_0x7676[_0x132271];return _0x1eefac;};'use strict';var emlformat=require(_0x6767('0x0'));var rimraf=require(_0x6767('0x1'));var zipdir=require(_0x6767('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6767('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6767('0x4'));var util=require('util');var path=require(_0x6767('0x5'));var sox=require(_0x6767('0x6'));var csv=require(_0x6767('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6767('0x8'));var _=require(_0x6767('0x9'));var squel=require(_0x6767('0xa'));var crypto=require('crypto');var jsforce=require(_0x6767('0xb'));var deskjs=require(_0x6767('0xc'));var toCsv=require(_0x6767('0x7'));var querystring=require(_0x6767('0xd'));var Papa=require(_0x6767('0xe'));var Redis=require(_0x6767('0xf'));var authService=require(_0x6767('0x10'));var qs=require(_0x6767('0x11'));var as=require(_0x6767('0x12'));var hardwareService=require(_0x6767('0x13'));var logger=require(_0x6767('0x14'))(_0x6767('0x15'));var utils=require('../../config/utils');var config=require(_0x6767('0x16'));var licenseUtil=require(_0x6767('0x17'));var db=require(_0x6767('0x18'))['db'];function respondWithStatusCode(_0x4968aa,_0x532c43){_0x532c43=_0x532c43||0xcc;return function(_0xb167cf){if(_0xb167cf){return _0x4968aa[_0x6767('0x19')](_0x532c43);}return _0x4968aa['status'](_0x532c43)[_0x6767('0x1a')]();};}function respondWithResult(_0x37db3f,_0x51f1b0){_0x51f1b0=_0x51f1b0||0xc8;return function(_0x259320){if(_0x259320){return _0x37db3f[_0x6767('0x1b')](_0x51f1b0)[_0x6767('0x1c')](_0x259320);}};}function respondWithFilteredResult(_0x4079c7,_0x549d80){return function(_0x428d2c){if(_0x428d2c){var _0x49b65f=typeof _0x549d80[_0x6767('0x1d')]===_0x6767('0x1e')&&typeof _0x549d80[_0x6767('0x1f')]==='undefined';var _0x2ee252=_0x428d2c['count'];var _0x9ac747=_0x49b65f?0x0:_0x549d80['offset'];var _0x3c309f=_0x49b65f?_0x428d2c['count']:_0x549d80['offset']+_0x549d80[_0x6767('0x1f')];var _0x29359f;if(_0x3c309f>=_0x2ee252){_0x3c309f=_0x2ee252;_0x29359f=0xc8;}else{_0x29359f=0xce;}_0x4079c7['status'](_0x29359f);return _0x4079c7[_0x6767('0x20')](_0x6767('0x21'),_0x9ac747+'-'+_0x3c309f+'/'+_0x2ee252)['json'](_0x428d2c);}return null;};}function patchUpdates(_0x2f5350){return function(_0x4a89c5){try{jsonpatch[_0x6767('0x22')](_0x4a89c5,_0x2f5350,!![]);}catch(_0x51e14e){return BPromise['reject'](_0x51e14e);}return _0x4a89c5[_0x6767('0x23')]();};}function saveUpdates(_0x414e94,_0xa88d6d){return function(_0x5caf8e){if(_0x5caf8e){return _0x5caf8e[_0x6767('0x24')](_0x414e94)[_0x6767('0x25')](function(_0x2bd141){return _0x2bd141;});}return null;};}function removeEntity(_0x378246,_0x315b29){return function(_0x2dace2){if(_0x2dace2){return _0x2dace2[_0x6767('0x26')]()[_0x6767('0x25')](function(){_0x378246[_0x6767('0x1b')](0xcc)[_0x6767('0x1a')]();});}};}function handleEntityNotFound(_0x2a0116,_0x20094e){return function(_0x5c4d0f){if(!_0x5c4d0f){_0x2a0116[_0x6767('0x19')](0x194);}return _0x5c4d0f;};}function handleError(_0x3219d7,_0xc06b4e){_0xc06b4e=_0xc06b4e||0x1f4;return function(_0x58a738){logger[_0x6767('0x27')](_0x58a738[_0x6767('0x28')]);if(_0x58a738['name']){delete _0x58a738[_0x6767('0x29')];}_0x3219d7[_0x6767('0x1b')](_0xc06b4e)[_0x6767('0x2a')](_0x58a738);};}exports['index']=function(_0x373da7,_0x254bf1){var _0xd64868={},_0x428d5f={},_0x58a347={'count':0x0,'rows':[]};var _0x6457af=_[_0x6767('0x2b')](db[_0x6767('0x2c')]['rawAttributes'],function(_0xe9228a){return{'name':_0xe9228a[_0x6767('0x2d')],'type':_0xe9228a['type'][_0x6767('0x2e')]};});_0x428d5f['model']=_[_0x6767('0x2b')](_0x6457af,_0x6767('0x29'));_0x428d5f[_0x6767('0x2f')]=_['keys'](_0x373da7[_0x6767('0x2f')]);_0x428d5f[_0x6767('0x30')]=_[_0x6767('0x31')](_0x428d5f[_0x6767('0x32')],_0x428d5f[_0x6767('0x2f')]);_0xd64868[_0x6767('0x33')]=_[_0x6767('0x31')](_0x428d5f[_0x6767('0x32')],qs[_0x6767('0x34')](_0x373da7['query'][_0x6767('0x34')]));_0xd64868[_0x6767('0x33')]=_0xd64868['attributes'][_0x6767('0x35')]?_0xd64868[_0x6767('0x33')]:_0x428d5f[_0x6767('0x32')];if(!_0x373da7[_0x6767('0x2f')][_0x6767('0x36')]('nolimit')){_0xd64868['limit']=qs[_0x6767('0x1f')](_0x373da7[_0x6767('0x2f')][_0x6767('0x1f')]);_0xd64868[_0x6767('0x1d')]=qs[_0x6767('0x1d')](_0x373da7[_0x6767('0x2f')]['offset']);}_0xd64868[_0x6767('0x37')]=qs[_0x6767('0x38')](_0x373da7[_0x6767('0x2f')][_0x6767('0x38')]);_0xd64868[_0x6767('0x39')]=qs['filters'](_[_0x6767('0x3a')](_0x373da7[_0x6767('0x2f')],_0x428d5f[_0x6767('0x30')]),_0x6457af);if(_0x373da7[_0x6767('0x2f')][_0x6767('0x3b')]){_0xd64868[_0x6767('0x39')]=_[_0x6767('0x3c')](_0xd64868[_0x6767('0x39')],{'$or':_[_0x6767('0x2b')](_0x6457af,function(_0x642c86){if(_0x642c86[_0x6767('0x3d')]!==_0x6767('0x3e')){var _0x42db53={};_0x42db53[_0x642c86['name']]={'$like':'%'+_0x373da7['query'][_0x6767('0x3b')]+'%'};return _0x42db53;}})});}_0xd64868=_['merge']({},_0xd64868,_0x373da7[_0x6767('0x3f')]);var _0x19f408={'where':_0xd64868[_0x6767('0x39')]};return db[_0x6767('0x2c')][_0x6767('0x40')](_0x19f408)[_0x6767('0x25')](function(_0x3c0eb4){_0x58a347[_0x6767('0x40')]=_0x3c0eb4;if(_0x373da7[_0x6767('0x2f')]['includeAll']){_0xd64868[_0x6767('0x41')]=[{'all':!![]}];}return db[_0x6767('0x2c')][_0x6767('0x42')](_0xd64868);})[_0x6767('0x25')](function(_0x164b5c){_0x58a347['rows']=_0x164b5c;return _0x58a347;})[_0x6767('0x25')](respondWithFilteredResult(_0x254bf1,_0xd64868))[_0x6767('0x43')](handleError(_0x254bf1,null));};exports[_0x6767('0x44')]=function(_0x248ecd,_0x3a2c23){var _0x37e1f6={'raw':!![],'where':{'id':_0x248ecd[_0x6767('0x45')]['id']}},_0x8a6bca={};_0x8a6bca['model']=_[_0x6767('0x46')](db[_0x6767('0x2c')]['rawAttributes']);_0x8a6bca[_0x6767('0x2f')]=_[_0x6767('0x46')](_0x248ecd[_0x6767('0x2f')]);_0x8a6bca[_0x6767('0x30')]=_[_0x6767('0x31')](_0x8a6bca[_0x6767('0x32')],_0x8a6bca['query']);_0x37e1f6[_0x6767('0x33')]=_['intersection'](_0x8a6bca[_0x6767('0x32')],qs['fields'](_0x248ecd['query'][_0x6767('0x34')]));_0x37e1f6[_0x6767('0x33')]=_0x37e1f6[_0x6767('0x33')][_0x6767('0x35')]?_0x37e1f6[_0x6767('0x33')]:_0x8a6bca[_0x6767('0x32')];if(_0x248ecd[_0x6767('0x2f')]['includeAll']){_0x37e1f6['include']=[{'all':!![]}];}_0x37e1f6=_[_0x6767('0x3c')]({},_0x37e1f6,_0x248ecd['options']);return db[_0x6767('0x2c')]['find'](_0x37e1f6)['then'](handleEntityNotFound(_0x3a2c23,null))['then'](respondWithResult(_0x3a2c23,null))[_0x6767('0x43')](handleError(_0x3a2c23,null));};exports[_0x6767('0x47')]=function(_0x48068d,_0xc2b3aa){return db[_0x6767('0x2c')][_0x6767('0x47')](_0x48068d['body'],{})[_0x6767('0x25')](respondWithResult(_0xc2b3aa,0xc9))[_0x6767('0x43')](handleError(_0xc2b3aa,null));};exports[_0x6767('0x24')]=function(_0x300829,_0x21b2e8){if(_0x300829['body']['id']){delete _0x300829[_0x6767('0x48')]['id'];}return db[_0x6767('0x2c')][_0x6767('0x49')]({'where':{'id':_0x300829[_0x6767('0x45')]['id']}})[_0x6767('0x25')](handleEntityNotFound(_0x21b2e8,null))['then'](saveUpdates(_0x300829[_0x6767('0x48')],null))[_0x6767('0x25')](respondWithResult(_0x21b2e8,null))['catch'](handleError(_0x21b2e8,null));};exports['destroy']=function(_0x50c817,_0x6397cb){return db[_0x6767('0x2c')][_0x6767('0x49')]({'where':{'id':_0x50c817[_0x6767('0x45')]['id']}})[_0x6767('0x25')](handleEntityNotFound(_0x6397cb,null))[_0x6767('0x25')](removeEntity(_0x6397cb,null))[_0x6767('0x43')](handleError(_0x6397cb,null));};exports[_0x6767('0x4a')]=function(_0x1d6675,_0x32d0c4){return db[_0x6767('0x2c')][_0x6767('0x4a')]()[_0x6767('0x25')](respondWithResult(_0x32d0c4,null))[_0x6767('0x43')](handleError(_0x32d0c4,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 7af8912..9969475 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x53684a,_0x144551){var _0x9dabbb=function(_0x3d89fc){while(--_0x3d89fc){_0x53684a['push'](_0x53684a['shift']());}};_0x9dabbb(++_0x144551);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0xa262f0,_0x41447a){var _0x39700f=function(_0x36bc78){while(--_0x36bc78){_0xa262f0['push'](_0xa262f0['shift']());}};_0x39700f(++_0x41447a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'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/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 8f4bcbc..00277ce 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 _0xf2c2=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','where','attributes','limit'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf2c2,0x132));var _0x2f2c=function(_0x150b05,_0x4b83a2){_0x150b05=_0x150b05-0x0;var _0x10570d=_0xf2c2[_0x150b05];return _0x10570d;};'use strict';var _=require(_0x2f2c('0x0'));var util=require(_0x2f2c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2f2c('0x2'));var fs=require('fs');var Redis=require(_0x2f2c('0x3'));var db=require(_0x2f2c('0x4'))['db'];var utils=require(_0x2f2c('0x5'));var logger=require(_0x2f2c('0x6'))(_0x2f2c('0x7'));var config=require('../../config/environment');var jayson=require(_0x2f2c('0x8'));var client=jayson[_0x2f2c('0x9')][_0x2f2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x485bfd,_0x1d2092,_0x5134e8){return new BPromise(function(_0x47c357,_0x19c5ce){return client[_0x2f2c('0xb')](_0x485bfd,_0x5134e8)[_0x2f2c('0xc')](function(_0x519cfe){logger[_0x2f2c('0xd')](_0x2f2c('0xe'),_0x1d2092,_0x2f2c('0xf'));logger[_0x2f2c('0x10')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x1d2092,'request\x20sent',JSON[_0x2f2c('0x11')](_0x519cfe));if(_0x519cfe[_0x2f2c('0x12')]){if(_0x519cfe[_0x2f2c('0x12')][_0x2f2c('0x13')]===0x1f4){logger[_0x2f2c('0x12')](_0x2f2c('0xe'),_0x1d2092,_0x519cfe['error']['message']);return _0x19c5ce(_0x519cfe[_0x2f2c('0x12')][_0x2f2c('0x14')]);}logger[_0x2f2c('0x12')](_0x2f2c('0xe'),_0x1d2092,_0x519cfe[_0x2f2c('0x12')][_0x2f2c('0x14')]);return _0x47c357(_0x519cfe[_0x2f2c('0x12')][_0x2f2c('0x14')]);}else{logger[_0x2f2c('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x1d2092,_0x2f2c('0xf'));_0x47c357(_0x519cfe[_0x2f2c('0x15')][_0x2f2c('0x14')]);}})[_0x2f2c('0x16')](function(_0x3f36c6){logger[_0x2f2c('0x12')](_0x2f2c('0xe'),_0x1d2092,_0x3f36c6);_0x19c5ce(_0x3f36c6);});});}exports[_0x2f2c('0x17')]=function(_0x4e1350){var _0x52c187=this;return new Promise(function(_0x235cbf,_0x930f8e){return db[_0x2f2c('0x18')][_0x2f2c('0x19')](_0x4e1350[_0x2f2c('0x1a')],{'raw':_0x4e1350[_0x2f2c('0x1b')]?_0x4e1350['options'][_0x2f2c('0x1c')]===undefined?!![]:![]:!![]})[_0x2f2c('0xc')](function(_0x65da07){logger[_0x2f2c('0xd')]('CreateChatQueueReport',_0x4e1350);logger[_0x2f2c('0x10')]('CreateChatQueueReport',_0x4e1350,JSON[_0x2f2c('0x11')](_0x65da07));_0x235cbf(_0x65da07);})[_0x2f2c('0x16')](function(_0x30c6c4){logger['error']('CreateChatQueueReport',_0x30c6c4[_0x2f2c('0x14')],_0x4e1350);_0x930f8e(_0x52c187[_0x2f2c('0x12')](0x1f4,_0x30c6c4[_0x2f2c('0x14')]));});});};exports[_0x2f2c('0x1d')]=function(_0x39730a){var _0x74d3ef=this;return new Promise(function(_0x584d48,_0x41ad3d){return db[_0x2f2c('0x18')][_0x2f2c('0x1e')](_0x39730a['body'],{'raw':_0x39730a[_0x2f2c('0x1b')]?_0x39730a[_0x2f2c('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39730a[_0x2f2c('0x1b')]?_0x39730a[_0x2f2c('0x1b')][_0x2f2c('0x1f')]||null:null,'attributes':_0x39730a[_0x2f2c('0x1b')]?_0x39730a[_0x2f2c('0x1b')][_0x2f2c('0x20')]||null:null,'limit':_0x39730a['options']?_0x39730a[_0x2f2c('0x1b')][_0x2f2c('0x21')]||null:null})[_0x2f2c('0xc')](function(_0x38e921){logger[_0x2f2c('0xd')](_0x2f2c('0x1d'),_0x39730a);logger[_0x2f2c('0x10')](_0x2f2c('0x1d'),_0x39730a,JSON[_0x2f2c('0x11')](_0x38e921));_0x584d48(_0x38e921);})[_0x2f2c('0x16')](function(_0x38bc1e){logger[_0x2f2c('0x12')](_0x2f2c('0x1d'),_0x38bc1e[_0x2f2c('0x14')],_0x39730a);_0x41ad3d(_0x74d3ef[_0x2f2c('0x12')](0x1f4,_0x38bc1e['message']));});});}; \ No newline at end of file +var _0xc1d8=['result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','then','UpdateChatQueueReport','update','where','limit','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message'];(function(_0x1f2dda,_0x539c5f){var _0x29b49e=function(_0x4cba4f){while(--_0x4cba4f){_0x1f2dda['push'](_0x1f2dda['shift']());}};_0x29b49e(++_0x539c5f);}(_0xc1d8,0xec));var _0x8c1d=function(_0x4f43b8,_0x553ffc){_0x4f43b8=_0x4f43b8-0x0;var _0x5d7a96=_0xc1d8[_0x4f43b8];return _0x5d7a96;};'use strict';var _=require(_0x8c1d('0x0'));var util=require(_0x8c1d('0x1'));var moment=require('moment');var BPromise=require(_0x8c1d('0x2'));var rs=require(_0x8c1d('0x3'));var fs=require('fs');var Redis=require(_0x8c1d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8c1d('0x5'))(_0x8c1d('0x6'));var config=require(_0x8c1d('0x7'));var jayson=require(_0x8c1d('0x8'));var client=jayson[_0x8c1d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43953a,_0x2d1f1c,_0x3b032a){return new BPromise(function(_0x5edf0b,_0x8e5360){return client[_0x8c1d('0xa')](_0x43953a,_0x3b032a)['then'](function(_0x5d0c81){logger[_0x8c1d('0xb')](_0x8c1d('0xc'),_0x2d1f1c,'request\x20sent');logger[_0x8c1d('0xd')](_0x8c1d('0xe'),_0x2d1f1c,_0x8c1d('0xf'),JSON[_0x8c1d('0x10')](_0x5d0c81));if(_0x5d0c81['error']){if(_0x5d0c81['error'][_0x8c1d('0x11')]===0x1f4){logger['error'](_0x8c1d('0xc'),_0x2d1f1c,_0x5d0c81[_0x8c1d('0x12')]['message']);return _0x8e5360(_0x5d0c81['error'][_0x8c1d('0x13')]);}logger[_0x8c1d('0x12')](_0x8c1d('0xc'),_0x2d1f1c,_0x5d0c81[_0x8c1d('0x12')]['message']);return _0x5edf0b(_0x5d0c81[_0x8c1d('0x12')][_0x8c1d('0x13')]);}else{logger[_0x8c1d('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x2d1f1c,_0x8c1d('0xf'));_0x5edf0b(_0x5d0c81[_0x8c1d('0x14')][_0x8c1d('0x13')]);}})[_0x8c1d('0x15')](function(_0x2ae148){logger[_0x8c1d('0x12')](_0x8c1d('0xc'),_0x2d1f1c,_0x2ae148);_0x8e5360(_0x2ae148);});});}exports[_0x8c1d('0x16')]=function(_0x1e3b6b){var _0x46545c=this;return new Promise(function(_0xb40b6d,_0x4dc35f){return db[_0x8c1d('0x17')][_0x8c1d('0x18')](_0x1e3b6b[_0x8c1d('0x19')],{'raw':_0x1e3b6b[_0x8c1d('0x1a')]?_0x1e3b6b[_0x8c1d('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x8c1d('0x1b')](function(_0x863a1d){logger[_0x8c1d('0xb')](_0x8c1d('0x16'),_0x1e3b6b);logger[_0x8c1d('0xd')](_0x8c1d('0x16'),_0x1e3b6b,JSON[_0x8c1d('0x10')](_0x863a1d));_0xb40b6d(_0x863a1d);})[_0x8c1d('0x15')](function(_0x388dea){logger[_0x8c1d('0x12')](_0x8c1d('0x16'),_0x388dea[_0x8c1d('0x13')],_0x1e3b6b);_0x4dc35f(_0x46545c[_0x8c1d('0x12')](0x1f4,_0x388dea[_0x8c1d('0x13')]));});});};exports[_0x8c1d('0x1c')]=function(_0x185a9c){var _0x3b0020=this;return new Promise(function(_0xb3028f,_0x309c15){return db[_0x8c1d('0x17')][_0x8c1d('0x1d')](_0x185a9c[_0x8c1d('0x19')],{'raw':_0x185a9c[_0x8c1d('0x1a')]?_0x185a9c[_0x8c1d('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x185a9c[_0x8c1d('0x1a')]?_0x185a9c[_0x8c1d('0x1a')][_0x8c1d('0x1e')]||null:null,'attributes':_0x185a9c[_0x8c1d('0x1a')]?_0x185a9c[_0x8c1d('0x1a')]['attributes']||null:null,'limit':_0x185a9c[_0x8c1d('0x1a')]?_0x185a9c[_0x8c1d('0x1a')][_0x8c1d('0x1f')]||null:null})[_0x8c1d('0x1b')](function(_0x2bae0e){logger['info']('UpdateChatQueueReport',_0x185a9c);logger[_0x8c1d('0xd')](_0x8c1d('0x1c'),_0x185a9c,JSON[_0x8c1d('0x10')](_0x2bae0e));_0xb3028f(_0x2bae0e);})[_0x8c1d('0x15')](function(_0x2ad6fc){logger[_0x8c1d('0x12')](_0x8c1d('0x1c'),_0x2ad6fc[_0x8c1d('0x13')],_0x185a9c);_0x309c15(_0x3b0020[_0x8c1d('0x12')](0x1f4,_0x2ad6fc['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 72ea189..37dc797 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 _0xdaba=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','delete','exports','multer','path'];(function(_0x40889c,_0x73e154){var _0x1e69a3=function(_0x365601){while(--_0x365601){_0x40889c['push'](_0x40889c['shift']());}};_0x1e69a3(++_0x73e154);}(_0xdaba,0xbb));var _0xadab=function(_0x283b0a,_0x2330fc){_0x283b0a=_0x283b0a-0x0;var _0x18bba9=_0xdaba[_0x283b0a];return _0x18bba9;};'use strict';var multer=require(_0xadab('0x0'));var util=require('util');var path=require(_0xadab('0x1'));var timeout=require(_0xadab('0x2'));var express=require('express');var router=express[_0xadab('0x3')]();var fs_extra=require(_0xadab('0x4'));var auth=require(_0xadab('0x5'));var interaction=require(_0xadab('0x6'));var config=require(_0xadab('0x7'));var controller=require(_0xadab('0x8'));router[_0xadab('0x9')]('/',auth[_0xadab('0xa')](),controller[_0xadab('0xb')]);router[_0xadab('0x9')](_0xadab('0xc'),auth['isAuthenticated'](),controller[_0xadab('0xd')]);router[_0xadab('0x9')]('/:id',auth[_0xadab('0xa')](),controller['show']);router[_0xadab('0xe')]('/',auth[_0xadab('0xa')](),controller[_0xadab('0xf')]);router[_0xadab('0x10')](_0xadab('0x11'),auth[_0xadab('0xa')](),controller[_0xadab('0x12')]);router[_0xadab('0x13')](_0xadab('0x11'),auth[_0xadab('0xa')](),controller['destroy']);module[_0xadab('0x14')]=router; \ No newline at end of file +var _0x712c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','destroy','exports','path','connect-timeout','express'];(function(_0x2f5504,_0x482f6a){var _0x55ade3=function(_0x127305){while(--_0x127305){_0x2f5504['push'](_0x2f5504['shift']());}};_0x55ade3(++_0x482f6a);}(_0x712c,0x12f));var _0xc712=function(_0x42f154,_0x32110c){_0x42f154=_0x42f154-0x0;var _0x471993=_0x712c[_0x42f154];return _0x471993;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc712('0x0'));var timeout=require(_0xc712('0x1'));var express=require(_0xc712('0x2'));var router=express[_0xc712('0x3')]();var fs_extra=require(_0xc712('0x4'));var auth=require(_0xc712('0x5'));var interaction=require(_0xc712('0x6'));var config=require(_0xc712('0x7'));var controller=require(_0xc712('0x8'));router[_0xc712('0x9')]('/',auth[_0xc712('0xa')](),controller[_0xc712('0xb')]);router['get']('/describe',auth[_0xc712('0xa')](),controller[_0xc712('0xc')]);router[_0xc712('0x9')](_0xc712('0xd'),auth[_0xc712('0xa')](),controller[_0xc712('0xe')]);router[_0xc712('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc712('0xd'),auth[_0xc712('0xa')](),controller['update']);router['delete'](_0xc712('0xd'),auth[_0xc712('0xa')](),controller[_0xc712('0x10')]);module[_0xc712('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 c0f1eb8..44b1170 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x5a60d8,_0x389c36){var _0x41e628=function(_0x25f9dd){while(--_0x25f9dd){_0x5a60d8['push'](_0x5a60d8['shift']());}};_0x41e628(++_0x389c36);}(_0xaa88,0x137));var _0x8aa8=function(_0x4d67b8,_0x565134){_0x4d67b8=_0x4d67b8-0x0;var _0x55af3b=_0xaa88[_0x4d67b8];return _0x55af3b;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x59c30c,_0x2dab81){var _0x1836b5=function(_0x535fb5){while(--_0x535fb5){_0x59c30c['push'](_0x59c30c['shift']());}};_0x1836b5(++_0x2dab81);}(_0xf4eb,0xec));var _0xbf4e=function(_0x482e5e,_0x354c58){_0x482e5e=_0x482e5e-0x0;var _0x91fb22=_0xf4eb[_0x482e5e];return _0x91fb22;};'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 0dab05e..81f2b41 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 _0x44f6=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','limit','undefined','count','set','apply','reject','save','update','then','sendStatus','error','name','send','index','ChatTransferReport','rawAttributes','fieldName','type','model','map','query','keys','filters','fields','attributes','hasOwnProperty','offset','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','intersection','length','find','create','body','destroy','describe','eml-format'];(function(_0x421924,_0x15d560){var _0x10b657=function(_0x355529){while(--_0x355529){_0x421924['push'](_0x421924['shift']());}};_0x10b657(++_0x15d560);}(_0x44f6,0x171));var _0x644f=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x44f6[_0x4b73a2];return _0x383c66;};'use strict';var emlformat=require(_0x644f('0x0'));var rimraf=require(_0x644f('0x1'));var zipdir=require(_0x644f('0x2'));var jsonpatch=require(_0x644f('0x3'));var rp=require(_0x644f('0x4'));var moment=require(_0x644f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x644f('0x6'));var util=require(_0x644f('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x644f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x644f('0x9'));var _=require(_0x644f('0xa'));var squel=require(_0x644f('0xb'));var crypto=require('crypto');var jsforce=require(_0x644f('0xc'));var deskjs=require(_0x644f('0xd'));var toCsv=require(_0x644f('0x8'));var querystring=require(_0x644f('0xe'));var Papa=require('papaparse');var Redis=require(_0x644f('0xf'));var authService=require(_0x644f('0x10'));var qs=require(_0x644f('0x11'));var as=require(_0x644f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x644f('0x13'))(_0x644f('0x14'));var utils=require(_0x644f('0x15'));var config=require(_0x644f('0x16'));var licenseUtil=require(_0x644f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf97c15,_0x57702c){_0x57702c=_0x57702c||0xcc;return function(_0x1eaf01){if(_0x1eaf01){return _0xf97c15['sendStatus'](_0x57702c);}return _0xf97c15[_0x644f('0x18')](_0x57702c)[_0x644f('0x19')]();};}function respondWithResult(_0x1e52a,_0x592f83){_0x592f83=_0x592f83||0xc8;return function(_0x300124){if(_0x300124){return _0x1e52a['status'](_0x592f83)[_0x644f('0x1a')](_0x300124);}};}function respondWithFilteredResult(_0xe8155c,_0x38c640){return function(_0x4333f4){if(_0x4333f4){var _0x889153=typeof _0x38c640['offset']==='undefined'&&typeof _0x38c640[_0x644f('0x1b')]===_0x644f('0x1c');var _0x1fe32e=_0x4333f4[_0x644f('0x1d')];var _0x59d9b0=_0x889153?0x0:_0x38c640['offset'];var _0x5540a5=_0x889153?_0x4333f4[_0x644f('0x1d')]:_0x38c640['offset']+_0x38c640[_0x644f('0x1b')];var _0x58c2a7;if(_0x5540a5>=_0x1fe32e){_0x5540a5=_0x1fe32e;_0x58c2a7=0xc8;}else{_0x58c2a7=0xce;}_0xe8155c[_0x644f('0x18')](_0x58c2a7);return _0xe8155c[_0x644f('0x1e')]('Content-Range',_0x59d9b0+'-'+_0x5540a5+'/'+_0x1fe32e)[_0x644f('0x1a')](_0x4333f4);}return null;};}function patchUpdates(_0x40e6bf){return function(_0xc783ae){try{jsonpatch[_0x644f('0x1f')](_0xc783ae,_0x40e6bf,!![]);}catch(_0x3497a3){return BPromise[_0x644f('0x20')](_0x3497a3);}return _0xc783ae[_0x644f('0x21')]();};}function saveUpdates(_0x240cdc,_0x3db17c){return function(_0x95d68b){if(_0x95d68b){return _0x95d68b[_0x644f('0x22')](_0x240cdc)['then'](function(_0x3ccb6c){return _0x3ccb6c;});}return null;};}function removeEntity(_0x2d1aa1,_0x4b9fe3){return function(_0x21d97a){if(_0x21d97a){return _0x21d97a['destroy']()[_0x644f('0x23')](function(){_0x2d1aa1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x166706,_0x4d8a94){return function(_0x578c09){if(!_0x578c09){_0x166706[_0x644f('0x24')](0x194);}return _0x578c09;};}function handleError(_0xd601,_0x22add3){_0x22add3=_0x22add3||0x1f4;return function(_0x12f7d3){logger[_0x644f('0x25')](_0x12f7d3['stack']);if(_0x12f7d3[_0x644f('0x26')]){delete _0x12f7d3['name'];}_0xd601[_0x644f('0x18')](_0x22add3)[_0x644f('0x27')](_0x12f7d3);};}exports[_0x644f('0x28')]=function(_0x22e45a,_0x349292){var _0x44a3ac={},_0x21d33f={},_0x266679={'count':0x0,'rows':[]};var _0x414d9a=_['map'](db[_0x644f('0x29')][_0x644f('0x2a')],function(_0x3d8d3f){return{'name':_0x3d8d3f[_0x644f('0x2b')],'type':_0x3d8d3f[_0x644f('0x2c')]['key']};});_0x21d33f[_0x644f('0x2d')]=_[_0x644f('0x2e')](_0x414d9a,'name');_0x21d33f[_0x644f('0x2f')]=_[_0x644f('0x30')](_0x22e45a[_0x644f('0x2f')]);_0x21d33f[_0x644f('0x31')]=_['intersection'](_0x21d33f[_0x644f('0x2d')],_0x21d33f[_0x644f('0x2f')]);_0x44a3ac['attributes']=_['intersection'](_0x21d33f[_0x644f('0x2d')],qs[_0x644f('0x32')](_0x22e45a[_0x644f('0x2f')][_0x644f('0x32')]));_0x44a3ac[_0x644f('0x33')]=_0x44a3ac[_0x644f('0x33')]['length']?_0x44a3ac[_0x644f('0x33')]:_0x21d33f[_0x644f('0x2d')];if(!_0x22e45a['query'][_0x644f('0x34')]('nolimit')){_0x44a3ac[_0x644f('0x1b')]=qs[_0x644f('0x1b')](_0x22e45a[_0x644f('0x2f')][_0x644f('0x1b')]);_0x44a3ac[_0x644f('0x35')]=qs['offset'](_0x22e45a[_0x644f('0x2f')]['offset']);}_0x44a3ac[_0x644f('0x36')]=qs[_0x644f('0x37')](_0x22e45a[_0x644f('0x2f')][_0x644f('0x37')]);_0x44a3ac[_0x644f('0x38')]=qs[_0x644f('0x31')](_['pick'](_0x22e45a[_0x644f('0x2f')],_0x21d33f[_0x644f('0x31')]),_0x414d9a);if(_0x22e45a[_0x644f('0x2f')]['filter']){_0x44a3ac[_0x644f('0x38')]=_[_0x644f('0x39')](_0x44a3ac[_0x644f('0x38')],{'$or':_[_0x644f('0x2e')](_0x414d9a,function(_0x588ab9){if(_0x588ab9[_0x644f('0x2c')]!==_0x644f('0x3a')){var _0x341b37={};_0x341b37[_0x588ab9[_0x644f('0x26')]]={'$like':'%'+_0x22e45a[_0x644f('0x2f')][_0x644f('0x3b')]+'%'};return _0x341b37;}})});}_0x44a3ac=_['merge']({},_0x44a3ac,_0x22e45a[_0x644f('0x3c')]);var _0x4937de={'where':_0x44a3ac[_0x644f('0x38')]};return db['ChatTransferReport']['count'](_0x4937de)[_0x644f('0x23')](function(_0x12c09d){_0x266679[_0x644f('0x1d')]=_0x12c09d;if(_0x22e45a['query'][_0x644f('0x3d')]){_0x44a3ac[_0x644f('0x3e')]=[{'all':!![]}];}return db[_0x644f('0x29')][_0x644f('0x3f')](_0x44a3ac);})[_0x644f('0x23')](function(_0x490de7){_0x266679['rows']=_0x490de7;return _0x266679;})['then'](respondWithFilteredResult(_0x349292,_0x44a3ac))[_0x644f('0x40')](handleError(_0x349292,null));};exports[_0x644f('0x41')]=function(_0x4914f8,_0x3b0951){var _0x544320={'raw':!![],'where':{'id':_0x4914f8[_0x644f('0x42')]['id']}},_0x26a871={};_0x26a871[_0x644f('0x2d')]=_[_0x644f('0x30')](db[_0x644f('0x29')]['rawAttributes']);_0x26a871['query']=_['keys'](_0x4914f8[_0x644f('0x2f')]);_0x26a871[_0x644f('0x31')]=_[_0x644f('0x43')](_0x26a871[_0x644f('0x2d')],_0x26a871['query']);_0x544320[_0x644f('0x33')]=_[_0x644f('0x43')](_0x26a871[_0x644f('0x2d')],qs['fields'](_0x4914f8[_0x644f('0x2f')][_0x644f('0x32')]));_0x544320['attributes']=_0x544320[_0x644f('0x33')][_0x644f('0x44')]?_0x544320[_0x644f('0x33')]:_0x26a871[_0x644f('0x2d')];if(_0x4914f8[_0x644f('0x2f')][_0x644f('0x3d')]){_0x544320[_0x644f('0x3e')]=[{'all':!![]}];}_0x544320=_[_0x644f('0x39')]({},_0x544320,_0x4914f8[_0x644f('0x3c')]);return db[_0x644f('0x29')][_0x644f('0x45')](_0x544320)[_0x644f('0x23')](handleEntityNotFound(_0x3b0951,null))['then'](respondWithResult(_0x3b0951,null))[_0x644f('0x40')](handleError(_0x3b0951,null));};exports[_0x644f('0x46')]=function(_0x5de413,_0x1c045c){return db[_0x644f('0x29')][_0x644f('0x46')](_0x5de413[_0x644f('0x47')],{})[_0x644f('0x23')](respondWithResult(_0x1c045c,0xc9))[_0x644f('0x40')](handleError(_0x1c045c,null));};exports[_0x644f('0x22')]=function(_0x1b6f50,_0x2c677e){if(_0x1b6f50[_0x644f('0x47')]['id']){delete _0x1b6f50[_0x644f('0x47')]['id'];}return db[_0x644f('0x29')][_0x644f('0x45')]({'where':{'id':_0x1b6f50[_0x644f('0x42')]['id']}})['then'](handleEntityNotFound(_0x2c677e,null))[_0x644f('0x23')](saveUpdates(_0x1b6f50[_0x644f('0x47')],null))[_0x644f('0x23')](respondWithResult(_0x2c677e,null))[_0x644f('0x40')](handleError(_0x2c677e,null));};exports[_0x644f('0x48')]=function(_0x3cf45c,_0x2c381a){return db['ChatTransferReport'][_0x644f('0x45')]({'where':{'id':_0x3cf45c[_0x644f('0x42')]['id']}})['then'](handleEntityNotFound(_0x2c381a,null))[_0x644f('0x23')](removeEntity(_0x2c381a,null))[_0x644f('0x40')](handleError(_0x2c381a,null));};exports[_0x644f('0x49')]=function(_0x594c37,_0x5327b4){return db[_0x644f('0x29')][_0x644f('0x49')]()[_0x644f('0x23')](respondWithResult(_0x5327b4,null))['catch'](handleError(_0x5327b4,null));}; \ No newline at end of file +var _0x0dd0=['pick','filters','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','rawAttributes','options','find','create','body','update','destroy','describe','rimraf','zip-dir','request-promise','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','../../config/license/util','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','end','error','stack','name','send','index','map','ChatTransferReport','fieldName','type','key','keys','query','model','attributes','intersection','fields','length','order','sort','where'];(function(_0x5da6f5,_0x14554d){var _0x42ae41=function(_0x240ead){while(--_0x240ead){_0x5da6f5['push'](_0x5da6f5['shift']());}};_0x42ae41(++_0x14554d);}(_0x0dd0,0xa6));var _0x00dd=function(_0x120385,_0x54064d){_0x120385=_0x120385-0x0;var _0x1ccb0f=_0x0dd0[_0x120385];return _0x1ccb0f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x00dd('0x0'));var zipdir=require(_0x00dd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x00dd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x00dd('0x3'));var util=require(_0x00dd('0x4'));var path=require(_0x00dd('0x5'));var sox=require(_0x00dd('0x6'));var csv=require(_0x00dd('0x7'));var ejs=require(_0x00dd('0x8'));var fs=require('fs');var fs_extra=require(_0x00dd('0x9'));var _=require(_0x00dd('0xa'));var squel=require(_0x00dd('0xb'));var crypto=require('crypto');var jsforce=require(_0x00dd('0xc'));var deskjs=require(_0x00dd('0xd'));var toCsv=require(_0x00dd('0x7'));var querystring=require(_0x00dd('0xe'));var Papa=require('papaparse');var Redis=require(_0x00dd('0xf'));var authService=require(_0x00dd('0x10'));var qs=require(_0x00dd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x00dd('0x12'));var logger=require(_0x00dd('0x13'))(_0x00dd('0x14'));var utils=require(_0x00dd('0x15'));var config=require(_0x00dd('0x16'));var licenseUtil=require(_0x00dd('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f175d,_0xa1878a){_0xa1878a=_0xa1878a||0xcc;return function(_0x256949){if(_0x256949){return _0x4f175d['sendStatus'](_0xa1878a);}return _0x4f175d[_0x00dd('0x18')](_0xa1878a)['end']();};}function respondWithResult(_0x1b974f,_0x4937f4){_0x4937f4=_0x4937f4||0xc8;return function(_0x520105){if(_0x520105){return _0x1b974f[_0x00dd('0x18')](_0x4937f4)[_0x00dd('0x19')](_0x520105);}};}function respondWithFilteredResult(_0x132553,_0xaa3fe0){return function(_0x537288){if(_0x537288){var _0x37e853=typeof _0xaa3fe0['offset']===_0x00dd('0x1a')&&typeof _0xaa3fe0[_0x00dd('0x1b')]===_0x00dd('0x1a');var _0x148679=_0x537288[_0x00dd('0x1c')];var _0x106531=_0x37e853?0x0:_0xaa3fe0['offset'];var _0xecf272=_0x37e853?_0x537288[_0x00dd('0x1c')]:_0xaa3fe0[_0x00dd('0x1d')]+_0xaa3fe0[_0x00dd('0x1b')];var _0x2e36e9;if(_0xecf272>=_0x148679){_0xecf272=_0x148679;_0x2e36e9=0xc8;}else{_0x2e36e9=0xce;}_0x132553[_0x00dd('0x18')](_0x2e36e9);return _0x132553[_0x00dd('0x1e')](_0x00dd('0x1f'),_0x106531+'-'+_0xecf272+'/'+_0x148679)[_0x00dd('0x19')](_0x537288);}return null;};}function patchUpdates(_0x1e69a9){return function(_0x54ad91){try{jsonpatch[_0x00dd('0x20')](_0x54ad91,_0x1e69a9,!![]);}catch(_0x50bdf0){return BPromise[_0x00dd('0x21')](_0x50bdf0);}return _0x54ad91['save']();};}function saveUpdates(_0x3fbd6c,_0xb06e1f){return function(_0x4ff358){if(_0x4ff358){return _0x4ff358['update'](_0x3fbd6c)[_0x00dd('0x22')](function(_0x714aa7){return _0x714aa7;});}return null;};}function removeEntity(_0x358f59,_0x3f3d77){return function(_0x92f540){if(_0x92f540){return _0x92f540['destroy']()[_0x00dd('0x22')](function(){_0x358f59[_0x00dd('0x18')](0xcc)[_0x00dd('0x23')]();});}};}function handleEntityNotFound(_0x11b610,_0x374c5d){return function(_0x35e86f){if(!_0x35e86f){_0x11b610['sendStatus'](0x194);}return _0x35e86f;};}function handleError(_0x12c2f7,_0x49f510){_0x49f510=_0x49f510||0x1f4;return function(_0x54a89e){logger[_0x00dd('0x24')](_0x54a89e[_0x00dd('0x25')]);if(_0x54a89e[_0x00dd('0x26')]){delete _0x54a89e[_0x00dd('0x26')];}_0x12c2f7[_0x00dd('0x18')](_0x49f510)[_0x00dd('0x27')](_0x54a89e);};}exports[_0x00dd('0x28')]=function(_0x24d488,_0x270e82){var _0x36ec15={},_0x5b995f={},_0x2a03ad={'count':0x0,'rows':[]};var _0x1efdda=_[_0x00dd('0x29')](db[_0x00dd('0x2a')]['rawAttributes'],function(_0x5b30e6){return{'name':_0x5b30e6[_0x00dd('0x2b')],'type':_0x5b30e6[_0x00dd('0x2c')][_0x00dd('0x2d')]};});_0x5b995f['model']=_['map'](_0x1efdda,_0x00dd('0x26'));_0x5b995f['query']=_[_0x00dd('0x2e')](_0x24d488[_0x00dd('0x2f')]);_0x5b995f['filters']=_['intersection'](_0x5b995f[_0x00dd('0x30')],_0x5b995f['query']);_0x36ec15[_0x00dd('0x31')]=_[_0x00dd('0x32')](_0x5b995f['model'],qs[_0x00dd('0x33')](_0x24d488['query'][_0x00dd('0x33')]));_0x36ec15['attributes']=_0x36ec15['attributes'][_0x00dd('0x34')]?_0x36ec15[_0x00dd('0x31')]:_0x5b995f['model'];if(!_0x24d488[_0x00dd('0x2f')]['hasOwnProperty']('nolimit')){_0x36ec15['limit']=qs['limit'](_0x24d488[_0x00dd('0x2f')][_0x00dd('0x1b')]);_0x36ec15['offset']=qs[_0x00dd('0x1d')](_0x24d488[_0x00dd('0x2f')][_0x00dd('0x1d')]);}_0x36ec15[_0x00dd('0x35')]=qs[_0x00dd('0x36')](_0x24d488['query'][_0x00dd('0x36')]);_0x36ec15[_0x00dd('0x37')]=qs['filters'](_[_0x00dd('0x38')](_0x24d488[_0x00dd('0x2f')],_0x5b995f[_0x00dd('0x39')]),_0x1efdda);if(_0x24d488['query'][_0x00dd('0x3a')]){_0x36ec15['where']=_[_0x00dd('0x3b')](_0x36ec15[_0x00dd('0x37')],{'$or':_[_0x00dd('0x29')](_0x1efdda,function(_0x482bef){if(_0x482bef[_0x00dd('0x2c')]!==_0x00dd('0x3c')){var _0x5bfa2c={};_0x5bfa2c[_0x482bef[_0x00dd('0x26')]]={'$like':'%'+_0x24d488[_0x00dd('0x2f')][_0x00dd('0x3a')]+'%'};return _0x5bfa2c;}})});}_0x36ec15=_[_0x00dd('0x3b')]({},_0x36ec15,_0x24d488['options']);var _0x22e285={'where':_0x36ec15[_0x00dd('0x37')]};return db[_0x00dd('0x2a')][_0x00dd('0x1c')](_0x22e285)[_0x00dd('0x22')](function(_0x59af2b){_0x2a03ad[_0x00dd('0x1c')]=_0x59af2b;if(_0x24d488['query'][_0x00dd('0x3d')]){_0x36ec15[_0x00dd('0x3e')]=[{'all':!![]}];}return db[_0x00dd('0x2a')]['findAll'](_0x36ec15);})[_0x00dd('0x22')](function(_0x222778){_0x2a03ad[_0x00dd('0x3f')]=_0x222778;return _0x2a03ad;})['then'](respondWithFilteredResult(_0x270e82,_0x36ec15))[_0x00dd('0x40')](handleError(_0x270e82,null));};exports['show']=function(_0x3df394,_0x46e6fe){var _0x5df38b={'raw':!![],'where':{'id':_0x3df394[_0x00dd('0x41')]['id']}},_0x2f6876={};_0x2f6876[_0x00dd('0x30')]=_['keys'](db[_0x00dd('0x2a')][_0x00dd('0x42')]);_0x2f6876[_0x00dd('0x2f')]=_[_0x00dd('0x2e')](_0x3df394[_0x00dd('0x2f')]);_0x2f6876[_0x00dd('0x39')]=_[_0x00dd('0x32')](_0x2f6876[_0x00dd('0x30')],_0x2f6876[_0x00dd('0x2f')]);_0x5df38b[_0x00dd('0x31')]=_[_0x00dd('0x32')](_0x2f6876['model'],qs[_0x00dd('0x33')](_0x3df394[_0x00dd('0x2f')][_0x00dd('0x33')]));_0x5df38b[_0x00dd('0x31')]=_0x5df38b[_0x00dd('0x31')]['length']?_0x5df38b['attributes']:_0x2f6876['model'];if(_0x3df394[_0x00dd('0x2f')][_0x00dd('0x3d')]){_0x5df38b[_0x00dd('0x3e')]=[{'all':!![]}];}_0x5df38b=_['merge']({},_0x5df38b,_0x3df394[_0x00dd('0x43')]);return db['ChatTransferReport'][_0x00dd('0x44')](_0x5df38b)[_0x00dd('0x22')](handleEntityNotFound(_0x46e6fe,null))[_0x00dd('0x22')](respondWithResult(_0x46e6fe,null))['catch'](handleError(_0x46e6fe,null));};exports[_0x00dd('0x45')]=function(_0x28dd88,_0x27e831){return db[_0x00dd('0x2a')][_0x00dd('0x45')](_0x28dd88[_0x00dd('0x46')],{})['then'](respondWithResult(_0x27e831,0xc9))[_0x00dd('0x40')](handleError(_0x27e831,null));};exports[_0x00dd('0x47')]=function(_0x2e4bd2,_0xfae863){if(_0x2e4bd2[_0x00dd('0x46')]['id']){delete _0x2e4bd2[_0x00dd('0x46')]['id'];}return db['ChatTransferReport'][_0x00dd('0x44')]({'where':{'id':_0x2e4bd2['params']['id']}})[_0x00dd('0x22')](handleEntityNotFound(_0xfae863,null))['then'](saveUpdates(_0x2e4bd2['body'],null))[_0x00dd('0x22')](respondWithResult(_0xfae863,null))[_0x00dd('0x40')](handleError(_0xfae863,null));};exports[_0x00dd('0x48')]=function(_0x194a14,_0x155ad2){return db['ChatTransferReport'][_0x00dd('0x44')]({'where':{'id':_0x194a14[_0x00dd('0x41')]['id']}})[_0x00dd('0x22')](handleEntityNotFound(_0x155ad2,null))['then'](removeEntity(_0x155ad2,null))[_0x00dd('0x40')](handleError(_0x155ad2,null));};exports[_0x00dd('0x49')]=function(_0x50ce6e,_0x14307b){return db[_0x00dd('0x2a')][_0x00dd('0x49')]()['then'](respondWithResult(_0x14307b,null))[_0x00dd('0x40')](handleError(_0x14307b,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 7353028..05473b5 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 _0x7b4d=['define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','api','request-promise','path','../../config/environment'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x7b4d,0x16c));var _0xd7b4=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0x7b4d[_0x2d4421];return _0x2d3b01;};'use strict';var _=require(_0xd7b4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd7b4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd7b4('0x2'));var fs=require('fs');var path=require(_0xd7b4('0x3'));var rimraf=require('rimraf');var config=require(_0xd7b4('0x4'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x541cfa,_0x50b7bb){return _0x541cfa[_0xd7b4('0x5')](_0xd7b4('0x6'),attributes,{'tableName':_0xd7b4('0x7'),'paranoid':![],'indexes':[{'name':_0xd7b4('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x63fa=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport'];(function(_0x56b4a6,_0x4ff3a6){var _0x102123=function(_0x3775d2){while(--_0x3775d2){_0x56b4a6['push'](_0x56b4a6['shift']());}};_0x102123(++_0x4ff3a6);}(_0x63fa,0x152));var _0xa63f=function(_0x36173a,_0x3cce53){_0x36173a=_0x36173a-0x0;var _0x1b06ac=_0x63fa[_0x36173a];return _0x1b06ac;};'use strict';var _=require(_0xa63f('0x0'));var util=require(_0xa63f('0x1'));var logger=require(_0xa63f('0x2'))(_0xa63f('0x3'));var moment=require(_0xa63f('0x4'));var BPromise=require(_0xa63f('0x5'));var rp=require(_0xa63f('0x6'));var fs=require('fs');var path=require(_0xa63f('0x7'));var rimraf=require('rimraf');var config=require(_0xa63f('0x8'));var attributes=require(_0xa63f('0x9'));module[_0xa63f('0xa')]=function(_0x320975,_0x5274c0){return _0x320975['define'](_0xa63f('0xb'),attributes,{'tableName':_0xa63f('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa63f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 32b64c0..9486686 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 _0x4e80=['stringify','error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','ChatTransferReport,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x2e7426,_0x21caa7){var _0x4ddeb6=function(_0x37c23c){while(--_0x37c23c){_0x2e7426['push'](_0x2e7426['shift']());}};_0x4ddeb6(++_0x21caa7);}(_0x4e80,0x12d));var _0x04e8=function(_0x26a9ad,_0x11a04f){_0x26a9ad=_0x26a9ad-0x0;var _0x31d9bc=_0x4e80[_0x26a9ad];return _0x31d9bc;};'use strict';var _=require(_0x04e8('0x0'));var util=require(_0x04e8('0x1'));var moment=require('moment');var BPromise=require(_0x04e8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04e8('0x3'));var db=require(_0x04e8('0x4'))['db'];var utils=require(_0x04e8('0x5'));var logger=require(_0x04e8('0x6'))('rpc');var config=require(_0x04e8('0x7'));var jayson=require(_0x04e8('0x8'));var client=jayson['client'][_0x04e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27cc16,_0x163325,_0x2709ff){return new BPromise(function(_0x34fc04,_0x4e9b75){return client['request'](_0x27cc16,_0x2709ff)[_0x04e8('0xa')](function(_0x4ac3b7){logger['info'](_0x04e8('0xb'),_0x163325,'request\x20sent');logger[_0x04e8('0xc')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x163325,_0x04e8('0xd'),JSON[_0x04e8('0xe')](_0x4ac3b7));if(_0x4ac3b7['error']){if(_0x4ac3b7[_0x04e8('0xf')][_0x04e8('0x10')]===0x1f4){logger['error'](_0x04e8('0xb'),_0x163325,_0x4ac3b7[_0x04e8('0xf')][_0x04e8('0x11')]);return _0x4e9b75(_0x4ac3b7['error'][_0x04e8('0x11')]);}logger[_0x04e8('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x163325,_0x4ac3b7[_0x04e8('0xf')]['message']);return _0x34fc04(_0x4ac3b7[_0x04e8('0xf')]['message']);}else{logger[_0x04e8('0x12')](_0x04e8('0xb'),_0x163325,'request\x20sent');_0x34fc04(_0x4ac3b7[_0x04e8('0x13')][_0x04e8('0x11')]);}})[_0x04e8('0x14')](function(_0x1071e3){logger[_0x04e8('0xf')](_0x04e8('0xb'),_0x163325,_0x1071e3);_0x4e9b75(_0x1071e3);});});} \ No newline at end of file +var _0xd852=['info','request\x20sent','stringify','error','ChatTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','then'];(function(_0x499c05,_0x1e85a5){var _0x51ea5c=function(_0x1d55dc){while(--_0x1d55dc){_0x499c05['push'](_0x499c05['shift']());}};_0x51ea5c(++_0x1e85a5);}(_0xd852,0x1c9));var _0x2d85=function(_0xeda80b,_0x23fb13){_0xeda80b=_0xeda80b-0x0;var _0x5805dd=_0xd852[_0xeda80b];return _0x5805dd;};'use strict';var _=require(_0x2d85('0x0'));var util=require(_0x2d85('0x1'));var moment=require(_0x2d85('0x2'));var BPromise=require(_0x2d85('0x3'));var rs=require(_0x2d85('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d85('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2d85('0x6'));var jayson=require(_0x2d85('0x7'));var client=jayson[_0x2d85('0x8')][_0x2d85('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x374075,_0x55ee16,_0x48b89b){return new BPromise(function(_0xcb07cf,_0x3a4c28){return client['request'](_0x374075,_0x48b89b)[_0x2d85('0xa')](function(_0x117b3a){logger[_0x2d85('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x55ee16,_0x2d85('0xc'));logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x55ee16,_0x2d85('0xc'),JSON[_0x2d85('0xd')](_0x117b3a));if(_0x117b3a['error']){if(_0x117b3a[_0x2d85('0xe')]['code']===0x1f4){logger[_0x2d85('0xe')](_0x2d85('0xf'),_0x55ee16,_0x117b3a[_0x2d85('0xe')][_0x2d85('0x10')]);return _0x3a4c28(_0x117b3a[_0x2d85('0xe')][_0x2d85('0x10')]);}logger['error'](_0x2d85('0xf'),_0x55ee16,_0x117b3a['error'][_0x2d85('0x10')]);return _0xcb07cf(_0x117b3a[_0x2d85('0xe')][_0x2d85('0x10')]);}else{logger[_0x2d85('0xb')](_0x2d85('0xf'),_0x55ee16,_0x2d85('0xc'));_0xcb07cf(_0x117b3a[_0x2d85('0x11')][_0x2d85('0x10')]);}})['catch'](function(_0xef2e7f){logger[_0x2d85('0xe')](_0x2d85('0xf'),_0x55ee16,_0xef2e7f);_0x3a4c28(_0xef2e7f);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 614b896..d549161 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 _0x7b45=['show','post','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x4e2807,_0x3942be){var _0x2eb3fc=function(_0x2f6a75){while(--_0x2f6a75){_0x4e2807['push'](_0x4e2807['shift']());}};_0x2eb3fc(++_0x3942be);}(_0x7b45,0xef));var _0x57b4=function(_0x44700b,_0x1cef26){_0x44700b=_0x44700b-0x0;var _0x4af965=_0x7b45[_0x44700b];return _0x4af965;};'use strict';var multer=require(_0x57b4('0x0'));var util=require('util');var path=require(_0x57b4('0x1'));var timeout=require('connect-timeout');var express=require(_0x57b4('0x2'));var router=express[_0x57b4('0x3')]();var fs_extra=require(_0x57b4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x57b4('0x5'));var config=require(_0x57b4('0x6'));var controller=require(_0x57b4('0x7'));router[_0x57b4('0x8')]('/',auth[_0x57b4('0x9')](),controller['index']);router[_0x57b4('0x8')](_0x57b4('0xa'),auth[_0x57b4('0x9')](),controller[_0x57b4('0xb')]);router['get'](_0x57b4('0xc'),auth['isAuthenticated'](),controller[_0x57b4('0xd')]);router[_0x57b4('0xe')]('/',auth['isAuthenticated'](),controller[_0x57b4('0xf')]);router[_0x57b4('0x10')]('/:id',auth[_0x57b4('0x9')](),controller[_0x57b4('0x11')]);router[_0x57b4('0x12')](_0x57b4('0xc'),auth['isAuthenticated'](),controller[_0x57b4('0x13')]);module[_0x57b4('0x14')]=router; \ No newline at end of file +var _0x2475=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','delete','exports','multer','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2475,0x165));var _0x5247=function(_0x48918c,_0x2f0188){_0x48918c=_0x48918c-0x0;var _0x55f84a=_0x2475[_0x48918c];return _0x55f84a;};'use strict';var multer=require(_0x5247('0x0'));var util=require('util');var path=require(_0x5247('0x1'));var timeout=require(_0x5247('0x2'));var express=require(_0x5247('0x3'));var router=express[_0x5247('0x4')]();var fs_extra=require(_0x5247('0x5'));var auth=require(_0x5247('0x6'));var interaction=require(_0x5247('0x7'));var config=require(_0x5247('0x8'));var controller=require('./chatTransferReport.controller');router['get']('/',auth[_0x5247('0x9')](),controller['index']);router[_0x5247('0xa')](_0x5247('0xb'),auth[_0x5247('0x9')](),controller[_0x5247('0xc')]);router['get'](_0x5247('0xd'),auth['isAuthenticated'](),controller[_0x5247('0xe')]);router[_0x5247('0xf')]('/',auth[_0x5247('0x9')](),controller[_0x5247('0x10')]);router[_0x5247('0x11')]('/:id',auth[_0x5247('0x9')](),controller['update']);router[_0x5247('0x12')]('/:id',auth[_0x5247('0x9')](),controller['destroy']);module[_0x5247('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 4309283..8d8c150 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 _0x7e31=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','Chat','Send','Contact\x20us','INTEGER','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Type\x20a\x20message','Skip','thumb','input','name','text','onlineForm','parse','setDataValue','stringify','textarea','Comments','getDataValue','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'];(function(_0x47f719,_0x2e559d){var _0x407f4e=function(_0x2be03a){while(--_0x2be03a){_0x47f719['push'](_0x47f719['shift']());}};_0x407f4e(++_0x2e559d);}(_0x7e31,0x64));var _0x17e3=function(_0x3c86dc,_0x5d22fc){_0x3c86dc=_0x3c86dc-0x0;var _0x4aeb79=_0x7e31[_0x3c86dc];return _0x4aeb79;};'use strict';var Sequelize=require(_0x17e3('0x0'));var rs=require(_0x17e3('0x1'));module[_0x17e3('0x2')]={'name':{'type':Sequelize[_0x17e3('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x17e3('0x3')],'allowNull':![],'unique':_0x17e3('0x4')},'description':{'type':Sequelize[_0x17e3('0x3')]},'mapKey':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x17e3('0x5')},'key':{'type':Sequelize[_0x17e3('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x17e3('0x3')],'allowNull':![],'defaultValue':_0x17e3('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x17e3('0x3')],'allowNull':![],'defaultValue':_0x17e3('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x17e3('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x17e3('0x9')]('rounded','squared'),'defaultValue':_0x17e3('0xa')},'header_online':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0xb')},'offline_chat_button':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0xc')},'header_offline':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0xd')},'download_transcript':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x17e3('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x17e3('0xf')]},'closingQuestion':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0x11')},'closingMessage':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x17e3('0x12')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x17e3('0x9')]('star',_0x17e3('0x13')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x17e3('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x17e3('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x17e3('0x14'),'variable':null,'config':{'placeholder':_0x17e3('0x15'),'type':_0x17e3('0x16'),'required':!![]},'props':{'title':_0x17e3('0x15'),'helpText':''}},{'type':'input','props':{'title':_0x17e3('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x17e3('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x17e3('0x17'))?JSON[_0x17e3('0x18')](this['getDataValue']('onlineForm')):{};},'set':function(_0x4c22eb){return this[_0x17e3('0x19')](_0x17e3('0x17'),JSON[_0x17e3('0x1a')](_0x4c22eb));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x17e3('0x1a')]({'items':[{'type':_0x17e3('0x14'),'props':{'title':_0x17e3('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x17e3('0x5'),'type':'email'},'variable':null},{'type':_0x17e3('0x1b'),'config':{'placeholder':'Comments'},'props':{'title':_0x17e3('0x1c'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x17e3('0x1d')](_0x17e3('0x1e'))?JSON[_0x17e3('0x18')](this[_0x17e3('0x1d')](_0x17e3('0x1e'))):{};},'set':function(_0x315c64){return this['setDataValue'](_0x17e3('0x1e'),JSON[_0x17e3('0x1a')](_0x315c64));}},'token':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':function(){return rs[_0x17e3('0x1f')]();}},'autoclose':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0x20')},'waitingMessage':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0x21')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x17e3('0x22')},'enableUnmanagedNote':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0x12')},'sendUnmanaged':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x17e3('0xf')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x17e3('0x23');}},'notificationSound':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0x24')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x17e3('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0x25')},'verticalAlignment':{'type':Sequelize[_0x17e3('0xe')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0x26')},'messagesAlignment':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0x27')},'defaultTitle':{'type':Sequelize[_0x17e3('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x17e3('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x17e3('0x3')],'allowNull':![],'defaultValue':_0x17e3('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x17e3('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x17e3('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x17e3('0xe')],'comment':_0x17e3('0x29')},'mandatoryDisposition':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![],'comment':_0x17e3('0x2a'),'set':function(_0x2e119d){if(!_0x2e119d)this[_0x17e3('0x19')]('mandatoryDispositionPauseId',null);this[_0x17e3('0x19')]('mandatoryDisposition',_0x2e119d);}},'vidaooEscalation':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x17e3('0x3')],'allowNull':![],'defaultValue':_0x17e3('0x2b')},'vidaooNote':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':function(){return _0x17e3('0x2c');}},'vidaooMetadata':{'type':Sequelize[_0x17e3('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x17e3('0xf')]}}; \ No newline at end of file +var _0x14d6=['You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','Feedback','star','thumb','stringify','input','text','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','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'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x14d6,0x17e));var _0x614d=function(_0x508b25,_0x1616eb){_0x508b25=_0x508b25-0x0;var _0x3b81eb=_0x14d6[_0x508b25];return _0x3b81eb;};'use strict';var Sequelize=require(_0x614d('0x0'));var rs=require(_0x614d('0x1'));module[_0x614d('0x2')]={'name':{'type':Sequelize[_0x614d('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x614d('0x3')],'allowNull':![],'unique':_0x614d('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x614d('0x3')],'defaultValue':_0x614d('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x614d('0x5')},'key':{'type':Sequelize[_0x614d('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x614d('0x3')],'defaultValue':_0x614d('0x6')},'customerAlias':{'type':Sequelize[_0x614d('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x614d('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x614d('0x3')],'allowNull':![],'defaultValue':_0x614d('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x614d('0x3')],'allowNull':![],'defaultValue':_0x614d('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x614d('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x614d('0x3')]},'animation':{'type':Sequelize[_0x614d('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x614d('0xb')](_0x614d('0xc'),_0x614d('0xd')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x614d('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x614d('0x3')],'defaultValue':_0x614d('0xe')},'offline_chat_button':{'type':Sequelize[_0x614d('0x3')],'defaultValue':_0x614d('0xf')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x614d('0x10')},'download_transcript':{'type':Sequelize[_0x614d('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x614d('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0x614d('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x614d('0x12')]},'closingQuestion':{'type':Sequelize[_0x614d('0x3')],'defaultValue':_0x614d('0x13')},'formSubmitSuccessMessage':{'type':Sequelize[_0x614d('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x614d('0x3')],'defaultValue':_0x614d('0x14')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x614d('0x15')},'placeholderMessage':{'type':Sequelize[_0x614d('0x3')],'defaultValue':_0x614d('0x16')},'closingMessage':{'type':Sequelize[_0x614d('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x614d('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x614d('0x3')],'defaultValue':_0x614d('0x17')},'conditionAgreement':{'type':Sequelize[_0x614d('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x614d('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x614d('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x614d('0x3')],'defaultValue':_0x614d('0x18')},'ratingType':{'type':Sequelize[_0x614d('0xb')](_0x614d('0x19'),_0x614d('0x1a')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x614d('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x614d('0x12')],'defaultValue':function(){return JSON[_0x614d('0x1b')]({'items':[{'type':_0x614d('0x1c'),'variable':null,'config':{'placeholder':'name','type':_0x614d('0x1d'),'required':!![]},'props':{'title':_0x614d('0x1e'),'helpText':''}},{'type':'input','props':{'title':_0x614d('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x614d('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x614d('0x1f')](_0x614d('0x20'))?JSON[_0x614d('0x21')](this['getDataValue']('onlineForm')):{};},'set':function(_0x5c801a){return this[_0x614d('0x22')](_0x614d('0x20'),JSON[_0x614d('0x1b')](_0x5c801a));}},'offlineForm':{'type':Sequelize[_0x614d('0x12')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x614d('0x1c'),'props':{'title':_0x614d('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x614d('0x5'),'type':_0x614d('0x5')},'variable':null},{'type':_0x614d('0x23'),'config':{'placeholder':_0x614d('0x24')},'props':{'title':_0x614d('0x24'),'helpText':_0x614d('0x25')}}],'fromKey':0x0});},'get':function(){return this[_0x614d('0x1f')](_0x614d('0x26'))?JSON[_0x614d('0x21')](this[_0x614d('0x1f')](_0x614d('0x26'))):{};},'set':function(_0x9c5084){return this[_0x614d('0x22')](_0x614d('0x26'),JSON[_0x614d('0x1b')](_0x9c5084));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x614d('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x614d('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x614d('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x614d('0x3')]},'forwardOffline':{'type':Sequelize[_0x614d('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x614d('0x3')]},'waitingTitle':{'type':Sequelize[_0x614d('0x3')],'defaultValue':_0x614d('0x27')},'waitingMessage':{'type':Sequelize[_0x614d('0x3')],'defaultValue':_0x614d('0x28')},'offlineMessageSubject':{'type':Sequelize[_0x614d('0x3')],'defaultValue':_0x614d('0x29')},'offlineMessageBody':{'type':Sequelize[_0x614d('0x3')],'defaultValue':_0x614d('0x2a')},'enableUnmanagedNote':{'type':Sequelize[_0x614d('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x614d('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x614d('0x17')},'sendUnmanaged':{'type':Sequelize[_0x614d('0x3')],'defaultValue':_0x614d('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0x614d('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x614d('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x614d('0x12')]},'showAgentAvatar':{'type':Sequelize[_0x614d('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x614d('0x3')]},'notificationTemplate':{'type':Sequelize[_0x614d('0x12')],'defaultValue':function(){return _0x614d('0x2b');}},'notificationSound':{'type':Sequelize[_0x614d('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x614d('0x3')],'defaultValue':_0x614d('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0x614d('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x614d('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x614d('0x2d')},'verticalAlignment':{'type':Sequelize[_0x614d('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x614d('0x3')],'defaultValue':_0x614d('0x2e')},'messagesAlignment':{'type':Sequelize[_0x614d('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x614d('0x3')]},'customerAvatar':{'type':Sequelize[_0x614d('0x12')]},'showCustomerAvatar':{'type':Sequelize[_0x614d('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x614d('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x614d('0x3')],'allowNull':![],'defaultValue':_0x614d('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x614d('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x614d('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x614d('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x614d('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x614d('0x3')],'defaultValue':_0x614d('0x30')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x614d('0x9')],'comment':_0x614d('0x31')},'mandatoryDisposition':{'type':Sequelize[_0x614d('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x54213f){if(!_0x54213f)this['setDataValue'](_0x614d('0x32'),null);this[_0x614d('0x22')](_0x614d('0x33'),_0x54213f);}},'vidaooEscalation':{'type':Sequelize[_0x614d('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x614d('0x3')]},'vidaooTopic':{'type':Sequelize[_0x614d('0x3')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x614d('0x3')],'defaultValue':function(){return _0x614d('0x34');}},'vidaooMetadata':{'type':Sequelize[_0x614d('0x12')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x614d('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 558844b..530096d 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 _0xcb81=['address','remote','x-real-ip','connection','virtual','replace','render','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','READ_COMMITTED','finally','getApplications','chatProactiveAction','ChatProactiveAction','getFields','false','onlineForm','items','fromKey','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','User','mustache','util','ejs','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','../../config/environment','../../errors/api','APINotFoundError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','undefined','limit','count','offset','Content-Range','json','update','get','destroy','stack','name','send','user-agent-parser','setUA','user-agent','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','referer','browser','version','format','%s\x20%s','unknown','device','model','vendor','type','index','Pause','map','ChatWebsite','rawAttributes','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','show','params','mandatoryDispositionPause','includeAll','include','find','body','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','describe','getDispositions','findOne','Disposition','nolimit','pick','ChatWebsiteId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','addAvatar','agentAvatar','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','existsSync','root','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','timezone','notify','chat','from','From\x20is\x20mandatory','mapKey','isEmpty','Body\x20is\x20mandatory','CmContact','createdAt','includes','updatedAt','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','Contacts','DESC','ChatApplication','Applications','Interval','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','orderBy','priority','asc','List','list','contact','headers','threadId','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','closed','messageId','created','autoclose','applications','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','startRouting','EventManager','offline','Sequelize','ValidationError','no\x20available\x20attributes','difference','CompanyId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','spread','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','files','attachments','offline-chat','basename','openNewInteraction','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','forwardOfflineAddress','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','email','Chat','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Owner','Tag','Tags','color','tag','getSnippet','getProactiveActions','getLicense','License','increment','3.10.1','origin','http://localhost:9000'];(function(_0x54395b,_0x51babb){var _0x199c87=function(_0x3e7bd8){while(--_0x3e7bd8){_0x54395b['push'](_0x54395b['shift']());}};_0x199c87(++_0x51babb);}(_0xcb81,0x154));var _0x1cb8=function(_0x202c61,_0x3673e0){_0x202c61=_0x202c61-0x0;var _0x540691=_0xcb81[_0x202c61];return _0x540691;};'use strict';var Mustache=require(_0x1cb8('0x0'));var util=require(_0x1cb8('0x1'));var path=require('path');var ejs=require(_0x1cb8('0x2'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var querystring=require('querystring');var htmlToText=require(_0x1cb8('0x3'));var Redis=require(_0x1cb8('0x4'));var jayson=require(_0x1cb8('0x5'));var qs=require(_0x1cb8('0x6'));var logger=require(_0x1cb8('0x7'))('api');var config=require(_0x1cb8('0x8'));var APIBadRequestError=require(_0x1cb8('0x9'))['APIBadRequestError'];var APINotFoundError=require(_0x1cb8('0x9'))[_0x1cb8('0xa')];var APIOutOfIntervalError=require(_0x1cb8('0x9'))['APIOutOfIntervalError'];var APIHandleError=require(_0x1cb8('0x9'))['handleError'];var APIConflictError=require('../../errors/api')[_0x1cb8('0xb')];var wildcardUtils=require(_0x1cb8('0xc'));var URL=require(_0x1cb8('0xd'))[_0x1cb8('0xe')];var db=require(_0x1cb8('0xf'))['db'];config[_0x1cb8('0x10')]=_[_0x1cb8('0x11')](config[_0x1cb8('0x10')],{'host':'localhost','port':0x18eb});var socket=require(_0x1cb8('0x12'))(new Redis(config[_0x1cb8('0x10')]));require(_0x1cb8('0x13'))[_0x1cb8('0x14')](socket);var client=jayson[_0x1cb8('0x15')]['http']({'port':0x232c});var client9002=jayson[_0x1cb8('0x15')][_0x1cb8('0x16')]({'port':0x232a});var client9003=jayson[_0x1cb8('0x15')][_0x1cb8('0x16')]({'port':0x232b});var client9001=jayson[_0x1cb8('0x15')][_0x1cb8('0x16')]({'port':0x2329});function respondWithRpcPromise(_0x339ad0,_0x243930,_0x5af4a3,_0x17a95d){return new Promise(function(_0x4b4917,_0xf6b347){var _0x28b8ff=_0x17a95d||client;return _0x28b8ff[_0x1cb8('0x17')](_0x339ad0,_0x5af4a3)[_0x1cb8('0x18')](function(_0x2635a8){logger[_0x1cb8('0x19')](_0x1cb8('0x1a'),_0x243930,_0x1cb8('0x1b'));logger[_0x1cb8('0x1c')](_0x1cb8('0x1d'),_0x243930,_0x1cb8('0x1b'),JSON[_0x1cb8('0x1e')](_0x2635a8));if(_0x2635a8['error']){if(_0x2635a8[_0x1cb8('0x1f')][_0x1cb8('0x20')]===0x1f4){logger[_0x1cb8('0x1f')](_0x1cb8('0x1a'),_0x243930,_0x2635a8['error'][_0x1cb8('0x21')]);return _0xf6b347(_0x2635a8['error'][_0x1cb8('0x21')]);}logger[_0x1cb8('0x1f')](_0x1cb8('0x1a'),_0x243930,_0x2635a8[_0x1cb8('0x1f')]['message']);return _0x4b4917(_0x2635a8['error'][_0x1cb8('0x21')]);}else{logger[_0x1cb8('0x19')](_0x1cb8('0x1a'),_0x243930,_0x1cb8('0x1b'));_0x4b4917(_0x2635a8[_0x1cb8('0x22')][_0x1cb8('0x21')]);}})[_0x1cb8('0x23')](function(_0x47b161){logger[_0x1cb8('0x1f')](_0x1cb8('0x1a'),_0x243930,_0x47b161);_0xf6b347(_0x47b161);});});}function respondWithStatusCode(_0x35c890,_0xeeb21d){_0xeeb21d=_0xeeb21d||0xcc;return function(_0x17f5f8){if(_0x17f5f8){return _0x35c890[_0x1cb8('0x24')](_0xeeb21d);}return _0x35c890['status'](_0xeeb21d)[_0x1cb8('0x25')]();};}function respondWithResult(_0x23ac21,_0xfdfb31){_0xfdfb31=_0xfdfb31||0xc8;return function(_0x3c1905){if(_0x3c1905){return _0x23ac21[_0x1cb8('0x26')](_0xfdfb31)['json'](_0x3c1905);}};}function respondWithFilteredResult(_0xed576b,_0x2e3adf){return function(_0x3a8b53){if(_0x3a8b53){var _0x21c17a=typeof _0x2e3adf['offset']===_0x1cb8('0x27')&&typeof _0x2e3adf[_0x1cb8('0x28')]===_0x1cb8('0x27');var _0x5bf630=_0x3a8b53[_0x1cb8('0x29')];var _0x2a6da9=_0x21c17a?0x0:_0x2e3adf[_0x1cb8('0x2a')];var _0x5558fe=_0x21c17a?_0x3a8b53[_0x1cb8('0x29')]:_0x2e3adf[_0x1cb8('0x2a')]+_0x2e3adf[_0x1cb8('0x28')];var _0xca35f2;if(_0x5558fe>=_0x5bf630){_0x5558fe=_0x5bf630;_0xca35f2=0xc8;}else{_0xca35f2=0xce;}_0xed576b[_0x1cb8('0x26')](_0xca35f2);return _0xed576b['set'](_0x1cb8('0x2b'),_0x2a6da9+'-'+_0x5558fe+'/'+_0x5bf630)[_0x1cb8('0x2c')](_0x3a8b53);}return null;};}function saveUpdates(_0x21fde7){return function(_0x1413a2){if(_0x1413a2){return _0x1413a2[_0x1cb8('0x2d')](_0x21fde7)[_0x1cb8('0x18')](function(_0x145f75){return _0x145f75;});}return null;};}function removeEntity(_0x18cc99){return function(_0x1aaae4){if(_0x1aaae4){return _0x1aaae4['destroy']()['then'](function(){var _0x427ddf=_0x1aaae4[_0x1cb8('0x2e')]({'plain':!![]});var _0x18a003='ChatWebsites';return db['UserProfileResource'][_0x1cb8('0x2f')]({'where':{'type':_0x18a003,'resourceId':_0x427ddf['id']}})[_0x1cb8('0x18')](function(){return _0x1aaae4;});})[_0x1cb8('0x18')](function(){_0x18cc99[_0x1cb8('0x26')](0xcc)[_0x1cb8('0x25')]();});}};}function handleEntityNotFound(_0x63ee4e){return function(_0x3cc898){if(!_0x3cc898){_0x63ee4e[_0x1cb8('0x24')](0x194);}return _0x3cc898;};}function handleError(_0x5210d5,_0xbe1943){_0xbe1943=_0xbe1943||0x1f4;return function(_0x1a6518){logger[_0x1cb8('0x1f')](_0x1a6518[_0x1cb8('0x30')]);if(_0x1a6518[_0x1cb8('0x31')]){delete _0x1a6518[_0x1cb8('0x31')];}_0x5210d5[_0x1cb8('0x26')](_0xbe1943)[_0x1cb8('0x32')](_0x1a6518);};}function createInteractionObject(_0x2e6ddb,_0x5c66f7,_0x203d3a,_0x2c98a4){var _0x5e9f5f=require(_0x1cb8('0x33'));var _0x3efb16=new _0x5e9f5f();var _0x15d6fa=_0x3efb16[_0x1cb8('0x34')](_0x203d3a[_0x1cb8('0x35')])['getResult']();var _0x385b4d=_0x5c66f7[_0x1cb8('0x36')];if(_0x203d3a[_0x1cb8('0x37')]){_0x385b4d=_0x203d3a['cf-connecting-ip'];}else if(_0x203d3a['x-forwarded-for']){_0x385b4d=_['first'](_0x203d3a[_0x1cb8('0x38')][_0x1cb8('0x39')](','));}return{'ContactId':_0x2c98a4['id'],'ChatWebsiteId':_0x2e6ddb,'from':(_0x2c98a4[_0x1cb8('0x3a')]||'')+'\x20'+(_0x2c98a4[_0x1cb8('0x3b')]||''),'customerIp':_0x385b4d,'customerPort':_0x203d3a['x-real-port']?_0x203d3a['x-real-port']:null,'referer':_0x5c66f7[_0x1cb8('0x3c')],'browserName':_0x15d6fa[_0x1cb8('0x3d')][_0x1cb8('0x31')]&&_0x15d6fa[_0x1cb8('0x3d')][_0x1cb8('0x3e')]?util[_0x1cb8('0x3f')](_0x1cb8('0x40'),_0x15d6fa[_0x1cb8('0x3d')]['name'],_0x15d6fa[_0x1cb8('0x3d')][_0x1cb8('0x3e')]):_0x1cb8('0x41'),'browserVersion':_0x15d6fa[_0x1cb8('0x3d')]['version']||_0x1cb8('0x41'),'osName':util['format'](_0x1cb8('0x40'),_0x15d6fa['os'][_0x1cb8('0x31')],_0x15d6fa['os']['version']),'osVersion':_0x15d6fa['os'][_0x1cb8('0x3e')],'deviceModel':_0x15d6fa[_0x1cb8('0x42')][_0x1cb8('0x43')]&&_0x15d6fa['device']['vendor']?util[_0x1cb8('0x3f')]('%s\x20%s\x20%s',_0x15d6fa[_0x1cb8('0x42')][_0x1cb8('0x43')],_0x15d6fa[_0x1cb8('0x42')][_0x1cb8('0x44')],_0x15d6fa[_0x1cb8('0x42')][_0x1cb8('0x45')]):null,'deviceVendor':_0x15d6fa[_0x1cb8('0x42')]['vendor'],'deviceType':_0x15d6fa[_0x1cb8('0x42')][_0x1cb8('0x45')],'formData':JSON[_0x1cb8('0x1e')](_0x5c66f7)};}exports[_0x1cb8('0x46')]=function(_0x59f992,_0x2cb11d){var _0x7f7a09={'include':[{'model':db[_0x1cb8('0x47')],'as':'mandatoryDispositionPause'}]},_0x1b83a6={},_0x4642de={'count':0x0,'rows':[]};var _0x10380e=_[_0x1cb8('0x48')](db[_0x1cb8('0x49')][_0x1cb8('0x4a')],function(_0x1ceaf1){return{'name':_0x1ceaf1['fieldName'],'type':_0x1ceaf1[_0x1cb8('0x45')][_0x1cb8('0x4b')]};});_0x1b83a6['model']=_[_0x1cb8('0x48')](_0x10380e,_0x1cb8('0x31'));_0x1b83a6[_0x1cb8('0x4c')]=_[_0x1cb8('0x4d')](_0x59f992[_0x1cb8('0x4c')]);_0x1b83a6[_0x1cb8('0x4e')]=_[_0x1cb8('0x4f')](_0x1b83a6[_0x1cb8('0x43')],_0x1b83a6[_0x1cb8('0x4c')]);_0x7f7a09[_0x1cb8('0x50')]=_[_0x1cb8('0x4f')](_0x1b83a6[_0x1cb8('0x43')],qs[_0x1cb8('0x51')](_0x59f992[_0x1cb8('0x4c')]['fields']));_0x7f7a09[_0x1cb8('0x50')]=_0x7f7a09[_0x1cb8('0x50')][_0x1cb8('0x52')]?_0x7f7a09[_0x1cb8('0x50')]:_0x1b83a6[_0x1cb8('0x43')];if(!_0x59f992[_0x1cb8('0x4c')][_0x1cb8('0x53')]('nolimit')){_0x7f7a09[_0x1cb8('0x28')]=qs[_0x1cb8('0x28')](_0x59f992[_0x1cb8('0x4c')]['limit']);_0x7f7a09['offset']=qs[_0x1cb8('0x2a')](_0x59f992[_0x1cb8('0x4c')][_0x1cb8('0x2a')]);}_0x7f7a09[_0x1cb8('0x54')]=qs[_0x1cb8('0x55')](_0x59f992['query'][_0x1cb8('0x55')]);_0x7f7a09[_0x1cb8('0x56')]=qs[_0x1cb8('0x4e')](_['pick'](_0x59f992['query'],_0x1b83a6['filters']),_0x10380e);if(_0x59f992[_0x1cb8('0x4c')]['filter']){_0x7f7a09[_0x1cb8('0x56')]=_[_0x1cb8('0x57')](_0x7f7a09[_0x1cb8('0x56')],{'$or':_[_0x1cb8('0x48')](_0x10380e,function(_0x427787){if(_0x427787['type']!==_0x1cb8('0x58')){var _0x2055ad={};_0x2055ad[_0x427787[_0x1cb8('0x31')]]={'$like':'%'+_0x59f992[_0x1cb8('0x4c')][_0x1cb8('0x59')]+'%'};return _0x2055ad;}})});}_0x7f7a09=_[_0x1cb8('0x57')]({},_0x7f7a09,_0x59f992[_0x1cb8('0x5a')]);var _0x53e09e={'where':_0x7f7a09[_0x1cb8('0x56')]};return db[_0x1cb8('0x49')][_0x1cb8('0x29')](_0x53e09e)[_0x1cb8('0x18')](function(_0x2d9995){_0x4642de[_0x1cb8('0x29')]=_0x2d9995;if(_0x59f992[_0x1cb8('0x4c')]['includeAll']){_0x7f7a09['include']=[{'all':!![]}];}return db['ChatWebsite'][_0x1cb8('0x5b')](_0x7f7a09);})['then'](function(_0x2f3daa){_0x4642de[_0x1cb8('0x5c')]=_0x2f3daa;return _0x4642de;})[_0x1cb8('0x18')](respondWithFilteredResult(_0x2cb11d,_0x7f7a09))[_0x1cb8('0x23')](handleError(_0x2cb11d,null));};exports[_0x1cb8('0x5d')]=function(_0x5d736c,_0x579d54){var _0x5de2b2={'raw':![],'where':{'id':_0x5d736c[_0x1cb8('0x5e')]['id']},'include':[{'model':db['Pause'],'as':_0x1cb8('0x5f')}]},_0x38e3d9={};_0x38e3d9['model']=_[_0x1cb8('0x4d')](db[_0x1cb8('0x49')]['rawAttributes']);_0x38e3d9[_0x1cb8('0x4c')]=_[_0x1cb8('0x4d')](_0x5d736c[_0x1cb8('0x4c')]);_0x38e3d9[_0x1cb8('0x4e')]=_[_0x1cb8('0x4f')](_0x38e3d9[_0x1cb8('0x43')],_0x38e3d9[_0x1cb8('0x4c')]);_0x5de2b2[_0x1cb8('0x50')]=_[_0x1cb8('0x4f')](_0x38e3d9[_0x1cb8('0x43')],qs[_0x1cb8('0x51')](_0x5d736c[_0x1cb8('0x4c')][_0x1cb8('0x51')]));_0x5de2b2['attributes']=_0x5de2b2[_0x1cb8('0x50')][_0x1cb8('0x52')]?_0x5de2b2[_0x1cb8('0x50')]:_0x38e3d9['model'];if(_0x5d736c[_0x1cb8('0x4c')][_0x1cb8('0x60')]){_0x5de2b2[_0x1cb8('0x61')]=[{'all':!![]}];}_0x5de2b2=_[_0x1cb8('0x57')]({},_0x5de2b2,_0x5d736c['options']);return db[_0x1cb8('0x49')][_0x1cb8('0x62')](_0x5de2b2)['then'](handleEntityNotFound(_0x579d54,null))[_0x1cb8('0x18')](respondWithResult(_0x579d54,null))[_0x1cb8('0x23')](handleError(_0x579d54,null));};exports['create']=function(_0x41a5b2,_0x46ed52){var _0x3a1089=null;_0x41a5b2[_0x1cb8('0x63')]['address']['split'](',')['forEach'](_0x7f7524=>{if(_0x7f7524[_0x1cb8('0x64')]()!==''&&!wildcardUtils[_0x1cb8('0x65')](_0x7f7524[_0x1cb8('0x64')]())){_0x3a1089=new APIBadRequestError('\x22'+_0x7f7524[_0x1cb8('0x64')]()+_0x1cb8('0x66'));}});if(_0x3a1089){return handleError(_0x46ed52,null)(_0x3a1089);}return db[_0x1cb8('0x49')]['create'](_0x41a5b2[_0x1cb8('0x63')],{})[_0x1cb8('0x18')](function(_0x438eef){var _0x5d8c5b=_0x41a5b2[_0x1cb8('0x67')][_0x1cb8('0x2e')]({'plain':!![]});if(!_0x5d8c5b)throw new Error(_0x1cb8('0x68'));if(_0x5d8c5b[_0x1cb8('0x69')]===_0x1cb8('0x67')){var _0x58e796=_0x438eef[_0x1cb8('0x2e')]({'plain':!![]});var _0x150f00=_0x1cb8('0x6a');return db['UserProfileSection'][_0x1cb8('0x62')]({'where':{'name':_0x150f00,'userProfileId':_0x5d8c5b[_0x1cb8('0x6b')]},'raw':!![]})['then'](function(_0x39bdf6){if(_0x39bdf6&&_0x39bdf6['autoAssociation']===0x0){return db['UserProfileResource'][_0x1cb8('0x6c')]({'name':_0x58e796[_0x1cb8('0x31')],'resourceId':_0x58e796['id'],'type':_0x39bdf6[_0x1cb8('0x31')],'sectionId':_0x39bdf6['id']},{})['then'](function(){return _0x438eef;});}else{return _0x438eef;}})['catch'](function(_0x5943d5){logger[_0x1cb8('0x1f')](_0x1cb8('0x6d'),_0x5943d5);throw _0x5943d5;});}return _0x438eef;})[_0x1cb8('0x18')](respondWithResult(_0x46ed52,0xc9))[_0x1cb8('0x23')](handleError(_0x46ed52,null));};exports[_0x1cb8('0x2d')]=function(_0x168009,_0x144e69){var _0x5f1186=null;_0x168009['body']['address']['split'](',')[_0x1cb8('0x6e')](_0x5b8a9e=>{if(_0x5b8a9e[_0x1cb8('0x64')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x5b8a9e['trim']())){_0x5f1186=new APIBadRequestError('\x22'+_0x5b8a9e['trim']()+_0x1cb8('0x66'));}});if(_0x5f1186){return handleError(_0x144e69,null)(_0x5f1186);}if(_0x168009[_0x1cb8('0x63')]['id']){delete _0x168009[_0x1cb8('0x63')]['id'];}return db[_0x1cb8('0x49')][_0x1cb8('0x62')]({'where':{'id':_0x168009[_0x1cb8('0x5e')]['id']},'include':[{'model':db[_0x1cb8('0x47')],'as':_0x1cb8('0x5f')}]})[_0x1cb8('0x18')](handleEntityNotFound(_0x144e69,null))[_0x1cb8('0x18')](saveUpdates(_0x168009[_0x1cb8('0x63')],null))[_0x1cb8('0x18')](respondWithResult(_0x144e69,null))[_0x1cb8('0x23')](handleError(_0x144e69,null));};exports[_0x1cb8('0x2f')]=function(_0xafc24b,_0x38aa03){return db['ChatWebsite'][_0x1cb8('0x62')]({'where':{'id':_0xafc24b[_0x1cb8('0x5e')]['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x38aa03,null))[_0x1cb8('0x18')](removeEntity(_0x38aa03,null))[_0x1cb8('0x23')](handleError(_0x38aa03,null));};exports[_0x1cb8('0x6f')]=function(_0x4fbbee,_0x4e5db2){return db[_0x1cb8('0x49')][_0x1cb8('0x6f')]()[_0x1cb8('0x18')](respondWithResult(_0x4e5db2,null))[_0x1cb8('0x23')](handleError(_0x4e5db2,null));};exports['addDisposition']=function(_0x7e9918,_0x34094c){if(_0x7e9918['body']['id']){delete _0x7e9918[_0x1cb8('0x63')]['id'];}return db['ChatWebsite'][_0x1cb8('0x62')]({'where':{'id':_0x7e9918[_0x1cb8('0x5e')]['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x34094c,null))['then'](function(_0x44b951){if(_0x44b951){_0x7e9918[_0x1cb8('0x63')]['ChatWebsiteId']=_0x44b951['id'];return db['Disposition'][_0x1cb8('0x6c')](_0x7e9918[_0x1cb8('0x63')]);}})['then'](respondWithResult(_0x34094c,null))[_0x1cb8('0x23')](handleError(_0x34094c,null));};exports[_0x1cb8('0x70')]=function(_0x3ddfba,_0x242959){var _0x451295={'raw':![],'where':{}};var _0x1195b5={};var _0x2b7a9d={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x1cb8('0x71')]({'where':{'id':_0x3ddfba['params']['id']}})['then'](handleEntityNotFound(_0x242959,null))['then'](function(_0x3a7740){if(_0x3a7740){_0x1195b5[_0x1cb8('0x43')]=_[_0x1cb8('0x4d')](db[_0x1cb8('0x72')][_0x1cb8('0x4a')]);_0x1195b5[_0x1cb8('0x4c')]=_['keys'](_0x3ddfba['query']);_0x1195b5[_0x1cb8('0x4e')]=_['intersection'](_0x1195b5[_0x1cb8('0x43')],_0x1195b5[_0x1cb8('0x4c')]);_0x451295[_0x1cb8('0x50')]=_['intersection'](_0x1195b5['model'],qs[_0x1cb8('0x51')](_0x3ddfba['query'][_0x1cb8('0x51')]));_0x451295[_0x1cb8('0x50')]=_0x451295[_0x1cb8('0x50')][_0x1cb8('0x52')]?_0x451295[_0x1cb8('0x50')]:_0x1195b5[_0x1cb8('0x43')];if(!_0x3ddfba[_0x1cb8('0x4c')][_0x1cb8('0x53')](_0x1cb8('0x73'))){_0x451295[_0x1cb8('0x28')]=qs[_0x1cb8('0x28')](_0x3ddfba[_0x1cb8('0x4c')][_0x1cb8('0x28')]);_0x451295['offset']=qs['offset'](_0x3ddfba[_0x1cb8('0x4c')][_0x1cb8('0x2a')]);}_0x451295[_0x1cb8('0x54')]=qs[_0x1cb8('0x55')](_0x3ddfba['query'][_0x1cb8('0x55')]);_0x451295[_0x1cb8('0x56')]=qs[_0x1cb8('0x4e')](_[_0x1cb8('0x74')](_0x3ddfba[_0x1cb8('0x4c')],_0x1195b5['filters']));_0x451295[_0x1cb8('0x56')][_0x1cb8('0x75')]=_0x3a7740['id'];if(_0x3ddfba[_0x1cb8('0x4c')][_0x1cb8('0x59')]){_0x451295[_0x1cb8('0x56')]=_[_0x1cb8('0x57')](_0x451295[_0x1cb8('0x56')],{'$or':_[_0x1cb8('0x48')](_0x451295[_0x1cb8('0x50')],function(_0x7e24da){var _0x4dff73={};_0x4dff73[_0x7e24da]={'$like':'%'+_0x3ddfba[_0x1cb8('0x4c')][_0x1cb8('0x59')]+'%'};return _0x4dff73;})});}_0x451295=_['merge']({},_0x451295,_0x3ddfba['options']);return db[_0x1cb8('0x72')]['count']({'where':_0x451295['where']})[_0x1cb8('0x18')](function(_0x2a375d){_0x2b7a9d['count']=_0x2a375d;if(_0x3ddfba['query'][_0x1cb8('0x60')]){_0x451295['include']=[{'all':!![]}];}return db[_0x1cb8('0x72')]['findAll'](_0x451295);})[_0x1cb8('0x18')](function(_0x32ce02){_0x2b7a9d['rows']=_0x32ce02;return _0x2b7a9d;});}})[_0x1cb8('0x18')](respondWithFilteredResult(_0x242959,_0x451295))[_0x1cb8('0x23')](handleError(_0x242959,null));};exports[_0x1cb8('0x76')]=function(_0x425afa,_0x2baafc){return db[_0x1cb8('0x49')][_0x1cb8('0x62')]({'where':{'id':_0x425afa[_0x1cb8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2baafc,null))[_0x1cb8('0x18')](function(_0x5de093){if(_0x5de093){return _0x5de093[_0x1cb8('0x76')](_0x425afa[_0x1cb8('0x4c')][_0x1cb8('0x77')]);}})['then'](respondWithStatusCode(_0x2baafc,null))['catch'](handleError(_0x2baafc,null));};exports[_0x1cb8('0x78')]=function(_0x2d4a06,_0x3868f4){if(_0x2d4a06['body']['id']){delete _0x2d4a06['body']['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x2d4a06[_0x1cb8('0x5e')]['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x3868f4,null))[_0x1cb8('0x18')](function(_0x37188f){if(_0x37188f){_0x2d4a06[_0x1cb8('0x63')][_0x1cb8('0x75')]=_0x37188f['id'];return db['CannedAnswer'][_0x1cb8('0x6c')](_0x2d4a06[_0x1cb8('0x63')]);}})[_0x1cb8('0x18')](respondWithResult(_0x3868f4,null))[_0x1cb8('0x23')](handleError(_0x3868f4,null));};exports[_0x1cb8('0x79')]=function(_0x4b89b5,_0x3dadf4){var _0x4598d4={'raw':![],'where':{}};var _0x31a9ec={};var _0x1aed78={'count':0x0,'rows':[]};return db[_0x1cb8('0x49')][_0x1cb8('0x71')]({'where':{'id':_0x4b89b5[_0x1cb8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3dadf4,null))['then'](function(_0x482f53){if(_0x482f53){_0x31a9ec[_0x1cb8('0x43')]=_[_0x1cb8('0x4d')](db[_0x1cb8('0x7a')][_0x1cb8('0x4a')]);_0x31a9ec['query']=_[_0x1cb8('0x4d')](_0x4b89b5['query']);_0x31a9ec[_0x1cb8('0x4e')]=_[_0x1cb8('0x4f')](_0x31a9ec[_0x1cb8('0x43')],_0x31a9ec['query']);_0x4598d4['attributes']=_[_0x1cb8('0x4f')](_0x31a9ec[_0x1cb8('0x43')],qs[_0x1cb8('0x51')](_0x4b89b5[_0x1cb8('0x4c')]['fields']));_0x4598d4[_0x1cb8('0x50')]=_0x4598d4[_0x1cb8('0x50')][_0x1cb8('0x52')]?_0x4598d4['attributes']:_0x31a9ec[_0x1cb8('0x43')];if(!_0x4b89b5[_0x1cb8('0x4c')][_0x1cb8('0x53')](_0x1cb8('0x73'))){_0x4598d4[_0x1cb8('0x28')]=qs['limit'](_0x4b89b5['query'][_0x1cb8('0x28')]);_0x4598d4['offset']=qs[_0x1cb8('0x2a')](_0x4b89b5[_0x1cb8('0x4c')]['offset']);}_0x4598d4[_0x1cb8('0x54')]=qs[_0x1cb8('0x55')](_0x4b89b5[_0x1cb8('0x4c')][_0x1cb8('0x55')]);_0x4598d4[_0x1cb8('0x56')]=qs['filters'](_[_0x1cb8('0x74')](_0x4b89b5[_0x1cb8('0x4c')],_0x31a9ec[_0x1cb8('0x4e')]));_0x4598d4[_0x1cb8('0x56')]['ChatWebsiteId']=_0x482f53['id'];if(_0x4b89b5[_0x1cb8('0x4c')][_0x1cb8('0x59')]){_0x4598d4[_0x1cb8('0x56')]=_[_0x1cb8('0x57')](_0x4598d4['where'],{'$or':_['map'](_0x4598d4['attributes'],function(_0x3d4e87){var _0xa1294c={};_0xa1294c[_0x3d4e87]={'$like':'%'+_0x4b89b5[_0x1cb8('0x4c')][_0x1cb8('0x59')]+'%'};return _0xa1294c;})});}_0x4598d4=_[_0x1cb8('0x57')]({},_0x4598d4,_0x4b89b5[_0x1cb8('0x5a')]);return db['CannedAnswer'][_0x1cb8('0x29')]({'where':_0x4598d4[_0x1cb8('0x56')]})[_0x1cb8('0x18')](function(_0x2ed831){_0x1aed78[_0x1cb8('0x29')]=_0x2ed831;if(_0x4b89b5[_0x1cb8('0x4c')][_0x1cb8('0x60')]){_0x4598d4['include']=[{'all':!![]}];}return db[_0x1cb8('0x7a')][_0x1cb8('0x5b')](_0x4598d4);})[_0x1cb8('0x18')](function(_0x23444c){_0x1aed78['rows']=_0x23444c;return _0x1aed78;});}})[_0x1cb8('0x18')](respondWithFilteredResult(_0x3dadf4,_0x4598d4))['catch'](handleError(_0x3dadf4,null));};exports[_0x1cb8('0x7b')]=function(_0x4359be,_0x4a5a56){return db[_0x1cb8('0x49')][_0x1cb8('0x62')]({'where':{'id':_0x4359be[_0x1cb8('0x5e')]['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x4a5a56,null))['then'](function(_0x59df7f){if(_0x59df7f){return _0x59df7f['removeAnswers'](_0x4359be[_0x1cb8('0x4c')]['ids']);}})[_0x1cb8('0x18')](respondWithStatusCode(_0x4a5a56,null))[_0x1cb8('0x23')](handleError(_0x4a5a56,null));};exports[_0x1cb8('0x7c')]=function(_0x317ec0,_0x217fe2){_0x317ec0['body'][_0x1cb8('0x7d')]=_0x317ec0['file']['filename'];return db[_0x1cb8('0x49')]['find']({'where':{'id':_0x317ec0[_0x1cb8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x217fe2,null))['then'](saveUpdates(_0x317ec0[_0x1cb8('0x63')],null))[_0x1cb8('0x18')](respondWithResult(_0x217fe2,null))[_0x1cb8('0x23')](handleError(_0x217fe2,null));};exports[_0x1cb8('0x7e')]=function(_0xcc98d,_0x18f98b){_0xcc98d[_0x1cb8('0x63')][_0x1cb8('0x7f')]=_0xcc98d[_0x1cb8('0x80')][_0x1cb8('0x81')];return db[_0x1cb8('0x49')]['find']({'where':{'id':_0xcc98d[_0x1cb8('0x5e')]['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x18f98b,null))['then'](saveUpdates(_0xcc98d['body'],null))['then'](respondWithResult(_0x18f98b,null))['catch'](handleError(_0x18f98b,null));};exports[_0x1cb8('0x82')]=function(_0x23a8ff,_0x206f28){_0x23a8ff[_0x1cb8('0x63')][_0x1cb8('0x83')]=_0x23a8ff[_0x1cb8('0x80')][_0x1cb8('0x81')];return db[_0x1cb8('0x49')][_0x1cb8('0x62')]({'where':{'id':_0x23a8ff[_0x1cb8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x206f28,null))[_0x1cb8('0x18')](saveUpdates(_0x23a8ff[_0x1cb8('0x63')],null))[_0x1cb8('0x18')](respondWithResult(_0x206f28,null))['catch'](handleError(_0x206f28,null));};exports[_0x1cb8('0x84')]=function(_0x4e557a,_0x4c16d8){_0x4e557a[_0x1cb8('0x63')][_0x1cb8('0x85')]=_0x4e557a[_0x1cb8('0x80')][_0x1cb8('0x81')];return db[_0x1cb8('0x49')][_0x1cb8('0x62')]({'where':{'id':_0x4e557a[_0x1cb8('0x5e')]['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x4c16d8,null))[_0x1cb8('0x18')](saveUpdates(_0x4e557a[_0x1cb8('0x63')],null))[_0x1cb8('0x18')](respondWithResult(_0x4c16d8,null))[_0x1cb8('0x23')](handleError(_0x4c16d8,null));};exports['getLogo']=function(_0x13e0ea,_0x4a9d31){var _0x5056d2=path[_0x1cb8('0x86')](config['root'],_0x1cb8('0x87'));var _0x411a4c={'where':{'id':_0x13e0ea['params']['id']},'attributes':['id',_0x1cb8('0x7d')],'raw':!![]};var _0x577645=![];return require(_0x1cb8('0x88'))['getLicense']()[_0x1cb8('0x18')](function(_0x2f20b0){if(_0x2f20b0){_0x577645=_0x2f20b0[_0x1cb8('0x89')];}})[_0x1cb8('0x18')](function(){return db['ChatWebsite'][_0x1cb8('0x62')](_0x411a4c);})['then'](handleEntityNotFound(_0x4a9d31,null))[_0x1cb8('0x18')](function(_0x1af5a1){if(_0x1af5a1){if(!_[_0x1cb8('0x8a')](_0x1af5a1[_0x1cb8('0x7d')])){if(fs[_0x1cb8('0x8b')](path[_0x1cb8('0x86')](config[_0x1cb8('0x8c')],'server/files/images/logos/',_0x1af5a1[_0x1cb8('0x7d')]))&&_0x577645){_0x5056d2=path['join'](config[_0x1cb8('0x8c')],_0x1cb8('0x8d'),_0x1af5a1[_0x1cb8('0x7d')]);}}return _0x4a9d31[_0x1cb8('0x8e')](_0x5056d2);}})[_0x1cb8('0x23')](handleError(_0x4a9d31,null));};exports['getAvatar']=function(_0x3b319b,_0x522267){var _0x336cd9=path[_0x1cb8('0x86')](config[_0x1cb8('0x8c')],_0x1cb8('0x8f'));var _0x300810={'where':{'id':_0x3b319b[_0x1cb8('0x5e')]['id']},'attributes':['id',_0x1cb8('0x7f')],'raw':!![]};return db[_0x1cb8('0x49')][_0x1cb8('0x62')](_0x300810)[_0x1cb8('0x18')](handleEntityNotFound(_0x522267,null))[_0x1cb8('0x18')](function(_0x3755bf){if(_0x3755bf){if(!_[_0x1cb8('0x8a')](_0x3755bf[_0x1cb8('0x7f')])){if(fs[_0x1cb8('0x8b')](path[_0x1cb8('0x86')](config['root'],_0x1cb8('0x90'),_0x3755bf[_0x1cb8('0x7f')]))){_0x336cd9=path['join'](config['root'],'server/files/images/avatars/',_0x3755bf['agentAvatar']);}}return _0x522267[_0x1cb8('0x8e')](_0x336cd9);}})[_0x1cb8('0x23')](handleError(_0x522267,null));};exports[_0x1cb8('0x91')]=function(_0x2c1df4,_0x1613c6){var _0xedd9c=path[_0x1cb8('0x86')](config['root'],_0x1cb8('0x92'));var _0x5c1076={'where':{'id':_0x2c1df4[_0x1cb8('0x5e')]['id']},'attributes':['id',_0x1cb8('0x83'),'showCustomerAvatar'],'raw':!![]};return db[_0x1cb8('0x49')][_0x1cb8('0x62')](_0x5c1076)[_0x1cb8('0x18')](handleEntityNotFound(_0x1613c6,null))[_0x1cb8('0x18')](function(_0xa1f60a){if(_0xa1f60a){if(!_[_0x1cb8('0x8a')](_0xa1f60a[_0x1cb8('0x83')])){if(fs[_0x1cb8('0x8b')](path['join'](config[_0x1cb8('0x8c')],_0x1cb8('0x90'),_0xa1f60a[_0x1cb8('0x83')]))&&_0xa1f60a[_0x1cb8('0x93')]){_0xedd9c=path[_0x1cb8('0x86')](config[_0x1cb8('0x8c')],'server/files/images/avatars/',_0xa1f60a[_0x1cb8('0x83')]);}}return _0x1613c6['download'](_0xedd9c);}})[_0x1cb8('0x23')](handleError(_0x1613c6,null));};exports[_0x1cb8('0x94')]=function(_0x2cdb0f,_0x517c2b){var _0x4e2c86=path[_0x1cb8('0x86')](config[_0x1cb8('0x8c')],'server/files/images/avatars/system_avatar.png');var _0x54235a={'where':{'id':_0x2cdb0f[_0x1cb8('0x5e')]['id']},'attributes':['id',_0x1cb8('0x85')],'raw':!![]};return db['ChatWebsite'][_0x1cb8('0x62')](_0x54235a)[_0x1cb8('0x18')](handleEntityNotFound(_0x517c2b,null))['then'](function(_0x1b3008){if(_0x1b3008){if(!_[_0x1cb8('0x8a')](_0x1b3008['systemAvatar'])){if(fs[_0x1cb8('0x8b')](path[_0x1cb8('0x86')](config[_0x1cb8('0x8c')],'server/files/images/avatars/',_0x1b3008[_0x1cb8('0x85')]))){_0x4e2c86=path[_0x1cb8('0x86')](config[_0x1cb8('0x8c')],'server/files/images/avatars/',_0x1b3008[_0x1cb8('0x85')]);}}return _0x517c2b[_0x1cb8('0x8e')](_0x4e2c86);}})['catch'](handleError(_0x517c2b,null));};function checkWebsiteInterval(_0x1874c1){var _0x33c57c=_0x1874c1['Interval'];if(!_0x33c57c){return Promise['resolve'](_0x1874c1);}var _0x22766d=_0x1874c1[_0x1cb8('0x95')]||undefined;return _0x33c57c['ifTime'](_0x22766d)[_0x1cb8('0x18')](function(_0x5bd7a4){if(!_0x5bd7a4){throw new APIOutOfIntervalError();}return _0x1874c1;});}exports[_0x1cb8('0x96')]=function(_0x953f93,_0x58b07e){var _0x55e0bc={'body':_0x953f93['body'],'channel':_0x1cb8('0x97')};var _0x5e2acb=[];var _0x42d91b=[];var _0x54c586={};var _0x55f800=![];if(_0x953f93['body']['id']){delete _0x953f93[_0x1cb8('0x63')]['id'];}if(_[_0x1cb8('0x8a')](_0x953f93['body'][_0x1cb8('0x98')])){throw new APIBadRequestError(_0x1cb8('0x99'));}if(_[_0x1cb8('0x8a')](_0x953f93['body'][_0x1cb8('0x9a')])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0x1cb8('0x9b')](_0x953f93[_0x1cb8('0x63')]['body'])){throw new APIBadRequestError(_0x1cb8('0x9c'));}var _0x1c2db2=_0x953f93[_0x1cb8('0x63')][_0x1cb8('0x36')]&&_0x953f93['body'][_0x1cb8('0x3c')];return db[_0x1cb8('0x9d')]['describe']()[_0x1cb8('0x18')](function(_0x2cf5a3){if(!_0x2cf5a3){throw new Error('No\x20available\x20attributes');}_0x5e2acb=Object[_0x1cb8('0x4d')](_0x2cf5a3)['filter'](function(_0x1db567){return![_0x1cb8('0x9e'),'updatedAt'][_0x1cb8('0x9f')](_0x1db567);});_0x42d91b=Object[_0x1cb8('0x4d')](_0x2cf5a3)[_0x1cb8('0x59')](function(_0x24100a){return!['createdAt',_0x1cb8('0xa0'),'CompanyId',_0x1cb8('0xa1')]['includes'](_0x24100a);});if(!_[_0x1cb8('0x9f')](_0x42d91b,_0x953f93[_0x1cb8('0x63')][_0x1cb8('0x9a')])){throw new APIBadRequestError(_0x1cb8('0xa2')+_0x42d91b[_0x1cb8('0x86')](',\x20'));}_0x54c586[_0x953f93[_0x1cb8('0x63')][_0x1cb8('0x9a')]]=_0x953f93[_0x1cb8('0x63')][_0x1cb8('0x98')];})[_0x1cb8('0x18')](function(){return db[_0x1cb8('0x49')][_0x1cb8('0x62')]({'where':{'id':_0x953f93[_0x1cb8('0x5e')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x1cb8('0x9d')],'as':_0x1cb8('0xa3'),'where':_0x54c586,'limit':0x1,'order':[[_0x1cb8('0xa0'),_0x1cb8('0xa4')]]}]},{'model':db[_0x1cb8('0xa5')],'as':_0x1cb8('0xa6')},{'model':db[_0x1cb8('0xa7')],'as':_0x1cb8('0xa7'),'include':[{'model':db[_0x1cb8('0xa7')],'as':'Intervals','attributes':['id',_0x1cb8('0xa8')],'raw':!![]}]}]});})[_0x1cb8('0x18')](function(_0x16e956){if(!_0x16e956){throw new APINotFoundError(util['format'](_0x1cb8('0xa9'),_0x953f93[_0x1cb8('0x5e')]['id']));}if(_0x1c2db2){return checkWebsiteInterval(_0x16e956);}return _0x16e956;})[_0x1cb8('0x18')](function(_0x22cf92){_0x55e0bc[_0x1cb8('0xaa')]=_0x22cf92;_0x55e0bc['applications']=_[_0x1cb8('0xab')](_0x22cf92['Applications'],[_0x1cb8('0xac')],[_0x1cb8('0xad')]);if(_0x55e0bc[_0x1cb8('0xaa')][_0x1cb8('0xa6')]){delete _0x55e0bc[_0x1cb8('0xaa')]['Applications'];}_0x55e0bc['list']=_0x22cf92[_0x1cb8('0xae')]||{'id':_0x22cf92['ListId']};if(_0x55e0bc[_0x1cb8('0xaf')]&&_0x55e0bc[_0x1cb8('0xaf')]['Contacts'][_0x1cb8('0x52')]){return _0x55e0bc[_0x1cb8('0xaf')][_0x1cb8('0xa3')][0x0];}var _0x5364b8=_['defaults'](_0x953f93[_0x1cb8('0x63')],{'firstName':_0x953f93[_0x1cb8('0x63')][_0x1cb8('0x98')],'ListId':_0x22cf92[_0x1cb8('0xa1')]});_0x5364b8[_0x953f93[_0x1cb8('0x63')]['mapKey']]=_0x953f93[_0x1cb8('0x63')][_0x1cb8('0x98')];return db[_0x1cb8('0x9d')]['create'](_0x5364b8,{'fields':_0x5e2acb,'raw':!![]});})[_0x1cb8('0x18')](function(_0x7362ad){_0x55e0bc[_0x1cb8('0xb0')]=_0x7362ad;var _0xad4af5=createInteractionObject(_0x953f93[_0x1cb8('0x5e')]['id'],_0x953f93[_0x1cb8('0x63')],_0x953f93[_0x1cb8('0xb1')],_0x7362ad);var _0x2add95={'ChatWebsiteId':_0x953f93[_0x1cb8('0x5e')]['id']};if(_0x953f93[_0x1cb8('0x63')]['threadId']){_0x2add95[_0x1cb8('0xb2')]=_0x953f93['body']['threadId'];_0x2add95['closed']=![];return db[_0x1cb8('0xb3')][_0x1cb8('0x62')]({'where':_0x2add95})[_0x1cb8('0x18')](function(_0x4040bb){var _0x574d04=_0x953f93['body'][_0x1cb8('0x36')]&&_0x953f93[_0x1cb8('0x63')][_0x1cb8('0x3c')];if(_0x4040bb){_0x55f800=!![];return _0x4040bb;}else if(!_0x574d04&&_0x4040bb&&_0x4040bb['closed']){throw new APIConflictError(_0x1cb8('0xb4'));}_0xad4af5[_0x1cb8('0xb2')]=_0x953f93[_0x1cb8('0x63')][_0x1cb8('0xb2')];_0xad4af5[_0x1cb8('0xb5')]=_0x953f93[_0x1cb8('0x63')][_0x1cb8('0xb5')];return db[_0x1cb8('0xb3')][_0x1cb8('0x6c')](_0xad4af5);});}_0x2add95[_0x1cb8('0xb6')]=_0x7362ad['id'];if(_0x953f93[_0x1cb8('0x63')][_0x1cb8('0xb7')]&&_0x953f93[_0x1cb8('0x63')]['interaction']['id']){_0x2add95['id']=_0x953f93['body'][_0x1cb8('0xb7')]['id'];return db[_0x1cb8('0xb3')][_0x1cb8('0x62')]({'where':_0x2add95})[_0x1cb8('0x18')](function(_0x395712){var _0x2b196a=_0x953f93[_0x1cb8('0x63')][_0x1cb8('0x36')]&&_0x953f93['body'][_0x1cb8('0x3c')];if(!_0x2b196a&&_0x395712&&_0x395712[_0x1cb8('0xb8')]){throw new APIConflictError(_0x1cb8('0xb4'));}else if(_0x395712){_0x55f800=!![];return _0x395712;}else{return db[_0x1cb8('0xb3')][_0x1cb8('0x6c')](_0xad4af5);}});}return db['ChatInteraction'][_0x1cb8('0x6c')](_0xad4af5);})[_0x1cb8('0x18')](function(_0x3e9331){if(!_0x55f800){return _0x3e9331;}var _0x224323={'from':(_0x55e0bc[_0x1cb8('0xb0')][_0x1cb8('0x3a')]||'')+'\x20'+(_0x55e0bc[_0x1cb8('0xb0')][_0x1cb8('0x3b')]||'')};if(_0x953f93[_0x1cb8('0x63')][_0x1cb8('0xb2')]&&_0x953f93[_0x1cb8('0x63')][_0x1cb8('0xb9')]&&_0x953f93[_0x1cb8('0x63')][_0x1cb8('0xb2')]!=_0x953f93[_0x1cb8('0x63')][_0x1cb8('0xb9')]){_0x224323[_0x1cb8('0xb2')]=_0x953f93[_0x1cb8('0x63')][_0x1cb8('0xb9')];}return _0x3e9331[_0x1cb8('0x2d')](_0x224323);})['then'](function(_0x5aac81){_0x55e0bc[_0x1cb8('0xb7')]=_0x5aac81[_0x1cb8('0x2e')]({'plain':!![]});_0x55e0bc[_0x1cb8('0xb7')][_0x1cb8('0xba')]=!_0x55f800;if(_0x55e0bc['interaction']['created']){if(_0x55e0bc[_0x1cb8('0xaa')][_0x1cb8('0xbb')]){_0x55e0bc[_0x1cb8('0xbc')][_0x1cb8('0xbd')]({'id':0x0,'priority':_0x55e0bc['applications'][_0x1cb8('0x52')]+0x1,'app':_0x1cb8('0xbe'),'appdata':_0x1cb8('0xbf'),'interval':_0x1cb8('0xc0')});}}return db['ChatMessage'][_0x1cb8('0x6c')]({'body':_0x953f93['body'][_0x1cb8('0x63')],'ChatWebsiteId':_0x953f93[_0x1cb8('0x5e')]['id'],'ChatInteractionId':_0x5aac81['id'],'direction':'in','ContactId':_0x55e0bc['contact']['id'],'AttachmentId':_0x953f93['body'][_0x1cb8('0xc1')]});})[_0x1cb8('0x18')](function(_0xd2c894){_0x55e0bc[_0x1cb8('0x21')]=_0xd2c894;if(!_0x55e0bc['interaction'][_0x1cb8('0xc2')]){return;}return db['User']['find']({'attributes':['id',_0x1cb8('0x31')],'where':{'id':_0x55e0bc[_0x1cb8('0xb7')][_0x1cb8('0xc2')]}});})[_0x1cb8('0x18')](function(_0x5df8b0){if(_0x5df8b0){_0x55e0bc['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x1cb8('0xc3'),'appdata':_0x5df8b0['name']+','+(_0x55e0bc[_0x1cb8('0xaa')][_0x1cb8('0xc4')]||0xa),'interval':'*,*,*,*'});_0x55e0bc['forcedOwnership']=!![];}if(!_0x55e0bc[_0x1cb8('0xb7')]['queueId']){return;}return db['ChatQueue'][_0x1cb8('0x62')]({'attributes':['id','name'],'where':{'id':_0x55e0bc[_0x1cb8('0xb7')][_0x1cb8('0xc5')]}});})[_0x1cb8('0x18')](function(_0xd35d89){if(_0xd35d89){_0x55e0bc[_0x1cb8('0xbc')]['unshift']({'id':0x0,'priority':0x1,'app':_0x1cb8('0xc6'),'appdata':_0xd35d89[_0x1cb8('0x31')]+','+(_0x55e0bc[_0x1cb8('0xaa')][_0x1cb8('0xc7')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x1cb8('0xc8'),_0x55e0bc);})['then'](function(_0x2e5037){respondWithRpcPromise(_0x1cb8('0xc9'),_0x1cb8('0xc9'),{'event':'notify','message':_0x2e5037},client9002);return _0x2e5037;})['then'](respondWithResult(_0x58b07e,null))[_0x1cb8('0x23')](APIHandleError(_0x58b07e));};exports[_0x1cb8('0xca')]=function(_0x522e26,_0x8c2aa4){var _0x4c21f4,_0x3c0934,_0x50dbbc;var _0x9c1563=[];var _0x215785={};var _0x426638=_0x522e26['files']||[];var _0xd15ec5=[];var _0x43265e;return db[_0x1cb8('0x9d')][_0x1cb8('0x6f')]()[_0x1cb8('0x18')](function(_0x55ffea){if(!_0x55ffea){throw new db[(_0x1cb8('0xcb'))][(_0x1cb8('0xcc'))](_0x1cb8('0xcd'));}_0x9c1563=_[_0x1cb8('0xce')](_[_0x1cb8('0x4d')](_0x55ffea),[_0x1cb8('0x9e'),_0x1cb8('0xa0'),_0x1cb8('0xcf'),_0x1cb8('0xa1')]);if(_0x522e26[_0x1cb8('0x63')]['id']){delete _0x522e26[_0x1cb8('0x63')]['id'];}if(_['isNil'](_0x522e26[_0x1cb8('0x63')][_0x1cb8('0x98')])){throw _0x8c2aa4[_0x1cb8('0x26')](0x1f4)[_0x1cb8('0x32')](new db[(_0x1cb8('0xcb'))]['ValidationError'](_0x1cb8('0xd0')));}if(_[_0x1cb8('0x8a')](_0x522e26['body'][_0x1cb8('0x63')])||_0x522e26[_0x1cb8('0x63')][_0x1cb8('0x63')]===''){throw _0x8c2aa4[_0x1cb8('0x26')](0x1f4)[_0x1cb8('0x32')](new db[(_0x1cb8('0xcb'))]['ValidationError'](_0x1cb8('0xd1')));}if(_[_0x1cb8('0x8a')](_0x522e26['body'][_0x1cb8('0xd2')])){throw _0x8c2aa4[_0x1cb8('0x26')](0x1f4)[_0x1cb8('0x32')](new db[(_0x1cb8('0xcb'))][(_0x1cb8('0xcc'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x9c1563));}if(!_[_0x1cb8('0x9f')](_0x9c1563,_0x522e26[_0x1cb8('0x63')]['mapKeyOffline'])){throw _0x8c2aa4[_0x1cb8('0x26')](0x1f4)[_0x1cb8('0x32')](new db[(_0x1cb8('0xcb'))][(_0x1cb8('0xcc'))](_0x1cb8('0xd3')+_0x9c1563));}_0x215785[_0x522e26['body'][_0x1cb8('0xd2')]]=_0x522e26[_0x1cb8('0x63')]['from'];})[_0x1cb8('0x18')](function(){return db[_0x1cb8('0x49')][_0x1cb8('0x62')]({'where':{'id':_0x522e26[_0x1cb8('0x5e')]['id']},'include':[{'model':db['CmList'],'as':_0x1cb8('0xae')},{'model':db[_0x1cb8('0xd4')],'as':_0x1cb8('0xd4')}]});})[_0x1cb8('0x18')](handleEntityNotFound(_0x8c2aa4,null))[_0x1cb8('0x18')](function(_0x7bb3c9){if(_0x7bb3c9&&_0x7bb3c9[_0x1cb8('0xae')]){_0x3c0934=_0x7bb3c9;var _0x420152=_[_0x1cb8('0x11')](_0x522e26[_0x1cb8('0x63')],{'firstName':_0x522e26['body']['from'],'phone':_0x522e26[_0x1cb8('0x63')][_0x1cb8('0x98')],'ListId':_0x7bb3c9[_0x1cb8('0xa1')]});_0x420152[_0x522e26[_0x1cb8('0x63')][_0x1cb8('0xd2')]]=_0x522e26[_0x1cb8('0x63')][_0x1cb8('0x98')];return db[_0x1cb8('0x9d')]['findOrCreate']({'where':_0x215785,'defaults':_0x420152});}})[_0x1cb8('0xd5')](function(_0x5a6ead){if(_0x5a6ead){_0x50dbbc=_0x5a6ead;var _0x14cfac=fs['readFileSync'](path[_0x1cb8('0x86')](config[_0x1cb8('0x8c')],_0x1cb8('0xd6')),_0x1cb8('0xd7'));var _0x122b16=ejs['render'](_0x14cfac,{'body':_[_0x1cb8('0xd8')](_0x522e26['body'][_0x1cb8('0x63')]),'bodyTitle':_0x3c0934[_0x1cb8('0xd9')]});return db[_0x1cb8('0xda')][_0x1cb8('0x6c')]({'body':_0x122b16,'plainBody':htmlToText[_0x1cb8('0xdb')](_0x122b16),'ContactId':_0x5a6ead['id'],'ChatWebsiteId':_0x3c0934['id']});}})['then'](function(_0x3b04af){_0x43265e=_0x3b04af;if(_0x426638[_0x1cb8('0x52')]){var _0x12a26d=_0x426638[_0x1cb8('0x48')](function(_0x3c53b3){return{'name':_0x3c53b3[_0x1cb8('0xdc')],'basename':_0x3c53b3[_0x1cb8('0x81')],'type':_0x3c53b3[_0x1cb8('0xdd')],'ChatOfflineMessageId':_0x3b04af['id']};});_0xd15ec5=_0x12a26d[_0x1cb8('0x48')](_0x39af2b=>{var _0x2a7a21={'filename':_0x39af2b[_0x1cb8('0x31')],'path':path[_0x1cb8('0x86')](config[_0x1cb8('0x8c')],_0x1cb8('0xde'),_0x1cb8('0xdf'),_0x1cb8('0xe0'),_0x1cb8('0xe1'),_0x39af2b[_0x1cb8('0xe2')])};return _0x2a7a21;});if(!_0x3c0934[_0x1cb8('0xe3')]){return db['sequelize'][_0x1cb8('0xe4')](function(_0x46c38e){return db[_0x1cb8('0xe5')][_0x1cb8('0xe6')](_0x12a26d,{'transaction':_0x46c38e});});}}})[_0x1cb8('0x18')](function(){if(_0x43265e){_0x4c21f4=_0x43265e;return db[_0x1cb8('0xd4')][_0x1cb8('0x71')]({'where':{'service':!![]},'include':[{'model':db[_0x1cb8('0xe7')],'as':_0x1cb8('0xe8'),'raw':!![],'include':[{'model':db[_0x1cb8('0xe9')],'as':_0x1cb8('0xe9'),'raw':!![]}]}]});}})[_0x1cb8('0x18')](function(_0xbf79b){if(_0xbf79b&&_0xbf79b[_0x1cb8('0xe8')]&&_0x3c0934[_0x1cb8('0xea')]&&_0x3c0934['forwardOfflineAddress']){var _0x437f93=_0xbf79b[_0x1cb8('0xeb')]();return respondWithRpcPromise('SendMail',_0x1cb8('0xec'),{'account':_0x437f93,'message':{'from':util[_0x1cb8('0x3f')](_0x1cb8('0xed'),_0xbf79b[_0x1cb8('0x31')],_0xbf79b['email']||_0xbf79b[_0x1cb8('0xe8')][_0x1cb8('0x67')]),'to':_0x3c0934[_0x1cb8('0xee')],'subject':_0x3c0934[_0x1cb8('0xef')],'html':_0x4c21f4[_0x1cb8('0x63')],'attachments':_0xd15ec5}},client9003)[_0x1cb8('0x18')](function(){return _0x4c21f4;})['catch'](function(_0x55631){logger[_0x1cb8('0x1f')](_0x55631);});}})[_0x1cb8('0x18')](function(){if(_0x3c0934&&_0x3c0934[_0x1cb8('0xe3')]&&_0x3c0934[_0x1cb8('0xf0')]){var _0x209017=[];if(_0x426638[_0x1cb8('0x52')]){_0x209017=_0x426638[_0x1cb8('0x48')](function(_0x2fa983){return{'name':_0x2fa983['originalname'],'basename':_0x2fa983[_0x1cb8('0x81')],'type':_0x2fa983[_0x1cb8('0xdd')],'ChatOfflineMessageId':_0x43265e['id']};});}var _0x423245;if(!_['isNil'](_0x3c0934[_0x1cb8('0xf1')])){var _0x18e798=_[_0x1cb8('0x48')](_0x522e26[_0x1cb8('0x63')],function(_0x27698e){return _0x27698e;});var _0x24e942=_[_0x1cb8('0xf2')](_0x18e798)[0x0];var _0x3ecb86=_['mapValues'](_0x24e942,function(_0x25f77c){return _0x25f77c;});_0x423245=_0x3ecb86[0x1][_0x3c0934['subjectOffline']];}var _0x327a2e={'from':_0x50dbbc[_0x1cb8('0xf3')],'firstName':_0x50dbbc[_0x1cb8('0x3a')],'lastName':_0x50dbbc[_0x1cb8('0x3b')],'mapKey':_0x1cb8('0xf3'),'message':{'from':_0x50dbbc['email'],'to':_0x3c0934[_0x1cb8('0xd4')][_0x1cb8('0xf3')],'cc':'','subject':_['isNil'](_0x423245)?_0x3c0934['offlineMessageSubject']:_0x423245,'messageId':'','sentAt':new Date(),'attach':_0x209017[_0x1cb8('0x52')],'attachments':_0x209017,'originChannel':_0x1cb8('0xf4'),'ChatWebsiteId':_0x3c0934['id'],'ChatOfflineMessageId':_0x4c21f4['id'],'originTo':_0x3c0934[_0x1cb8('0xd4')][_0x1cb8('0xf3')]},'body':_0x4c21f4[_0x1cb8('0x63')]};var _0x1e5abc={'account':{'id':_0x3c0934[_0x1cb8('0xf0')]},'body':_0x327a2e,'log':_0x1cb8('0xf5')};return respondWithRpcPromise(_0x1cb8('0xf5'),_0x1cb8('0xf6'),_0x1e5abc,client9001)[_0x1cb8('0x18')](function(){return _0x4c21f4;})[_0x1cb8('0x23')](function(_0x183208){logger[_0x1cb8('0x1f')](_0x183208);});}return;})[_0x1cb8('0x18')](function(){if(_0x4c21f4){return _0x4c21f4;}})[_0x1cb8('0x18')](respondWithResult(_0x8c2aa4,null))[_0x1cb8('0x23')](function(){for(var _0x2b6f7f of _0x426638){var _0x1f5694=path['join'](config['root'],_0x1cb8('0xde'),'files','attachments',_0x1cb8('0xe1'),_0x2b6f7f[_0x1cb8('0x81')]);fs_extra['remove'](_0x1f5694)[_0x1cb8('0x23')](function(_0x502d55){logger[_0x1cb8('0x1f')](_0x1cb8('0xf7'),_0x1f5694,_0x502d55);});}});};exports[_0x1cb8('0xf8')]=function(_0x4f58d5,_0x526eb6){return db[_0x1cb8('0xb3')]['find']({'where':{'id':_0x4f58d5[_0x1cb8('0x5e')]['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x526eb6,null))[_0x1cb8('0x18')](function(_0x5da69b){if(_0x5da69b){return _0x5da69b[_0x1cb8('0xf8')](_0x4f58d5['body']['ids'],_[_0x1cb8('0xf9')](_0x4f58d5[_0x1cb8('0x63')],[_0x1cb8('0x77'),'id'])||{});}})['then'](respondWithResult(_0x526eb6,null))[_0x1cb8('0x23')](handleError(_0x526eb6,null));};exports[_0x1cb8('0xfa')]=function(_0x5b96cc,_0xd8a47b){var _0x3ccb7d={'raw':![],'where':{}};var _0x3812cd={};var _0x1d7374={'count':0x0,'rows':[]};return db[_0x1cb8('0x49')][_0x1cb8('0x71')]({'where':{'id':_0x5b96cc[_0x1cb8('0x5e')]['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0xd8a47b,null))[_0x1cb8('0x18')](function(_0x318d31){if(_0x318d31){_0x3812cd['model']=_[_0x1cb8('0x4d')](db[_0x1cb8('0xb3')][_0x1cb8('0x4a')]);_0x3812cd['query']=_[_0x1cb8('0x4d')](_0x5b96cc['query']);_0x3812cd[_0x1cb8('0x4e')]=_[_0x1cb8('0x4f')](_0x3812cd[_0x1cb8('0x43')],_0x3812cd[_0x1cb8('0x4c')]);_0x3ccb7d[_0x1cb8('0x50')]=_['intersection'](_0x3812cd[_0x1cb8('0x43')],qs['fields'](_0x5b96cc[_0x1cb8('0x4c')][_0x1cb8('0x51')]));_0x3ccb7d[_0x1cb8('0x50')]=_0x3ccb7d[_0x1cb8('0x50')][_0x1cb8('0x52')]?_0x3ccb7d['attributes']:_0x3812cd[_0x1cb8('0x43')];if(!_0x5b96cc[_0x1cb8('0x4c')][_0x1cb8('0x53')]('nolimit')){_0x3ccb7d[_0x1cb8('0x28')]=qs[_0x1cb8('0x28')](_0x5b96cc[_0x1cb8('0x4c')]['limit']);_0x3ccb7d['offset']=qs[_0x1cb8('0x2a')](_0x5b96cc[_0x1cb8('0x4c')][_0x1cb8('0x2a')]);}_0x3ccb7d['order']=qs[_0x1cb8('0x55')](_0x5b96cc['query'][_0x1cb8('0x55')]);_0x3ccb7d[_0x1cb8('0x56')]=qs[_0x1cb8('0x4e')](_['pick'](_0x5b96cc['query'],_0x3812cd[_0x1cb8('0x4e')]));_0x3ccb7d[_0x1cb8('0x56')][_0x1cb8('0x75')]=_0x318d31['id'];if(_0x5b96cc['query'][_0x1cb8('0x59')]){_0x3ccb7d['where']=_[_0x1cb8('0x57')](_0x3ccb7d['where'],{'$or':_[_0x1cb8('0x48')](_0x3ccb7d[_0x1cb8('0x50')],function(_0x582e68){var _0x58b14b={};_0x58b14b[_0x582e68]={'$like':'%'+_0x5b96cc[_0x1cb8('0x4c')][_0x1cb8('0x59')]+'%'};return _0x58b14b;})});}_0x3ccb7d=_[_0x1cb8('0x57')]({},_0x3ccb7d,_0x5b96cc[_0x1cb8('0x5a')]);return db[_0x1cb8('0xb3')][_0x1cb8('0x29')]({'where':_0x3ccb7d[_0x1cb8('0x56')]})['then'](function(_0x398bb8){_0x1d7374[_0x1cb8('0x29')]=_0x398bb8;if(_0x5b96cc['query'][_0x1cb8('0x60')]){_0x3ccb7d[_0x1cb8('0x61')]=[{'model':db[_0x1cb8('0x9d')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x1cb8('0xfb'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0x1cb8('0xfc')],'as':_0x1cb8('0xfd'),'attributes':['id',_0x1cb8('0x31'),_0x1cb8('0xfe')],'where':_0x5b96cc['query'][_0x1cb8('0xff')]?{'id':_0x5b96cc[_0x1cb8('0x4c')][_0x1cb8('0xff')]}:undefined,'required':_0x5b96cc[_0x1cb8('0x4c')][_0x1cb8('0xff')]?!![]:![]}];}return db[_0x1cb8('0xb3')][_0x1cb8('0x5b')](_0x3ccb7d);})[_0x1cb8('0x18')](function(_0x5878fb){_0x1d7374['rows']=_0x5878fb;return _0x1d7374;});}})[_0x1cb8('0x18')](respondWithFilteredResult(_0xd8a47b,_0x3ccb7d))[_0x1cb8('0x23')](handleError(_0xd8a47b,null));};exports[_0x1cb8('0x100')]=function(_0x4f46df,_0x54c172){var _0x4bb9bf=0x0;var _0x2efa4a=0x0;var _0x4a1a96=![];var _0x526298;var _0x3ace86;return db[_0x1cb8('0x49')]['find']({'where':{'id':_0x4f46df[_0x1cb8('0x5e')]['id']},'include':[{'model':db['Interval'],'as':_0x1cb8('0xa7'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0x1cb8('0xa8')]}]}]})['then'](handleEntityNotFound(_0x54c172,null))[_0x1cb8('0x18')](function(_0x309e32){if(_0x309e32){_0x526298=_0x309e32;return _0x309e32[_0x1cb8('0x101')]({'raw':!![]});}})[_0x1cb8('0x18')](function(_0x3f1167){if(_0x526298){if(_0x3f1167){_0x3ace86=_0x3f1167;}}return require(_0x1cb8('0x88'))[_0x1cb8('0x102')]();})[_0x1cb8('0x18')](function(_0x1485aa){if(_0x1485aa){_0x2efa4a=_0x1485aa['virtual'];_0x4a1a96=_0x1485aa['custom'];}})[_0x1cb8('0x18')](function(){return db['ChatInteraction'][_0x1cb8('0x29')]({'where':{'closed':![]}});})[_0x1cb8('0x18')](function(_0xc0d895){_0x4bb9bf=_0xc0d895;if(_0x2efa4a&&_0xc0d895>_0x2efa4a){return db[_0x1cb8('0x103')]['findOne']({'where':{'id':0x1}})[_0x1cb8('0x18')](function(_0x1fea10){if(_0x1fea10){_0x1fea10[_0x1cb8('0x104')]('chatLicenseExceeded');}});}})[_0x1cb8('0x18')](function(){var _0x3ed9fd=_0x526298[_0x1cb8('0xa7')];var _0x1319ad=_0x526298['timezone']||undefined;return _0x3ed9fd?_0x3ed9fd['ifTime'](_0x1319ad):!![];})['then'](function(_0x1a46f0){var _0x1ac4aa=fs['readFileSync'](path[_0x1cb8('0x86')](config['root'],'server/files/chat/iframe.ejs'),'utf8');var _0x211dac=_0x1cb8('0x105');var _0x2f27dd=![];var _0x47d2f0,_0xd88ec7;if(_0x4f46df[_0x1cb8('0xb1')]['referer']){_0x47d2f0=new URL(_0x4f46df[_0x1cb8('0xb1')]['referer'])[_0x1cb8('0x106')];}else if(_0x4f46df['headers'][_0x1cb8('0x106')]){_0x47d2f0=new URL(_0x4f46df[_0x1cb8('0xb1')][_0x1cb8('0x106')])[_0x1cb8('0x106')];}else{_0x47d2f0=_0x1cb8('0x107');}_0xd88ec7=typeof _0x526298[_0x1cb8('0x108')]['split'](',')[_0x1cb8('0x62')](function(_0x45cc1c){return wildcardUtils['testWebsiteWithWildcard'](_0x45cc1c,_0x47d2f0);})!=='undefined';var _0x5d219a={'chatVersion':_0x211dac,'chatWebsiteAddressOrigin':_0xd88ec7?_0x47d2f0:_0x526298['address'],'remote':_0x526298[_0x1cb8('0x109')],'query':querystring[_0x1cb8('0x1e')](_[_0x1cb8('0x57')](_0x526298[_0x1cb8('0x2e')]({'plain':!![]}),{'customerIp':_0x4f46df[_0x1cb8('0xb1')][_0x1cb8('0x38')]||_0x4f46df[_0x1cb8('0xb1')][_0x1cb8('0x10a')]||_0x4f46df[_0x1cb8('0x10b')]['remoteAddress']||_0x4f46df['ip'],'referer':_0x4f46df[_0x1cb8('0xb1')][_0x1cb8('0x3c')],'openedInteractions':_0x4bb9bf,'maxInteractions':_0x2efa4a,'virtual':_0x4a1a96[_0x1cb8('0x10c')],'online':_0x1a46f0,'custom':_0x4a1a96,'address':_0xd88ec7?_0x47d2f0:null}))[_0x1cb8('0x10d')](/'/g,'\x5c\x27')};_0x54c172[_0x1cb8('0x32')](ejs['render'](Mustache[_0x1cb8('0x10e')](_0x1ac4aa,_0x5d219a),{'proactiveActions':_0x3ace86,'alignment':_0x526298[_0x1cb8('0x10f')],'verticalAlignment':_0x526298[_0x1cb8('0x110')],'div_color':_0x526298[_0x1cb8('0xfe')],'labelText':_0x526298[_0x1cb8('0x111')],'text_color':_0x526298[_0x1cb8('0x112')],'text_button_color':_0x526298[_0x1cb8('0x113')],'button_color':_0x526298[_0x1cb8('0x114')],'background_color':_0x526298[_0x1cb8('0x115')],'hideWhenOffline':_0x526298[_0x1cb8('0x116')],'intervalId':_0x526298[_0x1cb8('0x117')],'isDevelopment':_0x2f27dd,'chatVersion':_0x211dac}));})[_0x1cb8('0x23')](handleError(_0x54c172,null));};exports[_0x1cb8('0x118')]=function(_0x502d26,_0xf049fc){var _0x38d9ee=_0x502d26['params']['id'];var _0x70d4e1=_0x502d26[_0x1cb8('0x63')];var _0x1f615e=0xc8;var _0x254b42=null;return db[_0x1cb8('0x119')][_0x1cb8('0xe4')]({'isolationLevel':db[_0x1cb8('0x119')][_0x1cb8('0x11a')]['ISOLATION_LEVELS'][_0x1cb8('0x11b')]},function(_0x2b533f){return db[_0x1cb8('0x49')]['findOne']({'where':{'id':_0x38d9ee},'transaction':_0x2b533f})[_0x1cb8('0x18')](function(_0x36a875){if(_0x36a875){return db[_0x1cb8('0xa5')][_0x1cb8('0x2f')]({'where':{'ChatWebsiteId':_0x38d9ee},'transaction':_0x2b533f})[_0x1cb8('0x18')](function(){var _0x13905e=_['map'](_0x70d4e1,function(_0x41a769){_0x41a769[_0x1cb8('0x75')]=_0x38d9ee;return _0x41a769;});return db[_0x1cb8('0xa5')][_0x1cb8('0xe6')](_0x13905e,{'transaction':_0x2b533f});});}else{_0x1f615e=0x194;_0x254b42=[];}});})[_0x1cb8('0x18')](function(){if(_0x1f615e!==0x194){return db[_0x1cb8('0xa5')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x38d9ee},'order':_0x1cb8('0xac')})[_0x1cb8('0x18')](function(_0x4e3037){_0x254b42=_0x4e3037;});}})['catch'](function(_0x74dd99){_0x1f615e=0x1f4;logger[_0x1cb8('0x1f')](_0x74dd99[_0x1cb8('0x30')]);if(_0x74dd99[_0x1cb8('0x31')]){delete _0x74dd99[_0x1cb8('0x31')];}_0x254b42=_0x74dd99;})[_0x1cb8('0x11c')](function(){if(_0x254b42===null){_0xf049fc[_0x1cb8('0x24')](_0x1f615e);}else{if(_0x1f615e===0x1f4){_0xf049fc[_0x1cb8('0x26')](_0x1f615e)['send'](_0x254b42);}else{_0xf049fc['status'](_0x1f615e)['json'](_0x254b42);}}});};exports[_0x1cb8('0x11d')]=function(_0x47b6ed,_0x202fc9){var _0x3f85ea={};var _0x463341={};var _0x4b475f;var _0x363000;return db[_0x1cb8('0x49')][_0x1cb8('0x71')]({'where':{'id':_0x47b6ed['params']['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x202fc9,null))[_0x1cb8('0x18')](function(_0x423e79){if(_0x423e79){_0x4b475f=_0x423e79;_0x463341[_0x1cb8('0x43')]=_[_0x1cb8('0x4d')](db[_0x1cb8('0xa5')][_0x1cb8('0x4a')]);_0x463341['query']=_['keys'](_0x47b6ed[_0x1cb8('0x4c')]);_0x463341['filters']=_[_0x1cb8('0x4f')](_0x463341['model'],_0x463341[_0x1cb8('0x4c')]);_0x3f85ea[_0x1cb8('0x50')]=_[_0x1cb8('0x4f')](_0x463341[_0x1cb8('0x43')],qs[_0x1cb8('0x51')](_0x47b6ed['query'][_0x1cb8('0x51')]));_0x3f85ea[_0x1cb8('0x50')]=_0x3f85ea[_0x1cb8('0x50')][_0x1cb8('0x52')]?_0x3f85ea['attributes']:_0x463341[_0x1cb8('0x43')];_0x3f85ea[_0x1cb8('0x54')]=qs[_0x1cb8('0x55')](_0x47b6ed[_0x1cb8('0x4c')][_0x1cb8('0x55')]);_0x3f85ea['where']=qs[_0x1cb8('0x4e')](_[_0x1cb8('0x74')](_0x47b6ed[_0x1cb8('0x4c')],_0x463341['filters']));if(_0x47b6ed[_0x1cb8('0x4c')][_0x1cb8('0x59')]){_0x3f85ea[_0x1cb8('0x56')]=_[_0x1cb8('0x57')](_0x3f85ea['where'],{'$or':_[_0x1cb8('0x48')](_0x3f85ea[_0x1cb8('0x50')],function(_0x2839a8){var _0x16e8d2={};_0x16e8d2[_0x2839a8]={'$like':'%'+_0x47b6ed[_0x1cb8('0x4c')][_0x1cb8('0x59')]+'%'};return _0x16e8d2;})});}_0x3f85ea=_[_0x1cb8('0x57')]({},_0x3f85ea,_0x47b6ed[_0x1cb8('0x5a')]);return _0x4b475f[_0x1cb8('0x11d')](_0x3f85ea);}})[_0x1cb8('0x18')](function(_0x5de558){if(_0x5de558){_0x363000=_0x5de558[_0x1cb8('0x52')];if(!_0x47b6ed[_0x1cb8('0x4c')]['hasOwnProperty'](_0x1cb8('0x73'))){_0x3f85ea['limit']=qs[_0x1cb8('0x28')](_0x47b6ed[_0x1cb8('0x4c')]['limit']);_0x3f85ea[_0x1cb8('0x2a')]=qs[_0x1cb8('0x2a')](_0x47b6ed[_0x1cb8('0x4c')][_0x1cb8('0x2a')]);}return _0x4b475f[_0x1cb8('0x11d')](_0x3f85ea);}})[_0x1cb8('0x18')](function(_0x4c5f96){if(_0x4c5f96){return _0x4c5f96?{'count':_0x363000,'rows':_0x4c5f96}:null;}})[_0x1cb8('0x18')](respondWithResult(_0x202fc9,null))[_0x1cb8('0x23')](handleError(_0x202fc9,null));};exports['addProactiveActions']=function(_0x4a1b43,_0x3ac39c){return db[_0x1cb8('0x11e')][_0x1cb8('0x62')]({'where':{'id':_0x4a1b43[_0x1cb8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3ac39c,null))['then'](function(_0x106b44){if(_0x106b44){return _0x106b44['addProactiveActions'](_0x4a1b43[_0x1cb8('0x63')][_0x1cb8('0x77')],_[_0x1cb8('0xf9')](_0x4a1b43['body'],['ids','id'])||{});}})[_0x1cb8('0x18')](respondWithResult(_0x3ac39c,null))[_0x1cb8('0x23')](handleError(_0x3ac39c,null));};exports['getProactiveActions']=function(_0x2edb7e,_0x1a51f0){var _0x57c2cf={};var _0x1eadd3={};var _0x5aed14;var _0x15139c;return db[_0x1cb8('0x49')][_0x1cb8('0x71')]({'where':{'id':_0x2edb7e['params']['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x1a51f0,null))[_0x1cb8('0x18')](function(_0x19ef15){if(_0x19ef15){_0x5aed14=_0x19ef15;_0x1eadd3['model']=_['keys'](db[_0x1cb8('0x11f')][_0x1cb8('0x4a')]);_0x1eadd3[_0x1cb8('0x4c')]=_[_0x1cb8('0x4d')](_0x2edb7e[_0x1cb8('0x4c')]);_0x1eadd3[_0x1cb8('0x4e')]=_[_0x1cb8('0x4f')](_0x1eadd3[_0x1cb8('0x43')],_0x1eadd3[_0x1cb8('0x4c')]);_0x57c2cf[_0x1cb8('0x50')]=_[_0x1cb8('0x4f')](_0x1eadd3[_0x1cb8('0x43')],qs['fields'](_0x2edb7e['query']['fields']));_0x57c2cf[_0x1cb8('0x50')]=_0x57c2cf['attributes'][_0x1cb8('0x52')]?_0x57c2cf['attributes']:_0x1eadd3[_0x1cb8('0x43')];_0x57c2cf['order']=qs['sort'](_0x2edb7e[_0x1cb8('0x4c')][_0x1cb8('0x55')]);_0x57c2cf['where']=qs[_0x1cb8('0x4e')](_[_0x1cb8('0x74')](_0x2edb7e[_0x1cb8('0x4c')],_0x1eadd3[_0x1cb8('0x4e')]));if(_0x2edb7e[_0x1cb8('0x4c')]['filter']){_0x57c2cf[_0x1cb8('0x56')]=_[_0x1cb8('0x57')](_0x57c2cf[_0x1cb8('0x56')],{'$or':_[_0x1cb8('0x48')](_0x57c2cf[_0x1cb8('0x50')],function(_0x5c0ef8){var _0x5b699b={};_0x5b699b[_0x5c0ef8]={'$like':'%'+_0x2edb7e[_0x1cb8('0x4c')][_0x1cb8('0x59')]+'%'};return _0x5b699b;})});}_0x57c2cf=_[_0x1cb8('0x57')]({},_0x57c2cf,_0x2edb7e[_0x1cb8('0x5a')]);return _0x5aed14['getProactiveActions'](_0x57c2cf);}})[_0x1cb8('0x18')](function(_0x27a766){if(_0x27a766){_0x15139c=_0x27a766['length'];if(!_0x2edb7e[_0x1cb8('0x4c')][_0x1cb8('0x53')]('nolimit')){_0x57c2cf[_0x1cb8('0x28')]=qs[_0x1cb8('0x28')](_0x2edb7e['query']['limit']);_0x57c2cf[_0x1cb8('0x2a')]=qs['offset'](_0x2edb7e[_0x1cb8('0x4c')][_0x1cb8('0x2a')]);}return _0x5aed14['getProactiveActions'](_0x57c2cf);}})[_0x1cb8('0x18')](function(_0x34c028){if(_0x34c028){return _0x34c028?{'count':_0x15139c,'rows':_0x34c028}:null;}})[_0x1cb8('0x18')](respondWithResult(_0x1a51f0,null))['catch'](handleError(_0x1a51f0,null));};exports[_0x1cb8('0x120')]=function(_0x548df4,_0xfb255e){var _0x424916=_0x548df4['query']['online']===_0x1cb8('0x121')?'offlineForm':_0x1cb8('0x122');return db[_0x1cb8('0x49')][_0x1cb8('0x62')]({'attributes':['id',_0x424916],'where':{'id':_0x548df4[_0x1cb8('0x5e')]['id']}})['then'](handleEntityNotFound(_0xfb255e,null))[_0x1cb8('0x18')](function(_0x3dba7a){if(_0x3dba7a){var _0x3bfd8b=_0x3dba7a[_0x424916];var _0x364373=_0x3bfd8b&&_0x3bfd8b[_0x1cb8('0x123')]?_0x3bfd8b['items']:[];_0xfb255e[_0x1cb8('0x32')]({'fromKey':_[_0x1cb8('0x8a')](_0x3bfd8b[_0x1cb8('0x124')])?undefined:_0x3bfd8b[_0x1cb8('0x124')],'count':_0x364373[_0x1cb8('0x52')],'rows':_0x364373});}})[_0x1cb8('0x23')](handleError(_0xfb255e,null));};exports['getOfflineMessages']=function(_0x10c924,_0x3e930e){var _0x44c8aa={'raw':![],'where':{}};var _0x174f23={};var _0x322415={'count':0x0,'rows':[]};return db[_0x1cb8('0x49')][_0x1cb8('0x71')]({'where':{'id':_0x10c924['params']['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x3e930e,null))['then'](function(_0x21825f){if(_0x21825f){_0x174f23['model']=_[_0x1cb8('0x4d')](db[_0x1cb8('0xda')][_0x1cb8('0x4a')]);_0x174f23[_0x1cb8('0x4c')]=_[_0x1cb8('0x4d')](_0x10c924[_0x1cb8('0x4c')]);_0x174f23['filters']=_[_0x1cb8('0x4f')](_0x174f23['model'],_0x174f23['query']);_0x44c8aa[_0x1cb8('0x50')]=_['intersection'](_0x174f23[_0x1cb8('0x43')],qs['fields'](_0x10c924['query'][_0x1cb8('0x51')]));_0x44c8aa[_0x1cb8('0x50')]=_0x44c8aa[_0x1cb8('0x50')]['length']?_0x44c8aa[_0x1cb8('0x50')]:_0x174f23[_0x1cb8('0x43')];if(!_0x10c924[_0x1cb8('0x4c')][_0x1cb8('0x53')](_0x1cb8('0x73'))){_0x44c8aa[_0x1cb8('0x28')]=qs['limit'](_0x10c924[_0x1cb8('0x4c')]['limit']);_0x44c8aa[_0x1cb8('0x2a')]=qs['offset'](_0x10c924[_0x1cb8('0x4c')][_0x1cb8('0x2a')]);}_0x44c8aa[_0x1cb8('0x54')]=qs[_0x1cb8('0x55')](_0x10c924[_0x1cb8('0x4c')][_0x1cb8('0x55')]);_0x44c8aa['where']=qs[_0x1cb8('0x4e')](_['pick'](_0x10c924['query'],_0x174f23[_0x1cb8('0x4e')]));_0x44c8aa['where'][_0x1cb8('0x75')]=_0x21825f['id'];if(_0x10c924['query']['filter']){_0x44c8aa[_0x1cb8('0x56')]=_['merge'](_0x44c8aa[_0x1cb8('0x56')],{'$or':_['map'](_0x44c8aa[_0x1cb8('0x50')],function(_0x31311d){var _0x11a302={};_0x11a302[_0x31311d]={'$like':'%'+_0x10c924[_0x1cb8('0x4c')][_0x1cb8('0x59')]+'%'};return _0x11a302;})});}_0x44c8aa=_[_0x1cb8('0x57')]({},_0x44c8aa,_0x10c924[_0x1cb8('0x5a')]);return db['ChatOfflineMessage'][_0x1cb8('0x29')]({'where':_0x44c8aa['where']})[_0x1cb8('0x18')](function(_0x58101a){_0x322415['count']=_0x58101a;if(_0x10c924['query'][_0x1cb8('0x60')]){_0x44c8aa[_0x1cb8('0x61')]=[{'all':!![]}];}else{_0x44c8aa[_0x1cb8('0x61')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x1cb8('0xe5')],'as':_0x1cb8('0x125'),'required':![]}];}return db['ChatOfflineMessage'][_0x1cb8('0x5b')](_0x44c8aa);})['then'](function(_0x4f64b6){_0x322415[_0x1cb8('0x5c')]=_0x4f64b6;return _0x322415;});}})[_0x1cb8('0x18')](respondWithFilteredResult(_0x3e930e,_0x44c8aa))[_0x1cb8('0x23')](handleError(_0x3e930e,null));};exports['addAgents']=function(_0x1f37ac,_0x40218c){return db[_0x1cb8('0x49')][_0x1cb8('0x62')]({'where':{'id':_0x1f37ac[_0x1cb8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x40218c,null))[_0x1cb8('0x18')](function(_0x5a34e1){if(_0x5a34e1){return _0x5a34e1[_0x1cb8('0x126')](_0x1f37ac['body']['ids'],_['omit'](_0x1f37ac['body'],[_0x1cb8('0x77'),'id'])||{})[_0x1cb8('0xd5')](function(_0x1e6466){for(var _0x317996=0x0;_0x317996<_0x1f37ac[_0x1cb8('0x63')]['ids'][_0x1cb8('0x52')];_0x317996+=0x1){socket['emit'](_0x1cb8('0x127'),{'UserId':Number(_0x1f37ac[_0x1cb8('0x63')][_0x1cb8('0x77')][_0x317996]),'ChatWebsiteId':Number(_0x1f37ac[_0x1cb8('0x5e')]['id'])});}return _0x1e6466;});}})[_0x1cb8('0x18')](respondWithResult(_0x40218c,null))[_0x1cb8('0x23')](handleError(_0x40218c,null));};exports[_0x1cb8('0x128')]=function(_0x5cc4bc,_0x116020){return db[_0x1cb8('0x49')]['find']({'where':{'id':_0x5cc4bc[_0x1cb8('0x5e')]['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x116020,null))[_0x1cb8('0x18')](function(_0x227c16){if(_0x227c16){return _0x227c16[_0x1cb8('0x128')](_0x5cc4bc[_0x1cb8('0x4c')][_0x1cb8('0x77')])[_0x1cb8('0x18')](function(){if(_[_0x1cb8('0x129')](_0x5cc4bc[_0x1cb8('0x4c')]['ids'])){for(var _0x788c53=0x0;_0x788c53<_0x5cc4bc[_0x1cb8('0x4c')][_0x1cb8('0x77')][_0x1cb8('0x52')];_0x788c53+=0x1){socket[_0x1cb8('0x12a')](_0x1cb8('0x12b'),{'UserId':Number(_0x5cc4bc[_0x1cb8('0x4c')][_0x1cb8('0x77')][_0x788c53]),'ChatWebsiteId':Number(_0x5cc4bc['params']['id'])});}}else{socket[_0x1cb8('0x12a')](_0x1cb8('0x12b'),{'UserId':Number(_0x5cc4bc[_0x1cb8('0x4c')][_0x1cb8('0x77')]),'ChatWebsiteId':Number(_0x5cc4bc['params']['id'])});}});}})['then'](respondWithStatusCode(_0x116020,null))[_0x1cb8('0x23')](handleError(_0x116020,null));};exports[_0x1cb8('0x12c')]=function(_0x27077e,_0x2935d6){var _0x570652={};var _0x4e8e21={};var _0x40ecba;var _0x2f924f;return db[_0x1cb8('0x49')][_0x1cb8('0x71')]({'where':{'id':_0x27077e['params']['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x2935d6,null))[_0x1cb8('0x18')](function(_0x29a1a1){if(_0x29a1a1){_0x40ecba=_0x29a1a1;_0x4e8e21['model']=_['keys'](db[_0x1cb8('0x12d')][_0x1cb8('0x4a')]);_0x4e8e21['query']=_[_0x1cb8('0x4d')](_0x27077e[_0x1cb8('0x4c')]);_0x4e8e21[_0x1cb8('0x4e')]=_[_0x1cb8('0x4f')](_0x4e8e21[_0x1cb8('0x43')],_0x4e8e21[_0x1cb8('0x4c')]);_0x570652['attributes']=_[_0x1cb8('0x4f')](_0x4e8e21['model'],qs['fields'](_0x27077e['query'][_0x1cb8('0x51')]));_0x570652[_0x1cb8('0x50')]=_0x570652[_0x1cb8('0x50')]['length']?_0x570652[_0x1cb8('0x50')]:_0x4e8e21[_0x1cb8('0x43')];_0x570652[_0x1cb8('0x54')]=qs[_0x1cb8('0x55')](_0x27077e[_0x1cb8('0x4c')]['sort']);_0x570652[_0x1cb8('0x56')]=qs[_0x1cb8('0x4e')](_[_0x1cb8('0x74')](_0x27077e[_0x1cb8('0x4c')],_0x4e8e21['filters']));if(_0x27077e[_0x1cb8('0x4c')][_0x1cb8('0x59')]){_0x570652[_0x1cb8('0x56')]=_['merge'](_0x570652[_0x1cb8('0x56')],{'$or':_[_0x1cb8('0x48')](_0x570652[_0x1cb8('0x50')],function(_0x3a56fc){var _0x5e3e91={};_0x5e3e91[_0x3a56fc]={'$like':'%'+_0x27077e[_0x1cb8('0x4c')]['filter']+'%'};return _0x5e3e91;})});}_0x570652=_[_0x1cb8('0x57')]({},_0x570652,_0x27077e[_0x1cb8('0x5a')]);return _0x40ecba[_0x1cb8('0x12c')](_0x570652);}})[_0x1cb8('0x18')](function(_0x26ef24){if(_0x26ef24){_0x2f924f=_0x26ef24[_0x1cb8('0x52')];if(!_0x27077e[_0x1cb8('0x4c')][_0x1cb8('0x53')]('nolimit')){_0x570652['limit']=qs['limit'](_0x27077e['query'][_0x1cb8('0x28')]);_0x570652[_0x1cb8('0x2a')]=qs[_0x1cb8('0x2a')](_0x27077e['query'][_0x1cb8('0x2a')]);}return _0x40ecba[_0x1cb8('0x12c')](_0x570652);}})[_0x1cb8('0x18')](function(_0x34e3c9){if(_0x34e3c9){return _0x34e3c9?{'count':_0x2f924f,'rows':_0x34e3c9}:null;}})[_0x1cb8('0x18')](respondWithResult(_0x2935d6,null))[_0x1cb8('0x23')](handleError(_0x2935d6,null));}; \ No newline at end of file +var _0x6f0d=['addInteraction','omit','getInteractions','rawAttributes','Contact','User','Owner','fullname','internal','Tag','color','tag','getSnippet','getProactiveActions','virtual','License','increment','readFileSync','server/files/chat/iframe.ejs','3.10.1','origin','http://localhost:9000','testWebsiteWithWildcard','x-real-ip','connection','replace','alignment','verticalAlignment','textColor','textButtonColor','color_button','backgroundColor','IntervalId','addApplications','transaction','Transaction','stack','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','spread','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','util','path','ejs','fs-extra','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','api','../../errors/api','APIBadRequestError','APINotFoundError','handleError','APIConflictError','./helpers/wildcard-expressions','URL','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','get','ChatWebsites','UserProfileResource','name','send','setUA','user-agent','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','model','device','%s\x20%s\x20%s','vendor','type','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','key','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','create','address','forEach','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','timezone','ifTime','notify','chat','from','mapKey','isEmpty','Body\x20is\x20mandatory','CmContact','createdAt','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','List','Contacts','DESC','ChatApplication','Applications','interval','account','applications','orderBy','priority','asc','list','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','contact','lastName','messageId','created','autoclose','push','close','AttachmentId','UserId','unshift','agent','ChatQueue','queueId','queue','waitForTheAssignedQueue','startRouting','EventManager','offline','files','Sequelize','ValidationError','no\x20available\x20attributes','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','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','attachments','offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','email','offlineMessageSubject','MailAccountId','subjectOffline','mapValues','Chat','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file'];(function(_0x477d3e,_0x25003b){var _0x4addc1=function(_0x169e9e){while(--_0x169e9e){_0x477d3e['push'](_0x477d3e['shift']());}};_0x4addc1(++_0x25003b);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x28cde3,_0x5d4fc6){_0x28cde3=_0x28cde3-0x0;var _0x2dba45=_0x6f0d[_0x28cde3];return _0x2dba45;};'use strict';var Mustache=require('mustache');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var ejs=require(_0xd6f0('0x2'));var fs=require('fs');var fs_extra=require(_0xd6f0('0x3'));var _=require('lodash');var querystring=require(_0xd6f0('0x4'));var htmlToText=require(_0xd6f0('0x5'));var Redis=require(_0xd6f0('0x6'));var jayson=require(_0xd6f0('0x7'));var qs=require(_0xd6f0('0x8'));var logger=require('../../config/logger')(_0xd6f0('0x9'));var config=require('../../config/environment');var APIBadRequestError=require(_0xd6f0('0xa'))[_0xd6f0('0xb')];var APINotFoundError=require(_0xd6f0('0xa'))[_0xd6f0('0xc')];var APIOutOfIntervalError=require('../../errors/api')['APIOutOfIntervalError'];var APIHandleError=require(_0xd6f0('0xa'))[_0xd6f0('0xd')];var APIConflictError=require(_0xd6f0('0xa'))[_0xd6f0('0xe')];var wildcardUtils=require(_0xd6f0('0xf'));var URL=require('url')[_0xd6f0('0x10')];var db=require(_0xd6f0('0x11'))['db'];config[_0xd6f0('0x12')]=_[_0xd6f0('0x13')](config['redis'],{'host':_0xd6f0('0x14'),'port':0x18eb});var socket=require(_0xd6f0('0x15'))(new Redis(config[_0xd6f0('0x12')]));require(_0xd6f0('0x16'))[_0xd6f0('0x17')](socket);var client=jayson[_0xd6f0('0x18')][_0xd6f0('0x19')]({'port':0x232c});var client9002=jayson[_0xd6f0('0x18')][_0xd6f0('0x19')]({'port':0x232a});var client9003=jayson['client'][_0xd6f0('0x19')]({'port':0x232b});var client9001=jayson[_0xd6f0('0x18')]['http']({'port':0x2329});function respondWithRpcPromise(_0x419b7e,_0x593abe,_0x3f4851,_0x154e3e){return new Promise(function(_0x41bd99,_0x472156){var _0x64ff5f=_0x154e3e||client;return _0x64ff5f[_0xd6f0('0x1a')](_0x419b7e,_0x3f4851)[_0xd6f0('0x1b')](function(_0x29fbb9){logger[_0xd6f0('0x1c')](_0xd6f0('0x1d'),_0x593abe,_0xd6f0('0x1e'));logger[_0xd6f0('0x1f')](_0xd6f0('0x20'),_0x593abe,_0xd6f0('0x1e'),JSON[_0xd6f0('0x21')](_0x29fbb9));if(_0x29fbb9[_0xd6f0('0x22')]){if(_0x29fbb9['error']['code']===0x1f4){logger[_0xd6f0('0x22')](_0xd6f0('0x1d'),_0x593abe,_0x29fbb9[_0xd6f0('0x22')]['message']);return _0x472156(_0x29fbb9[_0xd6f0('0x22')][_0xd6f0('0x23')]);}logger['error'](_0xd6f0('0x1d'),_0x593abe,_0x29fbb9['error'][_0xd6f0('0x23')]);return _0x41bd99(_0x29fbb9[_0xd6f0('0x22')]['message']);}else{logger[_0xd6f0('0x1c')](_0xd6f0('0x1d'),_0x593abe,'request\x20sent');_0x41bd99(_0x29fbb9[_0xd6f0('0x24')][_0xd6f0('0x23')]);}})[_0xd6f0('0x25')](function(_0x5b1a62){logger[_0xd6f0('0x22')](_0xd6f0('0x1d'),_0x593abe,_0x5b1a62);_0x472156(_0x5b1a62);});});}function respondWithStatusCode(_0x5ecb16,_0xcea0ae){_0xcea0ae=_0xcea0ae||0xcc;return function(_0x551be8){if(_0x551be8){return _0x5ecb16[_0xd6f0('0x26')](_0xcea0ae);}return _0x5ecb16[_0xd6f0('0x27')](_0xcea0ae)[_0xd6f0('0x28')]();};}function respondWithResult(_0x3c1bff,_0x4101bd){_0x4101bd=_0x4101bd||0xc8;return function(_0x715aab){if(_0x715aab){return _0x3c1bff[_0xd6f0('0x27')](_0x4101bd)[_0xd6f0('0x29')](_0x715aab);}};}function respondWithFilteredResult(_0x48975d,_0x1ea941){return function(_0x1982d3){if(_0x1982d3){var _0x55656c=typeof _0x1ea941[_0xd6f0('0x2a')]===_0xd6f0('0x2b')&&typeof _0x1ea941[_0xd6f0('0x2c')]===_0xd6f0('0x2b');var _0x1a3967=_0x1982d3[_0xd6f0('0x2d')];var _0x351fda=_0x55656c?0x0:_0x1ea941[_0xd6f0('0x2a')];var _0x465cf9=_0x55656c?_0x1982d3[_0xd6f0('0x2d')]:_0x1ea941[_0xd6f0('0x2a')]+_0x1ea941[_0xd6f0('0x2c')];var _0x348529;if(_0x465cf9>=_0x1a3967){_0x465cf9=_0x1a3967;_0x348529=0xc8;}else{_0x348529=0xce;}_0x48975d[_0xd6f0('0x27')](_0x348529);return _0x48975d[_0xd6f0('0x2e')](_0xd6f0('0x2f'),_0x351fda+'-'+_0x465cf9+'/'+_0x1a3967)[_0xd6f0('0x29')](_0x1982d3);}return null;};}function saveUpdates(_0x376890){return function(_0x1086d6){if(_0x1086d6){return _0x1086d6[_0xd6f0('0x30')](_0x376890)[_0xd6f0('0x1b')](function(_0x26ab29){return _0x26ab29;});}return null;};}function removeEntity(_0x4a8ebe){return function(_0x11124c){if(_0x11124c){return _0x11124c['destroy']()['then'](function(){var _0x43d588=_0x11124c[_0xd6f0('0x31')]({'plain':!![]});var _0x12a6fa=_0xd6f0('0x32');return db[_0xd6f0('0x33')]['destroy']({'where':{'type':_0x12a6fa,'resourceId':_0x43d588['id']}})[_0xd6f0('0x1b')](function(){return _0x11124c;});})['then'](function(){_0x4a8ebe[_0xd6f0('0x27')](0xcc)[_0xd6f0('0x28')]();});}};}function handleEntityNotFound(_0x42c01a){return function(_0x1eecf0){if(!_0x1eecf0){_0x42c01a[_0xd6f0('0x26')](0x194);}return _0x1eecf0;};}function handleError(_0x5c3132,_0x47b33d){_0x47b33d=_0x47b33d||0x1f4;return function(_0x3b6463){logger[_0xd6f0('0x22')](_0x3b6463['stack']);if(_0x3b6463[_0xd6f0('0x34')]){delete _0x3b6463['name'];}_0x5c3132[_0xd6f0('0x27')](_0x47b33d)[_0xd6f0('0x35')](_0x3b6463);};}function createInteractionObject(_0x28659e,_0x1852dd,_0x451834,_0x3d1280){var _0x6b44fa=require('user-agent-parser');var _0x52203d=new _0x6b44fa();var _0x162537=_0x52203d[_0xd6f0('0x36')](_0x451834[_0xd6f0('0x37')])['getResult']();var _0x59f905=_0x1852dd[_0xd6f0('0x38')];if(_0x451834[_0xd6f0('0x39')]){_0x59f905=_0x451834[_0xd6f0('0x39')];}else if(_0x451834[_0xd6f0('0x3a')]){_0x59f905=_[_0xd6f0('0x3b')](_0x451834[_0xd6f0('0x3a')][_0xd6f0('0x3c')](','));}return{'ContactId':_0x3d1280['id'],'ChatWebsiteId':_0x28659e,'from':(_0x3d1280[_0xd6f0('0x3d')]||'')+'\x20'+(_0x3d1280['lastName']||''),'customerIp':_0x59f905,'customerPort':_0x451834[_0xd6f0('0x3e')]?_0x451834[_0xd6f0('0x3e')]:null,'referer':_0x1852dd[_0xd6f0('0x3f')],'browserName':_0x162537[_0xd6f0('0x40')]['name']&&_0x162537[_0xd6f0('0x40')][_0xd6f0('0x41')]?util[_0xd6f0('0x42')](_0xd6f0('0x43'),_0x162537[_0xd6f0('0x40')]['name'],_0x162537[_0xd6f0('0x40')][_0xd6f0('0x41')]):_0xd6f0('0x44'),'browserVersion':_0x162537['browser'][_0xd6f0('0x41')]||_0xd6f0('0x44'),'osName':util['format']('%s\x20%s',_0x162537['os'][_0xd6f0('0x34')],_0x162537['os'][_0xd6f0('0x41')]),'osVersion':_0x162537['os'][_0xd6f0('0x41')],'deviceModel':_0x162537['device'][_0xd6f0('0x45')]&&_0x162537[_0xd6f0('0x46')]['vendor']?util[_0xd6f0('0x42')](_0xd6f0('0x47'),_0x162537[_0xd6f0('0x46')][_0xd6f0('0x45')],_0x162537['device'][_0xd6f0('0x48')],_0x162537[_0xd6f0('0x46')][_0xd6f0('0x49')]):null,'deviceVendor':_0x162537[_0xd6f0('0x46')][_0xd6f0('0x48')],'deviceType':_0x162537[_0xd6f0('0x46')][_0xd6f0('0x49')],'formData':JSON[_0xd6f0('0x21')](_0x1852dd)};}exports['index']=function(_0x909f20,_0x3d42ca){var _0x55e93b={'include':[{'model':db[_0xd6f0('0x4a')],'as':_0xd6f0('0x4b')}]},_0x268772={},_0x39ca69={'count':0x0,'rows':[]};var _0x4f1e07=_[_0xd6f0('0x4c')](db[_0xd6f0('0x4d')]['rawAttributes'],function(_0x558622){return{'name':_0x558622[_0xd6f0('0x4e')],'type':_0x558622['type'][_0xd6f0('0x4f')]};});_0x268772[_0xd6f0('0x45')]=_[_0xd6f0('0x4c')](_0x4f1e07,'name');_0x268772[_0xd6f0('0x50')]=_[_0xd6f0('0x51')](_0x909f20[_0xd6f0('0x50')]);_0x268772[_0xd6f0('0x52')]=_[_0xd6f0('0x53')](_0x268772['model'],_0x268772[_0xd6f0('0x50')]);_0x55e93b['attributes']=_[_0xd6f0('0x53')](_0x268772[_0xd6f0('0x45')],qs[_0xd6f0('0x54')](_0x909f20[_0xd6f0('0x50')]['fields']));_0x55e93b['attributes']=_0x55e93b[_0xd6f0('0x55')][_0xd6f0('0x56')]?_0x55e93b['attributes']:_0x268772[_0xd6f0('0x45')];if(!_0x909f20['query'][_0xd6f0('0x57')](_0xd6f0('0x58'))){_0x55e93b[_0xd6f0('0x2c')]=qs[_0xd6f0('0x2c')](_0x909f20[_0xd6f0('0x50')]['limit']);_0x55e93b[_0xd6f0('0x2a')]=qs[_0xd6f0('0x2a')](_0x909f20[_0xd6f0('0x50')][_0xd6f0('0x2a')]);}_0x55e93b[_0xd6f0('0x59')]=qs[_0xd6f0('0x5a')](_0x909f20[_0xd6f0('0x50')][_0xd6f0('0x5a')]);_0x55e93b['where']=qs[_0xd6f0('0x52')](_[_0xd6f0('0x5b')](_0x909f20[_0xd6f0('0x50')],_0x268772[_0xd6f0('0x52')]),_0x4f1e07);if(_0x909f20[_0xd6f0('0x50')][_0xd6f0('0x5c')]){_0x55e93b[_0xd6f0('0x5d')]=_[_0xd6f0('0x5e')](_0x55e93b[_0xd6f0('0x5d')],{'$or':_['map'](_0x4f1e07,function(_0x250805){if(_0x250805['type']!=='VIRTUAL'){var _0x25ea7b={};_0x25ea7b[_0x250805['name']]={'$like':'%'+_0x909f20['query'][_0xd6f0('0x5c')]+'%'};return _0x25ea7b;}})});}_0x55e93b=_[_0xd6f0('0x5e')]({},_0x55e93b,_0x909f20[_0xd6f0('0x5f')]);var _0x47a159={'where':_0x55e93b[_0xd6f0('0x5d')]};return db[_0xd6f0('0x4d')][_0xd6f0('0x2d')](_0x47a159)['then'](function(_0x9cab15){_0x39ca69[_0xd6f0('0x2d')]=_0x9cab15;if(_0x909f20['query'][_0xd6f0('0x60')]){_0x55e93b[_0xd6f0('0x61')]=[{'all':!![]}];}return db['ChatWebsite'][_0xd6f0('0x62')](_0x55e93b);})[_0xd6f0('0x1b')](function(_0x22e511){_0x39ca69[_0xd6f0('0x63')]=_0x22e511;return _0x39ca69;})[_0xd6f0('0x1b')](respondWithFilteredResult(_0x3d42ca,_0x55e93b))['catch'](handleError(_0x3d42ca,null));};exports[_0xd6f0('0x64')]=function(_0x43254c,_0x5db620){var _0x26d728={'raw':![],'where':{'id':_0x43254c[_0xd6f0('0x65')]['id']},'include':[{'model':db['Pause'],'as':_0xd6f0('0x4b')}]},_0x15d3fe={};_0x15d3fe['model']=_['keys'](db['ChatWebsite']['rawAttributes']);_0x15d3fe[_0xd6f0('0x50')]=_[_0xd6f0('0x51')](_0x43254c[_0xd6f0('0x50')]);_0x15d3fe[_0xd6f0('0x52')]=_['intersection'](_0x15d3fe[_0xd6f0('0x45')],_0x15d3fe['query']);_0x26d728[_0xd6f0('0x55')]=_[_0xd6f0('0x53')](_0x15d3fe[_0xd6f0('0x45')],qs['fields'](_0x43254c[_0xd6f0('0x50')][_0xd6f0('0x54')]));_0x26d728[_0xd6f0('0x55')]=_0x26d728[_0xd6f0('0x55')]['length']?_0x26d728[_0xd6f0('0x55')]:_0x15d3fe[_0xd6f0('0x45')];if(_0x43254c[_0xd6f0('0x50')]['includeAll']){_0x26d728[_0xd6f0('0x61')]=[{'all':!![]}];}_0x26d728=_[_0xd6f0('0x5e')]({},_0x26d728,_0x43254c[_0xd6f0('0x5f')]);return db[_0xd6f0('0x4d')]['find'](_0x26d728)[_0xd6f0('0x1b')](handleEntityNotFound(_0x5db620,null))[_0xd6f0('0x1b')](respondWithResult(_0x5db620,null))[_0xd6f0('0x25')](handleError(_0x5db620,null));};exports[_0xd6f0('0x66')]=function(_0x49fc4a,_0x535910){var _0x490bc4=null;_0x49fc4a['body'][_0xd6f0('0x67')][_0xd6f0('0x3c')](',')[_0xd6f0('0x68')](_0x30cd81=>{if(_0x30cd81[_0xd6f0('0x69')]()!==''&&!wildcardUtils[_0xd6f0('0x6a')](_0x30cd81[_0xd6f0('0x69')]())){_0x490bc4=new APIBadRequestError('\x22'+_0x30cd81[_0xd6f0('0x69')]()+_0xd6f0('0x6b'));}});if(_0x490bc4){return handleError(_0x535910,null)(_0x490bc4);}return db['ChatWebsite']['create'](_0x49fc4a[_0xd6f0('0x6c')],{})['then'](function(_0x237bea){var _0x3a85bd=_0x49fc4a[_0xd6f0('0x6d')][_0xd6f0('0x31')]({'plain':!![]});if(!_0x3a85bd)throw new Error(_0xd6f0('0x6e'));if(_0x3a85bd[_0xd6f0('0x6f')]===_0xd6f0('0x6d')){var _0x541f71=_0x237bea[_0xd6f0('0x31')]({'plain':!![]});var _0x318a68=_0xd6f0('0x32');return db['UserProfileSection'][_0xd6f0('0x70')]({'where':{'name':_0x318a68,'userProfileId':_0x3a85bd[_0xd6f0('0x71')]},'raw':!![]})['then'](function(_0xad50ac){if(_0xad50ac&&_0xad50ac[_0xd6f0('0x72')]===0x0){return db[_0xd6f0('0x33')][_0xd6f0('0x66')]({'name':_0x541f71[_0xd6f0('0x34')],'resourceId':_0x541f71['id'],'type':_0xad50ac[_0xd6f0('0x34')],'sectionId':_0xad50ac['id']},{})[_0xd6f0('0x1b')](function(){return _0x237bea;});}else{return _0x237bea;}})[_0xd6f0('0x25')](function(_0x3502ea){logger['error'](_0xd6f0('0x73'),_0x3502ea);throw _0x3502ea;});}return _0x237bea;})[_0xd6f0('0x1b')](respondWithResult(_0x535910,0xc9))[_0xd6f0('0x25')](handleError(_0x535910,null));};exports[_0xd6f0('0x30')]=function(_0x5f1321,_0x211a50){var _0x1b33df=null;_0x5f1321[_0xd6f0('0x6c')][_0xd6f0('0x67')][_0xd6f0('0x3c')](',')[_0xd6f0('0x68')](_0x907a6f=>{if(_0x907a6f[_0xd6f0('0x69')]()!==''&&!wildcardUtils[_0xd6f0('0x6a')](_0x907a6f[_0xd6f0('0x69')]())){_0x1b33df=new APIBadRequestError('\x22'+_0x907a6f['trim']()+_0xd6f0('0x6b'));}});if(_0x1b33df){return handleError(_0x211a50,null)(_0x1b33df);}if(_0x5f1321[_0xd6f0('0x6c')]['id']){delete _0x5f1321[_0xd6f0('0x6c')]['id'];}return db['ChatWebsite'][_0xd6f0('0x70')]({'where':{'id':_0x5f1321[_0xd6f0('0x65')]['id']},'include':[{'model':db[_0xd6f0('0x4a')],'as':_0xd6f0('0x4b')}]})[_0xd6f0('0x1b')](handleEntityNotFound(_0x211a50,null))[_0xd6f0('0x1b')](saveUpdates(_0x5f1321[_0xd6f0('0x6c')],null))[_0xd6f0('0x1b')](respondWithResult(_0x211a50,null))[_0xd6f0('0x25')](handleError(_0x211a50,null));};exports[_0xd6f0('0x74')]=function(_0x27ad68,_0x5b3155){return db['ChatWebsite'][_0xd6f0('0x70')]({'where':{'id':_0x27ad68[_0xd6f0('0x65')]['id']}})[_0xd6f0('0x1b')](handleEntityNotFound(_0x5b3155,null))[_0xd6f0('0x1b')](removeEntity(_0x5b3155,null))[_0xd6f0('0x25')](handleError(_0x5b3155,null));};exports['describe']=function(_0x15143a,_0x2d38e6){return db['ChatWebsite'][_0xd6f0('0x75')]()['then'](respondWithResult(_0x2d38e6,null))[_0xd6f0('0x25')](handleError(_0x2d38e6,null));};exports[_0xd6f0('0x76')]=function(_0x4107a9,_0x37ecc9){if(_0x4107a9[_0xd6f0('0x6c')]['id']){delete _0x4107a9['body']['id'];}return db['ChatWebsite'][_0xd6f0('0x70')]({'where':{'id':_0x4107a9[_0xd6f0('0x65')]['id']}})['then'](handleEntityNotFound(_0x37ecc9,null))[_0xd6f0('0x1b')](function(_0x5819e2){if(_0x5819e2){_0x4107a9['body'][_0xd6f0('0x77')]=_0x5819e2['id'];return db['Disposition']['create'](_0x4107a9['body']);}})['then'](respondWithResult(_0x37ecc9,null))[_0xd6f0('0x25')](handleError(_0x37ecc9,null));};exports[_0xd6f0('0x78')]=function(_0x3891d4,_0xcfed18){var _0x40a954={'raw':![],'where':{}};var _0x2258a6={};var _0x3d2792={'count':0x0,'rows':[]};return db[_0xd6f0('0x4d')][_0xd6f0('0x79')]({'where':{'id':_0x3891d4['params']['id']}})[_0xd6f0('0x1b')](handleEntityNotFound(_0xcfed18,null))['then'](function(_0x50db3e){if(_0x50db3e){_0x2258a6[_0xd6f0('0x45')]=_[_0xd6f0('0x51')](db[_0xd6f0('0x7a')]['rawAttributes']);_0x2258a6[_0xd6f0('0x50')]=_[_0xd6f0('0x51')](_0x3891d4[_0xd6f0('0x50')]);_0x2258a6[_0xd6f0('0x52')]=_[_0xd6f0('0x53')](_0x2258a6[_0xd6f0('0x45')],_0x2258a6[_0xd6f0('0x50')]);_0x40a954[_0xd6f0('0x55')]=_['intersection'](_0x2258a6[_0xd6f0('0x45')],qs[_0xd6f0('0x54')](_0x3891d4['query'][_0xd6f0('0x54')]));_0x40a954[_0xd6f0('0x55')]=_0x40a954[_0xd6f0('0x55')][_0xd6f0('0x56')]?_0x40a954[_0xd6f0('0x55')]:_0x2258a6[_0xd6f0('0x45')];if(!_0x3891d4[_0xd6f0('0x50')]['hasOwnProperty'](_0xd6f0('0x58'))){_0x40a954[_0xd6f0('0x2c')]=qs[_0xd6f0('0x2c')](_0x3891d4['query']['limit']);_0x40a954['offset']=qs[_0xd6f0('0x2a')](_0x3891d4[_0xd6f0('0x50')][_0xd6f0('0x2a')]);}_0x40a954[_0xd6f0('0x59')]=qs[_0xd6f0('0x5a')](_0x3891d4[_0xd6f0('0x50')]['sort']);_0x40a954[_0xd6f0('0x5d')]=qs[_0xd6f0('0x52')](_[_0xd6f0('0x5b')](_0x3891d4[_0xd6f0('0x50')],_0x2258a6['filters']));_0x40a954[_0xd6f0('0x5d')]['ChatWebsiteId']=_0x50db3e['id'];if(_0x3891d4[_0xd6f0('0x50')]['filter']){_0x40a954[_0xd6f0('0x5d')]=_[_0xd6f0('0x5e')](_0x40a954['where'],{'$or':_[_0xd6f0('0x4c')](_0x40a954[_0xd6f0('0x55')],function(_0x2cc992){var _0x3ac31d={};_0x3ac31d[_0x2cc992]={'$like':'%'+_0x3891d4[_0xd6f0('0x50')][_0xd6f0('0x5c')]+'%'};return _0x3ac31d;})});}_0x40a954=_[_0xd6f0('0x5e')]({},_0x40a954,_0x3891d4[_0xd6f0('0x5f')]);return db[_0xd6f0('0x7a')][_0xd6f0('0x2d')]({'where':_0x40a954[_0xd6f0('0x5d')]})[_0xd6f0('0x1b')](function(_0x1e495f){_0x3d2792[_0xd6f0('0x2d')]=_0x1e495f;if(_0x3891d4['query'][_0xd6f0('0x60')]){_0x40a954[_0xd6f0('0x61')]=[{'all':!![]}];}return db[_0xd6f0('0x7a')][_0xd6f0('0x62')](_0x40a954);})[_0xd6f0('0x1b')](function(_0x32159d){_0x3d2792[_0xd6f0('0x63')]=_0x32159d;return _0x3d2792;});}})[_0xd6f0('0x1b')](respondWithFilteredResult(_0xcfed18,_0x40a954))[_0xd6f0('0x25')](handleError(_0xcfed18,null));};exports[_0xd6f0('0x7b')]=function(_0x3c43d5,_0x34b6fa){return db[_0xd6f0('0x4d')][_0xd6f0('0x70')]({'where':{'id':_0x3c43d5['params']['id']}})['then'](handleEntityNotFound(_0x34b6fa,null))[_0xd6f0('0x1b')](function(_0x422755){if(_0x422755){return _0x422755[_0xd6f0('0x7b')](_0x3c43d5[_0xd6f0('0x50')][_0xd6f0('0x7c')]);}})['then'](respondWithStatusCode(_0x34b6fa,null))[_0xd6f0('0x25')](handleError(_0x34b6fa,null));};exports[_0xd6f0('0x7d')]=function(_0x2d0d8a,_0x425ada){if(_0x2d0d8a['body']['id']){delete _0x2d0d8a[_0xd6f0('0x6c')]['id'];}return db[_0xd6f0('0x4d')][_0xd6f0('0x70')]({'where':{'id':_0x2d0d8a[_0xd6f0('0x65')]['id']}})[_0xd6f0('0x1b')](handleEntityNotFound(_0x425ada,null))[_0xd6f0('0x1b')](function(_0x50d310){if(_0x50d310){_0x2d0d8a['body'][_0xd6f0('0x77')]=_0x50d310['id'];return db['CannedAnswer'][_0xd6f0('0x66')](_0x2d0d8a['body']);}})[_0xd6f0('0x1b')](respondWithResult(_0x425ada,null))[_0xd6f0('0x25')](handleError(_0x425ada,null));};exports['getAnswers']=function(_0x3bf3b9,_0x5cc944){var _0x2cec2b={'raw':![],'where':{}};var _0x1756c={};var _0x65b7c={'count':0x0,'rows':[]};return db[_0xd6f0('0x4d')]['findOne']({'where':{'id':_0x3bf3b9[_0xd6f0('0x65')]['id']}})[_0xd6f0('0x1b')](handleEntityNotFound(_0x5cc944,null))[_0xd6f0('0x1b')](function(_0x543956){if(_0x543956){_0x1756c[_0xd6f0('0x45')]=_[_0xd6f0('0x51')](db[_0xd6f0('0x7e')]['rawAttributes']);_0x1756c['query']=_[_0xd6f0('0x51')](_0x3bf3b9[_0xd6f0('0x50')]);_0x1756c[_0xd6f0('0x52')]=_['intersection'](_0x1756c[_0xd6f0('0x45')],_0x1756c[_0xd6f0('0x50')]);_0x2cec2b[_0xd6f0('0x55')]=_[_0xd6f0('0x53')](_0x1756c[_0xd6f0('0x45')],qs[_0xd6f0('0x54')](_0x3bf3b9[_0xd6f0('0x50')]['fields']));_0x2cec2b[_0xd6f0('0x55')]=_0x2cec2b['attributes'][_0xd6f0('0x56')]?_0x2cec2b[_0xd6f0('0x55')]:_0x1756c[_0xd6f0('0x45')];if(!_0x3bf3b9['query'][_0xd6f0('0x57')]('nolimit')){_0x2cec2b['limit']=qs[_0xd6f0('0x2c')](_0x3bf3b9[_0xd6f0('0x50')][_0xd6f0('0x2c')]);_0x2cec2b['offset']=qs[_0xd6f0('0x2a')](_0x3bf3b9['query']['offset']);}_0x2cec2b[_0xd6f0('0x59')]=qs[_0xd6f0('0x5a')](_0x3bf3b9[_0xd6f0('0x50')][_0xd6f0('0x5a')]);_0x2cec2b[_0xd6f0('0x5d')]=qs[_0xd6f0('0x52')](_['pick'](_0x3bf3b9[_0xd6f0('0x50')],_0x1756c['filters']));_0x2cec2b[_0xd6f0('0x5d')]['ChatWebsiteId']=_0x543956['id'];if(_0x3bf3b9[_0xd6f0('0x50')][_0xd6f0('0x5c')]){_0x2cec2b['where']=_[_0xd6f0('0x5e')](_0x2cec2b[_0xd6f0('0x5d')],{'$or':_[_0xd6f0('0x4c')](_0x2cec2b[_0xd6f0('0x55')],function(_0x1fff48){var _0x6cb6a2={};_0x6cb6a2[_0x1fff48]={'$like':'%'+_0x3bf3b9[_0xd6f0('0x50')][_0xd6f0('0x5c')]+'%'};return _0x6cb6a2;})});}_0x2cec2b=_['merge']({},_0x2cec2b,_0x3bf3b9[_0xd6f0('0x5f')]);return db[_0xd6f0('0x7e')]['count']({'where':_0x2cec2b[_0xd6f0('0x5d')]})['then'](function(_0x1f980f){_0x65b7c[_0xd6f0('0x2d')]=_0x1f980f;if(_0x3bf3b9[_0xd6f0('0x50')][_0xd6f0('0x60')]){_0x2cec2b['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xd6f0('0x62')](_0x2cec2b);})[_0xd6f0('0x1b')](function(_0xe96c8a){_0x65b7c[_0xd6f0('0x63')]=_0xe96c8a;return _0x65b7c;});}})[_0xd6f0('0x1b')](respondWithFilteredResult(_0x5cc944,_0x2cec2b))[_0xd6f0('0x25')](handleError(_0x5cc944,null));};exports[_0xd6f0('0x7f')]=function(_0x563c11,_0x1533b7){return db[_0xd6f0('0x4d')][_0xd6f0('0x70')]({'where':{'id':_0x563c11[_0xd6f0('0x65')]['id']}})['then'](handleEntityNotFound(_0x1533b7,null))[_0xd6f0('0x1b')](function(_0x5b787f){if(_0x5b787f){return _0x5b787f['removeAnswers'](_0x563c11[_0xd6f0('0x50')]['ids']);}})[_0xd6f0('0x1b')](respondWithStatusCode(_0x1533b7,null))[_0xd6f0('0x25')](handleError(_0x1533b7,null));};exports[_0xd6f0('0x80')]=function(_0x1603f0,_0x2d4481){_0x1603f0[_0xd6f0('0x6c')][_0xd6f0('0x81')]=_0x1603f0['file'][_0xd6f0('0x82')];return db[_0xd6f0('0x4d')][_0xd6f0('0x70')]({'where':{'id':_0x1603f0['params']['id']}})[_0xd6f0('0x1b')](handleEntityNotFound(_0x2d4481,null))[_0xd6f0('0x1b')](saveUpdates(_0x1603f0[_0xd6f0('0x6c')],null))[_0xd6f0('0x1b')](respondWithResult(_0x2d4481,null))['catch'](handleError(_0x2d4481,null));};exports[_0xd6f0('0x83')]=function(_0x4e5bb8,_0x1dc05e){_0x4e5bb8['body'][_0xd6f0('0x84')]=_0x4e5bb8[_0xd6f0('0x85')][_0xd6f0('0x82')];return db[_0xd6f0('0x4d')][_0xd6f0('0x70')]({'where':{'id':_0x4e5bb8[_0xd6f0('0x65')]['id']}})[_0xd6f0('0x1b')](handleEntityNotFound(_0x1dc05e,null))['then'](saveUpdates(_0x4e5bb8['body'],null))[_0xd6f0('0x1b')](respondWithResult(_0x1dc05e,null))['catch'](handleError(_0x1dc05e,null));};exports[_0xd6f0('0x86')]=function(_0x21ff2c,_0x21cba5){_0x21ff2c[_0xd6f0('0x6c')][_0xd6f0('0x87')]=_0x21ff2c[_0xd6f0('0x85')][_0xd6f0('0x82')];return db[_0xd6f0('0x4d')][_0xd6f0('0x70')]({'where':{'id':_0x21ff2c[_0xd6f0('0x65')]['id']}})[_0xd6f0('0x1b')](handleEntityNotFound(_0x21cba5,null))['then'](saveUpdates(_0x21ff2c[_0xd6f0('0x6c')],null))['then'](respondWithResult(_0x21cba5,null))[_0xd6f0('0x25')](handleError(_0x21cba5,null));};exports[_0xd6f0('0x88')]=function(_0x4ed3f0,_0x3707a3){_0x4ed3f0[_0xd6f0('0x6c')][_0xd6f0('0x89')]=_0x4ed3f0[_0xd6f0('0x85')][_0xd6f0('0x82')];return db[_0xd6f0('0x4d')][_0xd6f0('0x70')]({'where':{'id':_0x4ed3f0[_0xd6f0('0x65')]['id']}})[_0xd6f0('0x1b')](handleEntityNotFound(_0x3707a3,null))['then'](saveUpdates(_0x4ed3f0[_0xd6f0('0x6c')],null))[_0xd6f0('0x1b')](respondWithResult(_0x3707a3,null))['catch'](handleError(_0x3707a3,null));};exports[_0xd6f0('0x8a')]=function(_0x592b10,_0x5938ba){var _0x48882b=path[_0xd6f0('0x8b')](config[_0xd6f0('0x8c')],'server/files/images/logos/default_logo.svg');var _0x18e364={'where':{'id':_0x592b10[_0xd6f0('0x65')]['id']},'attributes':['id',_0xd6f0('0x81')],'raw':!![]};var _0x6c7bb3=![];return require(_0xd6f0('0x8d'))[_0xd6f0('0x8e')]()[_0xd6f0('0x1b')](function(_0x340ca1){if(_0x340ca1){_0x6c7bb3=_0x340ca1['custom'];}})[_0xd6f0('0x1b')](function(){return db[_0xd6f0('0x4d')]['find'](_0x18e364);})[_0xd6f0('0x1b')](handleEntityNotFound(_0x5938ba,null))['then'](function(_0x2607da){if(_0x2607da){if(!_[_0xd6f0('0x8f')](_0x2607da[_0xd6f0('0x81')])){if(fs[_0xd6f0('0x90')](path['join'](config[_0xd6f0('0x8c')],'server/files/images/logos/',_0x2607da['sitepic']))&&_0x6c7bb3){_0x48882b=path[_0xd6f0('0x8b')](config[_0xd6f0('0x8c')],_0xd6f0('0x91'),_0x2607da['sitepic']);}}return _0x5938ba[_0xd6f0('0x92')](_0x48882b);}})[_0xd6f0('0x25')](handleError(_0x5938ba,null));};exports[_0xd6f0('0x93')]=function(_0x3721c5,_0x259b01){var _0x5cbab7=path[_0xd6f0('0x8b')](config[_0xd6f0('0x8c')],'server/files/images/avatars/default_avatar.png');var _0x3c86ac={'where':{'id':_0x3721c5['params']['id']},'attributes':['id',_0xd6f0('0x84')],'raw':!![]};return db[_0xd6f0('0x4d')][_0xd6f0('0x70')](_0x3c86ac)[_0xd6f0('0x1b')](handleEntityNotFound(_0x259b01,null))[_0xd6f0('0x1b')](function(_0x16e929){if(_0x16e929){if(!_[_0xd6f0('0x8f')](_0x16e929['agentAvatar'])){if(fs['existsSync'](path[_0xd6f0('0x8b')](config['root'],_0xd6f0('0x94'),_0x16e929[_0xd6f0('0x84')]))){_0x5cbab7=path[_0xd6f0('0x8b')](config['root'],_0xd6f0('0x94'),_0x16e929['agentAvatar']);}}return _0x259b01[_0xd6f0('0x92')](_0x5cbab7);}})[_0xd6f0('0x25')](handleError(_0x259b01,null));};exports['getCustomerAvatar']=function(_0xc24941,_0xc4e8c){var _0x58fb59=path['join'](config['root'],_0xd6f0('0x95'));var _0x44bf6f={'where':{'id':_0xc24941[_0xd6f0('0x65')]['id']},'attributes':['id',_0xd6f0('0x87'),_0xd6f0('0x96')],'raw':!![]};return db['ChatWebsite'][_0xd6f0('0x70')](_0x44bf6f)[_0xd6f0('0x1b')](handleEntityNotFound(_0xc4e8c,null))[_0xd6f0('0x1b')](function(_0x4284c1){if(_0x4284c1){if(!_[_0xd6f0('0x8f')](_0x4284c1[_0xd6f0('0x87')])){if(fs[_0xd6f0('0x90')](path[_0xd6f0('0x8b')](config[_0xd6f0('0x8c')],_0xd6f0('0x94'),_0x4284c1[_0xd6f0('0x87')]))&&_0x4284c1[_0xd6f0('0x96')]){_0x58fb59=path[_0xd6f0('0x8b')](config[_0xd6f0('0x8c')],'server/files/images/avatars/',_0x4284c1['customerAvatar']);}}return _0xc4e8c[_0xd6f0('0x92')](_0x58fb59);}})[_0xd6f0('0x25')](handleError(_0xc4e8c,null));};exports['getSystemAvatar']=function(_0x1bd3ef,_0x2f7e8f){var _0x382054=path[_0xd6f0('0x8b')](config[_0xd6f0('0x8c')],_0xd6f0('0x97'));var _0x42ffcf={'where':{'id':_0x1bd3ef['params']['id']},'attributes':['id',_0xd6f0('0x89')],'raw':!![]};return db[_0xd6f0('0x4d')][_0xd6f0('0x70')](_0x42ffcf)[_0xd6f0('0x1b')](handleEntityNotFound(_0x2f7e8f,null))['then'](function(_0x17db4b){if(_0x17db4b){if(!_[_0xd6f0('0x8f')](_0x17db4b[_0xd6f0('0x89')])){if(fs['existsSync'](path[_0xd6f0('0x8b')](config['root'],_0xd6f0('0x94'),_0x17db4b[_0xd6f0('0x89')]))){_0x382054=path[_0xd6f0('0x8b')](config[_0xd6f0('0x8c')],_0xd6f0('0x94'),_0x17db4b[_0xd6f0('0x89')]);}}return _0x2f7e8f[_0xd6f0('0x92')](_0x382054);}})[_0xd6f0('0x25')](handleError(_0x2f7e8f,null));};function checkWebsiteInterval(_0x3e6f9e){var _0x175bef=_0x3e6f9e[_0xd6f0('0x98')];if(!_0x175bef){return Promise[_0xd6f0('0x99')](_0x3e6f9e);}var _0x263d86=_0x3e6f9e[_0xd6f0('0x9a')]||undefined;return _0x175bef[_0xd6f0('0x9b')](_0x263d86)[_0xd6f0('0x1b')](function(_0x482248){if(!_0x482248){throw new APIOutOfIntervalError();}return _0x3e6f9e;});}exports[_0xd6f0('0x9c')]=function(_0x3d1d95,_0x31d723){var _0x1b50a5={'body':_0x3d1d95['body'],'channel':_0xd6f0('0x9d')};var _0x525652=[];var _0x5a8d88=[];var _0xfc19ca={};var _0x5a4a86=![];if(_0x3d1d95[_0xd6f0('0x6c')]['id']){delete _0x3d1d95[_0xd6f0('0x6c')]['id'];}if(_[_0xd6f0('0x8f')](_0x3d1d95['body'][_0xd6f0('0x9e')])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0xd6f0('0x8f')](_0x3d1d95[_0xd6f0('0x6c')][_0xd6f0('0x9f')])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0xd6f0('0xa0')](_0x3d1d95[_0xd6f0('0x6c')][_0xd6f0('0x6c')])){throw new APIBadRequestError(_0xd6f0('0xa1'));}var _0x108dd8=_0x3d1d95[_0xd6f0('0x6c')]['customerIp']&&_0x3d1d95[_0xd6f0('0x6c')][_0xd6f0('0x3f')];return db[_0xd6f0('0xa2')][_0xd6f0('0x75')]()['then'](function(_0x3757b6){if(!_0x3757b6){throw new Error('No\x20available\x20attributes');}_0x525652=Object[_0xd6f0('0x51')](_0x3757b6)['filter'](function(_0x5db326){return![_0xd6f0('0xa3'),_0xd6f0('0xa4')][_0xd6f0('0xa5')](_0x5db326);});_0x5a8d88=Object['keys'](_0x3757b6)[_0xd6f0('0x5c')](function(_0x57dd30){return![_0xd6f0('0xa3'),_0xd6f0('0xa4'),_0xd6f0('0xa6'),_0xd6f0('0xa7')][_0xd6f0('0xa5')](_0x57dd30);});if(!_[_0xd6f0('0xa5')](_0x5a8d88,_0x3d1d95[_0xd6f0('0x6c')][_0xd6f0('0x9f')])){throw new APIBadRequestError(_0xd6f0('0xa8')+_0x5a8d88[_0xd6f0('0x8b')](',\x20'));}_0xfc19ca[_0x3d1d95[_0xd6f0('0x6c')][_0xd6f0('0x9f')]]=_0x3d1d95['body']['from'];})[_0xd6f0('0x1b')](function(){return db[_0xd6f0('0x4d')][_0xd6f0('0x70')]({'where':{'id':_0x3d1d95[_0xd6f0('0x65')]['id']},'include':[{'model':db['CmList'],'as':_0xd6f0('0xa9'),'include':[{'model':db['CmContact'],'as':_0xd6f0('0xaa'),'where':_0xfc19ca,'limit':0x1,'order':[[_0xd6f0('0xa4'),_0xd6f0('0xab')]]}]},{'model':db[_0xd6f0('0xac')],'as':_0xd6f0('0xad')},{'model':db['Interval'],'as':_0xd6f0('0x98'),'include':[{'model':db[_0xd6f0('0x98')],'as':'Intervals','attributes':['id',_0xd6f0('0xae')],'raw':!![]}]}]});})[_0xd6f0('0x1b')](function(_0x2e7576){if(!_0x2e7576){throw new APINotFoundError(util[_0xd6f0('0x42')]('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x3d1d95['params']['id']));}if(_0x108dd8){return checkWebsiteInterval(_0x2e7576);}return _0x2e7576;})[_0xd6f0('0x1b')](function(_0xa24f4f){_0x1b50a5[_0xd6f0('0xaf')]=_0xa24f4f;_0x1b50a5[_0xd6f0('0xb0')]=_[_0xd6f0('0xb1')](_0xa24f4f[_0xd6f0('0xad')],[_0xd6f0('0xb2')],[_0xd6f0('0xb3')]);if(_0x1b50a5['account'][_0xd6f0('0xad')]){delete _0x1b50a5[_0xd6f0('0xaf')][_0xd6f0('0xad')];}_0x1b50a5[_0xd6f0('0xb4')]=_0xa24f4f[_0xd6f0('0xa9')]||{'id':_0xa24f4f[_0xd6f0('0xa7')]};if(_0x1b50a5[_0xd6f0('0xb4')]&&_0x1b50a5[_0xd6f0('0xb4')][_0xd6f0('0xaa')][_0xd6f0('0x56')]){return _0x1b50a5[_0xd6f0('0xb4')]['Contacts'][0x0];}var _0x5e66ae=_[_0xd6f0('0x13')](_0x3d1d95['body'],{'firstName':_0x3d1d95[_0xd6f0('0x6c')][_0xd6f0('0x9e')],'ListId':_0xa24f4f[_0xd6f0('0xa7')]});_0x5e66ae[_0x3d1d95[_0xd6f0('0x6c')][_0xd6f0('0x9f')]]=_0x3d1d95[_0xd6f0('0x6c')][_0xd6f0('0x9e')];return db['CmContact'][_0xd6f0('0x66')](_0x5e66ae,{'fields':_0x525652,'raw':!![]});})[_0xd6f0('0x1b')](function(_0x4b3935){_0x1b50a5['contact']=_0x4b3935;var _0x50d549=createInteractionObject(_0x3d1d95[_0xd6f0('0x65')]['id'],_0x3d1d95[_0xd6f0('0x6c')],_0x3d1d95[_0xd6f0('0xb5')],_0x4b3935);var _0x1dba84={'ChatWebsiteId':_0x3d1d95['params']['id']};if(_0x3d1d95[_0xd6f0('0x6c')][_0xd6f0('0xb6')]){_0x1dba84['threadId']=_0x3d1d95[_0xd6f0('0x6c')][_0xd6f0('0xb6')];_0x1dba84[_0xd6f0('0xb7')]=![];return db[_0xd6f0('0xb8')]['find']({'where':_0x1dba84})[_0xd6f0('0x1b')](function(_0x19bf81){var _0x53d9fa=_0x3d1d95['body'][_0xd6f0('0x38')]&&_0x3d1d95[_0xd6f0('0x6c')][_0xd6f0('0x3f')];if(_0x19bf81){_0x5a4a86=!![];return _0x19bf81;}else if(!_0x53d9fa&&_0x19bf81&&_0x19bf81[_0xd6f0('0xb7')]){throw new APIConflictError(_0xd6f0('0xb9'));}_0x50d549[_0xd6f0('0xb6')]=_0x3d1d95[_0xd6f0('0x6c')][_0xd6f0('0xb6')];_0x50d549[_0xd6f0('0xba')]=_0x3d1d95[_0xd6f0('0x6c')]['externalUrl'];return db[_0xd6f0('0xb8')][_0xd6f0('0x66')](_0x50d549);});}_0x1dba84[_0xd6f0('0xbb')]=_0x4b3935['id'];if(_0x3d1d95[_0xd6f0('0x6c')][_0xd6f0('0xbc')]&&_0x3d1d95[_0xd6f0('0x6c')]['interaction']['id']){_0x1dba84['id']=_0x3d1d95['body'][_0xd6f0('0xbc')]['id'];return db[_0xd6f0('0xb8')][_0xd6f0('0x70')]({'where':_0x1dba84})[_0xd6f0('0x1b')](function(_0x53d6fd){var _0x477673=_0x3d1d95[_0xd6f0('0x6c')][_0xd6f0('0x38')]&&_0x3d1d95[_0xd6f0('0x6c')][_0xd6f0('0x3f')];if(!_0x477673&&_0x53d6fd&&_0x53d6fd['closed']){throw new APIConflictError(_0xd6f0('0xb9'));}else if(_0x53d6fd){_0x5a4a86=!![];return _0x53d6fd;}else{return db[_0xd6f0('0xb8')]['create'](_0x50d549);}});}return db[_0xd6f0('0xb8')][_0xd6f0('0x66')](_0x50d549);})['then'](function(_0x26915c){if(!_0x5a4a86){return _0x26915c;}var _0xbf236e={'from':(_0x1b50a5[_0xd6f0('0xbd')][_0xd6f0('0x3d')]||'')+'\x20'+(_0x1b50a5[_0xd6f0('0xbd')][_0xd6f0('0xbe')]||'')};if(_0x3d1d95[_0xd6f0('0x6c')][_0xd6f0('0xb6')]&&_0x3d1d95[_0xd6f0('0x6c')][_0xd6f0('0xbf')]&&_0x3d1d95[_0xd6f0('0x6c')]['threadId']!=_0x3d1d95[_0xd6f0('0x6c')]['messageId']){_0xbf236e[_0xd6f0('0xb6')]=_0x3d1d95[_0xd6f0('0x6c')][_0xd6f0('0xbf')];}return _0x26915c['update'](_0xbf236e);})[_0xd6f0('0x1b')](function(_0x2e64be){_0x1b50a5[_0xd6f0('0xbc')]=_0x2e64be[_0xd6f0('0x31')]({'plain':!![]});_0x1b50a5[_0xd6f0('0xbc')]['created']=!_0x5a4a86;if(_0x1b50a5['interaction'][_0xd6f0('0xc0')]){if(_0x1b50a5[_0xd6f0('0xaf')][_0xd6f0('0xc1')]){_0x1b50a5[_0xd6f0('0xb0')][_0xd6f0('0xc2')]({'id':0x0,'priority':_0x1b50a5[_0xd6f0('0xb0')][_0xd6f0('0x56')]+0x1,'app':_0xd6f0('0xc3'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db['ChatMessage'][_0xd6f0('0x66')]({'body':_0x3d1d95['body'][_0xd6f0('0x6c')],'ChatWebsiteId':_0x3d1d95[_0xd6f0('0x65')]['id'],'ChatInteractionId':_0x2e64be['id'],'direction':'in','ContactId':_0x1b50a5[_0xd6f0('0xbd')]['id'],'AttachmentId':_0x3d1d95[_0xd6f0('0x6c')][_0xd6f0('0xc4')]});})[_0xd6f0('0x1b')](function(_0x332d93){_0x1b50a5[_0xd6f0('0x23')]=_0x332d93;if(!_0x1b50a5[_0xd6f0('0xbc')][_0xd6f0('0xc5')]){return;}return db['User'][_0xd6f0('0x70')]({'attributes':['id','name'],'where':{'id':_0x1b50a5[_0xd6f0('0xbc')][_0xd6f0('0xc5')]}});})['then'](function(_0x22ac86){if(_0x22ac86){_0x1b50a5[_0xd6f0('0xb0')][_0xd6f0('0xc6')]({'id':0x0,'priority':0x0,'app':_0xd6f0('0xc7'),'appdata':_0x22ac86[_0xd6f0('0x34')]+','+(_0x1b50a5['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x1b50a5['forcedOwnership']=!![];}if(!_0x1b50a5[_0xd6f0('0xbc')]['queueId']){return;}return db[_0xd6f0('0xc8')][_0xd6f0('0x70')]({'attributes':['id',_0xd6f0('0x34')],'where':{'id':_0x1b50a5[_0xd6f0('0xbc')][_0xd6f0('0xc9')]}});})[_0xd6f0('0x1b')](function(_0x55f274){if(_0x55f274){_0x1b50a5[_0xd6f0('0xb0')][_0xd6f0('0xc6')]({'id':0x0,'priority':0x1,'app':_0xd6f0('0xca'),'appdata':_0x55f274[_0xd6f0('0x34')]+','+(_0x1b50a5[_0xd6f0('0xaf')][_0xd6f0('0xcb')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xd6f0('0xcc'),_0x1b50a5);})[_0xd6f0('0x1b')](function(_0x5bd53f){respondWithRpcPromise(_0xd6f0('0xcd'),_0xd6f0('0xcd'),{'event':'notify','message':_0x5bd53f},client9002);return _0x5bd53f;})[_0xd6f0('0x1b')](respondWithResult(_0x31d723,null))[_0xd6f0('0x25')](APIHandleError(_0x31d723));};exports[_0xd6f0('0xce')]=function(_0x5f3d8a,_0x420305){var _0x3b273b,_0x46fe26,_0x2d6902;var _0x3b64bd=[];var _0x56e21e={};var _0x11ec0f=_0x5f3d8a[_0xd6f0('0xcf')]||[];var _0xcbf306=[];var _0x1c03aa;return db[_0xd6f0('0xa2')][_0xd6f0('0x75')]()[_0xd6f0('0x1b')](function(_0x18c5d6){if(!_0x18c5d6){throw new db[(_0xd6f0('0xd0'))][(_0xd6f0('0xd1'))](_0xd6f0('0xd2'));}_0x3b64bd=_['difference'](_[_0xd6f0('0x51')](_0x18c5d6),[_0xd6f0('0xa3'),'updatedAt',_0xd6f0('0xa6'),'ListId']);if(_0x5f3d8a[_0xd6f0('0x6c')]['id']){delete _0x5f3d8a[_0xd6f0('0x6c')]['id'];}if(_['isNil'](_0x5f3d8a[_0xd6f0('0x6c')]['from'])){throw _0x420305[_0xd6f0('0x27')](0x1f4)['send'](new db[(_0xd6f0('0xd0'))][(_0xd6f0('0xd1'))]('from\x20is\x20mandatory'));}if(_['isNil'](_0x5f3d8a[_0xd6f0('0x6c')][_0xd6f0('0x6c')])||_0x5f3d8a[_0xd6f0('0x6c')]['body']===''){throw _0x420305[_0xd6f0('0x27')](0x1f4)[_0xd6f0('0x35')](new db[(_0xd6f0('0xd0'))][(_0xd6f0('0xd1'))](_0xd6f0('0xd3')));}if(_['isNil'](_0x5f3d8a[_0xd6f0('0x6c')][_0xd6f0('0xd4')])){throw _0x420305[_0xd6f0('0x27')](0x1f4)[_0xd6f0('0x35')](new db[(_0xd6f0('0xd0'))][(_0xd6f0('0xd1'))](_0xd6f0('0xd5')+_0x3b64bd));}if(!_['includes'](_0x3b64bd,_0x5f3d8a[_0xd6f0('0x6c')][_0xd6f0('0xd4')])){throw _0x420305['status'](0x1f4)[_0xd6f0('0x35')](new db[(_0xd6f0('0xd0'))]['ValidationError'](_0xd6f0('0xd6')+_0x3b64bd));}_0x56e21e[_0x5f3d8a[_0xd6f0('0x6c')][_0xd6f0('0xd4')]]=_0x5f3d8a[_0xd6f0('0x6c')][_0xd6f0('0x9e')];})[_0xd6f0('0x1b')](function(){return db[_0xd6f0('0x4d')][_0xd6f0('0x70')]({'where':{'id':_0x5f3d8a['params']['id']},'include':[{'model':db[_0xd6f0('0xd7')],'as':_0xd6f0('0xa9')},{'model':db['MailAccount'],'as':_0xd6f0('0xd8')}]});})['then'](handleEntityNotFound(_0x420305,null))[_0xd6f0('0x1b')](function(_0x2a87b5){if(_0x2a87b5&&_0x2a87b5[_0xd6f0('0xa9')]){_0x46fe26=_0x2a87b5;var _0x1f9663=_[_0xd6f0('0x13')](_0x5f3d8a[_0xd6f0('0x6c')],{'firstName':_0x5f3d8a[_0xd6f0('0x6c')]['from'],'phone':_0x5f3d8a[_0xd6f0('0x6c')][_0xd6f0('0x9e')],'ListId':_0x2a87b5[_0xd6f0('0xa7')]});_0x1f9663[_0x5f3d8a[_0xd6f0('0x6c')][_0xd6f0('0xd4')]]=_0x5f3d8a['body'][_0xd6f0('0x9e')];return db['CmContact'][_0xd6f0('0xd9')]({'where':_0x56e21e,'defaults':_0x1f9663});}})['spread'](function(_0x4707c0){if(_0x4707c0){_0x2d6902=_0x4707c0;var _0x188eff=fs['readFileSync'](path[_0xd6f0('0x8b')](config['root'],'server/files/templates/chatOfflineMessage.ejs'),_0xd6f0('0xda'));var _0x2d9cd9=ejs[_0xd6f0('0xdb')](_0x188eff,{'body':_[_0xd6f0('0xdc')](_0x5f3d8a[_0xd6f0('0x6c')][_0xd6f0('0x6c')]),'bodyTitle':_0x46fe26[_0xd6f0('0xdd')]});return db[_0xd6f0('0xde')][_0xd6f0('0x66')]({'body':_0x2d9cd9,'plainBody':htmlToText[_0xd6f0('0xdf')](_0x2d9cd9),'ContactId':_0x4707c0['id'],'ChatWebsiteId':_0x46fe26['id']});}})[_0xd6f0('0x1b')](function(_0x1d7dda){_0x1c03aa=_0x1d7dda;if(_0x11ec0f[_0xd6f0('0x56')]){var _0x26d4c2=_0x11ec0f[_0xd6f0('0x4c')](function(_0x578463){return{'name':_0x578463[_0xd6f0('0xe0')],'basename':_0x578463[_0xd6f0('0x82')],'type':_0x578463['mimetype'],'ChatOfflineMessageId':_0x1d7dda['id']};});_0xcbf306=_0x26d4c2[_0xd6f0('0x4c')](_0x1814a9=>{var _0x35cb94={'filename':_0x1814a9[_0xd6f0('0x34')],'path':path[_0xd6f0('0x8b')](config[_0xd6f0('0x8c')],_0xd6f0('0xe1'),'files',_0xd6f0('0xe2'),_0xd6f0('0xe3'),_0x1814a9[_0xd6f0('0xe4')])};return _0x35cb94;});if(!_0x46fe26[_0xd6f0('0xe5')]){return db[_0xd6f0('0xe6')]['transaction'](function(_0xdbcb43){return db[_0xd6f0('0xe7')][_0xd6f0('0xe8')](_0x26d4c2,{'transaction':_0xdbcb43});});}}})['then'](function(){if(_0x1c03aa){_0x3b273b=_0x1c03aa;return db[_0xd6f0('0xd8')][_0xd6f0('0x79')]({'where':{'service':!![]},'include':[{'model':db[_0xd6f0('0xe9')],'as':_0xd6f0('0xea'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xd6f0('0xeb'),'raw':!![]}]}]});}})[_0xd6f0('0x1b')](function(_0x2b6b72){if(_0x2b6b72&&_0x2b6b72[_0xd6f0('0xea')]&&_0x46fe26[_0xd6f0('0xec')]&&_0x46fe26[_0xd6f0('0xed')]){var _0x1ad09b=_0x2b6b72[_0xd6f0('0xee')]();return respondWithRpcPromise(_0xd6f0('0xef'),_0xd6f0('0xf0'),{'account':_0x1ad09b,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x2b6b72[_0xd6f0('0x34')],_0x2b6b72[_0xd6f0('0xf1')]||_0x2b6b72[_0xd6f0('0xea')][_0xd6f0('0x6d')]),'to':_0x46fe26[_0xd6f0('0xed')],'subject':_0x46fe26[_0xd6f0('0xf2')],'html':_0x3b273b[_0xd6f0('0x6c')],'attachments':_0xcbf306}},client9003)[_0xd6f0('0x1b')](function(){return _0x3b273b;})[_0xd6f0('0x25')](function(_0x920605){logger[_0xd6f0('0x22')](_0x920605);});}})[_0xd6f0('0x1b')](function(){if(_0x46fe26&&_0x46fe26[_0xd6f0('0xe5')]&&_0x46fe26[_0xd6f0('0xf3')]){var _0x2ac49c=[];if(_0x11ec0f['length']){_0x2ac49c=_0x11ec0f[_0xd6f0('0x4c')](function(_0x16f044){return{'name':_0x16f044['originalname'],'basename':_0x16f044[_0xd6f0('0x82')],'type':_0x16f044['mimetype'],'ChatOfflineMessageId':_0x1c03aa['id']};});}var _0xba0bc5;if(!_[_0xd6f0('0x8f')](_0x46fe26[_0xd6f0('0xf4')])){var _0x5558df=_[_0xd6f0('0x4c')](_0x5f3d8a[_0xd6f0('0x6c')],function(_0x33d248){return _0x33d248;});var _0x1a4ad0=_['toPairsIn'](_0x5558df)[0x0];var _0x227a3f=_[_0xd6f0('0xf5')](_0x1a4ad0,function(_0x4e7e89){return _0x4e7e89;});_0xba0bc5=_0x227a3f[0x1][_0x46fe26[_0xd6f0('0xf4')]];}var _0x1151d0={'from':_0x2d6902[_0xd6f0('0xf1')],'firstName':_0x2d6902[_0xd6f0('0x3d')],'lastName':_0x2d6902['lastName'],'mapKey':_0xd6f0('0xf1'),'message':{'from':_0x2d6902[_0xd6f0('0xf1')],'to':_0x46fe26['MailAccount'][_0xd6f0('0xf1')],'cc':'','subject':_[_0xd6f0('0x8f')](_0xba0bc5)?_0x46fe26['offlineMessageSubject']:_0xba0bc5,'messageId':'','sentAt':new Date(),'attach':_0x2ac49c[_0xd6f0('0x56')],'attachments':_0x2ac49c,'originChannel':_0xd6f0('0xf6'),'ChatWebsiteId':_0x46fe26['id'],'ChatOfflineMessageId':_0x3b273b['id'],'originTo':_0x46fe26[_0xd6f0('0xd8')][_0xd6f0('0xf1')]},'body':_0x3b273b[_0xd6f0('0x6c')]};var _0x46ee50={'account':{'id':_0x46fe26[_0xd6f0('0xf3')]},'body':_0x1151d0,'log':_0xd6f0('0xf7')};return respondWithRpcPromise(_0xd6f0('0xf7'),_0xd6f0('0xf8'),_0x46ee50,client9001)[_0xd6f0('0x1b')](function(){return _0x3b273b;})['catch'](function(_0x312c8c){logger['error'](_0x312c8c);});}return;})[_0xd6f0('0x1b')](function(){if(_0x3b273b){return _0x3b273b;}})[_0xd6f0('0x1b')](respondWithResult(_0x420305,null))[_0xd6f0('0x25')](function(){for(var _0x14b60b of _0x11ec0f){var _0x545039=path['join'](config[_0xd6f0('0x8c')],'server',_0xd6f0('0xcf'),_0xd6f0('0xe2'),_0xd6f0('0xe3'),_0x14b60b['filename']);fs_extra['remove'](_0x545039)[_0xd6f0('0x25')](function(_0x5ac263){logger[_0xd6f0('0x22')](_0xd6f0('0xf9'),_0x545039,_0x5ac263);});}});};exports[_0xd6f0('0xfa')]=function(_0x202805,_0x19a9c9){return db[_0xd6f0('0xb8')]['find']({'where':{'id':_0x202805[_0xd6f0('0x65')]['id']}})[_0xd6f0('0x1b')](handleEntityNotFound(_0x19a9c9,null))['then'](function(_0xbc9dee){if(_0xbc9dee){return _0xbc9dee[_0xd6f0('0xfa')](_0x202805[_0xd6f0('0x6c')][_0xd6f0('0x7c')],_[_0xd6f0('0xfb')](_0x202805['body'],['ids','id'])||{});}})[_0xd6f0('0x1b')](respondWithResult(_0x19a9c9,null))['catch'](handleError(_0x19a9c9,null));};exports[_0xd6f0('0xfc')]=function(_0x3a1710,_0x97904c){var _0x57caec={'raw':![],'where':{}};var _0x55605e={};var _0x1862e4={'count':0x0,'rows':[]};return db[_0xd6f0('0x4d')][_0xd6f0('0x79')]({'where':{'id':_0x3a1710[_0xd6f0('0x65')]['id']}})['then'](handleEntityNotFound(_0x97904c,null))[_0xd6f0('0x1b')](function(_0x37107f){if(_0x37107f){_0x55605e['model']=_[_0xd6f0('0x51')](db[_0xd6f0('0xb8')][_0xd6f0('0xfd')]);_0x55605e[_0xd6f0('0x50')]=_[_0xd6f0('0x51')](_0x3a1710['query']);_0x55605e['filters']=_[_0xd6f0('0x53')](_0x55605e[_0xd6f0('0x45')],_0x55605e['query']);_0x57caec[_0xd6f0('0x55')]=_[_0xd6f0('0x53')](_0x55605e[_0xd6f0('0x45')],qs[_0xd6f0('0x54')](_0x3a1710[_0xd6f0('0x50')][_0xd6f0('0x54')]));_0x57caec[_0xd6f0('0x55')]=_0x57caec[_0xd6f0('0x55')][_0xd6f0('0x56')]?_0x57caec[_0xd6f0('0x55')]:_0x55605e[_0xd6f0('0x45')];if(!_0x3a1710['query']['hasOwnProperty'](_0xd6f0('0x58'))){_0x57caec['limit']=qs[_0xd6f0('0x2c')](_0x3a1710[_0xd6f0('0x50')][_0xd6f0('0x2c')]);_0x57caec['offset']=qs['offset'](_0x3a1710['query'][_0xd6f0('0x2a')]);}_0x57caec[_0xd6f0('0x59')]=qs['sort'](_0x3a1710['query'][_0xd6f0('0x5a')]);_0x57caec[_0xd6f0('0x5d')]=qs[_0xd6f0('0x52')](_['pick'](_0x3a1710['query'],_0x55605e[_0xd6f0('0x52')]));_0x57caec[_0xd6f0('0x5d')][_0xd6f0('0x77')]=_0x37107f['id'];if(_0x3a1710['query'][_0xd6f0('0x5c')]){_0x57caec[_0xd6f0('0x5d')]=_['merge'](_0x57caec[_0xd6f0('0x5d')],{'$or':_[_0xd6f0('0x4c')](_0x57caec[_0xd6f0('0x55')],function(_0x1d67b6){var _0x1b8262={};_0x1b8262[_0x1d67b6]={'$like':'%'+_0x3a1710[_0xd6f0('0x50')][_0xd6f0('0x5c')]+'%'};return _0x1b8262;})});}_0x57caec=_[_0xd6f0('0x5e')]({},_0x57caec,_0x3a1710['options']);return db['ChatInteraction'][_0xd6f0('0x2d')]({'where':_0x57caec['where']})['then'](function(_0x44e0ca){_0x1862e4[_0xd6f0('0x2d')]=_0x44e0ca;if(_0x3a1710[_0xd6f0('0x50')]['includeAll']){_0x57caec['include']=[{'model':db['CmContact'],'as':_0xd6f0('0xfe'),'required':![]},{'model':db[_0xd6f0('0xff')],'as':_0xd6f0('0x100'),'attributes':[_0xd6f0('0x34'),_0xd6f0('0x101'),_0xd6f0('0x102')],'required':![]},{'model':db[_0xd6f0('0x103')],'as':'Tags','attributes':['id',_0xd6f0('0x34'),_0xd6f0('0x104')],'where':_0x3a1710[_0xd6f0('0x50')][_0xd6f0('0x105')]?{'id':_0x3a1710[_0xd6f0('0x50')][_0xd6f0('0x105')]}:undefined,'required':_0x3a1710[_0xd6f0('0x50')][_0xd6f0('0x105')]?!![]:![]}];}return db[_0xd6f0('0xb8')][_0xd6f0('0x62')](_0x57caec);})[_0xd6f0('0x1b')](function(_0xa39204){_0x1862e4[_0xd6f0('0x63')]=_0xa39204;return _0x1862e4;});}})[_0xd6f0('0x1b')](respondWithFilteredResult(_0x97904c,_0x57caec))['catch'](handleError(_0x97904c,null));};exports[_0xd6f0('0x106')]=function(_0x30c00f,_0x4e8990){var _0x10c1cc=0x0;var _0x4489fd=0x0;var _0x19a4d8=![];var _0x3c999f;var _0x53bf04;return db[_0xd6f0('0x4d')][_0xd6f0('0x70')]({'where':{'id':_0x30c00f['params']['id']},'include':[{'model':db[_0xd6f0('0x98')],'as':_0xd6f0('0x98'),'include':[{'model':db[_0xd6f0('0x98')],'as':'Intervals','attributes':['id',_0xd6f0('0xae')]}]}]})['then'](handleEntityNotFound(_0x4e8990,null))[_0xd6f0('0x1b')](function(_0xcd8d6c){if(_0xcd8d6c){_0x3c999f=_0xcd8d6c;return _0xcd8d6c[_0xd6f0('0x107')]({'raw':!![]});}})[_0xd6f0('0x1b')](function(_0x541381){if(_0x3c999f){if(_0x541381){_0x53bf04=_0x541381;}}return require(_0xd6f0('0x8d'))[_0xd6f0('0x8e')]();})[_0xd6f0('0x1b')](function(_0x3c9992){if(_0x3c9992){_0x4489fd=_0x3c9992[_0xd6f0('0x108')];_0x19a4d8=_0x3c9992['custom'];}})['then'](function(){return db[_0xd6f0('0xb8')][_0xd6f0('0x2d')]({'where':{'closed':![]}});})[_0xd6f0('0x1b')](function(_0x4b1cb2){_0x10c1cc=_0x4b1cb2;if(_0x4489fd&&_0x4b1cb2>_0x4489fd){return db[_0xd6f0('0x109')][_0xd6f0('0x79')]({'where':{'id':0x1}})[_0xd6f0('0x1b')](function(_0x223930){if(_0x223930){_0x223930[_0xd6f0('0x10a')]('chatLicenseExceeded');}});}})[_0xd6f0('0x1b')](function(){var _0x39be16=_0x3c999f[_0xd6f0('0x98')];var _0x4e5c24=_0x3c999f[_0xd6f0('0x9a')]||undefined;return _0x39be16?_0x39be16[_0xd6f0('0x9b')](_0x4e5c24):!![];})[_0xd6f0('0x1b')](function(_0x6d8346){var _0x4d8aac=fs[_0xd6f0('0x10b')](path[_0xd6f0('0x8b')](config['root'],_0xd6f0('0x10c')),_0xd6f0('0xda'));var _0x13c5e1=_0xd6f0('0x10d');var _0x4b8bbf=![];var _0x591b3e,_0x6a50e8;if(_0x30c00f[_0xd6f0('0xb5')][_0xd6f0('0x3f')]){_0x591b3e=new URL(_0x30c00f[_0xd6f0('0xb5')][_0xd6f0('0x3f')])[_0xd6f0('0x10e')];}else if(_0x30c00f[_0xd6f0('0xb5')]['origin']){_0x591b3e=new URL(_0x30c00f[_0xd6f0('0xb5')][_0xd6f0('0x10e')])['origin'];}else{_0x591b3e=_0xd6f0('0x10f');}_0x6a50e8=typeof _0x3c999f[_0xd6f0('0x67')][_0xd6f0('0x3c')](',')['find'](function(_0x48b282){return wildcardUtils[_0xd6f0('0x110')](_0x48b282,_0x591b3e);})!==_0xd6f0('0x2b');var _0x5e631d={'chatVersion':_0x13c5e1,'chatWebsiteAddressOrigin':_0x6a50e8?_0x591b3e:_0x3c999f[_0xd6f0('0x67')],'remote':_0x3c999f['remote'],'query':querystring[_0xd6f0('0x21')](_[_0xd6f0('0x5e')](_0x3c999f[_0xd6f0('0x31')]({'plain':!![]}),{'customerIp':_0x30c00f['headers'][_0xd6f0('0x3a')]||_0x30c00f['headers'][_0xd6f0('0x111')]||_0x30c00f[_0xd6f0('0x112')]['remoteAddress']||_0x30c00f['ip'],'referer':_0x30c00f[_0xd6f0('0xb5')][_0xd6f0('0x3f')],'openedInteractions':_0x10c1cc,'maxInteractions':_0x4489fd,'virtual':_0x19a4d8['virtual'],'online':_0x6d8346,'custom':_0x19a4d8,'address':_0x6a50e8?_0x591b3e:null}))[_0xd6f0('0x113')](/'/g,'\x5c\x27')};_0x4e8990[_0xd6f0('0x35')](ejs[_0xd6f0('0xdb')](Mustache[_0xd6f0('0xdb')](_0x4d8aac,_0x5e631d),{'proactiveActions':_0x53bf04,'alignment':_0x3c999f[_0xd6f0('0x114')],'verticalAlignment':_0x3c999f[_0xd6f0('0x115')],'div_color':_0x3c999f[_0xd6f0('0x104')],'labelText':_0x3c999f['labelText'],'text_color':_0x3c999f[_0xd6f0('0x116')],'text_button_color':_0x3c999f[_0xd6f0('0x117')],'button_color':_0x3c999f[_0xd6f0('0x118')],'background_color':_0x3c999f[_0xd6f0('0x119')],'hideWhenOffline':_0x3c999f['hideWhenOffline'],'intervalId':_0x3c999f[_0xd6f0('0x11a')],'isDevelopment':_0x4b8bbf,'chatVersion':_0x13c5e1}));})[_0xd6f0('0x25')](handleError(_0x4e8990,null));};exports[_0xd6f0('0x11b')]=function(_0xba8c33,_0x5c7ccc){var _0x3059b4=_0xba8c33[_0xd6f0('0x65')]['id'];var _0x3b1fa0=_0xba8c33['body'];var _0x20e689=0xc8;var _0x189357=null;return db['sequelize'][_0xd6f0('0x11c')]({'isolationLevel':db[_0xd6f0('0xe6')][_0xd6f0('0x11d')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x2200e0){return db[_0xd6f0('0x4d')][_0xd6f0('0x79')]({'where':{'id':_0x3059b4},'transaction':_0x2200e0})[_0xd6f0('0x1b')](function(_0x2ac7f9){if(_0x2ac7f9){return db[_0xd6f0('0xac')]['destroy']({'where':{'ChatWebsiteId':_0x3059b4},'transaction':_0x2200e0})[_0xd6f0('0x1b')](function(){var _0x104ce5=_[_0xd6f0('0x4c')](_0x3b1fa0,function(_0x7d5ab4){_0x7d5ab4[_0xd6f0('0x77')]=_0x3059b4;return _0x7d5ab4;});return db[_0xd6f0('0xac')][_0xd6f0('0xe8')](_0x104ce5,{'transaction':_0x2200e0});});}else{_0x20e689=0x194;_0x189357=[];}});})[_0xd6f0('0x1b')](function(){if(_0x20e689!==0x194){return db[_0xd6f0('0xac')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x3059b4},'order':_0xd6f0('0xb2')})['then'](function(_0x57ed5c){_0x189357=_0x57ed5c;});}})[_0xd6f0('0x25')](function(_0x4f0f96){_0x20e689=0x1f4;logger[_0xd6f0('0x22')](_0x4f0f96[_0xd6f0('0x11e')]);if(_0x4f0f96['name']){delete _0x4f0f96[_0xd6f0('0x34')];}_0x189357=_0x4f0f96;})[_0xd6f0('0x11f')](function(){if(_0x189357===null){_0x5c7ccc[_0xd6f0('0x26')](_0x20e689);}else{if(_0x20e689===0x1f4){_0x5c7ccc[_0xd6f0('0x27')](_0x20e689)[_0xd6f0('0x35')](_0x189357);}else{_0x5c7ccc[_0xd6f0('0x27')](_0x20e689)[_0xd6f0('0x29')](_0x189357);}}});};exports[_0xd6f0('0x120')]=function(_0x33677c,_0x36a92a){var _0x112b40={};var _0x136623={};var _0x1e21f9;var _0x17a816;return db[_0xd6f0('0x4d')][_0xd6f0('0x79')]({'where':{'id':_0x33677c[_0xd6f0('0x65')]['id']}})[_0xd6f0('0x1b')](handleEntityNotFound(_0x36a92a,null))[_0xd6f0('0x1b')](function(_0x20ddc4){if(_0x20ddc4){_0x1e21f9=_0x20ddc4;_0x136623[_0xd6f0('0x45')]=_[_0xd6f0('0x51')](db[_0xd6f0('0xac')][_0xd6f0('0xfd')]);_0x136623[_0xd6f0('0x50')]=_['keys'](_0x33677c[_0xd6f0('0x50')]);_0x136623[_0xd6f0('0x52')]=_[_0xd6f0('0x53')](_0x136623[_0xd6f0('0x45')],_0x136623['query']);_0x112b40[_0xd6f0('0x55')]=_['intersection'](_0x136623[_0xd6f0('0x45')],qs['fields'](_0x33677c[_0xd6f0('0x50')][_0xd6f0('0x54')]));_0x112b40[_0xd6f0('0x55')]=_0x112b40[_0xd6f0('0x55')]['length']?_0x112b40[_0xd6f0('0x55')]:_0x136623['model'];_0x112b40[_0xd6f0('0x59')]=qs[_0xd6f0('0x5a')](_0x33677c['query'][_0xd6f0('0x5a')]);_0x112b40[_0xd6f0('0x5d')]=qs[_0xd6f0('0x52')](_[_0xd6f0('0x5b')](_0x33677c['query'],_0x136623[_0xd6f0('0x52')]));if(_0x33677c[_0xd6f0('0x50')]['filter']){_0x112b40[_0xd6f0('0x5d')]=_[_0xd6f0('0x5e')](_0x112b40[_0xd6f0('0x5d')],{'$or':_[_0xd6f0('0x4c')](_0x112b40[_0xd6f0('0x55')],function(_0x194cbd){var _0x4805d2={};_0x4805d2[_0x194cbd]={'$like':'%'+_0x33677c[_0xd6f0('0x50')][_0xd6f0('0x5c')]+'%'};return _0x4805d2;})});}_0x112b40=_[_0xd6f0('0x5e')]({},_0x112b40,_0x33677c[_0xd6f0('0x5f')]);return _0x1e21f9[_0xd6f0('0x120')](_0x112b40);}})[_0xd6f0('0x1b')](function(_0x20be66){if(_0x20be66){_0x17a816=_0x20be66[_0xd6f0('0x56')];if(!_0x33677c[_0xd6f0('0x50')][_0xd6f0('0x57')](_0xd6f0('0x58'))){_0x112b40[_0xd6f0('0x2c')]=qs[_0xd6f0('0x2c')](_0x33677c[_0xd6f0('0x50')]['limit']);_0x112b40[_0xd6f0('0x2a')]=qs['offset'](_0x33677c['query'][_0xd6f0('0x2a')]);}return _0x1e21f9[_0xd6f0('0x120')](_0x112b40);}})[_0xd6f0('0x1b')](function(_0x5ae610){if(_0x5ae610){return _0x5ae610?{'count':_0x17a816,'rows':_0x5ae610}:null;}})[_0xd6f0('0x1b')](respondWithResult(_0x36a92a,null))[_0xd6f0('0x25')](handleError(_0x36a92a,null));};exports[_0xd6f0('0x121')]=function(_0x526d64,_0x5b8e66){return db[_0xd6f0('0x122')][_0xd6f0('0x70')]({'where':{'id':_0x526d64[_0xd6f0('0x65')]['id']}})['then'](handleEntityNotFound(_0x5b8e66,null))[_0xd6f0('0x1b')](function(_0xade3f3){if(_0xade3f3){return _0xade3f3['addProactiveActions'](_0x526d64['body'][_0xd6f0('0x7c')],_[_0xd6f0('0xfb')](_0x526d64['body'],[_0xd6f0('0x7c'),'id'])||{});}})['then'](respondWithResult(_0x5b8e66,null))[_0xd6f0('0x25')](handleError(_0x5b8e66,null));};exports['getProactiveActions']=function(_0x2fc34a,_0xa2ffeb){var _0x3c2348={};var _0x129a15={};var _0x40ba46;var _0xaaac3f;return db['ChatWebsite'][_0xd6f0('0x79')]({'where':{'id':_0x2fc34a[_0xd6f0('0x65')]['id']}})[_0xd6f0('0x1b')](handleEntityNotFound(_0xa2ffeb,null))[_0xd6f0('0x1b')](function(_0x12bf7d){if(_0x12bf7d){_0x40ba46=_0x12bf7d;_0x129a15[_0xd6f0('0x45')]=_[_0xd6f0('0x51')](db[_0xd6f0('0x123')][_0xd6f0('0xfd')]);_0x129a15[_0xd6f0('0x50')]=_[_0xd6f0('0x51')](_0x2fc34a['query']);_0x129a15[_0xd6f0('0x52')]=_[_0xd6f0('0x53')](_0x129a15[_0xd6f0('0x45')],_0x129a15[_0xd6f0('0x50')]);_0x3c2348[_0xd6f0('0x55')]=_[_0xd6f0('0x53')](_0x129a15[_0xd6f0('0x45')],qs['fields'](_0x2fc34a[_0xd6f0('0x50')]['fields']));_0x3c2348[_0xd6f0('0x55')]=_0x3c2348[_0xd6f0('0x55')][_0xd6f0('0x56')]?_0x3c2348['attributes']:_0x129a15['model'];_0x3c2348['order']=qs[_0xd6f0('0x5a')](_0x2fc34a[_0xd6f0('0x50')][_0xd6f0('0x5a')]);_0x3c2348[_0xd6f0('0x5d')]=qs['filters'](_[_0xd6f0('0x5b')](_0x2fc34a[_0xd6f0('0x50')],_0x129a15[_0xd6f0('0x52')]));if(_0x2fc34a[_0xd6f0('0x50')][_0xd6f0('0x5c')]){_0x3c2348[_0xd6f0('0x5d')]=_[_0xd6f0('0x5e')](_0x3c2348['where'],{'$or':_[_0xd6f0('0x4c')](_0x3c2348[_0xd6f0('0x55')],function(_0x16533b){var _0x4096d1={};_0x4096d1[_0x16533b]={'$like':'%'+_0x2fc34a[_0xd6f0('0x50')]['filter']+'%'};return _0x4096d1;})});}_0x3c2348=_[_0xd6f0('0x5e')]({},_0x3c2348,_0x2fc34a[_0xd6f0('0x5f')]);return _0x40ba46[_0xd6f0('0x107')](_0x3c2348);}})[_0xd6f0('0x1b')](function(_0x18085f){if(_0x18085f){_0xaaac3f=_0x18085f[_0xd6f0('0x56')];if(!_0x2fc34a[_0xd6f0('0x50')][_0xd6f0('0x57')](_0xd6f0('0x58'))){_0x3c2348[_0xd6f0('0x2c')]=qs[_0xd6f0('0x2c')](_0x2fc34a[_0xd6f0('0x50')][_0xd6f0('0x2c')]);_0x3c2348[_0xd6f0('0x2a')]=qs['offset'](_0x2fc34a[_0xd6f0('0x50')][_0xd6f0('0x2a')]);}return _0x40ba46[_0xd6f0('0x107')](_0x3c2348);}})[_0xd6f0('0x1b')](function(_0x53efdf){if(_0x53efdf){return _0x53efdf?{'count':_0xaaac3f,'rows':_0x53efdf}:null;}})[_0xd6f0('0x1b')](respondWithResult(_0xa2ffeb,null))[_0xd6f0('0x25')](handleError(_0xa2ffeb,null));};exports[_0xd6f0('0x124')]=function(_0x33c9a8,_0xb9c09b){var _0x194587=_0x33c9a8[_0xd6f0('0x50')][_0xd6f0('0x125')]===_0xd6f0('0x126')?'offlineForm':_0xd6f0('0x127');return db[_0xd6f0('0x4d')]['find']({'attributes':['id',_0x194587],'where':{'id':_0x33c9a8[_0xd6f0('0x65')]['id']}})[_0xd6f0('0x1b')](handleEntityNotFound(_0xb9c09b,null))['then'](function(_0x421505){if(_0x421505){var _0x28c9c8=_0x421505[_0x194587];var _0x5b3972=_0x28c9c8&&_0x28c9c8[_0xd6f0('0x128')]?_0x28c9c8['items']:[];_0xb9c09b[_0xd6f0('0x35')]({'fromKey':_[_0xd6f0('0x8f')](_0x28c9c8[_0xd6f0('0x129')])?undefined:_0x28c9c8['fromKey'],'count':_0x5b3972[_0xd6f0('0x56')],'rows':_0x5b3972});}})[_0xd6f0('0x25')](handleError(_0xb9c09b,null));};exports[_0xd6f0('0x12a')]=function(_0x16f950,_0x3620da){var _0x182671={'raw':![],'where':{}};var _0x693d8b={};var _0x3d72b3={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd6f0('0x79')]({'where':{'id':_0x16f950[_0xd6f0('0x65')]['id']}})['then'](handleEntityNotFound(_0x3620da,null))[_0xd6f0('0x1b')](function(_0x43177d){if(_0x43177d){_0x693d8b[_0xd6f0('0x45')]=_[_0xd6f0('0x51')](db[_0xd6f0('0xde')][_0xd6f0('0xfd')]);_0x693d8b[_0xd6f0('0x50')]=_[_0xd6f0('0x51')](_0x16f950[_0xd6f0('0x50')]);_0x693d8b[_0xd6f0('0x52')]=_[_0xd6f0('0x53')](_0x693d8b[_0xd6f0('0x45')],_0x693d8b['query']);_0x182671[_0xd6f0('0x55')]=_['intersection'](_0x693d8b[_0xd6f0('0x45')],qs[_0xd6f0('0x54')](_0x16f950[_0xd6f0('0x50')][_0xd6f0('0x54')]));_0x182671[_0xd6f0('0x55')]=_0x182671['attributes']['length']?_0x182671[_0xd6f0('0x55')]:_0x693d8b[_0xd6f0('0x45')];if(!_0x16f950[_0xd6f0('0x50')][_0xd6f0('0x57')](_0xd6f0('0x58'))){_0x182671['limit']=qs[_0xd6f0('0x2c')](_0x16f950[_0xd6f0('0x50')][_0xd6f0('0x2c')]);_0x182671['offset']=qs[_0xd6f0('0x2a')](_0x16f950[_0xd6f0('0x50')][_0xd6f0('0x2a')]);}_0x182671[_0xd6f0('0x59')]=qs[_0xd6f0('0x5a')](_0x16f950[_0xd6f0('0x50')]['sort']);_0x182671['where']=qs[_0xd6f0('0x52')](_[_0xd6f0('0x5b')](_0x16f950['query'],_0x693d8b['filters']));_0x182671[_0xd6f0('0x5d')][_0xd6f0('0x77')]=_0x43177d['id'];if(_0x16f950[_0xd6f0('0x50')]['filter']){_0x182671[_0xd6f0('0x5d')]=_['merge'](_0x182671[_0xd6f0('0x5d')],{'$or':_['map'](_0x182671['attributes'],function(_0x3b8332){var _0x508c66={};_0x508c66[_0x3b8332]={'$like':'%'+_0x16f950[_0xd6f0('0x50')][_0xd6f0('0x5c')]+'%'};return _0x508c66;})});}_0x182671=_[_0xd6f0('0x5e')]({},_0x182671,_0x16f950[_0xd6f0('0x5f')]);return db[_0xd6f0('0xde')]['count']({'where':_0x182671['where']})[_0xd6f0('0x1b')](function(_0x4b2db9){_0x3d72b3[_0xd6f0('0x2d')]=_0x4b2db9;if(_0x16f950[_0xd6f0('0x50')]['includeAll']){_0x182671[_0xd6f0('0x61')]=[{'all':!![]}];}else{_0x182671['include']=[{'model':db['CmContact'],'as':_0xd6f0('0xfe'),'required':![]},{'model':db[_0xd6f0('0xe7')],'as':_0xd6f0('0x12b'),'required':![]}];}return db[_0xd6f0('0xde')]['findAll'](_0x182671);})[_0xd6f0('0x1b')](function(_0x1f8ed5){_0x3d72b3[_0xd6f0('0x63')]=_0x1f8ed5;return _0x3d72b3;});}})[_0xd6f0('0x1b')](respondWithFilteredResult(_0x3620da,_0x182671))['catch'](handleError(_0x3620da,null));};exports[_0xd6f0('0x12c')]=function(_0x5945bb,_0x21f55d){return db['ChatWebsite']['find']({'where':{'id':_0x5945bb[_0xd6f0('0x65')]['id']}})[_0xd6f0('0x1b')](handleEntityNotFound(_0x21f55d,null))['then'](function(_0x29f9cb){if(_0x29f9cb){return _0x29f9cb['addAgents'](_0x5945bb['body']['ids'],_['omit'](_0x5945bb[_0xd6f0('0x6c')],[_0xd6f0('0x7c'),'id'])||{})[_0xd6f0('0x12d')](function(_0x329fab){for(var _0x42c997=0x0;_0x42c997<_0x5945bb[_0xd6f0('0x6c')][_0xd6f0('0x7c')][_0xd6f0('0x56')];_0x42c997+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x5945bb['body']['ids'][_0x42c997]),'ChatWebsiteId':Number(_0x5945bb['params']['id'])});}return _0x329fab;});}})[_0xd6f0('0x1b')](respondWithResult(_0x21f55d,null))[_0xd6f0('0x25')](handleError(_0x21f55d,null));};exports[_0xd6f0('0x12e')]=function(_0x5d32d7,_0xf83cfd){return db[_0xd6f0('0x4d')][_0xd6f0('0x70')]({'where':{'id':_0x5d32d7['params']['id']}})[_0xd6f0('0x1b')](handleEntityNotFound(_0xf83cfd,null))[_0xd6f0('0x1b')](function(_0x49a32b){if(_0x49a32b){return _0x49a32b[_0xd6f0('0x12e')](_0x5d32d7['query'][_0xd6f0('0x7c')])[_0xd6f0('0x1b')](function(){if(_[_0xd6f0('0x12f')](_0x5d32d7[_0xd6f0('0x50')][_0xd6f0('0x7c')])){for(var _0x408d17=0x0;_0x408d17<_0x5d32d7[_0xd6f0('0x50')][_0xd6f0('0x7c')][_0xd6f0('0x56')];_0x408d17+=0x1){socket[_0xd6f0('0x130')](_0xd6f0('0x131'),{'UserId':Number(_0x5d32d7[_0xd6f0('0x50')][_0xd6f0('0x7c')][_0x408d17]),'ChatWebsiteId':Number(_0x5d32d7['params']['id'])});}}else{socket[_0xd6f0('0x130')](_0xd6f0('0x131'),{'UserId':Number(_0x5d32d7[_0xd6f0('0x50')][_0xd6f0('0x7c')]),'ChatWebsiteId':Number(_0x5d32d7[_0xd6f0('0x65')]['id'])});}});}})[_0xd6f0('0x1b')](respondWithStatusCode(_0xf83cfd,null))[_0xd6f0('0x25')](handleError(_0xf83cfd,null));};exports[_0xd6f0('0x132')]=function(_0x565bca,_0x4113d8){var _0xd9cb39={};var _0x5fc643={};var _0x3b0cd4;var _0x12aba2;return db[_0xd6f0('0x4d')]['findOne']({'where':{'id':_0x565bca[_0xd6f0('0x65')]['id']}})['then'](handleEntityNotFound(_0x4113d8,null))[_0xd6f0('0x1b')](function(_0x3d21bf){if(_0x3d21bf){_0x3b0cd4=_0x3d21bf;_0x5fc643[_0xd6f0('0x45')]=_['keys'](db[_0xd6f0('0xff')][_0xd6f0('0xfd')]);_0x5fc643['query']=_[_0xd6f0('0x51')](_0x565bca[_0xd6f0('0x50')]);_0x5fc643['filters']=_[_0xd6f0('0x53')](_0x5fc643[_0xd6f0('0x45')],_0x5fc643['query']);_0xd9cb39[_0xd6f0('0x55')]=_[_0xd6f0('0x53')](_0x5fc643[_0xd6f0('0x45')],qs[_0xd6f0('0x54')](_0x565bca[_0xd6f0('0x50')][_0xd6f0('0x54')]));_0xd9cb39[_0xd6f0('0x55')]=_0xd9cb39['attributes']['length']?_0xd9cb39['attributes']:_0x5fc643[_0xd6f0('0x45')];_0xd9cb39[_0xd6f0('0x59')]=qs[_0xd6f0('0x5a')](_0x565bca[_0xd6f0('0x50')][_0xd6f0('0x5a')]);_0xd9cb39[_0xd6f0('0x5d')]=qs['filters'](_['pick'](_0x565bca[_0xd6f0('0x50')],_0x5fc643[_0xd6f0('0x52')]));if(_0x565bca['query'][_0xd6f0('0x5c')]){_0xd9cb39['where']=_[_0xd6f0('0x5e')](_0xd9cb39['where'],{'$or':_[_0xd6f0('0x4c')](_0xd9cb39['attributes'],function(_0x47f6c9){var _0x3aed3c={};_0x3aed3c[_0x47f6c9]={'$like':'%'+_0x565bca['query']['filter']+'%'};return _0x3aed3c;})});}_0xd9cb39=_['merge']({},_0xd9cb39,_0x565bca[_0xd6f0('0x5f')]);return _0x3b0cd4[_0xd6f0('0x132')](_0xd9cb39);}})[_0xd6f0('0x1b')](function(_0x59db5a){if(_0x59db5a){_0x12aba2=_0x59db5a[_0xd6f0('0x56')];if(!_0x565bca[_0xd6f0('0x50')]['hasOwnProperty']('nolimit')){_0xd9cb39[_0xd6f0('0x2c')]=qs[_0xd6f0('0x2c')](_0x565bca[_0xd6f0('0x50')][_0xd6f0('0x2c')]);_0xd9cb39[_0xd6f0('0x2a')]=qs[_0xd6f0('0x2a')](_0x565bca[_0xd6f0('0x50')][_0xd6f0('0x2a')]);}return _0x3b0cd4['getAgents'](_0xd9cb39);}})[_0xd6f0('0x1b')](function(_0x402529){if(_0x402529){return _0x402529?{'count':_0x12aba2,'rows':_0x402529}:null;}})[_0xd6f0('0x1b')](respondWithResult(_0x4113d8,null))['catch'](handleError(_0x4113d8,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index ba532eb..88e1e1b 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 _0xaf79=['remove','emit','hook','exports','../../mysqldb','ChatWebsite','setMaxListeners','save','update'];(function(_0xd3c93d,_0xf7dd71){var _0x3924c3=function(_0x18d6c5){while(--_0x18d6c5){_0xd3c93d['push'](_0xd3c93d['shift']());}};_0x3924c3(++_0xf7dd71);}(_0xaf79,0x82));var _0x9af7=function(_0x408663,_0x5eb6ce){_0x408663=_0x408663-0x0;var _0x4eb1f1=_0xaf79[_0x408663];return _0x4eb1f1;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x9af7('0x0'))['db'][_0x9af7('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9af7('0x2')](0x0);var events={'afterCreate':_0x9af7('0x3'),'afterUpdate':_0x9af7('0x4'),'afterDestroy':_0x9af7('0x5')};function emitEvent(_0x53e09f){return function(_0x6e8099,_0xfa2a43,_0x432c06){ChatWebsiteEvents[_0x9af7('0x6')](_0x53e09f+':'+_0x6e8099['id'],_0x6e8099);ChatWebsiteEvents['emit'](_0x53e09f,_0x6e8099);_0x432c06(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x9af7('0x7')](e,emitEvent(event));}}module[_0x9af7('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0xdcc4=['events','../../mysqldb','ChatWebsite','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x24006e,_0x42714c){var _0x5b9d3a=function(_0x8d9caa){while(--_0x8d9caa){_0x24006e['push'](_0x24006e['shift']());}};_0x5b9d3a(++_0x42714c);}(_0xdcc4,0xea));var _0x4dcc=function(_0x51d786,_0x3a6797){_0x51d786=_0x51d786-0x0;var _0x32560b=_0xdcc4[_0x51d786];return _0x32560b;};'use strict';var EventEmitter=require(_0x4dcc('0x0'));var ChatWebsite=require(_0x4dcc('0x1'))['db'][_0x4dcc('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x4dcc('0x3')](0x0);var events={'afterCreate':_0x4dcc('0x4'),'afterUpdate':'update','afterDestroy':_0x4dcc('0x5')};function emitEvent(_0x5c1ea7){return function(_0x416d97,_0x30c165,_0x34bc8d){ChatWebsiteEvents[_0x4dcc('0x6')](_0x5c1ea7+':'+_0x416d97['id'],_0x416d97);ChatWebsiteEvents['emit'](_0x5c1ea7,_0x416d97);_0x34bc8d(null);};}for(var e in events){if(events[_0x4dcc('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x4dcc('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 3f8178b..4f019df 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 _0x9ad4=['api','moment','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util'];(function(_0x1b7161,_0xc11e47){var _0x1fae52=function(_0xb5f207){while(--_0xb5f207){_0x1b7161['push'](_0x1b7161['shift']());}};_0x1fae52(++_0xc11e47);}(_0x9ad4,0x1b8));var _0x49ad=function(_0x4ab9a7,_0x291df1){_0x4ab9a7=_0x4ab9a7-0x0;var _0xd08799=_0x9ad4[_0x4ab9a7];return _0xd08799;};'use strict';var _=require(_0x49ad('0x0'));var util=require(_0x49ad('0x1'));var logger=require('../../config/logger')(_0x49ad('0x2'));var moment=require(_0x49ad('0x3'));var BPromise=require(_0x49ad('0x4'));var rp=require(_0x49ad('0x5'));var fs=require('fs');var path=require(_0x49ad('0x6'));var rimraf=require('rimraf');var config=require(_0x49ad('0x7'));var attributes=require(_0x49ad('0x8'));module[_0x49ad('0x9')]=function(_0x91f9a9,_0x2ed766){return _0x91f9a9[_0x49ad('0xa')](_0x49ad('0xb'),attributes,{'tableName':_0x49ad('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c31=['moment','bluebird','request-promise','define','ChatWebsite','chat_websites','lodash','util','../../config/logger'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x0c31,0x177));var _0x10c3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x0c31[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x10c3('0x0'));var util=require(_0x10c3('0x1'));var logger=require(_0x10c3('0x2'))('api');var moment=require(_0x10c3('0x3'));var BPromise=require(_0x10c3('0x4'));var rp=require(_0x10c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x3118a3,_0x5f4f8f){return _0x3118a3[_0x10c3('0x6')](_0x10c3('0x7'),attributes,{'tableName':_0x10c3('0x8'),'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 f47088d..b4dc842 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 _0x98b9=['request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatWebsite.socket','register'];(function(_0x3ed131,_0x4be59f){var _0x1a0365=function(_0x4e4342){while(--_0x4e4342){_0x3ed131['push'](_0x3ed131['shift']());}};_0x1a0365(++_0x4be59f);}(_0x98b9,0x84));var _0x998b=function(_0x599fd2,_0x2bea83){_0x599fd2=_0x599fd2-0x0;var _0x467b51=_0x98b9[_0x599fd2];return _0x467b51;};'use strict';var _=require(_0x998b('0x0'));var util=require(_0x998b('0x1'));var moment=require(_0x998b('0x2'));var BPromise=require(_0x998b('0x3'));var rs=require(_0x998b('0x4'));var fs=require('fs');var Redis=require(_0x998b('0x5'));var db=require(_0x998b('0x6'))['db'];var utils=require(_0x998b('0x7'));var logger=require(_0x998b('0x8'))(_0x998b('0x9'));var config=require(_0x998b('0xa'));var jayson=require(_0x998b('0xb'));var client=jayson[_0x998b('0xc')][_0x998b('0xd')]({'port':0x232a});config[_0x998b('0xe')]=_[_0x998b('0xf')](config[_0x998b('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x998b('0x10'))[_0x998b('0x11')](socket);function respondWithRpcPromise(_0x4c90f2,_0x5ed447,_0x2baa5d){return new BPromise(function(_0x5dbf15,_0x3b697a){return client[_0x998b('0x12')](_0x4c90f2,_0x2baa5d)[_0x998b('0x13')](function(_0x2b6e45){logger[_0x998b('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x5ed447,_0x998b('0x15'));logger[_0x998b('0x16')](_0x998b('0x17'),_0x5ed447,'request\x20sent',JSON['stringify'](_0x2b6e45));if(_0x2b6e45[_0x998b('0x18')]){if(_0x2b6e45[_0x998b('0x18')][_0x998b('0x19')]===0x1f4){logger[_0x998b('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x5ed447,_0x2b6e45[_0x998b('0x18')]['message']);return _0x3b697a(_0x2b6e45[_0x998b('0x18')]['message']);}logger[_0x998b('0x18')](_0x998b('0x1a'),_0x5ed447,_0x2b6e45[_0x998b('0x18')][_0x998b('0x1b')]);return _0x5dbf15(_0x2b6e45[_0x998b('0x18')][_0x998b('0x1b')]);}else{logger[_0x998b('0x14')](_0x998b('0x1a'),_0x5ed447,_0x998b('0x15'));_0x5dbf15(_0x2b6e45[_0x998b('0x1c')][_0x998b('0x1b')]);}})[_0x998b('0x1d')](function(_0x2b198d){logger[_0x998b('0x18')](_0x998b('0x1a'),_0x5ed447,_0x2b198d);_0x3b697a(_0x2b198d);});});} \ No newline at end of file +var _0xe73c=['defaults','redis','socket.io-emitter','./chatWebsite.socket','register','request','then','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client'];(function(_0x419780,_0x4eb356){var _0x16458e=function(_0x296cde){while(--_0x296cde){_0x419780['push'](_0x419780['shift']());}};_0x16458e(++_0x4eb356);}(_0xe73c,0xe2));var _0xce73=function(_0x5cdf30,_0x4e9316){_0x5cdf30=_0x5cdf30-0x0;var _0x408c24=_0xe73c[_0x5cdf30];return _0x408c24;};'use strict';var _=require('lodash');var util=require(_0xce73('0x0'));var moment=require(_0xce73('0x1'));var BPromise=require(_0xce73('0x2'));var rs=require(_0xce73('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xce73('0x4'))(_0xce73('0x5'));var config=require(_0xce73('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xce73('0x7')]['http']({'port':0x232a});config['redis']=_[_0xce73('0x8')](config[_0xce73('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xce73('0xa'))(new Redis(config[_0xce73('0x9')]));require(_0xce73('0xb'))[_0xce73('0xc')](socket);function respondWithRpcPromise(_0x4912e2,_0x405673,_0x562b5b){return new BPromise(function(_0x1135cf,_0x53370e){return client[_0xce73('0xd')](_0x4912e2,_0x562b5b)[_0xce73('0xe')](function(_0x309137){logger[_0xce73('0xf')]('ChatWebsite,\x20%s,\x20%s',_0x405673,'request\x20sent');logger[_0xce73('0x10')](_0xce73('0x11'),_0x405673,_0xce73('0x12'),JSON[_0xce73('0x13')](_0x309137));if(_0x309137[_0xce73('0x14')]){if(_0x309137['error'][_0xce73('0x15')]===0x1f4){logger[_0xce73('0x14')](_0xce73('0x16'),_0x405673,_0x309137['error'][_0xce73('0x17')]);return _0x53370e(_0x309137[_0xce73('0x14')][_0xce73('0x17')]);}logger[_0xce73('0x14')](_0xce73('0x16'),_0x405673,_0x309137[_0xce73('0x14')][_0xce73('0x17')]);return _0x1135cf(_0x309137[_0xce73('0x14')][_0xce73('0x17')]);}else{logger[_0xce73('0xf')](_0xce73('0x16'),_0x405673,_0xce73('0x12'));_0x1135cf(_0x309137[_0xce73('0x18')]['message']);}})[_0xce73('0x19')](function(_0x3fdb7b){logger[_0xce73('0x14')](_0xce73('0x16'),_0x405673,_0x3fdb7b);_0x53370e(_0x3fdb7b);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 13e61dd..35b0981 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 _0xe37a=['chatWebsite:','./chatWebsite.events','remove','emit','removeListener','length'];(function(_0x17066f,_0x2fb843){var _0x221b86=function(_0x1747ee){while(--_0x1747ee){_0x17066f['push'](_0x17066f['shift']());}};_0x221b86(++_0x2fb843);}(_0xe37a,0xe5));var _0xae37=function(_0x1058e5,_0x440855){_0x1058e5=_0x1058e5-0x0;var _0x9a8e3d=_0xe37a[_0x1058e5];return _0x9a8e3d;};'use strict';var ChatWebsiteEvents=require(_0xae37('0x0'));var events=['save',_0xae37('0x1'),'update'];function createListener(_0x1d5ea0,_0x47fe00){return function(_0x5d8173){_0x47fe00[_0xae37('0x2')](_0x1d5ea0,_0x5d8173);};}function removeListener(_0x1259e9,_0x4af123){return function(){ChatWebsiteEvents[_0xae37('0x3')](_0x1259e9,_0x4af123);};}exports['register']=function(_0x4765ed){for(var _0x479910=0x0,_0x5aa0c7=events[_0xae37('0x4')];_0x479910<_0x5aa0c7;_0x479910++){var _0x536851=events[_0x479910];var _0x4cf37f=createListener(_0xae37('0x5')+_0x536851,_0x4765ed);ChatWebsiteEvents['on'](_0x536851,_0x4cf37f);}}; \ No newline at end of file +var _0x8b9b=['removeListener','register','length','chatWebsite:','./chatWebsite.events','remove','update','emit'];(function(_0x1b64dd,_0x2cf769){var _0xeb464c=function(_0x38272c){while(--_0x38272c){_0x1b64dd['push'](_0x1b64dd['shift']());}};_0xeb464c(++_0x2cf769);}(_0x8b9b,0x134));var _0xb8b9=function(_0x417234,_0x28ac37){_0x417234=_0x417234-0x0;var _0x33f3b8=_0x8b9b[_0x417234];return _0x33f3b8;};'use strict';var ChatWebsiteEvents=require(_0xb8b9('0x0'));var events=['save',_0xb8b9('0x1'),_0xb8b9('0x2')];function createListener(_0x22002e,_0xc4c094){return function(_0x2fcfec){_0xc4c094[_0xb8b9('0x3')](_0x22002e,_0x2fcfec);};}function removeListener(_0x2a4b8f,_0x446c88){return function(){ChatWebsiteEvents[_0xb8b9('0x4')](_0x2a4b8f,_0x446c88);};}exports[_0xb8b9('0x5')]=function(_0x5a3420){for(var _0xca6659=0x0,_0x239f9b=events[_0xb8b9('0x6')];_0xca6659<_0x239f9b;_0xca6659++){var _0x532643=events[_0xca6659];var _0x4b2feb=createListener(_0xb8b9('0x7')+_0x532643,_0x5a3420);ChatWebsiteEvents['on'](_0x532643,_0x4b2feb);}}; \ 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 3a697ea..54a6863 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 _0xffd6=['escapeRegExp','url','replace','localhost','test','trim','([\x5cw]+)','../../../utils/misc'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0xffd6,0x97));var _0x6ffd=function(_0x16db8b,_0xca7d28){_0x16db8b=_0x16db8b-0x0;var _0x5ba017=_0xffd6[_0x16db8b];return _0x5ba017;};var escapeRegExp=require(_0x6ffd('0x0'))[_0x6ffd('0x1')];var URL=require(_0x6ffd('0x2'))['URL'];function testWildcardValidity(_0x589640){var _0x305b6b=!![];try{new URL(_0x589640[_0x6ffd('0x3')]('*',_0x6ffd('0x4')));}catch(_0x560afa){_0x305b6b=![];}return _0x305b6b&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x6ffd('0x5')](_0x589640);}function testWebsiteWithWildcard(_0x173979,_0x3b8a46){var _0x2949a4;var _0x561055=escapeRegExp(_0x173979[_0x6ffd('0x6')]()[_0x6ffd('0x3')](/\/$/,''))[_0x6ffd('0x3')]('\x5c*',_0x6ffd('0x7'));try{new URL(_0x173979[_0x6ffd('0x3')]('\x5c*','localhost'));_0x2949a4=new RegExp(_0x561055)[_0x6ffd('0x5')](_0x3b8a46);}catch(_0x417f34){_0x2949a4=![];}return _0x2949a4;}module['exports']={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0xc5c8=['../../../utils/misc','escapeRegExp','url','localhost','trim','replace','([\x5cw]+)'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc5c8,0x118));var _0x8c5c=function(_0x4cbd5b,_0x196052){_0x4cbd5b=_0x4cbd5b-0x0;var _0x577104=_0xc5c8[_0x4cbd5b];return _0x577104;};var escapeRegExp=require(_0x8c5c('0x0'))[_0x8c5c('0x1')];var URL=require(_0x8c5c('0x2'))['URL'];function testWildcardValidity(_0x1217bd){var _0x5eb28f=!![];try{new URL(_0x1217bd['replace']('*',_0x8c5c('0x3')));}catch(_0x210e70){_0x5eb28f=![];}return _0x5eb28f&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x1217bd);}function testWebsiteWithWildcard(_0x302b48,_0x6bfa4f){var _0x390b86;var _0x2e297d=escapeRegExp(_0x302b48[_0x8c5c('0x4')]()[_0x8c5c('0x5')](/\/$/,''))[_0x8c5c('0x5')]('\x5c*',_0x8c5c('0x6'));try{new URL(_0x302b48[_0x8c5c('0x5')]('\x5c*',_0x8c5c('0x3')));_0x390b86=new RegExp(_0x2e297d)['test'](_0x6bfa4f);}catch(_0x552b87){_0x390b86=![];}return _0x390b86;}module['exports']={'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 c89c06c..b88208a 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 _0x88ac=['getAnswers','/:id/logo','/:id/avatar','getAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','post','create','addDisposition','addAnswer','join','root','server/files/images/logos/','%s-%s','now','originalname','file','addLogo','diskStorage','format','single','addAvatar','server/files/images/avatars/','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','/:id/interactions','addInteraction','addApplications','addProactiveActions','/:id/users','addAgents','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','isAuthenticated','get','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x88ac,0x1a2));var _0xc88a=function(_0x1c3bed,_0x1736f9){_0x1c3bed=_0x1c3bed-0x0;var _0x1302b9=_0x88ac[_0x1c3bed];return _0x1302b9;};'use strict';var multer=require(_0xc88a('0x0'));var util=require(_0xc88a('0x1'));var path=require(_0xc88a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc88a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc88a('0x4'));var interaction=require(_0xc88a('0x5'));var config=require('../../config/environment');var controller=require(_0xc88a('0x6'));router['get']('/',auth[_0xc88a('0x7')](),controller['index']);router[_0xc88a('0x8')]('/describe',auth[_0xc88a('0x7')](),controller['describe']);router[_0xc88a('0x8')](_0xc88a('0x9'),auth[_0xc88a('0x7')](),controller[_0xc88a('0xa')]);router['get'](_0xc88a('0xb'),auth[_0xc88a('0x7')](),controller[_0xc88a('0xc')]);router[_0xc88a('0x8')](_0xc88a('0xd'),auth['isAuthenticated'](),controller[_0xc88a('0xe')]);router[_0xc88a('0x8')](_0xc88a('0xf'),controller['getLogo']);router[_0xc88a('0x8')](_0xc88a('0x10'),controller[_0xc88a('0x11')]);router[_0xc88a('0x8')]('/:id/customer_avatar',controller['getCustomerAvatar']);router['get'](_0xc88a('0x12'),controller[_0xc88a('0x13')]);router[_0xc88a('0x8')]('/:id/interactions',auth[_0xc88a('0x7')](),controller[_0xc88a('0x14')]);router['get'](_0xc88a('0x15'),controller[_0xc88a('0x16')]);router['get'](_0xc88a('0x17'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x18')]);router[_0xc88a('0x8')](_0xc88a('0x19'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x1a')]);router[_0xc88a('0x8')](_0xc88a('0x1b'),controller['getFields']);router[_0xc88a('0x8')](_0xc88a('0x1c'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x1d')]);router[_0xc88a('0x8')]('/:id/users',auth[_0xc88a('0x7')](),controller['getAgents']);router[_0xc88a('0x1e')]('/',auth[_0xc88a('0x7')](),controller[_0xc88a('0x1f')]);router[_0xc88a('0x1e')](_0xc88a('0xb'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x20')]);router[_0xc88a('0x1e')](_0xc88a('0xd'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5394a9,_0x1ad6be,_0x2f685d){_0x2f685d(null,path[_0xc88a('0x22')](config[_0xc88a('0x23')],_0xc88a('0x24')));},'filename':function(_0x501c74,_0x371c6d,_0x260239){_0x260239(null,util['format'](_0xc88a('0x25'),Date[_0xc88a('0x26')](),_0x371c6d[_0xc88a('0x27')]));}})});router[_0xc88a('0x1e')](_0xc88a('0xf'),upload['single'](_0xc88a('0x28')),controller[_0xc88a('0x29')]);var upload=multer({'storage':multer[_0xc88a('0x2a')]({'destination':function(_0x5804c7,_0x5a9533,_0x2b0611){_0x2b0611(null,path[_0xc88a('0x22')](config[_0xc88a('0x23')],'server/files/images/avatars/'));},'filename':function(_0x208d6c,_0x39d172,_0x141a41){_0x141a41(null,util[_0xc88a('0x2b')]('%s-%s',Date['now'](),_0x39d172[_0xc88a('0x27')]));}})});router[_0xc88a('0x1e')]('/:id/avatar',upload[_0xc88a('0x2c')](_0xc88a('0x28')),controller[_0xc88a('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x586aa7,_0x395c67,_0x141b43){_0x141b43(null,path[_0xc88a('0x22')](config[_0xc88a('0x23')],_0xc88a('0x2e')));},'filename':function(_0x364f70,_0x28cb36,_0x377eef){_0x377eef(null,util['format'](_0xc88a('0x25'),Date['now'](),_0x28cb36[_0xc88a('0x27')]));}})});router['post'](_0xc88a('0x2f'),upload[_0xc88a('0x2c')](_0xc88a('0x28')),controller[_0xc88a('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x58e207,_0x4e3077,_0x1b76a0){_0x1b76a0(null,path['join'](config[_0xc88a('0x23')],_0xc88a('0x2e')));},'filename':function(_0x38971a,_0x768d04,_0x68d00a){_0x68d00a(null,util[_0xc88a('0x2b')]('%s-%s',Date[_0xc88a('0x26')](),_0x768d04['originalname']));}})});router['post']('/:id/system_avatar',upload['single']('file'),controller[_0xc88a('0x31')]);router['post'](_0xc88a('0x32'),controller[_0xc88a('0x33')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x5bbbdd,_0x508717,_0x50b533){const _0x1c3560=path[_0xc88a('0x22')](config[_0xc88a('0x23')],_0xc88a('0x34'),_0xc88a('0x35'),_0xc88a('0x36'));fs_extra[_0xc88a('0x37')](_0x1c3560,function(){_0x50b533(null,_0x1c3560);});},'filename':function(_0xa0fcd0,_0x24e07c,_0x23a6ff){const _0x30201d=_0x24e07c[_0xc88a('0x27')][_0xc88a('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x44166c=path[_0xc88a('0x39')](_0x30201d);const _0x52f7bd=Date[_0xc88a('0x26')]()+'-'+_0x30201d['replace'](_0x44166c,'')+_0x44166c;_0x23a6ff(null,_0x52f7bd);}})});router[_0xc88a('0x1e')](_0xc88a('0x3a'),offlineUploadMulter[_0xc88a('0x3b')](),controller['offline']);router[_0xc88a('0x1e')](_0xc88a('0x3c'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x3d')]);router[_0xc88a('0x1e')]('/:id/applications',auth[_0xc88a('0x7')](),controller[_0xc88a('0x3e')]);router['post'](_0xc88a('0x19'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x3f')]);router[_0xc88a('0x1e')](_0xc88a('0x40'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x41')]);router['put'](_0xc88a('0x9'),auth[_0xc88a('0x7')](),controller['update']);router['delete'](_0xc88a('0x9'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x42')]);router[_0xc88a('0x43')](_0xc88a('0xb'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x44')]);router['delete'](_0xc88a('0xd'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x45')]);router[_0xc88a('0x43')](_0xc88a('0x40'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x46')]);module[_0xc88a('0x47')]=router; \ No newline at end of file +var _0xc5af=['isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','addDisposition','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','addLogo','single','addAvatar','file','addCustomerAvatar','server/files/images/avatars/','/:id/system_avatar','/:id/notify','server/files','ensureDir','replace','extname','/:id/offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','removeDispositions','removeAgents','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xc5af,0x80));var _0xfc5a=function(_0x4009af,_0x1bc8ac){_0x4009af=_0x4009af-0x0;var _0x16e058=_0xc5af[_0x4009af];return _0x16e058;};'use strict';var multer=require('multer');var util=require(_0xfc5a('0x0'));var path=require(_0xfc5a('0x1'));var timeout=require(_0xfc5a('0x2'));var express=require('express');var router=express[_0xfc5a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfc5a('0x4'));var config=require(_0xfc5a('0x5'));var controller=require(_0xfc5a('0x6'));router[_0xfc5a('0x7')]('/',auth[_0xfc5a('0x8')](),controller[_0xfc5a('0x9')]);router[_0xfc5a('0x7')](_0xfc5a('0xa'),auth[_0xfc5a('0x8')](),controller[_0xfc5a('0xb')]);router[_0xfc5a('0x7')](_0xfc5a('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xfc5a('0x7')](_0xfc5a('0xd'),auth[_0xfc5a('0x8')](),controller[_0xfc5a('0xe')]);router[_0xfc5a('0x7')](_0xfc5a('0xf'),auth['isAuthenticated'](),controller[_0xfc5a('0x10')]);router[_0xfc5a('0x7')]('/:id/logo',controller['getLogo']);router[_0xfc5a('0x7')](_0xfc5a('0x11'),controller[_0xfc5a('0x12')]);router[_0xfc5a('0x7')](_0xfc5a('0x13'),controller[_0xfc5a('0x14')]);router[_0xfc5a('0x7')]('/:id/system_avatar',controller[_0xfc5a('0x15')]);router[_0xfc5a('0x7')](_0xfc5a('0x16'),auth['isAuthenticated'](),controller[_0xfc5a('0x17')]);router[_0xfc5a('0x7')]('/:id/snippet',controller[_0xfc5a('0x18')]);router[_0xfc5a('0x7')](_0xfc5a('0x19'),auth['isAuthenticated'](),controller[_0xfc5a('0x1a')]);router[_0xfc5a('0x7')](_0xfc5a('0x1b'),auth[_0xfc5a('0x8')](),controller[_0xfc5a('0x1c')]);router[_0xfc5a('0x7')](_0xfc5a('0x1d'),controller[_0xfc5a('0x1e')]);router[_0xfc5a('0x7')](_0xfc5a('0x1f'),auth[_0xfc5a('0x8')](),controller['getOfflineMessages']);router[_0xfc5a('0x7')](_0xfc5a('0x20'),auth[_0xfc5a('0x8')](),controller[_0xfc5a('0x21')]);router['post']('/',auth[_0xfc5a('0x8')](),controller['create']);router[_0xfc5a('0x22')](_0xfc5a('0xd'),auth[_0xfc5a('0x8')](),controller[_0xfc5a('0x23')]);router['post'](_0xfc5a('0xf'),auth['isAuthenticated'](),controller['addAnswer']);var upload=multer({'storage':multer[_0xfc5a('0x24')]({'destination':function(_0xa64af8,_0x86a437,_0x16ddf1){_0x16ddf1(null,path[_0xfc5a('0x25')](config[_0xfc5a('0x26')],_0xfc5a('0x27')));},'filename':function(_0x34495a,_0x5a3d1e,_0x2e0d8b){_0x2e0d8b(null,util[_0xfc5a('0x28')](_0xfc5a('0x29'),Date[_0xfc5a('0x2a')](),_0x5a3d1e[_0xfc5a('0x2b')]));}})});router[_0xfc5a('0x22')](_0xfc5a('0x2c'),upload['single']('file'),controller[_0xfc5a('0x2d')]);var upload=multer({'storage':multer[_0xfc5a('0x24')]({'destination':function(_0x314063,_0x15cb7b,_0x36ea89){_0x36ea89(null,path[_0xfc5a('0x25')](config[_0xfc5a('0x26')],'server/files/images/avatars/'));},'filename':function(_0x5e3e64,_0x40e98c,_0x3cb2ba){_0x3cb2ba(null,util[_0xfc5a('0x28')](_0xfc5a('0x29'),Date['now'](),_0x40e98c[_0xfc5a('0x2b')]));}})});router[_0xfc5a('0x22')](_0xfc5a('0x11'),upload[_0xfc5a('0x2e')]('file'),controller[_0xfc5a('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x486fa9,_0x388c04,_0x4eaefa){_0x4eaefa(null,path[_0xfc5a('0x25')](config[_0xfc5a('0x26')],'server/files/images/avatars/'));},'filename':function(_0x480198,_0x1879bb,_0x1c6c9d){_0x1c6c9d(null,util[_0xfc5a('0x28')](_0xfc5a('0x29'),Date[_0xfc5a('0x2a')](),_0x1879bb[_0xfc5a('0x2b')]));}})});router[_0xfc5a('0x22')]('/:id/customer_avatar',upload['single'](_0xfc5a('0x30')),controller[_0xfc5a('0x31')]);var upload=multer({'storage':multer[_0xfc5a('0x24')]({'destination':function(_0x316e57,_0x3026bb,_0x5aae59){_0x5aae59(null,path[_0xfc5a('0x25')](config['root'],_0xfc5a('0x32')));},'filename':function(_0x5a6e40,_0x2074c9,_0x2bb10b){_0x2bb10b(null,util[_0xfc5a('0x28')](_0xfc5a('0x29'),Date[_0xfc5a('0x2a')](),_0x2074c9[_0xfc5a('0x2b')]));}})});router['post'](_0xfc5a('0x33'),upload[_0xfc5a('0x2e')](_0xfc5a('0x30')),controller['addSystemAvatar']);router[_0xfc5a('0x22')](_0xfc5a('0x34'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xfc5a('0x24')]({'destination':function(_0x3cafcb,_0x5ee71f,_0x223f99){const _0xf23718=path[_0xfc5a('0x25')](config['root'],_0xfc5a('0x35'),'attachments','offline-chat');fs_extra[_0xfc5a('0x36')](_0xf23718,function(){_0x223f99(null,_0xf23718);});},'filename':function(_0x37d62b,_0x5e49b9,_0x11b86c){const _0x1c69ef=_0x5e49b9[_0xfc5a('0x2b')][_0xfc5a('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2bd9ff=path[_0xfc5a('0x38')](_0x1c69ef);const _0x5519db=Date[_0xfc5a('0x2a')]()+'-'+_0x1c69ef[_0xfc5a('0x37')](_0x2bd9ff,'')+_0x2bd9ff;_0x11b86c(null,_0x5519db);}})});router[_0xfc5a('0x22')](_0xfc5a('0x39'),offlineUploadMulter['any'](),controller['offline']);router['post'](_0xfc5a('0x16'),auth[_0xfc5a('0x8')](),controller[_0xfc5a('0x3a')]);router[_0xfc5a('0x22')](_0xfc5a('0x19'),auth[_0xfc5a('0x8')](),controller[_0xfc5a('0x3b')]);router[_0xfc5a('0x22')]('/:id/proactive_actions',auth[_0xfc5a('0x8')](),controller[_0xfc5a('0x3c')]);router[_0xfc5a('0x22')]('/:id/users',auth[_0xfc5a('0x8')](),controller[_0xfc5a('0x3d')]);router[_0xfc5a('0x3e')]('/:id',auth['isAuthenticated'](),controller[_0xfc5a('0x3f')]);router[_0xfc5a('0x40')](_0xfc5a('0xc'),auth[_0xfc5a('0x8')](),controller['destroy']);router[_0xfc5a('0x40')]('/:id/dispositions',auth[_0xfc5a('0x8')](),controller[_0xfc5a('0x41')]);router['delete'](_0xfc5a('0xf'),auth[_0xfc5a('0x8')](),controller['removeAnswers']);router[_0xfc5a('0x40')](_0xfc5a('0x20'),auth[_0xfc5a('0x8')](),controller[_0xfc5a('0x42')]);module[_0xfc5a('0x43')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 204ebe5..62eab93 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 _0x9ec1=['client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','express','../components/auth/service','../config/environment','Router','env','production','app','get'];(function(_0x501b95,_0x1e7d66){var _0x118ba2=function(_0x37e09b){while(--_0x37e09b){_0x501b95['push'](_0x501b95['shift']());}};_0x118ba2(++_0x1e7d66);}(_0x9ec1,0x13a));var _0x19ec=function(_0x499001,_0x3f27ae){_0x499001=_0x499001-0x0;var _0x320c65=_0x9ec1[_0x499001];return _0x320c65;};var beaverLogger=require('beaver-logger/server');var express=require(_0x19ec('0x0'));var auth=require(_0x19ec('0x1'));var config=require(_0x19ec('0x2'));var router=express[_0x19ec('0x3')]();var isProduction=config[_0x19ec('0x4')]===_0x19ec('0x5')||![];function clientSideLogs(_0x2a3dc9,_0x202ac2,_0x33d4af){var _0x3eb98a=_0x2a3dc9[_0x19ec('0x6')][_0x19ec('0x7')](_0x19ec('0x8'));if(!_0x3eb98a){throw new Error(_0x19ec('0x9'));}return beaverLogger[_0x19ec('0xa')]({'uri':_0x19ec('0xb'),'logger':_0x3eb98a,'enableCors':!isProduction})(_0x2a3dc9,_0x202ac2,_0x33d4af);}router[_0x19ec('0xc')](auth[_0x19ec('0xd')](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0x1423=['app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server','Router','env','production'];(function(_0x1cea79,_0x3cddb9){var _0x30912f=function(_0x5aabd7){while(--_0x5aabd7){_0x1cea79['push'](_0x1cea79['shift']());}};_0x30912f(++_0x3cddb9);}(_0x1423,0x1c3));var _0x3142=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1423[_0x2641f9];return _0x585741;};var beaverLogger=require(_0x3142('0x0'));var express=require('express');var auth=require('../components/auth/service');var config=require('../config/environment');var router=express[_0x3142('0x1')]();var isProduction=config[_0x3142('0x2')]===_0x3142('0x3')||![];function clientSideLogs(_0x254efc,_0x41dda5,_0x3dc93e){var _0x4515e7=_0x254efc[_0x3142('0x4')][_0x3142('0x5')](_0x3142('0x6'));if(!_0x4515e7){throw new Error(_0x3142('0x7'));}return beaverLogger[_0x3142('0x8')]({'uri':_0x3142('0x9'),'logger':_0x4515e7,'enableCors':!isProduction})(_0x254efc,_0x41dda5,_0x3dc93e);}router[_0x3142('0xa')](auth[_0x3142('0xb')](),clientSideLogs);module[_0x3142('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 12f8919..2f13b2e 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 _0x7715=['MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_id'];(function(_0x3abab3,_0x4aaebb){var _0x44a5c8=function(_0x25c9b9){while(--_0x25c9b9){_0x3abab3['push'](_0x3abab3['shift']());}};_0x44a5c8(++_0x4aaebb);}(_0x7715,0x17d));var _0x5771=function(_0x1bfbe7,_0x34e702){_0x1bfbe7=_0x1bfbe7-0x0;var _0x452f2c=_0x7715[_0x1bfbe7];return _0x452f2c;};'use strict';var Sequelize=require(_0x5771('0x0'));module[_0x5771('0x1')]={'name':{'type':Sequelize[_0x5771('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x5771('0x3')](_0x5771('0x4'),_0x5771('0x5'),_0x5771('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x5771('0x3')](_0x5771('0x7'),'Dynamics365')},'data1':{'type':Sequelize[_0x5771('0x2')],'comment':_0x5771('0x8')},'data2':{'type':Sequelize[_0x5771('0x2')],'comment':_0x5771('0x9')},'data3':{'type':Sequelize['STRING'],'comment':_0x5771('0xa')},'data4':{'type':Sequelize[_0x5771('0x2')],'comment':_0x5771('0xb')},'data5':{'type':Sequelize[_0x5771('0xc')],'comment':_0x5771('0xd')},'data6':{'type':Sequelize[_0x5771('0xc')],'comment':_0x5771('0xe')},'data7':{'type':Sequelize[_0x5771('0xc')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x980e=['STRING','ENUM','Google','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0xed41b,_0x523eb0){var _0x3bec24=function(_0x2facd7){while(--_0x2facd7){_0xed41b['push'](_0xed41b['shift']());}};_0x3bec24(++_0x523eb0);}(_0x980e,0xa8));var _0xe980=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x980e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe980('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe980('0x1')]('AmazonAWS',_0xe980('0x2'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xe980('0x1')](_0xe980('0x3'),_0xe980('0x4'))},'data1':{'type':Sequelize[_0xe980('0x0')],'comment':_0xe980('0x5')},'data2':{'type':Sequelize['STRING'],'comment':_0xe980('0x6')},'data3':{'type':Sequelize['STRING'],'comment':_0xe980('0x7')},'data4':{'type':Sequelize[_0xe980('0x0')],'comment':_0xe980('0x8')},'data5':{'type':Sequelize[_0xe980('0x9')],'comment':_0xe980('0xa')},'data6':{'type':Sequelize[_0xe980('0x9')],'comment':_0xe980('0xb')},'data7':{'type':Sequelize[_0xe980('0x9')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 59cb67c..e882236 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 _0x063e=['stringify','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','api','./cloudProvider.oauth','defaults','redis','localhost','socket.io-emitter','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy','sendStatus','error','name','padEnd','slice','index','map','CloudProvider','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','sort','pick','filter','where','merge','count','includeAll','include','findAll','rows','MicrosoftAzure','decryptString','catch','show','params','keys','options','find','data3','body','service','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','del','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x063e,0x1d7));var _0xe063=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x063e[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var Redis=require(_0xe063('0x0'));var qs=require(_0xe063('0x1'));var encryptor=require('../../components/encryptor');var config=require(_0xe063('0x2'));var logger=require(_0xe063('0x3'))(_0xe063('0x4'));var db=require('../../mysqldb')['db'];var oauth=require(_0xe063('0x5'));config['redis']=_[_0xe063('0x6')](config[_0xe063('0x7')],{'host':_0xe063('0x8'),'port':0x18eb});var socket=require(_0xe063('0x9'))(new Redis(config[_0xe063('0x7')]));var redis=new Redis(config[_0xe063('0x7')]);function respondWithStatusCode(_0x1945aa,_0x4bb9ea){_0x4bb9ea=_0x4bb9ea||0xcc;return function(_0x2bcb2d){if(_0x2bcb2d){return _0x1945aa['sendStatus'](_0x4bb9ea);}return _0x1945aa[_0xe063('0xa')](_0x4bb9ea)[_0xe063('0xb')]();};}function respondWithResult(_0xcebb22,_0x52fd91){_0x52fd91=_0x52fd91||0xc8;return function(_0x2bdb02){if(_0x2bdb02){return _0xcebb22[_0xe063('0xa')](_0x52fd91)[_0xe063('0xc')](_0x2bdb02);}};}function respondWithFilteredResult(_0x25d6aa,_0x13ba06){return function(_0x49a2c7){if(_0x49a2c7){var _0x5d17cd=typeof _0x13ba06[_0xe063('0xd')]===_0xe063('0xe')&&typeof _0x13ba06[_0xe063('0xf')]==='undefined';var _0x436186=_0x49a2c7['count'];var _0x55222f=_0x5d17cd?0x0:_0x13ba06['offset'];var _0x5158bc=_0x5d17cd?_0x49a2c7['count']:_0x13ba06[_0xe063('0xd')]+_0x13ba06[_0xe063('0xf')];var _0x52d870;if(_0x5158bc>=_0x436186){_0x5158bc=_0x436186;_0x52d870=0xc8;}else{_0x52d870=0xce;}_0x25d6aa[_0xe063('0xa')](_0x52d870);return _0x25d6aa[_0xe063('0x10')](_0xe063('0x11'),_0x55222f+'-'+_0x5158bc+'/'+_0x436186)[_0xe063('0xc')](_0x49a2c7);}return null;};}function saveUpdates(_0x34961d){return function(_0x24812b){if(_0x24812b){return _0x24812b[_0xe063('0x12')](_0x34961d)[_0xe063('0x13')](function(_0x4e263d){return _0x4e263d;});}return null;};}function removeEntity(_0x19b0db){return function(_0x4c0d64){if(_0x4c0d64){return _0x4c0d64[_0xe063('0x14')]()[_0xe063('0x13')](function(){_0x19b0db[_0xe063('0xa')](0xcc)[_0xe063('0xb')]();});}};}function handleEntityNotFound(_0x217c68){return function(_0x54e442){if(!_0x54e442){_0x217c68[_0xe063('0x15')](0x194);}return _0x54e442;};}function handleError(_0x5c92f1,_0x4aaa19){_0x4aaa19=_0x4aaa19||0x1f4;return function(_0x55277b){logger[_0xe063('0x16')](_0x55277b['stack']);if(_0x55277b[_0xe063('0x17')]){delete _0x55277b[_0xe063('0x17')];}_0x5c92f1[_0xe063('0xa')](_0x4aaa19)['send'](_0x55277b);};}function maskClientSecret(_0x321a4a){return _[_0xe063('0x18')](_0x321a4a[_0xe063('0x19')](0x0,0x3),0x14,'*');}exports[_0xe063('0x1a')]=function(_0x52e8eb,_0xb0f3db){var _0x281544={},_0x1b22d3={},_0x4b4af5={'count':0x0,'rows':[]};var _0x1fe66c=_[_0xe063('0x1b')](db[_0xe063('0x1c')][_0xe063('0x1d')],function(_0x1244c6){return{'name':_0x1244c6['fieldName'],'type':_0x1244c6[_0xe063('0x1e')][_0xe063('0x1f')]};});_0x1b22d3[_0xe063('0x20')]=_['map'](_0x1fe66c,_0xe063('0x17'));_0x1b22d3[_0xe063('0x21')]=_['keys'](_0x52e8eb[_0xe063('0x21')]);_0x1b22d3[_0xe063('0x22')]=_[_0xe063('0x23')](_0x1b22d3[_0xe063('0x20')],_0x1b22d3[_0xe063('0x21')]);_0x281544[_0xe063('0x24')]=_['intersection'](_0x1b22d3['model'],qs[_0xe063('0x25')](_0x52e8eb[_0xe063('0x21')][_0xe063('0x25')]));_0x281544[_0xe063('0x24')]=_0x281544[_0xe063('0x24')][_0xe063('0x26')]?_0x281544[_0xe063('0x24')]:_0x1b22d3[_0xe063('0x20')];if(!_0x52e8eb[_0xe063('0x21')]['hasOwnProperty']('nolimit')){_0x281544[_0xe063('0xf')]=qs[_0xe063('0xf')](_0x52e8eb[_0xe063('0x21')][_0xe063('0xf')]);_0x281544['offset']=qs[_0xe063('0xd')](_0x52e8eb['query']['offset']);}_0x281544['order']=qs[_0xe063('0x27')](_0x52e8eb[_0xe063('0x21')][_0xe063('0x27')]);_0x281544['where']=qs[_0xe063('0x22')](_[_0xe063('0x28')](_0x52e8eb[_0xe063('0x21')],_0x1b22d3[_0xe063('0x22')]),_0x1fe66c);if(_0x52e8eb[_0xe063('0x21')][_0xe063('0x29')]){_0x281544[_0xe063('0x2a')]=_[_0xe063('0x2b')](_0x281544[_0xe063('0x2a')],{'$or':_['map'](_0x1fe66c,function(_0x304240){if(_0x304240['type']!=='VIRTUAL'){var _0x57f5fe={};_0x57f5fe[_0x304240['name']]={'$like':'%'+_0x52e8eb[_0xe063('0x21')]['filter']+'%'};return _0x57f5fe;}})});}_0x281544=_[_0xe063('0x2b')]({},_0x281544,_0x52e8eb['options']);var _0x3bb56b={'where':_0x281544[_0xe063('0x2a')]};return db['CloudProvider']['count'](_0x3bb56b)[_0xe063('0x13')](function(_0x3f05f5){_0x4b4af5[_0xe063('0x2c')]=_0x3f05f5;if(_0x52e8eb[_0xe063('0x21')][_0xe063('0x2d')]){_0x281544[_0xe063('0x2e')]=[{'all':!![]}];}return db[_0xe063('0x1c')][_0xe063('0x2f')](_0x281544);})[_0xe063('0x13')](function(_0x515f0f){_0x4b4af5[_0xe063('0x30')]=_[_0xe063('0x1b')](_0x515f0f,function(_0x1280f7){if(_0x1280f7['service']===_0xe063('0x31')){var _0x2c439b=encryptor[_0xe063('0x32')](_0x1280f7['data3']);_0x1280f7['data3']=maskClientSecret(_0x2c439b);}return _0x1280f7;});return _0x4b4af5;})[_0xe063('0x13')](respondWithFilteredResult(_0xb0f3db,_0x281544))[_0xe063('0x33')](handleError(_0xb0f3db,null));};exports[_0xe063('0x34')]=function(_0x4e7603,_0x2c0843){var _0x3bddcc={'raw':!![],'where':{'id':_0x4e7603[_0xe063('0x35')]['id']}},_0x2a44b7={};_0x2a44b7[_0xe063('0x20')]=_[_0xe063('0x36')](db[_0xe063('0x1c')]['rawAttributes']);_0x2a44b7[_0xe063('0x21')]=_[_0xe063('0x36')](_0x4e7603[_0xe063('0x21')]);_0x2a44b7[_0xe063('0x22')]=_[_0xe063('0x23')](_0x2a44b7[_0xe063('0x20')],_0x2a44b7[_0xe063('0x21')]);_0x3bddcc['attributes']=_[_0xe063('0x23')](_0x2a44b7['model'],qs['fields'](_0x4e7603[_0xe063('0x21')]['fields']));_0x3bddcc['attributes']=_0x3bddcc[_0xe063('0x24')][_0xe063('0x26')]?_0x3bddcc['attributes']:_0x2a44b7[_0xe063('0x20')];if(_0x4e7603['query']['includeAll']){_0x3bddcc[_0xe063('0x2e')]=[{'all':!![]}];}_0x3bddcc=_[_0xe063('0x2b')]({},_0x3bddcc,_0x4e7603[_0xe063('0x37')]);return db['CloudProvider'][_0xe063('0x38')](_0x3bddcc)[_0xe063('0x13')](handleEntityNotFound(_0x2c0843,null))['then'](function(_0x5e0bca){if(_0x5e0bca['service']==='MicrosoftAzure'){var _0x3045f0=encryptor[_0xe063('0x32')](_0x5e0bca[_0xe063('0x39')]);_0x5e0bca[_0xe063('0x39')]=maskClientSecret(_0x3045f0);}return _0x5e0bca;})[_0xe063('0x13')](respondWithResult(_0x2c0843,null))[_0xe063('0x33')](handleError(_0x2c0843,null));};exports['create']=function(_0x4876eb,_0xf1ff70){if(!_0x4876eb[_0xe063('0x3a')][_0xe063('0x17')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x4876eb[_0xe063('0x3a')][_0xe063('0x3b')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x41622d=db[_0xe063('0x1c')][_0xe063('0x1d')]['service'][_0xe063('0x3c')];if(!_0x41622d[_0xe063('0x3d')](_0x4876eb[_0xe063('0x3a')][_0xe063('0x3b')]))throw new Error(_0xe063('0x3e')+_0x41622d[_0xe063('0x3f')](',\x20'));if(_0x4876eb[_0xe063('0x3a')]['service']==='MicrosoftAzure'&&_0x4876eb['body'][_0xe063('0x39')]){_0x4876eb['body'][_0xe063('0x39')]=encryptor[_0xe063('0x40')](_0x4876eb['body'][_0xe063('0x39')]);}return db[_0xe063('0x1c')][_0xe063('0x41')](_0x4876eb[_0xe063('0x3a')],{})[_0xe063('0x13')](respondWithResult(_0xf1ff70,0xc9))[_0xe063('0x33')](handleError(_0xf1ff70,null));};exports[_0xe063('0x12')]=function(_0x403a7b,_0x5b0e15){if(_0x403a7b[_0xe063('0x3a')]['id']){delete _0x403a7b[_0xe063('0x3a')]['id'];}return db[_0xe063('0x1c')][_0xe063('0x38')]({'where':{'id':_0x403a7b[_0xe063('0x35')]['id']}})['then'](handleEntityNotFound(_0x5b0e15,null))[_0xe063('0x13')](function(_0x463d32){if(_0x463d32[_0xe063('0x3b')]==='MicrosoftAzure'&&_0x403a7b['body']['data3']){_0x403a7b[_0xe063('0x3a')][_0xe063('0x39')]=encryptor[_0xe063('0x40')](_0x403a7b[_0xe063('0x3a')]['data3']);}return _0x463d32;})[_0xe063('0x13')](saveUpdates(_0x403a7b[_0xe063('0x3a')],null))['then'](respondWithResult(_0x5b0e15,null))[_0xe063('0x33')](handleError(_0x5b0e15,null));};exports[_0xe063('0x14')]=function(_0x27da11,_0x2f9d9e){return db[_0xe063('0x1c')][_0xe063('0x38')]({'where':{'id':_0x27da11[_0xe063('0x35')]['id']}})['then'](handleEntityNotFound(_0x2f9d9e,null))[_0xe063('0x13')](removeEntity(_0x2f9d9e,null))[_0xe063('0x33')](handleError(_0x2f9d9e,null));};exports[_0xe063('0x42')]=function(_0x2b6edd,_0x231595){return db[_0xe063('0x1c')][_0xe063('0x43')]({'where':{'id':_0x2b6edd[_0xe063('0x35')]['id']},'raw':!![]})[_0xe063('0x13')](function(_0x487e14){if(!_0x487e14)return _0x231595[_0xe063('0x15')](0x194);return{'url':oauth[_0xe063('0x44')](_0x487e14,_0x2b6edd[_0xe063('0x45')]['id'])};})[_0xe063('0x13')](respondWithResult(_0x231595,null))[_0xe063('0x33')](handleError(_0x231595,null));};exports[_0xe063('0x46')]=function(_0x296bdb,_0x1843b8){var _0x462489=_0x296bdb[_0xe063('0x3a')];var _0x1153e1;var _0x266501;if(_0x462489[_0xe063('0x16')])throw _0x462489;redis[_0xe063('0x47')](_0x462489[_0xe063('0x48')])[_0xe063('0x13')](function(_0x5efd0c){if(!_0x5efd0c)throw new Error(_0xe063('0x49'));_0x1153e1=JSON[_0xe063('0x4a')](_0x5efd0c);var _0x195293=Buffer[_0xe063('0x4b')](_0x462489['state'],_0xe063('0x4c'))[_0xe063('0x4d')](_0xe063('0x4e'));_0x266501=JSON['parse'](_0x195293);if(!oauth[_0xe063('0x4f')](_0x462489[_0xe063('0x50')],_0x1153e1[_0xe063('0x51')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xe063('0x52')](_0x462489[_0xe063('0x48')]);return oauth['getOauth2MicrosoftAccessToken'](_0x462489[_0xe063('0x53')],_0x1153e1);})['then'](function(_0x4267c6){_0x1153e1[_0xe063('0x54')]=_0x4267c6['access_token'];_0x1153e1[_0xe063('0x55')]=_0x4267c6[_0xe063('0x56')];return db[_0xe063('0x1c')][_0xe063('0x12')]({'data5':_0x1153e1[_0xe063('0x54')],'data6':_0x1153e1['data6']},{'where':{'id':_0x1153e1['id']}});})[_0xe063('0x13')](function(){oauth[_0xe063('0x57')](_0x1153e1);socket[_0xe063('0x58')](_0xe063('0x59'),{'id':_0x266501['id']});return;})[_0xe063('0x13')](respondWithStatusCode(_0x1843b8,null))['catch'](function(_0x38b02d){if(_0x266501){socket['emit'](_0xe063('0x5a'),{'id':_0x266501['id']});}if(!_0x1153e1){logger[_0xe063('0x16')](_0xe063('0x5b'),_0x38b02d);return _0x1843b8[_0xe063('0xa')](0x1f4)[_0xe063('0x5c')](_0x38b02d['message']);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x1153e1['id'],JSON[_0xe063('0x5d')](_0x38b02d));});}; \ No newline at end of file +var _0x3203=['order','sort','filter','where','merge','options','includeAll','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','params','find','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','update','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','get','state','Invalid\x20state\x20parameter','base64','toString','ascii','parse','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../config/environment','api','./cloudProvider.oauth','defaults','redis','localhost','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','sendStatus','error','stack','name','send','padEnd','slice','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x1268f4,_0x147117){var _0x2f1b05=function(_0x4d634d){while(--_0x4d634d){_0x1268f4['push'](_0x1268f4['shift']());}};_0x2f1b05(++_0x147117);}(_0x3203,0x1ed));var _0x3320=function(_0x205e5a,_0x5c19fb){_0x205e5a=_0x205e5a-0x0;var _0x10da58=_0x3203[_0x205e5a];return _0x10da58;};'use strict';var _=require(_0x3320('0x0'));var Redis=require(_0x3320('0x1'));var qs=require(_0x3320('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0x3320('0x3'));var logger=require('../../config/logger')(_0x3320('0x4'));var db=require('../../mysqldb')['db'];var oauth=require(_0x3320('0x5'));config['redis']=_[_0x3320('0x6')](config[_0x3320('0x7')],{'host':_0x3320('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3320('0x7')]));var redis=new Redis(config[_0x3320('0x7')]);function respondWithStatusCode(_0x4912cb,_0x538a78){_0x538a78=_0x538a78||0xcc;return function(_0x3e3121){if(_0x3e3121){return _0x4912cb['sendStatus'](_0x538a78);}return _0x4912cb[_0x3320('0x9')](_0x538a78)['end']();};}function respondWithResult(_0xeec36a,_0x39f1d6){_0x39f1d6=_0x39f1d6||0xc8;return function(_0x1183f3){if(_0x1183f3){return _0xeec36a['status'](_0x39f1d6)[_0x3320('0xa')](_0x1183f3);}};}function respondWithFilteredResult(_0x4ddd87,_0x1c0b3c){return function(_0x3d99bb){if(_0x3d99bb){var _0x563f34=typeof _0x1c0b3c[_0x3320('0xb')]===_0x3320('0xc')&&typeof _0x1c0b3c[_0x3320('0xd')]===_0x3320('0xc');var _0x2c9cff=_0x3d99bb[_0x3320('0xe')];var _0x269f06=_0x563f34?0x0:_0x1c0b3c['offset'];var _0x358c3b=_0x563f34?_0x3d99bb['count']:_0x1c0b3c[_0x3320('0xb')]+_0x1c0b3c[_0x3320('0xd')];var _0x5ac63d;if(_0x358c3b>=_0x2c9cff){_0x358c3b=_0x2c9cff;_0x5ac63d=0xc8;}else{_0x5ac63d=0xce;}_0x4ddd87[_0x3320('0x9')](_0x5ac63d);return _0x4ddd87[_0x3320('0xf')](_0x3320('0x10'),_0x269f06+'-'+_0x358c3b+'/'+_0x2c9cff)['json'](_0x3d99bb);}return null;};}function saveUpdates(_0x8b9fd4){return function(_0x3ca094){if(_0x3ca094){return _0x3ca094['update'](_0x8b9fd4)[_0x3320('0x11')](function(_0x20f330){return _0x20f330;});}return null;};}function removeEntity(_0x288493){return function(_0x10eea6){if(_0x10eea6){return _0x10eea6[_0x3320('0x12')]()[_0x3320('0x11')](function(){_0x288493[_0x3320('0x9')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c9d8e){return function(_0x3dad53){if(!_0x3dad53){_0x3c9d8e[_0x3320('0x13')](0x194);}return _0x3dad53;};}function handleError(_0x1d2d74,_0x4780bf){_0x4780bf=_0x4780bf||0x1f4;return function(_0x35699f){logger[_0x3320('0x14')](_0x35699f[_0x3320('0x15')]);if(_0x35699f[_0x3320('0x16')]){delete _0x35699f[_0x3320('0x16')];}_0x1d2d74['status'](_0x4780bf)[_0x3320('0x17')](_0x35699f);};}function maskClientSecret(_0x11eee7){return _[_0x3320('0x18')](_0x11eee7[_0x3320('0x19')](0x0,0x3),0x14,'*');}exports['index']=function(_0x11eb41,_0x5a9eef){var _0x1ca8ec={},_0x29e669={},_0x58bdb5={'count':0x0,'rows':[]};var _0x4b1b5d=_[_0x3320('0x1a')](db[_0x3320('0x1b')][_0x3320('0x1c')],function(_0x4a37c6){return{'name':_0x4a37c6[_0x3320('0x1d')],'type':_0x4a37c6[_0x3320('0x1e')][_0x3320('0x1f')]};});_0x29e669[_0x3320('0x20')]=_[_0x3320('0x1a')](_0x4b1b5d,_0x3320('0x16'));_0x29e669[_0x3320('0x21')]=_[_0x3320('0x22')](_0x11eb41[_0x3320('0x21')]);_0x29e669[_0x3320('0x23')]=_[_0x3320('0x24')](_0x29e669['model'],_0x29e669[_0x3320('0x21')]);_0x1ca8ec[_0x3320('0x25')]=_['intersection'](_0x29e669[_0x3320('0x20')],qs[_0x3320('0x26')](_0x11eb41[_0x3320('0x21')][_0x3320('0x26')]));_0x1ca8ec[_0x3320('0x25')]=_0x1ca8ec[_0x3320('0x25')][_0x3320('0x27')]?_0x1ca8ec[_0x3320('0x25')]:_0x29e669[_0x3320('0x20')];if(!_0x11eb41[_0x3320('0x21')][_0x3320('0x28')]('nolimit')){_0x1ca8ec[_0x3320('0xd')]=qs[_0x3320('0xd')](_0x11eb41[_0x3320('0x21')][_0x3320('0xd')]);_0x1ca8ec[_0x3320('0xb')]=qs[_0x3320('0xb')](_0x11eb41[_0x3320('0x21')][_0x3320('0xb')]);}_0x1ca8ec[_0x3320('0x29')]=qs['sort'](_0x11eb41[_0x3320('0x21')][_0x3320('0x2a')]);_0x1ca8ec['where']=qs[_0x3320('0x23')](_['pick'](_0x11eb41[_0x3320('0x21')],_0x29e669[_0x3320('0x23')]),_0x4b1b5d);if(_0x11eb41[_0x3320('0x21')][_0x3320('0x2b')]){_0x1ca8ec[_0x3320('0x2c')]=_[_0x3320('0x2d')](_0x1ca8ec[_0x3320('0x2c')],{'$or':_['map'](_0x4b1b5d,function(_0x2990bb){if(_0x2990bb[_0x3320('0x1e')]!=='VIRTUAL'){var _0x29b258={};_0x29b258[_0x2990bb[_0x3320('0x16')]]={'$like':'%'+_0x11eb41[_0x3320('0x21')][_0x3320('0x2b')]+'%'};return _0x29b258;}})});}_0x1ca8ec=_['merge']({},_0x1ca8ec,_0x11eb41[_0x3320('0x2e')]);var _0x2cad90={'where':_0x1ca8ec[_0x3320('0x2c')]};return db[_0x3320('0x1b')]['count'](_0x2cad90)[_0x3320('0x11')](function(_0x4222a4){_0x58bdb5['count']=_0x4222a4;if(_0x11eb41['query'][_0x3320('0x2f')]){_0x1ca8ec['include']=[{'all':!![]}];}return db['CloudProvider'][_0x3320('0x30')](_0x1ca8ec);})[_0x3320('0x11')](function(_0x1b7a2a){_0x58bdb5[_0x3320('0x31')]=_[_0x3320('0x1a')](_0x1b7a2a,function(_0x7a5f61){if(_0x7a5f61[_0x3320('0x32')]===_0x3320('0x33')){var _0x3d4037=encryptor[_0x3320('0x34')](_0x7a5f61['data3']);_0x7a5f61[_0x3320('0x35')]=maskClientSecret(_0x3d4037);}return _0x7a5f61;});return _0x58bdb5;})[_0x3320('0x11')](respondWithFilteredResult(_0x5a9eef,_0x1ca8ec))[_0x3320('0x36')](handleError(_0x5a9eef,null));};exports['show']=function(_0x9d3842,_0x18c50d){var _0x2da67c={'raw':!![],'where':{'id':_0x9d3842[_0x3320('0x37')]['id']}},_0x2d853c={};_0x2d853c[_0x3320('0x20')]=_[_0x3320('0x22')](db[_0x3320('0x1b')][_0x3320('0x1c')]);_0x2d853c[_0x3320('0x21')]=_[_0x3320('0x22')](_0x9d3842[_0x3320('0x21')]);_0x2d853c[_0x3320('0x23')]=_[_0x3320('0x24')](_0x2d853c[_0x3320('0x20')],_0x2d853c[_0x3320('0x21')]);_0x2da67c['attributes']=_['intersection'](_0x2d853c[_0x3320('0x20')],qs[_0x3320('0x26')](_0x9d3842[_0x3320('0x21')]['fields']));_0x2da67c[_0x3320('0x25')]=_0x2da67c[_0x3320('0x25')][_0x3320('0x27')]?_0x2da67c[_0x3320('0x25')]:_0x2d853c[_0x3320('0x20')];if(_0x9d3842[_0x3320('0x21')][_0x3320('0x2f')]){_0x2da67c['include']=[{'all':!![]}];}_0x2da67c=_[_0x3320('0x2d')]({},_0x2da67c,_0x9d3842[_0x3320('0x2e')]);return db['CloudProvider'][_0x3320('0x38')](_0x2da67c)[_0x3320('0x11')](handleEntityNotFound(_0x18c50d,null))[_0x3320('0x11')](function(_0x2ce9a1){if(_0x2ce9a1[_0x3320('0x32')]===_0x3320('0x33')){var _0xf2b8e9=encryptor['decryptString'](_0x2ce9a1[_0x3320('0x35')]);_0x2ce9a1[_0x3320('0x35')]=maskClientSecret(_0xf2b8e9);}return _0x2ce9a1;})[_0x3320('0x11')](respondWithResult(_0x18c50d,null))[_0x3320('0x36')](handleError(_0x18c50d,null));};exports['create']=function(_0x33ccad,_0x4adfc5){if(!_0x33ccad[_0x3320('0x39')][_0x3320('0x16')])throw new Error(_0x3320('0x3a'));if(!_0x33ccad['body']['service'])throw new Error(_0x3320('0x3b'));var _0x224e46=db['CloudProvider'][_0x3320('0x1c')][_0x3320('0x32')]['values'];if(!_0x224e46[_0x3320('0x3c')](_0x33ccad['body'][_0x3320('0x32')]))throw new Error(_0x3320('0x3d')+_0x224e46[_0x3320('0x3e')](',\x20'));if(_0x33ccad[_0x3320('0x39')][_0x3320('0x32')]==='MicrosoftAzure'&&_0x33ccad['body'][_0x3320('0x35')]){_0x33ccad[_0x3320('0x39')][_0x3320('0x35')]=encryptor[_0x3320('0x3f')](_0x33ccad[_0x3320('0x39')][_0x3320('0x35')]);}return db[_0x3320('0x1b')][_0x3320('0x40')](_0x33ccad[_0x3320('0x39')],{})[_0x3320('0x11')](respondWithResult(_0x4adfc5,0xc9))[_0x3320('0x36')](handleError(_0x4adfc5,null));};exports[_0x3320('0x41')]=function(_0x1fbf2d,_0x5359d2){if(_0x1fbf2d[_0x3320('0x39')]['id']){delete _0x1fbf2d[_0x3320('0x39')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x1fbf2d[_0x3320('0x37')]['id']}})['then'](handleEntityNotFound(_0x5359d2,null))['then'](function(_0x557527){if(_0x557527[_0x3320('0x32')]===_0x3320('0x33')&&_0x1fbf2d['body'][_0x3320('0x35')]){_0x1fbf2d[_0x3320('0x39')]['data3']=encryptor[_0x3320('0x3f')](_0x1fbf2d[_0x3320('0x39')]['data3']);}return _0x557527;})[_0x3320('0x11')](saveUpdates(_0x1fbf2d[_0x3320('0x39')],null))[_0x3320('0x11')](respondWithResult(_0x5359d2,null))[_0x3320('0x36')](handleError(_0x5359d2,null));};exports[_0x3320('0x12')]=function(_0xe31a6b,_0x2c33e1){return db[_0x3320('0x1b')][_0x3320('0x38')]({'where':{'id':_0xe31a6b[_0x3320('0x37')]['id']}})[_0x3320('0x11')](handleEntityNotFound(_0x2c33e1,null))[_0x3320('0x11')](removeEntity(_0x2c33e1,null))[_0x3320('0x36')](handleError(_0x2c33e1,null));};exports[_0x3320('0x42')]=function(_0x15f139,_0x1fd3cc){return db[_0x3320('0x1b')][_0x3320('0x43')]({'where':{'id':_0x15f139['params']['id']},'raw':!![]})['then'](function(_0x745204){if(!_0x745204)return _0x1fd3cc[_0x3320('0x13')](0x194);return{'url':oauth[_0x3320('0x44')](_0x745204,_0x15f139[_0x3320('0x45')]['id'])};})['then'](respondWithResult(_0x1fd3cc,null))[_0x3320('0x36')](handleError(_0x1fd3cc,null));};exports['oauth2MicrosoftCallback']=function(_0x1d8512,_0x28e896){var _0x3b2f22=_0x1d8512[_0x3320('0x39')];var _0x41c915;var _0x511b13;if(_0x3b2f22[_0x3320('0x14')])throw _0x3b2f22;redis[_0x3320('0x46')](_0x3b2f22[_0x3320('0x47')])[_0x3320('0x11')](function(_0x13f32b){if(!_0x13f32b)throw new Error(_0x3320('0x48'));_0x41c915=JSON['parse'](_0x13f32b);var _0x492c5b=Buffer['from'](_0x3b2f22[_0x3320('0x47')],_0x3320('0x49'))[_0x3320('0x4a')](_0x3320('0x4b'));_0x511b13=JSON[_0x3320('0x4c')](_0x492c5b);if(!oauth['isValidIdToken'](_0x3b2f22['id_token'],_0x41c915[_0x3320('0x4d')]))throw new Error(_0x3320('0x4e'));redis[_0x3320('0x4f')](_0x3b2f22[_0x3320('0x47')]);return oauth[_0x3320('0x50')](_0x3b2f22['code'],_0x41c915);})[_0x3320('0x11')](function(_0x1dd33f){_0x41c915['data5']=_0x1dd33f['access_token'];_0x41c915[_0x3320('0x51')]=_0x1dd33f['refresh_token'];return db[_0x3320('0x1b')]['update']({'data5':_0x41c915['data5'],'data6':_0x41c915['data6']},{'where':{'id':_0x41c915['id']}});})[_0x3320('0x11')](function(){oauth[_0x3320('0x52')](_0x41c915);socket[_0x3320('0x53')](_0x3320('0x54'),{'id':_0x511b13['id']});return;})['then'](respondWithStatusCode(_0x28e896,null))[_0x3320('0x36')](function(_0x102a1d){if(_0x511b13){socket[_0x3320('0x53')](_0x3320('0x55'),{'id':_0x511b13['id']});}if(!_0x41c915){logger[_0x3320('0x14')]('Invalid\x20authentication\x20state\x20parameter',_0x102a1d);return _0x28e896[_0x3320('0x9')](0x1f4)[_0x3320('0x17')](_0x102a1d[_0x3320('0x56')]);}logger['error'](_0x3320('0x57'),_0x41c915['id'],JSON[_0x3320('0x58')](_0x102a1d));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index d7f6046..52b2a13 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 _0xc6bd=['../../config/logger','api','moment','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','lodash','util'];(function(_0x21e563,_0xadbdca){var _0x5e6b46=function(_0x302b50){while(--_0x302b50){_0x21e563['push'](_0x21e563['shift']());}};_0x5e6b46(++_0xadbdca);}(_0xc6bd,0x148));var _0xdc6b=function(_0x109c6c,_0x3e27b2){_0x109c6c=_0x109c6c-0x0;var _0x3e150e=_0xc6bd[_0x109c6c];return _0x3e150e;};'use strict';var _=require(_0xdc6b('0x0'));var util=require(_0xdc6b('0x1'));var logger=require(_0xdc6b('0x2'))(_0xdc6b('0x3'));var moment=require(_0xdc6b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdc6b('0x5'));var config=require(_0xdc6b('0x6'));var attributes=require(_0xdc6b('0x7'));module[_0xdc6b('0x8')]=function(_0x3d3d26,_0x599274){return _0x3d3d26[_0xdc6b('0x9')]('CloudProvider',attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5563=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes','exports'];(function(_0x5b6d36,_0x2e4327){var _0x311e9e=function(_0x44eca0){while(--_0x44eca0){_0x5b6d36['push'](_0x5b6d36['shift']());}};_0x311e9e(++_0x2e4327);}(_0x5563,0x10e));var _0x3556=function(_0x7f7619,_0x20e2fc){_0x7f7619=_0x7f7619-0x0;var _0x79d00c=_0x5563[_0x7f7619];return _0x79d00c;};'use strict';var _=require(_0x3556('0x0'));var util=require(_0x3556('0x1'));var logger=require(_0x3556('0x2'))(_0x3556('0x3'));var moment=require('moment');var BPromise=require(_0x3556('0x4'));var rp=require(_0x3556('0x5'));var fs=require('fs');var path=require(_0x3556('0x6'));var rimraf=require('rimraf');var config=require(_0x3556('0x7'));var attributes=require(_0x3556('0x8'));module[_0x3556('0x9')]=function(_0x1c88c1,_0x2b6ec5){return _0x1c88c1['define']('CloudProvider',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 ac4c53e..f418b08 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 _0xd9b9=['[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','offline_access','/authorize','map','type','Dynamics365','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','code','id_token','base64','randomBytes','toString','hex','client_id','response_type','redirect_uri','response_mode','form_post','state','key','value','oauth2/','data1','set','stringify','decode','payload','iss','issuer','aud','audience','nonce','isAfter','unix','data3','CloudProvider','then','refresh_token','data6','data4','decryptString','data5','access_token','update','catch','error','POST','intervals','all','inspect'];(function(_0x426892,_0x42aaeb){var _0x1d7fd4=function(_0x5a78f5){while(--_0x5a78f5){_0x426892['push'](_0x426892['shift']());}};_0x1d7fd4(++_0x42aaeb);}(_0xd9b9,0xe3));var _0x9d9b=function(_0x47916a,_0x1b403b){_0x47916a=_0x47916a-0x0;var _0x321a13=_0xd9b9[_0x47916a];return _0x321a13;};'use strict';var _=require('lodash');var crypto=require(_0x9d9b('0x0'));var jwt=require(_0x9d9b('0x1'));var moment=require(_0x9d9b('0x2'));var Redis=require('ioredis');var rp=require(_0x9d9b('0x3'));var util=require(_0x9d9b('0x4'));var encryptor=require(_0x9d9b('0x5'));var config=require(_0x9d9b('0x6'));var logger=require('../../config/logger')(_0x9d9b('0x7'));var schedule=require(_0x9d9b('0x8'));var db=require(_0x9d9b('0x9'))['db'];config[_0x9d9b('0xa')]=_[_0x9d9b('0xb')](config['redis'],{'host':_0x9d9b('0xc'),'port':0x18eb});var redis=new Redis(config[_0x9d9b('0xa')]);var MICROSOFT_AUTH_URL=_0x9d9b('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x9d9b('0xe'),_0x9d9b('0xf'),_0x9d9b('0x10'),'offline_access',_0x9d9b('0x11'),'https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x9d9b('0xe'),_0x9d9b('0x12')]};var MICROSOFT_AUTH_ENDPOINT=_0x9d9b('0x13');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5c31e6){var _0x48b3b7=_[_0x9d9b('0x14')](AZURE_AUTH_SCOPES[_0x5c31e6[_0x9d9b('0x15')]]);if(_0x5c31e6[_0x9d9b('0x15')]===_0x9d9b('0x16'))_0x48b3b7['push'](_0x5c31e6[_0x9d9b('0x17')]+_0x9d9b('0x18'));return _0x48b3b7[_0x9d9b('0x19')]('\x20');}function getAccessTokenScope(_0x157213){if(_0x157213[_0x9d9b('0x15')]===_0x9d9b('0x1a'))return _0x9d9b('0x11');if(_0x157213[_0x9d9b('0x15')]===_0x9d9b('0x16'))return _0x157213[_0x9d9b('0x17')]+_0x9d9b('0x18');}function generateMicrosoftAuthorizationUrl(_0x19ba81,_0x5404a7){var _0x4a786c=MICROSOFT_AUTH_URL[_0x9d9b('0x1b')](_0x9d9b('0x1c'),_0x19ba81[_0x9d9b('0x1d')]);var _0xc7ed2e=[_0x9d9b('0x1e'),_0x9d9b('0x1f')];var _0x42081a=Buffer['from'](JSON['stringify']({'id':_0x5404a7}))['toString'](_0x9d9b('0x20'));var _0x238d9c=crypto[_0x9d9b('0x21')](0x10)[_0x9d9b('0x22')](_0x9d9b('0x23'));var _0x265962=getAuthorizationScopes(_0x19ba81);var _0x5d8fc8=[{'key':_0x9d9b('0x24'),'value':_0x19ba81['data1']},{'key':_0x9d9b('0x25'),'value':encodeURIComponent(_0xc7ed2e[_0x9d9b('0x19')]('\x20'))},{'key':_0x9d9b('0x26'),'value':_0x19ba81['data4']},{'key':_0x9d9b('0x27'),'value':_0x9d9b('0x28')},{'key':'scope','value':encodeURIComponent(_0x265962)},{'key':_0x9d9b('0x29'),'value':_0x42081a},{'key':'nonce','value':_0x238d9c},{'key':'prompt','value':'login'}];var _0xf738f6=_0x4a786c+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x5d8fc8,function(_0x2dc612){return _0x2dc612[_0x9d9b('0x2a')]+'='+_0x2dc612[_0x9d9b('0x2b')];})[_0x9d9b('0x19')]('&');_0x19ba81['oauth2Claims']={'issuer':_0x4a786c['replace'](_0x9d9b('0x2c'),''),'audience':_0x19ba81[_0x9d9b('0x2d')],'state':_0x42081a,'nonce':_0x238d9c};redis[_0x9d9b('0x2e')](_0x42081a,JSON[_0x9d9b('0x2f')](_0x19ba81));return _0xf738f6;}function isValidIdToken(_0x124cce,_0x1f0648){try{var _0x5cba8c=jwt[_0x9d9b('0x30')](_0x124cce,{'complete':!![]});var _0x3738e4=_0x5cba8c[_0x9d9b('0x31')];if(_0x3738e4[_0x9d9b('0x32')]!==_0x1f0648[_0x9d9b('0x33')])return![];if(_0x3738e4[_0x9d9b('0x34')]!==_0x1f0648[_0x9d9b('0x35')])return![];if(_0x3738e4['nonce']!==_0x1f0648[_0x9d9b('0x36')])return![];if(moment()[_0x9d9b('0x37')](moment[_0x9d9b('0x38')](_0x3738e4['exp'])))return![];return!![];}catch(_0x431f71){throw _0x431f71;}}function refreshOauth2MicrosoftAccessToken(_0x597694){return Promise['resolve']()['then'](function(){if(_0x597694[_0x9d9b('0x39')])return _0x597694;return db[_0x9d9b('0x3a')]['findOne']({'where':{'id':_0x597694['id']},'raw':!![]});})[_0x9d9b('0x3b')](function(_0x10203d){var _0x309bf6={'grant_type':_0x9d9b('0x3c'),'refresh_token':_0x10203d[_0x9d9b('0x3d')],'scope':getAccessTokenScope(_0x10203d),'redirect_uri':_0x10203d[_0x9d9b('0x3e')],'client_id':_0x10203d['data1'],'client_secret':encryptor[_0x9d9b('0x3f')](_0x10203d['data3'])};var _0x5245dd={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0x9d9b('0x1c'),_0x10203d[_0x9d9b('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x309bf6,'json':!![]};return rp(_0x5245dd);})[_0x9d9b('0x3b')](function(_0x51366f){_0x597694[_0x9d9b('0x40')]=_0x51366f[_0x9d9b('0x41')];_0x597694[_0x9d9b('0x3d')]=_0x51366f['refresh_token'];return db['CloudProvider'][_0x9d9b('0x42')]({'data5':_0x597694[_0x9d9b('0x40')],'data6':_0x597694['data6']},{'where':{'id':_0x597694['id']}});})['then'](function(){return _0x597694;})[_0x9d9b('0x43')](function(_0x4da12f){logger[_0x9d9b('0x44')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x597694['id'],_0x4da12f);});}function getOauth2MicrosoftAccessToken(_0x2d9169,_0x28b9f8){var _0x4f82bc={'grant_type':'authorization_code','code':_0x2d9169,'scope':getAccessTokenScope(_0x28b9f8),'redirect_uri':_0x28b9f8[_0x9d9b('0x3e')],'client_id':_0x28b9f8[_0x9d9b('0x2d')],'client_secret':encryptor[_0x9d9b('0x3f')](_0x28b9f8['data3'])};var _0x53316b={'method':_0x9d9b('0x45'),'uri':MICROSOFT_AUTH_URL[_0x9d9b('0x1b')](_0x9d9b('0x1c'),_0x28b9f8[_0x9d9b('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4f82bc,'json':!![]};return rp(_0x53316b);}function startRefreshInterval(_0x961d32){var _0x1563b4=schedule[_0x9d9b('0x46')];if(_0x1563b4[_0x961d32['id']])clearInterval(_0x1563b4[_0x961d32['id']]);_0x1563b4[_0x961d32['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x961d32['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x1563b4;}function startAllRefreshIntervals(){return db[_0x9d9b('0x3a')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x4fa0ae){var _0xdea203=_0x4fa0ae[_0x9d9b('0x14')](function(_0x1936d7){return refreshOauth2MicrosoftAccessToken(_0x1936d7)[_0x9d9b('0x3b')](function(_0x439b3a){startRefreshInterval(_0x439b3a);});});return Promise[_0x9d9b('0x47')](_0xdea203);})[_0x9d9b('0x43')](function(_0x530984){var _0xc48763=_0x530984?util[_0x9d9b('0x48')](_0x530984,{'showHidden':![],'depth':null}):'';logger['error'](_0x9d9b('0x49'),_0xc48763);});}module[_0x9d9b('0x4a')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x71b7=['resolve','data3','CloudProvider','findOne','refresh_token','POST','data2','data5','access_token','update','data6','then','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','bind','intervals','findAll','all','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','jsonwebtoken','ioredis','util','../../components/encryptor','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','map','type','Dynamics365','push','/.default','join','Outlook365','data7','{TENANT_ID}','code','id_token','from','stringify','toString','base64','randomBytes','hex','data1','response_type','redirect_uri','data4','response_mode','form_post','state','nonce','prompt','login','key','value','replace','oauth2/','set','iss','issuer','aud','audience','isAfter','unix','exp'];(function(_0x378e56,_0x3fd3c5){var _0x1aa133=function(_0x18725f){while(--_0x18725f){_0x378e56['push'](_0x378e56['shift']());}};_0x1aa133(++_0x3fd3c5);}(_0x71b7,0x67));var _0x771b=function(_0x1acc03,_0x1794d6){_0x1acc03=_0x1acc03-0x0;var _0x51bc63=_0x71b7[_0x1acc03];return _0x51bc63;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require(_0x771b('0x0'));var moment=require('moment');var Redis=require(_0x771b('0x1'));var rp=require('request-promise');var util=require(_0x771b('0x2'));var encryptor=require(_0x771b('0x3'));var config=require('../../config/environment');var logger=require(_0x771b('0x4'))(_0x771b('0x5'));var schedule=require(_0x771b('0x6'));var db=require(_0x771b('0x7'))['db'];config[_0x771b('0x8')]=_[_0x771b('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x771b('0x8')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x771b('0xa'),_0x771b('0xb'),_0x771b('0xc'),_0x771b('0xd'),_0x771b('0xe'),_0x771b('0xf'),_0x771b('0x10')],'Dynamics365':[_0x771b('0xa'),_0x771b('0xd')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x771b('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x22b008){var _0x2e69ff=_[_0x771b('0x12')](AZURE_AUTH_SCOPES[_0x22b008[_0x771b('0x13')]]);if(_0x22b008[_0x771b('0x13')]===_0x771b('0x14'))_0x2e69ff[_0x771b('0x15')](_0x22b008['data7']+_0x771b('0x16'));return _0x2e69ff[_0x771b('0x17')]('\x20');}function getAccessTokenScope(_0x3d149e){if(_0x3d149e['type']===_0x771b('0x18'))return _0x771b('0xe');if(_0x3d149e[_0x771b('0x13')]===_0x771b('0x14'))return _0x3d149e[_0x771b('0x19')]+_0x771b('0x16');}function generateMicrosoftAuthorizationUrl(_0x482bef,_0x529161){var _0x14803a=MICROSOFT_AUTH_URL['replace'](_0x771b('0x1a'),_0x482bef['data2']);var _0x3936a6=[_0x771b('0x1b'),_0x771b('0x1c')];var _0x5dce93=Buffer[_0x771b('0x1d')](JSON[_0x771b('0x1e')]({'id':_0x529161}))[_0x771b('0x1f')](_0x771b('0x20'));var _0x4bdaf7=crypto[_0x771b('0x21')](0x10)[_0x771b('0x1f')](_0x771b('0x22'));var _0x22a1a6=getAuthorizationScopes(_0x482bef);var _0xd9b7ef=[{'key':'client_id','value':_0x482bef[_0x771b('0x23')]},{'key':_0x771b('0x24'),'value':encodeURIComponent(_0x3936a6[_0x771b('0x17')]('\x20'))},{'key':_0x771b('0x25'),'value':_0x482bef[_0x771b('0x26')]},{'key':_0x771b('0x27'),'value':_0x771b('0x28')},{'key':'scope','value':encodeURIComponent(_0x22a1a6)},{'key':_0x771b('0x29'),'value':_0x5dce93},{'key':_0x771b('0x2a'),'value':_0x4bdaf7},{'key':_0x771b('0x2b'),'value':_0x771b('0x2c')}];var _0x2bb082=_0x14803a+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x771b('0x12')](_0xd9b7ef,function(_0x3e87){return _0x3e87[_0x771b('0x2d')]+'='+_0x3e87[_0x771b('0x2e')];})[_0x771b('0x17')]('&');_0x482bef['oauth2Claims']={'issuer':_0x14803a[_0x771b('0x2f')](_0x771b('0x30'),''),'audience':_0x482bef[_0x771b('0x23')],'state':_0x5dce93,'nonce':_0x4bdaf7};redis[_0x771b('0x31')](_0x5dce93,JSON[_0x771b('0x1e')](_0x482bef));return _0x2bb082;}function isValidIdToken(_0x3c724c,_0x3f79f6){try{var _0x3afc30=jwt['decode'](_0x3c724c,{'complete':!![]});var _0x146d37=_0x3afc30['payload'];if(_0x146d37[_0x771b('0x32')]!==_0x3f79f6[_0x771b('0x33')])return![];if(_0x146d37[_0x771b('0x34')]!==_0x3f79f6[_0x771b('0x35')])return![];if(_0x146d37[_0x771b('0x2a')]!==_0x3f79f6[_0x771b('0x2a')])return![];if(moment()[_0x771b('0x36')](moment[_0x771b('0x37')](_0x146d37[_0x771b('0x38')])))return![];return!![];}catch(_0x3a93f5){throw _0x3a93f5;}}function refreshOauth2MicrosoftAccessToken(_0x4e05f1){return Promise[_0x771b('0x39')]()['then'](function(){if(_0x4e05f1[_0x771b('0x3a')])return _0x4e05f1;return db[_0x771b('0x3b')][_0x771b('0x3c')]({'where':{'id':_0x4e05f1['id']},'raw':!![]});})['then'](function(_0x561c7c){var _0x4caf1d={'grant_type':_0x771b('0x3d'),'refresh_token':_0x561c7c['data6'],'scope':getAccessTokenScope(_0x561c7c),'redirect_uri':_0x561c7c[_0x771b('0x26')],'client_id':_0x561c7c['data1'],'client_secret':encryptor['decryptString'](_0x561c7c[_0x771b('0x3a')])};var _0x843fdf={'method':_0x771b('0x3e'),'uri':MICROSOFT_AUTH_URL[_0x771b('0x2f')]('{TENANT_ID}',_0x561c7c[_0x771b('0x3f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4caf1d,'json':!![]};return rp(_0x843fdf);})['then'](function(_0x15c780){_0x4e05f1[_0x771b('0x40')]=_0x15c780[_0x771b('0x41')];_0x4e05f1['data6']=_0x15c780['refresh_token'];return db['CloudProvider'][_0x771b('0x42')]({'data5':_0x4e05f1['data5'],'data6':_0x4e05f1[_0x771b('0x43')]},{'where':{'id':_0x4e05f1['id']}});})[_0x771b('0x44')](function(){return _0x4e05f1;})[_0x771b('0x45')](function(_0x4f48eb){logger['error'](_0x771b('0x46'),_0x4e05f1['id'],_0x4f48eb);});}function getOauth2MicrosoftAccessToken(_0x4f231a,_0x3e98e0){var _0x4c6341={'grant_type':_0x771b('0x47'),'code':_0x4f231a,'scope':getAccessTokenScope(_0x3e98e0),'redirect_uri':_0x3e98e0[_0x771b('0x26')],'client_id':_0x3e98e0[_0x771b('0x23')],'client_secret':encryptor['decryptString'](_0x3e98e0['data3'])};var _0x369a27={'method':_0x771b('0x3e'),'uri':MICROSOFT_AUTH_URL[_0x771b('0x2f')]('{TENANT_ID}',_0x3e98e0[_0x771b('0x3f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4c6341,'json':!![]};return rp(_0x369a27);}function startRefreshInterval(_0x5234ea){var _0x29bfa3=schedule['intervals'];if(_0x29bfa3[_0x5234ea['id']])clearInterval(_0x29bfa3[_0x5234ea['id']]);_0x29bfa3[_0x5234ea['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x771b('0x48')](this,{'id':_0x5234ea['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x771b('0x49')]=_0x29bfa3;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x771b('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x771b('0x44')](function(_0x58a60c){var _0x54fdcd=_0x58a60c[_0x771b('0x12')](function(_0x4fb574){return refreshOauth2MicrosoftAccessToken(_0x4fb574)['then'](function(_0x40ee25){startRefreshInterval(_0x40ee25);});});return Promise[_0x771b('0x4b')](_0x54fdcd);})[_0x771b('0x45')](function(_0x1a7ab3){var _0x30bf5c=_0x1a7ab3?util[_0x771b('0x4c')](_0x1a7ab3,{'showHidden':![],'depth':null}):'';logger[_0x771b('0x4d')](_0x771b('0x4e'),_0x30bf5c);});}module[_0x771b('0x4f')]={'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 f744c6b..f856ec6 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 _0x236c=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2f4943,_0x4d7077){var _0x300213=function(_0x8bf8f1){while(--_0x8bf8f1){_0x2f4943['push'](_0x2f4943['shift']());}};_0x300213(++_0x4d7077);}(_0x236c,0x155));var _0xc236=function(_0x9031b,_0x483db7){_0x9031b=_0x9031b-0x0;var _0xe13f19=_0x236c[_0x9031b];return _0xe13f19;};'use strict';var _=require(_0xc236('0x0'));var util=require('util');var moment=require(_0xc236('0x1'));var BPromise=require(_0xc236('0x2'));var rs=require(_0xc236('0x3'));var fs=require('fs');var Redis=require(_0xc236('0x4'));var db=require(_0xc236('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc236('0x6'))(_0xc236('0x7'));var config=require(_0xc236('0x8'));var jayson=require(_0xc236('0x9'));var client=jayson[_0xc236('0xa')][_0xc236('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5abd65,_0xd612c6,_0x4d349b){return new BPromise(function(_0x51a13b,_0x5bc6a2){return client['request'](_0x5abd65,_0x4d349b)[_0xc236('0xc')](function(_0x4b8dc6){logger[_0xc236('0xd')](_0xc236('0xe'),_0xd612c6,_0xc236('0xf'));logger[_0xc236('0x10')](_0xc236('0x11'),_0xd612c6,'request\x20sent',JSON[_0xc236('0x12')](_0x4b8dc6));if(_0x4b8dc6[_0xc236('0x13')]){if(_0x4b8dc6['error'][_0xc236('0x14')]===0x1f4){logger[_0xc236('0x13')]('CloudProvider,\x20%s,\x20%s',_0xd612c6,_0x4b8dc6[_0xc236('0x13')]['message']);return _0x5bc6a2(_0x4b8dc6['error'][_0xc236('0x15')]);}logger[_0xc236('0x13')](_0xc236('0xe'),_0xd612c6,_0x4b8dc6[_0xc236('0x13')]['message']);return _0x51a13b(_0x4b8dc6[_0xc236('0x13')]['message']);}else{logger['info'](_0xc236('0xe'),_0xd612c6,_0xc236('0xf'));_0x51a13b(_0x4b8dc6[_0xc236('0x16')][_0xc236('0x15')]);}})[_0xc236('0x17')](function(_0x5ac3ed){logger['error']('CloudProvider,\x20%s,\x20%s',_0xd612c6,_0x5ac3ed);_0x5bc6a2(_0x5ac3ed);});});} \ No newline at end of file +var _0x0c71=['bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','then','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util'];(function(_0x4989fe,_0x201e34){var _0x4afd24=function(_0x3bb870){while(--_0x3bb870){_0x4989fe['push'](_0x4989fe['shift']());}};_0x4afd24(++_0x201e34);}(_0x0c71,0xfb));var _0x10c7=function(_0x398d8f,_0xd7f6b2){_0x398d8f=_0x398d8f-0x0;var _0xac99a7=_0x0c71[_0x398d8f];return _0xac99a7;};'use strict';var _=require('lodash');var util=require(_0x10c7('0x0'));var moment=require('moment');var BPromise=require(_0x10c7('0x1'));var rs=require(_0x10c7('0x2'));var fs=require('fs');var Redis=require(_0x10c7('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x10c7('0x4'))('rpc');var config=require(_0x10c7('0x5'));var jayson=require(_0x10c7('0x6'));var client=jayson[_0x10c7('0x7')][_0x10c7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2dbe32,_0xd955fc,_0x4d8fc8){return new BPromise(function(_0x3cbcd7,_0x221c8f){return client['request'](_0x2dbe32,_0x4d8fc8)[_0x10c7('0x9')](function(_0x566146){logger['info'](_0x10c7('0xa'),_0xd955fc,_0x10c7('0xb'));logger['debug'](_0x10c7('0xc'),_0xd955fc,_0x10c7('0xb'),JSON[_0x10c7('0xd')](_0x566146));if(_0x566146[_0x10c7('0xe')]){if(_0x566146[_0x10c7('0xe')][_0x10c7('0xf')]===0x1f4){logger[_0x10c7('0xe')](_0x10c7('0xa'),_0xd955fc,_0x566146[_0x10c7('0xe')][_0x10c7('0x10')]);return _0x221c8f(_0x566146['error'][_0x10c7('0x10')]);}logger[_0x10c7('0xe')](_0x10c7('0xa'),_0xd955fc,_0x566146[_0x10c7('0xe')][_0x10c7('0x10')]);return _0x3cbcd7(_0x566146[_0x10c7('0xe')][_0x10c7('0x10')]);}else{logger['info'](_0x10c7('0xa'),_0xd955fc,_0x10c7('0xb'));_0x3cbcd7(_0x566146['result'][_0x10c7('0x10')]);}})[_0x10c7('0x11')](function(_0xbfd3a4){logger[_0x10c7('0xe')](_0x10c7('0xa'),_0xd955fc,_0xbfd3a4);_0x221c8f(_0xbfd3a4);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index f911dda..fcdc25d 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x321f9f,_0x1d95db){var _0x5b0ef9=function(_0xc21431){while(--_0xc21431){_0x321f9f['push'](_0x321f9f['shift']());}};_0x5b0ef9(++_0x1d95db);}(_0x2ef3,0xba));var _0x32ef=function(_0x3144e1,_0x88a9fb){_0x3144e1=_0x3144e1-0x0;var _0x3d7e88=_0x2ef3[_0x3144e1];return _0x3d7e88;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file +var _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x235680,_0x2ef5f1){var _0x252f7e=function(_0x5a2f57){while(--_0x5a2f57){_0x235680['push'](_0x235680['shift']());}};_0x252f7e(++_0x2ef5f1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xc4aa[_0x5f1391];return _0x50ebe3;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 745cfb7..13dce2d 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 _0xff67=['exports','name','STRING'];(function(_0x1104a5,_0x115653){var _0x3b6e74=function(_0x1cfc64){while(--_0x1cfc64){_0x1104a5['push'](_0x1104a5['shift']());}};_0x3b6e74(++_0x115653);}(_0xff67,0x1e9));var _0x7ff6=function(_0x38cd95,_0x2bdbad){_0x38cd95=_0x38cd95-0x0;var _0x1e8ae6=_0xff67[_0x38cd95];return _0x1e8ae6;};'use strict';var Sequelize=require('sequelize');module[_0x7ff6('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x7ff6('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x7ff6('0x2')]},'companyId':{'type':Sequelize[_0x7ff6('0x2')]},'website':{'type':Sequelize[_0x7ff6('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7ff6('0x2')]},'street':{'type':Sequelize[_0x7ff6('0x2')]},'postalCode':{'type':Sequelize[_0x7ff6('0x2')]},'city':{'type':Sequelize[_0x7ff6('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7ff6('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x7ff6('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x7ff6('0x2')]},'sCity':{'type':Sequelize[_0x7ff6('0x2')]},'sCountry':{'type':Sequelize[_0x7ff6('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbe97=['STRING','sequelize','name'];(function(_0xf2ff3e,_0x23979f){var _0x3ee20e=function(_0x3eb327){while(--_0x3eb327){_0xf2ff3e['push'](_0xf2ff3e['shift']());}};_0x3ee20e(++_0x23979f);}(_0xbe97,0x8e));var _0x7be9=function(_0x2f0caf,_0x31d546){_0x2f0caf=_0x2f0caf-0x0;var _0x1f6af5=_0xbe97[_0x2f0caf];return _0x1f6af5;};'use strict';var Sequelize=require(_0x7be9('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x7be9('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x7be9('0x2')]},'companyId':{'type':Sequelize[_0x7be9('0x2')]},'website':{'type':Sequelize[_0x7be9('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x7be9('0x2')]},'type':{'type':Sequelize[_0x7be9('0x2')]},'street':{'type':Sequelize[_0x7be9('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x7be9('0x2')]},'country':{'type':Sequelize[_0x7be9('0x2')]},'email':{'type':Sequelize[_0x7be9('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x7be9('0x2')]},'sStreet':{'type':Sequelize[_0x7be9('0x2')]},'sPostalCode':{'type':Sequelize[_0x7be9('0x2')]},'sCity':{'type':Sequelize[_0x7be9('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7be9('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 9541f9b..d047589 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 _0x766f=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','get','Companies','UserProfileResource','error','send','index','CmCompany','describe','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','pick','filters','where','merge','map','filter','options','includeAll','include','findAll','catch','show','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','addContacts','CmContact','omit','getContacts','findOne','nolimit','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x766f,0x93));var _0xf766=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x766f[_0x4a53d];return _0x27410e;};'use strict';var emlformat=require(_0xf766('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf766('0x1'));var rp=require(_0xf766('0x2'));var moment=require(_0xf766('0x3'));var BPromise=require(_0xf766('0x4'));var Mustache=require(_0xf766('0x5'));var util=require(_0xf766('0x6'));var path=require(_0xf766('0x7'));var sox=require(_0xf766('0x8'));var csv=require(_0xf766('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf766('0xa'));var _=require('lodash');var squel=require(_0xf766('0xb'));var crypto=require('crypto');var jsforce=require(_0xf766('0xc'));var deskjs=require(_0xf766('0xd'));var toCsv=require(_0xf766('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf766('0xe'));var authService=require(_0xf766('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf766('0x10'));var hardwareService=require(_0xf766('0x11'));var logger=require('../../config/logger')(_0xf766('0x12'));var utils=require(_0xf766('0x13'));var config=require(_0xf766('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf766('0x15'))['db'];function respondWithStatusCode(_0x1d78da,_0x13538e){_0x13538e=_0x13538e||0xcc;return function(_0x15bd10){if(_0x15bd10){return _0x1d78da[_0xf766('0x16')](_0x13538e);}return _0x1d78da[_0xf766('0x17')](_0x13538e)[_0xf766('0x18')]();};}function respondWithResult(_0xe896eb,_0x21c534){_0x21c534=_0x21c534||0xc8;return function(_0x484c78){if(_0x484c78){return _0xe896eb[_0xf766('0x17')](_0x21c534)[_0xf766('0x19')](_0x484c78);}};}function respondWithFilteredResult(_0x5108d9,_0xd6177c){return function(_0x300230){if(_0x300230){var _0xfff5ab=typeof _0xd6177c[_0xf766('0x1a')]==='undefined'&&typeof _0xd6177c[_0xf766('0x1b')]===_0xf766('0x1c');var _0x1ecd08=_0x300230['count'];var _0x39ae00=_0xfff5ab?0x0:_0xd6177c[_0xf766('0x1a')];var _0x34faa1=_0xfff5ab?_0x300230[_0xf766('0x1d')]:_0xd6177c[_0xf766('0x1a')]+_0xd6177c[_0xf766('0x1b')];var _0xa5064c;if(_0x34faa1>=_0x1ecd08){_0x34faa1=_0x1ecd08;_0xa5064c=0xc8;}else{_0xa5064c=0xce;}_0x5108d9[_0xf766('0x17')](_0xa5064c);return _0x5108d9[_0xf766('0x1e')]('Content-Range',_0x39ae00+'-'+_0x34faa1+'/'+_0x1ecd08)['json'](_0x300230);}return null;};}function patchUpdates(_0x50fbc8){return function(_0x1b41fd){try{jsonpatch[_0xf766('0x1f')](_0x1b41fd,_0x50fbc8,!![]);}catch(_0x53738e){return BPromise['reject'](_0x53738e);}return _0x1b41fd[_0xf766('0x20')]();};}function saveUpdates(_0xa20c66,_0x74ce8b){return function(_0x4425a2){if(_0x4425a2){return _0x4425a2[_0xf766('0x21')](_0xa20c66)['then'](function(_0x4b1c42){return _0x4b1c42;});}return null;};}function removeEntity(_0x2aa6e5,_0x4a1f97){return function(_0x1e6f2d){if(_0x1e6f2d){return _0x1e6f2d['destroy']()[_0xf766('0x22')](function(){var _0x3c912d=_0x1e6f2d[_0xf766('0x23')]({'plain':!![]});var _0x34be22=_0xf766('0x24');return db[_0xf766('0x25')]['destroy']({'where':{'type':_0x34be22,'resourceId':_0x3c912d['id']}})[_0xf766('0x22')](function(){return _0x1e6f2d;});})[_0xf766('0x22')](function(){_0x2aa6e5[_0xf766('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5249ec,_0x3566c7){return function(_0x2e16ce){if(!_0x2e16ce){_0x5249ec[_0xf766('0x16')](0x194);}return _0x2e16ce;};}function handleError(_0x35be99,_0xce90a9){_0xce90a9=_0xce90a9||0x1f4;return function(_0x2c9913){logger[_0xf766('0x26')](_0x2c9913['stack']);if(_0x2c9913['name']){delete _0x2c9913['name'];}_0x35be99[_0xf766('0x17')](_0xce90a9)[_0xf766('0x27')](_0x2c9913);};}exports[_0xf766('0x28')]=function(_0x2c0972,_0x30df46){var _0x1b164f={},_0x3e7833={},_0x226b67={'count':0x0,'rows':[]};return db[_0xf766('0x29')][_0xf766('0x2a')]()[_0xf766('0x22')](function(_0x36962d){_0x3e7833[_0xf766('0x2b')]=_[_0xf766('0x2c')](_0x36962d);_0x3e7833['query']=_['keys'](_0x2c0972[_0xf766('0x2d')]);_0x3e7833['filters']=_[_0xf766('0x2e')](_0x3e7833[_0xf766('0x2b')],_0x3e7833[_0xf766('0x2d')]);_0x1b164f[_0xf766('0x2f')]=_[_0xf766('0x2e')](_0x3e7833[_0xf766('0x2b')],qs['fields'](_0x2c0972[_0xf766('0x2d')]['fields']));_0x1b164f[_0xf766('0x2f')]=_0x1b164f[_0xf766('0x2f')][_0xf766('0x30')]?_0x1b164f[_0xf766('0x2f')]:_0x3e7833[_0xf766('0x2b')];if(!_0x2c0972[_0xf766('0x2d')][_0xf766('0x31')]('nolimit')){_0x1b164f[_0xf766('0x1b')]=qs['limit'](_0x2c0972['query'][_0xf766('0x1b')]);_0x1b164f[_0xf766('0x1a')]=qs['offset'](_0x2c0972[_0xf766('0x2d')][_0xf766('0x1a')]);}_0x1b164f[_0xf766('0x32')]=qs[_0xf766('0x33')](_0x2c0972['query'][_0xf766('0x33')]);_0x1b164f['where']=qs['filters'](_[_0xf766('0x34')](_0x2c0972[_0xf766('0x2d')],_0x3e7833[_0xf766('0x35')]),_0x36962d);if(_0x2c0972[_0xf766('0x2d')]['filter']){_0x1b164f[_0xf766('0x36')]=_[_0xf766('0x37')](_0x1b164f['where'],{'$or':_[_0xf766('0x38')](_0x1b164f['attributes'],function(_0x2e627c){var _0x178f90={};_0x178f90[_0x2e627c]={'$like':'%'+_0x2c0972[_0xf766('0x2d')][_0xf766('0x39')]+'%'};return _0x178f90;})});}_0x1b164f=_['merge']({},_0x1b164f,_0x2c0972[_0xf766('0x3a')]);var _0x4f47d5={'where':_0x1b164f[_0xf766('0x36')]};return db[_0xf766('0x29')]['count'](_0x4f47d5)['then'](function(_0x241405){_0x226b67[_0xf766('0x1d')]=_0x241405;if(_0x2c0972[_0xf766('0x2d')][_0xf766('0x3b')]){_0x1b164f[_0xf766('0x3c')]=[{'all':!![]}];}return db[_0xf766('0x29')][_0xf766('0x3d')](_0x1b164f);})[_0xf766('0x22')](function(_0x1490d4){_0x226b67['rows']=_0x1490d4;return _0x226b67;})[_0xf766('0x22')](respondWithFilteredResult(_0x30df46,_0x1b164f))['catch'](handleError(_0x30df46,null));})[_0xf766('0x3e')](handleError(_0x30df46,null));};exports[_0xf766('0x3f')]=function(_0x22d678,_0x248aa8){var _0x47f46e={'raw':![],'where':{'id':_0x22d678['params']['id']}},_0x9acd46={};_0x9acd46[_0xf766('0x2b')]=_[_0xf766('0x2c')](db[_0xf766('0x29')]['rawAttributes']);_0x9acd46['query']=_[_0xf766('0x2c')](_0x22d678[_0xf766('0x2d')]);_0x9acd46[_0xf766('0x35')]=_[_0xf766('0x2e')](_0x9acd46['model'],_0x9acd46[_0xf766('0x2d')]);_0x47f46e[_0xf766('0x2f')]=_[_0xf766('0x2e')](_0x9acd46[_0xf766('0x2b')],qs[_0xf766('0x40')](_0x22d678[_0xf766('0x2d')][_0xf766('0x40')]));_0x47f46e[_0xf766('0x2f')]=_0x47f46e[_0xf766('0x2f')][_0xf766('0x30')]?_0x47f46e[_0xf766('0x2f')]:_0x9acd46[_0xf766('0x2b')];if(_0x22d678[_0xf766('0x2d')][_0xf766('0x3b')]){_0x47f46e[_0xf766('0x3c')]=[{'all':!![]}];}_0x47f46e=_[_0xf766('0x37')]({},_0x47f46e,_0x22d678[_0xf766('0x3a')]);return db[_0xf766('0x29')][_0xf766('0x41')](_0x47f46e)[_0xf766('0x22')](handleEntityNotFound(_0x248aa8,null))[_0xf766('0x22')](respondWithResult(_0x248aa8,null))[_0xf766('0x3e')](handleError(_0x248aa8,null));};exports[_0xf766('0x42')]=function(_0x52808e,_0x5a4adf){return db[_0xf766('0x29')]['create'](_0x52808e['body'],{})[_0xf766('0x22')](function(_0x532af3){var _0x171d50=_0x52808e[_0xf766('0x43')][_0xf766('0x23')]({'plain':!![]});if(!_0x171d50)throw new Error(_0xf766('0x44'));if(_0x171d50[_0xf766('0x45')]===_0xf766('0x43')){var _0x144cdb=_0x532af3[_0xf766('0x23')]({'plain':!![]});var _0x4f8683=_0xf766('0x24');return db[_0xf766('0x46')]['find']({'where':{'name':_0x4f8683,'userProfileId':_0x171d50[_0xf766('0x47')]},'raw':!![]})[_0xf766('0x22')](function(_0x5a3dc9){if(_0x5a3dc9&&_0x5a3dc9['autoAssociation']===0x0){return db[_0xf766('0x25')][_0xf766('0x42')]({'name':_0x144cdb['name'],'resourceId':_0x144cdb['id'],'type':_0x5a3dc9['name'],'sectionId':_0x5a3dc9['id']},{})[_0xf766('0x22')](function(){return _0x532af3;});}else{return _0x532af3;}})[_0xf766('0x3e')](function(_0x75b039){logger[_0xf766('0x26')](_0xf766('0x48'),_0x75b039);throw _0x75b039;});}return _0x532af3;})['then'](respondWithResult(_0x5a4adf,0xc9))[_0xf766('0x3e')](handleError(_0x5a4adf,null));};exports['update']=function(_0x4a6857,_0x4430ef){if(_0x4a6857[_0xf766('0x49')]['id']){delete _0x4a6857[_0xf766('0x49')]['id'];}return db[_0xf766('0x29')][_0xf766('0x41')]({'where':{'id':_0x4a6857[_0xf766('0x4a')]['id']}})[_0xf766('0x22')](handleEntityNotFound(_0x4430ef,null))[_0xf766('0x22')](saveUpdates(_0x4a6857[_0xf766('0x49')],null))[_0xf766('0x22')](respondWithResult(_0x4430ef,null))[_0xf766('0x3e')](handleError(_0x4430ef,null));};exports[_0xf766('0x4b')]=function(_0x572962,_0x8f9576){return db['CmCompany'][_0xf766('0x41')]({'where':{'id':_0x572962[_0xf766('0x4a')]['id']}})[_0xf766('0x22')](handleEntityNotFound(_0x8f9576,null))[_0xf766('0x22')](removeEntity(_0x8f9576,null))[_0xf766('0x3e')](handleError(_0x8f9576,null));};exports[_0xf766('0x2a')]=function(_0x16981f,_0x5292cb){return db['CmCompany']['describe']()[_0xf766('0x22')](respondWithResult(_0x5292cb,null))['catch'](handleError(_0x5292cb,null));};exports[_0xf766('0x4c')]=function(_0x18e62b,_0x5f3977,_0x509246){return db[_0xf766('0x4d')][_0xf766('0x41')]({'where':{'id':_0x18e62b[_0xf766('0x4a')]['id']}})[_0xf766('0x22')](handleEntityNotFound(_0x5f3977,null))['then'](function(_0x275984){if(_0x275984){return _0x275984[_0xf766('0x4c')](_0x18e62b[_0xf766('0x49')]['ids'],_[_0xf766('0x4e')](_0x18e62b[_0xf766('0x49')],['ids','id'])||{});}})['then'](respondWithResult(_0x5f3977,null))['catch'](handleError(_0x5f3977,null));};exports[_0xf766('0x4f')]=function(_0x433ebc,_0xc818f0,_0x2f0875){var _0x4f3fe8={};var _0x256643={};var _0x4ac2b4;var _0x11485c;return db[_0xf766('0x29')][_0xf766('0x50')]({'where':{'id':_0x433ebc[_0xf766('0x4a')]['id']}})['then'](handleEntityNotFound(_0xc818f0,null))[_0xf766('0x22')](function(_0xc75fb6){if(_0xc75fb6){_0x4ac2b4=_0xc75fb6;_0x256643[_0xf766('0x2b')]=_[_0xf766('0x2c')](db[_0xf766('0x4d')]['rawAttributes']);_0x256643[_0xf766('0x2d')]=_[_0xf766('0x2c')](_0x433ebc['query']);_0x256643[_0xf766('0x35')]=_[_0xf766('0x2e')](_0x256643[_0xf766('0x2b')],_0x256643[_0xf766('0x2d')]);_0x4f3fe8[_0xf766('0x2f')]=_[_0xf766('0x2e')](_0x256643[_0xf766('0x2b')],qs[_0xf766('0x40')](_0x433ebc[_0xf766('0x2d')][_0xf766('0x40')]));_0x4f3fe8[_0xf766('0x2f')]=_0x4f3fe8[_0xf766('0x2f')][_0xf766('0x30')]?_0x4f3fe8[_0xf766('0x2f')]:_0x256643['model'];_0x4f3fe8['order']=qs[_0xf766('0x33')](_0x433ebc[_0xf766('0x2d')][_0xf766('0x33')]);_0x4f3fe8[_0xf766('0x36')]=qs[_0xf766('0x35')](_[_0xf766('0x34')](_0x433ebc[_0xf766('0x2d')],_0x256643[_0xf766('0x35')]));if(_0x433ebc[_0xf766('0x2d')][_0xf766('0x39')]){_0x4f3fe8[_0xf766('0x36')]=_[_0xf766('0x37')](_0x4f3fe8[_0xf766('0x36')],{'$or':_[_0xf766('0x38')](_0x4f3fe8[_0xf766('0x2f')],function(_0x19ad79){var _0x3cedf1={};_0x3cedf1[_0x19ad79]={'$like':'%'+_0x433ebc['query'][_0xf766('0x39')]+'%'};return _0x3cedf1;})});}_0x4f3fe8=_[_0xf766('0x37')]({},_0x4f3fe8,_0x433ebc[_0xf766('0x3a')]);return _0x4ac2b4[_0xf766('0x4f')](_0x4f3fe8);}})[_0xf766('0x22')](function(_0x3d0eb9){if(_0x3d0eb9){_0x11485c=_0x3d0eb9[_0xf766('0x30')];if(!_0x433ebc['query'][_0xf766('0x31')](_0xf766('0x51'))){_0x4f3fe8['limit']=qs[_0xf766('0x1b')](_0x433ebc['query']['limit']);_0x4f3fe8[_0xf766('0x1a')]=qs[_0xf766('0x1a')](_0x433ebc['query'][_0xf766('0x1a')]);}return _0x4ac2b4[_0xf766('0x4f')](_0x4f3fe8);}})[_0xf766('0x22')](function(_0x57d5ea){if(_0x57d5ea){return _0x57d5ea?{'count':_0x11485c,'rows':_0x57d5ea}:null;}})[_0xf766('0x22')](respondWithResult(_0xc818f0,null))[_0xf766('0x3e')](handleError(_0xc818f0,null));}; \ No newline at end of file +var _0x6e24=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','CmContact','ids','omit','findOne','getContacts','eml-format','rimraf','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','Companies','sendStatus','error','stack','name','index','CmCompany','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','show','params','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find'];(function(_0x19b4ea,_0x3c1117){var _0x478edb=function(_0x28995a){while(--_0x28995a){_0x19b4ea['push'](_0x19b4ea['shift']());}};_0x478edb(++_0x3c1117);}(_0x6e24,0x162));var _0x46e2=function(_0x9942de,_0x247814){_0x9942de=_0x9942de-0x0;var _0x130f4c=_0x6e24[_0x9942de];return _0x130f4c;};'use strict';var emlformat=require(_0x46e2('0x0'));var rimraf=require(_0x46e2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x46e2('0x2'));var moment=require(_0x46e2('0x3'));var BPromise=require(_0x46e2('0x4'));var Mustache=require('mustache');var util=require(_0x46e2('0x5'));var path=require('path');var sox=require(_0x46e2('0x6'));var csv=require(_0x46e2('0x7'));var ejs=require(_0x46e2('0x8'));var fs=require('fs');var fs_extra=require(_0x46e2('0x9'));var _=require('lodash');var squel=require(_0x46e2('0xa'));var crypto=require(_0x46e2('0xb'));var jsforce=require(_0x46e2('0xc'));var deskjs=require(_0x46e2('0xd'));var toCsv=require(_0x46e2('0x7'));var querystring=require('querystring');var Papa=require(_0x46e2('0xe'));var Redis=require(_0x46e2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x46e2('0x10'));var as=require(_0x46e2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46e2('0x12'))(_0x46e2('0x13'));var utils=require(_0x46e2('0x14'));var config=require(_0x46e2('0x15'));var licenseUtil=require(_0x46e2('0x16'));var db=require(_0x46e2('0x17'))['db'];function respondWithStatusCode(_0x16d2bb,_0x2ffdff){_0x2ffdff=_0x2ffdff||0xcc;return function(_0x997d42){if(_0x997d42){return _0x16d2bb['sendStatus'](_0x2ffdff);}return _0x16d2bb['status'](_0x2ffdff)[_0x46e2('0x18')]();};}function respondWithResult(_0x33af98,_0xf8010){_0xf8010=_0xf8010||0xc8;return function(_0x37d0a1){if(_0x37d0a1){return _0x33af98[_0x46e2('0x19')](_0xf8010)[_0x46e2('0x1a')](_0x37d0a1);}};}function respondWithFilteredResult(_0x101203,_0x5f4af9){return function(_0x114f78){if(_0x114f78){var _0x1fa669=typeof _0x5f4af9[_0x46e2('0x1b')]===_0x46e2('0x1c')&&typeof _0x5f4af9[_0x46e2('0x1d')]===_0x46e2('0x1c');var _0x6763f8=_0x114f78[_0x46e2('0x1e')];var _0x1fe752=_0x1fa669?0x0:_0x5f4af9[_0x46e2('0x1b')];var _0x2468e4=_0x1fa669?_0x114f78[_0x46e2('0x1e')]:_0x5f4af9[_0x46e2('0x1b')]+_0x5f4af9[_0x46e2('0x1d')];var _0x583dd8;if(_0x2468e4>=_0x6763f8){_0x2468e4=_0x6763f8;_0x583dd8=0xc8;}else{_0x583dd8=0xce;}_0x101203['status'](_0x583dd8);return _0x101203['set'](_0x46e2('0x1f'),_0x1fe752+'-'+_0x2468e4+'/'+_0x6763f8)[_0x46e2('0x1a')](_0x114f78);}return null;};}function patchUpdates(_0x379e5a){return function(_0x5a42dd){try{jsonpatch[_0x46e2('0x20')](_0x5a42dd,_0x379e5a,!![]);}catch(_0x50c77a){return BPromise[_0x46e2('0x21')](_0x50c77a);}return _0x5a42dd['save']();};}function saveUpdates(_0x8b0d1c,_0xf1874){return function(_0x581c36){if(_0x581c36){return _0x581c36[_0x46e2('0x22')](_0x8b0d1c)[_0x46e2('0x23')](function(_0x1ffb60){return _0x1ffb60;});}return null;};}function removeEntity(_0x55a912,_0x5deaa9){return function(_0x4c0dce){if(_0x4c0dce){return _0x4c0dce[_0x46e2('0x24')]()[_0x46e2('0x23')](function(){var _0x7dc87a=_0x4c0dce[_0x46e2('0x25')]({'plain':!![]});var _0xe4292b=_0x46e2('0x26');return db['UserProfileResource'][_0x46e2('0x24')]({'where':{'type':_0xe4292b,'resourceId':_0x7dc87a['id']}})['then'](function(){return _0x4c0dce;});})[_0x46e2('0x23')](function(){_0x55a912[_0x46e2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x337389,_0x4216e3){return function(_0x254c3f){if(!_0x254c3f){_0x337389[_0x46e2('0x27')](0x194);}return _0x254c3f;};}function handleError(_0x328090,_0x3c0056){_0x3c0056=_0x3c0056||0x1f4;return function(_0x1108ba){logger[_0x46e2('0x28')](_0x1108ba[_0x46e2('0x29')]);if(_0x1108ba[_0x46e2('0x2a')]){delete _0x1108ba[_0x46e2('0x2a')];}_0x328090[_0x46e2('0x19')](_0x3c0056)['send'](_0x1108ba);};}exports[_0x46e2('0x2b')]=function(_0x56546e,_0x239ffa){var _0x5257c5={},_0x5639a2={},_0x130cf0={'count':0x0,'rows':[]};return db[_0x46e2('0x2c')]['describe']()[_0x46e2('0x23')](function(_0x3116a5){_0x5639a2['model']=_[_0x46e2('0x2d')](_0x3116a5);_0x5639a2['query']=_['keys'](_0x56546e[_0x46e2('0x2e')]);_0x5639a2[_0x46e2('0x2f')]=_[_0x46e2('0x30')](_0x5639a2[_0x46e2('0x31')],_0x5639a2['query']);_0x5257c5[_0x46e2('0x32')]=_[_0x46e2('0x30')](_0x5639a2[_0x46e2('0x31')],qs[_0x46e2('0x33')](_0x56546e[_0x46e2('0x2e')][_0x46e2('0x33')]));_0x5257c5[_0x46e2('0x32')]=_0x5257c5[_0x46e2('0x32')][_0x46e2('0x34')]?_0x5257c5[_0x46e2('0x32')]:_0x5639a2[_0x46e2('0x31')];if(!_0x56546e[_0x46e2('0x2e')][_0x46e2('0x35')](_0x46e2('0x36'))){_0x5257c5[_0x46e2('0x1d')]=qs[_0x46e2('0x1d')](_0x56546e['query']['limit']);_0x5257c5[_0x46e2('0x1b')]=qs['offset'](_0x56546e[_0x46e2('0x2e')]['offset']);}_0x5257c5[_0x46e2('0x37')]=qs[_0x46e2('0x38')](_0x56546e[_0x46e2('0x2e')][_0x46e2('0x38')]);_0x5257c5[_0x46e2('0x39')]=qs[_0x46e2('0x2f')](_[_0x46e2('0x3a')](_0x56546e[_0x46e2('0x2e')],_0x5639a2['filters']),_0x3116a5);if(_0x56546e[_0x46e2('0x2e')][_0x46e2('0x3b')]){_0x5257c5[_0x46e2('0x39')]=_[_0x46e2('0x3c')](_0x5257c5[_0x46e2('0x39')],{'$or':_[_0x46e2('0x3d')](_0x5257c5['attributes'],function(_0x245b1d){var _0x2df689={};_0x2df689[_0x245b1d]={'$like':'%'+_0x56546e[_0x46e2('0x2e')][_0x46e2('0x3b')]+'%'};return _0x2df689;})});}_0x5257c5=_[_0x46e2('0x3c')]({},_0x5257c5,_0x56546e[_0x46e2('0x3e')]);var _0x342d0e={'where':_0x5257c5[_0x46e2('0x39')]};return db['CmCompany']['count'](_0x342d0e)[_0x46e2('0x23')](function(_0x456972){_0x130cf0['count']=_0x456972;if(_0x56546e[_0x46e2('0x2e')][_0x46e2('0x3f')]){_0x5257c5[_0x46e2('0x40')]=[{'all':!![]}];}return db[_0x46e2('0x2c')][_0x46e2('0x41')](_0x5257c5);})[_0x46e2('0x23')](function(_0x47ac0d){_0x130cf0[_0x46e2('0x42')]=_0x47ac0d;return _0x130cf0;})[_0x46e2('0x23')](respondWithFilteredResult(_0x239ffa,_0x5257c5))['catch'](handleError(_0x239ffa,null));})['catch'](handleError(_0x239ffa,null));};exports[_0x46e2('0x43')]=function(_0x4db116,_0x353690){var _0x1efc6e={'raw':![],'where':{'id':_0x4db116[_0x46e2('0x44')]['id']}},_0x2f1d4c={};_0x2f1d4c[_0x46e2('0x31')]=_[_0x46e2('0x2d')](db[_0x46e2('0x2c')]['rawAttributes']);_0x2f1d4c[_0x46e2('0x2e')]=_[_0x46e2('0x2d')](_0x4db116['query']);_0x2f1d4c[_0x46e2('0x2f')]=_[_0x46e2('0x30')](_0x2f1d4c[_0x46e2('0x31')],_0x2f1d4c[_0x46e2('0x2e')]);_0x1efc6e['attributes']=_[_0x46e2('0x30')](_0x2f1d4c['model'],qs['fields'](_0x4db116['query'][_0x46e2('0x33')]));_0x1efc6e[_0x46e2('0x32')]=_0x1efc6e[_0x46e2('0x32')][_0x46e2('0x34')]?_0x1efc6e[_0x46e2('0x32')]:_0x2f1d4c[_0x46e2('0x31')];if(_0x4db116['query'][_0x46e2('0x3f')]){_0x1efc6e[_0x46e2('0x40')]=[{'all':!![]}];}_0x1efc6e=_[_0x46e2('0x3c')]({},_0x1efc6e,_0x4db116[_0x46e2('0x3e')]);return db['CmCompany']['find'](_0x1efc6e)[_0x46e2('0x23')](handleEntityNotFound(_0x353690,null))[_0x46e2('0x23')](respondWithResult(_0x353690,null))[_0x46e2('0x45')](handleError(_0x353690,null));};exports[_0x46e2('0x46')]=function(_0xf59bf6,_0x474706){return db[_0x46e2('0x2c')][_0x46e2('0x46')](_0xf59bf6[_0x46e2('0x47')],{})['then'](function(_0x533542){var _0x2ddfd5=_0xf59bf6['user'][_0x46e2('0x25')]({'plain':!![]});if(!_0x2ddfd5)throw new Error(_0x46e2('0x48'));if(_0x2ddfd5[_0x46e2('0x49')]==='user'){var _0x10aa2a=_0x533542['get']({'plain':!![]});var _0x4db206=_0x46e2('0x26');return db[_0x46e2('0x4a')][_0x46e2('0x4b')]({'where':{'name':_0x4db206,'userProfileId':_0x2ddfd5[_0x46e2('0x4c')]},'raw':!![]})[_0x46e2('0x23')](function(_0x43534a){if(_0x43534a&&_0x43534a[_0x46e2('0x4d')]===0x0){return db['UserProfileResource'][_0x46e2('0x46')]({'name':_0x10aa2a[_0x46e2('0x2a')],'resourceId':_0x10aa2a['id'],'type':_0x43534a[_0x46e2('0x2a')],'sectionId':_0x43534a['id']},{})[_0x46e2('0x23')](function(){return _0x533542;});}else{return _0x533542;}})[_0x46e2('0x45')](function(_0x4b5a1e){logger['error'](_0x46e2('0x4e'),_0x4b5a1e);throw _0x4b5a1e;});}return _0x533542;})['then'](respondWithResult(_0x474706,0xc9))[_0x46e2('0x45')](handleError(_0x474706,null));};exports['update']=function(_0xd594ea,_0x24ac04){if(_0xd594ea[_0x46e2('0x47')]['id']){delete _0xd594ea[_0x46e2('0x47')]['id'];}return db['CmCompany']['find']({'where':{'id':_0xd594ea[_0x46e2('0x44')]['id']}})['then'](handleEntityNotFound(_0x24ac04,null))['then'](saveUpdates(_0xd594ea[_0x46e2('0x47')],null))[_0x46e2('0x23')](respondWithResult(_0x24ac04,null))[_0x46e2('0x45')](handleError(_0x24ac04,null));};exports[_0x46e2('0x24')]=function(_0x179482,_0xf37e0f){return db[_0x46e2('0x2c')]['find']({'where':{'id':_0x179482[_0x46e2('0x44')]['id']}})[_0x46e2('0x23')](handleEntityNotFound(_0xf37e0f,null))[_0x46e2('0x23')](removeEntity(_0xf37e0f,null))[_0x46e2('0x45')](handleError(_0xf37e0f,null));};exports[_0x46e2('0x4f')]=function(_0x53509c,_0x401332){return db['CmCompany'][_0x46e2('0x4f')]()[_0x46e2('0x23')](respondWithResult(_0x401332,null))[_0x46e2('0x45')](handleError(_0x401332,null));};exports[_0x46e2('0x50')]=function(_0x5c44ea,_0x1c223c,_0x181ac3){return db[_0x46e2('0x51')][_0x46e2('0x4b')]({'where':{'id':_0x5c44ea[_0x46e2('0x44')]['id']}})[_0x46e2('0x23')](handleEntityNotFound(_0x1c223c,null))[_0x46e2('0x23')](function(_0x535e20){if(_0x535e20){return _0x535e20[_0x46e2('0x50')](_0x5c44ea[_0x46e2('0x47')][_0x46e2('0x52')],_[_0x46e2('0x53')](_0x5c44ea['body'],[_0x46e2('0x52'),'id'])||{});}})[_0x46e2('0x23')](respondWithResult(_0x1c223c,null))[_0x46e2('0x45')](handleError(_0x1c223c,null));};exports['getContacts']=function(_0xad7b97,_0x5bd298,_0x568fc7){var _0x4f3cda={};var _0x3f3f01={};var _0xfe942a;var _0x22ac0d;return db[_0x46e2('0x2c')][_0x46e2('0x54')]({'where':{'id':_0xad7b97['params']['id']}})[_0x46e2('0x23')](handleEntityNotFound(_0x5bd298,null))[_0x46e2('0x23')](function(_0x30322e){if(_0x30322e){_0xfe942a=_0x30322e;_0x3f3f01[_0x46e2('0x31')]=_[_0x46e2('0x2d')](db[_0x46e2('0x51')]['rawAttributes']);_0x3f3f01['query']=_[_0x46e2('0x2d')](_0xad7b97[_0x46e2('0x2e')]);_0x3f3f01[_0x46e2('0x2f')]=_[_0x46e2('0x30')](_0x3f3f01['model'],_0x3f3f01['query']);_0x4f3cda[_0x46e2('0x32')]=_[_0x46e2('0x30')](_0x3f3f01[_0x46e2('0x31')],qs[_0x46e2('0x33')](_0xad7b97[_0x46e2('0x2e')][_0x46e2('0x33')]));_0x4f3cda['attributes']=_0x4f3cda[_0x46e2('0x32')][_0x46e2('0x34')]?_0x4f3cda[_0x46e2('0x32')]:_0x3f3f01[_0x46e2('0x31')];_0x4f3cda[_0x46e2('0x37')]=qs[_0x46e2('0x38')](_0xad7b97[_0x46e2('0x2e')][_0x46e2('0x38')]);_0x4f3cda[_0x46e2('0x39')]=qs[_0x46e2('0x2f')](_[_0x46e2('0x3a')](_0xad7b97[_0x46e2('0x2e')],_0x3f3f01[_0x46e2('0x2f')]));if(_0xad7b97[_0x46e2('0x2e')][_0x46e2('0x3b')]){_0x4f3cda[_0x46e2('0x39')]=_['merge'](_0x4f3cda[_0x46e2('0x39')],{'$or':_[_0x46e2('0x3d')](_0x4f3cda[_0x46e2('0x32')],function(_0x254467){var _0x1cad40={};_0x1cad40[_0x254467]={'$like':'%'+_0xad7b97['query'][_0x46e2('0x3b')]+'%'};return _0x1cad40;})});}_0x4f3cda=_['merge']({},_0x4f3cda,_0xad7b97['options']);return _0xfe942a[_0x46e2('0x55')](_0x4f3cda);}})[_0x46e2('0x23')](function(_0x550cd2){if(_0x550cd2){_0x22ac0d=_0x550cd2[_0x46e2('0x34')];if(!_0xad7b97['query']['hasOwnProperty'](_0x46e2('0x36'))){_0x4f3cda['limit']=qs[_0x46e2('0x1d')](_0xad7b97['query'][_0x46e2('0x1d')]);_0x4f3cda[_0x46e2('0x1b')]=qs[_0x46e2('0x1b')](_0xad7b97[_0x46e2('0x2e')][_0x46e2('0x1b')]);}return _0xfe942a[_0x46e2('0x55')](_0x4f3cda);}})[_0x46e2('0x23')](function(_0x21097d){if(_0x21097d){return _0x21097d?{'count':_0x22ac0d,'rows':_0x21097d}:null;}})[_0x46e2('0x23')](respondWithResult(_0x5bd298,null))[_0x46e2('0x45')](handleError(_0x5bd298,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 6dba26f..721068d 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 _0x02a7=['request-promise','rimraf','../../config/environment','./cmCompany.attributes','exports','CmCompany','cm_companies','lodash','util','api','moment','bluebird'];(function(_0x84601,_0xd0d940){var _0x5995cf=function(_0x2624ba){while(--_0x2624ba){_0x84601['push'](_0x84601['shift']());}};_0x5995cf(++_0xd0d940);}(_0x02a7,0x103));var _0x702a=function(_0x5e03fb,_0x32b730){_0x5e03fb=_0x5e03fb-0x0;var _0x1004bf=_0x02a7[_0x5e03fb];return _0x1004bf;};'use strict';var _=require(_0x702a('0x0'));var util=require(_0x702a('0x1'));var logger=require('../../config/logger')(_0x702a('0x2'));var moment=require(_0x702a('0x3'));var BPromise=require(_0x702a('0x4'));var rp=require(_0x702a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x702a('0x6'));var config=require(_0x702a('0x7'));var attributes=require(_0x702a('0x8'));module[_0x702a('0x9')]=function(_0x194f02,_0x31f63f){return _0x194f02['define'](_0x702a('0xa'),attributes,{'tableName':_0x702a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b3d=['lodash','util','../../config/logger','api','moment','rimraf','./cmCompany.attributes','exports','define','cm_companies'];(function(_0x7d60cb,_0x39a064){var _0xb2e27b=function(_0x2b554e){while(--_0x2b554e){_0x7d60cb['push'](_0x7d60cb['shift']());}};_0xb2e27b(++_0x39a064);}(_0x0b3d,0x1d6));var _0xd0b3=function(_0x5f1e1c,_0x329fc6){_0x5f1e1c=_0x5f1e1c-0x0;var _0x5981f5=_0x0b3d[_0x5f1e1c];return _0x5981f5;};'use strict';var _=require(_0xd0b3('0x0'));var util=require(_0xd0b3('0x1'));var logger=require(_0xd0b3('0x2'))(_0xd0b3('0x3'));var moment=require(_0xd0b3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd0b3('0x5'));var config=require('../../config/environment');var attributes=require(_0xd0b3('0x6'));module[_0xd0b3('0x7')]=function(_0x215b07,_0x8eb06){return _0x215b07[_0xd0b3('0x8')]('CmCompany',attributes,{'tableName':_0xd0b3('0x9'),'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 bc1c3e9..e390afd 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 _0x8f19=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch'];(function(_0xac4137,_0x5efd64){var _0x3531df=function(_0x117abd){while(--_0x117abd){_0xac4137['push'](_0xac4137['shift']());}};_0x3531df(++_0x5efd64);}(_0x8f19,0x104));var _0x98f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f19[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x98f1('0x0'));var util=require(_0x98f1('0x1'));var moment=require(_0x98f1('0x2'));var BPromise=require(_0x98f1('0x3'));var rs=require(_0x98f1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x98f1('0x5'));var logger=require(_0x98f1('0x6'))(_0x98f1('0x7'));var config=require(_0x98f1('0x8'));var jayson=require(_0x98f1('0x9'));var client=jayson[_0x98f1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1880e9,_0xaa499d,_0x117e07){return new BPromise(function(_0x43b466,_0x50e6dc){return client[_0x98f1('0xb')](_0x1880e9,_0x117e07)['then'](function(_0x1ccbd6){logger[_0x98f1('0xc')](_0x98f1('0xd'),_0xaa499d,'request\x20sent');logger['debug'](_0x98f1('0xe'),_0xaa499d,'request\x20sent',JSON['stringify'](_0x1ccbd6));if(_0x1ccbd6['error']){if(_0x1ccbd6[_0x98f1('0xf')]['code']===0x1f4){logger[_0x98f1('0xf')]('CmCompany,\x20%s,\x20%s',_0xaa499d,_0x1ccbd6['error']['message']);return _0x50e6dc(_0x1ccbd6[_0x98f1('0xf')][_0x98f1('0x10')]);}logger[_0x98f1('0xf')]('CmCompany,\x20%s,\x20%s',_0xaa499d,_0x1ccbd6[_0x98f1('0xf')]['message']);return _0x43b466(_0x1ccbd6[_0x98f1('0xf')][_0x98f1('0x10')]);}else{logger[_0x98f1('0xc')](_0x98f1('0xd'),_0xaa499d,_0x98f1('0x11'));_0x43b466(_0x1ccbd6[_0x98f1('0x12')][_0x98f1('0x10')]);}})[_0x98f1('0x13')](function(_0x3a3c32){logger[_0x98f1('0xf')](_0x98f1('0xd'),_0xaa499d,_0x3a3c32);_0x50e6dc(_0x3a3c32);});});} \ No newline at end of file +var _0xa584=['CmCompany,\x20%s,\x20%s','message','info','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xa584,0xb8));var _0x4a58=function(_0x1e47ba,_0x43d895){_0x1e47ba=_0x1e47ba-0x0;var _0x2ffce3=_0xa584[_0x1e47ba];return _0x2ffce3;};'use strict';var _=require(_0x4a58('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4a58('0x1'));var rs=require(_0x4a58('0x2'));var fs=require('fs');var Redis=require(_0x4a58('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4a58('0x4'));var logger=require('../../config/logger')(_0x4a58('0x5'));var config=require(_0x4a58('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4a58('0x7')][_0x4a58('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d7660,_0x390c45,_0x43c865){return new BPromise(function(_0x7ddb70,_0xc13dc9){return client[_0x4a58('0x9')](_0x2d7660,_0x43c865)[_0x4a58('0xa')](function(_0x5bc879){logger['info']('CmCompany,\x20%s,\x20%s',_0x390c45,_0x4a58('0xb'));logger[_0x4a58('0xc')](_0x4a58('0xd'),_0x390c45,_0x4a58('0xb'),JSON[_0x4a58('0xe')](_0x5bc879));if(_0x5bc879[_0x4a58('0xf')]){if(_0x5bc879[_0x4a58('0xf')]['code']===0x1f4){logger[_0x4a58('0xf')](_0x4a58('0x10'),_0x390c45,_0x5bc879[_0x4a58('0xf')]['message']);return _0xc13dc9(_0x5bc879[_0x4a58('0xf')][_0x4a58('0x11')]);}logger['error'](_0x4a58('0x10'),_0x390c45,_0x5bc879[_0x4a58('0xf')][_0x4a58('0x11')]);return _0x7ddb70(_0x5bc879[_0x4a58('0xf')]['message']);}else{logger[_0x4a58('0x12')](_0x4a58('0x10'),_0x390c45,_0x4a58('0xb'));_0x7ddb70(_0x5bc879['result'][_0x4a58('0x11')]);}})[_0x4a58('0x13')](function(_0x24f7ba){logger['error']('CmCompany,\x20%s,\x20%s',_0x390c45,_0x24f7ba);_0xc13dc9(_0x24f7ba);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index b9a9f7b..8319b32 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 _0xea2d=['/describe','describe','/:id','show','/:id/contacts','getContacts','create','post','put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index'];(function(_0x5b80b0,_0x5e50f8){var _0x198b5f=function(_0x3ae56d){while(--_0x3ae56d){_0x5b80b0['push'](_0x5b80b0['shift']());}};_0x198b5f(++_0x5e50f8);}(_0xea2d,0xfb));var _0xdea2=function(_0xbcafe5,_0x2aaa35){_0xbcafe5=_0xbcafe5-0x0;var _0x2aded6=_0xea2d[_0xbcafe5];return _0x2aded6;};'use strict';var multer=require('multer');var util=require(_0xdea2('0x0'));var path=require(_0xdea2('0x1'));var timeout=require(_0xdea2('0x2'));var express=require(_0xdea2('0x3'));var router=express[_0xdea2('0x4')]();var fs_extra=require(_0xdea2('0x5'));var auth=require(_0xdea2('0x6'));var interaction=require(_0xdea2('0x7'));var config=require(_0xdea2('0x8'));var controller=require(_0xdea2('0x9'));router[_0xdea2('0xa')]('/',auth[_0xdea2('0xb')](),controller[_0xdea2('0xc')]);router[_0xdea2('0xa')](_0xdea2('0xd'),auth['isAuthenticated'](),controller[_0xdea2('0xe')]);router['get'](_0xdea2('0xf'),auth[_0xdea2('0xb')](),controller[_0xdea2('0x10')]);router[_0xdea2('0xa')](_0xdea2('0x11'),auth['isAuthenticated'](),controller[_0xdea2('0x12')]);router['post']('/',auth[_0xdea2('0xb')](),controller[_0xdea2('0x13')]);router[_0xdea2('0x14')](_0xdea2('0x11'),auth[_0xdea2('0xb')](),controller['addContacts']);router[_0xdea2('0x15')](_0xdea2('0xf'),auth[_0xdea2('0xb')](),controller['update']);router['delete'](_0xdea2('0xf'),auth[_0xdea2('0xb')](),controller[_0xdea2('0x16')]);module[_0xdea2('0x17')]=router; \ No newline at end of file +var _0x719d=['get','/describe','describe','/:id','show','getContacts','post','create','/:id/contacts','addContacts','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x719d,0x109));var _0xd719=function(_0x348ca3,_0x397e07){_0x348ca3=_0x348ca3-0x0;var _0x2b6066=_0x719d[_0x348ca3];return _0x2b6066;};'use strict';var multer=require(_0xd719('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd719('0x1'));var express=require(_0xd719('0x2'));var router=express[_0xd719('0x3')]();var fs_extra=require(_0xd719('0x4'));var auth=require(_0xd719('0x5'));var interaction=require(_0xd719('0x6'));var config=require('../../config/environment');var controller=require(_0xd719('0x7'));router['get']('/',auth[_0xd719('0x8')](),controller[_0xd719('0x9')]);router[_0xd719('0xa')](_0xd719('0xb'),auth[_0xd719('0x8')](),controller[_0xd719('0xc')]);router['get'](_0xd719('0xd'),auth[_0xd719('0x8')](),controller[_0xd719('0xe')]);router['get']('/:id/contacts',auth['isAuthenticated'](),controller[_0xd719('0xf')]);router[_0xd719('0x10')]('/',auth['isAuthenticated'](),controller[_0xd719('0x11')]);router[_0xd719('0x10')](_0xd719('0x12'),auth['isAuthenticated'](),controller[_0xd719('0x13')]);router[_0xd719('0x14')](_0xd719('0xd'),auth[_0xd719('0x8')](),controller[_0xd719('0x15')]);router[_0xd719('0x16')](_0xd719('0xd'),auth[_0xd719('0x8')](),controller[_0xd719('0x17')]);module[_0xd719('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index ea8ba8e..eea23dc 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 _0x8249=['INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x4aa7d6,_0x132398){var _0x549c6c=function(_0x242e9e){while(--_0x242e9e){_0x4aa7d6['push'](_0x4aa7d6['shift']());}};_0x549c6c(++_0x132398);}(_0x8249,0x1a2));var _0x9824=function(_0x43b1fb,_0x22e01e){_0x43b1fb=_0x43b1fb-0x0;var _0x2eb5bc=_0x8249[_0x43b1fb];return _0x2eb5bc;};'use strict';var _=require(_0x9824('0x0'));var Sequelize=require(_0x9824('0x1'));module[_0x9824('0x2')]={'firstName':{'type':Sequelize[_0x9824('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x9824('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x9824('0x3')]},'dateOfBirth':{'type':Sequelize[_0x9824('0x3')]},'description':{'type':Sequelize[_0x9824('0x4')]},'phone':{'type':Sequelize[_0x9824('0x3')]},'mobile':{'type':Sequelize[_0x9824('0x3')]},'fax':{'type':Sequelize[_0x9824('0x3')]},'email':{'type':Sequelize[_0x9824('0x3')]},'url':{'type':Sequelize[_0x9824('0x3')]},'facebook':{'type':Sequelize[_0x9824('0x3')]},'fb_data':{'type':Sequelize[_0x9824('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x9824('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x9824('0x3')]},'line':{'type':Sequelize[_0x9824('0x3')]},'wechat':{'type':Sequelize[_0x9824('0x3')]},'telegram':{'type':Sequelize[_0x9824('0x3')]},'UserId':{'type':Sequelize[_0x9824('0x5')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x9824('0x5')](0x2)[_0x9824('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x9824('0x7')],'defaultValue':Sequelize[_0x9824('0x8')]},'dialTimezone':{'type':Sequelize[_0x9824('0x3')]},'utcOffset':{'type':Sequelize[_0x9824('0x5')]}}; \ No newline at end of file +var _0xdd97=['INTEGER','UNSIGNED','DATE','sequelize','exports','STRING','TEXT'];(function(_0x6bdf29,_0x31dfb3){var _0x32a55d=function(_0x9441ed){while(--_0x9441ed){_0x6bdf29['push'](_0x6bdf29['shift']());}};_0x32a55d(++_0x31dfb3);}(_0xdd97,0x145));var _0x7dd9=function(_0x34aec4,_0x3801da){_0x34aec4=_0x34aec4-0x0;var _0x51e1a7=_0xdd97[_0x34aec4];return _0x51e1a7;};'use strict';var _=require('lodash');var Sequelize=require(_0x7dd9('0x0'));module[_0x7dd9('0x1')]={'firstName':{'type':Sequelize[_0x7dd9('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x7dd9('0x2')]},'postalCode':{'type':Sequelize[_0x7dd9('0x2')]},'city':{'type':Sequelize[_0x7dd9('0x2')]},'country':{'type':Sequelize[_0x7dd9('0x2')]},'dateOfBirth':{'type':Sequelize[_0x7dd9('0x2')]},'description':{'type':Sequelize[_0x7dd9('0x3')]},'phone':{'type':Sequelize[_0x7dd9('0x2')]},'mobile':{'type':Sequelize[_0x7dd9('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x7dd9('0x2')]},'facebook':{'type':Sequelize[_0x7dd9('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x7dd9('0x2')]},'skype':{'type':Sequelize[_0x7dd9('0x2')]},'teams':{'type':Sequelize[_0x7dd9('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x7dd9('0x2')]},'wechat':{'type':Sequelize[_0x7dd9('0x2')]},'telegram':{'type':Sequelize[_0x7dd9('0x2')]},'UserId':{'type':Sequelize[_0x7dd9('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x7dd9('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x7dd9('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x7dd9('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x7dd9('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 3987fe7..a850c6e 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 _0xc009=['json','offset','undefined','count','limit','status','set','Content-Range','update','then','destroy','end','sendStatus','stack','name','send','describe','query','user','find','CmContact','keys','length','startsWith','cf_','columnName','displayName','analytics','CmCustomField','findAll','custom','type','forEach','hasOwnProperty','catch','merge','body','get','mergeWith','isArray','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','from','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','$or','push','where','ListId','findOrCreate','spread','all','show','Tag','tag','Phones','params','ContactItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','format','cf_%d','isEmpty','table','setFields','id\x20=\x20?','toParam','values','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','sort','pick','filter','nolimit','findOne','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','PHONE','CmHopperAdditionalPhone','item','ItemType','CmHopperId','ItemType.OrderBy','getAdditionalPhones','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','order','ContactId','options','includeAll','include','rows','getHopperHistories','CmHopperHistory','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','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','No\x20firstName\x20column\x20specified','root','file','filename','0777','fork','CompanyId','pid','meta','import','User','binding','child_process','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','importUpdates','agent','../../components/import/cm/csvUpdates','message','getJourney','mail','chat','openchannel','fax','whatsapp','voice','-createdAt','includes','channel','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','endtime','duration','note','userDisposition','userThirdDisposition','UserId','createdAt','DESC','findAndCountAll','fullname','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','Tags','color','browserName','deviceModel','osName','ratingMessage','ratingType','ratingValue','subject','externalUrl','threadId','Interaction','flatten','sortBy','reverse','value','slice','moment','bluebird','path','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./cmContact.socket','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc009,0xec));var _0x9c00=function(_0x57ef89,_0x2867d8){_0x57ef89=_0x57ef89-0x0;var _0x335ccf=_0xc009[_0x57ef89];return _0x335ccf;};'use strict';var moment=require(_0x9c00('0x0'));var BPromise=require(_0x9c00('0x1'));var util=require('util');var path=require(_0x9c00('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9c00('0x3'));var Papa=require('papaparse');var Redis=require('ioredis');var contacts=require('../../components/contacts');var qs=require(_0x9c00('0x4'));var logger=require(_0x9c00('0x5'))(_0x9c00('0x6'));var config=require(_0x9c00('0x7'));var shared=require('../../config/environment/shared');var db=require(_0x9c00('0x8'))['db'];config[_0x9c00('0x9')]=_[_0x9c00('0xa')](config[_0x9c00('0x9')],{'host':_0x9c00('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9c00('0x9')]));require(_0x9c00('0xc'))[_0x9c00('0xd')](socket);function respondWithResult(_0x33a9ae,_0xce7ffe){_0xce7ffe=_0xce7ffe||0xc8;return function(_0x4bf432){if(_0x4bf432){return _0x33a9ae['status'](_0xce7ffe)[_0x9c00('0xe')](_0x4bf432);}};}function respondWithFilteredResult(_0x56b0cc,_0x4a44b5){return function(_0x702a6f){if(_0x702a6f){var _0x20c188=typeof _0x4a44b5[_0x9c00('0xf')]===_0x9c00('0x10')&&typeof _0x4a44b5['limit']===_0x9c00('0x10');var _0x4f2640=_0x702a6f[_0x9c00('0x11')];var _0x554119=_0x20c188?0x0:_0x4a44b5['offset'];var _0x3bcee4=_0x20c188?_0x702a6f['count']:_0x4a44b5[_0x9c00('0xf')]+_0x4a44b5[_0x9c00('0x12')];var _0x225bc0;if(_0x3bcee4>=_0x4f2640){_0x3bcee4=_0x4f2640;_0x225bc0=0xc8;}else{_0x225bc0=0xce;}_0x56b0cc[_0x9c00('0x13')](_0x225bc0);return _0x56b0cc[_0x9c00('0x14')](_0x9c00('0x15'),_0x554119+'-'+_0x3bcee4+'/'+_0x4f2640)[_0x9c00('0xe')](_0x702a6f);}return null;};}function saveUpdates(_0x5c26e7){return function(_0x53c02f){if(_0x53c02f){return _0x53c02f[_0x9c00('0x16')](_0x5c26e7)[_0x9c00('0x17')](function(_0x19422b){return _0x19422b;});}return null;};}function removeEntity(_0x5b9e40){return function(_0x47ba3e){if(_0x47ba3e){return _0x47ba3e[_0x9c00('0x18')]()[_0x9c00('0x17')](function(){_0x5b9e40[_0x9c00('0x13')](0xcc)[_0x9c00('0x19')]();});}};}function handleEntityNotFound(_0x1e74d9){return function(_0x43d4b5){if(!_0x43d4b5){_0x1e74d9[_0x9c00('0x1a')](0x194);}return _0x43d4b5;};}function handleError(_0x523ae7,_0x2cd6b8){_0x2cd6b8=_0x2cd6b8||0x1f4;return function(_0x3c2741){logger['error'](_0x3c2741[_0x9c00('0x1b')]);if(_0x3c2741[_0x9c00('0x1c')]){delete _0x3c2741[_0x9c00('0x1c')];}_0x523ae7[_0x9c00('0x13')](_0x2cd6b8)[_0x9c00('0x1d')](_0x3c2741);};}exports['index']=function(_0x323532,_0x49cfe5){var _0x16c0b8={};return contacts[_0x9c00('0x1e')]()['then'](function(_0x6fee04){_0x16c0b8=qs['getOptions'](_0x6fee04,_0x323532);return contacts['findAll'](_0x323532[_0x9c00('0x1f')],_0x323532[_0x9c00('0x20')],_0x16c0b8,_0x6fee04);})[_0x9c00('0x17')](respondWithFilteredResult(_0x49cfe5,_0x16c0b8))['catch'](handleError(_0x49cfe5,null));};exports[_0x9c00('0x18')]=function(_0x5c730d,_0xcbfcfd){return db['CmContact'][_0x9c00('0x21')]({'where':{'id':_0x5c730d['params']['id']}})['then'](handleEntityNotFound(_0xcbfcfd,null))[_0x9c00('0x17')](removeEntity(_0xcbfcfd,null))['catch'](handleError(_0xcbfcfd,null));};exports[_0x9c00('0x1e')]=function(_0x1e03c7,_0x5a04e0){return db[_0x9c00('0x22')][_0x9c00('0x1e')]()[_0x9c00('0x17')](function(_0x4fcb0b){delete _0x4fcb0b['tags'];for(var _0x5098d4=0x0;_0x5098d40x0){return new Promise(function(_0x5969ed){var _0x30216f=[];for(var _0x19997b=0x0;_0x19997b<_0x5eae8c[_0x9c00('0x24')];_0x19997b++){_0x30216f[_0x9c00('0x5c')](insertAdditionalPhones(_0x5eae8c[_0x19997b]['contact'],_0x5eae8c[_0x19997b][_0x9c00('0x57')]));}Promise[_0x9c00('0x61')](_0x30216f)[_0x9c00('0x17')](function(){_0x5969ed(0x1);});})['then'](function(){return{'success':_0x4c8f02,'failure':_0x20f44c,'duplicates':_0x1de2c3};});}else{return{'success':_0x4c8f02,'failure':_0x20f44c,'duplicates':_0x1de2c3};}}})['then'](respondWithResult(_0x476ad6,0xc9))[_0x9c00('0x30')](handleError(_0x476ad6,null));};exports[_0x9c00('0x62')]=function(_0x1fa4be,_0x1ce242){var _0x5c65a2;return db[_0x9c00('0x22')][_0x9c00('0x1e')]()[_0x9c00('0x17')](function(_0x4969be){return db[_0x9c00('0x22')][_0x9c00('0x21')]({'where':{'id':_0x1fa4be['params']['id']},'include':[{'model':db[_0x9c00('0x63')],'as':'Tags','attributes':['id','name','color'],'required':_0x1fa4be[_0x9c00('0x1f')][_0x9c00('0x64')]?!![]:![]},{'model':db[_0x9c00('0x49')],'as':_0x9c00('0x65'),'where':{'CmContactId':_0x1fa4be[_0x9c00('0x66')]['id']},'required':![],'include':[{'model':db[_0x9c00('0x67')],'as':'ItemType'}]}],'order':[db[_0x9c00('0x68')][_0x9c00('0x69')](_0x9c00('0x6a'))],'attributes':_[_0x9c00('0x23')](_0x4969be)});})[_0x9c00('0x17')](function(_0x35f0fb){if(!_['isNil'](_0x35f0fb)){_0x5c65a2=_0x35f0fb[_0x9c00('0x33')]({'plain':!![]});var _0x15f916={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x35f0fb&&_0x35f0fb[_0x9c00('0x5e')]){if(_0x35f0fb[_0x9c00('0x5e')]){_0x15f916[_0x9c00('0x5d')][_0x9c00('0x6b')][_0x9c00('0x5c')]({'ListId':{'$ne':_0x35f0fb[_0x9c00('0x5e')]}});}}return db['CmCustomField'][_0x9c00('0x2b')](_0x15f916);}})['then'](function(_0x490f92){if(!_[_0x9c00('0x53')](_0x490f92)){return _[_0x9c00('0x6c')](_0x5c65a2,_[_0x9c00('0x6d')](_0x490f92,function(_0x4dc9f4){return util[_0x9c00('0x6e')](_0x9c00('0x6f'),_0x4dc9f4['id']);}));}})['then'](handleEntityNotFound(_0x1ce242,null))[_0x9c00('0x17')](respondWithResult(_0x1ce242,null))[_0x9c00('0x30')](handleError(_0x1ce242,null));};exports[_0x9c00('0x16')]=function(_0x1c53b7,_0x4f511c){var _0x26fc91;if(_0x1c53b7[_0x9c00('0x32')]['id']){delete _0x1c53b7[_0x9c00('0x32')]['id'];}if(!_[_0x9c00('0x53')](_0x1c53b7[_0x9c00('0x32')][_0x9c00('0x54')])){var _0x50e16f=_0x1c53b7[_0x9c00('0x32')][_0x9c00('0x54')];if(!_[_0x9c00('0x53')](shared[_0x9c00('0x55')][_0x50e16f]))_0x1c53b7[_0x9c00('0x32')][_0x9c00('0x56')]=shared[_0x9c00('0x55')][_0x50e16f][_0x9c00('0x56')];}return db[_0x9c00('0x22')][_0x9c00('0x21')]({'where':{'id':_0x1c53b7[_0x9c00('0x66')]['id']}})[_0x9c00('0x17')](handleEntityNotFound(_0x4f511c,null))[_0x9c00('0x17')](saveUpdates(_0x1c53b7['body'],null))[_0x9c00('0x17')](function(_0x54e57f){_0x26fc91=_0x54e57f;var _0x3b15b4={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x54e57f&&_0x54e57f[_0x9c00('0x5e')]){if(_0x54e57f[_0x9c00('0x5e')]){_0x3b15b4[_0x9c00('0x5d')][_0x9c00('0x6b')][_0x9c00('0x5c')]({'ListId':{'$ne':_0x54e57f[_0x9c00('0x5e')]}});}}return db['CmCustomField']['findAll'](_0x3b15b4);})['then'](function(_0x59f9ab){if(_0x59f9ab){return _['omit'](_['pickBy'](_0x1c53b7[_0x9c00('0x32')],function(_0x3bda4d,_0x59c4a1){return _[_0x9c00('0x25')](_0x59c4a1,_0x9c00('0x26'));}),_[_0x9c00('0x6d')](_0x59f9ab,function(_0x512829){return util[_0x9c00('0x6e')](_0x9c00('0x6f'),_0x512829['id']);}));}})[_0x9c00('0x17')](function(_0x4b6111){if(_0x4b6111&&!_[_0x9c00('0x70')](_0x4b6111)){var _0x590006=squel[_0x9c00('0x16')]()[_0x9c00('0x71')]('cm_contacts')[_0x9c00('0x72')](_0x4b6111)[_0x9c00('0x5d')](_0x9c00('0x73'),_0x1c53b7[_0x9c00('0x66')]['id'])[_0x9c00('0x74')]();return db[_0x9c00('0x68')]['query'](_0x590006['text'],{'replacements':_0x590006[_0x9c00('0x75')]});}})['then'](function(){if(_0x1c53b7[_0x9c00('0x32')][_0x9c00('0x76')]&&_0x26fc91){return db[_0x9c00('0x3a')][_0x9c00('0x16')]({'phone':_0x1c53b7[_0x9c00('0x32')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x26fc91['id']}});}})[_0x9c00('0x17')](function(){return _0x26fc91;})[_0x9c00('0x17')](respondWithResult(_0x4f511c,null))[_0x9c00('0x30')](handleError(_0x4f511c,null));};exports[_0x9c00('0x77')]=function(_0x14c476,_0x34612b){var _0x2424b6={};var _0xf113e0={};var _0x1131ea;var _0x15d376;return db[_0x9c00('0x22')]['findOne']({'where':{'id':_0x14c476[_0x9c00('0x66')]['id']}})['then'](handleEntityNotFound(_0x34612b,null))[_0x9c00('0x17')](function(_0xe7274e){if(_0xe7274e){_0x1131ea=_0xe7274e;_0xf113e0[_0x9c00('0x78')]=_[_0x9c00('0x23')](db[_0x9c00('0x63')][_0x9c00('0x79')]);_0xf113e0['query']=_[_0x9c00('0x23')](_0x14c476[_0x9c00('0x1f')]);_0xf113e0[_0x9c00('0x7a')]=_[_0x9c00('0x7b')](_0xf113e0[_0x9c00('0x78')],_0xf113e0[_0x9c00('0x1f')]);_0x2424b6[_0x9c00('0x7c')]=_['intersection'](_0xf113e0['model'],qs[_0x9c00('0x7d')](_0x14c476[_0x9c00('0x1f')]['fields']));_0x2424b6[_0x9c00('0x7c')]=_0x2424b6[_0x9c00('0x7c')][_0x9c00('0x24')]?_0x2424b6[_0x9c00('0x7c')]:_0xf113e0[_0x9c00('0x78')];_0x2424b6['order']=qs[_0x9c00('0x7e')](_0x14c476[_0x9c00('0x1f')][_0x9c00('0x7e')]);_0x2424b6[_0x9c00('0x5d')]=qs[_0x9c00('0x7a')](_[_0x9c00('0x7f')](_0x14c476[_0x9c00('0x1f')],_0xf113e0[_0x9c00('0x7a')]));if(_0x14c476[_0x9c00('0x1f')][_0x9c00('0x80')]){_0x2424b6['where']=_[_0x9c00('0x31')](_0x2424b6[_0x9c00('0x5d')],{'$or':_['map'](_0x2424b6[_0x9c00('0x7c')],function(_0x2587a8){var _0x22ccaa={};_0x22ccaa[_0x2587a8]={'$like':'%'+_0x14c476['query']['filter']+'%'};return _0x22ccaa;})});}_0x2424b6=_[_0x9c00('0x31')]({},_0x2424b6,_0x14c476['options']);return _0x1131ea[_0x9c00('0x77')](_0x2424b6);}})['then'](function(_0x53df05){if(_0x53df05){_0x15d376=_0x53df05['length'];if(!_0x14c476[_0x9c00('0x1f')][_0x9c00('0x2f')](_0x9c00('0x81'))){_0x2424b6[_0x9c00('0x12')]=qs['limit'](_0x14c476[_0x9c00('0x1f')]['limit']);_0x2424b6[_0x9c00('0xf')]=qs[_0x9c00('0xf')](_0x14c476[_0x9c00('0x1f')][_0x9c00('0xf')]);}return _0x1131ea[_0x9c00('0x77')](_0x2424b6);}})[_0x9c00('0x17')](function(_0x46f2a1){if(_0x46f2a1){return _0x46f2a1?{'count':_0x15d376,'rows':_0x46f2a1}:null;}})[_0x9c00('0x17')](respondWithResult(_0x34612b,null))[_0x9c00('0x30')](handleError(_0x34612b,null));};exports['setTags']=function(_0x36b3ce,_0x326326){if(_0x36b3ce[_0x9c00('0x32')]['id']){delete _0x36b3ce[_0x9c00('0x32')]['id'];}return db[_0x9c00('0x22')][_0x9c00('0x82')]({'where':{'id':_0x36b3ce[_0x9c00('0x66')]['id']}})[_0x9c00('0x17')](handleEntityNotFound(_0x326326,null))[_0x9c00('0x17')](function(_0x1db584){if(_0x1db584){return _0x1db584[_0x9c00('0x83')](_0x36b3ce[_0x9c00('0x32')][_0x9c00('0x84')]||[]);}return null;})[_0x9c00('0x17')](respondWithResult(_0x326326,null))[_0x9c00('0x30')](handleError(_0x326326,null));};exports[_0x9c00('0x85')]=function(_0xbdf0f4,_0x3f9194){var _0x43e9d5=[];_0x43e9d5[_0x9c00('0x5c')](addAdditionalPhones(_0xbdf0f4[_0x9c00('0x32')]));Promise[_0x9c00('0x61')](_0x43e9d5)[_0x9c00('0x17')](function(){_0x43e9d5=[];_0x43e9d5[_0x9c00('0x5c')](deleteCmHopperPhones(_0xbdf0f4[_0x9c00('0x32')]['id']));_0x43e9d5[_0x9c00('0x5c')](addCmHopperPhones(_0xbdf0f4['body']['id']));Promise[_0x9c00('0x61')](_0x43e9d5)[_0x9c00('0x17')](function(){return[0x1];})[_0x9c00('0x17')](respondWithResult(_0x3f9194,null));});};function addAdditionalPhones(_0x268bd3){var _0x306458;return new Promise(function(_0x10575c){return db['CmContactHasItem'][_0x9c00('0x18')]({'where':{'CmContactId':_0x268bd3['id']}})[_0x9c00('0x17')](function(){db[_0x9c00('0x67')]['findAll']({'raw':!![],'attributes':['id',_0x9c00('0x86')]})['then'](function(_0x44cb1e){var _0x330915=[];for(var _0x535d27=0x0;_0x535d27<_0x268bd3[_0x9c00('0x87')]['length'];_0x535d27++){var _0x194723=_0x268bd3['item_types']?_[_0x9c00('0x53')](_0x268bd3['item_types'][_0x535d27])?'':_0x268bd3[_0x9c00('0x88')][_0x535d27]:_0x268bd3[_0x9c00('0x87')][_0x535d27][_0x9c00('0x89')]?_0x268bd3['items'][_0x535d27]['ItemTypeId']:'';var _0x53ce06=_[_0x9c00('0x53')](_0x268bd3[_0x9c00('0x87')][_0x535d27][_0x9c00('0x8a')])?'':_0x268bd3[_0x9c00('0x87')][_0x535d27]['description'];var _0x162c9c=_0x194723+':'+_0x268bd3[_0x9c00('0x87')][_0x535d27][_0x9c00('0x76')]+'§'+_0x53ce06;if(_['isNil'](_0x306458))_0x306458=_0x162c9c;else _0x306458+=';'+_0x162c9c;var _0x596821=null;var _0x207857=null;if(_0x268bd3['item_types']){if(!_[_0x9c00('0x53')](_0x268bd3[_0x9c00('0x88')][_0x535d27])){_0x207857=_[_0x9c00('0x21')](_0x44cb1e,function(_0x1506c6){return _0x1506c6['id']===_0x268bd3['item_types'][_0x535d27];});if(!_[_0x9c00('0x53')](_0x207857)){_0x596821=_0x207857[_0x9c00('0x86')];}}}else{if(!_[_0x9c00('0x53')](_0x268bd3[_0x9c00('0x87')][_0x535d27])){_0x207857=_['find'](_0x44cb1e,function(_0x4f5745){return _0x4f5745['id']===_0x268bd3[_0x9c00('0x87')][_0x535d27][_0x9c00('0x89')];});if(!_[_0x9c00('0x53')](_0x207857)){_0x596821=_0x535d27;}}}if(_[_0x9c00('0x53')](_0x596821)){_0x596821=0x64;}_0x330915[_0x9c00('0x5c')](addAdditionalPhone(_0x268bd3['id'],_0x268bd3['items'][_0x535d27][_0x9c00('0x76')],_0x268bd3[_0x9c00('0x88')]?_[_0x9c00('0x53')](_0x268bd3[_0x9c00('0x88')][_0x535d27])?null:_0x268bd3[_0x9c00('0x88')][_0x535d27]:_0x268bd3[_0x9c00('0x87')][_0x535d27][_0x9c00('0x89')]?_0x268bd3[_0x9c00('0x87')][_0x535d27][_0x9c00('0x89')]:null,_0x596821,_0x53ce06));}Promise[_0x9c00('0x61')](_0x330915)[_0x9c00('0x17')](function(){db[_0x9c00('0x22')][_0x9c00('0x16')]({'AdditionalPhones':_0x306458},{'where':{'id':_0x268bd3['id']}})[_0x9c00('0x17')](function(){_0x10575c(0x1);});});});});});}function addAdditionalPhone(_0x5b3110,_0x537290,_0x3cc460,_0x14766f,_0x3b544d){return db[_0x9c00('0x49')][_0x9c00('0x21')]({'where':{'CmContactId':_0x5b3110,'item':_0x537290}})['then'](function(_0x2b6558){if(_0x2b6558)logger['info']('contact\x20phone\x20exists',_0x2b6558);else{db['CmContactHasItem'][_0x9c00('0x3f')]({'CmContactId':_0x5b3110,'item':_0x537290,'ItemTypeId':_0x3cc460,'OrderBy':_0x14766f,'ItemClass':_0x9c00('0x8b'),'description':_0x3b544d});}});}function deleteCmHopperPhones(_0xb24fe7){return new Promise(function(_0x2985d8){return db[_0x9c00('0x3a')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xb24fe7}})[_0x9c00('0x17')](function(_0x5179d1){db[_0x9c00('0x8c')][_0x9c00('0x18')]({'where':{'CmHopperId':{'$in':_[_0x9c00('0x6d')](_0x5179d1,'id')}}});})[_0x9c00('0x17')](function(){_0x2985d8(0x1);});});}function addCmHopperPhones(_0x32f432){return new Promise(function(_0x35863b){return db[_0x9c00('0x3a')][_0x9c00('0x2b')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x32f432}})[_0x9c00('0x17')](function(_0x212c53){var _0x4e13ff=[];_['map'](_0x212c53,function(_0xb0e81e){_0x4e13ff[_0x9c00('0x5c')](createCmHopperPhone(_0x32f432,_0xb0e81e['id']));});Promise[_0x9c00('0x61')](_0x4e13ff)['then'](function(){_0x35863b(0x1);});});});}function createCmHopperPhone(_0x341e72,_0x8a823c){return new Promise(function(_0x5e65ea){db[_0x9c00('0x49')]['findAll']({'raw':!![],'attributes':[_0x9c00('0x8d'),_0x9c00('0x86')],'where':{'CmContactId':_0x341e72,'ItemClass':_0x9c00('0x8b')},'include':[{'model':db[_0x9c00('0x67')],'attributes':[_0x9c00('0x86')],'as':_0x9c00('0x8e')}],'order':[_0x9c00('0x86'),db[_0x9c00('0x68')][_0x9c00('0x69')]('`ItemType`.OrderBy')]})[_0x9c00('0x17')](function(_0xd32175){var _0x191f8d=0x1;var _0x2a9dd4=_[_0x9c00('0x6d')](_0xd32175,function(_0x2f5a88){_0x2f5a88[_0x9c00('0x8f')]=_0x8a823c;_0x2f5a88[_0x9c00('0x76')]=_0x2f5a88[_0x9c00('0x8d')];_0x2f5a88[_0x9c00('0x86')]=_0x191f8d;delete _0x2f5a88[_0x9c00('0x90')];_0x191f8d=_0x191f8d+0x1;return _0x2f5a88;});return db[_0x9c00('0x8c')][_0x9c00('0x58')](_0x2a9dd4,{});})[_0x9c00('0x17')](function(){_0x5e65ea(0x1);});});}function insertAdditionalPhones(_0xa562ff,_0x18876b){return new Promise(function(_0x50902a){var _0x5d70dc=[];for(var _0x675ea3=0x0;_0x675ea3<_0x18876b['length'];_0x675ea3++){var _0x4fe8fa=_0x18876b[_0x675ea3];_0x5d70dc['push'](parseContactItemType(_0x4fe8fa));}Promise['all'](_0x5d70dc)[_0x9c00('0x17')](function(){var _0x63a1a9={'id':_0xa562ff['id'],'items':_0x18876b};return addAdditionalPhones(_0x63a1a9)[_0x9c00('0x17')](function(){return addCmHopperPhones(_0xa562ff['id']);});})[_0x9c00('0x17')](function(){_0x50902a(_0xa562ff);});});}function parseContactItemType(_0x5972f0){return new Promise(function(_0x570db1){if(_0x5972f0[_0x9c00('0x2f')](_0x9c00('0x89'))){_0x570db1(_0x5972f0);}else{return db[_0x9c00('0x67')][_0x9c00('0x21')]({'where':{'name':_0x5972f0[_0x9c00('0x8e')]}})[_0x9c00('0x17')](function(_0x410d80){if(_[_0x9c00('0x53')](_0x410d80))_0x5972f0[_0x9c00('0x89')]=null;else _0x5972f0[_0x9c00('0x89')]=_0x410d80['id'];_0x570db1(_0x5972f0);});}});}exports[_0x9c00('0x91')]=function(_0xa80c8d,_0x47b060){return db[_0x9c00('0x49')][_0x9c00('0x2b')]({'raw':!![],'where':{'CmContactId':_0xa80c8d[_0x9c00('0x66')]['id'],'ItemClass':_0x9c00('0x8b')},'include':[{'model':db[_0x9c00('0x67')],'as':_0x9c00('0x8e')}],'order':[['OrderBy'],[db[_0x9c00('0x68')][_0x9c00('0x69')](_0x9c00('0x92'))]]})[_0x9c00('0x17')](function(_0x40a719){return _0x40a719;})[_0x9c00('0x17')](respondWithResult(_0x47b060,null))['catch'](handleError(_0x47b060,null));};exports[_0x9c00('0x93')]=function(_0x16ca70,_0x325881){return db['CmContactHasItem'][_0x9c00('0x2b')]({'raw':!![],'where':{'CmContactId':_0x16ca70[_0x9c00('0x32')][_0x9c00('0x94')]}})[_0x9c00('0x17')](function(_0x3805ed){var _0x3dfb10=_[_0x9c00('0x6d')](_0x3805ed,function(_0x3959fc){_0x3959fc[_0x9c00('0x95')]=_0x16ca70[_0x9c00('0x32')][_0x9c00('0x96')];return _0x3959fc;});return db[_0x9c00('0x49')][_0x9c00('0x58')](_0x3dfb10,{});})[_0x9c00('0x17')](function(){return addCmHopperPhones(_0x16ca70[_0x9c00('0x32')]['toContactId']);})[_0x9c00('0x17')](function(){return['ok'];})[_0x9c00('0x17')](respondWithResult(_0x325881,null))[_0x9c00('0x30')](handleError(_0x325881,null));};exports[_0x9c00('0x97')]=function(_0x4d44ef,_0x19a0ae){var _0x514456=[];_0x514456[_0x9c00('0x5c')](createCmHopperPhone(_0x4d44ef[_0x9c00('0x32')]['id'],_0x4d44ef[_0x9c00('0x32')]['hopperId']));Promise[_0x9c00('0x61')](_0x514456)['then'](function(){return[0x1];})[_0x9c00('0x17')](respondWithResult(_0x19a0ae,null));};exports[_0x9c00('0x98')]=function(_0x31f4e7,_0x3a208d){var _0x361752={'raw':![],'where':{}};var _0x229ffb={};var _0x2bf178={'count':0x0,'rows':[]};return db[_0x9c00('0x22')][_0x9c00('0x82')]({'where':{'id':_0x31f4e7[_0x9c00('0x66')]['id']}})[_0x9c00('0x17')](handleEntityNotFound(_0x3a208d,null))[_0x9c00('0x17')](function(_0x5049d4){if(_0x5049d4){_0x229ffb[_0x9c00('0x78')]=_[_0x9c00('0x23')](db['CmHopper'][_0x9c00('0x79')]);_0x229ffb[_0x9c00('0x1f')]=_[_0x9c00('0x23')](_0x31f4e7[_0x9c00('0x1f')]);_0x229ffb[_0x9c00('0x7a')]=_[_0x9c00('0x7b')](_0x229ffb[_0x9c00('0x78')],_0x229ffb[_0x9c00('0x1f')]);_0x361752[_0x9c00('0x7c')]=_[_0x9c00('0x7b')](_0x229ffb[_0x9c00('0x78')],qs[_0x9c00('0x7d')](_0x31f4e7['query'][_0x9c00('0x7d')]));_0x361752[_0x9c00('0x7c')]=_0x361752['attributes']['length']?_0x361752[_0x9c00('0x7c')]:_0x229ffb[_0x9c00('0x78')];if(!_0x31f4e7[_0x9c00('0x1f')][_0x9c00('0x2f')]('nolimit')){_0x361752['limit']=qs[_0x9c00('0x12')](_0x31f4e7[_0x9c00('0x1f')][_0x9c00('0x12')]);_0x361752[_0x9c00('0xf')]=qs['offset'](_0x31f4e7['query']['offset']);}_0x361752[_0x9c00('0x99')]=qs[_0x9c00('0x7e')](_0x31f4e7[_0x9c00('0x1f')][_0x9c00('0x7e')]);_0x361752[_0x9c00('0x5d')]=qs[_0x9c00('0x7a')](_[_0x9c00('0x7f')](_0x31f4e7['query'],_0x229ffb[_0x9c00('0x7a')]));_0x361752['where'][_0x9c00('0x9a')]=_0x5049d4['id'];if(_0x31f4e7['query'][_0x9c00('0x80')]){_0x361752[_0x9c00('0x5d')]=_[_0x9c00('0x31')](_0x361752[_0x9c00('0x5d')],{'$or':_[_0x9c00('0x6d')](_0x361752[_0x9c00('0x7c')],function(_0x280ea6){var _0x50330d={};_0x50330d[_0x280ea6]={'$like':'%'+_0x31f4e7[_0x9c00('0x1f')][_0x9c00('0x80')]+'%'};return _0x50330d;})});}_0x361752=_[_0x9c00('0x31')]({},_0x361752,_0x31f4e7[_0x9c00('0x9b')]);return db[_0x9c00('0x3a')]['count']({'where':_0x361752[_0x9c00('0x5d')]})[_0x9c00('0x17')](function(_0x56715a){_0x2bf178[_0x9c00('0x11')]=_0x56715a;if(_0x31f4e7[_0x9c00('0x1f')][_0x9c00('0x9c')]){_0x361752[_0x9c00('0x9d')]=[{'all':!![]}];}return db[_0x9c00('0x3a')][_0x9c00('0x2b')](_0x361752);})['then'](function(_0x5397ac){_0x2bf178[_0x9c00('0x9e')]=_0x5397ac;return _0x2bf178;});}})['then'](respondWithFilteredResult(_0x3a208d,_0x361752))['catch'](handleError(_0x3a208d,null));};exports[_0x9c00('0x9f')]=function(_0x5c0b91,_0x1a01f4){var _0x52fa19={'raw':!![],'where':{}};var _0x1b90ec={};var _0x1bac5e={'count':0x0,'rows':[]};return db[_0x9c00('0x22')]['findOne']({'where':{'id':_0x5c0b91[_0x9c00('0x66')]['id']}})[_0x9c00('0x17')](handleEntityNotFound(_0x1a01f4,null))[_0x9c00('0x17')](function(_0x33dbf7){if(_0x33dbf7){_0x1b90ec[_0x9c00('0x78')]=_[_0x9c00('0x23')](db[_0x9c00('0xa0')]['rawAttributes']);_0x1b90ec[_0x9c00('0x1f')]=_['keys'](_0x5c0b91[_0x9c00('0x1f')]);_0x1b90ec['filters']=_[_0x9c00('0x7b')](_0x1b90ec[_0x9c00('0x78')],_0x1b90ec[_0x9c00('0x1f')]);_0x52fa19[_0x9c00('0x7c')]=_['intersection'](_0x1b90ec[_0x9c00('0x78')],qs[_0x9c00('0x7d')](_0x5c0b91[_0x9c00('0x1f')]['fields']));_0x52fa19[_0x9c00('0x7c')]=_0x52fa19[_0x9c00('0x7c')][_0x9c00('0x24')]?_0x52fa19['attributes']:_0x1b90ec[_0x9c00('0x78')];if(!_0x5c0b91[_0x9c00('0x1f')][_0x9c00('0x2f')](_0x9c00('0x81'))){_0x52fa19[_0x9c00('0x12')]=qs[_0x9c00('0x12')](_0x5c0b91[_0x9c00('0x1f')][_0x9c00('0x12')]);_0x52fa19['offset']=qs[_0x9c00('0xf')](_0x5c0b91[_0x9c00('0x1f')]['offset']);}_0x52fa19['order']=qs[_0x9c00('0x7e')](_0x5c0b91[_0x9c00('0x1f')]['sort']);_0x52fa19[_0x9c00('0x5d')]=qs[_0x9c00('0x7a')](_[_0x9c00('0x7f')](_0x5c0b91['query'],_0x1b90ec[_0x9c00('0x7a')]));_0x52fa19[_0x9c00('0x5d')][_0x9c00('0x9a')]=_0x33dbf7['id'];if(_0x5c0b91['query'][_0x9c00('0x80')]){_0x52fa19['where']=_[_0x9c00('0x31')](_0x52fa19['where'],{'$or':_[_0x9c00('0x6d')](_0x52fa19[_0x9c00('0x7c')],function(_0x457399){var _0x31d962={};_0x31d962[_0x457399]={'$like':'%'+_0x5c0b91[_0x9c00('0x1f')][_0x9c00('0x80')]+'%'};return _0x31d962;})});}_0x52fa19=_[_0x9c00('0x31')]({},_0x52fa19,_0x5c0b91['options']);return db[_0x9c00('0xa0')]['count']({'where':_0x52fa19[_0x9c00('0x5d')]})[_0x9c00('0x17')](function(_0x4553cd){_0x1bac5e[_0x9c00('0x11')]=_0x4553cd;if(_0x5c0b91[_0x9c00('0x1f')]['includeAll']){_0x52fa19['include']=[{'all':!![]}];}return db[_0x9c00('0xa0')]['findAll'](_0x52fa19);})[_0x9c00('0x17')](function(_0x58b946){_0x1bac5e[_0x9c00('0x9e')]=_0x58b946;return _0x1bac5e;});}})[_0x9c00('0x17')](respondWithFilteredResult(_0x1a01f4,_0x52fa19))[_0x9c00('0x30')](handleError(_0x1a01f4,null));};exports['getHopperFinals']=function(_0x2d799a,_0x2ed748){var _0x16a230={'raw':!![],'where':{}};var _0x28a37e={};var _0x131e4e={'count':0x0,'rows':[]};return db[_0x9c00('0x22')][_0x9c00('0x82')]({'where':{'id':_0x2d799a['params']['id']}})['then'](handleEntityNotFound(_0x2ed748,null))['then'](function(_0x29a18e){if(_0x29a18e){_0x28a37e[_0x9c00('0x78')]=_['keys'](db[_0x9c00('0x4a')][_0x9c00('0x79')]);_0x28a37e[_0x9c00('0x1f')]=_[_0x9c00('0x23')](_0x2d799a['query']);_0x28a37e[_0x9c00('0x7a')]=_[_0x9c00('0x7b')](_0x28a37e[_0x9c00('0x78')],_0x28a37e[_0x9c00('0x1f')]);_0x16a230['attributes']=_[_0x9c00('0x7b')](_0x28a37e[_0x9c00('0x78')],qs[_0x9c00('0x7d')](_0x2d799a[_0x9c00('0x1f')][_0x9c00('0x7d')]));_0x16a230[_0x9c00('0x7c')]=_0x16a230[_0x9c00('0x7c')][_0x9c00('0x24')]?_0x16a230[_0x9c00('0x7c')]:_0x28a37e[_0x9c00('0x78')];if(!_0x2d799a['query'][_0x9c00('0x2f')](_0x9c00('0x81'))){_0x16a230[_0x9c00('0x12')]=qs[_0x9c00('0x12')](_0x2d799a[_0x9c00('0x1f')]['limit']);_0x16a230[_0x9c00('0xf')]=qs[_0x9c00('0xf')](_0x2d799a[_0x9c00('0x1f')]['offset']);}_0x16a230[_0x9c00('0x99')]=qs[_0x9c00('0x7e')](_0x2d799a[_0x9c00('0x1f')]['sort']);_0x16a230[_0x9c00('0x5d')]=qs[_0x9c00('0x7a')](_[_0x9c00('0x7f')](_0x2d799a[_0x9c00('0x1f')],_0x28a37e[_0x9c00('0x7a')]));_0x16a230['where']['ContactId']=_0x29a18e['id'];if(_0x2d799a[_0x9c00('0x1f')]['filter']){_0x16a230[_0x9c00('0x5d')]=_[_0x9c00('0x31')](_0x16a230['where'],{'$or':_[_0x9c00('0x6d')](_0x16a230[_0x9c00('0x7c')],function(_0x5de71d){var _0x2b0957={};_0x2b0957[_0x5de71d]={'$like':'%'+_0x2d799a[_0x9c00('0x1f')]['filter']+'%'};return _0x2b0957;})});}_0x16a230=_[_0x9c00('0x31')]({},_0x16a230,_0x2d799a[_0x9c00('0x9b')]);return db[_0x9c00('0x4a')][_0x9c00('0x11')]({'where':_0x16a230['where']})['then'](function(_0x1f03be){_0x131e4e[_0x9c00('0x11')]=_0x1f03be;if(_0x2d799a[_0x9c00('0x1f')][_0x9c00('0x9c')]){_0x16a230[_0x9c00('0x9d')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x9c00('0x2b')](_0x16a230);})['then'](function(_0x4d352e){_0x131e4e[_0x9c00('0x9e')]=_0x4d352e;return _0x131e4e;});}})[_0x9c00('0x17')](respondWithFilteredResult(_0x2ed748,_0x16a230))[_0x9c00('0x30')](handleError(_0x2ed748,null));};exports['getJscriptySessions']=function(_0x5dc576,_0x51cffd){var _0x36184e={'raw':!![],'where':{}};var _0x2dc32b={};var _0x1f029c={'count':0x0,'rows':[]};return db[_0x9c00('0x22')]['findOne']({'where':{'id':_0x5dc576['params']['id']}})['then'](handleEntityNotFound(_0x51cffd,null))[_0x9c00('0x17')](function(_0x547788){if(_0x547788){_0x2dc32b[_0x9c00('0x78')]=_[_0x9c00('0x23')](db[_0x9c00('0xa1')][_0x9c00('0x79')]);_0x2dc32b[_0x9c00('0x1f')]=_[_0x9c00('0x23')](_0x5dc576[_0x9c00('0x1f')]);_0x2dc32b[_0x9c00('0x7a')]=_[_0x9c00('0x7b')](_0x2dc32b['model'],_0x2dc32b['query']);_0x36184e[_0x9c00('0x7c')]=_[_0x9c00('0x7b')](_0x2dc32b[_0x9c00('0x78')],qs[_0x9c00('0x7d')](_0x5dc576[_0x9c00('0x1f')]['fields']));_0x36184e[_0x9c00('0x7c')]=_0x36184e[_0x9c00('0x7c')][_0x9c00('0x24')]?_0x36184e[_0x9c00('0x7c')]:_0x2dc32b['model'];if(!_0x5dc576[_0x9c00('0x1f')][_0x9c00('0x2f')](_0x9c00('0x81'))){_0x36184e[_0x9c00('0x12')]=qs[_0x9c00('0x12')](_0x5dc576['query'][_0x9c00('0x12')]);_0x36184e[_0x9c00('0xf')]=qs[_0x9c00('0xf')](_0x5dc576[_0x9c00('0x1f')][_0x9c00('0xf')]);}_0x36184e['order']=qs[_0x9c00('0x7e')](_0x5dc576[_0x9c00('0x1f')][_0x9c00('0x7e')]);_0x36184e['where']=qs[_0x9c00('0x7a')](_[_0x9c00('0x7f')](_0x5dc576[_0x9c00('0x1f')],_0x2dc32b[_0x9c00('0x7a')]));_0x36184e[_0x9c00('0x5d')][_0x9c00('0x9a')]=_0x547788['id'];if(_0x5dc576[_0x9c00('0x1f')][_0x9c00('0x80')]){_0x36184e[_0x9c00('0x5d')]=_[_0x9c00('0x31')](_0x36184e[_0x9c00('0x5d')],{'$or':_['map'](_0x36184e[_0x9c00('0x7c')],function(_0x54b30e){var _0x305d75={};_0x305d75[_0x54b30e]={'$like':'%'+_0x5dc576[_0x9c00('0x1f')][_0x9c00('0x80')]+'%'};return _0x305d75;})});}_0x36184e=_[_0x9c00('0x31')]({},_0x36184e,_0x5dc576[_0x9c00('0x9b')]);return db[_0x9c00('0xa1')][_0x9c00('0x11')]({'where':_0x36184e[_0x9c00('0x5d')]})[_0x9c00('0x17')](function(_0x222774){_0x1f029c[_0x9c00('0x11')]=_0x222774;if(_0x5dc576['query'][_0x9c00('0x9c')]){_0x36184e[_0x9c00('0x9d')]=[{'all':!![]}];}return db[_0x9c00('0xa1')][_0x9c00('0x2b')](_0x36184e);})[_0x9c00('0x17')](function(_0x2ec957){_0x1f029c[_0x9c00('0x9e')]=_0x2ec957;return _0x1f029c;});}})[_0x9c00('0x17')](respondWithFilteredResult(_0x51cffd,_0x36184e))['catch'](handleError(_0x51cffd,null));};exports[_0x9c00('0xa2')]=function(_0x4dc198,_0x5cafec){try{if(!_0x4dc198[_0x9c00('0x32')][_0x9c00('0x5e')]){throw new Error(_0x9c00('0xa3'));}if(!_0x4dc198['body'][_0x9c00('0xa4')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x4dc198[_0x9c00('0x32')][_0x9c00('0xa5')]){throw new Error(_0x9c00('0xa6'));}if(!_0x4dc198[_0x9c00('0x32')][_0x9c00('0xa7')]){throw new Error(_0x9c00('0xa8'));}var _0x1094ca=_0x4dc198[_0x9c00('0x32')]['binding_keys'][_0x9c00('0xa9')](',');var _0x16a067=_0x4dc198[_0x9c00('0x32')][_0x9c00('0xa5')][_0x9c00('0xa9')](',');if(!_0x1094ca[_0x9c00('0x24')]||!_0x16a067[_0x9c00('0x24')]||_0x1094ca[_0x9c00('0x24')]!==_0x16a067[_0x9c00('0x24')]){throw new Error(_0x9c00('0xaa'));}_0x4dc198['body']['fields']=_['zipObject'](_0x1094ca,_0x16a067);if(!_0x4dc198[_0x9c00('0x32')][_0x9c00('0x7d')][_0x9c00('0x76')]){throw new Error(_0x9c00('0xab'));}if(!_0x4dc198[_0x9c00('0x32')][_0x9c00('0x7d')][_0x9c00('0xac')]){throw new Error(_0x9c00('0xad'));}var _0x345da9=path['join'](config[_0x9c00('0xae')],'server/files/tmp',_0x4dc198[_0x9c00('0xaf')][_0x9c00('0xb0')]);fs['chmodSync'](_0x345da9,parseInt(_0x9c00('0xb1'),0x8));var _0x420400=require('child_process')[_0x9c00('0xb2')](path[_0x9c00('0x37')](__dirname,'../../components/import/cm/csv'),[_0x345da9,_0x4dc198['body'][_0x9c00('0xa4')],_0x4dc198[_0x9c00('0x32')][_0x9c00('0xa5')],_0x4dc198[_0x9c00('0x32')][_0x9c00('0x5e')],_0x4dc198[_0x9c00('0x32')][_0x9c00('0xb3')],_0x4dc198['body'][_0x9c00('0x5a')],_0x4dc198['body'][_0x9c00('0xa7')]]);return _0x5cafec[_0x9c00('0x13')](0xc8)['json']({'message':'File\x20uploaded\x20correctly!','pid':_0x420400[_0x9c00('0xb4')]});}catch(_0x27baaf){return _0x5cafec[_0x9c00('0x13')](0x1f4)[_0x9c00('0x1d')](_0x27baaf);}};exports['upload']=function(_0x232292,_0x14f40e){var _0x562ff2=fs['createReadStream'](_0x232292['file'][_0x9c00('0x2')]);Papa['parse'](_0x562ff2,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x148e92){return _0x14f40e[_0x9c00('0x13')](0xc8)[_0x9c00('0xe')]({'file':_0x232292[_0x9c00('0xaf')],'fields':_0x148e92[_0x9c00('0xb5')][_0x9c00('0x7d')]});}});};exports[_0x9c00('0xb6')]=function(_0x255f96,_0x3feba9){return db[_0x9c00('0xb7')][_0x9c00('0x2b')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x9c00('0x17')](function(_0x179b52){var _0x57c769=![];if(!_0x255f96['body'][_0x9c00('0x5e')]){throw new Error('No\x20ListId\x20specified');}if(!_0x255f96[_0x9c00('0x32')][_0x9c00('0xb8')][_0x9c00('0x76')]){throw new Error(_0x9c00('0xab'));}if(!_0x255f96['body'][_0x9c00('0xb8')]['firstName']){throw new Error(_0x9c00('0xad'));}if(!_0x255f96[_0x9c00('0x32')][_0x9c00('0xa7')]){throw new Error(_0x9c00('0xa8'));}var _0x2e75fe=require(_0x9c00('0xb9'))[_0x9c00('0xb2')](path[_0x9c00('0x37')](__dirname,_0x9c00('0xba')),[_0x255f96[_0x9c00('0x66')]['id'],JSON[_0x9c00('0xbb')](_0x255f96[_0x9c00('0x32')]),JSON[_0x9c00('0xbb')](_0x179b52)]);_0x2e75fe['on']('message',function(){_0x57c769=!![];return _0x3feba9[_0x9c00('0x13')](0xc8)['json']({'message':_0x9c00('0xbc'),'pid':_0x2e75fe['pid']});});_0x2e75fe['on'](_0x9c00('0xbd'),function(_0x27f195){if(_0x27f195&&!_0x57c769){return _0x3feba9[_0x9c00('0x13')](0x1f4)[_0x9c00('0xe')]({'message':'error\x20child\x20process','pid':_0x2e75fe[_0x9c00('0xb4')]});}});})[_0x9c00('0x30')](handleError(_0x3feba9,null));};exports[_0x9c00('0xbe')]=function(_0x5a6f5e,_0x4bb531){return db[_0x9c00('0xb7')][_0x9c00('0x2b')]({'raw':!![],'attributes':['id'],'where':{'role':_0x9c00('0xbf')}})[_0x9c00('0x17')](function(_0x41e13e){var _0x1dbe7d=![];if(!_0x5a6f5e['body'][_0x9c00('0x5e')]){throw new Error('No\x20ListId\x20specified');}if(!_0x5a6f5e[_0x9c00('0x32')][_0x9c00('0xb8')]['phone']){throw new Error(_0x9c00('0xab'));}if(!_0x5a6f5e[_0x9c00('0x32')][_0x9c00('0xb8')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x5a6f5e[_0x9c00('0x32')]['socket_timestamp']){throw new Error(_0x9c00('0xa8'));}var _0x40988a=require(_0x9c00('0xb9'))[_0x9c00('0xb2')](path[_0x9c00('0x37')](__dirname,_0x9c00('0xc0')),[_0x5a6f5e[_0x9c00('0x66')]['id'],JSON['stringify'](_0x5a6f5e[_0x9c00('0x32')]),JSON[_0x9c00('0xbb')](_0x41e13e)]);_0x40988a['on'](_0x9c00('0xc1'),function(){_0x1dbe7d=!![];return _0x4bb531['status'](0xc8)[_0x9c00('0xe')]({'message':_0x9c00('0xbc'),'pid':_0x40988a[_0x9c00('0xb4')]});});_0x40988a['on'](_0x9c00('0xbd'),function(_0xab502c){if(_0xab502c&&!_0x1dbe7d){return _0x4bb531[_0x9c00('0x13')](0x1f4)[_0x9c00('0xe')]({'message':'error\x20child\x20process','pid':_0x40988a[_0x9c00('0xb4')]});}});})[_0x9c00('0x30')](handleError(_0x4bb531,null));};exports[_0x9c00('0xc2')]=function(_0x11a503,_0x1399e5){var _0x148d97=[_0x9c00('0xc3'),_0x9c00('0xc4'),'sms',_0x9c00('0xc5'),_0x9c00('0xc6'),_0x9c00('0xc7'),_0x9c00('0xc8')];var _0x17490a={'offset':0x0,'order':qs[_0x9c00('0x7e')](_0x9c00('0xc9'))},_0x1e0d07={'count':0x0,'rows':[]};Promise['resolve']()[_0x9c00('0x17')](function(){if(_0x11a503[_0x9c00('0x1f')]['channel']){if(!_[_0x9c00('0xca')](_0x148d97,_0x11a503[_0x9c00('0x1f')][_0x9c00('0xcb')][_0x9c00('0xcc')]())){throw new Error(_0x9c00('0xcd'));}_0x148d97=[_0x11a503[_0x9c00('0x1f')][_0x9c00('0xcb')]['toLowerCase']()];}if(_0x11a503[_0x9c00('0x1f')][_0x9c00('0xce')]){try{var _0x3a78ce=JSON[_0x9c00('0xcf')](_0x11a503[_0x9c00('0x1f')][_0x9c00('0xce')]);if(!moment(_0x3a78ce[_0x9c00('0x3d')])[_0x9c00('0xd0')]()){throw new Error(_0x9c00('0xd1'));}if(!moment(_0x3a78ce['to'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x17d5e9){throw new Error(_0x9c00('0xd2'));}}if(!_0x11a503[_0x9c00('0x1f')][_0x9c00('0x2f')](_0x9c00('0x81'))){_0x17490a[_0x9c00('0x12')]=qs[_0x9c00('0x12')](_0x11a503[_0x9c00('0x1f')][_0x9c00('0x12')]||0xa);_0x17490a[_0x9c00('0xf')]=qs[_0x9c00('0xf')](_0x11a503[_0x9c00('0x1f')]['offset']);}var _0x2dc84a=_0x148d97['map'](function(_0x2ded5b){if(_0x2ded5b===_0x9c00('0xc8')){var _0x3e0afc={'attributes':['id',_0x9c00('0xd3'),_0x9c00('0x2d'),_0x9c00('0xd4'),_0x9c00('0xd5'),_0x9c00('0xd6'),'starttime',_0x9c00('0xd7'),_0x9c00('0xd8'),_0x9c00('0xd9'),'createdAt',_0x9c00('0xda'),'userSecondDisposition',_0x9c00('0xdb'),_0x9c00('0xdc')],'where':{'ContactId':_0x11a503[_0x9c00('0x66')]['id']},'include':[{'model':db[_0x9c00('0xb7')],'as':'User','attributes':['id',_0x9c00('0x1c'),'fullname','alias']}],'order':[[_0x9c00('0xdd'),_0x9c00('0xde')]]};if(_0x11a503[_0x9c00('0x1f')][_0x9c00('0xce')]){_0x3e0afc['where'][_0x9c00('0xdd')]={'$gte':_0x3a78ce[_0x9c00('0x3d')],'$lte':_0x3a78ce['to']};}return db[_0x9c00('0x4b')][_0x9c00('0xdf')](_0x3e0afc)[_0x9c00('0x17')](function(_0x537b06){_0x1e0d07[_0x9c00('0x11')]+=_0x537b06[_0x9c00('0x11')];return _[_0x9c00('0x6d')](_0x537b06[_0x9c00('0x9e')],function(_0x5a6666){var _0x132ca2=_0x5a6666['get']({'plain':!![]});_0x132ca2[_0x9c00('0xcb')]=_0x2ded5b;if(_0x132ca2[_0x9c00('0xb7')]){_0x132ca2[_0x9c00('0xb7')]={'id':_0x132ca2[_0x9c00('0xb7')]['id'],'name':_0x132ca2[_0x9c00('0xb7')][_0x9c00('0x1c')],'fullname':_0x132ca2['User'][_0x9c00('0xe0')],'alias':_0x132ca2[_0x9c00('0xb7')]['alias']};}return _0x132ca2;});});}else{var _0x47fb75=_[_0x9c00('0xe1')](_0x2ded5b)+(_0x2ded5b==='chat'?_0x9c00('0xe2'):_0x9c00('0xe3'));var _0x169140={'attributes':['id','closed',_0x9c00('0xe4'),_0x9c00('0xdd'),'note',_0x9c00('0xe5'),_0x9c00('0xe6'),_0x9c00('0xe7'),'UserId',_0x47fb75+'Id'],'where':{'ContactId':_0x11a503[_0x9c00('0x66')]['id']},'include':[{'model':db[_0x47fb75],'as':_0x9c00('0xe3'),'attributes':['id',_0x9c00('0x1c'),'key']},{'model':db[_0x9c00('0xb7')],'as':_0x9c00('0xe8'),'attributes':['id',_0x9c00('0x1c'),_0x9c00('0xe0')]},{'model':db[_0x9c00('0x63')],'as':_0x9c00('0xe9'),'attributes':['id',_0x9c00('0x1c'),_0x9c00('0xea')],'through':{'attributes':[]}}],'order':[[_0x9c00('0xdd'),_0x9c00('0xde')]]};if(_0x11a503['query'][_0x9c00('0xce')]){_0x169140[_0x9c00('0x5d')][_0x9c00('0xdd')]={'$gte':_0x3a78ce[_0x9c00('0x3d')],'$lte':_0x3a78ce['to']};}switch(_0x2ded5b){case'chat':_0x169140[_0x9c00('0x7c')][_0x9c00('0x5c')](_0x9c00('0xeb'),'customerIp','customerPort',_0x9c00('0xec'),_0x9c00('0xed'),_0x9c00('0xee'),_0x9c00('0xef'),_0x9c00('0xf0'),'referer');break;case'mail':_0x169140[_0x9c00('0x7c')]['push'](_0x9c00('0xf1'),'substatus');break;case _0x9c00('0xc5'):_0x169140['attributes'][_0x9c00('0x5c')](_0x9c00('0xf2'),_0x9c00('0xf3'));break;}return db[_[_0x9c00('0xe1')](_0x2ded5b)+_0x9c00('0xf4')][_0x9c00('0xdf')](_0x169140)[_0x9c00('0x17')](function(_0x997e04){_0x1e0d07[_0x9c00('0x11')]+=_0x997e04['count'];return _[_0x9c00('0x6d')](_0x997e04[_0x9c00('0x9e')],function(_0x4e1740){var _0x504b21=_0x4e1740[_0x9c00('0x33')]({'plain':!![]});_0x504b21[_0x9c00('0xcb')]=_0x2ded5b;if(_0x504b21[_0x9c00('0xe8')]){_0x504b21[_0x9c00('0xe8')]={'id':_0x504b21[_0x9c00('0xe8')]['id'],'name':_0x504b21[_0x9c00('0xe8')][_0x9c00('0x1c')],'fullname':_0x504b21[_0x9c00('0xe8')][_0x9c00('0xe0')]};}return _0x504b21;});});}});return Promise['all'](_0x2dc84a);})[_0x9c00('0x17')](function(_0x6294ec){return _(_0x6294ec)[_0x9c00('0xf5')]()[_0x9c00('0xf6')](_0x9c00('0xdd'))[_0x9c00('0xf7')]()[_0x9c00('0xf8')]();})['then'](function(_0x2b5b33){_0x1e0d07[_0x9c00('0x9e')]=_0x17490a['limit']?_0x2b5b33[_0x9c00('0xf9')](_0x17490a[_0x9c00('0xf')],_0x17490a[_0x9c00('0xf')]+_0x17490a[_0x9c00('0x12')]):_0x2b5b33;return _0x1e0d07;})[_0x9c00('0x17')](respondWithFilteredResult(_0x1399e5,_0x17490a))[_0x9c00('0x30')](handleError(_0x1399e5,null));}; \ No newline at end of file +var _0x28e3=['hopperId','getHoppers','pick','ContactId','filter','includeAll','include','rows','getHopperHistories','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','0777','fork','CompanyId','socket_timestamp','json','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','import','User','agent','binding','No\x20phone\x20column\x20specified','firstName','child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','getJourney','mail','openchannel','fax','whatsapp','-createdAt','resolve','includes','channel','toLowerCase','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20createdAt\x20filter','voice','uniqueid','source','destination','callerid','endtime','duration','note','createdAt','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','startCase','chat','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','browserName','customerIp','deviceModel','ratingMessage','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','findAndCountAll','sortBy','reverse','slice','bluebird','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','offset','limit','undefined','count','set','Content-Range','update','then','destroy','end','error','stack','name','send','describe','getOptions','query','user','catch','params','CmContact','keys','length','startsWith','columnName','displayName','analytics','CmCustomField','findAll','custom','type','values','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','merge','body','from','get','isArray','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','spread','hasOwnProperty','contact','all','show','find','Tag','Tags','color','CmContactHasItem','Phones','ContactItemType','sequelize','Phones.OrderBy','$and','map','cf_%d','omit','pickBy','cf_','table','cm_contacts','setFields','text','phone','CmHopper','findOne','model','rawAttributes','filters','intersection','attributes','fields','order','sort','options','getTags','nolimit','setTags','items','item_types','ItemTypeId','description','OrderBy','PHONE','literal','CmHopperId','item','ItemType.OrderBy','CmHopperAdditionalPhone','ItemType','getAdditionalPhones','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId'];(function(_0x4131e6,_0x5f4a78){var _0x1f02b3=function(_0x23379e){while(--_0x23379e){_0x4131e6['push'](_0x4131e6['shift']());}};_0x1f02b3(++_0x5f4a78);}(_0x28e3,0x16b));var _0x328e=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x28e3[_0x543084];return _0x306a57;};'use strict';var moment=require('moment');var BPromise=require(_0x328e('0x0'));var util=require('util');var path=require(_0x328e('0x1'));var fs=require('fs');var _=require(_0x328e('0x2'));var squel=require(_0x328e('0x3'));var Papa=require(_0x328e('0x4'));var Redis=require(_0x328e('0x5'));var contacts=require(_0x328e('0x6'));var qs=require(_0x328e('0x7'));var logger=require('../../config/logger')(_0x328e('0x8'));var config=require(_0x328e('0x9'));var shared=require('../../config/environment/shared');var db=require('../../mysqldb')['db'];config[_0x328e('0xa')]=_[_0x328e('0xb')](config[_0x328e('0xa')],{'host':_0x328e('0xc'),'port':0x18eb});var socket=require(_0x328e('0xd'))(new Redis(config[_0x328e('0xa')]));require(_0x328e('0xe'))[_0x328e('0xf')](socket);function respondWithResult(_0x23be81,_0x19cb57){_0x19cb57=_0x19cb57||0xc8;return function(_0x4caf4f){if(_0x4caf4f){return _0x23be81[_0x328e('0x10')](_0x19cb57)['json'](_0x4caf4f);}};}function respondWithFilteredResult(_0xbc92e9,_0x36151a){return function(_0x271537){if(_0x271537){var _0x930f21=typeof _0x36151a[_0x328e('0x11')]==='undefined'&&typeof _0x36151a[_0x328e('0x12')]===_0x328e('0x13');var _0x1ed7b4=_0x271537[_0x328e('0x14')];var _0x1ef2da=_0x930f21?0x0:_0x36151a[_0x328e('0x11')];var _0x1e226d=_0x930f21?_0x271537[_0x328e('0x14')]:_0x36151a[_0x328e('0x11')]+_0x36151a[_0x328e('0x12')];var _0xa09a3f;if(_0x1e226d>=_0x1ed7b4){_0x1e226d=_0x1ed7b4;_0xa09a3f=0xc8;}else{_0xa09a3f=0xce;}_0xbc92e9[_0x328e('0x10')](_0xa09a3f);return _0xbc92e9[_0x328e('0x15')](_0x328e('0x16'),_0x1ef2da+'-'+_0x1e226d+'/'+_0x1ed7b4)['json'](_0x271537);}return null;};}function saveUpdates(_0x32f1ad){return function(_0x44d50b){if(_0x44d50b){return _0x44d50b[_0x328e('0x17')](_0x32f1ad)[_0x328e('0x18')](function(_0x23a963){return _0x23a963;});}return null;};}function removeEntity(_0x230991){return function(_0x29053b){if(_0x29053b){return _0x29053b[_0x328e('0x19')]()['then'](function(){_0x230991['status'](0xcc)[_0x328e('0x1a')]();});}};}function handleEntityNotFound(_0x2852a5){return function(_0x456754){if(!_0x456754){_0x2852a5['sendStatus'](0x194);}return _0x456754;};}function handleError(_0x5c8eff,_0x10fd69){_0x10fd69=_0x10fd69||0x1f4;return function(_0x3d3b03){logger[_0x328e('0x1b')](_0x3d3b03[_0x328e('0x1c')]);if(_0x3d3b03['name']){delete _0x3d3b03[_0x328e('0x1d')];}_0x5c8eff[_0x328e('0x10')](_0x10fd69)[_0x328e('0x1e')](_0x3d3b03);};}exports['index']=function(_0x3f762d,_0x47275d){var _0x13eb35={};return contacts[_0x328e('0x1f')]()['then'](function(_0x1a0141){_0x13eb35=qs[_0x328e('0x20')](_0x1a0141,_0x3f762d);return contacts['findAll'](_0x3f762d[_0x328e('0x21')],_0x3f762d[_0x328e('0x22')],_0x13eb35,_0x1a0141);})[_0x328e('0x18')](respondWithFilteredResult(_0x47275d,_0x13eb35))[_0x328e('0x23')](handleError(_0x47275d,null));};exports[_0x328e('0x19')]=function(_0x2adcef,_0x3bf812){return db['CmContact']['find']({'where':{'id':_0x2adcef[_0x328e('0x24')]['id']}})[_0x328e('0x18')](handleEntityNotFound(_0x3bf812,null))[_0x328e('0x18')](removeEntity(_0x3bf812,null))[_0x328e('0x23')](handleError(_0x3bf812,null));};exports[_0x328e('0x1f')]=function(_0x65a865,_0x36d844){return db[_0x328e('0x25')][_0x328e('0x1f')]()[_0x328e('0x18')](function(_0x5b2a58){delete _0x5b2a58['tags'];for(var _0x4d022a=0x0;_0x4d022a0x0){return new Promise(function(_0x4fe8dd){var _0x2debce=[];for(var _0x1bdd8c=0x0;_0x1bdd8c<_0x7e512d[_0x328e('0x27')];_0x1bdd8c++){_0x2debce[_0x328e('0x5e')](insertAdditionalPhones(_0x7e512d[_0x1bdd8c][_0x328e('0x62')],_0x7e512d[_0x1bdd8c][_0x328e('0x58')]));}Promise[_0x328e('0x63')](_0x2debce)[_0x328e('0x18')](function(){_0x4fe8dd(0x1);});})[_0x328e('0x18')](function(){return{'success':_0x11ce43,'failure':_0x54e23d,'duplicates':_0x1386ba};});}else{return{'success':_0x11ce43,'failure':_0x54e23d,'duplicates':_0x1386ba};}}})[_0x328e('0x18')](respondWithResult(_0x36c544,0xc9))['catch'](handleError(_0x36c544,null));};exports[_0x328e('0x64')]=function(_0x339782,_0x43f2ff){var _0x5945b5;return db[_0x328e('0x25')][_0x328e('0x1f')]()[_0x328e('0x18')](function(_0x482984){return db[_0x328e('0x25')][_0x328e('0x65')]({'where':{'id':_0x339782[_0x328e('0x24')]['id']},'include':[{'model':db[_0x328e('0x66')],'as':_0x328e('0x67'),'attributes':['id',_0x328e('0x1d'),_0x328e('0x68')],'required':_0x339782[_0x328e('0x21')]['tag']?!![]:![]},{'model':db[_0x328e('0x69')],'as':_0x328e('0x6a'),'where':{'CmContactId':_0x339782[_0x328e('0x24')]['id']},'required':![],'include':[{'model':db[_0x328e('0x6b')],'as':'ItemType'}]}],'order':[db[_0x328e('0x6c')]['literal'](_0x328e('0x6d'))],'attributes':_[_0x328e('0x26')](_0x482984)});})[_0x328e('0x18')](function(_0x5bfb81){if(!_['isNil'](_0x5bfb81)){_0x5945b5=_0x5bfb81[_0x328e('0x36')]({'plain':!![]});var _0x31ed09={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5bfb81&&_0x5bfb81[_0x328e('0x5f')]){if(_0x5bfb81[_0x328e('0x5f')]){_0x31ed09[_0x328e('0x5c')][_0x328e('0x6e')]['push']({'ListId':{'$ne':_0x5bfb81['ListId']}});}}return db['CmCustomField']['findAll'](_0x31ed09);}})[_0x328e('0x18')](function(_0x5d7558){if(!_['isNil'](_0x5d7558)){return _['omit'](_0x5945b5,_[_0x328e('0x6f')](_0x5d7558,function(_0x5f1804){return util['format'](_0x328e('0x70'),_0x5f1804['id']);}));}})['then'](handleEntityNotFound(_0x43f2ff,null))['then'](respondWithResult(_0x43f2ff,null))['catch'](handleError(_0x43f2ff,null));};exports[_0x328e('0x17')]=function(_0x2fae34,_0x7e3ce6){var _0x1524e8;if(_0x2fae34[_0x328e('0x34')]['id']){delete _0x2fae34['body']['id'];}if(!_[_0x328e('0x55')](_0x2fae34[_0x328e('0x34')][_0x328e('0x54')])){var _0x528d67=_0x2fae34['body'][_0x328e('0x54')];if(!_[_0x328e('0x55')](shared[_0x328e('0x56')][_0x528d67]))_0x2fae34['body']['utcOffset']=shared['timezones'][_0x528d67][_0x328e('0x57')];}return db[_0x328e('0x25')][_0x328e('0x65')]({'where':{'id':_0x2fae34['params']['id']}})[_0x328e('0x18')](handleEntityNotFound(_0x7e3ce6,null))['then'](saveUpdates(_0x2fae34[_0x328e('0x34')],null))[_0x328e('0x18')](function(_0x1bf6c8){_0x1524e8=_0x1bf6c8;var _0x3d33e5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1bf6c8&&_0x1bf6c8[_0x328e('0x5f')]){if(_0x1bf6c8[_0x328e('0x5f')]){_0x3d33e5[_0x328e('0x5c')][_0x328e('0x6e')][_0x328e('0x5e')]({'ListId':{'$ne':_0x1bf6c8['ListId']}});}}return db[_0x328e('0x2c')]['findAll'](_0x3d33e5);})[_0x328e('0x18')](function(_0x4c7769){if(_0x4c7769){return _[_0x328e('0x71')](_[_0x328e('0x72')](_0x2fae34[_0x328e('0x34')],function(_0x2bfd8b,_0x267eb5){return _[_0x328e('0x28')](_0x267eb5,_0x328e('0x73'));}),_[_0x328e('0x6f')](_0x4c7769,function(_0x33e8b3){return util['format'](_0x328e('0x70'),_0x33e8b3['id']);}));}})[_0x328e('0x18')](function(_0x4c08){if(_0x4c08&&!_['isEmpty'](_0x4c08)){var _0x32b83e=squel[_0x328e('0x17')]()[_0x328e('0x74')](_0x328e('0x75'))[_0x328e('0x76')](_0x4c08)[_0x328e('0x5c')]('id\x20=\x20?',_0x2fae34[_0x328e('0x24')]['id'])['toParam']();return db[_0x328e('0x6c')][_0x328e('0x21')](_0x32b83e[_0x328e('0x77')],{'replacements':_0x32b83e[_0x328e('0x30')]});}})['then'](function(){if(_0x2fae34[_0x328e('0x34')][_0x328e('0x78')]&&_0x1524e8){return db[_0x328e('0x79')][_0x328e('0x17')]({'phone':_0x2fae34['body']['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x1524e8['id']}});}})['then'](function(){return _0x1524e8;})['then'](respondWithResult(_0x7e3ce6,null))[_0x328e('0x23')](handleError(_0x7e3ce6,null));};exports['getTags']=function(_0x369873,_0x11d65b){var _0x49d802={};var _0x3cbd3e={};var _0x33d619;var _0x208afd;return db['CmContact'][_0x328e('0x7a')]({'where':{'id':_0x369873['params']['id']}})[_0x328e('0x18')](handleEntityNotFound(_0x11d65b,null))[_0x328e('0x18')](function(_0x1a5fb4){if(_0x1a5fb4){_0x33d619=_0x1a5fb4;_0x3cbd3e[_0x328e('0x7b')]=_['keys'](db[_0x328e('0x66')][_0x328e('0x7c')]);_0x3cbd3e[_0x328e('0x21')]=_[_0x328e('0x26')](_0x369873[_0x328e('0x21')]);_0x3cbd3e[_0x328e('0x7d')]=_[_0x328e('0x7e')](_0x3cbd3e[_0x328e('0x7b')],_0x3cbd3e['query']);_0x49d802[_0x328e('0x7f')]=_[_0x328e('0x7e')](_0x3cbd3e['model'],qs['fields'](_0x369873['query'][_0x328e('0x80')]));_0x49d802['attributes']=_0x49d802[_0x328e('0x7f')][_0x328e('0x27')]?_0x49d802['attributes']:_0x3cbd3e[_0x328e('0x7b')];_0x49d802[_0x328e('0x81')]=qs['sort'](_0x369873[_0x328e('0x21')][_0x328e('0x82')]);_0x49d802[_0x328e('0x5c')]=qs[_0x328e('0x7d')](_['pick'](_0x369873['query'],_0x3cbd3e['filters']));if(_0x369873[_0x328e('0x21')]['filter']){_0x49d802['where']=_[_0x328e('0x33')](_0x49d802['where'],{'$or':_['map'](_0x49d802[_0x328e('0x7f')],function(_0x1b1bde){var _0x4380f1={};_0x4380f1[_0x1b1bde]={'$like':'%'+_0x369873[_0x328e('0x21')]['filter']+'%'};return _0x4380f1;})});}_0x49d802=_[_0x328e('0x33')]({},_0x49d802,_0x369873[_0x328e('0x83')]);return _0x33d619[_0x328e('0x84')](_0x49d802);}})[_0x328e('0x18')](function(_0x2f511a){if(_0x2f511a){_0x208afd=_0x2f511a[_0x328e('0x27')];if(!_0x369873[_0x328e('0x21')]['hasOwnProperty'](_0x328e('0x85'))){_0x49d802[_0x328e('0x12')]=qs[_0x328e('0x12')](_0x369873[_0x328e('0x21')][_0x328e('0x12')]);_0x49d802[_0x328e('0x11')]=qs[_0x328e('0x11')](_0x369873['query'][_0x328e('0x11')]);}return _0x33d619[_0x328e('0x84')](_0x49d802);}})[_0x328e('0x18')](function(_0x399c7d){if(_0x399c7d){return _0x399c7d?{'count':_0x208afd,'rows':_0x399c7d}:null;}})[_0x328e('0x18')](respondWithResult(_0x11d65b,null))[_0x328e('0x23')](handleError(_0x11d65b,null));};exports[_0x328e('0x86')]=function(_0x3f5c73,_0x15072e){if(_0x3f5c73['body']['id']){delete _0x3f5c73[_0x328e('0x34')]['id'];}return db[_0x328e('0x25')]['findOne']({'where':{'id':_0x3f5c73['params']['id']}})[_0x328e('0x18')](handleEntityNotFound(_0x15072e,null))[_0x328e('0x18')](function(_0x504634){if(_0x504634){return _0x504634[_0x328e('0x86')](_0x3f5c73[_0x328e('0x34')]['ids']||[]);}return null;})[_0x328e('0x18')](respondWithResult(_0x15072e,null))[_0x328e('0x23')](handleError(_0x15072e,null));};exports['setAdditionalPhones']=function(_0x3f5c47,_0x19bda7){var _0x310cd3=[];_0x310cd3['push'](addAdditionalPhones(_0x3f5c47['body']));Promise[_0x328e('0x63')](_0x310cd3)[_0x328e('0x18')](function(){_0x310cd3=[];_0x310cd3['push'](deleteCmHopperPhones(_0x3f5c47['body']['id']));_0x310cd3[_0x328e('0x5e')](addCmHopperPhones(_0x3f5c47['body']['id']));Promise[_0x328e('0x63')](_0x310cd3)[_0x328e('0x18')](function(){return[0x1];})[_0x328e('0x18')](respondWithResult(_0x19bda7,null));});};function addAdditionalPhones(_0x5a35bf){var _0x3f9cc8;return new Promise(function(_0x48148b){return db[_0x328e('0x69')][_0x328e('0x19')]({'where':{'CmContactId':_0x5a35bf['id']}})[_0x328e('0x18')](function(){db[_0x328e('0x6b')][_0x328e('0x2d')]({'raw':!![],'attributes':['id','OrderBy']})[_0x328e('0x18')](function(_0x1cd60f){var _0x3fe65f=[];for(var _0x3b753c=0x0;_0x3b753c<_0x5a35bf[_0x328e('0x87')][_0x328e('0x27')];_0x3b753c++){var _0x16ce8e=_0x5a35bf[_0x328e('0x88')]?_['isNil'](_0x5a35bf[_0x328e('0x88')][_0x3b753c])?'':_0x5a35bf[_0x328e('0x88')][_0x3b753c]:_0x5a35bf[_0x328e('0x87')][_0x3b753c][_0x328e('0x89')]?_0x5a35bf[_0x328e('0x87')][_0x3b753c][_0x328e('0x89')]:'';var _0x440195=_[_0x328e('0x55')](_0x5a35bf[_0x328e('0x87')][_0x3b753c][_0x328e('0x8a')])?'':_0x5a35bf['items'][_0x3b753c][_0x328e('0x8a')];var _0x49af00=_0x16ce8e+':'+_0x5a35bf['items'][_0x3b753c][_0x328e('0x78')]+'§'+_0x440195;if(_[_0x328e('0x55')](_0x3f9cc8))_0x3f9cc8=_0x49af00;else _0x3f9cc8+=';'+_0x49af00;var _0x266579=null;var _0x5709f6=null;if(_0x5a35bf['item_types']){if(!_[_0x328e('0x55')](_0x5a35bf[_0x328e('0x88')][_0x3b753c])){_0x5709f6=_[_0x328e('0x65')](_0x1cd60f,function(_0x2ee254){return _0x2ee254['id']===_0x5a35bf['item_types'][_0x3b753c];});if(!_[_0x328e('0x55')](_0x5709f6)){_0x266579=_0x5709f6[_0x328e('0x8b')];}}}else{if(!_[_0x328e('0x55')](_0x5a35bf[_0x328e('0x87')][_0x3b753c])){_0x5709f6=_[_0x328e('0x65')](_0x1cd60f,function(_0x3dff8b){return _0x3dff8b['id']===_0x5a35bf['items'][_0x3b753c][_0x328e('0x89')];});if(!_[_0x328e('0x55')](_0x5709f6)){_0x266579=_0x3b753c;}}}if(_[_0x328e('0x55')](_0x266579)){_0x266579=0x64;}_0x3fe65f['push'](addAdditionalPhone(_0x5a35bf['id'],_0x5a35bf[_0x328e('0x87')][_0x3b753c]['phone'],_0x5a35bf[_0x328e('0x88')]?_['isNil'](_0x5a35bf[_0x328e('0x88')][_0x3b753c])?null:_0x5a35bf['item_types'][_0x3b753c]:_0x5a35bf['items'][_0x3b753c][_0x328e('0x89')]?_0x5a35bf[_0x328e('0x87')][_0x3b753c][_0x328e('0x89')]:null,_0x266579,_0x440195));}Promise[_0x328e('0x63')](_0x3fe65f)[_0x328e('0x18')](function(){db[_0x328e('0x25')][_0x328e('0x17')]({'AdditionalPhones':_0x3f9cc8},{'where':{'id':_0x5a35bf['id']}})['then'](function(){_0x48148b(0x1);});});});});});}function addAdditionalPhone(_0xd3ab18,_0x271763,_0x43d339,_0x5e3fd,_0x40e107){return db[_0x328e('0x69')]['find']({'where':{'CmContactId':_0xd3ab18,'item':_0x271763}})[_0x328e('0x18')](function(_0x272b64){if(_0x272b64)logger['info']('contact\x20phone\x20exists',_0x272b64);else{db[_0x328e('0x69')][_0x328e('0x3f')]({'CmContactId':_0xd3ab18,'item':_0x271763,'ItemTypeId':_0x43d339,'OrderBy':_0x5e3fd,'ItemClass':_0x328e('0x8c'),'description':_0x40e107});}});}function deleteCmHopperPhones(_0x35948f){return new Promise(function(_0x597843){return db['CmHopper'][_0x328e('0x2d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x35948f}})[_0x328e('0x18')](function(_0x3cb470){db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':{'$in':_['map'](_0x3cb470,'id')}}});})[_0x328e('0x18')](function(){_0x597843(0x1);});});}function addCmHopperPhones(_0x4e549f){return new Promise(function(_0x495f4b){return db[_0x328e('0x79')][_0x328e('0x2d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4e549f}})[_0x328e('0x18')](function(_0x4e9b38){var _0xf838e4=[];_[_0x328e('0x6f')](_0x4e9b38,function(_0x38254d){_0xf838e4['push'](createCmHopperPhone(_0x4e549f,_0x38254d['id']));});Promise['all'](_0xf838e4)[_0x328e('0x18')](function(){_0x495f4b(0x1);});});});}function createCmHopperPhone(_0x24fe33,_0x228ecc){return new Promise(function(_0x22a139){db[_0x328e('0x69')][_0x328e('0x2d')]({'raw':!![],'attributes':['item',_0x328e('0x8b')],'where':{'CmContactId':_0x24fe33,'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'attributes':['OrderBy'],'as':'ItemType'}],'order':[_0x328e('0x8b'),db['sequelize'][_0x328e('0x8d')]('`ItemType`.OrderBy')]})[_0x328e('0x18')](function(_0x25b91c){var _0x2d6969=0x1;var _0xd6e1a6=_[_0x328e('0x6f')](_0x25b91c,function(_0x5a931b){_0x5a931b[_0x328e('0x8e')]=_0x228ecc;_0x5a931b[_0x328e('0x78')]=_0x5a931b[_0x328e('0x8f')];_0x5a931b[_0x328e('0x8b')]=_0x2d6969;delete _0x5a931b[_0x328e('0x90')];_0x2d6969=_0x2d6969+0x1;return _0x5a931b;});return db[_0x328e('0x91')][_0x328e('0x59')](_0xd6e1a6,{});})[_0x328e('0x18')](function(){_0x22a139(0x1);});});}function insertAdditionalPhones(_0x84f601,_0x2282ab){return new Promise(function(_0x3fbf7b){var _0x548531=[];for(var _0x272f4=0x0;_0x272f4<_0x2282ab['length'];_0x272f4++){var _0x240e6e=_0x2282ab[_0x272f4];_0x548531['push'](parseContactItemType(_0x240e6e));}Promise[_0x328e('0x63')](_0x548531)[_0x328e('0x18')](function(){var _0x2b2a78={'id':_0x84f601['id'],'items':_0x2282ab};return addAdditionalPhones(_0x2b2a78)['then'](function(){return addCmHopperPhones(_0x84f601['id']);});})['then'](function(){_0x3fbf7b(_0x84f601);});});}function parseContactItemType(_0x221959){return new Promise(function(_0x549065){if(_0x221959[_0x328e('0x61')](_0x328e('0x89'))){_0x549065(_0x221959);}else{return db[_0x328e('0x6b')][_0x328e('0x65')]({'where':{'name':_0x221959[_0x328e('0x92')]}})['then'](function(_0xccee5){if(_['isNil'](_0xccee5))_0x221959[_0x328e('0x89')]=null;else _0x221959[_0x328e('0x89')]=_0xccee5['id'];_0x549065(_0x221959);});}});}exports[_0x328e('0x93')]=function(_0x15e1a6,_0x1402c2){return db['CmContactHasItem'][_0x328e('0x2d')]({'raw':!![],'where':{'CmContactId':_0x15e1a6[_0x328e('0x24')]['id'],'ItemClass':_0x328e('0x8c')},'include':[{'model':db['ContactItemType'],'as':'ItemType'}],'order':[[_0x328e('0x8b')],[db[_0x328e('0x6c')][_0x328e('0x8d')](_0x328e('0x94'))]]})[_0x328e('0x18')](function(_0x19e389){return _0x19e389;})[_0x328e('0x18')](respondWithResult(_0x1402c2,null))[_0x328e('0x23')](handleError(_0x1402c2,null));};exports[_0x328e('0x95')]=function(_0x45527d,_0x4f2f19){return db[_0x328e('0x69')][_0x328e('0x2d')]({'raw':!![],'where':{'CmContactId':_0x45527d[_0x328e('0x34')][_0x328e('0x96')]}})['then'](function(_0x52c0a9){var _0x1ae7ef=_[_0x328e('0x6f')](_0x52c0a9,function(_0x5c2f6){_0x5c2f6[_0x328e('0x97')]=_0x45527d[_0x328e('0x34')][_0x328e('0x98')];return _0x5c2f6;});return db[_0x328e('0x69')][_0x328e('0x59')](_0x1ae7ef,{});})[_0x328e('0x18')](function(){return addCmHopperPhones(_0x45527d['body'][_0x328e('0x98')]);})['then'](function(){return['ok'];})[_0x328e('0x18')](respondWithResult(_0x4f2f19,null))[_0x328e('0x23')](handleError(_0x4f2f19,null));};exports['rescheduleAdditionalPhones']=function(_0x19af7f,_0x3d6aef){var _0x3451d1=[];_0x3451d1['push'](createCmHopperPhone(_0x19af7f[_0x328e('0x34')]['id'],_0x19af7f[_0x328e('0x34')][_0x328e('0x99')]));Promise[_0x328e('0x63')](_0x3451d1)[_0x328e('0x18')](function(){return[0x1];})[_0x328e('0x18')](respondWithResult(_0x3d6aef,null));};exports[_0x328e('0x9a')]=function(_0x3c68a2,_0x3e5b2b){var _0x44fc32={'raw':![],'where':{}};var _0x5a90dd={};var _0xbdca2a={'count':0x0,'rows':[]};return db[_0x328e('0x25')][_0x328e('0x7a')]({'where':{'id':_0x3c68a2['params']['id']}})[_0x328e('0x18')](handleEntityNotFound(_0x3e5b2b,null))['then'](function(_0x519da0){if(_0x519da0){_0x5a90dd[_0x328e('0x7b')]=_[_0x328e('0x26')](db[_0x328e('0x79')][_0x328e('0x7c')]);_0x5a90dd[_0x328e('0x21')]=_[_0x328e('0x26')](_0x3c68a2[_0x328e('0x21')]);_0x5a90dd[_0x328e('0x7d')]=_[_0x328e('0x7e')](_0x5a90dd[_0x328e('0x7b')],_0x5a90dd['query']);_0x44fc32[_0x328e('0x7f')]=_['intersection'](_0x5a90dd[_0x328e('0x7b')],qs['fields'](_0x3c68a2['query'][_0x328e('0x80')]));_0x44fc32[_0x328e('0x7f')]=_0x44fc32[_0x328e('0x7f')]['length']?_0x44fc32[_0x328e('0x7f')]:_0x5a90dd[_0x328e('0x7b')];if(!_0x3c68a2[_0x328e('0x21')][_0x328e('0x61')]('nolimit')){_0x44fc32['limit']=qs[_0x328e('0x12')](_0x3c68a2[_0x328e('0x21')][_0x328e('0x12')]);_0x44fc32[_0x328e('0x11')]=qs[_0x328e('0x11')](_0x3c68a2[_0x328e('0x21')][_0x328e('0x11')]);}_0x44fc32[_0x328e('0x81')]=qs[_0x328e('0x82')](_0x3c68a2[_0x328e('0x21')]['sort']);_0x44fc32[_0x328e('0x5c')]=qs[_0x328e('0x7d')](_[_0x328e('0x9b')](_0x3c68a2[_0x328e('0x21')],_0x5a90dd[_0x328e('0x7d')]));_0x44fc32[_0x328e('0x5c')][_0x328e('0x9c')]=_0x519da0['id'];if(_0x3c68a2[_0x328e('0x21')]['filter']){_0x44fc32[_0x328e('0x5c')]=_[_0x328e('0x33')](_0x44fc32[_0x328e('0x5c')],{'$or':_[_0x328e('0x6f')](_0x44fc32['attributes'],function(_0x33db97){var _0x1bd469={};_0x1bd469[_0x33db97]={'$like':'%'+_0x3c68a2[_0x328e('0x21')][_0x328e('0x9d')]+'%'};return _0x1bd469;})});}_0x44fc32=_[_0x328e('0x33')]({},_0x44fc32,_0x3c68a2[_0x328e('0x83')]);return db['CmHopper'][_0x328e('0x14')]({'where':_0x44fc32[_0x328e('0x5c')]})[_0x328e('0x18')](function(_0x2e819a){_0xbdca2a[_0x328e('0x14')]=_0x2e819a;if(_0x3c68a2[_0x328e('0x21')][_0x328e('0x9e')]){_0x44fc32[_0x328e('0x9f')]=[{'all':!![]}];}return db[_0x328e('0x79')][_0x328e('0x2d')](_0x44fc32);})[_0x328e('0x18')](function(_0x2a8261){_0xbdca2a[_0x328e('0xa0')]=_0x2a8261;return _0xbdca2a;});}})[_0x328e('0x18')](respondWithFilteredResult(_0x3e5b2b,_0x44fc32))['catch'](handleError(_0x3e5b2b,null));};exports[_0x328e('0xa1')]=function(_0x1b25a2,_0x3dbcf4){var _0x13e603={'raw':!![],'where':{}};var _0x38c8fe={};var _0x36a046={'count':0x0,'rows':[]};return db['CmContact'][_0x328e('0x7a')]({'where':{'id':_0x1b25a2['params']['id']}})[_0x328e('0x18')](handleEntityNotFound(_0x3dbcf4,null))[_0x328e('0x18')](function(_0x191fe1){if(_0x191fe1){_0x38c8fe[_0x328e('0x7b')]=_[_0x328e('0x26')](db['CmHopperHistory'][_0x328e('0x7c')]);_0x38c8fe[_0x328e('0x21')]=_[_0x328e('0x26')](_0x1b25a2[_0x328e('0x21')]);_0x38c8fe[_0x328e('0x7d')]=_[_0x328e('0x7e')](_0x38c8fe['model'],_0x38c8fe[_0x328e('0x21')]);_0x13e603[_0x328e('0x7f')]=_[_0x328e('0x7e')](_0x38c8fe[_0x328e('0x7b')],qs[_0x328e('0x80')](_0x1b25a2[_0x328e('0x21')][_0x328e('0x80')]));_0x13e603[_0x328e('0x7f')]=_0x13e603[_0x328e('0x7f')]['length']?_0x13e603['attributes']:_0x38c8fe['model'];if(!_0x1b25a2[_0x328e('0x21')]['hasOwnProperty'](_0x328e('0x85'))){_0x13e603[_0x328e('0x12')]=qs[_0x328e('0x12')](_0x1b25a2[_0x328e('0x21')][_0x328e('0x12')]);_0x13e603[_0x328e('0x11')]=qs['offset'](_0x1b25a2['query'][_0x328e('0x11')]);}_0x13e603['order']=qs[_0x328e('0x82')](_0x1b25a2['query'][_0x328e('0x82')]);_0x13e603[_0x328e('0x5c')]=qs[_0x328e('0x7d')](_['pick'](_0x1b25a2['query'],_0x38c8fe[_0x328e('0x7d')]));_0x13e603[_0x328e('0x5c')]['ContactId']=_0x191fe1['id'];if(_0x1b25a2[_0x328e('0x21')][_0x328e('0x9d')]){_0x13e603['where']=_[_0x328e('0x33')](_0x13e603['where'],{'$or':_['map'](_0x13e603['attributes'],function(_0xa28360){var _0x3e19ee={};_0x3e19ee[_0xa28360]={'$like':'%'+_0x1b25a2['query'][_0x328e('0x9d')]+'%'};return _0x3e19ee;})});}_0x13e603=_[_0x328e('0x33')]({},_0x13e603,_0x1b25a2[_0x328e('0x83')]);return db[_0x328e('0x4b')][_0x328e('0x14')]({'where':_0x13e603[_0x328e('0x5c')]})['then'](function(_0x5d4a22){_0x36a046['count']=_0x5d4a22;if(_0x1b25a2[_0x328e('0x21')][_0x328e('0x9e')]){_0x13e603[_0x328e('0x9f')]=[{'all':!![]}];}return db[_0x328e('0x4b')][_0x328e('0x2d')](_0x13e603);})[_0x328e('0x18')](function(_0x2b1e5b){_0x36a046[_0x328e('0xa0')]=_0x2b1e5b;return _0x36a046;});}})[_0x328e('0x18')](respondWithFilteredResult(_0x3dbcf4,_0x13e603))[_0x328e('0x23')](handleError(_0x3dbcf4,null));};exports['getHopperFinals']=function(_0x294a3d,_0x7b7b68){var _0x5e9b59={'raw':!![],'where':{}};var _0x35ffc6={};var _0x3f0c6a={'count':0x0,'rows':[]};return db['CmContact'][_0x328e('0x7a')]({'where':{'id':_0x294a3d[_0x328e('0x24')]['id']}})[_0x328e('0x18')](handleEntityNotFound(_0x7b7b68,null))['then'](function(_0x183ec2){if(_0x183ec2){_0x35ffc6['model']=_[_0x328e('0x26')](db[_0x328e('0x4a')][_0x328e('0x7c')]);_0x35ffc6[_0x328e('0x21')]=_[_0x328e('0x26')](_0x294a3d[_0x328e('0x21')]);_0x35ffc6[_0x328e('0x7d')]=_[_0x328e('0x7e')](_0x35ffc6[_0x328e('0x7b')],_0x35ffc6['query']);_0x5e9b59[_0x328e('0x7f')]=_[_0x328e('0x7e')](_0x35ffc6[_0x328e('0x7b')],qs[_0x328e('0x80')](_0x294a3d[_0x328e('0x21')][_0x328e('0x80')]));_0x5e9b59[_0x328e('0x7f')]=_0x5e9b59[_0x328e('0x7f')][_0x328e('0x27')]?_0x5e9b59[_0x328e('0x7f')]:_0x35ffc6['model'];if(!_0x294a3d['query']['hasOwnProperty'](_0x328e('0x85'))){_0x5e9b59['limit']=qs['limit'](_0x294a3d[_0x328e('0x21')][_0x328e('0x12')]);_0x5e9b59[_0x328e('0x11')]=qs['offset'](_0x294a3d[_0x328e('0x21')]['offset']);}_0x5e9b59[_0x328e('0x81')]=qs[_0x328e('0x82')](_0x294a3d[_0x328e('0x21')][_0x328e('0x82')]);_0x5e9b59['where']=qs[_0x328e('0x7d')](_[_0x328e('0x9b')](_0x294a3d[_0x328e('0x21')],_0x35ffc6[_0x328e('0x7d')]));_0x5e9b59[_0x328e('0x5c')][_0x328e('0x9c')]=_0x183ec2['id'];if(_0x294a3d[_0x328e('0x21')][_0x328e('0x9d')]){_0x5e9b59[_0x328e('0x5c')]=_['merge'](_0x5e9b59[_0x328e('0x5c')],{'$or':_[_0x328e('0x6f')](_0x5e9b59[_0x328e('0x7f')],function(_0x45c0db){var _0x3d5a06={};_0x3d5a06[_0x45c0db]={'$like':'%'+_0x294a3d['query'][_0x328e('0x9d')]+'%'};return _0x3d5a06;})});}_0x5e9b59=_[_0x328e('0x33')]({},_0x5e9b59,_0x294a3d[_0x328e('0x83')]);return db[_0x328e('0x4a')][_0x328e('0x14')]({'where':_0x5e9b59[_0x328e('0x5c')]})[_0x328e('0x18')](function(_0x153ad2){_0x3f0c6a['count']=_0x153ad2;if(_0x294a3d[_0x328e('0x21')][_0x328e('0x9e')]){_0x5e9b59[_0x328e('0x9f')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x328e('0x2d')](_0x5e9b59);})['then'](function(_0xc37d4f){_0x3f0c6a[_0x328e('0xa0')]=_0xc37d4f;return _0x3f0c6a;});}})[_0x328e('0x18')](respondWithFilteredResult(_0x7b7b68,_0x5e9b59))[_0x328e('0x23')](handleError(_0x7b7b68,null));};exports[_0x328e('0xa2')]=function(_0x25b4a5,_0x40824a){var _0x179ff1={'raw':!![],'where':{}};var _0x2a5948={};var _0xe561af={'count':0x0,'rows':[]};return db['CmContact'][_0x328e('0x7a')]({'where':{'id':_0x25b4a5[_0x328e('0x24')]['id']}})[_0x328e('0x18')](handleEntityNotFound(_0x40824a,null))[_0x328e('0x18')](function(_0x114929){if(_0x114929){_0x2a5948['model']=_['keys'](db[_0x328e('0xa3')]['rawAttributes']);_0x2a5948[_0x328e('0x21')]=_[_0x328e('0x26')](_0x25b4a5[_0x328e('0x21')]);_0x2a5948[_0x328e('0x7d')]=_['intersection'](_0x2a5948[_0x328e('0x7b')],_0x2a5948['query']);_0x179ff1[_0x328e('0x7f')]=_[_0x328e('0x7e')](_0x2a5948[_0x328e('0x7b')],qs[_0x328e('0x80')](_0x25b4a5[_0x328e('0x21')][_0x328e('0x80')]));_0x179ff1[_0x328e('0x7f')]=_0x179ff1[_0x328e('0x7f')][_0x328e('0x27')]?_0x179ff1[_0x328e('0x7f')]:_0x2a5948[_0x328e('0x7b')];if(!_0x25b4a5[_0x328e('0x21')]['hasOwnProperty'](_0x328e('0x85'))){_0x179ff1['limit']=qs[_0x328e('0x12')](_0x25b4a5[_0x328e('0x21')][_0x328e('0x12')]);_0x179ff1[_0x328e('0x11')]=qs[_0x328e('0x11')](_0x25b4a5[_0x328e('0x21')][_0x328e('0x11')]);}_0x179ff1[_0x328e('0x81')]=qs[_0x328e('0x82')](_0x25b4a5['query'][_0x328e('0x82')]);_0x179ff1[_0x328e('0x5c')]=qs[_0x328e('0x7d')](_['pick'](_0x25b4a5[_0x328e('0x21')],_0x2a5948[_0x328e('0x7d')]));_0x179ff1[_0x328e('0x5c')][_0x328e('0x9c')]=_0x114929['id'];if(_0x25b4a5[_0x328e('0x21')]['filter']){_0x179ff1[_0x328e('0x5c')]=_[_0x328e('0x33')](_0x179ff1[_0x328e('0x5c')],{'$or':_[_0x328e('0x6f')](_0x179ff1[_0x328e('0x7f')],function(_0x182277){var _0x31fd62={};_0x31fd62[_0x182277]={'$like':'%'+_0x25b4a5[_0x328e('0x21')][_0x328e('0x9d')]+'%'};return _0x31fd62;})});}_0x179ff1=_[_0x328e('0x33')]({},_0x179ff1,_0x25b4a5['options']);return db[_0x328e('0xa3')][_0x328e('0x14')]({'where':_0x179ff1[_0x328e('0x5c')]})['then'](function(_0x2dbb45){_0xe561af[_0x328e('0x14')]=_0x2dbb45;if(_0x25b4a5[_0x328e('0x21')]['includeAll']){_0x179ff1[_0x328e('0x9f')]=[{'all':!![]}];}return db[_0x328e('0xa3')][_0x328e('0x2d')](_0x179ff1);})[_0x328e('0x18')](function(_0xd56270){_0xe561af[_0x328e('0xa0')]=_0xd56270;return _0xe561af;});}})[_0x328e('0x18')](respondWithFilteredResult(_0x40824a,_0x179ff1))[_0x328e('0x23')](handleError(_0x40824a,null));};exports[_0x328e('0xa4')]=function(_0x219858,_0x445464){try{if(!_0x219858[_0x328e('0x34')][_0x328e('0x5f')]){throw new Error(_0x328e('0xa5'));}if(!_0x219858[_0x328e('0x34')][_0x328e('0xa6')]){throw new Error(_0x328e('0xa7'));}if(!_0x219858[_0x328e('0x34')][_0x328e('0xa8')]){throw new Error(_0x328e('0xa9'));}if(!_0x219858[_0x328e('0x34')]['socket_timestamp']){throw new Error(_0x328e('0xaa'));}var _0x2bd508=_0x219858[_0x328e('0x34')][_0x328e('0xa6')][_0x328e('0xab')](',');var _0x4641f6=_0x219858['body']['binding_values'][_0x328e('0xab')](',');if(!_0x2bd508[_0x328e('0x27')]||!_0x4641f6[_0x328e('0x27')]||_0x2bd508[_0x328e('0x27')]!==_0x4641f6[_0x328e('0x27')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x219858['body'][_0x328e('0x80')]=_['zipObject'](_0x2bd508,_0x4641f6);if(!_0x219858['body'][_0x328e('0x80')][_0x328e('0x78')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x219858[_0x328e('0x34')]['fields']['firstName']){throw new Error(_0x328e('0xac'));}var _0x5eb971=path['join'](config[_0x328e('0xad')],_0x328e('0xae'),_0x219858[_0x328e('0xaf')][_0x328e('0xb0')]);fs['chmodSync'](_0x5eb971,parseInt(_0x328e('0xb1'),0x8));var _0x2c0bbc=require('child_process')[_0x328e('0xb2')](path['join'](__dirname,'../../components/import/cm/csv'),[_0x5eb971,_0x219858['body'][_0x328e('0xa6')],_0x219858[_0x328e('0x34')]['binding_values'],_0x219858[_0x328e('0x34')][_0x328e('0x5f')],_0x219858[_0x328e('0x34')][_0x328e('0xb3')],_0x219858['body'][_0x328e('0x5b')],_0x219858[_0x328e('0x34')][_0x328e('0xb4')]]);return _0x445464['status'](0xc8)[_0x328e('0xb5')]({'message':_0x328e('0xb6'),'pid':_0x2c0bbc[_0x328e('0xb7')]});}catch(_0x14c0fa){return _0x445464[_0x328e('0x10')](0x1f4)[_0x328e('0x1e')](_0x14c0fa);}};exports[_0x328e('0xb8')]=function(_0x17b3f0,_0xe06fe5){var _0x3696ee=fs[_0x328e('0xb9')](_0x17b3f0[_0x328e('0xaf')][_0x328e('0x1')]);Papa[_0x328e('0xba')](_0x3696ee,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x226821){return _0xe06fe5[_0x328e('0x10')](0xc8)[_0x328e('0xb5')]({'file':_0x17b3f0[_0x328e('0xaf')],'fields':_0x226821[_0x328e('0xbb')][_0x328e('0x80')]});}});};exports[_0x328e('0xbc')]=function(_0x1eef28,_0x4d4998){return db[_0x328e('0xbd')][_0x328e('0x2d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x328e('0xbe')}})['then'](function(_0x2080a7){var _0x409ee4=![];if(!_0x1eef28[_0x328e('0x34')]['ListId']){throw new Error(_0x328e('0xa5'));}if(!_0x1eef28[_0x328e('0x34')][_0x328e('0xbf')][_0x328e('0x78')]){throw new Error(_0x328e('0xc0'));}if(!_0x1eef28['body'][_0x328e('0xbf')][_0x328e('0xc1')]){throw new Error(_0x328e('0xac'));}if(!_0x1eef28[_0x328e('0x34')][_0x328e('0xb4')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x1b5317=require(_0x328e('0xc2'))[_0x328e('0xb2')](path[_0x328e('0x39')](__dirname,_0x328e('0xc3')),[_0x1eef28[_0x328e('0x24')]['id'],JSON['stringify'](_0x1eef28['body']),JSON[_0x328e('0xc4')](_0x2080a7)]);_0x1b5317['on'](_0x328e('0xc5'),function(){_0x409ee4=!![];return _0x4d4998[_0x328e('0x10')](0xc8)[_0x328e('0xb5')]({'message':_0x328e('0xc6'),'pid':_0x1b5317[_0x328e('0xb7')]});});_0x1b5317['on'](_0x328e('0xc7'),function(_0x138f0b){if(_0x138f0b&&!_0x409ee4){return _0x4d4998[_0x328e('0x10')](0x1f4)[_0x328e('0xb5')]({'message':_0x328e('0xc8'),'pid':_0x1b5317[_0x328e('0xb7')]});}});})[_0x328e('0x23')](handleError(_0x4d4998,null));};exports[_0x328e('0xc9')]=function(_0x55b8fc,_0x1c8f7c){return db[_0x328e('0xbd')][_0x328e('0x2d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x328e('0xbe')}})[_0x328e('0x18')](function(_0x169b3f){var _0x2383a2=![];if(!_0x55b8fc[_0x328e('0x34')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x55b8fc[_0x328e('0x34')][_0x328e('0xbf')]['phone']){throw new Error(_0x328e('0xc0'));}if(!_0x55b8fc['body'][_0x328e('0xbf')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x55b8fc[_0x328e('0x34')][_0x328e('0xb4')]){throw new Error(_0x328e('0xaa'));}var _0x581c6c=require(_0x328e('0xc2'))[_0x328e('0xb2')](path[_0x328e('0x39')](__dirname,_0x328e('0xca')),[_0x55b8fc[_0x328e('0x24')]['id'],JSON[_0x328e('0xc4')](_0x55b8fc[_0x328e('0x34')]),JSON[_0x328e('0xc4')](_0x169b3f)]);_0x581c6c['on']('message',function(){_0x2383a2=!![];return _0x1c8f7c[_0x328e('0x10')](0xc8)[_0x328e('0xb5')]({'message':_0x328e('0xc6'),'pid':_0x581c6c['pid']});});_0x581c6c['on'](_0x328e('0xc7'),function(_0x1997e0){if(_0x1997e0&&!_0x2383a2){return _0x1c8f7c[_0x328e('0x10')](0x1f4)['json']({'message':_0x328e('0xc8'),'pid':_0x581c6c['pid']});}});})[_0x328e('0x23')](handleError(_0x1c8f7c,null));};exports[_0x328e('0xcb')]=function(_0x5828cd,_0x58d1eb){var _0x35562f=[_0x328e('0xcc'),'chat','sms',_0x328e('0xcd'),_0x328e('0xce'),_0x328e('0xcf'),'voice'];var _0x3ecaa6={'offset':0x0,'order':qs[_0x328e('0x82')](_0x328e('0xd0'))},_0x3981fc={'count':0x0,'rows':[]};Promise[_0x328e('0xd1')]()[_0x328e('0x18')](function(){if(_0x5828cd['query']['channel']){if(!_[_0x328e('0xd2')](_0x35562f,_0x5828cd[_0x328e('0x21')][_0x328e('0xd3')][_0x328e('0xd4')]())){throw new Error('Invalid\x20channel');}_0x35562f=[_0x5828cd[_0x328e('0x21')][_0x328e('0xd3')][_0x328e('0xd4')]()];}if(_0x5828cd['query'][_0x328e('0xd5')]){try{var _0x43ac06=JSON[_0x328e('0xba')](_0x5828cd[_0x328e('0x21')]['range']);if(!moment(_0x43ac06[_0x328e('0x35')])['isValid']()){throw new Error(_0x328e('0xd6'));}if(!moment(_0x43ac06['to'])[_0x328e('0xd7')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x255c09){throw new Error(_0x328e('0xd8'));}}if(!_0x5828cd[_0x328e('0x21')]['hasOwnProperty'](_0x328e('0x85'))){_0x3ecaa6[_0x328e('0x12')]=qs[_0x328e('0x12')](_0x5828cd['query'][_0x328e('0x12')]||0xa);_0x3ecaa6[_0x328e('0x11')]=qs[_0x328e('0x11')](_0x5828cd['query'][_0x328e('0x11')]);}var _0x51fa4b=_0x35562f['map'](function(_0x51c70c){if(_0x51c70c===_0x328e('0xd9')){var _0x428842={'attributes':['id',_0x328e('0xda'),_0x328e('0x2f'),_0x328e('0xdb'),_0x328e('0xdc'),_0x328e('0xdd'),'starttime',_0x328e('0xde'),_0x328e('0xdf'),_0x328e('0xe0'),_0x328e('0xe1'),'userDisposition',_0x328e('0xe2'),_0x328e('0xe3'),_0x328e('0xe4')],'where':{'ContactId':_0x5828cd[_0x328e('0x24')]['id']},'include':[{'model':db[_0x328e('0xbd')],'as':_0x328e('0xbd'),'attributes':['id','name',_0x328e('0xe5'),_0x328e('0xe6')]}],'order':[[_0x328e('0xe1'),_0x328e('0xe7')]]};if(_0x5828cd[_0x328e('0x21')][_0x328e('0xd5')]){_0x428842[_0x328e('0x5c')][_0x328e('0xe1')]={'$gte':_0x43ac06[_0x328e('0x35')],'$lte':_0x43ac06['to']};}return db['VoiceCallReport']['findAndCountAll'](_0x428842)['then'](function(_0xb3cb71){_0x3981fc['count']+=_0xb3cb71[_0x328e('0x14')];return _['map'](_0xb3cb71['rows'],function(_0x3e5846){var _0x4a5709=_0x3e5846[_0x328e('0x36')]({'plain':!![]});_0x4a5709[_0x328e('0xd3')]=_0x51c70c;if(_0x4a5709[_0x328e('0xbd')]){_0x4a5709[_0x328e('0xbd')]={'id':_0x4a5709['User']['id'],'name':_0x4a5709['User']['name'],'fullname':_0x4a5709['User'][_0x328e('0xe5')],'alias':_0x4a5709[_0x328e('0xbd')][_0x328e('0xe6')]};}return _0x4a5709;});});}else{var _0x46edda=_[_0x328e('0xe8')](_0x51c70c)+(_0x51c70c===_0x328e('0xe9')?_0x328e('0xea'):_0x328e('0xeb'));var _0x52fa1b={'attributes':['id',_0x328e('0xec'),_0x328e('0xed'),_0x328e('0xe1'),_0x328e('0xe0'),_0x328e('0xee'),_0x328e('0xef'),_0x328e('0xf0'),_0x328e('0xe4'),_0x46edda+'Id'],'where':{'ContactId':_0x5828cd['params']['id']},'include':[{'model':db[_0x46edda],'as':_0x328e('0xeb'),'attributes':['id',_0x328e('0x1d'),_0x328e('0xf1')]},{'model':db[_0x328e('0xbd')],'as':_0x328e('0xf2'),'attributes':['id',_0x328e('0x1d'),_0x328e('0xe5')]},{'model':db['Tag'],'as':_0x328e('0x67'),'attributes':['id',_0x328e('0x1d'),_0x328e('0x68')],'through':{'attributes':[]}}],'order':[[_0x328e('0xe1'),_0x328e('0xe7')]]};if(_0x5828cd[_0x328e('0x21')][_0x328e('0xd5')]){_0x52fa1b[_0x328e('0x5c')][_0x328e('0xe1')]={'$gte':_0x43ac06['from'],'$lte':_0x43ac06['to']};}switch(_0x51c70c){case _0x328e('0xe9'):_0x52fa1b[_0x328e('0x7f')][_0x328e('0x5e')](_0x328e('0xf3'),_0x328e('0xf4'),'customerPort',_0x328e('0xf5'),'osName',_0x328e('0xf6'),'ratingType',_0x328e('0xf7'),_0x328e('0xf8'));break;case'mail':_0x52fa1b[_0x328e('0x7f')][_0x328e('0x5e')](_0x328e('0xf9'),_0x328e('0xfa'));break;case _0x328e('0xcd'):_0x52fa1b[_0x328e('0x7f')][_0x328e('0x5e')](_0x328e('0xfb'),_0x328e('0xfc'));break;}return db[_['startCase'](_0x51c70c)+_0x328e('0xfd')][_0x328e('0xfe')](_0x52fa1b)[_0x328e('0x18')](function(_0x3e370c){_0x3981fc[_0x328e('0x14')]+=_0x3e370c['count'];return _[_0x328e('0x6f')](_0x3e370c[_0x328e('0xa0')],function(_0x31e1fb){var _0x3531a8=_0x31e1fb[_0x328e('0x36')]({'plain':!![]});_0x3531a8[_0x328e('0xd3')]=_0x51c70c;if(_0x3531a8[_0x328e('0xf2')]){_0x3531a8[_0x328e('0xf2')]={'id':_0x3531a8[_0x328e('0xf2')]['id'],'name':_0x3531a8[_0x328e('0xf2')][_0x328e('0x1d')],'fullname':_0x3531a8[_0x328e('0xf2')][_0x328e('0xe5')]};}return _0x3531a8;});});}});return Promise['all'](_0x51fa4b);})['then'](function(_0x2a1c8a){return _(_0x2a1c8a)['flatten']()[_0x328e('0xff')]('createdAt')[_0x328e('0x100')]()['value']();})[_0x328e('0x18')](function(_0x177b1e){_0x3981fc[_0x328e('0xa0')]=_0x3ecaa6[_0x328e('0x12')]?_0x177b1e[_0x328e('0x101')](_0x3ecaa6[_0x328e('0x11')],_0x3ecaa6['offset']+_0x3ecaa6[_0x328e('0x12')]):_0x177b1e;return _0x3981fc;})['then'](respondWithFilteredResult(_0x58d1eb,_0x3ecaa6))['catch'](handleError(_0x58d1eb,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index fde6d2f..1cb13b6 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 _0x36d4=['remove','emit','hook','exports','events','../../mysqldb','save'];(function(_0x5d2288,_0x352f6c){var _0x633f73=function(_0x4c26cf){while(--_0x4c26cf){_0x5d2288['push'](_0x5d2288['shift']());}};_0x633f73(++_0x352f6c);}(_0x36d4,0x6d));var _0x436d=function(_0x178f52,_0x5d9675){_0x178f52=_0x178f52-0x0;var _0x556f99=_0x36d4[_0x178f52];return _0x556f99;};'use strict';var EventEmitter=require(_0x436d('0x0'));var CmContact=require(_0x436d('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x436d('0x2'),'afterUpdate':'update','afterDestroy':_0x436d('0x3')};function emitEvent(_0x4e8af0){return function(_0x2f72e0,_0x4ddeec,_0x13d28c){CmContactEvents[_0x436d('0x4')](_0x4e8af0+':'+_0x2f72e0['id'],_0x2f72e0);CmContactEvents[_0x436d('0x4')](_0x4e8af0,_0x2f72e0);_0x13d28c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x436d('0x5')](e,emitEvent(event));}}module[_0x436d('0x6')]=CmContactEvents; \ No newline at end of file +var _0xa3cb=['exports','events','CmContact','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x45cd59,_0x5be7c0){var _0x39541a=function(_0xab724a){while(--_0xab724a){_0x45cd59['push'](_0x45cd59['shift']());}};_0x39541a(++_0x5be7c0);}(_0xa3cb,0xac));var _0xba3c=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xa3cb[_0x4b7895];return _0x264180;};'use strict';var EventEmitter=require(_0xba3c('0x0'));var CmContact=require('../../mysqldb')['db'][_0xba3c('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xba3c('0x2')](0x0);var events={'afterCreate':_0xba3c('0x3'),'afterUpdate':'update','afterDestroy':_0xba3c('0x4')};function emitEvent(_0x1f5088){return function(_0x1dc077,_0x41e206,_0x1122a5){CmContactEvents[_0xba3c('0x5')](_0x1f5088+':'+_0x1dc077['id'],_0x1dc077);CmContactEvents['emit'](_0x1f5088,_0x1dc077);_0x1122a5(null);};}for(var e in events){if(events[_0xba3c('0x6')](e)){var event=events[e];CmContact[_0xba3c('0x7')](e,emitEvent(event));}}module[_0xba3c('0x8')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index d767a77..20c2230 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 _0xd38d=['CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','CmHopper','create','dialCheckDuplicateType','always','onlyIfOpen','findAll','outbound','CmList','Lists','map','all','CmHopperBlack','exports','define','CmContact','fti_cm_contacts','mobile','utf8mb4','models','get','error','catch','isEmpty','destroy','push','info','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','moment','../../config/environment/shared','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve','findOne','then','timezones','utcOffset','add','minutes','phone','ListId','format','priority','callbackUniqueid','assign','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20'];(function(_0x2f24ee,_0x2b15b9){var _0x50dbd5=function(_0x339a6d){while(--_0x339a6d){_0x2f24ee['push'](_0x2f24ee['shift']());}};_0x50dbd5(++_0x2b15b9);}(_0xd38d,0x189));var _0xdd38=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xd38d[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xdd38('0x0'));var util=require(_0xdd38('0x1'));var logger=require(_0xdd38('0x2'))('api');var moment=require(_0xdd38('0x3'));var shared=require(_0xdd38('0x4'));var attributes=require(_0xdd38('0x5'));function getTimezoneCallbackAt(_0x4af559,_0x6ba13e,_0xc62d25,_0x1340b8){var _0x31a878=_0x1340b8?_0xdd38('0x6'):_0xdd38('0x7');var _0x973d4d=_0xc62d25[_0xdd38('0x8')]?_0xc62d25[_0xdd38('0x8')]:moment()['format'](_0xdd38('0x9'));if(_[_0xdd38('0xa')](_0xc62d25[_0xdd38('0xb')])){return Promise[_0xdd38('0xc')](_0x973d4d);}return _0x4af559[_0x31a878][_0xdd38('0xd')]({'where':{'id':_0x6ba13e}})[_0xdd38('0xe')](function(_0x32f873){if(_['isNil'](_0x32f873)||_[_0xdd38('0xa')](_0x32f873[_0xdd38('0xb')])){return Promise['resolve'](_0x973d4d);}var _0x2dc0f0=shared[_0xdd38('0xf')];var _0x37690b=_0x2dc0f0[_0x32f873[_0xdd38('0xb')]];var _0xd2974f=_0x2dc0f0[_0xc62d25[_0xdd38('0xb')]];if(_[_0xdd38('0xa')](_0x37690b)&&_[_0xdd38('0xa')](_0xd2974f)){return Promise['resolve'](_0x973d4d);}var _0x252f05=_0x37690b[_0xdd38('0x10')]-_0xd2974f['utcOffset'];var _0x288fe6=_0xc62d25[_0xdd38('0x8')]?_0xc62d25[_0xdd38('0x8')]:moment();_0x973d4d=moment(_0x288fe6)[_0xdd38('0x11')](_0x252f05,_0xdd38('0x12'))['format'](_0xdd38('0x9'));return Promise['resolve'](_0x973d4d);});}function getNewHopperPayload(_0x2cc0b6){return{'phone':_0x2cc0b6[_0xdd38('0x13')],'ContactId':_0x2cc0b6['id'],'ListId':_0x2cc0b6[_0xdd38('0x14')],'scheduledat':_0x2cc0b6[_0xdd38('0x8')]?_0x2cc0b6[_0xdd38('0x8')]:moment()[_0xdd38('0x15')](_0xdd38('0x9')),'priority':_0x2cc0b6[_0xdd38('0x16')]?_0x2cc0b6['priority']:0x2,'callback':_0x2cc0b6[_0xdd38('0x17')]?!![]:![],'callbackuniqueid':_0x2cc0b6[_0xdd38('0x17')]?_0x2cc0b6[_0xdd38('0x17')]:undefined,'callbackat':_0x2cc0b6[_0xdd38('0x17')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined};}function handleAlwaysCheckDuplicate(_0x3deb36,_0x3f7918,_0x284e11,_0x322687){var _0x50476a={'phone':_0x284e11[_0xdd38('0x13')]};var _0x55f265={'calleridnum':_0x284e11[_0xdd38('0x13')]};if(_0x322687){Object[_0xdd38('0x18')](_0x50476a,{'CampaignId':_0x3f7918['id']});Object[_0xdd38('0x18')](_0x55f265,{'CampaignId':_0x3f7918['id']});}else{Object[_0xdd38('0x18')](_0x50476a,{'VoiceQueueId':_0x3f7918['id']});Object['assign'](_0x55f265,{'VoiceQueueId':_0x3f7918['id']});}return _0x3deb36['CmHopper'][_0xdd38('0xd')]({'where':_0x50476a})[_0xdd38('0xe')](function(_0x2211e9){if(_0x2211e9){throw new Error(_0xdd38('0x19')+_0x284e11[_0xdd38('0x13')]+_0xdd38('0x1a')+_0x3f7918['id']);}return _0x3deb36[_0xdd38('0x1b')][_0xdd38('0xd')]({'where':_0x55f265});})[_0xdd38('0xe')](function(_0x6afdd8){if(_0x6afdd8){throw new Error(_0xdd38('0x1c')+_0x284e11[_0xdd38('0x13')]+_0xdd38('0x1a')+_0x3f7918['id']);}var _0x401bba=getNewHopperPayload(_0x284e11);if(_0x322687){_0x401bba[_0xdd38('0x1d')]=_0x3f7918['id'];}else{_0x401bba['VoiceQueueId']=_0x3f7918['id'];}return _0x3deb36['CmHopper']['create'](_0x401bba);});}function handleOnlyIfOpenCheckDuplicate(_0x3ca8be,_0x4ac6eb,_0x3e4885,_0x1769d3){var _0x161403={'phone':_0x3e4885[_0xdd38('0x13')]};if(_0x1769d3){Object[_0xdd38('0x18')](_0x161403,{'CampaignId':_0x4ac6eb['id']});}else{Object[_0xdd38('0x18')](_0x161403,{'VoiceQueueId':_0x4ac6eb['id']});}return _0x3ca8be['CmHopper'][_0xdd38('0xd')]({'where':_0x161403})['then'](function(_0x15ec2f){if(_0x15ec2f){throw new Error(_0xdd38('0x1e')+_0x3e4885[_0xdd38('0x13')]+_0xdd38('0x1a')+_0x4ac6eb['id']);}var _0x354c71=getNewHopperPayload(_0x3e4885);if(_0x1769d3){_0x354c71[_0xdd38('0x1d')]=_0x4ac6eb['id'];}else{_0x354c71[_0xdd38('0x1f')]=_0x4ac6eb['id'];}return _0x3ca8be[_0xdd38('0x20')][_0xdd38('0x21')](_0x354c71);});}function handleNeverCheckDuplicate(_0x2272b2,_0x2bc0dd,_0x5edf82){var _0xe42874=getNewHopperPayload(_0x5edf82);_0xe42874[_0xdd38('0x1f')]=_0x2bc0dd['id'];return _0x2272b2[_0xdd38('0x20')][_0xdd38('0x21')](_0xe42874);}function handleCheckDuplicate(_0x5b730c,_0xafd137,_0x4cc2a4,_0x3142b6){return getTimezoneCallbackAt(_0x5b730c,_0xafd137,_0x4cc2a4,_0x3142b6)[_0xdd38('0xe')](function(_0x321a5d){_0x4cc2a4[_0xdd38('0x8')]=_0x321a5d;switch(_0xafd137[_0xdd38('0x22')]){case _0xdd38('0x23'):return handleAlwaysCheckDuplicate(_0x5b730c,_0xafd137,_0x4cc2a4,_0x3142b6);case _0xdd38('0x24'):return handleOnlyIfOpenCheckDuplicate(_0x5b730c,_0xafd137,_0x4cc2a4,_0x3142b6);default:return handleNeverCheckDuplicate(_0x5b730c,_0xafd137,_0x4cc2a4);}});}function createHopperForVoiceQueues(_0x5639cf,_0x7407aa){return _0x5639cf[_0xdd38('0x7')][_0xdd38('0x25')]({'where':{'type':_0xdd38('0x26')},'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x5639cf[_0xdd38('0x27')],'as':_0xdd38('0x28'),'where':{'id':_0x7407aa[_0xdd38('0x14')]}}],'raw':!![]})['then'](function(_0x5b2fe9){var _0x5e6b8a=_0x5b2fe9[_0xdd38('0x29')](function(_0x45827d){return handleCheckDuplicate(_0x5639cf,_0x45827d,_0x7407aa,![]);});return Promise[_0xdd38('0x2a')](_0x5e6b8a);});}function createHopperForCampaigns(_0x26c665,_0x5719ce){return _0x26c665[_0xdd38('0x6')][_0xdd38('0x25')]({'attributes':['id','dialCheckDuplicateType',_0xdd38('0xb')],'include':[{'model':_0x26c665[_0xdd38('0x27')],'as':_0xdd38('0x28'),'where':{'id':_0x5719ce['ListId']}}],'raw':!![]})['then'](function(_0x35e0b3){var _0x20f7e0=_0x35e0b3[_0xdd38('0x29')](function(_0x4a28d9){return handleCheckDuplicate(_0x26c665,_0x4a28d9,_0x5719ce,!![]);});return Promise[_0xdd38('0x2a')](_0x20f7e0);});}function createHopperBlackForVoiceQueues(_0x399b6a,_0xde6eef){return _0x399b6a[_0xdd38('0x7')][_0xdd38('0x25')]({'where':{'type':_0xdd38('0x26')},'attributes':['id'],'include':[{'model':_0x399b6a[_0xdd38('0x27')],'as':'BlackLists','where':{'id':_0xde6eef[_0xdd38('0x14')]}}],'raw':!![]})['then'](function(_0x1735f7){var _0x1351ae=_0x1735f7['map'](function(_0x35d073){return _0x399b6a['CmHopperBlack'][_0xdd38('0x21')]({'phone':_0xde6eef[_0xdd38('0x13')],'ContactId':_0xde6eef['id'],'ListId':_0xde6eef[_0xdd38('0x14')],'VoiceQueueId':_0x35d073['id']});});return Promise[_0xdd38('0x2a')](_0x1351ae);});}function createHopperBlackForCampaigns(_0x315afe,_0x23d916){return _0x315afe[_0xdd38('0x6')][_0xdd38('0x25')]({'attributes':['id'],'include':[{'model':_0x315afe[_0xdd38('0x27')],'as':'BlackLists','where':{'id':_0x23d916['ListId']}}],'raw':!![]})[_0xdd38('0xe')](function(_0x21da56){var _0x2db4f9=_0x21da56['map'](function(_0xf1313){return _0x315afe[_0xdd38('0x2b')]['create']({'phone':_0x23d916[_0xdd38('0x13')],'ContactId':_0x23d916['id'],'ListId':_0x23d916[_0xdd38('0x14')],'CampaignId':_0xf1313['id']});});return Promise[_0xdd38('0x2a')](_0x2db4f9);});}module[_0xdd38('0x2c')]=function(_0x24be20){return _0x24be20[_0xdd38('0x2d')](_0xdd38('0x2e'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0xdd38('0x13'),'fields':[_0xdd38('0x13')]},{'name':_0xdd38('0x2f'),'fields':['firstName','lastName','phone',_0xdd38('0x30'),'fax','email'],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xdd38('0x31'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x4457d9,_0x2c6a74,_0x1e22f1){var _0x23018e=_0x24be20[_0xdd38('0x32')];var _0x5ab5ac=_0x4457d9[_0xdd38('0x33')]({'plain':!![]});if(!_0x5ab5ac[_0xdd38('0x14')]){logger[_0xdd38('0x34')]('[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20'+_0x5ab5ac['id']);return _0x1e22f1();}if(!_0x5ab5ac[_0xdd38('0x13')]){return _0x1e22f1();}return createHopperForVoiceQueues(_0x23018e,_0x5ab5ac)['then'](function(){return createHopperBlackForVoiceQueues(_0x23018e,_0x5ab5ac);})[_0xdd38('0xe')](function(){return createHopperForCampaigns(_0x23018e,_0x5ab5ac);})['then'](function(){return createHopperBlackForCampaigns(_0x23018e,_0x5ab5ac);})[_0xdd38('0xe')](function(){return _0x1e22f1();})[_0xdd38('0x35')](function(_0x781aa9){logger['error']('[cmContact][afterCreate]',_0x781aa9['message']);_0x1e22f1();});},'afterDestroy':function(_0x579724,_0xf48ee,_0x54918c){var _0x54b063=_0x24be20[_0xdd38('0x32')];var _0x160614=_0x579724[_0xdd38('0x33')]({'plain':!![]});return _0x54b063['CmHopper'][_0xdd38('0x25')]({'raw':!![],'where':{'ListId':_0x160614[_0xdd38('0x14')],'ContactId':_0x160614['id']}})[_0xdd38('0xe')](function(_0x1dc48d){if(!_[_0xdd38('0x36')](_0x1dc48d)){var _0x52cb02=[];for(var _0x29257e=0x0;_0x29257e<_0x1dc48d['length'];_0x29257e+=0x1){var _0x90e6d8=_0x54b063[_0xdd38('0x20')][_0xdd38('0x37')]({'where':{'ListId':_0x1dc48d[_0x29257e][_0xdd38('0x14')],'ContactId':_0x1dc48d[_0x29257e]['ContactId'],'VoiceQueueId':_0x1dc48d[_0x29257e][_0xdd38('0x1f')],'CampaignId':_0x1dc48d[_0x29257e]['CampaignId']}});_0x52cb02[_0xdd38('0x38')](_0x90e6d8);}return Promise[_0xdd38('0x2a')](_0x52cb02);}})['then'](function(_0x599352){logger[_0xdd38('0x39')]('[CmContact][afterDestroy][Succesfull]',util[_0xdd38('0x3a')](_0x599352,{'showHidden':![],'depth':null}));_0x54918c();})['catch'](function(_0xa3c56b){logger[_0xdd38('0x34')](_0xdd38('0x3b'),util[_0xdd38('0x3a')](_0xa3c56b,{'showHidden':![],'depth':null}));_0x54918c(_0xa3c56b);});}}});}; \ No newline at end of file +var _0xf6fd=['ListId','priority','callbackUniqueid','assign','CmHopper','findOne','then','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','CampaignId','VoiceQueueId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','dialCheckDuplicateType','always','findAll','outbound','CmList','Lists','map','all','BlackLists','CmHopperBlack','exports','define','CmContact','cm_contacts','fti_cm_contacts','firstName','lastName','mobile','email','utf8mb4','utf8mb4_unicode_ci','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','[cmContact][afterCreate]','message','models','isEmpty','length','ContactId','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','../../config/environment/shared','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve','timezones','utcOffset','add','minutes','format','phone'];(function(_0x329159,_0x4fef75){var _0x1158fd=function(_0x2132d3){while(--_0x2132d3){_0x329159['push'](_0x329159['shift']());}};_0x1158fd(++_0x4fef75);}(_0xf6fd,0x13c));var _0xdf6f=function(_0x22c3b8,_0x3a01d1){_0x22c3b8=_0x22c3b8-0x0;var _0x41212a=_0xf6fd[_0x22c3b8];return _0x41212a;};'use strict';var _=require(_0xdf6f('0x0'));var util=require(_0xdf6f('0x1'));var logger=require(_0xdf6f('0x2'))(_0xdf6f('0x3'));var moment=require('moment');var shared=require(_0xdf6f('0x4'));var attributes=require(_0xdf6f('0x5'));function getTimezoneCallbackAt(_0x2b58ae,_0x583173,_0x1514ad,_0x4ba47b){var _0x5958f1=_0x4ba47b?_0xdf6f('0x6'):_0xdf6f('0x7');var _0x5bbb68=_0x1514ad[_0xdf6f('0x8')]?_0x1514ad['scheduledat']:moment()['format'](_0xdf6f('0x9'));if(_[_0xdf6f('0xa')](_0x1514ad[_0xdf6f('0xb')])){return Promise[_0xdf6f('0xc')](_0x5bbb68);}return _0x2b58ae[_0x5958f1]['findOne']({'where':{'id':_0x583173}})['then'](function(_0x12a61d){if(_[_0xdf6f('0xa')](_0x12a61d)||_[_0xdf6f('0xa')](_0x12a61d[_0xdf6f('0xb')])){return Promise[_0xdf6f('0xc')](_0x5bbb68);}var _0x2e3d8b=shared[_0xdf6f('0xd')];var _0x303e65=_0x2e3d8b[_0x12a61d['dialTimezone']];var _0x4d4f52=_0x2e3d8b[_0x1514ad['dialTimezone']];if(_[_0xdf6f('0xa')](_0x303e65)&&_[_0xdf6f('0xa')](_0x4d4f52)){return Promise['resolve'](_0x5bbb68);}var _0x2a7f69=_0x303e65[_0xdf6f('0xe')]-_0x4d4f52['utcOffset'];var _0x124668=_0x1514ad[_0xdf6f('0x8')]?_0x1514ad[_0xdf6f('0x8')]:moment();_0x5bbb68=moment(_0x124668)[_0xdf6f('0xf')](_0x2a7f69,_0xdf6f('0x10'))[_0xdf6f('0x11')](_0xdf6f('0x9'));return Promise[_0xdf6f('0xc')](_0x5bbb68);});}function getNewHopperPayload(_0x5dd173){return{'phone':_0x5dd173[_0xdf6f('0x12')],'ContactId':_0x5dd173['id'],'ListId':_0x5dd173[_0xdf6f('0x13')],'scheduledat':_0x5dd173[_0xdf6f('0x8')]?_0x5dd173[_0xdf6f('0x8')]:moment()[_0xdf6f('0x11')](_0xdf6f('0x9')),'priority':_0x5dd173['priority']?_0x5dd173[_0xdf6f('0x14')]:0x2,'callback':_0x5dd173[_0xdf6f('0x15')]?!![]:![],'callbackuniqueid':_0x5dd173['callbackUniqueid']?_0x5dd173[_0xdf6f('0x15')]:undefined,'callbackat':_0x5dd173['callbackUniqueid']?moment()[_0xdf6f('0x11')](_0xdf6f('0x9')):undefined};}function handleAlwaysCheckDuplicate(_0x2a5dd3,_0x1ef7ca,_0x2357a4,_0x4a4ec9){var _0x5e8a5c={'phone':_0x2357a4['phone']};var _0xb6c951={'calleridnum':_0x2357a4[_0xdf6f('0x12')]};if(_0x4a4ec9){Object['assign'](_0x5e8a5c,{'CampaignId':_0x1ef7ca['id']});Object[_0xdf6f('0x16')](_0xb6c951,{'CampaignId':_0x1ef7ca['id']});}else{Object[_0xdf6f('0x16')](_0x5e8a5c,{'VoiceQueueId':_0x1ef7ca['id']});Object[_0xdf6f('0x16')](_0xb6c951,{'VoiceQueueId':_0x1ef7ca['id']});}return _0x2a5dd3[_0xdf6f('0x17')][_0xdf6f('0x18')]({'where':_0x5e8a5c})[_0xdf6f('0x19')](function(_0x260f0c){if(_0x260f0c){throw new Error(_0xdf6f('0x1a')+_0x2357a4[_0xdf6f('0x12')]+_0xdf6f('0x1b')+_0x1ef7ca['id']);}return _0x2a5dd3[_0xdf6f('0x1c')]['findOne']({'where':_0xb6c951});})[_0xdf6f('0x19')](function(_0x13b7de){if(_0x13b7de){throw new Error('[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x2357a4[_0xdf6f('0x12')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x1ef7ca['id']);}var _0x4e6bdc=getNewHopperPayload(_0x2357a4);if(_0x4a4ec9){_0x4e6bdc[_0xdf6f('0x1d')]=_0x1ef7ca['id'];}else{_0x4e6bdc[_0xdf6f('0x1e')]=_0x1ef7ca['id'];}return _0x2a5dd3[_0xdf6f('0x17')][_0xdf6f('0x1f')](_0x4e6bdc);});}function handleOnlyIfOpenCheckDuplicate(_0x41872d,_0x1ac2b9,_0x3a9fe8,_0x3b1af0){var _0x2641f5={'phone':_0x3a9fe8['phone']};if(_0x3b1af0){Object[_0xdf6f('0x16')](_0x2641f5,{'CampaignId':_0x1ac2b9['id']});}else{Object[_0xdf6f('0x16')](_0x2641f5,{'VoiceQueueId':_0x1ac2b9['id']});}return _0x41872d[_0xdf6f('0x17')][_0xdf6f('0x18')]({'where':_0x2641f5})[_0xdf6f('0x19')](function(_0x5391fb){if(_0x5391fb){throw new Error(_0xdf6f('0x20')+_0x3a9fe8['phone']+_0xdf6f('0x1b')+_0x1ac2b9['id']);}var _0x58b21d=getNewHopperPayload(_0x3a9fe8);if(_0x3b1af0){_0x58b21d[_0xdf6f('0x1d')]=_0x1ac2b9['id'];}else{_0x58b21d[_0xdf6f('0x1e')]=_0x1ac2b9['id'];}return _0x41872d[_0xdf6f('0x17')][_0xdf6f('0x1f')](_0x58b21d);});}function handleNeverCheckDuplicate(_0x3700d8,_0x5e870e,_0x1092b8){var _0x3c5456=getNewHopperPayload(_0x1092b8);_0x3c5456[_0xdf6f('0x1e')]=_0x5e870e['id'];return _0x3700d8[_0xdf6f('0x17')][_0xdf6f('0x1f')](_0x3c5456);}function handleCheckDuplicate(_0x47638a,_0x3e0ad3,_0x4e0d6b,_0x21f17b){return getTimezoneCallbackAt(_0x47638a,_0x3e0ad3,_0x4e0d6b,_0x21f17b)[_0xdf6f('0x19')](function(_0x583e95){_0x4e0d6b[_0xdf6f('0x8')]=_0x583e95;switch(_0x3e0ad3[_0xdf6f('0x21')]){case _0xdf6f('0x22'):return handleAlwaysCheckDuplicate(_0x47638a,_0x3e0ad3,_0x4e0d6b,_0x21f17b);case'onlyIfOpen':return handleOnlyIfOpenCheckDuplicate(_0x47638a,_0x3e0ad3,_0x4e0d6b,_0x21f17b);default:return handleNeverCheckDuplicate(_0x47638a,_0x3e0ad3,_0x4e0d6b);}});}function createHopperForVoiceQueues(_0x58f9c9,_0x50a1d3){return _0x58f9c9[_0xdf6f('0x7')][_0xdf6f('0x23')]({'where':{'type':_0xdf6f('0x24')},'attributes':['id',_0xdf6f('0x21'),_0xdf6f('0xb')],'include':[{'model':_0x58f9c9[_0xdf6f('0x25')],'as':_0xdf6f('0x26'),'where':{'id':_0x50a1d3[_0xdf6f('0x13')]}}],'raw':!![]})[_0xdf6f('0x19')](function(_0x308a13){var _0x2c8397=_0x308a13[_0xdf6f('0x27')](function(_0x2d6a6c){return handleCheckDuplicate(_0x58f9c9,_0x2d6a6c,_0x50a1d3,![]);});return Promise['all'](_0x2c8397);});}function createHopperForCampaigns(_0x5e73f1,_0x1bd76c){return _0x5e73f1[_0xdf6f('0x6')][_0xdf6f('0x23')]({'attributes':['id',_0xdf6f('0x21'),_0xdf6f('0xb')],'include':[{'model':_0x5e73f1[_0xdf6f('0x25')],'as':_0xdf6f('0x26'),'where':{'id':_0x1bd76c[_0xdf6f('0x13')]}}],'raw':!![]})['then'](function(_0x5929fa){var _0x1672f6=_0x5929fa[_0xdf6f('0x27')](function(_0x24d107){return handleCheckDuplicate(_0x5e73f1,_0x24d107,_0x1bd76c,!![]);});return Promise[_0xdf6f('0x28')](_0x1672f6);});}function createHopperBlackForVoiceQueues(_0x862974,_0x506f6c){return _0x862974[_0xdf6f('0x7')][_0xdf6f('0x23')]({'where':{'type':_0xdf6f('0x24')},'attributes':['id'],'include':[{'model':_0x862974[_0xdf6f('0x25')],'as':_0xdf6f('0x29'),'where':{'id':_0x506f6c[_0xdf6f('0x13')]}}],'raw':!![]})['then'](function(_0x1c4cc9){var _0x3277c3=_0x1c4cc9[_0xdf6f('0x27')](function(_0x3cb1ea){return _0x862974[_0xdf6f('0x2a')]['create']({'phone':_0x506f6c[_0xdf6f('0x12')],'ContactId':_0x506f6c['id'],'ListId':_0x506f6c[_0xdf6f('0x13')],'VoiceQueueId':_0x3cb1ea['id']});});return Promise['all'](_0x3277c3);});}function createHopperBlackForCampaigns(_0x20983c,_0xfb82fc){return _0x20983c[_0xdf6f('0x6')][_0xdf6f('0x23')]({'attributes':['id'],'include':[{'model':_0x20983c[_0xdf6f('0x25')],'as':_0xdf6f('0x29'),'where':{'id':_0xfb82fc['ListId']}}],'raw':!![]})[_0xdf6f('0x19')](function(_0x572d15){var _0x2ec36f=_0x572d15[_0xdf6f('0x27')](function(_0x373e87){return _0x20983c[_0xdf6f('0x2a')][_0xdf6f('0x1f')]({'phone':_0xfb82fc[_0xdf6f('0x12')],'ContactId':_0xfb82fc['id'],'ListId':_0xfb82fc['ListId'],'CampaignId':_0x373e87['id']});});return Promise[_0xdf6f('0x28')](_0x2ec36f);});}module[_0xdf6f('0x2b')]=function(_0x229cf7){return _0x229cf7[_0xdf6f('0x2c')](_0xdf6f('0x2d'),attributes,{'tableName':_0xdf6f('0x2e'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0xdf6f('0x12')]},{'name':_0xdf6f('0x2f'),'fields':[_0xdf6f('0x30'),_0xdf6f('0x31'),'phone',_0xdf6f('0x32'),'fax',_0xdf6f('0x33')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xdf6f('0x34'),'collate':_0xdf6f('0x35'),'hooks':{'afterCreate':function(_0x55c120,_0x114b8d,_0xb27859){var _0x34c82c=_0x229cf7['models'];var _0x58e25d=_0x55c120[_0xdf6f('0x36')]({'plain':!![]});if(!_0x58e25d[_0xdf6f('0x13')]){logger[_0xdf6f('0x37')](_0xdf6f('0x38')+_0x58e25d['id']);return _0xb27859();}if(!_0x58e25d[_0xdf6f('0x12')]){return _0xb27859();}return createHopperForVoiceQueues(_0x34c82c,_0x58e25d)[_0xdf6f('0x19')](function(){return createHopperBlackForVoiceQueues(_0x34c82c,_0x58e25d);})['then'](function(){return createHopperForCampaigns(_0x34c82c,_0x58e25d);})[_0xdf6f('0x19')](function(){return createHopperBlackForCampaigns(_0x34c82c,_0x58e25d);})['then'](function(){return _0xb27859();})['catch'](function(_0x5e202e){logger[_0xdf6f('0x37')](_0xdf6f('0x39'),_0x5e202e[_0xdf6f('0x3a')]);_0xb27859();});},'afterDestroy':function(_0x25abb7,_0x375c49,_0x1b4b9f){var _0x5145b7=_0x229cf7[_0xdf6f('0x3b')];var _0x1713c6=_0x25abb7[_0xdf6f('0x36')]({'plain':!![]});return _0x5145b7[_0xdf6f('0x17')]['findAll']({'raw':!![],'where':{'ListId':_0x1713c6[_0xdf6f('0x13')],'ContactId':_0x1713c6['id']}})[_0xdf6f('0x19')](function(_0x1c92ae){if(!_[_0xdf6f('0x3c')](_0x1c92ae)){var _0x565fee=[];for(var _0x48e1c1=0x0;_0x48e1c1<_0x1c92ae[_0xdf6f('0x3d')];_0x48e1c1+=0x1){var _0x290a9b=_0x5145b7[_0xdf6f('0x17')]['destroy']({'where':{'ListId':_0x1c92ae[_0x48e1c1][_0xdf6f('0x13')],'ContactId':_0x1c92ae[_0x48e1c1][_0xdf6f('0x3e')],'VoiceQueueId':_0x1c92ae[_0x48e1c1][_0xdf6f('0x1e')],'CampaignId':_0x1c92ae[_0x48e1c1][_0xdf6f('0x1d')]}});_0x565fee['push'](_0x290a9b);}return Promise['all'](_0x565fee);}})[_0xdf6f('0x19')](function(_0x99dc9a){logger[_0xdf6f('0x3f')](_0xdf6f('0x40'),util[_0xdf6f('0x41')](_0x99dc9a,{'showHidden':![],'depth':null}));_0x1b4b9f();})['catch'](function(_0x1ae74e){logger[_0xdf6f('0x37')](_0xdf6f('0x42'),util[_0xdf6f('0x41')](_0x1ae74e,{'showHidden':![],'depth':null}));_0x1b4b9f(_0x1ae74e);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index fe5435b..78c45b0 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x1f5b37,_0x6a1f84){var _0x4226ce=function(_0x15d433){while(--_0x15d433){_0x1f5b37['push'](_0x1f5b37['shift']());}};_0x4226ce(++_0x6a1f84);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 9d83bf6..06d14e9 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 _0x8fed=['STRING','PHONE','INTEGER'];(function(_0x20955a,_0x17a5c5){var _0x1e9a24=function(_0x4d28c8){while(--_0x4d28c8){_0x20955a['push'](_0x20955a['shift']());}};_0x1e9a24(++_0x17a5c5);}(_0x8fed,0xf5));var _0xd8fe=function(_0x52f4ad,_0x408fa5){_0x52f4ad=_0x52f4ad-0x0;var _0x1535b1=_0x8fed[_0x52f4ad];return _0x1535b1;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize[_0xd8fe('0x0')],'primaryKey':!![]},'item':{'type':Sequelize[_0xd8fe('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xd8fe('0x0')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xd8fe('0x1')],'defaultValue':_0xd8fe('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0xd8fe('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0xc770=['PHONE','sequelize','exports','INTEGER','STRING'];(function(_0x5ad3b7,_0x462eec){var _0x2b83ef=function(_0x50252d){while(--_0x50252d){_0x5ad3b7['push'](_0x5ad3b7['shift']());}};_0x2b83ef(++_0x462eec);}(_0xc770,0xd3));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0c77('0x0'));module[_0x0c77('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x0c77('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x0c77('0x3')],'defaultValue':_0x0c77('0x4')},'OrderBy':{'type':Sequelize[_0x0c77('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x0c77('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index cd4941b..c2f97c8 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 _0xb1f2=['desk.js','../../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','set','Content-Range','apply','reject','destroy','then','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','CmContactHasItem','rawAttributes','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','includeAll','include','findAll','catch','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','jsforce'];(function(_0x45a898,_0x4f5860){var _0x132a39=function(_0x33b16f){while(--_0x33b16f){_0x45a898['push'](_0x45a898['shift']());}};_0x132a39(++_0x4f5860);}(_0xb1f2,0x189));var _0x2b1f=function(_0x45d911,_0x3278e2){_0x45d911=_0x45d911-0x0;var _0x1f10c7=_0xb1f2[_0x45d911];return _0x1f10c7;};'use strict';var emlformat=require(_0x2b1f('0x0'));var rimraf=require(_0x2b1f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2b1f('0x2'));var moment=require(_0x2b1f('0x3'));var BPromise=require(_0x2b1f('0x4'));var Mustache=require(_0x2b1f('0x5'));var util=require('util');var path=require(_0x2b1f('0x6'));var sox=require(_0x2b1f('0x7'));var csv=require(_0x2b1f('0x8'));var ejs=require(_0x2b1f('0x9'));var fs=require('fs');var fs_extra=require(_0x2b1f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b1f('0xb'));var deskjs=require(_0x2b1f('0xc'));var toCsv=require(_0x2b1f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2b1f('0xd'));var qs=require(_0x2b1f('0xe'));var as=require(_0x2b1f('0xf'));var hardwareService=require(_0x2b1f('0x10'));var logger=require(_0x2b1f('0x11'))(_0x2b1f('0x12'));var utils=require(_0x2b1f('0x13'));var config=require(_0x2b1f('0x14'));var licenseUtil=require(_0x2b1f('0x15'));var db=require(_0x2b1f('0x16'))['db'];function respondWithStatusCode(_0x1feb3c,_0x123281){_0x123281=_0x123281||0xcc;return function(_0x327ddc){if(_0x327ddc){return _0x1feb3c[_0x2b1f('0x17')](_0x123281);}return _0x1feb3c[_0x2b1f('0x18')](_0x123281)[_0x2b1f('0x19')]();};}function respondWithResult(_0x463591,_0x246ae8){_0x246ae8=_0x246ae8||0xc8;return function(_0xb67115){if(_0xb67115){return _0x463591['status'](_0x246ae8)[_0x2b1f('0x1a')](_0xb67115);}};}function respondWithFilteredResult(_0x56f1b7,_0x448fe0){return function(_0x346fc7){if(_0x346fc7){var _0x25cbdb=typeof _0x448fe0[_0x2b1f('0x1b')]==='undefined'&&typeof _0x448fe0[_0x2b1f('0x1c')]===_0x2b1f('0x1d');var _0x3cc442=_0x346fc7[_0x2b1f('0x1e')];var _0x2f583a=_0x25cbdb?0x0:_0x448fe0[_0x2b1f('0x1b')];var _0x2a05ae=_0x25cbdb?_0x346fc7[_0x2b1f('0x1e')]:_0x448fe0[_0x2b1f('0x1b')]+_0x448fe0[_0x2b1f('0x1c')];var _0x34c4cb;if(_0x2a05ae>=_0x3cc442){_0x2a05ae=_0x3cc442;_0x34c4cb=0xc8;}else{_0x34c4cb=0xce;}_0x56f1b7[_0x2b1f('0x18')](_0x34c4cb);return _0x56f1b7[_0x2b1f('0x1f')](_0x2b1f('0x20'),_0x2f583a+'-'+_0x2a05ae+'/'+_0x3cc442)['json'](_0x346fc7);}return null;};}function patchUpdates(_0x806dc7){return function(_0x218446){try{jsonpatch[_0x2b1f('0x21')](_0x218446,_0x806dc7,!![]);}catch(_0x487acd){return BPromise[_0x2b1f('0x22')](_0x487acd);}return _0x218446['save']();};}function saveUpdates(_0x12b78d,_0x1e529b){return function(_0x479971){if(_0x479971){return _0x479971['update'](_0x12b78d)['then'](function(_0x18e999){return _0x18e999;});}return null;};}function removeEntity(_0x14b370,_0x35717d){return function(_0x58342a){if(_0x58342a){return _0x58342a[_0x2b1f('0x23')]()[_0x2b1f('0x24')](function(){var _0x1abda0=_0x58342a[_0x2b1f('0x25')]({'plain':!![]});var _0x49eca2=_0x2b1f('0x26');return db[_0x2b1f('0x27')]['destroy']({'where':{'type':_0x49eca2,'resourceId':_0x1abda0['id']}})[_0x2b1f('0x24')](function(){return _0x58342a;});})[_0x2b1f('0x24')](function(){_0x14b370[_0x2b1f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32b4cd,_0x3e2feb){return function(_0x373130){if(!_0x373130){_0x32b4cd['sendStatus'](0x194);}return _0x373130;};}function handleError(_0x5f0f73,_0x5be0ae){_0x5be0ae=_0x5be0ae||0x1f4;return function(_0x42665d){logger[_0x2b1f('0x28')](_0x42665d[_0x2b1f('0x29')]);if(_0x42665d[_0x2b1f('0x2a')]){delete _0x42665d[_0x2b1f('0x2a')];}_0x5f0f73[_0x2b1f('0x18')](_0x5be0ae)[_0x2b1f('0x2b')](_0x42665d);};}exports[_0x2b1f('0x2c')]=function(_0x5ed48e,_0x575a13){var _0x3b7072={},_0x3cdd39={},_0xd7d440={'count':0x0,'rows':[]};var _0xc3b545=_['map'](db[_0x2b1f('0x2d')][_0x2b1f('0x2e')],function(_0x29e819){return{'name':_0x29e819['fieldName'],'type':_0x29e819['type'][_0x2b1f('0x2f')]};});_0x3cdd39[_0x2b1f('0x30')]=_[_0x2b1f('0x31')](_0xc3b545,_0x2b1f('0x2a'));_0x3cdd39[_0x2b1f('0x32')]=_['keys'](_0x5ed48e['query']);_0x3cdd39[_0x2b1f('0x33')]=_[_0x2b1f('0x34')](_0x3cdd39[_0x2b1f('0x30')],_0x3cdd39[_0x2b1f('0x32')]);_0x3b7072[_0x2b1f('0x35')]=_['intersection'](_0x3cdd39[_0x2b1f('0x30')],qs[_0x2b1f('0x36')](_0x5ed48e[_0x2b1f('0x32')][_0x2b1f('0x36')]));_0x3b7072[_0x2b1f('0x35')]=_0x3b7072[_0x2b1f('0x35')][_0x2b1f('0x37')]?_0x3b7072[_0x2b1f('0x35')]:_0x3cdd39[_0x2b1f('0x30')];if(!_0x5ed48e[_0x2b1f('0x32')][_0x2b1f('0x38')](_0x2b1f('0x39'))){_0x3b7072['limit']=qs['limit'](_0x5ed48e[_0x2b1f('0x32')][_0x2b1f('0x1c')]);_0x3b7072[_0x2b1f('0x1b')]=qs['offset'](_0x5ed48e[_0x2b1f('0x32')][_0x2b1f('0x1b')]);}_0x3b7072[_0x2b1f('0x3a')]=qs[_0x2b1f('0x3b')](_0x5ed48e[_0x2b1f('0x32')]['sort']);_0x3b7072[_0x2b1f('0x3c')]=qs[_0x2b1f('0x33')](_['pick'](_0x5ed48e[_0x2b1f('0x32')],_0x3cdd39[_0x2b1f('0x33')]),_0xc3b545);if(_0x5ed48e[_0x2b1f('0x32')][_0x2b1f('0x3d')]){_0x3b7072[_0x2b1f('0x3c')]=_[_0x2b1f('0x3e')](_0x3b7072['where'],{'$or':_[_0x2b1f('0x31')](_0xc3b545,function(_0x41e1c9){if(_0x41e1c9[_0x2b1f('0x3f')]!=='VIRTUAL'){var _0x58f3b6={};_0x58f3b6[_0x41e1c9[_0x2b1f('0x2a')]]={'$like':'%'+_0x5ed48e[_0x2b1f('0x32')][_0x2b1f('0x3d')]+'%'};return _0x58f3b6;}})});}_0x3b7072=_[_0x2b1f('0x3e')]({},_0x3b7072,_0x5ed48e[_0x2b1f('0x40')]);var _0x51b0d2={'where':_0x3b7072['where']};return db[_0x2b1f('0x2d')][_0x2b1f('0x1e')](_0x51b0d2)[_0x2b1f('0x24')](function(_0x14b106){_0xd7d440['count']=_0x14b106;if(_0x5ed48e['query'][_0x2b1f('0x41')]){_0x3b7072[_0x2b1f('0x42')]=[{'all':!![]}];}return db[_0x2b1f('0x2d')][_0x2b1f('0x43')](_0x3b7072);})[_0x2b1f('0x24')](function(_0x323dff){_0xd7d440['rows']=_0x323dff;return _0xd7d440;})[_0x2b1f('0x24')](respondWithFilteredResult(_0x575a13,_0x3b7072))[_0x2b1f('0x44')](handleError(_0x575a13,null));};exports['show']=function(_0x261677,_0x1daaac){var _0x154678={'raw':!![],'where':{'id':_0x261677['params']['id']}},_0x4c69de={};_0x4c69de[_0x2b1f('0x30')]=_[_0x2b1f('0x45')](db[_0x2b1f('0x2d')][_0x2b1f('0x2e')]);_0x4c69de[_0x2b1f('0x32')]=_[_0x2b1f('0x45')](_0x261677['query']);_0x4c69de['filters']=_['intersection'](_0x4c69de[_0x2b1f('0x30')],_0x4c69de[_0x2b1f('0x32')]);_0x154678[_0x2b1f('0x35')]=_[_0x2b1f('0x34')](_0x4c69de[_0x2b1f('0x30')],qs[_0x2b1f('0x36')](_0x261677[_0x2b1f('0x32')][_0x2b1f('0x36')]));_0x154678[_0x2b1f('0x35')]=_0x154678[_0x2b1f('0x35')][_0x2b1f('0x37')]?_0x154678[_0x2b1f('0x35')]:_0x4c69de['model'];if(_0x261677[_0x2b1f('0x32')][_0x2b1f('0x41')]){_0x154678[_0x2b1f('0x42')]=[{'all':!![]}];}_0x154678=_[_0x2b1f('0x3e')]({},_0x154678,_0x261677[_0x2b1f('0x40')]);return db[_0x2b1f('0x2d')][_0x2b1f('0x46')](_0x154678)[_0x2b1f('0x24')](handleEntityNotFound(_0x1daaac,null))['then'](respondWithResult(_0x1daaac,null))[_0x2b1f('0x44')](handleError(_0x1daaac,null));};exports[_0x2b1f('0x47')]=function(_0x5515cb,_0x1550a3){return db[_0x2b1f('0x2d')]['create'](_0x5515cb[_0x2b1f('0x48')],{})['then'](function(_0x45c522){var _0x2ab036=_0x5515cb[_0x2b1f('0x49')][_0x2b1f('0x25')]({'plain':!![]});if(!_0x2ab036)throw new Error(_0x2b1f('0x4a'));if(_0x2ab036[_0x2b1f('0x4b')]===_0x2b1f('0x49')){var _0x1f6b8a=_0x45c522[_0x2b1f('0x25')]({'plain':!![]});var _0x30f314='CmContactHasItems';return db[_0x2b1f('0x4c')][_0x2b1f('0x46')]({'where':{'name':_0x30f314,'userProfileId':_0x2ab036[_0x2b1f('0x4d')]},'raw':!![]})[_0x2b1f('0x24')](function(_0x7cd830){if(_0x7cd830&&_0x7cd830['autoAssociation']===0x0){return db['UserProfileResource'][_0x2b1f('0x47')]({'name':_0x1f6b8a['name'],'resourceId':_0x1f6b8a['id'],'type':_0x7cd830[_0x2b1f('0x2a')],'sectionId':_0x7cd830['id']},{})[_0x2b1f('0x24')](function(){return _0x45c522;});}else{return _0x45c522;}})['catch'](function(_0x43debd){logger['error'](_0x2b1f('0x4e'),_0x43debd);throw _0x43debd;});}return _0x45c522;})['then'](respondWithResult(_0x1550a3,0xc9))[_0x2b1f('0x44')](handleError(_0x1550a3,null));};exports[_0x2b1f('0x4f')]=function(_0x1ae54b,_0x59815a){if(_0x1ae54b[_0x2b1f('0x48')]['id']){delete _0x1ae54b[_0x2b1f('0x48')]['id'];}return db[_0x2b1f('0x2d')][_0x2b1f('0x46')]({'where':{'id':_0x1ae54b[_0x2b1f('0x50')]['id']}})[_0x2b1f('0x24')](handleEntityNotFound(_0x59815a,null))[_0x2b1f('0x24')](saveUpdates(_0x1ae54b[_0x2b1f('0x48')],null))['then'](respondWithResult(_0x59815a,null))['catch'](handleError(_0x59815a,null));};exports['destroy']=function(_0x45bfa9,_0xd7cfb2){return db[_0x2b1f('0x2d')]['find']({'where':{'id':_0x45bfa9[_0x2b1f('0x50')]['id']}})[_0x2b1f('0x24')](handleEntityNotFound(_0xd7cfb2,null))[_0x2b1f('0x24')](removeEntity(_0xd7cfb2,null))[_0x2b1f('0x44')](handleError(_0xd7cfb2,null));}; \ No newline at end of file +var _0xad63=['fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','CmContactHasItem','includeAll','include','findAll','rows','catch','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','limit','undefined','count','offset','Content-Range','json','apply','reject','then','destroy','get','CmContactHasItems','end','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection'];(function(_0xdfc87d,_0x28e1a5){var _0x4e2a5e=function(_0x55f2f7){while(--_0x55f2f7){_0xdfc87d['push'](_0xdfc87d['shift']());}};_0x4e2a5e(++_0x28e1a5);}(_0xad63,0x1b9));var _0x3ad6=function(_0x5843b1,_0x592bdd){_0x5843b1=_0x5843b1-0x0;var _0x2e100c=_0xad63[_0x5843b1];return _0x2e100c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ad6('0x0'));var zipdir=require(_0x3ad6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3ad6('0x2'));var moment=require(_0x3ad6('0x3'));var BPromise=require(_0x3ad6('0x4'));var Mustache=require(_0x3ad6('0x5'));var util=require('util');var path=require(_0x3ad6('0x6'));var sox=require(_0x3ad6('0x7'));var csv=require(_0x3ad6('0x8'));var ejs=require(_0x3ad6('0x9'));var fs=require('fs');var fs_extra=require(_0x3ad6('0xa'));var _=require(_0x3ad6('0xb'));var squel=require('squel');var crypto=require(_0x3ad6('0xc'));var jsforce=require(_0x3ad6('0xd'));var deskjs=require(_0x3ad6('0xe'));var toCsv=require(_0x3ad6('0x8'));var querystring=require(_0x3ad6('0xf'));var Papa=require(_0x3ad6('0x10'));var Redis=require(_0x3ad6('0x11'));var authService=require(_0x3ad6('0x12'));var qs=require(_0x3ad6('0x13'));var as=require(_0x3ad6('0x14'));var hardwareService=require(_0x3ad6('0x15'));var logger=require(_0x3ad6('0x16'))(_0x3ad6('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3ad6('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e8bc8,_0x47b2db){_0x47b2db=_0x47b2db||0xcc;return function(_0x34061d){if(_0x34061d){return _0x2e8bc8[_0x3ad6('0x19')](_0x47b2db);}return _0x2e8bc8['status'](_0x47b2db)['end']();};}function respondWithResult(_0x55ae42,_0x1f055d){_0x1f055d=_0x1f055d||0xc8;return function(_0x1f2640){if(_0x1f2640){return _0x55ae42[_0x3ad6('0x1a')](_0x1f055d)['json'](_0x1f2640);}};}function respondWithFilteredResult(_0x25dae2,_0x2c447b){return function(_0x358ca9){if(_0x358ca9){var _0x48919f=typeof _0x2c447b['offset']==='undefined'&&typeof _0x2c447b[_0x3ad6('0x1b')]===_0x3ad6('0x1c');var _0x112eff=_0x358ca9[_0x3ad6('0x1d')];var _0x3e061d=_0x48919f?0x0:_0x2c447b[_0x3ad6('0x1e')];var _0x2a4e7f=_0x48919f?_0x358ca9['count']:_0x2c447b[_0x3ad6('0x1e')]+_0x2c447b[_0x3ad6('0x1b')];var _0x320b39;if(_0x2a4e7f>=_0x112eff){_0x2a4e7f=_0x112eff;_0x320b39=0xc8;}else{_0x320b39=0xce;}_0x25dae2[_0x3ad6('0x1a')](_0x320b39);return _0x25dae2['set'](_0x3ad6('0x1f'),_0x3e061d+'-'+_0x2a4e7f+'/'+_0x112eff)[_0x3ad6('0x20')](_0x358ca9);}return null;};}function patchUpdates(_0x453c72){return function(_0x38753f){try{jsonpatch[_0x3ad6('0x21')](_0x38753f,_0x453c72,!![]);}catch(_0x379923){return BPromise[_0x3ad6('0x22')](_0x379923);}return _0x38753f['save']();};}function saveUpdates(_0x3ead6f,_0x3719e5){return function(_0x5bc9be){if(_0x5bc9be){return _0x5bc9be['update'](_0x3ead6f)[_0x3ad6('0x23')](function(_0x417a9a){return _0x417a9a;});}return null;};}function removeEntity(_0x5417bd,_0x3bc63e){return function(_0x183d4a){if(_0x183d4a){return _0x183d4a[_0x3ad6('0x24')]()[_0x3ad6('0x23')](function(){var _0x952206=_0x183d4a[_0x3ad6('0x25')]({'plain':!![]});var _0x4e0510=_0x3ad6('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x4e0510,'resourceId':_0x952206['id']}})[_0x3ad6('0x23')](function(){return _0x183d4a;});})[_0x3ad6('0x23')](function(){_0x5417bd['status'](0xcc)[_0x3ad6('0x27')]();});}};}function handleEntityNotFound(_0x4fa9ab,_0x5264fa){return function(_0x254e5b){if(!_0x254e5b){_0x4fa9ab[_0x3ad6('0x19')](0x194);}return _0x254e5b;};}function handleError(_0x55fbc6,_0x21bc66){_0x21bc66=_0x21bc66||0x1f4;return function(_0x27efee){logger['error'](_0x27efee['stack']);if(_0x27efee[_0x3ad6('0x28')]){delete _0x27efee['name'];}_0x55fbc6[_0x3ad6('0x1a')](_0x21bc66)[_0x3ad6('0x29')](_0x27efee);};}exports[_0x3ad6('0x2a')]=function(_0x44bb3b,_0x2f13f6){var _0xe46b77={},_0x3642dd={},_0x3f956e={'count':0x0,'rows':[]};var _0x36d6e4=_[_0x3ad6('0x2b')](db['CmContactHasItem'][_0x3ad6('0x2c')],function(_0x79a1a4){return{'name':_0x79a1a4[_0x3ad6('0x2d')],'type':_0x79a1a4[_0x3ad6('0x2e')]['key']};});_0x3642dd[_0x3ad6('0x2f')]=_[_0x3ad6('0x2b')](_0x36d6e4,_0x3ad6('0x28'));_0x3642dd[_0x3ad6('0x30')]=_['keys'](_0x44bb3b[_0x3ad6('0x30')]);_0x3642dd[_0x3ad6('0x31')]=_[_0x3ad6('0x32')](_0x3642dd[_0x3ad6('0x2f')],_0x3642dd[_0x3ad6('0x30')]);_0xe46b77['attributes']=_[_0x3ad6('0x32')](_0x3642dd[_0x3ad6('0x2f')],qs[_0x3ad6('0x33')](_0x44bb3b[_0x3ad6('0x30')][_0x3ad6('0x33')]));_0xe46b77['attributes']=_0xe46b77[_0x3ad6('0x34')][_0x3ad6('0x35')]?_0xe46b77[_0x3ad6('0x34')]:_0x3642dd[_0x3ad6('0x2f')];if(!_0x44bb3b['query'][_0x3ad6('0x36')]('nolimit')){_0xe46b77[_0x3ad6('0x1b')]=qs[_0x3ad6('0x1b')](_0x44bb3b[_0x3ad6('0x30')][_0x3ad6('0x1b')]);_0xe46b77['offset']=qs[_0x3ad6('0x1e')](_0x44bb3b[_0x3ad6('0x30')][_0x3ad6('0x1e')]);}_0xe46b77[_0x3ad6('0x37')]=qs['sort'](_0x44bb3b[_0x3ad6('0x30')][_0x3ad6('0x38')]);_0xe46b77[_0x3ad6('0x39')]=qs[_0x3ad6('0x31')](_[_0x3ad6('0x3a')](_0x44bb3b[_0x3ad6('0x30')],_0x3642dd[_0x3ad6('0x31')]),_0x36d6e4);if(_0x44bb3b[_0x3ad6('0x30')][_0x3ad6('0x3b')]){_0xe46b77[_0x3ad6('0x39')]=_[_0x3ad6('0x3c')](_0xe46b77[_0x3ad6('0x39')],{'$or':_[_0x3ad6('0x2b')](_0x36d6e4,function(_0x20e4d9){if(_0x20e4d9[_0x3ad6('0x2e')]!=='VIRTUAL'){var _0x48033a={};_0x48033a[_0x20e4d9[_0x3ad6('0x28')]]={'$like':'%'+_0x44bb3b[_0x3ad6('0x30')][_0x3ad6('0x3b')]+'%'};return _0x48033a;}})});}_0xe46b77=_[_0x3ad6('0x3c')]({},_0xe46b77,_0x44bb3b['options']);var _0x521f5c={'where':_0xe46b77['where']};return db[_0x3ad6('0x3d')][_0x3ad6('0x1d')](_0x521f5c)[_0x3ad6('0x23')](function(_0x37349d){_0x3f956e[_0x3ad6('0x1d')]=_0x37349d;if(_0x44bb3b[_0x3ad6('0x30')][_0x3ad6('0x3e')]){_0xe46b77[_0x3ad6('0x3f')]=[{'all':!![]}];}return db[_0x3ad6('0x3d')][_0x3ad6('0x40')](_0xe46b77);})[_0x3ad6('0x23')](function(_0x47109c){_0x3f956e[_0x3ad6('0x41')]=_0x47109c;return _0x3f956e;})[_0x3ad6('0x23')](respondWithFilteredResult(_0x2f13f6,_0xe46b77))[_0x3ad6('0x42')](handleError(_0x2f13f6,null));};exports['show']=function(_0x533344,_0x55ec5d){var _0x30fc7e={'raw':!![],'where':{'id':_0x533344['params']['id']}},_0x58b19c={};_0x58b19c[_0x3ad6('0x2f')]=_[_0x3ad6('0x43')](db['CmContactHasItem'][_0x3ad6('0x2c')]);_0x58b19c[_0x3ad6('0x30')]=_[_0x3ad6('0x43')](_0x533344[_0x3ad6('0x30')]);_0x58b19c[_0x3ad6('0x31')]=_[_0x3ad6('0x32')](_0x58b19c[_0x3ad6('0x2f')],_0x58b19c['query']);_0x30fc7e[_0x3ad6('0x34')]=_['intersection'](_0x58b19c['model'],qs['fields'](_0x533344[_0x3ad6('0x30')]['fields']));_0x30fc7e[_0x3ad6('0x34')]=_0x30fc7e[_0x3ad6('0x34')]['length']?_0x30fc7e[_0x3ad6('0x34')]:_0x58b19c['model'];if(_0x533344[_0x3ad6('0x30')]['includeAll']){_0x30fc7e[_0x3ad6('0x3f')]=[{'all':!![]}];}_0x30fc7e=_['merge']({},_0x30fc7e,_0x533344[_0x3ad6('0x44')]);return db[_0x3ad6('0x3d')][_0x3ad6('0x45')](_0x30fc7e)['then'](handleEntityNotFound(_0x55ec5d,null))[_0x3ad6('0x23')](respondWithResult(_0x55ec5d,null))[_0x3ad6('0x42')](handleError(_0x55ec5d,null));};exports['create']=function(_0x380f88,_0x235d6d){return db[_0x3ad6('0x3d')][_0x3ad6('0x46')](_0x380f88[_0x3ad6('0x47')],{})[_0x3ad6('0x23')](function(_0x543d4f){var _0x34d99f=_0x380f88[_0x3ad6('0x48')][_0x3ad6('0x25')]({'plain':!![]});if(!_0x34d99f)throw new Error(_0x3ad6('0x49'));if(_0x34d99f[_0x3ad6('0x4a')]===_0x3ad6('0x48')){var _0x5a9c2c=_0x543d4f[_0x3ad6('0x25')]({'plain':!![]});var _0x3a08d5='CmContactHasItems';return db[_0x3ad6('0x4b')][_0x3ad6('0x45')]({'where':{'name':_0x3a08d5,'userProfileId':_0x34d99f['userProfileId']},'raw':!![]})[_0x3ad6('0x23')](function(_0x4fc5e2){if(_0x4fc5e2&&_0x4fc5e2[_0x3ad6('0x4c')]===0x0){return db[_0x3ad6('0x4d')][_0x3ad6('0x46')]({'name':_0x5a9c2c['name'],'resourceId':_0x5a9c2c['id'],'type':_0x4fc5e2['name'],'sectionId':_0x4fc5e2['id']},{})[_0x3ad6('0x23')](function(){return _0x543d4f;});}else{return _0x543d4f;}})[_0x3ad6('0x42')](function(_0x3c1089){logger[_0x3ad6('0x4e')](_0x3ad6('0x4f'),_0x3c1089);throw _0x3c1089;});}return _0x543d4f;})[_0x3ad6('0x23')](respondWithResult(_0x235d6d,0xc9))['catch'](handleError(_0x235d6d,null));};exports[_0x3ad6('0x50')]=function(_0x1b91ac,_0x685aba){if(_0x1b91ac[_0x3ad6('0x47')]['id']){delete _0x1b91ac[_0x3ad6('0x47')]['id'];}return db['CmContactHasItem']['find']({'where':{'id':_0x1b91ac[_0x3ad6('0x51')]['id']}})[_0x3ad6('0x23')](handleEntityNotFound(_0x685aba,null))[_0x3ad6('0x23')](saveUpdates(_0x1b91ac[_0x3ad6('0x47')],null))[_0x3ad6('0x23')](respondWithResult(_0x685aba,null))['catch'](handleError(_0x685aba,null));};exports[_0x3ad6('0x24')]=function(_0x44e2c3,_0x54c524){return db['CmContactHasItem']['find']({'where':{'id':_0x44e2c3[_0x3ad6('0x51')]['id']}})[_0x3ad6('0x23')](handleEntityNotFound(_0x54c524,null))[_0x3ad6('0x23')](removeEntity(_0x54c524,null))[_0x3ad6('0x42')](handleError(_0x54c524,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index faf061e..cc6e673 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 _0xa65f=['moment','bluebird','request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api'];(function(_0x57d6f6,_0x322ead){var _0x47f438=function(_0xac66fb){while(--_0xac66fb){_0x57d6f6['push'](_0x57d6f6['shift']());}};_0x47f438(++_0x322ead);}(_0xa65f,0xcc));var _0xfa65=function(_0x369289,_0x1ceef4){_0x369289=_0x369289-0x0;var _0x392ed2=_0xa65f[_0x369289];return _0x392ed2;};'use strict';var _=require(_0xfa65('0x0'));var util=require(_0xfa65('0x1'));var logger=require(_0xfa65('0x2'))(_0xfa65('0x3'));var moment=require(_0xfa65('0x4'));var BPromise=require(_0xfa65('0x5'));var rp=require(_0xfa65('0x6'));var fs=require('fs');var path=require(_0xfa65('0x7'));var rimraf=require('rimraf');var config=require(_0xfa65('0x8'));var attributes=require(_0xfa65('0x9'));module[_0xfa65('0xa')]=function(_0x1dc229,_0x59e62c){return _0x1dc229['define'](_0xfa65('0xb'),attributes,{'tableName':_0xfa65('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2c9=['../../config/environment','./cmContactHasItem.attributes','exports','cm_contact_has_items','lodash','util','api','moment','request-promise','rimraf'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xc2c9,0x11c));var _0x9c2c=function(_0x437fa3,_0xd8692e){_0x437fa3=_0x437fa3-0x0;var _0x205382=_0xc2c9[_0x437fa3];return _0x205382;};'use strict';var _=require(_0x9c2c('0x0'));var util=require(_0x9c2c('0x1'));var logger=require('../../config/logger')(_0x9c2c('0x2'));var moment=require(_0x9c2c('0x3'));var BPromise=require('bluebird');var rp=require(_0x9c2c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9c2c('0x5'));var config=require(_0x9c2c('0x6'));var attributes=require(_0x9c2c('0x7'));module[_0x9c2c('0x8')]=function(_0x35dec1,_0x5a6fe3){return _0x35dec1['define']('CmContactHasItem',attributes,{'tableName':_0x9c2c('0x9'),'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 30e3b26..a6d35ee 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 _0x4c22=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5def17,_0x30c9b3){var _0x1389db=function(_0x30a7ec){while(--_0x30a7ec){_0x5def17['push'](_0x5def17['shift']());}};_0x1389db(++_0x30c9b3);}(_0x4c22,0x1bd));var _0x24c2=function(_0x109946,_0x3a7335){_0x109946=_0x109946-0x0;var _0xd7868a=_0x4c22[_0x109946];return _0xd7868a;};'use strict';var _=require(_0x24c2('0x0'));var util=require(_0x24c2('0x1'));var moment=require(_0x24c2('0x2'));var BPromise=require(_0x24c2('0x3'));var rs=require(_0x24c2('0x4'));var fs=require('fs');var Redis=require(_0x24c2('0x5'));var db=require(_0x24c2('0x6'))['db'];var utils=require(_0x24c2('0x7'));var logger=require(_0x24c2('0x8'))('rpc');var config=require(_0x24c2('0x9'));var jayson=require(_0x24c2('0xa'));var client=jayson[_0x24c2('0xb')][_0x24c2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x26e387,_0x3c92a3,_0x1551f0){return new BPromise(function(_0x1e84dc,_0x579a12){return client[_0x24c2('0xd')](_0x26e387,_0x1551f0)[_0x24c2('0xe')](function(_0x1cbe37){logger[_0x24c2('0xf')](_0x24c2('0x10'),_0x3c92a3,_0x24c2('0x11'));logger[_0x24c2('0x12')](_0x24c2('0x13'),_0x3c92a3,'request\x20sent',JSON[_0x24c2('0x14')](_0x1cbe37));if(_0x1cbe37[_0x24c2('0x15')]){if(_0x1cbe37[_0x24c2('0x15')][_0x24c2('0x16')]===0x1f4){logger[_0x24c2('0x15')](_0x24c2('0x10'),_0x3c92a3,_0x1cbe37[_0x24c2('0x15')][_0x24c2('0x17')]);return _0x579a12(_0x1cbe37[_0x24c2('0x15')][_0x24c2('0x17')]);}logger[_0x24c2('0x15')](_0x24c2('0x10'),_0x3c92a3,_0x1cbe37[_0x24c2('0x15')]['message']);return _0x1e84dc(_0x1cbe37[_0x24c2('0x15')][_0x24c2('0x17')]);}else{logger['info'](_0x24c2('0x10'),_0x3c92a3,'request\x20sent');_0x1e84dc(_0x1cbe37[_0x24c2('0x18')][_0x24c2('0x17')]);}})[_0x24c2('0x19')](function(_0x5e2186){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x3c92a3,_0x5e2186);_0x579a12(_0x5e2186);});});} \ No newline at end of file +var _0x614d=['then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x2c2ddd,_0x1f2f89){var _0x3281c6=function(_0x405f81){while(--_0x405f81){_0x2c2ddd['push'](_0x2c2ddd['shift']());}};_0x3281c6(++_0x1f2f89);}(_0x614d,0xfc));var _0xd614=function(_0x3184c5,_0x32f665){_0x3184c5=_0x3184c5-0x0;var _0x19e031=_0x614d[_0x3184c5];return _0x19e031;};'use strict';var _=require('lodash');var util=require(_0xd614('0x0'));var moment=require(_0xd614('0x1'));var BPromise=require(_0xd614('0x2'));var rs=require(_0xd614('0x3'));var fs=require('fs');var Redis=require(_0xd614('0x4'));var db=require(_0xd614('0x5'))['db'];var utils=require(_0xd614('0x6'));var logger=require('../../config/logger')(_0xd614('0x7'));var config=require(_0xd614('0x8'));var jayson=require(_0xd614('0x9'));var client=jayson['client'][_0xd614('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1eb35f,_0x30bc25,_0x4522f3){return new BPromise(function(_0xf58bc8,_0x239495){return client[_0xd614('0xb')](_0x1eb35f,_0x4522f3)[_0xd614('0xc')](function(_0x2d9a24){logger[_0xd614('0xd')](_0xd614('0xe'),_0x30bc25,_0xd614('0xf'));logger[_0xd614('0x10')](_0xd614('0x11'),_0x30bc25,_0xd614('0xf'),JSON['stringify'](_0x2d9a24));if(_0x2d9a24['error']){if(_0x2d9a24[_0xd614('0x12')][_0xd614('0x13')]===0x1f4){logger[_0xd614('0x12')](_0xd614('0xe'),_0x30bc25,_0x2d9a24[_0xd614('0x12')][_0xd614('0x14')]);return _0x239495(_0x2d9a24[_0xd614('0x12')]['message']);}logger[_0xd614('0x12')](_0xd614('0xe'),_0x30bc25,_0x2d9a24[_0xd614('0x12')][_0xd614('0x14')]);return _0xf58bc8(_0x2d9a24[_0xd614('0x12')][_0xd614('0x14')]);}else{logger[_0xd614('0xd')](_0xd614('0xe'),_0x30bc25,_0xd614('0xf'));_0xf58bc8(_0x2d9a24[_0xd614('0x15')][_0xd614('0x14')]);}})['catch'](function(_0x57f029){logger[_0xd614('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x30bc25,_0x57f029);_0x239495(_0x57f029);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index e6deee7..3a139fc 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 _0xcdb4=['isAuthenticated','create','put','update','delete','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','/:id','show'];(function(_0x4c0adc,_0xd5df5d){var _0x442979=function(_0x3a70b7){while(--_0x3a70b7){_0x4c0adc['push'](_0x4c0adc['shift']());}};_0x442979(++_0xd5df5d);}(_0xcdb4,0x1f3));var _0x4cdb=function(_0x37cc92,_0x373e27){_0x37cc92=_0x37cc92-0x0;var _0x20266c=_0xcdb4[_0x37cc92];return _0x20266c;};'use strict';var multer=require(_0x4cdb('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4cdb('0x1'));var router=express[_0x4cdb('0x2')]();var fs_extra=require(_0x4cdb('0x3'));var auth=require(_0x4cdb('0x4'));var interaction=require(_0x4cdb('0x5'));var config=require(_0x4cdb('0x6'));var controller=require(_0x4cdb('0x7'));router[_0x4cdb('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4cdb('0x9'),auth['isAuthenticated'](),controller[_0x4cdb('0xa')]);router['post']('/',auth[_0x4cdb('0xb')](),controller[_0x4cdb('0xc')]);router[_0x4cdb('0xd')](_0x4cdb('0x9'),auth[_0x4cdb('0xb')](),controller[_0x4cdb('0xe')]);router[_0x4cdb('0xf')]('/:id',auth[_0x4cdb('0xb')](),controller['destroy']);module[_0x4cdb('0x10')]=router; \ No newline at end of file +var _0x843b=['isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','util','fs-extra','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller'];(function(_0x1073ad,_0x44bf0b){var _0x528474=function(_0x3450f7){while(--_0x3450f7){_0x1073ad['push'](_0x1073ad['shift']());}};_0x528474(++_0x44bf0b);}(_0x843b,0xae));var _0xb843=function(_0x193738,_0x4b7297){_0x193738=_0x193738-0x0;var _0x27043a=_0x843b[_0x193738];return _0x27043a;};'use strict';var multer=require(_0xb843('0x0'));var util=require(_0xb843('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xb843('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xb843('0x3'));var config=require(_0xb843('0x4'));var controller=require(_0xb843('0x5'));router['get']('/',auth[_0xb843('0x6')](),controller[_0xb843('0x7')]);router['get'](_0xb843('0x8'),auth[_0xb843('0x6')](),controller[_0xb843('0x9')]);router[_0xb843('0xa')]('/',auth[_0xb843('0x6')](),controller['create']);router[_0xb843('0xb')]('/:id',auth[_0xb843('0x6')](),controller[_0xb843('0xc')]);router[_0xb843('0xd')](_0xb843('0x8'),auth[_0xb843('0x6')](),controller[_0xb843('0xe')]);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 c621d25..7a74d68 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 _0x2364=['parse','isArray','values','stringify','BOOLEAN','ENUM','lodash','exports','alias','STRING','setDataValue','getDataValue','name','TEXT','long','type','select'];(function(_0x5dbacd,_0x12a43e){var _0x1125a2=function(_0x55ef64){while(--_0x55ef64){_0x5dbacd['push'](_0x5dbacd['shift']());}};_0x1125a2(++_0x12a43e);}(_0x2364,0xb0));var _0x4236=function(_0x393082,_0x1941c7){_0x393082=_0x393082-0x0;var _0x38e90e=_0x2364[_0x393082];return _0x38e90e;};'use strict';var Sequelize=require('sequelize');var _=require(_0x4236('0x0'));module[_0x4236('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2413d7){return this['getDataValue'](_0x4236('0x2'));}},'alias':{'type':Sequelize[_0x4236('0x3')],'allowNull':![],'set':function(_0x23ff43){this[_0x4236('0x4')](_0x4236('0x2'),_0x23ff43?_0x23ff43:this[_0x4236('0x5')](_0x4236('0x6')));}},'type':{'type':Sequelize[_0x4236('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0x4236('0x7')](_0x4236('0x8')),'get':function(){if(this['getDataValue'](_0x4236('0x9'))===_0x4236('0xa')){return JSON[_0x4236('0xb')](this['getDataValue']('values'));}else{return this[_0x4236('0x5')]('values');}},'set':function(_0x29c2f5){if(Array[_0x4236('0xc')](_0x29c2f5)){this[_0x4236('0x4')](_0x4236('0xd'),JSON[_0x4236('0xe')](_0x29c2f5));}else{this[_0x4236('0x4')]('values',_0x29c2f5);}}},'required':{'type':Sequelize[_0x4236('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x4236('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x4236('0x10')]('voice')}}; \ No newline at end of file +var _0x3ff5=['select','parse','isArray','stringify','setDataValue','BOOLEAN','ENUM','sequelize','lodash','exports','VIRTUAL','getDataValue','name','STRING','TEXT'];(function(_0x5432f9,_0x4209f5){var _0x36734c=function(_0x2aacd5){while(--_0x2aacd5){_0x5432f9['push'](_0x5432f9['shift']());}};_0x36734c(++_0x4209f5);}(_0x3ff5,0x19c));var _0x53ff=function(_0x2366d1,_0x18075f){_0x2366d1=_0x2366d1-0x0;var _0x32ed70=_0x3ff5[_0x2366d1];return _0x32ed70;};'use strict';var Sequelize=require(_0x53ff('0x0'));var _=require(_0x53ff('0x1'));module[_0x53ff('0x2')]={'name':{'type':Sequelize[_0x53ff('0x3')],'get':function(_0x3effed){return this[_0x53ff('0x4')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x49103d){this['setDataValue']('alias',_0x49103d?_0x49103d:this['getDataValue'](_0x53ff('0x5')));}},'type':{'type':Sequelize[_0x53ff('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x53ff('0x7')]('long'),'get':function(){if(this[_0x53ff('0x4')]('type')===_0x53ff('0x8')){return JSON[_0x53ff('0x9')](this[_0x53ff('0x4')]('values'));}else{return this[_0x53ff('0x4')]('values');}},'set':function(_0x5a321f){if(Array[_0x53ff('0xa')](_0x5a321f)){this['setDataValue']('values',JSON[_0x53ff('0xb')](_0x5a321f));}else{this[_0x53ff('0xc')]('values',_0x5a321f);}}},'required':{'type':Sequelize[_0x53ff('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x53ff('0xe')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index d702b0a..610f37d 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 _0x674e=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','options','CmCustomField','includeAll','include','rows','catch','merge','find','body','create','sequelize','Sequelize','TEXT','switch','BOOLEAN','addColumn','format','cf_%d','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','set','apply','reject','save','then','destroy','sendStatus','error','name','index','rawAttributes','fieldName','type','key','differenceBy','map','query','keys','filters'];(function(_0x458506,_0x5937e1){var _0x46395f=function(_0x33900b){while(--_0x33900b){_0x458506['push'](_0x458506['shift']());}};_0x46395f(++_0x5937e1);}(_0x674e,0x1f3));var _0xe674=function(_0x4c0091,_0x47d8d5){_0x4c0091=_0x4c0091-0x0;var _0x36b26f=_0x674e[_0x4c0091];return _0x36b26f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe674('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe674('0x1'));var rp=require(_0xe674('0x2'));var moment=require('moment');var BPromise=require(_0xe674('0x3'));var Mustache=require(_0xe674('0x4'));var util=require(_0xe674('0x5'));var path=require(_0xe674('0x6'));var sox=require(_0xe674('0x7'));var csv=require(_0xe674('0x8'));var ejs=require(_0xe674('0x9'));var fs=require('fs');var fs_extra=require(_0xe674('0xa'));var _=require(_0xe674('0xb'));var squel=require('squel');var crypto=require(_0xe674('0xc'));var jsforce=require(_0xe674('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe674('0x8'));var querystring=require(_0xe674('0xe'));var Papa=require(_0xe674('0xf'));var Redis=require(_0xe674('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe674('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe674('0x12'))(_0xe674('0x13'));var utils=require(_0xe674('0x14'));var config=require(_0xe674('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe674('0x16'))['db'];function respondWithStatusCode(_0x3e21af,_0x19fce8){_0x19fce8=_0x19fce8||0xcc;return function(_0x8abdcc){if(_0x8abdcc){return _0x3e21af['sendStatus'](_0x19fce8);}return _0x3e21af[_0xe674('0x17')](_0x19fce8)['end']();};}function respondWithResult(_0x2c9995,_0xeccfee){_0xeccfee=_0xeccfee||0xc8;return function(_0x1a85a6){if(_0x1a85a6){return _0x2c9995[_0xe674('0x17')](_0xeccfee)[_0xe674('0x18')](_0x1a85a6);}};}function respondWithFilteredResult(_0x480377,_0x29cd8b){return function(_0x5a5783){if(_0x5a5783){var _0x171a15=typeof _0x29cd8b[_0xe674('0x19')]===_0xe674('0x1a')&&typeof _0x29cd8b['limit']===_0xe674('0x1a');var _0x3a5d3d=_0x5a5783[_0xe674('0x1b')];var _0x2f5883=_0x171a15?0x0:_0x29cd8b['offset'];var _0x57f156=_0x171a15?_0x5a5783[_0xe674('0x1b')]:_0x29cd8b[_0xe674('0x19')]+_0x29cd8b['limit'];var _0x3b2d5f;if(_0x57f156>=_0x3a5d3d){_0x57f156=_0x3a5d3d;_0x3b2d5f=0xc8;}else{_0x3b2d5f=0xce;}_0x480377[_0xe674('0x17')](_0x3b2d5f);return _0x480377[_0xe674('0x1c')]('Content-Range',_0x2f5883+'-'+_0x57f156+'/'+_0x3a5d3d)[_0xe674('0x18')](_0x5a5783);}return null;};}function patchUpdates(_0x474110){return function(_0x281744){try{jsonpatch[_0xe674('0x1d')](_0x281744,_0x474110,!![]);}catch(_0x306522){return BPromise[_0xe674('0x1e')](_0x306522);}return _0x281744[_0xe674('0x1f')]();};}function saveUpdates(_0x379057,_0x1cb720){return function(_0x3cd361){if(_0x3cd361){return _0x3cd361['update'](_0x379057)[_0xe674('0x20')](function(_0x1dfc94){return _0x1dfc94;});}return null;};}function removeEntity(_0x27830d,_0x21710d){return function(_0x56eb08){if(_0x56eb08){return _0x56eb08[_0xe674('0x21')]()[_0xe674('0x20')](function(){_0x27830d[_0xe674('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39cc7c,_0x11a9b7){return function(_0x1c560e){if(!_0x1c560e){_0x39cc7c[_0xe674('0x22')](0x194);}return _0x1c560e;};}function handleError(_0x3e62ee,_0x38f0f9){_0x38f0f9=_0x38f0f9||0x1f4;return function(_0x23ad23){logger[_0xe674('0x23')](_0x23ad23['stack']);if(_0x23ad23[_0xe674('0x24')]){delete _0x23ad23[_0xe674('0x24')];}_0x3e62ee[_0xe674('0x17')](_0x38f0f9)['send'](_0x23ad23);};}exports[_0xe674('0x25')]=function(_0x442223,_0x3abcb4){var _0x4a54e9={},_0x47ce25={},_0x3714b2={'count':0x0,'rows':[]};var _0x17c6b1=_['map'](db['CmCustomField'][_0xe674('0x26')],function(_0x1ee1d8){return{'name':_0x1ee1d8[_0xe674('0x27')],'type':_0x1ee1d8[_0xe674('0x28')][_0xe674('0x29')]};});_0x47ce25['model']=_[_0xe674('0x2a')](_[_0xe674('0x2b')](_0x17c6b1,_0xe674('0x24')),[_0xe674('0x24')]);_0x47ce25[_0xe674('0x2c')]=_[_0xe674('0x2d')](_0x442223[_0xe674('0x2c')]);_0x47ce25[_0xe674('0x2e')]=_[_0xe674('0x2f')](_0x47ce25[_0xe674('0x30')],_0x47ce25[_0xe674('0x2c')]);_0x4a54e9[_0xe674('0x31')]=_[_0xe674('0x2f')](_0x47ce25[_0xe674('0x30')],qs['fields'](_0x442223[_0xe674('0x2c')][_0xe674('0x32')]));_0x4a54e9['attributes']=_0x4a54e9[_0xe674('0x31')][_0xe674('0x33')]?_0x4a54e9[_0xe674('0x31')]:_0x47ce25['model'];if(!_0x442223[_0xe674('0x2c')][_0xe674('0x34')](_0xe674('0x35'))){_0x4a54e9[_0xe674('0x36')]=qs[_0xe674('0x36')](_0x442223[_0xe674('0x2c')][_0xe674('0x36')]);_0x4a54e9[_0xe674('0x19')]=qs[_0xe674('0x19')](_0x442223[_0xe674('0x2c')][_0xe674('0x19')]);}_0x4a54e9[_0xe674('0x37')]=qs[_0xe674('0x38')](_0x442223[_0xe674('0x2c')][_0xe674('0x38')]);_0x4a54e9[_0xe674('0x39')]=qs[_0xe674('0x2e')](_[_0xe674('0x3a')](_0x442223['query'],_0x47ce25[_0xe674('0x2e')]),_0x17c6b1);if(_0x442223[_0xe674('0x2c')][_0xe674('0x3b')]){_0x4a54e9[_0xe674('0x39')]=_['merge'](_0x4a54e9[_0xe674('0x39')],{'$or':_[_0xe674('0x2b')](_0x17c6b1,function(_0x2ee0c7){if(_0x2ee0c7['type']!=='VIRTUAL'){var _0x4a2a16={};_0x4a2a16[_0x2ee0c7[_0xe674('0x24')]]={'$like':'%'+_0x442223['query'][_0xe674('0x3b')]+'%'};return _0x4a2a16;}})});}_0x4a54e9=_['merge']({},_0x4a54e9,_0x442223[_0xe674('0x3c')]);var _0x5d35c4={'where':_0x4a54e9[_0xe674('0x39')]};return db[_0xe674('0x3d')][_0xe674('0x1b')](_0x5d35c4)[_0xe674('0x20')](function(_0x2fd580){_0x3714b2[_0xe674('0x1b')]=_0x2fd580;if(_0x442223['query'][_0xe674('0x3e')]){_0x4a54e9[_0xe674('0x3f')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x4a54e9);})['then'](function(_0x549af2){_0x3714b2[_0xe674('0x40')]=_0x549af2;return _0x3714b2;})[_0xe674('0x20')](respondWithFilteredResult(_0x3abcb4,_0x4a54e9))[_0xe674('0x41')](handleError(_0x3abcb4,null));};exports['show']=function(_0x1c2844,_0x2cde47){var _0x70c776={'raw':!![],'where':{'id':_0x1c2844['params']['id']}},_0x3d87a3={};_0x3d87a3['model']=_[_0xe674('0x2d')](db[_0xe674('0x3d')][_0xe674('0x26')]);_0x3d87a3['query']=_[_0xe674('0x2d')](_0x1c2844[_0xe674('0x2c')]);_0x3d87a3['filters']=_[_0xe674('0x2f')](_0x3d87a3[_0xe674('0x30')],_0x3d87a3[_0xe674('0x2c')]);_0x70c776[_0xe674('0x31')]=_[_0xe674('0x2f')](_0x3d87a3[_0xe674('0x30')],qs[_0xe674('0x32')](_0x1c2844[_0xe674('0x2c')]['fields']));_0x70c776[_0xe674('0x31')]=_0x70c776[_0xe674('0x31')][_0xe674('0x33')]?_0x70c776['attributes']:_0x3d87a3[_0xe674('0x30')];if(_0x1c2844[_0xe674('0x2c')][_0xe674('0x3e')]){_0x70c776[_0xe674('0x3f')]=[{'all':!![]}];}_0x70c776=_[_0xe674('0x42')]({},_0x70c776,_0x1c2844[_0xe674('0x3c')]);return db[_0xe674('0x3d')][_0xe674('0x43')](_0x70c776)[_0xe674('0x20')](handleEntityNotFound(_0x2cde47,null))['then'](respondWithResult(_0x2cde47,null))[_0xe674('0x41')](handleError(_0x2cde47,null));};exports['update']=function(_0xee5bbf,_0x2da48b){if(_0xee5bbf['body']['id']){delete _0xee5bbf[_0xe674('0x44')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0xee5bbf['params']['id']}})[_0xe674('0x20')](handleEntityNotFound(_0x2da48b,null))['then'](saveUpdates(_0xee5bbf[_0xe674('0x44')],null))[_0xe674('0x20')](respondWithResult(_0x2da48b,null))[_0xe674('0x41')](handleError(_0x2da48b,null));};exports[_0xe674('0x21')]=function(_0x2dd8ce,_0x21b3eb){return db[_0xe674('0x3d')]['find']({'where':{'id':_0x2dd8ce['params']['id']}})[_0xe674('0x20')](handleEntityNotFound(_0x21b3eb,null))[_0xe674('0x20')](removeEntity(_0x21b3eb,null))['catch'](handleError(_0x21b3eb,null));};exports[_0xe674('0x45')]=function(_0x35c53e,_0x433d72){var _0x48b607;return db[_0xe674('0x46')]['transaction'](function(_0x20838c){return db[_0xe674('0x3d')][_0xe674('0x45')](_0x35c53e[_0xe674('0x44')],{'transaction':_0x20838c})[_0xe674('0x20')](function(_0x5e28de){_0x48b607=_0x5e28de;var _0x2b2ab7={'type':db[_0xe674('0x47')][_0xe674('0x48')],'transaction':_0x20838c};switch(_0x35c53e[_0xe674('0x44')][_0xe674('0x28')]){case'text':_0x2b2ab7[_0xe674('0x28')]=db[_0xe674('0x47')][_0xe674('0x48')];break;case'number':_0x2b2ab7[_0xe674('0x28')]=db[_0xe674('0x47')]['INTEGER'];break;case _0xe674('0x49'):_0x2b2ab7[_0xe674('0x28')]=db['Sequelize'][_0xe674('0x4a')];_0x2b2ab7['defaultValue']=![];break;default:}return db[_0xe674('0x46')]['queryInterface'][_0xe674('0x4b')]('cm_contacts',util[_0xe674('0x4c')](_0xe674('0x4d'),_0x48b607['id']),_0x2b2ab7);})[_0xe674('0x20')](function(){return _0x48b607;});})[_0xe674('0x20')](respondWithResult(_0x433d72,0xc9))[_0xe674('0x41')](handleError(_0x433d72,null));}; \ No newline at end of file +var _0xe247=['defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','request-promise','moment','bluebird','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/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','save','then','destroy','end','error','stack','name','send','index','map','CmCustomField','fieldName','type','key','model','differenceBy','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rows','catch','show','rawAttributes','includeAll','update','find','params','transaction','Sequelize','TEXT','INTEGER','switch','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe247,0xae));var _0x7e24=function(_0x52fd6c,_0x47c3ca){_0x52fd6c=_0x52fd6c-0x0;var _0x4c32c6=_0xe247[_0x52fd6c];return _0x4c32c6;};'use strict';var emlformat=require(_0x7e24('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7e24('0x1'));var moment=require(_0x7e24('0x2'));var BPromise=require(_0x7e24('0x3'));var Mustache=require('mustache');var util=require(_0x7e24('0x4'));var path=require('path');var sox=require(_0x7e24('0x5'));var csv=require(_0x7e24('0x6'));var ejs=require(_0x7e24('0x7'));var fs=require('fs');var fs_extra=require(_0x7e24('0x8'));var _=require(_0x7e24('0x9'));var squel=require(_0x7e24('0xa'));var crypto=require(_0x7e24('0xb'));var jsforce=require(_0x7e24('0xc'));var deskjs=require(_0x7e24('0xd'));var toCsv=require(_0x7e24('0x6'));var querystring=require(_0x7e24('0xe'));var Papa=require('papaparse');var Redis=require(_0x7e24('0xf'));var authService=require(_0x7e24('0x10'));var qs=require(_0x7e24('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e24('0x12'));var logger=require(_0x7e24('0x13'))(_0x7e24('0x14'));var utils=require(_0x7e24('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7e24('0x16'))['db'];function respondWithStatusCode(_0x3503db,_0x3dff14){_0x3dff14=_0x3dff14||0xcc;return function(_0x288d15){if(_0x288d15){return _0x3503db[_0x7e24('0x17')](_0x3dff14);}return _0x3503db[_0x7e24('0x18')](_0x3dff14)['end']();};}function respondWithResult(_0x4b495b,_0x4ba392){_0x4ba392=_0x4ba392||0xc8;return function(_0x2e5107){if(_0x2e5107){return _0x4b495b[_0x7e24('0x18')](_0x4ba392)[_0x7e24('0x19')](_0x2e5107);}};}function respondWithFilteredResult(_0x50215f,_0x33db5e){return function(_0x44d90e){if(_0x44d90e){var _0x1ef899=typeof _0x33db5e[_0x7e24('0x1a')]===_0x7e24('0x1b')&&typeof _0x33db5e['limit']==='undefined';var _0x26e215=_0x44d90e[_0x7e24('0x1c')];var _0x48fcd2=_0x1ef899?0x0:_0x33db5e['offset'];var _0x475959=_0x1ef899?_0x44d90e[_0x7e24('0x1c')]:_0x33db5e[_0x7e24('0x1a')]+_0x33db5e[_0x7e24('0x1d')];var _0x4a896e;if(_0x475959>=_0x26e215){_0x475959=_0x26e215;_0x4a896e=0xc8;}else{_0x4a896e=0xce;}_0x50215f[_0x7e24('0x18')](_0x4a896e);return _0x50215f['set'](_0x7e24('0x1e'),_0x48fcd2+'-'+_0x475959+'/'+_0x26e215)[_0x7e24('0x19')](_0x44d90e);}return null;};}function patchUpdates(_0x26efa9){return function(_0x2315fd){try{jsonpatch['apply'](_0x2315fd,_0x26efa9,!![]);}catch(_0x5afc24){return BPromise['reject'](_0x5afc24);}return _0x2315fd[_0x7e24('0x1f')]();};}function saveUpdates(_0xb0d325,_0x91dfaa){return function(_0x19bc31){if(_0x19bc31){return _0x19bc31['update'](_0xb0d325)[_0x7e24('0x20')](function(_0x459751){return _0x459751;});}return null;};}function removeEntity(_0x55be80,_0x354f47){return function(_0x5ee981){if(_0x5ee981){return _0x5ee981[_0x7e24('0x21')]()['then'](function(){_0x55be80[_0x7e24('0x18')](0xcc)[_0x7e24('0x22')]();});}};}function handleEntityNotFound(_0x100de3,_0x28f8c2){return function(_0x294e48){if(!_0x294e48){_0x100de3['sendStatus'](0x194);}return _0x294e48;};}function handleError(_0x34cdd4,_0x1e0187){_0x1e0187=_0x1e0187||0x1f4;return function(_0x5e6616){logger[_0x7e24('0x23')](_0x5e6616[_0x7e24('0x24')]);if(_0x5e6616[_0x7e24('0x25')]){delete _0x5e6616[_0x7e24('0x25')];}_0x34cdd4[_0x7e24('0x18')](_0x1e0187)[_0x7e24('0x26')](_0x5e6616);};}exports[_0x7e24('0x27')]=function(_0x2c7ba0,_0x32fa47){var _0x102e3c={},_0x2a32e7={},_0x5d5c20={'count':0x0,'rows':[]};var _0x2df4c0=_[_0x7e24('0x28')](db[_0x7e24('0x29')]['rawAttributes'],function(_0x68e935){return{'name':_0x68e935[_0x7e24('0x2a')],'type':_0x68e935[_0x7e24('0x2b')][_0x7e24('0x2c')]};});_0x2a32e7[_0x7e24('0x2d')]=_[_0x7e24('0x2e')](_[_0x7e24('0x28')](_0x2df4c0,_0x7e24('0x25')),[_0x7e24('0x25')]);_0x2a32e7[_0x7e24('0x2f')]=_[_0x7e24('0x30')](_0x2c7ba0[_0x7e24('0x2f')]);_0x2a32e7[_0x7e24('0x31')]=_['intersection'](_0x2a32e7[_0x7e24('0x2d')],_0x2a32e7[_0x7e24('0x2f')]);_0x102e3c[_0x7e24('0x32')]=_[_0x7e24('0x33')](_0x2a32e7[_0x7e24('0x2d')],qs[_0x7e24('0x34')](_0x2c7ba0[_0x7e24('0x2f')][_0x7e24('0x34')]));_0x102e3c[_0x7e24('0x32')]=_0x102e3c['attributes'][_0x7e24('0x35')]?_0x102e3c[_0x7e24('0x32')]:_0x2a32e7[_0x7e24('0x2d')];if(!_0x2c7ba0[_0x7e24('0x2f')][_0x7e24('0x36')](_0x7e24('0x37'))){_0x102e3c['limit']=qs[_0x7e24('0x1d')](_0x2c7ba0[_0x7e24('0x2f')][_0x7e24('0x1d')]);_0x102e3c[_0x7e24('0x1a')]=qs['offset'](_0x2c7ba0[_0x7e24('0x2f')][_0x7e24('0x1a')]);}_0x102e3c[_0x7e24('0x38')]=qs[_0x7e24('0x39')](_0x2c7ba0[_0x7e24('0x2f')][_0x7e24('0x39')]);_0x102e3c[_0x7e24('0x3a')]=qs[_0x7e24('0x31')](_[_0x7e24('0x3b')](_0x2c7ba0[_0x7e24('0x2f')],_0x2a32e7[_0x7e24('0x31')]),_0x2df4c0);if(_0x2c7ba0[_0x7e24('0x2f')][_0x7e24('0x3c')]){_0x102e3c[_0x7e24('0x3a')]=_[_0x7e24('0x3d')](_0x102e3c[_0x7e24('0x3a')],{'$or':_[_0x7e24('0x28')](_0x2df4c0,function(_0x5c2ffb){if(_0x5c2ffb[_0x7e24('0x2b')]!=='VIRTUAL'){var _0x5a2a4d={};_0x5a2a4d[_0x5c2ffb['name']]={'$like':'%'+_0x2c7ba0['query'][_0x7e24('0x3c')]+'%'};return _0x5a2a4d;}})});}_0x102e3c=_[_0x7e24('0x3d')]({},_0x102e3c,_0x2c7ba0[_0x7e24('0x3e')]);var _0x2c15b8={'where':_0x102e3c[_0x7e24('0x3a')]};return db[_0x7e24('0x29')][_0x7e24('0x1c')](_0x2c15b8)[_0x7e24('0x20')](function(_0x2e9bfc){_0x5d5c20[_0x7e24('0x1c')]=_0x2e9bfc;if(_0x2c7ba0[_0x7e24('0x2f')]['includeAll']){_0x102e3c[_0x7e24('0x3f')]=[{'all':!![]}];}return db[_0x7e24('0x29')]['findAll'](_0x102e3c);})['then'](function(_0x16cd72){_0x5d5c20[_0x7e24('0x40')]=_0x16cd72;return _0x5d5c20;})[_0x7e24('0x20')](respondWithFilteredResult(_0x32fa47,_0x102e3c))[_0x7e24('0x41')](handleError(_0x32fa47,null));};exports[_0x7e24('0x42')]=function(_0x2119f4,_0x40a6a2){var _0x16f635={'raw':!![],'where':{'id':_0x2119f4['params']['id']}},_0x401dd0={};_0x401dd0[_0x7e24('0x2d')]=_[_0x7e24('0x30')](db[_0x7e24('0x29')][_0x7e24('0x43')]);_0x401dd0['query']=_[_0x7e24('0x30')](_0x2119f4[_0x7e24('0x2f')]);_0x401dd0[_0x7e24('0x31')]=_[_0x7e24('0x33')](_0x401dd0[_0x7e24('0x2d')],_0x401dd0[_0x7e24('0x2f')]);_0x16f635[_0x7e24('0x32')]=_['intersection'](_0x401dd0['model'],qs['fields'](_0x2119f4['query'][_0x7e24('0x34')]));_0x16f635[_0x7e24('0x32')]=_0x16f635[_0x7e24('0x32')]['length']?_0x16f635['attributes']:_0x401dd0[_0x7e24('0x2d')];if(_0x2119f4[_0x7e24('0x2f')][_0x7e24('0x44')]){_0x16f635[_0x7e24('0x3f')]=[{'all':!![]}];}_0x16f635=_[_0x7e24('0x3d')]({},_0x16f635,_0x2119f4[_0x7e24('0x3e')]);return db[_0x7e24('0x29')]['find'](_0x16f635)[_0x7e24('0x20')](handleEntityNotFound(_0x40a6a2,null))['then'](respondWithResult(_0x40a6a2,null))[_0x7e24('0x41')](handleError(_0x40a6a2,null));};exports[_0x7e24('0x45')]=function(_0x128e79,_0x26e958){if(_0x128e79['body']['id']){delete _0x128e79['body']['id'];}return db['CmCustomField'][_0x7e24('0x46')]({'where':{'id':_0x128e79['params']['id']}})[_0x7e24('0x20')](handleEntityNotFound(_0x26e958,null))['then'](saveUpdates(_0x128e79['body'],null))[_0x7e24('0x20')](respondWithResult(_0x26e958,null))['catch'](handleError(_0x26e958,null));};exports[_0x7e24('0x21')]=function(_0x2d920a,_0x12de21){return db[_0x7e24('0x29')][_0x7e24('0x46')]({'where':{'id':_0x2d920a[_0x7e24('0x47')]['id']}})[_0x7e24('0x20')](handleEntityNotFound(_0x12de21,null))['then'](removeEntity(_0x12de21,null))[_0x7e24('0x41')](handleError(_0x12de21,null));};exports['create']=function(_0x1cbed3,_0x2294f9){var _0x4e4659;return db['sequelize'][_0x7e24('0x48')](function(_0x5df0c9){return db[_0x7e24('0x29')]['create'](_0x1cbed3['body'],{'transaction':_0x5df0c9})[_0x7e24('0x20')](function(_0x1a4d2c){_0x4e4659=_0x1a4d2c;var _0x17386b={'type':db[_0x7e24('0x49')][_0x7e24('0x4a')],'transaction':_0x5df0c9};switch(_0x1cbed3['body'][_0x7e24('0x2b')]){case'text':_0x17386b[_0x7e24('0x2b')]=db[_0x7e24('0x49')][_0x7e24('0x4a')];break;case'number':_0x17386b[_0x7e24('0x2b')]=db[_0x7e24('0x49')][_0x7e24('0x4b')];break;case _0x7e24('0x4c'):_0x17386b[_0x7e24('0x2b')]=db[_0x7e24('0x49')][_0x7e24('0x4d')];_0x17386b[_0x7e24('0x4e')]=![];break;default:}return db['sequelize'][_0x7e24('0x4f')][_0x7e24('0x50')](_0x7e24('0x51'),util[_0x7e24('0x52')](_0x7e24('0x53'),_0x4e4659['id']),_0x17386b);})[_0x7e24('0x20')](function(){return _0x4e4659;});})[_0x7e24('0x20')](respondWithResult(_0x2294f9,0xc9))[_0x7e24('0x41')](handleError(_0x2294f9,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index fdc3a9f..3293b73 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 _0x8cd4=['../../config/logger','api','moment','path','rimraf','./cmCustomField.attributes','exports','define','lodash','util'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x8cd4,0x170));var _0x48cd=function(_0x4bf0a3,_0x375172){_0x4bf0a3=_0x4bf0a3-0x0;var _0x366e64=_0x8cd4[_0x4bf0a3];return _0x366e64;};'use strict';var _=require(_0x48cd('0x0'));var util=require(_0x48cd('0x1'));var logger=require(_0x48cd('0x2'))(_0x48cd('0x3'));var moment=require(_0x48cd('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x48cd('0x5'));var rimraf=require(_0x48cd('0x6'));var config=require('../../config/environment');var attributes=require(_0x48cd('0x7'));module[_0x48cd('0x8')]=function(_0x4be917,_0x134a2e){return _0x4be917[_0x48cd('0x9')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ba8=['bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','cm_custom_fields','util','../../config/logger','api','moment'];(function(_0x35cbdc,_0x1b6fcb){var _0x3475e4=function(_0x4d9aa0){while(--_0x4d9aa0){_0x35cbdc['push'](_0x35cbdc['shift']());}};_0x3475e4(++_0x1b6fcb);}(_0x0ba8,0xcc));var _0x80ba=function(_0x7c2b6f,_0x2adc63){_0x7c2b6f=_0x7c2b6f-0x0;var _0x4f8bf6=_0x0ba8[_0x7c2b6f];return _0x4f8bf6;};'use strict';var _=require('lodash');var util=require(_0x80ba('0x0'));var logger=require(_0x80ba('0x1'))(_0x80ba('0x2'));var moment=require(_0x80ba('0x3'));var BPromise=require(_0x80ba('0x4'));var rp=require(_0x80ba('0x5'));var fs=require('fs');var path=require(_0x80ba('0x6'));var rimraf=require(_0x80ba('0x7'));var config=require(_0x80ba('0x8'));var attributes=require(_0x80ba('0x9'));module[_0x80ba('0xa')]=function(_0x255cd0,_0x48d1f6){return _0x255cd0[_0x80ba('0xb')]('CmCustomField',attributes,{'tableName':_0x80ba('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 501ba52..aad1908 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 _0xd232=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','moment'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xd232,0xb3));var _0x2d23=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd232[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2d23('0x0'));var BPromise=require(_0x2d23('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d23('0x2'));var db=require(_0x2d23('0x3'))['db'];var utils=require(_0x2d23('0x4'));var logger=require('../../config/logger')(_0x2d23('0x5'));var config=require('../../config/environment');var jayson=require(_0x2d23('0x6'));var client=jayson['client'][_0x2d23('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4d7783,_0x3a2699,_0x438cc5){return new BPromise(function(_0x55eaac,_0x1a3c48){return client['request'](_0x4d7783,_0x438cc5)['then'](function(_0xf9aa78){logger[_0x2d23('0x8')](_0x2d23('0x9'),_0x3a2699,_0x2d23('0xa'));logger[_0x2d23('0xb')](_0x2d23('0xc'),_0x3a2699,_0x2d23('0xa'),JSON['stringify'](_0xf9aa78));if(_0xf9aa78['error']){if(_0xf9aa78['error'][_0x2d23('0xd')]===0x1f4){logger[_0x2d23('0xe')](_0x2d23('0x9'),_0x3a2699,_0xf9aa78[_0x2d23('0xe')][_0x2d23('0xf')]);return _0x1a3c48(_0xf9aa78['error'][_0x2d23('0xf')]);}logger[_0x2d23('0xe')](_0x2d23('0x9'),_0x3a2699,_0xf9aa78['error'][_0x2d23('0xf')]);return _0x55eaac(_0xf9aa78[_0x2d23('0xe')][_0x2d23('0xf')]);}else{logger['info'](_0x2d23('0x9'),_0x3a2699,'request\x20sent');_0x55eaac(_0xf9aa78[_0x2d23('0x10')][_0x2d23('0xf')]);}})[_0x2d23('0x11')](function(_0x71c4c8){logger['error'](_0x2d23('0x9'),_0x3a2699,_0x71c4c8);_0x1a3c48(_0x71c4c8);});});} \ No newline at end of file +var _0xdb18=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','randomstring','ioredis'];(function(_0x5c3e2e,_0x3c59a4){var _0x3a3883=function(_0x2b6caf){while(--_0x2b6caf){_0x5c3e2e['push'](_0x5c3e2e['shift']());}};_0x3a3883(++_0x3c59a4);}(_0xdb18,0x1e0));var _0x8db1=function(_0x5d7062,_0x1e2029){_0x5d7062=_0x5d7062-0x0;var _0x50cd61=_0xdb18[_0x5d7062];return _0x50cd61;};'use strict';var _=require(_0x8db1('0x0'));var util=require(_0x8db1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8db1('0x2'));var fs=require('fs');var Redis=require(_0x8db1('0x3'));var db=require(_0x8db1('0x4'))['db'];var utils=require(_0x8db1('0x5'));var logger=require(_0x8db1('0x6'))(_0x8db1('0x7'));var config=require(_0x8db1('0x8'));var jayson=require(_0x8db1('0x9'));var client=jayson[_0x8db1('0xa')][_0x8db1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b59c4,_0x1eef82,_0x1abe87){return new BPromise(function(_0x3fbd4b,_0x191d6b){return client['request'](_0x1b59c4,_0x1abe87)['then'](function(_0x1a1e9f){logger[_0x8db1('0xc')](_0x8db1('0xd'),_0x1eef82,_0x8db1('0xe'));logger[_0x8db1('0xf')](_0x8db1('0x10'),_0x1eef82,_0x8db1('0xe'),JSON['stringify'](_0x1a1e9f));if(_0x1a1e9f[_0x8db1('0x11')]){if(_0x1a1e9f[_0x8db1('0x11')][_0x8db1('0x12')]===0x1f4){logger[_0x8db1('0x11')]('CmCustomField,\x20%s,\x20%s',_0x1eef82,_0x1a1e9f[_0x8db1('0x11')][_0x8db1('0x13')]);return _0x191d6b(_0x1a1e9f[_0x8db1('0x11')]['message']);}logger[_0x8db1('0x11')](_0x8db1('0xd'),_0x1eef82,_0x1a1e9f[_0x8db1('0x11')][_0x8db1('0x13')]);return _0x3fbd4b(_0x1a1e9f['error'][_0x8db1('0x13')]);}else{logger[_0x8db1('0xc')]('CmCustomField,\x20%s,\x20%s',_0x1eef82,'request\x20sent');_0x3fbd4b(_0x1a1e9f[_0x8db1('0x14')][_0x8db1('0x13')]);}})[_0x8db1('0x15')](function(_0x295e06){logger[_0x8db1('0x11')](_0x8db1('0xd'),_0x1eef82,_0x295e06);_0x191d6b(_0x295e06);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 00fd269..1890ae0 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 _0x3c2a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer','util','connect-timeout'];(function(_0x57a6f8,_0x5d5cde){var _0x5deef8=function(_0x56cd03){while(--_0x56cd03){_0x57a6f8['push'](_0x57a6f8['shift']());}};_0x5deef8(++_0x5d5cde);}(_0x3c2a,0x1b2));var _0xa3c2=function(_0x9274f8,_0x582257){_0x9274f8=_0x9274f8-0x0;var _0x573cd7=_0x3c2a[_0x9274f8];return _0x573cd7;};'use strict';var multer=require(_0xa3c2('0x0'));var util=require(_0xa3c2('0x1'));var path=require('path');var timeout=require(_0xa3c2('0x2'));var express=require('express');var router=express[_0xa3c2('0x3')]();var fs_extra=require(_0xa3c2('0x4'));var auth=require(_0xa3c2('0x5'));var interaction=require(_0xa3c2('0x6'));var config=require(_0xa3c2('0x7'));var controller=require(_0xa3c2('0x8'));router[_0xa3c2('0x9')]('/',auth[_0xa3c2('0xa')](),controller[_0xa3c2('0xb')]);router[_0xa3c2('0x9')](_0xa3c2('0xc'),auth[_0xa3c2('0xa')](),controller[_0xa3c2('0xd')]);router[_0xa3c2('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa3c2('0xf')](_0xa3c2('0xc'),auth[_0xa3c2('0xa')](),controller[_0xa3c2('0x10')]);router[_0xa3c2('0x11')]('/:id',auth[_0xa3c2('0xa')](),controller['destroy']);module[_0xa3c2('0x12')]=router; \ No newline at end of file +var _0xfa45=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x1925ed,_0xcede37){var _0x25d5b2=function(_0x107d3f){while(--_0x107d3f){_0x1925ed['push'](_0x1925ed['shift']());}};_0x25d5b2(++_0xcede37);}(_0xfa45,0x11b));var _0x5fa4=function(_0x2c6cf2,_0x4633c1){_0x2c6cf2=_0x2c6cf2-0x0;var _0x26dc0a=_0xfa45[_0x2c6cf2];return _0x26dc0a;};'use strict';var multer=require(_0x5fa4('0x0'));var util=require(_0x5fa4('0x1'));var path=require(_0x5fa4('0x2'));var timeout=require(_0x5fa4('0x3'));var express=require(_0x5fa4('0x4'));var router=express[_0x5fa4('0x5')]();var fs_extra=require(_0x5fa4('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5fa4('0x7'));var config=require('../../config/environment');var controller=require(_0x5fa4('0x8'));router[_0x5fa4('0x9')]('/',auth[_0x5fa4('0xa')](),controller[_0x5fa4('0xb')]);router[_0x5fa4('0x9')](_0x5fa4('0xc'),auth[_0x5fa4('0xa')](),controller[_0x5fa4('0xd')]);router[_0x5fa4('0xe')]('/',auth[_0x5fa4('0xa')](),controller['create']);router[_0x5fa4('0xf')]('/:id',auth[_0x5fa4('0xa')](),controller[_0x5fa4('0x10')]);router[_0x5fa4('0x11')](_0x5fa4('0xc'),auth[_0x5fa4('0xa')](),controller[_0x5fa4('0x12')]);module[_0x5fa4('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 31dc421..9bc926c 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 _0xb419=['DATE','UNSIGNED','contactListQueue','moment','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x1dd4ae,_0x42e514){var _0x2ff409=function(_0x3a2609){while(--_0x3a2609){_0x1dd4ae['push'](_0x1dd4ae['shift']());}};_0x2ff409(++_0x42e514);}(_0xb419,0xf6));var _0x9b41=function(_0x5d31cd,_0x1b48cd){_0x5d31cd=_0x5d31cd-0x0;var _0x38808c=_0xb419[_0x5d31cd];return _0x38808c;};'use strict';var moment=require(_0x9b41('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x9b41('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x9b41('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x9b41('0x3')](_0x9b41('0x4'))},'countbusyretry':{'type':Sequelize[_0x9b41('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9b41('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x9b41('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9b41('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9b41('0x6')]},'priority':{'type':Sequelize[_0x9b41('0x5')](0x2)[_0x9b41('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x9b41('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x9b41('0x5')],'unique':_0x9b41('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x9b41('0x8')},'UserId':{'type':Sequelize[_0x9b41('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x9b41('0x5')],'unique':_0x9b41('0x8')},'CampaignId':{'type':Sequelize[_0x9b41('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x9b41('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9b41('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9b41('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9b41('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9b41('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x9b41('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x9b41('0x1')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x0182=['DATE','INTEGER','UNSIGNED','contactListQueue','sequelize','exports','STRING','BOOLEAN'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x0182,0x11c));var _0x2018=function(_0x3937b6,_0xd53d2b){_0x3937b6=_0x3937b6-0x0;var _0x1ba356=_0x0182[_0x3937b6];return _0x1ba356;};'use strict';var moment=require('moment');var Sequelize=require(_0x2018('0x0'));module[_0x2018('0x1')]={'phone':{'type':Sequelize[_0x2018('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x2018('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x2018('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x2018('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2018('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2018('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x2018('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2018('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2018('0x4')]},'priority':{'type':Sequelize[_0x2018('0x5')](0x2)[_0x2018('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x2018('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x2018('0x7')},'ListId':{'type':Sequelize[_0x2018('0x5')],'unique':_0x2018('0x7')},'UserId':{'type':Sequelize[_0x2018('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x2018('0x5')],'unique':_0x2018('0x7')},'CampaignId':{'type':Sequelize[_0x2018('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2018('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2018('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2018('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x2018('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x2018('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x2018('0x4')],'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 6ef6a44..54c9af2 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 _0xbfe8=['CmHopperAdditionalPhone','end','getPreview','preview','dialOrderByScheduledAt','sequelize','transaction','filter','dialPreviewAutoRecallMe','value','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','Company','List','Queue','dialActive','getPreviewRecall','CmList','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','timezones','push','getTimezone','lodash','../../config/logger','api','status','json','offset','undefined','limit','count','set','then','error','stack','name','send','map','CmHopper','type','key','model','query','filters','concat','$and','$gt','$gte','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','include','rows','catch','show','keys','rawAttributes','intersection','length','options','find','create','update','body','params','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','createdAt','updatedAt','state','deleted','campaign','user','UserId','deletedat','format','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x573f85,_0x36146b){_0x573f85=_0x573f85-0x0;var _0x2a312a=_0xbfe8[_0x573f85];return _0x2a312a;};'use strict';var moment=require('moment');var _=require(_0x8bfe('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x8bfe('0x1'))(_0x8bfe('0x2'));var shared=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithResult(_0x101fc1,_0x31df14){_0x31df14=_0x31df14||0xc8;return function(_0x57eb53){if(_0x57eb53){return _0x101fc1[_0x8bfe('0x3')](_0x31df14)[_0x8bfe('0x4')](_0x57eb53);}};}function respondWithFilteredResult(_0x314a9a,_0x4933c9){return function(_0x29bb94){if(_0x29bb94){var _0x1b7dbd=typeof _0x4933c9[_0x8bfe('0x5')]===_0x8bfe('0x6')&&typeof _0x4933c9[_0x8bfe('0x7')]===_0x8bfe('0x6');var _0x19a47e=_0x29bb94[_0x8bfe('0x8')];var _0x243a11=_0x1b7dbd?0x0:_0x4933c9[_0x8bfe('0x5')];var _0x1f19ee=_0x1b7dbd?_0x29bb94[_0x8bfe('0x8')]:_0x4933c9[_0x8bfe('0x5')]+_0x4933c9[_0x8bfe('0x7')];var _0x30f76d;if(_0x1f19ee>=_0x19a47e){_0x1f19ee=_0x19a47e;_0x30f76d=0xc8;}else{_0x30f76d=0xce;}_0x314a9a['status'](_0x30f76d);return _0x314a9a[_0x8bfe('0x9')]('Content-Range',_0x243a11+'-'+_0x1f19ee+'/'+_0x19a47e)[_0x8bfe('0x4')](_0x29bb94);}return null;};}function saveUpdates(_0x2f479d,_0x22a131){return function(_0x5ba48c){if(_0x5ba48c){return _0x5ba48c['update'](_0x2f479d)[_0x8bfe('0xa')](function(_0x425eb8){return _0x425eb8;});}return null;};}function handleEntityNotFound(_0x22737f,_0x36fd25){return function(_0x46c8e3){if(!_0x46c8e3){_0x22737f['sendStatus'](0x194);}return _0x46c8e3;};}function handleError(_0x41cc42,_0x5520d7){_0x5520d7=_0x5520d7||0x1f4;return function(_0x55914b){logger[_0x8bfe('0xb')](_0x55914b[_0x8bfe('0xc')]);if(_0x55914b[_0x8bfe('0xd')]){delete _0x55914b['name'];}_0x41cc42['status'](_0x5520d7)[_0x8bfe('0xe')](_0x55914b);};}exports['index']=function(_0x4d6993,_0x2e7c29){var _0x17d688={},_0x5d8bf1={},_0x13ffc3={'count':0x0,'rows':[]};var _0xfd4a2a=_[_0x8bfe('0xf')](db[_0x8bfe('0x10')]['rawAttributes'],function(_0xbc7fa2){return{'name':_0xbc7fa2['fieldName'],'type':_0xbc7fa2[_0x8bfe('0x11')][_0x8bfe('0x12')]};});_0x5d8bf1[_0x8bfe('0x13')]=_['map'](_0xfd4a2a,'name');_0x5d8bf1[_0x8bfe('0x14')]=_['keys'](_0x4d6993['query']);_0x5d8bf1[_0x8bfe('0x15')]=_['intersection'](_0x5d8bf1[_0x8bfe('0x13')],_0x5d8bf1['query']);_0x5d8bf1[_0x8bfe('0x15')]=_[_0x8bfe('0x16')](_0x5d8bf1[_0x8bfe('0x15')],[_0x8bfe('0x17'),'$or',_0x8bfe('0x18'),_0x8bfe('0x19'),'$lt',_0x8bfe('0x1a'),_0x8bfe('0x1b'),_0x8bfe('0x1c'),_0x8bfe('0x1d'),_0x8bfe('0x1e'),_0x8bfe('0x1f'),'$in',_0x8bfe('0x20'),_0x8bfe('0x21'),_0x8bfe('0x22'),_0x8bfe('0x23'),_0x8bfe('0x24'),_0x8bfe('0x21'),_0x8bfe('0x25'),_0x8bfe('0x26'),_0x8bfe('0x27'),_0x8bfe('0x28')]);_0x17d688[_0x8bfe('0x29')]=_['intersection'](_0x5d8bf1[_0x8bfe('0x13')],qs[_0x8bfe('0x2a')](_0x4d6993['query'][_0x8bfe('0x2a')]));_0x17d688[_0x8bfe('0x29')]=_0x17d688[_0x8bfe('0x29')]['length']?_0x17d688[_0x8bfe('0x29')]:_0x5d8bf1[_0x8bfe('0x13')];if(!_0x4d6993['query']['hasOwnProperty'](_0x8bfe('0x2b'))){_0x17d688[_0x8bfe('0x7')]=qs[_0x8bfe('0x7')](_0x4d6993[_0x8bfe('0x14')][_0x8bfe('0x7')]);_0x17d688[_0x8bfe('0x5')]=qs[_0x8bfe('0x5')](_0x4d6993[_0x8bfe('0x14')][_0x8bfe('0x5')]);}_0x17d688[_0x8bfe('0x2c')]=qs['sort'](_0x4d6993['query'][_0x8bfe('0x2d')]);_0x17d688[_0x8bfe('0x2e')]=qs[_0x8bfe('0x15')](_[_0x8bfe('0x2f')](_0x4d6993[_0x8bfe('0x14')],_0x5d8bf1[_0x8bfe('0x15')]),_0xfd4a2a);if(_0x4d6993[_0x8bfe('0x14')]['filter']){_0x17d688[_0x8bfe('0x2e')]=_[_0x8bfe('0x30')](_0x17d688['where'],{'$or':_[_0x8bfe('0xf')](_0xfd4a2a,function(_0x96cdc9){if(_0x96cdc9[_0x8bfe('0x11')]!==_0x8bfe('0x31')){var _0x407763={};_0x407763[_0x96cdc9['name']]={'$like':'%'+_0x4d6993[_0x8bfe('0x14')]['filter']+'%'};return _0x407763;}})});}_0x17d688=_['merge']({},_0x17d688,_0x4d6993['options']);var _0x56e04b={'where':_0x17d688[_0x8bfe('0x2e')]};return db[_0x8bfe('0x10')][_0x8bfe('0x8')](_0x56e04b)[_0x8bfe('0xa')](function(_0x23ac8b){_0x13ffc3[_0x8bfe('0x8')]=_0x23ac8b;if(_0x4d6993[_0x8bfe('0x14')]['includeAll']){_0x17d688[_0x8bfe('0x32')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x17d688);})['then'](function(_0x18e0e7){_0x13ffc3[_0x8bfe('0x33')]=_0x18e0e7;return _0x13ffc3;})[_0x8bfe('0xa')](respondWithFilteredResult(_0x2e7c29,_0x17d688))[_0x8bfe('0x34')](handleError(_0x2e7c29,null));};exports[_0x8bfe('0x35')]=function(_0x6b96d6,_0x3a65a6){var _0x20b085={'raw':!![],'where':{'id':_0x6b96d6['params']['id']}},_0x52c9da={};_0x52c9da[_0x8bfe('0x13')]=_[_0x8bfe('0x36')](db[_0x8bfe('0x10')][_0x8bfe('0x37')]);_0x52c9da[_0x8bfe('0x14')]=_[_0x8bfe('0x36')](_0x6b96d6[_0x8bfe('0x14')]);_0x52c9da[_0x8bfe('0x15')]=_[_0x8bfe('0x38')](_0x52c9da['model'],_0x52c9da[_0x8bfe('0x14')]);_0x20b085[_0x8bfe('0x29')]=_[_0x8bfe('0x38')](_0x52c9da[_0x8bfe('0x13')],qs[_0x8bfe('0x2a')](_0x6b96d6[_0x8bfe('0x14')][_0x8bfe('0x2a')]));_0x20b085['attributes']=_0x20b085[_0x8bfe('0x29')][_0x8bfe('0x39')]?_0x20b085['attributes']:_0x52c9da[_0x8bfe('0x13')];if(_0x6b96d6['query']['includeAll']){_0x20b085[_0x8bfe('0x32')]=[{'all':!![]}];}_0x20b085=_[_0x8bfe('0x30')]({},_0x20b085,_0x6b96d6[_0x8bfe('0x3a')]);return db['CmHopper'][_0x8bfe('0x3b')](_0x20b085)['then'](handleEntityNotFound(_0x3a65a6,null))[_0x8bfe('0xa')](respondWithResult(_0x3a65a6,null))[_0x8bfe('0x34')](handleError(_0x3a65a6,null));};exports['create']=function(_0x1b99ec,_0x3433a1){return db[_0x8bfe('0x10')][_0x8bfe('0x3c')](_0x1b99ec['body'],{})[_0x8bfe('0xa')](respondWithResult(_0x3433a1,0xc9))[_0x8bfe('0x34')](handleError(_0x3433a1,null));};exports[_0x8bfe('0x3d')]=function(_0x4af00f,_0x58342b){if(_0x4af00f[_0x8bfe('0x3e')]['id']){delete _0x4af00f[_0x8bfe('0x3e')]['id'];}return db[_0x8bfe('0x10')][_0x8bfe('0x3b')]({'where':{'id':_0x4af00f[_0x8bfe('0x3f')]['id']}})[_0x8bfe('0xa')](handleEntityNotFound(_0x58342b,null))[_0x8bfe('0xa')](saveUpdates(_0x4af00f[_0x8bfe('0x3e')],null))['then'](respondWithResult(_0x58342b,null))[_0x8bfe('0x34')](handleError(_0x58342b,null));};exports[_0x8bfe('0x40')]=function(_0x4e6949,_0x4eb069){return db[_0x8bfe('0x10')][_0x8bfe('0x40')]()[_0x8bfe('0xa')](respondWithResult(_0x4eb069,null))['catch'](handleError(_0x4eb069,null));};exports[_0x8bfe('0x41')]=function(_0x3c4086,_0x55ad6e){var _0x1f2788;var _0x2ad3c1=_0x3c4086[_0x8bfe('0x3f')]['id'];return db[_0x8bfe('0x10')][_0x8bfe('0x3b')]({'where':{'id':_0x3c4086[_0x8bfe('0x3f')]['id']}})['then'](handleEntityNotFound(_0x55ad6e,null))['then'](function(_0x5a653d){if(_0x5a653d){return _0x5a653d['destroy']()[_0x8bfe('0xa')](function(_0x2b84a3){return _0x2b84a3;});}})[_0x8bfe('0xa')](function(_0x28947e){_0x1f2788=_0x28947e;if(_0x28947e){if(_0x28947e[_0x8bfe('0x42')]||_0x28947e['CampaignId']){return db[_0x28947e[_0x8bfe('0x42')]?_0x8bfe('0x43'):_0x8bfe('0x44')][_0x8bfe('0x3b')]({'where':{'id':_0x28947e[_0x8bfe('0x42')]?_0x28947e[_0x8bfe('0x42')]:_0x28947e['CampaignId']},'attributes':['id',_0x8bfe('0xd')],'raw':!![]});}}})[_0x8bfe('0xa')](function(_0x4ddb08){var _0x16d99e={};if(_0x4ddb08){_['merge'](_0x16d99e,_['omit'](_0x1f2788['dataValues'],[_0x8bfe('0x45'),_0x8bfe('0x46'),'id']));_0x16d99e[_0x8bfe('0x47')]=0x15;_0x16d99e['statedesc']=_0x8bfe('0x48');_0x16d99e[_0x8bfe('0x49')]=_0x4ddb08[_0x8bfe('0xd')];_0x16d99e['membername']=_0x3c4086[_0x8bfe('0x4a')][_0x8bfe('0xd')];_0x16d99e[_0x8bfe('0x4b')]=_0x3c4086[_0x8bfe('0x4a')]['id'];_0x16d99e['deleted']=!![];_0x16d99e[_0x8bfe('0x4c')]=moment()[_0x8bfe('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x16d99e[_0x8bfe('0x4e')]=_0x1f2788[_0x8bfe('0x4f')];_0x16d99e[_0x8bfe('0x50')]=_0x1f2788['VoiceQueueId']?_0x8bfe('0x51'):_0x8bfe('0x52');return db[_0x8bfe('0x53')][_0x8bfe('0x3b')]({'where':{'id':_0x16d99e[_0x8bfe('0x54')]},'attributes':['firstName',_0x8bfe('0x55')]})[_0x8bfe('0xa')](function(_0x3ff83d){if(!_[_0x8bfe('0x56')](_0x55ad6e)&&!_[_0x8bfe('0x56')](_0x3ff83d[_0x8bfe('0x57')])){_0x16d99e['calleridname']=_0x3ff83d[_0x8bfe('0x57')];if(!_['isNil'](_0x3ff83d[_0x8bfe('0x55')])){_0x16d99e[_0x8bfe('0x58')]+='\x20'+_0x3ff83d[_0x8bfe('0x55')];}}})[_0x8bfe('0x59')](function(){return db[_0x8bfe('0x5a')][_0x8bfe('0x3c')](_0x16d99e);});}})['then'](function(_0x159d37){return db[_0x8bfe('0x5b')][_0x8bfe('0x41')]({'where':{'CmHopperId':_0x2ad3c1}});})['then'](function(){return _0x55ad6e[_0x8bfe('0x3')](0xcc)[_0x8bfe('0x5c')]();})['catch'](handleError(_0x55ad6e,null));};exports[_0x8bfe('0x5d')]=function(_0x29f56c,_0x121bea){var _0x56959e=[];return db[_0x8bfe('0x53')][_0x8bfe('0x40')]()[_0x8bfe('0xa')](function(_0x126398){_0x56959e=_[_0x8bfe('0x36')](_0x126398);return _0x29f56c[_0x8bfe('0x4a')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x8bfe('0x5e')},'attributes':['id',_0x8bfe('0x5f'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x8bfe('0xa')](function(_0x500467){if(_0x500467&&_0x500467[_0x8bfe('0x39')]){return db[_0x8bfe('0x60')][_0x8bfe('0x61')](function(_0x5062d5){var _0x4b87cb={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x500467,'id')},'$or':[{'UserId':null},{'UserId':_0x29f56c[_0x8bfe('0x4a')]['id']}]};var _0xfa5db0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x500467)[_0x8bfe('0x62')]([_0x8bfe('0x63'),0x0])['map']('id')[_0x8bfe('0x64')]()},'$or':[{'UserId':null},{'UserId':_0x29f56c[_0x8bfe('0x4a')]['id']}]};var _0x1f153d={'$or':[_0x4b87cb,_0xfa5db0]};var _0x199e90=[];if(_0x29f56c[_0x8bfe('0x3e')]['direction']&&_0x29f56c[_0x8bfe('0x3e')]['direction']===_0x8bfe('0x65')){if(!_[_0x8bfe('0x66')](_0x29f56c['body']['hopperIds'])){_0x1f153d['id']={'$in':_0x29f56c[_0x8bfe('0x3e')][_0x8bfe('0x67')]};}_0x199e90=[[_0x8bfe('0x68'),_0x8bfe('0x69')],['scheduledAt',_0x500467[0x0][_0x8bfe('0x5f')]==='ASC'?_0x8bfe('0x6a'):_0x8bfe('0x69')],db[_0x8bfe('0x60')][_0x8bfe('0x6b')](_0x8bfe('0x6c')),['id',_0x8bfe('0x6a')]];}else{if(!_[_0x8bfe('0x66')](_0x29f56c[_0x8bfe('0x3e')][_0x8bfe('0x67')])){_0x1f153d['id']={'$notIn':_0x29f56c[_0x8bfe('0x3e')][_0x8bfe('0x67')]};}_0x199e90=[[_0x8bfe('0x68'),'DESC'],['scheduledAt',_0x500467[0x0]['dialOrderByScheduledAt']],db[_0x8bfe('0x60')]['literal'](_0x8bfe('0x6d')),['id','ASC']];}return db['CmHopper'][_0x8bfe('0x6e')]({'attributes':['id',_0x8bfe('0x6f'),_0x8bfe('0x4f'),_0x8bfe('0x70')],'where':_0x1f153d,'order':_0x199e90,'transaction':_0x5062d5,'lock':_0x5062d5[_0x8bfe('0x71')][_0x8bfe('0x72')],'include':[{'model':db['CmContact'],'as':_0x8bfe('0x73'),'attributes':_0x56959e,'include':[{'model':db[_0x8bfe('0x74')],'as':_0x8bfe('0x75'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0x8bfe('0x76'),'attributes':['id',_0x8bfe('0xd')]},{'model':db[_0x8bfe('0x43')],'as':_0x8bfe('0x77'),'attributes':['id',_0x8bfe('0xd'),_0x8bfe('0x78')]}]})['then'](function(_0x454616){if(_0x454616){return _0x454616['update']({'UserId':_0x29f56c[_0x8bfe('0x4a')]['id']},{'transaction':_0x5062d5});}});});}})[_0x8bfe('0xa')](handleEntityNotFound(_0x121bea,null))[_0x8bfe('0xa')](respondWithResult(_0x121bea,null))['catch'](handleError(_0x121bea,null));};exports[_0x8bfe('0x79')]=function(_0x31bd4b,_0x2d2236,_0x127701){var _0x5e8e2d=[];var _0x23ea23=_0x31bd4b[_0x8bfe('0x3f')]['id'];var _0x1207a4=_0x31bd4b['user']['id'];return db['CmContact'][_0x8bfe('0x40')]()[_0x8bfe('0xa')](function(_0x28012b){_0x5e8e2d=_[_0x8bfe('0x36')](_0x28012b);return db[_0x8bfe('0x60')][_0x8bfe('0x61')](function(_0x781d89){const _0x4619f0={'id':_0x23ea23};return db['CmHopper'][_0x8bfe('0x6e')]({'attributes':['id',_0x8bfe('0x6f'),_0x8bfe('0x70')],'where':_0x4619f0,'transaction':_0x781d89,'lock':_0x781d89['LOCK'][_0x8bfe('0x72')],'include':[{'model':db[_0x8bfe('0x53')],'as':_0x8bfe('0x73'),'attributes':_0x5e8e2d,'include':[{'model':db[_0x8bfe('0x74')],'as':_0x8bfe('0x75'),'attributes':['id',_0x8bfe('0xd')]}]},{'model':db[_0x8bfe('0x7a')],'as':_0x8bfe('0x76'),'attributes':['id',_0x8bfe('0xd')]},{'model':db[_0x8bfe('0x43')],'as':'Queue','attributes':['id',_0x8bfe('0xd'),_0x8bfe('0x78')]}]})['then'](function(_0x29bf2f){if(_0x29bf2f){return _0x29bf2f[_0x8bfe('0x3d')]({'UserId':_0x1207a4},{'transaction':_0x781d89});}});});})[_0x8bfe('0xa')](handleEntityNotFound(_0x2d2236,null))['then'](respondWithResult(_0x2d2236,null))[_0x8bfe('0x34')](handleError(_0x2d2236,null));};exports[_0x8bfe('0x7b')]=function(_0x2ea522,_0x42abcc){return _0x2ea522[_0x8bfe('0x4a')][_0x8bfe('0x7c')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x8bfe('0x5e')},'attributes':['id'],'raw':!![]})[_0x8bfe('0xa')](function(_0x2b6a29){if(_0x2b6a29&&_0x2b6a29[_0x8bfe('0x39')]){return db[_0x8bfe('0x10')][_0x8bfe('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x2b6a29,'id')},'$or':[{'UserId':null},{'UserId':_0x2ea522[_0x8bfe('0x4a')]['id']}]}});}return 0x0;})['then'](function(_0x39ffe1){if(!_[_0x8bfe('0x56')](_0x39ffe1)&&_[_0x8bfe('0x7d')](_0x39ffe1)){return _0x42abcc[_0x8bfe('0x3')](0xc8)['json']({'contacts':_0x39ffe1});}else{logger[_0x8bfe('0xb')](_0x8bfe('0x7e'),_0x8bfe('0x7b'),0x194,_0x8bfe('0x7f'));_0x42abcc[_0x8bfe('0x80')](0x194);}})[_0x8bfe('0x34')](handleError(_0x42abcc,null));};exports[_0x8bfe('0x81')]=function(_0x94b726,_0x1a8a31){var _0x4ace16=shared[_0x8bfe('0x82')];var _0x3ef0ea=[];_[_0x8bfe('0xf')](_0x4ace16,function(_0x580ab5){_0x3ef0ea[_0x8bfe('0x83')]({'id':_0x580ab5[_0x8bfe('0xd')],'name':_0x580ab5[_0x8bfe('0xd')],'utcOffset':_0x580ab5['utcOffset']});});return _0x1a8a31[_0x8bfe('0x3')](0xc8)[_0x8bfe('0x4')]({'tz':_0x3ef0ea});};exports[_0x8bfe('0x84')]=function(_0x5879b1,_0x5daf7d){var _0xa19a58=shared[_0x8bfe('0x82')];var _0x21d9ec={};if(!_['isNil'](_0xa19a58[_0x5879b1['body']['id']]))_0x21d9ec=_0xa19a58[_0x5879b1[_0x8bfe('0x3e')]['id']];return _0x5daf7d[_0x8bfe('0x3')](0xc8)[_0x8bfe('0x4')](_0x21d9ec);}; \ No newline at end of file +var _0x5fc3=['CmHopperFinal','CmHopperAdditionalPhone','end','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','value','prev','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','hopperIds','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','timezones','getTimezone','moment','lodash','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','update','then','error','stack','name','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','concat','$or','$gt','$lt','$lte','$ne','$not','$notBetween','$in','$notLike','$notILike','$like','$contains','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','catch','create','body','find','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','createdAt','updatedAt','state','statedesc','campaign','user','deleted','deletedat','format','campaigntype','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally'];(function(_0x4edb1b,_0x57f3d4){var _0x1f4b95=function(_0x21409f){while(--_0x21409f){_0x4edb1b['push'](_0x4edb1b['shift']());}};_0x1f4b95(++_0x57f3d4);}(_0x5fc3,0xa8));var _0x35fc=function(_0x42bafd,_0x3f0fe3){_0x42bafd=_0x42bafd-0x0;var _0x2ed705=_0x5fc3[_0x42bafd];return _0x2ed705;};'use strict';var moment=require(_0x35fc('0x0'));var _=require(_0x35fc('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x35fc('0x2'))(_0x35fc('0x3'));var shared=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];function respondWithResult(_0xb4f9ce,_0x5e75e6){_0x5e75e6=_0x5e75e6||0xc8;return function(_0x2d1404){if(_0x2d1404){return _0xb4f9ce[_0x35fc('0x6')](_0x5e75e6)[_0x35fc('0x7')](_0x2d1404);}};}function respondWithFilteredResult(_0x5b85ad,_0x5754be){return function(_0x19a0d1){if(_0x19a0d1){var _0x508b32=typeof _0x5754be[_0x35fc('0x8')]===_0x35fc('0x9')&&typeof _0x5754be[_0x35fc('0xa')]===_0x35fc('0x9');var _0x34ff19=_0x19a0d1[_0x35fc('0xb')];var _0x2051ab=_0x508b32?0x0:_0x5754be['offset'];var _0x1083a9=_0x508b32?_0x19a0d1[_0x35fc('0xb')]:_0x5754be['offset']+_0x5754be[_0x35fc('0xa')];var _0x33f491;if(_0x1083a9>=_0x34ff19){_0x1083a9=_0x34ff19;_0x33f491=0xc8;}else{_0x33f491=0xce;}_0x5b85ad['status'](_0x33f491);return _0x5b85ad[_0x35fc('0xc')](_0x35fc('0xd'),_0x2051ab+'-'+_0x1083a9+'/'+_0x34ff19)['json'](_0x19a0d1);}return null;};}function saveUpdates(_0x4cbe74,_0x409357){return function(_0x5d462a){if(_0x5d462a){return _0x5d462a[_0x35fc('0xe')](_0x4cbe74)[_0x35fc('0xf')](function(_0x2a6ad2){return _0x2a6ad2;});}return null;};}function handleEntityNotFound(_0x29730f,_0x38d9f2){return function(_0x5cfe94){if(!_0x5cfe94){_0x29730f['sendStatus'](0x194);}return _0x5cfe94;};}function handleError(_0x5eac0f,_0x558364){_0x558364=_0x558364||0x1f4;return function(_0x398b67){logger[_0x35fc('0x10')](_0x398b67[_0x35fc('0x11')]);if(_0x398b67[_0x35fc('0x12')]){delete _0x398b67[_0x35fc('0x12')];}_0x5eac0f[_0x35fc('0x6')](_0x558364)['send'](_0x398b67);};}exports[_0x35fc('0x13')]=function(_0x45c8b7,_0x553677){var _0x41e165={},_0x363e47={},_0x2e513b={'count':0x0,'rows':[]};var _0x5f56c6=_[_0x35fc('0x14')](db[_0x35fc('0x15')][_0x35fc('0x16')],function(_0x488234){return{'name':_0x488234[_0x35fc('0x17')],'type':_0x488234[_0x35fc('0x18')][_0x35fc('0x19')]};});_0x363e47[_0x35fc('0x1a')]=_[_0x35fc('0x14')](_0x5f56c6,_0x35fc('0x12'));_0x363e47[_0x35fc('0x1b')]=_[_0x35fc('0x1c')](_0x45c8b7[_0x35fc('0x1b')]);_0x363e47[_0x35fc('0x1d')]=_['intersection'](_0x363e47[_0x35fc('0x1a')],_0x363e47[_0x35fc('0x1b')]);_0x363e47[_0x35fc('0x1d')]=_[_0x35fc('0x1e')](_0x363e47[_0x35fc('0x1d')],['$and',_0x35fc('0x1f'),_0x35fc('0x20'),'$gte',_0x35fc('0x21'),_0x35fc('0x22'),_0x35fc('0x23'),'$eq',_0x35fc('0x24'),'$between',_0x35fc('0x25'),_0x35fc('0x26'),'$notIn','$like',_0x35fc('0x27'),'$iLike',_0x35fc('0x28'),_0x35fc('0x29'),'$overlap',_0x35fc('0x2a'),_0x35fc('0x2b'),_0x35fc('0x2c')]);_0x41e165[_0x35fc('0x2d')]=_[_0x35fc('0x2e')](_0x363e47[_0x35fc('0x1a')],qs[_0x35fc('0x2f')](_0x45c8b7[_0x35fc('0x1b')]['fields']));_0x41e165[_0x35fc('0x2d')]=_0x41e165[_0x35fc('0x2d')][_0x35fc('0x30')]?_0x41e165['attributes']:_0x363e47[_0x35fc('0x1a')];if(!_0x45c8b7[_0x35fc('0x1b')][_0x35fc('0x31')](_0x35fc('0x32'))){_0x41e165[_0x35fc('0xa')]=qs[_0x35fc('0xa')](_0x45c8b7[_0x35fc('0x1b')][_0x35fc('0xa')]);_0x41e165[_0x35fc('0x8')]=qs[_0x35fc('0x8')](_0x45c8b7['query']['offset']);}_0x41e165[_0x35fc('0x33')]=qs['sort'](_0x45c8b7[_0x35fc('0x1b')][_0x35fc('0x34')]);_0x41e165[_0x35fc('0x35')]=qs[_0x35fc('0x1d')](_[_0x35fc('0x36')](_0x45c8b7[_0x35fc('0x1b')],_0x363e47['filters']),_0x5f56c6);if(_0x45c8b7[_0x35fc('0x1b')][_0x35fc('0x37')]){_0x41e165[_0x35fc('0x35')]=_[_0x35fc('0x38')](_0x41e165[_0x35fc('0x35')],{'$or':_[_0x35fc('0x14')](_0x5f56c6,function(_0x553597){if(_0x553597[_0x35fc('0x18')]!==_0x35fc('0x39')){var _0x1fecdf={};_0x1fecdf[_0x553597['name']]={'$like':'%'+_0x45c8b7[_0x35fc('0x1b')]['filter']+'%'};return _0x1fecdf;}})});}_0x41e165=_[_0x35fc('0x38')]({},_0x41e165,_0x45c8b7[_0x35fc('0x3a')]);var _0x266a11={'where':_0x41e165[_0x35fc('0x35')]};return db['CmHopper']['count'](_0x266a11)['then'](function(_0x20f5fe){_0x2e513b['count']=_0x20f5fe;if(_0x45c8b7[_0x35fc('0x1b')]['includeAll']){_0x41e165[_0x35fc('0x3b')]=[{'all':!![]}];}return db[_0x35fc('0x15')][_0x35fc('0x3c')](_0x41e165);})[_0x35fc('0xf')](function(_0x1c10e0){_0x2e513b[_0x35fc('0x3d')]=_0x1c10e0;return _0x2e513b;})[_0x35fc('0xf')](respondWithFilteredResult(_0x553677,_0x41e165))['catch'](handleError(_0x553677,null));};exports[_0x35fc('0x3e')]=function(_0x16087d,_0x4e0ce3){var _0x1feda5={'raw':!![],'where':{'id':_0x16087d[_0x35fc('0x3f')]['id']}},_0x1ccc41={};_0x1ccc41[_0x35fc('0x1a')]=_[_0x35fc('0x1c')](db[_0x35fc('0x15')]['rawAttributes']);_0x1ccc41[_0x35fc('0x1b')]=_[_0x35fc('0x1c')](_0x16087d[_0x35fc('0x1b')]);_0x1ccc41['filters']=_[_0x35fc('0x2e')](_0x1ccc41[_0x35fc('0x1a')],_0x1ccc41['query']);_0x1feda5[_0x35fc('0x2d')]=_[_0x35fc('0x2e')](_0x1ccc41[_0x35fc('0x1a')],qs[_0x35fc('0x2f')](_0x16087d[_0x35fc('0x1b')][_0x35fc('0x2f')]));_0x1feda5[_0x35fc('0x2d')]=_0x1feda5[_0x35fc('0x2d')]['length']?_0x1feda5['attributes']:_0x1ccc41[_0x35fc('0x1a')];if(_0x16087d[_0x35fc('0x1b')]['includeAll']){_0x1feda5['include']=[{'all':!![]}];}_0x1feda5=_['merge']({},_0x1feda5,_0x16087d[_0x35fc('0x3a')]);return db[_0x35fc('0x15')]['find'](_0x1feda5)[_0x35fc('0xf')](handleEntityNotFound(_0x4e0ce3,null))[_0x35fc('0xf')](respondWithResult(_0x4e0ce3,null))[_0x35fc('0x40')](handleError(_0x4e0ce3,null));};exports[_0x35fc('0x41')]=function(_0x5c52be,_0x57105c){return db['CmHopper']['create'](_0x5c52be['body'],{})[_0x35fc('0xf')](respondWithResult(_0x57105c,0xc9))[_0x35fc('0x40')](handleError(_0x57105c,null));};exports['update']=function(_0x119925,_0x56cf1f){if(_0x119925[_0x35fc('0x42')]['id']){delete _0x119925[_0x35fc('0x42')]['id'];}return db[_0x35fc('0x15')][_0x35fc('0x43')]({'where':{'id':_0x119925[_0x35fc('0x3f')]['id']}})['then'](handleEntityNotFound(_0x56cf1f,null))[_0x35fc('0xf')](saveUpdates(_0x119925[_0x35fc('0x42')],null))['then'](respondWithResult(_0x56cf1f,null))[_0x35fc('0x40')](handleError(_0x56cf1f,null));};exports[_0x35fc('0x44')]=function(_0x2a8a09,_0x211746){return db['CmHopper'][_0x35fc('0x44')]()['then'](respondWithResult(_0x211746,null))['catch'](handleError(_0x211746,null));};exports[_0x35fc('0x45')]=function(_0x9db7e8,_0x18dc78){var _0xca8aef;var _0xf2ca20=_0x9db7e8[_0x35fc('0x3f')]['id'];return db[_0x35fc('0x15')][_0x35fc('0x43')]({'where':{'id':_0x9db7e8['params']['id']}})[_0x35fc('0xf')](handleEntityNotFound(_0x18dc78,null))[_0x35fc('0xf')](function(_0xeca02e){if(_0xeca02e){return _0xeca02e[_0x35fc('0x45')]()[_0x35fc('0xf')](function(_0x1e3221){return _0x1e3221;});}})[_0x35fc('0xf')](function(_0x347a4a){_0xca8aef=_0x347a4a;if(_0x347a4a){if(_0x347a4a[_0x35fc('0x46')]||_0x347a4a[_0x35fc('0x47')]){return db[_0x347a4a[_0x35fc('0x46')]?_0x35fc('0x48'):_0x35fc('0x49')][_0x35fc('0x43')]({'where':{'id':_0x347a4a['VoiceQueueId']?_0x347a4a['VoiceQueueId']:_0x347a4a[_0x35fc('0x47')]},'attributes':['id',_0x35fc('0x12')],'raw':!![]});}}})[_0x35fc('0xf')](function(_0x2bf0b0){var _0x3ee296={};if(_0x2bf0b0){_[_0x35fc('0x38')](_0x3ee296,_['omit'](_0xca8aef['dataValues'],[_0x35fc('0x4a'),_0x35fc('0x4b'),'id']));_0x3ee296[_0x35fc('0x4c')]=0x15;_0x3ee296[_0x35fc('0x4d')]='deleted';_0x3ee296[_0x35fc('0x4e')]=_0x2bf0b0[_0x35fc('0x12')];_0x3ee296['membername']=_0x9db7e8[_0x35fc('0x4f')][_0x35fc('0x12')];_0x3ee296['UserId']=_0x9db7e8[_0x35fc('0x4f')]['id'];_0x3ee296[_0x35fc('0x50')]=!![];_0x3ee296[_0x35fc('0x51')]=moment()[_0x35fc('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x3ee296['calleridnum']=_0xca8aef['phone'];_0x3ee296[_0x35fc('0x53')]=_0xca8aef[_0x35fc('0x46')]?'queue':_0x35fc('0x54');return db[_0x35fc('0x55')][_0x35fc('0x43')]({'where':{'id':_0x3ee296[_0x35fc('0x56')]},'attributes':[_0x35fc('0x57'),'lastName']})[_0x35fc('0xf')](function(_0x757aa6){if(!_[_0x35fc('0x58')](_0x18dc78)&&!_['isNil'](_0x757aa6[_0x35fc('0x57')])){_0x3ee296[_0x35fc('0x59')]=_0x757aa6['firstName'];if(!_[_0x35fc('0x58')](_0x757aa6[_0x35fc('0x5a')])){_0x3ee296[_0x35fc('0x59')]+='\x20'+_0x757aa6[_0x35fc('0x5a')];}}})[_0x35fc('0x5b')](function(){return db[_0x35fc('0x5c')][_0x35fc('0x41')](_0x3ee296);});}})[_0x35fc('0xf')](function(_0x53a79d){return db[_0x35fc('0x5d')][_0x35fc('0x45')]({'where':{'CmHopperId':_0xf2ca20}});})[_0x35fc('0xf')](function(){return _0x18dc78['status'](0xcc)[_0x35fc('0x5e')]();})['catch'](handleError(_0x18dc78,null));};exports['getPreview']=function(_0x5d4a39,_0x23b54f){var _0xb1c68a=[];return db[_0x35fc('0x55')][_0x35fc('0x44')]()[_0x35fc('0xf')](function(_0x4bbea0){_0xb1c68a=_['keys'](_0x4bbea0);return _0x5d4a39['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x35fc('0x5f')},'attributes':['id',_0x35fc('0x60'),_0x35fc('0x61')],'raw':!![]});})[_0x35fc('0xf')](function(_0x511e8b){if(_0x511e8b&&_0x511e8b[_0x35fc('0x30')]){return db[_0x35fc('0x62')][_0x35fc('0x63')](function(_0x1b0063){var _0x37bea1={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x35fc('0x52')](_0x35fc('0x64'))},'VoiceQueueId':{'$in':_[_0x35fc('0x14')](_0x511e8b,'id')},'$or':[{'UserId':null},{'UserId':_0x5d4a39[_0x35fc('0x4f')]['id']}]};var _0x4c3ace={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x511e8b)[_0x35fc('0x37')](['dialPreviewAutoRecallMe',0x0])[_0x35fc('0x14')]('id')[_0x35fc('0x65')]()},'$or':[{'UserId':null},{'UserId':_0x5d4a39[_0x35fc('0x4f')]['id']}]};var _0x2bc76c={'$or':[_0x37bea1,_0x4c3ace]};var _0x4bdde7=[];if(_0x5d4a39[_0x35fc('0x42')]['direction']&&_0x5d4a39['body']['direction']===_0x35fc('0x66')){if(!_['isEmpty'](_0x5d4a39[_0x35fc('0x42')]['hopperIds'])){_0x2bc76c['id']={'$in':_0x5d4a39[_0x35fc('0x42')]['hopperIds']};}_0x4bdde7=[[_0x35fc('0x67'),_0x35fc('0x68')],[_0x35fc('0x69'),_0x511e8b[0x0][_0x35fc('0x60')]==='ASC'?_0x35fc('0x6a'):_0x35fc('0x68')],db[_0x35fc('0x62')]['literal'](_0x35fc('0x6b')),['id',_0x35fc('0x6a')]];}else{if(!_[_0x35fc('0x6c')](_0x5d4a39[_0x35fc('0x42')][_0x35fc('0x6d')])){_0x2bc76c['id']={'$notIn':_0x5d4a39[_0x35fc('0x42')][_0x35fc('0x6d')]};}_0x4bdde7=[[_0x35fc('0x67'),'DESC'],[_0x35fc('0x69'),_0x511e8b[0x0][_0x35fc('0x60')]],db[_0x35fc('0x62')]['literal'](_0x35fc('0x6e')),['id',_0x35fc('0x68')]];}return db['CmHopper']['findOne']({'attributes':['id',_0x35fc('0x6f'),'phone',_0x35fc('0x70')],'where':_0x2bc76c,'order':_0x4bdde7,'transaction':_0x1b0063,'lock':_0x1b0063[_0x35fc('0x71')][_0x35fc('0x72')],'include':[{'model':db[_0x35fc('0x55')],'as':_0x35fc('0x73'),'attributes':_0xb1c68a,'include':[{'model':db[_0x35fc('0x74')],'as':_0x35fc('0x75'),'attributes':['id',_0x35fc('0x12')]}]},{'model':db[_0x35fc('0x76')],'as':_0x35fc('0x77'),'attributes':['id',_0x35fc('0x12')]},{'model':db[_0x35fc('0x48')],'as':_0x35fc('0x78'),'attributes':['id',_0x35fc('0x12'),_0x35fc('0x79')]}]})[_0x35fc('0xf')](function(_0x2d8219){if(_0x2d8219){return _0x2d8219[_0x35fc('0xe')]({'UserId':_0x5d4a39[_0x35fc('0x4f')]['id']},{'transaction':_0x1b0063});}});});}})[_0x35fc('0xf')](handleEntityNotFound(_0x23b54f,null))['then'](respondWithResult(_0x23b54f,null))[_0x35fc('0x40')](handleError(_0x23b54f,null));};exports['getPreviewRecall']=function(_0x88d681,_0x6c5ef,_0x2185ce){var _0x516b26=[];var _0x25af78=_0x88d681[_0x35fc('0x3f')]['id'];var _0x2913ba=_0x88d681[_0x35fc('0x4f')]['id'];return db[_0x35fc('0x55')][_0x35fc('0x44')]()[_0x35fc('0xf')](function(_0x580062){_0x516b26=_[_0x35fc('0x1c')](_0x580062);return db[_0x35fc('0x62')][_0x35fc('0x63')](function(_0x1ca01f){const _0x3a973d={'id':_0x25af78};return db[_0x35fc('0x15')]['findOne']({'attributes':['id',_0x35fc('0x6f'),_0x35fc('0x70')],'where':_0x3a973d,'transaction':_0x1ca01f,'lock':_0x1ca01f[_0x35fc('0x71')][_0x35fc('0x72')],'include':[{'model':db[_0x35fc('0x55')],'as':_0x35fc('0x73'),'attributes':_0x516b26,'include':[{'model':db[_0x35fc('0x74')],'as':_0x35fc('0x75'),'attributes':['id',_0x35fc('0x12')]}]},{'model':db['CmList'],'as':_0x35fc('0x77'),'attributes':['id','name']},{'model':db[_0x35fc('0x48')],'as':_0x35fc('0x78'),'attributes':['id','name',_0x35fc('0x79')]}]})[_0x35fc('0xf')](function(_0xcaa49){if(_0xcaa49){return _0xcaa49[_0x35fc('0xe')]({'UserId':_0x2913ba},{'transaction':_0x1ca01f});}});});})[_0x35fc('0xf')](handleEntityNotFound(_0x6c5ef,null))[_0x35fc('0xf')](respondWithResult(_0x6c5ef,null))[_0x35fc('0x40')](handleError(_0x6c5ef,null));};exports[_0x35fc('0x7a')]=function(_0x25ee61,_0x5806bf){return _0x25ee61['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x35fc('0x5f')},'attributes':['id'],'raw':!![]})[_0x35fc('0xf')](function(_0x8fc410){if(_0x8fc410&&_0x8fc410[_0x35fc('0x30')]){return db[_0x35fc('0x15')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x35fc('0x52')](_0x35fc('0x64'))},'VoiceQueueId':{'$in':_[_0x35fc('0x14')](_0x8fc410,'id')},'$or':[{'UserId':null},{'UserId':_0x25ee61[_0x35fc('0x4f')]['id']}]}});}return 0x0;})['then'](function(_0x15e936){if(!_[_0x35fc('0x58')](_0x15e936)&&_[_0x35fc('0x7b')](_0x15e936)){return _0x5806bf['status'](0xc8)[_0x35fc('0x7')]({'contacts':_0x15e936});}else{logger[_0x35fc('0x10')](_0x35fc('0x7c'),_0x35fc('0x7a'),0x194,_0x35fc('0x7d'));_0x5806bf[_0x35fc('0x7e')](0x194);}})[_0x35fc('0x40')](handleError(_0x5806bf,null));};exports[_0x35fc('0x7f')]=function(_0x4b6c03,_0x2faff7){var _0xa2c5f8=shared[_0x35fc('0x80')];var _0x2799c8=[];_[_0x35fc('0x14')](_0xa2c5f8,function(_0x1fcd36){_0x2799c8['push']({'id':_0x1fcd36[_0x35fc('0x12')],'name':_0x1fcd36['name'],'utcOffset':_0x1fcd36['utcOffset']});});return _0x2faff7[_0x35fc('0x6')](0xc8)['json']({'tz':_0x2799c8});};exports[_0x35fc('0x81')]=function(_0x233b7d,_0x2885b9){var _0x54cbcb=shared[_0x35fc('0x80')];var _0x2b3edc={};if(!_[_0x35fc('0x58')](_0x54cbcb[_0x233b7d[_0x35fc('0x42')]['id']]))_0x2b3edc=_0x54cbcb[_0x233b7d[_0x35fc('0x42')]['id']];return _0x2885b9['status'](0xc8)['json'](_0x2b3edc);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index a530b02..4f8b579 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 _0x1967=['scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x1967,0x173));var _0x7196=function(_0x8368c1,_0x4a101b){_0x8368c1=_0x8368c1-0x0;var _0x32635e=_0x1967[_0x8368c1];return _0x32635e;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));module['exports']=function(_0x36b01e,_0x186175){return _0x36b01e[_0x7196('0xa')](_0x7196('0xb'),attributes,{'tableName':_0x7196('0xc'),'paranoid':![],'indexes':[{'name':_0x7196('0xd'),'fields':['scheduledat']},{'name':_0x7196('0xe'),'fields':[_0x7196('0xe')]},{'name':_0x7196('0xf'),'fields':[_0x7196('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x90b1=['priority','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','define','CmHopper','cm_hopper','scheduledat','phone'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x90b1,0x1bb));var _0x190b=function(_0x5e4e99,_0x410870){_0x5e4e99=_0x5e4e99-0x0;var _0x200520=_0x90b1[_0x5e4e99];return _0x200520;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[{'name':_0x190b('0xa'),'fields':[_0x190b('0xa')]},{'name':_0x190b('0xb'),'fields':['phone']},{'name':_0x190b('0xc'),'fields':[_0x190b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index f10f172..5a64f27 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 _0xf725=['transaction','order','LOCK','UPDATE','CmContact','keys','User','Agent','name','voicePause','length','UserId','push','update','includes','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','destroy','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','all','Contact','GetContactByPhone','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','NOW()','CmList','List','lodash','util','moment','bluebird','../../config/logger','GetCmHopper','CmHopper','findAll','options','where','attributes','include','map','model','then','info','debug','message','error','find','raw','ShowCmHopper','stringify','catch','CreateCmHopper','create','body','UpdateCmHopper','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','describe','sequelize'];(function(_0x296f38,_0xd95c43){var _0x3ff21e=function(_0x44ac03){while(--_0x44ac03){_0x296f38['push'](_0x296f38['shift']());}};_0x3ff21e(++_0xd95c43);}(_0xf725,0xd0));var _0x5f72=function(_0x48231f,_0x3caff8){_0x48231f=_0x48231f-0x0;var _0x3123bc=_0xf725[_0x48231f];return _0x3123bc;};'use strict';var _=require(_0x5f72('0x0'));var util=require(_0x5f72('0x1'));var moment=require(_0x5f72('0x2'));var BPromise=require(_0x5f72('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x5f72('0x4'))('rpc');exports[_0x5f72('0x5')]=function(_0x31722d){var _0x28a13b=this;return new Promise(function(_0x51e204,_0x47e095){return db[_0x5f72('0x6')][_0x5f72('0x7')]({'raw':_0x31722d[_0x5f72('0x8')]?_0x31722d['options']['raw']===undefined?!![]:![]:!![],'where':_0x31722d[_0x5f72('0x8')]?_0x31722d['options'][_0x5f72('0x9')]||null:null,'attributes':_0x31722d['options']?_0x31722d['options'][_0x5f72('0xa')]||null:null,'limit':_0x31722d[_0x5f72('0x8')]?_0x31722d[_0x5f72('0x8')]['limit']||null:null,'include':_0x31722d[_0x5f72('0x8')]?_0x31722d[_0x5f72('0x8')][_0x5f72('0xb')]?_[_0x5f72('0xc')](_0x31722d[_0x5f72('0x8')]['include'],function(_0x292bc9){return{'model':db[_0x292bc9['model']],'as':_0x292bc9['as'],'attributes':_0x292bc9['attributes'],'include':_0x292bc9[_0x5f72('0xb')]?_[_0x5f72('0xc')](_0x292bc9[_0x5f72('0xb')],function(_0x134f63){return{'model':db[_0x134f63['model']],'as':_0x134f63['as'],'attributes':_0x134f63[_0x5f72('0xa')],'include':_0x134f63['include']?_[_0x5f72('0xc')](_0x134f63[_0x5f72('0xb')],function(_0x473f97){return{'model':db[_0x473f97[_0x5f72('0xd')]],'as':_0x473f97['as'],'attributes':_0x473f97['attributes']};}):[]};}):[]};}):[]:[]})[_0x5f72('0xe')](function(_0x3710b6){logger[_0x5f72('0xf')](_0x5f72('0x5'),_0x31722d);logger[_0x5f72('0x10')]('GetCmHopper',_0x31722d,JSON['stringify'](_0x3710b6));_0x51e204(_0x3710b6);})['catch'](function(_0x379bb7){logger['error'](_0x5f72('0x5'),_0x379bb7[_0x5f72('0x11')],_0x31722d);_0x47e095(_0x28a13b[_0x5f72('0x12')](0x1f4,_0x379bb7['message']));});});};exports['ShowCmHopper']=function(_0x200959){var _0x39898f=this;return new Promise(function(_0x57b43f,_0x51958f){return db[_0x5f72('0x6')][_0x5f72('0x13')]({'raw':_0x200959[_0x5f72('0x8')]?_0x200959[_0x5f72('0x8')][_0x5f72('0x14')]===undefined?!![]:![]:!![],'where':_0x200959[_0x5f72('0x8')]?_0x200959[_0x5f72('0x8')][_0x5f72('0x9')]||null:null,'attributes':_0x200959[_0x5f72('0x8')]?_0x200959[_0x5f72('0x8')][_0x5f72('0xa')]||null:null,'include':_0x200959['options']?_0x200959[_0x5f72('0x8')][_0x5f72('0xb')]?_[_0x5f72('0xc')](_0x200959[_0x5f72('0x8')][_0x5f72('0xb')],function(_0x59f662){return{'model':db[_0x59f662[_0x5f72('0xd')]],'as':_0x59f662['as'],'attributes':_0x59f662['attributes'],'include':_0x59f662[_0x5f72('0xb')]?_[_0x5f72('0xc')](_0x59f662[_0x5f72('0xb')],function(_0x39428d){return{'model':db[_0x39428d[_0x5f72('0xd')]],'as':_0x39428d['as'],'attributes':_0x39428d['attributes'],'include':_0x39428d[_0x5f72('0xb')]?_[_0x5f72('0xc')](_0x39428d['include'],function(_0x3af16f){return{'model':db[_0x3af16f['model']],'as':_0x3af16f['as'],'attributes':_0x3af16f['attributes']};}):[]};}):[]};}):[]:[]})[_0x5f72('0xe')](function(_0x16e40b){logger[_0x5f72('0xf')](_0x5f72('0x15'),_0x200959);logger[_0x5f72('0x10')](_0x5f72('0x15'),_0x200959,JSON[_0x5f72('0x16')](_0x16e40b));_0x57b43f(_0x16e40b);})[_0x5f72('0x17')](function(_0x4c9ce5){logger[_0x5f72('0x12')](_0x5f72('0x15'),_0x4c9ce5['message'],_0x200959);_0x51958f(_0x39898f[_0x5f72('0x12')](0x1f4,_0x4c9ce5[_0x5f72('0x11')]));});});};exports[_0x5f72('0x18')]=function(_0xb8548d){var _0x5eeea9=this;return new Promise(function(_0xa182ca,_0x26cf4f){return db[_0x5f72('0x6')][_0x5f72('0x19')](_0xb8548d[_0x5f72('0x1a')],{'raw':_0xb8548d['options']?_0xb8548d['options'][_0x5f72('0x14')]===undefined?!![]:![]:!![]})[_0x5f72('0xe')](function(_0x19ad35){logger[_0x5f72('0xf')](_0x5f72('0x18'),_0xb8548d);logger['debug'](_0x5f72('0x18'),_0xb8548d,JSON[_0x5f72('0x16')](_0x19ad35));_0xa182ca(_0x19ad35);})[_0x5f72('0x17')](function(_0x3ea194){logger[_0x5f72('0x12')](_0x5f72('0x18'),_0x3ea194[_0x5f72('0x11')],_0xb8548d);_0x26cf4f(_0x5eeea9[_0x5f72('0x12')](0x1f4,_0x3ea194[_0x5f72('0x11')]));});});};exports[_0x5f72('0x1b')]=function(_0x44be81){var _0x216bba=this;return new Promise(function(_0xf4d8b,_0xddb45c){return db['CmHopper']['update'](_0x44be81['body'],{'raw':_0x44be81[_0x5f72('0x8')]?_0x44be81[_0x5f72('0x8')][_0x5f72('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44be81[_0x5f72('0x8')]?_0x44be81[_0x5f72('0x8')][_0x5f72('0x9')]||null:null,'attributes':_0x44be81[_0x5f72('0x8')]?_0x44be81[_0x5f72('0x8')]['attributes']||null:null,'limit':_0x44be81[_0x5f72('0x8')]?_0x44be81['options'][_0x5f72('0x1c')]||null:null})[_0x5f72('0xe')](function(_0x60e1d5){logger[_0x5f72('0xf')]('UpdateCmHopper',_0x44be81);logger[_0x5f72('0xf')](_0x5f72('0x1d'),JSON[_0x5f72('0x16')](_0x44be81[_0x5f72('0x8')][_0x5f72('0x9')]),_0x44be81[_0x5f72('0x1a')][_0x5f72('0x1e')]);logger[_0x5f72('0x10')](_0x5f72('0x1b'),_0x44be81,JSON[_0x5f72('0x16')](_0x60e1d5));_0xf4d8b(_0x60e1d5);})[_0x5f72('0x17')](function(_0x5bb804){logger[_0x5f72('0x12')](_0x5f72('0x1b'),_0x5bb804[_0x5f72('0x11')],_0x44be81);_0xddb45c(_0x216bba[_0x5f72('0x12')](0x1f4,_0x5bb804[_0x5f72('0x11')]));});});};exports[_0x5f72('0x1f')]=function(_0x125d1c){var _0x483168=this;return new Promise(function(_0x34715b,_0x20325f){return db[_0x5f72('0x6')]['destroy']({'where':_0x125d1c[_0x5f72('0x8')]?_0x125d1c[_0x5f72('0x8')][_0x5f72('0x9')]||null:null})['then'](function(_0x4d50c1){logger[_0x5f72('0xf')](_0x5f72('0x1f'),_0x125d1c);logger[_0x5f72('0x10')]('DestroyCmHopper',_0x125d1c,JSON[_0x5f72('0x16')](_0x4d50c1));_0x34715b(_0x4d50c1);})[_0x5f72('0x17')](function(_0x3649b6){logger['error']('DestroyCmHopper',_0x3649b6[_0x5f72('0x11')],_0x125d1c);_0x20325f(_0x483168[_0x5f72('0x12')](0x1f4,_0x3649b6['message']));});});};exports[_0x5f72('0x20')]=function(_0x4313c4){var _0x958ab7=this;return new Promise(function(_0x3aa314,_0x27e04a){return db['CmContact'][_0x5f72('0x21')]()[_0x5f72('0xe')](function(_0x2b9918){return db[_0x5f72('0x22')][_0x5f72('0x23')](function(_0x1bf910){return db['CmHopper']['findAll']({'where':_0x4313c4[_0x5f72('0x8')]?_0x4313c4[_0x5f72('0x8')][_0x5f72('0x9')]||null:null,'attributes':_0x4313c4[_0x5f72('0x8')]?_0x4313c4['options'][_0x5f72('0xa')]||null:null,'limit':_0x4313c4[_0x5f72('0x8')]?_0x4313c4['options'][_0x5f72('0x1c')]||null:null,'order':_0x4313c4[_0x5f72('0x8')]?_0x4313c4[_0x5f72('0x8')][_0x5f72('0x24')]||null:null,'transaction':_0x1bf910,'lock':_0x1bf910[_0x5f72('0x25')][_0x5f72('0x26')],'include':[{'model':db[_0x5f72('0x27')],'as':'Contact','attributes':_[_0x5f72('0x28')](_0x2b9918)},{'model':db[_0x5f72('0x29')],'as':_0x5f72('0x2a'),'attributes':['id',_0x5f72('0x2b'),_0x5f72('0x2c')]}]})[_0x5f72('0xe')](function(_0x2e5dbb){var _0x5ccd3c=[];var _0x12bd91=[];for(var _0x2abf49=0x0;_0x2abf49<_0x2e5dbb[_0x5f72('0x2d')];_0x2abf49+=0x1){var _0x4d3411=_0x2e5dbb[_0x2abf49][_0x5f72('0x2e')];if(_0x4d3411===null){_0x5ccd3c[_0x5f72('0x2f')](_0x2e5dbb[_0x2abf49][_0x5f72('0x30')](_0x4313c4[_0x5f72('0x1a')],{'transaction':_0x1bf910}));}else if(!_0x12bd91[_0x5f72('0x31')](_0x4d3411)){_0x12bd91[_0x5f72('0x2f')](_0x4d3411);_0x5ccd3c[_0x5f72('0x2f')](_0x2e5dbb[_0x2abf49][_0x5f72('0x30')](_0x4313c4[_0x5f72('0x1a')],{'transaction':_0x1bf910}));}}return BPromise['all'](_0x5ccd3c);});})[_0x5f72('0xe')](function(_0x5709e3){logger[_0x5f72('0xf')](_0x5f72('0x20'),_0x4313c4);if(_0x5709e3[_0x5f72('0x2d')]>0x0){logger[_0x5f72('0xf')](_0x5f72('0x32'),_0x5709e3[0x0][_0x5f72('0x33')]['id'],_0x5709e3[0x0][_0x5f72('0x33')][_0x5f72('0x34')],_0x5709e3[0x0][_0x5f72('0x33')][_0x5f72('0x1e')]);}logger[_0x5f72('0x10')](_0x5f72('0x20'),_0x4313c4,JSON[_0x5f72('0x16')](_0x5709e3));_0x3aa314(_0x5709e3);})[_0x5f72('0x17')](function(_0x127492){logger[_0x5f72('0x12')](_0x5f72('0x20'),_0x127492[_0x5f72('0x11')],_0x4313c4);_0x27e04a(_0x958ab7[_0x5f72('0x12')](0x1f4,_0x127492['message']));});});});};exports[_0x5f72('0x35')]=function(_0x4e939b){var _0x533636=this;return new Promise(function(_0xde2439,_0x207120){return db['sequelize'][_0x5f72('0x23')](function(_0x4b9170){return db[_0x5f72('0x36')][_0x5f72('0x19')](_0x4e939b['body'],{'raw':_0x4e939b['options']?_0x4e939b[_0x5f72('0x8')][_0x5f72('0x14')]===undefined?!![]:![]:!![],'transaction':_0x4b9170})['then'](function(){logger[_0x5f72('0xf')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x4e939b[_0x5f72('0x8')][_0x5f72('0x9')]),_0x4e939b[_0x5f72('0x8')][_0x5f72('0x9')][_0x5f72('0x1e')]);return db[_0x5f72('0x6')][_0x5f72('0x37')]({'where':_0x4e939b[_0x5f72('0x8')]?_0x4e939b[_0x5f72('0x8')][_0x5f72('0x9')]||null:null,'transaction':_0x4b9170});});})['then'](function(_0x2f3d73){logger['info'](_0x5f72('0x35'),_0x4e939b);logger['debug'](_0x5f72('0x35'),_0x4e939b,JSON[_0x5f72('0x16')](_0x2f3d73));_0xde2439(_0x2f3d73);})[_0x5f72('0x17')](function(_0x3aa2b1){logger['error']('MoveContactManagedDialer',_0x3aa2b1[_0x5f72('0x11')],_0x4e939b);_0x207120(_0x533636['error'](0x1f4,_0x3aa2b1[_0x5f72('0x11')]));});});};exports['CountReScheduled']=function(_0x3a30f9){var _0x41f867=this;return new Promise(function(_0xab111e,_0x4d53cc){return db[_0x5f72('0x6')][_0x5f72('0x7')]({'raw':_0x3a30f9[_0x5f72('0x8')]?_0x3a30f9['options'][_0x5f72('0x14')]===undefined?!![]:![]:!![],'where':_0x3a30f9[_0x5f72('0x8')]?_0x3a30f9['options'][_0x5f72('0x9')]||null:null,'attributes':[[db[_0x5f72('0x22')]['fn'](_0x5f72('0x38'),db[_0x5f72('0x22')]['fn']('IF',db[_0x5f72('0x22')][_0x5f72('0x39')](_0x5f72('0x3a')+util[_0x5f72('0x3b')](_0x5f72('0x3c'),moment()[_0x5f72('0x3b')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x5f72('0x3d')))),_0x5f72('0x3e')]]})['then'](function(_0x8dff2f){logger[_0x5f72('0xf')](_0x5f72('0x3f'),_0x3a30f9);logger[_0x5f72('0x10')](_0x5f72('0x3f'),_0x3a30f9,JSON[_0x5f72('0x16')](_0x8dff2f));_0xab111e(_0x8dff2f);})['catch'](function(_0x510efe){logger[_0x5f72('0x12')]('CountReScheduled',_0x510efe[_0x5f72('0x11')],_0x3a30f9);_0x4d53cc(_0x41f867[_0x5f72('0x12')](0x1f4,_0x510efe[_0x5f72('0x11')]));});});};exports[_0x5f72('0x40')]=function(_0x45f4aa){var _0x1c6dad=this;return new Promise(function(_0x197071,_0x2319ff){return db[_0x5f72('0x27')][_0x5f72('0x21')]()['then'](function(){return db[_0x5f72('0x22')][_0x5f72('0x23')](function(_0x55dd89){return db[_0x5f72('0x6')]['findAll']({'where':_0x45f4aa[_0x5f72('0x8')]?_0x45f4aa[_0x5f72('0x8')]['where']||null:null,'attributes':_0x45f4aa[_0x5f72('0x8')]?_0x45f4aa[_0x5f72('0x8')][_0x5f72('0xa')]||null:null,'limit':0x1,'order':_0x45f4aa[_0x5f72('0x8')]?_0x45f4aa[_0x5f72('0x8')]['order']||null:null,'group':db[_0x5f72('0x6')][_0x5f72('0x2e')],'transaction':_0x55dd89,'lock':_0x55dd89['LOCK'][_0x5f72('0x26')],'include':_0x45f4aa['options']?_0x45f4aa[_0x5f72('0x8')][_0x5f72('0xb')]?_['map'](_0x45f4aa[_0x5f72('0x8')][_0x5f72('0xb')],function(_0x135e80){return{'model':db[_0x135e80[_0x5f72('0xd')]],'as':_0x135e80['as'],'attributes':_0x135e80[_0x5f72('0xa')],'include':_0x135e80[_0x5f72('0xb')]?_[_0x5f72('0xc')](_0x135e80[_0x5f72('0xb')],function(_0xe47b46){return{'model':db[_0xe47b46['model']],'as':_0xe47b46['as'],'attributes':_0xe47b46['attributes'],'include':_0xe47b46[_0x5f72('0xb')]?_['map'](_0xe47b46[_0x5f72('0xb')],function(_0x56a265){return{'model':db[_0x56a265[_0x5f72('0xd')]],'as':_0x56a265['as'],'attributes':_0x56a265['attributes']};}):[]};}):[]};}):[]:[]})[_0x5f72('0xe')](function(_0x9ae1d1){var _0xfaf62d=[];for(var _0x597d6f=0x0;_0x597d6f<_0x9ae1d1[_0x5f72('0x2d')];_0x597d6f+=0x1){_0xfaf62d[_0x5f72('0x2f')](_0x9ae1d1[_0x597d6f]['update'](_0x45f4aa[_0x5f72('0x1a')],{'transaction':_0x55dd89}));}return BPromise[_0x5f72('0x41')](_0xfaf62d);});})[_0x5f72('0xe')](function(_0x25df47){logger[_0x5f72('0xf')]('GetContactRecallMe',_0x45f4aa);logger[_0x5f72('0x10')](_0x5f72('0x40'),_0x45f4aa,JSON[_0x5f72('0x16')](_0x25df47));_0x197071(_0x25df47);})[_0x5f72('0x17')](function(_0x12bc23){logger[_0x5f72('0x12')](_0x5f72('0x40'),_0x12bc23[_0x5f72('0x11')],_0x45f4aa);_0x2319ff(_0x1c6dad[_0x5f72('0x12')](0x1f4,_0x12bc23[_0x5f72('0x11')]));});});});};exports['GetCmHopperPreview']=function(_0x4727d9){var _0xd71502=this;return new Promise(function(_0x4e1f53,_0x525ca5){db[_0x5f72('0x27')][_0x5f72('0x21')]()[_0x5f72('0xe')](function(_0x4e9305){return db[_0x5f72('0x6')]['findAll']({'raw':_0x4727d9[_0x5f72('0x8')]?_0x4727d9[_0x5f72('0x8')][_0x5f72('0x14')]===undefined?!![]:![]:!![],'where':_0x4727d9[_0x5f72('0x8')]?_0x4727d9[_0x5f72('0x8')]['where']||null:null,'attributes':_0x4727d9[_0x5f72('0x8')]?_0x4727d9[_0x5f72('0x8')][_0x5f72('0xa')]||null:null,'limit':_0x4727d9[_0x5f72('0x8')]?_0x4727d9[_0x5f72('0x8')][_0x5f72('0x1c')]||null:null,'include':_0x4727d9[_0x5f72('0x8')]?_0x4727d9[_0x5f72('0x8')][_0x5f72('0xb')]?_[_0x5f72('0xc')](_0x4727d9[_0x5f72('0x8')]['include'],function(_0x1550d3){return{'model':db[_0x1550d3[_0x5f72('0xd')]],'as':_0x1550d3['as'],'attributes':_0x1550d3['as']===_0x5f72('0x42')?_[_0x5f72('0x28')](_0x4e9305):_0x1550d3['attributes'],'include':_0x1550d3[_0x5f72('0xb')]?_[_0x5f72('0xc')](_0x1550d3['include'],function(_0x1dc35c){return{'model':db[_0x1dc35c[_0x5f72('0xd')]],'as':_0x1dc35c['as'],'attributes':_0x1dc35c[_0x5f72('0xa')],'include':_0x1dc35c[_0x5f72('0xb')]?_[_0x5f72('0xc')](_0x1dc35c[_0x5f72('0xb')],function(_0x3fae4a){return{'model':db[_0x3fae4a[_0x5f72('0xd')]],'as':_0x3fae4a['as'],'attributes':_0x3fae4a[_0x5f72('0xa')]};}):[]};}):[]};}):[]:[]})[_0x5f72('0xe')](function(_0x3978bf){logger[_0x5f72('0xf')]('GetCmHopper',_0x4727d9);logger[_0x5f72('0x10')](_0x5f72('0x5'),_0x4727d9,JSON[_0x5f72('0x16')](_0x3978bf));_0x4e1f53(_0x3978bf);})['catch'](function(_0x514796){logger[_0x5f72('0x12')](_0x5f72('0x5'),_0x514796[_0x5f72('0x11')],_0x4727d9);_0x525ca5(_0xd71502[_0x5f72('0x12')](0x1f4,_0x514796[_0x5f72('0x11')]));});});});};exports[_0x5f72('0x43')]=function(_0x378da1){var _0x4d45e5=this;return new Promise(function(_0x3722e6,_0x346822){return db['CmContact'][_0x5f72('0x44')]({'raw':!![],'where':{'phone':_0x378da1[_0x5f72('0x8')][_0x5f72('0x9')][_0x5f72('0x45')]},'attributes':['id',_0x5f72('0x46')],'order':[['id','DESC']]})[_0x5f72('0xe')](function(_0x4b6b9f){logger[_0x5f72('0xf')]('getContactByPhone',_0x378da1);logger[_0x5f72('0x10')](_0x5f72('0x47'),_0x378da1,JSON[_0x5f72('0x16')](_0x4b6b9f));_0x3722e6(_0x4b6b9f);})[_0x5f72('0x17')](function(_0x19dccb){logger[_0x5f72('0x12')](_0x5f72('0x47'),_0x19dccb[_0x5f72('0x11')],_0x378da1);_0x346822(_0x4d45e5['error'](0x1f4,_0x19dccb['message']));});});};exports['ResetActiveCalls']=function(_0x120a0b){var _0x455e4d=this;return new Promise(function(_0x2f74fa,_0x305c03){return db[_0x5f72('0x22')]['transaction'](function(_0x59f1d6){var _0x46f5be=_0x120a0b[_0x5f72('0x8')]&&_0x120a0b[_0x5f72('0x8')][_0x5f72('0x9')]?_0x120a0b[_0x5f72('0x8')][_0x5f72('0x9')]:{};return db[_0x5f72('0x6')]['update'](_0x120a0b['body'],{'where':_0x46f5be,'transaction':_0x59f1d6})[_0x5f72('0xe')](function(_0x3ebf61){logger['info'](_0x5f72('0x48'),_0x120a0b);logger['debug'](_0x5f72('0x48'),_0x120a0b,JSON[_0x5f72('0x16')](_0x3ebf61));_0x2f74fa(_0x3ebf61);})[_0x5f72('0x17')](function(_0x170df7){logger[_0x5f72('0x12')]('ResetActiveCalls',_0x170df7['message'],_0x120a0b);_0x305c03(_0x455e4d[_0x5f72('0x12')](0x1f4,_0x170df7['message']));});});});};exports[_0x5f72('0x49')]=function(_0x205eb6){var _0x6d62c7=this;var _0x255084=_0x205eb6[_0x5f72('0x1a')][_0x5f72('0x9')][_0x5f72('0x4a')];var _0x391af4=_0x205eb6[_0x5f72('0x1a')][_0x5f72('0x9')][_0x5f72('0x4b')];var _0x16dfd1=_0x205eb6['body'][_0x5f72('0x9')][_0x5f72('0x4c')];return new Promise(function(_0x170530,_0x4e271f){return db[_0x5f72('0x6')][_0x5f72('0x7')]({'where':{'voiceQueueId':{'$in':_0x255084},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal'](_0x5f72('0x4d')+_0x391af4+'\x20MINUTE'),'$gt':db[_0x5f72('0x22')]['literal'](_0x5f72('0x4e'))}},'UserId':{'$in':_0x16dfd1}},'include':[{'model':db[_0x5f72('0x27')],'as':_0x5f72('0x42')},{'model':db[_0x5f72('0x29')],'as':'Agent','attributes':['id',_0x5f72('0x2b'),'voicePause']},{'model':db[_0x5f72('0x4f')],'as':_0x5f72('0x50')}]})['then'](function(_0x2f1ed9){if(_0x2f1ed9[_0x5f72('0x2d')]>0x0){return db[_0x5f72('0x22')][_0x5f72('0x23')](function(_0x40dde1){return db['CmHopper'][_0x5f72('0x30')]({'recallmeNotifiedDate':db[_0x5f72('0x22')][_0x5f72('0x39')](_0x5f72('0x4e'))},{'where':{'id':{'$in':_[_0x5f72('0xc')](_0x2f1ed9,'id')}},'transaction':_0x40dde1})['then'](function(){_0x170530(_0x2f1ed9);})[_0x5f72('0x17')](function(_0x1d93f4){logger['error'](_0x5f72('0x49'),_0x1d93f4[_0x5f72('0x11')],_0x205eb6);_0x4e271f(_0x6d62c7[_0x5f72('0x12')](0x1f4,_0x1d93f4['message']));});})[_0x5f72('0x17')](function(_0x4280b7){logger[_0x5f72('0x12')](_0x5f72('0x49'),_0x4280b7[_0x5f72('0x11')],_0x205eb6);_0x4e271f(_0x6d62c7['error'](0x1f4,_0x4280b7[_0x5f72('0x11')]));});}else{_0x170530(_0x2f1ed9);}});});}; \ No newline at end of file +var _0xb120=['find','where','CreateCmHopper','create','body','UpdateCmHopper','active','DestroyCmHopper','destroy','CmContact','describe','sequelize','UPDATE','keys','User','Agent','name','voicePause','UserId','push','update','all','GetContactDialer','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','transaction','CmHopperFinal','CountReScheduled','literal','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','LOCK','GetCmHopperPreview','GetContactByPhone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','Contact','List','util','moment','bluebird','../../mysqldb','rpc','GetCmHopper','CmHopper','findAll','options','raw','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','ShowCmHopper'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xb120,0x7f));var _0x0b12=function(_0x3a05c4,_0x1937e4){_0x3a05c4=_0x3a05c4-0x0;var _0x439be5=_0xb120[_0x3a05c4];return _0x439be5;};'use strict';var _=require('lodash');var util=require(_0x0b12('0x0'));var moment=require(_0x0b12('0x1'));var BPromise=require(_0x0b12('0x2'));var db=require(_0x0b12('0x3'))['db'];var logger=require('../../config/logger')(_0x0b12('0x4'));exports[_0x0b12('0x5')]=function(_0x27cf79){var _0x463d39=this;return new Promise(function(_0x141986,_0x128ff5){return db[_0x0b12('0x6')][_0x0b12('0x7')]({'raw':_0x27cf79[_0x0b12('0x8')]?_0x27cf79[_0x0b12('0x8')][_0x0b12('0x9')]===undefined?!![]:![]:!![],'where':_0x27cf79[_0x0b12('0x8')]?_0x27cf79[_0x0b12('0x8')]['where']||null:null,'attributes':_0x27cf79[_0x0b12('0x8')]?_0x27cf79[_0x0b12('0x8')][_0x0b12('0xa')]||null:null,'limit':_0x27cf79['options']?_0x27cf79[_0x0b12('0x8')][_0x0b12('0xb')]||null:null,'include':_0x27cf79[_0x0b12('0x8')]?_0x27cf79[_0x0b12('0x8')]['include']?_['map'](_0x27cf79['options'][_0x0b12('0xc')],function(_0x12ee7c){return{'model':db[_0x12ee7c['model']],'as':_0x12ee7c['as'],'attributes':_0x12ee7c[_0x0b12('0xa')],'include':_0x12ee7c['include']?_[_0x0b12('0xd')](_0x12ee7c[_0x0b12('0xc')],function(_0x4a2d96){return{'model':db[_0x4a2d96[_0x0b12('0xe')]],'as':_0x4a2d96['as'],'attributes':_0x4a2d96[_0x0b12('0xa')],'include':_0x4a2d96['include']?_[_0x0b12('0xd')](_0x4a2d96[_0x0b12('0xc')],function(_0x21569c){return{'model':db[_0x21569c[_0x0b12('0xe')]],'as':_0x21569c['as'],'attributes':_0x21569c[_0x0b12('0xa')]};}):[]};}):[]};}):[]:[]})[_0x0b12('0xf')](function(_0x19a1a7){logger[_0x0b12('0x10')](_0x0b12('0x5'),_0x27cf79);logger[_0x0b12('0x11')](_0x0b12('0x5'),_0x27cf79,JSON[_0x0b12('0x12')](_0x19a1a7));_0x141986(_0x19a1a7);})[_0x0b12('0x13')](function(_0x240ce6){logger[_0x0b12('0x14')](_0x0b12('0x5'),_0x240ce6[_0x0b12('0x15')],_0x27cf79);_0x128ff5(_0x463d39[_0x0b12('0x14')](0x1f4,_0x240ce6[_0x0b12('0x15')]));});});};exports[_0x0b12('0x16')]=function(_0x2ece66){var _0x43d08c=this;return new Promise(function(_0x44d3b2,_0x5899be){return db[_0x0b12('0x6')][_0x0b12('0x17')]({'raw':_0x2ece66[_0x0b12('0x8')]?_0x2ece66['options'][_0x0b12('0x9')]===undefined?!![]:![]:!![],'where':_0x2ece66[_0x0b12('0x8')]?_0x2ece66['options'][_0x0b12('0x18')]||null:null,'attributes':_0x2ece66[_0x0b12('0x8')]?_0x2ece66[_0x0b12('0x8')][_0x0b12('0xa')]||null:null,'include':_0x2ece66[_0x0b12('0x8')]?_0x2ece66[_0x0b12('0x8')][_0x0b12('0xc')]?_[_0x0b12('0xd')](_0x2ece66['options'][_0x0b12('0xc')],function(_0x2c0d7b){return{'model':db[_0x2c0d7b[_0x0b12('0xe')]],'as':_0x2c0d7b['as'],'attributes':_0x2c0d7b[_0x0b12('0xa')],'include':_0x2c0d7b[_0x0b12('0xc')]?_[_0x0b12('0xd')](_0x2c0d7b[_0x0b12('0xc')],function(_0x232933){return{'model':db[_0x232933[_0x0b12('0xe')]],'as':_0x232933['as'],'attributes':_0x232933[_0x0b12('0xa')],'include':_0x232933[_0x0b12('0xc')]?_[_0x0b12('0xd')](_0x232933[_0x0b12('0xc')],function(_0xe664b0){return{'model':db[_0xe664b0['model']],'as':_0xe664b0['as'],'attributes':_0xe664b0[_0x0b12('0xa')]};}):[]};}):[]};}):[]:[]})[_0x0b12('0xf')](function(_0x1a86bf){logger[_0x0b12('0x10')](_0x0b12('0x16'),_0x2ece66);logger['debug'](_0x0b12('0x16'),_0x2ece66,JSON[_0x0b12('0x12')](_0x1a86bf));_0x44d3b2(_0x1a86bf);})['catch'](function(_0x36b22e){logger['error'](_0x0b12('0x16'),_0x36b22e[_0x0b12('0x15')],_0x2ece66);_0x5899be(_0x43d08c[_0x0b12('0x14')](0x1f4,_0x36b22e[_0x0b12('0x15')]));});});};exports[_0x0b12('0x19')]=function(_0x40679a){var _0x4ce434=this;return new Promise(function(_0x30598a,_0x57dc12){return db[_0x0b12('0x6')][_0x0b12('0x1a')](_0x40679a[_0x0b12('0x1b')],{'raw':_0x40679a['options']?_0x40679a[_0x0b12('0x8')][_0x0b12('0x9')]===undefined?!![]:![]:!![]})['then'](function(_0x3d2850){logger[_0x0b12('0x10')](_0x0b12('0x19'),_0x40679a);logger[_0x0b12('0x11')]('CreateCmHopper',_0x40679a,JSON[_0x0b12('0x12')](_0x3d2850));_0x30598a(_0x3d2850);})[_0x0b12('0x13')](function(_0x21195b){logger[_0x0b12('0x14')]('CreateCmHopper',_0x21195b[_0x0b12('0x15')],_0x40679a);_0x57dc12(_0x4ce434['error'](0x1f4,_0x21195b[_0x0b12('0x15')]));});});};exports['UpdateCmHopper']=function(_0x589879){var _0x9ea4e=this;return new Promise(function(_0x17f70b,_0x426c64){return db['CmHopper']['update'](_0x589879[_0x0b12('0x1b')],{'raw':_0x589879[_0x0b12('0x8')]?_0x589879['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x589879['options']?_0x589879[_0x0b12('0x8')][_0x0b12('0x18')]||null:null,'attributes':_0x589879[_0x0b12('0x8')]?_0x589879[_0x0b12('0x8')][_0x0b12('0xa')]||null:null,'limit':_0x589879['options']?_0x589879[_0x0b12('0x8')][_0x0b12('0xb')]||null:null})[_0x0b12('0xf')](function(_0x23ebde){logger[_0x0b12('0x10')](_0x0b12('0x1c'),_0x589879);logger[_0x0b12('0x10')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x589879[_0x0b12('0x8')][_0x0b12('0x18')]),_0x589879['body'][_0x0b12('0x1d')]);logger[_0x0b12('0x11')](_0x0b12('0x1c'),_0x589879,JSON[_0x0b12('0x12')](_0x23ebde));_0x17f70b(_0x23ebde);})[_0x0b12('0x13')](function(_0x4e725d){logger[_0x0b12('0x14')](_0x0b12('0x1c'),_0x4e725d['message'],_0x589879);_0x426c64(_0x9ea4e[_0x0b12('0x14')](0x1f4,_0x4e725d[_0x0b12('0x15')]));});});};exports[_0x0b12('0x1e')]=function(_0x4f2523){var _0x457498=this;return new Promise(function(_0x5e35a2,_0x5677c7){return db['CmHopper'][_0x0b12('0x1f')]({'where':_0x4f2523[_0x0b12('0x8')]?_0x4f2523[_0x0b12('0x8')]['where']||null:null})[_0x0b12('0xf')](function(_0x459e91){logger[_0x0b12('0x10')](_0x0b12('0x1e'),_0x4f2523);logger[_0x0b12('0x11')](_0x0b12('0x1e'),_0x4f2523,JSON[_0x0b12('0x12')](_0x459e91));_0x5e35a2(_0x459e91);})[_0x0b12('0x13')](function(_0x2c5106){logger['error'](_0x0b12('0x1e'),_0x2c5106[_0x0b12('0x15')],_0x4f2523);_0x5677c7(_0x457498[_0x0b12('0x14')](0x1f4,_0x2c5106[_0x0b12('0x15')]));});});};exports['GetContactDialer']=function(_0x2887c2){var _0x5e21c0=this;return new Promise(function(_0xf8aa4,_0x2999fe){return db[_0x0b12('0x20')][_0x0b12('0x21')]()[_0x0b12('0xf')](function(_0xffc328){return db[_0x0b12('0x22')]['transaction'](function(_0x33dcc5){return db['CmHopper'][_0x0b12('0x7')]({'where':_0x2887c2[_0x0b12('0x8')]?_0x2887c2[_0x0b12('0x8')]['where']||null:null,'attributes':_0x2887c2[_0x0b12('0x8')]?_0x2887c2[_0x0b12('0x8')]['attributes']||null:null,'limit':_0x2887c2[_0x0b12('0x8')]?_0x2887c2[_0x0b12('0x8')][_0x0b12('0xb')]||null:null,'order':_0x2887c2[_0x0b12('0x8')]?_0x2887c2[_0x0b12('0x8')]['order']||null:null,'transaction':_0x33dcc5,'lock':_0x33dcc5['LOCK'][_0x0b12('0x23')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0x0b12('0x24')](_0xffc328)},{'model':db[_0x0b12('0x25')],'as':_0x0b12('0x26'),'attributes':['id',_0x0b12('0x27'),_0x0b12('0x28')]}]})[_0x0b12('0xf')](function(_0x47d641){var _0x129292=[];var _0x5d2dc7=[];for(var _0x10d068=0x0;_0x10d068<_0x47d641['length'];_0x10d068+=0x1){var _0x191a4e=_0x47d641[_0x10d068][_0x0b12('0x29')];if(_0x191a4e===null){_0x129292[_0x0b12('0x2a')](_0x47d641[_0x10d068][_0x0b12('0x2b')](_0x2887c2['body'],{'transaction':_0x33dcc5}));}else if(!_0x5d2dc7['includes'](_0x191a4e)){_0x5d2dc7['push'](_0x191a4e);_0x129292[_0x0b12('0x2a')](_0x47d641[_0x10d068][_0x0b12('0x2b')](_0x2887c2[_0x0b12('0x1b')],{'transaction':_0x33dcc5}));}}return BPromise[_0x0b12('0x2c')](_0x129292);});})[_0x0b12('0xf')](function(_0xdfcae5){logger[_0x0b12('0x10')](_0x0b12('0x2d'),_0x2887c2);if(_0xdfcae5[_0x0b12('0x2e')]>0x0){logger[_0x0b12('0x10')](_0x0b12('0x2f'),_0xdfcae5[0x0][_0x0b12('0x30')]['id'],_0xdfcae5[0x0][_0x0b12('0x30')]['ContactId'],_0xdfcae5[0x0][_0x0b12('0x30')][_0x0b12('0x1d')]);}logger[_0x0b12('0x11')]('GetContactDialer',_0x2887c2,JSON[_0x0b12('0x12')](_0xdfcae5));_0xf8aa4(_0xdfcae5);})[_0x0b12('0x13')](function(_0x232bc6){logger[_0x0b12('0x14')]('GetContactDialer',_0x232bc6[_0x0b12('0x15')],_0x2887c2);_0x2999fe(_0x5e21c0[_0x0b12('0x14')](0x1f4,_0x232bc6['message']));});});});};exports[_0x0b12('0x31')]=function(_0x360814){var _0x483c99=this;return new Promise(function(_0x283bb1,_0x52ec08){return db[_0x0b12('0x22')][_0x0b12('0x32')](function(_0x2387ef){return db[_0x0b12('0x33')][_0x0b12('0x1a')](_0x360814[_0x0b12('0x1b')],{'raw':_0x360814[_0x0b12('0x8')]?_0x360814[_0x0b12('0x8')]['raw']===undefined?!![]:![]:!![],'transaction':_0x2387ef})[_0x0b12('0xf')](function(){logger[_0x0b12('0x10')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x0b12('0x12')](_0x360814['options'][_0x0b12('0x18')]),_0x360814[_0x0b12('0x8')][_0x0b12('0x18')][_0x0b12('0x1d')]);return db[_0x0b12('0x6')][_0x0b12('0x1f')]({'where':_0x360814[_0x0b12('0x8')]?_0x360814[_0x0b12('0x8')][_0x0b12('0x18')]||null:null,'transaction':_0x2387ef});});})[_0x0b12('0xf')](function(_0x568901){logger[_0x0b12('0x10')](_0x0b12('0x31'),_0x360814);logger[_0x0b12('0x11')](_0x0b12('0x31'),_0x360814,JSON[_0x0b12('0x12')](_0x568901));_0x283bb1(_0x568901);})['catch'](function(_0x38a101){logger[_0x0b12('0x14')](_0x0b12('0x31'),_0x38a101[_0x0b12('0x15')],_0x360814);_0x52ec08(_0x483c99['error'](0x1f4,_0x38a101[_0x0b12('0x15')]));});});};exports[_0x0b12('0x34')]=function(_0x2ca3f8){var _0x25e516=this;return new Promise(function(_0x36790d,_0x2ce5c8){return db['CmHopper'][_0x0b12('0x7')]({'raw':_0x2ca3f8[_0x0b12('0x8')]?_0x2ca3f8[_0x0b12('0x8')][_0x0b12('0x9')]===undefined?!![]:![]:!![],'where':_0x2ca3f8[_0x0b12('0x8')]?_0x2ca3f8[_0x0b12('0x8')][_0x0b12('0x18')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0b12('0x22')][_0x0b12('0x35')]('`scheduledat`\x20>=\x20'+util[_0x0b12('0x36')]('\x22%s\x22',moment()[_0x0b12('0x36')](_0x0b12('0x37')))+_0x0b12('0x38')))),_0x0b12('0x39')]]})[_0x0b12('0xf')](function(_0x41e708){logger['info'](_0x0b12('0x34'),_0x2ca3f8);logger[_0x0b12('0x11')](_0x0b12('0x34'),_0x2ca3f8,JSON['stringify'](_0x41e708));_0x36790d(_0x41e708);})[_0x0b12('0x13')](function(_0x14ce15){logger[_0x0b12('0x14')]('CountReScheduled',_0x14ce15['message'],_0x2ca3f8);_0x2ce5c8(_0x25e516[_0x0b12('0x14')](0x1f4,_0x14ce15[_0x0b12('0x15')]));});});};exports[_0x0b12('0x3a')]=function(_0x158e8b){var _0x42258b=this;return new Promise(function(_0x4a2856,_0x13cac5){return db[_0x0b12('0x20')]['describe']()[_0x0b12('0xf')](function(){return db['sequelize']['transaction'](function(_0x2f8075){return db['CmHopper']['findAll']({'where':_0x158e8b[_0x0b12('0x8')]?_0x158e8b['options'][_0x0b12('0x18')]||null:null,'attributes':_0x158e8b['options']?_0x158e8b[_0x0b12('0x8')][_0x0b12('0xa')]||null:null,'limit':0x1,'order':_0x158e8b[_0x0b12('0x8')]?_0x158e8b[_0x0b12('0x8')][_0x0b12('0x3b')]||null:null,'group':db[_0x0b12('0x6')]['UserId'],'transaction':_0x2f8075,'lock':_0x2f8075[_0x0b12('0x3c')]['UPDATE'],'include':_0x158e8b[_0x0b12('0x8')]?_0x158e8b[_0x0b12('0x8')][_0x0b12('0xc')]?_['map'](_0x158e8b[_0x0b12('0x8')][_0x0b12('0xc')],function(_0x47a879){return{'model':db[_0x47a879[_0x0b12('0xe')]],'as':_0x47a879['as'],'attributes':_0x47a879[_0x0b12('0xa')],'include':_0x47a879[_0x0b12('0xc')]?_[_0x0b12('0xd')](_0x47a879[_0x0b12('0xc')],function(_0x3daa29){return{'model':db[_0x3daa29['model']],'as':_0x3daa29['as'],'attributes':_0x3daa29[_0x0b12('0xa')],'include':_0x3daa29[_0x0b12('0xc')]?_[_0x0b12('0xd')](_0x3daa29['include'],function(_0x41c2e8){return{'model':db[_0x41c2e8[_0x0b12('0xe')]],'as':_0x41c2e8['as'],'attributes':_0x41c2e8[_0x0b12('0xa')]};}):[]};}):[]};}):[]:[]})[_0x0b12('0xf')](function(_0x2404d1){var _0x4330ec=[];for(var _0x4fd87b=0x0;_0x4fd87b<_0x2404d1[_0x0b12('0x2e')];_0x4fd87b+=0x1){_0x4330ec[_0x0b12('0x2a')](_0x2404d1[_0x4fd87b][_0x0b12('0x2b')](_0x158e8b[_0x0b12('0x1b')],{'transaction':_0x2f8075}));}return BPromise['all'](_0x4330ec);});})['then'](function(_0x5f5129){logger[_0x0b12('0x10')](_0x0b12('0x3a'),_0x158e8b);logger[_0x0b12('0x11')]('GetContactRecallMe',_0x158e8b,JSON[_0x0b12('0x12')](_0x5f5129));_0x4a2856(_0x5f5129);})[_0x0b12('0x13')](function(_0x5a2fcf){logger[_0x0b12('0x14')](_0x0b12('0x3a'),_0x5a2fcf[_0x0b12('0x15')],_0x158e8b);_0x13cac5(_0x42258b[_0x0b12('0x14')](0x1f4,_0x5a2fcf[_0x0b12('0x15')]));});});});};exports[_0x0b12('0x3d')]=function(_0x5f2b17){var _0x323cff=this;return new Promise(function(_0x53f1d9,_0x2a3095){db[_0x0b12('0x20')][_0x0b12('0x21')]()[_0x0b12('0xf')](function(_0x568d45){return db[_0x0b12('0x6')][_0x0b12('0x7')]({'raw':_0x5f2b17[_0x0b12('0x8')]?_0x5f2b17[_0x0b12('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x5f2b17[_0x0b12('0x8')]?_0x5f2b17['options']['where']||null:null,'attributes':_0x5f2b17['options']?_0x5f2b17[_0x0b12('0x8')][_0x0b12('0xa')]||null:null,'limit':_0x5f2b17[_0x0b12('0x8')]?_0x5f2b17['options'][_0x0b12('0xb')]||null:null,'include':_0x5f2b17[_0x0b12('0x8')]?_0x5f2b17['options']['include']?_['map'](_0x5f2b17[_0x0b12('0x8')][_0x0b12('0xc')],function(_0x2b5fd6){return{'model':db[_0x2b5fd6[_0x0b12('0xe')]],'as':_0x2b5fd6['as'],'attributes':_0x2b5fd6['as']==='Contact'?_[_0x0b12('0x24')](_0x568d45):_0x2b5fd6[_0x0b12('0xa')],'include':_0x2b5fd6[_0x0b12('0xc')]?_[_0x0b12('0xd')](_0x2b5fd6[_0x0b12('0xc')],function(_0xa94c01){return{'model':db[_0xa94c01[_0x0b12('0xe')]],'as':_0xa94c01['as'],'attributes':_0xa94c01[_0x0b12('0xa')],'include':_0xa94c01['include']?_[_0x0b12('0xd')](_0xa94c01[_0x0b12('0xc')],function(_0xad28fe){return{'model':db[_0xad28fe[_0x0b12('0xe')]],'as':_0xad28fe['as'],'attributes':_0xad28fe['attributes']};}):[]};}):[]};}):[]:[]})[_0x0b12('0xf')](function(_0x2dcc30){logger['info'](_0x0b12('0x5'),_0x5f2b17);logger[_0x0b12('0x11')]('GetCmHopper',_0x5f2b17,JSON[_0x0b12('0x12')](_0x2dcc30));_0x53f1d9(_0x2dcc30);})['catch'](function(_0x3a20ee){logger[_0x0b12('0x14')](_0x0b12('0x5'),_0x3a20ee[_0x0b12('0x15')],_0x5f2b17);_0x2a3095(_0x323cff[_0x0b12('0x14')](0x1f4,_0x3a20ee['message']));});});});};exports[_0x0b12('0x3e')]=function(_0x2caab0){var _0x25a47e=this;return new Promise(function(_0x5449ad,_0xaa1a9c){return db[_0x0b12('0x20')]['findOne']({'raw':!![],'where':{'phone':_0x2caab0['options']['where']['phone']},'attributes':['id',_0x0b12('0x3f')],'order':[['id',_0x0b12('0x40')]]})[_0x0b12('0xf')](function(_0x2f2437){logger[_0x0b12('0x10')](_0x0b12('0x41'),_0x2caab0);logger[_0x0b12('0x11')]('getContactByPhone',_0x2caab0,JSON[_0x0b12('0x12')](_0x2f2437));_0x5449ad(_0x2f2437);})['catch'](function(_0x1405d3){logger[_0x0b12('0x14')]('getContactByPhone',_0x1405d3[_0x0b12('0x15')],_0x2caab0);_0xaa1a9c(_0x25a47e[_0x0b12('0x14')](0x1f4,_0x1405d3[_0x0b12('0x15')]));});});};exports[_0x0b12('0x42')]=function(_0x4c6d6e){var _0x493aad=this;return new Promise(function(_0x25cded,_0x398dcc){return db[_0x0b12('0x22')][_0x0b12('0x32')](function(_0x5b2999){var _0x2c4839=_0x4c6d6e[_0x0b12('0x8')]&&_0x4c6d6e[_0x0b12('0x8')][_0x0b12('0x18')]?_0x4c6d6e[_0x0b12('0x8')][_0x0b12('0x18')]:{};return db[_0x0b12('0x6')][_0x0b12('0x2b')](_0x4c6d6e['body'],{'where':_0x2c4839,'transaction':_0x5b2999})[_0x0b12('0xf')](function(_0x96c0fc){logger[_0x0b12('0x10')](_0x0b12('0x42'),_0x4c6d6e);logger[_0x0b12('0x11')](_0x0b12('0x42'),_0x4c6d6e,JSON[_0x0b12('0x12')](_0x96c0fc));_0x25cded(_0x96c0fc);})[_0x0b12('0x13')](function(_0x2f31a2){logger['error'](_0x0b12('0x42'),_0x2f31a2[_0x0b12('0x15')],_0x4c6d6e);_0x398dcc(_0x493aad[_0x0b12('0x14')](0x1f4,_0x2f31a2[_0x0b12('0x15')]));});});});};exports[_0x0b12('0x43')]=function(_0x5348d9){var _0x4c64db=this;var _0xc3a0d0=_0x5348d9[_0x0b12('0x1b')][_0x0b12('0x18')][_0x0b12('0x44')];var _0x331298=_0x5348d9[_0x0b12('0x1b')]['where'][_0x0b12('0x45')];var _0x359b1d=_0x5348d9[_0x0b12('0x1b')]['where']['availableAgentsIds'];return new Promise(function(_0x6ee020,_0x370909){return db['CmHopper']['findAll']({'where':{'voiceQueueId':{'$in':_0xc3a0d0},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0x0b12('0x35')](_0x0b12('0x46')+_0x331298+_0x0b12('0x47')),'$gt':db[_0x0b12('0x22')][_0x0b12('0x35')](_0x0b12('0x48'))}},'UserId':{'$in':_0x359b1d}},'include':[{'model':db[_0x0b12('0x20')],'as':_0x0b12('0x49')},{'model':db[_0x0b12('0x25')],'as':_0x0b12('0x26'),'attributes':['id','name',_0x0b12('0x28')]},{'model':db['CmList'],'as':_0x0b12('0x4a')}]})[_0x0b12('0xf')](function(_0x358a91){if(_0x358a91[_0x0b12('0x2e')]>0x0){return db[_0x0b12('0x22')][_0x0b12('0x32')](function(_0x5ae4d7){return db[_0x0b12('0x6')][_0x0b12('0x2b')]({'recallmeNotifiedDate':db['sequelize'][_0x0b12('0x35')](_0x0b12('0x48'))},{'where':{'id':{'$in':_[_0x0b12('0xd')](_0x358a91,'id')}},'transaction':_0x5ae4d7})[_0x0b12('0xf')](function(){_0x6ee020(_0x358a91);})[_0x0b12('0x13')](function(_0x33e1f6){logger[_0x0b12('0x14')](_0x0b12('0x43'),_0x33e1f6[_0x0b12('0x15')],_0x5348d9);_0x370909(_0x4c64db[_0x0b12('0x14')](0x1f4,_0x33e1f6[_0x0b12('0x15')]));});})[_0x0b12('0x13')](function(_0x276593){logger[_0x0b12('0x14')](_0x0b12('0x43'),_0x276593[_0x0b12('0x15')],_0x5348d9);_0x370909(_0x4c64db[_0x0b12('0x14')](0x1f4,_0x276593[_0x0b12('0x15')]));});}else{_0x6ee020(_0x358a91);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index f1fb0d8..5d205ff 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 _0xfe60=['getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','getTimezone','put','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','index','/describe','isAuthenticated'];(function(_0x35aa5c,_0x2b7f6e){var _0xd6d1b6=function(_0x48d58c){while(--_0x48d58c){_0x35aa5c['push'](_0x35aa5c['shift']());}};_0xd6d1b6(++_0x2b7f6e);}(_0xfe60,0x75));var _0x0fe6=function(_0x1ff3ec,_0x319426){_0x1ff3ec=_0x1ff3ec-0x0;var _0x5a9385=_0xfe60[_0x1ff3ec];return _0x5a9385;};'use strict';var express=require(_0x0fe6('0x0'));var router=express[_0x0fe6('0x1')]();var auth=require(_0x0fe6('0x2'));var controller=require(_0x0fe6('0x3'));router[_0x0fe6('0x4')]('/',auth['isAuthenticated'](),controller[_0x0fe6('0x5')]);router[_0x0fe6('0x4')](_0x0fe6('0x6'),auth[_0x0fe6('0x7')](),controller['describe']);router[_0x0fe6('0x4')]('/opencontacts',auth[_0x0fe6('0x7')](),controller[_0x0fe6('0x8')]);router[_0x0fe6('0x4')](_0x0fe6('0x9'),auth[_0x0fe6('0x7')](),controller[_0x0fe6('0xa')]);router['get'](_0x0fe6('0xb'),auth[_0x0fe6('0x7')](),controller[_0x0fe6('0xc')]);router[_0x0fe6('0x4')](_0x0fe6('0xd'),auth[_0x0fe6('0x7')](),controller[_0x0fe6('0xe')]);router[_0x0fe6('0xf')]('/',auth[_0x0fe6('0x7')](),controller[_0x0fe6('0x10')]);router[_0x0fe6('0xf')](_0x0fe6('0x11'),auth[_0x0fe6('0x7')](),controller[_0x0fe6('0x12')]);router[_0x0fe6('0xf')]('/timezone',auth['isAuthenticated'](),controller[_0x0fe6('0x13')]);router[_0x0fe6('0x14')]('/:id',auth[_0x0fe6('0x7')](),controller[_0x0fe6('0x15')]);router[_0x0fe6('0x16')](_0x0fe6('0xb'),auth['isAuthenticated'](),controller[_0x0fe6('0x17')]);module[_0x0fe6('0x18')]=router; \ No newline at end of file +var _0xe2b5=['/:id','show','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','/timezones','getTimezones'];(function(_0x15d763,_0x5d5012){var _0x2d12cc=function(_0x3ceb49){while(--_0x3ceb49){_0x15d763['push'](_0x15d763['shift']());}};_0x2d12cc(++_0x5d5012);}(_0xe2b5,0x120));var _0x5e2b=function(_0x3755a2,_0x5be61e){_0x3755a2=_0x3755a2-0x0;var _0x2df8e4=_0xe2b5[_0x3755a2];return _0x2df8e4;};'use strict';var express=require(_0x5e2b('0x0'));var router=express[_0x5e2b('0x1')]();var auth=require(_0x5e2b('0x2'));var controller=require(_0x5e2b('0x3'));router[_0x5e2b('0x4')]('/',auth[_0x5e2b('0x5')](),controller[_0x5e2b('0x6')]);router[_0x5e2b('0x4')](_0x5e2b('0x7'),auth[_0x5e2b('0x5')](),controller[_0x5e2b('0x8')]);router[_0x5e2b('0x4')](_0x5e2b('0x9'),auth[_0x5e2b('0x5')](),controller['getOpenContacts']);router[_0x5e2b('0x4')](_0x5e2b('0xa'),auth[_0x5e2b('0x5')](),controller[_0x5e2b('0xb')]);router[_0x5e2b('0x4')](_0x5e2b('0xc'),auth[_0x5e2b('0x5')](),controller[_0x5e2b('0xd')]);router['get']('/:id/previewrecall',auth['isAuthenticated'](),controller[_0x5e2b('0xe')]);router[_0x5e2b('0xf')]('/',auth[_0x5e2b('0x5')](),controller[_0x5e2b('0x10')]);router[_0x5e2b('0xf')](_0x5e2b('0x11'),auth['isAuthenticated'](),controller[_0x5e2b('0x12')]);router[_0x5e2b('0xf')](_0x5e2b('0x13'),auth[_0x5e2b('0x5')](),controller[_0x5e2b('0x14')]);router['put']('/:id',auth[_0x5e2b('0x5')](),controller[_0x5e2b('0x15')]);router[_0x5e2b('0x16')]('/:id',auth[_0x5e2b('0x5')](),controller[_0x5e2b('0x17')]);module[_0x5e2b('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index f2f999a..05411a5 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 _0xb527=['exports','INTEGER','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize'];(function(_0x3e3432,_0xa18f5f){var _0x10bb36=function(_0x18808e){while(--_0x18808e){_0x3e3432['push'](_0x3e3432['shift']());}};_0x10bb36(++_0xa18f5f);}(_0xb527,0x116));var _0x7b52=function(_0xfdc98e,_0x3f3e0e){_0xfdc98e=_0xfdc98e-0x0;var _0x5b0307=_0xb527[_0xfdc98e];return _0x5b0307;};'use strict';var moment=require(_0x7b52('0x0'));var Sequelize=require(_0x7b52('0x1'));module[_0x7b52('0x2')]={'CmHopperId':{'type':Sequelize[_0x7b52('0x3')]},'phone':{'type':Sequelize[_0x7b52('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x7b52('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x7b52('0x5')],'defaultValue':moment()['format'](_0x7b52('0x6'))},'countbusyretry':{'type':Sequelize[_0x7b52('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7b52('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7b52('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x7b52('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7b52('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7b52('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xeb19=['format','moment','sequelize','exports','INTEGER','DATE'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xeb19,0xd3));var _0x9eb1=function(_0x31d31f,_0x13b41a){_0x31d31f=_0x31d31f-0x0;var _0x5d0246=_0xeb19[_0x31d31f];return _0x5d0246;};'use strict';var moment=require(_0x9eb1('0x0'));var Sequelize=require(_0x9eb1('0x1'));module[_0x9eb1('0x2')]={'CmHopperId':{'type':Sequelize[_0x9eb1('0x3')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x9eb1('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x9eb1('0x4')],'defaultValue':moment()[_0x9eb1('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9eb1('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x9eb1('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9eb1('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9eb1('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9eb1('0x3')],'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 f2aa55a..fe8c404 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 _0xba08=['then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','reject','update'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xba08,0x188));var _0x8ba0=function(_0xb5a111,_0x25dd37){_0xb5a111=_0xb5a111-0x0;var _0x169f93=_0xba08[_0xb5a111];return _0x169f93;};'use strict';var emlformat=require(_0x8ba0('0x0'));var rimraf=require(_0x8ba0('0x1'));var zipdir=require(_0x8ba0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ba0('0x3'));var moment=require(_0x8ba0('0x4'));var BPromise=require(_0x8ba0('0x5'));var Mustache=require(_0x8ba0('0x6'));var util=require(_0x8ba0('0x7'));var path=require(_0x8ba0('0x8'));var sox=require(_0x8ba0('0x9'));var csv=require(_0x8ba0('0xa'));var ejs=require(_0x8ba0('0xb'));var fs=require('fs');var fs_extra=require(_0x8ba0('0xc'));var _=require(_0x8ba0('0xd'));var squel=require(_0x8ba0('0xe'));var crypto=require(_0x8ba0('0xf'));var jsforce=require(_0x8ba0('0x10'));var deskjs=require(_0x8ba0('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ba0('0x12'));var Redis=require('ioredis');var authService=require(_0x8ba0('0x13'));var qs=require(_0x8ba0('0x14'));var as=require(_0x8ba0('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8ba0('0x16'));var utils=require(_0x8ba0('0x17'));var config=require(_0x8ba0('0x18'));var licenseUtil=require(_0x8ba0('0x19'));var db=require(_0x8ba0('0x1a'))['db'];function respondWithStatusCode(_0x40c370,_0x4bee64){_0x4bee64=_0x4bee64||0xcc;return function(_0x2a2324){if(_0x2a2324){return _0x40c370[_0x8ba0('0x1b')](_0x4bee64);}return _0x40c370[_0x8ba0('0x1c')](_0x4bee64)[_0x8ba0('0x1d')]();};}function respondWithResult(_0x46a0bb,_0x1a5b96){_0x1a5b96=_0x1a5b96||0xc8;return function(_0x1097b5){if(_0x1097b5){return _0x46a0bb[_0x8ba0('0x1c')](_0x1a5b96)['json'](_0x1097b5);}};}function respondWithFilteredResult(_0x19dab2,_0x38878c){return function(_0x592577){if(_0x592577){var _0x4bd100=typeof _0x38878c[_0x8ba0('0x1e')]==='undefined'&&typeof _0x38878c['limit']===_0x8ba0('0x1f');var _0x5770be=_0x592577[_0x8ba0('0x20')];var _0x34b446=_0x4bd100?0x0:_0x38878c[_0x8ba0('0x1e')];var _0xee9121=_0x4bd100?_0x592577['count']:_0x38878c[_0x8ba0('0x1e')]+_0x38878c[_0x8ba0('0x21')];var _0x20e78e;if(_0xee9121>=_0x5770be){_0xee9121=_0x5770be;_0x20e78e=0xc8;}else{_0x20e78e=0xce;}_0x19dab2[_0x8ba0('0x1c')](_0x20e78e);return _0x19dab2[_0x8ba0('0x22')]('Content-Range',_0x34b446+'-'+_0xee9121+'/'+_0x5770be)[_0x8ba0('0x23')](_0x592577);}return null;};}function patchUpdates(_0x26b7bf){return function(_0x43b9d6){try{jsonpatch['apply'](_0x43b9d6,_0x26b7bf,!![]);}catch(_0x10130d){return BPromise[_0x8ba0('0x24')](_0x10130d);}return _0x43b9d6['save']();};}function saveUpdates(_0x30e1be,_0x53897a){return function(_0x493f76){if(_0x493f76){return _0x493f76[_0x8ba0('0x25')](_0x30e1be)[_0x8ba0('0x26')](function(_0x49a58a){return _0x49a58a;});}return null;};}function removeEntity(_0x7a6248,_0xc514a1){return function(_0x5e7cd6){if(_0x5e7cd6){return _0x5e7cd6['destroy']()[_0x8ba0('0x26')](function(){var _0xb5b016=_0x5e7cd6[_0x8ba0('0x27')]({'plain':!![]});var _0x716824=_0x8ba0('0x28');return db[_0x8ba0('0x29')][_0x8ba0('0x2a')]({'where':{'type':_0x716824,'resourceId':_0xb5b016['id']}})[_0x8ba0('0x26')](function(){return _0x5e7cd6;});})[_0x8ba0('0x26')](function(){_0x7a6248['status'](0xcc)[_0x8ba0('0x1d')]();});}};}function handleEntityNotFound(_0x5a0235,_0x1ec1a7){return function(_0x3f4532){if(!_0x3f4532){_0x5a0235[_0x8ba0('0x1b')](0x194);}return _0x3f4532;};}function handleError(_0xb1b310,_0x7e5555){_0x7e5555=_0x7e5555||0x1f4;return function(_0x5f1104){logger[_0x8ba0('0x2b')](_0x5f1104[_0x8ba0('0x2c')]);if(_0x5f1104[_0x8ba0('0x2d')]){delete _0x5f1104[_0x8ba0('0x2d')];}_0xb1b310['status'](_0x7e5555)[_0x8ba0('0x2e')](_0x5f1104);};}exports[_0x8ba0('0x2f')]=function(_0x3d0eb9,_0x18aec1){var _0x117d3d={},_0x1711be={},_0xf85df6={'count':0x0,'rows':[]};var _0x36f6f6=_[_0x8ba0('0x30')](db[_0x8ba0('0x31')][_0x8ba0('0x32')],function(_0x29535e){return{'name':_0x29535e[_0x8ba0('0x33')],'type':_0x29535e[_0x8ba0('0x34')][_0x8ba0('0x35')]};});_0x1711be['model']=_['map'](_0x36f6f6,'name');_0x1711be[_0x8ba0('0x36')]=_[_0x8ba0('0x37')](_0x3d0eb9['query']);_0x1711be['filters']=_[_0x8ba0('0x38')](_0x1711be[_0x8ba0('0x39')],_0x1711be[_0x8ba0('0x36')]);_0x117d3d[_0x8ba0('0x3a')]=_[_0x8ba0('0x38')](_0x1711be[_0x8ba0('0x39')],qs['fields'](_0x3d0eb9[_0x8ba0('0x36')][_0x8ba0('0x3b')]));_0x117d3d[_0x8ba0('0x3a')]=_0x117d3d['attributes'][_0x8ba0('0x3c')]?_0x117d3d[_0x8ba0('0x3a')]:_0x1711be[_0x8ba0('0x39')];if(!_0x3d0eb9['query']['hasOwnProperty'](_0x8ba0('0x3d'))){_0x117d3d[_0x8ba0('0x21')]=qs['limit'](_0x3d0eb9['query'][_0x8ba0('0x21')]);_0x117d3d[_0x8ba0('0x1e')]=qs[_0x8ba0('0x1e')](_0x3d0eb9[_0x8ba0('0x36')]['offset']);}_0x117d3d[_0x8ba0('0x3e')]=qs[_0x8ba0('0x3f')](_0x3d0eb9[_0x8ba0('0x36')]['sort']);_0x117d3d[_0x8ba0('0x40')]=qs[_0x8ba0('0x41')](_[_0x8ba0('0x42')](_0x3d0eb9[_0x8ba0('0x36')],_0x1711be[_0x8ba0('0x41')]),_0x36f6f6);if(_0x3d0eb9['query'][_0x8ba0('0x43')]){_0x117d3d[_0x8ba0('0x40')]=_[_0x8ba0('0x44')](_0x117d3d['where'],{'$or':_[_0x8ba0('0x30')](_0x36f6f6,function(_0x30613f){if(_0x30613f[_0x8ba0('0x34')]!==_0x8ba0('0x45')){var _0x1ed5d5={};_0x1ed5d5[_0x30613f[_0x8ba0('0x2d')]]={'$like':'%'+_0x3d0eb9['query']['filter']+'%'};return _0x1ed5d5;}})});}_0x117d3d=_[_0x8ba0('0x44')]({},_0x117d3d,_0x3d0eb9['options']);var _0x37fdc4={'where':_0x117d3d[_0x8ba0('0x40')]};return db[_0x8ba0('0x31')]['count'](_0x37fdc4)[_0x8ba0('0x26')](function(_0x2cc6d0){_0xf85df6[_0x8ba0('0x20')]=_0x2cc6d0;if(_0x3d0eb9['query'][_0x8ba0('0x46')]){_0x117d3d[_0x8ba0('0x47')]=[{'all':!![]}];}return db[_0x8ba0('0x31')][_0x8ba0('0x48')](_0x117d3d);})[_0x8ba0('0x26')](function(_0xdff783){_0xf85df6[_0x8ba0('0x49')]=_0xdff783;return _0xf85df6;})['then'](respondWithFilteredResult(_0x18aec1,_0x117d3d))[_0x8ba0('0x4a')](handleError(_0x18aec1,null));};exports[_0x8ba0('0x4b')]=function(_0x1694b9,_0x344c6d){var _0x547e23={'raw':!![],'where':{'id':_0x1694b9['params']['id']}},_0x27537d={};_0x27537d[_0x8ba0('0x39')]=_[_0x8ba0('0x37')](db[_0x8ba0('0x31')]['rawAttributes']);_0x27537d[_0x8ba0('0x36')]=_[_0x8ba0('0x37')](_0x1694b9[_0x8ba0('0x36')]);_0x27537d['filters']=_['intersection'](_0x27537d[_0x8ba0('0x39')],_0x27537d['query']);_0x547e23['attributes']=_[_0x8ba0('0x38')](_0x27537d[_0x8ba0('0x39')],qs[_0x8ba0('0x3b')](_0x1694b9[_0x8ba0('0x36')][_0x8ba0('0x3b')]));_0x547e23[_0x8ba0('0x3a')]=_0x547e23[_0x8ba0('0x3a')][_0x8ba0('0x3c')]?_0x547e23['attributes']:_0x27537d[_0x8ba0('0x39')];if(_0x1694b9[_0x8ba0('0x36')]['includeAll']){_0x547e23[_0x8ba0('0x47')]=[{'all':!![]}];}_0x547e23=_[_0x8ba0('0x44')]({},_0x547e23,_0x1694b9[_0x8ba0('0x4c')]);return db['CmHopperAdditionalPhone'][_0x8ba0('0x4d')](_0x547e23)['then'](handleEntityNotFound(_0x344c6d,null))[_0x8ba0('0x26')](respondWithResult(_0x344c6d,null))['catch'](handleError(_0x344c6d,null));};exports[_0x8ba0('0x4e')]=function(_0x364c34,_0x2176fc){return db[_0x8ba0('0x31')][_0x8ba0('0x4e')](_0x364c34[_0x8ba0('0x4f')],{})[_0x8ba0('0x26')](function(_0x2173b2){var _0x32de2d=_0x364c34['user'][_0x8ba0('0x27')]({'plain':!![]});if(!_0x32de2d)throw new Error(_0x8ba0('0x50'));if(_0x32de2d[_0x8ba0('0x51')]===_0x8ba0('0x52')){var _0x189527=_0x2173b2['get']({'plain':!![]});var _0x5210bb=_0x8ba0('0x28');return db[_0x8ba0('0x53')][_0x8ba0('0x4d')]({'where':{'name':_0x5210bb,'userProfileId':_0x32de2d['userProfileId']},'raw':!![]})['then'](function(_0x5e7277){if(_0x5e7277&&_0x5e7277['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x189527[_0x8ba0('0x2d')],'resourceId':_0x189527['id'],'type':_0x5e7277[_0x8ba0('0x2d')],'sectionId':_0x5e7277['id']},{})[_0x8ba0('0x26')](function(){return _0x2173b2;});}else{return _0x2173b2;}})[_0x8ba0('0x4a')](function(_0xafe0ea){logger['error'](_0x8ba0('0x54'),_0xafe0ea);throw _0xafe0ea;});}return _0x2173b2;})['then'](respondWithResult(_0x2176fc,0xc9))['catch'](handleError(_0x2176fc,null));};exports['update']=function(_0x4eda9e,_0x5d1cad){if(_0x4eda9e[_0x8ba0('0x4f')]['id']){delete _0x4eda9e[_0x8ba0('0x4f')]['id'];}return db['CmHopperAdditionalPhone'][_0x8ba0('0x4d')]({'where':{'id':_0x4eda9e[_0x8ba0('0x55')]['id']}})[_0x8ba0('0x26')](handleEntityNotFound(_0x5d1cad,null))[_0x8ba0('0x26')](saveUpdates(_0x4eda9e[_0x8ba0('0x4f')],null))['then'](respondWithResult(_0x5d1cad,null))[_0x8ba0('0x4a')](handleError(_0x5d1cad,null));};exports['destroy']=function(_0x8b1752,_0x111366){return db['CmHopperAdditionalPhone'][_0x8ba0('0x4d')]({'where':{'id':_0x8b1752[_0x8ba0('0x55')]['id']}})[_0x8ba0('0x26')](handleEntityNotFound(_0x111366,null))['then'](removeEntity(_0x111366,null))[_0x8ba0('0x4a')](handleError(_0x111366,null));}; \ No newline at end of file +var _0x6a2f=['query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','update','then','CmHopperAdditionalPhones','UserProfileResource','end','error','stack','name','send','CmHopperAdditionalPhone','fieldName','type','key','model'];(function(_0x2f0582,_0x3c2f49){var _0x56c66d=function(_0x390e23){while(--_0x390e23){_0x2f0582['push'](_0x2f0582['shift']());}};_0x56c66d(++_0x3c2f49);}(_0x6a2f,0x78));var _0xf6a2=function(_0x5c082a,_0x19ac27){_0x5c082a=_0x5c082a-0x0;var _0x3b60ac=_0x6a2f[_0x5c082a];return _0x3b60ac;};'use strict';var emlformat=require(_0xf6a2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf6a2('0x1'));var jsonpatch=require(_0xf6a2('0x2'));var rp=require(_0xf6a2('0x3'));var moment=require(_0xf6a2('0x4'));var BPromise=require(_0xf6a2('0x5'));var Mustache=require(_0xf6a2('0x6'));var util=require(_0xf6a2('0x7'));var path=require(_0xf6a2('0x8'));var sox=require(_0xf6a2('0x9'));var csv=require(_0xf6a2('0xa'));var ejs=require(_0xf6a2('0xb'));var fs=require('fs');var fs_extra=require(_0xf6a2('0xc'));var _=require(_0xf6a2('0xd'));var squel=require(_0xf6a2('0xe'));var crypto=require(_0xf6a2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xf6a2('0x10'));var toCsv=require(_0xf6a2('0xa'));var querystring=require(_0xf6a2('0x11'));var Papa=require(_0xf6a2('0x12'));var Redis=require(_0xf6a2('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf6a2('0x14'));var hardwareService=require(_0xf6a2('0x15'));var logger=require(_0xf6a2('0x16'))(_0xf6a2('0x17'));var utils=require(_0xf6a2('0x18'));var config=require(_0xf6a2('0x19'));var licenseUtil=require(_0xf6a2('0x1a'));var db=require(_0xf6a2('0x1b'))['db'];function respondWithStatusCode(_0x4b43a6,_0x25eec2){_0x25eec2=_0x25eec2||0xcc;return function(_0x24ff6e){if(_0x24ff6e){return _0x4b43a6[_0xf6a2('0x1c')](_0x25eec2);}return _0x4b43a6[_0xf6a2('0x1d')](_0x25eec2)['end']();};}function respondWithResult(_0x1e8c28,_0x277a70){_0x277a70=_0x277a70||0xc8;return function(_0x4e6ec1){if(_0x4e6ec1){return _0x1e8c28[_0xf6a2('0x1d')](_0x277a70)[_0xf6a2('0x1e')](_0x4e6ec1);}};}function respondWithFilteredResult(_0x5d66bb,_0x427f6b){return function(_0x5182e5){if(_0x5182e5){var _0x88534b=typeof _0x427f6b[_0xf6a2('0x1f')]===_0xf6a2('0x20')&&typeof _0x427f6b['limit']===_0xf6a2('0x20');var _0x4b7cd7=_0x5182e5[_0xf6a2('0x21')];var _0x2f85cf=_0x88534b?0x0:_0x427f6b[_0xf6a2('0x1f')];var _0x3ce86e=_0x88534b?_0x5182e5[_0xf6a2('0x21')]:_0x427f6b[_0xf6a2('0x1f')]+_0x427f6b[_0xf6a2('0x22')];var _0x27688a;if(_0x3ce86e>=_0x4b7cd7){_0x3ce86e=_0x4b7cd7;_0x27688a=0xc8;}else{_0x27688a=0xce;}_0x5d66bb[_0xf6a2('0x1d')](_0x27688a);return _0x5d66bb[_0xf6a2('0x23')]('Content-Range',_0x2f85cf+'-'+_0x3ce86e+'/'+_0x4b7cd7)[_0xf6a2('0x1e')](_0x5182e5);}return null;};}function patchUpdates(_0x27eafd){return function(_0x2e8eca){try{jsonpatch[_0xf6a2('0x24')](_0x2e8eca,_0x27eafd,!![]);}catch(_0x1506b7){return BPromise['reject'](_0x1506b7);}return _0x2e8eca[_0xf6a2('0x25')]();};}function saveUpdates(_0x58d2a1,_0x1bfad4){return function(_0x1f9650){if(_0x1f9650){return _0x1f9650[_0xf6a2('0x26')](_0x58d2a1)[_0xf6a2('0x27')](function(_0x1bf56d){return _0x1bf56d;});}return null;};}function removeEntity(_0x524464,_0x5d32ec){return function(_0x3edc5f){if(_0x3edc5f){return _0x3edc5f['destroy']()[_0xf6a2('0x27')](function(){var _0x4fbc42=_0x3edc5f['get']({'plain':!![]});var _0x22ea6f=_0xf6a2('0x28');return db[_0xf6a2('0x29')]['destroy']({'where':{'type':_0x22ea6f,'resourceId':_0x4fbc42['id']}})['then'](function(){return _0x3edc5f;});})[_0xf6a2('0x27')](function(){_0x524464[_0xf6a2('0x1d')](0xcc)[_0xf6a2('0x2a')]();});}};}function handleEntityNotFound(_0x25161e,_0x3f23d4){return function(_0x4a9e6b){if(!_0x4a9e6b){_0x25161e[_0xf6a2('0x1c')](0x194);}return _0x4a9e6b;};}function handleError(_0x56c2bd,_0x30f01c){_0x30f01c=_0x30f01c||0x1f4;return function(_0x20d47b){logger[_0xf6a2('0x2b')](_0x20d47b[_0xf6a2('0x2c')]);if(_0x20d47b[_0xf6a2('0x2d')]){delete _0x20d47b[_0xf6a2('0x2d')];}_0x56c2bd['status'](_0x30f01c)[_0xf6a2('0x2e')](_0x20d47b);};}exports['index']=function(_0x213133,_0x5109c9){var _0x1fc489={},_0x507eba={},_0x22ee9f={'count':0x0,'rows':[]};var _0x2c67e0=_['map'](db[_0xf6a2('0x2f')]['rawAttributes'],function(_0x3c959e){return{'name':_0x3c959e[_0xf6a2('0x30')],'type':_0x3c959e[_0xf6a2('0x31')][_0xf6a2('0x32')]};});_0x507eba[_0xf6a2('0x33')]=_['map'](_0x2c67e0,_0xf6a2('0x2d'));_0x507eba[_0xf6a2('0x34')]=_['keys'](_0x213133['query']);_0x507eba[_0xf6a2('0x35')]=_[_0xf6a2('0x36')](_0x507eba[_0xf6a2('0x33')],_0x507eba[_0xf6a2('0x34')]);_0x1fc489['attributes']=_[_0xf6a2('0x36')](_0x507eba['model'],qs[_0xf6a2('0x37')](_0x213133[_0xf6a2('0x34')][_0xf6a2('0x37')]));_0x1fc489[_0xf6a2('0x38')]=_0x1fc489[_0xf6a2('0x38')][_0xf6a2('0x39')]?_0x1fc489[_0xf6a2('0x38')]:_0x507eba[_0xf6a2('0x33')];if(!_0x213133[_0xf6a2('0x34')]['hasOwnProperty'](_0xf6a2('0x3a'))){_0x1fc489[_0xf6a2('0x22')]=qs[_0xf6a2('0x22')](_0x213133[_0xf6a2('0x34')]['limit']);_0x1fc489[_0xf6a2('0x1f')]=qs[_0xf6a2('0x1f')](_0x213133[_0xf6a2('0x34')]['offset']);}_0x1fc489[_0xf6a2('0x3b')]=qs[_0xf6a2('0x3c')](_0x213133[_0xf6a2('0x34')]['sort']);_0x1fc489[_0xf6a2('0x3d')]=qs[_0xf6a2('0x35')](_['pick'](_0x213133[_0xf6a2('0x34')],_0x507eba[_0xf6a2('0x35')]),_0x2c67e0);if(_0x213133[_0xf6a2('0x34')][_0xf6a2('0x3e')]){_0x1fc489['where']=_[_0xf6a2('0x3f')](_0x1fc489[_0xf6a2('0x3d')],{'$or':_[_0xf6a2('0x40')](_0x2c67e0,function(_0x5350fe){if(_0x5350fe['type']!==_0xf6a2('0x41')){var _0x1062ea={};_0x1062ea[_0x5350fe[_0xf6a2('0x2d')]]={'$like':'%'+_0x213133[_0xf6a2('0x34')][_0xf6a2('0x3e')]+'%'};return _0x1062ea;}})});}_0x1fc489=_[_0xf6a2('0x3f')]({},_0x1fc489,_0x213133[_0xf6a2('0x42')]);var _0x57a60e={'where':_0x1fc489[_0xf6a2('0x3d')]};return db['CmHopperAdditionalPhone']['count'](_0x57a60e)['then'](function(_0x416c97){_0x22ee9f[_0xf6a2('0x21')]=_0x416c97;if(_0x213133[_0xf6a2('0x34')][_0xf6a2('0x43')]){_0x1fc489[_0xf6a2('0x44')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0xf6a2('0x45')](_0x1fc489);})[_0xf6a2('0x27')](function(_0x5a1381){_0x22ee9f[_0xf6a2('0x46')]=_0x5a1381;return _0x22ee9f;})['then'](respondWithFilteredResult(_0x5109c9,_0x1fc489))[_0xf6a2('0x47')](handleError(_0x5109c9,null));};exports[_0xf6a2('0x48')]=function(_0x3dbbd2,_0x3ce189){var _0x4174ff={'raw':!![],'where':{'id':_0x3dbbd2[_0xf6a2('0x49')]['id']}},_0x84df42={};_0x84df42[_0xf6a2('0x33')]=_[_0xf6a2('0x4a')](db['CmHopperAdditionalPhone'][_0xf6a2('0x4b')]);_0x84df42['query']=_[_0xf6a2('0x4a')](_0x3dbbd2['query']);_0x84df42[_0xf6a2('0x35')]=_[_0xf6a2('0x36')](_0x84df42[_0xf6a2('0x33')],_0x84df42[_0xf6a2('0x34')]);_0x4174ff[_0xf6a2('0x38')]=_[_0xf6a2('0x36')](_0x84df42[_0xf6a2('0x33')],qs[_0xf6a2('0x37')](_0x3dbbd2['query'][_0xf6a2('0x37')]));_0x4174ff[_0xf6a2('0x38')]=_0x4174ff['attributes'][_0xf6a2('0x39')]?_0x4174ff['attributes']:_0x84df42['model'];if(_0x3dbbd2[_0xf6a2('0x34')][_0xf6a2('0x43')]){_0x4174ff[_0xf6a2('0x44')]=[{'all':!![]}];}_0x4174ff=_[_0xf6a2('0x3f')]({},_0x4174ff,_0x3dbbd2[_0xf6a2('0x42')]);return db[_0xf6a2('0x2f')][_0xf6a2('0x4c')](_0x4174ff)[_0xf6a2('0x27')](handleEntityNotFound(_0x3ce189,null))[_0xf6a2('0x27')](respondWithResult(_0x3ce189,null))['catch'](handleError(_0x3ce189,null));};exports['create']=function(_0x57aac3,_0x3dde32){return db[_0xf6a2('0x2f')]['create'](_0x57aac3[_0xf6a2('0x4d')],{})[_0xf6a2('0x27')](function(_0x52534d){var _0x11b7de=_0x57aac3[_0xf6a2('0x4e')][_0xf6a2('0x4f')]({'plain':!![]});if(!_0x11b7de)throw new Error(_0xf6a2('0x50'));if(_0x11b7de[_0xf6a2('0x51')]===_0xf6a2('0x4e')){var _0x12ca85=_0x52534d[_0xf6a2('0x4f')]({'plain':!![]});var _0x423f46=_0xf6a2('0x28');return db['UserProfileSection'][_0xf6a2('0x4c')]({'where':{'name':_0x423f46,'userProfileId':_0x11b7de['userProfileId']},'raw':!![]})[_0xf6a2('0x27')](function(_0x219826){if(_0x219826&&_0x219826[_0xf6a2('0x52')]===0x0){return db[_0xf6a2('0x29')][_0xf6a2('0x53')]({'name':_0x12ca85[_0xf6a2('0x2d')],'resourceId':_0x12ca85['id'],'type':_0x219826[_0xf6a2('0x2d')],'sectionId':_0x219826['id']},{})[_0xf6a2('0x27')](function(){return _0x52534d;});}else{return _0x52534d;}})[_0xf6a2('0x47')](function(_0x3b0c16){logger[_0xf6a2('0x2b')](_0xf6a2('0x54'),_0x3b0c16);throw _0x3b0c16;});}return _0x52534d;})[_0xf6a2('0x27')](respondWithResult(_0x3dde32,0xc9))[_0xf6a2('0x47')](handleError(_0x3dde32,null));};exports[_0xf6a2('0x26')]=function(_0x3020ab,_0xd18172){if(_0x3020ab[_0xf6a2('0x4d')]['id']){delete _0x3020ab[_0xf6a2('0x4d')]['id'];}return db[_0xf6a2('0x2f')][_0xf6a2('0x4c')]({'where':{'id':_0x3020ab['params']['id']}})[_0xf6a2('0x27')](handleEntityNotFound(_0xd18172,null))[_0xf6a2('0x27')](saveUpdates(_0x3020ab[_0xf6a2('0x4d')],null))[_0xf6a2('0x27')](respondWithResult(_0xd18172,null))[_0xf6a2('0x47')](handleError(_0xd18172,null));};exports[_0xf6a2('0x55')]=function(_0x2bd33f,_0x1e1ec2){return db[_0xf6a2('0x2f')]['find']({'where':{'id':_0x2bd33f['params']['id']}})['then'](handleEntityNotFound(_0x1e1ec2,null))[_0xf6a2('0x27')](removeEntity(_0x1e1ec2,null))[_0xf6a2('0x47')](handleError(_0x1e1ec2,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 5dc1667..d1e92e5 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 _0x5341=['bluebird','request-promise','path','../../config/environment','exports','define','CmHopperAdditionalPhone','lodash','util','../../config/logger','api','moment'];(function(_0x5938bd,_0x28b89d){var _0x3fc973=function(_0x361ccc){while(--_0x361ccc){_0x5938bd['push'](_0x5938bd['shift']());}};_0x3fc973(++_0x28b89d);}(_0x5341,0xbb));var _0x1534=function(_0x46a13a,_0x56e2d9){_0x46a13a=_0x46a13a-0x0;var _0x58b6e2=_0x5341[_0x46a13a];return _0x58b6e2;};'use strict';var _=require(_0x1534('0x0'));var util=require(_0x1534('0x1'));var logger=require(_0x1534('0x2'))(_0x1534('0x3'));var moment=require(_0x1534('0x4'));var BPromise=require(_0x1534('0x5'));var rp=require(_0x1534('0x6'));var fs=require('fs');var path=require(_0x1534('0x7'));var rimraf=require('rimraf');var config=require(_0x1534('0x8'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x1534('0x9')]=function(_0x3defe5,_0x6b465a){return _0x3defe5[_0x1534('0xa')](_0x1534('0xb'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88eb=['request-promise','path','rimraf','../../config/environment','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x88eb,0x19e));var _0xb88e=function(_0x3102af,_0x137b65){_0x3102af=_0x3102af-0x0;var _0x3c208c=_0x88eb[_0x3102af];return _0x3c208c;};'use strict';var _=require(_0xb88e('0x0'));var util=require(_0xb88e('0x1'));var logger=require(_0xb88e('0x2'))(_0xb88e('0x3'));var moment=require(_0xb88e('0x4'));var BPromise=require(_0xb88e('0x5'));var rp=require(_0xb88e('0x6'));var fs=require('fs');var path=require(_0xb88e('0x7'));var rimraf=require(_0xb88e('0x8'));var config=require(_0xb88e('0x9'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xb88e('0xa')]=function(_0x35f000,_0x495f54){return _0x35f000[_0xb88e('0xb')](_0xb88e('0xc'),attributes,{'tableName':_0xb88e('0xd'),'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 291e1a7..ce523f8 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 _0x2867=['CampaignId','duration','waitTime','scheduledat','add','minutes','isNil','phone','countcongestionretry','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','OrderBy','ASC','countbusyretry','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','countnosuchnumberretry','countabandonedretry'];(function(_0x29933d,_0x2969c7){var _0x21c910=function(_0x2c625b){while(--_0x2c625b){_0x29933d['push'](_0x29933d['shift']());}};_0x21c910(++_0x2969c7);}(_0x2867,0xc5));var _0x7286=function(_0x2c574e,_0x491053){_0x2c574e=_0x2c574e-0x0;var _0x1101f7=_0x2867[_0x2c574e];return _0x1101f7;};'use strict';var _=require(_0x7286('0x0'));var util=require(_0x7286('0x1'));var moment=require('moment');var BPromise=require(_0x7286('0x2'));var rs=require(_0x7286('0x3'));var fs=require('fs');var Redis=require(_0x7286('0x4'));var db=require(_0x7286('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7286('0x6'))(_0x7286('0x7'));var config=require(_0x7286('0x8'));var jayson=require(_0x7286('0x9'));var client=jayson[_0x7286('0xa')][_0x7286('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54c588,_0x1eb1ce,_0x4c1dcb){return new BPromise(function(_0xfd5ebc,_0x3b8f82){return client[_0x7286('0xc')](_0x54c588,_0x4c1dcb)[_0x7286('0xd')](function(_0x4e7b27){logger[_0x7286('0xe')](_0x7286('0xf'),_0x1eb1ce,_0x7286('0x10'));logger[_0x7286('0x11')](_0x7286('0x12'),_0x1eb1ce,_0x7286('0x10'),JSON[_0x7286('0x13')](_0x4e7b27));if(_0x4e7b27['error']){if(_0x4e7b27['error'][_0x7286('0x14')]===0x1f4){logger[_0x7286('0x15')](_0x7286('0xf'),_0x1eb1ce,_0x4e7b27[_0x7286('0x15')]['message']);return _0x3b8f82(_0x4e7b27[_0x7286('0x15')][_0x7286('0x16')]);}logger['error'](_0x7286('0xf'),_0x1eb1ce,_0x4e7b27['error'][_0x7286('0x16')]);return _0xfd5ebc(_0x4e7b27[_0x7286('0x15')]['message']);}else{logger[_0x7286('0xe')](_0x7286('0xf'),_0x1eb1ce,'request\x20sent');_0xfd5ebc(_0x4e7b27['result']['message']);}})[_0x7286('0x17')](function(_0x3017eb){logger['error'](_0x7286('0xf'),_0x1eb1ce,_0x3017eb);_0x3b8f82(_0x3017eb);});});}exports[_0x7286('0x18')]=function(_0x1c759e){var _0x5142a5=this;return new Promise(function(_0x508fd9,_0x22841b){return db[_0x7286('0x19')][_0x7286('0x1a')]({'raw':!![],'where':{'ContactId':_0x1c759e[_0x7286('0x1b')][_0x7286('0x1c')],'ListId':_0x1c759e['body'][_0x7286('0x1d')],'VoiceQueueId':_0x1c759e[_0x7286('0x1b')]['VoiceQueueId']===undefined?null:_0x1c759e[_0x7286('0x1b')][_0x7286('0x1e')],'CampaignId':_0x1c759e[_0x7286('0x1b')]['CampaignId']===undefined?null:_0x1c759e[_0x7286('0x1b')]['CampaignId']}})[_0x7286('0xd')](function(_0x45f355){if(_0x45f355!=null){return db['CmHopperAdditionalPhone'][_0x7286('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x45f355['id'],'OrderBy':{'$gt':_0x45f355['OrderBy']}},'order':[[_0x7286('0x1f'),_0x7286('0x20')]]})['then'](function(_0x24807c){var _0xc4a334=0x0;if(_0x24807c){if(_0x24807c[_0x7286('0x21')]+_0x24807c['countcongestionretry']+_0x24807c[_0x7286('0x22')]+_0x24807c['countnosuchnumberretry']+_0x24807c[_0x7286('0x23')]+_0x24807c['countabandonedretry']+_0x24807c[_0x7286('0x24')]+_0x24807c[_0x7286('0x25')]<_0x1c759e[_0x7286('0x26')][_0x7286('0x27')])_0xc4a334=0x1;_0x508fd9({'additional':_0xc4a334});}else{return db[_0x7286('0x28')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x45f355['id']},'order':[['OrderBy',_0x7286('0x20')]]})['then'](function(_0x3e868f){var _0x31fcb7=0x0;if(_0x3e868f){if(_0x3e868f[_0x7286('0x21')]+_0x3e868f['countcongestionretry']+_0x3e868f[_0x7286('0x22')]+_0x3e868f[_0x7286('0x29')]+_0x3e868f[_0x7286('0x23')]+_0x3e868f[_0x7286('0x2a')]+_0x3e868f[_0x7286('0x24')]+_0x3e868f['countagentrejectretry']<_0x1c759e[_0x7286('0x26')][_0x7286('0x27')])_0x31fcb7=0x1;_0x508fd9({'additional':_0x31fcb7});}else{_0x508fd9({'additional':0x0});}})[_0x7286('0x17')](function(_0x48c414){logger[_0x7286('0x15')](_0x7286('0x18'),_0x48c414[_0x7286('0x16')]);_0x22841b(_0x5142a5['error'](0x1f4,_0x48c414['message']));});}})[_0x7286('0x17')](function(_0x1b50c2){logger[_0x7286('0x15')](_0x7286('0x18'),_0x1b50c2[_0x7286('0x16')]);_0x22841b(_0x5142a5[_0x7286('0x15')](0x1f4,_0x1b50c2[_0x7286('0x16')]));});}else _0x508fd9({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x56a499){var _0x4a797f=this;return new Promise(function(_0x4b3749,_0x55cbeb){return db[_0x7286('0x19')][_0x7286('0x1a')]({'raw':!![],'where':{'ContactId':_0x56a499[_0x7286('0x1b')][_0x7286('0x1c')],'ListId':_0x56a499[_0x7286('0x1b')][_0x7286('0x1d')],'VoiceQueueId':_0x56a499[_0x7286('0x1b')][_0x7286('0x1e')]===undefined?null:_0x56a499['body'][_0x7286('0x1e')],'CampaignId':_0x56a499[_0x7286('0x1b')][_0x7286('0x2b')]===undefined?null:_0x56a499[_0x7286('0x1b')][_0x7286('0x2b')]}})[_0x7286('0xd')](function(_0xb8eff5){if(_0xb8eff5!=null){return db[_0x7286('0x28')][_0x7286('0x1a')]({'raw':!![],'where':{'CmHopperId':_0xb8eff5['id'],'OrderBy':{'$gte':_0xb8eff5[_0x7286('0x1f')]}},'order':[[_0x7286('0x1f'),_0x7286('0x20')]]})[_0x7286('0xd')](function(_0x516747){if(_0x516747)return activateAdditionalPhone(_0xb8eff5,_0x56a499[_0x7286('0x1b')],_0x516747,_0x56a499[_0x7286('0x2c')],_0x56a499['waitTime'])[_0x7286('0xd')](function(_0x139d06){_0x4b3749(_0x139d06);});else{return db[_0x7286('0x28')][_0x7286('0x1a')]({'raw':!![],'where':{'CmHopperId':_0xb8eff5['id']},'order':[['OrderBy',_0x7286('0x20')]]})['then'](function(_0x57065a){if(_0x57065a)return activateAdditionalPhone(_0xb8eff5,_0x56a499['body'],_0x57065a,_0x56a499['duration'],_0x56a499[_0x7286('0x2d')])[_0x7286('0xd')](function(_0x3f6170){_0x4b3749(_0x3f6170);});else{_0x4b3749({'id':_0xb8eff5['id'],'phone':''});}})['catch'](function(_0x848900){logger[_0x7286('0x15')](_0x7286('0x18'),_0x848900[_0x7286('0x16')]);_0x55cbeb(_0x4a797f[_0x7286('0x15')](0x1f4,_0x848900['message']));});}})['catch'](function(_0x4db93d){logger[_0x7286('0x15')](_0x7286('0x18'),_0x4db93d['message']);_0x55cbeb(_0x4a797f['error'](0x1f4,_0x4db93d[_0x7286('0x16')]));});}else _0x4b3749(0x1);});});};function activateAdditionalPhone(_0x717f7f,_0x210e0d,_0x47670f,_0x527a99,_0x3e1a97){return new Promise(function(_0x461a7d,_0x2691a7){var _0x324ba5;if(_['isNil'](_0x47670f[_0x7286('0x2e')])){_0x47670f[_0x7286('0x2e')]=moment();}if(moment()>moment(_0x47670f[_0x7286('0x2e')])){_0x324ba5=moment()[_0x7286('0x2f')](_0x3e1a97||0x3,_0x7286('0x30'));}else{if(_0x47670f[_0x7286('0x1f')]==0x0){_0x324ba5=moment(_0x47670f[_0x7286('0x2e')]);}else{_0x324ba5=moment()['add'](_0x3e1a97||0x3,_0x7286('0x30'));}}if(_[_0x7286('0x31')](_0x324ba5)){_0x324ba5=moment()['add'](_0x3e1a97||0x3,_0x7286('0x30'));}var _0x51d4f4={'phone':_0x717f7f[_0x7286('0x32')],'active':0x0,'OrderBy':_[_0x7286('0x31')](_0x717f7f[_0x7286('0x1f')])?0x0:_0x717f7f[_0x7286('0x1f')],'scheduledat':moment()[_0x7286('0x2f')](_0x527a99||0x1,'minutes'),'countbusyretry':_0x210e0d[_0x7286('0x21')],'countcongestionretry':_0x210e0d[_0x7286('0x33')],'countnoanswerretry':_0x210e0d['countnoanswerretry'],'countnosuchnumberretry':_0x210e0d[_0x7286('0x29')],'countdropretry':_0x210e0d[_0x7286('0x23')],'countabandonedretry':_0x210e0d[_0x7286('0x2a')],'countmachineretry':_0x210e0d[_0x7286('0x24')],'countagentrejectretry':_0x210e0d[_0x7286('0x25')],'createdAt':_0x210e0d[_0x7286('0x34')],'updatedAt':_0x210e0d[_0x7286('0x35')]};var _0x1d133c={'CmHopperId':_0x717f7f['id'],'phone':_0x47670f[_0x7286('0x32')],'active':0x0,'OrderBy':_[_0x7286('0x31')](_0x47670f[_0x7286('0x1f')])?0x0:_0x47670f[_0x7286('0x1f')],'scheduledat':_0x324ba5,'countbusyretry':_0x47670f[_0x7286('0x21')],'countcongestionretry':_0x47670f[_0x7286('0x33')],'countnoanswerretry':_0x47670f[_0x7286('0x22')],'countnosuchnumberretry':_0x47670f[_0x7286('0x29')],'countdropretry':_0x47670f['countdropretry'],'countabandonedretry':_0x47670f['countabandonedretry'],'countmachineretry':_0x47670f[_0x7286('0x24')],'countagentrejectretry':_0x47670f[_0x7286('0x25')],'createdAt':_0x47670f[_0x7286('0x34')],'updatedAt':_0x47670f[_0x7286('0x35')]};return db[_0x7286('0x36')][_0x7286('0x37')](function(_0x5cbc8a){return db[_0x7286('0x28')][_0x7286('0x38')](_0x51d4f4,{'where':{'id':_0x47670f['id']}},{'transaction':_0x5cbc8a})[_0x7286('0xd')](function(){return db[_0x7286('0x19')][_0x7286('0x38')](_0x1d133c,{'where':{'id':_0x717f7f['id']}},{'transaction':_0x5cbc8a});});})['then'](function(_0x14017d){_0x461a7d({'id':_0x717f7f['id'],'phone':_0x47670f[_0x7286('0x32')]});})['catch'](function(_0x5f45dd){logger[_0x7286('0x15')](_0x7286('0x39'),_0x5f45dd['message']);_0x2691a7({'error':_0x5f45dd[_0x7286('0x16')]});});});}exports['IncrementPreviewCounters']=function(_0x209d75){var _0x2cfbb0=this;return new Promise(function(_0x31f445,_0x64702c){return db[_0x7286('0x19')]['update'](_0x209d75['body'][_0x7286('0x3a')],{'where':{'id':_0x209d75[_0x7286('0x1b')]['id']}})[_0x7286('0xd')](function(_0x456552){_0x31f445(_0x456552);})[_0x7286('0x17')](function(_0xd179b2){logger[_0x7286('0x15')](_0x7286('0x3b'),_0xd179b2['message']);_0x64702c(_0x2cfbb0[_0x7286('0x15')](0x1f4,_0xd179b2[_0x7286('0x16')]));});});}; \ No newline at end of file +var _0xfcb9=['countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','countdropretry','countagentrejectretry','CmHopper','ListId','duration','waitTime','isNil','scheduledat','add','minutes','phone','updatedAt','createdAt','transaction','IncrementPreviewCounters','lodash','util','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','VerifyAdditionalPhones','findOne','ContactId','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xfcb9,0x188));var _0x9fcb=function(_0x5e4c4c,_0x1ad1dc){_0x5e4c4c=_0x5e4c4c-0x0;var _0x51762c=_0xfcb9[_0x5e4c4c];return _0x51762c;};'use strict';var _=require(_0x9fcb('0x0'));var util=require(_0x9fcb('0x1'));var moment=require('moment');var BPromise=require(_0x9fcb('0x2'));var rs=require(_0x9fcb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9fcb('0x4'))(_0x9fcb('0x5'));var config=require('../../config/environment');var jayson=require(_0x9fcb('0x6'));var client=jayson[_0x9fcb('0x7')][_0x9fcb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe05772,_0x4db54f,_0x5bec97){return new BPromise(function(_0x370d69,_0x43fd3d){return client[_0x9fcb('0x9')](_0xe05772,_0x5bec97)[_0x9fcb('0xa')](function(_0x8e6b68){logger[_0x9fcb('0xb')](_0x9fcb('0xc'),_0x4db54f,'request\x20sent');logger[_0x9fcb('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x4db54f,_0x9fcb('0xe'),JSON[_0x9fcb('0xf')](_0x8e6b68));if(_0x8e6b68['error']){if(_0x8e6b68[_0x9fcb('0x10')][_0x9fcb('0x11')]===0x1f4){logger[_0x9fcb('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4db54f,_0x8e6b68[_0x9fcb('0x10')][_0x9fcb('0x12')]);return _0x43fd3d(_0x8e6b68[_0x9fcb('0x10')]['message']);}logger[_0x9fcb('0x10')](_0x9fcb('0xc'),_0x4db54f,_0x8e6b68[_0x9fcb('0x10')][_0x9fcb('0x12')]);return _0x370d69(_0x8e6b68[_0x9fcb('0x10')][_0x9fcb('0x12')]);}else{logger[_0x9fcb('0xb')](_0x9fcb('0xc'),_0x4db54f,_0x9fcb('0xe'));_0x370d69(_0x8e6b68[_0x9fcb('0x13')][_0x9fcb('0x12')]);}})[_0x9fcb('0x14')](function(_0x366184){logger[_0x9fcb('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4db54f,_0x366184);_0x43fd3d(_0x366184);});});}exports[_0x9fcb('0x15')]=function(_0x569cdd){var _0x140b00=this;return new Promise(function(_0xd9ddbd,_0x4440c0){return db['CmHopper'][_0x9fcb('0x16')]({'raw':!![],'where':{'ContactId':_0x569cdd['body'][_0x9fcb('0x17')],'ListId':_0x569cdd[_0x9fcb('0x18')]['ListId'],'VoiceQueueId':_0x569cdd[_0x9fcb('0x18')][_0x9fcb('0x19')]===undefined?null:_0x569cdd[_0x9fcb('0x18')][_0x9fcb('0x19')],'CampaignId':_0x569cdd[_0x9fcb('0x18')][_0x9fcb('0x1a')]===undefined?null:_0x569cdd['body'][_0x9fcb('0x1a')]}})[_0x9fcb('0xa')](function(_0x282eae){if(_0x282eae!=null){return db[_0x9fcb('0x1b')][_0x9fcb('0x16')]({'raw':!![],'where':{'CmHopperId':_0x282eae['id'],'OrderBy':{'$gt':_0x282eae[_0x9fcb('0x1c')]}},'order':[[_0x9fcb('0x1c'),_0x9fcb('0x1d')]]})['then'](function(_0x34cd82){var _0x14e1b4=0x0;if(_0x34cd82){if(_0x34cd82[_0x9fcb('0x1e')]+_0x34cd82[_0x9fcb('0x1f')]+_0x34cd82[_0x9fcb('0x20')]+_0x34cd82[_0x9fcb('0x21')]+_0x34cd82['countdropretry']+_0x34cd82[_0x9fcb('0x22')]+_0x34cd82[_0x9fcb('0x23')]+_0x34cd82['countagentrejectretry']<_0x569cdd[_0x9fcb('0x24')][_0x9fcb('0x25')])_0x14e1b4=0x1;_0xd9ddbd({'additional':_0x14e1b4});}else{return db[_0x9fcb('0x1b')][_0x9fcb('0x16')]({'raw':!![],'where':{'CmHopperId':_0x282eae['id']},'order':[[_0x9fcb('0x1c'),_0x9fcb('0x1d')]]})[_0x9fcb('0xa')](function(_0x164d61){var _0x272d91=0x0;if(_0x164d61){if(_0x164d61[_0x9fcb('0x1e')]+_0x164d61[_0x9fcb('0x1f')]+_0x164d61[_0x9fcb('0x20')]+_0x164d61[_0x9fcb('0x21')]+_0x164d61[_0x9fcb('0x26')]+_0x164d61[_0x9fcb('0x22')]+_0x164d61[_0x9fcb('0x23')]+_0x164d61[_0x9fcb('0x27')]<_0x569cdd[_0x9fcb('0x24')][_0x9fcb('0x25')])_0x272d91=0x1;_0xd9ddbd({'additional':_0x272d91});}else{_0xd9ddbd({'additional':0x0});}})[_0x9fcb('0x14')](function(_0x5bcc33){logger[_0x9fcb('0x10')](_0x9fcb('0x15'),_0x5bcc33[_0x9fcb('0x12')]);_0x4440c0(_0x140b00[_0x9fcb('0x10')](0x1f4,_0x5bcc33[_0x9fcb('0x12')]));});}})[_0x9fcb('0x14')](function(_0x30ea0d){logger[_0x9fcb('0x10')](_0x9fcb('0x15'),_0x30ea0d[_0x9fcb('0x12')]);_0x4440c0(_0x140b00[_0x9fcb('0x10')](0x1f4,_0x30ea0d['message']));});}else _0xd9ddbd({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x2410d9){var _0x2fc705=this;return new Promise(function(_0x8e2e1f,_0x30a31d){return db[_0x9fcb('0x28')]['findOne']({'raw':!![],'where':{'ContactId':_0x2410d9[_0x9fcb('0x18')][_0x9fcb('0x17')],'ListId':_0x2410d9[_0x9fcb('0x18')][_0x9fcb('0x29')],'VoiceQueueId':_0x2410d9[_0x9fcb('0x18')][_0x9fcb('0x19')]===undefined?null:_0x2410d9['body'][_0x9fcb('0x19')],'CampaignId':_0x2410d9['body']['CampaignId']===undefined?null:_0x2410d9['body'][_0x9fcb('0x1a')]}})['then'](function(_0x1806df){if(_0x1806df!=null){return db[_0x9fcb('0x1b')][_0x9fcb('0x16')]({'raw':!![],'where':{'CmHopperId':_0x1806df['id'],'OrderBy':{'$gte':_0x1806df[_0x9fcb('0x1c')]}},'order':[[_0x9fcb('0x1c'),_0x9fcb('0x1d')]]})[_0x9fcb('0xa')](function(_0x151ed5){if(_0x151ed5)return activateAdditionalPhone(_0x1806df,_0x2410d9['body'],_0x151ed5,_0x2410d9[_0x9fcb('0x2a')],_0x2410d9[_0x9fcb('0x2b')])[_0x9fcb('0xa')](function(_0x248a43){_0x8e2e1f(_0x248a43);});else{return db[_0x9fcb('0x1b')][_0x9fcb('0x16')]({'raw':!![],'where':{'CmHopperId':_0x1806df['id']},'order':[[_0x9fcb('0x1c'),_0x9fcb('0x1d')]]})['then'](function(_0x2f0407){if(_0x2f0407)return activateAdditionalPhone(_0x1806df,_0x2410d9[_0x9fcb('0x18')],_0x2f0407,_0x2410d9['duration'],_0x2410d9[_0x9fcb('0x2b')])[_0x9fcb('0xa')](function(_0x1264a6){_0x8e2e1f(_0x1264a6);});else{_0x8e2e1f({'id':_0x1806df['id'],'phone':''});}})[_0x9fcb('0x14')](function(_0x431076){logger[_0x9fcb('0x10')](_0x9fcb('0x15'),_0x431076[_0x9fcb('0x12')]);_0x30a31d(_0x2fc705['error'](0x1f4,_0x431076[_0x9fcb('0x12')]));});}})['catch'](function(_0x2b169e){logger[_0x9fcb('0x10')](_0x9fcb('0x15'),_0x2b169e[_0x9fcb('0x12')]);_0x30a31d(_0x2fc705[_0x9fcb('0x10')](0x1f4,_0x2b169e[_0x9fcb('0x12')]));});}else _0x8e2e1f(0x1);});});};function activateAdditionalPhone(_0x2f88df,_0x2381de,_0x2862c9,_0x2defe3,_0xc76f4d){return new Promise(function(_0x3d68cd,_0x41a23c){var _0x5f07d4;if(_[_0x9fcb('0x2c')](_0x2862c9[_0x9fcb('0x2d')])){_0x2862c9[_0x9fcb('0x2d')]=moment();}if(moment()>moment(_0x2862c9[_0x9fcb('0x2d')])){_0x5f07d4=moment()[_0x9fcb('0x2e')](_0xc76f4d||0x3,_0x9fcb('0x2f'));}else{if(_0x2862c9[_0x9fcb('0x1c')]==0x0){_0x5f07d4=moment(_0x2862c9[_0x9fcb('0x2d')]);}else{_0x5f07d4=moment()[_0x9fcb('0x2e')](_0xc76f4d||0x3,'minutes');}}if(_['isNil'](_0x5f07d4)){_0x5f07d4=moment()['add'](_0xc76f4d||0x3,_0x9fcb('0x2f'));}var _0x37e0a7={'phone':_0x2f88df[_0x9fcb('0x30')],'active':0x0,'OrderBy':_['isNil'](_0x2f88df[_0x9fcb('0x1c')])?0x0:_0x2f88df['OrderBy'],'scheduledat':moment()['add'](_0x2defe3||0x1,_0x9fcb('0x2f')),'countbusyretry':_0x2381de[_0x9fcb('0x1e')],'countcongestionretry':_0x2381de[_0x9fcb('0x1f')],'countnoanswerretry':_0x2381de[_0x9fcb('0x20')],'countnosuchnumberretry':_0x2381de['countnosuchnumberretry'],'countdropretry':_0x2381de[_0x9fcb('0x26')],'countabandonedretry':_0x2381de[_0x9fcb('0x22')],'countmachineretry':_0x2381de[_0x9fcb('0x23')],'countagentrejectretry':_0x2381de['countagentrejectretry'],'createdAt':_0x2381de['createdAt'],'updatedAt':_0x2381de[_0x9fcb('0x31')]};var _0x11699e={'CmHopperId':_0x2f88df['id'],'phone':_0x2862c9['phone'],'active':0x0,'OrderBy':_[_0x9fcb('0x2c')](_0x2862c9[_0x9fcb('0x1c')])?0x0:_0x2862c9[_0x9fcb('0x1c')],'scheduledat':_0x5f07d4,'countbusyretry':_0x2862c9['countbusyretry'],'countcongestionretry':_0x2862c9[_0x9fcb('0x1f')],'countnoanswerretry':_0x2862c9[_0x9fcb('0x20')],'countnosuchnumberretry':_0x2862c9[_0x9fcb('0x21')],'countdropretry':_0x2862c9['countdropretry'],'countabandonedretry':_0x2862c9[_0x9fcb('0x22')],'countmachineretry':_0x2862c9[_0x9fcb('0x23')],'countagentrejectretry':_0x2862c9[_0x9fcb('0x27')],'createdAt':_0x2862c9[_0x9fcb('0x32')],'updatedAt':_0x2862c9['updatedAt']};return db['sequelize'][_0x9fcb('0x33')](function(_0x12fd6e){return db['CmHopperAdditionalPhone']['update'](_0x37e0a7,{'where':{'id':_0x2862c9['id']}},{'transaction':_0x12fd6e})[_0x9fcb('0xa')](function(){return db[_0x9fcb('0x28')]['update'](_0x11699e,{'where':{'id':_0x2f88df['id']}},{'transaction':_0x12fd6e});});})[_0x9fcb('0xa')](function(_0x39e0f8){_0x3d68cd({'id':_0x2f88df['id'],'phone':_0x2862c9[_0x9fcb('0x30')]});})['catch'](function(_0x462af2){logger[_0x9fcb('0x10')]('activateAdditionalPhone',_0x462af2[_0x9fcb('0x12')]);_0x41a23c({'error':_0x462af2[_0x9fcb('0x12')]});});});}exports['IncrementPreviewCounters']=function(_0x400332){var _0xd15dd9=this;return new Promise(function(_0xd382bc,_0x117fb7){return db['CmHopper']['update'](_0x400332[_0x9fcb('0x18')]['field'],{'where':{'id':_0x400332[_0x9fcb('0x18')]['id']}})[_0x9fcb('0xa')](function(_0x331c07){_0xd382bc(_0x331c07);})[_0x9fcb('0x14')](function(_0x4ad8c2){logger[_0x9fcb('0x10')](_0x9fcb('0x34'),_0x4ad8c2[_0x9fcb('0x12')]);_0x117fb7(_0xd15dd9[_0x9fcb('0x10')](0x1f4,_0x4ad8c2[_0x9fcb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 77dcc36..a53ef54 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 _0x8c2d=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmHopperAdditionalPhone.controller','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x214168,_0x3c8ca7){var _0x3af9d5=function(_0x58130e){while(--_0x58130e){_0x214168['push'](_0x214168['shift']());}};_0x3af9d5(++_0x3c8ca7);}(_0x8c2d,0x1cb));var _0xd8c2=function(_0x71ae3c,_0x49c7a8){_0x71ae3c=_0x71ae3c-0x0;var _0x267933=_0x8c2d[_0x71ae3c];return _0x267933;};'use strict';var multer=require(_0xd8c2('0x0'));var util=require(_0xd8c2('0x1'));var path=require(_0xd8c2('0x2'));var timeout=require(_0xd8c2('0x3'));var express=require(_0xd8c2('0x4'));var router=express[_0xd8c2('0x5')]();var fs_extra=require(_0xd8c2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd8c2('0x7'));var config=require('../../config/environment');var controller=require(_0xd8c2('0x8'));router['get']('/',auth[_0xd8c2('0x9')](),controller[_0xd8c2('0xa')]);router['get'](_0xd8c2('0xb'),auth['isAuthenticated'](),controller[_0xd8c2('0xc')]);router[_0xd8c2('0xd')]('/',auth['isAuthenticated'](),controller[_0xd8c2('0xe')]);router[_0xd8c2('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd8c2('0x10')](_0xd8c2('0xb'),auth[_0xd8c2('0x9')](),controller[_0xd8c2('0x11')]);module[_0xd8c2('0x12')]=router; \ No newline at end of file +var _0xaea2=['multer','util','path','connect-timeout','express','Router','fs-extra','get','isAuthenticated','/:id','show','post','put','update','destroy'];(function(_0x41be01,_0x42cccb){var _0x54a601=function(_0x5f07a4){while(--_0x5f07a4){_0x41be01['push'](_0x41be01['shift']());}};_0x54a601(++_0x42cccb);}(_0xaea2,0x12c));var _0x2aea=function(_0x2e6c8d,_0x17c7ef){_0x2e6c8d=_0x2e6c8d-0x0;var _0x259c0f=_0xaea2[_0x2e6c8d];return _0x259c0f;};'use strict';var multer=require(_0x2aea('0x0'));var util=require(_0x2aea('0x1'));var path=require(_0x2aea('0x2'));var timeout=require(_0x2aea('0x3'));var express=require(_0x2aea('0x4'));var router=express[_0x2aea('0x5')]();var fs_extra=require(_0x2aea('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router[_0x2aea('0x7')]('/',auth[_0x2aea('0x8')](),controller['index']);router[_0x2aea('0x7')](_0x2aea('0x9'),auth[_0x2aea('0x8')](),controller[_0x2aea('0xa')]);router[_0x2aea('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2aea('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x2aea('0xd')]);router['delete'](_0x2aea('0x9'),auth['isAuthenticated'](),controller[_0x2aea('0xe')]);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 f5bb5aa..c5ad461 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 _0xbccd=['moment','STRING','INTEGER','contactListQueue'];(function(_0xc7348b,_0x145880){var _0x307cec=function(_0x4f1554){while(--_0x4f1554){_0xc7348b['push'](_0xc7348b['shift']());}};_0x307cec(++_0x145880);}(_0xbccd,0x1b0));var _0xdbcc=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xbccd[_0x5f09c5];return _0x426ad9;};'use strict';var moment=require(_0xdbcc('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xdbcc('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xdbcc('0x2')],'unique':_0xdbcc('0x3')},'ListId':{'type':Sequelize[_0xdbcc('0x2')],'unique':_0xdbcc('0x3')},'VoiceQueueId':{'type':Sequelize[_0xdbcc('0x2')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0xea2f=['exports','STRING','contactListQueue','INTEGER','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xea2f,0x6d));var _0xfea2=function(_0x3c40a4,_0x224321){_0x3c40a4=_0x3c40a4-0x0;var _0x150601=_0xea2f[_0x3c40a4];return _0x150601;};'use strict';var moment=require(_0xfea2('0x0'));var Sequelize=require('sequelize');module[_0xfea2('0x1')]={'phone':{'type':Sequelize[_0xfea2('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xfea2('0x3')},'ListId':{'type':Sequelize[_0xfea2('0x4')],'unique':_0xfea2('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index aed0aa8..5422ab5 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 _0xc00b=['count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','CmHopperBlack','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','rows','show','rawAttributes','find','body','params','catch','destroy','describe','eml-format','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3954c8,_0x53cf4e){var _0x5e76ca=function(_0x3c9336){while(--_0x3c9336){_0x3954c8['push'](_0x3954c8['shift']());}};_0x5e76ca(++_0x53cf4e);}(_0xc00b,0x1e5));var _0xbc00=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xc00b[_0x1c8c28];return _0x1f59b4;};'use strict';var emlformat=require(_0xbc00('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbc00('0x1'));var moment=require('moment');var BPromise=require(_0xbc00('0x2'));var Mustache=require(_0xbc00('0x3'));var util=require(_0xbc00('0x4'));var path=require(_0xbc00('0x5'));var sox=require('sox');var csv=require(_0xbc00('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc00('0x7'));var _=require('lodash');var squel=require(_0xbc00('0x8'));var crypto=require(_0xbc00('0x9'));var jsforce=require(_0xbc00('0xa'));var deskjs=require(_0xbc00('0xb'));var toCsv=require(_0xbc00('0x6'));var querystring=require(_0xbc00('0xc'));var Papa=require('papaparse');var Redis=require(_0xbc00('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xbc00('0xe'));var as=require(_0xbc00('0xf'));var hardwareService=require(_0xbc00('0x10'));var logger=require('../../config/logger')(_0xbc00('0x11'));var utils=require('../../config/utils');var config=require(_0xbc00('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xbc00('0x13'))['db'];function respondWithStatusCode(_0x248684,_0x12cd59){_0x12cd59=_0x12cd59||0xcc;return function(_0x4aabba){if(_0x4aabba){return _0x248684[_0xbc00('0x14')](_0x12cd59);}return _0x248684[_0xbc00('0x15')](_0x12cd59)[_0xbc00('0x16')]();};}function respondWithResult(_0x55f770,_0xfcc4d2){_0xfcc4d2=_0xfcc4d2||0xc8;return function(_0xd05e85){if(_0xd05e85){return _0x55f770['status'](_0xfcc4d2)[_0xbc00('0x17')](_0xd05e85);}};}function respondWithFilteredResult(_0x3eb532,_0x3d6773){return function(_0x3d9659){if(_0x3d9659){var _0x46ae64=typeof _0x3d6773[_0xbc00('0x18')]===_0xbc00('0x19')&&typeof _0x3d6773['limit']==='undefined';var _0x53b0cd=_0x3d9659[_0xbc00('0x1a')];var _0x4e529d=_0x46ae64?0x0:_0x3d6773[_0xbc00('0x18')];var _0x5c1423=_0x46ae64?_0x3d9659[_0xbc00('0x1a')]:_0x3d6773[_0xbc00('0x18')]+_0x3d6773['limit'];var _0x3820c5;if(_0x5c1423>=_0x53b0cd){_0x5c1423=_0x53b0cd;_0x3820c5=0xc8;}else{_0x3820c5=0xce;}_0x3eb532['status'](_0x3820c5);return _0x3eb532[_0xbc00('0x1b')](_0xbc00('0x1c'),_0x4e529d+'-'+_0x5c1423+'/'+_0x53b0cd)['json'](_0x3d9659);}return null;};}function patchUpdates(_0x340f91){return function(_0x225ee6){try{jsonpatch[_0xbc00('0x1d')](_0x225ee6,_0x340f91,!![]);}catch(_0x13abd5){return BPromise[_0xbc00('0x1e')](_0x13abd5);}return _0x225ee6[_0xbc00('0x1f')]();};}function saveUpdates(_0x5c5131,_0x4c88c6){return function(_0x39afdf){if(_0x39afdf){return _0x39afdf[_0xbc00('0x20')](_0x5c5131)[_0xbc00('0x21')](function(_0x5286eb){return _0x5286eb;});}return null;};}function removeEntity(_0x334f8b,_0xf54de8){return function(_0x593289){if(_0x593289){return _0x593289['destroy']()[_0xbc00('0x21')](function(){_0x334f8b[_0xbc00('0x15')](0xcc)[_0xbc00('0x16')]();});}};}function handleEntityNotFound(_0x532f0d,_0x5f21c5){return function(_0x1a969f){if(!_0x1a969f){_0x532f0d['sendStatus'](0x194);}return _0x1a969f;};}function handleError(_0x33a6be,_0x3543f2){_0x3543f2=_0x3543f2||0x1f4;return function(_0x4b3356){logger[_0xbc00('0x22')](_0x4b3356[_0xbc00('0x23')]);if(_0x4b3356[_0xbc00('0x24')]){delete _0x4b3356[_0xbc00('0x24')];}_0x33a6be['status'](_0x3543f2)[_0xbc00('0x25')](_0x4b3356);};}exports[_0xbc00('0x26')]=function(_0x15724a,_0x458c3e){var _0x1a9da0={},_0x1a0e23={},_0x30c348={'count':0x0,'rows':[]};var _0x57a4a8=_[_0xbc00('0x27')](db[_0xbc00('0x28')]['rawAttributes'],function(_0x2c0cb3){return{'name':_0x2c0cb3[_0xbc00('0x29')],'type':_0x2c0cb3[_0xbc00('0x2a')][_0xbc00('0x2b')]};});_0x1a0e23[_0xbc00('0x2c')]=_[_0xbc00('0x27')](_0x57a4a8,_0xbc00('0x24'));_0x1a0e23[_0xbc00('0x2d')]=_[_0xbc00('0x2e')](_0x15724a[_0xbc00('0x2d')]);_0x1a0e23['filters']=_[_0xbc00('0x2f')](_0x1a0e23[_0xbc00('0x2c')],_0x1a0e23[_0xbc00('0x2d')]);_0x1a9da0[_0xbc00('0x30')]=_['intersection'](_0x1a0e23[_0xbc00('0x2c')],qs[_0xbc00('0x31')](_0x15724a[_0xbc00('0x2d')][_0xbc00('0x31')]));_0x1a9da0[_0xbc00('0x30')]=_0x1a9da0['attributes'][_0xbc00('0x32')]?_0x1a9da0[_0xbc00('0x30')]:_0x1a0e23[_0xbc00('0x2c')];if(!_0x15724a['query'][_0xbc00('0x33')](_0xbc00('0x34'))){_0x1a9da0[_0xbc00('0x35')]=qs[_0xbc00('0x35')](_0x15724a[_0xbc00('0x2d')]['limit']);_0x1a9da0[_0xbc00('0x18')]=qs[_0xbc00('0x18')](_0x15724a[_0xbc00('0x2d')][_0xbc00('0x18')]);}_0x1a9da0[_0xbc00('0x36')]=qs[_0xbc00('0x37')](_0x15724a['query']['sort']);_0x1a9da0[_0xbc00('0x38')]=qs[_0xbc00('0x39')](_[_0xbc00('0x3a')](_0x15724a[_0xbc00('0x2d')],_0x1a0e23[_0xbc00('0x39')]),_0x57a4a8);if(_0x15724a['query']['filter']){_0x1a9da0[_0xbc00('0x38')]=_[_0xbc00('0x3b')](_0x1a9da0[_0xbc00('0x38')],{'$or':_['map'](_0x57a4a8,function(_0x2c8060){if(_0x2c8060[_0xbc00('0x2a')]!==_0xbc00('0x3c')){var _0x465f0d={};_0x465f0d[_0x2c8060['name']]={'$like':'%'+_0x15724a[_0xbc00('0x2d')]['filter']+'%'};return _0x465f0d;}})});}_0x1a9da0=_[_0xbc00('0x3b')]({},_0x1a9da0,_0x15724a[_0xbc00('0x3d')]);var _0x5ead44={'where':_0x1a9da0['where']};return db[_0xbc00('0x28')][_0xbc00('0x1a')](_0x5ead44)[_0xbc00('0x21')](function(_0x7d36a2){_0x30c348[_0xbc00('0x1a')]=_0x7d36a2;if(_0x15724a[_0xbc00('0x2d')][_0xbc00('0x3e')]){_0x1a9da0[_0xbc00('0x3f')]=[{'all':!![]}];}return db[_0xbc00('0x28')]['findAll'](_0x1a9da0);})[_0xbc00('0x21')](function(_0x51c4d8){_0x30c348[_0xbc00('0x40')]=_0x51c4d8;return _0x30c348;})[_0xbc00('0x21')](respondWithFilteredResult(_0x458c3e,_0x1a9da0))['catch'](handleError(_0x458c3e,null));};exports[_0xbc00('0x41')]=function(_0x56e4fa,_0x112067){var _0x3ce349={'raw':!![],'where':{'id':_0x56e4fa['params']['id']}},_0x25b82a={};_0x25b82a[_0xbc00('0x2c')]=_['keys'](db[_0xbc00('0x28')][_0xbc00('0x42')]);_0x25b82a[_0xbc00('0x2d')]=_[_0xbc00('0x2e')](_0x56e4fa[_0xbc00('0x2d')]);_0x25b82a['filters']=_['intersection'](_0x25b82a['model'],_0x25b82a['query']);_0x3ce349[_0xbc00('0x30')]=_[_0xbc00('0x2f')](_0x25b82a['model'],qs[_0xbc00('0x31')](_0x56e4fa[_0xbc00('0x2d')][_0xbc00('0x31')]));_0x3ce349['attributes']=_0x3ce349[_0xbc00('0x30')][_0xbc00('0x32')]?_0x3ce349['attributes']:_0x25b82a['model'];if(_0x56e4fa['query'][_0xbc00('0x3e')]){_0x3ce349[_0xbc00('0x3f')]=[{'all':!![]}];}_0x3ce349=_[_0xbc00('0x3b')]({},_0x3ce349,_0x56e4fa[_0xbc00('0x3d')]);return db[_0xbc00('0x28')][_0xbc00('0x43')](_0x3ce349)[_0xbc00('0x21')](handleEntityNotFound(_0x112067,null))['then'](respondWithResult(_0x112067,null))['catch'](handleError(_0x112067,null));};exports[_0xbc00('0x20')]=function(_0x47f693,_0x43a386){if(_0x47f693['body']['id']){delete _0x47f693[_0xbc00('0x44')]['id'];}return db[_0xbc00('0x28')]['find']({'where':{'id':_0x47f693[_0xbc00('0x45')]['id']}})[_0xbc00('0x21')](handleEntityNotFound(_0x43a386,null))['then'](saveUpdates(_0x47f693[_0xbc00('0x44')],null))['then'](respondWithResult(_0x43a386,null))[_0xbc00('0x46')](handleError(_0x43a386,null));};exports[_0xbc00('0x47')]=function(_0x5b2c0b,_0x41cd92){return db[_0xbc00('0x28')]['find']({'where':{'id':_0x5b2c0b[_0xbc00('0x45')]['id']}})[_0xbc00('0x21')](handleEntityNotFound(_0x41cd92,null))[_0xbc00('0x21')](removeEntity(_0x41cd92,null))[_0xbc00('0x46')](handleError(_0x41cd92,null));};exports[_0xbc00('0x48')]=function(_0xd08fe5,_0xa9be82){return db[_0xbc00('0x28')][_0xbc00('0x48')]()[_0xbc00('0x21')](respondWithResult(_0xa9be82,null))[_0xbc00('0x46')](handleError(_0xa9be82,null));}; \ No newline at end of file +var _0xad9c=['includeAll','find','body','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','CmHopperBlack','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','include','rows','catch','show','params','rawAttributes'];(function(_0xb759ce,_0x639c27){var _0x3e0804=function(_0x14ecca){while(--_0x14ecca){_0xb759ce['push'](_0xb759ce['shift']());}};_0x3e0804(++_0x639c27);}(_0xad9c,0x15c));var _0xcad9=function(_0x1d7ad0,_0x34cfe4){_0x1d7ad0=_0x1d7ad0-0x0;var _0x474e29=_0xad9c[_0x1d7ad0];return _0x474e29;};'use strict';var emlformat=require(_0xcad9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcad9('0x1'));var rp=require('request-promise');var moment=require(_0xcad9('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xcad9('0x3'));var util=require(_0xcad9('0x4'));var path=require(_0xcad9('0x5'));var sox=require(_0xcad9('0x6'));var csv=require(_0xcad9('0x7'));var ejs=require(_0xcad9('0x8'));var fs=require('fs');var fs_extra=require(_0xcad9('0x9'));var _=require(_0xcad9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcad9('0xb'));var deskjs=require(_0xcad9('0xc'));var toCsv=require(_0xcad9('0x7'));var querystring=require(_0xcad9('0xd'));var Papa=require('papaparse');var Redis=require(_0xcad9('0xe'));var authService=require(_0xcad9('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcad9('0x10'));var logger=require('../../config/logger')(_0xcad9('0x11'));var utils=require(_0xcad9('0x12'));var config=require(_0xcad9('0x13'));var licenseUtil=require(_0xcad9('0x14'));var db=require(_0xcad9('0x15'))['db'];function respondWithStatusCode(_0x108a78,_0x1e7656){_0x1e7656=_0x1e7656||0xcc;return function(_0x3f442){if(_0x3f442){return _0x108a78[_0xcad9('0x16')](_0x1e7656);}return _0x108a78[_0xcad9('0x17')](_0x1e7656)[_0xcad9('0x18')]();};}function respondWithResult(_0xdc1009,_0x53bdaf){_0x53bdaf=_0x53bdaf||0xc8;return function(_0x3aeb48){if(_0x3aeb48){return _0xdc1009[_0xcad9('0x17')](_0x53bdaf)['json'](_0x3aeb48);}};}function respondWithFilteredResult(_0xa9cdc8,_0x373ef7){return function(_0x4bc826){if(_0x4bc826){var _0x160090=typeof _0x373ef7[_0xcad9('0x19')]===_0xcad9('0x1a')&&typeof _0x373ef7[_0xcad9('0x1b')]==='undefined';var _0x1266b3=_0x4bc826[_0xcad9('0x1c')];var _0x3b5724=_0x160090?0x0:_0x373ef7[_0xcad9('0x19')];var _0x3dcebe=_0x160090?_0x4bc826[_0xcad9('0x1c')]:_0x373ef7[_0xcad9('0x19')]+_0x373ef7[_0xcad9('0x1b')];var _0x1e99f8;if(_0x3dcebe>=_0x1266b3){_0x3dcebe=_0x1266b3;_0x1e99f8=0xc8;}else{_0x1e99f8=0xce;}_0xa9cdc8[_0xcad9('0x17')](_0x1e99f8);return _0xa9cdc8[_0xcad9('0x1d')](_0xcad9('0x1e'),_0x3b5724+'-'+_0x3dcebe+'/'+_0x1266b3)[_0xcad9('0x1f')](_0x4bc826);}return null;};}function patchUpdates(_0x3d4ede){return function(_0xb92f83){try{jsonpatch[_0xcad9('0x20')](_0xb92f83,_0x3d4ede,!![]);}catch(_0x65561){return BPromise[_0xcad9('0x21')](_0x65561);}return _0xb92f83[_0xcad9('0x22')]();};}function saveUpdates(_0x5df391,_0x168616){return function(_0x3dc21a){if(_0x3dc21a){return _0x3dc21a[_0xcad9('0x23')](_0x5df391)[_0xcad9('0x24')](function(_0x21e981){return _0x21e981;});}return null;};}function removeEntity(_0x538f9e,_0x47f80c){return function(_0x1a27d0){if(_0x1a27d0){return _0x1a27d0[_0xcad9('0x25')]()['then'](function(){_0x538f9e[_0xcad9('0x17')](0xcc)[_0xcad9('0x18')]();});}};}function handleEntityNotFound(_0x5c3f73,_0x506270){return function(_0x4a2a5c){if(!_0x4a2a5c){_0x5c3f73[_0xcad9('0x16')](0x194);}return _0x4a2a5c;};}function handleError(_0xa649ab,_0x53ad50){_0x53ad50=_0x53ad50||0x1f4;return function(_0x2f3fce){logger[_0xcad9('0x26')](_0x2f3fce['stack']);if(_0x2f3fce[_0xcad9('0x27')]){delete _0x2f3fce[_0xcad9('0x27')];}_0xa649ab[_0xcad9('0x17')](_0x53ad50)[_0xcad9('0x28')](_0x2f3fce);};}exports[_0xcad9('0x29')]=function(_0x29e8c3,_0x4a7f62){var _0x66d155={},_0xe1bc54={},_0x3d7576={'count':0x0,'rows':[]};var _0xd26d10=_['map'](db[_0xcad9('0x2a')]['rawAttributes'],function(_0x402088){return{'name':_0x402088['fieldName'],'type':_0x402088[_0xcad9('0x2b')]['key']};});_0xe1bc54[_0xcad9('0x2c')]=_[_0xcad9('0x2d')](_0xd26d10,_0xcad9('0x27'));_0xe1bc54[_0xcad9('0x2e')]=_[_0xcad9('0x2f')](_0x29e8c3[_0xcad9('0x2e')]);_0xe1bc54[_0xcad9('0x30')]=_[_0xcad9('0x31')](_0xe1bc54[_0xcad9('0x2c')],_0xe1bc54[_0xcad9('0x2e')]);_0x66d155[_0xcad9('0x32')]=_[_0xcad9('0x31')](_0xe1bc54[_0xcad9('0x2c')],qs[_0xcad9('0x33')](_0x29e8c3[_0xcad9('0x2e')][_0xcad9('0x33')]));_0x66d155[_0xcad9('0x32')]=_0x66d155[_0xcad9('0x32')][_0xcad9('0x34')]?_0x66d155[_0xcad9('0x32')]:_0xe1bc54[_0xcad9('0x2c')];if(!_0x29e8c3[_0xcad9('0x2e')][_0xcad9('0x35')](_0xcad9('0x36'))){_0x66d155[_0xcad9('0x1b')]=qs[_0xcad9('0x1b')](_0x29e8c3[_0xcad9('0x2e')][_0xcad9('0x1b')]);_0x66d155[_0xcad9('0x19')]=qs[_0xcad9('0x19')](_0x29e8c3[_0xcad9('0x2e')][_0xcad9('0x19')]);}_0x66d155[_0xcad9('0x37')]=qs[_0xcad9('0x38')](_0x29e8c3[_0xcad9('0x2e')][_0xcad9('0x38')]);_0x66d155[_0xcad9('0x39')]=qs[_0xcad9('0x30')](_['pick'](_0x29e8c3[_0xcad9('0x2e')],_0xe1bc54[_0xcad9('0x30')]),_0xd26d10);if(_0x29e8c3[_0xcad9('0x2e')][_0xcad9('0x3a')]){_0x66d155['where']=_[_0xcad9('0x3b')](_0x66d155['where'],{'$or':_['map'](_0xd26d10,function(_0x1b7640){if(_0x1b7640[_0xcad9('0x2b')]!=='VIRTUAL'){var _0x4d56c6={};_0x4d56c6[_0x1b7640[_0xcad9('0x27')]]={'$like':'%'+_0x29e8c3['query']['filter']+'%'};return _0x4d56c6;}})});}_0x66d155=_[_0xcad9('0x3b')]({},_0x66d155,_0x29e8c3['options']);var _0x22f064={'where':_0x66d155[_0xcad9('0x39')]};return db[_0xcad9('0x2a')][_0xcad9('0x1c')](_0x22f064)[_0xcad9('0x24')](function(_0x28fd07){_0x3d7576[_0xcad9('0x1c')]=_0x28fd07;if(_0x29e8c3[_0xcad9('0x2e')]['includeAll']){_0x66d155[_0xcad9('0x3c')]=[{'all':!![]}];}return db[_0xcad9('0x2a')]['findAll'](_0x66d155);})[_0xcad9('0x24')](function(_0x22ead6){_0x3d7576[_0xcad9('0x3d')]=_0x22ead6;return _0x3d7576;})[_0xcad9('0x24')](respondWithFilteredResult(_0x4a7f62,_0x66d155))[_0xcad9('0x3e')](handleError(_0x4a7f62,null));};exports[_0xcad9('0x3f')]=function(_0x45234c,_0x222489){var _0x307705={'raw':!![],'where':{'id':_0x45234c[_0xcad9('0x40')]['id']}},_0x86da92={};_0x86da92[_0xcad9('0x2c')]=_[_0xcad9('0x2f')](db[_0xcad9('0x2a')][_0xcad9('0x41')]);_0x86da92[_0xcad9('0x2e')]=_[_0xcad9('0x2f')](_0x45234c[_0xcad9('0x2e')]);_0x86da92['filters']=_[_0xcad9('0x31')](_0x86da92['model'],_0x86da92[_0xcad9('0x2e')]);_0x307705[_0xcad9('0x32')]=_[_0xcad9('0x31')](_0x86da92[_0xcad9('0x2c')],qs[_0xcad9('0x33')](_0x45234c['query'][_0xcad9('0x33')]));_0x307705[_0xcad9('0x32')]=_0x307705[_0xcad9('0x32')]['length']?_0x307705[_0xcad9('0x32')]:_0x86da92[_0xcad9('0x2c')];if(_0x45234c[_0xcad9('0x2e')][_0xcad9('0x42')]){_0x307705[_0xcad9('0x3c')]=[{'all':!![]}];}_0x307705=_['merge']({},_0x307705,_0x45234c['options']);return db[_0xcad9('0x2a')][_0xcad9('0x43')](_0x307705)[_0xcad9('0x24')](handleEntityNotFound(_0x222489,null))[_0xcad9('0x24')](respondWithResult(_0x222489,null))[_0xcad9('0x3e')](handleError(_0x222489,null));};exports[_0xcad9('0x23')]=function(_0xb53ef,_0x346503){if(_0xb53ef[_0xcad9('0x44')]['id']){delete _0xb53ef[_0xcad9('0x44')]['id'];}return db[_0xcad9('0x2a')]['find']({'where':{'id':_0xb53ef['params']['id']}})['then'](handleEntityNotFound(_0x346503,null))[_0xcad9('0x24')](saveUpdates(_0xb53ef[_0xcad9('0x44')],null))[_0xcad9('0x24')](respondWithResult(_0x346503,null))[_0xcad9('0x3e')](handleError(_0x346503,null));};exports[_0xcad9('0x25')]=function(_0x21ef90,_0x3f467d){return db[_0xcad9('0x2a')][_0xcad9('0x43')]({'where':{'id':_0x21ef90['params']['id']}})['then'](handleEntityNotFound(_0x3f467d,null))[_0xcad9('0x24')](removeEntity(_0x3f467d,null))[_0xcad9('0x3e')](handleError(_0x3f467d,null));};exports['describe']=function(_0x151335,_0x1884d9){return db[_0xcad9('0x2a')]['describe']()[_0xcad9('0x24')](respondWithResult(_0x1884d9,null))[_0xcad9('0x3e')](handleError(_0x1884d9,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index bfabb93..15de82e 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 _0xf61c=['cm_hopper_black','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf61c,0x121));var _0xcf61=function(_0x292b1b,_0x4102ba){_0x292b1b=_0x292b1b-0x0;var _0x40c64c=_0xf61c[_0x292b1b];return _0x40c64c;};'use strict';var _=require(_0xcf61('0x0'));var util=require('util');var logger=require(_0xcf61('0x1'))('api');var moment=require(_0xcf61('0x2'));var BPromise=require(_0xcf61('0x3'));var rp=require(_0xcf61('0x4'));var fs=require('fs');var path=require(_0xcf61('0x5'));var rimraf=require(_0xcf61('0x6'));var config=require(_0xcf61('0x7'));var attributes=require(_0xcf61('0x8'));module[_0xcf61('0x9')]=function(_0x1551ac,_0xffc3c){return _0x1551ac[_0xcf61('0xa')]('CmHopperBlack',attributes,{'tableName':_0xcf61('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3691=['util','../../config/logger','api','moment','path','rimraf','./cmHopperBlack.attributes','exports','cm_hopper_black','lodash'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0x3691,0x1e9));var _0x1369=function(_0x599c83,_0x1a2b53){_0x599c83=_0x599c83-0x0;var _0x2ba072=_0x3691[_0x599c83];return _0x2ba072;};'use strict';var _=require(_0x1369('0x0'));var util=require(_0x1369('0x1'));var logger=require(_0x1369('0x2'))(_0x1369('0x3'));var moment=require(_0x1369('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1369('0x5'));var rimraf=require(_0x1369('0x6'));var config=require('../../config/environment');var attributes=require(_0x1369('0x7'));module[_0x1369('0x8')]=function(_0x2109ef,_0x923038){return _0x2109ef['define']('CmHopperBlack',attributes,{'tableName':_0x1369('0x9'),'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 76adf08..18d88ec 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 _0xfdd2=['message','request\x20sent','result','GetCmHopperBlack','CmHopperBlack','findAll','raw','options','where','attributes','limit','model','include','map','then','catch','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x449561,_0x694bc6){var _0x1f08b3=function(_0x1f7d8d){while(--_0x1f7d8d){_0x449561['push'](_0x449561['shift']());}};_0x1f08b3(++_0x694bc6);}(_0xfdd2,0xb1));var _0x2fdd=function(_0x1df5cd,_0x3dc641){_0x1df5cd=_0x1df5cd-0x0;var _0xf6df9b=_0xfdd2[_0x1df5cd];return _0xf6df9b;};'use strict';var _=require(_0x2fdd('0x0'));var util=require(_0x2fdd('0x1'));var moment=require(_0x2fdd('0x2'));var BPromise=require('bluebird');var rs=require(_0x2fdd('0x3'));var fs=require('fs');var Redis=require(_0x2fdd('0x4'));var db=require(_0x2fdd('0x5'))['db'];var utils=require(_0x2fdd('0x6'));var logger=require(_0x2fdd('0x7'))(_0x2fdd('0x8'));var config=require('../../config/environment');var jayson=require(_0x2fdd('0x9'));var client=jayson[_0x2fdd('0xa')][_0x2fdd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x645179,_0x4367d2,_0x4dc1af){return new BPromise(function(_0x5e6c2a,_0xe8a48e){return client['request'](_0x645179,_0x4dc1af)['then'](function(_0x28c9a7){logger[_0x2fdd('0xc')](_0x2fdd('0xd'),_0x4367d2,'request\x20sent');logger[_0x2fdd('0xe')](_0x2fdd('0xf'),_0x4367d2,'request\x20sent',JSON[_0x2fdd('0x10')](_0x28c9a7));if(_0x28c9a7[_0x2fdd('0x11')]){if(_0x28c9a7[_0x2fdd('0x11')]['code']===0x1f4){logger['error'](_0x2fdd('0xd'),_0x4367d2,_0x28c9a7[_0x2fdd('0x11')][_0x2fdd('0x12')]);return _0xe8a48e(_0x28c9a7[_0x2fdd('0x11')][_0x2fdd('0x12')]);}logger['error'](_0x2fdd('0xd'),_0x4367d2,_0x28c9a7[_0x2fdd('0x11')][_0x2fdd('0x12')]);return _0x5e6c2a(_0x28c9a7[_0x2fdd('0x11')][_0x2fdd('0x12')]);}else{logger[_0x2fdd('0xc')](_0x2fdd('0xd'),_0x4367d2,_0x2fdd('0x13'));_0x5e6c2a(_0x28c9a7[_0x2fdd('0x14')][_0x2fdd('0x12')]);}})['catch'](function(_0x37bf9d){logger[_0x2fdd('0x11')](_0x2fdd('0xd'),_0x4367d2,_0x37bf9d);_0xe8a48e(_0x37bf9d);});});}exports[_0x2fdd('0x15')]=function(_0x493187){var _0x1cc220=this;return new Promise(function(_0x177940,_0xcda669){return db[_0x2fdd('0x16')][_0x2fdd('0x17')]({'raw':_0x493187['options']?_0x493187['options'][_0x2fdd('0x18')]===undefined?!![]:![]:!![],'where':_0x493187['options']?_0x493187[_0x2fdd('0x19')][_0x2fdd('0x1a')]||null:null,'attributes':_0x493187[_0x2fdd('0x19')]?_0x493187['options'][_0x2fdd('0x1b')]||null:null,'limit':_0x493187[_0x2fdd('0x19')]?_0x493187['options'][_0x2fdd('0x1c')]||null:null,'include':_0x493187[_0x2fdd('0x19')]?_0x493187[_0x2fdd('0x19')]['include']?_['map'](_0x493187['options']['include'],function(_0x309559){return{'model':db[_0x309559[_0x2fdd('0x1d')]],'as':_0x309559['as'],'attributes':_0x309559[_0x2fdd('0x1b')],'include':_0x309559[_0x2fdd('0x1e')]?_[_0x2fdd('0x1f')](_0x309559[_0x2fdd('0x1e')],function(_0x3267d5){return{'model':db[_0x3267d5[_0x2fdd('0x1d')]],'as':_0x3267d5['as'],'attributes':_0x3267d5[_0x2fdd('0x1b')],'include':_0x3267d5[_0x2fdd('0x1e')]?_[_0x2fdd('0x1f')](_0x3267d5[_0x2fdd('0x1e')],function(_0x51b70a){return{'model':db[_0x51b70a[_0x2fdd('0x1d')]],'as':_0x51b70a['as'],'attributes':_0x51b70a[_0x2fdd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2fdd('0x20')](function(_0xff87a1){logger[_0x2fdd('0xc')](_0x2fdd('0x15'),_0x493187);logger[_0x2fdd('0xe')]('GetCmHopperBlack',_0x493187,JSON[_0x2fdd('0x10')](_0xff87a1));_0x177940(_0xff87a1);})[_0x2fdd('0x21')](function(_0x3f3556){logger[_0x2fdd('0x11')](_0x2fdd('0x15'),_0x3f3556[_0x2fdd('0x12')],_0x493187);_0xcda669(_0x1cc220[_0x2fdd('0x11')](0x1f4,_0x3f3556[_0x2fdd('0x12')]));});});};exports[_0x2fdd('0x22')]=function(_0xf482d6){var _0x41897a=this;return new Promise(function(_0x449479,_0x1709e0){return db[_0x2fdd('0x16')][_0x2fdd('0x23')](_0xf482d6[_0x2fdd('0x24')],{'raw':_0xf482d6['options']?_0xf482d6['options'][_0x2fdd('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf482d6[_0x2fdd('0x19')]?_0xf482d6[_0x2fdd('0x19')]['where']||null:null,'attributes':_0xf482d6['options']?_0xf482d6['options']['attributes']||null:null,'limit':_0xf482d6['options']?_0xf482d6[_0x2fdd('0x19')][_0x2fdd('0x1c')]||null:null})['then'](function(_0x318dc7){logger[_0x2fdd('0xc')](_0x2fdd('0x22'),_0xf482d6);logger[_0x2fdd('0xe')](_0x2fdd('0x22'),_0xf482d6,JSON[_0x2fdd('0x10')](_0x318dc7));_0x449479(_0x318dc7);})[_0x2fdd('0x21')](function(_0x191d27){logger[_0x2fdd('0x11')](_0x2fdd('0x22'),_0x191d27[_0x2fdd('0x12')],_0xf482d6);_0x1709e0(_0x41897a[_0x2fdd('0x11')](0x1f4,_0x191d27[_0x2fdd('0x12')]));});});};exports[_0x2fdd('0x25')]=function(_0x44c93f){var _0x58fd1e=this;return new Promise(function(_0x4f9cfc,_0x4d91b5){return db[_0x2fdd('0x16')][_0x2fdd('0x26')]({'where':_0x44c93f['options']?_0x44c93f[_0x2fdd('0x19')][_0x2fdd('0x1a')]||null:null})['then'](function(_0x47d766){logger[_0x2fdd('0xc')](_0x2fdd('0x25'),_0x44c93f);logger[_0x2fdd('0xe')](_0x2fdd('0x25'),_0x44c93f,JSON[_0x2fdd('0x10')](_0x47d766));_0x4f9cfc(_0x47d766);})['catch'](function(_0x41ad7f){logger['error'](_0x2fdd('0x25'),_0x41ad7f[_0x2fdd('0x12')],_0x44c93f);_0x4d91b5(_0x58fd1e[_0x2fdd('0x11')](0x1f4,_0x41ad7f['message']));});});}; \ No newline at end of file +var _0xab66=['model','attributes','map','catch','UpdateCmHopperBlack','CmHopperBlack','update','body','DestroyCmHopperBlack','destroy','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','GetCmHopperBlack','findAll','options','raw','where','limit','include'];(function(_0x2c60ea,_0x3ec748){var _0x3558ba=function(_0x535a65){while(--_0x535a65){_0x2c60ea['push'](_0x2c60ea['shift']());}};_0x3558ba(++_0x3ec748);}(_0xab66,0xa3));var _0x6ab6=function(_0x1c188a,_0x28d4e3){_0x1c188a=_0x1c188a-0x0;var _0x7ab838=_0xab66[_0x1c188a];return _0x7ab838;};'use strict';var _=require('lodash');var util=require(_0x6ab6('0x0'));var moment=require(_0x6ab6('0x1'));var BPromise=require(_0x6ab6('0x2'));var rs=require(_0x6ab6('0x3'));var fs=require('fs');var Redis=require(_0x6ab6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ab6('0x5'));var logger=require(_0x6ab6('0x6'))('rpc');var config=require(_0x6ab6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6ab6('0x8')][_0x6ab6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2860e4,_0x76ec80,_0x11d479){return new BPromise(function(_0x442806,_0x316b05){return client[_0x6ab6('0xa')](_0x2860e4,_0x11d479)[_0x6ab6('0xb')](function(_0x522f4d){logger[_0x6ab6('0xc')](_0x6ab6('0xd'),_0x76ec80,'request\x20sent');logger[_0x6ab6('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x76ec80,_0x6ab6('0xf'),JSON['stringify'](_0x522f4d));if(_0x522f4d['error']){if(_0x522f4d[_0x6ab6('0x10')][_0x6ab6('0x11')]===0x1f4){logger[_0x6ab6('0x10')](_0x6ab6('0xd'),_0x76ec80,_0x522f4d[_0x6ab6('0x10')][_0x6ab6('0x12')]);return _0x316b05(_0x522f4d[_0x6ab6('0x10')][_0x6ab6('0x12')]);}logger[_0x6ab6('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x76ec80,_0x522f4d[_0x6ab6('0x10')][_0x6ab6('0x12')]);return _0x442806(_0x522f4d[_0x6ab6('0x10')][_0x6ab6('0x12')]);}else{logger['info'](_0x6ab6('0xd'),_0x76ec80,_0x6ab6('0xf'));_0x442806(_0x522f4d[_0x6ab6('0x13')]['message']);}})['catch'](function(_0x7b8ec2){logger[_0x6ab6('0x10')](_0x6ab6('0xd'),_0x76ec80,_0x7b8ec2);_0x316b05(_0x7b8ec2);});});}exports[_0x6ab6('0x14')]=function(_0x29b484){var _0x599b0e=this;return new Promise(function(_0x4cb677,_0x37e5ee){return db['CmHopperBlack'][_0x6ab6('0x15')]({'raw':_0x29b484[_0x6ab6('0x16')]?_0x29b484[_0x6ab6('0x16')][_0x6ab6('0x17')]===undefined?!![]:![]:!![],'where':_0x29b484['options']?_0x29b484[_0x6ab6('0x16')][_0x6ab6('0x18')]||null:null,'attributes':_0x29b484['options']?_0x29b484['options']['attributes']||null:null,'limit':_0x29b484[_0x6ab6('0x16')]?_0x29b484[_0x6ab6('0x16')][_0x6ab6('0x19')]||null:null,'include':_0x29b484[_0x6ab6('0x16')]?_0x29b484[_0x6ab6('0x16')][_0x6ab6('0x1a')]?_['map'](_0x29b484[_0x6ab6('0x16')][_0x6ab6('0x1a')],function(_0x2b45c7){return{'model':db[_0x2b45c7[_0x6ab6('0x1b')]],'as':_0x2b45c7['as'],'attributes':_0x2b45c7[_0x6ab6('0x1c')],'include':_0x2b45c7[_0x6ab6('0x1a')]?_[_0x6ab6('0x1d')](_0x2b45c7[_0x6ab6('0x1a')],function(_0x4399c5){return{'model':db[_0x4399c5['model']],'as':_0x4399c5['as'],'attributes':_0x4399c5[_0x6ab6('0x1c')],'include':_0x4399c5['include']?_[_0x6ab6('0x1d')](_0x4399c5[_0x6ab6('0x1a')],function(_0x343424){return{'model':db[_0x343424['model']],'as':_0x343424['as'],'attributes':_0x343424[_0x6ab6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6ab6('0xb')](function(_0x3519fd){logger[_0x6ab6('0xc')]('GetCmHopperBlack',_0x29b484);logger[_0x6ab6('0xe')]('GetCmHopperBlack',_0x29b484,JSON['stringify'](_0x3519fd));_0x4cb677(_0x3519fd);})[_0x6ab6('0x1e')](function(_0x2d9f72){logger[_0x6ab6('0x10')](_0x6ab6('0x14'),_0x2d9f72[_0x6ab6('0x12')],_0x29b484);_0x37e5ee(_0x599b0e[_0x6ab6('0x10')](0x1f4,_0x2d9f72['message']));});});};exports[_0x6ab6('0x1f')]=function(_0x226cd8){var _0x35ad6e=this;return new Promise(function(_0x43dc93,_0x4b9aa2){return db[_0x6ab6('0x20')][_0x6ab6('0x21')](_0x226cd8[_0x6ab6('0x22')],{'raw':_0x226cd8['options']?_0x226cd8['options'][_0x6ab6('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x226cd8[_0x6ab6('0x16')]?_0x226cd8[_0x6ab6('0x16')][_0x6ab6('0x18')]||null:null,'attributes':_0x226cd8[_0x6ab6('0x16')]?_0x226cd8[_0x6ab6('0x16')][_0x6ab6('0x1c')]||null:null,'limit':_0x226cd8['options']?_0x226cd8[_0x6ab6('0x16')]['limit']||null:null})['then'](function(_0x38e4a3){logger[_0x6ab6('0xc')](_0x6ab6('0x1f'),_0x226cd8);logger[_0x6ab6('0xe')]('UpdateCmHopperBlack',_0x226cd8,JSON['stringify'](_0x38e4a3));_0x43dc93(_0x38e4a3);})[_0x6ab6('0x1e')](function(_0x47641b){logger['error'](_0x6ab6('0x1f'),_0x47641b[_0x6ab6('0x12')],_0x226cd8);_0x4b9aa2(_0x35ad6e[_0x6ab6('0x10')](0x1f4,_0x47641b[_0x6ab6('0x12')]));});});};exports[_0x6ab6('0x23')]=function(_0x1ebd8d){var _0x3a3964=this;return new Promise(function(_0x1bcfde,_0x21c4b3){return db[_0x6ab6('0x20')][_0x6ab6('0x24')]({'where':_0x1ebd8d[_0x6ab6('0x16')]?_0x1ebd8d['options'][_0x6ab6('0x18')]||null:null})[_0x6ab6('0xb')](function(_0x16081b){logger[_0x6ab6('0xc')](_0x6ab6('0x23'),_0x1ebd8d);logger[_0x6ab6('0xe')]('DestroyCmHopperBlack',_0x1ebd8d,JSON[_0x6ab6('0x25')](_0x16081b));_0x1bcfde(_0x16081b);})[_0x6ab6('0x1e')](function(_0x50b1ca){logger[_0x6ab6('0x10')](_0x6ab6('0x23'),_0x50b1ca[_0x6ab6('0x12')],_0x1ebd8d);_0x21c4b3(_0x3a3964[_0x6ab6('0x10')](0x1f4,_0x50b1ca[_0x6ab6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 8e01abf..3b5b404 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 _0x627e=['describe','/:id','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe'];(function(_0x1a57c7,_0x1f0c32){var _0xb5899c=function(_0x4b7242){while(--_0x4b7242){_0x1a57c7['push'](_0x1a57c7['shift']());}};_0xb5899c(++_0x1f0c32);}(_0x627e,0x14a));var _0xe627=function(_0x8e500b,_0x5537d7){_0x8e500b=_0x8e500b-0x0;var _0x270372=_0x627e[_0x8e500b];return _0x270372;};'use strict';var multer=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var path=require(_0xe627('0x2'));var timeout=require(_0xe627('0x3'));var express=require(_0xe627('0x4'));var router=express['Router']();var fs_extra=require(_0xe627('0x5'));var auth=require(_0xe627('0x6'));var interaction=require(_0xe627('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router['get']('/',auth[_0xe627('0x8')](),controller[_0xe627('0x9')]);router[_0xe627('0xa')](_0xe627('0xb'),auth[_0xe627('0x8')](),controller[_0xe627('0xc')]);router['get'](_0xe627('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe627('0xe')](_0xe627('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xe627('0xf')](_0xe627('0xd'),auth[_0xe627('0x8')](),controller[_0xe627('0x10')]);module[_0xe627('0x11')]=router; \ No newline at end of file +var _0x0a6b=['fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','isAuthenticated','index','/describe','describe','show','put','/:id','delete','destroy','exports','multer','express'];(function(_0x2bd604,_0x184432){var _0x3dfb17=function(_0x3cad65){while(--_0x3cad65){_0x2bd604['push'](_0x2bd604['shift']());}};_0x3dfb17(++_0x184432);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x8a22de,_0x1fbd75){_0x8a22de=_0x8a22de-0x0;var _0x273eea=_0x0a6b[_0x8a22de];return _0x273eea;};'use strict';var multer=require(_0xb0a6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb0a6('0x1'));var router=express['Router']();var fs_extra=require(_0xb0a6('0x2'));var auth=require(_0xb0a6('0x3'));var interaction=require(_0xb0a6('0x4'));var config=require('../../config/environment');var controller=require(_0xb0a6('0x5'));router['get']('/',auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x7')]);router['get'](_0xb0a6('0x8'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb0a6('0xa')]);router[_0xb0a6('0xb')](_0xb0a6('0xc'),auth[_0xb0a6('0x6')](),controller['update']);router[_0xb0a6('0xd')](_0xb0a6('0xc'),auth['isAuthenticated'](),controller[_0xb0a6('0xe')]);module[_0xb0a6('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index cff1c7d..ada195a 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 _0x9589=['exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment'];(function(_0x4e95c8,_0x26c8f6){var _0x1d5ecf=function(_0x3474df){while(--_0x3474df){_0x4e95c8['push'](_0x4e95c8['shift']());}};_0x1d5ecf(++_0x26c8f6);}(_0x9589,0x1d2));var _0x9958=function(_0x1dc6bb,_0x1f7408){_0x1dc6bb=_0x1dc6bb-0x0;var _0x53600a=_0x9589[_0x1dc6bb];return _0x53600a;};'use strict';var Sequelize=require(_0x9958('0x0'));var moment=require(_0x9958('0x1'));module[_0x9958('0x2')]={'state':{'type':Sequelize[_0x9958('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x9958('0x4')]},'scheduledat':{'type':Sequelize[_0x9958('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9958('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9958('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9958('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x9958('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x9958('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x9958('0x4')]},'calleridname':{'type':Sequelize[_0x9958('0x4')]},'starttime':{'type':Sequelize[_0x9958('0x5')]},'responsetime':{'type':Sequelize[_0x9958('0x5')]},'answertime':{'type':Sequelize[_0x9958('0x5')]},'droptime':{'type':Sequelize[_0x9958('0x5')]},'endtime':{'type':Sequelize[_0x9958('0x5')]},'ringtime':{'type':Sequelize[_0x9958('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9958('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x9958('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x9958('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9958('0x4')]},'campaign':{'type':Sequelize[_0x9958('0x4')]},'campaigntype':{'type':Sequelize[_0x9958('0x4')]},'membername':{'type':Sequelize[_0x9958('0x4')]},'reason':{'type':Sequelize[_0x9958('0x4')]},'disposition':{'type':Sequelize[_0x9958('0x4')]},'secondDisposition':{'type':Sequelize[_0x9958('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x3fbd76){var _0x368a7e=this[_0x9958('0x6')](_0x9958('0x7'));if(_0x368a7e&&_0x3fbd76){this[_0x9958('0x8')](_0x9958('0x9'),moment(_0x3fbd76)[_0x9958('0xa')](moment(_0x368a7e),_0x9958('0xb')));}}},'amd':{'type':Sequelize[_0x9958('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x9958('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x9958('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x9958('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x9958('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9958('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9958('0x5')]},'deleted':{'type':Sequelize[_0x9958('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x9958('0x5')]},'recallme':{'type':Sequelize[_0x9958('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x9958('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x9958('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9958('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9958('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9958('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9958('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x160f=['setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime'];(function(_0xb9373d,_0x3c85a5){var _0x177c35=function(_0x3f53f0){while(--_0x3f53f0){_0xb9373d['push'](_0xb9373d['shift']());}};_0x177c35(++_0x3c85a5);}(_0x160f,0x109));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf160('0x0'));var moment=require(_0xf160('0x1'));module[_0xf160('0x2')]={'state':{'type':Sequelize[_0xf160('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xf160('0x4')]},'scheduledat':{'type':Sequelize[_0xf160('0x5')]},'countbusyretry':{'type':Sequelize[_0xf160('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf160('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xf160('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xf160('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf160('0x4')]},'calleridname':{'type':Sequelize[_0xf160('0x4')]},'starttime':{'type':Sequelize[_0xf160('0x5')]},'responsetime':{'type':Sequelize[_0xf160('0x5')]},'answertime':{'type':Sequelize[_0xf160('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xf160('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf160('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf160('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xf160('0x4')]},'membername':{'type':Sequelize[_0xf160('0x4')]},'reason':{'type':Sequelize[_0xf160('0x4')]},'disposition':{'type':Sequelize[_0xf160('0x4')]},'secondDisposition':{'type':Sequelize[_0xf160('0x4')]},'thirdDisposition':{'type':Sequelize[_0xf160('0x4')]},'dispositionat':{'type':Sequelize[_0xf160('0x5')],'set':function(_0x46ff0c){var _0x995548=this[_0xf160('0x6')](_0xf160('0x7'));if(_0x995548&&_0x46ff0c){this[_0xf160('0x8')](_0xf160('0x9'),moment(_0x46ff0c)[_0xf160('0xa')](moment(_0x995548),_0xf160('0xb')));}}},'amd':{'type':Sequelize[_0xf160('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0xf160('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xf160('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf160('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf160('0x5')]},'deleted':{'type':Sequelize[_0xf160('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xf160('0x5')]},'recallme':{'type':Sequelize[_0xf160('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xf160('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf160('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf160('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf160('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf160('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 14c8b15..076f851 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 _0xfcf0=['noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','field','NOW()','ContactId','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','state\x20=\x20?','state','toString','VoiceQueueId\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','ListId','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','CmHopper','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','includeAll','include','catch','params','merge','options','describe','body','uniqueid','find','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null'];(function(_0x22b2f8,_0x152017){var _0x14702f=function(_0x32c54a){while(--_0x32c54a){_0x22b2f8['push'](_0x22b2f8['shift']());}};_0x14702f(++_0x152017);}(_0xfcf0,0x138));var _0x0fcf=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xfcf0[_0x341e0f];return _0x59555a;};'use strict';var emlformat=require(_0x0fcf('0x0'));var rimraf=require(_0x0fcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fcf('0x2'));var rp=require(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require(_0x0fcf('0x5'));var Mustache=require('mustache');var util=require(_0x0fcf('0x6'));var path=require(_0x0fcf('0x7'));var sox=require(_0x0fcf('0x8'));var csv=require(_0x0fcf('0x9'));var ejs=require(_0x0fcf('0xa'));var fs=require('fs');var fs_extra=require(_0x0fcf('0xb'));var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0x9'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fcf('0x17'))['db'];function respondWithStatusCode(_0x3c999e,_0x4b4904){_0x4b4904=_0x4b4904||0xcc;return function(_0x20153d){if(_0x20153d){return _0x3c999e[_0x0fcf('0x18')](_0x4b4904);}return _0x3c999e[_0x0fcf('0x19')](_0x4b4904)[_0x0fcf('0x1a')]();};}function respondWithResult(_0x25fadc,_0x48bba6){_0x48bba6=_0x48bba6||0xc8;return function(_0xa32692){if(_0xa32692){return _0x25fadc[_0x0fcf('0x19')](_0x48bba6)[_0x0fcf('0x1b')](_0xa32692);}};}function respondWithFilteredResult(_0x5e867f,_0x3c09c4){return function(_0x610106){if(_0x610106){var _0x445207=typeof _0x3c09c4[_0x0fcf('0x1c')]==='undefined'&&typeof _0x3c09c4[_0x0fcf('0x1d')]===_0x0fcf('0x1e');var _0x1a8477=_0x610106[_0x0fcf('0x1f')];var _0x19cfbd=_0x445207?0x0:_0x3c09c4['offset'];var _0x18ea32=_0x445207?_0x610106[_0x0fcf('0x1f')]:_0x3c09c4['offset']+_0x3c09c4[_0x0fcf('0x1d')];var _0x1b9a90;if(_0x18ea32>=_0x1a8477){_0x18ea32=_0x1a8477;_0x1b9a90=0xc8;}else{_0x1b9a90=0xce;}_0x5e867f['status'](_0x1b9a90);return _0x5e867f[_0x0fcf('0x20')]('Content-Range',_0x19cfbd+'-'+_0x18ea32+'/'+_0x1a8477)[_0x0fcf('0x1b')](_0x610106);}return null;};}function patchUpdates(_0x13454e){return function(_0x5c8279){try{jsonpatch[_0x0fcf('0x21')](_0x5c8279,_0x13454e,!![]);}catch(_0x3f28d0){return BPromise[_0x0fcf('0x22')](_0x3f28d0);}return _0x5c8279['save']();};}function saveUpdates(_0x2f03ce,_0x1dafc8){return function(_0x196d30){if(_0x196d30){return _0x196d30[_0x0fcf('0x23')](_0x2f03ce)[_0x0fcf('0x24')](function(_0x30e1b0){return _0x30e1b0;});}return null;};}function removeEntity(_0x5841a9,_0x2eef74){return function(_0x253641){if(_0x253641){return _0x253641[_0x0fcf('0x25')]()[_0x0fcf('0x24')](function(){_0x5841a9[_0x0fcf('0x19')](0xcc)[_0x0fcf('0x1a')]();});}};}function handleEntityNotFound(_0x2ce990,_0x18f269){return function(_0x117510){if(!_0x117510){_0x2ce990['sendStatus'](0x194);}return _0x117510;};}function handleError(_0x18965e,_0xc107a){_0xc107a=_0xc107a||0x1f4;return function(_0x41b7a2){logger[_0x0fcf('0x26')](_0x41b7a2[_0x0fcf('0x27')]);if(_0x41b7a2[_0x0fcf('0x28')]){delete _0x41b7a2[_0x0fcf('0x28')];}_0x18965e['status'](_0xc107a)[_0x0fcf('0x29')](_0x41b7a2);};}exports[_0x0fcf('0x2a')]=function(_0x200517,_0x35180d){var _0x49fd0e={},_0x5d9bcd={},_0x4af80d={'count':0x0,'rows':[]};var _0x428194=_['map'](db[_0x0fcf('0x2b')][_0x0fcf('0x2c')],function(_0x56a416){return{'name':_0x56a416[_0x0fcf('0x2d')],'type':_0x56a416[_0x0fcf('0x2e')][_0x0fcf('0x2f')]};});_0x5d9bcd[_0x0fcf('0x30')]=_[_0x0fcf('0x31')](_0x428194,_0x0fcf('0x28'));_0x5d9bcd['query']=_[_0x0fcf('0x32')](_0x200517[_0x0fcf('0x33')]);_0x5d9bcd[_0x0fcf('0x34')]=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],_0x5d9bcd[_0x0fcf('0x33')]);_0x49fd0e['attributes']=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x49fd0e[_0x0fcf('0x37')]=_0x49fd0e[_0x0fcf('0x37')][_0x0fcf('0x38')]?_0x49fd0e[_0x0fcf('0x37')]:_0x5d9bcd[_0x0fcf('0x30')];if(!_0x200517[_0x0fcf('0x33')][_0x0fcf('0x39')](_0x0fcf('0x3a'))){_0x49fd0e[_0x0fcf('0x1d')]=qs['limit'](_0x200517['query'][_0x0fcf('0x1d')]);_0x49fd0e['offset']=qs['offset'](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x1c')]);}_0x49fd0e[_0x0fcf('0x3b')]=qs['sort'](_0x200517['query'][_0x0fcf('0x3c')]);_0x49fd0e[_0x0fcf('0x3d')]=qs[_0x0fcf('0x34')](_['pick'](_0x200517[_0x0fcf('0x33')],_0x5d9bcd[_0x0fcf('0x34')]),_0x428194);if(_0x200517[_0x0fcf('0x33')]['filter']){_0x49fd0e['where']=_['merge'](_0x49fd0e[_0x0fcf('0x3d')],{'$or':_[_0x0fcf('0x31')](_0x428194,function(_0xdfdd1){if(_0xdfdd1[_0x0fcf('0x2e')]!==_0x0fcf('0x3e')){var _0x4be8eb={};_0x4be8eb[_0xdfdd1[_0x0fcf('0x28')]]={'$like':'%'+_0x200517[_0x0fcf('0x33')][_0x0fcf('0x3f')]+'%'};return _0x4be8eb;}})});}_0x49fd0e=_['merge']({},_0x49fd0e,_0x200517['options']);var _0x13e4b2={'where':_0x49fd0e[_0x0fcf('0x3d')]};return db[_0x0fcf('0x2b')][_0x0fcf('0x1f')](_0x13e4b2)[_0x0fcf('0x24')](function(_0x4c6669){_0x4af80d[_0x0fcf('0x1f')]=_0x4c6669;if(_0x200517[_0x0fcf('0x33')][_0x0fcf('0x40')]){_0x49fd0e[_0x0fcf('0x41')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x49fd0e);})[_0x0fcf('0x24')](function(_0x2444a6){_0x4af80d['rows']=_0x2444a6;return _0x4af80d;})[_0x0fcf('0x24')](respondWithFilteredResult(_0x35180d,_0x49fd0e))[_0x0fcf('0x42')](handleError(_0x35180d,null));};exports['show']=function(_0x237fa6,_0xfc2f2b){var _0x44eb03={'raw':!![],'where':{'id':_0x237fa6[_0x0fcf('0x43')]['id']}},_0x1f322b={};_0x1f322b['model']=_[_0x0fcf('0x32')](db[_0x0fcf('0x2b')]['rawAttributes']);_0x1f322b['query']=_[_0x0fcf('0x32')](_0x237fa6['query']);_0x1f322b['filters']=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],_0x1f322b[_0x0fcf('0x33')]);_0x44eb03[_0x0fcf('0x37')]=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x237fa6[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x44eb03[_0x0fcf('0x37')]=_0x44eb03['attributes'][_0x0fcf('0x38')]?_0x44eb03[_0x0fcf('0x37')]:_0x1f322b[_0x0fcf('0x30')];if(_0x237fa6['query']['includeAll']){_0x44eb03[_0x0fcf('0x41')]=[{'all':!![]}];}_0x44eb03=_[_0x0fcf('0x44')]({},_0x44eb03,_0x237fa6[_0x0fcf('0x45')]);return db[_0x0fcf('0x2b')]['find'](_0x44eb03)['then'](handleEntityNotFound(_0xfc2f2b,null))[_0x0fcf('0x24')](respondWithResult(_0xfc2f2b,null))[_0x0fcf('0x42')](handleError(_0xfc2f2b,null));};exports[_0x0fcf('0x46')]=function(_0x1fb83d,_0x345188){return db[_0x0fcf('0x2b')][_0x0fcf('0x46')]()[_0x0fcf('0x24')](respondWithResult(_0x345188,null))['catch'](handleError(_0x345188,null));};exports['update']=function(_0x259c91,_0x243699){if(_0x259c91[_0x0fcf('0x47')][_0x0fcf('0x48')]){delete _0x259c91[_0x0fcf('0x47')][_0x0fcf('0x48')];}return db['CmHopperFinal'][_0x0fcf('0x49')]({'where':{'uniqueid':_0x259c91[_0x0fcf('0x43')]['id']}})['then'](handleEntityNotFound(_0x243699,null))[_0x0fcf('0x24')](saveUpdates(_0x259c91[_0x0fcf('0x47')],null))[_0x0fcf('0x24')](respondWithResult(_0x243699,null))[_0x0fcf('0x42')](handleError(_0x243699,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0xc514bf,_0x382448,_0x1bb062){return db[_0x0fcf('0x2b')][_0x0fcf('0x4a')]({'raw':![],'where':{'VoiceQueueId':_0xc514bf[_0x0fcf('0x43')]['id']},'attributes':[[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x4e')))),_0x0fcf('0x4f')],[db[_0x0fcf('0x4b')]['fn']('COUNT',db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x50')))),_0x0fcf('0x51')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db['sequelize']['fn']('IF',db[_0x0fcf('0x4b')]['literal'](_0x0fcf('0x52')))),_0x0fcf('0x53')],[db['sequelize']['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x54')))),_0x0fcf('0x55')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x0fcf('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x0fcf('0x56')],[db[_0x0fcf('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x57')))),'abandonedContacts'],[db[_0x0fcf('0x4b')]['fn']('COUNT',db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')]('`state`\x20=\x2022,\x201,\x20null'))),_0x0fcf('0x58')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x59')))),_0x0fcf('0x5a')]]})[_0x0fcf('0x24')](handleEntityNotFound(_0x382448,null))[_0x0fcf('0x24')](respondWithResult(_0x382448,null))[_0x0fcf('0x42')](handleError(_0x382448,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x62d12e,_0x1dda2e,_0x6af0f5){return db[_0x0fcf('0x2b')][_0x0fcf('0x4a')]({'raw':![],'where':{'CampaignId':_0x62d12e[_0x0fcf('0x43')]['id']},'attributes':[[db[_0x0fcf('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')]('`state`\x20=\x200,\x201,\x20null'))),_0x0fcf('0x4f')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x50')))),_0x0fcf('0x51')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x52')))),_0x0fcf('0x53')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x54')))),_0x0fcf('0x55')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x5b')))),_0x0fcf('0x56')],[db['sequelize']['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x57')))),_0x0fcf('0x5c')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x0fcf('0x4b')]['fn']('COUNT',db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x0fcf('0x24')](handleEntityNotFound(_0x1dda2e,null))[_0x0fcf('0x24')](respondWithResult(_0x1dda2e,null))['catch'](handleError(_0x1dda2e,null));};exports[_0x0fcf('0x5d')]=function(_0x3cb75a,_0x5936a6,_0x3d02c1){return db[_0x0fcf('0x5e')][_0x0fcf('0x49')]({'where':{'id':_0x3cb75a[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0x5936a6,null))[_0x0fcf('0x24')](function(_0x4704c9){var _0x4b1f10;if(_0x4704c9){_0x4b1f10=squel[_0x0fcf('0x5f')]()[_0x0fcf('0x60')](_0x0fcf('0x61'))[_0x0fcf('0x62')]([_0x0fcf('0x63'),_0x0fcf('0x64'),'ContactId','ListId',_0x0fcf('0x65'),_0x0fcf('0x66'),_0x0fcf('0x67')],squel[_0x0fcf('0x68')]()['field'](_0x0fcf('0x69'),_0x0fcf('0x63'))[_0x0fcf('0x6a')](_0x0fcf('0x6b'),_0x0fcf('0x64'))['field']('ANY_VALUE(ContactId)',_0x0fcf('0x6c'))['field'](_0x0fcf('0x6d'),'ListId')[_0x0fcf('0x6a')](_0x0fcf('0x6e'),_0x0fcf('0x65'))[_0x0fcf('0x6a')](_0x0fcf('0x6b'),'createdAt')[_0x0fcf('0x6a')](_0x0fcf('0x6b'),_0x0fcf('0x67'))[_0x0fcf('0x6f')]('cm_hopper_final')[_0x0fcf('0x3d')]('VoiceQueueId\x20=\x20?',_0x3cb75a[_0x0fcf('0x43')]['id']['toString']())[_0x0fcf('0x3d')](_0x0fcf('0x70'),_0x3cb75a['body'][_0x0fcf('0x71')][_0x0fcf('0x72')]())[_0x0fcf('0x3d')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x0fcf('0x68')]()['field'](_0x0fcf('0x63'))[_0x0fcf('0x6f')](_0x0fcf('0x61'))[_0x0fcf('0x3d')](_0x0fcf('0x73'),_0x3cb75a[_0x0fcf('0x43')]['id'][_0x0fcf('0x72')]()))[_0x0fcf('0x3d')](_0x0fcf('0x74'),squel['select']()[_0x0fcf('0x6a')](_0x0fcf('0x75'))[_0x0fcf('0x6f')](_0x0fcf('0x76'))[_0x0fcf('0x3d')](_0x0fcf('0x73'),_0x3cb75a[_0x0fcf('0x43')]['id'][_0x0fcf('0x72')]())['where'](_0x0fcf('0x77')))[_0x0fcf('0x78')](_0x0fcf('0x6c')))[_0x0fcf('0x72')]();return db[_0x0fcf('0x4b')][_0x0fcf('0x33')](_0x4b1f10);}return[];})[_0x0fcf('0x24')](respondWithResult(_0x5936a6,null))['catch'](handleError(_0x5936a6,null));};exports[_0x0fcf('0x79')]=function(_0x489c6d,_0x18645d,_0x9e933e){return db[_0x0fcf('0x7a')]['find']({'where':{'id':_0x489c6d['params']['id']}})['then'](handleEntityNotFound(_0x18645d,null))['then'](function(_0x301991){var _0x46bcc2;if(_0x301991){_0x46bcc2=squel[_0x0fcf('0x5f')]()[_0x0fcf('0x60')](_0x0fcf('0x61'))[_0x0fcf('0x62')]([_0x0fcf('0x63'),_0x0fcf('0x64'),_0x0fcf('0x6c'),_0x0fcf('0x7b'),_0x0fcf('0x7c'),'createdAt',_0x0fcf('0x67')],squel[_0x0fcf('0x68')]()['field'](_0x0fcf('0x69'),'phone')[_0x0fcf('0x6a')](_0x0fcf('0x6b'),'scheduledAt')['field'](_0x0fcf('0x7d'),_0x0fcf('0x6c'))['field'](_0x0fcf('0x6d'),_0x0fcf('0x7b'))[_0x0fcf('0x6a')](_0x0fcf('0x7e'),_0x0fcf('0x7c'))[_0x0fcf('0x6a')](_0x0fcf('0x6b'),_0x0fcf('0x66'))['field'](_0x0fcf('0x6b'),_0x0fcf('0x67'))[_0x0fcf('0x6f')](_0x0fcf('0x76'))['where'](_0x0fcf('0x7f'),_0x489c6d['params']['id']['toString']())['where'](_0x0fcf('0x70'),_0x489c6d[_0x0fcf('0x47')][_0x0fcf('0x71')][_0x0fcf('0x72')]())[_0x0fcf('0x3d')](_0x0fcf('0x80'))[_0x0fcf('0x3d')](_0x0fcf('0x74'),squel[_0x0fcf('0x68')]()['field'](_0x0fcf('0x63'))[_0x0fcf('0x6f')](_0x0fcf('0x61'))[_0x0fcf('0x3d')](_0x0fcf('0x7f'),_0x489c6d[_0x0fcf('0x43')]['id'][_0x0fcf('0x72')]()))[_0x0fcf('0x3d')](_0x0fcf('0x74'),squel['select']()['field']('calleridnum')[_0x0fcf('0x6f')](_0x0fcf('0x76'))[_0x0fcf('0x3d')](_0x0fcf('0x7f'),_0x489c6d['params']['id']['toString']())['where'](_0x0fcf('0x77')))['group'](_0x0fcf('0x6c')))['toString']();return db[_0x0fcf('0x4b')]['query'](_0x46bcc2);}return[];})[_0x0fcf('0x24')](respondWithResult(_0x18645d,null))['catch'](handleError(_0x18645d,null));};exports['checkContactHopper']=function(_0x426625,_0x4ccae3,_0x2905fa){return db[_0x0fcf('0x81')][_0x0fcf('0x82')]({'where':{'VoiceQueueId':_0x426625[_0x0fcf('0x47')][_0x0fcf('0x65')],'CampaignId':_0x426625[_0x0fcf('0x47')][_0x0fcf('0x7c')],'ContactId':_0x426625[_0x0fcf('0x47')][_0x0fcf('0x6c')]}})[_0x0fcf('0x24')](handleEntityNotFound(_0x4ccae3,null))[_0x0fcf('0x24')](function(_0x274aa9){if(_0x274aa9){return _0x274aa9;}return null;})[_0x0fcf('0x24')](respondWithResult(_0x4ccae3,null))['catch'](handleError(_0x4ccae3,null));}; \ No newline at end of file +var _0xc4aa=['ContactId','ListId','ANY_VALUE(VoiceQueueId)','NOW()','createdAt','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','cm_hopper','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','phone','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','CmHopperFinal','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','describe','uniqueid','find','body','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','scheduledAt','VoiceQueueId','updatedAt','field','ANY_VALUE(calleridnum)'];(function(_0x4d8744,_0x203345){var _0x17fb37=function(_0x216209){while(--_0x216209){_0x4d8744['push'](_0x4d8744['shift']());}};_0x17fb37(++_0x203345);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc4aa[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}exports[_0xac4a('0x2a')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=_[_0xac4a('0x2b')](db[_0xac4a('0x2c')]['rawAttributes'],function(_0x4bda1f){return{'name':_0x4bda1f[_0xac4a('0x2d')],'type':_0x4bda1f[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x4a5a9e[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0xdb7e,'name');_0x4a5a9e[_0xac4a('0x31')]=_['keys'](_0x42a33c[_0xac4a('0x31')]);_0x4a5a9e['filters']=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],_0x4a5a9e[_0xac4a('0x31')]);_0x116700[_0xac4a('0x33')]=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x34')]));_0x116700[_0xac4a('0x33')]=_0x116700[_0xac4a('0x33')][_0xac4a('0x35')]?_0x116700[_0xac4a('0x33')]:_0x4a5a9e[_0xac4a('0x30')];if(!_0x42a33c['query'][_0xac4a('0x36')](_0xac4a('0x37'))){_0x116700['limit']=qs[_0xac4a('0x1d')](_0x42a33c[_0xac4a('0x31')]['limit']);_0x116700['offset']=qs[_0xac4a('0x1b')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x1b')]);}_0x116700[_0xac4a('0x38')]=qs['sort'](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x39')]);_0x116700['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x3b')](_0x42a33c[_0xac4a('0x31')],_0x4a5a9e['filters']),_0xdb7e);if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x3c')]){_0x116700[_0xac4a('0x3d')]=_['merge'](_0x116700[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2b')](_0xdb7e,function(_0x4b9faf){if(_0x4b9faf['type']!==_0xac4a('0x3e')){var _0x5e0926={};_0x5e0926[_0x4b9faf['name']]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x5e0926;}})});}_0x116700=_[_0xac4a('0x3f')]({},_0x116700,_0x42a33c[_0xac4a('0x40')]);var _0x37834b={'where':_0x116700[_0xac4a('0x3d')]};return db[_0xac4a('0x2c')][_0xac4a('0x1e')](_0x37834b)[_0xac4a('0x24')](function(_0x2b16f0){_0x47f49c[_0xac4a('0x1e')]=_0x2b16f0;if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x41')]){_0x116700[_0xac4a('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':!![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')]()['then'](respondWithResult(_0x244950,null))['catch'](handleError(_0x244950,null));};exports[_0xac4a('0x23')]=function(_0x4aaeff,_0x18ae96){if(_0x4aaeff['body'][_0xac4a('0x4a')]){delete _0x4aaeff['body'][_0xac4a('0x4a')];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'uniqueid':_0x4aaeff[_0xac4a('0x46')]['id']}})['then'](handleEntityNotFound(_0x18ae96,null))[_0xac4a('0x24')](saveUpdates(_0x4aaeff[_0xac4a('0x4c')],null))[_0xac4a('0x24')](respondWithResult(_0x18ae96,null))[_0xac4a('0x44')](handleError(_0x18ae96,null));};exports[_0xac4a('0x4d')]=function(_0x138876,_0x187306,_0x4e6e19){return db[_0xac4a('0x2c')][_0xac4a('0x4e')]({'raw':![],'where':{'VoiceQueueId':_0x138876['params']['id']},'attributes':[[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x51')))),_0xac4a('0x52')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')]('`state`\x20=\x203,\x201,\x20null'))),_0xac4a('0x54')],[db[_0xac4a('0x4f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')]('`state`\x20=\x205,\x201,\x20null'))),_0xac4a('0x55')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x56')))),_0xac4a('0x57')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x58')))),_0xac4a('0x59')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5a')))),_0xac4a('0x5b')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5c')))),_0xac4a('0x5d')],[db['sequelize']['fn'](_0xac4a('0x50'),db['sequelize']['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x5e')))),'answeringMachine']]})[_0xac4a('0x24')](handleEntityNotFound(_0x187306,null))['then'](respondWithResult(_0x187306,null))['catch'](handleError(_0x187306,null));};exports[_0xac4a('0x5f')]=function(_0x568ffb,_0x3bcae2,_0x3c2f84){return db[_0xac4a('0x2c')][_0xac4a('0x4e')]({'raw':![],'where':{'CampaignId':_0x568ffb['params']['id']},'attributes':[[db[_0xac4a('0x4f')]['fn']('COUNT',db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x51')))),_0xac4a('0x52')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x60')))),_0xac4a('0x54')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x61')))),_0xac4a('0x55')],[db['sequelize']['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x56')))),_0xac4a('0x57')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db['sequelize']['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x58')))),_0xac4a('0x59')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5a')))),_0xac4a('0x5b')],[db[_0xac4a('0x4f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5c')))),_0xac4a('0x5d')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5e')))),_0xac4a('0x62')]]})[_0xac4a('0x24')](handleEntityNotFound(_0x3bcae2,null))['then'](respondWithResult(_0x3bcae2,null))[_0xac4a('0x44')](handleError(_0x3bcae2,null));};exports[_0xac4a('0x63')]=function(_0x26bd31,_0x231932,_0x513976){return db[_0xac4a('0x64')]['find']({'where':{'id':_0x26bd31[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x231932,null))['then'](function(_0x5bd95b){var _0x17eac2;if(_0x5bd95b){_0x17eac2=squel[_0xac4a('0x65')]()[_0xac4a('0x66')]('cm_hopper')[_0xac4a('0x67')](['phone',_0xac4a('0x68'),'ContactId','ListId',_0xac4a('0x69'),'createdAt',_0xac4a('0x6a')],squel['select']()[_0xac4a('0x6b')](_0xac4a('0x6c'),'phone')[_0xac4a('0x6b')]('NOW()',_0xac4a('0x68'))[_0xac4a('0x6b')]('ANY_VALUE(ContactId)',_0xac4a('0x6d'))['field']('ANY_VALUE(ListId)',_0xac4a('0x6e'))['field'](_0xac4a('0x6f'),'VoiceQueueId')['field'](_0xac4a('0x70'),_0xac4a('0x71'))[_0xac4a('0x6b')]('NOW()','updatedAt')[_0xac4a('0x72')](_0xac4a('0x73'))['where']('VoiceQueueId\x20=\x20?',_0x26bd31[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x75'),_0x26bd31[_0xac4a('0x4c')][_0xac4a('0x76')][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x77'))['where'](_0xac4a('0x78'),squel[_0xac4a('0x79')]()[_0xac4a('0x6b')]('phone')[_0xac4a('0x72')](_0xac4a('0x7a'))[_0xac4a('0x3d')](_0xac4a('0x7b'),_0x26bd31[_0xac4a('0x46')]['id']['toString']()))[_0xac4a('0x3d')](_0xac4a('0x78'),squel[_0xac4a('0x79')]()[_0xac4a('0x6b')](_0xac4a('0x7c'))[_0xac4a('0x72')](_0xac4a('0x73'))['where'](_0xac4a('0x7b'),_0x26bd31[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x7d')))[_0xac4a('0x7e')]('ContactId'))[_0xac4a('0x74')]();return db[_0xac4a('0x4f')][_0xac4a('0x31')](_0x17eac2);}return[];})[_0xac4a('0x24')](respondWithResult(_0x231932,null))['catch'](handleError(_0x231932,null));};exports[_0xac4a('0x7f')]=function(_0x56a934,_0x4447b5,_0x22b718){return db['Campaign']['find']({'where':{'id':_0x56a934[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x4447b5,null))[_0xac4a('0x24')](function(_0x4bb03d){var _0x1f3f1c;if(_0x4bb03d){_0x1f3f1c=squel['insert']()[_0xac4a('0x66')](_0xac4a('0x7a'))[_0xac4a('0x67')]([_0xac4a('0x80'),_0xac4a('0x68'),'ContactId','ListId',_0xac4a('0x81'),_0xac4a('0x71'),_0xac4a('0x6a')],squel[_0xac4a('0x79')]()[_0xac4a('0x6b')](_0xac4a('0x6c'),_0xac4a('0x80'))[_0xac4a('0x6b')]('NOW()','scheduledAt')[_0xac4a('0x6b')](_0xac4a('0x82'),_0xac4a('0x6d'))[_0xac4a('0x6b')](_0xac4a('0x83'),_0xac4a('0x6e'))[_0xac4a('0x6b')](_0xac4a('0x84'),'CampaignId')['field'](_0xac4a('0x70'),_0xac4a('0x71'))[_0xac4a('0x6b')](_0xac4a('0x70'),_0xac4a('0x6a'))[_0xac4a('0x72')](_0xac4a('0x73'))['where'](_0xac4a('0x85'),_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())['where'](_0xac4a('0x75'),_0x56a934[_0xac4a('0x4c')][_0xac4a('0x76')][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x77'))[_0xac4a('0x3d')](_0xac4a('0x78'),squel[_0xac4a('0x79')]()['field'](_0xac4a('0x80'))['from'](_0xac4a('0x7a'))[_0xac4a('0x3d')](_0xac4a('0x85'),_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]()))[_0xac4a('0x3d')](_0xac4a('0x78'),squel['select']()[_0xac4a('0x6b')](_0xac4a('0x7c'))[_0xac4a('0x72')](_0xac4a('0x73'))[_0xac4a('0x3d')]('CampaignId\x20=\x20?',_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())['where']('state\x20=\x204'))[_0xac4a('0x7e')](_0xac4a('0x6d')))['toString']();return db[_0xac4a('0x4f')][_0xac4a('0x31')](_0x1f3f1c);}return[];})[_0xac4a('0x24')](respondWithResult(_0x4447b5,null))[_0xac4a('0x44')](handleError(_0x4447b5,null));};exports[_0xac4a('0x86')]=function(_0x34787c,_0x599775,_0xbdff4b){return db[_0xac4a('0x87')][_0xac4a('0x88')]({'where':{'VoiceQueueId':_0x34787c['body'][_0xac4a('0x69')],'CampaignId':_0x34787c[_0xac4a('0x4c')][_0xac4a('0x81')],'ContactId':_0x34787c[_0xac4a('0x4c')][_0xac4a('0x6d')]}})[_0xac4a('0x24')](handleEntityNotFound(_0x599775,null))['then'](function(_0xe84bf7){if(_0xe84bf7){return _0xe84bf7;}return null;})[_0xac4a('0x24')](respondWithResult(_0x599775,null))['catch'](handleError(_0x599775,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 7735728..89592e1 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 _0xbabc=['cm_hopper_final','calleridnum','uniqueid','lodash','util','moment','rimraf','./cmHopperFinal.attributes','define','CmHopperFinal'];(function(_0x17e429,_0x26671a){var _0x3aafc4=function(_0xa673d4){while(--_0xa673d4){_0x17e429['push'](_0x17e429['shift']());}};_0x3aafc4(++_0x26671a);}(_0xbabc,0xfd));var _0xcbab=function(_0x13beb9,_0x1f14c9){_0x13beb9=_0x13beb9-0x0;var _0xa3df3d=_0xbabc[_0x13beb9];return _0xa3df3d;};'use strict';var _=require(_0xcbab('0x0'));var util=require(_0xcbab('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcbab('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcbab('0x3'));var config=require('../../config/environment');var attributes=require(_0xcbab('0x4'));module['exports']=function(_0x3499ea,_0x3ac788){return _0x3499ea[_0xcbab('0x5')](_0xcbab('0x6'),attributes,{'tableName':_0xcbab('0x7'),'paranoid':![],'indexes':[{'name':_0xcbab('0x8'),'fields':[_0xcbab('0x8')]},{'name':_0xcbab('0x9'),'fields':[_0xcbab('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1b02=['calleridnum','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final'];(function(_0x5f1dab,_0x3b9f18){var _0x2791fa=function(_0x4d618b){while(--_0x4d618b){_0x5f1dab['push'](_0x5f1dab['shift']());}};_0x2791fa(++_0x3b9f18);}(_0x1b02,0x7a));var _0x21b0=function(_0x45271c,_0x1bf2d8){_0x45271c=_0x45271c-0x0;var _0x44bfda=_0x1b02[_0x45271c];return _0x44bfda;};'use strict';var _=require(_0x21b0('0x0'));var util=require(_0x21b0('0x1'));var logger=require(_0x21b0('0x2'))(_0x21b0('0x3'));var moment=require('moment');var BPromise=require(_0x21b0('0x4'));var rp=require(_0x21b0('0x5'));var fs=require('fs');var path=require(_0x21b0('0x6'));var rimraf=require(_0x21b0('0x7'));var config=require(_0x21b0('0x8'));var attributes=require(_0x21b0('0x9'));module['exports']=function(_0x107ee9,_0x35d479){return _0x107ee9[_0x21b0('0xa')](_0x21b0('0xb'),attributes,{'tableName':_0x21b0('0xc'),'paranoid':![],'indexes':[{'name':_0x21b0('0xd'),'fields':['calleridnum']},{'name':_0x21b0('0xe'),'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 c53548d..19d97c4 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(_0x309b6a,_0x25bfcd){var _0x73e219=function(_0x2d692f){while(--_0x2d692f){_0x309b6a['push'](_0x309b6a['shift']());}};_0x73e219(++_0x25bfcd);}(_0xb10b,0x12a));var _0xbb10=function(_0x571a36,_0x5936f2){_0x571a36=_0x571a36-0x0;var _0x4dd68e=_0xb10b[_0x571a36];return _0x4dd68e;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x53ea2c,_0x373926){var _0x592843=function(_0x2f604a){while(--_0x2f604a){_0x53ea2c['push'](_0x53ea2c['shift']());}};_0x592843(++_0x373926);}(_0xb10b,0x12a));var _0xbb10=function(_0x55f380,_0x3e27f0){_0x55f380=_0x55f380-0x0;var _0x36b38e=_0xb10b[_0x55f380];return _0x36b38e;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 2861c88..2445f27 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 _0xa72d=['describe','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get'];(function(_0x457bc6,_0x431adc){var _0x337f06=function(_0x158788){while(--_0x158788){_0x457bc6['push'](_0x457bc6['shift']());}};_0x337f06(++_0x431adc);}(_0xa72d,0x1bf));var _0xda72=function(_0x3fc1d5,_0x4a4e2c){_0x3fc1d5=_0x3fc1d5-0x0;var _0x1b68eb=_0xa72d[_0x3fc1d5];return _0x1b68eb;};'use strict';var multer=require(_0xda72('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xda72('0x1'));var express=require(_0xda72('0x2'));var router=express[_0xda72('0x3')]();var fs_extra=require(_0xda72('0x4'));var auth=require(_0xda72('0x5'));var interaction=require(_0xda72('0x6'));var config=require(_0xda72('0x7'));var controller=require(_0xda72('0x8'));router['get']('/',auth[_0xda72('0x9')](),controller[_0xda72('0xa')]);router[_0xda72('0xb')]('/describe',auth[_0xda72('0x9')](),controller[_0xda72('0xc')]);router[_0xda72('0xb')](_0xda72('0xd'),auth[_0xda72('0x9')](),controller[_0xda72('0xe')]);router[_0xda72('0xb')](_0xda72('0xf'),auth[_0xda72('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0xda72('0x10'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0xda72('0x11')](_0xda72('0x12'),auth['isAuthenticated'](),controller[_0xda72('0x13')]);router[_0xda72('0x11')](_0xda72('0x14'),auth[_0xda72('0x9')](),controller[_0xda72('0x15')]);router['post'](_0xda72('0x16'),auth[_0xda72('0x9')](),controller[_0xda72('0x17')]);router[_0xda72('0x18')](_0xda72('0xd'),auth[_0xda72('0x9')](),controller[_0xda72('0x19')]);module[_0xda72('0x1a')]=router; \ No newline at end of file +var _0xfc9a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','checkContactHopper','put','/:id','update','exports','multer','util','path','connect-timeout'];(function(_0xfe26da,_0x5ac1b7){var _0x2abe6e=function(_0x586ea1){while(--_0x586ea1){_0xfe26da['push'](_0xfe26da['shift']());}};_0x2abe6e(++_0x5ac1b7);}(_0xfc9a,0x83));var _0xafc9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfc9a[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xafc9('0x0'));var util=require(_0xafc9('0x1'));var path=require(_0xafc9('0x2'));var timeout=require(_0xafc9('0x3'));var express=require(_0xafc9('0x4'));var router=express[_0xafc9('0x5')]();var fs_extra=require(_0xafc9('0x6'));var auth=require(_0xafc9('0x7'));var interaction=require(_0xafc9('0x8'));var config=require(_0xafc9('0x9'));var controller=require(_0xafc9('0xa'));router[_0xafc9('0xb')]('/',auth[_0xafc9('0xc')](),controller[_0xafc9('0xd')]);router['get'](_0xafc9('0xe'),auth[_0xafc9('0xc')](),controller[_0xafc9('0xf')]);router['get']('/:id',auth[_0xafc9('0xc')](),controller['show']);router[_0xafc9('0xb')](_0xafc9('0x10'),auth[_0xafc9('0xc')](),controller[_0xafc9('0x11')]);router['get']('/campaign/countAttributes/:id',auth[_0xafc9('0xc')](),controller[_0xafc9('0x12')]);router[_0xafc9('0x13')](_0xafc9('0x14'),auth[_0xafc9('0xc')](),controller[_0xafc9('0x15')]);router[_0xafc9('0x13')]('/voice/campaign/moveContacts/:id',auth[_0xafc9('0xc')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xafc9('0x13')]('/checkContactHopper',auth[_0xafc9('0xc')](),controller[_0xafc9('0x16')]);router[_0xafc9('0x17')](_0xafc9('0x18'),auth[_0xafc9('0xc')](),controller[_0xafc9('0x19')]);module[_0xafc9('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 6775b8c..90bde52 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 _0x6ee7=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x3a630a,_0x19db43){var _0x487f2c=function(_0x444b33){while(--_0x444b33){_0x3a630a['push'](_0x3a630a['shift']());}};_0x487f2c(++_0x19db43);}(_0x6ee7,0x1e1));var _0x76ee=function(_0x29dee5,_0x49761c){_0x29dee5=_0x29dee5-0x0;var _0x5f1bd9=_0x6ee7[_0x29dee5];return _0x5f1bd9;};'use strict';var Sequelize=require(_0x76ee('0x0'));module[_0x76ee('0x1')]={'state':{'type':Sequelize[_0x76ee('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x76ee('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x76ee('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x76ee('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x76ee('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x76ee('0x3')]},'originatecalleridname':{'type':Sequelize[_0x76ee('0x3')]},'calleridnum':{'type':Sequelize[_0x76ee('0x3')]},'calleridname':{'type':Sequelize[_0x76ee('0x3')]},'starttime':{'type':Sequelize[_0x76ee('0x4')]},'responsetime':{'type':Sequelize[_0x76ee('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x76ee('0x4')]},'endtime':{'type':Sequelize[_0x76ee('0x4')]},'ringtime':{'type':Sequelize[_0x76ee('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x76ee('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x76ee('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x76ee('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x76ee('0x3')]},'membername':{'type':Sequelize[_0x76ee('0x3')]},'reason':{'type':Sequelize[_0x76ee('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x76ee('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x76ee('0x4')]},'recallme':{'type':Sequelize[_0x76ee('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x76ee('0x4')]},'edited':{'type':Sequelize[_0x76ee('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x76ee('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x76ee('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x76ee('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x76ee('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x76ee('0x3')]}}; \ No newline at end of file +var _0x4e47=['STRING','DATE','BOOLEAN','INTEGER'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x4e47,0x17f));var _0x74e4=function(_0xbff951,_0xdcf1c2){_0xbff951=_0xbff951-0x0;var _0x160da3=_0x4e47[_0xbff951];return _0x160da3;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x74e4('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x74e4('0x1')]},'scheduledat':{'type':Sequelize[_0x74e4('0x2')]},'countbusyretry':{'type':Sequelize[_0x74e4('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x74e4('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x74e4('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x74e4('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x74e4('0x1')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x74e4('0x1')]},'calleridnum':{'type':Sequelize[_0x74e4('0x1')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x74e4('0x2')]},'responsetime':{'type':Sequelize[_0x74e4('0x2')]},'answertime':{'type':Sequelize[_0x74e4('0x2')]},'droptime':{'type':Sequelize[_0x74e4('0x2')]},'endtime':{'type':Sequelize[_0x74e4('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x74e4('0x0')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x74e4('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x74e4('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x74e4('0x1')]},'campaign':{'type':Sequelize[_0x74e4('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x74e4('0x1')]},'reason':{'type':Sequelize[_0x74e4('0x1')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x74e4('0x3')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x74e4('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x74e4('0x2')]},'recallme':{'type':Sequelize[_0x74e4('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x74e4('0x2')]},'edited':{'type':Sequelize[_0x74e4('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x74e4('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x74e4('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x74e4('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x74e4('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x74e4('0x0')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x74e4('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index ee5d40d..efe27a6 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 _0x47e4=['reject','then','destroy','error','name','index','map','CmHopperHistory','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','show','params','options','find','catch','create','describe','update','body','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply'];(function(_0xfe9a48,_0x4f5feb){var _0x16a6c0=function(_0xbeb0ea){while(--_0xbeb0ea){_0xfe9a48['push'](_0xfe9a48['shift']());}};_0x16a6c0(++_0x4f5feb);}(_0x47e4,0x105));var _0x447e=function(_0x5520c7,_0xbee449){_0x5520c7=_0x5520c7-0x0;var _0x3b0590=_0x47e4[_0x5520c7];return _0x3b0590;};'use strict';var emlformat=require(_0x447e('0x0'));var rimraf=require(_0x447e('0x1'));var zipdir=require(_0x447e('0x2'));var jsonpatch=require(_0x447e('0x3'));var rp=require(_0x447e('0x4'));var moment=require(_0x447e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x447e('0x6'));var util=require(_0x447e('0x7'));var path=require(_0x447e('0x8'));var sox=require(_0x447e('0x9'));var csv=require(_0x447e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x447e('0xb'));var _=require('lodash');var squel=require(_0x447e('0xc'));var crypto=require(_0x447e('0xd'));var jsforce=require(_0x447e('0xe'));var deskjs=require(_0x447e('0xf'));var toCsv=require(_0x447e('0xa'));var querystring=require(_0x447e('0x10'));var Papa=require(_0x447e('0x11'));var Redis=require(_0x447e('0x12'));var authService=require(_0x447e('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x447e('0x14'))('api');var utils=require(_0x447e('0x15'));var config=require(_0x447e('0x16'));var licenseUtil=require(_0x447e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xdabcf1,_0x5e8245){_0x5e8245=_0x5e8245||0xcc;return function(_0x3b5902){if(_0x3b5902){return _0xdabcf1[_0x447e('0x18')](_0x5e8245);}return _0xdabcf1[_0x447e('0x19')](_0x5e8245)[_0x447e('0x1a')]();};}function respondWithResult(_0x13e81e,_0x2b5fcb){_0x2b5fcb=_0x2b5fcb||0xc8;return function(_0xf11b50){if(_0xf11b50){return _0x13e81e['status'](_0x2b5fcb)[_0x447e('0x1b')](_0xf11b50);}};}function respondWithFilteredResult(_0x29d10e,_0x3ca235){return function(_0x3311af){if(_0x3311af){var _0x427297=typeof _0x3ca235['offset']===_0x447e('0x1c')&&typeof _0x3ca235[_0x447e('0x1d')]===_0x447e('0x1c');var _0x233018=_0x3311af[_0x447e('0x1e')];var _0x577330=_0x427297?0x0:_0x3ca235[_0x447e('0x1f')];var _0x44a6eb=_0x427297?_0x3311af[_0x447e('0x1e')]:_0x3ca235[_0x447e('0x1f')]+_0x3ca235['limit'];var _0x202842;if(_0x44a6eb>=_0x233018){_0x44a6eb=_0x233018;_0x202842=0xc8;}else{_0x202842=0xce;}_0x29d10e[_0x447e('0x19')](_0x202842);return _0x29d10e[_0x447e('0x20')](_0x447e('0x21'),_0x577330+'-'+_0x44a6eb+'/'+_0x233018)[_0x447e('0x1b')](_0x3311af);}return null;};}function patchUpdates(_0x57f643){return function(_0x437c34){try{jsonpatch[_0x447e('0x22')](_0x437c34,_0x57f643,!![]);}catch(_0x2e67d9){return BPromise[_0x447e('0x23')](_0x2e67d9);}return _0x437c34['save']();};}function saveUpdates(_0x1dab90,_0x29a990){return function(_0x5aad00){if(_0x5aad00){return _0x5aad00['update'](_0x1dab90)[_0x447e('0x24')](function(_0x442f9f){return _0x442f9f;});}return null;};}function removeEntity(_0x1d2356,_0x4461d6){return function(_0x4cda8f){if(_0x4cda8f){return _0x4cda8f[_0x447e('0x25')]()[_0x447e('0x24')](function(){_0x1d2356[_0x447e('0x19')](0xcc)[_0x447e('0x1a')]();});}};}function handleEntityNotFound(_0x56bf31,_0x59f728){return function(_0x59415b){if(!_0x59415b){_0x56bf31[_0x447e('0x18')](0x194);}return _0x59415b;};}function handleError(_0xfbfd0d,_0x1caca8){_0x1caca8=_0x1caca8||0x1f4;return function(_0x4961ba){logger[_0x447e('0x26')](_0x4961ba['stack']);if(_0x4961ba['name']){delete _0x4961ba[_0x447e('0x27')];}_0xfbfd0d[_0x447e('0x19')](_0x1caca8)['send'](_0x4961ba);};}exports[_0x447e('0x28')]=function(_0x26682d,_0x2494ed){var _0x4e0ed1={},_0x9a31b9={},_0x4df894={'count':0x0,'rows':[]};var _0x35284a=_[_0x447e('0x29')](db[_0x447e('0x2a')][_0x447e('0x2b')],function(_0x1c91f9){return{'name':_0x1c91f9['fieldName'],'type':_0x1c91f9[_0x447e('0x2c')][_0x447e('0x2d')]};});_0x9a31b9['model']=_[_0x447e('0x29')](_0x35284a,_0x447e('0x27'));_0x9a31b9[_0x447e('0x2e')]=_[_0x447e('0x2f')](_0x26682d[_0x447e('0x2e')]);_0x9a31b9[_0x447e('0x30')]=_[_0x447e('0x31')](_0x9a31b9[_0x447e('0x32')],_0x9a31b9[_0x447e('0x2e')]);_0x4e0ed1[_0x447e('0x33')]=_[_0x447e('0x31')](_0x9a31b9['model'],qs[_0x447e('0x34')](_0x26682d[_0x447e('0x2e')][_0x447e('0x34')]));_0x4e0ed1[_0x447e('0x33')]=_0x4e0ed1[_0x447e('0x33')][_0x447e('0x35')]?_0x4e0ed1[_0x447e('0x33')]:_0x9a31b9[_0x447e('0x32')];if(!_0x26682d[_0x447e('0x2e')][_0x447e('0x36')]('nolimit')){_0x4e0ed1[_0x447e('0x1d')]=qs[_0x447e('0x1d')](_0x26682d[_0x447e('0x2e')]['limit']);_0x4e0ed1['offset']=qs[_0x447e('0x1f')](_0x26682d[_0x447e('0x2e')][_0x447e('0x1f')]);}_0x4e0ed1[_0x447e('0x37')]=qs[_0x447e('0x38')](_0x26682d[_0x447e('0x2e')][_0x447e('0x38')]);_0x4e0ed1[_0x447e('0x39')]=qs['filters'](_[_0x447e('0x3a')](_0x26682d[_0x447e('0x2e')],_0x9a31b9[_0x447e('0x30')]),_0x35284a);if(_0x26682d[_0x447e('0x2e')][_0x447e('0x3b')]){_0x4e0ed1[_0x447e('0x39')]=_[_0x447e('0x3c')](_0x4e0ed1[_0x447e('0x39')],{'$or':_[_0x447e('0x29')](_0x35284a,function(_0x23831b){if(_0x23831b[_0x447e('0x2c')]!==_0x447e('0x3d')){var _0x2a5914={};_0x2a5914[_0x23831b['name']]={'$like':'%'+_0x26682d['query']['filter']+'%'};return _0x2a5914;}})});}_0x4e0ed1=_[_0x447e('0x3c')]({},_0x4e0ed1,_0x26682d['options']);var _0x169775={'where':_0x4e0ed1[_0x447e('0x39')]};return db[_0x447e('0x2a')][_0x447e('0x1e')](_0x169775)[_0x447e('0x24')](function(_0x4866b0){_0x4df894[_0x447e('0x1e')]=_0x4866b0;if(_0x26682d[_0x447e('0x2e')][_0x447e('0x3e')]){_0x4e0ed1[_0x447e('0x3f')]=[{'all':!![]}];}return db[_0x447e('0x2a')]['findAll'](_0x4e0ed1);})['then'](function(_0x541935){_0x4df894['rows']=_0x541935;return _0x4df894;})[_0x447e('0x24')](respondWithFilteredResult(_0x2494ed,_0x4e0ed1))['catch'](handleError(_0x2494ed,null));};exports[_0x447e('0x40')]=function(_0x195fcd,_0x50fcac){var _0x2e258a={'raw':!![],'where':{'id':_0x195fcd[_0x447e('0x41')]['id']}},_0x206297={};_0x206297[_0x447e('0x32')]=_['keys'](db[_0x447e('0x2a')][_0x447e('0x2b')]);_0x206297[_0x447e('0x2e')]=_[_0x447e('0x2f')](_0x195fcd[_0x447e('0x2e')]);_0x206297['filters']=_[_0x447e('0x31')](_0x206297['model'],_0x206297[_0x447e('0x2e')]);_0x2e258a[_0x447e('0x33')]=_['intersection'](_0x206297['model'],qs[_0x447e('0x34')](_0x195fcd[_0x447e('0x2e')]['fields']));_0x2e258a[_0x447e('0x33')]=_0x2e258a[_0x447e('0x33')][_0x447e('0x35')]?_0x2e258a[_0x447e('0x33')]:_0x206297[_0x447e('0x32')];if(_0x195fcd[_0x447e('0x2e')][_0x447e('0x3e')]){_0x2e258a[_0x447e('0x3f')]=[{'all':!![]}];}_0x2e258a=_[_0x447e('0x3c')]({},_0x2e258a,_0x195fcd[_0x447e('0x42')]);return db[_0x447e('0x2a')][_0x447e('0x43')](_0x2e258a)[_0x447e('0x24')](handleEntityNotFound(_0x50fcac,null))[_0x447e('0x24')](respondWithResult(_0x50fcac,null))[_0x447e('0x44')](handleError(_0x50fcac,null));};exports['create']=function(_0x593558,_0x1a0eaa){return db[_0x447e('0x2a')][_0x447e('0x45')](_0x593558['body'],{})['then'](respondWithResult(_0x1a0eaa,0xc9))[_0x447e('0x44')](handleError(_0x1a0eaa,null));};exports[_0x447e('0x46')]=function(_0x29c95e,_0x20caf5){return db['CmHopperHistory'][_0x447e('0x46')]()[_0x447e('0x24')](respondWithResult(_0x20caf5,null))['catch'](handleError(_0x20caf5,null));};exports[_0x447e('0x47')]=function(_0x555bea,_0x3e7497){if(_0x555bea[_0x447e('0x48')][_0x447e('0x49')]){delete _0x555bea['body'][_0x447e('0x49')];}return db[_0x447e('0x2a')][_0x447e('0x43')]({'where':{'uniqueid':_0x555bea[_0x447e('0x41')]['id']}})['then'](handleEntityNotFound(_0x3e7497,null))[_0x447e('0x24')](saveUpdates(_0x555bea[_0x447e('0x48')],null))['then'](respondWithResult(_0x3e7497,null))[_0x447e('0x44')](handleError(_0x3e7497,null));}; \ No newline at end of file +var _0x133a=['include','CmHopperHistory','findAll','rows','show','params','merge','catch','create','body','describe','uniqueid','find','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','offset','count','apply','reject','save','update','then','destroy','end','stack','name','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','filters','filter','VIRTUAL','options','includeAll'];(function(_0x464fc3,_0x56f0db){var _0x5a18d0=function(_0x18587d){while(--_0x18587d){_0x464fc3['push'](_0x464fc3['shift']());}};_0x5a18d0(++_0x56f0db);}(_0x133a,0x121));var _0xa133=function(_0x2a9d17,_0x27fa70){_0x2a9d17=_0x2a9d17-0x0;var _0x39bafb=_0x133a[_0x2a9d17];return _0x39bafb;};'use strict';var emlformat=require(_0xa133('0x0'));var rimraf=require(_0xa133('0x1'));var zipdir=require(_0xa133('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa133('0x3'));var BPromise=require(_0xa133('0x4'));var Mustache=require(_0xa133('0x5'));var util=require(_0xa133('0x6'));var path=require(_0xa133('0x7'));var sox=require('sox');var csv=require(_0xa133('0x8'));var ejs=require(_0xa133('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa133('0xa'));var squel=require(_0xa133('0xb'));var crypto=require(_0xa133('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa133('0xd'));var toCsv=require(_0xa133('0x8'));var querystring=require(_0xa133('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa133('0xf'));var logger=require(_0xa133('0x10'))(_0xa133('0x11'));var utils=require(_0xa133('0x12'));var config=require(_0xa133('0x13'));var licenseUtil=require(_0xa133('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bfa0c,_0x28608a){_0x28608a=_0x28608a||0xcc;return function(_0x1af25d){if(_0x1af25d){return _0x4bfa0c[_0xa133('0x15')](_0x28608a);}return _0x4bfa0c[_0xa133('0x16')](_0x28608a)['end']();};}function respondWithResult(_0x776d9,_0x350a8f){_0x350a8f=_0x350a8f||0xc8;return function(_0x2705d1){if(_0x2705d1){return _0x776d9[_0xa133('0x16')](_0x350a8f)[_0xa133('0x17')](_0x2705d1);}};}function respondWithFilteredResult(_0x1ab43d,_0x40d25f){return function(_0x53829b){if(_0x53829b){var _0xe51697=typeof _0x40d25f['offset']===_0xa133('0x18')&&typeof _0x40d25f[_0xa133('0x19')]===_0xa133('0x18');var _0xa2740e=_0x53829b['count'];var _0x46df4f=_0xe51697?0x0:_0x40d25f[_0xa133('0x1a')];var _0x1e5b1a=_0xe51697?_0x53829b[_0xa133('0x1b')]:_0x40d25f[_0xa133('0x1a')]+_0x40d25f[_0xa133('0x19')];var _0x1b2f96;if(_0x1e5b1a>=_0xa2740e){_0x1e5b1a=_0xa2740e;_0x1b2f96=0xc8;}else{_0x1b2f96=0xce;}_0x1ab43d[_0xa133('0x16')](_0x1b2f96);return _0x1ab43d['set']('Content-Range',_0x46df4f+'-'+_0x1e5b1a+'/'+_0xa2740e)[_0xa133('0x17')](_0x53829b);}return null;};}function patchUpdates(_0x37191a){return function(_0x50125b){try{jsonpatch[_0xa133('0x1c')](_0x50125b,_0x37191a,!![]);}catch(_0x5bcffc){return BPromise[_0xa133('0x1d')](_0x5bcffc);}return _0x50125b[_0xa133('0x1e')]();};}function saveUpdates(_0x1cf9a6,_0xece820){return function(_0x277652){if(_0x277652){return _0x277652[_0xa133('0x1f')](_0x1cf9a6)[_0xa133('0x20')](function(_0x1082a8){return _0x1082a8;});}return null;};}function removeEntity(_0x20d1dc,_0x41ecdd){return function(_0x3c1e1d){if(_0x3c1e1d){return _0x3c1e1d[_0xa133('0x21')]()[_0xa133('0x20')](function(){_0x20d1dc[_0xa133('0x16')](0xcc)[_0xa133('0x22')]();});}};}function handleEntityNotFound(_0x5289d2,_0x1e88bc){return function(_0x439c12){if(!_0x439c12){_0x5289d2[_0xa133('0x15')](0x194);}return _0x439c12;};}function handleError(_0x29715c,_0x5afade){_0x5afade=_0x5afade||0x1f4;return function(_0x2a64c5){logger['error'](_0x2a64c5[_0xa133('0x23')]);if(_0x2a64c5[_0xa133('0x24')]){delete _0x2a64c5[_0xa133('0x24')];}_0x29715c['status'](_0x5afade)['send'](_0x2a64c5);};}exports[_0xa133('0x25')]=function(_0x2d90ad,_0x80adff){var _0x1f94b3={},_0x5450f8={},_0x1ece32={'count':0x0,'rows':[]};var _0x237603=_[_0xa133('0x26')](db['CmHopperHistory'][_0xa133('0x27')],function(_0x5a6625){return{'name':_0x5a6625['fieldName'],'type':_0x5a6625[_0xa133('0x28')][_0xa133('0x29')]};});_0x5450f8[_0xa133('0x2a')]=_[_0xa133('0x26')](_0x237603,_0xa133('0x24'));_0x5450f8[_0xa133('0x2b')]=_[_0xa133('0x2c')](_0x2d90ad[_0xa133('0x2b')]);_0x5450f8['filters']=_[_0xa133('0x2d')](_0x5450f8[_0xa133('0x2a')],_0x5450f8['query']);_0x1f94b3[_0xa133('0x2e')]=_[_0xa133('0x2d')](_0x5450f8[_0xa133('0x2a')],qs[_0xa133('0x2f')](_0x2d90ad[_0xa133('0x2b')][_0xa133('0x2f')]));_0x1f94b3[_0xa133('0x2e')]=_0x1f94b3[_0xa133('0x2e')]['length']?_0x1f94b3[_0xa133('0x2e')]:_0x5450f8[_0xa133('0x2a')];if(!_0x2d90ad[_0xa133('0x2b')][_0xa133('0x30')]('nolimit')){_0x1f94b3[_0xa133('0x19')]=qs[_0xa133('0x19')](_0x2d90ad[_0xa133('0x2b')][_0xa133('0x19')]);_0x1f94b3[_0xa133('0x1a')]=qs[_0xa133('0x1a')](_0x2d90ad[_0xa133('0x2b')][_0xa133('0x1a')]);}_0x1f94b3['order']=qs[_0xa133('0x31')](_0x2d90ad[_0xa133('0x2b')][_0xa133('0x31')]);_0x1f94b3[_0xa133('0x32')]=qs[_0xa133('0x33')](_['pick'](_0x2d90ad[_0xa133('0x2b')],_0x5450f8[_0xa133('0x33')]),_0x237603);if(_0x2d90ad['query'][_0xa133('0x34')]){_0x1f94b3['where']=_['merge'](_0x1f94b3[_0xa133('0x32')],{'$or':_[_0xa133('0x26')](_0x237603,function(_0x1b673d){if(_0x1b673d[_0xa133('0x28')]!==_0xa133('0x35')){var _0x53742e={};_0x53742e[_0x1b673d[_0xa133('0x24')]]={'$like':'%'+_0x2d90ad[_0xa133('0x2b')][_0xa133('0x34')]+'%'};return _0x53742e;}})});}_0x1f94b3=_['merge']({},_0x1f94b3,_0x2d90ad[_0xa133('0x36')]);var _0x3a4a4c={'where':_0x1f94b3[_0xa133('0x32')]};return db['CmHopperHistory'][_0xa133('0x1b')](_0x3a4a4c)[_0xa133('0x20')](function(_0x3a496c){_0x1ece32[_0xa133('0x1b')]=_0x3a496c;if(_0x2d90ad[_0xa133('0x2b')][_0xa133('0x37')]){_0x1f94b3[_0xa133('0x38')]=[{'all':!![]}];}return db[_0xa133('0x39')][_0xa133('0x3a')](_0x1f94b3);})[_0xa133('0x20')](function(_0x5af674){_0x1ece32[_0xa133('0x3b')]=_0x5af674;return _0x1ece32;})['then'](respondWithFilteredResult(_0x80adff,_0x1f94b3))['catch'](handleError(_0x80adff,null));};exports[_0xa133('0x3c')]=function(_0x1b66ab,_0x54505c){var _0x32a57a={'raw':!![],'where':{'id':_0x1b66ab[_0xa133('0x3d')]['id']}},_0x1dbd8a={};_0x1dbd8a['model']=_[_0xa133('0x2c')](db['CmHopperHistory'][_0xa133('0x27')]);_0x1dbd8a[_0xa133('0x2b')]=_[_0xa133('0x2c')](_0x1b66ab[_0xa133('0x2b')]);_0x1dbd8a[_0xa133('0x33')]=_['intersection'](_0x1dbd8a[_0xa133('0x2a')],_0x1dbd8a[_0xa133('0x2b')]);_0x32a57a[_0xa133('0x2e')]=_[_0xa133('0x2d')](_0x1dbd8a[_0xa133('0x2a')],qs[_0xa133('0x2f')](_0x1b66ab[_0xa133('0x2b')][_0xa133('0x2f')]));_0x32a57a['attributes']=_0x32a57a[_0xa133('0x2e')]['length']?_0x32a57a[_0xa133('0x2e')]:_0x1dbd8a[_0xa133('0x2a')];if(_0x1b66ab['query'][_0xa133('0x37')]){_0x32a57a[_0xa133('0x38')]=[{'all':!![]}];}_0x32a57a=_[_0xa133('0x3e')]({},_0x32a57a,_0x1b66ab['options']);return db['CmHopperHistory']['find'](_0x32a57a)[_0xa133('0x20')](handleEntityNotFound(_0x54505c,null))[_0xa133('0x20')](respondWithResult(_0x54505c,null))[_0xa133('0x3f')](handleError(_0x54505c,null));};exports['create']=function(_0x4aa56d,_0x553544){return db[_0xa133('0x39')][_0xa133('0x40')](_0x4aa56d[_0xa133('0x41')],{})[_0xa133('0x20')](respondWithResult(_0x553544,0xc9))['catch'](handleError(_0x553544,null));};exports[_0xa133('0x42')]=function(_0x3d200,_0x2174b5){return db['CmHopperHistory'][_0xa133('0x42')]()[_0xa133('0x20')](respondWithResult(_0x2174b5,null))[_0xa133('0x3f')](handleError(_0x2174b5,null));};exports[_0xa133('0x1f')]=function(_0x7c31bc,_0x2c90ee){if(_0x7c31bc[_0xa133('0x41')][_0xa133('0x43')]){delete _0x7c31bc[_0xa133('0x41')][_0xa133('0x43')];}return db[_0xa133('0x39')][_0xa133('0x44')]({'where':{'uniqueid':_0x7c31bc[_0xa133('0x3d')]['id']}})[_0xa133('0x20')](handleEntityNotFound(_0x2c90ee,null))['then'](saveUpdates(_0x7c31bc[_0xa133('0x41')],null))[_0xa133('0x20')](respondWithResult(_0x2c90ee,null))['catch'](handleError(_0x2c90ee,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 4e904ef..de0764b 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 _0x7b77=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','lodash'];(function(_0x2a4d76,_0x5da602){var _0x313f01=function(_0x536c12){while(--_0x536c12){_0x2a4d76['push'](_0x2a4d76['shift']());}};_0x313f01(++_0x5da602);}(_0x7b77,0x179));var _0x77b7=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x7b77[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x77b7('0x0'));var util=require(_0x77b7('0x1'));var logger=require(_0x77b7('0x2'))(_0x77b7('0x3'));var moment=require('moment');var BPromise=require(_0x77b7('0x4'));var rp=require(_0x77b7('0x5'));var fs=require('fs');var path=require(_0x77b7('0x6'));var rimraf=require('rimraf');var config=require(_0x77b7('0x7'));var attributes=require(_0x77b7('0x8'));module[_0x77b7('0x9')]=function(_0x3d97f0,_0x4556c1){return _0x3d97f0[_0x77b7('0xa')]('CmHopperHistory',attributes,{'tableName':_0x77b7('0xb'),'paranoid':![],'indexes':[{'name':_0x77b7('0xc'),'fields':[_0x77b7('0xc')]},{'name':'uniqueid','fields':[_0x77b7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc95=['lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','CmHopperHistory','endtime','uniqueid'];(function(_0x59cd49,_0x2cedfd){var _0x2b05e4=function(_0x10d459){while(--_0x10d459){_0x59cd49['push'](_0x59cd49['shift']());}};_0x2b05e4(++_0x2cedfd);}(_0xbc95,0x1f4));var _0x5bc9=function(_0x3328bd,_0x34b6cc){_0x3328bd=_0x3328bd-0x0;var _0xf2012a=_0xbc95[_0x3328bd];return _0xf2012a;};'use strict';var _=require(_0x5bc9('0x0'));var util=require(_0x5bc9('0x1'));var logger=require(_0x5bc9('0x2'))(_0x5bc9('0x3'));var moment=require(_0x5bc9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5bc9('0x5'));var config=require(_0x5bc9('0x6'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x5cca07,_0x889a0e){return _0x5cca07['define'](_0x5bc9('0x7'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x5bc9('0x8')]},{'name':_0x5bc9('0x9'),'fields':[_0x5bc9('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 5f7cf42..51f33a7 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 _0xa1f1=['CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','body','options','raw','debug','AvgHandleTime','CmHopperHistory','findAll','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x2010,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','then','GetCampaignHopperHistory','col','ivrTotalCallsDays','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent'];(function(_0x47313d,_0x2128c4){var _0x1ca6f0=function(_0x5dc4ed){while(--_0x5dc4ed){_0x47313d['push'](_0x47313d['shift']());}};_0x1ca6f0(++_0x2128c4);}(_0xa1f1,0x7b));var _0x1a1f=function(_0xac0de1,_0x12d3d9){_0xac0de1=_0xac0de1-0x0;var _0x1c1995=_0xa1f1[_0xac0de1];return _0x1c1995;};'use strict';var _=require('lodash');var util=require(_0x1a1f('0x0'));var moment=require(_0x1a1f('0x1'));var BPromise=require(_0x1a1f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a1f('0x3'))['db'];var utils=require(_0x1a1f('0x4'));var logger=require(_0x1a1f('0x5'))(_0x1a1f('0x6'));var config=require(_0x1a1f('0x7'));var jayson=require(_0x1a1f('0x8'));var client=jayson[_0x1a1f('0x9')][_0x1a1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x187398,_0x3ec84e,_0x536442){return new BPromise(function(_0x1e608b,_0x8ecdd3){return client[_0x1a1f('0xb')](_0x187398,_0x536442)['then'](function(_0x42c485){logger[_0x1a1f('0xc')](_0x1a1f('0xd'),_0x3ec84e,_0x1a1f('0xe'));logger['debug'](_0x1a1f('0xf'),_0x3ec84e,_0x1a1f('0xe'),JSON[_0x1a1f('0x10')](_0x42c485));if(_0x42c485[_0x1a1f('0x11')]){if(_0x42c485[_0x1a1f('0x11')][_0x1a1f('0x12')]===0x1f4){logger[_0x1a1f('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x3ec84e,_0x42c485[_0x1a1f('0x11')][_0x1a1f('0x13')]);return _0x8ecdd3(_0x42c485[_0x1a1f('0x11')][_0x1a1f('0x13')]);}logger[_0x1a1f('0x11')](_0x1a1f('0xd'),_0x3ec84e,_0x42c485[_0x1a1f('0x11')][_0x1a1f('0x13')]);return _0x1e608b(_0x42c485[_0x1a1f('0x11')][_0x1a1f('0x13')]);}else{logger['info'](_0x1a1f('0xd'),_0x3ec84e,_0x1a1f('0xe'));_0x1e608b(_0x42c485[_0x1a1f('0x14')][_0x1a1f('0x13')]);}})[_0x1a1f('0x15')](function(_0x1f878d){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x3ec84e,_0x1f878d);_0x8ecdd3(_0x1f878d);});});}exports[_0x1a1f('0x16')]=function(_0x44d4b8){var _0x593d42=this;return new Promise(function(_0x65398b,_0x1a0bb9){return db['CmHopperHistory']['create'](_0x44d4b8[_0x1a1f('0x17')],{'raw':_0x44d4b8[_0x1a1f('0x18')]?_0x44d4b8[_0x1a1f('0x18')][_0x1a1f('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1c7805){logger[_0x1a1f('0xc')](_0x1a1f('0x16'),_0x44d4b8);logger[_0x1a1f('0x1a')]('CreateCmHopperHistory',_0x44d4b8,JSON[_0x1a1f('0x10')](_0x1c7805));_0x65398b(_0x1c7805);})[_0x1a1f('0x15')](function(_0x52e524){logger[_0x1a1f('0x11')](_0x1a1f('0x16'),_0x52e524[_0x1a1f('0x13')],_0x44d4b8);_0x1a0bb9(_0x593d42[_0x1a1f('0x11')](0x1f4,_0x52e524['message']));});});};exports[_0x1a1f('0x1b')]=function(_0x56c4ae){var _0xe4161a=this;return new Promise(function(_0x39c629,_0xa6198d){return db[_0x1a1f('0x1c')][_0x1a1f('0x1d')]({'raw':_0x56c4ae[_0x1a1f('0x18')]?_0x56c4ae['options'][_0x1a1f('0x19')]===undefined?!![]:![]:!![],'where':_0x56c4ae[_0x1a1f('0x18')]?_0x56c4ae[_0x1a1f('0x18')][_0x1a1f('0x1e')]||null:null,'attributes':[[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db['sequelize']['col']('id')),_0x1a1f('0x21')],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db['sequelize']['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')](_0x1a1f('0x23')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x24'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')](_0x1a1f('0x25')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn'](_0x1a1f('0x24'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')]['literal'](_0x1a1f('0x26')))),_0x1a1f('0x27')]]})['then'](function(_0x4c8470){logger[_0x1a1f('0xc')](_0x1a1f('0x1b'),_0x56c4ae);logger[_0x1a1f('0x1a')](_0x1a1f('0x1b'),_0x56c4ae,JSON[_0x1a1f('0x10')](_0x4c8470));_0x39c629(_0x4c8470);})['catch'](function(_0x347fe0){logger[_0x1a1f('0x11')](_0x1a1f('0x1b'),_0x347fe0[_0x1a1f('0x13')],_0x56c4ae);_0xa6198d(_0xe4161a['error'](0x1f4,_0x347fe0['message']));});});};exports[_0x1a1f('0x28')]=function(_0x1e88ad){var _0x4aead7=this;return new Promise(function(_0x39c8a0,_0x576190){return db['CmHopperHistory'][_0x1a1f('0x1d')]({'raw':_0x1e88ad[_0x1a1f('0x18')]?_0x1e88ad[_0x1a1f('0x18')][_0x1a1f('0x19')]===undefined?!![]:![]:!![],'where':_0x1e88ad[_0x1a1f('0x18')]?_0x1e88ad['options'][_0x1a1f('0x1e')]||null:null,'attributes':[[_0x1a1f('0x29'),_0x1a1f('0x2a')],[db['sequelize']['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')](_0x1a1f('0x2b')))),_0x1a1f('0x2c')],[db['sequelize']['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')](_0x1a1f('0x2d')))),_0x1a1f('0x2e')],[db['sequelize']['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db['sequelize'][_0x1a1f('0x22')](_0x1a1f('0x2f')))),_0x1a1f('0x30')],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x1a1f('0x31')))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')](_0x1a1f('0x32')))),_0x1a1f('0x33')],[db['sequelize']['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x1a1f('0x34')))),_0x1a1f('0x35')],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db[_0x1a1f('0x1f')]['fn']('COUNT',db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')]('`state`\x20=\x2012,\x201,\x20null'))),_0x1a1f('0x36')],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db['sequelize'][_0x1a1f('0x22')](_0x1a1f('0x37')))),_0x1a1f('0x38')],[db[_0x1a1f('0x1f')]['fn']('COUNT',db[_0x1a1f('0x1f')]['fn']('IF',db['sequelize'][_0x1a1f('0x22')](_0x1a1f('0x39')))),_0x1a1f('0x3a')],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db['sequelize']['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x1a1f('0x1f')]['fn']('COUNT',db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')]['literal'](_0x1a1f('0x3b')))),_0x1a1f('0x3c')],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db['sequelize']['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')](_0x1a1f('0x3d')))),_0x1a1f('0x3e')],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db['sequelize'][_0x1a1f('0x22')](_0x1a1f('0x3f')))),_0x1a1f('0x40')]],'group':[_0x1a1f('0x29')]})[_0x1a1f('0x41')](function(_0x3f0bc3){logger[_0x1a1f('0xc')](_0x1a1f('0x28'),_0x1e88ad);logger['debug']('GetVoiceQueueHopperHistory',_0x1e88ad,JSON[_0x1a1f('0x10')](_0x3f0bc3));_0x39c8a0(_0x3f0bc3);})['catch'](function(_0x29a984){logger[_0x1a1f('0x11')](_0x1a1f('0x28'),_0x29a984['message'],_0x1e88ad);_0x576190(_0x4aead7['error'](0x1f4,_0x29a984[_0x1a1f('0x13')]));});});};exports[_0x1a1f('0x42')]=function(_0x29b1d5){var _0x17c011=this;return new Promise(function(_0x4b6988,_0x33ff8c){return db[_0x1a1f('0x1c')]['findAll']({'raw':_0x29b1d5[_0x1a1f('0x18')]?_0x29b1d5[_0x1a1f('0x18')][_0x1a1f('0x19')]===undefined?!![]:![]:!![],'where':_0x29b1d5[_0x1a1f('0x18')]?_0x29b1d5[_0x1a1f('0x18')][_0x1a1f('0x1e')]||null:null,'attributes':[[_0x1a1f('0x29'),_0x1a1f('0x2a')],[db['sequelize']['fn'](_0x1a1f('0x20'),db['sequelize'][_0x1a1f('0x43')]('id')),_0x1a1f('0x44')],[db[_0x1a1f('0x1f')]['fn']('COUNT',db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')](_0x1a1f('0x2f')))),'ivrAnswerCallsDay']],'group':[_0x1a1f('0x29')]})['then'](function(_0x32116e){logger[_0x1a1f('0xc')](_0x1a1f('0x42'),_0x29b1d5);logger[_0x1a1f('0x1a')](_0x1a1f('0x42'),_0x29b1d5,JSON[_0x1a1f('0x10')](_0x32116e));_0x4b6988(_0x32116e);})['catch'](function(_0x54200c){logger['error'](_0x1a1f('0x42'),_0x54200c[_0x1a1f('0x13')],_0x29b1d5);_0x33ff8c(_0x17c011[_0x1a1f('0x11')](0x1f4,_0x54200c[_0x1a1f('0x13')]));});});}; \ No newline at end of file +var _0xf7c3=['request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CmHopperHistory','create','body','options','raw','CreateCmHopperHistory','catch','AvgHandleTime','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x58788d,_0x88b74f){var _0x58ceba=function(_0x16a416){while(--_0x16a416){_0x58788d['push'](_0x58788d['shift']());}};_0x58ceba(++_0x88b74f);}(_0xf7c3,0x154));var _0x3f7c=function(_0x3e78f4,_0x5d4c9a){_0x3e78f4=_0x3e78f4-0x0;var _0x5ca5eb=_0xf7c3[_0x3e78f4];return _0x5ca5eb;};'use strict';var _=require(_0x3f7c('0x0'));var util=require(_0x3f7c('0x1'));var moment=require(_0x3f7c('0x2'));var BPromise=require(_0x3f7c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f7c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f7c('0x5'));var logger=require(_0x3f7c('0x6'))(_0x3f7c('0x7'));var config=require('../../config/environment');var jayson=require(_0x3f7c('0x8'));var client=jayson[_0x3f7c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x854413,_0x57ce1e,_0x3c23a2){return new BPromise(function(_0x541074,_0x1253db){return client[_0x3f7c('0xa')](_0x854413,_0x3c23a2)[_0x3f7c('0xb')](function(_0x4c7e15){logger[_0x3f7c('0xc')](_0x3f7c('0xd'),_0x57ce1e,_0x3f7c('0xe'));logger[_0x3f7c('0xf')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x57ce1e,'request\x20sent',JSON[_0x3f7c('0x10')](_0x4c7e15));if(_0x4c7e15[_0x3f7c('0x11')]){if(_0x4c7e15['error'][_0x3f7c('0x12')]===0x1f4){logger[_0x3f7c('0x11')](_0x3f7c('0xd'),_0x57ce1e,_0x4c7e15[_0x3f7c('0x11')]['message']);return _0x1253db(_0x4c7e15[_0x3f7c('0x11')][_0x3f7c('0x13')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x57ce1e,_0x4c7e15['error'][_0x3f7c('0x13')]);return _0x541074(_0x4c7e15[_0x3f7c('0x11')][_0x3f7c('0x13')]);}else{logger[_0x3f7c('0xc')](_0x3f7c('0xd'),_0x57ce1e,'request\x20sent');_0x541074(_0x4c7e15[_0x3f7c('0x14')][_0x3f7c('0x13')]);}})['catch'](function(_0x5cae3f){logger[_0x3f7c('0x11')](_0x3f7c('0xd'),_0x57ce1e,_0x5cae3f);_0x1253db(_0x5cae3f);});});}exports['CreateCmHopperHistory']=function(_0x35c3c1){var _0x12ab92=this;return new Promise(function(_0x46b625,_0x51c6d6){return db[_0x3f7c('0x15')][_0x3f7c('0x16')](_0x35c3c1[_0x3f7c('0x17')],{'raw':_0x35c3c1['options']?_0x35c3c1[_0x3f7c('0x18')][_0x3f7c('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x171c65){logger[_0x3f7c('0xc')](_0x3f7c('0x1a'),_0x35c3c1);logger[_0x3f7c('0xf')](_0x3f7c('0x1a'),_0x35c3c1,JSON[_0x3f7c('0x10')](_0x171c65));_0x46b625(_0x171c65);})[_0x3f7c('0x1b')](function(_0x3bdcf2){logger[_0x3f7c('0x11')](_0x3f7c('0x1a'),_0x3bdcf2['message'],_0x35c3c1);_0x51c6d6(_0x12ab92['error'](0x1f4,_0x3bdcf2[_0x3f7c('0x13')]));});});};exports[_0x3f7c('0x1c')]=function(_0x2dcb02){var _0x3e6bc3=this;return new Promise(function(_0x8bf234,_0x199994){return db[_0x3f7c('0x15')][_0x3f7c('0x1d')]({'raw':_0x2dcb02[_0x3f7c('0x18')]?_0x2dcb02[_0x3f7c('0x18')][_0x3f7c('0x19')]===undefined?!![]:![]:!![],'where':_0x2dcb02[_0x3f7c('0x18')]?_0x2dcb02[_0x3f7c('0x18')][_0x3f7c('0x1e')]||null:null,'attributes':[[db[_0x3f7c('0x1f')]['fn']('COUNT',db[_0x3f7c('0x1f')][_0x3f7c('0x20')]('id')),_0x3f7c('0x21')],[db['sequelize']['fn'](_0x3f7c('0x22'),db[_0x3f7c('0x1f')]['fn']('IF',db[_0x3f7c('0x1f')][_0x3f7c('0x23')](_0x3f7c('0x24')))),_0x3f7c('0x25')],[db[_0x3f7c('0x1f')]['fn'](_0x3f7c('0x22'),db[_0x3f7c('0x1f')]['fn']('IF',db[_0x3f7c('0x1f')][_0x3f7c('0x23')](_0x3f7c('0x26')))),_0x3f7c('0x27')],[db['sequelize']['fn'](_0x3f7c('0x22'),db[_0x3f7c('0x1f')]['fn']('IF',db[_0x3f7c('0x1f')][_0x3f7c('0x23')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x3f7c('0x1f')]['fn']('AVG',db[_0x3f7c('0x1f')]['fn']('IF',db[_0x3f7c('0x1f')][_0x3f7c('0x23')](_0x3f7c('0x28')))),_0x3f7c('0x29')],[db[_0x3f7c('0x1f')]['fn'](_0x3f7c('0x2a'),db[_0x3f7c('0x1f')]['fn']('IF',db[_0x3f7c('0x1f')][_0x3f7c('0x23')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x3f7c('0x2b')]]})['then'](function(_0x550c3e){logger[_0x3f7c('0xc')](_0x3f7c('0x1c'),_0x2dcb02);logger['debug']('AvgHandleTime',_0x2dcb02,JSON[_0x3f7c('0x10')](_0x550c3e));_0x8bf234(_0x550c3e);})[_0x3f7c('0x1b')](function(_0x70df6){logger[_0x3f7c('0x11')](_0x3f7c('0x1c'),_0x70df6['message'],_0x2dcb02);_0x199994(_0x3e6bc3[_0x3f7c('0x11')](0x1f4,_0x70df6[_0x3f7c('0x13')]));});});};exports[_0x3f7c('0x2c')]=function(_0x119303){var _0x284b7a=this;return new Promise(function(_0x36b6fa,_0x23c3ff){return db['CmHopperHistory']['findAll']({'raw':_0x119303[_0x3f7c('0x18')]?_0x119303['options']['raw']===undefined?!![]:![]:!![],'where':_0x119303[_0x3f7c('0x18')]?_0x119303[_0x3f7c('0x18')]['where']||null:null,'attributes':[[_0x3f7c('0x2d'),_0x3f7c('0x2e')],[db[_0x3f7c('0x1f')]['fn'](_0x3f7c('0x22'),db['sequelize']['fn']('IF',db[_0x3f7c('0x1f')]['literal'](_0x3f7c('0x2f')))),_0x3f7c('0x30')],[db['sequelize']['fn'](_0x3f7c('0x22'),db[_0x3f7c('0x1f')]['fn']('IF',db[_0x3f7c('0x1f')][_0x3f7c('0x23')](_0x3f7c('0x31')))),_0x3f7c('0x32')],[db[_0x3f7c('0x1f')]['fn'](_0x3f7c('0x22'),db[_0x3f7c('0x1f')]['fn']('IF',db[_0x3f7c('0x1f')][_0x3f7c('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0x3f7c('0x33')],[db[_0x3f7c('0x1f')]['fn']('COUNT',db[_0x3f7c('0x1f')]['fn']('IF',db[_0x3f7c('0x1f')][_0x3f7c('0x23')]('`state`\x20=\x205,\x201,\x20null'))),_0x3f7c('0x34')],[db[_0x3f7c('0x1f')]['fn'](_0x3f7c('0x22'),db['sequelize']['fn']('IF',db[_0x3f7c('0x1f')][_0x3f7c('0x23')](_0x3f7c('0x35')))),_0x3f7c('0x36')],[db[_0x3f7c('0x1f')]['fn'](_0x3f7c('0x22'),db[_0x3f7c('0x1f')]['fn']('IF',db[_0x3f7c('0x1f')][_0x3f7c('0x23')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x3f7c('0x37')],[db[_0x3f7c('0x1f')]['fn'](_0x3f7c('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0x3f7c('0x23')](_0x3f7c('0x38')))),_0x3f7c('0x39')],[db[_0x3f7c('0x1f')]['fn'](_0x3f7c('0x22'),db[_0x3f7c('0x1f')]['fn']('IF',db[_0x3f7c('0x1f')][_0x3f7c('0x23')](_0x3f7c('0x3a')))),_0x3f7c('0x3b')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3f7c('0x1f')]['literal']('`state`\x20=\x2013,\x201,\x20null'))),'outboundBlacklistCallsDay'],[db[_0x3f7c('0x1f')]['fn']('COUNT',db[_0x3f7c('0x1f')]['fn']('IF',db[_0x3f7c('0x1f')][_0x3f7c('0x23')](_0x3f7c('0x3c')))),_0x3f7c('0x3d')],[db[_0x3f7c('0x1f')]['fn']('COUNT',db[_0x3f7c('0x1f')]['fn']('IF',db[_0x3f7c('0x1f')][_0x3f7c('0x23')](_0x3f7c('0x3e')))),'outboundRejectCallsDay'],[db[_0x3f7c('0x1f')]['fn'](_0x3f7c('0x22'),db['sequelize']['fn']('IF',db[_0x3f7c('0x1f')][_0x3f7c('0x23')](_0x3f7c('0x3f')))),'outboundAnswerAgiCallsDay'],[db[_0x3f7c('0x1f')]['fn'](_0x3f7c('0x22'),db[_0x3f7c('0x1f')]['fn']('IF',db[_0x3f7c('0x1f')]['literal'](_0x3f7c('0x40')))),_0x3f7c('0x41')],[db[_0x3f7c('0x1f')]['fn']('COUNT',db[_0x3f7c('0x1f')]['fn']('IF',db[_0x3f7c('0x1f')][_0x3f7c('0x23')](_0x3f7c('0x42')))),_0x3f7c('0x43')]],'group':[_0x3f7c('0x2d')]})['then'](function(_0x53a65e){logger[_0x3f7c('0xc')](_0x3f7c('0x2c'),_0x119303);logger[_0x3f7c('0xf')](_0x3f7c('0x2c'),_0x119303,JSON['stringify'](_0x53a65e));_0x36b6fa(_0x53a65e);})['catch'](function(_0xa666ff){logger[_0x3f7c('0x11')]('GetVoiceQueueHopperHistory',_0xa666ff['message'],_0x119303);_0x23c3ff(_0x284b7a[_0x3f7c('0x11')](0x1f4,_0xa666ff[_0x3f7c('0x13')]));});});};exports['GetCampaignHopperHistory']=function(_0x1e1bf1){var _0x14089b=this;return new Promise(function(_0x3e074f,_0x433a7c){return db[_0x3f7c('0x15')][_0x3f7c('0x1d')]({'raw':_0x1e1bf1[_0x3f7c('0x18')]?_0x1e1bf1[_0x3f7c('0x18')][_0x3f7c('0x19')]===undefined?!![]:![]:!![],'where':_0x1e1bf1[_0x3f7c('0x18')]?_0x1e1bf1[_0x3f7c('0x18')]['where']||null:null,'attributes':[[_0x3f7c('0x2d'),_0x3f7c('0x2e')],[db[_0x3f7c('0x1f')]['fn'](_0x3f7c('0x22'),db['sequelize']['col']('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x3f7c('0x22'),db[_0x3f7c('0x1f')]['fn']('IF',db[_0x3f7c('0x1f')][_0x3f7c('0x23')](_0x3f7c('0x24')))),_0x3f7c('0x44')]],'group':[_0x3f7c('0x2d')]})[_0x3f7c('0xb')](function(_0x3c7adc){logger[_0x3f7c('0xc')]('GetCampaignHopperHistory',_0x1e1bf1);logger[_0x3f7c('0xf')](_0x3f7c('0x45'),_0x1e1bf1,JSON[_0x3f7c('0x10')](_0x3c7adc));_0x3e074f(_0x3c7adc);})[_0x3f7c('0x1b')](function(_0xd52014){logger['error'](_0x3f7c('0x45'),_0xd52014[_0x3f7c('0x13')],_0x1e1bf1);_0x433a7c(_0x14089b[_0x3f7c('0x11')](0x1f4,_0xd52014[_0x3f7c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index c9706d7..cd34d19 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 _0x9543=['../../config/environment','./cmHopperHistory.controller','get','index','/describe','describe','/:id','isAuthenticated','create','put','update','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x323d7e,_0x8f38de){var _0x4c053c=function(_0x51853c){while(--_0x51853c){_0x323d7e['push'](_0x323d7e['shift']());}};_0x4c053c(++_0x8f38de);}(_0x9543,0x1a4));var _0x3954=function(_0x2f3947,_0xd4b6f){_0x2f3947=_0x2f3947-0x0;var _0x424d39=_0x9543[_0x2f3947];return _0x424d39;};'use strict';var multer=require(_0x3954('0x0'));var util=require(_0x3954('0x1'));var path=require('path');var timeout=require(_0x3954('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3954('0x3'));var interaction=require(_0x3954('0x4'));var config=require(_0x3954('0x5'));var controller=require(_0x3954('0x6'));router[_0x3954('0x7')]('/',auth['isAuthenticated'](),controller[_0x3954('0x8')]);router[_0x3954('0x7')](_0x3954('0x9'),auth['isAuthenticated'](),controller[_0x3954('0xa')]);router[_0x3954('0x7')](_0x3954('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x3954('0xc')](),controller[_0x3954('0xd')]);router[_0x3954('0xe')](_0x3954('0xb'),auth['isAuthenticated'](),controller[_0x3954('0xf')]);module[_0x3954('0x10')]=router; \ No newline at end of file +var _0x1710=['path','connect-timeout','Router','fs-extra','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update','exports','util'];(function(_0x1e2321,_0x3ae1c5){var _0x1d346d=function(_0x24f171){while(--_0x24f171){_0x1e2321['push'](_0x1e2321['shift']());}};_0x1d346d(++_0x3ae1c5);}(_0x1710,0x131));var _0x0171=function(_0x14e96a,_0x384465){_0x14e96a=_0x14e96a-0x0;var _0x36eacb=_0x1710[_0x14e96a];return _0x36eacb;};'use strict';var multer=require('multer');var util=require(_0x0171('0x0'));var path=require(_0x0171('0x1'));var timeout=require(_0x0171('0x2'));var express=require('express');var router=express[_0x0171('0x3')]();var fs_extra=require(_0x0171('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0171('0x5'));var controller=require(_0x0171('0x6'));router[_0x0171('0x7')]('/',auth[_0x0171('0x8')](),controller[_0x0171('0x9')]);router[_0x0171('0x7')](_0x0171('0xa'),auth[_0x0171('0x8')](),controller['describe']);router[_0x0171('0x7')](_0x0171('0xb'),auth[_0x0171('0x8')](),controller['show']);router[_0x0171('0xc')]('/',auth['isAuthenticated'](),controller[_0x0171('0xd')]);router[_0x0171('0xe')](_0x0171('0xb'),auth[_0x0171('0x8')](),controller[_0x0171('0xf')]);module[_0x0171('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index f2b0f7d..5ff0a7b 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 _0xadf0=['name','exports','STRING'];(function(_0x35fbb9,_0x548887){var _0x25bb90=function(_0x2a08a4){while(--_0x2a08a4){_0x35fbb9['push'](_0x35fbb9['shift']());}};_0x25bb90(++_0x548887);}(_0xadf0,0x12d));var _0x0adf=function(_0xe2e012,_0x30f284){_0xe2e012=_0xe2e012-0x0;var _0x4ba424=_0xadf0[_0xe2e012];return _0x4ba424;};'use strict';var Sequelize=require('sequelize');module[_0x0adf('0x0')]={'name':{'type':Sequelize[_0x0adf('0x1')],'unique':_0x0adf('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0adf('0x1')]},'dialPrefix':{'type':Sequelize[_0x0adf('0x1')]}}; \ No newline at end of file +var _0xc3a8=['STRING','sequelize','exports'];(function(_0x4d729f,_0x52bf8b){var _0x5ce12a=function(_0x3ae6a6){while(--_0x3ae6a6){_0x4d729f['push'](_0x4d729f['shift']());}};_0x5ce12a(++_0x52bf8b);}(_0xc3a8,0xe8));var _0x8c3a=function(_0x5b1b21,_0x26c3e8){_0x5b1b21=_0x5b1b21-0x0;var _0x4e0d1a=_0xc3a8[_0x5b1b21];return _0x4e0d1a;};'use strict';var Sequelize=require(_0x8c3a('0x0'));module[_0x8c3a('0x1')]={'name':{'type':Sequelize[_0x8c3a('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8c3a('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 f791508..4b0b8e1 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 _0xd5f2=['errors','message','Malformed\x20request\x20syntax','CmCustomField','concat','CustomFields','format','cf_%d','raw','getContacts','getContactsCsv','ContactItemType','OrderBy','alias','select','from','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','text','Sequelize','TEXT','INTEGER','BOOLEAN','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','info','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','stack','name','index','map','CmList','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','filter','options','include','findAll','rows','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','ListId','Disposition','getDispositions','findOne','rawAttributes','removeDispositions','ids','addContacts','CmContact','tags','isArray','each','success','push'];(function(_0x508cb9,_0x16836a){var _0x453fc0=function(_0x4f1a2a){while(--_0x4f1a2a){_0x508cb9['push'](_0x508cb9['shift']());}};_0x453fc0(++_0x16836a);}(_0xd5f2,0x17c));var _0x2d5f=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd5f2[_0x27af45];return _0x18df21;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2d5f('0x0'));var zipdir=require(_0x2d5f('0x1'));var jsonpatch=require(_0x2d5f('0x2'));var rp=require(_0x2d5f('0x3'));var moment=require(_0x2d5f('0x4'));var BPromise=require(_0x2d5f('0x5'));var Mustache=require(_0x2d5f('0x6'));var util=require(_0x2d5f('0x7'));var path=require(_0x2d5f('0x8'));var sox=require(_0x2d5f('0x9'));var csv=require(_0x2d5f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d5f('0xb'));var squel=require('squel');var crypto=require(_0x2d5f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2d5f('0xd'));var toCsv=require(_0x2d5f('0xa'));var querystring=require(_0x2d5f('0xe'));var Papa=require('papaparse');var Redis=require(_0x2d5f('0xf'));var authService=require(_0x2d5f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2d5f('0x11'));var hardwareService=require(_0x2d5f('0x12'));var logger=require('../../config/logger')(_0x2d5f('0x13'));var utils=require(_0x2d5f('0x14'));var config=require(_0x2d5f('0x15'));var licenseUtil=require(_0x2d5f('0x16'));var db=require(_0x2d5f('0x17'))['db'];var csv_results;config[_0x2d5f('0x18')]=_['defaults'](config[_0x2d5f('0x18')],{'host':_0x2d5f('0x19'),'port':0x18eb});var socket=require(_0x2d5f('0x1a'))(new Redis(config['redis']));require(_0x2d5f('0x1b'))['register'](socket);function respondWithStatusCode(_0x34724f,_0x480c62){_0x480c62=_0x480c62||0xcc;return function(_0x12dfaa){if(_0x12dfaa){return _0x34724f[_0x2d5f('0x1c')](_0x480c62);}return _0x34724f['status'](_0x480c62)[_0x2d5f('0x1d')]();};}function respondWithResult(_0x29238e,_0x2723a7){_0x2723a7=_0x2723a7||0xc8;return function(_0x7e6019){if(_0x7e6019){return _0x29238e[_0x2d5f('0x1e')](_0x2723a7)[_0x2d5f('0x1f')](_0x7e6019);}};}function respondWithFilteredResult(_0x3e184d,_0x5babf3){return function(_0x3387b5){if(_0x3387b5){var _0x5c6fb9=typeof _0x5babf3[_0x2d5f('0x20')]===_0x2d5f('0x21')&&typeof _0x5babf3[_0x2d5f('0x22')]===_0x2d5f('0x21');var _0x215e33=_0x3387b5[_0x2d5f('0x23')];var _0x446a82=_0x5c6fb9?0x0:_0x5babf3['offset'];var _0x5ac7c3=_0x5c6fb9?_0x3387b5[_0x2d5f('0x23')]:_0x5babf3['offset']+_0x5babf3[_0x2d5f('0x22')];var _0x39e922;if(_0x5ac7c3>=_0x215e33){_0x5ac7c3=_0x215e33;_0x39e922=0xc8;}else{_0x39e922=0xce;}_0x3e184d['status'](_0x39e922);return _0x3e184d[_0x2d5f('0x24')](_0x2d5f('0x25'),_0x446a82+'-'+_0x5ac7c3+'/'+_0x215e33)['json'](_0x3387b5);}return null;};}function patchUpdates(_0x47a9a3){return function(_0x2f43b2){try{jsonpatch[_0x2d5f('0x26')](_0x2f43b2,_0x47a9a3,!![]);}catch(_0x5ce65d){return BPromise[_0x2d5f('0x27')](_0x5ce65d);}return _0x2f43b2[_0x2d5f('0x28')]();};}function saveUpdates(_0x30f446,_0x9b914a){return function(_0x5b0884){if(_0x5b0884){return _0x5b0884['update'](_0x30f446)[_0x2d5f('0x29')](function(_0x13cd9d){return _0x13cd9d;});}return null;};}function removeEntity(_0x1e6f0c,_0x5cdc62){return function(_0x145f26){if(_0x145f26){return _0x145f26[_0x2d5f('0x2a')]()['then'](function(){var _0x19397b=_0x145f26['get']({'plain':!![]});var _0x3b1e88='Lists';return db[_0x2d5f('0x2b')][_0x2d5f('0x2a')]({'where':{'type':_0x3b1e88,'resourceId':_0x19397b['id']}})['then'](function(){return _0x145f26;});})[_0x2d5f('0x29')](function(){_0x1e6f0c[_0x2d5f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11b1e2,_0x430aa7){return function(_0x1379f5){if(!_0x1379f5){_0x11b1e2['sendStatus'](0x194);}return _0x1379f5;};}function handleError(_0xc8e74e,_0x2acd2f){_0x2acd2f=_0x2acd2f||0x1f4;return function(_0x50ee84){logger['error'](_0x50ee84[_0x2d5f('0x2c')]);if(_0x50ee84['name']){delete _0x50ee84[_0x2d5f('0x2d')];}_0xc8e74e['status'](_0x2acd2f)['send'](_0x50ee84);};}exports[_0x2d5f('0x2e')]=function(_0x3d025a,_0x14b2bd){var _0x48cd9c={},_0x444087={},_0x47fa04={'count':0x0,'rows':[]};var _0x138f22=_[_0x2d5f('0x2f')](db[_0x2d5f('0x30')]['rawAttributes'],function(_0x208a9a){return{'name':_0x208a9a[_0x2d5f('0x31')],'type':_0x208a9a['type'][_0x2d5f('0x32')]};});_0x444087[_0x2d5f('0x33')]=_[_0x2d5f('0x2f')](_0x138f22,_0x2d5f('0x2d'));_0x444087['query']=_[_0x2d5f('0x34')](_0x3d025a[_0x2d5f('0x35')]);_0x444087['filters']=_[_0x2d5f('0x36')](_0x444087['model'],_0x444087[_0x2d5f('0x35')]);_0x48cd9c[_0x2d5f('0x37')]=_['intersection'](_0x444087['model'],qs[_0x2d5f('0x38')](_0x3d025a[_0x2d5f('0x35')][_0x2d5f('0x38')]));_0x48cd9c[_0x2d5f('0x37')]=_0x48cd9c[_0x2d5f('0x37')][_0x2d5f('0x39')]?_0x48cd9c['attributes']:_0x444087[_0x2d5f('0x33')];if(!_0x3d025a[_0x2d5f('0x35')][_0x2d5f('0x3a')](_0x2d5f('0x3b'))){_0x48cd9c[_0x2d5f('0x22')]=qs['limit'](_0x3d025a[_0x2d5f('0x35')][_0x2d5f('0x22')]);_0x48cd9c['offset']=qs[_0x2d5f('0x20')](_0x3d025a[_0x2d5f('0x35')][_0x2d5f('0x20')]);}_0x48cd9c[_0x2d5f('0x3c')]=qs[_0x2d5f('0x3d')](_0x3d025a[_0x2d5f('0x35')]['sort']);_0x48cd9c[_0x2d5f('0x3e')]=qs[_0x2d5f('0x3f')](_[_0x2d5f('0x40')](_0x3d025a[_0x2d5f('0x35')],_0x444087[_0x2d5f('0x3f')]),_0x138f22);if(_0x3d025a[_0x2d5f('0x35')]['filter']){_0x48cd9c[_0x2d5f('0x3e')]=_[_0x2d5f('0x41')](_0x48cd9c[_0x2d5f('0x3e')],{'$or':_[_0x2d5f('0x2f')](_0x138f22,function(_0x28fb22){if(_0x28fb22[_0x2d5f('0x42')]!=='VIRTUAL'){var _0x296bd9={};_0x296bd9[_0x28fb22[_0x2d5f('0x2d')]]={'$like':'%'+_0x3d025a[_0x2d5f('0x35')][_0x2d5f('0x43')]+'%'};return _0x296bd9;}})});}_0x48cd9c=_[_0x2d5f('0x41')]({},_0x48cd9c,_0x3d025a[_0x2d5f('0x44')]);var _0x3a16d0={'where':_0x48cd9c[_0x2d5f('0x3e')]};return db['CmList']['count'](_0x3a16d0)[_0x2d5f('0x29')](function(_0x25ffb5){_0x47fa04[_0x2d5f('0x23')]=_0x25ffb5;if(_0x3d025a[_0x2d5f('0x35')]['includeAll']){_0x48cd9c[_0x2d5f('0x45')]=[{'all':!![]}];}return db[_0x2d5f('0x30')][_0x2d5f('0x46')](_0x48cd9c);})['then'](function(_0x5d073a){_0x47fa04[_0x2d5f('0x47')]=_0x5d073a;return _0x47fa04;})['then'](respondWithFilteredResult(_0x14b2bd,_0x48cd9c))[_0x2d5f('0x48')](handleError(_0x14b2bd,null));};exports[_0x2d5f('0x49')]=function(_0x50146b,_0x4ee461){var _0x925041={'raw':![],'where':{'id':_0x50146b['params']['id']}},_0x3ea151={};_0x3ea151[_0x2d5f('0x33')]=_[_0x2d5f('0x34')](db['CmList']['rawAttributes']);_0x3ea151[_0x2d5f('0x35')]=_[_0x2d5f('0x34')](_0x50146b[_0x2d5f('0x35')]);_0x3ea151[_0x2d5f('0x3f')]=_[_0x2d5f('0x36')](_0x3ea151[_0x2d5f('0x33')],_0x3ea151[_0x2d5f('0x35')]);_0x925041[_0x2d5f('0x37')]=_[_0x2d5f('0x36')](_0x3ea151[_0x2d5f('0x33')],qs[_0x2d5f('0x38')](_0x50146b['query'][_0x2d5f('0x38')]));_0x925041[_0x2d5f('0x37')]=_0x925041[_0x2d5f('0x37')][_0x2d5f('0x39')]?_0x925041[_0x2d5f('0x37')]:_0x3ea151[_0x2d5f('0x33')];if(_0x50146b[_0x2d5f('0x35')][_0x2d5f('0x4a')]){_0x925041[_0x2d5f('0x45')]=[{'all':!![]}];}_0x925041=_['merge']({},_0x925041,_0x50146b[_0x2d5f('0x44')]);return db[_0x2d5f('0x30')][_0x2d5f('0x4b')](_0x925041)[_0x2d5f('0x29')](handleEntityNotFound(_0x4ee461,null))['then'](respondWithResult(_0x4ee461,null))[_0x2d5f('0x48')](handleError(_0x4ee461,null));};exports[_0x2d5f('0x4c')]=function(_0x51fb9c,_0x588a93){return db['CmList']['create'](_0x51fb9c[_0x2d5f('0x4d')],{})[_0x2d5f('0x29')](function(_0x44be6a){var _0x4e14d8=_0x51fb9c[_0x2d5f('0x4e')]['get']({'plain':!![]});if(!_0x4e14d8)throw new Error(_0x2d5f('0x4f'));if(_0x4e14d8['role']===_0x2d5f('0x4e')){var _0x51cc7b=_0x44be6a[_0x2d5f('0x50')]({'plain':!![]});var _0xedb6a6='Lists';return db[_0x2d5f('0x51')][_0x2d5f('0x4b')]({'where':{'name':_0xedb6a6,'userProfileId':_0x4e14d8[_0x2d5f('0x52')]},'raw':!![]})[_0x2d5f('0x29')](function(_0x49ede8){if(_0x49ede8&&_0x49ede8[_0x2d5f('0x53')]===0x0){return db[_0x2d5f('0x2b')][_0x2d5f('0x4c')]({'name':_0x51cc7b[_0x2d5f('0x2d')],'resourceId':_0x51cc7b['id'],'type':_0x49ede8['name'],'sectionId':_0x49ede8['id']},{})[_0x2d5f('0x29')](function(){return _0x44be6a;});}else{return _0x44be6a;}})[_0x2d5f('0x48')](function(_0x81b355){logger[_0x2d5f('0x54')](_0x2d5f('0x55'),_0x81b355);throw _0x81b355;});}return _0x44be6a;})[_0x2d5f('0x29')](respondWithResult(_0x588a93,0xc9))[_0x2d5f('0x48')](handleError(_0x588a93,null));};exports[_0x2d5f('0x56')]=function(_0x4011b9,_0xcb67d1){if(_0x4011b9[_0x2d5f('0x4d')]['id']){delete _0x4011b9[_0x2d5f('0x4d')]['id'];}return db[_0x2d5f('0x30')]['find']({'where':{'id':_0x4011b9[_0x2d5f('0x57')]['id']}})[_0x2d5f('0x29')](handleEntityNotFound(_0xcb67d1,null))[_0x2d5f('0x29')](saveUpdates(_0x4011b9['body'],null))[_0x2d5f('0x29')](respondWithResult(_0xcb67d1,null))['catch'](handleError(_0xcb67d1,null));};exports[_0x2d5f('0x2a')]=function(_0x379f4a,_0x48143a){return db[_0x2d5f('0x30')]['find']({'where':{'id':_0x379f4a[_0x2d5f('0x57')]['id']}})[_0x2d5f('0x29')](handleEntityNotFound(_0x48143a,null))['then'](removeEntity(_0x48143a,null))['catch'](handleError(_0x48143a,null));};exports['describe']=function(_0x28cf37,_0x506ed8){return db[_0x2d5f('0x30')][_0x2d5f('0x58')]()['then'](respondWithResult(_0x506ed8,null))[_0x2d5f('0x48')](handleError(_0x506ed8,null));};exports['addDisposition']=function(_0x49fb8f,_0x589c93,_0x2652c2){if(_0x49fb8f[_0x2d5f('0x4d')]['id']){delete _0x49fb8f[_0x2d5f('0x4d')]['id'];}return db[_0x2d5f('0x30')][_0x2d5f('0x4b')]({'where':{'id':_0x49fb8f[_0x2d5f('0x57')]['id']}})[_0x2d5f('0x29')](handleEntityNotFound(_0x589c93,null))[_0x2d5f('0x29')](function(_0x34145a){if(_0x34145a){_0x49fb8f['body'][_0x2d5f('0x59')]=_0x34145a['id'];return db[_0x2d5f('0x5a')][_0x2d5f('0x4c')](_0x49fb8f[_0x2d5f('0x4d')]);}})['then'](respondWithResult(_0x589c93,null))['catch'](handleError(_0x589c93,null));};exports[_0x2d5f('0x5b')]=function(_0x414278,_0x356c59,_0x1e3914){var _0x3b6c71={'raw':![],'where':{}};var _0x254423={};var _0x3ab83b={'count':0x0,'rows':[]};return db[_0x2d5f('0x30')][_0x2d5f('0x5c')]({'where':{'id':_0x414278[_0x2d5f('0x57')]['id']}})[_0x2d5f('0x29')](handleEntityNotFound(_0x356c59,null))[_0x2d5f('0x29')](function(_0x1fb9c7){if(_0x1fb9c7){_0x254423['model']=_[_0x2d5f('0x34')](db[_0x2d5f('0x5a')][_0x2d5f('0x5d')]);_0x254423[_0x2d5f('0x35')]=_[_0x2d5f('0x34')](_0x414278[_0x2d5f('0x35')]);_0x254423[_0x2d5f('0x3f')]=_[_0x2d5f('0x36')](_0x254423[_0x2d5f('0x33')],_0x254423[_0x2d5f('0x35')]);_0x3b6c71[_0x2d5f('0x37')]=_['intersection'](_0x254423[_0x2d5f('0x33')],qs[_0x2d5f('0x38')](_0x414278['query'][_0x2d5f('0x38')]));_0x3b6c71['attributes']=_0x3b6c71[_0x2d5f('0x37')][_0x2d5f('0x39')]?_0x3b6c71['attributes']:_0x254423['model'];if(!_0x414278[_0x2d5f('0x35')][_0x2d5f('0x3a')]('nolimit')){_0x3b6c71['limit']=qs[_0x2d5f('0x22')](_0x414278[_0x2d5f('0x35')][_0x2d5f('0x22')]);_0x3b6c71['offset']=qs[_0x2d5f('0x20')](_0x414278[_0x2d5f('0x35')]['offset']);}_0x3b6c71['order']=qs[_0x2d5f('0x3d')](_0x414278[_0x2d5f('0x35')][_0x2d5f('0x3d')]);_0x3b6c71['where']=qs[_0x2d5f('0x3f')](_['pick'](_0x414278[_0x2d5f('0x35')],_0x254423[_0x2d5f('0x3f')]));_0x3b6c71[_0x2d5f('0x3e')][_0x2d5f('0x59')]=_0x1fb9c7['id'];if(_0x414278[_0x2d5f('0x35')][_0x2d5f('0x43')]){_0x3b6c71[_0x2d5f('0x3e')]=_[_0x2d5f('0x41')](_0x3b6c71['where'],{'$or':_[_0x2d5f('0x2f')](_0x3b6c71[_0x2d5f('0x37')],function(_0x34f8b4){var _0x562ea6={};_0x562ea6[_0x34f8b4]={'$like':'%'+_0x414278[_0x2d5f('0x35')][_0x2d5f('0x43')]+'%'};return _0x562ea6;})});}_0x3b6c71=_[_0x2d5f('0x41')]({},_0x3b6c71,_0x414278['options']);return db[_0x2d5f('0x5a')]['count']({'where':_0x3b6c71[_0x2d5f('0x3e')]})['then'](function(_0x5bfecc){_0x3ab83b[_0x2d5f('0x23')]=_0x5bfecc;if(_0x414278[_0x2d5f('0x35')][_0x2d5f('0x4a')]){_0x3b6c71[_0x2d5f('0x45')]=[{'all':!![]}];}return db['Disposition'][_0x2d5f('0x46')](_0x3b6c71);})[_0x2d5f('0x29')](function(_0x19eda8){_0x3ab83b['rows']=_0x19eda8;return _0x3ab83b;});}})[_0x2d5f('0x29')](respondWithFilteredResult(_0x356c59,_0x3b6c71))[_0x2d5f('0x48')](handleError(_0x356c59,null));};exports[_0x2d5f('0x5e')]=function(_0xed9777,_0x3afd81,_0x5028a2){return db[_0x2d5f('0x30')][_0x2d5f('0x4b')]({'where':{'id':_0xed9777[_0x2d5f('0x57')]['id']}})[_0x2d5f('0x29')](handleEntityNotFound(_0x3afd81,null))[_0x2d5f('0x29')](function(_0x5d2a69){if(_0x5d2a69){return _0x5d2a69[_0x2d5f('0x5e')](_0xed9777[_0x2d5f('0x35')][_0x2d5f('0x5f')]);}})['then'](respondWithStatusCode(_0x3afd81,null))[_0x2d5f('0x48')](handleError(_0x3afd81,null));};exports[_0x2d5f('0x60')]=function(_0x1de076,_0x5a0f87,_0x586d15){return db[_0x2d5f('0x30')]['find']({'where':{'id':_0x1de076[_0x2d5f('0x57')]['id']}})[_0x2d5f('0x29')](handleEntityNotFound(_0x5a0f87,null))[_0x2d5f('0x29')](function(_0x184c1c){if(_0x184c1c){var _0x3dbe13=[];var _0x47bdfc={'success':[],'errors':[]};return db[_0x2d5f('0x61')][_0x2d5f('0x58')]()[_0x2d5f('0x29')](function(_0x1e0228){if(_0x1de076[_0x2d5f('0x4d')][_0x2d5f('0x62')]&&_[_0x2d5f('0x63')](_0x1de076['body'][_0x2d5f('0x62')])){if(_0x1de076[_0x2d5f('0x4d')][_0x2d5f('0x62')]['length']){_0x1de076[_0x2d5f('0x4d')][_0x2d5f('0x62')]=_0x1de076[_0x2d5f('0x4d')][_0x2d5f('0x62')]['join'](';')+';';}else{_0x1de076['body'][_0x2d5f('0x62')]=null;}}else{_0x1de076['body'][_0x2d5f('0x62')]=null;}if(_0x1de076[_0x2d5f('0x4d')]&&_[_0x2d5f('0x63')](_0x1de076[_0x2d5f('0x4d')])){for(var _0x1ad6ee=0x0;_0x1ad6ee<_0x1de076[_0x2d5f('0x4d')][_0x2d5f('0x39')];_0x1ad6ee+=0x1){_0x1de076[_0x2d5f('0x4d')][_0x1ad6ee]['ListId']=_0x1de076[_0x2d5f('0x57')]['id'];_0x3dbe13['push'](_0x1de076[_0x2d5f('0x4d')][_0x1ad6ee]);}return BPromise[_0x2d5f('0x64')](_0x3dbe13,function(_0x4b9c21){return db[_0x2d5f('0x61')][_0x2d5f('0x4c')](_['omit'](_0x4b9c21,[_0x2d5f('0x5f'),'id'])||{},{'fields':_['keys'](_0x1e0228),'raw':!![]})['then'](function(_0x4d8c0a){_0x47bdfc[_0x2d5f('0x65')][_0x2d5f('0x66')](_0x4d8c0a['dataValues']);})[_0x2d5f('0x48')](function(_0x29b4ee){_0x47bdfc[_0x2d5f('0x67')][_0x2d5f('0x66')]({'data':_0x4b9c21,'error':_0x29b4ee[_0x2d5f('0x68')]});});})[_0x2d5f('0x29')](function(_0x2dca1a){return _0x47bdfc;})[_0x2d5f('0x48')](function(_0x327b6b){return _0x327b6b;});}else{_0x5a0f87['status'](0x190)[_0x2d5f('0x1f')]({'message':_0x2d5f('0x69')});}});}})['then'](respondWithResult(_0x5a0f87,null))['catch'](handleError(_0x5a0f87,null));};exports['getContacts']=function(_0x5d9834,_0x3b3c13,_0x201185){var _0x463ea2;return db[_0x2d5f('0x30')][_0x2d5f('0x4b')]({'where':{'id':_0x5d9834[_0x2d5f('0x57')]['id']},'include':[{'model':db[_0x2d5f('0x6a')],'as':'CustomFields'}]})[_0x2d5f('0x29')](handleEntityNotFound(_0x3b3c13,null))['then'](function(_0x49c9c9){if(_0x49c9c9){_0x463ea2=_0x49c9c9;return db[_0x2d5f('0x61')][_0x2d5f('0x5d')];}})[_0x2d5f('0x29')](function(_0x35b234){if(_0x35b234){var _0x245063={};var _0x1741de={};_0x1741de[_0x2d5f('0x33')]=_[_0x2d5f('0x6b')](_['keys'](_0x35b234),_[_0x2d5f('0x2f')](_0x463ea2[_0x2d5f('0x6c')],function(_0x3c4688){return util[_0x2d5f('0x6d')](_0x2d5f('0x6e'),_0x3c4688['id']);}));_0x1741de[_0x2d5f('0x35')]=_[_0x2d5f('0x34')](_0x5d9834[_0x2d5f('0x35')]);_0x1741de[_0x2d5f('0x3f')]=_['intersection'](_0x1741de['model'],_0x1741de['query']);_0x245063[_0x2d5f('0x37')]=_[_0x2d5f('0x36')](_0x1741de[_0x2d5f('0x33')],qs[_0x2d5f('0x38')](_0x5d9834[_0x2d5f('0x35')][_0x2d5f('0x38')]));_0x245063[_0x2d5f('0x37')]=_0x245063[_0x2d5f('0x37')]['length']?_0x245063[_0x2d5f('0x37')]:_0x1741de[_0x2d5f('0x33')];if(!_0x5d9834[_0x2d5f('0x35')][_0x2d5f('0x3a')]('nolimit')){_0x245063[_0x2d5f('0x22')]=qs[_0x2d5f('0x22')](_0x5d9834[_0x2d5f('0x35')][_0x2d5f('0x22')]);_0x245063[_0x2d5f('0x20')]=qs['offset'](_0x5d9834[_0x2d5f('0x35')][_0x2d5f('0x20')]);}_0x245063[_0x2d5f('0x3c')]=qs['sort'](_0x5d9834[_0x2d5f('0x35')]['sort']);_0x245063[_0x2d5f('0x3e')]=qs[_0x2d5f('0x3f')](_[_0x2d5f('0x40')](_0x5d9834['query'],_0x1741de[_0x2d5f('0x3f')]));_0x245063[_0x2d5f('0x6f')]=!![];if(_0x5d9834[_0x2d5f('0x35')][_0x2d5f('0x43')]){_0x245063[_0x2d5f('0x3e')]=_[_0x2d5f('0x41')](_0x245063['where'],{'$or':_[_0x2d5f('0x2f')](_0x245063['attributes'],function(_0x4f8818){var _0x5eb7e5={};_0x5eb7e5[_0x4f8818]={'$like':'%'+_0x5d9834[_0x2d5f('0x35')][_0x2d5f('0x43')]+'%'};return _0x5eb7e5;})});}_0x245063=_[_0x2d5f('0x41')]({},_0x245063,_0x5d9834[_0x2d5f('0x44')]);return _0x463ea2[_0x2d5f('0x70')](_0x245063);}})[_0x2d5f('0x29')](respondWithResult(_0x3b3c13,null))[_0x2d5f('0x48')](handleError(_0x3b3c13,null));};exports[_0x2d5f('0x71')]=function(_0x47fc0e,_0x179f97,_0x50d572){var _0x5ca4bf;var _0x291cdf;var _0x5449f1;var _0x518d5e=_0x47fc0e[_0x2d5f('0x57')]['id'];csv_results=[];return db[_0x2d5f('0x72')]['findAll']({'attributes':['id',_0x2d5f('0x2d')],'raw':!![],'order':[_0x2d5f('0x73')]})[_0x2d5f('0x29')](function(_0x261676){_0x5ca4bf=_0x261676;var _0x2ca4de=_[_0x2d5f('0x34')](db[_0x2d5f('0x61')][_0x2d5f('0x5d')]);return db[_0x2d5f('0x6a')][_0x2d5f('0x46')]({'raw':!![],'attributes':['id',_0x2d5f('0x74')]})[_0x2d5f('0x29')](function(_0x1c9d79){_0x291cdf=_0x1c9d79;var _0x104a8d=squel[_0x2d5f('0x75')]()[_0x2d5f('0x38')](_0x2ca4de)[_0x2d5f('0x76')]('cm_contacts','c')[_0x2d5f('0x3e')]('c.ListId\x20=\x20?',_0x518d5e)[_0x2d5f('0x3e')](_0x2d5f('0x77'))[_0x2d5f('0x78')]();for(var _0x28fa80=0x0;_0x28fa80<_0x291cdf['length'];_0x28fa80++){_0x104a8d[_0x2d5f('0x79')](_0x2d5f('0x7a')+_0x291cdf[_0x28fa80]['id'],_0x2d5f('0x7b')+_0x291cdf[_0x28fa80]['alias']);}for(var _0x28fa80=0x0;_0x28fa80<_0x5ca4bf[_0x2d5f('0x39')];_0x28fa80++){_0x104a8d['field'](squel[_0x2d5f('0x75')]()[_0x2d5f('0x79')](_0x2d5f('0x7c'))[_0x2d5f('0x76')](_0x2d5f('0x7d'))[_0x2d5f('0x3e')](_0x2d5f('0x7e'),_0x5ca4bf[_0x28fa80]['id'])[_0x2d5f('0x3e')](_0x2d5f('0x7f')),_0x2d5f('0x80')+_0x5ca4bf[_0x28fa80][_0x2d5f('0x2d')]);_0x104a8d[_0x2d5f('0x79')](squel[_0x2d5f('0x75')]()[_0x2d5f('0x79')](_0x2d5f('0x81'))[_0x2d5f('0x76')](_0x2d5f('0x7d'))[_0x2d5f('0x3e')](_0x2d5f('0x7e'),_0x5ca4bf[_0x28fa80]['id'])[_0x2d5f('0x3e')](_0x2d5f('0x7f')),_0x2d5f('0x82')+_0x5ca4bf[_0x28fa80][_0x2d5f('0x2d')]);}var _0x358df4=[];_0x358df4[_0x2d5f('0x66')](_0x104a8d['toString']());BPromise['each'](_0x358df4,handleQuery)[_0x2d5f('0x29')](function(_0x23ba53){handleQuery(_0x104a8d[_0x2d5f('0x83')]());var _0x443ccf=csv_results[0x0];if(!_['isEmpty'](_0x443ccf)){var _0x3360af=toCsv(_0x443ccf);var _0x47268b=Date[_0x2d5f('0x84')]();fs[_0x2d5f('0x85')](util[_0x2d5f('0x6d')](_0x2d5f('0x86'),_0x518d5e,_0x47268b),_0x3360af);_0x179f97[_0x2d5f('0x87')]('Content-disposition','attachment;\x20filename='+util[_0x2d5f('0x6d')](_0x2d5f('0x88'),_0x518d5e,_0x47268b));_0x179f97[_0x2d5f('0x87')](_0x2d5f('0x89'),'text/csv');return _0x179f97[_0x2d5f('0x8a')](util[_0x2d5f('0x6d')](_0x2d5f('0x86'),_0x518d5e,_0x47268b));}else{return _0x179f97[_0x2d5f('0x1c')](0xcc);}});});});};exports[_0x2d5f('0x8b')]=function(_0x94fb9e,_0x5e3904,_0x386194){var _0x16b7eb;delete _0x94fb9e[_0x2d5f('0x4d')]['id'];return db[_0x2d5f('0x30')][_0x2d5f('0x5c')]({'where':{'id':_0x94fb9e['params']['id']}})[_0x2d5f('0x29')](handleEntityNotFound(_0x5e3904,null))['then'](function(_0x3274f3){if(_0x3274f3){return db[_0x2d5f('0x8c')][_0x2d5f('0x8d')](function(_0x3e0ea9){return db['CmCustomField'][_0x2d5f('0x4c')](_0x94fb9e[_0x2d5f('0x4d')],{'transaction':_0x3e0ea9})['then'](function(_0x2a8691){_0x16b7eb=_0x2a8691;return _0x3274f3['addCustomFields'](_0x2a8691,{'transaction':_0x3e0ea9});})[_0x2d5f('0x29')](function(){var _0x532814={'type':db['Sequelize']['TEXT'],'transaction':_0x3e0ea9};switch(_0x94fb9e[_0x2d5f('0x4d')][_0x2d5f('0x42')]){case _0x2d5f('0x8e'):_0x532814[_0x2d5f('0x42')]=db[_0x2d5f('0x8f')][_0x2d5f('0x90')];break;case'number':_0x532814[_0x2d5f('0x42')]=db[_0x2d5f('0x8f')][_0x2d5f('0x91')];break;case'switch':_0x532814[_0x2d5f('0x42')]=db['Sequelize'][_0x2d5f('0x92')];_0x532814['defaultValue']=![];break;default:}return db[_0x2d5f('0x8c')]['queryInterface'][_0x2d5f('0x93')](_0x2d5f('0x94'),util['format'](_0x2d5f('0x95'),_0x16b7eb['id']),_0x532814);})[_0x2d5f('0x29')](function(){return _0x16b7eb;});});}})['then'](respondWithResult(_0x5e3904,null))[_0x2d5f('0x48')](handleError(_0x5e3904,null));};exports[_0x2d5f('0x96')]=function(_0x12fb1a,_0x5ba5db,_0x3bb56c){var _0x118a93={};var _0x3228d6={};var _0x1e325f;var _0x453a42;return db[_0x2d5f('0x30')][_0x2d5f('0x5c')]({'where':{'id':_0x12fb1a[_0x2d5f('0x57')]['id']}})[_0x2d5f('0x29')](handleEntityNotFound(_0x5ba5db,null))[_0x2d5f('0x29')](function(_0x3bc642){if(_0x3bc642){_0x1e325f=_0x3bc642;_0x3228d6[_0x2d5f('0x33')]=_[_0x2d5f('0x34')](db[_0x2d5f('0x6a')][_0x2d5f('0x5d')]);_0x3228d6[_0x2d5f('0x35')]=_[_0x2d5f('0x34')](_0x12fb1a[_0x2d5f('0x35')]);_0x3228d6[_0x2d5f('0x3f')]=_[_0x2d5f('0x36')](_0x3228d6[_0x2d5f('0x33')],_0x3228d6[_0x2d5f('0x35')]);_0x118a93[_0x2d5f('0x37')]=_[_0x2d5f('0x36')](_0x3228d6[_0x2d5f('0x33')],qs[_0x2d5f('0x38')](_0x12fb1a['query']['fields']));_0x118a93[_0x2d5f('0x37')]=_0x118a93[_0x2d5f('0x37')]['length']?_0x118a93[_0x2d5f('0x37')]:_0x3228d6[_0x2d5f('0x33')];_0x118a93[_0x2d5f('0x3c')]=qs[_0x2d5f('0x3d')](_0x12fb1a[_0x2d5f('0x35')]['sort']);_0x118a93['where']=qs[_0x2d5f('0x3f')](_['pick'](_0x12fb1a[_0x2d5f('0x35')],_0x3228d6[_0x2d5f('0x3f')]));_0x118a93[_0x2d5f('0x3e')]=_[_0x2d5f('0x41')](_0x118a93['where'],{'$or':[{'ListId':_0x3bc642['id']},{'ListId':null}]});if(_0x12fb1a[_0x2d5f('0x35')][_0x2d5f('0x43')]){_0x118a93['where']=_[_0x2d5f('0x41')](_0x118a93[_0x2d5f('0x3e')],{'$or':_[_0x2d5f('0x2f')](_0x118a93[_0x2d5f('0x37')],function(_0x4e3bcf){var _0x3d53e9={};_0x3d53e9[_0x4e3bcf]={'$like':'%'+_0x12fb1a[_0x2d5f('0x35')][_0x2d5f('0x43')]+'%'};return _0x3d53e9;})});}_0x118a93=_[_0x2d5f('0x41')]({},_0x118a93,_0x12fb1a['options']);return db[_0x2d5f('0x6a')][_0x2d5f('0x97')](_0x118a93);}})[_0x2d5f('0x29')](respondWithResult(_0x5ba5db,null))[_0x2d5f('0x48')](handleError(_0x5ba5db,null));};exports['getGlobalCustomFields']=function(_0x2b342f,_0x49c9b6){return db['CmCustomField']['findAndCountAll']({'where':{'ListId':null}})[_0x2d5f('0x29')](handleEntityNotFound(_0x49c9b6,null))[_0x2d5f('0x29')](function(_0x9d03a){return _0x9d03a;})[_0x2d5f('0x29')](respondWithResult(_0x49c9b6,null))[_0x2d5f('0x48')](handleError(_0x49c9b6,null));};exports[_0x2d5f('0x98')]=function(_0x2bc506,_0x3cb258,_0x2bd8a1){return db[_0x2d5f('0x30')][_0x2d5f('0x4b')]({'where':{'id':_0x2bc506[_0x2d5f('0x57')]['id']}})[_0x2d5f('0x29')](handleEntityNotFound(_0x3cb258,null))[_0x2d5f('0x29')](function(_0x1d53d4){if(_0x1d53d4){return _0x1d53d4['addAgents'](_0x2bc506['body']['ids'],_['omit'](_0x2bc506['body'],[_0x2d5f('0x5f'),'id'])||{})[_0x2d5f('0x99')](function(_0x183d0d){for(var _0x41bde0=0x0;_0x41bde0<_0x2bc506[_0x2d5f('0x4d')][_0x2d5f('0x5f')][_0x2d5f('0x39')];_0x41bde0+=0x1){socket[_0x2d5f('0x9a')](_0x2d5f('0x9b'),{'UserId':Number(_0x2bc506[_0x2d5f('0x4d')][_0x2d5f('0x5f')][_0x41bde0]),'CmListId':Number(_0x2bc506[_0x2d5f('0x57')]['id'])});}return _0x183d0d;});}})['then'](respondWithResult(_0x3cb258,null))[_0x2d5f('0x48')](handleError(_0x3cb258,null));};exports[_0x2d5f('0x9c')]=function(_0x2ecc25,_0x3d145f,_0x5c39d8){return db[_0x2d5f('0x30')][_0x2d5f('0x4b')]({'where':{'id':_0x2ecc25['params']['id']}})[_0x2d5f('0x29')](handleEntityNotFound(_0x3d145f,null))['then'](function(_0x266875){if(_0x266875){return _0x266875[_0x2d5f('0x9c')](_0x2ecc25[_0x2d5f('0x35')][_0x2d5f('0x5f')])['then'](function(){if(_[_0x2d5f('0x63')](_0x2ecc25[_0x2d5f('0x35')][_0x2d5f('0x5f')])){for(var _0x6342a8=0x0;_0x6342a8<_0x2ecc25[_0x2d5f('0x35')][_0x2d5f('0x5f')][_0x2d5f('0x39')];_0x6342a8+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x2ecc25[_0x2d5f('0x35')]['ids'][_0x6342a8]),'CmListId':Number(_0x2ecc25[_0x2d5f('0x57')]['id'])});}}else{socket[_0x2d5f('0x9a')](_0x2d5f('0x9d'),{'UserId':Number(_0x2ecc25['query']['ids']),'CmListId':Number(_0x2ecc25[_0x2d5f('0x57')]['id'])});}});}})[_0x2d5f('0x29')](respondWithStatusCode(_0x3d145f,null))[_0x2d5f('0x48')](handleError(_0x3d145f,null));};exports['getAgents']=function(_0x4fd9e2,_0x329af7,_0x2a90d9){var _0x27c518={};var _0x356e5f={};var _0x33bcb6;var _0x30b5ec;return db[_0x2d5f('0x30')][_0x2d5f('0x5c')]({'where':{'id':_0x4fd9e2[_0x2d5f('0x57')]['id']}})[_0x2d5f('0x29')](handleEntityNotFound(_0x329af7,null))[_0x2d5f('0x29')](function(_0x2ac446){if(_0x2ac446){_0x33bcb6=_0x2ac446;_0x356e5f[_0x2d5f('0x33')]=_[_0x2d5f('0x34')](db[_0x2d5f('0x9e')][_0x2d5f('0x5d')]);_0x356e5f['query']=_['keys'](_0x4fd9e2[_0x2d5f('0x35')]);_0x356e5f['filters']=_[_0x2d5f('0x36')](_0x356e5f['model'],_0x356e5f[_0x2d5f('0x35')]);_0x27c518['attributes']=_[_0x2d5f('0x36')](_0x356e5f['model'],qs['fields'](_0x4fd9e2[_0x2d5f('0x35')][_0x2d5f('0x38')]));_0x27c518[_0x2d5f('0x37')]=_0x27c518[_0x2d5f('0x37')][_0x2d5f('0x39')]?_0x27c518[_0x2d5f('0x37')]:_0x356e5f[_0x2d5f('0x33')];_0x27c518['order']=qs[_0x2d5f('0x3d')](_0x4fd9e2[_0x2d5f('0x35')]['sort']);_0x27c518[_0x2d5f('0x3e')]=qs['filters'](_[_0x2d5f('0x40')](_0x4fd9e2[_0x2d5f('0x35')],_0x356e5f['filters']));if(_0x4fd9e2['query']['filter']){_0x27c518[_0x2d5f('0x3e')]=_[_0x2d5f('0x41')](_0x27c518['where'],{'$or':_['map'](_0x27c518['attributes'],function(_0x4becf9){var _0x2b8ef3={};_0x2b8ef3[_0x4becf9]={'$like':'%'+_0x4fd9e2[_0x2d5f('0x35')]['filter']+'%'};return _0x2b8ef3;})});}_0x27c518=_['merge']({},_0x27c518,_0x4fd9e2['options']);return _0x33bcb6[_0x2d5f('0x9f')](_0x27c518);}})[_0x2d5f('0x29')](function(_0x25239c){if(_0x25239c){_0x30b5ec=_0x25239c[_0x2d5f('0x39')];if(!_0x4fd9e2[_0x2d5f('0x35')][_0x2d5f('0x3a')](_0x2d5f('0x3b'))){_0x27c518[_0x2d5f('0x22')]=qs[_0x2d5f('0x22')](_0x4fd9e2['query'][_0x2d5f('0x22')]);_0x27c518[_0x2d5f('0x20')]=qs['offset'](_0x4fd9e2[_0x2d5f('0x35')][_0x2d5f('0x20')]);}return _0x33bcb6[_0x2d5f('0x9f')](_0x27c518);}})[_0x2d5f('0x29')](function(_0xba867){if(_0xba867){return _0xba867?{'count':_0x30b5ec,'rows':_0xba867}:null;}})['then'](respondWithResult(_0x329af7,null))[_0x2d5f('0x48')](handleError(_0x329af7,null));};function handleQuery(_0x2b3309){logger[_0x2d5f('0xa0')](_0x2b3309);return db[_0x2d5f('0x8c')][_0x2d5f('0x35')](_0x2b3309)[_0x2d5f('0x99')](function(_0x5c09a1){csv_results[_0x2d5f('0x66')](_0x5c09a1);})[_0x2d5f('0x48')](function(_0x310291){logger[_0x2d5f('0x54')](_0x310291[_0x2d5f('0x68')]);});} \ No newline at end of file +var _0x257c=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','Lists','UserProfileResource','then','sendStatus','stack','name','send','index','map','rawAttributes','key','model','query','keys','attributes','fields','length','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','CmList','include','findAll','rows','catch','show','params','intersection','includeAll','options','find','create','body','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','ListId','Disposition','getDispositions','findOne','hasOwnProperty','pick','removeDispositions','ids','addContacts','CmContact','describe','isArray','tags','join','push','each','omit','success','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','CmCustomField','alias','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','select','description','description_additionalPhone_','toString','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','type','number','INTEGER','BOOLEAN','defaultValue','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','removeAgents','emit','userCmList:remove','User','getAgents','info','error','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x257c,0x140));var _0xc257=function(_0x31122e,_0x24fbf7){_0x31122e=_0x31122e-0x0;var _0x54922b=_0x257c[_0x31122e];return _0x54922b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc257('0x0'));var zipdir=require(_0xc257('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc257('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc257('0x3'));var util=require(_0xc257('0x4'));var path=require('path');var sox=require(_0xc257('0x5'));var csv=require(_0xc257('0x6'));var ejs=require(_0xc257('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc257('0x8'));var squel=require(_0xc257('0x9'));var crypto=require(_0xc257('0xa'));var jsforce=require(_0xc257('0xb'));var deskjs=require(_0xc257('0xc'));var toCsv=require(_0xc257('0x6'));var querystring=require(_0xc257('0xd'));var Papa=require(_0xc257('0xe'));var Redis=require(_0xc257('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc257('0x10'));var as=require(_0xc257('0x11'));var hardwareService=require(_0xc257('0x12'));var logger=require(_0xc257('0x13'))('api');var utils=require(_0xc257('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc257('0x15'));var db=require(_0xc257('0x16'))['db'];var csv_results;config[_0xc257('0x17')]=_['defaults'](config[_0xc257('0x17')],{'host':_0xc257('0x18'),'port':0x18eb});var socket=require(_0xc257('0x19'))(new Redis(config[_0xc257('0x17')]));require(_0xc257('0x1a'))['register'](socket);function respondWithStatusCode(_0x2c2f38,_0x4d86fa){_0x4d86fa=_0x4d86fa||0xcc;return function(_0x1a0a1f){if(_0x1a0a1f){return _0x2c2f38['sendStatus'](_0x4d86fa);}return _0x2c2f38[_0xc257('0x1b')](_0x4d86fa)[_0xc257('0x1c')]();};}function respondWithResult(_0x2c5eca,_0x6d68d1){_0x6d68d1=_0x6d68d1||0xc8;return function(_0x3fac75){if(_0x3fac75){return _0x2c5eca[_0xc257('0x1b')](_0x6d68d1)[_0xc257('0x1d')](_0x3fac75);}};}function respondWithFilteredResult(_0x1ff388,_0x4e0ee3){return function(_0x410df4){if(_0x410df4){var _0x26acbf=typeof _0x4e0ee3[_0xc257('0x1e')]===_0xc257('0x1f')&&typeof _0x4e0ee3[_0xc257('0x20')]==='undefined';var _0x7cd720=_0x410df4[_0xc257('0x21')];var _0x4be41c=_0x26acbf?0x0:_0x4e0ee3[_0xc257('0x1e')];var _0x43d5fe=_0x26acbf?_0x410df4[_0xc257('0x21')]:_0x4e0ee3[_0xc257('0x1e')]+_0x4e0ee3['limit'];var _0x51892b;if(_0x43d5fe>=_0x7cd720){_0x43d5fe=_0x7cd720;_0x51892b=0xc8;}else{_0x51892b=0xce;}_0x1ff388[_0xc257('0x1b')](_0x51892b);return _0x1ff388[_0xc257('0x22')](_0xc257('0x23'),_0x4be41c+'-'+_0x43d5fe+'/'+_0x7cd720)['json'](_0x410df4);}return null;};}function patchUpdates(_0x50a7d0){return function(_0x3479ba){try{jsonpatch[_0xc257('0x24')](_0x3479ba,_0x50a7d0,!![]);}catch(_0x11ed68){return BPromise[_0xc257('0x25')](_0x11ed68);}return _0x3479ba[_0xc257('0x26')]();};}function saveUpdates(_0x5461da,_0x19db48){return function(_0x3675ba){if(_0x3675ba){return _0x3675ba[_0xc257('0x27')](_0x5461da)['then'](function(_0xf2d8ca){return _0xf2d8ca;});}return null;};}function removeEntity(_0x5081c9,_0x1ef28b){return function(_0x2e223f){if(_0x2e223f){return _0x2e223f[_0xc257('0x28')]()['then'](function(){var _0x13aeae=_0x2e223f[_0xc257('0x29')]({'plain':!![]});var _0x1f0246=_0xc257('0x2a');return db[_0xc257('0x2b')][_0xc257('0x28')]({'where':{'type':_0x1f0246,'resourceId':_0x13aeae['id']}})[_0xc257('0x2c')](function(){return _0x2e223f;});})[_0xc257('0x2c')](function(){_0x5081c9['status'](0xcc)[_0xc257('0x1c')]();});}};}function handleEntityNotFound(_0x240855,_0x51b6c2){return function(_0x1fcf9b){if(!_0x1fcf9b){_0x240855[_0xc257('0x2d')](0x194);}return _0x1fcf9b;};}function handleError(_0x1c071c,_0x5bf9aa){_0x5bf9aa=_0x5bf9aa||0x1f4;return function(_0x5e01a1){logger['error'](_0x5e01a1[_0xc257('0x2e')]);if(_0x5e01a1['name']){delete _0x5e01a1[_0xc257('0x2f')];}_0x1c071c[_0xc257('0x1b')](_0x5bf9aa)[_0xc257('0x30')](_0x5e01a1);};}exports[_0xc257('0x31')]=function(_0x3ed0c8,_0xe20592){var _0x24c0c9={},_0x891546={},_0x2c7dff={'count':0x0,'rows':[]};var _0x2352f3=_[_0xc257('0x32')](db['CmList'][_0xc257('0x33')],function(_0x2ee923){return{'name':_0x2ee923['fieldName'],'type':_0x2ee923['type'][_0xc257('0x34')]};});_0x891546[_0xc257('0x35')]=_[_0xc257('0x32')](_0x2352f3,_0xc257('0x2f'));_0x891546[_0xc257('0x36')]=_[_0xc257('0x37')](_0x3ed0c8[_0xc257('0x36')]);_0x891546['filters']=_['intersection'](_0x891546[_0xc257('0x35')],_0x891546[_0xc257('0x36')]);_0x24c0c9[_0xc257('0x38')]=_['intersection'](_0x891546[_0xc257('0x35')],qs[_0xc257('0x39')](_0x3ed0c8['query'][_0xc257('0x39')]));_0x24c0c9[_0xc257('0x38')]=_0x24c0c9[_0xc257('0x38')][_0xc257('0x3a')]?_0x24c0c9[_0xc257('0x38')]:_0x891546[_0xc257('0x35')];if(!_0x3ed0c8[_0xc257('0x36')]['hasOwnProperty'](_0xc257('0x3b'))){_0x24c0c9['limit']=qs['limit'](_0x3ed0c8[_0xc257('0x36')][_0xc257('0x20')]);_0x24c0c9[_0xc257('0x1e')]=qs[_0xc257('0x1e')](_0x3ed0c8[_0xc257('0x36')][_0xc257('0x1e')]);}_0x24c0c9[_0xc257('0x3c')]=qs[_0xc257('0x3d')](_0x3ed0c8[_0xc257('0x36')][_0xc257('0x3d')]);_0x24c0c9['where']=qs[_0xc257('0x3e')](_['pick'](_0x3ed0c8[_0xc257('0x36')],_0x891546['filters']),_0x2352f3);if(_0x3ed0c8['query'][_0xc257('0x3f')]){_0x24c0c9[_0xc257('0x40')]=_[_0xc257('0x41')](_0x24c0c9[_0xc257('0x40')],{'$or':_[_0xc257('0x32')](_0x2352f3,function(_0x5dea4e){if(_0x5dea4e['type']!==_0xc257('0x42')){var _0x4b294d={};_0x4b294d[_0x5dea4e[_0xc257('0x2f')]]={'$like':'%'+_0x3ed0c8[_0xc257('0x36')][_0xc257('0x3f')]+'%'};return _0x4b294d;}})});}_0x24c0c9=_['merge']({},_0x24c0c9,_0x3ed0c8['options']);var _0x5e5de4={'where':_0x24c0c9['where']};return db[_0xc257('0x43')][_0xc257('0x21')](_0x5e5de4)[_0xc257('0x2c')](function(_0x545a5a){_0x2c7dff['count']=_0x545a5a;if(_0x3ed0c8['query']['includeAll']){_0x24c0c9[_0xc257('0x44')]=[{'all':!![]}];}return db['CmList'][_0xc257('0x45')](_0x24c0c9);})[_0xc257('0x2c')](function(_0x482b83){_0x2c7dff[_0xc257('0x46')]=_0x482b83;return _0x2c7dff;})[_0xc257('0x2c')](respondWithFilteredResult(_0xe20592,_0x24c0c9))[_0xc257('0x47')](handleError(_0xe20592,null));};exports[_0xc257('0x48')]=function(_0x54862d,_0xdb3b7e){var _0x5db29f={'raw':![],'where':{'id':_0x54862d[_0xc257('0x49')]['id']}},_0x2f430c={};_0x2f430c[_0xc257('0x35')]=_[_0xc257('0x37')](db[_0xc257('0x43')][_0xc257('0x33')]);_0x2f430c[_0xc257('0x36')]=_[_0xc257('0x37')](_0x54862d['query']);_0x2f430c[_0xc257('0x3e')]=_[_0xc257('0x4a')](_0x2f430c['model'],_0x2f430c['query']);_0x5db29f['attributes']=_[_0xc257('0x4a')](_0x2f430c[_0xc257('0x35')],qs[_0xc257('0x39')](_0x54862d[_0xc257('0x36')][_0xc257('0x39')]));_0x5db29f['attributes']=_0x5db29f[_0xc257('0x38')][_0xc257('0x3a')]?_0x5db29f['attributes']:_0x2f430c[_0xc257('0x35')];if(_0x54862d[_0xc257('0x36')][_0xc257('0x4b')]){_0x5db29f['include']=[{'all':!![]}];}_0x5db29f=_[_0xc257('0x41')]({},_0x5db29f,_0x54862d[_0xc257('0x4c')]);return db[_0xc257('0x43')][_0xc257('0x4d')](_0x5db29f)[_0xc257('0x2c')](handleEntityNotFound(_0xdb3b7e,null))[_0xc257('0x2c')](respondWithResult(_0xdb3b7e,null))[_0xc257('0x47')](handleError(_0xdb3b7e,null));};exports[_0xc257('0x4e')]=function(_0x409540,_0x21c3fe){return db['CmList'][_0xc257('0x4e')](_0x409540[_0xc257('0x4f')],{})[_0xc257('0x2c')](function(_0x14cd52){var _0x551cb6=_0x409540[_0xc257('0x50')][_0xc257('0x29')]({'plain':!![]});if(!_0x551cb6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x551cb6['role']==='user'){var _0x24cc7f=_0x14cd52[_0xc257('0x29')]({'plain':!![]});var _0x30b35d=_0xc257('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x30b35d,'userProfileId':_0x551cb6[_0xc257('0x51')]},'raw':!![]})[_0xc257('0x2c')](function(_0x36a24f){if(_0x36a24f&&_0x36a24f[_0xc257('0x52')]===0x0){return db['UserProfileResource'][_0xc257('0x4e')]({'name':_0x24cc7f[_0xc257('0x2f')],'resourceId':_0x24cc7f['id'],'type':_0x36a24f[_0xc257('0x2f')],'sectionId':_0x36a24f['id']},{})[_0xc257('0x2c')](function(){return _0x14cd52;});}else{return _0x14cd52;}})[_0xc257('0x47')](function(_0x594c5a){logger['error'](_0xc257('0x53'),_0x594c5a);throw _0x594c5a;});}return _0x14cd52;})[_0xc257('0x2c')](respondWithResult(_0x21c3fe,0xc9))[_0xc257('0x47')](handleError(_0x21c3fe,null));};exports['update']=function(_0x5599c1,_0x8931a){if(_0x5599c1[_0xc257('0x4f')]['id']){delete _0x5599c1[_0xc257('0x4f')]['id'];}return db[_0xc257('0x43')]['find']({'where':{'id':_0x5599c1['params']['id']}})[_0xc257('0x2c')](handleEntityNotFound(_0x8931a,null))['then'](saveUpdates(_0x5599c1[_0xc257('0x4f')],null))[_0xc257('0x2c')](respondWithResult(_0x8931a,null))[_0xc257('0x47')](handleError(_0x8931a,null));};exports[_0xc257('0x28')]=function(_0x2b389e,_0x3aa8bf){return db[_0xc257('0x43')]['find']({'where':{'id':_0x2b389e[_0xc257('0x49')]['id']}})[_0xc257('0x2c')](handleEntityNotFound(_0x3aa8bf,null))[_0xc257('0x2c')](removeEntity(_0x3aa8bf,null))[_0xc257('0x47')](handleError(_0x3aa8bf,null));};exports['describe']=function(_0x523b6f,_0x2176e6){return db[_0xc257('0x43')]['describe']()[_0xc257('0x2c')](respondWithResult(_0x2176e6,null))[_0xc257('0x47')](handleError(_0x2176e6,null));};exports[_0xc257('0x54')]=function(_0x307de0,_0x485291,_0x1c1c1c){if(_0x307de0[_0xc257('0x4f')]['id']){delete _0x307de0[_0xc257('0x4f')]['id'];}return db['CmList'][_0xc257('0x4d')]({'where':{'id':_0x307de0[_0xc257('0x49')]['id']}})[_0xc257('0x2c')](handleEntityNotFound(_0x485291,null))[_0xc257('0x2c')](function(_0x4b7315){if(_0x4b7315){_0x307de0[_0xc257('0x4f')][_0xc257('0x55')]=_0x4b7315['id'];return db[_0xc257('0x56')][_0xc257('0x4e')](_0x307de0['body']);}})['then'](respondWithResult(_0x485291,null))[_0xc257('0x47')](handleError(_0x485291,null));};exports[_0xc257('0x57')]=function(_0x182ccc,_0x288edc,_0x5a7c61){var _0x3cef69={'raw':![],'where':{}};var _0xbb2ad={};var _0x457420={'count':0x0,'rows':[]};return db['CmList'][_0xc257('0x58')]({'where':{'id':_0x182ccc[_0xc257('0x49')]['id']}})['then'](handleEntityNotFound(_0x288edc,null))[_0xc257('0x2c')](function(_0x583a8a){if(_0x583a8a){_0xbb2ad[_0xc257('0x35')]=_['keys'](db[_0xc257('0x56')][_0xc257('0x33')]);_0xbb2ad[_0xc257('0x36')]=_[_0xc257('0x37')](_0x182ccc['query']);_0xbb2ad['filters']=_[_0xc257('0x4a')](_0xbb2ad[_0xc257('0x35')],_0xbb2ad[_0xc257('0x36')]);_0x3cef69['attributes']=_[_0xc257('0x4a')](_0xbb2ad['model'],qs[_0xc257('0x39')](_0x182ccc[_0xc257('0x36')]['fields']));_0x3cef69['attributes']=_0x3cef69[_0xc257('0x38')][_0xc257('0x3a')]?_0x3cef69['attributes']:_0xbb2ad[_0xc257('0x35')];if(!_0x182ccc[_0xc257('0x36')][_0xc257('0x59')](_0xc257('0x3b'))){_0x3cef69[_0xc257('0x20')]=qs[_0xc257('0x20')](_0x182ccc[_0xc257('0x36')][_0xc257('0x20')]);_0x3cef69[_0xc257('0x1e')]=qs[_0xc257('0x1e')](_0x182ccc['query']['offset']);}_0x3cef69[_0xc257('0x3c')]=qs[_0xc257('0x3d')](_0x182ccc['query'][_0xc257('0x3d')]);_0x3cef69[_0xc257('0x40')]=qs[_0xc257('0x3e')](_[_0xc257('0x5a')](_0x182ccc[_0xc257('0x36')],_0xbb2ad[_0xc257('0x3e')]));_0x3cef69[_0xc257('0x40')][_0xc257('0x55')]=_0x583a8a['id'];if(_0x182ccc[_0xc257('0x36')][_0xc257('0x3f')]){_0x3cef69[_0xc257('0x40')]=_[_0xc257('0x41')](_0x3cef69[_0xc257('0x40')],{'$or':_[_0xc257('0x32')](_0x3cef69['attributes'],function(_0x389491){var _0x115d73={};_0x115d73[_0x389491]={'$like':'%'+_0x182ccc[_0xc257('0x36')][_0xc257('0x3f')]+'%'};return _0x115d73;})});}_0x3cef69=_[_0xc257('0x41')]({},_0x3cef69,_0x182ccc[_0xc257('0x4c')]);return db['Disposition'][_0xc257('0x21')]({'where':_0x3cef69[_0xc257('0x40')]})['then'](function(_0x579476){_0x457420[_0xc257('0x21')]=_0x579476;if(_0x182ccc['query']['includeAll']){_0x3cef69[_0xc257('0x44')]=[{'all':!![]}];}return db[_0xc257('0x56')]['findAll'](_0x3cef69);})[_0xc257('0x2c')](function(_0x95bb2e){_0x457420['rows']=_0x95bb2e;return _0x457420;});}})['then'](respondWithFilteredResult(_0x288edc,_0x3cef69))[_0xc257('0x47')](handleError(_0x288edc,null));};exports[_0xc257('0x5b')]=function(_0x36ba89,_0x1f732b,_0x4028eb){return db['CmList']['find']({'where':{'id':_0x36ba89[_0xc257('0x49')]['id']}})[_0xc257('0x2c')](handleEntityNotFound(_0x1f732b,null))[_0xc257('0x2c')](function(_0x6f7b92){if(_0x6f7b92){return _0x6f7b92[_0xc257('0x5b')](_0x36ba89[_0xc257('0x36')][_0xc257('0x5c')]);}})[_0xc257('0x2c')](respondWithStatusCode(_0x1f732b,null))['catch'](handleError(_0x1f732b,null));};exports[_0xc257('0x5d')]=function(_0x260414,_0x40a683,_0x1585a3){return db[_0xc257('0x43')][_0xc257('0x4d')]({'where':{'id':_0x260414[_0xc257('0x49')]['id']}})[_0xc257('0x2c')](handleEntityNotFound(_0x40a683,null))[_0xc257('0x2c')](function(_0x449959){if(_0x449959){var _0x5dd594=[];var _0x4fdd71={'success':[],'errors':[]};return db[_0xc257('0x5e')][_0xc257('0x5f')]()['then'](function(_0x679169){if(_0x260414[_0xc257('0x4f')]['tags']&&_[_0xc257('0x60')](_0x260414[_0xc257('0x4f')][_0xc257('0x61')])){if(_0x260414[_0xc257('0x4f')][_0xc257('0x61')]['length']){_0x260414[_0xc257('0x4f')][_0xc257('0x61')]=_0x260414[_0xc257('0x4f')][_0xc257('0x61')][_0xc257('0x62')](';')+';';}else{_0x260414['body'][_0xc257('0x61')]=null;}}else{_0x260414[_0xc257('0x4f')][_0xc257('0x61')]=null;}if(_0x260414[_0xc257('0x4f')]&&_[_0xc257('0x60')](_0x260414[_0xc257('0x4f')])){for(var _0x57302e=0x0;_0x57302e<_0x260414['body'][_0xc257('0x3a')];_0x57302e+=0x1){_0x260414['body'][_0x57302e]['ListId']=_0x260414[_0xc257('0x49')]['id'];_0x5dd594[_0xc257('0x63')](_0x260414[_0xc257('0x4f')][_0x57302e]);}return BPromise[_0xc257('0x64')](_0x5dd594,function(_0x390f8a){return db[_0xc257('0x5e')][_0xc257('0x4e')](_[_0xc257('0x65')](_0x390f8a,[_0xc257('0x5c'),'id'])||{},{'fields':_['keys'](_0x679169),'raw':!![]})['then'](function(_0x25e210){_0x4fdd71[_0xc257('0x66')]['push'](_0x25e210['dataValues']);})[_0xc257('0x47')](function(_0x11e455){_0x4fdd71[_0xc257('0x67')][_0xc257('0x63')]({'data':_0x390f8a,'error':_0x11e455[_0xc257('0x68')]});});})[_0xc257('0x2c')](function(_0x50c42b){return _0x4fdd71;})[_0xc257('0x47')](function(_0x33ce27){return _0x33ce27;});}else{_0x40a683[_0xc257('0x1b')](0x190)[_0xc257('0x1d')]({'message':_0xc257('0x69')});}});}})[_0xc257('0x2c')](respondWithResult(_0x40a683,null))['catch'](handleError(_0x40a683,null));};exports[_0xc257('0x6a')]=function(_0x43969c,_0x844e40,_0x2c8c00){var _0x342ceb;return db[_0xc257('0x43')]['find']({'where':{'id':_0x43969c[_0xc257('0x49')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xc257('0x6b')}]})[_0xc257('0x2c')](handleEntityNotFound(_0x844e40,null))[_0xc257('0x2c')](function(_0x2ebed2){if(_0x2ebed2){_0x342ceb=_0x2ebed2;return db['CmContact'][_0xc257('0x33')];}})['then'](function(_0x40e19c){if(_0x40e19c){var _0xb942ad={};var _0xb4e262={};_0xb4e262[_0xc257('0x35')]=_['concat'](_[_0xc257('0x37')](_0x40e19c),_['map'](_0x342ceb[_0xc257('0x6b')],function(_0x4bb6eb){return util[_0xc257('0x6c')](_0xc257('0x6d'),_0x4bb6eb['id']);}));_0xb4e262['query']=_[_0xc257('0x37')](_0x43969c[_0xc257('0x36')]);_0xb4e262[_0xc257('0x3e')]=_[_0xc257('0x4a')](_0xb4e262[_0xc257('0x35')],_0xb4e262[_0xc257('0x36')]);_0xb942ad[_0xc257('0x38')]=_['intersection'](_0xb4e262[_0xc257('0x35')],qs['fields'](_0x43969c['query'][_0xc257('0x39')]));_0xb942ad[_0xc257('0x38')]=_0xb942ad[_0xc257('0x38')][_0xc257('0x3a')]?_0xb942ad['attributes']:_0xb4e262[_0xc257('0x35')];if(!_0x43969c[_0xc257('0x36')][_0xc257('0x59')](_0xc257('0x3b'))){_0xb942ad[_0xc257('0x20')]=qs['limit'](_0x43969c[_0xc257('0x36')][_0xc257('0x20')]);_0xb942ad[_0xc257('0x1e')]=qs[_0xc257('0x1e')](_0x43969c[_0xc257('0x36')][_0xc257('0x1e')]);}_0xb942ad[_0xc257('0x3c')]=qs[_0xc257('0x3d')](_0x43969c[_0xc257('0x36')][_0xc257('0x3d')]);_0xb942ad[_0xc257('0x40')]=qs['filters'](_[_0xc257('0x5a')](_0x43969c[_0xc257('0x36')],_0xb4e262[_0xc257('0x3e')]));_0xb942ad[_0xc257('0x6e')]=!![];if(_0x43969c[_0xc257('0x36')]['filter']){_0xb942ad[_0xc257('0x40')]=_[_0xc257('0x41')](_0xb942ad[_0xc257('0x40')],{'$or':_[_0xc257('0x32')](_0xb942ad[_0xc257('0x38')],function(_0x88ad08){var _0x1adb64={};_0x1adb64[_0x88ad08]={'$like':'%'+_0x43969c[_0xc257('0x36')][_0xc257('0x3f')]+'%'};return _0x1adb64;})});}_0xb942ad=_[_0xc257('0x41')]({},_0xb942ad,_0x43969c[_0xc257('0x4c')]);return _0x342ceb[_0xc257('0x6a')](_0xb942ad);}})[_0xc257('0x2c')](respondWithResult(_0x844e40,null))['catch'](handleError(_0x844e40,null));};exports[_0xc257('0x6f')]=function(_0x36d050,_0x56a4ae,_0x4efb63){var _0x357119;var _0x2fa780;var _0x54822d;var _0x479035=_0x36d050['params']['id'];csv_results=[];return db[_0xc257('0x70')][_0xc257('0x45')]({'attributes':['id','name'],'raw':!![],'order':[_0xc257('0x71')]})[_0xc257('0x2c')](function(_0xe7a2d0){_0x357119=_0xe7a2d0;var _0x38b616=_[_0xc257('0x37')](db['CmContact'][_0xc257('0x33')]);return db[_0xc257('0x72')][_0xc257('0x45')]({'raw':!![],'attributes':['id',_0xc257('0x73')]})[_0xc257('0x2c')](function(_0x4bde53){_0x2fa780=_0x4bde53;var _0x5644f7=squel['select']()['fields'](_0x38b616)[_0xc257('0x74')](_0xc257('0x75'),'c')[_0xc257('0x40')](_0xc257('0x76'),_0x479035)['where'](_0xc257('0x77'))[_0xc257('0x78')]();for(var _0x552ccb=0x0;_0x552ccb<_0x2fa780[_0xc257('0x3a')];_0x552ccb++){_0x5644f7[_0xc257('0x79')](_0xc257('0x7a')+_0x2fa780[_0x552ccb]['id'],_0xc257('0x7b')+_0x2fa780[_0x552ccb][_0xc257('0x73')]);}for(var _0x552ccb=0x0;_0x552ccb<_0x357119[_0xc257('0x3a')];_0x552ccb++){_0x5644f7[_0xc257('0x79')](squel['select']()['field'](_0xc257('0x7c'))[_0xc257('0x74')](_0xc257('0x7d'))[_0xc257('0x40')]('ItemTypeId\x20=\x20?',_0x357119[_0x552ccb]['id'])[_0xc257('0x40')](_0xc257('0x7e')),_0xc257('0x7f')+_0x357119[_0x552ccb][_0xc257('0x2f')]);_0x5644f7[_0xc257('0x79')](squel[_0xc257('0x80')]()[_0xc257('0x79')](_0xc257('0x81'))[_0xc257('0x74')]('cm_contact_has_items')[_0xc257('0x40')]('ItemTypeId\x20=\x20?',_0x357119[_0x552ccb]['id'])['where']('CmContactId\x20=\x20c.id'),_0xc257('0x82')+_0x357119[_0x552ccb]['name']);}var _0x40878f=[];_0x40878f[_0xc257('0x63')](_0x5644f7[_0xc257('0x83')]());BPromise[_0xc257('0x64')](_0x40878f,handleQuery)['then'](function(_0x4543be){handleQuery(_0x5644f7[_0xc257('0x83')]());var _0x47f54f=csv_results[0x0];if(!_[_0xc257('0x84')](_0x47f54f)){var _0x169a1b=toCsv(_0x47f54f);var _0x11d2ef=Date[_0xc257('0x85')]();fs['writeFileSync'](util[_0xc257('0x6c')](_0xc257('0x86'),_0x479035,_0x11d2ef),_0x169a1b);_0x56a4ae[_0xc257('0x87')]('Content-disposition',_0xc257('0x88')+util[_0xc257('0x6c')](_0xc257('0x89'),_0x479035,_0x11d2ef));_0x56a4ae[_0xc257('0x87')](_0xc257('0x8a'),_0xc257('0x8b'));return _0x56a4ae[_0xc257('0x8c')](util['format']('/tmp/list_%d_%s.csv',_0x479035,_0x11d2ef));}else{return _0x56a4ae[_0xc257('0x2d')](0xcc);}});});});};exports[_0xc257('0x8d')]=function(_0xed8e4b,_0x4de67c,_0x34f28c){var _0x154432;delete _0xed8e4b[_0xc257('0x4f')]['id'];return db['CmList'][_0xc257('0x58')]({'where':{'id':_0xed8e4b[_0xc257('0x49')]['id']}})['then'](handleEntityNotFound(_0x4de67c,null))[_0xc257('0x2c')](function(_0x334607){if(_0x334607){return db[_0xc257('0x8e')][_0xc257('0x8f')](function(_0x138baa){return db[_0xc257('0x72')]['create'](_0xed8e4b['body'],{'transaction':_0x138baa})['then'](function(_0x84aaa0){_0x154432=_0x84aaa0;return _0x334607[_0xc257('0x90')](_0x84aaa0,{'transaction':_0x138baa});})[_0xc257('0x2c')](function(){var _0x4fa68c={'type':db[_0xc257('0x91')][_0xc257('0x92')],'transaction':_0x138baa};switch(_0xed8e4b['body']['type']){case'text':_0x4fa68c[_0xc257('0x93')]=db[_0xc257('0x91')][_0xc257('0x92')];break;case _0xc257('0x94'):_0x4fa68c['type']=db['Sequelize'][_0xc257('0x95')];break;case'switch':_0x4fa68c['type']=db[_0xc257('0x91')][_0xc257('0x96')];_0x4fa68c[_0xc257('0x97')]=![];break;default:}return db['sequelize']['queryInterface']['addColumn'](_0xc257('0x75'),util[_0xc257('0x6c')](_0xc257('0x98'),_0x154432['id']),_0x4fa68c);})['then'](function(){return _0x154432;});});}})[_0xc257('0x2c')](respondWithResult(_0x4de67c,null))[_0xc257('0x47')](handleError(_0x4de67c,null));};exports[_0xc257('0x99')]=function(_0x3405e6,_0x1d75de,_0x1f1155){var _0x4af9d5={};var _0x264ece={};var _0x33ea33;var _0x1f3616;return db[_0xc257('0x43')]['findOne']({'where':{'id':_0x3405e6['params']['id']}})[_0xc257('0x2c')](handleEntityNotFound(_0x1d75de,null))[_0xc257('0x2c')](function(_0x2d13fb){if(_0x2d13fb){_0x33ea33=_0x2d13fb;_0x264ece['model']=_[_0xc257('0x37')](db[_0xc257('0x72')][_0xc257('0x33')]);_0x264ece[_0xc257('0x36')]=_['keys'](_0x3405e6[_0xc257('0x36')]);_0x264ece[_0xc257('0x3e')]=_['intersection'](_0x264ece[_0xc257('0x35')],_0x264ece['query']);_0x4af9d5[_0xc257('0x38')]=_['intersection'](_0x264ece[_0xc257('0x35')],qs[_0xc257('0x39')](_0x3405e6[_0xc257('0x36')][_0xc257('0x39')]));_0x4af9d5['attributes']=_0x4af9d5[_0xc257('0x38')]['length']?_0x4af9d5['attributes']:_0x264ece[_0xc257('0x35')];_0x4af9d5['order']=qs[_0xc257('0x3d')](_0x3405e6[_0xc257('0x36')]['sort']);_0x4af9d5['where']=qs[_0xc257('0x3e')](_[_0xc257('0x5a')](_0x3405e6[_0xc257('0x36')],_0x264ece[_0xc257('0x3e')]));_0x4af9d5[_0xc257('0x40')]=_[_0xc257('0x41')](_0x4af9d5['where'],{'$or':[{'ListId':_0x2d13fb['id']},{'ListId':null}]});if(_0x3405e6['query']['filter']){_0x4af9d5[_0xc257('0x40')]=_['merge'](_0x4af9d5[_0xc257('0x40')],{'$or':_[_0xc257('0x32')](_0x4af9d5[_0xc257('0x38')],function(_0x55e354){var _0x258987={};_0x258987[_0x55e354]={'$like':'%'+_0x3405e6[_0xc257('0x36')][_0xc257('0x3f')]+'%'};return _0x258987;})});}_0x4af9d5=_[_0xc257('0x41')]({},_0x4af9d5,_0x3405e6['options']);return db[_0xc257('0x72')][_0xc257('0x9a')](_0x4af9d5);}})[_0xc257('0x2c')](respondWithResult(_0x1d75de,null))[_0xc257('0x47')](handleError(_0x1d75de,null));};exports[_0xc257('0x9b')]=function(_0x5b4ed2,_0x346728){return db[_0xc257('0x72')][_0xc257('0x9a')]({'where':{'ListId':null}})[_0xc257('0x2c')](handleEntityNotFound(_0x346728,null))['then'](function(_0x306c37){return _0x306c37;})[_0xc257('0x2c')](respondWithResult(_0x346728,null))[_0xc257('0x47')](handleError(_0x346728,null));};exports[_0xc257('0x9c')]=function(_0x337a26,_0x437071,_0x27cdd7){return db[_0xc257('0x43')][_0xc257('0x4d')]({'where':{'id':_0x337a26['params']['id']}})[_0xc257('0x2c')](handleEntityNotFound(_0x437071,null))[_0xc257('0x2c')](function(_0x232904){if(_0x232904){return _0x232904[_0xc257('0x9c')](_0x337a26['body'][_0xc257('0x5c')],_[_0xc257('0x65')](_0x337a26[_0xc257('0x4f')],[_0xc257('0x5c'),'id'])||{})[_0xc257('0x9d')](function(_0x560512){for(var _0x2215d1=0x0;_0x2215d1<_0x337a26[_0xc257('0x4f')]['ids'][_0xc257('0x3a')];_0x2215d1+=0x1){socket['emit']('userCmList:save',{'UserId':Number(_0x337a26['body'][_0xc257('0x5c')][_0x2215d1]),'CmListId':Number(_0x337a26[_0xc257('0x49')]['id'])});}return _0x560512;});}})['then'](respondWithResult(_0x437071,null))[_0xc257('0x47')](handleError(_0x437071,null));};exports[_0xc257('0x9e')]=function(_0x3700fb,_0x4efba,_0x110c5d){return db[_0xc257('0x43')][_0xc257('0x4d')]({'where':{'id':_0x3700fb[_0xc257('0x49')]['id']}})[_0xc257('0x2c')](handleEntityNotFound(_0x4efba,null))['then'](function(_0x1ce262){if(_0x1ce262){return _0x1ce262[_0xc257('0x9e')](_0x3700fb['query'][_0xc257('0x5c')])['then'](function(){if(_[_0xc257('0x60')](_0x3700fb['query'][_0xc257('0x5c')])){for(var _0x2ec3f1=0x0;_0x2ec3f1<_0x3700fb[_0xc257('0x36')]['ids'][_0xc257('0x3a')];_0x2ec3f1+=0x1){socket[_0xc257('0x9f')]('userCmList:remove',{'UserId':Number(_0x3700fb[_0xc257('0x36')][_0xc257('0x5c')][_0x2ec3f1]),'CmListId':Number(_0x3700fb[_0xc257('0x49')]['id'])});}}else{socket[_0xc257('0x9f')](_0xc257('0xa0'),{'UserId':Number(_0x3700fb['query'][_0xc257('0x5c')]),'CmListId':Number(_0x3700fb[_0xc257('0x49')]['id'])});}});}})[_0xc257('0x2c')](respondWithStatusCode(_0x4efba,null))[_0xc257('0x47')](handleError(_0x4efba,null));};exports['getAgents']=function(_0x103b05,_0x17b86d,_0x2e0aa8){var _0x14ee0b={};var _0x27c7a9={};var _0x559c2b;var _0x51f5b2;return db[_0xc257('0x43')][_0xc257('0x58')]({'where':{'id':_0x103b05['params']['id']}})[_0xc257('0x2c')](handleEntityNotFound(_0x17b86d,null))[_0xc257('0x2c')](function(_0x4d3b1e){if(_0x4d3b1e){_0x559c2b=_0x4d3b1e;_0x27c7a9['model']=_[_0xc257('0x37')](db[_0xc257('0xa1')][_0xc257('0x33')]);_0x27c7a9['query']=_[_0xc257('0x37')](_0x103b05[_0xc257('0x36')]);_0x27c7a9[_0xc257('0x3e')]=_[_0xc257('0x4a')](_0x27c7a9[_0xc257('0x35')],_0x27c7a9[_0xc257('0x36')]);_0x14ee0b[_0xc257('0x38')]=_[_0xc257('0x4a')](_0x27c7a9[_0xc257('0x35')],qs[_0xc257('0x39')](_0x103b05[_0xc257('0x36')][_0xc257('0x39')]));_0x14ee0b['attributes']=_0x14ee0b[_0xc257('0x38')]['length']?_0x14ee0b[_0xc257('0x38')]:_0x27c7a9[_0xc257('0x35')];_0x14ee0b['order']=qs[_0xc257('0x3d')](_0x103b05[_0xc257('0x36')][_0xc257('0x3d')]);_0x14ee0b[_0xc257('0x40')]=qs[_0xc257('0x3e')](_[_0xc257('0x5a')](_0x103b05['query'],_0x27c7a9[_0xc257('0x3e')]));if(_0x103b05['query'][_0xc257('0x3f')]){_0x14ee0b[_0xc257('0x40')]=_[_0xc257('0x41')](_0x14ee0b['where'],{'$or':_[_0xc257('0x32')](_0x14ee0b[_0xc257('0x38')],function(_0x10da62){var _0x2bfd03={};_0x2bfd03[_0x10da62]={'$like':'%'+_0x103b05[_0xc257('0x36')]['filter']+'%'};return _0x2bfd03;})});}_0x14ee0b=_['merge']({},_0x14ee0b,_0x103b05[_0xc257('0x4c')]);return _0x559c2b[_0xc257('0xa2')](_0x14ee0b);}})[_0xc257('0x2c')](function(_0x12f1c5){if(_0x12f1c5){_0x51f5b2=_0x12f1c5[_0xc257('0x3a')];if(!_0x103b05['query']['hasOwnProperty'](_0xc257('0x3b'))){_0x14ee0b[_0xc257('0x20')]=qs[_0xc257('0x20')](_0x103b05[_0xc257('0x36')][_0xc257('0x20')]);_0x14ee0b[_0xc257('0x1e')]=qs[_0xc257('0x1e')](_0x103b05[_0xc257('0x36')][_0xc257('0x1e')]);}return _0x559c2b[_0xc257('0xa2')](_0x14ee0b);}})[_0xc257('0x2c')](function(_0x3acc76){if(_0x3acc76){return _0x3acc76?{'count':_0x51f5b2,'rows':_0x3acc76}:null;}})[_0xc257('0x2c')](respondWithResult(_0x17b86d,null))[_0xc257('0x47')](handleError(_0x17b86d,null));};function handleQuery(_0x273933){logger[_0xc257('0xa3')](_0x273933);return db['sequelize'][_0xc257('0x36')](_0x273933)['spread'](function(_0x4e5c08){csv_results[_0xc257('0x63')](_0x4e5c08);})[_0xc257('0x47')](function(_0x4ff9a5){logger[_0xc257('0xa4')](_0x4ff9a5['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 5166292..7d0fdb3 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 _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0x55ca,0x126));var _0xa55c=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x55ca[_0x5f0089];return _0x193892;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x1bfb55,_0x2f0205){var _0x59fe7d=function(_0x384460){while(--_0x384460){_0x1bfb55['push'](_0x1bfb55['shift']());}};_0x59fe7d(++_0x2f0205);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 47ca876..f6c4c88 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 _0xd64b=['define','CmList','cm_lists','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x40da45,_0x29029f){var _0x29f717=function(_0x54c13c){while(--_0x54c13c){_0x40da45['push'](_0x40da45['shift']());}};_0x29f717(++_0x29029f);}(_0xd64b,0xc1));var _0xbd64=function(_0x42be36,_0x425079){_0x42be36=_0x42be36-0x0;var _0x3473d4=_0xd64b[_0x42be36];return _0x3473d4;};'use strict';var _=require(_0xbd64('0x0'));var util=require('util');var logger=require(_0xbd64('0x1'))('api');var moment=require(_0xbd64('0x2'));var BPromise=require(_0xbd64('0x3'));var rp=require(_0xbd64('0x4'));var fs=require('fs');var path=require(_0xbd64('0x5'));var rimraf=require(_0xbd64('0x6'));var config=require('../../config/environment');var attributes=require('./cmList.attributes');module['exports']=function(_0x51e87d,_0x58e9e7){return _0x51e87d[_0xbd64('0x7')](_0xbd64('0x8'),attributes,{'tableName':_0xbd64('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['cm_lists','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./cmList.attributes'];(function(_0x3d0e15,_0xdb46ae){var _0x4723bc=function(_0x5a02d4){while(--_0x5a02d4){_0x3d0e15['push'](_0x3d0e15['shift']());}};_0x4723bc(++_0xdb46ae);}(_0x70e0,0x17b));var _0x070e=function(_0x5a228b,_0x273a61){_0x5a228b=_0x5a228b-0x0;var _0x2224bb=_0x70e0[_0x5a228b];return _0x2224bb;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('CmList',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 2831a6a..47065c5 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 _0x90d3=['message','result','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1e9be4,_0x4138d7){var _0x2d39f6=function(_0x2b0851){while(--_0x2b0851){_0x1e9be4['push'](_0x1e9be4['shift']());}};_0x2d39f6(++_0x4138d7);}(_0x90d3,0x1ab));var _0x390d=function(_0x41cfd4,_0x1ed2cc){_0x41cfd4=_0x41cfd4-0x0;var _0x190f48=_0x90d3[_0x41cfd4];return _0x190f48;};'use strict';var _=require(_0x390d('0x0'));var util=require('util');var moment=require(_0x390d('0x1'));var BPromise=require(_0x390d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x390d('0x3'))['db'];var utils=require(_0x390d('0x4'));var logger=require(_0x390d('0x5'))('rpc');var config=require(_0x390d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x390d('0x7')]['http']({'port':0x232a});config[_0x390d('0x8')]=_[_0x390d('0x9')](config['redis'],{'host':_0x390d('0xa'),'port':0x18eb});var socket=require(_0x390d('0xb'))(new Redis(config[_0x390d('0x8')]));require(_0x390d('0xc'))[_0x390d('0xd')](socket);function respondWithRpcPromise(_0x52ff2c,_0xd78bde,_0x5b2ead){return new BPromise(function(_0x4a37ef,_0x385199){return client[_0x390d('0xe')](_0x52ff2c,_0x5b2ead)['then'](function(_0x1cecc6){logger[_0x390d('0xf')](_0x390d('0x10'),_0xd78bde,'request\x20sent');logger[_0x390d('0x11')](_0x390d('0x12'),_0xd78bde,_0x390d('0x13'),JSON[_0x390d('0x14')](_0x1cecc6));if(_0x1cecc6['error']){if(_0x1cecc6[_0x390d('0x15')][_0x390d('0x16')]===0x1f4){logger[_0x390d('0x15')](_0x390d('0x10'),_0xd78bde,_0x1cecc6[_0x390d('0x15')][_0x390d('0x17')]);return _0x385199(_0x1cecc6['error'][_0x390d('0x17')]);}logger['error'](_0x390d('0x10'),_0xd78bde,_0x1cecc6['error']['message']);return _0x4a37ef(_0x1cecc6[_0x390d('0x15')][_0x390d('0x17')]);}else{logger['info'](_0x390d('0x10'),_0xd78bde,'request\x20sent');_0x4a37ef(_0x1cecc6[_0x390d('0x18')]['message']);}})['catch'](function(_0x133c58){logger[_0x390d('0x15')](_0x390d('0x10'),_0xd78bde,_0x133c58);_0x385199(_0x133c58);});});} \ No newline at end of file +var _0xaaa3=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','request','info','CmList,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x5cdb17,_0x453a81){var _0x253a6f=function(_0x580eb2){while(--_0x580eb2){_0x5cdb17['push'](_0x5cdb17['shift']());}};_0x253a6f(++_0x453a81);}(_0xaaa3,0x1c6));var _0x3aaa=function(_0x52867b,_0x473565){_0x52867b=_0x52867b-0x0;var _0x5854ec=_0xaaa3[_0x52867b];return _0x5854ec;};'use strict';var _=require(_0x3aaa('0x0'));var util=require(_0x3aaa('0x1'));var moment=require(_0x3aaa('0x2'));var BPromise=require(_0x3aaa('0x3'));var rs=require(_0x3aaa('0x4'));var fs=require('fs');var Redis=require(_0x3aaa('0x5'));var db=require(_0x3aaa('0x6'))['db'];var utils=require(_0x3aaa('0x7'));var logger=require(_0x3aaa('0x8'))(_0x3aaa('0x9'));var config=require(_0x3aaa('0xa'));var jayson=require(_0x3aaa('0xb'));var client=jayson[_0x3aaa('0xc')][_0x3aaa('0xd')]({'port':0x232a});config[_0x3aaa('0xe')]=_[_0x3aaa('0xf')](config[_0x3aaa('0xe')],{'host':_0x3aaa('0x10'),'port':0x18eb});var socket=require(_0x3aaa('0x11'))(new Redis(config['redis']));require(_0x3aaa('0x12'))['register'](socket);function respondWithRpcPromise(_0x1052cc,_0x2af4c4,_0x2bb137){return new BPromise(function(_0x4b1a32,_0x2c6633){return client[_0x3aaa('0x13')](_0x1052cc,_0x2bb137)['then'](function(_0x1439e5){logger[_0x3aaa('0x14')](_0x3aaa('0x15'),_0x2af4c4,'request\x20sent');logger[_0x3aaa('0x16')]('CmList,\x20%s,\x20%s,\x20%s',_0x2af4c4,_0x3aaa('0x17'),JSON[_0x3aaa('0x18')](_0x1439e5));if(_0x1439e5[_0x3aaa('0x19')]){if(_0x1439e5['error'][_0x3aaa('0x1a')]===0x1f4){logger[_0x3aaa('0x19')](_0x3aaa('0x15'),_0x2af4c4,_0x1439e5['error'][_0x3aaa('0x1b')]);return _0x2c6633(_0x1439e5[_0x3aaa('0x19')]['message']);}logger[_0x3aaa('0x19')](_0x3aaa('0x15'),_0x2af4c4,_0x1439e5[_0x3aaa('0x19')][_0x3aaa('0x1b')]);return _0x4b1a32(_0x1439e5['error'][_0x3aaa('0x1b')]);}else{logger[_0x3aaa('0x14')]('CmList,\x20%s,\x20%s',_0x2af4c4,_0x3aaa('0x17'));_0x4b1a32(_0x1439e5[_0x3aaa('0x1c')][_0x3aaa('0x1b')]);}})[_0x3aaa('0x1d')](function(_0x13e0bd){logger[_0x3aaa('0x19')](_0x3aaa('0x15'),_0x2af4c4,_0x13e0bd);_0x2c6633(_0x13e0bd);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 2e69f93..3e3dc97 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 _0xadb0=['./cmList.events','save','remove','removeListener','register','length'];(function(_0x4785f4,_0x510d19){var _0x5f520=function(_0x5f430c){while(--_0x5f430c){_0x4785f4['push'](_0x4785f4['shift']());}};_0x5f520(++_0x510d19);}(_0xadb0,0x108));var _0x0adb=function(_0x2d086f,_0x2cd5ed){_0x2d086f=_0x2d086f-0x0;var _0x4ee454=_0xadb0[_0x2d086f];return _0x4ee454;};'use strict';var CmListEvents=require(_0x0adb('0x0'));var events=[_0x0adb('0x1'),_0x0adb('0x2'),'update'];function createListener(_0x4fa3a1,_0x5da954){return function(_0x1dba4d){_0x5da954['emit'](_0x4fa3a1,_0x1dba4d);};}function removeListener(_0x1e31b6,_0x449a42){return function(){CmListEvents[_0x0adb('0x3')](_0x1e31b6,_0x449a42);};}exports[_0x0adb('0x4')]=function(_0x1a2037){for(var _0x5929a2=0x0,_0x528cce=events[_0x0adb('0x5')];_0x5929a2<_0x528cce;_0x5929a2++){var _0x3cba28=events[_0x5929a2];var _0x5cc39d=createListener('cmList:'+_0x3cba28,_0x1a2037);CmListEvents['on'](_0x3cba28,_0x5cc39d);}}; \ No newline at end of file +var _0xc8d9=['removeListener','cmList:','./cmList.events','save','remove','update','emit'];(function(_0x3a0ebd,_0x47f368){var _0x51a660=function(_0x4023e6){while(--_0x4023e6){_0x3a0ebd['push'](_0x3a0ebd['shift']());}};_0x51a660(++_0x47f368);}(_0xc8d9,0x183));var _0x9c8d=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0xc8d9[_0x8af54b];return _0x27d8f0;};'use strict';var CmListEvents=require(_0x9c8d('0x0'));var events=[_0x9c8d('0x1'),_0x9c8d('0x2'),_0x9c8d('0x3')];function createListener(_0x23500d,_0x53a5a4){return function(_0x462cae){_0x53a5a4[_0x9c8d('0x4')](_0x23500d,_0x462cae);};}function removeListener(_0x485f47,_0x35cdae){return function(){CmListEvents[_0x9c8d('0x5')](_0x485f47,_0x35cdae);};}exports['register']=function(_0x911ae4){for(var _0x40d4f7=0x0,_0x181c12=events['length'];_0x40d4f7<_0x181c12;_0x40d4f7++){var _0x10f559=events[_0x40d4f7];var _0xd63c0e=createListener(_0x9c8d('0x6')+_0x10f559,_0x911ae4);CmListEvents['on'](_0x10f559,_0xd63c0e);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index c053d55..a8d9a7b 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 _0xe782=['addDisposition','addContacts','addCustomField','addAgents','put','update','/:id','delete','removeDispositions','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','get','/global_fields','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','create','post'];(function(_0x3cb3ca,_0x44d697){var _0x214366=function(_0x6b38e1){while(--_0x6b38e1){_0x3cb3ca['push'](_0x3cb3ca['shift']());}};_0x214366(++_0x44d697);}(_0xe782,0x133));var _0x2e78=function(_0x295bb9,_0x3f3d99){_0x295bb9=_0x295bb9-0x0;var _0x2647a0=_0xe782[_0x295bb9];return _0x2647a0;};'use strict';var multer=require('multer');var util=require(_0x2e78('0x0'));var path=require(_0x2e78('0x1'));var timeout=require(_0x2e78('0x2'));var express=require('express');var router=express[_0x2e78('0x3')]();var fs_extra=require(_0x2e78('0x4'));var auth=require(_0x2e78('0x5'));var interaction=require(_0x2e78('0x6'));var config=require(_0x2e78('0x7'));var controller=require(_0x2e78('0x8'));router['get']('/',auth[_0x2e78('0x9')](),controller[_0x2e78('0xa')]);router[_0x2e78('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x2e78('0xb')](_0x2e78('0xc'),auth['isAuthenticated'](),controller[_0x2e78('0xd')]);router[_0x2e78('0xb')]('/:id',auth[_0x2e78('0x9')](),controller[_0x2e78('0xe')]);router[_0x2e78('0xb')](_0x2e78('0xf'),auth['isAuthenticated'](),controller[_0x2e78('0x10')]);router['get'](_0x2e78('0x11'),auth[_0x2e78('0x9')](),controller['getContacts']);router['get'](_0x2e78('0x12'),auth[_0x2e78('0x9')](),controller[_0x2e78('0x13')]);router['get'](_0x2e78('0x14'),auth[_0x2e78('0x9')](),controller[_0x2e78('0x15')]);router[_0x2e78('0xb')](_0x2e78('0x16'),auth[_0x2e78('0x9')](),controller[_0x2e78('0x17')]);router['post']('/',auth[_0x2e78('0x9')](),controller[_0x2e78('0x18')]);router[_0x2e78('0x19')](_0x2e78('0xf'),auth[_0x2e78('0x9')](),controller[_0x2e78('0x1a')]);router[_0x2e78('0x19')](_0x2e78('0x11'),auth['isAuthenticated'](),controller[_0x2e78('0x1b')]);router['post'](_0x2e78('0x14'),auth[_0x2e78('0x9')](),controller[_0x2e78('0x1c')]);router[_0x2e78('0x19')]('/:id/users',auth[_0x2e78('0x9')](),controller[_0x2e78('0x1d')]);router[_0x2e78('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x2e78('0x1f')]);router['delete'](_0x2e78('0x20'),auth['isAuthenticated'](),controller['destroy']);router[_0x2e78('0x21')](_0x2e78('0xf'),auth[_0x2e78('0x9')](),controller[_0x2e78('0x22')]);router[_0x2e78('0x21')]('/:id/users',auth[_0x2e78('0x9')](),controller[_0x2e78('0x23')]);module[_0x2e78('0x24')]=router; \ No newline at end of file +var _0xa4f9=['describe','/global_fields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','/:id/users','getAgents','create','post','addDisposition','addCustomField','put','update','delete','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','/describe'];(function(_0x3517f1,_0x41b82b){var _0x1a1f8d=function(_0x2612bc){while(--_0x2612bc){_0x3517f1['push'](_0x3517f1['shift']());}};_0x1a1f8d(++_0x41b82b);}(_0xa4f9,0x1cf));var _0x9a4f=function(_0x451a8a,_0x12aad6){_0x451a8a=_0x451a8a-0x0;var _0x588b6c=_0xa4f9[_0x451a8a];return _0x588b6c;};'use strict';var multer=require(_0x9a4f('0x0'));var util=require(_0x9a4f('0x1'));var path=require('path');var timeout=require(_0x9a4f('0x2'));var express=require(_0x9a4f('0x3'));var router=express[_0x9a4f('0x4')]();var fs_extra=require(_0x9a4f('0x5'));var auth=require(_0x9a4f('0x6'));var interaction=require(_0x9a4f('0x7'));var config=require(_0x9a4f('0x8'));var controller=require(_0x9a4f('0x9'));router[_0x9a4f('0xa')]('/',auth[_0x9a4f('0xb')](),controller['index']);router[_0x9a4f('0xa')](_0x9a4f('0xc'),auth[_0x9a4f('0xb')](),controller[_0x9a4f('0xd')]);router['get'](_0x9a4f('0xe'),auth[_0x9a4f('0xb')](),controller['getGlobalCustomFields']);router[_0x9a4f('0xa')](_0x9a4f('0xf'),auth['isAuthenticated'](),controller[_0x9a4f('0x10')]);router['get'](_0x9a4f('0x11'),auth[_0x9a4f('0xb')](),controller[_0x9a4f('0x12')]);router[_0x9a4f('0xa')](_0x9a4f('0x13'),auth[_0x9a4f('0xb')](),controller[_0x9a4f('0x14')]);router[_0x9a4f('0xa')](_0x9a4f('0x15'),auth[_0x9a4f('0xb')](),controller['getContactsCsv']);router[_0x9a4f('0xa')](_0x9a4f('0x16'),auth[_0x9a4f('0xb')](),controller['getCustomFields']);router['get'](_0x9a4f('0x17'),auth[_0x9a4f('0xb')](),controller[_0x9a4f('0x18')]);router['post']('/',auth[_0x9a4f('0xb')](),controller[_0x9a4f('0x19')]);router[_0x9a4f('0x1a')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9a4f('0x1b')]);router['post'](_0x9a4f('0x13'),auth[_0x9a4f('0xb')](),controller['addContacts']);router[_0x9a4f('0x1a')](_0x9a4f('0x16'),auth[_0x9a4f('0xb')](),controller[_0x9a4f('0x1c')]);router[_0x9a4f('0x1a')](_0x9a4f('0x17'),auth[_0x9a4f('0xb')](),controller['addAgents']);router[_0x9a4f('0x1d')](_0x9a4f('0xf'),auth[_0x9a4f('0xb')](),controller[_0x9a4f('0x1e')]);router[_0x9a4f('0x1f')]('/:id',auth[_0x9a4f('0xb')](),controller['destroy']);router[_0x9a4f('0x1f')](_0x9a4f('0x11'),auth[_0x9a4f('0xb')](),controller['removeDispositions']);router[_0x9a4f('0x1f')](_0x9a4f('0x17'),auth[_0x9a4f('0xb')](),controller[_0x9a4f('0x20')]);module[_0x9a4f('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 6bfb03b..0d66294 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 _0x7ddf=['VIRTUAL','getDataValue','STRING','sequelize'];(function(_0x587fd9,_0x198ced){var _0xb044cd=function(_0x15b6ac){while(--_0x15b6ac){_0x587fd9['push'](_0x587fd9['shift']());}};_0xb044cd(++_0x198ced);}(_0x7ddf,0x11b));var _0xf7dd=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x7ddf[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0xf7dd('0x0'));module['exports']={'name':{'type':Sequelize[_0xf7dd('0x1')],'get':function(_0xea197f){return this[_0xf7dd('0x2')]('field');}},'field':{'type':Sequelize[_0xf7dd('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xf7dd('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0xf7dd('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0xfedc=['field','STRING','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0xfedc,0x146));var _0xcfed=function(_0x3b76f7,_0x566c53){_0x3b76f7=_0x3b76f7-0x0;var _0x43984e=_0xfedc[_0x3b76f7];return _0x43984e;};'use strict';var Sequelize=require(_0xcfed('0x0'));module[_0xcfed('0x1')]={'name':{'type':Sequelize[_0xcfed('0x2')],'get':function(_0x11fbd7){return this[_0xcfed('0x3')](_0xcfed('0x4'));}},'field':{'type':Sequelize[_0xcfed('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0xcfed('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0xcfed('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 98e5435..bbda221 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x1b2e83,_0x1dfdc2){var _0x100acf=function(_0x52ece6){while(--_0x52ece6){_0x1b2e83['push'](_0x1b2e83['shift']());}};_0x100acf(++_0x1dfdc2);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x1ef8e8,_0x430fea){var _0x4b47ea=function(_0x4f1592){while(--_0x4f1592){_0x1ef8e8['push'](_0x1ef8e8['shift']());}};_0x4b47ea(++_0x430fea);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index aceddee..bfcd53c 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 _0x2ed2=['bluebird','request-promise','rimraf','./condition.attributes','exports','Condition','tools_conditions','lodash','util','../../config/logger','api'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x2ed2,0x1eb));var _0x22ed=function(_0x4421a0,_0x1525bc){_0x4421a0=_0x4421a0-0x0;var _0x5626d0=_0x2ed2[_0x4421a0];return _0x5626d0;};'use strict';var _=require(_0x22ed('0x0'));var util=require(_0x22ed('0x1'));var logger=require(_0x22ed('0x2'))(_0x22ed('0x3'));var moment=require('moment');var BPromise=require(_0x22ed('0x4'));var rp=require(_0x22ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22ed('0x6'));var config=require('../../config/environment');var attributes=require(_0x22ed('0x7'));module[_0x22ed('0x8')]=function(_0x2ab9d3,_0x52662d){return _0x2ab9d3['define'](_0x22ed('0x9'),attributes,{'tableName':_0x22ed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40e5=['api','moment','bluebird','path','../../config/environment','exports','Condition','tools_conditions','lodash'];(function(_0x12b683,_0x124186){var _0xfb150b=function(_0x565ce7){while(--_0x565ce7){_0x12b683['push'](_0x12b683['shift']());}};_0xfb150b(++_0x124186);}(_0x40e5,0x143));var _0x540e=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x40e5[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x540e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x540e('0x1'));var moment=require(_0x540e('0x2'));var BPromise=require(_0x540e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x540e('0x4'));var rimraf=require('rimraf');var config=require(_0x540e('0x5'));var attributes=require('./condition.attributes');module[_0x540e('0x6')]=function(_0x434c48,_0x580a6f){return _0x434c48['define'](_0x540e('0x7'),attributes,{'tableName':_0x540e('0x8'),'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 ede024d..3c9a001 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 _0x7332=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x413a68,_0x1ada70){var _0x30ed03=function(_0x752154){while(--_0x752154){_0x413a68['push'](_0x413a68['shift']());}};_0x30ed03(++_0x1ada70);}(_0x7332,0x100));var _0x2733=function(_0x481f84,_0x8954b0){_0x481f84=_0x481f84-0x0;var _0x1ede8d=_0x7332[_0x481f84];return _0x1ede8d;};'use strict';var _=require(_0x2733('0x0'));var util=require(_0x2733('0x1'));var moment=require('moment');var BPromise=require(_0x2733('0x2'));var rs=require(_0x2733('0x3'));var fs=require('fs');var Redis=require(_0x2733('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2733('0x5'));var logger=require(_0x2733('0x6'))(_0x2733('0x7'));var config=require(_0x2733('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2733('0x9')][_0x2733('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf22e28,_0x47c0f6,_0x56854a){return new BPromise(function(_0x40bcc1,_0x13cea9){return client['request'](_0xf22e28,_0x56854a)[_0x2733('0xb')](function(_0x30eaed){logger[_0x2733('0xc')](_0x2733('0xd'),_0x47c0f6,_0x2733('0xe'));logger[_0x2733('0xf')](_0x2733('0x10'),_0x47c0f6,'request\x20sent',JSON[_0x2733('0x11')](_0x30eaed));if(_0x30eaed[_0x2733('0x12')]){if(_0x30eaed['error'][_0x2733('0x13')]===0x1f4){logger[_0x2733('0x12')](_0x2733('0xd'),_0x47c0f6,_0x30eaed[_0x2733('0x12')][_0x2733('0x14')]);return _0x13cea9(_0x30eaed[_0x2733('0x12')]['message']);}logger[_0x2733('0x12')](_0x2733('0xd'),_0x47c0f6,_0x30eaed[_0x2733('0x12')][_0x2733('0x14')]);return _0x40bcc1(_0x30eaed[_0x2733('0x12')][_0x2733('0x14')]);}else{logger[_0x2733('0xc')](_0x2733('0xd'),_0x47c0f6,_0x2733('0xe'));_0x40bcc1(_0x30eaed[_0x2733('0x15')]['message']);}})[_0x2733('0x16')](function(_0x171731){logger[_0x2733('0x12')](_0x2733('0xd'),_0x47c0f6,_0x171731);_0x13cea9(_0x171731);});});} \ No newline at end of file +var _0xefad=['Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x31fecb,_0x5cd94c){var _0x5904d7=function(_0x4bb362){while(--_0x4bb362){_0x31fecb['push'](_0x31fecb['shift']());}};_0x5904d7(++_0x5cd94c);}(_0xefad,0x199));var _0xdefa=function(_0x16c4d0,_0x5cb02b){_0x16c4d0=_0x16c4d0-0x0;var _0x360bdd=_0xefad[_0x16c4d0];return _0x360bdd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdefa('0x0'));var BPromise=require(_0xdefa('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdefa('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xdefa('0x3'))(_0xdefa('0x4'));var config=require(_0xdefa('0x5'));var jayson=require(_0xdefa('0x6'));var client=jayson[_0xdefa('0x7')][_0xdefa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a88f4,_0x14f536,_0x34f324){return new BPromise(function(_0x5b1a3a,_0x71f4e0){return client[_0xdefa('0x9')](_0x4a88f4,_0x34f324)[_0xdefa('0xa')](function(_0x7606fa){logger['info'](_0xdefa('0xb'),_0x14f536,_0xdefa('0xc'));logger[_0xdefa('0xd')](_0xdefa('0xe'),_0x14f536,_0xdefa('0xc'),JSON[_0xdefa('0xf')](_0x7606fa));if(_0x7606fa[_0xdefa('0x10')]){if(_0x7606fa[_0xdefa('0x10')][_0xdefa('0x11')]===0x1f4){logger[_0xdefa('0x10')](_0xdefa('0xb'),_0x14f536,_0x7606fa[_0xdefa('0x10')]['message']);return _0x71f4e0(_0x7606fa[_0xdefa('0x10')]['message']);}logger['error'](_0xdefa('0xb'),_0x14f536,_0x7606fa['error'][_0xdefa('0x12')]);return _0x5b1a3a(_0x7606fa[_0xdefa('0x10')]['message']);}else{logger['info'](_0xdefa('0xb'),_0x14f536,_0xdefa('0xc'));_0x5b1a3a(_0x7606fa['result'][_0xdefa('0x12')]);}})[_0xdefa('0x13')](function(_0x16e9bb){logger[_0xdefa('0x10')](_0xdefa('0xb'),_0x14f536,_0x16e9bb);_0x71f4e0(_0x16e9bb);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 2a9339a..fcb52fe 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 _0x12d8=['../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','delete','isAuthenticated','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x12d8,0x81));var _0x812d=function(_0x4e15c2,_0x1a3704){_0x4e15c2=_0x4e15c2-0x0;var _0x6211d5=_0x12d8[_0x4e15c2];return _0x6211d5;};'use strict';var multer=require(_0x812d('0x0'));var util=require(_0x812d('0x1'));var path=require('path');var timeout=require(_0x812d('0x2'));var express=require(_0x812d('0x3'));var router=express[_0x812d('0x4')]();var fs_extra=require(_0x812d('0x5'));var auth=require(_0x812d('0x6'));var interaction=require(_0x812d('0x7'));var config=require(_0x812d('0x8'));var controller=require(_0x812d('0x9'));router[_0x812d('0xa')](_0x812d('0xb'),auth['isAuthenticated'](),controller[_0x812d('0xc')]);router[_0x812d('0xd')](_0x812d('0xb'),auth[_0x812d('0xe')](),controller[_0x812d('0xf')]);module[_0x812d('0x10')]=router; \ No newline at end of file +var _0xe2ff=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','update','delete','/:id','isAuthenticated','destroy','exports','multer','path','connect-timeout','express'];(function(_0xa5e918,_0x17a59f){var _0x30c0d9=function(_0x4cbaaf){while(--_0x4cbaaf){_0xa5e918['push'](_0xa5e918['shift']());}};_0x30c0d9(++_0x17a59f);}(_0xe2ff,0x9c));var _0xfe2f=function(_0x136fef,_0x2f9910){_0x136fef=_0x136fef-0x0;var _0x460b73=_0xe2ff[_0x136fef];return _0x460b73;};'use strict';var multer=require(_0xfe2f('0x0'));var util=require('util');var path=require(_0xfe2f('0x1'));var timeout=require(_0xfe2f('0x2'));var express=require(_0xfe2f('0x3'));var router=express[_0xfe2f('0x4')]();var fs_extra=require(_0xfe2f('0x5'));var auth=require(_0xfe2f('0x6'));var interaction=require(_0xfe2f('0x7'));var config=require(_0xfe2f('0x8'));var controller=require('./condition.controller');router[_0xfe2f('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xfe2f('0xa')]);router[_0xfe2f('0xb')](_0xfe2f('0xc'),auth[_0xfe2f('0xd')](),controller[_0xfe2f('0xe')]);module[_0xfe2f('0xf')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 5d64998..b15c8a6 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 _0x1e1a=['STRING','name','sequelize','exports'];(function(_0x4f0a33,_0x3a64a3){var _0x5e94b2=function(_0x5c8cf2){while(--_0x5c8cf2){_0x4f0a33['push'](_0x4f0a33['shift']());}};_0x5e94b2(++_0x3a64a3);}(_0x1e1a,0x86));var _0xa1e1=function(_0x3ac173,_0x208130){_0x3ac173=_0x3ac173-0x0;var _0x30e23a=_0x1e1a[_0x3ac173];return _0x30e23a;};'use strict';var Sequelize=require(_0xa1e1('0x0'));module[_0xa1e1('0x1')]={'name':{'type':Sequelize[_0xa1e1('0x2')],'allowNull':![],'unique':_0xa1e1('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xa1e1('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x4a5b=['exports','STRING','name','INTEGER'];(function(_0x11cbef,_0x2ab1a8){var _0x42b02f=function(_0x2e9c17){while(--_0x2e9c17){_0x11cbef['push'](_0x11cbef['shift']());}};_0x42b02f(++_0x2ab1a8);}(_0x4a5b,0xe8));var _0xb4a5=function(_0x4d29b2,_0x2683df){_0x4d29b2=_0x4d29b2-0x0;var _0x39ed1a=_0x4a5b[_0x4d29b2];return _0x39ed1a;};'use strict';var Sequelize=require('sequelize');module[_0xb4a5('0x0')]={'name':{'type':Sequelize[_0xb4a5('0x1')],'allowNull':![],'unique':_0xb4a5('0x2')},'OrderBy':{'type':Sequelize[_0xb4a5('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 0bb0fef..89ea597 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 _0xea28=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','get','ContactItemTypes','sendStatus','stack','name','send','index','map','ContactItemType','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','intersection','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','UserProfileResource','body','params','destroy','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0x13f7b5,_0x38fe7b){var _0x5a99d5=function(_0x22414d){while(--_0x22414d){_0x13f7b5['push'](_0x13f7b5['shift']());}};_0x5a99d5(++_0x38fe7b);}(_0xea28,0x13a));var _0x8ea2=function(_0x19d872,_0x3c2116){_0x19d872=_0x19d872-0x0;var _0x57a144=_0xea28[_0x19d872];return _0x57a144;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require(_0x8ea2('0x1'));var zipdir=require(_0x8ea2('0x2'));var jsonpatch=require(_0x8ea2('0x3'));var rp=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var BPromise=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var util=require('util');var path=require(_0x8ea2('0x8'));var sox=require(_0x8ea2('0x9'));var csv=require(_0x8ea2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea2('0xb'));var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0xa'));var querystring=require(_0x8ea2('0x11'));var Papa=require(_0x8ea2('0x12'));var Redis=require(_0x8ea2('0x13'));var authService=require(_0x8ea2('0x14'));var qs=require(_0x8ea2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ea2('0x16'))(_0x8ea2('0x17'));var utils=require(_0x8ea2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8ea2('0x19'));var db=require(_0x8ea2('0x1a'))['db'];function respondWithStatusCode(_0x1dfb6e,_0x10aead){_0x10aead=_0x10aead||0xcc;return function(_0xe47c0e){if(_0xe47c0e){return _0x1dfb6e['sendStatus'](_0x10aead);}return _0x1dfb6e[_0x8ea2('0x1b')](_0x10aead)['end']();};}function respondWithResult(_0x4b2192,_0x772bad){_0x772bad=_0x772bad||0xc8;return function(_0x4726a7){if(_0x4726a7){return _0x4b2192[_0x8ea2('0x1b')](_0x772bad)[_0x8ea2('0x1c')](_0x4726a7);}};}function respondWithFilteredResult(_0x393faf,_0xbb9bd1){return function(_0x3cff96){if(_0x3cff96){var _0x11f5e8=typeof _0xbb9bd1[_0x8ea2('0x1d')]===_0x8ea2('0x1e')&&typeof _0xbb9bd1[_0x8ea2('0x1f')]===_0x8ea2('0x1e');var _0x3bc774=_0x3cff96[_0x8ea2('0x20')];var _0x1b64cf=_0x11f5e8?0x0:_0xbb9bd1[_0x8ea2('0x1d')];var _0x467045=_0x11f5e8?_0x3cff96[_0x8ea2('0x20')]:_0xbb9bd1[_0x8ea2('0x1d')]+_0xbb9bd1[_0x8ea2('0x1f')];var _0x134cbe;if(_0x467045>=_0x3bc774){_0x467045=_0x3bc774;_0x134cbe=0xc8;}else{_0x134cbe=0xce;}_0x393faf[_0x8ea2('0x1b')](_0x134cbe);return _0x393faf['set']('Content-Range',_0x1b64cf+'-'+_0x467045+'/'+_0x3bc774)[_0x8ea2('0x1c')](_0x3cff96);}return null;};}function patchUpdates(_0x248c18){return function(_0x29151a){try{jsonpatch['apply'](_0x29151a,_0x248c18,!![]);}catch(_0x46f4fe){return BPromise[_0x8ea2('0x21')](_0x46f4fe);}return _0x29151a['save']();};}function saveUpdates(_0x3d593b,_0x283f00){return function(_0x37229a){if(_0x37229a){return _0x37229a[_0x8ea2('0x22')](_0x3d593b)[_0x8ea2('0x23')](function(_0xe5c943){return _0xe5c943;});}return null;};}function removeEntity(_0x199417,_0x1e4cc9){return function(_0x18ec34){if(_0x18ec34){return _0x18ec34['destroy']()[_0x8ea2('0x23')](function(){var _0x4f48bd=_0x18ec34[_0x8ea2('0x24')]({'plain':!![]});var _0x42bec8=_0x8ea2('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x42bec8,'resourceId':_0x4f48bd['id']}})[_0x8ea2('0x23')](function(){return _0x18ec34;});})['then'](function(){_0x199417[_0x8ea2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3be291,_0x12fa37){return function(_0x21c526){if(!_0x21c526){_0x3be291[_0x8ea2('0x26')](0x194);}return _0x21c526;};}function handleError(_0x4e1b90,_0x5ce1d4){_0x5ce1d4=_0x5ce1d4||0x1f4;return function(_0xacaa6c){logger['error'](_0xacaa6c[_0x8ea2('0x27')]);if(_0xacaa6c[_0x8ea2('0x28')]){delete _0xacaa6c[_0x8ea2('0x28')];}_0x4e1b90[_0x8ea2('0x1b')](_0x5ce1d4)[_0x8ea2('0x29')](_0xacaa6c);};}exports[_0x8ea2('0x2a')]=function(_0x32e225,_0x316707){var _0x19e868={},_0x9c5fac={},_0x56d914={'count':0x0,'rows':[]};var _0x5b7ff9=_[_0x8ea2('0x2b')](db[_0x8ea2('0x2c')]['rawAttributes'],function(_0x4a110f){return{'name':_0x4a110f[_0x8ea2('0x2d')],'type':_0x4a110f['type'][_0x8ea2('0x2e')]};});_0x9c5fac[_0x8ea2('0x2f')]=_['map'](_0x5b7ff9,_0x8ea2('0x28'));_0x9c5fac[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x32e225['query']);_0x9c5fac['filters']=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],_0x9c5fac[_0x8ea2('0x30')]);_0x19e868[_0x8ea2('0x32')]=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],qs[_0x8ea2('0x33')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x19e868[_0x8ea2('0x32')]=_0x19e868[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x19e868[_0x8ea2('0x32')]:_0x9c5fac['model'];if(!_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x35')](_0x8ea2('0x36'))){_0x19e868[_0x8ea2('0x1f')]=qs['limit'](_0x32e225[_0x8ea2('0x30')]['limit']);_0x19e868[_0x8ea2('0x1d')]=qs[_0x8ea2('0x1d')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x1d')]);}_0x19e868['order']=qs[_0x8ea2('0x37')](_0x32e225['query']['sort']);_0x19e868[_0x8ea2('0x38')]=qs['filters'](_[_0x8ea2('0x39')](_0x32e225[_0x8ea2('0x30')],_0x9c5fac[_0x8ea2('0x3a')]),_0x5b7ff9);if(_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x3b')]){_0x19e868['where']=_[_0x8ea2('0x3c')](_0x19e868['where'],{'$or':_[_0x8ea2('0x2b')](_0x5b7ff9,function(_0x282f00){if(_0x282f00[_0x8ea2('0x3d')]!==_0x8ea2('0x3e')){var _0x4f9a8c={};_0x4f9a8c[_0x282f00[_0x8ea2('0x28')]]={'$like':'%'+_0x32e225['query'][_0x8ea2('0x3b')]+'%'};return _0x4f9a8c;}})});}_0x19e868=_['merge']({},_0x19e868,_0x32e225[_0x8ea2('0x3f')]);var _0x450e8f={'where':_0x19e868[_0x8ea2('0x38')]};return db[_0x8ea2('0x2c')][_0x8ea2('0x20')](_0x450e8f)[_0x8ea2('0x23')](function(_0x2f4fa8){_0x56d914['count']=_0x2f4fa8;if(_0x32e225['query'][_0x8ea2('0x40')]){_0x19e868['include']=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x19e868);})[_0x8ea2('0x23')](function(_0x5d9ba0){_0x56d914[_0x8ea2('0x41')]=_0x5d9ba0;return _0x56d914;})[_0x8ea2('0x23')](respondWithFilteredResult(_0x316707,_0x19e868))[_0x8ea2('0x42')](handleError(_0x316707,null));};exports[_0x8ea2('0x43')]=function(_0x989d9b,_0x8f700f){var _0x3b2219={'raw':!![],'where':{'id':_0x989d9b['params']['id']}},_0x348b17={};_0x348b17[_0x8ea2('0x2f')]=_[_0x8ea2('0x31')](db[_0x8ea2('0x2c')]['rawAttributes']);_0x348b17[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x989d9b[_0x8ea2('0x30')]);_0x348b17[_0x8ea2('0x3a')]=_[_0x8ea2('0x44')](_0x348b17['model'],_0x348b17[_0x8ea2('0x30')]);_0x3b2219[_0x8ea2('0x32')]=_[_0x8ea2('0x44')](_0x348b17['model'],qs[_0x8ea2('0x33')](_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x3b2219[_0x8ea2('0x32')]=_0x3b2219[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x3b2219[_0x8ea2('0x32')]:_0x348b17[_0x8ea2('0x2f')];if(_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x40')]){_0x3b2219[_0x8ea2('0x45')]=[{'all':!![]}];}_0x3b2219=_[_0x8ea2('0x3c')]({},_0x3b2219,_0x989d9b[_0x8ea2('0x3f')]);return db[_0x8ea2('0x2c')]['find'](_0x3b2219)[_0x8ea2('0x23')](handleEntityNotFound(_0x8f700f,null))[_0x8ea2('0x23')](respondWithResult(_0x8f700f,null))[_0x8ea2('0x42')](handleError(_0x8f700f,null));};exports[_0x8ea2('0x46')]=function(_0x182a46,_0x1daa25){return db[_0x8ea2('0x2c')][_0x8ea2('0x46')](_0x182a46['body'],{})[_0x8ea2('0x23')](function(_0x37a1cf){var _0x24dddb=_0x182a46['user']['get']({'plain':!![]});if(!_0x24dddb)throw new Error(_0x8ea2('0x47'));if(_0x24dddb[_0x8ea2('0x48')]===_0x8ea2('0x49')){var _0x5e5c37=_0x37a1cf[_0x8ea2('0x24')]({'plain':!![]});var _0x315b5d=_0x8ea2('0x25');return db[_0x8ea2('0x4a')][_0x8ea2('0x4b')]({'where':{'name':_0x315b5d,'userProfileId':_0x24dddb['userProfileId']},'raw':!![]})['then'](function(_0x24a22a){if(_0x24a22a&&_0x24a22a[_0x8ea2('0x4c')]===0x0){return db[_0x8ea2('0x4d')]['create']({'name':_0x5e5c37[_0x8ea2('0x28')],'resourceId':_0x5e5c37['id'],'type':_0x24a22a[_0x8ea2('0x28')],'sectionId':_0x24a22a['id']},{})[_0x8ea2('0x23')](function(){return _0x37a1cf;});}else{return _0x37a1cf;}})['catch'](function(_0x5c6524){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c6524);throw _0x5c6524;});}return _0x37a1cf;})['then'](respondWithResult(_0x1daa25,0xc9))[_0x8ea2('0x42')](handleError(_0x1daa25,null));};exports[_0x8ea2('0x22')]=function(_0x5f56f8,_0x49cf11){if(_0x5f56f8[_0x8ea2('0x4e')]['id']){delete _0x5f56f8[_0x8ea2('0x4e')]['id'];}return db[_0x8ea2('0x2c')]['find']({'where':{'id':_0x5f56f8[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x49cf11,null))['then'](saveUpdates(_0x5f56f8[_0x8ea2('0x4e')],null))[_0x8ea2('0x23')](respondWithResult(_0x49cf11,null))[_0x8ea2('0x42')](handleError(_0x49cf11,null));};exports[_0x8ea2('0x50')]=function(_0x4728b4,_0x58674d){return db['ContactItemType']['find']({'where':{'id':_0x4728b4[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x58674d,null))[_0x8ea2('0x23')](db[_0x8ea2('0x51')][_0x8ea2('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4728b4[_0x8ea2('0x4f')]['id']}}))[_0x8ea2('0x23')](removeEntity(_0x58674d,null))['catch'](handleError(_0x58674d,null));}; \ No newline at end of file +var _0xc2c7=['../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x132d9e,_0x1475d7){var _0x4337a4=function(_0x33cf87){while(--_0x33cf87){_0x132d9e['push'](_0x132d9e['shift']());}};_0x4337a4(++_0x1475d7);}(_0xc2c7,0x134));var _0x7c2c=function(_0x56f0a2,_0x549769){_0x56f0a2=_0x56f0a2-0x0;var _0x4977bf=_0xc2c7[_0x56f0a2];return _0x4977bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c2c('0x0'));var zipdir=require(_0x7c2c('0x1'));var jsonpatch=require(_0x7c2c('0x2'));var rp=require(_0x7c2c('0x3'));var moment=require(_0x7c2c('0x4'));var BPromise=require(_0x7c2c('0x5'));var Mustache=require(_0x7c2c('0x6'));var util=require(_0x7c2c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7c2c('0x8'));var ejs=require(_0x7c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x8'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];function respondWithStatusCode(_0xae8441,_0x45847d){_0x45847d=_0x45847d||0xcc;return function(_0x68398a){if(_0x68398a){return _0xae8441[_0x7c2c('0x19')](_0x45847d);}return _0xae8441[_0x7c2c('0x1a')](_0x45847d)[_0x7c2c('0x1b')]();};}function respondWithResult(_0x4c4aaf,_0x5b5729){_0x5b5729=_0x5b5729||0xc8;return function(_0x102778){if(_0x102778){return _0x4c4aaf[_0x7c2c('0x1a')](_0x5b5729)[_0x7c2c('0x1c')](_0x102778);}};}function respondWithFilteredResult(_0x5ae94f,_0x11424c){return function(_0x206ecd){if(_0x206ecd){var _0x5e55e0=typeof _0x11424c[_0x7c2c('0x1d')]==='undefined'&&typeof _0x11424c[_0x7c2c('0x1e')]==='undefined';var _0x342ea2=_0x206ecd[_0x7c2c('0x1f')];var _0x14453f=_0x5e55e0?0x0:_0x11424c[_0x7c2c('0x1d')];var _0x17df4a=_0x5e55e0?_0x206ecd[_0x7c2c('0x1f')]:_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')];var _0x2d356e;if(_0x17df4a>=_0x342ea2){_0x17df4a=_0x342ea2;_0x2d356e=0xc8;}else{_0x2d356e=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x2d356e);return _0x5ae94f[_0x7c2c('0x20')](_0x7c2c('0x21'),_0x14453f+'-'+_0x17df4a+'/'+_0x342ea2)['json'](_0x206ecd);}return null;};}function patchUpdates(_0x1c5491){return function(_0x4adb62){try{jsonpatch['apply'](_0x4adb62,_0x1c5491,!![]);}catch(_0x15ae33){return BPromise[_0x7c2c('0x22')](_0x15ae33);}return _0x4adb62[_0x7c2c('0x23')]();};}function saveUpdates(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x24')](_0x38ae30)['then'](function(_0x10c356){return _0x10c356;});}return null;};}function removeEntity(_0x4dedd8,_0x302c93){return function(_0x57f510){if(_0x57f510){return _0x57f510[_0x7c2c('0x25')]()[_0x7c2c('0x26')](function(){var _0x3126d=_0x57f510['get']({'plain':!![]});var _0x4d6ec7=_0x7c2c('0x27');return db[_0x7c2c('0x28')][_0x7c2c('0x25')]({'where':{'type':_0x4d6ec7,'resourceId':_0x3126d['id']}})[_0x7c2c('0x26')](function(){return _0x57f510;});})[_0x7c2c('0x26')](function(){_0x4dedd8[_0x7c2c('0x1a')](0xcc)[_0x7c2c('0x1b')]();});}};}function handleEntityNotFound(_0x4b1dd0,_0x358c67){return function(_0xf39941){if(!_0xf39941){_0x4b1dd0[_0x7c2c('0x19')](0x194);}return _0xf39941;};}function handleError(_0x22d03f,_0x145788){_0x145788=_0x145788||0x1f4;return function(_0x1f8846){logger[_0x7c2c('0x29')](_0x1f8846[_0x7c2c('0x2a')]);if(_0x1f8846[_0x7c2c('0x2b')]){delete _0x1f8846['name'];}_0x22d03f[_0x7c2c('0x1a')](_0x145788)[_0x7c2c('0x2c')](_0x1f8846);};}exports[_0x7c2c('0x2d')]=function(_0x720667,_0x53ad23){var _0xcb98ba={},_0x30dd1c={},_0x4192c8={'count':0x0,'rows':[]};var _0x1ef88b=_[_0x7c2c('0x2e')](db[_0x7c2c('0x2f')][_0x7c2c('0x30')],function(_0x57af44){return{'name':_0x57af44[_0x7c2c('0x31')],'type':_0x57af44[_0x7c2c('0x32')][_0x7c2c('0x33')]};});_0x30dd1c[_0x7c2c('0x34')]=_[_0x7c2c('0x2e')](_0x1ef88b,'name');_0x30dd1c['query']=_[_0x7c2c('0x35')](_0x720667['query']);_0x30dd1c['filters']=_[_0x7c2c('0x36')](_0x30dd1c[_0x7c2c('0x34')],_0x30dd1c[_0x7c2c('0x37')]);_0xcb98ba[_0x7c2c('0x38')]=_['intersection'](_0x30dd1c[_0x7c2c('0x34')],qs[_0x7c2c('0x39')](_0x720667[_0x7c2c('0x37')][_0x7c2c('0x39')]));_0xcb98ba[_0x7c2c('0x38')]=_0xcb98ba[_0x7c2c('0x38')][_0x7c2c('0x3a')]?_0xcb98ba[_0x7c2c('0x38')]:_0x30dd1c[_0x7c2c('0x34')];if(!_0x720667[_0x7c2c('0x37')][_0x7c2c('0x3b')](_0x7c2c('0x3c'))){_0xcb98ba[_0x7c2c('0x1e')]=qs['limit'](_0x720667['query'][_0x7c2c('0x1e')]);_0xcb98ba['offset']=qs['offset'](_0x720667['query'][_0x7c2c('0x1d')]);}_0xcb98ba[_0x7c2c('0x3d')]=qs[_0x7c2c('0x3e')](_0x720667[_0x7c2c('0x37')][_0x7c2c('0x3e')]);_0xcb98ba[_0x7c2c('0x3f')]=qs[_0x7c2c('0x40')](_[_0x7c2c('0x41')](_0x720667[_0x7c2c('0x37')],_0x30dd1c[_0x7c2c('0x40')]),_0x1ef88b);if(_0x720667[_0x7c2c('0x37')]['filter']){_0xcb98ba['where']=_[_0x7c2c('0x42')](_0xcb98ba[_0x7c2c('0x3f')],{'$or':_[_0x7c2c('0x2e')](_0x1ef88b,function(_0x57bead){if(_0x57bead['type']!==_0x7c2c('0x43')){var _0x19c3fb={};_0x19c3fb[_0x57bead[_0x7c2c('0x2b')]]={'$like':'%'+_0x720667[_0x7c2c('0x37')][_0x7c2c('0x44')]+'%'};return _0x19c3fb;}})});}_0xcb98ba=_[_0x7c2c('0x42')]({},_0xcb98ba,_0x720667[_0x7c2c('0x45')]);var _0x2e4093={'where':_0xcb98ba[_0x7c2c('0x3f')]};return db['ContactItemType'][_0x7c2c('0x1f')](_0x2e4093)['then'](function(_0x2c3f40){_0x4192c8[_0x7c2c('0x1f')]=_0x2c3f40;if(_0x720667['query'][_0x7c2c('0x46')]){_0xcb98ba['include']=[{'all':!![]}];}return db[_0x7c2c('0x2f')][_0x7c2c('0x47')](_0xcb98ba);})[_0x7c2c('0x26')](function(_0x26351e){_0x4192c8['rows']=_0x26351e;return _0x4192c8;})[_0x7c2c('0x26')](respondWithFilteredResult(_0x53ad23,_0xcb98ba))['catch'](handleError(_0x53ad23,null));};exports['show']=function(_0x8f2cfe,_0xd0a1d3){var _0x106a13={'raw':!![],'where':{'id':_0x8f2cfe[_0x7c2c('0x48')]['id']}},_0x4c239b={};_0x4c239b[_0x7c2c('0x34')]=_['keys'](db[_0x7c2c('0x2f')]['rawAttributes']);_0x4c239b[_0x7c2c('0x37')]=_[_0x7c2c('0x35')](_0x8f2cfe['query']);_0x4c239b['filters']=_[_0x7c2c('0x36')](_0x4c239b[_0x7c2c('0x34')],_0x4c239b['query']);_0x106a13[_0x7c2c('0x38')]=_['intersection'](_0x4c239b['model'],qs[_0x7c2c('0x39')](_0x8f2cfe[_0x7c2c('0x37')][_0x7c2c('0x39')]));_0x106a13[_0x7c2c('0x38')]=_0x106a13[_0x7c2c('0x38')][_0x7c2c('0x3a')]?_0x106a13[_0x7c2c('0x38')]:_0x4c239b[_0x7c2c('0x34')];if(_0x8f2cfe[_0x7c2c('0x37')]['includeAll']){_0x106a13['include']=[{'all':!![]}];}_0x106a13=_[_0x7c2c('0x42')]({},_0x106a13,_0x8f2cfe[_0x7c2c('0x45')]);return db[_0x7c2c('0x2f')]['find'](_0x106a13)['then'](handleEntityNotFound(_0xd0a1d3,null))[_0x7c2c('0x26')](respondWithResult(_0xd0a1d3,null))[_0x7c2c('0x49')](handleError(_0xd0a1d3,null));};exports[_0x7c2c('0x4a')]=function(_0x2b79d5,_0x5f3de8){return db['ContactItemType']['create'](_0x2b79d5[_0x7c2c('0x4b')],{})[_0x7c2c('0x26')](function(_0x1d0140){var _0x27a096=_0x2b79d5[_0x7c2c('0x4c')]['get']({'plain':!![]});if(!_0x27a096)throw new Error(_0x7c2c('0x4d'));if(_0x27a096[_0x7c2c('0x4e')]==='user'){var _0x19621a=_0x1d0140['get']({'plain':!![]});var _0xfba6a7=_0x7c2c('0x27');return db[_0x7c2c('0x4f')]['find']({'where':{'name':_0xfba6a7,'userProfileId':_0x27a096['userProfileId']},'raw':!![]})[_0x7c2c('0x26')](function(_0x5e4bc3){if(_0x5e4bc3&&_0x5e4bc3[_0x7c2c('0x50')]===0x0){return db[_0x7c2c('0x28')]['create']({'name':_0x19621a[_0x7c2c('0x2b')],'resourceId':_0x19621a['id'],'type':_0x5e4bc3[_0x7c2c('0x2b')],'sectionId':_0x5e4bc3['id']},{})['then'](function(){return _0x1d0140;});}else{return _0x1d0140;}})[_0x7c2c('0x49')](function(_0x5d4d02){logger['error'](_0x7c2c('0x51'),_0x5d4d02);throw _0x5d4d02;});}return _0x1d0140;})[_0x7c2c('0x26')](respondWithResult(_0x5f3de8,0xc9))[_0x7c2c('0x49')](handleError(_0x5f3de8,null));};exports['update']=function(_0x2bede2,_0x5baa8c){if(_0x2bede2[_0x7c2c('0x4b')]['id']){delete _0x2bede2[_0x7c2c('0x4b')]['id'];}return db['ContactItemType'][_0x7c2c('0x52')]({'where':{'id':_0x2bede2[_0x7c2c('0x48')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x5baa8c,null))[_0x7c2c('0x26')](saveUpdates(_0x2bede2['body'],null))[_0x7c2c('0x26')](respondWithResult(_0x5baa8c,null))[_0x7c2c('0x49')](handleError(_0x5baa8c,null));};exports['destroy']=function(_0x43abec,_0x497dfb){return db[_0x7c2c('0x2f')][_0x7c2c('0x52')]({'where':{'id':_0x43abec[_0x7c2c('0x48')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x497dfb,null))[_0x7c2c('0x26')](db['CmContactHasItem'][_0x7c2c('0x24')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x43abec[_0x7c2c('0x48')]['id']}}))['then'](removeEntity(_0x497dfb,null))['catch'](handleError(_0x497dfb,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index dc9285d..5d8caab 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 _0x2634=['./contactItemType.attributes','define','ContactItemType','lodash','api','bluebird','path','rimraf'];(function(_0x51bda1,_0x44f80d){var _0x1ce08c=function(_0x5b788e){while(--_0x5b788e){_0x51bda1['push'](_0x51bda1['shift']());}};_0x1ce08c(++_0x44f80d);}(_0x2634,0x1e3));var _0x4263=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2634[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4263('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4263('0x1'));var moment=require('moment');var BPromise=require(_0x4263('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4263('0x3'));var rimraf=require(_0x4263('0x4'));var config=require('../../config/environment');var attributes=require(_0x4263('0x5'));module['exports']=function(_0x13d2e1,_0x23938e){return _0x13d2e1[_0x4263('0x6')](_0x4263('0x7'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe477=['exports','define','ContactItemType','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes'];(function(_0x2feb53,_0x264ef7){var _0x5700ee=function(_0x700c98){while(--_0x700c98){_0x2feb53['push'](_0x2feb53['shift']());}};_0x5700ee(++_0x264ef7);}(_0xe477,0xf1));var _0x7e47=function(_0x466a1a,_0x37933b){_0x466a1a=_0x466a1a-0x0;var _0x577165=_0xe477[_0x466a1a];return _0x577165;};'use strict';var _=require(_0x7e47('0x0'));var util=require(_0x7e47('0x1'));var logger=require(_0x7e47('0x2'))(_0x7e47('0x3'));var moment=require(_0x7e47('0x4'));var BPromise=require(_0x7e47('0x5'));var rp=require(_0x7e47('0x6'));var fs=require('fs');var path=require(_0x7e47('0x7'));var rimraf=require(_0x7e47('0x8'));var config=require(_0x7e47('0x9'));var attributes=require(_0x7e47('0xa'));module[_0x7e47('0xb')]=function(_0x5b477b,_0x39c887){return _0x5b477b[_0x7e47('0xc')](_0x7e47('0xd'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 53f8f34..6aed0b9 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 _0x912f=['jayson/promise','client','request','then','info','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','ContactItemType,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x294975,_0xba7309){var _0x523628=function(_0x53e7ee){while(--_0x53e7ee){_0x294975['push'](_0x294975['shift']());}};_0x523628(++_0xba7309);}(_0x912f,0x1d9));var _0xf912=function(_0x250d23,_0x4af20e){_0x250d23=_0x250d23-0x0;var _0x8611f7=_0x912f[_0x250d23];return _0x8611f7;};'use strict';var _=require(_0xf912('0x0'));var util=require(_0xf912('0x1'));var moment=require(_0xf912('0x2'));var BPromise=require('bluebird');var rs=require(_0xf912('0x3'));var fs=require('fs');var Redis=require(_0xf912('0x4'));var db=require(_0xf912('0x5'))['db'];var utils=require(_0xf912('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf912('0x7'));var client=jayson[_0xf912('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x393532,_0x3696be,_0x11e894){return new BPromise(function(_0x51b95b,_0x553a67){return client[_0xf912('0x9')](_0x393532,_0x11e894)[_0xf912('0xa')](function(_0x2469a2){logger[_0xf912('0xb')]('ContactItemType,\x20%s,\x20%s',_0x3696be,_0xf912('0xc'));logger['debug'](_0xf912('0xd'),_0x3696be,_0xf912('0xc'),JSON[_0xf912('0xe')](_0x2469a2));if(_0x2469a2['error']){if(_0x2469a2['error']['code']===0x1f4){logger[_0xf912('0xf')](_0xf912('0x10'),_0x3696be,_0x2469a2[_0xf912('0xf')][_0xf912('0x11')]);return _0x553a67(_0x2469a2['error'][_0xf912('0x11')]);}logger[_0xf912('0xf')](_0xf912('0x10'),_0x3696be,_0x2469a2['error']['message']);return _0x51b95b(_0x2469a2[_0xf912('0xf')][_0xf912('0x11')]);}else{logger[_0xf912('0xb')](_0xf912('0x10'),_0x3696be,_0xf912('0xc'));_0x51b95b(_0x2469a2[_0xf912('0x12')][_0xf912('0x11')]);}})[_0xf912('0x13')](function(_0x158826){logger['error'](_0xf912('0x10'),_0x3696be,_0x158826);_0x553a67(_0x158826);});});} \ No newline at end of file +var _0xf640=['then','info','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','ContactItemType,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0xf23808,_0x1da7ab){var _0x357d8a=function(_0x179682){while(--_0x179682){_0xf23808['push'](_0xf23808['shift']());}};_0x357d8a(++_0x1da7ab);}(_0xf640,0x16e));var _0x0f64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf640[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0f64('0x0'));var util=require(_0x0f64('0x1'));var moment=require(_0x0f64('0x2'));var BPromise=require(_0x0f64('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f64('0x4'));var db=require(_0x0f64('0x5'))['db'];var utils=require(_0x0f64('0x6'));var logger=require(_0x0f64('0x7'))('rpc');var config=require(_0x0f64('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0f64('0x9')][_0x0f64('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56de6b,_0x4596b3,_0xbb7460){return new BPromise(function(_0x3b1630,_0x14058f){return client[_0x0f64('0xb')](_0x56de6b,_0xbb7460)[_0x0f64('0xc')](function(_0x43ebb4){logger[_0x0f64('0xd')]('ContactItemType,\x20%s,\x20%s',_0x4596b3,_0x0f64('0xe'));logger['debug'](_0x0f64('0xf'),_0x4596b3,_0x0f64('0xe'),JSON['stringify'](_0x43ebb4));if(_0x43ebb4['error']){if(_0x43ebb4[_0x0f64('0x10')][_0x0f64('0x11')]===0x1f4){logger[_0x0f64('0x10')](_0x0f64('0x12'),_0x4596b3,_0x43ebb4[_0x0f64('0x10')][_0x0f64('0x13')]);return _0x14058f(_0x43ebb4[_0x0f64('0x10')][_0x0f64('0x13')]);}logger[_0x0f64('0x10')]('ContactItemType,\x20%s,\x20%s',_0x4596b3,_0x43ebb4['error']['message']);return _0x3b1630(_0x43ebb4['error'][_0x0f64('0x13')]);}else{logger[_0x0f64('0xd')]('ContactItemType,\x20%s,\x20%s',_0x4596b3,_0x0f64('0xe'));_0x3b1630(_0x43ebb4['result'][_0x0f64('0x13')]);}})[_0x0f64('0x14')](function(_0x4c23c9){logger[_0x0f64('0x10')]('ContactItemType,\x20%s,\x20%s',_0x4596b3,_0x4c23c9);_0x14058f(_0x4c23c9);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index ce3d1f9..57894b0 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 _0x4a1c=['create','put','/:id','destroy','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./contactItemType.controller','get','index','isAuthenticated','show','post'];(function(_0x14c43d,_0x5de3af){var _0x1190f0=function(_0x2aa41f){while(--_0x2aa41f){_0x14c43d['push'](_0x14c43d['shift']());}};_0x1190f0(++_0x5de3af);}(_0x4a1c,0x199));var _0xc4a1=function(_0x528575,_0x2e067d){_0x528575=_0x528575-0x0;var _0x3063b7=_0x4a1c[_0x528575];return _0x3063b7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc4a1('0x0'));var express=require(_0xc4a1('0x1'));var router=express['Router']();var fs_extra=require(_0xc4a1('0x2'));var auth=require(_0xc4a1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc4a1('0x4'));var controller=require(_0xc4a1('0x5'));router[_0xc4a1('0x6')]('/',auth['isAuthenticated'](),controller[_0xc4a1('0x7')]);router[_0xc4a1('0x6')]('/:id',auth[_0xc4a1('0x8')](),controller[_0xc4a1('0x9')]);router[_0xc4a1('0xa')]('/',auth[_0xc4a1('0x8')](),controller[_0xc4a1('0xb')]);router[_0xc4a1('0xc')]('/:id',auth[_0xc4a1('0x8')](),controller['update']);router['delete'](_0xc4a1('0xd'),auth['isAuthenticated'](),controller[_0xc4a1('0xe')]);module['exports']=router; \ No newline at end of file +var _0xd6d1=['../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1ca29f,_0x318ac5){var _0x576c3b=function(_0x40caab){while(--_0x40caab){_0x1ca29f['push'](_0x1ca29f['shift']());}};_0x576c3b(++_0x318ac5);}(_0xd6d1,0x161));var _0x1d6d=function(_0x1e723d,_0x7b6655){_0x1e723d=_0x1e723d-0x0;var _0x41e81b=_0xd6d1[_0x1e723d];return _0x41e81b;};'use strict';var multer=require('multer');var util=require(_0x1d6d('0x0'));var path=require(_0x1d6d('0x1'));var timeout=require(_0x1d6d('0x2'));var express=require(_0x1d6d('0x3'));var router=express[_0x1d6d('0x4')]();var fs_extra=require(_0x1d6d('0x5'));var auth=require(_0x1d6d('0x6'));var interaction=require(_0x1d6d('0x7'));var config=require(_0x1d6d('0x8'));var controller=require('./contactItemType.controller');router[_0x1d6d('0x9')]('/',auth['isAuthenticated'](),controller[_0x1d6d('0xa')]);router['get'](_0x1d6d('0xb'),auth[_0x1d6d('0xc')](),controller[_0x1d6d('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1d6d('0xe')]);router[_0x1d6d('0xf')](_0x1d6d('0xb'),auth[_0x1d6d('0xc')](),controller[_0x1d6d('0x10')]);router[_0x1d6d('0x11')](_0x1d6d('0xb'),auth[_0x1d6d('0xc')](),controller[_0x1d6d('0x12')]);module[_0x1d6d('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index bebbc1b..0197660 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 _0xe706=['STRING','sequelize','exports'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xe706,0xa3));var _0x6e70=function(_0x3b1582,_0x31a7ff){_0x3b1582=_0x3b1582-0x0;var _0x3f2d2f=_0xe706[_0x3b1582];return _0x3f2d2f;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0xfacf36,_0x4d495f){var _0x141f1e=function(_0xb7cf78){while(--_0xb7cf78){_0xfacf36['push'](_0xfacf36['shift']());}};_0x141f1e(++_0x4d495f);}(_0x2032,0xd9));var _0x2203=function(_0x19604a,_0x3f5e31){_0x19604a=_0x19604a-0x0;var _0x14c9e8=_0x2032[_0x19604a];return _0x14c9e8;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 55b2be0..aee0fdd 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 _0x893f=['attrReport','reportType','attrRefresh','stringify','addItem','getItems','findOne','DashboardItem','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','save','update','destroy','then','get','CustomDashboards','UserProfileResource','error','name','send','map','Dashboard','rawAttributes','type','key','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','rows','catch','show','params','keys','length','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','body','updatedAt','role','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','attrOpenchannelAccounts','attrChatWebsites','web-report'];(function(_0x4305e2,_0x401ac3){var _0x1f9552=function(_0x41cc2a){while(--_0x41cc2a){_0x4305e2['push'](_0x4305e2['shift']());}};_0x1f9552(++_0x401ac3);}(_0x893f,0x182));var _0xf893=function(_0x785987,_0x14827a){_0x785987=_0x785987-0x0;var _0x29f5c8=_0x893f[_0x785987];return _0x29f5c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf893('0x0'));var zipdir=require(_0xf893('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf893('0x2'));var moment=require(_0xf893('0x3'));var BPromise=require(_0xf893('0x4'));var Mustache=require(_0xf893('0x5'));var util=require(_0xf893('0x6'));var path=require(_0xf893('0x7'));var sox=require('sox');var csv=require(_0xf893('0x8'));var ejs=require(_0xf893('0x9'));var fs=require('fs');var fs_extra=require(_0xf893('0xa'));var _=require(_0xf893('0xb'));var squel=require(_0xf893('0xc'));var crypto=require(_0xf893('0xd'));var jsforce=require(_0xf893('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf893('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf893('0xf'));var authService=require(_0xf893('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf893('0x11'));var hardwareService=require(_0xf893('0x12'));var logger=require(_0xf893('0x13'))(_0xf893('0x14'));var utils=require(_0xf893('0x15'));var config=require(_0xf893('0x16'));var licenseUtil=require(_0xf893('0x17'));var db=require(_0xf893('0x18'))['db'];config['redis']=_[_0xf893('0x19')](config[_0xf893('0x1a')],{'host':_0xf893('0x1b'),'port':0x18eb});var socket=require(_0xf893('0x1c'))(new Redis(config[_0xf893('0x1a')]));require(_0xf893('0x1d'))[_0xf893('0x1e')](socket);function respondWithStatusCode(_0x2b6b7c,_0x281b33){_0x281b33=_0x281b33||0xcc;return function(_0x2f8809){if(_0x2f8809){return _0x2b6b7c[_0xf893('0x1f')](_0x281b33);}return _0x2b6b7c[_0xf893('0x20')](_0x281b33)[_0xf893('0x21')]();};}function respondWithResult(_0x7b10c7,_0x21ed88){_0x21ed88=_0x21ed88||0xc8;return function(_0x4b9003){if(_0x4b9003){return _0x7b10c7[_0xf893('0x20')](_0x21ed88)[_0xf893('0x22')](_0x4b9003);}};}function respondWithFilteredResult(_0x378e95,_0x5be803){return function(_0x46f6e5){if(_0x46f6e5){var _0x5cdb7b=typeof _0x5be803['offset']===_0xf893('0x23')&&typeof _0x5be803[_0xf893('0x24')]===_0xf893('0x23');var _0x381fd2=_0x46f6e5[_0xf893('0x25')];var _0x3864d7=_0x5cdb7b?0x0:_0x5be803[_0xf893('0x26')];var _0x4a8bc5=_0x5cdb7b?_0x46f6e5[_0xf893('0x25')]:_0x5be803[_0xf893('0x26')]+_0x5be803[_0xf893('0x24')];var _0x41b020;if(_0x4a8bc5>=_0x381fd2){_0x4a8bc5=_0x381fd2;_0x41b020=0xc8;}else{_0x41b020=0xce;}_0x378e95[_0xf893('0x20')](_0x41b020);return _0x378e95[_0xf893('0x27')]('Content-Range',_0x3864d7+'-'+_0x4a8bc5+'/'+_0x381fd2)['json'](_0x46f6e5);}return null;};}function patchUpdates(_0x395dbb){return function(_0xb4d62f){try{jsonpatch['apply'](_0xb4d62f,_0x395dbb,!![]);}catch(_0x997c6e){return BPromise['reject'](_0x997c6e);}return _0xb4d62f[_0xf893('0x28')]();};}function saveUpdates(_0x198264,_0xb7e447){return function(_0xc88919){if(_0xc88919){return _0xc88919[_0xf893('0x29')](_0x198264)['then'](function(_0x51297b){return _0x51297b;});}return null;};}function removeEntity(_0x845701,_0x103b19){return function(_0x3b3b04){if(_0x3b3b04){return _0x3b3b04[_0xf893('0x2a')]()[_0xf893('0x2b')](function(){var _0x4a7dc8=_0x3b3b04[_0xf893('0x2c')]({'plain':!![]});var _0x32cf56=_0xf893('0x2d');return db[_0xf893('0x2e')][_0xf893('0x2a')]({'where':{'type':_0x32cf56,'resourceId':_0x4a7dc8['id']}})[_0xf893('0x2b')](function(){return _0x3b3b04;});})[_0xf893('0x2b')](function(){_0x845701['status'](0xcc)[_0xf893('0x21')]();});}};}function handleEntityNotFound(_0x314f87,_0xcca8b8){return function(_0x2d31a3){if(!_0x2d31a3){_0x314f87[_0xf893('0x1f')](0x194);}return _0x2d31a3;};}function handleError(_0x451cfa,_0x42d2d3){_0x42d2d3=_0x42d2d3||0x1f4;return function(_0x50ab52){logger[_0xf893('0x2f')](_0x50ab52['stack']);if(_0x50ab52[_0xf893('0x30')]){delete _0x50ab52[_0xf893('0x30')];}_0x451cfa[_0xf893('0x20')](_0x42d2d3)[_0xf893('0x31')](_0x50ab52);};}exports['index']=function(_0x119266,_0x348b0e){var _0x293bca={},_0x1a3e9a={},_0x183e2d={'count':0x0,'rows':[]};var _0x4b663c=_[_0xf893('0x32')](db[_0xf893('0x33')][_0xf893('0x34')],function(_0x1d3443){return{'name':_0x1d3443['fieldName'],'type':_0x1d3443[_0xf893('0x35')][_0xf893('0x36')]};});_0x1a3e9a['model']=_[_0xf893('0x32')](_0x4b663c,_0xf893('0x30'));_0x1a3e9a[_0xf893('0x37')]=_['keys'](_0x119266[_0xf893('0x37')]);_0x1a3e9a['filters']=_[_0xf893('0x38')](_0x1a3e9a['model'],_0x1a3e9a['query']);_0x293bca[_0xf893('0x39')]=_[_0xf893('0x38')](_0x1a3e9a[_0xf893('0x3a')],qs[_0xf893('0x3b')](_0x119266[_0xf893('0x37')][_0xf893('0x3b')]));_0x293bca['attributes']=_0x293bca['attributes']['length']?_0x293bca[_0xf893('0x39')]:_0x1a3e9a['model'];if(!_0x119266[_0xf893('0x37')][_0xf893('0x3c')](_0xf893('0x3d'))){_0x293bca[_0xf893('0x24')]=qs[_0xf893('0x24')](_0x119266[_0xf893('0x37')][_0xf893('0x24')]);_0x293bca['offset']=qs[_0xf893('0x26')](_0x119266['query'][_0xf893('0x26')]);}_0x293bca[_0xf893('0x3e')]=qs[_0xf893('0x3f')](_0x119266[_0xf893('0x37')][_0xf893('0x3f')]);_0x293bca[_0xf893('0x40')]=qs['filters'](_[_0xf893('0x41')](_0x119266['query'],_0x1a3e9a[_0xf893('0x42')]),_0x4b663c);if(_0x119266[_0xf893('0x37')][_0xf893('0x43')]){_0x293bca[_0xf893('0x40')]=_[_0xf893('0x44')](_0x293bca[_0xf893('0x40')],{'$or':_[_0xf893('0x32')](_0x4b663c,function(_0x51644e){if(_0x51644e[_0xf893('0x35')]!==_0xf893('0x45')){var _0x55d58f={};_0x55d58f[_0x51644e[_0xf893('0x30')]]={'$like':'%'+_0x119266[_0xf893('0x37')][_0xf893('0x43')]+'%'};return _0x55d58f;}})});}_0x293bca=_[_0xf893('0x44')]({},_0x293bca,_0x119266[_0xf893('0x46')]);var _0x266972={'where':_0x293bca[_0xf893('0x40')]};return db[_0xf893('0x33')][_0xf893('0x25')](_0x266972)['then'](function(_0x282995){_0x183e2d['count']=_0x282995;if(_0x119266['query']['includeAll']){_0x293bca['include']=[{'all':!![]}];}return db[_0xf893('0x33')]['findAll'](_0x293bca);})[_0xf893('0x2b')](function(_0x119acc){_0x183e2d[_0xf893('0x47')]=_0x119acc;return _0x183e2d;})['then'](respondWithFilteredResult(_0x348b0e,_0x293bca))[_0xf893('0x48')](handleError(_0x348b0e,null));};exports[_0xf893('0x49')]=function(_0x4fc226,_0x45964c){var _0x5536d1={'raw':![],'where':{'id':_0x4fc226[_0xf893('0x4a')]['id']}},_0x346ad3={};_0x346ad3[_0xf893('0x3a')]=_[_0xf893('0x4b')](db[_0xf893('0x33')][_0xf893('0x34')]);_0x346ad3[_0xf893('0x37')]=_[_0xf893('0x4b')](_0x4fc226[_0xf893('0x37')]);_0x346ad3['filters']=_[_0xf893('0x38')](_0x346ad3[_0xf893('0x3a')],_0x346ad3[_0xf893('0x37')]);_0x5536d1[_0xf893('0x39')]=_[_0xf893('0x38')](_0x346ad3[_0xf893('0x3a')],qs[_0xf893('0x3b')](_0x4fc226[_0xf893('0x37')][_0xf893('0x3b')]));_0x5536d1[_0xf893('0x39')]=_0x5536d1[_0xf893('0x39')][_0xf893('0x4c')]?_0x5536d1[_0xf893('0x39')]:_0x346ad3['model'];if(_0x4fc226[_0xf893('0x37')]['includeAll']){_0x5536d1[_0xf893('0x4d')]=[{'all':!![]}];}_0x5536d1=_[_0xf893('0x44')]({},_0x5536d1,_0x4fc226[_0xf893('0x46')]);return db[_0xf893('0x33')][_0xf893('0x4e')](_0x5536d1)[_0xf893('0x2b')](handleEntityNotFound(_0x45964c,null))[_0xf893('0x2b')](respondWithResult(_0x45964c,null))['catch'](handleError(_0x45964c,null));};exports['create']=function(_0x4c2f1d,_0x29e334){return db['Dashboard'][_0xf893('0x4f')](_0x4c2f1d['body'],{})['then'](function(_0xb944fe){var _0x5ebfdf=_0x4c2f1d[_0xf893('0x50')][_0xf893('0x2c')]({'plain':!![]});if(!_0x5ebfdf)throw new Error(_0xf893('0x51'));if(_0x5ebfdf['role']==='user'){var _0x56508f=_0xb944fe[_0xf893('0x2c')]({'plain':!![]});var _0x44edbc=_0xf893('0x2d');return db[_0xf893('0x52')][_0xf893('0x4e')]({'where':{'name':_0x44edbc,'userProfileId':_0x5ebfdf[_0xf893('0x53')]},'raw':!![]})[_0xf893('0x2b')](function(_0x5bb0b7){if(_0x5bb0b7&&_0x5bb0b7[_0xf893('0x54')]===0x0){return db[_0xf893('0x2e')]['create']({'name':_0x56508f[_0xf893('0x30')],'resourceId':_0x56508f['id'],'type':_0x5bb0b7['name'],'sectionId':_0x5bb0b7['id']},{})[_0xf893('0x2b')](function(){return _0xb944fe;});}else{return _0xb944fe;}})[_0xf893('0x48')](function(_0x3b7893){logger[_0xf893('0x2f')](_0xf893('0x55'),_0x3b7893);throw _0x3b7893;});}return _0xb944fe;})[_0xf893('0x2b')](respondWithResult(_0x29e334,0xc9))[_0xf893('0x48')](handleError(_0x29e334,null));};exports[_0xf893('0x56')]=function(_0x4df12f,_0x374260){var _0x59e3be={'where':{'id':_0x4df12f[_0xf893('0x4a')]['id']}},_0x7d0bfe={};_0x7d0bfe[_0xf893('0x3a')]=_[_0xf893('0x4b')](db['Dashboard']['rawAttributes']);_0x59e3be[_0xf893('0x39')]=_[_0xf893('0x38')](_0x7d0bfe[_0xf893('0x3a')],qs[_0xf893('0x3b')](_0x4df12f[_0xf893('0x37')][_0xf893('0x3b')]));_0x59e3be[_0xf893('0x39')]=_0x59e3be[_0xf893('0x39')][_0xf893('0x4c')]?_0x59e3be['attributes']:_0x7d0bfe[_0xf893('0x3a')];if(_0x4df12f['query']['includeAll']){_0x59e3be['include']=[{'all':!![]}];}_0x59e3be=_[_0xf893('0x44')]({},_0x59e3be,_0x4df12f[_0xf893('0x46')]);return db[_0xf893('0x33')]['find'](_0x59e3be)[_0xf893('0x2b')](handleEntityNotFound(_0x374260,null))['then'](function(_0x11159f){if(_0x11159f){var _0x42c582=_0x11159f[_0xf893('0x2c')]({'plain':!![]});_0x42c582=qs[_0xf893('0x57')](_0x42c582,['id',_0xf893('0x58'),'updatedAt']);_0x4df12f[_0xf893('0x59')]=_[_0xf893('0x57')](_0x4df12f[_0xf893('0x59')],['id',_0xf893('0x58'),_0xf893('0x5a')]);return db[_0xf893('0x33')][_0xf893('0x4f')](_[_0xf893('0x44')](_0x42c582,_0x4df12f[_0xf893('0x59')]),{'include':_0x4df12f['query']['includeAll']?[{'all':!![]}]:undefined})[_0xf893('0x2b')](function(_0x4b27b5){var _0x54d6f2=_0x4df12f['user'][_0xf893('0x2c')]({'plain':!![]});if(!_0x54d6f2)throw new Error(_0xf893('0x51'));if(_0x54d6f2[_0xf893('0x5b')]===_0xf893('0x50')){var _0x531f64=_0x4b27b5[_0xf893('0x2c')]({'plain':!![]});var _0x488ac9=_0xf893('0x2d');return db[_0xf893('0x52')][_0xf893('0x4e')]({'where':{'name':_0x488ac9,'userProfileId':_0x54d6f2[_0xf893('0x53')]},'raw':!![]})[_0xf893('0x2b')](function(_0x550a4c){if(_0x550a4c&&_0x550a4c[_0xf893('0x54')]===0x0){return db[_0xf893('0x2e')][_0xf893('0x4f')]({'name':_0x531f64['name'],'resourceId':_0x531f64['id'],'type':_0x550a4c[_0xf893('0x30')],'sectionId':_0x550a4c['id']},{})[_0xf893('0x2b')](function(){return _0x4b27b5;});}else{return _0x4b27b5;}})['catch'](function(_0x3ec9f5){logger[_0xf893('0x2f')](_0xf893('0x55'),_0x3ec9f5);throw _0x3ec9f5;});}return _0x4b27b5;});}})[_0xf893('0x2b')](respondWithResult(_0x374260,0xc9))[_0xf893('0x48')](handleError(_0x374260,null));};exports[_0xf893('0x29')]=function(_0x28c442,_0x463ff9){if(_0x28c442[_0xf893('0x59')]['id']){delete _0x28c442['body']['id'];}return db[_0xf893('0x33')]['find']({'where':{'id':_0x28c442[_0xf893('0x4a')]['id']}})[_0xf893('0x2b')](handleEntityNotFound(_0x463ff9,null))['then'](saveUpdates(_0x28c442[_0xf893('0x59')],null))['then'](respondWithResult(_0x463ff9,null))[_0xf893('0x48')](handleError(_0x463ff9,null));};exports[_0xf893('0x2a')]=function(_0x318ed6,_0xb1f3a6){return db[_0xf893('0x33')][_0xf893('0x4e')]({'where':{'id':_0x318ed6[_0xf893('0x4a')]['id']}})[_0xf893('0x2b')](handleEntityNotFound(_0xb1f3a6,null))[_0xf893('0x2b')](removeEntity(_0xb1f3a6,null))['catch'](handleError(_0xb1f3a6,null));};function widgetAttributes(_0x538312){try{switch(_0x538312[_0xf893('0x35')]){case'iframe':return[{'name':'attrUrl','value':_0x538312[_0xf893('0x5c')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x0]?_0x538312[_0xf893('0x5d')][0x0][_0xf893('0x5e')]:undefined)||'https://'}];case'custom':return[{'name':_0xf893('0x5f'),'value':_0x538312[_0xf893('0x5f')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x0]?_0x538312[_0xf893('0x5d')][0x0][_0xf893('0x5e')]:undefined)||''}];case _0xf893('0x60'):return[{'name':_0xf893('0x61'),'value':_0x538312['attrHourFormat']||(_0x538312['attrs']&&_0x538312['attrs'][0x0]?_0x538312[_0xf893('0x5d')][0x0][_0xf893('0x5e')]:undefined)||_0xf893('0x62')},{'name':_0xf893('0x63'),'value':_0x538312[_0xf893('0x63')]||(_0x538312[_0xf893('0x5d')]&&_0x538312['attrs'][0x1]?_0x538312[_0xf893('0x5d')][0x1]['value']:undefined)||_0xf893('0x64')},{'name':_0xf893('0x65'),'value':_0x538312[_0xf893('0x65')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x2]?_0x538312[_0xf893('0x5d')][0x2][_0xf893('0x5e')]:undefined)||0xc}];case _0xf893('0x66'):return[{'name':_0xf893('0x67'),'value':_0x538312[_0xf893('0x67')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x0]?_0x538312[_0xf893('0x5d')][0x0][_0xf893('0x5e')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x538312['attrVoiceQueues']||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x1]?_0x538312[_0xf893('0x5d')][0x1][_0xf893('0x5e')]:undefined)||[]},{'name':_0xf893('0x65'),'value':_0x538312['attrFontSize']||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x2]?_0x538312[_0xf893('0x5d')][0x2][_0xf893('0x5e')]:undefined)||0x14},{'name':_0xf893('0x68'),'value':_0x538312['attrChannel']||(_0x538312['attrs']&&_0x538312['attrs'][0x3]?_0x538312[_0xf893('0x5d')][0x3][_0xf893('0x5e')]:undefined)||_0xf893('0x69')},{'name':_0xf893('0x6a'),'value':_0x538312[_0xf893('0x6a')]||(_0x538312['attrs']&&_0x538312['attrs'][0x4]?_0x538312[_0xf893('0x5d')][0x4]['value']:undefined)||''},{'name':_0xf893('0x6b'),'value':_0x538312[_0xf893('0x6b')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x5]?_0x538312[_0xf893('0x5d')][0x5]['value']:undefined)||''},{'name':_0xf893('0x6c'),'value':_0x538312[_0xf893('0x6c')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x6]?_0x538312['attrs'][0x6][_0xf893('0x5e')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x538312['attrOpenchannelAccounts']||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x7]?_0x538312[_0xf893('0x5d')][0x7][_0xf893('0x5e')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x538312[_0xf893('0x6d')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x8]?_0x538312[_0xf893('0x5d')][0x8][_0xf893('0x5e')]:undefined)||''},{'name':'attrChatWebsites','value':_0x538312['attrChatWebsites']||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x9]?_0x538312['attrs'][0x9][_0xf893('0x5e')]:undefined)||''}];case _0xf893('0x6e'):case'pie-chart':return[{'name':_0xf893('0x6f'),'value':_0x538312[_0xf893('0x6f')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x0]?_0x538312[_0xf893('0x5d')][0x0][_0xf893('0x5e')]:undefined)||'total'},{'name':'attrSerie2','value':_0x538312[_0xf893('0x70')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x1]?_0x538312[_0xf893('0x5d')][0x1][_0xf893('0x5e')]:undefined)||null},{'name':_0xf893('0x71'),'value':_0x538312[_0xf893('0x71')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x2]?_0x538312['attrs'][0x2][_0xf893('0x5e')]:undefined)||null},{'name':_0xf893('0x72'),'value':_0x538312[_0xf893('0x72')]||(_0x538312['attrs']&&_0x538312[_0xf893('0x5d')][0x3]?_0x538312[_0xf893('0x5d')][0x3]['value']:undefined)||[]},{'name':_0xf893('0x68'),'value':_0x538312[_0xf893('0x68')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x4]?_0x538312[_0xf893('0x5d')][0x4][_0xf893('0x5e')]:undefined)||_0xf893('0x69')},{'name':_0xf893('0x6a'),'value':_0x538312['attrEmailAccounts']||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x5]?_0x538312['attrs'][0x5][_0xf893('0x5e')]:undefined)||''},{'name':_0xf893('0x6b'),'value':_0x538312['attrFaxAccounts']||(_0x538312['attrs']&&_0x538312[_0xf893('0x5d')][0x6]?_0x538312[_0xf893('0x5d')][0x6][_0xf893('0x5e')]:undefined)||''},{'name':_0xf893('0x6c'),'value':_0x538312[_0xf893('0x6c')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x7]?_0x538312[_0xf893('0x5d')][0x7][_0xf893('0x5e')]:undefined)||''},{'name':_0xf893('0x73'),'value':_0x538312[_0xf893('0x73')]||(_0x538312[_0xf893('0x5d')]&&_0x538312['attrs'][0x8]?_0x538312['attrs'][0x8][_0xf893('0x5e')]:undefined)||''},{'name':_0xf893('0x6d'),'value':_0x538312[_0xf893('0x6d')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x9]?_0x538312[_0xf893('0x5d')][0x9][_0xf893('0x5e')]:undefined)||''},{'name':_0xf893('0x74'),'value':_0x538312[_0xf893('0x74')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0xa]?_0x538312[_0xf893('0x5d')][0xa][_0xf893('0x5e')]:undefined)||''}];case _0xf893('0x75'):return[{'name':_0xf893('0x76'),'type':_0x538312[_0xf893('0x77')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x0]?_0x538312['attrs'][0x0][_0xf893('0x35')]:undefined)||null,'value':_0x538312[_0xf893('0x76')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x0]?_0x538312['attrs'][0x0]['value']:undefined)||null},{'name':_0xf893('0x78'),'value':_0x538312['attrRefresh']||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x1]?_0x538312[_0xf893('0x5d')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x394cdc){logger[_0xf893('0x2f')]('widgetAttributes:\x20%s',JSON[_0xf893('0x79')](_0x394cdc));return[];}}exports[_0xf893('0x7a')]=function(_0x59ab28,_0x3aca7d,_0x58d630){if(_0x59ab28[_0xf893('0x59')]['id']){delete _0x59ab28['body']['id'];}return db['Dashboard'][_0xf893('0x4e')]({'where':{'id':_0x59ab28[_0xf893('0x4a')]['id']}})[_0xf893('0x2b')](handleEntityNotFound(_0x3aca7d,null))['then'](function(_0x140491){if(_0x140491){_0x59ab28[_0xf893('0x59')]['DashboardId']=_0x140491['id'];_0x59ab28[_0xf893('0x59')][_0xf893('0x5d')]=widgetAttributes(_0x59ab28[_0xf893('0x59')]);return db['DashboardItem'][_0xf893('0x4f')](_0x59ab28['body']);}})[_0xf893('0x2b')](respondWithResult(_0x3aca7d,null))['catch'](handleError(_0x3aca7d,null));};exports[_0xf893('0x7b')]=function(_0x2f4a92,_0x42f7be,_0x39868d){var _0x2e1495={};var _0x29d01b={};var _0x411ae6;var _0x40a729;return db[_0xf893('0x33')][_0xf893('0x7c')]({'where':{'id':_0x2f4a92[_0xf893('0x4a')]['id']}})['then'](handleEntityNotFound(_0x42f7be,null))[_0xf893('0x2b')](function(_0xa35e23){if(_0xa35e23){_0x411ae6=_0xa35e23;_0x29d01b[_0xf893('0x3a')]=_[_0xf893('0x4b')](db[_0xf893('0x7d')][_0xf893('0x34')]);_0x29d01b[_0xf893('0x37')]=_[_0xf893('0x4b')](_0x2f4a92[_0xf893('0x37')]);_0x29d01b['filters']=_['intersection'](_0x29d01b[_0xf893('0x3a')],_0x29d01b[_0xf893('0x37')]);_0x2e1495[_0xf893('0x39')]=_['intersection'](_0x29d01b['model'],qs[_0xf893('0x3b')](_0x2f4a92[_0xf893('0x37')][_0xf893('0x3b')]));_0x2e1495[_0xf893('0x39')]=_0x2e1495[_0xf893('0x39')][_0xf893('0x4c')]?_0x2e1495['attributes']:_0x29d01b['model'];_0x2e1495['order']=qs[_0xf893('0x3f')](_0x2f4a92[_0xf893('0x37')][_0xf893('0x3f')]);_0x2e1495[_0xf893('0x40')]=qs[_0xf893('0x42')](_[_0xf893('0x41')](_0x2f4a92[_0xf893('0x37')],_0x29d01b[_0xf893('0x42')]));if(_0x2f4a92['query'][_0xf893('0x43')]){_0x2e1495[_0xf893('0x40')]=_[_0xf893('0x44')](_0x2e1495[_0xf893('0x40')],{'$or':_['map'](_0x2e1495[_0xf893('0x39')],function(_0x31b694){var _0x4c0030={};_0x4c0030[_0x31b694]={'$like':'%'+_0x2f4a92[_0xf893('0x37')]['filter']+'%'};return _0x4c0030;})});}_0x2e1495=_['merge']({},_0x2e1495,_0x2f4a92[_0xf893('0x46')]);return _0x411ae6['getItems'](_0x2e1495);}})['then'](function(_0x15dd13){if(_0x15dd13){_0x40a729=_0x15dd13[_0xf893('0x4c')];if(!_0x2f4a92[_0xf893('0x37')]['hasOwnProperty'](_0xf893('0x3d'))){_0x2e1495['limit']=qs[_0xf893('0x24')](_0x2f4a92['query'][_0xf893('0x24')]);_0x2e1495[_0xf893('0x26')]=qs['offset'](_0x2f4a92['query'][_0xf893('0x26')]);}return _0x411ae6[_0xf893('0x7b')](_0x2e1495);}})['then'](function(_0x2b1392){if(_0x2b1392){return _0x2b1392?{'count':_0x40a729,'rows':_0x2b1392}:null;}})['then'](respondWithResult(_0x42f7be,null))[_0xf893('0x48')](handleError(_0x42f7be,null));}; \ No newline at end of file +var _0x0361=['DashboardItem','getItems','findOne','order','nolimit','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','name','send','index','map','Dashboard','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','count','includeAll','include','findAll','catch','show','keys','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','omit','updatedAt','autoAssociation','params','attrUrl','attrs','value','https://','custom','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify'];(function(_0x5f7203,_0x334239){var _0x4d1702=function(_0x777529){while(--_0x777529){_0x5f7203['push'](_0x5f7203['shift']());}};_0x4d1702(++_0x334239);}(_0x0361,0x17c));var _0x1036=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0361[_0xfae23b];return _0x200640;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1036('0x0'));var zipdir=require(_0x1036('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1036('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1036('0x3'));var util=require(_0x1036('0x4'));var path=require(_0x1036('0x5'));var sox=require('sox');var csv=require(_0x1036('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1036('0x7'));var jsforce=require(_0x1036('0x8'));var deskjs=require(_0x1036('0x9'));var toCsv=require(_0x1036('0x6'));var querystring=require(_0x1036('0xa'));var Papa=require('papaparse');var Redis=require(_0x1036('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x1036('0xc'));var as=require(_0x1036('0xd'));var hardwareService=require(_0x1036('0xe'));var logger=require('../../config/logger')(_0x1036('0xf'));var utils=require(_0x1036('0x10'));var config=require(_0x1036('0x11'));var licenseUtil=require(_0x1036('0x12'));var db=require(_0x1036('0x13'))['db'];config[_0x1036('0x14')]=_[_0x1036('0x15')](config[_0x1036('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x1036('0x16'))(new Redis(config[_0x1036('0x14')]));require(_0x1036('0x17'))[_0x1036('0x18')](socket);function respondWithStatusCode(_0x2e49ad,_0x4b68cb){_0x4b68cb=_0x4b68cb||0xcc;return function(_0x32700d){if(_0x32700d){return _0x2e49ad[_0x1036('0x19')](_0x4b68cb);}return _0x2e49ad[_0x1036('0x1a')](_0x4b68cb)[_0x1036('0x1b')]();};}function respondWithResult(_0x54ca8b,_0x2271df){_0x2271df=_0x2271df||0xc8;return function(_0x323913){if(_0x323913){return _0x54ca8b[_0x1036('0x1a')](_0x2271df)['json'](_0x323913);}};}function respondWithFilteredResult(_0x22adc1,_0x25421d){return function(_0x3d5ec1){if(_0x3d5ec1){var _0x41567a=typeof _0x25421d[_0x1036('0x1c')]==='undefined'&&typeof _0x25421d['limit']==='undefined';var _0x4371ab=_0x3d5ec1['count'];var _0xea6168=_0x41567a?0x0:_0x25421d[_0x1036('0x1c')];var _0x5d4483=_0x41567a?_0x3d5ec1['count']:_0x25421d[_0x1036('0x1c')]+_0x25421d[_0x1036('0x1d')];var _0x43f6b4;if(_0x5d4483>=_0x4371ab){_0x5d4483=_0x4371ab;_0x43f6b4=0xc8;}else{_0x43f6b4=0xce;}_0x22adc1[_0x1036('0x1a')](_0x43f6b4);return _0x22adc1[_0x1036('0x1e')](_0x1036('0x1f'),_0xea6168+'-'+_0x5d4483+'/'+_0x4371ab)[_0x1036('0x20')](_0x3d5ec1);}return null;};}function patchUpdates(_0x43c65a){return function(_0x575dc8){try{jsonpatch['apply'](_0x575dc8,_0x43c65a,!![]);}catch(_0x598325){return BPromise[_0x1036('0x21')](_0x598325);}return _0x575dc8[_0x1036('0x22')]();};}function saveUpdates(_0x48507f,_0x409e31){return function(_0x34b9da){if(_0x34b9da){return _0x34b9da[_0x1036('0x23')](_0x48507f)[_0x1036('0x24')](function(_0x596ca3){return _0x596ca3;});}return null;};}function removeEntity(_0xba36d0,_0x1b5418){return function(_0x1e016a){if(_0x1e016a){return _0x1e016a[_0x1036('0x25')]()[_0x1036('0x24')](function(){var _0x58e310=_0x1e016a[_0x1036('0x26')]({'plain':!![]});var _0x4c992c=_0x1036('0x27');return db[_0x1036('0x28')][_0x1036('0x25')]({'where':{'type':_0x4c992c,'resourceId':_0x58e310['id']}})[_0x1036('0x24')](function(){return _0x1e016a;});})[_0x1036('0x24')](function(){_0xba36d0[_0x1036('0x1a')](0xcc)[_0x1036('0x1b')]();});}};}function handleEntityNotFound(_0xc96cc1,_0x323c14){return function(_0x350d5d){if(!_0x350d5d){_0xc96cc1[_0x1036('0x19')](0x194);}return _0x350d5d;};}function handleError(_0x4cc975,_0x3d9646){_0x3d9646=_0x3d9646||0x1f4;return function(_0x4b358f){logger['error'](_0x4b358f['stack']);if(_0x4b358f[_0x1036('0x29')]){delete _0x4b358f[_0x1036('0x29')];}_0x4cc975[_0x1036('0x1a')](_0x3d9646)[_0x1036('0x2a')](_0x4b358f);};}exports[_0x1036('0x2b')]=function(_0x1e4228,_0x385057){var _0x3c74b3={},_0x5180e2={},_0x1f58ba={'count':0x0,'rows':[]};var _0x56afa7=_[_0x1036('0x2c')](db[_0x1036('0x2d')][_0x1036('0x2e')],function(_0x3c728c){return{'name':_0x3c728c[_0x1036('0x2f')],'type':_0x3c728c['type'][_0x1036('0x30')]};});_0x5180e2['model']=_[_0x1036('0x2c')](_0x56afa7,_0x1036('0x29'));_0x5180e2[_0x1036('0x31')]=_['keys'](_0x1e4228[_0x1036('0x31')]);_0x5180e2[_0x1036('0x32')]=_[_0x1036('0x33')](_0x5180e2[_0x1036('0x34')],_0x5180e2['query']);_0x3c74b3['attributes']=_[_0x1036('0x33')](_0x5180e2['model'],qs['fields'](_0x1e4228[_0x1036('0x31')][_0x1036('0x35')]));_0x3c74b3[_0x1036('0x36')]=_0x3c74b3['attributes'][_0x1036('0x37')]?_0x3c74b3[_0x1036('0x36')]:_0x5180e2[_0x1036('0x34')];if(!_0x1e4228[_0x1036('0x31')][_0x1036('0x38')]('nolimit')){_0x3c74b3[_0x1036('0x1d')]=qs[_0x1036('0x1d')](_0x1e4228['query'][_0x1036('0x1d')]);_0x3c74b3[_0x1036('0x1c')]=qs[_0x1036('0x1c')](_0x1e4228[_0x1036('0x31')][_0x1036('0x1c')]);}_0x3c74b3['order']=qs[_0x1036('0x39')](_0x1e4228[_0x1036('0x31')][_0x1036('0x39')]);_0x3c74b3[_0x1036('0x3a')]=qs[_0x1036('0x32')](_[_0x1036('0x3b')](_0x1e4228[_0x1036('0x31')],_0x5180e2[_0x1036('0x32')]),_0x56afa7);if(_0x1e4228[_0x1036('0x31')][_0x1036('0x3c')]){_0x3c74b3[_0x1036('0x3a')]=_['merge'](_0x3c74b3[_0x1036('0x3a')],{'$or':_[_0x1036('0x2c')](_0x56afa7,function(_0x5ae848){if(_0x5ae848[_0x1036('0x3d')]!==_0x1036('0x3e')){var _0x261217={};_0x261217[_0x5ae848[_0x1036('0x29')]]={'$like':'%'+_0x1e4228[_0x1036('0x31')][_0x1036('0x3c')]+'%'};return _0x261217;}})});}_0x3c74b3=_[_0x1036('0x3f')]({},_0x3c74b3,_0x1e4228['options']);var _0x55a8da={'where':_0x3c74b3[_0x1036('0x3a')]};return db[_0x1036('0x2d')][_0x1036('0x40')](_0x55a8da)[_0x1036('0x24')](function(_0x5d2ca0){_0x1f58ba[_0x1036('0x40')]=_0x5d2ca0;if(_0x1e4228['query'][_0x1036('0x41')]){_0x3c74b3[_0x1036('0x42')]=[{'all':!![]}];}return db[_0x1036('0x2d')][_0x1036('0x43')](_0x3c74b3);})[_0x1036('0x24')](function(_0x38c6a1){_0x1f58ba['rows']=_0x38c6a1;return _0x1f58ba;})[_0x1036('0x24')](respondWithFilteredResult(_0x385057,_0x3c74b3))[_0x1036('0x44')](handleError(_0x385057,null));};exports[_0x1036('0x45')]=function(_0x202fd0,_0x313bca){var _0x372857={'raw':![],'where':{'id':_0x202fd0['params']['id']}},_0x36e689={};_0x36e689['model']=_[_0x1036('0x46')](db[_0x1036('0x2d')]['rawAttributes']);_0x36e689[_0x1036('0x31')]=_[_0x1036('0x46')](_0x202fd0[_0x1036('0x31')]);_0x36e689[_0x1036('0x32')]=_[_0x1036('0x33')](_0x36e689['model'],_0x36e689[_0x1036('0x31')]);_0x372857['attributes']=_[_0x1036('0x33')](_0x36e689[_0x1036('0x34')],qs['fields'](_0x202fd0[_0x1036('0x31')][_0x1036('0x35')]));_0x372857[_0x1036('0x36')]=_0x372857[_0x1036('0x36')][_0x1036('0x37')]?_0x372857['attributes']:_0x36e689[_0x1036('0x34')];if(_0x202fd0['query'][_0x1036('0x41')]){_0x372857['include']=[{'all':!![]}];}_0x372857=_['merge']({},_0x372857,_0x202fd0[_0x1036('0x47')]);return db['Dashboard']['find'](_0x372857)['then'](handleEntityNotFound(_0x313bca,null))[_0x1036('0x24')](respondWithResult(_0x313bca,null))[_0x1036('0x44')](handleError(_0x313bca,null));};exports[_0x1036('0x48')]=function(_0x1f9198,_0x9a6d00){return db[_0x1036('0x2d')][_0x1036('0x48')](_0x1f9198[_0x1036('0x49')],{})[_0x1036('0x24')](function(_0x2b13c5){var _0x187d55=_0x1f9198[_0x1036('0x4a')][_0x1036('0x26')]({'plain':!![]});if(!_0x187d55)throw new Error(_0x1036('0x4b'));if(_0x187d55[_0x1036('0x4c')]===_0x1036('0x4a')){var _0x4f36e3=_0x2b13c5[_0x1036('0x26')]({'plain':!![]});var _0x5cf6e7=_0x1036('0x27');return db[_0x1036('0x4d')][_0x1036('0x4e')]({'where':{'name':_0x5cf6e7,'userProfileId':_0x187d55[_0x1036('0x4f')]},'raw':!![]})[_0x1036('0x24')](function(_0x3cd948){if(_0x3cd948&&_0x3cd948['autoAssociation']===0x0){return db[_0x1036('0x28')]['create']({'name':_0x4f36e3['name'],'resourceId':_0x4f36e3['id'],'type':_0x3cd948[_0x1036('0x29')],'sectionId':_0x3cd948['id']},{})['then'](function(){return _0x2b13c5;});}else{return _0x2b13c5;}})[_0x1036('0x44')](function(_0x31c42a){logger[_0x1036('0x50')](_0x1036('0x51'),_0x31c42a);throw _0x31c42a;});}return _0x2b13c5;})[_0x1036('0x24')](respondWithResult(_0x9a6d00,0xc9))['catch'](handleError(_0x9a6d00,null));};exports[_0x1036('0x52')]=function(_0x320a22,_0x1f573a){var _0x3a9460={'where':{'id':_0x320a22['params']['id']}},_0x2b510a={};_0x2b510a['model']=_[_0x1036('0x46')](db[_0x1036('0x2d')][_0x1036('0x2e')]);_0x3a9460[_0x1036('0x36')]=_[_0x1036('0x33')](_0x2b510a[_0x1036('0x34')],qs['fields'](_0x320a22[_0x1036('0x31')][_0x1036('0x35')]));_0x3a9460[_0x1036('0x36')]=_0x3a9460[_0x1036('0x36')][_0x1036('0x37')]?_0x3a9460[_0x1036('0x36')]:_0x2b510a[_0x1036('0x34')];if(_0x320a22[_0x1036('0x31')][_0x1036('0x41')]){_0x3a9460['include']=[{'all':!![]}];}_0x3a9460=_[_0x1036('0x3f')]({},_0x3a9460,_0x320a22[_0x1036('0x47')]);return db[_0x1036('0x2d')][_0x1036('0x4e')](_0x3a9460)[_0x1036('0x24')](handleEntityNotFound(_0x1f573a,null))[_0x1036('0x24')](function(_0x45488c){if(_0x45488c){var _0x2bef60=_0x45488c['get']({'plain':!![]});_0x2bef60=qs['omit'](_0x2bef60,['id',_0x1036('0x53'),'updatedAt']);_0x320a22['body']=_[_0x1036('0x54')](_0x320a22[_0x1036('0x49')],['id','createdAt',_0x1036('0x55')]);return db[_0x1036('0x2d')][_0x1036('0x48')](_['merge'](_0x2bef60,_0x320a22[_0x1036('0x49')]),{'include':_0x320a22['query'][_0x1036('0x41')]?[{'all':!![]}]:undefined})[_0x1036('0x24')](function(_0x9f71d3){var _0xb9a230=_0x320a22[_0x1036('0x4a')][_0x1036('0x26')]({'plain':!![]});if(!_0xb9a230)throw new Error(_0x1036('0x4b'));if(_0xb9a230[_0x1036('0x4c')]==='user'){var _0x595b0f=_0x9f71d3[_0x1036('0x26')]({'plain':!![]});var _0x4371db=_0x1036('0x27');return db[_0x1036('0x4d')][_0x1036('0x4e')]({'where':{'name':_0x4371db,'userProfileId':_0xb9a230[_0x1036('0x4f')]},'raw':!![]})[_0x1036('0x24')](function(_0x4716ee){if(_0x4716ee&&_0x4716ee[_0x1036('0x56')]===0x0){return db[_0x1036('0x28')][_0x1036('0x48')]({'name':_0x595b0f[_0x1036('0x29')],'resourceId':_0x595b0f['id'],'type':_0x4716ee[_0x1036('0x29')],'sectionId':_0x4716ee['id']},{})['then'](function(){return _0x9f71d3;});}else{return _0x9f71d3;}})['catch'](function(_0xdb0fae){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdb0fae);throw _0xdb0fae;});}return _0x9f71d3;});}})[_0x1036('0x24')](respondWithResult(_0x1f573a,0xc9))[_0x1036('0x44')](handleError(_0x1f573a,null));};exports['update']=function(_0x116d1b,_0x1ff93e){if(_0x116d1b[_0x1036('0x49')]['id']){delete _0x116d1b[_0x1036('0x49')]['id'];}return db[_0x1036('0x2d')][_0x1036('0x4e')]({'where':{'id':_0x116d1b[_0x1036('0x57')]['id']}})[_0x1036('0x24')](handleEntityNotFound(_0x1ff93e,null))[_0x1036('0x24')](saveUpdates(_0x116d1b['body'],null))[_0x1036('0x24')](respondWithResult(_0x1ff93e,null))[_0x1036('0x44')](handleError(_0x1ff93e,null));};exports[_0x1036('0x25')]=function(_0x1f8a54,_0x418eaa){return db['Dashboard'][_0x1036('0x4e')]({'where':{'id':_0x1f8a54[_0x1036('0x57')]['id']}})[_0x1036('0x24')](handleEntityNotFound(_0x418eaa,null))['then'](removeEntity(_0x418eaa,null))[_0x1036('0x44')](handleError(_0x418eaa,null));};function widgetAttributes(_0x4517cf){try{switch(_0x4517cf[_0x1036('0x3d')]){case'iframe':return[{'name':_0x1036('0x58'),'value':_0x4517cf['attrUrl']||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf[_0x1036('0x59')][0x0]?_0x4517cf[_0x1036('0x59')][0x0][_0x1036('0x5a')]:undefined)||_0x1036('0x5b')}];case _0x1036('0x5c'):return[{'name':'attrPath','value':_0x4517cf['attrPath']||(_0x4517cf['attrs']&&_0x4517cf[_0x1036('0x59')][0x0]?_0x4517cf[_0x1036('0x59')][0x0][_0x1036('0x5a')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x4517cf[_0x1036('0x5d')]||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf[_0x1036('0x59')][0x0]?_0x4517cf['attrs'][0x0][_0x1036('0x5a')]:undefined)||_0x1036('0x5e')},{'name':_0x1036('0x5f'),'value':_0x4517cf[_0x1036('0x5f')]||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf[_0x1036('0x59')][0x1]?_0x4517cf[_0x1036('0x59')][0x1][_0x1036('0x5a')]:undefined)||_0x1036('0x60')},{'name':_0x1036('0x61'),'value':_0x4517cf[_0x1036('0x61')]||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf[_0x1036('0x59')][0x2]?_0x4517cf[_0x1036('0x59')][0x2][_0x1036('0x5a')]:undefined)||0xc}];case'counter':return[{'name':_0x1036('0x62'),'value':_0x4517cf[_0x1036('0x62')]||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf[_0x1036('0x59')][0x0]?_0x4517cf[_0x1036('0x59')][0x0][_0x1036('0x5a')]:undefined)||_0x1036('0x63')},{'name':_0x1036('0x64'),'value':_0x4517cf[_0x1036('0x64')]||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf[_0x1036('0x59')][0x1]?_0x4517cf[_0x1036('0x59')][0x1]['value']:undefined)||[]},{'name':_0x1036('0x61'),'value':_0x4517cf[_0x1036('0x61')]||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf[_0x1036('0x59')][0x2]?_0x4517cf['attrs'][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x4517cf[_0x1036('0x65')]||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf[_0x1036('0x59')][0x3]?_0x4517cf[_0x1036('0x59')][0x3][_0x1036('0x5a')]:undefined)||_0x1036('0x66')},{'name':'attrEmailAccounts','value':_0x4517cf['attrEmailAccounts']||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf[_0x1036('0x59')][0x4]?_0x4517cf[_0x1036('0x59')][0x4][_0x1036('0x5a')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x4517cf[_0x1036('0x67')]||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf['attrs'][0x5]?_0x4517cf['attrs'][0x5][_0x1036('0x5a')]:undefined)||''},{'name':_0x1036('0x68'),'value':_0x4517cf['attrSmsAccounts']||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf[_0x1036('0x59')][0x6]?_0x4517cf[_0x1036('0x59')][0x6][_0x1036('0x5a')]:undefined)||''},{'name':_0x1036('0x69'),'value':_0x4517cf[_0x1036('0x69')]||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf[_0x1036('0x59')][0x7]?_0x4517cf[_0x1036('0x59')][0x7][_0x1036('0x5a')]:undefined)||''},{'name':_0x1036('0x6a'),'value':_0x4517cf['attrWhatsappAccounts']||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf[_0x1036('0x59')][0x8]?_0x4517cf[_0x1036('0x59')][0x8][_0x1036('0x5a')]:undefined)||''},{'name':'attrChatWebsites','value':_0x4517cf[_0x1036('0x6b')]||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf[_0x1036('0x59')][0x9]?_0x4517cf[_0x1036('0x59')][0x9]['value']:undefined)||''}];case _0x1036('0x6c'):case _0x1036('0x6d'):return[{'name':'attrSerie1','value':_0x4517cf[_0x1036('0x6e')]||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf['attrs'][0x0]?_0x4517cf[_0x1036('0x59')][0x0][_0x1036('0x5a')]:undefined)||_0x1036('0x63')},{'name':_0x1036('0x6f'),'value':_0x4517cf['attrSerie2']||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf[_0x1036('0x59')][0x1]?_0x4517cf[_0x1036('0x59')][0x1][_0x1036('0x5a')]:undefined)||null},{'name':_0x1036('0x70'),'value':_0x4517cf[_0x1036('0x70')]||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf[_0x1036('0x59')][0x2]?_0x4517cf['attrs'][0x2]['value']:undefined)||null},{'name':_0x1036('0x64'),'value':_0x4517cf['attrVoiceQueues']||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf[_0x1036('0x59')][0x3]?_0x4517cf[_0x1036('0x59')][0x3][_0x1036('0x5a')]:undefined)||[]},{'name':_0x1036('0x65'),'value':_0x4517cf[_0x1036('0x65')]||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf[_0x1036('0x59')][0x4]?_0x4517cf[_0x1036('0x59')][0x4]['value']:undefined)||'voice'},{'name':_0x1036('0x71'),'value':_0x4517cf[_0x1036('0x71')]||(_0x4517cf['attrs']&&_0x4517cf['attrs'][0x5]?_0x4517cf['attrs'][0x5][_0x1036('0x5a')]:undefined)||''},{'name':_0x1036('0x67'),'value':_0x4517cf[_0x1036('0x67')]||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf['attrs'][0x6]?_0x4517cf[_0x1036('0x59')][0x6][_0x1036('0x5a')]:undefined)||''},{'name':_0x1036('0x68'),'value':_0x4517cf[_0x1036('0x68')]||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf['attrs'][0x7]?_0x4517cf[_0x1036('0x59')][0x7][_0x1036('0x5a')]:undefined)||''},{'name':_0x1036('0x69'),'value':_0x4517cf[_0x1036('0x69')]||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf[_0x1036('0x59')][0x8]?_0x4517cf[_0x1036('0x59')][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4517cf[_0x1036('0x6a')]||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf[_0x1036('0x59')][0x9]?_0x4517cf[_0x1036('0x59')][0x9][_0x1036('0x5a')]:undefined)||''},{'name':'attrChatWebsites','value':_0x4517cf[_0x1036('0x6b')]||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf[_0x1036('0x59')][0xa]?_0x4517cf['attrs'][0xa][_0x1036('0x5a')]:undefined)||''}];case _0x1036('0x72'):return[{'name':_0x1036('0x73'),'type':_0x4517cf[_0x1036('0x74')]||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf[_0x1036('0x59')][0x0]?_0x4517cf['attrs'][0x0][_0x1036('0x3d')]:undefined)||null,'value':_0x4517cf[_0x1036('0x73')]||(_0x4517cf[_0x1036('0x59')]&&_0x4517cf[_0x1036('0x59')][0x0]?_0x4517cf[_0x1036('0x59')][0x0]['value']:undefined)||null},{'name':_0x1036('0x75'),'value':_0x4517cf[_0x1036('0x75')]||(_0x4517cf['attrs']&&_0x4517cf[_0x1036('0x59')][0x1]?_0x4517cf[_0x1036('0x59')][0x1][_0x1036('0x5a')]:undefined)||0x0}];default:return[];}}catch(_0x3d603b){logger[_0x1036('0x50')](_0x1036('0x76'),JSON[_0x1036('0x77')](_0x3d603b));return[];}}exports['addItem']=function(_0x1d5aaa,_0x512b2f,_0x2d7d93){if(_0x1d5aaa[_0x1036('0x49')]['id']){delete _0x1d5aaa[_0x1036('0x49')]['id'];}return db[_0x1036('0x2d')]['find']({'where':{'id':_0x1d5aaa[_0x1036('0x57')]['id']}})[_0x1036('0x24')](handleEntityNotFound(_0x512b2f,null))['then'](function(_0x5abfd8){if(_0x5abfd8){_0x1d5aaa['body']['DashboardId']=_0x5abfd8['id'];_0x1d5aaa[_0x1036('0x49')][_0x1036('0x59')]=widgetAttributes(_0x1d5aaa[_0x1036('0x49')]);return db[_0x1036('0x78')][_0x1036('0x48')](_0x1d5aaa['body']);}})['then'](respondWithResult(_0x512b2f,null))[_0x1036('0x44')](handleError(_0x512b2f,null));};exports[_0x1036('0x79')]=function(_0x210166,_0x3fe3ad,_0x155a29){var _0x31de10={};var _0x24d9f5={};var _0x54f213;var _0x4cd3c5;return db[_0x1036('0x2d')][_0x1036('0x7a')]({'where':{'id':_0x210166[_0x1036('0x57')]['id']}})[_0x1036('0x24')](handleEntityNotFound(_0x3fe3ad,null))[_0x1036('0x24')](function(_0x104746){if(_0x104746){_0x54f213=_0x104746;_0x24d9f5[_0x1036('0x34')]=_[_0x1036('0x46')](db[_0x1036('0x78')][_0x1036('0x2e')]);_0x24d9f5['query']=_[_0x1036('0x46')](_0x210166[_0x1036('0x31')]);_0x24d9f5[_0x1036('0x32')]=_[_0x1036('0x33')](_0x24d9f5[_0x1036('0x34')],_0x24d9f5[_0x1036('0x31')]);_0x31de10[_0x1036('0x36')]=_[_0x1036('0x33')](_0x24d9f5[_0x1036('0x34')],qs[_0x1036('0x35')](_0x210166['query'][_0x1036('0x35')]));_0x31de10[_0x1036('0x36')]=_0x31de10[_0x1036('0x36')]['length']?_0x31de10[_0x1036('0x36')]:_0x24d9f5[_0x1036('0x34')];_0x31de10[_0x1036('0x7b')]=qs[_0x1036('0x39')](_0x210166[_0x1036('0x31')][_0x1036('0x39')]);_0x31de10[_0x1036('0x3a')]=qs[_0x1036('0x32')](_[_0x1036('0x3b')](_0x210166[_0x1036('0x31')],_0x24d9f5[_0x1036('0x32')]));if(_0x210166[_0x1036('0x31')][_0x1036('0x3c')]){_0x31de10[_0x1036('0x3a')]=_[_0x1036('0x3f')](_0x31de10[_0x1036('0x3a')],{'$or':_[_0x1036('0x2c')](_0x31de10[_0x1036('0x36')],function(_0x30454f){var _0x1c364e={};_0x1c364e[_0x30454f]={'$like':'%'+_0x210166[_0x1036('0x31')][_0x1036('0x3c')]+'%'};return _0x1c364e;})});}_0x31de10=_[_0x1036('0x3f')]({},_0x31de10,_0x210166[_0x1036('0x47')]);return _0x54f213['getItems'](_0x31de10);}})[_0x1036('0x24')](function(_0x5120ee){if(_0x5120ee){_0x4cd3c5=_0x5120ee[_0x1036('0x37')];if(!_0x210166[_0x1036('0x31')][_0x1036('0x38')](_0x1036('0x7c'))){_0x31de10[_0x1036('0x1d')]=qs[_0x1036('0x1d')](_0x210166[_0x1036('0x31')][_0x1036('0x1d')]);_0x31de10[_0x1036('0x1c')]=qs[_0x1036('0x1c')](_0x210166['query'][_0x1036('0x1c')]);}return _0x54f213[_0x1036('0x79')](_0x31de10);}})[_0x1036('0x24')](function(_0x8b6170){if(_0x8b6170){return _0x8b6170?{'count':_0x4cd3c5,'rows':_0x8b6170}:null;}})['then'](respondWithResult(_0x3fe3ad,null))[_0x1036('0x44')](handleError(_0x3fe3ad,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 375d3d7..9750ac1 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 _0x1e8e=['hasOwnProperty','events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit'];(function(_0x3b26af,_0x13e70a){var _0x43fe5d=function(_0x1b839d){while(--_0x1b839d){_0x3b26af['push'](_0x3b26af['shift']());}};_0x43fe5d(++_0x13e70a);}(_0x1e8e,0xeb));var _0xe1e8=function(_0x409012,_0x5bfea2){_0x409012=_0x409012-0x0;var _0x3ac007=_0x1e8e[_0x409012];return _0x3ac007;};'use strict';var EventEmitter=require(_0xe1e8('0x0'));var Dashboard=require(_0xe1e8('0x1'))['db'][_0xe1e8('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xe1e8('0x3')](0x0);var events={'afterCreate':_0xe1e8('0x4'),'afterUpdate':_0xe1e8('0x5'),'afterDestroy':_0xe1e8('0x6')};function emitEvent(_0xcdc654){return function(_0x347bd9,_0x4d9a2e,_0x5d60a0){DashboardEvents[_0xe1e8('0x7')](_0xcdc654+':'+_0x347bd9['id'],_0x347bd9);DashboardEvents[_0xe1e8('0x7')](_0xcdc654,_0x347bd9);_0x5d60a0(null);};}for(var e in events){if(events[_0xe1e8('0x8')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x6b01=['exports','../../mysqldb','Dashboard','remove','emit','hasOwnProperty'];(function(_0x55c455,_0x51a460){var _0x4dcd62=function(_0x2127dc){while(--_0x2127dc){_0x55c455['push'](_0x55c455['shift']());}};_0x4dcd62(++_0x51a460);}(_0x6b01,0x109));var _0x16b0=function(_0x573ace,_0x5f5c56){_0x573ace=_0x573ace-0x0;var _0x6059c1=_0x6b01[_0x573ace];return _0x6059c1;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x16b0('0x0'))['db'][_0x16b0('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x16b0('0x2')};function emitEvent(_0x5cbc8a){return function(_0x1442c0,_0x371e6a,_0x26b242){DashboardEvents[_0x16b0('0x3')](_0x5cbc8a+':'+_0x1442c0['id'],_0x1442c0);DashboardEvents[_0x16b0('0x3')](_0x5cbc8a,_0x1442c0);_0x26b242(null);};}for(var e in events){if(events[_0x16b0('0x4')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x16b0('0x5')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 7e9a6f8..6b70e90 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 _0x9b6c=['dashboards','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports'];(function(_0x153c40,_0x29ca39){var _0x28b579=function(_0x47ca22){while(--_0x47ca22){_0x153c40['push'](_0x153c40['shift']());}};_0x28b579(++_0x29ca39);}(_0x9b6c,0x135));var _0xc9b6=function(_0x253c9c,_0x5ee6b7){_0x253c9c=_0x253c9c-0x0;var _0x5b5e2f=_0x9b6c[_0x253c9c];return _0x5b5e2f;};'use strict';var _=require(_0xc9b6('0x0'));var util=require(_0xc9b6('0x1'));var logger=require('../../config/logger')(_0xc9b6('0x2'));var moment=require(_0xc9b6('0x3'));var BPromise=require(_0xc9b6('0x4'));var rp=require(_0xc9b6('0x5'));var fs=require('fs');var path=require(_0xc9b6('0x6'));var rimraf=require('rimraf');var config=require(_0xc9b6('0x7'));var attributes=require(_0xc9b6('0x8'));module[_0xc9b6('0x9')]=function(_0x5bd95f,_0x5db66b){return _0x5bd95f['define']('Dashboard',attributes,{'tableName':_0xc9b6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65bd=['api','moment','bluebird','path','rimraf','../../config/environment','exports','define','Dashboard','lodash'];(function(_0x410c92,_0x385255){var _0x6323cb=function(_0x43d881){while(--_0x43d881){_0x410c92['push'](_0x410c92['shift']());}};_0x6323cb(++_0x385255);}(_0x65bd,0xb3));var _0xd65b=function(_0x392f72,_0x3fb45e){_0x392f72=_0x392f72-0x0;var _0x1538d1=_0x65bd[_0x392f72];return _0x1538d1;};'use strict';var _=require(_0xd65b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd65b('0x1'));var moment=require(_0xd65b('0x2'));var BPromise=require(_0xd65b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd65b('0x4'));var rimraf=require(_0xd65b('0x5'));var config=require(_0xd65b('0x6'));var attributes=require('./dashboard.attributes');module[_0xd65b('0x7')]=function(_0x224e76,_0x187e5b){return _0x224e76[_0xd65b('0x8')](_0xd65b('0x9'),attributes,{'tableName':'dashboards','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 7cd0680..ef88d62 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 _0x54d2=['then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','./dashboard.socket','register','request'];(function(_0x206f4b,_0x346117){var _0x20599c=function(_0x2f15b3){while(--_0x2f15b3){_0x206f4b['push'](_0x206f4b['shift']());}};_0x20599c(++_0x346117);}(_0x54d2,0x1de));var _0x254d=function(_0x4efc59,_0x33de52){_0x4efc59=_0x4efc59-0x0;var _0x351a49=_0x54d2[_0x4efc59];return _0x351a49;};'use strict';var _=require('lodash');var util=require(_0x254d('0x0'));var moment=require(_0x254d('0x1'));var BPromise=require(_0x254d('0x2'));var rs=require(_0x254d('0x3'));var fs=require('fs');var Redis=require(_0x254d('0x4'));var db=require(_0x254d('0x5'))['db'];var utils=require(_0x254d('0x6'));var logger=require('../../config/logger')(_0x254d('0x7'));var config=require(_0x254d('0x8'));var jayson=require(_0x254d('0x9'));var client=jayson[_0x254d('0xa')]['http']({'port':0x232a});config[_0x254d('0xb')]=_[_0x254d('0xc')](config[_0x254d('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x254d('0xb')]));require(_0x254d('0xd'))[_0x254d('0xe')](socket);function respondWithRpcPromise(_0x251a3b,_0x851add,_0x2b1a32){return new BPromise(function(_0x4afcad,_0x490c44){return client[_0x254d('0xf')](_0x251a3b,_0x2b1a32)[_0x254d('0x10')](function(_0x3fd69e){logger[_0x254d('0x11')](_0x254d('0x12'),_0x851add,_0x254d('0x13'));logger[_0x254d('0x14')](_0x254d('0x15'),_0x851add,_0x254d('0x13'),JSON[_0x254d('0x16')](_0x3fd69e));if(_0x3fd69e[_0x254d('0x17')]){if(_0x3fd69e[_0x254d('0x17')]['code']===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x851add,_0x3fd69e['error'][_0x254d('0x18')]);return _0x490c44(_0x3fd69e[_0x254d('0x17')][_0x254d('0x18')]);}logger[_0x254d('0x17')]('Dashboard,\x20%s,\x20%s',_0x851add,_0x3fd69e['error'][_0x254d('0x18')]);return _0x4afcad(_0x3fd69e[_0x254d('0x17')]['message']);}else{logger[_0x254d('0x11')](_0x254d('0x12'),_0x851add,'request\x20sent');_0x4afcad(_0x3fd69e[_0x254d('0x19')][_0x254d('0x18')]);}})['catch'](function(_0xaebed2){logger[_0x254d('0x17')](_0x254d('0x12'),_0x851add,_0xaebed2);_0x490c44(_0xaebed2);});});} \ No newline at end of file +var _0x61db=['defaults','redis','./dashboard.socket','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x594a9e,_0x45c30e){var _0x2baf96=function(_0x5b8982){while(--_0x5b8982){_0x594a9e['push'](_0x594a9e['shift']());}};_0x2baf96(++_0x45c30e);}(_0x61db,0x198));var _0xb61d=function(_0x86de53,_0x2a2bd9){_0x86de53=_0x86de53-0x0;var _0x573f28=_0x61db[_0x86de53];return _0x573f28;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb61d('0x0'));var BPromise=require(_0xb61d('0x1'));var rs=require(_0xb61d('0x2'));var fs=require('fs');var Redis=require(_0xb61d('0x3'));var db=require(_0xb61d('0x4'))['db'];var utils=require(_0xb61d('0x5'));var logger=require(_0xb61d('0x6'))('rpc');var config=require(_0xb61d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb61d('0x8')][_0xb61d('0x9')]({'port':0x232a});config['redis']=_[_0xb61d('0xa')](config[_0xb61d('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb61d('0xb')]));require(_0xb61d('0xc'))['register'](socket);function respondWithRpcPromise(_0x6102ce,_0x2885cc,_0xfb0511){return new BPromise(function(_0x3de4cd,_0x5e6a28){return client['request'](_0x6102ce,_0xfb0511)['then'](function(_0x3fc76f){logger[_0xb61d('0xd')](_0xb61d('0xe'),_0x2885cc,_0xb61d('0xf'));logger['debug'](_0xb61d('0x10'),_0x2885cc,_0xb61d('0xf'),JSON[_0xb61d('0x11')](_0x3fc76f));if(_0x3fc76f[_0xb61d('0x12')]){if(_0x3fc76f[_0xb61d('0x12')][_0xb61d('0x13')]===0x1f4){logger[_0xb61d('0x12')]('Dashboard,\x20%s,\x20%s',_0x2885cc,_0x3fc76f[_0xb61d('0x12')][_0xb61d('0x14')]);return _0x5e6a28(_0x3fc76f[_0xb61d('0x12')][_0xb61d('0x14')]);}logger[_0xb61d('0x12')]('Dashboard,\x20%s,\x20%s',_0x2885cc,_0x3fc76f[_0xb61d('0x12')][_0xb61d('0x14')]);return _0x3de4cd(_0x3fc76f[_0xb61d('0x12')]['message']);}else{logger[_0xb61d('0xd')](_0xb61d('0xe'),_0x2885cc,_0xb61d('0xf'));_0x3de4cd(_0x3fc76f['result']['message']);}})[_0xb61d('0x15')](function(_0x14553a){logger[_0xb61d('0x12')](_0xb61d('0xe'),_0x2885cc,_0x14553a);_0x5e6a28(_0x14553a);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index a04ae27..dc516ee 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 _0x2af3=['./dashboard.events','save','remove','update','emit','register','length','dashboard:'];(function(_0x1dc9ae,_0x42127b){var _0x2789f1=function(_0x3e3b71){while(--_0x3e3b71){_0x1dc9ae['push'](_0x1dc9ae['shift']());}};_0x2789f1(++_0x42127b);}(_0x2af3,0x160));var _0x32af=function(_0x2ffdee,_0x42beea){_0x2ffdee=_0x2ffdee-0x0;var _0x5561b9=_0x2af3[_0x2ffdee];return _0x5561b9;};'use strict';var DashboardEvents=require(_0x32af('0x0'));var events=[_0x32af('0x1'),_0x32af('0x2'),_0x32af('0x3')];function createListener(_0x2ede1b,_0x10f496){return function(_0x4c7cf0){_0x10f496[_0x32af('0x4')](_0x2ede1b,_0x4c7cf0);};}function removeListener(_0x412997,_0x178569){return function(){DashboardEvents['removeListener'](_0x412997,_0x178569);};}exports[_0x32af('0x5')]=function(_0x19a9e8){for(var _0x4eeb2b=0x0,_0xee01c6=events[_0x32af('0x6')];_0x4eeb2b<_0xee01c6;_0x4eeb2b++){var _0xb3d2e0=events[_0x4eeb2b];var _0xb725ce=createListener(_0x32af('0x7')+_0xb3d2e0,_0x19a9e8);DashboardEvents['on'](_0xb3d2e0,_0xb725ce);}}; \ No newline at end of file +var _0x6d0c=['remove','update','removeListener','register','length','dashboard:','./dashboard.events','save'];(function(_0x57b4ff,_0x3f3be0){var _0x28642e=function(_0x9a5198){while(--_0x9a5198){_0x57b4ff['push'](_0x57b4ff['shift']());}};_0x28642e(++_0x3f3be0);}(_0x6d0c,0x146));var _0xc6d0=function(_0x50000b,_0x201785){_0x50000b=_0x50000b-0x0;var _0x47124b=_0x6d0c[_0x50000b];return _0x47124b;};'use strict';var DashboardEvents=require(_0xc6d0('0x0'));var events=[_0xc6d0('0x1'),_0xc6d0('0x2'),_0xc6d0('0x3')];function createListener(_0x48ee74,_0x4a52c0){return function(_0x2b062b){_0x4a52c0['emit'](_0x48ee74,_0x2b062b);};}function removeListener(_0x4f0594,_0x2a6384){return function(){DashboardEvents[_0xc6d0('0x4')](_0x4f0594,_0x2a6384);};}exports[_0xc6d0('0x5')]=function(_0x14700c){for(var _0x18a8fd=0x0,_0x11f2c6=events[_0xc6d0('0x6')];_0x18a8fd<_0x11f2c6;_0x18a8fd++){var _0x56140a=events[_0x18a8fd];var _0x30e1e4=createListener(_0xc6d0('0x7')+_0x56140a,_0x14700c);DashboardEvents['on'](_0x56140a,_0x30e1e4);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index b1b4f75..3b3b3c6 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 _0xbe2c=['update','delete','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','isAuthenticated','index','get','/:id','/:id/items','post','create','/:id/clone','clone','addItem','put'];(function(_0x56cc28,_0x4a921e){var _0x1f5798=function(_0x45f7a5){while(--_0x45f7a5){_0x56cc28['push'](_0x56cc28['shift']());}};_0x1f5798(++_0x4a921e);}(_0xbe2c,0x1e6));var _0xcbe2=function(_0x54add2,_0x879789){_0x54add2=_0x54add2-0x0;var _0x178bda=_0xbe2c[_0x54add2];return _0x178bda;};'use strict';var multer=require('multer');var util=require(_0xcbe2('0x0'));var path=require(_0xcbe2('0x1'));var timeout=require(_0xcbe2('0x2'));var express=require(_0xcbe2('0x3'));var router=express['Router']();var fs_extra=require(_0xcbe2('0x4'));var auth=require(_0xcbe2('0x5'));var interaction=require(_0xcbe2('0x6'));var config=require(_0xcbe2('0x7'));var controller=require(_0xcbe2('0x8'));router['get']('/',auth[_0xcbe2('0x9')](),controller[_0xcbe2('0xa')]);router[_0xcbe2('0xb')](_0xcbe2('0xc'),auth[_0xcbe2('0x9')](),controller['show']);router[_0xcbe2('0xb')](_0xcbe2('0xd'),auth[_0xcbe2('0x9')](),controller['getItems']);router[_0xcbe2('0xe')]('/',auth[_0xcbe2('0x9')](),controller[_0xcbe2('0xf')]);router['post'](_0xcbe2('0x10'),auth[_0xcbe2('0x9')](),controller[_0xcbe2('0x11')]);router[_0xcbe2('0xe')](_0xcbe2('0xd'),auth['isAuthenticated'](),controller[_0xcbe2('0x12')]);router[_0xcbe2('0x13')]('/:id',auth[_0xcbe2('0x9')](),controller[_0xcbe2('0x14')]);router[_0xcbe2('0x15')](_0xcbe2('0xc'),auth[_0xcbe2('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x19fc=['path','connect-timeout','express','Router','fs-extra','../../config/environment','./dashboard.controller','index','/:id','isAuthenticated','show','get','create','/:id/clone','clone','post','put','update','destroy','exports','multer','util'];(function(_0x297d73,_0x195b49){var _0x6849dc=function(_0x26890b){while(--_0x26890b){_0x297d73['push'](_0x297d73['shift']());}};_0x6849dc(++_0x195b49);}(_0x19fc,0xf0));var _0xc19f=function(_0x1b6563,_0x3bf0f1){_0x1b6563=_0x1b6563-0x0;var _0xdea7b8=_0x19fc[_0x1b6563];return _0xdea7b8;};'use strict';var multer=require(_0xc19f('0x0'));var util=require(_0xc19f('0x1'));var path=require(_0xc19f('0x2'));var timeout=require(_0xc19f('0x3'));var express=require(_0xc19f('0x4'));var router=express[_0xc19f('0x5')]();var fs_extra=require(_0xc19f('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc19f('0x7'));var controller=require(_0xc19f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xc19f('0x9')]);router['get'](_0xc19f('0xa'),auth[_0xc19f('0xb')](),controller[_0xc19f('0xc')]);router[_0xc19f('0xd')]('/:id/items',auth[_0xc19f('0xb')](),controller['getItems']);router['post']('/',auth[_0xc19f('0xb')](),controller[_0xc19f('0xe')]);router['post'](_0xc19f('0xf'),auth[_0xc19f('0xb')](),controller[_0xc19f('0x10')]);router[_0xc19f('0x11')]('/:id/items',auth[_0xc19f('0xb')](),controller['addItem']);router[_0xc19f('0x12')]('/:id',auth[_0xc19f('0xb')](),controller[_0xc19f('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc19f('0x14')]);module[_0xc19f('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 6b4dbe1..d16ffaf 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 _0x2eb2=['STRING','TEXT','parse','setDataValue','attrs','stringify','INTEGER','#2196f3','squel','lodash','exports'];(function(_0x257e22,_0x517acf){var _0x195f6e=function(_0x5a47d7){while(--_0x5a47d7){_0x257e22['push'](_0x257e22['shift']());}};_0x195f6e(++_0x517acf);}(_0x2eb2,0x19f));var _0x22eb=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x2eb2[_0x5e36d1];return _0x950b9e;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x22eb('0x0'));var _=require(_0x22eb('0x1'));module[_0x22eb('0x2')]={'title':{'type':Sequelize[_0x22eb('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x22eb('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x22eb('0x4')]('long'),'get':function(){try{return JSON[_0x22eb('0x5')](this['getDataValue']('attrs'));}catch(_0x1dfef7){return[];}},'set':function(_0x10e116){try{this[_0x22eb('0x6')](_0x22eb('0x7'),JSON[_0x22eb('0x8')](_0x10e116));}catch(_0x396806){this[_0x22eb('0x6')](_0x22eb('0x7'),JSON[_0x22eb('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x22eb('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x22eb('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x22eb('0x9')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x22eb('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x22eb('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x22eb('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0xabce=['squel','lodash','exports','STRING','long','parse','getDataValue','attrs','setDataValue','INTEGER','#ffffff','#2196f3','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabce,0x103));var _0xeabc=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xabce[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require(_0xeabc('0x0'));var squel=require(_0xeabc('0x1'));var _=require(_0xeabc('0x2'));module[_0xeabc('0x3')]={'title':{'type':Sequelize[_0xeabc('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xeabc('0x5')),'get':function(){try{return JSON[_0xeabc('0x6')](this[_0xeabc('0x7')]('attrs'));}catch(_0x54e4a8){return[];}},'set':function(_0x1b07a8){try{this['setDataValue'](_0xeabc('0x8'),JSON['stringify'](_0x1b07a8));}catch(_0x3bdc29){this[_0xeabc('0x9')](_0xeabc('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xeabc('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xeabc('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xeabc('0xa')]},'col':{'type':Sequelize[_0xeabc('0xa')]},'background':{'type':Sequelize[_0xeabc('0x4')],'allowNull':![],'defaultValue':_0xeabc('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xeabc('0x4')],'allowNull':![],'defaultValue':_0xeabc('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xeabc('0x4')]},'titleFontSize':{'type':Sequelize[_0xeabc('0xa')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index fad88fa..a189dc0 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 _0xbe52=['sendStatus','error','name','send','show','params','model','DashboardItem','rawAttributes','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','options','catch','find','type','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrEmailAccounts','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./dashboardItem.socket','register','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x4b6133,_0x37cce8){var _0x4185fb=function(_0x45bdfd){while(--_0x45bdfd){_0x4b6133['push'](_0x4b6133['shift']());}};_0x4185fb(++_0x37cce8);}(_0xbe52,0x164));var _0x2be5=function(_0x49b47a,_0x4ee998){_0x49b47a=_0x49b47a-0x0;var _0x30a84a=_0xbe52[_0x49b47a];return _0x30a84a;};'use strict';var emlformat=require(_0x2be5('0x0'));var rimraf=require(_0x2be5('0x1'));var zipdir=require(_0x2be5('0x2'));var jsonpatch=require(_0x2be5('0x3'));var rp=require(_0x2be5('0x4'));var moment=require('moment');var BPromise=require(_0x2be5('0x5'));var Mustache=require(_0x2be5('0x6'));var util=require(_0x2be5('0x7'));var path=require(_0x2be5('0x8'));var sox=require(_0x2be5('0x9'));var csv=require(_0x2be5('0xa'));var ejs=require(_0x2be5('0xb'));var fs=require('fs');var fs_extra=require(_0x2be5('0xc'));var _=require(_0x2be5('0xd'));var squel=require(_0x2be5('0xe'));var crypto=require(_0x2be5('0xf'));var jsforce=require(_0x2be5('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x2be5('0xa'));var querystring=require(_0x2be5('0x11'));var Papa=require(_0x2be5('0x12'));var Redis=require('ioredis');var authService=require(_0x2be5('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2be5('0x14'));var logger=require(_0x2be5('0x15'))(_0x2be5('0x16'));var utils=require(_0x2be5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2be5('0x18'));var db=require(_0x2be5('0x19'))['db'];config['redis']=_['defaults'](config[_0x2be5('0x1a')],{'host':_0x2be5('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2be5('0x1a')]));require(_0x2be5('0x1c'))[_0x2be5('0x1d')](socket);function respondWithStatusCode(_0x71834e,_0x38fc4b){_0x38fc4b=_0x38fc4b||0xcc;return function(_0x17737d){if(_0x17737d){return _0x71834e['sendStatus'](_0x38fc4b);}return _0x71834e['status'](_0x38fc4b)[_0x2be5('0x1e')]();};}function respondWithResult(_0x5e6f16,_0x1ae512){_0x1ae512=_0x1ae512||0xc8;return function(_0x577ca4){if(_0x577ca4){return _0x5e6f16[_0x2be5('0x1f')](_0x1ae512)[_0x2be5('0x20')](_0x577ca4);}};}function respondWithFilteredResult(_0x35db37,_0x5c6a02){return function(_0x8ea605){if(_0x8ea605){var _0x32fe0d=typeof _0x5c6a02['offset']===_0x2be5('0x21')&&typeof _0x5c6a02[_0x2be5('0x22')]===_0x2be5('0x21');var _0x1bffbf=_0x8ea605[_0x2be5('0x23')];var _0x22d7c2=_0x32fe0d?0x0:_0x5c6a02[_0x2be5('0x24')];var _0x53749d=_0x32fe0d?_0x8ea605['count']:_0x5c6a02[_0x2be5('0x24')]+_0x5c6a02[_0x2be5('0x22')];var _0x1bafd2;if(_0x53749d>=_0x1bffbf){_0x53749d=_0x1bffbf;_0x1bafd2=0xc8;}else{_0x1bafd2=0xce;}_0x35db37[_0x2be5('0x1f')](_0x1bafd2);return _0x35db37['set'](_0x2be5('0x25'),_0x22d7c2+'-'+_0x53749d+'/'+_0x1bffbf)[_0x2be5('0x20')](_0x8ea605);}return null;};}function patchUpdates(_0x2bbe9f){return function(_0x1f6c50){try{jsonpatch[_0x2be5('0x26')](_0x1f6c50,_0x2bbe9f,!![]);}catch(_0x3f78d4){return BPromise[_0x2be5('0x27')](_0x3f78d4);}return _0x1f6c50[_0x2be5('0x28')]();};}function saveUpdates(_0x3f4430,_0x3e63ab){return function(_0x5e9cb0){if(_0x5e9cb0){return _0x5e9cb0[_0x2be5('0x29')](_0x3f4430)[_0x2be5('0x2a')](function(_0x323c2d){return _0x323c2d;});}return null;};}function removeEntity(_0x4d3aee,_0x25c47c){return function(_0x319ed6){if(_0x319ed6){return _0x319ed6[_0x2be5('0x2b')]()[_0x2be5('0x2a')](function(){_0x4d3aee[_0x2be5('0x1f')](0xcc)[_0x2be5('0x1e')]();});}};}function handleEntityNotFound(_0x4bdbad,_0x228edd){return function(_0x1cfbd7){if(!_0x1cfbd7){_0x4bdbad[_0x2be5('0x2c')](0x194);}return _0x1cfbd7;};}function handleError(_0x329928,_0xa83c58){_0xa83c58=_0xa83c58||0x1f4;return function(_0x28c6bb){logger[_0x2be5('0x2d')](_0x28c6bb['stack']);if(_0x28c6bb[_0x2be5('0x2e')]){delete _0x28c6bb[_0x2be5('0x2e')];}_0x329928[_0x2be5('0x1f')](_0xa83c58)[_0x2be5('0x2f')](_0x28c6bb);};}exports[_0x2be5('0x30')]=function(_0x3817a7,_0x16afa0){var _0x4ca5a2={'raw':![],'where':{'id':_0x3817a7[_0x2be5('0x31')]['id']}},_0xf58441={};_0xf58441[_0x2be5('0x32')]=_['keys'](db[_0x2be5('0x33')][_0x2be5('0x34')]);_0xf58441['query']=_[_0x2be5('0x35')](_0x3817a7[_0x2be5('0x36')]);_0xf58441[_0x2be5('0x37')]=_[_0x2be5('0x38')](_0xf58441['model'],_0xf58441[_0x2be5('0x36')]);_0x4ca5a2[_0x2be5('0x39')]=_[_0x2be5('0x38')](_0xf58441['model'],qs['fields'](_0x3817a7[_0x2be5('0x36')][_0x2be5('0x3a')]));_0x4ca5a2[_0x2be5('0x39')]=_0x4ca5a2[_0x2be5('0x39')][_0x2be5('0x3b')]?_0x4ca5a2[_0x2be5('0x39')]:_0xf58441['model'];if(_0x3817a7[_0x2be5('0x36')][_0x2be5('0x3c')]){_0x4ca5a2['include']=[{'all':!![]}];}_0x4ca5a2=_[_0x2be5('0x3d')]({},_0x4ca5a2,_0x3817a7[_0x2be5('0x3e')]);return db[_0x2be5('0x33')]['find'](_0x4ca5a2)['then'](handleEntityNotFound(_0x16afa0,null))[_0x2be5('0x2a')](respondWithResult(_0x16afa0,null))[_0x2be5('0x3f')](handleError(_0x16afa0,null));};exports[_0x2be5('0x2b')]=function(_0x1644be,_0x470f1d){return db[_0x2be5('0x33')][_0x2be5('0x40')]({'where':{'id':_0x1644be[_0x2be5('0x31')]['id']}})[_0x2be5('0x2a')](handleEntityNotFound(_0x470f1d,null))['then'](removeEntity(_0x470f1d,null))[_0x2be5('0x3f')](handleError(_0x470f1d,null));};function widgetAttributes(_0x36574c){try{switch(_0x36574c[_0x2be5('0x41')]){case'iframe':return[{'name':_0x2be5('0x42'),'value':_0x36574c[_0x2be5('0x42')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c['attrs'][0x0]?_0x36574c['attrs'][0x0][_0x2be5('0x44')]:undefined)||_0x2be5('0x45')}];case _0x2be5('0x46'):return[{'name':'attrPath','value':_0x36574c[_0x2be5('0x47')]||(_0x36574c['attrs']&&_0x36574c[_0x2be5('0x43')][0x0]?_0x36574c[_0x2be5('0x43')][0x0]['value']:undefined)||''}];case _0x2be5('0x48'):return[{'name':_0x2be5('0x49'),'value':_0x36574c[_0x2be5('0x49')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c['attrs'][0x0]?_0x36574c['attrs'][0x0][_0x2be5('0x44')]:undefined)||_0x2be5('0x4a')},{'name':_0x2be5('0x4b'),'value':_0x36574c[_0x2be5('0x4b')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c['attrs'][0x1]?_0x36574c[_0x2be5('0x43')][0x1]['value']:undefined)||_0x2be5('0x4c')},{'name':_0x2be5('0x4d'),'value':_0x36574c[_0x2be5('0x4d')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x2]?_0x36574c['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x2be5('0x4e'),'value':_0x36574c['attrMetric']||(_0x36574c[_0x2be5('0x43')]&&_0x36574c['attrs'][0x0]?_0x36574c[_0x2be5('0x43')][0x0][_0x2be5('0x44')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x36574c[_0x2be5('0x4f')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x1]?_0x36574c['attrs'][0x1]['value']:undefined)||[]},{'name':_0x2be5('0x4d'),'value':_0x36574c['attrFontSize']||(_0x36574c[_0x2be5('0x43')]&&_0x36574c['attrs'][0x2]?_0x36574c['attrs'][0x2]['value']:undefined)||0x14},{'name':_0x2be5('0x50'),'value':_0x36574c[_0x2be5('0x50')]||(_0x36574c['attrs']&&_0x36574c[_0x2be5('0x43')][0x3]?_0x36574c[_0x2be5('0x43')][0x3][_0x2be5('0x44')]:undefined)||_0x2be5('0x51')},{'name':'attrEmailAccounts','value':_0x36574c['attrEmailAccounts']||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x4]?_0x36574c[_0x2be5('0x43')][0x4][_0x2be5('0x44')]:undefined)||''},{'name':_0x2be5('0x52'),'value':_0x36574c['attrFaxAccounts']||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x5]?_0x36574c[_0x2be5('0x43')][0x5][_0x2be5('0x44')]:undefined)||''},{'name':_0x2be5('0x53'),'value':_0x36574c[_0x2be5('0x53')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c['attrs'][0x6]?_0x36574c['attrs'][0x6][_0x2be5('0x44')]:undefined)||''},{'name':_0x2be5('0x54'),'value':_0x36574c[_0x2be5('0x54')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x7]?_0x36574c[_0x2be5('0x43')][0x7][_0x2be5('0x44')]:undefined)||''},{'name':_0x2be5('0x55'),'value':_0x36574c[_0x2be5('0x55')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x8]?_0x36574c[_0x2be5('0x43')][0x8]['value']:undefined)||''},{'name':_0x2be5('0x56'),'value':_0x36574c[_0x2be5('0x56')]||(_0x36574c['attrs']&&_0x36574c[_0x2be5('0x43')][0x9]?_0x36574c[_0x2be5('0x43')][0x9][_0x2be5('0x44')]:undefined)||''}];case _0x2be5('0x57'):case _0x2be5('0x58'):return[{'name':'attrSerie1','value':_0x36574c[_0x2be5('0x59')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x0]?_0x36574c[_0x2be5('0x43')][0x0][_0x2be5('0x44')]:undefined)||_0x2be5('0x5a')},{'name':_0x2be5('0x5b'),'value':_0x36574c[_0x2be5('0x5b')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x1]?_0x36574c[_0x2be5('0x43')][0x1][_0x2be5('0x44')]:undefined)||null},{'name':'attrSerie3','value':_0x36574c['attrSerie3']||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x2]?_0x36574c[_0x2be5('0x43')][0x2][_0x2be5('0x44')]:undefined)||null},{'name':_0x2be5('0x4f'),'value':_0x36574c[_0x2be5('0x4f')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c['attrs'][0x3]?_0x36574c['attrs'][0x3][_0x2be5('0x44')]:undefined)||[]},{'name':_0x2be5('0x50'),'value':_0x36574c[_0x2be5('0x50')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x4]?_0x36574c[_0x2be5('0x43')][0x4][_0x2be5('0x44')]:undefined)||_0x2be5('0x51')},{'name':_0x2be5('0x5c'),'value':_0x36574c['attrEmailAccounts']||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x5]?_0x36574c[_0x2be5('0x43')][0x5]['value']:undefined)||''},{'name':_0x2be5('0x52'),'value':_0x36574c[_0x2be5('0x52')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c['attrs'][0x6]?_0x36574c[_0x2be5('0x43')][0x6][_0x2be5('0x44')]:undefined)||''},{'name':_0x2be5('0x53'),'value':_0x36574c[_0x2be5('0x53')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x7]?_0x36574c[_0x2be5('0x43')][0x7][_0x2be5('0x44')]:undefined)||''},{'name':_0x2be5('0x54'),'value':_0x36574c['attrOpenchannelAccounts']||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x8]?_0x36574c[_0x2be5('0x43')][0x8]['value']:undefined)||''},{'name':_0x2be5('0x55'),'value':_0x36574c['attrWhatsappAccounts']||(_0x36574c[_0x2be5('0x43')]&&_0x36574c['attrs'][0x9]?_0x36574c[_0x2be5('0x43')][0x9][_0x2be5('0x44')]:undefined)||''},{'name':_0x2be5('0x56'),'value':_0x36574c[_0x2be5('0x56')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0xa]?_0x36574c[_0x2be5('0x43')][0xa][_0x2be5('0x44')]:undefined)||''}];case _0x2be5('0x5d'):return[{'name':_0x2be5('0x5e'),'type':_0x36574c['reportType']||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x0]?_0x36574c[_0x2be5('0x43')][0x0][_0x2be5('0x41')]:undefined)||null,'value':_0x36574c['attrReport']||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x0]?_0x36574c[_0x2be5('0x43')][0x0][_0x2be5('0x44')]:undefined)||null},{'name':'attrRefresh','value':_0x36574c[_0x2be5('0x5f')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x1]?_0x36574c['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x8b7d42){logger[_0x2be5('0x2d')](_0x2be5('0x60'),JSON[_0x2be5('0x61')](_0x8b7d42));return[];}}exports[_0x2be5('0x62')]=function(_0x437f4e,_0x2e4667){if(_0x437f4e[_0x2be5('0x63')]){_0x437f4e[_0x2be5('0x63')][_0x2be5('0x43')]=widgetAttributes(_0x437f4e[_0x2be5('0x63')]);}return db[_0x2be5('0x33')][_0x2be5('0x62')](_0x437f4e[_0x2be5('0x63')],{})[_0x2be5('0x2a')](respondWithResult(_0x2e4667,0xc9))['catch'](handleError(_0x2e4667,null));};exports[_0x2be5('0x29')]=function(_0x7952c4,_0x303e2c){if(_0x7952c4[_0x2be5('0x63')]['id']){delete _0x7952c4[_0x2be5('0x63')]['id'];}_0x7952c4['body'][_0x2be5('0x43')]=widgetAttributes(_0x7952c4['body']);return db[_0x2be5('0x33')][_0x2be5('0x40')]({'where':{'id':_0x7952c4[_0x2be5('0x31')]['id']}})[_0x2be5('0x2a')](handleEntityNotFound(_0x303e2c,null))[_0x2be5('0x2a')](saveUpdates(_0x7952c4['body'],null))[_0x2be5('0x2a')](respondWithResult(_0x303e2c,null))[_0x2be5('0x3f')](handleError(_0x303e2c,null));}; \ No newline at end of file +var _0x5bc1=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','rawAttributes','query','fields','attributes','length','includeAll','include','merge','options','DashboardItem','find','catch','iframe','attrUrl','attrs','value','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type','widgetAttributes:\x20%s','stringify','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','squel','crypto','jsforce'];(function(_0x5951e8,_0x42b9a7){var _0x20a1f5=function(_0x2bc968){while(--_0x2bc968){_0x5951e8['push'](_0x5951e8['shift']());}};_0x20a1f5(++_0x42b9a7);}(_0x5bc1,0xb5));var _0x15bc=function(_0x24c9d0,_0x4967b6){_0x24c9d0=_0x24c9d0-0x0;var _0x58c87f=_0x5bc1[_0x24c9d0];return _0x58c87f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x15bc('0x0'));var zipdir=require(_0x15bc('0x1'));var jsonpatch=require(_0x15bc('0x2'));var rp=require(_0x15bc('0x3'));var moment=require(_0x15bc('0x4'));var BPromise=require(_0x15bc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x15bc('0x6'));var sox=require(_0x15bc('0x7'));var csv=require(_0x15bc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x15bc('0x9'));var _=require('lodash');var squel=require(_0x15bc('0xa'));var crypto=require(_0x15bc('0xb'));var jsforce=require(_0x15bc('0xc'));var deskjs=require(_0x15bc('0xd'));var toCsv=require(_0x15bc('0x8'));var querystring=require(_0x15bc('0xe'));var Papa=require(_0x15bc('0xf'));var Redis=require(_0x15bc('0x10'));var authService=require(_0x15bc('0x11'));var qs=require(_0x15bc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15bc('0x13'));var logger=require(_0x15bc('0x14'))(_0x15bc('0x15'));var utils=require('../../config/utils');var config=require(_0x15bc('0x16'));var licenseUtil=require(_0x15bc('0x17'));var db=require(_0x15bc('0x18'))['db'];config[_0x15bc('0x19')]=_['defaults'](config[_0x15bc('0x19')],{'host':_0x15bc('0x1a'),'port':0x18eb});var socket=require(_0x15bc('0x1b'))(new Redis(config[_0x15bc('0x19')]));require(_0x15bc('0x1c'))[_0x15bc('0x1d')](socket);function respondWithStatusCode(_0x5383f1,_0x2daead){_0x2daead=_0x2daead||0xcc;return function(_0x3e99a7){if(_0x3e99a7){return _0x5383f1[_0x15bc('0x1e')](_0x2daead);}return _0x5383f1[_0x15bc('0x1f')](_0x2daead)[_0x15bc('0x20')]();};}function respondWithResult(_0x947132,_0x27574c){_0x27574c=_0x27574c||0xc8;return function(_0x5599a2){if(_0x5599a2){return _0x947132[_0x15bc('0x1f')](_0x27574c)[_0x15bc('0x21')](_0x5599a2);}};}function respondWithFilteredResult(_0x427212,_0xc067ee){return function(_0x1deadc){if(_0x1deadc){var _0x25b54a=typeof _0xc067ee[_0x15bc('0x22')]===_0x15bc('0x23')&&typeof _0xc067ee[_0x15bc('0x24')]===_0x15bc('0x23');var _0x1b3741=_0x1deadc['count'];var _0x3c6bb8=_0x25b54a?0x0:_0xc067ee['offset'];var _0x11c5d8=_0x25b54a?_0x1deadc['count']:_0xc067ee[_0x15bc('0x22')]+_0xc067ee[_0x15bc('0x24')];var _0x26b16b;if(_0x11c5d8>=_0x1b3741){_0x11c5d8=_0x1b3741;_0x26b16b=0xc8;}else{_0x26b16b=0xce;}_0x427212['status'](_0x26b16b);return _0x427212[_0x15bc('0x25')]('Content-Range',_0x3c6bb8+'-'+_0x11c5d8+'/'+_0x1b3741)[_0x15bc('0x21')](_0x1deadc);}return null;};}function patchUpdates(_0x2bebcc){return function(_0x27c83e){try{jsonpatch[_0x15bc('0x26')](_0x27c83e,_0x2bebcc,!![]);}catch(_0x2715d1){return BPromise[_0x15bc('0x27')](_0x2715d1);}return _0x27c83e[_0x15bc('0x28')]();};}function saveUpdates(_0x424020,_0x52462a){return function(_0x34be92){if(_0x34be92){return _0x34be92[_0x15bc('0x29')](_0x424020)[_0x15bc('0x2a')](function(_0xbacc26){return _0xbacc26;});}return null;};}function removeEntity(_0x4b505b,_0x3d1dc7){return function(_0x23a3d9){if(_0x23a3d9){return _0x23a3d9[_0x15bc('0x2b')]()[_0x15bc('0x2a')](function(){_0x4b505b[_0x15bc('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x423622,_0x5f3985){return function(_0x22ba14){if(!_0x22ba14){_0x423622[_0x15bc('0x1e')](0x194);}return _0x22ba14;};}function handleError(_0x17e3e6,_0x1b5ccc){_0x1b5ccc=_0x1b5ccc||0x1f4;return function(_0x21927c){logger[_0x15bc('0x2c')](_0x21927c[_0x15bc('0x2d')]);if(_0x21927c[_0x15bc('0x2e')]){delete _0x21927c['name'];}_0x17e3e6[_0x15bc('0x1f')](_0x1b5ccc)[_0x15bc('0x2f')](_0x21927c);};}exports[_0x15bc('0x30')]=function(_0x2d3d3f,_0x244d12){var _0x1d1234={'raw':![],'where':{'id':_0x2d3d3f[_0x15bc('0x31')]['id']}},_0x181e37={};_0x181e37[_0x15bc('0x32')]=_[_0x15bc('0x33')](db['DashboardItem'][_0x15bc('0x34')]);_0x181e37['query']=_[_0x15bc('0x33')](_0x2d3d3f[_0x15bc('0x35')]);_0x181e37['filters']=_['intersection'](_0x181e37[_0x15bc('0x32')],_0x181e37[_0x15bc('0x35')]);_0x1d1234['attributes']=_['intersection'](_0x181e37[_0x15bc('0x32')],qs[_0x15bc('0x36')](_0x2d3d3f[_0x15bc('0x35')][_0x15bc('0x36')]));_0x1d1234['attributes']=_0x1d1234[_0x15bc('0x37')][_0x15bc('0x38')]?_0x1d1234['attributes']:_0x181e37[_0x15bc('0x32')];if(_0x2d3d3f[_0x15bc('0x35')][_0x15bc('0x39')]){_0x1d1234[_0x15bc('0x3a')]=[{'all':!![]}];}_0x1d1234=_[_0x15bc('0x3b')]({},_0x1d1234,_0x2d3d3f[_0x15bc('0x3c')]);return db[_0x15bc('0x3d')][_0x15bc('0x3e')](_0x1d1234)['then'](handleEntityNotFound(_0x244d12,null))[_0x15bc('0x2a')](respondWithResult(_0x244d12,null))[_0x15bc('0x3f')](handleError(_0x244d12,null));};exports[_0x15bc('0x2b')]=function(_0x1bc2fc,_0x567fa9){return db['DashboardItem'][_0x15bc('0x3e')]({'where':{'id':_0x1bc2fc['params']['id']}})[_0x15bc('0x2a')](handleEntityNotFound(_0x567fa9,null))[_0x15bc('0x2a')](removeEntity(_0x567fa9,null))[_0x15bc('0x3f')](handleError(_0x567fa9,null));};function widgetAttributes(_0x31ba52){try{switch(_0x31ba52['type']){case _0x15bc('0x40'):return[{'name':_0x15bc('0x41'),'value':_0x31ba52[_0x15bc('0x41')]||(_0x31ba52[_0x15bc('0x42')]&&_0x31ba52[_0x15bc('0x42')][0x0]?_0x31ba52[_0x15bc('0x42')][0x0][_0x15bc('0x43')]:undefined)||'https://'}];case'custom':return[{'name':'attrPath','value':_0x31ba52[_0x15bc('0x44')]||(_0x31ba52['attrs']&&_0x31ba52[_0x15bc('0x42')][0x0]?_0x31ba52['attrs'][0x0][_0x15bc('0x43')]:undefined)||''}];case'clock':return[{'name':_0x15bc('0x45'),'value':_0x31ba52['attrHourFormat']||(_0x31ba52[_0x15bc('0x42')]&&_0x31ba52[_0x15bc('0x42')][0x0]?_0x31ba52[_0x15bc('0x42')][0x0][_0x15bc('0x43')]:undefined)||'HH:mm:ss'},{'name':_0x15bc('0x46'),'value':_0x31ba52[_0x15bc('0x46')]||(_0x31ba52[_0x15bc('0x42')]&&_0x31ba52['attrs'][0x1]?_0x31ba52[_0x15bc('0x42')][0x1][_0x15bc('0x43')]:undefined)||_0x15bc('0x47')},{'name':'attrFontSize','value':_0x31ba52[_0x15bc('0x48')]||(_0x31ba52[_0x15bc('0x42')]&&_0x31ba52[_0x15bc('0x42')][0x2]?_0x31ba52['attrs'][0x2]['value']:undefined)||0xc}];case _0x15bc('0x49'):return[{'name':_0x15bc('0x4a'),'value':_0x31ba52[_0x15bc('0x4a')]||(_0x31ba52[_0x15bc('0x42')]&&_0x31ba52['attrs'][0x0]?_0x31ba52[_0x15bc('0x42')][0x0][_0x15bc('0x43')]:undefined)||_0x15bc('0x4b')},{'name':_0x15bc('0x4c'),'value':_0x31ba52[_0x15bc('0x4c')]||(_0x31ba52[_0x15bc('0x42')]&&_0x31ba52[_0x15bc('0x42')][0x1]?_0x31ba52[_0x15bc('0x42')][0x1][_0x15bc('0x43')]:undefined)||[]},{'name':_0x15bc('0x48'),'value':_0x31ba52[_0x15bc('0x48')]||(_0x31ba52['attrs']&&_0x31ba52[_0x15bc('0x42')][0x2]?_0x31ba52[_0x15bc('0x42')][0x2][_0x15bc('0x43')]:undefined)||0x14},{'name':_0x15bc('0x4d'),'value':_0x31ba52[_0x15bc('0x4d')]||(_0x31ba52['attrs']&&_0x31ba52[_0x15bc('0x42')][0x3]?_0x31ba52[_0x15bc('0x42')][0x3][_0x15bc('0x43')]:undefined)||'voice'},{'name':_0x15bc('0x4e'),'value':_0x31ba52[_0x15bc('0x4e')]||(_0x31ba52['attrs']&&_0x31ba52['attrs'][0x4]?_0x31ba52[_0x15bc('0x42')][0x4][_0x15bc('0x43')]:undefined)||''},{'name':_0x15bc('0x4f'),'value':_0x31ba52[_0x15bc('0x4f')]||(_0x31ba52[_0x15bc('0x42')]&&_0x31ba52[_0x15bc('0x42')][0x5]?_0x31ba52[_0x15bc('0x42')][0x5][_0x15bc('0x43')]:undefined)||''},{'name':_0x15bc('0x50'),'value':_0x31ba52[_0x15bc('0x50')]||(_0x31ba52[_0x15bc('0x42')]&&_0x31ba52[_0x15bc('0x42')][0x6]?_0x31ba52['attrs'][0x6][_0x15bc('0x43')]:undefined)||''},{'name':_0x15bc('0x51'),'value':_0x31ba52[_0x15bc('0x51')]||(_0x31ba52[_0x15bc('0x42')]&&_0x31ba52[_0x15bc('0x42')][0x7]?_0x31ba52[_0x15bc('0x42')][0x7][_0x15bc('0x43')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x31ba52[_0x15bc('0x52')]||(_0x31ba52[_0x15bc('0x42')]&&_0x31ba52[_0x15bc('0x42')][0x8]?_0x31ba52[_0x15bc('0x42')][0x8][_0x15bc('0x43')]:undefined)||''},{'name':_0x15bc('0x53'),'value':_0x31ba52[_0x15bc('0x53')]||(_0x31ba52['attrs']&&_0x31ba52[_0x15bc('0x42')][0x9]?_0x31ba52['attrs'][0x9][_0x15bc('0x43')]:undefined)||''}];case _0x15bc('0x54'):case _0x15bc('0x55'):return[{'name':_0x15bc('0x56'),'value':_0x31ba52[_0x15bc('0x56')]||(_0x31ba52[_0x15bc('0x42')]&&_0x31ba52[_0x15bc('0x42')][0x0]?_0x31ba52[_0x15bc('0x42')][0x0][_0x15bc('0x43')]:undefined)||_0x15bc('0x4b')},{'name':_0x15bc('0x57'),'value':_0x31ba52[_0x15bc('0x57')]||(_0x31ba52[_0x15bc('0x42')]&&_0x31ba52['attrs'][0x1]?_0x31ba52['attrs'][0x1][_0x15bc('0x43')]:undefined)||null},{'name':_0x15bc('0x58'),'value':_0x31ba52[_0x15bc('0x58')]||(_0x31ba52[_0x15bc('0x42')]&&_0x31ba52[_0x15bc('0x42')][0x2]?_0x31ba52['attrs'][0x2][_0x15bc('0x43')]:undefined)||null},{'name':_0x15bc('0x4c'),'value':_0x31ba52['attrVoiceQueues']||(_0x31ba52['attrs']&&_0x31ba52[_0x15bc('0x42')][0x3]?_0x31ba52[_0x15bc('0x42')][0x3]['value']:undefined)||[]},{'name':_0x15bc('0x4d'),'value':_0x31ba52[_0x15bc('0x4d')]||(_0x31ba52[_0x15bc('0x42')]&&_0x31ba52[_0x15bc('0x42')][0x4]?_0x31ba52[_0x15bc('0x42')][0x4]['value']:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x31ba52[_0x15bc('0x4e')]||(_0x31ba52[_0x15bc('0x42')]&&_0x31ba52['attrs'][0x5]?_0x31ba52['attrs'][0x5][_0x15bc('0x43')]:undefined)||''},{'name':_0x15bc('0x4f'),'value':_0x31ba52['attrFaxAccounts']||(_0x31ba52[_0x15bc('0x42')]&&_0x31ba52[_0x15bc('0x42')][0x6]?_0x31ba52[_0x15bc('0x42')][0x6]['value']:undefined)||''},{'name':_0x15bc('0x50'),'value':_0x31ba52[_0x15bc('0x50')]||(_0x31ba52[_0x15bc('0x42')]&&_0x31ba52[_0x15bc('0x42')][0x7]?_0x31ba52[_0x15bc('0x42')][0x7][_0x15bc('0x43')]:undefined)||''},{'name':_0x15bc('0x51'),'value':_0x31ba52[_0x15bc('0x51')]||(_0x31ba52['attrs']&&_0x31ba52[_0x15bc('0x42')][0x8]?_0x31ba52[_0x15bc('0x42')][0x8]['value']:undefined)||''},{'name':_0x15bc('0x52'),'value':_0x31ba52[_0x15bc('0x52')]||(_0x31ba52[_0x15bc('0x42')]&&_0x31ba52['attrs'][0x9]?_0x31ba52[_0x15bc('0x42')][0x9][_0x15bc('0x43')]:undefined)||''},{'name':_0x15bc('0x53'),'value':_0x31ba52[_0x15bc('0x53')]||(_0x31ba52['attrs']&&_0x31ba52[_0x15bc('0x42')][0xa]?_0x31ba52[_0x15bc('0x42')][0xa]['value']:undefined)||''}];case _0x15bc('0x59'):return[{'name':_0x15bc('0x5a'),'type':_0x31ba52[_0x15bc('0x5b')]||(_0x31ba52[_0x15bc('0x42')]&&_0x31ba52[_0x15bc('0x42')][0x0]?_0x31ba52['attrs'][0x0][_0x15bc('0x5c')]:undefined)||null,'value':_0x31ba52[_0x15bc('0x5a')]||(_0x31ba52[_0x15bc('0x42')]&&_0x31ba52[_0x15bc('0x42')][0x0]?_0x31ba52['attrs'][0x0][_0x15bc('0x43')]:undefined)||null},{'name':'attrRefresh','value':_0x31ba52['attrRefresh']||(_0x31ba52[_0x15bc('0x42')]&&_0x31ba52[_0x15bc('0x42')][0x1]?_0x31ba52[_0x15bc('0x42')][0x1][_0x15bc('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x1fb665){logger[_0x15bc('0x2c')](_0x15bc('0x5d'),JSON[_0x15bc('0x5e')](_0x1fb665));return[];}}exports[_0x15bc('0x5f')]=function(_0x53c162,_0xf3a8b1){if(_0x53c162[_0x15bc('0x60')]){_0x53c162['body']['attrs']=widgetAttributes(_0x53c162['body']);}return db[_0x15bc('0x3d')][_0x15bc('0x5f')](_0x53c162[_0x15bc('0x60')],{})[_0x15bc('0x2a')](respondWithResult(_0xf3a8b1,0xc9))[_0x15bc('0x3f')](handleError(_0xf3a8b1,null));};exports['update']=function(_0xdd1855,_0x24a9e4){if(_0xdd1855['body']['id']){delete _0xdd1855[_0x15bc('0x60')]['id'];}_0xdd1855[_0x15bc('0x60')][_0x15bc('0x42')]=widgetAttributes(_0xdd1855[_0x15bc('0x60')]);return db['DashboardItem']['find']({'where':{'id':_0xdd1855[_0x15bc('0x31')]['id']}})[_0x15bc('0x2a')](handleEntityNotFound(_0x24a9e4,null))[_0x15bc('0x2a')](saveUpdates(_0xdd1855[_0x15bc('0x60')],null))[_0x15bc('0x2a')](respondWithResult(_0x24a9e4,null))[_0x15bc('0x3f')](handleError(_0x24a9e4,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 417e6ac..2209b08 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 _0x00f0=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x4965df,_0x4bff91){var _0xfb3d6d=function(_0x40ee7d){while(--_0x40ee7d){_0x4965df['push'](_0x4965df['shift']());}};_0xfb3d6d(++_0x4bff91);}(_0x00f0,0x111));var _0x000f=function(_0xb77969,_0x25422b){_0xb77969=_0xb77969-0x0;var _0x362813=_0x00f0[_0xb77969];return _0x362813;};'use strict';var EventEmitter=require(_0x000f('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x000f('0x1')](0x0);var events={'afterCreate':_0x000f('0x2'),'afterUpdate':_0x000f('0x3'),'afterDestroy':_0x000f('0x4')};function emitEvent(_0x525737){return function(_0x2b906e,_0x384ce5,_0x291875){DashboardItemEvents['emit'](_0x525737+':'+_0x2b906e['id'],_0x2b906e);DashboardItemEvents[_0x000f('0x5')](_0x525737,_0x2b906e);_0x291875(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x000f('0x6')](e,emitEvent(event));}}module[_0x000f('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x2e4a=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x31c760,_0x1154b1){var _0x1bb311=function(_0x2098ab){while(--_0x2098ab){_0x31c760['push'](_0x31c760['shift']());}};_0x1bb311(++_0x1154b1);}(_0x2e4a,0x12e));var _0xa2e4=function(_0xd9722e,_0x19a095){_0xd9722e=_0xd9722e-0x0;var _0x59cee8=_0x2e4a[_0xd9722e];return _0x59cee8;};'use strict';var EventEmitter=require(_0xa2e4('0x0'));var DashboardItem=require(_0xa2e4('0x1'))['db'][_0xa2e4('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xa2e4('0x3')](0x0);var events={'afterCreate':_0xa2e4('0x4'),'afterUpdate':_0xa2e4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x47f347){return function(_0x2a0e91,_0x1ad61f,_0x2f61c0){DashboardItemEvents['emit'](_0x47f347+':'+_0x2a0e91['id'],_0x2a0e91);DashboardItemEvents[_0xa2e4('0x6')](_0x47f347,_0x2a0e91);_0x2f61c0(null);};}for(var e in events){if(events[_0xa2e4('0x7')](e)){var event=events[e];DashboardItem[_0xa2e4('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 7e2227b..771ac0c 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 _0xcc0d=['../../config/environment','./dashboardItem.attributes','DashboardItem','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x48b08d,_0x35a344){var _0x460015=function(_0x229c56){while(--_0x229c56){_0x48b08d['push'](_0x48b08d['shift']());}};_0x460015(++_0x35a344);}(_0xcc0d,0x174));var _0xdcc0=function(_0x5d6bb6,_0x33a9bd){_0x5d6bb6=_0x5d6bb6-0x0;var _0x3d70e9=_0xcc0d[_0x5d6bb6];return _0x3d70e9;};'use strict';var _=require(_0xdcc0('0x0'));var util=require(_0xdcc0('0x1'));var logger=require(_0xdcc0('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdcc0('0x3'));var rp=require(_0xdcc0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdcc0('0x5'));var config=require(_0xdcc0('0x6'));var attributes=require(_0xdcc0('0x7'));module['exports']=function(_0x3baa5c,_0x5b6b32){return _0x3baa5c['define'](_0xdcc0('0x8'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x62da=['moment','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','../../config/logger','api'];(function(_0x599ef3,_0x2c708f){var _0x42867e=function(_0x23383f){while(--_0x23383f){_0x599ef3['push'](_0x599ef3['shift']());}};_0x42867e(++_0x2c708f);}(_0x62da,0xc0));var _0xa62d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x62da[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa62d('0x0'));var util=require('util');var logger=require(_0xa62d('0x1'))(_0xa62d('0x2'));var moment=require(_0xa62d('0x3'));var BPromise=require(_0xa62d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa62d('0x5'));var rimraf=require(_0xa62d('0x6'));var config=require(_0xa62d('0x7'));var attributes=require(_0xa62d('0x8'));module[_0xa62d('0x9')]=function(_0x46f662,_0xab1efb){return _0x46f662[_0xa62d('0xa')](_0xa62d('0xb'),attributes,{'tableName':_0xa62d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 12f66d3..930f3ed 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 _0x8168=['request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket'];(function(_0x1904ec,_0x4fbef5){var _0x54bad4=function(_0x1e8100){while(--_0x1e8100){_0x1904ec['push'](_0x1904ec['shift']());}};_0x54bad4(++_0x4fbef5);}(_0x8168,0x1e8));var _0x8816=function(_0x3a07d4,_0xa80b88){_0x3a07d4=_0x3a07d4-0x0;var _0x2c352=_0x8168[_0x3a07d4];return _0x2c352;};'use strict';var _=require(_0x8816('0x0'));var util=require('util');var moment=require(_0x8816('0x1'));var BPromise=require(_0x8816('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8816('0x3'));var db=require(_0x8816('0x4'))['db'];var utils=require(_0x8816('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8816('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x8816('0x7')]=_[_0x8816('0x8')](config[_0x8816('0x7')],{'host':_0x8816('0x9'),'port':0x18eb});var socket=require(_0x8816('0xa'))(new Redis(config[_0x8816('0x7')]));require(_0x8816('0xb'))['register'](socket);function respondWithRpcPromise(_0x42220b,_0x2c9631,_0x1c6981){return new BPromise(function(_0x4ee4ae,_0x3b88e7){return client[_0x8816('0xc')](_0x42220b,_0x1c6981)[_0x8816('0xd')](function(_0x141a2d){logger[_0x8816('0xe')](_0x8816('0xf'),_0x2c9631,_0x8816('0x10'));logger[_0x8816('0x11')](_0x8816('0x12'),_0x2c9631,'request\x20sent',JSON[_0x8816('0x13')](_0x141a2d));if(_0x141a2d['error']){if(_0x141a2d[_0x8816('0x14')][_0x8816('0x15')]===0x1f4){logger[_0x8816('0x14')](_0x8816('0xf'),_0x2c9631,_0x141a2d[_0x8816('0x14')][_0x8816('0x16')]);return _0x3b88e7(_0x141a2d[_0x8816('0x14')][_0x8816('0x16')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x2c9631,_0x141a2d[_0x8816('0x14')]['message']);return _0x4ee4ae(_0x141a2d[_0x8816('0x14')][_0x8816('0x16')]);}else{logger['info'](_0x8816('0xf'),_0x2c9631,_0x8816('0x10'));_0x4ee4ae(_0x141a2d[_0x8816('0x17')][_0x8816('0x16')]);}})[_0x8816('0x18')](function(_0x541330){logger[_0x8816('0x14')](_0x8816('0xf'),_0x2c9631,_0x541330);_0x3b88e7(_0x541330);});});} \ No newline at end of file +var _0x1a58=['DashboardItem,\x20%s,\x20%s','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','request\x20sent','debug','stringify','code','error','message'];(function(_0x34a07e,_0x2da866){var _0x313f95=function(_0x5ed09c){while(--_0x5ed09c){_0x34a07e['push'](_0x34a07e['shift']());}};_0x313f95(++_0x2da866);}(_0x1a58,0x107));var _0x81a5=function(_0x104e26,_0x3e60ae){_0x104e26=_0x104e26-0x0;var _0x1525ac=_0x1a58[_0x104e26];return _0x1525ac;};'use strict';var _=require(_0x81a5('0x0'));var util=require(_0x81a5('0x1'));var moment=require('moment');var BPromise=require(_0x81a5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x81a5('0x3'));var db=require(_0x81a5('0x4'))['db'];var utils=require(_0x81a5('0x5'));var logger=require(_0x81a5('0x6'))(_0x81a5('0x7'));var config=require(_0x81a5('0x8'));var jayson=require(_0x81a5('0x9'));var client=jayson[_0x81a5('0xa')][_0x81a5('0xb')]({'port':0x232a});config[_0x81a5('0xc')]=_[_0x81a5('0xd')](config[_0x81a5('0xc')],{'host':_0x81a5('0xe'),'port':0x18eb});var socket=require(_0x81a5('0xf'))(new Redis(config[_0x81a5('0xc')]));require(_0x81a5('0x10'))[_0x81a5('0x11')](socket);function respondWithRpcPromise(_0x4b7afa,_0x17c31d,_0x2e0302){return new BPromise(function(_0x525909,_0x509abf){return client[_0x81a5('0x12')](_0x4b7afa,_0x2e0302)[_0x81a5('0x13')](function(_0x3f7adc){logger[_0x81a5('0x14')]('DashboardItem,\x20%s,\x20%s',_0x17c31d,_0x81a5('0x15'));logger[_0x81a5('0x16')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x17c31d,_0x81a5('0x15'),JSON[_0x81a5('0x17')](_0x3f7adc));if(_0x3f7adc['error']){if(_0x3f7adc['error'][_0x81a5('0x18')]===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x17c31d,_0x3f7adc[_0x81a5('0x19')][_0x81a5('0x1a')]);return _0x509abf(_0x3f7adc[_0x81a5('0x19')][_0x81a5('0x1a')]);}logger[_0x81a5('0x19')](_0x81a5('0x1b'),_0x17c31d,_0x3f7adc[_0x81a5('0x19')][_0x81a5('0x1a')]);return _0x525909(_0x3f7adc[_0x81a5('0x19')]['message']);}else{logger[_0x81a5('0x14')](_0x81a5('0x1b'),_0x17c31d,_0x81a5('0x15'));_0x525909(_0x3f7adc[_0x81a5('0x1c')]['message']);}})['catch'](function(_0x208190){logger[_0x81a5('0x19')]('DashboardItem,\x20%s,\x20%s',_0x17c31d,_0x208190);_0x509abf(_0x208190);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 65c777d..a5269bc 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 _0x592d=['removeListener','length','./dashboardItem.events','save','remove','update'];(function(_0x126591,_0xbe043d){var _0xd3a26=function(_0x21ba71){while(--_0x21ba71){_0x126591['push'](_0x126591['shift']());}};_0xd3a26(++_0xbe043d);}(_0x592d,0x9e));var _0xd592=function(_0x228e86,_0x2ceaaf){_0x228e86=_0x228e86-0x0;var _0x3a7649=_0x592d[_0x228e86];return _0x3a7649;};'use strict';var DashboardItemEvents=require(_0xd592('0x0'));var events=[_0xd592('0x1'),_0xd592('0x2'),_0xd592('0x3')];function createListener(_0x5b392d,_0x42be9e){return function(_0x1d7da2){_0x42be9e['emit'](_0x5b392d,_0x1d7da2);};}function removeListener(_0x27a1e0,_0x1b8a09){return function(){DashboardItemEvents[_0xd592('0x4')](_0x27a1e0,_0x1b8a09);};}exports['register']=function(_0x4558cc){for(var _0x39fcbb=0x0,_0x1e46eb=events[_0xd592('0x5')];_0x39fcbb<_0x1e46eb;_0x39fcbb++){var _0x6396=events[_0x39fcbb];var _0x170bee=createListener('dashboardItem:'+_0x6396,_0x4558cc);DashboardItemEvents['on'](_0x6396,_0x170bee);}}; \ No newline at end of file +var _0xa6cf=['update','emit','removeListener','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x2dfd28,_0x153b3c){var _0x49c016=function(_0x1cfb4d){while(--_0x1cfb4d){_0x2dfd28['push'](_0x2dfd28['shift']());}};_0x49c016(++_0x153b3c);}(_0xa6cf,0x1ad));var _0xfa6c=function(_0x1331ba,_0x2a6f52){_0x1331ba=_0x1331ba-0x0;var _0x1f633b=_0xa6cf[_0x1331ba];return _0x1f633b;};'use strict';var DashboardItemEvents=require(_0xfa6c('0x0'));var events=[_0xfa6c('0x1'),_0xfa6c('0x2'),_0xfa6c('0x3')];function createListener(_0x6fcb2c,_0x13ec5c){return function(_0x3113bf){_0x13ec5c[_0xfa6c('0x4')](_0x6fcb2c,_0x3113bf);};}function removeListener(_0x5ce417,_0xb18e7e){return function(){DashboardItemEvents[_0xfa6c('0x5')](_0x5ce417,_0xb18e7e);};}exports['register']=function(_0x1b5aec){for(var _0x44cb2c=0x0,_0x40e599=events[_0xfa6c('0x6')];_0x44cb2c<_0x40e599;_0x44cb2c++){var _0x4301d0=events[_0x44cb2c];var _0x38a1cc=createListener(_0xfa6c('0x7')+_0x4301d0,_0x1b5aec);DashboardItemEvents['on'](_0x4301d0,_0x38a1cc);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index cef70c5..35cc426 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 _0x4229=['update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','create','put'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4229,0x1f3));var _0x9422=function(_0x1698d4,_0x51d44e){_0x1698d4=_0x1698d4-0x0;var _0x53474d=_0x4229[_0x1698d4];return _0x53474d;};'use strict';var multer=require('multer');var util=require(_0x9422('0x0'));var path=require(_0x9422('0x1'));var timeout=require(_0x9422('0x2'));var express=require(_0x9422('0x3'));var router=express[_0x9422('0x4')]();var fs_extra=require(_0x9422('0x5'));var auth=require(_0x9422('0x6'));var interaction=require(_0x9422('0x7'));var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router[_0x9422('0x8')](_0x9422('0x9'),auth[_0x9422('0xa')](),controller['show']);router['post']('/',auth[_0x9422('0xa')](),controller[_0x9422('0xb')]);router[_0x9422('0xc')](_0x9422('0x9'),auth[_0x9422('0xa')](),controller[_0x9422('0xd')]);router['delete'](_0x9422('0x9'),auth[_0x9422('0xa')](),controller[_0x9422('0xe')]);module[_0x9422('0xf')]=router; \ No newline at end of file +var _0x488b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','path','connect-timeout'];(function(_0x23200d,_0x15fb6e){var _0x3f8381=function(_0x3318d6){while(--_0x3318d6){_0x23200d['push'](_0x23200d['shift']());}};_0x3f8381(++_0x15fb6e);}(_0x488b,0xe1));var _0xb488=function(_0x3d2272,_0x566d1f){_0x3d2272=_0x3d2272-0x0;var _0x59c382=_0x488b[_0x3d2272];return _0x59c382;};'use strict';var multer=require(_0xb488('0x0'));var util=require('util');var path=require(_0xb488('0x1'));var timeout=require(_0xb488('0x2'));var express=require(_0xb488('0x3'));var router=express[_0xb488('0x4')]();var fs_extra=require(_0xb488('0x5'));var auth=require(_0xb488('0x6'));var interaction=require(_0xb488('0x7'));var config=require(_0xb488('0x8'));var controller=require(_0xb488('0x9'));router['get'](_0xb488('0xa'),auth[_0xb488('0xb')](),controller[_0xb488('0xc')]);router[_0xb488('0xd')]('/',auth[_0xb488('0xb')](),controller[_0xb488('0xe')]);router[_0xb488('0xf')](_0xb488('0xa'),auth[_0xb488('0xb')](),controller[_0xb488('0x10')]);router[_0xb488('0x11')]('/:id',auth[_0xb488('0xb')](),controller[_0xb488('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index fd2ebee..709f7f5 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 _0xc0e9=['STRING','exports','ENUM','first','second','third'];(function(_0x1bc844,_0x447375){var _0x3ae686=function(_0x1b8f93){while(--_0x1b8f93){_0x1bc844['push'](_0x1bc844['shift']());}};_0x3ae686(++_0x447375);}(_0xc0e9,0x11b));var _0x9c0e=function(_0x569f71,_0x4d66cb){_0x569f71=_0x569f71-0x0;var _0x5c3f46=_0xc0e9[_0x569f71];return _0x5c3f46;};'use strict';var Sequelize=require('sequelize');module[_0x9c0e('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x9c0e('0x1')](_0x9c0e('0x2'),_0x9c0e('0x3'),_0x9c0e('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x9c0e('0x5')]}}; \ No newline at end of file +var _0x1fdc=['first','sequelize','exports','ENUM','second','third'];(function(_0x371e61,_0x4f3ddd){var _0x392e65=function(_0x5052df){while(--_0x5052df){_0x371e61['push'](_0x371e61['shift']());}};_0x392e65(++_0x4f3ddd);}(_0x1fdc,0xb5));var _0xc1fd=function(_0xfd5f37,_0x24a79c){_0xfd5f37=_0xfd5f37-0x0;var _0x11bd01=_0x1fdc[_0xfd5f37];return _0x11bd01;};'use strict';var Sequelize=require(_0xc1fd('0x0'));module[_0xc1fd('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xc1fd('0x2')]('first',_0xc1fd('0x3'),_0xc1fd('0x4')),'allowNull':![],'defaultValue':_0xc1fd('0x5')},'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 ca25957..489f44a 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 _0xbf25=['send','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','filter','where','VIRTUAL','merge','Disposition','includeAll','include','catch','show','params','rawAttributes','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','Dispositions','sendStatus','error','stack','name'];(function(_0x231984,_0x3c4e25){var _0x9671ef=function(_0x3d8dd4){while(--_0x3d8dd4){_0x231984['push'](_0x231984['shift']());}};_0x9671ef(++_0x3c4e25);}(_0xbf25,0x15e));var _0x5bf2=function(_0x5d5a44,_0x14308c){_0x5d5a44=_0x5d5a44-0x0;var _0x3cf472=_0xbf25[_0x5d5a44];return _0x3cf472;};'use strict';var emlformat=require(_0x5bf2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5bf2('0x1'));var jsonpatch=require(_0x5bf2('0x2'));var rp=require(_0x5bf2('0x3'));var moment=require(_0x5bf2('0x4'));var BPromise=require(_0x5bf2('0x5'));var Mustache=require(_0x5bf2('0x6'));var util=require('util');var path=require(_0x5bf2('0x7'));var sox=require('sox');var csv=require(_0x5bf2('0x8'));var ejs=require(_0x5bf2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5bf2('0xa'));var squel=require(_0x5bf2('0xb'));var crypto=require(_0x5bf2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5bf2('0xd'));var toCsv=require(_0x5bf2('0x8'));var querystring=require(_0x5bf2('0xe'));var Papa=require('papaparse');var Redis=require(_0x5bf2('0xf'));var authService=require(_0x5bf2('0x10'));var qs=require(_0x5bf2('0x11'));var as=require(_0x5bf2('0x12'));var hardwareService=require(_0x5bf2('0x13'));var logger=require(_0x5bf2('0x14'))(_0x5bf2('0x15'));var utils=require(_0x5bf2('0x16'));var config=require(_0x5bf2('0x17'));var licenseUtil=require(_0x5bf2('0x18'));var db=require(_0x5bf2('0x19'))['db'];function respondWithStatusCode(_0x656dc6,_0x355620){_0x355620=_0x355620||0xcc;return function(_0x541e89){if(_0x541e89){return _0x656dc6['sendStatus'](_0x355620);}return _0x656dc6[_0x5bf2('0x1a')](_0x355620)[_0x5bf2('0x1b')]();};}function respondWithResult(_0x5d3cb6,_0x10c8a1){_0x10c8a1=_0x10c8a1||0xc8;return function(_0x43a83b){if(_0x43a83b){return _0x5d3cb6[_0x5bf2('0x1a')](_0x10c8a1)[_0x5bf2('0x1c')](_0x43a83b);}};}function respondWithFilteredResult(_0x15abc4,_0x277d50){return function(_0x3083cd){if(_0x3083cd){var _0xff9397=typeof _0x277d50[_0x5bf2('0x1d')]===_0x5bf2('0x1e')&&typeof _0x277d50[_0x5bf2('0x1f')]===_0x5bf2('0x1e');var _0x4d1990=_0x3083cd['count'];var _0x2f87ff=_0xff9397?0x0:_0x277d50['offset'];var _0x3df0cd=_0xff9397?_0x3083cd[_0x5bf2('0x20')]:_0x277d50['offset']+_0x277d50['limit'];var _0x3adc26;if(_0x3df0cd>=_0x4d1990){_0x3df0cd=_0x4d1990;_0x3adc26=0xc8;}else{_0x3adc26=0xce;}_0x15abc4[_0x5bf2('0x1a')](_0x3adc26);return _0x15abc4[_0x5bf2('0x21')](_0x5bf2('0x22'),_0x2f87ff+'-'+_0x3df0cd+'/'+_0x4d1990)[_0x5bf2('0x1c')](_0x3083cd);}return null;};}function patchUpdates(_0x3c97f5){return function(_0x3a9694){try{jsonpatch[_0x5bf2('0x23')](_0x3a9694,_0x3c97f5,!![]);}catch(_0x44bedc){return BPromise['reject'](_0x44bedc);}return _0x3a9694['save']();};}function saveUpdates(_0xe8c648,_0x3885e8){return function(_0x161ec2){if(_0x161ec2){return _0x161ec2[_0x5bf2('0x24')](_0xe8c648)[_0x5bf2('0x25')](function(_0x1cb9e1){return _0x1cb9e1;});}return null;};}function removeEntity(_0x37036d,_0x2eea63){return function(_0x239206){if(_0x239206){return _0x239206[_0x5bf2('0x26')]()[_0x5bf2('0x25')](function(){var _0x20ee02=_0x239206[_0x5bf2('0x27')]({'plain':!![]});var _0x5ae161=_0x5bf2('0x28');return db['UserProfileResource'][_0x5bf2('0x26')]({'where':{'type':_0x5ae161,'resourceId':_0x20ee02['id']}})[_0x5bf2('0x25')](function(){return _0x239206;});})['then'](function(){_0x37036d[_0x5bf2('0x1a')](0xcc)[_0x5bf2('0x1b')]();});}};}function handleEntityNotFound(_0x5cefb3,_0x5426f9){return function(_0x8c54cd){if(!_0x8c54cd){_0x5cefb3[_0x5bf2('0x29')](0x194);}return _0x8c54cd;};}function handleError(_0x3ceabf,_0x43c2f7){_0x43c2f7=_0x43c2f7||0x1f4;return function(_0x5ca619){logger[_0x5bf2('0x2a')](_0x5ca619[_0x5bf2('0x2b')]);if(_0x5ca619[_0x5bf2('0x2c')]){delete _0x5ca619[_0x5bf2('0x2c')];}_0x3ceabf[_0x5bf2('0x1a')](_0x43c2f7)[_0x5bf2('0x2d')](_0x5ca619);};}exports['index']=function(_0x3edba7,_0x2ea937){var _0x44a6a3={},_0x59ac8b={},_0x7023ae={'count':0x0,'rows':[]};var _0x432de6=_[_0x5bf2('0x2e')](db['Disposition']['rawAttributes'],function(_0x5284fe){return{'name':_0x5284fe[_0x5bf2('0x2f')],'type':_0x5284fe[_0x5bf2('0x30')][_0x5bf2('0x31')]};});_0x59ac8b[_0x5bf2('0x32')]=_[_0x5bf2('0x2e')](_0x432de6,'name');_0x59ac8b['query']=_[_0x5bf2('0x33')](_0x3edba7[_0x5bf2('0x34')]);_0x59ac8b[_0x5bf2('0x35')]=_[_0x5bf2('0x36')](_0x59ac8b[_0x5bf2('0x32')],_0x59ac8b[_0x5bf2('0x34')]);_0x44a6a3[_0x5bf2('0x37')]=_[_0x5bf2('0x36')](_0x59ac8b[_0x5bf2('0x32')],qs[_0x5bf2('0x38')](_0x3edba7[_0x5bf2('0x34')][_0x5bf2('0x38')]));_0x44a6a3[_0x5bf2('0x37')]=_0x44a6a3['attributes'][_0x5bf2('0x39')]?_0x44a6a3['attributes']:_0x59ac8b['model'];if(!_0x3edba7['query']['hasOwnProperty'](_0x5bf2('0x3a'))){_0x44a6a3[_0x5bf2('0x1f')]=qs[_0x5bf2('0x1f')](_0x3edba7[_0x5bf2('0x34')][_0x5bf2('0x1f')]);_0x44a6a3['offset']=qs['offset'](_0x3edba7['query'][_0x5bf2('0x1d')]);}_0x44a6a3[_0x5bf2('0x3b')]=qs['sort'](_0x3edba7['query']['sort']);_0x44a6a3['where']=qs[_0x5bf2('0x35')](_['pick'](_0x3edba7[_0x5bf2('0x34')],_0x59ac8b[_0x5bf2('0x35')]),_0x432de6);if(_0x3edba7[_0x5bf2('0x34')][_0x5bf2('0x3c')]){_0x44a6a3[_0x5bf2('0x3d')]=_['merge'](_0x44a6a3['where'],{'$or':_[_0x5bf2('0x2e')](_0x432de6,function(_0xa1c3bc){if(_0xa1c3bc[_0x5bf2('0x30')]!==_0x5bf2('0x3e')){var _0x51290c={};_0x51290c[_0xa1c3bc['name']]={'$like':'%'+_0x3edba7[_0x5bf2('0x34')][_0x5bf2('0x3c')]+'%'};return _0x51290c;}})});}_0x44a6a3=_[_0x5bf2('0x3f')]({},_0x44a6a3,_0x3edba7['options']);var _0x1cd76b={'where':_0x44a6a3['where']};return db[_0x5bf2('0x40')]['count'](_0x1cd76b)[_0x5bf2('0x25')](function(_0x22e6d4){_0x7023ae[_0x5bf2('0x20')]=_0x22e6d4;if(_0x3edba7[_0x5bf2('0x34')][_0x5bf2('0x41')]){_0x44a6a3[_0x5bf2('0x42')]=[{'all':!![]}];}return db[_0x5bf2('0x40')]['findAll'](_0x44a6a3);})['then'](function(_0x1509c1){_0x7023ae['rows']=_0x1509c1;return _0x7023ae;})['then'](respondWithFilteredResult(_0x2ea937,_0x44a6a3))[_0x5bf2('0x43')](handleError(_0x2ea937,null));};exports[_0x5bf2('0x44')]=function(_0x880696,_0x1de267){var _0x2aba02={'raw':!![],'where':{'id':_0x880696[_0x5bf2('0x45')]['id']}},_0x4d2159={};_0x4d2159[_0x5bf2('0x32')]=_[_0x5bf2('0x33')](db['Disposition'][_0x5bf2('0x46')]);_0x4d2159['query']=_[_0x5bf2('0x33')](_0x880696[_0x5bf2('0x34')]);_0x4d2159['filters']=_[_0x5bf2('0x36')](_0x4d2159['model'],_0x4d2159['query']);_0x2aba02[_0x5bf2('0x37')]=_['intersection'](_0x4d2159['model'],qs['fields'](_0x880696[_0x5bf2('0x34')][_0x5bf2('0x38')]));_0x2aba02['attributes']=_0x2aba02[_0x5bf2('0x37')][_0x5bf2('0x39')]?_0x2aba02[_0x5bf2('0x37')]:_0x4d2159[_0x5bf2('0x32')];if(_0x880696['query'][_0x5bf2('0x41')]){_0x2aba02[_0x5bf2('0x42')]=[{'all':!![]}];}_0x2aba02=_['merge']({},_0x2aba02,_0x880696['options']);return db[_0x5bf2('0x40')]['find'](_0x2aba02)[_0x5bf2('0x25')](handleEntityNotFound(_0x1de267,null))[_0x5bf2('0x25')](respondWithResult(_0x1de267,null))['catch'](handleError(_0x1de267,null));};exports['create']=function(_0x3a58fe,_0x4a2b21){return db[_0x5bf2('0x40')]['create'](_0x3a58fe['body'],{})[_0x5bf2('0x25')](function(_0x311bb1){var _0x323a73=_0x3a58fe['user'][_0x5bf2('0x27')]({'plain':!![]});if(!_0x323a73)throw new Error(_0x5bf2('0x47'));if(_0x323a73['role']==='user'){var _0x141747=_0x311bb1['get']({'plain':!![]});var _0x1b9cb8=_0x5bf2('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x1b9cb8,'userProfileId':_0x323a73[_0x5bf2('0x48')]},'raw':!![]})[_0x5bf2('0x25')](function(_0x3217a2){if(_0x3217a2&&_0x3217a2[_0x5bf2('0x49')]===0x0){return db[_0x5bf2('0x4a')][_0x5bf2('0x4b')]({'name':_0x141747[_0x5bf2('0x2c')],'resourceId':_0x141747['id'],'type':_0x3217a2[_0x5bf2('0x2c')],'sectionId':_0x3217a2['id']},{})[_0x5bf2('0x25')](function(){return _0x311bb1;});}else{return _0x311bb1;}})['catch'](function(_0x4e32e4){logger[_0x5bf2('0x2a')](_0x5bf2('0x4c'),_0x4e32e4);throw _0x4e32e4;});}return _0x311bb1;})[_0x5bf2('0x25')](respondWithResult(_0x4a2b21,0xc9))['catch'](handleError(_0x4a2b21,null));};exports['update']=function(_0x5e8617,_0x5d9618){if(_0x5e8617[_0x5bf2('0x4d')]['id']){delete _0x5e8617['body']['id'];}return db[_0x5bf2('0x40')][_0x5bf2('0x4e')]({'where':{'id':_0x5e8617['params']['id']}})[_0x5bf2('0x25')](handleEntityNotFound(_0x5d9618,null))[_0x5bf2('0x25')](saveUpdates(_0x5e8617[_0x5bf2('0x4d')],null))['then'](respondWithResult(_0x5d9618,null))[_0x5bf2('0x43')](handleError(_0x5d9618,null));};exports[_0x5bf2('0x26')]=function(_0x20f5c9,_0x5e8dfc){return db[_0x5bf2('0x40')][_0x5bf2('0x4e')]({'where':{'id':_0x20f5c9[_0x5bf2('0x45')]['id']}})[_0x5bf2('0x25')](handleEntityNotFound(_0x5e8dfc,null))['then'](removeEntity(_0x5e8dfc,null))[_0x5bf2('0x43')](handleError(_0x5e8dfc,null));}; \ No newline at end of file +var _0x8d59=['sort','where','pick','filter','merge','map','options','include','findAll','rows','params','length','includeAll','find','catch','create','body','user','role','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','end','error','name','send','Disposition','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','nolimit','order'];(function(_0x5ed73a,_0x2db7a9){var _0xbb9c28=function(_0x2fdb37){while(--_0x2fdb37){_0x5ed73a['push'](_0x5ed73a['shift']());}};_0xbb9c28(++_0x2db7a9);}(_0x8d59,0xb9));var _0x98d5=function(_0x3bbf79,_0xaafea7){_0x3bbf79=_0x3bbf79-0x0;var _0x543e94=_0x8d59[_0x3bbf79];return _0x543e94;};'use strict';var emlformat=require(_0x98d5('0x0'));var rimraf=require(_0x98d5('0x1'));var zipdir=require(_0x98d5('0x2'));var jsonpatch=require(_0x98d5('0x3'));var rp=require(_0x98d5('0x4'));var moment=require('moment');var BPromise=require(_0x98d5('0x5'));var Mustache=require(_0x98d5('0x6'));var util=require('util');var path=require(_0x98d5('0x7'));var sox=require(_0x98d5('0x8'));var csv=require('to-csv');var ejs=require(_0x98d5('0x9'));var fs=require('fs');var fs_extra=require(_0x98d5('0xa'));var _=require(_0x98d5('0xb'));var squel=require(_0x98d5('0xc'));var crypto=require(_0x98d5('0xd'));var jsforce=require(_0x98d5('0xe'));var deskjs=require(_0x98d5('0xf'));var toCsv=require(_0x98d5('0x10'));var querystring=require(_0x98d5('0x11'));var Papa=require('papaparse');var Redis=require(_0x98d5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x98d5('0x13'));var as=require(_0x98d5('0x14'));var hardwareService=require(_0x98d5('0x15'));var logger=require(_0x98d5('0x16'))(_0x98d5('0x17'));var utils=require('../../config/utils');var config=require(_0x98d5('0x18'));var licenseUtil=require(_0x98d5('0x19'));var db=require(_0x98d5('0x1a'))['db'];function respondWithStatusCode(_0x59dbe4,_0x5e2dff){_0x5e2dff=_0x5e2dff||0xcc;return function(_0x300cd6){if(_0x300cd6){return _0x59dbe4[_0x98d5('0x1b')](_0x5e2dff);}return _0x59dbe4[_0x98d5('0x1c')](_0x5e2dff)['end']();};}function respondWithResult(_0x5a6c62,_0x1ae8cb){_0x1ae8cb=_0x1ae8cb||0xc8;return function(_0xeb93c6){if(_0xeb93c6){return _0x5a6c62[_0x98d5('0x1c')](_0x1ae8cb)[_0x98d5('0x1d')](_0xeb93c6);}};}function respondWithFilteredResult(_0x2760d7,_0x1b7468){return function(_0x13d7cf){if(_0x13d7cf){var _0x479387=typeof _0x1b7468[_0x98d5('0x1e')]===_0x98d5('0x1f')&&typeof _0x1b7468[_0x98d5('0x20')]===_0x98d5('0x1f');var _0x5b2096=_0x13d7cf[_0x98d5('0x21')];var _0x69241e=_0x479387?0x0:_0x1b7468[_0x98d5('0x1e')];var _0x25627e=_0x479387?_0x13d7cf['count']:_0x1b7468[_0x98d5('0x1e')]+_0x1b7468[_0x98d5('0x20')];var _0x397610;if(_0x25627e>=_0x5b2096){_0x25627e=_0x5b2096;_0x397610=0xc8;}else{_0x397610=0xce;}_0x2760d7[_0x98d5('0x1c')](_0x397610);return _0x2760d7['set'](_0x98d5('0x22'),_0x69241e+'-'+_0x25627e+'/'+_0x5b2096)[_0x98d5('0x1d')](_0x13d7cf);}return null;};}function patchUpdates(_0x5d79c8){return function(_0x481559){try{jsonpatch[_0x98d5('0x23')](_0x481559,_0x5d79c8,!![]);}catch(_0x543697){return BPromise[_0x98d5('0x24')](_0x543697);}return _0x481559[_0x98d5('0x25')]();};}function saveUpdates(_0x228322,_0x3455c){return function(_0x586752){if(_0x586752){return _0x586752[_0x98d5('0x26')](_0x228322)[_0x98d5('0x27')](function(_0x15577b){return _0x15577b;});}return null;};}function removeEntity(_0x18d9e4,_0x565236){return function(_0x5089a0){if(_0x5089a0){return _0x5089a0[_0x98d5('0x28')]()[_0x98d5('0x27')](function(){var _0x512139=_0x5089a0[_0x98d5('0x29')]({'plain':!![]});var _0x30c874=_0x98d5('0x2a');return db[_0x98d5('0x2b')][_0x98d5('0x28')]({'where':{'type':_0x30c874,'resourceId':_0x512139['id']}})['then'](function(){return _0x5089a0;});})[_0x98d5('0x27')](function(){_0x18d9e4[_0x98d5('0x1c')](0xcc)[_0x98d5('0x2c')]();});}};}function handleEntityNotFound(_0x561561,_0x2afa46){return function(_0x415db8){if(!_0x415db8){_0x561561[_0x98d5('0x1b')](0x194);}return _0x415db8;};}function handleError(_0xdb934,_0x547d3){_0x547d3=_0x547d3||0x1f4;return function(_0x18dfe3){logger[_0x98d5('0x2d')](_0x18dfe3['stack']);if(_0x18dfe3[_0x98d5('0x2e')]){delete _0x18dfe3[_0x98d5('0x2e')];}_0xdb934['status'](_0x547d3)[_0x98d5('0x2f')](_0x18dfe3);};}exports['index']=function(_0x246d9b,_0xe47a8b){var _0x415ab0={},_0x29f115={},_0x4e394c={'count':0x0,'rows':[]};var _0x384a6b=_['map'](db[_0x98d5('0x30')][_0x98d5('0x31')],function(_0x1be95b){return{'name':_0x1be95b[_0x98d5('0x32')],'type':_0x1be95b[_0x98d5('0x33')]['key']};});_0x29f115[_0x98d5('0x34')]=_['map'](_0x384a6b,_0x98d5('0x2e'));_0x29f115[_0x98d5('0x35')]=_[_0x98d5('0x36')](_0x246d9b[_0x98d5('0x35')]);_0x29f115[_0x98d5('0x37')]=_['intersection'](_0x29f115[_0x98d5('0x34')],_0x29f115['query']);_0x415ab0[_0x98d5('0x38')]=_[_0x98d5('0x39')](_0x29f115[_0x98d5('0x34')],qs['fields'](_0x246d9b['query'][_0x98d5('0x3a')]));_0x415ab0['attributes']=_0x415ab0['attributes']['length']?_0x415ab0[_0x98d5('0x38')]:_0x29f115[_0x98d5('0x34')];if(!_0x246d9b[_0x98d5('0x35')]['hasOwnProperty'](_0x98d5('0x3b'))){_0x415ab0[_0x98d5('0x20')]=qs[_0x98d5('0x20')](_0x246d9b[_0x98d5('0x35')][_0x98d5('0x20')]);_0x415ab0['offset']=qs[_0x98d5('0x1e')](_0x246d9b[_0x98d5('0x35')]['offset']);}_0x415ab0[_0x98d5('0x3c')]=qs[_0x98d5('0x3d')](_0x246d9b[_0x98d5('0x35')]['sort']);_0x415ab0[_0x98d5('0x3e')]=qs[_0x98d5('0x37')](_[_0x98d5('0x3f')](_0x246d9b[_0x98d5('0x35')],_0x29f115[_0x98d5('0x37')]),_0x384a6b);if(_0x246d9b[_0x98d5('0x35')][_0x98d5('0x40')]){_0x415ab0[_0x98d5('0x3e')]=_[_0x98d5('0x41')](_0x415ab0['where'],{'$or':_[_0x98d5('0x42')](_0x384a6b,function(_0x297b00){if(_0x297b00[_0x98d5('0x33')]!=='VIRTUAL'){var _0x1af9ce={};_0x1af9ce[_0x297b00['name']]={'$like':'%'+_0x246d9b[_0x98d5('0x35')][_0x98d5('0x40')]+'%'};return _0x1af9ce;}})});}_0x415ab0=_[_0x98d5('0x41')]({},_0x415ab0,_0x246d9b[_0x98d5('0x43')]);var _0x5d1ac4={'where':_0x415ab0[_0x98d5('0x3e')]};return db[_0x98d5('0x30')][_0x98d5('0x21')](_0x5d1ac4)[_0x98d5('0x27')](function(_0x69788a){_0x4e394c['count']=_0x69788a;if(_0x246d9b[_0x98d5('0x35')]['includeAll']){_0x415ab0[_0x98d5('0x44')]=[{'all':!![]}];}return db['Disposition'][_0x98d5('0x45')](_0x415ab0);})[_0x98d5('0x27')](function(_0x4ca099){_0x4e394c[_0x98d5('0x46')]=_0x4ca099;return _0x4e394c;})['then'](respondWithFilteredResult(_0xe47a8b,_0x415ab0))['catch'](handleError(_0xe47a8b,null));};exports['show']=function(_0x59c864,_0x472337){var _0x50f1d1={'raw':!![],'where':{'id':_0x59c864[_0x98d5('0x47')]['id']}},_0x557f04={};_0x557f04[_0x98d5('0x34')]=_[_0x98d5('0x36')](db[_0x98d5('0x30')][_0x98d5('0x31')]);_0x557f04[_0x98d5('0x35')]=_[_0x98d5('0x36')](_0x59c864[_0x98d5('0x35')]);_0x557f04[_0x98d5('0x37')]=_[_0x98d5('0x39')](_0x557f04[_0x98d5('0x34')],_0x557f04[_0x98d5('0x35')]);_0x50f1d1['attributes']=_[_0x98d5('0x39')](_0x557f04[_0x98d5('0x34')],qs[_0x98d5('0x3a')](_0x59c864[_0x98d5('0x35')][_0x98d5('0x3a')]));_0x50f1d1[_0x98d5('0x38')]=_0x50f1d1[_0x98d5('0x38')][_0x98d5('0x48')]?_0x50f1d1['attributes']:_0x557f04[_0x98d5('0x34')];if(_0x59c864['query'][_0x98d5('0x49')]){_0x50f1d1[_0x98d5('0x44')]=[{'all':!![]}];}_0x50f1d1=_[_0x98d5('0x41')]({},_0x50f1d1,_0x59c864['options']);return db[_0x98d5('0x30')][_0x98d5('0x4a')](_0x50f1d1)[_0x98d5('0x27')](handleEntityNotFound(_0x472337,null))[_0x98d5('0x27')](respondWithResult(_0x472337,null))[_0x98d5('0x4b')](handleError(_0x472337,null));};exports[_0x98d5('0x4c')]=function(_0x25cf7e,_0x4f343a){return db['Disposition'][_0x98d5('0x4c')](_0x25cf7e[_0x98d5('0x4d')],{})[_0x98d5('0x27')](function(_0x53ae82){var _0x5bab0a=_0x25cf7e[_0x98d5('0x4e')][_0x98d5('0x29')]({'plain':!![]});if(!_0x5bab0a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5bab0a[_0x98d5('0x4f')]===_0x98d5('0x4e')){var _0x5aa08b=_0x53ae82['get']({'plain':!![]});var _0x1064a4=_0x98d5('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x1064a4,'userProfileId':_0x5bab0a[_0x98d5('0x50')]},'raw':!![]})[_0x98d5('0x27')](function(_0x2aebf5){if(_0x2aebf5&&_0x2aebf5[_0x98d5('0x51')]===0x0){return db[_0x98d5('0x2b')][_0x98d5('0x4c')]({'name':_0x5aa08b['name'],'resourceId':_0x5aa08b['id'],'type':_0x2aebf5[_0x98d5('0x2e')],'sectionId':_0x2aebf5['id']},{})[_0x98d5('0x27')](function(){return _0x53ae82;});}else{return _0x53ae82;}})['catch'](function(_0xa01435){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa01435);throw _0xa01435;});}return _0x53ae82;})[_0x98d5('0x27')](respondWithResult(_0x4f343a,0xc9))[_0x98d5('0x4b')](handleError(_0x4f343a,null));};exports['update']=function(_0xd0c7d6,_0x1849f5){if(_0xd0c7d6['body']['id']){delete _0xd0c7d6[_0x98d5('0x4d')]['id'];}return db[_0x98d5('0x30')]['find']({'where':{'id':_0xd0c7d6['params']['id']}})['then'](handleEntityNotFound(_0x1849f5,null))[_0x98d5('0x27')](saveUpdates(_0xd0c7d6[_0x98d5('0x4d')],null))[_0x98d5('0x27')](respondWithResult(_0x1849f5,null))[_0x98d5('0x4b')](handleError(_0x1849f5,null));};exports[_0x98d5('0x28')]=function(_0x37e163,_0x54654c){return db[_0x98d5('0x30')][_0x98d5('0x4a')]({'where':{'id':_0x37e163[_0x98d5('0x47')]['id']}})[_0x98d5('0x27')](handleEntityNotFound(_0x54654c,null))[_0x98d5('0x27')](removeEntity(_0x54654c,null))[_0x98d5('0x4b')](handleError(_0x54654c,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 5dba357..bd1ad47 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 _0xdafb=['name','ChatWebsiteId','name_mail','SmsAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','Disposition','tools_dispositions','name_voice'];(function(_0x5e5c00,_0x1b7a1d){var _0x47d92c=function(_0x11df20){while(--_0x11df20){_0x5e5c00['push'](_0x5e5c00['shift']());}};_0x47d92c(++_0x1b7a1d);}(_0xdafb,0xce));var _0xbdaf=function(_0x158ba3,_0xc7b8e4){_0x158ba3=_0x158ba3-0x0;var _0x50a36c=_0xdafb[_0x158ba3];return _0x50a36c;};'use strict';var _=require(_0xbdaf('0x0'));var util=require(_0xbdaf('0x1'));var logger=require(_0xbdaf('0x2'))(_0xbdaf('0x3'));var moment=require(_0xbdaf('0x4'));var BPromise=require('bluebird');var rp=require(_0xbdaf('0x5'));var fs=require('fs');var path=require(_0xbdaf('0x6'));var rimraf=require(_0xbdaf('0x7'));var config=require(_0xbdaf('0x8'));var attributes=require('./disposition.attributes');module[_0xbdaf('0x9')]=function(_0x3b07d4,_0x1c1f5d){return _0x3b07d4[_0xbdaf('0xa')](_0xbdaf('0xb'),attributes,{'tableName':_0xbdaf('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xbdaf('0xd'),'fields':[_0xbdaf('0xe'),'ListId']},{'unique':!![],'name':'name_chat','fields':['name',_0xbdaf('0xf')]},{'unique':!![],'name':_0xbdaf('0x10'),'fields':['name','MailAccountId']},{'unique':!![],'name':'name_sms','fields':['name',_0xbdaf('0x11')]},{'unique':!![],'name':'name_fax','fields':[_0xbdaf('0xe'),'FaxAccountId']},{'unique':!![],'name':_0xbdaf('0x12'),'fields':[_0xbdaf('0xe'),_0xbdaf('0x13')]},{'unique':!![],'name':_0xbdaf('0x14'),'fields':['name',_0xbdaf('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xec1a=['ListId','name_chat','name','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','FaxAccountId','OpenchannelAccountId','name_whatsapp','util','api','moment','request-promise','path','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name_voice'];(function(_0x1f20c1,_0x350567){var _0x548c58=function(_0x54b7c5){while(--_0x54b7c5){_0x1f20c1['push'](_0x1f20c1['shift']());}};_0x548c58(++_0x350567);}(_0xec1a,0x130));var _0xaec1=function(_0x2a7082,_0x362c5e){_0x2a7082=_0x2a7082-0x0;var _0x39c954=_0xec1a[_0x2a7082];return _0x39c954;};'use strict';var _=require('lodash');var util=require(_0xaec1('0x0'));var logger=require('../../config/logger')(_0xaec1('0x1'));var moment=require(_0xaec1('0x2'));var BPromise=require('bluebird');var rp=require(_0xaec1('0x3'));var fs=require('fs');var path=require(_0xaec1('0x4'));var rimraf=require('rimraf');var config=require(_0xaec1('0x5'));var attributes=require(_0xaec1('0x6'));module[_0xaec1('0x7')]=function(_0x2f1078,_0x237393){return _0x2f1078[_0xaec1('0x8')]('Disposition',attributes,{'tableName':_0xaec1('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xaec1('0xa'),'fields':['name',_0xaec1('0xb')]},{'unique':!![],'name':_0xaec1('0xc'),'fields':[_0xaec1('0xd'),_0xaec1('0xe')]},{'unique':!![],'name':'name_mail','fields':['name',_0xaec1('0xf')]},{'unique':!![],'name':_0xaec1('0x10'),'fields':['name',_0xaec1('0x11')]},{'unique':!![],'name':'name_fax','fields':[_0xaec1('0xd'),_0xaec1('0x12')]},{'unique':!![],'name':'name_openchannel','fields':[_0xaec1('0xd'),_0xaec1('0x13')]},{'unique':!![],'name':_0xaec1('0x14'),'fields':[_0xaec1('0xd'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index d33d118..c385549 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(_0x4d5684,_0x35c59f){var _0x148274=function(_0xeb37eb){while(--_0xeb37eb){_0x4d5684['push'](_0x4d5684['shift']());}};_0x148274(++_0x35c59f);}(_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 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(_0x107634,_0x37b6b0){var _0x242b0c=function(_0x19b1f4){while(--_0x19b1f4){_0x107634['push'](_0x107634['shift']());}};_0x242b0c(++_0x37b6b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var 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 6474377..6d0bd96 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 _0x4a2f=['isAuthenticated','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','/:id','show'];(function(_0x84cf8c,_0x211a87){var _0x302398=function(_0x230780){while(--_0x230780){_0x84cf8c['push'](_0x84cf8c['shift']());}};_0x302398(++_0x211a87);}(_0x4a2f,0x146));var _0xf4a2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4a2f[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xf4a2('0x0'));var util=require('util');var path=require(_0xf4a2('0x1'));var timeout=require('connect-timeout');var express=require(_0xf4a2('0x2'));var router=express[_0xf4a2('0x3')]();var fs_extra=require(_0xf4a2('0x4'));var auth=require(_0xf4a2('0x5'));var interaction=require(_0xf4a2('0x6'));var config=require('../../config/environment');var controller=require(_0xf4a2('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf4a2('0x8'),auth['isAuthenticated'](),controller[_0xf4a2('0x9')]);router['post']('/',auth[_0xf4a2('0xa')](),controller['create']);router[_0xf4a2('0xb')](_0xf4a2('0x8'),auth['isAuthenticated'](),controller[_0xf4a2('0xc')]);router[_0xf4a2('0xd')](_0xf4a2('0x8'),auth[_0xf4a2('0xa')](),controller[_0xf4a2('0xe')]);module[_0xf4a2('0xf')]=router; \ No newline at end of file +var _0x25e1=['../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x195f15,_0x17eedf){var _0x220ca5=function(_0x4c6ea7){while(--_0x4c6ea7){_0x195f15['push'](_0x195f15['shift']());}};_0x220ca5(++_0x17eedf);}(_0x25e1,0xd4));var _0x125e=function(_0x14df2d,_0x1543c5){_0x14df2d=_0x14df2d-0x0;var _0x471fc6=_0x25e1[_0x14df2d];return _0x471fc6;};'use strict';var multer=require(_0x125e('0x0'));var util=require(_0x125e('0x1'));var path=require(_0x125e('0x2'));var timeout=require(_0x125e('0x3'));var express=require(_0x125e('0x4'));var router=express[_0x125e('0x5')]();var fs_extra=require(_0x125e('0x6'));var auth=require(_0x125e('0x7'));var interaction=require(_0x125e('0x8'));var config=require(_0x125e('0x9'));var controller=require(_0x125e('0xa'));router[_0x125e('0xb')]('/',auth[_0x125e('0xc')](),controller[_0x125e('0xd')]);router['get'](_0x125e('0xe'),auth[_0x125e('0xc')](),controller[_0x125e('0xf')]);router[_0x125e('0x10')]('/',auth['isAuthenticated'](),controller[_0x125e('0x11')]);router[_0x125e('0x12')](_0x125e('0xe'),auth['isAuthenticated'](),controller[_0x125e('0x13')]);router[_0x125e('0x14')](_0x125e('0xe'),auth[_0x125e('0xc')](),controller[_0x125e('0x15')]);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 6a5b229..8482ae8 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 _0x8375=['sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition'];(function(_0x86c2a4,_0x11e4f6){var _0x4d08fa=function(_0x97e2a9){while(--_0x97e2a9){_0x86c2a4['push'](_0x86c2a4['shift']());}};_0x4d08fa(++_0x11e4f6);}(_0x8375,0xa8));var _0x5837=function(_0x2ecc53,_0x291adf){_0x2ecc53=_0x2ecc53-0x0;var _0x46a300=_0x8375[_0x2ecc53];return _0x46a300;};'use strict';var Sequelize=require(_0x5837('0x0'));module[_0x5837('0x1')]={'name':{'type':Sequelize[_0x5837('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x5837('0x3')](_0x5837('0x4'),'no'),'defaultValue':_0x5837('0x4')},'headerinfo':{'type':Sequelize[_0x5837('0x2')],'defaultValue':_0x5837('0x5')},'localstationid':{'type':Sequelize[_0x5837('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x5837('0x3')](_0x5837('0x6'),_0x5837('0x7'),_0x5837('0x8'),_0x5837('0x9'),'12000','14400'),'defaultValue':_0x5837('0x7')},'maxrate':{'type':Sequelize[_0x5837('0x3')]('2400',_0x5837('0x7'),'7200',_0x5837('0x9'),_0x5837('0xa'),_0x5837('0xb')),'defaultValue':_0x5837('0xb')},'modem':{'type':Sequelize[_0x5837('0x2')],'defaultValue':_0x5837('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x5837('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x5837('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x5837('0x3')](_0x5837('0xe'),_0x5837('0xf'),'DADHI','KHOMP'),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x5837('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5837('0x10')],'defaultValue':function(){return _0x5837('0x11');}},'notificationSound':{'type':Sequelize[_0x5837('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5837('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5837('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5837('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5837('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5837('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5837('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5837('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5837('0x12')],'defaultValue':![],'comment':_0x5837('0x13'),'set':function(_0x3a509b){if(!_0x3a509b)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x5837('0x14'),_0x3a509b);}}}; \ No newline at end of file +var _0x9f5a=['sequelize','exports','STRING','yes','ENUM','2400','7200','9600','12000','14400','4800','INTEGER','IAX','DADHI','KHOMP','TEXT','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x22bc2e,_0x5d238e){_0x22bc2e=_0x22bc2e-0x0;var _0x2e3bfb=_0x9f5a[_0x22bc2e];return _0x2e3bfb;};'use strict';var Sequelize=require(_0xa9f5('0x0'));module[_0xa9f5('0x1')]={'name':{'type':Sequelize[_0xa9f5('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa9f5('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0xa9f5('0x3'),'no'),'defaultValue':_0xa9f5('0x3')},'headerinfo':{'type':Sequelize[_0xa9f5('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xa9f5('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xa9f5('0x4')](_0xa9f5('0x5'),'4800',_0xa9f5('0x6'),_0xa9f5('0x7'),_0xa9f5('0x8'),_0xa9f5('0x9')),'defaultValue':_0xa9f5('0xa')},'maxrate':{'type':Sequelize[_0xa9f5('0x4')](_0xa9f5('0x5'),'4800',_0xa9f5('0x6'),_0xa9f5('0x7'),'12000',_0xa9f5('0x9')),'defaultValue':_0xa9f5('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xa9f5('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xa9f5('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xa9f5('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xa9f5('0x4')]('SIP',_0xa9f5('0xc'),_0xa9f5('0xd'),_0xa9f5('0xe')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xa9f5('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa9f5('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa9f5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa9f5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa9f5('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa9f5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa9f5('0xb')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xa9f5('0x10')],'defaultValue':![],'comment':_0xa9f5('0x11'),'set':function(_0x230fc2){if(!_0x230fc2)this[_0xa9f5('0x12')](_0xa9f5('0x13'),null);this[_0xa9f5('0x12')](_0xa9f5('0x14'),_0x230fc2);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 92b8a05..f13ece0 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 _0xc94e=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','FaxAccount','findAll','show','params','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','FaxAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','User','Owner','fullname','Tag','Tags','tag','addApplications','transaction','sequelize','Transaction','FaxApplication','bulkCreate','findAndCountAll','priority','finally','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','push','Answer','Set','ecm','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','List','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','jayson/promise','client','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','FaxAccounts','destroy','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type'];(function(_0x22b8a3,_0x2a79a7){var _0x199a0c=function(_0x544c66){while(--_0x544c66){_0x22b8a3['push'](_0x22b8a3['shift']());}};_0x199a0c(++_0x2a79a7);}(_0xc94e,0x13e));var _0xec94=function(_0x1fc0db,_0x18ba86){_0x1fc0db=_0x1fc0db-0x0;var _0x2a9f10=_0xc94e[_0x1fc0db];return _0x2a9f10;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xec94('0x0'));var jsonpatch=require(_0xec94('0x1'));var rp=require(_0xec94('0x2'));var moment=require(_0xec94('0x3'));var BPromise=require(_0xec94('0x4'));var Mustache=require(_0xec94('0x5'));var util=require('util');var path=require('path');var sox=require(_0xec94('0x6'));var csv=require(_0xec94('0x7'));var ejs=require(_0xec94('0x8'));var fs=require('fs');var fs_extra=require(_0xec94('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xec94('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xec94('0x7'));var querystring=require(_0xec94('0xb'));var Papa=require(_0xec94('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec94('0xd'));var logger=require(_0xec94('0xe'))(_0xec94('0xf'));var utils=require(_0xec94('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xec94('0x11'));var db=require(_0xec94('0x12'))['db'];config[_0xec94('0x13')]=_[_0xec94('0x14')](config[_0xec94('0x13')],{'host':_0xec94('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xec94('0x13')]));require(_0xec94('0x16'))['register'](socket);var jayson=require(_0xec94('0x17'));var client=jayson[_0xec94('0x18')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b14f1,_0x4baf6a,_0x13ad49,_0x36ab4f){return new BPromise(function(_0x496396,_0x5ca0eb){var _0x542f56=_0x36ab4f||client;return _0x542f56[_0xec94('0x19')](_0x4b14f1,_0x13ad49)['then'](function(_0x2bd611){logger[_0xec94('0x1a')](_0xec94('0x1b'),_0x4baf6a,_0xec94('0x1c'));logger[_0xec94('0x1d')](_0xec94('0x1e'),_0x4baf6a,_0xec94('0x1c'),JSON[_0xec94('0x1f')](_0x2bd611));if(_0x2bd611[_0xec94('0x20')]){if(_0x2bd611[_0xec94('0x20')]['code']===0x1f4){logger[_0xec94('0x20')](_0xec94('0x1b'),_0x4baf6a,_0x2bd611[_0xec94('0x20')][_0xec94('0x21')]);return _0x5ca0eb(_0x2bd611['error'][_0xec94('0x21')]);}logger[_0xec94('0x20')]('FaxAccount,\x20%s,\x20%s',_0x4baf6a,_0x2bd611[_0xec94('0x20')]['message']);return _0x496396(_0x2bd611[_0xec94('0x20')][_0xec94('0x21')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x4baf6a,_0xec94('0x1c'));_0x496396(_0x2bd611[_0xec94('0x22')]['message']);}})[_0xec94('0x23')](function(_0x34eba0){logger[_0xec94('0x20')]('FaxAccount,\x20%s,\x20%s',_0x4baf6a,_0x34eba0);_0x5ca0eb(_0x34eba0);});});}function respondWithStatusCode(_0x5d42f2,_0x40fb2c){_0x40fb2c=_0x40fb2c||0xcc;return function(_0x2ae205){if(_0x2ae205){return _0x5d42f2['sendStatus'](_0x40fb2c);}return _0x5d42f2[_0xec94('0x24')](_0x40fb2c)[_0xec94('0x25')]();};}function respondWithResult(_0x496ca7,_0x9657a3){_0x9657a3=_0x9657a3||0xc8;return function(_0xdc2b13){if(_0xdc2b13){return _0x496ca7[_0xec94('0x24')](_0x9657a3)[_0xec94('0x26')](_0xdc2b13);}};}function respondWithFilteredResult(_0x5464b8,_0xd1d473){return function(_0x3ea09c){if(_0x3ea09c){var _0x13f938=typeof _0xd1d473[_0xec94('0x27')]===_0xec94('0x28')&&typeof _0xd1d473[_0xec94('0x29')]===_0xec94('0x28');var _0x3dd245=_0x3ea09c[_0xec94('0x2a')];var _0x48e83b=_0x13f938?0x0:_0xd1d473[_0xec94('0x27')];var _0x57d637=_0x13f938?_0x3ea09c[_0xec94('0x2a')]:_0xd1d473[_0xec94('0x27')]+_0xd1d473[_0xec94('0x29')];var _0x2d99d8;if(_0x57d637>=_0x3dd245){_0x57d637=_0x3dd245;_0x2d99d8=0xc8;}else{_0x2d99d8=0xce;}_0x5464b8[_0xec94('0x24')](_0x2d99d8);return _0x5464b8[_0xec94('0x2b')](_0xec94('0x2c'),_0x48e83b+'-'+_0x57d637+'/'+_0x3dd245)[_0xec94('0x26')](_0x3ea09c);}return null;};}function patchUpdates(_0x31bc37){return function(_0x6ed7c5){try{jsonpatch[_0xec94('0x2d')](_0x6ed7c5,_0x31bc37,!![]);}catch(_0x2633c1){return BPromise[_0xec94('0x2e')](_0x2633c1);}return _0x6ed7c5[_0xec94('0x2f')]();};}function saveUpdates(_0x3f428b,_0x4b7a1f){return function(_0x2a31ba){if(_0x2a31ba){return _0x2a31ba[_0xec94('0x30')](_0x3f428b)[_0xec94('0x31')](function(_0xb9600b){return _0xb9600b;});}return null;};}function removeEntity(_0x21b13a,_0x11988b){return function(_0x940920){if(_0x940920){return _0x940920['destroy']()[_0xec94('0x31')](function(){var _0x3f4163=_0x940920[_0xec94('0x32')]({'plain':!![]});var _0x19c975=_0xec94('0x33');return db['UserProfileResource'][_0xec94('0x34')]({'where':{'type':_0x19c975,'resourceId':_0x3f4163['id']}})[_0xec94('0x31')](function(){return _0x940920;});})[_0xec94('0x31')](function(){_0x21b13a[_0xec94('0x24')](0xcc)[_0xec94('0x25')]();});}};}function handleEntityNotFound(_0x794909,_0x28b54d){return function(_0x4eb13d){if(!_0x4eb13d){_0x794909[_0xec94('0x35')](0x194);}return _0x4eb13d;};}function handleError(_0x3ed59a,_0x53d897){_0x53d897=_0x53d897||0x1f4;return function(_0x5c435e){logger[_0xec94('0x20')](_0x5c435e[_0xec94('0x36')]);if(_0x5c435e[_0xec94('0x37')]){delete _0x5c435e['name'];}_0x3ed59a['status'](_0x53d897)[_0xec94('0x38')](_0x5c435e);};}exports[_0xec94('0x39')]=function(_0x335156,_0x1be860){var _0x3ae6da={'include':[{'model':db[_0xec94('0x3a')],'as':_0xec94('0x3b')}]},_0x42b912={},_0x595b72={'count':0x0,'rows':[]};var _0x7c4a2c=_[_0xec94('0x3c')](db['FaxAccount'][_0xec94('0x3d')],function(_0x6794){return{'name':_0x6794[_0xec94('0x3e')],'type':_0x6794[_0xec94('0x3f')][_0xec94('0x40')]};});_0x42b912[_0xec94('0x41')]=_[_0xec94('0x3c')](_0x7c4a2c,'name');_0x42b912[_0xec94('0x42')]=_['keys'](_0x335156[_0xec94('0x42')]);_0x42b912[_0xec94('0x43')]=_[_0xec94('0x44')](_0x42b912[_0xec94('0x41')],_0x42b912[_0xec94('0x42')]);_0x3ae6da[_0xec94('0x45')]=_['intersection'](_0x42b912[_0xec94('0x41')],qs[_0xec94('0x46')](_0x335156[_0xec94('0x42')][_0xec94('0x46')]));_0x3ae6da[_0xec94('0x45')]=_0x3ae6da[_0xec94('0x45')][_0xec94('0x47')]?_0x3ae6da[_0xec94('0x45')]:_0x42b912['model'];if(!_0x335156[_0xec94('0x42')][_0xec94('0x48')](_0xec94('0x49'))){_0x3ae6da['limit']=qs['limit'](_0x335156[_0xec94('0x42')][_0xec94('0x29')]);_0x3ae6da['offset']=qs['offset'](_0x335156[_0xec94('0x42')][_0xec94('0x27')]);}_0x3ae6da[_0xec94('0x4a')]=qs['sort'](_0x335156[_0xec94('0x42')][_0xec94('0x4b')]);_0x3ae6da['where']=qs[_0xec94('0x43')](_[_0xec94('0x4c')](_0x335156[_0xec94('0x42')],_0x42b912[_0xec94('0x43')]),_0x7c4a2c);if(_0x335156[_0xec94('0x42')]['filter']){_0x3ae6da[_0xec94('0x4d')]=_[_0xec94('0x4e')](_0x3ae6da['where'],{'$or':_[_0xec94('0x3c')](_0x7c4a2c,function(_0x2df09a){if(_0x2df09a[_0xec94('0x3f')]!==_0xec94('0x4f')){var _0xcf25e1={};_0xcf25e1[_0x2df09a[_0xec94('0x37')]]={'$like':'%'+_0x335156[_0xec94('0x42')][_0xec94('0x50')]+'%'};return _0xcf25e1;}})});}_0x3ae6da=_[_0xec94('0x4e')]({},_0x3ae6da,_0x335156[_0xec94('0x51')]);var _0x27da96={'where':_0x3ae6da[_0xec94('0x4d')]};return db['FaxAccount'][_0xec94('0x2a')](_0x27da96)[_0xec94('0x31')](function(_0x4c747e){_0x595b72[_0xec94('0x2a')]=_0x4c747e;if(_0x335156[_0xec94('0x42')][_0xec94('0x52')]){_0x3ae6da['include']=[{'all':!![]}];}return db[_0xec94('0x53')][_0xec94('0x54')](_0x3ae6da);})['then'](function(_0x1e70f0){_0x595b72['rows']=_0x1e70f0;return _0x595b72;})['then'](respondWithFilteredResult(_0x1be860,_0x3ae6da))[_0xec94('0x23')](handleError(_0x1be860,null));};exports[_0xec94('0x55')]=function(_0x14654d,_0x3889d3){var _0x4ac2e0={'raw':![],'where':{'id':_0x14654d[_0xec94('0x56')]['id']},'include':[{'model':db[_0xec94('0x3a')],'as':'mandatoryDispositionPause'}]},_0x42f5de={};_0x42f5de[_0xec94('0x41')]=_[_0xec94('0x57')](db[_0xec94('0x53')][_0xec94('0x3d')]);_0x42f5de['query']=_['keys'](_0x14654d['query']);_0x42f5de[_0xec94('0x43')]=_[_0xec94('0x44')](_0x42f5de[_0xec94('0x41')],_0x42f5de[_0xec94('0x42')]);_0x4ac2e0[_0xec94('0x45')]=_[_0xec94('0x44')](_0x42f5de['model'],qs[_0xec94('0x46')](_0x14654d[_0xec94('0x42')]['fields']));_0x4ac2e0[_0xec94('0x45')]=_0x4ac2e0[_0xec94('0x45')][_0xec94('0x47')]?_0x4ac2e0[_0xec94('0x45')]:_0x42f5de[_0xec94('0x41')];if(_0x14654d[_0xec94('0x42')][_0xec94('0x52')]){_0x4ac2e0[_0xec94('0x58')]=[{'all':!![]}];}_0x4ac2e0=_['merge']({},_0x4ac2e0,_0x14654d[_0xec94('0x51')]);return db[_0xec94('0x53')][_0xec94('0x59')](_0x4ac2e0)[_0xec94('0x31')](handleEntityNotFound(_0x3889d3,null))['then'](respondWithResult(_0x3889d3,null))[_0xec94('0x23')](handleError(_0x3889d3,null));};exports[_0xec94('0x5a')]=function(_0xc0191f,_0x29927c){return db['FaxAccount'][_0xec94('0x5a')](_0xc0191f['body'],{})[_0xec94('0x31')](function(_0x269c5d){var _0x5aa1b2=_0xc0191f[_0xec94('0x5b')][_0xec94('0x32')]({'plain':!![]});if(!_0x5aa1b2)throw new Error(_0xec94('0x5c'));if(_0x5aa1b2[_0xec94('0x5d')]===_0xec94('0x5b')){var _0x9816f5=_0x269c5d[_0xec94('0x32')]({'plain':!![]});var _0x2fc7e7='FaxAccounts';return db[_0xec94('0x5e')]['find']({'where':{'name':_0x2fc7e7,'userProfileId':_0x5aa1b2[_0xec94('0x5f')]},'raw':!![]})[_0xec94('0x31')](function(_0x5167d9){if(_0x5167d9&&_0x5167d9[_0xec94('0x60')]===0x0){return db['UserProfileResource'][_0xec94('0x5a')]({'name':_0x9816f5['name'],'resourceId':_0x9816f5['id'],'type':_0x5167d9[_0xec94('0x37')],'sectionId':_0x5167d9['id']},{})['then'](function(){return _0x269c5d;});}else{return _0x269c5d;}})[_0xec94('0x23')](function(_0x3a7bc8){logger['error'](_0xec94('0x61'),_0x3a7bc8);throw _0x3a7bc8;});}return _0x269c5d;})[_0xec94('0x31')](respondWithResult(_0x29927c,0xc9))[_0xec94('0x23')](handleError(_0x29927c,null));};exports['update']=function(_0x3d50eb,_0x3ba8bb){if(_0x3d50eb[_0xec94('0x62')]['id']){delete _0x3d50eb['body']['id'];}return db['FaxAccount']['find']({'where':{'id':_0x3d50eb[_0xec94('0x56')]['id']},'include':[{'model':db[_0xec94('0x3a')],'as':_0xec94('0x3b')}]})[_0xec94('0x31')](handleEntityNotFound(_0x3ba8bb,null))['then'](saveUpdates(_0x3d50eb[_0xec94('0x62')],null))[_0xec94('0x31')](respondWithResult(_0x3ba8bb,null))['catch'](handleError(_0x3ba8bb,null));};exports[_0xec94('0x34')]=function(_0x276a98,_0x4d9acc){return db[_0xec94('0x53')][_0xec94('0x59')]({'where':{'id':_0x276a98[_0xec94('0x56')]['id']}})['then'](handleEntityNotFound(_0x4d9acc,null))['then'](removeEntity(_0x4d9acc,null))['catch'](handleError(_0x4d9acc,null));};exports[_0xec94('0x63')]=function(_0x200291,_0x46c2bf){return db['FaxAccount'][_0xec94('0x63')]()[_0xec94('0x31')](respondWithResult(_0x46c2bf,null))[_0xec94('0x23')](handleError(_0x46c2bf,null));};exports['addDisposition']=function(_0x568241,_0x3ac33d,_0x55d54e){if(_0x568241[_0xec94('0x62')]['id']){delete _0x568241[_0xec94('0x62')]['id'];}return db[_0xec94('0x53')][_0xec94('0x59')]({'where':{'id':_0x568241[_0xec94('0x56')]['id']}})[_0xec94('0x31')](handleEntityNotFound(_0x3ac33d,null))['then'](function(_0x3befad){if(_0x3befad){_0x568241[_0xec94('0x62')][_0xec94('0x64')]=_0x3befad['id'];return db[_0xec94('0x65')]['create'](_0x568241['body']);}})[_0xec94('0x31')](respondWithResult(_0x3ac33d,null))['catch'](handleError(_0x3ac33d,null));};exports[_0xec94('0x66')]=function(_0x8e4916,_0xfd11cd,_0x17b4eb){var _0x316fcf={'raw':![],'where':{}};var _0x5cae43={};var _0x122d36={'count':0x0,'rows':[]};return db['FaxAccount'][_0xec94('0x67')]({'where':{'id':_0x8e4916[_0xec94('0x56')]['id']}})[_0xec94('0x31')](handleEntityNotFound(_0xfd11cd,null))[_0xec94('0x31')](function(_0x1484d0){if(_0x1484d0){_0x5cae43[_0xec94('0x41')]=_['keys'](db[_0xec94('0x65')][_0xec94('0x3d')]);_0x5cae43[_0xec94('0x42')]=_[_0xec94('0x57')](_0x8e4916[_0xec94('0x42')]);_0x5cae43[_0xec94('0x43')]=_[_0xec94('0x44')](_0x5cae43[_0xec94('0x41')],_0x5cae43[_0xec94('0x42')]);_0x316fcf['attributes']=_[_0xec94('0x44')](_0x5cae43[_0xec94('0x41')],qs[_0xec94('0x46')](_0x8e4916[_0xec94('0x42')][_0xec94('0x46')]));_0x316fcf[_0xec94('0x45')]=_0x316fcf[_0xec94('0x45')]['length']?_0x316fcf['attributes']:_0x5cae43['model'];if(!_0x8e4916['query'][_0xec94('0x48')](_0xec94('0x49'))){_0x316fcf['limit']=qs[_0xec94('0x29')](_0x8e4916[_0xec94('0x42')]['limit']);_0x316fcf['offset']=qs[_0xec94('0x27')](_0x8e4916[_0xec94('0x42')]['offset']);}_0x316fcf[_0xec94('0x4a')]=qs[_0xec94('0x4b')](_0x8e4916['query']['sort']);_0x316fcf[_0xec94('0x4d')]=qs[_0xec94('0x43')](_[_0xec94('0x4c')](_0x8e4916[_0xec94('0x42')],_0x5cae43[_0xec94('0x43')]));_0x316fcf[_0xec94('0x4d')]['FaxAccountId']=_0x1484d0['id'];if(_0x8e4916[_0xec94('0x42')]['filter']){_0x316fcf[_0xec94('0x4d')]=_['merge'](_0x316fcf['where'],{'$or':_[_0xec94('0x3c')](_0x316fcf[_0xec94('0x45')],function(_0x7f455f){var _0x58ab38={};_0x58ab38[_0x7f455f]={'$like':'%'+_0x8e4916[_0xec94('0x42')][_0xec94('0x50')]+'%'};return _0x58ab38;})});}_0x316fcf=_[_0xec94('0x4e')]({},_0x316fcf,_0x8e4916[_0xec94('0x51')]);return db[_0xec94('0x65')][_0xec94('0x2a')]({'where':_0x316fcf[_0xec94('0x4d')]})[_0xec94('0x31')](function(_0x5cd243){_0x122d36[_0xec94('0x2a')]=_0x5cd243;if(_0x8e4916[_0xec94('0x42')][_0xec94('0x52')]){_0x316fcf[_0xec94('0x58')]=[{'all':!![]}];}return db['Disposition'][_0xec94('0x54')](_0x316fcf);})[_0xec94('0x31')](function(_0x3452cd){_0x122d36[_0xec94('0x68')]=_0x3452cd;return _0x122d36;});}})['then'](respondWithFilteredResult(_0xfd11cd,_0x316fcf))[_0xec94('0x23')](handleError(_0xfd11cd,null));};exports[_0xec94('0x69')]=function(_0x111445,_0x1365d3,_0x5eeace){return db['FaxAccount']['find']({'where':{'id':_0x111445[_0xec94('0x56')]['id']}})[_0xec94('0x31')](handleEntityNotFound(_0x1365d3,null))[_0xec94('0x31')](function(_0x53f3bf){if(_0x53f3bf){return _0x53f3bf[_0xec94('0x69')](_0x111445[_0xec94('0x42')][_0xec94('0x6a')]);}})[_0xec94('0x31')](respondWithStatusCode(_0x1365d3,null))[_0xec94('0x23')](handleError(_0x1365d3,null));};exports[_0xec94('0x6b')]=function(_0x2bc86b,_0x468d95,_0x3eafb8){if(_0x2bc86b[_0xec94('0x62')]['id']){delete _0x2bc86b[_0xec94('0x62')]['id'];}return db[_0xec94('0x53')][_0xec94('0x59')]({'where':{'id':_0x2bc86b[_0xec94('0x56')]['id']}})[_0xec94('0x31')](handleEntityNotFound(_0x468d95,null))[_0xec94('0x31')](function(_0x1fc3c7){if(_0x1fc3c7){_0x2bc86b[_0xec94('0x62')]['FaxAccountId']=_0x1fc3c7['id'];return db[_0xec94('0x6c')]['create'](_0x2bc86b[_0xec94('0x62')]);}})['then'](respondWithResult(_0x468d95,null))[_0xec94('0x23')](handleError(_0x468d95,null));};exports['getAnswers']=function(_0x550e89,_0xdadaf5,_0x82a4c0){var _0x3534f2={'raw':![],'where':{}};var _0x505814={};var _0x435b4a={'count':0x0,'rows':[]};return db[_0xec94('0x53')][_0xec94('0x67')]({'where':{'id':_0x550e89[_0xec94('0x56')]['id']}})[_0xec94('0x31')](handleEntityNotFound(_0xdadaf5,null))[_0xec94('0x31')](function(_0x3214ed){if(_0x3214ed){_0x505814[_0xec94('0x41')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x505814[_0xec94('0x42')]=_[_0xec94('0x57')](_0x550e89[_0xec94('0x42')]);_0x505814['filters']=_['intersection'](_0x505814[_0xec94('0x41')],_0x505814['query']);_0x3534f2[_0xec94('0x45')]=_['intersection'](_0x505814[_0xec94('0x41')],qs[_0xec94('0x46')](_0x550e89[_0xec94('0x42')][_0xec94('0x46')]));_0x3534f2[_0xec94('0x45')]=_0x3534f2[_0xec94('0x45')][_0xec94('0x47')]?_0x3534f2['attributes']:_0x505814[_0xec94('0x41')];if(!_0x550e89[_0xec94('0x42')][_0xec94('0x48')](_0xec94('0x49'))){_0x3534f2[_0xec94('0x29')]=qs['limit'](_0x550e89[_0xec94('0x42')][_0xec94('0x29')]);_0x3534f2[_0xec94('0x27')]=qs[_0xec94('0x27')](_0x550e89['query'][_0xec94('0x27')]);}_0x3534f2[_0xec94('0x4a')]=qs[_0xec94('0x4b')](_0x550e89['query'][_0xec94('0x4b')]);_0x3534f2[_0xec94('0x4d')]=qs[_0xec94('0x43')](_[_0xec94('0x4c')](_0x550e89[_0xec94('0x42')],_0x505814[_0xec94('0x43')]));_0x3534f2[_0xec94('0x4d')][_0xec94('0x64')]=_0x3214ed['id'];if(_0x550e89[_0xec94('0x42')]['filter']){_0x3534f2[_0xec94('0x4d')]=_[_0xec94('0x4e')](_0x3534f2[_0xec94('0x4d')],{'$or':_[_0xec94('0x3c')](_0x3534f2[_0xec94('0x45')],function(_0x99a807){var _0x467b12={};_0x467b12[_0x99a807]={'$like':'%'+_0x550e89[_0xec94('0x42')][_0xec94('0x50')]+'%'};return _0x467b12;})});}_0x3534f2=_[_0xec94('0x4e')]({},_0x3534f2,_0x550e89['options']);return db[_0xec94('0x6c')]['count']({'where':_0x3534f2[_0xec94('0x4d')]})['then'](function(_0x52d3d1){_0x435b4a[_0xec94('0x2a')]=_0x52d3d1;if(_0x550e89[_0xec94('0x42')][_0xec94('0x52')]){_0x3534f2[_0xec94('0x58')]=[{'all':!![]}];}return db[_0xec94('0x6c')][_0xec94('0x54')](_0x3534f2);})[_0xec94('0x31')](function(_0x27c344){_0x435b4a[_0xec94('0x68')]=_0x27c344;return _0x435b4a;});}})[_0xec94('0x31')](respondWithFilteredResult(_0xdadaf5,_0x3534f2))['catch'](handleError(_0xdadaf5,null));};exports[_0xec94('0x6d')]=function(_0x517828,_0x45e68d,_0x4de955){return db[_0xec94('0x53')]['find']({'where':{'id':_0x517828[_0xec94('0x56')]['id']}})[_0xec94('0x31')](handleEntityNotFound(_0x45e68d,null))[_0xec94('0x31')](function(_0x4cab0f){if(_0x4cab0f){return _0x4cab0f[_0xec94('0x6d')](_0x517828['query'][_0xec94('0x6a')]);}})['then'](respondWithStatusCode(_0x45e68d,null))[_0xec94('0x23')](handleError(_0x45e68d,null));};exports[_0xec94('0x6e')]=function(_0x22ab4b,_0x4f127c,_0x472420){return db[_0xec94('0x6f')][_0xec94('0x59')]({'where':{'id':_0x22ab4b[_0xec94('0x56')]['id']}})['then'](handleEntityNotFound(_0x4f127c,null))['then'](function(_0x4248d3){if(_0x4248d3){return _0x4248d3[_0xec94('0x6e')](_0x22ab4b[_0xec94('0x62')][_0xec94('0x6a')],_[_0xec94('0x70')](_0x22ab4b[_0xec94('0x62')],['ids','id'])||{});}})[_0xec94('0x31')](respondWithResult(_0x4f127c,null))[_0xec94('0x23')](handleError(_0x4f127c,null));};exports[_0xec94('0x71')]=function(_0x1d05aa,_0x21ebf2,_0x593a31){var _0x5673a9={'raw':![],'where':{}};var _0x59fb1c={};var _0x376cd7={'count':0x0,'rows':[]};return db[_0xec94('0x53')][_0xec94('0x67')]({'where':{'id':_0x1d05aa[_0xec94('0x56')]['id']}})[_0xec94('0x31')](handleEntityNotFound(_0x21ebf2,null))[_0xec94('0x31')](function(_0x57c2ca){if(_0x57c2ca){_0x59fb1c[_0xec94('0x41')]=_[_0xec94('0x57')](db[_0xec94('0x6f')][_0xec94('0x3d')]);_0x59fb1c[_0xec94('0x42')]=_[_0xec94('0x57')](_0x1d05aa['query']);_0x59fb1c[_0xec94('0x43')]=_[_0xec94('0x44')](_0x59fb1c[_0xec94('0x41')],_0x59fb1c[_0xec94('0x42')]);_0x5673a9[_0xec94('0x45')]=_[_0xec94('0x44')](_0x59fb1c[_0xec94('0x41')],qs[_0xec94('0x46')](_0x1d05aa[_0xec94('0x42')]['fields']));_0x5673a9[_0xec94('0x45')]=_0x5673a9[_0xec94('0x45')]['length']?_0x5673a9[_0xec94('0x45')]:_0x59fb1c[_0xec94('0x41')];if(!_0x1d05aa[_0xec94('0x42')]['hasOwnProperty'](_0xec94('0x49'))){_0x5673a9[_0xec94('0x29')]=qs[_0xec94('0x29')](_0x1d05aa[_0xec94('0x42')]['limit']);_0x5673a9[_0xec94('0x27')]=qs[_0xec94('0x27')](_0x1d05aa[_0xec94('0x42')][_0xec94('0x27')]);}_0x5673a9['order']=qs['sort'](_0x1d05aa['query'][_0xec94('0x4b')]);_0x5673a9[_0xec94('0x4d')]=qs['filters'](_['pick'](_0x1d05aa['query'],_0x59fb1c[_0xec94('0x43')]));_0x5673a9[_0xec94('0x4d')][_0xec94('0x64')]=_0x57c2ca['id'];if(_0x1d05aa[_0xec94('0x42')][_0xec94('0x50')]){_0x5673a9['where']=_[_0xec94('0x4e')](_0x5673a9[_0xec94('0x4d')],{'$or':_[_0xec94('0x3c')](_0x5673a9[_0xec94('0x45')],function(_0x589e3e){var _0x55d215={};_0x55d215[_0x589e3e]={'$like':'%'+_0x1d05aa[_0xec94('0x42')][_0xec94('0x50')]+'%'};return _0x55d215;})});}_0x5673a9=_['merge']({},_0x5673a9,_0x1d05aa['options']);return db[_0xec94('0x6f')][_0xec94('0x2a')]({'where':_0x5673a9[_0xec94('0x4d')]})[_0xec94('0x31')](function(_0x1903a0){_0x376cd7[_0xec94('0x2a')]=_0x1903a0;if(_0x1d05aa['query'][_0xec94('0x52')]){_0x5673a9[_0xec94('0x58')]=[{'model':db[_0xec94('0x72')],'as':'Contact','required':![]},{'model':db[_0xec94('0x73')],'as':_0xec94('0x74'),'attributes':['name',_0xec94('0x75'),'internal'],'required':![]},{'model':db[_0xec94('0x76')],'as':_0xec94('0x77'),'attributes':['id',_0xec94('0x37'),'color'],'where':_0x1d05aa[_0xec94('0x42')][_0xec94('0x78')]?{'id':_0x1d05aa[_0xec94('0x42')][_0xec94('0x78')]}:undefined,'required':_0x1d05aa['query']['tag']?!![]:![]}];}return db[_0xec94('0x6f')]['findAll'](_0x5673a9);})['then'](function(_0x5e2758){_0x376cd7[_0xec94('0x68')]=_0x5e2758;return _0x376cd7;});}})[_0xec94('0x31')](respondWithFilteredResult(_0x21ebf2,_0x5673a9))[_0xec94('0x23')](handleError(_0x21ebf2,null));};exports[_0xec94('0x79')]=function(_0x2da8a4,_0x210299){var _0x6a39ae=_0x2da8a4[_0xec94('0x56')]['id'];var _0xa96228=_0x2da8a4['body'];var _0x59060e=0xc8;var _0xb2692c=null;return db['sequelize'][_0xec94('0x7a')]({'isolationLevel':db[_0xec94('0x7b')][_0xec94('0x7c')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x1d080b){return db[_0xec94('0x53')][_0xec94('0x67')]({'where':{'id':_0x6a39ae},'transaction':_0x1d080b})['then'](function(_0x31fc8f){if(_0x31fc8f){return db[_0xec94('0x7d')][_0xec94('0x34')]({'where':{'FaxAccountId':_0x6a39ae},'transaction':_0x1d080b})['then'](function(){var _0x983a59=_[_0xec94('0x3c')](_0xa96228,function(_0x2b871b){_0x2b871b[_0xec94('0x64')]=_0x6a39ae;return _0x2b871b;});return db[_0xec94('0x7d')][_0xec94('0x7e')](_0x983a59,{'transaction':_0x1d080b});});}else{_0x59060e=0x194;_0xb2692c=[];}});})['then'](function(){if(_0x59060e!==0x194){return db[_0xec94('0x7d')][_0xec94('0x7f')]({'where':{'FaxAccountId':_0x6a39ae},'order':_0xec94('0x80')})[_0xec94('0x31')](function(_0x5aba2a){_0xb2692c=_0x5aba2a;});}})[_0xec94('0x23')](function(_0x358b01){_0x59060e=0x1f4;logger[_0xec94('0x20')](_0x358b01['stack']);if(_0x358b01[_0xec94('0x37')]){delete _0x358b01['name'];}_0xb2692c=_0x358b01;})[_0xec94('0x81')](function(){if(_0xb2692c===null){_0x210299[_0xec94('0x35')](_0x59060e);}else{if(_0x59060e===0x1f4){_0x210299[_0xec94('0x24')](_0x59060e)[_0xec94('0x38')](_0xb2692c);}else{_0x210299[_0xec94('0x24')](_0x59060e)[_0xec94('0x26')](_0xb2692c);}}});};exports['getApplications']=function(_0x1d5ee8,_0x3b1539,_0x1e8ff9){var _0x203e91={};var _0x278ff9={};var _0x21783f;var _0x25e14a;return db[_0xec94('0x53')][_0xec94('0x67')]({'where':{'id':_0x1d5ee8[_0xec94('0x56')]['id']}})[_0xec94('0x31')](handleEntityNotFound(_0x3b1539,null))[_0xec94('0x31')](function(_0x50d073){if(_0x50d073){_0x21783f=_0x50d073;_0x278ff9[_0xec94('0x41')]=_[_0xec94('0x57')](db['FaxApplication'][_0xec94('0x3d')]);_0x278ff9[_0xec94('0x42')]=_[_0xec94('0x57')](_0x1d5ee8[_0xec94('0x42')]);_0x278ff9[_0xec94('0x43')]=_['intersection'](_0x278ff9[_0xec94('0x41')],_0x278ff9[_0xec94('0x42')]);_0x203e91[_0xec94('0x45')]=_['intersection'](_0x278ff9[_0xec94('0x41')],qs[_0xec94('0x46')](_0x1d5ee8['query']['fields']));_0x203e91[_0xec94('0x45')]=_0x203e91[_0xec94('0x45')][_0xec94('0x47')]?_0x203e91[_0xec94('0x45')]:_0x278ff9[_0xec94('0x41')];_0x203e91[_0xec94('0x4a')]=qs['sort'](_0x1d5ee8['query'][_0xec94('0x4b')]);_0x203e91[_0xec94('0x4d')]=qs[_0xec94('0x43')](_[_0xec94('0x4c')](_0x1d5ee8['query'],_0x278ff9[_0xec94('0x43')]));if(_0x1d5ee8[_0xec94('0x42')][_0xec94('0x50')]){_0x203e91[_0xec94('0x4d')]=_[_0xec94('0x4e')](_0x203e91[_0xec94('0x4d')],{'$or':_[_0xec94('0x3c')](_0x203e91[_0xec94('0x45')],function(_0x5f374e){var _0x51c5f4={};_0x51c5f4[_0x5f374e]={'$like':'%'+_0x1d5ee8[_0xec94('0x42')][_0xec94('0x50')]+'%'};return _0x51c5f4;})});}_0x203e91=_[_0xec94('0x4e')]({},_0x203e91,_0x1d5ee8[_0xec94('0x51')]);return _0x21783f['getApplications'](_0x203e91);}})[_0xec94('0x31')](function(_0x45efe5){if(_0x45efe5){_0x25e14a=_0x45efe5['length'];if(!_0x1d5ee8[_0xec94('0x42')]['hasOwnProperty']('nolimit')){_0x203e91[_0xec94('0x29')]=qs['limit'](_0x1d5ee8['query']['limit']);_0x203e91[_0xec94('0x27')]=qs[_0xec94('0x27')](_0x1d5ee8[_0xec94('0x42')][_0xec94('0x27')]);}return _0x21783f['getApplications'](_0x203e91);}})[_0xec94('0x31')](function(_0x5c82a3){if(_0x5c82a3){return _0x5c82a3?{'count':_0x25e14a,'rows':_0x5c82a3}:null;}})[_0xec94('0x31')](respondWithResult(_0x3b1539,null))[_0xec94('0x23')](handleError(_0x3b1539,null));};function Extension(_0x586fcd,_0x1fb942,_0x57a78b,_0x4c0920){this['context']=_0xec94('0x82');this[_0xec94('0x83')]=_0x586fcd['localstationid'];this[_0xec94('0x84')]=_0x4c0920;this[_0xec94('0x3f')]=_0xec94('0x85');this[_0xec94('0x86')]=_0xec94('0x87');this['FaxAccountId']=_0x586fcd['id'];this[_0xec94('0x80')]=_0x1fb942;this[_0xec94('0x88')]=_0x57a78b;}function createExtensionsReciveFax(_0x4bc5c4){var _0xd1f2a5=0x1;var _0x3547cf=[];_0x3547cf[_0xec94('0x89')](new Extension(_0x4bc5c4,_0xd1f2a5,'',_0xec94('0x8a')));_0xd1f2a5+=0x1;_0x3547cf[_0xec94('0x89')](new Extension(_0x4bc5c4,_0xd1f2a5,'CDR(type)=inbound-fax',_0xec94('0x8b')));_0xd1f2a5+=0x1;for(var _0x5bc093 in _0x4bc5c4){if(_0x4bc5c4['hasOwnProperty'](_0x5bc093)&&(_0x5bc093===_0xec94('0x8c')||_0x5bc093==='localstationid'||_0x5bc093==='gateway'||_0x5bc093===_0xec94('0x8d')||_0x5bc093===_0xec94('0x8e')||_0x5bc093===_0xec94('0x8f')||_0x5bc093===_0xec94('0x90')||_0x5bc093===_0xec94('0x91')||_0x5bc093===_0xec94('0x92'))){_0x3547cf[_0xec94('0x89')](new Extension(_0x4bc5c4,_0xd1f2a5,_0xec94('0x93')+_0x5bc093+')='+_0x4bc5c4[_0x5bc093],'Set'));_0xd1f2a5+=0x1;}}_0x3547cf['push'](new Extension(_0x4bc5c4,_0xd1f2a5,'6',_0xec94('0x94')));_0xd1f2a5+=0x1;_0x3547cf[_0xec94('0x89')](new Extension(_0x4bc5c4,_0xd1f2a5,_0xec94('0x95'),'ReceiveFax'));_0xd1f2a5=0x0;return _0x3547cf;}exports['addAccountApplications']=function(_0x2dbb1b,_0x52c478,_0x1a461b){var _0x5d6ef7;return db[_0xec94('0x7b')][_0xec94('0x7a')](function(_0x48a8c7){return db[_0xec94('0x53')][_0xec94('0x5a')](_0x2dbb1b[_0xec94('0x62')],{'transaction':_0x48a8c7})[_0xec94('0x31')](function(_0x4d9562){_0x5d6ef7=_0x4d9562[_0xec94('0x32')]({'plain':!![]});return db[_0xec94('0x96')][_0xec94('0x7e')](createExtensionsReciveFax(_0x5d6ef7),{'transaction':_0x48a8c7});});})[_0xec94('0x31')](function(){return _0x5d6ef7;})[_0xec94('0x31')](respondWithResult(_0x52c478,null))[_0xec94('0x23')](handleError(_0x52c478,null));};exports[_0xec94('0x97')]=function(_0xd48acd,_0x128d48,_0x3449e8){var _0x16da9d;return db[_0xec94('0x7b')][_0xec94('0x7a')](function(_0x13ae2c){return db[_0xec94('0x53')][_0xec94('0x30')](_0xd48acd[_0xec94('0x62')],{'where':{'id':_0xd48acd[_0xec94('0x62')]['id']},'transaction':_0x13ae2c})[_0xec94('0x31')](function(_0x6940b2){return db[_0xec94('0x96')][_0xec94('0x34')]({'where':{'FaxAccountId':_0xd48acd[_0xec94('0x62')]['id']},'transaction':_0x13ae2c})[_0xec94('0x31')](function(_0x7758a8){return db[_0xec94('0x96')]['bulkCreate'](createExtensionsReciveFax(_['omit'](_0xd48acd[_0xec94('0x62')],[_0xec94('0x98'),'key',_0xec94('0x99'),_0xec94('0x9a'),_0xec94('0x9b'),_0xec94('0x9c')])),{'transaction':_0x13ae2c});});});})[_0xec94('0x31')](function(){return db[_0xec94('0x53')][_0xec94('0x9d')](_0xd48acd[_0xec94('0x62')]['id']);})[_0xec94('0x31')](respondWithResult(_0x128d48,null))[_0xec94('0x23')](handleError(_0x128d48,null));};exports[_0xec94('0x9e')]=function(_0x2bfbf2,_0x255268,_0x1cc01a){var _0x5cb399={'raw':!![],'where':{}};var _0x566d94={};var _0x5b5dca={'count':0x0,'rows':[]};return db[_0xec94('0x53')]['findOne']({'where':{'id':_0x2bfbf2[_0xec94('0x56')]['id']}})[_0xec94('0x31')](handleEntityNotFound(_0x255268,null))[_0xec94('0x31')](function(_0x48a0b5){if(_0x48a0b5){_0x566d94['model']=_[_0xec94('0x57')](db[_0xec94('0x9f')][_0xec94('0x3d')]);_0x566d94[_0xec94('0x42')]=_[_0xec94('0x57')](_0x2bfbf2[_0xec94('0x42')]);_0x566d94[_0xec94('0x43')]=_['intersection'](_0x566d94[_0xec94('0x41')],_0x566d94[_0xec94('0x42')]);_0x5cb399['attributes']=_[_0xec94('0x44')](_0x566d94['model'],qs[_0xec94('0x46')](_0x2bfbf2[_0xec94('0x42')][_0xec94('0x46')]));_0x5cb399['attributes']=_0x5cb399[_0xec94('0x45')][_0xec94('0x47')]?_0x5cb399[_0xec94('0x45')]:_0x566d94[_0xec94('0x41')];if(!_0x2bfbf2[_0xec94('0x42')]['hasOwnProperty'](_0xec94('0x49'))){_0x5cb399[_0xec94('0x29')]=qs[_0xec94('0x29')](_0x2bfbf2[_0xec94('0x42')][_0xec94('0x29')]);_0x5cb399['offset']=qs[_0xec94('0x27')](_0x2bfbf2[_0xec94('0x42')]['offset']);}_0x5cb399[_0xec94('0x4a')]=qs[_0xec94('0x4b')](_0x2bfbf2['query'][_0xec94('0x4b')]);_0x5cb399[_0xec94('0x4d')]=qs[_0xec94('0x43')](_[_0xec94('0x4c')](_0x2bfbf2[_0xec94('0x42')],_0x566d94[_0xec94('0x43')]));_0x5cb399[_0xec94('0x4d')][_0xec94('0x64')]=_0x48a0b5['id'];if(_0x2bfbf2['query'][_0xec94('0x50')]){_0x5cb399[_0xec94('0x4d')]=_[_0xec94('0x4e')](_0x5cb399[_0xec94('0x4d')],{'$or':_['map'](_0x5cb399[_0xec94('0x45')],function(_0x29c289){var _0x2cd1c9={};_0x2cd1c9[_0x29c289]={'$like':'%'+_0x2bfbf2[_0xec94('0x42')][_0xec94('0x50')]+'%'};return _0x2cd1c9;})});}if(_0x2bfbf2[_0xec94('0x42')][_0xec94('0xa0')]){var _0x30ac3b=_0x2bfbf2[_0xec94('0x42')][_0xec94('0xa0')][_0xec94('0xa1')](',');var _0x1eeb84={};_0x1eeb84[_0x30ac3b[0x0]]={'$gte':moment(_0x30ac3b[0x1])[_0xec94('0xa2')](_0xec94('0xa3'))};_0x5cb399[_0xec94('0x4d')]=_[_0xec94('0x4e')](_0x5cb399['where'],_0x1eeb84);}_0x5cb399=_[_0xec94('0x4e')]({},_0x5cb399,_0x2bfbf2['options']);return db['FaxMessage'][_0xec94('0x2a')]({'where':_0x5cb399[_0xec94('0x4d')]})['then'](function(_0x601178){_0x5b5dca['count']=_0x601178;if(_0x2bfbf2[_0xec94('0x42')][_0xec94('0x52')]){_0x5cb399[_0xec94('0x58')]=[{'all':!![]}];}return db['FaxMessage'][_0xec94('0x54')](_0x5cb399);})[_0xec94('0x31')](function(_0x2ebaf1){_0x5b5dca[_0xec94('0x68')]=_0x2ebaf1;return _0x5b5dca;});}})[_0xec94('0x31')](respondWithFilteredResult(_0x255268,_0x5cb399))[_0xec94('0x23')](handleError(_0x255268,null));};exports[_0xec94('0x38')]=function(_0x568f4c,_0x317237,_0x229170){var _0x12b250,_0x377f05={},_0x1a87b1;if(_0x568f4c[_0xec94('0x62')]['to']){_0x1a87b1=_0x568f4c[_0xec94('0x62')]['to'][0x0];}return db[_0xec94('0x53')][_0xec94('0x59')]({'where':{'id':_0x568f4c['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0xec94('0xa4'),'where':{'fax':_0x1a87b1},'limit':0x1,'order':[[_0xec94('0x9a'),_0xec94('0xa5')]]}]}]})['then'](handleEntityNotFound(_0x317237,null))[_0xec94('0x31')](function(_0x4365d0){_0x12b250=_0x4365d0;if(_0x568f4c['body'][_0xec94('0xa6')]&&_0x568f4c[_0xec94('0x62')]['attachments']['length']){for(var _0x180ed8=0x0;_0x180ed8<_0x568f4c[_0xec94('0x62')]['attachments'][_0xec94('0x47')];_0x180ed8+=0x1){_0x568f4c[_0xec94('0x62')][_0xec94('0xa6')][_0x180ed8]={'filename':_0x568f4c[_0xec94('0x62')][_0xec94('0xa6')][_0x180ed8][_0xec94('0x37')],'id':_0x568f4c[_0xec94('0x62')]['attachments'][_0x180ed8]['id'],'path':path[_0xec94('0xa7')](config[_0xec94('0xa8')],_0xec94('0xa9'),_0x568f4c[_0xec94('0x62')]['attachments'][_0x180ed8][_0xec94('0xaa')])};}}return respondWithRpcPromise(_0xec94('0xab'),_0xec94('0xab'),{'FaxAccountId':_['isNil'](_0x568f4c[_0xec94('0x56')]['id'])?undefined:_0x568f4c[_0xec94('0x56')]['id'],'path':_[_0xec94('0xac')](_0x568f4c[_0xec94('0x62')][_0xec94('0xa6')][0x0][_0xec94('0xad')])?undefined:_0x568f4c[_0xec94('0x62')][_0xec94('0xa6')][0x0][_0xec94('0xad')],'fax':_[_0xec94('0xac')](_0x568f4c[_0xec94('0x62')]['to'][0x0])?undefined:_0x568f4c[_0xec94('0x62')]['to'][0x0]},client9002);})['then'](function(){if(_0x12b250){if(_[_0xec94('0xac')](_0x568f4c[_0xec94('0x62')][_0xec94('0xae')])){_0x568f4c['body'][_0xec94('0xae')]=util['format']('\x22%s\x22\x20<%s>',_0x12b250[_0xec94('0x37')],_0x12b250['fax']);}if(_0x12b250[_0xec94('0xaf')]){if(_0x12b250[_0xec94('0xaf')][_0xec94('0xa4')][_0xec94('0x47')]){return _0x12b250['List'][_0xec94('0xa4')][0x0];}else{return db['CmContact'][_0xec94('0x5a')](_[_0xec94('0x14')](_0x568f4c[_0xec94('0x62')],{'firstName':_0x568f4c['body']['to'][0x0],'phone':_0x568f4c['body']['to'][0x0],'fax':_0x568f4c[_0xec94('0x62')]['to'][0x0],'ListId':_0x12b250[_0xec94('0x9c')]}));}}else{throw new Error(_0xec94('0xb0'));}}else{throw new Error(_0xec94('0xb1'));}})[_0xec94('0x31')](function(_0x551de6){if(_0x551de6){return db[_0xec94('0x6f')][_0xec94('0x59')]({'where':{'ContactId':_0x551de6['id'],'closed':![],'FaxAccountId':_0x12b250['id']}})[_0xec94('0x31')](function(_0x4abd72){if(_0x4abd72){return[_0x4abd72,![]];}return db['FaxInteraction'][_0xec94('0x5a')]({'UserId':_0x568f4c[_0xec94('0x5b')]['id'],'ContactId':_0x551de6['id'],'FaxAccountId':_0x12b250['id'],'fax':_0x568f4c[_0xec94('0x62')]['to'][0x0],'firstMsgDirection':_0xec94('0xb2'),'Messages':[_[_0xec94('0x4e')](_0x568f4c[_0xec94('0x62')],{'read':![],'body':_0x568f4c[_0xec94('0x62')][_0xec94('0xa6')][0x0][_0xec94('0xb3')],'FaxAccountId':_0x12b250['id'],'UserId':_0x568f4c['user']['id'],'ContactId':_0x551de6['id'],'AttachmentId':_0x568f4c[_0xec94('0x62')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xec94('0x9f')],'as':_0xec94('0xb4')}]})[_0xec94('0x31')](function(_0x5835c0){return[_0x5835c0,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xec94('0xb5')](function(_0x5ead76,_0x1c8f39){if(_0x1c8f39){return _0x5ead76;}return db['FaxMessage'][_0xec94('0x5a')]({'direction':'out','read':![],'body':_0x568f4c['body'][_0xec94('0xa6')][0x0][_0xec94('0xb3')],'FaxAccountId':_0x12b250['id'],'FaxInteractionId':_0x5ead76['id'],'UserId':_0x568f4c['user']['id'],'ContactId':_0x5ead76['ContactId'],'AttachmentId':_0x568f4c[_0xec94('0x62')][_0xec94('0xa6')][0x0]['id']})[_0xec94('0x31')](function(_0x5c7a4e){_0x5ead76[_0xec94('0xb6')][_0xec94('0xb4')]=[];_0x5ead76[_0xec94('0xb6')][_0xec94('0xb4')][_0xec94('0x89')](_0x5c7a4e['dataValues']);return _0x5ead76;});})[_0xec94('0x31')](function(_0x1540ad){respondWithRpcPromise(_0xec94('0xb7'),_0xec94('0xb7'),{'FaxAccountId':_[_0xec94('0xac')](_0x568f4c[_0xec94('0x56')]['id'])?undefined:_0x568f4c['params']['id'],'path':_[_0xec94('0xac')](_0x568f4c[_0xec94('0x62')][_0xec94('0xa6')][0x0]['path'])?undefined:_0x568f4c['body'][_0xec94('0xa6')][0x0][_0xec94('0xad')],'fax':_[_0xec94('0xac')](_0x568f4c['body']['to'][0x0])?undefined:_0x568f4c[_0xec94('0x62')]['to'][0x0],'AttachmentId':_0x568f4c[_0xec94('0x62')]['attachments'][0x0]['id']},client9002)[_0xec94('0x31')](function(_0x4e75e5){logger[_0xec94('0x1a')](_0xec94('0xb8'),_0x4e75e5);})[_0xec94('0x23')](function(_0x4fac02){logger[_0xec94('0x1a')](_0xec94('0xb8'),_0x4fac02);});return _0x1540ad;})[_0xec94('0x31')](respondWithResult(_0x317237,null))[_0xec94('0x23')](handleError(_0x317237,null));};exports[_0xec94('0xb9')]=function(_0x2d111d,_0x404e8e,_0x37c56a){return db['FaxAccount'][_0xec94('0x59')]({'where':{'id':_0x2d111d['params']['id']}})[_0xec94('0x31')](handleEntityNotFound(_0x404e8e,null))[_0xec94('0x31')](function(_0x15eaee){if(_0x15eaee){return _0x15eaee[_0xec94('0xb9')](_0x2d111d['body'][_0xec94('0x6a')],_['omit'](_0x2d111d['body'],['ids','id'])||{})[_0xec94('0xb5')](function(_0x13b6b5){for(var _0x183f6d=0x0;_0x183f6d<_0x2d111d[_0xec94('0x62')]['ids'][_0xec94('0x47')];_0x183f6d+=0x1){socket[_0xec94('0xba')]('userFaxAccount:save',{'UserId':Number(_0x2d111d[_0xec94('0x62')][_0xec94('0x6a')][_0x183f6d]),'FaxAccountId':Number(_0x2d111d['params']['id'])});}return _0x13b6b5;});}})[_0xec94('0x31')](respondWithResult(_0x404e8e,null))[_0xec94('0x23')](handleError(_0x404e8e,null));};exports[_0xec94('0xbb')]=function(_0x2a0d7c,_0x4af174,_0x225445){return db['FaxAccount']['find']({'where':{'id':_0x2a0d7c[_0xec94('0x56')]['id']}})['then'](handleEntityNotFound(_0x4af174,null))[_0xec94('0x31')](function(_0x3f5cce){if(_0x3f5cce){return _0x3f5cce[_0xec94('0xbb')](_0x2a0d7c['query']['ids'])[_0xec94('0x31')](function(){if(_[_0xec94('0xbc')](_0x2a0d7c[_0xec94('0x42')]['ids'])){for(var _0x5ee299=0x0;_0x5ee299<_0x2a0d7c[_0xec94('0x42')][_0xec94('0x6a')]['length'];_0x5ee299+=0x1){socket[_0xec94('0xba')](_0xec94('0xbd'),{'UserId':Number(_0x2a0d7c[_0xec94('0x42')][_0xec94('0x6a')][_0x5ee299]),'FaxAccountId':Number(_0x2a0d7c[_0xec94('0x56')]['id'])});}}else{socket['emit'](_0xec94('0xbd'),{'UserId':Number(_0x2a0d7c[_0xec94('0x42')][_0xec94('0x6a')]),'FaxAccountId':Number(_0x2a0d7c[_0xec94('0x56')]['id'])});}});}})[_0xec94('0x31')](respondWithStatusCode(_0x4af174,null))[_0xec94('0x23')](handleError(_0x4af174,null));};exports[_0xec94('0xbe')]=function(_0x55588d,_0x18181d,_0x206c49){var _0x2fc9ef={};var _0x17f5df={};var _0x3a0f76;var _0x51739a;return db['FaxAccount'][_0xec94('0x67')]({'where':{'id':_0x55588d[_0xec94('0x56')]['id']}})[_0xec94('0x31')](handleEntityNotFound(_0x18181d,null))['then'](function(_0x2374a4){if(_0x2374a4){_0x3a0f76=_0x2374a4;_0x17f5df[_0xec94('0x41')]=_[_0xec94('0x57')](db[_0xec94('0x73')][_0xec94('0x3d')]);_0x17f5df[_0xec94('0x42')]=_[_0xec94('0x57')](_0x55588d[_0xec94('0x42')]);_0x17f5df[_0xec94('0x43')]=_['intersection'](_0x17f5df['model'],_0x17f5df[_0xec94('0x42')]);_0x2fc9ef['attributes']=_[_0xec94('0x44')](_0x17f5df[_0xec94('0x41')],qs[_0xec94('0x46')](_0x55588d[_0xec94('0x42')][_0xec94('0x46')]));_0x2fc9ef[_0xec94('0x45')]=_0x2fc9ef['attributes'][_0xec94('0x47')]?_0x2fc9ef[_0xec94('0x45')]:_0x17f5df[_0xec94('0x41')];_0x2fc9ef[_0xec94('0x4a')]=qs[_0xec94('0x4b')](_0x55588d['query'][_0xec94('0x4b')]);_0x2fc9ef[_0xec94('0x4d')]=qs['filters'](_[_0xec94('0x4c')](_0x55588d[_0xec94('0x42')],_0x17f5df[_0xec94('0x43')]));if(_0x55588d['query']['filter']){_0x2fc9ef[_0xec94('0x4d')]=_[_0xec94('0x4e')](_0x2fc9ef[_0xec94('0x4d')],{'$or':_[_0xec94('0x3c')](_0x2fc9ef[_0xec94('0x45')],function(_0x195c4d){var _0x48e56a={};_0x48e56a[_0x195c4d]={'$like':'%'+_0x55588d[_0xec94('0x42')]['filter']+'%'};return _0x48e56a;})});}_0x2fc9ef=_['merge']({},_0x2fc9ef,_0x55588d['options']);return _0x3a0f76['getAgents'](_0x2fc9ef);}})[_0xec94('0x31')](function(_0x276b44){if(_0x276b44){_0x51739a=_0x276b44[_0xec94('0x47')];if(!_0x55588d[_0xec94('0x42')][_0xec94('0x48')](_0xec94('0x49'))){_0x2fc9ef[_0xec94('0x29')]=qs[_0xec94('0x29')](_0x55588d[_0xec94('0x42')]['limit']);_0x2fc9ef[_0xec94('0x27')]=qs[_0xec94('0x27')](_0x55588d[_0xec94('0x42')][_0xec94('0x27')]);}return _0x3a0f76[_0xec94('0xbe')](_0x2fc9ef);}})[_0xec94('0x31')](function(_0x113a2b){if(_0x113a2b){return _0x113a2b?{'count':_0x51739a,'rows':_0x113a2b}:null;}})[_0xec94('0x31')](respondWithResult(_0x18181d,null))[_0xec94('0x23')](handleError(_0x18181d,null));}; \ No newline at end of file +var _0x6704=['nolimit','CannedAnswer','removeAnswers','omit','FaxInteraction','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','Transaction','ISOLATION_LEVELS','findOne','FaxApplication','bulkCreate','priority','stack','finally','getApplications','localstationid','app','description','appdata','push','CDR(type)=inbound-fax','Set','gateway','headerinfo','minrate','modem','t38timeout','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','updateAccountApplications','transaction','tech','key','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','CmContact','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','format','fax','List','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','reject','save','update','get','FaxAccounts','destroy','end','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','body','describe','addDisposition','FaxAccountId','pick','Disposition','rows','removeDispositions','ids','addAnswer'];(function(_0x14b627,_0x2f38c0){var _0x80933b=function(_0x235d0d){while(--_0x235d0d){_0x14b627['push'](_0x14b627['shift']());}};_0x80933b(++_0x2f38c0);}(_0x6704,0x1c5));var _0x4670=function(_0x5d637c,_0x3dee88){_0x5d637c=_0x5d637c-0x0;var _0x1bff9c=_0x6704[_0x5d637c];return _0x1bff9c;};'use strict';var emlformat=require(_0x4670('0x0'));var rimraf=require(_0x4670('0x1'));var zipdir=require(_0x4670('0x2'));var jsonpatch=require(_0x4670('0x3'));var rp=require(_0x4670('0x4'));var moment=require(_0x4670('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4670('0x6'));var util=require(_0x4670('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4670('0x8'));var _=require(_0x4670('0x9'));var squel=require(_0x4670('0xa'));var crypto=require(_0x4670('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4670('0xc'));var toCsv=require(_0x4670('0xd'));var querystring=require(_0x4670('0xe'));var Papa=require(_0x4670('0xf'));var Redis=require(_0x4670('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4670('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4670('0x12'))(_0x4670('0x13'));var utils=require(_0x4670('0x14'));var config=require(_0x4670('0x15'));var licenseUtil=require(_0x4670('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4670('0x17')](config[_0x4670('0x18')],{'host':_0x4670('0x19'),'port':0x18eb});var socket=require(_0x4670('0x1a'))(new Redis(config['redis']));require(_0x4670('0x1b'))[_0x4670('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4670('0x1d')][_0x4670('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x4670('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5a3ace,_0x2dc7e4,_0x631256,_0x33e7e4){return new BPromise(function(_0x28d9d9,_0xbf4354){var _0x111c23=_0x33e7e4||client;return _0x111c23['request'](_0x5a3ace,_0x631256)[_0x4670('0x1f')](function(_0xf23e82){logger[_0x4670('0x20')]('FaxAccount,\x20%s,\x20%s',_0x2dc7e4,_0x4670('0x21'));logger[_0x4670('0x22')](_0x4670('0x23'),_0x2dc7e4,_0x4670('0x21'),JSON['stringify'](_0xf23e82));if(_0xf23e82[_0x4670('0x24')]){if(_0xf23e82['error']['code']===0x1f4){logger[_0x4670('0x24')](_0x4670('0x25'),_0x2dc7e4,_0xf23e82[_0x4670('0x24')][_0x4670('0x26')]);return _0xbf4354(_0xf23e82[_0x4670('0x24')]['message']);}logger['error'](_0x4670('0x25'),_0x2dc7e4,_0xf23e82[_0x4670('0x24')]['message']);return _0x28d9d9(_0xf23e82[_0x4670('0x24')][_0x4670('0x26')]);}else{logger[_0x4670('0x20')]('FaxAccount,\x20%s,\x20%s',_0x2dc7e4,_0x4670('0x21'));_0x28d9d9(_0xf23e82[_0x4670('0x27')][_0x4670('0x26')]);}})[_0x4670('0x28')](function(_0x5bb42f){logger[_0x4670('0x24')](_0x4670('0x25'),_0x2dc7e4,_0x5bb42f);_0xbf4354(_0x5bb42f);});});}function respondWithStatusCode(_0x2cddd9,_0x42cf36){_0x42cf36=_0x42cf36||0xcc;return function(_0x4b8909){if(_0x4b8909){return _0x2cddd9[_0x4670('0x29')](_0x42cf36);}return _0x2cddd9[_0x4670('0x2a')](_0x42cf36)['end']();};}function respondWithResult(_0x9e53b8,_0x49c3b8){_0x49c3b8=_0x49c3b8||0xc8;return function(_0x2e6a33){if(_0x2e6a33){return _0x9e53b8['status'](_0x49c3b8)[_0x4670('0x2b')](_0x2e6a33);}};}function respondWithFilteredResult(_0x28d71c,_0x392f2a){return function(_0x3e29d0){if(_0x3e29d0){var _0x4b762b=typeof _0x392f2a[_0x4670('0x2c')]===_0x4670('0x2d')&&typeof _0x392f2a[_0x4670('0x2e')]===_0x4670('0x2d');var _0x51db07=_0x3e29d0['count'];var _0x2364c8=_0x4b762b?0x0:_0x392f2a[_0x4670('0x2c')];var _0x3eed0c=_0x4b762b?_0x3e29d0[_0x4670('0x2f')]:_0x392f2a['offset']+_0x392f2a[_0x4670('0x2e')];var _0xa1d18e;if(_0x3eed0c>=_0x51db07){_0x3eed0c=_0x51db07;_0xa1d18e=0xc8;}else{_0xa1d18e=0xce;}_0x28d71c[_0x4670('0x2a')](_0xa1d18e);return _0x28d71c['set']('Content-Range',_0x2364c8+'-'+_0x3eed0c+'/'+_0x51db07)[_0x4670('0x2b')](_0x3e29d0);}return null;};}function patchUpdates(_0x3c9178){return function(_0x59a354){try{jsonpatch['apply'](_0x59a354,_0x3c9178,!![]);}catch(_0x150030){return BPromise[_0x4670('0x30')](_0x150030);}return _0x59a354[_0x4670('0x31')]();};}function saveUpdates(_0x19f2e2,_0x33ed5f){return function(_0x52f1c2){if(_0x52f1c2){return _0x52f1c2[_0x4670('0x32')](_0x19f2e2)[_0x4670('0x1f')](function(_0x58f39f){return _0x58f39f;});}return null;};}function removeEntity(_0x1a0b69,_0xeb81b){return function(_0x304057){if(_0x304057){return _0x304057['destroy']()[_0x4670('0x1f')](function(){var _0x511743=_0x304057[_0x4670('0x33')]({'plain':!![]});var _0x11aba0=_0x4670('0x34');return db['UserProfileResource'][_0x4670('0x35')]({'where':{'type':_0x11aba0,'resourceId':_0x511743['id']}})[_0x4670('0x1f')](function(){return _0x304057;});})[_0x4670('0x1f')](function(){_0x1a0b69[_0x4670('0x2a')](0xcc)[_0x4670('0x36')]();});}};}function handleEntityNotFound(_0x1c39e5,_0x50b9d5){return function(_0xe9bf19){if(!_0xe9bf19){_0x1c39e5[_0x4670('0x29')](0x194);}return _0xe9bf19;};}function handleError(_0xc999e2,_0x2c243a){_0x2c243a=_0x2c243a||0x1f4;return function(_0x317969){logger['error'](_0x317969['stack']);if(_0x317969[_0x4670('0x37')]){delete _0x317969[_0x4670('0x37')];}_0xc999e2[_0x4670('0x2a')](_0x2c243a)[_0x4670('0x38')](_0x317969);};}exports[_0x4670('0x39')]=function(_0x58dd0f,_0x121c3c){var _0x51a275={'include':[{'model':db[_0x4670('0x3a')],'as':_0x4670('0x3b')}]},_0xf9d020={},_0x52cc0c={'count':0x0,'rows':[]};var _0x5145a0=_[_0x4670('0x3c')](db[_0x4670('0x3d')][_0x4670('0x3e')],function(_0xed3dc4){return{'name':_0xed3dc4['fieldName'],'type':_0xed3dc4[_0x4670('0x3f')]['key']};});_0xf9d020[_0x4670('0x40')]=_[_0x4670('0x3c')](_0x5145a0,_0x4670('0x37'));_0xf9d020[_0x4670('0x41')]=_[_0x4670('0x42')](_0x58dd0f[_0x4670('0x41')]);_0xf9d020[_0x4670('0x43')]=_['intersection'](_0xf9d020[_0x4670('0x40')],_0xf9d020[_0x4670('0x41')]);_0x51a275[_0x4670('0x44')]=_[_0x4670('0x45')](_0xf9d020[_0x4670('0x40')],qs[_0x4670('0x46')](_0x58dd0f['query'][_0x4670('0x46')]));_0x51a275[_0x4670('0x44')]=_0x51a275['attributes'][_0x4670('0x47')]?_0x51a275['attributes']:_0xf9d020[_0x4670('0x40')];if(!_0x58dd0f[_0x4670('0x41')][_0x4670('0x48')]('nolimit')){_0x51a275[_0x4670('0x2e')]=qs[_0x4670('0x2e')](_0x58dd0f['query'][_0x4670('0x2e')]);_0x51a275[_0x4670('0x2c')]=qs[_0x4670('0x2c')](_0x58dd0f['query'][_0x4670('0x2c')]);}_0x51a275[_0x4670('0x49')]=qs[_0x4670('0x4a')](_0x58dd0f['query'][_0x4670('0x4a')]);_0x51a275[_0x4670('0x4b')]=qs[_0x4670('0x43')](_['pick'](_0x58dd0f[_0x4670('0x41')],_0xf9d020[_0x4670('0x43')]),_0x5145a0);if(_0x58dd0f[_0x4670('0x41')][_0x4670('0x4c')]){_0x51a275[_0x4670('0x4b')]=_[_0x4670('0x4d')](_0x51a275[_0x4670('0x4b')],{'$or':_[_0x4670('0x3c')](_0x5145a0,function(_0x714626){if(_0x714626['type']!==_0x4670('0x4e')){var _0x136c2b={};_0x136c2b[_0x714626[_0x4670('0x37')]]={'$like':'%'+_0x58dd0f['query'][_0x4670('0x4c')]+'%'};return _0x136c2b;}})});}_0x51a275=_[_0x4670('0x4d')]({},_0x51a275,_0x58dd0f[_0x4670('0x4f')]);var _0x3f1240={'where':_0x51a275[_0x4670('0x4b')]};return db[_0x4670('0x3d')][_0x4670('0x2f')](_0x3f1240)['then'](function(_0x15067d){_0x52cc0c['count']=_0x15067d;if(_0x58dd0f[_0x4670('0x41')]['includeAll']){_0x51a275[_0x4670('0x50')]=[{'all':!![]}];}return db[_0x4670('0x3d')][_0x4670('0x51')](_0x51a275);})[_0x4670('0x1f')](function(_0x3dad4b){_0x52cc0c['rows']=_0x3dad4b;return _0x52cc0c;})[_0x4670('0x1f')](respondWithFilteredResult(_0x121c3c,_0x51a275))['catch'](handleError(_0x121c3c,null));};exports['show']=function(_0x5c8415,_0x374040){var _0x11f604={'raw':![],'where':{'id':_0x5c8415[_0x4670('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0x4670('0x3b')}]},_0x273131={};_0x273131['model']=_[_0x4670('0x42')](db['FaxAccount']['rawAttributes']);_0x273131[_0x4670('0x41')]=_[_0x4670('0x42')](_0x5c8415['query']);_0x273131[_0x4670('0x43')]=_[_0x4670('0x45')](_0x273131[_0x4670('0x40')],_0x273131[_0x4670('0x41')]);_0x11f604[_0x4670('0x44')]=_[_0x4670('0x45')](_0x273131[_0x4670('0x40')],qs[_0x4670('0x46')](_0x5c8415[_0x4670('0x41')]['fields']));_0x11f604['attributes']=_0x11f604[_0x4670('0x44')][_0x4670('0x47')]?_0x11f604[_0x4670('0x44')]:_0x273131[_0x4670('0x40')];if(_0x5c8415[_0x4670('0x41')][_0x4670('0x53')]){_0x11f604['include']=[{'all':!![]}];}_0x11f604=_[_0x4670('0x4d')]({},_0x11f604,_0x5c8415['options']);return db['FaxAccount'][_0x4670('0x54')](_0x11f604)[_0x4670('0x1f')](handleEntityNotFound(_0x374040,null))[_0x4670('0x1f')](respondWithResult(_0x374040,null))[_0x4670('0x28')](handleError(_0x374040,null));};exports[_0x4670('0x55')]=function(_0x3ae2e6,_0x2f947b){return db[_0x4670('0x3d')][_0x4670('0x55')](_0x3ae2e6['body'],{})[_0x4670('0x1f')](function(_0x59efd2){var _0x17409e=_0x3ae2e6[_0x4670('0x56')][_0x4670('0x33')]({'plain':!![]});if(!_0x17409e)throw new Error(_0x4670('0x57'));if(_0x17409e[_0x4670('0x58')]===_0x4670('0x56')){var _0x490c64=_0x59efd2[_0x4670('0x33')]({'plain':!![]});var _0x508e30='FaxAccounts';return db['UserProfileSection'][_0x4670('0x54')]({'where':{'name':_0x508e30,'userProfileId':_0x17409e[_0x4670('0x59')]},'raw':!![]})[_0x4670('0x1f')](function(_0x3f1692){if(_0x3f1692&&_0x3f1692[_0x4670('0x5a')]===0x0){return db[_0x4670('0x5b')][_0x4670('0x55')]({'name':_0x490c64['name'],'resourceId':_0x490c64['id'],'type':_0x3f1692[_0x4670('0x37')],'sectionId':_0x3f1692['id']},{})['then'](function(){return _0x59efd2;});}else{return _0x59efd2;}})[_0x4670('0x28')](function(_0x5a9290){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a9290);throw _0x5a9290;});}return _0x59efd2;})['then'](respondWithResult(_0x2f947b,0xc9))[_0x4670('0x28')](handleError(_0x2f947b,null));};exports['update']=function(_0x4f6cf6,_0x564055){if(_0x4f6cf6[_0x4670('0x5c')]['id']){delete _0x4f6cf6[_0x4670('0x5c')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x4f6cf6[_0x4670('0x52')]['id']},'include':[{'model':db[_0x4670('0x3a')],'as':'mandatoryDispositionPause'}]})[_0x4670('0x1f')](handleEntityNotFound(_0x564055,null))[_0x4670('0x1f')](saveUpdates(_0x4f6cf6[_0x4670('0x5c')],null))[_0x4670('0x1f')](respondWithResult(_0x564055,null))[_0x4670('0x28')](handleError(_0x564055,null));};exports[_0x4670('0x35')]=function(_0x532fbc,_0x65d90c){return db['FaxAccount']['find']({'where':{'id':_0x532fbc[_0x4670('0x52')]['id']}})[_0x4670('0x1f')](handleEntityNotFound(_0x65d90c,null))[_0x4670('0x1f')](removeEntity(_0x65d90c,null))[_0x4670('0x28')](handleError(_0x65d90c,null));};exports[_0x4670('0x5d')]=function(_0x1cd90b,_0x2b615f){return db[_0x4670('0x3d')]['describe']()[_0x4670('0x1f')](respondWithResult(_0x2b615f,null))[_0x4670('0x28')](handleError(_0x2b615f,null));};exports[_0x4670('0x5e')]=function(_0x3dd5b2,_0x355cc1,_0x3b8909){if(_0x3dd5b2[_0x4670('0x5c')]['id']){delete _0x3dd5b2[_0x4670('0x5c')]['id'];}return db[_0x4670('0x3d')][_0x4670('0x54')]({'where':{'id':_0x3dd5b2[_0x4670('0x52')]['id']}})[_0x4670('0x1f')](handleEntityNotFound(_0x355cc1,null))[_0x4670('0x1f')](function(_0x1c9317){if(_0x1c9317){_0x3dd5b2[_0x4670('0x5c')][_0x4670('0x5f')]=_0x1c9317['id'];return db['Disposition'][_0x4670('0x55')](_0x3dd5b2[_0x4670('0x5c')]);}})['then'](respondWithResult(_0x355cc1,null))[_0x4670('0x28')](handleError(_0x355cc1,null));};exports['getDispositions']=function(_0x35536e,_0x195cb7,_0xfd3191){var _0x5b400e={'raw':![],'where':{}};var _0xfc0696={};var _0x1e2dbe={'count':0x0,'rows':[]};return db[_0x4670('0x3d')]['findOne']({'where':{'id':_0x35536e['params']['id']}})[_0x4670('0x1f')](handleEntityNotFound(_0x195cb7,null))['then'](function(_0x193beb){if(_0x193beb){_0xfc0696[_0x4670('0x40')]=_[_0x4670('0x42')](db['Disposition'][_0x4670('0x3e')]);_0xfc0696[_0x4670('0x41')]=_['keys'](_0x35536e[_0x4670('0x41')]);_0xfc0696[_0x4670('0x43')]=_[_0x4670('0x45')](_0xfc0696[_0x4670('0x40')],_0xfc0696[_0x4670('0x41')]);_0x5b400e['attributes']=_['intersection'](_0xfc0696['model'],qs['fields'](_0x35536e[_0x4670('0x41')][_0x4670('0x46')]));_0x5b400e['attributes']=_0x5b400e[_0x4670('0x44')][_0x4670('0x47')]?_0x5b400e[_0x4670('0x44')]:_0xfc0696[_0x4670('0x40')];if(!_0x35536e[_0x4670('0x41')]['hasOwnProperty']('nolimit')){_0x5b400e[_0x4670('0x2e')]=qs[_0x4670('0x2e')](_0x35536e['query'][_0x4670('0x2e')]);_0x5b400e[_0x4670('0x2c')]=qs[_0x4670('0x2c')](_0x35536e[_0x4670('0x41')]['offset']);}_0x5b400e['order']=qs[_0x4670('0x4a')](_0x35536e['query'][_0x4670('0x4a')]);_0x5b400e[_0x4670('0x4b')]=qs['filters'](_[_0x4670('0x60')](_0x35536e['query'],_0xfc0696[_0x4670('0x43')]));_0x5b400e[_0x4670('0x4b')]['FaxAccountId']=_0x193beb['id'];if(_0x35536e[_0x4670('0x41')]['filter']){_0x5b400e['where']=_['merge'](_0x5b400e[_0x4670('0x4b')],{'$or':_[_0x4670('0x3c')](_0x5b400e[_0x4670('0x44')],function(_0x35d0db){var _0x4710ab={};_0x4710ab[_0x35d0db]={'$like':'%'+_0x35536e[_0x4670('0x41')][_0x4670('0x4c')]+'%'};return _0x4710ab;})});}_0x5b400e=_['merge']({},_0x5b400e,_0x35536e[_0x4670('0x4f')]);return db['Disposition']['count']({'where':_0x5b400e['where']})['then'](function(_0x249c6e){_0x1e2dbe[_0x4670('0x2f')]=_0x249c6e;if(_0x35536e[_0x4670('0x41')][_0x4670('0x53')]){_0x5b400e['include']=[{'all':!![]}];}return db[_0x4670('0x61')][_0x4670('0x51')](_0x5b400e);})[_0x4670('0x1f')](function(_0x243367){_0x1e2dbe[_0x4670('0x62')]=_0x243367;return _0x1e2dbe;});}})[_0x4670('0x1f')](respondWithFilteredResult(_0x195cb7,_0x5b400e))['catch'](handleError(_0x195cb7,null));};exports[_0x4670('0x63')]=function(_0x1fdb0f,_0x372347,_0x473c13){return db[_0x4670('0x3d')]['find']({'where':{'id':_0x1fdb0f[_0x4670('0x52')]['id']}})[_0x4670('0x1f')](handleEntityNotFound(_0x372347,null))[_0x4670('0x1f')](function(_0xbf6294){if(_0xbf6294){return _0xbf6294[_0x4670('0x63')](_0x1fdb0f['query'][_0x4670('0x64')]);}})['then'](respondWithStatusCode(_0x372347,null))['catch'](handleError(_0x372347,null));};exports[_0x4670('0x65')]=function(_0x2e453b,_0x51c567,_0x3ba54d){if(_0x2e453b['body']['id']){delete _0x2e453b['body']['id'];}return db['FaxAccount'][_0x4670('0x54')]({'where':{'id':_0x2e453b[_0x4670('0x52')]['id']}})[_0x4670('0x1f')](handleEntityNotFound(_0x51c567,null))['then'](function(_0x58f359){if(_0x58f359){_0x2e453b[_0x4670('0x5c')][_0x4670('0x5f')]=_0x58f359['id'];return db['CannedAnswer'][_0x4670('0x55')](_0x2e453b[_0x4670('0x5c')]);}})[_0x4670('0x1f')](respondWithResult(_0x51c567,null))[_0x4670('0x28')](handleError(_0x51c567,null));};exports['getAnswers']=function(_0x46b364,_0x56afb6,_0x41798e){var _0xaf0ce2={'raw':![],'where':{}};var _0x193e74={};var _0x32dfbb={'count':0x0,'rows':[]};return db[_0x4670('0x3d')]['findOne']({'where':{'id':_0x46b364['params']['id']}})['then'](handleEntityNotFound(_0x56afb6,null))[_0x4670('0x1f')](function(_0x6fa36b){if(_0x6fa36b){_0x193e74[_0x4670('0x40')]=_[_0x4670('0x42')](db['CannedAnswer']['rawAttributes']);_0x193e74['query']=_[_0x4670('0x42')](_0x46b364[_0x4670('0x41')]);_0x193e74[_0x4670('0x43')]=_[_0x4670('0x45')](_0x193e74[_0x4670('0x40')],_0x193e74[_0x4670('0x41')]);_0xaf0ce2[_0x4670('0x44')]=_[_0x4670('0x45')](_0x193e74[_0x4670('0x40')],qs[_0x4670('0x46')](_0x46b364[_0x4670('0x41')][_0x4670('0x46')]));_0xaf0ce2[_0x4670('0x44')]=_0xaf0ce2[_0x4670('0x44')][_0x4670('0x47')]?_0xaf0ce2[_0x4670('0x44')]:_0x193e74[_0x4670('0x40')];if(!_0x46b364[_0x4670('0x41')][_0x4670('0x48')](_0x4670('0x66'))){_0xaf0ce2[_0x4670('0x2e')]=qs['limit'](_0x46b364['query'][_0x4670('0x2e')]);_0xaf0ce2[_0x4670('0x2c')]=qs[_0x4670('0x2c')](_0x46b364['query'][_0x4670('0x2c')]);}_0xaf0ce2[_0x4670('0x49')]=qs[_0x4670('0x4a')](_0x46b364[_0x4670('0x41')]['sort']);_0xaf0ce2['where']=qs['filters'](_[_0x4670('0x60')](_0x46b364['query'],_0x193e74[_0x4670('0x43')]));_0xaf0ce2[_0x4670('0x4b')][_0x4670('0x5f')]=_0x6fa36b['id'];if(_0x46b364[_0x4670('0x41')]['filter']){_0xaf0ce2['where']=_[_0x4670('0x4d')](_0xaf0ce2[_0x4670('0x4b')],{'$or':_[_0x4670('0x3c')](_0xaf0ce2[_0x4670('0x44')],function(_0x23de94){var _0x4b6ae9={};_0x4b6ae9[_0x23de94]={'$like':'%'+_0x46b364[_0x4670('0x41')]['filter']+'%'};return _0x4b6ae9;})});}_0xaf0ce2=_['merge']({},_0xaf0ce2,_0x46b364[_0x4670('0x4f')]);return db[_0x4670('0x67')][_0x4670('0x2f')]({'where':_0xaf0ce2[_0x4670('0x4b')]})[_0x4670('0x1f')](function(_0x429c55){_0x32dfbb[_0x4670('0x2f')]=_0x429c55;if(_0x46b364['query'][_0x4670('0x53')]){_0xaf0ce2['include']=[{'all':!![]}];}return db[_0x4670('0x67')]['findAll'](_0xaf0ce2);})['then'](function(_0x250362){_0x32dfbb[_0x4670('0x62')]=_0x250362;return _0x32dfbb;});}})[_0x4670('0x1f')](respondWithFilteredResult(_0x56afb6,_0xaf0ce2))[_0x4670('0x28')](handleError(_0x56afb6,null));};exports[_0x4670('0x68')]=function(_0x492ec2,_0x3beac6,_0x2c3012){return db[_0x4670('0x3d')]['find']({'where':{'id':_0x492ec2['params']['id']}})['then'](handleEntityNotFound(_0x3beac6,null))[_0x4670('0x1f')](function(_0x53279){if(_0x53279){return _0x53279['removeAnswers'](_0x492ec2[_0x4670('0x41')][_0x4670('0x64')]);}})[_0x4670('0x1f')](respondWithStatusCode(_0x3beac6,null))['catch'](handleError(_0x3beac6,null));};exports['addInteraction']=function(_0x3cb7e2,_0x28477b,_0x155f41){return db['FaxInteraction'][_0x4670('0x54')]({'where':{'id':_0x3cb7e2[_0x4670('0x52')]['id']}})[_0x4670('0x1f')](handleEntityNotFound(_0x28477b,null))['then'](function(_0x5a2457){if(_0x5a2457){return _0x5a2457['addInteraction'](_0x3cb7e2['body'][_0x4670('0x64')],_[_0x4670('0x69')](_0x3cb7e2[_0x4670('0x5c')],[_0x4670('0x64'),'id'])||{});}})[_0x4670('0x1f')](respondWithResult(_0x28477b,null))[_0x4670('0x28')](handleError(_0x28477b,null));};exports['getInteractions']=function(_0x304e61,_0x3d744c,_0x5e4fc8){var _0x5ad62a={'raw':![],'where':{}};var _0x313d88={};var _0x21ef14={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x304e61[_0x4670('0x52')]['id']}})[_0x4670('0x1f')](handleEntityNotFound(_0x3d744c,null))['then'](function(_0x258b3a){if(_0x258b3a){_0x313d88[_0x4670('0x40')]=_['keys'](db[_0x4670('0x6a')][_0x4670('0x3e')]);_0x313d88[_0x4670('0x41')]=_[_0x4670('0x42')](_0x304e61['query']);_0x313d88[_0x4670('0x43')]=_[_0x4670('0x45')](_0x313d88[_0x4670('0x40')],_0x313d88['query']);_0x5ad62a[_0x4670('0x44')]=_['intersection'](_0x313d88['model'],qs[_0x4670('0x46')](_0x304e61[_0x4670('0x41')][_0x4670('0x46')]));_0x5ad62a[_0x4670('0x44')]=_0x5ad62a[_0x4670('0x44')][_0x4670('0x47')]?_0x5ad62a[_0x4670('0x44')]:_0x313d88[_0x4670('0x40')];if(!_0x304e61['query'][_0x4670('0x48')](_0x4670('0x66'))){_0x5ad62a[_0x4670('0x2e')]=qs[_0x4670('0x2e')](_0x304e61[_0x4670('0x41')][_0x4670('0x2e')]);_0x5ad62a[_0x4670('0x2c')]=qs['offset'](_0x304e61[_0x4670('0x41')][_0x4670('0x2c')]);}_0x5ad62a[_0x4670('0x49')]=qs['sort'](_0x304e61[_0x4670('0x41')][_0x4670('0x4a')]);_0x5ad62a[_0x4670('0x4b')]=qs[_0x4670('0x43')](_[_0x4670('0x60')](_0x304e61[_0x4670('0x41')],_0x313d88[_0x4670('0x43')]));_0x5ad62a[_0x4670('0x4b')]['FaxAccountId']=_0x258b3a['id'];if(_0x304e61['query'][_0x4670('0x4c')]){_0x5ad62a[_0x4670('0x4b')]=_[_0x4670('0x4d')](_0x5ad62a[_0x4670('0x4b')],{'$or':_[_0x4670('0x3c')](_0x5ad62a['attributes'],function(_0x274598){var _0x44221b={};_0x44221b[_0x274598]={'$like':'%'+_0x304e61[_0x4670('0x41')][_0x4670('0x4c')]+'%'};return _0x44221b;})});}_0x5ad62a=_[_0x4670('0x4d')]({},_0x5ad62a,_0x304e61[_0x4670('0x4f')]);return db['FaxInteraction']['count']({'where':_0x5ad62a['where']})[_0x4670('0x1f')](function(_0x55b1e0){_0x21ef14['count']=_0x55b1e0;if(_0x304e61['query'][_0x4670('0x53')]){_0x5ad62a[_0x4670('0x50')]=[{'model':db['CmContact'],'as':_0x4670('0x6b'),'required':![]},{'model':db[_0x4670('0x6c')],'as':_0x4670('0x6d'),'attributes':[_0x4670('0x37'),_0x4670('0x6e'),_0x4670('0x6f')],'required':![]},{'model':db[_0x4670('0x70')],'as':_0x4670('0x71'),'attributes':['id',_0x4670('0x37'),_0x4670('0x72')],'where':_0x304e61[_0x4670('0x41')][_0x4670('0x73')]?{'id':_0x304e61[_0x4670('0x41')]['tag']}:undefined,'required':_0x304e61[_0x4670('0x41')][_0x4670('0x73')]?!![]:![]}];}return db[_0x4670('0x6a')][_0x4670('0x51')](_0x5ad62a);})[_0x4670('0x1f')](function(_0x315a53){_0x21ef14[_0x4670('0x62')]=_0x315a53;return _0x21ef14;});}})[_0x4670('0x1f')](respondWithFilteredResult(_0x3d744c,_0x5ad62a))[_0x4670('0x28')](handleError(_0x3d744c,null));};exports['addApplications']=function(_0x565500,_0x1eb7e2){var _0x55ed40=_0x565500[_0x4670('0x52')]['id'];var _0x4a51a2=_0x565500[_0x4670('0x5c')];var _0x5dfcf6=0xc8;var _0x696bc1=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x4670('0x74')][_0x4670('0x75')][_0x4670('0x76')]['READ_COMMITTED']},function(_0x49b493){return db[_0x4670('0x3d')][_0x4670('0x77')]({'where':{'id':_0x55ed40},'transaction':_0x49b493})[_0x4670('0x1f')](function(_0x2e0ec4){if(_0x2e0ec4){return db['FaxApplication'][_0x4670('0x35')]({'where':{'FaxAccountId':_0x55ed40},'transaction':_0x49b493})[_0x4670('0x1f')](function(){var _0x31b8d1=_[_0x4670('0x3c')](_0x4a51a2,function(_0x3656a2){_0x3656a2['FaxAccountId']=_0x55ed40;return _0x3656a2;});return db[_0x4670('0x78')][_0x4670('0x79')](_0x31b8d1,{'transaction':_0x49b493});});}else{_0x5dfcf6=0x194;_0x696bc1=[];}});})[_0x4670('0x1f')](function(){if(_0x5dfcf6!==0x194){return db[_0x4670('0x78')]['findAndCountAll']({'where':{'FaxAccountId':_0x55ed40},'order':_0x4670('0x7a')})['then'](function(_0x9e9370){_0x696bc1=_0x9e9370;});}})[_0x4670('0x28')](function(_0x58301c){_0x5dfcf6=0x1f4;logger[_0x4670('0x24')](_0x58301c[_0x4670('0x7b')]);if(_0x58301c[_0x4670('0x37')]){delete _0x58301c[_0x4670('0x37')];}_0x696bc1=_0x58301c;})[_0x4670('0x7c')](function(){if(_0x696bc1===null){_0x1eb7e2[_0x4670('0x29')](_0x5dfcf6);}else{if(_0x5dfcf6===0x1f4){_0x1eb7e2[_0x4670('0x2a')](_0x5dfcf6)[_0x4670('0x38')](_0x696bc1);}else{_0x1eb7e2[_0x4670('0x2a')](_0x5dfcf6)[_0x4670('0x2b')](_0x696bc1);}}});};exports[_0x4670('0x7d')]=function(_0x228160,_0x3848e6,_0x14a036){var _0xdf2077={};var _0xe57246={};var _0x2fdbd1;var _0x2c1cf3;return db[_0x4670('0x3d')][_0x4670('0x77')]({'where':{'id':_0x228160['params']['id']}})[_0x4670('0x1f')](handleEntityNotFound(_0x3848e6,null))['then'](function(_0x1fab85){if(_0x1fab85){_0x2fdbd1=_0x1fab85;_0xe57246[_0x4670('0x40')]=_[_0x4670('0x42')](db[_0x4670('0x78')][_0x4670('0x3e')]);_0xe57246[_0x4670('0x41')]=_[_0x4670('0x42')](_0x228160['query']);_0xe57246['filters']=_[_0x4670('0x45')](_0xe57246[_0x4670('0x40')],_0xe57246[_0x4670('0x41')]);_0xdf2077[_0x4670('0x44')]=_['intersection'](_0xe57246[_0x4670('0x40')],qs['fields'](_0x228160[_0x4670('0x41')][_0x4670('0x46')]));_0xdf2077[_0x4670('0x44')]=_0xdf2077[_0x4670('0x44')]['length']?_0xdf2077[_0x4670('0x44')]:_0xe57246[_0x4670('0x40')];_0xdf2077[_0x4670('0x49')]=qs[_0x4670('0x4a')](_0x228160[_0x4670('0x41')][_0x4670('0x4a')]);_0xdf2077['where']=qs[_0x4670('0x43')](_[_0x4670('0x60')](_0x228160[_0x4670('0x41')],_0xe57246[_0x4670('0x43')]));if(_0x228160[_0x4670('0x41')][_0x4670('0x4c')]){_0xdf2077[_0x4670('0x4b')]=_[_0x4670('0x4d')](_0xdf2077[_0x4670('0x4b')],{'$or':_['map'](_0xdf2077[_0x4670('0x44')],function(_0x442427){var _0x51d05e={};_0x51d05e[_0x442427]={'$like':'%'+_0x228160[_0x4670('0x41')][_0x4670('0x4c')]+'%'};return _0x51d05e;})});}_0xdf2077=_[_0x4670('0x4d')]({},_0xdf2077,_0x228160[_0x4670('0x4f')]);return _0x2fdbd1[_0x4670('0x7d')](_0xdf2077);}})[_0x4670('0x1f')](function(_0x468d93){if(_0x468d93){_0x2c1cf3=_0x468d93['length'];if(!_0x228160['query']['hasOwnProperty'](_0x4670('0x66'))){_0xdf2077[_0x4670('0x2e')]=qs['limit'](_0x228160[_0x4670('0x41')]['limit']);_0xdf2077[_0x4670('0x2c')]=qs[_0x4670('0x2c')](_0x228160[_0x4670('0x41')][_0x4670('0x2c')]);}return _0x2fdbd1['getApplications'](_0xdf2077);}})[_0x4670('0x1f')](function(_0x7f2869){if(_0x7f2869){return _0x7f2869?{'count':_0x2c1cf3,'rows':_0x7f2869}:null;}})['then'](respondWithResult(_0x3848e6,null))['catch'](handleError(_0x3848e6,null));};function Extension(_0x10a51b,_0x180f36,_0x481f88,_0x5151b0){this['context']='from-voip-provider';this['exten']=_0x10a51b[_0x4670('0x7e')];this[_0x4670('0x7f')]=_0x5151b0;this['type']='system';this[_0x4670('0x80')]='Fax\x20Extension';this[_0x4670('0x5f')]=_0x10a51b['id'];this[_0x4670('0x7a')]=_0x180f36;this[_0x4670('0x81')]=_0x481f88;}function createExtensionsReciveFax(_0xe10da7){var _0x162f4d=0x1;var _0x2aa364=[];_0x2aa364[_0x4670('0x82')](new Extension(_0xe10da7,_0x162f4d,'','Answer'));_0x162f4d+=0x1;_0x2aa364['push'](new Extension(_0xe10da7,_0x162f4d,_0x4670('0x83'),_0x4670('0x84')));_0x162f4d+=0x1;for(var _0x939048 in _0xe10da7){if(_0xe10da7[_0x4670('0x48')](_0x939048)&&(_0x939048==='ecm'||_0x939048===_0x4670('0x7e')||_0x939048===_0x4670('0x85')||_0x939048==='faxdetect'||_0x939048===_0x4670('0x86')||_0x939048==='maxrate'||_0x939048===_0x4670('0x87')||_0x939048===_0x4670('0x88')||_0x939048===_0x4670('0x89'))){_0x2aa364[_0x4670('0x82')](new Extension(_0xe10da7,_0x162f4d,_0x4670('0x8a')+_0x939048+')='+_0xe10da7[_0x939048],'Set'));_0x162f4d+=0x1;}}_0x2aa364[_0x4670('0x82')](new Extension(_0xe10da7,_0x162f4d,'6','Wait'));_0x162f4d+=0x1;_0x2aa364[_0x4670('0x82')](new Extension(_0xe10da7,_0x162f4d,_0x4670('0x8b'),'ReceiveFax'));_0x162f4d=0x0;return _0x2aa364;}exports[_0x4670('0x8c')]=function(_0x56c84d,_0x1e0d82,_0x59be6d){var _0x1d35d3;return db[_0x4670('0x74')]['transaction'](function(_0x491a83){return db[_0x4670('0x3d')][_0x4670('0x55')](_0x56c84d[_0x4670('0x5c')],{'transaction':_0x491a83})[_0x4670('0x1f')](function(_0x5103ac){_0x1d35d3=_0x5103ac[_0x4670('0x33')]({'plain':!![]});return db[_0x4670('0x8d')][_0x4670('0x79')](createExtensionsReciveFax(_0x1d35d3),{'transaction':_0x491a83});});})[_0x4670('0x1f')](function(){return _0x1d35d3;})['then'](respondWithResult(_0x1e0d82,null))[_0x4670('0x28')](handleError(_0x1e0d82,null));};exports[_0x4670('0x8e')]=function(_0x40be50,_0xb3bc75,_0xa5970c){var _0x531f25;return db['sequelize'][_0x4670('0x8f')](function(_0x1b2394){return db[_0x4670('0x3d')][_0x4670('0x32')](_0x40be50[_0x4670('0x5c')],{'where':{'id':_0x40be50['body']['id']},'transaction':_0x1b2394})[_0x4670('0x1f')](function(_0x5ce12c){return db[_0x4670('0x8d')][_0x4670('0x35')]({'where':{'FaxAccountId':_0x40be50[_0x4670('0x5c')]['id']},'transaction':_0x1b2394})['then'](function(_0x1f49ee){return db[_0x4670('0x8d')][_0x4670('0x79')](createExtensionsReciveFax(_[_0x4670('0x69')](_0x40be50[_0x4670('0x5c')],[_0x4670('0x90'),_0x4670('0x91'),'createdAt',_0x4670('0x92'),_0x4670('0x93'),_0x4670('0x94')])),{'transaction':_0x1b2394});});});})[_0x4670('0x1f')](function(){return db[_0x4670('0x3d')][_0x4670('0x95')](_0x40be50[_0x4670('0x5c')]['id']);})[_0x4670('0x1f')](respondWithResult(_0xb3bc75,null))[_0x4670('0x28')](handleError(_0xb3bc75,null));};exports[_0x4670('0x96')]=function(_0x55c4a9,_0x56cd99,_0x38b386){var _0x34539c={'raw':!![],'where':{}};var _0x402d42={};var _0x35fbda={'count':0x0,'rows':[]};return db[_0x4670('0x3d')]['findOne']({'where':{'id':_0x55c4a9['params']['id']}})['then'](handleEntityNotFound(_0x56cd99,null))[_0x4670('0x1f')](function(_0x47b9b0){if(_0x47b9b0){_0x402d42[_0x4670('0x40')]=_['keys'](db[_0x4670('0x97')][_0x4670('0x3e')]);_0x402d42['query']=_[_0x4670('0x42')](_0x55c4a9[_0x4670('0x41')]);_0x402d42[_0x4670('0x43')]=_['intersection'](_0x402d42[_0x4670('0x40')],_0x402d42['query']);_0x34539c[_0x4670('0x44')]=_[_0x4670('0x45')](_0x402d42[_0x4670('0x40')],qs['fields'](_0x55c4a9['query'][_0x4670('0x46')]));_0x34539c[_0x4670('0x44')]=_0x34539c[_0x4670('0x44')][_0x4670('0x47')]?_0x34539c[_0x4670('0x44')]:_0x402d42[_0x4670('0x40')];if(!_0x55c4a9[_0x4670('0x41')]['hasOwnProperty'](_0x4670('0x66'))){_0x34539c[_0x4670('0x2e')]=qs[_0x4670('0x2e')](_0x55c4a9[_0x4670('0x41')]['limit']);_0x34539c['offset']=qs['offset'](_0x55c4a9[_0x4670('0x41')]['offset']);}_0x34539c[_0x4670('0x49')]=qs[_0x4670('0x4a')](_0x55c4a9['query'][_0x4670('0x4a')]);_0x34539c[_0x4670('0x4b')]=qs[_0x4670('0x43')](_[_0x4670('0x60')](_0x55c4a9[_0x4670('0x41')],_0x402d42[_0x4670('0x43')]));_0x34539c[_0x4670('0x4b')]['FaxAccountId']=_0x47b9b0['id'];if(_0x55c4a9['query']['filter']){_0x34539c[_0x4670('0x4b')]=_['merge'](_0x34539c[_0x4670('0x4b')],{'$or':_[_0x4670('0x3c')](_0x34539c['attributes'],function(_0x527e4e){var _0x5785d5={};_0x5785d5[_0x527e4e]={'$like':'%'+_0x55c4a9[_0x4670('0x41')][_0x4670('0x4c')]+'%'};return _0x5785d5;})});}if(_0x55c4a9[_0x4670('0x41')][_0x4670('0x98')]){var _0x159eaa=_0x55c4a9['query'][_0x4670('0x98')][_0x4670('0x99')](',');var _0x4a6d5d={};_0x4a6d5d[_0x159eaa[0x0]]={'$gte':moment(_0x159eaa[0x1])['format'](_0x4670('0x9a'))};_0x34539c[_0x4670('0x4b')]=_[_0x4670('0x4d')](_0x34539c[_0x4670('0x4b')],_0x4a6d5d);}_0x34539c=_[_0x4670('0x4d')]({},_0x34539c,_0x55c4a9[_0x4670('0x4f')]);return db[_0x4670('0x97')]['count']({'where':_0x34539c[_0x4670('0x4b')]})[_0x4670('0x1f')](function(_0x3f6fca){_0x35fbda[_0x4670('0x2f')]=_0x3f6fca;if(_0x55c4a9[_0x4670('0x41')][_0x4670('0x53')]){_0x34539c['include']=[{'all':!![]}];}return db[_0x4670('0x97')][_0x4670('0x51')](_0x34539c);})[_0x4670('0x1f')](function(_0x19b17e){_0x35fbda[_0x4670('0x62')]=_0x19b17e;return _0x35fbda;});}})[_0x4670('0x1f')](respondWithFilteredResult(_0x56cd99,_0x34539c))[_0x4670('0x28')](handleError(_0x56cd99,null));};exports[_0x4670('0x38')]=function(_0x40a90a,_0x125988,_0x28c547){var _0x5c8c31,_0x3d4ab5={},_0x1484b9;if(_0x40a90a[_0x4670('0x5c')]['to']){_0x1484b9=_0x40a90a[_0x4670('0x5c')]['to'][0x0];}return db[_0x4670('0x3d')]['find']({'where':{'id':_0x40a90a[_0x4670('0x52')]['id']},'include':[{'model':db[_0x4670('0x9b')],'as':'List','include':[{'model':db[_0x4670('0x9c')],'as':'Contacts','where':{'fax':_0x1484b9},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})['then'](handleEntityNotFound(_0x125988,null))['then'](function(_0x45f192){_0x5c8c31=_0x45f192;if(_0x40a90a[_0x4670('0x5c')][_0x4670('0x9d')]&&_0x40a90a[_0x4670('0x5c')][_0x4670('0x9d')][_0x4670('0x47')]){for(var _0x435f28=0x0;_0x435f28<_0x40a90a['body'][_0x4670('0x9d')]['length'];_0x435f28+=0x1){_0x40a90a[_0x4670('0x5c')][_0x4670('0x9d')][_0x435f28]={'filename':_0x40a90a[_0x4670('0x5c')][_0x4670('0x9d')][_0x435f28][_0x4670('0x37')],'id':_0x40a90a[_0x4670('0x5c')][_0x4670('0x9d')][_0x435f28]['id'],'path':path['join'](config[_0x4670('0x9e')],_0x4670('0x9f'),_0x40a90a[_0x4670('0x5c')]['attachments'][_0x435f28][_0x4670('0xa0')])};}}return respondWithRpcPromise('CheckAfterSend',_0x4670('0xa1'),{'FaxAccountId':_[_0x4670('0xa2')](_0x40a90a[_0x4670('0x52')]['id'])?undefined:_0x40a90a[_0x4670('0x52')]['id'],'path':_[_0x4670('0xa2')](_0x40a90a[_0x4670('0x5c')][_0x4670('0x9d')][0x0][_0x4670('0xa3')])?undefined:_0x40a90a[_0x4670('0x5c')]['attachments'][0x0][_0x4670('0xa3')],'fax':_[_0x4670('0xa2')](_0x40a90a[_0x4670('0x5c')]['to'][0x0])?undefined:_0x40a90a[_0x4670('0x5c')]['to'][0x0]},client9002);})[_0x4670('0x1f')](function(){if(_0x5c8c31){if(_[_0x4670('0xa2')](_0x40a90a[_0x4670('0x5c')][_0x4670('0xa4')])){_0x40a90a[_0x4670('0x5c')][_0x4670('0xa4')]=util[_0x4670('0xa5')]('\x22%s\x22\x20<%s>',_0x5c8c31[_0x4670('0x37')],_0x5c8c31[_0x4670('0xa6')]);}if(_0x5c8c31[_0x4670('0xa7')]){if(_0x5c8c31[_0x4670('0xa7')]['Contacts']['length']){return _0x5c8c31['List'][_0x4670('0xa8')][0x0];}else{return db[_0x4670('0x9c')]['create'](_[_0x4670('0x17')](_0x40a90a[_0x4670('0x5c')],{'firstName':_0x40a90a[_0x4670('0x5c')]['to'][0x0],'phone':_0x40a90a[_0x4670('0x5c')]['to'][0x0],'fax':_0x40a90a['body']['to'][0x0],'ListId':_0x5c8c31[_0x4670('0x94')]}));}}else{throw new Error(_0x4670('0xa9'));}}else{throw new Error(_0x4670('0xaa'));}})[_0x4670('0x1f')](function(_0x6acc9){if(_0x6acc9){return db['FaxInteraction'][_0x4670('0x54')]({'where':{'ContactId':_0x6acc9['id'],'closed':![],'FaxAccountId':_0x5c8c31['id']}})[_0x4670('0x1f')](function(_0x1cd0e8){if(_0x1cd0e8){return[_0x1cd0e8,![]];}return db[_0x4670('0x6a')][_0x4670('0x55')]({'UserId':_0x40a90a[_0x4670('0x56')]['id'],'ContactId':_0x6acc9['id'],'FaxAccountId':_0x5c8c31['id'],'fax':_0x40a90a[_0x4670('0x5c')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x4670('0x4d')](_0x40a90a[_0x4670('0x5c')],{'read':![],'body':_0x40a90a[_0x4670('0x5c')][_0x4670('0x9d')][0x0][_0x4670('0xab')],'FaxAccountId':_0x5c8c31['id'],'UserId':_0x40a90a[_0x4670('0x56')]['id'],'ContactId':_0x6acc9['id'],'AttachmentId':_0x40a90a[_0x4670('0x5c')][_0x4670('0x9d')][0x0]['id']})]},{'include':[{'model':db[_0x4670('0x97')],'as':'Messages'}]})[_0x4670('0x1f')](function(_0x16b1be){return[_0x16b1be,!![]];});});}else{throw new Error(_0x4670('0xac'));}})[_0x4670('0xad')](function(_0x2f0163,_0x1aed6e){if(_0x1aed6e){return _0x2f0163;}return db['FaxMessage'][_0x4670('0x55')]({'direction':'out','read':![],'body':_0x40a90a[_0x4670('0x5c')][_0x4670('0x9d')][0x0]['filename'],'FaxAccountId':_0x5c8c31['id'],'FaxInteractionId':_0x2f0163['id'],'UserId':_0x40a90a['user']['id'],'ContactId':_0x2f0163[_0x4670('0xae')],'AttachmentId':_0x40a90a[_0x4670('0x5c')][_0x4670('0x9d')][0x0]['id']})['then'](function(_0x492bda){_0x2f0163[_0x4670('0xaf')]['Messages']=[];_0x2f0163[_0x4670('0xaf')][_0x4670('0xb0')][_0x4670('0x82')](_0x492bda[_0x4670('0xaf')]);return _0x2f0163;});})[_0x4670('0x1f')](function(_0x20e8ba){respondWithRpcPromise(_0x4670('0xb1'),'SendFax',{'FaxAccountId':_[_0x4670('0xa2')](_0x40a90a[_0x4670('0x52')]['id'])?undefined:_0x40a90a['params']['id'],'path':_[_0x4670('0xa2')](_0x40a90a['body'][_0x4670('0x9d')][0x0][_0x4670('0xa3')])?undefined:_0x40a90a[_0x4670('0x5c')][_0x4670('0x9d')][0x0][_0x4670('0xa3')],'fax':_[_0x4670('0xa2')](_0x40a90a[_0x4670('0x5c')]['to'][0x0])?undefined:_0x40a90a[_0x4670('0x5c')]['to'][0x0],'AttachmentId':_0x40a90a[_0x4670('0x5c')][_0x4670('0x9d')][0x0]['id']},client9002)[_0x4670('0x1f')](function(_0xcde33c){logger[_0x4670('0x20')](_0x4670('0xb2'),_0xcde33c);})[_0x4670('0x28')](function(_0x369fde){logger[_0x4670('0x20')]('SendFaxRpc,\x20%s',_0x369fde);});return _0x20e8ba;})[_0x4670('0x1f')](respondWithResult(_0x125988,null))[_0x4670('0x28')](handleError(_0x125988,null));};exports[_0x4670('0xb3')]=function(_0x33534a,_0x8fb2ea,_0x570b22){return db[_0x4670('0x3d')]['find']({'where':{'id':_0x33534a['params']['id']}})[_0x4670('0x1f')](handleEntityNotFound(_0x8fb2ea,null))['then'](function(_0x1c522c){if(_0x1c522c){return _0x1c522c['addAgents'](_0x33534a[_0x4670('0x5c')][_0x4670('0x64')],_['omit'](_0x33534a['body'],[_0x4670('0x64'),'id'])||{})['spread'](function(_0x29ed5f){for(var _0x132f57=0x0;_0x132f57<_0x33534a[_0x4670('0x5c')][_0x4670('0x64')]['length'];_0x132f57+=0x1){socket[_0x4670('0xb4')](_0x4670('0xb5'),{'UserId':Number(_0x33534a[_0x4670('0x5c')][_0x4670('0x64')][_0x132f57]),'FaxAccountId':Number(_0x33534a[_0x4670('0x52')]['id'])});}return _0x29ed5f;});}})[_0x4670('0x1f')](respondWithResult(_0x8fb2ea,null))[_0x4670('0x28')](handleError(_0x8fb2ea,null));};exports[_0x4670('0xb6')]=function(_0x238765,_0x2b9828,_0x977be8){return db[_0x4670('0x3d')][_0x4670('0x54')]({'where':{'id':_0x238765[_0x4670('0x52')]['id']}})['then'](handleEntityNotFound(_0x2b9828,null))[_0x4670('0x1f')](function(_0x2a1b50){if(_0x2a1b50){return _0x2a1b50[_0x4670('0xb6')](_0x238765[_0x4670('0x41')][_0x4670('0x64')])[_0x4670('0x1f')](function(){if(_['isArray'](_0x238765['query'][_0x4670('0x64')])){for(var _0x3cb18e=0x0;_0x3cb18e<_0x238765[_0x4670('0x41')][_0x4670('0x64')][_0x4670('0x47')];_0x3cb18e+=0x1){socket['emit'](_0x4670('0xb7'),{'UserId':Number(_0x238765[_0x4670('0x41')][_0x4670('0x64')][_0x3cb18e]),'FaxAccountId':Number(_0x238765['params']['id'])});}}else{socket[_0x4670('0xb4')](_0x4670('0xb7'),{'UserId':Number(_0x238765[_0x4670('0x41')][_0x4670('0x64')]),'FaxAccountId':Number(_0x238765[_0x4670('0x52')]['id'])});}});}})['then'](respondWithStatusCode(_0x2b9828,null))['catch'](handleError(_0x2b9828,null));};exports[_0x4670('0xb8')]=function(_0xdee015,_0x2b5faa,_0x48627a){var _0xf6f231={};var _0xa857d9={};var _0x468813;var _0x582b9c;return db[_0x4670('0x3d')]['findOne']({'where':{'id':_0xdee015['params']['id']}})['then'](handleEntityNotFound(_0x2b5faa,null))[_0x4670('0x1f')](function(_0x5bb0d6){if(_0x5bb0d6){_0x468813=_0x5bb0d6;_0xa857d9[_0x4670('0x40')]=_[_0x4670('0x42')](db[_0x4670('0x6c')]['rawAttributes']);_0xa857d9['query']=_[_0x4670('0x42')](_0xdee015[_0x4670('0x41')]);_0xa857d9[_0x4670('0x43')]=_['intersection'](_0xa857d9[_0x4670('0x40')],_0xa857d9[_0x4670('0x41')]);_0xf6f231[_0x4670('0x44')]=_[_0x4670('0x45')](_0xa857d9['model'],qs[_0x4670('0x46')](_0xdee015['query'][_0x4670('0x46')]));_0xf6f231[_0x4670('0x44')]=_0xf6f231[_0x4670('0x44')][_0x4670('0x47')]?_0xf6f231[_0x4670('0x44')]:_0xa857d9[_0x4670('0x40')];_0xf6f231[_0x4670('0x49')]=qs[_0x4670('0x4a')](_0xdee015[_0x4670('0x41')]['sort']);_0xf6f231[_0x4670('0x4b')]=qs[_0x4670('0x43')](_[_0x4670('0x60')](_0xdee015['query'],_0xa857d9[_0x4670('0x43')]));if(_0xdee015[_0x4670('0x41')][_0x4670('0x4c')]){_0xf6f231[_0x4670('0x4b')]=_[_0x4670('0x4d')](_0xf6f231[_0x4670('0x4b')],{'$or':_[_0x4670('0x3c')](_0xf6f231[_0x4670('0x44')],function(_0x18252a){var _0x10d00d={};_0x10d00d[_0x18252a]={'$like':'%'+_0xdee015[_0x4670('0x41')]['filter']+'%'};return _0x10d00d;})});}_0xf6f231=_[_0x4670('0x4d')]({},_0xf6f231,_0xdee015[_0x4670('0x4f')]);return _0x468813[_0x4670('0xb8')](_0xf6f231);}})['then'](function(_0x1bc6d9){if(_0x1bc6d9){_0x582b9c=_0x1bc6d9['length'];if(!_0xdee015[_0x4670('0x41')][_0x4670('0x48')](_0x4670('0x66'))){_0xf6f231[_0x4670('0x2e')]=qs['limit'](_0xdee015[_0x4670('0x41')][_0x4670('0x2e')]);_0xf6f231[_0x4670('0x2c')]=qs['offset'](_0xdee015[_0x4670('0x41')][_0x4670('0x2c')]);}return _0x468813[_0x4670('0xb8')](_0xf6f231);}})[_0x4670('0x1f')](function(_0x51dc15){if(_0x51dc15){return _0x51dc15?{'count':_0x582b9c,'rows':_0x51dc15}:null;}})[_0x4670('0x1f')](respondWithResult(_0x2b5faa,null))[_0x4670('0x28')](handleError(_0x2b5faa,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index f782021..7aaded0 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 _0x9eac=['emit','hasOwnProperty','exports','events','FaxAccount','setMaxListeners','save','remove'];(function(_0x2d61ac,_0x18ff36){var _0x3f7d3c=function(_0x2ba7e5){while(--_0x2ba7e5){_0x2d61ac['push'](_0x2d61ac['shift']());}};_0x3f7d3c(++_0x18ff36);}(_0x9eac,0x6b));var _0xc9ea=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x9eac[_0xaa1b3e];return _0x454d7d;};'use strict';var EventEmitter=require(_0xc9ea('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xc9ea('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xc9ea('0x2')](0x0);var events={'afterCreate':_0xc9ea('0x3'),'afterUpdate':'update','afterDestroy':_0xc9ea('0x4')};function emitEvent(_0x3a55f0){return function(_0x1f50c1,_0x5a6156,_0x411df4){FaxAccountEvents['emit'](_0x3a55f0+':'+_0x1f50c1['id'],_0x1f50c1);FaxAccountEvents[_0xc9ea('0x5')](_0x3a55f0,_0x1f50c1);_0x411df4(null);};}for(var e in events){if(events[_0xc9ea('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xc9ea('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0xcf2f=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','../../mysqldb','FaxAccount'];(function(_0x4dfc30,_0x2f8ea3){var _0x4cabbe=function(_0xe9957c){while(--_0xe9957c){_0x4dfc30['push'](_0x4dfc30['shift']());}};_0x4cabbe(++_0x2f8ea3);}(_0xcf2f,0x1c6));var _0xfcf2=function(_0x413fdc,_0x15a39c){_0x413fdc=_0x413fdc-0x0;var _0x38e3ef=_0xcf2f[_0x413fdc];return _0x38e3ef;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xfcf2('0x0'))['db'][_0xfcf2('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xfcf2('0x2')](0x0);var events={'afterCreate':_0xfcf2('0x3'),'afterUpdate':'update','afterDestroy':_0xfcf2('0x4')};function emitEvent(_0x4729d){return function(_0x526302,_0xff49b2,_0x3ce4b9){FaxAccountEvents[_0xfcf2('0x5')](_0x4729d+':'+_0x526302['id'],_0x526302);FaxAccountEvents[_0xfcf2('0x5')](_0x4729d,_0x526302);_0x3ce4b9(null);};}for(var e in events){if(events[_0xfcf2('0x6')](e)){var event=events[e];FaxAccount[_0xfcf2('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 54de863..207e92c 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 _0x41be=['define','fax_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports'];(function(_0x7852f3,_0x192e1b){var _0x1deb6e=function(_0x652b97){while(--_0x652b97){_0x7852f3['push'](_0x7852f3['shift']());}};_0x1deb6e(++_0x192e1b);}(_0x41be,0x1e2));var _0xe41b=function(_0x401a4d,_0x4bb835){_0x401a4d=_0x401a4d-0x0;var _0x1faaff=_0x41be[_0x401a4d];return _0x1faaff;};'use strict';var _=require(_0xe41b('0x0'));var util=require('util');var logger=require(_0xe41b('0x1'))(_0xe41b('0x2'));var moment=require(_0xe41b('0x3'));var BPromise=require(_0xe41b('0x4'));var rp=require(_0xe41b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe41b('0x6'));var config=require(_0xe41b('0x7'));var attributes=require(_0xe41b('0x8'));module[_0xe41b('0x9')]=function(_0x2de8c6,_0x374b30){return _0x2de8c6[_0xe41b('0xa')]('FaxAccount',attributes,{'tableName':_0xe41b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35e0=['../../config/environment','exports','define','fax_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x35e0,0x67));var _0x035e=function(_0xd427e9,_0x154151){_0xd427e9=_0xd427e9-0x0;var _0x223172=_0x35e0[_0xd427e9];return _0x223172;};'use strict';var _=require(_0x035e('0x0'));var util=require(_0x035e('0x1'));var logger=require(_0x035e('0x2'))(_0x035e('0x3'));var moment=require('moment');var BPromise=require(_0x035e('0x4'));var rp=require(_0x035e('0x5'));var fs=require('fs');var path=require(_0x035e('0x6'));var rimraf=require('rimraf');var config=require(_0x035e('0x7'));var attributes=require('./faxAccount.attributes');module[_0x035e('0x8')]=function(_0x40651d,_0x19d2f9){return _0x40651d[_0x035e('0x9')]('FaxAccount',attributes,{'tableName':_0x035e('0xa'),'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 0db3823..c411890 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 _0x39bc=['list','priority','asc','Contacts','length','contact','FaxInteraction','create','Contact\x20not\x20found','autoclose','push','close','unmanaged','*,*,*,*','created','AttachmentId','interaction','UserId','User','name','unshift','agent','queueId','queue','waitForTheAssignedQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','include','map','model','NotifyFaxAccount','fax','CmContact','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','DESC','FaxApplication','Applications','get','account','applications'];(function(_0x3d7af5,_0x308d72){var _0x11b446=function(_0x3ff3e4){while(--_0x3ff3e4){_0x3d7af5['push'](_0x3d7af5['shift']());}};_0x11b446(++_0x308d72);}(_0x39bc,0xc9));var _0xc39b=function(_0x5c3a80,_0x4b2c5c){_0x5c3a80=_0x5c3a80-0x0;var _0xd6dae5=_0x39bc[_0x5c3a80];return _0xd6dae5;};'use strict';var _=require(_0xc39b('0x0'));var util=require(_0xc39b('0x1'));var moment=require(_0xc39b('0x2'));var BPromise=require(_0xc39b('0x3'));var rs=require(_0xc39b('0x4'));var fs=require('fs');var Redis=require(_0xc39b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc39b('0x6'));var logger=require(_0xc39b('0x7'))(_0xc39b('0x8'));var config=require(_0xc39b('0x9'));var jayson=require(_0xc39b('0xa'));var client=jayson[_0xc39b('0xb')][_0xc39b('0xc')]({'port':0x232c});config['redis']=_[_0xc39b('0xd')](config[_0xc39b('0xe')],{'host':_0xc39b('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc39b('0xe')]));require(_0xc39b('0x10'))[_0xc39b('0x11')](socket);function respondWithRpcPromise(_0x59d6f8,_0x57ec2e,_0xdb1009){return new BPromise(function(_0x56bc9f,_0x627e2f){return client['request'](_0x59d6f8,_0xdb1009)[_0xc39b('0x12')](function(_0x4b8e58){logger[_0xc39b('0x13')](_0xc39b('0x14'),_0x57ec2e,'request\x20sent');logger[_0xc39b('0x15')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x57ec2e,_0xc39b('0x16'),JSON['stringify'](_0x4b8e58));if(_0x4b8e58[_0xc39b('0x17')]){if(_0x4b8e58['error'][_0xc39b('0x18')]===0x1f4){logger[_0xc39b('0x17')](_0xc39b('0x14'),_0x57ec2e,_0x4b8e58[_0xc39b('0x17')][_0xc39b('0x19')]);return _0x627e2f(_0x4b8e58[_0xc39b('0x17')][_0xc39b('0x19')]);}logger[_0xc39b('0x17')](_0xc39b('0x14'),_0x57ec2e,_0x4b8e58[_0xc39b('0x17')][_0xc39b('0x19')]);return _0x56bc9f(_0x4b8e58[_0xc39b('0x17')][_0xc39b('0x19')]);}else{logger[_0xc39b('0x13')](_0xc39b('0x14'),_0x57ec2e,_0xc39b('0x16'));_0x56bc9f(_0x4b8e58[_0xc39b('0x1a')]['message']);}})[_0xc39b('0x1b')](function(_0x2f73f2){logger['error'](_0xc39b('0x14'),_0x57ec2e,_0x2f73f2);_0x627e2f(_0x2f73f2);});});}exports[_0xc39b('0x1c')]=function(_0x5e203c){var _0x5cddad=this;return new Promise(function(_0x39c9c0,_0x310543){return db[_0xc39b('0x1d')]['findAll']({'raw':_0x5e203c[_0xc39b('0x1e')]?_0x5e203c['options'][_0xc39b('0x1f')]===undefined?!![]:![]:!![],'where':_0x5e203c['options']?_0x5e203c[_0xc39b('0x1e')][_0xc39b('0x20')]||null:null,'attributes':_0x5e203c[_0xc39b('0x1e')]?_0x5e203c[_0xc39b('0x1e')][_0xc39b('0x21')]||null:null,'limit':_0x5e203c['options']?_0x5e203c[_0xc39b('0x1e')]['limit']||null:null,'include':_0x5e203c['options']?_0x5e203c[_0xc39b('0x1e')][_0xc39b('0x22')]?_[_0xc39b('0x23')](_0x5e203c['options'][_0xc39b('0x22')],function(_0x559713){return{'model':db[_0x559713[_0xc39b('0x24')]],'as':_0x559713['as'],'attributes':_0x559713[_0xc39b('0x21')],'include':_0x559713['include']?_[_0xc39b('0x23')](_0x559713[_0xc39b('0x22')],function(_0x30481a){return{'model':db[_0x30481a['model']],'as':_0x30481a['as'],'attributes':_0x30481a[_0xc39b('0x21')],'include':_0x30481a[_0xc39b('0x22')]?_['map'](_0x30481a[_0xc39b('0x22')],function(_0x173fbb){return{'model':db[_0x173fbb[_0xc39b('0x24')]],'as':_0x173fbb['as'],'attributes':_0x173fbb['attributes']};}):[]};}):[]};}):[]:[]})[_0xc39b('0x12')](function(_0x4b6d17){logger[_0xc39b('0x13')](_0xc39b('0x1c'),_0x5e203c);logger[_0xc39b('0x15')](_0xc39b('0x1c'),_0x5e203c,JSON['stringify'](_0x4b6d17));_0x39c9c0(_0x4b6d17);})[_0xc39b('0x1b')](function(_0x152f16){logger[_0xc39b('0x17')](_0xc39b('0x1c'),_0x152f16[_0xc39b('0x19')],_0x5e203c);_0x310543(_0x5cddad[_0xc39b('0x17')](0x1f4,_0x152f16['message']));});});};exports[_0xc39b('0x25')]=function(_0x227f95,_0x299588,_0x5503bf){var _0x591ed2=this;return new Promise(function(_0x108573,_0x40d035){var _0x48e1c6={'body':_0x227f95['body'],'channel':_0xc39b('0x26')};var _0x30a17c=[];var _0x4d9617=[];var _0x388876={};return db[_0xc39b('0x27')]['describe']()[_0xc39b('0x12')](function(_0x46b1f4){if(!_0x46b1f4){throw new db[(_0xc39b('0x28'))][(_0xc39b('0x29'))]('no\x20available\x20attributes');}_0x30a17c=_[_0xc39b('0x2a')](_[_0xc39b('0x2b')](_0x46b1f4),[_0xc39b('0x2c'),_0xc39b('0x2d')]);_0x4d9617=_['difference'](_['keys'](_0x46b1f4),[_0xc39b('0x2c'),_0xc39b('0x2d'),'CompanyId',_0xc39b('0x2e')]);if(_0x227f95[_0xc39b('0x2f')]['id']){delete _0x227f95[_0xc39b('0x2f')]['id'];}if(_[_0xc39b('0x30')](_0x227f95[_0xc39b('0x2f')][_0xc39b('0x31')])){throw new db['Sequelize']['ValidationError'](_0xc39b('0x32'));}if(_[_0xc39b('0x30')](_0x227f95[_0xc39b('0x2f')]['body'])||_0x227f95[_0xc39b('0x2f')][_0xc39b('0x2f')]===''){throw new db[(_0xc39b('0x28'))][(_0xc39b('0x29'))](_0xc39b('0x33'));}if(_[_0xc39b('0x30')](_0x227f95[_0xc39b('0x2f')][_0xc39b('0x34')])){throw new db[(_0xc39b('0x28'))][(_0xc39b('0x29'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4d9617);}if(!_['includes'](_0x4d9617,_0x227f95[_0xc39b('0x2f')][_0xc39b('0x34')])){throw new db[(_0xc39b('0x28'))][(_0xc39b('0x29'))](_0xc39b('0x35')+_0x4d9617);}_0x388876[_0x227f95[_0xc39b('0x2f')]['mapKey']]=_0x227f95[_0xc39b('0x2f')][_0xc39b('0x31')];})[_0xc39b('0x12')](function(){return db[_0xc39b('0x1d')][_0xc39b('0x36')]({'where':{'id':_0x227f95['account']['id']},'include':[{'model':db[_0xc39b('0x37')],'as':_0xc39b('0x38'),'include':[{'model':db[_0xc39b('0x27')],'as':'Contacts','where':_0x388876,'limit':0x1,'order':[[_0xc39b('0x2d'),_0xc39b('0x39')]]}]},{'model':db[_0xc39b('0x3a')],'as':_0xc39b('0x3b')}]});})[_0xc39b('0x12')](function(_0x2709d1){if(_0x2709d1&&_0x2709d1[_0xc39b('0x38')]){var _0x31f8e3=_0x2709d1[_0xc39b('0x3c')]({'plain':!![]});_0x48e1c6[_0xc39b('0x3d')]=_0x31f8e3;_0x48e1c6[_0xc39b('0x3e')]=_0x31f8e3[_0xc39b('0x3b')];_0x48e1c6[_0xc39b('0x3f')]=_0x31f8e3['List'];_0x48e1c6[_0xc39b('0x3e')]=_['orderBy'](_0x48e1c6[_0xc39b('0x3e')],[_0xc39b('0x40')],[_0xc39b('0x41')]);if(_0x48e1c6[_0xc39b('0x3d')][_0xc39b('0x3b')]){delete _0x48e1c6['account'][_0xc39b('0x3b')];}if(_0x48e1c6['account']['List']&&_0x48e1c6[_0xc39b('0x3d')][_0xc39b('0x38')][_0xc39b('0x42')][_0xc39b('0x43')]){return _0x48e1c6['account']['List'][_0xc39b('0x42')][0x0];}var _0x40ebf3=_['defaults'](_0x227f95['body'],{'firstName':_0x227f95[_0xc39b('0x2f')][_0xc39b('0x31')],'ListId':_0x31f8e3['ListId']});_0x40ebf3[_0x227f95['body']['mapKey']]=_0x227f95[_0xc39b('0x2f')][_0xc39b('0x31')];return db[_0xc39b('0x27')]['create'](_0x40ebf3,{'fields':_0x30a17c,'raw':!![]});}})[_0xc39b('0x12')](function(_0x5ecee1){_0x48e1c6[_0xc39b('0x44')]=_0x5ecee1;if(_0x5ecee1){var _0x371858={'ContactId':_0x5ecee1['id'],'FaxAccountId':_0x227f95['account']['id'],'fax':_0x5ecee1[_0xc39b('0x26')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x5ecee1['id'],'closed':![],'FaxAccountId':_0x227f95[_0xc39b('0x3d')]['id']}})[_0xc39b('0x12')](function(_0x4ee7de){if(_0x4ee7de){return[_0x4ee7de,![]];}return db[_0xc39b('0x45')][_0xc39b('0x46')](_0x371858)['then'](function(_0x420d91){return[_0x420d91,!![]];});});}else{throw new Error(_0xc39b('0x47'));}})['spread'](function(_0x50696b,_0xa31cca){var _0x44a3bc=_0x50696b[_0xc39b('0x3c')]({'plain':!![]});if(_0xa31cca){if(_0x48e1c6['account'][_0xc39b('0x48')]){_0x48e1c6['applications'][_0xc39b('0x49')]({'id':0x0,'priority':_0x48e1c6[_0xc39b('0x3e')]['length']+0x1,'app':_0xc39b('0x4a'),'appdata':_0xc39b('0x4b'),'interval':_0xc39b('0x4c')});}_0x44a3bc[_0xc39b('0x4d')]=!![];}else{_0x44a3bc['created']=![];}_0x48e1c6['interaction']=_0x44a3bc;return db['FaxMessage'][_0xc39b('0x46')]({'body':_0x227f95[_0xc39b('0x2f')]['body'],'FaxAccountId':_0x227f95[_0xc39b('0x3d')]['id'],'FaxInteractionId':_0x50696b['id'],'direction':'in','ContactId':_0x50696b['ContactId'],'AttachmentId':_0x227f95[_0xc39b('0x2f')][_0xc39b('0x4e')]});})[_0xc39b('0x12')](function(_0x19bc7e){_0x48e1c6['message']=_0x19bc7e;if(!_0x48e1c6[_0xc39b('0x4f')][_0xc39b('0x50')])return;return db[_0xc39b('0x51')]['find']({'attributes':['id',_0xc39b('0x52')],'where':{'id':_0x48e1c6[_0xc39b('0x4f')][_0xc39b('0x50')]}});})[_0xc39b('0x12')](function(_0x54366b){if(_0x54366b){_0x48e1c6['applications'][_0xc39b('0x53')]({'id':0x0,'priority':0x0,'app':_0xc39b('0x54'),'appdata':_0x54366b[_0xc39b('0x52')]+','+(_0x48e1c6[_0xc39b('0x3d')]['waitForTheAssignedAgent']||0xa),'interval':_0xc39b('0x4c')});}if(!_0x48e1c6[_0xc39b('0x4f')][_0xc39b('0x55')])return;return db['FaxQueue'][_0xc39b('0x36')]({'attributes':['id',_0xc39b('0x52')],'where':{'id':_0x48e1c6[_0xc39b('0x4f')][_0xc39b('0x55')]}});})[_0xc39b('0x12')](function(_0x1cc08e){if(_0x1cc08e){_0x48e1c6[_0xc39b('0x3e')][_0xc39b('0x53')]({'id':0x0,'priority':0x1,'app':_0xc39b('0x56'),'appdata':_0x1cc08e['name']+','+(_0x48e1c6[_0xc39b('0x3d')][_0xc39b('0x57')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x48e1c6);})['then'](function(_0xae4ea4){_0x108573(_0xae4ea4);})['catch'](function(_0x393ccb){_0x40d035(_0x591ed2[_0xc39b('0x17')](0x1f4,_0x393ccb[_0xc39b('0x19')]));});});}; \ No newline at end of file +var _0x93d0=['redis','defaults','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','findAll','options','raw','where','attributes','include','map','model','then','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','CompanyId','isNil','from','from\x20is\x20mandatory','includes','mapKey','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','ListId','contact','fax','find','FaxInteraction','create','Contact\x20not\x20found','autoclose','push','length','close','unmanaged','*,*,*,*','created','AttachmentId','UserId','User','name','interaction','unshift','agent','waitForTheAssignedAgent','queueId','FaxQueue','queue','waitForTheAssignedQueue','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xbc2974,_0xec3342){var _0x3a5b4f=function(_0x5ec5b5){while(--_0x5ec5b5){_0xbc2974['push'](_0xbc2974['shift']());}};_0x3a5b4f(++_0xec3342);}(_0x93d0,0x1d7));var _0x093d=function(_0x55cf56,_0x4f9cae){_0x55cf56=_0x55cf56-0x0;var _0x38028c=_0x93d0[_0x55cf56];return _0x38028c;};'use strict';var _=require(_0x093d('0x0'));var util=require(_0x093d('0x1'));var moment=require(_0x093d('0x2'));var BPromise=require(_0x093d('0x3'));var rs=require(_0x093d('0x4'));var fs=require('fs');var Redis=require(_0x093d('0x5'));var db=require(_0x093d('0x6'))['db'];var utils=require(_0x093d('0x7'));var logger=require(_0x093d('0x8'))(_0x093d('0x9'));var config=require(_0x093d('0xa'));var jayson=require(_0x093d('0xb'));var client=jayson[_0x093d('0xc')][_0x093d('0xd')]({'port':0x232c});config[_0x093d('0xe')]=_[_0x093d('0xf')](config[_0x093d('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x093d('0x10'))(new Redis(config[_0x093d('0xe')]));require(_0x093d('0x11'))[_0x093d('0x12')](socket);function respondWithRpcPromise(_0x230e0e,_0x56dc29,_0x28a348){return new BPromise(function(_0x5757d9,_0x9c8903){return client[_0x093d('0x13')](_0x230e0e,_0x28a348)['then'](function(_0x5ede12){logger[_0x093d('0x14')](_0x093d('0x15'),_0x56dc29,_0x093d('0x16'));logger[_0x093d('0x17')](_0x093d('0x18'),_0x56dc29,_0x093d('0x16'),JSON[_0x093d('0x19')](_0x5ede12));if(_0x5ede12[_0x093d('0x1a')]){if(_0x5ede12[_0x093d('0x1a')][_0x093d('0x1b')]===0x1f4){logger[_0x093d('0x1a')](_0x093d('0x15'),_0x56dc29,_0x5ede12[_0x093d('0x1a')][_0x093d('0x1c')]);return _0x9c8903(_0x5ede12[_0x093d('0x1a')]['message']);}logger[_0x093d('0x1a')]('FaxAccount,\x20%s,\x20%s',_0x56dc29,_0x5ede12[_0x093d('0x1a')][_0x093d('0x1c')]);return _0x5757d9(_0x5ede12[_0x093d('0x1a')]['message']);}else{logger['info'](_0x093d('0x15'),_0x56dc29,_0x093d('0x16'));_0x5757d9(_0x5ede12[_0x093d('0x1d')]['message']);}})[_0x093d('0x1e')](function(_0x82162e){logger['error'](_0x093d('0x15'),_0x56dc29,_0x82162e);_0x9c8903(_0x82162e);});});}exports[_0x093d('0x1f')]=function(_0x11930b){var _0x227da1=this;return new Promise(function(_0x324b46,_0x4aa1cc){return db['FaxAccount'][_0x093d('0x20')]({'raw':_0x11930b[_0x093d('0x21')]?_0x11930b[_0x093d('0x21')][_0x093d('0x22')]===undefined?!![]:![]:!![],'where':_0x11930b['options']?_0x11930b[_0x093d('0x21')][_0x093d('0x23')]||null:null,'attributes':_0x11930b[_0x093d('0x21')]?_0x11930b['options'][_0x093d('0x24')]||null:null,'limit':_0x11930b[_0x093d('0x21')]?_0x11930b[_0x093d('0x21')]['limit']||null:null,'include':_0x11930b[_0x093d('0x21')]?_0x11930b[_0x093d('0x21')][_0x093d('0x25')]?_[_0x093d('0x26')](_0x11930b[_0x093d('0x21')][_0x093d('0x25')],function(_0x5f35c7){return{'model':db[_0x5f35c7[_0x093d('0x27')]],'as':_0x5f35c7['as'],'attributes':_0x5f35c7['attributes'],'include':_0x5f35c7[_0x093d('0x25')]?_[_0x093d('0x26')](_0x5f35c7[_0x093d('0x25')],function(_0x478309){return{'model':db[_0x478309[_0x093d('0x27')]],'as':_0x478309['as'],'attributes':_0x478309[_0x093d('0x24')],'include':_0x478309[_0x093d('0x25')]?_[_0x093d('0x26')](_0x478309['include'],function(_0x4f91c6){return{'model':db[_0x4f91c6[_0x093d('0x27')]],'as':_0x4f91c6['as'],'attributes':_0x4f91c6[_0x093d('0x24')]};}):[]};}):[]};}):[]:[]})[_0x093d('0x28')](function(_0x218c4d){logger['info'](_0x093d('0x1f'),_0x11930b);logger[_0x093d('0x17')](_0x093d('0x1f'),_0x11930b,JSON[_0x093d('0x19')](_0x218c4d));_0x324b46(_0x218c4d);})[_0x093d('0x1e')](function(_0x6403fb){logger[_0x093d('0x1a')](_0x093d('0x1f'),_0x6403fb[_0x093d('0x1c')],_0x11930b);_0x4aa1cc(_0x227da1[_0x093d('0x1a')](0x1f4,_0x6403fb[_0x093d('0x1c')]));});});};exports[_0x093d('0x29')]=function(_0x4afbf9,_0x351327,_0x29e3f3){var _0x462587=this;return new Promise(function(_0x575bf7,_0x46ee95){var _0x25ead5={'body':_0x4afbf9[_0x093d('0x2a')],'channel':'fax'};var _0x428cd1=[];var _0xd7878c=[];var _0x2569e2={};return db[_0x093d('0x2b')][_0x093d('0x2c')]()[_0x093d('0x28')](function(_0x416e48){if(!_0x416e48){throw new db[(_0x093d('0x2d'))][(_0x093d('0x2e'))](_0x093d('0x2f'));}_0x428cd1=_['difference'](_[_0x093d('0x30')](_0x416e48),[_0x093d('0x31'),_0x093d('0x32')]);_0xd7878c=_[_0x093d('0x33')](_[_0x093d('0x30')](_0x416e48),['createdAt',_0x093d('0x32'),_0x093d('0x34'),'ListId']);if(_0x4afbf9[_0x093d('0x2a')]['id']){delete _0x4afbf9[_0x093d('0x2a')]['id'];}if(_[_0x093d('0x35')](_0x4afbf9[_0x093d('0x2a')][_0x093d('0x36')])){throw new db[(_0x093d('0x2d'))][(_0x093d('0x2e'))](_0x093d('0x37'));}if(_[_0x093d('0x35')](_0x4afbf9[_0x093d('0x2a')][_0x093d('0x2a')])||_0x4afbf9[_0x093d('0x2a')][_0x093d('0x2a')]===''){throw new db[(_0x093d('0x2d'))][(_0x093d('0x2e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4afbf9[_0x093d('0x2a')]['mapKey'])){throw new db[(_0x093d('0x2d'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xd7878c);}if(!_[_0x093d('0x38')](_0xd7878c,_0x4afbf9[_0x093d('0x2a')][_0x093d('0x39')])){throw new db['Sequelize'][(_0x093d('0x2e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xd7878c);}_0x2569e2[_0x4afbf9[_0x093d('0x2a')][_0x093d('0x39')]]=_0x4afbf9[_0x093d('0x2a')]['from'];})['then'](function(){return db['FaxAccount']['find']({'where':{'id':_0x4afbf9[_0x093d('0x3a')]['id']},'include':[{'model':db[_0x093d('0x3b')],'as':_0x093d('0x3c'),'include':[{'model':db[_0x093d('0x2b')],'as':_0x093d('0x3d'),'where':_0x2569e2,'limit':0x1,'order':[[_0x093d('0x32'),_0x093d('0x3e')]]}]},{'model':db[_0x093d('0x3f')],'as':_0x093d('0x40')}]});})[_0x093d('0x28')](function(_0x17b30f){if(_0x17b30f&&_0x17b30f[_0x093d('0x3c')]){var _0x260d21=_0x17b30f[_0x093d('0x41')]({'plain':!![]});_0x25ead5[_0x093d('0x3a')]=_0x260d21;_0x25ead5[_0x093d('0x42')]=_0x260d21[_0x093d('0x40')];_0x25ead5[_0x093d('0x43')]=_0x260d21[_0x093d('0x3c')];_0x25ead5[_0x093d('0x42')]=_[_0x093d('0x44')](_0x25ead5[_0x093d('0x42')],[_0x093d('0x45')],['asc']);if(_0x25ead5['account']['Applications']){delete _0x25ead5[_0x093d('0x3a')][_0x093d('0x40')];}if(_0x25ead5['account'][_0x093d('0x3c')]&&_0x25ead5[_0x093d('0x3a')][_0x093d('0x3c')][_0x093d('0x3d')]['length']){return _0x25ead5[_0x093d('0x3a')][_0x093d('0x3c')][_0x093d('0x3d')][0x0];}var _0x3d4e1e=_['defaults'](_0x4afbf9[_0x093d('0x2a')],{'firstName':_0x4afbf9[_0x093d('0x2a')][_0x093d('0x36')],'ListId':_0x260d21[_0x093d('0x46')]});_0x3d4e1e[_0x4afbf9[_0x093d('0x2a')]['mapKey']]=_0x4afbf9[_0x093d('0x2a')][_0x093d('0x36')];return db['CmContact']['create'](_0x3d4e1e,{'fields':_0x428cd1,'raw':!![]});}})[_0x093d('0x28')](function(_0x52aeea){_0x25ead5[_0x093d('0x47')]=_0x52aeea;if(_0x52aeea){var _0x5a5420={'ContactId':_0x52aeea['id'],'FaxAccountId':_0x4afbf9['account']['id'],'fax':_0x52aeea[_0x093d('0x48')]};return db['FaxInteraction'][_0x093d('0x49')]({'where':{'ContactId':_0x52aeea['id'],'closed':![],'FaxAccountId':_0x4afbf9[_0x093d('0x3a')]['id']}})['then'](function(_0x2f8c75){if(_0x2f8c75){return[_0x2f8c75,![]];}return db[_0x093d('0x4a')][_0x093d('0x4b')](_0x5a5420)['then'](function(_0x5c6316){return[_0x5c6316,!![]];});});}else{throw new Error(_0x093d('0x4c'));}})['spread'](function(_0x4f2dc1,_0x9da2d8){var _0x53b7ce=_0x4f2dc1['get']({'plain':!![]});if(_0x9da2d8){if(_0x25ead5['account'][_0x093d('0x4d')]){_0x25ead5[_0x093d('0x42')][_0x093d('0x4e')]({'id':0x0,'priority':_0x25ead5[_0x093d('0x42')][_0x093d('0x4f')]+0x1,'app':_0x093d('0x50'),'appdata':_0x093d('0x51'),'interval':_0x093d('0x52')});}_0x53b7ce[_0x093d('0x53')]=!![];}else{_0x53b7ce[_0x093d('0x53')]=![];}_0x25ead5['interaction']=_0x53b7ce;return db['FaxMessage'][_0x093d('0x4b')]({'body':_0x4afbf9['body'][_0x093d('0x2a')],'FaxAccountId':_0x4afbf9['account']['id'],'FaxInteractionId':_0x4f2dc1['id'],'direction':'in','ContactId':_0x4f2dc1['ContactId'],'AttachmentId':_0x4afbf9[_0x093d('0x2a')][_0x093d('0x54')]});})[_0x093d('0x28')](function(_0x35a1ed){_0x25ead5[_0x093d('0x1c')]=_0x35a1ed;if(!_0x25ead5['interaction'][_0x093d('0x55')])return;return db[_0x093d('0x56')]['find']({'attributes':['id',_0x093d('0x57')],'where':{'id':_0x25ead5[_0x093d('0x58')][_0x093d('0x55')]}});})[_0x093d('0x28')](function(_0xeb54fe){if(_0xeb54fe){_0x25ead5[_0x093d('0x42')][_0x093d('0x59')]({'id':0x0,'priority':0x0,'app':_0x093d('0x5a'),'appdata':_0xeb54fe['name']+','+(_0x25ead5['account'][_0x093d('0x5b')]||0xa),'interval':_0x093d('0x52')});}if(!_0x25ead5[_0x093d('0x58')][_0x093d('0x5c')])return;return db[_0x093d('0x5d')][_0x093d('0x49')]({'attributes':['id',_0x093d('0x57')],'where':{'id':_0x25ead5[_0x093d('0x58')]['queueId']}});})[_0x093d('0x28')](function(_0x6e85d2){if(_0x6e85d2){_0x25ead5[_0x093d('0x42')][_0x093d('0x59')]({'id':0x0,'priority':0x1,'app':_0x093d('0x5e'),'appdata':_0x6e85d2['name']+','+(_0x25ead5[_0x093d('0x3a')][_0x093d('0x5f')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x093d('0x60'),_0x25ead5);})[_0x093d('0x28')](function(_0x2e6672){_0x575bf7(_0x2e6672);})[_0x093d('0x1e')](function(_0x56e6f5){_0x46ee95(_0x462587[_0x093d('0x1a')](0x1f4,_0x56e6f5[_0x093d('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index fed7246..9197e25 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 _0xe0bb=['save','remove','update','emit','removeListener','register','length','faxAccount:','./faxAccount.events'];(function(_0x216d12,_0x5d7760){var _0x3e6a4d=function(_0x389cbe){while(--_0x389cbe){_0x216d12['push'](_0x216d12['shift']());}};_0x3e6a4d(++_0x5d7760);}(_0xe0bb,0x116));var _0xbe0b=function(_0x17371c,_0x1a1e9c){_0x17371c=_0x17371c-0x0;var _0x422265=_0xe0bb[_0x17371c];return _0x422265;};'use strict';var FaxAccountEvents=require(_0xbe0b('0x0'));var events=[_0xbe0b('0x1'),_0xbe0b('0x2'),_0xbe0b('0x3')];function createListener(_0x3b2f38,_0x30bb82){return function(_0x544d76){_0x30bb82[_0xbe0b('0x4')](_0x3b2f38,_0x544d76);};}function removeListener(_0xa07433,_0x5d1ed9){return function(){FaxAccountEvents[_0xbe0b('0x5')](_0xa07433,_0x5d1ed9);};}exports[_0xbe0b('0x6')]=function(_0x34aa00){for(var _0x3e14b3=0x0,_0x1740b0=events[_0xbe0b('0x7')];_0x3e14b3<_0x1740b0;_0x3e14b3++){var _0xd4cc76=events[_0x3e14b3];var _0x236338=createListener(_0xbe0b('0x8')+_0xd4cc76,_0x34aa00);FaxAccountEvents['on'](_0xd4cc76,_0x236338);}}; \ No newline at end of file +var _0x1969=['save','remove','update','emit','removeListener','register','length','./faxAccount.events'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x1969,0x18f));var _0x9196=function(_0x367dbd,_0x106eba){_0x367dbd=_0x367dbd-0x0;var _0x3ddb21=_0x1969[_0x367dbd];return _0x3ddb21;};'use strict';var FaxAccountEvents=require(_0x9196('0x0'));var events=[_0x9196('0x1'),_0x9196('0x2'),_0x9196('0x3')];function createListener(_0x2e118c,_0x40c400){return function(_0x180456){_0x40c400[_0x9196('0x4')](_0x2e118c,_0x180456);};}function removeListener(_0x56bf6d,_0xfc2407){return function(){FaxAccountEvents[_0x9196('0x5')](_0x56bf6d,_0xfc2407);};}exports[_0x9196('0x6')]=function(_0x4f349c){for(var _0x4dae03=0x0,_0x19b7ba=events[_0x9196('0x7')];_0x4dae03<_0x19b7ba;_0x4dae03++){var _0x19b4af=events[_0x4dae03];var _0x5aeca0=createListener('faxAccount:'+_0x19b4af,_0x4f349c);FaxAccountEvents['on'](_0x19b4af,_0x5aeca0);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index dc548b9..9380d33 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 _0x2835=['getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','getAgents','post','create','/:id/dispositions','addDisposition','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','/:id/users','addAgents','/:id','update','delete','destroy','removeAnswers','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x7e3b9b,_0x284b8f){var _0x5c35f3=function(_0x4b57c9){while(--_0x4b57c9){_0x7e3b9b['push'](_0x7e3b9b['shift']());}};_0x5c35f3(++_0x284b8f);}(_0x2835,0x1b5));var _0x5283=function(_0x140c0a,_0x1bd761){_0x140c0a=_0x140c0a-0x0;var _0x2f9c64=_0x2835[_0x140c0a];return _0x2f9c64;};'use strict';var multer=require('multer');var util=require(_0x5283('0x0'));var path=require(_0x5283('0x1'));var timeout=require(_0x5283('0x2'));var express=require('express');var router=express[_0x5283('0x3')]();var fs_extra=require(_0x5283('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5283('0x5'));var config=require(_0x5283('0x6'));var controller=require(_0x5283('0x7'));router[_0x5283('0x8')]('/',auth[_0x5283('0x9')](),controller[_0x5283('0xa')]);router[_0x5283('0x8')](_0x5283('0xb'),auth[_0x5283('0x9')](),controller[_0x5283('0xc')]);router[_0x5283('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x5283('0xd')]);router[_0x5283('0x8')]('/:id/dispositions',auth[_0x5283('0x9')](),controller[_0x5283('0xe')]);router[_0x5283('0x8')](_0x5283('0xf'),auth[_0x5283('0x9')](),controller['getAnswers']);router[_0x5283('0x8')](_0x5283('0x10'),auth['isAuthenticated'](),controller[_0x5283('0x11')]);router[_0x5283('0x8')](_0x5283('0x12'),auth['isAuthenticated'](),controller['getApplications']);router[_0x5283('0x8')](_0x5283('0x13'),auth[_0x5283('0x9')](),controller[_0x5283('0x14')]);router['get']('/:id/users',auth[_0x5283('0x9')](),controller[_0x5283('0x15')]);router[_0x5283('0x16')]('/',auth[_0x5283('0x9')](),controller[_0x5283('0x17')]);router[_0x5283('0x16')](_0x5283('0x18'),auth[_0x5283('0x9')](),controller[_0x5283('0x19')]);router[_0x5283('0x16')](_0x5283('0xf'),auth[_0x5283('0x9')](),controller['addAnswer']);router['post']('/:id/interactions',auth['isAuthenticated'](),controller['addInteraction']);router['post']('/:id/applications',auth[_0x5283('0x9')](),controller[_0x5283('0x1a')]);router[_0x5283('0x16')](_0x5283('0x1b'),auth[_0x5283('0x9')](),controller['addAccountApplications']);router[_0x5283('0x16')](_0x5283('0x1c'),auth[_0x5283('0x9')](),controller[_0x5283('0x1d')]);router[_0x5283('0x16')](_0x5283('0x1e'),auth[_0x5283('0x9')](),controller[_0x5283('0x1f')]);router[_0x5283('0x16')](_0x5283('0x20'),auth[_0x5283('0x9')](),controller[_0x5283('0x21')]);router['put'](_0x5283('0x22'),auth['isAuthenticated'](),controller[_0x5283('0x23')]);router[_0x5283('0x24')](_0x5283('0x22'),auth[_0x5283('0x9')](),controller[_0x5283('0x25')]);router['delete'](_0x5283('0x18'),auth[_0x5283('0x9')](),controller['removeDispositions']);router[_0x5283('0x24')](_0x5283('0xf'),auth[_0x5283('0x9')](),controller[_0x5283('0x26')]);router[_0x5283('0x24')](_0x5283('0x20'),auth['isAuthenticated'](),controller[_0x5283('0x27')]);module[_0x5283('0x28')]=router; \ No newline at end of file +var _0x2428=['removeAnswers','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','create','post','addDisposition','addAnswer','addInteraction','addApplications','/updateaccountapplications','/:id/send','/:id/users','addAgents','put','/:id','update','delete','destroy'];(function(_0x5717fa,_0x4c0526){var _0xcfcaa3=function(_0x239180){while(--_0x239180){_0x5717fa['push'](_0x5717fa['shift']());}};_0xcfcaa3(++_0x4c0526);}(_0x2428,0x172));var _0x8242=function(_0x45fd90,_0x3bdb57){_0x45fd90=_0x45fd90-0x0;var _0x5ec055=_0x2428[_0x45fd90];return _0x5ec055;};'use strict';var multer=require(_0x8242('0x0'));var util=require(_0x8242('0x1'));var path=require(_0x8242('0x2'));var timeout=require(_0x8242('0x3'));var express=require(_0x8242('0x4'));var router=express[_0x8242('0x5')]();var fs_extra=require(_0x8242('0x6'));var auth=require(_0x8242('0x7'));var interaction=require(_0x8242('0x8'));var config=require(_0x8242('0x9'));var controller=require(_0x8242('0xa'));router[_0x8242('0xb')]('/',auth['isAuthenticated'](),controller[_0x8242('0xc')]);router[_0x8242('0xb')]('/describe',auth[_0x8242('0xd')](),controller[_0x8242('0xe')]);router[_0x8242('0xb')]('/:id',auth[_0x8242('0xd')](),controller[_0x8242('0xf')]);router[_0x8242('0xb')](_0x8242('0x10'),auth['isAuthenticated'](),controller[_0x8242('0x11')]);router[_0x8242('0xb')](_0x8242('0x12'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x8242('0xb')](_0x8242('0x13'),auth[_0x8242('0xd')](),controller['getInteractions']);router[_0x8242('0xb')](_0x8242('0x14'),auth[_0x8242('0xd')](),controller[_0x8242('0x15')]);router['get'](_0x8242('0x16'),auth['isAuthenticated'](),controller[_0x8242('0x17')]);router[_0x8242('0xb')]('/:id/users',auth['isAuthenticated'](),controller[_0x8242('0x18')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8242('0x19')]);router[_0x8242('0x1a')](_0x8242('0x10'),auth[_0x8242('0xd')](),controller[_0x8242('0x1b')]);router[_0x8242('0x1a')]('/:id/canned_answers',auth[_0x8242('0xd')](),controller[_0x8242('0x1c')]);router[_0x8242('0x1a')](_0x8242('0x13'),auth[_0x8242('0xd')](),controller[_0x8242('0x1d')]);router['post'](_0x8242('0x14'),auth['isAuthenticated'](),controller[_0x8242('0x1e')]);router[_0x8242('0x1a')]('/addaccountapplications',auth['isAuthenticated'](),controller['addAccountApplications']);router[_0x8242('0x1a')](_0x8242('0x1f'),auth[_0x8242('0xd')](),controller['updateAccountApplications']);router[_0x8242('0x1a')](_0x8242('0x20'),auth[_0x8242('0xd')](),controller['send']);router[_0x8242('0x1a')](_0x8242('0x21'),auth['isAuthenticated'](),controller[_0x8242('0x22')]);router[_0x8242('0x23')](_0x8242('0x24'),auth[_0x8242('0xd')](),controller[_0x8242('0x25')]);router[_0x8242('0x26')](_0x8242('0x24'),auth['isAuthenticated'](),controller[_0x8242('0x27')]);router['delete'](_0x8242('0x10'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x8242('0x26')](_0x8242('0x12'),auth[_0x8242('0xd')](),controller[_0x8242('0x28')]);router['delete'](_0x8242('0x21'),auth[_0x8242('0xd')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 433a51b..afc981b 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 _0x7d04=['noop','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x23a9f6,_0x5582e1){var _0x27dc42=function(_0xa0d3ef){while(--_0xa0d3ef){_0x23a9f6['push'](_0x23a9f6['shift']());}};_0x27dc42(++_0x5582e1);}(_0x7d04,0x170));var _0x47d0=function(_0x281457,_0x5d9e3c){_0x281457=_0x281457-0x0;var _0x2dea1e=_0x7d04[_0x281457];return _0x2dea1e;};'use strict';var Sequelize=require(_0x47d0('0x0'));module[_0x47d0('0x1')]={'priority':{'type':Sequelize[_0x47d0('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x47d0('0x3')],'allowNull':![],'defaultValue':_0x47d0('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x47d0('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x47d0('0x5')}}; \ No newline at end of file +var _0x929f=['INTEGER','STRING','TEXT','sequelize','exports'];(function(_0x174316,_0x2323d9){var _0x1c0b48=function(_0x23903c){while(--_0x23903c){_0x174316['push'](_0x174316['shift']());}};_0x1c0b48(++_0x2323d9);}(_0x929f,0xd0));var _0xf929=function(_0x4c65cb,_0x55c0dd){_0x4c65cb=_0x4c65cb-0x0;var _0x9a3ef4=_0x929f[_0x4c65cb];return _0x9a3ef4;};'use strict';var Sequelize=require(_0xf929('0x0'));module[_0xf929('0x1')]={'priority':{'type':Sequelize[_0xf929('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf929('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf929('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf929('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index a0cc999..d1ffab9 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 _0xb91a=['intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','apply','reject','update','then','end','error','name','send','index','FaxApplication','rawAttributes','type','key','model','map','query','keys','filters'];(function(_0x49cee9,_0x28e9de){var _0x5c896d=function(_0x29a2dd){while(--_0x29a2dd){_0x49cee9['push'](_0x49cee9['shift']());}};_0x5c896d(++_0x28e9de);}(_0xb91a,0x199));var _0xab91=function(_0x38885c,_0x59c452){_0x38885c=_0x38885c-0x0;var _0x3b27a2=_0xb91a[_0x38885c];return _0x3b27a2;};'use strict';var emlformat=require(_0xab91('0x0'));var rimraf=require(_0xab91('0x1'));var zipdir=require(_0xab91('0x2'));var jsonpatch=require(_0xab91('0x3'));var rp=require(_0xab91('0x4'));var moment=require(_0xab91('0x5'));var BPromise=require(_0xab91('0x6'));var Mustache=require(_0xab91('0x7'));var util=require(_0xab91('0x8'));var path=require('path');var sox=require(_0xab91('0x9'));var csv=require('to-csv');var ejs=require(_0xab91('0xa'));var fs=require('fs');var fs_extra=require(_0xab91('0xb'));var _=require('lodash');var squel=require(_0xab91('0xc'));var crypto=require(_0xab91('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xab91('0xe'));var toCsv=require(_0xab91('0xf'));var querystring=require('querystring');var Papa=require(_0xab91('0x10'));var Redis=require(_0xab91('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xab91('0x12'));var as=require(_0xab91('0x13'));var hardwareService=require(_0xab91('0x14'));var logger=require(_0xab91('0x15'))(_0xab91('0x16'));var utils=require(_0xab91('0x17'));var config=require(_0xab91('0x18'));var licenseUtil=require(_0xab91('0x19'));var db=require(_0xab91('0x1a'))['db'];function respondWithStatusCode(_0x4bcf05,_0x5621c3){_0x5621c3=_0x5621c3||0xcc;return function(_0x2381eb){if(_0x2381eb){return _0x4bcf05[_0xab91('0x1b')](_0x5621c3);}return _0x4bcf05['status'](_0x5621c3)['end']();};}function respondWithResult(_0x1352a8,_0x2d293a){_0x2d293a=_0x2d293a||0xc8;return function(_0x249d4b){if(_0x249d4b){return _0x1352a8['status'](_0x2d293a)[_0xab91('0x1c')](_0x249d4b);}};}function respondWithFilteredResult(_0x501a57,_0xfcda5c){return function(_0x4df06f){if(_0x4df06f){var _0x199360=typeof _0xfcda5c[_0xab91('0x1d')]===_0xab91('0x1e')&&typeof _0xfcda5c[_0xab91('0x1f')]===_0xab91('0x1e');var _0x1115f1=_0x4df06f['count'];var _0x3c7ce8=_0x199360?0x0:_0xfcda5c[_0xab91('0x1d')];var _0x304189=_0x199360?_0x4df06f[_0xab91('0x20')]:_0xfcda5c['offset']+_0xfcda5c[_0xab91('0x1f')];var _0x1769a7;if(_0x304189>=_0x1115f1){_0x304189=_0x1115f1;_0x1769a7=0xc8;}else{_0x1769a7=0xce;}_0x501a57[_0xab91('0x21')](_0x1769a7);return _0x501a57[_0xab91('0x22')]('Content-Range',_0x3c7ce8+'-'+_0x304189+'/'+_0x1115f1)[_0xab91('0x1c')](_0x4df06f);}return null;};}function patchUpdates(_0x1ccd26){return function(_0x391390){try{jsonpatch[_0xab91('0x23')](_0x391390,_0x1ccd26,!![]);}catch(_0x44209c){return BPromise[_0xab91('0x24')](_0x44209c);}return _0x391390['save']();};}function saveUpdates(_0x2decb3,_0x2075c1){return function(_0x6cb2f3){if(_0x6cb2f3){return _0x6cb2f3[_0xab91('0x25')](_0x2decb3)[_0xab91('0x26')](function(_0xc0d8a2){return _0xc0d8a2;});}return null;};}function removeEntity(_0x2a7611,_0x2401d6){return function(_0x553f3b){if(_0x553f3b){return _0x553f3b['destroy']()['then'](function(){_0x2a7611['status'](0xcc)[_0xab91('0x27')]();});}};}function handleEntityNotFound(_0x49c942,_0x23c682){return function(_0x42e996){if(!_0x42e996){_0x49c942[_0xab91('0x1b')](0x194);}return _0x42e996;};}function handleError(_0x1a5983,_0x1b49fd){_0x1b49fd=_0x1b49fd||0x1f4;return function(_0x429a40){logger[_0xab91('0x28')](_0x429a40['stack']);if(_0x429a40[_0xab91('0x29')]){delete _0x429a40[_0xab91('0x29')];}_0x1a5983[_0xab91('0x21')](_0x1b49fd)[_0xab91('0x2a')](_0x429a40);};}exports[_0xab91('0x2b')]=function(_0x1e915e,_0x27f538){var _0x1d9960={},_0x3d0a1b={},_0x858213={'count':0x0,'rows':[]};var _0x124a43=_['map'](db[_0xab91('0x2c')][_0xab91('0x2d')],function(_0x186008){return{'name':_0x186008['fieldName'],'type':_0x186008[_0xab91('0x2e')][_0xab91('0x2f')]};});_0x3d0a1b[_0xab91('0x30')]=_[_0xab91('0x31')](_0x124a43,'name');_0x3d0a1b[_0xab91('0x32')]=_[_0xab91('0x33')](_0x1e915e[_0xab91('0x32')]);_0x3d0a1b[_0xab91('0x34')]=_[_0xab91('0x35')](_0x3d0a1b[_0xab91('0x30')],_0x3d0a1b[_0xab91('0x32')]);_0x1d9960[_0xab91('0x36')]=_[_0xab91('0x35')](_0x3d0a1b[_0xab91('0x30')],qs['fields'](_0x1e915e['query'][_0xab91('0x37')]));_0x1d9960['attributes']=_0x1d9960[_0xab91('0x36')]['length']?_0x1d9960['attributes']:_0x3d0a1b['model'];if(!_0x1e915e['query'][_0xab91('0x38')]('nolimit')){_0x1d9960[_0xab91('0x1f')]=qs[_0xab91('0x1f')](_0x1e915e['query']['limit']);_0x1d9960[_0xab91('0x1d')]=qs[_0xab91('0x1d')](_0x1e915e[_0xab91('0x32')][_0xab91('0x1d')]);}_0x1d9960[_0xab91('0x39')]=qs[_0xab91('0x3a')](_0x1e915e['query']['sort']);_0x1d9960[_0xab91('0x3b')]=qs[_0xab91('0x34')](_[_0xab91('0x3c')](_0x1e915e[_0xab91('0x32')],_0x3d0a1b[_0xab91('0x34')]),_0x124a43);if(_0x1e915e[_0xab91('0x32')][_0xab91('0x3d')]){_0x1d9960[_0xab91('0x3b')]=_['merge'](_0x1d9960[_0xab91('0x3b')],{'$or':_[_0xab91('0x31')](_0x124a43,function(_0x531d58){if(_0x531d58[_0xab91('0x2e')]!==_0xab91('0x3e')){var _0x25b1ce={};_0x25b1ce[_0x531d58[_0xab91('0x29')]]={'$like':'%'+_0x1e915e[_0xab91('0x32')][_0xab91('0x3d')]+'%'};return _0x25b1ce;}})});}_0x1d9960=_[_0xab91('0x3f')]({},_0x1d9960,_0x1e915e['options']);var _0x4bad8b={'where':_0x1d9960[_0xab91('0x3b')]};return db['FaxApplication']['count'](_0x4bad8b)[_0xab91('0x26')](function(_0x50d212){_0x858213[_0xab91('0x20')]=_0x50d212;if(_0x1e915e[_0xab91('0x32')][_0xab91('0x40')]){_0x1d9960[_0xab91('0x41')]=[{'all':!![]}];}return db[_0xab91('0x2c')][_0xab91('0x42')](_0x1d9960);})[_0xab91('0x26')](function(_0x3e0fe3){_0x858213[_0xab91('0x43')]=_0x3e0fe3;return _0x858213;})[_0xab91('0x26')](respondWithFilteredResult(_0x27f538,_0x1d9960))[_0xab91('0x44')](handleError(_0x27f538,null));};exports[_0xab91('0x45')]=function(_0xc02978,_0x22ff75){var _0x3beb0d={'raw':!![],'where':{'id':_0xc02978[_0xab91('0x46')]['id']}},_0x481dfc={};_0x481dfc[_0xab91('0x30')]=_[_0xab91('0x33')](db[_0xab91('0x2c')][_0xab91('0x2d')]);_0x481dfc[_0xab91('0x32')]=_[_0xab91('0x33')](_0xc02978['query']);_0x481dfc['filters']=_[_0xab91('0x35')](_0x481dfc[_0xab91('0x30')],_0x481dfc[_0xab91('0x32')]);_0x3beb0d[_0xab91('0x36')]=_['intersection'](_0x481dfc[_0xab91('0x30')],qs[_0xab91('0x37')](_0xc02978[_0xab91('0x32')][_0xab91('0x37')]));_0x3beb0d[_0xab91('0x36')]=_0x3beb0d['attributes'][_0xab91('0x47')]?_0x3beb0d[_0xab91('0x36')]:_0x481dfc[_0xab91('0x30')];if(_0xc02978[_0xab91('0x32')][_0xab91('0x40')]){_0x3beb0d[_0xab91('0x41')]=[{'all':!![]}];}_0x3beb0d=_[_0xab91('0x3f')]({},_0x3beb0d,_0xc02978[_0xab91('0x48')]);return db[_0xab91('0x2c')]['find'](_0x3beb0d)[_0xab91('0x26')](handleEntityNotFound(_0x22ff75,null))[_0xab91('0x26')](respondWithResult(_0x22ff75,null))[_0xab91('0x44')](handleError(_0x22ff75,null));};exports['create']=function(_0x59e77a,_0x399a79){return db[_0xab91('0x2c')][_0xab91('0x49')](_0x59e77a[_0xab91('0x4a')],{})['then'](respondWithResult(_0x399a79,0xc9))[_0xab91('0x44')](handleError(_0x399a79,null));};exports[_0xab91('0x25')]=function(_0xc732a3,_0x529d1b){if(_0xc732a3[_0xab91('0x4a')]['id']){delete _0xc732a3[_0xab91('0x4a')]['id'];}return db[_0xab91('0x2c')][_0xab91('0x4b')]({'where':{'id':_0xc732a3[_0xab91('0x46')]['id']}})[_0xab91('0x26')](handleEntityNotFound(_0x529d1b,null))[_0xab91('0x26')](saveUpdates(_0xc732a3['body'],null))[_0xab91('0x26')](respondWithResult(_0x529d1b,null))[_0xab91('0x44')](handleError(_0x529d1b,null));};exports[_0xab91('0x4c')]=function(_0x4b96cb,_0x1756d7){return db[_0xab91('0x2c')]['find']({'where':{'id':_0x4b96cb[_0xab91('0x46')]['id']}})[_0xab91('0x26')](handleEntityNotFound(_0x1756d7,null))[_0xab91('0x26')](removeEntity(_0x1756d7,null))[_0xab91('0x44')](handleError(_0x1756d7,null));}; \ No newline at end of file +var _0x448e=['Content-Range','apply','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','options','FaxApplication','include','findAll','rows','catch','params','keys','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set'];(function(_0x3d3dac,_0x4ac212){var _0x3d2a5d=function(_0x1bff8a){while(--_0x1bff8a){_0x3d3dac['push'](_0x3d3dac['shift']());}};_0x3d2a5d(++_0x4ac212);}(_0x448e,0x1d1));var _0xe448=function(_0x2dcc9f,_0x25c5ff){_0x2dcc9f=_0x2dcc9f-0x0;var _0x168b82=_0x448e[_0x2dcc9f];return _0x168b82;};'use strict';var emlformat=require(_0xe448('0x0'));var rimraf=require(_0xe448('0x1'));var zipdir=require(_0xe448('0x2'));var jsonpatch=require(_0xe448('0x3'));var rp=require(_0xe448('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe448('0x5'));var util=require(_0xe448('0x6'));var path=require(_0xe448('0x7'));var sox=require(_0xe448('0x8'));var csv=require('to-csv');var ejs=require(_0xe448('0x9'));var fs=require('fs');var fs_extra=require(_0xe448('0xa'));var _=require('lodash');var squel=require(_0xe448('0xb'));var crypto=require(_0xe448('0xc'));var jsforce=require(_0xe448('0xd'));var deskjs=require(_0xe448('0xe'));var toCsv=require(_0xe448('0xf'));var querystring=require(_0xe448('0x10'));var Papa=require(_0xe448('0x11'));var Redis=require(_0xe448('0x12'));var authService=require(_0xe448('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe448('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe448('0x15'));var db=require(_0xe448('0x16'))['db'];function respondWithStatusCode(_0x195774,_0x51fb9f){_0x51fb9f=_0x51fb9f||0xcc;return function(_0x598f95){if(_0x598f95){return _0x195774[_0xe448('0x17')](_0x51fb9f);}return _0x195774[_0xe448('0x18')](_0x51fb9f)[_0xe448('0x19')]();};}function respondWithResult(_0x25eb12,_0x4b0d43){_0x4b0d43=_0x4b0d43||0xc8;return function(_0x396b56){if(_0x396b56){return _0x25eb12['status'](_0x4b0d43)[_0xe448('0x1a')](_0x396b56);}};}function respondWithFilteredResult(_0xcdd64,_0x454478){return function(_0x5b8604){if(_0x5b8604){var _0x1fc272=typeof _0x454478[_0xe448('0x1b')]==='undefined'&&typeof _0x454478['limit']===_0xe448('0x1c');var _0x55faa9=_0x5b8604[_0xe448('0x1d')];var _0x4b2e3b=_0x1fc272?0x0:_0x454478['offset'];var _0x400264=_0x1fc272?_0x5b8604[_0xe448('0x1d')]:_0x454478[_0xe448('0x1b')]+_0x454478[_0xe448('0x1e')];var _0x17150b;if(_0x400264>=_0x55faa9){_0x400264=_0x55faa9;_0x17150b=0xc8;}else{_0x17150b=0xce;}_0xcdd64[_0xe448('0x18')](_0x17150b);return _0xcdd64[_0xe448('0x1f')](_0xe448('0x20'),_0x4b2e3b+'-'+_0x400264+'/'+_0x55faa9)[_0xe448('0x1a')](_0x5b8604);}return null;};}function patchUpdates(_0x50d244){return function(_0x59fb86){try{jsonpatch[_0xe448('0x21')](_0x59fb86,_0x50d244,!![]);}catch(_0x3e548a){return BPromise['reject'](_0x3e548a);}return _0x59fb86[_0xe448('0x22')]();};}function saveUpdates(_0x1a2b4e,_0x53a69c){return function(_0xa80ccc){if(_0xa80ccc){return _0xa80ccc['update'](_0x1a2b4e)[_0xe448('0x23')](function(_0x2d9efc){return _0x2d9efc;});}return null;};}function removeEntity(_0x2bdfe1,_0x52dac8){return function(_0x2857f2){if(_0x2857f2){return _0x2857f2[_0xe448('0x24')]()[_0xe448('0x23')](function(){_0x2bdfe1[_0xe448('0x18')](0xcc)[_0xe448('0x19')]();});}};}function handleEntityNotFound(_0x103831,_0x276887){return function(_0x289ad9){if(!_0x289ad9){_0x103831[_0xe448('0x17')](0x194);}return _0x289ad9;};}function handleError(_0x327124,_0x12cfd6){_0x12cfd6=_0x12cfd6||0x1f4;return function(_0x1566cd){logger[_0xe448('0x25')](_0x1566cd[_0xe448('0x26')]);if(_0x1566cd[_0xe448('0x27')]){delete _0x1566cd[_0xe448('0x27')];}_0x327124[_0xe448('0x18')](_0x12cfd6)[_0xe448('0x28')](_0x1566cd);};}exports['index']=function(_0x2a934b,_0x4b9922){var _0x46510f={},_0x1cf44d={},_0xe01858={'count':0x0,'rows':[]};var _0x4f58f6=_[_0xe448('0x29')](db['FaxApplication'][_0xe448('0x2a')],function(_0x34f9a4){return{'name':_0x34f9a4[_0xe448('0x2b')],'type':_0x34f9a4[_0xe448('0x2c')][_0xe448('0x2d')]};});_0x1cf44d[_0xe448('0x2e')]=_[_0xe448('0x29')](_0x4f58f6,_0xe448('0x27'));_0x1cf44d[_0xe448('0x2f')]=_['keys'](_0x2a934b[_0xe448('0x2f')]);_0x1cf44d[_0xe448('0x30')]=_[_0xe448('0x31')](_0x1cf44d[_0xe448('0x2e')],_0x1cf44d[_0xe448('0x2f')]);_0x46510f[_0xe448('0x32')]=_['intersection'](_0x1cf44d[_0xe448('0x2e')],qs[_0xe448('0x33')](_0x2a934b[_0xe448('0x2f')]['fields']));_0x46510f[_0xe448('0x32')]=_0x46510f[_0xe448('0x32')][_0xe448('0x34')]?_0x46510f[_0xe448('0x32')]:_0x1cf44d[_0xe448('0x2e')];if(!_0x2a934b[_0xe448('0x2f')][_0xe448('0x35')]('nolimit')){_0x46510f[_0xe448('0x1e')]=qs[_0xe448('0x1e')](_0x2a934b[_0xe448('0x2f')][_0xe448('0x1e')]);_0x46510f[_0xe448('0x1b')]=qs['offset'](_0x2a934b[_0xe448('0x2f')][_0xe448('0x1b')]);}_0x46510f[_0xe448('0x36')]=qs[_0xe448('0x37')](_0x2a934b[_0xe448('0x2f')][_0xe448('0x37')]);_0x46510f['where']=qs[_0xe448('0x30')](_['pick'](_0x2a934b['query'],_0x1cf44d[_0xe448('0x30')]),_0x4f58f6);if(_0x2a934b[_0xe448('0x2f')][_0xe448('0x38')]){_0x46510f[_0xe448('0x39')]=_['merge'](_0x46510f[_0xe448('0x39')],{'$or':_[_0xe448('0x29')](_0x4f58f6,function(_0xc9d332){if(_0xc9d332[_0xe448('0x2c')]!=='VIRTUAL'){var _0x1f503f={};_0x1f503f[_0xc9d332[_0xe448('0x27')]]={'$like':'%'+_0x2a934b[_0xe448('0x2f')][_0xe448('0x38')]+'%'};return _0x1f503f;}})});}_0x46510f=_[_0xe448('0x3a')]({},_0x46510f,_0x2a934b[_0xe448('0x3b')]);var _0x47f753={'where':_0x46510f['where']};return db[_0xe448('0x3c')][_0xe448('0x1d')](_0x47f753)[_0xe448('0x23')](function(_0x51282d){_0xe01858[_0xe448('0x1d')]=_0x51282d;if(_0x2a934b[_0xe448('0x2f')]['includeAll']){_0x46510f[_0xe448('0x3d')]=[{'all':!![]}];}return db[_0xe448('0x3c')][_0xe448('0x3e')](_0x46510f);})[_0xe448('0x23')](function(_0x3dcb9f){_0xe01858[_0xe448('0x3f')]=_0x3dcb9f;return _0xe01858;})[_0xe448('0x23')](respondWithFilteredResult(_0x4b9922,_0x46510f))[_0xe448('0x40')](handleError(_0x4b9922,null));};exports['show']=function(_0x470d48,_0x565509){var _0xa48b1c={'raw':!![],'where':{'id':_0x470d48[_0xe448('0x41')]['id']}},_0x4ee39b={};_0x4ee39b[_0xe448('0x2e')]=_[_0xe448('0x42')](db[_0xe448('0x3c')][_0xe448('0x2a')]);_0x4ee39b['query']=_[_0xe448('0x42')](_0x470d48[_0xe448('0x2f')]);_0x4ee39b[_0xe448('0x30')]=_['intersection'](_0x4ee39b[_0xe448('0x2e')],_0x4ee39b[_0xe448('0x2f')]);_0xa48b1c[_0xe448('0x32')]=_[_0xe448('0x31')](_0x4ee39b[_0xe448('0x2e')],qs[_0xe448('0x33')](_0x470d48[_0xe448('0x2f')][_0xe448('0x33')]));_0xa48b1c['attributes']=_0xa48b1c[_0xe448('0x32')][_0xe448('0x34')]?_0xa48b1c['attributes']:_0x4ee39b[_0xe448('0x2e')];if(_0x470d48['query'][_0xe448('0x43')]){_0xa48b1c[_0xe448('0x3d')]=[{'all':!![]}];}_0xa48b1c=_[_0xe448('0x3a')]({},_0xa48b1c,_0x470d48[_0xe448('0x3b')]);return db[_0xe448('0x3c')][_0xe448('0x44')](_0xa48b1c)['then'](handleEntityNotFound(_0x565509,null))[_0xe448('0x23')](respondWithResult(_0x565509,null))['catch'](handleError(_0x565509,null));};exports[_0xe448('0x45')]=function(_0x2db8a9,_0x32249a){return db[_0xe448('0x3c')][_0xe448('0x45')](_0x2db8a9[_0xe448('0x46')],{})[_0xe448('0x23')](respondWithResult(_0x32249a,0xc9))[_0xe448('0x40')](handleError(_0x32249a,null));};exports['update']=function(_0x8b9b5f,_0x941d5b){if(_0x8b9b5f['body']['id']){delete _0x8b9b5f['body']['id'];}return db[_0xe448('0x3c')]['find']({'where':{'id':_0x8b9b5f[_0xe448('0x41')]['id']}})[_0xe448('0x23')](handleEntityNotFound(_0x941d5b,null))[_0xe448('0x23')](saveUpdates(_0x8b9b5f[_0xe448('0x46')],null))[_0xe448('0x23')](respondWithResult(_0x941d5b,null))[_0xe448('0x40')](handleError(_0x941d5b,null));};exports[_0xe448('0x24')]=function(_0x3f960e,_0xd4d45f){return db['FaxApplication']['find']({'where':{'id':_0x3f960e[_0xe448('0x41')]['id']}})[_0xe448('0x23')](handleEntityNotFound(_0xd4d45f,null))[_0xe448('0x23')](removeEntity(_0xd4d45f,null))[_0xe448('0x40')](handleError(_0xd4d45f,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index b57ff6d..e81731c 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 _0xfb6e=['path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4_unicode_ci','util','../../config/logger','api','request-promise'];(function(_0x3416e2,_0x5c9c1b){var _0x52f5fe=function(_0x428adc){while(--_0x428adc){_0x3416e2['push'](_0x3416e2['shift']());}};_0x52f5fe(++_0x5c9c1b);}(_0xfb6e,0x74));var _0xefb6=function(_0x425114,_0x1449ec){_0x425114=_0x425114-0x0;var _0x2d9ead=_0xfb6e[_0x425114];return _0x2d9ead;};'use strict';var _=require('lodash');var util=require(_0xefb6('0x0'));var logger=require(_0xefb6('0x1'))(_0xefb6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xefb6('0x3'));var fs=require('fs');var path=require(_0xefb6('0x4'));var rimraf=require(_0xefb6('0x5'));var config=require(_0xefb6('0x6'));var attributes=require(_0xefb6('0x7'));module[_0xefb6('0x8')]=function(_0x242edc,_0x22b42b){return _0x242edc[_0xefb6('0x9')]('FaxApplication',attributes,{'tableName':_0xefb6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xefb6('0xb')});}; \ No newline at end of file +var _0xad6f=['request-promise','path','./faxApplication.attributes','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xad6f,0x1e7));var _0xfad6=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xad6f[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xfad6('0x0'));var util=require(_0xfad6('0x1'));var logger=require(_0xfad6('0x2'))(_0xfad6('0x3'));var moment=require('moment');var BPromise=require(_0xfad6('0x4'));var rp=require(_0xfad6('0x5'));var fs=require('fs');var path=require(_0xfad6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfad6('0x7'));module['exports']=function(_0x2f7d0b,_0x4ec134){return _0x2f7d0b['define'](_0xfad6('0x8'),attributes,{'tableName':_0xfad6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfad6('0xa'),'collate':_0xfad6('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 60d3513..a2982fb 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 _0xe9a2=['client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x5d96ff,_0x431da5){var _0x4f93ca=function(_0x355a50){while(--_0x355a50){_0x5d96ff['push'](_0x5d96ff['shift']());}};_0x4f93ca(++_0x431da5);}(_0xe9a2,0x71));var _0x2e9a=function(_0x3a1bf1,_0x3c2ac8){_0x3a1bf1=_0x3a1bf1-0x0;var _0x31d72e=_0xe9a2[_0x3a1bf1];return _0x31d72e;};'use strict';var _=require(_0x2e9a('0x0'));var util=require(_0x2e9a('0x1'));var moment=require(_0x2e9a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e9a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e9a('0x4'));var logger=require('../../config/logger')(_0x2e9a('0x5'));var config=require(_0x2e9a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2e9a('0x7')][_0x2e9a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4bdf65,_0x39aa91,_0x2a9275){return new BPromise(function(_0x2e7c1f,_0x2f1fa3){return client[_0x2e9a('0x9')](_0x4bdf65,_0x2a9275)[_0x2e9a('0xa')](function(_0x4b6906){logger[_0x2e9a('0xb')](_0x2e9a('0xc'),_0x39aa91,_0x2e9a('0xd'));logger[_0x2e9a('0xe')](_0x2e9a('0xf'),_0x39aa91,'request\x20sent',JSON[_0x2e9a('0x10')](_0x4b6906));if(_0x4b6906['error']){if(_0x4b6906[_0x2e9a('0x11')]['code']===0x1f4){logger[_0x2e9a('0x11')](_0x2e9a('0xc'),_0x39aa91,_0x4b6906[_0x2e9a('0x11')]['message']);return _0x2f1fa3(_0x4b6906['error'][_0x2e9a('0x12')]);}logger[_0x2e9a('0x11')](_0x2e9a('0xc'),_0x39aa91,_0x4b6906[_0x2e9a('0x11')]['message']);return _0x2e7c1f(_0x4b6906[_0x2e9a('0x11')][_0x2e9a('0x12')]);}else{logger['info'](_0x2e9a('0xc'),_0x39aa91,_0x2e9a('0xd'));_0x2e7c1f(_0x4b6906[_0x2e9a('0x13')][_0x2e9a('0x12')]);}})[_0x2e9a('0x14')](function(_0x35fe81){logger[_0x2e9a('0x11')]('FaxApplication,\x20%s,\x20%s',_0x39aa91,_0x35fe81);_0x2f1fa3(_0x35fe81);});});}exports[_0x2e9a('0x15')]=function(_0x4822f6){var _0x2e7d01=this;return new Promise(function(_0x13e52b,_0x30728c){return db[_0x2e9a('0x16')][_0x2e9a('0x17')](_0x4822f6[_0x2e9a('0x18')],{'raw':_0x4822f6[_0x2e9a('0x19')]?_0x4822f6[_0x2e9a('0x19')][_0x2e9a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4822f6[_0x2e9a('0x19')]?_0x4822f6[_0x2e9a('0x19')][_0x2e9a('0x1b')]||null:null,'attributes':_0x4822f6['options']?_0x4822f6[_0x2e9a('0x19')][_0x2e9a('0x1c')]||null:null,'limit':_0x4822f6[_0x2e9a('0x19')]?_0x4822f6['options'][_0x2e9a('0x1d')]||null:null})['then'](function(_0x51ebc4){logger[_0x2e9a('0xb')](_0x2e9a('0x15'),_0x4822f6);logger['debug'](_0x2e9a('0x15'),_0x4822f6,JSON[_0x2e9a('0x10')](_0x51ebc4));_0x13e52b(_0x51ebc4);})[_0x2e9a('0x14')](function(_0x28a3a6){logger[_0x2e9a('0x11')](_0x2e9a('0x15'),_0x28a3a6[_0x2e9a('0x12')],_0x4822f6);_0x30728c(_0x2e7d01[_0x2e9a('0x11')](0x1f4,_0x28a3a6['message']));});});}; \ No newline at end of file +var _0x8d48=['where','attributes','limit','stringify','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','debug','request\x20sent','error','message','result','UpdateFaxApplication','FaxApplication','body','options','raw'];(function(_0x12f1fc,_0x49ff81){var _0x9e308e=function(_0x586584){while(--_0x586584){_0x12f1fc['push'](_0x12f1fc['shift']());}};_0x9e308e(++_0x49ff81);}(_0x8d48,0x18b));var _0x88d4=function(_0x7cb10c,_0x2fcc3a){_0x7cb10c=_0x7cb10c-0x0;var _0x11df59=_0x8d48[_0x7cb10c];return _0x11df59;};'use strict';var _=require('lodash');var util=require(_0x88d4('0x0'));var moment=require('moment');var BPromise=require(_0x88d4('0x1'));var rs=require(_0x88d4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x88d4('0x3'))['db'];var utils=require(_0x88d4('0x4'));var logger=require(_0x88d4('0x5'))(_0x88d4('0x6'));var config=require(_0x88d4('0x7'));var jayson=require(_0x88d4('0x8'));var client=jayson[_0x88d4('0x9')][_0x88d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b653e,_0x1b24ac,_0x17e8df){return new BPromise(function(_0x1f7185,_0x4a680b){return client[_0x88d4('0xb')](_0x4b653e,_0x17e8df)[_0x88d4('0xc')](function(_0x51f600){logger[_0x88d4('0xd')](_0x88d4('0xe'),_0x1b24ac,'request\x20sent');logger[_0x88d4('0xf')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x1b24ac,_0x88d4('0x10'),JSON['stringify'](_0x51f600));if(_0x51f600[_0x88d4('0x11')]){if(_0x51f600[_0x88d4('0x11')]['code']===0x1f4){logger[_0x88d4('0x11')](_0x88d4('0xe'),_0x1b24ac,_0x51f600[_0x88d4('0x11')][_0x88d4('0x12')]);return _0x4a680b(_0x51f600['error'][_0x88d4('0x12')]);}logger['error'](_0x88d4('0xe'),_0x1b24ac,_0x51f600[_0x88d4('0x11')][_0x88d4('0x12')]);return _0x1f7185(_0x51f600[_0x88d4('0x11')]['message']);}else{logger[_0x88d4('0xd')]('FaxApplication,\x20%s,\x20%s',_0x1b24ac,_0x88d4('0x10'));_0x1f7185(_0x51f600[_0x88d4('0x13')][_0x88d4('0x12')]);}})['catch'](function(_0x4d06c7){logger[_0x88d4('0x11')]('FaxApplication,\x20%s,\x20%s',_0x1b24ac,_0x4d06c7);_0x4a680b(_0x4d06c7);});});}exports[_0x88d4('0x14')]=function(_0x2cfcff){var _0x5a59bd=this;return new Promise(function(_0x28180e,_0x41d386){return db[_0x88d4('0x15')]['update'](_0x2cfcff[_0x88d4('0x16')],{'raw':_0x2cfcff[_0x88d4('0x17')]?_0x2cfcff[_0x88d4('0x17')][_0x88d4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cfcff[_0x88d4('0x17')]?_0x2cfcff[_0x88d4('0x17')][_0x88d4('0x19')]||null:null,'attributes':_0x2cfcff[_0x88d4('0x17')]?_0x2cfcff[_0x88d4('0x17')][_0x88d4('0x1a')]||null:null,'limit':_0x2cfcff['options']?_0x2cfcff['options'][_0x88d4('0x1b')]||null:null})[_0x88d4('0xc')](function(_0x4aae51){logger[_0x88d4('0xd')](_0x88d4('0x14'),_0x2cfcff);logger[_0x88d4('0xf')](_0x88d4('0x14'),_0x2cfcff,JSON[_0x88d4('0x1c')](_0x4aae51));_0x28180e(_0x4aae51);})[_0x88d4('0x1d')](function(_0x1314ff){logger[_0x88d4('0x11')](_0x88d4('0x14'),_0x1314ff[_0x88d4('0x12')],_0x2cfcff);_0x41d386(_0x5a59bd[_0x88d4('0x11')](0x1f4,_0x1314ff[_0x88d4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index d18a999..4beb857 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 _0xed3c=['index','show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./faxApplication.controller','get','isAuthenticated'];(function(_0x169dd4,_0x40c532){var _0x58359f=function(_0x2850f1){while(--_0x2850f1){_0x169dd4['push'](_0x169dd4['shift']());}};_0x58359f(++_0x40c532);}(_0xed3c,0x1a6));var _0xced3=function(_0x2f0f90,_0x411945){_0x2f0f90=_0x2f0f90-0x0;var _0x3da03a=_0xed3c[_0x2f0f90];return _0x3da03a;};'use strict';var multer=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var path=require(_0xced3('0x2'));var timeout=require(_0xced3('0x3'));var express=require('express');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('../../config/environment');var controller=require(_0xced3('0x7'));router[_0xced3('0x8')]('/',auth[_0xced3('0x9')](),controller[_0xced3('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xced3('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xced3('0xc')](_0xced3('0xd'),auth[_0xced3('0x9')](),controller[_0xced3('0xe')]);router[_0xced3('0xf')]('/:id',auth[_0xced3('0x9')](),controller[_0xced3('0x10')]);module[_0xced3('0x11')]=router; \ No newline at end of file +var _0x13f6=['delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','post','create','put','update'];(function(_0x24068a,_0x2a02c9){var _0x6180fb=function(_0x198509){while(--_0x198509){_0x24068a['push'](_0x24068a['shift']());}};_0x6180fb(++_0x2a02c9);}(_0x13f6,0x124));var _0x613f=function(_0xcd8fab,_0x1d0f1c){_0xcd8fab=_0xcd8fab-0x0;var _0x32cffa=_0x13f6[_0xcd8fab];return _0x32cffa;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var fs_extra=require(_0x613f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var controller=require(_0x613f('0x7'));router['get']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x613f('0xa')]('/',auth[_0x613f('0x8')](),controller[_0x613f('0xb')]);router[_0x613f('0xc')]('/:id',auth[_0x613f('0x8')](),controller[_0x613f('0xd')]);router[_0x613f('0xe')]('/:id',auth[_0x613f('0x8')](),controller[_0x613f('0xf')]);module[_0x613f('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 2b8d1ed..410e021 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 _0xe2fe=['DATE','STRING','out','INTEGER','sequelize'];(function(_0x466e9b,_0x19a655){var _0x39a57b=function(_0x1b6b81){while(--_0x1b6b81){_0x466e9b['push'](_0x466e9b['shift']());}};_0x39a57b(++_0x19a655);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xee2f('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xee2f('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xee2f('0x2')]},'thirdDisposition':{'type':Sequelize[_0xee2f('0x2')]},'note':{'type':Sequelize[_0xee2f('0x2')]},'read1stAt':{'type':Sequelize[_0xee2f('0x1')]},'fax':{'type':Sequelize[_0xee2f('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xee2f('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xee2f('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xee2f('0x3')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xee2f('0x4')]}}; \ No newline at end of file +var _0x2ef3=['out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x4e6cbb,_0x3450f0){var _0x15ced4=function(_0x248dd2){while(--_0x248dd2){_0x4e6cbb['push'](_0x4e6cbb['shift']());}};_0x15ced4(++_0x3450f0);}(_0x2ef3,0xba));var _0x32ef=function(_0x35da5f,_0x11aac9){_0x35da5f=_0x35da5f-0x0;var _0x96e12d=_0x2ef3[_0x35da5f];return _0x96e12d;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'closed':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x32ef('0x3')]},'disposition':{'type':Sequelize[_0x32ef('0x4')]},'secondDisposition':{'type':Sequelize[_0x32ef('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x32ef('0x4')]},'read1stAt':{'type':Sequelize[_0x32ef('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x32ef('0x5')]('in',_0x32ef('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x32ef('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x32ef('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 4b7420b..0a81c36 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 _0x32a6=['ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','status','json','offset','undefined','count','limit','set','update','then','destroy','end','sendStatus','error','stack','name','index','map','FaxInteraction','rawAttributes','fieldName','type','getOptions','fax','catch','model','keys','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','params','FaxMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','setTags','Tag','emit','faxInteractionTags:save','removeTags','download','toString','join','server','files','tmp','root','attachments','push','Attachment','Messages','createdAt','get','basename','createReadStream','pipe','createWriteStream','log','unlinkSync','rimraf','zip-dir','moment','util','path'];(function(_0x592416,_0x1cac8b){var _0x527db5=function(_0x3f65e0){while(--_0x3f65e0){_0x592416['push'](_0x592416['shift']());}};_0x527db5(++_0x1cac8b);}(_0x32a6,0x127));var _0x632a=function(_0x2a183f,_0x479397){_0x2a183f=_0x2a183f-0x0;var _0x27c963=_0x32a6[_0x2a183f];return _0x27c963;};'use strict';var rimraf=require(_0x632a('0x0'));var zipdir=require(_0x632a('0x1'));var moment=require(_0x632a('0x2'));var BPromise=require('bluebird');var util=require(_0x632a('0x3'));var path=require(_0x632a('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x632a('0x5'));var interaction=require(_0x632a('0x6'));var qs=require(_0x632a('0x7'));var logger=require(_0x632a('0x8'))(_0x632a('0x9'));var config=require(_0x632a('0xa'));var db=require(_0x632a('0xb'))['db'];config[_0x632a('0xc')]=_[_0x632a('0xd')](config[_0x632a('0xc')],{'host':_0x632a('0xe'),'port':0x18eb});var socket=require(_0x632a('0xf'))(new Redis(config[_0x632a('0xc')]));require(_0x632a('0x10'))[_0x632a('0x11')](socket);function respondWithStatusCode(_0x27f18d,_0x325c39){_0x325c39=_0x325c39||0xcc;return function(_0x378224){if(_0x378224){return _0x27f18d['sendStatus'](_0x325c39);}return _0x27f18d[_0x632a('0x12')](_0x325c39)['end']();};}function respondWithResult(_0x1621f5,_0x3374cf){_0x3374cf=_0x3374cf||0xc8;return function(_0x31700a){if(_0x31700a){return _0x1621f5[_0x632a('0x12')](_0x3374cf)[_0x632a('0x13')](_0x31700a);}};}function respondWithFilteredResult(_0x5d0203,_0x3531c1){return function(_0x3b1f17){if(_0x3b1f17){var _0x1cbb62=typeof _0x3531c1[_0x632a('0x14')]==='undefined'&&typeof _0x3531c1['limit']===_0x632a('0x15');var _0x43eb48=_0x3b1f17[_0x632a('0x16')];var _0x58542e=_0x1cbb62?0x0:_0x3531c1[_0x632a('0x14')];var _0x55fd5c=_0x1cbb62?_0x3b1f17[_0x632a('0x16')]:_0x3531c1['offset']+_0x3531c1[_0x632a('0x17')];var _0xf8bfa8;if(_0x55fd5c>=_0x43eb48){_0x55fd5c=_0x43eb48;_0xf8bfa8=0xc8;}else{_0xf8bfa8=0xce;}_0x5d0203['status'](_0xf8bfa8);return _0x5d0203[_0x632a('0x18')]('Content-Range',_0x58542e+'-'+_0x55fd5c+'/'+_0x43eb48)[_0x632a('0x13')](_0x3b1f17);}return null;};}function saveUpdates(_0x213366){return function(_0x2a15b6){if(_0x2a15b6){return _0x2a15b6[_0x632a('0x19')](_0x213366)[_0x632a('0x1a')](function(_0x4451a6){return _0x4451a6;});}return null;};}function removeEntity(_0x4c24f0){return function(_0x4af161){if(_0x4af161){return _0x4af161[_0x632a('0x1b')]()[_0x632a('0x1a')](function(){_0x4c24f0[_0x632a('0x12')](0xcc)[_0x632a('0x1c')]();});}};}function handleEntityNotFound(_0x431b6d){return function(_0x1338bd){if(!_0x1338bd){_0x431b6d[_0x632a('0x1d')](0x194);}return _0x1338bd;};}function handleError(_0x4c451a,_0x24492f){_0x24492f=_0x24492f||0x1f4;return function(_0x46a093){logger[_0x632a('0x1e')](_0x46a093[_0x632a('0x1f')]);if(_0x46a093['name']){delete _0x46a093[_0x632a('0x20')];}_0x4c451a[_0x632a('0x12')](_0x24492f)['send'](_0x46a093);};}exports[_0x632a('0x21')]=function(_0x1f3742,_0x46584a){var _0x363f4b={};var _0x447282=_[_0x632a('0x22')](db[_0x632a('0x23')][_0x632a('0x24')],function(_0x305f4b){return{'name':_0x305f4b[_0x632a('0x25')],'type':_0x305f4b[_0x632a('0x26')]['key']};});_0x363f4b=qs[_0x632a('0x27')](_0x447282,_0x1f3742);return interaction['findAll'](_0x632a('0x28'),_0x1f3742['query'],_0x1f3742['user'],_0x363f4b,_0x447282)[_0x632a('0x1a')](respondWithFilteredResult(_0x46584a,_0x363f4b))[_0x632a('0x29')](handleError(_0x46584a,null));};exports['show']=function(_0x29b58f,_0x1aeabb){var _0x24da9c={'raw':![],'where':{'id':_0x29b58f['params']['id']}},_0x21747b={};_0x21747b[_0x632a('0x2a')]=_[_0x632a('0x2b')](db[_0x632a('0x23')][_0x632a('0x24')]);_0x21747b['query']=_[_0x632a('0x2b')](_0x29b58f[_0x632a('0x2c')]);_0x21747b[_0x632a('0x2d')]=_[_0x632a('0x2e')](_0x21747b[_0x632a('0x2a')],_0x21747b[_0x632a('0x2c')]);_0x24da9c[_0x632a('0x2f')]=_['intersection'](_0x21747b['model'],qs[_0x632a('0x30')](_0x29b58f['query']['fields']));_0x24da9c[_0x632a('0x2f')]=_0x24da9c[_0x632a('0x2f')][_0x632a('0x31')]?_0x24da9c[_0x632a('0x2f')]:_0x21747b[_0x632a('0x2a')];if(_0x29b58f[_0x632a('0x2c')][_0x632a('0x32')]){_0x24da9c[_0x632a('0x33')]=[{'all':!![]}];}_0x24da9c=_[_0x632a('0x34')]({},_0x24da9c,_0x29b58f[_0x632a('0x35')]);return db[_0x632a('0x23')][_0x632a('0x36')](_0x24da9c)[_0x632a('0x1a')](handleEntityNotFound(_0x1aeabb,null))[_0x632a('0x1a')](respondWithResult(_0x1aeabb,null))[_0x632a('0x29')](handleError(_0x1aeabb,null));};exports[_0x632a('0x37')]=function(_0x150efe,_0x1a2ce4){return db[_0x632a('0x23')][_0x632a('0x37')](_0x150efe[_0x632a('0x38')],{})[_0x632a('0x1a')](respondWithResult(_0x1a2ce4,0xc9))[_0x632a('0x29')](handleError(_0x1a2ce4,null));};exports[_0x632a('0x19')]=function(_0x4e90e1,_0xe3ac22){if(_0x4e90e1[_0x632a('0x38')]['id']){delete _0x4e90e1['body']['id'];}return db[_0x632a('0x23')][_0x632a('0x36')]({'where':{'id':_0x4e90e1[_0x632a('0x39')]['id']}})['then'](handleEntityNotFound(_0xe3ac22,null))['then'](saveUpdates(_0x4e90e1[_0x632a('0x38')],null))[_0x632a('0x1a')](respondWithResult(_0xe3ac22,null))[_0x632a('0x29')](handleError(_0xe3ac22,null));};exports['destroy']=function(_0x3fe1b8,_0x21ae2c){return db[_0x632a('0x23')][_0x632a('0x36')]({'where':{'id':_0x3fe1b8[_0x632a('0x39')]['id']}})[_0x632a('0x1a')](handleEntityNotFound(_0x21ae2c,null))[_0x632a('0x1a')](removeEntity(_0x21ae2c,null))[_0x632a('0x29')](handleError(_0x21ae2c,null));};exports['describe']=function(_0x3b1ddb,_0x51fa0c){return db[_0x632a('0x23')]['describe']()[_0x632a('0x1a')](respondWithResult(_0x51fa0c,null))['catch'](handleError(_0x51fa0c,null));};exports['addMessage']=function(_0x55e2a7,_0x110756){return db[_0x632a('0x3a')][_0x632a('0x36')]({'where':{'id':_0x55e2a7['params']['id']}})[_0x632a('0x1a')](handleEntityNotFound(_0x110756,null))[_0x632a('0x1a')](function(_0x355b40){if(_0x355b40){return _0x355b40[_0x632a('0x3b')](_0x55e2a7['body'][_0x632a('0x3c')],_[_0x632a('0x3d')](_0x55e2a7[_0x632a('0x38')],[_0x632a('0x3c'),'id'])||{});}})[_0x632a('0x1a')](respondWithResult(_0x110756,null))[_0x632a('0x29')](handleError(_0x110756,null));};exports[_0x632a('0x3e')]=function(_0x3969ea,_0x1aeea5){var _0x5d3b66={'raw':![],'where':{}};var _0x464ed6={};var _0x3a56b1={'count':0x0,'rows':[]};return db[_0x632a('0x23')][_0x632a('0x3f')]({'where':{'id':_0x3969ea[_0x632a('0x39')]['id']}})[_0x632a('0x1a')](handleEntityNotFound(_0x1aeea5,null))['then'](function(_0x2ff202){if(_0x2ff202){_0x464ed6[_0x632a('0x2a')]=_[_0x632a('0x2b')](db[_0x632a('0x3a')][_0x632a('0x24')]);_0x464ed6[_0x632a('0x2c')]=_[_0x632a('0x2b')](_0x3969ea[_0x632a('0x2c')]);_0x464ed6[_0x632a('0x2d')]=_['intersection'](_0x464ed6['model'],_0x464ed6[_0x632a('0x2c')]);_0x5d3b66[_0x632a('0x2f')]=_[_0x632a('0x2e')](_0x464ed6[_0x632a('0x2a')],qs[_0x632a('0x30')](_0x3969ea['query']['fields']));_0x5d3b66[_0x632a('0x2f')]=_0x5d3b66[_0x632a('0x2f')][_0x632a('0x31')]?_0x5d3b66['attributes']:_0x464ed6[_0x632a('0x2a')];if(!_0x3969ea['query'][_0x632a('0x40')](_0x632a('0x41'))){_0x5d3b66[_0x632a('0x17')]=qs['limit'](_0x3969ea['query'][_0x632a('0x17')]);_0x5d3b66[_0x632a('0x14')]=qs['offset'](_0x3969ea['query'][_0x632a('0x14')]);}_0x5d3b66['order']=qs[_0x632a('0x42')](_0x3969ea['query']['sort']);_0x5d3b66[_0x632a('0x43')]=qs['filters'](_[_0x632a('0x44')](_0x3969ea['query'],_0x464ed6[_0x632a('0x2d')]));_0x5d3b66[_0x632a('0x43')]['FaxInteractionId']=_0x2ff202['id'];if(_0x3969ea[_0x632a('0x2c')][_0x632a('0x45')]){_0x5d3b66[_0x632a('0x43')]=_[_0x632a('0x34')](_0x5d3b66[_0x632a('0x43')],{'$or':_[_0x632a('0x22')](_0x5d3b66[_0x632a('0x2f')],function(_0x46e312){var _0x132b32={};_0x132b32[_0x46e312]={'$like':'%'+_0x3969ea['query'][_0x632a('0x45')]+'%'};return _0x132b32;})});}if(_0x3969ea['query'][_0x632a('0x46')]){var _0x2c7e6e=_0x3969ea['query'][_0x632a('0x46')][_0x632a('0x47')](',');var _0x2db640={};_0x2db640[_0x2c7e6e[0x0]]={'$gte':moment(_0x2c7e6e[0x1])[_0x632a('0x48')](_0x632a('0x49'))};_0x5d3b66[_0x632a('0x43')]=_['merge'](_0x5d3b66[_0x632a('0x43')],_0x2db640);}_0x5d3b66=_[_0x632a('0x34')]({},_0x5d3b66,_0x3969ea[_0x632a('0x35')]);return db['FaxMessage']['count']({'where':_0x5d3b66[_0x632a('0x43')]})['then'](function(_0x28c068){_0x3a56b1[_0x632a('0x16')]=_0x28c068;if(_0x3969ea[_0x632a('0x2c')][_0x632a('0x32')]){_0x5d3b66[_0x632a('0x33')]=[{'all':!![]}];}return db['FaxMessage'][_0x632a('0x4a')](_0x5d3b66);})[_0x632a('0x1a')](function(_0xb6795e){_0x3a56b1[_0x632a('0x4b')]=_0xb6795e;return _0x3a56b1;});}})[_0x632a('0x1a')](respondWithFilteredResult(_0x1aeea5,_0x5d3b66))[_0x632a('0x29')](handleError(_0x1aeea5,null));};exports['addTags']=function(_0x1592cd,_0x4ccdb9){return db[_0x632a('0x23')][_0x632a('0x36')]({'where':{'id':_0x1592cd[_0x632a('0x39')]['id']}})[_0x632a('0x1a')](handleEntityNotFound(_0x4ccdb9,null))['then'](function(_0x4c9910){if(_0x4c9910){return _0x4c9910[_0x632a('0x4c')](_0x1592cd[_0x632a('0x38')]['ids'],_['omit'](_0x1592cd[_0x632a('0x38')],['ids','id'])||{})['spread'](function(){return db[_0x632a('0x4d')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x1592cd[_0x632a('0x38')][_0x632a('0x3c')]}});})[_0x632a('0x1a')](function(_0x5e4d7b){socket[_0x632a('0x4e')](_0x632a('0x4f'),{'id':Number(_0x1592cd[_0x632a('0x39')]['id']),'tags':_0x5e4d7b||[]});return{'id':Number(_0x1592cd[_0x632a('0x39')]['id']),'tags':_0x5e4d7b||[]};});}})[_0x632a('0x1a')](respondWithResult(_0x4ccdb9,null))[_0x632a('0x29')](handleError(_0x4ccdb9,null));};exports[_0x632a('0x50')]=function(_0x3f2e50,_0x4eaded){return db[_0x632a('0x23')][_0x632a('0x36')]({'where':{'id':_0x3f2e50[_0x632a('0x39')]['id']}})[_0x632a('0x1a')](handleEntityNotFound(_0x4eaded,null))[_0x632a('0x1a')](function(_0x19b1d2){if(_0x19b1d2){return _0x19b1d2[_0x632a('0x50')](_0x3f2e50[_0x632a('0x2c')]['ids']);}})[_0x632a('0x1a')](respondWithStatusCode(_0x4eaded,null))[_0x632a('0x29')](handleError(_0x4eaded,null));};exports[_0x632a('0x51')]=function(_0x4c1c76,_0x502573){var _0x264aa7=moment()['unix']()[_0x632a('0x52')]();var _0x1ad027=path[_0x632a('0x53')](config['root'],_0x632a('0x54'),_0x632a('0x55'),_0x632a('0x56'));var _0x3fb456=path[_0x632a('0x53')](config[_0x632a('0x57')],_0x632a('0x54'),'files',_0x632a('0x58'));var _0x3e499e=path['join'](_0x1ad027,_0x264aa7);var _0x1e845e=util[_0x632a('0x48')]('transcript-%d-%s.zip',_0x4c1c76['params']['id'],_0x264aa7);var _0x538654=path['join'](_0x1ad027,_0x1e845e);var _0x3d4247=[];_0x3d4247[_0x632a('0x59')]({'model':db['Attachment'],'as':_0x632a('0x5a'),'raw':!![]});var _0x2bc961=[{'model':db[_0x632a('0x3a')],'as':_0x632a('0x5b'),'attributes':['id',_0x632a('0x38'),_0x632a('0x5c')],'include':_0x3d4247}];return db['FaxInteraction'][_0x632a('0x36')]({'where':{'id':_0x4c1c76[_0x632a('0x39')]['id']},'include':_0x2bc961})[_0x632a('0x1a')](handleEntityNotFound(_0x502573,null))['then'](function(_0x5302ef){if(_0x5302ef&&_0x5302ef[_0x632a('0x5b')]){var _0x1e07a5=_0x5302ef[_0x632a('0x5d')]({'plain':!![]});fs['mkdirSync'](_0x3e499e);for(var _0x194c07=0x0;_0x194c07<_0x1e07a5['Messages']['length'];_0x194c07++){var _0x13ecdc=_0x1e07a5['Messages'][_0x194c07][_0x632a('0x5a')];if(_0x13ecdc){var _0xa77253=path[_0x632a('0x53')](_0x3fb456,_0x13ecdc[_0x632a('0x5e')]);if(fs['existsSync'](_0xa77253)){fs[_0x632a('0x5f')](_0xa77253)[_0x632a('0x60')](fs[_0x632a('0x61')](path[_0x632a('0x53')](_0x3e499e,_0x13ecdc[_0x632a('0x5e')])));}}}return BPromise['resolve']()[_0x632a('0x1a')](function(){return new BPromise(function(_0xbfd62f,_0x4e5473){zipdir(_0x3e499e,{'saveTo':_0x538654},function(_0x494419,_0x5eaad4){if(_0x494419)return _0x4e5473(_0x494419);return _0xbfd62f(_0x5eaad4);});})[_0x632a('0x1a')](function(){return new BPromise(function(_0x41c645,_0x3e6922){rimraf(_0x3e499e,function(_0x1165fe){if(_0x1165fe)_0x3e6922(_0x1165fe);return _0x41c645();});});})[_0x632a('0x1a')](function(){return _0x502573[_0x632a('0x51')](_0x538654,_0x1e845e,function(_0x419a57){if(_0x419a57){console[_0x632a('0x62')]('err',_0x419a57);}else{fs[_0x632a('0x63')](_0x538654);}});});});}else{return _0x502573[_0x632a('0x1d')](0xc8);}})[_0x632a('0x29')](handleError(_0x502573,null));}; \ No newline at end of file +var _0xed59=['index','map','rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','user','catch','show','keys','FaxInteraction','filters','intersection','model','attributes','fields','length','include','merge','find','body','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','limit','order','pick','FaxInteractionId','where','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','rows','setTags','spread','color','emit','removeTags','download','join','root','server','attachments','push','Messages','createdAt','get','Attachment','basename','existsSync','createReadStream','pipe','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','lodash','../../components/parsers/qs','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','undefined','count','offset','update','then','destroy','end','error','stack','name','send'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xed59,0x1c3));var _0x9ed5=function(_0x4b04e9,_0x32f24f){_0x4b04e9=_0x4b04e9-0x0;var _0x431532=_0xed59[_0x4b04e9];return _0x431532;};'use strict';var rimraf=require(_0x9ed5('0x0'));var zipdir=require(_0x9ed5('0x1'));var moment=require(_0x9ed5('0x2'));var BPromise=require(_0x9ed5('0x3'));var util=require(_0x9ed5('0x4'));var path=require('path');var fs=require('fs');var _=require(_0x9ed5('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x9ed5('0x6'));var logger=require('../../config/logger')(_0x9ed5('0x7'));var config=require('../../config/environment');var db=require(_0x9ed5('0x8'))['db'];config['redis']=_[_0x9ed5('0x9')](config[_0x9ed5('0xa')],{'host':_0x9ed5('0xb'),'port':0x18eb});var socket=require(_0x9ed5('0xc'))(new Redis(config[_0x9ed5('0xa')]));require(_0x9ed5('0xd'))[_0x9ed5('0xe')](socket);function respondWithStatusCode(_0x3d1de9,_0x334c32){_0x334c32=_0x334c32||0xcc;return function(_0x4ed5f5){if(_0x4ed5f5){return _0x3d1de9[_0x9ed5('0xf')](_0x334c32);}return _0x3d1de9[_0x9ed5('0x10')](_0x334c32)['end']();};}function respondWithResult(_0x357b8e,_0x4680aa){_0x4680aa=_0x4680aa||0xc8;return function(_0x40b2f8){if(_0x40b2f8){return _0x357b8e['status'](_0x4680aa)[_0x9ed5('0x11')](_0x40b2f8);}};}function respondWithFilteredResult(_0x5a7b45,_0x3ec065){return function(_0xac9548){if(_0xac9548){var _0x1263f8=typeof _0x3ec065['offset']===_0x9ed5('0x12')&&typeof _0x3ec065['limit']==='undefined';var _0x4c4d9b=_0xac9548[_0x9ed5('0x13')];var _0x57f96a=_0x1263f8?0x0:_0x3ec065[_0x9ed5('0x14')];var _0x2ab694=_0x1263f8?_0xac9548[_0x9ed5('0x13')]:_0x3ec065[_0x9ed5('0x14')]+_0x3ec065['limit'];var _0x2f216d;if(_0x2ab694>=_0x4c4d9b){_0x2ab694=_0x4c4d9b;_0x2f216d=0xc8;}else{_0x2f216d=0xce;}_0x5a7b45[_0x9ed5('0x10')](_0x2f216d);return _0x5a7b45['set']('Content-Range',_0x57f96a+'-'+_0x2ab694+'/'+_0x4c4d9b)['json'](_0xac9548);}return null;};}function saveUpdates(_0x4527f7){return function(_0x467eaa){if(_0x467eaa){return _0x467eaa[_0x9ed5('0x15')](_0x4527f7)[_0x9ed5('0x16')](function(_0x1911f3){return _0x1911f3;});}return null;};}function removeEntity(_0x58ebfd){return function(_0x14196f){if(_0x14196f){return _0x14196f[_0x9ed5('0x17')]()[_0x9ed5('0x16')](function(){_0x58ebfd[_0x9ed5('0x10')](0xcc)[_0x9ed5('0x18')]();});}};}function handleEntityNotFound(_0x58bee6){return function(_0x5630ae){if(!_0x5630ae){_0x58bee6[_0x9ed5('0xf')](0x194);}return _0x5630ae;};}function handleError(_0x2df47a,_0x482172){_0x482172=_0x482172||0x1f4;return function(_0x429b71){logger[_0x9ed5('0x19')](_0x429b71[_0x9ed5('0x1a')]);if(_0x429b71[_0x9ed5('0x1b')]){delete _0x429b71[_0x9ed5('0x1b')];}_0x2df47a[_0x9ed5('0x10')](_0x482172)[_0x9ed5('0x1c')](_0x429b71);};}exports[_0x9ed5('0x1d')]=function(_0x10ac69,_0x23f6b0){var _0x49ab69={};var _0x365f9d=_[_0x9ed5('0x1e')](db['FaxInteraction'][_0x9ed5('0x1f')],function(_0x3b6365){return{'name':_0x3b6365[_0x9ed5('0x20')],'type':_0x3b6365[_0x9ed5('0x21')][_0x9ed5('0x22')]};});_0x49ab69=qs[_0x9ed5('0x23')](_0x365f9d,_0x10ac69);return interaction[_0x9ed5('0x24')](_0x9ed5('0x25'),_0x10ac69[_0x9ed5('0x26')],_0x10ac69[_0x9ed5('0x27')],_0x49ab69,_0x365f9d)['then'](respondWithFilteredResult(_0x23f6b0,_0x49ab69))[_0x9ed5('0x28')](handleError(_0x23f6b0,null));};exports[_0x9ed5('0x29')]=function(_0x2baae4,_0x54c351){var _0x1bf0f2={'raw':![],'where':{'id':_0x2baae4['params']['id']}},_0x553998={};_0x553998['model']=_[_0x9ed5('0x2a')](db[_0x9ed5('0x2b')][_0x9ed5('0x1f')]);_0x553998['query']=_[_0x9ed5('0x2a')](_0x2baae4['query']);_0x553998[_0x9ed5('0x2c')]=_[_0x9ed5('0x2d')](_0x553998[_0x9ed5('0x2e')],_0x553998['query']);_0x1bf0f2[_0x9ed5('0x2f')]=_['intersection'](_0x553998[_0x9ed5('0x2e')],qs[_0x9ed5('0x30')](_0x2baae4[_0x9ed5('0x26')][_0x9ed5('0x30')]));_0x1bf0f2[_0x9ed5('0x2f')]=_0x1bf0f2[_0x9ed5('0x2f')][_0x9ed5('0x31')]?_0x1bf0f2['attributes']:_0x553998[_0x9ed5('0x2e')];if(_0x2baae4[_0x9ed5('0x26')]['includeAll']){_0x1bf0f2[_0x9ed5('0x32')]=[{'all':!![]}];}_0x1bf0f2=_[_0x9ed5('0x33')]({},_0x1bf0f2,_0x2baae4['options']);return db['FaxInteraction'][_0x9ed5('0x34')](_0x1bf0f2)[_0x9ed5('0x16')](handleEntityNotFound(_0x54c351,null))[_0x9ed5('0x16')](respondWithResult(_0x54c351,null))['catch'](handleError(_0x54c351,null));};exports['create']=function(_0x157947,_0x54fc63){return db['FaxInteraction']['create'](_0x157947[_0x9ed5('0x35')],{})[_0x9ed5('0x16')](respondWithResult(_0x54fc63,0xc9))[_0x9ed5('0x28')](handleError(_0x54fc63,null));};exports[_0x9ed5('0x15')]=function(_0x15733b,_0x2620e9){if(_0x15733b['body']['id']){delete _0x15733b[_0x9ed5('0x35')]['id'];}return db['FaxInteraction'][_0x9ed5('0x34')]({'where':{'id':_0x15733b[_0x9ed5('0x36')]['id']}})[_0x9ed5('0x16')](handleEntityNotFound(_0x2620e9,null))['then'](saveUpdates(_0x15733b[_0x9ed5('0x35')],null))['then'](respondWithResult(_0x2620e9,null))[_0x9ed5('0x28')](handleError(_0x2620e9,null));};exports[_0x9ed5('0x17')]=function(_0x195733,_0x3b158a){return db[_0x9ed5('0x2b')][_0x9ed5('0x34')]({'where':{'id':_0x195733[_0x9ed5('0x36')]['id']}})[_0x9ed5('0x16')](handleEntityNotFound(_0x3b158a,null))[_0x9ed5('0x16')](removeEntity(_0x3b158a,null))[_0x9ed5('0x28')](handleError(_0x3b158a,null));};exports['describe']=function(_0x502c05,_0x4ba892){return db['FaxInteraction'][_0x9ed5('0x37')]()[_0x9ed5('0x16')](respondWithResult(_0x4ba892,null))[_0x9ed5('0x28')](handleError(_0x4ba892,null));};exports[_0x9ed5('0x38')]=function(_0x50ae83,_0x2d232d){return db[_0x9ed5('0x39')][_0x9ed5('0x34')]({'where':{'id':_0x50ae83[_0x9ed5('0x36')]['id']}})[_0x9ed5('0x16')](handleEntityNotFound(_0x2d232d,null))['then'](function(_0x2d25f8){if(_0x2d25f8){return _0x2d25f8[_0x9ed5('0x38')](_0x50ae83[_0x9ed5('0x35')][_0x9ed5('0x3a')],_[_0x9ed5('0x3b')](_0x50ae83[_0x9ed5('0x35')],[_0x9ed5('0x3a'),'id'])||{});}})[_0x9ed5('0x16')](respondWithResult(_0x2d232d,null))[_0x9ed5('0x28')](handleError(_0x2d232d,null));};exports[_0x9ed5('0x3c')]=function(_0x361ea7,_0x5b0ad9){var _0x3b3c0f={'raw':![],'where':{}};var _0x1965e4={};var _0x1372ad={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x9ed5('0x3d')]({'where':{'id':_0x361ea7[_0x9ed5('0x36')]['id']}})[_0x9ed5('0x16')](handleEntityNotFound(_0x5b0ad9,null))[_0x9ed5('0x16')](function(_0x4a8c69){if(_0x4a8c69){_0x1965e4['model']=_['keys'](db[_0x9ed5('0x39')][_0x9ed5('0x1f')]);_0x1965e4[_0x9ed5('0x26')]=_['keys'](_0x361ea7['query']);_0x1965e4[_0x9ed5('0x2c')]=_[_0x9ed5('0x2d')](_0x1965e4[_0x9ed5('0x2e')],_0x1965e4[_0x9ed5('0x26')]);_0x3b3c0f['attributes']=_[_0x9ed5('0x2d')](_0x1965e4[_0x9ed5('0x2e')],qs[_0x9ed5('0x30')](_0x361ea7[_0x9ed5('0x26')][_0x9ed5('0x30')]));_0x3b3c0f[_0x9ed5('0x2f')]=_0x3b3c0f[_0x9ed5('0x2f')][_0x9ed5('0x31')]?_0x3b3c0f[_0x9ed5('0x2f')]:_0x1965e4[_0x9ed5('0x2e')];if(!_0x361ea7[_0x9ed5('0x26')][_0x9ed5('0x3e')]('nolimit')){_0x3b3c0f[_0x9ed5('0x3f')]=qs['limit'](_0x361ea7[_0x9ed5('0x26')][_0x9ed5('0x3f')]);_0x3b3c0f[_0x9ed5('0x14')]=qs['offset'](_0x361ea7[_0x9ed5('0x26')][_0x9ed5('0x14')]);}_0x3b3c0f[_0x9ed5('0x40')]=qs['sort'](_0x361ea7[_0x9ed5('0x26')]['sort']);_0x3b3c0f['where']=qs[_0x9ed5('0x2c')](_[_0x9ed5('0x41')](_0x361ea7[_0x9ed5('0x26')],_0x1965e4[_0x9ed5('0x2c')]));_0x3b3c0f['where'][_0x9ed5('0x42')]=_0x4a8c69['id'];if(_0x361ea7[_0x9ed5('0x26')]['filter']){_0x3b3c0f['where']=_['merge'](_0x3b3c0f[_0x9ed5('0x43')],{'$or':_[_0x9ed5('0x1e')](_0x3b3c0f[_0x9ed5('0x2f')],function(_0x2fa3e9){var _0x12da1f={};_0x12da1f[_0x2fa3e9]={'$like':'%'+_0x361ea7['query']['filter']+'%'};return _0x12da1f;})});}if(_0x361ea7['query'][_0x9ed5('0x44')]){var _0x58d203=_0x361ea7[_0x9ed5('0x26')]['$gte']['split'](',');var _0x136c61={};_0x136c61[_0x58d203[0x0]]={'$gte':moment(_0x58d203[0x1])[_0x9ed5('0x45')](_0x9ed5('0x46'))};_0x3b3c0f[_0x9ed5('0x43')]=_[_0x9ed5('0x33')](_0x3b3c0f[_0x9ed5('0x43')],_0x136c61);}_0x3b3c0f=_['merge']({},_0x3b3c0f,_0x361ea7[_0x9ed5('0x47')]);return db['FaxMessage'][_0x9ed5('0x13')]({'where':_0x3b3c0f[_0x9ed5('0x43')]})[_0x9ed5('0x16')](function(_0x3a5747){_0x1372ad[_0x9ed5('0x13')]=_0x3a5747;if(_0x361ea7['query'][_0x9ed5('0x48')]){_0x3b3c0f[_0x9ed5('0x32')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x3b3c0f);})[_0x9ed5('0x16')](function(_0x3fbbed){_0x1372ad[_0x9ed5('0x49')]=_0x3fbbed;return _0x1372ad;});}})['then'](respondWithFilteredResult(_0x5b0ad9,_0x3b3c0f))['catch'](handleError(_0x5b0ad9,null));};exports['addTags']=function(_0x4f0739,_0x564a09){return db[_0x9ed5('0x2b')][_0x9ed5('0x34')]({'where':{'id':_0x4f0739['params']['id']}})[_0x9ed5('0x16')](handleEntityNotFound(_0x564a09,null))['then'](function(_0x5b86c9){if(_0x5b86c9){return _0x5b86c9[_0x9ed5('0x4a')](_0x4f0739[_0x9ed5('0x35')]['ids'],_[_0x9ed5('0x3b')](_0x4f0739[_0x9ed5('0x35')],[_0x9ed5('0x3a'),'id'])||{})[_0x9ed5('0x4b')](function(){return db['Tag'][_0x9ed5('0x24')]({'attributes':['id',_0x9ed5('0x1b'),_0x9ed5('0x4c')],'where':{'id':_0x4f0739['body'][_0x9ed5('0x3a')]}});})[_0x9ed5('0x16')](function(_0x57de34){socket[_0x9ed5('0x4d')]('faxInteractionTags:save',{'id':Number(_0x4f0739[_0x9ed5('0x36')]['id']),'tags':_0x57de34||[]});return{'id':Number(_0x4f0739[_0x9ed5('0x36')]['id']),'tags':_0x57de34||[]};});}})[_0x9ed5('0x16')](respondWithResult(_0x564a09,null))[_0x9ed5('0x28')](handleError(_0x564a09,null));};exports[_0x9ed5('0x4e')]=function(_0x40eee2,_0x1f2ba2){return db[_0x9ed5('0x2b')][_0x9ed5('0x34')]({'where':{'id':_0x40eee2[_0x9ed5('0x36')]['id']}})[_0x9ed5('0x16')](handleEntityNotFound(_0x1f2ba2,null))[_0x9ed5('0x16')](function(_0x3405fd){if(_0x3405fd){return _0x3405fd[_0x9ed5('0x4e')](_0x40eee2[_0x9ed5('0x26')][_0x9ed5('0x3a')]);}})['then'](respondWithStatusCode(_0x1f2ba2,null))[_0x9ed5('0x28')](handleError(_0x1f2ba2,null));};exports[_0x9ed5('0x4f')]=function(_0x30030b,_0x53b47f){var _0x3523cf=moment()['unix']()['toString']();var _0x43aa2=path[_0x9ed5('0x50')](config[_0x9ed5('0x51')],_0x9ed5('0x52'),'files','tmp');var _0x331373=path['join'](config[_0x9ed5('0x51')],'server','files',_0x9ed5('0x53'));var _0x2ab38d=path[_0x9ed5('0x50')](_0x43aa2,_0x3523cf);var _0x484892=util[_0x9ed5('0x45')]('transcript-%d-%s.zip',_0x30030b['params']['id'],_0x3523cf);var _0x49be4d=path[_0x9ed5('0x50')](_0x43aa2,_0x484892);var _0x2dc5cb=[];_0x2dc5cb[_0x9ed5('0x54')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0xfc9b4a=[{'model':db['FaxMessage'],'as':_0x9ed5('0x55'),'attributes':['id',_0x9ed5('0x35'),_0x9ed5('0x56')],'include':_0x2dc5cb}];return db['FaxInteraction']['find']({'where':{'id':_0x30030b[_0x9ed5('0x36')]['id']},'include':_0xfc9b4a})[_0x9ed5('0x16')](handleEntityNotFound(_0x53b47f,null))[_0x9ed5('0x16')](function(_0x75ff67){if(_0x75ff67&&_0x75ff67['Messages']){var _0xb859ae=_0x75ff67[_0x9ed5('0x57')]({'plain':!![]});fs['mkdirSync'](_0x2ab38d);for(var _0x277576=0x0;_0x277576<_0xb859ae[_0x9ed5('0x55')][_0x9ed5('0x31')];_0x277576++){var _0x222225=_0xb859ae['Messages'][_0x277576][_0x9ed5('0x58')];if(_0x222225){var _0x350451=path[_0x9ed5('0x50')](_0x331373,_0x222225[_0x9ed5('0x59')]);if(fs[_0x9ed5('0x5a')](_0x350451)){fs[_0x9ed5('0x5b')](_0x350451)[_0x9ed5('0x5c')](fs['createWriteStream'](path[_0x9ed5('0x50')](_0x2ab38d,_0x222225[_0x9ed5('0x59')])));}}}return BPromise['resolve']()[_0x9ed5('0x16')](function(){return new BPromise(function(_0x5965c2,_0x352d99){zipdir(_0x2ab38d,{'saveTo':_0x49be4d},function(_0x89c727,_0x3c0145){if(_0x89c727)return _0x352d99(_0x89c727);return _0x5965c2(_0x3c0145);});})[_0x9ed5('0x16')](function(){return new BPromise(function(_0x193b7f,_0x7151aa){rimraf(_0x2ab38d,function(_0x16328e){if(_0x16328e)_0x7151aa(_0x16328e);return _0x193b7f();});});})['then'](function(){return _0x53b47f[_0x9ed5('0x4f')](_0x49be4d,_0x484892,function(_0x270be3){if(_0x270be3){console[_0x9ed5('0x5d')](_0x9ed5('0x5e'),_0x270be3);}else{fs[_0x9ed5('0x5f')](_0x49be4d);}});});});}else{return _0x53b47f[_0x9ed5('0xf')](0xc8);}})[_0x9ed5('0x28')](handleError(_0x53b47f,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 17e30f0..c660d17 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 _0x137b=['update','remove','getUsers','then','setDataValue','Users','length','emit','catch','hasOwnProperty','hook','exports','events','FaxInteraction','../../mysqldb','FaxMessage','save'];(function(_0xe50756,_0x12b6ae){var _0x1541a5=function(_0x49c421){while(--_0x49c421){_0xe50756['push'](_0xe50756['shift']());}};_0x1541a5(++_0x12b6ae);}(_0x137b,0xe9));var _0xb137=function(_0x2638d0,_0x52f653){_0x2638d0=_0x2638d0-0x0;var _0x411a60=_0x137b[_0x2638d0];return _0x411a60;};'use strict';var EventEmitter=require(_0xb137('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0xb137('0x1')];var FaxMessage=require(_0xb137('0x2'))['db'][_0xb137('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb137('0x4'),'afterUpdate':_0xb137('0x5'),'afterDestroy':_0xb137('0x6')};function emitEvent(_0x32bdf4){return function(_0x14c873,_0x42921b,_0x291fb6){_0x14c873[_0xb137('0x7')]({'attributes':['id'],'raw':!![]})[_0xb137('0x8')](function(_0x146274){_0x14c873[_0xb137('0x9')](_0xb137('0xa'),_0x146274['map'](function(_0x2e1ccc){return{'id':_0x2e1ccc['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x14c873['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb137('0x8')](function(_0x582091){_0x14c873['setDataValue']('unreadMessages',_0x582091[_0xb137('0xb')]);FaxInteractionEvents[_0xb137('0xc')](_0x32bdf4+':'+_0x14c873['id'],_0x14c873);FaxInteractionEvents[_0xb137('0xc')](_0x32bdf4,_0x14c873);_0x291fb6(null);})[_0xb137('0xd')](_0x291fb6(null));};}for(var e in events){if(events[_0xb137('0xe')](e)){var event=events[e];FaxInteraction[_0xb137('0xf')](e,emitEvent(event));}}module[_0xb137('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0xa253=['setDataValue','Users','map','length','emit','catch','hook','exports','events','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','getUsers','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa253,0x13a));var _0x3a25=function(_0x10d405,_0x28d136){_0x10d405=_0x10d405-0x0;var _0x12bd98=_0xa253[_0x10d405];return _0x12bd98;};'use strict';var EventEmitter=require(_0x3a25('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x3a25('0x1')];var FaxMessage=require(_0x3a25('0x2'))['db'][_0x3a25('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x3a25('0x4')](0x0);var events={'afterCreate':_0x3a25('0x5'),'afterUpdate':_0x3a25('0x6'),'afterDestroy':_0x3a25('0x7')};function emitEvent(_0x2d695b){return function(_0x355518,_0x2d2e3e,_0x26019c){_0x355518[_0x3a25('0x8')]({'attributes':['id'],'raw':!![]})[_0x3a25('0x9')](function(_0x5561b2){_0x355518[_0x3a25('0xa')](_0x3a25('0xb'),_0x5561b2[_0x3a25('0xc')](function(_0x4f7017){return{'id':_0x4f7017['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x355518['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3a25('0x9')](function(_0x3885bd){_0x355518['setDataValue']('unreadMessages',_0x3885bd[_0x3a25('0xd')]);FaxInteractionEvents[_0x3a25('0xe')](_0x2d695b+':'+_0x355518['id'],_0x355518);FaxInteractionEvents[_0x3a25('0xe')](_0x2d695b,_0x355518);_0x26019c(null);})[_0x3a25('0xf')](_0x26019c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x3a25('0x10')](e,emitEvent(event));}}module[_0x3a25('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index df90a8c..f8594c4 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 _0xb6ec=['../../config/environment','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x4fbbe7,_0x1fdb52){var _0x8331b1=function(_0x3a413f){while(--_0x3a413f){_0x4fbbe7['push'](_0x4fbbe7['shift']());}};_0x8331b1(++_0x1fdb52);}(_0xb6ec,0xca));var _0xcb6e=function(_0xbc9a74,_0x5d258d){_0xbc9a74=_0xbc9a74-0x0;var _0x4a5552=_0xb6ec[_0xbc9a74];return _0x4a5552;};'use strict';var _=require(_0xcb6e('0x0'));var util=require(_0xcb6e('0x1'));var logger=require(_0xcb6e('0x2'))(_0xcb6e('0x3'));var moment=require('moment');var BPromise=require(_0xcb6e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb6e('0x5'));var rimraf=require('rimraf');var config=require(_0xcb6e('0x6'));var attributes=require('./faxInteraction.attributes');module[_0xcb6e('0x7')]=function(_0x507a50,_0x3c7533){return _0x507a50[_0xcb6e('0x8')](_0xcb6e('0x9'),attributes,{'tableName':_0xcb6e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x463f4c,_0x54dfee,_0x2d833b){if(_0x463f4c[_0xcb6e('0xb')](_0xcb6e('0xc'))){_0x463f4c[_0xcb6e('0xd')]=moment()[_0xcb6e('0xe')](_0xcb6e('0xf'));}_0x2d833b(null,_0x463f4c);}}});}; \ No newline at end of file +var _0x718f=['bluebird','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','moment'];(function(_0x441853,_0x525833){var _0x290547=function(_0x34865b){while(--_0x34865b){_0x441853['push'](_0x441853['shift']());}};_0x290547(++_0x525833);}(_0x718f,0x84));var _0xf718=function(_0x152a03,_0x41a4fe){_0x152a03=_0x152a03-0x0;var _0x3ccbd0=_0x718f[_0x152a03];return _0x3ccbd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf718('0x0'))(_0xf718('0x1'));var moment=require(_0xf718('0x2'));var BPromise=require(_0xf718('0x3'));var rp=require(_0xf718('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf718('0x5'));var config=require(_0xf718('0x6'));var attributes=require(_0xf718('0x7'));module[_0xf718('0x8')]=function(_0x31cc52,_0x3d2297){return _0x31cc52[_0xf718('0x9')]('FaxInteraction',attributes,{'tableName':_0xf718('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x293a4d,_0x1b6740,_0x25f229){if(_0x293a4d[_0xf718('0xb')]('closed')){_0x293a4d[_0xf718('0xc')]=moment()[_0xf718('0xd')](_0xf718('0xe'));}_0x25f229(null,_0x293a4d);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 7e49ca7..a172bff 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 _0x58bc=['catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','then','stringify','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0x58bc,0xf9));var _0xc58b=function(_0x1a58dc,_0x566e62){_0x1a58dc=_0x1a58dc-0x0;var _0x2ff7cd=_0x58bc[_0x1a58dc];return _0x2ff7cd;};'use strict';var _=require('lodash');var util=require(_0xc58b('0x0'));var moment=require(_0xc58b('0x1'));var BPromise=require(_0xc58b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc58b('0x3'));var db=require(_0xc58b('0x4'))['db'];var utils=require(_0xc58b('0x5'));var logger=require('../../config/logger')(_0xc58b('0x6'));var config=require(_0xc58b('0x7'));var jayson=require(_0xc58b('0x8'));var client=jayson[_0xc58b('0x9')][_0xc58b('0xa')]({'port':0x232a});config[_0xc58b('0xb')]=_[_0xc58b('0xc')](config[_0xc58b('0xb')],{'host':_0xc58b('0xd'),'port':0x18eb});var socket=require(_0xc58b('0xe'))(new Redis(config[_0xc58b('0xb')]));require(_0xc58b('0xf'))[_0xc58b('0x10')](socket);function respondWithRpcPromise(_0x4b8736,_0x49b751,_0x549175){return new BPromise(function(_0x174bff,_0x14939f){return client[_0xc58b('0x11')](_0x4b8736,_0x549175)['then'](function(_0x368841){logger['info'](_0xc58b('0x12'),_0x49b751,_0xc58b('0x13'));logger[_0xc58b('0x14')](_0xc58b('0x15'),_0x49b751,_0xc58b('0x13'),JSON['stringify'](_0x368841));if(_0x368841[_0xc58b('0x16')]){if(_0x368841[_0xc58b('0x16')][_0xc58b('0x17')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x49b751,_0x368841['error'][_0xc58b('0x18')]);return _0x14939f(_0x368841[_0xc58b('0x16')][_0xc58b('0x18')]);}logger[_0xc58b('0x16')](_0xc58b('0x12'),_0x49b751,_0x368841[_0xc58b('0x16')][_0xc58b('0x18')]);return _0x174bff(_0x368841[_0xc58b('0x16')]['message']);}else{logger[_0xc58b('0x19')](_0xc58b('0x12'),_0x49b751,'request\x20sent');_0x174bff(_0x368841[_0xc58b('0x1a')][_0xc58b('0x18')]);}})[_0xc58b('0x1b')](function(_0x4c82fa){logger[_0xc58b('0x16')](_0xc58b('0x12'),_0x49b751,_0x4c82fa);_0x14939f(_0x4c82fa);});});}exports[_0xc58b('0x1c')]=function(_0x49562e){var _0x5608df=this;return new Promise(function(_0x26d83d,_0x56da04){return db[_0xc58b('0x1d')][_0xc58b('0x1e')](_0x49562e[_0xc58b('0x1f')],{'raw':_0x49562e[_0xc58b('0x20')]?_0x49562e['options'][_0xc58b('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49562e[_0xc58b('0x20')]?_0x49562e['options'][_0xc58b('0x22')]||null:null,'attributes':_0x49562e[_0xc58b('0x20')]?_0x49562e[_0xc58b('0x20')][_0xc58b('0x23')]||null:null,'limit':_0x49562e[_0xc58b('0x20')]?_0x49562e[_0xc58b('0x20')][_0xc58b('0x24')]||null:null})[_0xc58b('0x25')](function(_0x5d6991){logger[_0xc58b('0x19')](_0xc58b('0x1c'),_0x49562e);logger[_0xc58b('0x14')](_0xc58b('0x1c'),_0x49562e,JSON[_0xc58b('0x26')](_0x5d6991));_0x26d83d(_0x5d6991);})[_0xc58b('0x1b')](function(_0x1dee37){logger[_0xc58b('0x16')]('UpdateFaxInteraction',_0x1dee37[_0xc58b('0x18')],_0x49562e);_0x56da04(_0x5608df[_0xc58b('0x16')](0x1f4,_0x1dee37['message']));});});};exports[_0xc58b('0x27')]=function(_0x345096){return new Promise(function(_0x422180,_0x42830){return db[_0xc58b('0x1d')][_0xc58b('0x28')]({'where':_0x345096[_0xc58b('0x20')]?_0x345096[_0xc58b('0x20')][_0xc58b('0x22')]||null:null})[_0xc58b('0x25')](function(_0x3f4c76){if(_0x3f4c76){return _0x3f4c76[_0xc58b('0x29')](_0x345096[_0xc58b('0x1f')][_0xc58b('0x2a')],_[_0xc58b('0x2b')](_0x345096[_0xc58b('0x1f')],[_0xc58b('0x2a'),'id'])||{});}})[_0xc58b('0x2c')](function(_0x45a654){logger[_0xc58b('0x19')](_0xc58b('0x2d'),_0x345096);logger[_0xc58b('0x14')](_0xc58b('0x2d'),_0x345096,JSON[_0xc58b('0x26')](_0x45a654));_0x422180(_0x45a654);})['catch'](function(_0x582062){logger['error']('AddTags',_0x582062[_0xc58b('0x18')],_0x345096);_0x42830(_this['error'](0x1f4,_0x582062['message']));});});}; \ No newline at end of file +var _0xe911=['catch','FaxInteraction','update','body','options','raw','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x293625,_0x56b6df){var _0x44f096=function(_0x104d34){while(--_0x104d34){_0x293625['push'](_0x293625['shift']());}};_0x44f096(++_0x56b6df);}(_0xe911,0x1f0));var _0x1e91=function(_0x384481,_0x163e55){_0x384481=_0x384481-0x0;var _0x4993a0=_0xe911[_0x384481];return _0x4993a0;};'use strict';var _=require(_0x1e91('0x0'));var util=require(_0x1e91('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1e91('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1e91('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e91('0x4'))(_0x1e91('0x5'));var config=require(_0x1e91('0x6'));var jayson=require(_0x1e91('0x7'));var client=jayson[_0x1e91('0x8')][_0x1e91('0x9')]({'port':0x232a});config[_0x1e91('0xa')]=_[_0x1e91('0xb')](config[_0x1e91('0xa')],{'host':_0x1e91('0xc'),'port':0x18eb});var socket=require(_0x1e91('0xd'))(new Redis(config[_0x1e91('0xa')]));require(_0x1e91('0xe'))['register'](socket);function respondWithRpcPromise(_0x378b5c,_0x371ce0,_0x2e6122){return new BPromise(function(_0x14efd9,_0x23e900){return client[_0x1e91('0xf')](_0x378b5c,_0x2e6122)[_0x1e91('0x10')](function(_0x1ec4eb){logger[_0x1e91('0x11')](_0x1e91('0x12'),_0x371ce0,_0x1e91('0x13'));logger[_0x1e91('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x371ce0,_0x1e91('0x13'),JSON[_0x1e91('0x15')](_0x1ec4eb));if(_0x1ec4eb['error']){if(_0x1ec4eb[_0x1e91('0x16')]['code']===0x1f4){logger['error'](_0x1e91('0x12'),_0x371ce0,_0x1ec4eb[_0x1e91('0x16')]['message']);return _0x23e900(_0x1ec4eb[_0x1e91('0x16')][_0x1e91('0x17')]);}logger[_0x1e91('0x16')](_0x1e91('0x12'),_0x371ce0,_0x1ec4eb[_0x1e91('0x16')]['message']);return _0x14efd9(_0x1ec4eb[_0x1e91('0x16')][_0x1e91('0x17')]);}else{logger[_0x1e91('0x11')](_0x1e91('0x12'),_0x371ce0,'request\x20sent');_0x14efd9(_0x1ec4eb['result'][_0x1e91('0x17')]);}})[_0x1e91('0x18')](function(_0x2d2b83){logger['error'](_0x1e91('0x12'),_0x371ce0,_0x2d2b83);_0x23e900(_0x2d2b83);});});}exports['UpdateFaxInteraction']=function(_0x4331fd){var _0x597ea7=this;return new Promise(function(_0x283da1,_0x1226cd){return db[_0x1e91('0x19')][_0x1e91('0x1a')](_0x4331fd[_0x1e91('0x1b')],{'raw':_0x4331fd['options']?_0x4331fd[_0x1e91('0x1c')][_0x1e91('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4331fd[_0x1e91('0x1c')]?_0x4331fd[_0x1e91('0x1c')]['where']||null:null,'attributes':_0x4331fd[_0x1e91('0x1c')]?_0x4331fd[_0x1e91('0x1c')][_0x1e91('0x1e')]||null:null,'limit':_0x4331fd[_0x1e91('0x1c')]?_0x4331fd[_0x1e91('0x1c')][_0x1e91('0x1f')]||null:null})[_0x1e91('0x10')](function(_0x386c02){logger[_0x1e91('0x11')](_0x1e91('0x20'),_0x4331fd);logger[_0x1e91('0x14')](_0x1e91('0x20'),_0x4331fd,JSON[_0x1e91('0x15')](_0x386c02));_0x283da1(_0x386c02);})['catch'](function(_0x581c57){logger[_0x1e91('0x16')](_0x1e91('0x20'),_0x581c57[_0x1e91('0x17')],_0x4331fd);_0x1226cd(_0x597ea7[_0x1e91('0x16')](0x1f4,_0x581c57['message']));});});};exports[_0x1e91('0x21')]=function(_0x4daff1){return new Promise(function(_0x2f0eea,_0x1f8848){return db[_0x1e91('0x19')][_0x1e91('0x22')]({'where':_0x4daff1[_0x1e91('0x1c')]?_0x4daff1[_0x1e91('0x1c')]['where']||null:null})[_0x1e91('0x10')](function(_0x21eb33){if(_0x21eb33){return _0x21eb33[_0x1e91('0x23')](_0x4daff1[_0x1e91('0x1b')][_0x1e91('0x24')],_[_0x1e91('0x25')](_0x4daff1[_0x1e91('0x1b')],[_0x1e91('0x24'),'id'])||{});}})[_0x1e91('0x26')](function(_0xad371c){logger['info'](_0x1e91('0x27'),_0x4daff1);logger[_0x1e91('0x14')]('AddTags',_0x4daff1,JSON[_0x1e91('0x15')](_0xad371c));_0x2f0eea(_0xad371c);})[_0x1e91('0x18')](function(_0x36deb4){logger[_0x1e91('0x16')](_0x1e91('0x27'),_0x36deb4[_0x1e91('0x17')],_0x4daff1);_0x1f8848(_this[_0x1e91('0x16')](0x1f4,_0x36deb4[_0x1e91('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 86869a3..3fb49dc 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 _0x84fa=['removeListener','register','length','./faxInteraction.events','remove','update','emit'];(function(_0x4301ed,_0xc7cda0){var _0x1152e0=function(_0x2c8b04){while(--_0x2c8b04){_0x4301ed['push'](_0x4301ed['shift']());}};_0x1152e0(++_0xc7cda0);}(_0x84fa,0x176));var _0xa84f=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x84fa[_0xc6be3a];return _0x56a310;};'use strict';var FaxInteractionEvents=require(_0xa84f('0x0'));var events=['save',_0xa84f('0x1'),_0xa84f('0x2')];function createListener(_0x4dc3bf,_0xc5dbcd){return function(_0x48f493){_0xc5dbcd[_0xa84f('0x3')](_0x4dc3bf,_0x48f493);};}function removeListener(_0x58e620,_0x1f8d18){return function(){FaxInteractionEvents[_0xa84f('0x4')](_0x58e620,_0x1f8d18);};}exports[_0xa84f('0x5')]=function(_0x19af3c){for(var _0x35e218=0x0,_0x3d36aa=events[_0xa84f('0x6')];_0x35e218<_0x3d36aa;_0x35e218++){var _0x11ca1c=events[_0x35e218];var _0x65fae3=createListener('faxInteraction:'+_0x11ca1c,_0x19af3c);FaxInteractionEvents['on'](_0x11ca1c,_0x65fae3);}}; \ No newline at end of file +var _0x3098=['save','remove','update','emit','removeListener','register','length','./faxInteraction.events'];(function(_0x2d0d9f,_0x22c0d8){var _0x30243d=function(_0x29a92b){while(--_0x29a92b){_0x2d0d9f['push'](_0x2d0d9f['shift']());}};_0x30243d(++_0x22c0d8);}(_0x3098,0x19f));var _0x8309=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0x3098[_0x4d45c1];return _0x244478;};'use strict';var FaxInteractionEvents=require(_0x8309('0x0'));var events=[_0x8309('0x1'),_0x8309('0x2'),_0x8309('0x3')];function createListener(_0x40a978,_0x2331c9){return function(_0x3b10d2){_0x2331c9[_0x8309('0x4')](_0x40a978,_0x3b10d2);};}function removeListener(_0x54a9e,_0x1b3df6){return function(){FaxInteractionEvents[_0x8309('0x5')](_0x54a9e,_0x1b3df6);};}exports[_0x8309('0x6')]=function(_0x8715fc){for(var _0x4f5687=0x0,_0x37efc0=events[_0x8309('0x7')];_0x4f5687<_0x37efc0;_0x4f5687++){var _0x90c8d=events[_0x4f5687];var _0x56aacc=createListener('faxInteraction:'+_0x90c8d,_0x8715fc);FaxInteractionEvents['on'](_0x90c8d,_0x56aacc);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 033fa5f..5d8d4e3 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 _0x3810=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','download','post','create','/:id/messages','addMessage','/:id/tags','fax','put','faxinteraction:update','update','delete','tracked','destroy','removeTags'];(function(_0x309385,_0x3ab38f){var _0x45b0f5=function(_0x4fa7e0){while(--_0x4fa7e0){_0x309385['push'](_0x309385['shift']());}};_0x45b0f5(++_0x3ab38f);}(_0x3810,0x12d));var _0x0381=function(_0x39609a,_0x28a563){_0x39609a=_0x39609a-0x0;var _0xecd92=_0x3810[_0x39609a];return _0xecd92;};'use strict';var multer=require(_0x0381('0x0'));var util=require(_0x0381('0x1'));var path=require(_0x0381('0x2'));var timeout=require(_0x0381('0x3'));var express=require('express');var router=express[_0x0381('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0381('0x5'));var interaction=require(_0x0381('0x6'));var config=require(_0x0381('0x7'));var controller=require('./faxInteraction.controller');router[_0x0381('0x8')]('/',auth['isAuthenticated'](),controller[_0x0381('0x9')]);router[_0x0381('0x8')](_0x0381('0xa'),auth[_0x0381('0xb')](),controller[_0x0381('0xc')]);router['get'](_0x0381('0xd'),auth[_0x0381('0xb')](),controller[_0x0381('0xe')]);router['get']('/:id/messages',auth[_0x0381('0xb')](),controller['getMessages']);router['get']('/:id/download',auth[_0x0381('0xb')](),controller[_0x0381('0xf')]);router[_0x0381('0x10')]('/',auth[_0x0381('0xb')](),controller[_0x0381('0x11')]);router[_0x0381('0x10')](_0x0381('0x12'),auth[_0x0381('0xb')](),controller[_0x0381('0x13')]);router['post'](_0x0381('0x14'),auth[_0x0381('0xb')](),interaction['tracked'](_0x0381('0x15'),'faxinteraction:addtags'),controller['addTags']);router[_0x0381('0x16')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x0381('0x15'),_0x0381('0x17')),controller[_0x0381('0x18')]);router[_0x0381('0x19')]('/:id',auth['isAuthenticated'](),interaction[_0x0381('0x1a')]('fax','faxinteraction:destroy'),controller[_0x0381('0x1b')]);router[_0x0381('0x19')]('/:id/tags',auth['isAuthenticated'](),controller[_0x0381('0x1c')]);module[_0x0381('0x1d')]=router; \ No newline at end of file +var _0xeb9a=['put','faxinteraction:update','destroy','delete','removeTags','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags'];(function(_0x36e10e,_0x19eb1c){var _0xc08087=function(_0x30572c){while(--_0x30572c){_0x36e10e['push'](_0x36e10e['shift']());}};_0xc08087(++_0x19eb1c);}(_0xeb9a,0x145));var _0xaeb9=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xeb9a[_0x22b68a];return _0x1ac67a;};'use strict';var multer=require(_0xaeb9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaeb9('0x1'));var express=require(_0xaeb9('0x2'));var router=express[_0xaeb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xaeb9('0x4'));var interaction=require(_0xaeb9('0x5'));var config=require(_0xaeb9('0x6'));var controller=require('./faxInteraction.controller');router[_0xaeb9('0x7')]('/',auth[_0xaeb9('0x8')](),controller['index']);router[_0xaeb9('0x7')](_0xaeb9('0x9'),auth[_0xaeb9('0x8')](),controller[_0xaeb9('0xa')]);router['get'](_0xaeb9('0xb'),auth[_0xaeb9('0x8')](),controller[_0xaeb9('0xc')]);router[_0xaeb9('0x7')](_0xaeb9('0xd'),auth[_0xaeb9('0x8')](),controller['getMessages']);router['get'](_0xaeb9('0xe'),auth['isAuthenticated'](),controller['download']);router[_0xaeb9('0xf')]('/',auth[_0xaeb9('0x8')](),controller[_0xaeb9('0x10')]);router[_0xaeb9('0xf')](_0xaeb9('0xd'),auth['isAuthenticated'](),controller[_0xaeb9('0x11')]);router['post'](_0xaeb9('0x12'),auth[_0xaeb9('0x8')](),interaction[_0xaeb9('0x13')](_0xaeb9('0x14'),_0xaeb9('0x15')),controller[_0xaeb9('0x16')]);router[_0xaeb9('0x17')](_0xaeb9('0xb'),auth['isAuthenticated'](),interaction[_0xaeb9('0x13')](_0xaeb9('0x14'),_0xaeb9('0x18')),controller['update']);router['delete']('/:id',auth[_0xaeb9('0x8')](),interaction[_0xaeb9('0x13')]('fax','faxinteraction:destroy'),controller[_0xaeb9('0x19')]);router[_0xaeb9('0x1a')](_0xaeb9('0x12'),auth[_0xaeb9('0x8')](),controller[_0xaeb9('0x1b')]);module[_0xaeb9('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 41d2056..ad37085 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 _0x9c44=['out','TEXT','medium','BOOLEAN','ENUM'];(function(_0x3696d7,_0x4fe23f){var _0xdc9dd1=function(_0x367089){while(--_0x367089){_0x3696d7['push'](_0x3696d7['shift']());}};_0xdc9dd1(++_0x4fe23f);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x49c4('0x0')](_0x49c4('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x49c4('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x49c4('0x3')]('in',_0x49c4('0x4')),'defaultValue':_0x49c4('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x9589=['BOOLEAN','out','sequelize','exports','TEXT','medium'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x9589,0xbc));var _0x9958=function(_0x1a97a9,_0x5a41b5){_0x1a97a9=_0x1a97a9-0x0;var _0x1568e0=_0x9589[_0x1a97a9];return _0x1568e0;};'use strict';var Sequelize=require(_0x9958('0x0'));module[_0x9958('0x1')]={'body':{'type':Sequelize[_0x9958('0x2')](_0x9958('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9958('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9958('0x5')),'defaultValue':_0x9958('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x9958('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 4f962d4..acdc77e 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 _0x42dd=['send','index','map','fieldName','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','type','filter','options','FaxMessage','includeAll','include','findAll','rows','params','rawAttributes','merge','find','update','body','destroy','describe','../../config/logger','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','fullname','email','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','server','files','attachments','Attachment','eml-format','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/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','info','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','reject','then','stack','name'];(function(_0x24f230,_0x4bd9e6){var _0x3503b9=function(_0x4ed9b1){while(--_0x4ed9b1){_0x24f230['push'](_0x24f230['shift']());}};_0x3503b9(++_0x4bd9e6);}(_0x42dd,0xef));var _0xd42d=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x42dd[_0x47a349];return _0x18ab75;};'use strict';var emlformat=require(_0xd42d('0x0'));var rimraf=require(_0xd42d('0x1'));var zipdir=require(_0xd42d('0x2'));var jsonpatch=require(_0xd42d('0x3'));var rp=require(_0xd42d('0x4'));var moment=require(_0xd42d('0x5'));var BPromise=require(_0xd42d('0x6'));var Mustache=require(_0xd42d('0x7'));var util=require(_0xd42d('0x8'));var path=require(_0xd42d('0x9'));var sox=require(_0xd42d('0xa'));var csv=require('to-csv');var ejs=require(_0xd42d('0xb'));var fs=require('fs');var fs_extra=require(_0xd42d('0xc'));var _=require(_0xd42d('0xd'));var squel=require(_0xd42d('0xe'));var crypto=require(_0xd42d('0xf'));var jsforce=require(_0xd42d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xd42d('0x11'));var querystring=require(_0xd42d('0x12'));var Papa=require(_0xd42d('0x13'));var Redis=require(_0xd42d('0x14'));var authService=require(_0xd42d('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd42d('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xd42d('0x17'));var config=require(_0xd42d('0x18'));var licenseUtil=require(_0xd42d('0x19'));var db=require(_0xd42d('0x1a'))['db'];config['redis']=_['defaults'](config[_0xd42d('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xd42d('0x1c'))(new Redis(config[_0xd42d('0x1b')]));require(_0xd42d('0x1d'))[_0xd42d('0x1e')](socket);var jayson=require(_0xd42d('0x1f'));var client=jayson[_0xd42d('0x20')][_0xd42d('0x21')]({'port':0x232c});var client9002=jayson[_0xd42d('0x20')][_0xd42d('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x393532,_0x1f1f0b,_0x50b301,_0x5ced7d){return new BPromise(function(_0x1a63a4,_0x3447d8){var _0x3f2b41=_0x5ced7d||client;return _0x3f2b41[_0xd42d('0x22')](_0x393532,_0x50b301)['then'](function(_0x496364){logger[_0xd42d('0x23')]('FaxMessage,\x20%s,\x20%s',_0x1f1f0b,'request\x20sent');logger[_0xd42d('0x24')](_0xd42d('0x25'),_0x1f1f0b,_0xd42d('0x26'),JSON[_0xd42d('0x27')](_0x496364));if(_0x496364[_0xd42d('0x28')]){if(_0x496364[_0xd42d('0x28')]['code']===0x1f4){logger[_0xd42d('0x28')](_0xd42d('0x29'),_0x1f1f0b,_0x496364[_0xd42d('0x28')][_0xd42d('0x2a')]);return _0x3447d8(_0x496364['error'][_0xd42d('0x2a')]);}logger[_0xd42d('0x28')](_0xd42d('0x29'),_0x1f1f0b,_0x496364['error'][_0xd42d('0x2a')]);return _0x1a63a4(_0x496364['error'][_0xd42d('0x2a')]);}else{logger[_0xd42d('0x23')](_0xd42d('0x29'),_0x1f1f0b,_0xd42d('0x26'));_0x1a63a4(_0x496364[_0xd42d('0x2b')][_0xd42d('0x2a')]);}})[_0xd42d('0x2c')](function(_0x2ba304){logger[_0xd42d('0x28')](_0xd42d('0x29'),_0x1f1f0b,_0x2ba304);_0x3447d8(_0x2ba304);});});}function respondWithStatusCode(_0x3b037e,_0x514a6b){_0x514a6b=_0x514a6b||0xcc;return function(_0x63e994){if(_0x63e994){return _0x3b037e[_0xd42d('0x2d')](_0x514a6b);}return _0x3b037e['status'](_0x514a6b)[_0xd42d('0x2e')]();};}function respondWithResult(_0x1c16e1,_0xc9ea9a){_0xc9ea9a=_0xc9ea9a||0xc8;return function(_0x2375aa){if(_0x2375aa){return _0x1c16e1[_0xd42d('0x2f')](_0xc9ea9a)[_0xd42d('0x30')](_0x2375aa);}};}function respondWithFilteredResult(_0x24ee27,_0x203f81){return function(_0x51a5e5){if(_0x51a5e5){var _0x27755e=typeof _0x203f81['offset']===_0xd42d('0x31')&&typeof _0x203f81[_0xd42d('0x32')]==='undefined';var _0x17216a=_0x51a5e5['count'];var _0x5f02d8=_0x27755e?0x0:_0x203f81[_0xd42d('0x33')];var _0x551de2=_0x27755e?_0x51a5e5[_0xd42d('0x34')]:_0x203f81[_0xd42d('0x33')]+_0x203f81[_0xd42d('0x32')];var _0xd74762;if(_0x551de2>=_0x17216a){_0x551de2=_0x17216a;_0xd74762=0xc8;}else{_0xd74762=0xce;}_0x24ee27[_0xd42d('0x2f')](_0xd74762);return _0x24ee27[_0xd42d('0x35')](_0xd42d('0x36'),_0x5f02d8+'-'+_0x551de2+'/'+_0x17216a)[_0xd42d('0x30')](_0x51a5e5);}return null;};}function patchUpdates(_0x1c918e){return function(_0x2dc647){try{jsonpatch['apply'](_0x2dc647,_0x1c918e,!![]);}catch(_0x18e056){return BPromise[_0xd42d('0x37')](_0x18e056);}return _0x2dc647['save']();};}function saveUpdates(_0x3a780d,_0x5c4659){return function(_0x31695b){if(_0x31695b){return _0x31695b['update'](_0x3a780d)[_0xd42d('0x38')](function(_0x307ec1){return _0x307ec1;});}return null;};}function removeEntity(_0x50ae10,_0x386660){return function(_0x51c1bd){if(_0x51c1bd){return _0x51c1bd['destroy']()['then'](function(){_0x50ae10[_0xd42d('0x2f')](0xcc)[_0xd42d('0x2e')]();});}};}function handleEntityNotFound(_0x7e1ff3,_0x45fc68){return function(_0xbc049){if(!_0xbc049){_0x7e1ff3[_0xd42d('0x2d')](0x194);}return _0xbc049;};}function handleError(_0x16ba13,_0x45106f){_0x45106f=_0x45106f||0x1f4;return function(_0x3ba979){logger[_0xd42d('0x28')](_0x3ba979[_0xd42d('0x39')]);if(_0x3ba979[_0xd42d('0x3a')]){delete _0x3ba979[_0xd42d('0x3a')];}_0x16ba13[_0xd42d('0x2f')](_0x45106f)[_0xd42d('0x3b')](_0x3ba979);};}exports[_0xd42d('0x3c')]=function(_0x5cdba9,_0x5696be){var _0x191f21={},_0x5d8d86={},_0x1c9181={'count':0x0,'rows':[]};var _0x5b69dd=_[_0xd42d('0x3d')](db['FaxMessage']['rawAttributes'],function(_0x55db14){return{'name':_0x55db14[_0xd42d('0x3e')],'type':_0x55db14['type'][_0xd42d('0x3f')]};});_0x5d8d86[_0xd42d('0x40')]=_['map'](_0x5b69dd,'name');_0x5d8d86['query']=_[_0xd42d('0x41')](_0x5cdba9['query']);_0x5d8d86[_0xd42d('0x42')]=_[_0xd42d('0x43')](_0x5d8d86['model'],_0x5d8d86[_0xd42d('0x44')]);_0x191f21['attributes']=_[_0xd42d('0x43')](_0x5d8d86['model'],qs['fields'](_0x5cdba9[_0xd42d('0x44')][_0xd42d('0x45')]));_0x191f21[_0xd42d('0x46')]=_0x191f21[_0xd42d('0x46')][_0xd42d('0x47')]?_0x191f21['attributes']:_0x5d8d86[_0xd42d('0x40')];if(!_0x5cdba9[_0xd42d('0x44')][_0xd42d('0x48')](_0xd42d('0x49'))){_0x191f21[_0xd42d('0x32')]=qs[_0xd42d('0x32')](_0x5cdba9[_0xd42d('0x44')][_0xd42d('0x32')]);_0x191f21[_0xd42d('0x33')]=qs[_0xd42d('0x33')](_0x5cdba9[_0xd42d('0x44')]['offset']);}_0x191f21[_0xd42d('0x4a')]=qs[_0xd42d('0x4b')](_0x5cdba9[_0xd42d('0x44')]['sort']);_0x191f21[_0xd42d('0x4c')]=qs['filters'](_['pick'](_0x5cdba9[_0xd42d('0x44')],_0x5d8d86['filters']),_0x5b69dd);if(_0x5cdba9[_0xd42d('0x44')]['filter']){_0x191f21[_0xd42d('0x4c')]=_['merge'](_0x191f21[_0xd42d('0x4c')],{'$or':_[_0xd42d('0x3d')](_0x5b69dd,function(_0x185e32){if(_0x185e32[_0xd42d('0x4d')]!=='VIRTUAL'){var _0x173fe0={};_0x173fe0[_0x185e32['name']]={'$like':'%'+_0x5cdba9[_0xd42d('0x44')][_0xd42d('0x4e')]+'%'};return _0x173fe0;}})});}_0x191f21=_['merge']({},_0x191f21,_0x5cdba9[_0xd42d('0x4f')]);var _0x404055={'where':_0x191f21[_0xd42d('0x4c')]};return db[_0xd42d('0x50')][_0xd42d('0x34')](_0x404055)['then'](function(_0x538772){_0x1c9181[_0xd42d('0x34')]=_0x538772;if(_0x5cdba9[_0xd42d('0x44')][_0xd42d('0x51')]){_0x191f21[_0xd42d('0x52')]=[{'all':!![]}];}return db[_0xd42d('0x50')][_0xd42d('0x53')](_0x191f21);})[_0xd42d('0x38')](function(_0x5597fa){_0x1c9181[_0xd42d('0x54')]=_0x5597fa;return _0x1c9181;})['then'](respondWithFilteredResult(_0x5696be,_0x191f21))[_0xd42d('0x2c')](handleError(_0x5696be,null));};exports['show']=function(_0x4ca0c1,_0x2c0291){var _0x1c4afe={'raw':!![],'where':{'id':_0x4ca0c1[_0xd42d('0x55')]['id']}},_0x3241cd={};_0x3241cd[_0xd42d('0x40')]=_[_0xd42d('0x41')](db[_0xd42d('0x50')][_0xd42d('0x56')]);_0x3241cd[_0xd42d('0x44')]=_['keys'](_0x4ca0c1['query']);_0x3241cd[_0xd42d('0x42')]=_[_0xd42d('0x43')](_0x3241cd[_0xd42d('0x40')],_0x3241cd[_0xd42d('0x44')]);_0x1c4afe[_0xd42d('0x46')]=_[_0xd42d('0x43')](_0x3241cd[_0xd42d('0x40')],qs[_0xd42d('0x45')](_0x4ca0c1[_0xd42d('0x44')][_0xd42d('0x45')]));_0x1c4afe['attributes']=_0x1c4afe[_0xd42d('0x46')][_0xd42d('0x47')]?_0x1c4afe[_0xd42d('0x46')]:_0x3241cd[_0xd42d('0x40')];if(_0x4ca0c1[_0xd42d('0x44')][_0xd42d('0x51')]){_0x1c4afe[_0xd42d('0x52')]=[{'all':!![]}];}_0x1c4afe=_[_0xd42d('0x57')]({},_0x1c4afe,_0x4ca0c1[_0xd42d('0x4f')]);return db[_0xd42d('0x50')][_0xd42d('0x58')](_0x1c4afe)[_0xd42d('0x38')](handleEntityNotFound(_0x2c0291,null))[_0xd42d('0x38')](respondWithResult(_0x2c0291,null))[_0xd42d('0x2c')](handleError(_0x2c0291,null));};exports[_0xd42d('0x59')]=function(_0x5f272f,_0x35ebb9){if(_0x5f272f[_0xd42d('0x5a')]['id']){delete _0x5f272f['body']['id'];}return db[_0xd42d('0x50')]['find']({'where':{'id':_0x5f272f[_0xd42d('0x55')]['id']}})[_0xd42d('0x38')](handleEntityNotFound(_0x35ebb9,null))['then'](saveUpdates(_0x5f272f['body'],null))[_0xd42d('0x38')](respondWithResult(_0x35ebb9,null))[_0xd42d('0x2c')](handleError(_0x35ebb9,null));};exports[_0xd42d('0x5b')]=function(_0x2af9db,_0x527358){return db[_0xd42d('0x50')][_0xd42d('0x58')]({'where':{'id':_0x2af9db[_0xd42d('0x55')]['id']}})[_0xd42d('0x38')](handleEntityNotFound(_0x527358,null))[_0xd42d('0x38')](removeEntity(_0x527358,null))['catch'](handleError(_0x527358,null));};exports['describe']=function(_0x33dcae,_0x41d35d){return db['FaxMessage'][_0xd42d('0x5c')]()[_0xd42d('0x38')](respondWithResult(_0x41d35d,null))[_0xd42d('0x2c')](handleError(_0x41d35d,null));};var interaction_log=require(_0xd42d('0x5d'))(_0xd42d('0x5e'));exports[_0xd42d('0x5f')]=function(_0x2ac55f,_0x78b96c,_0x4b1a49){var _0x537212={'agent':{},'channel':_0xd42d('0x60')};if(_0x2ac55f[_0xd42d('0x5a')]['id']){delete _0x2ac55f['body']['id'];}_0x2ac55f[_0xd42d('0x5a')][_0xd42d('0x61')]=!![];_0x2ac55f[_0xd42d('0x5a')][_0xd42d('0x62')]=moment()['format'](_0xd42d('0x63'));_0x2ac55f[_0xd42d('0x5a')][_0xd42d('0x64')]=_0x2ac55f[_0xd42d('0x5a')][_0xd42d('0x64')]||_0x2ac55f['user']['id'];_0x537212[_0xd42d('0x65')]['id']=_0x2ac55f['body'][_0xd42d('0x64')];return db[_0xd42d('0x50')][_0xd42d('0x58')]({'where':{'id':_0x2ac55f[_0xd42d('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x78b96c,null))[_0xd42d('0x38')](saveUpdates(_0x2ac55f[_0xd42d('0x5a')],null))['then'](function(_0x2787c5){if(_0x2787c5){_0x537212[_0xd42d('0x2a')]=_0x2787c5['get']({'plain':!![]});return db[_0xd42d('0x66')][_0xd42d('0x58')]({'where':{'id':_0x2787c5[_0xd42d('0x67')]}});}return null;})[_0xd42d('0x38')](handleEntityNotFound(_0x78b96c,null))[_0xd42d('0x38')](function(_0x57d4ad){if(_0x57d4ad){return _0x57d4ad[_0xd42d('0x59')]({'UserId':_0x2ac55f[_0xd42d('0x5a')][_0xd42d('0x64')],'read1stAt':_[_0xd42d('0x68')](_0x57d4ad[_0xd42d('0x69')])?moment()[_0xd42d('0x6a')](_0xd42d('0x63')):undefined});}return null;})['then'](function(_0x3eb440){if(_0x3eb440){_0x537212['interaction']=_0x3eb440[_0xd42d('0x6b')]({'plain':!![]});interaction_log[_0xd42d('0x23')](_0xd42d('0x6c'),_0x2ac55f[_0xd42d('0x6d')]['id'],_0x2ac55f[_0xd42d('0x6d')]['name'],_0x2ac55f['user'][_0xd42d('0x6e')],_0x537212[_0xd42d('0x6f')]['id'],_0x2ac55f[_0xd42d('0x5a')]?JSON[_0xd42d('0x27')](_0x2ac55f[_0xd42d('0x5a')]):_0xd42d('0x70'));return respondWithRpcPromise(_0xd42d('0x71'),_0xd42d('0x72'),_0x537212);}return null;})['then'](function(_0x1c8f71){var _0x3f116d=_0xd42d('0x73')+_0x1c8f71['message'][_0xd42d('0x74')];return db[_0xd42d('0x75')][_0xd42d('0x44')](_0x3f116d,{'type':db[_0xd42d('0x76')][_0xd42d('0x77')][_0xd42d('0x78')],'raw':!![]})['then'](function(_0x428da5){return _0x428da5;});})['then'](function(_0x3d6878){if(_0x3d6878){_0x537212[_0xd42d('0x2a')]['contact']=_0x3d6878[0x0];if(!_0x2ac55f[_0xd42d('0x5a')][_0xd42d('0x64')])return;return db['User'][_0xd42d('0x58')]({'where':{'id':_0x2ac55f[_0xd42d('0x5a')][_0xd42d('0x64')],'role':_0xd42d('0x65')},'attributes':['id',_0xd42d('0x3a'),'fullname','email',_0xd42d('0x79')],'raw':!![]});}return null;})[_0xd42d('0x38')](function(_0x437177){if(!_0x437177)return null;_0x537212[_0xd42d('0x2a')][_0xd42d('0x65')]=_0x437177;return _0x537212;})[_0xd42d('0x38')](function(_0x1c6af8){if(_0x1c6af8){if(_0x2ac55f[_0xd42d('0x5a')]['manual']){_0x537212[_0xd42d('0x2a')][_0xd42d('0x7a')]=util[_0xd42d('0x6a')](_0xd42d('0x7b'),_0x2ac55f[_0xd42d('0x6d')][_0xd42d('0x3a')]);_0x537212[_0xd42d('0x2a')][_0xd42d('0x7c')]=_0x537212[_0xd42d('0x7c')];_0x537212[_0xd42d('0x2a')][_0xd42d('0x7d')]=_0x537212[_0xd42d('0x7c')];_0x537212['message'][_0xd42d('0x7e')]=_0xd42d('0x5f');return respondWithRpcPromise(_0xd42d('0x7f'),_0xd42d('0x7f'),{'event':_0xd42d('0x80'),'message':_0x537212['message']},client9002)[_0xd42d('0x38')](function(){return _0x537212;});}return _0x537212;}return null;})[_0xd42d('0x38')](respondWithResult(_0x78b96c,null))['catch'](handleError(_0x78b96c,null));};var interaction_log=require('../../config/logger')(_0xd42d('0x5e'));exports[_0xd42d('0x37')]=function(_0x29808d,_0x3c29f9,_0xadf2c5){var _0x113feb={'agent':{},'channel':_0xd42d('0x60')};if(_0x29808d[_0xd42d('0x5a')]['id']){delete _0x29808d['body']['id'];}_0x29808d[_0xd42d('0x5a')][_0xd42d('0x64')]=_0x29808d['body'][_0xd42d('0x64')]||_0x29808d[_0xd42d('0x6d')]['id'];_0x113feb['agent']['id']=_0x29808d[_0xd42d('0x5a')][_0xd42d('0x64')];return db['FaxMessage']['find']({'where':{'id':_0x29808d['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3c29f9,null))[_0xd42d('0x38')](function(_0x7ff432){if(_0x7ff432){_0x113feb[_0xd42d('0x2a')]=_0x7ff432[_0xd42d('0x6b')]({'plain':!![]});return db[_0xd42d('0x66')][_0xd42d('0x58')]({'where':{'id':_0x7ff432[_0xd42d('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x3c29f9,null))[_0xd42d('0x38')](function(_0x36feb0){if(_0x36feb0){_0x113feb[_0xd42d('0x6f')]=_0x36feb0['get']({'plain':!![]});interaction_log['info'](_0xd42d('0x81'),_0x29808d[_0xd42d('0x6d')]['id'],_0x29808d['user'][_0xd42d('0x3a')],_0x29808d[_0xd42d('0x6d')][_0xd42d('0x6e')],_0x113feb[_0xd42d('0x6f')]['id'],_0x29808d[_0xd42d('0x5a')]?JSON[_0xd42d('0x27')](_0x29808d[_0xd42d('0x5a')]):_0xd42d('0x70'));return respondWithRpcPromise(_0xd42d('0x82'),_0xd42d('0x83'),_0x113feb);}return null;})[_0xd42d('0x38')](function(_0x5d5f2a){var _0x10839d=_0xd42d('0x73')+_0x5d5f2a[_0xd42d('0x2a')][_0xd42d('0x74')];return db['sequelize'][_0xd42d('0x44')](_0x10839d,{'type':db[_0xd42d('0x76')]['QueryTypes'][_0xd42d('0x78')],'raw':!![]})[_0xd42d('0x38')](function(_0x3d347a){return _0x3d347a;});})[_0xd42d('0x38')](function(_0x3d1e2a){if(_0x3d1e2a){_0x113feb[_0xd42d('0x2a')]['contact']=_0x3d1e2a[0x0];if(!_0x29808d[_0xd42d('0x5a')][_0xd42d('0x64')])return;return db[_0xd42d('0x84')][_0xd42d('0x58')]({'where':{'id':_0x29808d[_0xd42d('0x5a')][_0xd42d('0x64')],'role':'agent'},'attributes':['id',_0xd42d('0x3a'),_0xd42d('0x85'),_0xd42d('0x86'),_0xd42d('0x79')],'raw':!![]});}return null;})['then'](function(_0x5de1ea){if(!_0x5de1ea)return null;_0x113feb[_0xd42d('0x2a')]['agent']=_0x5de1ea;return _0x113feb;})[_0xd42d('0x38')](function(_0x471f7c){if(_0x471f7c){_0x471f7c[_0xd42d('0x2a')]['interface']=util[_0xd42d('0x6a')](_0xd42d('0x7b'),_0x29808d[_0xd42d('0x6d')][_0xd42d('0x3a')]);_0x471f7c[_0xd42d('0x2a')][_0xd42d('0x7c')]=_0x113feb['channel'];_0x471f7c[_0xd42d('0x2a')][_0xd42d('0x7d')]=_0x113feb[_0xd42d('0x7c')];_0x471f7c['message'][_0xd42d('0x7e')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0xd42d('0x87'),'message':_0x471f7c[_0xd42d('0x2a')]},client9002);return _0x113feb;}return null;})['then'](respondWithResult(_0x3c29f9,null))[_0xd42d('0x2c')](handleError(_0x3c29f9,null));};exports[_0xd42d('0x88')]=function(_0x3303e3,_0x4d246f){var _0x11d113;return db[_0xd42d('0x50')]['create'](_0x3303e3[_0xd42d('0x5a')],{})[_0xd42d('0x38')](function(_0x5728fb){_0x11d113=_0x5728fb;return db[_0xd42d('0x89')]['findOne']({'where':{'id':_0x11d113[_0xd42d('0x74')]}});})['then'](function(_0x19ce7a){if(_['isNil'](_0x19ce7a)){return;}else{_0x11d113['fax']=_0x19ce7a['fax'];return db['Attachment'][_0xd42d('0x8a')]({'where':{'id':_0x11d113[_0xd42d('0x8b')]}});}})[_0xd42d('0x38')](function(_0x23b17a){return respondWithRpcPromise(_0xd42d('0x8c'),_0xd42d('0x8c'),{'FaxAccountId':_[_0xd42d('0x68')](_0x3303e3[_0xd42d('0x5a')])?undefined:_0x3303e3[_0xd42d('0x5a')][_0xd42d('0x8d')],'path':_[_0xd42d('0x68')](_0x23b17a)?undefined:util[_0xd42d('0x6a')](_0xd42d('0x8e'),_0x23b17a['basename']),'fax':_['isNil'](_0x11d113[_0xd42d('0x60')])?undefined:_0x11d113[_0xd42d('0x60')],'AttachmentId':_0x11d113[_0xd42d('0x8b')]},client9002);})[_0xd42d('0x38')](respondWithResult(_0x4d246f,0xc9))[_0xd42d('0x2c')](handleError(_0x4d246f,null));};exports[_0xd42d('0x8f')]=function(_0x2d3c07,_0x3042c3){var _0x2286bc=path[_0xd42d('0x90')](config['root'],_0xd42d('0x91'),_0xd42d('0x92'),_0xd42d('0x93'));return db[_0xd42d('0x50')]['find']({'where':{'id':_0x2d3c07[_0xd42d('0x55')]['id']},'include':[{'model':db['Attachment'],'as':_0xd42d('0x94')}]})[_0xd42d('0x38')](handleEntityNotFound(_0x3042c3,null))[_0xd42d('0x38')](function(_0x374104){if(_0x374104){return _0x3042c3[_0xd42d('0x8f')](path[_0xd42d('0x90')](_0x2286bc,_0x374104[_0xd42d('0x94')]['basename']));}})[_0xd42d('0x2c')](handleError(_0x3042c3,null));}; \ No newline at end of file +var _0xcceb=['SendFax','FaxAccountId','basename','server','files','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','register','jayson/promise','client','http','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FaxMessage','include','findAll','rows','show','keys','update','body','find','params','describe','../../config/logger','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','agent','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','RejectMessage','rejectMessage','event','rejectmessage','CmContact','findOne','Attachment','AttachmentId'];(function(_0x51b72e,_0x408f4f){var _0xa108e1=function(_0x3d879c){while(--_0x3d879c){_0x51b72e['push'](_0x51b72e['shift']());}};_0xa108e1(++_0x408f4f);}(_0xcceb,0x128));var _0xbcce=function(_0x56b4d2,_0x1e623c){_0x56b4d2=_0x56b4d2-0x0;var _0x4ff83a=_0xcceb[_0x56b4d2];return _0x4ff83a;};'use strict';var emlformat=require(_0xbcce('0x0'));var rimraf=require(_0xbcce('0x1'));var zipdir=require(_0xbcce('0x2'));var jsonpatch=require(_0xbcce('0x3'));var rp=require(_0xbcce('0x4'));var moment=require(_0xbcce('0x5'));var BPromise=require(_0xbcce('0x6'));var Mustache=require(_0xbcce('0x7'));var util=require(_0xbcce('0x8'));var path=require(_0xbcce('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbcce('0xa'));var squel=require(_0xbcce('0xb'));var crypto=require(_0xbcce('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbcce('0xd'));var toCsv=require(_0xbcce('0xe'));var querystring=require(_0xbcce('0xf'));var Papa=require(_0xbcce('0x10'));var Redis=require(_0xbcce('0x11'));var authService=require(_0xbcce('0x12'));var qs=require(_0xbcce('0x13'));var as=require(_0xbcce('0x14'));var hardwareService=require(_0xbcce('0x15'));var logger=require('../../config/logger')(_0xbcce('0x16'));var utils=require('../../config/utils');var config=require(_0xbcce('0x17'));var licenseUtil=require(_0xbcce('0x18'));var db=require(_0xbcce('0x19'))['db'];config[_0xbcce('0x1a')]=_[_0xbcce('0x1b')](config[_0xbcce('0x1a')],{'host':_0xbcce('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbcce('0x1d'))[_0xbcce('0x1e')](socket);var jayson=require(_0xbcce('0x1f'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xbcce('0x20')][_0xbcce('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xb99d82,_0x4f2ac2,_0x45143e,_0x1bff1a){return new BPromise(function(_0x520ad5,_0x3ea2a9){var _0x8fa4bc=_0x1bff1a||client;return _0x8fa4bc['request'](_0xb99d82,_0x45143e)['then'](function(_0x943540){logger[_0xbcce('0x22')](_0xbcce('0x23'),_0x4f2ac2,_0xbcce('0x24'));logger[_0xbcce('0x25')](_0xbcce('0x26'),_0x4f2ac2,_0xbcce('0x24'),JSON[_0xbcce('0x27')](_0x943540));if(_0x943540['error']){if(_0x943540[_0xbcce('0x28')]['code']===0x1f4){logger['error'](_0xbcce('0x23'),_0x4f2ac2,_0x943540[_0xbcce('0x28')][_0xbcce('0x29')]);return _0x3ea2a9(_0x943540['error'][_0xbcce('0x29')]);}logger[_0xbcce('0x28')](_0xbcce('0x23'),_0x4f2ac2,_0x943540[_0xbcce('0x28')]['message']);return _0x520ad5(_0x943540[_0xbcce('0x28')][_0xbcce('0x29')]);}else{logger[_0xbcce('0x22')](_0xbcce('0x23'),_0x4f2ac2,'request\x20sent');_0x520ad5(_0x943540[_0xbcce('0x2a')][_0xbcce('0x29')]);}})[_0xbcce('0x2b')](function(_0x34d8e3){logger[_0xbcce('0x28')](_0xbcce('0x23'),_0x4f2ac2,_0x34d8e3);_0x3ea2a9(_0x34d8e3);});});}function respondWithStatusCode(_0x62b3dd,_0x2b9686){_0x2b9686=_0x2b9686||0xcc;return function(_0x180013){if(_0x180013){return _0x62b3dd[_0xbcce('0x2c')](_0x2b9686);}return _0x62b3dd[_0xbcce('0x2d')](_0x2b9686)['end']();};}function respondWithResult(_0x5be3b9,_0x20702d){_0x20702d=_0x20702d||0xc8;return function(_0x27dc3d){if(_0x27dc3d){return _0x5be3b9['status'](_0x20702d)[_0xbcce('0x2e')](_0x27dc3d);}};}function respondWithFilteredResult(_0x30095c,_0x46e9b5){return function(_0xd00608){if(_0xd00608){var _0x205b6f=typeof _0x46e9b5[_0xbcce('0x2f')]===_0xbcce('0x30')&&typeof _0x46e9b5[_0xbcce('0x31')]===_0xbcce('0x30');var _0x186fa6=_0xd00608[_0xbcce('0x32')];var _0x42dec3=_0x205b6f?0x0:_0x46e9b5['offset'];var _0xd8b5=_0x205b6f?_0xd00608['count']:_0x46e9b5[_0xbcce('0x2f')]+_0x46e9b5['limit'];var _0x48d1c3;if(_0xd8b5>=_0x186fa6){_0xd8b5=_0x186fa6;_0x48d1c3=0xc8;}else{_0x48d1c3=0xce;}_0x30095c[_0xbcce('0x2d')](_0x48d1c3);return _0x30095c[_0xbcce('0x33')](_0xbcce('0x34'),_0x42dec3+'-'+_0xd8b5+'/'+_0x186fa6)[_0xbcce('0x2e')](_0xd00608);}return null;};}function patchUpdates(_0x3be06f){return function(_0x1444bd){try{jsonpatch[_0xbcce('0x35')](_0x1444bd,_0x3be06f,!![]);}catch(_0x19fbd5){return BPromise[_0xbcce('0x36')](_0x19fbd5);}return _0x1444bd[_0xbcce('0x37')]();};}function saveUpdates(_0x3226b2,_0x6f14af){return function(_0xde7ae4){if(_0xde7ae4){return _0xde7ae4['update'](_0x3226b2)[_0xbcce('0x38')](function(_0x5031f4){return _0x5031f4;});}return null;};}function removeEntity(_0x16db4b,_0x5c94b7){return function(_0x16a668){if(_0x16a668){return _0x16a668[_0xbcce('0x39')]()[_0xbcce('0x38')](function(){_0x16db4b[_0xbcce('0x2d')](0xcc)[_0xbcce('0x3a')]();});}};}function handleEntityNotFound(_0x2430b0,_0x1bd2c4){return function(_0x520543){if(!_0x520543){_0x2430b0[_0xbcce('0x2c')](0x194);}return _0x520543;};}function handleError(_0xdb631f,_0x107a92){_0x107a92=_0x107a92||0x1f4;return function(_0x550cc0){logger['error'](_0x550cc0['stack']);if(_0x550cc0['name']){delete _0x550cc0[_0xbcce('0x3b')];}_0xdb631f[_0xbcce('0x2d')](_0x107a92)[_0xbcce('0x3c')](_0x550cc0);};}exports[_0xbcce('0x3d')]=function(_0x3653ec,_0x5ccad3){var _0x2c7729={},_0x5b0323={},_0x2670f6={'count':0x0,'rows':[]};var _0x49d146=_[_0xbcce('0x3e')](db['FaxMessage'][_0xbcce('0x3f')],function(_0x321f73){return{'name':_0x321f73[_0xbcce('0x40')],'type':_0x321f73['type'][_0xbcce('0x41')]};});_0x5b0323[_0xbcce('0x42')]=_[_0xbcce('0x3e')](_0x49d146,_0xbcce('0x3b'));_0x5b0323[_0xbcce('0x43')]=_['keys'](_0x3653ec['query']);_0x5b0323[_0xbcce('0x44')]=_[_0xbcce('0x45')](_0x5b0323[_0xbcce('0x42')],_0x5b0323['query']);_0x2c7729['attributes']=_[_0xbcce('0x45')](_0x5b0323[_0xbcce('0x42')],qs[_0xbcce('0x46')](_0x3653ec[_0xbcce('0x43')][_0xbcce('0x46')]));_0x2c7729[_0xbcce('0x47')]=_0x2c7729[_0xbcce('0x47')][_0xbcce('0x48')]?_0x2c7729[_0xbcce('0x47')]:_0x5b0323['model'];if(!_0x3653ec[_0xbcce('0x43')][_0xbcce('0x49')](_0xbcce('0x4a'))){_0x2c7729[_0xbcce('0x31')]=qs[_0xbcce('0x31')](_0x3653ec[_0xbcce('0x43')][_0xbcce('0x31')]);_0x2c7729[_0xbcce('0x2f')]=qs['offset'](_0x3653ec['query'][_0xbcce('0x2f')]);}_0x2c7729[_0xbcce('0x4b')]=qs[_0xbcce('0x4c')](_0x3653ec['query'][_0xbcce('0x4c')]);_0x2c7729[_0xbcce('0x4d')]=qs['filters'](_['pick'](_0x3653ec['query'],_0x5b0323[_0xbcce('0x44')]),_0x49d146);if(_0x3653ec['query'][_0xbcce('0x4e')]){_0x2c7729[_0xbcce('0x4d')]=_[_0xbcce('0x4f')](_0x2c7729[_0xbcce('0x4d')],{'$or':_[_0xbcce('0x3e')](_0x49d146,function(_0x13010b){if(_0x13010b['type']!==_0xbcce('0x50')){var _0x5007b4={};_0x5007b4[_0x13010b['name']]={'$like':'%'+_0x3653ec[_0xbcce('0x43')]['filter']+'%'};return _0x5007b4;}})});}_0x2c7729=_['merge']({},_0x2c7729,_0x3653ec[_0xbcce('0x51')]);var _0x13c2c2={'where':_0x2c7729['where']};return db[_0xbcce('0x52')][_0xbcce('0x32')](_0x13c2c2)[_0xbcce('0x38')](function(_0x1900ef){_0x2670f6[_0xbcce('0x32')]=_0x1900ef;if(_0x3653ec[_0xbcce('0x43')]['includeAll']){_0x2c7729[_0xbcce('0x53')]=[{'all':!![]}];}return db['FaxMessage'][_0xbcce('0x54')](_0x2c7729);})[_0xbcce('0x38')](function(_0x1ec223){_0x2670f6[_0xbcce('0x55')]=_0x1ec223;return _0x2670f6;})[_0xbcce('0x38')](respondWithFilteredResult(_0x5ccad3,_0x2c7729))[_0xbcce('0x2b')](handleError(_0x5ccad3,null));};exports[_0xbcce('0x56')]=function(_0x37bfc7,_0x2303f4){var _0x232522={'raw':!![],'where':{'id':_0x37bfc7['params']['id']}},_0x253169={};_0x253169[_0xbcce('0x42')]=_[_0xbcce('0x57')](db[_0xbcce('0x52')][_0xbcce('0x3f')]);_0x253169[_0xbcce('0x43')]=_[_0xbcce('0x57')](_0x37bfc7[_0xbcce('0x43')]);_0x253169[_0xbcce('0x44')]=_[_0xbcce('0x45')](_0x253169['model'],_0x253169[_0xbcce('0x43')]);_0x232522[_0xbcce('0x47')]=_[_0xbcce('0x45')](_0x253169['model'],qs[_0xbcce('0x46')](_0x37bfc7['query'][_0xbcce('0x46')]));_0x232522[_0xbcce('0x47')]=_0x232522[_0xbcce('0x47')][_0xbcce('0x48')]?_0x232522[_0xbcce('0x47')]:_0x253169[_0xbcce('0x42')];if(_0x37bfc7['query']['includeAll']){_0x232522[_0xbcce('0x53')]=[{'all':!![]}];}_0x232522=_[_0xbcce('0x4f')]({},_0x232522,_0x37bfc7[_0xbcce('0x51')]);return db[_0xbcce('0x52')]['find'](_0x232522)[_0xbcce('0x38')](handleEntityNotFound(_0x2303f4,null))['then'](respondWithResult(_0x2303f4,null))[_0xbcce('0x2b')](handleError(_0x2303f4,null));};exports[_0xbcce('0x58')]=function(_0x1dba14,_0x6e7ef9){if(_0x1dba14[_0xbcce('0x59')]['id']){delete _0x1dba14[_0xbcce('0x59')]['id'];}return db[_0xbcce('0x52')][_0xbcce('0x5a')]({'where':{'id':_0x1dba14[_0xbcce('0x5b')]['id']}})[_0xbcce('0x38')](handleEntityNotFound(_0x6e7ef9,null))['then'](saveUpdates(_0x1dba14[_0xbcce('0x59')],null))[_0xbcce('0x38')](respondWithResult(_0x6e7ef9,null))[_0xbcce('0x2b')](handleError(_0x6e7ef9,null));};exports[_0xbcce('0x39')]=function(_0xef5912,_0x4f3d35){return db[_0xbcce('0x52')][_0xbcce('0x5a')]({'where':{'id':_0xef5912[_0xbcce('0x5b')]['id']}})[_0xbcce('0x38')](handleEntityNotFound(_0x4f3d35,null))['then'](removeEntity(_0x4f3d35,null))['catch'](handleError(_0x4f3d35,null));};exports[_0xbcce('0x5c')]=function(_0x199384,_0x206fa4){return db[_0xbcce('0x52')][_0xbcce('0x5c')]()['then'](respondWithResult(_0x206fa4,null))[_0xbcce('0x2b')](handleError(_0x206fa4,null));};var interaction_log=require(_0xbcce('0x5d'))(_0xbcce('0x5e'));exports[_0xbcce('0x5f')]=function(_0x60c393,_0xd67640,_0x333a03){var _0x44d0dd={'agent':{},'channel':_0xbcce('0x60')};if(_0x60c393[_0xbcce('0x59')]['id']){delete _0x60c393[_0xbcce('0x59')]['id'];}_0x60c393['body'][_0xbcce('0x61')]=!![];_0x60c393['body'][_0xbcce('0x62')]=moment()['format'](_0xbcce('0x63'));_0x60c393['body'][_0xbcce('0x64')]=_0x60c393['body'][_0xbcce('0x64')]||_0x60c393[_0xbcce('0x65')]['id'];_0x44d0dd['agent']['id']=_0x60c393[_0xbcce('0x59')]['UserId'];return db[_0xbcce('0x52')][_0xbcce('0x5a')]({'where':{'id':_0x60c393[_0xbcce('0x5b')]['id'],'UserId':null}})[_0xbcce('0x38')](handleEntityNotFound(_0xd67640,null))['then'](saveUpdates(_0x60c393['body'],null))[_0xbcce('0x38')](function(_0x4e9c20){if(_0x4e9c20){_0x44d0dd[_0xbcce('0x29')]=_0x4e9c20[_0xbcce('0x66')]({'plain':!![]});return db[_0xbcce('0x67')]['find']({'where':{'id':_0x4e9c20[_0xbcce('0x68')]}});}return null;})['then'](handleEntityNotFound(_0xd67640,null))[_0xbcce('0x38')](function(_0x485327){if(_0x485327){return _0x485327['update']({'UserId':_0x60c393[_0xbcce('0x59')][_0xbcce('0x64')],'read1stAt':_[_0xbcce('0x69')](_0x485327[_0xbcce('0x6a')])?moment()[_0xbcce('0x6b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xbcce('0x38')](function(_0x18929a){if(_0x18929a){_0x44d0dd[_0xbcce('0x6c')]=_0x18929a['get']({'plain':!![]});interaction_log['info'](_0xbcce('0x6d'),_0x60c393[_0xbcce('0x65')]['id'],_0x60c393[_0xbcce('0x65')][_0xbcce('0x3b')],_0x60c393[_0xbcce('0x65')][_0xbcce('0x6e')],_0x44d0dd[_0xbcce('0x6c')]['id'],_0x60c393[_0xbcce('0x59')]?JSON[_0xbcce('0x27')](_0x60c393[_0xbcce('0x59')]):_0xbcce('0x6f'));return respondWithRpcPromise('AcceptMessage',_0xbcce('0x70'),_0x44d0dd);}return null;})['then'](function(_0x574b56){var _0x4423ba=_0xbcce('0x71')+_0x574b56['message'][_0xbcce('0x72')];return db[_0xbcce('0x73')][_0xbcce('0x43')](_0x4423ba,{'type':db[_0xbcce('0x74')]['QueryTypes'][_0xbcce('0x75')],'raw':!![]})[_0xbcce('0x38')](function(_0x2f864c){return _0x2f864c;});})[_0xbcce('0x38')](function(_0x5d2ef4){if(_0x5d2ef4){_0x44d0dd['message'][_0xbcce('0x76')]=_0x5d2ef4[0x0];if(!_0x60c393[_0xbcce('0x59')][_0xbcce('0x64')])return;return db[_0xbcce('0x77')]['find']({'where':{'id':_0x60c393[_0xbcce('0x59')]['UserId'],'role':'agent'},'attributes':['id',_0xbcce('0x3b'),_0xbcce('0x78'),_0xbcce('0x79'),_0xbcce('0x7a')],'raw':!![]});}return null;})['then'](function(_0x5c0768){if(!_0x5c0768)return null;_0x44d0dd[_0xbcce('0x29')][_0xbcce('0x7b')]=_0x5c0768;return _0x44d0dd;})[_0xbcce('0x38')](function(_0x53de1c){if(_0x53de1c){if(_0x60c393['body'][_0xbcce('0x7c')]){_0x44d0dd['message'][_0xbcce('0x7d')]=util[_0xbcce('0x6b')](_0xbcce('0x7e'),_0x60c393[_0xbcce('0x65')][_0xbcce('0x3b')]);_0x44d0dd[_0xbcce('0x29')][_0xbcce('0x7f')]=_0x44d0dd[_0xbcce('0x7f')];_0x44d0dd[_0xbcce('0x29')][_0xbcce('0x80')]=_0x44d0dd[_0xbcce('0x7f')];_0x44d0dd[_0xbcce('0x29')]['event']=_0xbcce('0x5f');return respondWithRpcPromise(_0xbcce('0x81'),_0xbcce('0x81'),{'event':_0xbcce('0x82'),'message':_0x44d0dd[_0xbcce('0x29')]},client9002)['then'](function(){return _0x44d0dd;});}return _0x44d0dd;}return null;})[_0xbcce('0x38')](respondWithResult(_0xd67640,null))[_0xbcce('0x2b')](handleError(_0xd67640,null));};var interaction_log=require(_0xbcce('0x5d'))(_0xbcce('0x5e'));exports[_0xbcce('0x36')]=function(_0x1d4f81,_0x2a780a,_0x5c47af){var _0x57239a={'agent':{},'channel':_0xbcce('0x60')};if(_0x1d4f81[_0xbcce('0x59')]['id']){delete _0x1d4f81[_0xbcce('0x59')]['id'];}_0x1d4f81[_0xbcce('0x59')]['UserId']=_0x1d4f81['body'][_0xbcce('0x64')]||_0x1d4f81['user']['id'];_0x57239a[_0xbcce('0x7b')]['id']=_0x1d4f81[_0xbcce('0x59')][_0xbcce('0x64')];return db[_0xbcce('0x52')]['find']({'where':{'id':_0x1d4f81[_0xbcce('0x5b')]['id'],'UserId':null}})[_0xbcce('0x38')](handleEntityNotFound(_0x2a780a,null))[_0xbcce('0x38')](function(_0x599a98){if(_0x599a98){_0x57239a[_0xbcce('0x29')]=_0x599a98[_0xbcce('0x66')]({'plain':!![]});return db[_0xbcce('0x67')][_0xbcce('0x5a')]({'where':{'id':_0x599a98[_0xbcce('0x68')]}});}return null;})[_0xbcce('0x38')](handleEntityNotFound(_0x2a780a,null))[_0xbcce('0x38')](function(_0xd96df9){if(_0xd96df9){_0x57239a[_0xbcce('0x6c')]=_0xd96df9[_0xbcce('0x66')]({'plain':!![]});interaction_log[_0xbcce('0x22')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1d4f81['user']['id'],_0x1d4f81[_0xbcce('0x65')][_0xbcce('0x3b')],_0x1d4f81[_0xbcce('0x65')][_0xbcce('0x6e')],_0x57239a['interaction']['id'],_0x1d4f81[_0xbcce('0x59')]?JSON[_0xbcce('0x27')](_0x1d4f81[_0xbcce('0x59')]):_0xbcce('0x6f'));return respondWithRpcPromise(_0xbcce('0x83'),_0xbcce('0x84'),_0x57239a);}return null;})['then'](function(_0x1efd69){var _0x4eb68a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1efd69[_0xbcce('0x29')][_0xbcce('0x72')];return db[_0xbcce('0x73')][_0xbcce('0x43')](_0x4eb68a,{'type':db[_0xbcce('0x74')]['QueryTypes'][_0xbcce('0x75')],'raw':!![]})[_0xbcce('0x38')](function(_0x5cf700){return _0x5cf700;});})['then'](function(_0x1b6dfc){if(_0x1b6dfc){_0x57239a['message'][_0xbcce('0x76')]=_0x1b6dfc[0x0];if(!_0x1d4f81[_0xbcce('0x59')][_0xbcce('0x64')])return;return db[_0xbcce('0x77')][_0xbcce('0x5a')]({'where':{'id':_0x1d4f81[_0xbcce('0x59')][_0xbcce('0x64')],'role':_0xbcce('0x7b')},'attributes':['id','name','fullname',_0xbcce('0x79'),_0xbcce('0x7a')],'raw':!![]});}return null;})[_0xbcce('0x38')](function(_0x1a99e3){if(!_0x1a99e3)return null;_0x57239a[_0xbcce('0x29')]['agent']=_0x1a99e3;return _0x57239a;})[_0xbcce('0x38')](function(_0x40942f){if(_0x40942f){_0x40942f[_0xbcce('0x29')][_0xbcce('0x7d')]=util[_0xbcce('0x6b')](_0xbcce('0x7e'),_0x1d4f81['user'][_0xbcce('0x3b')]);_0x40942f[_0xbcce('0x29')]['channel']=_0x57239a[_0xbcce('0x7f')];_0x40942f['message']['motionChannel']=_0x57239a[_0xbcce('0x7f')];_0x40942f[_0xbcce('0x29')][_0xbcce('0x85')]=_0xbcce('0x36');respondWithRpcPromise('EventManager','EventManager',{'event':_0xbcce('0x86'),'message':_0x40942f[_0xbcce('0x29')]},client9002);return _0x57239a;}return null;})[_0xbcce('0x38')](respondWithResult(_0x2a780a,null))[_0xbcce('0x2b')](handleError(_0x2a780a,null));};exports['create']=function(_0x1f6c2d,_0x1bffcc){var _0x1f74be;return db[_0xbcce('0x52')]['create'](_0x1f6c2d[_0xbcce('0x59')],{})[_0xbcce('0x38')](function(_0x21d8f4){_0x1f74be=_0x21d8f4;return db[_0xbcce('0x87')][_0xbcce('0x88')]({'where':{'id':_0x1f74be[_0xbcce('0x72')]}});})[_0xbcce('0x38')](function(_0x1c7840){if(_[_0xbcce('0x69')](_0x1c7840)){return;}else{_0x1f74be['fax']=_0x1c7840[_0xbcce('0x60')];return db[_0xbcce('0x89')][_0xbcce('0x88')]({'where':{'id':_0x1f74be[_0xbcce('0x8a')]}});}})[_0xbcce('0x38')](function(_0x265d17){return respondWithRpcPromise(_0xbcce('0x8b'),_0xbcce('0x8b'),{'FaxAccountId':_[_0xbcce('0x69')](_0x1f6c2d[_0xbcce('0x59')])?undefined:_0x1f6c2d[_0xbcce('0x59')][_0xbcce('0x8c')],'path':_['isNil'](_0x265d17)?undefined:util[_0xbcce('0x6b')]('/var/opt/motion2/server/files/attachments/%s',_0x265d17[_0xbcce('0x8d')]),'fax':_[_0xbcce('0x69')](_0x1f74be[_0xbcce('0x60')])?undefined:_0x1f74be[_0xbcce('0x60')],'AttachmentId':_0x1f74be['AttachmentId']},client9002);})[_0xbcce('0x38')](respondWithResult(_0x1bffcc,0xc9))['catch'](handleError(_0x1bffcc,null));};exports['download']=function(_0x88d6,_0x10ecef){var _0x4494a7=path['join'](config['root'],_0xbcce('0x8e'),_0xbcce('0x8f'),_0xbcce('0x90'));return db[_0xbcce('0x52')][_0xbcce('0x5a')]({'where':{'id':_0x88d6[_0xbcce('0x5b')]['id']},'include':[{'model':db[_0xbcce('0x89')],'as':_0xbcce('0x89')}]})[_0xbcce('0x38')](handleEntityNotFound(_0x10ecef,null))['then'](function(_0x31c4db){if(_0x31c4db){return _0x10ecef['download'](path['join'](_0x4494a7,_0x31c4db[_0xbcce('0x89')][_0xbcce('0x8d')]));}})[_0xbcce('0x2b')](handleError(_0x10ecef,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index bebde96..263e8a8 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 _0xdb7e=['hook','exports','events','../../mysqldb','FaxMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x45b29d,_0x44ce43){var _0x32d74=function(_0x559eff){while(--_0x559eff){_0x45b29d['push'](_0x45b29d['shift']());}};_0x32d74(++_0x44ce43);}(_0xdb7e,0x11a));var _0xedb7=function(_0x2ec3e1,_0x367c86){_0x2ec3e1=_0x2ec3e1-0x0;var _0x368238=_0xdb7e[_0x2ec3e1];return _0x368238;};'use strict';var EventEmitter=require(_0xedb7('0x0'));var FaxMessage=require(_0xedb7('0x1'))['db'][_0xedb7('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xedb7('0x3'),'afterUpdate':_0xedb7('0x4'),'afterDestroy':_0xedb7('0x5')};function emitEvent(_0x58fc55){return function(_0x16179a,_0x4130d2,_0x40f048){FaxMessageEvents[_0xedb7('0x6')](_0x58fc55+':'+_0x16179a['id'],_0x16179a);FaxMessageEvents[_0xedb7('0x6')](_0x58fc55,_0x16179a);_0x40f048(null);};}for(var e in events){if(events[_0xedb7('0x7')](e)){var event=events[e];FaxMessage[_0xedb7('0x8')](e,emitEvent(event));}}module[_0xedb7('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x1883=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save'];(function(_0x37d7b9,_0x43c686){var _0x489cc5=function(_0x5ca9b1){while(--_0x5ca9b1){_0x37d7b9['push'](_0x37d7b9['shift']());}};_0x489cc5(++_0x43c686);}(_0x1883,0xab));var _0x3188=function(_0x5736e8,_0x2f933f){_0x5736e8=_0x5736e8-0x0;var _0xd092d4=_0x1883[_0x5736e8];return _0xd092d4;};'use strict';var EventEmitter=require(_0x3188('0x0'));var FaxMessage=require(_0x3188('0x1'))['db'][_0x3188('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x3188('0x3')](0x0);var events={'afterCreate':_0x3188('0x4'),'afterUpdate':_0x3188('0x5'),'afterDestroy':_0x3188('0x6')};function emitEvent(_0x408500){return function(_0x1c7c86,_0x44afb8,_0x46216d){FaxMessageEvents[_0x3188('0x7')](_0x408500+':'+_0x1c7c86['id'],_0x1c7c86);FaxMessageEvents[_0x3188('0x7')](_0x408500,_0x1c7c86);_0x46216d(null);};}for(var e in events){if(events[_0x3188('0x8')](e)){var event=events[e];FaxMessage[_0x3188('0x9')](e,emitEvent(event));}}module[_0x3188('0xa')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 2a136a3..58fa58e 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 _0x7fe4=['error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','FaxMessage','body','FULLTEXT','models','toLowerCase','direction','isNil','UserId','findOne','FaxInteractionId','then','update','createdAt'];(function(_0x228932,_0x23509a){var _0x56929b=function(_0x4199e1){while(--_0x4199e1){_0x228932['push'](_0x228932['shift']());}};_0x56929b(++_0x23509a);}(_0x7fe4,0x107));var _0x47fe=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x7fe4[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0x47fe('0x0'));var util=require(_0x47fe('0x1'));var logger=require('../../config/logger')(_0x47fe('0x2'));var moment=require(_0x47fe('0x3'));var BPromise=require(_0x47fe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47fe('0x5'));var rimraf=require(_0x47fe('0x6'));var config=require(_0x47fe('0x7'));var attributes=require('./faxMessage.attributes');module[_0x47fe('0x8')]=function(_0x4d7473,_0x304cf4){return _0x4d7473[_0x47fe('0x9')](_0x47fe('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x47fe('0xb')],'type':_0x47fe('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x55d112,_0x4b08e1,_0x438764){var _0x4f675a=_0x4d7473[_0x47fe('0xd')];var _0x2fa00b=_0x55d112['get']({'plain':!![]});if(_0x2fa00b['direction'][_0x47fe('0xe')]()==='in'||_0x2fa00b[_0x47fe('0xf')]['toLowerCase']()==='out'&&!_0x2fa00b['secret']&&!_[_0x47fe('0x10')](_0x2fa00b[_0x47fe('0x11')])){_0x4f675a['FaxInteraction'][_0x47fe('0x12')]({'where':{'id':_0x2fa00b[_0x47fe('0x13')]}})[_0x47fe('0x14')](function(_0x3ed203){if(_0x3ed203){_0x3ed203[_0x47fe('0x15')]({'lastMsgAt':_0x2fa00b[_0x47fe('0x16')],'lastMsgDirection':_0x2fa00b[_0x47fe('0xf')][_0x47fe('0xe')]()});}})['catch'](function(_0xa57761){console[_0x47fe('0x17')](_0xa57761);});}_0x438764();}},'charset':_0x47fe('0x18'),'collate':_0x47fe('0x19')});}; \ No newline at end of file +var _0x52e7=['../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','FaxInteraction','FaxInteractionId','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x5e8e2d,_0x6a6104){var _0x583ced=function(_0x2cb8b2){while(--_0x2cb8b2){_0x5e8e2d['push'](_0x5e8e2d['shift']());}};_0x583ced(++_0x6a6104);}(_0x52e7,0x68));var _0x752e=function(_0x3441e9,_0x269c8a){_0x3441e9=_0x3441e9-0x0;var _0x7f9ada=_0x52e7[_0x3441e9];return _0x7f9ada;};'use strict';var _=require(_0x752e('0x0'));var util=require(_0x752e('0x1'));var logger=require(_0x752e('0x2'))(_0x752e('0x3'));var moment=require('moment');var BPromise=require(_0x752e('0x4'));var rp=require(_0x752e('0x5'));var fs=require('fs');var path=require(_0x752e('0x6'));var rimraf=require(_0x752e('0x7'));var config=require(_0x752e('0x8'));var attributes=require(_0x752e('0x9'));module[_0x752e('0xa')]=function(_0x562c98,_0x50b6c2){return _0x562c98[_0x752e('0xb')](_0x752e('0xc'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x752e('0xd')],'type':_0x752e('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x12105d,_0x54dbaa,_0x995a20){var _0x447175=_0x562c98[_0x752e('0xf')];var _0xe7d361=_0x12105d[_0x752e('0x10')]({'plain':!![]});if(_0xe7d361[_0x752e('0x11')]['toLowerCase']()==='in'||_0xe7d361['direction'][_0x752e('0x12')]()==='out'&&!_0xe7d361[_0x752e('0x13')]&&!_[_0x752e('0x14')](_0xe7d361['UserId'])){_0x447175[_0x752e('0x15')]['findOne']({'where':{'id':_0xe7d361[_0x752e('0x16')]}})['then'](function(_0x184480){if(_0x184480){_0x184480[_0x752e('0x17')]({'lastMsgAt':_0xe7d361[_0x752e('0x18')],'lastMsgDirection':_0xe7d361['direction'][_0x752e('0x12')]()});}})[_0x752e('0x19')](function(_0x3bb51d){console[_0x752e('0x1a')](_0x3bb51d);});}_0x995a20();}},'charset':_0x752e('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index e415501..29363e9 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 _0xb821=['register','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateFaxMessage','create','body','options','raw','stringify','UpdateFaxMessage','FaxMessage','update','where','attributes','limit','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket'];(function(_0x58a872,_0x50d43a){var _0x3e1577=function(_0x21c808){while(--_0x21c808){_0x58a872['push'](_0x58a872['shift']());}};_0x3e1577(++_0x50d43a);}(_0xb821,0xa7));var _0x1b82=function(_0xd199e9,_0x48405c){_0xd199e9=_0xd199e9-0x0;var _0x1f5271=_0xb821[_0xd199e9];return _0x1f5271;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});config[_0x1b82('0x8')]=_[_0x1b82('0x9')](config[_0x1b82('0x8')],{'host':_0x1b82('0xa'),'port':0x18eb});var socket=require(_0x1b82('0xb'))(new Redis(config[_0x1b82('0x8')]));require(_0x1b82('0xc'))[_0x1b82('0xd')](socket);function respondWithRpcPromise(_0x4955b5,_0x4011f2,_0x30c6ee){return new BPromise(function(_0x44dfd4,_0x14c57a){return client[_0x1b82('0xe')](_0x4955b5,_0x30c6ee)[_0x1b82('0xf')](function(_0x739f99){logger[_0x1b82('0x10')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x1b82('0x11'));logger[_0x1b82('0x12')](_0x1b82('0x13'),_0x4011f2,_0x1b82('0x11'),JSON['stringify'](_0x739f99));if(_0x739f99[_0x1b82('0x14')]){if(_0x739f99['error']['code']===0x1f4){logger[_0x1b82('0x14')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x739f99[_0x1b82('0x14')][_0x1b82('0x15')]);return _0x14c57a(_0x739f99['error'][_0x1b82('0x15')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x739f99[_0x1b82('0x14')]['message']);return _0x44dfd4(_0x739f99[_0x1b82('0x14')][_0x1b82('0x15')]);}else{logger[_0x1b82('0x10')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,'request\x20sent');_0x44dfd4(_0x739f99[_0x1b82('0x16')]['message']);}})[_0x1b82('0x17')](function(_0x1002a1){logger[_0x1b82('0x14')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x1002a1);_0x14c57a(_0x1002a1);});});}exports[_0x1b82('0x18')]=function(_0x2b6ee8){var _0x11af50=this;return new Promise(function(_0x46e5e2,_0x10d45c){return db['FaxMessage'][_0x1b82('0x19')](_0x2b6ee8[_0x1b82('0x1a')],{'raw':_0x2b6ee8[_0x1b82('0x1b')]?_0x2b6ee8[_0x1b82('0x1b')][_0x1b82('0x1c')]===undefined?!![]:![]:!![]})[_0x1b82('0xf')](function(_0x2d07f4){logger['info'](_0x1b82('0x18'),_0x2b6ee8);logger[_0x1b82('0x12')]('CreateFaxMessage',_0x2b6ee8,JSON[_0x1b82('0x1d')](_0x2d07f4));_0x46e5e2(_0x2d07f4);})[_0x1b82('0x17')](function(_0x1ad9d6){logger['error'](_0x1b82('0x18'),_0x1ad9d6['message'],_0x2b6ee8);_0x10d45c(_0x11af50['error'](0x1f4,_0x1ad9d6['message']));});});};exports[_0x1b82('0x1e')]=function(_0x149d0f){var _0xfd00d1=this;return new Promise(function(_0x257b79,_0x548a3b){return db[_0x1b82('0x1f')][_0x1b82('0x20')](_0x149d0f[_0x1b82('0x1a')],{'raw':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f[_0x1b82('0x1b')][_0x1b82('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f[_0x1b82('0x1b')][_0x1b82('0x21')]||null:null,'attributes':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f[_0x1b82('0x1b')][_0x1b82('0x22')]||null:null,'limit':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f['options'][_0x1b82('0x23')]||null:null})[_0x1b82('0xf')](function(_0x155a34){logger[_0x1b82('0x10')](_0x1b82('0x1e'),_0x149d0f);logger[_0x1b82('0x12')](_0x1b82('0x1e'),_0x149d0f,JSON[_0x1b82('0x1d')](_0x155a34));_0x257b79(_0x155a34);})[_0x1b82('0x17')](function(_0x362657){logger['error'](_0x1b82('0x1e'),_0x362657[_0x1b82('0x15')],_0x149d0f);_0x548a3b(_0xfd00d1[_0x1b82('0x14')](0x1f4,_0x362657[_0x1b82('0x15')]));});});}; \ No newline at end of file +var _0x5636=['error','code','message','result','CreateFaxMessage','FaxMessage','body','options','then','UpdateFaxMessage','update','where','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x40d79b,_0x22a83d){var _0x3ff7a7=function(_0x48e8ae){while(--_0x48e8ae){_0x40d79b['push'](_0x40d79b['shift']());}};_0x3ff7a7(++_0x22a83d);}(_0x5636,0x102));var _0x6563=function(_0x40f000,_0x5a1ca9){_0x40f000=_0x40f000-0x0;var _0x41096a=_0x5636[_0x40f000];return _0x41096a;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6563('0x2'));var db=require(_0x6563('0x3'))['db'];var utils=require(_0x6563('0x4'));var logger=require('../../config/logger')(_0x6563('0x5'));var config=require(_0x6563('0x6'));var jayson=require(_0x6563('0x7'));var client=jayson[_0x6563('0x8')][_0x6563('0x9')]({'port':0x232a});config[_0x6563('0xa')]=_[_0x6563('0xb')](config[_0x6563('0xa')],{'host':_0x6563('0xc'),'port':0x18eb});var socket=require(_0x6563('0xd'))(new Redis(config[_0x6563('0xa')]));require(_0x6563('0xe'))[_0x6563('0xf')](socket);function respondWithRpcPromise(_0x516d1a,_0x51fdc2,_0x2946f3){return new BPromise(function(_0x129fa3,_0x490a56){return client['request'](_0x516d1a,_0x2946f3)['then'](function(_0x1ef002){logger[_0x6563('0x10')](_0x6563('0x11'),_0x51fdc2,_0x6563('0x12'));logger[_0x6563('0x13')](_0x6563('0x14'),_0x51fdc2,_0x6563('0x12'),JSON[_0x6563('0x15')](_0x1ef002));if(_0x1ef002[_0x6563('0x16')]){if(_0x1ef002['error'][_0x6563('0x17')]===0x1f4){logger['error'](_0x6563('0x11'),_0x51fdc2,_0x1ef002[_0x6563('0x16')][_0x6563('0x18')]);return _0x490a56(_0x1ef002[_0x6563('0x16')]['message']);}logger[_0x6563('0x16')](_0x6563('0x11'),_0x51fdc2,_0x1ef002[_0x6563('0x16')][_0x6563('0x18')]);return _0x129fa3(_0x1ef002['error'][_0x6563('0x18')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x51fdc2,'request\x20sent');_0x129fa3(_0x1ef002[_0x6563('0x19')]['message']);}})['catch'](function(_0x27651b){logger[_0x6563('0x16')](_0x6563('0x11'),_0x51fdc2,_0x27651b);_0x490a56(_0x27651b);});});}exports[_0x6563('0x1a')]=function(_0xf8b544){var _0x10811d=this;return new Promise(function(_0x37ba3,_0x93a45){return db[_0x6563('0x1b')]['create'](_0xf8b544[_0x6563('0x1c')],{'raw':_0xf8b544[_0x6563('0x1d')]?_0xf8b544[_0x6563('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x6563('0x1e')](function(_0x5c37bb){logger[_0x6563('0x10')](_0x6563('0x1a'),_0xf8b544);logger['debug']('CreateFaxMessage',_0xf8b544,JSON[_0x6563('0x15')](_0x5c37bb));_0x37ba3(_0x5c37bb);})['catch'](function(_0x1097d0){logger[_0x6563('0x16')](_0x6563('0x1a'),_0x1097d0['message'],_0xf8b544);_0x93a45(_0x10811d[_0x6563('0x16')](0x1f4,_0x1097d0['message']));});});};exports[_0x6563('0x1f')]=function(_0x1590e6){var _0x5e5aeb=this;return new Promise(function(_0x365b16,_0x28252d){return db['FaxMessage'][_0x6563('0x20')](_0x1590e6['body'],{'raw':_0x1590e6[_0x6563('0x1d')]?_0x1590e6['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1590e6[_0x6563('0x1d')]?_0x1590e6[_0x6563('0x1d')][_0x6563('0x21')]||null:null,'attributes':_0x1590e6[_0x6563('0x1d')]?_0x1590e6[_0x6563('0x1d')]['attributes']||null:null,'limit':_0x1590e6[_0x6563('0x1d')]?_0x1590e6['options']['limit']||null:null})[_0x6563('0x1e')](function(_0x35af37){logger[_0x6563('0x10')](_0x6563('0x1f'),_0x1590e6);logger[_0x6563('0x13')](_0x6563('0x1f'),_0x1590e6,JSON[_0x6563('0x15')](_0x35af37));_0x365b16(_0x35af37);})[_0x6563('0x22')](function(_0x101b24){logger[_0x6563('0x16')]('UpdateFaxMessage',_0x101b24[_0x6563('0x18')],_0x1590e6);_0x28252d(_0x5e5aeb[_0x6563('0x16')](0x1f4,_0x101b24[_0x6563('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 7da1572..2bd5ab9 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 _0x6b67=['length','update','emit','register'];(function(_0x2a9197,_0x5225eb){var _0x588c8a=function(_0x4698ee){while(--_0x4698ee){_0x2a9197['push'](_0x2a9197['shift']());}};_0x588c8a(++_0x5225eb);}(_0x6b67,0xf9));var _0x76b6=function(_0x1b2422,_0x1e98d4){_0x1b2422=_0x1b2422-0x0;var _0x376573=_0x6b67[_0x1b2422];return _0x376573;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save','remove',_0x76b6('0x0')];function createListener(_0x107e38,_0x45b265){return function(_0x302eba){_0x45b265[_0x76b6('0x1')](_0x107e38,_0x302eba);};}function removeListener(_0x74f590,_0x10025b){return function(){FaxMessageEvents['removeListener'](_0x74f590,_0x10025b);};}exports[_0x76b6('0x2')]=function(_0x3e690c){for(var _0x33a6f2=0x0,_0x168db1=events[_0x76b6('0x3')];_0x33a6f2<_0x168db1;_0x33a6f2++){var _0x2930d8=events[_0x33a6f2];var _0x3545e8=createListener('faxMessage:'+_0x2930d8,_0x3e690c);FaxMessageEvents['on'](_0x2930d8,_0x3545e8);}}; \ No newline at end of file +var _0x256b=['register','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x40869e,_0x5d33c1){var _0x5edc75=function(_0xfe7825){while(--_0xfe7825){_0x40869e['push'](_0x40869e['shift']());}};_0x5edc75(++_0x5d33c1);}(_0x256b,0x122));var _0xb256=function(_0x186d11,_0x290d2e){_0x186d11=_0x186d11-0x0;var _0x3621dd=_0x256b[_0x186d11];return _0x3621dd;};'use strict';var FaxMessageEvents=require(_0xb256('0x0'));var events=[_0xb256('0x1'),_0xb256('0x2'),_0xb256('0x3')];function createListener(_0x315961,_0x23d1e8){return function(_0xf799c7){_0x23d1e8[_0xb256('0x4')](_0x315961,_0xf799c7);};}function removeListener(_0x45205f,_0x4c859b){return function(){FaxMessageEvents[_0xb256('0x5')](_0x45205f,_0x4c859b);};}exports[_0xb256('0x6')]=function(_0x51b70){for(var _0x57e541=0x0,_0x15659c=events['length'];_0x57e541<_0x15659c;_0x57e541++){var _0x3232ff=events[_0x57e541];var _0x4e1c52=createListener(_0xb256('0x7')+_0x3232ff,_0x51b70);FaxMessageEvents['on'](_0x3232ff,_0x4e1c52);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index b5a7641..6768f3b 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 _0x3f8c=['/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','get','isAuthenticated','index','/describe','/:id','show','/:id/download','post','tracked','fax','create','put'];(function(_0x412818,_0xe8171a){var _0x2d40d1=function(_0xa3099a){while(--_0xa3099a){_0x412818['push'](_0x412818['shift']());}};_0x2d40d1(++_0xe8171a);}(_0x3f8c,0x104));var _0xc3f8=function(_0x30c3d1,_0x2ebf84){_0x30c3d1=_0x30c3d1-0x0;var _0x25384f=_0x3f8c[_0x30c3d1];return _0x25384f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc3f8('0x0'));var timeout=require(_0xc3f8('0x1'));var express=require(_0xc3f8('0x2'));var router=express[_0xc3f8('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('./faxMessage.controller');router[_0xc3f8('0x4')]('/',auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x6')]);router[_0xc3f8('0x4')](_0xc3f8('0x7'),auth[_0xc3f8('0x5')](),controller['describe']);router[_0xc3f8('0x4')](_0xc3f8('0x8'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x9')]);router[_0xc3f8('0x4')](_0xc3f8('0xa'),auth[_0xc3f8('0x5')](),controller['download']);router[_0xc3f8('0xb')]('/',auth[_0xc3f8('0x5')](),interaction[_0xc3f8('0xc')](_0xc3f8('0xd'),'faxmessage:create'),controller[_0xc3f8('0xe')]);router[_0xc3f8('0xf')](_0xc3f8('0x8'),auth[_0xc3f8('0x5')](),controller['update']);router[_0xc3f8('0xf')](_0xc3f8('0x10'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x11')]);router[_0xc3f8('0xf')](_0xc3f8('0x12'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x13')]);router[_0xc3f8('0x14')](_0xc3f8('0x8'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x15')]);module[_0xc3f8('0x16')]=router; \ No newline at end of file +var _0x4ded=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','isAuthenticated','describe','download','fax','create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x234e74,_0x12f2f8){var _0x3f1ab4=function(_0x5c0e57){while(--_0x5c0e57){_0x234e74['push'](_0x234e74['shift']());}};_0x3f1ab4(++_0x12f2f8);}(_0x4ded,0x116));var _0xd4de=function(_0x4e5089,_0x38014e){_0x4e5089=_0x4e5089-0x0;var _0x1b3dad=_0x4ded[_0x4e5089];return _0x1b3dad;};'use strict';var multer=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var path=require(_0xd4de('0x2'));var timeout=require(_0xd4de('0x3'));var express=require(_0xd4de('0x4'));var router=express[_0xd4de('0x5')]();var fs_extra=require(_0xd4de('0x6'));var auth=require(_0xd4de('0x7'));var interaction=require(_0xd4de('0x8'));var config=require(_0xd4de('0x9'));var controller=require(_0xd4de('0xa'));router[_0xd4de('0xb')]('/',auth['isAuthenticated'](),controller[_0xd4de('0xc')]);router[_0xd4de('0xb')](_0xd4de('0xd'),auth[_0xd4de('0xe')](),controller[_0xd4de('0xf')]);router[_0xd4de('0xb')]('/:id',auth[_0xd4de('0xe')](),controller['show']);router['get']('/:id/download',auth[_0xd4de('0xe')](),controller[_0xd4de('0x10')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0xd4de('0x11'),'faxmessage:create'),controller[_0xd4de('0x12')]);router[_0xd4de('0x13')](_0xd4de('0x14'),auth[_0xd4de('0xe')](),controller[_0xd4de('0x15')]);router[_0xd4de('0x13')](_0xd4de('0x16'),auth[_0xd4de('0xe')](),controller[_0xd4de('0x17')]);router[_0xd4de('0x13')](_0xd4de('0x18'),auth[_0xd4de('0xe')](),controller[_0xd4de('0x19')]);router[_0xd4de('0x1a')](_0xd4de('0x14'),auth[_0xd4de('0xe')](),controller[_0xd4de('0x1b')]);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 015dbdb..7c96549 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 _0x3e4d=['STRING','ENUM','rrmemory','beepall','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e4d,0x16d));var _0xd3e4=function(_0x2eb3e0,_0x5f1c2d){_0x2eb3e0=_0x2eb3e0-0x0;var _0xbd221a=_0x3e4d[_0x2eb3e0];return _0xbd221a;};'use strict';var Sequelize=require(_0xd3e4('0x0'));module['exports']={'name':{'type':Sequelize[_0xd3e4('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd3e4('0x2')](_0xd3e4('0x3'),_0xd3e4('0x4'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xd3e4('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb072=['sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb072,0x1a7));var _0x2b07=function(_0x3b585e,_0x1f90f8){_0x3b585e=_0x3b585e-0x0;var _0x146036=_0xb072[_0x3b585e];return _0x146036;};'use strict';var Sequelize=require(_0x2b07('0x0'));module[_0x2b07('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2b07('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2b07('0x3')]},'timeout':{'type':Sequelize[_0x2b07('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2b07('0x5')](_0x2b07('0x6'),_0x2b07('0x7'),_0x2b07('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x2b07('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 a4df2bf..b51c66f 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 _0x539d=['clone','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','removeTeams','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','lodash','squel','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','then','destroy','get','UserProfileResource','end','error','stack','name','send','FaxQueue','fieldName','type','key','where','include','query','findAll','rows','catch','show','params','keys','rawAttributes','filters','intersection','model','attributes','merge','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','FaxQueues','find','autoAssociation','update','describe','getMembers','findOne','UserFaxQueue','fields','length','nolimit','order','sort','pick','FaxQueueId','filter','map','findAndCountAll','UserId','faxPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','hasOwnProperty','addTeams','Team','User','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','ids','select','join','user_has_teams','FaxQueueId\x20=\x20?'];(function(_0x1b9c3b,_0x43c1eb){var _0x56c260=function(_0x4d050c){while(--_0x4d050c){_0x1b9c3b['push'](_0x1b9c3b['shift']());}};_0x56c260(++_0x43c1eb);}(_0x539d,0x17b));var _0xd539=function(_0x5e9a69,_0x40c0ec){_0x5e9a69=_0x5e9a69-0x0;var _0x5979c8=_0x539d[_0x5e9a69];return _0x5979c8;};'use strict';var BPromise=require(_0xd539('0x0'));var util=require('util');var _=require(_0xd539('0x1'));var squel=require(_0xd539('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xd539('0x3'))(_0xd539('0x4'));var config=require(_0xd539('0x5'));var db=require(_0xd539('0x6'))['db'];config[_0xd539('0x7')]=_['defaults'](config[_0xd539('0x7')],{'host':_0xd539('0x8'),'port':0x18eb});var socket=require(_0xd539('0x9'))(new Redis(config[_0xd539('0x7')]));require(_0xd539('0xa'))[_0xd539('0xb')](socket);function respondWithStatusCode(_0x555080,_0x372cb9){_0x372cb9=_0x372cb9||0xcc;return function(_0x2015a5){if(_0x2015a5){return _0x555080[_0xd539('0xc')](_0x372cb9);}return _0x555080[_0xd539('0xd')](_0x372cb9)['end']();};}function respondWithResult(_0x586ce8,_0x3f0805){_0x3f0805=_0x3f0805||0xc8;return function(_0x36027a){if(_0x36027a){return _0x586ce8[_0xd539('0xd')](_0x3f0805)[_0xd539('0xe')](_0x36027a);}};}function respondWithFilteredResult(_0x424b1a,_0x3c59d1){return function(_0x2367f1){if(_0x2367f1){var _0x3860dc=typeof _0x3c59d1['offset']===_0xd539('0xf')&&typeof _0x3c59d1[_0xd539('0x10')]===_0xd539('0xf');var _0x4b3461=_0x2367f1[_0xd539('0x11')];var _0xac445e=_0x3860dc?0x0:_0x3c59d1['offset'];var _0x278f49=_0x3860dc?_0x2367f1[_0xd539('0x11')]:_0x3c59d1[_0xd539('0x12')]+_0x3c59d1[_0xd539('0x10')];var _0x23bce1;if(_0x278f49>=_0x4b3461){_0x278f49=_0x4b3461;_0x23bce1=0xc8;}else{_0x23bce1=0xce;}_0x424b1a[_0xd539('0xd')](_0x23bce1);return _0x424b1a[_0xd539('0x13')](_0xd539('0x14'),_0xac445e+'-'+_0x278f49+'/'+_0x4b3461)[_0xd539('0xe')](_0x2367f1);}return null;};}function saveUpdates(_0x17f7bf){return function(_0x460f3c){if(_0x460f3c){return _0x460f3c['update'](_0x17f7bf)[_0xd539('0x15')](function(_0x41fb1e){return _0x41fb1e;});}return null;};}function removeEntity(_0x6d6bbe){return function(_0x99327a){if(_0x99327a){return _0x99327a[_0xd539('0x16')]()[_0xd539('0x15')](function(){var _0x3debbf=_0x99327a[_0xd539('0x17')]({'plain':!![]});var _0x4cde7e='FaxQueues';return db[_0xd539('0x18')][_0xd539('0x16')]({'where':{'type':_0x4cde7e,'resourceId':_0x3debbf['id']}})[_0xd539('0x15')](function(){return _0x99327a;});})[_0xd539('0x15')](function(){_0x6d6bbe['status'](0xcc)[_0xd539('0x19')]();});}};}function handleEntityNotFound(_0x14abea){return function(_0x46076e){if(!_0x46076e){_0x14abea[_0xd539('0xc')](0x194);}return _0x46076e;};}function handleError(_0x11c993,_0x13445e){_0x13445e=_0x13445e||0x1f4;return function(_0x38985c){logger[_0xd539('0x1a')](_0x38985c[_0xd539('0x1b')]);if(_0x38985c['name']){delete _0x38985c[_0xd539('0x1c')];}_0x11c993[_0xd539('0xd')](_0x13445e)[_0xd539('0x1d')](_0x38985c);};}exports['index']=function(_0x564cf2,_0x3e3398){var _0xfd3352={};var _0x1280c2={'count':0x0,'rows':[]};var _0xc1789e=_['map'](db[_0xd539('0x1e')]['rawAttributes'],function(_0x1343de){return{'name':_0x1343de[_0xd539('0x1f')],'type':_0x1343de[_0xd539('0x20')][_0xd539('0x21')]};});_0xfd3352=qs['getOptions'](_0xc1789e,_0x564cf2);var _0x4c836d={'where':_0xfd3352[_0xd539('0x22')]};return db[_0xd539('0x1e')]['count'](_0x4c836d)['then'](function(_0x575b63){_0x1280c2[_0xd539('0x11')]=_0x575b63;_0xfd3352[_0xd539('0x23')]=qs[_0xd539('0x23')](_0x564cf2[_0xd539('0x24')]);return db['FaxQueue'][_0xd539('0x25')](_0xfd3352);})[_0xd539('0x15')](function(_0x516806){_0x1280c2[_0xd539('0x26')]=_0x516806;return _0x1280c2;})[_0xd539('0x15')](respondWithFilteredResult(_0x3e3398,_0xfd3352))[_0xd539('0x27')](handleError(_0x3e3398,null));};exports[_0xd539('0x28')]=function(_0x2f0121,_0x4808e6){var _0x2510eb={'raw':!![],'where':{'id':_0x2f0121[_0xd539('0x29')]['id']}},_0x4e10c0={};_0x4e10c0['model']=_[_0xd539('0x2a')](db['FaxQueue'][_0xd539('0x2b')]);_0x4e10c0[_0xd539('0x24')]=_[_0xd539('0x2a')](_0x2f0121[_0xd539('0x24')]);_0x4e10c0[_0xd539('0x2c')]=_[_0xd539('0x2d')](_0x4e10c0[_0xd539('0x2e')],_0x4e10c0[_0xd539('0x24')]);_0x2510eb[_0xd539('0x2f')]=_[_0xd539('0x2d')](_0x4e10c0[_0xd539('0x2e')],qs['fields'](_0x2f0121[_0xd539('0x24')]['fields']));_0x2510eb[_0xd539('0x2f')]=_0x2510eb[_0xd539('0x2f')]['length']?_0x2510eb[_0xd539('0x2f')]:_0x4e10c0[_0xd539('0x2e')];if(_0x2f0121['query']['includeAll']){_0x2510eb[_0xd539('0x23')]=[{'all':!![]}];}_0x2510eb=_[_0xd539('0x30')]({},_0x2510eb,_0x2f0121[_0xd539('0x31')]);return db[_0xd539('0x1e')]['find'](_0x2510eb)[_0xd539('0x15')](handleEntityNotFound(_0x4808e6,null))[_0xd539('0x15')](respondWithResult(_0x4808e6,null))[_0xd539('0x27')](handleError(_0x4808e6,null));};exports[_0xd539('0x32')]=function(_0x5172e3,_0x443832){return db[_0xd539('0x1e')][_0xd539('0x32')](_0x5172e3[_0xd539('0x33')],{})[_0xd539('0x15')](function(_0x3deb9b){var _0x4b5059=_0x5172e3['user'][_0xd539('0x17')]({'plain':!![]});if(!_0x4b5059)throw new Error(_0xd539('0x34'));if(_0x4b5059[_0xd539('0x35')]===_0xd539('0x36')){var _0x56a96c=_0x3deb9b[_0xd539('0x17')]({'plain':!![]});var _0x1c5106=_0xd539('0x37');return db['UserProfileSection'][_0xd539('0x38')]({'where':{'name':_0x1c5106,'userProfileId':_0x4b5059['userProfileId']},'raw':!![]})[_0xd539('0x15')](function(_0x4b44cf){if(_0x4b44cf&&_0x4b44cf[_0xd539('0x39')]===0x0){return db['UserProfileResource']['create']({'name':_0x56a96c[_0xd539('0x1c')],'resourceId':_0x56a96c['id'],'type':_0x4b44cf[_0xd539('0x1c')],'sectionId':_0x4b44cf['id']},{})[_0xd539('0x15')](function(){return _0x3deb9b;});}else{return _0x3deb9b;}})[_0xd539('0x27')](function(_0x1917c4){logger[_0xd539('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1917c4);throw _0x1917c4;});}return _0x3deb9b;})[_0xd539('0x15')](respondWithResult(_0x443832,0xc9))[_0xd539('0x27')](handleError(_0x443832,null));};exports[_0xd539('0x3a')]=function(_0x5d1d2c,_0x3e9320){if(_0x5d1d2c['body']['id']){delete _0x5d1d2c['body']['id'];}return db[_0xd539('0x1e')][_0xd539('0x38')]({'where':{'id':_0x5d1d2c[_0xd539('0x29')]['id']}})[_0xd539('0x15')](handleEntityNotFound(_0x3e9320,null))['then'](saveUpdates(_0x5d1d2c[_0xd539('0x33')],null))[_0xd539('0x15')](respondWithResult(_0x3e9320,null))[_0xd539('0x27')](handleError(_0x3e9320,null));};exports[_0xd539('0x16')]=function(_0x4e577c,_0x158e21){return db[_0xd539('0x1e')]['find']({'where':{'id':_0x4e577c[_0xd539('0x29')]['id']}})[_0xd539('0x15')](handleEntityNotFound(_0x158e21,null))[_0xd539('0x15')](removeEntity(_0x158e21,null))[_0xd539('0x27')](handleError(_0x158e21,null));};exports['describe']=function(_0x3f26e7,_0x433b1f){return db[_0xd539('0x1e')][_0xd539('0x3b')]()[_0xd539('0x15')](respondWithResult(_0x433b1f,null))[_0xd539('0x27')](handleError(_0x433b1f,null));};exports[_0xd539('0x3c')]=function(_0x25fb47,_0x2dc6b0){var _0x203e42={'raw':!![],'where':{}},_0x54d65a={},_0x14027c;return db[_0xd539('0x1e')][_0xd539('0x3d')]({'where':{'id':_0x25fb47[_0xd539('0x29')]['id']}})['then'](handleEntityNotFound(_0x2dc6b0,null))[_0xd539('0x15')](function(_0x1baf59){if(_0x1baf59){_0x14027c=_0x1baf59[_0xd539('0x17')]({'plain':!![]});_0x54d65a[_0xd539('0x2e')]=_[_0xd539('0x2a')](db[_0xd539('0x3e')][_0xd539('0x2b')]);_0x54d65a['query']=_[_0xd539('0x2a')](_0x25fb47[_0xd539('0x24')]);_0x54d65a[_0xd539('0x2c')]=_[_0xd539('0x2d')](_0x54d65a[_0xd539('0x2e')],_0x54d65a[_0xd539('0x24')]);_0x203e42['attributes']=_[_0xd539('0x2d')](_0x54d65a[_0xd539('0x2e')],qs['fields'](_0x25fb47['query'][_0xd539('0x3f')]));_0x203e42[_0xd539('0x2f')]=_0x203e42['attributes'][_0xd539('0x40')]?_0x203e42[_0xd539('0x2f')]:_0x54d65a[_0xd539('0x2e')];if(!_0x25fb47[_0xd539('0x24')]['hasOwnProperty'](_0xd539('0x41'))){_0x203e42[_0xd539('0x10')]=qs[_0xd539('0x10')](_0x25fb47[_0xd539('0x24')]['limit']);_0x203e42[_0xd539('0x12')]=qs[_0xd539('0x12')](_0x25fb47[_0xd539('0x24')]['offset']);}_0x203e42[_0xd539('0x42')]=qs[_0xd539('0x43')](_0x25fb47[_0xd539('0x24')][_0xd539('0x43')]);_0x203e42[_0xd539('0x22')]=qs[_0xd539('0x2c')](_[_0xd539('0x44')](_0x25fb47[_0xd539('0x24')],_0x54d65a[_0xd539('0x2c')]));_0x203e42[_0xd539('0x22')][_0xd539('0x45')]=_0x1baf59['id'];if(_0x25fb47[_0xd539('0x24')][_0xd539('0x46')]){_0x203e42[_0xd539('0x22')]=_[_0xd539('0x30')](_0x203e42['where'],{'$or':_[_0xd539('0x47')](_0x203e42[_0xd539('0x2f')],function(_0x4a9178){var _0x4a653f={};_0x4a653f[_0x4a9178]={'$like':'%'+_0x25fb47['query'][_0xd539('0x46')]+'%'};return _0x4a653f;})});}_0x203e42=_[_0xd539('0x30')]({},_0x203e42,_0x25fb47[_0xd539('0x31')]);return db[_0xd539('0x3e')]['findAll'](_0x203e42);}})[_0xd539('0x15')](function(_0x392d4a){if(_0x392d4a){return db['User'][_0xd539('0x48')]({'where':{'id':_[_0xd539('0x47')](_0x392d4a,_0xd539('0x49')),'role':'agent'},'attributes':['id',_0xd539('0x1c'),_0xd539('0x4a'),_0xd539('0x4b'),'createdAt']});}})[_0xd539('0x15')](function(_0x3becf4){if(_0x3becf4){return{'count':_0x3becf4[_0xd539('0x11')],'rows':_['map'](_0x3becf4[_0xd539('0x26')],function(_0x1b4c8e){return{'membername':_0x1b4c8e[_0xd539('0x1c')],'UserId':_0x1b4c8e['id'],'queue_name':_0x14027c[_0xd539('0x1c')],'FaxQueueId':_0x14027c['id'],'interface':util[_0xd539('0x4c')](_0xd539('0x4d'),_0xd539('0x4e'),_0x1b4c8e[_0xd539('0x1c')]),'penalty':0x0,'paused':_0x1b4c8e[_0xd539('0x4a')],'createdAt':_0x1b4c8e[_0xd539('0x4f')],'updatedAt':_0x1b4c8e[_0xd539('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd539('0x15')](respondWithFilteredResult(_0x2dc6b0,_0x203e42))['catch'](handleError(_0x2dc6b0,null));};exports[_0xd539('0x50')]=function(_0x1c1f46,_0x38e93b){var _0x535929={};var _0x2af7a3={};var _0x1831e7;var _0x4d006a;return db[_0xd539('0x1e')][_0xd539('0x3d')]({'where':{'id':_0x1c1f46[_0xd539('0x29')]['id']}})[_0xd539('0x15')](handleEntityNotFound(_0x38e93b,null))[_0xd539('0x15')](function(_0x1b46be){if(_0x1b46be){_0x1831e7=_0x1b46be;_0x2af7a3[_0xd539('0x2e')]=_[_0xd539('0x2a')](db['Team']['rawAttributes']);_0x2af7a3[_0xd539('0x24')]=_[_0xd539('0x2a')](_0x1c1f46[_0xd539('0x24')]);_0x2af7a3[_0xd539('0x2c')]=_[_0xd539('0x2d')](_0x2af7a3[_0xd539('0x2e')],_0x2af7a3[_0xd539('0x24')]);_0x535929['attributes']=_[_0xd539('0x2d')](_0x2af7a3[_0xd539('0x2e')],qs[_0xd539('0x3f')](_0x1c1f46[_0xd539('0x24')][_0xd539('0x3f')]));_0x535929['attributes']=_0x535929[_0xd539('0x2f')]['length']?_0x535929['attributes']:_0x2af7a3['model'];_0x535929[_0xd539('0x42')]=qs[_0xd539('0x43')](_0x1c1f46[_0xd539('0x24')][_0xd539('0x43')]);_0x535929[_0xd539('0x22')]=qs[_0xd539('0x2c')](_['pick'](_0x1c1f46['query'],_0x2af7a3[_0xd539('0x2c')]));if(_0x1c1f46['query']['filter']){_0x535929['where']=_[_0xd539('0x30')](_0x535929['where'],{'$or':_['map'](_0x535929[_0xd539('0x2f')],function(_0x1d79ce){var _0x20a721={};_0x20a721[_0x1d79ce]={'$like':'%'+_0x1c1f46['query'][_0xd539('0x46')]+'%'};return _0x20a721;})});}_0x535929=_[_0xd539('0x30')]({},_0x535929,_0x1c1f46[_0xd539('0x31')]);return _0x1831e7[_0xd539('0x50')](_0x535929);}})[_0xd539('0x15')](function(_0x5b82b7){if(_0x5b82b7){_0x4d006a=_0x5b82b7[_0xd539('0x40')];if(!_0x1c1f46[_0xd539('0x24')][_0xd539('0x51')](_0xd539('0x41'))){_0x535929[_0xd539('0x10')]=qs[_0xd539('0x10')](_0x1c1f46[_0xd539('0x24')][_0xd539('0x10')]);_0x535929[_0xd539('0x12')]=qs[_0xd539('0x12')](_0x1c1f46[_0xd539('0x24')][_0xd539('0x12')]);}return _0x1831e7[_0xd539('0x50')](_0x535929);}})[_0xd539('0x15')](function(_0x53584c){if(_0x53584c){return _0x53584c?{'count':_0x4d006a,'rows':_0x53584c}:null;}})[_0xd539('0x15')](respondWithResult(_0x38e93b,null))[_0xd539('0x27')](handleError(_0x38e93b,null));};exports[_0xd539('0x52')]=function(_0x32fcb9,_0x26c6b9){var _0x56f549=_0x32fcb9[_0xd539('0x33')]['ids'];return db[_0xd539('0x53')][_0xd539('0x25')]({'where':{'id':_0x56f549},'attributes':['id'],'include':[{'model':db[_0xd539('0x54')],'as':_0xd539('0x55'),'attributes':['id',_0xd539('0x1c'),_0xd539('0x56'),'voicePause',_0xd539('0x57')],'raw':!![]}]})[_0xd539('0x15')](function(_0x5a0c9a){if(_0x5a0c9a){var _0x4cfcfb=_[_0xd539('0x58')](_0x5a0c9a,function(_0x2e4b86){var _0x384439=_0x2e4b86[_0xd539('0x17')]({'plain':!![]});return _0x384439[_0xd539('0x55')];});return db['FaxQueue'][_0xd539('0x38')]({'where':{'id':_0x32fcb9['params']['id']}})[_0xd539('0x15')](function(_0x17865f){return db[_0xd539('0x59')][_0xd539('0x5a')](function(_0x3597b3){return _0x17865f['addTeams'](_0x56f549,{'transaction':_0x3597b3})[_0xd539('0x15')](function(){return BPromise[_0xd539('0x5b')](_0x4cfcfb,function(_0x14032b){return db[_0xd539('0x3e')][_0xd539('0x5c')]({'where':{'UserId':_0x14032b['id'],'FaxQueueId':_0x32fcb9[_0xd539('0x29')]['id']},'transaction':_0x3597b3});});})['then'](function(){_0x4cfcfb[_0xd539('0x5d')](function(_0x36b311){socket[_0xd539('0x5e')](_0xd539('0x5f'),{'UserId':_0x36b311['id'],'FaxQueueId':_0x17865f['id']});});});});});}})[_0xd539('0x15')](respondWithStatusCode(_0x26c6b9,null))[_0xd539('0x27')](handleError(_0x26c6b9,null));};exports['removeTeams']=function(_0x24dbe0,_0xeb8d7a){return db[_0xd539('0x53')]['findAll']({'where':{'id':_0x24dbe0['query'][_0xd539('0x60')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd539('0x55'),'attributes':['id'],'raw':!![]}]})[_0xd539('0x15')](handleEntityNotFound(_0xeb8d7a,null))['then'](function(_0x2c97d3){var _0x342a99=_[_0xd539('0x47')](_0x2c97d3,'id');var _0x32b06d=[];var _0x42e6bb=[];var _0xbaa486=squel[_0xd539('0x61')]();_0xbaa486['field']('tq.TeamId')['from']('team_has_fax_queues','tq')[_0xd539('0x62')](_0xd539('0x63'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xd539('0x64'),_0x24dbe0[_0xd539('0x29')]['id']);for(var _0x5966aa=0x0;_0x5966aa<_0x2c97d3[_0xd539('0x40')];_0x5966aa+=0x1){let _0x1dc82d=_0x2c97d3[_0x5966aa];for(var _0x16f229=0x0;_0x16f229<_0x1dc82d['Agents']['length'];_0x16f229+=0x1){let _0x31004c=_0x1dc82d[_0xd539('0x55')][_0x16f229];var _0x460325=_0xbaa486[_0xd539('0x65')]();_0x460325[_0xd539('0x22')]('ut.UserId\x20=\x20?',_0x31004c['id']);_0x42e6bb[_0xd539('0x66')](db[_0xd539('0x59')]['query'](_0x460325[_0xd539('0x67')](),{'type':db[_0xd539('0x59')][_0xd539('0x68')][_0xd539('0x69')]})[_0xd539('0x15')](function(_0x194ae9){if(_0x194ae9[_0xd539('0x40')]===0x1){return _0x31004c['id'];}else{var _0x411213=_['every'](_[_0xd539('0x47')](_0x194ae9,_0xd539('0x6a')),function(_0x1c8881){return _[_0xd539('0x6b')](_0x342a99,_0x1c8881);});if(_0x411213){return _0x31004c['id'];}}}));}}return BPromise[_0xd539('0x6c')](_0x42e6bb)[_0xd539('0x15')](function(_0x45a1b6){_0x32b06d=_(_0x32b06d)[_0xd539('0x6d')](_0x45a1b6)[_0xd539('0x6e')]()['value']();return db['FaxQueue'][_0xd539('0x38')]({'where':{'id':_0x24dbe0[_0xd539('0x29')]['id']}})[_0xd539('0x15')](function(_0x328a4c){return db[_0xd539('0x59')][_0xd539('0x5a')](function(_0x451bd3){return _0x328a4c[_0xd539('0x6f')](_0x24dbe0[_0xd539('0x24')][_0xd539('0x60')],{'transaction':_0x451bd3})[_0xd539('0x15')](function(){if(!_[_0xd539('0x70')](_0x32b06d)){return _0x328a4c['removeAgents'](_0x32b06d,{'transaction':_0x451bd3});}})['then'](function(){_0x32b06d[_0xd539('0x5d')](function(_0x62baac){socket[_0xd539('0x5e')](_0xd539('0x71'),{'UserId':_0x62baac,'FaxQueueId':_0x328a4c['id']});});});});});});})[_0xd539('0x15')](respondWithStatusCode(_0xeb8d7a,null))[_0xd539('0x27')](handleError(_0xeb8d7a,null));};exports['addAgents']=function(_0x3a530d,_0x1054dd){return db[_0xd539('0x1e')][_0xd539('0x38')]({'where':{'id':_0x3a530d[_0xd539('0x29')]['id']}})[_0xd539('0x15')](handleEntityNotFound(_0x1054dd,null))[_0xd539('0x15')](function(_0x404d28){if(_0x404d28){return _0x404d28[_0xd539('0x72')](_0x3a530d['body'][_0xd539('0x60')],_[_0xd539('0x73')](_0x3a530d[_0xd539('0x33')],[_0xd539('0x60'),'id'])||{})[_0xd539('0x74')](function(_0x4a5819){for(var _0x39c881=0x0;_0x39c881<_0x3a530d[_0xd539('0x33')][_0xd539('0x60')][_0xd539('0x40')];_0x39c881+=0x1){socket[_0xd539('0x5e')](_0xd539('0x5f'),{'UserId':Number(_0x3a530d[_0xd539('0x33')][_0xd539('0x60')][_0x39c881]),'FaxQueueId':Number(_0x3a530d[_0xd539('0x29')]['id'])});}return _0x4a5819;});}})[_0xd539('0x15')](respondWithResult(_0x1054dd,null))['catch'](handleError(_0x1054dd,null));};exports['removeAgents']=function(_0x4365d9,_0x50972a){return db[_0xd539('0x1e')][_0xd539('0x38')]({'where':{'id':_0x4365d9[_0xd539('0x29')]['id']}})['then'](handleEntityNotFound(_0x50972a,null))[_0xd539('0x15')](function(_0x574c1a){if(_0x574c1a){return _0x574c1a[_0xd539('0x75')](_0x4365d9['query'][_0xd539('0x60')])['then'](function(){if(_[_0xd539('0x76')](_0x4365d9[_0xd539('0x24')][_0xd539('0x60')])){for(var _0x252f83=0x0;_0x252f83<_0x4365d9[_0xd539('0x24')][_0xd539('0x60')][_0xd539('0x40')];_0x252f83+=0x1){socket['emit'](_0xd539('0x71'),{'UserId':Number(_0x4365d9['query'][_0xd539('0x60')][_0x252f83]),'FaxQueueId':Number(_0x4365d9['params']['id'])});}}else{socket[_0xd539('0x5e')](_0xd539('0x71'),{'UserId':Number(_0x4365d9[_0xd539('0x24')]['ids']),'FaxQueueId':Number(_0x4365d9[_0xd539('0x29')]['id'])});}});}})['then'](respondWithStatusCode(_0x50972a,null))[_0xd539('0x27')](handleError(_0x50972a,null));};exports[_0xd539('0x77')]=function(_0x5d83d9,_0x29faa1){var _0x4bb8ee={};var _0x27c569={};var _0x1f820d;var _0x34724d;return db[_0xd539('0x1e')][_0xd539('0x3d')]({'where':{'id':_0x5d83d9[_0xd539('0x29')]['id']}})[_0xd539('0x15')](handleEntityNotFound(_0x29faa1,null))['then'](function(_0x2e1d53){if(_0x2e1d53){_0x1f820d=_0x2e1d53;_0x27c569[_0xd539('0x2e')]=_['keys'](db[_0xd539('0x54')][_0xd539('0x2b')]);_0x27c569[_0xd539('0x24')]=_['keys'](_0x5d83d9[_0xd539('0x24')]);_0x27c569[_0xd539('0x2c')]=_[_0xd539('0x2d')](_0x27c569[_0xd539('0x2e')],_0x27c569[_0xd539('0x24')]);_0x4bb8ee['attributes']=_[_0xd539('0x2d')](_0x27c569[_0xd539('0x2e')],qs['fields'](_0x5d83d9[_0xd539('0x24')]['fields']));_0x4bb8ee[_0xd539('0x2f')]=_0x4bb8ee[_0xd539('0x2f')][_0xd539('0x40')]?_0x4bb8ee[_0xd539('0x2f')]:_0x27c569[_0xd539('0x2e')];_0x4bb8ee[_0xd539('0x42')]=qs[_0xd539('0x43')](_0x5d83d9[_0xd539('0x24')][_0xd539('0x43')]);_0x4bb8ee[_0xd539('0x22')]=qs[_0xd539('0x2c')](_[_0xd539('0x44')](_0x5d83d9[_0xd539('0x24')],_0x27c569[_0xd539('0x2c')]));if(_0x5d83d9[_0xd539('0x24')]['filter']){_0x4bb8ee[_0xd539('0x22')]=_['merge'](_0x4bb8ee[_0xd539('0x22')],{'$or':_[_0xd539('0x47')](_0x4bb8ee[_0xd539('0x2f')],function(_0x1e93f3){var _0x34f316={};_0x34f316[_0x1e93f3]={'$like':'%'+_0x5d83d9[_0xd539('0x24')]['filter']+'%'};return _0x34f316;})});}_0x4bb8ee=_[_0xd539('0x30')]({},_0x4bb8ee,_0x5d83d9[_0xd539('0x31')]);return _0x1f820d[_0xd539('0x77')](_0x4bb8ee);}})[_0xd539('0x15')](function(_0x2dfe87){if(_0x2dfe87){_0x34724d=_0x2dfe87[_0xd539('0x40')];if(!_0x5d83d9[_0xd539('0x24')]['hasOwnProperty']('nolimit')){_0x4bb8ee[_0xd539('0x10')]=qs[_0xd539('0x10')](_0x5d83d9['query'][_0xd539('0x10')]);_0x4bb8ee['offset']=qs[_0xd539('0x12')](_0x5d83d9[_0xd539('0x24')][_0xd539('0x12')]);}return _0x1f820d[_0xd539('0x77')](_0x4bb8ee);}})[_0xd539('0x15')](function(_0x371b4e){if(_0x371b4e){return _0x371b4e?{'count':_0x34724d,'rows':_0x371b4e}:null;}})[_0xd539('0x15')](respondWithResult(_0x29faa1,null))[_0xd539('0x27')](handleError(_0x29faa1,null));}; \ No newline at end of file +var _0x6931=['find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','update','body','describe','getMembers','findOne','UserFaxQueue','fields','sort','pick','FaxQueueId','filter','findAll','User','format','%s/%s','faxPause','createdAt','updatedAt','order','options','getTeams','hasOwnProperty','nolimit','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','findOrCreate','forEach','emit','removeTeams','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','union','compact','value','removeAgents','omit','spread','userFaxQueue:save','isArray','userFaxQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','destroy','then','FaxQueues','UserProfileResource','error','stack','name','send','index','map','FaxQueue','rawAttributes','type','getOptions','where','count','include','rows','show','params','model','query','keys','filters','intersection','attributes','length','includeAll','merge'];(function(_0x58735e,_0x3e4c5a){var _0x3559ad=function(_0x32e9b2){while(--_0x32e9b2){_0x58735e['push'](_0x58735e['shift']());}};_0x3559ad(++_0x3e4c5a);}(_0x6931,0x1a9));var _0x1693=function(_0x1692d3,_0x28d38a){_0x1692d3=_0x1692d3-0x0;var _0x5d6489=_0x6931[_0x1692d3];return _0x5d6489;};'use strict';var BPromise=require(_0x1693('0x0'));var util=require(_0x1693('0x1'));var _=require(_0x1693('0x2'));var squel=require(_0x1693('0x3'));var Redis=require(_0x1693('0x4'));var qs=require(_0x1693('0x5'));var logger=require(_0x1693('0x6'))(_0x1693('0x7'));var config=require('../../config/environment');var db=require(_0x1693('0x8'))['db'];config[_0x1693('0x9')]=_[_0x1693('0xa')](config[_0x1693('0x9')],{'host':_0x1693('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1693('0x9')]));require(_0x1693('0xc'))[_0x1693('0xd')](socket);function respondWithStatusCode(_0x579434,_0xc66466){_0xc66466=_0xc66466||0xcc;return function(_0x2dfab9){if(_0x2dfab9){return _0x579434[_0x1693('0xe')](_0xc66466);}return _0x579434[_0x1693('0xf')](_0xc66466)[_0x1693('0x10')]();};}function respondWithResult(_0x181184,_0x26ba4b){_0x26ba4b=_0x26ba4b||0xc8;return function(_0x3807dd){if(_0x3807dd){return _0x181184[_0x1693('0xf')](_0x26ba4b)[_0x1693('0x11')](_0x3807dd);}};}function respondWithFilteredResult(_0x1ba755,_0x57e6bd){return function(_0x24f22f){if(_0x24f22f){var _0x83c817=typeof _0x57e6bd[_0x1693('0x12')]===_0x1693('0x13')&&typeof _0x57e6bd[_0x1693('0x14')]===_0x1693('0x13');var _0x4744ed=_0x24f22f['count'];var _0x31caad=_0x83c817?0x0:_0x57e6bd['offset'];var _0x367f9d=_0x83c817?_0x24f22f['count']:_0x57e6bd[_0x1693('0x12')]+_0x57e6bd[_0x1693('0x14')];var _0x4db220;if(_0x367f9d>=_0x4744ed){_0x367f9d=_0x4744ed;_0x4db220=0xc8;}else{_0x4db220=0xce;}_0x1ba755['status'](_0x4db220);return _0x1ba755[_0x1693('0x15')]('Content-Range',_0x31caad+'-'+_0x367f9d+'/'+_0x4744ed)['json'](_0x24f22f);}return null;};}function saveUpdates(_0x54724d){return function(_0x1eb3ef){if(_0x1eb3ef){return _0x1eb3ef['update'](_0x54724d)['then'](function(_0x2a3bc2){return _0x2a3bc2;});}return null;};}function removeEntity(_0x1a270b){return function(_0x7ef2){if(_0x7ef2){return _0x7ef2[_0x1693('0x16')]()[_0x1693('0x17')](function(){var _0x7a19ae=_0x7ef2['get']({'plain':!![]});var _0x5c4159=_0x1693('0x18');return db[_0x1693('0x19')]['destroy']({'where':{'type':_0x5c4159,'resourceId':_0x7a19ae['id']}})[_0x1693('0x17')](function(){return _0x7ef2;});})[_0x1693('0x17')](function(){_0x1a270b[_0x1693('0xf')](0xcc)[_0x1693('0x10')]();});}};}function handleEntityNotFound(_0x2e0ada){return function(_0x4f0f17){if(!_0x4f0f17){_0x2e0ada[_0x1693('0xe')](0x194);}return _0x4f0f17;};}function handleError(_0x433db6,_0xbe9928){_0xbe9928=_0xbe9928||0x1f4;return function(_0x120dee){logger[_0x1693('0x1a')](_0x120dee[_0x1693('0x1b')]);if(_0x120dee['name']){delete _0x120dee[_0x1693('0x1c')];}_0x433db6['status'](_0xbe9928)[_0x1693('0x1d')](_0x120dee);};}exports[_0x1693('0x1e')]=function(_0x31ef48,_0x56bc00){var _0x108ba9={};var _0x341a72={'count':0x0,'rows':[]};var _0x43cfb6=_[_0x1693('0x1f')](db[_0x1693('0x20')][_0x1693('0x21')],function(_0x404bf1){return{'name':_0x404bf1['fieldName'],'type':_0x404bf1[_0x1693('0x22')]['key']};});_0x108ba9=qs[_0x1693('0x23')](_0x43cfb6,_0x31ef48);var _0x553794={'where':_0x108ba9[_0x1693('0x24')]};return db[_0x1693('0x20')][_0x1693('0x25')](_0x553794)[_0x1693('0x17')](function(_0x5888d7){_0x341a72[_0x1693('0x25')]=_0x5888d7;_0x108ba9[_0x1693('0x26')]=qs['include'](_0x31ef48['query']);return db[_0x1693('0x20')]['findAll'](_0x108ba9);})['then'](function(_0x5ce409){_0x341a72[_0x1693('0x27')]=_0x5ce409;return _0x341a72;})[_0x1693('0x17')](respondWithFilteredResult(_0x56bc00,_0x108ba9))['catch'](handleError(_0x56bc00,null));};exports[_0x1693('0x28')]=function(_0x514115,_0x41dc12){var _0x4ec5d4={'raw':!![],'where':{'id':_0x514115[_0x1693('0x29')]['id']}},_0x11889d={};_0x11889d[_0x1693('0x2a')]=_['keys'](db[_0x1693('0x20')][_0x1693('0x21')]);_0x11889d[_0x1693('0x2b')]=_[_0x1693('0x2c')](_0x514115[_0x1693('0x2b')]);_0x11889d[_0x1693('0x2d')]=_[_0x1693('0x2e')](_0x11889d[_0x1693('0x2a')],_0x11889d[_0x1693('0x2b')]);_0x4ec5d4[_0x1693('0x2f')]=_[_0x1693('0x2e')](_0x11889d[_0x1693('0x2a')],qs['fields'](_0x514115[_0x1693('0x2b')]['fields']));_0x4ec5d4[_0x1693('0x2f')]=_0x4ec5d4[_0x1693('0x2f')][_0x1693('0x30')]?_0x4ec5d4[_0x1693('0x2f')]:_0x11889d[_0x1693('0x2a')];if(_0x514115[_0x1693('0x2b')][_0x1693('0x31')]){_0x4ec5d4[_0x1693('0x26')]=[{'all':!![]}];}_0x4ec5d4=_[_0x1693('0x32')]({},_0x4ec5d4,_0x514115['options']);return db[_0x1693('0x20')][_0x1693('0x33')](_0x4ec5d4)[_0x1693('0x17')](handleEntityNotFound(_0x41dc12,null))[_0x1693('0x17')](respondWithResult(_0x41dc12,null))[_0x1693('0x34')](handleError(_0x41dc12,null));};exports[_0x1693('0x35')]=function(_0x3a49cf,_0x1caa91){return db[_0x1693('0x20')][_0x1693('0x35')](_0x3a49cf['body'],{})['then'](function(_0x47bd30){var _0x3ccf09=_0x3a49cf[_0x1693('0x36')][_0x1693('0x37')]({'plain':!![]});if(!_0x3ccf09)throw new Error(_0x1693('0x38'));if(_0x3ccf09[_0x1693('0x39')]===_0x1693('0x36')){var _0x1beda2=_0x47bd30[_0x1693('0x37')]({'plain':!![]});var _0x1502a1=_0x1693('0x18');return db[_0x1693('0x3a')][_0x1693('0x33')]({'where':{'name':_0x1502a1,'userProfileId':_0x3ccf09['userProfileId']},'raw':!![]})[_0x1693('0x17')](function(_0xd2929d){if(_0xd2929d&&_0xd2929d[_0x1693('0x3b')]===0x0){return db[_0x1693('0x19')][_0x1693('0x35')]({'name':_0x1beda2[_0x1693('0x1c')],'resourceId':_0x1beda2['id'],'type':_0xd2929d['name'],'sectionId':_0xd2929d['id']},{})[_0x1693('0x17')](function(){return _0x47bd30;});}else{return _0x47bd30;}})['catch'](function(_0x5c2505){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c2505);throw _0x5c2505;});}return _0x47bd30;})['then'](respondWithResult(_0x1caa91,0xc9))[_0x1693('0x34')](handleError(_0x1caa91,null));};exports[_0x1693('0x3c')]=function(_0x3996aa,_0x5cd283){if(_0x3996aa['body']['id']){delete _0x3996aa['body']['id'];}return db[_0x1693('0x20')][_0x1693('0x33')]({'where':{'id':_0x3996aa[_0x1693('0x29')]['id']}})['then'](handleEntityNotFound(_0x5cd283,null))[_0x1693('0x17')](saveUpdates(_0x3996aa[_0x1693('0x3d')],null))['then'](respondWithResult(_0x5cd283,null))[_0x1693('0x34')](handleError(_0x5cd283,null));};exports['destroy']=function(_0x3809e5,_0x26092a){return db[_0x1693('0x20')]['find']({'where':{'id':_0x3809e5[_0x1693('0x29')]['id']}})['then'](handleEntityNotFound(_0x26092a,null))[_0x1693('0x17')](removeEntity(_0x26092a,null))[_0x1693('0x34')](handleError(_0x26092a,null));};exports[_0x1693('0x3e')]=function(_0x255169,_0x357d62){return db['FaxQueue']['describe']()['then'](respondWithResult(_0x357d62,null))[_0x1693('0x34')](handleError(_0x357d62,null));};exports[_0x1693('0x3f')]=function(_0x2e865c,_0x102f31){var _0x250d80={'raw':!![],'where':{}},_0x4be5c5={},_0x2f8285;return db[_0x1693('0x20')][_0x1693('0x40')]({'where':{'id':_0x2e865c[_0x1693('0x29')]['id']}})[_0x1693('0x17')](handleEntityNotFound(_0x102f31,null))['then'](function(_0x4f41ba){if(_0x4f41ba){_0x2f8285=_0x4f41ba[_0x1693('0x37')]({'plain':!![]});_0x4be5c5[_0x1693('0x2a')]=_[_0x1693('0x2c')](db[_0x1693('0x41')][_0x1693('0x21')]);_0x4be5c5['query']=_['keys'](_0x2e865c[_0x1693('0x2b')]);_0x4be5c5[_0x1693('0x2d')]=_['intersection'](_0x4be5c5[_0x1693('0x2a')],_0x4be5c5[_0x1693('0x2b')]);_0x250d80['attributes']=_[_0x1693('0x2e')](_0x4be5c5[_0x1693('0x2a')],qs[_0x1693('0x42')](_0x2e865c[_0x1693('0x2b')][_0x1693('0x42')]));_0x250d80['attributes']=_0x250d80[_0x1693('0x2f')]['length']?_0x250d80['attributes']:_0x4be5c5['model'];if(!_0x2e865c[_0x1693('0x2b')]['hasOwnProperty']('nolimit')){_0x250d80[_0x1693('0x14')]=qs[_0x1693('0x14')](_0x2e865c[_0x1693('0x2b')][_0x1693('0x14')]);_0x250d80[_0x1693('0x12')]=qs[_0x1693('0x12')](_0x2e865c[_0x1693('0x2b')]['offset']);}_0x250d80['order']=qs['sort'](_0x2e865c[_0x1693('0x2b')][_0x1693('0x43')]);_0x250d80[_0x1693('0x24')]=qs['filters'](_[_0x1693('0x44')](_0x2e865c[_0x1693('0x2b')],_0x4be5c5['filters']));_0x250d80[_0x1693('0x24')][_0x1693('0x45')]=_0x4f41ba['id'];if(_0x2e865c[_0x1693('0x2b')]['filter']){_0x250d80[_0x1693('0x24')]=_[_0x1693('0x32')](_0x250d80[_0x1693('0x24')],{'$or':_[_0x1693('0x1f')](_0x250d80[_0x1693('0x2f')],function(_0x38958f){var _0x39c68d={};_0x39c68d[_0x38958f]={'$like':'%'+_0x2e865c[_0x1693('0x2b')][_0x1693('0x46')]+'%'};return _0x39c68d;})});}_0x250d80=_[_0x1693('0x32')]({},_0x250d80,_0x2e865c['options']);return db[_0x1693('0x41')][_0x1693('0x47')](_0x250d80);}})[_0x1693('0x17')](function(_0x3217f0){if(_0x3217f0){return db[_0x1693('0x48')]['findAndCountAll']({'where':{'id':_[_0x1693('0x1f')](_0x3217f0,'UserId'),'role':'agent'},'attributes':['id',_0x1693('0x1c'),'faxPause','updatedAt','createdAt']});}})[_0x1693('0x17')](function(_0x986f14){if(_0x986f14){return{'count':_0x986f14[_0x1693('0x25')],'rows':_['map'](_0x986f14[_0x1693('0x27')],function(_0x34c6c0){return{'membername':_0x34c6c0[_0x1693('0x1c')],'UserId':_0x34c6c0['id'],'queue_name':_0x2f8285[_0x1693('0x1c')],'FaxQueueId':_0x2f8285['id'],'interface':util[_0x1693('0x49')](_0x1693('0x4a'),'SIP',_0x34c6c0[_0x1693('0x1c')]),'penalty':0x0,'paused':_0x34c6c0[_0x1693('0x4b')],'createdAt':_0x34c6c0[_0x1693('0x4c')],'updatedAt':_0x34c6c0[_0x1693('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1693('0x17')](respondWithFilteredResult(_0x102f31,_0x250d80))['catch'](handleError(_0x102f31,null));};exports['getTeams']=function(_0x52e4c2,_0x5c7121){var _0x10a19c={};var _0x44ea02={};var _0x4f5659;var _0x2d714f;return db[_0x1693('0x20')][_0x1693('0x40')]({'where':{'id':_0x52e4c2[_0x1693('0x29')]['id']}})[_0x1693('0x17')](handleEntityNotFound(_0x5c7121,null))[_0x1693('0x17')](function(_0x4c224a){if(_0x4c224a){_0x4f5659=_0x4c224a;_0x44ea02[_0x1693('0x2a')]=_['keys'](db['Team'][_0x1693('0x21')]);_0x44ea02[_0x1693('0x2b')]=_[_0x1693('0x2c')](_0x52e4c2[_0x1693('0x2b')]);_0x44ea02[_0x1693('0x2d')]=_['intersection'](_0x44ea02[_0x1693('0x2a')],_0x44ea02[_0x1693('0x2b')]);_0x10a19c[_0x1693('0x2f')]=_[_0x1693('0x2e')](_0x44ea02[_0x1693('0x2a')],qs['fields'](_0x52e4c2[_0x1693('0x2b')][_0x1693('0x42')]));_0x10a19c[_0x1693('0x2f')]=_0x10a19c[_0x1693('0x2f')]['length']?_0x10a19c[_0x1693('0x2f')]:_0x44ea02[_0x1693('0x2a')];_0x10a19c[_0x1693('0x4e')]=qs[_0x1693('0x43')](_0x52e4c2[_0x1693('0x2b')][_0x1693('0x43')]);_0x10a19c['where']=qs['filters'](_['pick'](_0x52e4c2[_0x1693('0x2b')],_0x44ea02[_0x1693('0x2d')]));if(_0x52e4c2['query'][_0x1693('0x46')]){_0x10a19c[_0x1693('0x24')]=_['merge'](_0x10a19c[_0x1693('0x24')],{'$or':_['map'](_0x10a19c[_0x1693('0x2f')],function(_0x41a82f){var _0x4751a5={};_0x4751a5[_0x41a82f]={'$like':'%'+_0x52e4c2[_0x1693('0x2b')][_0x1693('0x46')]+'%'};return _0x4751a5;})});}_0x10a19c=_[_0x1693('0x32')]({},_0x10a19c,_0x52e4c2[_0x1693('0x4f')]);return _0x4f5659[_0x1693('0x50')](_0x10a19c);}})[_0x1693('0x17')](function(_0x584a14){if(_0x584a14){_0x2d714f=_0x584a14[_0x1693('0x30')];if(!_0x52e4c2['query'][_0x1693('0x51')](_0x1693('0x52'))){_0x10a19c[_0x1693('0x14')]=qs[_0x1693('0x14')](_0x52e4c2['query'][_0x1693('0x14')]);_0x10a19c['offset']=qs[_0x1693('0x12')](_0x52e4c2[_0x1693('0x2b')][_0x1693('0x12')]);}return _0x4f5659['getTeams'](_0x10a19c);}})['then'](function(_0x2dbd5f){if(_0x2dbd5f){return _0x2dbd5f?{'count':_0x2d714f,'rows':_0x2dbd5f}:null;}})[_0x1693('0x17')](respondWithResult(_0x5c7121,null))[_0x1693('0x34')](handleError(_0x5c7121,null));};exports['addTeams']=function(_0x2b0ea5,_0x53fe31){var _0x4237d9=_0x2b0ea5[_0x1693('0x3d')][_0x1693('0x53')];return db[_0x1693('0x54')]['findAll']({'where':{'id':_0x4237d9},'attributes':['id'],'include':[{'model':db[_0x1693('0x48')],'as':_0x1693('0x55'),'attributes':['id',_0x1693('0x1c'),_0x1693('0x56'),_0x1693('0x57'),_0x1693('0x58')],'raw':!![]}]})[_0x1693('0x17')](function(_0xeacf5b){if(_0xeacf5b){var _0x419721=_[_0x1693('0x59')](_0xeacf5b,function(_0x15c543){var _0x320596=_0x15c543[_0x1693('0x37')]({'plain':!![]});return _0x320596[_0x1693('0x55')];});return db[_0x1693('0x20')][_0x1693('0x33')]({'where':{'id':_0x2b0ea5['params']['id']}})['then'](function(_0x42ee1f){return db[_0x1693('0x5a')]['transaction'](function(_0xa20458){return _0x42ee1f[_0x1693('0x5b')](_0x4237d9,{'transaction':_0xa20458})[_0x1693('0x17')](function(){return BPromise['each'](_0x419721,function(_0x68749c){return db[_0x1693('0x41')][_0x1693('0x5c')]({'where':{'UserId':_0x68749c['id'],'FaxQueueId':_0x2b0ea5[_0x1693('0x29')]['id']},'transaction':_0xa20458});});})[_0x1693('0x17')](function(){_0x419721[_0x1693('0x5d')](function(_0x28d7ae){socket[_0x1693('0x5e')]('userFaxQueue:save',{'UserId':_0x28d7ae['id'],'FaxQueueId':_0x42ee1f['id']});});});});});}})[_0x1693('0x17')](respondWithStatusCode(_0x53fe31,null))['catch'](handleError(_0x53fe31,null));};exports[_0x1693('0x5f')]=function(_0x442af0,_0x1e7554){return db[_0x1693('0x54')]['findAll']({'where':{'id':_0x442af0[_0x1693('0x2b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1693('0x48')],'as':_0x1693('0x55'),'attributes':['id'],'raw':!![]}]})[_0x1693('0x17')](handleEntityNotFound(_0x1e7554,null))[_0x1693('0x17')](function(_0x282ed8){var _0x107b30=_[_0x1693('0x1f')](_0x282ed8,'id');var _0x4465a9=[];var _0x594773=[];var _0xbac4f7=squel['select']();_0xbac4f7['field'](_0x1693('0x60'))[_0x1693('0x61')](_0x1693('0x62'),'tq')[_0x1693('0x63')](_0x1693('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x1693('0x65'),_0x442af0[_0x1693('0x29')]['id']);for(var _0xa5d4e4=0x0;_0xa5d4e4<_0x282ed8[_0x1693('0x30')];_0xa5d4e4+=0x1){let _0x1b9658=_0x282ed8[_0xa5d4e4];for(var _0x5b7747=0x0;_0x5b7747<_0x1b9658[_0x1693('0x55')][_0x1693('0x30')];_0x5b7747+=0x1){let _0x238e28=_0x1b9658[_0x1693('0x55')][_0x5b7747];var _0x2e1a28=_0xbac4f7['clone']();_0x2e1a28[_0x1693('0x24')](_0x1693('0x66'),_0x238e28['id']);_0x594773[_0x1693('0x67')](db[_0x1693('0x5a')][_0x1693('0x2b')](_0x2e1a28[_0x1693('0x68')](),{'type':db[_0x1693('0x5a')]['QueryTypes'][_0x1693('0x69')]})[_0x1693('0x17')](function(_0x15378d){if(_0x15378d['length']===0x1){return _0x238e28['id'];}else{var _0x3743fc=_[_0x1693('0x6a')](_['map'](_0x15378d,_0x1693('0x6b')),function(_0x9b07bd){return _[_0x1693('0x6c')](_0x107b30,_0x9b07bd);});if(_0x3743fc){return _0x238e28['id'];}}}));}}return BPromise['all'](_0x594773)[_0x1693('0x17')](function(_0x5a3922){_0x4465a9=_(_0x4465a9)[_0x1693('0x6d')](_0x5a3922)[_0x1693('0x6e')]()[_0x1693('0x6f')]();return db[_0x1693('0x20')][_0x1693('0x33')]({'where':{'id':_0x442af0['params']['id']}})[_0x1693('0x17')](function(_0x11ce8f){return db[_0x1693('0x5a')]['transaction'](function(_0x533612){return _0x11ce8f[_0x1693('0x5f')](_0x442af0[_0x1693('0x2b')]['ids'],{'transaction':_0x533612})[_0x1693('0x17')](function(){if(!_['isEmpty'](_0x4465a9)){return _0x11ce8f[_0x1693('0x70')](_0x4465a9,{'transaction':_0x533612});}})[_0x1693('0x17')](function(){_0x4465a9['forEach'](function(_0x1f4195){socket['emit']('userFaxQueue:remove',{'UserId':_0x1f4195,'FaxQueueId':_0x11ce8f['id']});});});});});});})[_0x1693('0x17')](respondWithStatusCode(_0x1e7554,null))[_0x1693('0x34')](handleError(_0x1e7554,null));};exports['addAgents']=function(_0x57470d,_0x3567be){return db[_0x1693('0x20')]['find']({'where':{'id':_0x57470d[_0x1693('0x29')]['id']}})[_0x1693('0x17')](handleEntityNotFound(_0x3567be,null))[_0x1693('0x17')](function(_0x4a4463){if(_0x4a4463){return _0x4a4463['addAgents'](_0x57470d[_0x1693('0x3d')][_0x1693('0x53')],_[_0x1693('0x71')](_0x57470d[_0x1693('0x3d')],[_0x1693('0x53'),'id'])||{})[_0x1693('0x72')](function(_0x182b02){for(var _0x5da984=0x0;_0x5da984<_0x57470d['body'][_0x1693('0x53')][_0x1693('0x30')];_0x5da984+=0x1){socket[_0x1693('0x5e')](_0x1693('0x73'),{'UserId':Number(_0x57470d[_0x1693('0x3d')]['ids'][_0x5da984]),'FaxQueueId':Number(_0x57470d['params']['id'])});}return _0x182b02;});}})['then'](respondWithResult(_0x3567be,null))[_0x1693('0x34')](handleError(_0x3567be,null));};exports[_0x1693('0x70')]=function(_0x2be526,_0x59a3a9){return db['FaxQueue'][_0x1693('0x33')]({'where':{'id':_0x2be526['params']['id']}})[_0x1693('0x17')](handleEntityNotFound(_0x59a3a9,null))[_0x1693('0x17')](function(_0x4cef47){if(_0x4cef47){return _0x4cef47[_0x1693('0x70')](_0x2be526[_0x1693('0x2b')][_0x1693('0x53')])[_0x1693('0x17')](function(){if(_[_0x1693('0x74')](_0x2be526[_0x1693('0x2b')][_0x1693('0x53')])){for(var _0x1868bf=0x0;_0x1868bf<_0x2be526[_0x1693('0x2b')][_0x1693('0x53')][_0x1693('0x30')];_0x1868bf+=0x1){socket['emit'](_0x1693('0x75'),{'UserId':Number(_0x2be526[_0x1693('0x2b')]['ids'][_0x1868bf]),'FaxQueueId':Number(_0x2be526[_0x1693('0x29')]['id'])});}}else{socket[_0x1693('0x5e')](_0x1693('0x75'),{'UserId':Number(_0x2be526[_0x1693('0x2b')][_0x1693('0x53')]),'FaxQueueId':Number(_0x2be526[_0x1693('0x29')]['id'])});}});}})[_0x1693('0x17')](respondWithStatusCode(_0x59a3a9,null))[_0x1693('0x34')](handleError(_0x59a3a9,null));};exports[_0x1693('0x76')]=function(_0x166887,_0x2a10f9){var _0x4de909={};var _0x99e0b9={};var _0x237d07;var _0x1f2f1d;return db[_0x1693('0x20')][_0x1693('0x40')]({'where':{'id':_0x166887[_0x1693('0x29')]['id']}})[_0x1693('0x17')](handleEntityNotFound(_0x2a10f9,null))[_0x1693('0x17')](function(_0x1aa7c2){if(_0x1aa7c2){_0x237d07=_0x1aa7c2;_0x99e0b9[_0x1693('0x2a')]=_['keys'](db['User'][_0x1693('0x21')]);_0x99e0b9['query']=_[_0x1693('0x2c')](_0x166887['query']);_0x99e0b9[_0x1693('0x2d')]=_['intersection'](_0x99e0b9['model'],_0x99e0b9[_0x1693('0x2b')]);_0x4de909[_0x1693('0x2f')]=_[_0x1693('0x2e')](_0x99e0b9[_0x1693('0x2a')],qs[_0x1693('0x42')](_0x166887[_0x1693('0x2b')][_0x1693('0x42')]));_0x4de909[_0x1693('0x2f')]=_0x4de909[_0x1693('0x2f')][_0x1693('0x30')]?_0x4de909[_0x1693('0x2f')]:_0x99e0b9[_0x1693('0x2a')];_0x4de909['order']=qs[_0x1693('0x43')](_0x166887[_0x1693('0x2b')][_0x1693('0x43')]);_0x4de909[_0x1693('0x24')]=qs['filters'](_[_0x1693('0x44')](_0x166887[_0x1693('0x2b')],_0x99e0b9[_0x1693('0x2d')]));if(_0x166887[_0x1693('0x2b')][_0x1693('0x46')]){_0x4de909[_0x1693('0x24')]=_[_0x1693('0x32')](_0x4de909[_0x1693('0x24')],{'$or':_[_0x1693('0x1f')](_0x4de909['attributes'],function(_0x960477){var _0x574e51={};_0x574e51[_0x960477]={'$like':'%'+_0x166887[_0x1693('0x2b')][_0x1693('0x46')]+'%'};return _0x574e51;})});}_0x4de909=_['merge']({},_0x4de909,_0x166887['options']);return _0x237d07[_0x1693('0x76')](_0x4de909);}})['then'](function(_0x519b3d){if(_0x519b3d){_0x1f2f1d=_0x519b3d['length'];if(!_0x166887[_0x1693('0x2b')][_0x1693('0x51')](_0x1693('0x52'))){_0x4de909[_0x1693('0x14')]=qs['limit'](_0x166887[_0x1693('0x2b')][_0x1693('0x14')]);_0x4de909[_0x1693('0x12')]=qs[_0x1693('0x12')](_0x166887[_0x1693('0x2b')][_0x1693('0x12')]);}return _0x237d07[_0x1693('0x76')](_0x4de909);}})[_0x1693('0x17')](function(_0x40d5ad){if(_0x40d5ad){return _0x40d5ad?{'count':_0x1f2f1d,'rows':_0x40d5ad}:null;}})[_0x1693('0x17')](respondWithResult(_0x2a10f9,null))[_0x1693('0x34')](handleError(_0x2a10f9,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 8866c81..89cf63f 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 _0x70f1=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove'];(function(_0x56d856,_0x4ed94e){var _0x375e02=function(_0x4d700c){while(--_0x4d700c){_0x56d856['push'](_0x56d856['shift']());}};_0x375e02(++_0x4ed94e);}(_0x70f1,0x122));var _0x170f=function(_0x129e45,_0x405d67){_0x129e45=_0x129e45-0x0;var _0x718901=_0x70f1[_0x129e45];return _0x718901;};'use strict';var EventEmitter=require(_0x170f('0x0'));var FaxQueue=require(_0x170f('0x1'))['db'][_0x170f('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x170f('0x3')](0x0);var events={'afterCreate':_0x170f('0x4'),'afterUpdate':_0x170f('0x5'),'afterDestroy':_0x170f('0x6')};function emitEvent(_0x5db9bf){return function(_0x4ee505,_0x7948d7,_0x33e034){FaxQueueEvents['emit'](_0x5db9bf+':'+_0x4ee505['id'],_0x4ee505);FaxQueueEvents[_0x170f('0x7')](_0x5db9bf,_0x4ee505);_0x33e034(null);};}for(var e in events){if(events[_0x170f('0x8')](e)){var event=events[e];FaxQueue[_0x170f('0x9')](e,emitEvent(event));}}module[_0x170f('0xa')]=FaxQueueEvents; \ No newline at end of file +var _0x9501=['FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x386eb0,_0x2689aa){var _0x19ab3e=function(_0x1968bb){while(--_0x1968bb){_0x386eb0['push'](_0x386eb0['shift']());}};_0x19ab3e(++_0x2689aa);}(_0x9501,0x118));var _0x1950=function(_0x1cf717,_0x3ba653){_0x1cf717=_0x1cf717-0x0;var _0x194b03=_0x9501[_0x1cf717];return _0x194b03;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db'][_0x1950('0x0')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x1950('0x1')](0x0);var events={'afterCreate':_0x1950('0x2'),'afterUpdate':_0x1950('0x3'),'afterDestroy':_0x1950('0x4')};function emitEvent(_0x43e224){return function(_0x31c493,_0x3e3cf7,_0x53fd2f){FaxQueueEvents[_0x1950('0x5')](_0x43e224+':'+_0x31c493['id'],_0x31c493);FaxQueueEvents[_0x1950('0x5')](_0x43e224,_0x31c493);_0x53fd2f(null);};}for(var e in events){if(events[_0x1950('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x1950('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 240e270..fe81408 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 _0x4985=['./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4985,0xdd));var _0x5498=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x4985[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x5498('0x0'));var util=require(_0x5498('0x1'));var logger=require(_0x5498('0x2'))('api');var moment=require(_0x5498('0x3'));var BPromise=require('bluebird');var rp=require(_0x5498('0x4'));var fs=require('fs');var path=require(_0x5498('0x5'));var rimraf=require('rimraf');var config=require(_0x5498('0x6'));var attributes=require(_0x5498('0x7'));module[_0x5498('0x8')]=function(_0x1f3508,_0x3975ea){return _0x1f3508[_0x5498('0x9')](_0x5498('0xa'),attributes,{'tableName':_0x5498('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4394=['exports','define','FaxQueue','fax_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./faxQueue.attributes'];(function(_0x183908,_0x162e5e){var _0x13899e=function(_0x48ad4c){while(--_0x48ad4c){_0x183908['push'](_0x183908['shift']());}};_0x13899e(++_0x162e5e);}(_0x4394,0x164));var _0x4439=function(_0x32be62,_0x22e6fd){_0x32be62=_0x32be62-0x0;var _0x1a37e9=_0x4394[_0x32be62];return _0x1a37e9;};'use strict';var _=require(_0x4439('0x0'));var util=require('util');var logger=require(_0x4439('0x1'))(_0x4439('0x2'));var moment=require(_0x4439('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4439('0x4'));var rimraf=require('rimraf');var config=require(_0x4439('0x5'));var attributes=require(_0x4439('0x6'));module[_0x4439('0x7')]=function(_0x2a7351,_0x57cd9c){return _0x2a7351[_0x4439('0x8')](_0x4439('0x9'),attributes,{'tableName':_0x4439('0xa'),'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 6fdcbab..eb83605 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 _0x36ab=['code','message','info','result','catch','GetFaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowFaxQueue','FaxQueue','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','then','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x36ab,0x1ab));var _0xb36a=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x36ab[_0x1992f1];return _0x413dfe;};'use strict';var _=require('lodash');var util=require(_0xb36a('0x0'));var moment=require(_0xb36a('0x1'));var BPromise=require(_0xb36a('0x2'));var rs=require(_0xb36a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb36a('0x4'))['db'];var utils=require(_0xb36a('0x5'));var logger=require(_0xb36a('0x6'))(_0xb36a('0x7'));var config=require(_0xb36a('0x8'));var jayson=require(_0xb36a('0x9'));var client=jayson[_0xb36a('0xa')][_0xb36a('0xb')]({'port':0x232a});config[_0xb36a('0xc')]=_[_0xb36a('0xd')](config[_0xb36a('0xc')],{'host':_0xb36a('0xe'),'port':0x18eb});var socket=require(_0xb36a('0xf'))(new Redis(config[_0xb36a('0xc')]));require(_0xb36a('0x10'))['register'](socket);function respondWithRpcPromise(_0x34c81e,_0x497f58,_0x56822d){return new BPromise(function(_0x46ea0e,_0x23e407){return client['request'](_0x34c81e,_0x56822d)[_0xb36a('0x11')](function(_0x29ef5b){logger['info'](_0xb36a('0x12'),_0x497f58,'request\x20sent');logger[_0xb36a('0x13')](_0xb36a('0x14'),_0x497f58,_0xb36a('0x15'),JSON[_0xb36a('0x16')](_0x29ef5b));if(_0x29ef5b[_0xb36a('0x17')]){if(_0x29ef5b[_0xb36a('0x17')][_0xb36a('0x18')]===0x1f4){logger['error'](_0xb36a('0x12'),_0x497f58,_0x29ef5b[_0xb36a('0x17')][_0xb36a('0x19')]);return _0x23e407(_0x29ef5b[_0xb36a('0x17')][_0xb36a('0x19')]);}logger['error'](_0xb36a('0x12'),_0x497f58,_0x29ef5b['error'][_0xb36a('0x19')]);return _0x46ea0e(_0x29ef5b['error'][_0xb36a('0x19')]);}else{logger[_0xb36a('0x1a')](_0xb36a('0x12'),_0x497f58,_0xb36a('0x15'));_0x46ea0e(_0x29ef5b[_0xb36a('0x1b')]['message']);}})[_0xb36a('0x1c')](function(_0x4fd521){logger[_0xb36a('0x17')](_0xb36a('0x12'),_0x497f58,_0x4fd521);_0x23e407(_0x4fd521);});});}exports[_0xb36a('0x1d')]=function(_0x5b4f86){var _0x39197a=this;return new Promise(function(_0x48a908,_0xb33c26){return db['FaxQueue'][_0xb36a('0x1e')]({'raw':_0x5b4f86[_0xb36a('0x1f')]?_0x5b4f86['options'][_0xb36a('0x20')]===undefined?!![]:![]:!![],'where':_0x5b4f86[_0xb36a('0x1f')]?_0x5b4f86[_0xb36a('0x1f')][_0xb36a('0x21')]||null:null,'attributes':_0x5b4f86[_0xb36a('0x1f')]?_0x5b4f86[_0xb36a('0x1f')][_0xb36a('0x22')]||null:null,'limit':_0x5b4f86[_0xb36a('0x1f')]?_0x5b4f86['options'][_0xb36a('0x23')]||null:null,'include':_0x5b4f86[_0xb36a('0x1f')]?_0x5b4f86[_0xb36a('0x1f')][_0xb36a('0x24')]?_['map'](_0x5b4f86[_0xb36a('0x1f')][_0xb36a('0x24')],function(_0x2d0948){return{'model':db[_0x2d0948[_0xb36a('0x25')]],'as':_0x2d0948['as'],'attributes':_0x2d0948['attributes'],'include':_0x2d0948[_0xb36a('0x24')]?_[_0xb36a('0x26')](_0x2d0948[_0xb36a('0x24')],function(_0x3ae3f8){return{'model':db[_0x3ae3f8['model']],'as':_0x3ae3f8['as'],'attributes':_0x3ae3f8[_0xb36a('0x22')],'include':_0x3ae3f8[_0xb36a('0x24')]?_['map'](_0x3ae3f8[_0xb36a('0x24')],function(_0x5af1f4){return{'model':db[_0x5af1f4[_0xb36a('0x25')]],'as':_0x5af1f4['as'],'attributes':_0x5af1f4['attributes']};}):[]};}):[]};}):[]:[]})[_0xb36a('0x11')](function(_0x25620a){logger[_0xb36a('0x1a')]('GetFaxQueue',_0x5b4f86);logger[_0xb36a('0x13')](_0xb36a('0x1d'),_0x5b4f86,JSON[_0xb36a('0x16')](_0x25620a));_0x48a908(_0x25620a);})['catch'](function(_0x42fba0){logger['error'](_0xb36a('0x1d'),_0x42fba0['message'],_0x5b4f86);_0xb33c26(_0x39197a[_0xb36a('0x17')](0x1f4,_0x42fba0[_0xb36a('0x19')]));});});};exports[_0xb36a('0x27')]=function(_0x4680d1){var _0x2d4130=this;return new Promise(function(_0x5cde2a,_0x24b8a8){return db[_0xb36a('0x28')]['find']({'raw':_0x4680d1[_0xb36a('0x1f')]?_0x4680d1['options'][_0xb36a('0x20')]===undefined?!![]:![]:!![],'where':_0x4680d1['options']?_0x4680d1['options'][_0xb36a('0x21')]||null:null,'attributes':_0x4680d1[_0xb36a('0x1f')]?_0x4680d1[_0xb36a('0x1f')]['attributes']||null:null,'include':_0x4680d1[_0xb36a('0x1f')]?_0x4680d1['options'][_0xb36a('0x24')]?_['map'](_0x4680d1['options'][_0xb36a('0x24')],function(_0xa42869){return{'model':db[_0xa42869[_0xb36a('0x25')]],'as':_0xa42869['as'],'attributes':_0xa42869[_0xb36a('0x22')],'include':_0xa42869[_0xb36a('0x24')]?_[_0xb36a('0x26')](_0xa42869['include'],function(_0x331f2f){return{'model':db[_0x331f2f[_0xb36a('0x25')]],'as':_0x331f2f['as'],'attributes':_0x331f2f[_0xb36a('0x22')],'include':_0x331f2f[_0xb36a('0x24')]?_['map'](_0x331f2f[_0xb36a('0x24')],function(_0x4f23bb){return{'model':db[_0x4f23bb[_0xb36a('0x25')]],'as':_0x4f23bb['as'],'attributes':_0x4f23bb[_0xb36a('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb36a('0x11')](function(_0x4a4af3){logger[_0xb36a('0x1a')](_0xb36a('0x27'),_0x4680d1);logger['debug'](_0xb36a('0x27'),_0x4680d1,JSON['stringify'](_0x4a4af3));_0x5cde2a(_0x4a4af3);})[_0xb36a('0x1c')](function(_0x4a5a69){logger[_0xb36a('0x17')]('ShowFaxQueue',_0x4a5a69['message'],_0x4680d1);_0x24b8a8(_0x2d4130[_0xb36a('0x17')](0x1f4,_0x4a5a69[_0xb36a('0x19')]));});});}; \ No newline at end of file +var _0x7dfc=['../../config/utils','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./faxQueue.socket','register','request','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','FaxQueue','options','raw','where','attributes','limit','include','map','model','GetFaxQueue','stringify','catch','ShowFaxQueue','find','then','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0x7dfc,0xf6));var _0xc7df=function(_0x19eccb,_0x84b7db){_0x19eccb=_0x19eccb-0x0;var _0x37228d=_0x7dfc[_0x19eccb];return _0x37228d;};'use strict';var _=require(_0xc7df('0x0'));var util=require(_0xc7df('0x1'));var moment=require(_0xc7df('0x2'));var BPromise=require(_0xc7df('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7df('0x4'));var db=require(_0xc7df('0x5'))['db'];var utils=require(_0xc7df('0x6'));var logger=require('../../config/logger')(_0xc7df('0x7'));var config=require(_0xc7df('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc7df('0x9')][_0xc7df('0xa')]({'port':0x232a});config['redis']=_[_0xc7df('0xb')](config['redis'],{'host':_0xc7df('0xc'),'port':0x18eb});var socket=require(_0xc7df('0xd'))(new Redis(config[_0xc7df('0xe')]));require(_0xc7df('0xf'))[_0xc7df('0x10')](socket);function respondWithRpcPromise(_0x4643e2,_0x587ebc,_0x180961){return new BPromise(function(_0x19f21b,_0x162754){return client[_0xc7df('0x11')](_0x4643e2,_0x180961)['then'](function(_0x4d28fe){logger['info'](_0xc7df('0x12'),_0x587ebc,_0xc7df('0x13'));logger['debug'](_0xc7df('0x14'),_0x587ebc,_0xc7df('0x13'),JSON['stringify'](_0x4d28fe));if(_0x4d28fe[_0xc7df('0x15')]){if(_0x4d28fe[_0xc7df('0x15')][_0xc7df('0x16')]===0x1f4){logger[_0xc7df('0x15')](_0xc7df('0x12'),_0x587ebc,_0x4d28fe[_0xc7df('0x15')][_0xc7df('0x17')]);return _0x162754(_0x4d28fe[_0xc7df('0x15')][_0xc7df('0x17')]);}logger['error'](_0xc7df('0x12'),_0x587ebc,_0x4d28fe[_0xc7df('0x15')][_0xc7df('0x17')]);return _0x19f21b(_0x4d28fe[_0xc7df('0x15')][_0xc7df('0x17')]);}else{logger[_0xc7df('0x18')](_0xc7df('0x12'),_0x587ebc,_0xc7df('0x13'));_0x19f21b(_0x4d28fe[_0xc7df('0x19')]['message']);}})['catch'](function(_0x57ef48){logger[_0xc7df('0x15')]('FaxQueue,\x20%s,\x20%s',_0x587ebc,_0x57ef48);_0x162754(_0x57ef48);});});}exports['GetFaxQueue']=function(_0x4adc6d){var _0x2e6472=this;return new Promise(function(_0x421f58,_0x2ff415){return db[_0xc7df('0x1a')]['findAll']({'raw':_0x4adc6d['options']?_0x4adc6d[_0xc7df('0x1b')][_0xc7df('0x1c')]===undefined?!![]:![]:!![],'where':_0x4adc6d[_0xc7df('0x1b')]?_0x4adc6d[_0xc7df('0x1b')][_0xc7df('0x1d')]||null:null,'attributes':_0x4adc6d[_0xc7df('0x1b')]?_0x4adc6d[_0xc7df('0x1b')][_0xc7df('0x1e')]||null:null,'limit':_0x4adc6d['options']?_0x4adc6d[_0xc7df('0x1b')][_0xc7df('0x1f')]||null:null,'include':_0x4adc6d[_0xc7df('0x1b')]?_0x4adc6d[_0xc7df('0x1b')][_0xc7df('0x20')]?_[_0xc7df('0x21')](_0x4adc6d[_0xc7df('0x1b')][_0xc7df('0x20')],function(_0x141149){return{'model':db[_0x141149[_0xc7df('0x22')]],'as':_0x141149['as'],'attributes':_0x141149[_0xc7df('0x1e')],'include':_0x141149[_0xc7df('0x20')]?_[_0xc7df('0x21')](_0x141149['include'],function(_0x5ef0b3){return{'model':db[_0x5ef0b3[_0xc7df('0x22')]],'as':_0x5ef0b3['as'],'attributes':_0x5ef0b3[_0xc7df('0x1e')],'include':_0x5ef0b3[_0xc7df('0x20')]?_[_0xc7df('0x21')](_0x5ef0b3[_0xc7df('0x20')],function(_0x447448){return{'model':db[_0x447448[_0xc7df('0x22')]],'as':_0x447448['as'],'attributes':_0x447448[_0xc7df('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x465dcc){logger[_0xc7df('0x18')](_0xc7df('0x23'),_0x4adc6d);logger['debug']('GetFaxQueue',_0x4adc6d,JSON[_0xc7df('0x24')](_0x465dcc));_0x421f58(_0x465dcc);})[_0xc7df('0x25')](function(_0x4c0322){logger[_0xc7df('0x15')](_0xc7df('0x23'),_0x4c0322[_0xc7df('0x17')],_0x4adc6d);_0x2ff415(_0x2e6472[_0xc7df('0x15')](0x1f4,_0x4c0322['message']));});});};exports[_0xc7df('0x26')]=function(_0x5bdcea){var _0x10d8ba=this;return new Promise(function(_0x1e36da,_0x8b770){return db[_0xc7df('0x1a')][_0xc7df('0x27')]({'raw':_0x5bdcea[_0xc7df('0x1b')]?_0x5bdcea['options'][_0xc7df('0x1c')]===undefined?!![]:![]:!![],'where':_0x5bdcea[_0xc7df('0x1b')]?_0x5bdcea[_0xc7df('0x1b')]['where']||null:null,'attributes':_0x5bdcea['options']?_0x5bdcea[_0xc7df('0x1b')][_0xc7df('0x1e')]||null:null,'include':_0x5bdcea[_0xc7df('0x1b')]?_0x5bdcea['options'][_0xc7df('0x20')]?_[_0xc7df('0x21')](_0x5bdcea[_0xc7df('0x1b')]['include'],function(_0x3d6a35){return{'model':db[_0x3d6a35[_0xc7df('0x22')]],'as':_0x3d6a35['as'],'attributes':_0x3d6a35[_0xc7df('0x1e')],'include':_0x3d6a35[_0xc7df('0x20')]?_['map'](_0x3d6a35[_0xc7df('0x20')],function(_0x3dda07){return{'model':db[_0x3dda07['model']],'as':_0x3dda07['as'],'attributes':_0x3dda07[_0xc7df('0x1e')],'include':_0x3dda07[_0xc7df('0x20')]?_['map'](_0x3dda07['include'],function(_0x2d9623){return{'model':db[_0x2d9623[_0xc7df('0x22')]],'as':_0x2d9623['as'],'attributes':_0x2d9623[_0xc7df('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc7df('0x28')](function(_0x5d6b08){logger['info'](_0xc7df('0x26'),_0x5bdcea);logger[_0xc7df('0x29')](_0xc7df('0x26'),_0x5bdcea,JSON[_0xc7df('0x24')](_0x5d6b08));_0x1e36da(_0x5d6b08);})[_0xc7df('0x25')](function(_0x32999c){logger[_0xc7df('0x15')]('ShowFaxQueue',_0x32999c[_0xc7df('0x17')],_0x5bdcea);_0x8b770(_0x10d8ba[_0xc7df('0x15')](0x1f4,_0x32999c[_0xc7df('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 4b4deb4..b0867d4 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 _0x98a8=['save','remove','update','removeListener','register','faxQueue:','./faxQueue.events'];(function(_0x304466,_0x2103fe){var _0x152a94=function(_0x3f63f2){while(--_0x3f63f2){_0x304466['push'](_0x304466['shift']());}};_0x152a94(++_0x2103fe);}(_0x98a8,0x12c));var _0x898a=function(_0x30c374,_0x8afacd){_0x30c374=_0x30c374-0x0;var _0x565ed4=_0x98a8[_0x30c374];return _0x565ed4;};'use strict';var FaxQueueEvents=require(_0x898a('0x0'));var events=[_0x898a('0x1'),_0x898a('0x2'),_0x898a('0x3')];function createListener(_0x213c5d,_0x226db7){return function(_0x69c61f){_0x226db7['emit'](_0x213c5d,_0x69c61f);};}function removeListener(_0x2bb3e2,_0xf84a19){return function(){FaxQueueEvents[_0x898a('0x4')](_0x2bb3e2,_0xf84a19);};}exports[_0x898a('0x5')]=function(_0x3e7ddd){for(var _0x5d7e59=0x0,_0x3aadc2=events['length'];_0x5d7e59<_0x3aadc2;_0x5d7e59++){var _0xfa8c50=events[_0x5d7e59];var _0x4fbce5=createListener(_0x898a('0x6')+_0xfa8c50,_0x3e7ddd);FaxQueueEvents['on'](_0xfa8c50,_0x4fbce5);}}; \ No newline at end of file +var _0xaccc=['length','faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xaccc,0xda));var _0xcacc=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xaccc[_0xe66cf2];return _0x2d84e7;};'use strict';var FaxQueueEvents=require(_0xcacc('0x0'));var events=[_0xcacc('0x1'),_0xcacc('0x2'),_0xcacc('0x3')];function createListener(_0x315a70,_0x1f0d10){return function(_0x4b0142){_0x1f0d10[_0xcacc('0x4')](_0x315a70,_0x4b0142);};}function removeListener(_0x15fcec,_0x1e34bd){return function(){FaxQueueEvents[_0xcacc('0x5')](_0x15fcec,_0x1e34bd);};}exports['register']=function(_0x2b21bb){for(var _0x484dc9=0x0,_0x7fa51c=events[_0xcacc('0x6')];_0x484dc9<_0x7fa51c;_0x484dc9++){var _0x35ea66=events[_0x484dc9];var _0x1eb4f6=createListener(_0xcacc('0x7')+_0x35ea66,_0x2b21bb);FaxQueueEvents['on'](_0x35ea66,_0x1eb4f6);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 1ec2617..6bf0f3d 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 _0xd9eb=['/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','create','/:id/users','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe'];(function(_0x4c172c,_0x260443){var _0x461d6f=function(_0x2fc84b){while(--_0x2fc84b){_0x4c172c['push'](_0x4c172c['shift']());}};_0x461d6f(++_0x260443);}(_0xd9eb,0xca));var _0xbd9e=function(_0x2e5981,_0xe4e846){_0x2e5981=_0x2e5981-0x0;var _0x6e4fef=_0xd9eb[_0x2e5981];return _0x6e4fef;};'use strict';var multer=require(_0xbd9e('0x0'));var util=require(_0xbd9e('0x1'));var path=require(_0xbd9e('0x2'));var timeout=require(_0xbd9e('0x3'));var express=require(_0xbd9e('0x4'));var router=express[_0xbd9e('0x5')]();var fs_extra=require(_0xbd9e('0x6'));var auth=require(_0xbd9e('0x7'));var interaction=require(_0xbd9e('0x8'));var config=require(_0xbd9e('0x9'));var controller=require(_0xbd9e('0xa'));router[_0xbd9e('0xb')]('/',auth[_0xbd9e('0xc')](),controller['index']);router[_0xbd9e('0xb')](_0xbd9e('0xd'),auth[_0xbd9e('0xc')](),controller[_0xbd9e('0xe')]);router[_0xbd9e('0xb')](_0xbd9e('0xf'),auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x10')]);router[_0xbd9e('0xb')](_0xbd9e('0x11'),auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x12')]);router['get'](_0xbd9e('0x13'),auth[_0xbd9e('0xc')](),controller['getTeams']);router[_0xbd9e('0xb')]('/:id/users',auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x14')]);router[_0xbd9e('0x15')]('/',auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x16')]);router[_0xbd9e('0x15')](_0xbd9e('0x13'),auth[_0xbd9e('0xc')](),controller['addTeams']);router[_0xbd9e('0x15')](_0xbd9e('0x17'),auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x18')]);router[_0xbd9e('0x19')](_0xbd9e('0xf'),auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x1a')]);router[_0xbd9e('0x1b')](_0xbd9e('0xf'),auth[_0xbd9e('0xc')](),controller['destroy']);router[_0xbd9e('0x1b')](_0xbd9e('0x13'),auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x1c')]);router[_0xbd9e('0x1b')]('/:id/users',auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x1d')]);module[_0xbd9e('0x1e')]=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(_0x5a547b,_0xfdf7fe){var _0x36d9d6=function(_0x268044){while(--_0x268044){_0x5a547b['push'](_0x5a547b['shift']());}};_0x36d9d6(++_0xfdf7fe);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x2fb974,_0x39c5c8){_0x2fb974=_0x2fb974-0x0;var _0x51d376=_0x0e4b[_0x2fb974];return _0x51d376;};'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 7ab91a6..807bb84 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 _0xd8a7=['DATE','moment','STRING'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xd8a7,0xdf));var _0x7d8a=function(_0x3fa44d,_0x4c190d){_0x3fa44d=_0x3fa44d-0x0;var _0x603bce=_0xd8a7[_0x3fa44d];return _0x603bce;};'use strict';var moment=require(_0x7d8a('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x7d8a('0x1')]},'joinAt':{'type':Sequelize[_0x7d8a('0x2')]},'leaveAt':{'type':Sequelize[_0x7d8a('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x7d8a('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x39b3=['moment','STRING','DATE'];(function(_0x180969,_0x2a722a){var _0x5afea5=function(_0x409aa3){while(--_0x409aa3){_0x180969['push'](_0x180969['shift']());}};_0x5afea5(++_0x2a722a);}(_0x39b3,0xc9));var _0x339b=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x39b3[_0x3ab9ee];return _0x82ee88;};'use strict';var moment=require(_0x339b('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x339b('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x339b('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x339b('0x2')]},'exitAt':{'type':Sequelize[_0x339b('0x2')]},'reason':{'type':Sequelize[_0x339b('0x1')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index af88e5c..b8754fd 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 _0x49e9=['count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','index','FaxQueueReport','rawAttributes','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','params','include','options','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit'];(function(_0x33e840,_0x120983){var _0x363891=function(_0x276d39){while(--_0x276d39){_0x33e840['push'](_0x33e840['shift']());}};_0x363891(++_0x120983);}(_0x49e9,0x10f));var _0x949e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49e9[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x949e('0x0'));var rimraf=require(_0x949e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x949e('0x2'));var rp=require(_0x949e('0x3'));var moment=require(_0x949e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x949e('0x5'));var path=require('path');var sox=require(_0x949e('0x6'));var csv=require(_0x949e('0x7'));var ejs=require(_0x949e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x949e('0x9'));var squel=require(_0x949e('0xa'));var crypto=require(_0x949e('0xb'));var jsforce=require(_0x949e('0xc'));var deskjs=require(_0x949e('0xd'));var toCsv=require(_0x949e('0x7'));var querystring=require(_0x949e('0xe'));var Papa=require('papaparse');var Redis=require(_0x949e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x949e('0x10'));var as=require(_0x949e('0x11'));var hardwareService=require(_0x949e('0x12'));var logger=require('../../config/logger')(_0x949e('0x13'));var utils=require(_0x949e('0x14'));var config=require(_0x949e('0x15'));var licenseUtil=require(_0x949e('0x16'));var db=require(_0x949e('0x17'))['db'];function respondWithStatusCode(_0x253d5e,_0x1871a5){_0x1871a5=_0x1871a5||0xcc;return function(_0x17d1f3){if(_0x17d1f3){return _0x253d5e[_0x949e('0x18')](_0x1871a5);}return _0x253d5e[_0x949e('0x19')](_0x1871a5)[_0x949e('0x1a')]();};}function respondWithResult(_0x7a8954,_0x3e0e54){_0x3e0e54=_0x3e0e54||0xc8;return function(_0x7f8be2){if(_0x7f8be2){return _0x7a8954[_0x949e('0x19')](_0x3e0e54)['json'](_0x7f8be2);}};}function respondWithFilteredResult(_0x257981,_0x3d81cd){return function(_0x587bff){if(_0x587bff){var _0xf1f41a=typeof _0x3d81cd['offset']===_0x949e('0x1b')&&typeof _0x3d81cd[_0x949e('0x1c')]==='undefined';var _0x37fd96=_0x587bff[_0x949e('0x1d')];var _0x43498d=_0xf1f41a?0x0:_0x3d81cd[_0x949e('0x1e')];var _0x20333c=_0xf1f41a?_0x587bff['count']:_0x3d81cd[_0x949e('0x1e')]+_0x3d81cd[_0x949e('0x1c')];var _0x476fa8;if(_0x20333c>=_0x37fd96){_0x20333c=_0x37fd96;_0x476fa8=0xc8;}else{_0x476fa8=0xce;}_0x257981[_0x949e('0x19')](_0x476fa8);return _0x257981[_0x949e('0x1f')](_0x949e('0x20'),_0x43498d+'-'+_0x20333c+'/'+_0x37fd96)[_0x949e('0x21')](_0x587bff);}return null;};}function patchUpdates(_0x2f21bd){return function(_0x104740){try{jsonpatch[_0x949e('0x22')](_0x104740,_0x2f21bd,!![]);}catch(_0x23fc20){return BPromise[_0x949e('0x23')](_0x23fc20);}return _0x104740[_0x949e('0x24')]();};}function saveUpdates(_0x1927ab,_0x199d53){return function(_0x2e81f2){if(_0x2e81f2){return _0x2e81f2['update'](_0x1927ab)[_0x949e('0x25')](function(_0x44ffb4){return _0x44ffb4;});}return null;};}function removeEntity(_0x5572ae,_0x48a1d1){return function(_0x23b38e){if(_0x23b38e){return _0x23b38e[_0x949e('0x26')]()[_0x949e('0x25')](function(){_0x5572ae[_0x949e('0x19')](0xcc)[_0x949e('0x1a')]();});}};}function handleEntityNotFound(_0x1185b3,_0x29e07b){return function(_0x255b11){if(!_0x255b11){_0x1185b3[_0x949e('0x18')](0x194);}return _0x255b11;};}function handleError(_0x20258c,_0x5dcc46){_0x5dcc46=_0x5dcc46||0x1f4;return function(_0x212224){logger[_0x949e('0x27')](_0x212224['stack']);if(_0x212224[_0x949e('0x28')]){delete _0x212224[_0x949e('0x28')];}_0x20258c['status'](_0x5dcc46)[_0x949e('0x29')](_0x212224);};}exports[_0x949e('0x2a')]=function(_0x5b9f28,_0x1867d9){var _0x5b2b0b={},_0x5e6e34={},_0x4e169d={'count':0x0,'rows':[]};var _0x54ad5d=_['map'](db[_0x949e('0x2b')][_0x949e('0x2c')],function(_0x3051ec){return{'name':_0x3051ec['fieldName'],'type':_0x3051ec['type']['key']};});_0x5e6e34['model']=_[_0x949e('0x2d')](_0x54ad5d,_0x949e('0x28'));_0x5e6e34[_0x949e('0x2e')]=_[_0x949e('0x2f')](_0x5b9f28['query']);_0x5e6e34[_0x949e('0x30')]=_[_0x949e('0x31')](_0x5e6e34[_0x949e('0x32')],_0x5e6e34['query']);_0x5b2b0b[_0x949e('0x33')]=_[_0x949e('0x31')](_0x5e6e34[_0x949e('0x32')],qs['fields'](_0x5b9f28['query'][_0x949e('0x34')]));_0x5b2b0b[_0x949e('0x33')]=_0x5b2b0b[_0x949e('0x33')][_0x949e('0x35')]?_0x5b2b0b['attributes']:_0x5e6e34[_0x949e('0x32')];if(!_0x5b9f28[_0x949e('0x2e')][_0x949e('0x36')](_0x949e('0x37'))){_0x5b2b0b[_0x949e('0x1c')]=qs[_0x949e('0x1c')](_0x5b9f28[_0x949e('0x2e')][_0x949e('0x1c')]);_0x5b2b0b['offset']=qs['offset'](_0x5b9f28[_0x949e('0x2e')]['offset']);}_0x5b2b0b['order']=qs[_0x949e('0x38')](_0x5b9f28[_0x949e('0x2e')][_0x949e('0x38')]);_0x5b2b0b[_0x949e('0x39')]=qs[_0x949e('0x30')](_[_0x949e('0x3a')](_0x5b9f28[_0x949e('0x2e')],_0x5e6e34[_0x949e('0x30')]),_0x54ad5d);if(_0x5b9f28[_0x949e('0x2e')][_0x949e('0x3b')]){_0x5b2b0b[_0x949e('0x39')]=_[_0x949e('0x3c')](_0x5b2b0b[_0x949e('0x39')],{'$or':_[_0x949e('0x2d')](_0x54ad5d,function(_0x26ad2b){if(_0x26ad2b[_0x949e('0x3d')]!==_0x949e('0x3e')){var _0x498fa3={};_0x498fa3[_0x26ad2b[_0x949e('0x28')]]={'$like':'%'+_0x5b9f28['query'][_0x949e('0x3b')]+'%'};return _0x498fa3;}})});}_0x5b2b0b=_[_0x949e('0x3c')]({},_0x5b2b0b,_0x5b9f28['options']);var _0x5084dc={'where':_0x5b2b0b['where']};return db[_0x949e('0x2b')][_0x949e('0x1d')](_0x5084dc)['then'](function(_0x59c024){_0x4e169d['count']=_0x59c024;if(_0x5b9f28[_0x949e('0x2e')][_0x949e('0x3f')]){_0x5b2b0b['include']=[{'all':!![]}];}return db[_0x949e('0x2b')][_0x949e('0x40')](_0x5b2b0b);})['then'](function(_0x3a1bc7){_0x4e169d[_0x949e('0x41')]=_0x3a1bc7;return _0x4e169d;})[_0x949e('0x25')](respondWithFilteredResult(_0x1867d9,_0x5b2b0b))[_0x949e('0x42')](handleError(_0x1867d9,null));};exports['show']=function(_0x58b34b,_0x2bca69){var _0x590aa7={'raw':!![],'where':{'id':_0x58b34b[_0x949e('0x43')]['id']}},_0x7201da={};_0x7201da[_0x949e('0x32')]=_[_0x949e('0x2f')](db[_0x949e('0x2b')]['rawAttributes']);_0x7201da['query']=_[_0x949e('0x2f')](_0x58b34b['query']);_0x7201da[_0x949e('0x30')]=_[_0x949e('0x31')](_0x7201da[_0x949e('0x32')],_0x7201da[_0x949e('0x2e')]);_0x590aa7[_0x949e('0x33')]=_[_0x949e('0x31')](_0x7201da['model'],qs['fields'](_0x58b34b[_0x949e('0x2e')][_0x949e('0x34')]));_0x590aa7[_0x949e('0x33')]=_0x590aa7[_0x949e('0x33')][_0x949e('0x35')]?_0x590aa7['attributes']:_0x7201da[_0x949e('0x32')];if(_0x58b34b[_0x949e('0x2e')]['includeAll']){_0x590aa7[_0x949e('0x44')]=[{'all':!![]}];}_0x590aa7=_[_0x949e('0x3c')]({},_0x590aa7,_0x58b34b[_0x949e('0x45')]);return db[_0x949e('0x2b')][_0x949e('0x46')](_0x590aa7)[_0x949e('0x25')](handleEntityNotFound(_0x2bca69,null))[_0x949e('0x25')](respondWithResult(_0x2bca69,null))[_0x949e('0x42')](handleError(_0x2bca69,null));};exports[_0x949e('0x47')]=function(_0x4913f5,_0x1599ea){return db['FaxQueueReport'][_0x949e('0x47')](_0x4913f5[_0x949e('0x48')],{})['then'](respondWithResult(_0x1599ea,0xc9))[_0x949e('0x42')](handleError(_0x1599ea,null));};exports[_0x949e('0x49')]=function(_0x121355,_0x2e2b6a){if(_0x121355[_0x949e('0x48')]['id']){delete _0x121355[_0x949e('0x48')]['id'];}return db[_0x949e('0x2b')][_0x949e('0x46')]({'where':{'id':_0x121355['params']['id']}})[_0x949e('0x25')](handleEntityNotFound(_0x2e2b6a,null))[_0x949e('0x25')](saveUpdates(_0x121355[_0x949e('0x48')],null))[_0x949e('0x25')](respondWithResult(_0x2e2b6a,null))[_0x949e('0x42')](handleError(_0x2e2b6a,null));};exports['destroy']=function(_0x5f23b2,_0x46a4fe){return db[_0x949e('0x2b')]['find']({'where':{'id':_0x5f23b2[_0x949e('0x43')]['id']}})[_0x949e('0x25')](handleEntityNotFound(_0x46a4fe,null))[_0x949e('0x25')](removeEntity(_0x46a4fe,null))[_0x949e('0x42')](handleError(_0x46a4fe,null));};exports['describe']=function(_0x4b990e,_0x450d16){return db[_0x949e('0x2b')][_0x949e('0x4a')]()[_0x949e('0x25')](respondWithResult(_0x450d16,null))[_0x949e('0x42')](handleError(_0x450d16,null));}; \ No newline at end of file +var _0x0f9f=['create','body','update','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','keys','filters','intersection','attributes','model','fields','query','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch'];(function(_0x51b829,_0xb2594c){var _0x12437a=function(_0x480822){while(--_0x480822){_0x51b829['push'](_0x51b829['shift']());}};_0x12437a(++_0xb2594c);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0xb36ccf,_0x24c93b){_0xb36ccf=_0xb36ccf-0x0;var _0x37b01e=_0x0f9f[_0xb36ccf];return _0x37b01e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf0f9('0x0'));var zipdir=require(_0xf0f9('0x1'));var jsonpatch=require(_0xf0f9('0x2'));var rp=require('request-promise');var moment=require(_0xf0f9('0x3'));var BPromise=require(_0xf0f9('0x4'));var Mustache=require(_0xf0f9('0x5'));var util=require(_0xf0f9('0x6'));var path=require(_0xf0f9('0x7'));var sox=require(_0xf0f9('0x8'));var csv=require(_0xf0f9('0x9'));var ejs=require(_0xf0f9('0xa'));var fs=require('fs');var fs_extra=require(_0xf0f9('0xb'));var _=require(_0xf0f9('0xc'));var squel=require('squel');var crypto=require(_0xf0f9('0xd'));var jsforce=require(_0xf0f9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf0f9('0x9'));var querystring=require(_0xf0f9('0xf'));var Papa=require(_0xf0f9('0x10'));var Redis=require('ioredis');var authService=require(_0xf0f9('0x11'));var qs=require(_0xf0f9('0x12'));var as=require(_0xf0f9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf0f9('0x14'));var utils=require(_0xf0f9('0x15'));var config=require(_0xf0f9('0x16'));var licenseUtil=require(_0xf0f9('0x17'));var db=require(_0xf0f9('0x18'))['db'];function respondWithStatusCode(_0x32d17f,_0x2360eb){_0x2360eb=_0x2360eb||0xcc;return function(_0x4f27c2){if(_0x4f27c2){return _0x32d17f[_0xf0f9('0x19')](_0x2360eb);}return _0x32d17f[_0xf0f9('0x1a')](_0x2360eb)[_0xf0f9('0x1b')]();};}function respondWithResult(_0x200514,_0x524169){_0x524169=_0x524169||0xc8;return function(_0x51d78a){if(_0x51d78a){return _0x200514[_0xf0f9('0x1a')](_0x524169)[_0xf0f9('0x1c')](_0x51d78a);}};}function respondWithFilteredResult(_0xa7d48c,_0x2e2955){return function(_0x2b05e3){if(_0x2b05e3){var _0x2f5bec=typeof _0x2e2955[_0xf0f9('0x1d')]===_0xf0f9('0x1e')&&typeof _0x2e2955[_0xf0f9('0x1f')]===_0xf0f9('0x1e');var _0x4d3534=_0x2b05e3['count'];var _0x350a48=_0x2f5bec?0x0:_0x2e2955[_0xf0f9('0x1d')];var _0x4c4e17=_0x2f5bec?_0x2b05e3[_0xf0f9('0x20')]:_0x2e2955['offset']+_0x2e2955['limit'];var _0x42c157;if(_0x4c4e17>=_0x4d3534){_0x4c4e17=_0x4d3534;_0x42c157=0xc8;}else{_0x42c157=0xce;}_0xa7d48c[_0xf0f9('0x1a')](_0x42c157);return _0xa7d48c[_0xf0f9('0x21')](_0xf0f9('0x22'),_0x350a48+'-'+_0x4c4e17+'/'+_0x4d3534)[_0xf0f9('0x1c')](_0x2b05e3);}return null;};}function patchUpdates(_0x4ed9ff){return function(_0x5ccbc9){try{jsonpatch['apply'](_0x5ccbc9,_0x4ed9ff,!![]);}catch(_0x102336){return BPromise[_0xf0f9('0x23')](_0x102336);}return _0x5ccbc9[_0xf0f9('0x24')]();};}function saveUpdates(_0x5d87a9,_0x4a8726){return function(_0x209cd4){if(_0x209cd4){return _0x209cd4['update'](_0x5d87a9)[_0xf0f9('0x25')](function(_0x414f87){return _0x414f87;});}return null;};}function removeEntity(_0x173c79,_0x570c68){return function(_0x33dfca){if(_0x33dfca){return _0x33dfca[_0xf0f9('0x26')]()[_0xf0f9('0x25')](function(){_0x173c79['status'](0xcc)[_0xf0f9('0x1b')]();});}};}function handleEntityNotFound(_0x33f070,_0x2879a2){return function(_0x185e1e){if(!_0x185e1e){_0x33f070[_0xf0f9('0x19')](0x194);}return _0x185e1e;};}function handleError(_0x19d750,_0x5df7f5){_0x5df7f5=_0x5df7f5||0x1f4;return function(_0x28e1f6){logger['error'](_0x28e1f6[_0xf0f9('0x27')]);if(_0x28e1f6[_0xf0f9('0x28')]){delete _0x28e1f6['name'];}_0x19d750['status'](_0x5df7f5)[_0xf0f9('0x29')](_0x28e1f6);};}exports['index']=function(_0x2121b8,_0x3f236e){var _0x269e47={},_0x353502={},_0x3ec658={'count':0x0,'rows':[]};var _0x39cd34=_[_0xf0f9('0x2a')](db[_0xf0f9('0x2b')][_0xf0f9('0x2c')],function(_0x4e4e08){return{'name':_0x4e4e08[_0xf0f9('0x2d')],'type':_0x4e4e08[_0xf0f9('0x2e')]['key']};});_0x353502['model']=_[_0xf0f9('0x2a')](_0x39cd34,'name');_0x353502['query']=_[_0xf0f9('0x2f')](_0x2121b8['query']);_0x353502[_0xf0f9('0x30')]=_[_0xf0f9('0x31')](_0x353502['model'],_0x353502['query']);_0x269e47[_0xf0f9('0x32')]=_[_0xf0f9('0x31')](_0x353502[_0xf0f9('0x33')],qs[_0xf0f9('0x34')](_0x2121b8[_0xf0f9('0x35')][_0xf0f9('0x34')]));_0x269e47[_0xf0f9('0x32')]=_0x269e47[_0xf0f9('0x32')][_0xf0f9('0x36')]?_0x269e47[_0xf0f9('0x32')]:_0x353502[_0xf0f9('0x33')];if(!_0x2121b8[_0xf0f9('0x35')][_0xf0f9('0x37')]('nolimit')){_0x269e47[_0xf0f9('0x1f')]=qs['limit'](_0x2121b8[_0xf0f9('0x35')][_0xf0f9('0x1f')]);_0x269e47[_0xf0f9('0x1d')]=qs[_0xf0f9('0x1d')](_0x2121b8[_0xf0f9('0x35')][_0xf0f9('0x1d')]);}_0x269e47[_0xf0f9('0x38')]=qs['sort'](_0x2121b8['query'][_0xf0f9('0x39')]);_0x269e47[_0xf0f9('0x3a')]=qs[_0xf0f9('0x30')](_[_0xf0f9('0x3b')](_0x2121b8[_0xf0f9('0x35')],_0x353502['filters']),_0x39cd34);if(_0x2121b8[_0xf0f9('0x35')][_0xf0f9('0x3c')]){_0x269e47[_0xf0f9('0x3a')]=_[_0xf0f9('0x3d')](_0x269e47[_0xf0f9('0x3a')],{'$or':_['map'](_0x39cd34,function(_0x2a5860){if(_0x2a5860[_0xf0f9('0x2e')]!==_0xf0f9('0x3e')){var _0x208aa9={};_0x208aa9[_0x2a5860[_0xf0f9('0x28')]]={'$like':'%'+_0x2121b8[_0xf0f9('0x35')]['filter']+'%'};return _0x208aa9;}})});}_0x269e47=_[_0xf0f9('0x3d')]({},_0x269e47,_0x2121b8[_0xf0f9('0x3f')]);var _0x13b8c5={'where':_0x269e47['where']};return db[_0xf0f9('0x2b')][_0xf0f9('0x20')](_0x13b8c5)[_0xf0f9('0x25')](function(_0xa2b82b){_0x3ec658[_0xf0f9('0x20')]=_0xa2b82b;if(_0x2121b8[_0xf0f9('0x35')][_0xf0f9('0x40')]){_0x269e47[_0xf0f9('0x41')]=[{'all':!![]}];}return db[_0xf0f9('0x2b')][_0xf0f9('0x42')](_0x269e47);})[_0xf0f9('0x25')](function(_0x149870){_0x3ec658[_0xf0f9('0x43')]=_0x149870;return _0x3ec658;})['then'](respondWithFilteredResult(_0x3f236e,_0x269e47))['catch'](handleError(_0x3f236e,null));};exports[_0xf0f9('0x44')]=function(_0x4a3355,_0x54daca){var _0x4e8234={'raw':!![],'where':{'id':_0x4a3355[_0xf0f9('0x45')]['id']}},_0x2cb95d={};_0x2cb95d[_0xf0f9('0x33')]=_[_0xf0f9('0x2f')](db[_0xf0f9('0x2b')][_0xf0f9('0x2c')]);_0x2cb95d[_0xf0f9('0x35')]=_[_0xf0f9('0x2f')](_0x4a3355[_0xf0f9('0x35')]);_0x2cb95d['filters']=_[_0xf0f9('0x31')](_0x2cb95d[_0xf0f9('0x33')],_0x2cb95d[_0xf0f9('0x35')]);_0x4e8234['attributes']=_[_0xf0f9('0x31')](_0x2cb95d[_0xf0f9('0x33')],qs[_0xf0f9('0x34')](_0x4a3355['query'][_0xf0f9('0x34')]));_0x4e8234[_0xf0f9('0x32')]=_0x4e8234['attributes'][_0xf0f9('0x36')]?_0x4e8234[_0xf0f9('0x32')]:_0x2cb95d[_0xf0f9('0x33')];if(_0x4a3355[_0xf0f9('0x35')]['includeAll']){_0x4e8234[_0xf0f9('0x41')]=[{'all':!![]}];}_0x4e8234=_[_0xf0f9('0x3d')]({},_0x4e8234,_0x4a3355[_0xf0f9('0x3f')]);return db[_0xf0f9('0x2b')][_0xf0f9('0x46')](_0x4e8234)[_0xf0f9('0x25')](handleEntityNotFound(_0x54daca,null))['then'](respondWithResult(_0x54daca,null))[_0xf0f9('0x47')](handleError(_0x54daca,null));};exports['create']=function(_0x340374,_0x38956b){return db[_0xf0f9('0x2b')][_0xf0f9('0x48')](_0x340374[_0xf0f9('0x49')],{})[_0xf0f9('0x25')](respondWithResult(_0x38956b,0xc9))[_0xf0f9('0x47')](handleError(_0x38956b,null));};exports[_0xf0f9('0x4a')]=function(_0x1f47fa,_0x13bb13){if(_0x1f47fa[_0xf0f9('0x49')]['id']){delete _0x1f47fa[_0xf0f9('0x49')]['id'];}return db[_0xf0f9('0x2b')][_0xf0f9('0x46')]({'where':{'id':_0x1f47fa[_0xf0f9('0x45')]['id']}})[_0xf0f9('0x25')](handleEntityNotFound(_0x13bb13,null))[_0xf0f9('0x25')](saveUpdates(_0x1f47fa[_0xf0f9('0x49')],null))[_0xf0f9('0x25')](respondWithResult(_0x13bb13,null))[_0xf0f9('0x47')](handleError(_0x13bb13,null));};exports[_0xf0f9('0x26')]=function(_0x40711c,_0x3db0b2){return db[_0xf0f9('0x2b')]['find']({'where':{'id':_0x40711c['params']['id']}})[_0xf0f9('0x25')](handleEntityNotFound(_0x3db0b2,null))['then'](removeEntity(_0x3db0b2,null))[_0xf0f9('0x47')](handleError(_0x3db0b2,null));};exports[_0xf0f9('0x4b')]=function(_0x1821bc,_0x542de6){return db[_0xf0f9('0x2b')]['describe']()[_0xf0f9('0x25')](respondWithResult(_0x542de6,null))[_0xf0f9('0x47')](handleError(_0x542de6,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index d143b94..ca3ac17 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 _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x590fc4,_0x44de6f){var _0x59c99d=function(_0x4bf657){while(--_0x4bf657){_0x590fc4['push'](_0x590fc4['shift']());}};_0x59c99d(++_0x44de6f);}(_0x4975,0x86));var _0x5497=function(_0x1ad8f,_0x2cd4f4){_0x1ad8f=_0x1ad8f-0x0;var _0xbfcab=_0x4975[_0x1ad8f];return _0xbfcab;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash'];(function(_0x410345,_0x24bc50){var _0x188f0d=function(_0x48ff23){while(--_0x48ff23){_0x410345['push'](_0x410345['shift']());}};_0x188f0d(++_0x24bc50);}(_0x5fc3,0xa8));var _0x35fc=function(_0xf55e73,_0x3fecc5){_0xf55e73=_0xf55e73-0x0;var _0x116b99=_0x5fc3[_0xf55e73];return _0x116b99;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('FaxQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('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 a876580..9c01ba8 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 _0x2f54=['../../config/environment','jayson/promise','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','update','where','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5c47f7,_0xc34ca6){var _0x53037a=function(_0x1fbca4){while(--_0x1fbca4){_0x5c47f7['push'](_0x5c47f7['shift']());}};_0x53037a(++_0xc34ca6);}(_0x2f54,0x142));var _0x42f5=function(_0x1602fd,_0x847115){_0x1602fd=_0x1602fd-0x0;var _0x1eaf42=_0x2f54[_0x1602fd];return _0x1eaf42;};'use strict';var _=require(_0x42f5('0x0'));var util=require(_0x42f5('0x1'));var moment=require(_0x42f5('0x2'));var BPromise=require('bluebird');var rs=require(_0x42f5('0x3'));var fs=require('fs');var Redis=require(_0x42f5('0x4'));var db=require(_0x42f5('0x5'))['db'];var utils=require(_0x42f5('0x6'));var logger=require(_0x42f5('0x7'))('rpc');var config=require(_0x42f5('0x8'));var jayson=require(_0x42f5('0x9'));var client=jayson['client'][_0x42f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4db778,_0x1512e1,_0x1446de){return new BPromise(function(_0x1764f6,_0x2ea43d){return client[_0x42f5('0xb')](_0x4db778,_0x1446de)[_0x42f5('0xc')](function(_0x890696){logger[_0x42f5('0xd')](_0x42f5('0xe'),_0x1512e1,_0x42f5('0xf'));logger[_0x42f5('0x10')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x1512e1,'request\x20sent',JSON[_0x42f5('0x11')](_0x890696));if(_0x890696[_0x42f5('0x12')]){if(_0x890696[_0x42f5('0x12')][_0x42f5('0x13')]===0x1f4){logger[_0x42f5('0x12')](_0x42f5('0xe'),_0x1512e1,_0x890696[_0x42f5('0x12')][_0x42f5('0x14')]);return _0x2ea43d(_0x890696[_0x42f5('0x12')][_0x42f5('0x14')]);}logger[_0x42f5('0x12')](_0x42f5('0xe'),_0x1512e1,_0x890696[_0x42f5('0x12')][_0x42f5('0x14')]);return _0x1764f6(_0x890696[_0x42f5('0x12')]['message']);}else{logger[_0x42f5('0xd')](_0x42f5('0xe'),_0x1512e1,_0x42f5('0xf'));_0x1764f6(_0x890696[_0x42f5('0x15')][_0x42f5('0x14')]);}})[_0x42f5('0x16')](function(_0x1ccdcc){logger[_0x42f5('0x12')](_0x42f5('0xe'),_0x1512e1,_0x1ccdcc);_0x2ea43d(_0x1ccdcc);});});}exports[_0x42f5('0x17')]=function(_0x59feb3){var _0x5a85bd=this;return new Promise(function(_0x32c21a,_0x34dd2b){return db[_0x42f5('0x18')][_0x42f5('0x19')](_0x59feb3[_0x42f5('0x1a')],{'raw':_0x59feb3[_0x42f5('0x1b')]?_0x59feb3[_0x42f5('0x1b')][_0x42f5('0x1c')]===undefined?!![]:![]:!![]})[_0x42f5('0xc')](function(_0x70b1da){logger[_0x42f5('0xd')](_0x42f5('0x17'),_0x59feb3);logger[_0x42f5('0x10')](_0x42f5('0x17'),_0x59feb3,JSON[_0x42f5('0x11')](_0x70b1da));_0x32c21a(_0x70b1da);})[_0x42f5('0x16')](function(_0x4f4286){logger[_0x42f5('0x12')](_0x42f5('0x17'),_0x4f4286[_0x42f5('0x14')],_0x59feb3);_0x34dd2b(_0x5a85bd[_0x42f5('0x12')](0x1f4,_0x4f4286[_0x42f5('0x14')]));});});};exports[_0x42f5('0x1d')]=function(_0x2be155){var _0x1c86fc=this;return new Promise(function(_0x3761c1,_0x19dd26){return db[_0x42f5('0x18')][_0x42f5('0x1e')](_0x2be155[_0x42f5('0x1a')],{'raw':_0x2be155[_0x42f5('0x1b')]?_0x2be155['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2be155[_0x42f5('0x1b')]?_0x2be155['options'][_0x42f5('0x1f')]||null:null,'attributes':_0x2be155[_0x42f5('0x1b')]?_0x2be155[_0x42f5('0x1b')]['attributes']||null:null,'limit':_0x2be155[_0x42f5('0x1b')]?_0x2be155[_0x42f5('0x1b')][_0x42f5('0x20')]||null:null})[_0x42f5('0xc')](function(_0x6b4ced){logger[_0x42f5('0xd')](_0x42f5('0x1d'),_0x2be155);logger[_0x42f5('0x10')](_0x42f5('0x1d'),_0x2be155,JSON[_0x42f5('0x11')](_0x6b4ced));_0x3761c1(_0x6b4ced);})['catch'](function(_0x484067){logger[_0x42f5('0x12')]('UpdateFaxQueueReport',_0x484067['message'],_0x2be155);_0x19dd26(_0x1c86fc[_0x42f5('0x12')](0x1f4,_0x484067[_0x42f5('0x14')]));});});}; \ No newline at end of file +var _0xfb44=['FaxQueueReport','update','raw','where','attributes','limit','lodash','util','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateFaxQueueReport','create','body','options','catch','UpdateFaxQueueReport'];(function(_0x15c934,_0x30070d){var _0x5d8cb4=function(_0x568684){while(--_0x568684){_0x15c934['push'](_0x15c934['shift']());}};_0x5d8cb4(++_0x30070d);}(_0xfb44,0x186));var _0x4fb4=function(_0x1daab3,_0x12e602){_0x1daab3=_0x1daab3-0x0;var _0x58eef6=_0xfb44[_0x1daab3];return _0x58eef6;};'use strict';var _=require(_0x4fb4('0x0'));var util=require(_0x4fb4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4fb4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4fb4('0x3'));var logger=require(_0x4fb4('0x4'))('rpc');var config=require(_0x4fb4('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4fb4('0x6')][_0x4fb4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2c6b4e,_0xb432f8,_0x39f36a){return new BPromise(function(_0x5341ae,_0xc92b37){return client[_0x4fb4('0x8')](_0x2c6b4e,_0x39f36a)[_0x4fb4('0x9')](function(_0x3c7815){logger[_0x4fb4('0xa')](_0x4fb4('0xb'),_0xb432f8,'request\x20sent');logger[_0x4fb4('0xc')](_0x4fb4('0xd'),_0xb432f8,_0x4fb4('0xe'),JSON[_0x4fb4('0xf')](_0x3c7815));if(_0x3c7815['error']){if(_0x3c7815[_0x4fb4('0x10')][_0x4fb4('0x11')]===0x1f4){logger[_0x4fb4('0x10')](_0x4fb4('0xb'),_0xb432f8,_0x3c7815[_0x4fb4('0x10')][_0x4fb4('0x12')]);return _0xc92b37(_0x3c7815['error']['message']);}logger[_0x4fb4('0x10')](_0x4fb4('0xb'),_0xb432f8,_0x3c7815[_0x4fb4('0x10')][_0x4fb4('0x12')]);return _0x5341ae(_0x3c7815[_0x4fb4('0x10')][_0x4fb4('0x12')]);}else{logger[_0x4fb4('0xa')](_0x4fb4('0xb'),_0xb432f8,_0x4fb4('0xe'));_0x5341ae(_0x3c7815[_0x4fb4('0x13')][_0x4fb4('0x12')]);}})['catch'](function(_0x275089){logger[_0x4fb4('0x10')](_0x4fb4('0xb'),_0xb432f8,_0x275089);_0xc92b37(_0x275089);});});}exports[_0x4fb4('0x14')]=function(_0x485f48){var _0x29b38f=this;return new Promise(function(_0x2a9bc8,_0x1824ca){return db['FaxQueueReport'][_0x4fb4('0x15')](_0x485f48[_0x4fb4('0x16')],{'raw':_0x485f48[_0x4fb4('0x17')]?_0x485f48[_0x4fb4('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x504b24){logger[_0x4fb4('0xa')](_0x4fb4('0x14'),_0x485f48);logger[_0x4fb4('0xc')]('CreateFaxQueueReport',_0x485f48,JSON[_0x4fb4('0xf')](_0x504b24));_0x2a9bc8(_0x504b24);})[_0x4fb4('0x18')](function(_0x5c3335){logger[_0x4fb4('0x10')](_0x4fb4('0x14'),_0x5c3335[_0x4fb4('0x12')],_0x485f48);_0x1824ca(_0x29b38f['error'](0x1f4,_0x5c3335['message']));});});};exports[_0x4fb4('0x19')]=function(_0x2bf467){var _0x2783d7=this;return new Promise(function(_0x488ae2,_0x22ffe7){return db[_0x4fb4('0x1a')][_0x4fb4('0x1b')](_0x2bf467[_0x4fb4('0x16')],{'raw':_0x2bf467['options']?_0x2bf467[_0x4fb4('0x17')][_0x4fb4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bf467[_0x4fb4('0x17')]?_0x2bf467[_0x4fb4('0x17')][_0x4fb4('0x1d')]||null:null,'attributes':_0x2bf467[_0x4fb4('0x17')]?_0x2bf467[_0x4fb4('0x17')][_0x4fb4('0x1e')]||null:null,'limit':_0x2bf467[_0x4fb4('0x17')]?_0x2bf467['options'][_0x4fb4('0x1f')]||null:null})[_0x4fb4('0x9')](function(_0x48adab){logger[_0x4fb4('0xa')]('UpdateFaxQueueReport',_0x2bf467);logger[_0x4fb4('0xc')](_0x4fb4('0x19'),_0x2bf467,JSON['stringify'](_0x48adab));_0x488ae2(_0x48adab);})['catch'](function(_0x58af37){logger[_0x4fb4('0x10')]('UpdateFaxQueueReport',_0x58af37[_0x4fb4('0x12')],_0x2bf467);_0x22ffe7(_0x2783d7[_0x4fb4('0x10')](0x1f4,_0x58af37[_0x4fb4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 4f22c82..ccd0822 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 _0x47c6=['destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','delete'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x47c6,0xb5));var _0x647c=function(_0x1630f1,_0x2eba83){_0x1630f1=_0x1630f1-0x0;var _0x1531e6=_0x47c6[_0x1630f1];return _0x1531e6;};'use strict';var multer=require(_0x647c('0x0'));var util=require(_0x647c('0x1'));var path=require(_0x647c('0x2'));var timeout=require(_0x647c('0x3'));var express=require('express');var router=express[_0x647c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x647c('0x5'));var interaction=require(_0x647c('0x6'));var config=require('../../config/environment');var controller=require(_0x647c('0x7'));router[_0x647c('0x8')]('/',auth['isAuthenticated'](),controller[_0x647c('0x9')]);router[_0x647c('0x8')](_0x647c('0xa'),auth[_0x647c('0xb')](),controller[_0x647c('0xc')]);router[_0x647c('0x8')]('/:id',auth[_0x647c('0xb')](),controller[_0x647c('0xd')]);router[_0x647c('0xe')]('/',auth[_0x647c('0xb')](),controller[_0x647c('0xf')]);router[_0x647c('0x10')](_0x647c('0x11'),auth[_0x647c('0xb')](),controller['update']);router[_0x647c('0x12')](_0x647c('0x11'),auth['isAuthenticated'](),controller[_0x647c('0x13')]);module['exports']=router; \ No newline at end of file +var _0x7347=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','destroy','exports'];(function(_0x2e5304,_0x4a4b3a){var _0x190524=function(_0x2dec7a){while(--_0x2dec7a){_0x2e5304['push'](_0x2e5304['shift']());}};_0x190524(++_0x4a4b3a);}(_0x7347,0xf0));var _0x7734=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x7347[_0x525c7b];return _0x27b33e;};'use strict';var multer=require(_0x7734('0x0'));var util=require(_0x7734('0x1'));var path=require(_0x7734('0x2'));var timeout=require(_0x7734('0x3'));var express=require(_0x7734('0x4'));var router=express[_0x7734('0x5')]();var fs_extra=require(_0x7734('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7734('0x7'));var config=require('../../config/environment');var controller=require(_0x7734('0x8'));router[_0x7734('0x9')]('/',auth[_0x7734('0xa')](),controller[_0x7734('0xb')]);router[_0x7734('0x9')](_0x7734('0xc'),auth[_0x7734('0xa')](),controller[_0x7734('0xd')]);router[_0x7734('0x9')](_0x7734('0xe'),auth[_0x7734('0xa')](),controller[_0x7734('0xf')]);router['post']('/',auth[_0x7734('0xa')](),controller['create']);router[_0x7734('0x10')](_0x7734('0xe'),auth[_0x7734('0xa')](),controller[_0x7734('0x11')]);router['delete'](_0x7734('0xe'),auth[_0x7734('0xa')](),controller[_0x7734('0x12')]);module[_0x7734('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index b4f7923..93a5ed8 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x29fcaf,_0x20c943){var _0x4adcb2=function(_0x59e82a){while(--_0x59e82a){_0x29fcaf['push'](_0x29fcaf['shift']());}};_0x4adcb2(++_0x20c943);}(_0x54ef,0x112));var _0xf54e=function(_0x335627,_0x24face){_0x335627=_0x335627-0x0;var _0x4c0082=_0x54ef[_0x335627];return _0x4c0082;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x53c6e8,_0x5e5338){var _0xc573ff=function(_0x5b56ac){while(--_0x5b56ac){_0x53c6e8['push'](_0x53c6e8['shift']());}};_0xc573ff(++_0x5e5338);}(_0xf4eb,0xec));var _0xbf4e=function(_0x285ce3,_0x20b6af){_0x285ce3=_0x285ce3-0x0;var _0xb2b5a5=_0xf4eb[_0x285ce3];return _0xb2b5a5;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 6362963..00a4245 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 _0xbd94=['type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','send','index','map','FaxTransferReport','rawAttributes','fieldName'];(function(_0x2f3b82,_0x368cc2){var _0x52139d=function(_0x35ebf1){while(--_0x35ebf1){_0x2f3b82['push'](_0x2f3b82['shift']());}};_0x52139d(++_0x368cc2);}(_0xbd94,0x1d3));var _0x4bd9=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xbd94[_0x39096d];return _0x13da4f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4bd9('0x0'));var zipdir=require(_0x4bd9('0x1'));var jsonpatch=require(_0x4bd9('0x2'));var rp=require(_0x4bd9('0x3'));var moment=require('moment');var BPromise=require(_0x4bd9('0x4'));var Mustache=require(_0x4bd9('0x5'));var util=require(_0x4bd9('0x6'));var path=require('path');var sox=require(_0x4bd9('0x7'));var csv=require(_0x4bd9('0x8'));var ejs=require(_0x4bd9('0x9'));var fs=require('fs');var fs_extra=require(_0x4bd9('0xa'));var _=require('lodash');var squel=require(_0x4bd9('0xb'));var crypto=require('crypto');var jsforce=require(_0x4bd9('0xc'));var deskjs=require(_0x4bd9('0xd'));var toCsv=require(_0x4bd9('0x8'));var querystring=require(_0x4bd9('0xe'));var Papa=require('papaparse');var Redis=require(_0x4bd9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4bd9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4bd9('0x11'))('api');var utils=require(_0x4bd9('0x12'));var config=require(_0x4bd9('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4bd9('0x14'))['db'];function respondWithStatusCode(_0x2cc3ea,_0x8633b){_0x8633b=_0x8633b||0xcc;return function(_0x5c878a){if(_0x5c878a){return _0x2cc3ea[_0x4bd9('0x15')](_0x8633b);}return _0x2cc3ea[_0x4bd9('0x16')](_0x8633b)[_0x4bd9('0x17')]();};}function respondWithResult(_0x2ae61e,_0x62bc9a){_0x62bc9a=_0x62bc9a||0xc8;return function(_0x4628d2){if(_0x4628d2){return _0x2ae61e['status'](_0x62bc9a)[_0x4bd9('0x18')](_0x4628d2);}};}function respondWithFilteredResult(_0x3cc512,_0xe7a236){return function(_0x839efb){if(_0x839efb){var _0x75d268=typeof _0xe7a236[_0x4bd9('0x19')]===_0x4bd9('0x1a')&&typeof _0xe7a236[_0x4bd9('0x1b')]===_0x4bd9('0x1a');var _0x404bc6=_0x839efb[_0x4bd9('0x1c')];var _0x2999bf=_0x75d268?0x0:_0xe7a236[_0x4bd9('0x19')];var _0x475174=_0x75d268?_0x839efb[_0x4bd9('0x1c')]:_0xe7a236['offset']+_0xe7a236[_0x4bd9('0x1b')];var _0xf746b1;if(_0x475174>=_0x404bc6){_0x475174=_0x404bc6;_0xf746b1=0xc8;}else{_0xf746b1=0xce;}_0x3cc512[_0x4bd9('0x16')](_0xf746b1);return _0x3cc512[_0x4bd9('0x1d')](_0x4bd9('0x1e'),_0x2999bf+'-'+_0x475174+'/'+_0x404bc6)[_0x4bd9('0x18')](_0x839efb);}return null;};}function patchUpdates(_0x47149b){return function(_0x5ab13b){try{jsonpatch[_0x4bd9('0x1f')](_0x5ab13b,_0x47149b,!![]);}catch(_0x36c634){return BPromise[_0x4bd9('0x20')](_0x36c634);}return _0x5ab13b['save']();};}function saveUpdates(_0x53b803,_0x2cb947){return function(_0x5ab731){if(_0x5ab731){return _0x5ab731[_0x4bd9('0x21')](_0x53b803)[_0x4bd9('0x22')](function(_0x22ef4d){return _0x22ef4d;});}return null;};}function removeEntity(_0x3c46d4,_0x2fb544){return function(_0x338e58){if(_0x338e58){return _0x338e58[_0x4bd9('0x23')]()[_0x4bd9('0x22')](function(){_0x3c46d4[_0x4bd9('0x16')](0xcc)[_0x4bd9('0x17')]();});}};}function handleEntityNotFound(_0x4e5f08,_0x3b13e0){return function(_0x32ecd4){if(!_0x32ecd4){_0x4e5f08[_0x4bd9('0x15')](0x194);}return _0x32ecd4;};}function handleError(_0x18eeaa,_0x42f02c){_0x42f02c=_0x42f02c||0x1f4;return function(_0x2e1a35){logger[_0x4bd9('0x24')](_0x2e1a35[_0x4bd9('0x25')]);if(_0x2e1a35['name']){delete _0x2e1a35['name'];}_0x18eeaa[_0x4bd9('0x16')](_0x42f02c)[_0x4bd9('0x26')](_0x2e1a35);};}exports[_0x4bd9('0x27')]=function(_0x131aa6,_0xcf7464){var _0x3c9326={},_0x10d1b2={},_0x5ec02c={'count':0x0,'rows':[]};var _0xe8a5bb=_[_0x4bd9('0x28')](db[_0x4bd9('0x29')][_0x4bd9('0x2a')],function(_0x291554){return{'name':_0x291554[_0x4bd9('0x2b')],'type':_0x291554[_0x4bd9('0x2c')]['key']};});_0x10d1b2[_0x4bd9('0x2d')]=_[_0x4bd9('0x28')](_0xe8a5bb,_0x4bd9('0x2e'));_0x10d1b2[_0x4bd9('0x2f')]=_[_0x4bd9('0x30')](_0x131aa6['query']);_0x10d1b2[_0x4bd9('0x31')]=_[_0x4bd9('0x32')](_0x10d1b2[_0x4bd9('0x2d')],_0x10d1b2[_0x4bd9('0x2f')]);_0x3c9326[_0x4bd9('0x33')]=_[_0x4bd9('0x32')](_0x10d1b2[_0x4bd9('0x2d')],qs[_0x4bd9('0x34')](_0x131aa6['query']['fields']));_0x3c9326['attributes']=_0x3c9326[_0x4bd9('0x33')][_0x4bd9('0x35')]?_0x3c9326[_0x4bd9('0x33')]:_0x10d1b2['model'];if(!_0x131aa6[_0x4bd9('0x2f')][_0x4bd9('0x36')](_0x4bd9('0x37'))){_0x3c9326['limit']=qs[_0x4bd9('0x1b')](_0x131aa6[_0x4bd9('0x2f')][_0x4bd9('0x1b')]);_0x3c9326[_0x4bd9('0x19')]=qs[_0x4bd9('0x19')](_0x131aa6['query']['offset']);}_0x3c9326[_0x4bd9('0x38')]=qs[_0x4bd9('0x39')](_0x131aa6[_0x4bd9('0x2f')]['sort']);_0x3c9326[_0x4bd9('0x3a')]=qs[_0x4bd9('0x31')](_[_0x4bd9('0x3b')](_0x131aa6[_0x4bd9('0x2f')],_0x10d1b2[_0x4bd9('0x31')]),_0xe8a5bb);if(_0x131aa6[_0x4bd9('0x2f')][_0x4bd9('0x3c')]){_0x3c9326[_0x4bd9('0x3a')]=_[_0x4bd9('0x3d')](_0x3c9326[_0x4bd9('0x3a')],{'$or':_[_0x4bd9('0x28')](_0xe8a5bb,function(_0x2d0bee){if(_0x2d0bee[_0x4bd9('0x2c')]!==_0x4bd9('0x3e')){var _0x5613be={};_0x5613be[_0x2d0bee[_0x4bd9('0x2e')]]={'$like':'%'+_0x131aa6[_0x4bd9('0x2f')]['filter']+'%'};return _0x5613be;}})});}_0x3c9326=_[_0x4bd9('0x3d')]({},_0x3c9326,_0x131aa6[_0x4bd9('0x3f')]);var _0x31b58e={'where':_0x3c9326[_0x4bd9('0x3a')]};return db[_0x4bd9('0x29')][_0x4bd9('0x1c')](_0x31b58e)[_0x4bd9('0x22')](function(_0x36d772){_0x5ec02c[_0x4bd9('0x1c')]=_0x36d772;if(_0x131aa6['query'][_0x4bd9('0x40')]){_0x3c9326[_0x4bd9('0x41')]=[{'all':!![]}];}return db[_0x4bd9('0x29')]['findAll'](_0x3c9326);})[_0x4bd9('0x22')](function(_0x4dcac5){_0x5ec02c[_0x4bd9('0x42')]=_0x4dcac5;return _0x5ec02c;})[_0x4bd9('0x22')](respondWithFilteredResult(_0xcf7464,_0x3c9326))[_0x4bd9('0x43')](handleError(_0xcf7464,null));};exports['show']=function(_0x54fad4,_0xbb473d){var _0x2d6422={'raw':!![],'where':{'id':_0x54fad4['params']['id']}},_0x24c664={};_0x24c664['model']=_[_0x4bd9('0x30')](db[_0x4bd9('0x29')][_0x4bd9('0x2a')]);_0x24c664['query']=_[_0x4bd9('0x30')](_0x54fad4[_0x4bd9('0x2f')]);_0x24c664['filters']=_[_0x4bd9('0x32')](_0x24c664[_0x4bd9('0x2d')],_0x24c664[_0x4bd9('0x2f')]);_0x2d6422[_0x4bd9('0x33')]=_[_0x4bd9('0x32')](_0x24c664[_0x4bd9('0x2d')],qs[_0x4bd9('0x34')](_0x54fad4[_0x4bd9('0x2f')][_0x4bd9('0x34')]));_0x2d6422[_0x4bd9('0x33')]=_0x2d6422['attributes']['length']?_0x2d6422['attributes']:_0x24c664[_0x4bd9('0x2d')];if(_0x54fad4[_0x4bd9('0x2f')]['includeAll']){_0x2d6422[_0x4bd9('0x41')]=[{'all':!![]}];}_0x2d6422=_[_0x4bd9('0x3d')]({},_0x2d6422,_0x54fad4[_0x4bd9('0x3f')]);return db[_0x4bd9('0x29')]['find'](_0x2d6422)[_0x4bd9('0x22')](handleEntityNotFound(_0xbb473d,null))[_0x4bd9('0x22')](respondWithResult(_0xbb473d,null))[_0x4bd9('0x43')](handleError(_0xbb473d,null));};exports[_0x4bd9('0x44')]=function(_0x199f95,_0x3e610a){return db[_0x4bd9('0x29')][_0x4bd9('0x44')](_0x199f95[_0x4bd9('0x45')],{})['then'](respondWithResult(_0x3e610a,0xc9))[_0x4bd9('0x43')](handleError(_0x3e610a,null));};exports[_0x4bd9('0x21')]=function(_0x2ec46d,_0x4a791d){if(_0x2ec46d[_0x4bd9('0x45')]['id']){delete _0x2ec46d[_0x4bd9('0x45')]['id'];}return db['FaxTransferReport'][_0x4bd9('0x46')]({'where':{'id':_0x2ec46d['params']['id']}})[_0x4bd9('0x22')](handleEntityNotFound(_0x4a791d,null))[_0x4bd9('0x22')](saveUpdates(_0x2ec46d['body'],null))[_0x4bd9('0x22')](respondWithResult(_0x4a791d,null))[_0x4bd9('0x43')](handleError(_0x4a791d,null));};exports[_0x4bd9('0x23')]=function(_0x20063c,_0x5f0a15){return db['FaxTransferReport'][_0x4bd9('0x46')]({'where':{'id':_0x20063c[_0x4bd9('0x47')]['id']}})[_0x4bd9('0x22')](handleEntityNotFound(_0x5f0a15,null))[_0x4bd9('0x22')](removeEntity(_0x5f0a15,null))[_0x4bd9('0x43')](handleError(_0x5f0a15,null));};exports[_0x4bd9('0x48')]=function(_0x1db535,_0xd83e89){return db['FaxTransferReport'][_0x4bd9('0x48')]()['then'](respondWithResult(_0xd83e89,null))[_0x4bd9('0x43')](handleError(_0xd83e89,null));}; \ No newline at end of file +var _0x4878=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','include','findAll','rows','catch','keys','length','options','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined'];(function(_0x1e1986,_0x56f395){var _0x170b43=function(_0x121ab1){while(--_0x121ab1){_0x1e1986['push'](_0x1e1986['shift']());}};_0x170b43(++_0x56f395);}(_0x4878,0x109));var _0x8487=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4878[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0x8487('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8487('0x1'));var jsonpatch=require(_0x8487('0x2'));var rp=require(_0x8487('0x3'));var moment=require(_0x8487('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8487('0x5'));var path=require(_0x8487('0x6'));var sox=require('sox');var csv=require(_0x8487('0x7'));var ejs=require(_0x8487('0x8'));var fs=require('fs');var fs_extra=require(_0x8487('0x9'));var _=require(_0x8487('0xa'));var squel=require(_0x8487('0xb'));var crypto=require(_0x8487('0xc'));var jsforce=require(_0x8487('0xd'));var deskjs=require(_0x8487('0xe'));var toCsv=require(_0x8487('0x7'));var querystring=require(_0x8487('0xf'));var Papa=require('papaparse');var Redis=require(_0x8487('0x10'));var authService=require(_0x8487('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8487('0x12'));var utils=require(_0x8487('0x13'));var config=require(_0x8487('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x165c39,_0x55f16f){_0x55f16f=_0x55f16f||0xcc;return function(_0x4cff3b){if(_0x4cff3b){return _0x165c39[_0x8487('0x15')](_0x55f16f);}return _0x165c39[_0x8487('0x16')](_0x55f16f)[_0x8487('0x17')]();};}function respondWithResult(_0x15ec9c,_0x4923eb){_0x4923eb=_0x4923eb||0xc8;return function(_0x4cfada){if(_0x4cfada){return _0x15ec9c[_0x8487('0x16')](_0x4923eb)[_0x8487('0x18')](_0x4cfada);}};}function respondWithFilteredResult(_0x3807a9,_0x3e9297){return function(_0xd207a8){if(_0xd207a8){var _0x2bfa4c=typeof _0x3e9297[_0x8487('0x19')]===_0x8487('0x1a')&&typeof _0x3e9297[_0x8487('0x1b')]===_0x8487('0x1a');var _0x1d9935=_0xd207a8[_0x8487('0x1c')];var _0x472eae=_0x2bfa4c?0x0:_0x3e9297[_0x8487('0x19')];var _0x2e764c=_0x2bfa4c?_0xd207a8['count']:_0x3e9297[_0x8487('0x19')]+_0x3e9297[_0x8487('0x1b')];var _0x239ca6;if(_0x2e764c>=_0x1d9935){_0x2e764c=_0x1d9935;_0x239ca6=0xc8;}else{_0x239ca6=0xce;}_0x3807a9[_0x8487('0x16')](_0x239ca6);return _0x3807a9[_0x8487('0x1d')](_0x8487('0x1e'),_0x472eae+'-'+_0x2e764c+'/'+_0x1d9935)[_0x8487('0x18')](_0xd207a8);}return null;};}function patchUpdates(_0x4fb22c){return function(_0x3fbe11){try{jsonpatch[_0x8487('0x1f')](_0x3fbe11,_0x4fb22c,!![]);}catch(_0x1bc491){return BPromise[_0x8487('0x20')](_0x1bc491);}return _0x3fbe11[_0x8487('0x21')]();};}function saveUpdates(_0x18d714,_0x1811f2){return function(_0x5d7899){if(_0x5d7899){return _0x5d7899[_0x8487('0x22')](_0x18d714)[_0x8487('0x23')](function(_0x528e6c){return _0x528e6c;});}return null;};}function removeEntity(_0x3a9581,_0x20cd21){return function(_0x29be83){if(_0x29be83){return _0x29be83[_0x8487('0x24')]()[_0x8487('0x23')](function(){_0x3a9581[_0x8487('0x16')](0xcc)[_0x8487('0x17')]();});}};}function handleEntityNotFound(_0x20af42,_0x2c92db){return function(_0x2f455b){if(!_0x2f455b){_0x20af42['sendStatus'](0x194);}return _0x2f455b;};}function handleError(_0x2810dc,_0x5ce202){_0x5ce202=_0x5ce202||0x1f4;return function(_0x2d4cd2){logger[_0x8487('0x25')](_0x2d4cd2['stack']);if(_0x2d4cd2[_0x8487('0x26')]){delete _0x2d4cd2[_0x8487('0x26')];}_0x2810dc[_0x8487('0x16')](_0x5ce202)[_0x8487('0x27')](_0x2d4cd2);};}exports[_0x8487('0x28')]=function(_0x5a2ef0,_0x52a318){var _0x536984={},_0x12aef2={},_0x3085f6={'count':0x0,'rows':[]};var _0x5d667d=_[_0x8487('0x29')](db[_0x8487('0x2a')][_0x8487('0x2b')],function(_0x265ffe){return{'name':_0x265ffe[_0x8487('0x2c')],'type':_0x265ffe[_0x8487('0x2d')][_0x8487('0x2e')]};});_0x12aef2[_0x8487('0x2f')]=_[_0x8487('0x29')](_0x5d667d,_0x8487('0x26'));_0x12aef2[_0x8487('0x30')]=_['keys'](_0x5a2ef0[_0x8487('0x30')]);_0x12aef2['filters']=_[_0x8487('0x31')](_0x12aef2[_0x8487('0x2f')],_0x12aef2[_0x8487('0x30')]);_0x536984[_0x8487('0x32')]=_[_0x8487('0x31')](_0x12aef2[_0x8487('0x2f')],qs[_0x8487('0x33')](_0x5a2ef0[_0x8487('0x30')][_0x8487('0x33')]));_0x536984[_0x8487('0x32')]=_0x536984[_0x8487('0x32')]['length']?_0x536984[_0x8487('0x32')]:_0x12aef2['model'];if(!_0x5a2ef0[_0x8487('0x30')]['hasOwnProperty'](_0x8487('0x34'))){_0x536984[_0x8487('0x1b')]=qs['limit'](_0x5a2ef0[_0x8487('0x30')][_0x8487('0x1b')]);_0x536984['offset']=qs[_0x8487('0x19')](_0x5a2ef0['query']['offset']);}_0x536984[_0x8487('0x35')]=qs['sort'](_0x5a2ef0[_0x8487('0x30')][_0x8487('0x36')]);_0x536984['where']=qs[_0x8487('0x37')](_[_0x8487('0x38')](_0x5a2ef0[_0x8487('0x30')],_0x12aef2[_0x8487('0x37')]),_0x5d667d);if(_0x5a2ef0[_0x8487('0x30')][_0x8487('0x39')]){_0x536984['where']=_[_0x8487('0x3a')](_0x536984[_0x8487('0x3b')],{'$or':_[_0x8487('0x29')](_0x5d667d,function(_0x1f3d5e){if(_0x1f3d5e[_0x8487('0x2d')]!==_0x8487('0x3c')){var _0x195f5b={};_0x195f5b[_0x1f3d5e[_0x8487('0x26')]]={'$like':'%'+_0x5a2ef0['query'][_0x8487('0x39')]+'%'};return _0x195f5b;}})});}_0x536984=_['merge']({},_0x536984,_0x5a2ef0['options']);var _0x1ca6e2={'where':_0x536984['where']};return db[_0x8487('0x2a')]['count'](_0x1ca6e2)['then'](function(_0x53ac7d){_0x3085f6[_0x8487('0x1c')]=_0x53ac7d;if(_0x5a2ef0['query']['includeAll']){_0x536984[_0x8487('0x3d')]=[{'all':!![]}];}return db[_0x8487('0x2a')][_0x8487('0x3e')](_0x536984);})[_0x8487('0x23')](function(_0x252021){_0x3085f6[_0x8487('0x3f')]=_0x252021;return _0x3085f6;})[_0x8487('0x23')](respondWithFilteredResult(_0x52a318,_0x536984))[_0x8487('0x40')](handleError(_0x52a318,null));};exports['show']=function(_0x4f4440,_0x3a2499){var _0x7d3921={'raw':!![],'where':{'id':_0x4f4440['params']['id']}},_0x4c2100={};_0x4c2100[_0x8487('0x2f')]=_[_0x8487('0x41')](db[_0x8487('0x2a')][_0x8487('0x2b')]);_0x4c2100[_0x8487('0x30')]=_[_0x8487('0x41')](_0x4f4440[_0x8487('0x30')]);_0x4c2100[_0x8487('0x37')]=_[_0x8487('0x31')](_0x4c2100['model'],_0x4c2100[_0x8487('0x30')]);_0x7d3921[_0x8487('0x32')]=_[_0x8487('0x31')](_0x4c2100['model'],qs[_0x8487('0x33')](_0x4f4440[_0x8487('0x30')][_0x8487('0x33')]));_0x7d3921[_0x8487('0x32')]=_0x7d3921[_0x8487('0x32')][_0x8487('0x42')]?_0x7d3921[_0x8487('0x32')]:_0x4c2100['model'];if(_0x4f4440[_0x8487('0x30')]['includeAll']){_0x7d3921['include']=[{'all':!![]}];}_0x7d3921=_['merge']({},_0x7d3921,_0x4f4440[_0x8487('0x43')]);return db[_0x8487('0x2a')][_0x8487('0x44')](_0x7d3921)[_0x8487('0x23')](handleEntityNotFound(_0x3a2499,null))[_0x8487('0x23')](respondWithResult(_0x3a2499,null))[_0x8487('0x40')](handleError(_0x3a2499,null));};exports[_0x8487('0x45')]=function(_0xf77097,_0x451a11){return db[_0x8487('0x2a')][_0x8487('0x45')](_0xf77097['body'],{})['then'](respondWithResult(_0x451a11,0xc9))[_0x8487('0x40')](handleError(_0x451a11,null));};exports[_0x8487('0x22')]=function(_0x436564,_0x2253dd){if(_0x436564[_0x8487('0x46')]['id']){delete _0x436564['body']['id'];}return db[_0x8487('0x2a')][_0x8487('0x44')]({'where':{'id':_0x436564[_0x8487('0x47')]['id']}})[_0x8487('0x23')](handleEntityNotFound(_0x2253dd,null))[_0x8487('0x23')](saveUpdates(_0x436564['body'],null))[_0x8487('0x23')](respondWithResult(_0x2253dd,null))[_0x8487('0x40')](handleError(_0x2253dd,null));};exports['destroy']=function(_0x9f6039,_0x287037){return db['FaxTransferReport']['find']({'where':{'id':_0x9f6039[_0x8487('0x47')]['id']}})[_0x8487('0x23')](handleEntityNotFound(_0x287037,null))['then'](removeEntity(_0x287037,null))[_0x8487('0x40')](handleError(_0x287037,null));};exports[_0x8487('0x48')]=function(_0x46145e,_0x17a490){return db[_0x8487('0x2a')][_0x8487('0x48')]()[_0x8487('0x23')](respondWithResult(_0x17a490,null))[_0x8487('0x40')](handleError(_0x17a490,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 392c0fb..53ba71f 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 _0xb44f=['util','api','moment','bluebird','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','lodash'];(function(_0x263d88,_0x5cd913){var _0x212585=function(_0x2dccc4){while(--_0x2dccc4){_0x263d88['push'](_0x263d88['shift']());}};_0x212585(++_0x5cd913);}(_0xb44f,0xe3));var _0xfb44=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb44f[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xfb44('0x0'));var util=require(_0xfb44('0x1'));var logger=require('../../config/logger')(_0xfb44('0x2'));var moment=require(_0xfb44('0x3'));var BPromise=require(_0xfb44('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfb44('0x5'));var config=require(_0xfb44('0x6'));var attributes=require(_0xfb44('0x7'));module[_0xfb44('0x8')]=function(_0x1d2e44,_0x45c1e4){return _0x1d2e44[_0xfb44('0x9')](_0xfb44('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xfb44('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4559=['exports','define','uniqueid','util','api','moment','bluebird','path','rimraf'];(function(_0x2016d2,_0x3dd3a0){var _0x280d53=function(_0x2395a6){while(--_0x2395a6){_0x2016d2['push'](_0x2016d2['shift']());}};_0x280d53(++_0x3dd3a0);}(_0x4559,0x18f));var _0x9455=function(_0x5b7a4a,_0x54c362){_0x5b7a4a=_0x5b7a4a-0x0;var _0x5feaf9=_0x4559[_0x5b7a4a];return _0x5feaf9;};'use strict';var _=require('lodash');var util=require(_0x9455('0x0'));var logger=require('../../config/logger')(_0x9455('0x1'));var moment=require(_0x9455('0x2'));var BPromise=require(_0x9455('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9455('0x4'));var rimraf=require(_0x9455('0x5'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0x9455('0x6')]=function(_0xee44aa,_0x374563){return _0xee44aa[_0x9455('0x7')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x9455('0x8'),'fields':[_0x9455('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index ddf97ff..735b896 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 _0x5bc9=['moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util'];(function(_0x361399,_0x1d48e4){var _0x542f74=function(_0x4b03df){while(--_0x4b03df){_0x361399['push'](_0x361399['shift']());}};_0x542f74(++_0x1d48e4);}(_0x5bc9,0x12a));var _0x95bc=function(_0x2466cd,_0x34974d){_0x2466cd=_0x2466cd-0x0;var _0x42a025=_0x5bc9[_0x2466cd];return _0x42a025;};'use strict';var _=require(_0x95bc('0x0'));var util=require(_0x95bc('0x1'));var moment=require(_0x95bc('0x2'));var BPromise=require(_0x95bc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95bc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x95bc('0x5'))(_0x95bc('0x6'));var config=require(_0x95bc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x95bc('0x8')][_0x95bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4eeefb,_0x2f85e7,_0xee502e){return new BPromise(function(_0x31bb9c,_0x593fbc){return client[_0x95bc('0xa')](_0x4eeefb,_0xee502e)['then'](function(_0x456eb7){logger[_0x95bc('0xb')](_0x95bc('0xc'),_0x2f85e7,_0x95bc('0xd'));logger[_0x95bc('0xe')](_0x95bc('0xf'),_0x2f85e7,'request\x20sent',JSON[_0x95bc('0x10')](_0x456eb7));if(_0x456eb7[_0x95bc('0x11')]){if(_0x456eb7['error'][_0x95bc('0x12')]===0x1f4){logger[_0x95bc('0x11')](_0x95bc('0xc'),_0x2f85e7,_0x456eb7[_0x95bc('0x11')][_0x95bc('0x13')]);return _0x593fbc(_0x456eb7['error']['message']);}logger[_0x95bc('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x2f85e7,_0x456eb7[_0x95bc('0x11')][_0x95bc('0x13')]);return _0x31bb9c(_0x456eb7[_0x95bc('0x11')]['message']);}else{logger[_0x95bc('0xb')](_0x95bc('0xc'),_0x2f85e7,_0x95bc('0xd'));_0x31bb9c(_0x456eb7['result'][_0x95bc('0x13')]);}})['catch'](function(_0x1f23a9){logger[_0x95bc('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x2f85e7,_0x1f23a9);_0x593fbc(_0x1f23a9);});});} \ No newline at end of file +var _0xba3e=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0xba3e,0x1ec));var _0xeba3=function(_0x21f0e7,_0x374461){_0x21f0e7=_0x21f0e7-0x0;var _0x57c401=_0xba3e[_0x21f0e7];return _0x57c401;};'use strict';var _=require(_0xeba3('0x0'));var util=require(_0xeba3('0x1'));var moment=require(_0xeba3('0x2'));var BPromise=require(_0xeba3('0x3'));var rs=require(_0xeba3('0x4'));var fs=require('fs');var Redis=require(_0xeba3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xeba3('0x6'));var logger=require(_0xeba3('0x7'))(_0xeba3('0x8'));var config=require(_0xeba3('0x9'));var jayson=require(_0xeba3('0xa'));var client=jayson[_0xeba3('0xb')][_0xeba3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b4273,_0x3f1dc8,_0x4fa95f){return new BPromise(function(_0x59b0f5,_0x44275c){return client[_0xeba3('0xd')](_0x4b4273,_0x4fa95f)[_0xeba3('0xe')](function(_0x38058c){logger[_0xeba3('0xf')](_0xeba3('0x10'),_0x3f1dc8,_0xeba3('0x11'));logger[_0xeba3('0x12')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x3f1dc8,_0xeba3('0x11'),JSON[_0xeba3('0x13')](_0x38058c));if(_0x38058c['error']){if(_0x38058c['error'][_0xeba3('0x14')]===0x1f4){logger[_0xeba3('0x15')]('FaxTransferReport,\x20%s,\x20%s',_0x3f1dc8,_0x38058c[_0xeba3('0x15')][_0xeba3('0x16')]);return _0x44275c(_0x38058c['error'][_0xeba3('0x16')]);}logger[_0xeba3('0x15')]('FaxTransferReport,\x20%s,\x20%s',_0x3f1dc8,_0x38058c[_0xeba3('0x15')][_0xeba3('0x16')]);return _0x59b0f5(_0x38058c[_0xeba3('0x15')][_0xeba3('0x16')]);}else{logger[_0xeba3('0xf')](_0xeba3('0x10'),_0x3f1dc8,_0xeba3('0x11'));_0x59b0f5(_0x38058c[_0xeba3('0x17')]['message']);}})[_0xeba3('0x18')](function(_0x970094){logger[_0xeba3('0x15')](_0xeba3('0x10'),_0x3f1dc8,_0x970094);_0x44275c(_0x970094);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 762e2db..de4ced8 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 _0x6b2b=['express','Router','fs-extra','../../components/auth/service','./faxTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x476c7,_0x298ee0){var _0x47ae56=function(_0x4acf5a){while(--_0x4acf5a){_0x476c7['push'](_0x476c7['shift']());}};_0x47ae56(++_0x298ee0);}(_0x6b2b,0x178));var _0xb6b2=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x6b2b[_0x3740fe];return _0x55492b;};'use strict';var multer=require(_0xb6b2('0x0'));var util=require(_0xb6b2('0x1'));var path=require(_0xb6b2('0x2'));var timeout=require(_0xb6b2('0x3'));var express=require(_0xb6b2('0x4'));var router=express[_0xb6b2('0x5')]();var fs_extra=require(_0xb6b2('0x6'));var auth=require(_0xb6b2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb6b2('0x8'));router[_0xb6b2('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb6b2('0xa'),auth[_0xb6b2('0xb')](),controller[_0xb6b2('0xc')]);router[_0xb6b2('0x9')](_0xb6b2('0xd'),auth[_0xb6b2('0xb')](),controller[_0xb6b2('0xe')]);router[_0xb6b2('0xf')]('/',auth[_0xb6b2('0xb')](),controller['create']);router[_0xb6b2('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xb6b2('0x11')]);router[_0xb6b2('0x12')](_0xb6b2('0xd'),auth['isAuthenticated'](),controller[_0xb6b2('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3ddd=['fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','multer','util','path','connect-timeout','express','Router'];(function(_0x216e58,_0x497adc){var _0x5adcad=function(_0x22197f){while(--_0x22197f){_0x216e58['push'](_0x216e58['shift']());}};_0x5adcad(++_0x497adc);}(_0x3ddd,0xd6));var _0xd3dd=function(_0x1b2f5f,_0x2dcd8c){_0x1b2f5f=_0x1b2f5f-0x0;var _0x345eca=_0x3ddd[_0x1b2f5f];return _0x345eca;};'use strict';var multer=require(_0xd3dd('0x0'));var util=require(_0xd3dd('0x1'));var path=require(_0xd3dd('0x2'));var timeout=require(_0xd3dd('0x3'));var express=require(_0xd3dd('0x4'));var router=express[_0xd3dd('0x5')]();var fs_extra=require(_0xd3dd('0x6'));var auth=require(_0xd3dd('0x7'));var interaction=require(_0xd3dd('0x8'));var config=require('../../config/environment');var controller=require(_0xd3dd('0x9'));router[_0xd3dd('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd3dd('0xa')](_0xd3dd('0xb'),auth[_0xd3dd('0xc')](),controller[_0xd3dd('0xd')]);router[_0xd3dd('0xa')](_0xd3dd('0xe'),auth[_0xd3dd('0xc')](),controller[_0xd3dd('0xf')]);router[_0xd3dd('0x10')]('/',auth[_0xd3dd('0xc')](),controller[_0xd3dd('0x11')]);router['put']('/:id',auth[_0xd3dd('0xc')](),controller[_0xd3dd('0x12')]);router[_0xd3dd('0x13')](_0xd3dd('0xe'),auth[_0xd3dd('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 3eb0bdf..a1aae6b 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 _0xb2f9=['update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','index','/:id','isAuthenticated','get','/:id/configurations','getConfigurations','/:id/fields','getFields','put'];(function(_0x5e5edd,_0x4a5af1){var _0x274a03=function(_0x2b271c){while(--_0x2b271c){_0x5e5edd['push'](_0x5e5edd['shift']());}};_0x274a03(++_0x4a5af1);}(_0xb2f9,0xb6));var _0x9b2f=function(_0x5b6199,_0x303ccc){_0x5b6199=_0x5b6199-0x0;var _0x12853d=_0xb2f9[_0x5b6199];return _0x12853d;};'use strict';var multer=require('multer');var util=require(_0x9b2f('0x0'));var path=require(_0x9b2f('0x1'));var timeout=require(_0x9b2f('0x2'));var express=require(_0x9b2f('0x3'));var router=express[_0x9b2f('0x4')]();var fs_extra=require(_0x9b2f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9b2f('0x6'));var config=require(_0x9b2f('0x7'));var controller=require(_0x9b2f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x9b2f('0x9')]);router['get'](_0x9b2f('0xa'),auth[_0x9b2f('0xb')](),controller['show']);router[_0x9b2f('0xc')](_0x9b2f('0xd'),auth[_0x9b2f('0xb')](),controller[_0x9b2f('0xe')]);router[_0x9b2f('0xc')](_0x9b2f('0xf'),auth['isAuthenticated'](),controller[_0x9b2f('0x10')]);router['post']('/',auth[_0x9b2f('0xb')](),controller['create']);router['post'](_0x9b2f('0xd'),auth[_0x9b2f('0xb')](),controller['addConfiguration']);router[_0x9b2f('0x11')](_0x9b2f('0xa'),auth[_0x9b2f('0xb')](),controller[_0x9b2f('0x12')]);router[_0x9b2f('0x13')](_0x9b2f('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9e93=['/:id','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put'];(function(_0x4d81de,_0x18e4b6){var _0x306c98=function(_0x5000fc){while(--_0x5000fc){_0x4d81de['push'](_0x4d81de['shift']());}};_0x306c98(++_0x18e4b6);}(_0x9e93,0x1a4));var _0x39e9=function(_0x8abd64,_0x539570){_0x8abd64=_0x8abd64-0x0;var _0xd2511e=_0x9e93[_0x8abd64];return _0xd2511e;};'use strict';var multer=require(_0x39e9('0x0'));var util=require(_0x39e9('0x1'));var path=require('path');var timeout=require(_0x39e9('0x2'));var express=require(_0x39e9('0x3'));var router=express[_0x39e9('0x4')]();var fs_extra=require(_0x39e9('0x5'));var auth=require(_0x39e9('0x6'));var interaction=require(_0x39e9('0x7'));var config=require(_0x39e9('0x8'));var controller=require('./intDeskAccount.controller');router[_0x39e9('0x9')]('/',auth['isAuthenticated'](),controller[_0x39e9('0xa')]);router[_0x39e9('0x9')]('/:id',auth[_0x39e9('0xb')](),controller[_0x39e9('0xc')]);router[_0x39e9('0x9')](_0x39e9('0xd'),auth[_0x39e9('0xb')](),controller[_0x39e9('0xe')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x39e9('0xf')]);router[_0x39e9('0x10')]('/',auth[_0x39e9('0xb')](),controller[_0x39e9('0x11')]);router['post'](_0x39e9('0xd'),auth[_0x39e9('0xb')](),controller[_0x39e9('0x12')]);router[_0x39e9('0x13')](_0x39e9('0x14'),auth[_0x39e9('0xb')](),controller['update']);router['delete'](_0x39e9('0x14'),auth['isAuthenticated'](),controller[_0x39e9('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index cadaef7..1d574cd 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 _0xd384=['newTab','sequelize','exports','STRING','ENUM','basic','integrationTab'];(function(_0x32a4b2,_0xf534c7){var _0x2582d5=function(_0x5c21aa){while(--_0x5c21aa){_0x32a4b2['push'](_0x32a4b2['shift']());}};_0x2582d5(++_0xf534c7);}(_0xd384,0x86));var _0x4d38=function(_0x55debd,_0x2c9d19){_0x55debd=_0x55debd-0x0;var _0x569b06=_0xd384[_0x55debd];return _0x569b06;};'use strict';var Sequelize=require(_0x4d38('0x0'));module[_0x4d38('0x1')]={'name':{'type':Sequelize[_0x4d38('0x2')]},'description':{'type':Sequelize[_0x4d38('0x2')]},'username':{'type':Sequelize[_0x4d38('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x4d38('0x3')]('basic'),'defaultValue':_0x4d38('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x4d38('0x2')]},'consumerSecret':{'type':Sequelize[_0x4d38('0x2')]},'token':{'type':Sequelize[_0x4d38('0x2')]},'tokenSecret':{'type':Sequelize[_0x4d38('0x2')]},'serverUrl':{'type':Sequelize[_0x4d38('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4d38('0x3')](_0x4d38('0x5'),_0x4d38('0x6')),'defaultValue':_0x4d38('0x5')}}; \ No newline at end of file +var _0x4925=['basic','integrationTab','newTab','STRING'];(function(_0x2d6fac,_0x3cba6c){var _0x3c122f=function(_0x1b44d8){while(--_0x1b44d8){_0x2d6fac['push'](_0x2d6fac['shift']());}};_0x3c122f(++_0x3cba6c);}(_0x4925,0x11b));var _0x5492=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0x4925[_0x52f1e6];return _0x21f104;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5492('0x0')]},'description':{'type':Sequelize[_0x5492('0x0')]},'username':{'type':Sequelize[_0x5492('0x0')]},'remoteUri':{'type':Sequelize[_0x5492('0x0')]},'authType':{'type':Sequelize['ENUM'](_0x5492('0x1')),'defaultValue':_0x5492('0x1')},'password':{'type':Sequelize[_0x5492('0x0')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x5492('0x0')]},'token':{'type':Sequelize[_0x5492('0x0')]},'tokenSecret':{'type':Sequelize[_0x5492('0x0')]},'serverUrl':{'type':Sequelize[_0x5492('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x5492('0x2'),_0x5492('0x3')),'defaultValue':_0x5492('0x2')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 156e4e4..6d00d0e 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 _0xd596=['concat','_embedded','active','test','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','destroy','then','sendStatus','error','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','find','create','body','params','findOne','options','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','DeskConfiguration','DeskField','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','application/json','basic','headers','Authorization','Basic\x20%s','format','toString','base64'];(function(_0x3fc875,_0x2a47ae){var _0x166fde=function(_0x4a631f){while(--_0x4a631f){_0x3fc875['push'](_0x3fc875['shift']());}};_0x166fde(++_0x2a47ae);}(_0xd596,0x1d3));var _0x6d59=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0xd596[_0x1064bc];return _0x5edc45;};'use strict';var emlformat=require(_0x6d59('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6d59('0x1'));var rp=require(_0x6d59('0x2'));var moment=require('moment');var BPromise=require(_0x6d59('0x3'));var Mustache=require(_0x6d59('0x4'));var util=require(_0x6d59('0x5'));var path=require(_0x6d59('0x6'));var sox=require(_0x6d59('0x7'));var csv=require(_0x6d59('0x8'));var ejs=require(_0x6d59('0x9'));var fs=require('fs');var fs_extra=require(_0x6d59('0xa'));var _=require(_0x6d59('0xb'));var squel=require(_0x6d59('0xc'));var crypto=require(_0x6d59('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6d59('0xe'));var toCsv=require(_0x6d59('0x8'));var querystring=require(_0x6d59('0xf'));var Papa=require(_0x6d59('0x10'));var Redis=require('ioredis');var authService=require(_0x6d59('0x11'));var qs=require(_0x6d59('0x12'));var as=require(_0x6d59('0x13'));var hardwareService=require(_0x6d59('0x14'));var logger=require(_0x6d59('0x15'))(_0x6d59('0x16'));var utils=require(_0x6d59('0x17'));var config=require(_0x6d59('0x18'));var licenseUtil=require(_0x6d59('0x19'));var db=require(_0x6d59('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x284d22,_0x3d1a96){_0x3d1a96=_0x3d1a96||0xcc;return function(_0x2359a6){if(_0x2359a6){return _0x284d22['sendStatus'](_0x3d1a96);}return _0x284d22['status'](_0x3d1a96)[_0x6d59('0x1b')]();};}function respondWithResult(_0x2dddc1,_0x5e270a){_0x5e270a=_0x5e270a||0xc8;return function(_0x59f2fc){if(_0x59f2fc){return _0x2dddc1[_0x6d59('0x1c')](_0x5e270a)[_0x6d59('0x1d')](_0x59f2fc);}};}function respondWithFilteredResult(_0x2d0089,_0x2c54ac){return function(_0x205f07){if(_0x205f07){var _0x1332b9=typeof _0x2c54ac[_0x6d59('0x1e')]===_0x6d59('0x1f')&&typeof _0x2c54ac[_0x6d59('0x20')]==='undefined';var _0x2bc005=_0x205f07['count'];var _0x33f41e=_0x1332b9?0x0:_0x2c54ac[_0x6d59('0x1e')];var _0x5beb35=_0x1332b9?_0x205f07['count']:_0x2c54ac[_0x6d59('0x1e')]+_0x2c54ac['limit'];var _0x29d652;if(_0x5beb35>=_0x2bc005){_0x5beb35=_0x2bc005;_0x29d652=0xc8;}else{_0x29d652=0xce;}_0x2d0089[_0x6d59('0x1c')](_0x29d652);return _0x2d0089[_0x6d59('0x21')](_0x6d59('0x22'),_0x33f41e+'-'+_0x5beb35+'/'+_0x2bc005)[_0x6d59('0x1d')](_0x205f07);}return null;};}function patchUpdates(_0x46a922){return function(_0x260145){try{jsonpatch[_0x6d59('0x23')](_0x260145,_0x46a922,!![]);}catch(_0x233cb9){return BPromise['reject'](_0x233cb9);}return _0x260145[_0x6d59('0x24')]();};}function saveUpdates(_0x3e59c7,_0x541e32){return function(_0x346aa6){if(_0x346aa6){return _0x346aa6[_0x6d59('0x25')](_0x3e59c7)['then'](function(_0x437d0b){return _0x437d0b;});}return null;};}function removeEntity(_0x386a12,_0x585e0c){return function(_0x401170){if(_0x401170){return _0x401170[_0x6d59('0x26')]()[_0x6d59('0x27')](function(){_0x386a12[_0x6d59('0x1c')](0xcc)[_0x6d59('0x1b')]();});}};}function handleEntityNotFound(_0x363b6a,_0x542fea){return function(_0x4d20d4){if(!_0x4d20d4){_0x363b6a[_0x6d59('0x28')](0x194);}return _0x4d20d4;};}function handleError(_0x5c2975,_0x30e3ca){_0x30e3ca=_0x30e3ca||0x1f4;return function(_0x4ed0e3){logger[_0x6d59('0x29')](_0x4ed0e3['stack']);if(_0x4ed0e3[_0x6d59('0x2a')]){delete _0x4ed0e3['name'];}_0x5c2975[_0x6d59('0x1c')](_0x30e3ca)[_0x6d59('0x2b')](_0x4ed0e3);};}exports[_0x6d59('0x2c')]=function(_0x51e73d,_0x3df80e){var _0x4a5156={},_0x2f4567={},_0x421732={'count':0x0,'rows':[]};var _0x4e2b36=_[_0x6d59('0x2d')](db[_0x6d59('0x2e')][_0x6d59('0x2f')],function(_0x52a738){return{'name':_0x52a738[_0x6d59('0x30')],'type':_0x52a738[_0x6d59('0x31')]['key']};});_0x2f4567['model']=_[_0x6d59('0x2d')](_0x4e2b36,'name');_0x2f4567[_0x6d59('0x32')]=_[_0x6d59('0x33')](_0x51e73d[_0x6d59('0x32')]);_0x2f4567[_0x6d59('0x34')]=_[_0x6d59('0x35')](_0x2f4567['model'],_0x2f4567[_0x6d59('0x32')]);_0x4a5156[_0x6d59('0x36')]=_[_0x6d59('0x35')](_0x2f4567[_0x6d59('0x37')],qs['fields'](_0x51e73d[_0x6d59('0x32')][_0x6d59('0x38')]));_0x4a5156[_0x6d59('0x36')]=_0x4a5156['attributes'][_0x6d59('0x39')]?_0x4a5156['attributes']:_0x2f4567[_0x6d59('0x37')];if(!_0x51e73d[_0x6d59('0x32')][_0x6d59('0x3a')](_0x6d59('0x3b'))){_0x4a5156[_0x6d59('0x20')]=qs['limit'](_0x51e73d[_0x6d59('0x32')][_0x6d59('0x20')]);_0x4a5156['offset']=qs[_0x6d59('0x1e')](_0x51e73d[_0x6d59('0x32')]['offset']);}_0x4a5156[_0x6d59('0x3c')]=qs['sort'](_0x51e73d[_0x6d59('0x32')][_0x6d59('0x3d')]);_0x4a5156[_0x6d59('0x3e')]=qs[_0x6d59('0x34')](_[_0x6d59('0x3f')](_0x51e73d[_0x6d59('0x32')],_0x2f4567[_0x6d59('0x34')]),_0x4e2b36);if(_0x51e73d[_0x6d59('0x32')][_0x6d59('0x40')]){_0x4a5156[_0x6d59('0x3e')]=_[_0x6d59('0x41')](_0x4a5156[_0x6d59('0x3e')],{'$or':_[_0x6d59('0x2d')](_0x4e2b36,function(_0x576080){if(_0x576080['type']!=='VIRTUAL'){var _0xe66b4d={};_0xe66b4d[_0x576080[_0x6d59('0x2a')]]={'$like':'%'+_0x51e73d[_0x6d59('0x32')]['filter']+'%'};return _0xe66b4d;}})});}_0x4a5156=_['merge']({},_0x4a5156,_0x51e73d['options']);var _0x47a023={'where':_0x4a5156[_0x6d59('0x3e')]};return db['DeskAccount']['count'](_0x47a023)[_0x6d59('0x27')](function(_0x3bbc5b){_0x421732[_0x6d59('0x42')]=_0x3bbc5b;if(_0x51e73d[_0x6d59('0x32')][_0x6d59('0x43')]){_0x4a5156[_0x6d59('0x44')]=[{'all':!![]}];}return db[_0x6d59('0x2e')][_0x6d59('0x45')](_0x4a5156);})[_0x6d59('0x27')](function(_0x38df3d){_0x421732[_0x6d59('0x46')]=_0x38df3d;return _0x421732;})['then'](respondWithFilteredResult(_0x3df80e,_0x4a5156))[_0x6d59('0x47')](handleError(_0x3df80e,null));};exports['show']=function(_0x7f94d,_0x9ddf75){var _0x37e295={'raw':![],'where':{'id':_0x7f94d['params']['id']}},_0x506d09={};_0x506d09[_0x6d59('0x37')]=_[_0x6d59('0x33')](db[_0x6d59('0x2e')][_0x6d59('0x2f')]);_0x506d09['query']=_[_0x6d59('0x33')](_0x7f94d[_0x6d59('0x32')]);_0x506d09[_0x6d59('0x34')]=_[_0x6d59('0x35')](_0x506d09[_0x6d59('0x37')],_0x506d09[_0x6d59('0x32')]);_0x37e295[_0x6d59('0x36')]=_[_0x6d59('0x35')](_0x506d09[_0x6d59('0x37')],qs[_0x6d59('0x38')](_0x7f94d[_0x6d59('0x32')][_0x6d59('0x38')]));_0x37e295['attributes']=_0x37e295[_0x6d59('0x36')][_0x6d59('0x39')]?_0x37e295[_0x6d59('0x36')]:_0x506d09[_0x6d59('0x37')];if(_0x7f94d[_0x6d59('0x32')][_0x6d59('0x43')]){_0x37e295[_0x6d59('0x44')]=[{'all':!![]}];}_0x37e295=_[_0x6d59('0x41')]({},_0x37e295,_0x7f94d['options']);return db[_0x6d59('0x2e')][_0x6d59('0x48')](_0x37e295)['then'](handleEntityNotFound(_0x9ddf75,null))[_0x6d59('0x27')](respondWithResult(_0x9ddf75,null))['catch'](handleError(_0x9ddf75,null));};exports[_0x6d59('0x49')]=function(_0x3f847a,_0x38a2fc){return db[_0x6d59('0x2e')]['create'](_0x3f847a[_0x6d59('0x4a')],{})[_0x6d59('0x27')](respondWithResult(_0x38a2fc,0xc9))[_0x6d59('0x47')](handleError(_0x38a2fc,null));};exports['update']=function(_0x2c7161,_0x78d107){if(_0x2c7161[_0x6d59('0x4a')]['id']){delete _0x2c7161[_0x6d59('0x4a')]['id'];}return db['DeskAccount']['find']({'where':{'id':_0x2c7161['params']['id']}})[_0x6d59('0x27')](handleEntityNotFound(_0x78d107,null))[_0x6d59('0x27')](saveUpdates(_0x2c7161[_0x6d59('0x4a')],null))['then'](respondWithResult(_0x78d107,null))[_0x6d59('0x47')](handleError(_0x78d107,null));};exports[_0x6d59('0x26')]=function(_0x3978be,_0x4e00fd){return db[_0x6d59('0x2e')][_0x6d59('0x48')]({'where':{'id':_0x3978be[_0x6d59('0x4b')]['id']}})[_0x6d59('0x27')](handleEntityNotFound(_0x4e00fd,null))[_0x6d59('0x27')](removeEntity(_0x4e00fd,null))[_0x6d59('0x47')](handleError(_0x4e00fd,null));};exports['getConfigurations']=function(_0x10d8dd,_0x51e56c,_0x5b452f){var _0x1d994a={};var _0x166c2f={};var _0x27eccc;var _0x5486b1;return db['DeskAccount'][_0x6d59('0x4c')]({'where':{'id':_0x10d8dd['params']['id']}})[_0x6d59('0x27')](handleEntityNotFound(_0x51e56c,null))[_0x6d59('0x27')](function(_0x5e3fa5){if(_0x5e3fa5){_0x27eccc=_0x5e3fa5;_0x166c2f[_0x6d59('0x37')]=_[_0x6d59('0x33')](db['DeskConfiguration']['rawAttributes']);_0x166c2f[_0x6d59('0x32')]=_[_0x6d59('0x33')](_0x10d8dd[_0x6d59('0x32')]);_0x166c2f[_0x6d59('0x34')]=_[_0x6d59('0x35')](_0x166c2f[_0x6d59('0x37')],_0x166c2f[_0x6d59('0x32')]);_0x1d994a['attributes']=_[_0x6d59('0x35')](_0x166c2f[_0x6d59('0x37')],qs[_0x6d59('0x38')](_0x10d8dd[_0x6d59('0x32')][_0x6d59('0x38')]));_0x1d994a[_0x6d59('0x36')]=_0x1d994a['attributes']['length']?_0x1d994a[_0x6d59('0x36')]:_0x166c2f[_0x6d59('0x37')];_0x1d994a[_0x6d59('0x3c')]=qs['sort'](_0x10d8dd[_0x6d59('0x32')]['sort']);_0x1d994a[_0x6d59('0x3e')]=qs[_0x6d59('0x34')](_[_0x6d59('0x3f')](_0x10d8dd[_0x6d59('0x32')],_0x166c2f['filters']));if(_0x10d8dd[_0x6d59('0x32')][_0x6d59('0x40')]){_0x1d994a[_0x6d59('0x3e')]=_[_0x6d59('0x41')](_0x1d994a[_0x6d59('0x3e')],{'$or':_['map'](_0x1d994a['attributes'],function(_0x405b02){var _0x431f03={};_0x431f03[_0x405b02]={'$like':'%'+_0x10d8dd['query'][_0x6d59('0x40')]+'%'};return _0x431f03;})});}_0x1d994a=_[_0x6d59('0x41')]({},_0x1d994a,_0x10d8dd[_0x6d59('0x4d')]);return _0x27eccc[_0x6d59('0x4e')](_0x1d994a);}})[_0x6d59('0x27')](function(_0x49dc40){if(_0x49dc40){_0x5486b1=_0x49dc40[_0x6d59('0x39')];if(!_0x10d8dd[_0x6d59('0x32')][_0x6d59('0x3a')]('nolimit')){_0x1d994a[_0x6d59('0x20')]=qs[_0x6d59('0x20')](_0x10d8dd[_0x6d59('0x32')][_0x6d59('0x20')]);_0x1d994a[_0x6d59('0x1e')]=qs['offset'](_0x10d8dd[_0x6d59('0x32')][_0x6d59('0x1e')]);}return _0x27eccc['getConfigurations'](_0x1d994a);}})[_0x6d59('0x27')](function(_0x188a41){if(_0x188a41){return _0x188a41?{'count':_0x5486b1,'rows':_0x188a41}:null;}})[_0x6d59('0x27')](respondWithResult(_0x51e56c,null))[_0x6d59('0x47')](handleError(_0x51e56c,null));};exports[_0x6d59('0x4f')]=function(_0x2bf298,_0x55fa04,_0x17280c){if(_0x2bf298[_0x6d59('0x4a')]['id']){delete _0x2bf298[_0x6d59('0x4a')]['id'];}return db[_0x6d59('0x2e')][_0x6d59('0x4c')]({'where':{'id':_0x2bf298['params']['id']}})[_0x6d59('0x27')](handleEntityNotFound(_0x55fa04,null))[_0x6d59('0x27')](function(_0x39f15e){if(_0x39f15e){_0x2bf298[_0x6d59('0x4a')][_0x6d59('0x50')]=_0x39f15e['id'];_0x2bf298['body'][_0x6d59('0x51')]=integrations[_0x6d59('0x52')](_0x2bf298[_0x6d59('0x4a')]['channel'],_0x2bf298[_0x6d59('0x4a')][_0x6d59('0x31')]);_0x2bf298[_0x6d59('0x4a')][_0x6d59('0x53')]=integrations[_0x6d59('0x54')](_0x2bf298[_0x6d59('0x4a')]['channel'],_0x2bf298[_0x6d59('0x4a')]['type']);return db[_0x6d59('0x55')]['create'](_0x2bf298[_0x6d59('0x4a')],{'include':[{'model':db[_0x6d59('0x56')],'as':'Subjects'},{'model':db['DeskField'],'as':_0x6d59('0x53')}]});}return null;})[_0x6d59('0x27')](respondWithResult(_0x55fa04,null))[_0x6d59('0x47')](handleError(_0x55fa04,null));};exports['getFields']=function(_0x554c4c,_0x506126,_0x2f2633){var _0x43a7c0=[{'name':_0x6d59('0x57'),'label':_0x6d59('0x57'),'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 _0x46c094='';return db[_0x6d59('0x2e')]['findOne']({'where':{'id':_0x554c4c[_0x6d59('0x4b')]['id']},'attributes':['id',_0x6d59('0x58'),_0x6d59('0x59'),_0x6d59('0x5a'),_0x6d59('0x5b'),_0x6d59('0x5c'),_0x6d59('0x5d'),_0x6d59('0x5e'),_0x6d59('0x5f')]})[_0x6d59('0x27')](handleEntityNotFound(_0x506126,null))[_0x6d59('0x27')](function(_0x46ff83){if(_0x46ff83){_0x46c094=_0x46ff83[_0x6d59('0x58')];var _0x349693=_0x46c094[_0x6d59('0x60')](-0x1);if(_0x349693==='/'){_0x46c094=_0x46c094[_0x6d59('0x61')](0x0,_0x46c094[_0x6d59('0x62')](_0x349693));}var _0x5561b8={'method':_0x6d59('0x63'),'uri':util['format']('%s/custom_fields',_0x46c094),'headers':{'Content-Type':_0x6d59('0x64'),'Accept':_0x6d59('0x64')},'json':!![]};if(_0x46ff83['authType']===_0x6d59('0x65')){_0x5561b8[_0x6d59('0x66')][_0x6d59('0x67')]=util['format'](_0x6d59('0x68'),new Buffer(util[_0x6d59('0x69')]('%s:%s',_0x46ff83['username'],_0x46ff83[_0x6d59('0x5b')]))[_0x6d59('0x6a')](_0x6d59('0x6b')));}return rp(_0x5561b8)[_0x6d59('0x27')](function(_0x5af00a){return _0x43a7c0[_0x6d59('0x6c')](_[_0x6d59('0x2d')](_0x5af00a[_0x6d59('0x6d')]['entries'],function(_0x475300){return{'id':_0x475300[_0x6d59('0x2a')],'name':_0x475300['name'],'type':_0x475300[_0x6d59('0x31')],'active':_0x475300[_0x6d59('0x6e')],'label':_0x475300['label'],'custom':!![]};}));});}})[_0x6d59('0x27')](function(_0x3fa259){return{'count':_0x3fa259['length'],'rows':_0x3fa259};})[_0x6d59('0x27')](respondWithResult(_0x506126,null))['catch'](function(_0x4e24b7){var _0x172a2a=_0x554c4c['query'][_0x6d59('0x6f')]?0x1f4:_0x4e24b7['statusCode']||0x1f4;logger[_0x6d59('0x29')](_0x6d59('0x70'),'getFields',_0x172a2a,JSON[_0x6d59('0x71')](_0x4e24b7));delete _0x4e24b7['name'];if(_0x172a2a===0x191){_0x172a2a=0x190;}_0x506126['status'](_0x172a2a)[_0x6d59('0x2b')](_0x554c4c[_0x6d59('0x32')][_0x6d59('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x4e24b7[_0x6d59('0x72')]}:_0x4e24b7);});}; \ No newline at end of file +var _0xc89a=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','squel','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','../../components/integrations/configuration','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','type','options','include','findAll','catch','show','keys','find','create','body','params','getConfigurations','findOne','DeskConfiguration','hasOwnProperty','AccountId','Subjects','getSubjects','Descriptions','DeskField','priority','authType','username','password','consumerKey','consumerSecret','remoteUri','slice','substring','format','%s/custom_fields','application/json','Authorization','Basic\x20%s','%s:%s','toString','base64','_embedded','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','Wrong\x20credentials','eml-format','rimraf'];(function(_0x24d402,_0x5bdcdf){var _0x32ac0b=function(_0x599780){while(--_0x599780){_0x24d402['push'](_0x24d402['shift']());}};_0x32ac0b(++_0x5bdcdf);}(_0xc89a,0x1ae));var _0xac89=function(_0x4b422f,_0x1cb2d2){_0x4b422f=_0x4b422f-0x0;var _0x16ff82=_0xc89a[_0x4b422f];return _0x16ff82;};'use strict';var emlformat=require(_0xac89('0x0'));var rimraf=require(_0xac89('0x1'));var zipdir=require(_0xac89('0x2'));var jsonpatch=require(_0xac89('0x3'));var rp=require(_0xac89('0x4'));var moment=require(_0xac89('0x5'));var BPromise=require(_0xac89('0x6'));var Mustache=require(_0xac89('0x7'));var util=require('util');var path=require(_0xac89('0x8'));var sox=require(_0xac89('0x9'));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(_0xac89('0xa'));var crypto=require('crypto');var jsforce=require(_0xac89('0xb'));var deskjs=require(_0xac89('0xc'));var toCsv=require(_0xac89('0xd'));var querystring=require(_0xac89('0xe'));var Papa=require(_0xac89('0xf'));var Redis=require('ioredis');var authService=require(_0xac89('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xac89('0x11'));var hardwareService=require(_0xac89('0x12'));var logger=require(_0xac89('0x13'))('api');var utils=require(_0xac89('0x14'));var config=require(_0xac89('0x15'));var licenseUtil=require(_0xac89('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xac89('0x17'));function respondWithStatusCode(_0x33feb4,_0x36964d){_0x36964d=_0x36964d||0xcc;return function(_0x1ecf0e){if(_0x1ecf0e){return _0x33feb4[_0xac89('0x18')](_0x36964d);}return _0x33feb4[_0xac89('0x19')](_0x36964d)['end']();};}function respondWithResult(_0x39f896,_0x374dc0){_0x374dc0=_0x374dc0||0xc8;return function(_0x28cde){if(_0x28cde){return _0x39f896[_0xac89('0x19')](_0x374dc0)['json'](_0x28cde);}};}function respondWithFilteredResult(_0x289c3d,_0x506e91){return function(_0x5b8093){if(_0x5b8093){var _0x321b94=typeof _0x506e91[_0xac89('0x1a')]==='undefined'&&typeof _0x506e91[_0xac89('0x1b')]===_0xac89('0x1c');var _0x265a10=_0x5b8093[_0xac89('0x1d')];var _0xe6ff27=_0x321b94?0x0:_0x506e91['offset'];var _0x276cfc=_0x321b94?_0x5b8093[_0xac89('0x1d')]:_0x506e91['offset']+_0x506e91[_0xac89('0x1b')];var _0x370498;if(_0x276cfc>=_0x265a10){_0x276cfc=_0x265a10;_0x370498=0xc8;}else{_0x370498=0xce;}_0x289c3d[_0xac89('0x19')](_0x370498);return _0x289c3d[_0xac89('0x1e')](_0xac89('0x1f'),_0xe6ff27+'-'+_0x276cfc+'/'+_0x265a10)[_0xac89('0x20')](_0x5b8093);}return null;};}function patchUpdates(_0x2cd856){return function(_0x2c9778){try{jsonpatch[_0xac89('0x21')](_0x2c9778,_0x2cd856,!![]);}catch(_0xb1a198){return BPromise[_0xac89('0x22')](_0xb1a198);}return _0x2c9778[_0xac89('0x23')]();};}function saveUpdates(_0x21831f,_0x5cbb45){return function(_0x48f89d){if(_0x48f89d){return _0x48f89d[_0xac89('0x24')](_0x21831f)['then'](function(_0xd98e5a){return _0xd98e5a;});}return null;};}function removeEntity(_0x51c15b,_0x246aa6){return function(_0x379e13){if(_0x379e13){return _0x379e13[_0xac89('0x25')]()[_0xac89('0x26')](function(){_0x51c15b['status'](0xcc)[_0xac89('0x27')]();});}};}function handleEntityNotFound(_0x510741,_0x41e529){return function(_0x220023){if(!_0x220023){_0x510741[_0xac89('0x18')](0x194);}return _0x220023;};}function handleError(_0x44b794,_0x467f2d){_0x467f2d=_0x467f2d||0x1f4;return function(_0x3f67ea){logger[_0xac89('0x28')](_0x3f67ea[_0xac89('0x29')]);if(_0x3f67ea[_0xac89('0x2a')]){delete _0x3f67ea[_0xac89('0x2a')];}_0x44b794[_0xac89('0x19')](_0x467f2d)[_0xac89('0x2b')](_0x3f67ea);};}exports[_0xac89('0x2c')]=function(_0x42d35c,_0x5927be){var _0x24255e={},_0x3ea033={},_0x3b3115={'count':0x0,'rows':[]};var _0x148745=_[_0xac89('0x2d')](db[_0xac89('0x2e')][_0xac89('0x2f')],function(_0x148ed9){return{'name':_0x148ed9[_0xac89('0x30')],'type':_0x148ed9['type']['key']};});_0x3ea033[_0xac89('0x31')]=_[_0xac89('0x2d')](_0x148745,_0xac89('0x2a'));_0x3ea033[_0xac89('0x32')]=_['keys'](_0x42d35c[_0xac89('0x32')]);_0x3ea033['filters']=_[_0xac89('0x33')](_0x3ea033[_0xac89('0x31')],_0x3ea033['query']);_0x24255e[_0xac89('0x34')]=_[_0xac89('0x33')](_0x3ea033[_0xac89('0x31')],qs[_0xac89('0x35')](_0x42d35c[_0xac89('0x32')][_0xac89('0x35')]));_0x24255e['attributes']=_0x24255e[_0xac89('0x34')][_0xac89('0x36')]?_0x24255e[_0xac89('0x34')]:_0x3ea033[_0xac89('0x31')];if(!_0x42d35c[_0xac89('0x32')]['hasOwnProperty'](_0xac89('0x37'))){_0x24255e['limit']=qs[_0xac89('0x1b')](_0x42d35c[_0xac89('0x32')][_0xac89('0x1b')]);_0x24255e[_0xac89('0x1a')]=qs[_0xac89('0x1a')](_0x42d35c[_0xac89('0x32')][_0xac89('0x1a')]);}_0x24255e[_0xac89('0x38')]=qs[_0xac89('0x39')](_0x42d35c[_0xac89('0x32')]['sort']);_0x24255e['where']=qs[_0xac89('0x3a')](_[_0xac89('0x3b')](_0x42d35c[_0xac89('0x32')],_0x3ea033[_0xac89('0x3a')]),_0x148745);if(_0x42d35c[_0xac89('0x32')][_0xac89('0x3c')]){_0x24255e[_0xac89('0x3d')]=_[_0xac89('0x3e')](_0x24255e[_0xac89('0x3d')],{'$or':_['map'](_0x148745,function(_0x22f3ae){if(_0x22f3ae[_0xac89('0x3f')]!=='VIRTUAL'){var _0x31ccc4={};_0x31ccc4[_0x22f3ae[_0xac89('0x2a')]]={'$like':'%'+_0x42d35c[_0xac89('0x32')][_0xac89('0x3c')]+'%'};return _0x31ccc4;}})});}_0x24255e=_[_0xac89('0x3e')]({},_0x24255e,_0x42d35c[_0xac89('0x40')]);var _0x35a3c8={'where':_0x24255e[_0xac89('0x3d')]};return db[_0xac89('0x2e')][_0xac89('0x1d')](_0x35a3c8)[_0xac89('0x26')](function(_0x486104){_0x3b3115[_0xac89('0x1d')]=_0x486104;if(_0x42d35c[_0xac89('0x32')]['includeAll']){_0x24255e[_0xac89('0x41')]=[{'all':!![]}];}return db['DeskAccount'][_0xac89('0x42')](_0x24255e);})['then'](function(_0x5aec51){_0x3b3115['rows']=_0x5aec51;return _0x3b3115;})[_0xac89('0x26')](respondWithFilteredResult(_0x5927be,_0x24255e))[_0xac89('0x43')](handleError(_0x5927be,null));};exports[_0xac89('0x44')]=function(_0x31ced5,_0x58d2ac){var _0x4834a7={'raw':![],'where':{'id':_0x31ced5['params']['id']}},_0x2f83eb={};_0x2f83eb['model']=_['keys'](db[_0xac89('0x2e')][_0xac89('0x2f')]);_0x2f83eb[_0xac89('0x32')]=_[_0xac89('0x45')](_0x31ced5[_0xac89('0x32')]);_0x2f83eb[_0xac89('0x3a')]=_[_0xac89('0x33')](_0x2f83eb[_0xac89('0x31')],_0x2f83eb['query']);_0x4834a7[_0xac89('0x34')]=_['intersection'](_0x2f83eb[_0xac89('0x31')],qs['fields'](_0x31ced5[_0xac89('0x32')][_0xac89('0x35')]));_0x4834a7[_0xac89('0x34')]=_0x4834a7[_0xac89('0x34')][_0xac89('0x36')]?_0x4834a7[_0xac89('0x34')]:_0x2f83eb[_0xac89('0x31')];if(_0x31ced5[_0xac89('0x32')]['includeAll']){_0x4834a7[_0xac89('0x41')]=[{'all':!![]}];}_0x4834a7=_[_0xac89('0x3e')]({},_0x4834a7,_0x31ced5[_0xac89('0x40')]);return db[_0xac89('0x2e')][_0xac89('0x46')](_0x4834a7)[_0xac89('0x26')](handleEntityNotFound(_0x58d2ac,null))['then'](respondWithResult(_0x58d2ac,null))[_0xac89('0x43')](handleError(_0x58d2ac,null));};exports[_0xac89('0x47')]=function(_0x4a7161,_0x11632d){return db['DeskAccount']['create'](_0x4a7161[_0xac89('0x48')],{})[_0xac89('0x26')](respondWithResult(_0x11632d,0xc9))[_0xac89('0x43')](handleError(_0x11632d,null));};exports[_0xac89('0x24')]=function(_0x4169a6,_0x5e63e9){if(_0x4169a6['body']['id']){delete _0x4169a6[_0xac89('0x48')]['id'];}return db[_0xac89('0x2e')][_0xac89('0x46')]({'where':{'id':_0x4169a6[_0xac89('0x49')]['id']}})[_0xac89('0x26')](handleEntityNotFound(_0x5e63e9,null))[_0xac89('0x26')](saveUpdates(_0x4169a6[_0xac89('0x48')],null))[_0xac89('0x26')](respondWithResult(_0x5e63e9,null))['catch'](handleError(_0x5e63e9,null));};exports[_0xac89('0x25')]=function(_0x2e4d67,_0x8b30bf){return db['DeskAccount'][_0xac89('0x46')]({'where':{'id':_0x2e4d67['params']['id']}})[_0xac89('0x26')](handleEntityNotFound(_0x8b30bf,null))[_0xac89('0x26')](removeEntity(_0x8b30bf,null))[_0xac89('0x43')](handleError(_0x8b30bf,null));};exports[_0xac89('0x4a')]=function(_0x429bce,_0x212cca,_0x4ba485){var _0x171d29={};var _0x3226b8={};var _0x2b7aec;var _0x21e40d;return db['DeskAccount'][_0xac89('0x4b')]({'where':{'id':_0x429bce[_0xac89('0x49')]['id']}})['then'](handleEntityNotFound(_0x212cca,null))[_0xac89('0x26')](function(_0x36e5a9){if(_0x36e5a9){_0x2b7aec=_0x36e5a9;_0x3226b8[_0xac89('0x31')]=_['keys'](db[_0xac89('0x4c')]['rawAttributes']);_0x3226b8['query']=_[_0xac89('0x45')](_0x429bce[_0xac89('0x32')]);_0x3226b8[_0xac89('0x3a')]=_[_0xac89('0x33')](_0x3226b8[_0xac89('0x31')],_0x3226b8[_0xac89('0x32')]);_0x171d29[_0xac89('0x34')]=_[_0xac89('0x33')](_0x3226b8[_0xac89('0x31')],qs[_0xac89('0x35')](_0x429bce[_0xac89('0x32')][_0xac89('0x35')]));_0x171d29[_0xac89('0x34')]=_0x171d29[_0xac89('0x34')][_0xac89('0x36')]?_0x171d29[_0xac89('0x34')]:_0x3226b8['model'];_0x171d29[_0xac89('0x38')]=qs['sort'](_0x429bce[_0xac89('0x32')][_0xac89('0x39')]);_0x171d29[_0xac89('0x3d')]=qs['filters'](_[_0xac89('0x3b')](_0x429bce[_0xac89('0x32')],_0x3226b8[_0xac89('0x3a')]));if(_0x429bce[_0xac89('0x32')]['filter']){_0x171d29[_0xac89('0x3d')]=_['merge'](_0x171d29[_0xac89('0x3d')],{'$or':_[_0xac89('0x2d')](_0x171d29['attributes'],function(_0x5b95ac){var _0x54659b={};_0x54659b[_0x5b95ac]={'$like':'%'+_0x429bce[_0xac89('0x32')]['filter']+'%'};return _0x54659b;})});}_0x171d29=_[_0xac89('0x3e')]({},_0x171d29,_0x429bce[_0xac89('0x40')]);return _0x2b7aec[_0xac89('0x4a')](_0x171d29);}})[_0xac89('0x26')](function(_0x2244af){if(_0x2244af){_0x21e40d=_0x2244af[_0xac89('0x36')];if(!_0x429bce[_0xac89('0x32')][_0xac89('0x4d')](_0xac89('0x37'))){_0x171d29[_0xac89('0x1b')]=qs[_0xac89('0x1b')](_0x429bce[_0xac89('0x32')]['limit']);_0x171d29[_0xac89('0x1a')]=qs[_0xac89('0x1a')](_0x429bce[_0xac89('0x32')][_0xac89('0x1a')]);}return _0x2b7aec['getConfigurations'](_0x171d29);}})[_0xac89('0x26')](function(_0x5cdb43){if(_0x5cdb43){return _0x5cdb43?{'count':_0x21e40d,'rows':_0x5cdb43}:null;}})[_0xac89('0x26')](respondWithResult(_0x212cca,null))['catch'](handleError(_0x212cca,null));};exports['addConfiguration']=function(_0x590a35,_0x3dc237,_0xa3024b){if(_0x590a35[_0xac89('0x48')]['id']){delete _0x590a35[_0xac89('0x48')]['id'];}return db[_0xac89('0x2e')][_0xac89('0x4b')]({'where':{'id':_0x590a35[_0xac89('0x49')]['id']}})[_0xac89('0x26')](handleEntityNotFound(_0x3dc237,null))[_0xac89('0x26')](function(_0x3af7b8){if(_0x3af7b8){_0x590a35['body'][_0xac89('0x4e')]=_0x3af7b8['id'];_0x590a35['body'][_0xac89('0x4f')]=integrations[_0xac89('0x50')](_0x590a35[_0xac89('0x48')]['channel'],_0x590a35[_0xac89('0x48')]['type']);_0x590a35[_0xac89('0x48')][_0xac89('0x51')]=integrations['getDescriptions'](_0x590a35['body']['channel'],_0x590a35[_0xac89('0x48')][_0xac89('0x3f')]);return db[_0xac89('0x4c')][_0xac89('0x47')](_0x590a35[_0xac89('0x48')],{'include':[{'model':db[_0xac89('0x52')],'as':_0xac89('0x4f')},{'model':db[_0xac89('0x52')],'as':'Descriptions'}]});}return null;})[_0xac89('0x26')](respondWithResult(_0x3dc237,null))['catch'](handleError(_0x3dc237,null));};exports['getFields']=function(_0x6f88a6,_0x3a90bb,_0x38aa97){var _0xb1c3be=[{'name':'priority','label':_0xac89('0x53'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0xfb06ed='';return db[_0xac89('0x2e')][_0xac89('0x4b')]({'where':{'id':_0x6f88a6[_0xac89('0x49')]['id']},'attributes':['id','remoteUri',_0xac89('0x54'),_0xac89('0x55'),_0xac89('0x56'),_0xac89('0x57'),_0xac89('0x58'),'token','tokenSecret']})[_0xac89('0x26')](handleEntityNotFound(_0x3a90bb,null))[_0xac89('0x26')](function(_0x3b7503){if(_0x3b7503){_0xfb06ed=_0x3b7503[_0xac89('0x59')];var _0x56da3d=_0xfb06ed[_0xac89('0x5a')](-0x1);if(_0x56da3d==='/'){_0xfb06ed=_0xfb06ed[_0xac89('0x5b')](0x0,_0xfb06ed['lastIndexOf'](_0x56da3d));}var _0x47dc0a={'method':'GET','uri':util[_0xac89('0x5c')](_0xac89('0x5d'),_0xfb06ed),'headers':{'Content-Type':_0xac89('0x5e'),'Accept':_0xac89('0x5e')},'json':!![]};if(_0x3b7503[_0xac89('0x54')]==='basic'){_0x47dc0a['headers'][_0xac89('0x5f')]=util[_0xac89('0x5c')](_0xac89('0x60'),new Buffer(util['format'](_0xac89('0x61'),_0x3b7503['username'],_0x3b7503[_0xac89('0x56')]))[_0xac89('0x62')](_0xac89('0x63')));}return rp(_0x47dc0a)['then'](function(_0x259371){return _0xb1c3be['concat'](_[_0xac89('0x2d')](_0x259371[_0xac89('0x64')]['entries'],function(_0x4ddaab){return{'id':_0x4ddaab[_0xac89('0x2a')],'name':_0x4ddaab[_0xac89('0x2a')],'type':_0x4ddaab[_0xac89('0x3f')],'active':_0x4ddaab[_0xac89('0x65')],'label':_0x4ddaab[_0xac89('0x66')],'custom':!![]};}));});}})['then'](function(_0x1454b7){return{'count':_0x1454b7[_0xac89('0x36')],'rows':_0x1454b7};})['then'](respondWithResult(_0x3a90bb,null))[_0xac89('0x43')](function(_0x17d541){var _0x515bc3=_0x6f88a6[_0xac89('0x32')]['test']?0x1f4:_0x17d541[_0xac89('0x67')]||0x1f4;logger['error'](_0xac89('0x68'),_0xac89('0x69'),_0x515bc3,JSON['stringify'](_0x17d541));delete _0x17d541[_0xac89('0x2a')];if(_0x515bc3===0x191){_0x515bc3=0x190;}_0x3a90bb['status'](_0x515bc3)[_0xac89('0x2b')](_0x6f88a6[_0xac89('0x32')][_0xac89('0x6a')]?{'message':_0xac89('0x6b'),'statusCode':_0x17d541[_0xac89('0x67')]}:_0x17d541);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 9dbb8af..30838f6 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 _0x159e=['exports','define','DeskAccount','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0x1d080d,_0x3d075a){var _0x54925d=function(_0x25284c){while(--_0x25284c){_0x1d080d['push'](_0x1d080d['shift']());}};_0x54925d(++_0x3d075a);}(_0x159e,0x145));var _0xe159=function(_0x34a8ee,_0x5a1bf4){_0x34a8ee=_0x34a8ee-0x0;var _0x4126f1=_0x159e[_0x34a8ee];return _0x4126f1;};'use strict';var _=require(_0xe159('0x0'));var util=require('util');var logger=require(_0xe159('0x1'))(_0xe159('0x2'));var moment=require(_0xe159('0x3'));var BPromise=require(_0xe159('0x4'));var rp=require(_0xe159('0x5'));var fs=require('fs');var path=require(_0xe159('0x6'));var rimraf=require(_0xe159('0x7'));var config=require(_0xe159('0x8'));var attributes=require(_0xe159('0x9'));var integrations=require(_0xe159('0xa'));module[_0xe159('0xb')]=function(_0xa9ae9b,_0x16bb1f){return _0xa9ae9b[_0xe159('0xc')](_0xe159('0xd'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0e5=['rimraf','../../config/environment','../../components/integrations/configuration','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x576d5b,_0x1b8b7b){var _0x5b1f5e=function(_0xc8aa04){while(--_0xc8aa04){_0x576d5b['push'](_0x576d5b['shift']());}};_0x5b1f5e(++_0x1b8b7b);}(_0xd0e5,0x1bd));var _0x5d0e=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0xd0e5[_0x2555d0];return _0x3bb486;};'use strict';var _=require(_0x5d0e('0x0'));var util=require(_0x5d0e('0x1'));var logger=require(_0x5d0e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5d0e('0x3'));var rp=require(_0x5d0e('0x4'));var fs=require('fs');var path=require(_0x5d0e('0x5'));var rimraf=require(_0x5d0e('0x6'));var config=require(_0x5d0e('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x5d0e('0x8'));module['exports']=function(_0x5d3725,_0x17ecd9){return _0x5d3725['define'](_0x5d0e('0x9'),attributes,{'tableName':_0x5d0e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index fcd3fd2..bb38be6 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 _0xaf4e=['attributes','stringify','catch','ShowDeskAccount','find','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','GetDeskAccount','DeskAccount','findAll','options','raw','where','include','map','model'];(function(_0x5ddbd8,_0xcc7237){var _0x4e5cac=function(_0x4dc562){while(--_0x4dc562){_0x5ddbd8['push'](_0x5ddbd8['shift']());}};_0x4e5cac(++_0xcc7237);}(_0xaf4e,0x19d));var _0xeaf4=function(_0x392de5,_0x326dce){_0x392de5=_0x392de5-0x0;var _0x19d104=_0xaf4e[_0x392de5];return _0x19d104;};'use strict';var _=require(_0xeaf4('0x0'));var util=require(_0xeaf4('0x1'));var moment=require(_0xeaf4('0x2'));var BPromise=require(_0xeaf4('0x3'));var rs=require(_0xeaf4('0x4'));var fs=require('fs');var Redis=require(_0xeaf4('0x5'));var db=require(_0xeaf4('0x6'))['db'];var utils=require(_0xeaf4('0x7'));var logger=require(_0xeaf4('0x8'))(_0xeaf4('0x9'));var config=require(_0xeaf4('0xa'));var jayson=require(_0xeaf4('0xb'));var client=jayson[_0xeaf4('0xc')][_0xeaf4('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xa40d78,_0x12469d,_0xc73960){return new BPromise(function(_0x1e8b86,_0xf605b8){return client['request'](_0xa40d78,_0xc73960)[_0xeaf4('0xe')](function(_0x41fa75){logger[_0xeaf4('0xf')](_0xeaf4('0x10'),_0x12469d,_0xeaf4('0x11'));logger['debug'](_0xeaf4('0x12'),_0x12469d,_0xeaf4('0x11'),JSON['stringify'](_0x41fa75));if(_0x41fa75[_0xeaf4('0x13')]){if(_0x41fa75['error'][_0xeaf4('0x14')]===0x1f4){logger[_0xeaf4('0x13')](_0xeaf4('0x10'),_0x12469d,_0x41fa75[_0xeaf4('0x13')][_0xeaf4('0x15')]);return _0xf605b8(_0x41fa75[_0xeaf4('0x13')]['message']);}logger[_0xeaf4('0x13')](_0xeaf4('0x10'),_0x12469d,_0x41fa75[_0xeaf4('0x13')][_0xeaf4('0x15')]);return _0x1e8b86(_0x41fa75[_0xeaf4('0x13')]['message']);}else{logger[_0xeaf4('0xf')](_0xeaf4('0x10'),_0x12469d,_0xeaf4('0x11'));_0x1e8b86(_0x41fa75['result'][_0xeaf4('0x15')]);}})['catch'](function(_0x4ce4eb){logger['error'](_0xeaf4('0x10'),_0x12469d,_0x4ce4eb);_0xf605b8(_0x4ce4eb);});});}exports[_0xeaf4('0x16')]=function(_0x5881a5){var _0x6b0864=this;return new Promise(function(_0xdad785,_0x438c91){return db[_0xeaf4('0x17')][_0xeaf4('0x18')]({'raw':_0x5881a5[_0xeaf4('0x19')]?_0x5881a5[_0xeaf4('0x19')][_0xeaf4('0x1a')]===undefined?!![]:![]:!![],'where':_0x5881a5[_0xeaf4('0x19')]?_0x5881a5[_0xeaf4('0x19')][_0xeaf4('0x1b')]||null:null,'attributes':_0x5881a5[_0xeaf4('0x19')]?_0x5881a5[_0xeaf4('0x19')]['attributes']||null:null,'limit':_0x5881a5[_0xeaf4('0x19')]?_0x5881a5['options']['limit']||null:null,'include':_0x5881a5[_0xeaf4('0x19')]?_0x5881a5['options'][_0xeaf4('0x1c')]?_[_0xeaf4('0x1d')](_0x5881a5[_0xeaf4('0x19')][_0xeaf4('0x1c')],function(_0x1beabe){return{'model':db[_0x1beabe[_0xeaf4('0x1e')]],'as':_0x1beabe['as'],'attributes':_0x1beabe[_0xeaf4('0x1f')],'include':_0x1beabe[_0xeaf4('0x1c')]?_[_0xeaf4('0x1d')](_0x1beabe['include'],function(_0x12c49e){return{'model':db[_0x12c49e[_0xeaf4('0x1e')]],'as':_0x12c49e['as'],'attributes':_0x12c49e[_0xeaf4('0x1f')],'include':_0x12c49e[_0xeaf4('0x1c')]?_[_0xeaf4('0x1d')](_0x12c49e[_0xeaf4('0x1c')],function(_0x53a001){return{'model':db[_0x53a001[_0xeaf4('0x1e')]],'as':_0x53a001['as'],'attributes':_0x53a001[_0xeaf4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xeaf4('0xe')](function(_0x2c1ee1){logger['info'](_0xeaf4('0x16'),_0x5881a5);logger['debug'](_0xeaf4('0x16'),_0x5881a5,JSON[_0xeaf4('0x20')](_0x2c1ee1));_0xdad785(_0x2c1ee1);})[_0xeaf4('0x21')](function(_0x51c052){logger[_0xeaf4('0x13')](_0xeaf4('0x16'),_0x51c052[_0xeaf4('0x15')],_0x5881a5);_0x438c91(_0x6b0864['error'](0x1f4,_0x51c052[_0xeaf4('0x15')]));});});};exports[_0xeaf4('0x22')]=function(_0x4bff77){var _0x27a92b=this;return new Promise(function(_0x54c8c3,_0xeda649){return db[_0xeaf4('0x17')][_0xeaf4('0x23')]({'raw':_0x4bff77[_0xeaf4('0x19')]?_0x4bff77['options'][_0xeaf4('0x1a')]===undefined?!![]:![]:!![],'where':_0x4bff77[_0xeaf4('0x19')]?_0x4bff77[_0xeaf4('0x19')][_0xeaf4('0x1b')]||null:null,'attributes':_0x4bff77[_0xeaf4('0x19')]?_0x4bff77[_0xeaf4('0x19')]['attributes']||null:null,'include':_0x4bff77[_0xeaf4('0x19')]?_0x4bff77[_0xeaf4('0x19')]['include']?_['map'](_0x4bff77[_0xeaf4('0x19')][_0xeaf4('0x1c')],function(_0x5d3b8b){return{'model':db[_0x5d3b8b[_0xeaf4('0x1e')]],'as':_0x5d3b8b['as'],'attributes':_0x5d3b8b['attributes'],'include':_0x5d3b8b[_0xeaf4('0x1c')]?_[_0xeaf4('0x1d')](_0x5d3b8b[_0xeaf4('0x1c')],function(_0x3a4177){return{'model':db[_0x3a4177[_0xeaf4('0x1e')]],'as':_0x3a4177['as'],'attributes':_0x3a4177[_0xeaf4('0x1f')],'include':_0x3a4177['include']?_[_0xeaf4('0x1d')](_0x3a4177[_0xeaf4('0x1c')],function(_0x928565){return{'model':db[_0x928565[_0xeaf4('0x1e')]],'as':_0x928565['as'],'attributes':_0x928565[_0xeaf4('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1da972){logger['info']('ShowDeskAccount',_0x4bff77);logger[_0xeaf4('0x24')](_0xeaf4('0x22'),_0x4bff77,JSON[_0xeaf4('0x20')](_0x1da972));_0x54c8c3(_0x1da972);})[_0xeaf4('0x21')](function(_0x15f6dd){logger['error'](_0xeaf4('0x22'),_0x15f6dd[_0xeaf4('0x15')],_0x4bff77);_0xeda649(_0x27a92b[_0xeaf4('0x13')](0x1f4,_0x15f6dd[_0xeaf4('0x15')]));});});}; \ No newline at end of file +var _0xa179=['DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetDeskAccount','ShowDeskAccount','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then'];(function(_0x424b27,_0x54d9c2){var _0x37c091=function(_0x43865d){while(--_0x43865d){_0x424b27['push'](_0x424b27['shift']());}};_0x37c091(++_0x54d9c2);}(_0xa179,0xe3));var _0x9a17=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa179[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9a17('0x0'));var util=require('util');var moment=require(_0x9a17('0x1'));var BPromise=require('bluebird');var rs=require(_0x9a17('0x2'));var fs=require('fs');var Redis=require(_0x9a17('0x3'));var db=require(_0x9a17('0x4'))['db'];var utils=require(_0x9a17('0x5'));var logger=require(_0x9a17('0x6'))(_0x9a17('0x7'));var config=require(_0x9a17('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a1cc2,_0x3f1ee6,_0x11d538){return new BPromise(function(_0x3d8129,_0x185a31){return client[_0x9a17('0x9')](_0x1a1cc2,_0x11d538)[_0x9a17('0xa')](function(_0xeec794){logger['info'](_0x9a17('0xb'),_0x3f1ee6,_0x9a17('0xc'));logger[_0x9a17('0xd')](_0x9a17('0xe'),_0x3f1ee6,_0x9a17('0xc'),JSON[_0x9a17('0xf')](_0xeec794));if(_0xeec794[_0x9a17('0x10')]){if(_0xeec794[_0x9a17('0x10')]['code']===0x1f4){logger[_0x9a17('0x10')](_0x9a17('0xb'),_0x3f1ee6,_0xeec794[_0x9a17('0x10')]['message']);return _0x185a31(_0xeec794['error'][_0x9a17('0x11')]);}logger[_0x9a17('0x10')](_0x9a17('0xb'),_0x3f1ee6,_0xeec794[_0x9a17('0x10')][_0x9a17('0x11')]);return _0x3d8129(_0xeec794[_0x9a17('0x10')][_0x9a17('0x11')]);}else{logger[_0x9a17('0x12')](_0x9a17('0xb'),_0x3f1ee6,_0x9a17('0xc'));_0x3d8129(_0xeec794[_0x9a17('0x13')][_0x9a17('0x11')]);}})[_0x9a17('0x14')](function(_0x90d900){logger[_0x9a17('0x10')](_0x9a17('0xb'),_0x3f1ee6,_0x90d900);_0x185a31(_0x90d900);});});}exports['GetDeskAccount']=function(_0x57b470){var _0x22b2b5=this;return new Promise(function(_0x2cb402,_0x212a79){return db[_0x9a17('0x15')][_0x9a17('0x16')]({'raw':_0x57b470[_0x9a17('0x17')]?_0x57b470[_0x9a17('0x17')][_0x9a17('0x18')]===undefined?!![]:![]:!![],'where':_0x57b470[_0x9a17('0x17')]?_0x57b470[_0x9a17('0x17')][_0x9a17('0x19')]||null:null,'attributes':_0x57b470[_0x9a17('0x17')]?_0x57b470[_0x9a17('0x17')][_0x9a17('0x1a')]||null:null,'limit':_0x57b470[_0x9a17('0x17')]?_0x57b470[_0x9a17('0x17')][_0x9a17('0x1b')]||null:null,'include':_0x57b470[_0x9a17('0x17')]?_0x57b470[_0x9a17('0x17')][_0x9a17('0x1c')]?_['map'](_0x57b470[_0x9a17('0x17')]['include'],function(_0x551491){return{'model':db[_0x551491['model']],'as':_0x551491['as'],'attributes':_0x551491[_0x9a17('0x1a')],'include':_0x551491[_0x9a17('0x1c')]?_[_0x9a17('0x1d')](_0x551491[_0x9a17('0x1c')],function(_0x23aa49){return{'model':db[_0x23aa49['model']],'as':_0x23aa49['as'],'attributes':_0x23aa49[_0x9a17('0x1a')],'include':_0x23aa49['include']?_[_0x9a17('0x1d')](_0x23aa49['include'],function(_0x22e2df){return{'model':db[_0x22e2df[_0x9a17('0x1e')]],'as':_0x22e2df['as'],'attributes':_0x22e2df[_0x9a17('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4df651){logger[_0x9a17('0x12')](_0x9a17('0x1f'),_0x57b470);logger[_0x9a17('0xd')](_0x9a17('0x1f'),_0x57b470,JSON[_0x9a17('0xf')](_0x4df651));_0x2cb402(_0x4df651);})[_0x9a17('0x14')](function(_0x477fac){logger['error'](_0x9a17('0x1f'),_0x477fac['message'],_0x57b470);_0x212a79(_0x22b2b5[_0x9a17('0x10')](0x1f4,_0x477fac[_0x9a17('0x11')]));});});};exports[_0x9a17('0x20')]=function(_0x4a8d72){var _0x5ab748=this;return new Promise(function(_0x47c6fe,_0x101eeb){return db['DeskAccount'][_0x9a17('0x21')]({'raw':_0x4a8d72[_0x9a17('0x17')]?_0x4a8d72[_0x9a17('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4a8d72[_0x9a17('0x17')]?_0x4a8d72[_0x9a17('0x17')][_0x9a17('0x19')]||null:null,'attributes':_0x4a8d72[_0x9a17('0x17')]?_0x4a8d72[_0x9a17('0x17')][_0x9a17('0x1a')]||null:null,'include':_0x4a8d72[_0x9a17('0x17')]?_0x4a8d72['options'][_0x9a17('0x1c')]?_[_0x9a17('0x1d')](_0x4a8d72[_0x9a17('0x17')][_0x9a17('0x1c')],function(_0x486c51){return{'model':db[_0x486c51[_0x9a17('0x1e')]],'as':_0x486c51['as'],'attributes':_0x486c51['attributes'],'include':_0x486c51[_0x9a17('0x1c')]?_['map'](_0x486c51[_0x9a17('0x1c')],function(_0xc6108e){return{'model':db[_0xc6108e[_0x9a17('0x1e')]],'as':_0xc6108e['as'],'attributes':_0xc6108e[_0x9a17('0x1a')],'include':_0xc6108e[_0x9a17('0x1c')]?_[_0x9a17('0x1d')](_0xc6108e[_0x9a17('0x1c')],function(_0xd84ae9){return{'model':db[_0xd84ae9[_0x9a17('0x1e')]],'as':_0xd84ae9['as'],'attributes':_0xd84ae9[_0x9a17('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9a17('0xa')](function(_0xa176){logger['info'](_0x9a17('0x20'),_0x4a8d72);logger[_0x9a17('0xd')](_0x9a17('0x20'),_0x4a8d72,JSON[_0x9a17('0xf')](_0xa176));_0x47c6fe(_0xa176);})[_0x9a17('0x14')](function(_0x3287da){logger[_0x9a17('0x10')](_0x9a17('0x20'),_0x3287da[_0x9a17('0x11')],_0x4a8d72);_0x101eeb(_0x5ab748[_0x9a17('0x10')](0x1f4,_0x3287da[_0x9a17('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 7f3a757..b5d7365 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(_0x35de9d,_0x39d81c){var _0x2b3874=function(_0xf633dd){while(--_0xf633dd){_0x35de9d['push'](_0x35de9d['shift']());}};_0x2b3874(++_0x39d81c);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');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 _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x2f90ee,_0x499cd3){var _0x455526=function(_0x1c46f0){while(--_0x1c46f0){_0x2f90ee['push'](_0x2f90ee['shift']());}};_0x455526(++_0x499cd3);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index ed8b10c..e555619 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 _0x9bf7=['sequelize','exports','STRING'];(function(_0x5d12bd,_0x30c47c){var _0x520b8b=function(_0x3a1d3d){while(--_0x3a1d3d){_0x5d12bd['push'](_0x5d12bd['shift']());}};_0x520b8b(++_0x30c47c);}(_0x9bf7,0x1ce));var _0x79bf=function(_0x4f16b5,_0xfb1151){_0x4f16b5=_0x4f16b5-0x0;var _0x3d471b=_0x9bf7[_0x4f16b5];return _0x3d471b;};'use strict';var Sequelize=require(_0x79bf('0x0'));module[_0x79bf('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x79bf('0x2')]}}; \ No newline at end of file +var _0x9f3f=['exports','sequelize'];(function(_0xf21353,_0x4e76cf){var _0xd2371f=function(_0xca6953){while(--_0xca6953){_0xf21353['push'](_0xf21353['shift']());}};_0xd2371f(++_0x4e76cf);}(_0x9f3f,0xb5));var _0xf9f3=function(_0x24fa1a,_0x16d9c2){_0x24fa1a=_0x24fa1a-0x0;var _0xc5621f=_0x9f3f[_0x24fa1a];return _0xc5621f;};'use strict';var Sequelize=require(_0xf9f3('0x0'));module[_0xf9f3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 8bb8aff..dd88717 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 _0xcba0=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','count','includeAll','include','rows','show','params','keys','rawAttributes','find','create','body','catch','destroy','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','limit','offset','set','Content-Range','apply','save','update','then','end','name','send','map','DeskConfiguration','fieldName','model','query'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xcba0,0xc0));var _0x0cba=function(_0x18c8b0,_0x3e1c87){_0x18c8b0=_0x18c8b0-0x0;var _0x1dc91c=_0xcba0[_0x18c8b0];return _0x1dc91c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0cba('0x0'));var zipdir=require(_0x0cba('0x1'));var jsonpatch=require(_0x0cba('0x2'));var rp=require(_0x0cba('0x3'));var moment=require(_0x0cba('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0cba('0x5'));var path=require('path');var sox=require(_0x0cba('0x6'));var csv=require(_0x0cba('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0cba('0x8'));var _=require(_0x0cba('0x9'));var squel=require('squel');var crypto=require(_0x0cba('0xa'));var jsforce=require(_0x0cba('0xb'));var deskjs=require(_0x0cba('0xc'));var toCsv=require(_0x0cba('0x7'));var querystring=require(_0x0cba('0xd'));var Papa=require('papaparse');var Redis=require(_0x0cba('0xe'));var authService=require(_0x0cba('0xf'));var qs=require(_0x0cba('0x10'));var as=require(_0x0cba('0x11'));var hardwareService=require(_0x0cba('0x12'));var logger=require(_0x0cba('0x13'))(_0x0cba('0x14'));var utils=require(_0x0cba('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0cba('0x16'));var db=require(_0x0cba('0x17'))['db'];function respondWithStatusCode(_0xff5e4e,_0x4fcaa0){_0x4fcaa0=_0x4fcaa0||0xcc;return function(_0x590c3e){if(_0x590c3e){return _0xff5e4e['sendStatus'](_0x4fcaa0);}return _0xff5e4e[_0x0cba('0x18')](_0x4fcaa0)['end']();};}function respondWithResult(_0x464714,_0x1e882b){_0x1e882b=_0x1e882b||0xc8;return function(_0x51c060){if(_0x51c060){return _0x464714[_0x0cba('0x18')](_0x1e882b)[_0x0cba('0x19')](_0x51c060);}};}function respondWithFilteredResult(_0x3deb0f,_0x1fde35){return function(_0x24058b){if(_0x24058b){var _0x24dbd4=typeof _0x1fde35['offset']==='undefined'&&typeof _0x1fde35[_0x0cba('0x1a')]==='undefined';var _0x4ff241=_0x24058b['count'];var _0x157e27=_0x24dbd4?0x0:_0x1fde35['offset'];var _0x56ef96=_0x24dbd4?_0x24058b['count']:_0x1fde35[_0x0cba('0x1b')]+_0x1fde35['limit'];var _0xabe120;if(_0x56ef96>=_0x4ff241){_0x56ef96=_0x4ff241;_0xabe120=0xc8;}else{_0xabe120=0xce;}_0x3deb0f['status'](_0xabe120);return _0x3deb0f[_0x0cba('0x1c')](_0x0cba('0x1d'),_0x157e27+'-'+_0x56ef96+'/'+_0x4ff241)[_0x0cba('0x19')](_0x24058b);}return null;};}function patchUpdates(_0x135927){return function(_0x48478d){try{jsonpatch[_0x0cba('0x1e')](_0x48478d,_0x135927,!![]);}catch(_0xfe4969){return BPromise['reject'](_0xfe4969);}return _0x48478d[_0x0cba('0x1f')]();};}function saveUpdates(_0xe24a4e,_0x2d6800){return function(_0x3e7181){if(_0x3e7181){return _0x3e7181[_0x0cba('0x20')](_0xe24a4e)[_0x0cba('0x21')](function(_0x11a292){return _0x11a292;});}return null;};}function removeEntity(_0xf4504,_0x4028b9){return function(_0x265fa6){if(_0x265fa6){return _0x265fa6['destroy']()[_0x0cba('0x21')](function(){_0xf4504[_0x0cba('0x18')](0xcc)[_0x0cba('0x22')]();});}};}function handleEntityNotFound(_0x290f2c,_0x11ee31){return function(_0x5d5a47){if(!_0x5d5a47){_0x290f2c['sendStatus'](0x194);}return _0x5d5a47;};}function handleError(_0x43f289,_0x5c5464){_0x5c5464=_0x5c5464||0x1f4;return function(_0x3df455){logger['error'](_0x3df455['stack']);if(_0x3df455[_0x0cba('0x23')]){delete _0x3df455[_0x0cba('0x23')];}_0x43f289['status'](_0x5c5464)[_0x0cba('0x24')](_0x3df455);};}exports['index']=function(_0x569f6b,_0x4e2d0f){var _0x4aace9={},_0x1d3bd7={},_0x3edef8={'count':0x0,'rows':[]};var _0x17df40=_[_0x0cba('0x25')](db[_0x0cba('0x26')]['rawAttributes'],function(_0xf413c2){return{'name':_0xf413c2[_0x0cba('0x27')],'type':_0xf413c2['type']['key']};});_0x1d3bd7[_0x0cba('0x28')]=_[_0x0cba('0x25')](_0x17df40,'name');_0x1d3bd7[_0x0cba('0x29')]=_['keys'](_0x569f6b[_0x0cba('0x29')]);_0x1d3bd7[_0x0cba('0x2a')]=_[_0x0cba('0x2b')](_0x1d3bd7[_0x0cba('0x28')],_0x1d3bd7[_0x0cba('0x29')]);_0x4aace9['attributes']=_[_0x0cba('0x2b')](_0x1d3bd7[_0x0cba('0x28')],qs[_0x0cba('0x2c')](_0x569f6b[_0x0cba('0x29')][_0x0cba('0x2c')]));_0x4aace9['attributes']=_0x4aace9[_0x0cba('0x2d')][_0x0cba('0x2e')]?_0x4aace9['attributes']:_0x1d3bd7[_0x0cba('0x28')];if(!_0x569f6b['query'][_0x0cba('0x2f')](_0x0cba('0x30'))){_0x4aace9['limit']=qs['limit'](_0x569f6b[_0x0cba('0x29')][_0x0cba('0x1a')]);_0x4aace9[_0x0cba('0x1b')]=qs[_0x0cba('0x1b')](_0x569f6b[_0x0cba('0x29')]['offset']);}_0x4aace9[_0x0cba('0x31')]=qs[_0x0cba('0x32')](_0x569f6b[_0x0cba('0x29')][_0x0cba('0x32')]);_0x4aace9[_0x0cba('0x33')]=qs[_0x0cba('0x2a')](_[_0x0cba('0x34')](_0x569f6b[_0x0cba('0x29')],_0x1d3bd7['filters']),_0x17df40);if(_0x569f6b[_0x0cba('0x29')][_0x0cba('0x35')]){_0x4aace9[_0x0cba('0x33')]=_[_0x0cba('0x36')](_0x4aace9['where'],{'$or':_[_0x0cba('0x25')](_0x17df40,function(_0xccd189){if(_0xccd189[_0x0cba('0x37')]!=='VIRTUAL'){var _0x429688={};_0x429688[_0xccd189[_0x0cba('0x23')]]={'$like':'%'+_0x569f6b[_0x0cba('0x29')][_0x0cba('0x35')]+'%'};return _0x429688;}})});}_0x4aace9=_[_0x0cba('0x36')]({},_0x4aace9,_0x569f6b[_0x0cba('0x38')]);var _0x5b71ac={'where':_0x4aace9[_0x0cba('0x33')]};return db[_0x0cba('0x26')][_0x0cba('0x39')](_0x5b71ac)['then'](function(_0x22ac83){_0x3edef8['count']=_0x22ac83;if(_0x569f6b[_0x0cba('0x29')][_0x0cba('0x3a')]){_0x4aace9[_0x0cba('0x3b')]=[{'all':!![]}];}return db[_0x0cba('0x26')]['findAll'](_0x4aace9);})[_0x0cba('0x21')](function(_0x29efea){_0x3edef8[_0x0cba('0x3c')]=_0x29efea;return _0x3edef8;})[_0x0cba('0x21')](respondWithFilteredResult(_0x4e2d0f,_0x4aace9))['catch'](handleError(_0x4e2d0f,null));};exports[_0x0cba('0x3d')]=function(_0x46ae0,_0x4c1dff){var _0x56b7c5={'raw':![],'where':{'id':_0x46ae0[_0x0cba('0x3e')]['id']}},_0x146495={};_0x146495[_0x0cba('0x28')]=_[_0x0cba('0x3f')](db[_0x0cba('0x26')][_0x0cba('0x40')]);_0x146495[_0x0cba('0x29')]=_[_0x0cba('0x3f')](_0x46ae0[_0x0cba('0x29')]);_0x146495['filters']=_['intersection'](_0x146495['model'],_0x146495['query']);_0x56b7c5[_0x0cba('0x2d')]=_[_0x0cba('0x2b')](_0x146495[_0x0cba('0x28')],qs['fields'](_0x46ae0[_0x0cba('0x29')][_0x0cba('0x2c')]));_0x56b7c5[_0x0cba('0x2d')]=_0x56b7c5[_0x0cba('0x2d')][_0x0cba('0x2e')]?_0x56b7c5[_0x0cba('0x2d')]:_0x146495['model'];if(_0x46ae0[_0x0cba('0x29')][_0x0cba('0x3a')]){_0x56b7c5[_0x0cba('0x3b')]=[{'all':!![]}];}_0x56b7c5=_[_0x0cba('0x36')]({},_0x56b7c5,_0x46ae0[_0x0cba('0x38')]);return db[_0x0cba('0x26')][_0x0cba('0x41')](_0x56b7c5)[_0x0cba('0x21')](handleEntityNotFound(_0x4c1dff,null))[_0x0cba('0x21')](respondWithResult(_0x4c1dff,null))['catch'](handleError(_0x4c1dff,null));};exports[_0x0cba('0x42')]=function(_0x229f5d,_0x317cc4){return db[_0x0cba('0x26')][_0x0cba('0x42')](_0x229f5d[_0x0cba('0x43')],{})['then'](respondWithResult(_0x317cc4,0xc9))[_0x0cba('0x44')](handleError(_0x317cc4,null));};exports[_0x0cba('0x20')]=function(_0x5aaa21,_0x405076){if(_0x5aaa21[_0x0cba('0x43')]['id']){delete _0x5aaa21['body']['id'];}return db['DeskConfiguration'][_0x0cba('0x41')]({'where':{'id':_0x5aaa21[_0x0cba('0x3e')]['id']}})[_0x0cba('0x21')](handleEntityNotFound(_0x405076,null))[_0x0cba('0x21')](saveUpdates(_0x5aaa21['body'],null))[_0x0cba('0x21')](respondWithResult(_0x405076,null))[_0x0cba('0x44')](handleError(_0x405076,null));};exports[_0x0cba('0x45')]=function(_0x59e5b3,_0x316782){return db[_0x0cba('0x26')]['find']({'where':{'id':_0x59e5b3['params']['id']}})['then'](handleEntityNotFound(_0x316782,null))[_0x0cba('0x21')](removeEntity(_0x316782,null))[_0x0cba('0x44')](handleError(_0x316782,null));};exports[_0x0cba('0x46')]=function(_0x1d56df,_0x25d667,_0x365826){var _0x481f4e={};var _0x30797f={};var _0x51fe3f;var _0x5038c4;return db[_0x0cba('0x26')][_0x0cba('0x47')]({'where':{'id':_0x1d56df[_0x0cba('0x3e')]['id']}})[_0x0cba('0x21')](handleEntityNotFound(_0x25d667,null))['then'](function(_0x26f293){if(_0x26f293){_0x51fe3f=_0x26f293;_0x30797f[_0x0cba('0x28')]=_[_0x0cba('0x3f')](db[_0x0cba('0x48')]['rawAttributes']);_0x30797f[_0x0cba('0x29')]=_[_0x0cba('0x3f')](_0x1d56df[_0x0cba('0x29')]);_0x30797f[_0x0cba('0x2a')]=_[_0x0cba('0x2b')](_0x30797f['model'],_0x30797f[_0x0cba('0x29')]);_0x481f4e['attributes']=_[_0x0cba('0x2b')](_0x30797f['model'],qs[_0x0cba('0x2c')](_0x1d56df['query'][_0x0cba('0x2c')]));_0x481f4e['attributes']=_0x481f4e[_0x0cba('0x2d')]['length']?_0x481f4e['attributes']:_0x30797f[_0x0cba('0x28')];_0x481f4e[_0x0cba('0x31')]=qs[_0x0cba('0x32')](_0x1d56df['query']['sort']);_0x481f4e[_0x0cba('0x33')]=qs[_0x0cba('0x2a')](_[_0x0cba('0x34')](_0x1d56df['query'],_0x30797f[_0x0cba('0x2a')]));if(_0x1d56df[_0x0cba('0x29')][_0x0cba('0x35')]){_0x481f4e[_0x0cba('0x33')]=_[_0x0cba('0x36')](_0x481f4e[_0x0cba('0x33')],{'$or':_['map'](_0x481f4e[_0x0cba('0x2d')],function(_0x1458eb){var _0x1264c9={};_0x1264c9[_0x1458eb]={'$like':'%'+_0x1d56df[_0x0cba('0x29')]['filter']+'%'};return _0x1264c9;})});}_0x481f4e=_[_0x0cba('0x36')]({},_0x481f4e,_0x1d56df[_0x0cba('0x38')]);return _0x51fe3f['getFields'](_0x481f4e);}})[_0x0cba('0x21')](function(_0x32f410){if(_0x32f410){_0x5038c4=_0x32f410[_0x0cba('0x2e')];if(!_0x1d56df[_0x0cba('0x29')][_0x0cba('0x2f')]('nolimit')){_0x481f4e[_0x0cba('0x1a')]=qs[_0x0cba('0x1a')](_0x1d56df['query'][_0x0cba('0x1a')]);_0x481f4e[_0x0cba('0x1b')]=qs[_0x0cba('0x1b')](_0x1d56df['query'][_0x0cba('0x1b')]);}return _0x51fe3f['getFields'](_0x481f4e);}})[_0x0cba('0x21')](function(_0x5888fe){if(_0x5888fe){return _0x5888fe?{'count':_0x5038c4,'rows':_0x5888fe}:null;}})[_0x0cba('0x21')](respondWithResult(_0x25d667,null))[_0x0cba('0x44')](handleError(_0x25d667,null));};exports[_0x0cba('0x49')]=function(_0x21b021,_0x451095,_0x555a69){var _0xf5636={};var _0xf3dd7={};var _0x59bf9f;var _0x199eb9;return db['DeskConfiguration'][_0x0cba('0x47')]({'where':{'id':_0x21b021[_0x0cba('0x3e')]['id']}})['then'](handleEntityNotFound(_0x451095,null))[_0x0cba('0x21')](function(_0x157dec){if(_0x157dec){_0x59bf9f=_0x157dec;_0xf3dd7['model']=_[_0x0cba('0x3f')](db['DeskField'][_0x0cba('0x40')]);_0xf3dd7[_0x0cba('0x29')]=_[_0x0cba('0x3f')](_0x21b021[_0x0cba('0x29')]);_0xf3dd7['filters']=_['intersection'](_0xf3dd7[_0x0cba('0x28')],_0xf3dd7[_0x0cba('0x29')]);_0xf5636[_0x0cba('0x2d')]=_['intersection'](_0xf3dd7[_0x0cba('0x28')],qs[_0x0cba('0x2c')](_0x21b021[_0x0cba('0x29')][_0x0cba('0x2c')]));_0xf5636['attributes']=_0xf5636[_0x0cba('0x2d')][_0x0cba('0x2e')]?_0xf5636[_0x0cba('0x2d')]:_0xf3dd7['model'];_0xf5636['order']=qs[_0x0cba('0x32')](_0x21b021['query'][_0x0cba('0x32')]);_0xf5636[_0x0cba('0x33')]=qs[_0x0cba('0x2a')](_[_0x0cba('0x34')](_0x21b021[_0x0cba('0x29')],_0xf3dd7['filters']));if(_0x21b021[_0x0cba('0x29')][_0x0cba('0x35')]){_0xf5636[_0x0cba('0x33')]=_[_0x0cba('0x36')](_0xf5636[_0x0cba('0x33')],{'$or':_[_0x0cba('0x25')](_0xf5636['attributes'],function(_0x35e5b1){var _0x2fe6d0={};_0x2fe6d0[_0x35e5b1]={'$like':'%'+_0x21b021[_0x0cba('0x29')][_0x0cba('0x35')]+'%'};return _0x2fe6d0;})});}_0xf5636=_[_0x0cba('0x36')]({},_0xf5636,_0x21b021['options']);return _0x59bf9f['getSubjects'](_0xf5636);}})[_0x0cba('0x21')](function(_0x17be79){if(_0x17be79){_0x199eb9=_0x17be79['length'];if(!_0x21b021[_0x0cba('0x29')][_0x0cba('0x2f')](_0x0cba('0x30'))){_0xf5636[_0x0cba('0x1a')]=qs[_0x0cba('0x1a')](_0x21b021[_0x0cba('0x29')][_0x0cba('0x1a')]);_0xf5636[_0x0cba('0x1b')]=qs[_0x0cba('0x1b')](_0x21b021[_0x0cba('0x29')][_0x0cba('0x1b')]);}return _0x59bf9f[_0x0cba('0x49')](_0xf5636);}})[_0x0cba('0x21')](function(_0x1eed6b){if(_0x1eed6b){return _0x1eed6b?{'count':_0x199eb9,'rows':_0x1eed6b}:null;}})['then'](respondWithResult(_0x451095,null))[_0x0cba('0x44')](handleError(_0x451095,null));};exports[_0x0cba('0x4a')]=function(_0x3df64a,_0x44131b,_0x5183c7){var _0x5d1d19={};var _0x55708d={};var _0x2354dd;var _0x15960c;return db[_0x0cba('0x26')][_0x0cba('0x47')]({'where':{'id':_0x3df64a[_0x0cba('0x3e')]['id']}})[_0x0cba('0x21')](handleEntityNotFound(_0x44131b,null))[_0x0cba('0x21')](function(_0x301bd7){if(_0x301bd7){_0x2354dd=_0x301bd7;_0x55708d['model']=_[_0x0cba('0x3f')](db['DeskField'][_0x0cba('0x40')]);_0x55708d[_0x0cba('0x29')]=_[_0x0cba('0x3f')](_0x3df64a['query']);_0x55708d[_0x0cba('0x2a')]=_[_0x0cba('0x2b')](_0x55708d[_0x0cba('0x28')],_0x55708d[_0x0cba('0x29')]);_0x5d1d19[_0x0cba('0x2d')]=_[_0x0cba('0x2b')](_0x55708d[_0x0cba('0x28')],qs['fields'](_0x3df64a[_0x0cba('0x29')][_0x0cba('0x2c')]));_0x5d1d19[_0x0cba('0x2d')]=_0x5d1d19[_0x0cba('0x2d')][_0x0cba('0x2e')]?_0x5d1d19['attributes']:_0x55708d[_0x0cba('0x28')];_0x5d1d19[_0x0cba('0x31')]=qs['sort'](_0x3df64a['query'][_0x0cba('0x32')]);_0x5d1d19[_0x0cba('0x33')]=qs[_0x0cba('0x2a')](_[_0x0cba('0x34')](_0x3df64a[_0x0cba('0x29')],_0x55708d[_0x0cba('0x2a')]));if(_0x3df64a['query'][_0x0cba('0x35')]){_0x5d1d19[_0x0cba('0x33')]=_[_0x0cba('0x36')](_0x5d1d19[_0x0cba('0x33')],{'$or':_[_0x0cba('0x25')](_0x5d1d19[_0x0cba('0x2d')],function(_0x15cf14){var _0x597c05={};_0x597c05[_0x15cf14]={'$like':'%'+_0x3df64a[_0x0cba('0x29')]['filter']+'%'};return _0x597c05;})});}_0x5d1d19=_[_0x0cba('0x36')]({},_0x5d1d19,_0x3df64a['options']);return _0x2354dd[_0x0cba('0x4a')](_0x5d1d19);}})[_0x0cba('0x21')](function(_0xeb62f3){if(_0xeb62f3){_0x15960c=_0xeb62f3['length'];if(!_0x3df64a[_0x0cba('0x29')][_0x0cba('0x2f')](_0x0cba('0x30'))){_0x5d1d19[_0x0cba('0x1a')]=qs['limit'](_0x3df64a[_0x0cba('0x29')]['limit']);_0x5d1d19[_0x0cba('0x1b')]=qs['offset'](_0x3df64a[_0x0cba('0x29')][_0x0cba('0x1b')]);}return _0x2354dd[_0x0cba('0x4a')](_0x5d1d19);}})[_0x0cba('0x21')](function(_0x4c3586){if(_0x4c3586){return _0x4c3586?{'count':_0x15960c,'rows':_0x4c3586}:null;}})['then'](respondWithResult(_0x44131b,null))[_0x0cba('0x44')](handleError(_0x44131b,null));};exports[_0x0cba('0x4b')]=function(_0x10685f,_0x5927b1,_0x271c3e){var _0x2508ad={};var _0x2ad37c={};var _0x124165;var _0x534cb7;return db[_0x0cba('0x26')][_0x0cba('0x47')]({'where':{'id':_0x10685f[_0x0cba('0x3e')]['id']}})[_0x0cba('0x21')](handleEntityNotFound(_0x5927b1,null))['then'](function(_0x51bbe3){if(_0x51bbe3){_0x124165=_0x51bbe3;_0x2ad37c[_0x0cba('0x28')]=_['keys'](db['Tag'][_0x0cba('0x40')]);_0x2ad37c['query']=_[_0x0cba('0x3f')](_0x10685f[_0x0cba('0x29')]);_0x2ad37c[_0x0cba('0x2a')]=_[_0x0cba('0x2b')](_0x2ad37c[_0x0cba('0x28')],_0x2ad37c['query']);_0x2508ad['attributes']=_[_0x0cba('0x2b')](_0x2ad37c[_0x0cba('0x28')],qs['fields'](_0x10685f['query'][_0x0cba('0x2c')]));_0x2508ad[_0x0cba('0x2d')]=_0x2508ad[_0x0cba('0x2d')]['length']?_0x2508ad[_0x0cba('0x2d')]:_0x2ad37c[_0x0cba('0x28')];_0x2508ad[_0x0cba('0x31')]=qs[_0x0cba('0x32')](_0x10685f[_0x0cba('0x29')][_0x0cba('0x32')]);_0x2508ad[_0x0cba('0x33')]=qs[_0x0cba('0x2a')](_[_0x0cba('0x34')](_0x10685f['query'],_0x2ad37c[_0x0cba('0x2a')]));if(_0x10685f[_0x0cba('0x29')][_0x0cba('0x35')]){_0x2508ad[_0x0cba('0x33')]=_['merge'](_0x2508ad['where'],{'$or':_['map'](_0x2508ad['attributes'],function(_0x463eb2){var _0xaf660f={};_0xaf660f[_0x463eb2]={'$like':'%'+_0x10685f[_0x0cba('0x29')][_0x0cba('0x35')]+'%'};return _0xaf660f;})});}_0x2508ad=_[_0x0cba('0x36')]({},_0x2508ad,_0x10685f[_0x0cba('0x38')]);return _0x124165[_0x0cba('0x4b')](_0x2508ad);}})['then'](function(_0x3ee2c6){if(_0x3ee2c6){_0x534cb7=_0x3ee2c6[_0x0cba('0x2e')];if(!_0x10685f[_0x0cba('0x29')][_0x0cba('0x2f')](_0x0cba('0x30'))){_0x2508ad['limit']=qs[_0x0cba('0x1a')](_0x10685f[_0x0cba('0x29')][_0x0cba('0x1a')]);_0x2508ad['offset']=qs[_0x0cba('0x1b')](_0x10685f[_0x0cba('0x29')]['offset']);}return _0x124165['getTags'](_0x2508ad);}})[_0x0cba('0x21')](function(_0x14e701){if(_0x14e701){return _0x14e701?{'count':_0x534cb7,'rows':_0x14e701}:null;}})[_0x0cba('0x21')](respondWithResult(_0x5927b1,null))[_0x0cba('0x44')](handleError(_0x5927b1,null));};exports['setTags']=function(_0x11981a,_0x114c48,_0x156f84){if(_0x11981a[_0x0cba('0x43')]['id']){delete _0x11981a[_0x0cba('0x43')]['id'];}return db[_0x0cba('0x26')][_0x0cba('0x47')]({'where':{'id':_0x11981a['params']['id']}})[_0x0cba('0x21')](handleEntityNotFound(_0x114c48,null))[_0x0cba('0x21')](function(_0x46cf04){if(_0x46cf04){return _0x46cf04[_0x0cba('0x4c')](_0x11981a[_0x0cba('0x43')][_0x0cba('0x4d')]||[]);}return null;})[_0x0cba('0x21')](respondWithResult(_0x114c48,null))['catch'](handleError(_0x114c48,null));}; \ No newline at end of file +var _0xc81f=['set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc81f,0x8a));var _0xfc81=function(_0x46361e,_0x243aaf){_0x46361e=_0x46361e-0x0;var _0x14e302=_0xc81f[_0x46361e];return _0x14e302;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfc81('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfc81('0x1'));var moment=require(_0xfc81('0x2'));var BPromise=require(_0xfc81('0x3'));var Mustache=require(_0xfc81('0x4'));var util=require(_0xfc81('0x5'));var path=require(_0xfc81('0x6'));var sox=require(_0xfc81('0x7'));var csv=require(_0xfc81('0x8'));var ejs=require(_0xfc81('0x9'));var fs=require('fs');var fs_extra=require(_0xfc81('0xa'));var _=require(_0xfc81('0xb'));var squel=require('squel');var crypto=require(_0xfc81('0xc'));var jsforce=require(_0xfc81('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfc81('0x8'));var querystring=require(_0xfc81('0xe'));var Papa=require(_0xfc81('0xf'));var Redis=require('ioredis');var authService=require(_0xfc81('0x10'));var qs=require(_0xfc81('0x11'));var as=require(_0xfc81('0x12'));var hardwareService=require(_0xfc81('0x13'));var logger=require(_0xfc81('0x14'))('api');var utils=require(_0xfc81('0x15'));var config=require(_0xfc81('0x16'));var licenseUtil=require(_0xfc81('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b3312,_0x3e5ae){_0x3e5ae=_0x3e5ae||0xcc;return function(_0x43ba2b){if(_0x43ba2b){return _0x5b3312[_0xfc81('0x18')](_0x3e5ae);}return _0x5b3312[_0xfc81('0x19')](_0x3e5ae)[_0xfc81('0x1a')]();};}function respondWithResult(_0x134880,_0x374576){_0x374576=_0x374576||0xc8;return function(_0x22a325){if(_0x22a325){return _0x134880['status'](_0x374576)[_0xfc81('0x1b')](_0x22a325);}};}function respondWithFilteredResult(_0x5acb32,_0x5edbf4){return function(_0x1c92cb){if(_0x1c92cb){var _0x321bd1=typeof _0x5edbf4['offset']==='undefined'&&typeof _0x5edbf4[_0xfc81('0x1c')]===_0xfc81('0x1d');var _0xb03efc=_0x1c92cb[_0xfc81('0x1e')];var _0x9339a4=_0x321bd1?0x0:_0x5edbf4[_0xfc81('0x1f')];var _0x165110=_0x321bd1?_0x1c92cb[_0xfc81('0x1e')]:_0x5edbf4[_0xfc81('0x1f')]+_0x5edbf4[_0xfc81('0x1c')];var _0x5aa4e2;if(_0x165110>=_0xb03efc){_0x165110=_0xb03efc;_0x5aa4e2=0xc8;}else{_0x5aa4e2=0xce;}_0x5acb32['status'](_0x5aa4e2);return _0x5acb32[_0xfc81('0x20')](_0xfc81('0x21'),_0x9339a4+'-'+_0x165110+'/'+_0xb03efc)['json'](_0x1c92cb);}return null;};}function patchUpdates(_0x54a591){return function(_0xacef21){try{jsonpatch[_0xfc81('0x22')](_0xacef21,_0x54a591,!![]);}catch(_0x3ed7f8){return BPromise[_0xfc81('0x23')](_0x3ed7f8);}return _0xacef21[_0xfc81('0x24')]();};}function saveUpdates(_0xd93e9e,_0x1fe64f){return function(_0x389e17){if(_0x389e17){return _0x389e17[_0xfc81('0x25')](_0xd93e9e)[_0xfc81('0x26')](function(_0x2e0c7e){return _0x2e0c7e;});}return null;};}function removeEntity(_0x5990d7,_0x5087d4){return function(_0x47e507){if(_0x47e507){return _0x47e507[_0xfc81('0x27')]()[_0xfc81('0x26')](function(){_0x5990d7[_0xfc81('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f9793,_0x5dec7f){return function(_0x85d2b0){if(!_0x85d2b0){_0x3f9793[_0xfc81('0x18')](0x194);}return _0x85d2b0;};}function handleError(_0x1f8965,_0x2032c6){_0x2032c6=_0x2032c6||0x1f4;return function(_0x3a88a2){logger['error'](_0x3a88a2[_0xfc81('0x28')]);if(_0x3a88a2[_0xfc81('0x29')]){delete _0x3a88a2[_0xfc81('0x29')];}_0x1f8965[_0xfc81('0x19')](_0x2032c6)[_0xfc81('0x2a')](_0x3a88a2);};}exports[_0xfc81('0x2b')]=function(_0x39cd87,_0x2796d0){var _0x2885dd={},_0xb1727f={},_0x56508b={'count':0x0,'rows':[]};var _0x43a46f=_[_0xfc81('0x2c')](db[_0xfc81('0x2d')][_0xfc81('0x2e')],function(_0x4b9824){return{'name':_0x4b9824[_0xfc81('0x2f')],'type':_0x4b9824['type'][_0xfc81('0x30')]};});_0xb1727f[_0xfc81('0x31')]=_[_0xfc81('0x2c')](_0x43a46f,'name');_0xb1727f[_0xfc81('0x32')]=_[_0xfc81('0x33')](_0x39cd87[_0xfc81('0x32')]);_0xb1727f[_0xfc81('0x34')]=_[_0xfc81('0x35')](_0xb1727f[_0xfc81('0x31')],_0xb1727f[_0xfc81('0x32')]);_0x2885dd[_0xfc81('0x36')]=_[_0xfc81('0x35')](_0xb1727f[_0xfc81('0x31')],qs[_0xfc81('0x37')](_0x39cd87['query'][_0xfc81('0x37')]));_0x2885dd[_0xfc81('0x36')]=_0x2885dd[_0xfc81('0x36')][_0xfc81('0x38')]?_0x2885dd[_0xfc81('0x36')]:_0xb1727f[_0xfc81('0x31')];if(!_0x39cd87[_0xfc81('0x32')][_0xfc81('0x39')](_0xfc81('0x3a'))){_0x2885dd[_0xfc81('0x1c')]=qs[_0xfc81('0x1c')](_0x39cd87['query'][_0xfc81('0x1c')]);_0x2885dd['offset']=qs[_0xfc81('0x1f')](_0x39cd87['query'][_0xfc81('0x1f')]);}_0x2885dd[_0xfc81('0x3b')]=qs[_0xfc81('0x3c')](_0x39cd87[_0xfc81('0x32')][_0xfc81('0x3c')]);_0x2885dd['where']=qs['filters'](_[_0xfc81('0x3d')](_0x39cd87[_0xfc81('0x32')],_0xb1727f[_0xfc81('0x34')]),_0x43a46f);if(_0x39cd87[_0xfc81('0x32')]['filter']){_0x2885dd[_0xfc81('0x3e')]=_[_0xfc81('0x3f')](_0x2885dd['where'],{'$or':_[_0xfc81('0x2c')](_0x43a46f,function(_0x5aa3af){if(_0x5aa3af[_0xfc81('0x40')]!=='VIRTUAL'){var _0x8b2552={};_0x8b2552[_0x5aa3af[_0xfc81('0x29')]]={'$like':'%'+_0x39cd87['query'][_0xfc81('0x41')]+'%'};return _0x8b2552;}})});}_0x2885dd=_['merge']({},_0x2885dd,_0x39cd87[_0xfc81('0x42')]);var _0x5643b5={'where':_0x2885dd[_0xfc81('0x3e')]};return db['DeskConfiguration'][_0xfc81('0x1e')](_0x5643b5)[_0xfc81('0x26')](function(_0xef092a){_0x56508b[_0xfc81('0x1e')]=_0xef092a;if(_0x39cd87['query'][_0xfc81('0x43')]){_0x2885dd[_0xfc81('0x44')]=[{'all':!![]}];}return db[_0xfc81('0x2d')][_0xfc81('0x45')](_0x2885dd);})['then'](function(_0x3ab489){_0x56508b[_0xfc81('0x46')]=_0x3ab489;return _0x56508b;})[_0xfc81('0x26')](respondWithFilteredResult(_0x2796d0,_0x2885dd))[_0xfc81('0x47')](handleError(_0x2796d0,null));};exports['show']=function(_0x1ac3a4,_0x1c2fb2){var _0x34f73a={'raw':![],'where':{'id':_0x1ac3a4[_0xfc81('0x48')]['id']}},_0x57b8c7={};_0x57b8c7[_0xfc81('0x31')]=_['keys'](db[_0xfc81('0x2d')][_0xfc81('0x2e')]);_0x57b8c7['query']=_[_0xfc81('0x33')](_0x1ac3a4[_0xfc81('0x32')]);_0x57b8c7[_0xfc81('0x34')]=_[_0xfc81('0x35')](_0x57b8c7[_0xfc81('0x31')],_0x57b8c7[_0xfc81('0x32')]);_0x34f73a[_0xfc81('0x36')]=_['intersection'](_0x57b8c7['model'],qs[_0xfc81('0x37')](_0x1ac3a4['query'][_0xfc81('0x37')]));_0x34f73a[_0xfc81('0x36')]=_0x34f73a[_0xfc81('0x36')][_0xfc81('0x38')]?_0x34f73a[_0xfc81('0x36')]:_0x57b8c7[_0xfc81('0x31')];if(_0x1ac3a4[_0xfc81('0x32')][_0xfc81('0x43')]){_0x34f73a[_0xfc81('0x44')]=[{'all':!![]}];}_0x34f73a=_['merge']({},_0x34f73a,_0x1ac3a4[_0xfc81('0x42')]);return db['DeskConfiguration'][_0xfc81('0x49')](_0x34f73a)['then'](handleEntityNotFound(_0x1c2fb2,null))[_0xfc81('0x26')](respondWithResult(_0x1c2fb2,null))[_0xfc81('0x47')](handleError(_0x1c2fb2,null));};exports[_0xfc81('0x4a')]=function(_0x4a4372,_0x2b7960){return db[_0xfc81('0x2d')]['create'](_0x4a4372[_0xfc81('0x4b')],{})[_0xfc81('0x26')](respondWithResult(_0x2b7960,0xc9))[_0xfc81('0x47')](handleError(_0x2b7960,null));};exports[_0xfc81('0x25')]=function(_0x5220dc,_0x5b03ef){if(_0x5220dc[_0xfc81('0x4b')]['id']){delete _0x5220dc[_0xfc81('0x4b')]['id'];}return db['DeskConfiguration'][_0xfc81('0x49')]({'where':{'id':_0x5220dc[_0xfc81('0x48')]['id']}})[_0xfc81('0x26')](handleEntityNotFound(_0x5b03ef,null))[_0xfc81('0x26')](saveUpdates(_0x5220dc[_0xfc81('0x4b')],null))[_0xfc81('0x26')](respondWithResult(_0x5b03ef,null))[_0xfc81('0x47')](handleError(_0x5b03ef,null));};exports[_0xfc81('0x27')]=function(_0x3f2486,_0x48f290){return db['DeskConfiguration'][_0xfc81('0x49')]({'where':{'id':_0x3f2486[_0xfc81('0x48')]['id']}})[_0xfc81('0x26')](handleEntityNotFound(_0x48f290,null))['then'](removeEntity(_0x48f290,null))[_0xfc81('0x47')](handleError(_0x48f290,null));};exports[_0xfc81('0x4c')]=function(_0x1031ac,_0x511e41,_0x1bd229){var _0x5bface={};var _0x289abe={};var _0x4d8d02;var _0x279d1a;return db[_0xfc81('0x2d')][_0xfc81('0x4d')]({'where':{'id':_0x1031ac[_0xfc81('0x48')]['id']}})[_0xfc81('0x26')](handleEntityNotFound(_0x511e41,null))[_0xfc81('0x26')](function(_0x2182bc){if(_0x2182bc){_0x4d8d02=_0x2182bc;_0x289abe[_0xfc81('0x31')]=_[_0xfc81('0x33')](db[_0xfc81('0x4e')]['rawAttributes']);_0x289abe[_0xfc81('0x32')]=_[_0xfc81('0x33')](_0x1031ac['query']);_0x289abe[_0xfc81('0x34')]=_['intersection'](_0x289abe['model'],_0x289abe[_0xfc81('0x32')]);_0x5bface[_0xfc81('0x36')]=_[_0xfc81('0x35')](_0x289abe[_0xfc81('0x31')],qs['fields'](_0x1031ac[_0xfc81('0x32')][_0xfc81('0x37')]));_0x5bface[_0xfc81('0x36')]=_0x5bface[_0xfc81('0x36')][_0xfc81('0x38')]?_0x5bface[_0xfc81('0x36')]:_0x289abe[_0xfc81('0x31')];_0x5bface[_0xfc81('0x3b')]=qs[_0xfc81('0x3c')](_0x1031ac['query']['sort']);_0x5bface['where']=qs[_0xfc81('0x34')](_[_0xfc81('0x3d')](_0x1031ac[_0xfc81('0x32')],_0x289abe[_0xfc81('0x34')]));if(_0x1031ac[_0xfc81('0x32')][_0xfc81('0x41')]){_0x5bface[_0xfc81('0x3e')]=_[_0xfc81('0x3f')](_0x5bface[_0xfc81('0x3e')],{'$or':_['map'](_0x5bface[_0xfc81('0x36')],function(_0x1cc182){var _0x36639e={};_0x36639e[_0x1cc182]={'$like':'%'+_0x1031ac[_0xfc81('0x32')][_0xfc81('0x41')]+'%'};return _0x36639e;})});}_0x5bface=_[_0xfc81('0x3f')]({},_0x5bface,_0x1031ac[_0xfc81('0x42')]);return _0x4d8d02[_0xfc81('0x4c')](_0x5bface);}})[_0xfc81('0x26')](function(_0x790fe3){if(_0x790fe3){_0x279d1a=_0x790fe3[_0xfc81('0x38')];if(!_0x1031ac['query'][_0xfc81('0x39')](_0xfc81('0x3a'))){_0x5bface[_0xfc81('0x1c')]=qs[_0xfc81('0x1c')](_0x1031ac[_0xfc81('0x32')][_0xfc81('0x1c')]);_0x5bface[_0xfc81('0x1f')]=qs['offset'](_0x1031ac['query'][_0xfc81('0x1f')]);}return _0x4d8d02[_0xfc81('0x4c')](_0x5bface);}})[_0xfc81('0x26')](function(_0xd34f79){if(_0xd34f79){return _0xd34f79?{'count':_0x279d1a,'rows':_0xd34f79}:null;}})['then'](respondWithResult(_0x511e41,null))['catch'](handleError(_0x511e41,null));};exports[_0xfc81('0x4f')]=function(_0x7fe327,_0x1e3c85,_0x145886){var _0xc01dfe={};var _0x40cea0={};var _0x5dd071;var _0x53fb53;return db[_0xfc81('0x2d')][_0xfc81('0x4d')]({'where':{'id':_0x7fe327[_0xfc81('0x48')]['id']}})[_0xfc81('0x26')](handleEntityNotFound(_0x1e3c85,null))[_0xfc81('0x26')](function(_0x196a82){if(_0x196a82){_0x5dd071=_0x196a82;_0x40cea0[_0xfc81('0x31')]=_[_0xfc81('0x33')](db[_0xfc81('0x4e')]['rawAttributes']);_0x40cea0[_0xfc81('0x32')]=_[_0xfc81('0x33')](_0x7fe327['query']);_0x40cea0[_0xfc81('0x34')]=_[_0xfc81('0x35')](_0x40cea0[_0xfc81('0x31')],_0x40cea0[_0xfc81('0x32')]);_0xc01dfe['attributes']=_[_0xfc81('0x35')](_0x40cea0[_0xfc81('0x31')],qs['fields'](_0x7fe327[_0xfc81('0x32')][_0xfc81('0x37')]));_0xc01dfe[_0xfc81('0x36')]=_0xc01dfe['attributes'][_0xfc81('0x38')]?_0xc01dfe[_0xfc81('0x36')]:_0x40cea0['model'];_0xc01dfe[_0xfc81('0x3b')]=qs[_0xfc81('0x3c')](_0x7fe327['query']['sort']);_0xc01dfe[_0xfc81('0x3e')]=qs['filters'](_[_0xfc81('0x3d')](_0x7fe327['query'],_0x40cea0[_0xfc81('0x34')]));if(_0x7fe327[_0xfc81('0x32')]['filter']){_0xc01dfe[_0xfc81('0x3e')]=_[_0xfc81('0x3f')](_0xc01dfe['where'],{'$or':_[_0xfc81('0x2c')](_0xc01dfe[_0xfc81('0x36')],function(_0x3ff522){var _0x366aa5={};_0x366aa5[_0x3ff522]={'$like':'%'+_0x7fe327[_0xfc81('0x32')][_0xfc81('0x41')]+'%'};return _0x366aa5;})});}_0xc01dfe=_[_0xfc81('0x3f')]({},_0xc01dfe,_0x7fe327[_0xfc81('0x42')]);return _0x5dd071[_0xfc81('0x4f')](_0xc01dfe);}})[_0xfc81('0x26')](function(_0xc8369c){if(_0xc8369c){_0x53fb53=_0xc8369c[_0xfc81('0x38')];if(!_0x7fe327[_0xfc81('0x32')][_0xfc81('0x39')](_0xfc81('0x3a'))){_0xc01dfe[_0xfc81('0x1c')]=qs[_0xfc81('0x1c')](_0x7fe327['query']['limit']);_0xc01dfe['offset']=qs['offset'](_0x7fe327[_0xfc81('0x32')][_0xfc81('0x1f')]);}return _0x5dd071[_0xfc81('0x4f')](_0xc01dfe);}})[_0xfc81('0x26')](function(_0x40cc23){if(_0x40cc23){return _0x40cc23?{'count':_0x53fb53,'rows':_0x40cc23}:null;}})[_0xfc81('0x26')](respondWithResult(_0x1e3c85,null))[_0xfc81('0x47')](handleError(_0x1e3c85,null));};exports[_0xfc81('0x50')]=function(_0x5065c7,_0x1a1375,_0x3edbe3){var _0x5ca8e6={};var _0x5022c3={};var _0x5109d8;var _0x332bd7;return db[_0xfc81('0x2d')][_0xfc81('0x4d')]({'where':{'id':_0x5065c7[_0xfc81('0x48')]['id']}})[_0xfc81('0x26')](handleEntityNotFound(_0x1a1375,null))[_0xfc81('0x26')](function(_0x1694ce){if(_0x1694ce){_0x5109d8=_0x1694ce;_0x5022c3['model']=_[_0xfc81('0x33')](db[_0xfc81('0x4e')][_0xfc81('0x2e')]);_0x5022c3[_0xfc81('0x32')]=_['keys'](_0x5065c7[_0xfc81('0x32')]);_0x5022c3[_0xfc81('0x34')]=_[_0xfc81('0x35')](_0x5022c3['model'],_0x5022c3[_0xfc81('0x32')]);_0x5ca8e6['attributes']=_[_0xfc81('0x35')](_0x5022c3['model'],qs[_0xfc81('0x37')](_0x5065c7[_0xfc81('0x32')][_0xfc81('0x37')]));_0x5ca8e6[_0xfc81('0x36')]=_0x5ca8e6['attributes'][_0xfc81('0x38')]?_0x5ca8e6[_0xfc81('0x36')]:_0x5022c3[_0xfc81('0x31')];_0x5ca8e6[_0xfc81('0x3b')]=qs[_0xfc81('0x3c')](_0x5065c7[_0xfc81('0x32')]['sort']);_0x5ca8e6[_0xfc81('0x3e')]=qs[_0xfc81('0x34')](_[_0xfc81('0x3d')](_0x5065c7[_0xfc81('0x32')],_0x5022c3[_0xfc81('0x34')]));if(_0x5065c7[_0xfc81('0x32')][_0xfc81('0x41')]){_0x5ca8e6[_0xfc81('0x3e')]=_[_0xfc81('0x3f')](_0x5ca8e6[_0xfc81('0x3e')],{'$or':_[_0xfc81('0x2c')](_0x5ca8e6['attributes'],function(_0x396f18){var _0x40ecf1={};_0x40ecf1[_0x396f18]={'$like':'%'+_0x5065c7[_0xfc81('0x32')][_0xfc81('0x41')]+'%'};return _0x40ecf1;})});}_0x5ca8e6=_['merge']({},_0x5ca8e6,_0x5065c7[_0xfc81('0x42')]);return _0x5109d8[_0xfc81('0x50')](_0x5ca8e6);}})[_0xfc81('0x26')](function(_0x3e83c1){if(_0x3e83c1){_0x332bd7=_0x3e83c1[_0xfc81('0x38')];if(!_0x5065c7[_0xfc81('0x32')][_0xfc81('0x39')]('nolimit')){_0x5ca8e6['limit']=qs[_0xfc81('0x1c')](_0x5065c7[_0xfc81('0x32')]['limit']);_0x5ca8e6[_0xfc81('0x1f')]=qs[_0xfc81('0x1f')](_0x5065c7[_0xfc81('0x32')][_0xfc81('0x1f')]);}return _0x5109d8['getDescriptions'](_0x5ca8e6);}})['then'](function(_0x25139d){if(_0x25139d){return _0x25139d?{'count':_0x332bd7,'rows':_0x25139d}:null;}})['then'](respondWithResult(_0x1a1375,null))['catch'](handleError(_0x1a1375,null));};exports[_0xfc81('0x51')]=function(_0x19feb7,_0x1b6072,_0xfbbe09){var _0xd1b487={};var _0x43dfd8={};var _0x7e23a4;var _0x38465d;return db[_0xfc81('0x2d')]['findOne']({'where':{'id':_0x19feb7[_0xfc81('0x48')]['id']}})['then'](handleEntityNotFound(_0x1b6072,null))[_0xfc81('0x26')](function(_0x2179c5){if(_0x2179c5){_0x7e23a4=_0x2179c5;_0x43dfd8[_0xfc81('0x31')]=_[_0xfc81('0x33')](db[_0xfc81('0x52')][_0xfc81('0x2e')]);_0x43dfd8[_0xfc81('0x32')]=_[_0xfc81('0x33')](_0x19feb7['query']);_0x43dfd8['filters']=_[_0xfc81('0x35')](_0x43dfd8[_0xfc81('0x31')],_0x43dfd8[_0xfc81('0x32')]);_0xd1b487['attributes']=_[_0xfc81('0x35')](_0x43dfd8[_0xfc81('0x31')],qs['fields'](_0x19feb7[_0xfc81('0x32')][_0xfc81('0x37')]));_0xd1b487['attributes']=_0xd1b487[_0xfc81('0x36')][_0xfc81('0x38')]?_0xd1b487[_0xfc81('0x36')]:_0x43dfd8['model'];_0xd1b487[_0xfc81('0x3b')]=qs[_0xfc81('0x3c')](_0x19feb7[_0xfc81('0x32')][_0xfc81('0x3c')]);_0xd1b487[_0xfc81('0x3e')]=qs[_0xfc81('0x34')](_[_0xfc81('0x3d')](_0x19feb7[_0xfc81('0x32')],_0x43dfd8[_0xfc81('0x34')]));if(_0x19feb7[_0xfc81('0x32')][_0xfc81('0x41')]){_0xd1b487[_0xfc81('0x3e')]=_[_0xfc81('0x3f')](_0xd1b487[_0xfc81('0x3e')],{'$or':_[_0xfc81('0x2c')](_0xd1b487[_0xfc81('0x36')],function(_0x589b9a){var _0x181dcd={};_0x181dcd[_0x589b9a]={'$like':'%'+_0x19feb7[_0xfc81('0x32')][_0xfc81('0x41')]+'%'};return _0x181dcd;})});}_0xd1b487=_[_0xfc81('0x3f')]({},_0xd1b487,_0x19feb7[_0xfc81('0x42')]);return _0x7e23a4[_0xfc81('0x51')](_0xd1b487);}})[_0xfc81('0x26')](function(_0x42cf16){if(_0x42cf16){_0x38465d=_0x42cf16['length'];if(!_0x19feb7['query']['hasOwnProperty'](_0xfc81('0x3a'))){_0xd1b487['limit']=qs[_0xfc81('0x1c')](_0x19feb7['query'][_0xfc81('0x1c')]);_0xd1b487[_0xfc81('0x1f')]=qs[_0xfc81('0x1f')](_0x19feb7[_0xfc81('0x32')][_0xfc81('0x1f')]);}return _0x7e23a4[_0xfc81('0x51')](_0xd1b487);}})['then'](function(_0x39a27d){if(_0x39a27d){return _0x39a27d?{'count':_0x38465d,'rows':_0x39a27d}:null;}})[_0xfc81('0x26')](respondWithResult(_0x1b6072,null))[_0xfc81('0x47')](handleError(_0x1b6072,null));};exports['setTags']=function(_0x402ba6,_0x2e8a8f,_0xa531c3){if(_0x402ba6[_0xfc81('0x4b')]['id']){delete _0x402ba6['body']['id'];}return db[_0xfc81('0x2d')][_0xfc81('0x4d')]({'where':{'id':_0x402ba6[_0xfc81('0x48')]['id']}})['then'](handleEntityNotFound(_0x2e8a8f,null))['then'](function(_0xf383f9){if(_0xf383f9){return _0xf383f9[_0xfc81('0x53')](_0x402ba6[_0xfc81('0x4b')][_0xfc81('0x54')]||[]);}return null;})[_0xfc81('0x26')](respondWithResult(_0x2e8a8f,null))[_0xfc81('0x47')](handleError(_0x2e8a8f,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index ddc6945..f046497 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 _0xd596=['../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x4e99fd,_0x3a2f2c){var _0x46b44e=function(_0x2ecebe){while(--_0x2ecebe){_0x4e99fd['push'](_0x4e99fd['shift']());}};_0x46b44e(++_0x3a2f2c);}(_0xd596,0x199));var _0x6d59=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xd596[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x6d59('0x0'));var util=require(_0x6d59('0x1'));var logger=require('../../config/logger')(_0x6d59('0x2'));var moment=require('moment');var BPromise=require(_0x6d59('0x3'));var rp=require(_0x6d59('0x4'));var fs=require('fs');var path=require(_0x6d59('0x5'));var rimraf=require(_0x6d59('0x6'));var config=require(_0x6d59('0x7'));var attributes=require(_0x6d59('0x8'));module[_0x6d59('0x9')]=function(_0x54d5f9,_0x588a9b){return _0x54d5f9[_0x6d59('0xa')](_0x6d59('0xb'),attributes,{'tableName':_0x6d59('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95c0=['path','rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x95c0,0x74));var _0x095c=function(_0x877d79,_0x6253ac){_0x877d79=_0x877d79-0x0;var _0x504a83=_0x95c0[_0x877d79];return _0x504a83;};'use strict';var _=require(_0x095c('0x0'));var util=require('util');var logger=require(_0x095c('0x1'))(_0x095c('0x2'));var moment=require('moment');var BPromise=require(_0x095c('0x3'));var rp=require(_0x095c('0x4'));var fs=require('fs');var path=require(_0x095c('0x5'));var rimraf=require(_0x095c('0x6'));var config=require('../../config/environment');var attributes=require(_0x095c('0x7'));module[_0x095c('0x8')]=function(_0x2b7b3e,_0x92c19b){return _0x2b7b3e[_0x095c('0x9')](_0x095c('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 890c97a..58dc0e9 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 _0x4849=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x1cdcab,_0x17a516){var _0x4393d0=function(_0x53b841){while(--_0x53b841){_0x1cdcab['push'](_0x1cdcab['shift']());}};_0x4393d0(++_0x17a516);}(_0x4849,0xf8));var _0x9484=function(_0x15a2f1,_0xdfe6d6){_0x15a2f1=_0x15a2f1-0x0;var _0xf57a96=_0x4849[_0x15a2f1];return _0xf57a96;};'use strict';var _=require(_0x9484('0x0'));var util=require(_0x9484('0x1'));var moment=require(_0x9484('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9484('0x3'));var db=require(_0x9484('0x4'))['db'];var utils=require(_0x9484('0x5'));var logger=require(_0x9484('0x6'))(_0x9484('0x7'));var config=require(_0x9484('0x8'));var jayson=require(_0x9484('0x9'));var client=jayson[_0x9484('0xa')][_0x9484('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x536b43,_0x4a8a70,_0x11f2a1){return new BPromise(function(_0x583079,_0x3929b9){return client[_0x9484('0xc')](_0x536b43,_0x11f2a1)[_0x9484('0xd')](function(_0xe8b216){logger[_0x9484('0xe')](_0x9484('0xf'),_0x4a8a70,_0x9484('0x10'));logger[_0x9484('0x11')](_0x9484('0x12'),_0x4a8a70,_0x9484('0x10'),JSON[_0x9484('0x13')](_0xe8b216));if(_0xe8b216[_0x9484('0x14')]){if(_0xe8b216[_0x9484('0x14')][_0x9484('0x15')]===0x1f4){logger[_0x9484('0x14')]('DeskConfiguration,\x20%s,\x20%s',_0x4a8a70,_0xe8b216[_0x9484('0x14')]['message']);return _0x3929b9(_0xe8b216[_0x9484('0x14')][_0x9484('0x16')]);}logger[_0x9484('0x14')](_0x9484('0xf'),_0x4a8a70,_0xe8b216[_0x9484('0x14')][_0x9484('0x16')]);return _0x583079(_0xe8b216['error'][_0x9484('0x16')]);}else{logger[_0x9484('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x4a8a70,'request\x20sent');_0x583079(_0xe8b216[_0x9484('0x17')]['message']);}})[_0x9484('0x18')](function(_0x4e974f){logger[_0x9484('0x14')](_0x9484('0xf'),_0x4a8a70,_0x4e974f);_0x3929b9(_0x4e974f);});});} \ No newline at end of file +var _0x5b47=['lodash','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch'];(function(_0x547add,_0x387042){var _0x2ed1f3=function(_0x3bbb4d){while(--_0x3bbb4d){_0x547add['push'](_0x547add['shift']());}};_0x2ed1f3(++_0x387042);}(_0x5b47,0x120));var _0x75b4=function(_0x5e73df,_0x394be1){_0x5e73df=_0x5e73df-0x0;var _0x308b30=_0x5b47[_0x5e73df];return _0x308b30;};'use strict';var _=require(_0x75b4('0x0'));var util=require(_0x75b4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x75b4('0x2'));var logger=require(_0x75b4('0x3'))(_0x75b4('0x4'));var config=require(_0x75b4('0x5'));var jayson=require(_0x75b4('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53dcb0,_0x1f1e33,_0x5285bb){return new BPromise(function(_0x16138d,_0x39ff0b){return client[_0x75b4('0x7')](_0x53dcb0,_0x5285bb)[_0x75b4('0x8')](function(_0x127e77){logger[_0x75b4('0x9')](_0x75b4('0xa'),_0x1f1e33,_0x75b4('0xb'));logger[_0x75b4('0xc')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1f1e33,_0x75b4('0xb'),JSON['stringify'](_0x127e77));if(_0x127e77[_0x75b4('0xd')]){if(_0x127e77[_0x75b4('0xd')][_0x75b4('0xe')]===0x1f4){logger[_0x75b4('0xd')](_0x75b4('0xa'),_0x1f1e33,_0x127e77[_0x75b4('0xd')][_0x75b4('0xf')]);return _0x39ff0b(_0x127e77[_0x75b4('0xd')]['message']);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x1f1e33,_0x127e77[_0x75b4('0xd')][_0x75b4('0xf')]);return _0x16138d(_0x127e77['error'][_0x75b4('0xf')]);}else{logger[_0x75b4('0x9')](_0x75b4('0xa'),_0x1f1e33,'request\x20sent');_0x16138d(_0x127e77[_0x75b4('0x10')][_0x75b4('0xf')]);}})[_0x75b4('0x11')](function(_0xc7ce4f){logger['error'](_0x75b4('0xa'),_0x1f1e33,_0xc7ce4f);_0x39ff0b(_0xc7ce4f);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 5f6b358..c0fb296 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 _0xb016=['put','/:id','update','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create'];(function(_0x1c6b59,_0x28b966){var _0x5279a0=function(_0x2d994a){while(--_0x2d994a){_0x1c6b59['push'](_0x1c6b59['shift']());}};_0x5279a0(++_0x28b966);}(_0xb016,0x159));var _0x6b01=function(_0x5a8d07,_0x54069c){_0x5a8d07=_0x5a8d07-0x0;var _0x5d635e=_0xb016[_0x5a8d07];return _0x5d635e;};'use strict';var multer=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b01('0x2'));var router=express['Router']();var fs_extra=require(_0x6b01('0x3'));var auth=require(_0x6b01('0x4'));var interaction=require(_0x6b01('0x5'));var config=require(_0x6b01('0x6'));var controller=require('./intDeskField.controller');router[_0x6b01('0x7')]('/',auth[_0x6b01('0x8')](),controller[_0x6b01('0x9')]);router['get']('/:id',auth[_0x6b01('0x8')](),controller[_0x6b01('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6b01('0xb')]);router[_0x6b01('0xc')](_0x6b01('0xd'),auth[_0x6b01('0x8')](),controller[_0x6b01('0xe')]);router['delete']('/:id',auth[_0x6b01('0x8')](),controller[_0x6b01('0xf')]);module[_0x6b01('0x10')]=router; \ No newline at end of file +var _0x1564=['put','/:id','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','post'];(function(_0x2c056e,_0x4f25d5){var _0x364185=function(_0x351001){while(--_0x351001){_0x2c056e['push'](_0x2c056e['shift']());}};_0x364185(++_0x4f25d5);}(_0x1564,0x125));var _0x4156=function(_0x35cfc8,_0x384497){_0x35cfc8=_0x35cfc8-0x0;var _0x272edb=_0x1564[_0x35cfc8];return _0x272edb;};'use strict';var multer=require(_0x4156('0x0'));var util=require(_0x4156('0x1'));var path=require(_0x4156('0x2'));var timeout=require(_0x4156('0x3'));var express=require('express');var router=express[_0x4156('0x4')]();var fs_extra=require(_0x4156('0x5'));var auth=require(_0x4156('0x6'));var interaction=require(_0x4156('0x7'));var config=require(_0x4156('0x8'));var controller=require(_0x4156('0x9'));router[_0x4156('0xa')]('/',auth[_0x4156('0xb')](),controller['index']);router['get']('/:id',auth[_0x4156('0xb')](),controller['show']);router[_0x4156('0xc')]('/',auth[_0x4156('0xb')](),controller['create']);router[_0x4156('0xd')](_0x4156('0xe'),auth[_0x4156('0xb')](),controller['update']);router[_0x4156('0xf')]('/:id',auth[_0x4156('0xb')](),controller[_0x4156('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index b9aeedf..b2239be 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 _0x3410=['sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN'];(function(_0x5e9755,_0x3f9347){var _0x14064f=function(_0x20a79c){while(--_0x20a79c){_0x5e9755['push'](_0x5e9755['shift']());}};_0x14064f(++_0x3f9347);}(_0x3410,0x172));var _0x0341=function(_0x146e50,_0x2d6755){_0x146e50=_0x146e50-0x0;var _0x418f9a=_0x3410[_0x146e50];return _0x418f9a;};'use strict';var Sequelize=require(_0x0341('0x0'));module[_0x0341('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0341('0x2'),_0x0341('0x3'),_0x0341('0x4'),_0x0341('0x5'),_0x0341('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0341('0x7')]},'key':{'type':Sequelize[_0x0341('0x7')]},'keyType':{'type':Sequelize[_0x0341('0x8')](_0x0341('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x0341('0x7')]},'idField':{'type':Sequelize[_0x0341('0x7')]},'nameField':{'type':Sequelize[_0x0341('0x7')]},'customField':{'type':Sequelize[_0x0341('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0341('0x7')]}}; \ No newline at end of file +var _0xf3e0=['variable','keyValue','picklist','STRING','customVariable','sequelize','ENUM','string'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0xf3e0,0x1d5));var _0x0f3e=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xf3e0[_0x4ed520];return _0x4415a6;};'use strict';var Sequelize=require(_0x0f3e('0x0'));module['exports']={'type':{'type':Sequelize[_0x0f3e('0x1')](_0x0f3e('0x2'),_0x0f3e('0x3'),'customVariable',_0x0f3e('0x4'),_0x0f3e('0x5')),'defaultValue':_0x0f3e('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0f3e('0x6')]},'keyType':{'type':Sequelize[_0x0f3e('0x1')](_0x0f3e('0x2'),_0x0f3e('0x3'),_0x0f3e('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0f3e('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0f3e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 78c688e..1ca8cae 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 _0xd1f9=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','send','index','map','DeskField','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','nolimit','order','sort','filters','pick','filter','VIRTUAL','name','merge','options','where','includeAll','include','findAll','rows','show','params','length','find','create','body','catch','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','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x21cb7f,_0x48cd16){var _0x5a079a=function(_0x569a4f){while(--_0x569a4f){_0x21cb7f['push'](_0x21cb7f['shift']());}};_0x5a079a(++_0x48cd16);}(_0xd1f9,0x88));var _0x9d1f=function(_0x4e8286,_0x4eaeb4){_0x4e8286=_0x4e8286-0x0;var _0x44a440=_0xd1f9[_0x4e8286];return _0x44a440;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9d1f('0x0'));var jsonpatch=require(_0x9d1f('0x1'));var rp=require(_0x9d1f('0x2'));var moment=require(_0x9d1f('0x3'));var BPromise=require(_0x9d1f('0x4'));var Mustache=require(_0x9d1f('0x5'));var util=require(_0x9d1f('0x6'));var path=require(_0x9d1f('0x7'));var sox=require(_0x9d1f('0x8'));var csv=require('to-csv');var ejs=require(_0x9d1f('0x9'));var fs=require('fs');var fs_extra=require(_0x9d1f('0xa'));var _=require(_0x9d1f('0xb'));var squel=require(_0x9d1f('0xc'));var crypto=require(_0x9d1f('0xd'));var jsforce=require(_0x9d1f('0xe'));var deskjs=require(_0x9d1f('0xf'));var toCsv=require(_0x9d1f('0x10'));var querystring=require(_0x9d1f('0x11'));var Papa=require(_0x9d1f('0x12'));var Redis=require(_0x9d1f('0x13'));var authService=require(_0x9d1f('0x14'));var qs=require(_0x9d1f('0x15'));var as=require(_0x9d1f('0x16'));var hardwareService=require(_0x9d1f('0x17'));var logger=require(_0x9d1f('0x18'))(_0x9d1f('0x19'));var utils=require(_0x9d1f('0x1a'));var config=require(_0x9d1f('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d1f('0x1c'))['db'];function respondWithStatusCode(_0x15a999,_0x7edbfa){_0x7edbfa=_0x7edbfa||0xcc;return function(_0x5a4d43){if(_0x5a4d43){return _0x15a999[_0x9d1f('0x1d')](_0x7edbfa);}return _0x15a999['status'](_0x7edbfa)['end']();};}function respondWithResult(_0x71e9c9,_0x38395d){_0x38395d=_0x38395d||0xc8;return function(_0x25c0b0){if(_0x25c0b0){return _0x71e9c9[_0x9d1f('0x1e')](_0x38395d)[_0x9d1f('0x1f')](_0x25c0b0);}};}function respondWithFilteredResult(_0x40a87f,_0x9f8cfc){return function(_0x2488a3){if(_0x2488a3){var _0x24cd8a=typeof _0x9f8cfc[_0x9d1f('0x20')]===_0x9d1f('0x21')&&typeof _0x9f8cfc[_0x9d1f('0x22')]===_0x9d1f('0x21');var _0x57ba11=_0x2488a3[_0x9d1f('0x23')];var _0x42a2b4=_0x24cd8a?0x0:_0x9f8cfc['offset'];var _0x329b69=_0x24cd8a?_0x2488a3['count']:_0x9f8cfc['offset']+_0x9f8cfc['limit'];var _0x2d39f3;if(_0x329b69>=_0x57ba11){_0x329b69=_0x57ba11;_0x2d39f3=0xc8;}else{_0x2d39f3=0xce;}_0x40a87f[_0x9d1f('0x1e')](_0x2d39f3);return _0x40a87f[_0x9d1f('0x24')]('Content-Range',_0x42a2b4+'-'+_0x329b69+'/'+_0x57ba11)[_0x9d1f('0x1f')](_0x2488a3);}return null;};}function patchUpdates(_0x4cfcf5){return function(_0x1c0280){try{jsonpatch['apply'](_0x1c0280,_0x4cfcf5,!![]);}catch(_0x552a84){return BPromise[_0x9d1f('0x25')](_0x552a84);}return _0x1c0280[_0x9d1f('0x26')]();};}function saveUpdates(_0x35a80d,_0x2d861b){return function(_0x44ef15){if(_0x44ef15){return _0x44ef15[_0x9d1f('0x27')](_0x35a80d)[_0x9d1f('0x28')](function(_0x3b10f7){return _0x3b10f7;});}return null;};}function removeEntity(_0x2c6417,_0xc05aa){return function(_0x1ab0f4){if(_0x1ab0f4){return _0x1ab0f4[_0x9d1f('0x29')]()[_0x9d1f('0x28')](function(){_0x2c6417[_0x9d1f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b234d,_0xa2392f){return function(_0x48245c){if(!_0x48245c){_0x2b234d['sendStatus'](0x194);}return _0x48245c;};}function handleError(_0x1f2b0e,_0xfdd4ae){_0xfdd4ae=_0xfdd4ae||0x1f4;return function(_0x3ca450){logger[_0x9d1f('0x2a')](_0x3ca450[_0x9d1f('0x2b')]);if(_0x3ca450['name']){delete _0x3ca450['name'];}_0x1f2b0e[_0x9d1f('0x1e')](_0xfdd4ae)[_0x9d1f('0x2c')](_0x3ca450);};}exports[_0x9d1f('0x2d')]=function(_0x44515d,_0x1df1b8){var _0x1d8ffe={},_0x48fbf5={},_0x2b11db={'count':0x0,'rows':[]};var _0x4daec3=_[_0x9d1f('0x2e')](db[_0x9d1f('0x2f')][_0x9d1f('0x30')],function(_0x579c46){return{'name':_0x579c46[_0x9d1f('0x31')],'type':_0x579c46['type'][_0x9d1f('0x32')]};});_0x48fbf5[_0x9d1f('0x33')]=_[_0x9d1f('0x2e')](_0x4daec3,'name');_0x48fbf5['query']=_[_0x9d1f('0x34')](_0x44515d[_0x9d1f('0x35')]);_0x48fbf5['filters']=_[_0x9d1f('0x36')](_0x48fbf5[_0x9d1f('0x33')],_0x48fbf5[_0x9d1f('0x35')]);_0x1d8ffe[_0x9d1f('0x37')]=_['intersection'](_0x48fbf5[_0x9d1f('0x33')],qs[_0x9d1f('0x38')](_0x44515d[_0x9d1f('0x35')][_0x9d1f('0x38')]));_0x1d8ffe['attributes']=_0x1d8ffe[_0x9d1f('0x37')]['length']?_0x1d8ffe[_0x9d1f('0x37')]:_0x48fbf5[_0x9d1f('0x33')];if(!_0x44515d[_0x9d1f('0x35')]['hasOwnProperty'](_0x9d1f('0x39'))){_0x1d8ffe[_0x9d1f('0x22')]=qs[_0x9d1f('0x22')](_0x44515d[_0x9d1f('0x35')][_0x9d1f('0x22')]);_0x1d8ffe['offset']=qs[_0x9d1f('0x20')](_0x44515d[_0x9d1f('0x35')][_0x9d1f('0x20')]);}_0x1d8ffe[_0x9d1f('0x3a')]=qs[_0x9d1f('0x3b')](_0x44515d[_0x9d1f('0x35')][_0x9d1f('0x3b')]);_0x1d8ffe['where']=qs[_0x9d1f('0x3c')](_[_0x9d1f('0x3d')](_0x44515d[_0x9d1f('0x35')],_0x48fbf5[_0x9d1f('0x3c')]),_0x4daec3);if(_0x44515d['query'][_0x9d1f('0x3e')]){_0x1d8ffe['where']=_['merge'](_0x1d8ffe['where'],{'$or':_[_0x9d1f('0x2e')](_0x4daec3,function(_0x1253e2){if(_0x1253e2['type']!==_0x9d1f('0x3f')){var _0x28fde6={};_0x28fde6[_0x1253e2[_0x9d1f('0x40')]]={'$like':'%'+_0x44515d[_0x9d1f('0x35')][_0x9d1f('0x3e')]+'%'};return _0x28fde6;}})});}_0x1d8ffe=_[_0x9d1f('0x41')]({},_0x1d8ffe,_0x44515d[_0x9d1f('0x42')]);var _0x537407={'where':_0x1d8ffe[_0x9d1f('0x43')]};return db['DeskField'][_0x9d1f('0x23')](_0x537407)[_0x9d1f('0x28')](function(_0x5f2ae9){_0x2b11db[_0x9d1f('0x23')]=_0x5f2ae9;if(_0x44515d[_0x9d1f('0x35')][_0x9d1f('0x44')]){_0x1d8ffe[_0x9d1f('0x45')]=[{'all':!![]}];}return db[_0x9d1f('0x2f')][_0x9d1f('0x46')](_0x1d8ffe);})[_0x9d1f('0x28')](function(_0x54c0c0){_0x2b11db[_0x9d1f('0x47')]=_0x54c0c0;return _0x2b11db;})[_0x9d1f('0x28')](respondWithFilteredResult(_0x1df1b8,_0x1d8ffe))['catch'](handleError(_0x1df1b8,null));};exports[_0x9d1f('0x48')]=function(_0x4ab238,_0x3555de){var _0x185185={'raw':!![],'where':{'id':_0x4ab238[_0x9d1f('0x49')]['id']}},_0x48dc9a={};_0x48dc9a[_0x9d1f('0x33')]=_[_0x9d1f('0x34')](db[_0x9d1f('0x2f')][_0x9d1f('0x30')]);_0x48dc9a['query']=_[_0x9d1f('0x34')](_0x4ab238[_0x9d1f('0x35')]);_0x48dc9a['filters']=_[_0x9d1f('0x36')](_0x48dc9a[_0x9d1f('0x33')],_0x48dc9a[_0x9d1f('0x35')]);_0x185185[_0x9d1f('0x37')]=_[_0x9d1f('0x36')](_0x48dc9a[_0x9d1f('0x33')],qs[_0x9d1f('0x38')](_0x4ab238[_0x9d1f('0x35')][_0x9d1f('0x38')]));_0x185185[_0x9d1f('0x37')]=_0x185185[_0x9d1f('0x37')][_0x9d1f('0x4a')]?_0x185185[_0x9d1f('0x37')]:_0x48dc9a[_0x9d1f('0x33')];if(_0x4ab238['query'][_0x9d1f('0x44')]){_0x185185[_0x9d1f('0x45')]=[{'all':!![]}];}_0x185185=_[_0x9d1f('0x41')]({},_0x185185,_0x4ab238[_0x9d1f('0x42')]);return db[_0x9d1f('0x2f')][_0x9d1f('0x4b')](_0x185185)[_0x9d1f('0x28')](handleEntityNotFound(_0x3555de,null))[_0x9d1f('0x28')](respondWithResult(_0x3555de,null))['catch'](handleError(_0x3555de,null));};exports[_0x9d1f('0x4c')]=function(_0x132904,_0xea9cae){return db[_0x9d1f('0x2f')]['create'](_0x132904[_0x9d1f('0x4d')],{})['then'](respondWithResult(_0xea9cae,0xc9))['catch'](handleError(_0xea9cae,null));};exports[_0x9d1f('0x27')]=function(_0x4306ec,_0x272357){if(_0x4306ec[_0x9d1f('0x4d')]['id']){delete _0x4306ec[_0x9d1f('0x4d')]['id'];}return db['DeskField'][_0x9d1f('0x4b')]({'where':{'id':_0x4306ec[_0x9d1f('0x49')]['id']}})[_0x9d1f('0x28')](handleEntityNotFound(_0x272357,null))[_0x9d1f('0x28')](saveUpdates(_0x4306ec[_0x9d1f('0x4d')],null))['then'](respondWithResult(_0x272357,null))[_0x9d1f('0x4e')](handleError(_0x272357,null));};exports[_0x9d1f('0x29')]=function(_0x4c0f05,_0x5a9b0d){return db[_0x9d1f('0x2f')][_0x9d1f('0x4b')]({'where':{'id':_0x4c0f05[_0x9d1f('0x49')]['id']}})[_0x9d1f('0x28')](handleEntityNotFound(_0x5a9b0d,null))[_0x9d1f('0x28')](removeEntity(_0x5a9b0d,null))['catch'](handleError(_0x5a9b0d,null));}; \ No newline at end of file +var _0x64a1=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body','params','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','stack','name','send','map','DeskField','fieldName'];(function(_0x2fcd90,_0x4780cc){var _0x55b596=function(_0xe475f6){while(--_0xe475f6){_0x2fcd90['push'](_0x2fcd90['shift']());}};_0x55b596(++_0x4780cc);}(_0x64a1,0x13e));var _0x164a=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x64a1[_0x599f41];return _0x2e4d58;};'use strict';var emlformat=require(_0x164a('0x0'));var rimraf=require(_0x164a('0x1'));var zipdir=require(_0x164a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x164a('0x3'));var BPromise=require(_0x164a('0x4'));var Mustache=require(_0x164a('0x5'));var util=require('util');var path=require(_0x164a('0x6'));var sox=require(_0x164a('0x7'));var csv=require(_0x164a('0x8'));var ejs=require(_0x164a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x164a('0xa'));var squel=require(_0x164a('0xb'));var crypto=require(_0x164a('0xc'));var jsforce=require(_0x164a('0xd'));var deskjs=require(_0x164a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x164a('0xf'));var Papa=require(_0x164a('0x10'));var Redis=require('ioredis');var authService=require(_0x164a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x164a('0x12'))(_0x164a('0x13'));var utils=require('../../config/utils');var config=require(_0x164a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x164a('0x15'))['db'];function respondWithStatusCode(_0x437143,_0x2abe54){_0x2abe54=_0x2abe54||0xcc;return function(_0x508a58){if(_0x508a58){return _0x437143[_0x164a('0x16')](_0x2abe54);}return _0x437143[_0x164a('0x17')](_0x2abe54)[_0x164a('0x18')]();};}function respondWithResult(_0xbb4e7e,_0x466f6d){_0x466f6d=_0x466f6d||0xc8;return function(_0x44ad33){if(_0x44ad33){return _0xbb4e7e[_0x164a('0x17')](_0x466f6d)[_0x164a('0x19')](_0x44ad33);}};}function respondWithFilteredResult(_0x28984f,_0x43fc19){return function(_0x3bfc66){if(_0x3bfc66){var _0xb44b99=typeof _0x43fc19[_0x164a('0x1a')]===_0x164a('0x1b')&&typeof _0x43fc19['limit']===_0x164a('0x1b');var _0x1ba59d=_0x3bfc66[_0x164a('0x1c')];var _0x203b01=_0xb44b99?0x0:_0x43fc19['offset'];var _0x9872d6=_0xb44b99?_0x3bfc66[_0x164a('0x1c')]:_0x43fc19['offset']+_0x43fc19[_0x164a('0x1d')];var _0x393ff8;if(_0x9872d6>=_0x1ba59d){_0x9872d6=_0x1ba59d;_0x393ff8=0xc8;}else{_0x393ff8=0xce;}_0x28984f[_0x164a('0x17')](_0x393ff8);return _0x28984f[_0x164a('0x1e')]('Content-Range',_0x203b01+'-'+_0x9872d6+'/'+_0x1ba59d)['json'](_0x3bfc66);}return null;};}function patchUpdates(_0x4d7953){return function(_0x3b6fe1){try{jsonpatch[_0x164a('0x1f')](_0x3b6fe1,_0x4d7953,!![]);}catch(_0xe9b17f){return BPromise[_0x164a('0x20')](_0xe9b17f);}return _0x3b6fe1[_0x164a('0x21')]();};}function saveUpdates(_0x423e41,_0x1bf075){return function(_0x10b1ea){if(_0x10b1ea){return _0x10b1ea[_0x164a('0x22')](_0x423e41)['then'](function(_0x2c2510){return _0x2c2510;});}return null;};}function removeEntity(_0x11a170,_0x1ba8b4){return function(_0x507fe5){if(_0x507fe5){return _0x507fe5['destroy']()[_0x164a('0x23')](function(){_0x11a170[_0x164a('0x17')](0xcc)[_0x164a('0x18')]();});}};}function handleEntityNotFound(_0x27a261,_0xbd1d59){return function(_0x5d6a11){if(!_0x5d6a11){_0x27a261[_0x164a('0x16')](0x194);}return _0x5d6a11;};}function handleError(_0x306a5a,_0x4f7f6e){_0x4f7f6e=_0x4f7f6e||0x1f4;return function(_0x6740e1){logger['error'](_0x6740e1[_0x164a('0x24')]);if(_0x6740e1[_0x164a('0x25')]){delete _0x6740e1[_0x164a('0x25')];}_0x306a5a[_0x164a('0x17')](_0x4f7f6e)[_0x164a('0x26')](_0x6740e1);};}exports['index']=function(_0x2c964d,_0x2ea402){var _0x12d7d4={},_0x48533d={},_0x50a4d3={'count':0x0,'rows':[]};var _0x4b6593=_[_0x164a('0x27')](db[_0x164a('0x28')]['rawAttributes'],function(_0x392de4){return{'name':_0x392de4[_0x164a('0x29')],'type':_0x392de4[_0x164a('0x2a')][_0x164a('0x2b')]};});_0x48533d[_0x164a('0x2c')]=_[_0x164a('0x27')](_0x4b6593,'name');_0x48533d[_0x164a('0x2d')]=_[_0x164a('0x2e')](_0x2c964d['query']);_0x48533d[_0x164a('0x2f')]=_[_0x164a('0x30')](_0x48533d[_0x164a('0x2c')],_0x48533d[_0x164a('0x2d')]);_0x12d7d4[_0x164a('0x31')]=_[_0x164a('0x30')](_0x48533d[_0x164a('0x2c')],qs[_0x164a('0x32')](_0x2c964d[_0x164a('0x2d')]['fields']));_0x12d7d4[_0x164a('0x31')]=_0x12d7d4[_0x164a('0x31')][_0x164a('0x33')]?_0x12d7d4[_0x164a('0x31')]:_0x48533d[_0x164a('0x2c')];if(!_0x2c964d['query'][_0x164a('0x34')](_0x164a('0x35'))){_0x12d7d4[_0x164a('0x1d')]=qs[_0x164a('0x1d')](_0x2c964d[_0x164a('0x2d')][_0x164a('0x1d')]);_0x12d7d4[_0x164a('0x1a')]=qs[_0x164a('0x1a')](_0x2c964d[_0x164a('0x2d')][_0x164a('0x1a')]);}_0x12d7d4[_0x164a('0x36')]=qs[_0x164a('0x37')](_0x2c964d[_0x164a('0x2d')][_0x164a('0x37')]);_0x12d7d4[_0x164a('0x38')]=qs[_0x164a('0x2f')](_['pick'](_0x2c964d[_0x164a('0x2d')],_0x48533d['filters']),_0x4b6593);if(_0x2c964d['query'][_0x164a('0x39')]){_0x12d7d4[_0x164a('0x38')]=_[_0x164a('0x3a')](_0x12d7d4['where'],{'$or':_[_0x164a('0x27')](_0x4b6593,function(_0x41d982){if(_0x41d982[_0x164a('0x2a')]!=='VIRTUAL'){var _0x2447c7={};_0x2447c7[_0x41d982['name']]={'$like':'%'+_0x2c964d[_0x164a('0x2d')][_0x164a('0x39')]+'%'};return _0x2447c7;}})});}_0x12d7d4=_[_0x164a('0x3a')]({},_0x12d7d4,_0x2c964d[_0x164a('0x3b')]);var _0x1e53db={'where':_0x12d7d4['where']};return db[_0x164a('0x28')][_0x164a('0x1c')](_0x1e53db)[_0x164a('0x23')](function(_0x169170){_0x50a4d3[_0x164a('0x1c')]=_0x169170;if(_0x2c964d['query']['includeAll']){_0x12d7d4[_0x164a('0x3c')]=[{'all':!![]}];}return db['DeskField'][_0x164a('0x3d')](_0x12d7d4);})[_0x164a('0x23')](function(_0x416e3d){_0x50a4d3[_0x164a('0x3e')]=_0x416e3d;return _0x50a4d3;})[_0x164a('0x23')](respondWithFilteredResult(_0x2ea402,_0x12d7d4))[_0x164a('0x3f')](handleError(_0x2ea402,null));};exports[_0x164a('0x40')]=function(_0x58237d,_0x20885e){var _0x2c9d70={'raw':!![],'where':{'id':_0x58237d['params']['id']}},_0x2bf42f={};_0x2bf42f[_0x164a('0x2c')]=_[_0x164a('0x2e')](db[_0x164a('0x28')][_0x164a('0x41')]);_0x2bf42f[_0x164a('0x2d')]=_[_0x164a('0x2e')](_0x58237d['query']);_0x2bf42f['filters']=_[_0x164a('0x30')](_0x2bf42f[_0x164a('0x2c')],_0x2bf42f['query']);_0x2c9d70['attributes']=_['intersection'](_0x2bf42f[_0x164a('0x2c')],qs[_0x164a('0x32')](_0x58237d[_0x164a('0x2d')][_0x164a('0x32')]));_0x2c9d70[_0x164a('0x31')]=_0x2c9d70['attributes'][_0x164a('0x33')]?_0x2c9d70[_0x164a('0x31')]:_0x2bf42f[_0x164a('0x2c')];if(_0x58237d['query'][_0x164a('0x42')]){_0x2c9d70[_0x164a('0x3c')]=[{'all':!![]}];}_0x2c9d70=_[_0x164a('0x3a')]({},_0x2c9d70,_0x58237d['options']);return db[_0x164a('0x28')][_0x164a('0x43')](_0x2c9d70)[_0x164a('0x23')](handleEntityNotFound(_0x20885e,null))[_0x164a('0x23')](respondWithResult(_0x20885e,null))[_0x164a('0x3f')](handleError(_0x20885e,null));};exports['create']=function(_0x23f573,_0x11ac70){return db[_0x164a('0x28')][_0x164a('0x44')](_0x23f573[_0x164a('0x45')],{})['then'](respondWithResult(_0x11ac70,0xc9))[_0x164a('0x3f')](handleError(_0x11ac70,null));};exports[_0x164a('0x22')]=function(_0x1f7d22,_0x33a582){if(_0x1f7d22[_0x164a('0x45')]['id']){delete _0x1f7d22[_0x164a('0x45')]['id'];}return db[_0x164a('0x28')][_0x164a('0x43')]({'where':{'id':_0x1f7d22[_0x164a('0x46')]['id']}})[_0x164a('0x23')](handleEntityNotFound(_0x33a582,null))[_0x164a('0x23')](saveUpdates(_0x1f7d22[_0x164a('0x45')],null))[_0x164a('0x23')](respondWithResult(_0x33a582,null))['catch'](handleError(_0x33a582,null));};exports[_0x164a('0x47')]=function(_0x38c979,_0x380037){return db[_0x164a('0x28')][_0x164a('0x43')]({'where':{'id':_0x38c979[_0x164a('0x46')]['id']}})['then'](handleEntityNotFound(_0x380037,null))[_0x164a('0x23')](removeEntity(_0x380037,null))[_0x164a('0x3f')](handleError(_0x380037,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index a13e896..684d778 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 _0xfcf2=['util','../../config/logger','api','moment','bluebird','rimraf','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash'];(function(_0x2b93a5,_0x31934c){var _0x4111dc=function(_0x3d4f71){while(--_0x3d4f71){_0x2b93a5['push'](_0x2b93a5['shift']());}};_0x4111dc(++_0x31934c);}(_0xfcf2,0xb3));var _0x2fcf=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xfcf2[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x2fcf('0x0'));var util=require(_0x2fcf('0x1'));var logger=require(_0x2fcf('0x2'))(_0x2fcf('0x3'));var moment=require(_0x2fcf('0x4'));var BPromise=require(_0x2fcf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2fcf('0x6'));var config=require('../../config/environment');var attributes=require(_0x2fcf('0x7'));module[_0x2fcf('0x8')]=function(_0x21320a,_0x1bd4fb){return _0x21320a[_0x2fcf('0x9')](_0x2fcf('0xa'),attributes,{'tableName':_0x2fcf('0xb'),'paranoid':![],'indexes':[{'name':_0x2fcf('0xc'),'fields':[_0x2fcf('0xd'),_0x2fcf('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd649=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','define','DeskField','int_desk_fields','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x401089,_0x469a19){var _0x128e7c=function(_0x286ffa){while(--_0x286ffa){_0x401089['push'](_0x401089['shift']());}};_0x128e7c(++_0x469a19);}(_0xd649,0xcc));var _0x9d64=function(_0x4aac6b,_0x272aa1){_0x4aac6b=_0x4aac6b-0x0;var _0x4e908d=_0xd649[_0x4aac6b];return _0x4e908d;};'use strict';var _=require(_0x9d64('0x0'));var util=require(_0x9d64('0x1'));var logger=require(_0x9d64('0x2'))(_0x9d64('0x3'));var moment=require(_0x9d64('0x4'));var BPromise=require(_0x9d64('0x5'));var rp=require(_0x9d64('0x6'));var fs=require('fs');var path=require(_0x9d64('0x7'));var rimraf=require(_0x9d64('0x8'));var config=require(_0x9d64('0x9'));var attributes=require(_0x9d64('0xa'));module['exports']=function(_0x16d894,_0x1f802c){return _0x16d894[_0x9d64('0xb')](_0x9d64('0xc'),attributes,{'tableName':_0x9d64('0xd'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x9d64('0xe'),_0x9d64('0xf')],'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 827e109..6ade5f7 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 _0x2566=['request','DeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http'];(function(_0x279a3b,_0x505197){var _0x4eb520=function(_0x233300){while(--_0x233300){_0x279a3b['push'](_0x279a3b['shift']());}};_0x4eb520(++_0x505197);}(_0x2566,0x87));var _0x6256=function(_0x37d332,_0x5c62a7){_0x37d332=_0x37d332-0x0;var _0x1d5751=_0x2566[_0x37d332];return _0x1d5751;};'use strict';var _=require(_0x6256('0x0'));var util=require(_0x6256('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6256('0x2'));var fs=require('fs');var Redis=require(_0x6256('0x3'));var db=require(_0x6256('0x4'))['db'];var utils=require(_0x6256('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6256('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6256('0x7')][_0x6256('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x89bef0,_0xfccdb6,_0x728a2e){return new BPromise(function(_0x1a3cd3,_0x57fe28){return client[_0x6256('0x9')](_0x89bef0,_0x728a2e)['then'](function(_0x1de9d8){logger['info'](_0x6256('0xa'),_0xfccdb6,'request\x20sent');logger[_0x6256('0xb')]('DeskField,\x20%s,\x20%s,\x20%s',_0xfccdb6,_0x6256('0xc'),JSON[_0x6256('0xd')](_0x1de9d8));if(_0x1de9d8[_0x6256('0xe')]){if(_0x1de9d8['error']['code']===0x1f4){logger[_0x6256('0xe')]('DeskField,\x20%s,\x20%s',_0xfccdb6,_0x1de9d8['error'][_0x6256('0xf')]);return _0x57fe28(_0x1de9d8[_0x6256('0xe')][_0x6256('0xf')]);}logger[_0x6256('0xe')](_0x6256('0xa'),_0xfccdb6,_0x1de9d8[_0x6256('0xe')][_0x6256('0xf')]);return _0x1a3cd3(_0x1de9d8[_0x6256('0xe')]['message']);}else{logger[_0x6256('0x10')](_0x6256('0xa'),_0xfccdb6,_0x6256('0xc'));_0x1a3cd3(_0x1de9d8['result']['message']);}})[_0x6256('0x11')](function(_0x412ce9){logger['error'](_0x6256('0xa'),_0xfccdb6,_0x412ce9);_0x57fe28(_0x412ce9);});});} \ No newline at end of file +var _0x6977=['request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x41e382,_0x329ac6){var _0x5b2dc9=function(_0x2fa650){while(--_0x2fa650){_0x41e382['push'](_0x41e382['shift']());}};_0x5b2dc9(++_0x329ac6);}(_0x6977,0x199));var _0x7697=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x6977[_0x484e36];return _0xafc85d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7697('0x0'));var BPromise=require(_0x7697('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7697('0x2'))['db'];var utils=require(_0x7697('0x3'));var logger=require(_0x7697('0x4'))(_0x7697('0x5'));var config=require(_0x7697('0x6'));var jayson=require(_0x7697('0x7'));var client=jayson[_0x7697('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47e48f,_0x26fd4f,_0x2fac36){return new BPromise(function(_0x58600d,_0x410510){return client[_0x7697('0x9')](_0x47e48f,_0x2fac36)[_0x7697('0xa')](function(_0x417793){logger[_0x7697('0xb')](_0x7697('0xc'),_0x26fd4f,_0x7697('0xd'));logger[_0x7697('0xe')](_0x7697('0xf'),_0x26fd4f,_0x7697('0xd'),JSON[_0x7697('0x10')](_0x417793));if(_0x417793[_0x7697('0x11')]){if(_0x417793[_0x7697('0x11')][_0x7697('0x12')]===0x1f4){logger[_0x7697('0x11')](_0x7697('0xc'),_0x26fd4f,_0x417793[_0x7697('0x11')][_0x7697('0x13')]);return _0x410510(_0x417793[_0x7697('0x11')]['message']);}logger['error'](_0x7697('0xc'),_0x26fd4f,_0x417793[_0x7697('0x11')]['message']);return _0x58600d(_0x417793[_0x7697('0x11')]['message']);}else{logger['info'](_0x7697('0xc'),_0x26fd4f,_0x7697('0xd'));_0x58600d(_0x417793[_0x7697('0x14')][_0x7697('0x13')]);}})[_0x7697('0x15')](function(_0x5efbf0){logger[_0x7697('0x11')](_0x7697('0xc'),_0x26fd4f,_0x5efbf0);_0x410510(_0x5efbf0);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 6b36453..ba94c6d 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 _0x92e8=['get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','update','delete','destroy','path','connect-timeout','express','fs-extra','../../config/environment','./intDynamics365Account.controller'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x92e8,0xc2));var _0x892e=function(_0x1ef547,_0x31bfdb){_0x1ef547=_0x1ef547-0x0;var _0x1d697b=_0x92e8[_0x1ef547];return _0x1d697b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x892e('0x0'));var timeout=require(_0x892e('0x1'));var express=require(_0x892e('0x2'));var router=express['Router']();var fs_extra=require(_0x892e('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x892e('0x4'));var controller=require(_0x892e('0x5'));router[_0x892e('0x6')]('/',auth[_0x892e('0x7')](),controller[_0x892e('0x8')]);router['get'](_0x892e('0x9'),auth[_0x892e('0x7')](),controller[_0x892e('0xa')]);router[_0x892e('0x6')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x892e('0xb')]);router['get'](_0x892e('0xc'),auth[_0x892e('0x7')](),controller[_0x892e('0xd')]);router[_0x892e('0xe')]('/',auth[_0x892e('0x7')](),controller['create']);router['post'](_0x892e('0xf'),auth[_0x892e('0x7')](),controller[_0x892e('0x10')]);router['put'](_0x892e('0x9'),auth[_0x892e('0x7')](),controller[_0x892e('0x11')]);router[_0x892e('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x892e('0x13')]);module['exports']=router; \ No newline at end of file +var _0xbc44=['update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','isAuthenticated','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc44,0xaa));var _0x4bc4=function(_0x58aed,_0x10c4b3){_0x58aed=_0x58aed-0x0;var _0x532599=_0xbc44[_0x58aed];return _0x532599;};'use strict';var multer=require(_0x4bc4('0x0'));var util=require(_0x4bc4('0x1'));var path=require('path');var timeout=require(_0x4bc4('0x2'));var express=require(_0x4bc4('0x3'));var router=express[_0x4bc4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4bc4('0x5'));var interaction=require(_0x4bc4('0x6'));var config=require(_0x4bc4('0x7'));var controller=require('./intDynamics365Account.controller');router[_0x4bc4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4bc4('0x8')](_0x4bc4('0x9'),auth['isAuthenticated'](),controller[_0x4bc4('0xa')]);router[_0x4bc4('0x8')]('/:id/configurations',auth[_0x4bc4('0xb')](),controller[_0x4bc4('0xc')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x4bc4('0xd')]);router[_0x4bc4('0xe')]('/',auth[_0x4bc4('0xb')](),controller[_0x4bc4('0xf')]);router[_0x4bc4('0xe')](_0x4bc4('0x10'),auth[_0x4bc4('0xb')](),controller[_0x4bc4('0x11')]);router[_0x4bc4('0x12')](_0x4bc4('0x9'),auth['isAuthenticated'](),controller[_0x4bc4('0x13')]);router['delete'](_0x4bc4('0x9'),auth[_0x4bc4('0xb')](),controller['destroy']);module[_0x4bc4('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 6c50c32..cab577a 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 _0x2d72=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3f2093,_0x5ed88f){var _0x208b83=function(_0x1c5ba0){while(--_0x1c5ba0){_0x3f2093['push'](_0x3f2093['shift']());}};_0x208b83(++_0x5ed88f);}(_0x2d72,0xa8));var _0x22d7=function(_0x46f2d7,_0x5c4c44){_0x46f2d7=_0x46f2d7-0x0;var _0x50ad46=_0x2d72[_0x46f2d7];return _0x50ad46;};'use strict';var Sequelize=require(_0x22d7('0x0'));module[_0x22d7('0x1')]={'name':{'type':Sequelize[_0x22d7('0x2')]},'username':{'type':Sequelize[_0x22d7('0x2')]},'password':{'type':Sequelize[_0x22d7('0x2')]},'remoteUri':{'type':Sequelize[_0x22d7('0x2')]},'tenantId':{'type':Sequelize[_0x22d7('0x2')]},'clientId':{'type':Sequelize[_0x22d7('0x2')]},'clientSecret':{'type':Sequelize[_0x22d7('0x2')]},'serverUrl':{'type':Sequelize[_0x22d7('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x22d7('0x2')]},'modernAuthentication':{'type':Sequelize[_0x22d7('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x815b=['sequelize','exports','STRING','BOOLEAN'];(function(_0x1dea38,_0x53320e){var _0xf5721a=function(_0x5ba1b4){while(--_0x5ba1b4){_0x1dea38['push'](_0x1dea38['shift']());}};_0xf5721a(++_0x53320e);}(_0x815b,0xb4));var _0xb815=function(_0x2a06aa,_0xdf3701){_0x2a06aa=_0x2a06aa-0x0;var _0x1f0036=_0x815b[_0x2a06aa];return _0x1f0036;};'use strict';var Sequelize=require(_0xb815('0x0'));module[_0xb815('0x1')]={'name':{'type':Sequelize[_0xb815('0x2')]},'username':{'type':Sequelize[_0xb815('0x2')]},'password':{'type':Sequelize[_0xb815('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xb815('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb815('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb815('0x2')]},'modernAuthentication':{'type':Sequelize[_0xb815('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 5aeae6e..b8a1ffb 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 _0xf443=['sentimentvalue','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','https://login.microsoftonline.com/','/oauth2/token','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','forEach','@odata.type','substring','PicklistAttributeMetadata','push','MetadataId','BooleanAttributeMetadata','all','StringAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','show','params','includeAll','find','create','catch','body','getConfigurations','findOne','length','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','Incident','PhoneCall','title','description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','accountidname','actualserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','importsequencenumber','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame'];(function(_0x262e9e,_0x26296c){var _0x3c9cf5=function(_0x3096a4){while(--_0x3096a4){_0x262e9e['push'](_0x262e9e['shift']());}};_0x3c9cf5(++_0x26296c);}(_0xf443,0x1c8));var _0x3f44=function(_0x437f02,_0x55b88e){_0x437f02=_0x437f02-0x0;var _0x598688=_0xf443[_0x437f02];return _0x598688;};'use strict';var rp=require(_0x3f44('0x0'));var util=require('util');var _=require(_0x3f44('0x1'));var qs=require(_0x3f44('0x2'));var logger=require('../../config/logger')(_0x3f44('0x3'));var db=require(_0x3f44('0x4'))['db'];var integrations=require(_0x3f44('0x5'));function respondWithResult(_0x8ada15,_0x29d527){_0x29d527=_0x29d527||0xc8;return function(_0x190798){if(_0x190798){return _0x8ada15[_0x3f44('0x6')](_0x29d527)[_0x3f44('0x7')](_0x190798);}};}function respondWithFilteredResult(_0x22d56a,_0x52c70d){return function(_0x29e7d3){if(_0x29e7d3){var _0x905c6d=typeof _0x52c70d['offset']===_0x3f44('0x8')&&typeof _0x52c70d[_0x3f44('0x9')]===_0x3f44('0x8');var _0x2b6172=_0x29e7d3[_0x3f44('0xa')];var _0x42092d=_0x905c6d?0x0:_0x52c70d[_0x3f44('0xb')];var _0x513c21=_0x905c6d?_0x29e7d3['count']:_0x52c70d[_0x3f44('0xb')]+_0x52c70d[_0x3f44('0x9')];var _0x382e57;if(_0x513c21>=_0x2b6172){_0x513c21=_0x2b6172;_0x382e57=0xc8;}else{_0x382e57=0xce;}_0x22d56a[_0x3f44('0x6')](_0x382e57);return _0x22d56a['set'](_0x3f44('0xc'),_0x42092d+'-'+_0x513c21+'/'+_0x2b6172)['json'](_0x29e7d3);}return null;};}function saveUpdates(_0x58abae){return function(_0x58a75a){if(_0x58a75a){return _0x58a75a[_0x3f44('0xd')](_0x58abae)[_0x3f44('0xe')](function(_0x10f123){return _0x10f123;});}return null;};}function removeEntity(_0x1023bc){return function(_0x2d541f){if(_0x2d541f){return _0x2d541f[_0x3f44('0xf')]()['then'](function(){_0x1023bc[_0x3f44('0x6')](0xcc)[_0x3f44('0x10')]();});}};}function handleEntityNotFound(_0x5ca82c){return function(_0x3729b0){if(!_0x3729b0){_0x5ca82c[_0x3f44('0x11')](0x194);}return _0x3729b0;};}function handleError(_0x49f57c,_0x24ce86){_0x24ce86=_0x24ce86||0x1f4;return function(_0x22efe3){logger[_0x3f44('0x12')](_0x22efe3[_0x3f44('0x13')]);if(_0x22efe3[_0x3f44('0x14')]){delete _0x22efe3[_0x3f44('0x14')];}_0x49f57c[_0x3f44('0x6')](_0x24ce86)[_0x3f44('0x15')](_0x22efe3);};}exports[_0x3f44('0x16')]=function(_0x318d25,_0x4c8c93){var _0x269427={},_0x41a668={},_0x373346={'count':0x0,'rows':[]};var _0x47660f=_[_0x3f44('0x17')](db[_0x3f44('0x18')][_0x3f44('0x19')],function(_0x33f44a){return{'name':_0x33f44a[_0x3f44('0x1a')],'type':_0x33f44a[_0x3f44('0x1b')][_0x3f44('0x1c')]};});_0x41a668[_0x3f44('0x1d')]=_[_0x3f44('0x17')](_0x47660f,_0x3f44('0x14'));_0x41a668[_0x3f44('0x1e')]=_[_0x3f44('0x1f')](_0x318d25[_0x3f44('0x1e')]);_0x41a668[_0x3f44('0x20')]=_[_0x3f44('0x21')](_0x41a668[_0x3f44('0x1d')],_0x41a668[_0x3f44('0x1e')]);_0x269427['attributes']=_[_0x3f44('0x21')](_0x41a668[_0x3f44('0x1d')],qs[_0x3f44('0x22')](_0x318d25['query'][_0x3f44('0x22')]));_0x269427[_0x3f44('0x23')]=_0x269427['attributes']['length']?_0x269427[_0x3f44('0x23')]:_0x41a668['model'];if(!_0x318d25['query'][_0x3f44('0x24')]('nolimit')){_0x269427['limit']=qs[_0x3f44('0x9')](_0x318d25[_0x3f44('0x1e')][_0x3f44('0x9')]);_0x269427[_0x3f44('0xb')]=qs[_0x3f44('0xb')](_0x318d25[_0x3f44('0x1e')][_0x3f44('0xb')]);}_0x269427[_0x3f44('0x25')]=qs[_0x3f44('0x26')](_0x318d25[_0x3f44('0x1e')]['sort']);_0x269427[_0x3f44('0x27')]=qs[_0x3f44('0x20')](_[_0x3f44('0x28')](_0x318d25[_0x3f44('0x1e')],_0x41a668[_0x3f44('0x20')]),_0x47660f);if(_0x318d25[_0x3f44('0x1e')][_0x3f44('0x29')]){_0x269427[_0x3f44('0x27')]=_[_0x3f44('0x2a')](_0x269427['where'],{'$or':_[_0x3f44('0x17')](_0x47660f,function(_0x4c5000){if(_0x4c5000[_0x3f44('0x1b')]!=='VIRTUAL'){var _0x235d9e={};_0x235d9e[_0x4c5000[_0x3f44('0x14')]]={'$like':'%'+_0x318d25['query']['filter']+'%'};return _0x235d9e;}})});}_0x269427=_[_0x3f44('0x2a')]({},_0x269427,_0x318d25[_0x3f44('0x2b')]);var _0x296d2c={'where':_0x269427[_0x3f44('0x27')]};return db[_0x3f44('0x18')][_0x3f44('0xa')](_0x296d2c)[_0x3f44('0xe')](function(_0x112d17){_0x373346[_0x3f44('0xa')]=_0x112d17;if(_0x318d25[_0x3f44('0x1e')]['includeAll']){_0x269427[_0x3f44('0x2c')]=[{'all':!![]}];}return db[_0x3f44('0x18')][_0x3f44('0x2d')](_0x269427);})[_0x3f44('0xe')](function(_0x41ab20){_0x373346['rows']=_0x41ab20;return _0x373346;})[_0x3f44('0xe')](respondWithFilteredResult(_0x4c8c93,_0x269427))['catch'](handleError(_0x4c8c93,null));};exports[_0x3f44('0x2e')]=function(_0x3ffe40,_0x3524fc){var _0x1f16a7={'raw':![],'where':{'id':_0x3ffe40[_0x3f44('0x2f')]['id']}},_0x178555={};_0x178555['model']=_[_0x3f44('0x1f')](db[_0x3f44('0x18')]['rawAttributes']);_0x178555[_0x3f44('0x1e')]=_[_0x3f44('0x1f')](_0x3ffe40[_0x3f44('0x1e')]);_0x178555['filters']=_[_0x3f44('0x21')](_0x178555['model'],_0x178555['query']);_0x1f16a7[_0x3f44('0x23')]=_[_0x3f44('0x21')](_0x178555[_0x3f44('0x1d')],qs[_0x3f44('0x22')](_0x3ffe40['query'][_0x3f44('0x22')]));_0x1f16a7[_0x3f44('0x23')]=_0x1f16a7['attributes']['length']?_0x1f16a7[_0x3f44('0x23')]:_0x178555[_0x3f44('0x1d')];if(_0x3ffe40['query'][_0x3f44('0x30')]){_0x1f16a7[_0x3f44('0x2c')]=[{'all':!![]}];}_0x1f16a7=_[_0x3f44('0x2a')]({},_0x1f16a7,_0x3ffe40[_0x3f44('0x2b')]);return db[_0x3f44('0x18')][_0x3f44('0x31')](_0x1f16a7)[_0x3f44('0xe')](handleEntityNotFound(_0x3524fc,null))['then'](respondWithResult(_0x3524fc,null))['catch'](handleError(_0x3524fc,null));};exports[_0x3f44('0x32')]=function(_0x3f9afa,_0x197484){return db[_0x3f44('0x18')][_0x3f44('0x32')](_0x3f9afa['body'],{})[_0x3f44('0xe')](respondWithResult(_0x197484,0xc9))[_0x3f44('0x33')](handleError(_0x197484,null));};exports[_0x3f44('0xd')]=function(_0x2338d1,_0x2253d1){if(_0x2338d1[_0x3f44('0x34')]['id']){delete _0x2338d1[_0x3f44('0x34')]['id'];}return db[_0x3f44('0x18')][_0x3f44('0x31')]({'where':{'id':_0x2338d1[_0x3f44('0x2f')]['id']}})[_0x3f44('0xe')](handleEntityNotFound(_0x2253d1,null))['then'](saveUpdates(_0x2338d1[_0x3f44('0x34')],null))[_0x3f44('0xe')](respondWithResult(_0x2253d1,null))[_0x3f44('0x33')](handleError(_0x2253d1,null));};exports[_0x3f44('0xf')]=function(_0x28232c,_0x3e605b){return db['Dynamics365Account'][_0x3f44('0x31')]({'where':{'id':_0x28232c[_0x3f44('0x2f')]['id']}})[_0x3f44('0xe')](handleEntityNotFound(_0x3e605b,null))[_0x3f44('0xe')](removeEntity(_0x3e605b,null))[_0x3f44('0x33')](handleError(_0x3e605b,null));};exports[_0x3f44('0x35')]=function(_0x3b37cd,_0x1680c7){var _0x1c56ac={};var _0x2f0d35={};var _0x58e579;var _0x5ca686;return db[_0x3f44('0x18')][_0x3f44('0x36')]({'where':{'id':_0x3b37cd[_0x3f44('0x2f')]['id']}})[_0x3f44('0xe')](handleEntityNotFound(_0x1680c7,null))[_0x3f44('0xe')](function(_0xd8ceaa){if(_0xd8ceaa){_0x58e579=_0xd8ceaa;_0x2f0d35[_0x3f44('0x1d')]=_[_0x3f44('0x1f')](db['Dynamics365Configuration'][_0x3f44('0x19')]);_0x2f0d35['query']=_['keys'](_0x3b37cd[_0x3f44('0x1e')]);_0x2f0d35['filters']=_['intersection'](_0x2f0d35[_0x3f44('0x1d')],_0x2f0d35[_0x3f44('0x1e')]);_0x1c56ac[_0x3f44('0x23')]=_[_0x3f44('0x21')](_0x2f0d35[_0x3f44('0x1d')],qs[_0x3f44('0x22')](_0x3b37cd['query'][_0x3f44('0x22')]));_0x1c56ac[_0x3f44('0x23')]=_0x1c56ac[_0x3f44('0x23')][_0x3f44('0x37')]?_0x1c56ac[_0x3f44('0x23')]:_0x2f0d35['model'];_0x1c56ac[_0x3f44('0x25')]=qs[_0x3f44('0x26')](_0x3b37cd[_0x3f44('0x1e')][_0x3f44('0x26')]);_0x1c56ac['where']=qs[_0x3f44('0x20')](_[_0x3f44('0x28')](_0x3b37cd['query'],_0x2f0d35[_0x3f44('0x20')]));if(_0x3b37cd[_0x3f44('0x1e')][_0x3f44('0x29')]){_0x1c56ac['where']=_['merge'](_0x1c56ac['where'],{'$or':_[_0x3f44('0x17')](_0x1c56ac[_0x3f44('0x23')],function(_0x5a2177){var _0x4a2495={};_0x4a2495[_0x5a2177]={'$like':'%'+_0x3b37cd[_0x3f44('0x1e')]['filter']+'%'};return _0x4a2495;})});}_0x1c56ac=_[_0x3f44('0x2a')]({},_0x1c56ac,_0x3b37cd[_0x3f44('0x2b')]);return _0x58e579[_0x3f44('0x35')](_0x1c56ac);}})[_0x3f44('0xe')](function(_0xfc8ae){if(_0xfc8ae){_0x5ca686=_0xfc8ae[_0x3f44('0x37')];if(!_0x3b37cd[_0x3f44('0x1e')]['hasOwnProperty'](_0x3f44('0x38'))){_0x1c56ac[_0x3f44('0x9')]=qs[_0x3f44('0x9')](_0x3b37cd[_0x3f44('0x1e')][_0x3f44('0x9')]);_0x1c56ac[_0x3f44('0xb')]=qs[_0x3f44('0xb')](_0x3b37cd[_0x3f44('0x1e')]['offset']);}return _0x58e579[_0x3f44('0x35')](_0x1c56ac);}})[_0x3f44('0xe')](function(_0x2c46c8){if(_0x2c46c8){return _0x2c46c8?{'count':_0x5ca686,'rows':_0x2c46c8}:null;}})['then'](respondWithResult(_0x1680c7,null))[_0x3f44('0x33')](handleError(_0x1680c7,null));};exports[_0x3f44('0x39')]=function(_0x4dc2ab,_0x1e57f4){if(_0x4dc2ab[_0x3f44('0x34')]['id']){delete _0x4dc2ab['body']['id'];}return db[_0x3f44('0x18')][_0x3f44('0x36')]({'where':{'id':_0x4dc2ab[_0x3f44('0x2f')]['id']}})['then'](handleEntityNotFound(_0x1e57f4,null))[_0x3f44('0xe')](function(_0x43c7b8){if(_0x43c7b8){_0x4dc2ab['body'][_0x3f44('0x3a')]=_0x43c7b8['id'];_0x4dc2ab[_0x3f44('0x34')][_0x3f44('0x3b')]=integrations[_0x3f44('0x3c')](_0x4dc2ab[_0x3f44('0x34')][_0x3f44('0x3d')],_0x4dc2ab[_0x3f44('0x34')][_0x3f44('0x1b')]);_0x4dc2ab[_0x3f44('0x34')][_0x3f44('0x3e')]=integrations[_0x3f44('0x3f')](_0x4dc2ab[_0x3f44('0x34')][_0x3f44('0x3d')],_0x4dc2ab['body'][_0x3f44('0x1b')]);return db[_0x3f44('0x40')][_0x3f44('0x32')](_0x4dc2ab['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0x3f44('0x3b')},{'model':db[_0x3f44('0x41')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1e57f4,null))[_0x3f44('0x33')](handleError(_0x1e57f4,null));};function sanitizeRemoteUri(_0x4a5386){var _0x2d6b57=_0x4a5386[_0x3f44('0x42')](-0x1);if(_0x2d6b57==='/')return _0x4a5386['substring'](0x0,_0x4a5386[_0x3f44('0x43')](_0x2d6b57));return _0x4a5386;}function getWebApiUrl(_0x4c2874){return util[_0x3f44('0x44')](_0x3f44('0x45'),_0x4c2874);}exports[_0x3f44('0x46')]=function(_0x2fb4fc,_0x15ba26){var _0x4a3935=_0x2fb4fc[_0x3f44('0x1e')]['ticketType'];var _0x47013f=_0x4a3935==='incident'?_0x3f44('0x47'):_0x3f44('0x48');var _0x21f3af='';var _0x55d685='';var _0x36a805='';var _0x38ed9c='';var _0x7a35ec='';var _0xf570ea='';var _0x18118f='';var _0x594acb='';var _0x5661b=[_0x3f44('0x49'),_0x3f44('0x4a'),'customerid',_0x3f44('0x4b'),_0x3f44('0x4c'),_0x3f44('0x4d'),_0x3f44('0x4e'),_0x3f44('0x4f'),'directioncode','phonecall_activity_parties'];var _0x5fbf67=[_0x3f44('0x50'),'accountidyominame',_0x3f44('0x51'),'billedserviceunits',_0x3f44('0x52'),_0x3f44('0x53'),'contractdetailidname',_0x3f44('0x54'),_0x3f44('0x55'),_0x3f44('0x56'),_0x3f44('0x57'),_0x3f44('0x58'),_0x3f44('0x59'),_0x3f44('0x5a'),_0x3f44('0x5b'),_0x3f44('0x5c'),'customeridtype',_0x3f44('0x5d'),'emailaddress',_0x3f44('0x5e'),_0x3f44('0x5f'),_0x3f44('0x60'),_0x3f44('0x61'),_0x3f44('0x62'),'firstresponsebykpiidname','followupby',_0x3f44('0x63'),'influencescore',_0x3f44('0x64'),'lastonholdtime',_0x3f44('0x65'),_0x3f44('0x66'),_0x3f44('0x67'),_0x3f44('0x68'),_0x3f44('0x69'),_0x3f44('0x6a'),_0x3f44('0x6b'),_0x3f44('0x6c'),'msdyn_incidenttypename',_0x3f44('0x6d'),_0x3f44('0x6e'),_0x3f44('0x6f'),_0x3f44('0x70'),_0x3f44('0x71'),_0x3f44('0x72'),_0x3f44('0x73'),_0x3f44('0x74'),_0x3f44('0x75'),_0x3f44('0x76'),'prioritycodename',_0x3f44('0x77'),_0x3f44('0x78'),_0x3f44('0x79'),_0x3f44('0x7a'),_0x3f44('0x7b'),_0x3f44('0x7c'),_0x3f44('0x7d'),_0x3f44('0x7e'),'slainvokedidname',_0x3f44('0x7f'),_0x3f44('0x80'),'statecode',_0x3f44('0x81'),_0x3f44('0x82'),_0x3f44('0x83'),_0x3f44('0x84'),_0x3f44('0x85'),_0x3f44('0x86'),_0x3f44('0x87'),_0x3f44('0x88')];var _0x242949=_0x5661b['concat'](_0x5fbf67);return db[_0x3f44('0x18')][_0x3f44('0x36')]({'where':{'id':_0x2fb4fc[_0x3f44('0x2f')]['id']},'attributes':['id',_0x3f44('0x89'),_0x3f44('0x8a'),_0x3f44('0x8b'),_0x3f44('0x8c'),_0x3f44('0x8d'),_0x3f44('0x8e'),_0x3f44('0x8f')],'include':[{'model':db[_0x3f44('0x90')],'as':_0x3f44('0x90'),'attributes':['id','data5','data7']}]})[_0x3f44('0xe')](handleEntityNotFound(_0x15ba26,null))[_0x3f44('0xe')](function(_0x43ed9e){if(_0x43ed9e){if(_0x43ed9e[_0x3f44('0x8f')]){_0x43ed9e['access_token']=_0x43ed9e[_0x3f44('0x90')][_0x3f44('0x91')];_0x594acb=sanitizeRemoteUri(_0x43ed9e[_0x3f44('0x90')][_0x3f44('0x92')]);_0x18118f=getWebApiUrl(_0x594acb);return _0x43ed9e;}_0x594acb=sanitizeRemoteUri(_0x43ed9e['remoteUri']);_0x18118f=getWebApiUrl(_0x594acb);var _0x25fc6a={'method':'POST','uri':_0x3f44('0x93')+_0x43ed9e[_0x3f44('0x8c')]+_0x3f44('0x94'),'form':{'client_id':_0x43ed9e[_0x3f44('0x8d')],'resource':_0x594acb,'username':_0x43ed9e[_0x3f44('0x89')],'password':_0x43ed9e['password'],'grant_type':'password','client_secret':_0x43ed9e['clientSecret']},'json':!![]};return rp(_0x25fc6a);}})[_0x3f44('0xe')](function(_0x2914ba){_0xf570ea=_0x2914ba[_0x3f44('0x95')];var _0x3093e7={'method':'GET','uri':encodeURI(_0x18118f+_0x3f44('0x96')+_0x47013f+'\x27'),'headers':{'Authorization':_0x3f44('0x97')+_0xf570ea,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3093e7);})[_0x3f44('0xe')](function(_0x34ffe1){var _0x4705a6=_0x34ffe1[_0x3f44('0x98')][0x0];var _0x482122=_0x4705a6['MetadataId'];var _0x22491a={'method':_0x3f44('0x99'),'uri':_0x18118f+_0x3f44('0x9a')+_0x482122+_0x3f44('0x9b'),'headers':{'Authorization':_0x3f44('0x97')+_0xf570ea,'If-None-Match':null,'OData-Version':_0x3f44('0x9c')},'json':!![]};return rp(_0x22491a);})[_0x3f44('0xe')](function(_0x156b02){_0x21f3af=_0x156b02;_0x55d685=_0x21f3af[_0x3f44('0x9d')];_0x55d685=_[_0x3f44('0x9e')](_0x55d685,function(_0x393206){return!_0x242949['includes'](_0x393206['LogicalName']);});var _0x45feb9=[];var _0x1d4130=[];_0x55d685[_0x3f44('0x9f')](function(_0x106385){if(_0x106385[_0x3f44('0xa0')]){var _0x5d2417=_0x106385[_0x3f44('0xa0')][_0x3f44('0xa1')](_0x106385[_0x3f44('0xa0')][_0x3f44('0x43')]('.')+0x1);if(_0x5d2417===_0x3f44('0xa2')){_0x45feb9[_0x3f44('0xa3')](getSelectList(_0x18118f,_0x4a3935,_0x1d4130,_0x21f3af[_0x3f44('0xa4')],_0x106385[_0x3f44('0xa4')],_0xf570ea));}}});return Promise['all'](_0x45feb9);})[_0x3f44('0xe')](function(_0x3583bc){_0x36a805=_0x3583bc[0x0];var _0x1e0bd8=[];var _0x457b4d=[];_0x55d685[_0x3f44('0x9f')](function(_0x4e4b27){if(!_['isNil'](_0x4e4b27[_0x3f44('0xa0')])){var _0x1a825b=_0x4e4b27[_0x3f44('0xa0')]['substring'](_0x4e4b27[_0x3f44('0xa0')][_0x3f44('0x43')]('.')+0x1);if(_0x1a825b===_0x3f44('0xa5')){_0x1e0bd8[_0x3f44('0xa3')](getBooleanList(_0x18118f,_0x4a3935,_0x457b4d,_0x21f3af['MetadataId'],_0x4e4b27[_0x3f44('0xa4')],_0xf570ea));}}});return Promise[_0x3f44('0xa6')](_0x1e0bd8);})[_0x3f44('0xe')](function(_0x21dd6b){_0x38ed9c=_0x21dd6b[0x0];var _0x7d6441=[];var _0x5c1fd3=[];_0x55d685[_0x3f44('0x9f')](function(_0x267703){if(_0x267703[_0x3f44('0xa0')]){var _0x21fd7c=_0x267703[_0x3f44('0xa0')][_0x3f44('0xa1')](_0x267703['@odata.type'][_0x3f44('0x43')]('.')+0x1);if(_0x21fd7c===_0x3f44('0xa7')||_0x21fd7c==='DoubleAttributeMetadata'||_0x21fd7c==='BigIntAttributeMetadata'||_0x21fd7c===_0x3f44('0xa8')||_0x21fd7c===_0x3f44('0xa9')||_0x21fd7c===_0x3f44('0xaa')||_0x21fd7c===_0x3f44('0xab')||_0x21fd7c===_0x3f44('0xac')||_0x21fd7c===_0x3f44('0xad')||_0x21fd7c===_0x3f44('0xae')){_0x7d6441[_0x3f44('0xa3')](getInputList(_0x18118f,_0x4a3935,_0x21fd7c,_0x5c1fd3,_0x21f3af[_0x3f44('0xa4')],_0x267703[_0x3f44('0xa4')],_0xf570ea));}}});return Promise[_0x3f44('0xa6')](_0x7d6441);})['then'](function(_0x3907cf){_0x7a35ec=_0x3907cf[0x0];var _0x107a33=_0x36a805['concat'](_0x38ed9c)[_0x3f44('0xaf')](_0x7a35ec);var _0x5cbb3f={'count':_0x107a33[_0x3f44('0x37')],'rows':_0x107a33};return _0x5cbb3f;})['then'](respondWithResult(_0x15ba26,null))['catch'](function(_0x10a55f){var _0x35cc55=_0x2fb4fc[_0x3f44('0x1e')][_0x3f44('0xb0')]?0x1f4:_0x10a55f[_0x3f44('0xb1')]||0x1f4;logger[_0x3f44('0x12')](_0x10a55f['stack']);delete _0x10a55f[_0x3f44('0x14')];if(_0x35cc55===0x191){_0x35cc55=0x190;}_0x15ba26['status'](_0x35cc55)[_0x3f44('0x15')](_0x2fb4fc[_0x3f44('0x1e')][_0x3f44('0xb0')]?{'message':_0x3f44('0xb2'),'statusCode':_0x10a55f[_0x3f44('0xb1')]}:_0x10a55f);});};function getSelectList(_0xcd6bd1,_0xdfe4bf,_0x19fbaf,_0x47a6e1,_0xb92e3d,_0xe20cdf){var _0x10ee5d={'method':'GET','uri':_0xcd6bd1+_0x3f44('0x9a')+_0x47a6e1+_0x3f44('0xb3')+_0xb92e3d+_0x3f44('0xb4')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0xe20cdf,'If-None-Match':null,'OData-Version':_0x3f44('0x9c')},'json':!![]};return rp(_0x10ee5d)['then'](function(_0x2de1d3){var _0x25d851=[];var _0x4364f8=_0x2de1d3[_0x3f44('0xb5')][_0x3f44('0xb6')];_0x4364f8[_0x3f44('0x9f')](function(_0x2a7dff){_0x25d851[_0x3f44('0xa3')]({'name':_0x2a7dff[_0x3f44('0xb7')][_0x3f44('0xb8')][_0x3f44('0xb7')],'value':String(_0x2a7dff[_0x3f44('0xb9')])});});var _0x13b783={'id':_0xdfe4bf+'_'+_0x2de1d3[_0x3f44('0xba')],'name':_0x2de1d3[_0x3f44('0xbb')]['UserLocalizedLabel'][_0x3f44('0xb7')],'custom':![],'options':_0x25d851};_0x19fbaf['push'](_0x13b783);return _0x19fbaf;});}function getBooleanList(_0x130082,_0x40f9a8,_0x178690,_0x307b5e,_0x4bcad1,_0x21efaa){var _0x433006={'method':_0x3f44('0x99'),'uri':_0x130082+_0x3f44('0x9a')+_0x307b5e+_0x3f44('0xb3')+_0x4bcad1+_0x3f44('0xbc'),'headers':{'Authorization':'Bearer\x20'+_0x21efaa,'If-None-Match':null,'OData-Version':_0x3f44('0x9c')},'json':!![]};return rp(_0x433006)[_0x3f44('0xe')](function(_0x288d5a){var _0x131fb8=[];_0x131fb8[_0x3f44('0xa3')]({'name':_0x288d5a[_0x3f44('0xb5')]['TrueOption'][_0x3f44('0xb7')]['UserLocalizedLabel'][_0x3f44('0xb7')],'value':_0x3f44('0xbd')},{'name':_0x288d5a['OptionSet'][_0x3f44('0xbe')][_0x3f44('0xb7')][_0x3f44('0xb8')]['Label'],'value':_0x3f44('0xbf')});var _0x4884b0={'id':_0x40f9a8+'_'+_0x288d5a[_0x3f44('0xba')],'name':_0x288d5a[_0x3f44('0xbb')][_0x3f44('0xb8')]['Label'],'custom':![],'options':_0x131fb8};_0x178690[_0x3f44('0xa3')](_0x4884b0);return _0x178690;});}function getInputList(_0x5ae3bd,_0xd14810,_0x311fbe,_0x4a028f,_0x4d01ab,_0x39a36e,_0x503f62){var _0x5c5604={'method':_0x3f44('0x99'),'uri':_0x5ae3bd+'EntityDefinitions('+_0x4d01ab+_0x3f44('0xb3')+_0x39a36e+_0x3f44('0xc0')+_0x311fbe+_0x3f44('0xc1'),'headers':{'Authorization':'Bearer\x20'+_0x503f62,'If-None-Match':null,'OData-Version':_0x3f44('0x9c')},'json':!![]};return rp(_0x5c5604)[_0x3f44('0xe')](function(_0x8dad25){var _0x1a5481={'id':_0xd14810+'_'+_0x8dad25[_0x3f44('0xba')],'name':_0x8dad25[_0x3f44('0xbb')][_0x3f44('0xb8')]?_0x8dad25[_0x3f44('0xbb')][_0x3f44('0xb8')][_0x3f44('0xb7')]:_0x8dad25[_0x3f44('0xba')],'custom':![],'options':[]};_0x4a028f[_0x3f44('0xa3')](_0x1a5481);return _0x4a028f;});} \ No newline at end of file +var _0xe6e5=['ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','remoteUri','tenantId','clientSecret','modernAuthentication','data5','data7','access_token','CloudProvider','https://login.microsoftonline.com/','clientId','password','Bearer\x20','4.0','GET',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','LogicalName','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','forEach','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials','EntityDefinitions(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','status','offset','undefined','limit','count','set','json','update','then','end','sendStatus','error','stack','name','send','map','Dynamics365Account','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','findOne','Dynamics365Configuration','order','addConfiguration','AccountId','Subjects','channel','getDescriptions','Dynamics365Field','Descriptions','substring','lastIndexOf','format','%s/api/data/v9.0/'];(function(_0x4a55e0,_0x160a3c){var _0x2d06ff=function(_0x539752){while(--_0x539752){_0x4a55e0['push'](_0x4a55e0['shift']());}};_0x2d06ff(++_0x160a3c);}(_0xe6e5,0x1e7));var _0x5e6e=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xe6e5[_0x58e469];return _0x4c01c5;};'use strict';var rp=require(_0x5e6e('0x0'));var util=require(_0x5e6e('0x1'));var _=require(_0x5e6e('0x2'));var qs=require(_0x5e6e('0x3'));var logger=require(_0x5e6e('0x4'))(_0x5e6e('0x5'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5e6e('0x6'));function respondWithResult(_0x1751bc,_0x2c268b){_0x2c268b=_0x2c268b||0xc8;return function(_0x143c1c){if(_0x143c1c){return _0x1751bc[_0x5e6e('0x7')](_0x2c268b)['json'](_0x143c1c);}};}function respondWithFilteredResult(_0x25b33c,_0x18b12d){return function(_0x28b603){if(_0x28b603){var _0x42e7db=typeof _0x18b12d[_0x5e6e('0x8')]===_0x5e6e('0x9')&&typeof _0x18b12d[_0x5e6e('0xa')]==='undefined';var _0xdbee49=_0x28b603[_0x5e6e('0xb')];var _0x26ea1b=_0x42e7db?0x0:_0x18b12d[_0x5e6e('0x8')];var _0x5a843c=_0x42e7db?_0x28b603[_0x5e6e('0xb')]:_0x18b12d[_0x5e6e('0x8')]+_0x18b12d[_0x5e6e('0xa')];var _0x4468f9;if(_0x5a843c>=_0xdbee49){_0x5a843c=_0xdbee49;_0x4468f9=0xc8;}else{_0x4468f9=0xce;}_0x25b33c['status'](_0x4468f9);return _0x25b33c[_0x5e6e('0xc')]('Content-Range',_0x26ea1b+'-'+_0x5a843c+'/'+_0xdbee49)[_0x5e6e('0xd')](_0x28b603);}return null;};}function saveUpdates(_0x570c63){return function(_0x5e5a80){if(_0x5e5a80){return _0x5e5a80[_0x5e6e('0xe')](_0x570c63)[_0x5e6e('0xf')](function(_0x1bce14){return _0x1bce14;});}return null;};}function removeEntity(_0x5c3ef9){return function(_0x5911b3){if(_0x5911b3){return _0x5911b3['destroy']()['then'](function(){_0x5c3ef9[_0x5e6e('0x7')](0xcc)[_0x5e6e('0x10')]();});}};}function handleEntityNotFound(_0x3d57f3){return function(_0x13fcd5){if(!_0x13fcd5){_0x3d57f3[_0x5e6e('0x11')](0x194);}return _0x13fcd5;};}function handleError(_0xa1bc87,_0x4ff27d){_0x4ff27d=_0x4ff27d||0x1f4;return function(_0xd07b99){logger[_0x5e6e('0x12')](_0xd07b99[_0x5e6e('0x13')]);if(_0xd07b99[_0x5e6e('0x14')]){delete _0xd07b99['name'];}_0xa1bc87[_0x5e6e('0x7')](_0x4ff27d)[_0x5e6e('0x15')](_0xd07b99);};}exports['index']=function(_0x1a8972,_0x37a195){var _0xd7fd83={},_0x1e2e41={},_0x218b20={'count':0x0,'rows':[]};var _0x2ebda7=_[_0x5e6e('0x16')](db[_0x5e6e('0x17')]['rawAttributes'],function(_0xa0c202){return{'name':_0xa0c202[_0x5e6e('0x18')],'type':_0xa0c202['type'][_0x5e6e('0x19')]};});_0x1e2e41[_0x5e6e('0x1a')]=_[_0x5e6e('0x16')](_0x2ebda7,_0x5e6e('0x14'));_0x1e2e41[_0x5e6e('0x1b')]=_[_0x5e6e('0x1c')](_0x1a8972['query']);_0x1e2e41[_0x5e6e('0x1d')]=_[_0x5e6e('0x1e')](_0x1e2e41[_0x5e6e('0x1a')],_0x1e2e41[_0x5e6e('0x1b')]);_0xd7fd83[_0x5e6e('0x1f')]=_['intersection'](_0x1e2e41[_0x5e6e('0x1a')],qs[_0x5e6e('0x20')](_0x1a8972[_0x5e6e('0x1b')][_0x5e6e('0x20')]));_0xd7fd83['attributes']=_0xd7fd83[_0x5e6e('0x1f')][_0x5e6e('0x21')]?_0xd7fd83[_0x5e6e('0x1f')]:_0x1e2e41[_0x5e6e('0x1a')];if(!_0x1a8972['query'][_0x5e6e('0x22')]('nolimit')){_0xd7fd83[_0x5e6e('0xa')]=qs[_0x5e6e('0xa')](_0x1a8972[_0x5e6e('0x1b')][_0x5e6e('0xa')]);_0xd7fd83[_0x5e6e('0x8')]=qs[_0x5e6e('0x8')](_0x1a8972[_0x5e6e('0x1b')]['offset']);}_0xd7fd83['order']=qs['sort'](_0x1a8972['query'][_0x5e6e('0x23')]);_0xd7fd83['where']=qs[_0x5e6e('0x1d')](_[_0x5e6e('0x24')](_0x1a8972[_0x5e6e('0x1b')],_0x1e2e41[_0x5e6e('0x1d')]),_0x2ebda7);if(_0x1a8972[_0x5e6e('0x1b')]['filter']){_0xd7fd83[_0x5e6e('0x25')]=_[_0x5e6e('0x26')](_0xd7fd83['where'],{'$or':_[_0x5e6e('0x16')](_0x2ebda7,function(_0x41682b){if(_0x41682b[_0x5e6e('0x27')]!==_0x5e6e('0x28')){var _0x558d44={};_0x558d44[_0x41682b[_0x5e6e('0x14')]]={'$like':'%'+_0x1a8972['query'][_0x5e6e('0x29')]+'%'};return _0x558d44;}})});}_0xd7fd83=_[_0x5e6e('0x26')]({},_0xd7fd83,_0x1a8972[_0x5e6e('0x2a')]);var _0x5ad942={'where':_0xd7fd83[_0x5e6e('0x25')]};return db[_0x5e6e('0x17')][_0x5e6e('0xb')](_0x5ad942)[_0x5e6e('0xf')](function(_0x4d9027){_0x218b20[_0x5e6e('0xb')]=_0x4d9027;if(_0x1a8972[_0x5e6e('0x1b')][_0x5e6e('0x2b')]){_0xd7fd83[_0x5e6e('0x2c')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x5e6e('0x2d')](_0xd7fd83);})[_0x5e6e('0xf')](function(_0x35fb62){_0x218b20[_0x5e6e('0x2e')]=_0x35fb62;return _0x218b20;})[_0x5e6e('0xf')](respondWithFilteredResult(_0x37a195,_0xd7fd83))[_0x5e6e('0x2f')](handleError(_0x37a195,null));};exports[_0x5e6e('0x30')]=function(_0x1b28c9,_0x3363c3){var _0x17f89c={'raw':![],'where':{'id':_0x1b28c9[_0x5e6e('0x31')]['id']}},_0x244ee2={};_0x244ee2[_0x5e6e('0x1a')]=_[_0x5e6e('0x1c')](db[_0x5e6e('0x17')]['rawAttributes']);_0x244ee2[_0x5e6e('0x1b')]=_[_0x5e6e('0x1c')](_0x1b28c9['query']);_0x244ee2[_0x5e6e('0x1d')]=_['intersection'](_0x244ee2[_0x5e6e('0x1a')],_0x244ee2[_0x5e6e('0x1b')]);_0x17f89c['attributes']=_[_0x5e6e('0x1e')](_0x244ee2[_0x5e6e('0x1a')],qs[_0x5e6e('0x20')](_0x1b28c9[_0x5e6e('0x1b')][_0x5e6e('0x20')]));_0x17f89c[_0x5e6e('0x1f')]=_0x17f89c[_0x5e6e('0x1f')][_0x5e6e('0x21')]?_0x17f89c[_0x5e6e('0x1f')]:_0x244ee2[_0x5e6e('0x1a')];if(_0x1b28c9[_0x5e6e('0x1b')][_0x5e6e('0x2b')]){_0x17f89c[_0x5e6e('0x2c')]=[{'all':!![]}];}_0x17f89c=_[_0x5e6e('0x26')]({},_0x17f89c,_0x1b28c9[_0x5e6e('0x2a')]);return db[_0x5e6e('0x17')][_0x5e6e('0x32')](_0x17f89c)['then'](handleEntityNotFound(_0x3363c3,null))[_0x5e6e('0xf')](respondWithResult(_0x3363c3,null))[_0x5e6e('0x2f')](handleError(_0x3363c3,null));};exports[_0x5e6e('0x33')]=function(_0x23456c,_0x3ac32c){return db[_0x5e6e('0x17')][_0x5e6e('0x33')](_0x23456c[_0x5e6e('0x34')],{})[_0x5e6e('0xf')](respondWithResult(_0x3ac32c,0xc9))['catch'](handleError(_0x3ac32c,null));};exports['update']=function(_0x6cc233,_0x42f7f8){if(_0x6cc233['body']['id']){delete _0x6cc233[_0x5e6e('0x34')]['id'];}return db[_0x5e6e('0x17')][_0x5e6e('0x32')]({'where':{'id':_0x6cc233[_0x5e6e('0x31')]['id']}})['then'](handleEntityNotFound(_0x42f7f8,null))[_0x5e6e('0xf')](saveUpdates(_0x6cc233[_0x5e6e('0x34')],null))['then'](respondWithResult(_0x42f7f8,null))[_0x5e6e('0x2f')](handleError(_0x42f7f8,null));};exports[_0x5e6e('0x35')]=function(_0x4a3b89,_0x32e22e){return db[_0x5e6e('0x17')][_0x5e6e('0x32')]({'where':{'id':_0x4a3b89[_0x5e6e('0x31')]['id']}})['then'](handleEntityNotFound(_0x32e22e,null))['then'](removeEntity(_0x32e22e,null))['catch'](handleError(_0x32e22e,null));};exports['getConfigurations']=function(_0x156905,_0x4203b8){var _0x5737e7={};var _0x5028a8={};var _0x4fe309;var _0x1d0b86;return db['Dynamics365Account'][_0x5e6e('0x36')]({'where':{'id':_0x156905[_0x5e6e('0x31')]['id']}})['then'](handleEntityNotFound(_0x4203b8,null))[_0x5e6e('0xf')](function(_0x4d39a9){if(_0x4d39a9){_0x4fe309=_0x4d39a9;_0x5028a8[_0x5e6e('0x1a')]=_['keys'](db[_0x5e6e('0x37')]['rawAttributes']);_0x5028a8['query']=_['keys'](_0x156905[_0x5e6e('0x1b')]);_0x5028a8[_0x5e6e('0x1d')]=_[_0x5e6e('0x1e')](_0x5028a8[_0x5e6e('0x1a')],_0x5028a8[_0x5e6e('0x1b')]);_0x5737e7['attributes']=_[_0x5e6e('0x1e')](_0x5028a8[_0x5e6e('0x1a')],qs[_0x5e6e('0x20')](_0x156905[_0x5e6e('0x1b')]['fields']));_0x5737e7['attributes']=_0x5737e7['attributes'][_0x5e6e('0x21')]?_0x5737e7[_0x5e6e('0x1f')]:_0x5028a8[_0x5e6e('0x1a')];_0x5737e7[_0x5e6e('0x38')]=qs[_0x5e6e('0x23')](_0x156905['query'][_0x5e6e('0x23')]);_0x5737e7[_0x5e6e('0x25')]=qs[_0x5e6e('0x1d')](_['pick'](_0x156905[_0x5e6e('0x1b')],_0x5028a8[_0x5e6e('0x1d')]));if(_0x156905[_0x5e6e('0x1b')][_0x5e6e('0x29')]){_0x5737e7['where']=_[_0x5e6e('0x26')](_0x5737e7[_0x5e6e('0x25')],{'$or':_[_0x5e6e('0x16')](_0x5737e7[_0x5e6e('0x1f')],function(_0x4d73bd){var _0x363e25={};_0x363e25[_0x4d73bd]={'$like':'%'+_0x156905[_0x5e6e('0x1b')][_0x5e6e('0x29')]+'%'};return _0x363e25;})});}_0x5737e7=_[_0x5e6e('0x26')]({},_0x5737e7,_0x156905[_0x5e6e('0x2a')]);return _0x4fe309['getConfigurations'](_0x5737e7);}})['then'](function(_0x3a7a88){if(_0x3a7a88){_0x1d0b86=_0x3a7a88[_0x5e6e('0x21')];if(!_0x156905[_0x5e6e('0x1b')]['hasOwnProperty']('nolimit')){_0x5737e7['limit']=qs[_0x5e6e('0xa')](_0x156905[_0x5e6e('0x1b')]['limit']);_0x5737e7['offset']=qs[_0x5e6e('0x8')](_0x156905[_0x5e6e('0x1b')][_0x5e6e('0x8')]);}return _0x4fe309['getConfigurations'](_0x5737e7);}})['then'](function(_0x37a827){if(_0x37a827){return _0x37a827?{'count':_0x1d0b86,'rows':_0x37a827}:null;}})['then'](respondWithResult(_0x4203b8,null))[_0x5e6e('0x2f')](handleError(_0x4203b8,null));};exports[_0x5e6e('0x39')]=function(_0x4adeec,_0x56f5bb){if(_0x4adeec[_0x5e6e('0x34')]['id']){delete _0x4adeec['body']['id'];}return db[_0x5e6e('0x17')]['findOne']({'where':{'id':_0x4adeec['params']['id']}})[_0x5e6e('0xf')](handleEntityNotFound(_0x56f5bb,null))[_0x5e6e('0xf')](function(_0x4bdcaa){if(_0x4bdcaa){_0x4adeec[_0x5e6e('0x34')][_0x5e6e('0x3a')]=_0x4bdcaa['id'];_0x4adeec['body'][_0x5e6e('0x3b')]=integrations['getSubjects'](_0x4adeec[_0x5e6e('0x34')][_0x5e6e('0x3c')],_0x4adeec[_0x5e6e('0x34')][_0x5e6e('0x27')]);_0x4adeec['body']['Descriptions']=integrations[_0x5e6e('0x3d')](_0x4adeec['body']['channel'],_0x4adeec['body'][_0x5e6e('0x27')]);return db[_0x5e6e('0x37')][_0x5e6e('0x33')](_0x4adeec[_0x5e6e('0x34')],{'include':[{'model':db[_0x5e6e('0x3e')],'as':_0x5e6e('0x3b')},{'model':db[_0x5e6e('0x3e')],'as':_0x5e6e('0x3f')}]});}return null;})[_0x5e6e('0xf')](respondWithResult(_0x56f5bb,null))[_0x5e6e('0x2f')](handleError(_0x56f5bb,null));};function sanitizeRemoteUri(_0x39c0f6){var _0x1b30b7=_0x39c0f6['slice'](-0x1);if(_0x1b30b7==='/')return _0x39c0f6[_0x5e6e('0x40')](0x0,_0x39c0f6[_0x5e6e('0x41')](_0x1b30b7));return _0x39c0f6;}function getWebApiUrl(_0x5a091c){return util[_0x5e6e('0x42')](_0x5e6e('0x43'),_0x5a091c);}exports['getFields']=function(_0x2790db,_0x480d20){var _0x3d2057=_0x2790db[_0x5e6e('0x1b')][_0x5e6e('0x44')];var _0x4b454b=_0x3d2057===_0x5e6e('0x45')?_0x5e6e('0x46'):_0x5e6e('0x47');var _0x5c7961='';var _0x3ce110='';var _0x14d039='';var _0x1dd2b3='';var _0x10b5f9='';var _0x4a7cb5='';var _0x2d7c17='';var _0x34d0d0='';var _0x2542f7=[_0x5e6e('0x48'),_0x5e6e('0x49'),_0x5e6e('0x4a'),_0x5e6e('0x4b'),_0x5e6e('0x4c'),_0x5e6e('0x4d'),'phonenumber',_0x5e6e('0x4e'),_0x5e6e('0x4f'),_0x5e6e('0x50')];var _0x50de69=[_0x5e6e('0x51'),_0x5e6e('0x52'),_0x5e6e('0x53'),_0x5e6e('0x54'),'contactidname',_0x5e6e('0x55'),_0x5e6e('0x56'),_0x5e6e('0x57'),_0x5e6e('0x58'),'createdbyexternalpartyyominame','createdbyname','createdbyyominame',_0x5e6e('0x59'),_0x5e6e('0x5a'),_0x5e6e('0x5b'),_0x5e6e('0x5c'),_0x5e6e('0x5d'),'customeridyominame',_0x5e6e('0x5e'),_0x5e6e('0x5f'),_0x5e6e('0x60'),_0x5e6e('0x61'),'escalatedon',_0x5e6e('0x62'),'firstresponsebykpiidname',_0x5e6e('0x63'),_0x5e6e('0x64'),_0x5e6e('0x65'),_0x5e6e('0x66'),'lastonholdtime',_0x5e6e('0x67'),_0x5e6e('0x68'),_0x5e6e('0x69'),'modifiedbyname','modifiedbyyominame',_0x5e6e('0x6a'),'modifiedonbehalfbyname',_0x5e6e('0x6b'),_0x5e6e('0x6c'),_0x5e6e('0x6d'),_0x5e6e('0x6e'),_0x5e6e('0x6f'),_0x5e6e('0x70'),_0x5e6e('0x71'),'owneridtype','owneridyominame',_0x5e6e('0x72'),'primarycontactidname',_0x5e6e('0x73'),_0x5e6e('0x74'),_0x5e6e('0x75'),_0x5e6e('0x76'),_0x5e6e('0x77'),_0x5e6e('0x78'),_0x5e6e('0x79'),'responsiblecontactidname',_0x5e6e('0x7a'),_0x5e6e('0x7b'),_0x5e6e('0x7c'),_0x5e6e('0x7d'),'socialprofileidname','statecode',_0x5e6e('0x7e'),'subjectidname',_0x5e6e('0x7f'),_0x5e6e('0x80'),_0x5e6e('0x81'),_0x5e6e('0x82'),_0x5e6e('0x83'),'versionnumber'];var _0x584540=_0x2542f7[_0x5e6e('0x84')](_0x50de69);return db['Dynamics365Account'][_0x5e6e('0x36')]({'where':{'id':_0x2790db[_0x5e6e('0x31')]['id']},'attributes':['id',_0x5e6e('0x85'),'password',_0x5e6e('0x86'),_0x5e6e('0x87'),'clientId',_0x5e6e('0x88'),_0x5e6e('0x89')],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','attributes':['id',_0x5e6e('0x8a'),_0x5e6e('0x8b')]}]})[_0x5e6e('0xf')](handleEntityNotFound(_0x480d20,null))['then'](function(_0x4b57d8){if(_0x4b57d8){if(_0x4b57d8[_0x5e6e('0x89')]){_0x4b57d8[_0x5e6e('0x8c')]=_0x4b57d8[_0x5e6e('0x8d')]['data5'];_0x34d0d0=sanitizeRemoteUri(_0x4b57d8['CloudProvider']['data7']);_0x2d7c17=getWebApiUrl(_0x34d0d0);return _0x4b57d8;}_0x34d0d0=sanitizeRemoteUri(_0x4b57d8[_0x5e6e('0x86')]);_0x2d7c17=getWebApiUrl(_0x34d0d0);var _0xc338e3={'method':'POST','uri':_0x5e6e('0x8e')+_0x4b57d8[_0x5e6e('0x87')]+'/oauth2/token','form':{'client_id':_0x4b57d8[_0x5e6e('0x8f')],'resource':_0x34d0d0,'username':_0x4b57d8[_0x5e6e('0x85')],'password':_0x4b57d8[_0x5e6e('0x90')],'grant_type':_0x5e6e('0x90'),'client_secret':_0x4b57d8[_0x5e6e('0x88')]},'json':!![]};return rp(_0xc338e3);}})[_0x5e6e('0xf')](function(_0x53f278){_0x4a7cb5=_0x53f278[_0x5e6e('0x8c')];var _0x52601e={'method':'GET','uri':encodeURI(_0x2d7c17+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x4b454b+'\x27'),'headers':{'Authorization':_0x5e6e('0x91')+_0x4a7cb5,'If-None-Match':null,'OData-Version':_0x5e6e('0x92')},'json':!![]};return rp(_0x52601e);})[_0x5e6e('0xf')](function(_0x4d159c){var _0x112b2a=_0x4d159c['value'][0x0];var _0x1714b8=_0x112b2a['MetadataId'];var _0x558d58={'method':_0x5e6e('0x93'),'uri':_0x2d7c17+'EntityDefinitions('+_0x1714b8+_0x5e6e('0x94'),'headers':{'Authorization':_0x5e6e('0x91')+_0x4a7cb5,'If-None-Match':null,'OData-Version':_0x5e6e('0x92')},'json':!![]};return rp(_0x558d58);})[_0x5e6e('0xf')](function(_0x45912d){_0x5c7961=_0x45912d;_0x3ce110=_0x5c7961[_0x5e6e('0x95')];_0x3ce110=_['remove'](_0x3ce110,function(_0x3d0c5d){return!_0x584540[_0x5e6e('0x96')](_0x3d0c5d[_0x5e6e('0x97')]);});var _0x47511f=[];var _0x4bba6c=[];_0x3ce110['forEach'](function(_0x136640){if(_0x136640[_0x5e6e('0x98')]){var _0x21534a=_0x136640['@odata.type'][_0x5e6e('0x40')](_0x136640[_0x5e6e('0x98')]['lastIndexOf']('.')+0x1);if(_0x21534a===_0x5e6e('0x99')){_0x47511f[_0x5e6e('0x9a')](getSelectList(_0x2d7c17,_0x3d2057,_0x4bba6c,_0x5c7961[_0x5e6e('0x9b')],_0x136640[_0x5e6e('0x9b')],_0x4a7cb5));}}});return Promise[_0x5e6e('0x9c')](_0x47511f);})[_0x5e6e('0xf')](function(_0x46f55c){_0x14d039=_0x46f55c[0x0];var _0x338776=[];var _0x3d12ee=[];_0x3ce110[_0x5e6e('0x9d')](function(_0x4877e7){if(!_[_0x5e6e('0x9e')](_0x4877e7['@odata.type'])){var _0x9ec3a9=_0x4877e7[_0x5e6e('0x98')]['substring'](_0x4877e7[_0x5e6e('0x98')]['lastIndexOf']('.')+0x1);if(_0x9ec3a9===_0x5e6e('0x9f')){_0x338776[_0x5e6e('0x9a')](getBooleanList(_0x2d7c17,_0x3d2057,_0x3d12ee,_0x5c7961['MetadataId'],_0x4877e7[_0x5e6e('0x9b')],_0x4a7cb5));}}});return Promise['all'](_0x338776);})[_0x5e6e('0xf')](function(_0x48c675){_0x1dd2b3=_0x48c675[0x0];var _0x5c599d=[];var _0x57f834=[];_0x3ce110[_0x5e6e('0x9d')](function(_0x499956){if(_0x499956['@odata.type']){var _0x1a9ff7=_0x499956[_0x5e6e('0x98')][_0x5e6e('0x40')](_0x499956[_0x5e6e('0x98')][_0x5e6e('0x41')]('.')+0x1);if(_0x1a9ff7==='StringAttributeMetadata'||_0x1a9ff7===_0x5e6e('0xa0')||_0x1a9ff7==='BigIntAttributeMetadata'||_0x1a9ff7===_0x5e6e('0xa1')||_0x1a9ff7===_0x5e6e('0xa2')||_0x1a9ff7==='DateTimeAttributeMetadata'||_0x1a9ff7===_0x5e6e('0xa3')||_0x1a9ff7===_0x5e6e('0xa4')||_0x1a9ff7===_0x5e6e('0xa5')||_0x1a9ff7===_0x5e6e('0xa6')){_0x5c599d[_0x5e6e('0x9a')](getInputList(_0x2d7c17,_0x3d2057,_0x1a9ff7,_0x57f834,_0x5c7961[_0x5e6e('0x9b')],_0x499956[_0x5e6e('0x9b')],_0x4a7cb5));}}});return Promise[_0x5e6e('0x9c')](_0x5c599d);})[_0x5e6e('0xf')](function(_0xfa4e17){_0x10b5f9=_0xfa4e17[0x0];var _0x3d0fe5=_0x14d039[_0x5e6e('0x84')](_0x1dd2b3)[_0x5e6e('0x84')](_0x10b5f9);var _0x5842aa={'count':_0x3d0fe5[_0x5e6e('0x21')],'rows':_0x3d0fe5};return _0x5842aa;})[_0x5e6e('0xf')](respondWithResult(_0x480d20,null))[_0x5e6e('0x2f')](function(_0x2913ee){var _0x27c644=_0x2790db[_0x5e6e('0x1b')][_0x5e6e('0xa7')]?0x1f4:_0x2913ee[_0x5e6e('0xa8')]||0x1f4;logger[_0x5e6e('0x12')](_0x2913ee[_0x5e6e('0x13')]);delete _0x2913ee[_0x5e6e('0x14')];if(_0x27c644===0x191){_0x27c644=0x190;}_0x480d20[_0x5e6e('0x7')](_0x27c644)[_0x5e6e('0x15')](_0x2790db[_0x5e6e('0x1b')]['test']?{'message':_0x5e6e('0xa9'),'statusCode':_0x2913ee[_0x5e6e('0xa8')]}:_0x2913ee);});};function getSelectList(_0x5b22d1,_0x4c9748,_0x3f76b3,_0x23ac53,_0x35cd23,_0x1c3948){var _0x346632={'method':_0x5e6e('0x93'),'uri':_0x5b22d1+_0x5e6e('0xaa')+_0x23ac53+')/Attributes('+_0x35cd23+_0x5e6e('0xab')+_0x5e6e('0xac'),'headers':{'Authorization':_0x5e6e('0x91')+_0x1c3948,'If-None-Match':null,'OData-Version':_0x5e6e('0x92')},'json':!![]};return rp(_0x346632)['then'](function(_0x161249){var _0x564eb8=[];var _0x512e99=_0x161249['OptionSet'][_0x5e6e('0xad')];_0x512e99[_0x5e6e('0x9d')](function(_0xc1e91){_0x564eb8[_0x5e6e('0x9a')]({'name':_0xc1e91[_0x5e6e('0xae')][_0x5e6e('0xaf')][_0x5e6e('0xae')],'value':String(_0xc1e91[_0x5e6e('0xb0')])});});var _0x12de49={'id':_0x4c9748+'_'+_0x161249[_0x5e6e('0x97')],'name':_0x161249['DisplayName'][_0x5e6e('0xaf')][_0x5e6e('0xae')],'custom':![],'options':_0x564eb8};_0x3f76b3['push'](_0x12de49);return _0x3f76b3;});}function getBooleanList(_0xb50346,_0xddc7f0,_0x92401c,_0x4747f5,_0x1281f2,_0x470f7a){var _0x3a2cb2={'method':_0x5e6e('0x93'),'uri':_0xb50346+_0x5e6e('0xaa')+_0x4747f5+')/Attributes('+_0x1281f2+_0x5e6e('0xb1'),'headers':{'Authorization':_0x5e6e('0x91')+_0x470f7a,'If-None-Match':null,'OData-Version':_0x5e6e('0x92')},'json':!![]};return rp(_0x3a2cb2)['then'](function(_0x5a55ee){var _0x13040e=[];_0x13040e[_0x5e6e('0x9a')]({'name':_0x5a55ee[_0x5e6e('0xb2')][_0x5e6e('0xb3')][_0x5e6e('0xae')][_0x5e6e('0xaf')][_0x5e6e('0xae')],'value':'true'},{'name':_0x5a55ee[_0x5e6e('0xb2')][_0x5e6e('0xb4')][_0x5e6e('0xae')]['UserLocalizedLabel'][_0x5e6e('0xae')],'value':_0x5e6e('0xb5')});var _0x25a071={'id':_0xddc7f0+'_'+_0x5a55ee[_0x5e6e('0x97')],'name':_0x5a55ee[_0x5e6e('0xb6')][_0x5e6e('0xaf')][_0x5e6e('0xae')],'custom':![],'options':_0x13040e};_0x92401c[_0x5e6e('0x9a')](_0x25a071);return _0x92401c;});}function getInputList(_0x27fd0b,_0xda3c9c,_0x3cf277,_0x326505,_0x30a778,_0x3176a6,_0x56c48a){var _0x55facd={'method':'GET','uri':_0x27fd0b+'EntityDefinitions('+_0x30a778+')/Attributes('+_0x3176a6+_0x5e6e('0xb7')+_0x3cf277+_0x5e6e('0xb8'),'headers':{'Authorization':_0x5e6e('0x91')+_0x56c48a,'If-None-Match':null,'OData-Version':_0x5e6e('0x92')},'json':!![]};return rp(_0x55facd)['then'](function(_0x2fd32b){var _0x148ee1={'id':_0xda3c9c+'_'+_0x2fd32b[_0x5e6e('0x97')],'name':_0x2fd32b[_0x5e6e('0xb6')][_0x5e6e('0xaf')]?_0x2fd32b['DisplayName'][_0x5e6e('0xaf')][_0x5e6e('0xae')]:_0x2fd32b[_0x5e6e('0x97')],'custom':![],'options':[]};_0x326505[_0x5e6e('0x9a')](_0x148ee1);return _0x326505;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 7351bb2..3d707ab 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 _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x3b2005,_0x2912f6){var _0x5eaca6=function(_0x2d772c){while(--_0x2d772c){_0x3b2005['push'](_0x3b2005['shift']());}};_0x5eaca6(++_0x2912f6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x228ac9,_0x42f065){_0x228ac9=_0x228ac9-0x0;var _0x69fe02=_0xcb91[_0x228ac9];return _0x69fe02;};'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'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x53078f,_0x34c213){var _0x583363=function(_0x28c376){while(--_0x28c376){_0x53078f['push'](_0x53078f['shift']());}};_0x583363(++_0x34c213);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0xcb91[_0x1602ef];return _0x5870ee;};'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'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 26e6dd7..eb20630 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 _0x3c08=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','limit','include','map','model','ShowDynamics365Account','find','where','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x4af93e,_0xc260c9){var _0x188f89=function(_0x112ce0){while(--_0x112ce0){_0x4af93e['push'](_0x4af93e['shift']());}};_0x188f89(++_0xc260c9);}(_0x3c08,0x67));var _0x83c0=function(_0x29bed1,_0x9104ed){_0x29bed1=_0x29bed1-0x0;var _0x14338c=_0x3c08[_0x29bed1];return _0x14338c;};'use strict';var _=require(_0x83c0('0x0'));var util=require(_0x83c0('0x1'));var moment=require(_0x83c0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x83c0('0x3'));var db=require(_0x83c0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x83c0('0x5'))(_0x83c0('0x6'));var config=require(_0x83c0('0x7'));var jayson=require(_0x83c0('0x8'));var client=jayson['client'][_0x83c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b9585,_0x56e297,_0x5044ae){return new BPromise(function(_0x4ab018,_0x43564e){return client[_0x83c0('0xa')](_0x3b9585,_0x5044ae)[_0x83c0('0xb')](function(_0x3c523d){logger[_0x83c0('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x56e297,_0x83c0('0xd'));logger[_0x83c0('0xe')](_0x83c0('0xf'),_0x56e297,_0x83c0('0xd'),JSON[_0x83c0('0x10')](_0x3c523d));if(_0x3c523d[_0x83c0('0x11')]){if(_0x3c523d[_0x83c0('0x11')][_0x83c0('0x12')]===0x1f4){logger[_0x83c0('0x11')](_0x83c0('0x13'),_0x56e297,_0x3c523d[_0x83c0('0x11')][_0x83c0('0x14')]);return _0x43564e(_0x3c523d[_0x83c0('0x11')][_0x83c0('0x14')]);}logger[_0x83c0('0x11')](_0x83c0('0x13'),_0x56e297,_0x3c523d[_0x83c0('0x11')]['message']);return _0x4ab018(_0x3c523d[_0x83c0('0x11')][_0x83c0('0x14')]);}else{logger['info'](_0x83c0('0x13'),_0x56e297,_0x83c0('0xd'));_0x4ab018(_0x3c523d[_0x83c0('0x15')]['message']);}})[_0x83c0('0x16')](function(_0x52a840){logger[_0x83c0('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x56e297,_0x52a840);_0x43564e(_0x52a840);});});}exports[_0x83c0('0x17')]=function(_0x43000a){var _0x297d2d=this;return new Promise(function(_0x447bcf,_0x2a0a7f){return db[_0x83c0('0x18')][_0x83c0('0x19')]({'raw':_0x43000a['options']?_0x43000a[_0x83c0('0x1a')][_0x83c0('0x1b')]===undefined?!![]:![]:!![],'where':_0x43000a[_0x83c0('0x1a')]?_0x43000a[_0x83c0('0x1a')]['where']||null:null,'attributes':_0x43000a['options']?_0x43000a[_0x83c0('0x1a')][_0x83c0('0x1c')]||null:null,'limit':_0x43000a[_0x83c0('0x1a')]?_0x43000a[_0x83c0('0x1a')][_0x83c0('0x1d')]||null:null,'include':_0x43000a[_0x83c0('0x1a')]?_0x43000a[_0x83c0('0x1a')]['include']?_['map'](_0x43000a[_0x83c0('0x1a')][_0x83c0('0x1e')],function(_0x520748){return{'model':db[_0x520748['model']],'as':_0x520748['as'],'attributes':_0x520748[_0x83c0('0x1c')],'include':_0x520748[_0x83c0('0x1e')]?_[_0x83c0('0x1f')](_0x520748['include'],function(_0x757b39){return{'model':db[_0x757b39['model']],'as':_0x757b39['as'],'attributes':_0x757b39[_0x83c0('0x1c')],'include':_0x757b39['include']?_['map'](_0x757b39[_0x83c0('0x1e')],function(_0x452f4f){return{'model':db[_0x452f4f[_0x83c0('0x20')]],'as':_0x452f4f['as'],'attributes':_0x452f4f[_0x83c0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x83c0('0xb')](function(_0x4947cd){logger[_0x83c0('0xc')](_0x83c0('0x17'),_0x43000a);logger[_0x83c0('0xe')]('GetDynamics365Account',_0x43000a,JSON[_0x83c0('0x10')](_0x4947cd));_0x447bcf(_0x4947cd);})['catch'](function(_0x461521){logger[_0x83c0('0x11')](_0x83c0('0x17'),_0x461521['message'],_0x43000a);_0x2a0a7f(_0x297d2d[_0x83c0('0x11')](0x1f4,_0x461521[_0x83c0('0x14')]));});});};exports[_0x83c0('0x21')]=function(_0x2acd0d){var _0x4ee6ee=this;return new Promise(function(_0x2a5532,_0x3c1bd9){return db[_0x83c0('0x18')][_0x83c0('0x22')]({'raw':_0x2acd0d[_0x83c0('0x1a')]?_0x2acd0d[_0x83c0('0x1a')][_0x83c0('0x1b')]===undefined?!![]:![]:!![],'where':_0x2acd0d['options']?_0x2acd0d[_0x83c0('0x1a')][_0x83c0('0x23')]||null:null,'attributes':_0x2acd0d[_0x83c0('0x1a')]?_0x2acd0d['options']['attributes']||null:null,'include':_0x2acd0d['options']?_0x2acd0d[_0x83c0('0x1a')][_0x83c0('0x1e')]?_[_0x83c0('0x1f')](_0x2acd0d[_0x83c0('0x1a')][_0x83c0('0x1e')],function(_0xb6b421){return{'model':db[_0xb6b421[_0x83c0('0x20')]],'as':_0xb6b421['as'],'attributes':_0xb6b421[_0x83c0('0x1c')],'include':_0xb6b421[_0x83c0('0x1e')]?_['map'](_0xb6b421[_0x83c0('0x1e')],function(_0x167f38){return{'model':db[_0x167f38[_0x83c0('0x20')]],'as':_0x167f38['as'],'attributes':_0x167f38[_0x83c0('0x1c')],'include':_0x167f38[_0x83c0('0x1e')]?_['map'](_0x167f38['include'],function(_0x4f51cf){return{'model':db[_0x4f51cf[_0x83c0('0x20')]],'as':_0x4f51cf['as'],'attributes':_0x4f51cf[_0x83c0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x83c0('0xb')](function(_0x119322){logger[_0x83c0('0xc')]('ShowDynamics365Account',_0x2acd0d);logger[_0x83c0('0xe')](_0x83c0('0x21'),_0x2acd0d,JSON[_0x83c0('0x10')](_0x119322));_0x2a5532(_0x119322);})[_0x83c0('0x16')](function(_0x11aae7){logger[_0x83c0('0x11')](_0x83c0('0x21'),_0x11aae7['message'],_0x2acd0d);_0x3c1bd9(_0x4ee6ee[_0x83c0('0x11')](0x1f4,_0x11aae7[_0x83c0('0x14')]));});});}; \ No newline at end of file +var _0xe65b=['jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','include','map','model','attributes','catch','ShowDynamics365Account','stringify','lodash','moment','bluebird','randomstring','../../config/utils','../../config/environment'];(function(_0x371808,_0x2c851d){var _0x57cabf=function(_0x1c4635){while(--_0x1c4635){_0x371808['push'](_0x371808['shift']());}};_0x57cabf(++_0x2c851d);}(_0xe65b,0x19a));var _0xbe65=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xe65b[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xbe65('0x0'));var util=require('util');var moment=require(_0xbe65('0x1'));var BPromise=require(_0xbe65('0x2'));var rs=require(_0xbe65('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbe65('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe65('0x5'));var jayson=require(_0xbe65('0x6'));var client=jayson[_0xbe65('0x7')][_0xbe65('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc3ab9b,_0x520db6,_0x18754f){return new BPromise(function(_0x13a987,_0x15e8b){return client['request'](_0xc3ab9b,_0x18754f)[_0xbe65('0x9')](function(_0x4a3f3c){logger[_0xbe65('0xa')](_0xbe65('0xb'),_0x520db6,_0xbe65('0xc'));logger[_0xbe65('0xd')](_0xbe65('0xe'),_0x520db6,_0xbe65('0xc'),JSON['stringify'](_0x4a3f3c));if(_0x4a3f3c[_0xbe65('0xf')]){if(_0x4a3f3c[_0xbe65('0xf')][_0xbe65('0x10')]===0x1f4){logger['error'](_0xbe65('0xb'),_0x520db6,_0x4a3f3c[_0xbe65('0xf')][_0xbe65('0x11')]);return _0x15e8b(_0x4a3f3c[_0xbe65('0xf')][_0xbe65('0x11')]);}logger[_0xbe65('0xf')](_0xbe65('0xb'),_0x520db6,_0x4a3f3c[_0xbe65('0xf')][_0xbe65('0x11')]);return _0x13a987(_0x4a3f3c[_0xbe65('0xf')]['message']);}else{logger[_0xbe65('0xa')](_0xbe65('0xb'),_0x520db6,_0xbe65('0xc'));_0x13a987(_0x4a3f3c[_0xbe65('0x12')][_0xbe65('0x11')]);}})['catch'](function(_0x2f47b7){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x520db6,_0x2f47b7);_0x15e8b(_0x2f47b7);});});}exports[_0xbe65('0x13')]=function(_0x455930){var _0x39365e=this;return new Promise(function(_0x2a7ac0,_0xc66d02){return db[_0xbe65('0x14')][_0xbe65('0x15')]({'raw':_0x455930['options']?_0x455930[_0xbe65('0x16')][_0xbe65('0x17')]===undefined?!![]:![]:!![],'where':_0x455930[_0xbe65('0x16')]?_0x455930['options'][_0xbe65('0x18')]||null:null,'attributes':_0x455930['options']?_0x455930[_0xbe65('0x16')]['attributes']||null:null,'limit':_0x455930[_0xbe65('0x16')]?_0x455930[_0xbe65('0x16')]['limit']||null:null,'include':_0x455930['options']?_0x455930[_0xbe65('0x16')][_0xbe65('0x19')]?_[_0xbe65('0x1a')](_0x455930[_0xbe65('0x16')][_0xbe65('0x19')],function(_0x137f5d){return{'model':db[_0x137f5d[_0xbe65('0x1b')]],'as':_0x137f5d['as'],'attributes':_0x137f5d[_0xbe65('0x1c')],'include':_0x137f5d[_0xbe65('0x19')]?_[_0xbe65('0x1a')](_0x137f5d[_0xbe65('0x19')],function(_0x425f47){return{'model':db[_0x425f47['model']],'as':_0x425f47['as'],'attributes':_0x425f47[_0xbe65('0x1c')],'include':_0x425f47['include']?_['map'](_0x425f47[_0xbe65('0x19')],function(_0x4ef736){return{'model':db[_0x4ef736['model']],'as':_0x4ef736['as'],'attributes':_0x4ef736[_0xbe65('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbe65('0x9')](function(_0x30dcff){logger[_0xbe65('0xa')](_0xbe65('0x13'),_0x455930);logger[_0xbe65('0xd')]('GetDynamics365Account',_0x455930,JSON['stringify'](_0x30dcff));_0x2a7ac0(_0x30dcff);})[_0xbe65('0x1d')](function(_0x8be515){logger[_0xbe65('0xf')](_0xbe65('0x13'),_0x8be515['message'],_0x455930);_0xc66d02(_0x39365e[_0xbe65('0xf')](0x1f4,_0x8be515[_0xbe65('0x11')]));});});};exports[_0xbe65('0x1e')]=function(_0xae5647){var _0x37e63a=this;return new Promise(function(_0x213421,_0x10d1f2){return db[_0xbe65('0x14')]['find']({'raw':_0xae5647[_0xbe65('0x16')]?_0xae5647[_0xbe65('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xae5647['options']?_0xae5647[_0xbe65('0x16')][_0xbe65('0x18')]||null:null,'attributes':_0xae5647[_0xbe65('0x16')]?_0xae5647['options'][_0xbe65('0x1c')]||null:null,'include':_0xae5647[_0xbe65('0x16')]?_0xae5647[_0xbe65('0x16')][_0xbe65('0x19')]?_[_0xbe65('0x1a')](_0xae5647[_0xbe65('0x16')][_0xbe65('0x19')],function(_0x260ba4){return{'model':db[_0x260ba4[_0xbe65('0x1b')]],'as':_0x260ba4['as'],'attributes':_0x260ba4[_0xbe65('0x1c')],'include':_0x260ba4['include']?_[_0xbe65('0x1a')](_0x260ba4['include'],function(_0x16c302){return{'model':db[_0x16c302[_0xbe65('0x1b')]],'as':_0x16c302['as'],'attributes':_0x16c302[_0xbe65('0x1c')],'include':_0x16c302[_0xbe65('0x19')]?_['map'](_0x16c302['include'],function(_0x303392){return{'model':db[_0x303392[_0xbe65('0x1b')]],'as':_0x303392['as'],'attributes':_0x303392[_0xbe65('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x85c5b5){logger[_0xbe65('0xa')](_0xbe65('0x1e'),_0xae5647);logger['debug'](_0xbe65('0x1e'),_0xae5647,JSON[_0xbe65('0x1f')](_0x85c5b5));_0x213421(_0x85c5b5);})['catch'](function(_0x2c5aff){logger[_0xbe65('0xf')]('ShowDynamics365Account',_0x2c5aff[_0xbe65('0x11')],_0xae5647);_0x10d1f2(_0x37e63a[_0xbe65('0xf')](0x1f4,_0x2c5aff[_0xbe65('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 8c4c5a3..85644aa 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 _0xbbfd=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','path'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xbbfd,0x1df));var _0xdbbf=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xbbfd[_0x45d3f0];return _0x314b79;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdbbf('0x0'));var timeout=require(_0xdbbf('0x1'));var express=require(_0xdbbf('0x2'));var router=express[_0xdbbf('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdbbf('0x4'));var config=require(_0xdbbf('0x5'));var controller=require(_0xdbbf('0x6'));router[_0xdbbf('0x7')]('/',auth[_0xdbbf('0x8')](),controller[_0xdbbf('0x9')]);router[_0xdbbf('0x7')](_0xdbbf('0xa'),auth[_0xdbbf('0x8')](),controller[_0xdbbf('0xb')]);router[_0xdbbf('0x7')](_0xdbbf('0xc'),auth[_0xdbbf('0x8')](),controller[_0xdbbf('0xd')]);router[_0xdbbf('0x7')](_0xdbbf('0xe'),auth[_0xdbbf('0x8')](),controller[_0xdbbf('0xf')]);router['get'](_0xdbbf('0x10'),auth[_0xdbbf('0x8')](),controller[_0xdbbf('0x11')]);router[_0xdbbf('0x12')]('/',auth[_0xdbbf('0x8')](),controller['create']);router[_0xdbbf('0x13')]('/:id',auth[_0xdbbf('0x8')](),controller[_0xdbbf('0x14')]);router[_0xdbbf('0x15')](_0xdbbf('0xa'),auth[_0xdbbf('0x8')](),controller[_0xdbbf('0x16')]);module[_0xdbbf('0x17')]=router; \ No newline at end of file +var _0xd004=['/:id/subjects','getSubjects','getDescriptions','post','put','/:id','update','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','get','show','/:id/fields','isAuthenticated','getFields'];(function(_0xe29c6e,_0x20615c){var _0x22e682=function(_0xa0b66e){while(--_0xa0b66e){_0xe29c6e['push'](_0xe29c6e['shift']());}};_0x22e682(++_0x20615c);}(_0xd004,0x181));var _0x4d00=function(_0x52121e,_0x4e7ac8){_0x52121e=_0x52121e-0x0;var _0x2d7778=_0xd004[_0x52121e];return _0x2d7778;};'use strict';var multer=require(_0x4d00('0x0'));var util=require(_0x4d00('0x1'));var path=require(_0x4d00('0x2'));var timeout=require(_0x4d00('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4d00('0x4'));var auth=require(_0x4d00('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0x4d00('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4d00('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x4d00('0x7')]);router[_0x4d00('0x6')](_0x4d00('0x8'),auth[_0x4d00('0x9')](),controller[_0x4d00('0xa')]);router['get'](_0x4d00('0xb'),auth['isAuthenticated'](),controller[_0x4d00('0xc')]);router[_0x4d00('0x6')]('/:id/descriptions',auth[_0x4d00('0x9')](),controller[_0x4d00('0xd')]);router[_0x4d00('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4d00('0xf')](_0x4d00('0x10'),auth[_0x4d00('0x9')](),controller[_0x4d00('0x11')]);router['delete'](_0x4d00('0x10'),auth[_0x4d00('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 4ee1877..6410487 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 _0x7ba9=['BOOLEAN','exports','STRING','ENUM','phonecall','incident','contact','nothing'];(function(_0x735a49,_0x3da3fd){var _0xee7e9=function(_0x18c9c1){while(--_0x18c9c1){_0x735a49['push'](_0x735a49['shift']());}};_0xee7e9(++_0x3da3fd);}(_0x7ba9,0x169));var _0x97ba=function(_0x5bd4f6,_0xf4e45c){_0x5bd4f6=_0x5bd4f6-0x0;var _0x33a165=_0x7ba9[_0x5bd4f6];return _0x33a165;};'use strict';var Sequelize=require('sequelize');module[_0x97ba('0x0')]={'name':{'type':Sequelize[_0x97ba('0x1')]},'description':{'type':Sequelize[_0x97ba('0x1')]},'ticketType':{'type':Sequelize[_0x97ba('0x2')]('incident',_0x97ba('0x3')),'defaultValue':_0x97ba('0x4')},'moduleCreate':{'type':Sequelize[_0x97ba('0x2')](_0x97ba('0x5'),_0x97ba('0x6')),'defaultValue':_0x97ba('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x97ba('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x97ba('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xadc2=['exports','STRING','phonecall','incident','ENUM','nothing','BOOLEAN','sequelize'];(function(_0x51dbba,_0x817f0d){var _0x34906d=function(_0x192a8b){while(--_0x192a8b){_0x51dbba['push'](_0x51dbba['shift']());}};_0x34906d(++_0x817f0d);}(_0xadc2,0xdf));var _0x2adc=function(_0x1ce2f3,_0x344e68){_0x1ce2f3=_0x1ce2f3-0x0;var _0x2f61e3=_0xadc2[_0x1ce2f3];return _0x2f61e3;};'use strict';var Sequelize=require(_0x2adc('0x0'));module[_0x2adc('0x1')]={'name':{'type':Sequelize[_0x2adc('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM']('incident',_0x2adc('0x3')),'defaultValue':_0x2adc('0x4')},'moduleCreate':{'type':Sequelize[_0x2adc('0x5')]('contact',_0x2adc('0x6')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x2adc('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x2adc('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 07e9e47..df92935 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 _0x360f=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','nolimit','order','pick','where','merge','VIRTUAL','filter','options','Dynamics365Configuration','includeAll','include','findAll','rows','show','params','find','catch','create','body','getFields','findOne','Dynamics365Field','sort','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce'];(function(_0x109d94,_0x34399e){var _0x30c67f=function(_0x2e1f19){while(--_0x2e1f19){_0x109d94['push'](_0x109d94['shift']());}};_0x30c67f(++_0x34399e);}(_0x360f,0x9c));var _0xf360=function(_0x3a538b,_0x240afc){_0x3a538b=_0x3a538b-0x0;var _0x5eb358=_0x360f[_0x3a538b];return _0x5eb358;};'use strict';var emlformat=require(_0xf360('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf360('0x1'));var jsonpatch=require(_0xf360('0x2'));var rp=require('request-promise');var moment=require(_0xf360('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf360('0x4'));var util=require(_0xf360('0x5'));var path=require('path');var sox=require(_0xf360('0x6'));var csv=require(_0xf360('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf360('0x8'));var squel=require(_0xf360('0x9'));var crypto=require(_0xf360('0xa'));var jsforce=require(_0xf360('0xb'));var deskjs=require(_0xf360('0xc'));var toCsv=require(_0xf360('0x7'));var querystring=require(_0xf360('0xd'));var Papa=require('papaparse');var Redis=require(_0xf360('0xe'));var authService=require(_0xf360('0xf'));var qs=require(_0xf360('0x10'));var as=require(_0xf360('0x11'));var hardwareService=require(_0xf360('0x12'));var logger=require(_0xf360('0x13'))(_0xf360('0x14'));var utils=require(_0xf360('0x15'));var config=require(_0xf360('0x16'));var licenseUtil=require(_0xf360('0x17'));var db=require(_0xf360('0x18'))['db'];function respondWithStatusCode(_0x21e6a9,_0x3ea84d){_0x3ea84d=_0x3ea84d||0xcc;return function(_0x9e17ea){if(_0x9e17ea){return _0x21e6a9[_0xf360('0x19')](_0x3ea84d);}return _0x21e6a9[_0xf360('0x1a')](_0x3ea84d)[_0xf360('0x1b')]();};}function respondWithResult(_0x2ee506,_0x28e9c5){_0x28e9c5=_0x28e9c5||0xc8;return function(_0x351bb4){if(_0x351bb4){return _0x2ee506[_0xf360('0x1a')](_0x28e9c5)[_0xf360('0x1c')](_0x351bb4);}};}function respondWithFilteredResult(_0xf99797,_0x4049da){return function(_0x32acec){if(_0x32acec){var _0x541c6c=typeof _0x4049da[_0xf360('0x1d')]===_0xf360('0x1e')&&typeof _0x4049da[_0xf360('0x1f')]===_0xf360('0x1e');var _0x19a53d=_0x32acec[_0xf360('0x20')];var _0x412ae9=_0x541c6c?0x0:_0x4049da['offset'];var _0x3b53e6=_0x541c6c?_0x32acec[_0xf360('0x20')]:_0x4049da[_0xf360('0x1d')]+_0x4049da[_0xf360('0x1f')];var _0x3bfecf;if(_0x3b53e6>=_0x19a53d){_0x3b53e6=_0x19a53d;_0x3bfecf=0xc8;}else{_0x3bfecf=0xce;}_0xf99797[_0xf360('0x1a')](_0x3bfecf);return _0xf99797[_0xf360('0x21')](_0xf360('0x22'),_0x412ae9+'-'+_0x3b53e6+'/'+_0x19a53d)[_0xf360('0x1c')](_0x32acec);}return null;};}function patchUpdates(_0x6c2071){return function(_0x29c253){try{jsonpatch['apply'](_0x29c253,_0x6c2071,!![]);}catch(_0x2824f7){return BPromise[_0xf360('0x23')](_0x2824f7);}return _0x29c253[_0xf360('0x24')]();};}function saveUpdates(_0x32f4ee,_0x44d17c){return function(_0x38215b){if(_0x38215b){return _0x38215b[_0xf360('0x25')](_0x32f4ee)[_0xf360('0x26')](function(_0x131bd2){return _0x131bd2;});}return null;};}function removeEntity(_0x3b298e,_0x55c97a){return function(_0x4a90c4){if(_0x4a90c4){return _0x4a90c4[_0xf360('0x27')]()[_0xf360('0x26')](function(){_0x3b298e[_0xf360('0x1a')](0xcc)[_0xf360('0x1b')]();});}};}function handleEntityNotFound(_0x14f17d,_0x434546){return function(_0x7c4173){if(!_0x7c4173){_0x14f17d[_0xf360('0x19')](0x194);}return _0x7c4173;};}function handleError(_0x2e4d19,_0x475614){_0x475614=_0x475614||0x1f4;return function(_0x18ff11){logger[_0xf360('0x28')](_0x18ff11[_0xf360('0x29')]);if(_0x18ff11['name']){delete _0x18ff11[_0xf360('0x2a')];}_0x2e4d19[_0xf360('0x1a')](_0x475614)[_0xf360('0x2b')](_0x18ff11);};}exports[_0xf360('0x2c')]=function(_0x39e944,_0x418049){var _0x558c1d={},_0x23f6eb={},_0x12c255={'count':0x0,'rows':[]};var _0x47f2e3=_[_0xf360('0x2d')](db['Dynamics365Configuration'][_0xf360('0x2e')],function(_0x2d6b8b){return{'name':_0x2d6b8b[_0xf360('0x2f')],'type':_0x2d6b8b[_0xf360('0x30')][_0xf360('0x31')]};});_0x23f6eb[_0xf360('0x32')]=_[_0xf360('0x2d')](_0x47f2e3,_0xf360('0x2a'));_0x23f6eb['query']=_[_0xf360('0x33')](_0x39e944['query']);_0x23f6eb[_0xf360('0x34')]=_['intersection'](_0x23f6eb[_0xf360('0x32')],_0x23f6eb[_0xf360('0x35')]);_0x558c1d[_0xf360('0x36')]=_[_0xf360('0x37')](_0x23f6eb[_0xf360('0x32')],qs['fields'](_0x39e944[_0xf360('0x35')][_0xf360('0x38')]));_0x558c1d[_0xf360('0x36')]=_0x558c1d['attributes'][_0xf360('0x39')]?_0x558c1d[_0xf360('0x36')]:_0x23f6eb[_0xf360('0x32')];if(!_0x39e944[_0xf360('0x35')]['hasOwnProperty'](_0xf360('0x3a'))){_0x558c1d[_0xf360('0x1f')]=qs['limit'](_0x39e944['query']['limit']);_0x558c1d[_0xf360('0x1d')]=qs['offset'](_0x39e944['query'][_0xf360('0x1d')]);}_0x558c1d[_0xf360('0x3b')]=qs['sort'](_0x39e944['query']['sort']);_0x558c1d['where']=qs[_0xf360('0x34')](_[_0xf360('0x3c')](_0x39e944['query'],_0x23f6eb[_0xf360('0x34')]),_0x47f2e3);if(_0x39e944[_0xf360('0x35')]['filter']){_0x558c1d[_0xf360('0x3d')]=_[_0xf360('0x3e')](_0x558c1d[_0xf360('0x3d')],{'$or':_[_0xf360('0x2d')](_0x47f2e3,function(_0x314d7e){if(_0x314d7e['type']!==_0xf360('0x3f')){var _0x477317={};_0x477317[_0x314d7e['name']]={'$like':'%'+_0x39e944[_0xf360('0x35')][_0xf360('0x40')]+'%'};return _0x477317;}})});}_0x558c1d=_['merge']({},_0x558c1d,_0x39e944[_0xf360('0x41')]);var _0xd72cc5={'where':_0x558c1d[_0xf360('0x3d')]};return db[_0xf360('0x42')]['count'](_0xd72cc5)['then'](function(_0x543d95){_0x12c255[_0xf360('0x20')]=_0x543d95;if(_0x39e944['query'][_0xf360('0x43')]){_0x558c1d[_0xf360('0x44')]=[{'all':!![]}];}return db[_0xf360('0x42')][_0xf360('0x45')](_0x558c1d);})[_0xf360('0x26')](function(_0x263e58){_0x12c255[_0xf360('0x46')]=_0x263e58;return _0x12c255;})[_0xf360('0x26')](respondWithFilteredResult(_0x418049,_0x558c1d))['catch'](handleError(_0x418049,null));};exports[_0xf360('0x47')]=function(_0x19616c,_0x581d4a){var _0x494eb2={'raw':![],'where':{'id':_0x19616c[_0xf360('0x48')]['id']}},_0x16ea5e={};_0x16ea5e[_0xf360('0x32')]=_['keys'](db[_0xf360('0x42')][_0xf360('0x2e')]);_0x16ea5e['query']=_[_0xf360('0x33')](_0x19616c[_0xf360('0x35')]);_0x16ea5e[_0xf360('0x34')]=_[_0xf360('0x37')](_0x16ea5e[_0xf360('0x32')],_0x16ea5e['query']);_0x494eb2[_0xf360('0x36')]=_[_0xf360('0x37')](_0x16ea5e[_0xf360('0x32')],qs[_0xf360('0x38')](_0x19616c[_0xf360('0x35')][_0xf360('0x38')]));_0x494eb2[_0xf360('0x36')]=_0x494eb2['attributes']['length']?_0x494eb2[_0xf360('0x36')]:_0x16ea5e[_0xf360('0x32')];if(_0x19616c[_0xf360('0x35')][_0xf360('0x43')]){_0x494eb2[_0xf360('0x44')]=[{'all':!![]}];}_0x494eb2=_[_0xf360('0x3e')]({},_0x494eb2,_0x19616c[_0xf360('0x41')]);return db[_0xf360('0x42')][_0xf360('0x49')](_0x494eb2)[_0xf360('0x26')](handleEntityNotFound(_0x581d4a,null))['then'](respondWithResult(_0x581d4a,null))[_0xf360('0x4a')](handleError(_0x581d4a,null));};exports[_0xf360('0x4b')]=function(_0x109886,_0x3c777d){return db[_0xf360('0x42')]['create'](_0x109886['body'],{})[_0xf360('0x26')](respondWithResult(_0x3c777d,0xc9))[_0xf360('0x4a')](handleError(_0x3c777d,null));};exports[_0xf360('0x25')]=function(_0x485dd2,_0x3439f6){if(_0x485dd2[_0xf360('0x4c')]['id']){delete _0x485dd2[_0xf360('0x4c')]['id'];}return db[_0xf360('0x42')][_0xf360('0x49')]({'where':{'id':_0x485dd2['params']['id']}})[_0xf360('0x26')](handleEntityNotFound(_0x3439f6,null))[_0xf360('0x26')](saveUpdates(_0x485dd2[_0xf360('0x4c')],null))[_0xf360('0x26')](respondWithResult(_0x3439f6,null))[_0xf360('0x4a')](handleError(_0x3439f6,null));};exports[_0xf360('0x27')]=function(_0x21b367,_0x422474){return db[_0xf360('0x42')][_0xf360('0x49')]({'where':{'id':_0x21b367[_0xf360('0x48')]['id']}})[_0xf360('0x26')](handleEntityNotFound(_0x422474,null))[_0xf360('0x26')](removeEntity(_0x422474,null))[_0xf360('0x4a')](handleError(_0x422474,null));};exports[_0xf360('0x4d')]=function(_0x17d8c1,_0x14fa1d,_0x56e615){var _0x2abd23={};var _0x529cb8={};var _0xb53b68;var _0x1c42d3;return db[_0xf360('0x42')][_0xf360('0x4e')]({'where':{'id':_0x17d8c1['params']['id']}})[_0xf360('0x26')](handleEntityNotFound(_0x14fa1d,null))['then'](function(_0x52a0c0){if(_0x52a0c0){_0xb53b68=_0x52a0c0;_0x529cb8[_0xf360('0x32')]=_[_0xf360('0x33')](db[_0xf360('0x4f')][_0xf360('0x2e')]);_0x529cb8[_0xf360('0x35')]=_[_0xf360('0x33')](_0x17d8c1[_0xf360('0x35')]);_0x529cb8[_0xf360('0x34')]=_[_0xf360('0x37')](_0x529cb8[_0xf360('0x32')],_0x529cb8[_0xf360('0x35')]);_0x2abd23[_0xf360('0x36')]=_[_0xf360('0x37')](_0x529cb8['model'],qs[_0xf360('0x38')](_0x17d8c1[_0xf360('0x35')][_0xf360('0x38')]));_0x2abd23[_0xf360('0x36')]=_0x2abd23[_0xf360('0x36')][_0xf360('0x39')]?_0x2abd23['attributes']:_0x529cb8[_0xf360('0x32')];_0x2abd23[_0xf360('0x3b')]=qs[_0xf360('0x50')](_0x17d8c1['query']['sort']);_0x2abd23['where']=qs[_0xf360('0x34')](_[_0xf360('0x3c')](_0x17d8c1[_0xf360('0x35')],_0x529cb8[_0xf360('0x34')]));if(_0x17d8c1[_0xf360('0x35')][_0xf360('0x40')]){_0x2abd23[_0xf360('0x3d')]=_[_0xf360('0x3e')](_0x2abd23[_0xf360('0x3d')],{'$or':_['map'](_0x2abd23[_0xf360('0x36')],function(_0x55d740){var _0x1b9229={};_0x1b9229[_0x55d740]={'$like':'%'+_0x17d8c1[_0xf360('0x35')][_0xf360('0x40')]+'%'};return _0x1b9229;})});}_0x2abd23=_['merge']({},_0x2abd23,_0x17d8c1[_0xf360('0x41')]);return _0xb53b68[_0xf360('0x4d')](_0x2abd23);}})['then'](function(_0x598c38){if(_0x598c38){_0x1c42d3=_0x598c38[_0xf360('0x39')];if(!_0x17d8c1[_0xf360('0x35')][_0xf360('0x51')](_0xf360('0x3a'))){_0x2abd23[_0xf360('0x1f')]=qs[_0xf360('0x1f')](_0x17d8c1[_0xf360('0x35')][_0xf360('0x1f')]);_0x2abd23[_0xf360('0x1d')]=qs[_0xf360('0x1d')](_0x17d8c1[_0xf360('0x35')][_0xf360('0x1d')]);}return _0xb53b68[_0xf360('0x4d')](_0x2abd23);}})['then'](function(_0x56caed){if(_0x56caed){return _0x56caed?{'count':_0x1c42d3,'rows':_0x56caed}:null;}})[_0xf360('0x26')](respondWithResult(_0x14fa1d,null))[_0xf360('0x4a')](handleError(_0x14fa1d,null));};exports['getSubjects']=function(_0x5bf633,_0x1ef3b7,_0x48d6dd){var _0x54d75d={};var _0x13994d={};var _0x362d99;var _0x359d4f;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x5bf633[_0xf360('0x48')]['id']}})[_0xf360('0x26')](handleEntityNotFound(_0x1ef3b7,null))['then'](function(_0x54c090){if(_0x54c090){_0x362d99=_0x54c090;_0x13994d[_0xf360('0x32')]=_[_0xf360('0x33')](db[_0xf360('0x4f')][_0xf360('0x2e')]);_0x13994d['query']=_['keys'](_0x5bf633[_0xf360('0x35')]);_0x13994d[_0xf360('0x34')]=_['intersection'](_0x13994d[_0xf360('0x32')],_0x13994d[_0xf360('0x35')]);_0x54d75d[_0xf360('0x36')]=_[_0xf360('0x37')](_0x13994d[_0xf360('0x32')],qs['fields'](_0x5bf633[_0xf360('0x35')][_0xf360('0x38')]));_0x54d75d[_0xf360('0x36')]=_0x54d75d['attributes'][_0xf360('0x39')]?_0x54d75d[_0xf360('0x36')]:_0x13994d['model'];_0x54d75d[_0xf360('0x3b')]=qs[_0xf360('0x50')](_0x5bf633[_0xf360('0x35')][_0xf360('0x50')]);_0x54d75d[_0xf360('0x3d')]=qs['filters'](_[_0xf360('0x3c')](_0x5bf633['query'],_0x13994d[_0xf360('0x34')]));if(_0x5bf633[_0xf360('0x35')][_0xf360('0x40')]){_0x54d75d[_0xf360('0x3d')]=_[_0xf360('0x3e')](_0x54d75d[_0xf360('0x3d')],{'$or':_['map'](_0x54d75d[_0xf360('0x36')],function(_0x3a1c6a){var _0x2c8d37={};_0x2c8d37[_0x3a1c6a]={'$like':'%'+_0x5bf633[_0xf360('0x35')]['filter']+'%'};return _0x2c8d37;})});}_0x54d75d=_[_0xf360('0x3e')]({},_0x54d75d,_0x5bf633['options']);return _0x362d99[_0xf360('0x52')](_0x54d75d);}})[_0xf360('0x26')](function(_0x3fdfa0){if(_0x3fdfa0){_0x359d4f=_0x3fdfa0[_0xf360('0x39')];if(!_0x5bf633[_0xf360('0x35')][_0xf360('0x51')](_0xf360('0x3a'))){_0x54d75d[_0xf360('0x1f')]=qs[_0xf360('0x1f')](_0x5bf633[_0xf360('0x35')][_0xf360('0x1f')]);_0x54d75d[_0xf360('0x1d')]=qs[_0xf360('0x1d')](_0x5bf633[_0xf360('0x35')][_0xf360('0x1d')]);}return _0x362d99['getSubjects'](_0x54d75d);}})['then'](function(_0x37131e){if(_0x37131e){return _0x37131e?{'count':_0x359d4f,'rows':_0x37131e}:null;}})[_0xf360('0x26')](respondWithResult(_0x1ef3b7,null))[_0xf360('0x4a')](handleError(_0x1ef3b7,null));};exports[_0xf360('0x53')]=function(_0x57c5e1,_0x33d23c,_0x30454c){var _0x22b8b7={};var _0x1ca804={};var _0x41e7a9;var _0x3fbeb2;return db[_0xf360('0x42')][_0xf360('0x4e')]({'where':{'id':_0x57c5e1[_0xf360('0x48')]['id']}})[_0xf360('0x26')](handleEntityNotFound(_0x33d23c,null))['then'](function(_0x350feb){if(_0x350feb){_0x41e7a9=_0x350feb;_0x1ca804[_0xf360('0x32')]=_[_0xf360('0x33')](db[_0xf360('0x4f')]['rawAttributes']);_0x1ca804[_0xf360('0x35')]=_[_0xf360('0x33')](_0x57c5e1[_0xf360('0x35')]);_0x1ca804['filters']=_['intersection'](_0x1ca804[_0xf360('0x32')],_0x1ca804['query']);_0x22b8b7[_0xf360('0x36')]=_['intersection'](_0x1ca804['model'],qs[_0xf360('0x38')](_0x57c5e1['query'][_0xf360('0x38')]));_0x22b8b7[_0xf360('0x36')]=_0x22b8b7[_0xf360('0x36')][_0xf360('0x39')]?_0x22b8b7['attributes']:_0x1ca804[_0xf360('0x32')];_0x22b8b7['order']=qs[_0xf360('0x50')](_0x57c5e1[_0xf360('0x35')][_0xf360('0x50')]);_0x22b8b7[_0xf360('0x3d')]=qs[_0xf360('0x34')](_[_0xf360('0x3c')](_0x57c5e1[_0xf360('0x35')],_0x1ca804['filters']));if(_0x57c5e1[_0xf360('0x35')]['filter']){_0x22b8b7[_0xf360('0x3d')]=_[_0xf360('0x3e')](_0x22b8b7[_0xf360('0x3d')],{'$or':_[_0xf360('0x2d')](_0x22b8b7[_0xf360('0x36')],function(_0x192605){var _0x21360a={};_0x21360a[_0x192605]={'$like':'%'+_0x57c5e1[_0xf360('0x35')][_0xf360('0x40')]+'%'};return _0x21360a;})});}_0x22b8b7=_[_0xf360('0x3e')]({},_0x22b8b7,_0x57c5e1['options']);return _0x41e7a9[_0xf360('0x53')](_0x22b8b7);}})[_0xf360('0x26')](function(_0x19e5fe){if(_0x19e5fe){_0x3fbeb2=_0x19e5fe[_0xf360('0x39')];if(!_0x57c5e1[_0xf360('0x35')][_0xf360('0x51')](_0xf360('0x3a'))){_0x22b8b7[_0xf360('0x1f')]=qs['limit'](_0x57c5e1['query']['limit']);_0x22b8b7[_0xf360('0x1d')]=qs['offset'](_0x57c5e1[_0xf360('0x35')][_0xf360('0x1d')]);}return _0x41e7a9[_0xf360('0x53')](_0x22b8b7);}})[_0xf360('0x26')](function(_0x4a02a4){if(_0x4a02a4){return _0x4a02a4?{'count':_0x3fbeb2,'rows':_0x4a02a4}:null;}})['then'](respondWithResult(_0x33d23c,null))[_0xf360('0x4a')](handleError(_0x33d23c,null));}; \ No newline at end of file +var _0xc05e=['reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','Dynamics365Configuration','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','create','body','find','findOne','length','getFields','getSubjects','Dynamics365Field','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x3ddb3e,_0x1a49f9){var _0x4ad13d=function(_0x328c59){while(--_0x328c59){_0x3ddb3e['push'](_0x3ddb3e['shift']());}};_0x4ad13d(++_0x1a49f9);}(_0xc05e,0xc9));var _0xec05=function(_0x42db77,_0xe8340f){_0x42db77=_0x42db77-0x0;var _0x30d8b8=_0xc05e[_0x42db77];return _0x30d8b8;};'use strict';var emlformat=require(_0xec05('0x0'));var rimraf=require(_0xec05('0x1'));var zipdir=require(_0xec05('0x2'));var jsonpatch=require(_0xec05('0x3'));var rp=require(_0xec05('0x4'));var moment=require(_0xec05('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xec05('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec05('0x7'));var _=require('lodash');var squel=require(_0xec05('0x8'));var crypto=require(_0xec05('0x9'));var jsforce=require(_0xec05('0xa'));var deskjs=require(_0xec05('0xb'));var toCsv=require(_0xec05('0xc'));var querystring=require(_0xec05('0xd'));var Papa=require(_0xec05('0xe'));var Redis=require(_0xec05('0xf'));var authService=require(_0xec05('0x10'));var qs=require(_0xec05('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec05('0x12'));var logger=require(_0xec05('0x13'))('api');var utils=require(_0xec05('0x14'));var config=require(_0xec05('0x15'));var licenseUtil=require(_0xec05('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x514f79,_0x8dae2b){_0x8dae2b=_0x8dae2b||0xcc;return function(_0x1099be){if(_0x1099be){return _0x514f79['sendStatus'](_0x8dae2b);}return _0x514f79['status'](_0x8dae2b)[_0xec05('0x17')]();};}function respondWithResult(_0x5c8691,_0x196e11){_0x196e11=_0x196e11||0xc8;return function(_0x5e149e){if(_0x5e149e){return _0x5c8691[_0xec05('0x18')](_0x196e11)[_0xec05('0x19')](_0x5e149e);}};}function respondWithFilteredResult(_0x24b7fa,_0x841f9a){return function(_0x14ec99){if(_0x14ec99){var _0x784777=typeof _0x841f9a[_0xec05('0x1a')]===_0xec05('0x1b')&&typeof _0x841f9a[_0xec05('0x1c')]==='undefined';var _0xfeec6=_0x14ec99['count'];var _0x53abae=_0x784777?0x0:_0x841f9a[_0xec05('0x1a')];var _0x4291bf=_0x784777?_0x14ec99[_0xec05('0x1d')]:_0x841f9a[_0xec05('0x1a')]+_0x841f9a['limit'];var _0x4b264e;if(_0x4291bf>=_0xfeec6){_0x4291bf=_0xfeec6;_0x4b264e=0xc8;}else{_0x4b264e=0xce;}_0x24b7fa[_0xec05('0x18')](_0x4b264e);return _0x24b7fa[_0xec05('0x1e')](_0xec05('0x1f'),_0x53abae+'-'+_0x4291bf+'/'+_0xfeec6)['json'](_0x14ec99);}return null;};}function patchUpdates(_0x2a7613){return function(_0x1f11e1){try{jsonpatch[_0xec05('0x20')](_0x1f11e1,_0x2a7613,!![]);}catch(_0x2ce0df){return BPromise[_0xec05('0x21')](_0x2ce0df);}return _0x1f11e1[_0xec05('0x22')]();};}function saveUpdates(_0x214d26,_0x40dc2b){return function(_0x51cbc1){if(_0x51cbc1){return _0x51cbc1[_0xec05('0x23')](_0x214d26)[_0xec05('0x24')](function(_0x55e222){return _0x55e222;});}return null;};}function removeEntity(_0x3caac1,_0x1afd2c){return function(_0xfd1b4){if(_0xfd1b4){return _0xfd1b4[_0xec05('0x25')]()[_0xec05('0x24')](function(){_0x3caac1['status'](0xcc)[_0xec05('0x17')]();});}};}function handleEntityNotFound(_0x37b5f9,_0xd6d8a4){return function(_0x279ee5){if(!_0x279ee5){_0x37b5f9[_0xec05('0x26')](0x194);}return _0x279ee5;};}function handleError(_0x4d4568,_0x5256a9){_0x5256a9=_0x5256a9||0x1f4;return function(_0x385d36){logger[_0xec05('0x27')](_0x385d36[_0xec05('0x28')]);if(_0x385d36['name']){delete _0x385d36[_0xec05('0x29')];}_0x4d4568['status'](_0x5256a9)[_0xec05('0x2a')](_0x385d36);};}exports['index']=function(_0x181911,_0x2e8830){var _0x4a13e5={},_0xf434ee={},_0x322dc2={'count':0x0,'rows':[]};var _0x437008=_[_0xec05('0x2b')](db[_0xec05('0x2c')]['rawAttributes'],function(_0x1cc277){return{'name':_0x1cc277['fieldName'],'type':_0x1cc277[_0xec05('0x2d')]['key']};});_0xf434ee[_0xec05('0x2e')]=_['map'](_0x437008,_0xec05('0x29'));_0xf434ee[_0xec05('0x2f')]=_['keys'](_0x181911[_0xec05('0x2f')]);_0xf434ee[_0xec05('0x30')]=_[_0xec05('0x31')](_0xf434ee['model'],_0xf434ee[_0xec05('0x2f')]);_0x4a13e5[_0xec05('0x32')]=_[_0xec05('0x31')](_0xf434ee[_0xec05('0x2e')],qs[_0xec05('0x33')](_0x181911[_0xec05('0x2f')][_0xec05('0x33')]));_0x4a13e5[_0xec05('0x32')]=_0x4a13e5[_0xec05('0x32')]['length']?_0x4a13e5[_0xec05('0x32')]:_0xf434ee[_0xec05('0x2e')];if(!_0x181911[_0xec05('0x2f')][_0xec05('0x34')](_0xec05('0x35'))){_0x4a13e5[_0xec05('0x1c')]=qs[_0xec05('0x1c')](_0x181911[_0xec05('0x2f')][_0xec05('0x1c')]);_0x4a13e5[_0xec05('0x1a')]=qs[_0xec05('0x1a')](_0x181911[_0xec05('0x2f')][_0xec05('0x1a')]);}_0x4a13e5[_0xec05('0x36')]=qs['sort'](_0x181911[_0xec05('0x2f')][_0xec05('0x37')]);_0x4a13e5['where']=qs[_0xec05('0x30')](_[_0xec05('0x38')](_0x181911[_0xec05('0x2f')],_0xf434ee[_0xec05('0x30')]),_0x437008);if(_0x181911[_0xec05('0x2f')]['filter']){_0x4a13e5[_0xec05('0x39')]=_[_0xec05('0x3a')](_0x4a13e5[_0xec05('0x39')],{'$or':_[_0xec05('0x2b')](_0x437008,function(_0x54fe4b){if(_0x54fe4b[_0xec05('0x2d')]!==_0xec05('0x3b')){var _0x5e72dd={};_0x5e72dd[_0x54fe4b['name']]={'$like':'%'+_0x181911[_0xec05('0x2f')][_0xec05('0x3c')]+'%'};return _0x5e72dd;}})});}_0x4a13e5=_[_0xec05('0x3a')]({},_0x4a13e5,_0x181911[_0xec05('0x3d')]);var _0x3d4628={'where':_0x4a13e5['where']};return db[_0xec05('0x2c')][_0xec05('0x1d')](_0x3d4628)[_0xec05('0x24')](function(_0x1eb3e6){_0x322dc2[_0xec05('0x1d')]=_0x1eb3e6;if(_0x181911[_0xec05('0x2f')][_0xec05('0x3e')]){_0x4a13e5['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xec05('0x3f')](_0x4a13e5);})[_0xec05('0x24')](function(_0x5f1315){_0x322dc2[_0xec05('0x40')]=_0x5f1315;return _0x322dc2;})[_0xec05('0x24')](respondWithFilteredResult(_0x2e8830,_0x4a13e5))[_0xec05('0x41')](handleError(_0x2e8830,null));};exports['show']=function(_0x3a507e,_0x4e979b){var _0x1e2dcc={'raw':![],'where':{'id':_0x3a507e[_0xec05('0x42')]['id']}},_0x50ce83={};_0x50ce83[_0xec05('0x2e')]=_[_0xec05('0x43')](db[_0xec05('0x2c')][_0xec05('0x44')]);_0x50ce83[_0xec05('0x2f')]=_['keys'](_0x3a507e[_0xec05('0x2f')]);_0x50ce83['filters']=_[_0xec05('0x31')](_0x50ce83[_0xec05('0x2e')],_0x50ce83[_0xec05('0x2f')]);_0x1e2dcc[_0xec05('0x32')]=_[_0xec05('0x31')](_0x50ce83[_0xec05('0x2e')],qs['fields'](_0x3a507e[_0xec05('0x2f')][_0xec05('0x33')]));_0x1e2dcc['attributes']=_0x1e2dcc[_0xec05('0x32')]['length']?_0x1e2dcc[_0xec05('0x32')]:_0x50ce83[_0xec05('0x2e')];if(_0x3a507e['query']['includeAll']){_0x1e2dcc['include']=[{'all':!![]}];}_0x1e2dcc=_[_0xec05('0x3a')]({},_0x1e2dcc,_0x3a507e['options']);return db[_0xec05('0x2c')]['find'](_0x1e2dcc)['then'](handleEntityNotFound(_0x4e979b,null))[_0xec05('0x24')](respondWithResult(_0x4e979b,null))[_0xec05('0x41')](handleError(_0x4e979b,null));};exports[_0xec05('0x45')]=function(_0x9ed632,_0x293de5){return db[_0xec05('0x2c')]['create'](_0x9ed632[_0xec05('0x46')],{})[_0xec05('0x24')](respondWithResult(_0x293de5,0xc9))['catch'](handleError(_0x293de5,null));};exports['update']=function(_0x1ef244,_0x33e6d7){if(_0x1ef244[_0xec05('0x46')]['id']){delete _0x1ef244[_0xec05('0x46')]['id'];}return db[_0xec05('0x2c')]['find']({'where':{'id':_0x1ef244[_0xec05('0x42')]['id']}})[_0xec05('0x24')](handleEntityNotFound(_0x33e6d7,null))[_0xec05('0x24')](saveUpdates(_0x1ef244[_0xec05('0x46')],null))[_0xec05('0x24')](respondWithResult(_0x33e6d7,null))[_0xec05('0x41')](handleError(_0x33e6d7,null));};exports[_0xec05('0x25')]=function(_0x49b997,_0x2a0fa0){return db['Dynamics365Configuration'][_0xec05('0x47')]({'where':{'id':_0x49b997[_0xec05('0x42')]['id']}})[_0xec05('0x24')](handleEntityNotFound(_0x2a0fa0,null))[_0xec05('0x24')](removeEntity(_0x2a0fa0,null))[_0xec05('0x41')](handleError(_0x2a0fa0,null));};exports['getFields']=function(_0x34b2b6,_0x41178b,_0x5784bb){var _0x57e123={};var _0x480675={};var _0x28283a;var _0x43b20d;return db['Dynamics365Configuration'][_0xec05('0x48')]({'where':{'id':_0x34b2b6[_0xec05('0x42')]['id']}})[_0xec05('0x24')](handleEntityNotFound(_0x41178b,null))[_0xec05('0x24')](function(_0x10ec8a){if(_0x10ec8a){_0x28283a=_0x10ec8a;_0x480675[_0xec05('0x2e')]=_[_0xec05('0x43')](db['Dynamics365Field'][_0xec05('0x44')]);_0x480675[_0xec05('0x2f')]=_[_0xec05('0x43')](_0x34b2b6[_0xec05('0x2f')]);_0x480675[_0xec05('0x30')]=_[_0xec05('0x31')](_0x480675[_0xec05('0x2e')],_0x480675[_0xec05('0x2f')]);_0x57e123[_0xec05('0x32')]=_[_0xec05('0x31')](_0x480675[_0xec05('0x2e')],qs[_0xec05('0x33')](_0x34b2b6[_0xec05('0x2f')][_0xec05('0x33')]));_0x57e123['attributes']=_0x57e123['attributes'][_0xec05('0x49')]?_0x57e123[_0xec05('0x32')]:_0x480675[_0xec05('0x2e')];_0x57e123[_0xec05('0x36')]=qs[_0xec05('0x37')](_0x34b2b6[_0xec05('0x2f')][_0xec05('0x37')]);_0x57e123[_0xec05('0x39')]=qs[_0xec05('0x30')](_[_0xec05('0x38')](_0x34b2b6['query'],_0x480675[_0xec05('0x30')]));if(_0x34b2b6[_0xec05('0x2f')][_0xec05('0x3c')]){_0x57e123['where']=_[_0xec05('0x3a')](_0x57e123[_0xec05('0x39')],{'$or':_['map'](_0x57e123[_0xec05('0x32')],function(_0x17ca72){var _0x207748={};_0x207748[_0x17ca72]={'$like':'%'+_0x34b2b6[_0xec05('0x2f')][_0xec05('0x3c')]+'%'};return _0x207748;})});}_0x57e123=_['merge']({},_0x57e123,_0x34b2b6[_0xec05('0x3d')]);return _0x28283a['getFields'](_0x57e123);}})[_0xec05('0x24')](function(_0x2e28e9){if(_0x2e28e9){_0x43b20d=_0x2e28e9[_0xec05('0x49')];if(!_0x34b2b6['query'][_0xec05('0x34')](_0xec05('0x35'))){_0x57e123[_0xec05('0x1c')]=qs[_0xec05('0x1c')](_0x34b2b6['query'][_0xec05('0x1c')]);_0x57e123['offset']=qs[_0xec05('0x1a')](_0x34b2b6[_0xec05('0x2f')]['offset']);}return _0x28283a[_0xec05('0x4a')](_0x57e123);}})[_0xec05('0x24')](function(_0x3c2521){if(_0x3c2521){return _0x3c2521?{'count':_0x43b20d,'rows':_0x3c2521}:null;}})['then'](respondWithResult(_0x41178b,null))[_0xec05('0x41')](handleError(_0x41178b,null));};exports[_0xec05('0x4b')]=function(_0x2adbfc,_0x3cc69b,_0x81307c){var _0x3d125c={};var _0x220742={};var _0x2ea2b0;var _0x1b867f;return db[_0xec05('0x2c')][_0xec05('0x48')]({'where':{'id':_0x2adbfc[_0xec05('0x42')]['id']}})[_0xec05('0x24')](handleEntityNotFound(_0x3cc69b,null))[_0xec05('0x24')](function(_0x82da96){if(_0x82da96){_0x2ea2b0=_0x82da96;_0x220742['model']=_[_0xec05('0x43')](db[_0xec05('0x4c')][_0xec05('0x44')]);_0x220742['query']=_[_0xec05('0x43')](_0x2adbfc[_0xec05('0x2f')]);_0x220742[_0xec05('0x30')]=_[_0xec05('0x31')](_0x220742['model'],_0x220742[_0xec05('0x2f')]);_0x3d125c[_0xec05('0x32')]=_[_0xec05('0x31')](_0x220742['model'],qs[_0xec05('0x33')](_0x2adbfc['query'][_0xec05('0x33')]));_0x3d125c[_0xec05('0x32')]=_0x3d125c['attributes'][_0xec05('0x49')]?_0x3d125c[_0xec05('0x32')]:_0x220742[_0xec05('0x2e')];_0x3d125c[_0xec05('0x36')]=qs[_0xec05('0x37')](_0x2adbfc[_0xec05('0x2f')]['sort']);_0x3d125c[_0xec05('0x39')]=qs['filters'](_[_0xec05('0x38')](_0x2adbfc[_0xec05('0x2f')],_0x220742['filters']));if(_0x2adbfc[_0xec05('0x2f')][_0xec05('0x3c')]){_0x3d125c[_0xec05('0x39')]=_['merge'](_0x3d125c[_0xec05('0x39')],{'$or':_[_0xec05('0x2b')](_0x3d125c[_0xec05('0x32')],function(_0x1c14a3){var _0x2fb422={};_0x2fb422[_0x1c14a3]={'$like':'%'+_0x2adbfc[_0xec05('0x2f')][_0xec05('0x3c')]+'%'};return _0x2fb422;})});}_0x3d125c=_[_0xec05('0x3a')]({},_0x3d125c,_0x2adbfc['options']);return _0x2ea2b0[_0xec05('0x4b')](_0x3d125c);}})[_0xec05('0x24')](function(_0x1f5eaa){if(_0x1f5eaa){_0x1b867f=_0x1f5eaa[_0xec05('0x49')];if(!_0x2adbfc[_0xec05('0x2f')]['hasOwnProperty'](_0xec05('0x35'))){_0x3d125c['limit']=qs[_0xec05('0x1c')](_0x2adbfc[_0xec05('0x2f')][_0xec05('0x1c')]);_0x3d125c[_0xec05('0x1a')]=qs[_0xec05('0x1a')](_0x2adbfc[_0xec05('0x2f')][_0xec05('0x1a')]);}return _0x2ea2b0[_0xec05('0x4b')](_0x3d125c);}})[_0xec05('0x24')](function(_0x5729a2){if(_0x5729a2){return _0x5729a2?{'count':_0x1b867f,'rows':_0x5729a2}:null;}})[_0xec05('0x24')](respondWithResult(_0x3cc69b,null))[_0xec05('0x41')](handleError(_0x3cc69b,null));};exports[_0xec05('0x4d')]=function(_0x146532,_0x36af8c,_0x3782c4){var _0x4acb8e={};var _0x348670={};var _0x5315fb;var _0x4967ec;return db[_0xec05('0x2c')][_0xec05('0x48')]({'where':{'id':_0x146532[_0xec05('0x42')]['id']}})[_0xec05('0x24')](handleEntityNotFound(_0x36af8c,null))[_0xec05('0x24')](function(_0x2dbb06){if(_0x2dbb06){_0x5315fb=_0x2dbb06;_0x348670['model']=_[_0xec05('0x43')](db[_0xec05('0x4c')][_0xec05('0x44')]);_0x348670['query']=_[_0xec05('0x43')](_0x146532[_0xec05('0x2f')]);_0x348670['filters']=_['intersection'](_0x348670['model'],_0x348670[_0xec05('0x2f')]);_0x4acb8e[_0xec05('0x32')]=_[_0xec05('0x31')](_0x348670[_0xec05('0x2e')],qs['fields'](_0x146532['query'][_0xec05('0x33')]));_0x4acb8e[_0xec05('0x32')]=_0x4acb8e['attributes'][_0xec05('0x49')]?_0x4acb8e[_0xec05('0x32')]:_0x348670['model'];_0x4acb8e['order']=qs[_0xec05('0x37')](_0x146532[_0xec05('0x2f')][_0xec05('0x37')]);_0x4acb8e[_0xec05('0x39')]=qs[_0xec05('0x30')](_[_0xec05('0x38')](_0x146532[_0xec05('0x2f')],_0x348670[_0xec05('0x30')]));if(_0x146532[_0xec05('0x2f')][_0xec05('0x3c')]){_0x4acb8e[_0xec05('0x39')]=_['merge'](_0x4acb8e[_0xec05('0x39')],{'$or':_[_0xec05('0x2b')](_0x4acb8e[_0xec05('0x32')],function(_0x42e2af){var _0x282fb1={};_0x282fb1[_0x42e2af]={'$like':'%'+_0x146532[_0xec05('0x2f')][_0xec05('0x3c')]+'%'};return _0x282fb1;})});}_0x4acb8e=_[_0xec05('0x3a')]({},_0x4acb8e,_0x146532[_0xec05('0x3d')]);return _0x5315fb[_0xec05('0x4d')](_0x4acb8e);}})[_0xec05('0x24')](function(_0x387052){if(_0x387052){_0x4967ec=_0x387052[_0xec05('0x49')];if(!_0x146532[_0xec05('0x2f')][_0xec05('0x34')]('nolimit')){_0x4acb8e[_0xec05('0x1c')]=qs[_0xec05('0x1c')](_0x146532[_0xec05('0x2f')][_0xec05('0x1c')]);_0x4acb8e['offset']=qs['offset'](_0x146532['query'][_0xec05('0x1a')]);}return _0x5315fb[_0xec05('0x4d')](_0x4acb8e);}})['then'](function(_0x409c5b){if(_0x409c5b){return _0x409c5b?{'count':_0x4967ec,'rows':_0x409c5b}:null;}})[_0xec05('0x24')](respondWithResult(_0x36af8c,null))[_0xec05('0x41')](handleError(_0x36af8c,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index d4f56c4..98eaa63 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 _0xe14d=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','int_dynamics365_configurations','lodash'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xe14d,0x1ee));var _0xde14=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xe14d[_0x2fc012];return _0x2891f9;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var moment=require('moment');var BPromise=require(_0xde14('0x4'));var rp=require(_0xde14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var attributes=require(_0xde14('0x8'));module[_0xde14('0x9')]=function(_0x461af3,_0xba1514){return _0x461af3['define']('Dynamics365Configuration',attributes,{'tableName':_0xde14('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa41a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','int_dynamics365_configurations','lodash','util','api'];(function(_0x55b694,_0x3ab0ef){var _0x1cfaca=function(_0x4ceff1){while(--_0x4ceff1){_0x55b694['push'](_0x55b694['shift']());}};_0x1cfaca(++_0x3ab0ef);}(_0xa41a,0x6b));var _0xaa41=function(_0x2013a6,_0x598c67){_0x2013a6=_0x2013a6-0x0;var _0x2fde28=_0xa41a[_0x2013a6];return _0x2fde28;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));module['exports']=function(_0x2122a0,_0x1ec9d4){return _0x2122a0['define']('Dynamics365Configuration',attributes,{'tableName':_0xaa41('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 30c5d9f..9041aad 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 _0x09ba=['http','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Configuration,\x20%s,\x20%s','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x28e74e,_0x53ed3b){var _0x3e1d22=function(_0x3783b8){while(--_0x3783b8){_0x28e74e['push'](_0x28e74e['shift']());}};_0x3e1d22(++_0x53ed3b);}(_0x09ba,0x140));var _0xa09b=function(_0x3f7830,_0x2ef515){_0x3f7830=_0x3f7830-0x0;var _0x392bcf=_0x09ba[_0x3f7830];return _0x392bcf;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa09b('0x0'));var rs=require(_0xa09b('0x1'));var fs=require('fs');var Redis=require(_0xa09b('0x2'));var db=require(_0xa09b('0x3'))['db'];var utils=require(_0xa09b('0x4'));var logger=require(_0xa09b('0x5'))(_0xa09b('0x6'));var config=require(_0xa09b('0x7'));var jayson=require(_0xa09b('0x8'));var client=jayson[_0xa09b('0x9')][_0xa09b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41b29c,_0x3ca80e,_0x2df368){return new BPromise(function(_0x3bf305,_0x112a04){return client[_0xa09b('0xb')](_0x41b29c,_0x2df368)[_0xa09b('0xc')](function(_0x4c0793){logger[_0xa09b('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3ca80e,_0xa09b('0xe'));logger[_0xa09b('0xf')](_0xa09b('0x10'),_0x3ca80e,'request\x20sent',JSON[_0xa09b('0x11')](_0x4c0793));if(_0x4c0793[_0xa09b('0x12')]){if(_0x4c0793[_0xa09b('0x12')]['code']===0x1f4){logger[_0xa09b('0x12')](_0xa09b('0x13'),_0x3ca80e,_0x4c0793[_0xa09b('0x12')][_0xa09b('0x14')]);return _0x112a04(_0x4c0793[_0xa09b('0x12')][_0xa09b('0x14')]);}logger[_0xa09b('0x12')](_0xa09b('0x13'),_0x3ca80e,_0x4c0793[_0xa09b('0x12')][_0xa09b('0x14')]);return _0x3bf305(_0x4c0793[_0xa09b('0x12')][_0xa09b('0x14')]);}else{logger[_0xa09b('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3ca80e,_0xa09b('0xe'));_0x3bf305(_0x4c0793['result'][_0xa09b('0x14')]);}})[_0xa09b('0x15')](function(_0x25ff56){logger[_0xa09b('0x12')](_0xa09b('0x13'),_0x3ca80e,_0x25ff56);_0x112a04(_0x25ff56);});});} \ No newline at end of file +var _0xda5f=['result','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x385940,_0x45dadf){var _0x4e004f=function(_0x5dc63f){while(--_0x5dc63f){_0x385940['push'](_0x385940['shift']());}};_0x4e004f(++_0x45dadf);}(_0xda5f,0x161));var _0xfda5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda5f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfda5('0x0'));var util=require('util');var moment=require(_0xfda5('0x1'));var BPromise=require(_0xfda5('0x2'));var rs=require(_0xfda5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfda5('0x4'));var logger=require(_0xfda5('0x5'))(_0xfda5('0x6'));var config=require('../../config/environment');var jayson=require(_0xfda5('0x7'));var client=jayson[_0xfda5('0x8')][_0xfda5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c3ede,_0x5ed0b9,_0x1a7999){return new BPromise(function(_0x4efa78,_0x1f5258){return client[_0xfda5('0xa')](_0x2c3ede,_0x1a7999)[_0xfda5('0xb')](function(_0x29ac55){logger['info'](_0xfda5('0xc'),_0x5ed0b9,_0xfda5('0xd'));logger[_0xfda5('0xe')](_0xfda5('0xf'),_0x5ed0b9,_0xfda5('0xd'),JSON[_0xfda5('0x10')](_0x29ac55));if(_0x29ac55[_0xfda5('0x11')]){if(_0x29ac55[_0xfda5('0x11')][_0xfda5('0x12')]===0x1f4){logger[_0xfda5('0x11')](_0xfda5('0xc'),_0x5ed0b9,_0x29ac55[_0xfda5('0x11')]['message']);return _0x1f5258(_0x29ac55[_0xfda5('0x11')][_0xfda5('0x13')]);}logger[_0xfda5('0x11')](_0xfda5('0xc'),_0x5ed0b9,_0x29ac55['error'][_0xfda5('0x13')]);return _0x4efa78(_0x29ac55['error'][_0xfda5('0x13')]);}else{logger[_0xfda5('0x14')](_0xfda5('0xc'),_0x5ed0b9,_0xfda5('0xd'));_0x4efa78(_0x29ac55[_0xfda5('0x15')][_0xfda5('0x13')]);}})['catch'](function(_0x5f5c95){logger[_0xfda5('0x11')](_0xfda5('0xc'),_0x5ed0b9,_0x5f5c95);_0x1f5258(_0x5f5c95);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 1441ca0..46b7167 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 _0x39af=['isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39af,0x69));var _0xf39a=function(_0x3899a4,_0x3d6515){_0x3899a4=_0x3899a4-0x0;var _0x31f606=_0x39af[_0x3899a4];return _0x31f606;};'use strict';var multer=require(_0xf39a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf39a('0x1'));var express=require(_0xf39a('0x2'));var router=express[_0xf39a('0x3')]();var fs_extra=require(_0xf39a('0x4'));var auth=require(_0xf39a('0x5'));var interaction=require(_0xf39a('0x6'));var config=require(_0xf39a('0x7'));var controller=require('./intDynamics365Field.controller');router[_0xf39a('0x8')]('/',auth[_0xf39a('0x9')](),controller['index']);router['get'](_0xf39a('0xa'),auth[_0xf39a('0x9')](),controller[_0xf39a('0xb')]);router[_0xf39a('0xc')]('/',auth[_0xf39a('0x9')](),controller[_0xf39a('0xd')]);router[_0xf39a('0xe')](_0xf39a('0xa'),auth[_0xf39a('0x9')](),controller[_0xf39a('0xf')]);router[_0xf39a('0x10')](_0xf39a('0xa'),auth['isAuthenticated'](),controller[_0xf39a('0x11')]);module[_0xf39a('0x12')]=router; \ No newline at end of file +var _0xf1c0=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id','show','post','create'];(function(_0x3c76e0,_0x1c8b67){var _0x167ead=function(_0x43fd65){while(--_0x43fd65){_0x3c76e0['push'](_0x3c76e0['shift']());}};_0x167ead(++_0x1c8b67);}(_0xf1c0,0x1ba));var _0x0f1c=function(_0x1789cd,_0x459a18){_0x1789cd=_0x1789cd-0x0;var _0x38b0b9=_0xf1c0[_0x1789cd];return _0x38b0b9;};'use strict';var multer=require(_0x0f1c('0x0'));var util=require('util');var path=require(_0x0f1c('0x1'));var timeout=require(_0x0f1c('0x2'));var express=require(_0x0f1c('0x3'));var router=express[_0x0f1c('0x4')]();var fs_extra=require(_0x0f1c('0x5'));var auth=require(_0x0f1c('0x6'));var interaction=require(_0x0f1c('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0x0f1c('0x8')](),controller['index']);router[_0x0f1c('0x9')](_0x0f1c('0xa'),auth[_0x0f1c('0x8')](),controller[_0x0f1c('0xb')]);router[_0x0f1c('0xc')]('/',auth[_0x0f1c('0x8')](),controller[_0x0f1c('0xd')]);router[_0x0f1c('0xe')]('/:id',auth[_0x0f1c('0x8')](),controller[_0x0f1c('0xf')]);router[_0x0f1c('0x10')](_0x0f1c('0xa'),auth[_0x0f1c('0x8')](),controller[_0x0f1c('0x11')]);module[_0x0f1c('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index f0072db..d1cf421 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 _0xa95a=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0xa95a,0xe6));var _0xaa95=function(_0x4ca53a,_0x48ba3d){_0x4ca53a=_0x4ca53a-0x0;var _0x47b0d8=_0xa95a[_0x4ca53a];return _0x47b0d8;};'use strict';var Sequelize=require(_0xaa95('0x0'));module[_0xaa95('0x1')]={'type':{'type':Sequelize[_0xaa95('0x2')](_0xaa95('0x3'),_0xaa95('0x4'),_0xaa95('0x5'),_0xaa95('0x6'),_0xaa95('0x7')),'defaultValue':_0xaa95('0x3')},'content':{'type':Sequelize[_0xaa95('0x8')]},'key':{'type':Sequelize[_0xaa95('0x8')]},'keyType':{'type':Sequelize[_0xaa95('0x2')](_0xaa95('0x3'),_0xaa95('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xaa95('0x8')]},'idField':{'type':Sequelize[_0xaa95('0x8')]},'nameField':{'type':Sequelize[_0xaa95('0x8')]},'customField':{'type':Sequelize[_0xaa95('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5286=['STRING','BOOLEAN','exports','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x5286,0x17c));var _0x6528=function(_0x45369e,_0x9855c9){_0x45369e=_0x45369e-0x0;var _0x18fe5c=_0x5286[_0x45369e];return _0x18fe5c;};'use strict';var Sequelize=require('sequelize');module[_0x6528('0x0')]={'type':{'type':Sequelize[_0x6528('0x1')]('string',_0x6528('0x2'),_0x6528('0x3'),_0x6528('0x4'),_0x6528('0x5')),'defaultValue':_0x6528('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6528('0x1')](_0x6528('0x6'),_0x6528('0x2'),_0x6528('0x3'))},'keyContent':{'type':Sequelize[_0x6528('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6528('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 9284232..da195a9 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 _0x4bd0=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','key','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','keys','find','create','catch','body','params','eml-format','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs'];(function(_0xc069,_0x3005d6){var _0x3f143c=function(_0x2de702){while(--_0x2de702){_0xc069['push'](_0xc069['shift']());}};_0x3f143c(++_0x3005d6);}(_0x4bd0,0x93));var _0x04bd=function(_0x50811d,_0x17d91c){_0x50811d=_0x50811d-0x0;var _0x4f1582=_0x4bd0[_0x50811d];return _0x4f1582;};'use strict';var emlformat=require(_0x04bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x04bd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x04bd('0x2'));var moment=require(_0x04bd('0x3'));var BPromise=require(_0x04bd('0x4'));var Mustache=require('mustache');var util=require(_0x04bd('0x5'));var path=require(_0x04bd('0x6'));var sox=require('sox');var csv=require(_0x04bd('0x7'));var ejs=require(_0x04bd('0x8'));var fs=require('fs');var fs_extra=require(_0x04bd('0x9'));var _=require(_0x04bd('0xa'));var squel=require(_0x04bd('0xb'));var crypto=require(_0x04bd('0xc'));var jsforce=require(_0x04bd('0xd'));var deskjs=require(_0x04bd('0xe'));var toCsv=require('to-csv');var querystring=require(_0x04bd('0xf'));var Papa=require(_0x04bd('0x10'));var Redis=require(_0x04bd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x04bd('0x12'));var as=require(_0x04bd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04bd('0x14'))(_0x04bd('0x15'));var utils=require(_0x04bd('0x16'));var config=require(_0x04bd('0x17'));var licenseUtil=require(_0x04bd('0x18'));var db=require(_0x04bd('0x19'))['db'];function respondWithStatusCode(_0x3e52ce,_0x5d51aa){_0x5d51aa=_0x5d51aa||0xcc;return function(_0x4827f5){if(_0x4827f5){return _0x3e52ce[_0x04bd('0x1a')](_0x5d51aa);}return _0x3e52ce['status'](_0x5d51aa)[_0x04bd('0x1b')]();};}function respondWithResult(_0x2ad8c2,_0xf5af18){_0xf5af18=_0xf5af18||0xc8;return function(_0x1e0208){if(_0x1e0208){return _0x2ad8c2[_0x04bd('0x1c')](_0xf5af18)[_0x04bd('0x1d')](_0x1e0208);}};}function respondWithFilteredResult(_0x50e9f4,_0xde69ea){return function(_0x3e9ac3){if(_0x3e9ac3){var _0x59c791=typeof _0xde69ea[_0x04bd('0x1e')]===_0x04bd('0x1f')&&typeof _0xde69ea['limit']===_0x04bd('0x1f');var _0x1ca9f8=_0x3e9ac3[_0x04bd('0x20')];var _0x348c99=_0x59c791?0x0:_0xde69ea[_0x04bd('0x1e')];var _0x687bdb=_0x59c791?_0x3e9ac3[_0x04bd('0x20')]:_0xde69ea['offset']+_0xde69ea['limit'];var _0x3782a7;if(_0x687bdb>=_0x1ca9f8){_0x687bdb=_0x1ca9f8;_0x3782a7=0xc8;}else{_0x3782a7=0xce;}_0x50e9f4[_0x04bd('0x1c')](_0x3782a7);return _0x50e9f4[_0x04bd('0x21')](_0x04bd('0x22'),_0x348c99+'-'+_0x687bdb+'/'+_0x1ca9f8)['json'](_0x3e9ac3);}return null;};}function patchUpdates(_0x557042){return function(_0x30adf5){try{jsonpatch['apply'](_0x30adf5,_0x557042,!![]);}catch(_0x1d74a7){return BPromise[_0x04bd('0x23')](_0x1d74a7);}return _0x30adf5[_0x04bd('0x24')]();};}function saveUpdates(_0x20e0a5,_0x48db21){return function(_0x545d81){if(_0x545d81){return _0x545d81[_0x04bd('0x25')](_0x20e0a5)['then'](function(_0x433816){return _0x433816;});}return null;};}function removeEntity(_0x217df5,_0x585c5a){return function(_0x1546d0){if(_0x1546d0){return _0x1546d0[_0x04bd('0x26')]()[_0x04bd('0x27')](function(){_0x217df5['status'](0xcc)[_0x04bd('0x1b')]();});}};}function handleEntityNotFound(_0x5e91cf,_0x2b48a6){return function(_0x3607af){if(!_0x3607af){_0x5e91cf[_0x04bd('0x1a')](0x194);}return _0x3607af;};}function handleError(_0x77134b,_0x1f1e8b){_0x1f1e8b=_0x1f1e8b||0x1f4;return function(_0x2feca6){logger[_0x04bd('0x28')](_0x2feca6[_0x04bd('0x29')]);if(_0x2feca6[_0x04bd('0x2a')]){delete _0x2feca6['name'];}_0x77134b['status'](_0x1f1e8b)[_0x04bd('0x2b')](_0x2feca6);};}exports[_0x04bd('0x2c')]=function(_0x397969,_0xe5aed1){var _0x213a82={},_0x4a19fb={},_0x2c5bc7={'count':0x0,'rows':[]};var _0x248e97=_[_0x04bd('0x2d')](db[_0x04bd('0x2e')][_0x04bd('0x2f')],function(_0xc41c7d){return{'name':_0xc41c7d[_0x04bd('0x30')],'type':_0xc41c7d['type'][_0x04bd('0x31')]};});_0x4a19fb['model']=_[_0x04bd('0x2d')](_0x248e97,_0x04bd('0x2a'));_0x4a19fb['query']=_['keys'](_0x397969['query']);_0x4a19fb[_0x04bd('0x32')]=_[_0x04bd('0x33')](_0x4a19fb[_0x04bd('0x34')],_0x4a19fb[_0x04bd('0x35')]);_0x213a82['attributes']=_[_0x04bd('0x33')](_0x4a19fb[_0x04bd('0x34')],qs[_0x04bd('0x36')](_0x397969[_0x04bd('0x35')][_0x04bd('0x36')]));_0x213a82[_0x04bd('0x37')]=_0x213a82['attributes'][_0x04bd('0x38')]?_0x213a82[_0x04bd('0x37')]:_0x4a19fb['model'];if(!_0x397969[_0x04bd('0x35')][_0x04bd('0x39')]('nolimit')){_0x213a82[_0x04bd('0x3a')]=qs[_0x04bd('0x3a')](_0x397969[_0x04bd('0x35')][_0x04bd('0x3a')]);_0x213a82[_0x04bd('0x1e')]=qs[_0x04bd('0x1e')](_0x397969['query'][_0x04bd('0x1e')]);}_0x213a82[_0x04bd('0x3b')]=qs[_0x04bd('0x3c')](_0x397969['query']['sort']);_0x213a82[_0x04bd('0x3d')]=qs['filters'](_[_0x04bd('0x3e')](_0x397969[_0x04bd('0x35')],_0x4a19fb[_0x04bd('0x32')]),_0x248e97);if(_0x397969[_0x04bd('0x35')][_0x04bd('0x3f')]){_0x213a82[_0x04bd('0x3d')]=_[_0x04bd('0x40')](_0x213a82[_0x04bd('0x3d')],{'$or':_[_0x04bd('0x2d')](_0x248e97,function(_0x553619){if(_0x553619[_0x04bd('0x41')]!==_0x04bd('0x42')){var _0x5ddb15={};_0x5ddb15[_0x553619[_0x04bd('0x2a')]]={'$like':'%'+_0x397969['query']['filter']+'%'};return _0x5ddb15;}})});}_0x213a82=_[_0x04bd('0x40')]({},_0x213a82,_0x397969[_0x04bd('0x43')]);var _0x269320={'where':_0x213a82['where']};return db['Dynamics365Field'][_0x04bd('0x20')](_0x269320)[_0x04bd('0x27')](function(_0x21049f){_0x2c5bc7[_0x04bd('0x20')]=_0x21049f;if(_0x397969[_0x04bd('0x35')][_0x04bd('0x44')]){_0x213a82['include']=[{'all':!![]}];}return db[_0x04bd('0x2e')][_0x04bd('0x45')](_0x213a82);})[_0x04bd('0x27')](function(_0x35c4d0){_0x2c5bc7[_0x04bd('0x46')]=_0x35c4d0;return _0x2c5bc7;})[_0x04bd('0x27')](respondWithFilteredResult(_0xe5aed1,_0x213a82))['catch'](handleError(_0xe5aed1,null));};exports[_0x04bd('0x47')]=function(_0x357145,_0x444991){var _0xcd4c0={'raw':!![],'where':{'id':_0x357145['params']['id']}},_0x5b7837={};_0x5b7837['model']=_[_0x04bd('0x48')](db['Dynamics365Field'][_0x04bd('0x2f')]);_0x5b7837['query']=_['keys'](_0x357145[_0x04bd('0x35')]);_0x5b7837[_0x04bd('0x32')]=_[_0x04bd('0x33')](_0x5b7837[_0x04bd('0x34')],_0x5b7837['query']);_0xcd4c0[_0x04bd('0x37')]=_['intersection'](_0x5b7837[_0x04bd('0x34')],qs[_0x04bd('0x36')](_0x357145['query'][_0x04bd('0x36')]));_0xcd4c0[_0x04bd('0x37')]=_0xcd4c0[_0x04bd('0x37')]['length']?_0xcd4c0['attributes']:_0x5b7837[_0x04bd('0x34')];if(_0x357145[_0x04bd('0x35')][_0x04bd('0x44')]){_0xcd4c0['include']=[{'all':!![]}];}_0xcd4c0=_[_0x04bd('0x40')]({},_0xcd4c0,_0x357145[_0x04bd('0x43')]);return db[_0x04bd('0x2e')][_0x04bd('0x49')](_0xcd4c0)['then'](handleEntityNotFound(_0x444991,null))['then'](respondWithResult(_0x444991,null))['catch'](handleError(_0x444991,null));};exports[_0x04bd('0x4a')]=function(_0x2a9822,_0x13a1b3){return db[_0x04bd('0x2e')][_0x04bd('0x4a')](_0x2a9822['body'],{})[_0x04bd('0x27')](respondWithResult(_0x13a1b3,0xc9))[_0x04bd('0x4b')](handleError(_0x13a1b3,null));};exports['update']=function(_0x3bacb1,_0x3df294){if(_0x3bacb1['body']['id']){delete _0x3bacb1[_0x04bd('0x4c')]['id'];}return db[_0x04bd('0x2e')]['find']({'where':{'id':_0x3bacb1[_0x04bd('0x4d')]['id']}})[_0x04bd('0x27')](handleEntityNotFound(_0x3df294,null))[_0x04bd('0x27')](saveUpdates(_0x3bacb1['body'],null))[_0x04bd('0x27')](respondWithResult(_0x3df294,null))[_0x04bd('0x4b')](handleError(_0x3df294,null));};exports[_0x04bd('0x26')]=function(_0x123539,_0x457d66){return db[_0x04bd('0x2e')][_0x04bd('0x49')]({'where':{'id':_0x123539[_0x04bd('0x4d')]['id']}})[_0x04bd('0x27')](handleEntityNotFound(_0x457d66,null))['then'](removeEntity(_0x457d66,null))[_0x04bd('0x4b')](handleError(_0x457d66,null));}; \ No newline at end of file +var _0xfd58=['send','Dynamics365Field','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','VIRTUAL','merge','options','count','includeAll','include','rows','catch','params','rawAttributes','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0xfd58,0x170));var _0x8fd5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfd58[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8fd5('0x0'));var zipdir=require(_0x8fd5('0x1'));var jsonpatch=require(_0x8fd5('0x2'));var rp=require(_0x8fd5('0x3'));var moment=require(_0x8fd5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8fd5('0x5'));var util=require(_0x8fd5('0x6'));var path=require(_0x8fd5('0x7'));var sox=require(_0x8fd5('0x8'));var csv=require(_0x8fd5('0x9'));var ejs=require(_0x8fd5('0xa'));var fs=require('fs');var fs_extra=require(_0x8fd5('0xb'));var _=require(_0x8fd5('0xc'));var squel=require(_0x8fd5('0xd'));var crypto=require('crypto');var jsforce=require(_0x8fd5('0xe'));var deskjs=require(_0x8fd5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8fd5('0x10'));var Papa=require('papaparse');var Redis=require(_0x8fd5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8fd5('0x12'));var as=require(_0x8fd5('0x13'));var hardwareService=require(_0x8fd5('0x14'));var logger=require('../../config/logger')(_0x8fd5('0x15'));var utils=require(_0x8fd5('0x16'));var config=require(_0x8fd5('0x17'));var licenseUtil=require(_0x8fd5('0x18'));var db=require(_0x8fd5('0x19'))['db'];function respondWithStatusCode(_0x1132ec,_0x353d73){_0x353d73=_0x353d73||0xcc;return function(_0x4ed051){if(_0x4ed051){return _0x1132ec[_0x8fd5('0x1a')](_0x353d73);}return _0x1132ec['status'](_0x353d73)[_0x8fd5('0x1b')]();};}function respondWithResult(_0x4fd1b,_0x1917c3){_0x1917c3=_0x1917c3||0xc8;return function(_0x3e1067){if(_0x3e1067){return _0x4fd1b[_0x8fd5('0x1c')](_0x1917c3)['json'](_0x3e1067);}};}function respondWithFilteredResult(_0x137b10,_0x36211e){return function(_0x22c6d4){if(_0x22c6d4){var _0xc57c2=typeof _0x36211e[_0x8fd5('0x1d')]==='undefined'&&typeof _0x36211e[_0x8fd5('0x1e')]==='undefined';var _0x480c6d=_0x22c6d4['count'];var _0x45c9db=_0xc57c2?0x0:_0x36211e['offset'];var _0x4bcaf5=_0xc57c2?_0x22c6d4['count']:_0x36211e[_0x8fd5('0x1d')]+_0x36211e[_0x8fd5('0x1e')];var _0x138a56;if(_0x4bcaf5>=_0x480c6d){_0x4bcaf5=_0x480c6d;_0x138a56=0xc8;}else{_0x138a56=0xce;}_0x137b10[_0x8fd5('0x1c')](_0x138a56);return _0x137b10[_0x8fd5('0x1f')](_0x8fd5('0x20'),_0x45c9db+'-'+_0x4bcaf5+'/'+_0x480c6d)['json'](_0x22c6d4);}return null;};}function patchUpdates(_0x268184){return function(_0xc2ffc){try{jsonpatch['apply'](_0xc2ffc,_0x268184,!![]);}catch(_0x523ab4){return BPromise['reject'](_0x523ab4);}return _0xc2ffc[_0x8fd5('0x21')]();};}function saveUpdates(_0x13aaeb,_0x34280c){return function(_0x13aa22){if(_0x13aa22){return _0x13aa22[_0x8fd5('0x22')](_0x13aaeb)[_0x8fd5('0x23')](function(_0x5e9e66){return _0x5e9e66;});}return null;};}function removeEntity(_0x157c06,_0x12dc18){return function(_0x27a25c){if(_0x27a25c){return _0x27a25c[_0x8fd5('0x24')]()[_0x8fd5('0x23')](function(){_0x157c06[_0x8fd5('0x1c')](0xcc)[_0x8fd5('0x1b')]();});}};}function handleEntityNotFound(_0x589376,_0xa85159){return function(_0x2815c0){if(!_0x2815c0){_0x589376[_0x8fd5('0x1a')](0x194);}return _0x2815c0;};}function handleError(_0x26122a,_0x5c7c59){_0x5c7c59=_0x5c7c59||0x1f4;return function(_0x45df6f){logger[_0x8fd5('0x25')](_0x45df6f[_0x8fd5('0x26')]);if(_0x45df6f[_0x8fd5('0x27')]){delete _0x45df6f[_0x8fd5('0x27')];}_0x26122a['status'](_0x5c7c59)[_0x8fd5('0x28')](_0x45df6f);};}exports['index']=function(_0x255346,_0x51b9ac){var _0x22a403={},_0x5b7994={},_0x44cecc={'count':0x0,'rows':[]};var _0x29358b=_['map'](db[_0x8fd5('0x29')]['rawAttributes'],function(_0x8fbb5c){return{'name':_0x8fbb5c['fieldName'],'type':_0x8fbb5c[_0x8fd5('0x2a')][_0x8fd5('0x2b')]};});_0x5b7994[_0x8fd5('0x2c')]=_['map'](_0x29358b,_0x8fd5('0x27'));_0x5b7994['query']=_[_0x8fd5('0x2d')](_0x255346[_0x8fd5('0x2e')]);_0x5b7994['filters']=_[_0x8fd5('0x2f')](_0x5b7994[_0x8fd5('0x2c')],_0x5b7994[_0x8fd5('0x2e')]);_0x22a403[_0x8fd5('0x30')]=_['intersection'](_0x5b7994['model'],qs[_0x8fd5('0x31')](_0x255346[_0x8fd5('0x2e')][_0x8fd5('0x31')]));_0x22a403[_0x8fd5('0x30')]=_0x22a403[_0x8fd5('0x30')][_0x8fd5('0x32')]?_0x22a403[_0x8fd5('0x30')]:_0x5b7994[_0x8fd5('0x2c')];if(!_0x255346[_0x8fd5('0x2e')][_0x8fd5('0x33')]('nolimit')){_0x22a403[_0x8fd5('0x1e')]=qs[_0x8fd5('0x1e')](_0x255346[_0x8fd5('0x2e')][_0x8fd5('0x1e')]);_0x22a403[_0x8fd5('0x1d')]=qs[_0x8fd5('0x1d')](_0x255346[_0x8fd5('0x2e')][_0x8fd5('0x1d')]);}_0x22a403['order']=qs[_0x8fd5('0x34')](_0x255346['query'][_0x8fd5('0x34')]);_0x22a403[_0x8fd5('0x35')]=qs[_0x8fd5('0x36')](_['pick'](_0x255346[_0x8fd5('0x2e')],_0x5b7994[_0x8fd5('0x36')]),_0x29358b);if(_0x255346[_0x8fd5('0x2e')][_0x8fd5('0x37')]){_0x22a403[_0x8fd5('0x35')]=_['merge'](_0x22a403['where'],{'$or':_['map'](_0x29358b,function(_0x1d25d3){if(_0x1d25d3[_0x8fd5('0x2a')]!==_0x8fd5('0x38')){var _0x2e546a={};_0x2e546a[_0x1d25d3[_0x8fd5('0x27')]]={'$like':'%'+_0x255346['query'][_0x8fd5('0x37')]+'%'};return _0x2e546a;}})});}_0x22a403=_[_0x8fd5('0x39')]({},_0x22a403,_0x255346[_0x8fd5('0x3a')]);var _0xa53ae3={'where':_0x22a403[_0x8fd5('0x35')]};return db[_0x8fd5('0x29')]['count'](_0xa53ae3)[_0x8fd5('0x23')](function(_0x4632e9){_0x44cecc[_0x8fd5('0x3b')]=_0x4632e9;if(_0x255346[_0x8fd5('0x2e')][_0x8fd5('0x3c')]){_0x22a403[_0x8fd5('0x3d')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x22a403);})['then'](function(_0xa4a854){_0x44cecc[_0x8fd5('0x3e')]=_0xa4a854;return _0x44cecc;})[_0x8fd5('0x23')](respondWithFilteredResult(_0x51b9ac,_0x22a403))[_0x8fd5('0x3f')](handleError(_0x51b9ac,null));};exports['show']=function(_0x49585c,_0x3aebdb){var _0x19063e={'raw':!![],'where':{'id':_0x49585c[_0x8fd5('0x40')]['id']}},_0x4f4761={};_0x4f4761[_0x8fd5('0x2c')]=_['keys'](db[_0x8fd5('0x29')][_0x8fd5('0x41')]);_0x4f4761[_0x8fd5('0x2e')]=_[_0x8fd5('0x2d')](_0x49585c[_0x8fd5('0x2e')]);_0x4f4761[_0x8fd5('0x36')]=_[_0x8fd5('0x2f')](_0x4f4761[_0x8fd5('0x2c')],_0x4f4761['query']);_0x19063e[_0x8fd5('0x30')]=_[_0x8fd5('0x2f')](_0x4f4761[_0x8fd5('0x2c')],qs[_0x8fd5('0x31')](_0x49585c[_0x8fd5('0x2e')][_0x8fd5('0x31')]));_0x19063e['attributes']=_0x19063e[_0x8fd5('0x30')][_0x8fd5('0x32')]?_0x19063e[_0x8fd5('0x30')]:_0x4f4761['model'];if(_0x49585c['query'][_0x8fd5('0x3c')]){_0x19063e[_0x8fd5('0x3d')]=[{'all':!![]}];}_0x19063e=_[_0x8fd5('0x39')]({},_0x19063e,_0x49585c[_0x8fd5('0x3a')]);return db[_0x8fd5('0x29')]['find'](_0x19063e)['then'](handleEntityNotFound(_0x3aebdb,null))[_0x8fd5('0x23')](respondWithResult(_0x3aebdb,null))['catch'](handleError(_0x3aebdb,null));};exports[_0x8fd5('0x42')]=function(_0xe6857b,_0xe32835){return db['Dynamics365Field'][_0x8fd5('0x42')](_0xe6857b['body'],{})[_0x8fd5('0x23')](respondWithResult(_0xe32835,0xc9))[_0x8fd5('0x3f')](handleError(_0xe32835,null));};exports['update']=function(_0x2cf3e1,_0x5b7d00){if(_0x2cf3e1[_0x8fd5('0x43')]['id']){delete _0x2cf3e1[_0x8fd5('0x43')]['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x2cf3e1['params']['id']}})[_0x8fd5('0x23')](handleEntityNotFound(_0x5b7d00,null))[_0x8fd5('0x23')](saveUpdates(_0x2cf3e1[_0x8fd5('0x43')],null))[_0x8fd5('0x23')](respondWithResult(_0x5b7d00,null))['catch'](handleError(_0x5b7d00,null));};exports[_0x8fd5('0x24')]=function(_0x562ab6,_0x24bad5){return db[_0x8fd5('0x29')]['find']({'where':{'id':_0x562ab6['params']['id']}})[_0x8fd5('0x23')](handleEntityNotFound(_0x24bad5,null))[_0x8fd5('0x23')](removeEntity(_0x24bad5,null))[_0x8fd5('0x3f')](handleError(_0x24bad5,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 454df99..9b2c786 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 _0x5e77=['./intDynamics365Field.attributes','exports','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3b941f,_0x1fd7ed){var _0x42506b=function(_0x538b41){while(--_0x538b41){_0x3b941f['push'](_0x3b941f['shift']());}};_0x42506b(++_0x1fd7ed);}(_0x5e77,0x1b6));var _0x75e7=function(_0x388bfa,_0x1f518c){_0x388bfa=_0x388bfa-0x0;var _0x11d6a6=_0x5e77[_0x388bfa];return _0x11d6a6;};'use strict';var _=require(_0x75e7('0x0'));var util=require(_0x75e7('0x1'));var logger=require(_0x75e7('0x2'))(_0x75e7('0x3'));var moment=require(_0x75e7('0x4'));var BPromise=require(_0x75e7('0x5'));var rp=require(_0x75e7('0x6'));var fs=require('fs');var path=require(_0x75e7('0x7'));var rimraf=require(_0x75e7('0x8'));var config=require(_0x75e7('0x9'));var attributes=require(_0x75e7('0xa'));module[_0x75e7('0xb')]=function(_0x288736,_0x3a3eb7){return _0x288736['define']('Dynamics365Field',attributes,{'tableName':_0x75e7('0xc'),'paranoid':![],'indexes':[{'name':_0x75e7('0xd'),'fields':[_0x75e7('0xe'),_0x75e7('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x696f=['idField','FieldId','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields'];(function(_0xb58975,_0x5e24d9){var _0x15f827=function(_0x1205cb){while(--_0x1205cb){_0xb58975['push'](_0xb58975['shift']());}};_0x15f827(++_0x5e24d9);}(_0x696f,0x17c));var _0xf696=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x696f[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xf696('0x0'));var util=require(_0xf696('0x1'));var logger=require('../../config/logger')(_0xf696('0x2'));var moment=require('moment');var BPromise=require(_0xf696('0x3'));var rp=require(_0xf696('0x4'));var fs=require('fs');var path=require(_0xf696('0x5'));var rimraf=require(_0xf696('0x6'));var config=require(_0xf696('0x7'));var attributes=require(_0xf696('0x8'));module[_0xf696('0x9')]=function(_0x2ec243,_0xc4b3b4){return _0x2ec243['define'](_0xf696('0xa'),attributes,{'tableName':_0xf696('0xb'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xf696('0xc'),_0xf696('0xd')],'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 6863aaa..d7789e7 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 _0xc0dc=['http','request','then','info','Dynamics365Field,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4a541f,_0x291599){var _0x55c122=function(_0xd5a351){while(--_0xd5a351){_0x4a541f['push'](_0x4a541f['shift']());}};_0x55c122(++_0x291599);}(_0xc0dc,0xf2));var _0xcc0d=function(_0x49e4b1,_0x44a5ab){_0x49e4b1=_0x49e4b1-0x0;var _0x269c98=_0xc0dc[_0x49e4b1];return _0x269c98;};'use strict';var _=require(_0xcc0d('0x0'));var util=require(_0xcc0d('0x1'));var moment=require(_0xcc0d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc0d('0x3'));var db=require(_0xcc0d('0x4'))['db'];var utils=require(_0xcc0d('0x5'));var logger=require(_0xcc0d('0x6'))(_0xcc0d('0x7'));var config=require(_0xcc0d('0x8'));var jayson=require(_0xcc0d('0x9'));var client=jayson[_0xcc0d('0xa')][_0xcc0d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa2f963,_0x45a3ae,_0x3bd6c3){return new BPromise(function(_0xf3b7c1,_0x46ebe6){return client[_0xcc0d('0xc')](_0xa2f963,_0x3bd6c3)[_0xcc0d('0xd')](function(_0x28db81){logger[_0xcc0d('0xe')](_0xcc0d('0xf'),_0x45a3ae,'request\x20sent');logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x45a3ae,'request\x20sent',JSON[_0xcc0d('0x10')](_0x28db81));if(_0x28db81[_0xcc0d('0x11')]){if(_0x28db81[_0xcc0d('0x11')][_0xcc0d('0x12')]===0x1f4){logger[_0xcc0d('0x11')](_0xcc0d('0xf'),_0x45a3ae,_0x28db81[_0xcc0d('0x11')]['message']);return _0x46ebe6(_0x28db81[_0xcc0d('0x11')][_0xcc0d('0x13')]);}logger[_0xcc0d('0x11')](_0xcc0d('0xf'),_0x45a3ae,_0x28db81[_0xcc0d('0x11')][_0xcc0d('0x13')]);return _0xf3b7c1(_0x28db81[_0xcc0d('0x11')]['message']);}else{logger[_0xcc0d('0xe')](_0xcc0d('0xf'),_0x45a3ae,_0xcc0d('0x14'));_0xf3b7c1(_0x28db81[_0xcc0d('0x15')][_0xcc0d('0x13')]);}})[_0xcc0d('0x16')](function(_0x3d2be3){logger['error'](_0xcc0d('0xf'),_0x45a3ae,_0x3d2be3);_0x46ebe6(_0x3d2be3);});});} \ No newline at end of file +var _0x416f=['then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0x416f,0x12a));var _0xf416=function(_0x18cbe7,_0x4c6994){_0x18cbe7=_0x18cbe7-0x0;var _0x588087=_0x416f[_0x18cbe7];return _0x588087;};'use strict';var _=require(_0xf416('0x0'));var util=require(_0xf416('0x1'));var moment=require(_0xf416('0x2'));var BPromise=require(_0xf416('0x3'));var rs=require(_0xf416('0x4'));var fs=require('fs');var Redis=require(_0xf416('0x5'));var db=require(_0xf416('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf416('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x198c27,_0x290541,_0xee1763){return new BPromise(function(_0x1b57ab,_0x573f7a){return client['request'](_0x198c27,_0xee1763)[_0xf416('0x8')](function(_0x353e15){logger[_0xf416('0x9')](_0xf416('0xa'),_0x290541,_0xf416('0xb'));logger[_0xf416('0xc')](_0xf416('0xd'),_0x290541,_0xf416('0xb'),JSON[_0xf416('0xe')](_0x353e15));if(_0x353e15[_0xf416('0xf')]){if(_0x353e15[_0xf416('0xf')]['code']===0x1f4){logger[_0xf416('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x290541,_0x353e15[_0xf416('0xf')][_0xf416('0x10')]);return _0x573f7a(_0x353e15[_0xf416('0xf')][_0xf416('0x10')]);}logger[_0xf416('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x290541,_0x353e15[_0xf416('0xf')]['message']);return _0x1b57ab(_0x353e15[_0xf416('0xf')][_0xf416('0x10')]);}else{logger[_0xf416('0x9')](_0xf416('0xa'),_0x290541,_0xf416('0xb'));_0x1b57ab(_0x353e15[_0xf416('0x11')][_0xf416('0x10')]);}})['catch'](function(_0xfa678f){logger['error'](_0xf416('0xa'),_0x290541,_0xfa678f);_0x573f7a(_0xfa678f);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 7e3fc30..4bc4609 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 _0xd5fd=['isAuthenticated','show','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x5087c7,_0xcbedbf){var _0x33e9a0=function(_0x8a93ce){while(--_0x8a93ce){_0x5087c7['push'](_0x5087c7['shift']());}};_0x33e9a0(++_0xcbedbf);}(_0xd5fd,0x6d));var _0xdd5f=function(_0x1c78dd,_0x117d6e){_0x1c78dd=_0x1c78dd-0x0;var _0x927903=_0xd5fd[_0x1c78dd];return _0x927903;};'use strict';var multer=require(_0xdd5f('0x0'));var util=require(_0xdd5f('0x1'));var path=require(_0xdd5f('0x2'));var timeout=require('connect-timeout');var express=require(_0xdd5f('0x3'));var router=express[_0xdd5f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdd5f('0x5'));var interaction=require(_0xdd5f('0x6'));var config=require(_0xdd5f('0x7'));var controller=require('./intFreshdeskAccount.controller');router[_0xdd5f('0x8')]('/',auth['isAuthenticated'](),controller[_0xdd5f('0x9')]);router[_0xdd5f('0x8')](_0xdd5f('0xa'),auth[_0xdd5f('0xb')](),controller[_0xdd5f('0xc')]);router[_0xdd5f('0x8')](_0xdd5f('0xd'),auth[_0xdd5f('0xb')](),controller['getConfigurations']);router[_0xdd5f('0x8')](_0xdd5f('0xe'),auth[_0xdd5f('0xb')](),controller[_0xdd5f('0xf')]);router['post']('/',auth[_0xdd5f('0xb')](),controller[_0xdd5f('0x10')]);router[_0xdd5f('0x11')](_0xdd5f('0xd'),auth[_0xdd5f('0xb')](),controller[_0xdd5f('0x12')]);router[_0xdd5f('0x13')]('/:id',auth[_0xdd5f('0xb')](),controller['update']);router['delete'](_0xdd5f('0xa'),auth[_0xdd5f('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5779=['update','delete','exports','multer','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post'];(function(_0x479103,_0x12d8e9){var _0x131db1=function(_0x5466eb){while(--_0x5466eb){_0x479103['push'](_0x479103['shift']());}};_0x131db1(++_0x12d8e9);}(_0x5779,0xf3));var _0x9577=function(_0x4277fa,_0x382dfe){_0x4277fa=_0x4277fa-0x0;var _0x3803e6=_0x5779[_0x4277fa];return _0x3803e6;};'use strict';var multer=require(_0x9577('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9577('0x1'));var express=require(_0x9577('0x2'));var router=express['Router']();var fs_extra=require(_0x9577('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9577('0x4'));var config=require(_0x9577('0x5'));var controller=require(_0x9577('0x6'));router[_0x9577('0x7')]('/',auth[_0x9577('0x8')](),controller['index']);router[_0x9577('0x7')](_0x9577('0x9'),auth[_0x9577('0x8')](),controller[_0x9577('0xa')]);router[_0x9577('0x7')](_0x9577('0xb'),auth[_0x9577('0x8')](),controller[_0x9577('0xc')]);router[_0x9577('0x7')](_0x9577('0xd'),auth['isAuthenticated'](),controller[_0x9577('0xe')]);router['post']('/',auth[_0x9577('0x8')](),controller[_0x9577('0xf')]);router[_0x9577('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth[_0x9577('0x8')](),controller[_0x9577('0x11')]);router[_0x9577('0x12')](_0x9577('0x9'),auth[_0x9577('0x8')](),controller['destroy']);module[_0x9577('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 0ecff5b..be84ccc 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 _0x2da6=['username','sequelize','exports','STRING'];(function(_0x124e34,_0x543943){var _0x41d899=function(_0x2770c8){while(--_0x2770c8){_0x124e34['push'](_0x124e34['shift']());}};_0x41d899(++_0x543943);}(_0x2da6,0x1dd));var _0x62da=function(_0x44df09,_0x223d0b){_0x44df09=_0x44df09-0x0;var _0x4d96ce=_0x2da6[_0x44df09];return _0x4d96ce;};'use strict';var Sequelize=require(_0x62da('0x0'));module[_0x62da('0x1')]={'name':{'type':Sequelize[_0x62da('0x2')]},'description':{'type':Sequelize[_0x62da('0x2')]},'username':{'type':Sequelize[_0x62da('0x2')],'unique':_0x62da('0x3')},'apiKey':{'type':Sequelize[_0x62da('0x2')]},'remoteUri':{'type':Sequelize[_0x62da('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xb145=['STRING','username','remoteUri','exports'];(function(_0x32f9ca,_0x2fa8bc){var _0x52e083=function(_0x4fd86a){while(--_0x4fd86a){_0x32f9ca['push'](_0x32f9ca['shift']());}};_0x52e083(++_0x2fa8bc);}(_0xb145,0xa3));var _0x5b14=function(_0x185704,_0x5e1b10){_0x185704=_0x185704-0x0;var _0x588e77=_0xb145[_0x185704];return _0x588e77;};'use strict';var Sequelize=require('sequelize');module[_0x5b14('0x0')]={'name':{'type':Sequelize[_0x5b14('0x1')]},'description':{'type':Sequelize[_0x5b14('0x1')]},'username':{'type':Sequelize[_0x5b14('0x1')],'unique':_0x5b14('0x2')},'apiKey':{'type':Sequelize[_0x5b14('0x1')]},'remoteUri':{'type':Sequelize[_0x5b14('0x1')],'unique':_0x5b14('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index aeb9f6a..891777a 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 _0x81a4=['includeAll','FreshdeskAccount','rows','catch','params','rawAttributes','create','body','find','getConfigurations','findOne','FreshdeskConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','getFields','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','company','includes','custom_text','custom_dropdown','label','default','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x5695e5,_0xa00d0d){var _0x3784ad=function(_0x306cd6){while(--_0x306cd6){_0x5695e5['push'](_0x5695e5['shift']());}};_0x3784ad(++_0xa00d0d);}(_0x81a4,0x1a6));var _0x481a=function(_0x2e914,_0x1c7566){_0x2e914=_0x2e914-0x0;var _0x936e45=_0x81a4[_0x2e914];return _0x936e45;};'use strict';var emlformat=require(_0x481a('0x0'));var rimraf=require(_0x481a('0x1'));var zipdir=require(_0x481a('0x2'));var jsonpatch=require(_0x481a('0x3'));var rp=require('request-promise');var moment=require(_0x481a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x481a('0x5'));var util=require(_0x481a('0x6'));var path=require(_0x481a('0x7'));var sox=require('sox');var csv=require(_0x481a('0x8'));var ejs=require(_0x481a('0x9'));var fs=require('fs');var fs_extra=require(_0x481a('0xa'));var _=require(_0x481a('0xb'));var squel=require('squel');var crypto=require(_0x481a('0xc'));var jsforce=require(_0x481a('0xd'));var deskjs=require(_0x481a('0xe'));var toCsv=require(_0x481a('0x8'));var querystring=require(_0x481a('0xf'));var Papa=require(_0x481a('0x10'));var Redis=require('ioredis');var authService=require(_0x481a('0x11'));var qs=require(_0x481a('0x12'));var as=require(_0x481a('0x13'));var hardwareService=require(_0x481a('0x14'));var logger=require(_0x481a('0x15'))(_0x481a('0x16'));var utils=require(_0x481a('0x17'));var config=require(_0x481a('0x18'));var licenseUtil=require(_0x481a('0x19'));var db=require(_0x481a('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5838af,_0x28a189){_0x28a189=_0x28a189||0xcc;return function(_0x12a690){if(_0x12a690){return _0x5838af[_0x481a('0x1b')](_0x28a189);}return _0x5838af[_0x481a('0x1c')](_0x28a189)[_0x481a('0x1d')]();};}function respondWithResult(_0x2e520b,_0x5637bd){_0x5637bd=_0x5637bd||0xc8;return function(_0x2b20ed){if(_0x2b20ed){return _0x2e520b['status'](_0x5637bd)[_0x481a('0x1e')](_0x2b20ed);}};}function respondWithFilteredResult(_0x1410c1,_0x40f691){return function(_0x507a5b){if(_0x507a5b){var _0x488d6a=typeof _0x40f691[_0x481a('0x1f')]===_0x481a('0x20')&&typeof _0x40f691[_0x481a('0x21')]===_0x481a('0x20');var _0x263755=_0x507a5b[_0x481a('0x22')];var _0xe4e8fe=_0x488d6a?0x0:_0x40f691[_0x481a('0x1f')];var _0x38c15e=_0x488d6a?_0x507a5b[_0x481a('0x22')]:_0x40f691['offset']+_0x40f691[_0x481a('0x21')];var _0x2e81be;if(_0x38c15e>=_0x263755){_0x38c15e=_0x263755;_0x2e81be=0xc8;}else{_0x2e81be=0xce;}_0x1410c1[_0x481a('0x1c')](_0x2e81be);return _0x1410c1[_0x481a('0x23')](_0x481a('0x24'),_0xe4e8fe+'-'+_0x38c15e+'/'+_0x263755)['json'](_0x507a5b);}return null;};}function patchUpdates(_0x2e3549){return function(_0x46db3c){try{jsonpatch[_0x481a('0x25')](_0x46db3c,_0x2e3549,!![]);}catch(_0x35c3c3){return BPromise['reject'](_0x35c3c3);}return _0x46db3c[_0x481a('0x26')]();};}function saveUpdates(_0x1afd59,_0x44673f){return function(_0x2f3ea0){if(_0x2f3ea0){return _0x2f3ea0[_0x481a('0x27')](_0x1afd59)[_0x481a('0x28')](function(_0x336ea1){return _0x336ea1;});}return null;};}function removeEntity(_0x6a554b,_0x56dc8f){return function(_0x333866){if(_0x333866){return _0x333866[_0x481a('0x29')]()['then'](function(){_0x6a554b[_0x481a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f7c7d,_0x2ab2ed){return function(_0x3b36b1){if(!_0x3b36b1){_0x1f7c7d[_0x481a('0x1b')](0x194);}return _0x3b36b1;};}function handleError(_0x542639,_0x42acf4){_0x42acf4=_0x42acf4||0x1f4;return function(_0x3ecd24){logger[_0x481a('0x2a')](_0x3ecd24[_0x481a('0x2b')]);if(_0x3ecd24[_0x481a('0x2c')]){delete _0x3ecd24[_0x481a('0x2c')];}_0x542639['status'](_0x42acf4)[_0x481a('0x2d')](_0x3ecd24);};}exports[_0x481a('0x2e')]=function(_0xde418d,_0x428e55){var _0x4e9d26={},_0x14317e={},_0x39d776={'count':0x0,'rows':[]};var _0x25ea29=_[_0x481a('0x2f')](db['FreshdeskAccount']['rawAttributes'],function(_0x56275e){return{'name':_0x56275e['fieldName'],'type':_0x56275e[_0x481a('0x30')][_0x481a('0x31')]};});_0x14317e[_0x481a('0x32')]=_['map'](_0x25ea29,_0x481a('0x2c'));_0x14317e[_0x481a('0x33')]=_[_0x481a('0x34')](_0xde418d['query']);_0x14317e[_0x481a('0x35')]=_[_0x481a('0x36')](_0x14317e['model'],_0x14317e['query']);_0x4e9d26[_0x481a('0x37')]=_[_0x481a('0x36')](_0x14317e[_0x481a('0x32')],qs[_0x481a('0x38')](_0xde418d[_0x481a('0x33')]['fields']));_0x4e9d26[_0x481a('0x37')]=_0x4e9d26[_0x481a('0x37')][_0x481a('0x39')]?_0x4e9d26[_0x481a('0x37')]:_0x14317e['model'];if(!_0xde418d['query']['hasOwnProperty'](_0x481a('0x3a'))){_0x4e9d26[_0x481a('0x21')]=qs['limit'](_0xde418d[_0x481a('0x33')][_0x481a('0x21')]);_0x4e9d26['offset']=qs[_0x481a('0x1f')](_0xde418d['query']['offset']);}_0x4e9d26['order']=qs[_0x481a('0x3b')](_0xde418d['query'][_0x481a('0x3b')]);_0x4e9d26[_0x481a('0x3c')]=qs[_0x481a('0x35')](_[_0x481a('0x3d')](_0xde418d['query'],_0x14317e[_0x481a('0x35')]),_0x25ea29);if(_0xde418d[_0x481a('0x33')][_0x481a('0x3e')]){_0x4e9d26[_0x481a('0x3c')]=_[_0x481a('0x3f')](_0x4e9d26[_0x481a('0x3c')],{'$or':_['map'](_0x25ea29,function(_0x37972e){if(_0x37972e[_0x481a('0x30')]!==_0x481a('0x40')){var _0x5e6227={};_0x5e6227[_0x37972e['name']]={'$like':'%'+_0xde418d[_0x481a('0x33')][_0x481a('0x3e')]+'%'};return _0x5e6227;}})});}_0x4e9d26=_[_0x481a('0x3f')]({},_0x4e9d26,_0xde418d[_0x481a('0x41')]);var _0x5776b6={'where':_0x4e9d26['where']};return db['FreshdeskAccount']['count'](_0x5776b6)[_0x481a('0x28')](function(_0x221ebc){_0x39d776[_0x481a('0x22')]=_0x221ebc;if(_0xde418d['query'][_0x481a('0x42')]){_0x4e9d26['include']=[{'all':!![]}];}return db[_0x481a('0x43')]['findAll'](_0x4e9d26);})[_0x481a('0x28')](function(_0x30b6ab){_0x39d776[_0x481a('0x44')]=_0x30b6ab;return _0x39d776;})['then'](respondWithFilteredResult(_0x428e55,_0x4e9d26))[_0x481a('0x45')](handleError(_0x428e55,null));};exports['show']=function(_0x5c25b5,_0x4aaa5c){var _0x1c77b7={'raw':![],'where':{'id':_0x5c25b5[_0x481a('0x46')]['id']}},_0x260593={};_0x260593[_0x481a('0x32')]=_[_0x481a('0x34')](db[_0x481a('0x43')][_0x481a('0x47')]);_0x260593['query']=_['keys'](_0x5c25b5[_0x481a('0x33')]);_0x260593[_0x481a('0x35')]=_[_0x481a('0x36')](_0x260593['model'],_0x260593[_0x481a('0x33')]);_0x1c77b7[_0x481a('0x37')]=_[_0x481a('0x36')](_0x260593['model'],qs['fields'](_0x5c25b5[_0x481a('0x33')][_0x481a('0x38')]));_0x1c77b7[_0x481a('0x37')]=_0x1c77b7[_0x481a('0x37')][_0x481a('0x39')]?_0x1c77b7[_0x481a('0x37')]:_0x260593[_0x481a('0x32')];if(_0x5c25b5[_0x481a('0x33')][_0x481a('0x42')]){_0x1c77b7['include']=[{'all':!![]}];}_0x1c77b7=_[_0x481a('0x3f')]({},_0x1c77b7,_0x5c25b5['options']);return db[_0x481a('0x43')]['find'](_0x1c77b7)[_0x481a('0x28')](handleEntityNotFound(_0x4aaa5c,null))[_0x481a('0x28')](respondWithResult(_0x4aaa5c,null))[_0x481a('0x45')](handleError(_0x4aaa5c,null));};exports[_0x481a('0x48')]=function(_0x52fc2c,_0x31796b){return db[_0x481a('0x43')]['create'](_0x52fc2c[_0x481a('0x49')],{})[_0x481a('0x28')](respondWithResult(_0x31796b,0xc9))['catch'](handleError(_0x31796b,null));};exports['update']=function(_0x35dff1,_0x4a8120){if(_0x35dff1['body']['id']){delete _0x35dff1[_0x481a('0x49')]['id'];}return db[_0x481a('0x43')][_0x481a('0x4a')]({'where':{'id':_0x35dff1[_0x481a('0x46')]['id']}})[_0x481a('0x28')](handleEntityNotFound(_0x4a8120,null))['then'](saveUpdates(_0x35dff1['body'],null))['then'](respondWithResult(_0x4a8120,null))['catch'](handleError(_0x4a8120,null));};exports['destroy']=function(_0x1c8a1f,_0xd6cbb){return db['FreshdeskAccount']['find']({'where':{'id':_0x1c8a1f[_0x481a('0x46')]['id']}})[_0x481a('0x28')](handleEntityNotFound(_0xd6cbb,null))[_0x481a('0x28')](removeEntity(_0xd6cbb,null))[_0x481a('0x45')](handleError(_0xd6cbb,null));};exports[_0x481a('0x4b')]=function(_0x4b4e74,_0x35ba2f,_0x4825f3){var _0x151523={};var _0x121557={};var _0x32b619;var _0x10585b;return db['FreshdeskAccount'][_0x481a('0x4c')]({'where':{'id':_0x4b4e74['params']['id']}})[_0x481a('0x28')](handleEntityNotFound(_0x35ba2f,null))['then'](function(_0x161924){if(_0x161924){_0x32b619=_0x161924;_0x121557['model']=_[_0x481a('0x34')](db[_0x481a('0x4d')][_0x481a('0x47')]);_0x121557[_0x481a('0x33')]=_[_0x481a('0x34')](_0x4b4e74[_0x481a('0x33')]);_0x121557[_0x481a('0x35')]=_[_0x481a('0x36')](_0x121557[_0x481a('0x32')],_0x121557[_0x481a('0x33')]);_0x151523[_0x481a('0x37')]=_[_0x481a('0x36')](_0x121557[_0x481a('0x32')],qs[_0x481a('0x38')](_0x4b4e74[_0x481a('0x33')]['fields']));_0x151523[_0x481a('0x37')]=_0x151523['attributes']['length']?_0x151523['attributes']:_0x121557[_0x481a('0x32')];_0x151523[_0x481a('0x4e')]=qs[_0x481a('0x3b')](_0x4b4e74[_0x481a('0x33')][_0x481a('0x3b')]);_0x151523[_0x481a('0x3c')]=qs['filters'](_[_0x481a('0x3d')](_0x4b4e74[_0x481a('0x33')],_0x121557[_0x481a('0x35')]));if(_0x4b4e74[_0x481a('0x33')][_0x481a('0x3e')]){_0x151523[_0x481a('0x3c')]=_[_0x481a('0x3f')](_0x151523[_0x481a('0x3c')],{'$or':_[_0x481a('0x2f')](_0x151523[_0x481a('0x37')],function(_0x312b36){var _0x15c6a0={};_0x15c6a0[_0x312b36]={'$like':'%'+_0x4b4e74['query'][_0x481a('0x3e')]+'%'};return _0x15c6a0;})});}_0x151523=_[_0x481a('0x3f')]({},_0x151523,_0x4b4e74[_0x481a('0x41')]);return _0x32b619[_0x481a('0x4b')](_0x151523);}})[_0x481a('0x28')](function(_0x244cfe){if(_0x244cfe){_0x10585b=_0x244cfe[_0x481a('0x39')];if(!_0x4b4e74[_0x481a('0x33')][_0x481a('0x4f')]('nolimit')){_0x151523[_0x481a('0x21')]=qs[_0x481a('0x21')](_0x4b4e74[_0x481a('0x33')][_0x481a('0x21')]);_0x151523[_0x481a('0x1f')]=qs[_0x481a('0x1f')](_0x4b4e74['query'][_0x481a('0x1f')]);}return _0x32b619[_0x481a('0x4b')](_0x151523);}})['then'](function(_0x1e41bf){if(_0x1e41bf){return _0x1e41bf?{'count':_0x10585b,'rows':_0x1e41bf}:null;}})['then'](respondWithResult(_0x35ba2f,null))[_0x481a('0x45')](handleError(_0x35ba2f,null));};exports[_0x481a('0x50')]=function(_0x54e80d,_0x13139e,_0x5e565d){if(_0x54e80d[_0x481a('0x49')]['id']){delete _0x54e80d['body']['id'];}return db[_0x481a('0x43')][_0x481a('0x4c')]({'where':{'id':_0x54e80d['params']['id']}})[_0x481a('0x28')](handleEntityNotFound(_0x13139e,null))[_0x481a('0x28')](function(_0x39af88){if(_0x39af88){_0x54e80d[_0x481a('0x49')][_0x481a('0x51')]=_0x39af88['id'];_0x54e80d[_0x481a('0x49')][_0x481a('0x52')]=integrations[_0x481a('0x53')](_0x54e80d[_0x481a('0x49')]['channel'],_0x54e80d['body'][_0x481a('0x30')]);_0x54e80d['body'][_0x481a('0x54')]=integrations[_0x481a('0x55')](_0x54e80d['body'][_0x481a('0x56')],_0x54e80d[_0x481a('0x49')][_0x481a('0x30')]);return db[_0x481a('0x4d')][_0x481a('0x48')](_0x54e80d['body'],{'include':[{'model':db[_0x481a('0x57')],'as':'Subjects'},{'model':db[_0x481a('0x57')],'as':_0x481a('0x54')}]});}return null;})['then'](respondWithResult(_0x13139e,null))[_0x481a('0x45')](handleError(_0x13139e,null));};exports[_0x481a('0x58')]=function(_0x50a5a6,_0x95a29b,_0x2a9035){var _0x5ee0e5='';return db['FreshdeskAccount'][_0x481a('0x4c')]({'where':{'id':_0x50a5a6[_0x481a('0x46')]['id']},'attributes':['id',_0x481a('0x59'),'apiKey']})[_0x481a('0x28')](handleEntityNotFound(_0x95a29b,null))[_0x481a('0x28')](function(_0x10e30e){if(_0x10e30e){_0x5ee0e5=_0x10e30e[_0x481a('0x59')];var _0x25f209=_0x5ee0e5[_0x481a('0x5a')](-0x1);if(_0x25f209==='/'){_0x5ee0e5=_0x5ee0e5[_0x481a('0x5b')](0x0,_0x5ee0e5[_0x481a('0x5c')](_0x25f209));}return rp({'method':_0x481a('0x5d'),'uri':util[_0x481a('0x5e')](_0x481a('0x5f'),_0x5ee0e5,_0x481a('0x60')),'headers':{'Authorization':util[_0x481a('0x5e')](_0x481a('0x61'),new Buffer(util[_0x481a('0x5e')](_0x481a('0x62'),_0x10e30e[_0x481a('0x63')]))[_0x481a('0x64')](_0x481a('0x65')))},'json':!![]});}})['then'](function(_0x14e40b){if(_0x14e40b){var _0x33e5b0=[_0x481a('0x66'),_0x481a('0x67'),_0x481a('0x68'),_0x481a('0x69'),_0x481a('0x1c'),_0x481a('0x6a'),_0x481a('0x6b'),_0x481a('0x6c'),_0x481a('0x6d'),'group',_0x481a('0x6e')];_['remove'](_0x14e40b,function(_0xffe41){return _0x33e5b0[_0x481a('0x6f')](_0xffe41[_0x481a('0x2c')])||!_0xffe41['default']&&_0xffe41[_0x481a('0x30')]!==_0x481a('0x70')&&_0xffe41[_0x481a('0x30')]!==_0x481a('0x71');});return{'count':_0x14e40b[_0x481a('0x39')],'rows':_[_0x481a('0x2f')](_0x14e40b,function(_0x598126){return{'id':_0x598126['name'],'name':_0x598126[_0x481a('0x72')],'custom':!_0x598126[_0x481a('0x73')],'options':_0x598126['choices']?_['map'](_0x598126[_0x481a('0x74')],function(_0x3f8965){return{'name':_[_0x481a('0x75')](_0x3f8965),'value':_0x3f8965};}):[]};})};}})['then'](respondWithResult(_0x95a29b,null))[_0x481a('0x45')](function(_0x2ad632){var _0x540024=_0x50a5a6['query'][_0x481a('0x76')]?0x1f4:_0x2ad632[_0x481a('0x77')]||0x1f4;logger[_0x481a('0x2a')](_0x481a('0x78'),_0x481a('0x58'),_0x540024,JSON[_0x481a('0x79')](_0x2ad632));delete _0x2ad632[_0x481a('0x2c')];if(_0x540024===0x191){_0x540024=0x190;}_0x95a29b['status'](_0x540024)[_0x481a('0x2d')](_0x50a5a6[_0x481a('0x33')][_0x481a('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x2ad632[_0x481a('0x77')]}:_0x2ad632);});}; \ No newline at end of file +var _0x422f=['GET','format','%s/%s','api/v2/ticket_fields','%s:X','base64','subject','agent','description','priority','source','ticket_type','group','custom_text','custom_dropdown','label','default','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','reject','then','destroy','error','stack','name','index','map','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','type','VIRTUAL','options','FreshdeskAccount','include','findAll','rows','catch','params','length','includeAll','find','create','body','update','findOne','rawAttributes','pick','getConfigurations','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','FreshdeskField','remoteUri','apiKey','lastIndexOf'];(function(_0x21a4f8,_0x4bf0f0){var _0x4f051e=function(_0x3e6460){while(--_0x3e6460){_0x21a4f8['push'](_0x21a4f8['shift']());}};_0x4f051e(++_0x4bf0f0);}(_0x422f,0x1c7));var _0xf422=function(_0x105d80,_0x562858){_0x105d80=_0x105d80-0x0;var _0x3e863b=_0x422f[_0x105d80];return _0x3e863b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf422('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf422('0x1'));var rp=require(_0xf422('0x2'));var moment=require('moment');var BPromise=require(_0xf422('0x3'));var Mustache=require(_0xf422('0x4'));var util=require(_0xf422('0x5'));var path=require(_0xf422('0x6'));var sox=require(_0xf422('0x7'));var csv=require(_0xf422('0x8'));var ejs=require(_0xf422('0x9'));var fs=require('fs');var fs_extra=require(_0xf422('0xa'));var _=require(_0xf422('0xb'));var squel=require('squel');var crypto=require(_0xf422('0xc'));var jsforce=require(_0xf422('0xd'));var deskjs=require(_0xf422('0xe'));var toCsv=require(_0xf422('0x8'));var querystring=require(_0xf422('0xf'));var Papa=require('papaparse');var Redis=require(_0xf422('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf422('0x11'));var hardwareService=require(_0xf422('0x12'));var logger=require(_0xf422('0x13'))(_0xf422('0x14'));var utils=require(_0xf422('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf422('0x16'));var db=require(_0xf422('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x133a6a,_0x8aa9cc){_0x8aa9cc=_0x8aa9cc||0xcc;return function(_0x1ea998){if(_0x1ea998){return _0x133a6a[_0xf422('0x18')](_0x8aa9cc);}return _0x133a6a[_0xf422('0x19')](_0x8aa9cc)[_0xf422('0x1a')]();};}function respondWithResult(_0x223b21,_0x272430){_0x272430=_0x272430||0xc8;return function(_0x2e6d81){if(_0x2e6d81){return _0x223b21['status'](_0x272430)['json'](_0x2e6d81);}};}function respondWithFilteredResult(_0x52f96b,_0x1c81e1){return function(_0x30b70a){if(_0x30b70a){var _0x21a35d=typeof _0x1c81e1[_0xf422('0x1b')]==='undefined'&&typeof _0x1c81e1[_0xf422('0x1c')]===_0xf422('0x1d');var _0x76e4b1=_0x30b70a[_0xf422('0x1e')];var _0x43de64=_0x21a35d?0x0:_0x1c81e1[_0xf422('0x1b')];var _0x4fefd0=_0x21a35d?_0x30b70a['count']:_0x1c81e1[_0xf422('0x1b')]+_0x1c81e1[_0xf422('0x1c')];var _0x215287;if(_0x4fefd0>=_0x76e4b1){_0x4fefd0=_0x76e4b1;_0x215287=0xc8;}else{_0x215287=0xce;}_0x52f96b['status'](_0x215287);return _0x52f96b[_0xf422('0x1f')]('Content-Range',_0x43de64+'-'+_0x4fefd0+'/'+_0x76e4b1)[_0xf422('0x20')](_0x30b70a);}return null;};}function patchUpdates(_0x15833b){return function(_0x36b7e7){try{jsonpatch['apply'](_0x36b7e7,_0x15833b,!![]);}catch(_0xf2d06b){return BPromise[_0xf422('0x21')](_0xf2d06b);}return _0x36b7e7['save']();};}function saveUpdates(_0x4b80a0,_0x268575){return function(_0x3cb26b){if(_0x3cb26b){return _0x3cb26b['update'](_0x4b80a0)[_0xf422('0x22')](function(_0x570ea2){return _0x570ea2;});}return null;};}function removeEntity(_0x3b21a5,_0x32ceee){return function(_0x31a518){if(_0x31a518){return _0x31a518[_0xf422('0x23')]()[_0xf422('0x22')](function(){_0x3b21a5[_0xf422('0x19')](0xcc)[_0xf422('0x1a')]();});}};}function handleEntityNotFound(_0x11d10b,_0x5dcab4){return function(_0x1125ce){if(!_0x1125ce){_0x11d10b['sendStatus'](0x194);}return _0x1125ce;};}function handleError(_0x2f0f9f,_0x7d36e7){_0x7d36e7=_0x7d36e7||0x1f4;return function(_0x29e62f){logger[_0xf422('0x24')](_0x29e62f[_0xf422('0x25')]);if(_0x29e62f[_0xf422('0x26')]){delete _0x29e62f[_0xf422('0x26')];}_0x2f0f9f['status'](_0x7d36e7)['send'](_0x29e62f);};}exports[_0xf422('0x27')]=function(_0x10d51b,_0x266fb8){var _0x33ef63={},_0xefb99e={},_0x48e0c7={'count':0x0,'rows':[]};var _0x6d22f1=_[_0xf422('0x28')](db['FreshdeskAccount']['rawAttributes'],function(_0x3f86fc){return{'name':_0x3f86fc['fieldName'],'type':_0x3f86fc['type'][_0xf422('0x29')]};});_0xefb99e[_0xf422('0x2a')]=_['map'](_0x6d22f1,_0xf422('0x26'));_0xefb99e[_0xf422('0x2b')]=_[_0xf422('0x2c')](_0x10d51b[_0xf422('0x2b')]);_0xefb99e[_0xf422('0x2d')]=_['intersection'](_0xefb99e[_0xf422('0x2a')],_0xefb99e['query']);_0x33ef63[_0xf422('0x2e')]=_[_0xf422('0x2f')](_0xefb99e[_0xf422('0x2a')],qs[_0xf422('0x30')](_0x10d51b[_0xf422('0x2b')][_0xf422('0x30')]));_0x33ef63[_0xf422('0x2e')]=_0x33ef63['attributes']['length']?_0x33ef63[_0xf422('0x2e')]:_0xefb99e[_0xf422('0x2a')];if(!_0x10d51b['query'][_0xf422('0x31')](_0xf422('0x32'))){_0x33ef63[_0xf422('0x1c')]=qs[_0xf422('0x1c')](_0x10d51b[_0xf422('0x2b')][_0xf422('0x1c')]);_0x33ef63[_0xf422('0x1b')]=qs[_0xf422('0x1b')](_0x10d51b[_0xf422('0x2b')][_0xf422('0x1b')]);}_0x33ef63[_0xf422('0x33')]=qs[_0xf422('0x34')](_0x10d51b[_0xf422('0x2b')][_0xf422('0x34')]);_0x33ef63['where']=qs['filters'](_['pick'](_0x10d51b[_0xf422('0x2b')],_0xefb99e[_0xf422('0x2d')]),_0x6d22f1);if(_0x10d51b['query'][_0xf422('0x35')]){_0x33ef63['where']=_[_0xf422('0x36')](_0x33ef63[_0xf422('0x37')],{'$or':_['map'](_0x6d22f1,function(_0x42dc4d){if(_0x42dc4d[_0xf422('0x38')]!==_0xf422('0x39')){var _0x511fc7={};_0x511fc7[_0x42dc4d[_0xf422('0x26')]]={'$like':'%'+_0x10d51b['query']['filter']+'%'};return _0x511fc7;}})});}_0x33ef63=_['merge']({},_0x33ef63,_0x10d51b[_0xf422('0x3a')]);var _0x293497={'where':_0x33ef63[_0xf422('0x37')]};return db[_0xf422('0x3b')][_0xf422('0x1e')](_0x293497)[_0xf422('0x22')](function(_0x42923d){_0x48e0c7[_0xf422('0x1e')]=_0x42923d;if(_0x10d51b['query']['includeAll']){_0x33ef63[_0xf422('0x3c')]=[{'all':!![]}];}return db[_0xf422('0x3b')][_0xf422('0x3d')](_0x33ef63);})[_0xf422('0x22')](function(_0xc7423f){_0x48e0c7[_0xf422('0x3e')]=_0xc7423f;return _0x48e0c7;})['then'](respondWithFilteredResult(_0x266fb8,_0x33ef63))[_0xf422('0x3f')](handleError(_0x266fb8,null));};exports['show']=function(_0x17c1f2,_0x391e3c){var _0x564041={'raw':![],'where':{'id':_0x17c1f2[_0xf422('0x40')]['id']}},_0x3c9b0d={};_0x3c9b0d[_0xf422('0x2a')]=_[_0xf422('0x2c')](db[_0xf422('0x3b')]['rawAttributes']);_0x3c9b0d[_0xf422('0x2b')]=_[_0xf422('0x2c')](_0x17c1f2[_0xf422('0x2b')]);_0x3c9b0d[_0xf422('0x2d')]=_[_0xf422('0x2f')](_0x3c9b0d['model'],_0x3c9b0d[_0xf422('0x2b')]);_0x564041[_0xf422('0x2e')]=_['intersection'](_0x3c9b0d[_0xf422('0x2a')],qs['fields'](_0x17c1f2[_0xf422('0x2b')][_0xf422('0x30')]));_0x564041[_0xf422('0x2e')]=_0x564041[_0xf422('0x2e')][_0xf422('0x41')]?_0x564041[_0xf422('0x2e')]:_0x3c9b0d[_0xf422('0x2a')];if(_0x17c1f2[_0xf422('0x2b')][_0xf422('0x42')]){_0x564041[_0xf422('0x3c')]=[{'all':!![]}];}_0x564041=_[_0xf422('0x36')]({},_0x564041,_0x17c1f2[_0xf422('0x3a')]);return db[_0xf422('0x3b')][_0xf422('0x43')](_0x564041)[_0xf422('0x22')](handleEntityNotFound(_0x391e3c,null))['then'](respondWithResult(_0x391e3c,null))['catch'](handleError(_0x391e3c,null));};exports[_0xf422('0x44')]=function(_0x2c2ce9,_0x3452a8){return db['FreshdeskAccount'][_0xf422('0x44')](_0x2c2ce9[_0xf422('0x45')],{})[_0xf422('0x22')](respondWithResult(_0x3452a8,0xc9))[_0xf422('0x3f')](handleError(_0x3452a8,null));};exports[_0xf422('0x46')]=function(_0x259e24,_0x3dffe0){if(_0x259e24['body']['id']){delete _0x259e24[_0xf422('0x45')]['id'];}return db['FreshdeskAccount'][_0xf422('0x43')]({'where':{'id':_0x259e24[_0xf422('0x40')]['id']}})['then'](handleEntityNotFound(_0x3dffe0,null))[_0xf422('0x22')](saveUpdates(_0x259e24[_0xf422('0x45')],null))[_0xf422('0x22')](respondWithResult(_0x3dffe0,null))[_0xf422('0x3f')](handleError(_0x3dffe0,null));};exports[_0xf422('0x23')]=function(_0x5c3cb8,_0x5261df){return db[_0xf422('0x3b')]['find']({'where':{'id':_0x5c3cb8[_0xf422('0x40')]['id']}})[_0xf422('0x22')](handleEntityNotFound(_0x5261df,null))[_0xf422('0x22')](removeEntity(_0x5261df,null))[_0xf422('0x3f')](handleError(_0x5261df,null));};exports['getConfigurations']=function(_0x4b8b1f,_0x44448c,_0xe333b8){var _0x46a200={};var _0xddcd6c={};var _0x2b640a;var _0x350af2;return db['FreshdeskAccount'][_0xf422('0x47')]({'where':{'id':_0x4b8b1f['params']['id']}})[_0xf422('0x22')](handleEntityNotFound(_0x44448c,null))[_0xf422('0x22')](function(_0x2369e7){if(_0x2369e7){_0x2b640a=_0x2369e7;_0xddcd6c[_0xf422('0x2a')]=_['keys'](db['FreshdeskConfiguration'][_0xf422('0x48')]);_0xddcd6c[_0xf422('0x2b')]=_[_0xf422('0x2c')](_0x4b8b1f[_0xf422('0x2b')]);_0xddcd6c[_0xf422('0x2d')]=_[_0xf422('0x2f')](_0xddcd6c[_0xf422('0x2a')],_0xddcd6c['query']);_0x46a200[_0xf422('0x2e')]=_[_0xf422('0x2f')](_0xddcd6c[_0xf422('0x2a')],qs[_0xf422('0x30')](_0x4b8b1f[_0xf422('0x2b')][_0xf422('0x30')]));_0x46a200[_0xf422('0x2e')]=_0x46a200[_0xf422('0x2e')][_0xf422('0x41')]?_0x46a200[_0xf422('0x2e')]:_0xddcd6c['model'];_0x46a200[_0xf422('0x33')]=qs[_0xf422('0x34')](_0x4b8b1f[_0xf422('0x2b')][_0xf422('0x34')]);_0x46a200[_0xf422('0x37')]=qs['filters'](_[_0xf422('0x49')](_0x4b8b1f[_0xf422('0x2b')],_0xddcd6c['filters']));if(_0x4b8b1f[_0xf422('0x2b')][_0xf422('0x35')]){_0x46a200[_0xf422('0x37')]=_[_0xf422('0x36')](_0x46a200[_0xf422('0x37')],{'$or':_[_0xf422('0x28')](_0x46a200[_0xf422('0x2e')],function(_0x5997bc){var _0x2c2316={};_0x2c2316[_0x5997bc]={'$like':'%'+_0x4b8b1f[_0xf422('0x2b')][_0xf422('0x35')]+'%'};return _0x2c2316;})});}_0x46a200=_['merge']({},_0x46a200,_0x4b8b1f[_0xf422('0x3a')]);return _0x2b640a[_0xf422('0x4a')](_0x46a200);}})[_0xf422('0x22')](function(_0x144494){if(_0x144494){_0x350af2=_0x144494[_0xf422('0x41')];if(!_0x4b8b1f[_0xf422('0x2b')][_0xf422('0x31')](_0xf422('0x32'))){_0x46a200[_0xf422('0x1c')]=qs[_0xf422('0x1c')](_0x4b8b1f[_0xf422('0x2b')][_0xf422('0x1c')]);_0x46a200[_0xf422('0x1b')]=qs[_0xf422('0x1b')](_0x4b8b1f[_0xf422('0x2b')][_0xf422('0x1b')]);}return _0x2b640a[_0xf422('0x4a')](_0x46a200);}})[_0xf422('0x22')](function(_0x366019){if(_0x366019){return _0x366019?{'count':_0x350af2,'rows':_0x366019}:null;}})['then'](respondWithResult(_0x44448c,null))['catch'](handleError(_0x44448c,null));};exports[_0xf422('0x4b')]=function(_0x5ec3a5,_0xd9e138,_0x3345dd){if(_0x5ec3a5[_0xf422('0x45')]['id']){delete _0x5ec3a5[_0xf422('0x45')]['id'];}return db['FreshdeskAccount'][_0xf422('0x47')]({'where':{'id':_0x5ec3a5[_0xf422('0x40')]['id']}})[_0xf422('0x22')](handleEntityNotFound(_0xd9e138,null))['then'](function(_0x5b5dfa){if(_0x5b5dfa){_0x5ec3a5[_0xf422('0x45')][_0xf422('0x4c')]=_0x5b5dfa['id'];_0x5ec3a5[_0xf422('0x45')][_0xf422('0x4d')]=integrations['getSubjects'](_0x5ec3a5['body']['channel'],_0x5ec3a5[_0xf422('0x45')][_0xf422('0x38')]);_0x5ec3a5[_0xf422('0x45')][_0xf422('0x4e')]=integrations[_0xf422('0x4f')](_0x5ec3a5[_0xf422('0x45')][_0xf422('0x50')],_0x5ec3a5['body']['type']);return db['FreshdeskConfiguration'][_0xf422('0x44')](_0x5ec3a5['body'],{'include':[{'model':db[_0xf422('0x51')],'as':_0xf422('0x4d')},{'model':db['FreshdeskField'],'as':_0xf422('0x4e')}]});}return null;})[_0xf422('0x22')](respondWithResult(_0xd9e138,null))[_0xf422('0x3f')](handleError(_0xd9e138,null));};exports['getFields']=function(_0x2435af,_0x24adb6,_0x5b1760){var _0x20d6aa='';return db[_0xf422('0x3b')][_0xf422('0x47')]({'where':{'id':_0x2435af[_0xf422('0x40')]['id']},'attributes':['id',_0xf422('0x52'),_0xf422('0x53')]})[_0xf422('0x22')](handleEntityNotFound(_0x24adb6,null))['then'](function(_0x1d2ca8){if(_0x1d2ca8){_0x20d6aa=_0x1d2ca8[_0xf422('0x52')];var _0x33c2df=_0x20d6aa['slice'](-0x1);if(_0x33c2df==='/'){_0x20d6aa=_0x20d6aa['substring'](0x0,_0x20d6aa[_0xf422('0x54')](_0x33c2df));}return rp({'method':_0xf422('0x55'),'uri':util[_0xf422('0x56')](_0xf422('0x57'),_0x20d6aa,_0xf422('0x58')),'headers':{'Authorization':util[_0xf422('0x56')]('Basic\x20%s',new Buffer(util[_0xf422('0x56')](_0xf422('0x59'),_0x1d2ca8[_0xf422('0x53')]))['toString'](_0xf422('0x5a')))},'json':!![]});}})['then'](function(_0x4dedde){if(_0x4dedde){var _0x47aa00=['requester',_0xf422('0x5b'),_0xf422('0x5c'),_0xf422('0x5d'),_0xf422('0x19'),_0xf422('0x5e'),'group',_0xf422('0x5f'),_0xf422('0x60'),_0xf422('0x61'),'company'];_['remove'](_0x4dedde,function(_0x3bc35a){return _0x47aa00['includes'](_0x3bc35a[_0xf422('0x26')])||!_0x3bc35a['default']&&_0x3bc35a[_0xf422('0x38')]!==_0xf422('0x62')&&_0x3bc35a['type']!==_0xf422('0x63');});return{'count':_0x4dedde[_0xf422('0x41')],'rows':_['map'](_0x4dedde,function(_0x35d33c){return{'id':_0x35d33c[_0xf422('0x26')],'name':_0x35d33c[_0xf422('0x64')],'custom':!_0x35d33c[_0xf422('0x65')],'options':_0x35d33c['choices']?_[_0xf422('0x28')](_0x35d33c['choices'],function(_0x175b19){return{'name':_[_0xf422('0x66')](_0x175b19),'value':_0x175b19};}):[]};})};}})[_0xf422('0x22')](respondWithResult(_0x24adb6,null))['catch'](function(_0x4e032d){var _0x853ef4=_0x2435af[_0xf422('0x2b')]['test']?0x1f4:_0x4e032d[_0xf422('0x67')]||0x1f4;logger['error'](_0xf422('0x68'),'getFields',_0x853ef4,JSON['stringify'](_0x4e032d));delete _0x4e032d[_0xf422('0x26')];if(_0x853ef4===0x191){_0x853ef4=0x190;}_0x24adb6[_0xf422('0x19')](_0x853ef4)[_0xf422('0x69')](_0x2435af[_0xf422('0x2b')][_0xf422('0x6a')]?{'message':_0xf422('0x6b'),'statusCode':_0x4e032d[_0xf422('0x67')]}:_0x4e032d);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index ceb306c..3537786 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 _0x1bab=['moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api'];(function(_0x373516,_0x52f67e){var _0x745a3f=function(_0x14c3b7){while(--_0x14c3b7){_0x373516['push'](_0x373516['shift']());}};_0x745a3f(++_0x52f67e);}(_0x1bab,0x122));var _0xb1ba=function(_0x1f510f,_0x3c6858){_0x1f510f=_0x1f510f-0x0;var _0x1400b5=_0x1bab[_0x1f510f];return _0x1400b5;};'use strict';var _=require(_0xb1ba('0x0'));var util=require(_0xb1ba('0x1'));var logger=require(_0xb1ba('0x2'))(_0xb1ba('0x3'));var moment=require(_0xb1ba('0x4'));var BPromise=require(_0xb1ba('0x5'));var rp=require(_0xb1ba('0x6'));var fs=require('fs');var path=require(_0xb1ba('0x7'));var rimraf=require(_0xb1ba('0x8'));var config=require(_0xb1ba('0x9'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xb1ba('0xa'));module['exports']=function(_0x24dec3,_0x14a0ad){return _0x24dec3[_0xb1ba('0xb')](_0xb1ba('0xc'),attributes,{'tableName':_0xb1ba('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd986=['path','rimraf','../../config/environment','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x46152a,_0x238ecf){var _0x3e304e=function(_0x2ada22){while(--_0x2ada22){_0x46152a['push'](_0x46152a['shift']());}};_0x3e304e(++_0x238ecf);}(_0xd986,0x11f));var _0x6d98=function(_0x46987e,_0x33fe12){_0x46987e=_0x46987e-0x0;var _0x1bdc48=_0xd986[_0x46987e];return _0x1bdc48;};'use strict';var _=require(_0x6d98('0x0'));var util=require(_0x6d98('0x1'));var logger=require(_0x6d98('0x2'))(_0x6d98('0x3'));var moment=require(_0x6d98('0x4'));var BPromise=require(_0x6d98('0x5'));var rp=require(_0x6d98('0x6'));var fs=require('fs');var path=require(_0x6d98('0x7'));var rimraf=require(_0x6d98('0x8'));var config=require(_0x6d98('0x9'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x6d98('0xa'));module['exports']=function(_0x32fc23,_0x4b7011){return _0x32fc23[_0x6d98('0xb')](_0x6d98('0xc'),attributes,{'tableName':_0x6d98('0xd'),'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 e431a8a..45e3094 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 _0x0902=['FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','include','map','model','ShowFreshdeskAccount','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0902,0xaf));var _0x2090=function(_0x26ecab,_0x574afc){_0x26ecab=_0x26ecab-0x0;var _0x168cd2=_0x0902[_0x26ecab];return _0x168cd2;};'use strict';var _=require(_0x2090('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2090('0x1'));var rs=require(_0x2090('0x2'));var fs=require('fs');var Redis=require(_0x2090('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2090('0x4'));var logger=require('../../config/logger')(_0x2090('0x5'));var config=require('../../config/environment');var jayson=require(_0x2090('0x6'));var client=jayson[_0x2090('0x7')][_0x2090('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a11e4,_0x56eb2f,_0x1bbde3){return new BPromise(function(_0x55851d,_0x55a499){return client['request'](_0x5a11e4,_0x1bbde3)[_0x2090('0x9')](function(_0x443d46){logger[_0x2090('0xa')](_0x2090('0xb'),_0x56eb2f,_0x2090('0xc'));logger[_0x2090('0xd')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x56eb2f,_0x2090('0xc'),JSON[_0x2090('0xe')](_0x443d46));if(_0x443d46[_0x2090('0xf')]){if(_0x443d46[_0x2090('0xf')][_0x2090('0x10')]===0x1f4){logger[_0x2090('0xf')](_0x2090('0xb'),_0x56eb2f,_0x443d46[_0x2090('0xf')][_0x2090('0x11')]);return _0x55a499(_0x443d46[_0x2090('0xf')]['message']);}logger[_0x2090('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x56eb2f,_0x443d46[_0x2090('0xf')]['message']);return _0x55851d(_0x443d46[_0x2090('0xf')][_0x2090('0x11')]);}else{logger[_0x2090('0xa')](_0x2090('0xb'),_0x56eb2f,'request\x20sent');_0x55851d(_0x443d46[_0x2090('0x12')][_0x2090('0x11')]);}})[_0x2090('0x13')](function(_0x1e7255){logger[_0x2090('0xf')](_0x2090('0xb'),_0x56eb2f,_0x1e7255);_0x55a499(_0x1e7255);});});}exports[_0x2090('0x14')]=function(_0x3ae762){var _0x58615d=this;return new Promise(function(_0x580e42,_0x167eee){return db[_0x2090('0x15')][_0x2090('0x16')]({'raw':_0x3ae762['options']?_0x3ae762[_0x2090('0x17')][_0x2090('0x18')]===undefined?!![]:![]:!![],'where':_0x3ae762[_0x2090('0x17')]?_0x3ae762[_0x2090('0x17')][_0x2090('0x19')]||null:null,'attributes':_0x3ae762[_0x2090('0x17')]?_0x3ae762['options'][_0x2090('0x1a')]||null:null,'limit':_0x3ae762[_0x2090('0x17')]?_0x3ae762[_0x2090('0x17')]['limit']||null:null,'include':_0x3ae762[_0x2090('0x17')]?_0x3ae762[_0x2090('0x17')][_0x2090('0x1b')]?_[_0x2090('0x1c')](_0x3ae762[_0x2090('0x17')][_0x2090('0x1b')],function(_0x554c0a){return{'model':db[_0x554c0a[_0x2090('0x1d')]],'as':_0x554c0a['as'],'attributes':_0x554c0a[_0x2090('0x1a')],'include':_0x554c0a[_0x2090('0x1b')]?_[_0x2090('0x1c')](_0x554c0a[_0x2090('0x1b')],function(_0xe614e){return{'model':db[_0xe614e[_0x2090('0x1d')]],'as':_0xe614e['as'],'attributes':_0xe614e[_0x2090('0x1a')],'include':_0xe614e[_0x2090('0x1b')]?_[_0x2090('0x1c')](_0xe614e['include'],function(_0x332dc1){return{'model':db[_0x332dc1['model']],'as':_0x332dc1['as'],'attributes':_0x332dc1[_0x2090('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2090('0x9')](function(_0x5de4ac){logger['info'](_0x2090('0x14'),_0x3ae762);logger[_0x2090('0xd')](_0x2090('0x14'),_0x3ae762,JSON[_0x2090('0xe')](_0x5de4ac));_0x580e42(_0x5de4ac);})[_0x2090('0x13')](function(_0x949b92){logger[_0x2090('0xf')](_0x2090('0x14'),_0x949b92[_0x2090('0x11')],_0x3ae762);_0x167eee(_0x58615d['error'](0x1f4,_0x949b92[_0x2090('0x11')]));});});};exports['ShowFreshdeskAccount']=function(_0x203ce1){var _0x219df7=this;return new Promise(function(_0x151627,_0x1f838f){return db['FreshdeskAccount']['find']({'raw':_0x203ce1[_0x2090('0x17')]?_0x203ce1[_0x2090('0x17')][_0x2090('0x18')]===undefined?!![]:![]:!![],'where':_0x203ce1[_0x2090('0x17')]?_0x203ce1['options'][_0x2090('0x19')]||null:null,'attributes':_0x203ce1[_0x2090('0x17')]?_0x203ce1[_0x2090('0x17')][_0x2090('0x1a')]||null:null,'include':_0x203ce1[_0x2090('0x17')]?_0x203ce1['options']['include']?_[_0x2090('0x1c')](_0x203ce1[_0x2090('0x17')][_0x2090('0x1b')],function(_0x12ad06){return{'model':db[_0x12ad06[_0x2090('0x1d')]],'as':_0x12ad06['as'],'attributes':_0x12ad06[_0x2090('0x1a')],'include':_0x12ad06[_0x2090('0x1b')]?_[_0x2090('0x1c')](_0x12ad06[_0x2090('0x1b')],function(_0x90438){return{'model':db[_0x90438[_0x2090('0x1d')]],'as':_0x90438['as'],'attributes':_0x90438[_0x2090('0x1a')],'include':_0x90438['include']?_[_0x2090('0x1c')](_0x90438[_0x2090('0x1b')],function(_0x30e2e8){return{'model':db[_0x30e2e8[_0x2090('0x1d')]],'as':_0x30e2e8['as'],'attributes':_0x30e2e8['attributes']};}):[]};}):[]};}):[]:[]})[_0x2090('0x9')](function(_0x3ba854){logger[_0x2090('0xa')](_0x2090('0x1e'),_0x203ce1);logger[_0x2090('0xd')]('ShowFreshdeskAccount',_0x203ce1,JSON[_0x2090('0xe')](_0x3ba854));_0x151627(_0x3ba854);})[_0x2090('0x13')](function(_0x2f76ad){logger[_0x2090('0xf')]('ShowFreshdeskAccount',_0x2f76ad[_0x2090('0x11')],_0x203ce1);_0x1f838f(_0x219df7[_0x2090('0xf')](0x1f4,_0x2f76ad[_0x2090('0x11')]));});});}; \ No newline at end of file +var _0xfc38=['FreshdeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowFreshdeskAccount','find','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetFreshdeskAccount'];(function(_0x80ab9e,_0x32c636){var _0x7605e6=function(_0x207f0d){while(--_0x207f0d){_0x80ab9e['push'](_0x80ab9e['shift']());}};_0x7605e6(++_0x32c636);}(_0xfc38,0x98));var _0x8fc3=function(_0x7d12ad,_0x3fd692){_0x7d12ad=_0x7d12ad-0x0;var _0x238278=_0xfc38[_0x7d12ad];return _0x238278;};'use strict';var _=require('lodash');var util=require(_0x8fc3('0x0'));var moment=require('moment');var BPromise=require(_0x8fc3('0x1'));var rs=require(_0x8fc3('0x2'));var fs=require('fs');var Redis=require(_0x8fc3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8fc3('0x4'));var logger=require(_0x8fc3('0x5'))(_0x8fc3('0x6'));var config=require(_0x8fc3('0x7'));var jayson=require(_0x8fc3('0x8'));var client=jayson['client'][_0x8fc3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x370c4f,_0x596b83,_0x2feb74){return new BPromise(function(_0x3e89d7,_0x26a101){return client[_0x8fc3('0xa')](_0x370c4f,_0x2feb74)[_0x8fc3('0xb')](function(_0x3f30d2){logger[_0x8fc3('0xc')](_0x8fc3('0xd'),_0x596b83,'request\x20sent');logger[_0x8fc3('0xe')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x596b83,_0x8fc3('0xf'),JSON[_0x8fc3('0x10')](_0x3f30d2));if(_0x3f30d2[_0x8fc3('0x11')]){if(_0x3f30d2[_0x8fc3('0x11')][_0x8fc3('0x12')]===0x1f4){logger['error'](_0x8fc3('0xd'),_0x596b83,_0x3f30d2[_0x8fc3('0x11')]['message']);return _0x26a101(_0x3f30d2[_0x8fc3('0x11')][_0x8fc3('0x13')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x596b83,_0x3f30d2[_0x8fc3('0x11')]['message']);return _0x3e89d7(_0x3f30d2['error'][_0x8fc3('0x13')]);}else{logger[_0x8fc3('0xc')](_0x8fc3('0xd'),_0x596b83,_0x8fc3('0xf'));_0x3e89d7(_0x3f30d2[_0x8fc3('0x14')]['message']);}})[_0x8fc3('0x15')](function(_0x302d3b){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x596b83,_0x302d3b);_0x26a101(_0x302d3b);});});}exports[_0x8fc3('0x16')]=function(_0xe5fdef){var _0x5092c6=this;return new Promise(function(_0x4ad916,_0x237169){return db[_0x8fc3('0x17')][_0x8fc3('0x18')]({'raw':_0xe5fdef[_0x8fc3('0x19')]?_0xe5fdef['options'][_0x8fc3('0x1a')]===undefined?!![]:![]:!![],'where':_0xe5fdef[_0x8fc3('0x19')]?_0xe5fdef[_0x8fc3('0x19')][_0x8fc3('0x1b')]||null:null,'attributes':_0xe5fdef['options']?_0xe5fdef['options']['attributes']||null:null,'limit':_0xe5fdef[_0x8fc3('0x19')]?_0xe5fdef[_0x8fc3('0x19')][_0x8fc3('0x1c')]||null:null,'include':_0xe5fdef[_0x8fc3('0x19')]?_0xe5fdef[_0x8fc3('0x19')][_0x8fc3('0x1d')]?_[_0x8fc3('0x1e')](_0xe5fdef[_0x8fc3('0x19')][_0x8fc3('0x1d')],function(_0x16485b){return{'model':db[_0x16485b[_0x8fc3('0x1f')]],'as':_0x16485b['as'],'attributes':_0x16485b['attributes'],'include':_0x16485b['include']?_[_0x8fc3('0x1e')](_0x16485b[_0x8fc3('0x1d')],function(_0x57c13d){return{'model':db[_0x57c13d['model']],'as':_0x57c13d['as'],'attributes':_0x57c13d[_0x8fc3('0x20')],'include':_0x57c13d[_0x8fc3('0x1d')]?_['map'](_0x57c13d[_0x8fc3('0x1d')],function(_0x5b4c2e){return{'model':db[_0x5b4c2e[_0x8fc3('0x1f')]],'as':_0x5b4c2e['as'],'attributes':_0x5b4c2e[_0x8fc3('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8fc3('0xb')](function(_0x48b5c4){logger[_0x8fc3('0xc')](_0x8fc3('0x16'),_0xe5fdef);logger[_0x8fc3('0xe')]('GetFreshdeskAccount',_0xe5fdef,JSON[_0x8fc3('0x10')](_0x48b5c4));_0x4ad916(_0x48b5c4);})['catch'](function(_0x26da4e){logger[_0x8fc3('0x11')](_0x8fc3('0x16'),_0x26da4e[_0x8fc3('0x13')],_0xe5fdef);_0x237169(_0x5092c6['error'](0x1f4,_0x26da4e[_0x8fc3('0x13')]));});});};exports[_0x8fc3('0x21')]=function(_0x128a6e){var _0x5a096d=this;return new Promise(function(_0x49687c,_0x421ca5){return db[_0x8fc3('0x17')][_0x8fc3('0x22')]({'raw':_0x128a6e[_0x8fc3('0x19')]?_0x128a6e[_0x8fc3('0x19')][_0x8fc3('0x1a')]===undefined?!![]:![]:!![],'where':_0x128a6e[_0x8fc3('0x19')]?_0x128a6e[_0x8fc3('0x19')][_0x8fc3('0x1b')]||null:null,'attributes':_0x128a6e[_0x8fc3('0x19')]?_0x128a6e[_0x8fc3('0x19')][_0x8fc3('0x20')]||null:null,'include':_0x128a6e[_0x8fc3('0x19')]?_0x128a6e[_0x8fc3('0x19')]['include']?_[_0x8fc3('0x1e')](_0x128a6e[_0x8fc3('0x19')][_0x8fc3('0x1d')],function(_0x200250){return{'model':db[_0x200250[_0x8fc3('0x1f')]],'as':_0x200250['as'],'attributes':_0x200250['attributes'],'include':_0x200250['include']?_[_0x8fc3('0x1e')](_0x200250[_0x8fc3('0x1d')],function(_0x11d1c6){return{'model':db[_0x11d1c6[_0x8fc3('0x1f')]],'as':_0x11d1c6['as'],'attributes':_0x11d1c6['attributes'],'include':_0x11d1c6['include']?_['map'](_0x11d1c6[_0x8fc3('0x1d')],function(_0x22128f){return{'model':db[_0x22128f['model']],'as':_0x22128f['as'],'attributes':_0x22128f[_0x8fc3('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8fc3('0xb')](function(_0x5b9631){logger[_0x8fc3('0xc')](_0x8fc3('0x21'),_0x128a6e);logger['debug'](_0x8fc3('0x21'),_0x128a6e,JSON[_0x8fc3('0x10')](_0x5b9631));_0x49687c(_0x5b9631);})[_0x8fc3('0x15')](function(_0x4d074c){logger['error'](_0x8fc3('0x21'),_0x4d074c[_0x8fc3('0x13')],_0x128a6e);_0x421ca5(_0x5a096d[_0x8fc3('0x11')](0x1f4,_0x4d074c['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 51f4d89..55a8b1e 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 _0x37b9=['/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','delete','destroy','multer','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show'];(function(_0x322f92,_0x11a209){var _0x1a42ee=function(_0x49f740){while(--_0x49f740){_0x322f92['push'](_0x322f92['shift']());}};_0x1a42ee(++_0x11a209);}(_0x37b9,0x1bd));var _0x937b=function(_0x5a4400,_0xfae3b6){_0x5a4400=_0x5a4400-0x0;var _0xf9b532=_0x37b9[_0x5a4400];return _0xf9b532;};'use strict';var multer=require(_0x937b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x937b('0x1'));var express=require(_0x937b('0x2'));var router=express['Router']();var fs_extra=require(_0x937b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x937b('0x4'));var config=require(_0x937b('0x5'));var controller=require(_0x937b('0x6'));router[_0x937b('0x7')]('/',auth[_0x937b('0x8')](),controller['index']);router[_0x937b('0x7')](_0x937b('0x9'),auth[_0x937b('0x8')](),controller[_0x937b('0xa')]);router[_0x937b('0x7')](_0x937b('0xb'),auth[_0x937b('0x8')](),controller[_0x937b('0xc')]);router['get']('/:id/subjects',auth[_0x937b('0x8')](),controller[_0x937b('0xd')]);router[_0x937b('0x7')](_0x937b('0xe'),auth[_0x937b('0x8')](),controller[_0x937b('0xf')]);router['get'](_0x937b('0x10'),auth[_0x937b('0x8')](),controller[_0x937b('0x11')]);router[_0x937b('0x12')]('/',auth['isAuthenticated'](),controller[_0x937b('0x13')]);router[_0x937b('0x12')](_0x937b('0x10'),auth[_0x937b('0x8')](),controller[_0x937b('0x14')]);router[_0x937b('0x15')](_0x937b('0x9'),auth[_0x937b('0x8')](),controller['update']);router[_0x937b('0x16')](_0x937b('0x9'),auth[_0x937b('0x8')](),controller[_0x937b('0x17')]);module['exports']=router; \ No newline at end of file +var _0xa3ad=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0xe174fe,_0x50df01){var _0x333445=function(_0x34d911){while(--_0x34d911){_0xe174fe['push'](_0xe174fe['shift']());}};_0x333445(++_0x50df01);}(_0xa3ad,0x6f));var _0xda3a=function(_0x4f2372,_0x445311){_0x4f2372=_0x4f2372-0x0;var _0x5db736=_0xa3ad[_0x4f2372];return _0x5db736;};'use strict';var multer=require(_0xda3a('0x0'));var util=require(_0xda3a('0x1'));var path=require(_0xda3a('0x2'));var timeout=require(_0xda3a('0x3'));var express=require(_0xda3a('0x4'));var router=express['Router']();var fs_extra=require(_0xda3a('0x5'));var auth=require(_0xda3a('0x6'));var interaction=require(_0xda3a('0x7'));var config=require(_0xda3a('0x8'));var controller=require(_0xda3a('0x9'));router[_0xda3a('0xa')]('/',auth[_0xda3a('0xb')](),controller[_0xda3a('0xc')]);router[_0xda3a('0xa')](_0xda3a('0xd'),auth['isAuthenticated'](),controller[_0xda3a('0xe')]);router[_0xda3a('0xa')](_0xda3a('0xf'),auth[_0xda3a('0xb')](),controller[_0xda3a('0x10')]);router[_0xda3a('0xa')](_0xda3a('0x11'),auth[_0xda3a('0xb')](),controller['getSubjects']);router['get'](_0xda3a('0x12'),auth[_0xda3a('0xb')](),controller[_0xda3a('0x13')]);router[_0xda3a('0xa')](_0xda3a('0x14'),auth[_0xda3a('0xb')](),controller['getTags']);router['post']('/',auth[_0xda3a('0xb')](),controller[_0xda3a('0x15')]);router[_0xda3a('0x16')](_0xda3a('0x14'),auth[_0xda3a('0xb')](),controller[_0xda3a('0x17')]);router[_0xda3a('0x18')]('/:id',auth[_0xda3a('0xb')](),controller[_0xda3a('0x19')]);router[_0xda3a('0x1a')]('/:id',auth[_0xda3a('0xb')](),controller[_0xda3a('0x1b')]);module[_0xda3a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index ab0790d..3c3d1ce 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 _0x1a35=['sequelize','exports','STRING'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1a35,0xc6));var _0x51a3=function(_0x2877fd,_0x221e60){_0x2877fd=_0x2877fd-0x0;var _0x4c0501=_0x1a35[_0x2877fd];return _0x4c0501;};'use strict';var Sequelize=require(_0x51a3('0x0'));module[_0x51a3('0x1')]={'name':{'type':Sequelize[_0x51a3('0x2')]},'description':{'type':Sequelize[_0x51a3('0x2')]}}; \ No newline at end of file +var _0x8705=['exports','STRING','sequelize'];(function(_0x4f21f6,_0x31e150){var _0x3d83c9=function(_0x50f7d0){while(--_0x50f7d0){_0x4f21f6['push'](_0x4f21f6['shift']());}};_0x3d83c9(++_0x31e150);}(_0x8705,0xd4));var _0x5870=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8705[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x5870('0x0'));module[_0x5870('0x1')]={'name':{'type':Sequelize[_0x5870('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 67831cc..9a771a6 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 _0x8e23=['undefined','count','set','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskConfiguration','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x3b4835,_0x217455){var _0x3057f9=function(_0x3917fc){while(--_0x3917fc){_0x3b4835['push'](_0x3b4835['shift']());}};_0x3057f9(++_0x217455);}(_0x8e23,0xdf));var _0x38e2=function(_0x363033,_0x482d4e){_0x363033=_0x363033-0x0;var _0x472b1a=_0x8e23[_0x363033];return _0x472b1a;};'use strict';var emlformat=require(_0x38e2('0x0'));var rimraf=require(_0x38e2('0x1'));var zipdir=require(_0x38e2('0x2'));var jsonpatch=require(_0x38e2('0x3'));var rp=require('request-promise');var moment=require(_0x38e2('0x4'));var BPromise=require(_0x38e2('0x5'));var Mustache=require('mustache');var util=require(_0x38e2('0x6'));var path=require(_0x38e2('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x38e2('0x8'));var fs=require('fs');var fs_extra=require(_0x38e2('0x9'));var _=require(_0x38e2('0xa'));var squel=require(_0x38e2('0xb'));var crypto=require(_0x38e2('0xc'));var jsforce=require(_0x38e2('0xd'));var deskjs=require(_0x38e2('0xe'));var toCsv=require(_0x38e2('0xf'));var querystring=require(_0x38e2('0x10'));var Papa=require(_0x38e2('0x11'));var Redis=require(_0x38e2('0x12'));var authService=require(_0x38e2('0x13'));var qs=require(_0x38e2('0x14'));var as=require(_0x38e2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x38e2('0x16'));var utils=require(_0x38e2('0x17'));var config=require(_0x38e2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x38e2('0x19'))['db'];function respondWithStatusCode(_0x58a6be,_0x2a71b7){_0x2a71b7=_0x2a71b7||0xcc;return function(_0x5f278d){if(_0x5f278d){return _0x58a6be[_0x38e2('0x1a')](_0x2a71b7);}return _0x58a6be[_0x38e2('0x1b')](_0x2a71b7)[_0x38e2('0x1c')]();};}function respondWithResult(_0x114f63,_0x96ca28){_0x96ca28=_0x96ca28||0xc8;return function(_0x1fa728){if(_0x1fa728){return _0x114f63['status'](_0x96ca28)[_0x38e2('0x1d')](_0x1fa728);}};}function respondWithFilteredResult(_0x539c43,_0x2b35de){return function(_0x9a9b){if(_0x9a9b){var _0x1a453c=typeof _0x2b35de[_0x38e2('0x1e')]==='undefined'&&typeof _0x2b35de[_0x38e2('0x1f')]===_0x38e2('0x20');var _0x52adbe=_0x9a9b['count'];var _0x1942cf=_0x1a453c?0x0:_0x2b35de[_0x38e2('0x1e')];var _0x4723b0=_0x1a453c?_0x9a9b[_0x38e2('0x21')]:_0x2b35de[_0x38e2('0x1e')]+_0x2b35de[_0x38e2('0x1f')];var _0x5ee9be;if(_0x4723b0>=_0x52adbe){_0x4723b0=_0x52adbe;_0x5ee9be=0xc8;}else{_0x5ee9be=0xce;}_0x539c43[_0x38e2('0x1b')](_0x5ee9be);return _0x539c43[_0x38e2('0x22')]('Content-Range',_0x1942cf+'-'+_0x4723b0+'/'+_0x52adbe)[_0x38e2('0x1d')](_0x9a9b);}return null;};}function patchUpdates(_0x1587c4){return function(_0x334680){try{jsonpatch['apply'](_0x334680,_0x1587c4,!![]);}catch(_0x1dc94a){return BPromise[_0x38e2('0x23')](_0x1dc94a);}return _0x334680[_0x38e2('0x24')]();};}function saveUpdates(_0x51c2dc,_0x4f05ca){return function(_0x3c59e5){if(_0x3c59e5){return _0x3c59e5['update'](_0x51c2dc)[_0x38e2('0x25')](function(_0x2591c1){return _0x2591c1;});}return null;};}function removeEntity(_0x562452,_0x1cfd17){return function(_0x284f1e){if(_0x284f1e){return _0x284f1e[_0x38e2('0x26')]()['then'](function(){_0x562452[_0x38e2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50d164,_0x178028){return function(_0x4c0b29){if(!_0x4c0b29){_0x50d164['sendStatus'](0x194);}return _0x4c0b29;};}function handleError(_0x10e055,_0x5b4b0c){_0x5b4b0c=_0x5b4b0c||0x1f4;return function(_0x33740b){logger[_0x38e2('0x27')](_0x33740b[_0x38e2('0x28')]);if(_0x33740b[_0x38e2('0x29')]){delete _0x33740b[_0x38e2('0x29')];}_0x10e055['status'](_0x5b4b0c)[_0x38e2('0x2a')](_0x33740b);};}exports['index']=function(_0x4188ad,_0x540a14){var _0xf20e={},_0x254ddc={},_0x1bea3e={'count':0x0,'rows':[]};var _0x7458e9=_[_0x38e2('0x2b')](db['FreshdeskConfiguration'][_0x38e2('0x2c')],function(_0x4e7993){return{'name':_0x4e7993[_0x38e2('0x2d')],'type':_0x4e7993[_0x38e2('0x2e')][_0x38e2('0x2f')]};});_0x254ddc[_0x38e2('0x30')]=_['map'](_0x7458e9,'name');_0x254ddc[_0x38e2('0x31')]=_[_0x38e2('0x32')](_0x4188ad[_0x38e2('0x31')]);_0x254ddc[_0x38e2('0x33')]=_[_0x38e2('0x34')](_0x254ddc['model'],_0x254ddc[_0x38e2('0x31')]);_0xf20e[_0x38e2('0x35')]=_['intersection'](_0x254ddc['model'],qs[_0x38e2('0x36')](_0x4188ad[_0x38e2('0x31')][_0x38e2('0x36')]));_0xf20e[_0x38e2('0x35')]=_0xf20e[_0x38e2('0x35')][_0x38e2('0x37')]?_0xf20e[_0x38e2('0x35')]:_0x254ddc[_0x38e2('0x30')];if(!_0x4188ad[_0x38e2('0x31')][_0x38e2('0x38')](_0x38e2('0x39'))){_0xf20e['limit']=qs[_0x38e2('0x1f')](_0x4188ad['query'][_0x38e2('0x1f')]);_0xf20e[_0x38e2('0x1e')]=qs['offset'](_0x4188ad['query'][_0x38e2('0x1e')]);}_0xf20e[_0x38e2('0x3a')]=qs[_0x38e2('0x3b')](_0x4188ad[_0x38e2('0x31')][_0x38e2('0x3b')]);_0xf20e[_0x38e2('0x3c')]=qs[_0x38e2('0x33')](_[_0x38e2('0x3d')](_0x4188ad[_0x38e2('0x31')],_0x254ddc[_0x38e2('0x33')]),_0x7458e9);if(_0x4188ad[_0x38e2('0x31')][_0x38e2('0x3e')]){_0xf20e[_0x38e2('0x3c')]=_[_0x38e2('0x3f')](_0xf20e[_0x38e2('0x3c')],{'$or':_[_0x38e2('0x2b')](_0x7458e9,function(_0x2aeb03){if(_0x2aeb03['type']!==_0x38e2('0x40')){var _0x440aa9={};_0x440aa9[_0x2aeb03[_0x38e2('0x29')]]={'$like':'%'+_0x4188ad[_0x38e2('0x31')][_0x38e2('0x3e')]+'%'};return _0x440aa9;}})});}_0xf20e=_[_0x38e2('0x3f')]({},_0xf20e,_0x4188ad[_0x38e2('0x41')]);var _0x5464a3={'where':_0xf20e['where']};return db[_0x38e2('0x42')][_0x38e2('0x21')](_0x5464a3)['then'](function(_0x999c5){_0x1bea3e[_0x38e2('0x21')]=_0x999c5;if(_0x4188ad[_0x38e2('0x31')]['includeAll']){_0xf20e[_0x38e2('0x43')]=[{'all':!![]}];}return db[_0x38e2('0x42')][_0x38e2('0x44')](_0xf20e);})[_0x38e2('0x25')](function(_0x219e4d){_0x1bea3e[_0x38e2('0x45')]=_0x219e4d;return _0x1bea3e;})[_0x38e2('0x25')](respondWithFilteredResult(_0x540a14,_0xf20e))[_0x38e2('0x46')](handleError(_0x540a14,null));};exports[_0x38e2('0x47')]=function(_0x34f5ea,_0x478274){var _0x424b33={'raw':![],'where':{'id':_0x34f5ea[_0x38e2('0x48')]['id']}},_0x4f6c07={};_0x4f6c07[_0x38e2('0x30')]=_[_0x38e2('0x32')](db['FreshdeskConfiguration'][_0x38e2('0x2c')]);_0x4f6c07[_0x38e2('0x31')]=_[_0x38e2('0x32')](_0x34f5ea[_0x38e2('0x31')]);_0x4f6c07[_0x38e2('0x33')]=_[_0x38e2('0x34')](_0x4f6c07[_0x38e2('0x30')],_0x4f6c07[_0x38e2('0x31')]);_0x424b33[_0x38e2('0x35')]=_[_0x38e2('0x34')](_0x4f6c07[_0x38e2('0x30')],qs[_0x38e2('0x36')](_0x34f5ea[_0x38e2('0x31')][_0x38e2('0x36')]));_0x424b33[_0x38e2('0x35')]=_0x424b33[_0x38e2('0x35')][_0x38e2('0x37')]?_0x424b33[_0x38e2('0x35')]:_0x4f6c07[_0x38e2('0x30')];if(_0x34f5ea[_0x38e2('0x31')]['includeAll']){_0x424b33[_0x38e2('0x43')]=[{'all':!![]}];}_0x424b33=_[_0x38e2('0x3f')]({},_0x424b33,_0x34f5ea[_0x38e2('0x41')]);return db[_0x38e2('0x42')][_0x38e2('0x49')](_0x424b33)[_0x38e2('0x25')](handleEntityNotFound(_0x478274,null))[_0x38e2('0x25')](respondWithResult(_0x478274,null))[_0x38e2('0x46')](handleError(_0x478274,null));};exports[_0x38e2('0x4a')]=function(_0x5e8b1e,_0x1fa82b){return db[_0x38e2('0x42')][_0x38e2('0x4a')](_0x5e8b1e['body'],{})[_0x38e2('0x25')](respondWithResult(_0x1fa82b,0xc9))[_0x38e2('0x46')](handleError(_0x1fa82b,null));};exports['update']=function(_0x417dbc,_0x7ef3b){if(_0x417dbc[_0x38e2('0x4b')]['id']){delete _0x417dbc[_0x38e2('0x4b')]['id'];}return db['FreshdeskConfiguration'][_0x38e2('0x49')]({'where':{'id':_0x417dbc[_0x38e2('0x48')]['id']}})[_0x38e2('0x25')](handleEntityNotFound(_0x7ef3b,null))[_0x38e2('0x25')](saveUpdates(_0x417dbc['body'],null))['then'](respondWithResult(_0x7ef3b,null))[_0x38e2('0x46')](handleError(_0x7ef3b,null));};exports[_0x38e2('0x26')]=function(_0x4cf47b,_0x5e1408){return db[_0x38e2('0x42')]['find']({'where':{'id':_0x4cf47b[_0x38e2('0x48')]['id']}})[_0x38e2('0x25')](handleEntityNotFound(_0x5e1408,null))[_0x38e2('0x25')](removeEntity(_0x5e1408,null))[_0x38e2('0x46')](handleError(_0x5e1408,null));};exports[_0x38e2('0x4c')]=function(_0x3cd71f,_0x5c60e4,_0x243dec){var _0x2f7b37={};var _0x41aeda={};var _0x35ac9e;var _0x331d1a;return db[_0x38e2('0x42')][_0x38e2('0x4d')]({'where':{'id':_0x3cd71f[_0x38e2('0x48')]['id']}})[_0x38e2('0x25')](handleEntityNotFound(_0x5c60e4,null))['then'](function(_0x3649db){if(_0x3649db){_0x35ac9e=_0x3649db;_0x41aeda['model']=_[_0x38e2('0x32')](db[_0x38e2('0x4e')][_0x38e2('0x2c')]);_0x41aeda['query']=_[_0x38e2('0x32')](_0x3cd71f[_0x38e2('0x31')]);_0x41aeda['filters']=_[_0x38e2('0x34')](_0x41aeda['model'],_0x41aeda[_0x38e2('0x31')]);_0x2f7b37['attributes']=_[_0x38e2('0x34')](_0x41aeda[_0x38e2('0x30')],qs[_0x38e2('0x36')](_0x3cd71f['query'][_0x38e2('0x36')]));_0x2f7b37[_0x38e2('0x35')]=_0x2f7b37[_0x38e2('0x35')]['length']?_0x2f7b37[_0x38e2('0x35')]:_0x41aeda[_0x38e2('0x30')];_0x2f7b37['order']=qs[_0x38e2('0x3b')](_0x3cd71f['query']['sort']);_0x2f7b37['where']=qs[_0x38e2('0x33')](_[_0x38e2('0x3d')](_0x3cd71f[_0x38e2('0x31')],_0x41aeda[_0x38e2('0x33')]));if(_0x3cd71f[_0x38e2('0x31')][_0x38e2('0x3e')]){_0x2f7b37[_0x38e2('0x3c')]=_['merge'](_0x2f7b37[_0x38e2('0x3c')],{'$or':_[_0x38e2('0x2b')](_0x2f7b37[_0x38e2('0x35')],function(_0xb9f82d){var _0x316ef1={};_0x316ef1[_0xb9f82d]={'$like':'%'+_0x3cd71f[_0x38e2('0x31')][_0x38e2('0x3e')]+'%'};return _0x316ef1;})});}_0x2f7b37=_[_0x38e2('0x3f')]({},_0x2f7b37,_0x3cd71f[_0x38e2('0x41')]);return _0x35ac9e[_0x38e2('0x4c')](_0x2f7b37);}})[_0x38e2('0x25')](function(_0x1ef861){if(_0x1ef861){_0x331d1a=_0x1ef861[_0x38e2('0x37')];if(!_0x3cd71f[_0x38e2('0x31')]['hasOwnProperty']('nolimit')){_0x2f7b37['limit']=qs[_0x38e2('0x1f')](_0x3cd71f[_0x38e2('0x31')][_0x38e2('0x1f')]);_0x2f7b37[_0x38e2('0x1e')]=qs[_0x38e2('0x1e')](_0x3cd71f['query'][_0x38e2('0x1e')]);}return _0x35ac9e[_0x38e2('0x4c')](_0x2f7b37);}})[_0x38e2('0x25')](function(_0x205a03){if(_0x205a03){return _0x205a03?{'count':_0x331d1a,'rows':_0x205a03}:null;}})['then'](respondWithResult(_0x5c60e4,null))[_0x38e2('0x46')](handleError(_0x5c60e4,null));};exports[_0x38e2('0x4f')]=function(_0x2a6f43,_0xdd708e,_0x2a6f9e){var _0x130d0e={};var _0x34ea81={};var _0x13c00b;var _0x366740;return db[_0x38e2('0x42')][_0x38e2('0x4d')]({'where':{'id':_0x2a6f43['params']['id']}})[_0x38e2('0x25')](handleEntityNotFound(_0xdd708e,null))[_0x38e2('0x25')](function(_0x2c2dea){if(_0x2c2dea){_0x13c00b=_0x2c2dea;_0x34ea81[_0x38e2('0x30')]=_[_0x38e2('0x32')](db[_0x38e2('0x4e')][_0x38e2('0x2c')]);_0x34ea81['query']=_['keys'](_0x2a6f43[_0x38e2('0x31')]);_0x34ea81[_0x38e2('0x33')]=_[_0x38e2('0x34')](_0x34ea81['model'],_0x34ea81['query']);_0x130d0e['attributes']=_[_0x38e2('0x34')](_0x34ea81['model'],qs['fields'](_0x2a6f43[_0x38e2('0x31')][_0x38e2('0x36')]));_0x130d0e[_0x38e2('0x35')]=_0x130d0e[_0x38e2('0x35')]['length']?_0x130d0e[_0x38e2('0x35')]:_0x34ea81[_0x38e2('0x30')];_0x130d0e['order']=qs[_0x38e2('0x3b')](_0x2a6f43[_0x38e2('0x31')][_0x38e2('0x3b')]);_0x130d0e[_0x38e2('0x3c')]=qs[_0x38e2('0x33')](_[_0x38e2('0x3d')](_0x2a6f43[_0x38e2('0x31')],_0x34ea81[_0x38e2('0x33')]));if(_0x2a6f43[_0x38e2('0x31')][_0x38e2('0x3e')]){_0x130d0e['where']=_[_0x38e2('0x3f')](_0x130d0e['where'],{'$or':_[_0x38e2('0x2b')](_0x130d0e[_0x38e2('0x35')],function(_0x3b73d8){var _0x253f26={};_0x253f26[_0x3b73d8]={'$like':'%'+_0x2a6f43[_0x38e2('0x31')]['filter']+'%'};return _0x253f26;})});}_0x130d0e=_[_0x38e2('0x3f')]({},_0x130d0e,_0x2a6f43[_0x38e2('0x41')]);return _0x13c00b[_0x38e2('0x4f')](_0x130d0e);}})[_0x38e2('0x25')](function(_0x32653c){if(_0x32653c){_0x366740=_0x32653c[_0x38e2('0x37')];if(!_0x2a6f43[_0x38e2('0x31')][_0x38e2('0x38')](_0x38e2('0x39'))){_0x130d0e[_0x38e2('0x1f')]=qs['limit'](_0x2a6f43[_0x38e2('0x31')][_0x38e2('0x1f')]);_0x130d0e[_0x38e2('0x1e')]=qs[_0x38e2('0x1e')](_0x2a6f43[_0x38e2('0x31')][_0x38e2('0x1e')]);}return _0x13c00b['getSubjects'](_0x130d0e);}})[_0x38e2('0x25')](function(_0x22cd21){if(_0x22cd21){return _0x22cd21?{'count':_0x366740,'rows':_0x22cd21}:null;}})['then'](respondWithResult(_0xdd708e,null))[_0x38e2('0x46')](handleError(_0xdd708e,null));};exports['getDescriptions']=function(_0x1e01f9,_0x9db21e,_0x3309ac){var _0x4a440b={};var _0x145b2e={};var _0x30ec27;var _0x1674f9;return db[_0x38e2('0x42')]['findOne']({'where':{'id':_0x1e01f9[_0x38e2('0x48')]['id']}})[_0x38e2('0x25')](handleEntityNotFound(_0x9db21e,null))['then'](function(_0x1022f3){if(_0x1022f3){_0x30ec27=_0x1022f3;_0x145b2e[_0x38e2('0x30')]=_[_0x38e2('0x32')](db['FreshdeskField'][_0x38e2('0x2c')]);_0x145b2e['query']=_[_0x38e2('0x32')](_0x1e01f9['query']);_0x145b2e[_0x38e2('0x33')]=_[_0x38e2('0x34')](_0x145b2e[_0x38e2('0x30')],_0x145b2e[_0x38e2('0x31')]);_0x4a440b[_0x38e2('0x35')]=_[_0x38e2('0x34')](_0x145b2e[_0x38e2('0x30')],qs['fields'](_0x1e01f9['query'][_0x38e2('0x36')]));_0x4a440b['attributes']=_0x4a440b[_0x38e2('0x35')][_0x38e2('0x37')]?_0x4a440b[_0x38e2('0x35')]:_0x145b2e[_0x38e2('0x30')];_0x4a440b['order']=qs['sort'](_0x1e01f9[_0x38e2('0x31')]['sort']);_0x4a440b[_0x38e2('0x3c')]=qs[_0x38e2('0x33')](_[_0x38e2('0x3d')](_0x1e01f9['query'],_0x145b2e['filters']));if(_0x1e01f9[_0x38e2('0x31')][_0x38e2('0x3e')]){_0x4a440b['where']=_[_0x38e2('0x3f')](_0x4a440b[_0x38e2('0x3c')],{'$or':_['map'](_0x4a440b[_0x38e2('0x35')],function(_0x46b1f5){var _0x37b35b={};_0x37b35b[_0x46b1f5]={'$like':'%'+_0x1e01f9[_0x38e2('0x31')][_0x38e2('0x3e')]+'%'};return _0x37b35b;})});}_0x4a440b=_[_0x38e2('0x3f')]({},_0x4a440b,_0x1e01f9[_0x38e2('0x41')]);return _0x30ec27[_0x38e2('0x50')](_0x4a440b);}})[_0x38e2('0x25')](function(_0x3d5b3a){if(_0x3d5b3a){_0x1674f9=_0x3d5b3a[_0x38e2('0x37')];if(!_0x1e01f9[_0x38e2('0x31')]['hasOwnProperty'](_0x38e2('0x39'))){_0x4a440b[_0x38e2('0x1f')]=qs['limit'](_0x1e01f9['query'][_0x38e2('0x1f')]);_0x4a440b['offset']=qs[_0x38e2('0x1e')](_0x1e01f9[_0x38e2('0x31')][_0x38e2('0x1e')]);}return _0x30ec27[_0x38e2('0x50')](_0x4a440b);}})[_0x38e2('0x25')](function(_0x1f4dbf){if(_0x1f4dbf){return _0x1f4dbf?{'count':_0x1674f9,'rows':_0x1f4dbf}:null;}})[_0x38e2('0x25')](respondWithResult(_0x9db21e,null))[_0x38e2('0x46')](handleError(_0x9db21e,null));};exports[_0x38e2('0x51')]=function(_0x21e6ed,_0x3482c7,_0xc9d660){var _0x44a073={};var _0x23d64b={};var _0xfac275;var _0xde208f;return db[_0x38e2('0x42')][_0x38e2('0x4d')]({'where':{'id':_0x21e6ed[_0x38e2('0x48')]['id']}})['then'](handleEntityNotFound(_0x3482c7,null))[_0x38e2('0x25')](function(_0x25fac6){if(_0x25fac6){_0xfac275=_0x25fac6;_0x23d64b[_0x38e2('0x30')]=_[_0x38e2('0x32')](db[_0x38e2('0x52')][_0x38e2('0x2c')]);_0x23d64b['query']=_['keys'](_0x21e6ed[_0x38e2('0x31')]);_0x23d64b['filters']=_[_0x38e2('0x34')](_0x23d64b[_0x38e2('0x30')],_0x23d64b[_0x38e2('0x31')]);_0x44a073['attributes']=_['intersection'](_0x23d64b[_0x38e2('0x30')],qs[_0x38e2('0x36')](_0x21e6ed[_0x38e2('0x31')]['fields']));_0x44a073['attributes']=_0x44a073[_0x38e2('0x35')][_0x38e2('0x37')]?_0x44a073['attributes']:_0x23d64b[_0x38e2('0x30')];_0x44a073[_0x38e2('0x3a')]=qs[_0x38e2('0x3b')](_0x21e6ed[_0x38e2('0x31')][_0x38e2('0x3b')]);_0x44a073[_0x38e2('0x3c')]=qs[_0x38e2('0x33')](_['pick'](_0x21e6ed[_0x38e2('0x31')],_0x23d64b[_0x38e2('0x33')]));if(_0x21e6ed[_0x38e2('0x31')][_0x38e2('0x3e')]){_0x44a073[_0x38e2('0x3c')]=_[_0x38e2('0x3f')](_0x44a073[_0x38e2('0x3c')],{'$or':_[_0x38e2('0x2b')](_0x44a073['attributes'],function(_0x4a8b97){var _0x4ef863={};_0x4ef863[_0x4a8b97]={'$like':'%'+_0x21e6ed[_0x38e2('0x31')]['filter']+'%'};return _0x4ef863;})});}_0x44a073=_['merge']({},_0x44a073,_0x21e6ed['options']);return _0xfac275[_0x38e2('0x51')](_0x44a073);}})[_0x38e2('0x25')](function(_0x5dd9f5){if(_0x5dd9f5){_0xde208f=_0x5dd9f5[_0x38e2('0x37')];if(!_0x21e6ed['query']['hasOwnProperty'](_0x38e2('0x39'))){_0x44a073['limit']=qs[_0x38e2('0x1f')](_0x21e6ed[_0x38e2('0x31')][_0x38e2('0x1f')]);_0x44a073[_0x38e2('0x1e')]=qs['offset'](_0x21e6ed[_0x38e2('0x31')][_0x38e2('0x1e')]);}return _0xfac275[_0x38e2('0x51')](_0x44a073);}})['then'](function(_0x5cfab8){if(_0x5cfab8){return _0x5cfab8?{'count':_0xde208f,'rows':_0x5cfab8}:null;}})['then'](respondWithResult(_0x3482c7,null))[_0x38e2('0x46')](handleError(_0x3482c7,null));};exports[_0x38e2('0x53')]=function(_0x673e72,_0xccf201,_0x33f68f){if(_0x673e72['body']['id']){delete _0x673e72[_0x38e2('0x4b')]['id'];}return db[_0x38e2('0x42')][_0x38e2('0x4d')]({'where':{'id':_0x673e72[_0x38e2('0x48')]['id']}})[_0x38e2('0x25')](handleEntityNotFound(_0xccf201,null))['then'](function(_0x40844f){if(_0x40844f){return _0x40844f[_0x38e2('0x53')](_0x673e72[_0x38e2('0x4b')][_0x38e2('0x54')]||[]);}return null;})['then'](respondWithResult(_0xccf201,null))[_0x38e2('0x46')](handleError(_0xccf201,null));}; \ No newline at end of file +var _0x08b5=['body','getFields','findOne','FreshdeskField','getSubjects','hasOwnProperty','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','offset','undefined','limit','count','status','set','apply','reject','save','update','then','error','stack','name','send','index','map','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','FreshdeskConfiguration','findAll','rows','params','rawAttributes','find','catch','create'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x08b5,0xad));var _0x508b=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x08b5[_0x21549c];return _0x426cbd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x508b('0x0'));var zipdir=require(_0x508b('0x1'));var jsonpatch=require(_0x508b('0x2'));var rp=require(_0x508b('0x3'));var moment=require(_0x508b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x508b('0x5'));var util=require(_0x508b('0x6'));var path=require('path');var sox=require(_0x508b('0x7'));var csv=require(_0x508b('0x8'));var ejs=require(_0x508b('0x9'));var fs=require('fs');var fs_extra=require(_0x508b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x508b('0xb'));var jsforce=require(_0x508b('0xc'));var deskjs=require(_0x508b('0xd'));var toCsv=require(_0x508b('0x8'));var querystring=require(_0x508b('0xe'));var Papa=require('papaparse');var Redis=require(_0x508b('0xf'));var authService=require(_0x508b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x508b('0x11'));var hardwareService=require(_0x508b('0x12'));var logger=require('../../config/logger')(_0x508b('0x13'));var utils=require(_0x508b('0x14'));var config=require(_0x508b('0x15'));var licenseUtil=require(_0x508b('0x16'));var db=require(_0x508b('0x17'))['db'];function respondWithStatusCode(_0x57c248,_0x8d67e4){_0x8d67e4=_0x8d67e4||0xcc;return function(_0x67fab6){if(_0x67fab6){return _0x57c248['sendStatus'](_0x8d67e4);}return _0x57c248['status'](_0x8d67e4)[_0x508b('0x18')]();};}function respondWithResult(_0x4b947f,_0x20b39b){_0x20b39b=_0x20b39b||0xc8;return function(_0x171de8){if(_0x171de8){return _0x4b947f['status'](_0x20b39b)['json'](_0x171de8);}};}function respondWithFilteredResult(_0x3b90d1,_0x796514){return function(_0x1b8861){if(_0x1b8861){var _0x1a8e5f=typeof _0x796514[_0x508b('0x19')]===_0x508b('0x1a')&&typeof _0x796514[_0x508b('0x1b')]===_0x508b('0x1a');var _0x875ba6=_0x1b8861[_0x508b('0x1c')];var _0x4041a6=_0x1a8e5f?0x0:_0x796514[_0x508b('0x19')];var _0x5798b0=_0x1a8e5f?_0x1b8861[_0x508b('0x1c')]:_0x796514[_0x508b('0x19')]+_0x796514[_0x508b('0x1b')];var _0x4c0080;if(_0x5798b0>=_0x875ba6){_0x5798b0=_0x875ba6;_0x4c0080=0xc8;}else{_0x4c0080=0xce;}_0x3b90d1[_0x508b('0x1d')](_0x4c0080);return _0x3b90d1[_0x508b('0x1e')]('Content-Range',_0x4041a6+'-'+_0x5798b0+'/'+_0x875ba6)['json'](_0x1b8861);}return null;};}function patchUpdates(_0x2d1419){return function(_0x514a1b){try{jsonpatch[_0x508b('0x1f')](_0x514a1b,_0x2d1419,!![]);}catch(_0x2b69ba){return BPromise[_0x508b('0x20')](_0x2b69ba);}return _0x514a1b[_0x508b('0x21')]();};}function saveUpdates(_0x5f471d,_0x1bc80d){return function(_0x3821c9){if(_0x3821c9){return _0x3821c9[_0x508b('0x22')](_0x5f471d)['then'](function(_0x187bdc){return _0x187bdc;});}return null;};}function removeEntity(_0x22ab2f,_0x44790c){return function(_0x138217){if(_0x138217){return _0x138217['destroy']()[_0x508b('0x23')](function(){_0x22ab2f[_0x508b('0x1d')](0xcc)[_0x508b('0x18')]();});}};}function handleEntityNotFound(_0x3f3aba,_0x2de10d){return function(_0x59467a){if(!_0x59467a){_0x3f3aba['sendStatus'](0x194);}return _0x59467a;};}function handleError(_0x840e1d,_0x58b442){_0x58b442=_0x58b442||0x1f4;return function(_0x2fd0ea){logger[_0x508b('0x24')](_0x2fd0ea[_0x508b('0x25')]);if(_0x2fd0ea[_0x508b('0x26')]){delete _0x2fd0ea[_0x508b('0x26')];}_0x840e1d[_0x508b('0x1d')](_0x58b442)[_0x508b('0x27')](_0x2fd0ea);};}exports[_0x508b('0x28')]=function(_0x5a03f9,_0x413d88){var _0x5d9dfe={},_0x25f64e={},_0x3b7413={'count':0x0,'rows':[]};var _0x5495d5=_[_0x508b('0x29')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x46868f){return{'name':_0x46868f[_0x508b('0x2a')],'type':_0x46868f[_0x508b('0x2b')]['key']};});_0x25f64e['model']=_[_0x508b('0x29')](_0x5495d5,_0x508b('0x26'));_0x25f64e[_0x508b('0x2c')]=_[_0x508b('0x2d')](_0x5a03f9[_0x508b('0x2c')]);_0x25f64e[_0x508b('0x2e')]=_[_0x508b('0x2f')](_0x25f64e[_0x508b('0x30')],_0x25f64e['query']);_0x5d9dfe[_0x508b('0x31')]=_[_0x508b('0x2f')](_0x25f64e[_0x508b('0x30')],qs[_0x508b('0x32')](_0x5a03f9[_0x508b('0x2c')][_0x508b('0x32')]));_0x5d9dfe['attributes']=_0x5d9dfe[_0x508b('0x31')][_0x508b('0x33')]?_0x5d9dfe['attributes']:_0x25f64e['model'];if(!_0x5a03f9['query']['hasOwnProperty'](_0x508b('0x34'))){_0x5d9dfe['limit']=qs[_0x508b('0x1b')](_0x5a03f9[_0x508b('0x2c')][_0x508b('0x1b')]);_0x5d9dfe[_0x508b('0x19')]=qs[_0x508b('0x19')](_0x5a03f9[_0x508b('0x2c')]['offset']);}_0x5d9dfe[_0x508b('0x35')]=qs[_0x508b('0x36')](_0x5a03f9[_0x508b('0x2c')]['sort']);_0x5d9dfe[_0x508b('0x37')]=qs[_0x508b('0x2e')](_[_0x508b('0x38')](_0x5a03f9['query'],_0x25f64e[_0x508b('0x2e')]),_0x5495d5);if(_0x5a03f9[_0x508b('0x2c')][_0x508b('0x39')]){_0x5d9dfe[_0x508b('0x37')]=_[_0x508b('0x3a')](_0x5d9dfe[_0x508b('0x37')],{'$or':_[_0x508b('0x29')](_0x5495d5,function(_0x5834bb){if(_0x5834bb['type']!=='VIRTUAL'){var _0x2c7f76={};_0x2c7f76[_0x5834bb['name']]={'$like':'%'+_0x5a03f9[_0x508b('0x2c')][_0x508b('0x39')]+'%'};return _0x2c7f76;}})});}_0x5d9dfe=_[_0x508b('0x3a')]({},_0x5d9dfe,_0x5a03f9[_0x508b('0x3b')]);var _0x284999={'where':_0x5d9dfe[_0x508b('0x37')]};return db['FreshdeskConfiguration'][_0x508b('0x1c')](_0x284999)[_0x508b('0x23')](function(_0x5cbcd7){_0x3b7413['count']=_0x5cbcd7;if(_0x5a03f9[_0x508b('0x2c')][_0x508b('0x3c')]){_0x5d9dfe[_0x508b('0x3d')]=[{'all':!![]}];}return db[_0x508b('0x3e')][_0x508b('0x3f')](_0x5d9dfe);})['then'](function(_0x4aba0c){_0x3b7413[_0x508b('0x40')]=_0x4aba0c;return _0x3b7413;})['then'](respondWithFilteredResult(_0x413d88,_0x5d9dfe))['catch'](handleError(_0x413d88,null));};exports['show']=function(_0x473aa6,_0x371e1c){var _0x46bbfb={'raw':![],'where':{'id':_0x473aa6[_0x508b('0x41')]['id']}},_0x181d79={};_0x181d79[_0x508b('0x30')]=_[_0x508b('0x2d')](db[_0x508b('0x3e')][_0x508b('0x42')]);_0x181d79[_0x508b('0x2c')]=_[_0x508b('0x2d')](_0x473aa6[_0x508b('0x2c')]);_0x181d79[_0x508b('0x2e')]=_[_0x508b('0x2f')](_0x181d79[_0x508b('0x30')],_0x181d79[_0x508b('0x2c')]);_0x46bbfb[_0x508b('0x31')]=_[_0x508b('0x2f')](_0x181d79[_0x508b('0x30')],qs[_0x508b('0x32')](_0x473aa6[_0x508b('0x2c')]['fields']));_0x46bbfb['attributes']=_0x46bbfb['attributes'][_0x508b('0x33')]?_0x46bbfb[_0x508b('0x31')]:_0x181d79['model'];if(_0x473aa6[_0x508b('0x2c')]['includeAll']){_0x46bbfb[_0x508b('0x3d')]=[{'all':!![]}];}_0x46bbfb=_[_0x508b('0x3a')]({},_0x46bbfb,_0x473aa6[_0x508b('0x3b')]);return db[_0x508b('0x3e')][_0x508b('0x43')](_0x46bbfb)[_0x508b('0x23')](handleEntityNotFound(_0x371e1c,null))['then'](respondWithResult(_0x371e1c,null))[_0x508b('0x44')](handleError(_0x371e1c,null));};exports[_0x508b('0x45')]=function(_0x1e313a,_0x1aba3a){return db['FreshdeskConfiguration'][_0x508b('0x45')](_0x1e313a[_0x508b('0x46')],{})[_0x508b('0x23')](respondWithResult(_0x1aba3a,0xc9))[_0x508b('0x44')](handleError(_0x1aba3a,null));};exports['update']=function(_0x3f81ba,_0x16fc23){if(_0x3f81ba['body']['id']){delete _0x3f81ba['body']['id'];}return db[_0x508b('0x3e')][_0x508b('0x43')]({'where':{'id':_0x3f81ba['params']['id']}})['then'](handleEntityNotFound(_0x16fc23,null))[_0x508b('0x23')](saveUpdates(_0x3f81ba[_0x508b('0x46')],null))[_0x508b('0x23')](respondWithResult(_0x16fc23,null))[_0x508b('0x44')](handleError(_0x16fc23,null));};exports['destroy']=function(_0x5414a8,_0x476e81){return db[_0x508b('0x3e')]['find']({'where':{'id':_0x5414a8[_0x508b('0x41')]['id']}})[_0x508b('0x23')](handleEntityNotFound(_0x476e81,null))[_0x508b('0x23')](removeEntity(_0x476e81,null))[_0x508b('0x44')](handleError(_0x476e81,null));};exports[_0x508b('0x47')]=function(_0x31d391,_0x3fdc91,_0x263be2){var _0x1298f7={};var _0x5e5fc3={};var _0x68bfef;var _0x2bacae;return db['FreshdeskConfiguration'][_0x508b('0x48')]({'where':{'id':_0x31d391['params']['id']}})[_0x508b('0x23')](handleEntityNotFound(_0x3fdc91,null))[_0x508b('0x23')](function(_0xf979a5){if(_0xf979a5){_0x68bfef=_0xf979a5;_0x5e5fc3['model']=_['keys'](db[_0x508b('0x49')][_0x508b('0x42')]);_0x5e5fc3[_0x508b('0x2c')]=_[_0x508b('0x2d')](_0x31d391[_0x508b('0x2c')]);_0x5e5fc3[_0x508b('0x2e')]=_[_0x508b('0x2f')](_0x5e5fc3[_0x508b('0x30')],_0x5e5fc3[_0x508b('0x2c')]);_0x1298f7[_0x508b('0x31')]=_[_0x508b('0x2f')](_0x5e5fc3[_0x508b('0x30')],qs[_0x508b('0x32')](_0x31d391['query'][_0x508b('0x32')]));_0x1298f7[_0x508b('0x31')]=_0x1298f7['attributes'][_0x508b('0x33')]?_0x1298f7['attributes']:_0x5e5fc3['model'];_0x1298f7[_0x508b('0x35')]=qs[_0x508b('0x36')](_0x31d391[_0x508b('0x2c')][_0x508b('0x36')]);_0x1298f7[_0x508b('0x37')]=qs[_0x508b('0x2e')](_[_0x508b('0x38')](_0x31d391[_0x508b('0x2c')],_0x5e5fc3[_0x508b('0x2e')]));if(_0x31d391['query'][_0x508b('0x39')]){_0x1298f7[_0x508b('0x37')]=_[_0x508b('0x3a')](_0x1298f7['where'],{'$or':_['map'](_0x1298f7[_0x508b('0x31')],function(_0x51a211){var _0x17b436={};_0x17b436[_0x51a211]={'$like':'%'+_0x31d391['query']['filter']+'%'};return _0x17b436;})});}_0x1298f7=_[_0x508b('0x3a')]({},_0x1298f7,_0x31d391[_0x508b('0x3b')]);return _0x68bfef[_0x508b('0x47')](_0x1298f7);}})['then'](function(_0x573495){if(_0x573495){_0x2bacae=_0x573495[_0x508b('0x33')];if(!_0x31d391['query']['hasOwnProperty'](_0x508b('0x34'))){_0x1298f7[_0x508b('0x1b')]=qs[_0x508b('0x1b')](_0x31d391[_0x508b('0x2c')][_0x508b('0x1b')]);_0x1298f7[_0x508b('0x19')]=qs[_0x508b('0x19')](_0x31d391[_0x508b('0x2c')][_0x508b('0x19')]);}return _0x68bfef[_0x508b('0x47')](_0x1298f7);}})[_0x508b('0x23')](function(_0x81102b){if(_0x81102b){return _0x81102b?{'count':_0x2bacae,'rows':_0x81102b}:null;}})[_0x508b('0x23')](respondWithResult(_0x3fdc91,null))[_0x508b('0x44')](handleError(_0x3fdc91,null));};exports[_0x508b('0x4a')]=function(_0x435577,_0x178dcf,_0x1df060){var _0x1fb016={};var _0x140f1b={};var _0x30a950;var _0x354c2a;return db['FreshdeskConfiguration'][_0x508b('0x48')]({'where':{'id':_0x435577[_0x508b('0x41')]['id']}})[_0x508b('0x23')](handleEntityNotFound(_0x178dcf,null))[_0x508b('0x23')](function(_0x1cb5db){if(_0x1cb5db){_0x30a950=_0x1cb5db;_0x140f1b[_0x508b('0x30')]=_[_0x508b('0x2d')](db[_0x508b('0x49')][_0x508b('0x42')]);_0x140f1b[_0x508b('0x2c')]=_[_0x508b('0x2d')](_0x435577[_0x508b('0x2c')]);_0x140f1b[_0x508b('0x2e')]=_[_0x508b('0x2f')](_0x140f1b['model'],_0x140f1b[_0x508b('0x2c')]);_0x1fb016[_0x508b('0x31')]=_[_0x508b('0x2f')](_0x140f1b[_0x508b('0x30')],qs[_0x508b('0x32')](_0x435577[_0x508b('0x2c')][_0x508b('0x32')]));_0x1fb016['attributes']=_0x1fb016[_0x508b('0x31')]['length']?_0x1fb016[_0x508b('0x31')]:_0x140f1b[_0x508b('0x30')];_0x1fb016[_0x508b('0x35')]=qs[_0x508b('0x36')](_0x435577[_0x508b('0x2c')]['sort']);_0x1fb016[_0x508b('0x37')]=qs[_0x508b('0x2e')](_[_0x508b('0x38')](_0x435577[_0x508b('0x2c')],_0x140f1b[_0x508b('0x2e')]));if(_0x435577[_0x508b('0x2c')][_0x508b('0x39')]){_0x1fb016['where']=_['merge'](_0x1fb016[_0x508b('0x37')],{'$or':_['map'](_0x1fb016[_0x508b('0x31')],function(_0x4ba2fe){var _0x3cd430={};_0x3cd430[_0x4ba2fe]={'$like':'%'+_0x435577[_0x508b('0x2c')]['filter']+'%'};return _0x3cd430;})});}_0x1fb016=_['merge']({},_0x1fb016,_0x435577[_0x508b('0x3b')]);return _0x30a950[_0x508b('0x4a')](_0x1fb016);}})['then'](function(_0x14acdb){if(_0x14acdb){_0x354c2a=_0x14acdb[_0x508b('0x33')];if(!_0x435577[_0x508b('0x2c')][_0x508b('0x4b')](_0x508b('0x34'))){_0x1fb016[_0x508b('0x1b')]=qs[_0x508b('0x1b')](_0x435577[_0x508b('0x2c')][_0x508b('0x1b')]);_0x1fb016[_0x508b('0x19')]=qs['offset'](_0x435577['query']['offset']);}return _0x30a950[_0x508b('0x4a')](_0x1fb016);}})['then'](function(_0x1c0cdc){if(_0x1c0cdc){return _0x1c0cdc?{'count':_0x354c2a,'rows':_0x1c0cdc}:null;}})[_0x508b('0x23')](respondWithResult(_0x178dcf,null))['catch'](handleError(_0x178dcf,null));};exports[_0x508b('0x4c')]=function(_0x3f1ab4,_0x29d585,_0x3bf110){var _0x5f3c55={};var _0x9325bc={};var _0x1b428e;var _0x5b0749;return db[_0x508b('0x3e')][_0x508b('0x48')]({'where':{'id':_0x3f1ab4[_0x508b('0x41')]['id']}})[_0x508b('0x23')](handleEntityNotFound(_0x29d585,null))['then'](function(_0x39108){if(_0x39108){_0x1b428e=_0x39108;_0x9325bc[_0x508b('0x30')]=_[_0x508b('0x2d')](db[_0x508b('0x49')][_0x508b('0x42')]);_0x9325bc['query']=_[_0x508b('0x2d')](_0x3f1ab4[_0x508b('0x2c')]);_0x9325bc['filters']=_[_0x508b('0x2f')](_0x9325bc[_0x508b('0x30')],_0x9325bc['query']);_0x5f3c55[_0x508b('0x31')]=_[_0x508b('0x2f')](_0x9325bc['model'],qs['fields'](_0x3f1ab4[_0x508b('0x2c')][_0x508b('0x32')]));_0x5f3c55[_0x508b('0x31')]=_0x5f3c55[_0x508b('0x31')][_0x508b('0x33')]?_0x5f3c55[_0x508b('0x31')]:_0x9325bc[_0x508b('0x30')];_0x5f3c55[_0x508b('0x35')]=qs['sort'](_0x3f1ab4['query']['sort']);_0x5f3c55['where']=qs[_0x508b('0x2e')](_[_0x508b('0x38')](_0x3f1ab4[_0x508b('0x2c')],_0x9325bc['filters']));if(_0x3f1ab4['query'][_0x508b('0x39')]){_0x5f3c55['where']=_[_0x508b('0x3a')](_0x5f3c55[_0x508b('0x37')],{'$or':_[_0x508b('0x29')](_0x5f3c55[_0x508b('0x31')],function(_0x2a21be){var _0x4bc0af={};_0x4bc0af[_0x2a21be]={'$like':'%'+_0x3f1ab4[_0x508b('0x2c')][_0x508b('0x39')]+'%'};return _0x4bc0af;})});}_0x5f3c55=_[_0x508b('0x3a')]({},_0x5f3c55,_0x3f1ab4[_0x508b('0x3b')]);return _0x1b428e['getDescriptions'](_0x5f3c55);}})[_0x508b('0x23')](function(_0xe090fd){if(_0xe090fd){_0x5b0749=_0xe090fd[_0x508b('0x33')];if(!_0x3f1ab4[_0x508b('0x2c')]['hasOwnProperty'](_0x508b('0x34'))){_0x5f3c55[_0x508b('0x1b')]=qs[_0x508b('0x1b')](_0x3f1ab4['query'][_0x508b('0x1b')]);_0x5f3c55[_0x508b('0x19')]=qs['offset'](_0x3f1ab4[_0x508b('0x2c')][_0x508b('0x19')]);}return _0x1b428e[_0x508b('0x4c')](_0x5f3c55);}})[_0x508b('0x23')](function(_0x1c2f41){if(_0x1c2f41){return _0x1c2f41?{'count':_0x5b0749,'rows':_0x1c2f41}:null;}})[_0x508b('0x23')](respondWithResult(_0x29d585,null))['catch'](handleError(_0x29d585,null));};exports[_0x508b('0x4d')]=function(_0x370cd8,_0x4a142c,_0xdbd0ba){var _0x599662={};var _0xc05430={};var _0x4f1204;var _0x5b4831;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x370cd8[_0x508b('0x41')]['id']}})[_0x508b('0x23')](handleEntityNotFound(_0x4a142c,null))[_0x508b('0x23')](function(_0x2bc893){if(_0x2bc893){_0x4f1204=_0x2bc893;_0xc05430[_0x508b('0x30')]=_[_0x508b('0x2d')](db[_0x508b('0x4e')]['rawAttributes']);_0xc05430[_0x508b('0x2c')]=_[_0x508b('0x2d')](_0x370cd8[_0x508b('0x2c')]);_0xc05430[_0x508b('0x2e')]=_[_0x508b('0x2f')](_0xc05430[_0x508b('0x30')],_0xc05430[_0x508b('0x2c')]);_0x599662[_0x508b('0x31')]=_[_0x508b('0x2f')](_0xc05430[_0x508b('0x30')],qs[_0x508b('0x32')](_0x370cd8[_0x508b('0x2c')][_0x508b('0x32')]));_0x599662[_0x508b('0x31')]=_0x599662[_0x508b('0x31')][_0x508b('0x33')]?_0x599662['attributes']:_0xc05430[_0x508b('0x30')];_0x599662[_0x508b('0x35')]=qs['sort'](_0x370cd8[_0x508b('0x2c')][_0x508b('0x36')]);_0x599662[_0x508b('0x37')]=qs['filters'](_['pick'](_0x370cd8['query'],_0xc05430[_0x508b('0x2e')]));if(_0x370cd8[_0x508b('0x2c')][_0x508b('0x39')]){_0x599662['where']=_[_0x508b('0x3a')](_0x599662[_0x508b('0x37')],{'$or':_[_0x508b('0x29')](_0x599662[_0x508b('0x31')],function(_0x46d28a){var _0x1c0b9b={};_0x1c0b9b[_0x46d28a]={'$like':'%'+_0x370cd8[_0x508b('0x2c')][_0x508b('0x39')]+'%'};return _0x1c0b9b;})});}_0x599662=_[_0x508b('0x3a')]({},_0x599662,_0x370cd8[_0x508b('0x3b')]);return _0x4f1204['getTags'](_0x599662);}})[_0x508b('0x23')](function(_0x435fdd){if(_0x435fdd){_0x5b4831=_0x435fdd[_0x508b('0x33')];if(!_0x370cd8['query'][_0x508b('0x4b')](_0x508b('0x34'))){_0x599662[_0x508b('0x1b')]=qs[_0x508b('0x1b')](_0x370cd8['query']['limit']);_0x599662[_0x508b('0x19')]=qs[_0x508b('0x19')](_0x370cd8[_0x508b('0x2c')][_0x508b('0x19')]);}return _0x4f1204[_0x508b('0x4d')](_0x599662);}})[_0x508b('0x23')](function(_0x1dcecc){if(_0x1dcecc){return _0x1dcecc?{'count':_0x5b4831,'rows':_0x1dcecc}:null;}})['then'](respondWithResult(_0x4a142c,null))[_0x508b('0x44')](handleError(_0x4a142c,null));};exports[_0x508b('0x4f')]=function(_0x547823,_0x2c04ac,_0x3d97a7){if(_0x547823[_0x508b('0x46')]['id']){delete _0x547823['body']['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x547823[_0x508b('0x41')]['id']}})[_0x508b('0x23')](handleEntityNotFound(_0x2c04ac,null))[_0x508b('0x23')](function(_0xddb2e0){if(_0xddb2e0){return _0xddb2e0['setTags'](_0x547823['body'][_0x508b('0x50')]||[]);}return null;})[_0x508b('0x23')](respondWithResult(_0x2c04ac,null))[_0x508b('0x44')](handleError(_0x2c04ac,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index ec6d251..bcbac72 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 _0xfeda=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','../../config/logger'];(function(_0x297c01,_0x5cd190){var _0x4fb8ff=function(_0x255757){while(--_0x255757){_0x297c01['push'](_0x297c01['shift']());}};_0x4fb8ff(++_0x5cd190);}(_0xfeda,0x137));var _0xafed=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xfeda[_0x55f8b4];return _0x2475f9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xafed('0x0'))(_0xafed('0x1'));var moment=require('moment');var BPromise=require(_0xafed('0x2'));var rp=require(_0xafed('0x3'));var fs=require('fs');var path=require(_0xafed('0x4'));var rimraf=require(_0xafed('0x5'));var config=require(_0xafed('0x6'));var attributes=require(_0xafed('0x7'));module[_0xafed('0x8')]=function(_0x18bbb2,_0x3b29e0){return _0x18bbb2[_0xafed('0x9')](_0xafed('0xa'),attributes,{'tableName':_0xafed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf383=['request-promise','define','FreshdeskConfiguration','lodash','util','api','moment','bluebird'];(function(_0xa3fadc,_0xd1e16){var _0x23ecb8=function(_0x2c71f7){while(--_0x2c71f7){_0xa3fadc['push'](_0xa3fadc['shift']());}};_0x23ecb8(++_0xd1e16);}(_0xf383,0xbb));var _0x3f38=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xf383[_0x40a825];return _0x273a54;};'use strict';var _=require(_0x3f38('0x0'));var util=require(_0x3f38('0x1'));var logger=require('../../config/logger')(_0x3f38('0x2'));var moment=require(_0x3f38('0x3'));var BPromise=require(_0x3f38('0x4'));var rp=require(_0x3f38('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x23a2fa,_0x1719f4){return _0x23a2fa[_0x3f38('0x6')](_0x3f38('0x7'),attributes,{'tableName':'int_freshdesk_configurations','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 1c13fe0..29d1586 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 _0x7d74=['error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x6a912b,_0xef43c3){var _0x226f7c=function(_0x2d20ea){while(--_0x2d20ea){_0x6a912b['push'](_0x6a912b['shift']());}};_0x226f7c(++_0xef43c3);}(_0x7d74,0xcf));var _0x47d7=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x7d74[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x47d7('0x0'));var util=require('util');var moment=require(_0x47d7('0x1'));var BPromise=require(_0x47d7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47d7('0x3'));var db=require(_0x47d7('0x4'))['db'];var utils=require(_0x47d7('0x5'));var logger=require(_0x47d7('0x6'))(_0x47d7('0x7'));var config=require(_0x47d7('0x8'));var jayson=require(_0x47d7('0x9'));var client=jayson[_0x47d7('0xa')][_0x47d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd27003,_0x3e803f,_0x449d15){return new BPromise(function(_0xf88054,_0x26cfba){return client[_0x47d7('0xc')](_0xd27003,_0x449d15)[_0x47d7('0xd')](function(_0x584e25){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x3e803f,_0x47d7('0xe'));logger[_0x47d7('0xf')](_0x47d7('0x10'),_0x3e803f,_0x47d7('0xe'),JSON[_0x47d7('0x11')](_0x584e25));if(_0x584e25['error']){if(_0x584e25[_0x47d7('0x12')][_0x47d7('0x13')]===0x1f4){logger[_0x47d7('0x12')](_0x47d7('0x14'),_0x3e803f,_0x584e25['error']['message']);return _0x26cfba(_0x584e25[_0x47d7('0x12')]['message']);}logger[_0x47d7('0x12')](_0x47d7('0x14'),_0x3e803f,_0x584e25[_0x47d7('0x12')][_0x47d7('0x15')]);return _0xf88054(_0x584e25[_0x47d7('0x12')]['message']);}else{logger[_0x47d7('0x16')](_0x47d7('0x14'),_0x3e803f,'request\x20sent');_0xf88054(_0x584e25[_0x47d7('0x17')][_0x47d7('0x15')]);}})[_0x47d7('0x18')](function(_0x3d97af){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x3e803f,_0x3d97af);_0x26cfba(_0x3d97af);});});} \ No newline at end of file +var _0xdf8f=['FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5ebf10,_0x164b1d){var _0x3d1bc1=function(_0x2071e2){while(--_0x2071e2){_0x5ebf10['push'](_0x5ebf10['shift']());}};_0x3d1bc1(++_0x164b1d);}(_0xdf8f,0x17e));var _0xfdf8=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdf8f[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0xfdf8('0x0'));var moment=require(_0xfdf8('0x1'));var BPromise=require(_0xfdf8('0x2'));var rs=require(_0xfdf8('0x3'));var fs=require('fs');var Redis=require(_0xfdf8('0x4'));var db=require(_0xfdf8('0x5'))['db'];var utils=require(_0xfdf8('0x6'));var logger=require(_0xfdf8('0x7'))('rpc');var config=require(_0xfdf8('0x8'));var jayson=require(_0xfdf8('0x9'));var client=jayson[_0xfdf8('0xa')][_0xfdf8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x81ce6b,_0x218f3f,_0xf2bfd1){return new BPromise(function(_0x503235,_0x31e90f){return client[_0xfdf8('0xc')](_0x81ce6b,_0xf2bfd1)[_0xfdf8('0xd')](function(_0x5e13e8){logger[_0xfdf8('0xe')](_0xfdf8('0xf'),_0x218f3f,_0xfdf8('0x10'));logger[_0xfdf8('0x11')](_0xfdf8('0x12'),_0x218f3f,'request\x20sent',JSON[_0xfdf8('0x13')](_0x5e13e8));if(_0x5e13e8['error']){if(_0x5e13e8[_0xfdf8('0x14')][_0xfdf8('0x15')]===0x1f4){logger[_0xfdf8('0x14')](_0xfdf8('0xf'),_0x218f3f,_0x5e13e8[_0xfdf8('0x14')][_0xfdf8('0x16')]);return _0x31e90f(_0x5e13e8['error'][_0xfdf8('0x16')]);}logger['error'](_0xfdf8('0xf'),_0x218f3f,_0x5e13e8[_0xfdf8('0x14')][_0xfdf8('0x16')]);return _0x503235(_0x5e13e8[_0xfdf8('0x14')][_0xfdf8('0x16')]);}else{logger[_0xfdf8('0xe')](_0xfdf8('0xf'),_0x218f3f,_0xfdf8('0x10'));_0x503235(_0x5e13e8[_0xfdf8('0x17')][_0xfdf8('0x16')]);}})[_0xfdf8('0x18')](function(_0x488313){logger[_0xfdf8('0x14')](_0xfdf8('0xf'),_0x218f3f,_0x488313);_0x31e90f(_0x488313);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 03ed5bc..8a041fa 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 _0x3936=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','/:id','isAuthenticated','show','post','create','put','destroy','exports'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x3936,0xd0));var _0x6393=function(_0xbb1add,_0x489d26){_0xbb1add=_0xbb1add-0x0;var _0x1620b1=_0x3936[_0xbb1add];return _0x1620b1;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x6393('0x0'));var express=require(_0x6393('0x1'));var router=express[_0x6393('0x2')]();var fs_extra=require(_0x6393('0x3'));var auth=require(_0x6393('0x4'));var interaction=require(_0x6393('0x5'));var config=require(_0x6393('0x6'));var controller=require(_0x6393('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x6393('0x8'),auth[_0x6393('0x9')](),controller[_0x6393('0xa')]);router[_0x6393('0xb')]('/',auth[_0x6393('0x9')](),controller[_0x6393('0xc')]);router[_0x6393('0xd')]('/:id',auth[_0x6393('0x9')](),controller['update']);router['delete'](_0x6393('0x8'),auth[_0x6393('0x9')](),controller[_0x6393('0xe')]);module[_0x6393('0xf')]=router; \ No newline at end of file +var _0x2206=['isAuthenticated','index','get','/:id','post','create','put','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller'];(function(_0xc1fcb,_0x7dfe40){var _0x4b7cdb=function(_0x5ac52c){while(--_0x5ac52c){_0xc1fcb['push'](_0xc1fcb['shift']());}};_0x4b7cdb(++_0x7dfe40);}(_0x2206,0x1f0));var _0x6220=function(_0x1a7f86,_0x5c3b7f){_0x1a7f86=_0x1a7f86-0x0;var _0x4a1549=_0x2206[_0x1a7f86];return _0x4a1549;};'use strict';var multer=require('multer');var util=require(_0x6220('0x0'));var path=require('path');var timeout=require(_0x6220('0x1'));var express=require(_0x6220('0x2'));var router=express[_0x6220('0x3')]();var fs_extra=require(_0x6220('0x4'));var auth=require(_0x6220('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6220('0x6'));var controller=require(_0x6220('0x7'));router['get']('/',auth[_0x6220('0x8')](),controller[_0x6220('0x9')]);router[_0x6220('0xa')](_0x6220('0xb'),auth[_0x6220('0x8')](),controller['show']);router[_0x6220('0xc')]('/',auth['isAuthenticated'](),controller[_0x6220('0xd')]);router[_0x6220('0xe')](_0x6220('0xb'),auth[_0x6220('0x8')](),controller['update']);router[_0x6220('0xf')](_0x6220('0xb'),auth[_0x6220('0x8')](),controller[_0x6220('0x10')]);module[_0x6220('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 6d2056f..ad25e3c 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 _0x2f47=['picklist','STRING','exports','ENUM','string','variable','customVariable'];(function(_0x4abd0b,_0x5b65f1){var _0x5356fc=function(_0x4a10b0){while(--_0x4a10b0){_0x4abd0b['push'](_0x4abd0b['shift']());}};_0x5356fc(++_0x5b65f1);}(_0x2f47,0x1a6));var _0x72f4=function(_0x52bf69,_0x5d797c){_0x52bf69=_0x52bf69-0x0;var _0x370826=_0x2f47[_0x52bf69];return _0x370826;};'use strict';var Sequelize=require('sequelize');module[_0x72f4('0x0')]={'type':{'type':Sequelize[_0x72f4('0x1')](_0x72f4('0x2'),_0x72f4('0x3'),_0x72f4('0x4'),'keyValue',_0x72f4('0x5')),'defaultValue':_0x72f4('0x2')},'content':{'type':Sequelize[_0x72f4('0x6')]},'key':{'type':Sequelize[_0x72f4('0x6')]},'keyType':{'type':Sequelize[_0x72f4('0x1')]('string',_0x72f4('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x72f4('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3c17=['ENUM','string','variable','customVariable','STRING','BOOLEAN','sequelize'];(function(_0x89a7ea,_0x15aa82){var _0x4cdbf0=function(_0x27162d){while(--_0x27162d){_0x89a7ea['push'](_0x89a7ea['shift']());}};_0x4cdbf0(++_0x15aa82);}(_0x3c17,0x14f));var _0x73c1=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3c17[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x73c1('0x0'));module['exports']={'type':{'type':Sequelize[_0x73c1('0x1')](_0x73c1('0x2'),_0x73c1('0x3'),_0x73c1('0x4'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x73c1('0x5')]},'key':{'type':Sequelize[_0x73c1('0x5')]},'keyType':{'type':Sequelize[_0x73c1('0x1')](_0x73c1('0x2'),'variable',_0x73c1('0x4'))},'keyContent':{'type':Sequelize[_0x73c1('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x73c1('0x5')]},'customField':{'type':Sequelize[_0x73c1('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x73c1('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 5153077..82832db 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 _0x8cc8=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','FreshdeskField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','merge','map','VIRTUAL','filter','options','where','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','squel','crypto'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8cc8,0x177));var _0x88cc=function(_0x31aee9,_0x389bb6){_0x31aee9=_0x31aee9-0x0;var _0x4d664d=_0x8cc8[_0x31aee9];return _0x4d664d;};'use strict';var emlformat=require(_0x88cc('0x0'));var rimraf=require(_0x88cc('0x1'));var zipdir=require(_0x88cc('0x2'));var jsonpatch=require(_0x88cc('0x3'));var rp=require(_0x88cc('0x4'));var moment=require(_0x88cc('0x5'));var BPromise=require(_0x88cc('0x6'));var Mustache=require(_0x88cc('0x7'));var util=require(_0x88cc('0x8'));var path=require(_0x88cc('0x9'));var sox=require(_0x88cc('0xa'));var csv=require(_0x88cc('0xb'));var ejs=require(_0x88cc('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x88cc('0xd'));var crypto=require(_0x88cc('0xe'));var jsforce=require(_0x88cc('0xf'));var deskjs=require(_0x88cc('0x10'));var toCsv=require('to-csv');var querystring=require(_0x88cc('0x11'));var Papa=require(_0x88cc('0x12'));var Redis=require('ioredis');var authService=require(_0x88cc('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x88cc('0x14'));var hardwareService=require(_0x88cc('0x15'));var logger=require(_0x88cc('0x16'))(_0x88cc('0x17'));var utils=require('../../config/utils');var config=require(_0x88cc('0x18'));var licenseUtil=require(_0x88cc('0x19'));var db=require(_0x88cc('0x1a'))['db'];function respondWithStatusCode(_0x2219e1,_0x297ca5){_0x297ca5=_0x297ca5||0xcc;return function(_0x1289d0){if(_0x1289d0){return _0x2219e1[_0x88cc('0x1b')](_0x297ca5);}return _0x2219e1[_0x88cc('0x1c')](_0x297ca5)['end']();};}function respondWithResult(_0x20193f,_0x3d1a38){_0x3d1a38=_0x3d1a38||0xc8;return function(_0x3d462b){if(_0x3d462b){return _0x20193f[_0x88cc('0x1c')](_0x3d1a38)[_0x88cc('0x1d')](_0x3d462b);}};}function respondWithFilteredResult(_0x4255bb,_0x49741f){return function(_0x3305f3){if(_0x3305f3){var _0x468101=typeof _0x49741f[_0x88cc('0x1e')]===_0x88cc('0x1f')&&typeof _0x49741f[_0x88cc('0x20')]==='undefined';var _0x30edea=_0x3305f3[_0x88cc('0x21')];var _0x34fb65=_0x468101?0x0:_0x49741f[_0x88cc('0x1e')];var _0x33144a=_0x468101?_0x3305f3['count']:_0x49741f[_0x88cc('0x1e')]+_0x49741f[_0x88cc('0x20')];var _0x5dbfef;if(_0x33144a>=_0x30edea){_0x33144a=_0x30edea;_0x5dbfef=0xc8;}else{_0x5dbfef=0xce;}_0x4255bb[_0x88cc('0x1c')](_0x5dbfef);return _0x4255bb['set'](_0x88cc('0x22'),_0x34fb65+'-'+_0x33144a+'/'+_0x30edea)[_0x88cc('0x1d')](_0x3305f3);}return null;};}function patchUpdates(_0x50cdaf){return function(_0x2cfe2d){try{jsonpatch[_0x88cc('0x23')](_0x2cfe2d,_0x50cdaf,!![]);}catch(_0xe55e9d){return BPromise[_0x88cc('0x24')](_0xe55e9d);}return _0x2cfe2d[_0x88cc('0x25')]();};}function saveUpdates(_0xa2e3eb,_0x4e5edb){return function(_0x155635){if(_0x155635){return _0x155635[_0x88cc('0x26')](_0xa2e3eb)[_0x88cc('0x27')](function(_0xac6e45){return _0xac6e45;});}return null;};}function removeEntity(_0x443631,_0x3c2353){return function(_0x420279){if(_0x420279){return _0x420279[_0x88cc('0x28')]()[_0x88cc('0x27')](function(){_0x443631[_0x88cc('0x1c')](0xcc)[_0x88cc('0x29')]();});}};}function handleEntityNotFound(_0x35c695,_0x22d711){return function(_0x5657ef){if(!_0x5657ef){_0x35c695[_0x88cc('0x1b')](0x194);}return _0x5657ef;};}function handleError(_0x337bab,_0x44ae48){_0x44ae48=_0x44ae48||0x1f4;return function(_0x3474b6){logger[_0x88cc('0x2a')](_0x3474b6[_0x88cc('0x2b')]);if(_0x3474b6[_0x88cc('0x2c')]){delete _0x3474b6[_0x88cc('0x2c')];}_0x337bab['status'](_0x44ae48)['send'](_0x3474b6);};}exports[_0x88cc('0x2d')]=function(_0x45f1c6,_0x1c1d57){var _0x5b77ae={},_0x570ea0={},_0x18ced1={'count':0x0,'rows':[]};var _0x2cc552=_['map'](db[_0x88cc('0x2e')][_0x88cc('0x2f')],function(_0x10248e){return{'name':_0x10248e['fieldName'],'type':_0x10248e[_0x88cc('0x30')][_0x88cc('0x31')]};});_0x570ea0[_0x88cc('0x32')]=_['map'](_0x2cc552,_0x88cc('0x2c'));_0x570ea0[_0x88cc('0x33')]=_[_0x88cc('0x34')](_0x45f1c6[_0x88cc('0x33')]);_0x570ea0[_0x88cc('0x35')]=_[_0x88cc('0x36')](_0x570ea0['model'],_0x570ea0[_0x88cc('0x33')]);_0x5b77ae[_0x88cc('0x37')]=_[_0x88cc('0x36')](_0x570ea0[_0x88cc('0x32')],qs[_0x88cc('0x38')](_0x45f1c6[_0x88cc('0x33')][_0x88cc('0x38')]));_0x5b77ae['attributes']=_0x5b77ae['attributes'][_0x88cc('0x39')]?_0x5b77ae[_0x88cc('0x37')]:_0x570ea0[_0x88cc('0x32')];if(!_0x45f1c6[_0x88cc('0x33')][_0x88cc('0x3a')]('nolimit')){_0x5b77ae[_0x88cc('0x20')]=qs[_0x88cc('0x20')](_0x45f1c6[_0x88cc('0x33')][_0x88cc('0x20')]);_0x5b77ae[_0x88cc('0x1e')]=qs[_0x88cc('0x1e')](_0x45f1c6[_0x88cc('0x33')][_0x88cc('0x1e')]);}_0x5b77ae[_0x88cc('0x3b')]=qs[_0x88cc('0x3c')](_0x45f1c6[_0x88cc('0x33')][_0x88cc('0x3c')]);_0x5b77ae['where']=qs[_0x88cc('0x35')](_[_0x88cc('0x3d')](_0x45f1c6['query'],_0x570ea0[_0x88cc('0x35')]),_0x2cc552);if(_0x45f1c6['query']['filter']){_0x5b77ae['where']=_[_0x88cc('0x3e')](_0x5b77ae['where'],{'$or':_[_0x88cc('0x3f')](_0x2cc552,function(_0x1fb2ca){if(_0x1fb2ca['type']!==_0x88cc('0x40')){var _0x57ecf7={};_0x57ecf7[_0x1fb2ca[_0x88cc('0x2c')]]={'$like':'%'+_0x45f1c6['query'][_0x88cc('0x41')]+'%'};return _0x57ecf7;}})});}_0x5b77ae=_['merge']({},_0x5b77ae,_0x45f1c6[_0x88cc('0x42')]);var _0x35342a={'where':_0x5b77ae[_0x88cc('0x43')]};return db[_0x88cc('0x2e')]['count'](_0x35342a)[_0x88cc('0x27')](function(_0x510e5b){_0x18ced1[_0x88cc('0x21')]=_0x510e5b;if(_0x45f1c6[_0x88cc('0x33')][_0x88cc('0x44')]){_0x5b77ae[_0x88cc('0x45')]=[{'all':!![]}];}return db[_0x88cc('0x2e')][_0x88cc('0x46')](_0x5b77ae);})[_0x88cc('0x27')](function(_0x2138dd){_0x18ced1[_0x88cc('0x47')]=_0x2138dd;return _0x18ced1;})['then'](respondWithFilteredResult(_0x1c1d57,_0x5b77ae))[_0x88cc('0x48')](handleError(_0x1c1d57,null));};exports[_0x88cc('0x49')]=function(_0x1481df,_0x5af511){var _0x188fee={'raw':!![],'where':{'id':_0x1481df[_0x88cc('0x4a')]['id']}},_0x37ad9f={};_0x37ad9f['model']=_[_0x88cc('0x34')](db[_0x88cc('0x2e')][_0x88cc('0x2f')]);_0x37ad9f[_0x88cc('0x33')]=_[_0x88cc('0x34')](_0x1481df['query']);_0x37ad9f[_0x88cc('0x35')]=_[_0x88cc('0x36')](_0x37ad9f[_0x88cc('0x32')],_0x37ad9f[_0x88cc('0x33')]);_0x188fee[_0x88cc('0x37')]=_['intersection'](_0x37ad9f[_0x88cc('0x32')],qs['fields'](_0x1481df['query'][_0x88cc('0x38')]));_0x188fee[_0x88cc('0x37')]=_0x188fee['attributes']['length']?_0x188fee[_0x88cc('0x37')]:_0x37ad9f[_0x88cc('0x32')];if(_0x1481df[_0x88cc('0x33')][_0x88cc('0x44')]){_0x188fee['include']=[{'all':!![]}];}_0x188fee=_[_0x88cc('0x3e')]({},_0x188fee,_0x1481df[_0x88cc('0x42')]);return db[_0x88cc('0x2e')][_0x88cc('0x4b')](_0x188fee)[_0x88cc('0x27')](handleEntityNotFound(_0x5af511,null))[_0x88cc('0x27')](respondWithResult(_0x5af511,null))[_0x88cc('0x48')](handleError(_0x5af511,null));};exports[_0x88cc('0x4c')]=function(_0x14e889,_0x6615dd){return db[_0x88cc('0x2e')]['create'](_0x14e889[_0x88cc('0x4d')],{})[_0x88cc('0x27')](respondWithResult(_0x6615dd,0xc9))[_0x88cc('0x48')](handleError(_0x6615dd,null));};exports['update']=function(_0x2e04e5,_0xdc32cb){if(_0x2e04e5['body']['id']){delete _0x2e04e5[_0x88cc('0x4d')]['id'];}return db[_0x88cc('0x2e')][_0x88cc('0x4b')]({'where':{'id':_0x2e04e5[_0x88cc('0x4a')]['id']}})['then'](handleEntityNotFound(_0xdc32cb,null))[_0x88cc('0x27')](saveUpdates(_0x2e04e5[_0x88cc('0x4d')],null))['then'](respondWithResult(_0xdc32cb,null))[_0x88cc('0x48')](handleError(_0xdc32cb,null));};exports[_0x88cc('0x28')]=function(_0x14912f,_0xa043e){return db[_0x88cc('0x2e')][_0x88cc('0x4b')]({'where':{'id':_0x14912f[_0x88cc('0x4a')]['id']}})[_0x88cc('0x27')](handleEntityNotFound(_0xa043e,null))[_0x88cc('0x27')](removeEntity(_0xa043e,null))[_0x88cc('0x48')](handleError(_0xa043e,null));}; \ No newline at end of file +var _0xf45e=['Content-Range','json','apply','reject','save','destroy','then','sendStatus','stack','index','map','rawAttributes','type','key','model','name','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','FreshdeskField','includeAll','include','findAll','rows','show','params','keys','length','merge','find','create','body','update','catch','eml-format','zip-dir','request-promise','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/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set'];(function(_0x33ba43,_0x398d35){var _0x459f16=function(_0x13294d){while(--_0x13294d){_0x33ba43['push'](_0x33ba43['shift']());}};_0x459f16(++_0x398d35);}(_0xf45e,0x115));var _0xef45=function(_0x833916,_0x3f3ca3){_0x833916=_0x833916-0x0;var _0x489df2=_0xf45e[_0x833916];return _0x489df2;};'use strict';var emlformat=require(_0xef45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef45('0x2'));var moment=require(_0xef45('0x3'));var BPromise=require(_0xef45('0x4'));var Mustache=require(_0xef45('0x5'));var util=require(_0xef45('0x6'));var path=require(_0xef45('0x7'));var sox=require(_0xef45('0x8'));var csv=require(_0xef45('0x9'));var ejs=require(_0xef45('0xa'));var fs=require('fs');var fs_extra=require(_0xef45('0xb'));var _=require(_0xef45('0xc'));var squel=require(_0xef45('0xd'));var crypto=require(_0xef45('0xe'));var jsforce=require(_0xef45('0xf'));var deskjs=require(_0xef45('0x10'));var toCsv=require(_0xef45('0x9'));var querystring=require(_0xef45('0x11'));var Papa=require(_0xef45('0x12'));var Redis=require(_0xef45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef45('0x14'));var as=require(_0xef45('0x15'));var hardwareService=require(_0xef45('0x16'));var logger=require(_0xef45('0x17'))(_0xef45('0x18'));var utils=require(_0xef45('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xef45('0x1a'));var db=require(_0xef45('0x1b'))['db'];function respondWithStatusCode(_0x30babb,_0x433be9){_0x433be9=_0x433be9||0xcc;return function(_0x476739){if(_0x476739){return _0x30babb['sendStatus'](_0x433be9);}return _0x30babb['status'](_0x433be9)[_0xef45('0x1c')]();};}function respondWithResult(_0x47fd96,_0x2ae89a){_0x2ae89a=_0x2ae89a||0xc8;return function(_0xb0fc43){if(_0xb0fc43){return _0x47fd96[_0xef45('0x1d')](_0x2ae89a)['json'](_0xb0fc43);}};}function respondWithFilteredResult(_0x5b3136,_0x29c0c4){return function(_0x5530e6){if(_0x5530e6){var _0x11cd3a=typeof _0x29c0c4[_0xef45('0x1e')]===_0xef45('0x1f')&&typeof _0x29c0c4[_0xef45('0x20')]==='undefined';var _0x560b2f=_0x5530e6[_0xef45('0x21')];var _0x219778=_0x11cd3a?0x0:_0x29c0c4[_0xef45('0x1e')];var _0x258785=_0x11cd3a?_0x5530e6['count']:_0x29c0c4['offset']+_0x29c0c4[_0xef45('0x20')];var _0x20ef26;if(_0x258785>=_0x560b2f){_0x258785=_0x560b2f;_0x20ef26=0xc8;}else{_0x20ef26=0xce;}_0x5b3136[_0xef45('0x1d')](_0x20ef26);return _0x5b3136[_0xef45('0x22')](_0xef45('0x23'),_0x219778+'-'+_0x258785+'/'+_0x560b2f)[_0xef45('0x24')](_0x5530e6);}return null;};}function patchUpdates(_0x375cbd){return function(_0x4a6217){try{jsonpatch[_0xef45('0x25')](_0x4a6217,_0x375cbd,!![]);}catch(_0x3e2a47){return BPromise[_0xef45('0x26')](_0x3e2a47);}return _0x4a6217[_0xef45('0x27')]();};}function saveUpdates(_0x27322f,_0x5205bf){return function(_0x40abc8){if(_0x40abc8){return _0x40abc8['update'](_0x27322f)['then'](function(_0x7707a1){return _0x7707a1;});}return null;};}function removeEntity(_0x2b41d8,_0xbb859b){return function(_0x7817d0){if(_0x7817d0){return _0x7817d0[_0xef45('0x28')]()[_0xef45('0x29')](function(){_0x2b41d8[_0xef45('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x208b35,_0x5f0593){return function(_0x38b470){if(!_0x38b470){_0x208b35[_0xef45('0x2a')](0x194);}return _0x38b470;};}function handleError(_0x578f03,_0x46e423){_0x46e423=_0x46e423||0x1f4;return function(_0x2c356d){logger['error'](_0x2c356d[_0xef45('0x2b')]);if(_0x2c356d['name']){delete _0x2c356d['name'];}_0x578f03['status'](_0x46e423)['send'](_0x2c356d);};}exports[_0xef45('0x2c')]=function(_0x2f72ef,_0x217e8d){var _0x15ad38={},_0x5782d0={},_0x18f304={'count':0x0,'rows':[]};var _0x4f028c=_[_0xef45('0x2d')](db['FreshdeskField'][_0xef45('0x2e')],function(_0x5bfd2d){return{'name':_0x5bfd2d['fieldName'],'type':_0x5bfd2d[_0xef45('0x2f')][_0xef45('0x30')]};});_0x5782d0[_0xef45('0x31')]=_[_0xef45('0x2d')](_0x4f028c,_0xef45('0x32'));_0x5782d0['query']=_['keys'](_0x2f72ef['query']);_0x5782d0[_0xef45('0x33')]=_[_0xef45('0x34')](_0x5782d0[_0xef45('0x31')],_0x5782d0[_0xef45('0x35')]);_0x15ad38[_0xef45('0x36')]=_[_0xef45('0x34')](_0x5782d0[_0xef45('0x31')],qs['fields'](_0x2f72ef['query'][_0xef45('0x37')]));_0x15ad38['attributes']=_0x15ad38[_0xef45('0x36')]['length']?_0x15ad38[_0xef45('0x36')]:_0x5782d0[_0xef45('0x31')];if(!_0x2f72ef[_0xef45('0x35')][_0xef45('0x38')](_0xef45('0x39'))){_0x15ad38['limit']=qs[_0xef45('0x20')](_0x2f72ef[_0xef45('0x35')][_0xef45('0x20')]);_0x15ad38['offset']=qs['offset'](_0x2f72ef[_0xef45('0x35')][_0xef45('0x1e')]);}_0x15ad38['order']=qs[_0xef45('0x3a')](_0x2f72ef['query']['sort']);_0x15ad38[_0xef45('0x3b')]=qs[_0xef45('0x33')](_[_0xef45('0x3c')](_0x2f72ef['query'],_0x5782d0[_0xef45('0x33')]),_0x4f028c);if(_0x2f72ef[_0xef45('0x35')][_0xef45('0x3d')]){_0x15ad38[_0xef45('0x3b')]=_['merge'](_0x15ad38['where'],{'$or':_[_0xef45('0x2d')](_0x4f028c,function(_0x474be1){if(_0x474be1[_0xef45('0x2f')]!==_0xef45('0x3e')){var _0x269a11={};_0x269a11[_0x474be1[_0xef45('0x32')]]={'$like':'%'+_0x2f72ef[_0xef45('0x35')][_0xef45('0x3d')]+'%'};return _0x269a11;}})});}_0x15ad38=_['merge']({},_0x15ad38,_0x2f72ef['options']);var _0x13f8b2={'where':_0x15ad38[_0xef45('0x3b')]};return db[_0xef45('0x3f')][_0xef45('0x21')](_0x13f8b2)[_0xef45('0x29')](function(_0x3bcada){_0x18f304[_0xef45('0x21')]=_0x3bcada;if(_0x2f72ef[_0xef45('0x35')][_0xef45('0x40')]){_0x15ad38[_0xef45('0x41')]=[{'all':!![]}];}return db[_0xef45('0x3f')][_0xef45('0x42')](_0x15ad38);})[_0xef45('0x29')](function(_0xd7d217){_0x18f304[_0xef45('0x43')]=_0xd7d217;return _0x18f304;})[_0xef45('0x29')](respondWithFilteredResult(_0x217e8d,_0x15ad38))['catch'](handleError(_0x217e8d,null));};exports[_0xef45('0x44')]=function(_0x5bdfad,_0x1b9d45){var _0x82c123={'raw':!![],'where':{'id':_0x5bdfad[_0xef45('0x45')]['id']}},_0x54ccb8={};_0x54ccb8['model']=_[_0xef45('0x46')](db['FreshdeskField'][_0xef45('0x2e')]);_0x54ccb8[_0xef45('0x35')]=_[_0xef45('0x46')](_0x5bdfad[_0xef45('0x35')]);_0x54ccb8[_0xef45('0x33')]=_[_0xef45('0x34')](_0x54ccb8[_0xef45('0x31')],_0x54ccb8['query']);_0x82c123[_0xef45('0x36')]=_[_0xef45('0x34')](_0x54ccb8[_0xef45('0x31')],qs[_0xef45('0x37')](_0x5bdfad[_0xef45('0x35')][_0xef45('0x37')]));_0x82c123[_0xef45('0x36')]=_0x82c123[_0xef45('0x36')][_0xef45('0x47')]?_0x82c123[_0xef45('0x36')]:_0x54ccb8[_0xef45('0x31')];if(_0x5bdfad[_0xef45('0x35')][_0xef45('0x40')]){_0x82c123[_0xef45('0x41')]=[{'all':!![]}];}_0x82c123=_[_0xef45('0x48')]({},_0x82c123,_0x5bdfad['options']);return db[_0xef45('0x3f')][_0xef45('0x49')](_0x82c123)[_0xef45('0x29')](handleEntityNotFound(_0x1b9d45,null))['then'](respondWithResult(_0x1b9d45,null))['catch'](handleError(_0x1b9d45,null));};exports['create']=function(_0x29aeab,_0x18143c){return db[_0xef45('0x3f')][_0xef45('0x4a')](_0x29aeab[_0xef45('0x4b')],{})[_0xef45('0x29')](respondWithResult(_0x18143c,0xc9))['catch'](handleError(_0x18143c,null));};exports[_0xef45('0x4c')]=function(_0x463796,_0x2b2419){if(_0x463796['body']['id']){delete _0x463796['body']['id'];}return db[_0xef45('0x3f')][_0xef45('0x49')]({'where':{'id':_0x463796['params']['id']}})[_0xef45('0x29')](handleEntityNotFound(_0x2b2419,null))[_0xef45('0x29')](saveUpdates(_0x463796[_0xef45('0x4b')],null))[_0xef45('0x29')](respondWithResult(_0x2b2419,null))[_0xef45('0x4d')](handleError(_0x2b2419,null));};exports[_0xef45('0x28')]=function(_0x23581f,_0xfa5fdd){return db[_0xef45('0x3f')][_0xef45('0x49')]({'where':{'id':_0x23581f[_0xef45('0x45')]['id']}})[_0xef45('0x29')](handleEntityNotFound(_0xfa5fdd,null))[_0xef45('0x29')](removeEntity(_0xfa5fdd,null))[_0xef45('0x4d')](handleError(_0xfa5fdd,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index b337bea..79c125c 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 _0xadec=['FreshdeskField','freshdesk_unique_index','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x148c57,_0x3a6ac1){var _0x1c7c69=function(_0x32e318){while(--_0x32e318){_0x148c57['push'](_0x148c57['shift']());}};_0x1c7c69(++_0x3a6ac1);}(_0xadec,0x156));var _0xcade=function(_0x2ef3db,_0x43b9eb){_0x2ef3db=_0x2ef3db-0x0;var _0x1fe796=_0xadec[_0x2ef3db];return _0x1fe796;};'use strict';var _=require(_0xcade('0x0'));var util=require(_0xcade('0x1'));var logger=require(_0xcade('0x2'))(_0xcade('0x3'));var moment=require(_0xcade('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcade('0x5'));var config=require(_0xcade('0x6'));var attributes=require(_0xcade('0x7'));module['exports']=function(_0x4da887,_0x5c8b77){return _0x4da887['define'](_0xcade('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xcade('0x9'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a52=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','util'];(function(_0x10b341,_0x5d1992){var _0x3d1596=function(_0x55d517){while(--_0x55d517){_0x10b341['push'](_0x10b341['shift']());}};_0x3d1596(++_0x5d1992);}(_0x4a52,0x15e));var _0x24a5=function(_0x1a7b96,_0x3dff24){_0x1a7b96=_0x1a7b96-0x0;var _0x396926=_0x4a52[_0x1a7b96];return _0x396926;};'use strict';var _=require(_0x24a5('0x0'));var util=require(_0x24a5('0x1'));var logger=require(_0x24a5('0x2'))(_0x24a5('0x3'));var moment=require(_0x24a5('0x4'));var BPromise=require('bluebird');var rp=require(_0x24a5('0x5'));var fs=require('fs');var path=require(_0x24a5('0x6'));var rimraf=require(_0x24a5('0x7'));var config=require(_0x24a5('0x8'));var attributes=require(_0x24a5('0x9'));module[_0x24a5('0xa')]=function(_0x5e824c,_0x572b18){return _0x5e824c[_0x24a5('0xb')](_0x24a5('0xc'),attributes,{'tableName':_0x24a5('0xd'),'paranoid':![],'indexes':[{'name':_0x24a5('0xe'),'fields':['idField',_0x24a5('0xf')],'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 0ab9094..13f7212 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 _0xa480=['jayson/promise','client','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xa480,0x184));var _0x0a48=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0xa480[_0x2e2681];return _0x368a64;};'use strict';var _=require(_0x0a48('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0a48('0x1'));var rs=require(_0x0a48('0x2'));var fs=require('fs');var Redis=require(_0x0a48('0x3'));var db=require(_0x0a48('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a48('0x5'))(_0x0a48('0x6'));var config=require(_0x0a48('0x7'));var jayson=require(_0x0a48('0x8'));var client=jayson[_0x0a48('0x9')][_0x0a48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20bacf,_0x99e9c6,_0x354218){return new BPromise(function(_0x45ae79,_0x5d081f){return client['request'](_0x20bacf,_0x354218)[_0x0a48('0xb')](function(_0x57e820){logger[_0x0a48('0xc')](_0x0a48('0xd'),_0x99e9c6,_0x0a48('0xe'));logger[_0x0a48('0xf')](_0x0a48('0x10'),_0x99e9c6,_0x0a48('0xe'),JSON[_0x0a48('0x11')](_0x57e820));if(_0x57e820['error']){if(_0x57e820[_0x0a48('0x12')][_0x0a48('0x13')]===0x1f4){logger[_0x0a48('0x12')](_0x0a48('0xd'),_0x99e9c6,_0x57e820[_0x0a48('0x12')][_0x0a48('0x14')]);return _0x5d081f(_0x57e820[_0x0a48('0x12')][_0x0a48('0x14')]);}logger[_0x0a48('0x12')](_0x0a48('0xd'),_0x99e9c6,_0x57e820['error'][_0x0a48('0x14')]);return _0x45ae79(_0x57e820[_0x0a48('0x12')]['message']);}else{logger[_0x0a48('0xc')](_0x0a48('0xd'),_0x99e9c6,_0x0a48('0xe'));_0x45ae79(_0x57e820[_0x0a48('0x15')][_0x0a48('0x14')]);}})['catch'](function(_0x5eee95){logger[_0x0a48('0x12')](_0x0a48('0xd'),_0x99e9c6,_0x5eee95);_0x5d081f(_0x5eee95);});});} \ No newline at end of file +var _0x9bee=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x9bee,0x1b9));var _0xe9be=function(_0x4b4141,_0x5c74f1){_0x4b4141=_0x4b4141-0x0;var _0x370fff=_0x9bee[_0x4b4141];return _0x370fff;};'use strict';var _=require(_0xe9be('0x0'));var util=require(_0xe9be('0x1'));var moment=require(_0xe9be('0x2'));var BPromise=require(_0xe9be('0x3'));var rs=require(_0xe9be('0x4'));var fs=require('fs');var Redis=require(_0xe9be('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe9be('0x6'));var logger=require(_0xe9be('0x7'))('rpc');var config=require(_0xe9be('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe9be('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1de0ce,_0x42a0a3,_0x11d9b1){return new BPromise(function(_0x234eff,_0x15ed57){return client[_0xe9be('0xa')](_0x1de0ce,_0x11d9b1)[_0xe9be('0xb')](function(_0x29817e){logger[_0xe9be('0xc')](_0xe9be('0xd'),_0x42a0a3,_0xe9be('0xe'));logger[_0xe9be('0xf')](_0xe9be('0x10'),_0x42a0a3,_0xe9be('0xe'),JSON[_0xe9be('0x11')](_0x29817e));if(_0x29817e[_0xe9be('0x12')]){if(_0x29817e[_0xe9be('0x12')][_0xe9be('0x13')]===0x1f4){logger[_0xe9be('0x12')](_0xe9be('0xd'),_0x42a0a3,_0x29817e[_0xe9be('0x12')][_0xe9be('0x14')]);return _0x15ed57(_0x29817e['error'][_0xe9be('0x14')]);}logger['error'](_0xe9be('0xd'),_0x42a0a3,_0x29817e[_0xe9be('0x12')][_0xe9be('0x14')]);return _0x234eff(_0x29817e[_0xe9be('0x12')][_0xe9be('0x14')]);}else{logger['info'](_0xe9be('0xd'),_0x42a0a3,_0xe9be('0xe'));_0x234eff(_0x29817e[_0xe9be('0x15')]['message']);}})[_0xe9be('0x16')](function(_0x47451c){logger[_0xe9be('0x12')](_0xe9be('0xd'),_0x42a0a3,_0x47451c);_0x15ed57(_0x47451c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 9cc07cc..98d8d88 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 _0x34b7=['getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x34b7,0x196));var _0x734b=function(_0x1ca993,_0x243c1e){_0x1ca993=_0x1ca993-0x0;var _0x150e5e=_0x34b7[_0x1ca993];return _0x150e5e;};'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('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x734b('0x7')]('/:id/fields',auth[_0x734b('0x8')](),controller[_0x734b('0xc')]);router[_0x734b('0xd')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0xe')]);router[_0x734b('0xd')](_0x734b('0xf'),auth[_0x734b('0x8')](),controller[_0x734b('0x10')]);router[_0x734b('0x11')](_0x734b('0xa'),auth[_0x734b('0x8')](),controller[_0x734b('0x12')]);router[_0x734b('0x13')]('/:id',auth[_0x734b('0x8')](),controller[_0x734b('0x14')]);module[_0x734b('0x15')]=router; \ No newline at end of file +var _0xac4a=['show','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','get'];(function(_0x1d89c3,_0x9c8b86){var _0x308a10=function(_0x295c51){while(--_0x295c51){_0x1d89c3['push'](_0x1d89c3['shift']());}};_0x308a10(++_0x9c8b86);}(_0xac4a,0x13f));var _0xaac4=function(_0x112147,_0x3d4906){_0x112147=_0x112147-0x0;var _0x1ef68c=_0xac4a[_0x112147];return _0x1ef68c;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id/configurations',auth[_0xaac4('0x9')](),controller['getConfigurations']);router[_0xaac4('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xd')]('/',auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router[_0xaac4('0xd')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')](_0xaac4('0x11'),auth['isAuthenticated'](),controller[_0xaac4('0x12')]);router[_0xaac4('0x13')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0x14')]);module[_0xaac4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 5293efc..3872035 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 _0x524e=['username','remoteUri','STRING'];(function(_0x7538c5,_0xa5d8ac){var _0x8b56be=function(_0x2036c0){while(--_0x2036c0){_0x7538c5['push'](_0x7538c5['shift']());}};_0x8b56be(++_0xa5d8ac);}(_0x524e,0x15e));var _0xe524=function(_0x5d2b99,_0x2cc6cf){_0x5d2b99=_0x5d2b99-0x0;var _0xe12851=_0x524e[_0x5d2b99];return _0xe12851;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe524('0x0')]},'description':{'type':Sequelize[_0xe524('0x0')]},'username':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x1')},'apiKey':{'type':Sequelize[_0xe524('0x0')]},'remoteUri':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x2')},'serverUrl':{'type':Sequelize[_0xe524('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0xfff0=['username','exports','STRING'];(function(_0x2e8a70,_0x43d2b0){var _0x1ffcdf=function(_0x479f4e){while(--_0x479f4e){_0x2e8a70['push'](_0x2e8a70['shift']());}};_0x1ffcdf(++_0x43d2b0);}(_0xfff0,0x139));var _0x0fff=function(_0x1dbb0a,_0x45afb4){_0x1dbb0a=_0x1dbb0a-0x0;var _0x56d052=_0xfff0[_0x1dbb0a];return _0x56d052;};'use strict';var Sequelize=require('sequelize');module[_0x0fff('0x0')]={'name':{'type':Sequelize[_0x0fff('0x1')]},'description':{'type':Sequelize[_0x0fff('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x0fff('0x2')},'apiKey':{'type':Sequelize[_0x0fff('0x1')]},'remoteUri':{'type':Sequelize[_0x0fff('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x0fff('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index f6f8f59..e46c38c 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 _0x5fe2=['../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','username','remoteUri','slice','substring','GET','/api/selector/owners','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','sox','ejs','lodash','squel','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils'];(function(_0x49a4e3,_0x1cc52e){var _0x1e96be=function(_0x184bdd){while(--_0x184bdd){_0x49a4e3['push'](_0x49a4e3['shift']());}};_0x1e96be(++_0x1cc52e);}(_0x5fe2,0x1df));var _0x25fe=function(_0xe83615,_0x336c25){_0xe83615=_0xe83615-0x0;var _0x201b0b=_0x5fe2[_0xe83615];return _0x201b0b;};'use strict';var emlformat=require(_0x25fe('0x0'));var rimraf=require(_0x25fe('0x1'));var zipdir=require(_0x25fe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x25fe('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x25fe('0x4'));var csv=require('to-csv');var ejs=require(_0x25fe('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x25fe('0x6'));var squel=require(_0x25fe('0x7'));var crypto=require('crypto');var jsforce=require(_0x25fe('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x25fe('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x25fe('0xa'));var authService=require(_0x25fe('0xb'));var qs=require(_0x25fe('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x25fe('0xd'));var logger=require('../../config/logger')(_0x25fe('0xe'));var utils=require(_0x25fe('0xf'));var config=require(_0x25fe('0x10'));var licenseUtil=require(_0x25fe('0x11'));var db=require(_0x25fe('0x12'))['db'];var integrations=require(_0x25fe('0x13'));function respondWithStatusCode(_0x1482ec,_0x4a420b){_0x4a420b=_0x4a420b||0xcc;return function(_0x16fe30){if(_0x16fe30){return _0x1482ec[_0x25fe('0x14')](_0x4a420b);}return _0x1482ec['status'](_0x4a420b)[_0x25fe('0x15')]();};}function respondWithResult(_0x39736d,_0x33a185){_0x33a185=_0x33a185||0xc8;return function(_0x1e2066){if(_0x1e2066){return _0x39736d[_0x25fe('0x16')](_0x33a185)[_0x25fe('0x17')](_0x1e2066);}};}function respondWithFilteredResult(_0x2e86a3,_0x39ba20){return function(_0x6b7d7f){if(_0x6b7d7f){var _0xa2068f=typeof _0x39ba20[_0x25fe('0x18')]===_0x25fe('0x19')&&typeof _0x39ba20[_0x25fe('0x1a')]===_0x25fe('0x19');var _0x2ec098=_0x6b7d7f[_0x25fe('0x1b')];var _0x441b34=_0xa2068f?0x0:_0x39ba20[_0x25fe('0x18')];var _0x1158ef=_0xa2068f?_0x6b7d7f['count']:_0x39ba20[_0x25fe('0x18')]+_0x39ba20['limit'];var _0x46fda9;if(_0x1158ef>=_0x2ec098){_0x1158ef=_0x2ec098;_0x46fda9=0xc8;}else{_0x46fda9=0xce;}_0x2e86a3[_0x25fe('0x16')](_0x46fda9);return _0x2e86a3[_0x25fe('0x1c')](_0x25fe('0x1d'),_0x441b34+'-'+_0x1158ef+'/'+_0x2ec098)[_0x25fe('0x17')](_0x6b7d7f);}return null;};}function patchUpdates(_0x47aff4){return function(_0x537925){try{jsonpatch['apply'](_0x537925,_0x47aff4,!![]);}catch(_0x1bb365){return BPromise[_0x25fe('0x1e')](_0x1bb365);}return _0x537925[_0x25fe('0x1f')]();};}function saveUpdates(_0x36938f,_0x359a96){return function(_0x421661){if(_0x421661){return _0x421661['update'](_0x36938f)['then'](function(_0x191493){return _0x191493;});}return null;};}function removeEntity(_0x103798,_0x3558f6){return function(_0x53cdbe){if(_0x53cdbe){return _0x53cdbe[_0x25fe('0x20')]()[_0x25fe('0x21')](function(){_0x103798['status'](0xcc)[_0x25fe('0x15')]();});}};}function handleEntityNotFound(_0x18d986,_0x5ec09c){return function(_0x32c0df){if(!_0x32c0df){_0x18d986['sendStatus'](0x194);}return _0x32c0df;};}function handleError(_0x4f0ca1,_0x716c1f){_0x716c1f=_0x716c1f||0x1f4;return function(_0x4eed3f){logger[_0x25fe('0x22')](_0x4eed3f[_0x25fe('0x23')]);if(_0x4eed3f[_0x25fe('0x24')]){delete _0x4eed3f['name'];}_0x4f0ca1['status'](_0x716c1f)[_0x25fe('0x25')](_0x4eed3f);};}exports[_0x25fe('0x26')]=function(_0xf1a2e3,_0x1e3782){var _0x42f0af={},_0xd32d12={},_0x4be870={'count':0x0,'rows':[]};var _0x4c5281=_[_0x25fe('0x27')](db[_0x25fe('0x28')][_0x25fe('0x29')],function(_0x30872f){return{'name':_0x30872f[_0x25fe('0x2a')],'type':_0x30872f['type'][_0x25fe('0x2b')]};});_0xd32d12['model']=_[_0x25fe('0x27')](_0x4c5281,_0x25fe('0x24'));_0xd32d12[_0x25fe('0x2c')]=_[_0x25fe('0x2d')](_0xf1a2e3['query']);_0xd32d12['filters']=_[_0x25fe('0x2e')](_0xd32d12[_0x25fe('0x2f')],_0xd32d12['query']);_0x42f0af[_0x25fe('0x30')]=_['intersection'](_0xd32d12[_0x25fe('0x2f')],qs['fields'](_0xf1a2e3[_0x25fe('0x2c')][_0x25fe('0x31')]));_0x42f0af[_0x25fe('0x30')]=_0x42f0af[_0x25fe('0x30')]['length']?_0x42f0af[_0x25fe('0x30')]:_0xd32d12['model'];if(!_0xf1a2e3['query'][_0x25fe('0x32')](_0x25fe('0x33'))){_0x42f0af[_0x25fe('0x1a')]=qs[_0x25fe('0x1a')](_0xf1a2e3['query'][_0x25fe('0x1a')]);_0x42f0af[_0x25fe('0x18')]=qs[_0x25fe('0x18')](_0xf1a2e3[_0x25fe('0x2c')]['offset']);}_0x42f0af['order']=qs[_0x25fe('0x34')](_0xf1a2e3[_0x25fe('0x2c')][_0x25fe('0x34')]);_0x42f0af[_0x25fe('0x35')]=qs[_0x25fe('0x36')](_[_0x25fe('0x37')](_0xf1a2e3['query'],_0xd32d12['filters']),_0x4c5281);if(_0xf1a2e3['query'][_0x25fe('0x38')]){_0x42f0af[_0x25fe('0x35')]=_[_0x25fe('0x39')](_0x42f0af['where'],{'$or':_['map'](_0x4c5281,function(_0x3b0672){if(_0x3b0672[_0x25fe('0x3a')]!=='VIRTUAL'){var _0x5994f0={};_0x5994f0[_0x3b0672[_0x25fe('0x24')]]={'$like':'%'+_0xf1a2e3['query'][_0x25fe('0x38')]+'%'};return _0x5994f0;}})});}_0x42f0af=_[_0x25fe('0x39')]({},_0x42f0af,_0xf1a2e3[_0x25fe('0x3b')]);var _0x7735e3={'where':_0x42f0af[_0x25fe('0x35')]};return db[_0x25fe('0x28')]['count'](_0x7735e3)[_0x25fe('0x21')](function(_0x1da71a){_0x4be870[_0x25fe('0x1b')]=_0x1da71a;if(_0xf1a2e3[_0x25fe('0x2c')][_0x25fe('0x3c')]){_0x42f0af[_0x25fe('0x3d')]=[{'all':!![]}];}return db[_0x25fe('0x28')][_0x25fe('0x3e')](_0x42f0af);})[_0x25fe('0x21')](function(_0x582d24){_0x4be870[_0x25fe('0x3f')]=_0x582d24;return _0x4be870;})[_0x25fe('0x21')](respondWithFilteredResult(_0x1e3782,_0x42f0af))[_0x25fe('0x40')](handleError(_0x1e3782,null));};exports[_0x25fe('0x41')]=function(_0x43e1a2,_0x1d757b){var _0x2af039={'raw':![],'where':{'id':_0x43e1a2[_0x25fe('0x42')]['id']}},_0x2bf88b={};_0x2bf88b['model']=_['keys'](db[_0x25fe('0x28')]['rawAttributes']);_0x2bf88b['query']=_[_0x25fe('0x2d')](_0x43e1a2[_0x25fe('0x2c')]);_0x2bf88b[_0x25fe('0x36')]=_[_0x25fe('0x2e')](_0x2bf88b[_0x25fe('0x2f')],_0x2bf88b[_0x25fe('0x2c')]);_0x2af039[_0x25fe('0x30')]=_[_0x25fe('0x2e')](_0x2bf88b[_0x25fe('0x2f')],qs[_0x25fe('0x31')](_0x43e1a2['query'][_0x25fe('0x31')]));_0x2af039[_0x25fe('0x30')]=_0x2af039[_0x25fe('0x30')][_0x25fe('0x43')]?_0x2af039[_0x25fe('0x30')]:_0x2bf88b['model'];if(_0x43e1a2['query'][_0x25fe('0x3c')]){_0x2af039[_0x25fe('0x3d')]=[{'all':!![]}];}_0x2af039=_[_0x25fe('0x39')]({},_0x2af039,_0x43e1a2[_0x25fe('0x3b')]);return db[_0x25fe('0x28')][_0x25fe('0x44')](_0x2af039)['then'](handleEntityNotFound(_0x1d757b,null))[_0x25fe('0x21')](respondWithResult(_0x1d757b,null))[_0x25fe('0x40')](handleError(_0x1d757b,null));};exports[_0x25fe('0x45')]=function(_0x1a23d7,_0x5445ac){return db[_0x25fe('0x28')][_0x25fe('0x45')](_0x1a23d7[_0x25fe('0x46')],{})[_0x25fe('0x21')](respondWithResult(_0x5445ac,0xc9))[_0x25fe('0x40')](handleError(_0x5445ac,null));};exports[_0x25fe('0x47')]=function(_0x3d61a8,_0x59ecc7){if(_0x3d61a8[_0x25fe('0x46')]['id']){delete _0x3d61a8[_0x25fe('0x46')]['id'];}return db[_0x25fe('0x28')][_0x25fe('0x44')]({'where':{'id':_0x3d61a8[_0x25fe('0x42')]['id']}})['then'](handleEntityNotFound(_0x59ecc7,null))[_0x25fe('0x21')](saveUpdates(_0x3d61a8['body'],null))[_0x25fe('0x21')](respondWithResult(_0x59ecc7,null))[_0x25fe('0x40')](handleError(_0x59ecc7,null));};exports['destroy']=function(_0x437311,_0x2bf3d4){return db[_0x25fe('0x28')][_0x25fe('0x44')]({'where':{'id':_0x437311[_0x25fe('0x42')]['id']}})[_0x25fe('0x21')](handleEntityNotFound(_0x2bf3d4,null))[_0x25fe('0x21')](removeEntity(_0x2bf3d4,null))['catch'](handleError(_0x2bf3d4,null));};exports[_0x25fe('0x48')]=function(_0x424b59,_0x269000,_0x49e615){var _0xb05cc9={};var _0x1bd824={};var _0xe434ef;var _0x1cdc3c;return db['FreshsalesAccount'][_0x25fe('0x49')]({'where':{'id':_0x424b59[_0x25fe('0x42')]['id']}})[_0x25fe('0x21')](handleEntityNotFound(_0x269000,null))[_0x25fe('0x21')](function(_0x30c34a){if(_0x30c34a){_0xe434ef=_0x30c34a;_0x1bd824[_0x25fe('0x2f')]=_['keys'](db[_0x25fe('0x4a')][_0x25fe('0x29')]);_0x1bd824['query']=_['keys'](_0x424b59[_0x25fe('0x2c')]);_0x1bd824[_0x25fe('0x36')]=_[_0x25fe('0x2e')](_0x1bd824[_0x25fe('0x2f')],_0x1bd824[_0x25fe('0x2c')]);_0xb05cc9['attributes']=_[_0x25fe('0x2e')](_0x1bd824[_0x25fe('0x2f')],qs[_0x25fe('0x31')](_0x424b59['query'][_0x25fe('0x31')]));_0xb05cc9[_0x25fe('0x30')]=_0xb05cc9[_0x25fe('0x30')][_0x25fe('0x43')]?_0xb05cc9[_0x25fe('0x30')]:_0x1bd824['model'];_0xb05cc9['order']=qs[_0x25fe('0x34')](_0x424b59['query'][_0x25fe('0x34')]);_0xb05cc9[_0x25fe('0x35')]=qs['filters'](_['pick'](_0x424b59['query'],_0x1bd824[_0x25fe('0x36')]));if(_0x424b59[_0x25fe('0x2c')][_0x25fe('0x38')]){_0xb05cc9['where']=_['merge'](_0xb05cc9['where'],{'$or':_[_0x25fe('0x27')](_0xb05cc9[_0x25fe('0x30')],function(_0x16d393){var _0x1299a3={};_0x1299a3[_0x16d393]={'$like':'%'+_0x424b59[_0x25fe('0x2c')][_0x25fe('0x38')]+'%'};return _0x1299a3;})});}_0xb05cc9=_[_0x25fe('0x39')]({},_0xb05cc9,_0x424b59[_0x25fe('0x3b')]);return _0xe434ef[_0x25fe('0x48')](_0xb05cc9);}})[_0x25fe('0x21')](function(_0xab5eff){if(_0xab5eff){_0x1cdc3c=_0xab5eff['length'];if(!_0x424b59[_0x25fe('0x2c')][_0x25fe('0x32')](_0x25fe('0x33'))){_0xb05cc9['limit']=qs[_0x25fe('0x1a')](_0x424b59['query'][_0x25fe('0x1a')]);_0xb05cc9[_0x25fe('0x18')]=qs[_0x25fe('0x18')](_0x424b59[_0x25fe('0x2c')][_0x25fe('0x18')]);}return _0xe434ef['getConfigurations'](_0xb05cc9);}})[_0x25fe('0x21')](function(_0x1a1ce7){if(_0x1a1ce7){return _0x1a1ce7?{'count':_0x1cdc3c,'rows':_0x1a1ce7}:null;}})['then'](respondWithResult(_0x269000,null))[_0x25fe('0x40')](handleError(_0x269000,null));};exports[_0x25fe('0x4b')]=function(_0x91b288,_0x54aee9,_0x55bbf5){if(_0x91b288['body']['id']){delete _0x91b288[_0x25fe('0x46')]['id'];}return db[_0x25fe('0x28')]['findOne']({'where':{'id':_0x91b288[_0x25fe('0x42')]['id']}})[_0x25fe('0x21')](handleEntityNotFound(_0x54aee9,null))['then'](function(_0x55ae36){if(_0x55ae36){_0x91b288['body'][_0x25fe('0x4c')]=_0x55ae36['id'];_0x91b288[_0x25fe('0x46')]['Subjects']=integrations[_0x25fe('0x4d')](_0x91b288[_0x25fe('0x46')]['channel'],_0x91b288[_0x25fe('0x46')]['type']);_0x91b288['body'][_0x25fe('0x4e')]=integrations[_0x25fe('0x4f')](_0x91b288[_0x25fe('0x46')][_0x25fe('0x50')],_0x91b288[_0x25fe('0x46')]['type']);return db[_0x25fe('0x4a')]['create'](_0x91b288[_0x25fe('0x46')],{'include':[{'model':db[_0x25fe('0x51')],'as':'Subjects'},{'model':db[_0x25fe('0x51')],'as':'Descriptions'}]});}return null;})[_0x25fe('0x21')](respondWithResult(_0x54aee9,null))['catch'](handleError(_0x54aee9,null));};exports['getFields']=function(_0x4154ba,_0x1a7293,_0x16a64a){var _0x53abf2='';var _0x879fac='';return db[_0x25fe('0x28')][_0x25fe('0x49')]({'where':{'id':_0x4154ba[_0x25fe('0x42')]['id']},'attributes':['id','username','remoteUri','apiKey']})[_0x25fe('0x21')](handleEntityNotFound(_0x1a7293,null))['then'](function(_0x4245d6){if(_0x4245d6){_0x879fac=_0x4245d6[_0x25fe('0x52')];_0x53abf2=_0x4245d6['remoteUri'];var _0x1b61c0=_0x4245d6[_0x25fe('0x53')][_0x25fe('0x54')](-0x1);if(_0x1b61c0==='/'){_0x53abf2=_0x53abf2[_0x25fe('0x55')](0x0,_0x53abf2['lastIndexOf'](_0x1b61c0));}return rp({'method':_0x25fe('0x56'),'uri':util['format']('%s%s',_0x53abf2,_0x25fe('0x57')),'headers':{'Authorization':_0x25fe('0x58')+_0x4245d6[_0x25fe('0x59')]},'json':!![]});}})[_0x25fe('0x21')](function(_0x33e3a2){if(_0x33e3a2){var _0x4b6c8e=_0x33e3a2[_0x25fe('0x5a')];var _0x241836=![];var _0xf15500=null;for(_0xf15500=0x0;_0xf15500<_0x4b6c8e[_0x25fe('0x43')];_0xf15500++){if(_0x4b6c8e[_0xf15500][_0x25fe('0x5b')]===_0x879fac){_0x241836=!![];}}if(_0x241836){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x25fe('0x5c')});}}})[_0x25fe('0x21')](respondWithResult(_0x1a7293,null))['catch'](function(_0x31dd18){var _0x330f75=_0x4154ba[_0x25fe('0x2c')][_0x25fe('0x5d')]?0x1f4:_0x31dd18[_0x25fe('0x5e')]||0x1f4;logger[_0x25fe('0x22')](_0x25fe('0x5f'),_0x25fe('0x60'),_0x330f75,JSON[_0x25fe('0x61')](_0x31dd18));delete _0x31dd18['name'];if(_0x330f75===0x191){_0x330f75=0x190;}_0x1a7293['status'](_0x330f75)[_0x25fe('0x25')](_0x4154ba[_0x25fe('0x2c')]['test']?{'message':_0x25fe('0x62'),'statusCode':_0x31dd18[_0x25fe('0x5e')]}:_0x31dd18);});}; \ No newline at end of file +var _0xa7c9=['apiKey','slice','lastIndexOf','GET','Token\x20token=','users','email','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','limit','count','offset','Content-Range','save','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','getConfigurations','findOne','FreshsalesConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri'];(function(_0x22fe66,_0x4afca8){var _0x29e9bb=function(_0x14cc62){while(--_0x14cc62){_0x22fe66['push'](_0x22fe66['shift']());}};_0x29e9bb(++_0x4afca8);}(_0xa7c9,0x134));var _0x9a7c=function(_0x1a5983,_0x4232cd){_0x1a5983=_0x1a5983-0x0;var _0xe48148=_0xa7c9[_0x1a5983];return _0xe48148;};'use strict';var emlformat=require(_0x9a7c('0x0'));var rimraf=require(_0x9a7c('0x1'));var zipdir=require(_0x9a7c('0x2'));var jsonpatch=require(_0x9a7c('0x3'));var rp=require(_0x9a7c('0x4'));var moment=require(_0x9a7c('0x5'));var BPromise=require(_0x9a7c('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9a7c('0x7'));var sox=require('sox');var csv=require(_0x9a7c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a7c('0x9'));var squel=require(_0x9a7c('0xa'));var crypto=require(_0x9a7c('0xb'));var jsforce=require(_0x9a7c('0xc'));var deskjs=require(_0x9a7c('0xd'));var toCsv=require(_0x9a7c('0x8'));var querystring=require(_0x9a7c('0xe'));var Papa=require(_0x9a7c('0xf'));var Redis=require(_0x9a7c('0x10'));var authService=require(_0x9a7c('0x11'));var qs=require(_0x9a7c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a7c('0x13'))(_0x9a7c('0x14'));var utils=require(_0x9a7c('0x15'));var config=require(_0x9a7c('0x16'));var licenseUtil=require(_0x9a7c('0x17'));var db=require(_0x9a7c('0x18'))['db'];var integrations=require(_0x9a7c('0x19'));function respondWithStatusCode(_0x5f30ed,_0x3dcfc4){_0x3dcfc4=_0x3dcfc4||0xcc;return function(_0x51ffc6){if(_0x51ffc6){return _0x5f30ed[_0x9a7c('0x1a')](_0x3dcfc4);}return _0x5f30ed[_0x9a7c('0x1b')](_0x3dcfc4)[_0x9a7c('0x1c')]();};}function respondWithResult(_0x471d4a,_0x3af5bd){_0x3af5bd=_0x3af5bd||0xc8;return function(_0x4de112){if(_0x4de112){return _0x471d4a[_0x9a7c('0x1b')](_0x3af5bd)[_0x9a7c('0x1d')](_0x4de112);}};}function respondWithFilteredResult(_0x3b886d,_0x19945b){return function(_0x28efe5){if(_0x28efe5){var _0x391f60=typeof _0x19945b['offset']==='undefined'&&typeof _0x19945b[_0x9a7c('0x1e')]==='undefined';var _0x398c28=_0x28efe5[_0x9a7c('0x1f')];var _0x39f917=_0x391f60?0x0:_0x19945b[_0x9a7c('0x20')];var _0x14c6dc=_0x391f60?_0x28efe5['count']:_0x19945b['offset']+_0x19945b[_0x9a7c('0x1e')];var _0x367a0c;if(_0x14c6dc>=_0x398c28){_0x14c6dc=_0x398c28;_0x367a0c=0xc8;}else{_0x367a0c=0xce;}_0x3b886d[_0x9a7c('0x1b')](_0x367a0c);return _0x3b886d['set'](_0x9a7c('0x21'),_0x39f917+'-'+_0x14c6dc+'/'+_0x398c28)[_0x9a7c('0x1d')](_0x28efe5);}return null;};}function patchUpdates(_0x1680c){return function(_0x1fa2c6){try{jsonpatch['apply'](_0x1fa2c6,_0x1680c,!![]);}catch(_0x1ae370){return BPromise['reject'](_0x1ae370);}return _0x1fa2c6[_0x9a7c('0x22')]();};}function saveUpdates(_0x138b34,_0x10e4dd){return function(_0x3c4a1e){if(_0x3c4a1e){return _0x3c4a1e['update'](_0x138b34)[_0x9a7c('0x23')](function(_0x4f7cf0){return _0x4f7cf0;});}return null;};}function removeEntity(_0x109538,_0x2f394c){return function(_0xcaca5c){if(_0xcaca5c){return _0xcaca5c[_0x9a7c('0x24')]()['then'](function(){_0x109538[_0x9a7c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x268ac1,_0x4f3a22){return function(_0x22d707){if(!_0x22d707){_0x268ac1['sendStatus'](0x194);}return _0x22d707;};}function handleError(_0x294318,_0x24aba1){_0x24aba1=_0x24aba1||0x1f4;return function(_0x1feaca){logger[_0x9a7c('0x25')](_0x1feaca[_0x9a7c('0x26')]);if(_0x1feaca[_0x9a7c('0x27')]){delete _0x1feaca[_0x9a7c('0x27')];}_0x294318[_0x9a7c('0x1b')](_0x24aba1)[_0x9a7c('0x28')](_0x1feaca);};}exports[_0x9a7c('0x29')]=function(_0x5a3619,_0x211530){var _0x1720b3={},_0x1ad1e7={},_0x3ac964={'count':0x0,'rows':[]};var _0x14f920=_[_0x9a7c('0x2a')](db[_0x9a7c('0x2b')][_0x9a7c('0x2c')],function(_0x9119dd){return{'name':_0x9119dd[_0x9a7c('0x2d')],'type':_0x9119dd[_0x9a7c('0x2e')][_0x9a7c('0x2f')]};});_0x1ad1e7[_0x9a7c('0x30')]=_[_0x9a7c('0x2a')](_0x14f920,_0x9a7c('0x27'));_0x1ad1e7[_0x9a7c('0x31')]=_[_0x9a7c('0x32')](_0x5a3619[_0x9a7c('0x31')]);_0x1ad1e7['filters']=_[_0x9a7c('0x33')](_0x1ad1e7['model'],_0x1ad1e7[_0x9a7c('0x31')]);_0x1720b3[_0x9a7c('0x34')]=_['intersection'](_0x1ad1e7[_0x9a7c('0x30')],qs[_0x9a7c('0x35')](_0x5a3619['query']['fields']));_0x1720b3[_0x9a7c('0x34')]=_0x1720b3[_0x9a7c('0x34')]['length']?_0x1720b3[_0x9a7c('0x34')]:_0x1ad1e7[_0x9a7c('0x30')];if(!_0x5a3619[_0x9a7c('0x31')][_0x9a7c('0x36')]('nolimit')){_0x1720b3[_0x9a7c('0x1e')]=qs[_0x9a7c('0x1e')](_0x5a3619[_0x9a7c('0x31')][_0x9a7c('0x1e')]);_0x1720b3[_0x9a7c('0x20')]=qs[_0x9a7c('0x20')](_0x5a3619[_0x9a7c('0x31')][_0x9a7c('0x20')]);}_0x1720b3[_0x9a7c('0x37')]=qs[_0x9a7c('0x38')](_0x5a3619['query'][_0x9a7c('0x38')]);_0x1720b3[_0x9a7c('0x39')]=qs[_0x9a7c('0x3a')](_[_0x9a7c('0x3b')](_0x5a3619[_0x9a7c('0x31')],_0x1ad1e7[_0x9a7c('0x3a')]),_0x14f920);if(_0x5a3619[_0x9a7c('0x31')][_0x9a7c('0x3c')]){_0x1720b3[_0x9a7c('0x39')]=_['merge'](_0x1720b3[_0x9a7c('0x39')],{'$or':_[_0x9a7c('0x2a')](_0x14f920,function(_0x4554aa){if(_0x4554aa[_0x9a7c('0x2e')]!=='VIRTUAL'){var _0x541969={};_0x541969[_0x4554aa[_0x9a7c('0x27')]]={'$like':'%'+_0x5a3619[_0x9a7c('0x31')][_0x9a7c('0x3c')]+'%'};return _0x541969;}})});}_0x1720b3=_[_0x9a7c('0x3d')]({},_0x1720b3,_0x5a3619[_0x9a7c('0x3e')]);var _0x50ff82={'where':_0x1720b3[_0x9a7c('0x39')]};return db[_0x9a7c('0x2b')]['count'](_0x50ff82)[_0x9a7c('0x23')](function(_0x3cc0ba){_0x3ac964[_0x9a7c('0x1f')]=_0x3cc0ba;if(_0x5a3619[_0x9a7c('0x31')][_0x9a7c('0x3f')]){_0x1720b3[_0x9a7c('0x40')]=[{'all':!![]}];}return db[_0x9a7c('0x2b')][_0x9a7c('0x41')](_0x1720b3);})[_0x9a7c('0x23')](function(_0x3c390d){_0x3ac964[_0x9a7c('0x42')]=_0x3c390d;return _0x3ac964;})[_0x9a7c('0x23')](respondWithFilteredResult(_0x211530,_0x1720b3))[_0x9a7c('0x43')](handleError(_0x211530,null));};exports[_0x9a7c('0x44')]=function(_0x9616e2,_0x3c73ef){var _0x183609={'raw':![],'where':{'id':_0x9616e2[_0x9a7c('0x45')]['id']}},_0x4c3f69={};_0x4c3f69[_0x9a7c('0x30')]=_[_0x9a7c('0x32')](db[_0x9a7c('0x2b')][_0x9a7c('0x2c')]);_0x4c3f69[_0x9a7c('0x31')]=_[_0x9a7c('0x32')](_0x9616e2[_0x9a7c('0x31')]);_0x4c3f69[_0x9a7c('0x3a')]=_[_0x9a7c('0x33')](_0x4c3f69[_0x9a7c('0x30')],_0x4c3f69[_0x9a7c('0x31')]);_0x183609[_0x9a7c('0x34')]=_['intersection'](_0x4c3f69[_0x9a7c('0x30')],qs[_0x9a7c('0x35')](_0x9616e2['query'][_0x9a7c('0x35')]));_0x183609[_0x9a7c('0x34')]=_0x183609[_0x9a7c('0x34')][_0x9a7c('0x46')]?_0x183609[_0x9a7c('0x34')]:_0x4c3f69['model'];if(_0x9616e2[_0x9a7c('0x31')][_0x9a7c('0x3f')]){_0x183609[_0x9a7c('0x40')]=[{'all':!![]}];}_0x183609=_[_0x9a7c('0x3d')]({},_0x183609,_0x9616e2[_0x9a7c('0x3e')]);return db[_0x9a7c('0x2b')]['find'](_0x183609)[_0x9a7c('0x23')](handleEntityNotFound(_0x3c73ef,null))[_0x9a7c('0x23')](respondWithResult(_0x3c73ef,null))[_0x9a7c('0x43')](handleError(_0x3c73ef,null));};exports[_0x9a7c('0x47')]=function(_0x9f758d,_0x28af00){return db[_0x9a7c('0x2b')]['create'](_0x9f758d[_0x9a7c('0x48')],{})[_0x9a7c('0x23')](respondWithResult(_0x28af00,0xc9))[_0x9a7c('0x43')](handleError(_0x28af00,null));};exports[_0x9a7c('0x49')]=function(_0x560940,_0x4de931){if(_0x560940[_0x9a7c('0x48')]['id']){delete _0x560940[_0x9a7c('0x48')]['id'];}return db[_0x9a7c('0x2b')]['find']({'where':{'id':_0x560940[_0x9a7c('0x45')]['id']}})[_0x9a7c('0x23')](handleEntityNotFound(_0x4de931,null))[_0x9a7c('0x23')](saveUpdates(_0x560940[_0x9a7c('0x48')],null))[_0x9a7c('0x23')](respondWithResult(_0x4de931,null))[_0x9a7c('0x43')](handleError(_0x4de931,null));};exports[_0x9a7c('0x24')]=function(_0x1647ea,_0x3e8e2d){return db[_0x9a7c('0x2b')]['find']({'where':{'id':_0x1647ea[_0x9a7c('0x45')]['id']}})['then'](handleEntityNotFound(_0x3e8e2d,null))[_0x9a7c('0x23')](removeEntity(_0x3e8e2d,null))[_0x9a7c('0x43')](handleError(_0x3e8e2d,null));};exports[_0x9a7c('0x4a')]=function(_0x36b37f,_0x1de078,_0x2b4913){var _0x1dbbf6={};var _0x248d2e={};var _0x4ac3c9;var _0x4d11e8;return db['FreshsalesAccount'][_0x9a7c('0x4b')]({'where':{'id':_0x36b37f['params']['id']}})[_0x9a7c('0x23')](handleEntityNotFound(_0x1de078,null))[_0x9a7c('0x23')](function(_0x10f20b){if(_0x10f20b){_0x4ac3c9=_0x10f20b;_0x248d2e[_0x9a7c('0x30')]=_[_0x9a7c('0x32')](db[_0x9a7c('0x4c')]['rawAttributes']);_0x248d2e['query']=_[_0x9a7c('0x32')](_0x36b37f[_0x9a7c('0x31')]);_0x248d2e[_0x9a7c('0x3a')]=_[_0x9a7c('0x33')](_0x248d2e['model'],_0x248d2e[_0x9a7c('0x31')]);_0x1dbbf6[_0x9a7c('0x34')]=_[_0x9a7c('0x33')](_0x248d2e[_0x9a7c('0x30')],qs[_0x9a7c('0x35')](_0x36b37f[_0x9a7c('0x31')][_0x9a7c('0x35')]));_0x1dbbf6['attributes']=_0x1dbbf6[_0x9a7c('0x34')][_0x9a7c('0x46')]?_0x1dbbf6[_0x9a7c('0x34')]:_0x248d2e[_0x9a7c('0x30')];_0x1dbbf6['order']=qs[_0x9a7c('0x38')](_0x36b37f[_0x9a7c('0x31')][_0x9a7c('0x38')]);_0x1dbbf6[_0x9a7c('0x39')]=qs['filters'](_[_0x9a7c('0x3b')](_0x36b37f['query'],_0x248d2e['filters']));if(_0x36b37f['query']['filter']){_0x1dbbf6[_0x9a7c('0x39')]=_['merge'](_0x1dbbf6[_0x9a7c('0x39')],{'$or':_['map'](_0x1dbbf6[_0x9a7c('0x34')],function(_0x574177){var _0x3d7113={};_0x3d7113[_0x574177]={'$like':'%'+_0x36b37f['query'][_0x9a7c('0x3c')]+'%'};return _0x3d7113;})});}_0x1dbbf6=_[_0x9a7c('0x3d')]({},_0x1dbbf6,_0x36b37f[_0x9a7c('0x3e')]);return _0x4ac3c9[_0x9a7c('0x4a')](_0x1dbbf6);}})[_0x9a7c('0x23')](function(_0x449e39){if(_0x449e39){_0x4d11e8=_0x449e39[_0x9a7c('0x46')];if(!_0x36b37f[_0x9a7c('0x31')][_0x9a7c('0x36')](_0x9a7c('0x4d'))){_0x1dbbf6[_0x9a7c('0x1e')]=qs[_0x9a7c('0x1e')](_0x36b37f['query'][_0x9a7c('0x1e')]);_0x1dbbf6[_0x9a7c('0x20')]=qs[_0x9a7c('0x20')](_0x36b37f[_0x9a7c('0x31')][_0x9a7c('0x20')]);}return _0x4ac3c9[_0x9a7c('0x4a')](_0x1dbbf6);}})['then'](function(_0x2a5a34){if(_0x2a5a34){return _0x2a5a34?{'count':_0x4d11e8,'rows':_0x2a5a34}:null;}})[_0x9a7c('0x23')](respondWithResult(_0x1de078,null))[_0x9a7c('0x43')](handleError(_0x1de078,null));};exports[_0x9a7c('0x4e')]=function(_0x2818cd,_0x4a73c7,_0x13edd6){if(_0x2818cd[_0x9a7c('0x48')]['id']){delete _0x2818cd[_0x9a7c('0x48')]['id'];}return db[_0x9a7c('0x2b')][_0x9a7c('0x4b')]({'where':{'id':_0x2818cd[_0x9a7c('0x45')]['id']}})['then'](handleEntityNotFound(_0x4a73c7,null))[_0x9a7c('0x23')](function(_0x43692f){if(_0x43692f){_0x2818cd['body'][_0x9a7c('0x4f')]=_0x43692f['id'];_0x2818cd[_0x9a7c('0x48')][_0x9a7c('0x50')]=integrations[_0x9a7c('0x51')](_0x2818cd['body'][_0x9a7c('0x52')],_0x2818cd['body'][_0x9a7c('0x2e')]);_0x2818cd[_0x9a7c('0x48')][_0x9a7c('0x53')]=integrations['getDescriptions'](_0x2818cd[_0x9a7c('0x48')]['channel'],_0x2818cd[_0x9a7c('0x48')][_0x9a7c('0x2e')]);return db[_0x9a7c('0x4c')][_0x9a7c('0x47')](_0x2818cd[_0x9a7c('0x48')],{'include':[{'model':db[_0x9a7c('0x54')],'as':_0x9a7c('0x50')},{'model':db[_0x9a7c('0x54')],'as':_0x9a7c('0x53')}]});}return null;})[_0x9a7c('0x23')](respondWithResult(_0x4a73c7,null))[_0x9a7c('0x43')](handleError(_0x4a73c7,null));};exports[_0x9a7c('0x55')]=function(_0x14470a,_0x28a0c3,_0x1fa473){var _0x1ceb4b='';var _0x28bb32='';return db[_0x9a7c('0x2b')][_0x9a7c('0x4b')]({'where':{'id':_0x14470a['params']['id']},'attributes':['id',_0x9a7c('0x56'),_0x9a7c('0x57'),_0x9a7c('0x58')]})[_0x9a7c('0x23')](handleEntityNotFound(_0x28a0c3,null))[_0x9a7c('0x23')](function(_0x316492){if(_0x316492){_0x28bb32=_0x316492['username'];_0x1ceb4b=_0x316492[_0x9a7c('0x57')];var _0x3bb529=_0x316492[_0x9a7c('0x57')][_0x9a7c('0x59')](-0x1);if(_0x3bb529==='/'){_0x1ceb4b=_0x1ceb4b['substring'](0x0,_0x1ceb4b[_0x9a7c('0x5a')](_0x3bb529));}return rp({'method':_0x9a7c('0x5b'),'uri':util['format']('%s%s',_0x1ceb4b,'/api/selector/owners'),'headers':{'Authorization':_0x9a7c('0x5c')+_0x316492[_0x9a7c('0x58')]},'json':!![]});}})[_0x9a7c('0x23')](function(_0x5cc18f){if(_0x5cc18f){var _0x18d883=_0x5cc18f[_0x9a7c('0x5d')];var _0xc61cf=![];var _0x201b2e=null;for(_0x201b2e=0x0;_0x201b2e<_0x18d883['length'];_0x201b2e++){if(_0x18d883[_0x201b2e][_0x9a7c('0x5e')]===_0x28bb32){_0xc61cf=!![];}}if(_0xc61cf){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x9a7c('0x23')](respondWithResult(_0x28a0c3,null))[_0x9a7c('0x43')](function(_0x3243f6){var _0x26e6f3=_0x14470a[_0x9a7c('0x31')]['test']?0x1f4:_0x3243f6[_0x9a7c('0x5f')]||0x1f4;logger[_0x9a7c('0x25')](_0x9a7c('0x60'),_0x9a7c('0x55'),_0x26e6f3,JSON[_0x9a7c('0x61')](_0x3243f6));delete _0x3243f6[_0x9a7c('0x27')];if(_0x26e6f3===0x191){_0x26e6f3=0x190;}_0x28a0c3[_0x9a7c('0x1b')](_0x26e6f3)[_0x9a7c('0x28')](_0x14470a['query'][_0x9a7c('0x62')]?{'message':'Wrong\x20credentials','statusCode':_0x3243f6[_0x9a7c('0x5f')]}:_0x3243f6);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index f2561de..c05b234 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 _0x1a37=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','FreshsalesAccount','lodash','util'];(function(_0xa63ea3,_0x4367ff){var _0x2aa5ff=function(_0x30dc84){while(--_0x30dc84){_0xa63ea3['push'](_0xa63ea3['shift']());}};_0x2aa5ff(++_0x4367ff);}(_0x1a37,0xb4));var _0x71a3=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x1a37[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var logger=require(_0x71a3('0x2'))(_0x71a3('0x3'));var moment=require(_0x71a3('0x4'));var BPromise=require(_0x71a3('0x5'));var rp=require(_0x71a3('0x6'));var fs=require('fs');var path=require(_0x71a3('0x7'));var rimraf=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x71a3('0xa'));module['exports']=function(_0xd09f7,_0x45050a){return _0xd09f7[_0x71a3('0xb')](_0x71a3('0xc'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32f4=['define','FreshsalesAccount','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x458435,_0x1b0c50){var _0x15d841=function(_0x6232e4){while(--_0x6232e4){_0x458435['push'](_0x458435['shift']());}};_0x15d841(++_0x1b0c50);}(_0x32f4,0x154));var _0x432f=function(_0x413841,_0x38933d){_0x413841=_0x413841-0x0;var _0x4907d0=_0x32f4[_0x413841];return _0x4907d0;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var logger=require(_0x432f('0x2'))(_0x432f('0x3'));var moment=require('moment');var BPromise=require(_0x432f('0x4'));var rp=require(_0x432f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var attributes=require(_0x432f('0x8'));var integrations=require(_0x432f('0x9'));module[_0x432f('0xa')]=function(_0x5d8cc0,_0x5b5f08){return _0x5d8cc0[_0x432f('0xb')](_0x432f('0xc'),attributes,{'tableName':'int_freshsales_accounts','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 c7c6e4d..95769c5 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 _0x82c4=['findAll','options','raw','attributes','include','map','model','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshsalesAccount'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x82c4,0x1ca));var _0x482c=function(_0x18515d,_0x5c442b){_0x18515d=_0x18515d-0x0;var _0x175db2=_0x82c4[_0x18515d];return _0x175db2;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var moment=require(_0x482c('0x2'));var BPromise=require(_0x482c('0x3'));var rs=require(_0x482c('0x4'));var fs=require('fs');var Redis=require(_0x482c('0x5'));var db=require(_0x482c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x482c('0x7'))('rpc');var config=require(_0x482c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x482c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfdb92,_0x32a503,_0x35cdab){return new BPromise(function(_0x1c10f2,_0x3846d8){return client['request'](_0xfdb92,_0x35cdab)[_0x482c('0xa')](function(_0x135cc1){logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));logger[_0x482c('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x32a503,_0x482c('0xd'),JSON[_0x482c('0xf')](_0x135cc1));if(_0x135cc1[_0x482c('0x10')]){if(_0x135cc1['error'][_0x482c('0x11')]===0x1f4){logger[_0x482c('0x10')](_0x482c('0xc'),_0x32a503,_0x135cc1['error']['message']);return _0x3846d8(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x32a503,_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);return _0x1c10f2(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}else{logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));_0x1c10f2(_0x135cc1[_0x482c('0x13')][_0x482c('0x12')]);}})[_0x482c('0x14')](function(_0x363403){logger[_0x482c('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x32a503,_0x363403);_0x3846d8(_0x363403);});});}exports[_0x482c('0x15')]=function(_0x5b6f7e){var _0x3aed45=this;return new Promise(function(_0x258148,_0x4af05a){return db['FreshsalesAccount'][_0x482c('0x16')]({'raw':_0x5b6f7e['options']?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x18')]===undefined?!![]:![]:!![],'where':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')]['where']||null:null,'attributes':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x19')]||null:null,'limit':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')]['limit']||null:null,'include':_0x5b6f7e['options']?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x5b6f7e['options'][_0x482c('0x1a')],function(_0x579d2f){return{'model':db[_0x579d2f[_0x482c('0x1c')]],'as':_0x579d2f['as'],'attributes':_0x579d2f[_0x482c('0x19')],'include':_0x579d2f['include']?_[_0x482c('0x1b')](_0x579d2f['include'],function(_0x589bc6){return{'model':db[_0x589bc6[_0x482c('0x1c')]],'as':_0x589bc6['as'],'attributes':_0x589bc6[_0x482c('0x19')],'include':_0x589bc6[_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x589bc6[_0x482c('0x1a')],function(_0x215826){return{'model':db[_0x215826[_0x482c('0x1c')]],'as':_0x215826['as'],'attributes':_0x215826['attributes']};}):[]};}):[]};}):[]:[]})[_0x482c('0xa')](function(_0x255417){logger['info'](_0x482c('0x15'),_0x5b6f7e);logger['debug']('GetFreshsalesAccount',_0x5b6f7e,JSON[_0x482c('0xf')](_0x255417));_0x258148(_0x255417);})['catch'](function(_0x1ac1c4){logger[_0x482c('0x10')](_0x482c('0x15'),_0x1ac1c4[_0x482c('0x12')],_0x5b6f7e);_0x4af05a(_0x3aed45[_0x482c('0x10')](0x1f4,_0x1ac1c4[_0x482c('0x12')]));});});};exports[_0x482c('0x1d')]=function(_0x3e9b22){var _0x24b4df=this;return new Promise(function(_0x2d3800,_0x3135a7){return db[_0x482c('0x1e')][_0x482c('0x1f')]({'raw':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')][_0x482c('0x18')]===undefined?!![]:![]:!![],'where':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')]['where']||null:null,'attributes':_0x3e9b22['options']?_0x3e9b22['options'][_0x482c('0x19')]||null:null,'include':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')][_0x482c('0x1a')]?_['map'](_0x3e9b22[_0x482c('0x17')]['include'],function(_0x31428c){return{'model':db[_0x31428c[_0x482c('0x1c')]],'as':_0x31428c['as'],'attributes':_0x31428c[_0x482c('0x19')],'include':_0x31428c[_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x31428c[_0x482c('0x1a')],function(_0x129a31){return{'model':db[_0x129a31[_0x482c('0x1c')]],'as':_0x129a31['as'],'attributes':_0x129a31['attributes'],'include':_0x129a31['include']?_[_0x482c('0x1b')](_0x129a31['include'],function(_0xe62a02){return{'model':db[_0xe62a02[_0x482c('0x1c')]],'as':_0xe62a02['as'],'attributes':_0xe62a02[_0x482c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29cbaa){logger[_0x482c('0xb')](_0x482c('0x1d'),_0x3e9b22);logger[_0x482c('0xe')]('ShowFreshsalesAccount',_0x3e9b22,JSON[_0x482c('0xf')](_0x29cbaa));_0x2d3800(_0x29cbaa);})['catch'](function(_0x1de7f4){logger['error'](_0x482c('0x1d'),_0x1de7f4['message'],_0x3e9b22);_0x3135a7(_0x24b4df[_0x482c('0x10')](0x1f4,_0x1de7f4[_0x482c('0x12')]));});});}; \ No newline at end of file +var _0x160f=['../../config/environment','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','limit','include','map','model','attributes','find','ShowFreshsalesAccount','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4ec13d,_0x358a8f){var _0x3c3fa7=function(_0x2615f6){while(--_0x2615f6){_0x4ec13d['push'](_0x4ec13d['shift']());}};_0x3c3fa7(++_0x358a8f);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));var BPromise=require(_0xf160('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf160('0x4'));var db=require(_0xf160('0x5'))['db'];var utils=require(_0xf160('0x6'));var logger=require(_0xf160('0x7'))(_0xf160('0x8'));var config=require(_0xf160('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf160('0xa')][_0xf160('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49fe49,_0x59440e,_0x41e909){return new BPromise(function(_0x5b76c8,_0x4bf890){return client['request'](_0x49fe49,_0x41e909)[_0xf160('0xc')](function(_0x90608){logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,'request\x20sent');logger['debug'](_0xf160('0xf'),_0x59440e,_0xf160('0x10'),JSON[_0xf160('0x11')](_0x90608));if(_0x90608['error']){if(_0x90608[_0xf160('0x12')][_0xf160('0x13')]===0x1f4){logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')]['message']);return _0x4bf890(_0x90608[_0xf160('0x12')]['message']);}logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')][_0xf160('0x14')]);return _0x5b76c8(_0x90608[_0xf160('0x12')][_0xf160('0x14')]);}else{logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,_0xf160('0x10'));_0x5b76c8(_0x90608['result'][_0xf160('0x14')]);}})[_0xf160('0x15')](function(_0x8699a0){logger[_0xf160('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x59440e,_0x8699a0);_0x4bf890(_0x8699a0);});});}exports[_0xf160('0x16')]=function(_0x4b8185){var _0x5388c7=this;return new Promise(function(_0x1cf6ba,_0x1e0c78){return db[_0xf160('0x17')][_0xf160('0x18')]({'raw':_0x4b8185[_0xf160('0x19')]?_0x4b8185[_0xf160('0x19')][_0xf160('0x1a')]===undefined?!![]:![]:!![],'where':_0x4b8185[_0xf160('0x19')]?_0x4b8185['options'][_0xf160('0x1b')]||null:null,'attributes':_0x4b8185[_0xf160('0x19')]?_0x4b8185[_0xf160('0x19')]['attributes']||null:null,'limit':_0x4b8185[_0xf160('0x19')]?_0x4b8185[_0xf160('0x19')][_0xf160('0x1c')]||null:null,'include':_0x4b8185[_0xf160('0x19')]?_0x4b8185[_0xf160('0x19')][_0xf160('0x1d')]?_[_0xf160('0x1e')](_0x4b8185['options'][_0xf160('0x1d')],function(_0x28bf27){return{'model':db[_0x28bf27[_0xf160('0x1f')]],'as':_0x28bf27['as'],'attributes':_0x28bf27[_0xf160('0x20')],'include':_0x28bf27['include']?_[_0xf160('0x1e')](_0x28bf27[_0xf160('0x1d')],function(_0x4a8003){return{'model':db[_0x4a8003['model']],'as':_0x4a8003['as'],'attributes':_0x4a8003[_0xf160('0x20')],'include':_0x4a8003[_0xf160('0x1d')]?_[_0xf160('0x1e')](_0x4a8003['include'],function(_0xcfa9bd){return{'model':db[_0xcfa9bd[_0xf160('0x1f')]],'as':_0xcfa9bd['as'],'attributes':_0xcfa9bd[_0xf160('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf160('0xc')](function(_0x135e0f){logger[_0xf160('0xd')]('GetFreshsalesAccount',_0x4b8185);logger['debug']('GetFreshsalesAccount',_0x4b8185,JSON[_0xf160('0x11')](_0x135e0f));_0x1cf6ba(_0x135e0f);})[_0xf160('0x15')](function(_0xcaab39){logger[_0xf160('0x12')](_0xf160('0x16'),_0xcaab39['message'],_0x4b8185);_0x1e0c78(_0x5388c7['error'](0x1f4,_0xcaab39[_0xf160('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0x4ce478){var _0x22c2e3=this;return new Promise(function(_0x3a35b3,_0x5497f6){return db[_0xf160('0x17')][_0xf160('0x21')]({'raw':_0x4ce478['options']?_0x4ce478['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ce478['options']?_0x4ce478[_0xf160('0x19')][_0xf160('0x1b')]||null:null,'attributes':_0x4ce478[_0xf160('0x19')]?_0x4ce478[_0xf160('0x19')][_0xf160('0x20')]||null:null,'include':_0x4ce478[_0xf160('0x19')]?_0x4ce478['options']['include']?_['map'](_0x4ce478[_0xf160('0x19')]['include'],function(_0x5c65d2){return{'model':db[_0x5c65d2[_0xf160('0x1f')]],'as':_0x5c65d2['as'],'attributes':_0x5c65d2[_0xf160('0x20')],'include':_0x5c65d2['include']?_[_0xf160('0x1e')](_0x5c65d2[_0xf160('0x1d')],function(_0x272efe){return{'model':db[_0x272efe[_0xf160('0x1f')]],'as':_0x272efe['as'],'attributes':_0x272efe[_0xf160('0x20')],'include':_0x272efe['include']?_[_0xf160('0x1e')](_0x272efe[_0xf160('0x1d')],function(_0x15070a){return{'model':db[_0x15070a['model']],'as':_0x15070a['as'],'attributes':_0x15070a[_0xf160('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf160('0xc')](function(_0x1e4bd6){logger[_0xf160('0xd')](_0xf160('0x22'),_0x4ce478);logger[_0xf160('0x23')]('ShowFreshsalesAccount',_0x4ce478,JSON['stringify'](_0x1e4bd6));_0x3a35b3(_0x1e4bd6);})[_0xf160('0x15')](function(_0x21c248){logger[_0xf160('0x12')](_0xf160('0x22'),_0x21c248[_0xf160('0x14')],_0x4ce478);_0x5497f6(_0x22c2e3[_0xf160('0x12')](0x1f4,_0x21c248[_0xf160('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index b70f69b..1e66a6f 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 _0x5488=['show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getFields','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','get','/:id'];(function(_0x132b2d,_0xddfb7d){var _0x441508=function(_0x598ee0){while(--_0x598ee0){_0x132b2d['push'](_0x132b2d['shift']());}};_0x441508(++_0xddfb7d);}(_0x5488,0xa2));var _0x8548=function(_0x2134b7,_0x1eb5e2){_0x2134b7=_0x2134b7-0x0;var _0x6c5914=_0x5488[_0x2134b7];return _0x6c5914;};'use strict';var multer=require(_0x8548('0x0'));var util=require(_0x8548('0x1'));var path=require(_0x8548('0x2'));var timeout=require(_0x8548('0x3'));var express=require('express');var router=express[_0x8548('0x4')]();var fs_extra=require(_0x8548('0x5'));var auth=require(_0x8548('0x6'));var interaction=require(_0x8548('0x7'));var config=require(_0x8548('0x8'));var controller=require(_0x8548('0x9'));router['get']('/',auth[_0x8548('0xa')](),controller['index']);router[_0x8548('0xb')](_0x8548('0xc'),auth[_0x8548('0xa')](),controller[_0x8548('0xd')]);router[_0x8548('0xb')](_0x8548('0xe'),auth[_0x8548('0xa')](),controller[_0x8548('0xf')]);router[_0x8548('0xb')](_0x8548('0x10'),auth[_0x8548('0xa')](),controller[_0x8548('0x11')]);router[_0x8548('0xb')]('/:id/fields',auth[_0x8548('0xa')](),controller[_0x8548('0x12')]);router['post']('/',auth[_0x8548('0xa')](),controller[_0x8548('0x13')]);router[_0x8548('0x14')](_0x8548('0xc'),auth[_0x8548('0xa')](),controller[_0x8548('0x15')]);router[_0x8548('0x16')](_0x8548('0xc'),auth[_0x8548('0xa')](),controller[_0x8548('0x17')]);module[_0x8548('0x18')]=router; \ No newline at end of file +var _0xc452=['getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects'];(function(_0xfeb14b,_0x32c930){var _0x486db3=function(_0x1d8a14){while(--_0x1d8a14){_0xfeb14b['push'](_0xfeb14b['shift']());}};_0x486db3(++_0x32c930);}(_0xc452,0xd7));var _0x2c45=function(_0x376971,_0x2fb3f7){_0x376971=_0x376971-0x0;var _0x1c24f5=_0xc452[_0x376971];return _0x1c24f5;};'use strict';var multer=require(_0x2c45('0x0'));var util=require(_0x2c45('0x1'));var path=require(_0x2c45('0x2'));var timeout=require(_0x2c45('0x3'));var express=require(_0x2c45('0x4'));var router=express[_0x2c45('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2c45('0x6'));var config=require(_0x2c45('0x7'));var controller=require(_0x2c45('0x8'));router[_0x2c45('0x9')]('/',auth[_0x2c45('0xa')](),controller[_0x2c45('0xb')]);router['get'](_0x2c45('0xc'),auth[_0x2c45('0xa')](),controller[_0x2c45('0xd')]);router['get'](_0x2c45('0xe'),auth['isAuthenticated'](),controller[_0x2c45('0xf')]);router[_0x2c45('0x9')](_0x2c45('0x10'),auth['isAuthenticated'](),controller[_0x2c45('0x11')]);router[_0x2c45('0x9')](_0x2c45('0x12'),auth[_0x2c45('0xa')](),controller['getFields']);router[_0x2c45('0x13')]('/',auth[_0x2c45('0xa')](),controller[_0x2c45('0x14')]);router['put']('/:id',auth[_0x2c45('0xa')](),controller['update']);router[_0x2c45('0x15')](_0x2c45('0xc'),auth['isAuthenticated'](),controller[_0x2c45('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index f48e89a..fbcef25 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 _0x2d26=['STRING'];(function(_0x5401ae,_0x5e58ac){var _0x286068=function(_0x2cac88){while(--_0x2cac88){_0x5401ae['push'](_0x5401ae['shift']());}};_0x286068(++_0x5e58ac);}(_0x2d26,0xd7));var _0x62d2=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x2d26[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x62d2('0x0')]},'description':{'type':Sequelize[_0x62d2('0x0')]}}; \ No newline at end of file +var _0x8f7c=['sequelize','exports','STRING'];(function(_0x12a890,_0x4f3cb5){var _0x1a79ef=function(_0x5723f4){while(--_0x5723f4){_0x12a890['push'](_0x12a890['shift']());}};_0x1a79ef(++_0x4f3cb5);}(_0x8f7c,0x1c2));var _0xc8f7=function(_0x255c5c,_0x3f16d2){_0x255c5c=_0x255c5c-0x0;var _0x39d1c1=_0x8f7c[_0x255c5c];return _0x39d1c1;};'use strict';var Sequelize=require(_0xc8f7('0x0'));module[_0xc8f7('0x1')]={'name':{'type':Sequelize[_0xc8f7('0x2')]},'description':{'type':Sequelize[_0xc8f7('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index d0f227c..76a30e8 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 _0x0b65=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','fs-extra','squel','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','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','FreshsalesConfiguration','includeAll','rows','rawAttributes','intersection','length','find','catch','create','body','params','findOne','FreshsalesField','getSubjects','getDescriptions','order','getFields'];(function(_0x3f4891,_0x4e6f62){var _0x54f2d8=function(_0x2b11ee){while(--_0x2b11ee){_0x3f4891['push'](_0x3f4891['shift']());}};_0x54f2d8(++_0x4e6f62);}(_0x0b65,0x9c));var _0x50b6=function(_0x595631,_0x20dbca){_0x595631=_0x595631-0x0;var _0x22f823=_0x0b65[_0x595631];return _0x22f823;};'use strict';var emlformat=require(_0x50b6('0x0'));var rimraf=require(_0x50b6('0x1'));var zipdir=require(_0x50b6('0x2'));var jsonpatch=require(_0x50b6('0x3'));var rp=require(_0x50b6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x50b6('0x5'));var sox=require(_0x50b6('0x6'));var csv=require(_0x50b6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x50b6('0x8'));var _=require('lodash');var squel=require(_0x50b6('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x50b6('0xa'));var toCsv=require(_0x50b6('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x50b6('0xb'));var authService=require(_0x50b6('0xc'));var qs=require(_0x50b6('0xd'));var as=require(_0x50b6('0xe'));var hardwareService=require(_0x50b6('0xf'));var logger=require(_0x50b6('0x10'))(_0x50b6('0x11'));var utils=require(_0x50b6('0x12'));var config=require(_0x50b6('0x13'));var licenseUtil=require(_0x50b6('0x14'));var db=require(_0x50b6('0x15'))['db'];function respondWithStatusCode(_0x48dd1f,_0xadc2b){_0xadc2b=_0xadc2b||0xcc;return function(_0x5a6335){if(_0x5a6335){return _0x48dd1f[_0x50b6('0x16')](_0xadc2b);}return _0x48dd1f[_0x50b6('0x17')](_0xadc2b)[_0x50b6('0x18')]();};}function respondWithResult(_0x1bddb4,_0x32e8b1){_0x32e8b1=_0x32e8b1||0xc8;return function(_0x394d16){if(_0x394d16){return _0x1bddb4[_0x50b6('0x17')](_0x32e8b1)[_0x50b6('0x19')](_0x394d16);}};}function respondWithFilteredResult(_0x352d16,_0x5ade09){return function(_0x25aa73){if(_0x25aa73){var _0x2834a4=typeof _0x5ade09[_0x50b6('0x1a')]===_0x50b6('0x1b')&&typeof _0x5ade09['limit']===_0x50b6('0x1b');var _0x120d63=_0x25aa73[_0x50b6('0x1c')];var _0x1b6858=_0x2834a4?0x0:_0x5ade09[_0x50b6('0x1a')];var _0x177591=_0x2834a4?_0x25aa73[_0x50b6('0x1c')]:_0x5ade09[_0x50b6('0x1a')]+_0x5ade09[_0x50b6('0x1d')];var _0x3648b5;if(_0x177591>=_0x120d63){_0x177591=_0x120d63;_0x3648b5=0xc8;}else{_0x3648b5=0xce;}_0x352d16[_0x50b6('0x17')](_0x3648b5);return _0x352d16[_0x50b6('0x1e')](_0x50b6('0x1f'),_0x1b6858+'-'+_0x177591+'/'+_0x120d63)[_0x50b6('0x19')](_0x25aa73);}return null;};}function patchUpdates(_0xe65ace){return function(_0x4bae66){try{jsonpatch[_0x50b6('0x20')](_0x4bae66,_0xe65ace,!![]);}catch(_0x1eb4f2){return BPromise[_0x50b6('0x21')](_0x1eb4f2);}return _0x4bae66[_0x50b6('0x22')]();};}function saveUpdates(_0x495bc5,_0x5ea339){return function(_0x16f668){if(_0x16f668){return _0x16f668[_0x50b6('0x23')](_0x495bc5)[_0x50b6('0x24')](function(_0x37ff43){return _0x37ff43;});}return null;};}function removeEntity(_0x12c41f,_0x1ab3ee){return function(_0x5b4860){if(_0x5b4860){return _0x5b4860[_0x50b6('0x25')]()[_0x50b6('0x24')](function(){_0x12c41f[_0x50b6('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17290f,_0x5dc7f3){return function(_0x1c4fa7){if(!_0x1c4fa7){_0x17290f[_0x50b6('0x16')](0x194);}return _0x1c4fa7;};}function handleError(_0x4d06bc,_0x43bd83){_0x43bd83=_0x43bd83||0x1f4;return function(_0x576591){logger[_0x50b6('0x26')](_0x576591[_0x50b6('0x27')]);if(_0x576591[_0x50b6('0x28')]){delete _0x576591[_0x50b6('0x28')];}_0x4d06bc[_0x50b6('0x17')](_0x43bd83)[_0x50b6('0x29')](_0x576591);};}exports[_0x50b6('0x2a')]=function(_0x58febc,_0x50535e){var _0x55693a={},_0x15395c={},_0x4852f9={'count':0x0,'rows':[]};var _0x49e8eb=_[_0x50b6('0x2b')](db['FreshsalesConfiguration']['rawAttributes'],function(_0x3d3a9b){return{'name':_0x3d3a9b[_0x50b6('0x2c')],'type':_0x3d3a9b[_0x50b6('0x2d')][_0x50b6('0x2e')]};});_0x15395c[_0x50b6('0x2f')]=_[_0x50b6('0x2b')](_0x49e8eb,'name');_0x15395c[_0x50b6('0x30')]=_[_0x50b6('0x31')](_0x58febc['query']);_0x15395c['filters']=_['intersection'](_0x15395c['model'],_0x15395c[_0x50b6('0x30')]);_0x55693a['attributes']=_['intersection'](_0x15395c[_0x50b6('0x2f')],qs[_0x50b6('0x32')](_0x58febc['query'][_0x50b6('0x32')]));_0x55693a[_0x50b6('0x33')]=_0x55693a[_0x50b6('0x33')]['length']?_0x55693a[_0x50b6('0x33')]:_0x15395c['model'];if(!_0x58febc['query'][_0x50b6('0x34')](_0x50b6('0x35'))){_0x55693a[_0x50b6('0x1d')]=qs[_0x50b6('0x1d')](_0x58febc[_0x50b6('0x30')][_0x50b6('0x1d')]);_0x55693a[_0x50b6('0x1a')]=qs[_0x50b6('0x1a')](_0x58febc[_0x50b6('0x30')]['offset']);}_0x55693a['order']=qs[_0x50b6('0x36')](_0x58febc[_0x50b6('0x30')][_0x50b6('0x36')]);_0x55693a[_0x50b6('0x37')]=qs[_0x50b6('0x38')](_[_0x50b6('0x39')](_0x58febc[_0x50b6('0x30')],_0x15395c[_0x50b6('0x38')]),_0x49e8eb);if(_0x58febc[_0x50b6('0x30')][_0x50b6('0x3a')]){_0x55693a[_0x50b6('0x37')]=_[_0x50b6('0x3b')](_0x55693a[_0x50b6('0x37')],{'$or':_[_0x50b6('0x2b')](_0x49e8eb,function(_0x251052){if(_0x251052[_0x50b6('0x2d')]!=='VIRTUAL'){var _0x799373={};_0x799373[_0x251052[_0x50b6('0x28')]]={'$like':'%'+_0x58febc['query'][_0x50b6('0x3a')]+'%'};return _0x799373;}})});}_0x55693a=_[_0x50b6('0x3b')]({},_0x55693a,_0x58febc[_0x50b6('0x3c')]);var _0x689e7b={'where':_0x55693a[_0x50b6('0x37')]};return db[_0x50b6('0x3d')]['count'](_0x689e7b)[_0x50b6('0x24')](function(_0x23d302){_0x4852f9[_0x50b6('0x1c')]=_0x23d302;if(_0x58febc[_0x50b6('0x30')][_0x50b6('0x3e')]){_0x55693a['include']=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x55693a);})['then'](function(_0x3428ed){_0x4852f9[_0x50b6('0x3f')]=_0x3428ed;return _0x4852f9;})['then'](respondWithFilteredResult(_0x50535e,_0x55693a))['catch'](handleError(_0x50535e,null));};exports['show']=function(_0x237e41,_0x4ad696){var _0x216a6e={'raw':![],'where':{'id':_0x237e41['params']['id']}},_0x21f0b8={};_0x21f0b8[_0x50b6('0x2f')]=_[_0x50b6('0x31')](db[_0x50b6('0x3d')][_0x50b6('0x40')]);_0x21f0b8['query']=_[_0x50b6('0x31')](_0x237e41[_0x50b6('0x30')]);_0x21f0b8[_0x50b6('0x38')]=_['intersection'](_0x21f0b8[_0x50b6('0x2f')],_0x21f0b8[_0x50b6('0x30')]);_0x216a6e['attributes']=_[_0x50b6('0x41')](_0x21f0b8['model'],qs['fields'](_0x237e41[_0x50b6('0x30')][_0x50b6('0x32')]));_0x216a6e[_0x50b6('0x33')]=_0x216a6e[_0x50b6('0x33')][_0x50b6('0x42')]?_0x216a6e['attributes']:_0x21f0b8['model'];if(_0x237e41[_0x50b6('0x30')][_0x50b6('0x3e')]){_0x216a6e['include']=[{'all':!![]}];}_0x216a6e=_['merge']({},_0x216a6e,_0x237e41[_0x50b6('0x3c')]);return db[_0x50b6('0x3d')][_0x50b6('0x43')](_0x216a6e)[_0x50b6('0x24')](handleEntityNotFound(_0x4ad696,null))[_0x50b6('0x24')](respondWithResult(_0x4ad696,null))[_0x50b6('0x44')](handleError(_0x4ad696,null));};exports[_0x50b6('0x45')]=function(_0x46a001,_0x5af8db){return db[_0x50b6('0x3d')][_0x50b6('0x45')](_0x46a001['body'],{})['then'](respondWithResult(_0x5af8db,0xc9))[_0x50b6('0x44')](handleError(_0x5af8db,null));};exports['update']=function(_0x792e27,_0x4c24a4){if(_0x792e27['body']['id']){delete _0x792e27[_0x50b6('0x46')]['id'];}return db[_0x50b6('0x3d')][_0x50b6('0x43')]({'where':{'id':_0x792e27['params']['id']}})[_0x50b6('0x24')](handleEntityNotFound(_0x4c24a4,null))[_0x50b6('0x24')](saveUpdates(_0x792e27['body'],null))[_0x50b6('0x24')](respondWithResult(_0x4c24a4,null))[_0x50b6('0x44')](handleError(_0x4c24a4,null));};exports[_0x50b6('0x25')]=function(_0x325fe1,_0x14a1b4){return db[_0x50b6('0x3d')][_0x50b6('0x43')]({'where':{'id':_0x325fe1[_0x50b6('0x47')]['id']}})[_0x50b6('0x24')](handleEntityNotFound(_0x14a1b4,null))[_0x50b6('0x24')](removeEntity(_0x14a1b4,null))[_0x50b6('0x44')](handleError(_0x14a1b4,null));};exports['getSubjects']=function(_0x2595bc,_0x498c51,_0x19b7c5){var _0x3c5de8={};var _0x66d778={};var _0xbccb0b;var _0x1c4b0f;return db['FreshsalesConfiguration'][_0x50b6('0x48')]({'where':{'id':_0x2595bc[_0x50b6('0x47')]['id']}})['then'](handleEntityNotFound(_0x498c51,null))[_0x50b6('0x24')](function(_0x21d345){if(_0x21d345){_0xbccb0b=_0x21d345;_0x66d778[_0x50b6('0x2f')]=_[_0x50b6('0x31')](db[_0x50b6('0x49')][_0x50b6('0x40')]);_0x66d778[_0x50b6('0x30')]=_[_0x50b6('0x31')](_0x2595bc['query']);_0x66d778['filters']=_['intersection'](_0x66d778[_0x50b6('0x2f')],_0x66d778['query']);_0x3c5de8[_0x50b6('0x33')]=_[_0x50b6('0x41')](_0x66d778[_0x50b6('0x2f')],qs[_0x50b6('0x32')](_0x2595bc['query'][_0x50b6('0x32')]));_0x3c5de8[_0x50b6('0x33')]=_0x3c5de8[_0x50b6('0x33')][_0x50b6('0x42')]?_0x3c5de8[_0x50b6('0x33')]:_0x66d778[_0x50b6('0x2f')];_0x3c5de8['order']=qs[_0x50b6('0x36')](_0x2595bc[_0x50b6('0x30')][_0x50b6('0x36')]);_0x3c5de8[_0x50b6('0x37')]=qs[_0x50b6('0x38')](_[_0x50b6('0x39')](_0x2595bc[_0x50b6('0x30')],_0x66d778[_0x50b6('0x38')]));if(_0x2595bc['query']['filter']){_0x3c5de8[_0x50b6('0x37')]=_[_0x50b6('0x3b')](_0x3c5de8[_0x50b6('0x37')],{'$or':_[_0x50b6('0x2b')](_0x3c5de8['attributes'],function(_0x284043){var _0x4ed56c={};_0x4ed56c[_0x284043]={'$like':'%'+_0x2595bc['query'][_0x50b6('0x3a')]+'%'};return _0x4ed56c;})});}_0x3c5de8=_[_0x50b6('0x3b')]({},_0x3c5de8,_0x2595bc[_0x50b6('0x3c')]);return _0xbccb0b[_0x50b6('0x4a')](_0x3c5de8);}})[_0x50b6('0x24')](function(_0x4151ce){if(_0x4151ce){_0x1c4b0f=_0x4151ce[_0x50b6('0x42')];if(!_0x2595bc[_0x50b6('0x30')][_0x50b6('0x34')]('nolimit')){_0x3c5de8[_0x50b6('0x1d')]=qs[_0x50b6('0x1d')](_0x2595bc['query'][_0x50b6('0x1d')]);_0x3c5de8[_0x50b6('0x1a')]=qs[_0x50b6('0x1a')](_0x2595bc[_0x50b6('0x30')][_0x50b6('0x1a')]);}return _0xbccb0b[_0x50b6('0x4a')](_0x3c5de8);}})[_0x50b6('0x24')](function(_0x47def9){if(_0x47def9){return _0x47def9?{'count':_0x1c4b0f,'rows':_0x47def9}:null;}})[_0x50b6('0x24')](respondWithResult(_0x498c51,null))['catch'](handleError(_0x498c51,null));};exports[_0x50b6('0x4b')]=function(_0x43737e,_0x45069e,_0x14131d){var _0x2d30c5={};var _0x1be42c={};var _0x2f730f;var _0x3dd6b4;return db[_0x50b6('0x3d')][_0x50b6('0x48')]({'where':{'id':_0x43737e['params']['id']}})['then'](handleEntityNotFound(_0x45069e,null))['then'](function(_0x19edcc){if(_0x19edcc){_0x2f730f=_0x19edcc;_0x1be42c['model']=_['keys'](db[_0x50b6('0x49')][_0x50b6('0x40')]);_0x1be42c[_0x50b6('0x30')]=_[_0x50b6('0x31')](_0x43737e[_0x50b6('0x30')]);_0x1be42c[_0x50b6('0x38')]=_[_0x50b6('0x41')](_0x1be42c[_0x50b6('0x2f')],_0x1be42c['query']);_0x2d30c5[_0x50b6('0x33')]=_[_0x50b6('0x41')](_0x1be42c[_0x50b6('0x2f')],qs[_0x50b6('0x32')](_0x43737e['query'][_0x50b6('0x32')]));_0x2d30c5['attributes']=_0x2d30c5['attributes'][_0x50b6('0x42')]?_0x2d30c5['attributes']:_0x1be42c[_0x50b6('0x2f')];_0x2d30c5[_0x50b6('0x4c')]=qs[_0x50b6('0x36')](_0x43737e[_0x50b6('0x30')][_0x50b6('0x36')]);_0x2d30c5[_0x50b6('0x37')]=qs[_0x50b6('0x38')](_[_0x50b6('0x39')](_0x43737e[_0x50b6('0x30')],_0x1be42c[_0x50b6('0x38')]));if(_0x43737e[_0x50b6('0x30')][_0x50b6('0x3a')]){_0x2d30c5[_0x50b6('0x37')]=_['merge'](_0x2d30c5['where'],{'$or':_['map'](_0x2d30c5[_0x50b6('0x33')],function(_0xeed55f){var _0x3f3a4c={};_0x3f3a4c[_0xeed55f]={'$like':'%'+_0x43737e[_0x50b6('0x30')][_0x50b6('0x3a')]+'%'};return _0x3f3a4c;})});}_0x2d30c5=_[_0x50b6('0x3b')]({},_0x2d30c5,_0x43737e[_0x50b6('0x3c')]);return _0x2f730f[_0x50b6('0x4b')](_0x2d30c5);}})[_0x50b6('0x24')](function(_0x196afa){if(_0x196afa){_0x3dd6b4=_0x196afa[_0x50b6('0x42')];if(!_0x43737e[_0x50b6('0x30')][_0x50b6('0x34')](_0x50b6('0x35'))){_0x2d30c5[_0x50b6('0x1d')]=qs[_0x50b6('0x1d')](_0x43737e[_0x50b6('0x30')]['limit']);_0x2d30c5[_0x50b6('0x1a')]=qs[_0x50b6('0x1a')](_0x43737e[_0x50b6('0x30')][_0x50b6('0x1a')]);}return _0x2f730f[_0x50b6('0x4b')](_0x2d30c5);}})[_0x50b6('0x24')](function(_0x12736b){if(_0x12736b){return _0x12736b?{'count':_0x3dd6b4,'rows':_0x12736b}:null;}})[_0x50b6('0x24')](respondWithResult(_0x45069e,null))[_0x50b6('0x44')](handleError(_0x45069e,null));};exports[_0x50b6('0x4d')]=function(_0x67a6a7,_0xcb352b,_0x39ab3f){var _0x56896a={};var _0x8b3f01={};var _0x440a51;var _0x2dcd81;return db[_0x50b6('0x3d')][_0x50b6('0x48')]({'where':{'id':_0x67a6a7[_0x50b6('0x47')]['id']}})[_0x50b6('0x24')](handleEntityNotFound(_0xcb352b,null))[_0x50b6('0x24')](function(_0x5388a3){if(_0x5388a3){_0x440a51=_0x5388a3;_0x8b3f01[_0x50b6('0x2f')]=_[_0x50b6('0x31')](db[_0x50b6('0x49')][_0x50b6('0x40')]);_0x8b3f01['query']=_['keys'](_0x67a6a7['query']);_0x8b3f01['filters']=_[_0x50b6('0x41')](_0x8b3f01[_0x50b6('0x2f')],_0x8b3f01[_0x50b6('0x30')]);_0x56896a[_0x50b6('0x33')]=_[_0x50b6('0x41')](_0x8b3f01[_0x50b6('0x2f')],qs[_0x50b6('0x32')](_0x67a6a7[_0x50b6('0x30')][_0x50b6('0x32')]));_0x56896a['attributes']=_0x56896a[_0x50b6('0x33')][_0x50b6('0x42')]?_0x56896a[_0x50b6('0x33')]:_0x8b3f01['model'];_0x56896a[_0x50b6('0x4c')]=qs['sort'](_0x67a6a7[_0x50b6('0x30')][_0x50b6('0x36')]);_0x56896a[_0x50b6('0x37')]=qs[_0x50b6('0x38')](_[_0x50b6('0x39')](_0x67a6a7['query'],_0x8b3f01[_0x50b6('0x38')]));if(_0x67a6a7['query'][_0x50b6('0x3a')]){_0x56896a[_0x50b6('0x37')]=_[_0x50b6('0x3b')](_0x56896a[_0x50b6('0x37')],{'$or':_[_0x50b6('0x2b')](_0x56896a[_0x50b6('0x33')],function(_0x304100){var _0x28e4e9={};_0x28e4e9[_0x304100]={'$like':'%'+_0x67a6a7['query'][_0x50b6('0x3a')]+'%'};return _0x28e4e9;})});}_0x56896a=_[_0x50b6('0x3b')]({},_0x56896a,_0x67a6a7[_0x50b6('0x3c')]);return _0x440a51[_0x50b6('0x4d')](_0x56896a);}})[_0x50b6('0x24')](function(_0x34f34e){if(_0x34f34e){_0x2dcd81=_0x34f34e[_0x50b6('0x42')];if(!_0x67a6a7['query']['hasOwnProperty'](_0x50b6('0x35'))){_0x56896a[_0x50b6('0x1d')]=qs[_0x50b6('0x1d')](_0x67a6a7['query'][_0x50b6('0x1d')]);_0x56896a[_0x50b6('0x1a')]=qs[_0x50b6('0x1a')](_0x67a6a7['query'][_0x50b6('0x1a')]);}return _0x440a51[_0x50b6('0x4d')](_0x56896a);}})[_0x50b6('0x24')](function(_0x253277){if(_0x253277){return _0x253277?{'count':_0x2dcd81,'rows':_0x253277}:null;}})[_0x50b6('0x24')](respondWithResult(_0xcb352b,null))['catch'](handleError(_0xcb352b,null));}; \ No newline at end of file +var _0x0411=['crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','end','error','stack','name','send','index','map','FreshsalesConfiguration','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','update','destroy','getSubjects','FreshsalesField','pick','hasOwnProperty','nolimit','getDescriptions','findOne','getFields','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x7d7886,_0x3f03de){var _0x1a4d01=function(_0xac31f5){while(--_0xac31f5){_0x7d7886['push'](_0x7d7886['shift']());}};_0x1a4d01(++_0x3f03de);}(_0x0411,0xf5));var _0x1041=function(_0x496c03,_0x469a38){_0x496c03=_0x496c03-0x0;var _0x5eccc5=_0x0411[_0x496c03];return _0x5eccc5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1041('0x0'));var jsonpatch=require(_0x1041('0x1'));var rp=require(_0x1041('0x2'));var moment=require(_0x1041('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1041('0x4'));var util=require(_0x1041('0x5'));var path=require(_0x1041('0x6'));var sox=require(_0x1041('0x7'));var csv=require(_0x1041('0x8'));var ejs=require(_0x1041('0x9'));var fs=require('fs');var fs_extra=require(_0x1041('0xa'));var _=require(_0x1041('0xb'));var squel=require(_0x1041('0xc'));var crypto=require(_0x1041('0xd'));var jsforce=require(_0x1041('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1041('0x8'));var querystring=require(_0x1041('0xf'));var Papa=require(_0x1041('0x10'));var Redis=require(_0x1041('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1041('0x12'));var as=require(_0x1041('0x13'));var hardwareService=require(_0x1041('0x14'));var logger=require(_0x1041('0x15'))(_0x1041('0x16'));var utils=require(_0x1041('0x17'));var config=require(_0x1041('0x18'));var licenseUtil=require(_0x1041('0x19'));var db=require(_0x1041('0x1a'))['db'];function respondWithStatusCode(_0x7dc03,_0x4bde32){_0x4bde32=_0x4bde32||0xcc;return function(_0xce55b8){if(_0xce55b8){return _0x7dc03[_0x1041('0x1b')](_0x4bde32);}return _0x7dc03[_0x1041('0x1c')](_0x4bde32)['end']();};}function respondWithResult(_0x3a75ea,_0xd497a2){_0xd497a2=_0xd497a2||0xc8;return function(_0x2c8060){if(_0x2c8060){return _0x3a75ea[_0x1041('0x1c')](_0xd497a2)[_0x1041('0x1d')](_0x2c8060);}};}function respondWithFilteredResult(_0x1732b5,_0x197147){return function(_0x2178ce){if(_0x2178ce){var _0x5718b5=typeof _0x197147['offset']===_0x1041('0x1e')&&typeof _0x197147[_0x1041('0x1f')]===_0x1041('0x1e');var _0x1372c9=_0x2178ce[_0x1041('0x20')];var _0xa13a7=_0x5718b5?0x0:_0x197147[_0x1041('0x21')];var _0x2c3598=_0x5718b5?_0x2178ce[_0x1041('0x20')]:_0x197147[_0x1041('0x21')]+_0x197147[_0x1041('0x1f')];var _0xba85a9;if(_0x2c3598>=_0x1372c9){_0x2c3598=_0x1372c9;_0xba85a9=0xc8;}else{_0xba85a9=0xce;}_0x1732b5[_0x1041('0x1c')](_0xba85a9);return _0x1732b5[_0x1041('0x22')](_0x1041('0x23'),_0xa13a7+'-'+_0x2c3598+'/'+_0x1372c9)[_0x1041('0x1d')](_0x2178ce);}return null;};}function patchUpdates(_0x2bd4d3){return function(_0xb90599){try{jsonpatch[_0x1041('0x24')](_0xb90599,_0x2bd4d3,!![]);}catch(_0x10f847){return BPromise[_0x1041('0x25')](_0x10f847);}return _0xb90599[_0x1041('0x26')]();};}function saveUpdates(_0x1817c4,_0x355aef){return function(_0x10ed40){if(_0x10ed40){return _0x10ed40['update'](_0x1817c4)['then'](function(_0x32e50b){return _0x32e50b;});}return null;};}function removeEntity(_0x5c91c1,_0x56ce35){return function(_0x6bc255){if(_0x6bc255){return _0x6bc255['destroy']()[_0x1041('0x27')](function(){_0x5c91c1[_0x1041('0x1c')](0xcc)[_0x1041('0x28')]();});}};}function handleEntityNotFound(_0x5834c7,_0x33d093){return function(_0x369b75){if(!_0x369b75){_0x5834c7['sendStatus'](0x194);}return _0x369b75;};}function handleError(_0x12f12c,_0x412629){_0x412629=_0x412629||0x1f4;return function(_0x41b66f){logger[_0x1041('0x29')](_0x41b66f[_0x1041('0x2a')]);if(_0x41b66f[_0x1041('0x2b')]){delete _0x41b66f['name'];}_0x12f12c['status'](_0x412629)[_0x1041('0x2c')](_0x41b66f);};}exports[_0x1041('0x2d')]=function(_0x99ace6,_0x585447){var _0x304f78={},_0x1f0bda={},_0x2b79f3={'count':0x0,'rows':[]};var _0x430b1=_[_0x1041('0x2e')](db[_0x1041('0x2f')]['rawAttributes'],function(_0x2aa2df){return{'name':_0x2aa2df[_0x1041('0x30')],'type':_0x2aa2df[_0x1041('0x31')][_0x1041('0x32')]};});_0x1f0bda[_0x1041('0x33')]=_[_0x1041('0x2e')](_0x430b1,_0x1041('0x2b'));_0x1f0bda[_0x1041('0x34')]=_['keys'](_0x99ace6[_0x1041('0x34')]);_0x1f0bda[_0x1041('0x35')]=_[_0x1041('0x36')](_0x1f0bda[_0x1041('0x33')],_0x1f0bda[_0x1041('0x34')]);_0x304f78[_0x1041('0x37')]=_[_0x1041('0x36')](_0x1f0bda['model'],qs['fields'](_0x99ace6[_0x1041('0x34')][_0x1041('0x38')]));_0x304f78[_0x1041('0x37')]=_0x304f78[_0x1041('0x37')][_0x1041('0x39')]?_0x304f78[_0x1041('0x37')]:_0x1f0bda[_0x1041('0x33')];if(!_0x99ace6['query']['hasOwnProperty']('nolimit')){_0x304f78[_0x1041('0x1f')]=qs['limit'](_0x99ace6[_0x1041('0x34')][_0x1041('0x1f')]);_0x304f78[_0x1041('0x21')]=qs[_0x1041('0x21')](_0x99ace6['query'][_0x1041('0x21')]);}_0x304f78[_0x1041('0x3a')]=qs[_0x1041('0x3b')](_0x99ace6['query'][_0x1041('0x3b')]);_0x304f78[_0x1041('0x3c')]=qs[_0x1041('0x35')](_['pick'](_0x99ace6[_0x1041('0x34')],_0x1f0bda[_0x1041('0x35')]),_0x430b1);if(_0x99ace6[_0x1041('0x34')][_0x1041('0x3d')]){_0x304f78[_0x1041('0x3c')]=_[_0x1041('0x3e')](_0x304f78[_0x1041('0x3c')],{'$or':_[_0x1041('0x2e')](_0x430b1,function(_0x320202){if(_0x320202[_0x1041('0x31')]!==_0x1041('0x3f')){var _0x218784={};_0x218784[_0x320202[_0x1041('0x2b')]]={'$like':'%'+_0x99ace6[_0x1041('0x34')][_0x1041('0x3d')]+'%'};return _0x218784;}})});}_0x304f78=_[_0x1041('0x3e')]({},_0x304f78,_0x99ace6[_0x1041('0x40')]);var _0x494a16={'where':_0x304f78[_0x1041('0x3c')]};return db[_0x1041('0x2f')]['count'](_0x494a16)[_0x1041('0x27')](function(_0x127e5c){_0x2b79f3[_0x1041('0x20')]=_0x127e5c;if(_0x99ace6[_0x1041('0x34')][_0x1041('0x41')]){_0x304f78[_0x1041('0x42')]=[{'all':!![]}];}return db[_0x1041('0x2f')]['findAll'](_0x304f78);})[_0x1041('0x27')](function(_0x5e712c){_0x2b79f3[_0x1041('0x43')]=_0x5e712c;return _0x2b79f3;})[_0x1041('0x27')](respondWithFilteredResult(_0x585447,_0x304f78))[_0x1041('0x44')](handleError(_0x585447,null));};exports[_0x1041('0x45')]=function(_0x5d5675,_0x23e982){var _0x4e488b={'raw':![],'where':{'id':_0x5d5675[_0x1041('0x46')]['id']}},_0x417ace={};_0x417ace[_0x1041('0x33')]=_[_0x1041('0x47')](db[_0x1041('0x2f')][_0x1041('0x48')]);_0x417ace[_0x1041('0x34')]=_[_0x1041('0x47')](_0x5d5675[_0x1041('0x34')]);_0x417ace[_0x1041('0x35')]=_[_0x1041('0x36')](_0x417ace[_0x1041('0x33')],_0x417ace[_0x1041('0x34')]);_0x4e488b[_0x1041('0x37')]=_[_0x1041('0x36')](_0x417ace[_0x1041('0x33')],qs[_0x1041('0x38')](_0x5d5675[_0x1041('0x34')][_0x1041('0x38')]));_0x4e488b[_0x1041('0x37')]=_0x4e488b['attributes']['length']?_0x4e488b[_0x1041('0x37')]:_0x417ace[_0x1041('0x33')];if(_0x5d5675[_0x1041('0x34')][_0x1041('0x41')]){_0x4e488b[_0x1041('0x42')]=[{'all':!![]}];}_0x4e488b=_[_0x1041('0x3e')]({},_0x4e488b,_0x5d5675[_0x1041('0x40')]);return db[_0x1041('0x2f')][_0x1041('0x49')](_0x4e488b)[_0x1041('0x27')](handleEntityNotFound(_0x23e982,null))[_0x1041('0x27')](respondWithResult(_0x23e982,null))[_0x1041('0x44')](handleError(_0x23e982,null));};exports['create']=function(_0x1b19ba,_0x4f9781){return db['FreshsalesConfiguration'][_0x1041('0x4a')](_0x1b19ba[_0x1041('0x4b')],{})[_0x1041('0x27')](respondWithResult(_0x4f9781,0xc9))['catch'](handleError(_0x4f9781,null));};exports[_0x1041('0x4c')]=function(_0x18c0da,_0x2d33e6){if(_0x18c0da[_0x1041('0x4b')]['id']){delete _0x18c0da[_0x1041('0x4b')]['id'];}return db[_0x1041('0x2f')][_0x1041('0x49')]({'where':{'id':_0x18c0da[_0x1041('0x46')]['id']}})[_0x1041('0x27')](handleEntityNotFound(_0x2d33e6,null))[_0x1041('0x27')](saveUpdates(_0x18c0da['body'],null))[_0x1041('0x27')](respondWithResult(_0x2d33e6,null))[_0x1041('0x44')](handleError(_0x2d33e6,null));};exports[_0x1041('0x4d')]=function(_0x4e8abb,_0x2efbb8){return db['FreshsalesConfiguration'][_0x1041('0x49')]({'where':{'id':_0x4e8abb[_0x1041('0x46')]['id']}})[_0x1041('0x27')](handleEntityNotFound(_0x2efbb8,null))['then'](removeEntity(_0x2efbb8,null))[_0x1041('0x44')](handleError(_0x2efbb8,null));};exports[_0x1041('0x4e')]=function(_0x1e483d,_0x1a4782,_0x12e6cc){var _0x43a255={};var _0x1a7025={};var _0x2f562b;var _0x2548b7;return db[_0x1041('0x2f')]['findOne']({'where':{'id':_0x1e483d[_0x1041('0x46')]['id']}})[_0x1041('0x27')](handleEntityNotFound(_0x1a4782,null))['then'](function(_0x2328a1){if(_0x2328a1){_0x2f562b=_0x2328a1;_0x1a7025[_0x1041('0x33')]=_[_0x1041('0x47')](db[_0x1041('0x4f')][_0x1041('0x48')]);_0x1a7025['query']=_[_0x1041('0x47')](_0x1e483d[_0x1041('0x34')]);_0x1a7025[_0x1041('0x35')]=_[_0x1041('0x36')](_0x1a7025['model'],_0x1a7025[_0x1041('0x34')]);_0x43a255[_0x1041('0x37')]=_[_0x1041('0x36')](_0x1a7025[_0x1041('0x33')],qs[_0x1041('0x38')](_0x1e483d['query'][_0x1041('0x38')]));_0x43a255[_0x1041('0x37')]=_0x43a255['attributes'][_0x1041('0x39')]?_0x43a255[_0x1041('0x37')]:_0x1a7025[_0x1041('0x33')];_0x43a255[_0x1041('0x3a')]=qs[_0x1041('0x3b')](_0x1e483d['query'][_0x1041('0x3b')]);_0x43a255['where']=qs['filters'](_[_0x1041('0x50')](_0x1e483d[_0x1041('0x34')],_0x1a7025[_0x1041('0x35')]));if(_0x1e483d[_0x1041('0x34')][_0x1041('0x3d')]){_0x43a255[_0x1041('0x3c')]=_[_0x1041('0x3e')](_0x43a255['where'],{'$or':_[_0x1041('0x2e')](_0x43a255[_0x1041('0x37')],function(_0x1ccab7){var _0x49d322={};_0x49d322[_0x1ccab7]={'$like':'%'+_0x1e483d[_0x1041('0x34')][_0x1041('0x3d')]+'%'};return _0x49d322;})});}_0x43a255=_[_0x1041('0x3e')]({},_0x43a255,_0x1e483d['options']);return _0x2f562b[_0x1041('0x4e')](_0x43a255);}})[_0x1041('0x27')](function(_0x16cf70){if(_0x16cf70){_0x2548b7=_0x16cf70['length'];if(!_0x1e483d[_0x1041('0x34')][_0x1041('0x51')](_0x1041('0x52'))){_0x43a255[_0x1041('0x1f')]=qs[_0x1041('0x1f')](_0x1e483d[_0x1041('0x34')]['limit']);_0x43a255['offset']=qs[_0x1041('0x21')](_0x1e483d['query'][_0x1041('0x21')]);}return _0x2f562b['getSubjects'](_0x43a255);}})[_0x1041('0x27')](function(_0x455a72){if(_0x455a72){return _0x455a72?{'count':_0x2548b7,'rows':_0x455a72}:null;}})[_0x1041('0x27')](respondWithResult(_0x1a4782,null))['catch'](handleError(_0x1a4782,null));};exports[_0x1041('0x53')]=function(_0x7b6b4b,_0x14348c,_0x10997b){var _0x192442={};var _0x2cd825={};var _0x2a7669;var _0x59cc78;return db[_0x1041('0x2f')][_0x1041('0x54')]({'where':{'id':_0x7b6b4b[_0x1041('0x46')]['id']}})[_0x1041('0x27')](handleEntityNotFound(_0x14348c,null))[_0x1041('0x27')](function(_0x4b6aae){if(_0x4b6aae){_0x2a7669=_0x4b6aae;_0x2cd825['model']=_[_0x1041('0x47')](db[_0x1041('0x4f')][_0x1041('0x48')]);_0x2cd825['query']=_[_0x1041('0x47')](_0x7b6b4b[_0x1041('0x34')]);_0x2cd825[_0x1041('0x35')]=_[_0x1041('0x36')](_0x2cd825[_0x1041('0x33')],_0x2cd825['query']);_0x192442[_0x1041('0x37')]=_[_0x1041('0x36')](_0x2cd825[_0x1041('0x33')],qs[_0x1041('0x38')](_0x7b6b4b[_0x1041('0x34')][_0x1041('0x38')]));_0x192442[_0x1041('0x37')]=_0x192442[_0x1041('0x37')]['length']?_0x192442[_0x1041('0x37')]:_0x2cd825[_0x1041('0x33')];_0x192442[_0x1041('0x3a')]=qs[_0x1041('0x3b')](_0x7b6b4b[_0x1041('0x34')]['sort']);_0x192442[_0x1041('0x3c')]=qs[_0x1041('0x35')](_[_0x1041('0x50')](_0x7b6b4b[_0x1041('0x34')],_0x2cd825[_0x1041('0x35')]));if(_0x7b6b4b[_0x1041('0x34')][_0x1041('0x3d')]){_0x192442[_0x1041('0x3c')]=_['merge'](_0x192442['where'],{'$or':_[_0x1041('0x2e')](_0x192442[_0x1041('0x37')],function(_0x1d7d94){var _0x48c99e={};_0x48c99e[_0x1d7d94]={'$like':'%'+_0x7b6b4b[_0x1041('0x34')][_0x1041('0x3d')]+'%'};return _0x48c99e;})});}_0x192442=_['merge']({},_0x192442,_0x7b6b4b[_0x1041('0x40')]);return _0x2a7669[_0x1041('0x53')](_0x192442);}})[_0x1041('0x27')](function(_0x2bea57){if(_0x2bea57){_0x59cc78=_0x2bea57['length'];if(!_0x7b6b4b[_0x1041('0x34')][_0x1041('0x51')](_0x1041('0x52'))){_0x192442[_0x1041('0x1f')]=qs[_0x1041('0x1f')](_0x7b6b4b['query'][_0x1041('0x1f')]);_0x192442['offset']=qs[_0x1041('0x21')](_0x7b6b4b[_0x1041('0x34')][_0x1041('0x21')]);}return _0x2a7669[_0x1041('0x53')](_0x192442);}})['then'](function(_0x17016d){if(_0x17016d){return _0x17016d?{'count':_0x59cc78,'rows':_0x17016d}:null;}})['then'](respondWithResult(_0x14348c,null))['catch'](handleError(_0x14348c,null));};exports[_0x1041('0x55')]=function(_0x5d285e,_0x26e3cf,_0x13bcca){var _0x2e8b82={};var _0x186fee={};var _0x177554;var _0x3088a0;return db[_0x1041('0x2f')][_0x1041('0x54')]({'where':{'id':_0x5d285e[_0x1041('0x46')]['id']}})[_0x1041('0x27')](handleEntityNotFound(_0x26e3cf,null))[_0x1041('0x27')](function(_0x1934d4){if(_0x1934d4){_0x177554=_0x1934d4;_0x186fee[_0x1041('0x33')]=_[_0x1041('0x47')](db['FreshsalesField'][_0x1041('0x48')]);_0x186fee[_0x1041('0x34')]=_[_0x1041('0x47')](_0x5d285e[_0x1041('0x34')]);_0x186fee[_0x1041('0x35')]=_['intersection'](_0x186fee[_0x1041('0x33')],_0x186fee[_0x1041('0x34')]);_0x2e8b82[_0x1041('0x37')]=_[_0x1041('0x36')](_0x186fee[_0x1041('0x33')],qs[_0x1041('0x38')](_0x5d285e[_0x1041('0x34')][_0x1041('0x38')]));_0x2e8b82[_0x1041('0x37')]=_0x2e8b82[_0x1041('0x37')][_0x1041('0x39')]?_0x2e8b82[_0x1041('0x37')]:_0x186fee['model'];_0x2e8b82[_0x1041('0x3a')]=qs[_0x1041('0x3b')](_0x5d285e[_0x1041('0x34')]['sort']);_0x2e8b82[_0x1041('0x3c')]=qs[_0x1041('0x35')](_[_0x1041('0x50')](_0x5d285e['query'],_0x186fee['filters']));if(_0x5d285e[_0x1041('0x34')][_0x1041('0x3d')]){_0x2e8b82[_0x1041('0x3c')]=_[_0x1041('0x3e')](_0x2e8b82[_0x1041('0x3c')],{'$or':_[_0x1041('0x2e')](_0x2e8b82[_0x1041('0x37')],function(_0x49638b){var _0x329650={};_0x329650[_0x49638b]={'$like':'%'+_0x5d285e[_0x1041('0x34')][_0x1041('0x3d')]+'%'};return _0x329650;})});}_0x2e8b82=_['merge']({},_0x2e8b82,_0x5d285e['options']);return _0x177554[_0x1041('0x55')](_0x2e8b82);}})[_0x1041('0x27')](function(_0x2fdfb0){if(_0x2fdfb0){_0x3088a0=_0x2fdfb0['length'];if(!_0x5d285e[_0x1041('0x34')][_0x1041('0x51')](_0x1041('0x52'))){_0x2e8b82['limit']=qs[_0x1041('0x1f')](_0x5d285e[_0x1041('0x34')][_0x1041('0x1f')]);_0x2e8b82['offset']=qs[_0x1041('0x21')](_0x5d285e['query']['offset']);}return _0x177554[_0x1041('0x55')](_0x2e8b82);}})[_0x1041('0x27')](function(_0x369c70){if(_0x369c70){return _0x369c70?{'count':_0x3088a0,'rows':_0x369c70}:null;}})[_0x1041('0x27')](respondWithResult(_0x26e3cf,null))[_0x1041('0x44')](handleError(_0x26e3cf,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 98ea26a..900d2af 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 _0xe79d=['api','bluebird','request-promise','path','rimraf','exports','define','FreshsalesConfiguration','int_freshsales_configurations','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe79d,0xe5));var _0xde79=function(_0x1d5d72,_0x3a402a){_0x1d5d72=_0x1d5d72-0x0;var _0x4a10fa=_0xe79d[_0x1d5d72];return _0x4a10fa;};'use strict';var _=require('lodash');var util=require(_0xde79('0x0'));var logger=require('../../config/logger')(_0xde79('0x1'));var moment=require('moment');var BPromise=require(_0xde79('0x2'));var rp=require(_0xde79('0x3'));var fs=require('fs');var path=require(_0xde79('0x4'));var rimraf=require(_0xde79('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xde79('0x6')]=function(_0x37a089,_0x25f1ae){return _0x37a089[_0xde79('0x7')](_0xde79('0x8'),attributes,{'tableName':_0xde79('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8569=['api','bluebird','request-promise','path','../../config/environment','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger'];(function(_0x965b4f,_0x304fe9){var _0x57f071=function(_0x52b82e){while(--_0x52b82e){_0x965b4f['push'](_0x965b4f['shift']());}};_0x57f071(++_0x304fe9);}(_0x8569,0x14d));var _0x9856=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x8569[_0x369151];return _0x4292d5;};'use strict';var _=require(_0x9856('0x0'));var util=require(_0x9856('0x1'));var logger=require(_0x9856('0x2'))(_0x9856('0x3'));var moment=require('moment');var BPromise=require(_0x9856('0x4'));var rp=require(_0x9856('0x5'));var fs=require('fs');var path=require(_0x9856('0x6'));var rimraf=require('rimraf');var config=require(_0x9856('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x9856('0x8')]=function(_0x404522,_0x3f1b95){return _0x404522[_0x9856('0x9')](_0x9856('0xa'),attributes,{'tableName':_0x9856('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 8a807d6..89ab3c2 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 _0xbfb2=['debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x4d1bdc,_0x395c16){var _0x8db334=function(_0x52f13c){while(--_0x52f13c){_0x4d1bdc['push'](_0x4d1bdc['shift']());}};_0x8db334(++_0x395c16);}(_0xbfb2,0x1e8));var _0x2bfb=function(_0x648272,_0x1f4b6a){_0x648272=_0x648272-0x0;var _0x1b0624=_0xbfb2[_0x648272];return _0x1b0624;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2bfb('0x0'));var BPromise=require(_0x2bfb('0x1'));var rs=require(_0x2bfb('0x2'));var fs=require('fs');var Redis=require(_0x2bfb('0x3'));var db=require(_0x2bfb('0x4'))['db'];var utils=require(_0x2bfb('0x5'));var logger=require(_0x2bfb('0x6'))(_0x2bfb('0x7'));var config=require(_0x2bfb('0x8'));var jayson=require(_0x2bfb('0x9'));var client=jayson[_0x2bfb('0xa')][_0x2bfb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x186824,_0x1522ee,_0x3536f7){return new BPromise(function(_0x289a59,_0x37f431){return client['request'](_0x186824,_0x3536f7)[_0x2bfb('0xc')](function(_0x5dd895){logger[_0x2bfb('0xd')](_0x2bfb('0xe'),_0x1522ee,_0x2bfb('0xf'));logger[_0x2bfb('0x10')](_0x2bfb('0x11'),_0x1522ee,_0x2bfb('0xf'),JSON['stringify'](_0x5dd895));if(_0x5dd895[_0x2bfb('0x12')]){if(_0x5dd895[_0x2bfb('0x12')]['code']===0x1f4){logger[_0x2bfb('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1522ee,_0x5dd895['error'][_0x2bfb('0x13')]);return _0x37f431(_0x5dd895['error'][_0x2bfb('0x13')]);}logger['error'](_0x2bfb('0xe'),_0x1522ee,_0x5dd895[_0x2bfb('0x12')][_0x2bfb('0x13')]);return _0x289a59(_0x5dd895['error']['message']);}else{logger['info'](_0x2bfb('0xe'),_0x1522ee,_0x2bfb('0xf'));_0x289a59(_0x5dd895[_0x2bfb('0x14')]['message']);}})['catch'](function(_0x394205){logger[_0x2bfb('0x12')](_0x2bfb('0xe'),_0x1522ee,_0x394205);_0x37f431(_0x394205);});});} \ No newline at end of file +var _0x1852=['then','info','request\x20sent','debug','stringify','error','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1852,0x186));var _0x2185=function(_0x123e61,_0x34849a){_0x123e61=_0x123e61-0x0;var _0x3edf6e=_0x1852[_0x123e61];return _0x3edf6e;};'use strict';var _=require(_0x2185('0x0'));var util=require('util');var moment=require(_0x2185('0x1'));var BPromise=require(_0x2185('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2185('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2185('0x4'))(_0x2185('0x5'));var config=require(_0x2185('0x6'));var jayson=require(_0x2185('0x7'));var client=jayson[_0x2185('0x8')][_0x2185('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d217d,_0x50913e,_0x2f4b6e){return new BPromise(function(_0x1b563f,_0x34b1f7){return client['request'](_0x4d217d,_0x2f4b6e)[_0x2185('0xa')](function(_0x27c616){logger[_0x2185('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x50913e,_0x2185('0xc'));logger[_0x2185('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x50913e,_0x2185('0xc'),JSON[_0x2185('0xe')](_0x27c616));if(_0x27c616[_0x2185('0xf')]){if(_0x27c616[_0x2185('0xf')]['code']===0x1f4){logger[_0x2185('0xf')](_0x2185('0x10'),_0x50913e,_0x27c616[_0x2185('0xf')][_0x2185('0x11')]);return _0x34b1f7(_0x27c616['error']['message']);}logger['error'](_0x2185('0x10'),_0x50913e,_0x27c616[_0x2185('0xf')][_0x2185('0x11')]);return _0x1b563f(_0x27c616[_0x2185('0xf')][_0x2185('0x11')]);}else{logger['info'](_0x2185('0x10'),_0x50913e,_0x2185('0xc'));_0x1b563f(_0x27c616[_0x2185('0x12')][_0x2185('0x11')]);}})[_0x2185('0x13')](function(_0x3b3100){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x50913e,_0x3b3100);_0x34b1f7(_0x3b3100);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 02dd779..2584c96 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 _0xc17f=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x3bdf9f,_0x506232){var _0x2b3e42=function(_0x2a302a){while(--_0x2a302a){_0x3bdf9f['push'](_0x3bdf9f['shift']());}};_0x2b3e42(++_0x506232);}(_0xc17f,0xb8));var _0xfc17=function(_0x4736dc,_0x237d41){_0x4736dc=_0x4736dc-0x0;var _0x519148=_0xc17f[_0x4736dc];return _0x519148;};'use strict';var multer=require(_0xfc17('0x0'));var util=require(_0xfc17('0x1'));var path=require(_0xfc17('0x2'));var timeout=require(_0xfc17('0x3'));var express=require(_0xfc17('0x4'));var router=express[_0xfc17('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfc17('0x6'));var interaction=require(_0xfc17('0x7'));var config=require(_0xfc17('0x8'));var controller=require(_0xfc17('0x9'));router['get']('/',auth[_0xfc17('0xa')](),controller[_0xfc17('0xb')]);router[_0xfc17('0xc')](_0xfc17('0xd'),auth[_0xfc17('0xa')](),controller[_0xfc17('0xe')]);router[_0xfc17('0xf')]('/',auth[_0xfc17('0xa')](),controller['create']);router[_0xfc17('0x10')](_0xfc17('0xd'),auth[_0xfc17('0xa')](),controller[_0xfc17('0x11')]);router['delete']('/:id',auth[_0xfc17('0xa')](),controller[_0xfc17('0x12')]);module[_0xfc17('0x13')]=router; \ No newline at end of file +var _0xc524=['index','show','post','create','put','update','delete','/:id','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x281313,_0x28e6e2){var _0x102967=function(_0x207ab9){while(--_0x207ab9){_0x281313['push'](_0x281313['shift']());}};_0x102967(++_0x28e6e2);}(_0xc524,0x1bf));var _0x4c52=function(_0x7fbce1,_0x25995f){_0x7fbce1=_0x7fbce1-0x0;var _0x5bfbf3=_0xc524[_0x7fbce1];return _0x5bfbf3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4c52('0x0'));var timeout=require(_0x4c52('0x1'));var express=require(_0x4c52('0x2'));var router=express[_0x4c52('0x3')]();var fs_extra=require(_0x4c52('0x4'));var auth=require(_0x4c52('0x5'));var interaction=require(_0x4c52('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router[_0x4c52('0x7')]('/',auth[_0x4c52('0x8')](),controller[_0x4c52('0x9')]);router[_0x4c52('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4c52('0xa')]);router[_0x4c52('0xb')]('/',auth['isAuthenticated'](),controller[_0x4c52('0xc')]);router[_0x4c52('0xd')]('/:id',auth[_0x4c52('0x8')](),controller[_0x4c52('0xe')]);router[_0x4c52('0xf')](_0x4c52('0x10'),auth[_0x4c52('0x8')](),controller[_0x4c52('0x11')]);module[_0x4c52('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index e038c95..3fc65a1 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 _0x4d64=['keyValue','string','STRING','customVariable','BOOLEAN','variable'];(function(_0x5aaed7,_0x5f0471){var _0xa2914e=function(_0x23ac30){while(--_0x23ac30){_0x5aaed7['push'](_0x5aaed7['shift']());}};_0xa2914e(++_0x5f0471);}(_0x4d64,0xbf));var _0x44d6=function(_0x43877f,_0x155848){_0x43877f=_0x43877f-0x0;var _0x574f28=_0x4d64[_0x43877f];return _0x574f28;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x44d6('0x0'),'customVariable',_0x44d6('0x1'),'picklist'),'defaultValue':_0x44d6('0x2')},'content':{'type':Sequelize[_0x44d6('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x44d6('0x0'),_0x44d6('0x4'))},'keyContent':{'type':Sequelize[_0x44d6('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x44d6('0x3')]},'customField':{'type':Sequelize[_0x44d6('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x44d6('0x3')]}}; \ No newline at end of file +var _0x3c8a=['STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x1775d8,_0x3aea16){var _0x8f6dac=function(_0x4137a0){while(--_0x4137a0){_0x1775d8['push'](_0x1775d8['shift']());}};_0x8f6dac(++_0x3aea16);}(_0x3c8a,0xda));var _0xa3c8=function(_0x5a1b6b,_0x320036){_0x5a1b6b=_0x5a1b6b-0x0;var _0xca9688=_0x3c8a[_0x5a1b6b];return _0xca9688;};'use strict';var Sequelize=require(_0xa3c8('0x0'));module['exports']={'type':{'type':Sequelize[_0xa3c8('0x1')](_0xa3c8('0x2'),_0xa3c8('0x3'),_0xa3c8('0x4'),_0xa3c8('0x5'),_0xa3c8('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa3c8('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xa3c8('0x3'),_0xa3c8('0x4'))},'keyContent':{'type':Sequelize[_0xa3c8('0x7')]},'idField':{'type':Sequelize[_0xa3c8('0x7')]},'nameField':{'type':Sequelize[_0xa3c8('0x7')]},'customField':{'type':Sequelize[_0xa3c8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 176096b..506819d 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 _0x3ea5=['catch','show','params','rawAttributes','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','FreshsalesField','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0x3ea5,0x1e8));var _0x53ea=function(_0x3868c7,_0x165fa5){_0x3868c7=_0x3868c7-0x0;var _0x1c5042=_0x3ea5[_0x3868c7];return _0x1c5042;};'use strict';var emlformat=require(_0x53ea('0x0'));var rimraf=require(_0x53ea('0x1'));var zipdir=require(_0x53ea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x53ea('0x3'));var moment=require(_0x53ea('0x4'));var BPromise=require(_0x53ea('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x53ea('0x6'));var sox=require(_0x53ea('0x7'));var csv=require(_0x53ea('0x8'));var ejs=require(_0x53ea('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x53ea('0xa'));var squel=require(_0x53ea('0xb'));var crypto=require(_0x53ea('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x53ea('0xd'));var toCsv=require(_0x53ea('0x8'));var querystring=require(_0x53ea('0xe'));var Papa=require(_0x53ea('0xf'));var Redis=require(_0x53ea('0x10'));var authService=require(_0x53ea('0x11'));var qs=require(_0x53ea('0x12'));var as=require(_0x53ea('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x53ea('0x14'))(_0x53ea('0x15'));var utils=require(_0x53ea('0x16'));var config=require(_0x53ea('0x17'));var licenseUtil=require(_0x53ea('0x18'));var db=require(_0x53ea('0x19'))['db'];function respondWithStatusCode(_0x2b7bab,_0x15b8bb){_0x15b8bb=_0x15b8bb||0xcc;return function(_0x2ed2c3){if(_0x2ed2c3){return _0x2b7bab[_0x53ea('0x1a')](_0x15b8bb);}return _0x2b7bab[_0x53ea('0x1b')](_0x15b8bb)[_0x53ea('0x1c')]();};}function respondWithResult(_0x247eb0,_0x50ab20){_0x50ab20=_0x50ab20||0xc8;return function(_0x2cf55f){if(_0x2cf55f){return _0x247eb0[_0x53ea('0x1b')](_0x50ab20)[_0x53ea('0x1d')](_0x2cf55f);}};}function respondWithFilteredResult(_0x164da7,_0x3f0045){return function(_0x352173){if(_0x352173){var _0x1b2965=typeof _0x3f0045['offset']===_0x53ea('0x1e')&&typeof _0x3f0045[_0x53ea('0x1f')]==='undefined';var _0x5eac8c=_0x352173['count'];var _0x5efc82=_0x1b2965?0x0:_0x3f0045[_0x53ea('0x20')];var _0x404262=_0x1b2965?_0x352173[_0x53ea('0x21')]:_0x3f0045[_0x53ea('0x20')]+_0x3f0045['limit'];var _0x1efcc5;if(_0x404262>=_0x5eac8c){_0x404262=_0x5eac8c;_0x1efcc5=0xc8;}else{_0x1efcc5=0xce;}_0x164da7[_0x53ea('0x1b')](_0x1efcc5);return _0x164da7[_0x53ea('0x22')](_0x53ea('0x23'),_0x5efc82+'-'+_0x404262+'/'+_0x5eac8c)[_0x53ea('0x1d')](_0x352173);}return null;};}function patchUpdates(_0x4386ff){return function(_0xd7c41){try{jsonpatch[_0x53ea('0x24')](_0xd7c41,_0x4386ff,!![]);}catch(_0x243f11){return BPromise[_0x53ea('0x25')](_0x243f11);}return _0xd7c41[_0x53ea('0x26')]();};}function saveUpdates(_0x4738cf,_0x28b663){return function(_0x3c03a3){if(_0x3c03a3){return _0x3c03a3[_0x53ea('0x27')](_0x4738cf)[_0x53ea('0x28')](function(_0x23719a){return _0x23719a;});}return null;};}function removeEntity(_0x4b4110,_0x118c6a){return function(_0x34f1c3){if(_0x34f1c3){return _0x34f1c3[_0x53ea('0x29')]()[_0x53ea('0x28')](function(){_0x4b4110[_0x53ea('0x1b')](0xcc)[_0x53ea('0x1c')]();});}};}function handleEntityNotFound(_0x107d35,_0x332871){return function(_0x5283d2){if(!_0x5283d2){_0x107d35['sendStatus'](0x194);}return _0x5283d2;};}function handleError(_0x1d63a7,_0x1bbb3a){_0x1bbb3a=_0x1bbb3a||0x1f4;return function(_0x3c57a3){logger[_0x53ea('0x2a')](_0x3c57a3[_0x53ea('0x2b')]);if(_0x3c57a3[_0x53ea('0x2c')]){delete _0x3c57a3['name'];}_0x1d63a7[_0x53ea('0x1b')](_0x1bbb3a)[_0x53ea('0x2d')](_0x3c57a3);};}exports['index']=function(_0x40155a,_0x3356db){var _0x2a120f={},_0x4f4226={},_0x18d6da={'count':0x0,'rows':[]};var _0x32859f=_[_0x53ea('0x2e')](db[_0x53ea('0x2f')]['rawAttributes'],function(_0x5f50be){return{'name':_0x5f50be[_0x53ea('0x30')],'type':_0x5f50be['type'][_0x53ea('0x31')]};});_0x4f4226[_0x53ea('0x32')]=_[_0x53ea('0x2e')](_0x32859f,_0x53ea('0x2c'));_0x4f4226[_0x53ea('0x33')]=_[_0x53ea('0x34')](_0x40155a[_0x53ea('0x33')]);_0x4f4226[_0x53ea('0x35')]=_[_0x53ea('0x36')](_0x4f4226[_0x53ea('0x32')],_0x4f4226[_0x53ea('0x33')]);_0x2a120f['attributes']=_[_0x53ea('0x36')](_0x4f4226[_0x53ea('0x32')],qs[_0x53ea('0x37')](_0x40155a[_0x53ea('0x33')][_0x53ea('0x37')]));_0x2a120f[_0x53ea('0x38')]=_0x2a120f[_0x53ea('0x38')][_0x53ea('0x39')]?_0x2a120f[_0x53ea('0x38')]:_0x4f4226['model'];if(!_0x40155a[_0x53ea('0x33')][_0x53ea('0x3a')](_0x53ea('0x3b'))){_0x2a120f[_0x53ea('0x1f')]=qs['limit'](_0x40155a[_0x53ea('0x33')][_0x53ea('0x1f')]);_0x2a120f[_0x53ea('0x20')]=qs[_0x53ea('0x20')](_0x40155a[_0x53ea('0x33')][_0x53ea('0x20')]);}_0x2a120f[_0x53ea('0x3c')]=qs['sort'](_0x40155a[_0x53ea('0x33')][_0x53ea('0x3d')]);_0x2a120f[_0x53ea('0x3e')]=qs[_0x53ea('0x35')](_[_0x53ea('0x3f')](_0x40155a['query'],_0x4f4226[_0x53ea('0x35')]),_0x32859f);if(_0x40155a[_0x53ea('0x33')][_0x53ea('0x40')]){_0x2a120f[_0x53ea('0x3e')]=_[_0x53ea('0x41')](_0x2a120f[_0x53ea('0x3e')],{'$or':_[_0x53ea('0x2e')](_0x32859f,function(_0x2109fe){if(_0x2109fe[_0x53ea('0x42')]!==_0x53ea('0x43')){var _0x2caa5a={};_0x2caa5a[_0x2109fe[_0x53ea('0x2c')]]={'$like':'%'+_0x40155a[_0x53ea('0x33')][_0x53ea('0x40')]+'%'};return _0x2caa5a;}})});}_0x2a120f=_['merge']({},_0x2a120f,_0x40155a[_0x53ea('0x44')]);var _0x393da3={'where':_0x2a120f[_0x53ea('0x3e')]};return db[_0x53ea('0x2f')][_0x53ea('0x21')](_0x393da3)[_0x53ea('0x28')](function(_0xcc27e2){_0x18d6da[_0x53ea('0x21')]=_0xcc27e2;if(_0x40155a[_0x53ea('0x33')][_0x53ea('0x45')]){_0x2a120f['include']=[{'all':!![]}];}return db[_0x53ea('0x2f')][_0x53ea('0x46')](_0x2a120f);})[_0x53ea('0x28')](function(_0x342e1f){_0x18d6da[_0x53ea('0x47')]=_0x342e1f;return _0x18d6da;})[_0x53ea('0x28')](respondWithFilteredResult(_0x3356db,_0x2a120f))[_0x53ea('0x48')](handleError(_0x3356db,null));};exports[_0x53ea('0x49')]=function(_0x2ecc02,_0x3e550f){var _0x1c042f={'raw':!![],'where':{'id':_0x2ecc02[_0x53ea('0x4a')]['id']}},_0x191e36={};_0x191e36['model']=_[_0x53ea('0x34')](db[_0x53ea('0x2f')][_0x53ea('0x4b')]);_0x191e36['query']=_[_0x53ea('0x34')](_0x2ecc02[_0x53ea('0x33')]);_0x191e36[_0x53ea('0x35')]=_[_0x53ea('0x36')](_0x191e36[_0x53ea('0x32')],_0x191e36[_0x53ea('0x33')]);_0x1c042f['attributes']=_['intersection'](_0x191e36[_0x53ea('0x32')],qs[_0x53ea('0x37')](_0x2ecc02['query']['fields']));_0x1c042f['attributes']=_0x1c042f[_0x53ea('0x38')][_0x53ea('0x39')]?_0x1c042f['attributes']:_0x191e36[_0x53ea('0x32')];if(_0x2ecc02['query'][_0x53ea('0x45')]){_0x1c042f[_0x53ea('0x4c')]=[{'all':!![]}];}_0x1c042f=_[_0x53ea('0x41')]({},_0x1c042f,_0x2ecc02[_0x53ea('0x44')]);return db[_0x53ea('0x2f')][_0x53ea('0x4d')](_0x1c042f)[_0x53ea('0x28')](handleEntityNotFound(_0x3e550f,null))[_0x53ea('0x28')](respondWithResult(_0x3e550f,null))[_0x53ea('0x48')](handleError(_0x3e550f,null));};exports[_0x53ea('0x4e')]=function(_0x407fbc,_0x4f6f9f){return db[_0x53ea('0x2f')]['create'](_0x407fbc['body'],{})[_0x53ea('0x28')](respondWithResult(_0x4f6f9f,0xc9))[_0x53ea('0x48')](handleError(_0x4f6f9f,null));};exports[_0x53ea('0x27')]=function(_0xee7127,_0x2a0cd6){if(_0xee7127['body']['id']){delete _0xee7127[_0x53ea('0x4f')]['id'];}return db[_0x53ea('0x2f')][_0x53ea('0x4d')]({'where':{'id':_0xee7127[_0x53ea('0x4a')]['id']}})[_0x53ea('0x28')](handleEntityNotFound(_0x2a0cd6,null))[_0x53ea('0x28')](saveUpdates(_0xee7127[_0x53ea('0x4f')],null))['then'](respondWithResult(_0x2a0cd6,null))[_0x53ea('0x48')](handleError(_0x2a0cd6,null));};exports[_0x53ea('0x29')]=function(_0xaa4fb0,_0x228e40){return db[_0x53ea('0x2f')][_0x53ea('0x4d')]({'where':{'id':_0xaa4fb0[_0x53ea('0x4a')]['id']}})[_0x53ea('0x28')](handleEntityNotFound(_0x228e40,null))[_0x53ea('0x28')](removeEntity(_0x228e40,null))['catch'](handleError(_0x228e40,null));}; \ No newline at end of file +var _0xadc2=['set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','FreshsalesField','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','show','params','rawAttributes','include','options','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset'];(function(_0x363787,_0x586566){var _0x16ceb7=function(_0x2692b1){while(--_0x2692b1){_0x363787['push'](_0x363787['shift']());}};_0x16ceb7(++_0x586566);}(_0xadc2,0x1df));var _0x2adc=function(_0x4b4dd0,_0x4b7586){_0x4b4dd0=_0x4b4dd0-0x0;var _0x42da25=_0xadc2[_0x4b4dd0];return _0x42da25;};'use strict';var emlformat=require(_0x2adc('0x0'));var rimraf=require(_0x2adc('0x1'));var zipdir=require(_0x2adc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2adc('0x3'));var moment=require('moment');var BPromise=require(_0x2adc('0x4'));var Mustache=require(_0x2adc('0x5'));var util=require(_0x2adc('0x6'));var path=require('path');var sox=require(_0x2adc('0x7'));var csv=require(_0x2adc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2adc('0x9'));var _=require(_0x2adc('0xa'));var squel=require(_0x2adc('0xb'));var crypto=require(_0x2adc('0xc'));var jsforce=require(_0x2adc('0xd'));var deskjs=require(_0x2adc('0xe'));var toCsv=require(_0x2adc('0x8'));var querystring=require(_0x2adc('0xf'));var Papa=require(_0x2adc('0x10'));var Redis=require(_0x2adc('0x11'));var authService=require(_0x2adc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2adc('0x13'));var hardwareService=require(_0x2adc('0x14'));var logger=require('../../config/logger')(_0x2adc('0x15'));var utils=require(_0x2adc('0x16'));var config=require(_0x2adc('0x17'));var licenseUtil=require(_0x2adc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcfd56f,_0x3c6fd8){_0x3c6fd8=_0x3c6fd8||0xcc;return function(_0x44aa66){if(_0x44aa66){return _0xcfd56f[_0x2adc('0x19')](_0x3c6fd8);}return _0xcfd56f[_0x2adc('0x1a')](_0x3c6fd8)[_0x2adc('0x1b')]();};}function respondWithResult(_0x4622ba,_0x39d1d4){_0x39d1d4=_0x39d1d4||0xc8;return function(_0x13255d){if(_0x13255d){return _0x4622ba[_0x2adc('0x1a')](_0x39d1d4)['json'](_0x13255d);}};}function respondWithFilteredResult(_0x479fc7,_0x5529e0){return function(_0x56a7ea){if(_0x56a7ea){var _0x2ab374=typeof _0x5529e0['offset']===_0x2adc('0x1c')&&typeof _0x5529e0[_0x2adc('0x1d')]==='undefined';var _0x400984=_0x56a7ea[_0x2adc('0x1e')];var _0x51c455=_0x2ab374?0x0:_0x5529e0[_0x2adc('0x1f')];var _0x94e6c4=_0x2ab374?_0x56a7ea[_0x2adc('0x1e')]:_0x5529e0[_0x2adc('0x1f')]+_0x5529e0[_0x2adc('0x1d')];var _0x4ce96b;if(_0x94e6c4>=_0x400984){_0x94e6c4=_0x400984;_0x4ce96b=0xc8;}else{_0x4ce96b=0xce;}_0x479fc7[_0x2adc('0x1a')](_0x4ce96b);return _0x479fc7[_0x2adc('0x20')](_0x2adc('0x21'),_0x51c455+'-'+_0x94e6c4+'/'+_0x400984)[_0x2adc('0x22')](_0x56a7ea);}return null;};}function patchUpdates(_0x1d689e){return function(_0x24efcd){try{jsonpatch[_0x2adc('0x23')](_0x24efcd,_0x1d689e,!![]);}catch(_0x463835){return BPromise['reject'](_0x463835);}return _0x24efcd[_0x2adc('0x24')]();};}function saveUpdates(_0x43b73b,_0x3e7699){return function(_0x53dc5d){if(_0x53dc5d){return _0x53dc5d[_0x2adc('0x25')](_0x43b73b)[_0x2adc('0x26')](function(_0xec587c){return _0xec587c;});}return null;};}function removeEntity(_0x1ce352,_0x5d3d31){return function(_0x53f7b8){if(_0x53f7b8){return _0x53f7b8[_0x2adc('0x27')]()['then'](function(){_0x1ce352[_0x2adc('0x1a')](0xcc)[_0x2adc('0x1b')]();});}};}function handleEntityNotFound(_0xc0683b,_0x510da9){return function(_0x2a0f3b){if(!_0x2a0f3b){_0xc0683b[_0x2adc('0x19')](0x194);}return _0x2a0f3b;};}function handleError(_0xad7d13,_0x4a38d5){_0x4a38d5=_0x4a38d5||0x1f4;return function(_0x55dcf9){logger['error'](_0x55dcf9[_0x2adc('0x28')]);if(_0x55dcf9[_0x2adc('0x29')]){delete _0x55dcf9[_0x2adc('0x29')];}_0xad7d13['status'](_0x4a38d5)[_0x2adc('0x2a')](_0x55dcf9);};}exports['index']=function(_0x5a7e2e,_0xe68312){var _0x4aedf7={},_0x2f1d2e={},_0x50c3ff={'count':0x0,'rows':[]};var _0xc749ec=_['map'](db[_0x2adc('0x2b')]['rawAttributes'],function(_0x30a15e){return{'name':_0x30a15e['fieldName'],'type':_0x30a15e[_0x2adc('0x2c')][_0x2adc('0x2d')]};});_0x2f1d2e[_0x2adc('0x2e')]=_['map'](_0xc749ec,_0x2adc('0x29'));_0x2f1d2e[_0x2adc('0x2f')]=_[_0x2adc('0x30')](_0x5a7e2e[_0x2adc('0x2f')]);_0x2f1d2e[_0x2adc('0x31')]=_[_0x2adc('0x32')](_0x2f1d2e[_0x2adc('0x2e')],_0x2f1d2e[_0x2adc('0x2f')]);_0x4aedf7['attributes']=_[_0x2adc('0x32')](_0x2f1d2e['model'],qs[_0x2adc('0x33')](_0x5a7e2e['query'][_0x2adc('0x33')]));_0x4aedf7[_0x2adc('0x34')]=_0x4aedf7[_0x2adc('0x34')][_0x2adc('0x35')]?_0x4aedf7[_0x2adc('0x34')]:_0x2f1d2e[_0x2adc('0x2e')];if(!_0x5a7e2e[_0x2adc('0x2f')][_0x2adc('0x36')]('nolimit')){_0x4aedf7[_0x2adc('0x1d')]=qs[_0x2adc('0x1d')](_0x5a7e2e[_0x2adc('0x2f')]['limit']);_0x4aedf7['offset']=qs[_0x2adc('0x1f')](_0x5a7e2e[_0x2adc('0x2f')][_0x2adc('0x1f')]);}_0x4aedf7[_0x2adc('0x37')]=qs[_0x2adc('0x38')](_0x5a7e2e[_0x2adc('0x2f')][_0x2adc('0x38')]);_0x4aedf7[_0x2adc('0x39')]=qs[_0x2adc('0x31')](_[_0x2adc('0x3a')](_0x5a7e2e[_0x2adc('0x2f')],_0x2f1d2e['filters']),_0xc749ec);if(_0x5a7e2e['query'][_0x2adc('0x3b')]){_0x4aedf7[_0x2adc('0x39')]=_[_0x2adc('0x3c')](_0x4aedf7['where'],{'$or':_[_0x2adc('0x3d')](_0xc749ec,function(_0x3d7b9e){if(_0x3d7b9e[_0x2adc('0x2c')]!==_0x2adc('0x3e')){var _0x42b52f={};_0x42b52f[_0x3d7b9e['name']]={'$like':'%'+_0x5a7e2e[_0x2adc('0x2f')][_0x2adc('0x3b')]+'%'};return _0x42b52f;}})});}_0x4aedf7=_[_0x2adc('0x3c')]({},_0x4aedf7,_0x5a7e2e['options']);var _0x233b13={'where':_0x4aedf7[_0x2adc('0x39')]};return db[_0x2adc('0x2b')][_0x2adc('0x1e')](_0x233b13)['then'](function(_0x5b4dc6){_0x50c3ff[_0x2adc('0x1e')]=_0x5b4dc6;if(_0x5a7e2e[_0x2adc('0x2f')][_0x2adc('0x3f')]){_0x4aedf7['include']=[{'all':!![]}];}return db[_0x2adc('0x2b')]['findAll'](_0x4aedf7);})[_0x2adc('0x26')](function(_0x5ad0cb){_0x50c3ff['rows']=_0x5ad0cb;return _0x50c3ff;})['then'](respondWithFilteredResult(_0xe68312,_0x4aedf7))['catch'](handleError(_0xe68312,null));};exports[_0x2adc('0x40')]=function(_0xa13b8f,_0x1aae02){var _0xcad041={'raw':!![],'where':{'id':_0xa13b8f[_0x2adc('0x41')]['id']}},_0x1faf0c={};_0x1faf0c[_0x2adc('0x2e')]=_[_0x2adc('0x30')](db[_0x2adc('0x2b')][_0x2adc('0x42')]);_0x1faf0c[_0x2adc('0x2f')]=_['keys'](_0xa13b8f[_0x2adc('0x2f')]);_0x1faf0c[_0x2adc('0x31')]=_[_0x2adc('0x32')](_0x1faf0c[_0x2adc('0x2e')],_0x1faf0c[_0x2adc('0x2f')]);_0xcad041[_0x2adc('0x34')]=_[_0x2adc('0x32')](_0x1faf0c[_0x2adc('0x2e')],qs[_0x2adc('0x33')](_0xa13b8f[_0x2adc('0x2f')][_0x2adc('0x33')]));_0xcad041['attributes']=_0xcad041[_0x2adc('0x34')]['length']?_0xcad041['attributes']:_0x1faf0c[_0x2adc('0x2e')];if(_0xa13b8f[_0x2adc('0x2f')][_0x2adc('0x3f')]){_0xcad041[_0x2adc('0x43')]=[{'all':!![]}];}_0xcad041=_[_0x2adc('0x3c')]({},_0xcad041,_0xa13b8f[_0x2adc('0x44')]);return db[_0x2adc('0x2b')][_0x2adc('0x45')](_0xcad041)['then'](handleEntityNotFound(_0x1aae02,null))['then'](respondWithResult(_0x1aae02,null))[_0x2adc('0x46')](handleError(_0x1aae02,null));};exports['create']=function(_0x5a8024,_0x332d75){return db['FreshsalesField'][_0x2adc('0x47')](_0x5a8024['body'],{})[_0x2adc('0x26')](respondWithResult(_0x332d75,0xc9))[_0x2adc('0x46')](handleError(_0x332d75,null));};exports[_0x2adc('0x25')]=function(_0xdbe8b7,_0x28c2f9){if(_0xdbe8b7[_0x2adc('0x48')]['id']){delete _0xdbe8b7['body']['id'];}return db[_0x2adc('0x2b')]['find']({'where':{'id':_0xdbe8b7[_0x2adc('0x41')]['id']}})[_0x2adc('0x26')](handleEntityNotFound(_0x28c2f9,null))[_0x2adc('0x26')](saveUpdates(_0xdbe8b7[_0x2adc('0x48')],null))[_0x2adc('0x26')](respondWithResult(_0x28c2f9,null))[_0x2adc('0x46')](handleError(_0x28c2f9,null));};exports[_0x2adc('0x27')]=function(_0x2690e5,_0x37671f){return db[_0x2adc('0x2b')]['find']({'where':{'id':_0x2690e5[_0x2adc('0x41')]['id']}})['then'](handleEntityNotFound(_0x37671f,null))[_0x2adc('0x26')](removeEntity(_0x37671f,null))[_0x2adc('0x46')](handleError(_0x37671f,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 9e0c28a..b353b18 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 _0x01a6=['freshsales_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshsalesField.attributes','exports','define'];(function(_0x2c8d85,_0x590fef){var _0x277ef4=function(_0x7c7a91){while(--_0x7c7a91){_0x2c8d85['push'](_0x2c8d85['shift']());}};_0x277ef4(++_0x590fef);}(_0x01a6,0x162));var _0x601a=function(_0x2f0577,_0x1ee479){_0x2f0577=_0x2f0577-0x0;var _0x2c789f=_0x01a6[_0x2f0577];return _0x2c789f;};'use strict';var _=require(_0x601a('0x0'));var util=require('util');var logger=require(_0x601a('0x1'))(_0x601a('0x2'));var moment=require(_0x601a('0x3'));var BPromise=require(_0x601a('0x4'));var rp=require(_0x601a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x601a('0x6'));var config=require('../../config/environment');var attributes=require(_0x601a('0x7'));module[_0x601a('0x8')]=function(_0x30df8c,_0x196c77){return _0x30df8c[_0x601a('0x9')]('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x601a('0xa'),'fields':[_0x601a('0xb'),_0x601a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x60a5=['FieldId','lodash','api','request-promise','path','rimraf','./intFreshsalesField.attributes','exports','freshsales_unique_index','idField'];(function(_0x58eb39,_0x41c81d){var _0xdbd6f9=function(_0x42e1cf){while(--_0x42e1cf){_0x58eb39['push'](_0x58eb39['shift']());}};_0xdbd6f9(++_0x41c81d);}(_0x60a5,0x83));var _0x560a=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x60a5[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x560a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x560a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x560a('0x2'));var fs=require('fs');var path=require(_0x560a('0x3'));var rimraf=require(_0x560a('0x4'));var config=require('../../config/environment');var attributes=require(_0x560a('0x5'));module[_0x560a('0x6')]=function(_0x3856ae,_0x5aaec6){return _0x3856ae['define']('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x560a('0x7'),'fields':[_0x560a('0x8'),_0x560a('0x9')],'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 420e7ad..7227eaf 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 _0x01d9=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x50503b,_0x3d28a8){var _0x7d499d=function(_0x1d247c){while(--_0x1d247c){_0x50503b['push'](_0x50503b['shift']());}};_0x7d499d(++_0x3d28a8);}(_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 moment=require(_0x901d('0x2'));var BPromise=require(_0x901d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x901d('0x4'));var db=require(_0x901d('0x5'))['db'];var utils=require(_0x901d('0x6'));var logger=require(_0x901d('0x7'))(_0x901d('0x8'));var config=require(_0x901d('0x9'));var jayson=require(_0x901d('0xa'));var client=jayson['client'][_0x901d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6c9ac8,_0x21e1d7,_0x12c39f){return new BPromise(function(_0x313f85,_0x39fc94){return client[_0x901d('0xc')](_0x6c9ac8,_0x12c39f)[_0x901d('0xd')](function(_0x15076e){logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));logger[_0x901d('0x11')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x21e1d7,_0x901d('0x10'),JSON['stringify'](_0x15076e));if(_0x15076e[_0x901d('0x12')]){if(_0x15076e[_0x901d('0x12')][_0x901d('0x13')]===0x1f4){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e['error'][_0x901d('0x14')]);return _0x39fc94(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e[_0x901d('0x12')]['message']);return _0x313f85(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}else{logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));_0x313f85(_0x15076e[_0x901d('0x15')][_0x901d('0x14')]);}})[_0x901d('0x16')](function(_0x3368fc){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x3368fc);_0x39fc94(_0x3368fc);});});} \ No newline at end of file +var _0xe2fe=['then','info','FreshsalesField,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x22cc9a,_0xda386f){var _0x1d98d3=function(_0x560ed6){while(--_0x560ed6){_0x22cc9a['push'](_0x22cc9a['shift']());}};_0x1d98d3(++_0xda386f);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 02e458f..9d7e394 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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x99c649,_0x512e81){var _0x355801=function(_0x14dee6){while(--_0x14dee6){_0x99c649['push'](_0x99c649['shift']());}};_0x355801(++_0x512e81);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x113afb,_0x286989){var _0x3337bf=function(_0x42c236){while(--_0x42c236){_0x113afb['push'](_0x113afb['shift']());}};_0x3337bf(++_0x286989);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/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 b77fdcf..cd4914b 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 _0xeec6=['STRING','username','ENUM','newTab','integrationTab','sequelize'];(function(_0x214caf,_0x59e8d2){var _0x2c977d=function(_0x54872e){while(--_0x54872e){_0x214caf['push'](_0x214caf['shift']());}};_0x2c977d(++_0x59e8d2);}(_0xeec6,0x125));var _0x6eec=function(_0x54eab6,_0x5e262f){_0x54eab6=_0x54eab6-0x0;var _0x1e7435=_0xeec6[_0x54eab6];return _0x1e7435;};'use strict';var Sequelize=require(_0x6eec('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6eec('0x1')]},'username':{'type':Sequelize[_0x6eec('0x1')],'unique':_0x6eec('0x2')},'remoteUri':{'type':Sequelize[_0x6eec('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x6eec('0x1')]},'clientSecret':{'type':Sequelize[_0x6eec('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x6eec('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x6eec('0x3')]('integrationTab',_0x6eec('0x4')),'defaultValue':_0x6eec('0x5')}}; \ No newline at end of file +var _0x4bd3=['newTab','integrationTab','sequelize','STRING','ENUM'];(function(_0xb828a,_0x2b5703){var _0x951132=function(_0x51e295){while(--_0x51e295){_0xb828a['push'](_0xb828a['shift']());}};_0x951132(++_0x2b5703);}(_0x4bd3,0x174));var _0x34bd=function(_0x31d4a9,_0x118114){_0x31d4a9=_0x31d4a9-0x0;var _0x4e15f4=_0x4bd3[_0x31d4a9];return _0x4e15f4;};'use strict';var Sequelize=require(_0x34bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x34bd('0x1')]},'description':{'type':Sequelize[_0x34bd('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x34bd('0x1')]},'clientId':{'type':Sequelize[_0x34bd('0x1')]},'clientSecret':{'type':Sequelize[_0x34bd('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x34bd('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x34bd('0x2')]('integrationTab',_0x34bd('0x3')),'defaultValue':_0x34bd('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 037f357..6ee3c28 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 _0x170a=['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','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','pick','merge','where','VIRTUAL','filter','includeAll','include','SalesforceAccount','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','SalesforceConfiguration','sort','options','nolimit','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','Task','remoteUri','clientSecret','securityToken','substring','clientId','login','password','concat','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','string','int','picklist','email','textarea','includes','label','custom','picklistValues','value','boolean','true','False','false','test','stringify','statusCode','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x170a,0xed));var _0xa170=function(_0x207aaa,_0x182043){_0x207aaa=_0x207aaa-0x0;var _0x35f7dc=_0x170a[_0x207aaa];return _0x35f7dc;};'use strict';var emlformat=require(_0xa170('0x0'));var rimraf=require(_0xa170('0x1'));var zipdir=require(_0xa170('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa170('0x3'));var moment=require('moment');var BPromise=require(_0xa170('0x4'));var Mustache=require('mustache');var util=require(_0xa170('0x5'));var path=require(_0xa170('0x6'));var sox=require(_0xa170('0x7'));var csv=require(_0xa170('0x8'));var ejs=require(_0xa170('0x9'));var fs=require('fs');var fs_extra=require(_0xa170('0xa'));var _=require(_0xa170('0xb'));var squel=require(_0xa170('0xc'));var crypto=require('crypto');var jsforce=require(_0xa170('0xd'));var deskjs=require(_0xa170('0xe'));var toCsv=require(_0xa170('0x8'));var querystring=require(_0xa170('0xf'));var Papa=require(_0xa170('0x10'));var Redis=require(_0xa170('0x11'));var authService=require(_0xa170('0x12'));var qs=require(_0xa170('0x13'));var as=require(_0xa170('0x14'));var hardwareService=require(_0xa170('0x15'));var logger=require('../../config/logger')(_0xa170('0x16'));var utils=require('../../config/utils');var config=require(_0xa170('0x17'));var licenseUtil=require(_0xa170('0x18'));var db=require(_0xa170('0x19'))['db'];var integrations=require(_0xa170('0x1a'));function respondWithStatusCode(_0xf3990,_0x3d3ecc){_0x3d3ecc=_0x3d3ecc||0xcc;return function(_0xb8d3fb){if(_0xb8d3fb){return _0xf3990[_0xa170('0x1b')](_0x3d3ecc);}return _0xf3990[_0xa170('0x1c')](_0x3d3ecc)[_0xa170('0x1d')]();};}function respondWithResult(_0x125516,_0xf7e664){_0xf7e664=_0xf7e664||0xc8;return function(_0x2937d2){if(_0x2937d2){return _0x125516['status'](_0xf7e664)['json'](_0x2937d2);}};}function respondWithFilteredResult(_0x4b1424,_0x330be3){return function(_0x563b3e){if(_0x563b3e){var _0xbd6325=typeof _0x330be3[_0xa170('0x1e')]===_0xa170('0x1f')&&typeof _0x330be3[_0xa170('0x20')]==='undefined';var _0x556c08=_0x563b3e[_0xa170('0x21')];var _0x30edbb=_0xbd6325?0x0:_0x330be3[_0xa170('0x1e')];var _0x34ade8=_0xbd6325?_0x563b3e['count']:_0x330be3['offset']+_0x330be3[_0xa170('0x20')];var _0x3f9fd2;if(_0x34ade8>=_0x556c08){_0x34ade8=_0x556c08;_0x3f9fd2=0xc8;}else{_0x3f9fd2=0xce;}_0x4b1424['status'](_0x3f9fd2);return _0x4b1424['set'](_0xa170('0x22'),_0x30edbb+'-'+_0x34ade8+'/'+_0x556c08)[_0xa170('0x23')](_0x563b3e);}return null;};}function patchUpdates(_0x38f10a){return function(_0x1c5baa){try{jsonpatch[_0xa170('0x24')](_0x1c5baa,_0x38f10a,!![]);}catch(_0x241284){return BPromise[_0xa170('0x25')](_0x241284);}return _0x1c5baa[_0xa170('0x26')]();};}function saveUpdates(_0x1324c2,_0x4bb40b){return function(_0x44df31){if(_0x44df31){return _0x44df31[_0xa170('0x27')](_0x1324c2)['then'](function(_0x18c44f){return _0x18c44f;});}return null;};}function removeEntity(_0x333bb0,_0x279430){return function(_0x27aa32){if(_0x27aa32){return _0x27aa32[_0xa170('0x28')]()[_0xa170('0x29')](function(){_0x333bb0[_0xa170('0x1c')](0xcc)[_0xa170('0x1d')]();});}};}function handleEntityNotFound(_0xb61e8f,_0x321eea){return function(_0x5834b0){if(!_0x5834b0){_0xb61e8f[_0xa170('0x1b')](0x194);}return _0x5834b0;};}function handleError(_0x41e4aa,_0x2884f9){_0x2884f9=_0x2884f9||0x1f4;return function(_0x2e8336){logger[_0xa170('0x2a')](_0x2e8336[_0xa170('0x2b')]);if(_0x2e8336[_0xa170('0x2c')]){delete _0x2e8336[_0xa170('0x2c')];}_0x41e4aa['status'](_0x2884f9)[_0xa170('0x2d')](_0x2e8336);};}exports[_0xa170('0x2e')]=function(_0x44df9c,_0x38b79e){var _0x2f10f3={},_0xab05a9={},_0x70149d={'count':0x0,'rows':[]};var _0x5bdf1d=_['map'](db['SalesforceAccount'][_0xa170('0x2f')],function(_0x7a9549){return{'name':_0x7a9549['fieldName'],'type':_0x7a9549[_0xa170('0x30')][_0xa170('0x31')]};});_0xab05a9[_0xa170('0x32')]=_[_0xa170('0x33')](_0x5bdf1d,'name');_0xab05a9[_0xa170('0x34')]=_[_0xa170('0x35')](_0x44df9c[_0xa170('0x34')]);_0xab05a9[_0xa170('0x36')]=_[_0xa170('0x37')](_0xab05a9[_0xa170('0x32')],_0xab05a9[_0xa170('0x34')]);_0x2f10f3['attributes']=_[_0xa170('0x37')](_0xab05a9[_0xa170('0x32')],qs['fields'](_0x44df9c[_0xa170('0x34')][_0xa170('0x38')]));_0x2f10f3[_0xa170('0x39')]=_0x2f10f3['attributes'][_0xa170('0x3a')]?_0x2f10f3['attributes']:_0xab05a9['model'];if(!_0x44df9c[_0xa170('0x34')][_0xa170('0x3b')]('nolimit')){_0x2f10f3[_0xa170('0x20')]=qs[_0xa170('0x20')](_0x44df9c[_0xa170('0x34')][_0xa170('0x20')]);_0x2f10f3[_0xa170('0x1e')]=qs['offset'](_0x44df9c['query'][_0xa170('0x1e')]);}_0x2f10f3[_0xa170('0x3c')]=qs['sort'](_0x44df9c[_0xa170('0x34')]['sort']);_0x2f10f3['where']=qs[_0xa170('0x36')](_[_0xa170('0x3d')](_0x44df9c['query'],_0xab05a9[_0xa170('0x36')]),_0x5bdf1d);if(_0x44df9c[_0xa170('0x34')]['filter']){_0x2f10f3['where']=_[_0xa170('0x3e')](_0x2f10f3[_0xa170('0x3f')],{'$or':_[_0xa170('0x33')](_0x5bdf1d,function(_0x2eaad6){if(_0x2eaad6[_0xa170('0x30')]!==_0xa170('0x40')){var _0x34b798={};_0x34b798[_0x2eaad6['name']]={'$like':'%'+_0x44df9c[_0xa170('0x34')][_0xa170('0x41')]+'%'};return _0x34b798;}})});}_0x2f10f3=_[_0xa170('0x3e')]({},_0x2f10f3,_0x44df9c['options']);var _0x5981a6={'where':_0x2f10f3[_0xa170('0x3f')]};return db['SalesforceAccount']['count'](_0x5981a6)[_0xa170('0x29')](function(_0x25dfe0){_0x70149d['count']=_0x25dfe0;if(_0x44df9c['query'][_0xa170('0x42')]){_0x2f10f3[_0xa170('0x43')]=[{'all':!![]}];}return db[_0xa170('0x44')][_0xa170('0x45')](_0x2f10f3);})[_0xa170('0x29')](function(_0x5708f3){_0x70149d[_0xa170('0x46')]=_0x5708f3;return _0x70149d;})[_0xa170('0x29')](respondWithFilteredResult(_0x38b79e,_0x2f10f3))[_0xa170('0x47')](handleError(_0x38b79e,null));};exports['show']=function(_0x20a438,_0x48c0c2){var _0x8bba79={'raw':![],'where':{'id':_0x20a438[_0xa170('0x48')]['id']}},_0x410464={};_0x410464[_0xa170('0x32')]=_['keys'](db['SalesforceAccount'][_0xa170('0x2f')]);_0x410464[_0xa170('0x34')]=_[_0xa170('0x35')](_0x20a438[_0xa170('0x34')]);_0x410464[_0xa170('0x36')]=_[_0xa170('0x37')](_0x410464[_0xa170('0x32')],_0x410464['query']);_0x8bba79[_0xa170('0x39')]=_[_0xa170('0x37')](_0x410464[_0xa170('0x32')],qs[_0xa170('0x38')](_0x20a438[_0xa170('0x34')][_0xa170('0x38')]));_0x8bba79[_0xa170('0x39')]=_0x8bba79[_0xa170('0x39')]['length']?_0x8bba79[_0xa170('0x39')]:_0x410464[_0xa170('0x32')];if(_0x20a438[_0xa170('0x34')]['includeAll']){_0x8bba79[_0xa170('0x43')]=[{'all':!![]}];}_0x8bba79=_[_0xa170('0x3e')]({},_0x8bba79,_0x20a438['options']);return db[_0xa170('0x44')][_0xa170('0x49')](_0x8bba79)[_0xa170('0x29')](handleEntityNotFound(_0x48c0c2,null))['then'](respondWithResult(_0x48c0c2,null))[_0xa170('0x47')](handleError(_0x48c0c2,null));};exports[_0xa170('0x4a')]=function(_0x59042b,_0x1e2843){return db['SalesforceAccount'][_0xa170('0x4a')](_0x59042b[_0xa170('0x4b')],{})['then'](respondWithResult(_0x1e2843,0xc9))['catch'](handleError(_0x1e2843,null));};exports[_0xa170('0x27')]=function(_0x735a34,_0x65b335){if(_0x735a34[_0xa170('0x4b')]['id']){delete _0x735a34[_0xa170('0x4b')]['id'];}return db[_0xa170('0x44')][_0xa170('0x49')]({'where':{'id':_0x735a34[_0xa170('0x48')]['id']}})[_0xa170('0x29')](handleEntityNotFound(_0x65b335,null))[_0xa170('0x29')](saveUpdates(_0x735a34[_0xa170('0x4b')],null))[_0xa170('0x29')](respondWithResult(_0x65b335,null))[_0xa170('0x47')](handleError(_0x65b335,null));};exports[_0xa170('0x28')]=function(_0x5cd5f7,_0xcbe0b5){return db[_0xa170('0x44')]['find']({'where':{'id':_0x5cd5f7[_0xa170('0x48')]['id']}})['then'](handleEntityNotFound(_0xcbe0b5,null))[_0xa170('0x29')](removeEntity(_0xcbe0b5,null))['catch'](handleError(_0xcbe0b5,null));};exports[_0xa170('0x4c')]=function(_0x1b2158,_0x420aa0,_0x5c3563){var _0x5bfcfa={};var _0x4801e1={};var _0x3c89fb;var _0x3bb144;return db['SalesforceAccount'][_0xa170('0x4d')]({'where':{'id':_0x1b2158[_0xa170('0x48')]['id']}})[_0xa170('0x29')](handleEntityNotFound(_0x420aa0,null))[_0xa170('0x29')](function(_0x24448f){if(_0x24448f){_0x3c89fb=_0x24448f;_0x4801e1[_0xa170('0x32')]=_['keys'](db[_0xa170('0x4e')][_0xa170('0x2f')]);_0x4801e1[_0xa170('0x34')]=_[_0xa170('0x35')](_0x1b2158[_0xa170('0x34')]);_0x4801e1[_0xa170('0x36')]=_[_0xa170('0x37')](_0x4801e1[_0xa170('0x32')],_0x4801e1[_0xa170('0x34')]);_0x5bfcfa[_0xa170('0x39')]=_[_0xa170('0x37')](_0x4801e1[_0xa170('0x32')],qs[_0xa170('0x38')](_0x1b2158[_0xa170('0x34')][_0xa170('0x38')]));_0x5bfcfa[_0xa170('0x39')]=_0x5bfcfa['attributes']['length']?_0x5bfcfa[_0xa170('0x39')]:_0x4801e1[_0xa170('0x32')];_0x5bfcfa['order']=qs[_0xa170('0x4f')](_0x1b2158[_0xa170('0x34')][_0xa170('0x4f')]);_0x5bfcfa[_0xa170('0x3f')]=qs[_0xa170('0x36')](_[_0xa170('0x3d')](_0x1b2158[_0xa170('0x34')],_0x4801e1['filters']));if(_0x1b2158[_0xa170('0x34')][_0xa170('0x41')]){_0x5bfcfa[_0xa170('0x3f')]=_['merge'](_0x5bfcfa['where'],{'$or':_['map'](_0x5bfcfa[_0xa170('0x39')],function(_0x30b8b5){var _0xd24e42={};_0xd24e42[_0x30b8b5]={'$like':'%'+_0x1b2158[_0xa170('0x34')][_0xa170('0x41')]+'%'};return _0xd24e42;})});}_0x5bfcfa=_[_0xa170('0x3e')]({},_0x5bfcfa,_0x1b2158[_0xa170('0x50')]);return _0x3c89fb[_0xa170('0x4c')](_0x5bfcfa);}})[_0xa170('0x29')](function(_0x5cebf1){if(_0x5cebf1){_0x3bb144=_0x5cebf1[_0xa170('0x3a')];if(!_0x1b2158[_0xa170('0x34')][_0xa170('0x3b')](_0xa170('0x51'))){_0x5bfcfa[_0xa170('0x20')]=qs[_0xa170('0x20')](_0x1b2158[_0xa170('0x34')]['limit']);_0x5bfcfa[_0xa170('0x1e')]=qs[_0xa170('0x1e')](_0x1b2158[_0xa170('0x34')][_0xa170('0x1e')]);}return _0x3c89fb[_0xa170('0x4c')](_0x5bfcfa);}})[_0xa170('0x29')](function(_0x3f6637){if(_0x3f6637){return _0x3f6637?{'count':_0x3bb144,'rows':_0x3f6637}:null;}})['then'](respondWithResult(_0x420aa0,null))['catch'](handleError(_0x420aa0,null));};exports[_0xa170('0x52')]=function(_0xe8bac5,_0x58797f,_0x50a87e){if(_0xe8bac5[_0xa170('0x4b')]['id']){delete _0xe8bac5[_0xa170('0x4b')]['id'];}return db[_0xa170('0x44')][_0xa170('0x4d')]({'where':{'id':_0xe8bac5[_0xa170('0x48')]['id']}})[_0xa170('0x29')](handleEntityNotFound(_0x58797f,null))[_0xa170('0x29')](function(_0x3a8bd5){if(_0x3a8bd5){_0xe8bac5[_0xa170('0x4b')]['AccountId']=_0x3a8bd5['id'];_0xe8bac5['body']['Subjects']=integrations[_0xa170('0x53')](_0xe8bac5['body'][_0xa170('0x54')],_0xe8bac5[_0xa170('0x4b')][_0xa170('0x30')]);_0xe8bac5['body'][_0xa170('0x55')]=integrations[_0xa170('0x56')](_0xe8bac5['body'][_0xa170('0x54')],_0xe8bac5[_0xa170('0x4b')][_0xa170('0x30')]);return db[_0xa170('0x4e')][_0xa170('0x4a')](_0xe8bac5[_0xa170('0x4b')],{'include':[{'model':db[_0xa170('0x57')],'as':_0xa170('0x58')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})[_0xa170('0x29')](respondWithResult(_0x58797f,null))['catch'](handleError(_0x58797f,null));};exports[_0xa170('0x59')]=function(_0x3df7e8,_0x3c88fa,_0x3c3283){var _0x28fe7a;var _0x21844b='';var _0x5b5165=_0xa170('0x5a');return db['SalesforceAccount'][_0xa170('0x4d')]({'where':{'id':_0x3df7e8[_0xa170('0x48')]['id']},'attributes':['id',_0xa170('0x5b'),'clientId',_0xa170('0x5c'),'username','password',_0xa170('0x5d')]})[_0xa170('0x29')](handleEntityNotFound(_0x3c88fa,null))['then'](function(_0x4bb9da){if(_0x4bb9da){_0x21844b=_0x4bb9da[_0xa170('0x5b')];var _0x49b192=_0x21844b['slice'](-0x1);if(_0x49b192==='/'){_0x21844b=_0x21844b[_0xa170('0x5e')](0x0,_0x21844b['lastIndexOf'](_0x49b192));}_0x28fe7a=new jsforce['Connection']({'oauth2':{'loginUrl':_0x21844b,'clientId':_0x4bb9da[_0xa170('0x5f')],'clientSecret':_0x4bb9da[_0xa170('0x5c')]}});return _0x28fe7a[_0xa170('0x60')](_0x4bb9da['username'],_0x4bb9da[_0xa170('0x61')][_0xa170('0x62')](_0x4bb9da['securityToken']));}})[_0xa170('0x29')](function(_0x581cbd){if(_0x581cbd){if(!_[_0xa170('0x63')](_0x3df7e8['query'][_0xa170('0x64')])){_0x5b5165=_0x3df7e8['query']['ticketType'];}return _0x28fe7a['sobject'](_0x5b5165)[_0xa170('0x65')]();}})['then'](function(_0x3344e6){var _0xdd8191=[_0xa170('0x66'),_0xa170('0x67'),_0xa170('0x68'),_0xa170('0x69'),'Subject','Description'];var _0x45baf7=[_0xa170('0x6a'),_0xa170('0x6b'),_0xa170('0x6c'),'boolean',_0xa170('0x6d'),_0xa170('0x6e'),'phone'];if(_0x3344e6){_['remove'](_0x3344e6[_0xa170('0x38')],function(_0x1c6e8b){return _0xdd8191[_0xa170('0x6f')](_0x1c6e8b['name'])||!_0x45baf7[_0xa170('0x6f')](_0x1c6e8b['type']);});return{'count':_0x3344e6['fields'][_0xa170('0x3a')],'rows':_[_0xa170('0x33')](_0x3344e6[_0xa170('0x38')],function(_0x3fdf56){return{'id':_0x3fdf56[_0xa170('0x2c')],'name':_0x3fdf56[_0xa170('0x70')],'custom':_0x3fdf56[_0xa170('0x71')],'options':_0x3fdf56[_0xa170('0x72')]['length']>0x0?_[_0xa170('0x33')](_0x3fdf56['picklistValues'],function(_0x5bb690){return{'name':_0x5bb690['label'],'value':_0x5bb690[_0xa170('0x73')]};}):_0x3fdf56[_0xa170('0x30')]==_0xa170('0x74')?[{'name':'True','value':_0xa170('0x75')},{'name':_0xa170('0x76'),'value':_0xa170('0x77')}]:[]};})};}})[_0xa170('0x29')](respondWithResult(_0x3c88fa,null))[_0xa170('0x47')](function(_0x427864){var _0x19e29e=_0x3df7e8[_0xa170('0x34')][_0xa170('0x78')]?0x1f4:_0x427864['statusCode']||0x1f4;logger[_0xa170('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0xa170('0x59'),_0x19e29e,JSON[_0xa170('0x79')](_0x427864));delete _0x427864['name'];if(_0x19e29e===0x191){_0x19e29e=0x190;}_0x3c88fa[_0xa170('0x1c')](_0x19e29e)[_0xa170('0x2d')](_0x3df7e8['query'][_0xa170('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0x427864[_0xa170('0x7a')]}:_0x427864);});}; \ No newline at end of file +var _0x71fc=['count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','getConfigurations','findOne','nolimit','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','clientId','login','concat','ticketType','sobject','describe','OwnerId','ActivityDate','Subject','Description','string','picklist','boolean','phone','remove','includes','label','custom','picklistValues','value','True','true','False','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit'];(function(_0x1b9ed2,_0x419f85){var _0x447ee2=function(_0x46d30a){while(--_0x46d30a){_0x1b9ed2['push'](_0x1b9ed2['shift']());}};_0x447ee2(++_0x419f85);}(_0x71fc,0xda));var _0xc71f=function(_0x427aa2,_0xed1752){_0x427aa2=_0x427aa2-0x0;var _0x4868d5=_0x71fc[_0x427aa2];return _0x4868d5;};'use strict';var emlformat=require(_0xc71f('0x0'));var rimraf=require(_0xc71f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc71f('0x2'));var rp=require(_0xc71f('0x3'));var moment=require(_0xc71f('0x4'));var BPromise=require(_0xc71f('0x5'));var Mustache=require('mustache');var util=require(_0xc71f('0x6'));var path=require(_0xc71f('0x7'));var sox=require(_0xc71f('0x8'));var csv=require('to-csv');var ejs=require(_0xc71f('0x9'));var fs=require('fs');var fs_extra=require(_0xc71f('0xa'));var _=require(_0xc71f('0xb'));var squel=require('squel');var crypto=require(_0xc71f('0xc'));var jsforce=require(_0xc71f('0xd'));var deskjs=require(_0xc71f('0xe'));var toCsv=require(_0xc71f('0xf'));var querystring=require(_0xc71f('0x10'));var Papa=require(_0xc71f('0x11'));var Redis=require('ioredis');var authService=require(_0xc71f('0x12'));var qs=require(_0xc71f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc71f('0x14'))(_0xc71f('0x15'));var utils=require(_0xc71f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc71f('0x17'));var db=require(_0xc71f('0x18'))['db'];var integrations=require(_0xc71f('0x19'));function respondWithStatusCode(_0x4903de,_0x3c1336){_0x3c1336=_0x3c1336||0xcc;return function(_0x3f603b){if(_0x3f603b){return _0x4903de[_0xc71f('0x1a')](_0x3c1336);}return _0x4903de[_0xc71f('0x1b')](_0x3c1336)['end']();};}function respondWithResult(_0x18b746,_0x236dce){_0x236dce=_0x236dce||0xc8;return function(_0x2b4040){if(_0x2b4040){return _0x18b746[_0xc71f('0x1b')](_0x236dce)[_0xc71f('0x1c')](_0x2b4040);}};}function respondWithFilteredResult(_0x380a65,_0x4343bb){return function(_0x6718d7){if(_0x6718d7){var _0x27af48=typeof _0x4343bb[_0xc71f('0x1d')]===_0xc71f('0x1e')&&typeof _0x4343bb[_0xc71f('0x1f')]===_0xc71f('0x1e');var _0x615804=_0x6718d7[_0xc71f('0x20')];var _0x4470cc=_0x27af48?0x0:_0x4343bb[_0xc71f('0x1d')];var _0xfcf588=_0x27af48?_0x6718d7[_0xc71f('0x20')]:_0x4343bb['offset']+_0x4343bb[_0xc71f('0x1f')];var _0x4eace3;if(_0xfcf588>=_0x615804){_0xfcf588=_0x615804;_0x4eace3=0xc8;}else{_0x4eace3=0xce;}_0x380a65[_0xc71f('0x1b')](_0x4eace3);return _0x380a65[_0xc71f('0x21')](_0xc71f('0x22'),_0x4470cc+'-'+_0xfcf588+'/'+_0x615804)[_0xc71f('0x1c')](_0x6718d7);}return null;};}function patchUpdates(_0x59b114){return function(_0x45e734){try{jsonpatch[_0xc71f('0x23')](_0x45e734,_0x59b114,!![]);}catch(_0x5eed74){return BPromise[_0xc71f('0x24')](_0x5eed74);}return _0x45e734[_0xc71f('0x25')]();};}function saveUpdates(_0x13c28f,_0x4db476){return function(_0x3218de){if(_0x3218de){return _0x3218de['update'](_0x13c28f)[_0xc71f('0x26')](function(_0x4e0df8){return _0x4e0df8;});}return null;};}function removeEntity(_0x3dfa8b,_0x37a910){return function(_0x413d57){if(_0x413d57){return _0x413d57[_0xc71f('0x27')]()[_0xc71f('0x26')](function(){_0x3dfa8b[_0xc71f('0x1b')](0xcc)[_0xc71f('0x28')]();});}};}function handleEntityNotFound(_0x5ed906,_0xd006c7){return function(_0x8694c9){if(!_0x8694c9){_0x5ed906[_0xc71f('0x1a')](0x194);}return _0x8694c9;};}function handleError(_0x4a5706,_0x137e1e){_0x137e1e=_0x137e1e||0x1f4;return function(_0x2f661f){logger[_0xc71f('0x29')](_0x2f661f[_0xc71f('0x2a')]);if(_0x2f661f[_0xc71f('0x2b')]){delete _0x2f661f[_0xc71f('0x2b')];}_0x4a5706[_0xc71f('0x1b')](_0x137e1e)[_0xc71f('0x2c')](_0x2f661f);};}exports[_0xc71f('0x2d')]=function(_0x10dc08,_0x6a1a67){var _0x253379={},_0x1786c1={},_0x417faa={'count':0x0,'rows':[]};var _0x324ddf=_[_0xc71f('0x2e')](db[_0xc71f('0x2f')][_0xc71f('0x30')],function(_0x2b98fb){return{'name':_0x2b98fb['fieldName'],'type':_0x2b98fb['type']['key']};});_0x1786c1[_0xc71f('0x31')]=_[_0xc71f('0x2e')](_0x324ddf,'name');_0x1786c1['query']=_[_0xc71f('0x32')](_0x10dc08[_0xc71f('0x33')]);_0x1786c1[_0xc71f('0x34')]=_[_0xc71f('0x35')](_0x1786c1[_0xc71f('0x31')],_0x1786c1[_0xc71f('0x33')]);_0x253379[_0xc71f('0x36')]=_[_0xc71f('0x35')](_0x1786c1[_0xc71f('0x31')],qs[_0xc71f('0x37')](_0x10dc08[_0xc71f('0x33')][_0xc71f('0x37')]));_0x253379[_0xc71f('0x36')]=_0x253379[_0xc71f('0x36')][_0xc71f('0x38')]?_0x253379[_0xc71f('0x36')]:_0x1786c1['model'];if(!_0x10dc08[_0xc71f('0x33')][_0xc71f('0x39')]('nolimit')){_0x253379[_0xc71f('0x1f')]=qs[_0xc71f('0x1f')](_0x10dc08[_0xc71f('0x33')][_0xc71f('0x1f')]);_0x253379['offset']=qs[_0xc71f('0x1d')](_0x10dc08['query'][_0xc71f('0x1d')]);}_0x253379[_0xc71f('0x3a')]=qs[_0xc71f('0x3b')](_0x10dc08[_0xc71f('0x33')][_0xc71f('0x3b')]);_0x253379[_0xc71f('0x3c')]=qs[_0xc71f('0x34')](_[_0xc71f('0x3d')](_0x10dc08[_0xc71f('0x33')],_0x1786c1['filters']),_0x324ddf);if(_0x10dc08[_0xc71f('0x33')][_0xc71f('0x3e')]){_0x253379[_0xc71f('0x3c')]=_[_0xc71f('0x3f')](_0x253379[_0xc71f('0x3c')],{'$or':_['map'](_0x324ddf,function(_0x15db5c){if(_0x15db5c[_0xc71f('0x40')]!==_0xc71f('0x41')){var _0x3653cf={};_0x3653cf[_0x15db5c['name']]={'$like':'%'+_0x10dc08[_0xc71f('0x33')][_0xc71f('0x3e')]+'%'};return _0x3653cf;}})});}_0x253379=_[_0xc71f('0x3f')]({},_0x253379,_0x10dc08[_0xc71f('0x42')]);var _0x5b234f={'where':_0x253379[_0xc71f('0x3c')]};return db[_0xc71f('0x2f')]['count'](_0x5b234f)[_0xc71f('0x26')](function(_0x411efa){_0x417faa[_0xc71f('0x20')]=_0x411efa;if(_0x10dc08['query'][_0xc71f('0x43')]){_0x253379[_0xc71f('0x44')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xc71f('0x45')](_0x253379);})[_0xc71f('0x26')](function(_0x2b259b){_0x417faa[_0xc71f('0x46')]=_0x2b259b;return _0x417faa;})['then'](respondWithFilteredResult(_0x6a1a67,_0x253379))['catch'](handleError(_0x6a1a67,null));};exports[_0xc71f('0x47')]=function(_0x228404,_0x407256){var _0xb4d4f3={'raw':![],'where':{'id':_0x228404[_0xc71f('0x48')]['id']}},_0x2cc523={};_0x2cc523['model']=_[_0xc71f('0x32')](db[_0xc71f('0x2f')]['rawAttributes']);_0x2cc523[_0xc71f('0x33')]=_[_0xc71f('0x32')](_0x228404[_0xc71f('0x33')]);_0x2cc523['filters']=_[_0xc71f('0x35')](_0x2cc523['model'],_0x2cc523[_0xc71f('0x33')]);_0xb4d4f3[_0xc71f('0x36')]=_[_0xc71f('0x35')](_0x2cc523[_0xc71f('0x31')],qs[_0xc71f('0x37')](_0x228404[_0xc71f('0x33')][_0xc71f('0x37')]));_0xb4d4f3[_0xc71f('0x36')]=_0xb4d4f3[_0xc71f('0x36')][_0xc71f('0x38')]?_0xb4d4f3[_0xc71f('0x36')]:_0x2cc523['model'];if(_0x228404['query'][_0xc71f('0x43')]){_0xb4d4f3[_0xc71f('0x44')]=[{'all':!![]}];}_0xb4d4f3=_[_0xc71f('0x3f')]({},_0xb4d4f3,_0x228404[_0xc71f('0x42')]);return db[_0xc71f('0x2f')][_0xc71f('0x49')](_0xb4d4f3)[_0xc71f('0x26')](handleEntityNotFound(_0x407256,null))[_0xc71f('0x26')](respondWithResult(_0x407256,null))[_0xc71f('0x4a')](handleError(_0x407256,null));};exports[_0xc71f('0x4b')]=function(_0x5019cd,_0x257686){return db['SalesforceAccount'][_0xc71f('0x4b')](_0x5019cd['body'],{})[_0xc71f('0x26')](respondWithResult(_0x257686,0xc9))[_0xc71f('0x4a')](handleError(_0x257686,null));};exports['update']=function(_0x10c5a7,_0x59e285){if(_0x10c5a7[_0xc71f('0x4c')]['id']){delete _0x10c5a7[_0xc71f('0x4c')]['id'];}return db[_0xc71f('0x2f')][_0xc71f('0x49')]({'where':{'id':_0x10c5a7[_0xc71f('0x48')]['id']}})[_0xc71f('0x26')](handleEntityNotFound(_0x59e285,null))[_0xc71f('0x26')](saveUpdates(_0x10c5a7[_0xc71f('0x4c')],null))[_0xc71f('0x26')](respondWithResult(_0x59e285,null))[_0xc71f('0x4a')](handleError(_0x59e285,null));};exports[_0xc71f('0x27')]=function(_0x4e8b55,_0x34137a){return db['SalesforceAccount'][_0xc71f('0x49')]({'where':{'id':_0x4e8b55[_0xc71f('0x48')]['id']}})['then'](handleEntityNotFound(_0x34137a,null))[_0xc71f('0x26')](removeEntity(_0x34137a,null))[_0xc71f('0x4a')](handleError(_0x34137a,null));};exports[_0xc71f('0x4d')]=function(_0x21903c,_0x5c1220,_0x56e3b1){var _0x58506f={};var _0x3d6de2={};var _0x97258c;var _0x48d14e;return db['SalesforceAccount'][_0xc71f('0x4e')]({'where':{'id':_0x21903c[_0xc71f('0x48')]['id']}})['then'](handleEntityNotFound(_0x5c1220,null))[_0xc71f('0x26')](function(_0x411966){if(_0x411966){_0x97258c=_0x411966;_0x3d6de2['model']=_[_0xc71f('0x32')](db['SalesforceConfiguration']['rawAttributes']);_0x3d6de2['query']=_['keys'](_0x21903c[_0xc71f('0x33')]);_0x3d6de2[_0xc71f('0x34')]=_['intersection'](_0x3d6de2[_0xc71f('0x31')],_0x3d6de2[_0xc71f('0x33')]);_0x58506f[_0xc71f('0x36')]=_['intersection'](_0x3d6de2[_0xc71f('0x31')],qs[_0xc71f('0x37')](_0x21903c[_0xc71f('0x33')][_0xc71f('0x37')]));_0x58506f[_0xc71f('0x36')]=_0x58506f[_0xc71f('0x36')][_0xc71f('0x38')]?_0x58506f['attributes']:_0x3d6de2[_0xc71f('0x31')];_0x58506f[_0xc71f('0x3a')]=qs[_0xc71f('0x3b')](_0x21903c['query'][_0xc71f('0x3b')]);_0x58506f['where']=qs[_0xc71f('0x34')](_['pick'](_0x21903c[_0xc71f('0x33')],_0x3d6de2[_0xc71f('0x34')]));if(_0x21903c[_0xc71f('0x33')]['filter']){_0x58506f['where']=_['merge'](_0x58506f[_0xc71f('0x3c')],{'$or':_[_0xc71f('0x2e')](_0x58506f[_0xc71f('0x36')],function(_0x76b780){var _0x3087d6={};_0x3087d6[_0x76b780]={'$like':'%'+_0x21903c[_0xc71f('0x33')][_0xc71f('0x3e')]+'%'};return _0x3087d6;})});}_0x58506f=_[_0xc71f('0x3f')]({},_0x58506f,_0x21903c[_0xc71f('0x42')]);return _0x97258c[_0xc71f('0x4d')](_0x58506f);}})[_0xc71f('0x26')](function(_0xf39873){if(_0xf39873){_0x48d14e=_0xf39873[_0xc71f('0x38')];if(!_0x21903c['query'][_0xc71f('0x39')](_0xc71f('0x4f'))){_0x58506f[_0xc71f('0x1f')]=qs[_0xc71f('0x1f')](_0x21903c[_0xc71f('0x33')][_0xc71f('0x1f')]);_0x58506f['offset']=qs[_0xc71f('0x1d')](_0x21903c[_0xc71f('0x33')][_0xc71f('0x1d')]);}return _0x97258c[_0xc71f('0x4d')](_0x58506f);}})[_0xc71f('0x26')](function(_0x4f8676){if(_0x4f8676){return _0x4f8676?{'count':_0x48d14e,'rows':_0x4f8676}:null;}})[_0xc71f('0x26')](respondWithResult(_0x5c1220,null))[_0xc71f('0x4a')](handleError(_0x5c1220,null));};exports['addConfiguration']=function(_0xb42f92,_0x31b3e9,_0x1839fb){if(_0xb42f92[_0xc71f('0x4c')]['id']){delete _0xb42f92['body']['id'];}return db[_0xc71f('0x2f')]['findOne']({'where':{'id':_0xb42f92[_0xc71f('0x48')]['id']}})[_0xc71f('0x26')](handleEntityNotFound(_0x31b3e9,null))[_0xc71f('0x26')](function(_0x29a428){if(_0x29a428){_0xb42f92[_0xc71f('0x4c')][_0xc71f('0x50')]=_0x29a428['id'];_0xb42f92[_0xc71f('0x4c')][_0xc71f('0x51')]=integrations[_0xc71f('0x52')](_0xb42f92['body']['channel'],_0xb42f92[_0xc71f('0x4c')][_0xc71f('0x40')]);_0xb42f92[_0xc71f('0x4c')][_0xc71f('0x53')]=integrations[_0xc71f('0x54')](_0xb42f92['body']['channel'],_0xb42f92[_0xc71f('0x4c')][_0xc71f('0x40')]);return db[_0xc71f('0x55')][_0xc71f('0x4b')](_0xb42f92[_0xc71f('0x4c')],{'include':[{'model':db[_0xc71f('0x56')],'as':_0xc71f('0x51')},{'model':db['SalesforceField'],'as':_0xc71f('0x53')}]});}return null;})[_0xc71f('0x26')](respondWithResult(_0x31b3e9,null))[_0xc71f('0x4a')](handleError(_0x31b3e9,null));};exports[_0xc71f('0x57')]=function(_0x4f8e38,_0x52f68c,_0x53b7b1){var _0x70098e;var _0x17212f='';var _0x2a431b=_0xc71f('0x58');return db['SalesforceAccount']['findOne']({'where':{'id':_0x4f8e38[_0xc71f('0x48')]['id']},'attributes':['id',_0xc71f('0x59'),'clientId',_0xc71f('0x5a'),_0xc71f('0x5b'),_0xc71f('0x5c'),_0xc71f('0x5d')]})['then'](handleEntityNotFound(_0x52f68c,null))[_0xc71f('0x26')](function(_0x57dc8b){if(_0x57dc8b){_0x17212f=_0x57dc8b[_0xc71f('0x59')];var _0x10a045=_0x17212f[_0xc71f('0x5e')](-0x1);if(_0x10a045==='/'){_0x17212f=_0x17212f[_0xc71f('0x5f')](0x0,_0x17212f[_0xc71f('0x60')](_0x10a045));}_0x70098e=new jsforce[(_0xc71f('0x61'))]({'oauth2':{'loginUrl':_0x17212f,'clientId':_0x57dc8b[_0xc71f('0x62')],'clientSecret':_0x57dc8b[_0xc71f('0x5a')]}});return _0x70098e[_0xc71f('0x63')](_0x57dc8b[_0xc71f('0x5b')],_0x57dc8b[_0xc71f('0x5c')][_0xc71f('0x64')](_0x57dc8b[_0xc71f('0x5d')]));}})[_0xc71f('0x26')](function(_0x3f6d71){if(_0x3f6d71){if(!_['isNil'](_0x4f8e38[_0xc71f('0x33')][_0xc71f('0x65')])){_0x2a431b=_0x4f8e38[_0xc71f('0x33')]['ticketType'];}return _0x70098e[_0xc71f('0x66')](_0x2a431b)[_0xc71f('0x67')]();}})[_0xc71f('0x26')](function(_0x4495b8){var _0x47747b=[_0xc71f('0x68'),_0xc71f('0x69'),'IsReminderSet','IsRecurrence',_0xc71f('0x6a'),_0xc71f('0x6b')];var _0xbe6246=[_0xc71f('0x6c'),'int',_0xc71f('0x6d'),_0xc71f('0x6e'),'email','textarea',_0xc71f('0x6f')];if(_0x4495b8){_[_0xc71f('0x70')](_0x4495b8[_0xc71f('0x37')],function(_0x3a4bb3){return _0x47747b[_0xc71f('0x71')](_0x3a4bb3[_0xc71f('0x2b')])||!_0xbe6246[_0xc71f('0x71')](_0x3a4bb3['type']);});return{'count':_0x4495b8[_0xc71f('0x37')]['length'],'rows':_[_0xc71f('0x2e')](_0x4495b8[_0xc71f('0x37')],function(_0x9b998){return{'id':_0x9b998[_0xc71f('0x2b')],'name':_0x9b998[_0xc71f('0x72')],'custom':_0x9b998[_0xc71f('0x73')],'options':_0x9b998['picklistValues'][_0xc71f('0x38')]>0x0?_[_0xc71f('0x2e')](_0x9b998[_0xc71f('0x74')],function(_0x2ccadb){return{'name':_0x2ccadb['label'],'value':_0x2ccadb[_0xc71f('0x75')]};}):_0x9b998[_0xc71f('0x40')]==_0xc71f('0x6e')?[{'name':_0xc71f('0x76'),'value':_0xc71f('0x77')},{'name':_0xc71f('0x78'),'value':'false'}]:[]};})};}})['then'](respondWithResult(_0x52f68c,null))['catch'](function(_0x3c4d87){var _0x5d1636=_0x4f8e38[_0xc71f('0x33')][_0xc71f('0x79')]?0x1f4:_0x3c4d87[_0xc71f('0x7a')]||0x1f4;logger[_0xc71f('0x29')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5d1636,JSON[_0xc71f('0x7b')](_0x3c4d87));delete _0x3c4d87[_0xc71f('0x2b')];if(_0x5d1636===0x191){_0x5d1636=0x190;}_0x52f68c[_0xc71f('0x1b')](_0x5d1636)['send'](_0x4f8e38[_0xc71f('0x33')][_0xc71f('0x79')]?{'message':_0xc71f('0x7c'),'statusCode':_0x3c4d87['statusCode']}:_0x3c4d87);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 9405d96..2eab433 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 _0xdd89=['int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xdd89,0xc5));var _0x9dd8=function(_0x4cc492,_0x162c85){_0x4cc492=_0x4cc492-0x0;var _0x1f36b9=_0xdd89[_0x4cc492];return _0x1f36b9;};'use strict';var _=require(_0x9dd8('0x0'));var util=require(_0x9dd8('0x1'));var logger=require(_0x9dd8('0x2'))(_0x9dd8('0x3'));var moment=require(_0x9dd8('0x4'));var BPromise=require(_0x9dd8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9dd8('0x6'));var config=require(_0x9dd8('0x7'));var attributes=require(_0x9dd8('0x8'));var integrations=require(_0x9dd8('0x9'));module[_0x9dd8('0xa')]=function(_0x2be577,_0x3ebe31){return _0x2be577[_0x9dd8('0xb')](_0x9dd8('0xc'),attributes,{'tableName':_0x9dd8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5656=['int_salesforce_accounts','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x6c3ed1,_0x1f2a8e){var _0x1bd89a=function(_0x3b5da7){while(--_0x3b5da7){_0x6c3ed1['push'](_0x6c3ed1['shift']());}};_0x1bd89a(++_0x1f2a8e);}(_0x5656,0x1d5));var _0x6565=function(_0x3ba1c8,_0x1bd012){_0x3ba1c8=_0x3ba1c8-0x0;var _0x3a8829=_0x5656[_0x3ba1c8];return _0x3a8829;};'use strict';var _=require(_0x6565('0x0'));var util=require(_0x6565('0x1'));var logger=require(_0x6565('0x2'))(_0x6565('0x3'));var moment=require(_0x6565('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6565('0x5'));var rimraf=require(_0x6565('0x6'));var config=require(_0x6565('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x6565('0x8'));module[_0x6565('0x9')]=function(_0x5423b7,_0x1318ba){return _0x5423b7[_0x6565('0xa')]('SalesforceAccount',attributes,{'tableName':_0x6565('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 3bc7c70..eb98203 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 _0x266d=['where','include','map','model','attributes','ShowSalesforceAccount','SalesforceAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','findAll','raw','options'];(function(_0x9d7ab8,_0x194a34){var _0x26d26e=function(_0x113d88){while(--_0x113d88){_0x9d7ab8['push'](_0x9d7ab8['shift']());}};_0x26d26e(++_0x194a34);}(_0x266d,0xb6));var _0xd266=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x266d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd266('0x0'));var util=require(_0xd266('0x1'));var moment=require(_0xd266('0x2'));var BPromise=require(_0xd266('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd266('0x4'));var db=require(_0xd266('0x5'))['db'];var utils=require(_0xd266('0x6'));var logger=require(_0xd266('0x7'))(_0xd266('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd266('0x9')][_0xd266('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8d393,_0x43acd2,_0x186012){return new BPromise(function(_0x2f73f4,_0x2a3287){return client[_0xd266('0xb')](_0x8d393,_0x186012)[_0xd266('0xc')](function(_0x441c44){logger[_0xd266('0xd')](_0xd266('0xe'),_0x43acd2,_0xd266('0xf'));logger[_0xd266('0x10')](_0xd266('0x11'),_0x43acd2,_0xd266('0xf'),JSON[_0xd266('0x12')](_0x441c44));if(_0x441c44[_0xd266('0x13')]){if(_0x441c44[_0xd266('0x13')][_0xd266('0x14')]===0x1f4){logger[_0xd266('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x43acd2,_0x441c44['error']['message']);return _0x2a3287(_0x441c44[_0xd266('0x13')]['message']);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x43acd2,_0x441c44['error'][_0xd266('0x15')]);return _0x2f73f4(_0x441c44[_0xd266('0x13')][_0xd266('0x15')]);}else{logger[_0xd266('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x43acd2,_0xd266('0xf'));_0x2f73f4(_0x441c44[_0xd266('0x16')][_0xd266('0x15')]);}})[_0xd266('0x17')](function(_0x46fc6a){logger[_0xd266('0x13')](_0xd266('0xe'),_0x43acd2,_0x46fc6a);_0x2a3287(_0x46fc6a);});});}exports[_0xd266('0x18')]=function(_0x28c4d7){var _0x426fa1=this;return new Promise(function(_0x690f56,_0x309af6){return db['SalesforceAccount'][_0xd266('0x19')]({'raw':_0x28c4d7['options']?_0x28c4d7['options'][_0xd266('0x1a')]===undefined?!![]:![]:!![],'where':_0x28c4d7[_0xd266('0x1b')]?_0x28c4d7[_0xd266('0x1b')][_0xd266('0x1c')]||null:null,'attributes':_0x28c4d7[_0xd266('0x1b')]?_0x28c4d7[_0xd266('0x1b')]['attributes']||null:null,'limit':_0x28c4d7[_0xd266('0x1b')]?_0x28c4d7[_0xd266('0x1b')]['limit']||null:null,'include':_0x28c4d7[_0xd266('0x1b')]?_0x28c4d7['options'][_0xd266('0x1d')]?_[_0xd266('0x1e')](_0x28c4d7['options'][_0xd266('0x1d')],function(_0x5b9a20){return{'model':db[_0x5b9a20[_0xd266('0x1f')]],'as':_0x5b9a20['as'],'attributes':_0x5b9a20[_0xd266('0x20')],'include':_0x5b9a20[_0xd266('0x1d')]?_['map'](_0x5b9a20[_0xd266('0x1d')],function(_0x4d45c1){return{'model':db[_0x4d45c1['model']],'as':_0x4d45c1['as'],'attributes':_0x4d45c1[_0xd266('0x20')],'include':_0x4d45c1[_0xd266('0x1d')]?_[_0xd266('0x1e')](_0x4d45c1[_0xd266('0x1d')],function(_0x227564){return{'model':db[_0x227564['model']],'as':_0x227564['as'],'attributes':_0x227564[_0xd266('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26f77a){logger[_0xd266('0xd')](_0xd266('0x18'),_0x28c4d7);logger[_0xd266('0x10')]('GetSalesforceAccount',_0x28c4d7,JSON[_0xd266('0x12')](_0x26f77a));_0x690f56(_0x26f77a);})['catch'](function(_0x28e88c){logger[_0xd266('0x13')]('GetSalesforceAccount',_0x28e88c['message'],_0x28c4d7);_0x309af6(_0x426fa1[_0xd266('0x13')](0x1f4,_0x28e88c[_0xd266('0x15')]));});});};exports[_0xd266('0x21')]=function(_0x3d6bd0){var _0x1443e8=this;return new Promise(function(_0x47cf61,_0xd583f0){return db[_0xd266('0x22')]['find']({'raw':_0x3d6bd0[_0xd266('0x1b')]?_0x3d6bd0['options'][_0xd266('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d6bd0[_0xd266('0x1b')]?_0x3d6bd0[_0xd266('0x1b')][_0xd266('0x1c')]||null:null,'attributes':_0x3d6bd0['options']?_0x3d6bd0['options'][_0xd266('0x20')]||null:null,'include':_0x3d6bd0[_0xd266('0x1b')]?_0x3d6bd0['options'][_0xd266('0x1d')]?_[_0xd266('0x1e')](_0x3d6bd0[_0xd266('0x1b')]['include'],function(_0x1497e8){return{'model':db[_0x1497e8[_0xd266('0x1f')]],'as':_0x1497e8['as'],'attributes':_0x1497e8['attributes'],'include':_0x1497e8[_0xd266('0x1d')]?_[_0xd266('0x1e')](_0x1497e8[_0xd266('0x1d')],function(_0x38f118){return{'model':db[_0x38f118[_0xd266('0x1f')]],'as':_0x38f118['as'],'attributes':_0x38f118[_0xd266('0x20')],'include':_0x38f118[_0xd266('0x1d')]?_[_0xd266('0x1e')](_0x38f118[_0xd266('0x1d')],function(_0x4109ba){return{'model':db[_0x4109ba[_0xd266('0x1f')]],'as':_0x4109ba['as'],'attributes':_0x4109ba[_0xd266('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd266('0xc')](function(_0x5981fd){logger[_0xd266('0xd')](_0xd266('0x21'),_0x3d6bd0);logger['debug']('ShowSalesforceAccount',_0x3d6bd0,JSON[_0xd266('0x12')](_0x5981fd));_0x47cf61(_0x5981fd);})[_0xd266('0x17')](function(_0x13b35d){logger[_0xd266('0x13')](_0xd266('0x21'),_0x13b35d[_0xd266('0x15')],_0x3d6bd0);_0xd583f0(_0x1443e8[_0xd266('0x13')](0x1f4,_0x13b35d[_0xd266('0x15')]));});});}; \ No newline at end of file +var _0x9caf=['where','attributes','limit','include','map','model','ShowSalesforceAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw'];(function(_0x1f2970,_0x2a8245){var _0x141589=function(_0x261aef){while(--_0x261aef){_0x1f2970['push'](_0x1f2970['shift']());}};_0x141589(++_0x2a8245);}(_0x9caf,0x1ac));var _0xf9ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9caf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf9ca('0x0'));var util=require(_0xf9ca('0x1'));var moment=require(_0xf9ca('0x2'));var BPromise=require(_0xf9ca('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf9ca('0x4'));var db=require(_0xf9ca('0x5'))['db'];var utils=require(_0xf9ca('0x6'));var logger=require('../../config/logger')(_0xf9ca('0x7'));var config=require(_0xf9ca('0x8'));var jayson=require(_0xf9ca('0x9'));var client=jayson[_0xf9ca('0xa')][_0xf9ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b0015,_0x52441b,_0x1c53b1){return new BPromise(function(_0x29971c,_0x5baacd){return client['request'](_0x1b0015,_0x1c53b1)[_0xf9ca('0xc')](function(_0xc9c2c7){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x52441b,_0xf9ca('0xd'));logger[_0xf9ca('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x52441b,_0xf9ca('0xd'),JSON[_0xf9ca('0xf')](_0xc9c2c7));if(_0xc9c2c7[_0xf9ca('0x10')]){if(_0xc9c2c7['error'][_0xf9ca('0x11')]===0x1f4){logger[_0xf9ca('0x10')](_0xf9ca('0x12'),_0x52441b,_0xc9c2c7['error'][_0xf9ca('0x13')]);return _0x5baacd(_0xc9c2c7[_0xf9ca('0x10')][_0xf9ca('0x13')]);}logger['error'](_0xf9ca('0x12'),_0x52441b,_0xc9c2c7[_0xf9ca('0x10')][_0xf9ca('0x13')]);return _0x29971c(_0xc9c2c7[_0xf9ca('0x10')][_0xf9ca('0x13')]);}else{logger['info'](_0xf9ca('0x12'),_0x52441b,'request\x20sent');_0x29971c(_0xc9c2c7[_0xf9ca('0x14')]['message']);}})[_0xf9ca('0x15')](function(_0xab3db){logger[_0xf9ca('0x10')](_0xf9ca('0x12'),_0x52441b,_0xab3db);_0x5baacd(_0xab3db);});});}exports[_0xf9ca('0x16')]=function(_0x3d3716){var _0x3f854c=this;return new Promise(function(_0x35736d,_0x18d12c){return db[_0xf9ca('0x17')][_0xf9ca('0x18')]({'raw':_0x3d3716[_0xf9ca('0x19')]?_0x3d3716['options'][_0xf9ca('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d3716[_0xf9ca('0x19')]?_0x3d3716['options'][_0xf9ca('0x1b')]||null:null,'attributes':_0x3d3716[_0xf9ca('0x19')]?_0x3d3716[_0xf9ca('0x19')][_0xf9ca('0x1c')]||null:null,'limit':_0x3d3716['options']?_0x3d3716['options'][_0xf9ca('0x1d')]||null:null,'include':_0x3d3716[_0xf9ca('0x19')]?_0x3d3716[_0xf9ca('0x19')][_0xf9ca('0x1e')]?_[_0xf9ca('0x1f')](_0x3d3716[_0xf9ca('0x19')][_0xf9ca('0x1e')],function(_0x50738f){return{'model':db[_0x50738f[_0xf9ca('0x20')]],'as':_0x50738f['as'],'attributes':_0x50738f['attributes'],'include':_0x50738f[_0xf9ca('0x1e')]?_[_0xf9ca('0x1f')](_0x50738f[_0xf9ca('0x1e')],function(_0x16fdc2){return{'model':db[_0x16fdc2[_0xf9ca('0x20')]],'as':_0x16fdc2['as'],'attributes':_0x16fdc2[_0xf9ca('0x1c')],'include':_0x16fdc2['include']?_[_0xf9ca('0x1f')](_0x16fdc2['include'],function(_0x2cfca0){return{'model':db[_0x2cfca0[_0xf9ca('0x20')]],'as':_0x2cfca0['as'],'attributes':_0x2cfca0[_0xf9ca('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf9ca('0xc')](function(_0x4d36fd){logger['info'](_0xf9ca('0x16'),_0x3d3716);logger[_0xf9ca('0xe')]('GetSalesforceAccount',_0x3d3716,JSON[_0xf9ca('0xf')](_0x4d36fd));_0x35736d(_0x4d36fd);})[_0xf9ca('0x15')](function(_0x32b672){logger[_0xf9ca('0x10')]('GetSalesforceAccount',_0x32b672['message'],_0x3d3716);_0x18d12c(_0x3f854c[_0xf9ca('0x10')](0x1f4,_0x32b672[_0xf9ca('0x13')]));});});};exports[_0xf9ca('0x21')]=function(_0xa969aa){var _0x1f6964=this;return new Promise(function(_0x15d03c,_0x45d497){return db[_0xf9ca('0x17')][_0xf9ca('0x22')]({'raw':_0xa969aa[_0xf9ca('0x19')]?_0xa969aa[_0xf9ca('0x19')][_0xf9ca('0x1a')]===undefined?!![]:![]:!![],'where':_0xa969aa[_0xf9ca('0x19')]?_0xa969aa['options']['where']||null:null,'attributes':_0xa969aa[_0xf9ca('0x19')]?_0xa969aa['options'][_0xf9ca('0x1c')]||null:null,'include':_0xa969aa['options']?_0xa969aa[_0xf9ca('0x19')]['include']?_[_0xf9ca('0x1f')](_0xa969aa[_0xf9ca('0x19')][_0xf9ca('0x1e')],function(_0x1ceefa){return{'model':db[_0x1ceefa[_0xf9ca('0x20')]],'as':_0x1ceefa['as'],'attributes':_0x1ceefa['attributes'],'include':_0x1ceefa['include']?_[_0xf9ca('0x1f')](_0x1ceefa[_0xf9ca('0x1e')],function(_0x5b9ec6){return{'model':db[_0x5b9ec6[_0xf9ca('0x20')]],'as':_0x5b9ec6['as'],'attributes':_0x5b9ec6[_0xf9ca('0x1c')],'include':_0x5b9ec6[_0xf9ca('0x1e')]?_['map'](_0x5b9ec6[_0xf9ca('0x1e')],function(_0x1c8a9a){return{'model':db[_0x1c8a9a['model']],'as':_0x1c8a9a['as'],'attributes':_0x1c8a9a[_0xf9ca('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf9ca('0xc')](function(_0x9f97b2){logger['info'](_0xf9ca('0x21'),_0xa969aa);logger[_0xf9ca('0xe')](_0xf9ca('0x21'),_0xa969aa,JSON[_0xf9ca('0xf')](_0x9f97b2));_0x15d03c(_0x9f97b2);})[_0xf9ca('0x15')](function(_0x44f920){logger['error'](_0xf9ca('0x21'),_0x44f920['message'],_0xa969aa);_0x45d497(_0x1f6964[_0xf9ca('0x10')](0x1f4,_0x44f920['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 18c204a..7e0b2e9 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 _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x236d24,_0x29e80a){var _0x1574cf=function(_0x5d1dad){while(--_0x5d1dad){_0x236d24['push'](_0x236d24['shift']());}};_0x1574cf(++_0x29e80a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x50b1c5,_0x1cf2a9){_0x50b1c5=_0x50b1c5-0x0;var _0x344f99=_0x0b0e[_0x50b1c5];return _0x344f99;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0xc75df7,_0x5cb464){var _0x4d839b=function(_0x120058){while(--_0x120058){_0xc75df7['push'](_0xc75df7['shift']());}};_0x4d839b(++_0x5cb464);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'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 1c88271..ef6aa02 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 _0x73c6=['Task','Case','ENUM','contact_lead','contact','account_contact_lead','account','nothing','lead','sequelize','STRING'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x73c6,0x195));var _0x673c=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x73c6[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0x673c('0x0'));module['exports']={'name':{'type':Sequelize[_0x673c('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x673c('0x2'),_0x673c('0x3')),'defaultValue':_0x673c('0x2')},'moduleSearch':{'type':Sequelize[_0x673c('0x4')](_0x673c('0x5'),_0x673c('0x6'),'lead',_0x673c('0x7'),_0x673c('0x8')),'defaultValue':_0x673c('0x5')},'moduleCreate':{'type':Sequelize[_0x673c('0x4')](_0x673c('0x9'),_0x673c('0x6'),'lead',_0x673c('0x8')),'defaultValue':_0x673c('0xa')},'leadId':{'type':Sequelize[_0x673c('0x1')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x673c('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x673c('0x1')]}}; \ No newline at end of file +var _0x57e6=['nothing','sequelize','exports','STRING','Task','ENUM','contact_lead','contact','lead','account_contact_lead','account'];(function(_0x18e2cb,_0x5314ad){var _0xfc0036=function(_0x803e4a){while(--_0x803e4a){_0x18e2cb['push'](_0x18e2cb['shift']());}};_0xfc0036(++_0x5314ad);}(_0x57e6,0x177));var _0x657e=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0x57e6[_0x5ac84c];return _0x3c53d2;};'use strict';var Sequelize=require(_0x657e('0x0'));module[_0x657e('0x1')]={'name':{'type':Sequelize[_0x657e('0x2')]},'description':{'type':Sequelize[_0x657e('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x657e('0x3'),'Case'),'defaultValue':_0x657e('0x3')},'moduleSearch':{'type':Sequelize[_0x657e('0x4')](_0x657e('0x5'),_0x657e('0x6'),_0x657e('0x7'),_0x657e('0x8'),_0x657e('0x9')),'defaultValue':_0x657e('0x5')},'moduleCreate':{'type':Sequelize[_0x657e('0x4')](_0x657e('0xa'),_0x657e('0x6'),_0x657e('0x7'),_0x657e('0x9')),'defaultValue':_0x657e('0x7')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x657e('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x657e('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x657e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 414667b..cbeaafb 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 _0x2570=['includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','getSubjects','rawAttributes','getDescriptions','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','SalesforceConfiguration','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options'];(function(_0x4ed955,_0x5b2b35){var _0x24bd1b=function(_0x93d4b6){while(--_0x93d4b6){_0x4ed955['push'](_0x4ed955['shift']());}};_0x24bd1b(++_0x5b2b35);}(_0x2570,0x1d7));var _0x0257=function(_0xdbff26,_0xfc8995){_0xdbff26=_0xdbff26-0x0;var _0x4adb23=_0x2570[_0xdbff26];return _0x4adb23;};'use strict';var emlformat=require(_0x0257('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0257('0x1'));var jsonpatch=require(_0x0257('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0257('0x3'));var util=require(_0x0257('0x4'));var path=require(_0x0257('0x5'));var sox=require(_0x0257('0x6'));var csv=require(_0x0257('0x7'));var ejs=require(_0x0257('0x8'));var fs=require('fs');var fs_extra=require(_0x0257('0x9'));var _=require('lodash');var squel=require(_0x0257('0xa'));var crypto=require(_0x0257('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0257('0xc'));var toCsv=require(_0x0257('0x7'));var querystring=require(_0x0257('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0257('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0257('0xf'));var logger=require('../../config/logger')(_0x0257('0x10'));var utils=require(_0x0257('0x11'));var config=require(_0x0257('0x12'));var licenseUtil=require(_0x0257('0x13'));var db=require(_0x0257('0x14'))['db'];function respondWithStatusCode(_0xa57264,_0x5cfec7){_0x5cfec7=_0x5cfec7||0xcc;return function(_0x15c3ea){if(_0x15c3ea){return _0xa57264[_0x0257('0x15')](_0x5cfec7);}return _0xa57264['status'](_0x5cfec7)['end']();};}function respondWithResult(_0x4ae0df,_0x5dbb89){_0x5dbb89=_0x5dbb89||0xc8;return function(_0x2547dc){if(_0x2547dc){return _0x4ae0df[_0x0257('0x16')](_0x5dbb89)[_0x0257('0x17')](_0x2547dc);}};}function respondWithFilteredResult(_0x2e7c9e,_0x5d8dd8){return function(_0x4e0526){if(_0x4e0526){var _0x24c7eb=typeof _0x5d8dd8[_0x0257('0x18')]==='undefined'&&typeof _0x5d8dd8[_0x0257('0x19')]==='undefined';var _0x46b57e=_0x4e0526[_0x0257('0x1a')];var _0x5b73d8=_0x24c7eb?0x0:_0x5d8dd8[_0x0257('0x18')];var _0x2b57b6=_0x24c7eb?_0x4e0526[_0x0257('0x1a')]:_0x5d8dd8[_0x0257('0x18')]+_0x5d8dd8[_0x0257('0x19')];var _0x2a65b8;if(_0x2b57b6>=_0x46b57e){_0x2b57b6=_0x46b57e;_0x2a65b8=0xc8;}else{_0x2a65b8=0xce;}_0x2e7c9e[_0x0257('0x16')](_0x2a65b8);return _0x2e7c9e[_0x0257('0x1b')](_0x0257('0x1c'),_0x5b73d8+'-'+_0x2b57b6+'/'+_0x46b57e)['json'](_0x4e0526);}return null;};}function patchUpdates(_0xc21038){return function(_0x58bf79){try{jsonpatch[_0x0257('0x1d')](_0x58bf79,_0xc21038,!![]);}catch(_0x4a51fd){return BPromise[_0x0257('0x1e')](_0x4a51fd);}return _0x58bf79[_0x0257('0x1f')]();};}function saveUpdates(_0x3aaebe,_0x36676f){return function(_0x4db883){if(_0x4db883){return _0x4db883[_0x0257('0x20')](_0x3aaebe)['then'](function(_0x389ebe){return _0x389ebe;});}return null;};}function removeEntity(_0xb85c52,_0x43b3cd){return function(_0x3d1b6d){if(_0x3d1b6d){return _0x3d1b6d[_0x0257('0x21')]()[_0x0257('0x22')](function(){_0xb85c52[_0x0257('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cd513,_0x351a15){return function(_0x4b1df9){if(!_0x4b1df9){_0x1cd513[_0x0257('0x15')](0x194);}return _0x4b1df9;};}function handleError(_0x59eaa1,_0x5be36d){_0x5be36d=_0x5be36d||0x1f4;return function(_0x23b7dc){logger[_0x0257('0x23')](_0x23b7dc[_0x0257('0x24')]);if(_0x23b7dc[_0x0257('0x25')]){delete _0x23b7dc[_0x0257('0x25')];}_0x59eaa1['status'](_0x5be36d)[_0x0257('0x26')](_0x23b7dc);};}exports['index']=function(_0x5e55b6,_0x3d5820){var _0x225426={},_0x4c7c54={},_0x14bff5={'count':0x0,'rows':[]};var _0x2b929e=_['map'](db[_0x0257('0x27')]['rawAttributes'],function(_0x48b8d9){return{'name':_0x48b8d9['fieldName'],'type':_0x48b8d9[_0x0257('0x28')][_0x0257('0x29')]};});_0x4c7c54[_0x0257('0x2a')]=_[_0x0257('0x2b')](_0x2b929e,'name');_0x4c7c54[_0x0257('0x2c')]=_[_0x0257('0x2d')](_0x5e55b6[_0x0257('0x2c')]);_0x4c7c54[_0x0257('0x2e')]=_[_0x0257('0x2f')](_0x4c7c54[_0x0257('0x2a')],_0x4c7c54[_0x0257('0x2c')]);_0x225426[_0x0257('0x30')]=_['intersection'](_0x4c7c54['model'],qs[_0x0257('0x31')](_0x5e55b6[_0x0257('0x2c')][_0x0257('0x31')]));_0x225426[_0x0257('0x30')]=_0x225426[_0x0257('0x30')][_0x0257('0x32')]?_0x225426[_0x0257('0x30')]:_0x4c7c54[_0x0257('0x2a')];if(!_0x5e55b6[_0x0257('0x2c')][_0x0257('0x33')](_0x0257('0x34'))){_0x225426[_0x0257('0x19')]=qs['limit'](_0x5e55b6['query'][_0x0257('0x19')]);_0x225426[_0x0257('0x18')]=qs[_0x0257('0x18')](_0x5e55b6['query']['offset']);}_0x225426[_0x0257('0x35')]=qs[_0x0257('0x36')](_0x5e55b6[_0x0257('0x2c')][_0x0257('0x36')]);_0x225426['where']=qs['filters'](_[_0x0257('0x37')](_0x5e55b6['query'],_0x4c7c54['filters']),_0x2b929e);if(_0x5e55b6['query']['filter']){_0x225426[_0x0257('0x38')]=_[_0x0257('0x39')](_0x225426[_0x0257('0x38')],{'$or':_[_0x0257('0x2b')](_0x2b929e,function(_0x4fa4e6){if(_0x4fa4e6[_0x0257('0x28')]!==_0x0257('0x3a')){var _0x560b1b={};_0x560b1b[_0x4fa4e6[_0x0257('0x25')]]={'$like':'%'+_0x5e55b6[_0x0257('0x2c')][_0x0257('0x3b')]+'%'};return _0x560b1b;}})});}_0x225426=_[_0x0257('0x39')]({},_0x225426,_0x5e55b6[_0x0257('0x3c')]);var _0x5995e9={'where':_0x225426[_0x0257('0x38')]};return db[_0x0257('0x27')][_0x0257('0x1a')](_0x5995e9)[_0x0257('0x22')](function(_0x30ed34){_0x14bff5[_0x0257('0x1a')]=_0x30ed34;if(_0x5e55b6['query'][_0x0257('0x3d')]){_0x225426[_0x0257('0x3e')]=[{'all':!![]}];}return db[_0x0257('0x27')][_0x0257('0x3f')](_0x225426);})[_0x0257('0x22')](function(_0x545689){_0x14bff5[_0x0257('0x40')]=_0x545689;return _0x14bff5;})[_0x0257('0x22')](respondWithFilteredResult(_0x3d5820,_0x225426))[_0x0257('0x41')](handleError(_0x3d5820,null));};exports[_0x0257('0x42')]=function(_0x4a8100,_0x195ed8){var _0x228d0b={'raw':![],'where':{'id':_0x4a8100[_0x0257('0x43')]['id']}},_0x17bfe7={};_0x17bfe7[_0x0257('0x2a')]=_[_0x0257('0x2d')](db['SalesforceConfiguration']['rawAttributes']);_0x17bfe7[_0x0257('0x2c')]=_['keys'](_0x4a8100[_0x0257('0x2c')]);_0x17bfe7[_0x0257('0x2e')]=_[_0x0257('0x2f')](_0x17bfe7[_0x0257('0x2a')],_0x17bfe7['query']);_0x228d0b[_0x0257('0x30')]=_['intersection'](_0x17bfe7['model'],qs[_0x0257('0x31')](_0x4a8100[_0x0257('0x2c')]['fields']));_0x228d0b[_0x0257('0x30')]=_0x228d0b[_0x0257('0x30')][_0x0257('0x32')]?_0x228d0b[_0x0257('0x30')]:_0x17bfe7[_0x0257('0x2a')];if(_0x4a8100[_0x0257('0x2c')][_0x0257('0x3d')]){_0x228d0b['include']=[{'all':!![]}];}_0x228d0b=_['merge']({},_0x228d0b,_0x4a8100[_0x0257('0x3c')]);return db[_0x0257('0x27')][_0x0257('0x44')](_0x228d0b)[_0x0257('0x22')](handleEntityNotFound(_0x195ed8,null))['then'](respondWithResult(_0x195ed8,null))[_0x0257('0x41')](handleError(_0x195ed8,null));};exports[_0x0257('0x45')]=function(_0x2b2786,_0xb1de21){return db[_0x0257('0x27')][_0x0257('0x45')](_0x2b2786[_0x0257('0x46')],{})['then'](respondWithResult(_0xb1de21,0xc9))[_0x0257('0x41')](handleError(_0xb1de21,null));};exports[_0x0257('0x20')]=function(_0x4ae6cf,_0x27cdea){if(_0x4ae6cf['body']['id']){delete _0x4ae6cf['body']['id'];}return db[_0x0257('0x27')][_0x0257('0x44')]({'where':{'id':_0x4ae6cf[_0x0257('0x43')]['id']}})[_0x0257('0x22')](handleEntityNotFound(_0x27cdea,null))[_0x0257('0x22')](saveUpdates(_0x4ae6cf[_0x0257('0x46')],null))[_0x0257('0x22')](respondWithResult(_0x27cdea,null))['catch'](handleError(_0x27cdea,null));};exports[_0x0257('0x21')]=function(_0x3326f6,_0x472ee1){return db[_0x0257('0x27')][_0x0257('0x44')]({'where':{'id':_0x3326f6[_0x0257('0x43')]['id']}})['then'](handleEntityNotFound(_0x472ee1,null))[_0x0257('0x22')](removeEntity(_0x472ee1,null))[_0x0257('0x41')](handleError(_0x472ee1,null));};exports[_0x0257('0x47')]=function(_0x3b527e,_0x1839e3,_0x2d5ec8){var _0x55881f={};var _0x14a408={};var _0x1e1727;var _0x14d565;return db[_0x0257('0x27')][_0x0257('0x48')]({'where':{'id':_0x3b527e['params']['id']}})[_0x0257('0x22')](handleEntityNotFound(_0x1839e3,null))[_0x0257('0x22')](function(_0x3fb20d){if(_0x3fb20d){_0x1e1727=_0x3fb20d;_0x14a408[_0x0257('0x2a')]=_['keys'](db['SalesforceField']['rawAttributes']);_0x14a408[_0x0257('0x2c')]=_['keys'](_0x3b527e[_0x0257('0x2c')]);_0x14a408['filters']=_[_0x0257('0x2f')](_0x14a408['model'],_0x14a408[_0x0257('0x2c')]);_0x55881f[_0x0257('0x30')]=_[_0x0257('0x2f')](_0x14a408['model'],qs[_0x0257('0x31')](_0x3b527e[_0x0257('0x2c')]['fields']));_0x55881f[_0x0257('0x30')]=_0x55881f[_0x0257('0x30')][_0x0257('0x32')]?_0x55881f[_0x0257('0x30')]:_0x14a408['model'];_0x55881f[_0x0257('0x35')]=qs[_0x0257('0x36')](_0x3b527e[_0x0257('0x2c')]['sort']);_0x55881f[_0x0257('0x38')]=qs['filters'](_[_0x0257('0x37')](_0x3b527e[_0x0257('0x2c')],_0x14a408['filters']));if(_0x3b527e[_0x0257('0x2c')]['filter']){_0x55881f[_0x0257('0x38')]=_[_0x0257('0x39')](_0x55881f[_0x0257('0x38')],{'$or':_['map'](_0x55881f[_0x0257('0x30')],function(_0x1e799d){var _0x18f676={};_0x18f676[_0x1e799d]={'$like':'%'+_0x3b527e['query'][_0x0257('0x3b')]+'%'};return _0x18f676;})});}_0x55881f=_['merge']({},_0x55881f,_0x3b527e[_0x0257('0x3c')]);return _0x1e1727[_0x0257('0x47')](_0x55881f);}})[_0x0257('0x22')](function(_0xbef48d){if(_0xbef48d){_0x14d565=_0xbef48d[_0x0257('0x32')];if(!_0x3b527e[_0x0257('0x2c')][_0x0257('0x33')]('nolimit')){_0x55881f[_0x0257('0x19')]=qs[_0x0257('0x19')](_0x3b527e[_0x0257('0x2c')][_0x0257('0x19')]);_0x55881f[_0x0257('0x18')]=qs[_0x0257('0x18')](_0x3b527e[_0x0257('0x2c')][_0x0257('0x18')]);}return _0x1e1727['getFields'](_0x55881f);}})[_0x0257('0x22')](function(_0x6ceca4){if(_0x6ceca4){return _0x6ceca4?{'count':_0x14d565,'rows':_0x6ceca4}:null;}})[_0x0257('0x22')](respondWithResult(_0x1839e3,null))[_0x0257('0x41')](handleError(_0x1839e3,null));};exports[_0x0257('0x49')]=function(_0x57322d,_0x5d3914,_0x4ff427){var _0x5f343d={};var _0x268d63={};var _0x4d1e42;var _0x26e430;return db[_0x0257('0x27')][_0x0257('0x48')]({'where':{'id':_0x57322d[_0x0257('0x43')]['id']}})[_0x0257('0x22')](handleEntityNotFound(_0x5d3914,null))[_0x0257('0x22')](function(_0x4d19e8){if(_0x4d19e8){_0x4d1e42=_0x4d19e8;_0x268d63[_0x0257('0x2a')]=_[_0x0257('0x2d')](db['SalesforceField'][_0x0257('0x4a')]);_0x268d63[_0x0257('0x2c')]=_[_0x0257('0x2d')](_0x57322d[_0x0257('0x2c')]);_0x268d63[_0x0257('0x2e')]=_['intersection'](_0x268d63[_0x0257('0x2a')],_0x268d63['query']);_0x5f343d[_0x0257('0x30')]=_[_0x0257('0x2f')](_0x268d63[_0x0257('0x2a')],qs[_0x0257('0x31')](_0x57322d[_0x0257('0x2c')][_0x0257('0x31')]));_0x5f343d['attributes']=_0x5f343d[_0x0257('0x30')][_0x0257('0x32')]?_0x5f343d[_0x0257('0x30')]:_0x268d63[_0x0257('0x2a')];_0x5f343d[_0x0257('0x35')]=qs[_0x0257('0x36')](_0x57322d['query'][_0x0257('0x36')]);_0x5f343d[_0x0257('0x38')]=qs[_0x0257('0x2e')](_[_0x0257('0x37')](_0x57322d[_0x0257('0x2c')],_0x268d63[_0x0257('0x2e')]));if(_0x57322d[_0x0257('0x2c')][_0x0257('0x3b')]){_0x5f343d['where']=_[_0x0257('0x39')](_0x5f343d['where'],{'$or':_[_0x0257('0x2b')](_0x5f343d[_0x0257('0x30')],function(_0x16eee7){var _0x2d9be6={};_0x2d9be6[_0x16eee7]={'$like':'%'+_0x57322d[_0x0257('0x2c')]['filter']+'%'};return _0x2d9be6;})});}_0x5f343d=_[_0x0257('0x39')]({},_0x5f343d,_0x57322d['options']);return _0x4d1e42[_0x0257('0x49')](_0x5f343d);}})[_0x0257('0x22')](function(_0x2acacf){if(_0x2acacf){_0x26e430=_0x2acacf['length'];if(!_0x57322d[_0x0257('0x2c')]['hasOwnProperty'](_0x0257('0x34'))){_0x5f343d[_0x0257('0x19')]=qs['limit'](_0x57322d[_0x0257('0x2c')][_0x0257('0x19')]);_0x5f343d[_0x0257('0x18')]=qs[_0x0257('0x18')](_0x57322d[_0x0257('0x2c')][_0x0257('0x18')]);}return _0x4d1e42[_0x0257('0x49')](_0x5f343d);}})[_0x0257('0x22')](function(_0x5c2f20){if(_0x5c2f20){return _0x5c2f20?{'count':_0x26e430,'rows':_0x5c2f20}:null;}})[_0x0257('0x22')](respondWithResult(_0x5d3914,null))['catch'](handleError(_0x5d3914,null));};exports[_0x0257('0x4b')]=function(_0x1f6d45,_0x43ffe1,_0x2fe7ee){var _0x3b65c6={};var _0x3b488b={};var _0x1a5fdc;var _0x445990;return db['SalesforceConfiguration'][_0x0257('0x48')]({'where':{'id':_0x1f6d45[_0x0257('0x43')]['id']}})[_0x0257('0x22')](handleEntityNotFound(_0x43ffe1,null))[_0x0257('0x22')](function(_0x15ad36){if(_0x15ad36){_0x1a5fdc=_0x15ad36;_0x3b488b['model']=_[_0x0257('0x2d')](db['SalesforceField'][_0x0257('0x4a')]);_0x3b488b[_0x0257('0x2c')]=_[_0x0257('0x2d')](_0x1f6d45[_0x0257('0x2c')]);_0x3b488b[_0x0257('0x2e')]=_[_0x0257('0x2f')](_0x3b488b[_0x0257('0x2a')],_0x3b488b['query']);_0x3b65c6['attributes']=_[_0x0257('0x2f')](_0x3b488b[_0x0257('0x2a')],qs[_0x0257('0x31')](_0x1f6d45['query']['fields']));_0x3b65c6[_0x0257('0x30')]=_0x3b65c6['attributes'][_0x0257('0x32')]?_0x3b65c6['attributes']:_0x3b488b[_0x0257('0x2a')];_0x3b65c6[_0x0257('0x35')]=qs[_0x0257('0x36')](_0x1f6d45[_0x0257('0x2c')][_0x0257('0x36')]);_0x3b65c6[_0x0257('0x38')]=qs[_0x0257('0x2e')](_[_0x0257('0x37')](_0x1f6d45[_0x0257('0x2c')],_0x3b488b[_0x0257('0x2e')]));if(_0x1f6d45[_0x0257('0x2c')]['filter']){_0x3b65c6[_0x0257('0x38')]=_[_0x0257('0x39')](_0x3b65c6[_0x0257('0x38')],{'$or':_[_0x0257('0x2b')](_0x3b65c6[_0x0257('0x30')],function(_0x1f0b6f){var _0x368e32={};_0x368e32[_0x1f0b6f]={'$like':'%'+_0x1f6d45[_0x0257('0x2c')][_0x0257('0x3b')]+'%'};return _0x368e32;})});}_0x3b65c6=_[_0x0257('0x39')]({},_0x3b65c6,_0x1f6d45[_0x0257('0x3c')]);return _0x1a5fdc[_0x0257('0x4b')](_0x3b65c6);}})['then'](function(_0x447c43){if(_0x447c43){_0x445990=_0x447c43['length'];if(!_0x1f6d45[_0x0257('0x2c')][_0x0257('0x33')]('nolimit')){_0x3b65c6[_0x0257('0x19')]=qs[_0x0257('0x19')](_0x1f6d45[_0x0257('0x2c')][_0x0257('0x19')]);_0x3b65c6['offset']=qs['offset'](_0x1f6d45['query'][_0x0257('0x18')]);}return _0x1a5fdc[_0x0257('0x4b')](_0x3b65c6);}})[_0x0257('0x22')](function(_0x20afe8){if(_0x20afe8){return _0x20afe8?{'count':_0x445990,'rows':_0x20afe8}:null;}})[_0x0257('0x22')](respondWithResult(_0x43ffe1,null))[_0x0257('0x41')](handleError(_0x43ffe1,null));}; \ No newline at end of file +var _0xb97c=['findOne','SalesforceField','getFields','hasOwnProperty','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','model','map','query','keys','filters','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','intersection','find','create','body'];(function(_0x40c120,_0x945e7a){var _0xe9f0d=function(_0x40c637){while(--_0x40c637){_0x40c120['push'](_0x40c120['shift']());}};_0xe9f0d(++_0x945e7a);}(_0xb97c,0x19b));var _0xcb97=function(_0xc68c60,_0x170391){_0xc68c60=_0xc68c60-0x0;var _0x1a12e3=_0xb97c[_0xc68c60];return _0x1a12e3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcb97('0x0'));var jsonpatch=require(_0xcb97('0x1'));var rp=require(_0xcb97('0x2'));var moment=require(_0xcb97('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcb97('0x4'));var path=require(_0xcb97('0x5'));var sox=require(_0xcb97('0x6'));var csv=require(_0xcb97('0x7'));var ejs=require(_0xcb97('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcb97('0x9'));var squel=require(_0xcb97('0xa'));var crypto=require(_0xcb97('0xb'));var jsforce=require(_0xcb97('0xc'));var deskjs=require(_0xcb97('0xd'));var toCsv=require(_0xcb97('0x7'));var querystring=require(_0xcb97('0xe'));var Papa=require(_0xcb97('0xf'));var Redis=require('ioredis');var authService=require(_0xcb97('0x10'));var qs=require(_0xcb97('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb97('0x12'));var logger=require(_0xcb97('0x13'))(_0xcb97('0x14'));var utils=require(_0xcb97('0x15'));var config=require(_0xcb97('0x16'));var licenseUtil=require(_0xcb97('0x17'));var db=require(_0xcb97('0x18'))['db'];function respondWithStatusCode(_0x5d48fa,_0x42abe7){_0x42abe7=_0x42abe7||0xcc;return function(_0x1ea338){if(_0x1ea338){return _0x5d48fa[_0xcb97('0x19')](_0x42abe7);}return _0x5d48fa[_0xcb97('0x1a')](_0x42abe7)[_0xcb97('0x1b')]();};}function respondWithResult(_0x4f57c9,_0x2cde2c){_0x2cde2c=_0x2cde2c||0xc8;return function(_0x1a720e){if(_0x1a720e){return _0x4f57c9['status'](_0x2cde2c)[_0xcb97('0x1c')](_0x1a720e);}};}function respondWithFilteredResult(_0x44c2fb,_0xb59ca6){return function(_0x323b1d){if(_0x323b1d){var _0x39aa74=typeof _0xb59ca6['offset']===_0xcb97('0x1d')&&typeof _0xb59ca6['limit']===_0xcb97('0x1d');var _0x42a985=_0x323b1d[_0xcb97('0x1e')];var _0x3a94f2=_0x39aa74?0x0:_0xb59ca6['offset'];var _0x2473d0=_0x39aa74?_0x323b1d[_0xcb97('0x1e')]:_0xb59ca6[_0xcb97('0x1f')]+_0xb59ca6[_0xcb97('0x20')];var _0xcea694;if(_0x2473d0>=_0x42a985){_0x2473d0=_0x42a985;_0xcea694=0xc8;}else{_0xcea694=0xce;}_0x44c2fb[_0xcb97('0x1a')](_0xcea694);return _0x44c2fb[_0xcb97('0x21')]('Content-Range',_0x3a94f2+'-'+_0x2473d0+'/'+_0x42a985)[_0xcb97('0x1c')](_0x323b1d);}return null;};}function patchUpdates(_0x11b149){return function(_0x2c8e62){try{jsonpatch[_0xcb97('0x22')](_0x2c8e62,_0x11b149,!![]);}catch(_0xd74426){return BPromise[_0xcb97('0x23')](_0xd74426);}return _0x2c8e62[_0xcb97('0x24')]();};}function saveUpdates(_0x3e32c6,_0x477cb9){return function(_0x1c368d){if(_0x1c368d){return _0x1c368d[_0xcb97('0x25')](_0x3e32c6)[_0xcb97('0x26')](function(_0x10643b){return _0x10643b;});}return null;};}function removeEntity(_0x55907c,_0x207db3){return function(_0x45c599){if(_0x45c599){return _0x45c599[_0xcb97('0x27')]()[_0xcb97('0x26')](function(){_0x55907c[_0xcb97('0x1a')](0xcc)[_0xcb97('0x1b')]();});}};}function handleEntityNotFound(_0x1b5908,_0x5e5ad4){return function(_0x17b21f){if(!_0x17b21f){_0x1b5908[_0xcb97('0x19')](0x194);}return _0x17b21f;};}function handleError(_0x88fa56,_0x41108c){_0x41108c=_0x41108c||0x1f4;return function(_0x32d14a){logger['error'](_0x32d14a[_0xcb97('0x28')]);if(_0x32d14a[_0xcb97('0x29')]){delete _0x32d14a[_0xcb97('0x29')];}_0x88fa56['status'](_0x41108c)[_0xcb97('0x2a')](_0x32d14a);};}exports[_0xcb97('0x2b')]=function(_0x341e9f,_0x1017ce){var _0x1d51e9={},_0x517dd8={},_0x323a03={'count':0x0,'rows':[]};var _0x56c201=_['map'](db[_0xcb97('0x2c')][_0xcb97('0x2d')],function(_0x33b219){return{'name':_0x33b219[_0xcb97('0x2e')],'type':_0x33b219[_0xcb97('0x2f')]['key']};});_0x517dd8[_0xcb97('0x30')]=_[_0xcb97('0x31')](_0x56c201,_0xcb97('0x29'));_0x517dd8[_0xcb97('0x32')]=_[_0xcb97('0x33')](_0x341e9f[_0xcb97('0x32')]);_0x517dd8[_0xcb97('0x34')]=_['intersection'](_0x517dd8['model'],_0x517dd8['query']);_0x1d51e9['attributes']=_['intersection'](_0x517dd8[_0xcb97('0x30')],qs[_0xcb97('0x35')](_0x341e9f[_0xcb97('0x32')][_0xcb97('0x35')]));_0x1d51e9['attributes']=_0x1d51e9[_0xcb97('0x36')][_0xcb97('0x37')]?_0x1d51e9['attributes']:_0x517dd8[_0xcb97('0x30')];if(!_0x341e9f[_0xcb97('0x32')]['hasOwnProperty'](_0xcb97('0x38'))){_0x1d51e9[_0xcb97('0x20')]=qs['limit'](_0x341e9f[_0xcb97('0x32')]['limit']);_0x1d51e9['offset']=qs[_0xcb97('0x1f')](_0x341e9f[_0xcb97('0x32')][_0xcb97('0x1f')]);}_0x1d51e9[_0xcb97('0x39')]=qs[_0xcb97('0x3a')](_0x341e9f[_0xcb97('0x32')][_0xcb97('0x3a')]);_0x1d51e9[_0xcb97('0x3b')]=qs[_0xcb97('0x34')](_[_0xcb97('0x3c')](_0x341e9f[_0xcb97('0x32')],_0x517dd8[_0xcb97('0x34')]),_0x56c201);if(_0x341e9f['query'][_0xcb97('0x3d')]){_0x1d51e9[_0xcb97('0x3b')]=_[_0xcb97('0x3e')](_0x1d51e9['where'],{'$or':_['map'](_0x56c201,function(_0x20128e){if(_0x20128e[_0xcb97('0x2f')]!==_0xcb97('0x3f')){var _0x303edb={};_0x303edb[_0x20128e[_0xcb97('0x29')]]={'$like':'%'+_0x341e9f[_0xcb97('0x32')]['filter']+'%'};return _0x303edb;}})});}_0x1d51e9=_[_0xcb97('0x3e')]({},_0x1d51e9,_0x341e9f[_0xcb97('0x40')]);var _0x1ce79f={'where':_0x1d51e9[_0xcb97('0x3b')]};return db[_0xcb97('0x2c')][_0xcb97('0x1e')](_0x1ce79f)[_0xcb97('0x26')](function(_0x5df8c8){_0x323a03['count']=_0x5df8c8;if(_0x341e9f[_0xcb97('0x32')][_0xcb97('0x41')]){_0x1d51e9[_0xcb97('0x42')]=[{'all':!![]}];}return db[_0xcb97('0x2c')]['findAll'](_0x1d51e9);})[_0xcb97('0x26')](function(_0x51be03){_0x323a03[_0xcb97('0x43')]=_0x51be03;return _0x323a03;})['then'](respondWithFilteredResult(_0x1017ce,_0x1d51e9))[_0xcb97('0x44')](handleError(_0x1017ce,null));};exports[_0xcb97('0x45')]=function(_0x19de37,_0x403c25){var _0x414501={'raw':![],'where':{'id':_0x19de37[_0xcb97('0x46')]['id']}},_0x53d0fc={};_0x53d0fc[_0xcb97('0x30')]=_[_0xcb97('0x33')](db[_0xcb97('0x2c')]['rawAttributes']);_0x53d0fc[_0xcb97('0x32')]=_[_0xcb97('0x33')](_0x19de37[_0xcb97('0x32')]);_0x53d0fc[_0xcb97('0x34')]=_[_0xcb97('0x47')](_0x53d0fc['model'],_0x53d0fc[_0xcb97('0x32')]);_0x414501[_0xcb97('0x36')]=_[_0xcb97('0x47')](_0x53d0fc[_0xcb97('0x30')],qs[_0xcb97('0x35')](_0x19de37[_0xcb97('0x32')][_0xcb97('0x35')]));_0x414501[_0xcb97('0x36')]=_0x414501[_0xcb97('0x36')]['length']?_0x414501[_0xcb97('0x36')]:_0x53d0fc[_0xcb97('0x30')];if(_0x19de37[_0xcb97('0x32')]['includeAll']){_0x414501['include']=[{'all':!![]}];}_0x414501=_[_0xcb97('0x3e')]({},_0x414501,_0x19de37['options']);return db['SalesforceConfiguration'][_0xcb97('0x48')](_0x414501)[_0xcb97('0x26')](handleEntityNotFound(_0x403c25,null))[_0xcb97('0x26')](respondWithResult(_0x403c25,null))[_0xcb97('0x44')](handleError(_0x403c25,null));};exports[_0xcb97('0x49')]=function(_0x26e140,_0x37739c){return db['SalesforceConfiguration'][_0xcb97('0x49')](_0x26e140[_0xcb97('0x4a')],{})['then'](respondWithResult(_0x37739c,0xc9))[_0xcb97('0x44')](handleError(_0x37739c,null));};exports[_0xcb97('0x25')]=function(_0x30b5ff,_0x1819fc){if(_0x30b5ff[_0xcb97('0x4a')]['id']){delete _0x30b5ff['body']['id'];}return db['SalesforceConfiguration'][_0xcb97('0x48')]({'where':{'id':_0x30b5ff['params']['id']}})[_0xcb97('0x26')](handleEntityNotFound(_0x1819fc,null))['then'](saveUpdates(_0x30b5ff['body'],null))['then'](respondWithResult(_0x1819fc,null))[_0xcb97('0x44')](handleError(_0x1819fc,null));};exports[_0xcb97('0x27')]=function(_0x3e2224,_0x27fa3a){return db[_0xcb97('0x2c')]['find']({'where':{'id':_0x3e2224['params']['id']}})[_0xcb97('0x26')](handleEntityNotFound(_0x27fa3a,null))[_0xcb97('0x26')](removeEntity(_0x27fa3a,null))[_0xcb97('0x44')](handleError(_0x27fa3a,null));};exports['getFields']=function(_0x21f9ec,_0x2841ea,_0x517636){var _0x4252e3={};var _0x30cf39={};var _0x2bff9a;var _0x2137be;return db[_0xcb97('0x2c')][_0xcb97('0x4b')]({'where':{'id':_0x21f9ec[_0xcb97('0x46')]['id']}})[_0xcb97('0x26')](handleEntityNotFound(_0x2841ea,null))[_0xcb97('0x26')](function(_0x1b2f6c){if(_0x1b2f6c){_0x2bff9a=_0x1b2f6c;_0x30cf39[_0xcb97('0x30')]=_['keys'](db[_0xcb97('0x4c')]['rawAttributes']);_0x30cf39[_0xcb97('0x32')]=_[_0xcb97('0x33')](_0x21f9ec[_0xcb97('0x32')]);_0x30cf39['filters']=_[_0xcb97('0x47')](_0x30cf39[_0xcb97('0x30')],_0x30cf39['query']);_0x4252e3[_0xcb97('0x36')]=_['intersection'](_0x30cf39[_0xcb97('0x30')],qs['fields'](_0x21f9ec[_0xcb97('0x32')][_0xcb97('0x35')]));_0x4252e3['attributes']=_0x4252e3[_0xcb97('0x36')][_0xcb97('0x37')]?_0x4252e3[_0xcb97('0x36')]:_0x30cf39[_0xcb97('0x30')];_0x4252e3[_0xcb97('0x39')]=qs[_0xcb97('0x3a')](_0x21f9ec['query']['sort']);_0x4252e3['where']=qs[_0xcb97('0x34')](_['pick'](_0x21f9ec[_0xcb97('0x32')],_0x30cf39[_0xcb97('0x34')]));if(_0x21f9ec['query'][_0xcb97('0x3d')]){_0x4252e3[_0xcb97('0x3b')]=_[_0xcb97('0x3e')](_0x4252e3[_0xcb97('0x3b')],{'$or':_['map'](_0x4252e3[_0xcb97('0x36')],function(_0x12e004){var _0x5d0825={};_0x5d0825[_0x12e004]={'$like':'%'+_0x21f9ec[_0xcb97('0x32')][_0xcb97('0x3d')]+'%'};return _0x5d0825;})});}_0x4252e3=_[_0xcb97('0x3e')]({},_0x4252e3,_0x21f9ec[_0xcb97('0x40')]);return _0x2bff9a[_0xcb97('0x4d')](_0x4252e3);}})[_0xcb97('0x26')](function(_0xdb32ed){if(_0xdb32ed){_0x2137be=_0xdb32ed[_0xcb97('0x37')];if(!_0x21f9ec['query'][_0xcb97('0x4e')]('nolimit')){_0x4252e3[_0xcb97('0x20')]=qs[_0xcb97('0x20')](_0x21f9ec[_0xcb97('0x32')][_0xcb97('0x20')]);_0x4252e3[_0xcb97('0x1f')]=qs[_0xcb97('0x1f')](_0x21f9ec['query']['offset']);}return _0x2bff9a[_0xcb97('0x4d')](_0x4252e3);}})[_0xcb97('0x26')](function(_0x3ba6af){if(_0x3ba6af){return _0x3ba6af?{'count':_0x2137be,'rows':_0x3ba6af}:null;}})[_0xcb97('0x26')](respondWithResult(_0x2841ea,null))[_0xcb97('0x44')](handleError(_0x2841ea,null));};exports[_0xcb97('0x4f')]=function(_0x3c7887,_0x302115,_0x4d2cd3){var _0x5e011c={};var _0x1d24e8={};var _0x46a18b;var _0x376c02;return db[_0xcb97('0x2c')][_0xcb97('0x4b')]({'where':{'id':_0x3c7887[_0xcb97('0x46')]['id']}})[_0xcb97('0x26')](handleEntityNotFound(_0x302115,null))['then'](function(_0x2b4276){if(_0x2b4276){_0x46a18b=_0x2b4276;_0x1d24e8[_0xcb97('0x30')]=_['keys'](db[_0xcb97('0x4c')][_0xcb97('0x2d')]);_0x1d24e8['query']=_[_0xcb97('0x33')](_0x3c7887[_0xcb97('0x32')]);_0x1d24e8[_0xcb97('0x34')]=_[_0xcb97('0x47')](_0x1d24e8[_0xcb97('0x30')],_0x1d24e8[_0xcb97('0x32')]);_0x5e011c['attributes']=_[_0xcb97('0x47')](_0x1d24e8[_0xcb97('0x30')],qs[_0xcb97('0x35')](_0x3c7887[_0xcb97('0x32')][_0xcb97('0x35')]));_0x5e011c[_0xcb97('0x36')]=_0x5e011c[_0xcb97('0x36')][_0xcb97('0x37')]?_0x5e011c[_0xcb97('0x36')]:_0x1d24e8[_0xcb97('0x30')];_0x5e011c[_0xcb97('0x39')]=qs['sort'](_0x3c7887[_0xcb97('0x32')][_0xcb97('0x3a')]);_0x5e011c[_0xcb97('0x3b')]=qs[_0xcb97('0x34')](_[_0xcb97('0x3c')](_0x3c7887[_0xcb97('0x32')],_0x1d24e8['filters']));if(_0x3c7887[_0xcb97('0x32')]['filter']){_0x5e011c[_0xcb97('0x3b')]=_['merge'](_0x5e011c['where'],{'$or':_[_0xcb97('0x31')](_0x5e011c[_0xcb97('0x36')],function(_0x25c2ea){var _0x4a0950={};_0x4a0950[_0x25c2ea]={'$like':'%'+_0x3c7887[_0xcb97('0x32')][_0xcb97('0x3d')]+'%'};return _0x4a0950;})});}_0x5e011c=_[_0xcb97('0x3e')]({},_0x5e011c,_0x3c7887[_0xcb97('0x40')]);return _0x46a18b[_0xcb97('0x4f')](_0x5e011c);}})[_0xcb97('0x26')](function(_0x21ef6e){if(_0x21ef6e){_0x376c02=_0x21ef6e[_0xcb97('0x37')];if(!_0x3c7887['query'][_0xcb97('0x4e')](_0xcb97('0x38'))){_0x5e011c['limit']=qs['limit'](_0x3c7887['query'][_0xcb97('0x20')]);_0x5e011c[_0xcb97('0x1f')]=qs[_0xcb97('0x1f')](_0x3c7887[_0xcb97('0x32')]['offset']);}return _0x46a18b[_0xcb97('0x4f')](_0x5e011c);}})['then'](function(_0x346f7c){if(_0x346f7c){return _0x346f7c?{'count':_0x376c02,'rows':_0x346f7c}:null;}})[_0xcb97('0x26')](respondWithResult(_0x302115,null))['catch'](handleError(_0x302115,null));};exports[_0xcb97('0x50')]=function(_0xd7e2ab,_0x298e9c,_0x13eb1c){var _0x13bc06={};var _0x47f0be={};var _0x189f7a;var _0x5b3585;return db[_0xcb97('0x2c')]['findOne']({'where':{'id':_0xd7e2ab['params']['id']}})[_0xcb97('0x26')](handleEntityNotFound(_0x298e9c,null))['then'](function(_0x4a7738){if(_0x4a7738){_0x189f7a=_0x4a7738;_0x47f0be[_0xcb97('0x30')]=_[_0xcb97('0x33')](db['SalesforceField'][_0xcb97('0x2d')]);_0x47f0be[_0xcb97('0x32')]=_[_0xcb97('0x33')](_0xd7e2ab['query']);_0x47f0be[_0xcb97('0x34')]=_[_0xcb97('0x47')](_0x47f0be[_0xcb97('0x30')],_0x47f0be[_0xcb97('0x32')]);_0x13bc06[_0xcb97('0x36')]=_[_0xcb97('0x47')](_0x47f0be[_0xcb97('0x30')],qs[_0xcb97('0x35')](_0xd7e2ab[_0xcb97('0x32')][_0xcb97('0x35')]));_0x13bc06[_0xcb97('0x36')]=_0x13bc06[_0xcb97('0x36')]['length']?_0x13bc06['attributes']:_0x47f0be['model'];_0x13bc06[_0xcb97('0x39')]=qs[_0xcb97('0x3a')](_0xd7e2ab[_0xcb97('0x32')]['sort']);_0x13bc06[_0xcb97('0x3b')]=qs[_0xcb97('0x34')](_['pick'](_0xd7e2ab[_0xcb97('0x32')],_0x47f0be[_0xcb97('0x34')]));if(_0xd7e2ab[_0xcb97('0x32')][_0xcb97('0x3d')]){_0x13bc06[_0xcb97('0x3b')]=_['merge'](_0x13bc06[_0xcb97('0x3b')],{'$or':_[_0xcb97('0x31')](_0x13bc06[_0xcb97('0x36')],function(_0x5a1003){var _0x408ea1={};_0x408ea1[_0x5a1003]={'$like':'%'+_0xd7e2ab[_0xcb97('0x32')][_0xcb97('0x3d')]+'%'};return _0x408ea1;})});}_0x13bc06=_['merge']({},_0x13bc06,_0xd7e2ab['options']);return _0x189f7a[_0xcb97('0x50')](_0x13bc06);}})[_0xcb97('0x26')](function(_0x21ab2f){if(_0x21ab2f){_0x5b3585=_0x21ab2f[_0xcb97('0x37')];if(!_0xd7e2ab[_0xcb97('0x32')][_0xcb97('0x4e')](_0xcb97('0x38'))){_0x13bc06[_0xcb97('0x20')]=qs[_0xcb97('0x20')](_0xd7e2ab['query'][_0xcb97('0x20')]);_0x13bc06[_0xcb97('0x1f')]=qs[_0xcb97('0x1f')](_0xd7e2ab['query'][_0xcb97('0x1f')]);}return _0x189f7a['getDescriptions'](_0x13bc06);}})[_0xcb97('0x26')](function(_0x12e81c){if(_0x12e81c){return _0x12e81c?{'count':_0x5b3585,'rows':_0x12e81c}:null;}})['then'](respondWithResult(_0x298e9c,null))['catch'](handleError(_0x298e9c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index f6bad72..0f12d8a 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 _0xf72b=['path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1972ba,_0x26a878){var _0x65ede6=function(_0x4de101){while(--_0x4de101){_0x1972ba['push'](_0x1972ba['shift']());}};_0x65ede6(++_0x26a878);}(_0xf72b,0x16d));var _0xbf72=function(_0x1abf45,_0x1cfbb9){_0x1abf45=_0x1abf45-0x0;var _0x39db58=_0xf72b[_0x1abf45];return _0x39db58;};'use strict';var _=require(_0xbf72('0x0'));var util=require(_0xbf72('0x1'));var logger=require(_0xbf72('0x2'))(_0xbf72('0x3'));var moment=require(_0xbf72('0x4'));var BPromise=require(_0xbf72('0x5'));var rp=require(_0xbf72('0x6'));var fs=require('fs');var path=require(_0xbf72('0x7'));var rimraf=require(_0xbf72('0x8'));var config=require(_0xbf72('0x9'));var attributes=require(_0xbf72('0xa'));module['exports']=function(_0x247d25,_0x4d7328){return _0x247d25[_0xbf72('0xb')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44f0=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations'];(function(_0x4c0c99,_0x1918b0){var _0x36b932=function(_0x235884){while(--_0x235884){_0x4c0c99['push'](_0x4c0c99['shift']());}};_0x36b932(++_0x1918b0);}(_0x44f0,0x150));var _0x044f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x44f0[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x044f('0x0'));var logger=require(_0x044f('0x1'))(_0x044f('0x2'));var moment=require(_0x044f('0x3'));var BPromise=require(_0x044f('0x4'));var rp=require(_0x044f('0x5'));var fs=require('fs');var path=require(_0x044f('0x6'));var rimraf=require(_0x044f('0x7'));var config=require(_0x044f('0x8'));var attributes=require(_0x044f('0x9'));module[_0x044f('0xa')]=function(_0x3a5581,_0x374253){return _0x3a5581[_0x044f('0xb')](_0x044f('0xc'),attributes,{'tableName':_0x044f('0xd'),'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 487ab70..4b14fdc 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 _0xa323=['http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client'];(function(_0xf8da14,_0x49b2f2){var _0x61d88c=function(_0x23c987){while(--_0x23c987){_0xf8da14['push'](_0xf8da14['shift']());}};_0x61d88c(++_0x49b2f2);}(_0xa323,0x1e6));var _0x3a32=function(_0x41ef02,_0x101e1a){_0x41ef02=_0x41ef02-0x0;var _0x5e6995=_0xa323[_0x41ef02];return _0x5e6995;};'use strict';var _=require(_0x3a32('0x0'));var util=require(_0x3a32('0x1'));var moment=require('moment');var BPromise=require(_0x3a32('0x2'));var rs=require(_0x3a32('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a32('0x4'))['db'];var utils=require(_0x3a32('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3a32('0x6'));var client=jayson[_0x3a32('0x7')][_0x3a32('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18b522,_0x3bf993,_0x3c5a8f){return new BPromise(function(_0x4849db,_0x34c503){return client['request'](_0x18b522,_0x3c5a8f)[_0x3a32('0x9')](function(_0x314707){logger[_0x3a32('0xa')](_0x3a32('0xb'),_0x3bf993,_0x3a32('0xc'));logger['debug'](_0x3a32('0xd'),_0x3bf993,_0x3a32('0xc'),JSON[_0x3a32('0xe')](_0x314707));if(_0x314707[_0x3a32('0xf')]){if(_0x314707[_0x3a32('0xf')][_0x3a32('0x10')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x3bf993,_0x314707[_0x3a32('0xf')][_0x3a32('0x11')]);return _0x34c503(_0x314707['error'][_0x3a32('0x11')]);}logger[_0x3a32('0xf')](_0x3a32('0xb'),_0x3bf993,_0x314707['error'][_0x3a32('0x11')]);return _0x4849db(_0x314707[_0x3a32('0xf')][_0x3a32('0x11')]);}else{logger[_0x3a32('0xa')](_0x3a32('0xb'),_0x3bf993,_0x3a32('0xc'));_0x4849db(_0x314707['result'][_0x3a32('0x11')]);}})[_0x3a32('0x12')](function(_0x2d68fa){logger['error'](_0x3a32('0xb'),_0x3bf993,_0x2d68fa);_0x34c503(_0x2d68fa);});});} \ No newline at end of file +var _0x918c=['rpc','../../config/environment','jayson/promise','client','http','request','info','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','request\x20sent','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x37c448,_0x7ee36){var _0x1b86e7=function(_0x24bdc7){while(--_0x24bdc7){_0x37c448['push'](_0x37c448['shift']());}};_0x1b86e7(++_0x7ee36);}(_0x918c,0x19d));var _0xc918=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x918c[_0x44bcb0];return _0xfaf881;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc918('0x0'));var BPromise=require(_0xc918('0x1'));var rs=require(_0xc918('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc918('0x3'))['db'];var utils=require(_0xc918('0x4'));var logger=require('../../config/logger')(_0xc918('0x5'));var config=require(_0xc918('0x6'));var jayson=require(_0xc918('0x7'));var client=jayson[_0xc918('0x8')][_0xc918('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fca8e,_0x262198,_0x49016f){return new BPromise(function(_0x4e5f23,_0x58a56e){return client[_0xc918('0xa')](_0x2fca8e,_0x49016f)['then'](function(_0x5a80f1){logger[_0xc918('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x262198,'request\x20sent');logger[_0xc918('0xc')](_0xc918('0xd'),_0x262198,'request\x20sent',JSON[_0xc918('0xe')](_0x5a80f1));if(_0x5a80f1[_0xc918('0xf')]){if(_0x5a80f1[_0xc918('0xf')][_0xc918('0x10')]===0x1f4){logger[_0xc918('0xf')](_0xc918('0x11'),_0x262198,_0x5a80f1[_0xc918('0xf')][_0xc918('0x12')]);return _0x58a56e(_0x5a80f1[_0xc918('0xf')]['message']);}logger[_0xc918('0xf')](_0xc918('0x11'),_0x262198,_0x5a80f1[_0xc918('0xf')][_0xc918('0x12')]);return _0x4e5f23(_0x5a80f1['error'][_0xc918('0x12')]);}else{logger[_0xc918('0xb')](_0xc918('0x11'),_0x262198,_0xc918('0x13'));_0x4e5f23(_0x5a80f1[_0xc918('0x14')][_0xc918('0x12')]);}})[_0xc918('0x15')](function(_0x1e2207){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x262198,_0x1e2207);_0x58a56e(_0x1e2207);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 332c681..8907048 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 _0x649e=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x36bcb5,_0x13f5ff){var _0x46d0e6=function(_0x5e79ef){while(--_0x5e79ef){_0x36bcb5['push'](_0x36bcb5['shift']());}};_0x46d0e6(++_0x13f5ff);}(_0x649e,0x1f3));var _0xe649=function(_0x52a782,_0x2e1988){_0x52a782=_0x52a782-0x0;var _0xab1d0b=_0x649e[_0x52a782];return _0xab1d0b;};'use strict';var multer=require(_0xe649('0x0'));var util=require(_0xe649('0x1'));var path=require(_0xe649('0x2'));var timeout=require('connect-timeout');var express=require(_0xe649('0x3'));var router=express[_0xe649('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe649('0x5'));var config=require(_0xe649('0x6'));var controller=require('./intSalesforceField.controller');router[_0xe649('0x7')]('/',auth[_0xe649('0x8')](),controller[_0xe649('0x9')]);router[_0xe649('0x7')]('/:id',auth[_0xe649('0x8')](),controller[_0xe649('0xa')]);router[_0xe649('0xb')]('/',auth[_0xe649('0x8')](),controller[_0xe649('0xc')]);router[_0xe649('0xd')](_0xe649('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xe649('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe649('0x10')]);module[_0xe649('0x11')]=router; \ No newline at end of file +var _0x3479=['get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller'];(function(_0x28d04f,_0xba9cc9){var _0x4406f9=function(_0x1264a6){while(--_0x1264a6){_0x28d04f['push'](_0x28d04f['shift']());}};_0x4406f9(++_0xba9cc9);}(_0x3479,0x107));var _0x9347=function(_0x25a136,_0x57320e){_0x25a136=_0x25a136-0x0;var _0x5b7159=_0x3479[_0x25a136];return _0x5b7159;};'use strict';var multer=require(_0x9347('0x0'));var util=require(_0x9347('0x1'));var path=require(_0x9347('0x2'));var timeout=require(_0x9347('0x3'));var express=require(_0x9347('0x4'));var router=express[_0x9347('0x5')]();var fs_extra=require(_0x9347('0x6'));var auth=require(_0x9347('0x7'));var interaction=require(_0x9347('0x8'));var config=require('../../config/environment');var controller=require(_0x9347('0x9'));router[_0x9347('0xa')]('/',auth[_0x9347('0xb')](),controller[_0x9347('0xc')]);router[_0x9347('0xa')](_0x9347('0xd'),auth['isAuthenticated'](),controller[_0x9347('0xe')]);router['post']('/',auth[_0x9347('0xb')](),controller[_0x9347('0xf')]);router[_0x9347('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9347('0x11')]);router[_0x9347('0x12')](_0x9347('0xd'),auth['isAuthenticated'](),controller[_0x9347('0x13')]);module[_0x9347('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 0e3fb22..c0d9f77 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 _0x20ed=['variable','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x3e25ba,_0x4d5399){var _0x393fb8=function(_0x4fc023){while(--_0x4fc023){_0x3e25ba['push'](_0x3e25ba['shift']());}};_0x393fb8(++_0x4d5399);}(_0x20ed,0xf4));var _0xd20e=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x20ed[_0x342700];return _0x53406f;};'use strict';var Sequelize=require(_0xd20e('0x0'));module[_0xd20e('0x1')]={'type':{'type':Sequelize[_0xd20e('0x2')](_0xd20e('0x3'),'variable',_0xd20e('0x4'),_0xd20e('0x5'),_0xd20e('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd20e('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd20e('0x2')](_0xd20e('0x3'),_0xd20e('0x8'),_0xd20e('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd20e('0x7')]},'variableName':{'type':Sequelize[_0xd20e('0x7')]}}; \ No newline at end of file +var _0x7501=['customVariable','sequelize','exports','ENUM','string','keyValue','picklist','STRING'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x7501,0x131));var _0x1750=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x7501[_0x3511d3];return _0x5d6321;};'use strict';var Sequelize=require(_0x1750('0x0'));module[_0x1750('0x1')]={'type':{'type':Sequelize[_0x1750('0x2')](_0x1750('0x3'),'variable','customVariable',_0x1750('0x4'),_0x1750('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1750('0x6')]},'key':{'type':Sequelize[_0x1750('0x6')]},'keyType':{'type':Sequelize[_0x1750('0x2')](_0x1750('0x3'),'variable',_0x1750('0x7'))},'keyContent':{'type':Sequelize[_0x1750('0x6')]},'idField':{'type':Sequelize[_0x1750('0x6')]},'variableName':{'type':Sequelize[_0x1750('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 8708884..805df2d 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 _0x5dd2=['end','status','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','error','name','send','index','SalesforceField','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','catch','show','params','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x348dff,_0x4f2c6c){var _0x5db9d9=function(_0x570bbe){while(--_0x570bbe){_0x348dff['push'](_0x348dff['shift']());}};_0x5db9d9(++_0x4f2c6c);}(_0x5dd2,0x118));var _0x25dd=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x5dd2[_0x2064e5];return _0x21a233;};'use strict';var emlformat=require(_0x25dd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x25dd('0x1'));var jsonpatch=require(_0x25dd('0x2'));var rp=require(_0x25dd('0x3'));var moment=require(_0x25dd('0x4'));var BPromise=require(_0x25dd('0x5'));var Mustache=require(_0x25dd('0x6'));var util=require(_0x25dd('0x7'));var path=require(_0x25dd('0x8'));var sox=require('sox');var csv=require(_0x25dd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x25dd('0xa'));var _=require('lodash');var squel=require(_0x25dd('0xb'));var crypto=require(_0x25dd('0xc'));var jsforce=require(_0x25dd('0xd'));var deskjs=require(_0x25dd('0xe'));var toCsv=require('to-csv');var querystring=require(_0x25dd('0xf'));var Papa=require(_0x25dd('0x10'));var Redis=require(_0x25dd('0x11'));var authService=require(_0x25dd('0x12'));var qs=require(_0x25dd('0x13'));var as=require(_0x25dd('0x14'));var hardwareService=require(_0x25dd('0x15'));var logger=require(_0x25dd('0x16'))(_0x25dd('0x17'));var utils=require('../../config/utils');var config=require(_0x25dd('0x18'));var licenseUtil=require(_0x25dd('0x19'));var db=require(_0x25dd('0x1a'))['db'];function respondWithStatusCode(_0x5a2355,_0x54b8d5){_0x54b8d5=_0x54b8d5||0xcc;return function(_0x3ffa13){if(_0x3ffa13){return _0x5a2355[_0x25dd('0x1b')](_0x54b8d5);}return _0x5a2355['status'](_0x54b8d5)[_0x25dd('0x1c')]();};}function respondWithResult(_0x216f2b,_0x2c8142){_0x2c8142=_0x2c8142||0xc8;return function(_0x1228ae){if(_0x1228ae){return _0x216f2b[_0x25dd('0x1d')](_0x2c8142)[_0x25dd('0x1e')](_0x1228ae);}};}function respondWithFilteredResult(_0x3c3a8e,_0x44c891){return function(_0x300601){if(_0x300601){var _0x2582d2=typeof _0x44c891[_0x25dd('0x1f')]==='undefined'&&typeof _0x44c891[_0x25dd('0x20')]===_0x25dd('0x21');var _0x47563e=_0x300601['count'];var _0x1604fd=_0x2582d2?0x0:_0x44c891[_0x25dd('0x1f')];var _0x39abec=_0x2582d2?_0x300601[_0x25dd('0x22')]:_0x44c891[_0x25dd('0x1f')]+_0x44c891[_0x25dd('0x20')];var _0x46e497;if(_0x39abec>=_0x47563e){_0x39abec=_0x47563e;_0x46e497=0xc8;}else{_0x46e497=0xce;}_0x3c3a8e[_0x25dd('0x1d')](_0x46e497);return _0x3c3a8e[_0x25dd('0x23')](_0x25dd('0x24'),_0x1604fd+'-'+_0x39abec+'/'+_0x47563e)[_0x25dd('0x1e')](_0x300601);}return null;};}function patchUpdates(_0x3f31a2){return function(_0x2c8d1a){try{jsonpatch['apply'](_0x2c8d1a,_0x3f31a2,!![]);}catch(_0x1000f9){return BPromise['reject'](_0x1000f9);}return _0x2c8d1a[_0x25dd('0x25')]();};}function saveUpdates(_0x1df760,_0x28e47b){return function(_0x4edeaf){if(_0x4edeaf){return _0x4edeaf[_0x25dd('0x26')](_0x1df760)[_0x25dd('0x27')](function(_0x576110){return _0x576110;});}return null;};}function removeEntity(_0xe8f970,_0x516fee){return function(_0x39f3f8){if(_0x39f3f8){return _0x39f3f8[_0x25dd('0x28')]()[_0x25dd('0x27')](function(){_0xe8f970[_0x25dd('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e74a9,_0x221135){return function(_0x4b2c5b){if(!_0x4b2c5b){_0x4e74a9[_0x25dd('0x1b')](0x194);}return _0x4b2c5b;};}function handleError(_0x4bacf9,_0x53cba2){_0x53cba2=_0x53cba2||0x1f4;return function(_0x3f867a){logger[_0x25dd('0x29')](_0x3f867a['stack']);if(_0x3f867a['name']){delete _0x3f867a[_0x25dd('0x2a')];}_0x4bacf9[_0x25dd('0x1d')](_0x53cba2)[_0x25dd('0x2b')](_0x3f867a);};}exports[_0x25dd('0x2c')]=function(_0x1fe82f,_0x4ba8a8){var _0x330e31={},_0x5c1562={},_0x10ad87={'count':0x0,'rows':[]};var _0x455068=_['map'](db[_0x25dd('0x2d')][_0x25dd('0x2e')],function(_0x156ee4){return{'name':_0x156ee4[_0x25dd('0x2f')],'type':_0x156ee4[_0x25dd('0x30')]['key']};});_0x5c1562['model']=_[_0x25dd('0x31')](_0x455068,_0x25dd('0x2a'));_0x5c1562[_0x25dd('0x32')]=_[_0x25dd('0x33')](_0x1fe82f[_0x25dd('0x32')]);_0x5c1562[_0x25dd('0x34')]=_[_0x25dd('0x35')](_0x5c1562[_0x25dd('0x36')],_0x5c1562[_0x25dd('0x32')]);_0x330e31[_0x25dd('0x37')]=_[_0x25dd('0x35')](_0x5c1562[_0x25dd('0x36')],qs['fields'](_0x1fe82f[_0x25dd('0x32')][_0x25dd('0x38')]));_0x330e31[_0x25dd('0x37')]=_0x330e31['attributes'][_0x25dd('0x39')]?_0x330e31[_0x25dd('0x37')]:_0x5c1562[_0x25dd('0x36')];if(!_0x1fe82f[_0x25dd('0x32')][_0x25dd('0x3a')](_0x25dd('0x3b'))){_0x330e31['limit']=qs[_0x25dd('0x20')](_0x1fe82f[_0x25dd('0x32')][_0x25dd('0x20')]);_0x330e31[_0x25dd('0x1f')]=qs[_0x25dd('0x1f')](_0x1fe82f[_0x25dd('0x32')][_0x25dd('0x1f')]);}_0x330e31[_0x25dd('0x3c')]=qs['sort'](_0x1fe82f['query'][_0x25dd('0x3d')]);_0x330e31[_0x25dd('0x3e')]=qs[_0x25dd('0x34')](_[_0x25dd('0x3f')](_0x1fe82f['query'],_0x5c1562['filters']),_0x455068);if(_0x1fe82f[_0x25dd('0x32')][_0x25dd('0x40')]){_0x330e31[_0x25dd('0x3e')]=_['merge'](_0x330e31[_0x25dd('0x3e')],{'$or':_[_0x25dd('0x31')](_0x455068,function(_0x4831d3){if(_0x4831d3[_0x25dd('0x30')]!==_0x25dd('0x41')){var _0x47f925={};_0x47f925[_0x4831d3['name']]={'$like':'%'+_0x1fe82f[_0x25dd('0x32')][_0x25dd('0x40')]+'%'};return _0x47f925;}})});}_0x330e31=_[_0x25dd('0x42')]({},_0x330e31,_0x1fe82f[_0x25dd('0x43')]);var _0x4b3048={'where':_0x330e31[_0x25dd('0x3e')]};return db[_0x25dd('0x2d')][_0x25dd('0x22')](_0x4b3048)['then'](function(_0x2a7f65){_0x10ad87[_0x25dd('0x22')]=_0x2a7f65;if(_0x1fe82f['query']['includeAll']){_0x330e31[_0x25dd('0x44')]=[{'all':!![]}];}return db[_0x25dd('0x2d')]['findAll'](_0x330e31);})[_0x25dd('0x27')](function(_0x422fe6){_0x10ad87[_0x25dd('0x45')]=_0x422fe6;return _0x10ad87;})[_0x25dd('0x27')](respondWithFilteredResult(_0x4ba8a8,_0x330e31))[_0x25dd('0x46')](handleError(_0x4ba8a8,null));};exports[_0x25dd('0x47')]=function(_0x31ff03,_0x49d4b4){var _0x1d1fb3={'raw':!![],'where':{'id':_0x31ff03[_0x25dd('0x48')]['id']}},_0x2f822c={};_0x2f822c['model']=_['keys'](db[_0x25dd('0x2d')][_0x25dd('0x2e')]);_0x2f822c[_0x25dd('0x32')]=_[_0x25dd('0x33')](_0x31ff03[_0x25dd('0x32')]);_0x2f822c['filters']=_[_0x25dd('0x35')](_0x2f822c[_0x25dd('0x36')],_0x2f822c[_0x25dd('0x32')]);_0x1d1fb3[_0x25dd('0x37')]=_[_0x25dd('0x35')](_0x2f822c['model'],qs[_0x25dd('0x38')](_0x31ff03['query'][_0x25dd('0x38')]));_0x1d1fb3[_0x25dd('0x37')]=_0x1d1fb3[_0x25dd('0x37')]['length']?_0x1d1fb3[_0x25dd('0x37')]:_0x2f822c[_0x25dd('0x36')];if(_0x31ff03['query'][_0x25dd('0x49')]){_0x1d1fb3[_0x25dd('0x44')]=[{'all':!![]}];}_0x1d1fb3=_[_0x25dd('0x42')]({},_0x1d1fb3,_0x31ff03[_0x25dd('0x43')]);return db[_0x25dd('0x2d')][_0x25dd('0x4a')](_0x1d1fb3)[_0x25dd('0x27')](handleEntityNotFound(_0x49d4b4,null))[_0x25dd('0x27')](respondWithResult(_0x49d4b4,null))[_0x25dd('0x46')](handleError(_0x49d4b4,null));};exports['create']=function(_0x3f9ae9,_0x598802){return db['SalesforceField'][_0x25dd('0x4b')](_0x3f9ae9[_0x25dd('0x4c')],{})['then'](respondWithResult(_0x598802,0xc9))['catch'](handleError(_0x598802,null));};exports['update']=function(_0x722ad5,_0xb252f){if(_0x722ad5[_0x25dd('0x4c')]['id']){delete _0x722ad5['body']['id'];}return db['SalesforceField']['find']({'where':{'id':_0x722ad5[_0x25dd('0x48')]['id']}})[_0x25dd('0x27')](handleEntityNotFound(_0xb252f,null))['then'](saveUpdates(_0x722ad5['body'],null))['then'](respondWithResult(_0xb252f,null))[_0x25dd('0x46')](handleError(_0xb252f,null));};exports[_0x25dd('0x28')]=function(_0x15d215,_0x29124d){return db[_0x25dd('0x2d')][_0x25dd('0x4a')]({'where':{'id':_0x15d215[_0x25dd('0x48')]['id']}})[_0x25dd('0x27')](handleEntityNotFound(_0x29124d,null))[_0x25dd('0x27')](removeEntity(_0x29124d,null))[_0x25dd('0x46')](handleError(_0x29124d,null));}; \ No newline at end of file +var _0xa404=['intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','find','catch','create','body','update','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','SalesforceField','rawAttributes','type','key','keys','filters'];(function(_0x2fa512,_0x2b3412){var _0x52bb13=function(_0x583177){while(--_0x583177){_0x2fa512['push'](_0x2fa512['shift']());}};_0x52bb13(++_0x2b3412);}(_0xa404,0x66));var _0x4a40=function(_0xab444f,_0x2deb9d){_0xab444f=_0xab444f-0x0;var _0x28a3dc=_0xa404[_0xab444f];return _0x28a3dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a40('0x0'));var zipdir=require(_0x4a40('0x1'));var jsonpatch=require(_0x4a40('0x2'));var rp=require(_0x4a40('0x3'));var moment=require('moment');var BPromise=require(_0x4a40('0x4'));var Mustache=require(_0x4a40('0x5'));var util=require('util');var path=require('path');var sox=require(_0x4a40('0x6'));var csv=require(_0x4a40('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a40('0x8'));var squel=require(_0x4a40('0x9'));var crypto=require('crypto');var jsforce=require(_0x4a40('0xa'));var deskjs=require(_0x4a40('0xb'));var toCsv=require(_0x4a40('0x7'));var querystring=require(_0x4a40('0xc'));var Papa=require(_0x4a40('0xd'));var Redis=require(_0x4a40('0xe'));var authService=require(_0x4a40('0xf'));var qs=require(_0x4a40('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a40('0x11'));var logger=require(_0x4a40('0x12'))(_0x4a40('0x13'));var utils=require(_0x4a40('0x14'));var config=require(_0x4a40('0x15'));var licenseUtil=require(_0x4a40('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17efa5,_0x34197d){_0x34197d=_0x34197d||0xcc;return function(_0xd20ba9){if(_0xd20ba9){return _0x17efa5['sendStatus'](_0x34197d);}return _0x17efa5[_0x4a40('0x17')](_0x34197d)[_0x4a40('0x18')]();};}function respondWithResult(_0x162f73,_0x46345d){_0x46345d=_0x46345d||0xc8;return function(_0x3d75da){if(_0x3d75da){return _0x162f73[_0x4a40('0x17')](_0x46345d)[_0x4a40('0x19')](_0x3d75da);}};}function respondWithFilteredResult(_0x980bba,_0x2ba81f){return function(_0x202857){if(_0x202857){var _0xaca5ce=typeof _0x2ba81f[_0x4a40('0x1a')]===_0x4a40('0x1b')&&typeof _0x2ba81f[_0x4a40('0x1c')]===_0x4a40('0x1b');var _0x432cfb=_0x202857[_0x4a40('0x1d')];var _0x57ea79=_0xaca5ce?0x0:_0x2ba81f[_0x4a40('0x1a')];var _0x5c2fc0=_0xaca5ce?_0x202857[_0x4a40('0x1d')]:_0x2ba81f['offset']+_0x2ba81f[_0x4a40('0x1c')];var _0xc9f14f;if(_0x5c2fc0>=_0x432cfb){_0x5c2fc0=_0x432cfb;_0xc9f14f=0xc8;}else{_0xc9f14f=0xce;}_0x980bba[_0x4a40('0x17')](_0xc9f14f);return _0x980bba[_0x4a40('0x1e')]('Content-Range',_0x57ea79+'-'+_0x5c2fc0+'/'+_0x432cfb)[_0x4a40('0x19')](_0x202857);}return null;};}function patchUpdates(_0xe4f7e4){return function(_0x502466){try{jsonpatch[_0x4a40('0x1f')](_0x502466,_0xe4f7e4,!![]);}catch(_0x4e7417){return BPromise[_0x4a40('0x20')](_0x4e7417);}return _0x502466[_0x4a40('0x21')]();};}function saveUpdates(_0x4c9964,_0xffae1b){return function(_0x45d040){if(_0x45d040){return _0x45d040['update'](_0x4c9964)[_0x4a40('0x22')](function(_0x10bf90){return _0x10bf90;});}return null;};}function removeEntity(_0x243b58,_0x2635b3){return function(_0x4a305f){if(_0x4a305f){return _0x4a305f['destroy']()[_0x4a40('0x22')](function(){_0x243b58[_0x4a40('0x17')](0xcc)[_0x4a40('0x18')]();});}};}function handleEntityNotFound(_0x18015e,_0xa1f73a){return function(_0x251824){if(!_0x251824){_0x18015e[_0x4a40('0x23')](0x194);}return _0x251824;};}function handleError(_0x3d6198,_0x50cfd6){_0x50cfd6=_0x50cfd6||0x1f4;return function(_0x1b8c86){logger[_0x4a40('0x24')](_0x1b8c86[_0x4a40('0x25')]);if(_0x1b8c86['name']){delete _0x1b8c86[_0x4a40('0x26')];}_0x3d6198['status'](_0x50cfd6)[_0x4a40('0x27')](_0x1b8c86);};}exports[_0x4a40('0x28')]=function(_0x525e43,_0x3698a5){var _0x43c8d6={},_0x5dc8c2={},_0x241f28={'count':0x0,'rows':[]};var _0xcf04b2=_[_0x4a40('0x29')](db[_0x4a40('0x2a')][_0x4a40('0x2b')],function(_0x939f3e){return{'name':_0x939f3e['fieldName'],'type':_0x939f3e[_0x4a40('0x2c')][_0x4a40('0x2d')]};});_0x5dc8c2['model']=_['map'](_0xcf04b2,'name');_0x5dc8c2['query']=_[_0x4a40('0x2e')](_0x525e43['query']);_0x5dc8c2[_0x4a40('0x2f')]=_[_0x4a40('0x30')](_0x5dc8c2[_0x4a40('0x31')],_0x5dc8c2[_0x4a40('0x32')]);_0x43c8d6['attributes']=_['intersection'](_0x5dc8c2[_0x4a40('0x31')],qs[_0x4a40('0x33')](_0x525e43[_0x4a40('0x32')][_0x4a40('0x33')]));_0x43c8d6[_0x4a40('0x34')]=_0x43c8d6['attributes'][_0x4a40('0x35')]?_0x43c8d6[_0x4a40('0x34')]:_0x5dc8c2[_0x4a40('0x31')];if(!_0x525e43[_0x4a40('0x32')][_0x4a40('0x36')](_0x4a40('0x37'))){_0x43c8d6['limit']=qs['limit'](_0x525e43[_0x4a40('0x32')][_0x4a40('0x1c')]);_0x43c8d6[_0x4a40('0x1a')]=qs['offset'](_0x525e43[_0x4a40('0x32')][_0x4a40('0x1a')]);}_0x43c8d6[_0x4a40('0x38')]=qs[_0x4a40('0x39')](_0x525e43[_0x4a40('0x32')][_0x4a40('0x39')]);_0x43c8d6[_0x4a40('0x3a')]=qs[_0x4a40('0x2f')](_[_0x4a40('0x3b')](_0x525e43['query'],_0x5dc8c2['filters']),_0xcf04b2);if(_0x525e43[_0x4a40('0x32')]['filter']){_0x43c8d6[_0x4a40('0x3a')]=_[_0x4a40('0x3c')](_0x43c8d6['where'],{'$or':_[_0x4a40('0x29')](_0xcf04b2,function(_0x5cdf53){if(_0x5cdf53[_0x4a40('0x2c')]!==_0x4a40('0x3d')){var _0x1d8f60={};_0x1d8f60[_0x5cdf53[_0x4a40('0x26')]]={'$like':'%'+_0x525e43[_0x4a40('0x32')][_0x4a40('0x3e')]+'%'};return _0x1d8f60;}})});}_0x43c8d6=_[_0x4a40('0x3c')]({},_0x43c8d6,_0x525e43[_0x4a40('0x3f')]);var _0x34c2cd={'where':_0x43c8d6[_0x4a40('0x3a')]};return db[_0x4a40('0x2a')][_0x4a40('0x1d')](_0x34c2cd)[_0x4a40('0x22')](function(_0x1ed81c){_0x241f28['count']=_0x1ed81c;if(_0x525e43['query'][_0x4a40('0x40')]){_0x43c8d6[_0x4a40('0x41')]=[{'all':!![]}];}return db[_0x4a40('0x2a')]['findAll'](_0x43c8d6);})[_0x4a40('0x22')](function(_0x223b48){_0x241f28[_0x4a40('0x42')]=_0x223b48;return _0x241f28;})['then'](respondWithFilteredResult(_0x3698a5,_0x43c8d6))['catch'](handleError(_0x3698a5,null));};exports[_0x4a40('0x43')]=function(_0x42200b,_0x2007dc){var _0x17a249={'raw':!![],'where':{'id':_0x42200b[_0x4a40('0x44')]['id']}},_0x53cc92={};_0x53cc92[_0x4a40('0x31')]=_['keys'](db[_0x4a40('0x2a')][_0x4a40('0x2b')]);_0x53cc92[_0x4a40('0x32')]=_[_0x4a40('0x2e')](_0x42200b[_0x4a40('0x32')]);_0x53cc92[_0x4a40('0x2f')]=_[_0x4a40('0x30')](_0x53cc92['model'],_0x53cc92[_0x4a40('0x32')]);_0x17a249[_0x4a40('0x34')]=_[_0x4a40('0x30')](_0x53cc92['model'],qs['fields'](_0x42200b['query']['fields']));_0x17a249[_0x4a40('0x34')]=_0x17a249[_0x4a40('0x34')]['length']?_0x17a249[_0x4a40('0x34')]:_0x53cc92[_0x4a40('0x31')];if(_0x42200b[_0x4a40('0x32')][_0x4a40('0x40')]){_0x17a249[_0x4a40('0x41')]=[{'all':!![]}];}_0x17a249=_[_0x4a40('0x3c')]({},_0x17a249,_0x42200b[_0x4a40('0x3f')]);return db[_0x4a40('0x2a')][_0x4a40('0x45')](_0x17a249)[_0x4a40('0x22')](handleEntityNotFound(_0x2007dc,null))[_0x4a40('0x22')](respondWithResult(_0x2007dc,null))[_0x4a40('0x46')](handleError(_0x2007dc,null));};exports[_0x4a40('0x47')]=function(_0x49c229,_0x400d5f){return db['SalesforceField'][_0x4a40('0x47')](_0x49c229[_0x4a40('0x48')],{})[_0x4a40('0x22')](respondWithResult(_0x400d5f,0xc9))[_0x4a40('0x46')](handleError(_0x400d5f,null));};exports[_0x4a40('0x49')]=function(_0x42257e,_0x1ef650){if(_0x42257e[_0x4a40('0x48')]['id']){delete _0x42257e[_0x4a40('0x48')]['id'];}return db[_0x4a40('0x2a')][_0x4a40('0x45')]({'where':{'id':_0x42257e[_0x4a40('0x44')]['id']}})[_0x4a40('0x22')](handleEntityNotFound(_0x1ef650,null))[_0x4a40('0x22')](saveUpdates(_0x42257e[_0x4a40('0x48')],null))[_0x4a40('0x22')](respondWithResult(_0x1ef650,null))['catch'](handleError(_0x1ef650,null));};exports[_0x4a40('0x4a')]=function(_0x2f111a,_0x140ed8){return db['SalesforceField']['find']({'where':{'id':_0x2f111a[_0x4a40('0x44')]['id']}})[_0x4a40('0x22')](handleEntityNotFound(_0x140ed8,null))[_0x4a40('0x22')](removeEntity(_0x140ed8,null))[_0x4a40('0x46')](handleError(_0x140ed8,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index a6d0d6d..41f79fb 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 _0xd614=['exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd614,0xd9));var _0x4d61=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xd614[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x4d61('0x0'));var util=require('util');var logger=require(_0x4d61('0x1'))('api');var moment=require(_0x4d61('0x2'));var BPromise=require(_0x4d61('0x3'));var rp=require(_0x4d61('0x4'));var fs=require('fs');var path=require(_0x4d61('0x5'));var rimraf=require(_0x4d61('0x6'));var config=require(_0x4d61('0x7'));var attributes=require('./intSalesforceField.attributes');module[_0x4d61('0x8')]=function(_0x413da7,_0x163300){return _0x413da7[_0x4d61('0x9')](_0x4d61('0xa'),attributes,{'tableName':_0x4d61('0xb'),'paranoid':![],'indexes':[{'name':_0x4d61('0xc'),'fields':[_0x4d61('0xd'),_0x4d61('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x261d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId'];(function(_0x118355,_0x201311){var _0x32f7ea=function(_0x4fd55b){while(--_0x4fd55b){_0x118355['push'](_0x118355['shift']());}};_0x32f7ea(++_0x201311);}(_0x261d,0xe0));var _0xd261=function(_0x219b28,_0x4dd22b){_0x219b28=_0x219b28-0x0;var _0x5a4ec7=_0x261d[_0x219b28];return _0x5a4ec7;};'use strict';var _=require(_0xd261('0x0'));var util=require(_0xd261('0x1'));var logger=require(_0xd261('0x2'))(_0xd261('0x3'));var moment=require(_0xd261('0x4'));var BPromise=require(_0xd261('0x5'));var rp=require(_0xd261('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd261('0x7'));var config=require(_0xd261('0x8'));var attributes=require(_0xd261('0x9'));module['exports']=function(_0x38c49e,_0x47b032){return _0x38c49e[_0xd261('0xa')](_0xd261('0xb'),attributes,{'tableName':_0xd261('0xc'),'paranoid':![],'indexes':[{'name':_0xd261('0xd'),'fields':[_0xd261('0xe'),_0xd261('0xf')],'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 30b8768..995f150 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 _0x268f=['request\x20sent','error','code','message','info','result','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x5346d1,_0x2e0612){var _0x4adbc1=function(_0x3d3754){while(--_0x3d3754){_0x5346d1['push'](_0x5346d1['shift']());}};_0x4adbc1(++_0x2e0612);}(_0x268f,0x149));var _0xf268=function(_0x287ff1,_0x1cb44a){_0x287ff1=_0x287ff1-0x0;var _0xb4dac6=_0x268f[_0x287ff1];return _0xb4dac6;};'use strict';var _=require(_0xf268('0x0'));var util=require(_0xf268('0x1'));var moment=require(_0xf268('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf268('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf268('0x4'));var logger=require('../../config/logger')(_0xf268('0x5'));var config=require(_0xf268('0x6'));var jayson=require(_0xf268('0x7'));var client=jayson[_0xf268('0x8')][_0xf268('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a6a6a,_0x1921bf,_0x216a8e){return new BPromise(function(_0x324c3f,_0x5be454){return client['request'](_0x5a6a6a,_0x216a8e)['then'](function(_0x8e30f6){logger['info'](_0xf268('0xa'),_0x1921bf,'request\x20sent');logger[_0xf268('0xb')](_0xf268('0xc'),_0x1921bf,_0xf268('0xd'),JSON['stringify'](_0x8e30f6));if(_0x8e30f6[_0xf268('0xe')]){if(_0x8e30f6[_0xf268('0xe')][_0xf268('0xf')]===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0x1921bf,_0x8e30f6['error'][_0xf268('0x10')]);return _0x5be454(_0x8e30f6[_0xf268('0xe')][_0xf268('0x10')]);}logger[_0xf268('0xe')](_0xf268('0xa'),_0x1921bf,_0x8e30f6['error']['message']);return _0x324c3f(_0x8e30f6[_0xf268('0xe')][_0xf268('0x10')]);}else{logger[_0xf268('0x11')](_0xf268('0xa'),_0x1921bf,_0xf268('0xd'));_0x324c3f(_0x8e30f6[_0xf268('0x12')][_0xf268('0x10')]);}})['catch'](function(_0x34cd5e){logger['error']('SalesforceField,\x20%s,\x20%s',_0x1921bf,_0x34cd5e);_0x5be454(_0x34cd5e);});});} \ No newline at end of file +var _0x8be0=['result','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3b98c8,_0x36eb12){var _0x57f6bc=function(_0x78cf75){while(--_0x78cf75){_0x3b98c8['push'](_0x3b98c8['shift']());}};_0x57f6bc(++_0x36eb12);}(_0x8be0,0x166));var _0x08be=function(_0xebf221,_0x179b2f){_0xebf221=_0xebf221-0x0;var _0x4a745d=_0x8be0[_0xebf221];return _0x4a745d;};'use strict';var _=require('lodash');var util=require(_0x08be('0x0'));var moment=require(_0x08be('0x1'));var BPromise=require(_0x08be('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x08be('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x08be('0x4'));var logger=require(_0x08be('0x5'))('rpc');var config=require(_0x08be('0x6'));var jayson=require(_0x08be('0x7'));var client=jayson[_0x08be('0x8')][_0x08be('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x442752,_0x3ee160,_0x172a4f){return new BPromise(function(_0x212f10,_0x37a2d1){return client['request'](_0x442752,_0x172a4f)[_0x08be('0xa')](function(_0x1379d1){logger[_0x08be('0xb')](_0x08be('0xc'),_0x3ee160,'request\x20sent');logger[_0x08be('0xd')](_0x08be('0xe'),_0x3ee160,_0x08be('0xf'),JSON[_0x08be('0x10')](_0x1379d1));if(_0x1379d1[_0x08be('0x11')]){if(_0x1379d1['error'][_0x08be('0x12')]===0x1f4){logger['error'](_0x08be('0xc'),_0x3ee160,_0x1379d1[_0x08be('0x11')][_0x08be('0x13')]);return _0x37a2d1(_0x1379d1[_0x08be('0x11')]['message']);}logger[_0x08be('0x11')](_0x08be('0xc'),_0x3ee160,_0x1379d1[_0x08be('0x11')][_0x08be('0x13')]);return _0x212f10(_0x1379d1[_0x08be('0x11')][_0x08be('0x13')]);}else{logger[_0x08be('0xb')](_0x08be('0xc'),_0x3ee160,_0x08be('0xf'));_0x212f10(_0x1379d1[_0x08be('0x14')][_0x08be('0x13')]);}})['catch'](function(_0x364092){logger['error'](_0x08be('0xc'),_0x3ee160,_0x364092);_0x37a2d1(_0x364092);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 44d9169..1ad9544 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 _0x8f37=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','/:id','update','delete','destroy'];(function(_0x337f7e,_0x35298d){var _0x3d0c0e=function(_0x405964){while(--_0x405964){_0x337f7e['push'](_0x337f7e['shift']());}};_0x3d0c0e(++_0x35298d);}(_0x8f37,0x190));var _0x78f3=function(_0x2f8ffe,_0x3fa93f){_0x2f8ffe=_0x2f8ffe-0x0;var _0x3d2a3f=_0x8f37[_0x2f8ffe];return _0x3d2a3f;};'use strict';var multer=require(_0x78f3('0x0'));var util=require(_0x78f3('0x1'));var path=require(_0x78f3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x78f3('0x3')]();var fs_extra=require(_0x78f3('0x4'));var auth=require(_0x78f3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x78f3('0x6'));var controller=require('./intServicenowAccount.controller');router[_0x78f3('0x7')]('/',auth['isAuthenticated'](),controller[_0x78f3('0x8')]);router[_0x78f3('0x7')]('/:id',auth[_0x78f3('0x9')](),controller['show']);router[_0x78f3('0x7')](_0x78f3('0xa'),auth['isAuthenticated'](),controller[_0x78f3('0xb')]);router[_0x78f3('0x7')](_0x78f3('0xc'),auth[_0x78f3('0x9')](),controller[_0x78f3('0xd')]);router['post']('/',auth[_0x78f3('0x9')](),controller[_0x78f3('0xe')]);router['post'](_0x78f3('0xa'),auth[_0x78f3('0x9')](),controller[_0x78f3('0xf')]);router['put'](_0x78f3('0x10'),auth[_0x78f3('0x9')](),controller[_0x78f3('0x11')]);router[_0x78f3('0x12')](_0x78f3('0x10'),auth[_0x78f3('0x9')](),controller[_0x78f3('0x13')]);module[_0x78f3('0x14')]=router; \ No newline at end of file +var _0x39e6=['/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post','update','delete'];(function(_0xea1bcd,_0x465e08){var _0xfbe4c6=function(_0x4e20f1){while(--_0x4e20f1){_0xea1bcd['push'](_0xea1bcd['shift']());}};_0xfbe4c6(++_0x465e08);}(_0x39e6,0xf5));var _0x639e=function(_0x2f2107,_0x1a0a44){_0x2f2107=_0x2f2107-0x0;var _0x9cf23b=_0x39e6[_0x2f2107];return _0x9cf23b;};'use strict';var multer=require(_0x639e('0x0'));var util=require(_0x639e('0x1'));var path=require(_0x639e('0x2'));var timeout=require(_0x639e('0x3'));var express=require('express');var router=express[_0x639e('0x4')]();var fs_extra=require(_0x639e('0x5'));var auth=require(_0x639e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x639e('0x7'));var controller=require(_0x639e('0x8'));router[_0x639e('0x9')]('/',auth[_0x639e('0xa')](),controller[_0x639e('0xb')]);router[_0x639e('0x9')]('/:id',auth[_0x639e('0xa')](),controller[_0x639e('0xc')]);router[_0x639e('0x9')](_0x639e('0xd'),auth[_0x639e('0xa')](),controller['getConfigurations']);router[_0x639e('0x9')](_0x639e('0xe'),auth[_0x639e('0xa')](),controller[_0x639e('0xf')]);router[_0x639e('0x10')]('/',auth[_0x639e('0xa')](),controller['create']);router[_0x639e('0x10')](_0x639e('0xd'),auth[_0x639e('0xa')](),controller['addConfiguration']);router['put']('/:id',auth[_0x639e('0xa')](),controller[_0x639e('0x11')]);router[_0x639e('0x12')](_0x639e('0x13'),auth[_0x639e('0xa')](),controller[_0x639e('0x14')]);module[_0x639e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 29eddf0..0380cd3 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 _0x1ef2=['remoteUri','sequelize','exports','STRING','username'];(function(_0x5b8f1a,_0x42a930){var _0xac26d6=function(_0x4eff39){while(--_0x4eff39){_0x5b8f1a['push'](_0x5b8f1a['shift']());}};_0xac26d6(++_0x42a930);}(_0x1ef2,0x123));var _0x21ef=function(_0x21b14f,_0x3ed9b9){_0x21b14f=_0x21b14f-0x0;var _0x4c0fd0=_0x1ef2[_0x21b14f];return _0x4c0fd0;};'use strict';var Sequelize=require(_0x21ef('0x0'));module[_0x21ef('0x1')]={'name':{'type':Sequelize[_0x21ef('0x2')]},'description':{'type':Sequelize[_0x21ef('0x2')]},'username':{'type':Sequelize[_0x21ef('0x2')],'unique':_0x21ef('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x21ef('0x2')]},'remoteUri':{'type':Sequelize[_0x21ef('0x2')],'unique':_0x21ef('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xc6c8=['STRING','username','remoteUri','sequelize','exports'];(function(_0x51b3b6,_0x57fc11){var _0xf6020=function(_0x86d377){while(--_0x86d377){_0x51b3b6['push'](_0x51b3b6['shift']());}};_0xf6020(++_0x57fc11);}(_0xc6c8,0x1ed));var _0x8c6c=function(_0x52da7f,_0x4294f6){_0x52da7f=_0x52da7f-0x0;var _0x512533=_0xc6c8[_0x52da7f];return _0x512533;};'use strict';var Sequelize=require(_0x8c6c('0x0'));module[_0x8c6c('0x1')]={'name':{'type':Sequelize[_0x8c6c('0x2')]},'description':{'type':Sequelize[_0x8c6c('0x2')]},'username':{'type':Sequelize[_0x8c6c('0x2')],'unique':_0x8c6c('0x3')},'password':{'type':Sequelize[_0x8c6c('0x2')]},'email':{'type':Sequelize[_0x8c6c('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x8c6c('0x4')},'serverUrl':{'type':Sequelize[_0x8c6c('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 f9bd6a7..a967779 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 _0xcaeb=['includes','internalType','label','push','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','concat','ServiceNow\x20error:\x20','test','statusCode','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','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','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','destroy','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','caused_by','upon_reject','child_incidents','approval_history','number','sys_updated_by','user_input','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','business_service','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','work_notes','short_description','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','urgency','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','category','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','remove'];(function(_0x14222a,_0x15253e){var _0x1e6bc5=function(_0x3d0ee9){while(--_0x3d0ee9){_0x14222a['push'](_0x14222a['shift']());}};_0x1e6bc5(++_0x15253e);}(_0xcaeb,0x18e));var _0xbcae=function(_0x3ff685,_0x304b9e){_0x3ff685=_0x3ff685-0x0;var _0x2046c9=_0xcaeb[_0x3ff685];return _0x2046c9;};'use strict';var emlformat=require(_0xbcae('0x0'));var rimraf=require(_0xbcae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbcae('0x2'));var rp=require(_0xbcae('0x3'));var moment=require(_0xbcae('0x4'));var BPromise=require(_0xbcae('0x5'));var Mustache=require('mustache');var util=require(_0xbcae('0x6'));var path=require(_0xbcae('0x7'));var sox=require('sox');var csv=require(_0xbcae('0x8'));var ejs=require(_0xbcae('0x9'));var fs=require('fs');var fs_extra=require(_0xbcae('0xa'));var _=require(_0xbcae('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbcae('0xc'));var deskjs=require(_0xbcae('0xd'));var toCsv=require(_0xbcae('0x8'));var querystring=require(_0xbcae('0xe'));var Papa=require(_0xbcae('0xf'));var Redis=require(_0xbcae('0x10'));var authService=require(_0xbcae('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbcae('0x12'));var hardwareService=require(_0xbcae('0x13'));var logger=require(_0xbcae('0x14'))(_0xbcae('0x15'));var utils=require('../../config/utils');var config=require(_0xbcae('0x16'));var licenseUtil=require(_0xbcae('0x17'));var db=require(_0xbcae('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x53a705,_0x496733){_0x496733=_0x496733||0xcc;return function(_0x3ded3e){if(_0x3ded3e){return _0x53a705[_0xbcae('0x19')](_0x496733);}return _0x53a705[_0xbcae('0x1a')](_0x496733)[_0xbcae('0x1b')]();};}function respondWithResult(_0x38b005,_0x10aa6f){_0x10aa6f=_0x10aa6f||0xc8;return function(_0x1cb8a5){if(_0x1cb8a5){return _0x38b005['status'](_0x10aa6f)[_0xbcae('0x1c')](_0x1cb8a5);}};}function respondWithFilteredResult(_0x430634,_0x18c75b){return function(_0x4b329b){if(_0x4b329b){var _0x4364ac=typeof _0x18c75b[_0xbcae('0x1d')]==='undefined'&&typeof _0x18c75b[_0xbcae('0x1e')]===_0xbcae('0x1f');var _0x390b34=_0x4b329b[_0xbcae('0x20')];var _0x45a439=_0x4364ac?0x0:_0x18c75b[_0xbcae('0x1d')];var _0x2cf8a7=_0x4364ac?_0x4b329b[_0xbcae('0x20')]:_0x18c75b[_0xbcae('0x1d')]+_0x18c75b[_0xbcae('0x1e')];var _0x1d6f61;if(_0x2cf8a7>=_0x390b34){_0x2cf8a7=_0x390b34;_0x1d6f61=0xc8;}else{_0x1d6f61=0xce;}_0x430634[_0xbcae('0x1a')](_0x1d6f61);return _0x430634[_0xbcae('0x21')](_0xbcae('0x22'),_0x45a439+'-'+_0x2cf8a7+'/'+_0x390b34)[_0xbcae('0x1c')](_0x4b329b);}return null;};}function patchUpdates(_0x2d6d3c){return function(_0xc6f2a0){try{jsonpatch[_0xbcae('0x23')](_0xc6f2a0,_0x2d6d3c,!![]);}catch(_0x3d5ce2){return BPromise[_0xbcae('0x24')](_0x3d5ce2);}return _0xc6f2a0[_0xbcae('0x25')]();};}function saveUpdates(_0x543c9f,_0x4fa53e){return function(_0x4aa6be){if(_0x4aa6be){return _0x4aa6be[_0xbcae('0x26')](_0x543c9f)[_0xbcae('0x27')](function(_0x5ce789){return _0x5ce789;});}return null;};}function removeEntity(_0x1d19e6,_0x560b41){return function(_0x4c518d){if(_0x4c518d){return _0x4c518d['destroy']()[_0xbcae('0x27')](function(){_0x1d19e6[_0xbcae('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b7357,_0x48319b){return function(_0x3abf40){if(!_0x3abf40){_0x2b7357[_0xbcae('0x19')](0x194);}return _0x3abf40;};}function handleError(_0x52e288,_0x578247){_0x578247=_0x578247||0x1f4;return function(_0x45a4c6){logger[_0xbcae('0x28')](_0x45a4c6[_0xbcae('0x29')]);if(_0x45a4c6[_0xbcae('0x2a')]){delete _0x45a4c6[_0xbcae('0x2a')];}_0x52e288['status'](_0x578247)[_0xbcae('0x2b')](_0x45a4c6);};}exports[_0xbcae('0x2c')]=function(_0x565367,_0x466438){var _0x484ad5={},_0x6eb30a={},_0x244ce4={'count':0x0,'rows':[]};var _0x554db0=_[_0xbcae('0x2d')](db[_0xbcae('0x2e')][_0xbcae('0x2f')],function(_0x37dd4a){return{'name':_0x37dd4a[_0xbcae('0x30')],'type':_0x37dd4a[_0xbcae('0x31')][_0xbcae('0x32')]};});_0x6eb30a[_0xbcae('0x33')]=_[_0xbcae('0x2d')](_0x554db0,'name');_0x6eb30a[_0xbcae('0x34')]=_['keys'](_0x565367[_0xbcae('0x34')]);_0x6eb30a[_0xbcae('0x35')]=_[_0xbcae('0x36')](_0x6eb30a[_0xbcae('0x33')],_0x6eb30a[_0xbcae('0x34')]);_0x484ad5['attributes']=_[_0xbcae('0x36')](_0x6eb30a['model'],qs[_0xbcae('0x37')](_0x565367[_0xbcae('0x34')]['fields']));_0x484ad5[_0xbcae('0x38')]=_0x484ad5[_0xbcae('0x38')][_0xbcae('0x39')]?_0x484ad5[_0xbcae('0x38')]:_0x6eb30a[_0xbcae('0x33')];if(!_0x565367['query'][_0xbcae('0x3a')](_0xbcae('0x3b'))){_0x484ad5['limit']=qs['limit'](_0x565367[_0xbcae('0x34')]['limit']);_0x484ad5[_0xbcae('0x1d')]=qs[_0xbcae('0x1d')](_0x565367[_0xbcae('0x34')]['offset']);}_0x484ad5[_0xbcae('0x3c')]=qs[_0xbcae('0x3d')](_0x565367[_0xbcae('0x34')]['sort']);_0x484ad5[_0xbcae('0x3e')]=qs[_0xbcae('0x35')](_[_0xbcae('0x3f')](_0x565367[_0xbcae('0x34')],_0x6eb30a[_0xbcae('0x35')]),_0x554db0);if(_0x565367[_0xbcae('0x34')]['filter']){_0x484ad5['where']=_[_0xbcae('0x40')](_0x484ad5['where'],{'$or':_[_0xbcae('0x2d')](_0x554db0,function(_0x4f698f){if(_0x4f698f[_0xbcae('0x31')]!==_0xbcae('0x41')){var _0x5c92b8={};_0x5c92b8[_0x4f698f[_0xbcae('0x2a')]]={'$like':'%'+_0x565367['query'][_0xbcae('0x42')]+'%'};return _0x5c92b8;}})});}_0x484ad5=_[_0xbcae('0x40')]({},_0x484ad5,_0x565367['options']);var _0x1932ff={'where':_0x484ad5[_0xbcae('0x3e')]};return db['ServicenowAccount'][_0xbcae('0x20')](_0x1932ff)[_0xbcae('0x27')](function(_0x7e85fc){_0x244ce4[_0xbcae('0x20')]=_0x7e85fc;if(_0x565367[_0xbcae('0x34')][_0xbcae('0x43')]){_0x484ad5[_0xbcae('0x44')]=[{'all':!![]}];}return db[_0xbcae('0x2e')][_0xbcae('0x45')](_0x484ad5);})[_0xbcae('0x27')](function(_0x52a081){_0x244ce4[_0xbcae('0x46')]=_0x52a081;return _0x244ce4;})[_0xbcae('0x27')](respondWithFilteredResult(_0x466438,_0x484ad5))[_0xbcae('0x47')](handleError(_0x466438,null));};exports[_0xbcae('0x48')]=function(_0x5a4298,_0x41c50e){var _0x4fa825={'raw':![],'where':{'id':_0x5a4298['params']['id']}},_0x156ab6={};_0x156ab6[_0xbcae('0x33')]=_[_0xbcae('0x49')](db[_0xbcae('0x2e')][_0xbcae('0x2f')]);_0x156ab6[_0xbcae('0x34')]=_['keys'](_0x5a4298['query']);_0x156ab6[_0xbcae('0x35')]=_[_0xbcae('0x36')](_0x156ab6[_0xbcae('0x33')],_0x156ab6[_0xbcae('0x34')]);_0x4fa825[_0xbcae('0x38')]=_[_0xbcae('0x36')](_0x156ab6[_0xbcae('0x33')],qs[_0xbcae('0x37')](_0x5a4298[_0xbcae('0x34')][_0xbcae('0x37')]));_0x4fa825[_0xbcae('0x38')]=_0x4fa825[_0xbcae('0x38')]['length']?_0x4fa825[_0xbcae('0x38')]:_0x156ab6[_0xbcae('0x33')];if(_0x5a4298[_0xbcae('0x34')]['includeAll']){_0x4fa825[_0xbcae('0x44')]=[{'all':!![]}];}_0x4fa825=_['merge']({},_0x4fa825,_0x5a4298[_0xbcae('0x4a')]);return db['ServicenowAccount'][_0xbcae('0x4b')](_0x4fa825)['then'](handleEntityNotFound(_0x41c50e,null))[_0xbcae('0x27')](respondWithResult(_0x41c50e,null))['catch'](handleError(_0x41c50e,null));};exports['create']=function(_0x51f5cf,_0x3fac2c){return db[_0xbcae('0x2e')][_0xbcae('0x4c')](_0x51f5cf[_0xbcae('0x4d')],{})['then'](respondWithResult(_0x3fac2c,0xc9))[_0xbcae('0x47')](handleError(_0x3fac2c,null));};exports[_0xbcae('0x26')]=function(_0x350c4b,_0x19bbe6){if(_0x350c4b[_0xbcae('0x4d')]['id']){delete _0x350c4b[_0xbcae('0x4d')]['id'];}return db[_0xbcae('0x2e')][_0xbcae('0x4b')]({'where':{'id':_0x350c4b[_0xbcae('0x4e')]['id']}})['then'](handleEntityNotFound(_0x19bbe6,null))['then'](saveUpdates(_0x350c4b[_0xbcae('0x4d')],null))[_0xbcae('0x27')](respondWithResult(_0x19bbe6,null))['catch'](handleError(_0x19bbe6,null));};exports[_0xbcae('0x4f')]=function(_0x5d5cde,_0x44cfba){return db[_0xbcae('0x2e')][_0xbcae('0x4b')]({'where':{'id':_0x5d5cde[_0xbcae('0x4e')]['id']}})[_0xbcae('0x27')](handleEntityNotFound(_0x44cfba,null))['then'](removeEntity(_0x44cfba,null))[_0xbcae('0x47')](handleError(_0x44cfba,null));};exports[_0xbcae('0x50')]=function(_0x5bc962,_0x5efb4a,_0x264087){var _0x28bda8={};var _0x3461e9={};var _0x4d5adf;var _0x364129;return db[_0xbcae('0x2e')][_0xbcae('0x51')]({'where':{'id':_0x5bc962[_0xbcae('0x4e')]['id']}})[_0xbcae('0x27')](handleEntityNotFound(_0x5efb4a,null))[_0xbcae('0x27')](function(_0x436826){if(_0x436826){_0x4d5adf=_0x436826;_0x3461e9[_0xbcae('0x33')]=_['keys'](db[_0xbcae('0x52')][_0xbcae('0x2f')]);_0x3461e9['query']=_['keys'](_0x5bc962[_0xbcae('0x34')]);_0x3461e9[_0xbcae('0x35')]=_[_0xbcae('0x36')](_0x3461e9['model'],_0x3461e9[_0xbcae('0x34')]);_0x28bda8[_0xbcae('0x38')]=_[_0xbcae('0x36')](_0x3461e9['model'],qs['fields'](_0x5bc962[_0xbcae('0x34')][_0xbcae('0x37')]));_0x28bda8[_0xbcae('0x38')]=_0x28bda8[_0xbcae('0x38')]['length']?_0x28bda8[_0xbcae('0x38')]:_0x3461e9[_0xbcae('0x33')];_0x28bda8[_0xbcae('0x3c')]=qs[_0xbcae('0x3d')](_0x5bc962[_0xbcae('0x34')][_0xbcae('0x3d')]);_0x28bda8[_0xbcae('0x3e')]=qs['filters'](_[_0xbcae('0x3f')](_0x5bc962[_0xbcae('0x34')],_0x3461e9[_0xbcae('0x35')]));if(_0x5bc962[_0xbcae('0x34')][_0xbcae('0x42')]){_0x28bda8['where']=_['merge'](_0x28bda8[_0xbcae('0x3e')],{'$or':_['map'](_0x28bda8[_0xbcae('0x38')],function(_0x2c1559){var _0x49142d={};_0x49142d[_0x2c1559]={'$like':'%'+_0x5bc962[_0xbcae('0x34')][_0xbcae('0x42')]+'%'};return _0x49142d;})});}_0x28bda8=_['merge']({},_0x28bda8,_0x5bc962[_0xbcae('0x4a')]);return _0x4d5adf[_0xbcae('0x50')](_0x28bda8);}})[_0xbcae('0x27')](function(_0x2b7027){if(_0x2b7027){_0x364129=_0x2b7027['length'];if(!_0x5bc962[_0xbcae('0x34')]['hasOwnProperty'](_0xbcae('0x3b'))){_0x28bda8['limit']=qs[_0xbcae('0x1e')](_0x5bc962[_0xbcae('0x34')][_0xbcae('0x1e')]);_0x28bda8['offset']=qs[_0xbcae('0x1d')](_0x5bc962[_0xbcae('0x34')][_0xbcae('0x1d')]);}return _0x4d5adf[_0xbcae('0x50')](_0x28bda8);}})[_0xbcae('0x27')](function(_0x4f7388){if(_0x4f7388){return _0x4f7388?{'count':_0x364129,'rows':_0x4f7388}:null;}})[_0xbcae('0x27')](respondWithResult(_0x5efb4a,null))[_0xbcae('0x47')](handleError(_0x5efb4a,null));};exports[_0xbcae('0x53')]=function(_0x4b71f4,_0x109232,_0xd8d15a){if(_0x4b71f4['body']['id']){delete _0x4b71f4[_0xbcae('0x4d')]['id'];}return db['ServicenowAccount'][_0xbcae('0x51')]({'where':{'id':_0x4b71f4[_0xbcae('0x4e')]['id']}})[_0xbcae('0x27')](handleEntityNotFound(_0x109232,null))[_0xbcae('0x27')](function(_0x221088){if(_0x221088){_0x4b71f4['body'][_0xbcae('0x54')]=_0x221088['id'];_0x4b71f4[_0xbcae('0x4d')]['Subjects']=integrations[_0xbcae('0x55')](_0x4b71f4['body'][_0xbcae('0x56')],_0x4b71f4[_0xbcae('0x4d')][_0xbcae('0x31')]);_0x4b71f4['body'][_0xbcae('0x57')]=integrations[_0xbcae('0x58')](_0x4b71f4[_0xbcae('0x4d')]['channel'],_0x4b71f4['body']['type']);return db[_0xbcae('0x52')][_0xbcae('0x4c')](_0x4b71f4[_0xbcae('0x4d')],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db[_0xbcae('0x59')],'as':_0xbcae('0x57')}]});}return null;})['then'](respondWithResult(_0x109232,null))[_0xbcae('0x47')](handleError(_0x109232,null));};exports[_0xbcae('0x5a')]=function(_0x4a21bd,_0x5742ff,_0x4d42c4){var _0x2401c4=[_0xbcae('0x5b'),_0xbcae('0x5c'),_0xbcae('0x5d'),_0xbcae('0x5e'),_0xbcae('0x5f'),_0xbcae('0x60'),_0xbcae('0x61'),_0xbcae('0x62'),'category'];var _0x59f05b=['parent','made_sla',_0xbcae('0x63'),'watch_list',_0xbcae('0x64'),'sys_updated_on',_0xbcae('0x65'),_0xbcae('0x5c'),_0xbcae('0x66'),_0xbcae('0x67'),'resolved_by',_0xbcae('0x68'),'opened_by',_0xbcae('0x69'),'sys_created_on',_0xbcae('0x6a'),_0xbcae('0x6b'),_0xbcae('0x6c'),_0xbcae('0x5d'),_0xbcae('0x3c'),_0xbcae('0x6d'),_0xbcae('0x6e'),_0xbcae('0x6f'),_0xbcae('0x70'),_0xbcae('0x71'),_0xbcae('0x72'),'work_notes_list',_0xbcae('0x73'),'priority',_0xbcae('0x74'),_0xbcae('0x75'),_0xbcae('0x76'),_0xbcae('0x77'),_0xbcae('0x78'),_0xbcae('0x79'),'group_list',_0xbcae('0x7a'),_0xbcae('0x7b'),_0xbcae('0x7c'),_0xbcae('0x7d'),'approval_set',_0xbcae('0x5e'),_0xbcae('0x7e'),_0xbcae('0x7f'),_0xbcae('0x5f'),'correlation_display',_0xbcae('0x80'),_0xbcae('0x81'),_0xbcae('0x82'),_0xbcae('0x83'),_0xbcae('0x84'),_0xbcae('0x85'),_0xbcae('0x86'),_0xbcae('0x60'),_0xbcae('0x87'),_0xbcae('0x88'),_0xbcae('0x89'),_0xbcae('0x8a'),'parent_incident',_0xbcae('0x8b'),_0xbcae('0x8c'),_0xbcae('0x8d'),_0xbcae('0x61'),_0xbcae('0x8e'),'problem_id','company','reassignment_count','activity_due','assigned_to',_0xbcae('0x62'),_0xbcae('0x8f'),'sla_due',_0xbcae('0x90'),_0xbcae('0x91'),_0xbcae('0x92'),_0xbcae('0x93'),_0xbcae('0x94'),_0xbcae('0x95'),_0xbcae('0x96'),_0xbcae('0x97'),'correlation_id','location',_0xbcae('0x98')];var _0x310589='';var _0x3acf01='';var _0x596150=[];var _0x1a8b9f='';var _0xe12af='';var _0x194e20=[];var _0x3cbd9d='';var _0x2f711e='';var _0xd7a70d={};var _0x34c98d='';return db[_0xbcae('0x2e')][_0xbcae('0x51')]({'where':{'id':_0x4a21bd['params']['id']},'attributes':['id',_0xbcae('0x99'),_0xbcae('0x9a'),_0xbcae('0x9b'),_0xbcae('0x9c'),_0xbcae('0x9d')]})[_0xbcae('0x27')](handleEntityNotFound(_0x5742ff,null))[_0xbcae('0x27')](function(_0x570a11){if(_0x570a11){_0x34c98d=_0x570a11[_0xbcae('0x9c')];var _0x543c56=_0x34c98d[_0xbcae('0x9e')](-0x1);if(_0x543c56==='/'){_0x34c98d=_0x34c98d[_0xbcae('0x9f')](0x0,_0x34c98d[_0xbcae('0xa0')](_0x543c56));}_0x2f711e=util[_0xbcae('0xa1')](_0xbcae('0xa2'),_0x34c98d);_0x3cbd9d=util[_0xbcae('0xa1')](_0xbcae('0xa3'),_0x34c98d);_0xd7a70d={'user':_0x570a11['username'],'pass':_0x570a11[_0xbcae('0x9a')]};var _0xe50372={'method':_0xbcae('0xa4'),'uri':_0x2f711e+'incident?sysparm_display_value=all','auth':_0xd7a70d,'json':!![]};return rp(_0xe50372);}})['then'](function(_0x29cb88){if(_0x29cb88[_0xbcae('0xa5')][_0xbcae('0x39')]>0x0){_0x310589=_0x29cb88[_0xbcae('0xa5')];}console[_0xbcae('0xa6')](_0xbcae('0xa7'),_0x310589);_0x194e20=[];_0x3acf01=Object['assign']([],_0x310589);_[_0xbcae('0xa8')](_0x3acf01,function(_0x494119){return!_0x2401c4[_0xbcae('0xa9')](_0x494119[_0xbcae('0x2a')]);});_0x3acf01['forEach'](function(_0x2b5019){var _0x6947fc=createFieldObject(_0x3cbd9d,_0xd7a70d,_0x2b5019[_0xbcae('0xaa')],_0x2b5019[_0xbcae('0x2a')],_0x2b5019[_0xbcae('0xab')],![]);_0x194e20[_0xbcae('0xac')](_0x6947fc);});return Promise[_0xbcae('0xad')](_0x194e20);})[_0xbcae('0x27')](function(_0x456df5){_0x596150=_0x456df5;_0x1a8b9f=Object[_0xbcae('0xae')]([],_0x310589);console['log'](_0xbcae('0xaf'),_0x310589);_['remove'](_0x1a8b9f,function(_0x1bd477){return _0x59f05b[_0xbcae('0xa9')](_0x1bd477[_0xbcae('0x2a')]);});console[_0xbcae('0xa6')](_0xbcae('0xb0'),_0x1a8b9f);_0x194e20=[];_0x1a8b9f[_0xbcae('0xb1')](function(_0x27118c){var _0x5ead5b=createFieldObject(_0x3cbd9d,_0xd7a70d,_0x27118c[_0xbcae('0xaa')],_0x27118c[_0xbcae('0x2a')],_0x27118c[_0xbcae('0xab')],!![]);_0x194e20['push'](_0x5ead5b);});return Promise['all'](_0x194e20);})['then'](function(_0x2e0cdd){_0xe12af=_0x2e0cdd;var _0x13c080=_0x596150[_0xbcae('0xb2')](_0xe12af);return{'count':_0x13c080[_0xbcae('0x39')],'rows':_0x13c080};})['then'](respondWithResult(_0x5742ff,null))[_0xbcae('0x47')](function(_0x4ed31f){console[_0xbcae('0xa6')](_0xbcae('0xb3')+_0x4ed31f);var _0x3e491b=_0x4a21bd[_0xbcae('0x34')][_0xbcae('0xb4')]?0x1f4:_0x4ed31f[_0xbcae('0xb5')]||0x1f4;logger['error'](_0x4ed31f[_0xbcae('0x29')]);delete _0x4ed31f[_0xbcae('0x2a')];if(_0x3e491b===0x191){_0x3e491b=0x190;}_0x5742ff[_0xbcae('0x1a')](_0x3e491b)[_0xbcae('0x2b')](_0x4a21bd[_0xbcae('0x34')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4ed31f['statusCode']}:_0x4ed31f);});};function createFieldObject(_0x853349,_0x5c0d7a,_0x1ee45c,_0x2bcb13,_0x148e96,_0x3b0256){return new Promise(function(_0x1b3263,_0x478f8b){var _0x227d1b={'id':_0x2bcb13,'name':_0x148e96,'custom':_0x3b0256};if(_0x1ee45c==='boolean'){_0x227d1b['options']=[{'name':_0xbcae('0xb6'),'value':_0xbcae('0xb7')},{'name':_0xbcae('0xb8'),'value':_0xbcae('0xb9')}];_0x1b3263(_0x227d1b);}else{var _0x54affc={'method':_0xbcae('0xa4'),'uri':_0x853349+_0xbcae('0xba')+_0x2bcb13,'auth':_0x5c0d7a,'json':!![]};return rp(_0x54affc)['then'](function(_0x5789b5){var _0x277df0=[];if(_0x5789b5[_0xbcae('0xa5')][_0xbcae('0x39')]>0x0){_0x5789b5[_0xbcae('0xa5')][_0xbcae('0xb1')](function(_0xac3ae1){if(_0xac3ae1[_0xbcae('0xbb')]===_0xbcae('0xb9')){var _0x300600={'name':_0xac3ae1[_0xbcae('0xab')],'value':_0xac3ae1[_0xbcae('0xbc')]};_0x277df0[_0xbcae('0xac')](_0x300600);}});}_0x227d1b[_0xbcae('0x4a')]=_0x277df0;if(_0x227d1b[_0xbcae('0x4a')][_0xbcae('0x39')]>0x0){_0x1b3263(_0x227d1b);}else{if(_0x3b0256==![]){_0x1b3263();}else{_0x1b3263(_0x227d1b);}}});}});} \ No newline at end of file +var _0x13b7=['TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','True','true','False','false','value','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','error','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','filter','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','getDescriptions','ServicenowField','Descriptions','subcategory','close_code','notify','incident_state','severity','category','parent','made_sla','caused_by','upon_reject','child_incidents','hold_reason','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','sys_created_by','knowledge','calendar_stc','cmdb_ci','work_notes_list','business_service','priority','sys_domain_path','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','business_stc','calendar_duration','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','username','password','email','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','internalType','label','push','all','TCL:\x20_object'];(function(_0x514607,_0x3e4924){var _0x5ec4b5=function(_0x27c518){while(--_0x27c518){_0x514607['push'](_0x514607['shift']());}};_0x5ec4b5(++_0x3e4924);}(_0x13b7,0x181));var _0x713b=function(_0x184042,_0x2163fa){_0x184042=_0x184042-0x0;var _0x22ef1a=_0x13b7[_0x184042];return _0x22ef1a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x713b('0x0'));var zipdir=require(_0x713b('0x1'));var jsonpatch=require(_0x713b('0x2'));var rp=require(_0x713b('0x3'));var moment=require(_0x713b('0x4'));var BPromise=require(_0x713b('0x5'));var Mustache=require(_0x713b('0x6'));var util=require('util');var path=require(_0x713b('0x7'));var sox=require(_0x713b('0x8'));var csv=require(_0x713b('0x9'));var ejs=require(_0x713b('0xa'));var fs=require('fs');var fs_extra=require(_0x713b('0xb'));var _=require(_0x713b('0xc'));var squel=require('squel');var crypto=require(_0x713b('0xd'));var jsforce=require(_0x713b('0xe'));var deskjs=require(_0x713b('0xf'));var toCsv=require(_0x713b('0x9'));var querystring=require('querystring');var Papa=require(_0x713b('0x10'));var Redis=require(_0x713b('0x11'));var authService=require(_0x713b('0x12'));var qs=require(_0x713b('0x13'));var as=require(_0x713b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x713b('0x15'));var utils=require(_0x713b('0x16'));var config=require(_0x713b('0x17'));var licenseUtil=require(_0x713b('0x18'));var db=require(_0x713b('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x339043,_0x32ee06){_0x32ee06=_0x32ee06||0xcc;return function(_0x5a24c6){if(_0x5a24c6){return _0x339043[_0x713b('0x1a')](_0x32ee06);}return _0x339043[_0x713b('0x1b')](_0x32ee06)[_0x713b('0x1c')]();};}function respondWithResult(_0x34b0a9,_0x699af0){_0x699af0=_0x699af0||0xc8;return function(_0x52c97a){if(_0x52c97a){return _0x34b0a9[_0x713b('0x1b')](_0x699af0)[_0x713b('0x1d')](_0x52c97a);}};}function respondWithFilteredResult(_0x3f42cd,_0x14495f){return function(_0xda52bc){if(_0xda52bc){var _0x13071c=typeof _0x14495f['offset']===_0x713b('0x1e')&&typeof _0x14495f[_0x713b('0x1f')]===_0x713b('0x1e');var _0x866707=_0xda52bc['count'];var _0x577131=_0x13071c?0x0:_0x14495f[_0x713b('0x20')];var _0x3a51c=_0x13071c?_0xda52bc[_0x713b('0x21')]:_0x14495f[_0x713b('0x20')]+_0x14495f[_0x713b('0x1f')];var _0x1795dd;if(_0x3a51c>=_0x866707){_0x3a51c=_0x866707;_0x1795dd=0xc8;}else{_0x1795dd=0xce;}_0x3f42cd[_0x713b('0x1b')](_0x1795dd);return _0x3f42cd[_0x713b('0x22')](_0x713b('0x23'),_0x577131+'-'+_0x3a51c+'/'+_0x866707)[_0x713b('0x1d')](_0xda52bc);}return null;};}function patchUpdates(_0x11a300){return function(_0x31d365){try{jsonpatch['apply'](_0x31d365,_0x11a300,!![]);}catch(_0x592b6c){return BPromise[_0x713b('0x24')](_0x592b6c);}return _0x31d365[_0x713b('0x25')]();};}function saveUpdates(_0x10f5e0,_0x5060fe){return function(_0x1e3748){if(_0x1e3748){return _0x1e3748[_0x713b('0x26')](_0x10f5e0)[_0x713b('0x27')](function(_0x104727){return _0x104727;});}return null;};}function removeEntity(_0x403805,_0x144d28){return function(_0x43ccc9){if(_0x43ccc9){return _0x43ccc9['destroy']()[_0x713b('0x27')](function(){_0x403805['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2be7c6,_0x529341){return function(_0xf9caca){if(!_0xf9caca){_0x2be7c6[_0x713b('0x1a')](0x194);}return _0xf9caca;};}function handleError(_0x3c1a02,_0x4b54a2){_0x4b54a2=_0x4b54a2||0x1f4;return function(_0x133e20){logger[_0x713b('0x28')](_0x133e20[_0x713b('0x29')]);if(_0x133e20[_0x713b('0x2a')]){delete _0x133e20[_0x713b('0x2a')];}_0x3c1a02[_0x713b('0x1b')](_0x4b54a2)[_0x713b('0x2b')](_0x133e20);};}exports['index']=function(_0x6812da,_0x375d6a){var _0x4adcd2={},_0x1e1b3={},_0x916137={'count':0x0,'rows':[]};var _0x3c0d77=_[_0x713b('0x2c')](db[_0x713b('0x2d')][_0x713b('0x2e')],function(_0x4eb3df){return{'name':_0x4eb3df[_0x713b('0x2f')],'type':_0x4eb3df['type'][_0x713b('0x30')]};});_0x1e1b3[_0x713b('0x31')]=_[_0x713b('0x2c')](_0x3c0d77,_0x713b('0x2a'));_0x1e1b3[_0x713b('0x32')]=_[_0x713b('0x33')](_0x6812da[_0x713b('0x32')]);_0x1e1b3[_0x713b('0x34')]=_[_0x713b('0x35')](_0x1e1b3['model'],_0x1e1b3[_0x713b('0x32')]);_0x4adcd2[_0x713b('0x36')]=_[_0x713b('0x35')](_0x1e1b3[_0x713b('0x31')],qs[_0x713b('0x37')](_0x6812da[_0x713b('0x32')][_0x713b('0x37')]));_0x4adcd2[_0x713b('0x36')]=_0x4adcd2[_0x713b('0x36')][_0x713b('0x38')]?_0x4adcd2[_0x713b('0x36')]:_0x1e1b3[_0x713b('0x31')];if(!_0x6812da[_0x713b('0x32')]['hasOwnProperty'](_0x713b('0x39'))){_0x4adcd2[_0x713b('0x1f')]=qs[_0x713b('0x1f')](_0x6812da[_0x713b('0x32')]['limit']);_0x4adcd2['offset']=qs[_0x713b('0x20')](_0x6812da[_0x713b('0x32')]['offset']);}_0x4adcd2[_0x713b('0x3a')]=qs[_0x713b('0x3b')](_0x6812da['query'][_0x713b('0x3b')]);_0x4adcd2[_0x713b('0x3c')]=qs['filters'](_[_0x713b('0x3d')](_0x6812da[_0x713b('0x32')],_0x1e1b3[_0x713b('0x34')]),_0x3c0d77);if(_0x6812da[_0x713b('0x32')]['filter']){_0x4adcd2[_0x713b('0x3c')]=_[_0x713b('0x3e')](_0x4adcd2['where'],{'$or':_[_0x713b('0x2c')](_0x3c0d77,function(_0x2471b7){if(_0x2471b7[_0x713b('0x3f')]!==_0x713b('0x40')){var _0x350518={};_0x350518[_0x2471b7['name']]={'$like':'%'+_0x6812da['query']['filter']+'%'};return _0x350518;}})});}_0x4adcd2=_[_0x713b('0x3e')]({},_0x4adcd2,_0x6812da[_0x713b('0x41')]);var _0xe1782d={'where':_0x4adcd2[_0x713b('0x3c')]};return db[_0x713b('0x2d')][_0x713b('0x21')](_0xe1782d)['then'](function(_0x51c357){_0x916137['count']=_0x51c357;if(_0x6812da[_0x713b('0x32')][_0x713b('0x42')]){_0x4adcd2[_0x713b('0x43')]=[{'all':!![]}];}return db[_0x713b('0x2d')]['findAll'](_0x4adcd2);})[_0x713b('0x27')](function(_0x347338){_0x916137[_0x713b('0x44')]=_0x347338;return _0x916137;})[_0x713b('0x27')](respondWithFilteredResult(_0x375d6a,_0x4adcd2))[_0x713b('0x45')](handleError(_0x375d6a,null));};exports[_0x713b('0x46')]=function(_0x5c4e77,_0x4d70c0){var _0x2e822c={'raw':![],'where':{'id':_0x5c4e77[_0x713b('0x47')]['id']}},_0x383773={};_0x383773[_0x713b('0x31')]=_[_0x713b('0x33')](db[_0x713b('0x2d')][_0x713b('0x2e')]);_0x383773[_0x713b('0x32')]=_['keys'](_0x5c4e77[_0x713b('0x32')]);_0x383773[_0x713b('0x34')]=_[_0x713b('0x35')](_0x383773['model'],_0x383773[_0x713b('0x32')]);_0x2e822c[_0x713b('0x36')]=_[_0x713b('0x35')](_0x383773[_0x713b('0x31')],qs[_0x713b('0x37')](_0x5c4e77[_0x713b('0x32')]['fields']));_0x2e822c[_0x713b('0x36')]=_0x2e822c[_0x713b('0x36')][_0x713b('0x38')]?_0x2e822c['attributes']:_0x383773[_0x713b('0x31')];if(_0x5c4e77[_0x713b('0x32')][_0x713b('0x42')]){_0x2e822c[_0x713b('0x43')]=[{'all':!![]}];}_0x2e822c=_['merge']({},_0x2e822c,_0x5c4e77[_0x713b('0x41')]);return db[_0x713b('0x2d')][_0x713b('0x48')](_0x2e822c)[_0x713b('0x27')](handleEntityNotFound(_0x4d70c0,null))[_0x713b('0x27')](respondWithResult(_0x4d70c0,null))[_0x713b('0x45')](handleError(_0x4d70c0,null));};exports['create']=function(_0x1ab902,_0x298633){return db[_0x713b('0x2d')][_0x713b('0x49')](_0x1ab902[_0x713b('0x4a')],{})[_0x713b('0x27')](respondWithResult(_0x298633,0xc9))[_0x713b('0x45')](handleError(_0x298633,null));};exports[_0x713b('0x26')]=function(_0x2be4bf,_0x465160){if(_0x2be4bf[_0x713b('0x4a')]['id']){delete _0x2be4bf[_0x713b('0x4a')]['id'];}return db[_0x713b('0x2d')][_0x713b('0x48')]({'where':{'id':_0x2be4bf[_0x713b('0x47')]['id']}})[_0x713b('0x27')](handleEntityNotFound(_0x465160,null))[_0x713b('0x27')](saveUpdates(_0x2be4bf[_0x713b('0x4a')],null))[_0x713b('0x27')](respondWithResult(_0x465160,null))[_0x713b('0x45')](handleError(_0x465160,null));};exports[_0x713b('0x4b')]=function(_0x2b9910,_0x6dbe07){return db['ServicenowAccount']['find']({'where':{'id':_0x2b9910['params']['id']}})[_0x713b('0x27')](handleEntityNotFound(_0x6dbe07,null))['then'](removeEntity(_0x6dbe07,null))[_0x713b('0x45')](handleError(_0x6dbe07,null));};exports[_0x713b('0x4c')]=function(_0x2932d2,_0x4874e9,_0x3c36ee){var _0x22fd11={};var _0x47b202={};var _0xb5a5eb;var _0x3acb46;return db[_0x713b('0x2d')][_0x713b('0x4d')]({'where':{'id':_0x2932d2[_0x713b('0x47')]['id']}})['then'](handleEntityNotFound(_0x4874e9,null))['then'](function(_0x411394){if(_0x411394){_0xb5a5eb=_0x411394;_0x47b202['model']=_[_0x713b('0x33')](db[_0x713b('0x4e')][_0x713b('0x2e')]);_0x47b202[_0x713b('0x32')]=_['keys'](_0x2932d2[_0x713b('0x32')]);_0x47b202[_0x713b('0x34')]=_[_0x713b('0x35')](_0x47b202[_0x713b('0x31')],_0x47b202[_0x713b('0x32')]);_0x22fd11[_0x713b('0x36')]=_[_0x713b('0x35')](_0x47b202['model'],qs[_0x713b('0x37')](_0x2932d2[_0x713b('0x32')][_0x713b('0x37')]));_0x22fd11['attributes']=_0x22fd11[_0x713b('0x36')][_0x713b('0x38')]?_0x22fd11['attributes']:_0x47b202[_0x713b('0x31')];_0x22fd11[_0x713b('0x3a')]=qs[_0x713b('0x3b')](_0x2932d2[_0x713b('0x32')][_0x713b('0x3b')]);_0x22fd11[_0x713b('0x3c')]=qs['filters'](_[_0x713b('0x3d')](_0x2932d2[_0x713b('0x32')],_0x47b202['filters']));if(_0x2932d2[_0x713b('0x32')][_0x713b('0x4f')]){_0x22fd11[_0x713b('0x3c')]=_['merge'](_0x22fd11[_0x713b('0x3c')],{'$or':_[_0x713b('0x2c')](_0x22fd11[_0x713b('0x36')],function(_0x15f0f9){var _0x8ef9a8={};_0x8ef9a8[_0x15f0f9]={'$like':'%'+_0x2932d2[_0x713b('0x32')][_0x713b('0x4f')]+'%'};return _0x8ef9a8;})});}_0x22fd11=_[_0x713b('0x3e')]({},_0x22fd11,_0x2932d2['options']);return _0xb5a5eb[_0x713b('0x4c')](_0x22fd11);}})['then'](function(_0x5b420f){if(_0x5b420f){_0x3acb46=_0x5b420f['length'];if(!_0x2932d2[_0x713b('0x32')][_0x713b('0x50')]('nolimit')){_0x22fd11['limit']=qs[_0x713b('0x1f')](_0x2932d2[_0x713b('0x32')][_0x713b('0x1f')]);_0x22fd11[_0x713b('0x20')]=qs[_0x713b('0x20')](_0x2932d2[_0x713b('0x32')][_0x713b('0x20')]);}return _0xb5a5eb[_0x713b('0x4c')](_0x22fd11);}})['then'](function(_0x250ef6){if(_0x250ef6){return _0x250ef6?{'count':_0x3acb46,'rows':_0x250ef6}:null;}})[_0x713b('0x27')](respondWithResult(_0x4874e9,null))['catch'](handleError(_0x4874e9,null));};exports[_0x713b('0x51')]=function(_0x3c4ffc,_0x2e6d4a,_0x572af3){if(_0x3c4ffc['body']['id']){delete _0x3c4ffc[_0x713b('0x4a')]['id'];}return db[_0x713b('0x2d')]['findOne']({'where':{'id':_0x3c4ffc[_0x713b('0x47')]['id']}})['then'](handleEntityNotFound(_0x2e6d4a,null))[_0x713b('0x27')](function(_0x44b626){if(_0x44b626){_0x3c4ffc[_0x713b('0x4a')][_0x713b('0x52')]=_0x44b626['id'];_0x3c4ffc[_0x713b('0x4a')][_0x713b('0x53')]=integrations['getSubjects'](_0x3c4ffc['body'][_0x713b('0x54')],_0x3c4ffc[_0x713b('0x4a')]['type']);_0x3c4ffc[_0x713b('0x4a')]['Descriptions']=integrations[_0x713b('0x55')](_0x3c4ffc['body'][_0x713b('0x54')],_0x3c4ffc[_0x713b('0x4a')][_0x713b('0x3f')]);return db['ServicenowConfiguration']['create'](_0x3c4ffc[_0x713b('0x4a')],{'include':[{'model':db[_0x713b('0x56')],'as':_0x713b('0x53')},{'model':db['ServicenowField'],'as':_0x713b('0x57')}]});}return null;})[_0x713b('0x27')](respondWithResult(_0x2e6d4a,null))['catch'](handleError(_0x2e6d4a,null));};exports['getFields']=function(_0xf7b709,_0x14779f,_0xd63e20){var _0x55d2fc=['made_sla','hold_reason','knowledge',_0x713b('0x58'),_0x713b('0x59'),_0x713b('0x5a'),_0x713b('0x5b'),_0x713b('0x5c'),_0x713b('0x5d')];var _0x42708e=[_0x713b('0x5e'),_0x713b('0x5f'),_0x713b('0x60'),'watch_list',_0x713b('0x61'),'sys_updated_on',_0x713b('0x62'),_0x713b('0x63'),_0x713b('0x64'),_0x713b('0x65'),_0x713b('0x66'),_0x713b('0x67'),_0x713b('0x68'),'user_input',_0x713b('0x69'),_0x713b('0x6a'),'state',_0x713b('0x6b'),_0x713b('0x6c'),_0x713b('0x3a'),_0x713b('0x6d'),'closed_at',_0x713b('0x6e'),'delivery_plan','impact','active',_0x713b('0x6f'),_0x713b('0x70'),_0x713b('0x71'),_0x713b('0x72'),'rfc',_0x713b('0x73'),'expected_start',_0x713b('0x74'),_0x713b('0x75'),_0x713b('0x76'),_0x713b('0x77'),_0x713b('0x78'),_0x713b('0x79'),_0x713b('0x7a'),_0x713b('0x7b'),_0x713b('0x58'),_0x713b('0x7c'),_0x713b('0x7d'),_0x713b('0x59'),_0x713b('0x7e'),_0x713b('0x7f'),'work_start','assignment_group',_0x713b('0x80'),'additional_assignee_list','description',_0x713b('0x81'),_0x713b('0x5a'),'sys_class_name','close_notes',_0x713b('0x82'),_0x713b('0x83'),_0x713b('0x84'),_0x713b('0x85'),'contact_type',_0x713b('0x86'),_0x713b('0x5b'),_0x713b('0x87'),_0x713b('0x88'),_0x713b('0x89'),_0x713b('0x8a'),_0x713b('0x8b'),_0x713b('0x8c'),_0x713b('0x5c'),'comments','sla_due',_0x713b('0x8d'),_0x713b('0x8e'),_0x713b('0x8f'),_0x713b('0x90'),_0x713b('0x91'),_0x713b('0x92'),_0x713b('0x93'),_0x713b('0x94'),_0x713b('0x95'),'location','category'];var _0x33e987='';var _0x14a2b8='';var _0x35bf96=[];var _0x23e8ac='';var _0x213f31='';var _0x1f5899=[];var _0x51e90a='';var _0x3c2622='';var _0x169698={};var _0x4ba141='';return db[_0x713b('0x2d')][_0x713b('0x4d')]({'where':{'id':_0xf7b709[_0x713b('0x47')]['id']},'attributes':['id',_0x713b('0x96'),_0x713b('0x97'),_0x713b('0x98'),'remoteUri',_0x713b('0x99')]})['then'](handleEntityNotFound(_0x14779f,null))[_0x713b('0x27')](function(_0x4d0e2e){if(_0x4d0e2e){_0x4ba141=_0x4d0e2e['remoteUri'];var _0x5edbb4=_0x4ba141[_0x713b('0x9a')](-0x1);if(_0x5edbb4==='/'){_0x4ba141=_0x4ba141[_0x713b('0x9b')](0x0,_0x4ba141[_0x713b('0x9c')](_0x5edbb4));}_0x3c2622=util[_0x713b('0x9d')](_0x713b('0x9e'),_0x4ba141);_0x51e90a=util['format'](_0x713b('0x9f'),_0x4ba141);_0x169698={'user':_0x4d0e2e[_0x713b('0x96')],'pass':_0x4d0e2e[_0x713b('0x97')]};var _0x24397e={'method':_0x713b('0xa0'),'uri':_0x3c2622+_0x713b('0xa1'),'auth':_0x169698,'json':!![]};return rp(_0x24397e);}})[_0x713b('0x27')](function(_0x1f4968){if(_0x1f4968[_0x713b('0xa2')][_0x713b('0x38')]>0x0){_0x33e987=_0x1f4968[_0x713b('0xa2')];}console[_0x713b('0xa3')](_0x713b('0xa4'),_0x33e987);_0x1f5899=[];_0x14a2b8=Object[_0x713b('0xa5')]([],_0x33e987);_[_0x713b('0xa6')](_0x14a2b8,function(_0x3bfa26){return!_0x55d2fc[_0x713b('0xa7')](_0x3bfa26[_0x713b('0x2a')]);});_0x14a2b8['forEach'](function(_0x2edbe3){var _0x5e9318=createFieldObject(_0x51e90a,_0x169698,_0x2edbe3[_0x713b('0xa8')],_0x2edbe3[_0x713b('0x2a')],_0x2edbe3[_0x713b('0xa9')],![]);_0x1f5899[_0x713b('0xaa')](_0x5e9318);});return Promise[_0x713b('0xab')](_0x1f5899);})[_0x713b('0x27')](function(_0x24e551){_0x35bf96=_0x24e551;_0x23e8ac=Object['assign']([],_0x33e987);console['log'](_0x713b('0xac'),_0x33e987);_[_0x713b('0xa6')](_0x23e8ac,function(_0x5a9597){return _0x42708e[_0x713b('0xa7')](_0x5a9597['name']);});console[_0x713b('0xa3')](_0x713b('0xad'),_0x23e8ac);_0x1f5899=[];_0x23e8ac[_0x713b('0xae')](function(_0x4735c5){var _0x5ae63a=createFieldObject(_0x51e90a,_0x169698,_0x4735c5['internalType'],_0x4735c5['name'],_0x4735c5[_0x713b('0xa9')],!![]);_0x1f5899[_0x713b('0xaa')](_0x5ae63a);});return Promise[_0x713b('0xab')](_0x1f5899);})['then'](function(_0x5116f4){_0x213f31=_0x5116f4;var _0x56f965=_0x35bf96[_0x713b('0xaf')](_0x213f31);return{'count':_0x56f965[_0x713b('0x38')],'rows':_0x56f965};})[_0x713b('0x27')](respondWithResult(_0x14779f,null))['catch'](function(_0x3ee659){console['log'](_0x713b('0xb0')+_0x3ee659);var _0x43cdbf=_0xf7b709[_0x713b('0x32')][_0x713b('0xb1')]?0x1f4:_0x3ee659['statusCode']||0x1f4;logger[_0x713b('0x28')](_0x3ee659[_0x713b('0x29')]);delete _0x3ee659[_0x713b('0x2a')];if(_0x43cdbf===0x191){_0x43cdbf=0x190;}_0x14779f[_0x713b('0x1b')](_0x43cdbf)[_0x713b('0x2b')](_0xf7b709[_0x713b('0x32')][_0x713b('0xb1')]?{'message':_0x713b('0xb2'),'statusCode':_0x3ee659[_0x713b('0xb3')]}:_0x3ee659);});};function createFieldObject(_0x15a7a5,_0x6db2ac,_0x4021ee,_0x406d8d,_0x568b27,_0x5890de){return new Promise(function(_0x302b09,_0x573665){var _0x4cf22b={'id':_0x406d8d,'name':_0x568b27,'custom':_0x5890de};if(_0x4021ee===_0x713b('0xb4')){_0x4cf22b['options']=[{'name':_0x713b('0xb5'),'value':_0x713b('0xb6')},{'name':_0x713b('0xb7'),'value':'false'}];_0x302b09(_0x4cf22b);}else{var _0x52ec51={'method':_0x713b('0xa0'),'uri':_0x15a7a5+'sys_choice?sysparm_query=name=incident^element='+_0x406d8d,'auth':_0x6db2ac,'json':!![]};return rp(_0x52ec51)[_0x713b('0x27')](function(_0x15b8a4){var _0x4fd2a6=[];if(_0x15b8a4[_0x713b('0xa2')]['length']>0x0){_0x15b8a4[_0x713b('0xa2')][_0x713b('0xae')](function(_0x53a2dd){if(_0x53a2dd['inactive']===_0x713b('0xb8')){var _0x1f530d={'name':_0x53a2dd[_0x713b('0xa9')],'value':_0x53a2dd[_0x713b('0xb9')]};_0x4fd2a6[_0x713b('0xaa')](_0x1f530d);}});}_0x4cf22b[_0x713b('0x41')]=_0x4fd2a6;if(_0x4cf22b['options'][_0x713b('0x38')]>0x0){_0x302b09(_0x4cf22b);}else{if(_0x5890de==![]){_0x302b09();}else{_0x302b09(_0x4cf22b);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 8b8b5b1..56789e1 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 _0xe2fe=['define','int_servicenow_accounts','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x5ac186,_0x11fe19){var _0x42afc1=function(_0x4f6c2c){while(--_0x4f6c2c){_0x5ac186['push'](_0x5ac186['shift']());}};_0x42afc1(++_0x11fe19);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xee2f('0x7'));module[_0xee2f('0x8')]=function(_0x49926b,_0x1533a0){return _0x49926b[_0xee2f('0x9')]('ServicenowAccount',attributes,{'tableName':_0xee2f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger'];(function(_0x41fd9d,_0x7c1122){var _0x3f7123=function(_0xd5d888){while(--_0xd5d888){_0x41fd9d['push'](_0x41fd9d['shift']());}};_0x3f7123(++_0x7c1122);}(_0x7217,0x19e));var _0x7721=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x7217[_0x4fc9e6];return _0x551d28;};'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'));var integrations=require(_0x7721('0x8'));module[_0x7721('0x9')]=function(_0xb239e0,_0xf7ff37){return _0xb239e0[_0x7721('0xa')](_0x7721('0xb'),attributes,{'tableName':_0x7721('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 50f1f64..253ba20 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 _0xf025=['where','ShowServicenowAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','GetServicenowAccount','ServicenowAccount','options','raw','limit','map','include','model','attributes'];(function(_0x1ecaba,_0x1f3eec){var _0x134ca1=function(_0x1c99d0){while(--_0x1c99d0){_0x1ecaba['push'](_0x1ecaba['shift']());}};_0x134ca1(++_0x1f3eec);}(_0xf025,0xce));var _0x5f02=function(_0x57da0a,_0x284aed){_0x57da0a=_0x57da0a-0x0;var _0x3145d5=_0xf025[_0x57da0a];return _0x3145d5;};'use strict';var _=require(_0x5f02('0x0'));var util=require(_0x5f02('0x1'));var moment=require(_0x5f02('0x2'));var BPromise=require('bluebird');var rs=require(_0x5f02('0x3'));var fs=require('fs');var Redis=require(_0x5f02('0x4'));var db=require(_0x5f02('0x5'))['db'];var utils=require(_0x5f02('0x6'));var logger=require(_0x5f02('0x7'))('rpc');var config=require(_0x5f02('0x8'));var jayson=require(_0x5f02('0x9'));var client=jayson[_0x5f02('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf9122,_0x3e906d,_0x2fb8e8){return new BPromise(function(_0x4af1e8,_0x54c630){return client[_0x5f02('0xb')](_0xf9122,_0x2fb8e8)[_0x5f02('0xc')](function(_0x7d7cf7){logger[_0x5f02('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x3e906d,_0x5f02('0xe'));logger[_0x5f02('0xf')](_0x5f02('0x10'),_0x3e906d,_0x5f02('0xe'),JSON[_0x5f02('0x11')](_0x7d7cf7));if(_0x7d7cf7[_0x5f02('0x12')]){if(_0x7d7cf7[_0x5f02('0x12')][_0x5f02('0x13')]===0x1f4){logger[_0x5f02('0x12')](_0x5f02('0x14'),_0x3e906d,_0x7d7cf7[_0x5f02('0x12')][_0x5f02('0x15')]);return _0x54c630(_0x7d7cf7[_0x5f02('0x12')]['message']);}logger[_0x5f02('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x3e906d,_0x7d7cf7[_0x5f02('0x12')][_0x5f02('0x15')]);return _0x4af1e8(_0x7d7cf7[_0x5f02('0x12')]['message']);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x3e906d,_0x5f02('0xe'));_0x4af1e8(_0x7d7cf7[_0x5f02('0x16')][_0x5f02('0x15')]);}})['catch'](function(_0x549e3b){logger[_0x5f02('0x12')](_0x5f02('0x14'),_0x3e906d,_0x549e3b);_0x54c630(_0x549e3b);});});}exports[_0x5f02('0x17')]=function(_0x141475){var _0x5c04f5=this;return new Promise(function(_0x3e0dad,_0x1da645){return db[_0x5f02('0x18')]['findAll']({'raw':_0x141475[_0x5f02('0x19')]?_0x141475[_0x5f02('0x19')][_0x5f02('0x1a')]===undefined?!![]:![]:!![],'where':_0x141475[_0x5f02('0x19')]?_0x141475[_0x5f02('0x19')]['where']||null:null,'attributes':_0x141475['options']?_0x141475[_0x5f02('0x19')]['attributes']||null:null,'limit':_0x141475[_0x5f02('0x19')]?_0x141475['options'][_0x5f02('0x1b')]||null:null,'include':_0x141475['options']?_0x141475[_0x5f02('0x19')]['include']?_[_0x5f02('0x1c')](_0x141475[_0x5f02('0x19')][_0x5f02('0x1d')],function(_0x29a473){return{'model':db[_0x29a473[_0x5f02('0x1e')]],'as':_0x29a473['as'],'attributes':_0x29a473[_0x5f02('0x1f')],'include':_0x29a473['include']?_[_0x5f02('0x1c')](_0x29a473['include'],function(_0xb70fd){return{'model':db[_0xb70fd[_0x5f02('0x1e')]],'as':_0xb70fd['as'],'attributes':_0xb70fd[_0x5f02('0x1f')],'include':_0xb70fd[_0x5f02('0x1d')]?_[_0x5f02('0x1c')](_0xb70fd[_0x5f02('0x1d')],function(_0xd5aa07){return{'model':db[_0xd5aa07[_0x5f02('0x1e')]],'as':_0xd5aa07['as'],'attributes':_0xd5aa07[_0x5f02('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5f02('0xc')](function(_0xc8893){logger[_0x5f02('0xd')](_0x5f02('0x17'),_0x141475);logger[_0x5f02('0xf')]('GetServicenowAccount',_0x141475,JSON['stringify'](_0xc8893));_0x3e0dad(_0xc8893);})['catch'](function(_0x21d1e6){logger['error'](_0x5f02('0x17'),_0x21d1e6[_0x5f02('0x15')],_0x141475);_0x1da645(_0x5c04f5[_0x5f02('0x12')](0x1f4,_0x21d1e6[_0x5f02('0x15')]));});});};exports['ShowServicenowAccount']=function(_0x58041c){var _0x4bc523=this;return new Promise(function(_0x3a4b55,_0x38c65f){return db[_0x5f02('0x18')]['find']({'raw':_0x58041c[_0x5f02('0x19')]?_0x58041c[_0x5f02('0x19')][_0x5f02('0x1a')]===undefined?!![]:![]:!![],'where':_0x58041c[_0x5f02('0x19')]?_0x58041c[_0x5f02('0x19')][_0x5f02('0x20')]||null:null,'attributes':_0x58041c[_0x5f02('0x19')]?_0x58041c[_0x5f02('0x19')][_0x5f02('0x1f')]||null:null,'include':_0x58041c[_0x5f02('0x19')]?_0x58041c[_0x5f02('0x19')][_0x5f02('0x1d')]?_['map'](_0x58041c['options']['include'],function(_0x26cec9){return{'model':db[_0x26cec9[_0x5f02('0x1e')]],'as':_0x26cec9['as'],'attributes':_0x26cec9[_0x5f02('0x1f')],'include':_0x26cec9['include']?_[_0x5f02('0x1c')](_0x26cec9[_0x5f02('0x1d')],function(_0x2d4ed8){return{'model':db[_0x2d4ed8['model']],'as':_0x2d4ed8['as'],'attributes':_0x2d4ed8[_0x5f02('0x1f')],'include':_0x2d4ed8[_0x5f02('0x1d')]?_[_0x5f02('0x1c')](_0x2d4ed8['include'],function(_0x28f651){return{'model':db[_0x28f651[_0x5f02('0x1e')]],'as':_0x28f651['as'],'attributes':_0x28f651[_0x5f02('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4023ec){logger['info'](_0x5f02('0x21'),_0x58041c);logger[_0x5f02('0xf')](_0x5f02('0x21'),_0x58041c,JSON[_0x5f02('0x11')](_0x4023ec));_0x3a4b55(_0x4023ec);})['catch'](function(_0xf939d9){logger[_0x5f02('0x12')](_0x5f02('0x21'),_0xf939d9[_0x5f02('0x15')],_0x58041c);_0x38c65f(_0x4bc523[_0x5f02('0x12')](0x1f4,_0xf939d9[_0x5f02('0x15')]));});});}; \ No newline at end of file +var _0x3ad9=['error','message','info','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','include','map','model','debug','ShowServicenowAccount','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x1c3a30,_0x330a20){var _0x385263=function(_0x27e02c){while(--_0x27e02c){_0x1c3a30['push'](_0x1c3a30['shift']());}};_0x385263(++_0x330a20);}(_0x3ad9,0x142));var _0x93ad=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x3ad9[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require('lodash');var util=require(_0x93ad('0x0'));var moment=require(_0x93ad('0x1'));var BPromise=require('bluebird');var rs=require(_0x93ad('0x2'));var fs=require('fs');var Redis=require(_0x93ad('0x3'));var db=require(_0x93ad('0x4'))['db'];var utils=require(_0x93ad('0x5'));var logger=require(_0x93ad('0x6'))(_0x93ad('0x7'));var config=require('../../config/environment');var jayson=require(_0x93ad('0x8'));var client=jayson[_0x93ad('0x9')][_0x93ad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31d933,_0x1055d8,_0x5b8b11){return new BPromise(function(_0x421ac8,_0x5447af){return client[_0x93ad('0xb')](_0x31d933,_0x5b8b11)[_0x93ad('0xc')](function(_0x5744f6){logger['info'](_0x93ad('0xd'),_0x1055d8,_0x93ad('0xe'));logger['debug'](_0x93ad('0xf'),_0x1055d8,'request\x20sent',JSON[_0x93ad('0x10')](_0x5744f6));if(_0x5744f6['error']){if(_0x5744f6['error'][_0x93ad('0x11')]===0x1f4){logger['error'](_0x93ad('0xd'),_0x1055d8,_0x5744f6[_0x93ad('0x12')][_0x93ad('0x13')]);return _0x5447af(_0x5744f6[_0x93ad('0x12')][_0x93ad('0x13')]);}logger[_0x93ad('0x12')](_0x93ad('0xd'),_0x1055d8,_0x5744f6[_0x93ad('0x12')][_0x93ad('0x13')]);return _0x421ac8(_0x5744f6[_0x93ad('0x12')][_0x93ad('0x13')]);}else{logger[_0x93ad('0x14')](_0x93ad('0xd'),_0x1055d8,_0x93ad('0xe'));_0x421ac8(_0x5744f6[_0x93ad('0x15')][_0x93ad('0x13')]);}})[_0x93ad('0x16')](function(_0x2c3c42){logger[_0x93ad('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x1055d8,_0x2c3c42);_0x5447af(_0x2c3c42);});});}exports[_0x93ad('0x17')]=function(_0x39bd0c){var _0x35bf83=this;return new Promise(function(_0x275630,_0x3c2033){return db[_0x93ad('0x18')][_0x93ad('0x19')]({'raw':_0x39bd0c[_0x93ad('0x1a')]?_0x39bd0c[_0x93ad('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x39bd0c[_0x93ad('0x1a')]?_0x39bd0c[_0x93ad('0x1a')][_0x93ad('0x1b')]||null:null,'attributes':_0x39bd0c[_0x93ad('0x1a')]?_0x39bd0c[_0x93ad('0x1a')][_0x93ad('0x1c')]||null:null,'limit':_0x39bd0c[_0x93ad('0x1a')]?_0x39bd0c[_0x93ad('0x1a')]['limit']||null:null,'include':_0x39bd0c[_0x93ad('0x1a')]?_0x39bd0c[_0x93ad('0x1a')][_0x93ad('0x1d')]?_[_0x93ad('0x1e')](_0x39bd0c[_0x93ad('0x1a')]['include'],function(_0x4793c0){return{'model':db[_0x4793c0[_0x93ad('0x1f')]],'as':_0x4793c0['as'],'attributes':_0x4793c0['attributes'],'include':_0x4793c0[_0x93ad('0x1d')]?_[_0x93ad('0x1e')](_0x4793c0['include'],function(_0x295a1e){return{'model':db[_0x295a1e[_0x93ad('0x1f')]],'as':_0x295a1e['as'],'attributes':_0x295a1e[_0x93ad('0x1c')],'include':_0x295a1e[_0x93ad('0x1d')]?_[_0x93ad('0x1e')](_0x295a1e['include'],function(_0x9f369d){return{'model':db[_0x9f369d[_0x93ad('0x1f')]],'as':_0x9f369d['as'],'attributes':_0x9f369d[_0x93ad('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4dff07){logger[_0x93ad('0x14')](_0x93ad('0x17'),_0x39bd0c);logger[_0x93ad('0x20')](_0x93ad('0x17'),_0x39bd0c,JSON[_0x93ad('0x10')](_0x4dff07));_0x275630(_0x4dff07);})[_0x93ad('0x16')](function(_0x26f9c9){logger[_0x93ad('0x12')](_0x93ad('0x17'),_0x26f9c9[_0x93ad('0x13')],_0x39bd0c);_0x3c2033(_0x35bf83[_0x93ad('0x12')](0x1f4,_0x26f9c9[_0x93ad('0x13')]));});});};exports[_0x93ad('0x21')]=function(_0x52c695){var _0x1e7675=this;return new Promise(function(_0x5e0c55,_0x349a35){return db[_0x93ad('0x18')]['find']({'raw':_0x52c695[_0x93ad('0x1a')]?_0x52c695[_0x93ad('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x52c695[_0x93ad('0x1a')]?_0x52c695[_0x93ad('0x1a')]['where']||null:null,'attributes':_0x52c695[_0x93ad('0x1a')]?_0x52c695[_0x93ad('0x1a')][_0x93ad('0x1c')]||null:null,'include':_0x52c695[_0x93ad('0x1a')]?_0x52c695['options'][_0x93ad('0x1d')]?_[_0x93ad('0x1e')](_0x52c695[_0x93ad('0x1a')][_0x93ad('0x1d')],function(_0x3bc8bc){return{'model':db[_0x3bc8bc[_0x93ad('0x1f')]],'as':_0x3bc8bc['as'],'attributes':_0x3bc8bc[_0x93ad('0x1c')],'include':_0x3bc8bc[_0x93ad('0x1d')]?_[_0x93ad('0x1e')](_0x3bc8bc[_0x93ad('0x1d')],function(_0x5738c6){return{'model':db[_0x5738c6[_0x93ad('0x1f')]],'as':_0x5738c6['as'],'attributes':_0x5738c6[_0x93ad('0x1c')],'include':_0x5738c6[_0x93ad('0x1d')]?_[_0x93ad('0x1e')](_0x5738c6[_0x93ad('0x1d')],function(_0x234bd5){return{'model':db[_0x234bd5[_0x93ad('0x1f')]],'as':_0x234bd5['as'],'attributes':_0x234bd5['attributes']};}):[]};}):[]};}):[]:[]})[_0x93ad('0xc')](function(_0x313e5f){logger[_0x93ad('0x14')](_0x93ad('0x21'),_0x52c695);logger['debug'](_0x93ad('0x21'),_0x52c695,JSON['stringify'](_0x313e5f));_0x5e0c55(_0x313e5f);})[_0x93ad('0x16')](function(_0x13b738){logger[_0x93ad('0x12')]('ShowServicenowAccount',_0x13b738['message'],_0x52c695);_0x349a35(_0x1e7675[_0x93ad('0x12')](0x1f4,_0x13b738['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 580a584..f5ae8b2 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 _0xbea2=['../../components/interaction/service','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xd7a401,_0x292d95){var _0x3acf2e=function(_0xceab2a){while(--_0xceab2a){_0xd7a401['push'](_0xd7a401['shift']());}};_0x3acf2e(++_0x292d95);}(_0xbea2,0x1da));var _0x2bea=function(_0x51568e,_0x111a42){_0x51568e=_0x51568e-0x0;var _0x126b86=_0xbea2[_0x51568e];return _0x126b86;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2bea('0x0'));var timeout=require(_0x2bea('0x1'));var express=require(_0x2bea('0x2'));var router=express[_0x2bea('0x3')]();var fs_extra=require(_0x2bea('0x4'));var auth=require(_0x2bea('0x5'));var interaction=require(_0x2bea('0x6'));var config=require('../../config/environment');var controller=require(_0x2bea('0x7'));router[_0x2bea('0x8')]('/',auth['isAuthenticated'](),controller[_0x2bea('0x9')]);router[_0x2bea('0x8')](_0x2bea('0xa'),auth[_0x2bea('0xb')](),controller[_0x2bea('0xc')]);router[_0x2bea('0x8')](_0x2bea('0xd'),auth[_0x2bea('0xb')](),controller[_0x2bea('0xe')]);router[_0x2bea('0x8')](_0x2bea('0xf'),auth['isAuthenticated'](),controller[_0x2bea('0x10')]);router[_0x2bea('0x8')](_0x2bea('0x11'),auth[_0x2bea('0xb')](),controller[_0x2bea('0x12')]);router[_0x2bea('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2bea('0x14')]('/:id',auth[_0x2bea('0xb')](),controller[_0x2bea('0x15')]);router[_0x2bea('0x16')](_0x2bea('0xa'),auth[_0x2bea('0xb')](),controller[_0x2bea('0x17')]);module['exports']=router; \ No newline at end of file +var _0x0af4=['/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0af4,0x66));var _0x40af=function(_0x852985,_0x118075){_0x852985=_0x852985-0x0;var _0x4f1d74=_0x0af4[_0x852985];return _0x4f1d74;};'use strict';var multer=require('multer');var util=require(_0x40af('0x0'));var path=require('path');var timeout=require(_0x40af('0x1'));var express=require(_0x40af('0x2'));var router=express[_0x40af('0x3')]();var fs_extra=require(_0x40af('0x4'));var auth=require(_0x40af('0x5'));var interaction=require(_0x40af('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router[_0x40af('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x40af('0x7')](_0x40af('0x8'),auth[_0x40af('0x9')](),controller[_0x40af('0xa')]);router[_0x40af('0x7')](_0x40af('0xb'),auth[_0x40af('0x9')](),controller[_0x40af('0xc')]);router[_0x40af('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x40af('0xd')]);router[_0x40af('0x7')](_0x40af('0xe'),auth[_0x40af('0x9')](),controller[_0x40af('0xf')]);router[_0x40af('0x10')]('/',auth[_0x40af('0x9')](),controller[_0x40af('0x11')]);router['put']('/:id',auth[_0x40af('0x9')](),controller[_0x40af('0x12')]);router[_0x40af('0x13')](_0x40af('0x8'),auth['isAuthenticated'](),controller[_0x40af('0x14')]);module[_0x40af('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 7f52444..3329c6f 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 _0x3528=['exports','STRING','sequelize'];(function(_0x5231bf,_0x9e19a3){var _0x250914=function(_0x49a6e1){while(--_0x49a6e1){_0x5231bf['push'](_0x5231bf['shift']());}};_0x250914(++_0x9e19a3);}(_0x3528,0x131));var _0x8352=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3528[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x8352('0x0'));module[_0x8352('0x1')]={'name':{'type':Sequelize[_0x8352('0x2')]},'description':{'type':Sequelize[_0x8352('0x2')]}}; \ No newline at end of file +var _0x98f4=['sequelize','exports','STRING'];(function(_0x507d62,_0x1f83cb){var _0xed22f2=function(_0x183714){while(--_0x183714){_0x507d62['push'](_0x507d62['shift']());}};_0xed22f2(++_0x1f83cb);}(_0x98f4,0x1d7));var _0x498f=function(_0x119e7a,_0x3949d3){_0x119e7a=_0x119e7a-0x0;var _0x1fb90a=_0x98f4[_0x119e7a];return _0x1fb90a;};'use strict';var Sequelize=require(_0x498f('0x0'));module[_0x498f('0x1')]={'name':{'type':Sequelize[_0x498f('0x2')]},'description':{'type':Sequelize[_0x498f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 64c2366..0989b46 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 _0x504d=['sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','catch','show','options','create','body','update','find','params','destroy','getFields','findOne','ServicenowField','getSubjects','nolimit','getDescriptions','eml-format','zip-dir','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','then','end','name','index','map','ServicenowConfiguration','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x24e51a,_0x2db38f){var _0x4eb61a=function(_0x598b54){while(--_0x598b54){_0x24e51a['push'](_0x24e51a['shift']());}};_0x4eb61a(++_0x2db38f);}(_0x504d,0x1bc));var _0xd504=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x504d[_0x243b2f];return _0xcb3c2d;};'use strict';var emlformat=require(_0xd504('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd504('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd504('0x2'));var BPromise=require(_0xd504('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd504('0x4'));var sox=require(_0xd504('0x5'));var csv=require(_0xd504('0x6'));var ejs=require(_0xd504('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd504('0x8'));var squel=require(_0xd504('0x9'));var crypto=require(_0xd504('0xa'));var jsforce=require(_0xd504('0xb'));var deskjs=require(_0xd504('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd504('0xd'));var Redis=require('ioredis');var authService=require(_0xd504('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd504('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd504('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xd504('0x11'));var licenseUtil=require(_0xd504('0x12'));var db=require(_0xd504('0x13'))['db'];function respondWithStatusCode(_0x161a63,_0x3356f8){_0x3356f8=_0x3356f8||0xcc;return function(_0x5ba289){if(_0x5ba289){return _0x161a63[_0xd504('0x14')](_0x3356f8);}return _0x161a63[_0xd504('0x15')](_0x3356f8)['end']();};}function respondWithResult(_0x34ca07,_0x539aeb){_0x539aeb=_0x539aeb||0xc8;return function(_0x15064c){if(_0x15064c){return _0x34ca07[_0xd504('0x15')](_0x539aeb)[_0xd504('0x16')](_0x15064c);}};}function respondWithFilteredResult(_0x46d748,_0x4178e1){return function(_0x1b49ae){if(_0x1b49ae){var _0x554836=typeof _0x4178e1['offset']===_0xd504('0x17')&&typeof _0x4178e1[_0xd504('0x18')]==='undefined';var _0x2b341b=_0x1b49ae[_0xd504('0x19')];var _0x2839f8=_0x554836?0x0:_0x4178e1[_0xd504('0x1a')];var _0x3f6cae=_0x554836?_0x1b49ae[_0xd504('0x19')]:_0x4178e1[_0xd504('0x1a')]+_0x4178e1[_0xd504('0x18')];var _0x128239;if(_0x3f6cae>=_0x2b341b){_0x3f6cae=_0x2b341b;_0x128239=0xc8;}else{_0x128239=0xce;}_0x46d748[_0xd504('0x15')](_0x128239);return _0x46d748['set'](_0xd504('0x1b'),_0x2839f8+'-'+_0x3f6cae+'/'+_0x2b341b)[_0xd504('0x16')](_0x1b49ae);}return null;};}function patchUpdates(_0x407e7f){return function(_0x412de8){try{jsonpatch[_0xd504('0x1c')](_0x412de8,_0x407e7f,!![]);}catch(_0x1a5674){return BPromise[_0xd504('0x1d')](_0x1a5674);}return _0x412de8['save']();};}function saveUpdates(_0x15bebf,_0x3c6303){return function(_0x2f90ac){if(_0x2f90ac){return _0x2f90ac['update'](_0x15bebf)[_0xd504('0x1e')](function(_0x5393a1){return _0x5393a1;});}return null;};}function removeEntity(_0x306b67,_0x28f10e){return function(_0x31b830){if(_0x31b830){return _0x31b830['destroy']()[_0xd504('0x1e')](function(){_0x306b67[_0xd504('0x15')](0xcc)[_0xd504('0x1f')]();});}};}function handleEntityNotFound(_0xc8e7cc,_0x3d6ffa){return function(_0x587d89){if(!_0x587d89){_0xc8e7cc[_0xd504('0x14')](0x194);}return _0x587d89;};}function handleError(_0x5d09b6,_0x3dab4e){_0x3dab4e=_0x3dab4e||0x1f4;return function(_0x421a12){logger['error'](_0x421a12['stack']);if(_0x421a12[_0xd504('0x20')]){delete _0x421a12['name'];}_0x5d09b6[_0xd504('0x15')](_0x3dab4e)['send'](_0x421a12);};}exports[_0xd504('0x21')]=function(_0x458be3,_0x2d33b4){var _0x2aa339={},_0x596928={},_0x4355c7={'count':0x0,'rows':[]};var _0x5322da=_[_0xd504('0x22')](db[_0xd504('0x23')][_0xd504('0x24')],function(_0x1ea1ff){return{'name':_0x1ea1ff['fieldName'],'type':_0x1ea1ff['type']['key']};});_0x596928[_0xd504('0x25')]=_[_0xd504('0x22')](_0x5322da,_0xd504('0x20'));_0x596928[_0xd504('0x26')]=_[_0xd504('0x27')](_0x458be3['query']);_0x596928[_0xd504('0x28')]=_[_0xd504('0x29')](_0x596928[_0xd504('0x25')],_0x596928[_0xd504('0x26')]);_0x2aa339['attributes']=_['intersection'](_0x596928['model'],qs[_0xd504('0x2a')](_0x458be3[_0xd504('0x26')][_0xd504('0x2a')]));_0x2aa339[_0xd504('0x2b')]=_0x2aa339[_0xd504('0x2b')][_0xd504('0x2c')]?_0x2aa339[_0xd504('0x2b')]:_0x596928[_0xd504('0x25')];if(!_0x458be3[_0xd504('0x26')][_0xd504('0x2d')]('nolimit')){_0x2aa339[_0xd504('0x18')]=qs[_0xd504('0x18')](_0x458be3[_0xd504('0x26')][_0xd504('0x18')]);_0x2aa339['offset']=qs[_0xd504('0x1a')](_0x458be3['query'][_0xd504('0x1a')]);}_0x2aa339['order']=qs[_0xd504('0x2e')](_0x458be3[_0xd504('0x26')]['sort']);_0x2aa339[_0xd504('0x2f')]=qs[_0xd504('0x28')](_[_0xd504('0x30')](_0x458be3[_0xd504('0x26')],_0x596928[_0xd504('0x28')]),_0x5322da);if(_0x458be3[_0xd504('0x26')][_0xd504('0x31')]){_0x2aa339[_0xd504('0x2f')]=_[_0xd504('0x32')](_0x2aa339['where'],{'$or':_[_0xd504('0x22')](_0x5322da,function(_0x4982d9){if(_0x4982d9[_0xd504('0x33')]!==_0xd504('0x34')){var _0x30879e={};_0x30879e[_0x4982d9['name']]={'$like':'%'+_0x458be3[_0xd504('0x26')]['filter']+'%'};return _0x30879e;}})});}_0x2aa339=_[_0xd504('0x32')]({},_0x2aa339,_0x458be3['options']);var _0x32b3c8={'where':_0x2aa339['where']};return db[_0xd504('0x23')]['count'](_0x32b3c8)['then'](function(_0x423473){_0x4355c7[_0xd504('0x19')]=_0x423473;if(_0x458be3['query'][_0xd504('0x35')]){_0x2aa339[_0xd504('0x36')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x2aa339);})[_0xd504('0x1e')](function(_0x3f6007){_0x4355c7['rows']=_0x3f6007;return _0x4355c7;})['then'](respondWithFilteredResult(_0x2d33b4,_0x2aa339))[_0xd504('0x37')](handleError(_0x2d33b4,null));};exports[_0xd504('0x38')]=function(_0x13fb3f,_0xefdcc4){var _0x443460={'raw':![],'where':{'id':_0x13fb3f['params']['id']}},_0x26e9d4={};_0x26e9d4[_0xd504('0x25')]=_[_0xd504('0x27')](db[_0xd504('0x23')][_0xd504('0x24')]);_0x26e9d4['query']=_[_0xd504('0x27')](_0x13fb3f[_0xd504('0x26')]);_0x26e9d4[_0xd504('0x28')]=_[_0xd504('0x29')](_0x26e9d4[_0xd504('0x25')],_0x26e9d4[_0xd504('0x26')]);_0x443460['attributes']=_['intersection'](_0x26e9d4['model'],qs[_0xd504('0x2a')](_0x13fb3f['query']['fields']));_0x443460[_0xd504('0x2b')]=_0x443460[_0xd504('0x2b')][_0xd504('0x2c')]?_0x443460[_0xd504('0x2b')]:_0x26e9d4[_0xd504('0x25')];if(_0x13fb3f[_0xd504('0x26')][_0xd504('0x35')]){_0x443460[_0xd504('0x36')]=[{'all':!![]}];}_0x443460=_['merge']({},_0x443460,_0x13fb3f[_0xd504('0x39')]);return db[_0xd504('0x23')]['find'](_0x443460)['then'](handleEntityNotFound(_0xefdcc4,null))['then'](respondWithResult(_0xefdcc4,null))[_0xd504('0x37')](handleError(_0xefdcc4,null));};exports[_0xd504('0x3a')]=function(_0x29f13f,_0x20f316){return db[_0xd504('0x23')]['create'](_0x29f13f[_0xd504('0x3b')],{})[_0xd504('0x1e')](respondWithResult(_0x20f316,0xc9))[_0xd504('0x37')](handleError(_0x20f316,null));};exports[_0xd504('0x3c')]=function(_0x5f1cba,_0x5a3307){if(_0x5f1cba[_0xd504('0x3b')]['id']){delete _0x5f1cba[_0xd504('0x3b')]['id'];}return db['ServicenowConfiguration'][_0xd504('0x3d')]({'where':{'id':_0x5f1cba[_0xd504('0x3e')]['id']}})[_0xd504('0x1e')](handleEntityNotFound(_0x5a3307,null))['then'](saveUpdates(_0x5f1cba[_0xd504('0x3b')],null))[_0xd504('0x1e')](respondWithResult(_0x5a3307,null))[_0xd504('0x37')](handleError(_0x5a3307,null));};exports[_0xd504('0x3f')]=function(_0x4e04e8,_0x3918e1){return db['ServicenowConfiguration'][_0xd504('0x3d')]({'where':{'id':_0x4e04e8[_0xd504('0x3e')]['id']}})[_0xd504('0x1e')](handleEntityNotFound(_0x3918e1,null))[_0xd504('0x1e')](removeEntity(_0x3918e1,null))[_0xd504('0x37')](handleError(_0x3918e1,null));};exports[_0xd504('0x40')]=function(_0x3994d0,_0x40ef19,_0x90d3e8){var _0x2b9258={};var _0x56dc74={};var _0x3dc0c3;var _0x3ecd8a;return db[_0xd504('0x23')][_0xd504('0x41')]({'where':{'id':_0x3994d0[_0xd504('0x3e')]['id']}})[_0xd504('0x1e')](handleEntityNotFound(_0x40ef19,null))[_0xd504('0x1e')](function(_0x4c2ac9){if(_0x4c2ac9){_0x3dc0c3=_0x4c2ac9;_0x56dc74[_0xd504('0x25')]=_['keys'](db[_0xd504('0x42')]['rawAttributes']);_0x56dc74[_0xd504('0x26')]=_[_0xd504('0x27')](_0x3994d0[_0xd504('0x26')]);_0x56dc74[_0xd504('0x28')]=_[_0xd504('0x29')](_0x56dc74['model'],_0x56dc74['query']);_0x2b9258[_0xd504('0x2b')]=_[_0xd504('0x29')](_0x56dc74[_0xd504('0x25')],qs['fields'](_0x3994d0[_0xd504('0x26')]['fields']));_0x2b9258[_0xd504('0x2b')]=_0x2b9258[_0xd504('0x2b')]['length']?_0x2b9258[_0xd504('0x2b')]:_0x56dc74[_0xd504('0x25')];_0x2b9258['order']=qs[_0xd504('0x2e')](_0x3994d0[_0xd504('0x26')]['sort']);_0x2b9258['where']=qs[_0xd504('0x28')](_[_0xd504('0x30')](_0x3994d0[_0xd504('0x26')],_0x56dc74[_0xd504('0x28')]));if(_0x3994d0[_0xd504('0x26')][_0xd504('0x31')]){_0x2b9258[_0xd504('0x2f')]=_['merge'](_0x2b9258[_0xd504('0x2f')],{'$or':_['map'](_0x2b9258[_0xd504('0x2b')],function(_0x2e5eee){var _0x4f76cb={};_0x4f76cb[_0x2e5eee]={'$like':'%'+_0x3994d0[_0xd504('0x26')][_0xd504('0x31')]+'%'};return _0x4f76cb;})});}_0x2b9258=_['merge']({},_0x2b9258,_0x3994d0['options']);return _0x3dc0c3['getFields'](_0x2b9258);}})[_0xd504('0x1e')](function(_0xf04136){if(_0xf04136){_0x3ecd8a=_0xf04136[_0xd504('0x2c')];if(!_0x3994d0[_0xd504('0x26')][_0xd504('0x2d')]('nolimit')){_0x2b9258[_0xd504('0x18')]=qs[_0xd504('0x18')](_0x3994d0[_0xd504('0x26')][_0xd504('0x18')]);_0x2b9258[_0xd504('0x1a')]=qs[_0xd504('0x1a')](_0x3994d0[_0xd504('0x26')][_0xd504('0x1a')]);}return _0x3dc0c3['getFields'](_0x2b9258);}})[_0xd504('0x1e')](function(_0x541b22){if(_0x541b22){return _0x541b22?{'count':_0x3ecd8a,'rows':_0x541b22}:null;}})[_0xd504('0x1e')](respondWithResult(_0x40ef19,null))[_0xd504('0x37')](handleError(_0x40ef19,null));};exports[_0xd504('0x43')]=function(_0x2be231,_0xd76fc5,_0xc6a305){var _0x46a3c0={};var _0x572de2={};var _0x199221;var _0x1d9892;return db[_0xd504('0x23')][_0xd504('0x41')]({'where':{'id':_0x2be231[_0xd504('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd76fc5,null))[_0xd504('0x1e')](function(_0x295481){if(_0x295481){_0x199221=_0x295481;_0x572de2[_0xd504('0x25')]=_[_0xd504('0x27')](db[_0xd504('0x42')][_0xd504('0x24')]);_0x572de2[_0xd504('0x26')]=_[_0xd504('0x27')](_0x2be231[_0xd504('0x26')]);_0x572de2[_0xd504('0x28')]=_[_0xd504('0x29')](_0x572de2[_0xd504('0x25')],_0x572de2['query']);_0x46a3c0[_0xd504('0x2b')]=_['intersection'](_0x572de2[_0xd504('0x25')],qs[_0xd504('0x2a')](_0x2be231[_0xd504('0x26')][_0xd504('0x2a')]));_0x46a3c0[_0xd504('0x2b')]=_0x46a3c0[_0xd504('0x2b')][_0xd504('0x2c')]?_0x46a3c0[_0xd504('0x2b')]:_0x572de2[_0xd504('0x25')];_0x46a3c0['order']=qs[_0xd504('0x2e')](_0x2be231[_0xd504('0x26')][_0xd504('0x2e')]);_0x46a3c0[_0xd504('0x2f')]=qs['filters'](_[_0xd504('0x30')](_0x2be231[_0xd504('0x26')],_0x572de2[_0xd504('0x28')]));if(_0x2be231[_0xd504('0x26')][_0xd504('0x31')]){_0x46a3c0[_0xd504('0x2f')]=_[_0xd504('0x32')](_0x46a3c0[_0xd504('0x2f')],{'$or':_[_0xd504('0x22')](_0x46a3c0['attributes'],function(_0x4b32d9){var _0x7140fd={};_0x7140fd[_0x4b32d9]={'$like':'%'+_0x2be231['query'][_0xd504('0x31')]+'%'};return _0x7140fd;})});}_0x46a3c0=_['merge']({},_0x46a3c0,_0x2be231[_0xd504('0x39')]);return _0x199221[_0xd504('0x43')](_0x46a3c0);}})[_0xd504('0x1e')](function(_0x1023b1){if(_0x1023b1){_0x1d9892=_0x1023b1['length'];if(!_0x2be231[_0xd504('0x26')]['hasOwnProperty'](_0xd504('0x44'))){_0x46a3c0[_0xd504('0x18')]=qs[_0xd504('0x18')](_0x2be231['query'][_0xd504('0x18')]);_0x46a3c0[_0xd504('0x1a')]=qs[_0xd504('0x1a')](_0x2be231[_0xd504('0x26')][_0xd504('0x1a')]);}return _0x199221[_0xd504('0x43')](_0x46a3c0);}})['then'](function(_0x3f65d3){if(_0x3f65d3){return _0x3f65d3?{'count':_0x1d9892,'rows':_0x3f65d3}:null;}})['then'](respondWithResult(_0xd76fc5,null))[_0xd504('0x37')](handleError(_0xd76fc5,null));};exports['getDescriptions']=function(_0x2bb827,_0x479444,_0x48d27d){var _0x5d4f44={};var _0x3d6971={};var _0x86976c;var _0x559fc5;return db[_0xd504('0x23')][_0xd504('0x41')]({'where':{'id':_0x2bb827[_0xd504('0x3e')]['id']}})['then'](handleEntityNotFound(_0x479444,null))[_0xd504('0x1e')](function(_0x9b6c55){if(_0x9b6c55){_0x86976c=_0x9b6c55;_0x3d6971['model']=_[_0xd504('0x27')](db[_0xd504('0x42')][_0xd504('0x24')]);_0x3d6971[_0xd504('0x26')]=_[_0xd504('0x27')](_0x2bb827[_0xd504('0x26')]);_0x3d6971[_0xd504('0x28')]=_[_0xd504('0x29')](_0x3d6971[_0xd504('0x25')],_0x3d6971[_0xd504('0x26')]);_0x5d4f44['attributes']=_['intersection'](_0x3d6971[_0xd504('0x25')],qs['fields'](_0x2bb827[_0xd504('0x26')][_0xd504('0x2a')]));_0x5d4f44[_0xd504('0x2b')]=_0x5d4f44[_0xd504('0x2b')][_0xd504('0x2c')]?_0x5d4f44[_0xd504('0x2b')]:_0x3d6971['model'];_0x5d4f44['order']=qs[_0xd504('0x2e')](_0x2bb827[_0xd504('0x26')]['sort']);_0x5d4f44[_0xd504('0x2f')]=qs['filters'](_[_0xd504('0x30')](_0x2bb827[_0xd504('0x26')],_0x3d6971[_0xd504('0x28')]));if(_0x2bb827['query'][_0xd504('0x31')]){_0x5d4f44['where']=_['merge'](_0x5d4f44[_0xd504('0x2f')],{'$or':_['map'](_0x5d4f44['attributes'],function(_0x57aff1){var _0x25a827={};_0x25a827[_0x57aff1]={'$like':'%'+_0x2bb827[_0xd504('0x26')]['filter']+'%'};return _0x25a827;})});}_0x5d4f44=_[_0xd504('0x32')]({},_0x5d4f44,_0x2bb827[_0xd504('0x39')]);return _0x86976c[_0xd504('0x45')](_0x5d4f44);}})['then'](function(_0x478096){if(_0x478096){_0x559fc5=_0x478096['length'];if(!_0x2bb827[_0xd504('0x26')][_0xd504('0x2d')]('nolimit')){_0x5d4f44[_0xd504('0x18')]=qs[_0xd504('0x18')](_0x2bb827[_0xd504('0x26')][_0xd504('0x18')]);_0x5d4f44[_0xd504('0x1a')]=qs['offset'](_0x2bb827[_0xd504('0x26')][_0xd504('0x1a')]);}return _0x86976c['getDescriptions'](_0x5d4f44);}})[_0xd504('0x1e')](function(_0x175512){if(_0x175512){return _0x175512?{'count':_0x559fc5,'rows':_0x175512}:null;}})[_0xd504('0x1e')](respondWithResult(_0x479444,null))['catch'](handleError(_0x479444,null));}; \ No newline at end of file +var _0x7ba5=['getSubjects','ServicenowField','getDescriptions','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','count','offset','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','ServicenowConfiguration','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','includeAll','include','findAll','rows','catch','show','params','create','body','find','getFields','findOne','rawAttributes','options'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x7ba5,0x193));var _0x57ba=function(_0x3b5792,_0x33dfd5){_0x3b5792=_0x3b5792-0x0;var _0x1afa23=_0x7ba5[_0x3b5792];return _0x1afa23;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57ba('0x0'));var zipdir=require(_0x57ba('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57ba('0x2'));var moment=require(_0x57ba('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x57ba('0x4'));var util=require(_0x57ba('0x5'));var path=require(_0x57ba('0x6'));var sox=require('sox');var csv=require(_0x57ba('0x7'));var ejs=require(_0x57ba('0x8'));var fs=require('fs');var fs_extra=require(_0x57ba('0x9'));var _=require('lodash');var squel=require(_0x57ba('0xa'));var crypto=require('crypto');var jsforce=require(_0x57ba('0xb'));var deskjs=require(_0x57ba('0xc'));var toCsv=require(_0x57ba('0x7'));var querystring=require(_0x57ba('0xd'));var Papa=require(_0x57ba('0xe'));var Redis=require(_0x57ba('0xf'));var authService=require(_0x57ba('0x10'));var qs=require(_0x57ba('0x11'));var as=require(_0x57ba('0x12'));var hardwareService=require(_0x57ba('0x13'));var logger=require(_0x57ba('0x14'))(_0x57ba('0x15'));var utils=require(_0x57ba('0x16'));var config=require(_0x57ba('0x17'));var licenseUtil=require(_0x57ba('0x18'));var db=require(_0x57ba('0x19'))['db'];function respondWithStatusCode(_0x285fb9,_0x5921e6){_0x5921e6=_0x5921e6||0xcc;return function(_0x2afb53){if(_0x2afb53){return _0x285fb9[_0x57ba('0x1a')](_0x5921e6);}return _0x285fb9[_0x57ba('0x1b')](_0x5921e6)['end']();};}function respondWithResult(_0x1ad205,_0x56024c){_0x56024c=_0x56024c||0xc8;return function(_0x427cac){if(_0x427cac){return _0x1ad205[_0x57ba('0x1b')](_0x56024c)['json'](_0x427cac);}};}function respondWithFilteredResult(_0x2ef883,_0x4502e2){return function(_0x15fa23){if(_0x15fa23){var _0x4e1309=typeof _0x4502e2['offset']==='undefined'&&typeof _0x4502e2[_0x57ba('0x1c')]==='undefined';var _0x449b3f=_0x15fa23[_0x57ba('0x1d')];var _0x22a4ed=_0x4e1309?0x0:_0x4502e2[_0x57ba('0x1e')];var _0x107a12=_0x4e1309?_0x15fa23[_0x57ba('0x1d')]:_0x4502e2['offset']+_0x4502e2[_0x57ba('0x1c')];var _0x4180e0;if(_0x107a12>=_0x449b3f){_0x107a12=_0x449b3f;_0x4180e0=0xc8;}else{_0x4180e0=0xce;}_0x2ef883[_0x57ba('0x1b')](_0x4180e0);return _0x2ef883['set'](_0x57ba('0x1f'),_0x22a4ed+'-'+_0x107a12+'/'+_0x449b3f)['json'](_0x15fa23);}return null;};}function patchUpdates(_0xd60c72){return function(_0x2f8898){try{jsonpatch[_0x57ba('0x20')](_0x2f8898,_0xd60c72,!![]);}catch(_0x1bdff9){return BPromise['reject'](_0x1bdff9);}return _0x2f8898[_0x57ba('0x21')]();};}function saveUpdates(_0x19e94a,_0x13a85c){return function(_0x63f89){if(_0x63f89){return _0x63f89[_0x57ba('0x22')](_0x19e94a)[_0x57ba('0x23')](function(_0x4e23f0){return _0x4e23f0;});}return null;};}function removeEntity(_0x16f794,_0x397d79){return function(_0x1de25a){if(_0x1de25a){return _0x1de25a[_0x57ba('0x24')]()[_0x57ba('0x23')](function(){_0x16f794[_0x57ba('0x1b')](0xcc)[_0x57ba('0x25')]();});}};}function handleEntityNotFound(_0x337951,_0x861eb1){return function(_0x3b96f6){if(!_0x3b96f6){_0x337951[_0x57ba('0x1a')](0x194);}return _0x3b96f6;};}function handleError(_0x4f1f88,_0x5530d6){_0x5530d6=_0x5530d6||0x1f4;return function(_0x1127a3){logger[_0x57ba('0x26')](_0x1127a3[_0x57ba('0x27')]);if(_0x1127a3[_0x57ba('0x28')]){delete _0x1127a3[_0x57ba('0x28')];}_0x4f1f88[_0x57ba('0x1b')](_0x5530d6)[_0x57ba('0x29')](_0x1127a3);};}exports[_0x57ba('0x2a')]=function(_0x42fbdf,_0x20a2d0){var _0x363a61={},_0x483442={},_0x1dee21={'count':0x0,'rows':[]};var _0x3f49c7=_['map'](db[_0x57ba('0x2b')]['rawAttributes'],function(_0x3cdb5f){return{'name':_0x3cdb5f[_0x57ba('0x2c')],'type':_0x3cdb5f[_0x57ba('0x2d')]['key']};});_0x483442[_0x57ba('0x2e')]=_['map'](_0x3f49c7,_0x57ba('0x28'));_0x483442[_0x57ba('0x2f')]=_[_0x57ba('0x30')](_0x42fbdf[_0x57ba('0x2f')]);_0x483442[_0x57ba('0x31')]=_[_0x57ba('0x32')](_0x483442['model'],_0x483442[_0x57ba('0x2f')]);_0x363a61['attributes']=_[_0x57ba('0x32')](_0x483442['model'],qs[_0x57ba('0x33')](_0x42fbdf[_0x57ba('0x2f')][_0x57ba('0x33')]));_0x363a61['attributes']=_0x363a61[_0x57ba('0x34')][_0x57ba('0x35')]?_0x363a61[_0x57ba('0x34')]:_0x483442[_0x57ba('0x2e')];if(!_0x42fbdf[_0x57ba('0x2f')][_0x57ba('0x36')](_0x57ba('0x37'))){_0x363a61[_0x57ba('0x1c')]=qs[_0x57ba('0x1c')](_0x42fbdf[_0x57ba('0x2f')][_0x57ba('0x1c')]);_0x363a61['offset']=qs[_0x57ba('0x1e')](_0x42fbdf['query'][_0x57ba('0x1e')]);}_0x363a61[_0x57ba('0x38')]=qs['sort'](_0x42fbdf['query'][_0x57ba('0x39')]);_0x363a61[_0x57ba('0x3a')]=qs['filters'](_[_0x57ba('0x3b')](_0x42fbdf[_0x57ba('0x2f')],_0x483442[_0x57ba('0x31')]),_0x3f49c7);if(_0x42fbdf['query'][_0x57ba('0x3c')]){_0x363a61[_0x57ba('0x3a')]=_[_0x57ba('0x3d')](_0x363a61[_0x57ba('0x3a')],{'$or':_[_0x57ba('0x3e')](_0x3f49c7,function(_0x35ddce){if(_0x35ddce[_0x57ba('0x2d')]!=='VIRTUAL'){var _0xdd4ca6={};_0xdd4ca6[_0x35ddce[_0x57ba('0x28')]]={'$like':'%'+_0x42fbdf[_0x57ba('0x2f')][_0x57ba('0x3c')]+'%'};return _0xdd4ca6;}})});}_0x363a61=_[_0x57ba('0x3d')]({},_0x363a61,_0x42fbdf['options']);var _0x924d00={'where':_0x363a61['where']};return db[_0x57ba('0x2b')][_0x57ba('0x1d')](_0x924d00)['then'](function(_0x19973e){_0x1dee21[_0x57ba('0x1d')]=_0x19973e;if(_0x42fbdf[_0x57ba('0x2f')][_0x57ba('0x3f')]){_0x363a61[_0x57ba('0x40')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x57ba('0x41')](_0x363a61);})[_0x57ba('0x23')](function(_0x1f534b){_0x1dee21[_0x57ba('0x42')]=_0x1f534b;return _0x1dee21;})[_0x57ba('0x23')](respondWithFilteredResult(_0x20a2d0,_0x363a61))[_0x57ba('0x43')](handleError(_0x20a2d0,null));};exports[_0x57ba('0x44')]=function(_0x4194de,_0x1da9d3){var _0x2ffd8e={'raw':![],'where':{'id':_0x4194de[_0x57ba('0x45')]['id']}},_0x2a33f3={};_0x2a33f3['model']=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0x2a33f3[_0x57ba('0x2f')]=_['keys'](_0x4194de[_0x57ba('0x2f')]);_0x2a33f3['filters']=_['intersection'](_0x2a33f3[_0x57ba('0x2e')],_0x2a33f3[_0x57ba('0x2f')]);_0x2ffd8e[_0x57ba('0x34')]=_[_0x57ba('0x32')](_0x2a33f3[_0x57ba('0x2e')],qs[_0x57ba('0x33')](_0x4194de['query'][_0x57ba('0x33')]));_0x2ffd8e['attributes']=_0x2ffd8e[_0x57ba('0x34')][_0x57ba('0x35')]?_0x2ffd8e[_0x57ba('0x34')]:_0x2a33f3['model'];if(_0x4194de[_0x57ba('0x2f')]['includeAll']){_0x2ffd8e[_0x57ba('0x40')]=[{'all':!![]}];}_0x2ffd8e=_[_0x57ba('0x3d')]({},_0x2ffd8e,_0x4194de['options']);return db[_0x57ba('0x2b')]['find'](_0x2ffd8e)[_0x57ba('0x23')](handleEntityNotFound(_0x1da9d3,null))[_0x57ba('0x23')](respondWithResult(_0x1da9d3,null))['catch'](handleError(_0x1da9d3,null));};exports[_0x57ba('0x46')]=function(_0x1b6bf5,_0x49551b){return db['ServicenowConfiguration'][_0x57ba('0x46')](_0x1b6bf5[_0x57ba('0x47')],{})[_0x57ba('0x23')](respondWithResult(_0x49551b,0xc9))[_0x57ba('0x43')](handleError(_0x49551b,null));};exports[_0x57ba('0x22')]=function(_0x10cfed,_0x39b00d){if(_0x10cfed[_0x57ba('0x47')]['id']){delete _0x10cfed[_0x57ba('0x47')]['id'];}return db[_0x57ba('0x2b')][_0x57ba('0x48')]({'where':{'id':_0x10cfed['params']['id']}})[_0x57ba('0x23')](handleEntityNotFound(_0x39b00d,null))[_0x57ba('0x23')](saveUpdates(_0x10cfed[_0x57ba('0x47')],null))[_0x57ba('0x23')](respondWithResult(_0x39b00d,null))[_0x57ba('0x43')](handleError(_0x39b00d,null));};exports['destroy']=function(_0x3ad6bc,_0x1b8939){return db[_0x57ba('0x2b')]['find']({'where':{'id':_0x3ad6bc['params']['id']}})['then'](handleEntityNotFound(_0x1b8939,null))[_0x57ba('0x23')](removeEntity(_0x1b8939,null))[_0x57ba('0x43')](handleError(_0x1b8939,null));};exports[_0x57ba('0x49')]=function(_0xfcbe62,_0x6b67f9,_0xc5d599){var _0x550bb0={};var _0x4c2540={};var _0x268a5b;var _0x2c35a5;return db[_0x57ba('0x2b')][_0x57ba('0x4a')]({'where':{'id':_0xfcbe62[_0x57ba('0x45')]['id']}})[_0x57ba('0x23')](handleEntityNotFound(_0x6b67f9,null))['then'](function(_0x152551){if(_0x152551){_0x268a5b=_0x152551;_0x4c2540[_0x57ba('0x2e')]=_['keys'](db['ServicenowField'][_0x57ba('0x4b')]);_0x4c2540[_0x57ba('0x2f')]=_['keys'](_0xfcbe62[_0x57ba('0x2f')]);_0x4c2540[_0x57ba('0x31')]=_[_0x57ba('0x32')](_0x4c2540[_0x57ba('0x2e')],_0x4c2540['query']);_0x550bb0[_0x57ba('0x34')]=_[_0x57ba('0x32')](_0x4c2540['model'],qs[_0x57ba('0x33')](_0xfcbe62[_0x57ba('0x2f')][_0x57ba('0x33')]));_0x550bb0[_0x57ba('0x34')]=_0x550bb0[_0x57ba('0x34')][_0x57ba('0x35')]?_0x550bb0['attributes']:_0x4c2540[_0x57ba('0x2e')];_0x550bb0[_0x57ba('0x38')]=qs['sort'](_0xfcbe62[_0x57ba('0x2f')]['sort']);_0x550bb0['where']=qs[_0x57ba('0x31')](_[_0x57ba('0x3b')](_0xfcbe62[_0x57ba('0x2f')],_0x4c2540[_0x57ba('0x31')]));if(_0xfcbe62[_0x57ba('0x2f')][_0x57ba('0x3c')]){_0x550bb0[_0x57ba('0x3a')]=_[_0x57ba('0x3d')](_0x550bb0['where'],{'$or':_[_0x57ba('0x3e')](_0x550bb0['attributes'],function(_0x1a31c9){var _0x3a0583={};_0x3a0583[_0x1a31c9]={'$like':'%'+_0xfcbe62[_0x57ba('0x2f')][_0x57ba('0x3c')]+'%'};return _0x3a0583;})});}_0x550bb0=_[_0x57ba('0x3d')]({},_0x550bb0,_0xfcbe62[_0x57ba('0x4c')]);return _0x268a5b[_0x57ba('0x49')](_0x550bb0);}})[_0x57ba('0x23')](function(_0x23fe3e){if(_0x23fe3e){_0x2c35a5=_0x23fe3e[_0x57ba('0x35')];if(!_0xfcbe62[_0x57ba('0x2f')][_0x57ba('0x36')](_0x57ba('0x37'))){_0x550bb0[_0x57ba('0x1c')]=qs[_0x57ba('0x1c')](_0xfcbe62[_0x57ba('0x2f')][_0x57ba('0x1c')]);_0x550bb0[_0x57ba('0x1e')]=qs['offset'](_0xfcbe62[_0x57ba('0x2f')][_0x57ba('0x1e')]);}return _0x268a5b[_0x57ba('0x49')](_0x550bb0);}})[_0x57ba('0x23')](function(_0x305570){if(_0x305570){return _0x305570?{'count':_0x2c35a5,'rows':_0x305570}:null;}})[_0x57ba('0x23')](respondWithResult(_0x6b67f9,null))[_0x57ba('0x43')](handleError(_0x6b67f9,null));};exports[_0x57ba('0x4d')]=function(_0x431175,_0x268d95,_0x44df73){var _0x387066={};var _0x1e484f={};var _0x3709c9;var _0x27f4d2;return db[_0x57ba('0x2b')][_0x57ba('0x4a')]({'where':{'id':_0x431175['params']['id']}})['then'](handleEntityNotFound(_0x268d95,null))[_0x57ba('0x23')](function(_0x1701c1){if(_0x1701c1){_0x3709c9=_0x1701c1;_0x1e484f[_0x57ba('0x2e')]=_[_0x57ba('0x30')](db[_0x57ba('0x4e')]['rawAttributes']);_0x1e484f['query']=_[_0x57ba('0x30')](_0x431175[_0x57ba('0x2f')]);_0x1e484f[_0x57ba('0x31')]=_[_0x57ba('0x32')](_0x1e484f[_0x57ba('0x2e')],_0x1e484f['query']);_0x387066[_0x57ba('0x34')]=_[_0x57ba('0x32')](_0x1e484f[_0x57ba('0x2e')],qs[_0x57ba('0x33')](_0x431175[_0x57ba('0x2f')][_0x57ba('0x33')]));_0x387066[_0x57ba('0x34')]=_0x387066[_0x57ba('0x34')][_0x57ba('0x35')]?_0x387066[_0x57ba('0x34')]:_0x1e484f['model'];_0x387066[_0x57ba('0x38')]=qs[_0x57ba('0x39')](_0x431175[_0x57ba('0x2f')]['sort']);_0x387066['where']=qs[_0x57ba('0x31')](_['pick'](_0x431175[_0x57ba('0x2f')],_0x1e484f[_0x57ba('0x31')]));if(_0x431175[_0x57ba('0x2f')][_0x57ba('0x3c')]){_0x387066['where']=_[_0x57ba('0x3d')](_0x387066[_0x57ba('0x3a')],{'$or':_[_0x57ba('0x3e')](_0x387066[_0x57ba('0x34')],function(_0x408edd){var _0x577f15={};_0x577f15[_0x408edd]={'$like':'%'+_0x431175[_0x57ba('0x2f')]['filter']+'%'};return _0x577f15;})});}_0x387066=_[_0x57ba('0x3d')]({},_0x387066,_0x431175[_0x57ba('0x4c')]);return _0x3709c9['getSubjects'](_0x387066);}})['then'](function(_0x5cc197){if(_0x5cc197){_0x27f4d2=_0x5cc197[_0x57ba('0x35')];if(!_0x431175[_0x57ba('0x2f')][_0x57ba('0x36')](_0x57ba('0x37'))){_0x387066[_0x57ba('0x1c')]=qs['limit'](_0x431175[_0x57ba('0x2f')][_0x57ba('0x1c')]);_0x387066[_0x57ba('0x1e')]=qs[_0x57ba('0x1e')](_0x431175['query'][_0x57ba('0x1e')]);}return _0x3709c9[_0x57ba('0x4d')](_0x387066);}})[_0x57ba('0x23')](function(_0x32505a){if(_0x32505a){return _0x32505a?{'count':_0x27f4d2,'rows':_0x32505a}:null;}})[_0x57ba('0x23')](respondWithResult(_0x268d95,null))[_0x57ba('0x43')](handleError(_0x268d95,null));};exports[_0x57ba('0x4f')]=function(_0x5f31db,_0x5f4e86,_0x4939d4){var _0x532b7f={};var _0x457c76={};var _0x290f3e;var _0xadbc05;return db['ServicenowConfiguration'][_0x57ba('0x4a')]({'where':{'id':_0x5f31db[_0x57ba('0x45')]['id']}})[_0x57ba('0x23')](handleEntityNotFound(_0x5f4e86,null))['then'](function(_0x5f0c46){if(_0x5f0c46){_0x290f3e=_0x5f0c46;_0x457c76['model']=_[_0x57ba('0x30')](db['ServicenowField'][_0x57ba('0x4b')]);_0x457c76[_0x57ba('0x2f')]=_[_0x57ba('0x30')](_0x5f31db[_0x57ba('0x2f')]);_0x457c76[_0x57ba('0x31')]=_[_0x57ba('0x32')](_0x457c76[_0x57ba('0x2e')],_0x457c76['query']);_0x532b7f['attributes']=_[_0x57ba('0x32')](_0x457c76['model'],qs[_0x57ba('0x33')](_0x5f31db['query']['fields']));_0x532b7f[_0x57ba('0x34')]=_0x532b7f[_0x57ba('0x34')][_0x57ba('0x35')]?_0x532b7f[_0x57ba('0x34')]:_0x457c76[_0x57ba('0x2e')];_0x532b7f[_0x57ba('0x38')]=qs['sort'](_0x5f31db[_0x57ba('0x2f')][_0x57ba('0x39')]);_0x532b7f[_0x57ba('0x3a')]=qs['filters'](_[_0x57ba('0x3b')](_0x5f31db[_0x57ba('0x2f')],_0x457c76[_0x57ba('0x31')]));if(_0x5f31db['query']['filter']){_0x532b7f[_0x57ba('0x3a')]=_['merge'](_0x532b7f[_0x57ba('0x3a')],{'$or':_[_0x57ba('0x3e')](_0x532b7f[_0x57ba('0x34')],function(_0x290d70){var _0x5a6212={};_0x5a6212[_0x290d70]={'$like':'%'+_0x5f31db[_0x57ba('0x2f')]['filter']+'%'};return _0x5a6212;})});}_0x532b7f=_['merge']({},_0x532b7f,_0x5f31db[_0x57ba('0x4c')]);return _0x290f3e[_0x57ba('0x4f')](_0x532b7f);}})[_0x57ba('0x23')](function(_0x5dd4de){if(_0x5dd4de){_0xadbc05=_0x5dd4de[_0x57ba('0x35')];if(!_0x5f31db[_0x57ba('0x2f')]['hasOwnProperty'](_0x57ba('0x37'))){_0x532b7f['limit']=qs[_0x57ba('0x1c')](_0x5f31db[_0x57ba('0x2f')][_0x57ba('0x1c')]);_0x532b7f[_0x57ba('0x1e')]=qs[_0x57ba('0x1e')](_0x5f31db['query'][_0x57ba('0x1e')]);}return _0x290f3e['getDescriptions'](_0x532b7f);}})[_0x57ba('0x23')](function(_0x5a4bf3){if(_0x5a4bf3){return _0x5a4bf3?{'count':_0xadbc05,'rows':_0x5a4bf3}:null;}})[_0x57ba('0x23')](respondWithResult(_0x5f4e86,null))['catch'](handleError(_0x5f4e86,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 628c4da..587e7c1 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 _0x1f75=['exports','define','ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x1f75,0x13c));var _0x51f7=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x1f75[_0x4a7631];return _0x1a5a6f;};'use strict';var _=require('lodash');var util=require(_0x51f7('0x0'));var logger=require(_0x51f7('0x1'))(_0x51f7('0x2'));var moment=require(_0x51f7('0x3'));var BPromise=require(_0x51f7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x51f7('0x5'));var rimraf=require(_0x51f7('0x6'));var config=require(_0x51f7('0x7'));var attributes=require(_0x51f7('0x8'));module[_0x51f7('0x9')]=function(_0x1fe16a,_0x244646){return _0x1fe16a[_0x51f7('0xa')](_0x51f7('0xb'),attributes,{'tableName':_0x51f7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e7b=['exports','define','ServicenowConfiguration','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x59aa98,_0x2a31f2){var _0x5609c2=function(_0x421823){while(--_0x421823){_0x59aa98['push'](_0x59aa98['shift']());}};_0x5609c2(++_0x2a31f2);}(_0x4e7b,0xf3));var _0xb4e7=function(_0x2b1e3,_0x900521){_0x2b1e3=_0x2b1e3-0x0;var _0x1595e6=_0x4e7b[_0x2b1e3];return _0x1595e6;};'use strict';var _=require(_0xb4e7('0x0'));var util=require(_0xb4e7('0x1'));var logger=require('../../config/logger')(_0xb4e7('0x2'));var moment=require('moment');var BPromise=require(_0xb4e7('0x3'));var rp=require(_0xb4e7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb4e7('0x5'));var config=require(_0xb4e7('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xb4e7('0x7')]=function(_0x3351aa,_0x271dbf){return _0x3351aa[_0xb4e7('0x8')](_0xb4e7('0x9'),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 1ab1b76..9e24bd3 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 _0x2cc4=['code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x2cc4,0xdd));var _0x42cc=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0x2cc4[_0x1ee351];return _0x245aaf;};'use strict';var _=require(_0x42cc('0x0'));var util=require(_0x42cc('0x1'));var moment=require(_0x42cc('0x2'));var BPromise=require(_0x42cc('0x3'));var rs=require(_0x42cc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x42cc('0x5'))['db'];var utils=require(_0x42cc('0x6'));var logger=require('../../config/logger')(_0x42cc('0x7'));var config=require(_0x42cc('0x8'));var jayson=require(_0x42cc('0x9'));var client=jayson[_0x42cc('0xa')][_0x42cc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fc8d2,_0x31df59,_0xd28d27){return new BPromise(function(_0x1342f8,_0x272915){return client[_0x42cc('0xc')](_0x4fc8d2,_0xd28d27)[_0x42cc('0xd')](function(_0x4717b7){logger[_0x42cc('0xe')](_0x42cc('0xf'),_0x31df59,_0x42cc('0x10'));logger[_0x42cc('0x11')](_0x42cc('0x12'),_0x31df59,'request\x20sent',JSON['stringify'](_0x4717b7));if(_0x4717b7['error']){if(_0x4717b7['error'][_0x42cc('0x13')]===0x1f4){logger[_0x42cc('0x14')](_0x42cc('0xf'),_0x31df59,_0x4717b7[_0x42cc('0x14')]['message']);return _0x272915(_0x4717b7[_0x42cc('0x14')][_0x42cc('0x15')]);}logger[_0x42cc('0x14')](_0x42cc('0xf'),_0x31df59,_0x4717b7[_0x42cc('0x14')][_0x42cc('0x15')]);return _0x1342f8(_0x4717b7[_0x42cc('0x14')][_0x42cc('0x15')]);}else{logger['info'](_0x42cc('0xf'),_0x31df59,_0x42cc('0x10'));_0x1342f8(_0x4717b7[_0x42cc('0x16')][_0x42cc('0x15')]);}})[_0x42cc('0x17')](function(_0x5ad460){logger[_0x42cc('0x14')]('ServicenowConfiguration,\x20%s,\x20%s',_0x31df59,_0x5ad460);_0x272915(_0x5ad460);});});} \ No newline at end of file +var _0x736c=['rpc','../../config/environment','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x239193,_0x1585ef){var _0x4f51c3=function(_0x8eba2c){while(--_0x8eba2c){_0x239193['push'](_0x239193['shift']());}};_0x4f51c3(++_0x1585ef);}(_0x736c,0x190));var _0xc736=function(_0x351463,_0x35ceca){_0x351463=_0x351463-0x0;var _0x4b73ef=_0x736c[_0x351463];return _0x4b73ef;};'use strict';var _=require(_0xc736('0x0'));var util=require(_0xc736('0x1'));var moment=require('moment');var BPromise=require(_0xc736('0x2'));var rs=require(_0xc736('0x3'));var fs=require('fs');var Redis=require(_0xc736('0x4'));var db=require(_0xc736('0x5'))['db'];var utils=require(_0xc736('0x6'));var logger=require(_0xc736('0x7'))(_0xc736('0x8'));var config=require(_0xc736('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc736('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x480ef2,_0x58245d,_0x5915a0){return new BPromise(function(_0x26e67e,_0x2935cb){return client[_0xc736('0xb')](_0x480ef2,_0x5915a0)[_0xc736('0xc')](function(_0x13682d){logger[_0xc736('0xd')](_0xc736('0xe'),_0x58245d,'request\x20sent');logger[_0xc736('0xf')](_0xc736('0x10'),_0x58245d,_0xc736('0x11'),JSON[_0xc736('0x12')](_0x13682d));if(_0x13682d[_0xc736('0x13')]){if(_0x13682d[_0xc736('0x13')][_0xc736('0x14')]===0x1f4){logger[_0xc736('0x13')](_0xc736('0xe'),_0x58245d,_0x13682d[_0xc736('0x13')]['message']);return _0x2935cb(_0x13682d[_0xc736('0x13')][_0xc736('0x15')]);}logger[_0xc736('0x13')](_0xc736('0xe'),_0x58245d,_0x13682d[_0xc736('0x13')][_0xc736('0x15')]);return _0x26e67e(_0x13682d[_0xc736('0x13')]['message']);}else{logger[_0xc736('0xd')](_0xc736('0xe'),_0x58245d,_0xc736('0x11'));_0x26e67e(_0x13682d[_0xc736('0x16')][_0xc736('0x15')]);}})[_0xc736('0x17')](function(_0x107826){logger[_0xc736('0x13')](_0xc736('0xe'),_0x58245d,_0x107826);_0x2935cb(_0x107826);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 3ba3978..4eb0c64 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 _0x395f=['index','show','post','create','put','/:id','delete','destroy','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x36290e,_0x328f43){var _0x56eba4=function(_0x42369c){while(--_0x42369c){_0x36290e['push'](_0x36290e['shift']());}};_0x56eba4(++_0x328f43);}(_0x395f,0x1a8));var _0xf395=function(_0x32957d,_0x3266d1){_0x32957d=_0x32957d-0x0;var _0x82d9d7=_0x395f[_0x32957d];return _0x82d9d7;};'use strict';var multer=require(_0xf395('0x0'));var util=require(_0xf395('0x1'));var path=require('path');var timeout=require(_0xf395('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf395('0x3'));var auth=require(_0xf395('0x4'));var interaction=require(_0xf395('0x5'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0xf395('0x6')]('/',auth[_0xf395('0x7')](),controller[_0xf395('0x8')]);router[_0xf395('0x6')]('/:id',auth[_0xf395('0x7')](),controller[_0xf395('0x9')]);router[_0xf395('0xa')]('/',auth[_0xf395('0x7')](),controller[_0xf395('0xb')]);router[_0xf395('0xc')](_0xf395('0xd'),auth[_0xf395('0x7')](),controller['update']);router[_0xf395('0xe')](_0xf395('0xd'),auth[_0xf395('0x7')](),controller[_0xf395('0xf')]);module['exports']=router; \ No newline at end of file +var _0xf363=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','post','destroy','exports','util','path','connect-timeout'];(function(_0x24972e,_0x47ca8a){var _0x5bd9f4=function(_0x188785){while(--_0x188785){_0x24972e['push'](_0x24972e['shift']());}};_0x5bd9f4(++_0x47ca8a);}(_0xf363,0x151));var _0x3f36=function(_0x284111,_0x36ee82){_0x284111=_0x284111-0x0;var _0x54c9ec=_0xf363[_0x284111];return _0x54c9ec;};'use strict';var multer=require('multer');var util=require(_0x3f36('0x0'));var path=require(_0x3f36('0x1'));var timeout=require(_0x3f36('0x2'));var express=require(_0x3f36('0x3'));var router=express[_0x3f36('0x4')]();var fs_extra=require(_0x3f36('0x5'));var auth=require(_0x3f36('0x6'));var interaction=require(_0x3f36('0x7'));var config=require(_0x3f36('0x8'));var controller=require(_0x3f36('0x9'));router[_0x3f36('0xa')]('/',auth[_0x3f36('0xb')](),controller[_0x3f36('0xc')]);router[_0x3f36('0xa')](_0x3f36('0xd'),auth[_0x3f36('0xb')](),controller['show']);router[_0x3f36('0xe')]('/',auth[_0x3f36('0xb')](),controller['create']);router['put'](_0x3f36('0xd'),auth[_0x3f36('0xb')](),controller['update']);router['delete'](_0x3f36('0xd'),auth['isAuthenticated'](),controller[_0x3f36('0xf')]);module[_0x3f36('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index a6ae050..04135e7 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 _0xcf83=['STRING','customVariable','string','keyValue','picklist'];(function(_0x7881e1,_0x22fd9a){var _0x3f051d=function(_0x57768c){while(--_0x57768c){_0x7881e1['push'](_0x7881e1['shift']());}};_0x3f051d(++_0x22fd9a);}(_0xcf83,0xf2));var _0x3cf8=function(_0x1aaa79,_0x310c50){_0x1aaa79=_0x1aaa79-0x0;var _0x59a250=_0xcf83[_0x1aaa79];return _0x59a250;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x3cf8('0x0'),'variable','customVariable',_0x3cf8('0x1'),_0x3cf8('0x2')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3cf8('0x3')]},'key':{'type':Sequelize[_0x3cf8('0x3')]},'keyType':{'type':Sequelize['ENUM'](_0x3cf8('0x0'),'variable',_0x3cf8('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3cf8('0x3')]},'nameField':{'type':Sequelize[_0x3cf8('0x3')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3cf8('0x3')]}}; \ No newline at end of file +var _0x4a09=['string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x23292a,_0x1e08ea){var _0x4564f2=function(_0x1ae201){while(--_0x1ae201){_0x23292a['push'](_0x23292a['shift']());}};_0x4564f2(++_0x1e08ea);}(_0x4a09,0x11e));var _0x94a0=function(_0x3876f3,_0x386f6c){_0x3876f3=_0x3876f3-0x0;var _0x234041=_0x4a09[_0x3876f3];return _0x234041;};'use strict';var Sequelize=require(_0x94a0('0x0'));module['exports']={'type':{'type':Sequelize[_0x94a0('0x1')](_0x94a0('0x2'),_0x94a0('0x3'),_0x94a0('0x4'),'keyValue',_0x94a0('0x5')),'defaultValue':_0x94a0('0x2')},'content':{'type':Sequelize[_0x94a0('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x94a0('0x1')](_0x94a0('0x2'),'variable',_0x94a0('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x94a0('0x6')]},'customField':{'type':Sequelize[_0x94a0('0x7')],'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 d8245ba..bf138f4 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 _0x92ba=['name','send','index','map','ServicenowField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','error'];(function(_0x2cdb07,_0x2b9f74){var _0x1ad170=function(_0x5d1015){while(--_0x5d1015){_0x2cdb07['push'](_0x2cdb07['shift']());}};_0x1ad170(++_0x2b9f74);}(_0x92ba,0x1e1));var _0xa92b=function(_0x531e8f,_0x1bd935){_0x531e8f=_0x531e8f-0x0;var _0x2c79e9=_0x92ba[_0x531e8f];return _0x2c79e9;};'use strict';var emlformat=require(_0xa92b('0x0'));var rimraf=require(_0xa92b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa92b('0x2'));var rp=require(_0xa92b('0x3'));var moment=require(_0xa92b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa92b('0x5'));var util=require(_0xa92b('0x6'));var path=require(_0xa92b('0x7'));var sox=require(_0xa92b('0x8'));var csv=require('to-csv');var ejs=require(_0xa92b('0x9'));var fs=require('fs');var fs_extra=require(_0xa92b('0xa'));var _=require(_0xa92b('0xb'));var squel=require(_0xa92b('0xc'));var crypto=require(_0xa92b('0xd'));var jsforce=require(_0xa92b('0xe'));var deskjs=require(_0xa92b('0xf'));var toCsv=require(_0xa92b('0x10'));var querystring=require(_0xa92b('0x11'));var Papa=require(_0xa92b('0x12'));var Redis=require(_0xa92b('0x13'));var authService=require(_0xa92b('0x14'));var qs=require(_0xa92b('0x15'));var as=require(_0xa92b('0x16'));var hardwareService=require(_0xa92b('0x17'));var logger=require(_0xa92b('0x18'))('api');var utils=require(_0xa92b('0x19'));var config=require(_0xa92b('0x1a'));var licenseUtil=require(_0xa92b('0x1b'));var db=require(_0xa92b('0x1c'))['db'];function respondWithStatusCode(_0x26e7a7,_0x3b5cb9){_0x3b5cb9=_0x3b5cb9||0xcc;return function(_0x2cf83b){if(_0x2cf83b){return _0x26e7a7[_0xa92b('0x1d')](_0x3b5cb9);}return _0x26e7a7[_0xa92b('0x1e')](_0x3b5cb9)[_0xa92b('0x1f')]();};}function respondWithResult(_0xe273f7,_0x2e72af){_0x2e72af=_0x2e72af||0xc8;return function(_0x30b602){if(_0x30b602){return _0xe273f7[_0xa92b('0x1e')](_0x2e72af)[_0xa92b('0x20')](_0x30b602);}};}function respondWithFilteredResult(_0x13fc6f,_0x197523){return function(_0xdf4713){if(_0xdf4713){var _0x37fa3c=typeof _0x197523[_0xa92b('0x21')]==='undefined'&&typeof _0x197523[_0xa92b('0x22')]===_0xa92b('0x23');var _0x401f91=_0xdf4713[_0xa92b('0x24')];var _0x46894a=_0x37fa3c?0x0:_0x197523[_0xa92b('0x21')];var _0x5383ea=_0x37fa3c?_0xdf4713[_0xa92b('0x24')]:_0x197523[_0xa92b('0x21')]+_0x197523[_0xa92b('0x22')];var _0x382eb5;if(_0x5383ea>=_0x401f91){_0x5383ea=_0x401f91;_0x382eb5=0xc8;}else{_0x382eb5=0xce;}_0x13fc6f[_0xa92b('0x1e')](_0x382eb5);return _0x13fc6f['set'](_0xa92b('0x25'),_0x46894a+'-'+_0x5383ea+'/'+_0x401f91)[_0xa92b('0x20')](_0xdf4713);}return null;};}function patchUpdates(_0x19318a){return function(_0x29f52f){try{jsonpatch[_0xa92b('0x26')](_0x29f52f,_0x19318a,!![]);}catch(_0x5e60f0){return BPromise[_0xa92b('0x27')](_0x5e60f0);}return _0x29f52f[_0xa92b('0x28')]();};}function saveUpdates(_0x4e047f,_0x52b5f7){return function(_0x32bfd7){if(_0x32bfd7){return _0x32bfd7[_0xa92b('0x29')](_0x4e047f)['then'](function(_0x161c55){return _0x161c55;});}return null;};}function removeEntity(_0xe3adf2,_0x35191e){return function(_0x5169ef){if(_0x5169ef){return _0x5169ef['destroy']()[_0xa92b('0x2a')](function(){_0xe3adf2[_0xa92b('0x1e')](0xcc)[_0xa92b('0x1f')]();});}};}function handleEntityNotFound(_0x4be030,_0xd8eb03){return function(_0x3a2df3){if(!_0x3a2df3){_0x4be030[_0xa92b('0x1d')](0x194);}return _0x3a2df3;};}function handleError(_0x4b35eb,_0x55e473){_0x55e473=_0x55e473||0x1f4;return function(_0x44ecc5){logger[_0xa92b('0x2b')](_0x44ecc5['stack']);if(_0x44ecc5[_0xa92b('0x2c')]){delete _0x44ecc5[_0xa92b('0x2c')];}_0x4b35eb[_0xa92b('0x1e')](_0x55e473)[_0xa92b('0x2d')](_0x44ecc5);};}exports[_0xa92b('0x2e')]=function(_0x5f3295,_0x166113){var _0x240681={},_0x18fb82={},_0x31a952={'count':0x0,'rows':[]};var _0x16d2a5=_[_0xa92b('0x2f')](db[_0xa92b('0x30')][_0xa92b('0x31')],function(_0x1233ae){return{'name':_0x1233ae['fieldName'],'type':_0x1233ae[_0xa92b('0x32')][_0xa92b('0x33')]};});_0x18fb82[_0xa92b('0x34')]=_[_0xa92b('0x2f')](_0x16d2a5,_0xa92b('0x2c'));_0x18fb82[_0xa92b('0x35')]=_[_0xa92b('0x36')](_0x5f3295['query']);_0x18fb82[_0xa92b('0x37')]=_[_0xa92b('0x38')](_0x18fb82[_0xa92b('0x34')],_0x18fb82[_0xa92b('0x35')]);_0x240681['attributes']=_[_0xa92b('0x38')](_0x18fb82[_0xa92b('0x34')],qs[_0xa92b('0x39')](_0x5f3295['query'][_0xa92b('0x39')]));_0x240681['attributes']=_0x240681[_0xa92b('0x3a')]['length']?_0x240681[_0xa92b('0x3a')]:_0x18fb82[_0xa92b('0x34')];if(!_0x5f3295['query'][_0xa92b('0x3b')](_0xa92b('0x3c'))){_0x240681[_0xa92b('0x22')]=qs['limit'](_0x5f3295[_0xa92b('0x35')][_0xa92b('0x22')]);_0x240681[_0xa92b('0x21')]=qs[_0xa92b('0x21')](_0x5f3295[_0xa92b('0x35')]['offset']);}_0x240681['order']=qs['sort'](_0x5f3295['query']['sort']);_0x240681[_0xa92b('0x3d')]=qs[_0xa92b('0x37')](_[_0xa92b('0x3e')](_0x5f3295[_0xa92b('0x35')],_0x18fb82[_0xa92b('0x37')]),_0x16d2a5);if(_0x5f3295[_0xa92b('0x35')][_0xa92b('0x3f')]){_0x240681[_0xa92b('0x3d')]=_[_0xa92b('0x40')](_0x240681['where'],{'$or':_['map'](_0x16d2a5,function(_0x35d7de){if(_0x35d7de[_0xa92b('0x32')]!==_0xa92b('0x41')){var _0x63504d={};_0x63504d[_0x35d7de['name']]={'$like':'%'+_0x5f3295[_0xa92b('0x35')][_0xa92b('0x3f')]+'%'};return _0x63504d;}})});}_0x240681=_['merge']({},_0x240681,_0x5f3295[_0xa92b('0x42')]);var _0x39a207={'where':_0x240681[_0xa92b('0x3d')]};return db[_0xa92b('0x30')][_0xa92b('0x24')](_0x39a207)[_0xa92b('0x2a')](function(_0x336373){_0x31a952[_0xa92b('0x24')]=_0x336373;if(_0x5f3295[_0xa92b('0x35')]['includeAll']){_0x240681[_0xa92b('0x43')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x240681);})[_0xa92b('0x2a')](function(_0x12a2d3){_0x31a952[_0xa92b('0x44')]=_0x12a2d3;return _0x31a952;})[_0xa92b('0x2a')](respondWithFilteredResult(_0x166113,_0x240681))[_0xa92b('0x45')](handleError(_0x166113,null));};exports[_0xa92b('0x46')]=function(_0x50ed53,_0x648949){var _0x160b8f={'raw':!![],'where':{'id':_0x50ed53['params']['id']}},_0x44796c={};_0x44796c[_0xa92b('0x34')]=_['keys'](db[_0xa92b('0x30')][_0xa92b('0x31')]);_0x44796c[_0xa92b('0x35')]=_['keys'](_0x50ed53['query']);_0x44796c['filters']=_[_0xa92b('0x38')](_0x44796c[_0xa92b('0x34')],_0x44796c['query']);_0x160b8f[_0xa92b('0x3a')]=_[_0xa92b('0x38')](_0x44796c[_0xa92b('0x34')],qs[_0xa92b('0x39')](_0x50ed53[_0xa92b('0x35')][_0xa92b('0x39')]));_0x160b8f[_0xa92b('0x3a')]=_0x160b8f['attributes']['length']?_0x160b8f['attributes']:_0x44796c[_0xa92b('0x34')];if(_0x50ed53['query']['includeAll']){_0x160b8f[_0xa92b('0x43')]=[{'all':!![]}];}_0x160b8f=_[_0xa92b('0x40')]({},_0x160b8f,_0x50ed53['options']);return db[_0xa92b('0x30')]['find'](_0x160b8f)[_0xa92b('0x2a')](handleEntityNotFound(_0x648949,null))[_0xa92b('0x2a')](respondWithResult(_0x648949,null))[_0xa92b('0x45')](handleError(_0x648949,null));};exports[_0xa92b('0x47')]=function(_0x323d89,_0x21e398){return db[_0xa92b('0x30')]['create'](_0x323d89[_0xa92b('0x48')],{})[_0xa92b('0x2a')](respondWithResult(_0x21e398,0xc9))[_0xa92b('0x45')](handleError(_0x21e398,null));};exports[_0xa92b('0x29')]=function(_0xd1de3b,_0x998720){if(_0xd1de3b[_0xa92b('0x48')]['id']){delete _0xd1de3b['body']['id'];}return db[_0xa92b('0x30')][_0xa92b('0x49')]({'where':{'id':_0xd1de3b['params']['id']}})['then'](handleEntityNotFound(_0x998720,null))['then'](saveUpdates(_0xd1de3b[_0xa92b('0x48')],null))['then'](respondWithResult(_0x998720,null))[_0xa92b('0x45')](handleError(_0x998720,null));};exports['destroy']=function(_0x41b413,_0x2da094){return db[_0xa92b('0x30')][_0xa92b('0x49')]({'where':{'id':_0x41b413[_0xa92b('0x4a')]['id']}})[_0xa92b('0x2a')](handleEntityNotFound(_0x2da094,null))[_0xa92b('0x2a')](removeEntity(_0x2da094,null))[_0xa92b('0x45')](handleError(_0x2da094,null));}; \ No newline at end of file +var _0xc220=['where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','order','sort'];(function(_0x3154b0,_0x2a6e80){var _0x28bde7=function(_0x27cdba){while(--_0x27cdba){_0x3154b0['push'](_0x3154b0['shift']());}};_0x28bde7(++_0x2a6e80);}(_0xc220,0x13f));var _0x0c22=function(_0x6f77bb,_0x1d9726){_0x6f77bb=_0x6f77bb-0x0;var _0x2fee3c=_0xc220[_0x6f77bb];return _0x2fee3c;};'use strict';var emlformat=require(_0x0c22('0x0'));var rimraf=require(_0x0c22('0x1'));var zipdir=require(_0x0c22('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0c22('0x3'));var moment=require(_0x0c22('0x4'));var BPromise=require(_0x0c22('0x5'));var Mustache=require(_0x0c22('0x6'));var util=require('util');var path=require(_0x0c22('0x7'));var sox=require(_0x0c22('0x8'));var csv=require(_0x0c22('0x9'));var ejs=require(_0x0c22('0xa'));var fs=require('fs');var fs_extra=require(_0x0c22('0xb'));var _=require(_0x0c22('0xc'));var squel=require(_0x0c22('0xd'));var crypto=require('crypto');var jsforce=require(_0x0c22('0xe'));var deskjs=require(_0x0c22('0xf'));var toCsv=require(_0x0c22('0x9'));var querystring=require(_0x0c22('0x10'));var Papa=require(_0x0c22('0x11'));var Redis=require(_0x0c22('0x12'));var authService=require(_0x0c22('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c22('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0c22('0x15'));var licenseUtil=require(_0x0c22('0x16'));var db=require(_0x0c22('0x17'))['db'];function respondWithStatusCode(_0x4d7a47,_0x2f7732){_0x2f7732=_0x2f7732||0xcc;return function(_0x4fb8cd){if(_0x4fb8cd){return _0x4d7a47['sendStatus'](_0x2f7732);}return _0x4d7a47[_0x0c22('0x18')](_0x2f7732)['end']();};}function respondWithResult(_0x1953d5,_0x1e74e6){_0x1e74e6=_0x1e74e6||0xc8;return function(_0x2bc9a9){if(_0x2bc9a9){return _0x1953d5[_0x0c22('0x18')](_0x1e74e6)[_0x0c22('0x19')](_0x2bc9a9);}};}function respondWithFilteredResult(_0x446797,_0x357322){return function(_0x19098d){if(_0x19098d){var _0x520564=typeof _0x357322['offset']===_0x0c22('0x1a')&&typeof _0x357322[_0x0c22('0x1b')]===_0x0c22('0x1a');var _0xfa1585=_0x19098d[_0x0c22('0x1c')];var _0x45c092=_0x520564?0x0:_0x357322[_0x0c22('0x1d')];var _0x4d8e70=_0x520564?_0x19098d['count']:_0x357322[_0x0c22('0x1d')]+_0x357322[_0x0c22('0x1b')];var _0x32aca2;if(_0x4d8e70>=_0xfa1585){_0x4d8e70=_0xfa1585;_0x32aca2=0xc8;}else{_0x32aca2=0xce;}_0x446797[_0x0c22('0x18')](_0x32aca2);return _0x446797[_0x0c22('0x1e')](_0x0c22('0x1f'),_0x45c092+'-'+_0x4d8e70+'/'+_0xfa1585)[_0x0c22('0x19')](_0x19098d);}return null;};}function patchUpdates(_0x351b58){return function(_0x1dc48d){try{jsonpatch[_0x0c22('0x20')](_0x1dc48d,_0x351b58,!![]);}catch(_0x5a17de){return BPromise[_0x0c22('0x21')](_0x5a17de);}return _0x1dc48d[_0x0c22('0x22')]();};}function saveUpdates(_0x3667fc,_0x2e9a67){return function(_0x8e75c0){if(_0x8e75c0){return _0x8e75c0[_0x0c22('0x23')](_0x3667fc)[_0x0c22('0x24')](function(_0x3d3303){return _0x3d3303;});}return null;};}function removeEntity(_0x6f8a0b,_0x184211){return function(_0x212bdb){if(_0x212bdb){return _0x212bdb[_0x0c22('0x25')]()['then'](function(){_0x6f8a0b['status'](0xcc)[_0x0c22('0x26')]();});}};}function handleEntityNotFound(_0x124f0f,_0x5eeac1){return function(_0x42e954){if(!_0x42e954){_0x124f0f[_0x0c22('0x27')](0x194);}return _0x42e954;};}function handleError(_0x143709,_0x35bf21){_0x35bf21=_0x35bf21||0x1f4;return function(_0x48ad35){logger[_0x0c22('0x28')](_0x48ad35[_0x0c22('0x29')]);if(_0x48ad35[_0x0c22('0x2a')]){delete _0x48ad35[_0x0c22('0x2a')];}_0x143709[_0x0c22('0x18')](_0x35bf21)[_0x0c22('0x2b')](_0x48ad35);};}exports[_0x0c22('0x2c')]=function(_0x48221d,_0x33b14b){var _0x14dc92={},_0x3b6ea5={},_0x3f4fdf={'count':0x0,'rows':[]};var _0x241b6b=_[_0x0c22('0x2d')](db[_0x0c22('0x2e')][_0x0c22('0x2f')],function(_0x317d7a){return{'name':_0x317d7a[_0x0c22('0x30')],'type':_0x317d7a[_0x0c22('0x31')][_0x0c22('0x32')]};});_0x3b6ea5[_0x0c22('0x33')]=_[_0x0c22('0x2d')](_0x241b6b,_0x0c22('0x2a'));_0x3b6ea5['query']=_[_0x0c22('0x34')](_0x48221d[_0x0c22('0x35')]);_0x3b6ea5[_0x0c22('0x36')]=_['intersection'](_0x3b6ea5[_0x0c22('0x33')],_0x3b6ea5[_0x0c22('0x35')]);_0x14dc92[_0x0c22('0x37')]=_[_0x0c22('0x38')](_0x3b6ea5[_0x0c22('0x33')],qs[_0x0c22('0x39')](_0x48221d['query'][_0x0c22('0x39')]));_0x14dc92[_0x0c22('0x37')]=_0x14dc92[_0x0c22('0x37')][_0x0c22('0x3a')]?_0x14dc92[_0x0c22('0x37')]:_0x3b6ea5[_0x0c22('0x33')];if(!_0x48221d[_0x0c22('0x35')]['hasOwnProperty']('nolimit')){_0x14dc92[_0x0c22('0x1b')]=qs[_0x0c22('0x1b')](_0x48221d['query']['limit']);_0x14dc92[_0x0c22('0x1d')]=qs[_0x0c22('0x1d')](_0x48221d[_0x0c22('0x35')][_0x0c22('0x1d')]);}_0x14dc92[_0x0c22('0x3b')]=qs[_0x0c22('0x3c')](_0x48221d['query'][_0x0c22('0x3c')]);_0x14dc92[_0x0c22('0x3d')]=qs[_0x0c22('0x36')](_[_0x0c22('0x3e')](_0x48221d['query'],_0x3b6ea5['filters']),_0x241b6b);if(_0x48221d['query'][_0x0c22('0x3f')]){_0x14dc92[_0x0c22('0x3d')]=_[_0x0c22('0x40')](_0x14dc92[_0x0c22('0x3d')],{'$or':_[_0x0c22('0x2d')](_0x241b6b,function(_0x500171){if(_0x500171[_0x0c22('0x31')]!=='VIRTUAL'){var _0x51e063={};_0x51e063[_0x500171[_0x0c22('0x2a')]]={'$like':'%'+_0x48221d[_0x0c22('0x35')][_0x0c22('0x3f')]+'%'};return _0x51e063;}})});}_0x14dc92=_['merge']({},_0x14dc92,_0x48221d['options']);var _0x1ac1b3={'where':_0x14dc92[_0x0c22('0x3d')]};return db[_0x0c22('0x2e')][_0x0c22('0x1c')](_0x1ac1b3)[_0x0c22('0x24')](function(_0xac011e){_0x3f4fdf[_0x0c22('0x1c')]=_0xac011e;if(_0x48221d[_0x0c22('0x35')][_0x0c22('0x41')]){_0x14dc92[_0x0c22('0x42')]=[{'all':!![]}];}return db['ServicenowField'][_0x0c22('0x43')](_0x14dc92);})[_0x0c22('0x24')](function(_0x33e74f){_0x3f4fdf[_0x0c22('0x44')]=_0x33e74f;return _0x3f4fdf;})[_0x0c22('0x24')](respondWithFilteredResult(_0x33b14b,_0x14dc92))[_0x0c22('0x45')](handleError(_0x33b14b,null));};exports[_0x0c22('0x46')]=function(_0x47eaa3,_0x490762){var _0x414c74={'raw':!![],'where':{'id':_0x47eaa3[_0x0c22('0x47')]['id']}},_0x2a351c={};_0x2a351c[_0x0c22('0x33')]=_['keys'](db[_0x0c22('0x2e')][_0x0c22('0x2f')]);_0x2a351c[_0x0c22('0x35')]=_[_0x0c22('0x34')](_0x47eaa3[_0x0c22('0x35')]);_0x2a351c[_0x0c22('0x36')]=_[_0x0c22('0x38')](_0x2a351c[_0x0c22('0x33')],_0x2a351c['query']);_0x414c74[_0x0c22('0x37')]=_[_0x0c22('0x38')](_0x2a351c[_0x0c22('0x33')],qs[_0x0c22('0x39')](_0x47eaa3[_0x0c22('0x35')][_0x0c22('0x39')]));_0x414c74[_0x0c22('0x37')]=_0x414c74[_0x0c22('0x37')][_0x0c22('0x3a')]?_0x414c74[_0x0c22('0x37')]:_0x2a351c[_0x0c22('0x33')];if(_0x47eaa3[_0x0c22('0x35')][_0x0c22('0x41')]){_0x414c74[_0x0c22('0x42')]=[{'all':!![]}];}_0x414c74=_[_0x0c22('0x40')]({},_0x414c74,_0x47eaa3[_0x0c22('0x48')]);return db[_0x0c22('0x2e')][_0x0c22('0x49')](_0x414c74)['then'](handleEntityNotFound(_0x490762,null))[_0x0c22('0x24')](respondWithResult(_0x490762,null))[_0x0c22('0x45')](handleError(_0x490762,null));};exports['create']=function(_0x22d716,_0x4d48fc){return db[_0x0c22('0x2e')][_0x0c22('0x4a')](_0x22d716['body'],{})['then'](respondWithResult(_0x4d48fc,0xc9))[_0x0c22('0x45')](handleError(_0x4d48fc,null));};exports[_0x0c22('0x23')]=function(_0x5286a2,_0xa420fd){if(_0x5286a2[_0x0c22('0x4b')]['id']){delete _0x5286a2[_0x0c22('0x4b')]['id'];}return db[_0x0c22('0x2e')][_0x0c22('0x49')]({'where':{'id':_0x5286a2[_0x0c22('0x47')]['id']}})[_0x0c22('0x24')](handleEntityNotFound(_0xa420fd,null))[_0x0c22('0x24')](saveUpdates(_0x5286a2[_0x0c22('0x4b')],null))[_0x0c22('0x24')](respondWithResult(_0xa420fd,null))['catch'](handleError(_0xa420fd,null));};exports[_0x0c22('0x25')]=function(_0x280d01,_0x3514b8){return db[_0x0c22('0x2e')][_0x0c22('0x49')]({'where':{'id':_0x280d01[_0x0c22('0x47')]['id']}})[_0x0c22('0x24')](handleEntityNotFound(_0x3514b8,null))['then'](removeEntity(_0x3514b8,null))[_0x0c22('0x45')](handleError(_0x3514b8,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index e1f93c7..cbcdb2a 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 _0xcff2=['define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0xde0534,_0x209073){var _0x2e50db=function(_0x5dd2cf){while(--_0x5dd2cf){_0xde0534['push'](_0xde0534['shift']());}};_0x2e50db(++_0x209073);}(_0xcff2,0x131));var _0x2cff=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0xcff2[_0x1b64dd];return _0xeb464c;};'use strict';var _=require(_0x2cff('0x0'));var util=require(_0x2cff('0x1'));var logger=require(_0x2cff('0x2'))(_0x2cff('0x3'));var moment=require(_0x2cff('0x4'));var BPromise=require(_0x2cff('0x5'));var rp=require(_0x2cff('0x6'));var fs=require('fs');var path=require(_0x2cff('0x7'));var rimraf=require('rimraf');var config=require(_0x2cff('0x8'));var attributes=require('./intServicenowField.attributes');module[_0x2cff('0x9')]=function(_0x2145c7,_0x4f5410){return _0x2145c7[_0x2cff('0xa')](_0x2cff('0xb'),attributes,{'tableName':_0x2cff('0xc'),'paranoid':![],'indexes':[{'name':_0x2cff('0xd'),'fields':[_0x2cff('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xae45=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','define','ServicenowField','int_servicenow_fields','idField','FieldId'];(function(_0x598775,_0x271390){var _0xf2ebfc=function(_0x47599a){while(--_0x47599a){_0x598775['push'](_0x598775['shift']());}};_0xf2ebfc(++_0x271390);}(_0xae45,0x118));var _0x5ae4=function(_0x1e95d0,_0x41da82){_0x1e95d0=_0x1e95d0-0x0;var _0x2285f7=_0xae45[_0x1e95d0];return _0x2285f7;};'use strict';var _=require(_0x5ae4('0x0'));var util=require('util');var logger=require(_0x5ae4('0x1'))(_0x5ae4('0x2'));var moment=require(_0x5ae4('0x3'));var BPromise=require(_0x5ae4('0x4'));var rp=require(_0x5ae4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ae4('0x6'));var config=require(_0x5ae4('0x7'));var attributes=require(_0x5ae4('0x8'));module['exports']=function(_0x4e3b5e,_0x3d5b62){return _0x4e3b5e[_0x5ae4('0x9')](_0x5ae4('0xa'),attributes,{'tableName':_0x5ae4('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x5ae4('0xc'),_0x5ae4('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index c78aa82..46cfa01 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x410680,_0x450b2d){var _0x49dc01=function(_0x34cd93){while(--_0x34cd93){_0x410680['push'](_0x410680['shift']());}};_0x49dc01(++_0x450b2d);}(_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 moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x417b30,_0x2546e2){var _0x39eac5=function(_0x8c7a00){while(--_0x8c7a00){_0x417b30['push'](_0x417b30['shift']());}};_0x39eac5(++_0x2546e2);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x47cbd3,_0x169170){_0x47cbd3=_0x47cbd3-0x0;var _0x281bf3=_0x9ffd[_0x47cbd3];return _0x281bf3;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 1d8e96d..6e499ad 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1b1ff6,_0x59c00e){var _0x515356=function(_0x1a5152){while(--_0x1a5152){_0x1b1ff6['push'](_0x1b1ff6['shift']());}};_0x515356(++_0x59c00e);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4efa92,_0x4b6df5){var _0x105c3a=function(_0xc679f6){while(--_0xc679f6){_0x4efa92['push'](_0x4efa92['shift']());}};_0x105c3a(++_0x4b6df5);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 5112bce..a4c5749 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(_0x59716b,_0x1c8fc9){var _0x4b9ddf=function(_0x4ab902){while(--_0x4ab902){_0x59716b['push'](_0x59716b['shift']());}};_0x4b9ddf(++_0x1c8fc9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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(_0xf5e707,_0x5c3fb4){var _0x45facd=function(_0x2e2690){while(--_0x2e2690){_0xf5e707['push'](_0xf5e707['shift']());}};_0x45facd(++_0x5c3fb4);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index d6e9254..6470c73 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 _0xaf6a=['remoteUri','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','JSON','stringify','username','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','get_module_fields','Calls','values','module_fields','includes','label','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','limit','undefined','count','Content-Range','json','apply','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','SugarcrmAccount','include','rows','catch','show','params','options','create','body','find','destroy','findOne','SugarcrmConfiguration','nolimit','getConfigurations','Subjects','getSubjects','getDescriptions','channel','SugarcrmField','getFields','assigned_user_id','date_start','parent_type','parent_name','direction','password'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xaf6a,0x105));var _0xaaf6=function(_0xb9622e,_0x91225d){_0xb9622e=_0xb9622e-0x0;var _0x12969e=_0xaf6a[_0xb9622e];return _0x12969e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaaf6('0x0'));var zipdir=require(_0xaaf6('0x1'));var jsonpatch=require(_0xaaf6('0x2'));var rp=require(_0xaaf6('0x3'));var moment=require(_0xaaf6('0x4'));var BPromise=require(_0xaaf6('0x5'));var Mustache=require('mustache');var util=require(_0xaaf6('0x6'));var path=require(_0xaaf6('0x7'));var sox=require(_0xaaf6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaaf6('0x9'));var _=require(_0xaaf6('0xa'));var squel=require(_0xaaf6('0xb'));var crypto=require(_0xaaf6('0xc'));var jsforce=require(_0xaaf6('0xd'));var deskjs=require(_0xaaf6('0xe'));var toCsv=require(_0xaaf6('0xf'));var querystring=require(_0xaaf6('0x10'));var Papa=require(_0xaaf6('0x11'));var Redis=require(_0xaaf6('0x12'));var authService=require(_0xaaf6('0x13'));var qs=require(_0xaaf6('0x14'));var as=require(_0xaaf6('0x15'));var hardwareService=require(_0xaaf6('0x16'));var logger=require(_0xaaf6('0x17'))(_0xaaf6('0x18'));var utils=require(_0xaaf6('0x19'));var config=require(_0xaaf6('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xaaf6('0x1b'))['db'];var integrations=require(_0xaaf6('0x1c'));function respondWithStatusCode(_0x53d096,_0xb1083f){_0xb1083f=_0xb1083f||0xcc;return function(_0x1583a7){if(_0x1583a7){return _0x53d096[_0xaaf6('0x1d')](_0xb1083f);}return _0x53d096['status'](_0xb1083f)[_0xaaf6('0x1e')]();};}function respondWithResult(_0x1053d0,_0x181126){_0x181126=_0x181126||0xc8;return function(_0x54c99c){if(_0x54c99c){return _0x1053d0[_0xaaf6('0x1f')](_0x181126)['json'](_0x54c99c);}};}function respondWithFilteredResult(_0x3724b8,_0x4634b3){return function(_0x5bce0e){if(_0x5bce0e){var _0x33579e=typeof _0x4634b3[_0xaaf6('0x20')]==='undefined'&&typeof _0x4634b3[_0xaaf6('0x21')]===_0xaaf6('0x22');var _0x421bfa=_0x5bce0e[_0xaaf6('0x23')];var _0x36ed67=_0x33579e?0x0:_0x4634b3['offset'];var _0x6de3d9=_0x33579e?_0x5bce0e[_0xaaf6('0x23')]:_0x4634b3[_0xaaf6('0x20')]+_0x4634b3[_0xaaf6('0x21')];var _0x2f0539;if(_0x6de3d9>=_0x421bfa){_0x6de3d9=_0x421bfa;_0x2f0539=0xc8;}else{_0x2f0539=0xce;}_0x3724b8[_0xaaf6('0x1f')](_0x2f0539);return _0x3724b8['set'](_0xaaf6('0x24'),_0x36ed67+'-'+_0x6de3d9+'/'+_0x421bfa)[_0xaaf6('0x25')](_0x5bce0e);}return null;};}function patchUpdates(_0xca6dbb){return function(_0x25dd1e){try{jsonpatch[_0xaaf6('0x26')](_0x25dd1e,_0xca6dbb,!![]);}catch(_0x4ab975){return BPromise['reject'](_0x4ab975);}return _0x25dd1e['save']();};}function saveUpdates(_0x1cdd79,_0x293b06){return function(_0x5b56c1){if(_0x5b56c1){return _0x5b56c1[_0xaaf6('0x27')](_0x1cdd79)[_0xaaf6('0x28')](function(_0x14c4de){return _0x14c4de;});}return null;};}function removeEntity(_0x41ca10,_0x2e8033){return function(_0x540cfa){if(_0x540cfa){return _0x540cfa['destroy']()[_0xaaf6('0x28')](function(){_0x41ca10[_0xaaf6('0x1f')](0xcc)[_0xaaf6('0x1e')]();});}};}function handleEntityNotFound(_0x2b7698,_0x94f943){return function(_0x178e0e){if(!_0x178e0e){_0x2b7698[_0xaaf6('0x1d')](0x194);}return _0x178e0e;};}function handleError(_0x494966,_0x5c9efc){_0x5c9efc=_0x5c9efc||0x1f4;return function(_0x3738be){logger[_0xaaf6('0x29')](_0x3738be['stack']);if(_0x3738be['name']){delete _0x3738be[_0xaaf6('0x2a')];}_0x494966[_0xaaf6('0x1f')](_0x5c9efc)[_0xaaf6('0x2b')](_0x3738be);};}exports[_0xaaf6('0x2c')]=function(_0x347b23,_0x20818f){var _0x4df504={},_0x30f154={},_0x143fba={'count':0x0,'rows':[]};var _0x391780=_[_0xaaf6('0x2d')](db['SugarcrmAccount'][_0xaaf6('0x2e')],function(_0x3978fc){return{'name':_0x3978fc[_0xaaf6('0x2f')],'type':_0x3978fc[_0xaaf6('0x30')][_0xaaf6('0x31')]};});_0x30f154[_0xaaf6('0x32')]=_[_0xaaf6('0x2d')](_0x391780,'name');_0x30f154['query']=_[_0xaaf6('0x33')](_0x347b23['query']);_0x30f154[_0xaaf6('0x34')]=_[_0xaaf6('0x35')](_0x30f154[_0xaaf6('0x32')],_0x30f154[_0xaaf6('0x36')]);_0x4df504[_0xaaf6('0x37')]=_[_0xaaf6('0x35')](_0x30f154[_0xaaf6('0x32')],qs['fields'](_0x347b23['query'][_0xaaf6('0x38')]));_0x4df504[_0xaaf6('0x37')]=_0x4df504[_0xaaf6('0x37')][_0xaaf6('0x39')]?_0x4df504[_0xaaf6('0x37')]:_0x30f154[_0xaaf6('0x32')];if(!_0x347b23[_0xaaf6('0x36')][_0xaaf6('0x3a')]('nolimit')){_0x4df504[_0xaaf6('0x21')]=qs[_0xaaf6('0x21')](_0x347b23[_0xaaf6('0x36')]['limit']);_0x4df504[_0xaaf6('0x20')]=qs[_0xaaf6('0x20')](_0x347b23[_0xaaf6('0x36')]['offset']);}_0x4df504[_0xaaf6('0x3b')]=qs['sort'](_0x347b23['query'][_0xaaf6('0x3c')]);_0x4df504[_0xaaf6('0x3d')]=qs['filters'](_[_0xaaf6('0x3e')](_0x347b23[_0xaaf6('0x36')],_0x30f154['filters']),_0x391780);if(_0x347b23[_0xaaf6('0x36')][_0xaaf6('0x3f')]){_0x4df504['where']=_[_0xaaf6('0x40')](_0x4df504[_0xaaf6('0x3d')],{'$or':_[_0xaaf6('0x2d')](_0x391780,function(_0x464efa){if(_0x464efa[_0xaaf6('0x30')]!==_0xaaf6('0x41')){var _0x45699f={};_0x45699f[_0x464efa[_0xaaf6('0x2a')]]={'$like':'%'+_0x347b23['query'][_0xaaf6('0x3f')]+'%'};return _0x45699f;}})});}_0x4df504=_['merge']({},_0x4df504,_0x347b23['options']);var _0x28dcc6={'where':_0x4df504[_0xaaf6('0x3d')]};return db[_0xaaf6('0x42')][_0xaaf6('0x23')](_0x28dcc6)[_0xaaf6('0x28')](function(_0x22fbe3){_0x143fba['count']=_0x22fbe3;if(_0x347b23[_0xaaf6('0x36')]['includeAll']){_0x4df504[_0xaaf6('0x43')]=[{'all':!![]}];}return db['SugarcrmAccount']['findAll'](_0x4df504);})[_0xaaf6('0x28')](function(_0x4dfeb8){_0x143fba[_0xaaf6('0x44')]=_0x4dfeb8;return _0x143fba;})[_0xaaf6('0x28')](respondWithFilteredResult(_0x20818f,_0x4df504))[_0xaaf6('0x45')](handleError(_0x20818f,null));};exports[_0xaaf6('0x46')]=function(_0x1228d8,_0x3bf08f){var _0x409c52={'raw':![],'where':{'id':_0x1228d8[_0xaaf6('0x47')]['id']}},_0x3a819a={};_0x3a819a[_0xaaf6('0x32')]=_[_0xaaf6('0x33')](db['SugarcrmAccount']['rawAttributes']);_0x3a819a[_0xaaf6('0x36')]=_[_0xaaf6('0x33')](_0x1228d8[_0xaaf6('0x36')]);_0x3a819a[_0xaaf6('0x34')]=_[_0xaaf6('0x35')](_0x3a819a[_0xaaf6('0x32')],_0x3a819a[_0xaaf6('0x36')]);_0x409c52[_0xaaf6('0x37')]=_[_0xaaf6('0x35')](_0x3a819a[_0xaaf6('0x32')],qs[_0xaaf6('0x38')](_0x1228d8[_0xaaf6('0x36')]['fields']));_0x409c52[_0xaaf6('0x37')]=_0x409c52[_0xaaf6('0x37')][_0xaaf6('0x39')]?_0x409c52[_0xaaf6('0x37')]:_0x3a819a[_0xaaf6('0x32')];if(_0x1228d8[_0xaaf6('0x36')]['includeAll']){_0x409c52[_0xaaf6('0x43')]=[{'all':!![]}];}_0x409c52=_[_0xaaf6('0x40')]({},_0x409c52,_0x1228d8[_0xaaf6('0x48')]);return db[_0xaaf6('0x42')]['find'](_0x409c52)[_0xaaf6('0x28')](handleEntityNotFound(_0x3bf08f,null))['then'](respondWithResult(_0x3bf08f,null))[_0xaaf6('0x45')](handleError(_0x3bf08f,null));};exports[_0xaaf6('0x49')]=function(_0x465854,_0x2ea159){return db[_0xaaf6('0x42')][_0xaaf6('0x49')](_0x465854[_0xaaf6('0x4a')],{})[_0xaaf6('0x28')](respondWithResult(_0x2ea159,0xc9))[_0xaaf6('0x45')](handleError(_0x2ea159,null));};exports['update']=function(_0x30539c,_0x4412aa){if(_0x30539c[_0xaaf6('0x4a')]['id']){delete _0x30539c[_0xaaf6('0x4a')]['id'];}return db[_0xaaf6('0x42')][_0xaaf6('0x4b')]({'where':{'id':_0x30539c[_0xaaf6('0x47')]['id']}})[_0xaaf6('0x28')](handleEntityNotFound(_0x4412aa,null))[_0xaaf6('0x28')](saveUpdates(_0x30539c['body'],null))[_0xaaf6('0x28')](respondWithResult(_0x4412aa,null))[_0xaaf6('0x45')](handleError(_0x4412aa,null));};exports[_0xaaf6('0x4c')]=function(_0x16c70a,_0x8541b9){return db[_0xaaf6('0x42')][_0xaaf6('0x4b')]({'where':{'id':_0x16c70a[_0xaaf6('0x47')]['id']}})[_0xaaf6('0x28')](handleEntityNotFound(_0x8541b9,null))[_0xaaf6('0x28')](removeEntity(_0x8541b9,null))[_0xaaf6('0x45')](handleError(_0x8541b9,null));};exports['getConfigurations']=function(_0x5ee9b2,_0xd2771e,_0x546900){var _0x141dc2={};var _0x56e744={};var _0x2e39ef;var _0xb6a1a2;return db[_0xaaf6('0x42')][_0xaaf6('0x4d')]({'where':{'id':_0x5ee9b2[_0xaaf6('0x47')]['id']}})[_0xaaf6('0x28')](handleEntityNotFound(_0xd2771e,null))[_0xaaf6('0x28')](function(_0x4eea01){if(_0x4eea01){_0x2e39ef=_0x4eea01;_0x56e744[_0xaaf6('0x32')]=_[_0xaaf6('0x33')](db[_0xaaf6('0x4e')]['rawAttributes']);_0x56e744[_0xaaf6('0x36')]=_[_0xaaf6('0x33')](_0x5ee9b2['query']);_0x56e744['filters']=_[_0xaaf6('0x35')](_0x56e744[_0xaaf6('0x32')],_0x56e744['query']);_0x141dc2[_0xaaf6('0x37')]=_[_0xaaf6('0x35')](_0x56e744['model'],qs[_0xaaf6('0x38')](_0x5ee9b2['query'][_0xaaf6('0x38')]));_0x141dc2[_0xaaf6('0x37')]=_0x141dc2[_0xaaf6('0x37')][_0xaaf6('0x39')]?_0x141dc2[_0xaaf6('0x37')]:_0x56e744[_0xaaf6('0x32')];_0x141dc2[_0xaaf6('0x3b')]=qs['sort'](_0x5ee9b2['query']['sort']);_0x141dc2[_0xaaf6('0x3d')]=qs[_0xaaf6('0x34')](_[_0xaaf6('0x3e')](_0x5ee9b2[_0xaaf6('0x36')],_0x56e744[_0xaaf6('0x34')]));if(_0x5ee9b2[_0xaaf6('0x36')][_0xaaf6('0x3f')]){_0x141dc2[_0xaaf6('0x3d')]=_['merge'](_0x141dc2[_0xaaf6('0x3d')],{'$or':_[_0xaaf6('0x2d')](_0x141dc2['attributes'],function(_0x420429){var _0x58c32f={};_0x58c32f[_0x420429]={'$like':'%'+_0x5ee9b2[_0xaaf6('0x36')][_0xaaf6('0x3f')]+'%'};return _0x58c32f;})});}_0x141dc2=_[_0xaaf6('0x40')]({},_0x141dc2,_0x5ee9b2['options']);return _0x2e39ef['getConfigurations'](_0x141dc2);}})['then'](function(_0xc26874){if(_0xc26874){_0xb6a1a2=_0xc26874[_0xaaf6('0x39')];if(!_0x5ee9b2[_0xaaf6('0x36')][_0xaaf6('0x3a')](_0xaaf6('0x4f'))){_0x141dc2['limit']=qs['limit'](_0x5ee9b2['query'][_0xaaf6('0x21')]);_0x141dc2[_0xaaf6('0x20')]=qs['offset'](_0x5ee9b2[_0xaaf6('0x36')][_0xaaf6('0x20')]);}return _0x2e39ef[_0xaaf6('0x50')](_0x141dc2);}})['then'](function(_0x1ab608){if(_0x1ab608){return _0x1ab608?{'count':_0xb6a1a2,'rows':_0x1ab608}:null;}})['then'](respondWithResult(_0xd2771e,null))[_0xaaf6('0x45')](handleError(_0xd2771e,null));};exports['addConfiguration']=function(_0xdac63b,_0x19b4bd,_0x23ac98){if(_0xdac63b[_0xaaf6('0x4a')]['id']){delete _0xdac63b['body']['id'];}return db[_0xaaf6('0x42')][_0xaaf6('0x4d')]({'where':{'id':_0xdac63b['params']['id']}})[_0xaaf6('0x28')](handleEntityNotFound(_0x19b4bd,null))[_0xaaf6('0x28')](function(_0x2b2947){if(_0x2b2947){_0xdac63b[_0xaaf6('0x4a')]['AccountId']=_0x2b2947['id'];_0xdac63b[_0xaaf6('0x4a')][_0xaaf6('0x51')]=integrations[_0xaaf6('0x52')](_0xdac63b[_0xaaf6('0x4a')]['channel'],_0xdac63b[_0xaaf6('0x4a')][_0xaaf6('0x30')]);_0xdac63b[_0xaaf6('0x4a')]['Descriptions']=integrations[_0xaaf6('0x53')](_0xdac63b['body'][_0xaaf6('0x54')],_0xdac63b[_0xaaf6('0x4a')][_0xaaf6('0x30')]);return db[_0xaaf6('0x4e')]['create'](_0xdac63b[_0xaaf6('0x4a')],{'include':[{'model':db[_0xaaf6('0x55')],'as':_0xaaf6('0x51')},{'model':db[_0xaaf6('0x55')],'as':'Descriptions'}]});}return null;})[_0xaaf6('0x28')](respondWithResult(_0x19b4bd,null))[_0xaaf6('0x45')](handleError(_0x19b4bd,null));};exports[_0xaaf6('0x56')]=function(_0x138d2c,_0x2e33f6,_0x4f3a55){var _0x54b730='';var _0x5c3984=['id',_0xaaf6('0x2a'),_0xaaf6('0x57'),'created_by','description',_0xaaf6('0x58'),'duration_hours','duration_minutes','parent_id',_0xaaf6('0x59'),_0xaaf6('0x5a'),_0xaaf6('0x5b')];return db['SugarcrmAccount'][_0xaaf6('0x4d')]({'where':{'id':_0x138d2c[_0xaaf6('0x47')]['id']},'attributes':['id','username',_0xaaf6('0x5c'),'remoteUri']})[_0xaaf6('0x28')](handleEntityNotFound(_0x2e33f6,null))[_0xaaf6('0x28')](function(_0x84cde2){if(_0x84cde2){_0x54b730=_0x84cde2[_0xaaf6('0x5d')];var _0x34b97a=_0x54b730[_0xaaf6('0x5e')](-0x1);if(_0x34b97a==='/'){_0x54b730=_0x54b730[_0xaaf6('0x5f')](0x0,_0x54b730[_0xaaf6('0x60')](_0x34b97a));}return rp({'method':'POST','uri':util[_0xaaf6('0x61')](_0xaaf6('0x62'),_0x54b730,_0xaaf6('0x63')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0xaaf6('0x64'),'rest_data':JSON[_0xaaf6('0x65')]({'user_auth':{'user_name':_0x84cde2[_0xaaf6('0x66')],'password':_0x84cde2['password'],'encryption':'PLAIN'},'application':_0xaaf6('0x67')})}});}})[_0xaaf6('0x28')](function(_0x634f9c){if(_0x634f9c&&_0x634f9c[_0xaaf6('0x2a')]!==_0xaaf6('0x68')&&_0x634f9c[_0xaaf6('0x2a')]!==_0xaaf6('0x69')){return rp({'method':_0xaaf6('0x6a'),'uri':util[_0xaaf6('0x61')](_0xaaf6('0x62'),_0x54b730,_0xaaf6('0x63')),'json':!![],'form':{'method':_0xaaf6('0x6b'),'input_type':_0xaaf6('0x64'),'response_type':_0xaaf6('0x64'),'rest_data':JSON[_0xaaf6('0x65')]({'session':_0x634f9c['id'],'module_name':_0xaaf6('0x6c')})}})[_0xaaf6('0x28')](function(_0x288790){if(_0x288790){var _0x4de6f8=_[_0xaaf6('0x6d')](_0x288790[_0xaaf6('0x6e')]);_['remove'](_0x4de6f8,function(_0x3cb591){return _0x5c3984[_0xaaf6('0x6f')](_0x3cb591[_0xaaf6('0x2a')]);});return{'count':_0x4de6f8[_0xaaf6('0x39')],'rows':_[_0xaaf6('0x2d')](_0x4de6f8,function(_0x4a5ba8){return{'id':_0x4a5ba8[_0xaaf6('0x2a')],'name':_0x4a5ba8[_0xaaf6('0x70')],'custom':_['endsWith'](_0x4a5ba8[_0xaaf6('0x2a')],'_c')?!![]:![],'options':_0x4a5ba8[_0xaaf6('0x48')]?_[_0xaaf6('0x2d')](_[_0xaaf6('0x6d')](_0x4a5ba8[_0xaaf6('0x48')]),function(_0x364867){return{'name':_0x364867[_0xaaf6('0x71')],'value':_0x364867[_0xaaf6('0x2a')]};}):[]};})};}})[_0xaaf6('0x28')](respondWithResult(_0x2e33f6,null))[_0xaaf6('0x45')](function(_0x1ab78e){var _0x42db38=_0x138d2c[_0xaaf6('0x36')][_0xaaf6('0x72')]?0x1f4:_0x1ab78e[_0xaaf6('0x73')]||0x1f4;logger['error'](_0xaaf6('0x74'),_0xaaf6('0x56'),_0x42db38,JSON[_0xaaf6('0x65')](_0x1ab78e));delete _0x1ab78e['name'];if(_0x42db38===0x191){_0x42db38=0x190;}_0x2e33f6[_0xaaf6('0x1f')](_0x42db38)['send'](_0x138d2c[_0xaaf6('0x36')][_0xaaf6('0x72')]?{'message':_0xaaf6('0x75'),'statusCode':_0x1ab78e['statusCode']}:_0x1ab78e);});}else{var _0x52544e=0x1f4;_0x2e33f6[_0xaaf6('0x1f')](_0x52544e)[_0xaaf6('0x2b')]({'message':_0xaaf6('0x75'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x8763=['remove','endsWith','value','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','statusCode','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','SugarcrmAccount','include','find','create','body','getConfigurations','order','nolimit','addConfiguration','findOne','Subjects','getSubjects','getDescriptions','channel','SugarcrmConfiguration','SugarcrmField','getFields','created_by','description','duration_hours','duration_minutes','parent_id','parent_type','parent_name','username','password','remoteUri','substring','lastIndexOf','POST','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','format','%s%s','/service/v4_1/rest.php','get_module_fields','Calls','values','module_fields'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8763,0x81));var _0x3876=function(_0x2d1da1,_0x1bb2d0){_0x2d1da1=_0x2d1da1-0x0;var _0x3102e9=_0x8763[_0x2d1da1];return _0x3102e9;};'use strict';var emlformat=require(_0x3876('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3876('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3876('0x2'));var moment=require(_0x3876('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3876('0x4'));var util=require(_0x3876('0x5'));var path=require(_0x3876('0x6'));var sox=require('sox');var csv=require(_0x3876('0x7'));var ejs=require(_0x3876('0x8'));var fs=require('fs');var fs_extra=require(_0x3876('0x9'));var _=require(_0x3876('0xa'));var squel=require(_0x3876('0xb'));var crypto=require(_0x3876('0xc'));var jsforce=require(_0x3876('0xd'));var deskjs=require(_0x3876('0xe'));var toCsv=require(_0x3876('0x7'));var querystring=require('querystring');var Papa=require(_0x3876('0xf'));var Redis=require(_0x3876('0x10'));var authService=require(_0x3876('0x11'));var qs=require(_0x3876('0x12'));var as=require(_0x3876('0x13'));var hardwareService=require(_0x3876('0x14'));var logger=require(_0x3876('0x15'))(_0x3876('0x16'));var utils=require(_0x3876('0x17'));var config=require(_0x3876('0x18'));var licenseUtil=require(_0x3876('0x19'));var db=require(_0x3876('0x1a'))['db'];var integrations=require(_0x3876('0x1b'));function respondWithStatusCode(_0x119125,_0x49ee38){_0x49ee38=_0x49ee38||0xcc;return function(_0x4b9eba){if(_0x4b9eba){return _0x119125[_0x3876('0x1c')](_0x49ee38);}return _0x119125['status'](_0x49ee38)['end']();};}function respondWithResult(_0x553145,_0x5500e7){_0x5500e7=_0x5500e7||0xc8;return function(_0x6e62c5){if(_0x6e62c5){return _0x553145[_0x3876('0x1d')](_0x5500e7)['json'](_0x6e62c5);}};}function respondWithFilteredResult(_0x22336b,_0x419908){return function(_0x25aaff){if(_0x25aaff){var _0xe0471f=typeof _0x419908[_0x3876('0x1e')]==='undefined'&&typeof _0x419908['limit']===_0x3876('0x1f');var _0x5cf563=_0x25aaff[_0x3876('0x20')];var _0x5e3b8b=_0xe0471f?0x0:_0x419908[_0x3876('0x1e')];var _0x4e2746=_0xe0471f?_0x25aaff[_0x3876('0x20')]:_0x419908[_0x3876('0x1e')]+_0x419908[_0x3876('0x21')];var _0x4405dd;if(_0x4e2746>=_0x5cf563){_0x4e2746=_0x5cf563;_0x4405dd=0xc8;}else{_0x4405dd=0xce;}_0x22336b[_0x3876('0x1d')](_0x4405dd);return _0x22336b['set'](_0x3876('0x22'),_0x5e3b8b+'-'+_0x4e2746+'/'+_0x5cf563)['json'](_0x25aaff);}return null;};}function patchUpdates(_0x3285f3){return function(_0x7df7f5){try{jsonpatch[_0x3876('0x23')](_0x7df7f5,_0x3285f3,!![]);}catch(_0x400dc3){return BPromise['reject'](_0x400dc3);}return _0x7df7f5[_0x3876('0x24')]();};}function saveUpdates(_0x49ba76,_0x4c292b){return function(_0x5e2547){if(_0x5e2547){return _0x5e2547[_0x3876('0x25')](_0x49ba76)[_0x3876('0x26')](function(_0x397d64){return _0x397d64;});}return null;};}function removeEntity(_0x2029fc,_0x4f57fb){return function(_0x318dfe){if(_0x318dfe){return _0x318dfe[_0x3876('0x27')]()['then'](function(){_0x2029fc[_0x3876('0x1d')](0xcc)[_0x3876('0x28')]();});}};}function handleEntityNotFound(_0x4b8515,_0x337697){return function(_0x2c2540){if(!_0x2c2540){_0x4b8515[_0x3876('0x1c')](0x194);}return _0x2c2540;};}function handleError(_0x3ee7be,_0x57f8a5){_0x57f8a5=_0x57f8a5||0x1f4;return function(_0x1bfbaf){logger[_0x3876('0x29')](_0x1bfbaf[_0x3876('0x2a')]);if(_0x1bfbaf[_0x3876('0x2b')]){delete _0x1bfbaf['name'];}_0x3ee7be['status'](_0x57f8a5)[_0x3876('0x2c')](_0x1bfbaf);};}exports[_0x3876('0x2d')]=function(_0x35a6a3,_0x32d49a){var _0x3448ba={},_0xcae2a3={},_0x450c05={'count':0x0,'rows':[]};var _0x32a22b=_['map'](db['SugarcrmAccount'][_0x3876('0x2e')],function(_0x4ecf52){return{'name':_0x4ecf52[_0x3876('0x2f')],'type':_0x4ecf52[_0x3876('0x30')][_0x3876('0x31')]};});_0xcae2a3['model']=_[_0x3876('0x32')](_0x32a22b,'name');_0xcae2a3['query']=_[_0x3876('0x33')](_0x35a6a3[_0x3876('0x34')]);_0xcae2a3[_0x3876('0x35')]=_[_0x3876('0x36')](_0xcae2a3['model'],_0xcae2a3[_0x3876('0x34')]);_0x3448ba[_0x3876('0x37')]=_[_0x3876('0x36')](_0xcae2a3[_0x3876('0x38')],qs[_0x3876('0x39')](_0x35a6a3[_0x3876('0x34')][_0x3876('0x39')]));_0x3448ba[_0x3876('0x37')]=_0x3448ba[_0x3876('0x37')][_0x3876('0x3a')]?_0x3448ba['attributes']:_0xcae2a3[_0x3876('0x38')];if(!_0x35a6a3[_0x3876('0x34')][_0x3876('0x3b')]('nolimit')){_0x3448ba[_0x3876('0x21')]=qs[_0x3876('0x21')](_0x35a6a3[_0x3876('0x34')][_0x3876('0x21')]);_0x3448ba[_0x3876('0x1e')]=qs[_0x3876('0x1e')](_0x35a6a3[_0x3876('0x34')][_0x3876('0x1e')]);}_0x3448ba['order']=qs[_0x3876('0x3c')](_0x35a6a3[_0x3876('0x34')][_0x3876('0x3c')]);_0x3448ba[_0x3876('0x3d')]=qs['filters'](_[_0x3876('0x3e')](_0x35a6a3[_0x3876('0x34')],_0xcae2a3[_0x3876('0x35')]),_0x32a22b);if(_0x35a6a3[_0x3876('0x34')][_0x3876('0x3f')]){_0x3448ba['where']=_[_0x3876('0x40')](_0x3448ba[_0x3876('0x3d')],{'$or':_['map'](_0x32a22b,function(_0x377d14){if(_0x377d14[_0x3876('0x30')]!==_0x3876('0x41')){var _0xa5759a={};_0xa5759a[_0x377d14[_0x3876('0x2b')]]={'$like':'%'+_0x35a6a3[_0x3876('0x34')][_0x3876('0x3f')]+'%'};return _0xa5759a;}})});}_0x3448ba=_['merge']({},_0x3448ba,_0x35a6a3[_0x3876('0x42')]);var _0x5d7fdf={'where':_0x3448ba[_0x3876('0x3d')]};return db['SugarcrmAccount']['count'](_0x5d7fdf)[_0x3876('0x26')](function(_0x3ef2d7){_0x450c05['count']=_0x3ef2d7;if(_0x35a6a3[_0x3876('0x34')][_0x3876('0x43')]){_0x3448ba['include']=[{'all':!![]}];}return db['SugarcrmAccount'][_0x3876('0x44')](_0x3448ba);})[_0x3876('0x26')](function(_0xc602e7){_0x450c05[_0x3876('0x45')]=_0xc602e7;return _0x450c05;})[_0x3876('0x26')](respondWithFilteredResult(_0x32d49a,_0x3448ba))[_0x3876('0x46')](handleError(_0x32d49a,null));};exports[_0x3876('0x47')]=function(_0x114926,_0x1072e7){var _0x6672e7={'raw':![],'where':{'id':_0x114926[_0x3876('0x48')]['id']}},_0x52894b={};_0x52894b[_0x3876('0x38')]=_[_0x3876('0x33')](db[_0x3876('0x49')][_0x3876('0x2e')]);_0x52894b[_0x3876('0x34')]=_['keys'](_0x114926['query']);_0x52894b[_0x3876('0x35')]=_[_0x3876('0x36')](_0x52894b[_0x3876('0x38')],_0x52894b['query']);_0x6672e7[_0x3876('0x37')]=_[_0x3876('0x36')](_0x52894b[_0x3876('0x38')],qs[_0x3876('0x39')](_0x114926[_0x3876('0x34')][_0x3876('0x39')]));_0x6672e7[_0x3876('0x37')]=_0x6672e7[_0x3876('0x37')][_0x3876('0x3a')]?_0x6672e7[_0x3876('0x37')]:_0x52894b[_0x3876('0x38')];if(_0x114926[_0x3876('0x34')][_0x3876('0x43')]){_0x6672e7[_0x3876('0x4a')]=[{'all':!![]}];}_0x6672e7=_[_0x3876('0x40')]({},_0x6672e7,_0x114926[_0x3876('0x42')]);return db['SugarcrmAccount'][_0x3876('0x4b')](_0x6672e7)[_0x3876('0x26')](handleEntityNotFound(_0x1072e7,null))['then'](respondWithResult(_0x1072e7,null))[_0x3876('0x46')](handleError(_0x1072e7,null));};exports[_0x3876('0x4c')]=function(_0x1dfd38,_0x4d461c){return db[_0x3876('0x49')]['create'](_0x1dfd38[_0x3876('0x4d')],{})[_0x3876('0x26')](respondWithResult(_0x4d461c,0xc9))[_0x3876('0x46')](handleError(_0x4d461c,null));};exports[_0x3876('0x25')]=function(_0x58b2ab,_0x1d74a6){if(_0x58b2ab[_0x3876('0x4d')]['id']){delete _0x58b2ab[_0x3876('0x4d')]['id'];}return db['SugarcrmAccount'][_0x3876('0x4b')]({'where':{'id':_0x58b2ab['params']['id']}})[_0x3876('0x26')](handleEntityNotFound(_0x1d74a6,null))['then'](saveUpdates(_0x58b2ab['body'],null))[_0x3876('0x26')](respondWithResult(_0x1d74a6,null))[_0x3876('0x46')](handleError(_0x1d74a6,null));};exports[_0x3876('0x27')]=function(_0x5ebf35,_0x2d19ed){return db[_0x3876('0x49')][_0x3876('0x4b')]({'where':{'id':_0x5ebf35[_0x3876('0x48')]['id']}})[_0x3876('0x26')](handleEntityNotFound(_0x2d19ed,null))[_0x3876('0x26')](removeEntity(_0x2d19ed,null))[_0x3876('0x46')](handleError(_0x2d19ed,null));};exports[_0x3876('0x4e')]=function(_0x2cb607,_0x524453,_0x13e2e1){var _0x572e22={};var _0x1edb88={};var _0x3e535f;var _0x54bba5;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x2cb607['params']['id']}})['then'](handleEntityNotFound(_0x524453,null))[_0x3876('0x26')](function(_0x38fbf7){if(_0x38fbf7){_0x3e535f=_0x38fbf7;_0x1edb88['model']=_['keys'](db['SugarcrmConfiguration'][_0x3876('0x2e')]);_0x1edb88['query']=_['keys'](_0x2cb607[_0x3876('0x34')]);_0x1edb88[_0x3876('0x35')]=_[_0x3876('0x36')](_0x1edb88[_0x3876('0x38')],_0x1edb88[_0x3876('0x34')]);_0x572e22[_0x3876('0x37')]=_['intersection'](_0x1edb88['model'],qs[_0x3876('0x39')](_0x2cb607[_0x3876('0x34')]['fields']));_0x572e22[_0x3876('0x37')]=_0x572e22[_0x3876('0x37')][_0x3876('0x3a')]?_0x572e22['attributes']:_0x1edb88[_0x3876('0x38')];_0x572e22[_0x3876('0x4f')]=qs[_0x3876('0x3c')](_0x2cb607[_0x3876('0x34')][_0x3876('0x3c')]);_0x572e22['where']=qs['filters'](_[_0x3876('0x3e')](_0x2cb607[_0x3876('0x34')],_0x1edb88['filters']));if(_0x2cb607['query'][_0x3876('0x3f')]){_0x572e22[_0x3876('0x3d')]=_[_0x3876('0x40')](_0x572e22[_0x3876('0x3d')],{'$or':_[_0x3876('0x32')](_0x572e22['attributes'],function(_0x4c4d46){var _0x1b01bc={};_0x1b01bc[_0x4c4d46]={'$like':'%'+_0x2cb607['query'][_0x3876('0x3f')]+'%'};return _0x1b01bc;})});}_0x572e22=_[_0x3876('0x40')]({},_0x572e22,_0x2cb607[_0x3876('0x42')]);return _0x3e535f[_0x3876('0x4e')](_0x572e22);}})[_0x3876('0x26')](function(_0x3e805d){if(_0x3e805d){_0x54bba5=_0x3e805d[_0x3876('0x3a')];if(!_0x2cb607['query'][_0x3876('0x3b')](_0x3876('0x50'))){_0x572e22[_0x3876('0x21')]=qs[_0x3876('0x21')](_0x2cb607[_0x3876('0x34')][_0x3876('0x21')]);_0x572e22[_0x3876('0x1e')]=qs[_0x3876('0x1e')](_0x2cb607[_0x3876('0x34')][_0x3876('0x1e')]);}return _0x3e535f[_0x3876('0x4e')](_0x572e22);}})[_0x3876('0x26')](function(_0x239559){if(_0x239559){return _0x239559?{'count':_0x54bba5,'rows':_0x239559}:null;}})['then'](respondWithResult(_0x524453,null))['catch'](handleError(_0x524453,null));};exports[_0x3876('0x51')]=function(_0x11c4b3,_0xf6a764,_0x5d77f2){if(_0x11c4b3[_0x3876('0x4d')]['id']){delete _0x11c4b3[_0x3876('0x4d')]['id'];}return db[_0x3876('0x49')][_0x3876('0x52')]({'where':{'id':_0x11c4b3[_0x3876('0x48')]['id']}})['then'](handleEntityNotFound(_0xf6a764,null))['then'](function(_0x1a9eee){if(_0x1a9eee){_0x11c4b3[_0x3876('0x4d')]['AccountId']=_0x1a9eee['id'];_0x11c4b3[_0x3876('0x4d')][_0x3876('0x53')]=integrations[_0x3876('0x54')](_0x11c4b3['body']['channel'],_0x11c4b3[_0x3876('0x4d')]['type']);_0x11c4b3[_0x3876('0x4d')]['Descriptions']=integrations[_0x3876('0x55')](_0x11c4b3[_0x3876('0x4d')][_0x3876('0x56')],_0x11c4b3[_0x3876('0x4d')]['type']);return db[_0x3876('0x57')][_0x3876('0x4c')](_0x11c4b3[_0x3876('0x4d')],{'include':[{'model':db['SugarcrmField'],'as':_0x3876('0x53')},{'model':db[_0x3876('0x58')],'as':'Descriptions'}]});}return null;})[_0x3876('0x26')](respondWithResult(_0xf6a764,null))[_0x3876('0x46')](handleError(_0xf6a764,null));};exports[_0x3876('0x59')]=function(_0x226d62,_0x3a89f4,_0x4209cc){var _0x2767cc='';var _0x4832a2=['id',_0x3876('0x2b'),'assigned_user_id',_0x3876('0x5a'),_0x3876('0x5b'),'date_start',_0x3876('0x5c'),_0x3876('0x5d'),_0x3876('0x5e'),_0x3876('0x5f'),_0x3876('0x60'),'direction'];return db[_0x3876('0x49')]['findOne']({'where':{'id':_0x226d62[_0x3876('0x48')]['id']},'attributes':['id',_0x3876('0x61'),_0x3876('0x62'),'remoteUri']})[_0x3876('0x26')](handleEntityNotFound(_0x3a89f4,null))['then'](function(_0x5176ae){if(_0x5176ae){_0x2767cc=_0x5176ae[_0x3876('0x63')];var _0x41e653=_0x2767cc['slice'](-0x1);if(_0x41e653==='/'){_0x2767cc=_0x2767cc[_0x3876('0x64')](0x0,_0x2767cc[_0x3876('0x65')](_0x41e653));}return rp({'method':_0x3876('0x66'),'uri':util['format']('%s%s',_0x2767cc,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0x3876('0x67'),'response_type':_0x3876('0x67'),'rest_data':JSON[_0x3876('0x68')]({'user_auth':{'user_name':_0x5176ae[_0x3876('0x61')],'password':_0x5176ae['password'],'encryption':_0x3876('0x69')},'application':_0x3876('0x6a')})}});}})[_0x3876('0x26')](function(_0x153730){if(_0x153730&&_0x153730[_0x3876('0x2b')]!==_0x3876('0x6b')&&_0x153730[_0x3876('0x2b')]!=='Password\x20Expired'){return rp({'method':_0x3876('0x66'),'uri':util[_0x3876('0x6c')](_0x3876('0x6d'),_0x2767cc,_0x3876('0x6e')),'json':!![],'form':{'method':_0x3876('0x6f'),'input_type':_0x3876('0x67'),'response_type':_0x3876('0x67'),'rest_data':JSON[_0x3876('0x68')]({'session':_0x153730['id'],'module_name':_0x3876('0x70')})}})['then'](function(_0x87fe20){if(_0x87fe20){var _0x29b29b=_[_0x3876('0x71')](_0x87fe20[_0x3876('0x72')]);_[_0x3876('0x73')](_0x29b29b,function(_0x53f8bd){return _0x4832a2['includes'](_0x53f8bd[_0x3876('0x2b')]);});return{'count':_0x29b29b['length'],'rows':_['map'](_0x29b29b,function(_0x25b71c){return{'id':_0x25b71c[_0x3876('0x2b')],'name':_0x25b71c['label'],'custom':_[_0x3876('0x74')](_0x25b71c['name'],'_c')?!![]:![],'options':_0x25b71c[_0x3876('0x42')]?_[_0x3876('0x32')](_[_0x3876('0x71')](_0x25b71c[_0x3876('0x42')]),function(_0x268bd2){return{'name':_0x268bd2[_0x3876('0x75')],'value':_0x268bd2['name']};}):[]};})};}})[_0x3876('0x26')](respondWithResult(_0x3a89f4,null))[_0x3876('0x46')](function(_0x1878a5){var _0x23e934=_0x226d62['query']['test']?0x1f4:_0x1878a5['statusCode']||0x1f4;logger['error'](_0x3876('0x76'),_0x3876('0x59'),_0x23e934,JSON['stringify'](_0x1878a5));delete _0x1878a5[_0x3876('0x2b')];if(_0x23e934===0x191){_0x23e934=0x190;}_0x3a89f4[_0x3876('0x1d')](_0x23e934)[_0x3876('0x2c')](_0x226d62[_0x3876('0x34')][_0x3876('0x77')]?{'message':_0x3876('0x78'),'statusCode':_0x1878a5[_0x3876('0x79')]}:_0x1878a5);});}else{var _0x3d3a36=0x1f4;_0x3a89f4['status'](_0x3d3a36)[_0x3876('0x2c')]({'message':_0x3876('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 4c27d0e..dd73a22 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 _0xcf37=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xcf37,0xdc));var _0x7cf3=function(_0x608903,_0x42518e){_0x608903=_0x608903-0x0;var _0x92ba79=_0xcf37[_0x608903];return _0x92ba79;};'use strict';var _=require('lodash');var util=require(_0x7cf3('0x0'));var logger=require(_0x7cf3('0x1'))(_0x7cf3('0x2'));var moment=require(_0x7cf3('0x3'));var BPromise=require(_0x7cf3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7cf3('0x5'));var rimraf=require(_0x7cf3('0x6'));var config=require(_0x7cf3('0x7'));var attributes=require(_0x7cf3('0x8'));var integrations=require(_0x7cf3('0x9'));module['exports']=function(_0x488938,_0x4fd617){return _0x488938['define'](_0x7cf3('0xa'),attributes,{'tableName':_0x7cf3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ed4=['api','path','rimraf','../../config/environment','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x3ed4,0xdf));var _0x43ed=function(_0x1cab2b,_0x2f05fa){_0x1cab2b=_0x1cab2b-0x0;var _0x59a640=_0x3ed4[_0x1cab2b];return _0x59a640;};'use strict';var _=require(_0x43ed('0x0'));var util=require('util');var logger=require(_0x43ed('0x1'))(_0x43ed('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43ed('0x3'));var rimraf=require(_0x43ed('0x4'));var config=require(_0x43ed('0x5'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x407a0e,_0xb3c745){return _0x407a0e[_0x43ed('0x6')](_0x43ed('0x7'),attributes,{'tableName':_0x43ed('0x8'),'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 ad7c0e3..bff1472 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 _0xcf11=['result','findAll','options','raw','where','attributes','limit','include','map','model','GetSugarcrmAccount','catch','find','ShowSugarcrmAccount','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5d0d7f,_0x1d0ded){var _0x4b2262=function(_0x486dca){while(--_0x486dca){_0x5d0d7f['push'](_0x5d0d7f['shift']());}};_0x4b2262(++_0x1d0ded);}(_0xcf11,0xfc));var _0x1cf1=function(_0x29e3b6,_0x40b0b4){_0x29e3b6=_0x29e3b6-0x0;var _0x55d4b0=_0xcf11[_0x29e3b6];return _0x55d4b0;};'use strict';var _=require('lodash');var util=require(_0x1cf1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1cf1('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cf1('0x2'));var logger=require(_0x1cf1('0x3'))(_0x1cf1('0x4'));var config=require(_0x1cf1('0x5'));var jayson=require(_0x1cf1('0x6'));var client=jayson[_0x1cf1('0x7')][_0x1cf1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c5fa,_0x1a32ed,_0xd30483){return new BPromise(function(_0x13fe9e,_0x46d0d9){return client[_0x1cf1('0x9')](_0x1c5fa,_0xd30483)[_0x1cf1('0xa')](function(_0x2ffda5){logger[_0x1cf1('0xb')](_0x1cf1('0xc'),_0x1a32ed,_0x1cf1('0xd'));logger[_0x1cf1('0xe')](_0x1cf1('0xf'),_0x1a32ed,_0x1cf1('0xd'),JSON[_0x1cf1('0x10')](_0x2ffda5));if(_0x2ffda5[_0x1cf1('0x11')]){if(_0x2ffda5[_0x1cf1('0x11')][_0x1cf1('0x12')]===0x1f4){logger['error'](_0x1cf1('0xc'),_0x1a32ed,_0x2ffda5['error']['message']);return _0x46d0d9(_0x2ffda5[_0x1cf1('0x11')][_0x1cf1('0x13')]);}logger[_0x1cf1('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x1a32ed,_0x2ffda5[_0x1cf1('0x11')][_0x1cf1('0x13')]);return _0x13fe9e(_0x2ffda5[_0x1cf1('0x11')][_0x1cf1('0x13')]);}else{logger['info'](_0x1cf1('0xc'),_0x1a32ed,_0x1cf1('0xd'));_0x13fe9e(_0x2ffda5[_0x1cf1('0x14')]['message']);}})['catch'](function(_0x3cd354){logger[_0x1cf1('0x11')](_0x1cf1('0xc'),_0x1a32ed,_0x3cd354);_0x46d0d9(_0x3cd354);});});}exports['GetSugarcrmAccount']=function(_0x18bcc9){var _0x4b30f1=this;return new Promise(function(_0xc27a2d,_0x20f3fa){return db['SugarcrmAccount'][_0x1cf1('0x15')]({'raw':_0x18bcc9[_0x1cf1('0x16')]?_0x18bcc9['options'][_0x1cf1('0x17')]===undefined?!![]:![]:!![],'where':_0x18bcc9[_0x1cf1('0x16')]?_0x18bcc9[_0x1cf1('0x16')][_0x1cf1('0x18')]||null:null,'attributes':_0x18bcc9[_0x1cf1('0x16')]?_0x18bcc9[_0x1cf1('0x16')][_0x1cf1('0x19')]||null:null,'limit':_0x18bcc9[_0x1cf1('0x16')]?_0x18bcc9[_0x1cf1('0x16')][_0x1cf1('0x1a')]||null:null,'include':_0x18bcc9[_0x1cf1('0x16')]?_0x18bcc9['options'][_0x1cf1('0x1b')]?_[_0x1cf1('0x1c')](_0x18bcc9[_0x1cf1('0x16')][_0x1cf1('0x1b')],function(_0x517459){return{'model':db[_0x517459[_0x1cf1('0x1d')]],'as':_0x517459['as'],'attributes':_0x517459[_0x1cf1('0x19')],'include':_0x517459[_0x1cf1('0x1b')]?_[_0x1cf1('0x1c')](_0x517459[_0x1cf1('0x1b')],function(_0xfb4804){return{'model':db[_0xfb4804[_0x1cf1('0x1d')]],'as':_0xfb4804['as'],'attributes':_0xfb4804['attributes'],'include':_0xfb4804['include']?_[_0x1cf1('0x1c')](_0xfb4804[_0x1cf1('0x1b')],function(_0x2c1fd7){return{'model':db[_0x2c1fd7[_0x1cf1('0x1d')]],'as':_0x2c1fd7['as'],'attributes':_0x2c1fd7['attributes']};}):[]};}):[]};}):[]:[]})[_0x1cf1('0xa')](function(_0x53663a){logger[_0x1cf1('0xb')](_0x1cf1('0x1e'),_0x18bcc9);logger['debug']('GetSugarcrmAccount',_0x18bcc9,JSON['stringify'](_0x53663a));_0xc27a2d(_0x53663a);})[_0x1cf1('0x1f')](function(_0x342329){logger[_0x1cf1('0x11')](_0x1cf1('0x1e'),_0x342329[_0x1cf1('0x13')],_0x18bcc9);_0x20f3fa(_0x4b30f1[_0x1cf1('0x11')](0x1f4,_0x342329[_0x1cf1('0x13')]));});});};exports['ShowSugarcrmAccount']=function(_0x632b2e){var _0x10f722=this;return new Promise(function(_0xec2cdd,_0x1385b3){return db['SugarcrmAccount'][_0x1cf1('0x20')]({'raw':_0x632b2e['options']?_0x632b2e[_0x1cf1('0x16')][_0x1cf1('0x17')]===undefined?!![]:![]:!![],'where':_0x632b2e[_0x1cf1('0x16')]?_0x632b2e[_0x1cf1('0x16')][_0x1cf1('0x18')]||null:null,'attributes':_0x632b2e[_0x1cf1('0x16')]?_0x632b2e[_0x1cf1('0x16')]['attributes']||null:null,'include':_0x632b2e[_0x1cf1('0x16')]?_0x632b2e[_0x1cf1('0x16')][_0x1cf1('0x1b')]?_['map'](_0x632b2e[_0x1cf1('0x16')][_0x1cf1('0x1b')],function(_0x55e53e){return{'model':db[_0x55e53e[_0x1cf1('0x1d')]],'as':_0x55e53e['as'],'attributes':_0x55e53e[_0x1cf1('0x19')],'include':_0x55e53e[_0x1cf1('0x1b')]?_[_0x1cf1('0x1c')](_0x55e53e[_0x1cf1('0x1b')],function(_0xf24711){return{'model':db[_0xf24711['model']],'as':_0xf24711['as'],'attributes':_0xf24711[_0x1cf1('0x19')],'include':_0xf24711[_0x1cf1('0x1b')]?_['map'](_0xf24711[_0x1cf1('0x1b')],function(_0x26a486){return{'model':db[_0x26a486[_0x1cf1('0x1d')]],'as':_0x26a486['as'],'attributes':_0x26a486[_0x1cf1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cf1('0xa')](function(_0xf43271){logger[_0x1cf1('0xb')](_0x1cf1('0x21'),_0x632b2e);logger['debug'](_0x1cf1('0x21'),_0x632b2e,JSON['stringify'](_0xf43271));_0xec2cdd(_0xf43271);})['catch'](function(_0x266378){logger['error'](_0x1cf1('0x21'),_0x266378['message'],_0x632b2e);_0x1385b3(_0x10f722[_0x1cf1('0x11')](0x1f4,_0x266378['message']));});});}; \ No newline at end of file +var _0xfa64=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetSugarcrmAccount','findAll','options','where','limit','include','map','attributes','model','catch','ShowSugarcrmAccount','SugarcrmAccount','raw','lodash','util','moment','bluebird','randomstring'];(function(_0x4ca6ab,_0x29bc6c){var _0x516678=function(_0x108d0e){while(--_0x108d0e){_0x4ca6ab['push'](_0x4ca6ab['shift']());}};_0x516678(++_0x29bc6c);}(_0xfa64,0x12d));var _0x4fa6=function(_0x494cfb,_0x4c7cc2){_0x494cfb=_0x494cfb-0x0;var _0x39dd20=_0xfa64[_0x494cfb];return _0x39dd20;};'use strict';var _=require(_0x4fa6('0x0'));var util=require(_0x4fa6('0x1'));var moment=require(_0x4fa6('0x2'));var BPromise=require(_0x4fa6('0x3'));var rs=require(_0x4fa6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4fa6('0x5'))['db'];var utils=require(_0x4fa6('0x6'));var logger=require(_0x4fa6('0x7'))('rpc');var config=require(_0x4fa6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4fa6('0x9')][_0x4fa6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x558a51,_0x321bfb,_0x13966f){return new BPromise(function(_0x5e3407,_0x40baa){return client[_0x4fa6('0xb')](_0x558a51,_0x13966f)[_0x4fa6('0xc')](function(_0x8f5767){logger[_0x4fa6('0xd')](_0x4fa6('0xe'),_0x321bfb,_0x4fa6('0xf'));logger[_0x4fa6('0x10')](_0x4fa6('0x11'),_0x321bfb,_0x4fa6('0xf'),JSON['stringify'](_0x8f5767));if(_0x8f5767[_0x4fa6('0x12')]){if(_0x8f5767[_0x4fa6('0x12')]['code']===0x1f4){logger[_0x4fa6('0x12')](_0x4fa6('0xe'),_0x321bfb,_0x8f5767[_0x4fa6('0x12')][_0x4fa6('0x13')]);return _0x40baa(_0x8f5767[_0x4fa6('0x12')][_0x4fa6('0x13')]);}logger[_0x4fa6('0x12')](_0x4fa6('0xe'),_0x321bfb,_0x8f5767['error'][_0x4fa6('0x13')]);return _0x5e3407(_0x8f5767[_0x4fa6('0x12')][_0x4fa6('0x13')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x321bfb,_0x4fa6('0xf'));_0x5e3407(_0x8f5767[_0x4fa6('0x14')][_0x4fa6('0x13')]);}})['catch'](function(_0x42bb9c){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x321bfb,_0x42bb9c);_0x40baa(_0x42bb9c);});});}exports[_0x4fa6('0x15')]=function(_0x24538e){var _0x264b15=this;return new Promise(function(_0x1ca6d1,_0x330c93){return db['SugarcrmAccount'][_0x4fa6('0x16')]({'raw':_0x24538e['options']?_0x24538e['options']['raw']===undefined?!![]:![]:!![],'where':_0x24538e['options']?_0x24538e[_0x4fa6('0x17')][_0x4fa6('0x18')]||null:null,'attributes':_0x24538e[_0x4fa6('0x17')]?_0x24538e[_0x4fa6('0x17')]['attributes']||null:null,'limit':_0x24538e[_0x4fa6('0x17')]?_0x24538e[_0x4fa6('0x17')][_0x4fa6('0x19')]||null:null,'include':_0x24538e[_0x4fa6('0x17')]?_0x24538e[_0x4fa6('0x17')][_0x4fa6('0x1a')]?_[_0x4fa6('0x1b')](_0x24538e[_0x4fa6('0x17')][_0x4fa6('0x1a')],function(_0x373c6c){return{'model':db[_0x373c6c['model']],'as':_0x373c6c['as'],'attributes':_0x373c6c[_0x4fa6('0x1c')],'include':_0x373c6c['include']?_[_0x4fa6('0x1b')](_0x373c6c[_0x4fa6('0x1a')],function(_0x45782b){return{'model':db[_0x45782b[_0x4fa6('0x1d')]],'as':_0x45782b['as'],'attributes':_0x45782b['attributes'],'include':_0x45782b[_0x4fa6('0x1a')]?_[_0x4fa6('0x1b')](_0x45782b[_0x4fa6('0x1a')],function(_0x5734a4){return{'model':db[_0x5734a4[_0x4fa6('0x1d')]],'as':_0x5734a4['as'],'attributes':_0x5734a4[_0x4fa6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4fa6('0xc')](function(_0x6b1f47){logger[_0x4fa6('0xd')](_0x4fa6('0x15'),_0x24538e);logger[_0x4fa6('0x10')](_0x4fa6('0x15'),_0x24538e,JSON['stringify'](_0x6b1f47));_0x1ca6d1(_0x6b1f47);})[_0x4fa6('0x1e')](function(_0x3785ef){logger[_0x4fa6('0x12')]('GetSugarcrmAccount',_0x3785ef['message'],_0x24538e);_0x330c93(_0x264b15[_0x4fa6('0x12')](0x1f4,_0x3785ef[_0x4fa6('0x13')]));});});};exports[_0x4fa6('0x1f')]=function(_0x346a88){var _0x39ecbb=this;return new Promise(function(_0xbe6361,_0x3aabf6){return db[_0x4fa6('0x20')]['find']({'raw':_0x346a88[_0x4fa6('0x17')]?_0x346a88[_0x4fa6('0x17')][_0x4fa6('0x21')]===undefined?!![]:![]:!![],'where':_0x346a88[_0x4fa6('0x17')]?_0x346a88[_0x4fa6('0x17')][_0x4fa6('0x18')]||null:null,'attributes':_0x346a88[_0x4fa6('0x17')]?_0x346a88[_0x4fa6('0x17')][_0x4fa6('0x1c')]||null:null,'include':_0x346a88[_0x4fa6('0x17')]?_0x346a88['options'][_0x4fa6('0x1a')]?_[_0x4fa6('0x1b')](_0x346a88[_0x4fa6('0x17')][_0x4fa6('0x1a')],function(_0x248bf8){return{'model':db[_0x248bf8[_0x4fa6('0x1d')]],'as':_0x248bf8['as'],'attributes':_0x248bf8[_0x4fa6('0x1c')],'include':_0x248bf8[_0x4fa6('0x1a')]?_['map'](_0x248bf8[_0x4fa6('0x1a')],function(_0x37a488){return{'model':db[_0x37a488['model']],'as':_0x37a488['as'],'attributes':_0x37a488[_0x4fa6('0x1c')],'include':_0x37a488['include']?_[_0x4fa6('0x1b')](_0x37a488[_0x4fa6('0x1a')],function(_0xe51639){return{'model':db[_0xe51639[_0x4fa6('0x1d')]],'as':_0xe51639['as'],'attributes':_0xe51639[_0x4fa6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4fa6('0xc')](function(_0x310182){logger[_0x4fa6('0xd')]('ShowSugarcrmAccount',_0x346a88);logger[_0x4fa6('0x10')]('ShowSugarcrmAccount',_0x346a88,JSON['stringify'](_0x310182));_0xbe6361(_0x310182);})[_0x4fa6('0x1e')](function(_0x5d615e){logger['error']('ShowSugarcrmAccount',_0x5d615e['message'],_0x346a88);_0x3aabf6(_0x39ecbb['error'](0x1f4,_0x5d615e['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index ded859f..cfe13f2 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 _0xa312=['create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa312,0x162));var _0x2a31=function(_0x35d775,_0x25431e){_0x35d775=_0x35d775-0x0;var _0x59384d=_0xa312[_0x35d775];return _0x59384d;};'use strict';var multer=require(_0x2a31('0x0'));var util=require(_0x2a31('0x1'));var path=require(_0x2a31('0x2'));var timeout=require(_0x2a31('0x3'));var express=require(_0x2a31('0x4'));var router=express[_0x2a31('0x5')]();var fs_extra=require(_0x2a31('0x6'));var auth=require(_0x2a31('0x7'));var interaction=require(_0x2a31('0x8'));var config=require('../../config/environment');var controller=require(_0x2a31('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2a31('0xa')](_0x2a31('0xb'),auth['isAuthenticated'](),controller[_0x2a31('0xc')]);router[_0x2a31('0xa')](_0x2a31('0xd'),auth[_0x2a31('0xe')](),controller[_0x2a31('0xf')]);router[_0x2a31('0xa')](_0x2a31('0x10'),auth[_0x2a31('0xe')](),controller[_0x2a31('0x11')]);router[_0x2a31('0xa')](_0x2a31('0x12'),auth[_0x2a31('0xe')](),controller[_0x2a31('0x13')]);router[_0x2a31('0x14')]('/',auth[_0x2a31('0xe')](),controller[_0x2a31('0x15')]);router['put'](_0x2a31('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x2a31('0x16')](_0x2a31('0xb'),auth[_0x2a31('0xe')](),controller[_0x2a31('0x17')]);module[_0x2a31('0x18')]=router; \ No newline at end of file +var _0x2c63=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete'];(function(_0x536d70,_0xa88ce3){var _0x455ed3=function(_0xaa6b){while(--_0xaa6b){_0x536d70['push'](_0x536d70['shift']());}};_0x455ed3(++_0xa88ce3);}(_0x2c63,0x12b));var _0x32c6=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x2c63[_0x4bb66f];return _0xf2772f;};'use strict';var multer=require(_0x32c6('0x0'));var util=require(_0x32c6('0x1'));var path=require(_0x32c6('0x2'));var timeout=require(_0x32c6('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x32c6('0x4'));var auth=require(_0x32c6('0x5'));var interaction=require(_0x32c6('0x6'));var config=require(_0x32c6('0x7'));var controller=require(_0x32c6('0x8'));router[_0x32c6('0x9')]('/',auth[_0x32c6('0xa')](),controller[_0x32c6('0xb')]);router[_0x32c6('0x9')](_0x32c6('0xc'),auth[_0x32c6('0xa')](),controller['show']);router[_0x32c6('0x9')](_0x32c6('0xd'),auth['isAuthenticated'](),controller[_0x32c6('0xe')]);router[_0x32c6('0x9')](_0x32c6('0xf'),auth[_0x32c6('0xa')](),controller['getSubjects']);router[_0x32c6('0x9')](_0x32c6('0x10'),auth[_0x32c6('0xa')](),controller[_0x32c6('0x11')]);router[_0x32c6('0x12')]('/',auth['isAuthenticated'](),controller[_0x32c6('0x13')]);router[_0x32c6('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x32c6('0x15')]);router[_0x32c6('0x16')](_0x32c6('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index de3920e..323bdc8 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 _0xc73e=['sequelize','STRING'];(function(_0x452a27,_0x5a2b48){var _0x385c7b=function(_0x5bc06a){while(--_0x5bc06a){_0x452a27['push'](_0x452a27['shift']());}};_0x385c7b(++_0x5a2b48);}(_0xc73e,0x102));var _0xec73=function(_0x3f7c5c,_0x38dedf){_0x3f7c5c=_0x3f7c5c-0x0;var _0x384461=_0xc73e[_0x3f7c5c];return _0x384461;};'use strict';var Sequelize=require(_0xec73('0x0'));module['exports']={'name':{'type':Sequelize[_0xec73('0x1')]},'description':{'type':Sequelize[_0xec73('0x1')]}}; \ No newline at end of file +var _0x238f=['STRING','sequelize','exports'];(function(_0x56c4f7,_0xf31074){var _0x35689e=function(_0x4cc5fc){while(--_0x4cc5fc){_0x56c4f7['push'](_0x56c4f7['shift']());}};_0x35689e(++_0xf31074);}(_0x238f,0x1c0));var _0xf238=function(_0xc0dd4e,_0x43b7ec){_0xc0dd4e=_0xc0dd4e-0x0;var _0x5309e8=_0x238f[_0xc0dd4e];return _0x5309e8;};'use strict';var Sequelize=require(_0xf238('0x0'));module[_0xf238('0x1')]={'name':{'type':Sequelize[_0xf238('0x2')]},'description':{'type':Sequelize[_0xf238('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index bb4f20f..d199a41 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 _0x8bf4=['includeAll','findAll','rows','catch','params','length','include','find','create','body','getFields','findOne','SugarcrmField','pick','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','send','map','SugarcrmConfiguration','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options'];(function(_0x1acfcd,_0x2b4bfc){var _0x5bfbca=function(_0x1ba587){while(--_0x1ba587){_0x1acfcd['push'](_0x1acfcd['shift']());}};_0x5bfbca(++_0x2b4bfc);}(_0x8bf4,0x1d8));var _0x48bf=function(_0x4ad095,_0x5f4d18){_0x4ad095=_0x4ad095-0x0;var _0x168ddf=_0x8bf4[_0x4ad095];return _0x168ddf;};'use strict';var emlformat=require(_0x48bf('0x0'));var rimraf=require(_0x48bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x48bf('0x2'));var rp=require(_0x48bf('0x3'));var moment=require(_0x48bf('0x4'));var BPromise=require(_0x48bf('0x5'));var Mustache=require(_0x48bf('0x6'));var util=require(_0x48bf('0x7'));var path=require(_0x48bf('0x8'));var sox=require('sox');var csv=require(_0x48bf('0x9'));var ejs=require(_0x48bf('0xa'));var fs=require('fs');var fs_extra=require(_0x48bf('0xb'));var _=require(_0x48bf('0xc'));var squel=require(_0x48bf('0xd'));var crypto=require(_0x48bf('0xe'));var jsforce=require(_0x48bf('0xf'));var deskjs=require(_0x48bf('0x10'));var toCsv=require(_0x48bf('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x48bf('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x48bf('0x12'));var as=require(_0x48bf('0x13'));var hardwareService=require(_0x48bf('0x14'));var logger=require(_0x48bf('0x15'))('api');var utils=require(_0x48bf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x48bf('0x17'))['db'];function respondWithStatusCode(_0x230a19,_0x3c3b2e){_0x3c3b2e=_0x3c3b2e||0xcc;return function(_0x5eb4a4){if(_0x5eb4a4){return _0x230a19['sendStatus'](_0x3c3b2e);}return _0x230a19[_0x48bf('0x18')](_0x3c3b2e)[_0x48bf('0x19')]();};}function respondWithResult(_0x16d66a,_0x297cd9){_0x297cd9=_0x297cd9||0xc8;return function(_0x41f4f1){if(_0x41f4f1){return _0x16d66a['status'](_0x297cd9)[_0x48bf('0x1a')](_0x41f4f1);}};}function respondWithFilteredResult(_0x562e57,_0x13864d){return function(_0x26008c){if(_0x26008c){var _0x1ddaf3=typeof _0x13864d[_0x48bf('0x1b')]==='undefined'&&typeof _0x13864d[_0x48bf('0x1c')]==='undefined';var _0x45a11=_0x26008c[_0x48bf('0x1d')];var _0x49e810=_0x1ddaf3?0x0:_0x13864d['offset'];var _0x6a040b=_0x1ddaf3?_0x26008c[_0x48bf('0x1d')]:_0x13864d[_0x48bf('0x1b')]+_0x13864d[_0x48bf('0x1c')];var _0x435a54;if(_0x6a040b>=_0x45a11){_0x6a040b=_0x45a11;_0x435a54=0xc8;}else{_0x435a54=0xce;}_0x562e57[_0x48bf('0x18')](_0x435a54);return _0x562e57[_0x48bf('0x1e')](_0x48bf('0x1f'),_0x49e810+'-'+_0x6a040b+'/'+_0x45a11)['json'](_0x26008c);}return null;};}function patchUpdates(_0x39b1a9){return function(_0x172ad9){try{jsonpatch[_0x48bf('0x20')](_0x172ad9,_0x39b1a9,!![]);}catch(_0x4bb803){return BPromise['reject'](_0x4bb803);}return _0x172ad9['save']();};}function saveUpdates(_0x585132,_0x32e083){return function(_0x463622){if(_0x463622){return _0x463622[_0x48bf('0x21')](_0x585132)[_0x48bf('0x22')](function(_0x3059ac){return _0x3059ac;});}return null;};}function removeEntity(_0x41c413,_0x591696){return function(_0x34b466){if(_0x34b466){return _0x34b466[_0x48bf('0x23')]()[_0x48bf('0x22')](function(){_0x41c413[_0x48bf('0x18')](0xcc)[_0x48bf('0x19')]();});}};}function handleEntityNotFound(_0x3bbd98,_0x36206e){return function(_0x16e3a8){if(!_0x16e3a8){_0x3bbd98[_0x48bf('0x24')](0x194);}return _0x16e3a8;};}function handleError(_0x1a7bc7,_0x46425d){_0x46425d=_0x46425d||0x1f4;return function(_0x4dab2c){logger[_0x48bf('0x25')](_0x4dab2c[_0x48bf('0x26')]);if(_0x4dab2c[_0x48bf('0x27')]){delete _0x4dab2c[_0x48bf('0x27')];}_0x1a7bc7[_0x48bf('0x18')](_0x46425d)[_0x48bf('0x28')](_0x4dab2c);};}exports['index']=function(_0x5ecbdf,_0x4bef12){var _0x4913e2={},_0x3975ef={},_0x218485={'count':0x0,'rows':[]};var _0x52a0eb=_[_0x48bf('0x29')](db[_0x48bf('0x2a')][_0x48bf('0x2b')],function(_0xcf46b4){return{'name':_0xcf46b4['fieldName'],'type':_0xcf46b4['type'][_0x48bf('0x2c')]};});_0x3975ef[_0x48bf('0x2d')]=_['map'](_0x52a0eb,_0x48bf('0x27'));_0x3975ef['query']=_[_0x48bf('0x2e')](_0x5ecbdf[_0x48bf('0x2f')]);_0x3975ef[_0x48bf('0x30')]=_['intersection'](_0x3975ef[_0x48bf('0x2d')],_0x3975ef[_0x48bf('0x2f')]);_0x4913e2['attributes']=_[_0x48bf('0x31')](_0x3975ef[_0x48bf('0x2d')],qs[_0x48bf('0x32')](_0x5ecbdf['query']['fields']));_0x4913e2[_0x48bf('0x33')]=_0x4913e2[_0x48bf('0x33')]['length']?_0x4913e2['attributes']:_0x3975ef[_0x48bf('0x2d')];if(!_0x5ecbdf['query'][_0x48bf('0x34')](_0x48bf('0x35'))){_0x4913e2[_0x48bf('0x1c')]=qs[_0x48bf('0x1c')](_0x5ecbdf[_0x48bf('0x2f')][_0x48bf('0x1c')]);_0x4913e2[_0x48bf('0x1b')]=qs[_0x48bf('0x1b')](_0x5ecbdf[_0x48bf('0x2f')][_0x48bf('0x1b')]);}_0x4913e2[_0x48bf('0x36')]=qs['sort'](_0x5ecbdf[_0x48bf('0x2f')][_0x48bf('0x37')]);_0x4913e2[_0x48bf('0x38')]=qs[_0x48bf('0x30')](_['pick'](_0x5ecbdf[_0x48bf('0x2f')],_0x3975ef[_0x48bf('0x30')]),_0x52a0eb);if(_0x5ecbdf[_0x48bf('0x2f')][_0x48bf('0x39')]){_0x4913e2[_0x48bf('0x38')]=_[_0x48bf('0x3a')](_0x4913e2[_0x48bf('0x38')],{'$or':_['map'](_0x52a0eb,function(_0x23aeac){if(_0x23aeac['type']!=='VIRTUAL'){var _0x1971e3={};_0x1971e3[_0x23aeac[_0x48bf('0x27')]]={'$like':'%'+_0x5ecbdf[_0x48bf('0x2f')][_0x48bf('0x39')]+'%'};return _0x1971e3;}})});}_0x4913e2=_[_0x48bf('0x3a')]({},_0x4913e2,_0x5ecbdf[_0x48bf('0x3b')]);var _0x4cef50={'where':_0x4913e2[_0x48bf('0x38')]};return db['SugarcrmConfiguration']['count'](_0x4cef50)[_0x48bf('0x22')](function(_0x4005c0){_0x218485[_0x48bf('0x1d')]=_0x4005c0;if(_0x5ecbdf[_0x48bf('0x2f')][_0x48bf('0x3c')]){_0x4913e2['include']=[{'all':!![]}];}return db[_0x48bf('0x2a')][_0x48bf('0x3d')](_0x4913e2);})[_0x48bf('0x22')](function(_0x20c464){_0x218485[_0x48bf('0x3e')]=_0x20c464;return _0x218485;})['then'](respondWithFilteredResult(_0x4bef12,_0x4913e2))[_0x48bf('0x3f')](handleError(_0x4bef12,null));};exports['show']=function(_0x2d7eb1,_0xa44cb0){var _0x20531c={'raw':![],'where':{'id':_0x2d7eb1[_0x48bf('0x40')]['id']}},_0x44e1d3={};_0x44e1d3['model']=_['keys'](db[_0x48bf('0x2a')][_0x48bf('0x2b')]);_0x44e1d3['query']=_[_0x48bf('0x2e')](_0x2d7eb1[_0x48bf('0x2f')]);_0x44e1d3[_0x48bf('0x30')]=_['intersection'](_0x44e1d3['model'],_0x44e1d3['query']);_0x20531c[_0x48bf('0x33')]=_[_0x48bf('0x31')](_0x44e1d3[_0x48bf('0x2d')],qs[_0x48bf('0x32')](_0x2d7eb1['query']['fields']));_0x20531c[_0x48bf('0x33')]=_0x20531c[_0x48bf('0x33')][_0x48bf('0x41')]?_0x20531c['attributes']:_0x44e1d3[_0x48bf('0x2d')];if(_0x2d7eb1['query'][_0x48bf('0x3c')]){_0x20531c[_0x48bf('0x42')]=[{'all':!![]}];}_0x20531c=_['merge']({},_0x20531c,_0x2d7eb1[_0x48bf('0x3b')]);return db['SugarcrmConfiguration'][_0x48bf('0x43')](_0x20531c)['then'](handleEntityNotFound(_0xa44cb0,null))[_0x48bf('0x22')](respondWithResult(_0xa44cb0,null))[_0x48bf('0x3f')](handleError(_0xa44cb0,null));};exports[_0x48bf('0x44')]=function(_0x2c3ed1,_0x160f79){return db[_0x48bf('0x2a')]['create'](_0x2c3ed1[_0x48bf('0x45')],{})[_0x48bf('0x22')](respondWithResult(_0x160f79,0xc9))['catch'](handleError(_0x160f79,null));};exports[_0x48bf('0x21')]=function(_0x510b41,_0x48b3e0){if(_0x510b41['body']['id']){delete _0x510b41[_0x48bf('0x45')]['id'];}return db[_0x48bf('0x2a')][_0x48bf('0x43')]({'where':{'id':_0x510b41[_0x48bf('0x40')]['id']}})['then'](handleEntityNotFound(_0x48b3e0,null))['then'](saveUpdates(_0x510b41[_0x48bf('0x45')],null))[_0x48bf('0x22')](respondWithResult(_0x48b3e0,null))[_0x48bf('0x3f')](handleError(_0x48b3e0,null));};exports['destroy']=function(_0x6926ef,_0x4d98ec){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x6926ef['params']['id']}})[_0x48bf('0x22')](handleEntityNotFound(_0x4d98ec,null))[_0x48bf('0x22')](removeEntity(_0x4d98ec,null))[_0x48bf('0x3f')](handleError(_0x4d98ec,null));};exports[_0x48bf('0x46')]=function(_0x7d16ea,_0x17cb3c,_0x1bc6c8){var _0x584959={};var _0x2a41e3={};var _0x3cac7a;var _0x2f6b70;return db[_0x48bf('0x2a')][_0x48bf('0x47')]({'where':{'id':_0x7d16ea[_0x48bf('0x40')]['id']}})[_0x48bf('0x22')](handleEntityNotFound(_0x17cb3c,null))[_0x48bf('0x22')](function(_0x12e737){if(_0x12e737){_0x3cac7a=_0x12e737;_0x2a41e3['model']=_[_0x48bf('0x2e')](db[_0x48bf('0x48')][_0x48bf('0x2b')]);_0x2a41e3[_0x48bf('0x2f')]=_[_0x48bf('0x2e')](_0x7d16ea[_0x48bf('0x2f')]);_0x2a41e3[_0x48bf('0x30')]=_[_0x48bf('0x31')](_0x2a41e3['model'],_0x2a41e3['query']);_0x584959[_0x48bf('0x33')]=_[_0x48bf('0x31')](_0x2a41e3[_0x48bf('0x2d')],qs[_0x48bf('0x32')](_0x7d16ea[_0x48bf('0x2f')]['fields']));_0x584959[_0x48bf('0x33')]=_0x584959[_0x48bf('0x33')][_0x48bf('0x41')]?_0x584959[_0x48bf('0x33')]:_0x2a41e3[_0x48bf('0x2d')];_0x584959[_0x48bf('0x36')]=qs['sort'](_0x7d16ea[_0x48bf('0x2f')][_0x48bf('0x37')]);_0x584959[_0x48bf('0x38')]=qs[_0x48bf('0x30')](_[_0x48bf('0x49')](_0x7d16ea[_0x48bf('0x2f')],_0x2a41e3[_0x48bf('0x30')]));if(_0x7d16ea[_0x48bf('0x2f')][_0x48bf('0x39')]){_0x584959[_0x48bf('0x38')]=_[_0x48bf('0x3a')](_0x584959[_0x48bf('0x38')],{'$or':_['map'](_0x584959[_0x48bf('0x33')],function(_0x5a6948){var _0x4cc6aa={};_0x4cc6aa[_0x5a6948]={'$like':'%'+_0x7d16ea[_0x48bf('0x2f')][_0x48bf('0x39')]+'%'};return _0x4cc6aa;})});}_0x584959=_[_0x48bf('0x3a')]({},_0x584959,_0x7d16ea['options']);return _0x3cac7a[_0x48bf('0x46')](_0x584959);}})['then'](function(_0x21ecb3){if(_0x21ecb3){_0x2f6b70=_0x21ecb3[_0x48bf('0x41')];if(!_0x7d16ea[_0x48bf('0x2f')][_0x48bf('0x34')](_0x48bf('0x35'))){_0x584959[_0x48bf('0x1c')]=qs['limit'](_0x7d16ea[_0x48bf('0x2f')][_0x48bf('0x1c')]);_0x584959['offset']=qs[_0x48bf('0x1b')](_0x7d16ea[_0x48bf('0x2f')][_0x48bf('0x1b')]);}return _0x3cac7a[_0x48bf('0x46')](_0x584959);}})[_0x48bf('0x22')](function(_0x238b29){if(_0x238b29){return _0x238b29?{'count':_0x2f6b70,'rows':_0x238b29}:null;}})[_0x48bf('0x22')](respondWithResult(_0x17cb3c,null))[_0x48bf('0x3f')](handleError(_0x17cb3c,null));};exports['getSubjects']=function(_0xa44f13,_0x3f976b,_0x424701){var _0x48aae3={};var _0x32151d={};var _0x400e52;var _0x2f4ab6;return db[_0x48bf('0x2a')][_0x48bf('0x47')]({'where':{'id':_0xa44f13[_0x48bf('0x40')]['id']}})[_0x48bf('0x22')](handleEntityNotFound(_0x3f976b,null))[_0x48bf('0x22')](function(_0x43f7ea){if(_0x43f7ea){_0x400e52=_0x43f7ea;_0x32151d[_0x48bf('0x2d')]=_[_0x48bf('0x2e')](db[_0x48bf('0x48')]['rawAttributes']);_0x32151d[_0x48bf('0x2f')]=_[_0x48bf('0x2e')](_0xa44f13[_0x48bf('0x2f')]);_0x32151d[_0x48bf('0x30')]=_['intersection'](_0x32151d['model'],_0x32151d[_0x48bf('0x2f')]);_0x48aae3[_0x48bf('0x33')]=_[_0x48bf('0x31')](_0x32151d[_0x48bf('0x2d')],qs[_0x48bf('0x32')](_0xa44f13[_0x48bf('0x2f')][_0x48bf('0x32')]));_0x48aae3[_0x48bf('0x33')]=_0x48aae3['attributes'][_0x48bf('0x41')]?_0x48aae3['attributes']:_0x32151d[_0x48bf('0x2d')];_0x48aae3[_0x48bf('0x36')]=qs[_0x48bf('0x37')](_0xa44f13['query'][_0x48bf('0x37')]);_0x48aae3[_0x48bf('0x38')]=qs['filters'](_[_0x48bf('0x49')](_0xa44f13['query'],_0x32151d[_0x48bf('0x30')]));if(_0xa44f13[_0x48bf('0x2f')][_0x48bf('0x39')]){_0x48aae3[_0x48bf('0x38')]=_[_0x48bf('0x3a')](_0x48aae3[_0x48bf('0x38')],{'$or':_[_0x48bf('0x29')](_0x48aae3[_0x48bf('0x33')],function(_0x4f2f6a){var _0x5d52b0={};_0x5d52b0[_0x4f2f6a]={'$like':'%'+_0xa44f13[_0x48bf('0x2f')][_0x48bf('0x39')]+'%'};return _0x5d52b0;})});}_0x48aae3=_['merge']({},_0x48aae3,_0xa44f13[_0x48bf('0x3b')]);return _0x400e52[_0x48bf('0x4a')](_0x48aae3);}})[_0x48bf('0x22')](function(_0x4b962a){if(_0x4b962a){_0x2f4ab6=_0x4b962a[_0x48bf('0x41')];if(!_0xa44f13[_0x48bf('0x2f')]['hasOwnProperty'](_0x48bf('0x35'))){_0x48aae3[_0x48bf('0x1c')]=qs['limit'](_0xa44f13['query'][_0x48bf('0x1c')]);_0x48aae3[_0x48bf('0x1b')]=qs[_0x48bf('0x1b')](_0xa44f13[_0x48bf('0x2f')][_0x48bf('0x1b')]);}return _0x400e52['getSubjects'](_0x48aae3);}})[_0x48bf('0x22')](function(_0x1b4ad5){if(_0x1b4ad5){return _0x1b4ad5?{'count':_0x2f4ab6,'rows':_0x1b4ad5}:null;}})[_0x48bf('0x22')](respondWithResult(_0x3f976b,null))['catch'](handleError(_0x3f976b,null));};exports[_0x48bf('0x4b')]=function(_0x84025b,_0x29c17f,_0x4c7f08){var _0x184608={};var _0x246549={};var _0x369de1;var _0x1afa52;return db['SugarcrmConfiguration'][_0x48bf('0x47')]({'where':{'id':_0x84025b[_0x48bf('0x40')]['id']}})[_0x48bf('0x22')](handleEntityNotFound(_0x29c17f,null))['then'](function(_0x4ecf7a){if(_0x4ecf7a){_0x369de1=_0x4ecf7a;_0x246549['model']=_[_0x48bf('0x2e')](db['SugarcrmField'][_0x48bf('0x2b')]);_0x246549[_0x48bf('0x2f')]=_[_0x48bf('0x2e')](_0x84025b[_0x48bf('0x2f')]);_0x246549[_0x48bf('0x30')]=_[_0x48bf('0x31')](_0x246549['model'],_0x246549[_0x48bf('0x2f')]);_0x184608[_0x48bf('0x33')]=_['intersection'](_0x246549['model'],qs[_0x48bf('0x32')](_0x84025b[_0x48bf('0x2f')][_0x48bf('0x32')]));_0x184608['attributes']=_0x184608[_0x48bf('0x33')][_0x48bf('0x41')]?_0x184608[_0x48bf('0x33')]:_0x246549[_0x48bf('0x2d')];_0x184608[_0x48bf('0x36')]=qs['sort'](_0x84025b['query']['sort']);_0x184608[_0x48bf('0x38')]=qs[_0x48bf('0x30')](_[_0x48bf('0x49')](_0x84025b[_0x48bf('0x2f')],_0x246549[_0x48bf('0x30')]));if(_0x84025b[_0x48bf('0x2f')][_0x48bf('0x39')]){_0x184608[_0x48bf('0x38')]=_['merge'](_0x184608[_0x48bf('0x38')],{'$or':_[_0x48bf('0x29')](_0x184608['attributes'],function(_0x14136e){var _0x311a1e={};_0x311a1e[_0x14136e]={'$like':'%'+_0x84025b['query'][_0x48bf('0x39')]+'%'};return _0x311a1e;})});}_0x184608=_['merge']({},_0x184608,_0x84025b[_0x48bf('0x3b')]);return _0x369de1[_0x48bf('0x4b')](_0x184608);}})['then'](function(_0x27295f){if(_0x27295f){_0x1afa52=_0x27295f[_0x48bf('0x41')];if(!_0x84025b[_0x48bf('0x2f')]['hasOwnProperty']('nolimit')){_0x184608['limit']=qs['limit'](_0x84025b[_0x48bf('0x2f')][_0x48bf('0x1c')]);_0x184608[_0x48bf('0x1b')]=qs['offset'](_0x84025b[_0x48bf('0x2f')][_0x48bf('0x1b')]);}return _0x369de1[_0x48bf('0x4b')](_0x184608);}})[_0x48bf('0x22')](function(_0x93660d){if(_0x93660d){return _0x93660d?{'count':_0x1afa52,'rows':_0x93660d}:null;}})['then'](respondWithResult(_0x29c17f,null))[_0x48bf('0x3f')](handleError(_0x29c17f,null));}; \ No newline at end of file +var _0x4e38=['error','stack','name','send','SugarcrmConfiguration','rawAttributes','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','includeAll','findAll','rows','params','options','find','catch','create','body','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','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','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4e38,0x11d));var _0x84e3=function(_0x352e85,_0x32fb5e){_0x352e85=_0x352e85-0x0;var _0x28c351=_0x4e38[_0x352e85];return _0x28c351;};'use strict';var emlformat=require(_0x84e3('0x0'));var rimraf=require(_0x84e3('0x1'));var zipdir=require(_0x84e3('0x2'));var jsonpatch=require(_0x84e3('0x3'));var rp=require('request-promise');var moment=require(_0x84e3('0x4'));var BPromise=require(_0x84e3('0x5'));var Mustache=require(_0x84e3('0x6'));var util=require(_0x84e3('0x7'));var path=require(_0x84e3('0x8'));var sox=require(_0x84e3('0x9'));var csv=require(_0x84e3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x84e3('0xb'));var _=require(_0x84e3('0xc'));var squel=require(_0x84e3('0xd'));var crypto=require('crypto');var jsforce=require(_0x84e3('0xe'));var deskjs=require(_0x84e3('0xf'));var toCsv=require('to-csv');var querystring=require(_0x84e3('0x10'));var Papa=require(_0x84e3('0x11'));var Redis=require(_0x84e3('0x12'));var authService=require(_0x84e3('0x13'));var qs=require(_0x84e3('0x14'));var as=require(_0x84e3('0x15'));var hardwareService=require(_0x84e3('0x16'));var logger=require(_0x84e3('0x17'))(_0x84e3('0x18'));var utils=require(_0x84e3('0x19'));var config=require(_0x84e3('0x1a'));var licenseUtil=require(_0x84e3('0x1b'));var db=require(_0x84e3('0x1c'))['db'];function respondWithStatusCode(_0x510c4c,_0x28dc35){_0x28dc35=_0x28dc35||0xcc;return function(_0x170f75){if(_0x170f75){return _0x510c4c['sendStatus'](_0x28dc35);}return _0x510c4c[_0x84e3('0x1d')](_0x28dc35)[_0x84e3('0x1e')]();};}function respondWithResult(_0x53ba48,_0x5cfe7b){_0x5cfe7b=_0x5cfe7b||0xc8;return function(_0x321b13){if(_0x321b13){return _0x53ba48[_0x84e3('0x1d')](_0x5cfe7b)[_0x84e3('0x1f')](_0x321b13);}};}function respondWithFilteredResult(_0x3e4364,_0x1613c5){return function(_0x3dc5f5){if(_0x3dc5f5){var _0x575cc3=typeof _0x1613c5['offset']===_0x84e3('0x20')&&typeof _0x1613c5['limit']===_0x84e3('0x20');var _0x29cf2e=_0x3dc5f5[_0x84e3('0x21')];var _0x94a84f=_0x575cc3?0x0:_0x1613c5[_0x84e3('0x22')];var _0x3f10c4=_0x575cc3?_0x3dc5f5['count']:_0x1613c5['offset']+_0x1613c5[_0x84e3('0x23')];var _0x3fc9d5;if(_0x3f10c4>=_0x29cf2e){_0x3f10c4=_0x29cf2e;_0x3fc9d5=0xc8;}else{_0x3fc9d5=0xce;}_0x3e4364[_0x84e3('0x1d')](_0x3fc9d5);return _0x3e4364[_0x84e3('0x24')](_0x84e3('0x25'),_0x94a84f+'-'+_0x3f10c4+'/'+_0x29cf2e)[_0x84e3('0x1f')](_0x3dc5f5);}return null;};}function patchUpdates(_0x3d0459){return function(_0x5cdf8d){try{jsonpatch[_0x84e3('0x26')](_0x5cdf8d,_0x3d0459,!![]);}catch(_0xd71e71){return BPromise['reject'](_0xd71e71);}return _0x5cdf8d[_0x84e3('0x27')]();};}function saveUpdates(_0x683573,_0x259cd2){return function(_0x493e5b){if(_0x493e5b){return _0x493e5b[_0x84e3('0x28')](_0x683573)[_0x84e3('0x29')](function(_0x3af715){return _0x3af715;});}return null;};}function removeEntity(_0x404462,_0x301bbc){return function(_0x25eeb1){if(_0x25eeb1){return _0x25eeb1[_0x84e3('0x2a')]()[_0x84e3('0x29')](function(){_0x404462['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31d8cc,_0x566aff){return function(_0x28dc81){if(!_0x28dc81){_0x31d8cc['sendStatus'](0x194);}return _0x28dc81;};}function handleError(_0x1f8789,_0x4f704a){_0x4f704a=_0x4f704a||0x1f4;return function(_0x121ee6){logger[_0x84e3('0x2b')](_0x121ee6[_0x84e3('0x2c')]);if(_0x121ee6['name']){delete _0x121ee6[_0x84e3('0x2d')];}_0x1f8789[_0x84e3('0x1d')](_0x4f704a)[_0x84e3('0x2e')](_0x121ee6);};}exports['index']=function(_0x531031,_0x20b5dc){var _0x342192={},_0x3b188e={},_0x376e8b={'count':0x0,'rows':[]};var _0x24f22f=_['map'](db[_0x84e3('0x2f')][_0x84e3('0x30')],function(_0x313e58){return{'name':_0x313e58['fieldName'],'type':_0x313e58['type']['key']};});_0x3b188e[_0x84e3('0x31')]=_[_0x84e3('0x32')](_0x24f22f,_0x84e3('0x2d'));_0x3b188e[_0x84e3('0x33')]=_[_0x84e3('0x34')](_0x531031[_0x84e3('0x33')]);_0x3b188e[_0x84e3('0x35')]=_['intersection'](_0x3b188e[_0x84e3('0x31')],_0x3b188e[_0x84e3('0x33')]);_0x342192[_0x84e3('0x36')]=_[_0x84e3('0x37')](_0x3b188e[_0x84e3('0x31')],qs[_0x84e3('0x38')](_0x531031['query'][_0x84e3('0x38')]));_0x342192[_0x84e3('0x36')]=_0x342192['attributes'][_0x84e3('0x39')]?_0x342192[_0x84e3('0x36')]:_0x3b188e[_0x84e3('0x31')];if(!_0x531031[_0x84e3('0x33')][_0x84e3('0x3a')](_0x84e3('0x3b'))){_0x342192[_0x84e3('0x23')]=qs['limit'](_0x531031['query'][_0x84e3('0x23')]);_0x342192[_0x84e3('0x22')]=qs[_0x84e3('0x22')](_0x531031[_0x84e3('0x33')][_0x84e3('0x22')]);}_0x342192[_0x84e3('0x3c')]=qs['sort'](_0x531031[_0x84e3('0x33')][_0x84e3('0x3d')]);_0x342192['where']=qs[_0x84e3('0x35')](_[_0x84e3('0x3e')](_0x531031[_0x84e3('0x33')],_0x3b188e[_0x84e3('0x35')]),_0x24f22f);if(_0x531031[_0x84e3('0x33')][_0x84e3('0x3f')]){_0x342192['where']=_[_0x84e3('0x40')](_0x342192[_0x84e3('0x41')],{'$or':_[_0x84e3('0x32')](_0x24f22f,function(_0x26f915){if(_0x26f915[_0x84e3('0x42')]!==_0x84e3('0x43')){var _0x4f84c6={};_0x4f84c6[_0x26f915['name']]={'$like':'%'+_0x531031[_0x84e3('0x33')]['filter']+'%'};return _0x4f84c6;}})});}_0x342192=_[_0x84e3('0x40')]({},_0x342192,_0x531031['options']);var _0x3dc9e0={'where':_0x342192[_0x84e3('0x41')]};return db[_0x84e3('0x2f')]['count'](_0x3dc9e0)[_0x84e3('0x29')](function(_0xaf3775){_0x376e8b[_0x84e3('0x21')]=_0xaf3775;if(_0x531031[_0x84e3('0x33')][_0x84e3('0x44')]){_0x342192['include']=[{'all':!![]}];}return db[_0x84e3('0x2f')][_0x84e3('0x45')](_0x342192);})[_0x84e3('0x29')](function(_0x3163f1){_0x376e8b[_0x84e3('0x46')]=_0x3163f1;return _0x376e8b;})['then'](respondWithFilteredResult(_0x20b5dc,_0x342192))['catch'](handleError(_0x20b5dc,null));};exports['show']=function(_0x56ae7f,_0x320ac1){var _0x5a30b5={'raw':![],'where':{'id':_0x56ae7f[_0x84e3('0x47')]['id']}},_0x6cacfd={};_0x6cacfd[_0x84e3('0x31')]=_[_0x84e3('0x34')](db[_0x84e3('0x2f')][_0x84e3('0x30')]);_0x6cacfd[_0x84e3('0x33')]=_['keys'](_0x56ae7f[_0x84e3('0x33')]);_0x6cacfd[_0x84e3('0x35')]=_[_0x84e3('0x37')](_0x6cacfd[_0x84e3('0x31')],_0x6cacfd[_0x84e3('0x33')]);_0x5a30b5[_0x84e3('0x36')]=_[_0x84e3('0x37')](_0x6cacfd['model'],qs[_0x84e3('0x38')](_0x56ae7f[_0x84e3('0x33')][_0x84e3('0x38')]));_0x5a30b5['attributes']=_0x5a30b5['attributes'][_0x84e3('0x39')]?_0x5a30b5[_0x84e3('0x36')]:_0x6cacfd['model'];if(_0x56ae7f[_0x84e3('0x33')][_0x84e3('0x44')]){_0x5a30b5['include']=[{'all':!![]}];}_0x5a30b5=_[_0x84e3('0x40')]({},_0x5a30b5,_0x56ae7f[_0x84e3('0x48')]);return db['SugarcrmConfiguration'][_0x84e3('0x49')](_0x5a30b5)[_0x84e3('0x29')](handleEntityNotFound(_0x320ac1,null))['then'](respondWithResult(_0x320ac1,null))[_0x84e3('0x4a')](handleError(_0x320ac1,null));};exports['create']=function(_0x59c033,_0x5f5b33){return db[_0x84e3('0x2f')][_0x84e3('0x4b')](_0x59c033['body'],{})[_0x84e3('0x29')](respondWithResult(_0x5f5b33,0xc9))[_0x84e3('0x4a')](handleError(_0x5f5b33,null));};exports[_0x84e3('0x28')]=function(_0x40367e,_0x537a96){if(_0x40367e[_0x84e3('0x4c')]['id']){delete _0x40367e[_0x84e3('0x4c')]['id'];}return db[_0x84e3('0x2f')][_0x84e3('0x49')]({'where':{'id':_0x40367e[_0x84e3('0x47')]['id']}})[_0x84e3('0x29')](handleEntityNotFound(_0x537a96,null))[_0x84e3('0x29')](saveUpdates(_0x40367e[_0x84e3('0x4c')],null))['then'](respondWithResult(_0x537a96,null))[_0x84e3('0x4a')](handleError(_0x537a96,null));};exports[_0x84e3('0x2a')]=function(_0x41e86d,_0x51ecb1){return db[_0x84e3('0x2f')][_0x84e3('0x49')]({'where':{'id':_0x41e86d[_0x84e3('0x47')]['id']}})[_0x84e3('0x29')](handleEntityNotFound(_0x51ecb1,null))[_0x84e3('0x29')](removeEntity(_0x51ecb1,null))[_0x84e3('0x4a')](handleError(_0x51ecb1,null));};exports[_0x84e3('0x4d')]=function(_0x4d13ab,_0x1b7c16,_0x54872e){var _0x5290b7={};var _0x262759={};var _0x4fbea5;var _0x4ad4d7;return db[_0x84e3('0x2f')][_0x84e3('0x4e')]({'where':{'id':_0x4d13ab[_0x84e3('0x47')]['id']}})[_0x84e3('0x29')](handleEntityNotFound(_0x1b7c16,null))[_0x84e3('0x29')](function(_0x34f26d){if(_0x34f26d){_0x4fbea5=_0x34f26d;_0x262759[_0x84e3('0x31')]=_[_0x84e3('0x34')](db[_0x84e3('0x4f')][_0x84e3('0x30')]);_0x262759[_0x84e3('0x33')]=_['keys'](_0x4d13ab['query']);_0x262759[_0x84e3('0x35')]=_[_0x84e3('0x37')](_0x262759['model'],_0x262759[_0x84e3('0x33')]);_0x5290b7[_0x84e3('0x36')]=_['intersection'](_0x262759['model'],qs['fields'](_0x4d13ab[_0x84e3('0x33')][_0x84e3('0x38')]));_0x5290b7[_0x84e3('0x36')]=_0x5290b7[_0x84e3('0x36')][_0x84e3('0x39')]?_0x5290b7['attributes']:_0x262759[_0x84e3('0x31')];_0x5290b7[_0x84e3('0x3c')]=qs[_0x84e3('0x3d')](_0x4d13ab['query'][_0x84e3('0x3d')]);_0x5290b7['where']=qs[_0x84e3('0x35')](_[_0x84e3('0x3e')](_0x4d13ab['query'],_0x262759[_0x84e3('0x35')]));if(_0x4d13ab[_0x84e3('0x33')]['filter']){_0x5290b7[_0x84e3('0x41')]=_[_0x84e3('0x40')](_0x5290b7[_0x84e3('0x41')],{'$or':_[_0x84e3('0x32')](_0x5290b7[_0x84e3('0x36')],function(_0x5d0aaf){var _0x257014={};_0x257014[_0x5d0aaf]={'$like':'%'+_0x4d13ab['query'][_0x84e3('0x3f')]+'%'};return _0x257014;})});}_0x5290b7=_[_0x84e3('0x40')]({},_0x5290b7,_0x4d13ab['options']);return _0x4fbea5[_0x84e3('0x4d')](_0x5290b7);}})['then'](function(_0x6fd1e8){if(_0x6fd1e8){_0x4ad4d7=_0x6fd1e8[_0x84e3('0x39')];if(!_0x4d13ab[_0x84e3('0x33')]['hasOwnProperty'](_0x84e3('0x3b'))){_0x5290b7[_0x84e3('0x23')]=qs[_0x84e3('0x23')](_0x4d13ab['query'][_0x84e3('0x23')]);_0x5290b7[_0x84e3('0x22')]=qs[_0x84e3('0x22')](_0x4d13ab[_0x84e3('0x33')][_0x84e3('0x22')]);}return _0x4fbea5['getFields'](_0x5290b7);}})[_0x84e3('0x29')](function(_0x46eda5){if(_0x46eda5){return _0x46eda5?{'count':_0x4ad4d7,'rows':_0x46eda5}:null;}})[_0x84e3('0x29')](respondWithResult(_0x1b7c16,null))[_0x84e3('0x4a')](handleError(_0x1b7c16,null));};exports['getSubjects']=function(_0xf537d1,_0x171445,_0x3d2874){var _0x48c796={};var _0xb3195={};var _0x5676d4;var _0x949a1c;return db[_0x84e3('0x2f')][_0x84e3('0x4e')]({'where':{'id':_0xf537d1[_0x84e3('0x47')]['id']}})['then'](handleEntityNotFound(_0x171445,null))[_0x84e3('0x29')](function(_0x127a1c){if(_0x127a1c){_0x5676d4=_0x127a1c;_0xb3195[_0x84e3('0x31')]=_['keys'](db[_0x84e3('0x4f')][_0x84e3('0x30')]);_0xb3195[_0x84e3('0x33')]=_[_0x84e3('0x34')](_0xf537d1['query']);_0xb3195[_0x84e3('0x35')]=_[_0x84e3('0x37')](_0xb3195['model'],_0xb3195[_0x84e3('0x33')]);_0x48c796[_0x84e3('0x36')]=_[_0x84e3('0x37')](_0xb3195['model'],qs[_0x84e3('0x38')](_0xf537d1[_0x84e3('0x33')][_0x84e3('0x38')]));_0x48c796[_0x84e3('0x36')]=_0x48c796[_0x84e3('0x36')][_0x84e3('0x39')]?_0x48c796[_0x84e3('0x36')]:_0xb3195[_0x84e3('0x31')];_0x48c796['order']=qs[_0x84e3('0x3d')](_0xf537d1[_0x84e3('0x33')]['sort']);_0x48c796['where']=qs[_0x84e3('0x35')](_['pick'](_0xf537d1['query'],_0xb3195[_0x84e3('0x35')]));if(_0xf537d1[_0x84e3('0x33')][_0x84e3('0x3f')]){_0x48c796['where']=_[_0x84e3('0x40')](_0x48c796[_0x84e3('0x41')],{'$or':_[_0x84e3('0x32')](_0x48c796[_0x84e3('0x36')],function(_0x161862){var _0x1eb1c9={};_0x1eb1c9[_0x161862]={'$like':'%'+_0xf537d1['query']['filter']+'%'};return _0x1eb1c9;})});}_0x48c796=_['merge']({},_0x48c796,_0xf537d1[_0x84e3('0x48')]);return _0x5676d4[_0x84e3('0x50')](_0x48c796);}})[_0x84e3('0x29')](function(_0x37aac9){if(_0x37aac9){_0x949a1c=_0x37aac9[_0x84e3('0x39')];if(!_0xf537d1[_0x84e3('0x33')][_0x84e3('0x3a')](_0x84e3('0x3b'))){_0x48c796[_0x84e3('0x23')]=qs[_0x84e3('0x23')](_0xf537d1['query'][_0x84e3('0x23')]);_0x48c796[_0x84e3('0x22')]=qs[_0x84e3('0x22')](_0xf537d1[_0x84e3('0x33')]['offset']);}return _0x5676d4['getSubjects'](_0x48c796);}})[_0x84e3('0x29')](function(_0xf7ed97){if(_0xf7ed97){return _0xf7ed97?{'count':_0x949a1c,'rows':_0xf7ed97}:null;}})[_0x84e3('0x29')](respondWithResult(_0x171445,null))['catch'](handleError(_0x171445,null));};exports[_0x84e3('0x51')]=function(_0x53d711,_0x306708,_0x49d6bc){var _0x4305d2={};var _0x210914={};var _0x1911ec;var _0x26ec4c;return db[_0x84e3('0x2f')][_0x84e3('0x4e')]({'where':{'id':_0x53d711['params']['id']}})[_0x84e3('0x29')](handleEntityNotFound(_0x306708,null))[_0x84e3('0x29')](function(_0x3b0e9e){if(_0x3b0e9e){_0x1911ec=_0x3b0e9e;_0x210914[_0x84e3('0x31')]=_['keys'](db[_0x84e3('0x4f')]['rawAttributes']);_0x210914[_0x84e3('0x33')]=_['keys'](_0x53d711[_0x84e3('0x33')]);_0x210914[_0x84e3('0x35')]=_['intersection'](_0x210914['model'],_0x210914['query']);_0x4305d2[_0x84e3('0x36')]=_['intersection'](_0x210914[_0x84e3('0x31')],qs[_0x84e3('0x38')](_0x53d711[_0x84e3('0x33')][_0x84e3('0x38')]));_0x4305d2[_0x84e3('0x36')]=_0x4305d2[_0x84e3('0x36')][_0x84e3('0x39')]?_0x4305d2[_0x84e3('0x36')]:_0x210914['model'];_0x4305d2[_0x84e3('0x3c')]=qs[_0x84e3('0x3d')](_0x53d711[_0x84e3('0x33')][_0x84e3('0x3d')]);_0x4305d2['where']=qs[_0x84e3('0x35')](_['pick'](_0x53d711[_0x84e3('0x33')],_0x210914[_0x84e3('0x35')]));if(_0x53d711['query'][_0x84e3('0x3f')]){_0x4305d2[_0x84e3('0x41')]=_['merge'](_0x4305d2[_0x84e3('0x41')],{'$or':_[_0x84e3('0x32')](_0x4305d2[_0x84e3('0x36')],function(_0x291383){var _0x40fdc8={};_0x40fdc8[_0x291383]={'$like':'%'+_0x53d711[_0x84e3('0x33')][_0x84e3('0x3f')]+'%'};return _0x40fdc8;})});}_0x4305d2=_[_0x84e3('0x40')]({},_0x4305d2,_0x53d711[_0x84e3('0x48')]);return _0x1911ec['getDescriptions'](_0x4305d2);}})[_0x84e3('0x29')](function(_0x28a14d){if(_0x28a14d){_0x26ec4c=_0x28a14d['length'];if(!_0x53d711[_0x84e3('0x33')]['hasOwnProperty']('nolimit')){_0x4305d2['limit']=qs[_0x84e3('0x23')](_0x53d711['query']['limit']);_0x4305d2['offset']=qs[_0x84e3('0x22')](_0x53d711[_0x84e3('0x33')][_0x84e3('0x22')]);}return _0x1911ec['getDescriptions'](_0x4305d2);}})[_0x84e3('0x29')](function(_0x29d8ab){if(_0x29d8ab){return _0x29d8ab?{'count':_0x26ec4c,'rows':_0x29d8ab}:null;}})[_0x84e3('0x29')](respondWithResult(_0x306708,null))[_0x84e3('0x4a')](handleError(_0x306708,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index ca0ba5b..28e81cf 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 _0x4bb2=['moment','bluebird','path','rimraf','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','api'];(function(_0x361704,_0x3af61c){var _0x258953=function(_0x53ca46){while(--_0x53ca46){_0x361704['push'](_0x361704['shift']());}};_0x258953(++_0x3af61c);}(_0x4bb2,0x105));var _0x24bb=function(_0x5eee48,_0xd7d559){_0x5eee48=_0x5eee48-0x0;var _0x2ff2f7=_0x4bb2[_0x5eee48];return _0x2ff2f7;};'use strict';var _=require(_0x24bb('0x0'));var util=require('util');var logger=require(_0x24bb('0x1'))(_0x24bb('0x2'));var moment=require(_0x24bb('0x3'));var BPromise=require(_0x24bb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x24bb('0x5'));var rimraf=require(_0x24bb('0x6'));var config=require('../../config/environment');var attributes=require(_0x24bb('0x7'));module[_0x24bb('0x8')]=function(_0xdd07c9,_0x215fa0){return _0xdd07c9[_0x24bb('0x9')](_0x24bb('0xa'),attributes,{'tableName':_0x24bb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b03=['int_sugarcrm_configurations','lodash','../../config/logger','api','bluebird','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration'];(function(_0x3dd7d8,_0x27409f){var _0x4215b9=function(_0xd73150){while(--_0xd73150){_0x3dd7d8['push'](_0x3dd7d8['shift']());}};_0x4215b9(++_0x27409f);}(_0x5b03,0x161));var _0x35b0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5b03[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x35b0('0x0'));var util=require('util');var logger=require(_0x35b0('0x1'))(_0x35b0('0x2'));var moment=require('moment');var BPromise=require(_0x35b0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x35b0('0x4'));var rimraf=require('rimraf');var config=require(_0x35b0('0x5'));var attributes=require(_0x35b0('0x6'));module[_0x35b0('0x7')]=function(_0x228352,_0x5c5a34){return _0x228352[_0x35b0('0x8')](_0x35b0('0x9'),attributes,{'tableName':_0x35b0('0xa'),'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 d900aff..2f22e56 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 _0xacc4=['client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4a874e,_0x166d48){var _0x4cb77c=function(_0x3d692e){while(--_0x3d692e){_0x4a874e['push'](_0x4a874e['shift']());}};_0x4cb77c(++_0x166d48);}(_0xacc4,0x13f));var _0x4acc=function(_0xd4636c,_0x34dbf6){_0xd4636c=_0xd4636c-0x0;var _0x5ee17d=_0xacc4[_0xd4636c];return _0x5ee17d;};'use strict';var _=require(_0x4acc('0x0'));var util=require(_0x4acc('0x1'));var moment=require(_0x4acc('0x2'));var BPromise=require(_0x4acc('0x3'));var rs=require(_0x4acc('0x4'));var fs=require('fs');var Redis=require(_0x4acc('0x5'));var db=require(_0x4acc('0x6'))['db'];var utils=require(_0x4acc('0x7'));var logger=require(_0x4acc('0x8'))('rpc');var config=require(_0x4acc('0x9'));var jayson=require(_0x4acc('0xa'));var client=jayson[_0x4acc('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a0b10,_0x2ce389,_0x227756){return new BPromise(function(_0x1e8487,_0x1cac5a){return client[_0x4acc('0xc')](_0x1a0b10,_0x227756)[_0x4acc('0xd')](function(_0x4a4847){logger[_0x4acc('0xe')](_0x4acc('0xf'),_0x2ce389,_0x4acc('0x10'));logger['debug'](_0x4acc('0x11'),_0x2ce389,'request\x20sent',JSON['stringify'](_0x4a4847));if(_0x4a4847['error']){if(_0x4a4847['error'][_0x4acc('0x12')]===0x1f4){logger['error'](_0x4acc('0xf'),_0x2ce389,_0x4a4847[_0x4acc('0x13')][_0x4acc('0x14')]);return _0x1cac5a(_0x4a4847[_0x4acc('0x13')][_0x4acc('0x14')]);}logger[_0x4acc('0x13')](_0x4acc('0xf'),_0x2ce389,_0x4a4847[_0x4acc('0x13')][_0x4acc('0x14')]);return _0x1e8487(_0x4a4847[_0x4acc('0x13')][_0x4acc('0x14')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x2ce389,'request\x20sent');_0x1e8487(_0x4a4847[_0x4acc('0x15')][_0x4acc('0x14')]);}})['catch'](function(_0x261536){logger['error'](_0x4acc('0xf'),_0x2ce389,_0x261536);_0x1cac5a(_0x261536);});});} \ No newline at end of file +var _0x4015=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','util'];(function(_0x468377,_0x8f9e40){var _0x51cef3=function(_0x3df806){while(--_0x3df806){_0x468377['push'](_0x468377['shift']());}};_0x51cef3(++_0x8f9e40);}(_0x4015,0x110));var _0x5401=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0x4015[_0x5f1cf8];return _0x27d0fa;};'use strict';var _=require('lodash');var util=require(_0x5401('0x0'));var moment=require(_0x5401('0x1'));var BPromise=require(_0x5401('0x2'));var rs=require(_0x5401('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5401('0x4'))['db'];var utils=require(_0x5401('0x5'));var logger=require(_0x5401('0x6'))(_0x5401('0x7'));var config=require(_0x5401('0x8'));var jayson=require(_0x5401('0x9'));var client=jayson[_0x5401('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59e23f,_0x436830,_0x3a3999){return new BPromise(function(_0x2d82f7,_0x4d1488){return client['request'](_0x59e23f,_0x3a3999)[_0x5401('0xb')](function(_0x1d4ed4){logger['info'](_0x5401('0xc'),_0x436830,_0x5401('0xd'));logger[_0x5401('0xe')](_0x5401('0xf'),_0x436830,'request\x20sent',JSON[_0x5401('0x10')](_0x1d4ed4));if(_0x1d4ed4[_0x5401('0x11')]){if(_0x1d4ed4[_0x5401('0x11')]['code']===0x1f4){logger[_0x5401('0x11')](_0x5401('0xc'),_0x436830,_0x1d4ed4[_0x5401('0x11')][_0x5401('0x12')]);return _0x4d1488(_0x1d4ed4[_0x5401('0x11')][_0x5401('0x12')]);}logger[_0x5401('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x436830,_0x1d4ed4[_0x5401('0x11')][_0x5401('0x12')]);return _0x2d82f7(_0x1d4ed4[_0x5401('0x11')]['message']);}else{logger[_0x5401('0x13')](_0x5401('0xc'),_0x436830,_0x5401('0xd'));_0x2d82f7(_0x1d4ed4['result'][_0x5401('0x12')]);}})[_0x5401('0x14')](function(_0x292a5b){logger[_0x5401('0x11')](_0x5401('0xc'),_0x436830,_0x292a5b);_0x4d1488(_0x292a5b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index ebc68f8..092d14c 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 _0xf14c=['path','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xf14c,0x141));var _0xcf14=function(_0x43dae8,_0xac1de7){_0x43dae8=_0x43dae8-0x0;var _0x4e7ffe=_0xf14c[_0x43dae8];return _0x4e7ffe;};'use strict';var multer=require(_0xcf14('0x0'));var util=require(_0xcf14('0x1'));var path=require(_0xcf14('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcf14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcf14('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcf14('0x5'));var controller=require(_0xcf14('0x6'));router['get']('/',auth[_0xcf14('0x7')](),controller['index']);router[_0xcf14('0x8')](_0xcf14('0x9'),auth['isAuthenticated'](),controller[_0xcf14('0xa')]);router[_0xcf14('0xb')]('/',auth[_0xcf14('0x7')](),controller[_0xcf14('0xc')]);router[_0xcf14('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xcf14('0xe')]);router[_0xcf14('0xf')](_0xcf14('0x9'),auth[_0xcf14('0x7')](),controller[_0xcf14('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2fc2=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x37f46c,_0x711b84){var _0x2c1498=function(_0x31df19){while(--_0x31df19){_0x37f46c['push'](_0x37f46c['shift']());}};_0x2c1498(++_0x711b84);}(_0x2fc2,0x1b6));var _0x22fc=function(_0x44f098,_0x21cacf){_0x44f098=_0x44f098-0x0;var _0x45e58b=_0x2fc2[_0x44f098];return _0x45e58b;};'use strict';var multer=require(_0x22fc('0x0'));var util=require(_0x22fc('0x1'));var path=require(_0x22fc('0x2'));var timeout=require(_0x22fc('0x3'));var express=require(_0x22fc('0x4'));var router=express[_0x22fc('0x5')]();var fs_extra=require(_0x22fc('0x6'));var auth=require(_0x22fc('0x7'));var interaction=require(_0x22fc('0x8'));var config=require(_0x22fc('0x9'));var controller=require(_0x22fc('0xa'));router[_0x22fc('0xb')]('/',auth[_0x22fc('0xc')](),controller['index']);router[_0x22fc('0xb')](_0x22fc('0xd'),auth[_0x22fc('0xc')](),controller[_0x22fc('0xe')]);router[_0x22fc('0xf')]('/',auth['isAuthenticated'](),controller[_0x22fc('0x10')]);router['put'](_0x22fc('0xd'),auth[_0x22fc('0xc')](),controller[_0x22fc('0x11')]);router[_0x22fc('0x12')](_0x22fc('0xd'),auth[_0x22fc('0xc')](),controller[_0x22fc('0x13')]);module[_0x22fc('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index a655683..52a88a1 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 _0x0543=['keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x44606e,_0x2bf244){var _0xe68388=function(_0x488a30){while(--_0x488a30){_0x44606e['push'](_0x44606e['shift']());}};_0xe68388(++_0x2bf244);}(_0x0543,0x14f));var _0x3054=function(_0x12786e,_0x3347b5){_0x12786e=_0x12786e-0x0;var _0x15bf46=_0x0543[_0x12786e];return _0x15bf46;};'use strict';var Sequelize=require(_0x3054('0x0'));module[_0x3054('0x1')]={'type':{'type':Sequelize[_0x3054('0x2')](_0x3054('0x3'),_0x3054('0x4'),'customVariable',_0x3054('0x5'),_0x3054('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3054('0x7')]},'key':{'type':Sequelize[_0x3054('0x7')]},'keyType':{'type':Sequelize[_0x3054('0x2')](_0x3054('0x3'),'variable',_0x3054('0x8'))},'keyContent':{'type':Sequelize[_0x3054('0x7')]},'idField':{'type':Sequelize[_0x3054('0x7')]},'nameField':{'type':Sequelize[_0x3054('0x7')]},'customField':{'type':Sequelize[_0x3054('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3054('0x7')]}}; \ No newline at end of file +var _0xe3a6=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','STRING'];(function(_0x442f02,_0x47d845){var _0xab6ef1=function(_0x4cad5c){while(--_0x4cad5c){_0x442f02['push'](_0x442f02['shift']());}};_0xab6ef1(++_0x47d845);}(_0xe3a6,0x1f2));var _0x6e3a=function(_0xa1b8e1,_0x31e781){_0xa1b8e1=_0xa1b8e1-0x0;var _0x16e56c=_0xe3a6[_0xa1b8e1];return _0x16e56c;};'use strict';var Sequelize=require(_0x6e3a('0x0'));module[_0x6e3a('0x1')]={'type':{'type':Sequelize[_0x6e3a('0x2')](_0x6e3a('0x3'),'variable',_0x6e3a('0x4'),'keyValue','picklist'),'defaultValue':_0x6e3a('0x3')},'content':{'type':Sequelize[_0x6e3a('0x5')]},'key':{'type':Sequelize[_0x6e3a('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x6e3a('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6e3a('0x5')]},'nameField':{'type':Sequelize[_0x6e3a('0x5')]},'customField':{'type':Sequelize[_0x6e3a('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6e3a('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 6a6b498..a79c05c 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 _0xf8e6=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','index','map','SugarcrmField','fieldName','type','key','model','name','query','keys','filters','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','findAll','rows','show','rawAttributes','intersection','includeAll','include','options','create','catch','body','params','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0xf8e6,0xd8));var _0x6f8e=function(_0x1b2a13,_0x50690c){_0x1b2a13=_0x1b2a13-0x0;var _0x534811=_0xf8e6[_0x1b2a13];return _0x534811;};'use strict';var emlformat=require(_0x6f8e('0x0'));var rimraf=require(_0x6f8e('0x1'));var zipdir=require(_0x6f8e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f8e('0x3'));var moment=require(_0x6f8e('0x4'));var BPromise=require(_0x6f8e('0x5'));var Mustache=require(_0x6f8e('0x6'));var util=require(_0x6f8e('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x6f8e('0x8'));var ejs=require(_0x6f8e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f8e('0xa'));var squel=require(_0x6f8e('0xb'));var crypto=require(_0x6f8e('0xc'));var jsforce=require(_0x6f8e('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6f8e('0xe'));var Papa=require(_0x6f8e('0xf'));var Redis=require(_0x6f8e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6f8e('0x11'));var as=require(_0x6f8e('0x12'));var hardwareService=require(_0x6f8e('0x13'));var logger=require(_0x6f8e('0x14'))(_0x6f8e('0x15'));var utils=require(_0x6f8e('0x16'));var config=require(_0x6f8e('0x17'));var licenseUtil=require(_0x6f8e('0x18'));var db=require(_0x6f8e('0x19'))['db'];function respondWithStatusCode(_0x5be8aa,_0x5169d3){_0x5169d3=_0x5169d3||0xcc;return function(_0x426543){if(_0x426543){return _0x5be8aa['sendStatus'](_0x5169d3);}return _0x5be8aa[_0x6f8e('0x1a')](_0x5169d3)[_0x6f8e('0x1b')]();};}function respondWithResult(_0x4274a9,_0x592e78){_0x592e78=_0x592e78||0xc8;return function(_0xff8376){if(_0xff8376){return _0x4274a9[_0x6f8e('0x1a')](_0x592e78)['json'](_0xff8376);}};}function respondWithFilteredResult(_0x4c937c,_0x4f44ea){return function(_0xd850c5){if(_0xd850c5){var _0x1fea35=typeof _0x4f44ea['offset']===_0x6f8e('0x1c')&&typeof _0x4f44ea[_0x6f8e('0x1d')]==='undefined';var _0x3a0358=_0xd850c5[_0x6f8e('0x1e')];var _0x193bed=_0x1fea35?0x0:_0x4f44ea[_0x6f8e('0x1f')];var _0x3d9774=_0x1fea35?_0xd850c5[_0x6f8e('0x1e')]:_0x4f44ea['offset']+_0x4f44ea['limit'];var _0x282a4c;if(_0x3d9774>=_0x3a0358){_0x3d9774=_0x3a0358;_0x282a4c=0xc8;}else{_0x282a4c=0xce;}_0x4c937c[_0x6f8e('0x1a')](_0x282a4c);return _0x4c937c[_0x6f8e('0x20')](_0x6f8e('0x21'),_0x193bed+'-'+_0x3d9774+'/'+_0x3a0358)[_0x6f8e('0x22')](_0xd850c5);}return null;};}function patchUpdates(_0x3f7241){return function(_0x46a5d5){try{jsonpatch[_0x6f8e('0x23')](_0x46a5d5,_0x3f7241,!![]);}catch(_0xedeeb7){return BPromise[_0x6f8e('0x24')](_0xedeeb7);}return _0x46a5d5[_0x6f8e('0x25')]();};}function saveUpdates(_0x3ba624,_0x117b52){return function(_0x4b25f4){if(_0x4b25f4){return _0x4b25f4[_0x6f8e('0x26')](_0x3ba624)['then'](function(_0x18d499){return _0x18d499;});}return null;};}function removeEntity(_0x567970,_0x42dd92){return function(_0x183997){if(_0x183997){return _0x183997[_0x6f8e('0x27')]()[_0x6f8e('0x28')](function(){_0x567970[_0x6f8e('0x1a')](0xcc)[_0x6f8e('0x1b')]();});}};}function handleEntityNotFound(_0xbc4051,_0x58cfc3){return function(_0x413ba4){if(!_0x413ba4){_0xbc4051[_0x6f8e('0x29')](0x194);}return _0x413ba4;};}function handleError(_0x2da773,_0xbdf586){_0xbdf586=_0xbdf586||0x1f4;return function(_0x1d86c1){logger[_0x6f8e('0x2a')](_0x1d86c1[_0x6f8e('0x2b')]);if(_0x1d86c1['name']){delete _0x1d86c1['name'];}_0x2da773[_0x6f8e('0x1a')](_0xbdf586)['send'](_0x1d86c1);};}exports[_0x6f8e('0x2c')]=function(_0x250bcb,_0x3ba347){var _0x1a2689={},_0x14b5a6={},_0x556971={'count':0x0,'rows':[]};var _0x32bc35=_[_0x6f8e('0x2d')](db[_0x6f8e('0x2e')]['rawAttributes'],function(_0x4c08b8){return{'name':_0x4c08b8[_0x6f8e('0x2f')],'type':_0x4c08b8[_0x6f8e('0x30')][_0x6f8e('0x31')]};});_0x14b5a6[_0x6f8e('0x32')]=_['map'](_0x32bc35,_0x6f8e('0x33'));_0x14b5a6[_0x6f8e('0x34')]=_[_0x6f8e('0x35')](_0x250bcb[_0x6f8e('0x34')]);_0x14b5a6[_0x6f8e('0x36')]=_['intersection'](_0x14b5a6['model'],_0x14b5a6[_0x6f8e('0x34')]);_0x1a2689[_0x6f8e('0x37')]=_['intersection'](_0x14b5a6[_0x6f8e('0x32')],qs[_0x6f8e('0x38')](_0x250bcb[_0x6f8e('0x34')][_0x6f8e('0x38')]));_0x1a2689[_0x6f8e('0x37')]=_0x1a2689['attributes'][_0x6f8e('0x39')]?_0x1a2689['attributes']:_0x14b5a6[_0x6f8e('0x32')];if(!_0x250bcb[_0x6f8e('0x34')]['hasOwnProperty'](_0x6f8e('0x3a'))){_0x1a2689[_0x6f8e('0x1d')]=qs['limit'](_0x250bcb[_0x6f8e('0x34')][_0x6f8e('0x1d')]);_0x1a2689['offset']=qs[_0x6f8e('0x1f')](_0x250bcb[_0x6f8e('0x34')][_0x6f8e('0x1f')]);}_0x1a2689[_0x6f8e('0x3b')]=qs[_0x6f8e('0x3c')](_0x250bcb[_0x6f8e('0x34')][_0x6f8e('0x3c')]);_0x1a2689['where']=qs[_0x6f8e('0x36')](_[_0x6f8e('0x3d')](_0x250bcb[_0x6f8e('0x34')],_0x14b5a6[_0x6f8e('0x36')]),_0x32bc35);if(_0x250bcb[_0x6f8e('0x34')][_0x6f8e('0x3e')]){_0x1a2689[_0x6f8e('0x3f')]=_[_0x6f8e('0x40')](_0x1a2689[_0x6f8e('0x3f')],{'$or':_[_0x6f8e('0x2d')](_0x32bc35,function(_0x31572e){if(_0x31572e[_0x6f8e('0x30')]!==_0x6f8e('0x41')){var _0x5119fa={};_0x5119fa[_0x31572e[_0x6f8e('0x33')]]={'$like':'%'+_0x250bcb[_0x6f8e('0x34')][_0x6f8e('0x3e')]+'%'};return _0x5119fa;}})});}_0x1a2689=_[_0x6f8e('0x40')]({},_0x1a2689,_0x250bcb['options']);var _0x59ffb5={'where':_0x1a2689['where']};return db[_0x6f8e('0x2e')]['count'](_0x59ffb5)[_0x6f8e('0x28')](function(_0x8bd729){_0x556971['count']=_0x8bd729;if(_0x250bcb[_0x6f8e('0x34')]['includeAll']){_0x1a2689['include']=[{'all':!![]}];}return db[_0x6f8e('0x2e')][_0x6f8e('0x42')](_0x1a2689);})[_0x6f8e('0x28')](function(_0x51c0d9){_0x556971[_0x6f8e('0x43')]=_0x51c0d9;return _0x556971;})['then'](respondWithFilteredResult(_0x3ba347,_0x1a2689))['catch'](handleError(_0x3ba347,null));};exports[_0x6f8e('0x44')]=function(_0x50d5f8,_0x3d0ae4){var _0x1e98d8={'raw':!![],'where':{'id':_0x50d5f8['params']['id']}},_0x158c5c={};_0x158c5c[_0x6f8e('0x32')]=_[_0x6f8e('0x35')](db[_0x6f8e('0x2e')][_0x6f8e('0x45')]);_0x158c5c['query']=_[_0x6f8e('0x35')](_0x50d5f8[_0x6f8e('0x34')]);_0x158c5c[_0x6f8e('0x36')]=_[_0x6f8e('0x46')](_0x158c5c[_0x6f8e('0x32')],_0x158c5c[_0x6f8e('0x34')]);_0x1e98d8['attributes']=_[_0x6f8e('0x46')](_0x158c5c[_0x6f8e('0x32')],qs[_0x6f8e('0x38')](_0x50d5f8[_0x6f8e('0x34')]['fields']));_0x1e98d8[_0x6f8e('0x37')]=_0x1e98d8[_0x6f8e('0x37')][_0x6f8e('0x39')]?_0x1e98d8[_0x6f8e('0x37')]:_0x158c5c[_0x6f8e('0x32')];if(_0x50d5f8[_0x6f8e('0x34')][_0x6f8e('0x47')]){_0x1e98d8[_0x6f8e('0x48')]=[{'all':!![]}];}_0x1e98d8=_['merge']({},_0x1e98d8,_0x50d5f8[_0x6f8e('0x49')]);return db[_0x6f8e('0x2e')]['find'](_0x1e98d8)[_0x6f8e('0x28')](handleEntityNotFound(_0x3d0ae4,null))[_0x6f8e('0x28')](respondWithResult(_0x3d0ae4,null))['catch'](handleError(_0x3d0ae4,null));};exports['create']=function(_0x26857d,_0x431c7b){return db['SugarcrmField'][_0x6f8e('0x4a')](_0x26857d['body'],{})[_0x6f8e('0x28')](respondWithResult(_0x431c7b,0xc9))[_0x6f8e('0x4b')](handleError(_0x431c7b,null));};exports[_0x6f8e('0x26')]=function(_0x4812d0,_0x436494){if(_0x4812d0['body']['id']){delete _0x4812d0[_0x6f8e('0x4c')]['id'];}return db[_0x6f8e('0x2e')]['find']({'where':{'id':_0x4812d0[_0x6f8e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x436494,null))[_0x6f8e('0x28')](saveUpdates(_0x4812d0[_0x6f8e('0x4c')],null))[_0x6f8e('0x28')](respondWithResult(_0x436494,null))['catch'](handleError(_0x436494,null));};exports[_0x6f8e('0x27')]=function(_0x5dd08b,_0x17534f){return db[_0x6f8e('0x2e')][_0x6f8e('0x4e')]({'where':{'id':_0x5dd08b[_0x6f8e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x17534f,null))['then'](removeEntity(_0x17534f,null))[_0x6f8e('0x4b')](handleError(_0x17534f,null));}; \ No newline at end of file +var _0x3156=['../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','SugarcrmField','include','rows','catch','params','includeAll','find','create','body','update','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x524bb0,_0x326327){var _0x2fb947=function(_0x56302b){while(--_0x56302b){_0x524bb0['push'](_0x524bb0['shift']());}};_0x2fb947(++_0x326327);}(_0x3156,0xca));var _0x6315=function(_0x12ca1c,_0xe43be9){_0x12ca1c=_0x12ca1c-0x0;var _0x3afc5d=_0x3156[_0x12ca1c];return _0x3afc5d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6315('0x0'));var rp=require(_0x6315('0x1'));var moment=require(_0x6315('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6315('0x3'));var util=require(_0x6315('0x4'));var path=require(_0x6315('0x5'));var sox=require(_0x6315('0x6'));var csv=require('to-csv');var ejs=require(_0x6315('0x7'));var fs=require('fs');var fs_extra=require(_0x6315('0x8'));var _=require(_0x6315('0x9'));var squel=require(_0x6315('0xa'));var crypto=require(_0x6315('0xb'));var jsforce=require(_0x6315('0xc'));var deskjs=require(_0x6315('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6315('0xe'));var Redis=require('ioredis');var authService=require(_0x6315('0xf'));var qs=require(_0x6315('0x10'));var as=require(_0x6315('0x11'));var hardwareService=require(_0x6315('0x12'));var logger=require(_0x6315('0x13'))(_0x6315('0x14'));var utils=require(_0x6315('0x15'));var config=require(_0x6315('0x16'));var licenseUtil=require(_0x6315('0x17'));var db=require(_0x6315('0x18'))['db'];function respondWithStatusCode(_0x4486a6,_0x26f304){_0x26f304=_0x26f304||0xcc;return function(_0x582de8){if(_0x582de8){return _0x4486a6['sendStatus'](_0x26f304);}return _0x4486a6[_0x6315('0x19')](_0x26f304)[_0x6315('0x1a')]();};}function respondWithResult(_0x5ad9b4,_0x46bcc3){_0x46bcc3=_0x46bcc3||0xc8;return function(_0x233633){if(_0x233633){return _0x5ad9b4['status'](_0x46bcc3)[_0x6315('0x1b')](_0x233633);}};}function respondWithFilteredResult(_0x3372ed,_0x4f67ff){return function(_0x25c67b){if(_0x25c67b){var _0x3a59e6=typeof _0x4f67ff[_0x6315('0x1c')]===_0x6315('0x1d')&&typeof _0x4f67ff[_0x6315('0x1e')]===_0x6315('0x1d');var _0x5300c7=_0x25c67b['count'];var _0x2472ed=_0x3a59e6?0x0:_0x4f67ff[_0x6315('0x1c')];var _0x52cd08=_0x3a59e6?_0x25c67b[_0x6315('0x1f')]:_0x4f67ff[_0x6315('0x1c')]+_0x4f67ff[_0x6315('0x1e')];var _0x3107e4;if(_0x52cd08>=_0x5300c7){_0x52cd08=_0x5300c7;_0x3107e4=0xc8;}else{_0x3107e4=0xce;}_0x3372ed[_0x6315('0x19')](_0x3107e4);return _0x3372ed[_0x6315('0x20')](_0x6315('0x21'),_0x2472ed+'-'+_0x52cd08+'/'+_0x5300c7)[_0x6315('0x1b')](_0x25c67b);}return null;};}function patchUpdates(_0x49bde8){return function(_0x3359a3){try{jsonpatch[_0x6315('0x22')](_0x3359a3,_0x49bde8,!![]);}catch(_0x212827){return BPromise['reject'](_0x212827);}return _0x3359a3['save']();};}function saveUpdates(_0x6ea0b3,_0x5c5876){return function(_0xe77aa2){if(_0xe77aa2){return _0xe77aa2['update'](_0x6ea0b3)[_0x6315('0x23')](function(_0x427a3a){return _0x427a3a;});}return null;};}function removeEntity(_0x164c29,_0x31fe78){return function(_0x20e09d){if(_0x20e09d){return _0x20e09d[_0x6315('0x24')]()['then'](function(){_0x164c29['status'](0xcc)[_0x6315('0x1a')]();});}};}function handleEntityNotFound(_0x2854ac,_0x5c1a41){return function(_0x392907){if(!_0x392907){_0x2854ac[_0x6315('0x25')](0x194);}return _0x392907;};}function handleError(_0x50c2fc,_0x256e33){_0x256e33=_0x256e33||0x1f4;return function(_0x507929){logger[_0x6315('0x26')](_0x507929[_0x6315('0x27')]);if(_0x507929['name']){delete _0x507929[_0x6315('0x28')];}_0x50c2fc['status'](_0x256e33)[_0x6315('0x29')](_0x507929);};}exports[_0x6315('0x2a')]=function(_0x148bda,_0x369b30){var _0x58ec9d={},_0x16655b={},_0x2656cb={'count':0x0,'rows':[]};var _0x5daf4f=_['map'](db['SugarcrmField'][_0x6315('0x2b')],function(_0x257f33){return{'name':_0x257f33['fieldName'],'type':_0x257f33[_0x6315('0x2c')][_0x6315('0x2d')]};});_0x16655b['model']=_[_0x6315('0x2e')](_0x5daf4f,_0x6315('0x28'));_0x16655b[_0x6315('0x2f')]=_[_0x6315('0x30')](_0x148bda[_0x6315('0x2f')]);_0x16655b[_0x6315('0x31')]=_[_0x6315('0x32')](_0x16655b['model'],_0x16655b[_0x6315('0x2f')]);_0x58ec9d[_0x6315('0x33')]=_[_0x6315('0x32')](_0x16655b[_0x6315('0x34')],qs[_0x6315('0x35')](_0x148bda[_0x6315('0x2f')]['fields']));_0x58ec9d[_0x6315('0x33')]=_0x58ec9d['attributes'][_0x6315('0x36')]?_0x58ec9d[_0x6315('0x33')]:_0x16655b[_0x6315('0x34')];if(!_0x148bda[_0x6315('0x2f')][_0x6315('0x37')](_0x6315('0x38'))){_0x58ec9d['limit']=qs['limit'](_0x148bda[_0x6315('0x2f')]['limit']);_0x58ec9d[_0x6315('0x1c')]=qs[_0x6315('0x1c')](_0x148bda['query'][_0x6315('0x1c')]);}_0x58ec9d[_0x6315('0x39')]=qs['sort'](_0x148bda[_0x6315('0x2f')][_0x6315('0x3a')]);_0x58ec9d[_0x6315('0x3b')]=qs[_0x6315('0x31')](_[_0x6315('0x3c')](_0x148bda['query'],_0x16655b[_0x6315('0x31')]),_0x5daf4f);if(_0x148bda[_0x6315('0x2f')][_0x6315('0x3d')]){_0x58ec9d[_0x6315('0x3b')]=_['merge'](_0x58ec9d['where'],{'$or':_[_0x6315('0x2e')](_0x5daf4f,function(_0x36d5f8){if(_0x36d5f8[_0x6315('0x2c')]!==_0x6315('0x3e')){var _0x2aef66={};_0x2aef66[_0x36d5f8[_0x6315('0x28')]]={'$like':'%'+_0x148bda[_0x6315('0x2f')]['filter']+'%'};return _0x2aef66;}})});}_0x58ec9d=_[_0x6315('0x3f')]({},_0x58ec9d,_0x148bda[_0x6315('0x40')]);var _0x4baa87={'where':_0x58ec9d[_0x6315('0x3b')]};return db[_0x6315('0x41')]['count'](_0x4baa87)[_0x6315('0x23')](function(_0x2b51fb){_0x2656cb[_0x6315('0x1f')]=_0x2b51fb;if(_0x148bda[_0x6315('0x2f')]['includeAll']){_0x58ec9d[_0x6315('0x42')]=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x58ec9d);})[_0x6315('0x23')](function(_0x21c5a8){_0x2656cb[_0x6315('0x43')]=_0x21c5a8;return _0x2656cb;})[_0x6315('0x23')](respondWithFilteredResult(_0x369b30,_0x58ec9d))[_0x6315('0x44')](handleError(_0x369b30,null));};exports['show']=function(_0x3cfda0,_0x439e0e){var _0x575698={'raw':!![],'where':{'id':_0x3cfda0[_0x6315('0x45')]['id']}},_0x5ed3f7={};_0x5ed3f7[_0x6315('0x34')]=_[_0x6315('0x30')](db[_0x6315('0x41')][_0x6315('0x2b')]);_0x5ed3f7[_0x6315('0x2f')]=_[_0x6315('0x30')](_0x3cfda0[_0x6315('0x2f')]);_0x5ed3f7['filters']=_[_0x6315('0x32')](_0x5ed3f7[_0x6315('0x34')],_0x5ed3f7[_0x6315('0x2f')]);_0x575698['attributes']=_[_0x6315('0x32')](_0x5ed3f7[_0x6315('0x34')],qs['fields'](_0x3cfda0['query'][_0x6315('0x35')]));_0x575698[_0x6315('0x33')]=_0x575698[_0x6315('0x33')][_0x6315('0x36')]?_0x575698[_0x6315('0x33')]:_0x5ed3f7[_0x6315('0x34')];if(_0x3cfda0[_0x6315('0x2f')][_0x6315('0x46')]){_0x575698[_0x6315('0x42')]=[{'all':!![]}];}_0x575698=_[_0x6315('0x3f')]({},_0x575698,_0x3cfda0[_0x6315('0x40')]);return db[_0x6315('0x41')][_0x6315('0x47')](_0x575698)[_0x6315('0x23')](handleEntityNotFound(_0x439e0e,null))[_0x6315('0x23')](respondWithResult(_0x439e0e,null))[_0x6315('0x44')](handleError(_0x439e0e,null));};exports[_0x6315('0x48')]=function(_0x3769dd,_0x2ff7df){return db[_0x6315('0x41')][_0x6315('0x48')](_0x3769dd[_0x6315('0x49')],{})[_0x6315('0x23')](respondWithResult(_0x2ff7df,0xc9))[_0x6315('0x44')](handleError(_0x2ff7df,null));};exports[_0x6315('0x4a')]=function(_0x422f04,_0x123b14){if(_0x422f04['body']['id']){delete _0x422f04[_0x6315('0x49')]['id'];}return db[_0x6315('0x41')]['find']({'where':{'id':_0x422f04[_0x6315('0x45')]['id']}})[_0x6315('0x23')](handleEntityNotFound(_0x123b14,null))[_0x6315('0x23')](saveUpdates(_0x422f04[_0x6315('0x49')],null))[_0x6315('0x23')](respondWithResult(_0x123b14,null))[_0x6315('0x44')](handleError(_0x123b14,null));};exports[_0x6315('0x24')]=function(_0x3415a4,_0x310b88){return db['SugarcrmField'][_0x6315('0x47')]({'where':{'id':_0x3415a4[_0x6315('0x45')]['id']}})[_0x6315('0x23')](handleEntityNotFound(_0x310b88,null))[_0x6315('0x23')](removeEntity(_0x310b88,null))[_0x6315('0x44')](handleError(_0x310b88,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index b0e0be7..fcb68f3 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 _0xbc33=['api','moment','bluebird','request-promise','./intSugarcrmField.attributes','exports','sugarcrm_unique_index','idField','util','../../config/logger'];(function(_0xcac6de,_0x3a76e3){var _0x3da403=function(_0xb6ead3){while(--_0xb6ead3){_0xcac6de['push'](_0xcac6de['shift']());}};_0x3da403(++_0x3a76e3);}(_0xbc33,0x1f2));var _0x3bc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc33[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3bc3('0x0'));var logger=require(_0x3bc3('0x1'))(_0x3bc3('0x2'));var moment=require(_0x3bc3('0x3'));var BPromise=require(_0x3bc3('0x4'));var rp=require(_0x3bc3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3bc3('0x6'));module[_0x3bc3('0x7')]=function(_0x2c09ee,_0x3d2d08){return _0x2c09ee['define']('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x3bc3('0x8'),'fields':[_0x3bc3('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdcb9=['FieldId','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','idField'];(function(_0xc5f04e,_0x4a2d66){var _0x198311=function(_0x1e0790){while(--_0x1e0790){_0xc5f04e['push'](_0xc5f04e['shift']());}};_0x198311(++_0x4a2d66);}(_0xdcb9,0x127));var _0x9dcb=function(_0x214a9d,_0x2b833a){_0x214a9d=_0x214a9d-0x0;var _0x2da545=_0xdcb9[_0x214a9d];return _0x2da545;};'use strict';var _=require(_0x9dcb('0x0'));var util=require('util');var logger=require(_0x9dcb('0x1'))(_0x9dcb('0x2'));var moment=require(_0x9dcb('0x3'));var BPromise=require('bluebird');var rp=require(_0x9dcb('0x4'));var fs=require('fs');var path=require(_0x9dcb('0x5'));var rimraf=require(_0x9dcb('0x6'));var config=require(_0x9dcb('0x7'));var attributes=require(_0x9dcb('0x8'));module[_0x9dcb('0x9')]=function(_0x4041d7,_0x4200a9){return _0x4041d7[_0x9dcb('0xa')]('SugarcrmField',attributes,{'tableName':_0x9dcb('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x9dcb('0xc'),_0x9dcb('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 517ef4b..688a766 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 _0x41d5=['info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x197b38,_0x394a4d){var _0x20a23a=function(_0x2a5541){while(--_0x2a5541){_0x197b38['push'](_0x197b38['shift']());}};_0x20a23a(++_0x394a4d);}(_0x41d5,0x15c));var _0x541d=function(_0x2ebbd0,_0x5ee358){_0x2ebbd0=_0x2ebbd0-0x0;var _0x2b1105=_0x41d5[_0x2ebbd0];return _0x2b1105;};'use strict';var _=require(_0x541d('0x0'));var util=require('util');var moment=require(_0x541d('0x1'));var BPromise=require(_0x541d('0x2'));var rs=require(_0x541d('0x3'));var fs=require('fs');var Redis=require(_0x541d('0x4'));var db=require(_0x541d('0x5'))['db'];var utils=require(_0x541d('0x6'));var logger=require(_0x541d('0x7'))(_0x541d('0x8'));var config=require(_0x541d('0x9'));var jayson=require(_0x541d('0xa'));var client=jayson[_0x541d('0xb')][_0x541d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x567eee,_0x5452c3,_0x14ba07){return new BPromise(function(_0x93a26b,_0x8af4e7){return client[_0x541d('0xd')](_0x567eee,_0x14ba07)['then'](function(_0x491db8){logger['info'](_0x541d('0xe'),_0x5452c3,_0x541d('0xf'));logger['debug'](_0x541d('0x10'),_0x5452c3,_0x541d('0xf'),JSON['stringify'](_0x491db8));if(_0x491db8['error']){if(_0x491db8[_0x541d('0x11')][_0x541d('0x12')]===0x1f4){logger[_0x541d('0x11')](_0x541d('0xe'),_0x5452c3,_0x491db8[_0x541d('0x11')][_0x541d('0x13')]);return _0x8af4e7(_0x491db8[_0x541d('0x11')][_0x541d('0x13')]);}logger[_0x541d('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x5452c3,_0x491db8[_0x541d('0x11')][_0x541d('0x13')]);return _0x93a26b(_0x491db8[_0x541d('0x11')][_0x541d('0x13')]);}else{logger[_0x541d('0x14')](_0x541d('0xe'),_0x5452c3,_0x541d('0xf'));_0x93a26b(_0x491db8[_0x541d('0x15')][_0x541d('0x13')]);}})[_0x541d('0x16')](function(_0x18eb98){logger[_0x541d('0x11')](_0x541d('0xe'),_0x5452c3,_0x18eb98);_0x8af4e7(_0x18eb98);});});} \ No newline at end of file +var _0x39a8=['error','code','message','SugarcrmField,\x20%s,\x20%s','info','result','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s'];(function(_0x5229ab,_0x45d526){var _0x21c204=function(_0xbc8288){while(--_0xbc8288){_0x5229ab['push'](_0x5229ab['shift']());}};_0x21c204(++_0x45d526);}(_0x39a8,0x102));var _0x839a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x39a8[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x839a('0x0'));var util=require('util');var moment=require(_0x839a('0x1'));var BPromise=require(_0x839a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x839a('0x3'))['db'];var utils=require(_0x839a('0x4'));var logger=require(_0x839a('0x5'))(_0x839a('0x6'));var config=require(_0x839a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x839a('0x8')][_0x839a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x311c41,_0x33bf49,_0x243ca4){return new BPromise(function(_0x49bb9c,_0x27495f){return client[_0x839a('0xa')](_0x311c41,_0x243ca4)[_0x839a('0xb')](function(_0x1889ef){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x33bf49,_0x839a('0xc'));logger[_0x839a('0xd')](_0x839a('0xe'),_0x33bf49,_0x839a('0xc'),JSON['stringify'](_0x1889ef));if(_0x1889ef['error']){if(_0x1889ef[_0x839a('0xf')][_0x839a('0x10')]===0x1f4){logger[_0x839a('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x33bf49,_0x1889ef[_0x839a('0xf')][_0x839a('0x11')]);return _0x27495f(_0x1889ef[_0x839a('0xf')][_0x839a('0x11')]);}logger['error'](_0x839a('0x12'),_0x33bf49,_0x1889ef[_0x839a('0xf')]['message']);return _0x49bb9c(_0x1889ef[_0x839a('0xf')][_0x839a('0x11')]);}else{logger[_0x839a('0x13')](_0x839a('0x12'),_0x33bf49,'request\x20sent');_0x49bb9c(_0x1889ef[_0x839a('0x14')]['message']);}})['catch'](function(_0x19a2d0){logger[_0x839a('0xf')](_0x839a('0x12'),_0x33bf49,_0x19a2d0);_0x27495f(_0x19a2d0);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index e40954e..89c8f72 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 _0xb3c2=['../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x489f1a,_0x934623){var _0x519ae4=function(_0x323d95){while(--_0x323d95){_0x489f1a['push'](_0x489f1a['shift']());}};_0x519ae4(++_0x934623);}(_0xb3c2,0x152));var _0x2b3c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb3c2[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x2b3c('0x0'));var util=require(_0x2b3c('0x1'));var path=require('path');var timeout=require(_0x2b3c('0x2'));var express=require(_0x2b3c('0x3'));var router=express[_0x2b3c('0x4')]();var fs_extra=require(_0x2b3c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2b3c('0x6'));var config=require(_0x2b3c('0x7'));var controller=require(_0x2b3c('0x8'));router[_0x2b3c('0x9')]('/',auth[_0x2b3c('0xa')](),controller['index']);router[_0x2b3c('0x9')](_0x2b3c('0xb'),auth[_0x2b3c('0xa')](),controller[_0x2b3c('0xc')]);router['get']('/:id/configurations',auth[_0x2b3c('0xa')](),controller[_0x2b3c('0xd')]);router[_0x2b3c('0x9')]('/:id/fields',auth[_0x2b3c('0xa')](),controller[_0x2b3c('0xe')]);router[_0x2b3c('0xf')]('/',auth[_0x2b3c('0xa')](),controller[_0x2b3c('0x10')]);router[_0x2b3c('0xf')](_0x2b3c('0x11'),auth[_0x2b3c('0xa')](),controller[_0x2b3c('0x12')]);router[_0x2b3c('0x13')]('/:id',auth[_0x2b3c('0xa')](),controller['update']);router[_0x2b3c('0x14')](_0x2b3c('0xb'),auth['isAuthenticated'](),controller[_0x2b3c('0x15')]);module[_0x2b3c('0x16')]=router; \ No newline at end of file +var _0x2413=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','put','update','delete','destroy','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2413,0x1a1));var _0x3241=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2413[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x3241('0x0'));var util=require('util');var path=require(_0x3241('0x1'));var timeout=require('connect-timeout');var express=require(_0x3241('0x2'));var router=express[_0x3241('0x3')]();var fs_extra=require(_0x3241('0x4'));var auth=require(_0x3241('0x5'));var interaction=require(_0x3241('0x6'));var config=require('../../config/environment');var controller=require(_0x3241('0x7'));router['get']('/',auth[_0x3241('0x8')](),controller['index']);router[_0x3241('0x9')](_0x3241('0xa'),auth[_0x3241('0x8')](),controller[_0x3241('0xb')]);router[_0x3241('0x9')](_0x3241('0xc'),auth[_0x3241('0x8')](),controller[_0x3241('0xd')]);router[_0x3241('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x3241('0xe')]);router[_0x3241('0xf')]('/',auth[_0x3241('0x8')](),controller[_0x3241('0x10')]);router[_0x3241('0xf')](_0x3241('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x3241('0x11')]('/:id',auth[_0x3241('0x8')](),controller[_0x3241('0x12')]);router[_0x3241('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x3241('0x14')]);module[_0x3241('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 3872912..2e48aee 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 _0x905b=['HelpDesk','sequelize','STRING'];(function(_0x257dfa,_0x61b0f3){var _0x3b4d16=function(_0x539d9d){while(--_0x539d9d){_0x257dfa['push'](_0x257dfa['shift']());}};_0x3b4d16(++_0x61b0f3);}(_0x905b,0x18a));var _0xb905=function(_0x5599cc,_0x345a90){_0x5599cc=_0x5599cc-0x0;var _0x295548=_0x905b[_0x5599cc];return _0x295548;};'use strict';var Sequelize=require(_0xb905('0x0'));module['exports']={'name':{'type':Sequelize[_0xb905('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb905('0x1')]},'username':{'type':Sequelize[_0xb905('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xb905('0x1')],'allowNull':![],'defaultValue':_0xb905('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xb905('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xb905('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x5be8=['HelpDesk','exports','STRING'];(function(_0x5d6482,_0x1c9b00){var _0x32e681=function(_0x398459){while(--_0x398459){_0x5d6482['push'](_0x5d6482['shift']());}};_0x32e681(++_0x1c9b00);}(_0x5be8,0x184));var _0x85be=function(_0x447ba3,_0xda66ad){_0x447ba3=_0x447ba3-0x0;var _0xaa8428=_0x5be8[_0x447ba3];return _0xaa8428;};'use strict';var Sequelize=require('sequelize');module[_0x85be('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x85be('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x85be('0x1')],'allowNull':![],'defaultValue':_0x85be('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x85be('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x85be('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 6704725..ed8980f 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 _0x0f29=['moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','%s/webservice.php','GET','getchallenge','success','POST','result','token','describe','sessionName','autogenerated','owner','remove','includes','editable','false','startsWith','cf_','picklistValues','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','limit','count','offset','Content-Range','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','type','VIRTUAL','options','includeAll','VtigerAccount','rows','catch','show','params','include','find','create','body','findOne','VtigerConfiguration','filter','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','getFields','username','description'];(function(_0x40651f,_0x643f98){var _0x108328=function(_0x5ce74b){while(--_0x5ce74b){_0x40651f['push'](_0x40651f['shift']());}};_0x108328(++_0x643f98);}(_0x0f29,0x107));var _0x90f2=function(_0x188b55,_0x51e0ad){_0x188b55=_0x188b55-0x0;var _0x249daf=_0x0f29[_0x188b55];return _0x249daf;};'use strict';var emlformat=require(_0x90f2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x90f2('0x1'));var jsonpatch=require(_0x90f2('0x2'));var rp=require(_0x90f2('0x3'));var moment=require('moment');var BPromise=require(_0x90f2('0x4'));var Mustache=require('mustache');var util=require(_0x90f2('0x5'));var path=require('path');var sox=require(_0x90f2('0x6'));var csv=require(_0x90f2('0x7'));var ejs=require(_0x90f2('0x8'));var fs=require('fs');var fs_extra=require(_0x90f2('0x9'));var _=require(_0x90f2('0xa'));var squel=require('squel');var crypto=require(_0x90f2('0xb'));var jsforce=require(_0x90f2('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x90f2('0xd'));var Papa=require(_0x90f2('0xe'));var Redis=require(_0x90f2('0xf'));var authService=require(_0x90f2('0x10'));var qs=require(_0x90f2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x90f2('0x12'));var logger=require('../../config/logger')(_0x90f2('0x13'));var utils=require(_0x90f2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x90f2('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xacee33,_0x9ae989){_0x9ae989=_0x9ae989||0xcc;return function(_0x4521e2){if(_0x4521e2){return _0xacee33[_0x90f2('0x16')](_0x9ae989);}return _0xacee33[_0x90f2('0x17')](_0x9ae989)[_0x90f2('0x18')]();};}function respondWithResult(_0x21cb6f,_0xa66fbc){_0xa66fbc=_0xa66fbc||0xc8;return function(_0xde0164){if(_0xde0164){return _0x21cb6f[_0x90f2('0x17')](_0xa66fbc)[_0x90f2('0x19')](_0xde0164);}};}function respondWithFilteredResult(_0xd4c5e3,_0x29c91d){return function(_0x27b6c9){if(_0x27b6c9){var _0x514738=typeof _0x29c91d['offset']==='undefined'&&typeof _0x29c91d[_0x90f2('0x1a')]==='undefined';var _0x12b070=_0x27b6c9[_0x90f2('0x1b')];var _0x125fa2=_0x514738?0x0:_0x29c91d[_0x90f2('0x1c')];var _0x282645=_0x514738?_0x27b6c9[_0x90f2('0x1b')]:_0x29c91d[_0x90f2('0x1c')]+_0x29c91d[_0x90f2('0x1a')];var _0x578e02;if(_0x282645>=_0x12b070){_0x282645=_0x12b070;_0x578e02=0xc8;}else{_0x578e02=0xce;}_0xd4c5e3[_0x90f2('0x17')](_0x578e02);return _0xd4c5e3['set'](_0x90f2('0x1d'),_0x125fa2+'-'+_0x282645+'/'+_0x12b070)[_0x90f2('0x19')](_0x27b6c9);}return null;};}function patchUpdates(_0x38f292){return function(_0x182e18){try{jsonpatch['apply'](_0x182e18,_0x38f292,!![]);}catch(_0x3c7daa){return BPromise[_0x90f2('0x1e')](_0x3c7daa);}return _0x182e18[_0x90f2('0x1f')]();};}function saveUpdates(_0x2f9df4,_0xe8d988){return function(_0x29c245){if(_0x29c245){return _0x29c245[_0x90f2('0x20')](_0x2f9df4)[_0x90f2('0x21')](function(_0x4f16a6){return _0x4f16a6;});}return null;};}function removeEntity(_0x25f44e,_0xc4e450){return function(_0x110f62){if(_0x110f62){return _0x110f62[_0x90f2('0x22')]()['then'](function(){_0x25f44e[_0x90f2('0x17')](0xcc)[_0x90f2('0x18')]();});}};}function handleEntityNotFound(_0xe45aa1,_0x4172d3){return function(_0x4ef332){if(!_0x4ef332){_0xe45aa1[_0x90f2('0x16')](0x194);}return _0x4ef332;};}function handleError(_0x3a6631,_0x1d70da){_0x1d70da=_0x1d70da||0x1f4;return function(_0x2f6cbd){logger[_0x90f2('0x23')](_0x2f6cbd[_0x90f2('0x24')]);if(_0x2f6cbd[_0x90f2('0x25')]){delete _0x2f6cbd[_0x90f2('0x25')];}_0x3a6631[_0x90f2('0x17')](_0x1d70da)['send'](_0x2f6cbd);};}exports[_0x90f2('0x26')]=function(_0x572c3d,_0x338228){var _0x6a5738={},_0x478001={},_0x2e53f0={'count':0x0,'rows':[]};var _0x112c45=_['map'](db['VtigerAccount'][_0x90f2('0x27')],function(_0x1b9f34){return{'name':_0x1b9f34[_0x90f2('0x28')],'type':_0x1b9f34['type'][_0x90f2('0x29')]};});_0x478001['model']=_['map'](_0x112c45,_0x90f2('0x25'));_0x478001[_0x90f2('0x2a')]=_[_0x90f2('0x2b')](_0x572c3d['query']);_0x478001[_0x90f2('0x2c')]=_[_0x90f2('0x2d')](_0x478001[_0x90f2('0x2e')],_0x478001[_0x90f2('0x2a')]);_0x6a5738['attributes']=_[_0x90f2('0x2d')](_0x478001[_0x90f2('0x2e')],qs[_0x90f2('0x2f')](_0x572c3d['query'][_0x90f2('0x2f')]));_0x6a5738['attributes']=_0x6a5738[_0x90f2('0x30')][_0x90f2('0x31')]?_0x6a5738[_0x90f2('0x30')]:_0x478001['model'];if(!_0x572c3d[_0x90f2('0x2a')][_0x90f2('0x32')](_0x90f2('0x33'))){_0x6a5738[_0x90f2('0x1a')]=qs['limit'](_0x572c3d['query']['limit']);_0x6a5738[_0x90f2('0x1c')]=qs['offset'](_0x572c3d[_0x90f2('0x2a')][_0x90f2('0x1c')]);}_0x6a5738[_0x90f2('0x34')]=qs['sort'](_0x572c3d[_0x90f2('0x2a')][_0x90f2('0x35')]);_0x6a5738['where']=qs[_0x90f2('0x2c')](_[_0x90f2('0x36')](_0x572c3d[_0x90f2('0x2a')],_0x478001[_0x90f2('0x2c')]),_0x112c45);if(_0x572c3d['query']['filter']){_0x6a5738[_0x90f2('0x37')]=_[_0x90f2('0x38')](_0x6a5738[_0x90f2('0x37')],{'$or':_[_0x90f2('0x39')](_0x112c45,function(_0x26c5c9){if(_0x26c5c9[_0x90f2('0x3a')]!==_0x90f2('0x3b')){var _0x534f4b={};_0x534f4b[_0x26c5c9[_0x90f2('0x25')]]={'$like':'%'+_0x572c3d['query']['filter']+'%'};return _0x534f4b;}})});}_0x6a5738=_['merge']({},_0x6a5738,_0x572c3d[_0x90f2('0x3c')]);var _0x55ef80={'where':_0x6a5738[_0x90f2('0x37')]};return db['VtigerAccount'][_0x90f2('0x1b')](_0x55ef80)[_0x90f2('0x21')](function(_0x441c1a){_0x2e53f0['count']=_0x441c1a;if(_0x572c3d[_0x90f2('0x2a')][_0x90f2('0x3d')]){_0x6a5738['include']=[{'all':!![]}];}return db[_0x90f2('0x3e')]['findAll'](_0x6a5738);})[_0x90f2('0x21')](function(_0x66820){_0x2e53f0[_0x90f2('0x3f')]=_0x66820;return _0x2e53f0;})[_0x90f2('0x21')](respondWithFilteredResult(_0x338228,_0x6a5738))[_0x90f2('0x40')](handleError(_0x338228,null));};exports[_0x90f2('0x41')]=function(_0x208f33,_0x5f340a){var _0x4d9a22={'raw':![],'where':{'id':_0x208f33[_0x90f2('0x42')]['id']}},_0x324b9f={};_0x324b9f[_0x90f2('0x2e')]=_[_0x90f2('0x2b')](db[_0x90f2('0x3e')][_0x90f2('0x27')]);_0x324b9f['query']=_[_0x90f2('0x2b')](_0x208f33[_0x90f2('0x2a')]);_0x324b9f[_0x90f2('0x2c')]=_[_0x90f2('0x2d')](_0x324b9f['model'],_0x324b9f[_0x90f2('0x2a')]);_0x4d9a22['attributes']=_['intersection'](_0x324b9f[_0x90f2('0x2e')],qs[_0x90f2('0x2f')](_0x208f33[_0x90f2('0x2a')]['fields']));_0x4d9a22[_0x90f2('0x30')]=_0x4d9a22['attributes']['length']?_0x4d9a22[_0x90f2('0x30')]:_0x324b9f[_0x90f2('0x2e')];if(_0x208f33[_0x90f2('0x2a')][_0x90f2('0x3d')]){_0x4d9a22[_0x90f2('0x43')]=[{'all':!![]}];}_0x4d9a22=_[_0x90f2('0x38')]({},_0x4d9a22,_0x208f33[_0x90f2('0x3c')]);return db['VtigerAccount'][_0x90f2('0x44')](_0x4d9a22)['then'](handleEntityNotFound(_0x5f340a,null))[_0x90f2('0x21')](respondWithResult(_0x5f340a,null))[_0x90f2('0x40')](handleError(_0x5f340a,null));};exports[_0x90f2('0x45')]=function(_0x215ac6,_0x4e290e){return db[_0x90f2('0x3e')]['create'](_0x215ac6[_0x90f2('0x46')],{})[_0x90f2('0x21')](respondWithResult(_0x4e290e,0xc9))[_0x90f2('0x40')](handleError(_0x4e290e,null));};exports[_0x90f2('0x20')]=function(_0x51a585,_0x57630e){if(_0x51a585[_0x90f2('0x46')]['id']){delete _0x51a585[_0x90f2('0x46')]['id'];}return db['VtigerAccount'][_0x90f2('0x44')]({'where':{'id':_0x51a585[_0x90f2('0x42')]['id']}})[_0x90f2('0x21')](handleEntityNotFound(_0x57630e,null))[_0x90f2('0x21')](saveUpdates(_0x51a585[_0x90f2('0x46')],null))[_0x90f2('0x21')](respondWithResult(_0x57630e,null))[_0x90f2('0x40')](handleError(_0x57630e,null));};exports[_0x90f2('0x22')]=function(_0x3f65b2,_0x5d632e){return db['VtigerAccount'][_0x90f2('0x44')]({'where':{'id':_0x3f65b2[_0x90f2('0x42')]['id']}})['then'](handleEntityNotFound(_0x5d632e,null))['then'](removeEntity(_0x5d632e,null))[_0x90f2('0x40')](handleError(_0x5d632e,null));};exports['getConfigurations']=function(_0x3f4b02,_0x288545,_0x1b00ff){var _0x5d8434={};var _0x5662ca={};var _0x532699;var _0x5687bc;return db[_0x90f2('0x3e')][_0x90f2('0x47')]({'where':{'id':_0x3f4b02['params']['id']}})[_0x90f2('0x21')](handleEntityNotFound(_0x288545,null))[_0x90f2('0x21')](function(_0x45eb12){if(_0x45eb12){_0x532699=_0x45eb12;_0x5662ca[_0x90f2('0x2e')]=_[_0x90f2('0x2b')](db[_0x90f2('0x48')]['rawAttributes']);_0x5662ca[_0x90f2('0x2a')]=_[_0x90f2('0x2b')](_0x3f4b02[_0x90f2('0x2a')]);_0x5662ca[_0x90f2('0x2c')]=_[_0x90f2('0x2d')](_0x5662ca['model'],_0x5662ca[_0x90f2('0x2a')]);_0x5d8434[_0x90f2('0x30')]=_[_0x90f2('0x2d')](_0x5662ca['model'],qs['fields'](_0x3f4b02[_0x90f2('0x2a')]['fields']));_0x5d8434[_0x90f2('0x30')]=_0x5d8434['attributes']['length']?_0x5d8434['attributes']:_0x5662ca[_0x90f2('0x2e')];_0x5d8434[_0x90f2('0x34')]=qs['sort'](_0x3f4b02[_0x90f2('0x2a')]['sort']);_0x5d8434[_0x90f2('0x37')]=qs[_0x90f2('0x2c')](_[_0x90f2('0x36')](_0x3f4b02[_0x90f2('0x2a')],_0x5662ca['filters']));if(_0x3f4b02[_0x90f2('0x2a')]['filter']){_0x5d8434[_0x90f2('0x37')]=_['merge'](_0x5d8434[_0x90f2('0x37')],{'$or':_[_0x90f2('0x39')](_0x5d8434[_0x90f2('0x30')],function(_0x1c0b54){var _0x1822d1={};_0x1822d1[_0x1c0b54]={'$like':'%'+_0x3f4b02[_0x90f2('0x2a')][_0x90f2('0x49')]+'%'};return _0x1822d1;})});}_0x5d8434=_[_0x90f2('0x38')]({},_0x5d8434,_0x3f4b02[_0x90f2('0x3c')]);return _0x532699[_0x90f2('0x4a')](_0x5d8434);}})['then'](function(_0x3fcd02){if(_0x3fcd02){_0x5687bc=_0x3fcd02[_0x90f2('0x31')];if(!_0x3f4b02[_0x90f2('0x2a')][_0x90f2('0x32')](_0x90f2('0x33'))){_0x5d8434['limit']=qs[_0x90f2('0x1a')](_0x3f4b02['query'][_0x90f2('0x1a')]);_0x5d8434[_0x90f2('0x1c')]=qs[_0x90f2('0x1c')](_0x3f4b02[_0x90f2('0x2a')][_0x90f2('0x1c')]);}return _0x532699[_0x90f2('0x4a')](_0x5d8434);}})['then'](function(_0x34f060){if(_0x34f060){return _0x34f060?{'count':_0x5687bc,'rows':_0x34f060}:null;}})['then'](respondWithResult(_0x288545,null))[_0x90f2('0x40')](handleError(_0x288545,null));};exports[_0x90f2('0x4b')]=function(_0x19f9f7,_0x16bf3d,_0x5a1b38){if(_0x19f9f7[_0x90f2('0x46')]['id']){delete _0x19f9f7[_0x90f2('0x46')]['id'];}return db['VtigerAccount'][_0x90f2('0x47')]({'where':{'id':_0x19f9f7[_0x90f2('0x42')]['id']}})[_0x90f2('0x21')](handleEntityNotFound(_0x16bf3d,null))[_0x90f2('0x21')](function(_0x2e5eef){if(_0x2e5eef){_0x19f9f7[_0x90f2('0x46')][_0x90f2('0x4c')]=_0x2e5eef['id'];_0x19f9f7[_0x90f2('0x46')][_0x90f2('0x4d')]=integrations[_0x90f2('0x4e')](_0x19f9f7[_0x90f2('0x46')][_0x90f2('0x4f')],_0x19f9f7[_0x90f2('0x46')][_0x90f2('0x3a')]);_0x19f9f7['body'][_0x90f2('0x50')]=integrations['getDescriptions'](_0x19f9f7[_0x90f2('0x46')][_0x90f2('0x4f')],_0x19f9f7[_0x90f2('0x46')]['type']);return db[_0x90f2('0x48')][_0x90f2('0x45')](_0x19f9f7[_0x90f2('0x46')],{'include':[{'model':db[_0x90f2('0x51')],'as':_0x90f2('0x4d')},{'model':db[_0x90f2('0x51')],'as':_0x90f2('0x50')}]});}return null;})[_0x90f2('0x21')](respondWithResult(_0x16bf3d,null))[_0x90f2('0x40')](handleError(_0x16bf3d,null));};var md5=require('md5');exports[_0x90f2('0x52')]=function(_0x47ebca,_0x3eb93c,_0x521f33){var _0x3fc74f=null;var _0x51e4fe=null;var _0xe18b6c=null;var _0x43dbe8=null;var _0x2cd320='';return db['VtigerAccount'][_0x90f2('0x47')]({'where':{'id':_0x47ebca[_0x90f2('0x42')]['id']},'attributes':['id',_0x90f2('0x25'),_0x90f2('0x53'),_0x90f2('0x54'),_0x90f2('0x55'),_0x90f2('0x56'),_0x90f2('0x57'),_0x90f2('0x58')]})[_0x90f2('0x21')](handleEntityNotFound(_0x3eb93c,null))['then'](function(_0x175d5b){if(_0x175d5b){_0x3fc74f=_0x175d5b[_0x90f2('0x53')];_0x51e4fe=_0x175d5b[_0x90f2('0x58')];_0xe18b6c=_0x175d5b[_0x90f2('0x55')];_0x2cd320=_0x175d5b[_0x90f2('0x56')];var _0x32666f=_0x2cd320['slice'](-0x1);if(_0x32666f==='/'){_0x2cd320=_0x2cd320[_0x90f2('0x59')](0x0,_0x2cd320[_0x90f2('0x5a')](_0x32666f));}_0x43dbe8=util['format'](_0x90f2('0x5b'),_0x2cd320);var _0x1c201d={'method':_0x90f2('0x5c'),'uri':_0x43dbe8,'qs':{'operation':_0x90f2('0x5d'),'username':_0x175d5b[_0x90f2('0x53')]},'json':!![]};return rp(_0x1c201d);}})[_0x90f2('0x21')](function(_0x2a1929){if(_0x2a1929[_0x90f2('0x5e')]){var _0x38d3ae={'method':_0x90f2('0x5f'),'uri':_0x43dbe8,'form':{'operation':'login','username':_0x3fc74f,'accessKey':md5(_0x2a1929[_0x90f2('0x60')][_0x90f2('0x61')]+_0x51e4fe)},'json':!![]};return rp(_0x38d3ae);}})['then'](function(_0x219d73){if(_0x219d73['success']){var _0x528749={'method':_0x90f2('0x5c'),'uri':_0x43dbe8,'qs':{'operation':_0x90f2('0x62'),'username':_0x3fc74f,'sessionName':_0x219d73[_0x90f2('0x60')][_0x90f2('0x63')],'elementType':_0xe18b6c},'json':!![]};return rp(_0x528749);}})[_0x90f2('0x21')](function(_0x161687){if(_0x161687[_0x90f2('0x5e')]){var _0x1a8024=[_0x90f2('0x64'),'reference',_0x90f2('0x65')];_[_0x90f2('0x66')](_0x161687[_0x90f2('0x60')][_0x90f2('0x2f')],function(_0x2b816d){return _0x1a8024[_0x90f2('0x67')](_0x2b816d[_0x90f2('0x3a')]['name']);});_[_0x90f2('0x66')](_0x161687['result']['fields'],function(_0x32ca5b){return _0x32ca5b[_0x90f2('0x68')]===_0x90f2('0x69');});return{'count':_0x161687['result']['fields'][_0x90f2('0x31')],'rows':_[_0x90f2('0x39')](_0x161687[_0x90f2('0x60')]['fields'],function(_0x5afd0b){return{'id':_0x5afd0b[_0x90f2('0x25')],'name':_0x5afd0b['label'],'custom':_[_0x90f2('0x6a')](_0x5afd0b[_0x90f2('0x25')],_0x90f2('0x6b'))?!![]:![],'options':_0x5afd0b[_0x90f2('0x3a')][_0x90f2('0x25')]==='picklist'&&_0x5afd0b[_0x90f2('0x3a')][_0x90f2('0x6c')]['length']>0x0?_['map'](_0x5afd0b[_0x90f2('0x3a')][_0x90f2('0x6c')],function(_0x526a6d){return{'name':_0x526a6d['label'],'value':_0x526a6d['value']};}):[]};})};}})['then'](respondWithResult(_0x3eb93c,null))[_0x90f2('0x40')](function(_0x340edc){console['log'](_0x90f2('0x6d')+_0x340edc);var _0x12d846=_0x47ebca[_0x90f2('0x2a')][_0x90f2('0x6e')]?0x1f4:_0x340edc[_0x90f2('0x6f')]||0x1f4;logger['error'](_0x90f2('0x70'),_0x90f2('0x52'),_0x12d846,JSON[_0x90f2('0x71')](_0x340edc));delete _0x340edc['name'];if(_0x12d846===0x191){_0x12d846=0x190;}_0x3eb93c['status'](_0x12d846)[_0x90f2('0x72')](_0x47ebca[_0x90f2('0x2a')]['test']?{'message':_0x90f2('0x73'),'statusCode':_0x340edc[_0x90f2('0x6f')]}:_0x340edc);});}; \ No newline at end of file +var _0xc88c=['vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../components/integrations/configuration','status','end','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','VtigerAccount','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','catch','show','params','includeAll','include','find','create','body','update','getConfigurations','findOne','VtigerConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','%s/webservice.php','GET','getchallenge','POST','login','result','success','describe','sessionName','autogenerated','reference','owner','includes','editable','false','startsWith','cf_','picklist','picklistValues','label','value','log'];(function(_0x495ee7,_0x1f8218){var _0x27e06d=function(_0x4218eb){while(--_0x4218eb){_0x495ee7['push'](_0x495ee7['shift']());}};_0x27e06d(++_0x1f8218);}(_0xc88c,0x7d));var _0xcc88=function(_0x34ef32,_0x3096d8){_0x34ef32=_0x34ef32-0x0;var _0x2f5f46=_0xc88c[_0x34ef32];return _0x2f5f46;};'use strict';var emlformat=require(_0xcc88('0x0'));var rimraf=require(_0xcc88('0x1'));var zipdir=require(_0xcc88('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc88('0x3'));var moment=require(_0xcc88('0x4'));var BPromise=require(_0xcc88('0x5'));var Mustache=require('mustache');var util=require(_0xcc88('0x6'));var path=require('path');var sox=require(_0xcc88('0x7'));var csv=require(_0xcc88('0x8'));var ejs=require(_0xcc88('0x9'));var fs=require('fs');var fs_extra=require(_0xcc88('0xa'));var _=require(_0xcc88('0xb'));var squel=require(_0xcc88('0xc'));var crypto=require('crypto');var jsforce=require(_0xcc88('0xd'));var deskjs=require(_0xcc88('0xe'));var toCsv=require(_0xcc88('0x8'));var querystring=require('querystring');var Papa=require(_0xcc88('0xf'));var Redis=require('ioredis');var authService=require(_0xcc88('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc88('0x11'));var logger=require(_0xcc88('0x12'))(_0xcc88('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xcc88('0x14'));function respondWithStatusCode(_0x3f74b5,_0x478d6e){_0x478d6e=_0x478d6e||0xcc;return function(_0x14e72b){if(_0x14e72b){return _0x3f74b5['sendStatus'](_0x478d6e);}return _0x3f74b5[_0xcc88('0x15')](_0x478d6e)[_0xcc88('0x16')]();};}function respondWithResult(_0xdc2fdb,_0x35bea0){_0x35bea0=_0x35bea0||0xc8;return function(_0x23814c){if(_0x23814c){return _0xdc2fdb[_0xcc88('0x15')](_0x35bea0)['json'](_0x23814c);}};}function respondWithFilteredResult(_0xbdc3c7,_0x26cc50){return function(_0xf604f6){if(_0xf604f6){var _0x48165d=typeof _0x26cc50['offset']===_0xcc88('0x17')&&typeof _0x26cc50[_0xcc88('0x18')]===_0xcc88('0x17');var _0x3d02dd=_0xf604f6[_0xcc88('0x19')];var _0x4bbc34=_0x48165d?0x0:_0x26cc50['offset'];var _0x28799c=_0x48165d?_0xf604f6[_0xcc88('0x19')]:_0x26cc50['offset']+_0x26cc50[_0xcc88('0x18')];var _0x46437e;if(_0x28799c>=_0x3d02dd){_0x28799c=_0x3d02dd;_0x46437e=0xc8;}else{_0x46437e=0xce;}_0xbdc3c7[_0xcc88('0x15')](_0x46437e);return _0xbdc3c7[_0xcc88('0x1a')](_0xcc88('0x1b'),_0x4bbc34+'-'+_0x28799c+'/'+_0x3d02dd)[_0xcc88('0x1c')](_0xf604f6);}return null;};}function patchUpdates(_0x39f477){return function(_0x41af04){try{jsonpatch[_0xcc88('0x1d')](_0x41af04,_0x39f477,!![]);}catch(_0x1bd6e9){return BPromise[_0xcc88('0x1e')](_0x1bd6e9);}return _0x41af04[_0xcc88('0x1f')]();};}function saveUpdates(_0x2ebbbd,_0x440304){return function(_0x2b39f5){if(_0x2b39f5){return _0x2b39f5['update'](_0x2ebbbd)[_0xcc88('0x20')](function(_0x166b48){return _0x166b48;});}return null;};}function removeEntity(_0x403a0d,_0x276006){return function(_0x4f6b25){if(_0x4f6b25){return _0x4f6b25[_0xcc88('0x21')]()[_0xcc88('0x20')](function(){_0x403a0d[_0xcc88('0x15')](0xcc)[_0xcc88('0x16')]();});}};}function handleEntityNotFound(_0x4380ee,_0x18c580){return function(_0x4cf2fb){if(!_0x4cf2fb){_0x4380ee[_0xcc88('0x22')](0x194);}return _0x4cf2fb;};}function handleError(_0x22b328,_0x34f796){_0x34f796=_0x34f796||0x1f4;return function(_0x55c513){logger[_0xcc88('0x23')](_0x55c513[_0xcc88('0x24')]);if(_0x55c513[_0xcc88('0x25')]){delete _0x55c513['name'];}_0x22b328[_0xcc88('0x15')](_0x34f796)[_0xcc88('0x26')](_0x55c513);};}exports['index']=function(_0x34f330,_0x55488b){var _0x768b0a={},_0x1b8034={},_0x3a1334={'count':0x0,'rows':[]};var _0x4f42e9=_[_0xcc88('0x27')](db[_0xcc88('0x28')][_0xcc88('0x29')],function(_0x465b66){return{'name':_0x465b66['fieldName'],'type':_0x465b66[_0xcc88('0x2a')][_0xcc88('0x2b')]};});_0x1b8034[_0xcc88('0x2c')]=_[_0xcc88('0x27')](_0x4f42e9,'name');_0x1b8034[_0xcc88('0x2d')]=_[_0xcc88('0x2e')](_0x34f330[_0xcc88('0x2d')]);_0x1b8034['filters']=_[_0xcc88('0x2f')](_0x1b8034[_0xcc88('0x2c')],_0x1b8034['query']);_0x768b0a[_0xcc88('0x30')]=_['intersection'](_0x1b8034['model'],qs[_0xcc88('0x31')](_0x34f330[_0xcc88('0x2d')][_0xcc88('0x31')]));_0x768b0a[_0xcc88('0x30')]=_0x768b0a[_0xcc88('0x30')][_0xcc88('0x32')]?_0x768b0a['attributes']:_0x1b8034['model'];if(!_0x34f330[_0xcc88('0x2d')][_0xcc88('0x33')](_0xcc88('0x34'))){_0x768b0a[_0xcc88('0x18')]=qs['limit'](_0x34f330[_0xcc88('0x2d')][_0xcc88('0x18')]);_0x768b0a[_0xcc88('0x35')]=qs[_0xcc88('0x35')](_0x34f330[_0xcc88('0x2d')][_0xcc88('0x35')]);}_0x768b0a[_0xcc88('0x36')]=qs[_0xcc88('0x37')](_0x34f330[_0xcc88('0x2d')][_0xcc88('0x37')]);_0x768b0a[_0xcc88('0x38')]=qs[_0xcc88('0x39')](_[_0xcc88('0x3a')](_0x34f330[_0xcc88('0x2d')],_0x1b8034[_0xcc88('0x39')]),_0x4f42e9);if(_0x34f330['query'][_0xcc88('0x3b')]){_0x768b0a[_0xcc88('0x38')]=_[_0xcc88('0x3c')](_0x768b0a['where'],{'$or':_[_0xcc88('0x27')](_0x4f42e9,function(_0x12be00){if(_0x12be00[_0xcc88('0x2a')]!==_0xcc88('0x3d')){var _0x3462ec={};_0x3462ec[_0x12be00[_0xcc88('0x25')]]={'$like':'%'+_0x34f330[_0xcc88('0x2d')][_0xcc88('0x3b')]+'%'};return _0x3462ec;}})});}_0x768b0a=_[_0xcc88('0x3c')]({},_0x768b0a,_0x34f330[_0xcc88('0x3e')]);var _0x2562bb={'where':_0x768b0a[_0xcc88('0x38')]};return db['VtigerAccount'][_0xcc88('0x19')](_0x2562bb)[_0xcc88('0x20')](function(_0x2b8833){_0x3a1334[_0xcc88('0x19')]=_0x2b8833;if(_0x34f330[_0xcc88('0x2d')]['includeAll']){_0x768b0a['include']=[{'all':!![]}];}return db[_0xcc88('0x28')][_0xcc88('0x3f')](_0x768b0a);})['then'](function(_0x3ac4da){_0x3a1334['rows']=_0x3ac4da;return _0x3a1334;})[_0xcc88('0x20')](respondWithFilteredResult(_0x55488b,_0x768b0a))[_0xcc88('0x40')](handleError(_0x55488b,null));};exports[_0xcc88('0x41')]=function(_0xdb15d7,_0x10175d){var _0x54ca48={'raw':![],'where':{'id':_0xdb15d7[_0xcc88('0x42')]['id']}},_0x4edec9={};_0x4edec9['model']=_[_0xcc88('0x2e')](db[_0xcc88('0x28')][_0xcc88('0x29')]);_0x4edec9['query']=_['keys'](_0xdb15d7[_0xcc88('0x2d')]);_0x4edec9[_0xcc88('0x39')]=_['intersection'](_0x4edec9[_0xcc88('0x2c')],_0x4edec9[_0xcc88('0x2d')]);_0x54ca48[_0xcc88('0x30')]=_['intersection'](_0x4edec9[_0xcc88('0x2c')],qs[_0xcc88('0x31')](_0xdb15d7[_0xcc88('0x2d')]['fields']));_0x54ca48[_0xcc88('0x30')]=_0x54ca48['attributes'][_0xcc88('0x32')]?_0x54ca48[_0xcc88('0x30')]:_0x4edec9['model'];if(_0xdb15d7[_0xcc88('0x2d')][_0xcc88('0x43')]){_0x54ca48[_0xcc88('0x44')]=[{'all':!![]}];}_0x54ca48=_[_0xcc88('0x3c')]({},_0x54ca48,_0xdb15d7[_0xcc88('0x3e')]);return db[_0xcc88('0x28')][_0xcc88('0x45')](_0x54ca48)[_0xcc88('0x20')](handleEntityNotFound(_0x10175d,null))[_0xcc88('0x20')](respondWithResult(_0x10175d,null))['catch'](handleError(_0x10175d,null));};exports[_0xcc88('0x46')]=function(_0x3e00d6,_0x28140f){return db[_0xcc88('0x28')]['create'](_0x3e00d6[_0xcc88('0x47')],{})['then'](respondWithResult(_0x28140f,0xc9))[_0xcc88('0x40')](handleError(_0x28140f,null));};exports[_0xcc88('0x48')]=function(_0x5d8a49,_0x5d932d){if(_0x5d8a49['body']['id']){delete _0x5d8a49[_0xcc88('0x47')]['id'];}return db['VtigerAccount'][_0xcc88('0x45')]({'where':{'id':_0x5d8a49['params']['id']}})['then'](handleEntityNotFound(_0x5d932d,null))[_0xcc88('0x20')](saveUpdates(_0x5d8a49[_0xcc88('0x47')],null))[_0xcc88('0x20')](respondWithResult(_0x5d932d,null))['catch'](handleError(_0x5d932d,null));};exports[_0xcc88('0x21')]=function(_0x39132c,_0x5ec378){return db[_0xcc88('0x28')][_0xcc88('0x45')]({'where':{'id':_0x39132c['params']['id']}})[_0xcc88('0x20')](handleEntityNotFound(_0x5ec378,null))['then'](removeEntity(_0x5ec378,null))[_0xcc88('0x40')](handleError(_0x5ec378,null));};exports[_0xcc88('0x49')]=function(_0x285ac3,_0x340a5a,_0x351ad5){var _0x142c2b={};var _0x2e45e9={};var _0x417251;var _0x536f22;return db[_0xcc88('0x28')][_0xcc88('0x4a')]({'where':{'id':_0x285ac3['params']['id']}})[_0xcc88('0x20')](handleEntityNotFound(_0x340a5a,null))['then'](function(_0x30fc3e){if(_0x30fc3e){_0x417251=_0x30fc3e;_0x2e45e9['model']=_[_0xcc88('0x2e')](db[_0xcc88('0x4b')][_0xcc88('0x29')]);_0x2e45e9[_0xcc88('0x2d')]=_[_0xcc88('0x2e')](_0x285ac3['query']);_0x2e45e9[_0xcc88('0x39')]=_[_0xcc88('0x2f')](_0x2e45e9[_0xcc88('0x2c')],_0x2e45e9[_0xcc88('0x2d')]);_0x142c2b[_0xcc88('0x30')]=_[_0xcc88('0x2f')](_0x2e45e9[_0xcc88('0x2c')],qs['fields'](_0x285ac3['query'][_0xcc88('0x31')]));_0x142c2b[_0xcc88('0x30')]=_0x142c2b['attributes']['length']?_0x142c2b[_0xcc88('0x30')]:_0x2e45e9['model'];_0x142c2b[_0xcc88('0x36')]=qs[_0xcc88('0x37')](_0x285ac3[_0xcc88('0x2d')][_0xcc88('0x37')]);_0x142c2b[_0xcc88('0x38')]=qs[_0xcc88('0x39')](_[_0xcc88('0x3a')](_0x285ac3[_0xcc88('0x2d')],_0x2e45e9[_0xcc88('0x39')]));if(_0x285ac3[_0xcc88('0x2d')][_0xcc88('0x3b')]){_0x142c2b[_0xcc88('0x38')]=_['merge'](_0x142c2b[_0xcc88('0x38')],{'$or':_['map'](_0x142c2b[_0xcc88('0x30')],function(_0x55a0e7){var _0x820a9a={};_0x820a9a[_0x55a0e7]={'$like':'%'+_0x285ac3[_0xcc88('0x2d')][_0xcc88('0x3b')]+'%'};return _0x820a9a;})});}_0x142c2b=_['merge']({},_0x142c2b,_0x285ac3[_0xcc88('0x3e')]);return _0x417251[_0xcc88('0x49')](_0x142c2b);}})[_0xcc88('0x20')](function(_0x111bcd){if(_0x111bcd){_0x536f22=_0x111bcd[_0xcc88('0x32')];if(!_0x285ac3['query'][_0xcc88('0x33')](_0xcc88('0x34'))){_0x142c2b['limit']=qs[_0xcc88('0x18')](_0x285ac3[_0xcc88('0x2d')][_0xcc88('0x18')]);_0x142c2b['offset']=qs['offset'](_0x285ac3['query'][_0xcc88('0x35')]);}return _0x417251[_0xcc88('0x49')](_0x142c2b);}})['then'](function(_0x3afb1b){if(_0x3afb1b){return _0x3afb1b?{'count':_0x536f22,'rows':_0x3afb1b}:null;}})[_0xcc88('0x20')](respondWithResult(_0x340a5a,null))[_0xcc88('0x40')](handleError(_0x340a5a,null));};exports['addConfiguration']=function(_0xb557d8,_0x2e0c0b,_0xec40fd){if(_0xb557d8[_0xcc88('0x47')]['id']){delete _0xb557d8[_0xcc88('0x47')]['id'];}return db[_0xcc88('0x28')][_0xcc88('0x4a')]({'where':{'id':_0xb557d8[_0xcc88('0x42')]['id']}})[_0xcc88('0x20')](handleEntityNotFound(_0x2e0c0b,null))['then'](function(_0x27299a){if(_0x27299a){_0xb557d8['body'][_0xcc88('0x4c')]=_0x27299a['id'];_0xb557d8['body'][_0xcc88('0x4d')]=integrations[_0xcc88('0x4e')](_0xb557d8[_0xcc88('0x47')][_0xcc88('0x4f')],_0xb557d8[_0xcc88('0x47')][_0xcc88('0x2a')]);_0xb557d8[_0xcc88('0x47')][_0xcc88('0x50')]=integrations['getDescriptions'](_0xb557d8[_0xcc88('0x47')][_0xcc88('0x4f')],_0xb557d8[_0xcc88('0x47')][_0xcc88('0x2a')]);return db[_0xcc88('0x4b')][_0xcc88('0x46')](_0xb557d8[_0xcc88('0x47')],{'include':[{'model':db[_0xcc88('0x51')],'as':_0xcc88('0x4d')},{'model':db[_0xcc88('0x51')],'as':'Descriptions'}]});}return null;})[_0xcc88('0x20')](respondWithResult(_0x2e0c0b,null))[_0xcc88('0x40')](handleError(_0x2e0c0b,null));};var md5=require('md5');exports[_0xcc88('0x52')]=function(_0x1861e8,_0x45c832,_0x49b42e){var _0x3166a8=null;var _0x4ef313=null;var _0x4358b2=null;var _0x1b3f79=null;var _0x5ead38='';return db[_0xcc88('0x28')]['findOne']({'where':{'id':_0x1861e8['params']['id']},'attributes':['id',_0xcc88('0x25'),_0xcc88('0x53'),_0xcc88('0x54'),_0xcc88('0x55'),_0xcc88('0x56'),_0xcc88('0x57'),_0xcc88('0x58')]})[_0xcc88('0x20')](handleEntityNotFound(_0x45c832,null))[_0xcc88('0x20')](function(_0x3c5897){if(_0x3c5897){_0x3166a8=_0x3c5897[_0xcc88('0x53')];_0x4ef313=_0x3c5897[_0xcc88('0x58')];_0x4358b2=_0x3c5897[_0xcc88('0x55')];_0x5ead38=_0x3c5897[_0xcc88('0x56')];var _0x293063=_0x5ead38['slice'](-0x1);if(_0x293063==='/'){_0x5ead38=_0x5ead38[_0xcc88('0x59')](0x0,_0x5ead38[_0xcc88('0x5a')](_0x293063));}_0x1b3f79=util['format'](_0xcc88('0x5b'),_0x5ead38);var _0x463a2c={'method':_0xcc88('0x5c'),'uri':_0x1b3f79,'qs':{'operation':_0xcc88('0x5d'),'username':_0x3c5897[_0xcc88('0x53')]},'json':!![]};return rp(_0x463a2c);}})[_0xcc88('0x20')](function(_0x5b05a8){if(_0x5b05a8['success']){var _0x27b764={'method':_0xcc88('0x5e'),'uri':_0x1b3f79,'form':{'operation':_0xcc88('0x5f'),'username':_0x3166a8,'accessKey':md5(_0x5b05a8[_0xcc88('0x60')]['token']+_0x4ef313)},'json':!![]};return rp(_0x27b764);}})[_0xcc88('0x20')](function(_0x21bba){if(_0x21bba[_0xcc88('0x61')]){var _0x31347b={'method':_0xcc88('0x5c'),'uri':_0x1b3f79,'qs':{'operation':_0xcc88('0x62'),'username':_0x3166a8,'sessionName':_0x21bba[_0xcc88('0x60')][_0xcc88('0x63')],'elementType':_0x4358b2},'json':!![]};return rp(_0x31347b);}})[_0xcc88('0x20')](function(_0x1edb8a){if(_0x1edb8a[_0xcc88('0x61')]){var _0x329e6d=[_0xcc88('0x64'),_0xcc88('0x65'),_0xcc88('0x66')];_['remove'](_0x1edb8a[_0xcc88('0x60')][_0xcc88('0x31')],function(_0x217909){return _0x329e6d[_0xcc88('0x67')](_0x217909[_0xcc88('0x2a')][_0xcc88('0x25')]);});_['remove'](_0x1edb8a[_0xcc88('0x60')][_0xcc88('0x31')],function(_0x10bdf1){return _0x10bdf1[_0xcc88('0x68')]===_0xcc88('0x69');});return{'count':_0x1edb8a['result'][_0xcc88('0x31')][_0xcc88('0x32')],'rows':_[_0xcc88('0x27')](_0x1edb8a[_0xcc88('0x60')][_0xcc88('0x31')],function(_0xc7e9d3){return{'id':_0xc7e9d3[_0xcc88('0x25')],'name':_0xc7e9d3['label'],'custom':_[_0xcc88('0x6a')](_0xc7e9d3[_0xcc88('0x25')],_0xcc88('0x6b'))?!![]:![],'options':_0xc7e9d3[_0xcc88('0x2a')]['name']===_0xcc88('0x6c')&&_0xc7e9d3['type']['picklistValues'][_0xcc88('0x32')]>0x0?_[_0xcc88('0x27')](_0xc7e9d3[_0xcc88('0x2a')][_0xcc88('0x6d')],function(_0x39b941){return{'name':_0x39b941[_0xcc88('0x6e')],'value':_0x39b941[_0xcc88('0x6f')]};}):[]};})};}})[_0xcc88('0x20')](respondWithResult(_0x45c832,null))[_0xcc88('0x40')](function(_0x45b10d){console[_0xcc88('0x70')](_0xcc88('0x71')+_0x45b10d);var _0x341669=_0x1861e8[_0xcc88('0x2d')][_0xcc88('0x72')]?0x1f4:_0x45b10d['statusCode']||0x1f4;logger['error'](_0xcc88('0x73'),'getFields',_0x341669,JSON[_0xcc88('0x74')](_0x45b10d));delete _0x45b10d['name'];if(_0x341669===0x191){_0x341669=0x190;}_0x45c832['status'](_0x341669)[_0xcc88('0x26')](_0x1861e8[_0xcc88('0x2d')][_0xcc88('0x72')]?{'message':_0xcc88('0x75'),'statusCode':_0x45b10d[_0xcc88('0x76')]}:_0x45b10d);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 1c209ec..a015291 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 _0x8120=['./intVtigerAccount.attributes','exports','define','VtigerAccount','lodash','util','../../config/logger','moment','bluebird'];(function(_0x141423,_0x23d999){var _0xfcc89e=function(_0xef114e){while(--_0xef114e){_0x141423['push'](_0x141423['shift']());}};_0xfcc89e(++_0x23d999);}(_0x8120,0xe5));var _0x0812=function(_0x17f759,_0x1301ad){_0x17f759=_0x17f759-0x0;var _0x952a00=_0x8120[_0x17f759];return _0x952a00;};'use strict';var _=require(_0x0812('0x0'));var util=require(_0x0812('0x1'));var logger=require(_0x0812('0x2'))('api');var moment=require(_0x0812('0x3'));var BPromise=require(_0x0812('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(_0x0812('0x5'));var integrations=require('../../components/integrations/configuration');module[_0x0812('0x6')]=function(_0x393648,_0x2a7714){return _0x393648[_0x0812('0x7')](_0x0812('0x8'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f90=['../../components/integrations/configuration','exports','define','VtigerAccount','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intVtigerAccount.attributes'];(function(_0x52b922,_0xd70829){var _0x62d6b6=function(_0x174422){while(--_0x174422){_0x52b922['push'](_0x52b922['shift']());}};_0x62d6b6(++_0xd70829);}(_0x2f90,0xa0));var _0x02f9=function(_0x4bfacd,_0x94e4d0){_0x4bfacd=_0x4bfacd-0x0;var _0x1b5f9a=_0x2f90[_0x4bfacd];return _0x1b5f9a;};'use strict';var _=require('lodash');var util=require(_0x02f9('0x0'));var logger=require(_0x02f9('0x1'))(_0x02f9('0x2'));var moment=require(_0x02f9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x02f9('0x4'));var rimraf=require(_0x02f9('0x5'));var config=require(_0x02f9('0x6'));var attributes=require(_0x02f9('0x7'));var integrations=require(_0x02f9('0x8'));module[_0x02f9('0x9')]=function(_0x165fe7,_0x4b7d8b){return _0x165fe7[_0x02f9('0xa')](_0x02f9('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 2be7e58..ad80775 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 _0xf290=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVtigerAccount','findAll','options','raw','where','map','include','model','attributes','stringify','VtigerAccount','ShowVtigerAccount','util','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf290,0xde));var _0x0f29=function(_0x5a2d3f,_0x27b04e){_0x5a2d3f=_0x5a2d3f-0x0;var _0x5c65d8=_0xf290[_0x5a2d3f];return _0x5c65d8;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var moment=require('moment');var BPromise=require(_0x0f29('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f29('0x2'));var db=require(_0x0f29('0x3'))['db'];var utils=require(_0x0f29('0x4'));var logger=require(_0x0f29('0x5'))(_0x0f29('0x6'));var config=require('../../config/environment');var jayson=require(_0x0f29('0x7'));var client=jayson['client'][_0x0f29('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c45ec,_0x355e21,_0xaa2675){return new BPromise(function(_0xc78ca2,_0x45350b){return client[_0x0f29('0x9')](_0x1c45ec,_0xaa2675)[_0x0f29('0xa')](function(_0x376de4){logger[_0x0f29('0xb')](_0x0f29('0xc'),_0x355e21,_0x0f29('0xd'));logger[_0x0f29('0xe')](_0x0f29('0xf'),_0x355e21,_0x0f29('0xd'),JSON['stringify'](_0x376de4));if(_0x376de4[_0x0f29('0x10')]){if(_0x376de4['error'][_0x0f29('0x11')]===0x1f4){logger[_0x0f29('0x10')](_0x0f29('0xc'),_0x355e21,_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);return _0x45350b(_0x376de4[_0x0f29('0x10')]['message']);}logger[_0x0f29('0x10')](_0x0f29('0xc'),_0x355e21,_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);return _0xc78ca2(_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);}else{logger[_0x0f29('0xb')](_0x0f29('0xc'),_0x355e21,'request\x20sent');_0xc78ca2(_0x376de4['result'][_0x0f29('0x12')]);}})[_0x0f29('0x13')](function(_0x38031e){logger[_0x0f29('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x355e21,_0x38031e);_0x45350b(_0x38031e);});});}exports[_0x0f29('0x14')]=function(_0x5d72a5){var _0x17b994=this;return new Promise(function(_0x4ca5e8,_0x5ddc74){return db['VtigerAccount'][_0x0f29('0x15')]({'raw':_0x5d72a5[_0x0f29('0x16')]?_0x5d72a5[_0x0f29('0x16')][_0x0f29('0x17')]===undefined?!![]:![]:!![],'where':_0x5d72a5[_0x0f29('0x16')]?_0x5d72a5[_0x0f29('0x16')][_0x0f29('0x18')]||null:null,'attributes':_0x5d72a5['options']?_0x5d72a5[_0x0f29('0x16')]['attributes']||null:null,'limit':_0x5d72a5['options']?_0x5d72a5['options']['limit']||null:null,'include':_0x5d72a5[_0x0f29('0x16')]?_0x5d72a5[_0x0f29('0x16')]['include']?_[_0x0f29('0x19')](_0x5d72a5[_0x0f29('0x16')][_0x0f29('0x1a')],function(_0x3402dc){return{'model':db[_0x3402dc[_0x0f29('0x1b')]],'as':_0x3402dc['as'],'attributes':_0x3402dc['attributes'],'include':_0x3402dc[_0x0f29('0x1a')]?_['map'](_0x3402dc[_0x0f29('0x1a')],function(_0x26f46f){return{'model':db[_0x26f46f[_0x0f29('0x1b')]],'as':_0x26f46f['as'],'attributes':_0x26f46f[_0x0f29('0x1c')],'include':_0x26f46f['include']?_[_0x0f29('0x19')](_0x26f46f['include'],function(_0x58b201){return{'model':db[_0x58b201[_0x0f29('0x1b')]],'as':_0x58b201['as'],'attributes':_0x58b201['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x57dcc7){logger['info'](_0x0f29('0x14'),_0x5d72a5);logger[_0x0f29('0xe')]('GetVtigerAccount',_0x5d72a5,JSON[_0x0f29('0x1d')](_0x57dcc7));_0x4ca5e8(_0x57dcc7);})[_0x0f29('0x13')](function(_0x274c9d){logger['error']('GetVtigerAccount',_0x274c9d[_0x0f29('0x12')],_0x5d72a5);_0x5ddc74(_0x17b994['error'](0x1f4,_0x274c9d[_0x0f29('0x12')]));});});};exports['ShowVtigerAccount']=function(_0x526364){var _0x7b10f=this;return new Promise(function(_0x409b19,_0xf59431){return db[_0x0f29('0x1e')]['find']({'raw':_0x526364['options']?_0x526364[_0x0f29('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x526364['options']?_0x526364[_0x0f29('0x16')]['where']||null:null,'attributes':_0x526364[_0x0f29('0x16')]?_0x526364['options']['attributes']||null:null,'include':_0x526364[_0x0f29('0x16')]?_0x526364[_0x0f29('0x16')][_0x0f29('0x1a')]?_[_0x0f29('0x19')](_0x526364[_0x0f29('0x16')]['include'],function(_0x426a3e){return{'model':db[_0x426a3e['model']],'as':_0x426a3e['as'],'attributes':_0x426a3e[_0x0f29('0x1c')],'include':_0x426a3e[_0x0f29('0x1a')]?_[_0x0f29('0x19')](_0x426a3e[_0x0f29('0x1a')],function(_0x4852a5){return{'model':db[_0x4852a5[_0x0f29('0x1b')]],'as':_0x4852a5['as'],'attributes':_0x4852a5[_0x0f29('0x1c')],'include':_0x4852a5['include']?_[_0x0f29('0x19')](_0x4852a5[_0x0f29('0x1a')],function(_0x5e40ac){return{'model':db[_0x5e40ac['model']],'as':_0x5e40ac['as'],'attributes':_0x5e40ac[_0x0f29('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0f29('0xa')](function(_0x3691d4){logger[_0x0f29('0xb')](_0x0f29('0x1f'),_0x526364);logger[_0x0f29('0xe')]('ShowVtigerAccount',_0x526364,JSON[_0x0f29('0x1d')](_0x3691d4));_0x409b19(_0x3691d4);})['catch'](function(_0x331dc7){logger['error'](_0x0f29('0x1f'),_0x331dc7[_0x0f29('0x12')],_0x526364);_0xf59431(_0x7b10f[_0x0f29('0x10')](0x1f4,_0x331dc7['message']));});});}; \ No newline at end of file +var _0x757a=['stringify','error','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','map','model','ShowVtigerAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s'];(function(_0x3eab86,_0x3110ed){var _0x9dac0c=function(_0xd5417f){while(--_0xd5417f){_0x3eab86['push'](_0x3eab86['shift']());}};_0x9dac0c(++_0x3110ed);}(_0x757a,0xde));var _0xa757=function(_0x41fe7f,_0x294cbb){_0x41fe7f=_0x41fe7f-0x0;var _0x10c37e=_0x757a[_0x41fe7f];return _0x10c37e;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetVtigerAccount',_0x4d9f58);logger['debug']('GetVtigerAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetVtigerAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 3784920..ac5a6ac 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 _0xb4ab=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','show'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb4ab,0x1e9));var _0xbb4a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb4ab[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xbb4a('0x0'));var util=require(_0xbb4a('0x1'));var path=require(_0xbb4a('0x2'));var timeout=require(_0xbb4a('0x3'));var express=require(_0xbb4a('0x4'));var router=express[_0xbb4a('0x5')]();var fs_extra=require(_0xbb4a('0x6'));var auth=require(_0xbb4a('0x7'));var interaction=require(_0xbb4a('0x8'));var config=require(_0xbb4a('0x9'));var controller=require(_0xbb4a('0xa'));router[_0xbb4a('0xb')]('/',auth[_0xbb4a('0xc')](),controller[_0xbb4a('0xd')]);router['get']('/:id',auth[_0xbb4a('0xc')](),controller[_0xbb4a('0xe')]);router[_0xbb4a('0xb')](_0xbb4a('0xf'),auth['isAuthenticated'](),controller[_0xbb4a('0x10')]);router[_0xbb4a('0xb')](_0xbb4a('0x11'),auth['isAuthenticated'](),controller[_0xbb4a('0x12')]);router[_0xbb4a('0xb')](_0xbb4a('0x13'),auth[_0xbb4a('0xc')](),controller[_0xbb4a('0x14')]);router[_0xbb4a('0x15')]('/',auth[_0xbb4a('0xc')](),controller[_0xbb4a('0x16')]);router[_0xbb4a('0x17')](_0xbb4a('0x18'),auth['isAuthenticated'](),controller['update']);router[_0xbb4a('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xbb4a('0x1a')]);module[_0xbb4a('0x1b')]=router; \ No newline at end of file +var _0x3866=['fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','show','/:id/fields','getFields','get','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','delete','/:id','destroy','multer','util','path','connect-timeout','Router'];(function(_0x1eb259,_0x97e9c5){var _0x451869=function(_0x51569a){while(--_0x51569a){_0x1eb259['push'](_0x1eb259['shift']());}};_0x451869(++_0x97e9c5);}(_0x3866,0x10f));var _0x6386=function(_0xaa66b4,_0x5bad46){_0xaa66b4=_0xaa66b4-0x0;var _0x1a7e0a=_0x3866[_0xaa66b4];return _0x1a7e0a;};'use strict';var multer=require(_0x6386('0x0'));var util=require(_0x6386('0x1'));var path=require(_0x6386('0x2'));var timeout=require(_0x6386('0x3'));var express=require('express');var router=express[_0x6386('0x4')]();var fs_extra=require(_0x6386('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6386('0x6'));var config=require(_0x6386('0x7'));var controller=require(_0x6386('0x8'));router['get']('/',auth[_0x6386('0x9')](),controller['index']);router['get']('/:id',auth[_0x6386('0x9')](),controller[_0x6386('0xa')]);router['get'](_0x6386('0xb'),auth[_0x6386('0x9')](),controller[_0x6386('0xc')]);router[_0x6386('0xd')](_0x6386('0xe'),auth[_0x6386('0x9')](),controller[_0x6386('0xf')]);router[_0x6386('0xd')](_0x6386('0x10'),auth[_0x6386('0x9')](),controller[_0x6386('0x11')]);router['post']('/',auth[_0x6386('0x9')](),controller[_0x6386('0x12')]);router[_0x6386('0x13')]('/:id',auth[_0x6386('0x9')](),controller['update']);router[_0x6386('0x14')](_0x6386('0x15'),auth[_0x6386('0x9')](),controller[_0x6386('0x16')]);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 66cac29..110c93a 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 _0x0a5b=['sequelize','STRING'];(function(_0x545bf3,_0x518ed5){var _0x41b0f8=function(_0x412fa7){while(--_0x412fa7){_0x545bf3['push'](_0x545bf3['shift']());}};_0x41b0f8(++_0x518ed5);}(_0x0a5b,0x1ce));var _0xb0a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0a5b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb0a5('0x0'));module['exports']={'name':{'type':Sequelize[_0xb0a5('0x1')]},'description':{'type':Sequelize[_0xb0a5('0x1')]}}; \ No newline at end of file +var _0xc3ac=['sequelize','exports','STRING'];(function(_0x3a5cba,_0x57736f){var _0x3f1d6d=function(_0x34a3d3){while(--_0x34a3d3){_0x3a5cba['push'](_0x3a5cba['shift']());}};_0x3f1d6d(++_0x57736f);}(_0xc3ac,0xb4));var _0xcc3a=function(_0x3d67d0,_0x59d1f9){_0x3d67d0=_0x3d67d0-0x0;var _0x34a470=_0xc3ac[_0x3d67d0];return _0x34a470;};'use strict';var Sequelize=require(_0xcc3a('0x0'));module[_0xcc3a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcc3a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 9c9f0ab..6cbbf75 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 _0x4c18=['rows','catch','params','rawAttributes','fields','includeAll','find','create','body','destroy','getFields','findOne','VtigerField','order','pick','nolimit','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','error','send','map','VtigerConfiguration','fieldName','type','key','model','name','query','keys','intersection','attributes','length','hasOwnProperty','sort','where','filters','filter','VIRTUAL','merge','options','include','findAll'];(function(_0x369a98,_0x32250c){var _0x29565c=function(_0x1a6973){while(--_0x1a6973){_0x369a98['push'](_0x369a98['shift']());}};_0x29565c(++_0x32250c);}(_0x4c18,0x18e));var _0x84c1=function(_0x16deb1,_0x5cc91f){_0x16deb1=_0x16deb1-0x0;var _0x18abc0=_0x4c18[_0x16deb1];return _0x18abc0;};'use strict';var emlformat=require(_0x84c1('0x0'));var rimraf=require(_0x84c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x84c1('0x2'));var rp=require('request-promise');var moment=require(_0x84c1('0x3'));var BPromise=require(_0x84c1('0x4'));var Mustache=require('mustache');var util=require(_0x84c1('0x5'));var path=require(_0x84c1('0x6'));var sox=require(_0x84c1('0x7'));var csv=require(_0x84c1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84c1('0x9'));var squel=require('squel');var crypto=require(_0x84c1('0xa'));var jsforce=require(_0x84c1('0xb'));var deskjs=require(_0x84c1('0xc'));var toCsv=require(_0x84c1('0x8'));var querystring=require(_0x84c1('0xd'));var Papa=require('papaparse');var Redis=require(_0x84c1('0xe'));var authService=require(_0x84c1('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x84c1('0x10'));var logger=require(_0x84c1('0x11'))(_0x84c1('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x84c1('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58d79b,_0x2bdb9c){_0x2bdb9c=_0x2bdb9c||0xcc;return function(_0xcf7378){if(_0xcf7378){return _0x58d79b[_0x84c1('0x14')](_0x2bdb9c);}return _0x58d79b[_0x84c1('0x15')](_0x2bdb9c)[_0x84c1('0x16')]();};}function respondWithResult(_0x1931ee,_0x5c2f0f){_0x5c2f0f=_0x5c2f0f||0xc8;return function(_0x48648){if(_0x48648){return _0x1931ee[_0x84c1('0x15')](_0x5c2f0f)[_0x84c1('0x17')](_0x48648);}};}function respondWithFilteredResult(_0x3206c0,_0x4d8d8c){return function(_0x509bc3){if(_0x509bc3){var _0x4f7ffe=typeof _0x4d8d8c[_0x84c1('0x18')]==='undefined'&&typeof _0x4d8d8c[_0x84c1('0x19')]===_0x84c1('0x1a');var _0x31ee42=_0x509bc3[_0x84c1('0x1b')];var _0x3f14c8=_0x4f7ffe?0x0:_0x4d8d8c['offset'];var _0x2f6f00=_0x4f7ffe?_0x509bc3[_0x84c1('0x1b')]:_0x4d8d8c[_0x84c1('0x18')]+_0x4d8d8c[_0x84c1('0x19')];var _0x5b6c79;if(_0x2f6f00>=_0x31ee42){_0x2f6f00=_0x31ee42;_0x5b6c79=0xc8;}else{_0x5b6c79=0xce;}_0x3206c0[_0x84c1('0x15')](_0x5b6c79);return _0x3206c0[_0x84c1('0x1c')](_0x84c1('0x1d'),_0x3f14c8+'-'+_0x2f6f00+'/'+_0x31ee42)[_0x84c1('0x17')](_0x509bc3);}return null;};}function patchUpdates(_0x58430e){return function(_0xf0602a){try{jsonpatch[_0x84c1('0x1e')](_0xf0602a,_0x58430e,!![]);}catch(_0x5ba86c){return BPromise['reject'](_0x5ba86c);}return _0xf0602a[_0x84c1('0x1f')]();};}function saveUpdates(_0x576bd7,_0x192dea){return function(_0x38df49){if(_0x38df49){return _0x38df49[_0x84c1('0x20')](_0x576bd7)['then'](function(_0x147ee8){return _0x147ee8;});}return null;};}function removeEntity(_0x186d05,_0x2163d7){return function(_0x1c836d){if(_0x1c836d){return _0x1c836d['destroy']()[_0x84c1('0x21')](function(){_0x186d05['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x49d719,_0x59547b){return function(_0x3a3747){if(!_0x3a3747){_0x49d719[_0x84c1('0x14')](0x194);}return _0x3a3747;};}function handleError(_0x416417,_0x413237){_0x413237=_0x413237||0x1f4;return function(_0xac978c){logger[_0x84c1('0x22')](_0xac978c['stack']);if(_0xac978c['name']){delete _0xac978c['name'];}_0x416417[_0x84c1('0x15')](_0x413237)[_0x84c1('0x23')](_0xac978c);};}exports['index']=function(_0x2bb76c,_0x14466f){var _0x436f0c={},_0x5dca7c={},_0x1956c1={'count':0x0,'rows':[]};var _0x36739e=_[_0x84c1('0x24')](db[_0x84c1('0x25')]['rawAttributes'],function(_0x22bbc6){return{'name':_0x22bbc6[_0x84c1('0x26')],'type':_0x22bbc6[_0x84c1('0x27')][_0x84c1('0x28')]};});_0x5dca7c[_0x84c1('0x29')]=_['map'](_0x36739e,_0x84c1('0x2a'));_0x5dca7c[_0x84c1('0x2b')]=_[_0x84c1('0x2c')](_0x2bb76c[_0x84c1('0x2b')]);_0x5dca7c['filters']=_[_0x84c1('0x2d')](_0x5dca7c['model'],_0x5dca7c[_0x84c1('0x2b')]);_0x436f0c['attributes']=_['intersection'](_0x5dca7c[_0x84c1('0x29')],qs['fields'](_0x2bb76c[_0x84c1('0x2b')]['fields']));_0x436f0c[_0x84c1('0x2e')]=_0x436f0c['attributes'][_0x84c1('0x2f')]?_0x436f0c[_0x84c1('0x2e')]:_0x5dca7c[_0x84c1('0x29')];if(!_0x2bb76c[_0x84c1('0x2b')][_0x84c1('0x30')]('nolimit')){_0x436f0c[_0x84c1('0x19')]=qs[_0x84c1('0x19')](_0x2bb76c[_0x84c1('0x2b')]['limit']);_0x436f0c[_0x84c1('0x18')]=qs[_0x84c1('0x18')](_0x2bb76c['query']['offset']);}_0x436f0c['order']=qs[_0x84c1('0x31')](_0x2bb76c[_0x84c1('0x2b')][_0x84c1('0x31')]);_0x436f0c[_0x84c1('0x32')]=qs[_0x84c1('0x33')](_['pick'](_0x2bb76c[_0x84c1('0x2b')],_0x5dca7c[_0x84c1('0x33')]),_0x36739e);if(_0x2bb76c[_0x84c1('0x2b')][_0x84c1('0x34')]){_0x436f0c[_0x84c1('0x32')]=_['merge'](_0x436f0c[_0x84c1('0x32')],{'$or':_['map'](_0x36739e,function(_0x2b1c6d){if(_0x2b1c6d[_0x84c1('0x27')]!==_0x84c1('0x35')){var _0x28641f={};_0x28641f[_0x2b1c6d[_0x84c1('0x2a')]]={'$like':'%'+_0x2bb76c[_0x84c1('0x2b')][_0x84c1('0x34')]+'%'};return _0x28641f;}})});}_0x436f0c=_[_0x84c1('0x36')]({},_0x436f0c,_0x2bb76c[_0x84c1('0x37')]);var _0x5c5911={'where':_0x436f0c[_0x84c1('0x32')]};return db[_0x84c1('0x25')][_0x84c1('0x1b')](_0x5c5911)['then'](function(_0x14a8d4){_0x1956c1[_0x84c1('0x1b')]=_0x14a8d4;if(_0x2bb76c[_0x84c1('0x2b')]['includeAll']){_0x436f0c[_0x84c1('0x38')]=[{'all':!![]}];}return db[_0x84c1('0x25')][_0x84c1('0x39')](_0x436f0c);})['then'](function(_0x1280e1){_0x1956c1[_0x84c1('0x3a')]=_0x1280e1;return _0x1956c1;})[_0x84c1('0x21')](respondWithFilteredResult(_0x14466f,_0x436f0c))[_0x84c1('0x3b')](handleError(_0x14466f,null));};exports['show']=function(_0x1f1eac,_0xf3a16d){var _0x5b2b1d={'raw':![],'where':{'id':_0x1f1eac[_0x84c1('0x3c')]['id']}},_0x10c5e7={};_0x10c5e7[_0x84c1('0x29')]=_[_0x84c1('0x2c')](db[_0x84c1('0x25')][_0x84c1('0x3d')]);_0x10c5e7[_0x84c1('0x2b')]=_[_0x84c1('0x2c')](_0x1f1eac[_0x84c1('0x2b')]);_0x10c5e7['filters']=_['intersection'](_0x10c5e7['model'],_0x10c5e7[_0x84c1('0x2b')]);_0x5b2b1d['attributes']=_['intersection'](_0x10c5e7[_0x84c1('0x29')],qs[_0x84c1('0x3e')](_0x1f1eac['query']['fields']));_0x5b2b1d['attributes']=_0x5b2b1d[_0x84c1('0x2e')][_0x84c1('0x2f')]?_0x5b2b1d[_0x84c1('0x2e')]:_0x10c5e7[_0x84c1('0x29')];if(_0x1f1eac[_0x84c1('0x2b')][_0x84c1('0x3f')]){_0x5b2b1d['include']=[{'all':!![]}];}_0x5b2b1d=_[_0x84c1('0x36')]({},_0x5b2b1d,_0x1f1eac[_0x84c1('0x37')]);return db['VtigerConfiguration'][_0x84c1('0x40')](_0x5b2b1d)[_0x84c1('0x21')](handleEntityNotFound(_0xf3a16d,null))[_0x84c1('0x21')](respondWithResult(_0xf3a16d,null))[_0x84c1('0x3b')](handleError(_0xf3a16d,null));};exports[_0x84c1('0x41')]=function(_0x58b91b,_0x257a5f){return db[_0x84c1('0x25')][_0x84c1('0x41')](_0x58b91b['body'],{})[_0x84c1('0x21')](respondWithResult(_0x257a5f,0xc9))['catch'](handleError(_0x257a5f,null));};exports[_0x84c1('0x20')]=function(_0x2a8b62,_0x3187ca){if(_0x2a8b62[_0x84c1('0x42')]['id']){delete _0x2a8b62[_0x84c1('0x42')]['id'];}return db[_0x84c1('0x25')][_0x84c1('0x40')]({'where':{'id':_0x2a8b62[_0x84c1('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3187ca,null))['then'](saveUpdates(_0x2a8b62['body'],null))[_0x84c1('0x21')](respondWithResult(_0x3187ca,null))[_0x84c1('0x3b')](handleError(_0x3187ca,null));};exports[_0x84c1('0x43')]=function(_0x20f5af,_0x2e597e){return db['VtigerConfiguration'][_0x84c1('0x40')]({'where':{'id':_0x20f5af[_0x84c1('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2e597e,null))[_0x84c1('0x21')](removeEntity(_0x2e597e,null))[_0x84c1('0x3b')](handleError(_0x2e597e,null));};exports[_0x84c1('0x44')]=function(_0x5cafa1,_0x20847d,_0x171083){var _0x1d74cd={};var _0x2505ae={};var _0x2d3386;var _0x25e7ca;return db['VtigerConfiguration'][_0x84c1('0x45')]({'where':{'id':_0x5cafa1[_0x84c1('0x3c')]['id']}})['then'](handleEntityNotFound(_0x20847d,null))[_0x84c1('0x21')](function(_0x3b257b){if(_0x3b257b){_0x2d3386=_0x3b257b;_0x2505ae[_0x84c1('0x29')]=_[_0x84c1('0x2c')](db[_0x84c1('0x46')][_0x84c1('0x3d')]);_0x2505ae['query']=_['keys'](_0x5cafa1['query']);_0x2505ae['filters']=_[_0x84c1('0x2d')](_0x2505ae[_0x84c1('0x29')],_0x2505ae['query']);_0x1d74cd['attributes']=_[_0x84c1('0x2d')](_0x2505ae['model'],qs[_0x84c1('0x3e')](_0x5cafa1[_0x84c1('0x2b')]['fields']));_0x1d74cd[_0x84c1('0x2e')]=_0x1d74cd['attributes'][_0x84c1('0x2f')]?_0x1d74cd['attributes']:_0x2505ae[_0x84c1('0x29')];_0x1d74cd[_0x84c1('0x47')]=qs[_0x84c1('0x31')](_0x5cafa1['query'][_0x84c1('0x31')]);_0x1d74cd['where']=qs['filters'](_[_0x84c1('0x48')](_0x5cafa1[_0x84c1('0x2b')],_0x2505ae[_0x84c1('0x33')]));if(_0x5cafa1[_0x84c1('0x2b')][_0x84c1('0x34')]){_0x1d74cd[_0x84c1('0x32')]=_[_0x84c1('0x36')](_0x1d74cd[_0x84c1('0x32')],{'$or':_[_0x84c1('0x24')](_0x1d74cd[_0x84c1('0x2e')],function(_0x55d062){var _0x5a85a2={};_0x5a85a2[_0x55d062]={'$like':'%'+_0x5cafa1[_0x84c1('0x2b')][_0x84c1('0x34')]+'%'};return _0x5a85a2;})});}_0x1d74cd=_[_0x84c1('0x36')]({},_0x1d74cd,_0x5cafa1[_0x84c1('0x37')]);return _0x2d3386[_0x84c1('0x44')](_0x1d74cd);}})[_0x84c1('0x21')](function(_0x29b202){if(_0x29b202){_0x25e7ca=_0x29b202[_0x84c1('0x2f')];if(!_0x5cafa1[_0x84c1('0x2b')][_0x84c1('0x30')](_0x84c1('0x49'))){_0x1d74cd[_0x84c1('0x19')]=qs[_0x84c1('0x19')](_0x5cafa1[_0x84c1('0x2b')][_0x84c1('0x19')]);_0x1d74cd[_0x84c1('0x18')]=qs[_0x84c1('0x18')](_0x5cafa1['query']['offset']);}return _0x2d3386[_0x84c1('0x44')](_0x1d74cd);}})[_0x84c1('0x21')](function(_0x5a9fd8){if(_0x5a9fd8){return _0x5a9fd8?{'count':_0x25e7ca,'rows':_0x5a9fd8}:null;}})[_0x84c1('0x21')](respondWithResult(_0x20847d,null))[_0x84c1('0x3b')](handleError(_0x20847d,null));};exports[_0x84c1('0x4a')]=function(_0x40e5fb,_0x169624,_0x14452a){var _0x710c1e={};var _0x3cf563={};var _0x284ecf;var _0x30613f;return db[_0x84c1('0x25')][_0x84c1('0x45')]({'where':{'id':_0x40e5fb['params']['id']}})['then'](handleEntityNotFound(_0x169624,null))[_0x84c1('0x21')](function(_0x35361e){if(_0x35361e){_0x284ecf=_0x35361e;_0x3cf563[_0x84c1('0x29')]=_[_0x84c1('0x2c')](db[_0x84c1('0x46')]['rawAttributes']);_0x3cf563['query']=_[_0x84c1('0x2c')](_0x40e5fb['query']);_0x3cf563[_0x84c1('0x33')]=_[_0x84c1('0x2d')](_0x3cf563['model'],_0x3cf563['query']);_0x710c1e['attributes']=_[_0x84c1('0x2d')](_0x3cf563['model'],qs[_0x84c1('0x3e')](_0x40e5fb[_0x84c1('0x2b')][_0x84c1('0x3e')]));_0x710c1e['attributes']=_0x710c1e[_0x84c1('0x2e')][_0x84c1('0x2f')]?_0x710c1e[_0x84c1('0x2e')]:_0x3cf563[_0x84c1('0x29')];_0x710c1e[_0x84c1('0x47')]=qs[_0x84c1('0x31')](_0x40e5fb[_0x84c1('0x2b')]['sort']);_0x710c1e['where']=qs['filters'](_[_0x84c1('0x48')](_0x40e5fb[_0x84c1('0x2b')],_0x3cf563['filters']));if(_0x40e5fb[_0x84c1('0x2b')][_0x84c1('0x34')]){_0x710c1e[_0x84c1('0x32')]=_[_0x84c1('0x36')](_0x710c1e[_0x84c1('0x32')],{'$or':_[_0x84c1('0x24')](_0x710c1e[_0x84c1('0x2e')],function(_0x3f3fea){var _0x2b458b={};_0x2b458b[_0x3f3fea]={'$like':'%'+_0x40e5fb[_0x84c1('0x2b')][_0x84c1('0x34')]+'%'};return _0x2b458b;})});}_0x710c1e=_[_0x84c1('0x36')]({},_0x710c1e,_0x40e5fb[_0x84c1('0x37')]);return _0x284ecf[_0x84c1('0x4a')](_0x710c1e);}})['then'](function(_0x175b29){if(_0x175b29){_0x30613f=_0x175b29[_0x84c1('0x2f')];if(!_0x40e5fb['query']['hasOwnProperty']('nolimit')){_0x710c1e[_0x84c1('0x19')]=qs[_0x84c1('0x19')](_0x40e5fb['query']['limit']);_0x710c1e['offset']=qs[_0x84c1('0x18')](_0x40e5fb[_0x84c1('0x2b')][_0x84c1('0x18')]);}return _0x284ecf[_0x84c1('0x4a')](_0x710c1e);}})[_0x84c1('0x21')](function(_0x3721da){if(_0x3721da){return _0x3721da?{'count':_0x30613f,'rows':_0x3721da}:null;}})['then'](respondWithResult(_0x169624,null))[_0x84c1('0x3b')](handleError(_0x169624,null));};exports[_0x84c1('0x4b')]=function(_0x777fad,_0x52c0ef,_0x1890ab){var _0x311367={};var _0x50a88f={};var _0x1cdc95;var _0x1f7bda;return db[_0x84c1('0x25')]['findOne']({'where':{'id':_0x777fad[_0x84c1('0x3c')]['id']}})[_0x84c1('0x21')](handleEntityNotFound(_0x52c0ef,null))[_0x84c1('0x21')](function(_0x574fa5){if(_0x574fa5){_0x1cdc95=_0x574fa5;_0x50a88f[_0x84c1('0x29')]=_[_0x84c1('0x2c')](db['VtigerField']['rawAttributes']);_0x50a88f['query']=_[_0x84c1('0x2c')](_0x777fad['query']);_0x50a88f[_0x84c1('0x33')]=_[_0x84c1('0x2d')](_0x50a88f[_0x84c1('0x29')],_0x50a88f[_0x84c1('0x2b')]);_0x311367[_0x84c1('0x2e')]=_[_0x84c1('0x2d')](_0x50a88f[_0x84c1('0x29')],qs['fields'](_0x777fad['query']['fields']));_0x311367[_0x84c1('0x2e')]=_0x311367[_0x84c1('0x2e')]['length']?_0x311367[_0x84c1('0x2e')]:_0x50a88f[_0x84c1('0x29')];_0x311367[_0x84c1('0x47')]=qs[_0x84c1('0x31')](_0x777fad['query'][_0x84c1('0x31')]);_0x311367[_0x84c1('0x32')]=qs[_0x84c1('0x33')](_[_0x84c1('0x48')](_0x777fad[_0x84c1('0x2b')],_0x50a88f[_0x84c1('0x33')]));if(_0x777fad['query'][_0x84c1('0x34')]){_0x311367[_0x84c1('0x32')]=_['merge'](_0x311367[_0x84c1('0x32')],{'$or':_[_0x84c1('0x24')](_0x311367[_0x84c1('0x2e')],function(_0x52d888){var _0x24012b={};_0x24012b[_0x52d888]={'$like':'%'+_0x777fad[_0x84c1('0x2b')]['filter']+'%'};return _0x24012b;})});}_0x311367=_[_0x84c1('0x36')]({},_0x311367,_0x777fad['options']);return _0x1cdc95['getDescriptions'](_0x311367);}})[_0x84c1('0x21')](function(_0xd5ff9d){if(_0xd5ff9d){_0x1f7bda=_0xd5ff9d['length'];if(!_0x777fad[_0x84c1('0x2b')][_0x84c1('0x30')](_0x84c1('0x49'))){_0x311367[_0x84c1('0x19')]=qs['limit'](_0x777fad['query']['limit']);_0x311367[_0x84c1('0x18')]=qs[_0x84c1('0x18')](_0x777fad['query']['offset']);}return _0x1cdc95[_0x84c1('0x4b')](_0x311367);}})[_0x84c1('0x21')](function(_0x3c8e99){if(_0x3c8e99){return _0x3c8e99?{'count':_0x1f7bda,'rows':_0x3c8e99}:null;}})[_0x84c1('0x21')](respondWithResult(_0x52c0ef,null))[_0x84c1('0x3b')](handleError(_0x52c0ef,null));}; \ No newline at end of file +var _0x666c=['bluebird','mustache','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','name','send','map','VtigerConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getFields','VtigerField','getSubjects','findOne','getDescriptions','rimraf','request-promise','moment'];(function(_0x95a80,_0x1dd45d){var _0x2241b7=function(_0x120b1b){while(--_0x120b1b){_0x95a80['push'](_0x95a80['shift']());}};_0x2241b7(++_0x1dd45d);}(_0x666c,0xde));var _0xc666=function(_0x41da6,_0x42431b){_0x41da6=_0x41da6-0x0;var _0x282340=_0x666c[_0x41da6];return _0x282340;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc666('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc666('0x1'));var moment=require(_0xc666('0x2'));var BPromise=require(_0xc666('0x3'));var Mustache=require(_0xc666('0x4'));var util=require('util');var path=require(_0xc666('0x5'));var sox=require(_0xc666('0x6'));var csv=require(_0xc666('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc666('0x8'));var squel=require('squel');var crypto=require(_0xc666('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc666('0xa'));var toCsv=require('to-csv');var querystring=require(_0xc666('0xb'));var Papa=require(_0xc666('0xc'));var Redis=require(_0xc666('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc666('0xe'));var as=require(_0xc666('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc666('0x10'));var utils=require(_0xc666('0x11'));var config=require(_0xc666('0x12'));var licenseUtil=require(_0xc666('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b9639,_0x2a9f15){_0x2a9f15=_0x2a9f15||0xcc;return function(_0x144d6d){if(_0x144d6d){return _0x4b9639['sendStatus'](_0x2a9f15);}return _0x4b9639[_0xc666('0x14')](_0x2a9f15)[_0xc666('0x15')]();};}function respondWithResult(_0x244370,_0x45e79d){_0x45e79d=_0x45e79d||0xc8;return function(_0x3907d0){if(_0x3907d0){return _0x244370[_0xc666('0x14')](_0x45e79d)[_0xc666('0x16')](_0x3907d0);}};}function respondWithFilteredResult(_0xf5c0a1,_0xf34467){return function(_0x461848){if(_0x461848){var _0x48c862=typeof _0xf34467[_0xc666('0x17')]==='undefined'&&typeof _0xf34467[_0xc666('0x18')]==='undefined';var _0x42751b=_0x461848[_0xc666('0x19')];var _0x4b5051=_0x48c862?0x0:_0xf34467[_0xc666('0x17')];var _0x136d9f=_0x48c862?_0x461848['count']:_0xf34467['offset']+_0xf34467[_0xc666('0x18')];var _0x620a75;if(_0x136d9f>=_0x42751b){_0x136d9f=_0x42751b;_0x620a75=0xc8;}else{_0x620a75=0xce;}_0xf5c0a1[_0xc666('0x14')](_0x620a75);return _0xf5c0a1[_0xc666('0x1a')](_0xc666('0x1b'),_0x4b5051+'-'+_0x136d9f+'/'+_0x42751b)[_0xc666('0x16')](_0x461848);}return null;};}function patchUpdates(_0x5a8b3){return function(_0x9583be){try{jsonpatch[_0xc666('0x1c')](_0x9583be,_0x5a8b3,!![]);}catch(_0x12e5e6){return BPromise[_0xc666('0x1d')](_0x12e5e6);}return _0x9583be[_0xc666('0x1e')]();};}function saveUpdates(_0x3f64c7,_0x21b7af){return function(_0x3f1672){if(_0x3f1672){return _0x3f1672[_0xc666('0x1f')](_0x3f64c7)[_0xc666('0x20')](function(_0x2a8d6a){return _0x2a8d6a;});}return null;};}function removeEntity(_0x3554f7,_0x59feba){return function(_0x5f5082){if(_0x5f5082){return _0x5f5082['destroy']()[_0xc666('0x20')](function(){_0x3554f7[_0xc666('0x14')](0xcc)[_0xc666('0x15')]();});}};}function handleEntityNotFound(_0x2805c,_0xc35251){return function(_0x5e86cf){if(!_0x5e86cf){_0x2805c[_0xc666('0x21')](0x194);}return _0x5e86cf;};}function handleError(_0x4e246a,_0xb05184){_0xb05184=_0xb05184||0x1f4;return function(_0x29e29a){logger['error'](_0x29e29a['stack']);if(_0x29e29a[_0xc666('0x22')]){delete _0x29e29a['name'];}_0x4e246a[_0xc666('0x14')](_0xb05184)[_0xc666('0x23')](_0x29e29a);};}exports['index']=function(_0x1b7404,_0x3e7b7c){var _0x143e5a={},_0x1812fc={},_0x8d49b={'count':0x0,'rows':[]};var _0x86f7a3=_[_0xc666('0x24')](db[_0xc666('0x25')][_0xc666('0x26')],function(_0x5c6adb){return{'name':_0x5c6adb['fieldName'],'type':_0x5c6adb[_0xc666('0x27')][_0xc666('0x28')]};});_0x1812fc[_0xc666('0x29')]=_[_0xc666('0x24')](_0x86f7a3,_0xc666('0x22'));_0x1812fc[_0xc666('0x2a')]=_[_0xc666('0x2b')](_0x1b7404['query']);_0x1812fc[_0xc666('0x2c')]=_[_0xc666('0x2d')](_0x1812fc[_0xc666('0x29')],_0x1812fc[_0xc666('0x2a')]);_0x143e5a[_0xc666('0x2e')]=_[_0xc666('0x2d')](_0x1812fc[_0xc666('0x29')],qs[_0xc666('0x2f')](_0x1b7404['query'][_0xc666('0x2f')]));_0x143e5a[_0xc666('0x2e')]=_0x143e5a['attributes'][_0xc666('0x30')]?_0x143e5a[_0xc666('0x2e')]:_0x1812fc['model'];if(!_0x1b7404[_0xc666('0x2a')][_0xc666('0x31')](_0xc666('0x32'))){_0x143e5a[_0xc666('0x18')]=qs[_0xc666('0x18')](_0x1b7404[_0xc666('0x2a')][_0xc666('0x18')]);_0x143e5a[_0xc666('0x17')]=qs[_0xc666('0x17')](_0x1b7404[_0xc666('0x2a')]['offset']);}_0x143e5a[_0xc666('0x33')]=qs[_0xc666('0x34')](_0x1b7404[_0xc666('0x2a')][_0xc666('0x34')]);_0x143e5a[_0xc666('0x35')]=qs[_0xc666('0x2c')](_[_0xc666('0x36')](_0x1b7404[_0xc666('0x2a')],_0x1812fc[_0xc666('0x2c')]),_0x86f7a3);if(_0x1b7404['query'][_0xc666('0x37')]){_0x143e5a[_0xc666('0x35')]=_[_0xc666('0x38')](_0x143e5a['where'],{'$or':_[_0xc666('0x24')](_0x86f7a3,function(_0x13da1a){if(_0x13da1a[_0xc666('0x27')]!==_0xc666('0x39')){var _0x27a6c0={};_0x27a6c0[_0x13da1a['name']]={'$like':'%'+_0x1b7404[_0xc666('0x2a')][_0xc666('0x37')]+'%'};return _0x27a6c0;}})});}_0x143e5a=_['merge']({},_0x143e5a,_0x1b7404[_0xc666('0x3a')]);var _0x1e0a51={'where':_0x143e5a[_0xc666('0x35')]};return db[_0xc666('0x25')][_0xc666('0x19')](_0x1e0a51)[_0xc666('0x20')](function(_0x4320dd){_0x8d49b[_0xc666('0x19')]=_0x4320dd;if(_0x1b7404[_0xc666('0x2a')][_0xc666('0x3b')]){_0x143e5a[_0xc666('0x3c')]=[{'all':!![]}];}return db[_0xc666('0x25')][_0xc666('0x3d')](_0x143e5a);})['then'](function(_0x1b15af){_0x8d49b[_0xc666('0x3e')]=_0x1b15af;return _0x8d49b;})[_0xc666('0x20')](respondWithFilteredResult(_0x3e7b7c,_0x143e5a))[_0xc666('0x3f')](handleError(_0x3e7b7c,null));};exports[_0xc666('0x40')]=function(_0x46a324,_0x5d4d8f){var _0xfea009={'raw':![],'where':{'id':_0x46a324[_0xc666('0x41')]['id']}},_0x1cab36={};_0x1cab36[_0xc666('0x29')]=_[_0xc666('0x2b')](db[_0xc666('0x25')]['rawAttributes']);_0x1cab36[_0xc666('0x2a')]=_[_0xc666('0x2b')](_0x46a324[_0xc666('0x2a')]);_0x1cab36['filters']=_[_0xc666('0x2d')](_0x1cab36['model'],_0x1cab36[_0xc666('0x2a')]);_0xfea009[_0xc666('0x2e')]=_[_0xc666('0x2d')](_0x1cab36[_0xc666('0x29')],qs['fields'](_0x46a324[_0xc666('0x2a')][_0xc666('0x2f')]));_0xfea009['attributes']=_0xfea009[_0xc666('0x2e')]['length']?_0xfea009[_0xc666('0x2e')]:_0x1cab36['model'];if(_0x46a324[_0xc666('0x2a')][_0xc666('0x3b')]){_0xfea009['include']=[{'all':!![]}];}_0xfea009=_['merge']({},_0xfea009,_0x46a324[_0xc666('0x3a')]);return db[_0xc666('0x25')][_0xc666('0x42')](_0xfea009)[_0xc666('0x20')](handleEntityNotFound(_0x5d4d8f,null))[_0xc666('0x20')](respondWithResult(_0x5d4d8f,null))[_0xc666('0x3f')](handleError(_0x5d4d8f,null));};exports[_0xc666('0x43')]=function(_0x5ee4c6,_0x225e76){return db[_0xc666('0x25')][_0xc666('0x43')](_0x5ee4c6[_0xc666('0x44')],{})[_0xc666('0x20')](respondWithResult(_0x225e76,0xc9))['catch'](handleError(_0x225e76,null));};exports['update']=function(_0x3d5213,_0x137895){if(_0x3d5213[_0xc666('0x44')]['id']){delete _0x3d5213['body']['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x3d5213[_0xc666('0x41')]['id']}})['then'](handleEntityNotFound(_0x137895,null))['then'](saveUpdates(_0x3d5213[_0xc666('0x44')],null))['then'](respondWithResult(_0x137895,null))[_0xc666('0x3f')](handleError(_0x137895,null));};exports[_0xc666('0x45')]=function(_0x4cd6b5,_0x3eac48){return db[_0xc666('0x25')][_0xc666('0x42')]({'where':{'id':_0x4cd6b5[_0xc666('0x41')]['id']}})['then'](handleEntityNotFound(_0x3eac48,null))[_0xc666('0x20')](removeEntity(_0x3eac48,null))[_0xc666('0x3f')](handleError(_0x3eac48,null));};exports[_0xc666('0x46')]=function(_0x50fcb4,_0x201dd3,_0x369388){var _0x39336e={};var _0x275fc9={};var _0x2e90bc;var _0x21796a;return db[_0xc666('0x25')]['findOne']({'where':{'id':_0x50fcb4[_0xc666('0x41')]['id']}})[_0xc666('0x20')](handleEntityNotFound(_0x201dd3,null))[_0xc666('0x20')](function(_0x118fbd){if(_0x118fbd){_0x2e90bc=_0x118fbd;_0x275fc9[_0xc666('0x29')]=_['keys'](db[_0xc666('0x47')]['rawAttributes']);_0x275fc9['query']=_[_0xc666('0x2b')](_0x50fcb4['query']);_0x275fc9[_0xc666('0x2c')]=_['intersection'](_0x275fc9['model'],_0x275fc9[_0xc666('0x2a')]);_0x39336e[_0xc666('0x2e')]=_[_0xc666('0x2d')](_0x275fc9['model'],qs[_0xc666('0x2f')](_0x50fcb4[_0xc666('0x2a')][_0xc666('0x2f')]));_0x39336e[_0xc666('0x2e')]=_0x39336e[_0xc666('0x2e')][_0xc666('0x30')]?_0x39336e[_0xc666('0x2e')]:_0x275fc9['model'];_0x39336e[_0xc666('0x33')]=qs['sort'](_0x50fcb4['query'][_0xc666('0x34')]);_0x39336e[_0xc666('0x35')]=qs['filters'](_[_0xc666('0x36')](_0x50fcb4[_0xc666('0x2a')],_0x275fc9[_0xc666('0x2c')]));if(_0x50fcb4[_0xc666('0x2a')]['filter']){_0x39336e[_0xc666('0x35')]=_[_0xc666('0x38')](_0x39336e[_0xc666('0x35')],{'$or':_['map'](_0x39336e[_0xc666('0x2e')],function(_0xd1df98){var _0x1847a3={};_0x1847a3[_0xd1df98]={'$like':'%'+_0x50fcb4['query'][_0xc666('0x37')]+'%'};return _0x1847a3;})});}_0x39336e=_[_0xc666('0x38')]({},_0x39336e,_0x50fcb4[_0xc666('0x3a')]);return _0x2e90bc[_0xc666('0x46')](_0x39336e);}})[_0xc666('0x20')](function(_0x10feee){if(_0x10feee){_0x21796a=_0x10feee[_0xc666('0x30')];if(!_0x50fcb4['query'][_0xc666('0x31')](_0xc666('0x32'))){_0x39336e[_0xc666('0x18')]=qs[_0xc666('0x18')](_0x50fcb4['query'][_0xc666('0x18')]);_0x39336e[_0xc666('0x17')]=qs[_0xc666('0x17')](_0x50fcb4[_0xc666('0x2a')][_0xc666('0x17')]);}return _0x2e90bc['getFields'](_0x39336e);}})[_0xc666('0x20')](function(_0x7626c0){if(_0x7626c0){return _0x7626c0?{'count':_0x21796a,'rows':_0x7626c0}:null;}})['then'](respondWithResult(_0x201dd3,null))[_0xc666('0x3f')](handleError(_0x201dd3,null));};exports[_0xc666('0x48')]=function(_0x12ce3f,_0x429f0c,_0x14e6e9){var _0xc30090={};var _0x392555={};var _0x3ce66d;var _0x4e465e;return db[_0xc666('0x25')][_0xc666('0x49')]({'where':{'id':_0x12ce3f[_0xc666('0x41')]['id']}})[_0xc666('0x20')](handleEntityNotFound(_0x429f0c,null))['then'](function(_0x58dc32){if(_0x58dc32){_0x3ce66d=_0x58dc32;_0x392555[_0xc666('0x29')]=_[_0xc666('0x2b')](db[_0xc666('0x47')][_0xc666('0x26')]);_0x392555[_0xc666('0x2a')]=_[_0xc666('0x2b')](_0x12ce3f[_0xc666('0x2a')]);_0x392555['filters']=_[_0xc666('0x2d')](_0x392555[_0xc666('0x29')],_0x392555[_0xc666('0x2a')]);_0xc30090['attributes']=_['intersection'](_0x392555[_0xc666('0x29')],qs[_0xc666('0x2f')](_0x12ce3f[_0xc666('0x2a')][_0xc666('0x2f')]));_0xc30090[_0xc666('0x2e')]=_0xc30090[_0xc666('0x2e')][_0xc666('0x30')]?_0xc30090[_0xc666('0x2e')]:_0x392555[_0xc666('0x29')];_0xc30090['order']=qs['sort'](_0x12ce3f[_0xc666('0x2a')][_0xc666('0x34')]);_0xc30090[_0xc666('0x35')]=qs[_0xc666('0x2c')](_[_0xc666('0x36')](_0x12ce3f[_0xc666('0x2a')],_0x392555['filters']));if(_0x12ce3f[_0xc666('0x2a')]['filter']){_0xc30090[_0xc666('0x35')]=_[_0xc666('0x38')](_0xc30090[_0xc666('0x35')],{'$or':_['map'](_0xc30090[_0xc666('0x2e')],function(_0x5c6945){var _0xcd2fa4={};_0xcd2fa4[_0x5c6945]={'$like':'%'+_0x12ce3f[_0xc666('0x2a')][_0xc666('0x37')]+'%'};return _0xcd2fa4;})});}_0xc30090=_[_0xc666('0x38')]({},_0xc30090,_0x12ce3f[_0xc666('0x3a')]);return _0x3ce66d[_0xc666('0x48')](_0xc30090);}})[_0xc666('0x20')](function(_0x24da6d){if(_0x24da6d){_0x4e465e=_0x24da6d[_0xc666('0x30')];if(!_0x12ce3f[_0xc666('0x2a')][_0xc666('0x31')](_0xc666('0x32'))){_0xc30090[_0xc666('0x18')]=qs[_0xc666('0x18')](_0x12ce3f['query'][_0xc666('0x18')]);_0xc30090[_0xc666('0x17')]=qs[_0xc666('0x17')](_0x12ce3f[_0xc666('0x2a')]['offset']);}return _0x3ce66d[_0xc666('0x48')](_0xc30090);}})[_0xc666('0x20')](function(_0x38688c){if(_0x38688c){return _0x38688c?{'count':_0x4e465e,'rows':_0x38688c}:null;}})['then'](respondWithResult(_0x429f0c,null))['catch'](handleError(_0x429f0c,null));};exports[_0xc666('0x4a')]=function(_0x10a5cd,_0x125651,_0x2957e4){var _0x4e4f0f={};var _0x4f6c1a={};var _0x301287;var _0x47cbe1;return db[_0xc666('0x25')][_0xc666('0x49')]({'where':{'id':_0x10a5cd[_0xc666('0x41')]['id']}})[_0xc666('0x20')](handleEntityNotFound(_0x125651,null))['then'](function(_0x47e1d9){if(_0x47e1d9){_0x301287=_0x47e1d9;_0x4f6c1a[_0xc666('0x29')]=_['keys'](db[_0xc666('0x47')][_0xc666('0x26')]);_0x4f6c1a[_0xc666('0x2a')]=_[_0xc666('0x2b')](_0x10a5cd[_0xc666('0x2a')]);_0x4f6c1a[_0xc666('0x2c')]=_[_0xc666('0x2d')](_0x4f6c1a[_0xc666('0x29')],_0x4f6c1a[_0xc666('0x2a')]);_0x4e4f0f[_0xc666('0x2e')]=_[_0xc666('0x2d')](_0x4f6c1a[_0xc666('0x29')],qs['fields'](_0x10a5cd[_0xc666('0x2a')][_0xc666('0x2f')]));_0x4e4f0f[_0xc666('0x2e')]=_0x4e4f0f[_0xc666('0x2e')][_0xc666('0x30')]?_0x4e4f0f[_0xc666('0x2e')]:_0x4f6c1a[_0xc666('0x29')];_0x4e4f0f[_0xc666('0x33')]=qs['sort'](_0x10a5cd[_0xc666('0x2a')][_0xc666('0x34')]);_0x4e4f0f['where']=qs[_0xc666('0x2c')](_['pick'](_0x10a5cd[_0xc666('0x2a')],_0x4f6c1a[_0xc666('0x2c')]));if(_0x10a5cd[_0xc666('0x2a')][_0xc666('0x37')]){_0x4e4f0f[_0xc666('0x35')]=_[_0xc666('0x38')](_0x4e4f0f[_0xc666('0x35')],{'$or':_[_0xc666('0x24')](_0x4e4f0f['attributes'],function(_0x16a3e9){var _0x3633d7={};_0x3633d7[_0x16a3e9]={'$like':'%'+_0x10a5cd[_0xc666('0x2a')][_0xc666('0x37')]+'%'};return _0x3633d7;})});}_0x4e4f0f=_[_0xc666('0x38')]({},_0x4e4f0f,_0x10a5cd[_0xc666('0x3a')]);return _0x301287[_0xc666('0x4a')](_0x4e4f0f);}})[_0xc666('0x20')](function(_0x56945c){if(_0x56945c){_0x47cbe1=_0x56945c['length'];if(!_0x10a5cd[_0xc666('0x2a')][_0xc666('0x31')](_0xc666('0x32'))){_0x4e4f0f[_0xc666('0x18')]=qs[_0xc666('0x18')](_0x10a5cd[_0xc666('0x2a')][_0xc666('0x18')]);_0x4e4f0f[_0xc666('0x17')]=qs[_0xc666('0x17')](_0x10a5cd[_0xc666('0x2a')]['offset']);}return _0x301287['getDescriptions'](_0x4e4f0f);}})[_0xc666('0x20')](function(_0x3dd898){if(_0x3dd898){return _0x3dd898?{'count':_0x47cbe1,'rows':_0x3dd898}:null;}})[_0xc666('0x20')](respondWithResult(_0x125651,null))[_0xc666('0x3f')](handleError(_0x125651,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index bdbf2a8..ea49cf6 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 _0xf06c=['moment','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations','lodash','util','api'];(function(_0x4a2966,_0x37c4f2){var _0x386edb=function(_0x426d08){while(--_0x426d08){_0x4a2966['push'](_0x4a2966['shift']());}};_0x386edb(++_0x37c4f2);}(_0xf06c,0x1c5));var _0xcf06=function(_0x2bb7d7,_0x2d024e){_0x2bb7d7=_0x2bb7d7-0x0;var _0x480ae3=_0xf06c[_0x2bb7d7];return _0x480ae3;};'use strict';var _=require(_0xcf06('0x0'));var util=require(_0xcf06('0x1'));var logger=require('../../config/logger')(_0xcf06('0x2'));var moment=require(_0xcf06('0x3'));var BPromise=require(_0xcf06('0x4'));var rp=require(_0xcf06('0x5'));var fs=require('fs');var path=require(_0xcf06('0x6'));var rimraf=require('rimraf');var config=require(_0xcf06('0x7'));var attributes=require(_0xcf06('0x8'));module[_0xcf06('0x9')]=function(_0x5b819d,_0x2fa02d){return _0x5b819d['define'](_0xcf06('0xa'),attributes,{'tableName':_0xcf06('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38e6=['../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x271282,_0x55dade){var _0x2155cf=function(_0x486a62){while(--_0x486a62){_0x271282['push'](_0x271282['shift']());}};_0x2155cf(++_0x55dade);}(_0x38e6,0x18e));var _0x638e=function(_0x58c22b,_0x321b6b){_0x58c22b=_0x58c22b-0x0;var _0x4660b5=_0x38e6[_0x58c22b];return _0x4660b5;};'use strict';var _=require(_0x638e('0x0'));var util=require(_0x638e('0x1'));var logger=require(_0x638e('0x2'))(_0x638e('0x3'));var moment=require(_0x638e('0x4'));var BPromise=require('bluebird');var rp=require(_0x638e('0x5'));var fs=require('fs');var path=require(_0x638e('0x6'));var rimraf=require(_0x638e('0x7'));var config=require(_0x638e('0x8'));var attributes=require(_0x638e('0x9'));module[_0x638e('0xa')]=function(_0x4c492a,_0x27dd48){return _0x4c492a[_0x638e('0xb')](_0x638e('0xc'),attributes,{'tableName':_0x638e('0xd'),'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 e899b35..52a8de7 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 _0x7e67=['http','info','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','VtigerConfiguration,\x20%s,\x20%s','result','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x17dd1d,_0x31f1b5){var _0x5e9d0c=function(_0x2a4c95){while(--_0x2a4c95){_0x17dd1d['push'](_0x17dd1d['shift']());}};_0x5e9d0c(++_0x31f1b5);}(_0x7e67,0xa4));var _0x77e6=function(_0x223e85,_0x36a0b7){_0x223e85=_0x223e85-0x0;var _0x1bacaa=_0x7e67[_0x223e85];return _0x1bacaa;};'use strict';var _=require(_0x77e6('0x0'));var util=require(_0x77e6('0x1'));var moment=require(_0x77e6('0x2'));var BPromise=require(_0x77e6('0x3'));var rs=require(_0x77e6('0x4'));var fs=require('fs');var Redis=require(_0x77e6('0x5'));var db=require(_0x77e6('0x6'))['db'];var utils=require(_0x77e6('0x7'));var logger=require(_0x77e6('0x8'))(_0x77e6('0x9'));var config=require(_0x77e6('0xa'));var jayson=require(_0x77e6('0xb'));var client=jayson['client'][_0x77e6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e7fb2,_0x39201b,_0x148f72){return new BPromise(function(_0x535397,_0x2a2b41){return client['request'](_0x4e7fb2,_0x148f72)['then'](function(_0x645940){logger[_0x77e6('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x39201b,_0x77e6('0xe'));logger['debug'](_0x77e6('0xf'),_0x39201b,_0x77e6('0xe'),JSON['stringify'](_0x645940));if(_0x645940[_0x77e6('0x10')]){if(_0x645940[_0x77e6('0x10')][_0x77e6('0x11')]===0x1f4){logger[_0x77e6('0x10')](_0x77e6('0x12'),_0x39201b,_0x645940[_0x77e6('0x10')]['message']);return _0x2a2b41(_0x645940['error']['message']);}logger[_0x77e6('0x10')](_0x77e6('0x12'),_0x39201b,_0x645940[_0x77e6('0x10')]['message']);return _0x535397(_0x645940[_0x77e6('0x10')]['message']);}else{logger[_0x77e6('0xd')](_0x77e6('0x12'),_0x39201b,'request\x20sent');_0x535397(_0x645940[_0x77e6('0x13')][_0x77e6('0x14')]);}})[_0x77e6('0x15')](function(_0x565372){logger[_0x77e6('0x10')](_0x77e6('0x12'),_0x39201b,_0x565372);_0x2a2b41(_0x565372);});});} \ No newline at end of file +var _0x20cc=['info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x20cc,0x180));var _0xc20c=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x20cc[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0xc20c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc20c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc20c('0x2'));var db=require(_0xc20c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc20c('0x4'))(_0xc20c('0x5'));var config=require(_0xc20c('0x6'));var jayson=require(_0xc20c('0x7'));var client=jayson[_0xc20c('0x8')][_0xc20c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30745f,_0x299ff9,_0x1b5536){return new BPromise(function(_0x3b3adc,_0xff23c9){return client[_0xc20c('0xa')](_0x30745f,_0x1b5536)[_0xc20c('0xb')](function(_0x4500d6){logger[_0xc20c('0xc')](_0xc20c('0xd'),_0x299ff9,_0xc20c('0xe'));logger['debug'](_0xc20c('0xf'),_0x299ff9,_0xc20c('0xe'),JSON[_0xc20c('0x10')](_0x4500d6));if(_0x4500d6[_0xc20c('0x11')]){if(_0x4500d6[_0xc20c('0x11')][_0xc20c('0x12')]===0x1f4){logger[_0xc20c('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x299ff9,_0x4500d6[_0xc20c('0x11')][_0xc20c('0x13')]);return _0xff23c9(_0x4500d6[_0xc20c('0x11')][_0xc20c('0x13')]);}logger[_0xc20c('0x11')](_0xc20c('0xd'),_0x299ff9,_0x4500d6[_0xc20c('0x11')][_0xc20c('0x13')]);return _0x3b3adc(_0x4500d6[_0xc20c('0x11')][_0xc20c('0x13')]);}else{logger[_0xc20c('0xc')](_0xc20c('0xd'),_0x299ff9,_0xc20c('0xe'));_0x3b3adc(_0x4500d6[_0xc20c('0x14')][_0xc20c('0x13')]);}})[_0xc20c('0x15')](function(_0x435601){logger[_0xc20c('0x11')](_0xc20c('0xd'),_0x299ff9,_0x435601);_0xff23c9(_0x435601);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index f1d9ecf..eaf9600 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 _0x567c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','update','delete','destroy','exports','multer','util','path'];(function(_0x423e4b,_0x1bb75b){var _0x626fd4=function(_0x1e731e){while(--_0x1e731e){_0x423e4b['push'](_0x423e4b['shift']());}};_0x626fd4(++_0x1bb75b);}(_0x567c,0xb1));var _0xc567=function(_0x34f331,_0xa9e329){_0x34f331=_0x34f331-0x0;var _0x240b3c=_0x567c[_0x34f331];return _0x240b3c;};'use strict';var multer=require(_0xc567('0x0'));var util=require(_0xc567('0x1'));var path=require(_0xc567('0x2'));var timeout=require(_0xc567('0x3'));var express=require(_0xc567('0x4'));var router=express[_0xc567('0x5')]();var fs_extra=require(_0xc567('0x6'));var auth=require(_0xc567('0x7'));var interaction=require(_0xc567('0x8'));var config=require(_0xc567('0x9'));var controller=require('./intVtigerField.controller');router[_0xc567('0xa')]('/',auth[_0xc567('0xb')](),controller['index']);router[_0xc567('0xa')](_0xc567('0xc'),auth[_0xc567('0xb')](),controller[_0xc567('0xd')]);router['post']('/',auth[_0xc567('0xb')](),controller['create']);router['put'](_0xc567('0xc'),auth['isAuthenticated'](),controller[_0xc567('0xe')]);router[_0xc567('0xf')](_0xc567('0xc'),auth[_0xc567('0xb')](),controller[_0xc567('0x10')]);module[_0xc567('0x11')]=router; \ No newline at end of file +var _0x8265=['create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','post'];(function(_0x2e83b5,_0x4cb7b1){var _0x27a1be=function(_0x385ec7){while(--_0x385ec7){_0x2e83b5['push'](_0x2e83b5['shift']());}};_0x27a1be(++_0x4cb7b1);}(_0x8265,0xd8));var _0x5826=function(_0x485dac,_0x3860cd){_0x485dac=_0x485dac-0x0;var _0xe637da=_0x8265[_0x485dac];return _0xe637da;};'use strict';var multer=require(_0x5826('0x0'));var util=require(_0x5826('0x1'));var path=require(_0x5826('0x2'));var timeout=require('connect-timeout');var express=require(_0x5826('0x3'));var router=express[_0x5826('0x4')]();var fs_extra=require(_0x5826('0x5'));var auth=require(_0x5826('0x6'));var interaction=require(_0x5826('0x7'));var config=require(_0x5826('0x8'));var controller=require(_0x5826('0x9'));router[_0x5826('0xa')]('/',auth[_0x5826('0xb')](),controller[_0x5826('0xc')]);router['get'](_0x5826('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x5826('0xe')]('/',auth[_0x5826('0xb')](),controller[_0x5826('0xf')]);router[_0x5826('0x10')](_0x5826('0xd'),auth['isAuthenticated'](),controller[_0x5826('0x11')]);router[_0x5826('0x12')]('/:id',auth[_0x5826('0xb')](),controller[_0x5826('0x13')]);module[_0x5826('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 303d736..d787d90 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 _0xbd4f=['BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x2011d8,_0x3e5ece){var _0x2dfc8d=function(_0x457291){while(--_0x457291){_0x2011d8['push'](_0x2011d8['shift']());}};_0x2dfc8d(++_0x3e5ece);}(_0xbd4f,0x17d));var _0xfbd4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xbd4f[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0xfbd4('0x0'));module[_0xfbd4('0x1')]={'type':{'type':Sequelize[_0xfbd4('0x2')](_0xfbd4('0x3'),_0xfbd4('0x4'),'customVariable',_0xfbd4('0x5'),_0xfbd4('0x6')),'defaultValue':_0xfbd4('0x3')},'content':{'type':Sequelize[_0xfbd4('0x7')]},'key':{'type':Sequelize[_0xfbd4('0x7')]},'keyType':{'type':Sequelize[_0xfbd4('0x2')](_0xfbd4('0x3'),'variable',_0xfbd4('0x8'))},'keyContent':{'type':Sequelize[_0xfbd4('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xfbd4('0x7')]},'customField':{'type':Sequelize[_0xfbd4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7bcd=['BOOLEAN','sequelize','exports','ENUM','string','keyValue','variable','customVariable','STRING'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7bcd,0x9a));var _0xd7bc=function(_0x31e5cb,_0x2f5adf){_0x31e5cb=_0x31e5cb-0x0;var _0x4170df=_0x7bcd[_0x31e5cb];return _0x4170df;};'use strict';var Sequelize=require(_0xd7bc('0x0'));module[_0xd7bc('0x1')]={'type':{'type':Sequelize[_0xd7bc('0x2')](_0xd7bc('0x3'),'variable','customVariable',_0xd7bc('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xd7bc('0x5'),_0xd7bc('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd7bc('0x7')]},'customField':{'type':Sequelize[_0xd7bc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd7bc('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 2bb4453..cab1a82 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 _0xf605=['findAll','rows','catch','show','params','keys','length','create','body','find','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','update','then','end','error','stack','name','send','index','VtigerField','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xf605,0x1cd));var _0x5f60=function(_0x1158d5,_0x4e7ee8){_0x1158d5=_0x1158d5-0x0;var _0x3e9d61=_0xf605[_0x1158d5];return _0x3e9d61;};'use strict';var emlformat=require(_0x5f60('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5f60('0x1'));var rp=require(_0x5f60('0x2'));var moment=require(_0x5f60('0x3'));var BPromise=require(_0x5f60('0x4'));var Mustache=require(_0x5f60('0x5'));var util=require(_0x5f60('0x6'));var path=require(_0x5f60('0x7'));var sox=require(_0x5f60('0x8'));var csv=require(_0x5f60('0x9'));var ejs=require(_0x5f60('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5f60('0xb'));var crypto=require('crypto');var jsforce=require(_0x5f60('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5f60('0xd'));var Papa=require(_0x5f60('0xe'));var Redis=require('ioredis');var authService=require(_0x5f60('0xf'));var qs=require(_0x5f60('0x10'));var as=require(_0x5f60('0x11'));var hardwareService=require(_0x5f60('0x12'));var logger=require(_0x5f60('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5f60('0x14'));var db=require(_0x5f60('0x15'))['db'];function respondWithStatusCode(_0x2da996,_0x4af0ec){_0x4af0ec=_0x4af0ec||0xcc;return function(_0x1196f9){if(_0x1196f9){return _0x2da996[_0x5f60('0x16')](_0x4af0ec);}return _0x2da996[_0x5f60('0x17')](_0x4af0ec)['end']();};}function respondWithResult(_0x118b61,_0x248096){_0x248096=_0x248096||0xc8;return function(_0x4f122e){if(_0x4f122e){return _0x118b61[_0x5f60('0x17')](_0x248096)['json'](_0x4f122e);}};}function respondWithFilteredResult(_0x442b1b,_0xcc9c2d){return function(_0x2c20c5){if(_0x2c20c5){var _0x3c7c8e=typeof _0xcc9c2d[_0x5f60('0x18')]===_0x5f60('0x19')&&typeof _0xcc9c2d[_0x5f60('0x1a')]===_0x5f60('0x19');var _0x446bdd=_0x2c20c5[_0x5f60('0x1b')];var _0x35b3ef=_0x3c7c8e?0x0:_0xcc9c2d['offset'];var _0x376fa=_0x3c7c8e?_0x2c20c5[_0x5f60('0x1b')]:_0xcc9c2d[_0x5f60('0x18')]+_0xcc9c2d[_0x5f60('0x1a')];var _0x3c314e;if(_0x376fa>=_0x446bdd){_0x376fa=_0x446bdd;_0x3c314e=0xc8;}else{_0x3c314e=0xce;}_0x442b1b['status'](_0x3c314e);return _0x442b1b[_0x5f60('0x1c')]('Content-Range',_0x35b3ef+'-'+_0x376fa+'/'+_0x446bdd)[_0x5f60('0x1d')](_0x2c20c5);}return null;};}function patchUpdates(_0x2686bf){return function(_0x2b1865){try{jsonpatch[_0x5f60('0x1e')](_0x2b1865,_0x2686bf,!![]);}catch(_0x31df40){return BPromise[_0x5f60('0x1f')](_0x31df40);}return _0x2b1865['save']();};}function saveUpdates(_0x35c117,_0x30e243){return function(_0x59d7a5){if(_0x59d7a5){return _0x59d7a5[_0x5f60('0x20')](_0x35c117)['then'](function(_0xbf58c5){return _0xbf58c5;});}return null;};}function removeEntity(_0x5e0e1a,_0x333078){return function(_0x6ec7e0){if(_0x6ec7e0){return _0x6ec7e0['destroy']()[_0x5f60('0x21')](function(){_0x5e0e1a[_0x5f60('0x17')](0xcc)[_0x5f60('0x22')]();});}};}function handleEntityNotFound(_0x402078,_0x1dbed8){return function(_0x5b28a0){if(!_0x5b28a0){_0x402078[_0x5f60('0x16')](0x194);}return _0x5b28a0;};}function handleError(_0x589cd9,_0x1c943c){_0x1c943c=_0x1c943c||0x1f4;return function(_0x21fe16){logger[_0x5f60('0x23')](_0x21fe16[_0x5f60('0x24')]);if(_0x21fe16[_0x5f60('0x25')]){delete _0x21fe16[_0x5f60('0x25')];}_0x589cd9['status'](_0x1c943c)[_0x5f60('0x26')](_0x21fe16);};}exports[_0x5f60('0x27')]=function(_0x206afe,_0xc4eaf6){var _0x449c45={},_0x1a92d8={},_0x27e439={'count':0x0,'rows':[]};var _0x33fe77=_['map'](db[_0x5f60('0x28')][_0x5f60('0x29')],function(_0x583878){return{'name':_0x583878[_0x5f60('0x2a')],'type':_0x583878[_0x5f60('0x2b')][_0x5f60('0x2c')]};});_0x1a92d8[_0x5f60('0x2d')]=_[_0x5f60('0x2e')](_0x33fe77,_0x5f60('0x25'));_0x1a92d8[_0x5f60('0x2f')]=_['keys'](_0x206afe[_0x5f60('0x2f')]);_0x1a92d8[_0x5f60('0x30')]=_[_0x5f60('0x31')](_0x1a92d8[_0x5f60('0x2d')],_0x1a92d8[_0x5f60('0x2f')]);_0x449c45[_0x5f60('0x32')]=_[_0x5f60('0x31')](_0x1a92d8[_0x5f60('0x2d')],qs['fields'](_0x206afe[_0x5f60('0x2f')][_0x5f60('0x33')]));_0x449c45[_0x5f60('0x32')]=_0x449c45[_0x5f60('0x32')]['length']?_0x449c45[_0x5f60('0x32')]:_0x1a92d8[_0x5f60('0x2d')];if(!_0x206afe[_0x5f60('0x2f')][_0x5f60('0x34')](_0x5f60('0x35'))){_0x449c45['limit']=qs[_0x5f60('0x1a')](_0x206afe[_0x5f60('0x2f')]['limit']);_0x449c45['offset']=qs[_0x5f60('0x18')](_0x206afe[_0x5f60('0x2f')][_0x5f60('0x18')]);}_0x449c45[_0x5f60('0x36')]=qs[_0x5f60('0x37')](_0x206afe[_0x5f60('0x2f')][_0x5f60('0x37')]);_0x449c45[_0x5f60('0x38')]=qs[_0x5f60('0x30')](_[_0x5f60('0x39')](_0x206afe['query'],_0x1a92d8['filters']),_0x33fe77);if(_0x206afe[_0x5f60('0x2f')][_0x5f60('0x3a')]){_0x449c45[_0x5f60('0x38')]=_['merge'](_0x449c45[_0x5f60('0x38')],{'$or':_['map'](_0x33fe77,function(_0x3dccba){if(_0x3dccba[_0x5f60('0x2b')]!==_0x5f60('0x3b')){var _0x8e298b={};_0x8e298b[_0x3dccba[_0x5f60('0x25')]]={'$like':'%'+_0x206afe[_0x5f60('0x2f')][_0x5f60('0x3a')]+'%'};return _0x8e298b;}})});}_0x449c45=_[_0x5f60('0x3c')]({},_0x449c45,_0x206afe[_0x5f60('0x3d')]);var _0x4f3ea4={'where':_0x449c45[_0x5f60('0x38')]};return db[_0x5f60('0x28')]['count'](_0x4f3ea4)['then'](function(_0x3973b9){_0x27e439[_0x5f60('0x1b')]=_0x3973b9;if(_0x206afe[_0x5f60('0x2f')][_0x5f60('0x3e')]){_0x449c45[_0x5f60('0x3f')]=[{'all':!![]}];}return db[_0x5f60('0x28')][_0x5f60('0x40')](_0x449c45);})[_0x5f60('0x21')](function(_0x283a21){_0x27e439[_0x5f60('0x41')]=_0x283a21;return _0x27e439;})[_0x5f60('0x21')](respondWithFilteredResult(_0xc4eaf6,_0x449c45))[_0x5f60('0x42')](handleError(_0xc4eaf6,null));};exports[_0x5f60('0x43')]=function(_0x245957,_0xd06cf2){var _0x85d992={'raw':!![],'where':{'id':_0x245957[_0x5f60('0x44')]['id']}},_0x2839e1={};_0x2839e1[_0x5f60('0x2d')]=_['keys'](db[_0x5f60('0x28')][_0x5f60('0x29')]);_0x2839e1[_0x5f60('0x2f')]=_[_0x5f60('0x45')](_0x245957[_0x5f60('0x2f')]);_0x2839e1[_0x5f60('0x30')]=_[_0x5f60('0x31')](_0x2839e1[_0x5f60('0x2d')],_0x2839e1[_0x5f60('0x2f')]);_0x85d992[_0x5f60('0x32')]=_['intersection'](_0x2839e1['model'],qs[_0x5f60('0x33')](_0x245957[_0x5f60('0x2f')][_0x5f60('0x33')]));_0x85d992[_0x5f60('0x32')]=_0x85d992['attributes'][_0x5f60('0x46')]?_0x85d992['attributes']:_0x2839e1[_0x5f60('0x2d')];if(_0x245957[_0x5f60('0x2f')]['includeAll']){_0x85d992[_0x5f60('0x3f')]=[{'all':!![]}];}_0x85d992=_['merge']({},_0x85d992,_0x245957[_0x5f60('0x3d')]);return db['VtigerField']['find'](_0x85d992)[_0x5f60('0x21')](handleEntityNotFound(_0xd06cf2,null))[_0x5f60('0x21')](respondWithResult(_0xd06cf2,null))['catch'](handleError(_0xd06cf2,null));};exports['create']=function(_0x567e3f,_0x1ff915){return db[_0x5f60('0x28')][_0x5f60('0x47')](_0x567e3f[_0x5f60('0x48')],{})[_0x5f60('0x21')](respondWithResult(_0x1ff915,0xc9))[_0x5f60('0x42')](handleError(_0x1ff915,null));};exports[_0x5f60('0x20')]=function(_0x5b56c6,_0x3e5222){if(_0x5b56c6['body']['id']){delete _0x5b56c6[_0x5f60('0x48')]['id'];}return db[_0x5f60('0x28')][_0x5f60('0x49')]({'where':{'id':_0x5b56c6[_0x5f60('0x44')]['id']}})[_0x5f60('0x21')](handleEntityNotFound(_0x3e5222,null))['then'](saveUpdates(_0x5b56c6[_0x5f60('0x48')],null))[_0x5f60('0x21')](respondWithResult(_0x3e5222,null))['catch'](handleError(_0x3e5222,null));};exports[_0x5f60('0x4a')]=function(_0x21e059,_0x4c00a4){return db[_0x5f60('0x28')][_0x5f60('0x49')]({'where':{'id':_0x21e059[_0x5f60('0x44')]['id']}})['then'](handleEntityNotFound(_0x4c00a4,null))[_0x5f60('0x21')](removeEntity(_0x4c00a4,null))['catch'](handleError(_0x4c00a4,null));}; \ No newline at end of file +var _0xb090=['keys','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','update','destroy','then','name','send','index','map','VtigerField','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','type','merge','options','include','findAll','catch','show','params'];(function(_0x530ddb,_0x3008f8){var _0x4fa295=function(_0x552364){while(--_0x552364){_0x530ddb['push'](_0x530ddb['shift']());}};_0x4fa295(++_0x3008f8);}(_0xb090,0xdc));var _0x0b09=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0xb090[_0x1ed116];return _0x574066;};'use strict';var emlformat=require(_0x0b09('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0b09('0x1'));var jsonpatch=require(_0x0b09('0x2'));var rp=require('request-promise');var moment=require(_0x0b09('0x3'));var BPromise=require(_0x0b09('0x4'));var Mustache=require(_0x0b09('0x5'));var util=require(_0x0b09('0x6'));var path=require('path');var sox=require(_0x0b09('0x7'));var csv=require('to-csv');var ejs=require(_0x0b09('0x8'));var fs=require('fs');var fs_extra=require(_0x0b09('0x9'));var _=require(_0x0b09('0xa'));var squel=require(_0x0b09('0xb'));var crypto=require(_0x0b09('0xc'));var jsforce=require(_0x0b09('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0b09('0xe'));var querystring=require(_0x0b09('0xf'));var Papa=require(_0x0b09('0x10'));var Redis=require(_0x0b09('0x11'));var authService=require(_0x0b09('0x12'));var qs=require(_0x0b09('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b09('0x14'));var logger=require(_0x0b09('0x15'))(_0x0b09('0x16'));var utils=require(_0x0b09('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0b09('0x18'))['db'];function respondWithStatusCode(_0x37ba5d,_0x33d74d){_0x33d74d=_0x33d74d||0xcc;return function(_0x5acc94){if(_0x5acc94){return _0x37ba5d[_0x0b09('0x19')](_0x33d74d);}return _0x37ba5d[_0x0b09('0x1a')](_0x33d74d)[_0x0b09('0x1b')]();};}function respondWithResult(_0x43853f,_0x18d175){_0x18d175=_0x18d175||0xc8;return function(_0x3d5e1f){if(_0x3d5e1f){return _0x43853f[_0x0b09('0x1a')](_0x18d175)[_0x0b09('0x1c')](_0x3d5e1f);}};}function respondWithFilteredResult(_0x41241f,_0x5de968){return function(_0x3e5f54){if(_0x3e5f54){var _0x1d4f97=typeof _0x5de968['offset']===_0x0b09('0x1d')&&typeof _0x5de968['limit']===_0x0b09('0x1d');var _0x40771e=_0x3e5f54[_0x0b09('0x1e')];var _0x7dce49=_0x1d4f97?0x0:_0x5de968[_0x0b09('0x1f')];var _0x619a7c=_0x1d4f97?_0x3e5f54[_0x0b09('0x1e')]:_0x5de968[_0x0b09('0x1f')]+_0x5de968[_0x0b09('0x20')];var _0x45d776;if(_0x619a7c>=_0x40771e){_0x619a7c=_0x40771e;_0x45d776=0xc8;}else{_0x45d776=0xce;}_0x41241f[_0x0b09('0x1a')](_0x45d776);return _0x41241f[_0x0b09('0x21')]('Content-Range',_0x7dce49+'-'+_0x619a7c+'/'+_0x40771e)[_0x0b09('0x1c')](_0x3e5f54);}return null;};}function patchUpdates(_0x43c4af){return function(_0x49fd31){try{jsonpatch[_0x0b09('0x22')](_0x49fd31,_0x43c4af,!![]);}catch(_0x228af5){return BPromise[_0x0b09('0x23')](_0x228af5);}return _0x49fd31[_0x0b09('0x24')]();};}function saveUpdates(_0x9b9d56,_0x154131){return function(_0x47f2e3){if(_0x47f2e3){return _0x47f2e3[_0x0b09('0x25')](_0x9b9d56)['then'](function(_0x3572aa){return _0x3572aa;});}return null;};}function removeEntity(_0x321494,_0x550b3b){return function(_0x1b962f){if(_0x1b962f){return _0x1b962f[_0x0b09('0x26')]()[_0x0b09('0x27')](function(){_0x321494[_0x0b09('0x1a')](0xcc)[_0x0b09('0x1b')]();});}};}function handleEntityNotFound(_0x43d5da,_0x4f2b99){return function(_0x17bc8e){if(!_0x17bc8e){_0x43d5da['sendStatus'](0x194);}return _0x17bc8e;};}function handleError(_0x3e74ee,_0x4ede22){_0x4ede22=_0x4ede22||0x1f4;return function(_0x35b113){logger['error'](_0x35b113['stack']);if(_0x35b113[_0x0b09('0x28')]){delete _0x35b113[_0x0b09('0x28')];}_0x3e74ee['status'](_0x4ede22)[_0x0b09('0x29')](_0x35b113);};}exports[_0x0b09('0x2a')]=function(_0x339997,_0x29e27){var _0x182a5c={},_0x1a012b={},_0xb8fda6={'count':0x0,'rows':[]};var _0xf14779=_[_0x0b09('0x2b')](db[_0x0b09('0x2c')][_0x0b09('0x2d')],function(_0x401f09){return{'name':_0x401f09[_0x0b09('0x2e')],'type':_0x401f09['type'][_0x0b09('0x2f')]};});_0x1a012b[_0x0b09('0x30')]=_[_0x0b09('0x2b')](_0xf14779,'name');_0x1a012b[_0x0b09('0x31')]=_['keys'](_0x339997[_0x0b09('0x31')]);_0x1a012b[_0x0b09('0x32')]=_[_0x0b09('0x33')](_0x1a012b['model'],_0x1a012b[_0x0b09('0x31')]);_0x182a5c[_0x0b09('0x34')]=_[_0x0b09('0x33')](_0x1a012b[_0x0b09('0x30')],qs['fields'](_0x339997[_0x0b09('0x31')][_0x0b09('0x35')]));_0x182a5c[_0x0b09('0x34')]=_0x182a5c[_0x0b09('0x34')][_0x0b09('0x36')]?_0x182a5c[_0x0b09('0x34')]:_0x1a012b[_0x0b09('0x30')];if(!_0x339997[_0x0b09('0x31')]['hasOwnProperty'](_0x0b09('0x37'))){_0x182a5c[_0x0b09('0x20')]=qs[_0x0b09('0x20')](_0x339997[_0x0b09('0x31')]['limit']);_0x182a5c[_0x0b09('0x1f')]=qs[_0x0b09('0x1f')](_0x339997[_0x0b09('0x31')][_0x0b09('0x1f')]);}_0x182a5c[_0x0b09('0x38')]=qs[_0x0b09('0x39')](_0x339997[_0x0b09('0x31')][_0x0b09('0x39')]);_0x182a5c['where']=qs[_0x0b09('0x32')](_[_0x0b09('0x3a')](_0x339997['query'],_0x1a012b[_0x0b09('0x32')]),_0xf14779);if(_0x339997['query']['filter']){_0x182a5c[_0x0b09('0x3b')]=_['merge'](_0x182a5c['where'],{'$or':_['map'](_0xf14779,function(_0x209152){if(_0x209152[_0x0b09('0x3c')]!=='VIRTUAL'){var _0x295102={};_0x295102[_0x209152[_0x0b09('0x28')]]={'$like':'%'+_0x339997[_0x0b09('0x31')]['filter']+'%'};return _0x295102;}})});}_0x182a5c=_[_0x0b09('0x3d')]({},_0x182a5c,_0x339997[_0x0b09('0x3e')]);var _0x370d4a={'where':_0x182a5c[_0x0b09('0x3b')]};return db[_0x0b09('0x2c')]['count'](_0x370d4a)['then'](function(_0x2aeb57){_0xb8fda6[_0x0b09('0x1e')]=_0x2aeb57;if(_0x339997[_0x0b09('0x31')]['includeAll']){_0x182a5c[_0x0b09('0x3f')]=[{'all':!![]}];}return db[_0x0b09('0x2c')][_0x0b09('0x40')](_0x182a5c);})[_0x0b09('0x27')](function(_0x208326){_0xb8fda6['rows']=_0x208326;return _0xb8fda6;})[_0x0b09('0x27')](respondWithFilteredResult(_0x29e27,_0x182a5c))[_0x0b09('0x41')](handleError(_0x29e27,null));};exports[_0x0b09('0x42')]=function(_0x35cd8a,_0x21f1f7){var _0x5afc73={'raw':!![],'where':{'id':_0x35cd8a[_0x0b09('0x43')]['id']}},_0x5c9735={};_0x5c9735['model']=_['keys'](db[_0x0b09('0x2c')][_0x0b09('0x2d')]);_0x5c9735[_0x0b09('0x31')]=_[_0x0b09('0x44')](_0x35cd8a[_0x0b09('0x31')]);_0x5c9735[_0x0b09('0x32')]=_['intersection'](_0x5c9735[_0x0b09('0x30')],_0x5c9735['query']);_0x5afc73['attributes']=_[_0x0b09('0x33')](_0x5c9735['model'],qs[_0x0b09('0x35')](_0x35cd8a['query']['fields']));_0x5afc73[_0x0b09('0x34')]=_0x5afc73['attributes'][_0x0b09('0x36')]?_0x5afc73[_0x0b09('0x34')]:_0x5c9735[_0x0b09('0x30')];if(_0x35cd8a['query']['includeAll']){_0x5afc73[_0x0b09('0x3f')]=[{'all':!![]}];}_0x5afc73=_[_0x0b09('0x3d')]({},_0x5afc73,_0x35cd8a[_0x0b09('0x3e')]);return db['VtigerField'][_0x0b09('0x45')](_0x5afc73)[_0x0b09('0x27')](handleEntityNotFound(_0x21f1f7,null))['then'](respondWithResult(_0x21f1f7,null))[_0x0b09('0x41')](handleError(_0x21f1f7,null));};exports[_0x0b09('0x46')]=function(_0x31722f,_0x2f3bce){return db['VtigerField']['create'](_0x31722f['body'],{})[_0x0b09('0x27')](respondWithResult(_0x2f3bce,0xc9))[_0x0b09('0x41')](handleError(_0x2f3bce,null));};exports[_0x0b09('0x25')]=function(_0x321c61,_0x2e0a6e){if(_0x321c61[_0x0b09('0x47')]['id']){delete _0x321c61[_0x0b09('0x47')]['id'];}return db[_0x0b09('0x2c')][_0x0b09('0x45')]({'where':{'id':_0x321c61[_0x0b09('0x43')]['id']}})[_0x0b09('0x27')](handleEntityNotFound(_0x2e0a6e,null))[_0x0b09('0x27')](saveUpdates(_0x321c61['body'],null))[_0x0b09('0x27')](respondWithResult(_0x2e0a6e,null))[_0x0b09('0x41')](handleError(_0x2e0a6e,null));};exports['destroy']=function(_0x1626cc,_0xdfdaee){return db[_0x0b09('0x2c')][_0x0b09('0x45')]({'where':{'id':_0x1626cc[_0x0b09('0x43')]['id']}})[_0x0b09('0x27')](handleEntityNotFound(_0xdfdaee,null))[_0x0b09('0x27')](removeEntity(_0xdfdaee,null))['catch'](handleError(_0xdfdaee,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index ae2ae42..a636204 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 _0x4d88=['bluebird','request-promise','./intVtigerField.attributes','exports','int_vtiger_fields','idField','FieldId','util','../../config/logger','api','moment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4d88,0x80));var _0x84d8=function(_0x1e83ba,_0x1e483e){_0x1e83ba=_0x1e83ba-0x0;var _0x5607f2=_0x4d88[_0x1e83ba];return _0x5607f2;};'use strict';var _=require('lodash');var util=require(_0x84d8('0x0'));var logger=require(_0x84d8('0x1'))(_0x84d8('0x2'));var moment=require(_0x84d8('0x3'));var BPromise=require(_0x84d8('0x4'));var rp=require(_0x84d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x84d8('0x6'));module[_0x84d8('0x7')]=function(_0x13c378,_0x114e7d){return _0x13c378['define']('VtigerField',attributes,{'tableName':_0x84d8('0x8'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x84d8('0x9'),_0x84d8('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5133=['path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x168ad0,_0x45e98b){var _0x3596fc=function(_0x388510){while(--_0x388510){_0x168ad0['push'](_0x168ad0['shift']());}};_0x3596fc(++_0x45e98b);}(_0x5133,0x72));var _0x3513=function(_0x2f80ba,_0x353fb1){_0x2f80ba=_0x2f80ba-0x0;var _0x31f76c=_0x5133[_0x2f80ba];return _0x31f76c;};'use strict';var _=require('lodash');var util=require(_0x3513('0x0'));var logger=require(_0x3513('0x1'))(_0x3513('0x2'));var moment=require(_0x3513('0x3'));var BPromise=require(_0x3513('0x4'));var rp=require(_0x3513('0x5'));var fs=require('fs');var path=require(_0x3513('0x6'));var rimraf=require(_0x3513('0x7'));var config=require(_0x3513('0x8'));var attributes=require(_0x3513('0x9'));module[_0x3513('0xa')]=function(_0x515d8a,_0x33f181){return _0x515d8a['define'](_0x3513('0xb'),attributes,{'tableName':_0x3513('0xc'),'paranoid':![],'indexes':[{'name':_0x3513('0xd'),'fields':[_0x3513('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 1325ece..89251ca 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 _0x2a4f=['message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerField,\x20%s,\x20%s'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x2a4f,0xf3));var _0xf2a4=function(_0x1f5834,_0x421950){_0x1f5834=_0x1f5834-0x0;var _0x418e31=_0x2a4f[_0x1f5834];return _0x418e31;};'use strict';var _=require(_0xf2a4('0x0'));var util=require(_0xf2a4('0x1'));var moment=require(_0xf2a4('0x2'));var BPromise=require(_0xf2a4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2a4('0x4'));var db=require(_0xf2a4('0x5'))['db'];var utils=require(_0xf2a4('0x6'));var logger=require(_0xf2a4('0x7'))(_0xf2a4('0x8'));var config=require(_0xf2a4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf2a4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d1d9c,_0x388f60,_0x1f74c0){return new BPromise(function(_0x2b11cc,_0x368e40){return client[_0xf2a4('0xb')](_0x4d1d9c,_0x1f74c0)[_0xf2a4('0xc')](function(_0x57e2fc){logger[_0xf2a4('0xd')]('VtigerField,\x20%s,\x20%s',_0x388f60,'request\x20sent');logger[_0xf2a4('0xe')](_0xf2a4('0xf'),_0x388f60,_0xf2a4('0x10'),JSON[_0xf2a4('0x11')](_0x57e2fc));if(_0x57e2fc[_0xf2a4('0x12')]){if(_0x57e2fc['error'][_0xf2a4('0x13')]===0x1f4){logger['error'](_0xf2a4('0x14'),_0x388f60,_0x57e2fc[_0xf2a4('0x12')][_0xf2a4('0x15')]);return _0x368e40(_0x57e2fc[_0xf2a4('0x12')][_0xf2a4('0x15')]);}logger[_0xf2a4('0x12')](_0xf2a4('0x14'),_0x388f60,_0x57e2fc[_0xf2a4('0x12')][_0xf2a4('0x15')]);return _0x2b11cc(_0x57e2fc[_0xf2a4('0x12')][_0xf2a4('0x15')]);}else{logger['info'](_0xf2a4('0x14'),_0x388f60,'request\x20sent');_0x2b11cc(_0x57e2fc['result'][_0xf2a4('0x15')]);}})['catch'](function(_0x14485e){logger['error'](_0xf2a4('0x14'),_0x388f60,_0x14485e);_0x368e40(_0x14485e);});});} \ No newline at end of file +var _0x15b7=['http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x15b7,0x161));var _0x715b=function(_0x4b25f5,_0x2cf63c){_0x4b25f5=_0x4b25f5-0x0;var _0x461858=_0x15b7[_0x4b25f5];return _0x461858;};'use strict';var _=require('lodash');var util=require(_0x715b('0x0'));var moment=require('moment');var BPromise=require(_0x715b('0x1'));var rs=require(_0x715b('0x2'));var fs=require('fs');var Redis=require(_0x715b('0x3'));var db=require(_0x715b('0x4'))['db'];var utils=require(_0x715b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x715b('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x715b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3a6aab,_0x17ffeb,_0x4877c4){return new BPromise(function(_0x4e4ca2,_0x2cce5c){return client[_0x715b('0x8')](_0x3a6aab,_0x4877c4)[_0x715b('0x9')](function(_0x1f508a){logger[_0x715b('0xa')](_0x715b('0xb'),_0x17ffeb,_0x715b('0xc'));logger[_0x715b('0xd')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x17ffeb,_0x715b('0xc'),JSON[_0x715b('0xe')](_0x1f508a));if(_0x1f508a[_0x715b('0xf')]){if(_0x1f508a['error'][_0x715b('0x10')]===0x1f4){logger[_0x715b('0xf')](_0x715b('0xb'),_0x17ffeb,_0x1f508a[_0x715b('0xf')][_0x715b('0x11')]);return _0x2cce5c(_0x1f508a['error']['message']);}logger[_0x715b('0xf')](_0x715b('0xb'),_0x17ffeb,_0x1f508a['error'][_0x715b('0x11')]);return _0x4e4ca2(_0x1f508a[_0x715b('0xf')][_0x715b('0x11')]);}else{logger[_0x715b('0xa')](_0x715b('0xb'),_0x17ffeb,_0x715b('0xc'));_0x4e4ca2(_0x1f508a['result']['message']);}})['catch'](function(_0x331e79){logger[_0x715b('0xf')](_0x715b('0xb'),_0x17ffeb,_0x331e79);_0x2cce5c(_0x331e79);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 549b58d..637d836 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 _0x82e7=['delete','destroy','exports','multer','path','connect-timeout','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update'];(function(_0xc87a46,_0x310eec){var _0x49632d=function(_0x44a3b1){while(--_0x44a3b1){_0xc87a46['push'](_0xc87a46['shift']());}};_0x49632d(++_0x310eec);}(_0x82e7,0x1e3));var _0x782e=function(_0xb7b269,_0xf52b7c){_0xb7b269=_0xb7b269-0x0;var _0x50e687=_0x82e7[_0xb7b269];return _0x50e687;};'use strict';var multer=require(_0x782e('0x0'));var util=require('util');var path=require(_0x782e('0x1'));var timeout=require(_0x782e('0x2'));var express=require('express');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(_0x782e('0x3'));var controller=require(_0x782e('0x4'));router[_0x782e('0x5')]('/',auth[_0x782e('0x6')](),controller[_0x782e('0x7')]);router[_0x782e('0x5')](_0x782e('0x8'),auth[_0x782e('0x6')](),controller[_0x782e('0x9')]);router[_0x782e('0x5')](_0x782e('0xa'),auth[_0x782e('0x6')](),controller[_0x782e('0xb')]);router['get'](_0x782e('0xc'),auth[_0x782e('0x6')](),controller['getFields']);router[_0x782e('0xd')]('/',auth[_0x782e('0x6')](),controller['create']);router[_0x782e('0xd')](_0x782e('0xa'),auth[_0x782e('0x6')](),controller[_0x782e('0xe')]);router[_0x782e('0xf')](_0x782e('0x8'),auth[_0x782e('0x6')](),controller[_0x782e('0x10')]);router[_0x782e('0x11')](_0x782e('0x8'),auth[_0x782e('0x6')](),controller[_0x782e('0x12')]);module[_0x782e('0x13')]=router; \ No newline at end of file +var _0x7ab2=['/:id/configurations','getConfigurations','/:id/fields','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x309dfe,_0x205837){var _0x381ec2=function(_0x284cee){while(--_0x284cee){_0x309dfe['push'](_0x309dfe['shift']());}};_0x381ec2(++_0x205837);}(_0x7ab2,0x72));var _0x27ab=function(_0x466292,_0x34bcc9){_0x466292=_0x466292-0x0;var _0x917dbc=_0x7ab2[_0x466292];return _0x917dbc;};'use strict';var multer=require(_0x27ab('0x0'));var util=require(_0x27ab('0x1'));var path=require(_0x27ab('0x2'));var timeout=require(_0x27ab('0x3'));var express=require('express');var router=express[_0x27ab('0x4')]();var fs_extra=require(_0x27ab('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x27ab('0x6'));var config=require(_0x27ab('0x7'));var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0x27ab('0x8')](),controller[_0x27ab('0x9')]);router[_0x27ab('0xa')](_0x27ab('0xb'),auth[_0x27ab('0x8')](),controller['show']);router['get'](_0x27ab('0xc'),auth[_0x27ab('0x8')](),controller[_0x27ab('0xd')]);router[_0x27ab('0xa')](_0x27ab('0xe'),auth[_0x27ab('0x8')](),controller['getFields']);router['post']('/',auth[_0x27ab('0x8')](),controller['create']);router['post'](_0x27ab('0xc'),auth[_0x27ab('0x8')](),controller[_0x27ab('0xf')]);router[_0x27ab('0x10')](_0x27ab('0xb'),auth['isAuthenticated'](),controller[_0x27ab('0x11')]);router[_0x27ab('0x12')](_0x27ab('0xb'),auth['isAuthenticated'](),controller[_0x27ab('0x13')]);module[_0x27ab('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 1f0d439..00b405a 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 _0x2484=['STRING','username','remoteUri','password','token','ENUM','integrationTab','sequelize','exports'];(function(_0x46e515,_0x390228){var _0x3753f0=function(_0x182426){while(--_0x182426){_0x46e515['push'](_0x46e515['shift']());}};_0x3753f0(++_0x390228);}(_0x2484,0x178));var _0x4248=function(_0x4c41c4,_0x75bc8a){_0x4c41c4=_0x4c41c4-0x0;var _0x2bdc48=_0x2484[_0x4c41c4];return _0x2bdc48;};'use strict';var Sequelize=require(_0x4248('0x0'));module[_0x4248('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4248('0x2')]},'username':{'type':Sequelize[_0x4248('0x2')],'unique':_0x4248('0x3')},'password':{'type':Sequelize[_0x4248('0x2')]},'token':{'type':Sequelize[_0x4248('0x2')]},'remoteUri':{'type':Sequelize[_0x4248('0x2')],'unique':_0x4248('0x4')},'authType':{'type':Sequelize['ENUM'](_0x4248('0x5'),_0x4248('0x6')),'defaultValue':_0x4248('0x5')},'serverUrl':{'type':Sequelize[_0x4248('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4248('0x7')](_0x4248('0x8'),'newTab'),'defaultValue':_0x4248('0x8')}}; \ No newline at end of file +var _0x49fe=['remoteUri','ENUM','password','token','integrationTab','sequelize','STRING','username'];(function(_0x34eb2a,_0x2dde38){var _0x3e96b8=function(_0x34e2d8){while(--_0x34e2d8){_0x34eb2a['push'](_0x34eb2a['shift']());}};_0x3e96b8(++_0x2dde38);}(_0x49fe,0x75));var _0xe49f=function(_0x2829f6,_0x329415){_0x2829f6=_0x2829f6-0x0;var _0x10d924=_0x49fe[_0x2829f6];return _0x10d924;};'use strict';var Sequelize=require(_0xe49f('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe49f('0x1')],'unique':_0xe49f('0x2')},'password':{'type':Sequelize[_0xe49f('0x1')]},'token':{'type':Sequelize[_0xe49f('0x1')]},'remoteUri':{'type':Sequelize[_0xe49f('0x1')],'unique':_0xe49f('0x3')},'authType':{'type':Sequelize[_0xe49f('0x4')](_0xe49f('0x5'),_0xe49f('0x6')),'defaultValue':_0xe49f('0x5')},'serverUrl':{'type':Sequelize[_0xe49f('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe49f('0x4')](_0xe49f('0x7'),'newTab'),'defaultValue':_0xe49f('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index b841628..cf62a79 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 _0x5ec6=['Sequelize','ValidationError','Unknown\x20authentication\x20type','description','remove','includes','title','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','body','findOne','ZendeskConfiguration','length','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','Basic\x20%s','%s:%s','toString','base64','headers'];(function(_0x4e23a9,_0x2fa6f2){var _0x1080ee=function(_0x5492ea){while(--_0x5492ea){_0x4e23a9['push'](_0x4e23a9['shift']());}};_0x1080ee(++_0x2fa6f2);}(_0x5ec6,0x7f));var _0x65ec=function(_0x25848d,_0x5c2cf0){_0x25848d=_0x25848d-0x0;var _0x37618c=_0x5ec6[_0x25848d];return _0x37618c;};'use strict';var emlformat=require(_0x65ec('0x0'));var rimraf=require(_0x65ec('0x1'));var zipdir=require(_0x65ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x65ec('0x3'));var moment=require('moment');var BPromise=require(_0x65ec('0x4'));var Mustache=require('mustache');var util=require(_0x65ec('0x5'));var path=require('path');var sox=require(_0x65ec('0x6'));var csv=require('to-csv');var ejs=require(_0x65ec('0x7'));var fs=require('fs');var fs_extra=require(_0x65ec('0x8'));var _=require('lodash');var squel=require(_0x65ec('0x9'));var crypto=require(_0x65ec('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x65ec('0xb'));var toCsv=require(_0x65ec('0xc'));var querystring=require(_0x65ec('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65ec('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x65ec('0xf'));var hardwareService=require(_0x65ec('0x10'));var logger=require('../../config/logger')(_0x65ec('0x11'));var utils=require(_0x65ec('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x65ec('0x13'));var db=require(_0x65ec('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3e52c8,_0x2af7d6){_0x2af7d6=_0x2af7d6||0xcc;return function(_0x411a7b){if(_0x411a7b){return _0x3e52c8[_0x65ec('0x15')](_0x2af7d6);}return _0x3e52c8[_0x65ec('0x16')](_0x2af7d6)[_0x65ec('0x17')]();};}function respondWithResult(_0x344724,_0x3edbfd){_0x3edbfd=_0x3edbfd||0xc8;return function(_0x58c81f){if(_0x58c81f){return _0x344724[_0x65ec('0x16')](_0x3edbfd)[_0x65ec('0x18')](_0x58c81f);}};}function respondWithFilteredResult(_0x35d06b,_0x4bbe88){return function(_0x5a0442){if(_0x5a0442){var _0x25cdd4=typeof _0x4bbe88[_0x65ec('0x19')]===_0x65ec('0x1a')&&typeof _0x4bbe88['limit']===_0x65ec('0x1a');var _0x286eac=_0x5a0442[_0x65ec('0x1b')];var _0xb4ed90=_0x25cdd4?0x0:_0x4bbe88[_0x65ec('0x19')];var _0xd81ed3=_0x25cdd4?_0x5a0442[_0x65ec('0x1b')]:_0x4bbe88[_0x65ec('0x19')]+_0x4bbe88[_0x65ec('0x1c')];var _0x441ad0;if(_0xd81ed3>=_0x286eac){_0xd81ed3=_0x286eac;_0x441ad0=0xc8;}else{_0x441ad0=0xce;}_0x35d06b[_0x65ec('0x16')](_0x441ad0);return _0x35d06b[_0x65ec('0x1d')](_0x65ec('0x1e'),_0xb4ed90+'-'+_0xd81ed3+'/'+_0x286eac)[_0x65ec('0x18')](_0x5a0442);}return null;};}function patchUpdates(_0x3804a4){return function(_0x1d538c){try{jsonpatch[_0x65ec('0x1f')](_0x1d538c,_0x3804a4,!![]);}catch(_0x130d4e){return BPromise[_0x65ec('0x20')](_0x130d4e);}return _0x1d538c['save']();};}function saveUpdates(_0x170703,_0x297fba){return function(_0x89e640){if(_0x89e640){return _0x89e640[_0x65ec('0x21')](_0x170703)[_0x65ec('0x22')](function(_0x163e55){return _0x163e55;});}return null;};}function removeEntity(_0x47288d,_0x58239f){return function(_0xf1ff97){if(_0xf1ff97){return _0xf1ff97[_0x65ec('0x23')]()[_0x65ec('0x22')](function(){_0x47288d[_0x65ec('0x16')](0xcc)[_0x65ec('0x17')]();});}};}function handleEntityNotFound(_0x156793,_0x21426b){return function(_0xf5adc7){if(!_0xf5adc7){_0x156793[_0x65ec('0x15')](0x194);}return _0xf5adc7;};}function handleError(_0x4c846b,_0x10baef){_0x10baef=_0x10baef||0x1f4;return function(_0x30f0cf){logger[_0x65ec('0x24')](_0x30f0cf[_0x65ec('0x25')]);if(_0x30f0cf['name']){delete _0x30f0cf[_0x65ec('0x26')];}_0x4c846b['status'](_0x10baef)[_0x65ec('0x27')](_0x30f0cf);};}exports[_0x65ec('0x28')]=function(_0x1d0b5c,_0x30366c){var _0x14431d={},_0x46d4c1={},_0x46bf66={'count':0x0,'rows':[]};var _0x39410f=_[_0x65ec('0x29')](db[_0x65ec('0x2a')][_0x65ec('0x2b')],function(_0x4b435c){return{'name':_0x4b435c['fieldName'],'type':_0x4b435c[_0x65ec('0x2c')]['key']};});_0x46d4c1[_0x65ec('0x2d')]=_[_0x65ec('0x29')](_0x39410f,'name');_0x46d4c1[_0x65ec('0x2e')]=_[_0x65ec('0x2f')](_0x1d0b5c[_0x65ec('0x2e')]);_0x46d4c1[_0x65ec('0x30')]=_['intersection'](_0x46d4c1[_0x65ec('0x2d')],_0x46d4c1[_0x65ec('0x2e')]);_0x14431d[_0x65ec('0x31')]=_[_0x65ec('0x32')](_0x46d4c1[_0x65ec('0x2d')],qs[_0x65ec('0x33')](_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x33')]));_0x14431d[_0x65ec('0x31')]=_0x14431d[_0x65ec('0x31')]['length']?_0x14431d[_0x65ec('0x31')]:_0x46d4c1[_0x65ec('0x2d')];if(!_0x1d0b5c['query'][_0x65ec('0x34')](_0x65ec('0x35'))){_0x14431d[_0x65ec('0x1c')]=qs[_0x65ec('0x1c')](_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x1c')]);_0x14431d[_0x65ec('0x19')]=qs['offset'](_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x19')]);}_0x14431d[_0x65ec('0x36')]=qs[_0x65ec('0x37')](_0x1d0b5c['query'][_0x65ec('0x37')]);_0x14431d[_0x65ec('0x38')]=qs[_0x65ec('0x30')](_[_0x65ec('0x39')](_0x1d0b5c['query'],_0x46d4c1['filters']),_0x39410f);if(_0x1d0b5c[_0x65ec('0x2e')]['filter']){_0x14431d[_0x65ec('0x38')]=_[_0x65ec('0x3a')](_0x14431d['where'],{'$or':_[_0x65ec('0x29')](_0x39410f,function(_0x1fbc2b){if(_0x1fbc2b[_0x65ec('0x2c')]!==_0x65ec('0x3b')){var _0x3cffbf={};_0x3cffbf[_0x1fbc2b[_0x65ec('0x26')]]={'$like':'%'+_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x3c')]+'%'};return _0x3cffbf;}})});}_0x14431d=_[_0x65ec('0x3a')]({},_0x14431d,_0x1d0b5c[_0x65ec('0x3d')]);var _0x3561ef={'where':_0x14431d['where']};return db[_0x65ec('0x2a')]['count'](_0x3561ef)[_0x65ec('0x22')](function(_0x278d43){_0x46bf66[_0x65ec('0x1b')]=_0x278d43;if(_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x3e')]){_0x14431d[_0x65ec('0x3f')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x65ec('0x40')](_0x14431d);})['then'](function(_0x5d8d57){_0x46bf66[_0x65ec('0x41')]=_0x5d8d57;return _0x46bf66;})[_0x65ec('0x22')](respondWithFilteredResult(_0x30366c,_0x14431d))[_0x65ec('0x42')](handleError(_0x30366c,null));};exports[_0x65ec('0x43')]=function(_0x1d475e,_0x524235){var _0x4843ca={'raw':![],'where':{'id':_0x1d475e[_0x65ec('0x44')]['id']}},_0x1aef6d={};_0x1aef6d[_0x65ec('0x2d')]=_[_0x65ec('0x2f')](db[_0x65ec('0x2a')]['rawAttributes']);_0x1aef6d['query']=_[_0x65ec('0x2f')](_0x1d475e[_0x65ec('0x2e')]);_0x1aef6d[_0x65ec('0x30')]=_[_0x65ec('0x32')](_0x1aef6d[_0x65ec('0x2d')],_0x1aef6d[_0x65ec('0x2e')]);_0x4843ca[_0x65ec('0x31')]=_['intersection'](_0x1aef6d[_0x65ec('0x2d')],qs[_0x65ec('0x33')](_0x1d475e[_0x65ec('0x2e')]['fields']));_0x4843ca[_0x65ec('0x31')]=_0x4843ca[_0x65ec('0x31')]['length']?_0x4843ca[_0x65ec('0x31')]:_0x1aef6d[_0x65ec('0x2d')];if(_0x1d475e[_0x65ec('0x2e')][_0x65ec('0x3e')]){_0x4843ca[_0x65ec('0x3f')]=[{'all':!![]}];}_0x4843ca=_['merge']({},_0x4843ca,_0x1d475e[_0x65ec('0x3d')]);return db[_0x65ec('0x2a')][_0x65ec('0x45')](_0x4843ca)[_0x65ec('0x22')](handleEntityNotFound(_0x524235,null))['then'](respondWithResult(_0x524235,null))[_0x65ec('0x42')](handleError(_0x524235,null));};exports['create']=function(_0x1ed0f9,_0x169890){return db[_0x65ec('0x2a')]['create'](_0x1ed0f9['body'],{})[_0x65ec('0x22')](respondWithResult(_0x169890,0xc9))[_0x65ec('0x42')](handleError(_0x169890,null));};exports[_0x65ec('0x21')]=function(_0x2111af,_0x1b3732){if(_0x2111af[_0x65ec('0x46')]['id']){delete _0x2111af[_0x65ec('0x46')]['id'];}return db[_0x65ec('0x2a')][_0x65ec('0x45')]({'where':{'id':_0x2111af[_0x65ec('0x44')]['id']}})[_0x65ec('0x22')](handleEntityNotFound(_0x1b3732,null))[_0x65ec('0x22')](saveUpdates(_0x2111af[_0x65ec('0x46')],null))[_0x65ec('0x22')](respondWithResult(_0x1b3732,null))[_0x65ec('0x42')](handleError(_0x1b3732,null));};exports[_0x65ec('0x23')]=function(_0x22c28c,_0x5eb6d3){return db[_0x65ec('0x2a')][_0x65ec('0x45')]({'where':{'id':_0x22c28c['params']['id']}})[_0x65ec('0x22')](handleEntityNotFound(_0x5eb6d3,null))[_0x65ec('0x22')](removeEntity(_0x5eb6d3,null))[_0x65ec('0x42')](handleError(_0x5eb6d3,null));};exports['getConfigurations']=function(_0x3eee1e,_0x2b2756,_0x27843b){var _0x50f1c3={};var _0xabb4e3={};var _0x5e5e48;var _0x4c9905;return db[_0x65ec('0x2a')][_0x65ec('0x47')]({'where':{'id':_0x3eee1e[_0x65ec('0x44')]['id']}})['then'](handleEntityNotFound(_0x2b2756,null))[_0x65ec('0x22')](function(_0x28a686){if(_0x28a686){_0x5e5e48=_0x28a686;_0xabb4e3[_0x65ec('0x2d')]=_[_0x65ec('0x2f')](db[_0x65ec('0x48')][_0x65ec('0x2b')]);_0xabb4e3[_0x65ec('0x2e')]=_[_0x65ec('0x2f')](_0x3eee1e[_0x65ec('0x2e')]);_0xabb4e3['filters']=_['intersection'](_0xabb4e3[_0x65ec('0x2d')],_0xabb4e3['query']);_0x50f1c3[_0x65ec('0x31')]=_['intersection'](_0xabb4e3[_0x65ec('0x2d')],qs[_0x65ec('0x33')](_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x33')]));_0x50f1c3[_0x65ec('0x31')]=_0x50f1c3[_0x65ec('0x31')][_0x65ec('0x49')]?_0x50f1c3['attributes']:_0xabb4e3[_0x65ec('0x2d')];_0x50f1c3[_0x65ec('0x36')]=qs[_0x65ec('0x37')](_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x37')]);_0x50f1c3['where']=qs[_0x65ec('0x30')](_[_0x65ec('0x39')](_0x3eee1e[_0x65ec('0x2e')],_0xabb4e3[_0x65ec('0x30')]));if(_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x3c')]){_0x50f1c3[_0x65ec('0x38')]=_[_0x65ec('0x3a')](_0x50f1c3['where'],{'$or':_[_0x65ec('0x29')](_0x50f1c3[_0x65ec('0x31')],function(_0x12bb9b){var _0x233b9b={};_0x233b9b[_0x12bb9b]={'$like':'%'+_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x3c')]+'%'};return _0x233b9b;})});}_0x50f1c3=_[_0x65ec('0x3a')]({},_0x50f1c3,_0x3eee1e['options']);return _0x5e5e48['getConfigurations'](_0x50f1c3);}})[_0x65ec('0x22')](function(_0x56dd47){if(_0x56dd47){_0x4c9905=_0x56dd47[_0x65ec('0x49')];if(!_0x3eee1e[_0x65ec('0x2e')]['hasOwnProperty'](_0x65ec('0x35'))){_0x50f1c3[_0x65ec('0x1c')]=qs[_0x65ec('0x1c')](_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x1c')]);_0x50f1c3[_0x65ec('0x19')]=qs[_0x65ec('0x19')](_0x3eee1e['query']['offset']);}return _0x5e5e48[_0x65ec('0x4a')](_0x50f1c3);}})[_0x65ec('0x22')](function(_0xd14e5){if(_0xd14e5){return _0xd14e5?{'count':_0x4c9905,'rows':_0xd14e5}:null;}})['then'](respondWithResult(_0x2b2756,null))[_0x65ec('0x42')](handleError(_0x2b2756,null));};exports[_0x65ec('0x4b')]=function(_0x17059d,_0x3d761f,_0x21096d){if(_0x17059d[_0x65ec('0x46')]['id']){delete _0x17059d[_0x65ec('0x46')]['id'];}return db['ZendeskAccount'][_0x65ec('0x47')]({'where':{'id':_0x17059d[_0x65ec('0x44')]['id']}})[_0x65ec('0x22')](handleEntityNotFound(_0x3d761f,null))[_0x65ec('0x22')](function(_0x3da824){if(_0x3da824){_0x17059d[_0x65ec('0x46')][_0x65ec('0x4c')]=_0x3da824['id'];_0x17059d[_0x65ec('0x46')][_0x65ec('0x4d')]=integrations['getSubjects'](_0x17059d['body'][_0x65ec('0x4e')],_0x17059d['body']['type']);_0x17059d[_0x65ec('0x46')][_0x65ec('0x4f')]=integrations[_0x65ec('0x50')](_0x17059d['body']['channel'],_0x17059d[_0x65ec('0x46')]['type']);return db['ZendeskConfiguration']['create'](_0x17059d[_0x65ec('0x46')],{'include':[{'model':db['ZendeskField'],'as':_0x65ec('0x4d')},{'model':db[_0x65ec('0x51')],'as':_0x65ec('0x4f')}]});}return null;})['then'](respondWithResult(_0x3d761f,null))['catch'](handleError(_0x3d761f,null));};exports[_0x65ec('0x52')]=function(_0x54f1cb,_0x244d12,_0x1c2972){var _0xf78f6a='';return db[_0x65ec('0x2a')][_0x65ec('0x47')]({'where':{'id':_0x54f1cb[_0x65ec('0x44')]['id']},'attributes':['id',_0x65ec('0x53'),_0x65ec('0x54'),_0x65ec('0x55'),_0x65ec('0x56'),'remoteUri']})[_0x65ec('0x22')](handleEntityNotFound(_0x244d12,null))['then'](function(_0x46e454){if(_0x46e454){_0xf78f6a=_0x46e454[_0x65ec('0x57')];var _0x292f81=_0xf78f6a[_0x65ec('0x58')](-0x1);if(_0x292f81==='/'){_0xf78f6a=_0xf78f6a['substring'](0x0,_0xf78f6a[_0x65ec('0x59')](_0x292f81));}var _0x556c5e={'method':_0x65ec('0x5a'),'uri':util[_0x65ec('0x5b')](_0x65ec('0x5c'),_0xf78f6a,_0x65ec('0x5d')),'json':!![]};switch(_0x46e454['authType']){case'password':_0x556c5e['headers']={'Authorization':util[_0x65ec('0x5b')](_0x65ec('0x5e'),new Buffer(util[_0x65ec('0x5b')](_0x65ec('0x5f'),_0x46e454[_0x65ec('0x53')],_0x46e454[_0x65ec('0x54')]))[_0x65ec('0x60')](_0x65ec('0x61')))};break;case _0x65ec('0x55'):_0x556c5e[_0x65ec('0x62')]={'Authorization':util[_0x65ec('0x5b')](_0x65ec('0x5e'),new Buffer(util[_0x65ec('0x5b')]('%s/token:%s',_0x46e454[_0x65ec('0x53')],_0x46e454[_0x65ec('0x55')]))[_0x65ec('0x60')](_0x65ec('0x61')))};break;default:throw new db[(_0x65ec('0x63'))][(_0x65ec('0x64'))](_0x65ec('0x65'));}return rp(_0x556c5e);}})[_0x65ec('0x22')](function(_0x3b5640){if(_0x3b5640){var _0x26ac0e=['subject',_0x65ec('0x66'),'group','assignee'];_[_0x65ec('0x67')](_0x3b5640[_0x65ec('0x5d')],function(_0x272432){return _0x26ac0e[_0x65ec('0x68')](_0x272432[_0x65ec('0x2c')]);});return{'count':_0x3b5640[_0x65ec('0x5d')][_0x65ec('0x49')],'rows':_[_0x65ec('0x29')](_0x3b5640['ticket_fields'],function(_0x1f5fe7){return{'id':_0x1f5fe7['id'],'name':_0x1f5fe7['position']>0x7?_0x1f5fe7[_0x65ec('0x69')]:_0x1f5fe7[_0x65ec('0x2c')],'custom':_0x1f5fe7[_0x65ec('0x6a')]>0x7?!![]:![],'options':_0x1f5fe7['system_field_options']?_0x1f5fe7[_0x65ec('0x6b')]:_0x1f5fe7[_0x65ec('0x6c')]?_0x1f5fe7[_0x65ec('0x6c')]:[]};})};}})[_0x65ec('0x22')](respondWithResult(_0x244d12,null))[_0x65ec('0x42')](function(_0x77ebd2){var _0x1172f3=_0x54f1cb['query'][_0x65ec('0x6d')]?0x1f4:_0x77ebd2[_0x65ec('0x6e')]||0x1f4;logger[_0x65ec('0x24')](_0x65ec('0x6f'),'getFields',_0x1172f3,JSON['stringify'](_0x77ebd2));delete _0x77ebd2[_0x65ec('0x26')];if(_0x1172f3===0x191){_0x1172f3=0x190;}_0x244d12[_0x65ec('0x16')](_0x1172f3)[_0x65ec('0x27')](_0x54f1cb[_0x65ec('0x2e')][_0x65ec('0x6d')]?{'message':_0x65ec('0x70'),'statusCode':_0x77ebd2['statusCode']}:_0x77ebd2);});}; \ No newline at end of file +var _0x7916=['hasOwnProperty','order','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','update','body','getConfigurations','ZendeskConfiguration','sort','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskField','findOne','password','token','remoteUri','slice','substring','GET','format','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','username','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','undefined','count','limit','status','set','apply','save','then','destroy','error','name','map','ZendeskAccount','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes'];(function(_0x1ba06e,_0x13bd4a){var _0x80185f=function(_0x5a32a1){while(--_0x5a32a1){_0x1ba06e['push'](_0x1ba06e['shift']());}};_0x80185f(++_0x13bd4a);}(_0x7916,0x128));var _0x6791=function(_0xe48ead,_0x2933d5){_0xe48ead=_0xe48ead-0x0;var _0x374ca8=_0x7916[_0xe48ead];return _0x374ca8;};'use strict';var emlformat=require(_0x6791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6791('0x1'));var jsonpatch=require(_0x6791('0x2'));var rp=require('request-promise');var moment=require(_0x6791('0x3'));var BPromise=require(_0x6791('0x4'));var Mustache=require(_0x6791('0x5'));var util=require(_0x6791('0x6'));var path=require('path');var sox=require(_0x6791('0x7'));var csv=require('to-csv');var ejs=require(_0x6791('0x8'));var fs=require('fs');var fs_extra=require(_0x6791('0x9'));var _=require('lodash');var squel=require(_0x6791('0xa'));var crypto=require('crypto');var jsforce=require(_0x6791('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6791('0xc'));var Papa=require(_0x6791('0xd'));var Redis=require('ioredis');var authService=require(_0x6791('0xe'));var qs=require(_0x6791('0xf'));var as=require(_0x6791('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6791('0x11'))(_0x6791('0x12'));var utils=require(_0x6791('0x13'));var config=require(_0x6791('0x14'));var licenseUtil=require(_0x6791('0x15'));var db=require(_0x6791('0x16'))['db'];var integrations=require(_0x6791('0x17'));function respondWithStatusCode(_0x16c62b,_0x423e22){_0x423e22=_0x423e22||0xcc;return function(_0x11c730){if(_0x11c730){return _0x16c62b[_0x6791('0x18')](_0x423e22);}return _0x16c62b['status'](_0x423e22)['end']();};}function respondWithResult(_0x34b28d,_0x5122f9){_0x5122f9=_0x5122f9||0xc8;return function(_0x2a9151){if(_0x2a9151){return _0x34b28d['status'](_0x5122f9)[_0x6791('0x19')](_0x2a9151);}};}function respondWithFilteredResult(_0x163898,_0x517910){return function(_0x3e4792){if(_0x3e4792){var _0x4b80ed=typeof _0x517910[_0x6791('0x1a')]===_0x6791('0x1b')&&typeof _0x517910['limit']===_0x6791('0x1b');var _0x36d7a1=_0x3e4792['count'];var _0x1872f5=_0x4b80ed?0x0:_0x517910['offset'];var _0xe55dba=_0x4b80ed?_0x3e4792[_0x6791('0x1c')]:_0x517910[_0x6791('0x1a')]+_0x517910[_0x6791('0x1d')];var _0x25adbc;if(_0xe55dba>=_0x36d7a1){_0xe55dba=_0x36d7a1;_0x25adbc=0xc8;}else{_0x25adbc=0xce;}_0x163898[_0x6791('0x1e')](_0x25adbc);return _0x163898[_0x6791('0x1f')]('Content-Range',_0x1872f5+'-'+_0xe55dba+'/'+_0x36d7a1)[_0x6791('0x19')](_0x3e4792);}return null;};}function patchUpdates(_0x306acb){return function(_0x51368e){try{jsonpatch[_0x6791('0x20')](_0x51368e,_0x306acb,!![]);}catch(_0x3b57f0){return BPromise['reject'](_0x3b57f0);}return _0x51368e[_0x6791('0x21')]();};}function saveUpdates(_0x309610,_0x15b9ab){return function(_0x12d83b){if(_0x12d83b){return _0x12d83b['update'](_0x309610)[_0x6791('0x22')](function(_0x1b516d){return _0x1b516d;});}return null;};}function removeEntity(_0x4a8717,_0x53bb44){return function(_0x4b23bc){if(_0x4b23bc){return _0x4b23bc[_0x6791('0x23')]()['then'](function(){_0x4a8717[_0x6791('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a092,_0x496273){return function(_0x5cadc){if(!_0x5cadc){_0x54a092[_0x6791('0x18')](0x194);}return _0x5cadc;};}function handleError(_0xd49b84,_0x56a74e){_0x56a74e=_0x56a74e||0x1f4;return function(_0x3def2e){logger[_0x6791('0x24')](_0x3def2e['stack']);if(_0x3def2e[_0x6791('0x25')]){delete _0x3def2e['name'];}_0xd49b84[_0x6791('0x1e')](_0x56a74e)['send'](_0x3def2e);};}exports['index']=function(_0x270a1d,_0x551718){var _0x2f56a2={},_0x34b006={},_0x483d6c={'count':0x0,'rows':[]};var _0x240a9f=_[_0x6791('0x26')](db[_0x6791('0x27')][_0x6791('0x28')],function(_0x5d9d54){return{'name':_0x5d9d54['fieldName'],'type':_0x5d9d54[_0x6791('0x29')]['key']};});_0x34b006[_0x6791('0x2a')]=_[_0x6791('0x26')](_0x240a9f,_0x6791('0x25'));_0x34b006[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x270a1d[_0x6791('0x2b')]);_0x34b006[_0x6791('0x2d')]=_[_0x6791('0x2e')](_0x34b006[_0x6791('0x2a')],_0x34b006[_0x6791('0x2b')]);_0x2f56a2['attributes']=_[_0x6791('0x2e')](_0x34b006[_0x6791('0x2a')],qs[_0x6791('0x2f')](_0x270a1d[_0x6791('0x2b')][_0x6791('0x2f')]));_0x2f56a2[_0x6791('0x30')]=_0x2f56a2['attributes']['length']?_0x2f56a2['attributes']:_0x34b006[_0x6791('0x2a')];if(!_0x270a1d[_0x6791('0x2b')][_0x6791('0x31')]('nolimit')){_0x2f56a2['limit']=qs[_0x6791('0x1d')](_0x270a1d[_0x6791('0x2b')][_0x6791('0x1d')]);_0x2f56a2[_0x6791('0x1a')]=qs['offset'](_0x270a1d[_0x6791('0x2b')][_0x6791('0x1a')]);}_0x2f56a2[_0x6791('0x32')]=qs['sort'](_0x270a1d[_0x6791('0x2b')]['sort']);_0x2f56a2['where']=qs[_0x6791('0x2d')](_[_0x6791('0x33')](_0x270a1d['query'],_0x34b006[_0x6791('0x2d')]),_0x240a9f);if(_0x270a1d[_0x6791('0x2b')][_0x6791('0x34')]){_0x2f56a2[_0x6791('0x35')]=_[_0x6791('0x36')](_0x2f56a2['where'],{'$or':_[_0x6791('0x26')](_0x240a9f,function(_0xc95516){if(_0xc95516[_0x6791('0x29')]!=='VIRTUAL'){var _0x3a6062={};_0x3a6062[_0xc95516[_0x6791('0x25')]]={'$like':'%'+_0x270a1d[_0x6791('0x2b')]['filter']+'%'};return _0x3a6062;}})});}_0x2f56a2=_[_0x6791('0x36')]({},_0x2f56a2,_0x270a1d[_0x6791('0x37')]);var _0x13be81={'where':_0x2f56a2[_0x6791('0x35')]};return db['ZendeskAccount'][_0x6791('0x1c')](_0x13be81)[_0x6791('0x22')](function(_0x3e95b6){_0x483d6c[_0x6791('0x1c')]=_0x3e95b6;if(_0x270a1d[_0x6791('0x2b')][_0x6791('0x38')]){_0x2f56a2[_0x6791('0x39')]=[{'all':!![]}];}return db[_0x6791('0x27')][_0x6791('0x3a')](_0x2f56a2);})['then'](function(_0x52c03a){_0x483d6c[_0x6791('0x3b')]=_0x52c03a;return _0x483d6c;})[_0x6791('0x22')](respondWithFilteredResult(_0x551718,_0x2f56a2))['catch'](handleError(_0x551718,null));};exports[_0x6791('0x3c')]=function(_0x1c9913,_0x1c6803){var _0x3edb86={'raw':![],'where':{'id':_0x1c9913[_0x6791('0x3d')]['id']}},_0x1a922e={};_0x1a922e[_0x6791('0x2a')]=_['keys'](db[_0x6791('0x27')]['rawAttributes']);_0x1a922e[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x1c9913[_0x6791('0x2b')]);_0x1a922e[_0x6791('0x2d')]=_['intersection'](_0x1a922e[_0x6791('0x2a')],_0x1a922e[_0x6791('0x2b')]);_0x3edb86[_0x6791('0x30')]=_[_0x6791('0x2e')](_0x1a922e[_0x6791('0x2a')],qs[_0x6791('0x2f')](_0x1c9913[_0x6791('0x2b')][_0x6791('0x2f')]));_0x3edb86['attributes']=_0x3edb86[_0x6791('0x30')][_0x6791('0x3e')]?_0x3edb86[_0x6791('0x30')]:_0x1a922e[_0x6791('0x2a')];if(_0x1c9913['query'][_0x6791('0x38')]){_0x3edb86[_0x6791('0x39')]=[{'all':!![]}];}_0x3edb86=_['merge']({},_0x3edb86,_0x1c9913[_0x6791('0x37')]);return db['ZendeskAccount'][_0x6791('0x3f')](_0x3edb86)[_0x6791('0x22')](handleEntityNotFound(_0x1c6803,null))[_0x6791('0x22')](respondWithResult(_0x1c6803,null))[_0x6791('0x40')](handleError(_0x1c6803,null));};exports[_0x6791('0x41')]=function(_0xb2a2,_0x4163f5){return db[_0x6791('0x27')][_0x6791('0x41')](_0xb2a2['body'],{})[_0x6791('0x22')](respondWithResult(_0x4163f5,0xc9))['catch'](handleError(_0x4163f5,null));};exports[_0x6791('0x42')]=function(_0x2bb86a,_0x276002){if(_0x2bb86a[_0x6791('0x43')]['id']){delete _0x2bb86a[_0x6791('0x43')]['id'];}return db['ZendeskAccount'][_0x6791('0x3f')]({'where':{'id':_0x2bb86a[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x276002,null))[_0x6791('0x22')](saveUpdates(_0x2bb86a[_0x6791('0x43')],null))['then'](respondWithResult(_0x276002,null))[_0x6791('0x40')](handleError(_0x276002,null));};exports[_0x6791('0x23')]=function(_0x4ff9f4,_0x3df699){return db['ZendeskAccount'][_0x6791('0x3f')]({'where':{'id':_0x4ff9f4[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x3df699,null))[_0x6791('0x22')](removeEntity(_0x3df699,null))['catch'](handleError(_0x3df699,null));};exports[_0x6791('0x44')]=function(_0x243faf,_0x5655c8,_0x189b22){var _0x4370ab={};var _0x3a895b={};var _0x5df56e;var _0x355e97;return db[_0x6791('0x27')]['findOne']({'where':{'id':_0x243faf[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x5655c8,null))['then'](function(_0x169531){if(_0x169531){_0x5df56e=_0x169531;_0x3a895b[_0x6791('0x2a')]=_[_0x6791('0x2c')](db[_0x6791('0x45')]['rawAttributes']);_0x3a895b[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x243faf[_0x6791('0x2b')]);_0x3a895b['filters']=_['intersection'](_0x3a895b[_0x6791('0x2a')],_0x3a895b[_0x6791('0x2b')]);_0x4370ab[_0x6791('0x30')]=_[_0x6791('0x2e')](_0x3a895b[_0x6791('0x2a')],qs['fields'](_0x243faf['query'][_0x6791('0x2f')]));_0x4370ab['attributes']=_0x4370ab['attributes'][_0x6791('0x3e')]?_0x4370ab[_0x6791('0x30')]:_0x3a895b[_0x6791('0x2a')];_0x4370ab[_0x6791('0x32')]=qs[_0x6791('0x46')](_0x243faf[_0x6791('0x2b')]['sort']);_0x4370ab['where']=qs[_0x6791('0x2d')](_[_0x6791('0x33')](_0x243faf['query'],_0x3a895b[_0x6791('0x2d')]));if(_0x243faf['query'][_0x6791('0x34')]){_0x4370ab[_0x6791('0x35')]=_['merge'](_0x4370ab[_0x6791('0x35')],{'$or':_[_0x6791('0x26')](_0x4370ab[_0x6791('0x30')],function(_0x49ed65){var _0x3ba679={};_0x3ba679[_0x49ed65]={'$like':'%'+_0x243faf[_0x6791('0x2b')][_0x6791('0x34')]+'%'};return _0x3ba679;})});}_0x4370ab=_[_0x6791('0x36')]({},_0x4370ab,_0x243faf[_0x6791('0x37')]);return _0x5df56e['getConfigurations'](_0x4370ab);}})['then'](function(_0x1a9acd){if(_0x1a9acd){_0x355e97=_0x1a9acd[_0x6791('0x3e')];if(!_0x243faf['query'][_0x6791('0x31')](_0x6791('0x47'))){_0x4370ab[_0x6791('0x1d')]=qs[_0x6791('0x1d')](_0x243faf[_0x6791('0x2b')][_0x6791('0x1d')]);_0x4370ab[_0x6791('0x1a')]=qs[_0x6791('0x1a')](_0x243faf['query'][_0x6791('0x1a')]);}return _0x5df56e[_0x6791('0x44')](_0x4370ab);}})[_0x6791('0x22')](function(_0x1a9a2e){if(_0x1a9a2e){return _0x1a9a2e?{'count':_0x355e97,'rows':_0x1a9a2e}:null;}})['then'](respondWithResult(_0x5655c8,null))[_0x6791('0x40')](handleError(_0x5655c8,null));};exports[_0x6791('0x48')]=function(_0xa8a8dd,_0x5ca809,_0x205320){if(_0xa8a8dd[_0x6791('0x43')]['id']){delete _0xa8a8dd[_0x6791('0x43')]['id'];}return db[_0x6791('0x27')]['findOne']({'where':{'id':_0xa8a8dd[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x5ca809,null))['then'](function(_0x1114d4){if(_0x1114d4){_0xa8a8dd[_0x6791('0x43')][_0x6791('0x49')]=_0x1114d4['id'];_0xa8a8dd[_0x6791('0x43')][_0x6791('0x4a')]=integrations[_0x6791('0x4b')](_0xa8a8dd['body'][_0x6791('0x4c')],_0xa8a8dd[_0x6791('0x43')][_0x6791('0x29')]);_0xa8a8dd['body'][_0x6791('0x4d')]=integrations['getDescriptions'](_0xa8a8dd[_0x6791('0x43')][_0x6791('0x4c')],_0xa8a8dd[_0x6791('0x43')][_0x6791('0x29')]);return db[_0x6791('0x45')]['create'](_0xa8a8dd[_0x6791('0x43')],{'include':[{'model':db[_0x6791('0x4e')],'as':_0x6791('0x4a')},{'model':db[_0x6791('0x4e')],'as':'Descriptions'}]});}return null;})[_0x6791('0x22')](respondWithResult(_0x5ca809,null))[_0x6791('0x40')](handleError(_0x5ca809,null));};exports['getFields']=function(_0x34691c,_0x1fa44a,_0x567302){var _0x201465='';return db[_0x6791('0x27')][_0x6791('0x4f')]({'where':{'id':_0x34691c[_0x6791('0x3d')]['id']},'attributes':['id','username',_0x6791('0x50'),_0x6791('0x51'),'authType',_0x6791('0x52')]})[_0x6791('0x22')](handleEntityNotFound(_0x1fa44a,null))[_0x6791('0x22')](function(_0x20c736){if(_0x20c736){_0x201465=_0x20c736[_0x6791('0x52')];var _0x4ecf62=_0x201465[_0x6791('0x53')](-0x1);if(_0x4ecf62==='/'){_0x201465=_0x201465[_0x6791('0x54')](0x0,_0x201465['lastIndexOf'](_0x4ecf62));}var _0x4463ef={'method':_0x6791('0x55'),'uri':util[_0x6791('0x56')]('%s/%s',_0x201465,_0x6791('0x57')),'json':!![]};switch(_0x20c736[_0x6791('0x58')]){case _0x6791('0x50'):_0x4463ef[_0x6791('0x59')]={'Authorization':util[_0x6791('0x56')](_0x6791('0x5a'),new Buffer(util[_0x6791('0x56')](_0x6791('0x5b'),_0x20c736['username'],_0x20c736[_0x6791('0x50')]))[_0x6791('0x5c')]('base64'))};break;case _0x6791('0x51'):_0x4463ef[_0x6791('0x59')]={'Authorization':util[_0x6791('0x56')]('Basic\x20%s',new Buffer(util[_0x6791('0x56')]('%s/token:%s',_0x20c736[_0x6791('0x5d')],_0x20c736[_0x6791('0x51')]))[_0x6791('0x5c')](_0x6791('0x5e')))};break;default:throw new db[(_0x6791('0x5f'))][(_0x6791('0x60'))](_0x6791('0x61'));}return rp(_0x4463ef);}})[_0x6791('0x22')](function(_0x23e0d3){if(_0x23e0d3){var _0x1fa853=[_0x6791('0x62'),_0x6791('0x63'),_0x6791('0x64'),_0x6791('0x65')];_[_0x6791('0x66')](_0x23e0d3[_0x6791('0x57')],function(_0x3b53b8){return _0x1fa853[_0x6791('0x67')](_0x3b53b8[_0x6791('0x29')]);});return{'count':_0x23e0d3['ticket_fields']['length'],'rows':_['map'](_0x23e0d3[_0x6791('0x57')],function(_0x31c1a8){return{'id':_0x31c1a8['id'],'name':_0x31c1a8[_0x6791('0x68')]>0x7?_0x31c1a8[_0x6791('0x69')]:_0x31c1a8[_0x6791('0x29')],'custom':_0x31c1a8[_0x6791('0x68')]>0x7?!![]:![],'options':_0x31c1a8[_0x6791('0x6a')]?_0x31c1a8[_0x6791('0x6a')]:_0x31c1a8[_0x6791('0x6b')]?_0x31c1a8[_0x6791('0x6b')]:[]};})};}})[_0x6791('0x22')](respondWithResult(_0x1fa44a,null))[_0x6791('0x40')](function(_0x44ec4d){var _0x4047b6=_0x34691c[_0x6791('0x2b')][_0x6791('0x6c')]?0x1f4:_0x44ec4d[_0x6791('0x6d')]||0x1f4;logger[_0x6791('0x24')](_0x6791('0x6e'),_0x6791('0x6f'),_0x4047b6,JSON[_0x6791('0x70')](_0x44ec4d));delete _0x44ec4d[_0x6791('0x25')];if(_0x4047b6===0x191){_0x4047b6=0x190;}_0x1fa44a[_0x6791('0x1e')](_0x4047b6)[_0x6791('0x71')](_0x34691c[_0x6791('0x2b')]['test']?{'message':_0x6791('0x72'),'statusCode':_0x44ec4d['statusCode']}:_0x44ec4d);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 509b37b..37c0b5f 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 _0x2b06=['../../components/integrations/configuration','exports','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes'];(function(_0x2e6f02,_0x20186d){var _0x2358ff=function(_0x329450){while(--_0x329450){_0x2e6f02['push'](_0x2e6f02['shift']());}};_0x2358ff(++_0x20186d);}(_0x2b06,0xd3));var _0x62b0=function(_0x473b41,_0x1c320f){_0x473b41=_0x473b41-0x0;var _0x4e521d=_0x2b06[_0x473b41];return _0x4e521d;};'use strict';var _=require('lodash');var util=require(_0x62b0('0x0'));var logger=require(_0x62b0('0x1'))(_0x62b0('0x2'));var moment=require(_0x62b0('0x3'));var BPromise=require(_0x62b0('0x4'));var rp=require(_0x62b0('0x5'));var fs=require('fs');var path=require(_0x62b0('0x6'));var rimraf=require(_0x62b0('0x7'));var config=require('../../config/environment');var attributes=require(_0x62b0('0x8'));var integrations=require(_0x62b0('0x9'));module[_0x62b0('0xa')]=function(_0x5871c7,_0x4b8fe1){return _0x5871c7['define']('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b6e=['request-promise','path','rimraf','./intZendeskAccount.attributes','exports','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','api','moment'];(function(_0x5bafb9,_0x221490){var _0xfeaea5=function(_0x43c21e){while(--_0x43c21e){_0x5bafb9['push'](_0x5bafb9['shift']());}};_0xfeaea5(++_0x221490);}(_0x5b6e,0x164));var _0xe5b6=function(_0x255990,_0x199135){_0x255990=_0x255990-0x0;var _0xcf1674=_0x5b6e[_0x255990];return _0xcf1674;};'use strict';var _=require('lodash');var util=require(_0xe5b6('0x0'));var logger=require(_0xe5b6('0x1'))(_0xe5b6('0x2'));var moment=require(_0xe5b6('0x3'));var BPromise=require('bluebird');var rp=require(_0xe5b6('0x4'));var fs=require('fs');var path=require(_0xe5b6('0x5'));var rimraf=require(_0xe5b6('0x6'));var config=require('../../config/environment');var attributes=require(_0xe5b6('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xe5b6('0x8')]=function(_0x12fc6a,_0x2380df){return _0x12fc6a[_0xe5b6('0x9')](_0xe5b6('0xa'),attributes,{'tableName':_0xe5b6('0xb'),'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 6faa219..b8e403a 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 _0x1eae=['GetZendeskAccount','options','raw','where','attributes','limit','include','model','debug','catch','ShowZendeskAccount','ZendeskAccount','find','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x1eae,0x12e));var _0xe1ea=function(_0x532451,_0x21109a){_0x532451=_0x532451-0x0;var _0x2981f9=_0x1eae[_0x532451];return _0x2981f9;};'use strict';var _=require(_0xe1ea('0x0'));var util=require(_0xe1ea('0x1'));var moment=require(_0xe1ea('0x2'));var BPromise=require(_0xe1ea('0x3'));var rs=require(_0xe1ea('0x4'));var fs=require('fs');var Redis=require(_0xe1ea('0x5'));var db=require(_0xe1ea('0x6'))['db'];var utils=require(_0xe1ea('0x7'));var logger=require('../../config/logger')(_0xe1ea('0x8'));var config=require(_0xe1ea('0x9'));var jayson=require(_0xe1ea('0xa'));var client=jayson['client'][_0xe1ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45ca78,_0x4a7271,_0x3a4707){return new BPromise(function(_0x2bc78a,_0xec4571){return client[_0xe1ea('0xc')](_0x45ca78,_0x3a4707)[_0xe1ea('0xd')](function(_0x78f43d){logger[_0xe1ea('0xe')](_0xe1ea('0xf'),_0x4a7271,_0xe1ea('0x10'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x4a7271,_0xe1ea('0x10'),JSON[_0xe1ea('0x11')](_0x78f43d));if(_0x78f43d[_0xe1ea('0x12')]){if(_0x78f43d[_0xe1ea('0x12')][_0xe1ea('0x13')]===0x1f4){logger[_0xe1ea('0x12')](_0xe1ea('0xf'),_0x4a7271,_0x78f43d['error'][_0xe1ea('0x14')]);return _0xec4571(_0x78f43d[_0xe1ea('0x12')][_0xe1ea('0x14')]);}logger[_0xe1ea('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x4a7271,_0x78f43d['error'][_0xe1ea('0x14')]);return _0x2bc78a(_0x78f43d[_0xe1ea('0x12')][_0xe1ea('0x14')]);}else{logger[_0xe1ea('0xe')](_0xe1ea('0xf'),_0x4a7271,'request\x20sent');_0x2bc78a(_0x78f43d[_0xe1ea('0x15')][_0xe1ea('0x14')]);}})['catch'](function(_0xaa9233){logger[_0xe1ea('0x12')](_0xe1ea('0xf'),_0x4a7271,_0xaa9233);_0xec4571(_0xaa9233);});});}exports[_0xe1ea('0x16')]=function(_0x47f18b){var _0x5f512a=this;return new Promise(function(_0x5bc6a5,_0x1d56fb){return db['ZendeskAccount']['findAll']({'raw':_0x47f18b[_0xe1ea('0x17')]?_0x47f18b['options'][_0xe1ea('0x18')]===undefined?!![]:![]:!![],'where':_0x47f18b[_0xe1ea('0x17')]?_0x47f18b['options'][_0xe1ea('0x19')]||null:null,'attributes':_0x47f18b[_0xe1ea('0x17')]?_0x47f18b[_0xe1ea('0x17')][_0xe1ea('0x1a')]||null:null,'limit':_0x47f18b['options']?_0x47f18b[_0xe1ea('0x17')][_0xe1ea('0x1b')]||null:null,'include':_0x47f18b['options']?_0x47f18b[_0xe1ea('0x17')]['include']?_['map'](_0x47f18b[_0xe1ea('0x17')][_0xe1ea('0x1c')],function(_0x29ecb2){return{'model':db[_0x29ecb2[_0xe1ea('0x1d')]],'as':_0x29ecb2['as'],'attributes':_0x29ecb2[_0xe1ea('0x1a')],'include':_0x29ecb2[_0xe1ea('0x1c')]?_['map'](_0x29ecb2[_0xe1ea('0x1c')],function(_0x45524e){return{'model':db[_0x45524e[_0xe1ea('0x1d')]],'as':_0x45524e['as'],'attributes':_0x45524e['attributes'],'include':_0x45524e[_0xe1ea('0x1c')]?_['map'](_0x45524e[_0xe1ea('0x1c')],function(_0x5859da){return{'model':db[_0x5859da[_0xe1ea('0x1d')]],'as':_0x5859da['as'],'attributes':_0x5859da[_0xe1ea('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe1ea('0xd')](function(_0x45a1d3){logger[_0xe1ea('0xe')]('GetZendeskAccount',_0x47f18b);logger[_0xe1ea('0x1e')]('GetZendeskAccount',_0x47f18b,JSON[_0xe1ea('0x11')](_0x45a1d3));_0x5bc6a5(_0x45a1d3);})[_0xe1ea('0x1f')](function(_0x3a2254){logger[_0xe1ea('0x12')]('GetZendeskAccount',_0x3a2254[_0xe1ea('0x14')],_0x47f18b);_0x1d56fb(_0x5f512a[_0xe1ea('0x12')](0x1f4,_0x3a2254[_0xe1ea('0x14')]));});});};exports[_0xe1ea('0x20')]=function(_0xaadc4c){var _0x394a28=this;return new Promise(function(_0x1be5cd,_0x18c28b){return db[_0xe1ea('0x21')][_0xe1ea('0x22')]({'raw':_0xaadc4c[_0xe1ea('0x17')]?_0xaadc4c['options'][_0xe1ea('0x18')]===undefined?!![]:![]:!![],'where':_0xaadc4c['options']?_0xaadc4c[_0xe1ea('0x17')][_0xe1ea('0x19')]||null:null,'attributes':_0xaadc4c[_0xe1ea('0x17')]?_0xaadc4c[_0xe1ea('0x17')]['attributes']||null:null,'include':_0xaadc4c[_0xe1ea('0x17')]?_0xaadc4c[_0xe1ea('0x17')][_0xe1ea('0x1c')]?_[_0xe1ea('0x23')](_0xaadc4c[_0xe1ea('0x17')]['include'],function(_0x24e0e5){return{'model':db[_0x24e0e5['model']],'as':_0x24e0e5['as'],'attributes':_0x24e0e5[_0xe1ea('0x1a')],'include':_0x24e0e5[_0xe1ea('0x1c')]?_['map'](_0x24e0e5[_0xe1ea('0x1c')],function(_0x12c2c7){return{'model':db[_0x12c2c7[_0xe1ea('0x1d')]],'as':_0x12c2c7['as'],'attributes':_0x12c2c7[_0xe1ea('0x1a')],'include':_0x12c2c7[_0xe1ea('0x1c')]?_[_0xe1ea('0x23')](_0x12c2c7[_0xe1ea('0x1c')],function(_0x103aa4){return{'model':db[_0x103aa4[_0xe1ea('0x1d')]],'as':_0x103aa4['as'],'attributes':_0x103aa4[_0xe1ea('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe1ea('0xd')](function(_0x5c4692){logger[_0xe1ea('0xe')](_0xe1ea('0x20'),_0xaadc4c);logger['debug']('ShowZendeskAccount',_0xaadc4c,JSON[_0xe1ea('0x11')](_0x5c4692));_0x1be5cd(_0x5c4692);})['catch'](function(_0x3e9c26){logger['error']('ShowZendeskAccount',_0x3e9c26[_0xe1ea('0x14')],_0xaadc4c);_0x18c28b(_0x394a28[_0xe1ea('0x12')](0x1f4,_0x3e9c26[_0xe1ea('0x14')]));});});}; \ No newline at end of file +var _0xe933=['../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskAccount,\x20%s,\x20%s','info','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowZendeskAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x25d8ac,_0x303e59){var _0x20fc9d=function(_0x30cb86){while(--_0x30cb86){_0x25d8ac['push'](_0x25d8ac['shift']());}};_0x20fc9d(++_0x303e59);}(_0xe933,0x103));var _0x3e93=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xe933[_0x29d94e];return _0x106237;};'use strict';var _=require(_0x3e93('0x0'));var util=require(_0x3e93('0x1'));var moment=require(_0x3e93('0x2'));var BPromise=require(_0x3e93('0x3'));var rs=require(_0x3e93('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e93('0x5'))['db'];var utils=require(_0x3e93('0x6'));var logger=require(_0x3e93('0x7'))(_0x3e93('0x8'));var config=require(_0x3e93('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3e93('0xa')][_0x3e93('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22f53e,_0x2aaab6,_0x4303c2){return new BPromise(function(_0x417a1b,_0x300af4){return client[_0x3e93('0xc')](_0x22f53e,_0x4303c2)[_0x3e93('0xd')](function(_0x24dbce){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x2aaab6,_0x3e93('0xe'));logger[_0x3e93('0xf')](_0x3e93('0x10'),_0x2aaab6,_0x3e93('0xe'),JSON[_0x3e93('0x11')](_0x24dbce));if(_0x24dbce[_0x3e93('0x12')]){if(_0x24dbce[_0x3e93('0x12')][_0x3e93('0x13')]===0x1f4){logger[_0x3e93('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x2aaab6,_0x24dbce[_0x3e93('0x12')]['message']);return _0x300af4(_0x24dbce[_0x3e93('0x12')][_0x3e93('0x14')]);}logger[_0x3e93('0x12')](_0x3e93('0x15'),_0x2aaab6,_0x24dbce[_0x3e93('0x12')][_0x3e93('0x14')]);return _0x417a1b(_0x24dbce[_0x3e93('0x12')][_0x3e93('0x14')]);}else{logger[_0x3e93('0x16')](_0x3e93('0x15'),_0x2aaab6,_0x3e93('0xe'));_0x417a1b(_0x24dbce[_0x3e93('0x17')]['message']);}})[_0x3e93('0x18')](function(_0x16676a){logger[_0x3e93('0x12')](_0x3e93('0x15'),_0x2aaab6,_0x16676a);_0x300af4(_0x16676a);});});}exports[_0x3e93('0x19')]=function(_0x58a1ea){var _0x475f7b=this;return new Promise(function(_0x30237c,_0x4ebd2e){return db[_0x3e93('0x1a')][_0x3e93('0x1b')]({'raw':_0x58a1ea[_0x3e93('0x1c')]?_0x58a1ea[_0x3e93('0x1c')][_0x3e93('0x1d')]===undefined?!![]:![]:!![],'where':_0x58a1ea['options']?_0x58a1ea[_0x3e93('0x1c')][_0x3e93('0x1e')]||null:null,'attributes':_0x58a1ea[_0x3e93('0x1c')]?_0x58a1ea['options'][_0x3e93('0x1f')]||null:null,'limit':_0x58a1ea[_0x3e93('0x1c')]?_0x58a1ea['options'][_0x3e93('0x20')]||null:null,'include':_0x58a1ea[_0x3e93('0x1c')]?_0x58a1ea[_0x3e93('0x1c')][_0x3e93('0x21')]?_['map'](_0x58a1ea[_0x3e93('0x1c')][_0x3e93('0x21')],function(_0x52e125){return{'model':db[_0x52e125[_0x3e93('0x22')]],'as':_0x52e125['as'],'attributes':_0x52e125[_0x3e93('0x1f')],'include':_0x52e125[_0x3e93('0x21')]?_['map'](_0x52e125[_0x3e93('0x21')],function(_0x486926){return{'model':db[_0x486926[_0x3e93('0x22')]],'as':_0x486926['as'],'attributes':_0x486926[_0x3e93('0x1f')],'include':_0x486926[_0x3e93('0x21')]?_[_0x3e93('0x23')](_0x486926[_0x3e93('0x21')],function(_0x52a0d3){return{'model':db[_0x52a0d3[_0x3e93('0x22')]],'as':_0x52a0d3['as'],'attributes':_0x52a0d3[_0x3e93('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3e93('0xd')](function(_0x31e2ed){logger['info'](_0x3e93('0x19'),_0x58a1ea);logger[_0x3e93('0xf')](_0x3e93('0x19'),_0x58a1ea,JSON[_0x3e93('0x11')](_0x31e2ed));_0x30237c(_0x31e2ed);})[_0x3e93('0x18')](function(_0x44aba4){logger[_0x3e93('0x12')](_0x3e93('0x19'),_0x44aba4[_0x3e93('0x14')],_0x58a1ea);_0x4ebd2e(_0x475f7b[_0x3e93('0x12')](0x1f4,_0x44aba4['message']));});});};exports[_0x3e93('0x24')]=function(_0x8fad40){var _0x402f33=this;return new Promise(function(_0x576abf,_0x44a5ae){return db[_0x3e93('0x1a')][_0x3e93('0x25')]({'raw':_0x8fad40[_0x3e93('0x1c')]?_0x8fad40['options'][_0x3e93('0x1d')]===undefined?!![]:![]:!![],'where':_0x8fad40[_0x3e93('0x1c')]?_0x8fad40[_0x3e93('0x1c')][_0x3e93('0x1e')]||null:null,'attributes':_0x8fad40[_0x3e93('0x1c')]?_0x8fad40[_0x3e93('0x1c')][_0x3e93('0x1f')]||null:null,'include':_0x8fad40[_0x3e93('0x1c')]?_0x8fad40[_0x3e93('0x1c')][_0x3e93('0x21')]?_[_0x3e93('0x23')](_0x8fad40[_0x3e93('0x1c')][_0x3e93('0x21')],function(_0x4df05d){return{'model':db[_0x4df05d['model']],'as':_0x4df05d['as'],'attributes':_0x4df05d[_0x3e93('0x1f')],'include':_0x4df05d[_0x3e93('0x21')]?_['map'](_0x4df05d[_0x3e93('0x21')],function(_0x49482f){return{'model':db[_0x49482f['model']],'as':_0x49482f['as'],'attributes':_0x49482f[_0x3e93('0x1f')],'include':_0x49482f[_0x3e93('0x21')]?_[_0x3e93('0x23')](_0x49482f[_0x3e93('0x21')],function(_0x4dc476){return{'model':db[_0x4dc476[_0x3e93('0x22')]],'as':_0x4dc476['as'],'attributes':_0x4dc476[_0x3e93('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3e93('0xd')](function(_0x225451){logger[_0x3e93('0x16')](_0x3e93('0x24'),_0x8fad40);logger[_0x3e93('0xf')]('ShowZendeskAccount',_0x8fad40,JSON[_0x3e93('0x11')](_0x225451));_0x576abf(_0x225451);})[_0x3e93('0x18')](function(_0x371614){logger[_0x3e93('0x12')](_0x3e93('0x24'),_0x371614[_0x3e93('0x14')],_0x8fad40);_0x44a5ae(_0x402f33[_0x3e93('0x12')](0x1f4,_0x371614[_0x3e93('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 9d5f5e5..ab3cf07 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 _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(_0x3a9497,_0x1f2bd5){var _0x438741=function(_0x533615){while(--_0x533615){_0x3a9497['push'](_0x3a9497['shift']());}};_0x438741(++_0x1f2bd5);}(_0xb10b,0x12a));var _0xbb10=function(_0x1c97c8,_0x28d564){_0x1c97c8=_0x1c97c8-0x0;var _0x2c096d=_0xb10b[_0x1c97c8];return _0x2c096d;};'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 +var _0xbdb7=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','index','get','show','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getTags','/:id/tags','update','delete','/:id'];(function(_0x151418,_0x2cbffa){var _0x40e29a=function(_0xec4d7){while(--_0xec4d7){_0x151418['push'](_0x151418['shift']());}};_0x40e29a(++_0x2cbffa);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x3fea84,_0x3e832f){_0x3fea84=_0x3fea84-0x0;var _0x20778a=_0xbdb7[_0x3fea84];return _0x20778a;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xb')](_0x7bdb('0xe'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0xb')](_0x7bdb('0x11'),auth[_0x7bdb('0xf')](),controller['getDescriptions']);router['get']('/:id/tags',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x12')]);router['post']('/',auth[_0x7bdb('0xf')](),controller['create']);router['post'](_0x7bdb('0x13'),auth[_0x7bdb('0xf')](),controller['setTags']);router['put']('/:id',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x14')]);router[_0x7bdb('0x15')](_0x7bdb('0x16'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x17')]);module[_0x7bdb('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 8344846..64e0232 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 _0x700c=['STRING','sequelize','exports'];(function(_0x950c48,_0x3acdaf){var _0x20398c=function(_0x1c5aa8){while(--_0x1c5aa8){_0x950c48['push'](_0x950c48['shift']());}};_0x20398c(++_0x3acdaf);}(_0x700c,0x7f));var _0xc700=function(_0x482f29,_0x50af2f){_0x482f29=_0x482f29-0x0;var _0x2b74b8=_0x700c[_0x482f29];return _0x2b74b8;};'use strict';var Sequelize=require(_0xc700('0x0'));module[_0xc700('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc700('0x2')]}}; \ No newline at end of file +var _0x839b=['STRING'];(function(_0x501fde,_0x1ee95c){var _0x248bbe=function(_0x55dca6){while(--_0x55dca6){_0x501fde['push'](_0x501fde['shift']());}};_0x248bbe(++_0x1ee95c);}(_0x839b,0x148));var _0xb839=function(_0x1902cb,_0xd04be9){_0x1902cb=_0x1902cb-0x0;var _0x38f5ea=_0x839b[_0x1902cb];return _0x38f5ea;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb839('0x0')]},'description':{'type':Sequelize[_0xb839('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index efa75b6..9467a24 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 _0x5564=['show','params','catch','create','body','find','getFields','ZendeskField','map','getSubjects','findOne','getDescriptions','getTags','setTags','ids','fast-json-patch','request-promise','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','ZendeskConfiguration','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows'];(function(_0x62a1b7,_0x277a85){var _0x4fd666=function(_0xa125e8){while(--_0xa125e8){_0x62a1b7['push'](_0x62a1b7['shift']());}};_0x4fd666(++_0x277a85);}(_0x5564,0x1a9));var _0x4556=function(_0x138379,_0x58ed3d){_0x138379=_0x138379-0x0;var _0x334b91=_0x5564[_0x138379];return _0x334b91;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4556('0x0'));var rp=require(_0x4556('0x1'));var moment=require('moment');var BPromise=require(_0x4556('0x2'));var Mustache=require(_0x4556('0x3'));var util=require(_0x4556('0x4'));var path=require(_0x4556('0x5'));var sox=require(_0x4556('0x6'));var csv=require(_0x4556('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4556('0x8'));var _=require(_0x4556('0x9'));var squel=require('squel');var crypto=require(_0x4556('0xa'));var jsforce=require(_0x4556('0xb'));var deskjs=require(_0x4556('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4556('0xd'));var Papa=require('papaparse');var Redis=require(_0x4556('0xe'));var authService=require(_0x4556('0xf'));var qs=require(_0x4556('0x10'));var as=require(_0x4556('0x11'));var hardwareService=require(_0x4556('0x12'));var logger=require(_0x4556('0x13'))(_0x4556('0x14'));var utils=require(_0x4556('0x15'));var config=require(_0x4556('0x16'));var licenseUtil=require(_0x4556('0x17'));var db=require(_0x4556('0x18'))['db'];function respondWithStatusCode(_0x509c38,_0x15bf99){_0x15bf99=_0x15bf99||0xcc;return function(_0x294585){if(_0x294585){return _0x509c38[_0x4556('0x19')](_0x15bf99);}return _0x509c38[_0x4556('0x1a')](_0x15bf99)['end']();};}function respondWithResult(_0x339f43,_0x34b37e){_0x34b37e=_0x34b37e||0xc8;return function(_0xe4cd95){if(_0xe4cd95){return _0x339f43[_0x4556('0x1a')](_0x34b37e)[_0x4556('0x1b')](_0xe4cd95);}};}function respondWithFilteredResult(_0x1b0e1a,_0x20f8e2){return function(_0x58df6f){if(_0x58df6f){var _0x28819e=typeof _0x20f8e2['offset']==='undefined'&&typeof _0x20f8e2['limit']===_0x4556('0x1c');var _0x2d8957=_0x58df6f['count'];var _0x47f117=_0x28819e?0x0:_0x20f8e2[_0x4556('0x1d')];var _0x7d325c=_0x28819e?_0x58df6f['count']:_0x20f8e2['offset']+_0x20f8e2['limit'];var _0x42986f;if(_0x7d325c>=_0x2d8957){_0x7d325c=_0x2d8957;_0x42986f=0xc8;}else{_0x42986f=0xce;}_0x1b0e1a[_0x4556('0x1a')](_0x42986f);return _0x1b0e1a[_0x4556('0x1e')](_0x4556('0x1f'),_0x47f117+'-'+_0x7d325c+'/'+_0x2d8957)['json'](_0x58df6f);}return null;};}function patchUpdates(_0xf828cd){return function(_0x32b3f3){try{jsonpatch[_0x4556('0x20')](_0x32b3f3,_0xf828cd,!![]);}catch(_0x2b2bf5){return BPromise[_0x4556('0x21')](_0x2b2bf5);}return _0x32b3f3[_0x4556('0x22')]();};}function saveUpdates(_0x1acafa,_0x5a69f1){return function(_0x189204){if(_0x189204){return _0x189204[_0x4556('0x23')](_0x1acafa)[_0x4556('0x24')](function(_0x2ae67c){return _0x2ae67c;});}return null;};}function removeEntity(_0x528888,_0x5c492e){return function(_0x2aab19){if(_0x2aab19){return _0x2aab19[_0x4556('0x25')]()[_0x4556('0x24')](function(){_0x528888[_0x4556('0x1a')](0xcc)[_0x4556('0x26')]();});}};}function handleEntityNotFound(_0x94522,_0x1c4eaa){return function(_0x1636a9){if(!_0x1636a9){_0x94522[_0x4556('0x19')](0x194);}return _0x1636a9;};}function handleError(_0x2dc544,_0x54664e){_0x54664e=_0x54664e||0x1f4;return function(_0x409ca8){logger['error'](_0x409ca8[_0x4556('0x27')]);if(_0x409ca8[_0x4556('0x28')]){delete _0x409ca8[_0x4556('0x28')];}_0x2dc544[_0x4556('0x1a')](_0x54664e)[_0x4556('0x29')](_0x409ca8);};}exports['index']=function(_0x741a7b,_0x2d596f){var _0x478288={},_0x369802={},_0x2bda9e={'count':0x0,'rows':[]};var _0x118e9b=_['map'](db[_0x4556('0x2a')][_0x4556('0x2b')],function(_0x247e7a){return{'name':_0x247e7a['fieldName'],'type':_0x247e7a[_0x4556('0x2c')]['key']};});_0x369802[_0x4556('0x2d')]=_['map'](_0x118e9b,'name');_0x369802['query']=_[_0x4556('0x2e')](_0x741a7b[_0x4556('0x2f')]);_0x369802[_0x4556('0x30')]=_[_0x4556('0x31')](_0x369802['model'],_0x369802['query']);_0x478288[_0x4556('0x32')]=_[_0x4556('0x31')](_0x369802[_0x4556('0x2d')],qs[_0x4556('0x33')](_0x741a7b[_0x4556('0x2f')][_0x4556('0x33')]));_0x478288[_0x4556('0x32')]=_0x478288[_0x4556('0x32')][_0x4556('0x34')]?_0x478288[_0x4556('0x32')]:_0x369802[_0x4556('0x2d')];if(!_0x741a7b[_0x4556('0x2f')][_0x4556('0x35')](_0x4556('0x36'))){_0x478288['limit']=qs['limit'](_0x741a7b['query'][_0x4556('0x37')]);_0x478288[_0x4556('0x1d')]=qs[_0x4556('0x1d')](_0x741a7b[_0x4556('0x2f')][_0x4556('0x1d')]);}_0x478288[_0x4556('0x38')]=qs['sort'](_0x741a7b[_0x4556('0x2f')][_0x4556('0x39')]);_0x478288[_0x4556('0x3a')]=qs[_0x4556('0x30')](_[_0x4556('0x3b')](_0x741a7b[_0x4556('0x2f')],_0x369802[_0x4556('0x30')]),_0x118e9b);if(_0x741a7b[_0x4556('0x2f')][_0x4556('0x3c')]){_0x478288[_0x4556('0x3a')]=_[_0x4556('0x3d')](_0x478288[_0x4556('0x3a')],{'$or':_['map'](_0x118e9b,function(_0x16ca92){if(_0x16ca92[_0x4556('0x2c')]!=='VIRTUAL'){var _0x44d76c={};_0x44d76c[_0x16ca92[_0x4556('0x28')]]={'$like':'%'+_0x741a7b[_0x4556('0x2f')][_0x4556('0x3c')]+'%'};return _0x44d76c;}})});}_0x478288=_['merge']({},_0x478288,_0x741a7b[_0x4556('0x3e')]);var _0x526cc7={'where':_0x478288['where']};return db[_0x4556('0x2a')]['count'](_0x526cc7)[_0x4556('0x24')](function(_0x33dca4){_0x2bda9e['count']=_0x33dca4;if(_0x741a7b[_0x4556('0x2f')][_0x4556('0x3f')]){_0x478288[_0x4556('0x40')]=[{'all':!![]}];}return db[_0x4556('0x2a')][_0x4556('0x41')](_0x478288);})[_0x4556('0x24')](function(_0x593639){_0x2bda9e[_0x4556('0x42')]=_0x593639;return _0x2bda9e;})[_0x4556('0x24')](respondWithFilteredResult(_0x2d596f,_0x478288))['catch'](handleError(_0x2d596f,null));};exports[_0x4556('0x43')]=function(_0x12f821,_0x2bbf75){var _0x799e54={'raw':![],'where':{'id':_0x12f821[_0x4556('0x44')]['id']}},_0x325f68={};_0x325f68['model']=_['keys'](db[_0x4556('0x2a')][_0x4556('0x2b')]);_0x325f68[_0x4556('0x2f')]=_[_0x4556('0x2e')](_0x12f821[_0x4556('0x2f')]);_0x325f68['filters']=_[_0x4556('0x31')](_0x325f68[_0x4556('0x2d')],_0x325f68[_0x4556('0x2f')]);_0x799e54['attributes']=_['intersection'](_0x325f68['model'],qs[_0x4556('0x33')](_0x12f821[_0x4556('0x2f')][_0x4556('0x33')]));_0x799e54[_0x4556('0x32')]=_0x799e54['attributes'][_0x4556('0x34')]?_0x799e54[_0x4556('0x32')]:_0x325f68[_0x4556('0x2d')];if(_0x12f821[_0x4556('0x2f')][_0x4556('0x3f')]){_0x799e54[_0x4556('0x40')]=[{'all':!![]}];}_0x799e54=_['merge']({},_0x799e54,_0x12f821[_0x4556('0x3e')]);return db[_0x4556('0x2a')]['find'](_0x799e54)[_0x4556('0x24')](handleEntityNotFound(_0x2bbf75,null))[_0x4556('0x24')](respondWithResult(_0x2bbf75,null))[_0x4556('0x45')](handleError(_0x2bbf75,null));};exports[_0x4556('0x46')]=function(_0x4b2e96,_0xe925cf){return db[_0x4556('0x2a')][_0x4556('0x46')](_0x4b2e96[_0x4556('0x47')],{})[_0x4556('0x24')](respondWithResult(_0xe925cf,0xc9))[_0x4556('0x45')](handleError(_0xe925cf,null));};exports[_0x4556('0x23')]=function(_0x35ca36,_0x877b9c){if(_0x35ca36['body']['id']){delete _0x35ca36[_0x4556('0x47')]['id'];}return db[_0x4556('0x2a')][_0x4556('0x48')]({'where':{'id':_0x35ca36['params']['id']}})[_0x4556('0x24')](handleEntityNotFound(_0x877b9c,null))[_0x4556('0x24')](saveUpdates(_0x35ca36['body'],null))['then'](respondWithResult(_0x877b9c,null))[_0x4556('0x45')](handleError(_0x877b9c,null));};exports[_0x4556('0x25')]=function(_0x2ad512,_0x1793c0){return db[_0x4556('0x2a')]['find']({'where':{'id':_0x2ad512['params']['id']}})[_0x4556('0x24')](handleEntityNotFound(_0x1793c0,null))[_0x4556('0x24')](removeEntity(_0x1793c0,null))[_0x4556('0x45')](handleError(_0x1793c0,null));};exports[_0x4556('0x49')]=function(_0x71fc4c,_0x2385ab,_0x2381da){var _0x1df25c={};var _0x5217c7={};var _0x507394;var _0x532a9d;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x71fc4c[_0x4556('0x44')]['id']}})[_0x4556('0x24')](handleEntityNotFound(_0x2385ab,null))['then'](function(_0x1f6d75){if(_0x1f6d75){_0x507394=_0x1f6d75;_0x5217c7[_0x4556('0x2d')]=_[_0x4556('0x2e')](db[_0x4556('0x4a')][_0x4556('0x2b')]);_0x5217c7[_0x4556('0x2f')]=_[_0x4556('0x2e')](_0x71fc4c[_0x4556('0x2f')]);_0x5217c7['filters']=_[_0x4556('0x31')](_0x5217c7[_0x4556('0x2d')],_0x5217c7[_0x4556('0x2f')]);_0x1df25c[_0x4556('0x32')]=_[_0x4556('0x31')](_0x5217c7[_0x4556('0x2d')],qs['fields'](_0x71fc4c[_0x4556('0x2f')][_0x4556('0x33')]));_0x1df25c['attributes']=_0x1df25c[_0x4556('0x32')][_0x4556('0x34')]?_0x1df25c[_0x4556('0x32')]:_0x5217c7[_0x4556('0x2d')];_0x1df25c[_0x4556('0x38')]=qs[_0x4556('0x39')](_0x71fc4c[_0x4556('0x2f')][_0x4556('0x39')]);_0x1df25c['where']=qs['filters'](_[_0x4556('0x3b')](_0x71fc4c['query'],_0x5217c7[_0x4556('0x30')]));if(_0x71fc4c['query'][_0x4556('0x3c')]){_0x1df25c[_0x4556('0x3a')]=_[_0x4556('0x3d')](_0x1df25c[_0x4556('0x3a')],{'$or':_[_0x4556('0x4b')](_0x1df25c['attributes'],function(_0xfd0c92){var _0x3a7624={};_0x3a7624[_0xfd0c92]={'$like':'%'+_0x71fc4c[_0x4556('0x2f')]['filter']+'%'};return _0x3a7624;})});}_0x1df25c=_[_0x4556('0x3d')]({},_0x1df25c,_0x71fc4c[_0x4556('0x3e')]);return _0x507394[_0x4556('0x49')](_0x1df25c);}})['then'](function(_0x50cf3f){if(_0x50cf3f){_0x532a9d=_0x50cf3f['length'];if(!_0x71fc4c['query'][_0x4556('0x35')]('nolimit')){_0x1df25c[_0x4556('0x37')]=qs[_0x4556('0x37')](_0x71fc4c[_0x4556('0x2f')][_0x4556('0x37')]);_0x1df25c[_0x4556('0x1d')]=qs[_0x4556('0x1d')](_0x71fc4c['query'][_0x4556('0x1d')]);}return _0x507394[_0x4556('0x49')](_0x1df25c);}})[_0x4556('0x24')](function(_0x163de2){if(_0x163de2){return _0x163de2?{'count':_0x532a9d,'rows':_0x163de2}:null;}})[_0x4556('0x24')](respondWithResult(_0x2385ab,null))['catch'](handleError(_0x2385ab,null));};exports[_0x4556('0x4c')]=function(_0x315722,_0x3f2f6b,_0x43cbb4){var _0x3dff24={};var _0x12d619={};var _0x183639;var _0x2557de;return db[_0x4556('0x2a')][_0x4556('0x4d')]({'where':{'id':_0x315722[_0x4556('0x44')]['id']}})[_0x4556('0x24')](handleEntityNotFound(_0x3f2f6b,null))[_0x4556('0x24')](function(_0xf0f5d9){if(_0xf0f5d9){_0x183639=_0xf0f5d9;_0x12d619[_0x4556('0x2d')]=_[_0x4556('0x2e')](db[_0x4556('0x4a')][_0x4556('0x2b')]);_0x12d619['query']=_[_0x4556('0x2e')](_0x315722[_0x4556('0x2f')]);_0x12d619[_0x4556('0x30')]=_['intersection'](_0x12d619[_0x4556('0x2d')],_0x12d619['query']);_0x3dff24['attributes']=_['intersection'](_0x12d619[_0x4556('0x2d')],qs['fields'](_0x315722[_0x4556('0x2f')][_0x4556('0x33')]));_0x3dff24[_0x4556('0x32')]=_0x3dff24[_0x4556('0x32')][_0x4556('0x34')]?_0x3dff24[_0x4556('0x32')]:_0x12d619[_0x4556('0x2d')];_0x3dff24[_0x4556('0x38')]=qs[_0x4556('0x39')](_0x315722[_0x4556('0x2f')][_0x4556('0x39')]);_0x3dff24[_0x4556('0x3a')]=qs['filters'](_['pick'](_0x315722['query'],_0x12d619[_0x4556('0x30')]));if(_0x315722[_0x4556('0x2f')][_0x4556('0x3c')]){_0x3dff24[_0x4556('0x3a')]=_['merge'](_0x3dff24[_0x4556('0x3a')],{'$or':_[_0x4556('0x4b')](_0x3dff24[_0x4556('0x32')],function(_0x26f46d){var _0x2e0e70={};_0x2e0e70[_0x26f46d]={'$like':'%'+_0x315722[_0x4556('0x2f')][_0x4556('0x3c')]+'%'};return _0x2e0e70;})});}_0x3dff24=_[_0x4556('0x3d')]({},_0x3dff24,_0x315722[_0x4556('0x3e')]);return _0x183639[_0x4556('0x4c')](_0x3dff24);}})[_0x4556('0x24')](function(_0x31c72f){if(_0x31c72f){_0x2557de=_0x31c72f[_0x4556('0x34')];if(!_0x315722[_0x4556('0x2f')]['hasOwnProperty'](_0x4556('0x36'))){_0x3dff24[_0x4556('0x37')]=qs[_0x4556('0x37')](_0x315722[_0x4556('0x2f')][_0x4556('0x37')]);_0x3dff24[_0x4556('0x1d')]=qs[_0x4556('0x1d')](_0x315722[_0x4556('0x2f')]['offset']);}return _0x183639[_0x4556('0x4c')](_0x3dff24);}})[_0x4556('0x24')](function(_0x1c1424){if(_0x1c1424){return _0x1c1424?{'count':_0x2557de,'rows':_0x1c1424}:null;}})[_0x4556('0x24')](respondWithResult(_0x3f2f6b,null))[_0x4556('0x45')](handleError(_0x3f2f6b,null));};exports[_0x4556('0x4e')]=function(_0x2ae031,_0x6accf1,_0x34c9cb){var _0x16c390={};var _0x33ed06={};var _0x56f17b;var _0x5a2006;return db[_0x4556('0x2a')][_0x4556('0x4d')]({'where':{'id':_0x2ae031['params']['id']}})[_0x4556('0x24')](handleEntityNotFound(_0x6accf1,null))[_0x4556('0x24')](function(_0x3bb49a){if(_0x3bb49a){_0x56f17b=_0x3bb49a;_0x33ed06[_0x4556('0x2d')]=_[_0x4556('0x2e')](db[_0x4556('0x4a')][_0x4556('0x2b')]);_0x33ed06[_0x4556('0x2f')]=_['keys'](_0x2ae031[_0x4556('0x2f')]);_0x33ed06[_0x4556('0x30')]=_[_0x4556('0x31')](_0x33ed06[_0x4556('0x2d')],_0x33ed06[_0x4556('0x2f')]);_0x16c390[_0x4556('0x32')]=_[_0x4556('0x31')](_0x33ed06['model'],qs['fields'](_0x2ae031['query'][_0x4556('0x33')]));_0x16c390[_0x4556('0x32')]=_0x16c390[_0x4556('0x32')][_0x4556('0x34')]?_0x16c390[_0x4556('0x32')]:_0x33ed06['model'];_0x16c390[_0x4556('0x38')]=qs[_0x4556('0x39')](_0x2ae031['query'][_0x4556('0x39')]);_0x16c390[_0x4556('0x3a')]=qs[_0x4556('0x30')](_['pick'](_0x2ae031[_0x4556('0x2f')],_0x33ed06['filters']));if(_0x2ae031[_0x4556('0x2f')][_0x4556('0x3c')]){_0x16c390[_0x4556('0x3a')]=_[_0x4556('0x3d')](_0x16c390[_0x4556('0x3a')],{'$or':_[_0x4556('0x4b')](_0x16c390['attributes'],function(_0xfa5dd7){var _0x1fb1cd={};_0x1fb1cd[_0xfa5dd7]={'$like':'%'+_0x2ae031[_0x4556('0x2f')]['filter']+'%'};return _0x1fb1cd;})});}_0x16c390=_['merge']({},_0x16c390,_0x2ae031[_0x4556('0x3e')]);return _0x56f17b[_0x4556('0x4e')](_0x16c390);}})[_0x4556('0x24')](function(_0x35f2f1){if(_0x35f2f1){_0x5a2006=_0x35f2f1[_0x4556('0x34')];if(!_0x2ae031[_0x4556('0x2f')][_0x4556('0x35')](_0x4556('0x36'))){_0x16c390[_0x4556('0x37')]=qs[_0x4556('0x37')](_0x2ae031[_0x4556('0x2f')][_0x4556('0x37')]);_0x16c390[_0x4556('0x1d')]=qs[_0x4556('0x1d')](_0x2ae031[_0x4556('0x2f')][_0x4556('0x1d')]);}return _0x56f17b[_0x4556('0x4e')](_0x16c390);}})[_0x4556('0x24')](function(_0x41903a){if(_0x41903a){return _0x41903a?{'count':_0x5a2006,'rows':_0x41903a}:null;}})[_0x4556('0x24')](respondWithResult(_0x6accf1,null))[_0x4556('0x45')](handleError(_0x6accf1,null));};exports[_0x4556('0x4f')]=function(_0x3d5adc,_0x4b8b79,_0x1e2eeb){var _0x10ec4a={};var _0x27c307={};var _0x438229;var _0x3aa62e;return db[_0x4556('0x2a')]['findOne']({'where':{'id':_0x3d5adc[_0x4556('0x44')]['id']}})[_0x4556('0x24')](handleEntityNotFound(_0x4b8b79,null))[_0x4556('0x24')](function(_0xbd4a7c){if(_0xbd4a7c){_0x438229=_0xbd4a7c;_0x27c307[_0x4556('0x2d')]=_[_0x4556('0x2e')](db['Tag'][_0x4556('0x2b')]);_0x27c307[_0x4556('0x2f')]=_[_0x4556('0x2e')](_0x3d5adc[_0x4556('0x2f')]);_0x27c307[_0x4556('0x30')]=_[_0x4556('0x31')](_0x27c307[_0x4556('0x2d')],_0x27c307['query']);_0x10ec4a['attributes']=_[_0x4556('0x31')](_0x27c307[_0x4556('0x2d')],qs[_0x4556('0x33')](_0x3d5adc[_0x4556('0x2f')]['fields']));_0x10ec4a['attributes']=_0x10ec4a[_0x4556('0x32')][_0x4556('0x34')]?_0x10ec4a[_0x4556('0x32')]:_0x27c307[_0x4556('0x2d')];_0x10ec4a[_0x4556('0x38')]=qs[_0x4556('0x39')](_0x3d5adc[_0x4556('0x2f')][_0x4556('0x39')]);_0x10ec4a[_0x4556('0x3a')]=qs[_0x4556('0x30')](_['pick'](_0x3d5adc['query'],_0x27c307[_0x4556('0x30')]));if(_0x3d5adc[_0x4556('0x2f')]['filter']){_0x10ec4a[_0x4556('0x3a')]=_[_0x4556('0x3d')](_0x10ec4a['where'],{'$or':_['map'](_0x10ec4a['attributes'],function(_0x8acaa1){var _0x2717eb={};_0x2717eb[_0x8acaa1]={'$like':'%'+_0x3d5adc[_0x4556('0x2f')][_0x4556('0x3c')]+'%'};return _0x2717eb;})});}_0x10ec4a=_[_0x4556('0x3d')]({},_0x10ec4a,_0x3d5adc['options']);return _0x438229['getTags'](_0x10ec4a);}})[_0x4556('0x24')](function(_0x4571bd){if(_0x4571bd){_0x3aa62e=_0x4571bd[_0x4556('0x34')];if(!_0x3d5adc[_0x4556('0x2f')][_0x4556('0x35')](_0x4556('0x36'))){_0x10ec4a[_0x4556('0x37')]=qs[_0x4556('0x37')](_0x3d5adc[_0x4556('0x2f')][_0x4556('0x37')]);_0x10ec4a[_0x4556('0x1d')]=qs[_0x4556('0x1d')](_0x3d5adc[_0x4556('0x2f')][_0x4556('0x1d')]);}return _0x438229['getTags'](_0x10ec4a);}})[_0x4556('0x24')](function(_0x3684b0){if(_0x3684b0){return _0x3684b0?{'count':_0x3aa62e,'rows':_0x3684b0}:null;}})[_0x4556('0x24')](respondWithResult(_0x4b8b79,null))[_0x4556('0x45')](handleError(_0x4b8b79,null));};exports[_0x4556('0x50')]=function(_0x1b7baf,_0x16e457,_0x228839){if(_0x1b7baf[_0x4556('0x47')]['id']){delete _0x1b7baf[_0x4556('0x47')]['id'];}return db['ZendeskConfiguration'][_0x4556('0x4d')]({'where':{'id':_0x1b7baf[_0x4556('0x44')]['id']}})[_0x4556('0x24')](handleEntityNotFound(_0x16e457,null))['then'](function(_0x1b5c51){if(_0x1b5c51){return _0x1b5c51[_0x4556('0x50')](_0x1b7baf[_0x4556('0x47')][_0x4556('0x51')]||[]);}return null;})[_0x4556('0x24')](respondWithResult(_0x16e457,null))[_0x4556('0x45')](handleError(_0x16e457,null));}; \ No newline at end of file +var _0x46ce=['fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','includeAll','body','find','getFields','findOne','where','options','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','update','then','destroy','error','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes'];(function(_0x14b3b6,_0x30a251){var _0x4fe802=function(_0x33f2ff){while(--_0x33f2ff){_0x14b3b6['push'](_0x14b3b6['shift']());}};_0x4fe802(++_0x30a251);}(_0x46ce,0x69));var _0xe46c=function(_0x33333d,_0x13bb99){_0x33333d=_0x33333d-0x0;var _0x5b0a52=_0x46ce[_0x33333d];return _0x5b0a52;};'use strict';var emlformat=require(_0xe46c('0x0'));var rimraf=require(_0xe46c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe46c('0x2'));var rp=require(_0xe46c('0x3'));var moment=require(_0xe46c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe46c('0x5'));var path=require(_0xe46c('0x6'));var sox=require('sox');var csv=require(_0xe46c('0x7'));var ejs=require(_0xe46c('0x8'));var fs=require('fs');var fs_extra=require(_0xe46c('0x9'));var _=require(_0xe46c('0xa'));var squel=require('squel');var crypto=require(_0xe46c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe46c('0xc'));var toCsv=require(_0xe46c('0x7'));var querystring=require(_0xe46c('0xd'));var Papa=require(_0xe46c('0xe'));var Redis=require(_0xe46c('0xf'));var authService=require(_0xe46c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe46c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe46c('0x12'))(_0xe46c('0x13'));var utils=require(_0xe46c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe46c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bd322,_0x15302f){_0x15302f=_0x15302f||0xcc;return function(_0x2b73f3){if(_0x2b73f3){return _0x4bd322[_0xe46c('0x16')](_0x15302f);}return _0x4bd322[_0xe46c('0x17')](_0x15302f)[_0xe46c('0x18')]();};}function respondWithResult(_0x1229f3,_0x114a21){_0x114a21=_0x114a21||0xc8;return function(_0x54bca0){if(_0x54bca0){return _0x1229f3[_0xe46c('0x17')](_0x114a21)['json'](_0x54bca0);}};}function respondWithFilteredResult(_0x1ae5d8,_0x15a776){return function(_0x38b632){if(_0x38b632){var _0x3fd80a=typeof _0x15a776[_0xe46c('0x19')]===_0xe46c('0x1a')&&typeof _0x15a776['limit']===_0xe46c('0x1a');var _0x242cc3=_0x38b632['count'];var _0x5831f3=_0x3fd80a?0x0:_0x15a776[_0xe46c('0x19')];var _0x36a346=_0x3fd80a?_0x38b632[_0xe46c('0x1b')]:_0x15a776[_0xe46c('0x19')]+_0x15a776[_0xe46c('0x1c')];var _0x595b6a;if(_0x36a346>=_0x242cc3){_0x36a346=_0x242cc3;_0x595b6a=0xc8;}else{_0x595b6a=0xce;}_0x1ae5d8[_0xe46c('0x17')](_0x595b6a);return _0x1ae5d8[_0xe46c('0x1d')](_0xe46c('0x1e'),_0x5831f3+'-'+_0x36a346+'/'+_0x242cc3)[_0xe46c('0x1f')](_0x38b632);}return null;};}function patchUpdates(_0x44cccd){return function(_0x4cce0f){try{jsonpatch[_0xe46c('0x20')](_0x4cce0f,_0x44cccd,!![]);}catch(_0x590650){return BPromise['reject'](_0x590650);}return _0x4cce0f['save']();};}function saveUpdates(_0x21f6e6,_0x241937){return function(_0x190bc6){if(_0x190bc6){return _0x190bc6[_0xe46c('0x21')](_0x21f6e6)[_0xe46c('0x22')](function(_0x1a3bf9){return _0x1a3bf9;});}return null;};}function removeEntity(_0x21a83a,_0xe00f1d){return function(_0x53d995){if(_0x53d995){return _0x53d995[_0xe46c('0x23')]()[_0xe46c('0x22')](function(){_0x21a83a[_0xe46c('0x17')](0xcc)[_0xe46c('0x18')]();});}};}function handleEntityNotFound(_0xf284d5,_0x212318){return function(_0x30a1c4){if(!_0x30a1c4){_0xf284d5['sendStatus'](0x194);}return _0x30a1c4;};}function handleError(_0x10ed8d,_0x106223){_0x106223=_0x106223||0x1f4;return function(_0x4e17c8){logger[_0xe46c('0x24')](_0x4e17c8['stack']);if(_0x4e17c8[_0xe46c('0x25')]){delete _0x4e17c8[_0xe46c('0x25')];}_0x10ed8d[_0xe46c('0x17')](_0x106223)[_0xe46c('0x26')](_0x4e17c8);};}exports[_0xe46c('0x27')]=function(_0xbd7f43,_0x33bf91){var _0x3ff962={},_0x465e31={},_0x162344={'count':0x0,'rows':[]};var _0x202111=_['map'](db[_0xe46c('0x28')][_0xe46c('0x29')],function(_0x31f1e1){return{'name':_0x31f1e1[_0xe46c('0x2a')],'type':_0x31f1e1['type'][_0xe46c('0x2b')]};});_0x465e31[_0xe46c('0x2c')]=_[_0xe46c('0x2d')](_0x202111,'name');_0x465e31[_0xe46c('0x2e')]=_[_0xe46c('0x2f')](_0xbd7f43[_0xe46c('0x2e')]);_0x465e31[_0xe46c('0x30')]=_[_0xe46c('0x31')](_0x465e31[_0xe46c('0x2c')],_0x465e31[_0xe46c('0x2e')]);_0x3ff962[_0xe46c('0x32')]=_[_0xe46c('0x31')](_0x465e31['model'],qs[_0xe46c('0x33')](_0xbd7f43[_0xe46c('0x2e')][_0xe46c('0x33')]));_0x3ff962[_0xe46c('0x32')]=_0x3ff962[_0xe46c('0x32')][_0xe46c('0x34')]?_0x3ff962[_0xe46c('0x32')]:_0x465e31['model'];if(!_0xbd7f43[_0xe46c('0x2e')][_0xe46c('0x35')](_0xe46c('0x36'))){_0x3ff962[_0xe46c('0x1c')]=qs[_0xe46c('0x1c')](_0xbd7f43[_0xe46c('0x2e')][_0xe46c('0x1c')]);_0x3ff962[_0xe46c('0x19')]=qs[_0xe46c('0x19')](_0xbd7f43[_0xe46c('0x2e')][_0xe46c('0x19')]);}_0x3ff962[_0xe46c('0x37')]=qs[_0xe46c('0x38')](_0xbd7f43[_0xe46c('0x2e')][_0xe46c('0x38')]);_0x3ff962['where']=qs[_0xe46c('0x30')](_[_0xe46c('0x39')](_0xbd7f43[_0xe46c('0x2e')],_0x465e31[_0xe46c('0x30')]),_0x202111);if(_0xbd7f43[_0xe46c('0x2e')][_0xe46c('0x3a')]){_0x3ff962['where']=_[_0xe46c('0x3b')](_0x3ff962['where'],{'$or':_[_0xe46c('0x2d')](_0x202111,function(_0x5bbdd3){if(_0x5bbdd3['type']!==_0xe46c('0x3c')){var _0x2b6610={};_0x2b6610[_0x5bbdd3[_0xe46c('0x25')]]={'$like':'%'+_0xbd7f43[_0xe46c('0x2e')][_0xe46c('0x3a')]+'%'};return _0x2b6610;}})});}_0x3ff962=_[_0xe46c('0x3b')]({},_0x3ff962,_0xbd7f43['options']);var _0x4c9818={'where':_0x3ff962['where']};return db[_0xe46c('0x28')][_0xe46c('0x1b')](_0x4c9818)[_0xe46c('0x22')](function(_0x1b63b0){_0x162344[_0xe46c('0x1b')]=_0x1b63b0;if(_0xbd7f43[_0xe46c('0x2e')]['includeAll']){_0x3ff962[_0xe46c('0x3d')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xe46c('0x3e')](_0x3ff962);})[_0xe46c('0x22')](function(_0x277d6a){_0x162344['rows']=_0x277d6a;return _0x162344;})[_0xe46c('0x22')](respondWithFilteredResult(_0x33bf91,_0x3ff962))[_0xe46c('0x3f')](handleError(_0x33bf91,null));};exports[_0xe46c('0x40')]=function(_0x3a6ab3,_0x5d31de){var _0x3c978={'raw':![],'where':{'id':_0x3a6ab3[_0xe46c('0x41')]['id']}},_0x11074a={};_0x11074a[_0xe46c('0x2c')]=_['keys'](db[_0xe46c('0x28')][_0xe46c('0x29')]);_0x11074a['query']=_[_0xe46c('0x2f')](_0x3a6ab3[_0xe46c('0x2e')]);_0x11074a['filters']=_[_0xe46c('0x31')](_0x11074a[_0xe46c('0x2c')],_0x11074a[_0xe46c('0x2e')]);_0x3c978['attributes']=_[_0xe46c('0x31')](_0x11074a[_0xe46c('0x2c')],qs['fields'](_0x3a6ab3[_0xe46c('0x2e')][_0xe46c('0x33')]));_0x3c978[_0xe46c('0x32')]=_0x3c978['attributes'][_0xe46c('0x34')]?_0x3c978[_0xe46c('0x32')]:_0x11074a[_0xe46c('0x2c')];if(_0x3a6ab3['query'][_0xe46c('0x42')]){_0x3c978['include']=[{'all':!![]}];}_0x3c978=_['merge']({},_0x3c978,_0x3a6ab3['options']);return db[_0xe46c('0x28')]['find'](_0x3c978)[_0xe46c('0x22')](handleEntityNotFound(_0x5d31de,null))[_0xe46c('0x22')](respondWithResult(_0x5d31de,null))[_0xe46c('0x3f')](handleError(_0x5d31de,null));};exports['create']=function(_0x171d27,_0x4ba2d8){return db[_0xe46c('0x28')]['create'](_0x171d27[_0xe46c('0x43')],{})[_0xe46c('0x22')](respondWithResult(_0x4ba2d8,0xc9))['catch'](handleError(_0x4ba2d8,null));};exports['update']=function(_0x4cdf46,_0x3f5237){if(_0x4cdf46['body']['id']){delete _0x4cdf46[_0xe46c('0x43')]['id'];}return db[_0xe46c('0x28')][_0xe46c('0x44')]({'where':{'id':_0x4cdf46[_0xe46c('0x41')]['id']}})[_0xe46c('0x22')](handleEntityNotFound(_0x3f5237,null))[_0xe46c('0x22')](saveUpdates(_0x4cdf46[_0xe46c('0x43')],null))[_0xe46c('0x22')](respondWithResult(_0x3f5237,null))['catch'](handleError(_0x3f5237,null));};exports[_0xe46c('0x23')]=function(_0x4f5e26,_0x3bc451){return db['ZendeskConfiguration'][_0xe46c('0x44')]({'where':{'id':_0x4f5e26[_0xe46c('0x41')]['id']}})['then'](handleEntityNotFound(_0x3bc451,null))[_0xe46c('0x22')](removeEntity(_0x3bc451,null))[_0xe46c('0x3f')](handleError(_0x3bc451,null));};exports[_0xe46c('0x45')]=function(_0x548313,_0xe4ed60,_0x22c016){var _0x2d31f5={};var _0x1d30f1={};var _0x191b02;var _0x4478d4;return db[_0xe46c('0x28')][_0xe46c('0x46')]({'where':{'id':_0x548313['params']['id']}})[_0xe46c('0x22')](handleEntityNotFound(_0xe4ed60,null))[_0xe46c('0x22')](function(_0x2acebe){if(_0x2acebe){_0x191b02=_0x2acebe;_0x1d30f1[_0xe46c('0x2c')]=_[_0xe46c('0x2f')](db['ZendeskField'][_0xe46c('0x29')]);_0x1d30f1[_0xe46c('0x2e')]=_[_0xe46c('0x2f')](_0x548313[_0xe46c('0x2e')]);_0x1d30f1[_0xe46c('0x30')]=_[_0xe46c('0x31')](_0x1d30f1[_0xe46c('0x2c')],_0x1d30f1['query']);_0x2d31f5[_0xe46c('0x32')]=_[_0xe46c('0x31')](_0x1d30f1[_0xe46c('0x2c')],qs['fields'](_0x548313['query']['fields']));_0x2d31f5[_0xe46c('0x32')]=_0x2d31f5[_0xe46c('0x32')][_0xe46c('0x34')]?_0x2d31f5[_0xe46c('0x32')]:_0x1d30f1[_0xe46c('0x2c')];_0x2d31f5['order']=qs[_0xe46c('0x38')](_0x548313[_0xe46c('0x2e')][_0xe46c('0x38')]);_0x2d31f5[_0xe46c('0x47')]=qs[_0xe46c('0x30')](_[_0xe46c('0x39')](_0x548313[_0xe46c('0x2e')],_0x1d30f1[_0xe46c('0x30')]));if(_0x548313['query']['filter']){_0x2d31f5[_0xe46c('0x47')]=_[_0xe46c('0x3b')](_0x2d31f5['where'],{'$or':_[_0xe46c('0x2d')](_0x2d31f5['attributes'],function(_0x5494e4){var _0x39e538={};_0x39e538[_0x5494e4]={'$like':'%'+_0x548313[_0xe46c('0x2e')]['filter']+'%'};return _0x39e538;})});}_0x2d31f5=_[_0xe46c('0x3b')]({},_0x2d31f5,_0x548313[_0xe46c('0x48')]);return _0x191b02[_0xe46c('0x45')](_0x2d31f5);}})[_0xe46c('0x22')](function(_0x3a22cb){if(_0x3a22cb){_0x4478d4=_0x3a22cb['length'];if(!_0x548313['query'][_0xe46c('0x35')](_0xe46c('0x36'))){_0x2d31f5[_0xe46c('0x1c')]=qs[_0xe46c('0x1c')](_0x548313['query']['limit']);_0x2d31f5[_0xe46c('0x19')]=qs[_0xe46c('0x19')](_0x548313[_0xe46c('0x2e')][_0xe46c('0x19')]);}return _0x191b02['getFields'](_0x2d31f5);}})[_0xe46c('0x22')](function(_0x20e72a){if(_0x20e72a){return _0x20e72a?{'count':_0x4478d4,'rows':_0x20e72a}:null;}})[_0xe46c('0x22')](respondWithResult(_0xe4ed60,null))[_0xe46c('0x3f')](handleError(_0xe4ed60,null));};exports[_0xe46c('0x49')]=function(_0x35e584,_0x1f765a,_0x47acad){var _0x45b46d={};var _0x284c30={};var _0x30bf5d;var _0x203c45;return db['ZendeskConfiguration'][_0xe46c('0x46')]({'where':{'id':_0x35e584[_0xe46c('0x41')]['id']}})[_0xe46c('0x22')](handleEntityNotFound(_0x1f765a,null))[_0xe46c('0x22')](function(_0x2d9e4c){if(_0x2d9e4c){_0x30bf5d=_0x2d9e4c;_0x284c30[_0xe46c('0x2c')]=_[_0xe46c('0x2f')](db['ZendeskField'][_0xe46c('0x29')]);_0x284c30[_0xe46c('0x2e')]=_[_0xe46c('0x2f')](_0x35e584['query']);_0x284c30[_0xe46c('0x30')]=_[_0xe46c('0x31')](_0x284c30[_0xe46c('0x2c')],_0x284c30[_0xe46c('0x2e')]);_0x45b46d[_0xe46c('0x32')]=_[_0xe46c('0x31')](_0x284c30[_0xe46c('0x2c')],qs[_0xe46c('0x33')](_0x35e584[_0xe46c('0x2e')]['fields']));_0x45b46d[_0xe46c('0x32')]=_0x45b46d[_0xe46c('0x32')][_0xe46c('0x34')]?_0x45b46d[_0xe46c('0x32')]:_0x284c30[_0xe46c('0x2c')];_0x45b46d['order']=qs[_0xe46c('0x38')](_0x35e584[_0xe46c('0x2e')]['sort']);_0x45b46d[_0xe46c('0x47')]=qs[_0xe46c('0x30')](_[_0xe46c('0x39')](_0x35e584[_0xe46c('0x2e')],_0x284c30[_0xe46c('0x30')]));if(_0x35e584['query'][_0xe46c('0x3a')]){_0x45b46d[_0xe46c('0x47')]=_[_0xe46c('0x3b')](_0x45b46d['where'],{'$or':_[_0xe46c('0x2d')](_0x45b46d[_0xe46c('0x32')],function(_0x2b2123){var _0x134be7={};_0x134be7[_0x2b2123]={'$like':'%'+_0x35e584['query'][_0xe46c('0x3a')]+'%'};return _0x134be7;})});}_0x45b46d=_[_0xe46c('0x3b')]({},_0x45b46d,_0x35e584[_0xe46c('0x48')]);return _0x30bf5d[_0xe46c('0x49')](_0x45b46d);}})['then'](function(_0x2f7a85){if(_0x2f7a85){_0x203c45=_0x2f7a85['length'];if(!_0x35e584[_0xe46c('0x2e')]['hasOwnProperty'](_0xe46c('0x36'))){_0x45b46d[_0xe46c('0x1c')]=qs['limit'](_0x35e584[_0xe46c('0x2e')][_0xe46c('0x1c')]);_0x45b46d[_0xe46c('0x19')]=qs['offset'](_0x35e584['query'][_0xe46c('0x19')]);}return _0x30bf5d['getSubjects'](_0x45b46d);}})[_0xe46c('0x22')](function(_0x3f2237){if(_0x3f2237){return _0x3f2237?{'count':_0x203c45,'rows':_0x3f2237}:null;}})['then'](respondWithResult(_0x1f765a,null))['catch'](handleError(_0x1f765a,null));};exports[_0xe46c('0x4a')]=function(_0x12fe84,_0x1edaf7,_0x5f39cb){var _0x38ce50={};var _0x57e44a={};var _0x1ba8dc;var _0x250a09;return db['ZendeskConfiguration'][_0xe46c('0x46')]({'where':{'id':_0x12fe84[_0xe46c('0x41')]['id']}})['then'](handleEntityNotFound(_0x1edaf7,null))[_0xe46c('0x22')](function(_0xe331cb){if(_0xe331cb){_0x1ba8dc=_0xe331cb;_0x57e44a['model']=_['keys'](db['ZendeskField']['rawAttributes']);_0x57e44a[_0xe46c('0x2e')]=_[_0xe46c('0x2f')](_0x12fe84[_0xe46c('0x2e')]);_0x57e44a['filters']=_[_0xe46c('0x31')](_0x57e44a['model'],_0x57e44a[_0xe46c('0x2e')]);_0x38ce50[_0xe46c('0x32')]=_[_0xe46c('0x31')](_0x57e44a[_0xe46c('0x2c')],qs[_0xe46c('0x33')](_0x12fe84[_0xe46c('0x2e')][_0xe46c('0x33')]));_0x38ce50[_0xe46c('0x32')]=_0x38ce50[_0xe46c('0x32')][_0xe46c('0x34')]?_0x38ce50[_0xe46c('0x32')]:_0x57e44a[_0xe46c('0x2c')];_0x38ce50['order']=qs['sort'](_0x12fe84[_0xe46c('0x2e')][_0xe46c('0x38')]);_0x38ce50['where']=qs[_0xe46c('0x30')](_[_0xe46c('0x39')](_0x12fe84['query'],_0x57e44a[_0xe46c('0x30')]));if(_0x12fe84[_0xe46c('0x2e')]['filter']){_0x38ce50[_0xe46c('0x47')]=_[_0xe46c('0x3b')](_0x38ce50[_0xe46c('0x47')],{'$or':_[_0xe46c('0x2d')](_0x38ce50[_0xe46c('0x32')],function(_0xc97a2b){var _0x5e5b1f={};_0x5e5b1f[_0xc97a2b]={'$like':'%'+_0x12fe84[_0xe46c('0x2e')][_0xe46c('0x3a')]+'%'};return _0x5e5b1f;})});}_0x38ce50=_['merge']({},_0x38ce50,_0x12fe84[_0xe46c('0x48')]);return _0x1ba8dc[_0xe46c('0x4a')](_0x38ce50);}})[_0xe46c('0x22')](function(_0xf2a3c8){if(_0xf2a3c8){_0x250a09=_0xf2a3c8['length'];if(!_0x12fe84[_0xe46c('0x2e')][_0xe46c('0x35')](_0xe46c('0x36'))){_0x38ce50[_0xe46c('0x1c')]=qs[_0xe46c('0x1c')](_0x12fe84[_0xe46c('0x2e')][_0xe46c('0x1c')]);_0x38ce50[_0xe46c('0x19')]=qs[_0xe46c('0x19')](_0x12fe84[_0xe46c('0x2e')]['offset']);}return _0x1ba8dc[_0xe46c('0x4a')](_0x38ce50);}})[_0xe46c('0x22')](function(_0x2ab2bb){if(_0x2ab2bb){return _0x2ab2bb?{'count':_0x250a09,'rows':_0x2ab2bb}:null;}})[_0xe46c('0x22')](respondWithResult(_0x1edaf7,null))['catch'](handleError(_0x1edaf7,null));};exports[_0xe46c('0x4b')]=function(_0x1cc764,_0x24bf6d,_0x57af7d){var _0x53fa09={};var _0x580379={};var _0x275995;var _0x299da0;return db[_0xe46c('0x28')][_0xe46c('0x46')]({'where':{'id':_0x1cc764[_0xe46c('0x41')]['id']}})[_0xe46c('0x22')](handleEntityNotFound(_0x24bf6d,null))[_0xe46c('0x22')](function(_0x103d17){if(_0x103d17){_0x275995=_0x103d17;_0x580379[_0xe46c('0x2c')]=_[_0xe46c('0x2f')](db['Tag'][_0xe46c('0x29')]);_0x580379[_0xe46c('0x2e')]=_[_0xe46c('0x2f')](_0x1cc764[_0xe46c('0x2e')]);_0x580379['filters']=_[_0xe46c('0x31')](_0x580379[_0xe46c('0x2c')],_0x580379[_0xe46c('0x2e')]);_0x53fa09['attributes']=_[_0xe46c('0x31')](_0x580379[_0xe46c('0x2c')],qs[_0xe46c('0x33')](_0x1cc764[_0xe46c('0x2e')]['fields']));_0x53fa09[_0xe46c('0x32')]=_0x53fa09[_0xe46c('0x32')][_0xe46c('0x34')]?_0x53fa09['attributes']:_0x580379[_0xe46c('0x2c')];_0x53fa09[_0xe46c('0x37')]=qs[_0xe46c('0x38')](_0x1cc764[_0xe46c('0x2e')]['sort']);_0x53fa09['where']=qs[_0xe46c('0x30')](_[_0xe46c('0x39')](_0x1cc764[_0xe46c('0x2e')],_0x580379[_0xe46c('0x30')]));if(_0x1cc764['query'][_0xe46c('0x3a')]){_0x53fa09[_0xe46c('0x47')]=_[_0xe46c('0x3b')](_0x53fa09[_0xe46c('0x47')],{'$or':_[_0xe46c('0x2d')](_0x53fa09[_0xe46c('0x32')],function(_0x4925ba){var _0x31fc09={};_0x31fc09[_0x4925ba]={'$like':'%'+_0x1cc764[_0xe46c('0x2e')][_0xe46c('0x3a')]+'%'};return _0x31fc09;})});}_0x53fa09=_['merge']({},_0x53fa09,_0x1cc764['options']);return _0x275995[_0xe46c('0x4b')](_0x53fa09);}})[_0xe46c('0x22')](function(_0x5626ce){if(_0x5626ce){_0x299da0=_0x5626ce[_0xe46c('0x34')];if(!_0x1cc764[_0xe46c('0x2e')]['hasOwnProperty'](_0xe46c('0x36'))){_0x53fa09[_0xe46c('0x1c')]=qs[_0xe46c('0x1c')](_0x1cc764[_0xe46c('0x2e')][_0xe46c('0x1c')]);_0x53fa09[_0xe46c('0x19')]=qs['offset'](_0x1cc764[_0xe46c('0x2e')][_0xe46c('0x19')]);}return _0x275995[_0xe46c('0x4b')](_0x53fa09);}})[_0xe46c('0x22')](function(_0x3fc7cc){if(_0x3fc7cc){return _0x3fc7cc?{'count':_0x299da0,'rows':_0x3fc7cc}:null;}})['then'](respondWithResult(_0x24bf6d,null))[_0xe46c('0x3f')](handleError(_0x24bf6d,null));};exports[_0xe46c('0x4c')]=function(_0x39c06c,_0x1ff7bb,_0x5452a7){if(_0x39c06c['body']['id']){delete _0x39c06c['body']['id'];}return db[_0xe46c('0x28')]['findOne']({'where':{'id':_0x39c06c[_0xe46c('0x41')]['id']}})[_0xe46c('0x22')](handleEntityNotFound(_0x1ff7bb,null))[_0xe46c('0x22')](function(_0x212c7f){if(_0x212c7f){return _0x212c7f[_0xe46c('0x4c')](_0x39c06c[_0xe46c('0x43')][_0xe46c('0x4d')]||[]);}return null;})['then'](respondWithResult(_0x1ff7bb,null))['catch'](handleError(_0x1ff7bb,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 72c2437..49c872a 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 _0x5eb8=['request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','../../config/logger','api','moment','bluebird'];(function(_0x208e9f,_0x1efbed){var _0x4620d2=function(_0x1924e5){while(--_0x1924e5){_0x208e9f['push'](_0x208e9f['shift']());}};_0x4620d2(++_0x1efbed);}(_0x5eb8,0xb0));var _0x85eb=function(_0x599041,_0x40fbea){_0x599041=_0x599041-0x0;var _0x1c4969=_0x5eb8[_0x599041];return _0x1c4969;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x85eb('0x0'))(_0x85eb('0x1'));var moment=require(_0x85eb('0x2'));var BPromise=require(_0x85eb('0x3'));var rp=require(_0x85eb('0x4'));var fs=require('fs');var path=require(_0x85eb('0x5'));var rimraf=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var attributes=require(_0x85eb('0x8'));module[_0x85eb('0x9')]=function(_0x2bf83c,_0x1ba1d8){return _0x2bf83c['define'](_0x85eb('0xa'),attributes,{'tableName':_0x85eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3de3=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0x3de3,0x1ce));var _0x33de=function(_0x3a7e38,_0x57fb09){_0x3a7e38=_0x3a7e38-0x0;var _0x3d8dcd=_0x3de3[_0x3a7e38];return _0x3d8dcd;};'use strict';var _=require(_0x33de('0x0'));var util=require('util');var logger=require(_0x33de('0x1'))(_0x33de('0x2'));var moment=require('moment');var BPromise=require(_0x33de('0x3'));var rp=require(_0x33de('0x4'));var fs=require('fs');var path=require(_0x33de('0x5'));var rimraf=require(_0x33de('0x6'));var config=require('../../config/environment');var attributes=require(_0x33de('0x7'));module[_0x33de('0x8')]=function(_0x558f98,_0x142716){return _0x558f98['define'](_0x33de('0x9'),attributes,{'tableName':_0x33de('0xa'),'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 161250d..02116cb 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 _0xcb4d=['code','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','request','then','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3e4fbe,_0x1a550d){var _0x158ba5=function(_0x446f40){while(--_0x446f40){_0x3e4fbe['push'](_0x3e4fbe['shift']());}};_0x158ba5(++_0x1a550d);}(_0xcb4d,0x10a));var _0xdcb4=function(_0x4722f1,_0x599430){_0x4722f1=_0x4722f1-0x0;var _0x4c4e93=_0xcb4d[_0x4722f1];return _0x4c4e93;};'use strict';var _=require(_0xdcb4('0x0'));var util=require(_0xdcb4('0x1'));var moment=require(_0xdcb4('0x2'));var BPromise=require('bluebird');var rs=require(_0xdcb4('0x3'));var fs=require('fs');var Redis=require(_0xdcb4('0x4'));var db=require(_0xdcb4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdcb4('0x6'))(_0xdcb4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c7b39,_0x3ab85e,_0x2a6223){return new BPromise(function(_0x516ad0,_0x4b9d70){return client[_0xdcb4('0x8')](_0x4c7b39,_0x2a6223)[_0xdcb4('0x9')](function(_0x3c1e06){logger['info'](_0xdcb4('0xa'),_0x3ab85e,'request\x20sent');logger[_0xdcb4('0xb')](_0xdcb4('0xc'),_0x3ab85e,_0xdcb4('0xd'),JSON['stringify'](_0x3c1e06));if(_0x3c1e06['error']){if(_0x3c1e06['error'][_0xdcb4('0xe')]===0x1f4){logger[_0xdcb4('0xf')](_0xdcb4('0xa'),_0x3ab85e,_0x3c1e06[_0xdcb4('0xf')][_0xdcb4('0x10')]);return _0x4b9d70(_0x3c1e06[_0xdcb4('0xf')]['message']);}logger[_0xdcb4('0xf')](_0xdcb4('0xa'),_0x3ab85e,_0x3c1e06[_0xdcb4('0xf')][_0xdcb4('0x10')]);return _0x516ad0(_0x3c1e06[_0xdcb4('0xf')]['message']);}else{logger[_0xdcb4('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3ab85e,'request\x20sent');_0x516ad0(_0x3c1e06[_0xdcb4('0x12')]['message']);}})[_0xdcb4('0x13')](function(_0x89dce1){logger['error'](_0xdcb4('0xa'),_0x3ab85e,_0x89dce1);_0x4b9d70(_0x89dce1);});});} \ No newline at end of file +var _0xc0f0=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash'];(function(_0x507c81,_0x3e1b56){var _0x368a25=function(_0x1e7519){while(--_0x1e7519){_0x507c81['push'](_0x507c81['shift']());}};_0x368a25(++_0x3e1b56);}(_0xc0f0,0x153));var _0x0c0f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc0f0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0c0f('0x0'));var util=require(_0x0c0f('0x1'));var moment=require(_0x0c0f('0x2'));var BPromise=require(_0x0c0f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c0f('0x4'));var db=require(_0x0c0f('0x5'))['db'];var utils=require(_0x0c0f('0x6'));var logger=require(_0x0c0f('0x7'))('rpc');var config=require(_0x0c0f('0x8'));var jayson=require(_0x0c0f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfd38f3,_0x21ccd7,_0x878cd9){return new BPromise(function(_0x562dbd,_0x54ddf6){return client[_0x0c0f('0xa')](_0xfd38f3,_0x878cd9)[_0x0c0f('0xb')](function(_0x514a65){logger['info'](_0x0c0f('0xc'),_0x21ccd7,_0x0c0f('0xd'));logger[_0x0c0f('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x21ccd7,_0x0c0f('0xd'),JSON[_0x0c0f('0xf')](_0x514a65));if(_0x514a65[_0x0c0f('0x10')]){if(_0x514a65[_0x0c0f('0x10')][_0x0c0f('0x11')]===0x1f4){logger[_0x0c0f('0x10')](_0x0c0f('0xc'),_0x21ccd7,_0x514a65[_0x0c0f('0x10')][_0x0c0f('0x12')]);return _0x54ddf6(_0x514a65[_0x0c0f('0x10')][_0x0c0f('0x12')]);}logger[_0x0c0f('0x10')](_0x0c0f('0xc'),_0x21ccd7,_0x514a65[_0x0c0f('0x10')][_0x0c0f('0x12')]);return _0x562dbd(_0x514a65['error'][_0x0c0f('0x12')]);}else{logger['info'](_0x0c0f('0xc'),_0x21ccd7,_0x0c0f('0xd'));_0x562dbd(_0x514a65['result'][_0x0c0f('0x12')]);}})[_0x0c0f('0x13')](function(_0x9779ba){logger[_0x0c0f('0x10')](_0x0c0f('0xc'),_0x21ccd7,_0x9779ba);_0x54ddf6(_0x9779ba);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 60df399..0c2cd34 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 _0xc8a2=['../../config/environment','./intZendeskField.controller','get','index','/:id','show','post','put','isAuthenticated','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3b4c9c,_0x4c697c){var _0x5955ce=function(_0x162bc1){while(--_0x162bc1){_0x3b4c9c['push'](_0x3b4c9c['shift']());}};_0x5955ce(++_0x4c697c);}(_0xc8a2,0x1c2));var _0x2c8a=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xc8a2[_0x2be8c2];return _0x97f531;};'use strict';var multer=require('multer');var util=require(_0x2c8a('0x0'));var path=require('path');var timeout=require(_0x2c8a('0x1'));var express=require(_0x2c8a('0x2'));var router=express['Router']();var fs_extra=require(_0x2c8a('0x3'));var auth=require(_0x2c8a('0x4'));var interaction=require(_0x2c8a('0x5'));var config=require(_0x2c8a('0x6'));var controller=require(_0x2c8a('0x7'));router[_0x2c8a('0x8')]('/',auth['isAuthenticated'](),controller[_0x2c8a('0x9')]);router[_0x2c8a('0x8')](_0x2c8a('0xa'),auth['isAuthenticated'](),controller[_0x2c8a('0xb')]);router[_0x2c8a('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2c8a('0xd')](_0x2c8a('0xa'),auth[_0x2c8a('0xe')](),controller[_0x2c8a('0xf')]);router[_0x2c8a('0x10')](_0x2c8a('0xa'),auth[_0x2c8a('0xe')](),controller[_0x2c8a('0x11')]);module[_0x2c8a('0x12')]=router; \ No newline at end of file +var _0x0e8c=['put','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','post'];(function(_0x187b87,_0x1e2f8f){var _0x307d5e=function(_0x377cf0){while(--_0x377cf0){_0x187b87['push'](_0x187b87['shift']());}};_0x307d5e(++_0x1e2f8f);}(_0x0e8c,0xb8));var _0xc0e8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0e8c[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0xc0e8('0x0'));var path=require(_0xc0e8('0x1'));var timeout=require(_0xc0e8('0x2'));var express=require(_0xc0e8('0x3'));var router=express['Router']();var fs_extra=require(_0xc0e8('0x4'));var auth=require(_0xc0e8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc0e8('0x6'));var controller=require(_0xc0e8('0x7'));router[_0xc0e8('0x8')]('/',auth[_0xc0e8('0x9')](),controller['index']);router[_0xc0e8('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc0e8('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc0e8('0xb')](_0xc0e8('0xc'),auth[_0xc0e8('0x9')](),controller['update']);router['delete'](_0xc0e8('0xc'),auth[_0xc0e8('0x9')](),controller[_0xc0e8('0xd')]);module[_0xc0e8('0xe')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index a7b79f4..f4db272 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 _0x0ebb=['picklist','STRING','ENUM','BOOLEAN','sequelize','string','variable','keyValue'];(function(_0xe28c66,_0x57beac){var _0x130116=function(_0x1b9b1c){while(--_0x1b9b1c){_0xe28c66['push'](_0xe28c66['shift']());}};_0x130116(++_0x57beac);}(_0x0ebb,0xdc));var _0xb0eb=function(_0x40994e,_0x50fc7f){_0x40994e=_0x40994e-0x0;var _0x23c718=_0x0ebb[_0x40994e];return _0x23c718;};'use strict';var Sequelize=require(_0xb0eb('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xb0eb('0x1'),_0xb0eb('0x2'),'customVariable',_0xb0eb('0x3'),_0xb0eb('0x4')),'defaultValue':_0xb0eb('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb0eb('0x5')]},'keyType':{'type':Sequelize[_0xb0eb('0x6')](_0xb0eb('0x1'),_0xb0eb('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb0eb('0x5')]},'nameField':{'type':Sequelize[_0xb0eb('0x5')]},'customField':{'type':Sequelize[_0xb0eb('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb0eb('0x5')]}}; \ No newline at end of file +var _0x21be=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x21be,0x11b));var _0xe21b=function(_0x3a2fe5,_0x4f3adf){_0x3a2fe5=_0x3a2fe5-0x0;var _0x5aacd1=_0x21be[_0x3a2fe5];return _0x5aacd1;};'use strict';var Sequelize=require(_0xe21b('0x0'));module[_0xe21b('0x1')]={'type':{'type':Sequelize[_0xe21b('0x2')](_0xe21b('0x3'),_0xe21b('0x4'),_0xe21b('0x5'),_0xe21b('0x6'),_0xe21b('0x7')),'defaultValue':_0xe21b('0x3')},'content':{'type':Sequelize[_0xe21b('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe21b('0x2')](_0xe21b('0x3'),_0xe21b('0x4'),_0xe21b('0x5'))},'keyContent':{'type':Sequelize[_0xe21b('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xe21b('0x8')]},'customField':{'type':Sequelize[_0xe21b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe21b('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 8424bdc..4e1ff91 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 _0x3877=['fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','rimraf'];(function(_0x55b806,_0xe47221){var _0x4531be=function(_0xb16878){while(--_0xb16878){_0x55b806['push'](_0x55b806['shift']());}};_0x4531be(++_0xe47221);}(_0x3877,0x1c1));var _0x7387=function(_0x1f8a2c,_0x1823ed){_0x1f8a2c=_0x1f8a2c-0x0;var _0x2a8d99=_0x3877[_0x1f8a2c];return _0x2a8d99;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7387('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7387('0x1'));var rp=require(_0x7387('0x2'));var moment=require(_0x7387('0x3'));var BPromise=require(_0x7387('0x4'));var Mustache=require(_0x7387('0x5'));var util=require(_0x7387('0x6'));var path=require('path');var sox=require(_0x7387('0x7'));var csv=require(_0x7387('0x8'));var ejs=require(_0x7387('0x9'));var fs=require('fs');var fs_extra=require(_0x7387('0xa'));var _=require(_0x7387('0xb'));var squel=require(_0x7387('0xc'));var crypto=require(_0x7387('0xd'));var jsforce=require(_0x7387('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7387('0xf'));var Papa=require(_0x7387('0x10'));var Redis=require(_0x7387('0x11'));var authService=require(_0x7387('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7387('0x13'));var hardwareService=require(_0x7387('0x14'));var logger=require(_0x7387('0x15'))('api');var utils=require(_0x7387('0x16'));var config=require(_0x7387('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7387('0x18'))['db'];function respondWithStatusCode(_0xe3221e,_0x272a9f){_0x272a9f=_0x272a9f||0xcc;return function(_0x521b98){if(_0x521b98){return _0xe3221e['sendStatus'](_0x272a9f);}return _0xe3221e[_0x7387('0x19')](_0x272a9f)[_0x7387('0x1a')]();};}function respondWithResult(_0x5b4271,_0x507c6a){_0x507c6a=_0x507c6a||0xc8;return function(_0xe885bf){if(_0xe885bf){return _0x5b4271['status'](_0x507c6a)[_0x7387('0x1b')](_0xe885bf);}};}function respondWithFilteredResult(_0x450986,_0x2e053b){return function(_0x3576eb){if(_0x3576eb){var _0x5e9c1c=typeof _0x2e053b[_0x7387('0x1c')]===_0x7387('0x1d')&&typeof _0x2e053b[_0x7387('0x1e')]==='undefined';var _0x33ddbd=_0x3576eb[_0x7387('0x1f')];var _0x442f87=_0x5e9c1c?0x0:_0x2e053b['offset'];var _0x23878d=_0x5e9c1c?_0x3576eb[_0x7387('0x1f')]:_0x2e053b[_0x7387('0x1c')]+_0x2e053b[_0x7387('0x1e')];var _0x1cd228;if(_0x23878d>=_0x33ddbd){_0x23878d=_0x33ddbd;_0x1cd228=0xc8;}else{_0x1cd228=0xce;}_0x450986[_0x7387('0x19')](_0x1cd228);return _0x450986['set'](_0x7387('0x20'),_0x442f87+'-'+_0x23878d+'/'+_0x33ddbd)[_0x7387('0x1b')](_0x3576eb);}return null;};}function patchUpdates(_0x25b45f){return function(_0x84656a){try{jsonpatch[_0x7387('0x21')](_0x84656a,_0x25b45f,!![]);}catch(_0x11b72d){return BPromise['reject'](_0x11b72d);}return _0x84656a[_0x7387('0x22')]();};}function saveUpdates(_0x1b88e5,_0x5473ef){return function(_0xdb1804){if(_0xdb1804){return _0xdb1804[_0x7387('0x23')](_0x1b88e5)[_0x7387('0x24')](function(_0x5d1ea8){return _0x5d1ea8;});}return null;};}function removeEntity(_0x486af1,_0xa20900){return function(_0x3b2b3d){if(_0x3b2b3d){return _0x3b2b3d[_0x7387('0x25')]()[_0x7387('0x24')](function(){_0x486af1[_0x7387('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x536193,_0x5afc24){return function(_0x1b132a){if(!_0x1b132a){_0x536193['sendStatus'](0x194);}return _0x1b132a;};}function handleError(_0x3d4a80,_0x42e369){_0x42e369=_0x42e369||0x1f4;return function(_0x197777){logger['error'](_0x197777[_0x7387('0x26')]);if(_0x197777['name']){delete _0x197777[_0x7387('0x27')];}_0x3d4a80[_0x7387('0x19')](_0x42e369)[_0x7387('0x28')](_0x197777);};}exports[_0x7387('0x29')]=function(_0x336e52,_0xdb7fc2){var _0x227f5d={},_0x3b0b3e={},_0x42c6ba={'count':0x0,'rows':[]};var _0x3525b1=_[_0x7387('0x2a')](db[_0x7387('0x2b')][_0x7387('0x2c')],function(_0x189419){return{'name':_0x189419[_0x7387('0x2d')],'type':_0x189419[_0x7387('0x2e')][_0x7387('0x2f')]};});_0x3b0b3e[_0x7387('0x30')]=_[_0x7387('0x2a')](_0x3525b1,_0x7387('0x27'));_0x3b0b3e[_0x7387('0x31')]=_[_0x7387('0x32')](_0x336e52[_0x7387('0x31')]);_0x3b0b3e['filters']=_[_0x7387('0x33')](_0x3b0b3e['model'],_0x3b0b3e[_0x7387('0x31')]);_0x227f5d[_0x7387('0x34')]=_['intersection'](_0x3b0b3e[_0x7387('0x30')],qs[_0x7387('0x35')](_0x336e52['query'][_0x7387('0x35')]));_0x227f5d[_0x7387('0x34')]=_0x227f5d[_0x7387('0x34')][_0x7387('0x36')]?_0x227f5d[_0x7387('0x34')]:_0x3b0b3e[_0x7387('0x30')];if(!_0x336e52[_0x7387('0x31')][_0x7387('0x37')](_0x7387('0x38'))){_0x227f5d[_0x7387('0x1e')]=qs[_0x7387('0x1e')](_0x336e52[_0x7387('0x31')][_0x7387('0x1e')]);_0x227f5d[_0x7387('0x1c')]=qs[_0x7387('0x1c')](_0x336e52['query'][_0x7387('0x1c')]);}_0x227f5d[_0x7387('0x39')]=qs[_0x7387('0x3a')](_0x336e52[_0x7387('0x31')]['sort']);_0x227f5d[_0x7387('0x3b')]=qs[_0x7387('0x3c')](_[_0x7387('0x3d')](_0x336e52[_0x7387('0x31')],_0x3b0b3e['filters']),_0x3525b1);if(_0x336e52['query'][_0x7387('0x3e')]){_0x227f5d[_0x7387('0x3b')]=_[_0x7387('0x3f')](_0x227f5d[_0x7387('0x3b')],{'$or':_[_0x7387('0x2a')](_0x3525b1,function(_0x16cb4c){if(_0x16cb4c[_0x7387('0x2e')]!==_0x7387('0x40')){var _0x6d4201={};_0x6d4201[_0x16cb4c[_0x7387('0x27')]]={'$like':'%'+_0x336e52['query'][_0x7387('0x3e')]+'%'};return _0x6d4201;}})});}_0x227f5d=_['merge']({},_0x227f5d,_0x336e52[_0x7387('0x41')]);var _0x6a2565={'where':_0x227f5d[_0x7387('0x3b')]};return db['ZendeskField'][_0x7387('0x1f')](_0x6a2565)[_0x7387('0x24')](function(_0x49bb5e){_0x42c6ba[_0x7387('0x1f')]=_0x49bb5e;if(_0x336e52['query'][_0x7387('0x42')]){_0x227f5d[_0x7387('0x43')]=[{'all':!![]}];}return db[_0x7387('0x2b')][_0x7387('0x44')](_0x227f5d);})['then'](function(_0x3f7552){_0x42c6ba[_0x7387('0x45')]=_0x3f7552;return _0x42c6ba;})[_0x7387('0x24')](respondWithFilteredResult(_0xdb7fc2,_0x227f5d))[_0x7387('0x46')](handleError(_0xdb7fc2,null));};exports['show']=function(_0x357e5e,_0x47cfdb){var _0x5ecf={'raw':!![],'where':{'id':_0x357e5e[_0x7387('0x47')]['id']}},_0x3560f0={};_0x3560f0[_0x7387('0x30')]=_[_0x7387('0x32')](db[_0x7387('0x2b')][_0x7387('0x2c')]);_0x3560f0[_0x7387('0x31')]=_[_0x7387('0x32')](_0x357e5e[_0x7387('0x31')]);_0x3560f0['filters']=_[_0x7387('0x33')](_0x3560f0[_0x7387('0x30')],_0x3560f0[_0x7387('0x31')]);_0x5ecf[_0x7387('0x34')]=_[_0x7387('0x33')](_0x3560f0[_0x7387('0x30')],qs[_0x7387('0x35')](_0x357e5e['query']['fields']));_0x5ecf['attributes']=_0x5ecf['attributes'][_0x7387('0x36')]?_0x5ecf[_0x7387('0x34')]:_0x3560f0[_0x7387('0x30')];if(_0x357e5e[_0x7387('0x31')]['includeAll']){_0x5ecf[_0x7387('0x43')]=[{'all':!![]}];}_0x5ecf=_[_0x7387('0x3f')]({},_0x5ecf,_0x357e5e[_0x7387('0x41')]);return db[_0x7387('0x2b')][_0x7387('0x48')](_0x5ecf)['then'](handleEntityNotFound(_0x47cfdb,null))['then'](respondWithResult(_0x47cfdb,null))[_0x7387('0x46')](handleError(_0x47cfdb,null));};exports[_0x7387('0x49')]=function(_0x341b8b,_0x1524b4){return db[_0x7387('0x2b')][_0x7387('0x49')](_0x341b8b[_0x7387('0x4a')],{})[_0x7387('0x24')](respondWithResult(_0x1524b4,0xc9))[_0x7387('0x46')](handleError(_0x1524b4,null));};exports[_0x7387('0x23')]=function(_0x4143dd,_0x7cfa7d){if(_0x4143dd['body']['id']){delete _0x4143dd[_0x7387('0x4a')]['id'];}return db[_0x7387('0x2b')]['find']({'where':{'id':_0x4143dd[_0x7387('0x47')]['id']}})[_0x7387('0x24')](handleEntityNotFound(_0x7cfa7d,null))[_0x7387('0x24')](saveUpdates(_0x4143dd['body'],null))[_0x7387('0x24')](respondWithResult(_0x7cfa7d,null))['catch'](handleError(_0x7cfa7d,null));};exports[_0x7387('0x25')]=function(_0x18075d,_0x2546b1){return db[_0x7387('0x2b')][_0x7387('0x48')]({'where':{'id':_0x18075d[_0x7387('0x47')]['id']}})[_0x7387('0x24')](handleEntityNotFound(_0x2546b1,null))[_0x7387('0x24')](removeEntity(_0x2546b1,null))[_0x7387('0x46')](handleError(_0x2546b1,null));}; \ No newline at end of file +var _0x1177=['limit','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','send','index','ZendeskField','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','merge','where','VIRTUAL','name','findAll','then','rows','catch','show','fields','includeAll','include','find','create','body','params','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','fs-extra','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x107454,_0x109c76){var _0x109266=function(_0x386ce9){while(--_0x386ce9){_0x107454['push'](_0x107454['shift']());}};_0x109266(++_0x109c76);}(_0x1177,0x10b));var _0x7117=function(_0x1a1087,_0x4f43f3){_0x1a1087=_0x1a1087-0x0;var _0x5d7081=_0x1177[_0x1a1087];return _0x5d7081;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7117('0x0'));var zipdir=require(_0x7117('0x1'));var jsonpatch=require(_0x7117('0x2'));var rp=require('request-promise');var moment=require(_0x7117('0x3'));var BPromise=require(_0x7117('0x4'));var Mustache=require(_0x7117('0x5'));var util=require(_0x7117('0x6'));var path=require('path');var sox=require(_0x7117('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7117('0x8'));var _=require('lodash');var squel=require(_0x7117('0x9'));var crypto=require(_0x7117('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7117('0xb'));var querystring=require(_0x7117('0xc'));var Papa=require('papaparse');var Redis=require(_0x7117('0xd'));var authService=require(_0x7117('0xe'));var qs=require(_0x7117('0xf'));var as=require(_0x7117('0x10'));var hardwareService=require(_0x7117('0x11'));var logger=require(_0x7117('0x12'))(_0x7117('0x13'));var utils=require(_0x7117('0x14'));var config=require(_0x7117('0x15'));var licenseUtil=require(_0x7117('0x16'));var db=require(_0x7117('0x17'))['db'];function respondWithStatusCode(_0x1fedc5,_0x932183){_0x932183=_0x932183||0xcc;return function(_0x5726e6){if(_0x5726e6){return _0x1fedc5[_0x7117('0x18')](_0x932183);}return _0x1fedc5[_0x7117('0x19')](_0x932183)[_0x7117('0x1a')]();};}function respondWithResult(_0x69d407,_0x32d0db){_0x32d0db=_0x32d0db||0xc8;return function(_0x134ea7){if(_0x134ea7){return _0x69d407[_0x7117('0x19')](_0x32d0db)['json'](_0x134ea7);}};}function respondWithFilteredResult(_0x54bf02,_0x417377){return function(_0x30b0b4){if(_0x30b0b4){var _0x536011=typeof _0x417377[_0x7117('0x1b')]===_0x7117('0x1c')&&typeof _0x417377[_0x7117('0x1d')]===_0x7117('0x1c');var _0x3c403c=_0x30b0b4[_0x7117('0x1e')];var _0x495698=_0x536011?0x0:_0x417377[_0x7117('0x1b')];var _0x4116a6=_0x536011?_0x30b0b4[_0x7117('0x1e')]:_0x417377[_0x7117('0x1b')]+_0x417377[_0x7117('0x1d')];var _0x31f57f;if(_0x4116a6>=_0x3c403c){_0x4116a6=_0x3c403c;_0x31f57f=0xc8;}else{_0x31f57f=0xce;}_0x54bf02['status'](_0x31f57f);return _0x54bf02[_0x7117('0x1f')](_0x7117('0x20'),_0x495698+'-'+_0x4116a6+'/'+_0x3c403c)[_0x7117('0x21')](_0x30b0b4);}return null;};}function patchUpdates(_0x36ef6d){return function(_0x5a79e2){try{jsonpatch[_0x7117('0x22')](_0x5a79e2,_0x36ef6d,!![]);}catch(_0x3f91ee){return BPromise[_0x7117('0x23')](_0x3f91ee);}return _0x5a79e2[_0x7117('0x24')]();};}function saveUpdates(_0x501936,_0xde8ef9){return function(_0x4966b8){if(_0x4966b8){return _0x4966b8[_0x7117('0x25')](_0x501936)['then'](function(_0x1b8027){return _0x1b8027;});}return null;};}function removeEntity(_0x17f8b9,_0x10314a){return function(_0x46bf5f){if(_0x46bf5f){return _0x46bf5f[_0x7117('0x26')]()['then'](function(){_0x17f8b9[_0x7117('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d2c9d,_0x1f44d6){return function(_0x277197){if(!_0x277197){_0x2d2c9d[_0x7117('0x18')](0x194);}return _0x277197;};}function handleError(_0x416f86,_0x45a37d){_0x45a37d=_0x45a37d||0x1f4;return function(_0x36b7e2){logger['error'](_0x36b7e2[_0x7117('0x27')]);if(_0x36b7e2['name']){delete _0x36b7e2['name'];}_0x416f86[_0x7117('0x19')](_0x45a37d)[_0x7117('0x28')](_0x36b7e2);};}exports[_0x7117('0x29')]=function(_0x35ec01,_0xd77bcf){var _0x2f9bab={},_0x4413d8={},_0x47bcf5={'count':0x0,'rows':[]};var _0x3d7ca5=_['map'](db[_0x7117('0x2a')][_0x7117('0x2b')],function(_0x4d7050){return{'name':_0x4d7050[_0x7117('0x2c')],'type':_0x4d7050[_0x7117('0x2d')][_0x7117('0x2e')]};});_0x4413d8['model']=_[_0x7117('0x2f')](_0x3d7ca5,'name');_0x4413d8[_0x7117('0x30')]=_[_0x7117('0x31')](_0x35ec01[_0x7117('0x30')]);_0x4413d8[_0x7117('0x32')]=_[_0x7117('0x33')](_0x4413d8[_0x7117('0x34')],_0x4413d8[_0x7117('0x30')]);_0x2f9bab[_0x7117('0x35')]=_['intersection'](_0x4413d8['model'],qs['fields'](_0x35ec01[_0x7117('0x30')]['fields']));_0x2f9bab['attributes']=_0x2f9bab['attributes'][_0x7117('0x36')]?_0x2f9bab[_0x7117('0x35')]:_0x4413d8[_0x7117('0x34')];if(!_0x35ec01[_0x7117('0x30')][_0x7117('0x37')]('nolimit')){_0x2f9bab[_0x7117('0x1d')]=qs['limit'](_0x35ec01[_0x7117('0x30')][_0x7117('0x1d')]);_0x2f9bab[_0x7117('0x1b')]=qs[_0x7117('0x1b')](_0x35ec01[_0x7117('0x30')][_0x7117('0x1b')]);}_0x2f9bab[_0x7117('0x38')]=qs[_0x7117('0x39')](_0x35ec01[_0x7117('0x30')]['sort']);_0x2f9bab['where']=qs['filters'](_['pick'](_0x35ec01[_0x7117('0x30')],_0x4413d8[_0x7117('0x32')]),_0x3d7ca5);if(_0x35ec01[_0x7117('0x30')]['filter']){_0x2f9bab['where']=_[_0x7117('0x3a')](_0x2f9bab[_0x7117('0x3b')],{'$or':_[_0x7117('0x2f')](_0x3d7ca5,function(_0x403865){if(_0x403865[_0x7117('0x2d')]!==_0x7117('0x3c')){var _0x561967={};_0x561967[_0x403865[_0x7117('0x3d')]]={'$like':'%'+_0x35ec01[_0x7117('0x30')]['filter']+'%'};return _0x561967;}})});}_0x2f9bab=_[_0x7117('0x3a')]({},_0x2f9bab,_0x35ec01['options']);var _0x346c3f={'where':_0x2f9bab[_0x7117('0x3b')]};return db['ZendeskField'][_0x7117('0x1e')](_0x346c3f)['then'](function(_0x2189f1){_0x47bcf5[_0x7117('0x1e')]=_0x2189f1;if(_0x35ec01['query']['includeAll']){_0x2f9bab['include']=[{'all':!![]}];}return db['ZendeskField'][_0x7117('0x3e')](_0x2f9bab);})[_0x7117('0x3f')](function(_0x5c554c){_0x47bcf5[_0x7117('0x40')]=_0x5c554c;return _0x47bcf5;})[_0x7117('0x3f')](respondWithFilteredResult(_0xd77bcf,_0x2f9bab))[_0x7117('0x41')](handleError(_0xd77bcf,null));};exports[_0x7117('0x42')]=function(_0x180664,_0x240d63){var _0x18b0d={'raw':!![],'where':{'id':_0x180664['params']['id']}},_0x5342d8={};_0x5342d8['model']=_['keys'](db[_0x7117('0x2a')]['rawAttributes']);_0x5342d8[_0x7117('0x30')]=_[_0x7117('0x31')](_0x180664[_0x7117('0x30')]);_0x5342d8[_0x7117('0x32')]=_[_0x7117('0x33')](_0x5342d8[_0x7117('0x34')],_0x5342d8['query']);_0x18b0d[_0x7117('0x35')]=_[_0x7117('0x33')](_0x5342d8[_0x7117('0x34')],qs['fields'](_0x180664[_0x7117('0x30')][_0x7117('0x43')]));_0x18b0d['attributes']=_0x18b0d[_0x7117('0x35')][_0x7117('0x36')]?_0x18b0d['attributes']:_0x5342d8[_0x7117('0x34')];if(_0x180664[_0x7117('0x30')][_0x7117('0x44')]){_0x18b0d[_0x7117('0x45')]=[{'all':!![]}];}_0x18b0d=_['merge']({},_0x18b0d,_0x180664['options']);return db[_0x7117('0x2a')][_0x7117('0x46')](_0x18b0d)[_0x7117('0x3f')](handleEntityNotFound(_0x240d63,null))[_0x7117('0x3f')](respondWithResult(_0x240d63,null))[_0x7117('0x41')](handleError(_0x240d63,null));};exports[_0x7117('0x47')]=function(_0xdde239,_0x4194fd){return db[_0x7117('0x2a')][_0x7117('0x47')](_0xdde239[_0x7117('0x48')],{})[_0x7117('0x3f')](respondWithResult(_0x4194fd,0xc9))[_0x7117('0x41')](handleError(_0x4194fd,null));};exports[_0x7117('0x25')]=function(_0x2b376a,_0x36abf4){if(_0x2b376a[_0x7117('0x48')]['id']){delete _0x2b376a[_0x7117('0x48')]['id'];}return db[_0x7117('0x2a')][_0x7117('0x46')]({'where':{'id':_0x2b376a['params']['id']}})[_0x7117('0x3f')](handleEntityNotFound(_0x36abf4,null))['then'](saveUpdates(_0x2b376a['body'],null))[_0x7117('0x3f')](respondWithResult(_0x36abf4,null))[_0x7117('0x41')](handleError(_0x36abf4,null));};exports[_0x7117('0x26')]=function(_0x16901f,_0x361555){return db[_0x7117('0x2a')][_0x7117('0x46')]({'where':{'id':_0x16901f[_0x7117('0x49')]['id']}})[_0x7117('0x3f')](handleEntityNotFound(_0x361555,null))[_0x7117('0x3f')](removeEntity(_0x361555,null))[_0x7117('0x41')](handleError(_0x361555,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index b72c598..1a741b9 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 _0xc5da=['ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define'];(function(_0x336873,_0x177bc2){var _0x104864=function(_0xa04bcb){while(--_0xa04bcb){_0x336873['push'](_0x336873['shift']());}};_0x104864(++_0x177bc2);}(_0xc5da,0x1f2));var _0xac5d=function(_0x3b90e9,_0x4bdfb1){_0x3b90e9=_0x3b90e9-0x0;var _0x37cc1f=_0xc5da[_0x3b90e9];return _0x37cc1f;};'use strict';var _=require(_0xac5d('0x0'));var util=require(_0xac5d('0x1'));var logger=require(_0xac5d('0x2'))(_0xac5d('0x3'));var moment=require('moment');var BPromise=require(_0xac5d('0x4'));var rp=require(_0xac5d('0x5'));var fs=require('fs');var path=require(_0xac5d('0x6'));var rimraf=require(_0xac5d('0x7'));var config=require(_0xac5d('0x8'));var attributes=require(_0xac5d('0x9'));module[_0xac5d('0xa')]=function(_0x44c789,_0x37c130){return _0x44c789[_0xac5d('0xb')](_0xac5d('0xc'),attributes,{'tableName':_0xac5d('0xd'),'paranoid':![],'indexes':[{'name':_0xac5d('0xe'),'fields':[_0xac5d('0xf'),_0xac5d('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0657=['exports','define','idField','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0x0657,0x14b));var _0x7065=function(_0x2c14b2,_0x3ab475){_0x2c14b2=_0x2c14b2-0x0;var _0x5ca119=_0x0657[_0x2c14b2];return _0x5ca119;};'use strict';var _=require(_0x7065('0x0'));var util=require('util');var logger=require(_0x7065('0x1'))('api');var moment=require(_0x7065('0x2'));var BPromise=require(_0x7065('0x3'));var rp=require(_0x7065('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module[_0x7065('0x5')]=function(_0x3741b5,_0x15851d){return _0x3741b5[_0x7065('0x6')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x7065('0x7'),'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 7c72295..d0a3813 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 _0xa094=['code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','request','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x4d22f4,_0x1b5bd6){var _0x4047be=function(_0x3501a1){while(--_0x3501a1){_0x4d22f4['push'](_0x4d22f4['shift']());}};_0x4047be(++_0x1b5bd6);}(_0xa094,0x193));var _0x4a09=function(_0x28d16d,_0x4c9a21){_0x28d16d=_0x28d16d-0x0;var _0x34a8eb=_0xa094[_0x28d16d];return _0x34a8eb;};'use strict';var _=require(_0x4a09('0x0'));var util=require(_0x4a09('0x1'));var moment=require(_0x4a09('0x2'));var BPromise=require(_0x4a09('0x3'));var rs=require(_0x4a09('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a09('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a09('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4a09('0x7'));var client=jayson[_0x4a09('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2159c7,_0x5cc82c,_0x2706f8){return new BPromise(function(_0x50de52,_0x178d13){return client[_0x4a09('0x9')](_0x2159c7,_0x2706f8)[_0x4a09('0xa')](function(_0x289cb5){logger[_0x4a09('0xb')](_0x4a09('0xc'),_0x5cc82c,'request\x20sent');logger[_0x4a09('0xd')](_0x4a09('0xe'),_0x5cc82c,_0x4a09('0xf'),JSON['stringify'](_0x289cb5));if(_0x289cb5[_0x4a09('0x10')]){if(_0x289cb5[_0x4a09('0x10')][_0x4a09('0x11')]===0x1f4){logger[_0x4a09('0x10')](_0x4a09('0xc'),_0x5cc82c,_0x289cb5['error'][_0x4a09('0x12')]);return _0x178d13(_0x289cb5['error'][_0x4a09('0x12')]);}logger[_0x4a09('0x10')]('ZendeskField,\x20%s,\x20%s',_0x5cc82c,_0x289cb5[_0x4a09('0x10')][_0x4a09('0x12')]);return _0x50de52(_0x289cb5[_0x4a09('0x10')][_0x4a09('0x12')]);}else{logger[_0x4a09('0xb')](_0x4a09('0xc'),_0x5cc82c,'request\x20sent');_0x50de52(_0x289cb5['result'][_0x4a09('0x12')]);}})[_0x4a09('0x13')](function(_0x5295a6){logger[_0x4a09('0x10')](_0x4a09('0xc'),_0x5cc82c,_0x5295a6);_0x178d13(_0x5295a6);});});} \ No newline at end of file +var _0xc3cf=['code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2934a7,_0xfcc8e2){var _0x4acbd0=function(_0x5cbd9b){while(--_0x5cbd9b){_0x2934a7['push'](_0x2934a7['shift']());}};_0x4acbd0(++_0xfcc8e2);}(_0xc3cf,0x94));var _0xfc3c=function(_0x2ea1b,_0x551af1){_0x2ea1b=_0x2ea1b-0x0;var _0xa235ea=_0xc3cf[_0x2ea1b];return _0xa235ea;};'use strict';var _=require(_0xfc3c('0x0'));var util=require('util');var moment=require(_0xfc3c('0x1'));var BPromise=require('bluebird');var rs=require(_0xfc3c('0x2'));var fs=require('fs');var Redis=require(_0xfc3c('0x3'));var db=require(_0xfc3c('0x4'))['db'];var utils=require(_0xfc3c('0x5'));var logger=require(_0xfc3c('0x6'))(_0xfc3c('0x7'));var config=require(_0xfc3c('0x8'));var jayson=require(_0xfc3c('0x9'));var client=jayson[_0xfc3c('0xa')][_0xfc3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x402b5d,_0x5be87e,_0x326007){return new BPromise(function(_0x5df03b,_0x2af2aa){return client['request'](_0x402b5d,_0x326007)[_0xfc3c('0xc')](function(_0x384094){logger[_0xfc3c('0xd')](_0xfc3c('0xe'),_0x5be87e,_0xfc3c('0xf'));logger[_0xfc3c('0x10')](_0xfc3c('0x11'),_0x5be87e,_0xfc3c('0xf'),JSON[_0xfc3c('0x12')](_0x384094));if(_0x384094[_0xfc3c('0x13')]){if(_0x384094['error'][_0xfc3c('0x14')]===0x1f4){logger[_0xfc3c('0x13')](_0xfc3c('0xe'),_0x5be87e,_0x384094['error']['message']);return _0x2af2aa(_0x384094['error'][_0xfc3c('0x15')]);}logger[_0xfc3c('0x13')]('ZendeskField,\x20%s,\x20%s',_0x5be87e,_0x384094[_0xfc3c('0x13')][_0xfc3c('0x15')]);return _0x5df03b(_0x384094['error'][_0xfc3c('0x15')]);}else{logger['info'](_0xfc3c('0xe'),_0x5be87e,'request\x20sent');_0x5df03b(_0x384094[_0xfc3c('0x16')]['message']);}})[_0xfc3c('0x17')](function(_0x423bf8){logger[_0xfc3c('0x13')]('ZendeskField,\x20%s,\x20%s',_0x5be87e,_0x423bf8);_0x2af2aa(_0x423bf8);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index a8b09a2..9cf76b7 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 _0x01f1=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','destroy','exports','util','path','connect-timeout'];(function(_0x374e2f,_0x5da9c9){var _0x349abd=function(_0x1482f2){while(--_0x1482f2){_0x374e2f['push'](_0x374e2f['shift']());}};_0x349abd(++_0x5da9c9);}(_0x01f1,0x1dd));var _0x101f=function(_0x31df6f,_0x380e73){_0x31df6f=_0x31df6f-0x0;var _0x31e353=_0x01f1[_0x31df6f];return _0x31e353;};'use strict';var multer=require('multer');var util=require(_0x101f('0x0'));var path=require(_0x101f('0x1'));var timeout=require(_0x101f('0x2'));var express=require('express');var router=express[_0x101f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x101f('0x4'));var interaction=require(_0x101f('0x5'));var config=require(_0x101f('0x6'));var controller=require('./intZohoAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x101f('0x7')]);router[_0x101f('0x8')](_0x101f('0x9'),auth[_0x101f('0xa')](),controller['show']);router['get'](_0x101f('0xb'),auth[_0x101f('0xa')](),controller[_0x101f('0xc')]);router[_0x101f('0x8')](_0x101f('0xd'),auth[_0x101f('0xa')](),controller['getFields']);router[_0x101f('0xe')]('/',auth[_0x101f('0xa')](),controller['create']);router[_0x101f('0xe')](_0x101f('0xb'),auth[_0x101f('0xa')](),controller[_0x101f('0xf')]);router[_0x101f('0x10')]('/:id',auth[_0x101f('0xa')](),controller[_0x101f('0x11')]);router['delete'](_0x101f('0x9'),auth['isAuthenticated'](),controller[_0x101f('0x12')]);module[_0x101f('0x13')]=router; \ No newline at end of file +var _0xa2e4=['../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x58c22f,_0x3e7ce2){var _0x4cb2db=function(_0x1233ee){while(--_0x1233ee){_0x58c22f['push'](_0x58c22f['shift']());}};_0x4cb2db(++_0x3e7ce2);}(_0xa2e4,0x1c2));var _0x4a2e=function(_0x3b76ae,_0x1f110e){_0x3b76ae=_0x3b76ae-0x0;var _0x11ab0f=_0xa2e4[_0x3b76ae];return _0x11ab0f;};'use strict';var multer=require(_0x4a2e('0x0'));var util=require(_0x4a2e('0x1'));var path=require('path');var timeout=require(_0x4a2e('0x2'));var express=require(_0x4a2e('0x3'));var router=express[_0x4a2e('0x4')]();var fs_extra=require(_0x4a2e('0x5'));var auth=require(_0x4a2e('0x6'));var interaction=require(_0x4a2e('0x7'));var config=require('../../config/environment');var controller=require(_0x4a2e('0x8'));router[_0x4a2e('0x9')]('/',auth[_0x4a2e('0xa')](),controller['index']);router['get']('/:id',auth[_0x4a2e('0xa')](),controller[_0x4a2e('0xb')]);router[_0x4a2e('0x9')]('/:id/configurations',auth[_0x4a2e('0xa')](),controller[_0x4a2e('0xc')]);router[_0x4a2e('0x9')](_0x4a2e('0xd'),auth[_0x4a2e('0xa')](),controller[_0x4a2e('0xe')]);router[_0x4a2e('0xf')]('/',auth[_0x4a2e('0xa')](),controller['create']);router['post'](_0x4a2e('0x10'),auth[_0x4a2e('0xa')](),controller[_0x4a2e('0x11')]);router[_0x4a2e('0x12')](_0x4a2e('0x13'),auth[_0x4a2e('0xa')](),controller[_0x4a2e('0x14')]);router[_0x4a2e('0x15')]('/:id',auth[_0x4a2e('0xa')](),controller[_0x4a2e('0x16')]);module[_0x4a2e('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 516dae0..7c8e054 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 _0x9f62=['exports','STRING'];(function(_0x3405cc,_0x5d3881){var _0x3b9d97=function(_0x1074af){while(--_0x1074af){_0x3405cc['push'](_0x3405cc['shift']());}};_0x3b9d97(++_0x5d3881);}(_0x9f62,0x154));var _0x29f6=function(_0x48ab89,_0x380ea9){_0x48ab89=_0x48ab89-0x0;var _0xa93f07=_0x9f62[_0x48ab89];return _0xa93f07;};'use strict';var Sequelize=require('sequelize');module[_0x29f6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x29f6('0x1')]},'host':{'type':Sequelize[_0x29f6('0x1')]},'zone':{'type':Sequelize[_0x29f6('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x29f6('0x1')]},'refreshToken':{'type':Sequelize[_0x29f6('0x1')]}}; \ No newline at end of file +var _0x668b=['exports','STRING','sequelize'];(function(_0x1d7300,_0x17f109){var _0x46ee98=function(_0x5ee16a){while(--_0x5ee16a){_0x1d7300['push'](_0x1d7300['shift']());}};_0x46ee98(++_0x17f109);}(_0x668b,0x140));var _0xb668=function(_0x34232c,_0x18e61d){_0x34232c=_0x34232c-0x0;var _0x4d4f4e=_0x668b[_0x34232c];return _0x4d4f4e;};'use strict';var Sequelize=require(_0xb668('0x0'));module[_0xb668('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb668('0x2')]},'host':{'type':Sequelize[_0xb668('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb668('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb668('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xb668('0x2')]},'refreshToken':{'type':Sequelize[_0xb668('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index a6ea432..a73d940 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 _0x674a=['name','send','index','ZohoAccount','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','destroy','getConfigurations','findOne','ZohoConfiguration','order','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','Subjects','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','clientSecret','refresh_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','response','message','Owner','WhoId','Call_Result','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','jsforce','querystring','papaparse','../../components/auth/service','../../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','set','Content-Range','apply','reject','save','update','then','error','stack'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x674a,0x15f));var _0xa674=function(_0xf92bd0,_0x270ec5){_0xf92bd0=_0xf92bd0-0x0;var _0x162109=_0x674a[_0xf92bd0];return _0x162109;};'use strict';var emlformat=require(_0xa674('0x0'));var rimraf=require(_0xa674('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa674('0x2'));var moment=require(_0xa674('0x3'));var BPromise=require(_0xa674('0x4'));var Mustache=require(_0xa674('0x5'));var util=require('util');var path=require(_0xa674('0x6'));var sox=require(_0xa674('0x7'));var csv=require(_0xa674('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa674('0x9'));var crypto=require('crypto');var jsforce=require(_0xa674('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa674('0x8'));var querystring=require(_0xa674('0xb'));var Papa=require(_0xa674('0xc'));var Redis=require('ioredis');var authService=require(_0xa674('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xa674('0xe'));var hardwareService=require(_0xa674('0xf'));var logger=require(_0xa674('0x10'))(_0xa674('0x11'));var utils=require(_0xa674('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xa674('0x13'));var db=require(_0xa674('0x14'))['db'];var integrations=require(_0xa674('0x15'));function respondWithStatusCode(_0x2daedc,_0x16c047){_0x16c047=_0x16c047||0xcc;return function(_0x3f03f7){if(_0x3f03f7){return _0x2daedc[_0xa674('0x16')](_0x16c047);}return _0x2daedc[_0xa674('0x17')](_0x16c047)[_0xa674('0x18')]();};}function respondWithResult(_0x2922c6,_0x2337fb){_0x2337fb=_0x2337fb||0xc8;return function(_0x5d9e5b){if(_0x5d9e5b){return _0x2922c6[_0xa674('0x17')](_0x2337fb)[_0xa674('0x19')](_0x5d9e5b);}};}function respondWithFilteredResult(_0xca2128,_0xb9698e){return function(_0x57194f){if(_0x57194f){var _0x13058a=typeof _0xb9698e[_0xa674('0x1a')]===_0xa674('0x1b')&&typeof _0xb9698e[_0xa674('0x1c')]===_0xa674('0x1b');var _0x12116b=_0x57194f[_0xa674('0x1d')];var _0x4b5768=_0x13058a?0x0:_0xb9698e[_0xa674('0x1a')];var _0x449904=_0x13058a?_0x57194f[_0xa674('0x1d')]:_0xb9698e[_0xa674('0x1a')]+_0xb9698e[_0xa674('0x1c')];var _0x38344c;if(_0x449904>=_0x12116b){_0x449904=_0x12116b;_0x38344c=0xc8;}else{_0x38344c=0xce;}_0xca2128['status'](_0x38344c);return _0xca2128[_0xa674('0x1e')](_0xa674('0x1f'),_0x4b5768+'-'+_0x449904+'/'+_0x12116b)[_0xa674('0x19')](_0x57194f);}return null;};}function patchUpdates(_0x59e2d8){return function(_0x423ac7){try{jsonpatch[_0xa674('0x20')](_0x423ac7,_0x59e2d8,!![]);}catch(_0x3c14a8){return BPromise[_0xa674('0x21')](_0x3c14a8);}return _0x423ac7[_0xa674('0x22')]();};}function saveUpdates(_0x17842b,_0x3d692f){return function(_0x2c081e){if(_0x2c081e){return _0x2c081e[_0xa674('0x23')](_0x17842b)[_0xa674('0x24')](function(_0x4e24b1){return _0x4e24b1;});}return null;};}function removeEntity(_0x26ceef,_0x3c5779){return function(_0x2f1608){if(_0x2f1608){return _0x2f1608['destroy']()[_0xa674('0x24')](function(){_0x26ceef[_0xa674('0x17')](0xcc)[_0xa674('0x18')]();});}};}function handleEntityNotFound(_0x4efaee,_0xbe9c69){return function(_0x4dae64){if(!_0x4dae64){_0x4efaee['sendStatus'](0x194);}return _0x4dae64;};}function handleError(_0x184d75,_0x4ac8be){_0x4ac8be=_0x4ac8be||0x1f4;return function(_0x1ef241){logger[_0xa674('0x25')](_0x1ef241[_0xa674('0x26')]);if(_0x1ef241[_0xa674('0x27')]){delete _0x1ef241['name'];}_0x184d75['status'](_0x4ac8be)[_0xa674('0x28')](_0x1ef241);};}exports[_0xa674('0x29')]=function(_0x320e1d,_0x2c5245){var _0x1178da={},_0x5479d7={},_0x4c2e9f={'count':0x0,'rows':[]};var _0x34ac5a=_['map'](db[_0xa674('0x2a')]['rawAttributes'],function(_0x398626){return{'name':_0x398626[_0xa674('0x2b')],'type':_0x398626[_0xa674('0x2c')][_0xa674('0x2d')]};});_0x5479d7[_0xa674('0x2e')]=_[_0xa674('0x2f')](_0x34ac5a,_0xa674('0x27'));_0x5479d7[_0xa674('0x30')]=_[_0xa674('0x31')](_0x320e1d[_0xa674('0x30')]);_0x5479d7[_0xa674('0x32')]=_['intersection'](_0x5479d7[_0xa674('0x2e')],_0x5479d7[_0xa674('0x30')]);_0x1178da[_0xa674('0x33')]=_[_0xa674('0x34')](_0x5479d7[_0xa674('0x2e')],qs[_0xa674('0x35')](_0x320e1d[_0xa674('0x30')][_0xa674('0x35')]));_0x1178da[_0xa674('0x33')]=_0x1178da[_0xa674('0x33')][_0xa674('0x36')]?_0x1178da['attributes']:_0x5479d7[_0xa674('0x2e')];if(!_0x320e1d[_0xa674('0x30')][_0xa674('0x37')](_0xa674('0x38'))){_0x1178da[_0xa674('0x1c')]=qs['limit'](_0x320e1d['query'][_0xa674('0x1c')]);_0x1178da['offset']=qs[_0xa674('0x1a')](_0x320e1d['query']['offset']);}_0x1178da['order']=qs[_0xa674('0x39')](_0x320e1d[_0xa674('0x30')][_0xa674('0x39')]);_0x1178da[_0xa674('0x3a')]=qs[_0xa674('0x32')](_[_0xa674('0x3b')](_0x320e1d[_0xa674('0x30')],_0x5479d7['filters']),_0x34ac5a);if(_0x320e1d[_0xa674('0x30')][_0xa674('0x3c')]){_0x1178da['where']=_[_0xa674('0x3d')](_0x1178da[_0xa674('0x3a')],{'$or':_[_0xa674('0x2f')](_0x34ac5a,function(_0x538985){if(_0x538985['type']!==_0xa674('0x3e')){var _0xcc8348={};_0xcc8348[_0x538985[_0xa674('0x27')]]={'$like':'%'+_0x320e1d[_0xa674('0x30')][_0xa674('0x3c')]+'%'};return _0xcc8348;}})});}_0x1178da=_['merge']({},_0x1178da,_0x320e1d[_0xa674('0x3f')]);var _0x5f3cbd={'where':_0x1178da[_0xa674('0x3a')]};return db['ZohoAccount'][_0xa674('0x1d')](_0x5f3cbd)[_0xa674('0x24')](function(_0x465e31){_0x4c2e9f[_0xa674('0x1d')]=_0x465e31;if(_0x320e1d['query']['includeAll']){_0x1178da[_0xa674('0x40')]=[{'all':!![]}];}return db[_0xa674('0x2a')][_0xa674('0x41')](_0x1178da);})[_0xa674('0x24')](function(_0x2e0d6a){_0x4c2e9f[_0xa674('0x42')]=_0x2e0d6a;return _0x4c2e9f;})['then'](respondWithFilteredResult(_0x2c5245,_0x1178da))['catch'](handleError(_0x2c5245,null));};exports[_0xa674('0x43')]=function(_0x5c2db3,_0x11429d){var _0x564c2e={'raw':![],'where':{'id':_0x5c2db3[_0xa674('0x44')]['id']}},_0x222135={};_0x222135[_0xa674('0x2e')]=_[_0xa674('0x31')](db[_0xa674('0x2a')][_0xa674('0x45')]);_0x222135[_0xa674('0x30')]=_['keys'](_0x5c2db3[_0xa674('0x30')]);_0x222135[_0xa674('0x32')]=_['intersection'](_0x222135[_0xa674('0x2e')],_0x222135[_0xa674('0x30')]);_0x564c2e[_0xa674('0x33')]=_['intersection'](_0x222135[_0xa674('0x2e')],qs[_0xa674('0x35')](_0x5c2db3[_0xa674('0x30')]['fields']));_0x564c2e[_0xa674('0x33')]=_0x564c2e[_0xa674('0x33')][_0xa674('0x36')]?_0x564c2e[_0xa674('0x33')]:_0x222135[_0xa674('0x2e')];if(_0x5c2db3['query']['includeAll']){_0x564c2e[_0xa674('0x40')]=[{'all':!![]}];}_0x564c2e=_[_0xa674('0x3d')]({},_0x564c2e,_0x5c2db3[_0xa674('0x3f')]);return db['ZohoAccount'][_0xa674('0x46')](_0x564c2e)['then'](handleEntityNotFound(_0x11429d,null))[_0xa674('0x24')](respondWithResult(_0x11429d,null))[_0xa674('0x47')](handleError(_0x11429d,null));};exports['create']=function(_0x555589,_0x3c7a57){return db[_0xa674('0x2a')][_0xa674('0x48')](_0x555589['body'],{})[_0xa674('0x24')](respondWithResult(_0x3c7a57,0xc9))[_0xa674('0x47')](handleError(_0x3c7a57,null));};exports['update']=function(_0x549686,_0x52691c){if(_0x549686[_0xa674('0x49')]['id']){delete _0x549686[_0xa674('0x49')]['id'];}return db[_0xa674('0x2a')][_0xa674('0x46')]({'where':{'id':_0x549686[_0xa674('0x44')]['id']}})[_0xa674('0x24')](handleEntityNotFound(_0x52691c,null))[_0xa674('0x24')](saveUpdates(_0x549686['body'],null))[_0xa674('0x24')](respondWithResult(_0x52691c,null))[_0xa674('0x47')](handleError(_0x52691c,null));};exports[_0xa674('0x4a')]=function(_0x42645c,_0x5c1d14){return db[_0xa674('0x2a')][_0xa674('0x46')]({'where':{'id':_0x42645c['params']['id']}})[_0xa674('0x24')](handleEntityNotFound(_0x5c1d14,null))[_0xa674('0x24')](removeEntity(_0x5c1d14,null))[_0xa674('0x47')](handleError(_0x5c1d14,null));};exports[_0xa674('0x4b')]=function(_0x28bc6a,_0x2c0a6d,_0x3ecc9a){var _0x40dedf={};var _0x2a81b4={};var _0x3f54cd;var _0x43a780;return db[_0xa674('0x2a')][_0xa674('0x4c')]({'where':{'id':_0x28bc6a[_0xa674('0x44')]['id']}})[_0xa674('0x24')](handleEntityNotFound(_0x2c0a6d,null))[_0xa674('0x24')](function(_0x34b509){if(_0x34b509){_0x3f54cd=_0x34b509;_0x2a81b4['model']=_[_0xa674('0x31')](db[_0xa674('0x4d')][_0xa674('0x45')]);_0x2a81b4['query']=_[_0xa674('0x31')](_0x28bc6a[_0xa674('0x30')]);_0x2a81b4[_0xa674('0x32')]=_[_0xa674('0x34')](_0x2a81b4[_0xa674('0x2e')],_0x2a81b4[_0xa674('0x30')]);_0x40dedf[_0xa674('0x33')]=_[_0xa674('0x34')](_0x2a81b4['model'],qs[_0xa674('0x35')](_0x28bc6a[_0xa674('0x30')]['fields']));_0x40dedf[_0xa674('0x33')]=_0x40dedf[_0xa674('0x33')]['length']?_0x40dedf[_0xa674('0x33')]:_0x2a81b4[_0xa674('0x2e')];_0x40dedf[_0xa674('0x4e')]=qs['sort'](_0x28bc6a[_0xa674('0x30')]['sort']);_0x40dedf['where']=qs[_0xa674('0x32')](_[_0xa674('0x3b')](_0x28bc6a[_0xa674('0x30')],_0x2a81b4[_0xa674('0x32')]));if(_0x28bc6a[_0xa674('0x30')][_0xa674('0x3c')]){_0x40dedf[_0xa674('0x3a')]=_['merge'](_0x40dedf['where'],{'$or':_['map'](_0x40dedf[_0xa674('0x33')],function(_0x2d5342){var _0x3fc1d2={};_0x3fc1d2[_0x2d5342]={'$like':'%'+_0x28bc6a[_0xa674('0x30')][_0xa674('0x3c')]+'%'};return _0x3fc1d2;})});}_0x40dedf=_[_0xa674('0x3d')]({},_0x40dedf,_0x28bc6a['options']);return _0x3f54cd[_0xa674('0x4b')](_0x40dedf);}})[_0xa674('0x24')](function(_0x31ada1){if(_0x31ada1){_0x43a780=_0x31ada1[_0xa674('0x36')];if(!_0x28bc6a[_0xa674('0x30')][_0xa674('0x37')]('nolimit')){_0x40dedf[_0xa674('0x1c')]=qs[_0xa674('0x1c')](_0x28bc6a[_0xa674('0x30')][_0xa674('0x1c')]);_0x40dedf[_0xa674('0x1a')]=qs[_0xa674('0x1a')](_0x28bc6a[_0xa674('0x30')][_0xa674('0x1a')]);}return _0x3f54cd[_0xa674('0x4b')](_0x40dedf);}})['then'](function(_0x522fe2){if(_0x522fe2){return _0x522fe2?{'count':_0x43a780,'rows':_0x522fe2}:null;}})[_0xa674('0x24')](respondWithResult(_0x2c0a6d,null))[_0xa674('0x47')](handleError(_0x2c0a6d,null));};exports[_0xa674('0x4f')]=function(_0x11ce17,_0xae31eb,_0x4587d1){if(_0x11ce17['body']['id']){delete _0x11ce17[_0xa674('0x49')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x11ce17[_0xa674('0x44')]['id']}})[_0xa674('0x24')](handleEntityNotFound(_0xae31eb,null))[_0xa674('0x24')](function(_0x31b242){if(_0x31b242){_0x11ce17[_0xa674('0x49')]['AccountId']=_0x31b242['id'];_0x11ce17['body']['Subjects']=integrations[_0xa674('0x50')](_0x11ce17[_0xa674('0x49')][_0xa674('0x51')],_0x11ce17[_0xa674('0x49')]['type']);_0x11ce17[_0xa674('0x49')][_0xa674('0x52')]=integrations[_0xa674('0x53')](_0x11ce17[_0xa674('0x49')][_0xa674('0x51')],_0x11ce17[_0xa674('0x49')]['type']);return db[_0xa674('0x4d')][_0xa674('0x48')](_0x11ce17[_0xa674('0x49')],{'include':[{'model':db['ZohoField'],'as':_0xa674('0x54')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0xae31eb,null))['catch'](handleError(_0xae31eb,null));};function getAccessToken(_0x3517ac){return new Promise(function(_0x40e72e,_0x1e5384){var _0x218093;switch(_0x3517ac[_0xa674('0x55')]){case'US':_0x218093=_0xa674('0x56');break;case'AU':_0x218093=_0xa674('0x57');break;case'EU':_0x218093='https://accounts.zoho.eu';break;case'IN':_0x218093=_0xa674('0x58');break;case'CN':_0x218093=_0xa674('0x59');break;default:_0x218093=_0xa674('0x5a');break;}var _0x584761={'method':_0xa674('0x5b'),'uri':_0x218093+_0xa674('0x5c'),'qs':{'refresh_token':_0x3517ac[_0xa674('0x5d')],'client_id':_0x3517ac[_0xa674('0x5e')],'client_secret':_0x3517ac[_0xa674('0x5f')],'grant_type':_0xa674('0x60')},'json':!![]};return rp(_0x584761)[_0xa674('0x24')](function(_0x3a2cb3){if(_0x3a2cb3['access_token']){_0x40e72e(_0x3a2cb3['access_token']);}else{_0x1e5384(_0xa674('0x61'));}})[_0xa674('0x47')](function(_0x110f51){_0x1e5384(_0x110f51);});});}exports[_0xa674('0x62')]=function(_0x4ba9fa,_0x74eec2,_0x2e1dcb){var _0x29872d,_0x3c1a21,_0x5f655,_0x73a4f1,_0x1f9500;return db[_0xa674('0x2a')][_0xa674('0x4c')]({'where':{'id':_0x4ba9fa[_0xa674('0x44')]['id']},'attributes':['id',_0xa674('0x63'),'zone',_0xa674('0x5e'),'clientSecret',_0xa674('0x64'),_0xa674('0x65'),_0xa674('0x5d')]})[_0xa674('0x24')](handleEntityNotFound(_0x74eec2,null))[_0xa674('0x24')](function(_0x3180c2){_0x1f9500=_0x3180c2;_0x29872d=_0x1f9500[_0xa674('0x63')];_0x3c1a21=_0x29872d===_0xa674('0x66')?'eu':_0xa674('0x67');_0x5f655=_0x1f9500[_0xa674('0x64')];var _0x9d7a96=_0x5f655[_0xa674('0x68')](-0x1);if(_0x9d7a96==='/'||_0x9d7a96==='\x5c'||_0x9d7a96===':'){_0x5f655=_0x5f655[_0xa674('0x69')](0x0,_0x5f655['lastIndexOf'](_0x9d7a96));}if(!_0x1f9500[_0xa674('0x5d')]){throw new Error(_0xa674('0x6a'));}return getAccessToken(_0x1f9500);})[_0xa674('0x24')](function(_0x46ab40){if(_0x46ab40){return rp({'method':_0xa674('0x6b'),'uri':util[_0xa674('0x6c')](_0xa674('0x6d'),_0x3c1a21),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x46ab40},'json':!![]});}})[_0xa674('0x24')](function(_0x449ebd){if(_0x449ebd){if(_0x449ebd[_0xa674('0x6e')]&&_0x449ebd[_0xa674('0x6e')][_0xa674('0x25')]){throw new Error(_0x449ebd[_0xa674('0x6e')]['error'][_0xa674('0x6f')]);}var _0x33e7cf=[];var _0x10abf2=[];var _0x9ec45b=[_0xa674('0x70'),'Subject','Description',_0xa674('0x71'),'Call_Duration',_0xa674('0x72'),_0xa674('0x73'),_0xa674('0x74')];_0x10abf2=_['remove'](_0x449ebd[_0xa674('0x35')],function(_0x1e0628){return _0x9ec45b[_0xa674('0x75')](_0x1e0628[_0xa674('0x76')]);});for(var _0x5c65af=0x0;_0x5c65af<_0x10abf2[_0xa674('0x36')];_0x5c65af++){if(_0x10abf2[_0x5c65af][_0xa674('0x77')]===![]){_0x33e7cf[_0xa674('0x78')]({'id':_0x10abf2[_0x5c65af]['id'],'name':_0x10abf2[_0x5c65af][_0xa674('0x79')],'custom':_0x10abf2[_0x5c65af][_0xa674('0x7a')],'options':_0x10abf2[_0x5c65af]['data_type']===_0xa674('0x7b')&&_0x10abf2[_0x5c65af][_0xa674('0x7c')][_0xa674('0x36')]>-0x1?_[_0xa674('0x2f')](_0x10abf2[_0x5c65af]['pick_list_values'],function(_0xc74eab){return{'name':_0xc74eab,'value':_0xc74eab};}):[]});}}return{'count':_0x33e7cf[_0xa674('0x36')],'rows':_0x33e7cf};}else{return{'count':0x0,'rows':[]};}})[_0xa674('0x24')](respondWithResult(_0x74eec2,null))[_0xa674('0x47')](function(_0x51f56c){var _0x19c51c=_0x4ba9fa[_0xa674('0x30')][_0xa674('0x7d')]?0x1f4:_0x51f56c[_0xa674('0x7e')]||0x1f4;logger[_0xa674('0x25')](_0xa674('0x7f'),_0xa674('0x62'),_0x19c51c,JSON[_0xa674('0x80')](_0x51f56c));delete _0x51f56c[_0xa674('0x27')];if(_0x19c51c===0x191){_0x19c51c=0x190;}_0x74eec2[_0xa674('0x17')](_0x19c51c)[_0xa674('0x28')](_0x4ba9fa[_0xa674('0x30')][_0xa674('0x7d')]?{'message':_0xa674('0x81'),'statusCode':_0x51f56c['statusCode']}:_0x51f56c);});}; \ No newline at end of file +var _0x3fcb=['stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','ZohoAccount','includeAll','findAll','catch','show','keys','length','include','create','body','find','params','getConfigurations','ZohoConfiguration','order','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','type','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','com','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','api_name','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','rimraf','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus'];(function(_0x2db63a,_0x52ee8e){var _0x556b91=function(_0x4ad3aa){while(--_0x4ad3aa){_0x2db63a['push'](_0x2db63a['shift']());}};_0x556b91(++_0x52ee8e);}(_0x3fcb,0x1df));var _0xb3fc=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x3fcb[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0xb3fc('0x0'));var rimraf=require(_0xb3fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb3fc('0x2'));var moment=require('moment');var BPromise=require(_0xb3fc('0x3'));var Mustache=require('mustache');var util=require(_0xb3fc('0x4'));var path=require(_0xb3fc('0x5'));var sox=require('sox');var csv=require(_0xb3fc('0x6'));var ejs=require(_0xb3fc('0x7'));var fs=require('fs');var fs_extra=require(_0xb3fc('0x8'));var _=require(_0xb3fc('0x9'));var squel=require('squel');var crypto=require(_0xb3fc('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb3fc('0x6'));var querystring=require('querystring');var Papa=require(_0xb3fc('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb3fc('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb3fc('0xd'))(_0xb3fc('0xe'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb3fc('0xf'));var db=require(_0xb3fc('0x10'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2a2391,_0x567cea){_0x567cea=_0x567cea||0xcc;return function(_0x564d98){if(_0x564d98){return _0x2a2391['sendStatus'](_0x567cea);}return _0x2a2391[_0xb3fc('0x11')](_0x567cea)[_0xb3fc('0x12')]();};}function respondWithResult(_0xb8b267,_0x8fbea6){_0x8fbea6=_0x8fbea6||0xc8;return function(_0x357ef1){if(_0x357ef1){return _0xb8b267['status'](_0x8fbea6)[_0xb3fc('0x13')](_0x357ef1);}};}function respondWithFilteredResult(_0x14923,_0x3d3ce9){return function(_0xf0e84){if(_0xf0e84){var _0x265fd0=typeof _0x3d3ce9[_0xb3fc('0x14')]==='undefined'&&typeof _0x3d3ce9[_0xb3fc('0x15')]===_0xb3fc('0x16');var _0x495162=_0xf0e84[_0xb3fc('0x17')];var _0x3fad40=_0x265fd0?0x0:_0x3d3ce9[_0xb3fc('0x14')];var _0x35d271=_0x265fd0?_0xf0e84[_0xb3fc('0x17')]:_0x3d3ce9['offset']+_0x3d3ce9[_0xb3fc('0x15')];var _0x120eae;if(_0x35d271>=_0x495162){_0x35d271=_0x495162;_0x120eae=0xc8;}else{_0x120eae=0xce;}_0x14923[_0xb3fc('0x11')](_0x120eae);return _0x14923[_0xb3fc('0x18')](_0xb3fc('0x19'),_0x3fad40+'-'+_0x35d271+'/'+_0x495162)[_0xb3fc('0x13')](_0xf0e84);}return null;};}function patchUpdates(_0x46376f){return function(_0x38fbca){try{jsonpatch[_0xb3fc('0x1a')](_0x38fbca,_0x46376f,!![]);}catch(_0x554d32){return BPromise[_0xb3fc('0x1b')](_0x554d32);}return _0x38fbca[_0xb3fc('0x1c')]();};}function saveUpdates(_0xe0a181,_0x280e2e){return function(_0x982b2a){if(_0x982b2a){return _0x982b2a[_0xb3fc('0x1d')](_0xe0a181)[_0xb3fc('0x1e')](function(_0x49b351){return _0x49b351;});}return null;};}function removeEntity(_0x4f50b4,_0x351e72){return function(_0x278369){if(_0x278369){return _0x278369[_0xb3fc('0x1f')]()[_0xb3fc('0x1e')](function(){_0x4f50b4['status'](0xcc)[_0xb3fc('0x12')]();});}};}function handleEntityNotFound(_0xa920eb,_0x3d6f7f){return function(_0x21e061){if(!_0x21e061){_0xa920eb[_0xb3fc('0x20')](0x194);}return _0x21e061;};}function handleError(_0x38c35e,_0x35c827){_0x35c827=_0x35c827||0x1f4;return function(_0x2943d6){logger['error'](_0x2943d6[_0xb3fc('0x21')]);if(_0x2943d6[_0xb3fc('0x22')]){delete _0x2943d6['name'];}_0x38c35e['status'](_0x35c827)[_0xb3fc('0x23')](_0x2943d6);};}exports[_0xb3fc('0x24')]=function(_0x1ccf0a,_0x2c5772){var _0x104745={},_0x148b02={},_0x4a518c={'count':0x0,'rows':[]};var _0x564330=_[_0xb3fc('0x25')](db['ZohoAccount'][_0xb3fc('0x26')],function(_0x21589a){return{'name':_0x21589a[_0xb3fc('0x27')],'type':_0x21589a['type'][_0xb3fc('0x28')]};});_0x148b02[_0xb3fc('0x29')]=_[_0xb3fc('0x25')](_0x564330,_0xb3fc('0x22'));_0x148b02[_0xb3fc('0x2a')]=_['keys'](_0x1ccf0a['query']);_0x148b02[_0xb3fc('0x2b')]=_['intersection'](_0x148b02[_0xb3fc('0x29')],_0x148b02['query']);_0x104745[_0xb3fc('0x2c')]=_[_0xb3fc('0x2d')](_0x148b02[_0xb3fc('0x29')],qs['fields'](_0x1ccf0a[_0xb3fc('0x2a')][_0xb3fc('0x2e')]));_0x104745[_0xb3fc('0x2c')]=_0x104745[_0xb3fc('0x2c')]['length']?_0x104745[_0xb3fc('0x2c')]:_0x148b02[_0xb3fc('0x29')];if(!_0x1ccf0a[_0xb3fc('0x2a')][_0xb3fc('0x2f')]('nolimit')){_0x104745[_0xb3fc('0x15')]=qs[_0xb3fc('0x15')](_0x1ccf0a[_0xb3fc('0x2a')]['limit']);_0x104745[_0xb3fc('0x14')]=qs['offset'](_0x1ccf0a[_0xb3fc('0x2a')]['offset']);}_0x104745['order']=qs[_0xb3fc('0x30')](_0x1ccf0a[_0xb3fc('0x2a')][_0xb3fc('0x30')]);_0x104745[_0xb3fc('0x31')]=qs[_0xb3fc('0x2b')](_['pick'](_0x1ccf0a[_0xb3fc('0x2a')],_0x148b02['filters']),_0x564330);if(_0x1ccf0a[_0xb3fc('0x2a')][_0xb3fc('0x32')]){_0x104745[_0xb3fc('0x31')]=_[_0xb3fc('0x33')](_0x104745[_0xb3fc('0x31')],{'$or':_[_0xb3fc('0x25')](_0x564330,function(_0x1c6034){if(_0x1c6034['type']!==_0xb3fc('0x34')){var _0x551875={};_0x551875[_0x1c6034[_0xb3fc('0x22')]]={'$like':'%'+_0x1ccf0a[_0xb3fc('0x2a')]['filter']+'%'};return _0x551875;}})});}_0x104745=_[_0xb3fc('0x33')]({},_0x104745,_0x1ccf0a[_0xb3fc('0x35')]);var _0x483a8f={'where':_0x104745['where']};return db[_0xb3fc('0x36')]['count'](_0x483a8f)[_0xb3fc('0x1e')](function(_0x87ff6e){_0x4a518c[_0xb3fc('0x17')]=_0x87ff6e;if(_0x1ccf0a[_0xb3fc('0x2a')][_0xb3fc('0x37')]){_0x104745['include']=[{'all':!![]}];}return db[_0xb3fc('0x36')][_0xb3fc('0x38')](_0x104745);})[_0xb3fc('0x1e')](function(_0x22c72d){_0x4a518c['rows']=_0x22c72d;return _0x4a518c;})[_0xb3fc('0x1e')](respondWithFilteredResult(_0x2c5772,_0x104745))[_0xb3fc('0x39')](handleError(_0x2c5772,null));};exports[_0xb3fc('0x3a')]=function(_0x5ae532,_0x2cc852){var _0x6e6565={'raw':![],'where':{'id':_0x5ae532['params']['id']}},_0x10a466={};_0x10a466[_0xb3fc('0x29')]=_[_0xb3fc('0x3b')](db[_0xb3fc('0x36')][_0xb3fc('0x26')]);_0x10a466['query']=_[_0xb3fc('0x3b')](_0x5ae532[_0xb3fc('0x2a')]);_0x10a466[_0xb3fc('0x2b')]=_['intersection'](_0x10a466[_0xb3fc('0x29')],_0x10a466['query']);_0x6e6565[_0xb3fc('0x2c')]=_[_0xb3fc('0x2d')](_0x10a466[_0xb3fc('0x29')],qs[_0xb3fc('0x2e')](_0x5ae532['query'][_0xb3fc('0x2e')]));_0x6e6565[_0xb3fc('0x2c')]=_0x6e6565['attributes'][_0xb3fc('0x3c')]?_0x6e6565[_0xb3fc('0x2c')]:_0x10a466[_0xb3fc('0x29')];if(_0x5ae532[_0xb3fc('0x2a')][_0xb3fc('0x37')]){_0x6e6565[_0xb3fc('0x3d')]=[{'all':!![]}];}_0x6e6565=_[_0xb3fc('0x33')]({},_0x6e6565,_0x5ae532[_0xb3fc('0x35')]);return db['ZohoAccount']['find'](_0x6e6565)[_0xb3fc('0x1e')](handleEntityNotFound(_0x2cc852,null))[_0xb3fc('0x1e')](respondWithResult(_0x2cc852,null))[_0xb3fc('0x39')](handleError(_0x2cc852,null));};exports[_0xb3fc('0x3e')]=function(_0x100c61,_0x2517f5){return db[_0xb3fc('0x36')][_0xb3fc('0x3e')](_0x100c61[_0xb3fc('0x3f')],{})[_0xb3fc('0x1e')](respondWithResult(_0x2517f5,0xc9))[_0xb3fc('0x39')](handleError(_0x2517f5,null));};exports[_0xb3fc('0x1d')]=function(_0x22674c,_0x59adb2){if(_0x22674c[_0xb3fc('0x3f')]['id']){delete _0x22674c[_0xb3fc('0x3f')]['id'];}return db[_0xb3fc('0x36')][_0xb3fc('0x40')]({'where':{'id':_0x22674c['params']['id']}})[_0xb3fc('0x1e')](handleEntityNotFound(_0x59adb2,null))[_0xb3fc('0x1e')](saveUpdates(_0x22674c[_0xb3fc('0x3f')],null))[_0xb3fc('0x1e')](respondWithResult(_0x59adb2,null))[_0xb3fc('0x39')](handleError(_0x59adb2,null));};exports[_0xb3fc('0x1f')]=function(_0x5f2a9c,_0x3682b1){return db[_0xb3fc('0x36')][_0xb3fc('0x40')]({'where':{'id':_0x5f2a9c[_0xb3fc('0x41')]['id']}})[_0xb3fc('0x1e')](handleEntityNotFound(_0x3682b1,null))[_0xb3fc('0x1e')](removeEntity(_0x3682b1,null))[_0xb3fc('0x39')](handleError(_0x3682b1,null));};exports[_0xb3fc('0x42')]=function(_0x47092e,_0x350a42,_0x57d6ac){var _0x1c5154={};var _0x479925={};var _0x5d630b;var _0x367dcd;return db[_0xb3fc('0x36')]['findOne']({'where':{'id':_0x47092e[_0xb3fc('0x41')]['id']}})[_0xb3fc('0x1e')](handleEntityNotFound(_0x350a42,null))['then'](function(_0x45dfc4){if(_0x45dfc4){_0x5d630b=_0x45dfc4;_0x479925[_0xb3fc('0x29')]=_[_0xb3fc('0x3b')](db[_0xb3fc('0x43')][_0xb3fc('0x26')]);_0x479925[_0xb3fc('0x2a')]=_[_0xb3fc('0x3b')](_0x47092e[_0xb3fc('0x2a')]);_0x479925[_0xb3fc('0x2b')]=_[_0xb3fc('0x2d')](_0x479925[_0xb3fc('0x29')],_0x479925[_0xb3fc('0x2a')]);_0x1c5154[_0xb3fc('0x2c')]=_[_0xb3fc('0x2d')](_0x479925['model'],qs[_0xb3fc('0x2e')](_0x47092e[_0xb3fc('0x2a')][_0xb3fc('0x2e')]));_0x1c5154['attributes']=_0x1c5154[_0xb3fc('0x2c')][_0xb3fc('0x3c')]?_0x1c5154[_0xb3fc('0x2c')]:_0x479925[_0xb3fc('0x29')];_0x1c5154[_0xb3fc('0x44')]=qs[_0xb3fc('0x30')](_0x47092e['query'][_0xb3fc('0x30')]);_0x1c5154[_0xb3fc('0x31')]=qs[_0xb3fc('0x2b')](_['pick'](_0x47092e[_0xb3fc('0x2a')],_0x479925[_0xb3fc('0x2b')]));if(_0x47092e['query'][_0xb3fc('0x32')]){_0x1c5154[_0xb3fc('0x31')]=_[_0xb3fc('0x33')](_0x1c5154[_0xb3fc('0x31')],{'$or':_['map'](_0x1c5154[_0xb3fc('0x2c')],function(_0x1649f5){var _0x179800={};_0x179800[_0x1649f5]={'$like':'%'+_0x47092e[_0xb3fc('0x2a')][_0xb3fc('0x32')]+'%'};return _0x179800;})});}_0x1c5154=_[_0xb3fc('0x33')]({},_0x1c5154,_0x47092e[_0xb3fc('0x35')]);return _0x5d630b['getConfigurations'](_0x1c5154);}})['then'](function(_0x255177){if(_0x255177){_0x367dcd=_0x255177[_0xb3fc('0x3c')];if(!_0x47092e[_0xb3fc('0x2a')]['hasOwnProperty'](_0xb3fc('0x45'))){_0x1c5154['limit']=qs[_0xb3fc('0x15')](_0x47092e[_0xb3fc('0x2a')][_0xb3fc('0x15')]);_0x1c5154[_0xb3fc('0x14')]=qs['offset'](_0x47092e[_0xb3fc('0x2a')]['offset']);}return _0x5d630b[_0xb3fc('0x42')](_0x1c5154);}})[_0xb3fc('0x1e')](function(_0x4e3832){if(_0x4e3832){return _0x4e3832?{'count':_0x367dcd,'rows':_0x4e3832}:null;}})['then'](respondWithResult(_0x350a42,null))[_0xb3fc('0x39')](handleError(_0x350a42,null));};exports[_0xb3fc('0x46')]=function(_0x296d44,_0x1cbddd,_0xa302fc){if(_0x296d44[_0xb3fc('0x3f')]['id']){delete _0x296d44[_0xb3fc('0x3f')]['id'];}return db[_0xb3fc('0x36')][_0xb3fc('0x47')]({'where':{'id':_0x296d44[_0xb3fc('0x41')]['id']}})[_0xb3fc('0x1e')](handleEntityNotFound(_0x1cbddd,null))[_0xb3fc('0x1e')](function(_0x5de7df){if(_0x5de7df){_0x296d44[_0xb3fc('0x3f')][_0xb3fc('0x48')]=_0x5de7df['id'];_0x296d44['body'][_0xb3fc('0x49')]=integrations[_0xb3fc('0x4a')](_0x296d44['body'][_0xb3fc('0x4b')],_0x296d44['body'][_0xb3fc('0x4c')]);_0x296d44[_0xb3fc('0x3f')]['Descriptions']=integrations[_0xb3fc('0x4d')](_0x296d44[_0xb3fc('0x3f')][_0xb3fc('0x4b')],_0x296d44['body'][_0xb3fc('0x4c')]);return db[_0xb3fc('0x43')][_0xb3fc('0x3e')](_0x296d44['body'],{'include':[{'model':db[_0xb3fc('0x4e')],'as':_0xb3fc('0x49')},{'model':db['ZohoField'],'as':_0xb3fc('0x4f')}]});}return null;})['then'](respondWithResult(_0x1cbddd,null))['catch'](handleError(_0x1cbddd,null));};function getAccessToken(_0x53fd5a){return new Promise(function(_0x26c9f7,_0x41f4dc){var _0x2b8c05;switch(_0x53fd5a[_0xb3fc('0x50')]){case'US':_0x2b8c05=_0xb3fc('0x51');break;case'AU':_0x2b8c05=_0xb3fc('0x52');break;case'EU':_0x2b8c05='https://accounts.zoho.eu';break;case'IN':_0x2b8c05=_0xb3fc('0x53');break;case'CN':_0x2b8c05='https://accounts.zoho.com.cn';break;default:_0x2b8c05=_0xb3fc('0x54');break;}var _0x5b37f2={'method':_0xb3fc('0x55'),'uri':_0x2b8c05+_0xb3fc('0x56'),'qs':{'refresh_token':_0x53fd5a[_0xb3fc('0x57')],'client_id':_0x53fd5a[_0xb3fc('0x58')],'client_secret':_0x53fd5a[_0xb3fc('0x59')],'grant_type':_0xb3fc('0x5a')},'json':!![]};return rp(_0x5b37f2)[_0xb3fc('0x1e')](function(_0xf0c097){if(_0xf0c097['access_token']){_0x26c9f7(_0xf0c097[_0xb3fc('0x5b')]);}else{_0x41f4dc(_0xb3fc('0x5c'));}})['catch'](function(_0x393f05){_0x41f4dc(_0x393f05);});});}exports[_0xb3fc('0x5d')]=function(_0x18aa2e,_0x5e85f3,_0x5573cd){var _0x3e6111,_0x37f311,_0x3e62bb,_0x18c545,_0x3d22d1;return db[_0xb3fc('0x36')][_0xb3fc('0x47')]({'where':{'id':_0x18aa2e[_0xb3fc('0x41')]['id']},'attributes':['id',_0xb3fc('0x5e'),_0xb3fc('0x50'),_0xb3fc('0x58'),_0xb3fc('0x59'),_0xb3fc('0x5f'),_0xb3fc('0x60'),_0xb3fc('0x57')]})['then'](handleEntityNotFound(_0x5e85f3,null))['then'](function(_0x904ae9){_0x3d22d1=_0x904ae9;_0x3e6111=_0x3d22d1[_0xb3fc('0x5e')];_0x37f311=_0x3e6111===_0xb3fc('0x61')?'eu':_0xb3fc('0x62');_0x3e62bb=_0x3d22d1[_0xb3fc('0x5f')];var _0x569f04=_0x3e62bb['slice'](-0x1);if(_0x569f04==='/'||_0x569f04==='\x5c'||_0x569f04===':'){_0x3e62bb=_0x3e62bb['substring'](0x0,_0x3e62bb[_0xb3fc('0x63')](_0x569f04));}if(!_0x3d22d1[_0xb3fc('0x57')]){throw new Error(_0xb3fc('0x64'));}return getAccessToken(_0x3d22d1);})['then'](function(_0x389c0f){if(_0x389c0f){return rp({'method':_0xb3fc('0x65'),'uri':util[_0xb3fc('0x66')](_0xb3fc('0x67'),_0x37f311),'qs':{'module':_0xb3fc('0x68')},'headers':{'Authorization':_0xb3fc('0x69')+_0x389c0f},'json':!![]});}})[_0xb3fc('0x1e')](function(_0xfe30ad){if(_0xfe30ad){if(_0xfe30ad['response']&&_0xfe30ad[_0xb3fc('0x6a')][_0xb3fc('0x6b')]){throw new Error(_0xfe30ad[_0xb3fc('0x6a')][_0xb3fc('0x6b')][_0xb3fc('0x6c')]);}var _0x2abbe3=[];var _0x1804ba=[];var _0x832d5f=[_0xb3fc('0x6d'),_0xb3fc('0x6e'),_0xb3fc('0x6f'),_0xb3fc('0x70'),_0xb3fc('0x71'),_0xb3fc('0x72'),_0xb3fc('0x73'),_0xb3fc('0x74')];_0x1804ba=_['remove'](_0xfe30ad[_0xb3fc('0x2e')],function(_0x37246a){return _0x832d5f['includes'](_0x37246a[_0xb3fc('0x75')]);});for(var _0x30c43e=0x0;_0x30c43e<_0x1804ba[_0xb3fc('0x3c')];_0x30c43e++){if(_0x1804ba[_0x30c43e][_0xb3fc('0x76')]===![]){_0x2abbe3['push']({'id':_0x1804ba[_0x30c43e]['id'],'name':_0x1804ba[_0x30c43e][_0xb3fc('0x77')],'custom':_0x1804ba[_0x30c43e][_0xb3fc('0x78')],'options':_0x1804ba[_0x30c43e][_0xb3fc('0x79')]===_0xb3fc('0x7a')&&_0x1804ba[_0x30c43e]['pick_list_values'][_0xb3fc('0x3c')]>-0x1?_[_0xb3fc('0x25')](_0x1804ba[_0x30c43e][_0xb3fc('0x7b')],function(_0xad0924){return{'name':_0xad0924,'value':_0xad0924};}):[]});}}return{'count':_0x2abbe3[_0xb3fc('0x3c')],'rows':_0x2abbe3};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x5e85f3,null))['catch'](function(_0x170033){var _0x325821=_0x18aa2e[_0xb3fc('0x2a')]['test']?0x1f4:_0x170033[_0xb3fc('0x7c')]||0x1f4;logger[_0xb3fc('0x6b')](_0xb3fc('0x7d'),_0xb3fc('0x5d'),_0x325821,JSON[_0xb3fc('0x7e')](_0x170033));delete _0x170033['name'];if(_0x325821===0x191){_0x325821=0x190;}_0x5e85f3[_0xb3fc('0x11')](_0x325821)[_0xb3fc('0x23')](_0x18aa2e[_0xb3fc('0x2a')][_0xb3fc('0x7f')]?{'message':'Wrong\x20credentials','statusCode':_0x170033[_0xb3fc('0x7c')]}:_0x170033);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 1965c18..f420943 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 _0xdbb2=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','int_zoho_accounts','changed','zone','serverUrl','host','slice','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientSecret','application/x-www-form-urlencoded','parse','refreshToken','refresh_token','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','name','inspect','catch','clientId','code','substring','https://accounts.zoho.com','https://accounts.zoho.eu','authorization_code','then','info','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0xdbb2,0x182));var _0x2dbb=function(_0x42f1e7,_0x3a1279){_0x42f1e7=_0x42f1e7-0x0;var _0x460d91=_0xdbb2[_0x42f1e7];return _0x460d91;};'use strict';var _=require(_0x2dbb('0x0'));var util=require(_0x2dbb('0x1'));var logger=require(_0x2dbb('0x2'))(_0x2dbb('0x3'));var moment=require(_0x2dbb('0x4'));var BPromise=require(_0x2dbb('0x5'));var rp=require(_0x2dbb('0x6'));var fs=require('fs');var path=require(_0x2dbb('0x7'));var rimraf=require(_0x2dbb('0x8'));var config=require(_0x2dbb('0x9'));var attributes=require(_0x2dbb('0xa'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x583ca5,_0x3dce9d){return _0x583ca5['define']('ZohoAccount',attributes,{'tableName':_0x2dbb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x52a469,_0x3d0f45,_0x14c425){if(_0x52a469[_0x2dbb('0xc')](_0x2dbb('0xd'))||_0x52a469[_0x2dbb('0xc')](_0x2dbb('0xe'))||_0x52a469['changed']('clientId')||_0x52a469[_0x2dbb('0xc')]('clientSecret')||_0x52a469[_0x2dbb('0xc')]('code')||_0x52a469[_0x2dbb('0xc')](_0x2dbb('0xf'))){var _0x3e9f4d,_0x323a51;_0x3e9f4d=_0x52a469[_0x2dbb('0xe')];var _0xea6c7c=_0x3e9f4d[_0x2dbb('0x10')](-0x1);if(_0xea6c7c==='/'||_0xea6c7c==='\x5c'||_0xea6c7c===':'){_0x3e9f4d=_0x3e9f4d['substring'](0x0,_0x3e9f4d[_0x2dbb('0x11')](_0xea6c7c));}switch(_0x52a469[_0x2dbb('0xd')]){case'US':_0x323a51='https://accounts.zoho.com';break;case'AU':_0x323a51=_0x2dbb('0x12');break;case'IN':_0x323a51=_0x2dbb('0x13');break;case'CN':_0x323a51=_0x2dbb('0x14');break;default:_0x323a51='https://accounts.zoho.eu';break;}var _0x554740={'method':_0x2dbb('0x15'),'uri':_0x323a51+_0x2dbb('0x16'),'form':{'grant_type':'authorization_code','client_id':_0x52a469['clientId'],'client_secret':_0x52a469[_0x2dbb('0x17')],'redirect_uri':_0x52a469[_0x2dbb('0xe')],'code':_0x52a469['code']},'headers':{'Content-Type':_0x2dbb('0x18')}};return rp(_0x554740)['then'](function(_0x44d5b2){var _0x3f7a36=JSON[_0x2dbb('0x19')](_0x44d5b2);if(_0x3f7a36['refresh_token']){_0x52a469[_0x2dbb('0x1a')]=_0x3f7a36[_0x2dbb('0x1b')];logger['info'](util[_0x2dbb('0x1c')](_0x2dbb('0x1d'),_0x52a469['name'],_0x52a469['id']));}else{logger[_0x2dbb('0x1e')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x52a469[_0x2dbb('0x1f')],_0x52a469['id']),util[_0x2dbb('0x20')](_0x3f7a36,{'showHidden':![],'depth':null}));}return _0x14c425(null,_0x3d0f45);})[_0x2dbb('0x21')](function(_0x192a71){logger[_0x2dbb('0x1e')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x52a469[_0x2dbb('0x1f')],_0x52a469['id']),util[_0x2dbb('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x14c425(_0x192a71);});}else{return _0x14c425(null,_0x3d0f45);}},'beforeUpdate':function(_0x4d7139,_0x9530c0,_0x54fc9){if(_0x4d7139[_0x2dbb('0xc')](_0x2dbb('0xd'))||_0x4d7139[_0x2dbb('0xc')](_0x2dbb('0xe'))||_0x4d7139['changed'](_0x2dbb('0x22'))||_0x4d7139[_0x2dbb('0xc')](_0x2dbb('0x17'))||_0x4d7139[_0x2dbb('0xc')](_0x2dbb('0x23'))||_0x4d7139['changed']('host')){var _0x3ff445,_0x268469;_0x3ff445=_0x4d7139['serverUrl'];var _0x243e32=_0x3ff445[_0x2dbb('0x10')](-0x1);if(_0x243e32==='/'||_0x243e32==='\x5c'||_0x243e32===':'){_0x3ff445=_0x3ff445[_0x2dbb('0x24')](0x0,_0x3ff445[_0x2dbb('0x11')](_0x243e32));}switch(_0x4d7139[_0x2dbb('0xd')]){case'US':_0x268469=_0x2dbb('0x25');break;case'AU':_0x268469=_0x2dbb('0x12');break;case'IN':_0x268469=_0x2dbb('0x13');break;case'CN':_0x268469=_0x2dbb('0x14');break;default:_0x268469=_0x2dbb('0x26');break;}var _0x1cce46={'method':'POST','uri':_0x268469+_0x2dbb('0x16'),'form':{'grant_type':_0x2dbb('0x27'),'client_id':_0x4d7139['clientId'],'client_secret':_0x4d7139[_0x2dbb('0x17')],'redirect_uri':_0x4d7139['serverUrl'],'code':_0x4d7139[_0x2dbb('0x23')]},'headers':{'Content-Type':_0x2dbb('0x18')}};return rp(_0x1cce46)[_0x2dbb('0x28')](function(_0x21661f){var _0x3b6917=JSON[_0x2dbb('0x19')](_0x21661f);if(_0x3b6917[_0x2dbb('0x1b')]){_0x4d7139[_0x2dbb('0x1a')]=_0x3b6917[_0x2dbb('0x1b')];logger[_0x2dbb('0x29')](util[_0x2dbb('0x1c')](_0x2dbb('0x1d'),_0x4d7139[_0x2dbb('0x1f')],_0x4d7139['id']));}else{logger[_0x2dbb('0x1e')](util[_0x2dbb('0x1c')](_0x2dbb('0x2a'),_0x4d7139['name'],_0x4d7139['id']),util[_0x2dbb('0x20')](_0x3b6917,{'showHidden':![],'depth':null}));}return _0x54fc9(null,_0x9530c0);})[_0x2dbb('0x21')](function(_0x1d3ac1){logger[_0x2dbb('0x1e')](util[_0x2dbb('0x1c')](_0x2dbb('0x2a'),_0x4d7139[_0x2dbb('0x1f')],_0x4d7139['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x54fc9(_0x1d3ac1);});}else{return _0x54fc9(null,_0x9530c0);}}}});}; \ No newline at end of file +var _0xf7ca=['catch','slice','parse','lodash','api','moment','bluebird','request-promise','path','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','serverUrl','changed','clientId','clientSecret','code','host','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect'];(function(_0x45e28f,_0x43b0fd){var _0x117c15=function(_0x1d2bae){while(--_0x1d2bae){_0x45e28f['push'](_0x45e28f['shift']());}};_0x117c15(++_0x43b0fd);}(_0xf7ca,0x1ef));var _0xaf7c=function(_0x3c5589,_0x17563a){_0x3c5589=_0x3c5589-0x0;var _0x4c41b6=_0xf7ca[_0x3c5589];return _0x4c41b6;};'use strict';var _=require(_0xaf7c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaf7c('0x1'));var moment=require(_0xaf7c('0x2'));var BPromise=require(_0xaf7c('0x3'));var rp=require(_0xaf7c('0x4'));var fs=require('fs');var path=require(_0xaf7c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xaf7c('0x6'));module[_0xaf7c('0x7')]=function(_0x528d24,_0x596372){return _0x528d24[_0xaf7c('0x8')](_0xaf7c('0x9'),attributes,{'tableName':_0xaf7c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x443e13,_0x93fac3,_0x48de81){if(_0x443e13['changed'](_0xaf7c('0xb'))||_0x443e13['changed'](_0xaf7c('0xc'))||_0x443e13[_0xaf7c('0xd')](_0xaf7c('0xe'))||_0x443e13[_0xaf7c('0xd')](_0xaf7c('0xf'))||_0x443e13[_0xaf7c('0xd')](_0xaf7c('0x10'))||_0x443e13[_0xaf7c('0xd')](_0xaf7c('0x11'))){var _0x4bb9d9,_0x39ea79;_0x4bb9d9=_0x443e13[_0xaf7c('0xc')];var _0x4c8802=_0x4bb9d9['slice'](-0x1);if(_0x4c8802==='/'||_0x4c8802==='\x5c'||_0x4c8802===':'){_0x4bb9d9=_0x4bb9d9[_0xaf7c('0x12')](0x0,_0x4bb9d9[_0xaf7c('0x13')](_0x4c8802));}switch(_0x443e13[_0xaf7c('0xb')]){case'US':_0x39ea79=_0xaf7c('0x14');break;case'AU':_0x39ea79=_0xaf7c('0x15');break;case'IN':_0x39ea79=_0xaf7c('0x16');break;case'CN':_0x39ea79=_0xaf7c('0x17');break;default:_0x39ea79=_0xaf7c('0x18');break;}var _0x32cd9a={'method':'POST','uri':_0x39ea79+_0xaf7c('0x19'),'form':{'grant_type':_0xaf7c('0x1a'),'client_id':_0x443e13[_0xaf7c('0xe')],'client_secret':_0x443e13[_0xaf7c('0xf')],'redirect_uri':_0x443e13[_0xaf7c('0xc')],'code':_0x443e13[_0xaf7c('0x10')]},'headers':{'Content-Type':_0xaf7c('0x1b')}};return rp(_0x32cd9a)[_0xaf7c('0x1c')](function(_0x43fd86){var _0x432fb9=JSON['parse'](_0x43fd86);if(_0x432fb9[_0xaf7c('0x1d')]){_0x443e13[_0xaf7c('0x1e')]=_0x432fb9[_0xaf7c('0x1d')];logger[_0xaf7c('0x1f')](util['format'](_0xaf7c('0x20'),_0x443e13[_0xaf7c('0x21')],_0x443e13['id']));}else{logger[_0xaf7c('0x22')](util[_0xaf7c('0x23')](_0xaf7c('0x24'),_0x443e13['name'],_0x443e13['id']),util[_0xaf7c('0x25')](_0x432fb9,{'showHidden':![],'depth':null}));}return _0x48de81(null,_0x93fac3);})[_0xaf7c('0x26')](function(_0x56b1ec){logger[_0xaf7c('0x22')](util[_0xaf7c('0x23')](_0xaf7c('0x24'),_0x443e13['name'],_0x443e13['id']),util[_0xaf7c('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x48de81(_0x56b1ec);});}else{return _0x48de81(null,_0x93fac3);}},'beforeUpdate':function(_0x8d561c,_0x519ee3,_0x3f722c){if(_0x8d561c[_0xaf7c('0xd')]('zone')||_0x8d561c['changed'](_0xaf7c('0xc'))||_0x8d561c['changed'](_0xaf7c('0xe'))||_0x8d561c[_0xaf7c('0xd')](_0xaf7c('0xf'))||_0x8d561c['changed'](_0xaf7c('0x10'))||_0x8d561c['changed'](_0xaf7c('0x11'))){var _0x365b5a,_0x5e786b;_0x365b5a=_0x8d561c['serverUrl'];var _0x304578=_0x365b5a[_0xaf7c('0x27')](-0x1);if(_0x304578==='/'||_0x304578==='\x5c'||_0x304578===':'){_0x365b5a=_0x365b5a[_0xaf7c('0x12')](0x0,_0x365b5a[_0xaf7c('0x13')](_0x304578));}switch(_0x8d561c['zone']){case'US':_0x5e786b=_0xaf7c('0x14');break;case'AU':_0x5e786b=_0xaf7c('0x15');break;case'IN':_0x5e786b=_0xaf7c('0x16');break;case'CN':_0x5e786b=_0xaf7c('0x17');break;default:_0x5e786b=_0xaf7c('0x18');break;}var _0x40d8df={'method':'POST','uri':_0x5e786b+_0xaf7c('0x19'),'form':{'grant_type':_0xaf7c('0x1a'),'client_id':_0x8d561c[_0xaf7c('0xe')],'client_secret':_0x8d561c[_0xaf7c('0xf')],'redirect_uri':_0x8d561c[_0xaf7c('0xc')],'code':_0x8d561c[_0xaf7c('0x10')]},'headers':{'Content-Type':_0xaf7c('0x1b')}};return rp(_0x40d8df)['then'](function(_0x196812){var _0x492fe3=JSON[_0xaf7c('0x28')](_0x196812);if(_0x492fe3[_0xaf7c('0x1d')]){_0x8d561c['refreshToken']=_0x492fe3[_0xaf7c('0x1d')];logger[_0xaf7c('0x1f')](util[_0xaf7c('0x23')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x8d561c['name'],_0x8d561c['id']));}else{logger[_0xaf7c('0x22')](util[_0xaf7c('0x23')](_0xaf7c('0x24'),_0x8d561c[_0xaf7c('0x21')],_0x8d561c['id']),util[_0xaf7c('0x25')](_0x492fe3,{'showHidden':![],'depth':null}));}return _0x3f722c(null,_0x519ee3);})[_0xaf7c('0x26')](function(_0x2ca1bd){logger[_0xaf7c('0x22')](util[_0xaf7c('0x23')](_0xaf7c('0x24'),_0x8d561c[_0xaf7c('0x21')],_0x8d561c['id']),util[_0xaf7c('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x3f722c(_0x2ca1bd);});}else{return _0x3f722c(null,_0x519ee3);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 3b72b23..92d7c01 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 _0x4e7b=['model','map','stringify','ShowZohoAccount','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4e7b,0xf3));var _0xb4e7=function(_0xf61c3a,_0x4dcdaa){_0xf61c3a=_0xf61c3a-0x0;var _0x1811c9=_0x4e7b[_0xf61c3a];return _0x1811c9;};'use strict';var _=require(_0xb4e7('0x0'));var util=require(_0xb4e7('0x1'));var moment=require('moment');var BPromise=require(_0xb4e7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4e7('0x3'));var db=require(_0xb4e7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb4e7('0x5'))(_0xb4e7('0x6'));var config=require('../../config/environment');var jayson=require(_0xb4e7('0x7'));var client=jayson[_0xb4e7('0x8')][_0xb4e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dcf05,_0x315c27,_0x490b1b){return new BPromise(function(_0x366595,_0x3e621e){return client['request'](_0x1dcf05,_0x490b1b)[_0xb4e7('0xa')](function(_0x472973){logger[_0xb4e7('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x315c27,_0xb4e7('0xc'));logger[_0xb4e7('0xd')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x315c27,'request\x20sent',JSON['stringify'](_0x472973));if(_0x472973['error']){if(_0x472973[_0xb4e7('0xe')][_0xb4e7('0xf')]===0x1f4){logger[_0xb4e7('0xe')](_0xb4e7('0x10'),_0x315c27,_0x472973[_0xb4e7('0xe')][_0xb4e7('0x11')]);return _0x3e621e(_0x472973[_0xb4e7('0xe')][_0xb4e7('0x11')]);}logger[_0xb4e7('0xe')](_0xb4e7('0x10'),_0x315c27,_0x472973[_0xb4e7('0xe')][_0xb4e7('0x11')]);return _0x366595(_0x472973[_0xb4e7('0xe')][_0xb4e7('0x11')]);}else{logger['info'](_0xb4e7('0x10'),_0x315c27,_0xb4e7('0xc'));_0x366595(_0x472973[_0xb4e7('0x12')][_0xb4e7('0x11')]);}})[_0xb4e7('0x13')](function(_0x3078a0){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x315c27,_0x3078a0);_0x3e621e(_0x3078a0);});});}exports[_0xb4e7('0x14')]=function(_0xad7516){var _0x451572=this;return new Promise(function(_0x597f39,_0x30f45e){return db[_0xb4e7('0x15')][_0xb4e7('0x16')]({'raw':_0xad7516[_0xb4e7('0x17')]?_0xad7516['options'][_0xb4e7('0x18')]===undefined?!![]:![]:!![],'where':_0xad7516[_0xb4e7('0x17')]?_0xad7516[_0xb4e7('0x17')][_0xb4e7('0x19')]||null:null,'attributes':_0xad7516[_0xb4e7('0x17')]?_0xad7516[_0xb4e7('0x17')][_0xb4e7('0x1a')]||null:null,'limit':_0xad7516[_0xb4e7('0x17')]?_0xad7516[_0xb4e7('0x17')][_0xb4e7('0x1b')]||null:null,'include':_0xad7516[_0xb4e7('0x17')]?_0xad7516['options'][_0xb4e7('0x1c')]?_['map'](_0xad7516[_0xb4e7('0x17')][_0xb4e7('0x1c')],function(_0x30bf0e){return{'model':db[_0x30bf0e[_0xb4e7('0x1d')]],'as':_0x30bf0e['as'],'attributes':_0x30bf0e[_0xb4e7('0x1a')],'include':_0x30bf0e[_0xb4e7('0x1c')]?_[_0xb4e7('0x1e')](_0x30bf0e[_0xb4e7('0x1c')],function(_0x3002e7){return{'model':db[_0x3002e7['model']],'as':_0x3002e7['as'],'attributes':_0x3002e7[_0xb4e7('0x1a')],'include':_0x3002e7[_0xb4e7('0x1c')]?_[_0xb4e7('0x1e')](_0x3002e7[_0xb4e7('0x1c')],function(_0x55cb6f){return{'model':db[_0x55cb6f[_0xb4e7('0x1d')]],'as':_0x55cb6f['as'],'attributes':_0x55cb6f[_0xb4e7('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21c231){logger['info']('GetZohoAccount',_0xad7516);logger['debug'](_0xb4e7('0x14'),_0xad7516,JSON[_0xb4e7('0x1f')](_0x21c231));_0x597f39(_0x21c231);})[_0xb4e7('0x13')](function(_0x3732ef){logger['error'](_0xb4e7('0x14'),_0x3732ef[_0xb4e7('0x11')],_0xad7516);_0x30f45e(_0x451572[_0xb4e7('0xe')](0x1f4,_0x3732ef[_0xb4e7('0x11')]));});});};exports[_0xb4e7('0x20')]=function(_0x235cdc){var _0x3a946c=this;return new Promise(function(_0x562d1f,_0xa8bea9){return db[_0xb4e7('0x15')][_0xb4e7('0x21')]({'raw':_0x235cdc[_0xb4e7('0x17')]?_0x235cdc[_0xb4e7('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x235cdc['options']?_0x235cdc[_0xb4e7('0x17')][_0xb4e7('0x19')]||null:null,'attributes':_0x235cdc['options']?_0x235cdc[_0xb4e7('0x17')][_0xb4e7('0x1a')]||null:null,'include':_0x235cdc['options']?_0x235cdc['options']['include']?_['map'](_0x235cdc[_0xb4e7('0x17')]['include'],function(_0x140788){return{'model':db[_0x140788[_0xb4e7('0x1d')]],'as':_0x140788['as'],'attributes':_0x140788[_0xb4e7('0x1a')],'include':_0x140788[_0xb4e7('0x1c')]?_[_0xb4e7('0x1e')](_0x140788[_0xb4e7('0x1c')],function(_0x52c854){return{'model':db[_0x52c854[_0xb4e7('0x1d')]],'as':_0x52c854['as'],'attributes':_0x52c854[_0xb4e7('0x1a')],'include':_0x52c854[_0xb4e7('0x1c')]?_['map'](_0x52c854['include'],function(_0x23605e){return{'model':db[_0x23605e[_0xb4e7('0x1d')]],'as':_0x23605e['as'],'attributes':_0x23605e['attributes']};}):[]};}):[]};}):[]:[]})[_0xb4e7('0xa')](function(_0x2e9d5){logger[_0xb4e7('0xb')](_0xb4e7('0x20'),_0x235cdc);logger[_0xb4e7('0xd')](_0xb4e7('0x20'),_0x235cdc,JSON[_0xb4e7('0x1f')](_0x2e9d5));_0x562d1f(_0x2e9d5);})[_0xb4e7('0x13')](function(_0x2684ec){logger[_0xb4e7('0xe')](_0xb4e7('0x20'),_0x2684ec[_0xb4e7('0x11')],_0x235cdc);_0xa8bea9(_0x3a946c[_0xb4e7('0xe')](0x1f4,_0x2684ec[_0xb4e7('0x11')]));});});}; \ No newline at end of file +var _0x508a=['stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowZohoAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x508a,0x1aa));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa508('0x0'));var util=require('util');var moment=require(_0xa508('0x1'));var BPromise=require(_0xa508('0x2'));var rs=require(_0xa508('0x3'));var fs=require('fs');var Redis=require(_0xa508('0x4'));var db=require(_0xa508('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa508('0x6'))(_0xa508('0x7'));var config=require(_0xa508('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa508('0x9')][_0xa508('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x406df0,_0x4ddfec,_0x284fb1){return new BPromise(function(_0x6f201c,_0x4f6c23){return client[_0xa508('0xb')](_0x406df0,_0x284fb1)[_0xa508('0xc')](function(_0x577617){logger[_0xa508('0xd')](_0xa508('0xe'),_0x4ddfec,_0xa508('0xf'));logger[_0xa508('0x10')](_0xa508('0x11'),_0x4ddfec,'request\x20sent',JSON[_0xa508('0x12')](_0x577617));if(_0x577617[_0xa508('0x13')]){if(_0x577617['error'][_0xa508('0x14')]===0x1f4){logger[_0xa508('0x13')](_0xa508('0xe'),_0x4ddfec,_0x577617['error'][_0xa508('0x15')]);return _0x4f6c23(_0x577617['error'][_0xa508('0x15')]);}logger[_0xa508('0x13')](_0xa508('0xe'),_0x4ddfec,_0x577617[_0xa508('0x13')]['message']);return _0x6f201c(_0x577617[_0xa508('0x13')][_0xa508('0x15')]);}else{logger[_0xa508('0xd')](_0xa508('0xe'),_0x4ddfec,'request\x20sent');_0x6f201c(_0x577617[_0xa508('0x16')][_0xa508('0x15')]);}})[_0xa508('0x17')](function(_0xb76bf){logger['error'](_0xa508('0xe'),_0x4ddfec,_0xb76bf);_0x4f6c23(_0xb76bf);});});}exports[_0xa508('0x18')]=function(_0x5e29a8){var _0x5d345d=this;return new Promise(function(_0x1984ae,_0x226024){return db[_0xa508('0x19')][_0xa508('0x1a')]({'raw':_0x5e29a8[_0xa508('0x1b')]?_0x5e29a8[_0xa508('0x1b')][_0xa508('0x1c')]===undefined?!![]:![]:!![],'where':_0x5e29a8[_0xa508('0x1b')]?_0x5e29a8['options'][_0xa508('0x1d')]||null:null,'attributes':_0x5e29a8[_0xa508('0x1b')]?_0x5e29a8[_0xa508('0x1b')][_0xa508('0x1e')]||null:null,'limit':_0x5e29a8[_0xa508('0x1b')]?_0x5e29a8['options'][_0xa508('0x1f')]||null:null,'include':_0x5e29a8['options']?_0x5e29a8[_0xa508('0x1b')][_0xa508('0x20')]?_['map'](_0x5e29a8[_0xa508('0x1b')][_0xa508('0x20')],function(_0x14ca1c){return{'model':db[_0x14ca1c[_0xa508('0x21')]],'as':_0x14ca1c['as'],'attributes':_0x14ca1c['attributes'],'include':_0x14ca1c['include']?_['map'](_0x14ca1c[_0xa508('0x20')],function(_0x2cda06){return{'model':db[_0x2cda06[_0xa508('0x21')]],'as':_0x2cda06['as'],'attributes':_0x2cda06[_0xa508('0x1e')],'include':_0x2cda06[_0xa508('0x20')]?_[_0xa508('0x22')](_0x2cda06[_0xa508('0x20')],function(_0x4be5bf){return{'model':db[_0x4be5bf['model']],'as':_0x4be5bf['as'],'attributes':_0x4be5bf[_0xa508('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa508('0xc')](function(_0x47d93b){logger[_0xa508('0xd')]('GetZohoAccount',_0x5e29a8);logger[_0xa508('0x10')](_0xa508('0x18'),_0x5e29a8,JSON['stringify'](_0x47d93b));_0x1984ae(_0x47d93b);})[_0xa508('0x17')](function(_0x2ca53f){logger[_0xa508('0x13')](_0xa508('0x18'),_0x2ca53f['message'],_0x5e29a8);_0x226024(_0x5d345d[_0xa508('0x13')](0x1f4,_0x2ca53f[_0xa508('0x15')]));});});};exports[_0xa508('0x23')]=function(_0x5d971d){var _0x2affae=this;return new Promise(function(_0x391ba7,_0x4a7161){return db['ZohoAccount'][_0xa508('0x24')]({'raw':_0x5d971d['options']?_0x5d971d['options'][_0xa508('0x1c')]===undefined?!![]:![]:!![],'where':_0x5d971d['options']?_0x5d971d['options'][_0xa508('0x1d')]||null:null,'attributes':_0x5d971d[_0xa508('0x1b')]?_0x5d971d['options'][_0xa508('0x1e')]||null:null,'include':_0x5d971d[_0xa508('0x1b')]?_0x5d971d[_0xa508('0x1b')]['include']?_['map'](_0x5d971d[_0xa508('0x1b')][_0xa508('0x20')],function(_0x2a74dc){return{'model':db[_0x2a74dc[_0xa508('0x21')]],'as':_0x2a74dc['as'],'attributes':_0x2a74dc[_0xa508('0x1e')],'include':_0x2a74dc[_0xa508('0x20')]?_[_0xa508('0x22')](_0x2a74dc[_0xa508('0x20')],function(_0x374293){return{'model':db[_0x374293[_0xa508('0x21')]],'as':_0x374293['as'],'attributes':_0x374293[_0xa508('0x1e')],'include':_0x374293['include']?_[_0xa508('0x22')](_0x374293[_0xa508('0x20')],function(_0x453e4e){return{'model':db[_0x453e4e[_0xa508('0x21')]],'as':_0x453e4e['as'],'attributes':_0x453e4e['attributes']};}):[]};}):[]};}):[]:[]})[_0xa508('0xc')](function(_0x3de64d){logger[_0xa508('0xd')]('ShowZohoAccount',_0x5d971d);logger[_0xa508('0x10')](_0xa508('0x23'),_0x5d971d,JSON[_0xa508('0x12')](_0x3de64d));_0x391ba7(_0x3de64d);})['catch'](function(_0x4cc50e){logger[_0xa508('0x13')](_0xa508('0x23'),_0x4cc50e[_0xa508('0x15')],_0x5d971d);_0x4a7161(_0x2affae[_0xa508('0x13')](0x1f4,_0x4cc50e['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 1b2e9ab..f44fc87 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 _0xbd17=['show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id'];(function(_0x2df379,_0x35349a){var _0x2cadba=function(_0x19d4a2){while(--_0x19d4a2){_0x2df379['push'](_0x2df379['shift']());}};_0x2cadba(++_0x35349a);}(_0xbd17,0xdd));var _0x7bd1=function(_0x5c7055,_0x550d42){_0x5c7055=_0x5c7055-0x0;var _0x20d196=_0xbd17[_0x5c7055];return _0x20d196;};'use strict';var multer=require('multer');var util=require(_0x7bd1('0x0'));var path=require(_0x7bd1('0x1'));var timeout=require(_0x7bd1('0x2'));var express=require(_0x7bd1('0x3'));var router=express['Router']();var fs_extra=require(_0x7bd1('0x4'));var auth=require(_0x7bd1('0x5'));var interaction=require(_0x7bd1('0x6'));var config=require(_0x7bd1('0x7'));var controller=require(_0x7bd1('0x8'));router['get']('/',auth[_0x7bd1('0x9')](),controller[_0x7bd1('0xa')]);router[_0x7bd1('0xb')](_0x7bd1('0xc'),auth[_0x7bd1('0x9')](),controller[_0x7bd1('0xd')]);router[_0x7bd1('0xb')](_0x7bd1('0xe'),auth[_0x7bd1('0x9')](),controller[_0x7bd1('0xf')]);router[_0x7bd1('0xb')](_0x7bd1('0x10'),auth[_0x7bd1('0x9')](),controller[_0x7bd1('0x11')]);router[_0x7bd1('0xb')]('/:id/descriptions',auth[_0x7bd1('0x9')](),controller[_0x7bd1('0x12')]);router[_0x7bd1('0x13')]('/',auth[_0x7bd1('0x9')](),controller[_0x7bd1('0x14')]);router[_0x7bd1('0x15')](_0x7bd1('0xc'),auth['isAuthenticated'](),controller[_0x7bd1('0x16')]);router[_0x7bd1('0x17')](_0x7bd1('0xc'),auth[_0x7bd1('0x9')](),controller[_0x7bd1('0x18')]);module[_0x7bd1('0x19')]=router; \ No newline at end of file +var _0xd0f6=['/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects'];(function(_0x23b250,_0x416c8f){var _0x5e4a42=function(_0x21984e){while(--_0x21984e){_0x23b250['push'](_0x23b250['shift']());}};_0x5e4a42(++_0x416c8f);}(_0xd0f6,0x1b1));var _0x6d0f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd0f6[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x6d0f('0x0'));var util=require(_0x6d0f('0x1'));var path=require(_0x6d0f('0x2'));var timeout=require(_0x6d0f('0x3'));var express=require(_0x6d0f('0x4'));var router=express[_0x6d0f('0x5')]();var fs_extra=require(_0x6d0f('0x6'));var auth=require(_0x6d0f('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6d0f('0x8'));router[_0x6d0f('0x9')]('/',auth[_0x6d0f('0xa')](),controller[_0x6d0f('0xb')]);router[_0x6d0f('0x9')](_0x6d0f('0xc'),auth['isAuthenticated'](),controller[_0x6d0f('0xd')]);router[_0x6d0f('0x9')](_0x6d0f('0xe'),auth[_0x6d0f('0xa')](),controller['getFields']);router[_0x6d0f('0x9')](_0x6d0f('0xf'),auth[_0x6d0f('0xa')](),controller[_0x6d0f('0x10')]);router[_0x6d0f('0x9')](_0x6d0f('0x11'),auth['isAuthenticated'](),controller[_0x6d0f('0x12')]);router[_0x6d0f('0x13')]('/',auth[_0x6d0f('0xa')](),controller[_0x6d0f('0x14')]);router[_0x6d0f('0x15')](_0x6d0f('0xc'),auth[_0x6d0f('0xa')](),controller[_0x6d0f('0x16')]);router[_0x6d0f('0x17')]('/:id',auth[_0x6d0f('0xa')](),controller[_0x6d0f('0x18')]);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 7e6f00f..70e557e 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 _0x1294=['lead','contact','ENUM','contact_lead','sequelize','STRING'];(function(_0x3d1f63,_0x57ed3e){var _0x13f1bd=function(_0x585698){while(--_0x585698){_0x3d1f63['push'](_0x3d1f63['shift']());}};_0x13f1bd(++_0x57ed3e);}(_0x1294,0xb8));var _0x4129=function(_0x55e1d1,_0x3c9376){_0x55e1d1=_0x55e1d1-0x0;var _0x1165db=_0x1294[_0x55e1d1];return _0x1165db;};'use strict';var Sequelize=require(_0x4129('0x0'));module['exports']={'name':{'type':Sequelize[_0x4129('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x4129('0x2'),_0x4129('0x3'),'nothing'),'defaultValue':_0x4129('0x2')},'moduleSearch':{'type':Sequelize[_0x4129('0x4')](_0x4129('0x5'),_0x4129('0x3'),_0x4129('0x2')),'defaultValue':_0x4129('0x5')},'description':{'type':Sequelize[_0x4129('0x1')]}}; \ No newline at end of file +var _0x2415=['lead','contact','contact_lead','sequelize','exports','STRING','ENUM'];(function(_0x2c9cc7,_0x1ebde3){var _0x1b80d6=function(_0x370d38){while(--_0x370d38){_0x2c9cc7['push'](_0x2c9cc7['shift']());}};_0x1b80d6(++_0x1ebde3);}(_0x2415,0x7a));var _0x5241=function(_0x54d6df,_0x519a04){_0x54d6df=_0x54d6df-0x0;var _0x566f23=_0x2415[_0x54d6df];return _0x566f23;};'use strict';var Sequelize=require(_0x5241('0x0'));module[_0x5241('0x1')]={'name':{'type':Sequelize[_0x5241('0x2')]},'moduleCreate':{'type':Sequelize[_0x5241('0x3')](_0x5241('0x4'),_0x5241('0x5'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x5241('0x3')](_0x5241('0x6'),_0x5241('0x5'),_0x5241('0x4')),'defaultValue':_0x5241('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index e1020ed..80a8a35 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 _0x8070=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','body','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','save','update','then','destroy','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty'];(function(_0x332cb7,_0x45759a){var _0x23c4cb=function(_0xe0a3b6){while(--_0xe0a3b6){_0x332cb7['push'](_0x332cb7['shift']());}};_0x23c4cb(++_0x45759a);}(_0x8070,0x160));var _0x0807=function(_0x248ad3,_0x27995f){_0x248ad3=_0x248ad3-0x0;var _0x27856c=_0x8070[_0x248ad3];return _0x27856c;};'use strict';var emlformat=require(_0x0807('0x0'));var rimraf=require(_0x0807('0x1'));var zipdir=require(_0x0807('0x2'));var jsonpatch=require(_0x0807('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0807('0x4'));var Mustache=require('mustache');var util=require(_0x0807('0x5'));var path=require(_0x0807('0x6'));var sox=require(_0x0807('0x7'));var csv=require(_0x0807('0x8'));var ejs=require(_0x0807('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0807('0xa'));var squel=require(_0x0807('0xb'));var crypto=require(_0x0807('0xc'));var jsforce=require(_0x0807('0xd'));var deskjs=require(_0x0807('0xe'));var toCsv=require(_0x0807('0x8'));var querystring=require(_0x0807('0xf'));var Papa=require(_0x0807('0x10'));var Redis=require(_0x0807('0x11'));var authService=require(_0x0807('0x12'));var qs=require(_0x0807('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0807('0x14'));var logger=require(_0x0807('0x15'))(_0x0807('0x16'));var utils=require(_0x0807('0x17'));var config=require(_0x0807('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0807('0x19'))['db'];function respondWithStatusCode(_0x3ec8f3,_0x3cd6b5){_0x3cd6b5=_0x3cd6b5||0xcc;return function(_0x193c95){if(_0x193c95){return _0x3ec8f3[_0x0807('0x1a')](_0x3cd6b5);}return _0x3ec8f3['status'](_0x3cd6b5)[_0x0807('0x1b')]();};}function respondWithResult(_0x40cf33,_0x4b3c1c){_0x4b3c1c=_0x4b3c1c||0xc8;return function(_0x2b35c5){if(_0x2b35c5){return _0x40cf33[_0x0807('0x1c')](_0x4b3c1c)[_0x0807('0x1d')](_0x2b35c5);}};}function respondWithFilteredResult(_0x4b30fc,_0x7c0a37){return function(_0x381e65){if(_0x381e65){var _0x17b442=typeof _0x7c0a37[_0x0807('0x1e')]===_0x0807('0x1f')&&typeof _0x7c0a37[_0x0807('0x20')]===_0x0807('0x1f');var _0xaae226=_0x381e65[_0x0807('0x21')];var _0x2748a7=_0x17b442?0x0:_0x7c0a37[_0x0807('0x1e')];var _0x119985=_0x17b442?_0x381e65[_0x0807('0x21')]:_0x7c0a37['offset']+_0x7c0a37[_0x0807('0x20')];var _0xd2e477;if(_0x119985>=_0xaae226){_0x119985=_0xaae226;_0xd2e477=0xc8;}else{_0xd2e477=0xce;}_0x4b30fc[_0x0807('0x1c')](_0xd2e477);return _0x4b30fc['set']('Content-Range',_0x2748a7+'-'+_0x119985+'/'+_0xaae226)[_0x0807('0x1d')](_0x381e65);}return null;};}function patchUpdates(_0xf005f5){return function(_0x2a8b4f){try{jsonpatch[_0x0807('0x22')](_0x2a8b4f,_0xf005f5,!![]);}catch(_0x33478e){return BPromise['reject'](_0x33478e);}return _0x2a8b4f[_0x0807('0x23')]();};}function saveUpdates(_0xea234b,_0xd8ac39){return function(_0x1077d5){if(_0x1077d5){return _0x1077d5[_0x0807('0x24')](_0xea234b)[_0x0807('0x25')](function(_0x37e0cf){return _0x37e0cf;});}return null;};}function removeEntity(_0x41ad5f,_0x1f26ed){return function(_0x3d1626){if(_0x3d1626){return _0x3d1626[_0x0807('0x26')]()[_0x0807('0x25')](function(){_0x41ad5f['status'](0xcc)[_0x0807('0x1b')]();});}};}function handleEntityNotFound(_0xf38344,_0x414d0d){return function(_0xb70769){if(!_0xb70769){_0xf38344[_0x0807('0x1a')](0x194);}return _0xb70769;};}function handleError(_0x1b14a3,_0x1efe4e){_0x1efe4e=_0x1efe4e||0x1f4;return function(_0x27464e){logger[_0x0807('0x27')](_0x27464e[_0x0807('0x28')]);if(_0x27464e[_0x0807('0x29')]){delete _0x27464e[_0x0807('0x29')];}_0x1b14a3[_0x0807('0x1c')](_0x1efe4e)[_0x0807('0x2a')](_0x27464e);};}exports[_0x0807('0x2b')]=function(_0x4c4957,_0x2f6274){var _0x398d02={},_0x2c33bf={},_0x1e05c8={'count':0x0,'rows':[]};var _0x25ba6d=_[_0x0807('0x2c')](db[_0x0807('0x2d')][_0x0807('0x2e')],function(_0x1811bc){return{'name':_0x1811bc[_0x0807('0x2f')],'type':_0x1811bc[_0x0807('0x30')][_0x0807('0x31')]};});_0x2c33bf[_0x0807('0x32')]=_[_0x0807('0x2c')](_0x25ba6d,'name');_0x2c33bf[_0x0807('0x33')]=_[_0x0807('0x34')](_0x4c4957[_0x0807('0x33')]);_0x2c33bf[_0x0807('0x35')]=_[_0x0807('0x36')](_0x2c33bf[_0x0807('0x32')],_0x2c33bf[_0x0807('0x33')]);_0x398d02['attributes']=_['intersection'](_0x2c33bf['model'],qs[_0x0807('0x37')](_0x4c4957[_0x0807('0x33')][_0x0807('0x37')]));_0x398d02[_0x0807('0x38')]=_0x398d02[_0x0807('0x38')]['length']?_0x398d02[_0x0807('0x38')]:_0x2c33bf['model'];if(!_0x4c4957[_0x0807('0x33')][_0x0807('0x39')](_0x0807('0x3a'))){_0x398d02['limit']=qs[_0x0807('0x20')](_0x4c4957[_0x0807('0x33')][_0x0807('0x20')]);_0x398d02[_0x0807('0x1e')]=qs[_0x0807('0x1e')](_0x4c4957[_0x0807('0x33')][_0x0807('0x1e')]);}_0x398d02[_0x0807('0x3b')]=qs[_0x0807('0x3c')](_0x4c4957[_0x0807('0x33')][_0x0807('0x3c')]);_0x398d02[_0x0807('0x3d')]=qs[_0x0807('0x35')](_[_0x0807('0x3e')](_0x4c4957[_0x0807('0x33')],_0x2c33bf['filters']),_0x25ba6d);if(_0x4c4957[_0x0807('0x33')][_0x0807('0x3f')]){_0x398d02[_0x0807('0x3d')]=_[_0x0807('0x40')](_0x398d02[_0x0807('0x3d')],{'$or':_[_0x0807('0x2c')](_0x25ba6d,function(_0x65e1f){if(_0x65e1f[_0x0807('0x30')]!==_0x0807('0x41')){var _0x21aa63={};_0x21aa63[_0x65e1f[_0x0807('0x29')]]={'$like':'%'+_0x4c4957['query'][_0x0807('0x3f')]+'%'};return _0x21aa63;}})});}_0x398d02=_['merge']({},_0x398d02,_0x4c4957['options']);var _0x47b50e={'where':_0x398d02['where']};return db[_0x0807('0x2d')][_0x0807('0x21')](_0x47b50e)[_0x0807('0x25')](function(_0x584198){_0x1e05c8['count']=_0x584198;if(_0x4c4957[_0x0807('0x33')][_0x0807('0x42')]){_0x398d02[_0x0807('0x43')]=[{'all':!![]}];}return db[_0x0807('0x2d')][_0x0807('0x44')](_0x398d02);})[_0x0807('0x25')](function(_0x30d6cc){_0x1e05c8[_0x0807('0x45')]=_0x30d6cc;return _0x1e05c8;})[_0x0807('0x25')](respondWithFilteredResult(_0x2f6274,_0x398d02))[_0x0807('0x46')](handleError(_0x2f6274,null));};exports[_0x0807('0x47')]=function(_0x43ebbf,_0x4cd4d3){var _0x1c2daf={'raw':![],'where':{'id':_0x43ebbf[_0x0807('0x48')]['id']}},_0x54e193={};_0x54e193[_0x0807('0x32')]=_[_0x0807('0x34')](db[_0x0807('0x2d')][_0x0807('0x2e')]);_0x54e193[_0x0807('0x33')]=_[_0x0807('0x34')](_0x43ebbf[_0x0807('0x33')]);_0x54e193[_0x0807('0x35')]=_['intersection'](_0x54e193[_0x0807('0x32')],_0x54e193['query']);_0x1c2daf[_0x0807('0x38')]=_[_0x0807('0x36')](_0x54e193[_0x0807('0x32')],qs[_0x0807('0x37')](_0x43ebbf['query'][_0x0807('0x37')]));_0x1c2daf['attributes']=_0x1c2daf[_0x0807('0x38')][_0x0807('0x49')]?_0x1c2daf[_0x0807('0x38')]:_0x54e193[_0x0807('0x32')];if(_0x43ebbf[_0x0807('0x33')]['includeAll']){_0x1c2daf[_0x0807('0x43')]=[{'all':!![]}];}_0x1c2daf=_[_0x0807('0x40')]({},_0x1c2daf,_0x43ebbf[_0x0807('0x4a')]);return db[_0x0807('0x2d')][_0x0807('0x4b')](_0x1c2daf)[_0x0807('0x25')](handleEntityNotFound(_0x4cd4d3,null))[_0x0807('0x25')](respondWithResult(_0x4cd4d3,null))[_0x0807('0x46')](handleError(_0x4cd4d3,null));};exports['create']=function(_0x1ead12,_0x17ebe5){return db[_0x0807('0x2d')]['create'](_0x1ead12['body'],{})[_0x0807('0x25')](respondWithResult(_0x17ebe5,0xc9))['catch'](handleError(_0x17ebe5,null));};exports[_0x0807('0x24')]=function(_0x5dea6f,_0x115809){if(_0x5dea6f[_0x0807('0x4c')]['id']){delete _0x5dea6f[_0x0807('0x4c')]['id'];}return db[_0x0807('0x2d')][_0x0807('0x4b')]({'where':{'id':_0x5dea6f[_0x0807('0x48')]['id']}})[_0x0807('0x25')](handleEntityNotFound(_0x115809,null))[_0x0807('0x25')](saveUpdates(_0x5dea6f[_0x0807('0x4c')],null))[_0x0807('0x25')](respondWithResult(_0x115809,null))[_0x0807('0x46')](handleError(_0x115809,null));};exports[_0x0807('0x26')]=function(_0x556e1c,_0x282908){return db[_0x0807('0x2d')]['find']({'where':{'id':_0x556e1c[_0x0807('0x48')]['id']}})[_0x0807('0x25')](handleEntityNotFound(_0x282908,null))['then'](removeEntity(_0x282908,null))[_0x0807('0x46')](handleError(_0x282908,null));};exports[_0x0807('0x4d')]=function(_0x5c740a,_0x1c4cc4,_0xfd8555){var _0x5bc5fc={};var _0xfd4392={};var _0x449f59;var _0x28b00c;return db[_0x0807('0x2d')][_0x0807('0x4e')]({'where':{'id':_0x5c740a[_0x0807('0x48')]['id']}})[_0x0807('0x25')](handleEntityNotFound(_0x1c4cc4,null))[_0x0807('0x25')](function(_0x55a80a){if(_0x55a80a){_0x449f59=_0x55a80a;_0xfd4392[_0x0807('0x32')]=_[_0x0807('0x34')](db[_0x0807('0x4f')][_0x0807('0x2e')]);_0xfd4392[_0x0807('0x33')]=_[_0x0807('0x34')](_0x5c740a[_0x0807('0x33')]);_0xfd4392[_0x0807('0x35')]=_[_0x0807('0x36')](_0xfd4392[_0x0807('0x32')],_0xfd4392[_0x0807('0x33')]);_0x5bc5fc[_0x0807('0x38')]=_[_0x0807('0x36')](_0xfd4392[_0x0807('0x32')],qs[_0x0807('0x37')](_0x5c740a[_0x0807('0x33')][_0x0807('0x37')]));_0x5bc5fc['attributes']=_0x5bc5fc[_0x0807('0x38')][_0x0807('0x49')]?_0x5bc5fc[_0x0807('0x38')]:_0xfd4392[_0x0807('0x32')];_0x5bc5fc[_0x0807('0x3b')]=qs[_0x0807('0x3c')](_0x5c740a['query'][_0x0807('0x3c')]);_0x5bc5fc[_0x0807('0x3d')]=qs[_0x0807('0x35')](_[_0x0807('0x3e')](_0x5c740a['query'],_0xfd4392[_0x0807('0x35')]));if(_0x5c740a[_0x0807('0x33')]['filter']){_0x5bc5fc[_0x0807('0x3d')]=_['merge'](_0x5bc5fc['where'],{'$or':_[_0x0807('0x2c')](_0x5bc5fc[_0x0807('0x38')],function(_0x5d7650){var _0x4928e1={};_0x4928e1[_0x5d7650]={'$like':'%'+_0x5c740a[_0x0807('0x33')]['filter']+'%'};return _0x4928e1;})});}_0x5bc5fc=_[_0x0807('0x40')]({},_0x5bc5fc,_0x5c740a[_0x0807('0x4a')]);return _0x449f59[_0x0807('0x4d')](_0x5bc5fc);}})[_0x0807('0x25')](function(_0x2fb957){if(_0x2fb957){_0x28b00c=_0x2fb957[_0x0807('0x49')];if(!_0x5c740a['query'][_0x0807('0x39')](_0x0807('0x3a'))){_0x5bc5fc[_0x0807('0x20')]=qs[_0x0807('0x20')](_0x5c740a['query']['limit']);_0x5bc5fc[_0x0807('0x1e')]=qs[_0x0807('0x1e')](_0x5c740a[_0x0807('0x33')]['offset']);}return _0x449f59['getFields'](_0x5bc5fc);}})[_0x0807('0x25')](function(_0xd4459f){if(_0xd4459f){return _0xd4459f?{'count':_0x28b00c,'rows':_0xd4459f}:null;}})[_0x0807('0x25')](respondWithResult(_0x1c4cc4,null))[_0x0807('0x46')](handleError(_0x1c4cc4,null));};exports[_0x0807('0x50')]=function(_0x349c03,_0x23ee39,_0x2d4902){var _0x5a610a={};var _0x1bb7da={};var _0x45ace8;var _0x68891c;return db[_0x0807('0x2d')]['findOne']({'where':{'id':_0x349c03[_0x0807('0x48')]['id']}})[_0x0807('0x25')](handleEntityNotFound(_0x23ee39,null))[_0x0807('0x25')](function(_0x1bb91f){if(_0x1bb91f){_0x45ace8=_0x1bb91f;_0x1bb7da['model']=_[_0x0807('0x34')](db['ZohoField'][_0x0807('0x2e')]);_0x1bb7da['query']=_[_0x0807('0x34')](_0x349c03['query']);_0x1bb7da[_0x0807('0x35')]=_[_0x0807('0x36')](_0x1bb7da[_0x0807('0x32')],_0x1bb7da[_0x0807('0x33')]);_0x5a610a[_0x0807('0x38')]=_[_0x0807('0x36')](_0x1bb7da['model'],qs[_0x0807('0x37')](_0x349c03['query']['fields']));_0x5a610a[_0x0807('0x38')]=_0x5a610a[_0x0807('0x38')][_0x0807('0x49')]?_0x5a610a['attributes']:_0x1bb7da[_0x0807('0x32')];_0x5a610a[_0x0807('0x3b')]=qs['sort'](_0x349c03[_0x0807('0x33')][_0x0807('0x3c')]);_0x5a610a[_0x0807('0x3d')]=qs['filters'](_[_0x0807('0x3e')](_0x349c03[_0x0807('0x33')],_0x1bb7da['filters']));if(_0x349c03[_0x0807('0x33')][_0x0807('0x3f')]){_0x5a610a[_0x0807('0x3d')]=_[_0x0807('0x40')](_0x5a610a[_0x0807('0x3d')],{'$or':_[_0x0807('0x2c')](_0x5a610a[_0x0807('0x38')],function(_0x28b176){var _0x303302={};_0x303302[_0x28b176]={'$like':'%'+_0x349c03[_0x0807('0x33')]['filter']+'%'};return _0x303302;})});}_0x5a610a=_[_0x0807('0x40')]({},_0x5a610a,_0x349c03[_0x0807('0x4a')]);return _0x45ace8[_0x0807('0x50')](_0x5a610a);}})[_0x0807('0x25')](function(_0x343ffa){if(_0x343ffa){_0x68891c=_0x343ffa['length'];if(!_0x349c03[_0x0807('0x33')][_0x0807('0x39')](_0x0807('0x3a'))){_0x5a610a[_0x0807('0x20')]=qs[_0x0807('0x20')](_0x349c03[_0x0807('0x33')]['limit']);_0x5a610a[_0x0807('0x1e')]=qs[_0x0807('0x1e')](_0x349c03[_0x0807('0x33')][_0x0807('0x1e')]);}return _0x45ace8[_0x0807('0x50')](_0x5a610a);}})[_0x0807('0x25')](function(_0x8fd979){if(_0x8fd979){return _0x8fd979?{'count':_0x68891c,'rows':_0x8fd979}:null;}})['then'](respondWithResult(_0x23ee39,null))['catch'](handleError(_0x23ee39,null));};exports[_0x0807('0x51')]=function(_0x30d54b,_0x118164,_0xc1f2c2){var _0x17ad5c={};var _0x50d7c3={};var _0x57cc73;var _0x563bf4;return db[_0x0807('0x2d')][_0x0807('0x4e')]({'where':{'id':_0x30d54b[_0x0807('0x48')]['id']}})['then'](handleEntityNotFound(_0x118164,null))[_0x0807('0x25')](function(_0x89edb1){if(_0x89edb1){_0x57cc73=_0x89edb1;_0x50d7c3[_0x0807('0x32')]=_[_0x0807('0x34')](db[_0x0807('0x4f')][_0x0807('0x2e')]);_0x50d7c3['query']=_[_0x0807('0x34')](_0x30d54b[_0x0807('0x33')]);_0x50d7c3[_0x0807('0x35')]=_[_0x0807('0x36')](_0x50d7c3[_0x0807('0x32')],_0x50d7c3[_0x0807('0x33')]);_0x17ad5c[_0x0807('0x38')]=_[_0x0807('0x36')](_0x50d7c3[_0x0807('0x32')],qs[_0x0807('0x37')](_0x30d54b[_0x0807('0x33')][_0x0807('0x37')]));_0x17ad5c[_0x0807('0x38')]=_0x17ad5c[_0x0807('0x38')][_0x0807('0x49')]?_0x17ad5c['attributes']:_0x50d7c3['model'];_0x17ad5c[_0x0807('0x3b')]=qs[_0x0807('0x3c')](_0x30d54b[_0x0807('0x33')][_0x0807('0x3c')]);_0x17ad5c[_0x0807('0x3d')]=qs[_0x0807('0x35')](_[_0x0807('0x3e')](_0x30d54b[_0x0807('0x33')],_0x50d7c3['filters']));if(_0x30d54b[_0x0807('0x33')][_0x0807('0x3f')]){_0x17ad5c[_0x0807('0x3d')]=_[_0x0807('0x40')](_0x17ad5c[_0x0807('0x3d')],{'$or':_['map'](_0x17ad5c[_0x0807('0x38')],function(_0x392934){var _0x5a3293={};_0x5a3293[_0x392934]={'$like':'%'+_0x30d54b[_0x0807('0x33')][_0x0807('0x3f')]+'%'};return _0x5a3293;})});}_0x17ad5c=_[_0x0807('0x40')]({},_0x17ad5c,_0x30d54b['options']);return _0x57cc73[_0x0807('0x51')](_0x17ad5c);}})[_0x0807('0x25')](function(_0x25847a){if(_0x25847a){_0x563bf4=_0x25847a[_0x0807('0x49')];if(!_0x30d54b[_0x0807('0x33')]['hasOwnProperty'](_0x0807('0x3a'))){_0x17ad5c[_0x0807('0x20')]=qs[_0x0807('0x20')](_0x30d54b[_0x0807('0x33')][_0x0807('0x20')]);_0x17ad5c[_0x0807('0x1e')]=qs[_0x0807('0x1e')](_0x30d54b[_0x0807('0x33')][_0x0807('0x1e')]);}return _0x57cc73[_0x0807('0x51')](_0x17ad5c);}})[_0x0807('0x25')](function(_0x21ba9d){if(_0x21ba9d){return _0x21ba9d?{'count':_0x563bf4,'rows':_0x21ba9d}:null;}})[_0x0807('0x25')](respondWithResult(_0x118164,null))[_0x0807('0x46')](handleError(_0x118164,null));}; \ No newline at end of file +var _0xaf13=['create','body','getFields','ZohoField','getSubjects','getDescriptions','findOne','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ZohoConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll'];(function(_0x4d6823,_0xeb53){var _0x4217cf=function(_0x440b98){while(--_0x440b98){_0x4d6823['push'](_0x4d6823['shift']());}};_0x4217cf(++_0xeb53);}(_0xaf13,0xb1));var _0x3af1=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xaf13[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x3af1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3af1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3af1('0x2'));var moment=require(_0x3af1('0x3'));var BPromise=require(_0x3af1('0x4'));var Mustache=require('mustache');var util=require(_0x3af1('0x5'));var path=require(_0x3af1('0x6'));var sox=require(_0x3af1('0x7'));var csv=require(_0x3af1('0x8'));var ejs=require(_0x3af1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3af1('0xa'));var squel=require('squel');var crypto=require(_0x3af1('0xb'));var jsforce=require(_0x3af1('0xc'));var deskjs=require(_0x3af1('0xd'));var toCsv=require(_0x3af1('0x8'));var querystring=require('querystring');var Papa=require(_0x3af1('0xe'));var Redis=require(_0x3af1('0xf'));var authService=require(_0x3af1('0x10'));var qs=require(_0x3af1('0x11'));var as=require(_0x3af1('0x12'));var hardwareService=require(_0x3af1('0x13'));var logger=require(_0x3af1('0x14'))(_0x3af1('0x15'));var utils=require(_0x3af1('0x16'));var config=require(_0x3af1('0x17'));var licenseUtil=require(_0x3af1('0x18'));var db=require(_0x3af1('0x19'))['db'];function respondWithStatusCode(_0x553048,_0x1691e5){_0x1691e5=_0x1691e5||0xcc;return function(_0x464aa2){if(_0x464aa2){return _0x553048[_0x3af1('0x1a')](_0x1691e5);}return _0x553048[_0x3af1('0x1b')](_0x1691e5)[_0x3af1('0x1c')]();};}function respondWithResult(_0x4fb88f,_0x15118c){_0x15118c=_0x15118c||0xc8;return function(_0x3a562d){if(_0x3a562d){return _0x4fb88f[_0x3af1('0x1b')](_0x15118c)[_0x3af1('0x1d')](_0x3a562d);}};}function respondWithFilteredResult(_0x13e822,_0x5a9a05){return function(_0x3466ab){if(_0x3466ab){var _0x8292f3=typeof _0x5a9a05[_0x3af1('0x1e')]===_0x3af1('0x1f')&&typeof _0x5a9a05[_0x3af1('0x20')]===_0x3af1('0x1f');var _0x1daf37=_0x3466ab[_0x3af1('0x21')];var _0x5d4080=_0x8292f3?0x0:_0x5a9a05[_0x3af1('0x1e')];var _0x4c581b=_0x8292f3?_0x3466ab[_0x3af1('0x21')]:_0x5a9a05[_0x3af1('0x1e')]+_0x5a9a05[_0x3af1('0x20')];var _0x5a5528;if(_0x4c581b>=_0x1daf37){_0x4c581b=_0x1daf37;_0x5a5528=0xc8;}else{_0x5a5528=0xce;}_0x13e822[_0x3af1('0x1b')](_0x5a5528);return _0x13e822[_0x3af1('0x22')](_0x3af1('0x23'),_0x5d4080+'-'+_0x4c581b+'/'+_0x1daf37)[_0x3af1('0x1d')](_0x3466ab);}return null;};}function patchUpdates(_0x3ddc8b){return function(_0x546ea2){try{jsonpatch[_0x3af1('0x24')](_0x546ea2,_0x3ddc8b,!![]);}catch(_0xd9fce8){return BPromise[_0x3af1('0x25')](_0xd9fce8);}return _0x546ea2[_0x3af1('0x26')]();};}function saveUpdates(_0x154b90,_0x18a6af){return function(_0x245324){if(_0x245324){return _0x245324[_0x3af1('0x27')](_0x154b90)[_0x3af1('0x28')](function(_0x4e5fdd){return _0x4e5fdd;});}return null;};}function removeEntity(_0x29eb15,_0x36c2df){return function(_0x2b03c8){if(_0x2b03c8){return _0x2b03c8[_0x3af1('0x29')]()[_0x3af1('0x28')](function(){_0x29eb15['status'](0xcc)[_0x3af1('0x1c')]();});}};}function handleEntityNotFound(_0x3dabac,_0x2f704d){return function(_0x108d04){if(!_0x108d04){_0x3dabac[_0x3af1('0x1a')](0x194);}return _0x108d04;};}function handleError(_0x3e23d5,_0x1ed4fc){_0x1ed4fc=_0x1ed4fc||0x1f4;return function(_0x44a98b){logger[_0x3af1('0x2a')](_0x44a98b[_0x3af1('0x2b')]);if(_0x44a98b[_0x3af1('0x2c')]){delete _0x44a98b[_0x3af1('0x2c')];}_0x3e23d5[_0x3af1('0x1b')](_0x1ed4fc)[_0x3af1('0x2d')](_0x44a98b);};}exports[_0x3af1('0x2e')]=function(_0x33466f,_0xca9114){var _0x162d5b={},_0x2ac14f={},_0x16bf43={'count':0x0,'rows':[]};var _0x855708=_['map'](db[_0x3af1('0x2f')][_0x3af1('0x30')],function(_0x44a517){return{'name':_0x44a517[_0x3af1('0x31')],'type':_0x44a517['type'][_0x3af1('0x32')]};});_0x2ac14f[_0x3af1('0x33')]=_[_0x3af1('0x34')](_0x855708,_0x3af1('0x2c'));_0x2ac14f[_0x3af1('0x35')]=_[_0x3af1('0x36')](_0x33466f[_0x3af1('0x35')]);_0x2ac14f[_0x3af1('0x37')]=_[_0x3af1('0x38')](_0x2ac14f[_0x3af1('0x33')],_0x2ac14f['query']);_0x162d5b[_0x3af1('0x39')]=_['intersection'](_0x2ac14f['model'],qs['fields'](_0x33466f[_0x3af1('0x35')][_0x3af1('0x3a')]));_0x162d5b[_0x3af1('0x39')]=_0x162d5b[_0x3af1('0x39')][_0x3af1('0x3b')]?_0x162d5b[_0x3af1('0x39')]:_0x2ac14f[_0x3af1('0x33')];if(!_0x33466f[_0x3af1('0x35')][_0x3af1('0x3c')](_0x3af1('0x3d'))){_0x162d5b[_0x3af1('0x20')]=qs[_0x3af1('0x20')](_0x33466f[_0x3af1('0x35')][_0x3af1('0x20')]);_0x162d5b[_0x3af1('0x1e')]=qs[_0x3af1('0x1e')](_0x33466f[_0x3af1('0x35')]['offset']);}_0x162d5b[_0x3af1('0x3e')]=qs[_0x3af1('0x3f')](_0x33466f[_0x3af1('0x35')][_0x3af1('0x3f')]);_0x162d5b[_0x3af1('0x40')]=qs['filters'](_[_0x3af1('0x41')](_0x33466f[_0x3af1('0x35')],_0x2ac14f[_0x3af1('0x37')]),_0x855708);if(_0x33466f[_0x3af1('0x35')][_0x3af1('0x42')]){_0x162d5b['where']=_[_0x3af1('0x43')](_0x162d5b[_0x3af1('0x40')],{'$or':_[_0x3af1('0x34')](_0x855708,function(_0x143fe8){if(_0x143fe8[_0x3af1('0x44')]!==_0x3af1('0x45')){var _0x3ec5a0={};_0x3ec5a0[_0x143fe8[_0x3af1('0x2c')]]={'$like':'%'+_0x33466f['query'][_0x3af1('0x42')]+'%'};return _0x3ec5a0;}})});}_0x162d5b=_['merge']({},_0x162d5b,_0x33466f[_0x3af1('0x46')]);var _0x548e6d={'where':_0x162d5b[_0x3af1('0x40')]};return db[_0x3af1('0x2f')][_0x3af1('0x21')](_0x548e6d)[_0x3af1('0x28')](function(_0x3cc35a){_0x16bf43[_0x3af1('0x21')]=_0x3cc35a;if(_0x33466f[_0x3af1('0x35')]['includeAll']){_0x162d5b[_0x3af1('0x47')]=[{'all':!![]}];}return db[_0x3af1('0x2f')][_0x3af1('0x48')](_0x162d5b);})[_0x3af1('0x28')](function(_0x19b0bb){_0x16bf43[_0x3af1('0x49')]=_0x19b0bb;return _0x16bf43;})['then'](respondWithFilteredResult(_0xca9114,_0x162d5b))[_0x3af1('0x4a')](handleError(_0xca9114,null));};exports[_0x3af1('0x4b')]=function(_0x286278,_0x3cbedc){var _0x183477={'raw':![],'where':{'id':_0x286278[_0x3af1('0x4c')]['id']}},_0x4fdc49={};_0x4fdc49['model']=_[_0x3af1('0x36')](db[_0x3af1('0x2f')]['rawAttributes']);_0x4fdc49[_0x3af1('0x35')]=_[_0x3af1('0x36')](_0x286278[_0x3af1('0x35')]);_0x4fdc49[_0x3af1('0x37')]=_[_0x3af1('0x38')](_0x4fdc49[_0x3af1('0x33')],_0x4fdc49[_0x3af1('0x35')]);_0x183477[_0x3af1('0x39')]=_[_0x3af1('0x38')](_0x4fdc49[_0x3af1('0x33')],qs[_0x3af1('0x3a')](_0x286278[_0x3af1('0x35')][_0x3af1('0x3a')]));_0x183477[_0x3af1('0x39')]=_0x183477[_0x3af1('0x39')][_0x3af1('0x3b')]?_0x183477[_0x3af1('0x39')]:_0x4fdc49[_0x3af1('0x33')];if(_0x286278[_0x3af1('0x35')][_0x3af1('0x4d')]){_0x183477[_0x3af1('0x47')]=[{'all':!![]}];}_0x183477=_[_0x3af1('0x43')]({},_0x183477,_0x286278['options']);return db[_0x3af1('0x2f')]['find'](_0x183477)['then'](handleEntityNotFound(_0x3cbedc,null))[_0x3af1('0x28')](respondWithResult(_0x3cbedc,null))[_0x3af1('0x4a')](handleError(_0x3cbedc,null));};exports[_0x3af1('0x4e')]=function(_0x307612,_0x590beb){return db[_0x3af1('0x2f')]['create'](_0x307612[_0x3af1('0x4f')],{})[_0x3af1('0x28')](respondWithResult(_0x590beb,0xc9))[_0x3af1('0x4a')](handleError(_0x590beb,null));};exports['update']=function(_0x3fcd41,_0xd49255){if(_0x3fcd41[_0x3af1('0x4f')]['id']){delete _0x3fcd41['body']['id'];}return db[_0x3af1('0x2f')]['find']({'where':{'id':_0x3fcd41[_0x3af1('0x4c')]['id']}})['then'](handleEntityNotFound(_0xd49255,null))['then'](saveUpdates(_0x3fcd41[_0x3af1('0x4f')],null))[_0x3af1('0x28')](respondWithResult(_0xd49255,null))['catch'](handleError(_0xd49255,null));};exports[_0x3af1('0x29')]=function(_0xb85f33,_0x4291fa){return db[_0x3af1('0x2f')]['find']({'where':{'id':_0xb85f33[_0x3af1('0x4c')]['id']}})[_0x3af1('0x28')](handleEntityNotFound(_0x4291fa,null))['then'](removeEntity(_0x4291fa,null))['catch'](handleError(_0x4291fa,null));};exports[_0x3af1('0x50')]=function(_0x5bd081,_0xb6452e,_0xef6313){var _0x1aea62={};var _0x37c82={};var _0x4e6df3;var _0x195d80;return db[_0x3af1('0x2f')]['findOne']({'where':{'id':_0x5bd081['params']['id']}})['then'](handleEntityNotFound(_0xb6452e,null))['then'](function(_0x24e814){if(_0x24e814){_0x4e6df3=_0x24e814;_0x37c82[_0x3af1('0x33')]=_[_0x3af1('0x36')](db[_0x3af1('0x51')][_0x3af1('0x30')]);_0x37c82['query']=_[_0x3af1('0x36')](_0x5bd081[_0x3af1('0x35')]);_0x37c82[_0x3af1('0x37')]=_[_0x3af1('0x38')](_0x37c82['model'],_0x37c82['query']);_0x1aea62[_0x3af1('0x39')]=_['intersection'](_0x37c82[_0x3af1('0x33')],qs[_0x3af1('0x3a')](_0x5bd081[_0x3af1('0x35')]['fields']));_0x1aea62[_0x3af1('0x39')]=_0x1aea62[_0x3af1('0x39')][_0x3af1('0x3b')]?_0x1aea62[_0x3af1('0x39')]:_0x37c82[_0x3af1('0x33')];_0x1aea62[_0x3af1('0x3e')]=qs[_0x3af1('0x3f')](_0x5bd081[_0x3af1('0x35')][_0x3af1('0x3f')]);_0x1aea62[_0x3af1('0x40')]=qs[_0x3af1('0x37')](_['pick'](_0x5bd081[_0x3af1('0x35')],_0x37c82['filters']));if(_0x5bd081[_0x3af1('0x35')][_0x3af1('0x42')]){_0x1aea62[_0x3af1('0x40')]=_[_0x3af1('0x43')](_0x1aea62[_0x3af1('0x40')],{'$or':_[_0x3af1('0x34')](_0x1aea62[_0x3af1('0x39')],function(_0x1283ed){var _0x1bbf2b={};_0x1bbf2b[_0x1283ed]={'$like':'%'+_0x5bd081[_0x3af1('0x35')]['filter']+'%'};return _0x1bbf2b;})});}_0x1aea62=_[_0x3af1('0x43')]({},_0x1aea62,_0x5bd081[_0x3af1('0x46')]);return _0x4e6df3[_0x3af1('0x50')](_0x1aea62);}})['then'](function(_0x12c9ba){if(_0x12c9ba){_0x195d80=_0x12c9ba['length'];if(!_0x5bd081[_0x3af1('0x35')][_0x3af1('0x3c')](_0x3af1('0x3d'))){_0x1aea62[_0x3af1('0x20')]=qs['limit'](_0x5bd081[_0x3af1('0x35')][_0x3af1('0x20')]);_0x1aea62[_0x3af1('0x1e')]=qs[_0x3af1('0x1e')](_0x5bd081[_0x3af1('0x35')][_0x3af1('0x1e')]);}return _0x4e6df3[_0x3af1('0x50')](_0x1aea62);}})[_0x3af1('0x28')](function(_0x588789){if(_0x588789){return _0x588789?{'count':_0x195d80,'rows':_0x588789}:null;}})[_0x3af1('0x28')](respondWithResult(_0xb6452e,null))['catch'](handleError(_0xb6452e,null));};exports[_0x3af1('0x52')]=function(_0x412028,_0x366e31,_0x32c599){var _0x2b1763={};var _0x6428dc={};var _0x3d9e79;var _0x1060cd;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x412028[_0x3af1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x366e31,null))[_0x3af1('0x28')](function(_0x49a9a6){if(_0x49a9a6){_0x3d9e79=_0x49a9a6;_0x6428dc[_0x3af1('0x33')]=_[_0x3af1('0x36')](db[_0x3af1('0x51')][_0x3af1('0x30')]);_0x6428dc[_0x3af1('0x35')]=_[_0x3af1('0x36')](_0x412028['query']);_0x6428dc['filters']=_[_0x3af1('0x38')](_0x6428dc[_0x3af1('0x33')],_0x6428dc['query']);_0x2b1763[_0x3af1('0x39')]=_[_0x3af1('0x38')](_0x6428dc['model'],qs['fields'](_0x412028[_0x3af1('0x35')][_0x3af1('0x3a')]));_0x2b1763['attributes']=_0x2b1763[_0x3af1('0x39')][_0x3af1('0x3b')]?_0x2b1763[_0x3af1('0x39')]:_0x6428dc[_0x3af1('0x33')];_0x2b1763[_0x3af1('0x3e')]=qs['sort'](_0x412028[_0x3af1('0x35')][_0x3af1('0x3f')]);_0x2b1763['where']=qs[_0x3af1('0x37')](_['pick'](_0x412028['query'],_0x6428dc[_0x3af1('0x37')]));if(_0x412028[_0x3af1('0x35')][_0x3af1('0x42')]){_0x2b1763[_0x3af1('0x40')]=_[_0x3af1('0x43')](_0x2b1763['where'],{'$or':_[_0x3af1('0x34')](_0x2b1763[_0x3af1('0x39')],function(_0x174b84){var _0x4862da={};_0x4862da[_0x174b84]={'$like':'%'+_0x412028[_0x3af1('0x35')][_0x3af1('0x42')]+'%'};return _0x4862da;})});}_0x2b1763=_[_0x3af1('0x43')]({},_0x2b1763,_0x412028[_0x3af1('0x46')]);return _0x3d9e79[_0x3af1('0x52')](_0x2b1763);}})['then'](function(_0x5c3dca){if(_0x5c3dca){_0x1060cd=_0x5c3dca[_0x3af1('0x3b')];if(!_0x412028[_0x3af1('0x35')]['hasOwnProperty'](_0x3af1('0x3d'))){_0x2b1763[_0x3af1('0x20')]=qs[_0x3af1('0x20')](_0x412028[_0x3af1('0x35')]['limit']);_0x2b1763['offset']=qs[_0x3af1('0x1e')](_0x412028[_0x3af1('0x35')]['offset']);}return _0x3d9e79[_0x3af1('0x52')](_0x2b1763);}})[_0x3af1('0x28')](function(_0x414275){if(_0x414275){return _0x414275?{'count':_0x1060cd,'rows':_0x414275}:null;}})[_0x3af1('0x28')](respondWithResult(_0x366e31,null))[_0x3af1('0x4a')](handleError(_0x366e31,null));};exports[_0x3af1('0x53')]=function(_0x2788c4,_0xd38ce3,_0x3b9c45){var _0x5222d5={};var _0x2e54d2={};var _0x47b7a4;var _0x519296;return db['ZohoConfiguration'][_0x3af1('0x54')]({'where':{'id':_0x2788c4['params']['id']}})[_0x3af1('0x28')](handleEntityNotFound(_0xd38ce3,null))['then'](function(_0x186850){if(_0x186850){_0x47b7a4=_0x186850;_0x2e54d2['model']=_[_0x3af1('0x36')](db[_0x3af1('0x51')][_0x3af1('0x30')]);_0x2e54d2['query']=_['keys'](_0x2788c4['query']);_0x2e54d2[_0x3af1('0x37')]=_[_0x3af1('0x38')](_0x2e54d2[_0x3af1('0x33')],_0x2e54d2[_0x3af1('0x35')]);_0x5222d5[_0x3af1('0x39')]=_[_0x3af1('0x38')](_0x2e54d2[_0x3af1('0x33')],qs['fields'](_0x2788c4[_0x3af1('0x35')][_0x3af1('0x3a')]));_0x5222d5[_0x3af1('0x39')]=_0x5222d5[_0x3af1('0x39')][_0x3af1('0x3b')]?_0x5222d5[_0x3af1('0x39')]:_0x2e54d2[_0x3af1('0x33')];_0x5222d5[_0x3af1('0x3e')]=qs[_0x3af1('0x3f')](_0x2788c4[_0x3af1('0x35')][_0x3af1('0x3f')]);_0x5222d5[_0x3af1('0x40')]=qs[_0x3af1('0x37')](_[_0x3af1('0x41')](_0x2788c4[_0x3af1('0x35')],_0x2e54d2[_0x3af1('0x37')]));if(_0x2788c4['query'][_0x3af1('0x42')]){_0x5222d5[_0x3af1('0x40')]=_[_0x3af1('0x43')](_0x5222d5[_0x3af1('0x40')],{'$or':_[_0x3af1('0x34')](_0x5222d5[_0x3af1('0x39')],function(_0x4fae4d){var _0x450c36={};_0x450c36[_0x4fae4d]={'$like':'%'+_0x2788c4['query'][_0x3af1('0x42')]+'%'};return _0x450c36;})});}_0x5222d5=_['merge']({},_0x5222d5,_0x2788c4['options']);return _0x47b7a4['getDescriptions'](_0x5222d5);}})[_0x3af1('0x28')](function(_0x5a6eeb){if(_0x5a6eeb){_0x519296=_0x5a6eeb['length'];if(!_0x2788c4[_0x3af1('0x35')][_0x3af1('0x3c')]('nolimit')){_0x5222d5[_0x3af1('0x20')]=qs[_0x3af1('0x20')](_0x2788c4['query'][_0x3af1('0x20')]);_0x5222d5[_0x3af1('0x1e')]=qs[_0x3af1('0x1e')](_0x2788c4[_0x3af1('0x35')]['offset']);}return _0x47b7a4[_0x3af1('0x53')](_0x5222d5);}})[_0x3af1('0x28')](function(_0x591c1d){if(_0x591c1d){return _0x591c1d?{'count':_0x519296,'rows':_0x591c1d}:null;}})[_0x3af1('0x28')](respondWithResult(_0xd38ce3,null))[_0x3af1('0x4a')](handleError(_0xd38ce3,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 999f25e..51ed0d1 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 _0x436a=['bluebird','request-promise','rimraf','./intZohoConfiguration.attributes','ZohoConfiguration','int_zoho_configurations','lodash','util','moment'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x436a,0x10b));var _0xa436=function(_0x1f214b,_0x2fc240){_0x1f214b=_0x1f214b-0x0;var _0x472309=_0x436a[_0x1f214b];return _0x472309;};'use strict';var _=require(_0xa436('0x0'));var util=require(_0xa436('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa436('0x2'));var BPromise=require(_0xa436('0x3'));var rp=require(_0xa436('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa436('0x5'));var config=require('../../config/environment');var attributes=require(_0xa436('0x6'));module['exports']=function(_0x32933d,_0x3bd8df){return _0x32933d['define'](_0xa436('0x7'),attributes,{'tableName':_0xa436('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb73=['request-promise','path','./intZohoConfiguration.attributes','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','api','moment'];(function(_0x58acd3,_0x31c811){var _0x549f13=function(_0x4c48cf){while(--_0x4c48cf){_0x58acd3['push'](_0x58acd3['shift']());}};_0x549f13(++_0x31c811);}(_0xbb73,0x17f));var _0x3bb7=function(_0x40031f,_0x396036){_0x40031f=_0x40031f-0x0;var _0x5e4406=_0xbb73[_0x40031f];return _0x5e4406;};'use strict';var _=require(_0x3bb7('0x0'));var util=require('util');var logger=require(_0x3bb7('0x1'))(_0x3bb7('0x2'));var moment=require(_0x3bb7('0x3'));var BPromise=require('bluebird');var rp=require(_0x3bb7('0x4'));var fs=require('fs');var path=require(_0x3bb7('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3bb7('0x6'));module['exports']=function(_0x12c75c,_0x106403){return _0x12c75c['define'](_0x3bb7('0x7'),attributes,{'tableName':_0x3bb7('0x8'),'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 3962a46..dc3f4f2 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 _0x4943=['catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result'];(function(_0x3076f9,_0x379308){var _0x552d12=function(_0x58627e){while(--_0x58627e){_0x3076f9['push'](_0x3076f9['shift']());}};_0x552d12(++_0x379308);}(_0x4943,0x15a));var _0x3494=function(_0x2166df,_0x2f1bca){_0x2166df=_0x2166df-0x0;var _0x1e591a=_0x4943[_0x2166df];return _0x1e591a;};'use strict';var _=require('lodash');var util=require(_0x3494('0x0'));var moment=require(_0x3494('0x1'));var BPromise=require(_0x3494('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3494('0x3'));var db=require(_0x3494('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3494('0x5'))(_0x3494('0x6'));var config=require(_0x3494('0x7'));var jayson=require(_0x3494('0x8'));var client=jayson[_0x3494('0x9')][_0x3494('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x219afe,_0x1909ac,_0x1cbbbd){return new BPromise(function(_0xe6120d,_0x483060){return client[_0x3494('0xb')](_0x219afe,_0x1cbbbd)[_0x3494('0xc')](function(_0x2ef0d0){logger[_0x3494('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x1909ac,'request\x20sent');logger[_0x3494('0xe')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x1909ac,_0x3494('0xf'),JSON[_0x3494('0x10')](_0x2ef0d0));if(_0x2ef0d0[_0x3494('0x11')]){if(_0x2ef0d0[_0x3494('0x11')][_0x3494('0x12')]===0x1f4){logger[_0x3494('0x11')](_0x3494('0x13'),_0x1909ac,_0x2ef0d0[_0x3494('0x11')][_0x3494('0x14')]);return _0x483060(_0x2ef0d0['error'][_0x3494('0x14')]);}logger[_0x3494('0x11')](_0x3494('0x13'),_0x1909ac,_0x2ef0d0[_0x3494('0x11')][_0x3494('0x14')]);return _0xe6120d(_0x2ef0d0[_0x3494('0x11')][_0x3494('0x14')]);}else{logger['info'](_0x3494('0x13'),_0x1909ac,_0x3494('0xf'));_0xe6120d(_0x2ef0d0[_0x3494('0x15')][_0x3494('0x14')]);}})[_0x3494('0x16')](function(_0x3ce297){logger['error'](_0x3494('0x13'),_0x1909ac,_0x3ce297);_0x483060(_0x3ce297);});});} \ No newline at end of file +var _0xf7eb=['http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x40901f,_0x29c0a6){var _0x481958=function(_0x40730e){while(--_0x40730e){_0x40901f['push'](_0x40901f['shift']());}};_0x481958(++_0x29c0a6);}(_0xf7eb,0xd0));var _0xbf7e=function(_0x2f1195,_0x298bea){_0x2f1195=_0x2f1195-0x0;var _0x2245d1=_0xf7eb[_0x2f1195];return _0x2245d1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbf7e('0x0'));var fs=require('fs');var Redis=require(_0xbf7e('0x1'));var db=require(_0xbf7e('0x2'))['db'];var utils=require(_0xbf7e('0x3'));var logger=require(_0xbf7e('0x4'))(_0xbf7e('0x5'));var config=require(_0xbf7e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbf7e('0x7')][_0xbf7e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x373c67,_0x54bd1a,_0x452b41){return new BPromise(function(_0x1ace1c,_0x19fd2f){return client[_0xbf7e('0x9')](_0x373c67,_0x452b41)[_0xbf7e('0xa')](function(_0x1ace6c){logger[_0xbf7e('0xb')](_0xbf7e('0xc'),_0x54bd1a,'request\x20sent');logger['debug'](_0xbf7e('0xd'),_0x54bd1a,'request\x20sent',JSON[_0xbf7e('0xe')](_0x1ace6c));if(_0x1ace6c['error']){if(_0x1ace6c[_0xbf7e('0xf')]['code']===0x1f4){logger[_0xbf7e('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x54bd1a,_0x1ace6c['error'][_0xbf7e('0x10')]);return _0x19fd2f(_0x1ace6c[_0xbf7e('0xf')][_0xbf7e('0x10')]);}logger[_0xbf7e('0xf')](_0xbf7e('0xc'),_0x54bd1a,_0x1ace6c[_0xbf7e('0xf')][_0xbf7e('0x10')]);return _0x1ace1c(_0x1ace6c['error'][_0xbf7e('0x10')]);}else{logger[_0xbf7e('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x54bd1a,'request\x20sent');_0x1ace1c(_0x1ace6c[_0xbf7e('0x11')]['message']);}})['catch'](function(_0x2b577e){logger[_0xbf7e('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x54bd1a,_0x2b577e);_0x19fd2f(_0x2b577e);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index d9a2306..756d8c1 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 _0x9ab8=['get','isAuthenticated','index','/:id','show','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller'];(function(_0xfc455,_0x13a853){var _0x3f6eab=function(_0x56699a){while(--_0x56699a){_0xfc455['push'](_0xfc455['shift']());}};_0x3f6eab(++_0x13a853);}(_0x9ab8,0x87));var _0x89ab=function(_0x221cd4,_0x3269e9){_0x221cd4=_0x221cd4-0x0;var _0x5811eb=_0x9ab8[_0x221cd4];return _0x5811eb;};'use strict';var multer=require(_0x89ab('0x0'));var util=require(_0x89ab('0x1'));var path=require('path');var timeout=require(_0x89ab('0x2'));var express=require(_0x89ab('0x3'));var router=express[_0x89ab('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x89ab('0x5'));var interaction=require(_0x89ab('0x6'));var config=require(_0x89ab('0x7'));var controller=require(_0x89ab('0x8'));router[_0x89ab('0x9')]('/',auth[_0x89ab('0xa')](),controller[_0x89ab('0xb')]);router[_0x89ab('0x9')](_0x89ab('0xc'),auth[_0x89ab('0xa')](),controller[_0x89ab('0xd')]);router['post']('/',auth[_0x89ab('0xa')](),controller['create']);router[_0x89ab('0xe')](_0x89ab('0xc'),auth[_0x89ab('0xa')](),controller[_0x89ab('0xf')]);router[_0x89ab('0x10')](_0x89ab('0xc'),auth[_0x89ab('0xa')](),controller[_0x89ab('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3a19=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','/:id','post','put'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x3a19,0x196));var _0x93a1=function(_0x593396,_0x6ff39c){_0x593396=_0x593396-0x0;var _0x45c94c=_0x3a19[_0x593396];return _0x45c94c;};'use strict';var multer=require('multer');var util=require(_0x93a1('0x0'));var path=require(_0x93a1('0x1'));var timeout=require(_0x93a1('0x2'));var express=require('express');var router=express[_0x93a1('0x3')]();var fs_extra=require(_0x93a1('0x4'));var auth=require(_0x93a1('0x5'));var interaction=require(_0x93a1('0x6'));var config=require('../../config/environment');var controller=require(_0x93a1('0x7'));router[_0x93a1('0x8')]('/',auth[_0x93a1('0x9')](),controller[_0x93a1('0xa')]);router[_0x93a1('0x8')](_0x93a1('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x93a1('0xc')]('/',auth[_0x93a1('0x9')](),controller['create']);router[_0x93a1('0xd')]('/:id',auth[_0x93a1('0x9')](),controller['update']);router['delete'](_0x93a1('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x93a1('0xe')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 3ebe6b8..2d9b91e 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 _0x403b=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x403b,0x146));var _0xb403=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x403b[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xb403('0x0'));module[_0xb403('0x1')]={'type':{'type':Sequelize[_0xb403('0x2')](_0xb403('0x3'),_0xb403('0x4'),_0xb403('0x5'),_0xb403('0x6'),'picklist'),'defaultValue':_0xb403('0x3')},'content':{'type':Sequelize[_0xb403('0x7')]},'key':{'type':Sequelize[_0xb403('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0xb403('0x4'),_0xb403('0x5'))},'keyContent':{'type':Sequelize[_0xb403('0x7')]},'idField':{'type':Sequelize[_0xb403('0x7')]},'nameField':{'type':Sequelize[_0xb403('0x7')]},'customField':{'type':Sequelize[_0xb403('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb403('0x7')]}}; \ No newline at end of file +var _0x801c=['sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x801c,0x1d4));var _0xc801=function(_0x3091c3,_0x71dbc5){_0x3091c3=_0x3091c3-0x0;var _0x14130e=_0x801c[_0x3091c3];return _0x14130e;};'use strict';var Sequelize=require(_0xc801('0x0'));module[_0xc801('0x1')]={'type':{'type':Sequelize['ENUM'](_0xc801('0x2'),_0xc801('0x3'),_0xc801('0x4'),_0xc801('0x5'),_0xc801('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc801('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xc801('0x2'),_0xc801('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xc801('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc801('0x7')]},'customField':{'type':Sequelize[_0xc801('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc801('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 8b71aa3..1181390 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 _0x7e70=['find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','filters','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','length','options'];(function(_0x554eff,_0x515dd9){var _0x416215=function(_0x5a0921){while(--_0x5a0921){_0x554eff['push'](_0x554eff['shift']());}};_0x416215(++_0x515dd9);}(_0x7e70,0x98));var _0x07e7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7e70[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x07e7('0x0'));var zipdir=require(_0x07e7('0x1'));var jsonpatch=require(_0x07e7('0x2'));var rp=require(_0x07e7('0x3'));var moment=require(_0x07e7('0x4'));var BPromise=require(_0x07e7('0x5'));var Mustache=require('mustache');var util=require(_0x07e7('0x6'));var path=require(_0x07e7('0x7'));var sox=require(_0x07e7('0x8'));var csv=require(_0x07e7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x07e7('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x07e7('0xb'));var jsforce=require(_0x07e7('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x07e7('0xd'));var Papa=require(_0x07e7('0xe'));var Redis=require(_0x07e7('0xf'));var authService=require(_0x07e7('0x10'));var qs=require(_0x07e7('0x11'));var as=require(_0x07e7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x07e7('0x13'))('api');var utils=require(_0x07e7('0x14'));var config=require(_0x07e7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x07e7('0x16'))['db'];function respondWithStatusCode(_0x1c83b2,_0x2f1513){_0x2f1513=_0x2f1513||0xcc;return function(_0xd9709){if(_0xd9709){return _0x1c83b2[_0x07e7('0x17')](_0x2f1513);}return _0x1c83b2['status'](_0x2f1513)[_0x07e7('0x18')]();};}function respondWithResult(_0x475754,_0x581d95){_0x581d95=_0x581d95||0xc8;return function(_0x141227){if(_0x141227){return _0x475754[_0x07e7('0x19')](_0x581d95)[_0x07e7('0x1a')](_0x141227);}};}function respondWithFilteredResult(_0xc663fc,_0x418860){return function(_0x2f408c){if(_0x2f408c){var _0x53a711=typeof _0x418860[_0x07e7('0x1b')]===_0x07e7('0x1c')&&typeof _0x418860[_0x07e7('0x1d')]===_0x07e7('0x1c');var _0x2b1a01=_0x2f408c[_0x07e7('0x1e')];var _0x466eb8=_0x53a711?0x0:_0x418860[_0x07e7('0x1b')];var _0x34819b=_0x53a711?_0x2f408c['count']:_0x418860[_0x07e7('0x1b')]+_0x418860['limit'];var _0x137efb;if(_0x34819b>=_0x2b1a01){_0x34819b=_0x2b1a01;_0x137efb=0xc8;}else{_0x137efb=0xce;}_0xc663fc[_0x07e7('0x19')](_0x137efb);return _0xc663fc['set'](_0x07e7('0x1f'),_0x466eb8+'-'+_0x34819b+'/'+_0x2b1a01)[_0x07e7('0x1a')](_0x2f408c);}return null;};}function patchUpdates(_0x4aa5fe){return function(_0x18a1fb){try{jsonpatch[_0x07e7('0x20')](_0x18a1fb,_0x4aa5fe,!![]);}catch(_0x2e7730){return BPromise[_0x07e7('0x21')](_0x2e7730);}return _0x18a1fb[_0x07e7('0x22')]();};}function saveUpdates(_0x5555bc,_0x59cb60){return function(_0x4abb62){if(_0x4abb62){return _0x4abb62[_0x07e7('0x23')](_0x5555bc)[_0x07e7('0x24')](function(_0x5ec840){return _0x5ec840;});}return null;};}function removeEntity(_0x252ef7,_0x4a3cc2){return function(_0x1be39f){if(_0x1be39f){return _0x1be39f['destroy']()['then'](function(){_0x252ef7['status'](0xcc)[_0x07e7('0x18')]();});}};}function handleEntityNotFound(_0x348962,_0x5cc39b){return function(_0x354c37){if(!_0x354c37){_0x348962[_0x07e7('0x17')](0x194);}return _0x354c37;};}function handleError(_0x91e01d,_0x496db4){_0x496db4=_0x496db4||0x1f4;return function(_0x16e231){logger[_0x07e7('0x25')](_0x16e231[_0x07e7('0x26')]);if(_0x16e231[_0x07e7('0x27')]){delete _0x16e231['name'];}_0x91e01d[_0x07e7('0x19')](_0x496db4)[_0x07e7('0x28')](_0x16e231);};}exports['index']=function(_0x1d1a21,_0x15e007){var _0x36d201={},_0x4b7d8f={},_0xb4e7a7={'count':0x0,'rows':[]};var _0x5a7fd5=_[_0x07e7('0x29')](db[_0x07e7('0x2a')][_0x07e7('0x2b')],function(_0x39ac6f){return{'name':_0x39ac6f[_0x07e7('0x2c')],'type':_0x39ac6f[_0x07e7('0x2d')][_0x07e7('0x2e')]};});_0x4b7d8f[_0x07e7('0x2f')]=_[_0x07e7('0x29')](_0x5a7fd5,'name');_0x4b7d8f[_0x07e7('0x30')]=_[_0x07e7('0x31')](_0x1d1a21[_0x07e7('0x30')]);_0x4b7d8f['filters']=_[_0x07e7('0x32')](_0x4b7d8f[_0x07e7('0x2f')],_0x4b7d8f[_0x07e7('0x30')]);_0x36d201[_0x07e7('0x33')]=_['intersection'](_0x4b7d8f['model'],qs[_0x07e7('0x34')](_0x1d1a21[_0x07e7('0x30')][_0x07e7('0x34')]));_0x36d201['attributes']=_0x36d201[_0x07e7('0x33')]['length']?_0x36d201[_0x07e7('0x33')]:_0x4b7d8f[_0x07e7('0x2f')];if(!_0x1d1a21[_0x07e7('0x30')][_0x07e7('0x35')](_0x07e7('0x36'))){_0x36d201[_0x07e7('0x1d')]=qs[_0x07e7('0x1d')](_0x1d1a21['query'][_0x07e7('0x1d')]);_0x36d201[_0x07e7('0x1b')]=qs['offset'](_0x1d1a21[_0x07e7('0x30')]['offset']);}_0x36d201[_0x07e7('0x37')]=qs['sort'](_0x1d1a21[_0x07e7('0x30')]['sort']);_0x36d201['where']=qs[_0x07e7('0x38')](_[_0x07e7('0x39')](_0x1d1a21['query'],_0x4b7d8f[_0x07e7('0x38')]),_0x5a7fd5);if(_0x1d1a21[_0x07e7('0x30')][_0x07e7('0x3a')]){_0x36d201[_0x07e7('0x3b')]=_[_0x07e7('0x3c')](_0x36d201['where'],{'$or':_[_0x07e7('0x29')](_0x5a7fd5,function(_0x331586){if(_0x331586['type']!=='VIRTUAL'){var _0x1da4e4={};_0x1da4e4[_0x331586[_0x07e7('0x27')]]={'$like':'%'+_0x1d1a21[_0x07e7('0x30')]['filter']+'%'};return _0x1da4e4;}})});}_0x36d201=_[_0x07e7('0x3c')]({},_0x36d201,_0x1d1a21['options']);var _0x22f02c={'where':_0x36d201[_0x07e7('0x3b')]};return db[_0x07e7('0x2a')][_0x07e7('0x1e')](_0x22f02c)[_0x07e7('0x24')](function(_0xa7ca15){_0xb4e7a7[_0x07e7('0x1e')]=_0xa7ca15;if(_0x1d1a21[_0x07e7('0x30')][_0x07e7('0x3d')]){_0x36d201[_0x07e7('0x3e')]=[{'all':!![]}];}return db[_0x07e7('0x2a')][_0x07e7('0x3f')](_0x36d201);})[_0x07e7('0x24')](function(_0x1c16d9){_0xb4e7a7[_0x07e7('0x40')]=_0x1c16d9;return _0xb4e7a7;})['then'](respondWithFilteredResult(_0x15e007,_0x36d201))[_0x07e7('0x41')](handleError(_0x15e007,null));};exports[_0x07e7('0x42')]=function(_0x127cf8,_0x468226){var _0x2bf5f7={'raw':!![],'where':{'id':_0x127cf8[_0x07e7('0x43')]['id']}},_0x367793={};_0x367793['model']=_[_0x07e7('0x31')](db[_0x07e7('0x2a')][_0x07e7('0x2b')]);_0x367793[_0x07e7('0x30')]=_[_0x07e7('0x31')](_0x127cf8[_0x07e7('0x30')]);_0x367793[_0x07e7('0x38')]=_[_0x07e7('0x32')](_0x367793[_0x07e7('0x2f')],_0x367793['query']);_0x2bf5f7[_0x07e7('0x33')]=_[_0x07e7('0x32')](_0x367793[_0x07e7('0x2f')],qs[_0x07e7('0x34')](_0x127cf8[_0x07e7('0x30')][_0x07e7('0x34')]));_0x2bf5f7[_0x07e7('0x33')]=_0x2bf5f7['attributes'][_0x07e7('0x44')]?_0x2bf5f7['attributes']:_0x367793[_0x07e7('0x2f')];if(_0x127cf8[_0x07e7('0x30')][_0x07e7('0x3d')]){_0x2bf5f7[_0x07e7('0x3e')]=[{'all':!![]}];}_0x2bf5f7=_['merge']({},_0x2bf5f7,_0x127cf8[_0x07e7('0x45')]);return db[_0x07e7('0x2a')][_0x07e7('0x46')](_0x2bf5f7)['then'](handleEntityNotFound(_0x468226,null))['then'](respondWithResult(_0x468226,null))['catch'](handleError(_0x468226,null));};exports['create']=function(_0x4fadb6,_0xf0f714){return db['ZohoField'][_0x07e7('0x47')](_0x4fadb6[_0x07e7('0x48')],{})['then'](respondWithResult(_0xf0f714,0xc9))['catch'](handleError(_0xf0f714,null));};exports[_0x07e7('0x23')]=function(_0x27e898,_0x4bd468){if(_0x27e898[_0x07e7('0x48')]['id']){delete _0x27e898[_0x07e7('0x48')]['id'];}return db[_0x07e7('0x2a')][_0x07e7('0x46')]({'where':{'id':_0x27e898[_0x07e7('0x43')]['id']}})[_0x07e7('0x24')](handleEntityNotFound(_0x4bd468,null))[_0x07e7('0x24')](saveUpdates(_0x27e898[_0x07e7('0x48')],null))[_0x07e7('0x24')](respondWithResult(_0x4bd468,null))[_0x07e7('0x41')](handleError(_0x4bd468,null));};exports[_0x07e7('0x49')]=function(_0x11abe5,_0x391fb6){return db['ZohoField']['find']({'where':{'id':_0x11abe5[_0x07e7('0x43')]['id']}})[_0x07e7('0x24')](handleEntityNotFound(_0x391fb6,null))[_0x07e7('0x24')](removeEntity(_0x391fb6,null))['catch'](handleError(_0x391fb6,null));}; \ No newline at end of file +var _0xb32f=['map','ZohoField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body','params','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','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','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index'];(function(_0x592125,_0x3c3e4a){var _0x536040=function(_0x2325d1){while(--_0x2325d1){_0x592125['push'](_0x592125['shift']());}};_0x536040(++_0x3c3e4a);}(_0xb32f,0x14c));var _0xfb32=function(_0xae54cf,_0x6dd3b4){_0xae54cf=_0xae54cf-0x0;var _0x2e293d=_0xb32f[_0xae54cf];return _0x2e293d;};'use strict';var emlformat=require(_0xfb32('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfb32('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfb32('0x2'));var moment=require('moment');var BPromise=require(_0xfb32('0x3'));var Mustache=require(_0xfb32('0x4'));var util=require(_0xfb32('0x5'));var path=require(_0xfb32('0x6'));var sox=require(_0xfb32('0x7'));var csv=require(_0xfb32('0x8'));var ejs=require(_0xfb32('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb32('0xa'));var squel=require(_0xfb32('0xb'));var crypto=require(_0xfb32('0xc'));var jsforce=require(_0xfb32('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfb32('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfb32('0xf'));var qs=require(_0xfb32('0x10'));var as=require(_0xfb32('0x11'));var hardwareService=require(_0xfb32('0x12'));var logger=require('../../config/logger')(_0xfb32('0x13'));var utils=require(_0xfb32('0x14'));var config=require(_0xfb32('0x15'));var licenseUtil=require(_0xfb32('0x16'));var db=require(_0xfb32('0x17'))['db'];function respondWithStatusCode(_0x550752,_0x3bfa11){_0x3bfa11=_0x3bfa11||0xcc;return function(_0x44ddee){if(_0x44ddee){return _0x550752[_0xfb32('0x18')](_0x3bfa11);}return _0x550752[_0xfb32('0x19')](_0x3bfa11)[_0xfb32('0x1a')]();};}function respondWithResult(_0x29bea7,_0x5ea2dd){_0x5ea2dd=_0x5ea2dd||0xc8;return function(_0x5e7dd8){if(_0x5e7dd8){return _0x29bea7[_0xfb32('0x19')](_0x5ea2dd)[_0xfb32('0x1b')](_0x5e7dd8);}};}function respondWithFilteredResult(_0x2d0fe8,_0x2181e0){return function(_0x16eb00){if(_0x16eb00){var _0x2e92c3=typeof _0x2181e0[_0xfb32('0x1c')]===_0xfb32('0x1d')&&typeof _0x2181e0['limit']===_0xfb32('0x1d');var _0x36f27a=_0x16eb00[_0xfb32('0x1e')];var _0x32e057=_0x2e92c3?0x0:_0x2181e0['offset'];var _0x688c65=_0x2e92c3?_0x16eb00[_0xfb32('0x1e')]:_0x2181e0[_0xfb32('0x1c')]+_0x2181e0[_0xfb32('0x1f')];var _0x2f736e;if(_0x688c65>=_0x36f27a){_0x688c65=_0x36f27a;_0x2f736e=0xc8;}else{_0x2f736e=0xce;}_0x2d0fe8[_0xfb32('0x19')](_0x2f736e);return _0x2d0fe8[_0xfb32('0x20')]('Content-Range',_0x32e057+'-'+_0x688c65+'/'+_0x36f27a)[_0xfb32('0x1b')](_0x16eb00);}return null;};}function patchUpdates(_0x65775a){return function(_0x299e89){try{jsonpatch[_0xfb32('0x21')](_0x299e89,_0x65775a,!![]);}catch(_0x5ebe45){return BPromise[_0xfb32('0x22')](_0x5ebe45);}return _0x299e89[_0xfb32('0x23')]();};}function saveUpdates(_0x139132,_0x163bbf){return function(_0x4e7592){if(_0x4e7592){return _0x4e7592[_0xfb32('0x24')](_0x139132)[_0xfb32('0x25')](function(_0x397820){return _0x397820;});}return null;};}function removeEntity(_0x4692d9,_0x40f5ae){return function(_0x1af435){if(_0x1af435){return _0x1af435[_0xfb32('0x26')]()[_0xfb32('0x25')](function(){_0x4692d9[_0xfb32('0x19')](0xcc)[_0xfb32('0x1a')]();});}};}function handleEntityNotFound(_0x1f496c,_0x520186){return function(_0x1b3db6){if(!_0x1b3db6){_0x1f496c[_0xfb32('0x18')](0x194);}return _0x1b3db6;};}function handleError(_0x100059,_0x45f7b6){_0x45f7b6=_0x45f7b6||0x1f4;return function(_0x3e79fd){logger['error'](_0x3e79fd[_0xfb32('0x27')]);if(_0x3e79fd[_0xfb32('0x28')]){delete _0x3e79fd[_0xfb32('0x28')];}_0x100059['status'](_0x45f7b6)[_0xfb32('0x29')](_0x3e79fd);};}exports[_0xfb32('0x2a')]=function(_0x378588,_0x2517f0){var _0x330979={},_0x2e0309={},_0x167638={'count':0x0,'rows':[]};var _0x2f0bc1=_[_0xfb32('0x2b')](db[_0xfb32('0x2c')]['rawAttributes'],function(_0x2dc1bd){return{'name':_0x2dc1bd[_0xfb32('0x2d')],'type':_0x2dc1bd[_0xfb32('0x2e')][_0xfb32('0x2f')]};});_0x2e0309[_0xfb32('0x30')]=_[_0xfb32('0x2b')](_0x2f0bc1,_0xfb32('0x28'));_0x2e0309[_0xfb32('0x31')]=_[_0xfb32('0x32')](_0x378588[_0xfb32('0x31')]);_0x2e0309[_0xfb32('0x33')]=_[_0xfb32('0x34')](_0x2e0309['model'],_0x2e0309[_0xfb32('0x31')]);_0x330979[_0xfb32('0x35')]=_[_0xfb32('0x34')](_0x2e0309[_0xfb32('0x30')],qs[_0xfb32('0x36')](_0x378588[_0xfb32('0x31')][_0xfb32('0x36')]));_0x330979[_0xfb32('0x35')]=_0x330979[_0xfb32('0x35')][_0xfb32('0x37')]?_0x330979[_0xfb32('0x35')]:_0x2e0309['model'];if(!_0x378588[_0xfb32('0x31')][_0xfb32('0x38')]('nolimit')){_0x330979[_0xfb32('0x1f')]=qs[_0xfb32('0x1f')](_0x378588[_0xfb32('0x31')][_0xfb32('0x1f')]);_0x330979[_0xfb32('0x1c')]=qs[_0xfb32('0x1c')](_0x378588[_0xfb32('0x31')]['offset']);}_0x330979[_0xfb32('0x39')]=qs[_0xfb32('0x3a')](_0x378588[_0xfb32('0x31')][_0xfb32('0x3a')]);_0x330979['where']=qs['filters'](_['pick'](_0x378588[_0xfb32('0x31')],_0x2e0309[_0xfb32('0x33')]),_0x2f0bc1);if(_0x378588[_0xfb32('0x31')][_0xfb32('0x3b')]){_0x330979[_0xfb32('0x3c')]=_[_0xfb32('0x3d')](_0x330979[_0xfb32('0x3c')],{'$or':_['map'](_0x2f0bc1,function(_0xeaddd1){if(_0xeaddd1[_0xfb32('0x2e')]!==_0xfb32('0x3e')){var _0x3ba120={};_0x3ba120[_0xeaddd1[_0xfb32('0x28')]]={'$like':'%'+_0x378588['query'][_0xfb32('0x3b')]+'%'};return _0x3ba120;}})});}_0x330979=_[_0xfb32('0x3d')]({},_0x330979,_0x378588[_0xfb32('0x3f')]);var _0x437415={'where':_0x330979[_0xfb32('0x3c')]};return db[_0xfb32('0x2c')][_0xfb32('0x1e')](_0x437415)['then'](function(_0x17be46){_0x167638[_0xfb32('0x1e')]=_0x17be46;if(_0x378588[_0xfb32('0x31')]['includeAll']){_0x330979[_0xfb32('0x40')]=[{'all':!![]}];}return db[_0xfb32('0x2c')][_0xfb32('0x41')](_0x330979);})[_0xfb32('0x25')](function(_0x3108e6){_0x167638[_0xfb32('0x42')]=_0x3108e6;return _0x167638;})[_0xfb32('0x25')](respondWithFilteredResult(_0x2517f0,_0x330979))[_0xfb32('0x43')](handleError(_0x2517f0,null));};exports[_0xfb32('0x44')]=function(_0x33b290,_0x46c19b){var _0x29b72a={'raw':!![],'where':{'id':_0x33b290['params']['id']}},_0x1b760c={};_0x1b760c[_0xfb32('0x30')]=_[_0xfb32('0x32')](db[_0xfb32('0x2c')][_0xfb32('0x45')]);_0x1b760c['query']=_['keys'](_0x33b290[_0xfb32('0x31')]);_0x1b760c[_0xfb32('0x33')]=_[_0xfb32('0x34')](_0x1b760c[_0xfb32('0x30')],_0x1b760c[_0xfb32('0x31')]);_0x29b72a['attributes']=_[_0xfb32('0x34')](_0x1b760c[_0xfb32('0x30')],qs[_0xfb32('0x36')](_0x33b290[_0xfb32('0x31')]['fields']));_0x29b72a['attributes']=_0x29b72a[_0xfb32('0x35')]['length']?_0x29b72a[_0xfb32('0x35')]:_0x1b760c['model'];if(_0x33b290[_0xfb32('0x31')][_0xfb32('0x46')]){_0x29b72a['include']=[{'all':!![]}];}_0x29b72a=_['merge']({},_0x29b72a,_0x33b290[_0xfb32('0x3f')]);return db[_0xfb32('0x2c')][_0xfb32('0x47')](_0x29b72a)[_0xfb32('0x25')](handleEntityNotFound(_0x46c19b,null))['then'](respondWithResult(_0x46c19b,null))['catch'](handleError(_0x46c19b,null));};exports[_0xfb32('0x48')]=function(_0x10af54,_0x155bb0){return db['ZohoField'][_0xfb32('0x48')](_0x10af54[_0xfb32('0x49')],{})['then'](respondWithResult(_0x155bb0,0xc9))[_0xfb32('0x43')](handleError(_0x155bb0,null));};exports['update']=function(_0x58f0a2,_0x4ccaca){if(_0x58f0a2[_0xfb32('0x49')]['id']){delete _0x58f0a2['body']['id'];}return db['ZohoField']['find']({'where':{'id':_0x58f0a2[_0xfb32('0x4a')]['id']}})[_0xfb32('0x25')](handleEntityNotFound(_0x4ccaca,null))[_0xfb32('0x25')](saveUpdates(_0x58f0a2[_0xfb32('0x49')],null))[_0xfb32('0x25')](respondWithResult(_0x4ccaca,null))[_0xfb32('0x43')](handleError(_0x4ccaca,null));};exports[_0xfb32('0x26')]=function(_0x2fec46,_0x26a2e2){return db['ZohoField']['find']({'where':{'id':_0x2fec46[_0xfb32('0x4a')]['id']}})['then'](handleEntityNotFound(_0x26a2e2,null))[_0xfb32('0x25')](removeEntity(_0x26a2e2,null))[_0xfb32('0x43')](handleError(_0x26a2e2,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 69809c9..a784ff8 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 _0xba34=['FieldId','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./intZohoField.attributes','exports','define','int_zoho_fields','zoho_unique_index','idField'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xba34,0x119));var _0x4ba3=function(_0x266ae2,_0x274cf5){_0x266ae2=_0x266ae2-0x0;var _0x5117d2=_0xba34[_0x266ae2];return _0x5117d2;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));module[_0x4ba3('0x8')]=function(_0x3590a1,_0xb88621){return _0x3590a1[_0x4ba3('0x9')]('ZohoField',attributes,{'tableName':_0x4ba3('0xa'),'paranoid':![],'indexes':[{'name':_0x4ba3('0xb'),'fields':[_0x4ba3('0xc'),_0x4ba3('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4bd3=['lodash','../../config/logger','api','path','rimraf','../../config/environment','exports','define','ZohoField','zoho_unique_index','idField','FieldId'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x4bd3,0x174));var _0x34bd=function(_0x2df448,_0x1b4160){_0x2df448=_0x2df448-0x0;var _0x2357c2=_0x4bd3[_0x2df448];return _0x2357c2;};'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('./intZohoField.attributes');module[_0x34bd('0x6')]=function(_0x2a15a2,_0x5c2a7a){return _0x2a15a2[_0x34bd('0x7')](_0x34bd('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x34bd('0x9'),'fields':[_0x34bd('0xa'),_0x34bd('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 1fced97..75eca8f 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 _0x8e57=['ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0xb7d2ee,_0x44552d){var _0x4556e9=function(_0x1bd052){while(--_0x1bd052){_0xb7d2ee['push'](_0xb7d2ee['shift']());}};_0x4556e9(++_0x44552d);}(_0x8e57,0x92));var _0x78e5=function(_0x19517b,_0x3413d6){_0x19517b=_0x19517b-0x0;var _0x45b6f0=_0x8e57[_0x19517b];return _0x45b6f0;};'use strict';var _=require(_0x78e5('0x0'));var util=require(_0x78e5('0x1'));var moment=require(_0x78e5('0x2'));var BPromise=require(_0x78e5('0x3'));var rs=require(_0x78e5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78e5('0x5'))['db'];var utils=require(_0x78e5('0x6'));var logger=require(_0x78e5('0x7'))(_0x78e5('0x8'));var config=require(_0x78e5('0x9'));var jayson=require(_0x78e5('0xa'));var client=jayson[_0x78e5('0xb')][_0x78e5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x25ee19,_0x10c455,_0x125f44){return new BPromise(function(_0xa1e2de,_0x4fa140){return client[_0x78e5('0xd')](_0x25ee19,_0x125f44)['then'](function(_0x382517){logger[_0x78e5('0xe')](_0x78e5('0xf'),_0x10c455,_0x78e5('0x10'));logger['debug'](_0x78e5('0x11'),_0x10c455,_0x78e5('0x10'),JSON[_0x78e5('0x12')](_0x382517));if(_0x382517[_0x78e5('0x13')]){if(_0x382517[_0x78e5('0x13')][_0x78e5('0x14')]===0x1f4){logger[_0x78e5('0x13')](_0x78e5('0xf'),_0x10c455,_0x382517['error'][_0x78e5('0x15')]);return _0x4fa140(_0x382517[_0x78e5('0x13')][_0x78e5('0x15')]);}logger[_0x78e5('0x13')](_0x78e5('0xf'),_0x10c455,_0x382517['error']['message']);return _0xa1e2de(_0x382517[_0x78e5('0x13')][_0x78e5('0x15')]);}else{logger['info'](_0x78e5('0xf'),_0x10c455,_0x78e5('0x10'));_0xa1e2de(_0x382517[_0x78e5('0x16')][_0x78e5('0x15')]);}})['catch'](function(_0x13d7b1){logger[_0x78e5('0x13')](_0x78e5('0xf'),_0x10c455,_0x13d7b1);_0x4fa140(_0x13d7b1);});});} \ No newline at end of file +var _0x20c8=['jayson/promise','client','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x42bfb7,_0x25a3ec){var _0x5c497d=function(_0x48e83e){while(--_0x48e83e){_0x42bfb7['push'](_0x42bfb7['shift']());}};_0x5c497d(++_0x25a3ec);}(_0x20c8,0x148));var _0x820c=function(_0x3106f8,_0x239301){_0x3106f8=_0x3106f8-0x0;var _0x5383a7=_0x20c8[_0x3106f8];return _0x5383a7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x820c('0x0'));var BPromise=require(_0x820c('0x1'));var rs=require(_0x820c('0x2'));var fs=require('fs');var Redis=require(_0x820c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x820c('0x4'));var logger=require(_0x820c('0x5'))(_0x820c('0x6'));var config=require(_0x820c('0x7'));var jayson=require(_0x820c('0x8'));var client=jayson[_0x820c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x411097,_0x3148d8,_0x2d229c){return new BPromise(function(_0x45a9e0,_0x4a602a){return client[_0x820c('0xa')](_0x411097,_0x2d229c)['then'](function(_0xeb58b6){logger[_0x820c('0xb')](_0x820c('0xc'),_0x3148d8,_0x820c('0xd'));logger[_0x820c('0xe')](_0x820c('0xf'),_0x3148d8,'request\x20sent',JSON[_0x820c('0x10')](_0xeb58b6));if(_0xeb58b6['error']){if(_0xeb58b6[_0x820c('0x11')][_0x820c('0x12')]===0x1f4){logger[_0x820c('0x11')](_0x820c('0xc'),_0x3148d8,_0xeb58b6[_0x820c('0x11')][_0x820c('0x13')]);return _0x4a602a(_0xeb58b6[_0x820c('0x11')][_0x820c('0x13')]);}logger['error'](_0x820c('0xc'),_0x3148d8,_0xeb58b6[_0x820c('0x11')][_0x820c('0x13')]);return _0x45a9e0(_0xeb58b6['error']['message']);}else{logger[_0x820c('0xb')](_0x820c('0xc'),_0x3148d8,_0x820c('0xd'));_0x45a9e0(_0xeb58b6['result'][_0x820c('0x13')]);}})[_0x820c('0x14')](function(_0x3116cb){logger[_0x820c('0x11')](_0x820c('0xc'),_0x3148d8,_0x3116cb);_0x4a602a(_0x3116cb);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index ba11e3b..3c1922f 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x397b40,_0x56e7fc){var _0x258261=function(_0x4d249e){while(--_0x4d249e){_0x397b40['push'](_0x397b40['shift']());}};_0x258261(++_0x56e7fc);}(_0x70e0,0x17b));var _0x070e=function(_0x4ffdcc,_0x4e7fec){_0x4ffdcc=_0x4ffdcc-0x0;var _0x4e66c8=_0x70e0[_0x4ffdcc];return _0x4e66c8;};'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(_0x1025f6,_0x57597c){var _0x1b163a=function(_0x285eb0){while(--_0x285eb0){_0x1025f6['push'](_0x1025f6['shift']());}};_0x1b163a(++_0x57597c);}(_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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index ec7b6e7..fcf56df 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 _0xde44=['STRING','unique_name_and_version','app.js','INTEGER','sequelize','exports'];(function(_0x5cf4ef,_0x2d360f){var _0x4a8082=function(_0x4c6a9e){while(--_0x4c6a9e){_0x5cf4ef['push'](_0x5cf4ef['shift']());}};_0x4a8082(++_0x2d360f);}(_0xde44,0x160));var _0x4de4=function(_0x37f7a9,_0x41bf4c){_0x37f7a9=_0x37f7a9-0x0;var _0x2824b5=_0xde44[_0x37f7a9];return _0x2824b5;};'use strict';var Sequelize=require(_0x4de4('0x0'));module[_0x4de4('0x1')]={'name':{'type':Sequelize[_0x4de4('0x2')],'allowNull':![],'unique':_0x4de4('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4de4('0x3')},'main':{'type':Sequelize[_0x4de4('0x2')],'defaultValue':_0x4de4('0x4')},'filename':{'type':Sequelize[_0x4de4('0x2')]},'path':{'type':Sequelize[_0x4de4('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x4de4('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x4de4('0x2')]},'logo':{'type':Sequelize[_0x4de4('0x2')]},'state':{'type':Sequelize['STRING'],'unique':'state'},'description':{'type':Sequelize[_0x4de4('0x2')]},'title':{'type':Sequelize[_0x4de4('0x2')]},'remoteUri':{'type':Sequelize[_0x4de4('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x2ed3=['INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x2cc3cf,_0x194624){var _0x199423=function(_0x220035){while(--_0x220035){_0x2cc3cf['push'](_0x2cc3cf['shift']());}};_0x199423(++_0x194624);}(_0x2ed3,0x96));var _0x32ed=function(_0x591e16,_0x5aefc1){_0x591e16=_0x591e16-0x0;var _0x543b35=_0x2ed3[_0x591e16];return _0x543b35;};'use strict';var Sequelize=require(_0x32ed('0x0'));module[_0x32ed('0x1')]={'name':{'type':Sequelize[_0x32ed('0x2')],'allowNull':![],'unique':_0x32ed('0x3')},'version':{'type':Sequelize[_0x32ed('0x2')],'allowNull':![],'unique':_0x32ed('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x32ed('0x2')]},'size':{'type':Sequelize[_0x32ed('0x4')]},'active':{'type':Sequelize[_0x32ed('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x32ed('0x2')]},'state':{'type':Sequelize[_0x32ed('0x2')],'unique':_0x32ed('0x6')},'description':{'type':Sequelize[_0x32ed('0x2')]},'title':{'type':Sequelize[_0x32ed('0x2')]},'remoteUri':{'type':Sequelize[_0x32ed('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index d2734ab..0a43ed4 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 _0xfcf0=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','includeAll','include','catch','params','merge','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','key','model','map','keys','query','filters'];(function(_0x291618,_0x204fc6){var _0x1f7a49=function(_0x45128b){while(--_0x45128b){_0x291618['push'](_0x291618['shift']());}};_0x1f7a49(++_0x204fc6);}(_0xfcf0,0x138));var _0x0fcf=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0xfcf0[_0x284bc3];return _0x41ac81;};'use strict';var emlformat=require(_0x0fcf('0x0'));var rimraf=require(_0x0fcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fcf('0x2'));var rp=require(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require(_0x0fcf('0x5'));var Mustache=require('mustache');var util=require(_0x0fcf('0x6'));var path=require(_0x0fcf('0x7'));var sox=require(_0x0fcf('0x8'));var csv=require(_0x0fcf('0x9'));var ejs=require(_0x0fcf('0xa'));var fs=require('fs');var fs_extra=require(_0x0fcf('0xb'));var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0x9'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fcf('0x17'))['db'];function respondWithStatusCode(_0x3c999e,_0x4b4904){_0x4b4904=_0x4b4904||0xcc;return function(_0x20153d){if(_0x20153d){return _0x3c999e[_0x0fcf('0x18')](_0x4b4904);}return _0x3c999e[_0x0fcf('0x19')](_0x4b4904)[_0x0fcf('0x1a')]();};}function respondWithResult(_0x25fadc,_0x48bba6){_0x48bba6=_0x48bba6||0xc8;return function(_0xa32692){if(_0xa32692){return _0x25fadc[_0x0fcf('0x19')](_0x48bba6)[_0x0fcf('0x1b')](_0xa32692);}};}function respondWithFilteredResult(_0x5e867f,_0x3c09c4){return function(_0x610106){if(_0x610106){var _0x445207=typeof _0x3c09c4[_0x0fcf('0x1c')]==='undefined'&&typeof _0x3c09c4[_0x0fcf('0x1d')]===_0x0fcf('0x1e');var _0x1a8477=_0x610106[_0x0fcf('0x1f')];var _0x19cfbd=_0x445207?0x0:_0x3c09c4['offset'];var _0x18ea32=_0x445207?_0x610106[_0x0fcf('0x1f')]:_0x3c09c4['offset']+_0x3c09c4[_0x0fcf('0x1d')];var _0x1b9a90;if(_0x18ea32>=_0x1a8477){_0x18ea32=_0x1a8477;_0x1b9a90=0xc8;}else{_0x1b9a90=0xce;}_0x5e867f['status'](_0x1b9a90);return _0x5e867f[_0x0fcf('0x20')]('Content-Range',_0x19cfbd+'-'+_0x18ea32+'/'+_0x1a8477)[_0x0fcf('0x1b')](_0x610106);}return null;};}function patchUpdates(_0x13454e){return function(_0x5c8279){try{jsonpatch[_0x0fcf('0x21')](_0x5c8279,_0x13454e,!![]);}catch(_0x3f28d0){return BPromise[_0x0fcf('0x22')](_0x3f28d0);}return _0x5c8279['save']();};}function saveUpdates(_0x2f03ce,_0x1dafc8){return function(_0x196d30){if(_0x196d30){return _0x196d30[_0x0fcf('0x23')](_0x2f03ce)[_0x0fcf('0x24')](function(_0x30e1b0){return _0x30e1b0;});}return null;};}function removeEntity(_0x5841a9,_0x2eef74){return function(_0x253641){if(_0x253641){return _0x253641[_0x0fcf('0x25')]()[_0x0fcf('0x24')](function(){_0x5841a9[_0x0fcf('0x19')](0xcc)[_0x0fcf('0x1a')]();});}};}function handleEntityNotFound(_0x2ce990,_0x18f269){return function(_0x117510){if(!_0x117510){_0x2ce990['sendStatus'](0x194);}return _0x117510;};}function handleError(_0x18965e,_0xc107a){_0xc107a=_0xc107a||0x1f4;return function(_0x41b7a2){logger[_0x0fcf('0x26')](_0x41b7a2[_0x0fcf('0x27')]);if(_0x41b7a2[_0x0fcf('0x28')]){delete _0x41b7a2[_0x0fcf('0x28')];}_0x18965e['status'](_0xc107a)[_0x0fcf('0x29')](_0x41b7a2);};}exports[_0x0fcf('0x2a')]=function(_0x200517,_0x35180d){var _0x49fd0e={},_0x5d9bcd={},_0x4af80d={'count':0x0,'rows':[]};var _0x428194=_['map'](db[_0x0fcf('0x2b')][_0x0fcf('0x2c')],function(_0x56a416){return{'name':_0x56a416[_0x0fcf('0x2d')],'type':_0x56a416[_0x0fcf('0x2e')][_0x0fcf('0x2f')]};});_0x5d9bcd[_0x0fcf('0x30')]=_[_0x0fcf('0x31')](_0x428194,_0x0fcf('0x28'));_0x5d9bcd['query']=_[_0x0fcf('0x32')](_0x200517[_0x0fcf('0x33')]);_0x5d9bcd[_0x0fcf('0x34')]=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],_0x5d9bcd[_0x0fcf('0x33')]);_0x49fd0e['attributes']=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x49fd0e[_0x0fcf('0x37')]=_0x49fd0e[_0x0fcf('0x37')][_0x0fcf('0x38')]?_0x49fd0e[_0x0fcf('0x37')]:_0x5d9bcd[_0x0fcf('0x30')];if(!_0x200517[_0x0fcf('0x33')][_0x0fcf('0x39')](_0x0fcf('0x3a'))){_0x49fd0e[_0x0fcf('0x1d')]=qs['limit'](_0x200517['query'][_0x0fcf('0x1d')]);_0x49fd0e['offset']=qs['offset'](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x1c')]);}_0x49fd0e[_0x0fcf('0x3b')]=qs['sort'](_0x200517['query'][_0x0fcf('0x3c')]);_0x49fd0e[_0x0fcf('0x3d')]=qs[_0x0fcf('0x34')](_['pick'](_0x200517[_0x0fcf('0x33')],_0x5d9bcd[_0x0fcf('0x34')]),_0x428194);if(_0x200517[_0x0fcf('0x33')]['filter']){_0x49fd0e['where']=_['merge'](_0x49fd0e[_0x0fcf('0x3d')],{'$or':_[_0x0fcf('0x31')](_0x428194,function(_0xdfdd1){if(_0xdfdd1[_0x0fcf('0x2e')]!==_0x0fcf('0x3e')){var _0x4be8eb={};_0x4be8eb[_0xdfdd1[_0x0fcf('0x28')]]={'$like':'%'+_0x200517[_0x0fcf('0x33')][_0x0fcf('0x3f')]+'%'};return _0x4be8eb;}})});}_0x49fd0e=_['merge']({},_0x49fd0e,_0x200517['options']);var _0x13e4b2={'where':_0x49fd0e[_0x0fcf('0x3d')]};return db[_0x0fcf('0x2b')][_0x0fcf('0x1f')](_0x13e4b2)[_0x0fcf('0x24')](function(_0x4c6669){_0x4af80d[_0x0fcf('0x1f')]=_0x4c6669;if(_0x200517[_0x0fcf('0x33')][_0x0fcf('0x40')]){_0x49fd0e[_0x0fcf('0x41')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x49fd0e);})[_0x0fcf('0x24')](function(_0x2444a6){_0x4af80d['rows']=_0x2444a6;return _0x4af80d;})[_0x0fcf('0x24')](respondWithFilteredResult(_0x35180d,_0x49fd0e))[_0x0fcf('0x42')](handleError(_0x35180d,null));};exports['show']=function(_0x237fa6,_0xfc2f2b){var _0x44eb03={'raw':![],'where':{'id':_0x237fa6[_0x0fcf('0x43')]['id']}},_0x1f322b={};_0x1f322b['model']=_[_0x0fcf('0x32')](db[_0x0fcf('0x2b')]['rawAttributes']);_0x1f322b['query']=_[_0x0fcf('0x32')](_0x237fa6['query']);_0x1f322b['filters']=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],_0x1f322b[_0x0fcf('0x33')]);_0x44eb03[_0x0fcf('0x37')]=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x237fa6[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x44eb03[_0x0fcf('0x37')]=_0x44eb03['attributes'][_0x0fcf('0x38')]?_0x44eb03[_0x0fcf('0x37')]:_0x1f322b[_0x0fcf('0x30')];if(_0x237fa6['query']['includeAll']){_0x44eb03[_0x0fcf('0x41')]=[{'all':!![]}];}_0x44eb03=_[_0x0fcf('0x44')]({},_0x44eb03,_0x237fa6[_0x0fcf('0x45')]);return db[_0x0fcf('0x2b')]['find'](_0x44eb03)['then'](handleEntityNotFound(_0xfc2f2b,null))[_0x0fcf('0x24')](respondWithResult(_0xfc2f2b,null))[_0x0fcf('0x42')](handleError(_0xfc2f2b,null));};exports[_0x0fcf('0x46')]=function(_0x1fb83d,_0x345188){return db[_0x0fcf('0x2b')][_0x0fcf('0x46')](_0x1fb83d[_0x0fcf('0x47')],{})['then'](respondWithResult(_0x345188,0xc9))['catch'](handleError(_0x345188,null));};exports[_0x0fcf('0x23')]=function(_0x243699,_0x28d2f4){if(_0x243699[_0x0fcf('0x47')]['id']){delete _0x243699[_0x0fcf('0x47')]['id'];}return db[_0x0fcf('0x2b')]['find']({'where':{'id':_0x243699[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0x28d2f4,null))['then'](saveUpdates(_0x243699[_0x0fcf('0x47')],null))[_0x0fcf('0x24')](respondWithResult(_0x28d2f4,null))[_0x0fcf('0x42')](handleError(_0x28d2f4,null));};exports[_0x0fcf('0x25')]=function(_0x5435c0,_0xc514bf){return db[_0x0fcf('0x2b')][_0x0fcf('0x48')]({'where':{'id':_0x5435c0[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0xc514bf,null))[_0x0fcf('0x24')](removeEntity(_0xc514bf,null))[_0x0fcf('0x42')](handleError(_0xc514bf,null));}; \ No newline at end of file +var _0x5496=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','Integration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x5496,0x175));var _0x6549=function(_0x1ae06b,_0x300657){_0x1ae06b=_0x1ae06b-0x0;var _0x31eda9=_0x5496[_0x1ae06b];return _0x31eda9;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['create'](_0x41d675[_0x6549('0x4c')],{})[_0x6549('0x26')](respondWithResult(_0x1712f3,0xc9))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0xa4c650,_0x25a6ee){if(_0xa4c650[_0x6549('0x4c')]['id']){delete _0xa4c650[_0x6549('0x4c')]['id'];}return db['Integration'][_0x6549('0x4a')]({'where':{'id':_0xa4c650['params']['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x25a6ee,null))[_0x6549('0x26')](saveUpdates(_0xa4c650[_0x6549('0x4c')],null))['then'](respondWithResult(_0x25a6ee,null))[_0x6549('0x43')](handleError(_0x25a6ee,null));};exports[_0x6549('0x4d')]=function(_0x2ef4d2,_0x5300c8){return db[_0x6549('0x2b')][_0x6549('0x4a')]({'where':{'id':_0x2ef4d2[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x5300c8,null))[_0x6549('0x26')](removeEntity(_0x5300c8,null))[_0x6549('0x43')](handleError(_0x5300c8,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 0eb23f8..bf92b26 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 _0xb755=['request-promise','rimraf','./integration.attributes','exports','Integration','integrations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x22a6f6,_0x5d6ea9){var _0x464440=function(_0x147c88){while(--_0x147c88){_0x22a6f6['push'](_0x22a6f6['shift']());}};_0x464440(++_0x5d6ea9);}(_0xb755,0x1be));var _0x5b75=function(_0x4bb45,_0x987859){_0x4bb45=_0x4bb45-0x0;var _0x4c5fc0=_0xb755[_0x4bb45];return _0x4c5fc0;};'use strict';var _=require(_0x5b75('0x0'));var util=require('util');var logger=require(_0x5b75('0x1'))(_0x5b75('0x2'));var moment=require(_0x5b75('0x3'));var BPromise=require(_0x5b75('0x4'));var rp=require(_0x5b75('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5b75('0x6'));var config=require('../../config/environment');var attributes=require(_0x5b75('0x7'));module[_0x5b75('0x8')]=function(_0x19db77,_0x2f9bba){return _0x19db77['define'](_0x5b75('0x9'),attributes,{'tableName':_0x5b75('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2279=['path','rimraf','./integration.attributes','exports','define','Integration','integrations','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5cf4d2,_0x267394){var _0x4ea646=function(_0x3a48be){while(--_0x3a48be){_0x5cf4d2['push'](_0x5cf4d2['shift']());}};_0x4ea646(++_0x267394);}(_0x2279,0xca));var _0x9227=function(_0x131edb,_0x49b67a){_0x131edb=_0x131edb-0x0;var _0xe0d36e=_0x2279[_0x131edb];return _0xe0d36e;};'use strict';var _=require(_0x9227('0x0'));var util=require(_0x9227('0x1'));var logger=require('../../config/logger')(_0x9227('0x2'));var moment=require(_0x9227('0x3'));var BPromise=require(_0x9227('0x4'));var rp=require(_0x9227('0x5'));var fs=require('fs');var path=require(_0x9227('0x6'));var rimraf=require(_0x9227('0x7'));var config=require('../../config/environment');var attributes=require(_0x9227('0x8'));module[_0x9227('0x9')]=function(_0x4243e4,_0xf279a1){return _0x4243e4[_0x9227('0xa')](_0x9227('0xb'),attributes,{'tableName':_0x9227('0xc'),'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 9bcac63..546f2fb 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 _0x6d38=['request','then','Integration,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x156ecd,_0x583c64){var _0x26e833=function(_0xe43a4){while(--_0xe43a4){_0x156ecd['push'](_0x156ecd['shift']());}};_0x26e833(++_0x583c64);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6d38[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file +var _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(_0x81be38,_0x54ab1a){var _0xf503d8=function(_0x52728e){while(--_0x52728e){_0x81be38['push'](_0x81be38['shift']());}};_0xf503d8(++_0x54ab1a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4401b7,_0x9c1017){_0x4401b7=_0x4401b7-0x0;var _0x50e69e=_0x5f2f[_0x4401b7];return _0x50e69e;};'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 9968632..b1018af 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 _0xef0f=['update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x548e8d,_0x2345b6){var _0x38c2de=function(_0x58fde9){while(--_0x58fde9){_0x548e8d['push'](_0x548e8d['shift']());}};_0x38c2de(++_0x2345b6);}(_0xef0f,0x168));var _0xfef0=function(_0x2684a8,_0x49f0d9){_0x2684a8=_0x2684a8-0x0;var _0x33c0c4=_0xef0f[_0x2684a8];return _0x33c0c4;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var fs_extra=require(_0xfef0('0x4'));var auth=require(_0xfef0('0x5'));var interaction=require(_0xfef0('0x6'));var config=require('../../config/environment');var controller=require(_0xfef0('0x7'));router[_0xfef0('0x8')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0xa')]);router[_0xfef0('0x8')](_0xfef0('0xb'),auth['isAuthenticated'](),controller[_0xfef0('0xc')]);router['get'](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0xe')]);router[_0xfef0('0xf')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0x10')]);router[_0xfef0('0x11')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x12')]);router[_0xfef0('0x13')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x14')]);module['exports']=router; \ No newline at end of file +var _0x4137=['show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x4137,0xf8));var _0x7413=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4137[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['describe']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/',auth['isAuthenticated'](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x14')]);router['delete'](_0x7413('0xf'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 2ba9910..ca151f3 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 _0x292d=['ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0xdf757d,_0x7f7088){var _0x24f61b=function(_0x14ce54){while(--_0x14ce54){_0xdf757d['push'](_0xdf757d['shift']());}};_0x24f61b(++_0x7f7088);}(_0x292d,0x191));var _0xd292=function(_0x562faa,_0x23adc7){_0x562faa=_0x562faa-0x0;var _0xc70f59=_0x292d[_0x562faa];return _0xc70f59;};'use strict';var Sequelize=require(_0xd292('0x0'));module[_0xd292('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xd292('0x2')]},'ticketId':{'type':Sequelize[_0xd292('0x2')]},'integrationId':{'type':Sequelize[_0xd292('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd292('0x2')]},'calleridnum':{'type':Sequelize[_0xd292('0x2')]},'calleridname':{'type':Sequelize[_0xd292('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xd292('0x2')]},'membername':{'type':Sequelize[_0xd292('0x2')]},'agentcalledAt':{'type':Sequelize[_0xd292('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xd292('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xd292('0x4')]},'talktime':{'type':Sequelize[_0xd292('0x3')]},'agentacw':{'type':Sequelize[_0xd292('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd292('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xd292('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xd292('0x4')]},'agentdump':{'type':Sequelize[_0xd292('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xd292('0x4')]},'lastevent':{'type':Sequelize[_0xd292('0x2')]},'channel':{'type':Sequelize[_0xd292('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xd292('0x2')]},'language':{'type':Sequelize[_0xd292('0x2')]},'accountcode':{'type':Sequelize[_0xd292('0x2')]},'context':{'type':Sequelize[_0xd292('0x2')]},'exten':{'type':Sequelize[_0xd292('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd292('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd292('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd292('0x2')]},'destcalleridname':{'type':Sequelize[_0xd292('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd292('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd292('0x2')]},'destlanguage':{'type':Sequelize[_0xd292('0x2')]},'destaccountcode':{'type':Sequelize[_0xd292('0x2')]},'destcontext':{'type':Sequelize[_0xd292('0x2')]},'destexten':{'type':Sequelize[_0xd292('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xd292('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xd292('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xd292('0x2')]},'attachment':{'type':Sequelize[_0xd292('0x6')]},'html':{'type':Sequelize[_0xd292('0x6')]},'text':{'type':Sequelize[_0xd292('0x6')]},'status':{'type':Sequelize[_0xd292('0x7')](_0xd292('0x8'),_0xd292('0x9'),_0xd292('0xa'),_0xd292('0xb'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xd292('0x2')]},'appdata':{'type':Sequelize[_0xd292('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd315=['exports','STRING','DATE','INTEGER','TEXT','SENT','SENDING','FAILED','sequelize'];(function(_0x30e194,_0x175527){var _0x5db9d6=function(_0x5c159e){while(--_0x5c159e){_0x30e194['push'](_0x30e194['shift']());}};_0x5db9d6(++_0x175527);}(_0xd315,0x179));var _0x5d31=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd315[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5d31('0x0'));module[_0x5d31('0x1')]={'integration':{'type':Sequelize[_0x5d31('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x5d31('0x2')]},'ticketId':{'type':Sequelize[_0x5d31('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5d31('0x2')]},'calleridnum':{'type':Sequelize[_0x5d31('0x2')]},'calleridname':{'type':Sequelize[_0x5d31('0x2')]},'queue':{'type':Sequelize[_0x5d31('0x2')]},'interface':{'type':Sequelize[_0x5d31('0x2')]},'membername':{'type':Sequelize[_0x5d31('0x2')]},'agentcalledAt':{'type':Sequelize[_0x5d31('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x5d31('0x3')]},'talktime':{'type':Sequelize[_0x5d31('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5d31('0x4')]},'reason':{'type':Sequelize[_0x5d31('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x5d31('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x5d31('0x4')]},'channelstatedesc':{'type':Sequelize[_0x5d31('0x2')]},'connectedlinenum':{'type':Sequelize[_0x5d31('0x2')]},'connectedlinename':{'type':Sequelize[_0x5d31('0x2')]},'language':{'type':Sequelize[_0x5d31('0x2')]},'accountcode':{'type':Sequelize[_0x5d31('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5d31('0x2')]},'destchannel':{'type':Sequelize[_0x5d31('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x5d31('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5d31('0x2')]},'destcalleridname':{'type':Sequelize[_0x5d31('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x5d31('0x2')]},'destlanguage':{'type':Sequelize[_0x5d31('0x2')]},'destaccountcode':{'type':Sequelize[_0x5d31('0x2')]},'destcontext':{'type':Sequelize[_0x5d31('0x2')]},'destexten':{'type':Sequelize[_0x5d31('0x2')]},'destpriority':{'type':Sequelize[_0x5d31('0x2')]},'destuniqueid':{'type':Sequelize[_0x5d31('0x2')]},'messageId':{'type':Sequelize[_0x5d31('0x2')]},'inReplyTo':{'type':Sequelize[_0x5d31('0x2')]},'subject':{'type':Sequelize[_0x5d31('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x5d31('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x5d31('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0x5d31('0x6'),_0x5d31('0x7'),'RECEIVED',_0x5d31('0x8'))},'url':{'type':Sequelize[_0x5d31('0x2')]},'app':{'type':Sequelize[_0x5d31('0x2')]},'appdata':{'type':Sequelize[_0x5d31('0x2')]},'projectId':{'type':Sequelize[_0x5d31('0x4')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index a1eb58b..1905af8 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 _0xfd7d=['json','offset','limit','undefined','count','set','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','IntegrationReport','findAll','rows','catch','length','include','options','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xfd7d,0x19a));var _0xdfd7=function(_0x401f2e,_0x119d0d){_0x401f2e=_0x401f2e-0x0;var _0x4ef876=_0xfd7d[_0x401f2e];return _0x4ef876;};'use strict';var emlformat=require(_0xdfd7('0x0'));var rimraf=require(_0xdfd7('0x1'));var zipdir=require(_0xdfd7('0x2'));var jsonpatch=require(_0xdfd7('0x3'));var rp=require('request-promise');var moment=require(_0xdfd7('0x4'));var BPromise=require(_0xdfd7('0x5'));var Mustache=require('mustache');var util=require(_0xdfd7('0x6'));var path=require(_0xdfd7('0x7'));var sox=require(_0xdfd7('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdfd7('0x9'));var _=require(_0xdfd7('0xa'));var squel=require(_0xdfd7('0xb'));var crypto=require(_0xdfd7('0xc'));var jsforce=require(_0xdfd7('0xd'));var deskjs=require(_0xdfd7('0xe'));var toCsv=require(_0xdfd7('0xf'));var querystring=require(_0xdfd7('0x10'));var Papa=require(_0xdfd7('0x11'));var Redis=require('ioredis');var authService=require(_0xdfd7('0x12'));var qs=require(_0xdfd7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdfd7('0x14'));var logger=require(_0xdfd7('0x15'))(_0xdfd7('0x16'));var utils=require(_0xdfd7('0x17'));var config=require(_0xdfd7('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xdfd7('0x19'))['db'];function respondWithStatusCode(_0x380c44,_0x3c982f){_0x3c982f=_0x3c982f||0xcc;return function(_0x3d64f6){if(_0x3d64f6){return _0x380c44[_0xdfd7('0x1a')](_0x3c982f);}return _0x380c44[_0xdfd7('0x1b')](_0x3c982f)['end']();};}function respondWithResult(_0x1d4b20,_0x169b1f){_0x169b1f=_0x169b1f||0xc8;return function(_0x43cfa1){if(_0x43cfa1){return _0x1d4b20['status'](_0x169b1f)[_0xdfd7('0x1c')](_0x43cfa1);}};}function respondWithFilteredResult(_0x331d71,_0x1a0511){return function(_0x49599a){if(_0x49599a){var _0x54c8d7=typeof _0x1a0511[_0xdfd7('0x1d')]==='undefined'&&typeof _0x1a0511[_0xdfd7('0x1e')]===_0xdfd7('0x1f');var _0x1ee4f4=_0x49599a[_0xdfd7('0x20')];var _0x15b176=_0x54c8d7?0x0:_0x1a0511[_0xdfd7('0x1d')];var _0x3af519=_0x54c8d7?_0x49599a[_0xdfd7('0x20')]:_0x1a0511['offset']+_0x1a0511[_0xdfd7('0x1e')];var _0x53598f;if(_0x3af519>=_0x1ee4f4){_0x3af519=_0x1ee4f4;_0x53598f=0xc8;}else{_0x53598f=0xce;}_0x331d71[_0xdfd7('0x1b')](_0x53598f);return _0x331d71[_0xdfd7('0x21')]('Content-Range',_0x15b176+'-'+_0x3af519+'/'+_0x1ee4f4)[_0xdfd7('0x1c')](_0x49599a);}return null;};}function patchUpdates(_0x533e38){return function(_0x520367){try{jsonpatch['apply'](_0x520367,_0x533e38,!![]);}catch(_0x4cbad6){return BPromise[_0xdfd7('0x22')](_0x4cbad6);}return _0x520367[_0xdfd7('0x23')]();};}function saveUpdates(_0x11a306,_0x38f1ca){return function(_0x415282){if(_0x415282){return _0x415282['update'](_0x11a306)[_0xdfd7('0x24')](function(_0xb49e15){return _0xb49e15;});}return null;};}function removeEntity(_0x16398f,_0x3a870b){return function(_0x2cade5){if(_0x2cade5){return _0x2cade5[_0xdfd7('0x25')]()[_0xdfd7('0x24')](function(){_0x16398f[_0xdfd7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2708a2,_0xeb9903){return function(_0x39ae7d){if(!_0x39ae7d){_0x2708a2[_0xdfd7('0x1a')](0x194);}return _0x39ae7d;};}function handleError(_0x1ecd8c,_0x3dad58){_0x3dad58=_0x3dad58||0x1f4;return function(_0x17db2d){logger[_0xdfd7('0x26')](_0x17db2d[_0xdfd7('0x27')]);if(_0x17db2d[_0xdfd7('0x28')]){delete _0x17db2d[_0xdfd7('0x28')];}_0x1ecd8c['status'](_0x3dad58)['send'](_0x17db2d);};}exports[_0xdfd7('0x29')]=function(_0x42062c,_0x4e8001){var _0x15fa62={},_0x2c1a72={},_0x3fa105={'count':0x0,'rows':[]};var _0x5af324=_[_0xdfd7('0x2a')](db['IntegrationReport'][_0xdfd7('0x2b')],function(_0x1bdc93){return{'name':_0x1bdc93[_0xdfd7('0x2c')],'type':_0x1bdc93['type']['key']};});_0x2c1a72[_0xdfd7('0x2d')]=_['map'](_0x5af324,_0xdfd7('0x28'));_0x2c1a72[_0xdfd7('0x2e')]=_[_0xdfd7('0x2f')](_0x42062c[_0xdfd7('0x2e')]);_0x2c1a72[_0xdfd7('0x30')]=_['intersection'](_0x2c1a72[_0xdfd7('0x2d')],_0x2c1a72[_0xdfd7('0x2e')]);_0x15fa62[_0xdfd7('0x31')]=_[_0xdfd7('0x32')](_0x2c1a72[_0xdfd7('0x2d')],qs[_0xdfd7('0x33')](_0x42062c[_0xdfd7('0x2e')][_0xdfd7('0x33')]));_0x15fa62[_0xdfd7('0x31')]=_0x15fa62[_0xdfd7('0x31')]['length']?_0x15fa62[_0xdfd7('0x31')]:_0x2c1a72[_0xdfd7('0x2d')];if(!_0x42062c[_0xdfd7('0x2e')][_0xdfd7('0x34')](_0xdfd7('0x35'))){_0x15fa62[_0xdfd7('0x1e')]=qs[_0xdfd7('0x1e')](_0x42062c[_0xdfd7('0x2e')][_0xdfd7('0x1e')]);_0x15fa62[_0xdfd7('0x1d')]=qs['offset'](_0x42062c[_0xdfd7('0x2e')][_0xdfd7('0x1d')]);}_0x15fa62[_0xdfd7('0x36')]=qs[_0xdfd7('0x37')](_0x42062c[_0xdfd7('0x2e')][_0xdfd7('0x37')]);_0x15fa62[_0xdfd7('0x38')]=qs[_0xdfd7('0x30')](_['pick'](_0x42062c[_0xdfd7('0x2e')],_0x2c1a72['filters']),_0x5af324);if(_0x42062c['query'][_0xdfd7('0x39')]){_0x15fa62['where']=_[_0xdfd7('0x3a')](_0x15fa62[_0xdfd7('0x38')],{'$or':_[_0xdfd7('0x2a')](_0x5af324,function(_0x4ccb9b){if(_0x4ccb9b['type']!=='VIRTUAL'){var _0x2968e0={};_0x2968e0[_0x4ccb9b[_0xdfd7('0x28')]]={'$like':'%'+_0x42062c[_0xdfd7('0x2e')][_0xdfd7('0x39')]+'%'};return _0x2968e0;}})});}_0x15fa62=_['merge']({},_0x15fa62,_0x42062c['options']);var _0x80991c={'where':_0x15fa62[_0xdfd7('0x38')]};return db['IntegrationReport'][_0xdfd7('0x20')](_0x80991c)[_0xdfd7('0x24')](function(_0x3ad2a8){_0x3fa105['count']=_0x3ad2a8;if(_0x42062c['query'][_0xdfd7('0x3b')]){_0x15fa62['include']=[{'all':!![]}];}return db[_0xdfd7('0x3c')][_0xdfd7('0x3d')](_0x15fa62);})['then'](function(_0x42c1b1){_0x3fa105[_0xdfd7('0x3e')]=_0x42c1b1;return _0x3fa105;})[_0xdfd7('0x24')](respondWithFilteredResult(_0x4e8001,_0x15fa62))[_0xdfd7('0x3f')](handleError(_0x4e8001,null));};exports['show']=function(_0x121abb,_0xfd5099){var _0x555ac0={'raw':![],'where':{'id':_0x121abb['params']['id']}},_0x50ad96={};_0x50ad96['model']=_[_0xdfd7('0x2f')](db['IntegrationReport'][_0xdfd7('0x2b')]);_0x50ad96['query']=_[_0xdfd7('0x2f')](_0x121abb[_0xdfd7('0x2e')]);_0x50ad96[_0xdfd7('0x30')]=_[_0xdfd7('0x32')](_0x50ad96[_0xdfd7('0x2d')],_0x50ad96[_0xdfd7('0x2e')]);_0x555ac0['attributes']=_[_0xdfd7('0x32')](_0x50ad96[_0xdfd7('0x2d')],qs[_0xdfd7('0x33')](_0x121abb['query'][_0xdfd7('0x33')]));_0x555ac0[_0xdfd7('0x31')]=_0x555ac0[_0xdfd7('0x31')][_0xdfd7('0x40')]?_0x555ac0[_0xdfd7('0x31')]:_0x50ad96[_0xdfd7('0x2d')];if(_0x121abb['query']['includeAll']){_0x555ac0[_0xdfd7('0x41')]=[{'all':!![]}];}_0x555ac0=_['merge']({},_0x555ac0,_0x121abb[_0xdfd7('0x42')]);return db[_0xdfd7('0x3c')][_0xdfd7('0x43')](_0x555ac0)[_0xdfd7('0x24')](handleEntityNotFound(_0xfd5099,null))['then'](respondWithResult(_0xfd5099,null))[_0xdfd7('0x3f')](handleError(_0xfd5099,null));};exports[_0xdfd7('0x44')]=function(_0x3d37d8,_0x376679){return db[_0xdfd7('0x3c')][_0xdfd7('0x44')](_0x3d37d8[_0xdfd7('0x45')],{})['then'](respondWithResult(_0x376679,0xc9))[_0xdfd7('0x3f')](handleError(_0x376679,null));};exports[_0xdfd7('0x46')]=function(_0x3525d6,_0x410634){if(_0x3525d6['body']['id']){delete _0x3525d6['body']['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x3525d6['params']['id']}})[_0xdfd7('0x24')](handleEntityNotFound(_0x410634,null))[_0xdfd7('0x24')](saveUpdates(_0x3525d6['body'],null))['then'](respondWithResult(_0x410634,null))[_0xdfd7('0x3f')](handleError(_0x410634,null));};exports[_0xdfd7('0x25')]=function(_0x46e290,_0x250304){return db[_0xdfd7('0x3c')][_0xdfd7('0x43')]({'where':{'id':_0x46e290[_0xdfd7('0x47')]['id']}})[_0xdfd7('0x24')](handleEntityNotFound(_0x250304,null))[_0xdfd7('0x24')](removeEntity(_0x250304,null))[_0xdfd7('0x3f')](handleError(_0x250304,null));};exports[_0xdfd7('0x48')]=function(_0x35548f,_0xa7de25){return db['IntegrationReport'][_0xdfd7('0x48')]()['then'](respondWithResult(_0xa7de25,null))[_0xdfd7('0x3f')](handleError(_0xa7de25,null));}; \ No newline at end of file +var _0xacad=['rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','IntegrationReport'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xacad,0x14b));var _0xdaca=function(_0x293eba,_0x184088){_0x293eba=_0x293eba-0x0;var _0x7c7e54=_0xacad[_0x293eba];return _0x7c7e54;};'use strict';var emlformat=require(_0xdaca('0x0'));var rimraf=require(_0xdaca('0x1'));var zipdir=require(_0xdaca('0x2'));var jsonpatch=require(_0xdaca('0x3'));var rp=require(_0xdaca('0x4'));var moment=require(_0xdaca('0x5'));var BPromise=require(_0xdaca('0x6'));var Mustache=require(_0xdaca('0x7'));var util=require(_0xdaca('0x8'));var path=require('path');var sox=require(_0xdaca('0x9'));var csv=require(_0xdaca('0xa'));var ejs=require(_0xdaca('0xb'));var fs=require('fs');var fs_extra=require(_0xdaca('0xc'));var _=require('lodash');var squel=require(_0xdaca('0xd'));var crypto=require(_0xdaca('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdaca('0xf'));var toCsv=require(_0xdaca('0xa'));var querystring=require(_0xdaca('0x10'));var Papa=require('papaparse');var Redis=require(_0xdaca('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdaca('0x12'));var as=require(_0xdaca('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdaca('0x14'))('api');var utils=require(_0xdaca('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdaca('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x281e1f,_0x4ea61e){_0x4ea61e=_0x4ea61e||0xcc;return function(_0x5b7d08){if(_0x5b7d08){return _0x281e1f[_0xdaca('0x17')](_0x4ea61e);}return _0x281e1f[_0xdaca('0x18')](_0x4ea61e)[_0xdaca('0x19')]();};}function respondWithResult(_0x16b28c,_0x216e7c){_0x216e7c=_0x216e7c||0xc8;return function(_0xf80524){if(_0xf80524){return _0x16b28c[_0xdaca('0x18')](_0x216e7c)[_0xdaca('0x1a')](_0xf80524);}};}function respondWithFilteredResult(_0xd09ca7,_0x165636){return function(_0xb66695){if(_0xb66695){var _0x136b5d=typeof _0x165636['offset']===_0xdaca('0x1b')&&typeof _0x165636[_0xdaca('0x1c')]===_0xdaca('0x1b');var _0x5f57ea=_0xb66695[_0xdaca('0x1d')];var _0x2191fe=_0x136b5d?0x0:_0x165636[_0xdaca('0x1e')];var _0x558564=_0x136b5d?_0xb66695[_0xdaca('0x1d')]:_0x165636['offset']+_0x165636[_0xdaca('0x1c')];var _0x294fd8;if(_0x558564>=_0x5f57ea){_0x558564=_0x5f57ea;_0x294fd8=0xc8;}else{_0x294fd8=0xce;}_0xd09ca7['status'](_0x294fd8);return _0xd09ca7[_0xdaca('0x1f')](_0xdaca('0x20'),_0x2191fe+'-'+_0x558564+'/'+_0x5f57ea)[_0xdaca('0x1a')](_0xb66695);}return null;};}function patchUpdates(_0x4101f2){return function(_0x5bf638){try{jsonpatch['apply'](_0x5bf638,_0x4101f2,!![]);}catch(_0x4ee52f){return BPromise[_0xdaca('0x21')](_0x4ee52f);}return _0x5bf638[_0xdaca('0x22')]();};}function saveUpdates(_0x4f43ba,_0x55ddde){return function(_0x11a460){if(_0x11a460){return _0x11a460[_0xdaca('0x23')](_0x4f43ba)[_0xdaca('0x24')](function(_0x1d8798){return _0x1d8798;});}return null;};}function removeEntity(_0x580a56,_0x2aca4e){return function(_0x2370de){if(_0x2370de){return _0x2370de[_0xdaca('0x25')]()[_0xdaca('0x24')](function(){_0x580a56[_0xdaca('0x18')](0xcc)[_0xdaca('0x19')]();});}};}function handleEntityNotFound(_0x99ecc8,_0x49922e){return function(_0x37cbc5){if(!_0x37cbc5){_0x99ecc8[_0xdaca('0x17')](0x194);}return _0x37cbc5;};}function handleError(_0x184644,_0x4b922f){_0x4b922f=_0x4b922f||0x1f4;return function(_0x2aee4f){logger['error'](_0x2aee4f[_0xdaca('0x26')]);if(_0x2aee4f['name']){delete _0x2aee4f[_0xdaca('0x27')];}_0x184644[_0xdaca('0x18')](_0x4b922f)[_0xdaca('0x28')](_0x2aee4f);};}exports[_0xdaca('0x29')]=function(_0x5a8855,_0x23f00a){var _0x422675={},_0x37227f={},_0x167006={'count':0x0,'rows':[]};var _0x31ee18=_[_0xdaca('0x2a')](db[_0xdaca('0x2b')][_0xdaca('0x2c')],function(_0x9a2631){return{'name':_0x9a2631[_0xdaca('0x2d')],'type':_0x9a2631['type'][_0xdaca('0x2e')]};});_0x37227f[_0xdaca('0x2f')]=_[_0xdaca('0x2a')](_0x31ee18,'name');_0x37227f['query']=_['keys'](_0x5a8855[_0xdaca('0x30')]);_0x37227f[_0xdaca('0x31')]=_[_0xdaca('0x32')](_0x37227f[_0xdaca('0x2f')],_0x37227f['query']);_0x422675['attributes']=_['intersection'](_0x37227f[_0xdaca('0x2f')],qs[_0xdaca('0x33')](_0x5a8855['query'][_0xdaca('0x33')]));_0x422675[_0xdaca('0x34')]=_0x422675['attributes'][_0xdaca('0x35')]?_0x422675[_0xdaca('0x34')]:_0x37227f[_0xdaca('0x2f')];if(!_0x5a8855[_0xdaca('0x30')][_0xdaca('0x36')](_0xdaca('0x37'))){_0x422675[_0xdaca('0x1c')]=qs[_0xdaca('0x1c')](_0x5a8855['query'][_0xdaca('0x1c')]);_0x422675[_0xdaca('0x1e')]=qs['offset'](_0x5a8855[_0xdaca('0x30')][_0xdaca('0x1e')]);}_0x422675[_0xdaca('0x38')]=qs['sort'](_0x5a8855[_0xdaca('0x30')][_0xdaca('0x39')]);_0x422675[_0xdaca('0x3a')]=qs['filters'](_[_0xdaca('0x3b')](_0x5a8855['query'],_0x37227f[_0xdaca('0x31')]),_0x31ee18);if(_0x5a8855[_0xdaca('0x30')][_0xdaca('0x3c')]){_0x422675['where']=_[_0xdaca('0x3d')](_0x422675[_0xdaca('0x3a')],{'$or':_[_0xdaca('0x2a')](_0x31ee18,function(_0x2d06f8){if(_0x2d06f8['type']!=='VIRTUAL'){var _0x270615={};_0x270615[_0x2d06f8[_0xdaca('0x27')]]={'$like':'%'+_0x5a8855[_0xdaca('0x30')][_0xdaca('0x3c')]+'%'};return _0x270615;}})});}_0x422675=_['merge']({},_0x422675,_0x5a8855['options']);var _0xb573e1={'where':_0x422675[_0xdaca('0x3a')]};return db[_0xdaca('0x2b')][_0xdaca('0x1d')](_0xb573e1)[_0xdaca('0x24')](function(_0x1301d5){_0x167006['count']=_0x1301d5;if(_0x5a8855[_0xdaca('0x30')][_0xdaca('0x3e')]){_0x422675[_0xdaca('0x3f')]=[{'all':!![]}];}return db['IntegrationReport'][_0xdaca('0x40')](_0x422675);})[_0xdaca('0x24')](function(_0x43f24f){_0x167006[_0xdaca('0x41')]=_0x43f24f;return _0x167006;})['then'](respondWithFilteredResult(_0x23f00a,_0x422675))[_0xdaca('0x42')](handleError(_0x23f00a,null));};exports[_0xdaca('0x43')]=function(_0x37e944,_0x163379){var _0x295a23={'raw':![],'where':{'id':_0x37e944[_0xdaca('0x44')]['id']}},_0x2bdbf3={};_0x2bdbf3['model']=_[_0xdaca('0x45')](db['IntegrationReport'][_0xdaca('0x2c')]);_0x2bdbf3[_0xdaca('0x30')]=_['keys'](_0x37e944['query']);_0x2bdbf3[_0xdaca('0x31')]=_['intersection'](_0x2bdbf3[_0xdaca('0x2f')],_0x2bdbf3[_0xdaca('0x30')]);_0x295a23[_0xdaca('0x34')]=_[_0xdaca('0x32')](_0x2bdbf3[_0xdaca('0x2f')],qs[_0xdaca('0x33')](_0x37e944[_0xdaca('0x30')][_0xdaca('0x33')]));_0x295a23['attributes']=_0x295a23[_0xdaca('0x34')]['length']?_0x295a23[_0xdaca('0x34')]:_0x2bdbf3['model'];if(_0x37e944[_0xdaca('0x30')][_0xdaca('0x3e')]){_0x295a23[_0xdaca('0x3f')]=[{'all':!![]}];}_0x295a23=_['merge']({},_0x295a23,_0x37e944[_0xdaca('0x46')]);return db[_0xdaca('0x2b')]['find'](_0x295a23)[_0xdaca('0x24')](handleEntityNotFound(_0x163379,null))[_0xdaca('0x24')](respondWithResult(_0x163379,null))[_0xdaca('0x42')](handleError(_0x163379,null));};exports[_0xdaca('0x47')]=function(_0x538341,_0xd7663f){return db[_0xdaca('0x2b')][_0xdaca('0x47')](_0x538341[_0xdaca('0x48')],{})['then'](respondWithResult(_0xd7663f,0xc9))[_0xdaca('0x42')](handleError(_0xd7663f,null));};exports[_0xdaca('0x23')]=function(_0x53860a,_0x104404){if(_0x53860a[_0xdaca('0x48')]['id']){delete _0x53860a[_0xdaca('0x48')]['id'];}return db[_0xdaca('0x2b')][_0xdaca('0x49')]({'where':{'id':_0x53860a[_0xdaca('0x44')]['id']}})['then'](handleEntityNotFound(_0x104404,null))[_0xdaca('0x24')](saveUpdates(_0x53860a[_0xdaca('0x48')],null))[_0xdaca('0x24')](respondWithResult(_0x104404,null))[_0xdaca('0x42')](handleError(_0x104404,null));};exports[_0xdaca('0x25')]=function(_0x54f677,_0x52fc43){return db[_0xdaca('0x2b')][_0xdaca('0x49')]({'where':{'id':_0x54f677[_0xdaca('0x44')]['id']}})[_0xdaca('0x24')](handleEntityNotFound(_0x52fc43,null))[_0xdaca('0x24')](removeEntity(_0x52fc43,null))[_0xdaca('0x42')](handleError(_0x52fc43,null));};exports[_0xdaca('0x4a')]=function(_0x541170,_0x20442f){return db['IntegrationReport']['describe']()[_0xdaca('0x24')](respondWithResult(_0x20442f,null))[_0xdaca('0x42')](handleError(_0x20442f,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 188e51a..00282d8 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 _0x3861=['define','report_integration','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x556a41,_0x482566){var _0x338ae8=function(_0x2ca412){while(--_0x2ca412){_0x556a41['push'](_0x556a41['shift']());}};_0x338ae8(++_0x482566);}(_0x3861,0x91));var _0x1386=function(_0x4d692a,_0x25088e){_0x4d692a=_0x4d692a-0x0;var _0xb08e94=_0x3861[_0x4d692a];return _0xb08e94;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1386('0x0'))(_0x1386('0x1'));var moment=require(_0x1386('0x2'));var BPromise=require(_0x1386('0x3'));var rp=require(_0x1386('0x4'));var fs=require('fs');var path=require(_0x1386('0x5'));var rimraf=require(_0x1386('0x6'));var config=require(_0x1386('0x7'));var attributes=require(_0x1386('0x8'));module['exports']=function(_0x4b6709,_0x1d4300){return _0x4b6709[_0x1386('0x9')]('IntegrationReport',attributes,{'tableName':_0x1386('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe892=['report_integration','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport'];(function(_0x57d4b7,_0x2df9c3){var _0xefa3c2=function(_0xe3704d){while(--_0xe3704d){_0x57d4b7['push'](_0x57d4b7['shift']());}};_0xefa3c2(++_0x2df9c3);}(_0xe892,0x6d));var _0x2e89=function(_0x219420,_0x144b50){_0x219420=_0x219420-0x0;var _0x3f1159=_0xe892[_0x219420];return _0x3f1159;};'use strict';var _=require(_0x2e89('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2e89('0x1'));var moment=require(_0x2e89('0x2'));var BPromise=require(_0x2e89('0x3'));var rp=require(_0x2e89('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e89('0x5'));var config=require(_0x2e89('0x6'));var attributes=require(_0x2e89('0x7'));module[_0x2e89('0x8')]=function(_0x43a74b,_0x1f90d4){return _0x43a74b[_0x2e89('0x9')](_0x2e89('0xa'),attributes,{'tableName':_0x2e89('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index f31eaf2..2d832bf 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 _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(_0xe930d7,_0x3c8653){var _0x1adb1d=function(_0x5ce974){while(--_0x5ce974){_0xe930d7['push'](_0xe930d7['shift']());}};_0x1adb1d(++_0x3c8653);}(_0x57ca,0x108));var _0xa57c=function(_0x2926c1,_0x4ea7c2){_0x2926c1=_0x2926c1-0x0;var _0x48e509=_0x57ca[_0x2926c1];return _0x48e509;};'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 +var _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x8f4554,_0x97e1f8){var _0x2b7465=function(_0x5d8390){while(--_0x5d8390){_0x8f4554['push'](_0x8f4554['shift']());}};_0x2b7465(++_0x97e1f8);}(_0x524e,0x15e));var _0xe524=function(_0x57df79,_0x29432d){_0x57df79=_0x57df79-0x0;var _0x20d170=_0x524e[_0x57df79];return _0x20d170;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 7af17ec..2737e9f 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 _0x323e=['/:id','isAuthenticated','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','index'];(function(_0x34e415,_0x25856b){var _0x2f867a=function(_0x299903){while(--_0x299903){_0x34e415['push'](_0x34e415['shift']());}};_0x2f867a(++_0x25856b);}(_0x323e,0x188));var _0xe323=function(_0x1ccaca,_0x10887f){_0x1ccaca=_0x1ccaca-0x0;var _0x3729a6=_0x323e[_0x1ccaca];return _0x3729a6;};'use strict';var multer=require(_0xe323('0x0'));var util=require(_0xe323('0x1'));var path=require(_0xe323('0x2'));var timeout=require(_0xe323('0x3'));var express=require(_0xe323('0x4'));var router=express[_0xe323('0x5')]();var fs_extra=require(_0xe323('0x6'));var auth=require(_0xe323('0x7'));var interaction=require(_0xe323('0x8'));var config=require(_0xe323('0x9'));var controller=require(_0xe323('0xa'));router[_0xe323('0xb')]('/',auth['isAuthenticated'](),controller[_0xe323('0xc')]);router['get'](_0xe323('0xd'),auth[_0xe323('0xe')](),controller['show']);router[_0xe323('0xb')](_0xe323('0xf'),auth[_0xe323('0xe')](),controller[_0xe323('0x10')]);router[_0xe323('0x11')]('/',auth['isAuthenticated'](),controller[_0xe323('0x12')]);router[_0xe323('0x11')](_0xe323('0xf'),auth[_0xe323('0xe')](),controller[_0xe323('0x13')]);router[_0xe323('0x11')](_0xe323('0x14'),auth[_0xe323('0xe')](),controller[_0xe323('0x15')]);router[_0xe323('0x16')](_0xe323('0xd'),auth['isAuthenticated'](),controller[_0xe323('0x17')]);router[_0xe323('0x18')](_0xe323('0xd'),auth[_0xe323('0xe')](),controller[_0xe323('0x19')]);module[_0xe323('0x1a')]=router; \ No newline at end of file +var _0x0dee=['isAuthenticated','get','/:id','post','create','addInterval','/:id/sub_intervals/create_many','put','delete','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0x0dee,0xf7));var _0xe0de=function(_0xb8c40f,_0x5bea15){_0xb8c40f=_0xb8c40f-0x0;var _0x56bf59=_0x0dee[_0xb8c40f];return _0x56bf59;};'use strict';var multer=require(_0xe0de('0x0'));var util=require(_0xe0de('0x1'));var path=require('path');var timeout=require(_0xe0de('0x2'));var express=require('express');var router=express[_0xe0de('0x3')]();var fs_extra=require(_0xe0de('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe0de('0x5'));var config=require(_0xe0de('0x6'));var controller=require(_0xe0de('0x7'));router['get']('/',auth[_0xe0de('0x8')](),controller['index']);router[_0xe0de('0x9')](_0xe0de('0xa'),auth[_0xe0de('0x8')](),controller['show']);router[_0xe0de('0x9')]('/:id/sub_intervals',auth[_0xe0de('0x8')](),controller['getIntervals']);router[_0xe0de('0xb')]('/',auth[_0xe0de('0x8')](),controller[_0xe0de('0xc')]);router[_0xe0de('0xb')]('/:id/sub_intervals',auth[_0xe0de('0x8')](),controller[_0xe0de('0xd')]);router[_0xe0de('0xb')](_0xe0de('0xe'),auth['isAuthenticated'](),controller['addIntervals']);router[_0xe0de('0xf')](_0xe0de('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xe0de('0x10')](_0xe0de('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index d356d0c..11b30b5 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 _0x78ff=['sequelize','STRING'];(function(_0x4b9c09,_0xfd409f){var _0x186cd5=function(_0x5cc76a){while(--_0x5cc76a){_0x4b9c09['push'](_0x4b9c09['shift']());}};_0x186cd5(++_0xfd409f);}(_0x78ff,0x16a));var _0xf78f=function(_0x9ad71f,_0x18c4d5){_0x9ad71f=_0x9ad71f-0x0;var _0x1b7ab2=_0x78ff[_0x9ad71f];return _0x1b7ab2;};'use strict';var Sequelize=require(_0xf78f('0x0'));module['exports']={'name':{'type':Sequelize[_0xf78f('0x1')]},'description':{'type':Sequelize[_0xf78f('0x1')]},'interval':{'type':Sequelize[_0xf78f('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x4c1d=['STRING','sequelize','exports'];(function(_0x372c90,_0x46704f){var _0x8de2b3=function(_0x55355e){while(--_0x55355e){_0x372c90['push'](_0x372c90['shift']());}};_0x8de2b3(++_0x46704f);}(_0x4c1d,0xa9));var _0xd4c1=function(_0x2c5ee9,_0x3e7989){_0x2c5ee9=_0x2c5ee9-0x0;var _0x4566af=_0x4c1d[_0x2c5ee9];return _0x4566af;};'use strict';var Sequelize=require(_0xd4c1('0x0'));module[_0xd4c1('0x1')]={'name':{'type':Sequelize[_0xd4c1('0x2')]},'description':{'type':Sequelize[_0xd4c1('0x2')]},'interval':{'type':Sequelize[_0xd4c1('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 9699251..576e31b 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 _0x45d5=['end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','create','body','role','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addInterval','IntervalId','getIntervals','addIntervals','findOne','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x110109,_0x192c62){var _0x41b4e4=function(_0x39e861){while(--_0x39e861){_0x110109['push'](_0x110109['shift']());}};_0x41b4e4(++_0x192c62);}(_0x45d5,0x157));var _0x545d=function(_0x27ea1b,_0x1ad811){_0x27ea1b=_0x27ea1b-0x0;var _0x44b914=_0x45d5[_0x27ea1b];return _0x44b914;};'use strict';var emlformat=require(_0x545d('0x0'));var rimraf=require(_0x545d('0x1'));var zipdir=require(_0x545d('0x2'));var jsonpatch=require(_0x545d('0x3'));var rp=require('request-promise');var moment=require(_0x545d('0x4'));var BPromise=require(_0x545d('0x5'));var Mustache=require(_0x545d('0x6'));var util=require(_0x545d('0x7'));var path=require(_0x545d('0x8'));var sox=require(_0x545d('0x9'));var csv=require(_0x545d('0xa'));var ejs=require(_0x545d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x545d('0xc'));var squel=require(_0x545d('0xd'));var crypto=require('crypto');var jsforce=require(_0x545d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x545d('0xa'));var querystring=require('querystring');var Papa=require(_0x545d('0xf'));var Redis=require(_0x545d('0x10'));var authService=require(_0x545d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x545d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x545d('0x13'))('api');var utils=require(_0x545d('0x14'));var config=require(_0x545d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x545d('0x16'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x106473,_0x4498a5){_0x4498a5=_0x4498a5||0xcc;return function(_0x31fbab){if(_0x31fbab){return _0x106473[_0x545d('0x17')](_0x4498a5);}return _0x106473[_0x545d('0x18')](_0x4498a5)[_0x545d('0x19')]();};}function respondWithResult(_0x2d599d,_0x535e71){_0x535e71=_0x535e71||0xc8;return function(_0x282290){if(_0x282290){return _0x2d599d[_0x545d('0x18')](_0x535e71)[_0x545d('0x1a')](_0x282290);}};}function respondWithFilteredResult(_0x1905a9,_0x387561){return function(_0x115c1c){if(_0x115c1c){var _0x20138b=typeof _0x387561[_0x545d('0x1b')]==='undefined'&&typeof _0x387561[_0x545d('0x1c')]===_0x545d('0x1d');var _0x5b35d4=_0x115c1c['count'];var _0x481f57=_0x20138b?0x0:_0x387561['offset'];var _0x4d3d8e=_0x20138b?_0x115c1c[_0x545d('0x1e')]:_0x387561['offset']+_0x387561[_0x545d('0x1c')];var _0x12073c;if(_0x4d3d8e>=_0x5b35d4){_0x4d3d8e=_0x5b35d4;_0x12073c=0xc8;}else{_0x12073c=0xce;}_0x1905a9['status'](_0x12073c);return _0x1905a9[_0x545d('0x1f')](_0x545d('0x20'),_0x481f57+'-'+_0x4d3d8e+'/'+_0x5b35d4)['json'](_0x115c1c);}return null;};}function patchUpdates(_0x122734){return function(_0x351c71){try{jsonpatch[_0x545d('0x21')](_0x351c71,_0x122734,!![]);}catch(_0x2aa3ab){return BPromise[_0x545d('0x22')](_0x2aa3ab);}return _0x351c71[_0x545d('0x23')]();};}function saveUpdates(_0x495681,_0x2c4e51){return function(_0x1c2d43){if(_0x1c2d43){return _0x1c2d43[_0x545d('0x24')](_0x495681)[_0x545d('0x25')](function(_0x1a99fe){return _0x1a99fe;});}return null;};}function removeEntity(_0x95ced5,_0x143573){return function(_0x33b86a){if(_0x33b86a){return _0x33b86a[_0x545d('0x26')]()[_0x545d('0x25')](function(){var _0x5a4e1d=_0x33b86a[_0x545d('0x27')]({'plain':!![]});var _0x32750a=_0x545d('0x28');return db[_0x545d('0x29')]['destroy']({'where':{'type':_0x32750a,'resourceId':_0x5a4e1d['id']}})['then'](function(){return _0x33b86a;});})[_0x545d('0x25')](function(){_0x95ced5[_0x545d('0x18')](0xcc)[_0x545d('0x19')]();});}};}function handleEntityNotFound(_0x5a091e,_0x54e8a6){return function(_0x482f2b){if(!_0x482f2b){_0x5a091e[_0x545d('0x17')](0x194);}return _0x482f2b;};}function handleError(_0x17c5c0,_0x3802b1){_0x3802b1=_0x3802b1||0x1f4;return function(_0x5bf68f){logger['error'](_0x5bf68f[_0x545d('0x2a')]);if(_0x5bf68f[_0x545d('0x2b')]){delete _0x5bf68f[_0x545d('0x2b')];}_0x17c5c0[_0x545d('0x18')](_0x3802b1)[_0x545d('0x2c')](_0x5bf68f);};}exports[_0x545d('0x2d')]=function(_0x14e88e,_0x56e628){var _0x57a38f={},_0x23b7c4={},_0x4bee55={'count':0x0,'rows':[]};var _0x137bd4=_[_0x545d('0x2e')](db[_0x545d('0x2f')][_0x545d('0x30')],function(_0x1dc0b1){return{'name':_0x1dc0b1[_0x545d('0x31')],'type':_0x1dc0b1[_0x545d('0x32')][_0x545d('0x33')]};});_0x23b7c4[_0x545d('0x34')]=_['map'](_0x137bd4,_0x545d('0x2b'));_0x23b7c4[_0x545d('0x35')]=_[_0x545d('0x36')](_0x14e88e[_0x545d('0x35')]);_0x23b7c4[_0x545d('0x37')]=_[_0x545d('0x38')](_0x23b7c4['model'],_0x23b7c4[_0x545d('0x35')]);_0x57a38f[_0x545d('0x39')]=_[_0x545d('0x38')](_0x23b7c4[_0x545d('0x34')],qs['fields'](_0x14e88e[_0x545d('0x35')][_0x545d('0x3a')]));_0x57a38f[_0x545d('0x39')]=_0x57a38f[_0x545d('0x39')]['length']?_0x57a38f[_0x545d('0x39')]:_0x23b7c4[_0x545d('0x34')];if(!_0x14e88e['query'][_0x545d('0x3b')](_0x545d('0x3c'))){_0x57a38f[_0x545d('0x1c')]=qs[_0x545d('0x1c')](_0x14e88e[_0x545d('0x35')]['limit']);_0x57a38f[_0x545d('0x1b')]=qs[_0x545d('0x1b')](_0x14e88e[_0x545d('0x35')][_0x545d('0x1b')]);}_0x57a38f['order']=qs[_0x545d('0x3d')](_0x14e88e[_0x545d('0x35')][_0x545d('0x3d')]);_0x57a38f[_0x545d('0x3e')]=qs['filters'](_[_0x545d('0x3f')](_0x14e88e[_0x545d('0x35')],_0x23b7c4[_0x545d('0x37')]),_0x137bd4);if(_0x14e88e[_0x545d('0x35')][_0x545d('0x40')]){_0x57a38f['where']=_[_0x545d('0x41')](_0x57a38f[_0x545d('0x3e')],{'$or':_['map'](_0x137bd4,function(_0x3968b5){if(_0x3968b5['type']!==_0x545d('0x42')){var _0x1ada3f={};_0x1ada3f[_0x3968b5[_0x545d('0x2b')]]={'$like':'%'+_0x14e88e[_0x545d('0x35')][_0x545d('0x40')]+'%'};return _0x1ada3f;}})});}_0x57a38f=_[_0x545d('0x41')]({},_0x57a38f,_0x14e88e[_0x545d('0x43')]);var _0x27666a={'where':_0x57a38f[_0x545d('0x3e')]};return db[_0x545d('0x2f')][_0x545d('0x1e')](_0x27666a)[_0x545d('0x25')](function(_0x325162){_0x4bee55[_0x545d('0x1e')]=_0x325162;if(_0x14e88e['query'][_0x545d('0x44')]){_0x57a38f['include']=[{'all':!![]}];}return db[_0x545d('0x2f')][_0x545d('0x45')](_0x57a38f);})['then'](function(_0x54667f){_0x4bee55[_0x545d('0x46')]=_0x54667f;return _0x4bee55;})[_0x545d('0x25')](respondWithFilteredResult(_0x56e628,_0x57a38f))[_0x545d('0x47')](handleError(_0x56e628,null));};exports['show']=function(_0x4b6c77,_0xf2dc84){var _0x5bba22={'raw':!![],'where':{'id':_0x4b6c77[_0x545d('0x48')]['id']}},_0x345070={};_0x345070['model']=_[_0x545d('0x36')](db[_0x545d('0x2f')][_0x545d('0x30')]);_0x345070[_0x545d('0x35')]=_[_0x545d('0x36')](_0x4b6c77[_0x545d('0x35')]);_0x345070[_0x545d('0x37')]=_[_0x545d('0x38')](_0x345070['model'],_0x345070[_0x545d('0x35')]);_0x5bba22[_0x545d('0x39')]=_[_0x545d('0x38')](_0x345070[_0x545d('0x34')],qs['fields'](_0x4b6c77[_0x545d('0x35')][_0x545d('0x3a')]));_0x5bba22[_0x545d('0x39')]=_0x5bba22[_0x545d('0x39')][_0x545d('0x49')]?_0x5bba22['attributes']:_0x345070['model'];if(_0x4b6c77[_0x545d('0x35')]['includeAll']){_0x5bba22[_0x545d('0x4a')]=[{'all':!![]}];}_0x5bba22=_[_0x545d('0x41')]({},_0x5bba22,_0x4b6c77['options']);return db['Interval']['find'](_0x5bba22)[_0x545d('0x25')](handleEntityNotFound(_0xf2dc84,null))[_0x545d('0x25')](respondWithResult(_0xf2dc84,null))[_0x545d('0x47')](handleError(_0xf2dc84,null));};exports['create']=function(_0xc1b84e,_0x413fec){return db[_0x545d('0x2f')][_0x545d('0x4b')](_0xc1b84e[_0x545d('0x4c')],{})[_0x545d('0x25')](function(_0x87bdbd){var _0x3f51ac=_0xc1b84e['user'][_0x545d('0x27')]({'plain':!![]});if(!_0x3f51ac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f51ac[_0x545d('0x4d')]===_0x545d('0x4e')){var _0x3461ef=_0x87bdbd['get']({'plain':!![]});var _0x2ebe3d=_0x545d('0x28');return db[_0x545d('0x4f')]['find']({'where':{'name':_0x2ebe3d,'userProfileId':_0x3f51ac['userProfileId']},'raw':!![]})['then'](function(_0x46a947){if(_0x46a947&&_0x46a947[_0x545d('0x50')]===0x0){return db[_0x545d('0x29')]['create']({'name':_0x3461ef[_0x545d('0x2b')],'resourceId':_0x3461ef['id'],'type':_0x46a947[_0x545d('0x2b')],'sectionId':_0x46a947['id']},{})[_0x545d('0x25')](function(){return _0x87bdbd;});}else{return _0x87bdbd;}})[_0x545d('0x47')](function(_0x1dc065){logger[_0x545d('0x51')](_0x545d('0x52'),_0x1dc065);throw _0x1dc065;});}return _0x87bdbd;})['then'](respondWithResult(_0x413fec,0xc9))['catch'](handleError(_0x413fec,null));};exports[_0x545d('0x24')]=function(_0x454bdb,_0xdccc2d){if(_0x454bdb[_0x545d('0x4c')]['id']){delete _0x454bdb[_0x545d('0x4c')]['id'];}return db[_0x545d('0x2f')][_0x545d('0x53')]({'where':{'id':_0x454bdb[_0x545d('0x48')]['id']}})['then'](handleEntityNotFound(_0xdccc2d,null))[_0x545d('0x25')](saveUpdates(_0x454bdb['body'],null))[_0x545d('0x25')](respondWithResult(_0xdccc2d,null))[_0x545d('0x47')](handleError(_0xdccc2d,null));};exports[_0x545d('0x26')]=function(_0xf6448c,_0x184df1){return db[_0x545d('0x2f')][_0x545d('0x53')]({'where':{'id':_0xf6448c['params']['id']}})[_0x545d('0x25')](handleEntityNotFound(_0x184df1,null))[_0x545d('0x25')](removeEntity(_0x184df1,null))[_0x545d('0x47')](handleError(_0x184df1,null));};exports[_0x545d('0x54')]=function(_0x52f103,_0x4614eb,_0x11f3a7){if(_0x52f103[_0x545d('0x4c')]['id']){delete _0x52f103[_0x545d('0x4c')]['id'];}return db['Interval'][_0x545d('0x53')]({'where':{'id':_0x52f103[_0x545d('0x48')]['id']}})['then'](handleEntityNotFound(_0x4614eb,null))['then'](function(_0x52a3c8){if(_0x52a3c8){_0x52f103[_0x545d('0x4c')][_0x545d('0x55')]=_0x52a3c8['id'];return db[_0x545d('0x2f')]['create'](_0x52f103['body']);}})[_0x545d('0x25')](respondWithResult(_0x4614eb,null))[_0x545d('0x47')](handleError(_0x4614eb,null));};exports[_0x545d('0x56')]=function(_0x4f3d79,_0x406a1d,_0x4bf26c){var _0x4b7fc1={};var _0x206978={};var _0x4e9c55;var _0x3582ae;return db[_0x545d('0x2f')]['findOne']({'where':{'id':_0x4f3d79[_0x545d('0x48')]['id']}})['then'](handleEntityNotFound(_0x406a1d,null))[_0x545d('0x25')](function(_0x12ae5c){if(_0x12ae5c){_0x4e9c55=_0x12ae5c;_0x206978[_0x545d('0x34')]=_[_0x545d('0x36')](db[_0x545d('0x2f')]['rawAttributes']);_0x206978[_0x545d('0x35')]=_[_0x545d('0x36')](_0x4f3d79[_0x545d('0x35')]);_0x206978[_0x545d('0x37')]=_['intersection'](_0x206978['model'],_0x206978[_0x545d('0x35')]);_0x4b7fc1[_0x545d('0x39')]=_[_0x545d('0x38')](_0x206978['model'],qs[_0x545d('0x3a')](_0x4f3d79[_0x545d('0x35')]['fields']));_0x4b7fc1[_0x545d('0x39')]=_0x4b7fc1['attributes']['length']?_0x4b7fc1['attributes']:_0x206978[_0x545d('0x34')];_0x4b7fc1['order']=qs['sort'](_0x4f3d79[_0x545d('0x35')][_0x545d('0x3d')]);_0x4b7fc1[_0x545d('0x3e')]=qs[_0x545d('0x37')](_['pick'](_0x4f3d79[_0x545d('0x35')],_0x206978[_0x545d('0x37')]));if(_0x4f3d79['query']['filter']){_0x4b7fc1[_0x545d('0x3e')]=_[_0x545d('0x41')](_0x4b7fc1['where'],{'$or':_[_0x545d('0x2e')](_0x4b7fc1['attributes'],function(_0x226086){var _0xcaa0c1={};_0xcaa0c1[_0x226086]={'$like':'%'+_0x4f3d79[_0x545d('0x35')]['filter']+'%'};return _0xcaa0c1;})});}_0x4b7fc1=_[_0x545d('0x41')]({},_0x4b7fc1,_0x4f3d79['options']);return _0x4e9c55[_0x545d('0x56')](_0x4b7fc1);}})[_0x545d('0x25')](function(_0x58d0ec){if(_0x58d0ec){_0x3582ae=_0x58d0ec['length'];if(!_0x4f3d79[_0x545d('0x35')]['hasOwnProperty']('nolimit')){_0x4b7fc1[_0x545d('0x1c')]=qs[_0x545d('0x1c')](_0x4f3d79[_0x545d('0x35')][_0x545d('0x1c')]);_0x4b7fc1['offset']=qs[_0x545d('0x1b')](_0x4f3d79[_0x545d('0x35')][_0x545d('0x1b')]);}return _0x4e9c55[_0x545d('0x56')](_0x4b7fc1);}})[_0x545d('0x25')](function(_0xbbf2cf){if(_0xbbf2cf){return _0xbbf2cf?{'count':_0x3582ae,'rows':_0xbbf2cf}:null;}})['then'](respondWithResult(_0x406a1d,null))[_0x545d('0x47')](handleError(_0x406a1d,null));};exports[_0x545d('0x57')]=function(_0x3c868e,_0x4e54ab,_0xfe8cef){return db[_0x545d('0x2f')][_0x545d('0x58')]({'where':{'id':_0x3c868e['params']['id']}})[_0x545d('0x25')](handleEntityNotFound(_0x4e54ab,null))['then'](function(_0x49a8e9){if(_0x49a8e9){return db[_0x545d('0x59')][_0x545d('0x5a')](function(_0x2d22ae){return db[_0x545d('0x2f')]['destroy']({'where':{'IntervalId':_0x3c868e[_0x545d('0x48')]['id']},'transaction':_0x2d22ae})[_0x545d('0x25')](function(_0x5a38cf){var _0x3e9bc5=_[_0x545d('0x2e')](_0x3c868e[_0x545d('0x4c')],function(_0x314739){delete _0x314739['id'];_0x314739[_0x545d('0x55')]=_0x3c868e[_0x545d('0x48')]['id'];return _0x314739;});return db['Interval'][_0x545d('0x5b')](_0x3e9bc5,{'transaction':_0x2d22ae});});})[_0x545d('0x25')](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x3c868e[_0x545d('0x48')]['id']}});});}})['then'](respondWithResult(_0x4e54ab,null))[_0x545d('0x47')](handleError(_0x4e54ab,null));}; \ No newline at end of file +var _0xb6bb=['set','Content-Range','apply','reject','save','then','destroy','Intervals','UserProfileResource','error','stack','name','send','map','Interval','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','addInterval','getIntervals','findOne','nolimit','sequelize','transaction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','count','limit'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xb6bb,0xf4));var _0xbb6b=function(_0x554d68,_0x34ac83){_0x554d68=_0x554d68-0x0;var _0x40e00f=_0xb6bb[_0x554d68];return _0x40e00f;};'use strict';var emlformat=require(_0xbb6b('0x0'));var rimraf=require(_0xbb6b('0x1'));var zipdir=require(_0xbb6b('0x2'));var jsonpatch=require(_0xbb6b('0x3'));var rp=require(_0xbb6b('0x4'));var moment=require(_0xbb6b('0x5'));var BPromise=require(_0xbb6b('0x6'));var Mustache=require(_0xbb6b('0x7'));var util=require('util');var path=require(_0xbb6b('0x8'));var sox=require(_0xbb6b('0x9'));var csv=require(_0xbb6b('0xa'));var ejs=require(_0xbb6b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb6b('0xc'));var squel=require(_0xbb6b('0xd'));var crypto=require('crypto');var jsforce=require(_0xbb6b('0xe'));var deskjs=require(_0xbb6b('0xf'));var toCsv=require(_0xbb6b('0xa'));var querystring=require('querystring');var Papa=require(_0xbb6b('0x10'));var Redis=require('ioredis');var authService=require(_0xbb6b('0x11'));var qs=require(_0xbb6b('0x12'));var as=require(_0xbb6b('0x13'));var hardwareService=require(_0xbb6b('0x14'));var logger=require(_0xbb6b('0x15'))(_0xbb6b('0x16'));var utils=require(_0xbb6b('0x17'));var config=require(_0xbb6b('0x18'));var licenseUtil=require(_0xbb6b('0x19'));var db=require(_0xbb6b('0x1a'))['db'];var extensions=require(_0xbb6b('0x1b'));function respondWithStatusCode(_0x5ecee9,_0x16efc3){_0x16efc3=_0x16efc3||0xcc;return function(_0x2d0be4){if(_0x2d0be4){return _0x5ecee9[_0xbb6b('0x1c')](_0x16efc3);}return _0x5ecee9[_0xbb6b('0x1d')](_0x16efc3)[_0xbb6b('0x1e')]();};}function respondWithResult(_0x45ef45,_0x3b1db4){_0x3b1db4=_0x3b1db4||0xc8;return function(_0x16624a){if(_0x16624a){return _0x45ef45[_0xbb6b('0x1d')](_0x3b1db4)[_0xbb6b('0x1f')](_0x16624a);}};}function respondWithFilteredResult(_0x51c034,_0x1b52d8){return function(_0x2b0042){if(_0x2b0042){var _0x31a258=typeof _0x1b52d8[_0xbb6b('0x20')]==='undefined'&&typeof _0x1b52d8['limit']==='undefined';var _0x3c88cd=_0x2b0042['count'];var _0x213144=_0x31a258?0x0:_0x1b52d8['offset'];var _0x53f6c7=_0x31a258?_0x2b0042[_0xbb6b('0x21')]:_0x1b52d8['offset']+_0x1b52d8[_0xbb6b('0x22')];var _0x345a2c;if(_0x53f6c7>=_0x3c88cd){_0x53f6c7=_0x3c88cd;_0x345a2c=0xc8;}else{_0x345a2c=0xce;}_0x51c034[_0xbb6b('0x1d')](_0x345a2c);return _0x51c034[_0xbb6b('0x23')](_0xbb6b('0x24'),_0x213144+'-'+_0x53f6c7+'/'+_0x3c88cd)[_0xbb6b('0x1f')](_0x2b0042);}return null;};}function patchUpdates(_0x46cdcf){return function(_0x48c7b8){try{jsonpatch[_0xbb6b('0x25')](_0x48c7b8,_0x46cdcf,!![]);}catch(_0xeae4dc){return BPromise[_0xbb6b('0x26')](_0xeae4dc);}return _0x48c7b8[_0xbb6b('0x27')]();};}function saveUpdates(_0x15d8db,_0x16fde8){return function(_0x361fa6){if(_0x361fa6){return _0x361fa6['update'](_0x15d8db)[_0xbb6b('0x28')](function(_0x342009){return _0x342009;});}return null;};}function removeEntity(_0x29d2fa,_0x2089fa){return function(_0xbc93a5){if(_0xbc93a5){return _0xbc93a5[_0xbb6b('0x29')]()[_0xbb6b('0x28')](function(){var _0x3c0e05=_0xbc93a5['get']({'plain':!![]});var _0x48819e=_0xbb6b('0x2a');return db[_0xbb6b('0x2b')][_0xbb6b('0x29')]({'where':{'type':_0x48819e,'resourceId':_0x3c0e05['id']}})[_0xbb6b('0x28')](function(){return _0xbc93a5;});})[_0xbb6b('0x28')](function(){_0x29d2fa[_0xbb6b('0x1d')](0xcc)[_0xbb6b('0x1e')]();});}};}function handleEntityNotFound(_0x26857f,_0x1ff711){return function(_0x2fd2a9){if(!_0x2fd2a9){_0x26857f[_0xbb6b('0x1c')](0x194);}return _0x2fd2a9;};}function handleError(_0x47e21c,_0xd9adf0){_0xd9adf0=_0xd9adf0||0x1f4;return function(_0x4b9475){logger[_0xbb6b('0x2c')](_0x4b9475[_0xbb6b('0x2d')]);if(_0x4b9475[_0xbb6b('0x2e')]){delete _0x4b9475[_0xbb6b('0x2e')];}_0x47e21c[_0xbb6b('0x1d')](_0xd9adf0)[_0xbb6b('0x2f')](_0x4b9475);};}exports['index']=function(_0x1fd14e,_0x4113a3){var _0x3813a7={},_0x2b577f={},_0x1ff680={'count':0x0,'rows':[]};var _0x1e6fce=_[_0xbb6b('0x30')](db[_0xbb6b('0x31')]['rawAttributes'],function(_0x47102f){return{'name':_0x47102f[_0xbb6b('0x32')],'type':_0x47102f['type'][_0xbb6b('0x33')]};});_0x2b577f[_0xbb6b('0x34')]=_[_0xbb6b('0x30')](_0x1e6fce,_0xbb6b('0x2e'));_0x2b577f[_0xbb6b('0x35')]=_[_0xbb6b('0x36')](_0x1fd14e[_0xbb6b('0x35')]);_0x2b577f['filters']=_[_0xbb6b('0x37')](_0x2b577f[_0xbb6b('0x34')],_0x2b577f[_0xbb6b('0x35')]);_0x3813a7[_0xbb6b('0x38')]=_[_0xbb6b('0x37')](_0x2b577f[_0xbb6b('0x34')],qs[_0xbb6b('0x39')](_0x1fd14e[_0xbb6b('0x35')][_0xbb6b('0x39')]));_0x3813a7[_0xbb6b('0x38')]=_0x3813a7[_0xbb6b('0x38')][_0xbb6b('0x3a')]?_0x3813a7['attributes']:_0x2b577f['model'];if(!_0x1fd14e['query'][_0xbb6b('0x3b')]('nolimit')){_0x3813a7[_0xbb6b('0x22')]=qs['limit'](_0x1fd14e[_0xbb6b('0x35')][_0xbb6b('0x22')]);_0x3813a7[_0xbb6b('0x20')]=qs['offset'](_0x1fd14e[_0xbb6b('0x35')][_0xbb6b('0x20')]);}_0x3813a7[_0xbb6b('0x3c')]=qs['sort'](_0x1fd14e['query'][_0xbb6b('0x3d')]);_0x3813a7[_0xbb6b('0x3e')]=qs[_0xbb6b('0x3f')](_[_0xbb6b('0x40')](_0x1fd14e[_0xbb6b('0x35')],_0x2b577f[_0xbb6b('0x3f')]),_0x1e6fce);if(_0x1fd14e[_0xbb6b('0x35')]['filter']){_0x3813a7[_0xbb6b('0x3e')]=_[_0xbb6b('0x41')](_0x3813a7[_0xbb6b('0x3e')],{'$or':_[_0xbb6b('0x30')](_0x1e6fce,function(_0x4e3cf3){if(_0x4e3cf3['type']!==_0xbb6b('0x42')){var _0x268b3c={};_0x268b3c[_0x4e3cf3[_0xbb6b('0x2e')]]={'$like':'%'+_0x1fd14e['query'][_0xbb6b('0x43')]+'%'};return _0x268b3c;}})});}_0x3813a7=_[_0xbb6b('0x41')]({},_0x3813a7,_0x1fd14e[_0xbb6b('0x44')]);var _0x56b765={'where':_0x3813a7[_0xbb6b('0x3e')]};return db[_0xbb6b('0x31')][_0xbb6b('0x21')](_0x56b765)[_0xbb6b('0x28')](function(_0x1af636){_0x1ff680[_0xbb6b('0x21')]=_0x1af636;if(_0x1fd14e[_0xbb6b('0x35')][_0xbb6b('0x45')]){_0x3813a7[_0xbb6b('0x46')]=[{'all':!![]}];}return db['Interval'][_0xbb6b('0x47')](_0x3813a7);})['then'](function(_0x496481){_0x1ff680[_0xbb6b('0x48')]=_0x496481;return _0x1ff680;})['then'](respondWithFilteredResult(_0x4113a3,_0x3813a7))['catch'](handleError(_0x4113a3,null));};exports[_0xbb6b('0x49')]=function(_0x5760c3,_0x842e5){var _0x5fcab4={'raw':!![],'where':{'id':_0x5760c3[_0xbb6b('0x4a')]['id']}},_0x117b69={};_0x117b69[_0xbb6b('0x34')]=_[_0xbb6b('0x36')](db[_0xbb6b('0x31')][_0xbb6b('0x4b')]);_0x117b69[_0xbb6b('0x35')]=_[_0xbb6b('0x36')](_0x5760c3[_0xbb6b('0x35')]);_0x117b69[_0xbb6b('0x3f')]=_[_0xbb6b('0x37')](_0x117b69['model'],_0x117b69[_0xbb6b('0x35')]);_0x5fcab4[_0xbb6b('0x38')]=_['intersection'](_0x117b69[_0xbb6b('0x34')],qs[_0xbb6b('0x39')](_0x5760c3['query'][_0xbb6b('0x39')]));_0x5fcab4['attributes']=_0x5fcab4[_0xbb6b('0x38')][_0xbb6b('0x3a')]?_0x5fcab4[_0xbb6b('0x38')]:_0x117b69[_0xbb6b('0x34')];if(_0x5760c3[_0xbb6b('0x35')]['includeAll']){_0x5fcab4[_0xbb6b('0x46')]=[{'all':!![]}];}_0x5fcab4=_['merge']({},_0x5fcab4,_0x5760c3[_0xbb6b('0x44')]);return db[_0xbb6b('0x31')][_0xbb6b('0x4c')](_0x5fcab4)[_0xbb6b('0x28')](handleEntityNotFound(_0x842e5,null))[_0xbb6b('0x28')](respondWithResult(_0x842e5,null))[_0xbb6b('0x4d')](handleError(_0x842e5,null));};exports[_0xbb6b('0x4e')]=function(_0x485024,_0x5986ab){return db[_0xbb6b('0x31')][_0xbb6b('0x4e')](_0x485024[_0xbb6b('0x4f')],{})[_0xbb6b('0x28')](function(_0x48bc24){var _0xff8ac6=_0x485024[_0xbb6b('0x50')][_0xbb6b('0x51')]({'plain':!![]});if(!_0xff8ac6)throw new Error(_0xbb6b('0x52'));if(_0xff8ac6[_0xbb6b('0x53')]===_0xbb6b('0x50')){var _0x121c4f=_0x48bc24['get']({'plain':!![]});var _0x47d220='Intervals';return db[_0xbb6b('0x54')][_0xbb6b('0x4c')]({'where':{'name':_0x47d220,'userProfileId':_0xff8ac6[_0xbb6b('0x55')]},'raw':!![]})[_0xbb6b('0x28')](function(_0x4443b2){if(_0x4443b2&&_0x4443b2[_0xbb6b('0x56')]===0x0){return db['UserProfileResource'][_0xbb6b('0x4e')]({'name':_0x121c4f[_0xbb6b('0x2e')],'resourceId':_0x121c4f['id'],'type':_0x4443b2[_0xbb6b('0x2e')],'sectionId':_0x4443b2['id']},{})['then'](function(){return _0x48bc24;});}else{return _0x48bc24;}})[_0xbb6b('0x4d')](function(_0x9f4129){logger[_0xbb6b('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9f4129);throw _0x9f4129;});}return _0x48bc24;})[_0xbb6b('0x28')](respondWithResult(_0x5986ab,0xc9))[_0xbb6b('0x4d')](handleError(_0x5986ab,null));};exports['update']=function(_0x294df5,_0x5397e0){if(_0x294df5['body']['id']){delete _0x294df5[_0xbb6b('0x4f')]['id'];}return db[_0xbb6b('0x31')][_0xbb6b('0x4c')]({'where':{'id':_0x294df5[_0xbb6b('0x4a')]['id']}})[_0xbb6b('0x28')](handleEntityNotFound(_0x5397e0,null))[_0xbb6b('0x28')](saveUpdates(_0x294df5[_0xbb6b('0x4f')],null))[_0xbb6b('0x28')](respondWithResult(_0x5397e0,null))[_0xbb6b('0x4d')](handleError(_0x5397e0,null));};exports[_0xbb6b('0x29')]=function(_0x4e05ab,_0x288fe9){return db[_0xbb6b('0x31')][_0xbb6b('0x4c')]({'where':{'id':_0x4e05ab[_0xbb6b('0x4a')]['id']}})[_0xbb6b('0x28')](handleEntityNotFound(_0x288fe9,null))['then'](removeEntity(_0x288fe9,null))[_0xbb6b('0x4d')](handleError(_0x288fe9,null));};exports[_0xbb6b('0x57')]=function(_0x518672,_0x1e9233,_0x143f86){if(_0x518672[_0xbb6b('0x4f')]['id']){delete _0x518672[_0xbb6b('0x4f')]['id'];}return db[_0xbb6b('0x31')][_0xbb6b('0x4c')]({'where':{'id':_0x518672[_0xbb6b('0x4a')]['id']}})[_0xbb6b('0x28')](handleEntityNotFound(_0x1e9233,null))[_0xbb6b('0x28')](function(_0x139568){if(_0x139568){_0x518672[_0xbb6b('0x4f')]['IntervalId']=_0x139568['id'];return db[_0xbb6b('0x31')][_0xbb6b('0x4e')](_0x518672['body']);}})[_0xbb6b('0x28')](respondWithResult(_0x1e9233,null))[_0xbb6b('0x4d')](handleError(_0x1e9233,null));};exports[_0xbb6b('0x58')]=function(_0x120d62,_0x50741e,_0x99bc8){var _0x52362f={};var _0x94120c={};var _0x472d3a;var _0x2a5590;return db['Interval'][_0xbb6b('0x59')]({'where':{'id':_0x120d62[_0xbb6b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x50741e,null))[_0xbb6b('0x28')](function(_0x29ee37){if(_0x29ee37){_0x472d3a=_0x29ee37;_0x94120c[_0xbb6b('0x34')]=_[_0xbb6b('0x36')](db[_0xbb6b('0x31')][_0xbb6b('0x4b')]);_0x94120c[_0xbb6b('0x35')]=_[_0xbb6b('0x36')](_0x120d62[_0xbb6b('0x35')]);_0x94120c[_0xbb6b('0x3f')]=_[_0xbb6b('0x37')](_0x94120c['model'],_0x94120c[_0xbb6b('0x35')]);_0x52362f[_0xbb6b('0x38')]=_[_0xbb6b('0x37')](_0x94120c['model'],qs['fields'](_0x120d62[_0xbb6b('0x35')][_0xbb6b('0x39')]));_0x52362f[_0xbb6b('0x38')]=_0x52362f[_0xbb6b('0x38')][_0xbb6b('0x3a')]?_0x52362f[_0xbb6b('0x38')]:_0x94120c[_0xbb6b('0x34')];_0x52362f['order']=qs['sort'](_0x120d62[_0xbb6b('0x35')][_0xbb6b('0x3d')]);_0x52362f[_0xbb6b('0x3e')]=qs[_0xbb6b('0x3f')](_[_0xbb6b('0x40')](_0x120d62[_0xbb6b('0x35')],_0x94120c['filters']));if(_0x120d62[_0xbb6b('0x35')][_0xbb6b('0x43')]){_0x52362f[_0xbb6b('0x3e')]=_[_0xbb6b('0x41')](_0x52362f[_0xbb6b('0x3e')],{'$or':_[_0xbb6b('0x30')](_0x52362f[_0xbb6b('0x38')],function(_0x4012cd){var _0x203e99={};_0x203e99[_0x4012cd]={'$like':'%'+_0x120d62[_0xbb6b('0x35')]['filter']+'%'};return _0x203e99;})});}_0x52362f=_[_0xbb6b('0x41')]({},_0x52362f,_0x120d62[_0xbb6b('0x44')]);return _0x472d3a[_0xbb6b('0x58')](_0x52362f);}})[_0xbb6b('0x28')](function(_0x2a90ba){if(_0x2a90ba){_0x2a5590=_0x2a90ba[_0xbb6b('0x3a')];if(!_0x120d62[_0xbb6b('0x35')]['hasOwnProperty'](_0xbb6b('0x5a'))){_0x52362f['limit']=qs[_0xbb6b('0x22')](_0x120d62['query']['limit']);_0x52362f[_0xbb6b('0x20')]=qs[_0xbb6b('0x20')](_0x120d62[_0xbb6b('0x35')][_0xbb6b('0x20')]);}return _0x472d3a[_0xbb6b('0x58')](_0x52362f);}})[_0xbb6b('0x28')](function(_0x1ba2e6){if(_0x1ba2e6){return _0x1ba2e6?{'count':_0x2a5590,'rows':_0x1ba2e6}:null;}})[_0xbb6b('0x28')](respondWithResult(_0x50741e,null))[_0xbb6b('0x4d')](handleError(_0x50741e,null));};exports['addIntervals']=function(_0x491bfc,_0xa9178d,_0x2371ad){return db[_0xbb6b('0x31')][_0xbb6b('0x59')]({'where':{'id':_0x491bfc['params']['id']}})[_0xbb6b('0x28')](handleEntityNotFound(_0xa9178d,null))[_0xbb6b('0x28')](function(_0x47f1b2){if(_0x47f1b2){return db[_0xbb6b('0x5b')][_0xbb6b('0x5c')](function(_0x1c3ee5){return db[_0xbb6b('0x31')][_0xbb6b('0x29')]({'where':{'IntervalId':_0x491bfc[_0xbb6b('0x4a')]['id']},'transaction':_0x1c3ee5})[_0xbb6b('0x28')](function(_0x110618){var _0x2e2113=_[_0xbb6b('0x30')](_0x491bfc[_0xbb6b('0x4f')],function(_0x587274){delete _0x587274['id'];_0x587274['IntervalId']=_0x491bfc[_0xbb6b('0x4a')]['id'];return _0x587274;});return db[_0xbb6b('0x31')]['bulkCreate'](_0x2e2113,{'transaction':_0x1c3ee5});});})[_0xbb6b('0x28')](function(){return db[_0xbb6b('0x31')]['findAll']({'where':{'IntervalId':_0x491bfc[_0xbb6b('0x4a')]['id']}});});}})[_0xbb6b('0x28')](respondWithResult(_0xa9178d,null))[_0xbb6b('0x4d')](handleError(_0xa9178d,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index aa9290b..aed4536 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 _0x03cb=['./interval.attributes','../../components/extensions/rewrite','iftime','exports','tools_intervals','rewrite','interval','string','getIntervals','then','reduce'];(function(_0x1f9b23,_0x4fec1f){var _0x39a610=function(_0x3aaaa9){while(--_0x3aaaa9){_0x1f9b23['push'](_0x1f9b23['shift']());}};_0x39a610(++_0x4fec1f);}(_0x03cb,0xf2));var _0xb03c=function(_0x20a887,_0x3570f2){_0x20a887=_0x20a887-0x0;var _0x34217e=_0x03cb[_0x20a887];return _0x34217e;};'use strict';var attributes=require(_0xb03c('0x0'));var extensions=require(_0xb03c('0x1'));var iftime=require('../../utils/iftime')[_0xb03c('0x2')];module[_0xb03c('0x3')]=function(_0x58c30d){return _0x58c30d['define']('Interval',attributes,{'tableName':_0xb03c('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xb3787e){extensions['rewrite'](_0x58c30d,_0xb3787e);},'afterBulkCreate':function(_0x308346,_0x36b237,_0x268cdf){_0x268cdf();extensions[_0xb03c('0x5')](_0x58c30d,_0x308346[0x0]);},'afterUpdate':function(_0x7cb552){extensions['rewrite'](_0x58c30d,_0x7cb552);},'afterDestroy':function(_0x49adbf){extensions[_0xb03c('0x5')](_0x58c30d,_0x49adbf);}},'instanceMethods':{'ifTime':function(_0x155d40=undefined,_0x2475ca=new Date()){if(typeof this[_0xb03c('0x6')]===_0xb03c('0x7')){return iftime(this['interval'],_0x155d40,_0x2475ca);}else{return this[_0xb03c('0x8')]()[_0xb03c('0x9')](function(_0x581508){return Promise['all'](_0x581508['map'](function(_0x40e346){return _0x40e346['ifTime'](_0x155d40,_0x2475ca);}));})['then'](function(_0x46f370){return _0x46f370[_0xb03c('0xa')](function(_0x49353d,_0x52a03f){return _0x49353d||_0x52a03f;},![]);});}}}});}; \ No newline at end of file +var _0x79f0=['getIntervals','then','all','map','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','exports','Interval','tools_intervals','rewrite','interval'];(function(_0x7c9e8b,_0x5ca217){var _0x5525b4=function(_0x470c72){while(--_0x470c72){_0x7c9e8b['push'](_0x7c9e8b['shift']());}};_0x5525b4(++_0x5ca217);}(_0x79f0,0x156));var _0x079f=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x79f0[_0x4e6ae6];return _0x23c108;};'use strict';var attributes=require(_0x079f('0x0'));var extensions=require(_0x079f('0x1'));var iftime=require(_0x079f('0x2'))['iftime'];module[_0x079f('0x3')]=function(_0x2880d2){return _0x2880d2['define'](_0x079f('0x4'),attributes,{'tableName':_0x079f('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4e0513){extensions[_0x079f('0x6')](_0x2880d2,_0x4e0513);},'afterBulkCreate':function(_0x13b440,_0x46462f,_0x1a1a35){_0x1a1a35();extensions[_0x079f('0x6')](_0x2880d2,_0x13b440[0x0]);},'afterUpdate':function(_0x2e19bd){extensions[_0x079f('0x6')](_0x2880d2,_0x2e19bd);},'afterDestroy':function(_0x38d6ed){extensions[_0x079f('0x6')](_0x2880d2,_0x38d6ed);}},'instanceMethods':{'ifTime':function(_0x3019de=undefined,_0x4d3ab4=new Date()){if(typeof this[_0x079f('0x7')]==='string'){return iftime(this[_0x079f('0x7')],_0x3019de,_0x4d3ab4);}else{return this[_0x079f('0x8')]()[_0x079f('0x9')](function(_0x158699){return Promise[_0x079f('0xa')](_0x158699[_0x079f('0xb')](function(_0x24980a){return _0x24980a[_0x079f('0xc')](_0x3019de,_0x4d3ab4);}));})['then'](function(_0x34df80){return _0x34df80[_0x079f('0xd')](function(_0x4297f7,_0x299191){return _0x4297f7||_0x299191;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 1907dd1..3b0d4a1 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 _0x2911=['all','reduce','name','join','findById','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','ifTime','IntervalIftime','intervals','string','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','util','../../mysqldb','../../utils/iftime','iftime','rpc','GetInterval','findAll','options','raw','where','attributes','limit','map','include','model','then','info','error','message','ShowInterval','Interval','find','debug','stringify','catch'];(function(_0x766a5d,_0xb9ef6b){var _0x3f1568=function(_0x4d466a){while(--_0x4d466a){_0x766a5d['push'](_0x766a5d['shift']());}};_0x3f1568(++_0xb9ef6b);}(_0x2911,0x1e2));var _0x1291=function(_0x272cb2,_0x40f4b4){_0x272cb2=_0x272cb2-0x0;var _0x4f4acb=_0x2911[_0x272cb2];return _0x4f4acb;};'use strict';var _=require('lodash');var util=require(_0x1291('0x0'));var db=require(_0x1291('0x1'))['db'];var iftime=require(_0x1291('0x2'))[_0x1291('0x3')];var logger=require('../../config/logger')(_0x1291('0x4'));exports[_0x1291('0x5')]=function(_0x378d01){var _0x3b45d1=this;return new Promise(function(_0x32a669,_0x8641cc){return db['Interval'][_0x1291('0x6')]({'raw':_0x378d01[_0x1291('0x7')]?_0x378d01[_0x1291('0x7')][_0x1291('0x8')]===undefined?!![]:![]:!![],'where':_0x378d01[_0x1291('0x7')]?_0x378d01[_0x1291('0x7')][_0x1291('0x9')]||null:null,'attributes':_0x378d01[_0x1291('0x7')]?_0x378d01[_0x1291('0x7')][_0x1291('0xa')]||null:null,'limit':_0x378d01[_0x1291('0x7')]?_0x378d01[_0x1291('0x7')][_0x1291('0xb')]||null:null,'include':_0x378d01[_0x1291('0x7')]?_0x378d01[_0x1291('0x7')]['include']?_[_0x1291('0xc')](_0x378d01[_0x1291('0x7')][_0x1291('0xd')],function(_0x55aaa9){return{'model':db[_0x55aaa9[_0x1291('0xe')]],'as':_0x55aaa9['as'],'attributes':_0x55aaa9[_0x1291('0xa')],'include':_0x55aaa9[_0x1291('0xd')]?_[_0x1291('0xc')](_0x55aaa9[_0x1291('0xd')],function(_0x17d43d){return{'model':db[_0x17d43d[_0x1291('0xe')]],'as':_0x17d43d['as'],'attributes':_0x17d43d[_0x1291('0xa')],'include':_0x17d43d[_0x1291('0xd')]?_['map'](_0x17d43d[_0x1291('0xd')],function(_0x365001){return{'model':db[_0x365001[_0x1291('0xe')]],'as':_0x365001['as'],'attributes':_0x365001[_0x1291('0xa')]};}):[]};}):[]};}):[]:[]})[_0x1291('0xf')](function(_0x768d2e){logger[_0x1291('0x10')](_0x1291('0x5'),_0x378d01);logger['debug'](_0x1291('0x5'),_0x378d01,JSON['stringify'](_0x768d2e));_0x32a669(_0x768d2e);})['catch'](function(_0x15da41){logger[_0x1291('0x11')](_0x1291('0x5'),_0x15da41[_0x1291('0x12')],_0x378d01);_0x8641cc(_0x3b45d1[_0x1291('0x11')](0x1f4,_0x15da41[_0x1291('0x12')]));});});};exports[_0x1291('0x13')]=function(_0x25b66b){var _0x3c061f=this;return new Promise(function(_0x2833b9,_0x36b46a){return db[_0x1291('0x14')][_0x1291('0x15')]({'raw':_0x25b66b['options']?_0x25b66b['options'][_0x1291('0x8')]===undefined?!![]:![]:!![],'where':_0x25b66b[_0x1291('0x7')]?_0x25b66b[_0x1291('0x7')]['where']||null:null,'attributes':_0x25b66b[_0x1291('0x7')]?_0x25b66b[_0x1291('0x7')]['attributes']||null:null,'include':_0x25b66b[_0x1291('0x7')]?_0x25b66b[_0x1291('0x7')]['include']?_[_0x1291('0xc')](_0x25b66b['options']['include'],function(_0x305e61){return{'model':db[_0x305e61[_0x1291('0xe')]],'as':_0x305e61['as'],'attributes':_0x305e61['attributes'],'include':_0x305e61[_0x1291('0xd')]?_['map'](_0x305e61[_0x1291('0xd')],function(_0x198785){return{'model':db[_0x198785[_0x1291('0xe')]],'as':_0x198785['as'],'attributes':_0x198785[_0x1291('0xa')],'include':_0x198785[_0x1291('0xd')]?_[_0x1291('0xc')](_0x198785[_0x1291('0xd')],function(_0x344461){return{'model':db[_0x344461['model']],'as':_0x344461['as'],'attributes':_0x344461[_0x1291('0xa')]};}):[]};}):[]};}):[]:[]})[_0x1291('0xf')](function(_0x2b0839){logger[_0x1291('0x10')](_0x1291('0x13'),_0x25b66b);logger[_0x1291('0x16')]('ShowInterval',_0x25b66b,JSON[_0x1291('0x17')](_0x2b0839));_0x2833b9(_0x2b0839);})[_0x1291('0x18')](function(_0x1606a1){logger['error'](_0x1291('0x13'),_0x1606a1[_0x1291('0x12')],_0x25b66b);_0x36b46a(_0x3c061f[_0x1291('0x11')](0x1f4,_0x1606a1[_0x1291('0x12')]));});});};function checkArrayOfIntervals(_0x1946b1,_0x958e36){var _0x3ad43f=[];return db[_0x1291('0x14')]['findAll']({'where':{'id':_0x1946b1}})[_0x1291('0xf')](function(_0x41f17c){_0x3ad43f=_0x41f17c;return Promise[_0x1291('0x19')](_0x3ad43f['map'](function(_0x5570ed){return _0x5570ed['ifTime'](_0x958e36);}));})[_0x1291('0xf')](function(_0x1c3afc){var _0x2e47f1=_0x1c3afc[_0x1291('0x1a')](function(_0x1b8425,_0x5b9ce9){return _0x1b8425||_0x5b9ce9;},![]);logger['info'](util['format']('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x3ad43f[_0x1291('0xc')](function(_0x3cade4){return _0x3cade4[_0x1291('0x1b')];})[_0x1291('0x1c')](',\x20'),_0x3ad43f['map'](function(_0xa10813){return _0xa10813['id'];})[_0x1291('0x1c')](',\x20')));return _0x2e47f1;});}function checkSingleInterval(_0x4396ea,_0x5dd840){return db['Interval'][_0x1291('0x1d')](_0x4396ea)[_0x1291('0xf')](function(_0x37c821){if(_0x37c821){logger['info'](util[_0x1291('0x1e')](_0x1291('0x1f'),_0x37c821['name'],_0x37c821['id']));return _0x37c821[_0x1291('0x20')](_0x5dd840);}});}exports[_0x1291('0x21')]=function(_0x519b85){var _0x340a62=_0x519b85['intervalIds'];var _0x1def6b=Array['isArray'](_0x519b85[_0x1291('0x22')])?_0x519b85['intervals']:typeof _0x519b85[_0x1291('0x22')]===_0x1291('0x23')?[_0x519b85[_0x1291('0x22')]]:[];var _0x553448=_0x519b85['timezone']||undefined;var _0x3cb47e=![];if(_0x1def6b[_0x1291('0x24')]){logger[_0x1291('0x10')](util['format'](_0x1291('0x25'),_0x1def6b[_0x1291('0x1c')](';\x20')));}if(_0x553448){logger[_0x1291('0x10')](util[_0x1291('0x1e')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x553448));}logger[_0x1291('0x16')](_0x1291('0x26'),_0x3cb47e);logger['silly'](_0x1291('0x21'),_0x519b85);return Promise['resolve']()[_0x1291('0xf')](function(){if(Array['isArray'](_0x340a62)){return checkArrayOfIntervals(_0x340a62,_0x553448);}else if(_0x340a62){return checkSingleInterval(_0x340a62,_0x553448);}})['then'](function(_0x5260b3){var _0x167dbe=_0x1def6b[_0x1291('0x1a')](function(_0x39da17,_0x772f75){return _0x39da17||iftime(_0x772f75,_0x553448);},![]);_0x3cb47e=_0x5260b3||_0x167dbe;return _0x3cb47e;})['catch'](function(_0x232da8){logger[_0x1291('0x11')]('IntervalIftime',_0x519b85,_0x232da8);throw this[_0x1291('0x11')](0x1f4,_0x232da8[_0x1291('0x12')]);});}; \ No newline at end of file +var _0xbd35=['raw','limit','include','map','model','attributes','then','info','debug','catch','error','message','ShowInterval','find','stringify','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','IntervalIftime','resolve','util','../../mysqldb','../../utils/iftime','../../config/logger','GetInterval','Interval','findAll','options'];(function(_0xdaa456,_0x3dbbe5){var _0x288a4a=function(_0x4e4d5d){while(--_0x4e4d5d){_0xdaa456['push'](_0xdaa456['shift']());}};_0x288a4a(++_0x3dbbe5);}(_0xbd35,0x1a6));var _0x5bd3=function(_0x3cbdd0,_0x310e2c){_0x3cbdd0=_0x3cbdd0-0x0;var _0x5c2204=_0xbd35[_0x3cbdd0];return _0x5c2204;};'use strict';var _=require('lodash');var util=require(_0x5bd3('0x0'));var db=require(_0x5bd3('0x1'))['db'];var iftime=require(_0x5bd3('0x2'))['iftime'];var logger=require(_0x5bd3('0x3'))('rpc');exports[_0x5bd3('0x4')]=function(_0x748d61){var _0xb3da75=this;return new Promise(function(_0x5ad23b,_0x382d29){return db[_0x5bd3('0x5')][_0x5bd3('0x6')]({'raw':_0x748d61[_0x5bd3('0x7')]?_0x748d61[_0x5bd3('0x7')][_0x5bd3('0x8')]===undefined?!![]:![]:!![],'where':_0x748d61[_0x5bd3('0x7')]?_0x748d61[_0x5bd3('0x7')]['where']||null:null,'attributes':_0x748d61[_0x5bd3('0x7')]?_0x748d61['options']['attributes']||null:null,'limit':_0x748d61[_0x5bd3('0x7')]?_0x748d61[_0x5bd3('0x7')][_0x5bd3('0x9')]||null:null,'include':_0x748d61[_0x5bd3('0x7')]?_0x748d61[_0x5bd3('0x7')][_0x5bd3('0xa')]?_[_0x5bd3('0xb')](_0x748d61[_0x5bd3('0x7')][_0x5bd3('0xa')],function(_0x14f31b){return{'model':db[_0x14f31b[_0x5bd3('0xc')]],'as':_0x14f31b['as'],'attributes':_0x14f31b[_0x5bd3('0xd')],'include':_0x14f31b['include']?_[_0x5bd3('0xb')](_0x14f31b[_0x5bd3('0xa')],function(_0x29a670){return{'model':db[_0x29a670['model']],'as':_0x29a670['as'],'attributes':_0x29a670[_0x5bd3('0xd')],'include':_0x29a670[_0x5bd3('0xa')]?_[_0x5bd3('0xb')](_0x29a670['include'],function(_0xc56f48){return{'model':db[_0xc56f48['model']],'as':_0xc56f48['as'],'attributes':_0xc56f48['attributes']};}):[]};}):[]};}):[]:[]})[_0x5bd3('0xe')](function(_0xee1f){logger[_0x5bd3('0xf')](_0x5bd3('0x4'),_0x748d61);logger[_0x5bd3('0x10')](_0x5bd3('0x4'),_0x748d61,JSON['stringify'](_0xee1f));_0x5ad23b(_0xee1f);})[_0x5bd3('0x11')](function(_0x4b7d78){logger[_0x5bd3('0x12')]('GetInterval',_0x4b7d78[_0x5bd3('0x13')],_0x748d61);_0x382d29(_0xb3da75[_0x5bd3('0x12')](0x1f4,_0x4b7d78[_0x5bd3('0x13')]));});});};exports[_0x5bd3('0x14')]=function(_0x4d1c04){var _0x5d66c5=this;return new Promise(function(_0x406fc9,_0x54c890){return db[_0x5bd3('0x5')][_0x5bd3('0x15')]({'raw':_0x4d1c04[_0x5bd3('0x7')]?_0x4d1c04[_0x5bd3('0x7')][_0x5bd3('0x8')]===undefined?!![]:![]:!![],'where':_0x4d1c04['options']?_0x4d1c04[_0x5bd3('0x7')]['where']||null:null,'attributes':_0x4d1c04[_0x5bd3('0x7')]?_0x4d1c04[_0x5bd3('0x7')]['attributes']||null:null,'include':_0x4d1c04[_0x5bd3('0x7')]?_0x4d1c04[_0x5bd3('0x7')][_0x5bd3('0xa')]?_[_0x5bd3('0xb')](_0x4d1c04[_0x5bd3('0x7')][_0x5bd3('0xa')],function(_0x1772a0){return{'model':db[_0x1772a0['model']],'as':_0x1772a0['as'],'attributes':_0x1772a0[_0x5bd3('0xd')],'include':_0x1772a0[_0x5bd3('0xa')]?_[_0x5bd3('0xb')](_0x1772a0['include'],function(_0x347400){return{'model':db[_0x347400['model']],'as':_0x347400['as'],'attributes':_0x347400[_0x5bd3('0xd')],'include':_0x347400['include']?_[_0x5bd3('0xb')](_0x347400[_0x5bd3('0xa')],function(_0xd0ca9d){return{'model':db[_0xd0ca9d[_0x5bd3('0xc')]],'as':_0xd0ca9d['as'],'attributes':_0xd0ca9d[_0x5bd3('0xd')]};}):[]};}):[]};}):[]:[]})[_0x5bd3('0xe')](function(_0x880d18){logger[_0x5bd3('0xf')](_0x5bd3('0x14'),_0x4d1c04);logger[_0x5bd3('0x10')]('ShowInterval',_0x4d1c04,JSON[_0x5bd3('0x16')](_0x880d18));_0x406fc9(_0x880d18);})[_0x5bd3('0x11')](function(_0xb2c380){logger[_0x5bd3('0x12')](_0x5bd3('0x14'),_0xb2c380['message'],_0x4d1c04);_0x54c890(_0x5d66c5[_0x5bd3('0x12')](0x1f4,_0xb2c380[_0x5bd3('0x13')]));});});};function checkArrayOfIntervals(_0x1635ec,_0x133964){var _0x1a60ea=[];return db[_0x5bd3('0x5')][_0x5bd3('0x6')]({'where':{'id':_0x1635ec}})[_0x5bd3('0xe')](function(_0x44e25e){_0x1a60ea=_0x44e25e;return Promise[_0x5bd3('0x17')](_0x1a60ea[_0x5bd3('0xb')](function(_0x21663c){return _0x21663c[_0x5bd3('0x18')](_0x133964);}));})['then'](function(_0x2140e8){var _0x197742=_0x2140e8[_0x5bd3('0x19')](function(_0x327a84,_0xc63c9){return _0x327a84||_0xc63c9;},![]);logger['info'](util[_0x5bd3('0x1a')](_0x5bd3('0x1b'),_0x1a60ea[_0x5bd3('0xb')](function(_0x23836d){return _0x23836d[_0x5bd3('0x1c')];})[_0x5bd3('0x1d')](',\x20'),_0x1a60ea[_0x5bd3('0xb')](function(_0x380116){return _0x380116['id'];})[_0x5bd3('0x1d')](',\x20')));return _0x197742;});}function checkSingleInterval(_0x509193,_0x4894e0){return db['Interval'][_0x5bd3('0x1e')](_0x509193)['then'](function(_0x3b0940){if(_0x3b0940){logger[_0x5bd3('0xf')](util['format'](_0x5bd3('0x1f'),_0x3b0940['name'],_0x3b0940['id']));return _0x3b0940[_0x5bd3('0x18')](_0x4894e0);}});}exports['IntervalIftime']=function(_0x2640d6){var _0x5ba096=_0x2640d6[_0x5bd3('0x20')];var _0x298a5d=Array[_0x5bd3('0x21')](_0x2640d6['intervals'])?_0x2640d6[_0x5bd3('0x22')]:typeof _0x2640d6[_0x5bd3('0x22')]===_0x5bd3('0x23')?[_0x2640d6['intervals']]:[];var _0x278472=_0x2640d6[_0x5bd3('0x24')]||undefined;var _0x17c7df=![];if(_0x298a5d[_0x5bd3('0x25')]){logger['info'](util['format'](_0x5bd3('0x26'),_0x298a5d[_0x5bd3('0x1d')](';\x20')));}if(_0x278472){logger[_0x5bd3('0xf')](util[_0x5bd3('0x1a')](_0x5bd3('0x27'),_0x278472));}logger[_0x5bd3('0x10')](_0x5bd3('0x28'),_0x17c7df);logger['silly'](_0x5bd3('0x29'),_0x2640d6);return Promise[_0x5bd3('0x2a')]()[_0x5bd3('0xe')](function(){if(Array[_0x5bd3('0x21')](_0x5ba096)){return checkArrayOfIntervals(_0x5ba096,_0x278472);}else if(_0x5ba096){return checkSingleInterval(_0x5ba096,_0x278472);}})['then'](function(_0x422d5d){var _0xe8122e=_0x298a5d['reduce'](function(_0x434465,_0x243357){return _0x434465||iftime(_0x243357,_0x278472);},![]);_0x17c7df=_0x422d5d||_0xe8122e;return _0x17c7df;})[_0x5bd3('0x11')](function(_0x53ef49){logger[_0x5bd3('0x12')](_0x5bd3('0x29'),_0x2640d6,_0x53ef49);throw this[_0x5bd3('0x12')](0x1f4,_0x53ef49['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 6fa2df5..142db51 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 _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x9a29ea,_0x5b8b29){_0x9a29ea=_0x9a29ea-0x0;var _0x11f261=_0x0b0e[_0x9a29ea];return _0x11f261;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file +var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x26d9b4,_0x62abe){var _0x3a5ce0=function(_0x5552ff){while(--_0x5552ff){_0x26d9b4['push'](_0x26d9b4['shift']());}};_0x3a5ce0(++_0x62abe);}(_0xadb5,0xad));var _0x5adb=function(_0x972473,_0x13d588){_0x972473=_0x972473-0x0;var _0x1871c5=_0xadb5[_0x972473];return _0x1871c5;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 2617ece..9303263 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 _0xfcd8=['../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','Basic\x20','request','utf8','data','status','statusCode','json','error','write','end','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xfcd8,0x156));var _0x8fcd=function(_0x271c67,_0x999308){_0x271c67=_0x271c67-0x0;var _0x127789=_0xfcd8[_0x271c67];return _0x127789;};'use strict';var BPromise=require(_0x8fcd('0x0'));var https=require(_0x8fcd('0x1'));var logger=require(_0x8fcd('0x2'))(_0x8fcd('0x3'));var USERNAME=_0x8fcd('0x4');var PASSWORD=_0x8fcd('0x5');function openIssue(_0xf22c99,_0x2bd653){var _0x14f263={'fields':{'project':{'key':_0xf22c99[_0x8fcd('0x6')]||_0x8fcd('0x7')},'summary':(_0xf22c99[_0x8fcd('0x8')]||_0x8fcd('0x9'))+'\x20from\x20'+_0xf22c99['ip'],'description':_0xf22c99[_0x8fcd('0xa')]||JSON[_0x8fcd('0xb')](_0xf22c99),'issuetype':{'name':_0xf22c99['issuetype']||_0x8fcd('0xc')}}};_0x14f263[_0x8fcd('0xd')][_0x8fcd('0xe')]=_0xf22c99[_0x8fcd('0xf')];_0x14f263[_0x8fcd('0xd')][_0x8fcd('0x10')]=_0xf22c99['oldToken'];_0x14f263[_0x8fcd('0xd')][_0x8fcd('0x11')]=_0xf22c99[_0x8fcd('0x12')];_0x14f263[_0x8fcd('0xd')]['customfield_11503']=_0xf22c99[_0x8fcd('0x13')];_0x14f263[_0x8fcd('0xd')][_0x8fcd('0x14')]=_0xf22c99[_0x8fcd('0x15')];_0x14f263[_0x8fcd('0xd')][_0x8fcd('0x16')]=_0xf22c99['ip'];var _0x219baf={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x8fcd('0x17'),'method':_0x8fcd('0x18'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x8fcd('0x19')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x436d9d=JSON[_0x8fcd('0xb')](_0x14f263);var _0x344138=https[_0x8fcd('0x1a')](_0x219baf,function(_0x1c648d){_0x1c648d['setEncoding'](_0x8fcd('0x1b'));var _0x19b4dc='';_0x1c648d['on'](_0x8fcd('0x1c'),function(_0x5ed0df){_0x19b4dc+=_0x5ed0df;});_0x1c648d['on']('end',function(){if(_0x2bd653){return _0x2bd653[_0x8fcd('0x1d')](_0x1c648d[_0x8fcd('0x1e')])[_0x8fcd('0x1f')](JSON['parse'](_0x19b4dc));}});});_0x344138['on'](_0x8fcd('0x20'),function(_0x403894){if(_0x2bd653){return _0x2bd653['status'](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x344138[_0x8fcd('0x21')](_0x436d9d);_0x344138[_0x8fcd('0x22')]();}exports[_0x8fcd('0x23')]=openIssue;exports[_0x8fcd('0x24')]=function(_0x3edf0d,_0x5a2276){_0x3edf0d[_0x8fcd('0x25')]['ip']=_0x3edf0d[_0x8fcd('0x26')][_0x8fcd('0x27')]||_0x3edf0d[_0x8fcd('0x28')][_0x8fcd('0x29')]||_0x3edf0d[_0x8fcd('0x2a')][_0x8fcd('0x29')]||_0x3edf0d['connection'][_0x8fcd('0x2a')][_0x8fcd('0x29')];return openIssue(_0x3edf0d[_0x8fcd('0x25')],_0x5a2276);}; \ No newline at end of file +var _0xde1a=['email','customfield_11501','oldToken','fields','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','Basic\x20','toString','base64','request','data','end','status','parse','error','json','api.jira','openIssue','headers','remoteAddress','connection','socket','body','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','stringify','Bug'];(function(_0x4b124f,_0x438df5){var _0x29c4e0=function(_0x3cdb40){while(--_0x3cdb40){_0x4b124f['push'](_0x4b124f['shift']());}};_0x29c4e0(++_0x438df5);}(_0xde1a,0x1e0));var _0xade1=function(_0x3dde0e,_0x2d9d22){_0x3dde0e=_0x3dde0e-0x0;var _0x24fd5a=_0xde1a[_0x3dde0e];return _0x24fd5a;};'use strict';var BPromise=require(_0xade1('0x0'));var https=require(_0xade1('0x1'));var logger=require(_0xade1('0x2'))(_0xade1('0x3'));var USERNAME=_0xade1('0x4');var PASSWORD=_0xade1('0x5');function openIssue(_0x1a1522,_0x413440){var _0xb6d329={'fields':{'project':{'key':_0x1a1522[_0xade1('0x6')]||_0xade1('0x7')},'summary':(_0x1a1522[_0xade1('0x8')]||_0xade1('0x9'))+'\x20from\x20'+_0x1a1522['ip'],'description':_0x1a1522['description']||JSON[_0xade1('0xa')](_0x1a1522),'issuetype':{'name':_0x1a1522['issuetype']||_0xade1('0xb')}}};_0xb6d329['fields']['customfield_11500']=_0x1a1522[_0xade1('0xc')];_0xb6d329['fields'][_0xade1('0xd')]=_0x1a1522[_0xade1('0xe')];_0xb6d329[_0xade1('0xf')][_0xade1('0x10')]=_0x1a1522[_0xade1('0x11')];_0xb6d329['fields']['customfield_11503']=_0x1a1522[_0xade1('0x12')];_0xb6d329[_0xade1('0xf')][_0xade1('0x13')]=_0x1a1522[_0xade1('0x14')];_0xb6d329[_0xade1('0xf')][_0xade1('0x15')]=_0x1a1522['ip'];var _0x2590ac={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xade1('0x16'),'method':_0xade1('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xade1('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xade1('0x19')](_0xade1('0x1a'))}};var _0x202cf3=JSON['stringify'](_0xb6d329);var _0x1d5004=https[_0xade1('0x1b')](_0x2590ac,function(_0x1cda98){_0x1cda98['setEncoding']('utf8');var _0x28f118='';_0x1cda98['on'](_0xade1('0x1c'),function(_0x122ece){_0x28f118+=_0x122ece;});_0x1cda98['on'](_0xade1('0x1d'),function(){if(_0x413440){return _0x413440[_0xade1('0x1e')](_0x1cda98['statusCode'])['json'](JSON[_0xade1('0x1f')](_0x28f118));}});});_0x1d5004['on'](_0xade1('0x20'),function(_0x590219){if(_0x413440){return _0x413440[_0xade1('0x1e')](0x1f4)[_0xade1('0x21')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xade1('0x22')}]});}});_0x1d5004['write'](_0x202cf3);_0x1d5004[_0xade1('0x1d')]();}exports[_0xade1('0x23')]=openIssue;exports['send']=function(_0x3dd1dd,_0x3eb439){_0x3dd1dd['body']['ip']=_0x3dd1dd[_0xade1('0x24')]['x-forwarded-for']||_0x3dd1dd['connection'][_0xade1('0x25')]||_0x3dd1dd['socket'][_0xade1('0x25')]||_0x3dd1dd[_0xade1('0x26')][_0xade1('0x27')]['remoteAddress'];return openIssue(_0x3dd1dd[_0xade1('0x28')],_0x3eb439);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index bdaba99..a244c6e 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 _0x22fb=['./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x187357,_0x37862f){var _0x5631ae=function(_0x42ef8d){while(--_0x42ef8d){_0x187357['push'](_0x187357['shift']());}};_0x5631ae(++_0x37862f);}(_0x22fb,0x192));var _0xb22f=function(_0x1f8b77,_0x54d83b){_0x1f8b77=_0x1f8b77-0x0;var _0x169e04=_0x22fb[_0x1f8b77];return _0x169e04;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb22f('0x0'));var timeout=require('connect-timeout');var express=require(_0xb22f('0x1'));var router=express[_0xb22f('0x2')]();var fs_extra=require(_0xb22f('0x3'));var auth=require(_0xb22f('0x4'));var interaction=require(_0xb22f('0x5'));var config=require('../../config/environment');var controller=require(_0xb22f('0x6'));router[_0xb22f('0x7')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0x9')]);router[_0xb22f('0x7')](_0xb22f('0xa'),auth['isAuthenticated'](),controller[_0xb22f('0xb')]);router[_0xb22f('0x7')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xd')]);router[_0xb22f('0xe')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0xf')]);router[_0xb22f('0x10')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller['update']);router['delete']('/:id',auth[_0xb22f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x91a7=['Router','../../components/auth/service','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout'];(function(_0x5d5504,_0xc375cd){var _0x18e885=function(_0xd07da3){while(--_0xd07da3){_0x5d5504['push'](_0x5d5504['shift']());}};_0x18e885(++_0xc375cd);}(_0x91a7,0xe7));var _0x791a=function(_0x529100,_0x1bb499){_0x529100=_0x529100-0x0;var _0x13381b=_0x91a7[_0x529100];return _0x13381b;};'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['describe']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0xc')]('/',auth['isAuthenticated'](),controller[_0x791a('0xd')]);router[_0x791a('0xe')]('/:id',auth[_0x791a('0x9')](),controller[_0x791a('0xf')]);router[_0x791a('0x10')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 2fae676..8ffb78f 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7a54,0x106));var _0x47a5=function(_0x53c9c7,_0x1ca420){_0x53c9c7=_0x53c9c7-0x0;var _0x1d2ae2=_0x7a54[_0x53c9c7];return _0x1d2ae2;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7a54,0x106));var _0x47a5=function(_0x4aab96,_0x5e0d76){_0x4aab96=_0x4aab96-0x0;var _0x49fdbd=_0x7a54[_0x4aab96];return _0x49fdbd;};'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 33dcc06..adce586 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 _0x6363=['destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','error','stack','name','index','map','JscriptyAnswerReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6363,0x13a));var _0x3636=function(_0x52f66b,_0x35240e){_0x52f66b=_0x52f66b-0x0;var _0x53e3ff=_0x6363[_0x52f66b];return _0x53e3ff;};'use strict';var emlformat=require(_0x3636('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3636('0x1'));var jsonpatch=require(_0x3636('0x2'));var rp=require(_0x3636('0x3'));var moment=require(_0x3636('0x4'));var BPromise=require(_0x3636('0x5'));var Mustache=require(_0x3636('0x6'));var util=require(_0x3636('0x7'));var path=require(_0x3636('0x8'));var sox=require(_0x3636('0x9'));var csv=require(_0x3636('0xa'));var ejs=require(_0x3636('0xb'));var fs=require('fs');var fs_extra=require(_0x3636('0xc'));var _=require(_0x3636('0xd'));var squel=require(_0x3636('0xe'));var crypto=require('crypto');var jsforce=require(_0x3636('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3636('0xa'));var querystring=require(_0x3636('0x10'));var Papa=require(_0x3636('0x11'));var Redis=require(_0x3636('0x12'));var authService=require(_0x3636('0x13'));var qs=require(_0x3636('0x14'));var as=require(_0x3636('0x15'));var hardwareService=require(_0x3636('0x16'));var logger=require(_0x3636('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x3636('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3636('0x19'))['db'];function respondWithStatusCode(_0x41ddae,_0x62d6f9){_0x62d6f9=_0x62d6f9||0xcc;return function(_0x13ca35){if(_0x13ca35){return _0x41ddae[_0x3636('0x1a')](_0x62d6f9);}return _0x41ddae[_0x3636('0x1b')](_0x62d6f9)[_0x3636('0x1c')]();};}function respondWithResult(_0x12dfa9,_0x3295ab){_0x3295ab=_0x3295ab||0xc8;return function(_0x7b4b16){if(_0x7b4b16){return _0x12dfa9[_0x3636('0x1b')](_0x3295ab)[_0x3636('0x1d')](_0x7b4b16);}};}function respondWithFilteredResult(_0xcb2aa3,_0x3fc712){return function(_0x23cc34){if(_0x23cc34){var _0x3cbd0d=typeof _0x3fc712[_0x3636('0x1e')]==='undefined'&&typeof _0x3fc712[_0x3636('0x1f')]===_0x3636('0x20');var _0x4aa7fc=_0x23cc34[_0x3636('0x21')];var _0x5aa0ff=_0x3cbd0d?0x0:_0x3fc712['offset'];var _0xae6469=_0x3cbd0d?_0x23cc34[_0x3636('0x21')]:_0x3fc712[_0x3636('0x1e')]+_0x3fc712[_0x3636('0x1f')];var _0xe0e633;if(_0xae6469>=_0x4aa7fc){_0xae6469=_0x4aa7fc;_0xe0e633=0xc8;}else{_0xe0e633=0xce;}_0xcb2aa3[_0x3636('0x1b')](_0xe0e633);return _0xcb2aa3[_0x3636('0x22')](_0x3636('0x23'),_0x5aa0ff+'-'+_0xae6469+'/'+_0x4aa7fc)['json'](_0x23cc34);}return null;};}function patchUpdates(_0x48f598){return function(_0x316930){try{jsonpatch[_0x3636('0x24')](_0x316930,_0x48f598,!![]);}catch(_0x42b271){return BPromise['reject'](_0x42b271);}return _0x316930[_0x3636('0x25')]();};}function saveUpdates(_0xa46471,_0x15a0b3){return function(_0xe34cd9){if(_0xe34cd9){return _0xe34cd9[_0x3636('0x26')](_0xa46471)[_0x3636('0x27')](function(_0x4f5b0e){return _0x4f5b0e;});}return null;};}function removeEntity(_0x517fda,_0x368356){return function(_0x4ee098){if(_0x4ee098){return _0x4ee098['destroy']()[_0x3636('0x27')](function(){_0x517fda['status'](0xcc)[_0x3636('0x1c')]();});}};}function handleEntityNotFound(_0x4c24cf,_0x36f4c5){return function(_0x477c34){if(!_0x477c34){_0x4c24cf[_0x3636('0x1a')](0x194);}return _0x477c34;};}function handleError(_0x201ea1,_0x112b96){_0x112b96=_0x112b96||0x1f4;return function(_0x20ca8b){logger[_0x3636('0x28')](_0x20ca8b[_0x3636('0x29')]);if(_0x20ca8b[_0x3636('0x2a')]){delete _0x20ca8b[_0x3636('0x2a')];}_0x201ea1[_0x3636('0x1b')](_0x112b96)['send'](_0x20ca8b);};}exports[_0x3636('0x2b')]=function(_0x236f54,_0x2d644c){var _0x22b12f={},_0xd37c62={},_0x17e062={'count':0x0,'rows':[]};var _0x52ad91=_[_0x3636('0x2c')](db[_0x3636('0x2d')]['rawAttributes'],function(_0x8fffb0){return{'name':_0x8fffb0[_0x3636('0x2e')],'type':_0x8fffb0[_0x3636('0x2f')][_0x3636('0x30')]};});_0xd37c62[_0x3636('0x31')]=_['map'](_0x52ad91,_0x3636('0x2a'));_0xd37c62[_0x3636('0x32')]=_[_0x3636('0x33')](_0x236f54[_0x3636('0x32')]);_0xd37c62[_0x3636('0x34')]=_[_0x3636('0x35')](_0xd37c62[_0x3636('0x31')],_0xd37c62[_0x3636('0x32')]);_0x22b12f[_0x3636('0x36')]=_['intersection'](_0xd37c62['model'],qs[_0x3636('0x37')](_0x236f54['query']['fields']));_0x22b12f[_0x3636('0x36')]=_0x22b12f[_0x3636('0x36')][_0x3636('0x38')]?_0x22b12f['attributes']:_0xd37c62[_0x3636('0x31')];if(!_0x236f54[_0x3636('0x32')][_0x3636('0x39')](_0x3636('0x3a'))){_0x22b12f[_0x3636('0x1f')]=qs[_0x3636('0x1f')](_0x236f54[_0x3636('0x32')][_0x3636('0x1f')]);_0x22b12f[_0x3636('0x1e')]=qs[_0x3636('0x1e')](_0x236f54[_0x3636('0x32')][_0x3636('0x1e')]);}_0x22b12f[_0x3636('0x3b')]=qs['sort'](_0x236f54[_0x3636('0x32')][_0x3636('0x3c')]);_0x22b12f[_0x3636('0x3d')]=qs[_0x3636('0x34')](_['pick'](_0x236f54['query'],_0xd37c62[_0x3636('0x34')]),_0x52ad91);if(_0x236f54[_0x3636('0x32')][_0x3636('0x3e')]){_0x22b12f['where']=_[_0x3636('0x3f')](_0x22b12f[_0x3636('0x3d')],{'$or':_['map'](_0x52ad91,function(_0x58f03d){if(_0x58f03d[_0x3636('0x2f')]!=='VIRTUAL'){var _0x8c04cf={};_0x8c04cf[_0x58f03d[_0x3636('0x2a')]]={'$like':'%'+_0x236f54[_0x3636('0x32')][_0x3636('0x3e')]+'%'};return _0x8c04cf;}})});}_0x22b12f=_[_0x3636('0x3f')]({},_0x22b12f,_0x236f54[_0x3636('0x40')]);var _0x448397={'where':_0x22b12f[_0x3636('0x3d')]};return db[_0x3636('0x2d')]['count'](_0x448397)[_0x3636('0x27')](function(_0x44cb9c){_0x17e062[_0x3636('0x21')]=_0x44cb9c;if(_0x236f54[_0x3636('0x32')][_0x3636('0x41')]){_0x22b12f[_0x3636('0x42')]=[{'all':!![]}];}return db[_0x3636('0x2d')][_0x3636('0x43')](_0x22b12f);})[_0x3636('0x27')](function(_0x4df331){_0x17e062[_0x3636('0x44')]=_0x4df331;return _0x17e062;})[_0x3636('0x27')](respondWithFilteredResult(_0x2d644c,_0x22b12f))[_0x3636('0x45')](handleError(_0x2d644c,null));};exports[_0x3636('0x46')]=function(_0x9c59e0,_0x122cb2){var _0x201e2c={'raw':!![],'where':{'id':_0x9c59e0[_0x3636('0x47')]['id']}},_0x401281={};_0x401281[_0x3636('0x31')]=_[_0x3636('0x33')](db[_0x3636('0x2d')][_0x3636('0x48')]);_0x401281[_0x3636('0x32')]=_[_0x3636('0x33')](_0x9c59e0['query']);_0x401281[_0x3636('0x34')]=_[_0x3636('0x35')](_0x401281[_0x3636('0x31')],_0x401281[_0x3636('0x32')]);_0x201e2c[_0x3636('0x36')]=_[_0x3636('0x35')](_0x401281[_0x3636('0x31')],qs[_0x3636('0x37')](_0x9c59e0[_0x3636('0x32')][_0x3636('0x37')]));_0x201e2c[_0x3636('0x36')]=_0x201e2c[_0x3636('0x36')][_0x3636('0x38')]?_0x201e2c['attributes']:_0x401281['model'];if(_0x9c59e0['query'][_0x3636('0x41')]){_0x201e2c['include']=[{'all':!![]}];}_0x201e2c=_['merge']({},_0x201e2c,_0x9c59e0[_0x3636('0x40')]);return db[_0x3636('0x2d')][_0x3636('0x49')](_0x201e2c)['then'](handleEntityNotFound(_0x122cb2,null))[_0x3636('0x27')](respondWithResult(_0x122cb2,null))[_0x3636('0x45')](handleError(_0x122cb2,null));};exports[_0x3636('0x4a')]=function(_0x179410,_0x37a33e){return db[_0x3636('0x2d')][_0x3636('0x4a')](_0x179410[_0x3636('0x4b')],{})[_0x3636('0x27')](respondWithResult(_0x37a33e,0xc9))['catch'](handleError(_0x37a33e,null));};exports[_0x3636('0x26')]=function(_0x33c140,_0x16b65a){if(_0x33c140[_0x3636('0x4b')]['id']){delete _0x33c140[_0x3636('0x4b')]['id'];}return db[_0x3636('0x2d')]['find']({'where':{'id':_0x33c140[_0x3636('0x47')]['id']}})[_0x3636('0x27')](handleEntityNotFound(_0x16b65a,null))[_0x3636('0x27')](saveUpdates(_0x33c140[_0x3636('0x4b')],null))[_0x3636('0x27')](respondWithResult(_0x16b65a,null))['catch'](handleError(_0x16b65a,null));};exports[_0x3636('0x4c')]=function(_0x285ff1,_0xa61651){return db[_0x3636('0x2d')][_0x3636('0x49')]({'where':{'id':_0x285ff1['params']['id']}})[_0x3636('0x27')](handleEntityNotFound(_0xa61651,null))['then'](removeEntity(_0xa61651,null))['catch'](handleError(_0xa61651,null));};exports[_0x3636('0x4d')]=function(_0x1c1ec0,_0x2575ba){return db[_0x3636('0x2d')]['describe']()['then'](respondWithResult(_0x2575ba,null))[_0x3636('0x45')](handleError(_0x2575ba,null));}; \ No newline at end of file +var _0x8f9d=['describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','Content-Range','apply','save','update','then','destroy','stack','name','map','JscriptyAnswerReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','length','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','fields','includeAll','include','find','create','body'];(function(_0x22ac78,_0x4d9a24){var _0x166faf=function(_0x58d16e){while(--_0x58d16e){_0x22ac78['push'](_0x22ac78['shift']());}};_0x166faf(++_0x4d9a24);}(_0x8f9d,0x93));var _0xd8f9=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8f9d[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0xd8f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd8f9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd8f9('0x2'));var moment=require(_0xd8f9('0x3'));var BPromise=require(_0xd8f9('0x4'));var Mustache=require(_0xd8f9('0x5'));var util=require(_0xd8f9('0x6'));var path=require(_0xd8f9('0x7'));var sox=require(_0xd8f9('0x8'));var csv=require('to-csv');var ejs=require(_0xd8f9('0x9'));var fs=require('fs');var fs_extra=require(_0xd8f9('0xa'));var _=require(_0xd8f9('0xb'));var squel=require(_0xd8f9('0xc'));var crypto=require(_0xd8f9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd8f9('0xe'));var toCsv=require(_0xd8f9('0xf'));var querystring=require('querystring');var Papa=require(_0xd8f9('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd8f9('0x11'));var as=require(_0xd8f9('0x12'));var hardwareService=require(_0xd8f9('0x13'));var logger=require(_0xd8f9('0x14'))(_0xd8f9('0x15'));var utils=require(_0xd8f9('0x16'));var config=require(_0xd8f9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8f9('0x18'))['db'];function respondWithStatusCode(_0x56e0d6,_0x39aca0){_0x39aca0=_0x39aca0||0xcc;return function(_0x45aba0){if(_0x45aba0){return _0x56e0d6[_0xd8f9('0x19')](_0x39aca0);}return _0x56e0d6['status'](_0x39aca0)[_0xd8f9('0x1a')]();};}function respondWithResult(_0x3df6d2,_0x4cfebf){_0x4cfebf=_0x4cfebf||0xc8;return function(_0x223f10){if(_0x223f10){return _0x3df6d2['status'](_0x4cfebf)[_0xd8f9('0x1b')](_0x223f10);}};}function respondWithFilteredResult(_0x1525d6,_0x234901){return function(_0x10369c){if(_0x10369c){var _0x3a3a41=typeof _0x234901[_0xd8f9('0x1c')]===_0xd8f9('0x1d')&&typeof _0x234901['limit']==='undefined';var _0x284a1a=_0x10369c[_0xd8f9('0x1e')];var _0x4d5b8d=_0x3a3a41?0x0:_0x234901[_0xd8f9('0x1c')];var _0x47bdea=_0x3a3a41?_0x10369c[_0xd8f9('0x1e')]:_0x234901['offset']+_0x234901['limit'];var _0x58956e;if(_0x47bdea>=_0x284a1a){_0x47bdea=_0x284a1a;_0x58956e=0xc8;}else{_0x58956e=0xce;}_0x1525d6[_0xd8f9('0x1f')](_0x58956e);return _0x1525d6['set'](_0xd8f9('0x20'),_0x4d5b8d+'-'+_0x47bdea+'/'+_0x284a1a)[_0xd8f9('0x1b')](_0x10369c);}return null;};}function patchUpdates(_0x58ea35){return function(_0x3204b3){try{jsonpatch[_0xd8f9('0x21')](_0x3204b3,_0x58ea35,!![]);}catch(_0x45b2e3){return BPromise['reject'](_0x45b2e3);}return _0x3204b3[_0xd8f9('0x22')]();};}function saveUpdates(_0x260807,_0x164bf6){return function(_0x36d740){if(_0x36d740){return _0x36d740[_0xd8f9('0x23')](_0x260807)[_0xd8f9('0x24')](function(_0x4c5808){return _0x4c5808;});}return null;};}function removeEntity(_0x39fedc,_0xbd09da){return function(_0x1fcd45){if(_0x1fcd45){return _0x1fcd45[_0xd8f9('0x25')]()[_0xd8f9('0x24')](function(){_0x39fedc['status'](0xcc)[_0xd8f9('0x1a')]();});}};}function handleEntityNotFound(_0x1d6796,_0x28854a){return function(_0xd15475){if(!_0xd15475){_0x1d6796[_0xd8f9('0x19')](0x194);}return _0xd15475;};}function handleError(_0x9e1d6d,_0x175123){_0x175123=_0x175123||0x1f4;return function(_0x461880){logger['error'](_0x461880[_0xd8f9('0x26')]);if(_0x461880[_0xd8f9('0x27')]){delete _0x461880[_0xd8f9('0x27')];}_0x9e1d6d['status'](_0x175123)['send'](_0x461880);};}exports['index']=function(_0x3f85a2,_0x2c25c2){var _0x5050a4={},_0x2bda39={},_0x210cd1={'count':0x0,'rows':[]};var _0x5da878=_[_0xd8f9('0x28')](db[_0xd8f9('0x29')][_0xd8f9('0x2a')],function(_0x4caa27){return{'name':_0x4caa27[_0xd8f9('0x2b')],'type':_0x4caa27['type'][_0xd8f9('0x2c')]};});_0x2bda39[_0xd8f9('0x2d')]=_['map'](_0x5da878,_0xd8f9('0x27'));_0x2bda39['query']=_[_0xd8f9('0x2e')](_0x3f85a2[_0xd8f9('0x2f')]);_0x2bda39[_0xd8f9('0x30')]=_[_0xd8f9('0x31')](_0x2bda39[_0xd8f9('0x2d')],_0x2bda39[_0xd8f9('0x2f')]);_0x5050a4[_0xd8f9('0x32')]=_['intersection'](_0x2bda39[_0xd8f9('0x2d')],qs['fields'](_0x3f85a2['query']['fields']));_0x5050a4['attributes']=_0x5050a4[_0xd8f9('0x32')][_0xd8f9('0x33')]?_0x5050a4[_0xd8f9('0x32')]:_0x2bda39[_0xd8f9('0x2d')];if(!_0x3f85a2[_0xd8f9('0x2f')]['hasOwnProperty']('nolimit')){_0x5050a4[_0xd8f9('0x34')]=qs[_0xd8f9('0x34')](_0x3f85a2['query'][_0xd8f9('0x34')]);_0x5050a4[_0xd8f9('0x1c')]=qs[_0xd8f9('0x1c')](_0x3f85a2['query']['offset']);}_0x5050a4['order']=qs['sort'](_0x3f85a2[_0xd8f9('0x2f')][_0xd8f9('0x35')]);_0x5050a4[_0xd8f9('0x36')]=qs[_0xd8f9('0x30')](_[_0xd8f9('0x37')](_0x3f85a2['query'],_0x2bda39[_0xd8f9('0x30')]),_0x5da878);if(_0x3f85a2[_0xd8f9('0x2f')][_0xd8f9('0x38')]){_0x5050a4[_0xd8f9('0x36')]=_[_0xd8f9('0x39')](_0x5050a4[_0xd8f9('0x36')],{'$or':_[_0xd8f9('0x28')](_0x5da878,function(_0x262e7c){if(_0x262e7c[_0xd8f9('0x3a')]!==_0xd8f9('0x3b')){var _0x2a94d6={};_0x2a94d6[_0x262e7c['name']]={'$like':'%'+_0x3f85a2[_0xd8f9('0x2f')][_0xd8f9('0x38')]+'%'};return _0x2a94d6;}})});}_0x5050a4=_[_0xd8f9('0x39')]({},_0x5050a4,_0x3f85a2[_0xd8f9('0x3c')]);var _0x4af643={'where':_0x5050a4[_0xd8f9('0x36')]};return db[_0xd8f9('0x29')][_0xd8f9('0x1e')](_0x4af643)[_0xd8f9('0x24')](function(_0x1ab301){_0x210cd1[_0xd8f9('0x1e')]=_0x1ab301;if(_0x3f85a2['query']['includeAll']){_0x5050a4['include']=[{'all':!![]}];}return db[_0xd8f9('0x29')][_0xd8f9('0x3d')](_0x5050a4);})[_0xd8f9('0x24')](function(_0x1d8e5d){_0x210cd1[_0xd8f9('0x3e')]=_0x1d8e5d;return _0x210cd1;})[_0xd8f9('0x24')](respondWithFilteredResult(_0x2c25c2,_0x5050a4))[_0xd8f9('0x3f')](handleError(_0x2c25c2,null));};exports[_0xd8f9('0x40')]=function(_0x30e9aa,_0x5ed1b7){var _0x4aabbe={'raw':!![],'where':{'id':_0x30e9aa[_0xd8f9('0x41')]['id']}},_0x433d06={};_0x433d06[_0xd8f9('0x2d')]=_['keys'](db['JscriptyAnswerReport'][_0xd8f9('0x2a')]);_0x433d06[_0xd8f9('0x2f')]=_[_0xd8f9('0x2e')](_0x30e9aa['query']);_0x433d06[_0xd8f9('0x30')]=_[_0xd8f9('0x31')](_0x433d06[_0xd8f9('0x2d')],_0x433d06[_0xd8f9('0x2f')]);_0x4aabbe[_0xd8f9('0x32')]=_[_0xd8f9('0x31')](_0x433d06[_0xd8f9('0x2d')],qs[_0xd8f9('0x42')](_0x30e9aa[_0xd8f9('0x2f')]['fields']));_0x4aabbe['attributes']=_0x4aabbe['attributes'][_0xd8f9('0x33')]?_0x4aabbe[_0xd8f9('0x32')]:_0x433d06[_0xd8f9('0x2d')];if(_0x30e9aa[_0xd8f9('0x2f')][_0xd8f9('0x43')]){_0x4aabbe[_0xd8f9('0x44')]=[{'all':!![]}];}_0x4aabbe=_[_0xd8f9('0x39')]({},_0x4aabbe,_0x30e9aa[_0xd8f9('0x3c')]);return db[_0xd8f9('0x29')][_0xd8f9('0x45')](_0x4aabbe)[_0xd8f9('0x24')](handleEntityNotFound(_0x5ed1b7,null))[_0xd8f9('0x24')](respondWithResult(_0x5ed1b7,null))[_0xd8f9('0x3f')](handleError(_0x5ed1b7,null));};exports['create']=function(_0x395f6b,_0x1cc33e){return db[_0xd8f9('0x29')][_0xd8f9('0x46')](_0x395f6b['body'],{})[_0xd8f9('0x24')](respondWithResult(_0x1cc33e,0xc9))['catch'](handleError(_0x1cc33e,null));};exports['update']=function(_0x39fe25,_0x14e622){if(_0x39fe25[_0xd8f9('0x47')]['id']){delete _0x39fe25[_0xd8f9('0x47')]['id'];}return db[_0xd8f9('0x29')][_0xd8f9('0x45')]({'where':{'id':_0x39fe25[_0xd8f9('0x41')]['id']}})[_0xd8f9('0x24')](handleEntityNotFound(_0x14e622,null))[_0xd8f9('0x24')](saveUpdates(_0x39fe25[_0xd8f9('0x47')],null))['then'](respondWithResult(_0x14e622,null))['catch'](handleError(_0x14e622,null));};exports['destroy']=function(_0x1bb936,_0x3d2485){return db['JscriptyAnswerReport'][_0xd8f9('0x45')]({'where':{'id':_0x1bb936[_0xd8f9('0x41')]['id']}})[_0xd8f9('0x24')](handleEntityNotFound(_0x3d2485,null))[_0xd8f9('0x24')](removeEntity(_0x3d2485,null))[_0xd8f9('0x3f')](handleError(_0x3d2485,null));};exports[_0xd8f9('0x48')]=function(_0x455278,_0x705bd3){return db['JscriptyAnswerReport'][_0xd8f9('0x48')]()[_0xd8f9('0x24')](respondWithResult(_0x705bd3,null))[_0xd8f9('0x3f')](handleError(_0x705bd3,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 9f1748c..fc002e6 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 _0x5d42=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','JscriptyAnswerReport','report_jscripty_answers'];(function(_0x343b71,_0x1f93d8){var _0x152cb9=function(_0x3631f6){while(--_0x3631f6){_0x343b71['push'](_0x343b71['shift']());}};_0x152cb9(++_0x1f93d8);}(_0x5d42,0x99));var _0x25d4=function(_0xec9857,_0x5566ff){_0xec9857=_0xec9857-0x0;var _0x429309=_0x5d42[_0xec9857];return _0x429309;};'use strict';var _=require('lodash');var util=require(_0x25d4('0x0'));var logger=require(_0x25d4('0x1'))(_0x25d4('0x2'));var moment=require('moment');var BPromise=require(_0x25d4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x25d4('0x4'));var rimraf=require(_0x25d4('0x5'));var config=require(_0x25d4('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x3585b7,_0x2ce7ec){return _0x3585b7['define'](_0x25d4('0x7'),attributes,{'tableName':_0x25d4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf383=['define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports'];(function(_0x2aa5ff,_0x57e68e){var _0x16de13=function(_0x57a6d9){while(--_0x57a6d9){_0x2aa5ff['push'](_0x2aa5ff['shift']());}};_0x16de13(++_0x57e68e);}(_0xf383,0x162));var _0x3f38=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xf383[_0x9c2427];return _0x51984f;};'use strict';var _=require(_0x3f38('0x0'));var util=require(_0x3f38('0x1'));var logger=require(_0x3f38('0x2'))(_0x3f38('0x3'));var moment=require('moment');var BPromise=require(_0x3f38('0x4'));var rp=require(_0x3f38('0x5'));var fs=require('fs');var path=require(_0x3f38('0x6'));var rimraf=require(_0x3f38('0x7'));var config=require('../../config/environment');var attributes=require(_0x3f38('0x8'));module[_0x3f38('0x9')]=function(_0x406a06,_0x3ab24b){return _0x406a06[_0x3f38('0xa')](_0x3f38('0xb'),attributes,{'tableName':_0x3f38('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 81197b2..8d6eff1 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 _0x77e0=['request','then','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http'];(function(_0x1c7e96,_0x209dcb){var _0x2d1fb1=function(_0x51b84c){while(--_0x51b84c){_0x1c7e96['push'](_0x1c7e96['shift']());}};_0x2d1fb1(++_0x209dcb);}(_0x77e0,0x90));var _0x077e=function(_0x5b5ebe,_0x591543){_0x5b5ebe=_0x5b5ebe-0x0;var _0x534500=_0x77e0[_0x5b5ebe];return _0x534500;};'use strict';var _=require(_0x077e('0x0'));var util=require('util');var moment=require(_0x077e('0x1'));var BPromise=require(_0x077e('0x2'));var rs=require(_0x077e('0x3'));var fs=require('fs');var Redis=require(_0x077e('0x4'));var db=require(_0x077e('0x5'))['db'];var utils=require(_0x077e('0x6'));var logger=require('../../config/logger')(_0x077e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x077e('0x8')][_0x077e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e156e,_0x3cc5a3,_0x4087a7){return new BPromise(function(_0x5e6937,_0x2798a8){return client[_0x077e('0xa')](_0x3e156e,_0x4087a7)[_0x077e('0xb')](function(_0x464129){logger[_0x077e('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3cc5a3,_0x077e('0xd'));logger[_0x077e('0xe')](_0x077e('0xf'),_0x3cc5a3,_0x077e('0xd'),JSON[_0x077e('0x10')](_0x464129));if(_0x464129[_0x077e('0x11')]){if(_0x464129[_0x077e('0x11')][_0x077e('0x12')]===0x1f4){logger[_0x077e('0x11')](_0x077e('0x13'),_0x3cc5a3,_0x464129['error']['message']);return _0x2798a8(_0x464129[_0x077e('0x11')][_0x077e('0x14')]);}logger['error'](_0x077e('0x13'),_0x3cc5a3,_0x464129[_0x077e('0x11')][_0x077e('0x14')]);return _0x5e6937(_0x464129[_0x077e('0x11')]['message']);}else{logger[_0x077e('0xc')](_0x077e('0x13'),_0x3cc5a3,_0x077e('0xd'));_0x5e6937(_0x464129[_0x077e('0x15')][_0x077e('0x14')]);}})['catch'](function(_0x13b6a5){logger[_0x077e('0x11')](_0x077e('0x13'),_0x3cc5a3,_0x13b6a5);_0x2798a8(_0x13b6a5);});});} \ No newline at end of file +var _0xea5a=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyAnswerReport,\x20%s,\x20%s','result','catch','util'];(function(_0x11469e,_0x1443be){var _0x505b72=function(_0x134018){while(--_0x134018){_0x11469e['push'](_0x11469e['shift']());}};_0x505b72(++_0x1443be);}(_0xea5a,0x1e3));var _0xaea5=function(_0x52aec5,_0x49e60d){_0x52aec5=_0x52aec5-0x0;var _0x4c23dd=_0xea5a[_0x52aec5];return _0x4c23dd;};'use strict';var _=require('lodash');var util=require(_0xaea5('0x0'));var moment=require(_0xaea5('0x1'));var BPromise=require('bluebird');var rs=require(_0xaea5('0x2'));var fs=require('fs');var Redis=require(_0xaea5('0x3'));var db=require(_0xaea5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaea5('0x5'))(_0xaea5('0x6'));var config=require('../../config/environment');var jayson=require(_0xaea5('0x7'));var client=jayson[_0xaea5('0x8')][_0xaea5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10d9ea,_0x15696e,_0x29617e){return new BPromise(function(_0x56ca9b,_0x1736c0){return client[_0xaea5('0xa')](_0x10d9ea,_0x29617e)[_0xaea5('0xb')](function(_0x1b5f90){logger[_0xaea5('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x15696e,_0xaea5('0xd'));logger['debug'](_0xaea5('0xe'),_0x15696e,_0xaea5('0xd'),JSON[_0xaea5('0xf')](_0x1b5f90));if(_0x1b5f90[_0xaea5('0x10')]){if(_0x1b5f90[_0xaea5('0x10')][_0xaea5('0x11')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x15696e,_0x1b5f90['error']['message']);return _0x1736c0(_0x1b5f90['error'][_0xaea5('0x12')]);}logger[_0xaea5('0x10')](_0xaea5('0x13'),_0x15696e,_0x1b5f90[_0xaea5('0x10')][_0xaea5('0x12')]);return _0x56ca9b(_0x1b5f90['error'][_0xaea5('0x12')]);}else{logger[_0xaea5('0xc')](_0xaea5('0x13'),_0x15696e,'request\x20sent');_0x56ca9b(_0x1b5f90[_0xaea5('0x14')][_0xaea5('0x12')]);}})[_0xaea5('0x15')](function(_0x5df913){logger[_0xaea5('0x10')](_0xaea5('0x13'),_0x15696e,_0x5df913);_0x1736c0(_0x5df913);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 3c88390..f8a6021 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 _0x3be7=['post','/:id/clone','clone','put','update','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','getSummary','create'];(function(_0x180ad5,_0x290f3a){var _0x5ca23b=function(_0x544aeb){while(--_0x544aeb){_0x180ad5['push'](_0x180ad5['shift']());}};_0x5ca23b(++_0x290f3a);}(_0x3be7,0x172));var _0x73be=function(_0x3e75f2,_0x7b3f4f){_0x3e75f2=_0x3e75f2-0x0;var _0xcf25cc=_0x3be7[_0x3e75f2];return _0xcf25cc;};'use strict';var multer=require(_0x73be('0x0'));var util=require(_0x73be('0x1'));var path=require('path');var timeout=require(_0x73be('0x2'));var express=require('express');var router=express[_0x73be('0x3')]();var fs_extra=require(_0x73be('0x4'));var auth=require(_0x73be('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x73be('0x6'));var controller=require(_0x73be('0x7'));router[_0x73be('0x8')]('/',auth['isAuthenticated'](),controller[_0x73be('0x9')]);router['get'](_0x73be('0xa'),auth[_0x73be('0xb')](),controller[_0x73be('0xc')]);router['get'](_0x73be('0xd'),auth[_0x73be('0xb')](),controller[_0x73be('0xe')]);router[_0x73be('0x8')](_0x73be('0xf'),auth[_0x73be('0xb')](),controller[_0x73be('0x10')]);router[_0x73be('0x8')]('/:id/summary',auth[_0x73be('0xb')](),timeout(_0x73be('0x11')),controller[_0x73be('0x12')]);router['post']('/',auth[_0x73be('0xb')](),controller[_0x73be('0x13')]);router[_0x73be('0x14')](_0x73be('0x15'),auth['isAuthenticated'](),controller[_0x73be('0x16')]);router[_0x73be('0x17')](_0x73be('0xa'),auth[_0x73be('0xb')](),controller[_0x73be('0x18')]);router['delete']('/:id',auth[_0x73be('0xb')](),controller['destroy']);module[_0x73be('0x19')]=router; \ No newline at end of file +var _0xa7ce=['fs-extra','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','30s','getSummary','post','create','/:id/clone','clone','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x1fc69f,_0x4b8fb0){var _0x202ba1=function(_0x458034){while(--_0x458034){_0x1fc69f['push'](_0x1fc69f['shift']());}};_0x202ba1(++_0x4b8fb0);}(_0xa7ce,0xec));var _0xea7c=function(_0x46fa99,_0x2a43f8){_0x46fa99=_0x46fa99-0x0;var _0x2ab8a9=_0xa7ce[_0x46fa99];return _0x2ab8a9;};'use strict';var multer=require(_0xea7c('0x0'));var util=require('util');var path=require(_0xea7c('0x1'));var timeout=require(_0xea7c('0x2'));var express=require('express');var router=express[_0xea7c('0x3')]();var fs_extra=require(_0xea7c('0x4'));var auth=require(_0xea7c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xea7c('0x6'));var controller=require(_0xea7c('0x7'));router[_0xea7c('0x8')]('/',auth[_0xea7c('0x9')](),controller[_0xea7c('0xa')]);router[_0xea7c('0x8')](_0xea7c('0xb'),auth[_0xea7c('0x9')](),controller[_0xea7c('0xc')]);router[_0xea7c('0x8')](_0xea7c('0xd'),auth[_0xea7c('0x9')](),controller[_0xea7c('0xe')]);router['get'](_0xea7c('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router['get']('/:id/summary',auth[_0xea7c('0x9')](),timeout(_0xea7c('0x10')),controller[_0xea7c('0x11')]);router[_0xea7c('0x12')]('/',auth[_0xea7c('0x9')](),controller[_0xea7c('0x13')]);router[_0xea7c('0x12')](_0xea7c('0x14'),auth[_0xea7c('0x9')](),controller[_0xea7c('0x15')]);router['put'](_0xea7c('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xea7c('0xb'),auth['isAuthenticated'](),controller[_0xea7c('0x16')]);module[_0xea7c('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index a7341d9..84d09e0 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 _0x8423=['exports','STRING','name','TEXT','long','setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','util'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0x8423,0xb1));var _0x3842=function(_0x5e88ce,_0x585263){_0x5e88ce=_0x5e88ce-0x0;var _0x544aa9=_0x8423[_0x5e88ce];return _0x544aa9;};'use strict';var Sequelize=require(_0x3842('0x0'));var _=require(_0x3842('0x1'));var util=require(_0x3842('0x2'));module[_0x3842('0x3')]={'name':{'type':Sequelize[_0x3842('0x4')],'unique':_0x3842('0x5')},'description':{'type':Sequelize[_0x3842('0x4')]},'formData':{'type':Sequelize[_0x3842('0x6')](_0x3842('0x7')),'set':function(_0x653cbc){if(_['isObjectLike'](_0x653cbc)){this[_0x3842('0x8')](_0x3842('0x9'),JSON[_0x3842('0xa')](_0x653cbc));}else if(_['isString'](_0x653cbc)){this[_0x3842('0x8')](_0x3842('0x9'),_0x653cbc);}else{this[_0x3842('0x8')](_0x3842('0x9'),util[_0x3842('0xb')](_0x3842('0xc'),this['getDataValue'](_0x3842('0x5'))||'',this[_0x3842('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x3842('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x3842('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0xf42a=['format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','name','getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','TEXT','isObjectLike','formData','stringify','isString','setDataValue'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0xf42a,0xe6));var _0xaf42=function(_0x5ae4df,_0x328b50){_0x5ae4df=_0x5ae4df-0x0;var _0x45c389=_0xf42a[_0x5ae4df];return _0x45c389;};'use strict';var Sequelize=require(_0xaf42('0x0'));var _=require(_0xaf42('0x1'));var util=require(_0xaf42('0x2'));module['exports']={'name':{'type':Sequelize[_0xaf42('0x3')],'unique':'name'},'description':{'type':Sequelize[_0xaf42('0x3')]},'formData':{'type':Sequelize[_0xaf42('0x4')]('long'),'set':function(_0x30187d){if(_[_0xaf42('0x5')](_0x30187d)){this['setDataValue'](_0xaf42('0x6'),JSON[_0xaf42('0x7')](_0x30187d));}else if(_[_0xaf42('0x8')](_0x30187d)){this[_0xaf42('0x9')](_0xaf42('0x6'),_0x30187d);}else{this[_0xaf42('0x9')](_0xaf42('0x6'),util[_0xaf42('0xa')](_0xaf42('0xb'),this['getDataValue'](_0xaf42('0xc'))||'',this[_0xaf42('0xd')](_0xaf42('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xaf42('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xaf42('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index b76649f..50c8902 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 _0x6ea9=['YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','Projects','end','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','JscriptyProject','includeAll','include','findAll','rows','catch','params','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','body','omit','userProfileId','update','getSessions','findOne','JscriptySessionReport','JscriptyAnswerReport','ProjectId','number','fromCharCode','toString','indexOf','replace','startTime','starttime','parse','-createdAt','questionId','question'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x6ea9,0x89));var _0x96ea=function(_0x3fc2c9,_0x4fbfc5){_0x3fc2c9=_0x3fc2c9-0x0;var _0x13547d=_0x6ea9[_0x3fc2c9];return _0x13547d;};'use strict';var emlformat=require(_0x96ea('0x0'));var rimraf=require(_0x96ea('0x1'));var zipdir=require(_0x96ea('0x2'));var jsonpatch=require(_0x96ea('0x3'));var rp=require(_0x96ea('0x4'));var moment=require('moment');var BPromise=require(_0x96ea('0x5'));var Mustache=require(_0x96ea('0x6'));var util=require(_0x96ea('0x7'));var path=require('path');var sox=require(_0x96ea('0x8'));var csv=require('to-csv');var ejs=require(_0x96ea('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96ea('0xa'));var squel=require('squel');var crypto=require(_0x96ea('0xb'));var jsforce=require(_0x96ea('0xc'));var deskjs=require(_0x96ea('0xd'));var toCsv=require(_0x96ea('0xe'));var querystring=require(_0x96ea('0xf'));var Papa=require(_0x96ea('0x10'));var Redis=require('ioredis');var authService=require(_0x96ea('0x11'));var qs=require(_0x96ea('0x12'));var as=require(_0x96ea('0x13'));var hardwareService=require(_0x96ea('0x14'));var logger=require(_0x96ea('0x15'))(_0x96ea('0x16'));var utils=require(_0x96ea('0x17'));var config=require(_0x96ea('0x18'));var licenseUtil=require(_0x96ea('0x19'));var db=require(_0x96ea('0x1a'))['db'];function respondWithStatusCode(_0x593f80,_0x2384b1){_0x2384b1=_0x2384b1||0xcc;return function(_0x5f4c12){if(_0x5f4c12){return _0x593f80[_0x96ea('0x1b')](_0x2384b1);}return _0x593f80[_0x96ea('0x1c')](_0x2384b1)['end']();};}function respondWithResult(_0x1df101,_0x1ce6e9){_0x1ce6e9=_0x1ce6e9||0xc8;return function(_0xc1059e){if(_0xc1059e){return _0x1df101[_0x96ea('0x1c')](_0x1ce6e9)[_0x96ea('0x1d')](_0xc1059e);}};}function respondWithFilteredResult(_0x19308f,_0x1dd4f1){return function(_0x237f2c){if(_0x237f2c){var _0x4a847d=typeof _0x1dd4f1[_0x96ea('0x1e')]==='undefined'&&typeof _0x1dd4f1['limit']===_0x96ea('0x1f');var _0x3cb1e0=_0x237f2c['count'];var _0x47444c=_0x4a847d?0x0:_0x1dd4f1[_0x96ea('0x1e')];var _0x24c940=_0x4a847d?_0x237f2c[_0x96ea('0x20')]:_0x1dd4f1[_0x96ea('0x1e')]+_0x1dd4f1[_0x96ea('0x21')];var _0x43dd6f;if(_0x24c940>=_0x3cb1e0){_0x24c940=_0x3cb1e0;_0x43dd6f=0xc8;}else{_0x43dd6f=0xce;}_0x19308f['status'](_0x43dd6f);return _0x19308f['set'](_0x96ea('0x22'),_0x47444c+'-'+_0x24c940+'/'+_0x3cb1e0)[_0x96ea('0x1d')](_0x237f2c);}return null;};}function patchUpdates(_0xfaec11){return function(_0x1e1bcd){try{jsonpatch[_0x96ea('0x23')](_0x1e1bcd,_0xfaec11,!![]);}catch(_0xa3941){return BPromise[_0x96ea('0x24')](_0xa3941);}return _0x1e1bcd[_0x96ea('0x25')]();};}function saveUpdates(_0x2235e7,_0x3a618c){return function(_0x3a99f6){if(_0x3a99f6){return _0x3a99f6['update'](_0x2235e7)[_0x96ea('0x26')](function(_0x22cdc4){return _0x22cdc4;});}return null;};}function removeEntity(_0x3dc8bd,_0x3634e7){return function(_0x396117){if(_0x396117){return _0x396117[_0x96ea('0x27')]()['then'](function(){var _0x33e05b=_0x396117['get']({'plain':!![]});var _0x36143a=_0x96ea('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x36143a,'resourceId':_0x33e05b['id']}})[_0x96ea('0x26')](function(){return _0x396117;});})[_0x96ea('0x26')](function(){_0x3dc8bd[_0x96ea('0x1c')](0xcc)[_0x96ea('0x29')]();});}};}function handleEntityNotFound(_0x197af7,_0x49a7bd){return function(_0xf31340){if(!_0xf31340){_0x197af7[_0x96ea('0x1b')](0x194);}return _0xf31340;};}function handleError(_0x108043,_0x247c8c){_0x247c8c=_0x247c8c||0x1f4;return function(_0x2aa9e9){logger[_0x96ea('0x2a')](_0x2aa9e9[_0x96ea('0x2b')]);if(_0x2aa9e9[_0x96ea('0x2c')]){delete _0x2aa9e9[_0x96ea('0x2c')];}_0x108043[_0x96ea('0x1c')](_0x247c8c)[_0x96ea('0x2d')](_0x2aa9e9);};}exports[_0x96ea('0x2e')]=function(_0x91a2a2,_0x30ec3f){var _0x1c6f08={},_0x5a73a2={},_0x114450={'count':0x0,'rows':[]};var _0x13be02=_[_0x96ea('0x2f')](db['JscriptyProject'][_0x96ea('0x30')],function(_0x4e60e8){return{'name':_0x4e60e8['fieldName'],'type':_0x4e60e8[_0x96ea('0x31')][_0x96ea('0x32')]};});_0x5a73a2['model']=_[_0x96ea('0x2f')](_0x13be02,_0x96ea('0x2c'));_0x5a73a2[_0x96ea('0x33')]=_[_0x96ea('0x34')](_0x91a2a2[_0x96ea('0x33')]);_0x5a73a2[_0x96ea('0x35')]=_[_0x96ea('0x36')](_0x5a73a2[_0x96ea('0x37')],_0x5a73a2['query']);_0x1c6f08[_0x96ea('0x38')]=_[_0x96ea('0x36')](_0x5a73a2['model'],qs[_0x96ea('0x39')](_0x91a2a2[_0x96ea('0x33')][_0x96ea('0x39')]));_0x1c6f08[_0x96ea('0x38')]=_0x1c6f08[_0x96ea('0x38')][_0x96ea('0x3a')]?_0x1c6f08[_0x96ea('0x38')]:_0x5a73a2['model'];if(!_0x91a2a2[_0x96ea('0x33')][_0x96ea('0x3b')](_0x96ea('0x3c'))){_0x1c6f08[_0x96ea('0x21')]=qs[_0x96ea('0x21')](_0x91a2a2[_0x96ea('0x33')][_0x96ea('0x21')]);_0x1c6f08[_0x96ea('0x1e')]=qs[_0x96ea('0x1e')](_0x91a2a2[_0x96ea('0x33')][_0x96ea('0x1e')]);}_0x1c6f08[_0x96ea('0x3d')]=qs[_0x96ea('0x3e')](_0x91a2a2[_0x96ea('0x33')][_0x96ea('0x3e')]);_0x1c6f08[_0x96ea('0x3f')]=qs[_0x96ea('0x35')](_[_0x96ea('0x40')](_0x91a2a2[_0x96ea('0x33')],_0x5a73a2['filters']),_0x13be02);if(_0x91a2a2[_0x96ea('0x33')]['filter']){_0x1c6f08[_0x96ea('0x3f')]=_[_0x96ea('0x41')](_0x1c6f08[_0x96ea('0x3f')],{'$or':_[_0x96ea('0x2f')](_0x13be02,function(_0x2b9966){if(_0x2b9966['type']!==_0x96ea('0x42')){var _0x35266f={};_0x35266f[_0x2b9966[_0x96ea('0x2c')]]={'$like':'%'+_0x91a2a2['query'][_0x96ea('0x43')]+'%'};return _0x35266f;}})});}_0x1c6f08=_['merge']({},_0x1c6f08,_0x91a2a2[_0x96ea('0x44')]);var _0x47ed8e={'where':_0x1c6f08['where']};return db[_0x96ea('0x45')][_0x96ea('0x20')](_0x47ed8e)[_0x96ea('0x26')](function(_0x249456){_0x114450['count']=_0x249456;if(_0x91a2a2[_0x96ea('0x33')][_0x96ea('0x46')]){_0x1c6f08[_0x96ea('0x47')]=[{'all':!![]}];}return db[_0x96ea('0x45')][_0x96ea('0x48')](_0x1c6f08);})['then'](function(_0x5a346a){_0x114450[_0x96ea('0x49')]=_0x5a346a;return _0x114450;})[_0x96ea('0x26')](respondWithFilteredResult(_0x30ec3f,_0x1c6f08))[_0x96ea('0x4a')](handleError(_0x30ec3f,null));};exports['show']=function(_0x3d46ec,_0x2430b8){var _0x496dd9={'raw':![],'where':{'id':_0x3d46ec[_0x96ea('0x4b')]['id']}},_0x48d9be={};_0x48d9be[_0x96ea('0x37')]=_['keys'](db['JscriptyProject'][_0x96ea('0x30')]);_0x48d9be[_0x96ea('0x33')]=_[_0x96ea('0x34')](_0x3d46ec['query']);_0x48d9be[_0x96ea('0x35')]=_[_0x96ea('0x36')](_0x48d9be[_0x96ea('0x37')],_0x48d9be[_0x96ea('0x33')]);_0x496dd9['attributes']=_[_0x96ea('0x36')](_0x48d9be[_0x96ea('0x37')],qs[_0x96ea('0x39')](_0x3d46ec['query'][_0x96ea('0x39')]));_0x496dd9[_0x96ea('0x38')]=_0x496dd9[_0x96ea('0x38')]['length']?_0x496dd9[_0x96ea('0x38')]:_0x48d9be[_0x96ea('0x37')];if(_0x3d46ec[_0x96ea('0x33')][_0x96ea('0x46')]){_0x496dd9[_0x96ea('0x47')]=[{'all':!![]}];}_0x496dd9=_[_0x96ea('0x41')]({},_0x496dd9,_0x3d46ec[_0x96ea('0x44')]);return db['JscriptyProject']['find'](_0x496dd9)[_0x96ea('0x26')](handleEntityNotFound(_0x2430b8,null))[_0x96ea('0x26')](respondWithResult(_0x2430b8,null))[_0x96ea('0x4a')](handleError(_0x2430b8,null));};exports[_0x96ea('0x4c')]=function(_0x31a8af,_0xf921c5){return db[_0x96ea('0x45')]['create'](_0x31a8af['body'],{})[_0x96ea('0x26')](function(_0x131395){var _0x351440=_0x31a8af[_0x96ea('0x4d')][_0x96ea('0x4e')]({'plain':!![]});if(!_0x351440)throw new Error(_0x96ea('0x4f'));if(_0x351440[_0x96ea('0x50')]==='user'){var _0x440b35=_0x131395[_0x96ea('0x4e')]({'plain':!![]});var _0x5dc96a=_0x96ea('0x28');return db[_0x96ea('0x51')][_0x96ea('0x52')]({'where':{'name':_0x5dc96a,'userProfileId':_0x351440['userProfileId']},'raw':!![]})['then'](function(_0x4b15af){if(_0x4b15af&&_0x4b15af[_0x96ea('0x53')]===0x0){return db[_0x96ea('0x54')][_0x96ea('0x4c')]({'name':_0x440b35[_0x96ea('0x2c')],'resourceId':_0x440b35['id'],'type':_0x4b15af[_0x96ea('0x2c')],'sectionId':_0x4b15af['id']},{})[_0x96ea('0x26')](function(){return _0x131395;});}else{return _0x131395;}})['catch'](function(_0x3ef29b){logger[_0x96ea('0x2a')](_0x96ea('0x55'),_0x3ef29b);throw _0x3ef29b;});}return _0x131395;})['then'](respondWithResult(_0xf921c5,0xc9))[_0x96ea('0x4a')](handleError(_0xf921c5,null));};exports[_0x96ea('0x56')]=function(_0x9e64c4,_0x28db59){var _0x2faa1f={'where':{'id':_0x9e64c4['params']['id']}},_0x26e92f={};_0x26e92f['model']=_['keys'](db[_0x96ea('0x45')]['rawAttributes']);_0x2faa1f[_0x96ea('0x38')]=_[_0x96ea('0x36')](_0x26e92f[_0x96ea('0x37')],qs[_0x96ea('0x39')](_0x9e64c4[_0x96ea('0x33')]['fields']));_0x2faa1f[_0x96ea('0x38')]=_0x2faa1f['attributes'][_0x96ea('0x3a')]?_0x2faa1f['attributes']:_0x26e92f[_0x96ea('0x37')];if(_0x9e64c4[_0x96ea('0x33')][_0x96ea('0x46')]){_0x2faa1f[_0x96ea('0x47')]=[{'all':!![]}];}_0x2faa1f=_[_0x96ea('0x41')]({},_0x2faa1f,_0x9e64c4[_0x96ea('0x44')]);return db['JscriptyProject'][_0x96ea('0x52')](_0x2faa1f)[_0x96ea('0x26')](handleEntityNotFound(_0x28db59,null))[_0x96ea('0x26')](function(_0x31a532){if(_0x31a532){var _0x3ed8eb=_0x31a532[_0x96ea('0x4e')]({'plain':!![]});_0x3ed8eb=qs['omit'](_0x3ed8eb,['id',_0x96ea('0x57'),_0x96ea('0x58')]);_0x9e64c4[_0x96ea('0x59')]=_[_0x96ea('0x5a')](_0x9e64c4['body'],['id',_0x96ea('0x57'),_0x96ea('0x58')]);return db[_0x96ea('0x45')][_0x96ea('0x4c')](_[_0x96ea('0x41')](_0x3ed8eb,_0x9e64c4[_0x96ea('0x59')]),{'include':_0x9e64c4[_0x96ea('0x33')][_0x96ea('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x5744b7){var _0x3d9461=_0x9e64c4[_0x96ea('0x4d')]['get']({'plain':!![]});if(!_0x3d9461)throw new Error(_0x96ea('0x4f'));if(_0x3d9461[_0x96ea('0x50')]===_0x96ea('0x4d')){var _0x34cc52=_0x5744b7['get']({'plain':!![]});var _0x73a0f6=_0x96ea('0x28');return db['UserProfileSection'][_0x96ea('0x52')]({'where':{'name':_0x73a0f6,'userProfileId':_0x3d9461[_0x96ea('0x5b')]},'raw':!![]})['then'](function(_0x246392){if(_0x246392&&_0x246392['autoAssociation']===0x0){return db[_0x96ea('0x54')][_0x96ea('0x4c')]({'name':_0x34cc52[_0x96ea('0x2c')],'resourceId':_0x34cc52['id'],'type':_0x246392[_0x96ea('0x2c')],'sectionId':_0x246392['id']},{})[_0x96ea('0x26')](function(){return _0x5744b7;});}else{return _0x5744b7;}})[_0x96ea('0x4a')](function(_0x1d199f){logger[_0x96ea('0x2a')](_0x96ea('0x55'),_0x1d199f);throw _0x1d199f;});}return _0x5744b7;});}})[_0x96ea('0x26')](respondWithResult(_0x28db59,0xc9))['catch'](handleError(_0x28db59,null));};exports[_0x96ea('0x5c')]=function(_0x2536ff,_0x38e94f){if(_0x2536ff[_0x96ea('0x59')]['id']){delete _0x2536ff['body']['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x2536ff[_0x96ea('0x4b')]['id']}})[_0x96ea('0x26')](handleEntityNotFound(_0x38e94f,null))['then'](saveUpdates(_0x2536ff[_0x96ea('0x59')],null))['then'](respondWithResult(_0x38e94f,null))['catch'](handleError(_0x38e94f,null));};exports[_0x96ea('0x27')]=function(_0x42fd19,_0x37756d){return db[_0x96ea('0x45')][_0x96ea('0x52')]({'where':{'id':_0x42fd19[_0x96ea('0x4b')]['id']}})[_0x96ea('0x26')](handleEntityNotFound(_0x37756d,null))['then'](removeEntity(_0x37756d,null))[_0x96ea('0x4a')](handleError(_0x37756d,null));};exports[_0x96ea('0x5d')]=function(_0x22a4d2,_0x4960ea,_0x4f6831){var _0x3701b5={'raw':!![],'where':{}};var _0x1737d3={};var _0x25f8ee={'count':0x0,'rows':[]};return db[_0x96ea('0x45')][_0x96ea('0x5e')]({'where':{'id':_0x22a4d2[_0x96ea('0x4b')]['id']}})[_0x96ea('0x26')](handleEntityNotFound(_0x4960ea,null))[_0x96ea('0x26')](function(_0xd56ef0){if(_0xd56ef0){_0x1737d3['model']=_[_0x96ea('0x34')](db[_0x96ea('0x5f')][_0x96ea('0x30')]);_0x1737d3['query']=_[_0x96ea('0x34')](_0x22a4d2['query']);_0x1737d3[_0x96ea('0x35')]=_[_0x96ea('0x36')](_0x1737d3[_0x96ea('0x37')],_0x1737d3[_0x96ea('0x33')]);_0x3701b5[_0x96ea('0x38')]=_[_0x96ea('0x36')](_0x1737d3[_0x96ea('0x37')],qs['fields'](_0x22a4d2[_0x96ea('0x33')]['fields']));_0x3701b5[_0x96ea('0x38')]=_0x3701b5['attributes'][_0x96ea('0x3a')]?_0x3701b5['attributes']:_0x1737d3['model'];if(!_0x22a4d2[_0x96ea('0x33')]['hasOwnProperty'](_0x96ea('0x3c'))){_0x3701b5[_0x96ea('0x21')]=qs[_0x96ea('0x21')](_0x22a4d2[_0x96ea('0x33')][_0x96ea('0x21')]);_0x3701b5['offset']=qs['offset'](_0x22a4d2['query']['offset']);}_0x3701b5['order']=qs[_0x96ea('0x3e')](_0x22a4d2['query'][_0x96ea('0x3e')]);_0x3701b5[_0x96ea('0x3f')]=qs[_0x96ea('0x35')](_['pick'](_0x22a4d2[_0x96ea('0x33')],_0x1737d3[_0x96ea('0x35')]));_0x3701b5[_0x96ea('0x3f')]['ProjectId']=_0xd56ef0['id'];if(_0x22a4d2['query'][_0x96ea('0x43')]){_0x3701b5[_0x96ea('0x3f')]=_[_0x96ea('0x41')](_0x3701b5[_0x96ea('0x3f')],{'$or':_[_0x96ea('0x2f')](_0x3701b5['attributes'],function(_0x35401a){var _0x566692={};_0x566692[_0x35401a]={'$like':'%'+_0x22a4d2['query'][_0x96ea('0x43')]+'%'};return _0x566692;})});}_0x3701b5=_['merge']({},_0x3701b5,_0x22a4d2['options']);return db[_0x96ea('0x5f')]['count']({'where':_0x3701b5[_0x96ea('0x3f')]})[_0x96ea('0x26')](function(_0x3f2eab){_0x25f8ee[_0x96ea('0x20')]=_0x3f2eab;if(_0x22a4d2[_0x96ea('0x33')][_0x96ea('0x46')]){_0x3701b5[_0x96ea('0x47')]=[{'all':!![]}];}return db[_0x96ea('0x5f')][_0x96ea('0x48')](_0x3701b5);})['then'](function(_0x33534b){_0x25f8ee['rows']=_0x33534b;return _0x25f8ee;});}})[_0x96ea('0x26')](respondWithFilteredResult(_0x4960ea,_0x3701b5))[_0x96ea('0x4a')](handleError(_0x4960ea,null));};exports['getAnswers']=function(_0x25ed8a,_0x53ab95,_0x2f5434){var _0x2612c3={'raw':!![],'where':{}};var _0x123936={};var _0x33f9ef={'count':0x0,'rows':[]};return db[_0x96ea('0x45')]['findOne']({'where':{'id':_0x25ed8a[_0x96ea('0x4b')]['id']}})[_0x96ea('0x26')](handleEntityNotFound(_0x53ab95,null))[_0x96ea('0x26')](function(_0x2d8098){if(_0x2d8098){_0x123936[_0x96ea('0x37')]=_[_0x96ea('0x34')](db[_0x96ea('0x60')][_0x96ea('0x30')]);_0x123936[_0x96ea('0x33')]=_['keys'](_0x25ed8a[_0x96ea('0x33')]);_0x123936[_0x96ea('0x35')]=_[_0x96ea('0x36')](_0x123936['model'],_0x123936[_0x96ea('0x33')]);_0x2612c3[_0x96ea('0x38')]=_[_0x96ea('0x36')](_0x123936[_0x96ea('0x37')],qs[_0x96ea('0x39')](_0x25ed8a['query'][_0x96ea('0x39')]));_0x2612c3[_0x96ea('0x38')]=_0x2612c3['attributes'][_0x96ea('0x3a')]?_0x2612c3['attributes']:_0x123936['model'];if(!_0x25ed8a['query']['hasOwnProperty'](_0x96ea('0x3c'))){_0x2612c3[_0x96ea('0x21')]=qs[_0x96ea('0x21')](_0x25ed8a['query'][_0x96ea('0x21')]);_0x2612c3['offset']=qs['offset'](_0x25ed8a[_0x96ea('0x33')]['offset']);}_0x2612c3[_0x96ea('0x3d')]=qs[_0x96ea('0x3e')](_0x25ed8a[_0x96ea('0x33')][_0x96ea('0x3e')]);_0x2612c3[_0x96ea('0x3f')]=qs[_0x96ea('0x35')](_[_0x96ea('0x40')](_0x25ed8a[_0x96ea('0x33')],_0x123936[_0x96ea('0x35')]));_0x2612c3['where'][_0x96ea('0x61')]=_0x2d8098['id'];if(_0x25ed8a[_0x96ea('0x33')]['filter']){_0x2612c3[_0x96ea('0x3f')]=_['merge'](_0x2612c3[_0x96ea('0x3f')],{'$or':_[_0x96ea('0x2f')](_0x2612c3[_0x96ea('0x38')],function(_0x3419bf){var _0xdba9dd={};_0xdba9dd[_0x3419bf]={'$like':'%'+_0x25ed8a[_0x96ea('0x33')]['filter']+'%'};return _0xdba9dd;})});}_0x2612c3=_[_0x96ea('0x41')]({},_0x2612c3,_0x25ed8a[_0x96ea('0x44')]);return db[_0x96ea('0x60')][_0x96ea('0x20')]({'where':_0x2612c3[_0x96ea('0x3f')]})[_0x96ea('0x26')](function(_0x3b06e7){_0x33f9ef['count']=_0x3b06e7;if(_0x25ed8a[_0x96ea('0x33')]['includeAll']){_0x2612c3['include']=[{'all':!![]}];}return db[_0x96ea('0x60')][_0x96ea('0x48')](_0x2612c3);})[_0x96ea('0x26')](function(_0x53833a){_0x33f9ef[_0x96ea('0x49')]=_0x53833a;return _0x33f9ef;});}})['then'](respondWithFilteredResult(_0x53ab95,_0x2612c3))[_0x96ea('0x4a')](handleError(_0x53ab95,null));};function char(_0x171e94){return _0x96ea('0x62')===typeof _0x171e94?String[_0x96ea('0x63')][_0x96ea('0x23')](null,arguments):_0x171e94;}function needsEncapsulation(_0x15da1b){return!!_0x15da1b&&(_0x15da1b[_0x96ea('0x64')]()[_0x96ea('0x65')](char(0xd))>=0x0||_0x15da1b['toString']()[_0x96ea('0x65')](char(0xa))>=0x0||_0x15da1b[_0x96ea('0x64')]()[_0x96ea('0x65')](char(0x2c))>=0x0||_0x15da1b['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x1baced){var _0x426ec2=char(0x22),_0x50f372='\x5c'+char(0x22),_0x917222=_0x1baced[_0x96ea('0x64')]()[_0x96ea('0x66')](new RegExp(_0x426ec2,'g'),_0x50f372);return _0x426ec2+_0x917222+_0x426ec2;}exports['getSummary']=function(_0x1906c0,_0x2691c4,_0x4691ec){var _0x125773,_0x362eeb;var _0x1601cc={'where':{'ProjectId':_0x1906c0[_0x96ea('0x4b')]['id']}};if(_0x1906c0['query'][_0x96ea('0x67')]){_0x1601cc[_0x96ea('0x3f')][_0x96ea('0x68')]=JSON[_0x96ea('0x69')](_0x1906c0[_0x96ea('0x33')][_0x96ea('0x67')]);}return db[_0x96ea('0x5f')][_0x96ea('0x48')](_0x1601cc)[_0x96ea('0x26')](handleEntityNotFound(_0x2691c4,null))[_0x96ea('0x26')](function(_0x1977d5){if(_0x1977d5){_0x125773=_0x1977d5;return db['JscriptyQuestionReport'][_0x96ea('0x48')]({'where':{'SessionId':{'$in':_['map'](_0x125773,'id')},'ProjectId':_0x1906c0['params']['id']},'order':_0x96ea('0x6a')});}})['then'](handleEntityNotFound(_0x2691c4,null))[_0x96ea('0x26')](function(_0x21a30e){if(_0x21a30e){_0x362eeb=_0x21a30e;var _0x468643={};for(var _0x3678d0=0x0,_0x551348=_0x362eeb['length'];_0x3678d0<_0x551348;_0x3678d0++){if(!_0x468643[_0x96ea('0x3b')](_0x362eeb[_0x3678d0][_0x96ea('0x6b')])){_0x468643[_0x362eeb[_0x3678d0][_0x96ea('0x6b')]]=needsEncapsulation(_0x362eeb[_0x3678d0][_0x96ea('0x6c')])?encapsulate(_0x362eeb[_0x3678d0][_0x96ea('0x6c')]):_0x362eeb[_0x3678d0][_0x96ea('0x6c')];}}var _0x467740=[],_0x2d0f41={};for(var _0x5cb296=0x0,_0x105ddb=_0x125773[_0x96ea('0x3a')];_0x5cb296<_0x105ddb;_0x5cb296++){_0x2d0f41={'ProjectId':_0x1906c0[_0x96ea('0x4b')]['id'],'SessionId':_0x125773[_0x5cb296]['id'],'StartTime':moment(_0x125773[_0x5cb296][_0x96ea('0x68')])['format'](_0x96ea('0x6d'))};for(var _0x295b10=0x0,_0x14e08c=_0x362eeb['length'];_0x295b10<_0x14e08c;_0x295b10++){if(_0x362eeb[_0x295b10][_0x96ea('0x6e')]==_0x125773[_0x5cb296]['id']&&_0x468643[_0x96ea('0x3b')](_0x362eeb[_0x295b10][_0x96ea('0x6b')])){_0x2d0f41[_0x468643[_0x362eeb[_0x295b10][_0x96ea('0x6b')]]]=_0x362eeb[_0x295b10][_0x96ea('0x6f')];}}for(var _0x5ecf7f in _0x468643){if(!_0x2d0f41[_0x96ea('0x3b')](_0x468643[_0x5ecf7f])){_0x2d0f41[_0x468643[_0x5ecf7f]]=null;}}_0x467740[_0x96ea('0x70')](_0x2d0f41);}return _0x467740;}})['then'](function(_0x42a085){if(!_[_0x96ea('0x71')](_0x42a085)){var _0x5ef086=toCsv(_0x42a085);var _0x370cbe=Date[_0x96ea('0x72')]();fs[_0x96ea('0x73')](util[_0x96ea('0x74')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1906c0[_0x96ea('0x4b')]['id'],_0x370cbe),_0x5ef086);_0x2691c4[_0x96ea('0x75')](_0x96ea('0x76'),_0x96ea('0x77')+util[_0x96ea('0x74')](_0x96ea('0x78'),_0x1906c0['params']['id'],_0x370cbe));_0x2691c4[_0x96ea('0x75')]('Content-type','text/csv');return _0x2691c4[_0x96ea('0x79')](util[_0x96ea('0x74')](_0x96ea('0x7a'),_0x1906c0[_0x96ea('0x4b')]['id'],_0x370cbe));}else{return _0x2691c4['sendStatus'](0xcc);}})['catch'](handleError(_0x2691c4,null));}; \ No newline at end of file +var _0x6017=['pick','filter','merge','include','findAll','show','params','rawAttributes','length','includeAll','options','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','error','clone','omit','createdAt','updatedAt','create','getSessions','findOne','ProjectId','JscriptySessionReport','rows','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','parse','startTime','questionId','question','starttime','SessionId','answer','push','isEmpty','now','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','download','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','Projects','name','send','index','map','JscriptyProject','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x44145a,_0x27a17a){var _0x4c275c=function(_0xb1d6a3){while(--_0xb1d6a3){_0x44145a['push'](_0x44145a['shift']());}};_0x4c275c(++_0x27a17a);}(_0x6017,0xae));var _0x7601=function(_0x1d5d6b,_0xd3fe17){_0x1d5d6b=_0x1d5d6b-0x0;var _0x5b3164=_0x6017[_0x1d5d6b];return _0x5b3164;};'use strict';var emlformat=require(_0x7601('0x0'));var rimraf=require(_0x7601('0x1'));var zipdir=require(_0x7601('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7601('0x3'));var moment=require(_0x7601('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7601('0x5'));var util=require('util');var path=require(_0x7601('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7601('0x7'));var fs=require('fs');var fs_extra=require(_0x7601('0x8'));var _=require(_0x7601('0x9'));var squel=require(_0x7601('0xa'));var crypto=require(_0x7601('0xb'));var jsforce=require(_0x7601('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7601('0xd'));var querystring=require(_0x7601('0xe'));var Papa=require(_0x7601('0xf'));var Redis=require('ioredis');var authService=require(_0x7601('0x10'));var qs=require(_0x7601('0x11'));var as=require(_0x7601('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7601('0x13'))(_0x7601('0x14'));var utils=require(_0x7601('0x15'));var config=require(_0x7601('0x16'));var licenseUtil=require(_0x7601('0x17'));var db=require(_0x7601('0x18'))['db'];function respondWithStatusCode(_0x4001af,_0x1e2027){_0x1e2027=_0x1e2027||0xcc;return function(_0x2f5dbf){if(_0x2f5dbf){return _0x4001af[_0x7601('0x19')](_0x1e2027);}return _0x4001af['status'](_0x1e2027)[_0x7601('0x1a')]();};}function respondWithResult(_0x5ee63a,_0x4be36a){_0x4be36a=_0x4be36a||0xc8;return function(_0x2b8cbc){if(_0x2b8cbc){return _0x5ee63a[_0x7601('0x1b')](_0x4be36a)[_0x7601('0x1c')](_0x2b8cbc);}};}function respondWithFilteredResult(_0x33452d,_0x30b86d){return function(_0x3a1706){if(_0x3a1706){var _0xdd9b16=typeof _0x30b86d[_0x7601('0x1d')]==='undefined'&&typeof _0x30b86d[_0x7601('0x1e')]===_0x7601('0x1f');var _0x5329e6=_0x3a1706[_0x7601('0x20')];var _0x5c3fb7=_0xdd9b16?0x0:_0x30b86d['offset'];var _0x22520e=_0xdd9b16?_0x3a1706[_0x7601('0x20')]:_0x30b86d[_0x7601('0x1d')]+_0x30b86d[_0x7601('0x1e')];var _0x26f1b8;if(_0x22520e>=_0x5329e6){_0x22520e=_0x5329e6;_0x26f1b8=0xc8;}else{_0x26f1b8=0xce;}_0x33452d[_0x7601('0x1b')](_0x26f1b8);return _0x33452d[_0x7601('0x21')]('Content-Range',_0x5c3fb7+'-'+_0x22520e+'/'+_0x5329e6)[_0x7601('0x1c')](_0x3a1706);}return null;};}function patchUpdates(_0x1d58c0){return function(_0x4ed321){try{jsonpatch[_0x7601('0x22')](_0x4ed321,_0x1d58c0,!![]);}catch(_0x5169c9){return BPromise[_0x7601('0x23')](_0x5169c9);}return _0x4ed321[_0x7601('0x24')]();};}function saveUpdates(_0x99ab5b,_0x12f3f6){return function(_0x4cbf1e){if(_0x4cbf1e){return _0x4cbf1e[_0x7601('0x25')](_0x99ab5b)[_0x7601('0x26')](function(_0x140547){return _0x140547;});}return null;};}function removeEntity(_0x3a3629,_0x57e7a6){return function(_0x2b9bd){if(_0x2b9bd){return _0x2b9bd['destroy']()[_0x7601('0x26')](function(){var _0x561f58=_0x2b9bd['get']({'plain':!![]});var _0x326f8f=_0x7601('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x326f8f,'resourceId':_0x561f58['id']}})[_0x7601('0x26')](function(){return _0x2b9bd;});})['then'](function(){_0x3a3629['status'](0xcc)[_0x7601('0x1a')]();});}};}function handleEntityNotFound(_0x3501ec,_0xe9582b){return function(_0x5807ce){if(!_0x5807ce){_0x3501ec[_0x7601('0x19')](0x194);}return _0x5807ce;};}function handleError(_0x4a2321,_0x3f49b2){_0x3f49b2=_0x3f49b2||0x1f4;return function(_0xa05dda){logger['error'](_0xa05dda['stack']);if(_0xa05dda[_0x7601('0x28')]){delete _0xa05dda[_0x7601('0x28')];}_0x4a2321[_0x7601('0x1b')](_0x3f49b2)[_0x7601('0x29')](_0xa05dda);};}exports[_0x7601('0x2a')]=function(_0x29f34b,_0x5b961c){var _0x497f5f={},_0x27f423={},_0x170d27={'count':0x0,'rows':[]};var _0xa483c4=_[_0x7601('0x2b')](db[_0x7601('0x2c')]['rawAttributes'],function(_0x5ceb46){return{'name':_0x5ceb46[_0x7601('0x2d')],'type':_0x5ceb46[_0x7601('0x2e')][_0x7601('0x2f')]};});_0x27f423[_0x7601('0x30')]=_[_0x7601('0x2b')](_0xa483c4,'name');_0x27f423[_0x7601('0x31')]=_[_0x7601('0x32')](_0x29f34b['query']);_0x27f423[_0x7601('0x33')]=_[_0x7601('0x34')](_0x27f423[_0x7601('0x30')],_0x27f423[_0x7601('0x31')]);_0x497f5f[_0x7601('0x35')]=_['intersection'](_0x27f423[_0x7601('0x30')],qs[_0x7601('0x36')](_0x29f34b[_0x7601('0x31')][_0x7601('0x36')]));_0x497f5f['attributes']=_0x497f5f[_0x7601('0x35')]['length']?_0x497f5f['attributes']:_0x27f423[_0x7601('0x30')];if(!_0x29f34b[_0x7601('0x31')][_0x7601('0x37')](_0x7601('0x38'))){_0x497f5f[_0x7601('0x1e')]=qs[_0x7601('0x1e')](_0x29f34b[_0x7601('0x31')][_0x7601('0x1e')]);_0x497f5f[_0x7601('0x1d')]=qs[_0x7601('0x1d')](_0x29f34b[_0x7601('0x31')][_0x7601('0x1d')]);}_0x497f5f[_0x7601('0x39')]=qs[_0x7601('0x3a')](_0x29f34b['query'][_0x7601('0x3a')]);_0x497f5f[_0x7601('0x3b')]=qs[_0x7601('0x33')](_[_0x7601('0x3c')](_0x29f34b[_0x7601('0x31')],_0x27f423[_0x7601('0x33')]),_0xa483c4);if(_0x29f34b['query'][_0x7601('0x3d')]){_0x497f5f[_0x7601('0x3b')]=_['merge'](_0x497f5f[_0x7601('0x3b')],{'$or':_['map'](_0xa483c4,function(_0x2e9017){if(_0x2e9017['type']!=='VIRTUAL'){var _0x4eefe6={};_0x4eefe6[_0x2e9017[_0x7601('0x28')]]={'$like':'%'+_0x29f34b[_0x7601('0x31')][_0x7601('0x3d')]+'%'};return _0x4eefe6;}})});}_0x497f5f=_[_0x7601('0x3e')]({},_0x497f5f,_0x29f34b['options']);var _0x2c46a5={'where':_0x497f5f['where']};return db[_0x7601('0x2c')][_0x7601('0x20')](_0x2c46a5)[_0x7601('0x26')](function(_0xdf4ed){_0x170d27[_0x7601('0x20')]=_0xdf4ed;if(_0x29f34b[_0x7601('0x31')]['includeAll']){_0x497f5f[_0x7601('0x3f')]=[{'all':!![]}];}return db['JscriptyProject'][_0x7601('0x40')](_0x497f5f);})[_0x7601('0x26')](function(_0x58fd23){_0x170d27['rows']=_0x58fd23;return _0x170d27;})['then'](respondWithFilteredResult(_0x5b961c,_0x497f5f))['catch'](handleError(_0x5b961c,null));};exports[_0x7601('0x41')]=function(_0x1958d6,_0x337a25){var _0x458a4e={'raw':![],'where':{'id':_0x1958d6[_0x7601('0x42')]['id']}},_0x248ab7={};_0x248ab7[_0x7601('0x30')]=_[_0x7601('0x32')](db[_0x7601('0x2c')][_0x7601('0x43')]);_0x248ab7[_0x7601('0x31')]=_[_0x7601('0x32')](_0x1958d6[_0x7601('0x31')]);_0x248ab7[_0x7601('0x33')]=_[_0x7601('0x34')](_0x248ab7[_0x7601('0x30')],_0x248ab7['query']);_0x458a4e[_0x7601('0x35')]=_[_0x7601('0x34')](_0x248ab7[_0x7601('0x30')],qs[_0x7601('0x36')](_0x1958d6[_0x7601('0x31')]['fields']));_0x458a4e[_0x7601('0x35')]=_0x458a4e['attributes'][_0x7601('0x44')]?_0x458a4e[_0x7601('0x35')]:_0x248ab7['model'];if(_0x1958d6['query'][_0x7601('0x45')]){_0x458a4e[_0x7601('0x3f')]=[{'all':!![]}];}_0x458a4e=_[_0x7601('0x3e')]({},_0x458a4e,_0x1958d6[_0x7601('0x46')]);return db[_0x7601('0x2c')][_0x7601('0x47')](_0x458a4e)['then'](handleEntityNotFound(_0x337a25,null))[_0x7601('0x26')](respondWithResult(_0x337a25,null))['catch'](handleError(_0x337a25,null));};exports['create']=function(_0x2c3b10,_0x16c01c){return db[_0x7601('0x2c')]['create'](_0x2c3b10[_0x7601('0x48')],{})[_0x7601('0x26')](function(_0x5892d7){var _0x3a5046=_0x2c3b10[_0x7601('0x49')][_0x7601('0x4a')]({'plain':!![]});if(!_0x3a5046)throw new Error(_0x7601('0x4b'));if(_0x3a5046[_0x7601('0x4c')]===_0x7601('0x49')){var _0x25582b=_0x5892d7['get']({'plain':!![]});var _0x12b31d=_0x7601('0x27');return db[_0x7601('0x4d')]['find']({'where':{'name':_0x12b31d,'userProfileId':_0x3a5046[_0x7601('0x4e')]},'raw':!![]})[_0x7601('0x26')](function(_0x40a8b6){if(_0x40a8b6&&_0x40a8b6[_0x7601('0x4f')]===0x0){return db[_0x7601('0x50')]['create']({'name':_0x25582b[_0x7601('0x28')],'resourceId':_0x25582b['id'],'type':_0x40a8b6[_0x7601('0x28')],'sectionId':_0x40a8b6['id']},{})[_0x7601('0x26')](function(){return _0x5892d7;});}else{return _0x5892d7;}})[_0x7601('0x51')](function(_0x261eb3){logger[_0x7601('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x261eb3);throw _0x261eb3;});}return _0x5892d7;})[_0x7601('0x26')](respondWithResult(_0x16c01c,0xc9))[_0x7601('0x51')](handleError(_0x16c01c,null));};exports[_0x7601('0x53')]=function(_0x283bc9,_0x5d9770){var _0x1615f3={'where':{'id':_0x283bc9[_0x7601('0x42')]['id']}},_0x1b5aec={};_0x1b5aec[_0x7601('0x30')]=_[_0x7601('0x32')](db[_0x7601('0x2c')][_0x7601('0x43')]);_0x1615f3[_0x7601('0x35')]=_[_0x7601('0x34')](_0x1b5aec[_0x7601('0x30')],qs[_0x7601('0x36')](_0x283bc9[_0x7601('0x31')][_0x7601('0x36')]));_0x1615f3['attributes']=_0x1615f3[_0x7601('0x35')]['length']?_0x1615f3['attributes']:_0x1b5aec[_0x7601('0x30')];if(_0x283bc9[_0x7601('0x31')][_0x7601('0x45')]){_0x1615f3[_0x7601('0x3f')]=[{'all':!![]}];}_0x1615f3=_[_0x7601('0x3e')]({},_0x1615f3,_0x283bc9[_0x7601('0x46')]);return db[_0x7601('0x2c')][_0x7601('0x47')](_0x1615f3)['then'](handleEntityNotFound(_0x5d9770,null))[_0x7601('0x26')](function(_0x242c9f){if(_0x242c9f){var _0x271126=_0x242c9f[_0x7601('0x4a')]({'plain':!![]});_0x271126=qs[_0x7601('0x54')](_0x271126,['id',_0x7601('0x55'),_0x7601('0x56')]);_0x283bc9['body']=_[_0x7601('0x54')](_0x283bc9['body'],['id',_0x7601('0x55'),'updatedAt']);return db[_0x7601('0x2c')][_0x7601('0x57')](_[_0x7601('0x3e')](_0x271126,_0x283bc9[_0x7601('0x48')]),{'include':_0x283bc9[_0x7601('0x31')][_0x7601('0x45')]?[{'all':!![]}]:undefined})[_0x7601('0x26')](function(_0x1c3224){var _0x108350=_0x283bc9[_0x7601('0x49')]['get']({'plain':!![]});if(!_0x108350)throw new Error(_0x7601('0x4b'));if(_0x108350[_0x7601('0x4c')]===_0x7601('0x49')){var _0x18dfa7=_0x1c3224[_0x7601('0x4a')]({'plain':!![]});var _0x5978db=_0x7601('0x27');return db[_0x7601('0x4d')][_0x7601('0x47')]({'where':{'name':_0x5978db,'userProfileId':_0x108350[_0x7601('0x4e')]},'raw':!![]})[_0x7601('0x26')](function(_0xab4d1){if(_0xab4d1&&_0xab4d1[_0x7601('0x4f')]===0x0){return db[_0x7601('0x50')][_0x7601('0x57')]({'name':_0x18dfa7[_0x7601('0x28')],'resourceId':_0x18dfa7['id'],'type':_0xab4d1[_0x7601('0x28')],'sectionId':_0xab4d1['id']},{})[_0x7601('0x26')](function(){return _0x1c3224;});}else{return _0x1c3224;}})[_0x7601('0x51')](function(_0x2cf2c9){logger[_0x7601('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cf2c9);throw _0x2cf2c9;});}return _0x1c3224;});}})[_0x7601('0x26')](respondWithResult(_0x5d9770,0xc9))['catch'](handleError(_0x5d9770,null));};exports[_0x7601('0x25')]=function(_0x396b8f,_0x1eabe5){if(_0x396b8f[_0x7601('0x48')]['id']){delete _0x396b8f[_0x7601('0x48')]['id'];}return db[_0x7601('0x2c')][_0x7601('0x47')]({'where':{'id':_0x396b8f['params']['id']}})[_0x7601('0x26')](handleEntityNotFound(_0x1eabe5,null))[_0x7601('0x26')](saveUpdates(_0x396b8f[_0x7601('0x48')],null))[_0x7601('0x26')](respondWithResult(_0x1eabe5,null))[_0x7601('0x51')](handleError(_0x1eabe5,null));};exports['destroy']=function(_0x5ec33a,_0x355079){return db[_0x7601('0x2c')]['find']({'where':{'id':_0x5ec33a[_0x7601('0x42')]['id']}})['then'](handleEntityNotFound(_0x355079,null))['then'](removeEntity(_0x355079,null))[_0x7601('0x51')](handleError(_0x355079,null));};exports[_0x7601('0x58')]=function(_0x543767,_0x274d49,_0x55d9d5){var _0x5f4d58={'raw':!![],'where':{}};var _0xcebbc1={};var _0x53edd8={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x7601('0x59')]({'where':{'id':_0x543767[_0x7601('0x42')]['id']}})[_0x7601('0x26')](handleEntityNotFound(_0x274d49,null))[_0x7601('0x26')](function(_0x9ec15c){if(_0x9ec15c){_0xcebbc1['model']=_[_0x7601('0x32')](db['JscriptySessionReport'][_0x7601('0x43')]);_0xcebbc1[_0x7601('0x31')]=_[_0x7601('0x32')](_0x543767[_0x7601('0x31')]);_0xcebbc1[_0x7601('0x33')]=_['intersection'](_0xcebbc1[_0x7601('0x30')],_0xcebbc1[_0x7601('0x31')]);_0x5f4d58['attributes']=_['intersection'](_0xcebbc1[_0x7601('0x30')],qs[_0x7601('0x36')](_0x543767[_0x7601('0x31')][_0x7601('0x36')]));_0x5f4d58[_0x7601('0x35')]=_0x5f4d58[_0x7601('0x35')]['length']?_0x5f4d58['attributes']:_0xcebbc1[_0x7601('0x30')];if(!_0x543767['query'][_0x7601('0x37')](_0x7601('0x38'))){_0x5f4d58[_0x7601('0x1e')]=qs[_0x7601('0x1e')](_0x543767[_0x7601('0x31')][_0x7601('0x1e')]);_0x5f4d58[_0x7601('0x1d')]=qs[_0x7601('0x1d')](_0x543767['query'][_0x7601('0x1d')]);}_0x5f4d58[_0x7601('0x39')]=qs[_0x7601('0x3a')](_0x543767[_0x7601('0x31')][_0x7601('0x3a')]);_0x5f4d58[_0x7601('0x3b')]=qs['filters'](_['pick'](_0x543767[_0x7601('0x31')],_0xcebbc1[_0x7601('0x33')]));_0x5f4d58[_0x7601('0x3b')][_0x7601('0x5a')]=_0x9ec15c['id'];if(_0x543767['query'][_0x7601('0x3d')]){_0x5f4d58[_0x7601('0x3b')]=_['merge'](_0x5f4d58[_0x7601('0x3b')],{'$or':_['map'](_0x5f4d58[_0x7601('0x35')],function(_0x24cd45){var _0xa7dd95={};_0xa7dd95[_0x24cd45]={'$like':'%'+_0x543767[_0x7601('0x31')][_0x7601('0x3d')]+'%'};return _0xa7dd95;})});}_0x5f4d58=_[_0x7601('0x3e')]({},_0x5f4d58,_0x543767[_0x7601('0x46')]);return db[_0x7601('0x5b')][_0x7601('0x20')]({'where':_0x5f4d58[_0x7601('0x3b')]})['then'](function(_0x3b33fd){_0x53edd8['count']=_0x3b33fd;if(_0x543767[_0x7601('0x31')][_0x7601('0x45')]){_0x5f4d58[_0x7601('0x3f')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x7601('0x40')](_0x5f4d58);})[_0x7601('0x26')](function(_0x1f8ae6){_0x53edd8[_0x7601('0x5c')]=_0x1f8ae6;return _0x53edd8;});}})[_0x7601('0x26')](respondWithFilteredResult(_0x274d49,_0x5f4d58))[_0x7601('0x51')](handleError(_0x274d49,null));};exports['getAnswers']=function(_0x571633,_0x4e9c69,_0x4ceaa1){var _0x450d50={'raw':!![],'where':{}};var _0x288990={};var _0x3b0fb1={'count':0x0,'rows':[]};return db[_0x7601('0x2c')][_0x7601('0x59')]({'where':{'id':_0x571633[_0x7601('0x42')]['id']}})['then'](handleEntityNotFound(_0x4e9c69,null))['then'](function(_0x20582c){if(_0x20582c){_0x288990['model']=_[_0x7601('0x32')](db['JscriptyAnswerReport'][_0x7601('0x43')]);_0x288990[_0x7601('0x31')]=_[_0x7601('0x32')](_0x571633[_0x7601('0x31')]);_0x288990['filters']=_['intersection'](_0x288990['model'],_0x288990[_0x7601('0x31')]);_0x450d50[_0x7601('0x35')]=_[_0x7601('0x34')](_0x288990[_0x7601('0x30')],qs['fields'](_0x571633[_0x7601('0x31')][_0x7601('0x36')]));_0x450d50['attributes']=_0x450d50[_0x7601('0x35')]['length']?_0x450d50[_0x7601('0x35')]:_0x288990['model'];if(!_0x571633[_0x7601('0x31')][_0x7601('0x37')](_0x7601('0x38'))){_0x450d50[_0x7601('0x1e')]=qs['limit'](_0x571633['query']['limit']);_0x450d50[_0x7601('0x1d')]=qs[_0x7601('0x1d')](_0x571633[_0x7601('0x31')][_0x7601('0x1d')]);}_0x450d50['order']=qs[_0x7601('0x3a')](_0x571633[_0x7601('0x31')][_0x7601('0x3a')]);_0x450d50[_0x7601('0x3b')]=qs['filters'](_[_0x7601('0x3c')](_0x571633[_0x7601('0x31')],_0x288990[_0x7601('0x33')]));_0x450d50[_0x7601('0x3b')]['ProjectId']=_0x20582c['id'];if(_0x571633[_0x7601('0x31')][_0x7601('0x3d')]){_0x450d50['where']=_[_0x7601('0x3e')](_0x450d50['where'],{'$or':_[_0x7601('0x2b')](_0x450d50[_0x7601('0x35')],function(_0x399b92){var _0x3fba3d={};_0x3fba3d[_0x399b92]={'$like':'%'+_0x571633['query']['filter']+'%'};return _0x3fba3d;})});}_0x450d50=_[_0x7601('0x3e')]({},_0x450d50,_0x571633[_0x7601('0x46')]);return db[_0x7601('0x5d')][_0x7601('0x20')]({'where':_0x450d50['where']})[_0x7601('0x26')](function(_0x197dcd){_0x3b0fb1[_0x7601('0x20')]=_0x197dcd;if(_0x571633['query']['includeAll']){_0x450d50[_0x7601('0x3f')]=[{'all':!![]}];}return db[_0x7601('0x5d')]['findAll'](_0x450d50);})[_0x7601('0x26')](function(_0x23f4fc){_0x3b0fb1[_0x7601('0x5c')]=_0x23f4fc;return _0x3b0fb1;});}})[_0x7601('0x26')](respondWithFilteredResult(_0x4e9c69,_0x450d50))[_0x7601('0x51')](handleError(_0x4e9c69,null));};function char(_0x317184){return _0x7601('0x5e')===typeof _0x317184?String[_0x7601('0x5f')][_0x7601('0x22')](null,arguments):_0x317184;}function needsEncapsulation(_0x15f2d9){return!!_0x15f2d9&&(_0x15f2d9[_0x7601('0x60')]()['indexOf'](char(0xd))>=0x0||_0x15f2d9[_0x7601('0x60')]()[_0x7601('0x61')](char(0xa))>=0x0||_0x15f2d9['toString']()[_0x7601('0x61')](char(0x2c))>=0x0||_0x15f2d9['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x114dce){var _0x3ad441=char(0x22),_0x15e1e5='\x5c'+char(0x22),_0x179cc2=_0x114dce[_0x7601('0x60')]()[_0x7601('0x62')](new RegExp(_0x3ad441,'g'),_0x15e1e5);return _0x3ad441+_0x179cc2+_0x3ad441;}exports[_0x7601('0x63')]=function(_0x1a9af7,_0x396d25,_0x384318){var _0x508f7f,_0x62d77f;var _0x1ecc5c={'where':{'ProjectId':_0x1a9af7['params']['id']}};if(_0x1a9af7[_0x7601('0x31')]['startTime']){_0x1ecc5c[_0x7601('0x3b')]['starttime']=JSON[_0x7601('0x64')](_0x1a9af7[_0x7601('0x31')][_0x7601('0x65')]);}return db[_0x7601('0x5b')][_0x7601('0x40')](_0x1ecc5c)[_0x7601('0x26')](handleEntityNotFound(_0x396d25,null))[_0x7601('0x26')](function(_0x450e35){if(_0x450e35){_0x508f7f=_0x450e35;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x7601('0x2b')](_0x508f7f,'id')},'ProjectId':_0x1a9af7[_0x7601('0x42')]['id']},'order':'-createdAt'});}})[_0x7601('0x26')](handleEntityNotFound(_0x396d25,null))[_0x7601('0x26')](function(_0x1ca467){if(_0x1ca467){_0x62d77f=_0x1ca467;var _0x2c01f1={};for(var _0x7d2293=0x0,_0x293f1d=_0x62d77f[_0x7601('0x44')];_0x7d2293<_0x293f1d;_0x7d2293++){if(!_0x2c01f1[_0x7601('0x37')](_0x62d77f[_0x7d2293]['questionId'])){_0x2c01f1[_0x62d77f[_0x7d2293][_0x7601('0x66')]]=needsEncapsulation(_0x62d77f[_0x7d2293][_0x7601('0x67')])?encapsulate(_0x62d77f[_0x7d2293][_0x7601('0x67')]):_0x62d77f[_0x7d2293][_0x7601('0x67')];}}var _0x19bebb=[],_0x5d2a96={};for(var _0x3993ef=0x0,_0x31ac34=_0x508f7f[_0x7601('0x44')];_0x3993ef<_0x31ac34;_0x3993ef++){_0x5d2a96={'ProjectId':_0x1a9af7[_0x7601('0x42')]['id'],'SessionId':_0x508f7f[_0x3993ef]['id'],'StartTime':moment(_0x508f7f[_0x3993ef][_0x7601('0x68')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x403d48=0x0,_0xfffbb4=_0x62d77f[_0x7601('0x44')];_0x403d48<_0xfffbb4;_0x403d48++){if(_0x62d77f[_0x403d48][_0x7601('0x69')]==_0x508f7f[_0x3993ef]['id']&&_0x2c01f1[_0x7601('0x37')](_0x62d77f[_0x403d48]['questionId'])){_0x5d2a96[_0x2c01f1[_0x62d77f[_0x403d48][_0x7601('0x66')]]]=_0x62d77f[_0x403d48][_0x7601('0x6a')];}}for(var _0x37cd8e in _0x2c01f1){if(!_0x5d2a96[_0x7601('0x37')](_0x2c01f1[_0x37cd8e])){_0x5d2a96[_0x2c01f1[_0x37cd8e]]=null;}}_0x19bebb[_0x7601('0x6b')](_0x5d2a96);}return _0x19bebb;}})[_0x7601('0x26')](function(_0x43a8b0){if(!_[_0x7601('0x6c')](_0x43a8b0)){var _0x5d84dd=toCsv(_0x43a8b0);var _0x5620f2=Date[_0x7601('0x6d')]();fs['writeFileSync'](util[_0x7601('0x6e')](_0x7601('0x6f'),_0x1a9af7['params']['id'],_0x5620f2),_0x5d84dd);_0x396d25['setHeader']('Content-disposition',_0x7601('0x70')+util['format'](_0x7601('0x71'),_0x1a9af7['params']['id'],_0x5620f2));_0x396d25[_0x7601('0x72')](_0x7601('0x73'),'text/csv');return _0x396d25[_0x7601('0x74')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1a9af7['params']['id'],_0x5620f2));}else{return _0x396d25['sendStatus'](0xcc);}})[_0x7601('0x51')](handleError(_0x396d25,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 8e77d4b..252f747 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 _0xe1dc=['request-promise','rimraf','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3d93ae,_0x2e7a5d){var _0x563fe2=function(_0x35920f){while(--_0x35920f){_0x3d93ae['push'](_0x3d93ae['shift']());}};_0x563fe2(++_0x2e7a5d);}(_0xe1dc,0x8a));var _0xce1d=function(_0x41b94d,_0x197fd1){_0x41b94d=_0x41b94d-0x0;var _0x4274a3=_0xe1dc[_0x41b94d];return _0x4274a3;};'use strict';var _=require(_0xce1d('0x0'));var util=require(_0xce1d('0x1'));var logger=require(_0xce1d('0x2'))(_0xce1d('0x3'));var moment=require(_0xce1d('0x4'));var BPromise=require(_0xce1d('0x5'));var rp=require(_0xce1d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xce1d('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0xce1d('0x8')]=function(_0x232005,_0x2782b7){return _0x232005[_0xce1d('0x9')](_0xce1d('0xa'),attributes,{'tableName':_0xce1d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5294=['api','moment','bluebird','path','rimraf','../../config/environment','exports','define','jscripty_projects','lodash','util','../../config/logger'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x5294,0x111));var _0x4529=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x5294[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x4529('0x0'));var util=require(_0x4529('0x1'));var logger=require(_0x4529('0x2'))(_0x4529('0x3'));var moment=require(_0x4529('0x4'));var BPromise=require(_0x4529('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4529('0x6'));var rimraf=require(_0x4529('0x7'));var config=require(_0x4529('0x8'));var attributes=require('./jscriptyProject.attributes');module[_0x4529('0x9')]=function(_0x2c78e9,_0x10192d){return _0x2c78e9[_0x4529('0xa')]('JscriptyProject',attributes,{'tableName':_0x4529('0xb'),'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 8f06497..e012b8d 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0xda3f,0xec));var _0xfda3=function(_0x25c77b,_0x23dea4){_0x25c77b=_0x25c77b-0x0;var _0x2d041a=_0xda3f[_0x25c77b];return _0x2d041a;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xac4a,0x13f));var _0xaac4=function(_0x3cbae8,_0x212271){_0x3cbae8=_0x3cbae8-0x0;var _0x4375ea=_0xac4a[_0x3cbae8];return _0x4375ea;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index b4d6411..3ba32e7 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 _0x4c77=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','describe','show','post','create','put','/:id','delete','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x47a12a,_0x70f591){var _0x30cd40=function(_0x46b68f){while(--_0x46b68f){_0x47a12a['push'](_0x47a12a['shift']());}};_0x30cd40(++_0x70f591);}(_0x4c77,0x72));var _0x74c7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4c77[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x74c7('0x0'));var util=require(_0x74c7('0x1'));var path=require(_0x74c7('0x2'));var timeout=require(_0x74c7('0x3'));var express=require('express');var router=express[_0x74c7('0x4')]();var fs_extra=require(_0x74c7('0x5'));var auth=require(_0x74c7('0x6'));var interaction=require(_0x74c7('0x7'));var config=require(_0x74c7('0x8'));var controller=require(_0x74c7('0x9'));router[_0x74c7('0xa')]('/',auth[_0x74c7('0xb')](),controller['index']);router[_0x74c7('0xa')]('/describe',auth[_0x74c7('0xb')](),controller[_0x74c7('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x74c7('0xd')]);router[_0x74c7('0xe')]('/',auth[_0x74c7('0xb')](),controller[_0x74c7('0xf')]);router[_0x74c7('0x10')](_0x74c7('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x74c7('0x12')](_0x74c7('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x74c7('0x13')]=router; \ No newline at end of file +var _0x7d0d=['post','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x51df00,_0x4ac573){var _0x198328=function(_0x24e0ec){while(--_0x24e0ec){_0x51df00['push'](_0x51df00['shift']());}};_0x198328(++_0x4ac573);}(_0x7d0d,0x159));var _0xd7d0=function(_0x383191,_0xfe4dea){_0x383191=_0x383191-0x0;var _0x2ebeef=_0x7d0d[_0x383191];return _0x2ebeef;};'use strict';var multer=require('multer');var util=require(_0xd7d0('0x0'));var path=require(_0xd7d0('0x1'));var timeout=require(_0xd7d0('0x2'));var express=require(_0xd7d0('0x3'));var router=express[_0xd7d0('0x4')]();var fs_extra=require(_0xd7d0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd7d0('0x6'));var config=require(_0xd7d0('0x7'));var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0xd7d0('0x8')](),controller[_0xd7d0('0x9')]);router[_0xd7d0('0xa')](_0xd7d0('0xb'),auth[_0xd7d0('0x8')](),controller[_0xd7d0('0xc')]);router[_0xd7d0('0xa')](_0xd7d0('0xd'),auth['isAuthenticated'](),controller[_0xd7d0('0xe')]);router[_0xd7d0('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd7d0('0x10')](_0xd7d0('0xd'),auth[_0xd7d0('0x8')](),controller['update']);router[_0xd7d0('0x11')](_0xd7d0('0xd'),auth[_0xd7d0('0x8')](),controller[_0xd7d0('0x12')]);module[_0xd7d0('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index c77d04b..dbcf1d6 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(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x7a54,0x106));var _0x47a5=function(_0x3e9ee0,_0x214be2){_0x3e9ee0=_0x3e9ee0-0x0;var _0x1fe9fc=_0x7a54[_0x3e9ee0];return _0x1fe9fc;};'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(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x7a54,0x106));var _0x47a5=function(_0x1d2b5d,_0x5bd904){_0x1d2b5d=_0x1d2b5d-0x0;var _0x5adbd8=_0x7a54[_0x1d2b5d];return _0x5adbd8;};'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 a934456..3dfad53 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 _0x092e=['fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','offset','undefined','count','limit','set','reject','update','destroy','then','sendStatus','error','stack','name','send','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','JscriptyQuestionReport','findAll','rows','catch','keys','rawAttributes','create','body','find','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x3c4702,_0x315207){var _0x186a83=function(_0x5a2786){while(--_0x5a2786){_0x3c4702['push'](_0x3c4702['shift']());}};_0x186a83(++_0x315207);}(_0x092e,0x1ad));var _0xe092=function(_0x4c7aa5,_0x408285){_0x4c7aa5=_0x4c7aa5-0x0;var _0x168532=_0x092e[_0x4c7aa5];return _0x168532;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe092('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe092('0x1'));var moment=require(_0xe092('0x2'));var BPromise=require(_0xe092('0x3'));var Mustache=require(_0xe092('0x4'));var util=require(_0xe092('0x5'));var path=require(_0xe092('0x6'));var sox=require(_0xe092('0x7'));var csv=require('to-csv');var ejs=require(_0xe092('0x8'));var fs=require('fs');var fs_extra=require(_0xe092('0x9'));var _=require(_0xe092('0xa'));var squel=require('squel');var crypto=require(_0xe092('0xb'));var jsforce=require(_0xe092('0xc'));var deskjs=require(_0xe092('0xd'));var toCsv=require(_0xe092('0xe'));var querystring=require(_0xe092('0xf'));var Papa=require('papaparse');var Redis=require(_0xe092('0x10'));var authService=require(_0xe092('0x11'));var qs=require(_0xe092('0x12'));var as=require(_0xe092('0x13'));var hardwareService=require(_0xe092('0x14'));var logger=require(_0xe092('0x15'))(_0xe092('0x16'));var utils=require(_0xe092('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c1e0d,_0x12319b){_0x12319b=_0x12319b||0xcc;return function(_0x3bb1d6){if(_0x3bb1d6){return _0x5c1e0d['sendStatus'](_0x12319b);}return _0x5c1e0d[_0xe092('0x18')](_0x12319b)[_0xe092('0x19')]();};}function respondWithResult(_0x2fba07,_0x475c52){_0x475c52=_0x475c52||0xc8;return function(_0x1ba42d){if(_0x1ba42d){return _0x2fba07[_0xe092('0x18')](_0x475c52)[_0xe092('0x1a')](_0x1ba42d);}};}function respondWithFilteredResult(_0x4cd907,_0x2cab0e){return function(_0x41a177){if(_0x41a177){var _0x2277ee=typeof _0x2cab0e[_0xe092('0x1b')]===_0xe092('0x1c')&&typeof _0x2cab0e['limit']===_0xe092('0x1c');var _0x297fad=_0x41a177[_0xe092('0x1d')];var _0x39e6b1=_0x2277ee?0x0:_0x2cab0e[_0xe092('0x1b')];var _0x502d33=_0x2277ee?_0x41a177['count']:_0x2cab0e['offset']+_0x2cab0e[_0xe092('0x1e')];var _0x5389f1;if(_0x502d33>=_0x297fad){_0x502d33=_0x297fad;_0x5389f1=0xc8;}else{_0x5389f1=0xce;}_0x4cd907[_0xe092('0x18')](_0x5389f1);return _0x4cd907[_0xe092('0x1f')]('Content-Range',_0x39e6b1+'-'+_0x502d33+'/'+_0x297fad)[_0xe092('0x1a')](_0x41a177);}return null;};}function patchUpdates(_0x135b15){return function(_0x33c1fb){try{jsonpatch['apply'](_0x33c1fb,_0x135b15,!![]);}catch(_0x1ba214){return BPromise[_0xe092('0x20')](_0x1ba214);}return _0x33c1fb['save']();};}function saveUpdates(_0x96ea74,_0x2d149d){return function(_0x596fa2){if(_0x596fa2){return _0x596fa2[_0xe092('0x21')](_0x96ea74)['then'](function(_0x2087ed){return _0x2087ed;});}return null;};}function removeEntity(_0x5457ac,_0x88cbf){return function(_0x311e28){if(_0x311e28){return _0x311e28[_0xe092('0x22')]()[_0xe092('0x23')](function(){_0x5457ac[_0xe092('0x18')](0xcc)[_0xe092('0x19')]();});}};}function handleEntityNotFound(_0x5d5020,_0x10e6b1){return function(_0x599ddf){if(!_0x599ddf){_0x5d5020[_0xe092('0x24')](0x194);}return _0x599ddf;};}function handleError(_0x7586b3,_0x22d2c7){_0x22d2c7=_0x22d2c7||0x1f4;return function(_0x283e6d){logger[_0xe092('0x25')](_0x283e6d[_0xe092('0x26')]);if(_0x283e6d[_0xe092('0x27')]){delete _0x283e6d['name'];}_0x7586b3[_0xe092('0x18')](_0x22d2c7)[_0xe092('0x28')](_0x283e6d);};}exports['index']=function(_0x3bb832,_0x57e8ae){var _0x1bc31a={},_0x4bb39c={},_0x2f3ab0={'count':0x0,'rows':[]};var _0x1bb1a7=_['map'](db['JscriptyQuestionReport']['rawAttributes'],function(_0x2b30c5){return{'name':_0x2b30c5['fieldName'],'type':_0x2b30c5[_0xe092('0x29')][_0xe092('0x2a')]};});_0x4bb39c[_0xe092('0x2b')]=_[_0xe092('0x2c')](_0x1bb1a7,_0xe092('0x27'));_0x4bb39c[_0xe092('0x2d')]=_['keys'](_0x3bb832[_0xe092('0x2d')]);_0x4bb39c[_0xe092('0x2e')]=_[_0xe092('0x2f')](_0x4bb39c[_0xe092('0x2b')],_0x4bb39c[_0xe092('0x2d')]);_0x1bc31a[_0xe092('0x30')]=_[_0xe092('0x2f')](_0x4bb39c['model'],qs['fields'](_0x3bb832[_0xe092('0x2d')][_0xe092('0x31')]));_0x1bc31a[_0xe092('0x30')]=_0x1bc31a['attributes'][_0xe092('0x32')]?_0x1bc31a[_0xe092('0x30')]:_0x4bb39c[_0xe092('0x2b')];if(!_0x3bb832[_0xe092('0x2d')][_0xe092('0x33')](_0xe092('0x34'))){_0x1bc31a[_0xe092('0x1e')]=qs[_0xe092('0x1e')](_0x3bb832[_0xe092('0x2d')][_0xe092('0x1e')]);_0x1bc31a[_0xe092('0x1b')]=qs[_0xe092('0x1b')](_0x3bb832['query'][_0xe092('0x1b')]);}_0x1bc31a[_0xe092('0x35')]=qs[_0xe092('0x36')](_0x3bb832[_0xe092('0x2d')][_0xe092('0x36')]);_0x1bc31a[_0xe092('0x37')]=qs['filters'](_[_0xe092('0x38')](_0x3bb832['query'],_0x4bb39c[_0xe092('0x2e')]),_0x1bb1a7);if(_0x3bb832[_0xe092('0x2d')]['filter']){_0x1bc31a[_0xe092('0x37')]=_[_0xe092('0x39')](_0x1bc31a[_0xe092('0x37')],{'$or':_['map'](_0x1bb1a7,function(_0x2a78e3){if(_0x2a78e3['type']!==_0xe092('0x3a')){var _0x29fb79={};_0x29fb79[_0x2a78e3[_0xe092('0x27')]]={'$like':'%'+_0x3bb832[_0xe092('0x2d')][_0xe092('0x3b')]+'%'};return _0x29fb79;}})});}_0x1bc31a=_[_0xe092('0x39')]({},_0x1bc31a,_0x3bb832[_0xe092('0x3c')]);var _0x3a034c={'where':_0x1bc31a['where']};return db['JscriptyQuestionReport'][_0xe092('0x1d')](_0x3a034c)[_0xe092('0x23')](function(_0x48bad9){_0x2f3ab0[_0xe092('0x1d')]=_0x48bad9;if(_0x3bb832[_0xe092('0x2d')][_0xe092('0x3d')]){_0x1bc31a[_0xe092('0x3e')]=[{'all':!![]}];}return db[_0xe092('0x3f')][_0xe092('0x40')](_0x1bc31a);})[_0xe092('0x23')](function(_0x26fa60){_0x2f3ab0[_0xe092('0x41')]=_0x26fa60;return _0x2f3ab0;})['then'](respondWithFilteredResult(_0x57e8ae,_0x1bc31a))[_0xe092('0x42')](handleError(_0x57e8ae,null));};exports['show']=function(_0x40dbe9,_0x1b4b60){var _0x4537f6={'raw':!![],'where':{'id':_0x40dbe9['params']['id']}},_0x385b56={};_0x385b56[_0xe092('0x2b')]=_[_0xe092('0x43')](db[_0xe092('0x3f')][_0xe092('0x44')]);_0x385b56[_0xe092('0x2d')]=_[_0xe092('0x43')](_0x40dbe9[_0xe092('0x2d')]);_0x385b56[_0xe092('0x2e')]=_[_0xe092('0x2f')](_0x385b56['model'],_0x385b56[_0xe092('0x2d')]);_0x4537f6[_0xe092('0x30')]=_['intersection'](_0x385b56[_0xe092('0x2b')],qs[_0xe092('0x31')](_0x40dbe9[_0xe092('0x2d')]['fields']));_0x4537f6[_0xe092('0x30')]=_0x4537f6['attributes'][_0xe092('0x32')]?_0x4537f6[_0xe092('0x30')]:_0x385b56[_0xe092('0x2b')];if(_0x40dbe9['query']['includeAll']){_0x4537f6[_0xe092('0x3e')]=[{'all':!![]}];}_0x4537f6=_['merge']({},_0x4537f6,_0x40dbe9[_0xe092('0x3c')]);return db['JscriptyQuestionReport']['find'](_0x4537f6)['then'](handleEntityNotFound(_0x1b4b60,null))[_0xe092('0x23')](respondWithResult(_0x1b4b60,null))['catch'](handleError(_0x1b4b60,null));};exports['create']=function(_0x9c74bb,_0x772470){return db[_0xe092('0x3f')][_0xe092('0x45')](_0x9c74bb[_0xe092('0x46')],{})[_0xe092('0x23')](respondWithResult(_0x772470,0xc9))['catch'](handleError(_0x772470,null));};exports['update']=function(_0x42d2ac,_0x6af0){if(_0x42d2ac[_0xe092('0x46')]['id']){delete _0x42d2ac['body']['id'];}return db['JscriptyQuestionReport'][_0xe092('0x47')]({'where':{'id':_0x42d2ac['params']['id']}})[_0xe092('0x23')](handleEntityNotFound(_0x6af0,null))['then'](saveUpdates(_0x42d2ac[_0xe092('0x46')],null))['then'](respondWithResult(_0x6af0,null))[_0xe092('0x42')](handleError(_0x6af0,null));};exports['destroy']=function(_0x32f525,_0x40cafb){return db[_0xe092('0x3f')][_0xe092('0x47')]({'where':{'id':_0x32f525['params']['id']}})[_0xe092('0x23')](handleEntityNotFound(_0x40cafb,null))[_0xe092('0x23')](removeEntity(_0x40cafb,null))[_0xe092('0x42')](handleError(_0x40cafb,null));};exports[_0xe092('0x48')]=function(_0x46f315,_0x5339a9){return db[_0xe092('0x3f')][_0xe092('0x48')]()[_0xe092('0x23')](respondWithResult(_0x5339a9,null))[_0xe092('0x42')](handleError(_0x5339a9,null));}; \ No newline at end of file +var _0x3cd1=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','show','includeAll','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','end','name','send','map','JscriptyQuestionReport','rawAttributes'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3cd1,0xfe));var _0x13cd=function(_0x2101a8,_0x4fdf0d){_0x2101a8=_0x2101a8-0x0;var _0x1f112d=_0x3cd1[_0x2101a8];return _0x1f112d;};'use strict';var emlformat=require(_0x13cd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x13cd('0x1'));var jsonpatch=require(_0x13cd('0x2'));var rp=require('request-promise');var moment=require(_0x13cd('0x3'));var BPromise=require(_0x13cd('0x4'));var Mustache=require(_0x13cd('0x5'));var util=require(_0x13cd('0x6'));var path=require(_0x13cd('0x7'));var sox=require(_0x13cd('0x8'));var csv=require(_0x13cd('0x9'));var ejs=require(_0x13cd('0xa'));var fs=require('fs');var fs_extra=require(_0x13cd('0xb'));var _=require('lodash');var squel=require(_0x13cd('0xc'));var crypto=require(_0x13cd('0xd'));var jsforce=require(_0x13cd('0xe'));var deskjs=require(_0x13cd('0xf'));var toCsv=require('to-csv');var querystring=require(_0x13cd('0x10'));var Papa=require(_0x13cd('0x11'));var Redis=require(_0x13cd('0x12'));var authService=require(_0x13cd('0x13'));var qs=require(_0x13cd('0x14'));var as=require(_0x13cd('0x15'));var hardwareService=require(_0x13cd('0x16'));var logger=require(_0x13cd('0x17'))(_0x13cd('0x18'));var utils=require(_0x13cd('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x13cd('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44d3a4,_0x4d13ca){_0x4d13ca=_0x4d13ca||0xcc;return function(_0x3d836d){if(_0x3d836d){return _0x44d3a4[_0x13cd('0x1b')](_0x4d13ca);}return _0x44d3a4[_0x13cd('0x1c')](_0x4d13ca)['end']();};}function respondWithResult(_0x304d49,_0x29ba76){_0x29ba76=_0x29ba76||0xc8;return function(_0x779183){if(_0x779183){return _0x304d49['status'](_0x29ba76)[_0x13cd('0x1d')](_0x779183);}};}function respondWithFilteredResult(_0x5c6f85,_0xbe7cea){return function(_0x2e4593){if(_0x2e4593){var _0x3bbbb0=typeof _0xbe7cea[_0x13cd('0x1e')]==='undefined'&&typeof _0xbe7cea[_0x13cd('0x1f')]===_0x13cd('0x20');var _0x121429=_0x2e4593[_0x13cd('0x21')];var _0x48de1f=_0x3bbbb0?0x0:_0xbe7cea[_0x13cd('0x1e')];var _0x1c61d7=_0x3bbbb0?_0x2e4593['count']:_0xbe7cea[_0x13cd('0x1e')]+_0xbe7cea[_0x13cd('0x1f')];var _0x359f27;if(_0x1c61d7>=_0x121429){_0x1c61d7=_0x121429;_0x359f27=0xc8;}else{_0x359f27=0xce;}_0x5c6f85[_0x13cd('0x1c')](_0x359f27);return _0x5c6f85[_0x13cd('0x22')](_0x13cd('0x23'),_0x48de1f+'-'+_0x1c61d7+'/'+_0x121429)[_0x13cd('0x1d')](_0x2e4593);}return null;};}function patchUpdates(_0x24bb50){return function(_0x485c8a){try{jsonpatch['apply'](_0x485c8a,_0x24bb50,!![]);}catch(_0x2702da){return BPromise[_0x13cd('0x24')](_0x2702da);}return _0x485c8a[_0x13cd('0x25')]();};}function saveUpdates(_0xe177dc,_0x41c298){return function(_0x4f48bc){if(_0x4f48bc){return _0x4f48bc['update'](_0xe177dc)[_0x13cd('0x26')](function(_0x48b832){return _0x48b832;});}return null;};}function removeEntity(_0xc87db1,_0x2435c8){return function(_0x5790f1){if(_0x5790f1){return _0x5790f1[_0x13cd('0x27')]()[_0x13cd('0x26')](function(){_0xc87db1['status'](0xcc)[_0x13cd('0x28')]();});}};}function handleEntityNotFound(_0x2a9c83,_0x305d50){return function(_0x16ed72){if(!_0x16ed72){_0x2a9c83[_0x13cd('0x1b')](0x194);}return _0x16ed72;};}function handleError(_0x3797f9,_0x5940bf){_0x5940bf=_0x5940bf||0x1f4;return function(_0x2d2d20){logger['error'](_0x2d2d20['stack']);if(_0x2d2d20['name']){delete _0x2d2d20[_0x13cd('0x29')];}_0x3797f9[_0x13cd('0x1c')](_0x5940bf)[_0x13cd('0x2a')](_0x2d2d20);};}exports['index']=function(_0x497371,_0x53db92){var _0x379e62={},_0x4d7e64={},_0x550611={'count':0x0,'rows':[]};var _0x5315a7=_[_0x13cd('0x2b')](db[_0x13cd('0x2c')][_0x13cd('0x2d')],function(_0xc1820b){return{'name':_0xc1820b[_0x13cd('0x2e')],'type':_0xc1820b[_0x13cd('0x2f')][_0x13cd('0x30')]};});_0x4d7e64[_0x13cd('0x31')]=_[_0x13cd('0x2b')](_0x5315a7,'name');_0x4d7e64[_0x13cd('0x32')]=_[_0x13cd('0x33')](_0x497371[_0x13cd('0x32')]);_0x4d7e64[_0x13cd('0x34')]=_[_0x13cd('0x35')](_0x4d7e64[_0x13cd('0x31')],_0x4d7e64[_0x13cd('0x32')]);_0x379e62[_0x13cd('0x36')]=_[_0x13cd('0x35')](_0x4d7e64[_0x13cd('0x31')],qs['fields'](_0x497371['query'][_0x13cd('0x37')]));_0x379e62['attributes']=_0x379e62[_0x13cd('0x36')][_0x13cd('0x38')]?_0x379e62['attributes']:_0x4d7e64[_0x13cd('0x31')];if(!_0x497371[_0x13cd('0x32')][_0x13cd('0x39')](_0x13cd('0x3a'))){_0x379e62[_0x13cd('0x1f')]=qs['limit'](_0x497371['query']['limit']);_0x379e62[_0x13cd('0x1e')]=qs[_0x13cd('0x1e')](_0x497371[_0x13cd('0x32')][_0x13cd('0x1e')]);}_0x379e62['order']=qs[_0x13cd('0x3b')](_0x497371[_0x13cd('0x32')]['sort']);_0x379e62[_0x13cd('0x3c')]=qs['filters'](_['pick'](_0x497371[_0x13cd('0x32')],_0x4d7e64[_0x13cd('0x34')]),_0x5315a7);if(_0x497371[_0x13cd('0x32')][_0x13cd('0x3d')]){_0x379e62['where']=_[_0x13cd('0x3e')](_0x379e62['where'],{'$or':_['map'](_0x5315a7,function(_0x31785c){if(_0x31785c[_0x13cd('0x2f')]!==_0x13cd('0x3f')){var _0x21d79e={};_0x21d79e[_0x31785c[_0x13cd('0x29')]]={'$like':'%'+_0x497371[_0x13cd('0x32')][_0x13cd('0x3d')]+'%'};return _0x21d79e;}})});}_0x379e62=_['merge']({},_0x379e62,_0x497371[_0x13cd('0x40')]);var _0x36eada={'where':_0x379e62[_0x13cd('0x3c')]};return db[_0x13cd('0x2c')][_0x13cd('0x21')](_0x36eada)[_0x13cd('0x26')](function(_0x31b7b9){_0x550611[_0x13cd('0x21')]=_0x31b7b9;if(_0x497371['query']['includeAll']){_0x379e62[_0x13cd('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x379e62);})[_0x13cd('0x26')](function(_0x54635e){_0x550611[_0x13cd('0x42')]=_0x54635e;return _0x550611;})[_0x13cd('0x26')](respondWithFilteredResult(_0x53db92,_0x379e62))[_0x13cd('0x43')](handleError(_0x53db92,null));};exports[_0x13cd('0x44')]=function(_0x912aac,_0x37da2e){var _0x52a139={'raw':!![],'where':{'id':_0x912aac['params']['id']}},_0x5829da={};_0x5829da['model']=_['keys'](db[_0x13cd('0x2c')]['rawAttributes']);_0x5829da[_0x13cd('0x32')]=_[_0x13cd('0x33')](_0x912aac[_0x13cd('0x32')]);_0x5829da[_0x13cd('0x34')]=_[_0x13cd('0x35')](_0x5829da[_0x13cd('0x31')],_0x5829da[_0x13cd('0x32')]);_0x52a139[_0x13cd('0x36')]=_[_0x13cd('0x35')](_0x5829da[_0x13cd('0x31')],qs['fields'](_0x912aac[_0x13cd('0x32')][_0x13cd('0x37')]));_0x52a139['attributes']=_0x52a139['attributes']['length']?_0x52a139[_0x13cd('0x36')]:_0x5829da[_0x13cd('0x31')];if(_0x912aac[_0x13cd('0x32')][_0x13cd('0x45')]){_0x52a139[_0x13cd('0x41')]=[{'all':!![]}];}_0x52a139=_[_0x13cd('0x3e')]({},_0x52a139,_0x912aac[_0x13cd('0x40')]);return db[_0x13cd('0x2c')]['find'](_0x52a139)[_0x13cd('0x26')](handleEntityNotFound(_0x37da2e,null))[_0x13cd('0x26')](respondWithResult(_0x37da2e,null))[_0x13cd('0x43')](handleError(_0x37da2e,null));};exports[_0x13cd('0x46')]=function(_0x2eeef1,_0x1c0acf){return db['JscriptyQuestionReport']['create'](_0x2eeef1[_0x13cd('0x47')],{})[_0x13cd('0x26')](respondWithResult(_0x1c0acf,0xc9))[_0x13cd('0x43')](handleError(_0x1c0acf,null));};exports['update']=function(_0x317685,_0x223e2f){if(_0x317685[_0x13cd('0x47')]['id']){delete _0x317685['body']['id'];}return db[_0x13cd('0x2c')][_0x13cd('0x48')]({'where':{'id':_0x317685[_0x13cd('0x49')]['id']}})[_0x13cd('0x26')](handleEntityNotFound(_0x223e2f,null))[_0x13cd('0x26')](saveUpdates(_0x317685['body'],null))[_0x13cd('0x26')](respondWithResult(_0x223e2f,null))[_0x13cd('0x43')](handleError(_0x223e2f,null));};exports['destroy']=function(_0x1bdfbb,_0x2b2e4b){return db[_0x13cd('0x2c')][_0x13cd('0x48')]({'where':{'id':_0x1bdfbb[_0x13cd('0x49')]['id']}})['then'](handleEntityNotFound(_0x2b2e4b,null))[_0x13cd('0x26')](removeEntity(_0x2b2e4b,null))[_0x13cd('0x43')](handleError(_0x2b2e4b,null));};exports[_0x13cd('0x4a')]=function(_0x985b6c,_0x3e58a7){return db['JscriptyQuestionReport'][_0x13cd('0x4a')]()[_0x13cd('0x26')](respondWithResult(_0x3e58a7,null))[_0x13cd('0x43')](handleError(_0x3e58a7,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index a1940e3..ffad993 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 _0xce82=['../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x520506,_0x193e4f){var _0x45c1bc=function(_0x1e55d3){while(--_0x1e55d3){_0x520506['push'](_0x520506['shift']());}};_0x45c1bc(++_0x193e4f);}(_0xce82,0xbc));var _0x2ce8=function(_0x321324,_0x5da231){_0x321324=_0x321324-0x0;var _0x8336d1=_0xce82[_0x321324];return _0x8336d1;};'use strict';var _=require(_0x2ce8('0x0'));var util=require(_0x2ce8('0x1'));var logger=require(_0x2ce8('0x2'))(_0x2ce8('0x3'));var moment=require('moment');var BPromise=require(_0x2ce8('0x4'));var rp=require(_0x2ce8('0x5'));var fs=require('fs');var path=require(_0x2ce8('0x6'));var rimraf=require('rimraf');var config=require(_0x2ce8('0x7'));var attributes=require(_0x2ce8('0x8'));module[_0x2ce8('0x9')]=function(_0x5986db,_0xf67e5c){return _0x5986db[_0x2ce8('0xa')](_0x2ce8('0xb'),attributes,{'tableName':_0x2ce8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb785=['exports','define','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0x4bfb8b,_0x10b39f){var _0x48f13c=function(_0x346d11){while(--_0x346d11){_0x4bfb8b['push'](_0x4bfb8b['shift']());}};_0x48f13c(++_0x10b39f);}(_0xb785,0x154));var _0x5b78=function(_0x16a701,_0x58f832){_0x16a701=_0x16a701-0x0;var _0x412830=_0xb785[_0x16a701];return _0x412830;};'use strict';var _=require('lodash');var util=require(_0x5b78('0x0'));var logger=require(_0x5b78('0x1'))(_0x5b78('0x2'));var moment=require(_0x5b78('0x3'));var BPromise=require(_0x5b78('0x4'));var rp=require(_0x5b78('0x5'));var fs=require('fs');var path=require(_0x5b78('0x6'));var rimraf=require(_0x5b78('0x7'));var config=require(_0x5b78('0x8'));var attributes=require(_0x5b78('0x9'));module[_0x5b78('0xa')]=function(_0x22b59b,_0x237ec3){return _0x22b59b[_0x5b78('0xb')](_0x5b78('0xc'),attributes,{'tableName':_0x5b78('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index e91ed99..0c8f0f0 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 _0x4f96=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x30fd84,_0x41c9e0){var _0x160be9=function(_0xdd139f){while(--_0xdd139f){_0x30fd84['push'](_0x30fd84['shift']());}};_0x160be9(++_0x41c9e0);}(_0x4f96,0xd7));var _0x64f9=function(_0x41bcb3,_0x1a0627){_0x41bcb3=_0x41bcb3-0x0;var _0x141019=_0x4f96[_0x41bcb3];return _0x141019;};'use strict';var _=require(_0x64f9('0x0'));var util=require(_0x64f9('0x1'));var moment=require('moment');var BPromise=require(_0x64f9('0x2'));var rs=require(_0x64f9('0x3'));var fs=require('fs');var Redis=require(_0x64f9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x64f9('0x5'));var logger=require(_0x64f9('0x6'))(_0x64f9('0x7'));var config=require(_0x64f9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x64f9('0x9')][_0x64f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42cc24,_0x303b55,_0x290948){return new BPromise(function(_0x1f42f7,_0x32b239){return client[_0x64f9('0xb')](_0x42cc24,_0x290948)[_0x64f9('0xc')](function(_0x2f4a9e){logger['info'](_0x64f9('0xd'),_0x303b55,_0x64f9('0xe'));logger['debug'](_0x64f9('0xf'),_0x303b55,'request\x20sent',JSON['stringify'](_0x2f4a9e));if(_0x2f4a9e[_0x64f9('0x10')]){if(_0x2f4a9e[_0x64f9('0x10')][_0x64f9('0x11')]===0x1f4){logger[_0x64f9('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x303b55,_0x2f4a9e[_0x64f9('0x10')]['message']);return _0x32b239(_0x2f4a9e[_0x64f9('0x10')][_0x64f9('0x12')]);}logger[_0x64f9('0x10')](_0x64f9('0xd'),_0x303b55,_0x2f4a9e[_0x64f9('0x10')][_0x64f9('0x12')]);return _0x1f42f7(_0x2f4a9e[_0x64f9('0x10')][_0x64f9('0x12')]);}else{logger[_0x64f9('0x13')](_0x64f9('0xd'),_0x303b55,_0x64f9('0xe'));_0x1f42f7(_0x2f4a9e[_0x64f9('0x14')]['message']);}})[_0x64f9('0x15')](function(_0x2f18e8){logger[_0x64f9('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x303b55,_0x2f18e8);_0x32b239(_0x2f18e8);});});} \ No newline at end of file +var _0xdd41=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0x520730,_0x512567){var _0x28b307=function(_0x2f5c2c){while(--_0x2f5c2c){_0x520730['push'](_0x520730['shift']());}};_0x28b307(++_0x512567);}(_0xdd41,0xcc));var _0x1dd4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd41[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1dd4('0x0'));var util=require(_0x1dd4('0x1'));var moment=require(_0x1dd4('0x2'));var BPromise=require(_0x1dd4('0x3'));var rs=require(_0x1dd4('0x4'));var fs=require('fs');var Redis=require(_0x1dd4('0x5'));var db=require(_0x1dd4('0x6'))['db'];var utils=require(_0x1dd4('0x7'));var logger=require(_0x1dd4('0x8'))(_0x1dd4('0x9'));var config=require(_0x1dd4('0xa'));var jayson=require(_0x1dd4('0xb'));var client=jayson[_0x1dd4('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36501a,_0x3c01e1,_0x12d5ca){return new BPromise(function(_0x423df4,_0x205708){return client['request'](_0x36501a,_0x12d5ca)['then'](function(_0x2a0ce6){logger[_0x1dd4('0xd')](_0x1dd4('0xe'),_0x3c01e1,_0x1dd4('0xf'));logger[_0x1dd4('0x10')](_0x1dd4('0x11'),_0x3c01e1,'request\x20sent',JSON[_0x1dd4('0x12')](_0x2a0ce6));if(_0x2a0ce6['error']){if(_0x2a0ce6[_0x1dd4('0x13')][_0x1dd4('0x14')]===0x1f4){logger[_0x1dd4('0x13')](_0x1dd4('0xe'),_0x3c01e1,_0x2a0ce6[_0x1dd4('0x13')][_0x1dd4('0x15')]);return _0x205708(_0x2a0ce6['error'][_0x1dd4('0x15')]);}logger[_0x1dd4('0x13')](_0x1dd4('0xe'),_0x3c01e1,_0x2a0ce6['error']['message']);return _0x423df4(_0x2a0ce6[_0x1dd4('0x13')][_0x1dd4('0x15')]);}else{logger[_0x1dd4('0xd')](_0x1dd4('0xe'),_0x3c01e1,_0x1dd4('0xf'));_0x423df4(_0x2a0ce6[_0x1dd4('0x16')]['message']);}})['catch'](function(_0xba13cc){logger[_0x1dd4('0x13')](_0x1dd4('0xe'),_0x3c01e1,_0xba13cc);_0x205708(_0xba13cc);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 3669dd0..4f6f41a 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 _0x7830=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','/describe','describe','isAuthenticated','show','getQuestions','post','/:id','exports','util','path','express','Router'];(function(_0x219536,_0x8e0b9b){var _0x231e4d=function(_0x37b376){while(--_0x37b376){_0x219536['push'](_0x219536['shift']());}};_0x231e4d(++_0x8e0b9b);}(_0x7830,0x119));var _0x0783=function(_0x33b147,_0x1450d8){_0x33b147=_0x33b147-0x0;var _0x461a75=_0x7830[_0x33b147];return _0x461a75;};'use strict';var multer=require('multer');var util=require(_0x0783('0x0'));var path=require(_0x0783('0x1'));var timeout=require('connect-timeout');var express=require(_0x0783('0x2'));var router=express[_0x0783('0x3')]();var fs_extra=require(_0x0783('0x4'));var auth=require(_0x0783('0x5'));var interaction=require(_0x0783('0x6'));var config=require(_0x0783('0x7'));var controller=require(_0x0783('0x8'));router[_0x0783('0x9')]('/',auth['isAuthenticated'](),controller[_0x0783('0xa')]);router['get'](_0x0783('0xb'),auth['isAuthenticated'](),controller[_0x0783('0xc')]);router[_0x0783('0x9')]('/:id',auth[_0x0783('0xd')](),controller[_0x0783('0xe')]);router[_0x0783('0x9')]('/:id/questions',auth[_0x0783('0xd')](),controller[_0x0783('0xf')]);router[_0x0783('0x10')]('/',auth[_0x0783('0xd')](),controller['create']);router['put'](_0x0783('0x11'),auth[_0x0783('0xd')](),controller['update']);router['delete'](_0x0783('0x11'),auth[_0x0783('0xd')](),controller['destroy']);module[_0x0783('0x12')]=router; \ No newline at end of file +var _0xadfa=['fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','/:id/questions','getQuestions','post','create','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x1cd71f,_0x2a9d19){var _0x33d362=function(_0x2ecb41){while(--_0x2ecb41){_0x1cd71f['push'](_0x1cd71f['shift']());}};_0x33d362(++_0x2a9d19);}(_0xadfa,0xd7));var _0xaadf=function(_0x3363cd,_0x309c9e){_0x3363cd=_0x3363cd-0x0;var _0x58965e=_0xadfa[_0x3363cd];return _0x58965e;};'use strict';var multer=require(_0xaadf('0x0'));var util=require(_0xaadf('0x1'));var path=require(_0xaadf('0x2'));var timeout=require('connect-timeout');var express=require(_0xaadf('0x3'));var router=express[_0xaadf('0x4')]();var fs_extra=require(_0xaadf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaadf('0x6'));var config=require(_0xaadf('0x7'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0xaadf('0x8')](),controller[_0xaadf('0x9')]);router[_0xaadf('0xa')]('/describe',auth[_0xaadf('0x8')](),controller[_0xaadf('0xb')]);router[_0xaadf('0xa')](_0xaadf('0xc'),auth[_0xaadf('0x8')](),controller[_0xaadf('0xd')]);router[_0xaadf('0xa')](_0xaadf('0xe'),auth[_0xaadf('0x8')](),controller[_0xaadf('0xf')]);router[_0xaadf('0x10')]('/',auth[_0xaadf('0x8')](),controller[_0xaadf('0x11')]);router['put']('/:id',auth[_0xaadf('0x8')](),controller[_0xaadf('0x12')]);router[_0xaadf('0x13')](_0xaadf('0xc'),auth[_0xaadf('0x8')](),controller[_0xaadf('0x14')]);module[_0xaadf('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 332fb13..34775e1 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 _0xf326=['BOOLEAN','sequelize','exports','DATE','starttime','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x4ed4d2,_0x47acf7){var _0x15ae2e=function(_0x3199f0){while(--_0x3199f0){_0x4ed4d2['push'](_0x4ed4d2['shift']());}};_0x15ae2e(++_0x47acf7);}(_0xf326,0x17d));var _0x6f32=function(_0x1aa7b1,_0xe9e31d){_0x1aa7b1=_0x1aa7b1-0x0;var _0x5d4ff4=_0xf326[_0x1aa7b1];return _0x5d4ff4;};'use strict';var moment=require('moment');var Sequelize=require(_0x6f32('0x0'));module[_0x6f32('0x1')]={'starttime':{'type':Sequelize[_0x6f32('0x2')],'set':function(_0x2a1e7a){this['setDataValue'](_0x6f32('0x3'),_0x2a1e7a);this[_0x6f32('0x4')](_0x6f32('0x5'),moment()[_0x6f32('0x6')](_0x6f32('0x7')));}},'endtime':{'type':Sequelize[_0x6f32('0x2')]},'membername':{'type':Sequelize[_0x6f32('0x8')]},'projectname':{'type':Sequelize[_0x6f32('0x8')]},'queue':{'type':Sequelize[_0x6f32('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6f32('0x8')]},'calleridnum':{'type':Sequelize[_0x6f32('0x8')]},'completed':{'type':Sequelize[_0x6f32('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xed1c=['DATE','STRING','BOOLEAN','moment','sequelize','starttime','setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4450b1,_0x214ace){var _0x399b0b=function(_0x2197df){while(--_0x2197df){_0x4450b1['push'](_0x4450b1['shift']());}};_0x399b0b(++_0x214ace);}(_0xed1c,0xe4));var _0xced1=function(_0x52df74,_0x5d3cd5){_0x52df74=_0x52df74-0x0;var _0x541d93=_0xed1c[_0x52df74];return _0x541d93;};'use strict';var moment=require(_0xced1('0x0'));var Sequelize=require(_0xced1('0x1'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x5abe0f){this['setDataValue'](_0xced1('0x2'),_0x5abe0f);this[_0xced1('0x3')](_0xced1('0x4'),moment()['format'](_0xced1('0x5')));}},'endtime':{'type':Sequelize[_0xced1('0x6')]},'membername':{'type':Sequelize[_0xced1('0x7')]},'projectname':{'type':Sequelize[_0xced1('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xced1('0x7')]},'calleridname':{'type':Sequelize[_0xced1('0x7')]},'calleridnum':{'type':Sequelize[_0xced1('0x7')]},'completed':{'type':Sequelize[_0xced1('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 992070b..eb63900 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 _0xc99e=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','JscriptySessionReport','includeAll','include','findAll','rows','merge','catch','create','body','params','find','describe','getQuestions','findOne','JscriptyQuestionReport','eml-format','rimraf','zip-dir','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x46aabc,_0x1b0b24){var _0x10c273=function(_0x341129){while(--_0x341129){_0x46aabc['push'](_0x46aabc['shift']());}};_0x10c273(++_0x1b0b24);}(_0xc99e,0x1a8));var _0xec99=function(_0x163913,_0x4b2a6a){_0x163913=_0x163913-0x0;var _0x51cc2e=_0xc99e[_0x163913];return _0x51cc2e;};'use strict';var emlformat=require(_0xec99('0x0'));var rimraf=require(_0xec99('0x1'));var zipdir=require(_0xec99('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xec99('0x3'));var util=require('util');var path=require(_0xec99('0x4'));var sox=require('sox');var csv=require(_0xec99('0x5'));var ejs=require(_0xec99('0x6'));var fs=require('fs');var fs_extra=require(_0xec99('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xec99('0x8'));var jsforce=require(_0xec99('0x9'));var deskjs=require(_0xec99('0xa'));var toCsv=require(_0xec99('0x5'));var querystring=require(_0xec99('0xb'));var Papa=require(_0xec99('0xc'));var Redis=require(_0xec99('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xec99('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec99('0xf'));var logger=require(_0xec99('0x10'))(_0xec99('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xec99('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cce87,_0x1f987a){_0x1f987a=_0x1f987a||0xcc;return function(_0x44c657){if(_0x44c657){return _0x5cce87[_0xec99('0x13')](_0x1f987a);}return _0x5cce87[_0xec99('0x14')](_0x1f987a)[_0xec99('0x15')]();};}function respondWithResult(_0xe2dab5,_0x259539){_0x259539=_0x259539||0xc8;return function(_0x283a03){if(_0x283a03){return _0xe2dab5[_0xec99('0x14')](_0x259539)[_0xec99('0x16')](_0x283a03);}};}function respondWithFilteredResult(_0x1e5708,_0x524138){return function(_0x19a2fb){if(_0x19a2fb){var _0x26704a=typeof _0x524138[_0xec99('0x17')]==='undefined'&&typeof _0x524138[_0xec99('0x18')]===_0xec99('0x19');var _0x49be0d=_0x19a2fb['count'];var _0x4deca5=_0x26704a?0x0:_0x524138['offset'];var _0x552107=_0x26704a?_0x19a2fb[_0xec99('0x1a')]:_0x524138[_0xec99('0x17')]+_0x524138[_0xec99('0x18')];var _0x3ced25;if(_0x552107>=_0x49be0d){_0x552107=_0x49be0d;_0x3ced25=0xc8;}else{_0x3ced25=0xce;}_0x1e5708[_0xec99('0x14')](_0x3ced25);return _0x1e5708['set'](_0xec99('0x1b'),_0x4deca5+'-'+_0x552107+'/'+_0x49be0d)[_0xec99('0x16')](_0x19a2fb);}return null;};}function patchUpdates(_0x49abc1){return function(_0x1af0d6){try{jsonpatch[_0xec99('0x1c')](_0x1af0d6,_0x49abc1,!![]);}catch(_0x1a99b9){return BPromise[_0xec99('0x1d')](_0x1a99b9);}return _0x1af0d6[_0xec99('0x1e')]();};}function saveUpdates(_0x43f22b,_0x12012f){return function(_0x199471){if(_0x199471){return _0x199471[_0xec99('0x1f')](_0x43f22b)[_0xec99('0x20')](function(_0x419da8){return _0x419da8;});}return null;};}function removeEntity(_0x35f38f,_0x30405a){return function(_0x470302){if(_0x470302){return _0x470302[_0xec99('0x21')]()[_0xec99('0x20')](function(){_0x35f38f[_0xec99('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38cd08,_0x165fd1){return function(_0x174179){if(!_0x174179){_0x38cd08['sendStatus'](0x194);}return _0x174179;};}function handleError(_0x1daa06,_0x2948ad){_0x2948ad=_0x2948ad||0x1f4;return function(_0x16f3cf){logger[_0xec99('0x22')](_0x16f3cf[_0xec99('0x23')]);if(_0x16f3cf[_0xec99('0x24')]){delete _0x16f3cf[_0xec99('0x24')];}_0x1daa06[_0xec99('0x14')](_0x2948ad)[_0xec99('0x25')](_0x16f3cf);};}exports['index']=function(_0x21883b,_0x7fddf6){var _0x41b2c9={},_0x2b55bd={},_0x47509e={'count':0x0,'rows':[]};var _0x278e64=_[_0xec99('0x26')](db['JscriptySessionReport'][_0xec99('0x27')],function(_0x4b514b){return{'name':_0x4b514b['fieldName'],'type':_0x4b514b['type'][_0xec99('0x28')]};});_0x2b55bd['model']=_[_0xec99('0x26')](_0x278e64,_0xec99('0x24'));_0x2b55bd[_0xec99('0x29')]=_[_0xec99('0x2a')](_0x21883b['query']);_0x2b55bd[_0xec99('0x2b')]=_[_0xec99('0x2c')](_0x2b55bd[_0xec99('0x2d')],_0x2b55bd[_0xec99('0x29')]);_0x41b2c9[_0xec99('0x2e')]=_['intersection'](_0x2b55bd[_0xec99('0x2d')],qs[_0xec99('0x2f')](_0x21883b[_0xec99('0x29')][_0xec99('0x2f')]));_0x41b2c9[_0xec99('0x2e')]=_0x41b2c9[_0xec99('0x2e')][_0xec99('0x30')]?_0x41b2c9[_0xec99('0x2e')]:_0x2b55bd[_0xec99('0x2d')];if(!_0x21883b[_0xec99('0x29')][_0xec99('0x31')](_0xec99('0x32'))){_0x41b2c9[_0xec99('0x18')]=qs[_0xec99('0x18')](_0x21883b['query'][_0xec99('0x18')]);_0x41b2c9[_0xec99('0x17')]=qs[_0xec99('0x17')](_0x21883b[_0xec99('0x29')][_0xec99('0x17')]);}_0x41b2c9[_0xec99('0x33')]=qs[_0xec99('0x34')](_0x21883b[_0xec99('0x29')]['sort']);_0x41b2c9[_0xec99('0x35')]=qs[_0xec99('0x2b')](_[_0xec99('0x36')](_0x21883b[_0xec99('0x29')],_0x2b55bd[_0xec99('0x2b')]),_0x278e64);if(_0x21883b[_0xec99('0x29')][_0xec99('0x37')]){_0x41b2c9[_0xec99('0x35')]=_['merge'](_0x41b2c9['where'],{'$or':_['map'](_0x278e64,function(_0x4809df){if(_0x4809df['type']!==_0xec99('0x38')){var _0x8e276c={};_0x8e276c[_0x4809df['name']]={'$like':'%'+_0x21883b[_0xec99('0x29')][_0xec99('0x37')]+'%'};return _0x8e276c;}})});}_0x41b2c9=_['merge']({},_0x41b2c9,_0x21883b[_0xec99('0x39')]);var _0x2ca74b={'where':_0x41b2c9['where']};return db[_0xec99('0x3a')][_0xec99('0x1a')](_0x2ca74b)['then'](function(_0x38978d){_0x47509e['count']=_0x38978d;if(_0x21883b[_0xec99('0x29')][_0xec99('0x3b')]){_0x41b2c9[_0xec99('0x3c')]=[{'all':!![]}];}return db[_0xec99('0x3a')][_0xec99('0x3d')](_0x41b2c9);})[_0xec99('0x20')](function(_0x5b70dd){_0x47509e[_0xec99('0x3e')]=_0x5b70dd;return _0x47509e;})[_0xec99('0x20')](respondWithFilteredResult(_0x7fddf6,_0x41b2c9))['catch'](handleError(_0x7fddf6,null));};exports['show']=function(_0x1a641b,_0x353137){var _0x2b817f={'raw':!![],'where':{'id':_0x1a641b['params']['id']}},_0x3f143f={};_0x3f143f[_0xec99('0x2d')]=_[_0xec99('0x2a')](db[_0xec99('0x3a')][_0xec99('0x27')]);_0x3f143f[_0xec99('0x29')]=_[_0xec99('0x2a')](_0x1a641b[_0xec99('0x29')]);_0x3f143f[_0xec99('0x2b')]=_[_0xec99('0x2c')](_0x3f143f[_0xec99('0x2d')],_0x3f143f['query']);_0x2b817f[_0xec99('0x2e')]=_[_0xec99('0x2c')](_0x3f143f['model'],qs[_0xec99('0x2f')](_0x1a641b[_0xec99('0x29')][_0xec99('0x2f')]));_0x2b817f['attributes']=_0x2b817f[_0xec99('0x2e')][_0xec99('0x30')]?_0x2b817f[_0xec99('0x2e')]:_0x3f143f['model'];if(_0x1a641b[_0xec99('0x29')][_0xec99('0x3b')]){_0x2b817f[_0xec99('0x3c')]=[{'all':!![]}];}_0x2b817f=_[_0xec99('0x3f')]({},_0x2b817f,_0x1a641b[_0xec99('0x39')]);return db[_0xec99('0x3a')]['find'](_0x2b817f)[_0xec99('0x20')](handleEntityNotFound(_0x353137,null))[_0xec99('0x20')](respondWithResult(_0x353137,null))[_0xec99('0x40')](handleError(_0x353137,null));};exports[_0xec99('0x41')]=function(_0x2fb54d,_0x1b16d6){return db[_0xec99('0x3a')][_0xec99('0x41')](_0x2fb54d[_0xec99('0x42')],{})['then'](respondWithResult(_0x1b16d6,0xc9))[_0xec99('0x40')](handleError(_0x1b16d6,null));};exports['update']=function(_0x403aea,_0x231673){if(_0x403aea[_0xec99('0x42')]['id']){delete _0x403aea[_0xec99('0x42')]['id'];}return db[_0xec99('0x3a')]['find']({'where':{'id':_0x403aea[_0xec99('0x43')]['id']}})[_0xec99('0x20')](handleEntityNotFound(_0x231673,null))[_0xec99('0x20')](saveUpdates(_0x403aea[_0xec99('0x42')],null))['then'](respondWithResult(_0x231673,null))[_0xec99('0x40')](handleError(_0x231673,null));};exports[_0xec99('0x21')]=function(_0x1078e6,_0x11e36e){return db[_0xec99('0x3a')][_0xec99('0x44')]({'where':{'id':_0x1078e6[_0xec99('0x43')]['id']}})[_0xec99('0x20')](handleEntityNotFound(_0x11e36e,null))[_0xec99('0x20')](removeEntity(_0x11e36e,null))[_0xec99('0x40')](handleError(_0x11e36e,null));};exports[_0xec99('0x45')]=function(_0x5be2f5,_0x5ba492){return db[_0xec99('0x3a')][_0xec99('0x45')]()[_0xec99('0x20')](respondWithResult(_0x5ba492,null))['catch'](handleError(_0x5ba492,null));};exports[_0xec99('0x46')]=function(_0xf14251,_0x5995fb,_0x3763d2){var _0x2c49c8={'raw':!![],'where':{}};var _0x4753e3={};var _0x5849e3={'count':0x0,'rows':[]};return db[_0xec99('0x3a')][_0xec99('0x47')]({'where':{'id':_0xf14251[_0xec99('0x43')]['id']}})[_0xec99('0x20')](handleEntityNotFound(_0x5995fb,null))[_0xec99('0x20')](function(_0x54cdc3){if(_0x54cdc3){_0x4753e3[_0xec99('0x2d')]=_[_0xec99('0x2a')](db[_0xec99('0x48')][_0xec99('0x27')]);_0x4753e3[_0xec99('0x29')]=_[_0xec99('0x2a')](_0xf14251['query']);_0x4753e3[_0xec99('0x2b')]=_[_0xec99('0x2c')](_0x4753e3[_0xec99('0x2d')],_0x4753e3[_0xec99('0x29')]);_0x2c49c8[_0xec99('0x2e')]=_[_0xec99('0x2c')](_0x4753e3[_0xec99('0x2d')],qs[_0xec99('0x2f')](_0xf14251[_0xec99('0x29')]['fields']));_0x2c49c8[_0xec99('0x2e')]=_0x2c49c8[_0xec99('0x2e')][_0xec99('0x30')]?_0x2c49c8[_0xec99('0x2e')]:_0x4753e3[_0xec99('0x2d')];if(!_0xf14251[_0xec99('0x29')]['hasOwnProperty'](_0xec99('0x32'))){_0x2c49c8[_0xec99('0x18')]=qs[_0xec99('0x18')](_0xf14251[_0xec99('0x29')][_0xec99('0x18')]);_0x2c49c8[_0xec99('0x17')]=qs[_0xec99('0x17')](_0xf14251['query'][_0xec99('0x17')]);}_0x2c49c8[_0xec99('0x33')]=qs['sort'](_0xf14251['query'][_0xec99('0x34')]);_0x2c49c8[_0xec99('0x35')]=qs[_0xec99('0x2b')](_[_0xec99('0x36')](_0xf14251[_0xec99('0x29')],_0x4753e3[_0xec99('0x2b')]));_0x2c49c8[_0xec99('0x35')]['SessionId']=_0x54cdc3['id'];if(_0xf14251[_0xec99('0x29')]['filter']){_0x2c49c8[_0xec99('0x35')]=_[_0xec99('0x3f')](_0x2c49c8['where'],{'$or':_['map'](_0x2c49c8[_0xec99('0x2e')],function(_0x353dcd){var _0x5420fc={};_0x5420fc[_0x353dcd]={'$like':'%'+_0xf14251['query'][_0xec99('0x37')]+'%'};return _0x5420fc;})});}_0x2c49c8=_['merge']({},_0x2c49c8,_0xf14251[_0xec99('0x39')]);return db['JscriptyQuestionReport'][_0xec99('0x1a')]({'where':_0x2c49c8['where']})['then'](function(_0x11eb49){_0x5849e3[_0xec99('0x1a')]=_0x11eb49;if(_0xf14251[_0xec99('0x29')][_0xec99('0x3b')]){_0x2c49c8['include']=[{'all':!![]}];}return db[_0xec99('0x48')][_0xec99('0x3d')](_0x2c49c8);})[_0xec99('0x20')](function(_0xdd6495){_0x5849e3[_0xec99('0x3e')]=_0xdd6495;return _0x5849e3;});}})[_0xec99('0x20')](respondWithFilteredResult(_0x5995fb,_0x2c49c8))['catch'](handleError(_0x5995fb,null));}; \ No newline at end of file +var _0xc5e7=['eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','squel','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','error','stack','send','index','map','JscriptySessionReport','rawAttributes','key','model','name','keys','query','intersection','fields','attributes','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','find','body','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','findAll'];(function(_0x360e27,_0x220ba3){var _0x59b5b0=function(_0x5e2607){while(--_0x5e2607){_0x360e27['push'](_0x360e27['shift']());}};_0x59b5b0(++_0x220ba3);}(_0xc5e7,0x172));var _0x7c5e=function(_0x4a655c,_0x4ac154){_0x4a655c=_0x4a655c-0x0;var _0x473cd0=_0xc5e7[_0x4a655c];return _0x473cd0;};'use strict';var emlformat=require(_0x7c5e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7c5e('0x1'));var rp=require(_0x7c5e('0x2'));var moment=require(_0x7c5e('0x3'));var BPromise=require(_0x7c5e('0x4'));var Mustache=require('mustache');var util=require(_0x7c5e('0x5'));var path=require('path');var sox=require(_0x7c5e('0x6'));var csv=require('to-csv');var ejs=require(_0x7c5e('0x7'));var fs=require('fs');var fs_extra=require(_0x7c5e('0x8'));var _=require('lodash');var squel=require(_0x7c5e('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7c5e('0xa'));var querystring=require(_0x7c5e('0xb'));var Papa=require('papaparse');var Redis=require(_0x7c5e('0xc'));var authService=require(_0x7c5e('0xd'));var qs=require(_0x7c5e('0xe'));var as=require(_0x7c5e('0xf'));var hardwareService=require(_0x7c5e('0x10'));var logger=require(_0x7c5e('0x11'))(_0x7c5e('0x12'));var utils=require(_0x7c5e('0x13'));var config=require(_0x7c5e('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23f312,_0x25a060){_0x25a060=_0x25a060||0xcc;return function(_0x2ba28a){if(_0x2ba28a){return _0x23f312['sendStatus'](_0x25a060);}return _0x23f312[_0x7c5e('0x15')](_0x25a060)[_0x7c5e('0x16')]();};}function respondWithResult(_0x1289d3,_0x2b78df){_0x2b78df=_0x2b78df||0xc8;return function(_0x361562){if(_0x361562){return _0x1289d3['status'](_0x2b78df)[_0x7c5e('0x17')](_0x361562);}};}function respondWithFilteredResult(_0xc64590,_0x577bab){return function(_0x1653c9){if(_0x1653c9){var _0x526f01=typeof _0x577bab[_0x7c5e('0x18')]===_0x7c5e('0x19')&&typeof _0x577bab[_0x7c5e('0x1a')]===_0x7c5e('0x19');var _0x13f3f6=_0x1653c9[_0x7c5e('0x1b')];var _0x301235=_0x526f01?0x0:_0x577bab[_0x7c5e('0x18')];var _0x278e49=_0x526f01?_0x1653c9[_0x7c5e('0x1b')]:_0x577bab[_0x7c5e('0x18')]+_0x577bab[_0x7c5e('0x1a')];var _0x5a4306;if(_0x278e49>=_0x13f3f6){_0x278e49=_0x13f3f6;_0x5a4306=0xc8;}else{_0x5a4306=0xce;}_0xc64590['status'](_0x5a4306);return _0xc64590['set'](_0x7c5e('0x1c'),_0x301235+'-'+_0x278e49+'/'+_0x13f3f6)['json'](_0x1653c9);}return null;};}function patchUpdates(_0x26c3fb){return function(_0x51812b){try{jsonpatch[_0x7c5e('0x1d')](_0x51812b,_0x26c3fb,!![]);}catch(_0xf15a76){return BPromise['reject'](_0xf15a76);}return _0x51812b[_0x7c5e('0x1e')]();};}function saveUpdates(_0x240c54,_0x2794e4){return function(_0x43ba13){if(_0x43ba13){return _0x43ba13[_0x7c5e('0x1f')](_0x240c54)['then'](function(_0x2c9aad){return _0x2c9aad;});}return null;};}function removeEntity(_0xa7570,_0x529aa1){return function(_0x3a546d){if(_0x3a546d){return _0x3a546d[_0x7c5e('0x20')]()[_0x7c5e('0x21')](function(){_0xa7570[_0x7c5e('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc92701,_0x337a29){return function(_0x39c55e){if(!_0x39c55e){_0xc92701['sendStatus'](0x194);}return _0x39c55e;};}function handleError(_0x5ca61f,_0x5db77e){_0x5db77e=_0x5db77e||0x1f4;return function(_0x18f40e){logger[_0x7c5e('0x22')](_0x18f40e[_0x7c5e('0x23')]);if(_0x18f40e['name']){delete _0x18f40e['name'];}_0x5ca61f[_0x7c5e('0x15')](_0x5db77e)[_0x7c5e('0x24')](_0x18f40e);};}exports[_0x7c5e('0x25')]=function(_0x812253,_0x4ec6b1){var _0x45d0ae={},_0x48348a={},_0x419f4e={'count':0x0,'rows':[]};var _0x11168c=_[_0x7c5e('0x26')](db[_0x7c5e('0x27')][_0x7c5e('0x28')],function(_0x38be7b){return{'name':_0x38be7b['fieldName'],'type':_0x38be7b['type'][_0x7c5e('0x29')]};});_0x48348a[_0x7c5e('0x2a')]=_[_0x7c5e('0x26')](_0x11168c,_0x7c5e('0x2b'));_0x48348a['query']=_[_0x7c5e('0x2c')](_0x812253[_0x7c5e('0x2d')]);_0x48348a['filters']=_[_0x7c5e('0x2e')](_0x48348a[_0x7c5e('0x2a')],_0x48348a['query']);_0x45d0ae['attributes']=_[_0x7c5e('0x2e')](_0x48348a[_0x7c5e('0x2a')],qs[_0x7c5e('0x2f')](_0x812253[_0x7c5e('0x2d')][_0x7c5e('0x2f')]));_0x45d0ae[_0x7c5e('0x30')]=_0x45d0ae[_0x7c5e('0x30')]['length']?_0x45d0ae[_0x7c5e('0x30')]:_0x48348a[_0x7c5e('0x2a')];if(!_0x812253[_0x7c5e('0x2d')]['hasOwnProperty'](_0x7c5e('0x31'))){_0x45d0ae[_0x7c5e('0x1a')]=qs[_0x7c5e('0x1a')](_0x812253[_0x7c5e('0x2d')]['limit']);_0x45d0ae['offset']=qs[_0x7c5e('0x18')](_0x812253[_0x7c5e('0x2d')]['offset']);}_0x45d0ae[_0x7c5e('0x32')]=qs['sort'](_0x812253['query'][_0x7c5e('0x33')]);_0x45d0ae['where']=qs[_0x7c5e('0x34')](_[_0x7c5e('0x35')](_0x812253['query'],_0x48348a[_0x7c5e('0x34')]),_0x11168c);if(_0x812253[_0x7c5e('0x2d')][_0x7c5e('0x36')]){_0x45d0ae[_0x7c5e('0x37')]=_[_0x7c5e('0x38')](_0x45d0ae['where'],{'$or':_['map'](_0x11168c,function(_0x57d689){if(_0x57d689['type']!==_0x7c5e('0x39')){var _0x3ca62b={};_0x3ca62b[_0x57d689[_0x7c5e('0x2b')]]={'$like':'%'+_0x812253[_0x7c5e('0x2d')][_0x7c5e('0x36')]+'%'};return _0x3ca62b;}})});}_0x45d0ae=_['merge']({},_0x45d0ae,_0x812253[_0x7c5e('0x3a')]);var _0x2ed981={'where':_0x45d0ae[_0x7c5e('0x37')]};return db[_0x7c5e('0x27')]['count'](_0x2ed981)[_0x7c5e('0x21')](function(_0x406068){_0x419f4e[_0x7c5e('0x1b')]=_0x406068;if(_0x812253['query']['includeAll']){_0x45d0ae[_0x7c5e('0x3b')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x45d0ae);})[_0x7c5e('0x21')](function(_0x2a1f1c){_0x419f4e[_0x7c5e('0x3c')]=_0x2a1f1c;return _0x419f4e;})[_0x7c5e('0x21')](respondWithFilteredResult(_0x4ec6b1,_0x45d0ae))[_0x7c5e('0x3d')](handleError(_0x4ec6b1,null));};exports[_0x7c5e('0x3e')]=function(_0x11efe3,_0x21f790){var _0xcf6606={'raw':!![],'where':{'id':_0x11efe3[_0x7c5e('0x3f')]['id']}},_0x218637={};_0x218637[_0x7c5e('0x2a')]=_[_0x7c5e('0x2c')](db['JscriptySessionReport'][_0x7c5e('0x28')]);_0x218637['query']=_[_0x7c5e('0x2c')](_0x11efe3[_0x7c5e('0x2d')]);_0x218637[_0x7c5e('0x34')]=_[_0x7c5e('0x2e')](_0x218637['model'],_0x218637[_0x7c5e('0x2d')]);_0xcf6606[_0x7c5e('0x30')]=_[_0x7c5e('0x2e')](_0x218637[_0x7c5e('0x2a')],qs[_0x7c5e('0x2f')](_0x11efe3[_0x7c5e('0x2d')][_0x7c5e('0x2f')]));_0xcf6606['attributes']=_0xcf6606[_0x7c5e('0x30')][_0x7c5e('0x40')]?_0xcf6606['attributes']:_0x218637[_0x7c5e('0x2a')];if(_0x11efe3[_0x7c5e('0x2d')][_0x7c5e('0x41')]){_0xcf6606[_0x7c5e('0x3b')]=[{'all':!![]}];}_0xcf6606=_[_0x7c5e('0x38')]({},_0xcf6606,_0x11efe3['options']);return db[_0x7c5e('0x27')][_0x7c5e('0x42')](_0xcf6606)['then'](handleEntityNotFound(_0x21f790,null))['then'](respondWithResult(_0x21f790,null))[_0x7c5e('0x3d')](handleError(_0x21f790,null));};exports['create']=function(_0x3babc5,_0x2bbd07){return db[_0x7c5e('0x27')]['create'](_0x3babc5[_0x7c5e('0x43')],{})['then'](respondWithResult(_0x2bbd07,0xc9))[_0x7c5e('0x3d')](handleError(_0x2bbd07,null));};exports[_0x7c5e('0x1f')]=function(_0x763e12,_0x1e0e7b){if(_0x763e12[_0x7c5e('0x43')]['id']){delete _0x763e12[_0x7c5e('0x43')]['id'];}return db[_0x7c5e('0x27')][_0x7c5e('0x42')]({'where':{'id':_0x763e12['params']['id']}})['then'](handleEntityNotFound(_0x1e0e7b,null))['then'](saveUpdates(_0x763e12[_0x7c5e('0x43')],null))[_0x7c5e('0x21')](respondWithResult(_0x1e0e7b,null))[_0x7c5e('0x3d')](handleError(_0x1e0e7b,null));};exports[_0x7c5e('0x20')]=function(_0xffb02d,_0x440e18){return db[_0x7c5e('0x27')][_0x7c5e('0x42')]({'where':{'id':_0xffb02d[_0x7c5e('0x3f')]['id']}})[_0x7c5e('0x21')](handleEntityNotFound(_0x440e18,null))['then'](removeEntity(_0x440e18,null))['catch'](handleError(_0x440e18,null));};exports[_0x7c5e('0x44')]=function(_0x102d25,_0x14aad2){return db['JscriptySessionReport']['describe']()[_0x7c5e('0x21')](respondWithResult(_0x14aad2,null))['catch'](handleError(_0x14aad2,null));};exports[_0x7c5e('0x45')]=function(_0xbb9856,_0xfe2ad3,_0x53e0f3){var _0x595f46={'raw':!![],'where':{}};var _0x2f7537={};var _0x23329d={'count':0x0,'rows':[]};return db[_0x7c5e('0x27')][_0x7c5e('0x46')]({'where':{'id':_0xbb9856['params']['id']}})[_0x7c5e('0x21')](handleEntityNotFound(_0xfe2ad3,null))['then'](function(_0x388c83){if(_0x388c83){_0x2f7537[_0x7c5e('0x2a')]=_[_0x7c5e('0x2c')](db[_0x7c5e('0x47')][_0x7c5e('0x28')]);_0x2f7537['query']=_[_0x7c5e('0x2c')](_0xbb9856[_0x7c5e('0x2d')]);_0x2f7537['filters']=_['intersection'](_0x2f7537[_0x7c5e('0x2a')],_0x2f7537[_0x7c5e('0x2d')]);_0x595f46['attributes']=_[_0x7c5e('0x2e')](_0x2f7537[_0x7c5e('0x2a')],qs[_0x7c5e('0x2f')](_0xbb9856[_0x7c5e('0x2d')][_0x7c5e('0x2f')]));_0x595f46['attributes']=_0x595f46[_0x7c5e('0x30')][_0x7c5e('0x40')]?_0x595f46[_0x7c5e('0x30')]:_0x2f7537[_0x7c5e('0x2a')];if(!_0xbb9856[_0x7c5e('0x2d')][_0x7c5e('0x48')](_0x7c5e('0x31'))){_0x595f46[_0x7c5e('0x1a')]=qs[_0x7c5e('0x1a')](_0xbb9856[_0x7c5e('0x2d')][_0x7c5e('0x1a')]);_0x595f46[_0x7c5e('0x18')]=qs[_0x7c5e('0x18')](_0xbb9856[_0x7c5e('0x2d')]['offset']);}_0x595f46['order']=qs[_0x7c5e('0x33')](_0xbb9856[_0x7c5e('0x2d')]['sort']);_0x595f46[_0x7c5e('0x37')]=qs[_0x7c5e('0x34')](_[_0x7c5e('0x35')](_0xbb9856[_0x7c5e('0x2d')],_0x2f7537['filters']));_0x595f46[_0x7c5e('0x37')]['SessionId']=_0x388c83['id'];if(_0xbb9856[_0x7c5e('0x2d')][_0x7c5e('0x36')]){_0x595f46[_0x7c5e('0x37')]=_[_0x7c5e('0x38')](_0x595f46[_0x7c5e('0x37')],{'$or':_[_0x7c5e('0x26')](_0x595f46[_0x7c5e('0x30')],function(_0x1af012){var _0x4a58c6={};_0x4a58c6[_0x1af012]={'$like':'%'+_0xbb9856[_0x7c5e('0x2d')]['filter']+'%'};return _0x4a58c6;})});}_0x595f46=_[_0x7c5e('0x38')]({},_0x595f46,_0xbb9856[_0x7c5e('0x3a')]);return db['JscriptyQuestionReport'][_0x7c5e('0x1b')]({'where':_0x595f46[_0x7c5e('0x37')]})[_0x7c5e('0x21')](function(_0x50657a){_0x23329d[_0x7c5e('0x1b')]=_0x50657a;if(_0xbb9856[_0x7c5e('0x2d')]['includeAll']){_0x595f46[_0x7c5e('0x3b')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x7c5e('0x49')](_0x595f46);})[_0x7c5e('0x21')](function(_0x25a8cd){_0x23329d[_0x7c5e('0x3c')]=_0x25a8cd;return _0x23329d;});}})[_0x7c5e('0x21')](respondWithFilteredResult(_0xfe2ad3,_0x595f46))[_0x7c5e('0x3d')](handleError(_0xfe2ad3,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 4e967b0..2cdefa8 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 _0x277c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','report_jscripty_sessions','lodash','../../config/logger'];(function(_0x4ed638,_0x3980f6){var _0x1cdfec=function(_0x35f493){while(--_0x35f493){_0x4ed638['push'](_0x4ed638['shift']());}};_0x1cdfec(++_0x3980f6);}(_0x277c,0x153));var _0xc277=function(_0x5846ed,_0x2fa366){_0x5846ed=_0x5846ed-0x0;var _0x6fc50f=_0x277c[_0x5846ed];return _0x6fc50f;};'use strict';var _=require(_0xc277('0x0'));var util=require('util');var logger=require(_0xc277('0x1'))(_0xc277('0x2'));var moment=require(_0xc277('0x3'));var BPromise=require(_0xc277('0x4'));var rp=require(_0xc277('0x5'));var fs=require('fs');var path=require(_0xc277('0x6'));var rimraf=require(_0xc277('0x7'));var config=require(_0xc277('0x8'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x1a6582,_0x5a4f03){return _0x1a6582[_0xc277('0x9')]('JscriptySessionReport',attributes,{'tableName':_0xc277('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x277c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','report_jscripty_sessions','lodash','../../config/logger'];(function(_0x48ef95,_0x341a8a){var _0x40a225=function(_0x2aecb5){while(--_0x2aecb5){_0x48ef95['push'](_0x48ef95['shift']());}};_0x40a225(++_0x341a8a);}(_0x277c,0x153));var _0xc277=function(_0x2a4a73,_0x22529e){_0x2a4a73=_0x2a4a73-0x0;var _0x4c96ff=_0x277c[_0x2a4a73];return _0x4c96ff;};'use strict';var _=require(_0xc277('0x0'));var util=require('util');var logger=require(_0xc277('0x1'))(_0xc277('0x2'));var moment=require(_0xc277('0x3'));var BPromise=require(_0xc277('0x4'));var rp=require(_0xc277('0x5'));var fs=require('fs');var path=require(_0xc277('0x6'));var rimraf=require(_0xc277('0x7'));var config=require(_0xc277('0x8'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x1a6582,_0x5a4f03){return _0x1a6582[_0xc277('0x9')]('JscriptySessionReport',attributes,{'tableName':_0xc277('0xa'),'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 b91f6d0..2bb99cf 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 _0xdf55=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptySessionReport,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x191b8c,_0x6cc2e){var _0x1f231b=function(_0x339ee9){while(--_0x339ee9){_0x191b8c['push'](_0x191b8c['shift']());}};_0x1f231b(++_0x6cc2e);}(_0xdf55,0x83));var _0x5df5=function(_0x34eb0d,_0x43448b){_0x34eb0d=_0x34eb0d-0x0;var _0x309bb3=_0xdf55[_0x34eb0d];return _0x309bb3;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var moment=require('moment');var BPromise=require(_0x5df5('0x2'));var rs=require(_0x5df5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5df5('0x4'))['db'];var utils=require(_0x5df5('0x5'));var logger=require(_0x5df5('0x6'))('rpc');var config=require(_0x5df5('0x7'));var jayson=require(_0x5df5('0x8'));var client=jayson[_0x5df5('0x9')][_0x5df5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9b8756,_0x2b7ed9,_0x4722a2){return new BPromise(function(_0x3743f3,_0x4d43a3){return client[_0x5df5('0xb')](_0x9b8756,_0x4722a2)[_0x5df5('0xc')](function(_0x41941e){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x2b7ed9,_0x5df5('0xd'));logger['debug'](_0x5df5('0xe'),_0x2b7ed9,_0x5df5('0xd'),JSON['stringify'](_0x41941e));if(_0x41941e['error']){if(_0x41941e[_0x5df5('0xf')][_0x5df5('0x10')]===0x1f4){logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);return _0x4d43a3(_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);}logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e['error'][_0x5df5('0x12')]);return _0x3743f3(_0x41941e['error'][_0x5df5('0x12')]);}else{logger[_0x5df5('0x13')](_0x5df5('0x11'),_0x2b7ed9,_0x5df5('0xd'));_0x3743f3(_0x41941e[_0x5df5('0x14')]['message']);}})[_0x5df5('0x15')](function(_0x457205){logger['error'](_0x5df5('0x11'),_0x2b7ed9,_0x457205);_0x4d43a3(_0x457205);});});} \ No newline at end of file +var _0xe5af=['jayson/promise','client','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x232476,_0x2ae50b){var _0x5ea5ae=function(_0x3e6921){while(--_0x3e6921){_0x232476['push'](_0x232476['shift']());}};_0x5ea5ae(++_0x2ae50b);}(_0xe5af,0x9c));var _0xfe5a=function(_0x1688a2,_0x4bfe3c){_0x1688a2=_0x1688a2-0x0;var _0x244acb=_0xe5af[_0x1688a2];return _0x244acb;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var moment=require(_0xfe5a('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe5a('0x2'));var fs=require('fs');var Redis=require(_0xfe5a('0x3'));var db=require(_0xfe5a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe5a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfe5a('0x6'));var client=jayson[_0xfe5a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5eea2e,_0x356c69,_0x106492){return new BPromise(function(_0xfb4357,_0x3e683c){return client['request'](_0x5eea2e,_0x106492)[_0xfe5a('0x8')](function(_0x5a48ff){logger['info'](_0xfe5a('0x9'),_0x356c69,_0xfe5a('0xa'));logger['debug'](_0xfe5a('0xb'),_0x356c69,_0xfe5a('0xa'),JSON[_0xfe5a('0xc')](_0x5a48ff));if(_0x5a48ff[_0xfe5a('0xd')]){if(_0x5a48ff[_0xfe5a('0xd')]['code']===0x1f4){logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);return _0x3e683c(_0x5a48ff[_0xfe5a('0xd')]['message']);}logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);return _0xfb4357(_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);}else{logger[_0xfe5a('0xf')](_0xfe5a('0x9'),_0x356c69,_0xfe5a('0xa'));_0xfb4357(_0x5a48ff[_0xfe5a('0x10')][_0xfe5a('0xe')]);}})[_0xfe5a('0x11')](function(_0x22afa7){logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x22afa7);_0x3e683c(_0x22afa7);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 7060764..c34d117 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 _0x80b9=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','/:id','isAuthenticated','update','/download_log_file','exports'];(function(_0x57fa92,_0x2f0492){var _0x303ffd=function(_0x5eaa18){while(--_0x5eaa18){_0x57fa92['push'](_0x57fa92['shift']());}};_0x303ffd(++_0x2f0492);}(_0x80b9,0x9a));var _0x980b=function(_0x33a7e9,_0x2dd7cb){_0x33a7e9=_0x33a7e9-0x0;var _0x480fe0=_0x80b9[_0x33a7e9];return _0x480fe0;};'use strict';var multer=require(_0x980b('0x0'));var util=require(_0x980b('0x1'));var path=require(_0x980b('0x2'));var timeout=require(_0x980b('0x3'));var express=require('express');var router=express[_0x980b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x980b('0x5'));var interaction=require(_0x980b('0x6'));var config=require(_0x980b('0x7'));var controller=require(_0x980b('0x8'));router['get']('/',controller['index']);router['put'](_0x980b('0x9'),auth[_0x980b('0xa')](),controller[_0x980b('0xb')]);router['get'](_0x980b('0xc'),auth['isAuthenticated'](),controller['downloadLogFile']);module[_0x980b('0xd')]=router; \ No newline at end of file +var _0xf282=['put','/:id','isAuthenticated','/download_log_file','downloadLogFile','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index'];(function(_0x1e23b8,_0x4690f9){var _0x11f0f3=function(_0x4f2718){while(--_0x4f2718){_0x1e23b8['push'](_0x1e23b8['shift']());}};_0x11f0f3(++_0x4690f9);}(_0xf282,0x104));var _0x2f28=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xf282[_0x2070da];return _0x4f9fe1;};'use strict';var multer=require(_0x2f28('0x0'));var util=require(_0x2f28('0x1'));var path=require('path');var timeout=require(_0x2f28('0x2'));var express=require(_0x2f28('0x3'));var router=express[_0x2f28('0x4')]();var fs_extra=require(_0x2f28('0x5'));var auth=require(_0x2f28('0x6'));var interaction=require(_0x2f28('0x7'));var config=require(_0x2f28('0x8'));var controller=require(_0x2f28('0x9'));router[_0x2f28('0xa')]('/',controller[_0x2f28('0xb')]);router[_0x2f28('0xc')](_0x2f28('0xd'),auth[_0x2f28('0xe')](),controller['update']);router[_0x2f28('0xa')](_0x2f28('0xf'),auth['isAuthenticated'](),controller[_0x2f28('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 4372c69..432bd60 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 _0xdec1=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x4d5cce,_0x3082d7){var _0x5e2e77=function(_0xd79ddf){while(--_0xd79ddf){_0x4d5cce['push'](_0x4d5cce['shift']());}};_0x5e2e77(++_0x3082d7);}(_0xdec1,0x17e));var _0x1dec=function(_0x2687ff,_0x190caf){_0x2687ff=_0x2687ff-0x0;var _0x5a4160=_0xdec1[_0x2687ff];return _0x5a4160;};'use strict';var Sequelize=require(_0x1dec('0x0'));module[_0x1dec('0x1')]={'license':{'type':Sequelize[_0x1dec('0x2')]},'data1':{'type':Sequelize[_0x1dec('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x1dec('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x02b1=['exports','TEXT','STRING'];(function(_0x5ef7b8,_0x15cc07){var _0x2c7148=function(_0x398519){while(--_0x398519){_0x5ef7b8['push'](_0x5ef7b8['shift']());}};_0x2c7148(++_0x15cc07);}(_0x02b1,0x114));var _0x102b=function(_0x39a461,_0xc829d6){_0x39a461=_0x39a461-0x0;var _0x3264b7=_0x02b1[_0x39a461];return _0x3264b7;};'use strict';var Sequelize=require('sequelize');module[_0x102b('0x0')]={'license':{'type':Sequelize[_0x102b('0x1')]},'data1':{'type':Sequelize[_0x102b('0x2')]},'data2':{'type':Sequelize[_0x102b('0x2')]},'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 f7d4be9..140e126 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 _0xcfc7=['merge','getLicense','catch','body','find','checkLicense','key','demo','join','/var','log','Content-disposition','attachment;\x20filename=','text/plain','download','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','model','License','rawAttributes','keys','filters','intersection','query','fields','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcfc7,0x107));var _0x7cfc=function(_0x1bdc52,_0x4876a9){_0x1bdc52=_0x1bdc52-0x0;var _0xdf3fa3=_0xcfc7[_0x1bdc52];return _0xdf3fa3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7cfc('0x0'));var jsonpatch=require(_0x7cfc('0x1'));var rp=require(_0x7cfc('0x2'));var moment=require(_0x7cfc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7cfc('0x4'));var util=require(_0x7cfc('0x5'));var path=require(_0x7cfc('0x6'));var sox=require('sox');var csv=require(_0x7cfc('0x7'));var ejs=require(_0x7cfc('0x8'));var fs=require('fs');var fs_extra=require(_0x7cfc('0x9'));var _=require(_0x7cfc('0xa'));var squel=require('squel');var crypto=require(_0x7cfc('0xb'));var jsforce=require(_0x7cfc('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7cfc('0xd'));var qs=require(_0x7cfc('0xe'));var as=require(_0x7cfc('0xf'));var hardwareService=require(_0x7cfc('0x10'));var logger=require('../../config/logger')(_0x7cfc('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7cfc('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22406f,_0x2e951f){_0x2e951f=_0x2e951f||0xcc;return function(_0x373ba3){if(_0x373ba3){return _0x22406f[_0x7cfc('0x13')](_0x2e951f);}return _0x22406f[_0x7cfc('0x14')](_0x2e951f)[_0x7cfc('0x15')]();};}function respondWithResult(_0x13ead7,_0x30fdc3){_0x30fdc3=_0x30fdc3||0xc8;return function(_0x4a4009){if(_0x4a4009){return _0x13ead7[_0x7cfc('0x14')](_0x30fdc3)[_0x7cfc('0x16')](_0x4a4009);}};}function respondWithFilteredResult(_0x2653db,_0x100f9b){return function(_0x2537db){if(_0x2537db){var _0x3cb2ad=typeof _0x100f9b[_0x7cfc('0x17')]===_0x7cfc('0x18')&&typeof _0x100f9b['limit']===_0x7cfc('0x18');var _0x1f6a76=_0x2537db['count'];var _0x231331=_0x3cb2ad?0x0:_0x100f9b[_0x7cfc('0x17')];var _0x4c2bae=_0x3cb2ad?_0x2537db[_0x7cfc('0x19')]:_0x100f9b[_0x7cfc('0x17')]+_0x100f9b[_0x7cfc('0x1a')];var _0x19344c;if(_0x4c2bae>=_0x1f6a76){_0x4c2bae=_0x1f6a76;_0x19344c=0xc8;}else{_0x19344c=0xce;}_0x2653db['status'](_0x19344c);return _0x2653db[_0x7cfc('0x1b')](_0x7cfc('0x1c'),_0x231331+'-'+_0x4c2bae+'/'+_0x1f6a76)[_0x7cfc('0x16')](_0x2537db);}return null;};}function patchUpdates(_0x50cece){return function(_0x2489fd){try{jsonpatch[_0x7cfc('0x1d')](_0x2489fd,_0x50cece,!![]);}catch(_0x3797b8){return BPromise[_0x7cfc('0x1e')](_0x3797b8);}return _0x2489fd[_0x7cfc('0x1f')]();};}function saveUpdates(_0x227267,_0x4c8a43){return function(_0x3fa68f){if(_0x3fa68f){return _0x3fa68f['update'](_0x227267)['then'](function(_0x26f281){return _0x26f281;});}return null;};}function removeEntity(_0x1b24e9,_0x26be44){return function(_0x4c0f95){if(_0x4c0f95){return _0x4c0f95[_0x7cfc('0x20')]()[_0x7cfc('0x21')](function(){_0x1b24e9[_0x7cfc('0x14')](0xcc)[_0x7cfc('0x15')]();});}};}function handleEntityNotFound(_0x56925f,_0x3b5acc){return function(_0x24188e){if(!_0x24188e){_0x56925f[_0x7cfc('0x13')](0x194);}return _0x24188e;};}function handleError(_0x527797,_0xf1ba50){_0xf1ba50=_0xf1ba50||0x1f4;return function(_0x587a80){logger[_0x7cfc('0x22')](_0x587a80[_0x7cfc('0x23')]);if(_0x587a80[_0x7cfc('0x24')]){delete _0x587a80[_0x7cfc('0x24')];}_0x527797[_0x7cfc('0x14')](_0xf1ba50)[_0x7cfc('0x25')](_0x587a80);};}var utilLicense=require(_0x7cfc('0x12'));exports['index']=function(_0x506823,_0x4c836e){var _0x2a611b={'raw':!![],'where':{'id':0x1}},_0x54fb43={};_0x54fb43[_0x7cfc('0x26')]=_['keys'](db[_0x7cfc('0x27')][_0x7cfc('0x28')]);_0x54fb43['query']=_[_0x7cfc('0x29')](_0x506823['query']);_0x54fb43[_0x7cfc('0x2a')]=_[_0x7cfc('0x2b')](_0x54fb43[_0x7cfc('0x26')],_0x54fb43[_0x7cfc('0x2c')]);_0x2a611b['attributes']=_['intersection'](_0x54fb43['model'],qs['fields'](_0x506823['query'][_0x7cfc('0x2d')]));_0x2a611b['attributes']=_0x2a611b[_0x7cfc('0x2e')]['length']?_0x2a611b['attributes']:_0x54fb43[_0x7cfc('0x26')];_0x2a611b=_[_0x7cfc('0x2f')]({},_0x2a611b,_0x506823['options']);return utilLicense[_0x7cfc('0x30')](_0x2a611b)[_0x7cfc('0x21')](respondWithResult(_0x4c836e,null))[_0x7cfc('0x31')](handleError(_0x4c836e,null));};exports['update']=function(_0x17392d,_0x5a6a25){if(_0x17392d['body']['id']){delete _0x17392d[_0x7cfc('0x32')]['id'];}return db['License'][_0x7cfc('0x33')]({'where':{'id':_0x17392d['params']['id']}})[_0x7cfc('0x21')](handleEntityNotFound(_0x5a6a25,null))['then'](function(_0x23c964){var _0x68f4e8=_0x23c964['get']({'plain':!![]});return utilLicense[_0x7cfc('0x34')](_0x68f4e8,_0x17392d['body'][_0x7cfc('0x35')]);})[_0x7cfc('0x21')](function(_0x382576){if(!_0x382576[_0x7cfc('0x36')]){return saveUpdates(_0x17392d[_0x7cfc('0x32')],null);}return _0x382576;})[_0x7cfc('0x21')](respondWithResult(_0x5a6a25,null))['catch'](handleError(_0x5a6a25,null));};exports['downloadLogFile']=function(_0x5dcdc2,_0x3a9c3b){var _0x5cf7d2='license-info.log';var _0x839feb=path[_0x7cfc('0x37')](_0x7cfc('0x38'),_0x7cfc('0x39'),'xcally',_0x5cf7d2);_0x3a9c3b['setHeader'](_0x7cfc('0x3a'),_0x7cfc('0x3b')+_0x5cf7d2);_0x3a9c3b[_0x7cfc('0x1b')]('Content-Type',_0x7cfc('0x3c'));_0x3a9c3b[_0x7cfc('0x3d')](_0x839feb);}; \ No newline at end of file +var _0xc4af=['request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','../../config/license/util','index','model','keys','rawAttributes','query','intersection','fields','attributes','merge','options','getLicense','catch','body','License','find','demo','downloadLogFile','license-info.log','join','/var','xcally','setHeader','Content-disposition','text/plain','download','eml-format','rimraf','zip-dir'];(function(_0x527824,_0xc824a9){var _0xc8b8ed=function(_0x1b0e19){while(--_0x1b0e19){_0x527824['push'](_0x527824['shift']());}};_0xc8b8ed(++_0xc824a9);}(_0xc4af,0x7d));var _0xfc4a=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xc4af[_0x2b5eae];return _0x5f3ac9;};'use strict';var emlformat=require(_0xfc4a('0x0'));var rimraf=require(_0xfc4a('0x1'));var zipdir=require(_0xfc4a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfc4a('0x3'));var moment=require(_0xfc4a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfc4a('0x5'));var util=require(_0xfc4a('0x6'));var path=require(_0xfc4a('0x7'));var sox=require(_0xfc4a('0x8'));var csv=require(_0xfc4a('0x9'));var ejs=require(_0xfc4a('0xa'));var fs=require('fs');var fs_extra=require(_0xfc4a('0xb'));var _=require(_0xfc4a('0xc'));var squel=require(_0xfc4a('0xd'));var crypto=require(_0xfc4a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfc4a('0xf'));var toCsv=require(_0xfc4a('0x9'));var querystring=require(_0xfc4a('0x10'));var Papa=require(_0xfc4a('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfc4a('0x12'));var hardwareService=require(_0xfc4a('0x13'));var logger=require(_0xfc4a('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xfc4a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xfc4a('0x16'))['db'];function respondWithStatusCode(_0xacc92,_0x1f43f7){_0x1f43f7=_0x1f43f7||0xcc;return function(_0x197de7){if(_0x197de7){return _0xacc92['sendStatus'](_0x1f43f7);}return _0xacc92[_0xfc4a('0x17')](_0x1f43f7)[_0xfc4a('0x18')]();};}function respondWithResult(_0x3d4b0c,_0x4806d6){_0x4806d6=_0x4806d6||0xc8;return function(_0x1a2bc8){if(_0x1a2bc8){return _0x3d4b0c[_0xfc4a('0x17')](_0x4806d6)['json'](_0x1a2bc8);}};}function respondWithFilteredResult(_0x5ed0d0,_0x5badba){return function(_0x555458){if(_0x555458){var _0x2cee2f=typeof _0x5badba[_0xfc4a('0x19')]===_0xfc4a('0x1a')&&typeof _0x5badba[_0xfc4a('0x1b')]===_0xfc4a('0x1a');var _0x43c626=_0x555458[_0xfc4a('0x1c')];var _0x6aeff1=_0x2cee2f?0x0:_0x5badba[_0xfc4a('0x19')];var _0x4c4d55=_0x2cee2f?_0x555458[_0xfc4a('0x1c')]:_0x5badba[_0xfc4a('0x19')]+_0x5badba[_0xfc4a('0x1b')];var _0x35b50b;if(_0x4c4d55>=_0x43c626){_0x4c4d55=_0x43c626;_0x35b50b=0xc8;}else{_0x35b50b=0xce;}_0x5ed0d0[_0xfc4a('0x17')](_0x35b50b);return _0x5ed0d0['set'](_0xfc4a('0x1d'),_0x6aeff1+'-'+_0x4c4d55+'/'+_0x43c626)['json'](_0x555458);}return null;};}function patchUpdates(_0x1d15a8){return function(_0x4ed868){try{jsonpatch[_0xfc4a('0x1e')](_0x4ed868,_0x1d15a8,!![]);}catch(_0x5878bc){return BPromise[_0xfc4a('0x1f')](_0x5878bc);}return _0x4ed868[_0xfc4a('0x20')]();};}function saveUpdates(_0x1c3569,_0x4836b7){return function(_0x39605a){if(_0x39605a){return _0x39605a[_0xfc4a('0x21')](_0x1c3569)[_0xfc4a('0x22')](function(_0x343a70){return _0x343a70;});}return null;};}function removeEntity(_0x29547f,_0x30c48c){return function(_0x3df272){if(_0x3df272){return _0x3df272['destroy']()[_0xfc4a('0x22')](function(){_0x29547f[_0xfc4a('0x17')](0xcc)[_0xfc4a('0x18')]();});}};}function handleEntityNotFound(_0xdfb474,_0x51b5d2){return function(_0x49361b){if(!_0x49361b){_0xdfb474[_0xfc4a('0x23')](0x194);}return _0x49361b;};}function handleError(_0xf8d5aa,_0x25bfe8){_0x25bfe8=_0x25bfe8||0x1f4;return function(_0x5becfe){logger['error'](_0x5becfe[_0xfc4a('0x24')]);if(_0x5becfe[_0xfc4a('0x25')]){delete _0x5becfe[_0xfc4a('0x25')];}_0xf8d5aa[_0xfc4a('0x17')](_0x25bfe8)['send'](_0x5becfe);};}var utilLicense=require(_0xfc4a('0x26'));exports[_0xfc4a('0x27')]=function(_0x2ff651,_0x843cb2){var _0x26e4eb={'raw':!![],'where':{'id':0x1}},_0x3ba17c={};_0x3ba17c[_0xfc4a('0x28')]=_[_0xfc4a('0x29')](db['License'][_0xfc4a('0x2a')]);_0x3ba17c[_0xfc4a('0x2b')]=_[_0xfc4a('0x29')](_0x2ff651['query']);_0x3ba17c['filters']=_[_0xfc4a('0x2c')](_0x3ba17c[_0xfc4a('0x28')],_0x3ba17c[_0xfc4a('0x2b')]);_0x26e4eb['attributes']=_['intersection'](_0x3ba17c[_0xfc4a('0x28')],qs[_0xfc4a('0x2d')](_0x2ff651[_0xfc4a('0x2b')][_0xfc4a('0x2d')]));_0x26e4eb['attributes']=_0x26e4eb[_0xfc4a('0x2e')]['length']?_0x26e4eb[_0xfc4a('0x2e')]:_0x3ba17c['model'];_0x26e4eb=_[_0xfc4a('0x2f')]({},_0x26e4eb,_0x2ff651[_0xfc4a('0x30')]);return utilLicense[_0xfc4a('0x31')](_0x26e4eb)['then'](respondWithResult(_0x843cb2,null))[_0xfc4a('0x32')](handleError(_0x843cb2,null));};exports['update']=function(_0x4f3bfe,_0x4e7984){if(_0x4f3bfe['body']['id']){delete _0x4f3bfe[_0xfc4a('0x33')]['id'];}return db[_0xfc4a('0x34')][_0xfc4a('0x35')]({'where':{'id':_0x4f3bfe['params']['id']}})[_0xfc4a('0x22')](handleEntityNotFound(_0x4e7984,null))[_0xfc4a('0x22')](function(_0x347801){var _0x2869f5=_0x347801['get']({'plain':!![]});return utilLicense['checkLicense'](_0x2869f5,_0x4f3bfe[_0xfc4a('0x33')]['key']);})[_0xfc4a('0x22')](function(_0x2a443e){if(!_0x2a443e[_0xfc4a('0x36')]){return saveUpdates(_0x4f3bfe[_0xfc4a('0x33')],null);}return _0x2a443e;})[_0xfc4a('0x22')](respondWithResult(_0x4e7984,null))[_0xfc4a('0x32')](handleError(_0x4e7984,null));};exports[_0xfc4a('0x37')]=function(_0x3a2f3a,_0x26cabe){var _0x1c027e=_0xfc4a('0x38');var _0xecc647=path[_0xfc4a('0x39')](_0xfc4a('0x3a'),'log',_0xfc4a('0x3b'),_0x1c027e);_0x26cabe[_0xfc4a('0x3c')](_0xfc4a('0x3d'),'attachment;\x20filename='+_0x1c027e);_0x26cabe['set']('Content-Type',_0xfc4a('0x3e'));_0x26cabe[_0xfc4a('0x3f')](_0xecc647);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index a83bc16..90c1118 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 _0x15da=['../../config/logger','api','moment','bluebird','request-promise','path','define','License','license','util'];(function(_0x533676,_0x2be01c){var _0x32f7bd=function(_0x5b28fd){while(--_0x5b28fd){_0x533676['push'](_0x533676['shift']());}};_0x32f7bd(++_0x2be01c);}(_0x15da,0xf9));var _0xa15d=function(_0x5d5b69,_0x1111ab){_0x5d5b69=_0x5d5b69-0x0;var _0xf82413=_0x15da[_0x5d5b69];return _0xf82413;};'use strict';var _=require('lodash');var util=require(_0xa15d('0x0'));var logger=require(_0xa15d('0x1'))(_0xa15d('0x2'));var moment=require(_0xa15d('0x3'));var BPromise=require(_0xa15d('0x4'));var rp=require(_0xa15d('0x5'));var fs=require('fs');var path=require(_0xa15d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./license.attributes');module['exports']=function(_0x5b0882,_0x2eb69a){return _0x5b0882[_0xa15d('0x7')](_0xa15d('0x8'),attributes,{'tableName':_0xa15d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25d6=['define','License','license','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports'];(function(_0x4b9cb8,_0x1916a0){var _0x104a4b=function(_0x5264c5){while(--_0x5264c5){_0x4b9cb8['push'](_0x4b9cb8['shift']());}};_0x104a4b(++_0x1916a0);}(_0x25d6,0x123));var _0x625d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x625d('0x0'));var util=require(_0x625d('0x1'));var logger=require(_0x625d('0x2'))(_0x625d('0x3'));var moment=require(_0x625d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x625d('0x5'));var rimraf=require(_0x625d('0x6'));var config=require(_0x625d('0x7'));var attributes=require('./license.attributes');module[_0x625d('0x8')]=function(_0x2cdf9a,_0x2272eb){return _0x2cdf9a[_0x625d('0x9')](_0x625d('0xa'),attributes,{'tableName':_0x625d('0xb'),'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 ca3b3b8..5beceee 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 _0xdb4a=['result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','License,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3a7189,_0x3a4f03){var _0x11e42e=function(_0x217838){while(--_0x217838){_0x3a7189['push'](_0x3a7189['shift']());}};_0x11e42e(++_0x3a4f03);}(_0xdb4a,0x66));var _0xadb4=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xdb4a[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0xadb4('0x0'));var util=require('util');var moment=require(_0xadb4('0x1'));var BPromise=require(_0xadb4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xadb4('0x3'))['db'];var utils=require(_0xadb4('0x4'));var logger=require(_0xadb4('0x5'))(_0xadb4('0x6'));var config=require('../../config/environment');var jayson=require(_0xadb4('0x7'));var client=jayson[_0xadb4('0x8')][_0xadb4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x693fba,_0x28fffe,_0x1a2d92){return new BPromise(function(_0x47c7f3,_0x37bd0b){return client[_0xadb4('0xa')](_0x693fba,_0x1a2d92)['then'](function(_0x1e63bd){logger[_0xadb4('0xb')](_0xadb4('0xc'),_0x28fffe,_0xadb4('0xd'));logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x28fffe,'request\x20sent',JSON[_0xadb4('0xe')](_0x1e63bd));if(_0x1e63bd[_0xadb4('0xf')]){if(_0x1e63bd[_0xadb4('0xf')][_0xadb4('0x10')]===0x1f4){logger[_0xadb4('0xf')]('License,\x20%s,\x20%s',_0x28fffe,_0x1e63bd[_0xadb4('0xf')][_0xadb4('0x11')]);return _0x37bd0b(_0x1e63bd[_0xadb4('0xf')][_0xadb4('0x11')]);}logger['error'](_0xadb4('0xc'),_0x28fffe,_0x1e63bd['error']['message']);return _0x47c7f3(_0x1e63bd[_0xadb4('0xf')]['message']);}else{logger[_0xadb4('0xb')](_0xadb4('0xc'),_0x28fffe,_0xadb4('0xd'));_0x47c7f3(_0x1e63bd[_0xadb4('0x12')][_0xadb4('0x11')]);}})[_0xadb4('0x13')](function(_0x2c7622){logger[_0xadb4('0xf')](_0xadb4('0xc'),_0x28fffe,_0x2c7622);_0x37bd0b(_0x2c7622);});});} \ No newline at end of file +var _0x04fd=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x4252d0,_0x4a6298){var _0xca61=function(_0x431097){while(--_0x431097){_0x4252d0['push'](_0x4252d0['shift']());}};_0xca61(++_0x4a6298);}(_0x04fd,0x121));var _0xd04f=function(_0x4e318c,_0x2e802c){_0x4e318c=_0x4e318c-0x0;var _0x10bd03=_0x04fd[_0x4e318c];return _0x10bd03;};'use strict';var _=require('lodash');var util=require(_0xd04f('0x0'));var moment=require(_0xd04f('0x1'));var BPromise=require(_0xd04f('0x2'));var rs=require(_0xd04f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd04f('0x4'));var logger=require(_0xd04f('0x5'))(_0xd04f('0x6'));var config=require(_0xd04f('0x7'));var jayson=require(_0xd04f('0x8'));var client=jayson[_0xd04f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e9ca6,_0x156bb4,_0x20b526){return new BPromise(function(_0x5b9929,_0x3bab74){return client[_0xd04f('0xa')](_0x2e9ca6,_0x20b526)[_0xd04f('0xb')](function(_0x3501bb){logger[_0xd04f('0xc')](_0xd04f('0xd'),_0x156bb4,_0xd04f('0xe'));logger[_0xd04f('0xf')]('License,\x20%s,\x20%s,\x20%s',_0x156bb4,_0xd04f('0xe'),JSON[_0xd04f('0x10')](_0x3501bb));if(_0x3501bb['error']){if(_0x3501bb[_0xd04f('0x11')][_0xd04f('0x12')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x156bb4,_0x3501bb[_0xd04f('0x11')][_0xd04f('0x13')]);return _0x3bab74(_0x3501bb[_0xd04f('0x11')]['message']);}logger['error'](_0xd04f('0xd'),_0x156bb4,_0x3501bb[_0xd04f('0x11')][_0xd04f('0x13')]);return _0x5b9929(_0x3501bb[_0xd04f('0x11')][_0xd04f('0x13')]);}else{logger['info'](_0xd04f('0xd'),_0x156bb4,_0xd04f('0xe'));_0x5b9929(_0x3501bb[_0xd04f('0x14')]['message']);}})['catch'](function(_0x5af315){logger['error']('License,\x20%s,\x20%s',_0x156bb4,_0x5af315);_0x3bab74(_0x5af315);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 8ce891a..66d93bd 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 _0x3bce=['/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addInteraction','addAgents','put','/:id','update','delete','/:id/dispositions','removeDispositions','/:id/canned_answers','removeSmtp','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','show','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3bce,0x168));var _0xe3bc=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x3bce[_0x46e363];return _0x3fb059;};'use strict';var multer=require('multer');var util=require(_0xe3bc('0x0'));var path=require(_0xe3bc('0x1'));var timeout=require(_0xe3bc('0x2'));var express=require('express');var router=express[_0xe3bc('0x3')]();var fs_extra=require(_0xe3bc('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe3bc('0x5'));var controller=require(_0xe3bc('0x6'));router[_0xe3bc('0x7')]('/',auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x9')]);router[_0xe3bc('0x7')]('/describe',auth[_0xe3bc('0x8')](),controller['describe']);router['get']('/:id',auth[_0xe3bc('0x8')](),controller[_0xe3bc('0xa')]);router[_0xe3bc('0x7')]('/:id/dispositions',auth[_0xe3bc('0x8')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0xe3bc('0x8')](),controller[_0xe3bc('0xb')]);router['get'](_0xe3bc('0xc'),auth['isAuthenticated'](),controller[_0xe3bc('0xd')]);router[_0xe3bc('0x7')](_0xe3bc('0xe'),auth[_0xe3bc('0x8')](),controller[_0xe3bc('0xf')]);router['get'](_0xe3bc('0x10'),auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x11')]);router[_0xe3bc('0x7')](_0xe3bc('0x12'),auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x13')]);router['get'](_0xe3bc('0x14'),auth[_0xe3bc('0x8')](),controller['getMessages']);router[_0xe3bc('0x7')](_0xe3bc('0x15'),auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x16')]);router[_0xe3bc('0x7')](_0xe3bc('0x17'),auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x18')]);router[_0xe3bc('0x19')]('/:id/dispositions',auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x1a')]);router[_0xe3bc('0x19')]('/:id/canned_answers',auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x1b')]);router[_0xe3bc('0x19')]('/',auth['isAuthenticated'](),controller[_0xe3bc('0x1c')]);router[_0xe3bc('0x19')](_0xe3bc('0xc'),auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x1d')]);router[_0xe3bc('0x19')]('/:id/out_servers',auth[_0xe3bc('0x8')](),controller['addSmtp']);router[_0xe3bc('0x19')](_0xe3bc('0x10'),auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x1e')]);router[_0xe3bc('0x19')](_0xe3bc('0x12'),auth[_0xe3bc('0x8')](),controller['addApplications']);router[_0xe3bc('0x19')]('/:id/send',auth[_0xe3bc('0x8')](),controller['send']);router[_0xe3bc('0x19')]('/:id/users',auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x1f')]);router[_0xe3bc('0x20')](_0xe3bc('0x21'),auth['isAuthenticated'](),controller[_0xe3bc('0x22')]);router[_0xe3bc('0x23')](_0xe3bc('0x24'),auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x25')]);router[_0xe3bc('0x23')](_0xe3bc('0x26'),auth[_0xe3bc('0x8')](),controller['removeAnswers']);router[_0xe3bc('0x23')](_0xe3bc('0xc'),auth[_0xe3bc('0x8')](),controller['removeImap']);router[_0xe3bc('0x23')]('/:id/out_servers',auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x27')]);router[_0xe3bc('0x23')](_0xe3bc('0x21'),auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x28')]);router['delete'](_0xe3bc('0x17'),auth[_0xe3bc('0x8')](),controller['removeAgents']);module[_0xe3bc('0x29')]=router; \ No newline at end of file +var _0x3bc9=['/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addImap','addSmtp','addInteraction','addApplications','/:id/send','update','delete','removeDispositions','removeAnswers','removeImap','destroy','removeAgents','exports','util','connect-timeout','express','Router','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap'];(function(_0x457add,_0x16e13d){var _0x23b479=function(_0x37a9c0){while(--_0x37a9c0){_0x457add['push'](_0x457add['shift']());}};_0x23b479(++_0x16e13d);}(_0x3bc9,0x14f));var _0x93bc=function(_0x1b4add,_0x120b33){_0x1b4add=_0x1b4add-0x0;var _0xc4cd66=_0x3bc9[_0x1b4add];return _0xc4cd66;};'use strict';var multer=require('multer');var util=require(_0x93bc('0x0'));var path=require('path');var timeout=require(_0x93bc('0x1'));var express=require(_0x93bc('0x2'));var router=express[_0x93bc('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(_0x93bc('0x4'));router[_0x93bc('0x5')]('/',auth[_0x93bc('0x6')](),controller[_0x93bc('0x7')]);router[_0x93bc('0x5')](_0x93bc('0x8'),auth[_0x93bc('0x6')](),controller[_0x93bc('0x9')]);router[_0x93bc('0x5')](_0x93bc('0xa'),auth[_0x93bc('0x6')](),controller[_0x93bc('0xb')]);router[_0x93bc('0x5')](_0x93bc('0xc'),auth[_0x93bc('0x6')](),controller[_0x93bc('0xd')]);router['get']('/:id/canned_answers',auth[_0x93bc('0x6')](),controller[_0x93bc('0xe')]);router[_0x93bc('0x5')](_0x93bc('0xf'),auth[_0x93bc('0x6')](),controller[_0x93bc('0x10')]);router[_0x93bc('0x5')](_0x93bc('0x11'),auth[_0x93bc('0x6')](),controller[_0x93bc('0x12')]);router[_0x93bc('0x5')](_0x93bc('0x13'),auth['isAuthenticated'](),controller[_0x93bc('0x14')]);router[_0x93bc('0x5')](_0x93bc('0x15'),auth[_0x93bc('0x6')](),controller['getApplications']);router[_0x93bc('0x5')](_0x93bc('0x16'),auth[_0x93bc('0x6')](),controller[_0x93bc('0x17')]);router[_0x93bc('0x5')](_0x93bc('0x18'),auth[_0x93bc('0x6')](),controller[_0x93bc('0x19')]);router[_0x93bc('0x5')](_0x93bc('0x1a'),auth[_0x93bc('0x6')](),controller[_0x93bc('0x1b')]);router[_0x93bc('0x1c')](_0x93bc('0xc'),auth[_0x93bc('0x6')](),controller[_0x93bc('0x1d')]);router['post'](_0x93bc('0x1e'),auth[_0x93bc('0x6')](),controller['addAnswer']);router[_0x93bc('0x1c')]('/',auth['isAuthenticated'](),controller['create']);router[_0x93bc('0x1c')](_0x93bc('0xf'),auth[_0x93bc('0x6')](),controller[_0x93bc('0x1f')]);router[_0x93bc('0x1c')](_0x93bc('0x11'),auth[_0x93bc('0x6')](),controller[_0x93bc('0x20')]);router[_0x93bc('0x1c')](_0x93bc('0x13'),auth['isAuthenticated'](),controller[_0x93bc('0x21')]);router[_0x93bc('0x1c')](_0x93bc('0x15'),auth[_0x93bc('0x6')](),controller[_0x93bc('0x22')]);router[_0x93bc('0x1c')](_0x93bc('0x23'),auth[_0x93bc('0x6')](),controller['send']);router['post']('/:id/users',auth[_0x93bc('0x6')](),controller['addAgents']);router['put'](_0x93bc('0xa'),auth['isAuthenticated'](),controller[_0x93bc('0x24')]);router[_0x93bc('0x25')]('/:id/dispositions',auth[_0x93bc('0x6')](),controller[_0x93bc('0x26')]);router[_0x93bc('0x25')](_0x93bc('0x1e'),auth[_0x93bc('0x6')](),controller[_0x93bc('0x27')]);router['delete'](_0x93bc('0xf'),auth[_0x93bc('0x6')](),controller[_0x93bc('0x28')]);router[_0x93bc('0x25')](_0x93bc('0x11'),auth['isAuthenticated'](),controller['removeSmtp']);router['delete'](_0x93bc('0xa'),auth[_0x93bc('0x6')](),controller[_0x93bc('0x29')]);router['delete'](_0x93bc('0x1a'),auth[_0x93bc('0x6')](),controller[_0x93bc('0x2a')]);module[_0x93bc('0x2b')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index d4b04ea..f1ffba1 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 _0xf7fc=['mandatoryDispositionPauseId','setDataValue','gmail','hotmail','yahoo','outlook365','provider','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xf7fc,0x1a5));var _0xcf7f=function(_0x359959,_0x108408){_0x359959=_0x359959-0x0;var _0x28ef2d=_0xf7fc[_0x359959];return _0x28ef2d;};'use strict';var Sequelize=require(_0xcf7f('0x0'));module[_0xcf7f('0x1')]={'description':{'type':Sequelize[_0xcf7f('0x2')]},'name':{'type':Sequelize[_0xcf7f('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xcf7f('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xcf7f('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xcf7f('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xcf7f('0x4')]},'markAsUnread':{'type':Sequelize[_0xcf7f('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xcf7f('0x2')],'allowNull':![],'defaultValue':_0xcf7f('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xcf7f('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xcf7f('0x4')],'defaultValue':function(){return _0xcf7f('0x7');}},'notificationSound':{'type':Sequelize[_0xcf7f('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcf7f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcf7f('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcf7f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcf7f('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcf7f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcf7f('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xcf7f('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xcf7f('0x3')],'defaultValue':![],'comment':_0xcf7f('0xa'),'set':function(_0x423af1){if(!_0x423af1)this['setDataValue'](_0xcf7f('0xb'),null);this[_0xcf7f('0xc')]('mandatoryDisposition',_0x423af1);}},'provider':{'type':Sequelize['ENUM'](_0xcf7f('0xd'),_0xcf7f('0xe'),_0xcf7f('0xf'),_0xcf7f('0x10')),'defaultValue':null,'get':function(){var _0xb956e1=this['getDataValue'](_0xcf7f('0x11'));return _0xb956e1||'custom';},'set':function(_0x376e73){if(_0x376e73==='custom'){_0x376e73=null;}return this[_0xcf7f('0xc')](_0xcf7f('0x11'),_0x376e73);}}}; \ No newline at end of file +var _0x0a71=['ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x5f4844,_0x14f9c6){var _0x525519=function(_0x452c55){while(--_0x452c55){_0x5f4844['push'](_0x5f4844['shift']());}};_0x525519(++_0x14f9c6);}(_0x0a71,0x71));var _0x10a7=function(_0x49f168,_0xfc2dc3){_0x49f168=_0x49f168-0x0;var _0x1dbb91=_0x0a71[_0x49f168];return _0x1dbb91;};'use strict';var Sequelize=require('sequelize');module[_0x10a7('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x10a7('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x10a7('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x10a7('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x10a7('0x3')]},'markAsUnread':{'type':Sequelize[_0x10a7('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x10a7('0x1')],'allowNull':![],'defaultValue':_0x10a7('0x4')},'fontSize':{'type':Sequelize[_0x10a7('0x5')](0x2)[_0x10a7('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x10a7('0x3')],'defaultValue':function(){return _0x10a7('0x7');}},'notificationSound':{'type':Sequelize[_0x10a7('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x10a7('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x10a7('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x10a7('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x10a7('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x10a7('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x10a7('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x10a7('0x2')],'defaultValue':![],'comment':_0x10a7('0x9'),'set':function(_0x2b6bba){if(!_0x2b6bba)this[_0x10a7('0xa')](_0x10a7('0xb'),null);this[_0x10a7('0xa')](_0x10a7('0xc'),_0x2b6bba);}},'provider':{'type':Sequelize[_0x10a7('0xd')](_0x10a7('0xe'),_0x10a7('0xf'),_0x10a7('0x10'),_0x10a7('0x11')),'defaultValue':null,'get':function(){var _0x14345c=this[_0x10a7('0x12')](_0x10a7('0x13'));return _0x14345c||_0x10a7('0x14');},'set':function(_0x9347ef){if(_0x9347ef===_0x10a7('0x14')){_0x9347ef=null;}return this[_0x10a7('0xa')](_0x10a7('0x13'),_0x9347ef);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 21bfcfe..d7c0184 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 _0x7f14=['out','Interaction','Messages','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','util','path','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','offset','undefined','set','Content-Range','then','destroy','get','MailAccounts','UserProfileResource','end','stack','name','gmail','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','outlook365','smtp.office365.com','user','password','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','username','pass','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','model','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','MailServerIn','keys','find','body','provider','custom','update','describe','addDisposition','MailAccountId','create','getDispositions','Disposition','addAnswer','CannedAnswer','findOne','removeAnswers','key','email','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','ids','getInteractions','CmContact','User','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','finally','getApplications','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','send','split','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','attachments','join','server/files/attachments','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','List','ListId','messageId','attach'];(function(_0x28bb8d,_0x564dda){var _0x3c2d86=function(_0x21160e){while(--_0x21160e){_0x28bb8d['push'](_0x28bb8d['shift']());}};_0x3c2d86(++_0x564dda);}(_0x7f14,0xd1));var _0x47f1=function(_0xcf9a4e,_0x4315a1){_0xcf9a4e=_0xcf9a4e-0x0;var _0x315bab=_0x7f14[_0xcf9a4e];return _0x315bab;};'use strict';var moment=require(_0x47f1('0x0'));var BPromise=require('bluebird');var util=require(_0x47f1('0x1'));var path=require(_0x47f1('0x2'));var _=require(_0x47f1('0x3'));var juice=require(_0x47f1('0x4'));var Redis=require('ioredis');var qs=require(_0x47f1('0x5'));var logger=require(_0x47f1('0x6'))(_0x47f1('0x7'));var config=require(_0x47f1('0x8'));var db=require(_0x47f1('0x9'))['db'];config[_0x47f1('0xa')]=_[_0x47f1('0xb')](config[_0x47f1('0xa')],{'host':_0x47f1('0xc'),'port':0x18eb});var socket=require(_0x47f1('0xd'))(new Redis(config[_0x47f1('0xa')]));require('./mailAccount.socket')['register'](socket);var jayson=require(_0x47f1('0xe'));var client=jayson[_0x47f1('0xf')][_0x47f1('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x457f66,_0x27bf58,_0x112721,_0x834295){return new BPromise(function(_0x5cce9e,_0x23ddf7){var _0x12ef03=_0x834295||client;return _0x12ef03['request'](_0x457f66,_0x112721)['then'](function(_0x24a394){logger[_0x47f1('0x11')](_0x47f1('0x12'),_0x27bf58,_0x47f1('0x13'));logger[_0x47f1('0x14')](_0x47f1('0x15'),_0x27bf58,'request\x20sent',JSON['stringify'](_0x24a394));if(_0x24a394[_0x47f1('0x16')]){if(_0x24a394[_0x47f1('0x16')]['code']===0x1f4){logger[_0x47f1('0x16')](_0x47f1('0x12'),_0x27bf58,_0x24a394['error']['message']);return _0x23ddf7(_0x24a394[_0x47f1('0x16')]['message']);}logger[_0x47f1('0x16')](_0x47f1('0x12'),_0x27bf58,_0x24a394[_0x47f1('0x16')]['message']);return _0x5cce9e(_0x24a394['error'][_0x47f1('0x17')]);}else{logger['info'](_0x47f1('0x12'),_0x27bf58,_0x47f1('0x13'));_0x5cce9e(_0x24a394[_0x47f1('0x18')]['message']);}})[_0x47f1('0x19')](function(_0x5b4ab7){logger[_0x47f1('0x16')](_0x47f1('0x12'),_0x27bf58,_0x5b4ab7);_0x23ddf7(_0x5b4ab7);});});}function respondWithStatusCode(_0x28de05,_0x3d2b61){_0x3d2b61=_0x3d2b61||0xcc;return function(_0x41fc82){if(_0x41fc82){return _0x28de05[_0x47f1('0x1a')](_0x3d2b61);}return _0x28de05[_0x47f1('0x1b')](_0x3d2b61)['end']();};}function respondWithResult(_0x1fd6a0,_0x101ea8){_0x101ea8=_0x101ea8||0xc8;return function(_0x52dfe9){if(_0x52dfe9){return _0x1fd6a0[_0x47f1('0x1b')](_0x101ea8)[_0x47f1('0x1c')](_0x52dfe9);}};}function respondWithFilteredResult(_0x2931fc,_0x153d86){return function(_0x3a92c6){if(_0x3a92c6){var _0x529a3a=typeof _0x153d86[_0x47f1('0x1d')]===_0x47f1('0x1e')&&typeof _0x153d86['limit']===_0x47f1('0x1e');var _0xc9cd00=_0x3a92c6['count'];var _0x2904f6=_0x529a3a?0x0:_0x153d86['offset'];var _0x9f676=_0x529a3a?_0x3a92c6['count']:_0x153d86['offset']+_0x153d86['limit'];var _0x3172df;if(_0x9f676>=_0xc9cd00){_0x9f676=_0xc9cd00;_0x3172df=0xc8;}else{_0x3172df=0xce;}_0x2931fc[_0x47f1('0x1b')](_0x3172df);return _0x2931fc[_0x47f1('0x1f')](_0x47f1('0x20'),_0x2904f6+'-'+_0x9f676+'/'+_0xc9cd00)[_0x47f1('0x1c')](_0x3a92c6);}return null;};}function saveUpdates(_0x436263){return function(_0x3c0c42){if(_0x3c0c42){return _0x3c0c42['update'](_0x436263)[_0x47f1('0x21')](function(_0x4d2880){return _0x4d2880;});}return null;};}function removeEntity(_0x578266){return function(_0x36dd62){if(_0x36dd62){return _0x36dd62[_0x47f1('0x22')]()['then'](function(){var _0xa8e8b0=_0x36dd62[_0x47f1('0x23')]({'plain':!![]});var _0x41f413=_0x47f1('0x24');return db[_0x47f1('0x25')][_0x47f1('0x22')]({'where':{'type':_0x41f413,'resourceId':_0xa8e8b0['id']}})[_0x47f1('0x21')](function(){return _0x36dd62;});})[_0x47f1('0x21')](function(){_0x578266['status'](0xcc)[_0x47f1('0x26')]();});}};}function handleEntityNotFound(_0x419bdc){return function(_0x4f09b3){if(!_0x4f09b3){_0x419bdc[_0x47f1('0x1a')](0x194);}return _0x4f09b3;};}function handleError(_0x58841d,_0x22148d){_0x22148d=_0x22148d||0x1f4;return function(_0x363252){logger[_0x47f1('0x16')](_0x363252[_0x47f1('0x27')]);if(_0x363252['name']){delete _0x363252[_0x47f1('0x28')];}_0x58841d[_0x47f1('0x1b')](_0x22148d)['send'](_0x363252);};}function getImapHost(_0x4da62b){switch(_0x4da62b){case _0x47f1('0x29'):return'imap.gmail.com';case'yahoo':return'imap.mail.yahoo.com';case _0x47f1('0x2a'):return _0x47f1('0x2b');case'outlook365':return _0x47f1('0x2c');}throw new Error(_0x47f1('0x2d'),_0x4da62b);}function getSmtpHost(_0x341026){switch(_0x341026){case'gmail':return _0x47f1('0x2e');case _0x47f1('0x2f'):return _0x47f1('0x30');case _0x47f1('0x2a'):return'smtp-mail.outlook.com';case _0x47f1('0x31'):return _0x47f1('0x32');}throw new Error('Unknown\x20email\x20service\x20provider',_0x341026);}function getAuthenticationOptions(_0x4ba095,_0x53dc12){var _0x2fd026={};var _0x3f4833={};if(_0x4ba095){_0x2fd026['user']=_0x3f4833[_0x47f1('0x33')]=_0x53dc12['username'];_0x2fd026['password']=_0x3f4833['pass']=_0x53dc12[_0x47f1('0x34')];if(_0x53dc12['modernAuthentication']){_0x2fd026[_0x47f1('0x35')]=_0x3f4833['modernAuthentication']=!![];_0x2fd026[_0x47f1('0x36')]=_0x3f4833['CloudProviderId']=_0x53dc12['CloudProviderId'];_0x2fd026[_0x47f1('0x34')]=_0x3f4833['pass']=null;}else{_0x2fd026['CloudProviderId']=_0x3f4833[_0x47f1('0x36')]=null;}_0x2fd026['host']=getImapHost(_0x4ba095);_0x2fd026['port']=0x3e1;_0x3f4833[_0x47f1('0x37')]=getSmtpHost(_0x4ba095);_0x3f4833[_0x47f1('0x38')]=0x24b;_0x3f4833[_0x47f1('0x39')]=![];_0x2fd026['service']=_0x3f4833[_0x47f1('0x3a')]=null;}else{if(_0x53dc12[_0x47f1('0x3b')]){_0x2fd026[_0x47f1('0x33')]=_0x3f4833[_0x47f1('0x33')]=_0x53dc12[_0x47f1('0x3c')];_0x2fd026[_0x47f1('0x34')]=_0x3f4833[_0x47f1('0x3d')]=_0x53dc12[_0x47f1('0x34')];}else{_0x2fd026[_0x47f1('0x3b')]=_0x3f4833[_0x47f1('0x3b')]=![];_0x2fd026[_0x47f1('0x33')]=_0x3f4833['user']=null;_0x2fd026[_0x47f1('0x34')]=_0x3f4833['pass']=null;}_0x2fd026[_0x47f1('0x37')]=_0x53dc12[_0x47f1('0x3e')]['host'];_0x2fd026['port']=_0x53dc12[_0x47f1('0x3e')][_0x47f1('0x38')];_0x3f4833[_0x47f1('0x37')]=_0x53dc12[_0x47f1('0x3f')][_0x47f1('0x37')];_0x3f4833[_0x47f1('0x38')]=_0x53dc12[_0x47f1('0x3f')][_0x47f1('0x38')];}return{'Imap':_0x2fd026,'Smtp':_0x3f4833};}exports[_0x47f1('0x40')]=function(_0x4e1df2,_0x333e1b){var _0x4994e7={'include':[{'model':db['MailServerIn'],'as':_0x47f1('0x3e')},{'model':db[_0x47f1('0x41')],'as':_0x47f1('0x3f')},{'model':db[_0x47f1('0x42')],'as':_0x47f1('0x43')}]},_0x28b565={},_0x42b6e8={'count':0x0,'rows':[]};var _0x5ba7d7=_[_0x47f1('0x44')](db[_0x47f1('0x45')][_0x47f1('0x46')],function(_0x317557){return{'name':_0x317557[_0x47f1('0x47')],'type':_0x317557[_0x47f1('0x48')]['key']};});_0x28b565[_0x47f1('0x49')]=_[_0x47f1('0x44')](_0x5ba7d7,_0x47f1('0x28'));_0x28b565['query']=_['keys'](_0x4e1df2['query']);_0x28b565[_0x47f1('0x4a')]=_[_0x47f1('0x4b')](_0x28b565[_0x47f1('0x49')],_0x28b565['query']);_0x4994e7['attributes']=_[_0x47f1('0x4b')](_0x28b565['model'],qs[_0x47f1('0x4c')](_0x4e1df2[_0x47f1('0x4d')][_0x47f1('0x4c')]));_0x4994e7[_0x47f1('0x4e')]=_0x4994e7[_0x47f1('0x4e')][_0x47f1('0x4f')]?_0x4994e7[_0x47f1('0x4e')]:_0x28b565[_0x47f1('0x49')];if(!_0x4e1df2['query'][_0x47f1('0x50')](_0x47f1('0x51'))){_0x4994e7[_0x47f1('0x52')]=qs[_0x47f1('0x52')](_0x4e1df2[_0x47f1('0x4d')][_0x47f1('0x52')]);_0x4994e7[_0x47f1('0x1d')]=qs[_0x47f1('0x1d')](_0x4e1df2[_0x47f1('0x4d')]['offset']);}_0x4994e7[_0x47f1('0x53')]=qs[_0x47f1('0x54')](_0x4e1df2[_0x47f1('0x4d')]['sort']);_0x4994e7[_0x47f1('0x55')]=qs['filters'](_[_0x47f1('0x56')](_0x4e1df2[_0x47f1('0x4d')],_0x28b565[_0x47f1('0x4a')]),_0x5ba7d7);if(_0x4e1df2[_0x47f1('0x4d')][_0x47f1('0x57')]){_0x4994e7['where']=_[_0x47f1('0x58')](_0x4994e7[_0x47f1('0x55')],{'$or':_[_0x47f1('0x44')](_0x5ba7d7,function(_0x6e1db){if(_0x6e1db[_0x47f1('0x48')]!==_0x47f1('0x59')){var _0x47f054={};_0x47f054[_0x6e1db[_0x47f1('0x28')]]={'$like':'%'+_0x4e1df2[_0x47f1('0x4d')]['filter']+'%'};return _0x47f054;}})});}_0x4994e7=_[_0x47f1('0x58')]({},_0x4994e7,_0x4e1df2[_0x47f1('0x5a')]);var _0x44cbf1={'where':_0x4994e7['where']};return db[_0x47f1('0x45')][_0x47f1('0x5b')](_0x44cbf1)['then'](function(_0x51fc86){_0x42b6e8[_0x47f1('0x5b')]=_0x51fc86;if(_0x4e1df2[_0x47f1('0x4d')][_0x47f1('0x5c')]){_0x4994e7[_0x47f1('0x5d')]=[{'all':!![]}];}return db[_0x47f1('0x45')][_0x47f1('0x5e')](_0x4994e7);})[_0x47f1('0x21')](function(_0x13c29b){_0x42b6e8[_0x47f1('0x5f')]=_0x13c29b;return _0x42b6e8;})[_0x47f1('0x21')](respondWithFilteredResult(_0x333e1b,_0x4994e7))[_0x47f1('0x19')](handleError(_0x333e1b,null));};exports[_0x47f1('0x60')]=function(_0x368da4,_0x39e43e){var _0x54d834={'raw':![],'where':{'id':_0x368da4[_0x47f1('0x61')]['id']},'include':[{'model':db[_0x47f1('0x62')],'as':_0x47f1('0x3e')},{'model':db['MailServerOut'],'as':_0x47f1('0x3f')},{'model':db['Pause'],'as':_0x47f1('0x43')}]},_0x293469={};_0x293469[_0x47f1('0x49')]=_[_0x47f1('0x63')](db[_0x47f1('0x45')][_0x47f1('0x46')]);_0x293469[_0x47f1('0x4d')]=_[_0x47f1('0x63')](_0x368da4[_0x47f1('0x4d')]);_0x293469[_0x47f1('0x4a')]=_[_0x47f1('0x4b')](_0x293469[_0x47f1('0x49')],_0x293469[_0x47f1('0x4d')]);_0x54d834['attributes']=_[_0x47f1('0x4b')](_0x293469[_0x47f1('0x49')],qs[_0x47f1('0x4c')](_0x368da4[_0x47f1('0x4d')][_0x47f1('0x4c')]));_0x54d834[_0x47f1('0x4e')]=_0x54d834[_0x47f1('0x4e')]['length']?_0x54d834['attributes']:_0x293469[_0x47f1('0x49')];if(_0x368da4[_0x47f1('0x4d')][_0x47f1('0x5c')]){_0x54d834[_0x47f1('0x5d')]=[{'all':!![]}];}_0x54d834=_[_0x47f1('0x58')]({},_0x54d834,_0x368da4['options']);return db['MailAccount'][_0x47f1('0x64')](_0x54d834)[_0x47f1('0x21')](handleEntityNotFound(_0x39e43e,null))[_0x47f1('0x21')](respondWithResult(_0x39e43e,null))[_0x47f1('0x19')](handleError(_0x39e43e,null));};exports['update']=function(_0x16f44a,_0x2bf2a2){if(_0x16f44a[_0x47f1('0x65')]['id']){delete _0x16f44a[_0x47f1('0x65')]['id'];}var _0x6988f1=_0x16f44a[_0x47f1('0x65')][_0x47f1('0x66')]===_0x47f1('0x67')?null:_0x16f44a[_0x47f1('0x65')][_0x47f1('0x66')];var _0x545fda=_0x16f44a['body'][_0x47f1('0x3e')]||{};var _0x522200=_0x16f44a[_0x47f1('0x65')][_0x47f1('0x3f')]||{};if(_0x6988f1){_0x545fda[_0x47f1('0x37')]=getImapHost(_0x6988f1);_0x545fda[_0x47f1('0x38')]=0x3e1;_0x522200[_0x47f1('0x37')]=getSmtpHost(_0x6988f1);_0x522200[_0x47f1('0x38')]=0x24b;_0x522200[_0x47f1('0x39')]=![];}if(_0x522200['modernAuthentication']){_0x522200[_0x47f1('0x39')]=![];}else{_0x522200[_0x47f1('0x36')]=null;}if(!_0x545fda[_0x47f1('0x35')])_0x545fda['CloudProviderId']=null;_0x16f44a[_0x47f1('0x65')][_0x47f1('0x3e')]=_0x545fda;_0x16f44a[_0x47f1('0x65')][_0x47f1('0x3f')]=_0x522200;return db[_0x47f1('0x45')][_0x47f1('0x64')]({'where':{'id':_0x16f44a[_0x47f1('0x61')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x47f1('0x3e')},{'model':db[_0x47f1('0x41')],'as':_0x47f1('0x3f')},{'model':db[_0x47f1('0x42')],'as':'mandatoryDispositionPause'}]})[_0x47f1('0x21')](handleEntityNotFound(_0x2bf2a2,null))[_0x47f1('0x21')](function(_0x4d7113){if(!_0x4d7113)throw new Error('Mail\x20Account\x20not\x20found');if(_0x4d7113[_0x47f1('0x3a')])delete _0x16f44a[_0x47f1('0x65')][_0x47f1('0x3e')];return _0x4d7113;})[_0x47f1('0x21')](saveUpdates(_0x16f44a[_0x47f1('0x65')],null))['then'](function(_0x593950){if(!_0x16f44a[_0x47f1('0x65')]['Imap'])return _0x593950;return db[_0x47f1('0x62')][_0x47f1('0x68')](_0x16f44a[_0x47f1('0x65')][_0x47f1('0x3e')],{'where':{'MailAccountId':_0x593950['id']}})[_0x47f1('0x21')](function(){return _0x593950;});})['then'](function(_0x118eef){if(!_0x16f44a[_0x47f1('0x65')]['Smtp'])return _0x118eef;return db[_0x47f1('0x41')][_0x47f1('0x68')](_0x16f44a['body'][_0x47f1('0x3f')],{'where':{'MailAccountId':_0x118eef['id']}})['then'](function(){return _0x118eef;});})[_0x47f1('0x21')](respondWithResult(_0x2bf2a2,null))[_0x47f1('0x19')](handleError(_0x2bf2a2,null));};exports['describe']=function(_0x2b4f13,_0x291f46){return db[_0x47f1('0x45')][_0x47f1('0x69')]()[_0x47f1('0x21')](respondWithResult(_0x291f46,null))[_0x47f1('0x19')](handleError(_0x291f46,null));};exports[_0x47f1('0x6a')]=function(_0x2e69e9,_0x130f1b){if(_0x2e69e9['body']['id']){delete _0x2e69e9[_0x47f1('0x65')]['id'];}return db[_0x47f1('0x45')][_0x47f1('0x64')]({'where':{'id':_0x2e69e9[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x130f1b,null))['then'](function(_0x29758b){if(_0x29758b){_0x2e69e9[_0x47f1('0x65')][_0x47f1('0x6b')]=_0x29758b['id'];return db['Disposition'][_0x47f1('0x6c')](_0x2e69e9['body']);}})[_0x47f1('0x21')](respondWithResult(_0x130f1b,null))[_0x47f1('0x19')](handleError(_0x130f1b,null));};exports[_0x47f1('0x6d')]=function(_0x1d3ac0,_0x208720){var _0x36e150={'raw':![],'where':{}};var _0x556119={};var _0x1efda2={'count':0x0,'rows':[]};return db[_0x47f1('0x45')]['findOne']({'where':{'id':_0x1d3ac0[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x208720,null))[_0x47f1('0x21')](function(_0x3cbf94){if(_0x3cbf94){_0x556119[_0x47f1('0x49')]=_['keys'](db[_0x47f1('0x6e')][_0x47f1('0x46')]);_0x556119[_0x47f1('0x4d')]=_[_0x47f1('0x63')](_0x1d3ac0['query']);_0x556119[_0x47f1('0x4a')]=_['intersection'](_0x556119[_0x47f1('0x49')],_0x556119[_0x47f1('0x4d')]);_0x36e150[_0x47f1('0x4e')]=_[_0x47f1('0x4b')](_0x556119[_0x47f1('0x49')],qs[_0x47f1('0x4c')](_0x1d3ac0[_0x47f1('0x4d')]['fields']));_0x36e150['attributes']=_0x36e150[_0x47f1('0x4e')]['length']?_0x36e150[_0x47f1('0x4e')]:_0x556119[_0x47f1('0x49')];if(!_0x1d3ac0['query'][_0x47f1('0x50')]('nolimit')){_0x36e150[_0x47f1('0x52')]=qs[_0x47f1('0x52')](_0x1d3ac0[_0x47f1('0x4d')][_0x47f1('0x52')]);_0x36e150[_0x47f1('0x1d')]=qs['offset'](_0x1d3ac0[_0x47f1('0x4d')]['offset']);}_0x36e150[_0x47f1('0x53')]=qs[_0x47f1('0x54')](_0x1d3ac0['query'][_0x47f1('0x54')]);_0x36e150[_0x47f1('0x55')]=qs[_0x47f1('0x4a')](_['pick'](_0x1d3ac0[_0x47f1('0x4d')],_0x556119[_0x47f1('0x4a')]));_0x36e150[_0x47f1('0x55')][_0x47f1('0x6b')]=_0x3cbf94['id'];if(_0x1d3ac0['query']['filter']){_0x36e150[_0x47f1('0x55')]=_[_0x47f1('0x58')](_0x36e150['where'],{'$or':_[_0x47f1('0x44')](_0x36e150[_0x47f1('0x4e')],function(_0x20e3aa){var _0x6bb988={};_0x6bb988[_0x20e3aa]={'$like':'%'+_0x1d3ac0['query'][_0x47f1('0x57')]+'%'};return _0x6bb988;})});}_0x36e150=_['merge']({},_0x36e150,_0x1d3ac0[_0x47f1('0x5a')]);return db[_0x47f1('0x6e')]['count']({'where':_0x36e150['where']})['then'](function(_0x4b6775){_0x1efda2[_0x47f1('0x5b')]=_0x4b6775;if(_0x1d3ac0[_0x47f1('0x4d')][_0x47f1('0x5c')]){_0x36e150[_0x47f1('0x5d')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x36e150);})[_0x47f1('0x21')](function(_0x56ba30){_0x1efda2[_0x47f1('0x5f')]=_0x56ba30;return _0x1efda2;});}})['then'](respondWithFilteredResult(_0x208720,_0x36e150))[_0x47f1('0x19')](handleError(_0x208720,null));};exports['removeDispositions']=function(_0x59a63a,_0x45b894){return db[_0x47f1('0x45')][_0x47f1('0x64')]({'where':{'id':_0x59a63a[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x45b894,null))['then'](function(_0x252258){if(_0x252258){return _0x252258['removeDispositions'](_0x59a63a[_0x47f1('0x4d')]['ids']);}})['then'](respondWithStatusCode(_0x45b894,null))[_0x47f1('0x19')](handleError(_0x45b894,null));};exports[_0x47f1('0x6f')]=function(_0x2f81c5,_0x563789){if(_0x2f81c5['body']['id']){delete _0x2f81c5[_0x47f1('0x65')]['id'];}return db[_0x47f1('0x45')]['find']({'where':{'id':_0x2f81c5[_0x47f1('0x61')]['id']}})['then'](handleEntityNotFound(_0x563789,null))['then'](function(_0x801198){if(_0x801198){_0x2f81c5[_0x47f1('0x65')]['MailAccountId']=_0x801198['id'];return db[_0x47f1('0x70')]['create'](_0x2f81c5[_0x47f1('0x65')]);}})['then'](respondWithResult(_0x563789,null))[_0x47f1('0x19')](handleError(_0x563789,null));};exports['getAnswers']=function(_0x4a7142,_0xb338a6){var _0x42c773={'raw':![],'where':{}};var _0x5afc75={};var _0x7b7a00={'count':0x0,'rows':[]};return db[_0x47f1('0x45')][_0x47f1('0x71')]({'where':{'id':_0x4a7142[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0xb338a6,null))[_0x47f1('0x21')](function(_0xd1bdf1){if(_0xd1bdf1){_0x5afc75['model']=_[_0x47f1('0x63')](db[_0x47f1('0x70')][_0x47f1('0x46')]);_0x5afc75[_0x47f1('0x4d')]=_['keys'](_0x4a7142[_0x47f1('0x4d')]);_0x5afc75['filters']=_[_0x47f1('0x4b')](_0x5afc75[_0x47f1('0x49')],_0x5afc75[_0x47f1('0x4d')]);_0x42c773[_0x47f1('0x4e')]=_[_0x47f1('0x4b')](_0x5afc75[_0x47f1('0x49')],qs[_0x47f1('0x4c')](_0x4a7142['query'][_0x47f1('0x4c')]));_0x42c773[_0x47f1('0x4e')]=_0x42c773[_0x47f1('0x4e')]['length']?_0x42c773[_0x47f1('0x4e')]:_0x5afc75[_0x47f1('0x49')];if(!_0x4a7142[_0x47f1('0x4d')][_0x47f1('0x50')](_0x47f1('0x51'))){_0x42c773['limit']=qs[_0x47f1('0x52')](_0x4a7142[_0x47f1('0x4d')][_0x47f1('0x52')]);_0x42c773['offset']=qs[_0x47f1('0x1d')](_0x4a7142[_0x47f1('0x4d')]['offset']);}_0x42c773[_0x47f1('0x53')]=qs['sort'](_0x4a7142[_0x47f1('0x4d')][_0x47f1('0x54')]);_0x42c773[_0x47f1('0x55')]=qs[_0x47f1('0x4a')](_[_0x47f1('0x56')](_0x4a7142['query'],_0x5afc75['filters']));_0x42c773[_0x47f1('0x55')][_0x47f1('0x6b')]=_0xd1bdf1['id'];if(_0x4a7142[_0x47f1('0x4d')][_0x47f1('0x57')]){_0x42c773['where']=_[_0x47f1('0x58')](_0x42c773[_0x47f1('0x55')],{'$or':_[_0x47f1('0x44')](_0x42c773[_0x47f1('0x4e')],function(_0x3f303a){var _0x33e2b5={};_0x33e2b5[_0x3f303a]={'$like':'%'+_0x4a7142['query']['filter']+'%'};return _0x33e2b5;})});}_0x42c773=_[_0x47f1('0x58')]({},_0x42c773,_0x4a7142[_0x47f1('0x5a')]);return db[_0x47f1('0x70')][_0x47f1('0x5b')]({'where':_0x42c773[_0x47f1('0x55')]})['then'](function(_0x3e0c5d){_0x7b7a00['count']=_0x3e0c5d;if(_0x4a7142[_0x47f1('0x4d')]['includeAll']){_0x42c773['include']=[{'all':!![]}];}return db[_0x47f1('0x70')]['findAll'](_0x42c773);})[_0x47f1('0x21')](function(_0x4c4d11){_0x7b7a00[_0x47f1('0x5f')]=_0x4c4d11;return _0x7b7a00;});}})[_0x47f1('0x21')](respondWithFilteredResult(_0xb338a6,_0x42c773))[_0x47f1('0x19')](handleError(_0xb338a6,null));};exports[_0x47f1('0x72')]=function(_0xff0456,_0x1128b0){return db[_0x47f1('0x45')][_0x47f1('0x64')]({'where':{'id':_0xff0456['params']['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x1128b0,null))[_0x47f1('0x21')](function(_0x4e89f0){if(_0x4e89f0){return _0x4e89f0['removeAnswers'](_0xff0456[_0x47f1('0x4d')]['ids']);}})[_0x47f1('0x21')](respondWithStatusCode(_0x1128b0,null))[_0x47f1('0x19')](handleError(_0x1128b0,null));};exports['create']=function(_0xe24d9,_0x33c012){var _0x3eca96={'name':_0xe24d9[_0x47f1('0x65')]['name'],'key':_0xe24d9[_0x47f1('0x65')][_0x47f1('0x73')],'provider':_0xe24d9[_0x47f1('0x65')][_0x47f1('0x66')]===_0x47f1('0x67')?null:_0xe24d9[_0x47f1('0x65')][_0x47f1('0x66')],'email':_0xe24d9['body'][_0x47f1('0x74')],'ListId':_0xe24d9['body']['ListId'],'active':!_[_0x47f1('0x75')](_0xe24d9['body']['active'])?_0xe24d9[_0x47f1('0x65')][_0x47f1('0x76')]:!![],'description':_0xe24d9[_0x47f1('0x65')][_0x47f1('0x77')]||null};var _0x246384=getAuthenticationOptions(_0x3eca96[_0x47f1('0x66')],_0xe24d9[_0x47f1('0x65')]);_0x3eca96[_0x47f1('0x3e')]=_0x246384['Imap'];_0x3eca96[_0x47f1('0x3f')]=_0x246384[_0x47f1('0x3f')];return db['MailAccount'][_0x47f1('0x6c')](_0x3eca96,{'include':[{'model':db[_0x47f1('0x41')],'as':'Smtp'},{'model':db[_0x47f1('0x62')],'as':'Imap'}]})[_0x47f1('0x21')](function(_0x5ac283){var _0x3fe6b1=_0xe24d9['user'][_0x47f1('0x23')]({'plain':!![]});if(!_0x3fe6b1)throw new Error(_0x47f1('0x78'));if(_0x3fe6b1[_0x47f1('0x79')]==='user'){var _0x239cb6=_0x5ac283[_0x47f1('0x23')]({'plain':!![]});return db[_0x47f1('0x7a')][_0x47f1('0x64')]({'where':{'name':_0x47f1('0x24'),'userProfileId':_0x3fe6b1['userProfileId']},'raw':!![]})['then'](function(_0x3bff4c){if(_0x3bff4c&&_0x3bff4c[_0x47f1('0x7b')]===0x0){return db[_0x47f1('0x25')][_0x47f1('0x6c')]({'name':_0x239cb6['name'],'resourceId':_0x239cb6['id'],'type':_0x3bff4c[_0x47f1('0x28')],'sectionId':_0x3bff4c['id']},{})[_0x47f1('0x21')](function(){return _0x5ac283;});}else{return _0x5ac283;}})[_0x47f1('0x19')](function(_0x334151){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x334151);throw _0x334151;});}return _0x5ac283;})[_0x47f1('0x21')](respondWithResult(_0x33c012,0xc9))[_0x47f1('0x19')](handleError(_0x33c012,null));};exports[_0x47f1('0x7c')]=function(_0x27b6ad,_0x1bcb99){return db[_0x47f1('0x45')][_0x47f1('0x71')]({'where':{'id':_0x27b6ad['params']['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x1bcb99,null))[_0x47f1('0x21')](function(_0x3bed3b){if(_0x3bed3b){return _0x3bed3b[_0x47f1('0x7c')]();}return null;})['then'](respondWithResult(_0x1bcb99,null))[_0x47f1('0x19')](handleError(_0x1bcb99,null));};exports[_0x47f1('0x7d')]=function(_0x49b593,_0x249046){if(_0x49b593[_0x47f1('0x65')]['id']){delete _0x49b593['body']['id'];}return db[_0x47f1('0x45')]['find']({'where':{'id':_0x49b593[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x249046,null))[_0x47f1('0x21')](function(_0x560df9){if(_0x560df9){_0x49b593[_0x47f1('0x65')][_0x47f1('0x6b')]=_0x560df9['id'];return db['MailServerIn'][_0x47f1('0x6c')](_0x49b593[_0x47f1('0x65')]);}})[_0x47f1('0x21')](respondWithResult(_0x249046,null))[_0x47f1('0x19')](handleError(_0x249046,null));};exports[_0x47f1('0x7e')]=function(_0x4f7acf,_0x311191){return db['MailAccount'][_0x47f1('0x71')]({'where':{'id':_0x4f7acf[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x311191,null))[_0x47f1('0x21')](function(_0x3d251c){if(_0x3d251c){return _0x3d251c[_0x47f1('0x7f')](null);}return null;})['then'](respondWithStatusCode(_0x311191,null))[_0x47f1('0x19')](handleError(_0x311191,null));};exports[_0x47f1('0x80')]=function(_0xf10ebe,_0x214b0e){return db[_0x47f1('0x45')][_0x47f1('0x71')]({'where':{'id':_0xf10ebe[_0x47f1('0x61')]['id']}})['then'](handleEntityNotFound(_0x214b0e,null))['then'](function(_0x24ccad){if(_0x24ccad){return _0x24ccad[_0x47f1('0x80')]();}return null;})['then'](respondWithResult(_0x214b0e,null))[_0x47f1('0x19')](handleError(_0x214b0e,null));};exports[_0x47f1('0x81')]=function(_0x51b940,_0x492336){if(_0x51b940['body']['id']){delete _0x51b940[_0x47f1('0x65')]['id'];}return db[_0x47f1('0x45')]['find']({'where':{'id':_0x51b940[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x492336,null))[_0x47f1('0x21')](function(_0x1f6efc){if(_0x1f6efc){_0x51b940[_0x47f1('0x65')][_0x47f1('0x6b')]=_0x1f6efc['id'];return db['MailServerOut']['create'](_0x51b940[_0x47f1('0x65')]);}})[_0x47f1('0x21')](respondWithResult(_0x492336,null))[_0x47f1('0x19')](handleError(_0x492336,null));};exports[_0x47f1('0x82')]=function(_0xac3686,_0x267089){return db['MailAccount'][_0x47f1('0x71')]({'where':{'id':_0xac3686[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x267089,null))[_0x47f1('0x21')](function(_0x28dd5d){if(_0x28dd5d){return _0x28dd5d[_0x47f1('0x83')](null);}return null;})[_0x47f1('0x21')](respondWithStatusCode(_0x267089,null))[_0x47f1('0x19')](handleError(_0x267089,null));};exports[_0x47f1('0x84')]=function(_0x499d0f,_0x3e4da8){return db[_0x47f1('0x85')][_0x47f1('0x64')]({'where':{'id':_0x499d0f[_0x47f1('0x61')]['id']}})['then'](handleEntityNotFound(_0x3e4da8,null))[_0x47f1('0x21')](function(_0x5277d4){if(_0x5277d4){return _0x5277d4['addInteraction'](_0x499d0f[_0x47f1('0x65')][_0x47f1('0x86')],_['omit'](_0x499d0f[_0x47f1('0x65')],['ids','id'])||{});}})[_0x47f1('0x21')](respondWithResult(_0x3e4da8,null))[_0x47f1('0x19')](handleError(_0x3e4da8,null));};exports[_0x47f1('0x87')]=function(_0x2cdfae,_0x426a21){var _0x131158={'raw':![],'where':{}};var _0x3a1b06={};var _0x4be35b={'count':0x0,'rows':[]};return db[_0x47f1('0x45')][_0x47f1('0x71')]({'where':{'id':_0x2cdfae['params']['id']}})['then'](handleEntityNotFound(_0x426a21,null))[_0x47f1('0x21')](function(_0x2d9d5b){if(_0x2d9d5b){_0x3a1b06[_0x47f1('0x49')]=_[_0x47f1('0x63')](db[_0x47f1('0x85')][_0x47f1('0x46')]);_0x3a1b06[_0x47f1('0x4d')]=_[_0x47f1('0x63')](_0x2cdfae[_0x47f1('0x4d')]);_0x3a1b06[_0x47f1('0x4a')]=_[_0x47f1('0x4b')](_0x3a1b06[_0x47f1('0x49')],_0x3a1b06[_0x47f1('0x4d')]);_0x131158[_0x47f1('0x4e')]=_[_0x47f1('0x4b')](_0x3a1b06[_0x47f1('0x49')],qs['fields'](_0x2cdfae[_0x47f1('0x4d')][_0x47f1('0x4c')]));_0x131158[_0x47f1('0x4e')]=_0x131158['attributes']['length']?_0x131158['attributes']:_0x3a1b06['model'];if(!_0x2cdfae[_0x47f1('0x4d')]['hasOwnProperty'](_0x47f1('0x51'))){_0x131158[_0x47f1('0x52')]=qs[_0x47f1('0x52')](_0x2cdfae['query']['limit']);_0x131158[_0x47f1('0x1d')]=qs[_0x47f1('0x1d')](_0x2cdfae[_0x47f1('0x4d')]['offset']);}_0x131158[_0x47f1('0x53')]=qs[_0x47f1('0x54')](_0x2cdfae['query'][_0x47f1('0x54')]);_0x131158[_0x47f1('0x55')]=qs['filters'](_[_0x47f1('0x56')](_0x2cdfae[_0x47f1('0x4d')],_0x3a1b06[_0x47f1('0x4a')]));_0x131158['where']['MailAccountId']=_0x2d9d5b['id'];if(_0x2cdfae['query'][_0x47f1('0x57')]){_0x131158['where']=_[_0x47f1('0x58')](_0x131158[_0x47f1('0x55')],{'$or':_['map'](_0x131158[_0x47f1('0x4e')],function(_0x20fb38){var _0x1d08a7={};_0x1d08a7[_0x20fb38]={'$like':'%'+_0x2cdfae[_0x47f1('0x4d')]['filter']+'%'};return _0x1d08a7;})});}_0x131158=_[_0x47f1('0x58')]({},_0x131158,_0x2cdfae[_0x47f1('0x5a')]);return db[_0x47f1('0x85')][_0x47f1('0x5b')]({'where':_0x131158[_0x47f1('0x55')]})['then'](function(_0x4fd603){_0x4be35b[_0x47f1('0x5b')]=_0x4fd603;if(_0x2cdfae['query']['includeAll']){_0x131158['include']=[{'model':db[_0x47f1('0x88')],'as':'Contact','required':![]},{'model':db[_0x47f1('0x89')],'as':'Owner','attributes':[_0x47f1('0x28'),_0x47f1('0x8a'),_0x47f1('0x8b')],'required':![]},{'model':db['Tag'],'as':_0x47f1('0x8c'),'attributes':['id',_0x47f1('0x28'),_0x47f1('0x8d')],'where':_0x2cdfae[_0x47f1('0x4d')][_0x47f1('0x8e')]?{'id':_0x2cdfae[_0x47f1('0x4d')][_0x47f1('0x8e')]}:undefined,'required':_0x2cdfae[_0x47f1('0x4d')][_0x47f1('0x8e')]?!![]:![]}];}return db[_0x47f1('0x85')][_0x47f1('0x5e')](_0x131158);})['then'](function(_0x3b699a){_0x4be35b[_0x47f1('0x5f')]=_0x3b699a;return _0x4be35b;});}})['then'](respondWithFilteredResult(_0x426a21,_0x131158))[_0x47f1('0x19')](handleError(_0x426a21,null));};exports[_0x47f1('0x8f')]=function addApplications(_0x4b81df,_0xcc8c1b){var _0x3aa3ef=_0x4b81df['params']['id'];var _0x43f539=_0x4b81df[_0x47f1('0x65')];var _0x350e8f=0xc8;var _0x22946a=null;return db[_0x47f1('0x90')][_0x47f1('0x91')]({'isolationLevel':db['sequelize'][_0x47f1('0x92')][_0x47f1('0x93')][_0x47f1('0x94')]},function(_0x422780){return db[_0x47f1('0x45')][_0x47f1('0x71')]({'where':{'id':_0x3aa3ef},'transaction':_0x422780})['then'](function(_0x598bb3){if(_0x598bb3){return db[_0x47f1('0x95')][_0x47f1('0x22')]({'where':{'MailAccountId':_0x3aa3ef},'transaction':_0x422780})[_0x47f1('0x21')](function(){var _0x52715e=_[_0x47f1('0x44')](_0x43f539,function(_0x1aec8a){_0x1aec8a[_0x47f1('0x6b')]=_0x3aa3ef;return _0x1aec8a;});return db['MailApplication'][_0x47f1('0x96')](_0x52715e,{'transaction':_0x422780});});}else{_0x350e8f=0x194;_0x22946a=[];}});})[_0x47f1('0x21')](function(){if(_0x350e8f!==0x194){return db[_0x47f1('0x95')]['findAndCountAll']({'where':{'MailAccountId':_0x3aa3ef},'order':_0x47f1('0x97')})[_0x47f1('0x21')](function(_0x5ddd7d){_0x22946a=_0x5ddd7d;});}})['catch'](function(_0x291fdb){_0x350e8f=0x1f4;logger[_0x47f1('0x16')](_0x291fdb[_0x47f1('0x27')]);if(_0x291fdb[_0x47f1('0x28')]){delete _0x291fdb[_0x47f1('0x28')];}_0x22946a=_0x291fdb;})[_0x47f1('0x98')](function(){if(_0x22946a===null){_0xcc8c1b[_0x47f1('0x1a')](_0x350e8f);}else{if(_0x350e8f===0x1f4){_0xcc8c1b[_0x47f1('0x1b')](_0x350e8f)['send'](_0x22946a);}else{_0xcc8c1b['status'](_0x350e8f)[_0x47f1('0x1c')](_0x22946a);}}});};exports[_0x47f1('0x99')]=function(_0x3eb662,_0x1a6605){var _0x24ef40={};var _0x3e7cbb={};var _0x21feef;var _0x3acd43;return db['MailAccount'][_0x47f1('0x71')]({'where':{'id':_0x3eb662[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x1a6605,null))[_0x47f1('0x21')](function(_0x19e98b){if(_0x19e98b){_0x21feef=_0x19e98b;_0x3e7cbb['model']=_[_0x47f1('0x63')](db[_0x47f1('0x95')][_0x47f1('0x46')]);_0x3e7cbb[_0x47f1('0x4d')]=_[_0x47f1('0x63')](_0x3eb662[_0x47f1('0x4d')]);_0x3e7cbb['filters']=_[_0x47f1('0x4b')](_0x3e7cbb[_0x47f1('0x49')],_0x3e7cbb['query']);_0x24ef40['attributes']=_[_0x47f1('0x4b')](_0x3e7cbb[_0x47f1('0x49')],qs['fields'](_0x3eb662[_0x47f1('0x4d')]['fields']));_0x24ef40['attributes']=_0x24ef40[_0x47f1('0x4e')][_0x47f1('0x4f')]?_0x24ef40[_0x47f1('0x4e')]:_0x3e7cbb[_0x47f1('0x49')];_0x24ef40['order']=qs[_0x47f1('0x54')](_0x3eb662['query'][_0x47f1('0x54')]);_0x24ef40[_0x47f1('0x55')]=qs[_0x47f1('0x4a')](_[_0x47f1('0x56')](_0x3eb662[_0x47f1('0x4d')],_0x3e7cbb[_0x47f1('0x4a')]));if(_0x3eb662[_0x47f1('0x4d')][_0x47f1('0x57')]){_0x24ef40[_0x47f1('0x55')]=_[_0x47f1('0x58')](_0x24ef40[_0x47f1('0x55')],{'$or':_['map'](_0x24ef40[_0x47f1('0x4e')],function(_0x2b8438){var _0x287755={};_0x287755[_0x2b8438]={'$like':'%'+_0x3eb662[_0x47f1('0x4d')][_0x47f1('0x57')]+'%'};return _0x287755;})});}_0x24ef40=_[_0x47f1('0x58')]({},_0x24ef40,_0x3eb662[_0x47f1('0x5a')]);return _0x21feef['getApplications'](_0x24ef40);}})[_0x47f1('0x21')](function(_0x18da62){if(_0x18da62){_0x3acd43=_0x18da62['length'];if(!_0x3eb662[_0x47f1('0x4d')][_0x47f1('0x50')](_0x47f1('0x51'))){_0x24ef40['limit']=qs[_0x47f1('0x52')](_0x3eb662['query'][_0x47f1('0x52')]);_0x24ef40[_0x47f1('0x1d')]=qs[_0x47f1('0x1d')](_0x3eb662[_0x47f1('0x4d')][_0x47f1('0x1d')]);}return _0x21feef[_0x47f1('0x99')](_0x24ef40);}})[_0x47f1('0x21')](function(_0x11499d){if(_0x11499d){return _0x11499d?{'count':_0x3acd43,'rows':_0x11499d}:null;}})[_0x47f1('0x21')](respondWithResult(_0x1a6605,null))['catch'](handleError(_0x1a6605,null));};exports[_0x47f1('0x9a')]=function(_0x2bbcec,_0x536957){var _0x448f61={'raw':!![],'where':{}};var _0x36f2df={};var _0x4fd7b7={'count':0x0,'rows':[]};return db[_0x47f1('0x45')][_0x47f1('0x71')]({'where':{'id':_0x2bbcec[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x536957,null))['then'](function(_0x10606a){if(_0x10606a){_0x36f2df[_0x47f1('0x49')]=_['keys'](db['MailMessage']['rawAttributes']);_0x36f2df[_0x47f1('0x4d')]=_[_0x47f1('0x63')](_0x2bbcec['query']);_0x36f2df[_0x47f1('0x4a')]=_[_0x47f1('0x4b')](_0x36f2df['model'],_0x36f2df[_0x47f1('0x4d')]);_0x448f61[_0x47f1('0x4e')]=_[_0x47f1('0x4b')](_0x36f2df[_0x47f1('0x49')],qs[_0x47f1('0x4c')](_0x2bbcec[_0x47f1('0x4d')]['fields']));_0x448f61['attributes']=_0x448f61[_0x47f1('0x4e')]['length']?_0x448f61[_0x47f1('0x4e')]:_0x36f2df[_0x47f1('0x49')];if(!_0x2bbcec[_0x47f1('0x4d')]['hasOwnProperty']('nolimit')){_0x448f61['limit']=qs[_0x47f1('0x52')](_0x2bbcec[_0x47f1('0x4d')]['limit']);_0x448f61[_0x47f1('0x1d')]=qs['offset'](_0x2bbcec[_0x47f1('0x4d')][_0x47f1('0x1d')]);}_0x448f61[_0x47f1('0x53')]=qs[_0x47f1('0x54')](_0x2bbcec[_0x47f1('0x4d')]['sort']);_0x448f61[_0x47f1('0x55')]=qs['filters'](_[_0x47f1('0x56')](_0x2bbcec['query'],_0x36f2df[_0x47f1('0x4a')]));_0x448f61[_0x47f1('0x55')][_0x47f1('0x6b')]=_0x10606a['id'];if(_0x2bbcec[_0x47f1('0x4d')]['filter']){_0x448f61[_0x47f1('0x55')]=_[_0x47f1('0x58')](_0x448f61[_0x47f1('0x55')],{'$or':_[_0x47f1('0x44')](_0x448f61[_0x47f1('0x4e')],function(_0x45bcbc){var _0x14fd82={};_0x14fd82[_0x45bcbc]={'$like':'%'+_0x2bbcec['query'][_0x47f1('0x57')]+'%'};return _0x14fd82;})});}if(_0x2bbcec[_0x47f1('0x4d')]['$gte']){var _0x3e2767=_0x2bbcec[_0x47f1('0x4d')][_0x47f1('0x9b')]['split'](',');var _0x5f055b={};_0x5f055b[_0x3e2767[0x0]]={'$gte':moment(_0x3e2767[0x1])[_0x47f1('0x9c')](_0x47f1('0x9d'))};_0x448f61[_0x47f1('0x55')]=_[_0x47f1('0x58')](_0x448f61['where'],_0x5f055b);}_0x448f61=_[_0x47f1('0x58')]({},_0x448f61,_0x2bbcec[_0x47f1('0x5a')]);return db[_0x47f1('0x9e')][_0x47f1('0x5b')]({'where':_0x448f61[_0x47f1('0x55')]})[_0x47f1('0x21')](function(_0x10a524){_0x4fd7b7[_0x47f1('0x5b')]=_0x10a524;if(_0x2bbcec[_0x47f1('0x4d')]['includeAll']){_0x448f61[_0x47f1('0x5d')]=[{'all':!![]}];}return db['MailMessage'][_0x47f1('0x5e')](_0x448f61);})['then'](function(_0x445602){if(_0x2bbcec[_0x47f1('0x4d')][_0x47f1('0x9f')]==='true'){for(var _0x476416=0x0;_0x476416<_0x445602['length'];_0x476416++){_0x445602[_0x476416][_0x47f1('0x65')]=juice(_0x445602[_0x476416][_0x47f1('0x65')]);}}_0x4fd7b7[_0x47f1('0x5f')]=_0x445602;return _0x4fd7b7;});}})[_0x47f1('0x21')](respondWithFilteredResult(_0x536957,_0x448f61))[_0x47f1('0x19')](handleError(_0x536957,null));};exports[_0x47f1('0xa0')]=function(_0x48b2e5,_0x367d57){var _0x4eab17,_0x1ffdce={},_0x2f32f0;if(_0x48b2e5[_0x47f1('0x65')]['to']){_0x2f32f0=_0x48b2e5[_0x47f1('0x65')]['to'][_0x47f1('0xa1')](',')[0x0];}return db[_0x47f1('0x45')][_0x47f1('0x64')]({'where':{'id':_0x48b2e5['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x47f1('0x88')],'as':_0x47f1('0xa2'),'where':{'email':_0x2f32f0},'limit':0x1,'order':[[_0x47f1('0xa3'),_0x47f1('0xa4')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x47f1('0xa5')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x367d57,null))[_0x47f1('0x21')](function(_0x3ae501){if(!_0x3ae501)return;_0x4eab17=_0x3ae501;if(!_0x3ae501[_0x47f1('0x3f')])throw new Error(_0x47f1('0xa6'));if(_['isNil'](_0x48b2e5[_0x47f1('0x65')][_0x47f1('0xa7')])){_0x48b2e5[_0x47f1('0x65')][_0x47f1('0xa7')]=util['format']('%s\x20<%s>',_0x3ae501['name'],_0x3ae501[_0x47f1('0x74')]||_0x3ae501['Smtp'][_0x47f1('0x33')]);}if(_0x48b2e5['body'][_0x47f1('0xa8')]&&_0x48b2e5[_0x47f1('0x65')][_0x47f1('0xa8')][_0x47f1('0x4f')]){for(var _0x563056=0x0;_0x563056<_0x48b2e5[_0x47f1('0x65')][_0x47f1('0xa8')][_0x47f1('0x4f')];_0x563056+=0x1){_0x48b2e5[_0x47f1('0x65')][_0x47f1('0xa8')][_0x563056]={'filename':_0x48b2e5['body'][_0x47f1('0xa8')][_0x563056][_0x47f1('0x28')],'path':path[_0x47f1('0xa9')](config['root'],_0x47f1('0xaa'),_0x48b2e5[_0x47f1('0x65')]['attachments'][_0x563056]['basename'])};}}var _0x19a1d0=_0x3ae501[_0x47f1('0xab')]();return respondWithRpcPromise(_0x47f1('0xac'),_0x47f1('0xad'),{'account':_0x19a1d0,'message':_0x48b2e5[_0x47f1('0x65')]});})[_0x47f1('0x21')](function(_0x3896b9){if(!_0x3896b9)return;_0x1ffdce=_0x3896b9;if(!_0x4eab17['List'])throw new Error(_0x47f1('0xae'));if(_0x4eab17[_0x47f1('0xaf')][_0x47f1('0xa2')][_0x47f1('0x4f')])return _0x4eab17[_0x47f1('0xaf')]['Contacts'][0x0];return db[_0x47f1('0x88')][_0x47f1('0x6c')](_[_0x47f1('0xb')](_0x48b2e5[_0x47f1('0x65')],{'firstName':_0x48b2e5[_0x47f1('0x65')]['to'],'email':_0x48b2e5[_0x47f1('0x65')]['to'],'phone':_0x48b2e5[_0x47f1('0x65')]['to'],'ListId':_0x4eab17[_0x47f1('0xb0')]}));})['then'](function(_0x522340){if(!_0x522340)return;var _0x1e2413={'UserId':_0x48b2e5[_0x47f1('0x33')]['id'],'ContactId':_0x522340['id'],'MailAccountId':_0x4eab17['id'],'inReplyTo':_0x1ffdce[_0x47f1('0xb1')],'to':_0x48b2e5[_0x47f1('0x65')][_0x47f1('0xa7')],'cc':_0x48b2e5[_0x47f1('0x65')]['cc'],'subject':_0x48b2e5[_0x47f1('0x65')]['subject'],'attach':_0x48b2e5[_0x47f1('0x65')][_0x47f1('0xb2')],'firstMsgDirection':_0x47f1('0xb3'),'lastMsgAt':moment()['format'](_0x47f1('0x9d')),'lastMsgDirection':_0x47f1('0xb3'),'Messages':[_[_0x47f1('0x58')](_0x48b2e5[_0x47f1('0x65')],{'messageId':_0x1ffdce[_0x47f1('0xb1')],'sentAt':moment()[_0x47f1('0x9c')](_0x47f1('0x9d')),'read':!![],'MailAccountId':_0x4eab17['id'],'UserId':_0x48b2e5['user']['id'],'ContactId':_0x522340['id']})]};if(_0x48b2e5[_0x47f1('0x65')]['Interaction']){_0x1e2413=_['merge'](_0x1e2413,_0x48b2e5[_0x47f1('0x65')][_0x47f1('0xb4')]);}return db[_0x47f1('0x85')][_0x47f1('0x6c')](_0x1e2413,{'include':[{'model':db['MailMessage'],'as':_0x47f1('0xb5')}]});})[_0x47f1('0x21')](respondWithResult(_0x367d57,null))[_0x47f1('0x19')](handleError(_0x367d57,null));};exports['verifySmtp']=function(_0x333dfc,_0x148a57){return db[_0x47f1('0x45')]['find']({'where':{'id':_0x333dfc[_0x47f1('0x61')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x47f1('0x3f'),'raw':!![],'include':[{'model':db[_0x47f1('0xa5')],'as':_0x47f1('0xa5'),'raw':!![]}]}]})[_0x47f1('0x21')](handleEntityNotFound(_0x148a57,null))['then'](function(_0x4a58c7){if(!_0x4a58c7[_0x47f1('0x3f')])return;var _0x23b9af=_0x4a58c7[_0x47f1('0xab')]();return respondWithRpcPromise(_0x47f1('0xb6'),'verifySmtp',{'account':_0x23b9af});})[_0x47f1('0x21')](respondWithResult(_0x148a57,null))['catch'](handleError(_0x148a57,null));};exports[_0x47f1('0x22')]=function(_0xd6fba0,_0xf5425b){return db[_0x47f1('0x45')][_0x47f1('0x64')]({'where':{'id':_0xd6fba0[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0xf5425b,null))['then'](function(_0x46de77){if(_0x46de77&&_0x46de77[_0x47f1('0x3a')]){throw new db[(_0x47f1('0xb7'))][(_0x47f1('0xb8'))](_0x47f1('0xb9'));}return _0x46de77;})[_0x47f1('0x21')](removeEntity(_0xf5425b,null))['catch'](handleError(_0xf5425b,null));};exports[_0x47f1('0xba')]=function(_0x398c95,_0x579692){return db[_0x47f1('0x45')][_0x47f1('0x64')]({'where':{'id':_0x398c95[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x579692,null))[_0x47f1('0x21')](function(_0x3d8ebc){if(_0x3d8ebc){return _0x3d8ebc[_0x47f1('0xba')](_0x398c95[_0x47f1('0x65')]['ids'],_[_0x47f1('0xbb')](_0x398c95[_0x47f1('0x65')],['ids','id'])||{})[_0x47f1('0xbc')](function(_0x2d57af){for(var _0x149cd8=0x0;_0x149cd8<_0x398c95[_0x47f1('0x65')][_0x47f1('0x86')][_0x47f1('0x4f')];_0x149cd8+=0x1){socket[_0x47f1('0xbd')](_0x47f1('0xbe'),{'UserId':Number(_0x398c95[_0x47f1('0x65')][_0x47f1('0x86')][_0x149cd8]),'MailAccountId':Number(_0x398c95[_0x47f1('0x61')]['id'])});}return _0x2d57af;});}})[_0x47f1('0x21')](respondWithResult(_0x579692,null))['catch'](handleError(_0x579692,null));};exports[_0x47f1('0xbf')]=function(_0x16e1ed,_0x542bf7){return db[_0x47f1('0x45')][_0x47f1('0x64')]({'where':{'id':_0x16e1ed[_0x47f1('0x61')]['id']}})['then'](handleEntityNotFound(_0x542bf7,null))[_0x47f1('0x21')](function(_0x530aba){if(_0x530aba){return _0x530aba['removeAgents'](_0x16e1ed[_0x47f1('0x4d')]['ids'])['then'](function(){if(_['isArray'](_0x16e1ed[_0x47f1('0x4d')]['ids'])){for(var _0x4e68aa=0x0;_0x4e68aa<_0x16e1ed[_0x47f1('0x4d')][_0x47f1('0x86')]['length'];_0x4e68aa+=0x1){socket[_0x47f1('0xbd')](_0x47f1('0xc0'),{'UserId':Number(_0x16e1ed[_0x47f1('0x4d')][_0x47f1('0x86')][_0x4e68aa]),'MailAccountId':Number(_0x16e1ed[_0x47f1('0x61')]['id'])});}}else{socket[_0x47f1('0xbd')]('userMailAccount:remove',{'UserId':Number(_0x16e1ed[_0x47f1('0x4d')][_0x47f1('0x86')]),'MailAccountId':Number(_0x16e1ed['params']['id'])});}});}})[_0x47f1('0x21')](respondWithStatusCode(_0x542bf7,null))[_0x47f1('0x19')](handleError(_0x542bf7,null));};exports[_0x47f1('0xc1')]=function(_0x4c3b3d,_0x550f34){var _0x5ce2fb={};var _0x28bf9a={};var _0x1bb494;var _0x641e91;return db['MailAccount'][_0x47f1('0x71')]({'where':{'id':_0x4c3b3d[_0x47f1('0x61')]['id']}})['then'](handleEntityNotFound(_0x550f34,null))[_0x47f1('0x21')](function(_0x29f8ff){if(_0x29f8ff){_0x1bb494=_0x29f8ff;_0x28bf9a['model']=_[_0x47f1('0x63')](db['User']['rawAttributes']);_0x28bf9a[_0x47f1('0x4d')]=_['keys'](_0x4c3b3d['query']);_0x28bf9a[_0x47f1('0x4a')]=_['intersection'](_0x28bf9a['model'],_0x28bf9a[_0x47f1('0x4d')]);_0x5ce2fb[_0x47f1('0x4e')]=_[_0x47f1('0x4b')](_0x28bf9a[_0x47f1('0x49')],qs['fields'](_0x4c3b3d[_0x47f1('0x4d')]['fields']));_0x5ce2fb['attributes']=_0x5ce2fb[_0x47f1('0x4e')]['length']?_0x5ce2fb[_0x47f1('0x4e')]:_0x28bf9a[_0x47f1('0x49')];_0x5ce2fb[_0x47f1('0x53')]=qs[_0x47f1('0x54')](_0x4c3b3d[_0x47f1('0x4d')]['sort']);_0x5ce2fb[_0x47f1('0x55')]=qs[_0x47f1('0x4a')](_['pick'](_0x4c3b3d['query'],_0x28bf9a[_0x47f1('0x4a')]));if(_0x4c3b3d['query']['filter']){_0x5ce2fb['where']=_[_0x47f1('0x58')](_0x5ce2fb[_0x47f1('0x55')],{'$or':_[_0x47f1('0x44')](_0x5ce2fb[_0x47f1('0x4e')],function(_0x560845){var _0x16c10e={};_0x16c10e[_0x560845]={'$like':'%'+_0x4c3b3d[_0x47f1('0x4d')][_0x47f1('0x57')]+'%'};return _0x16c10e;})});}_0x5ce2fb=_['merge']({},_0x5ce2fb,_0x4c3b3d[_0x47f1('0x5a')]);return _0x1bb494[_0x47f1('0xc1')](_0x5ce2fb);}})[_0x47f1('0x21')](function(_0x2a9712){if(_0x2a9712){_0x641e91=_0x2a9712['length'];if(!_0x4c3b3d[_0x47f1('0x4d')][_0x47f1('0x50')](_0x47f1('0x51'))){_0x5ce2fb[_0x47f1('0x52')]=qs[_0x47f1('0x52')](_0x4c3b3d[_0x47f1('0x4d')]['limit']);_0x5ce2fb['offset']=qs['offset'](_0x4c3b3d[_0x47f1('0x4d')]['offset']);}return _0x1bb494[_0x47f1('0xc1')](_0x5ce2fb);}})['then'](function(_0x32aea4){if(_0x32aea4){return _0x32aea4?{'count':_0x641e91,'rows':_0x32aea4}:null;}})[_0x47f1('0x21')](respondWithResult(_0x550f34,null))[_0x47f1('0x19')](handleError(_0x550f34,null));}; \ No newline at end of file +var _0xea9c=['getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ListId','isNil','active','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','ids','omit','CmContact','Contact','User','Owner','internal','Tag','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','priority','finally','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','List','Contacts','updatedAt','DESC','CloudProvider','format','%s\x20<%s>','attachments','join','root','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','destroy','MailAccounts','name','send','gmail','imap.gmail.com','hotmail','imap-mail.outlook.com','outlook.office365.com','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password','modernAuthentication','CloudProviderId','pass','host','port','secure','service','authentication','Imap','index','MailServerIn','Smtp','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','MailAccount','findAll','rows','params','MailServerOut','Pause','includeAll','include','options','find','catch','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create'];(function(_0xb0c605,_0x30653a){var _0x285ff1=function(_0x1bfd49){while(--_0x1bfd49){_0xb0c605['push'](_0xb0c605['shift']());}};_0x285ff1(++_0x30653a);}(_0xea9c,0x117));var _0xcea9=function(_0x38c8ed,_0x1d9c22){_0x38c8ed=_0x38c8ed-0x0;var _0x5acbcf=_0xea9c[_0x38c8ed];return _0x5acbcf;};'use strict';var moment=require(_0xcea9('0x0'));var BPromise=require(_0xcea9('0x1'));var util=require(_0xcea9('0x2'));var path=require(_0xcea9('0x3'));var _=require(_0xcea9('0x4'));var juice=require(_0xcea9('0x5'));var Redis=require(_0xcea9('0x6'));var qs=require(_0xcea9('0x7'));var logger=require(_0xcea9('0x8'))(_0xcea9('0x9'));var config=require(_0xcea9('0xa'));var db=require('../../mysqldb')['db'];config[_0xcea9('0xb')]=_[_0xcea9('0xc')](config[_0xcea9('0xb')],{'host':_0xcea9('0xd'),'port':0x18eb});var socket=require(_0xcea9('0xe'))(new Redis(config[_0xcea9('0xb')]));require('./mailAccount.socket')[_0xcea9('0xf')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x7ce9e4,_0x37e0e8,_0x2d695b,_0xac51ce){return new BPromise(function(_0x48dbd1,_0x360501){var _0xe6a762=_0xac51ce||client;return _0xe6a762['request'](_0x7ce9e4,_0x2d695b)[_0xcea9('0x10')](function(_0x15a5b4){logger[_0xcea9('0x11')]('MailAccount,\x20%s,\x20%s',_0x37e0e8,_0xcea9('0x12'));logger['debug'](_0xcea9('0x13'),_0x37e0e8,'request\x20sent',JSON[_0xcea9('0x14')](_0x15a5b4));if(_0x15a5b4[_0xcea9('0x15')]){if(_0x15a5b4['error'][_0xcea9('0x16')]===0x1f4){logger['error'](_0xcea9('0x17'),_0x37e0e8,_0x15a5b4[_0xcea9('0x15')][_0xcea9('0x18')]);return _0x360501(_0x15a5b4[_0xcea9('0x15')]['message']);}logger[_0xcea9('0x15')](_0xcea9('0x17'),_0x37e0e8,_0x15a5b4[_0xcea9('0x15')][_0xcea9('0x18')]);return _0x48dbd1(_0x15a5b4[_0xcea9('0x15')][_0xcea9('0x18')]);}else{logger[_0xcea9('0x11')](_0xcea9('0x17'),_0x37e0e8,_0xcea9('0x12'));_0x48dbd1(_0x15a5b4[_0xcea9('0x19')][_0xcea9('0x18')]);}})['catch'](function(_0x3c5e6a){logger['error'](_0xcea9('0x17'),_0x37e0e8,_0x3c5e6a);_0x360501(_0x3c5e6a);});});}function respondWithStatusCode(_0x2af757,_0x5ad1ab){_0x5ad1ab=_0x5ad1ab||0xcc;return function(_0x5ed5de){if(_0x5ed5de){return _0x2af757[_0xcea9('0x1a')](_0x5ad1ab);}return _0x2af757[_0xcea9('0x1b')](_0x5ad1ab)[_0xcea9('0x1c')]();};}function respondWithResult(_0x29c040,_0x1f2192){_0x1f2192=_0x1f2192||0xc8;return function(_0x244aef){if(_0x244aef){return _0x29c040[_0xcea9('0x1b')](_0x1f2192)['json'](_0x244aef);}};}function respondWithFilteredResult(_0x1f9c66,_0x5ceda3){return function(_0x299082){if(_0x299082){var _0x54d6a8=typeof _0x5ceda3[_0xcea9('0x1d')]===_0xcea9('0x1e')&&typeof _0x5ceda3[_0xcea9('0x1f')]==='undefined';var _0x3e0f05=_0x299082[_0xcea9('0x20')];var _0x2aae9f=_0x54d6a8?0x0:_0x5ceda3[_0xcea9('0x1d')];var _0x4e344b=_0x54d6a8?_0x299082[_0xcea9('0x20')]:_0x5ceda3[_0xcea9('0x1d')]+_0x5ceda3[_0xcea9('0x1f')];var _0x595a5c;if(_0x4e344b>=_0x3e0f05){_0x4e344b=_0x3e0f05;_0x595a5c=0xc8;}else{_0x595a5c=0xce;}_0x1f9c66['status'](_0x595a5c);return _0x1f9c66[_0xcea9('0x21')](_0xcea9('0x22'),_0x2aae9f+'-'+_0x4e344b+'/'+_0x3e0f05)[_0xcea9('0x23')](_0x299082);}return null;};}function saveUpdates(_0x4ef9c5){return function(_0x33be07){if(_0x33be07){return _0x33be07[_0xcea9('0x24')](_0x4ef9c5)[_0xcea9('0x10')](function(_0x4dcb2e){return _0x4dcb2e;});}return null;};}function removeEntity(_0x1a4e1d){return function(_0x352782){if(_0x352782){return _0x352782[_0xcea9('0x25')]()['then'](function(){var _0x40daf8=_0x352782['get']({'plain':!![]});var _0x2b0542=_0xcea9('0x26');return db['UserProfileResource'][_0xcea9('0x25')]({'where':{'type':_0x2b0542,'resourceId':_0x40daf8['id']}})[_0xcea9('0x10')](function(){return _0x352782;});})[_0xcea9('0x10')](function(){_0x1a4e1d[_0xcea9('0x1b')](0xcc)[_0xcea9('0x1c')]();});}};}function handleEntityNotFound(_0x55ef9f){return function(_0x42b842){if(!_0x42b842){_0x55ef9f[_0xcea9('0x1a')](0x194);}return _0x42b842;};}function handleError(_0x19f50a,_0xb7753f){_0xb7753f=_0xb7753f||0x1f4;return function(_0x45c469){logger[_0xcea9('0x15')](_0x45c469['stack']);if(_0x45c469[_0xcea9('0x27')]){delete _0x45c469['name'];}_0x19f50a[_0xcea9('0x1b')](_0xb7753f)[_0xcea9('0x28')](_0x45c469);};}function getImapHost(_0x22203c){switch(_0x22203c){case _0xcea9('0x29'):return _0xcea9('0x2a');case'yahoo':return'imap.mail.yahoo.com';case _0xcea9('0x2b'):return _0xcea9('0x2c');case'outlook365':return _0xcea9('0x2d');}throw new Error('Unknown\x20email\x20service\x20provider',_0x22203c);}function getSmtpHost(_0x5d75d3){switch(_0x5d75d3){case _0xcea9('0x29'):return _0xcea9('0x2e');case _0xcea9('0x2f'):return _0xcea9('0x30');case _0xcea9('0x2b'):return _0xcea9('0x31');case _0xcea9('0x32'):return _0xcea9('0x33');}throw new Error(_0xcea9('0x34'),_0x5d75d3);}function getAuthenticationOptions(_0x327b94,_0x2811b1){var _0x5bc609={};var _0x178dfc={};if(_0x327b94){_0x5bc609[_0xcea9('0x35')]=_0x178dfc[_0xcea9('0x35')]=_0x2811b1[_0xcea9('0x36')];_0x5bc609[_0xcea9('0x37')]=_0x178dfc['pass']=_0x2811b1[_0xcea9('0x37')];if(_0x2811b1[_0xcea9('0x38')]){_0x5bc609[_0xcea9('0x38')]=_0x178dfc['modernAuthentication']=!![];_0x5bc609['CloudProviderId']=_0x178dfc[_0xcea9('0x39')]=_0x2811b1[_0xcea9('0x39')];_0x5bc609[_0xcea9('0x37')]=_0x178dfc[_0xcea9('0x3a')]=null;}else{_0x5bc609[_0xcea9('0x39')]=_0x178dfc['CloudProviderId']=null;}_0x5bc609[_0xcea9('0x3b')]=getImapHost(_0x327b94);_0x5bc609[_0xcea9('0x3c')]=0x3e1;_0x178dfc[_0xcea9('0x3b')]=getSmtpHost(_0x327b94);_0x178dfc[_0xcea9('0x3c')]=0x24b;_0x178dfc[_0xcea9('0x3d')]=![];_0x5bc609['service']=_0x178dfc[_0xcea9('0x3e')]=null;}else{if(_0x2811b1[_0xcea9('0x3f')]){_0x5bc609[_0xcea9('0x35')]=_0x178dfc[_0xcea9('0x35')]=_0x2811b1[_0xcea9('0x36')];_0x5bc609['password']=_0x178dfc[_0xcea9('0x3a')]=_0x2811b1['password'];}else{_0x5bc609[_0xcea9('0x3f')]=_0x178dfc[_0xcea9('0x3f')]=![];_0x5bc609[_0xcea9('0x35')]=_0x178dfc['user']=null;_0x5bc609[_0xcea9('0x37')]=_0x178dfc[_0xcea9('0x3a')]=null;}_0x5bc609['host']=_0x2811b1[_0xcea9('0x40')][_0xcea9('0x3b')];_0x5bc609[_0xcea9('0x3c')]=_0x2811b1[_0xcea9('0x40')]['port'];_0x178dfc[_0xcea9('0x3b')]=_0x2811b1['Smtp'][_0xcea9('0x3b')];_0x178dfc['port']=_0x2811b1['Smtp'][_0xcea9('0x3c')];}return{'Imap':_0x5bc609,'Smtp':_0x178dfc};}exports[_0xcea9('0x41')]=function(_0x3e16b0,_0x3bb067){var _0x359566={'include':[{'model':db[_0xcea9('0x42')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0xcea9('0x43')},{'model':db['Pause'],'as':_0xcea9('0x44')}]},_0x204f31={},_0x1a7d92={'count':0x0,'rows':[]};var _0x1cb4b2=_[_0xcea9('0x45')](db['MailAccount'][_0xcea9('0x46')],function(_0x2d64dd){return{'name':_0x2d64dd[_0xcea9('0x47')],'type':_0x2d64dd[_0xcea9('0x48')][_0xcea9('0x49')]};});_0x204f31[_0xcea9('0x4a')]=_[_0xcea9('0x45')](_0x1cb4b2,_0xcea9('0x27'));_0x204f31[_0xcea9('0x4b')]=_[_0xcea9('0x4c')](_0x3e16b0['query']);_0x204f31[_0xcea9('0x4d')]=_[_0xcea9('0x4e')](_0x204f31['model'],_0x204f31[_0xcea9('0x4b')]);_0x359566[_0xcea9('0x4f')]=_['intersection'](_0x204f31[_0xcea9('0x4a')],qs['fields'](_0x3e16b0[_0xcea9('0x4b')][_0xcea9('0x50')]));_0x359566[_0xcea9('0x4f')]=_0x359566[_0xcea9('0x4f')][_0xcea9('0x51')]?_0x359566[_0xcea9('0x4f')]:_0x204f31['model'];if(!_0x3e16b0[_0xcea9('0x4b')][_0xcea9('0x52')](_0xcea9('0x53'))){_0x359566[_0xcea9('0x1f')]=qs[_0xcea9('0x1f')](_0x3e16b0[_0xcea9('0x4b')][_0xcea9('0x1f')]);_0x359566[_0xcea9('0x1d')]=qs[_0xcea9('0x1d')](_0x3e16b0['query'][_0xcea9('0x1d')]);}_0x359566[_0xcea9('0x54')]=qs['sort'](_0x3e16b0[_0xcea9('0x4b')][_0xcea9('0x55')]);_0x359566[_0xcea9('0x56')]=qs['filters'](_[_0xcea9('0x57')](_0x3e16b0[_0xcea9('0x4b')],_0x204f31[_0xcea9('0x4d')]),_0x1cb4b2);if(_0x3e16b0[_0xcea9('0x4b')][_0xcea9('0x58')]){_0x359566['where']=_[_0xcea9('0x59')](_0x359566[_0xcea9('0x56')],{'$or':_['map'](_0x1cb4b2,function(_0x442821){if(_0x442821[_0xcea9('0x48')]!==_0xcea9('0x5a')){var _0x5d9093={};_0x5d9093[_0x442821[_0xcea9('0x27')]]={'$like':'%'+_0x3e16b0['query'][_0xcea9('0x58')]+'%'};return _0x5d9093;}})});}_0x359566=_['merge']({},_0x359566,_0x3e16b0['options']);var _0x5d7651={'where':_0x359566[_0xcea9('0x56')]};return db[_0xcea9('0x5b')][_0xcea9('0x20')](_0x5d7651)[_0xcea9('0x10')](function(_0x4037a7){_0x1a7d92[_0xcea9('0x20')]=_0x4037a7;if(_0x3e16b0[_0xcea9('0x4b')]['includeAll']){_0x359566['include']=[{'all':!![]}];}return db['MailAccount'][_0xcea9('0x5c')](_0x359566);})[_0xcea9('0x10')](function(_0x2d986b){_0x1a7d92[_0xcea9('0x5d')]=_0x2d986b;return _0x1a7d92;})['then'](respondWithFilteredResult(_0x3bb067,_0x359566))['catch'](handleError(_0x3bb067,null));};exports['show']=function(_0x1d812a,_0x29599c){var _0x5bbd2b={'raw':![],'where':{'id':_0x1d812a[_0xcea9('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xcea9('0x40')},{'model':db[_0xcea9('0x5f')],'as':_0xcea9('0x43')},{'model':db[_0xcea9('0x60')],'as':_0xcea9('0x44')}]},_0x53da8f={};_0x53da8f[_0xcea9('0x4a')]=_[_0xcea9('0x4c')](db[_0xcea9('0x5b')][_0xcea9('0x46')]);_0x53da8f['query']=_[_0xcea9('0x4c')](_0x1d812a[_0xcea9('0x4b')]);_0x53da8f[_0xcea9('0x4d')]=_[_0xcea9('0x4e')](_0x53da8f[_0xcea9('0x4a')],_0x53da8f[_0xcea9('0x4b')]);_0x5bbd2b['attributes']=_[_0xcea9('0x4e')](_0x53da8f[_0xcea9('0x4a')],qs[_0xcea9('0x50')](_0x1d812a[_0xcea9('0x4b')][_0xcea9('0x50')]));_0x5bbd2b['attributes']=_0x5bbd2b['attributes']['length']?_0x5bbd2b['attributes']:_0x53da8f[_0xcea9('0x4a')];if(_0x1d812a[_0xcea9('0x4b')][_0xcea9('0x61')]){_0x5bbd2b[_0xcea9('0x62')]=[{'all':!![]}];}_0x5bbd2b=_['merge']({},_0x5bbd2b,_0x1d812a[_0xcea9('0x63')]);return db[_0xcea9('0x5b')][_0xcea9('0x64')](_0x5bbd2b)[_0xcea9('0x10')](handleEntityNotFound(_0x29599c,null))[_0xcea9('0x10')](respondWithResult(_0x29599c,null))[_0xcea9('0x65')](handleError(_0x29599c,null));};exports[_0xcea9('0x24')]=function(_0x5c2d1b,_0x4ee211){if(_0x5c2d1b[_0xcea9('0x66')]['id']){delete _0x5c2d1b['body']['id'];}var _0x390b10=_0x5c2d1b[_0xcea9('0x66')][_0xcea9('0x67')]===_0xcea9('0x68')?null:_0x5c2d1b[_0xcea9('0x66')][_0xcea9('0x67')];var _0x13282a=_0x5c2d1b[_0xcea9('0x66')][_0xcea9('0x40')]||{};var _0x36ba65=_0x5c2d1b[_0xcea9('0x66')]['Smtp']||{};if(_0x390b10){_0x13282a[_0xcea9('0x3b')]=getImapHost(_0x390b10);_0x13282a[_0xcea9('0x3c')]=0x3e1;_0x36ba65[_0xcea9('0x3b')]=getSmtpHost(_0x390b10);_0x36ba65[_0xcea9('0x3c')]=0x24b;_0x36ba65[_0xcea9('0x3d')]=![];}if(_0x36ba65[_0xcea9('0x38')]){_0x36ba65[_0xcea9('0x3d')]=![];}else{_0x36ba65[_0xcea9('0x39')]=null;}if(!_0x13282a[_0xcea9('0x38')])_0x13282a[_0xcea9('0x39')]=null;_0x5c2d1b['body']['Imap']=_0x13282a;_0x5c2d1b['body'][_0xcea9('0x43')]=_0x36ba65;return db[_0xcea9('0x5b')][_0xcea9('0x64')]({'where':{'id':_0x5c2d1b[_0xcea9('0x5e')]['id']},'include':[{'model':db[_0xcea9('0x42')],'as':_0xcea9('0x40')},{'model':db[_0xcea9('0x5f')],'as':_0xcea9('0x43')},{'model':db[_0xcea9('0x60')],'as':_0xcea9('0x44')}]})[_0xcea9('0x10')](handleEntityNotFound(_0x4ee211,null))[_0xcea9('0x10')](function(_0x33c018){if(!_0x33c018)throw new Error(_0xcea9('0x69'));if(_0x33c018[_0xcea9('0x3e')])delete _0x5c2d1b['body'][_0xcea9('0x40')];return _0x33c018;})['then'](saveUpdates(_0x5c2d1b['body'],null))[_0xcea9('0x10')](function(_0x223ca4){if(!_0x5c2d1b[_0xcea9('0x66')]['Imap'])return _0x223ca4;return db[_0xcea9('0x42')][_0xcea9('0x24')](_0x5c2d1b[_0xcea9('0x66')]['Imap'],{'where':{'MailAccountId':_0x223ca4['id']}})[_0xcea9('0x10')](function(){return _0x223ca4;});})[_0xcea9('0x10')](function(_0x1987f2){if(!_0x5c2d1b[_0xcea9('0x66')][_0xcea9('0x43')])return _0x1987f2;return db[_0xcea9('0x5f')][_0xcea9('0x24')](_0x5c2d1b[_0xcea9('0x66')]['Smtp'],{'where':{'MailAccountId':_0x1987f2['id']}})[_0xcea9('0x10')](function(){return _0x1987f2;});})[_0xcea9('0x10')](respondWithResult(_0x4ee211,null))[_0xcea9('0x65')](handleError(_0x4ee211,null));};exports['describe']=function(_0x52b004,_0x367994){return db[_0xcea9('0x5b')][_0xcea9('0x6a')]()[_0xcea9('0x10')](respondWithResult(_0x367994,null))['catch'](handleError(_0x367994,null));};exports[_0xcea9('0x6b')]=function(_0x2bd12a,_0x4bd855){if(_0x2bd12a['body']['id']){delete _0x2bd12a[_0xcea9('0x66')]['id'];}return db[_0xcea9('0x5b')][_0xcea9('0x64')]({'where':{'id':_0x2bd12a[_0xcea9('0x5e')]['id']}})[_0xcea9('0x10')](handleEntityNotFound(_0x4bd855,null))['then'](function(_0x7b0ae4){if(_0x7b0ae4){_0x2bd12a[_0xcea9('0x66')][_0xcea9('0x6c')]=_0x7b0ae4['id'];return db[_0xcea9('0x6d')][_0xcea9('0x6e')](_0x2bd12a['body']);}})[_0xcea9('0x10')](respondWithResult(_0x4bd855,null))['catch'](handleError(_0x4bd855,null));};exports[_0xcea9('0x6f')]=function(_0x58bcce,_0x267bda){var _0x16196d={'raw':![],'where':{}};var _0x16c6a5={};var _0x10f272={'count':0x0,'rows':[]};return db[_0xcea9('0x5b')][_0xcea9('0x70')]({'where':{'id':_0x58bcce['params']['id']}})[_0xcea9('0x10')](handleEntityNotFound(_0x267bda,null))['then'](function(_0x19d5db){if(_0x19d5db){_0x16c6a5[_0xcea9('0x4a')]=_[_0xcea9('0x4c')](db[_0xcea9('0x6d')][_0xcea9('0x46')]);_0x16c6a5['query']=_[_0xcea9('0x4c')](_0x58bcce[_0xcea9('0x4b')]);_0x16c6a5[_0xcea9('0x4d')]=_[_0xcea9('0x4e')](_0x16c6a5[_0xcea9('0x4a')],_0x16c6a5[_0xcea9('0x4b')]);_0x16196d[_0xcea9('0x4f')]=_[_0xcea9('0x4e')](_0x16c6a5['model'],qs[_0xcea9('0x50')](_0x58bcce[_0xcea9('0x4b')][_0xcea9('0x50')]));_0x16196d[_0xcea9('0x4f')]=_0x16196d[_0xcea9('0x4f')]['length']?_0x16196d['attributes']:_0x16c6a5['model'];if(!_0x58bcce['query']['hasOwnProperty'](_0xcea9('0x53'))){_0x16196d['limit']=qs[_0xcea9('0x1f')](_0x58bcce[_0xcea9('0x4b')][_0xcea9('0x1f')]);_0x16196d[_0xcea9('0x1d')]=qs[_0xcea9('0x1d')](_0x58bcce[_0xcea9('0x4b')][_0xcea9('0x1d')]);}_0x16196d['order']=qs[_0xcea9('0x55')](_0x58bcce[_0xcea9('0x4b')]['sort']);_0x16196d[_0xcea9('0x56')]=qs['filters'](_[_0xcea9('0x57')](_0x58bcce[_0xcea9('0x4b')],_0x16c6a5[_0xcea9('0x4d')]));_0x16196d['where'][_0xcea9('0x6c')]=_0x19d5db['id'];if(_0x58bcce[_0xcea9('0x4b')]['filter']){_0x16196d[_0xcea9('0x56')]=_[_0xcea9('0x59')](_0x16196d[_0xcea9('0x56')],{'$or':_[_0xcea9('0x45')](_0x16196d[_0xcea9('0x4f')],function(_0x2e7c56){var _0x57f210={};_0x57f210[_0x2e7c56]={'$like':'%'+_0x58bcce[_0xcea9('0x4b')][_0xcea9('0x58')]+'%'};return _0x57f210;})});}_0x16196d=_[_0xcea9('0x59')]({},_0x16196d,_0x58bcce[_0xcea9('0x63')]);return db[_0xcea9('0x6d')][_0xcea9('0x20')]({'where':_0x16196d[_0xcea9('0x56')]})[_0xcea9('0x10')](function(_0x5306db){_0x10f272[_0xcea9('0x20')]=_0x5306db;if(_0x58bcce['query']['includeAll']){_0x16196d[_0xcea9('0x62')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x16196d);})[_0xcea9('0x10')](function(_0x273333){_0x10f272[_0xcea9('0x5d')]=_0x273333;return _0x10f272;});}})[_0xcea9('0x10')](respondWithFilteredResult(_0x267bda,_0x16196d))[_0xcea9('0x65')](handleError(_0x267bda,null));};exports[_0xcea9('0x71')]=function(_0x6420c,_0x3dddac){return db[_0xcea9('0x5b')][_0xcea9('0x64')]({'where':{'id':_0x6420c['params']['id']}})[_0xcea9('0x10')](handleEntityNotFound(_0x3dddac,null))[_0xcea9('0x10')](function(_0x52553e){if(_0x52553e){return _0x52553e[_0xcea9('0x71')](_0x6420c[_0xcea9('0x4b')]['ids']);}})[_0xcea9('0x10')](respondWithStatusCode(_0x3dddac,null))[_0xcea9('0x65')](handleError(_0x3dddac,null));};exports[_0xcea9('0x72')]=function(_0x24e044,_0x840482){if(_0x24e044[_0xcea9('0x66')]['id']){delete _0x24e044[_0xcea9('0x66')]['id'];}return db[_0xcea9('0x5b')][_0xcea9('0x64')]({'where':{'id':_0x24e044[_0xcea9('0x5e')]['id']}})[_0xcea9('0x10')](handleEntityNotFound(_0x840482,null))[_0xcea9('0x10')](function(_0x52c34e){if(_0x52c34e){_0x24e044[_0xcea9('0x66')][_0xcea9('0x6c')]=_0x52c34e['id'];return db[_0xcea9('0x73')][_0xcea9('0x6e')](_0x24e044[_0xcea9('0x66')]);}})[_0xcea9('0x10')](respondWithResult(_0x840482,null))[_0xcea9('0x65')](handleError(_0x840482,null));};exports[_0xcea9('0x74')]=function(_0x5e10a0,_0x2235c2){var _0x38d6a0={'raw':![],'where':{}};var _0x1ec08d={};var _0x11bfc8={'count':0x0,'rows':[]};return db[_0xcea9('0x5b')][_0xcea9('0x70')]({'where':{'id':_0x5e10a0[_0xcea9('0x5e')]['id']}})[_0xcea9('0x10')](handleEntityNotFound(_0x2235c2,null))['then'](function(_0x4a8421){if(_0x4a8421){_0x1ec08d['model']=_[_0xcea9('0x4c')](db[_0xcea9('0x73')]['rawAttributes']);_0x1ec08d[_0xcea9('0x4b')]=_['keys'](_0x5e10a0[_0xcea9('0x4b')]);_0x1ec08d[_0xcea9('0x4d')]=_['intersection'](_0x1ec08d[_0xcea9('0x4a')],_0x1ec08d['query']);_0x38d6a0[_0xcea9('0x4f')]=_[_0xcea9('0x4e')](_0x1ec08d['model'],qs[_0xcea9('0x50')](_0x5e10a0['query'][_0xcea9('0x50')]));_0x38d6a0[_0xcea9('0x4f')]=_0x38d6a0[_0xcea9('0x4f')][_0xcea9('0x51')]?_0x38d6a0[_0xcea9('0x4f')]:_0x1ec08d[_0xcea9('0x4a')];if(!_0x5e10a0[_0xcea9('0x4b')][_0xcea9('0x52')](_0xcea9('0x53'))){_0x38d6a0['limit']=qs[_0xcea9('0x1f')](_0x5e10a0[_0xcea9('0x4b')][_0xcea9('0x1f')]);_0x38d6a0['offset']=qs[_0xcea9('0x1d')](_0x5e10a0[_0xcea9('0x4b')][_0xcea9('0x1d')]);}_0x38d6a0[_0xcea9('0x54')]=qs[_0xcea9('0x55')](_0x5e10a0[_0xcea9('0x4b')][_0xcea9('0x55')]);_0x38d6a0['where']=qs[_0xcea9('0x4d')](_[_0xcea9('0x57')](_0x5e10a0[_0xcea9('0x4b')],_0x1ec08d[_0xcea9('0x4d')]));_0x38d6a0['where'][_0xcea9('0x6c')]=_0x4a8421['id'];if(_0x5e10a0[_0xcea9('0x4b')][_0xcea9('0x58')]){_0x38d6a0['where']=_[_0xcea9('0x59')](_0x38d6a0[_0xcea9('0x56')],{'$or':_[_0xcea9('0x45')](_0x38d6a0[_0xcea9('0x4f')],function(_0x114c7e){var _0x289a6b={};_0x289a6b[_0x114c7e]={'$like':'%'+_0x5e10a0[_0xcea9('0x4b')]['filter']+'%'};return _0x289a6b;})});}_0x38d6a0=_['merge']({},_0x38d6a0,_0x5e10a0[_0xcea9('0x63')]);return db[_0xcea9('0x73')][_0xcea9('0x20')]({'where':_0x38d6a0[_0xcea9('0x56')]})['then'](function(_0x1b3166){_0x11bfc8[_0xcea9('0x20')]=_0x1b3166;if(_0x5e10a0[_0xcea9('0x4b')]['includeAll']){_0x38d6a0[_0xcea9('0x62')]=[{'all':!![]}];}return db[_0xcea9('0x73')][_0xcea9('0x5c')](_0x38d6a0);})[_0xcea9('0x10')](function(_0xcc9084){_0x11bfc8[_0xcea9('0x5d')]=_0xcc9084;return _0x11bfc8;});}})[_0xcea9('0x10')](respondWithFilteredResult(_0x2235c2,_0x38d6a0))['catch'](handleError(_0x2235c2,null));};exports[_0xcea9('0x75')]=function(_0x38f185,_0x410a8c){return db[_0xcea9('0x5b')][_0xcea9('0x64')]({'where':{'id':_0x38f185[_0xcea9('0x5e')]['id']}})[_0xcea9('0x10')](handleEntityNotFound(_0x410a8c,null))[_0xcea9('0x10')](function(_0x57343a){if(_0x57343a){return _0x57343a['removeAnswers'](_0x38f185['query']['ids']);}})[_0xcea9('0x10')](respondWithStatusCode(_0x410a8c,null))[_0xcea9('0x65')](handleError(_0x410a8c,null));};exports['create']=function(_0x492355,_0x261384){var _0x2520af={'name':_0x492355[_0xcea9('0x66')][_0xcea9('0x27')],'key':_0x492355[_0xcea9('0x66')]['key'],'provider':_0x492355[_0xcea9('0x66')]['provider']===_0xcea9('0x68')?null:_0x492355[_0xcea9('0x66')]['provider'],'email':_0x492355[_0xcea9('0x66')]['email'],'ListId':_0x492355[_0xcea9('0x66')][_0xcea9('0x76')],'active':!_[_0xcea9('0x77')](_0x492355[_0xcea9('0x66')]['active'])?_0x492355[_0xcea9('0x66')][_0xcea9('0x78')]:!![],'description':_0x492355[_0xcea9('0x66')]['description']||null};var _0x40e571=getAuthenticationOptions(_0x2520af[_0xcea9('0x67')],_0x492355[_0xcea9('0x66')]);_0x2520af[_0xcea9('0x40')]=_0x40e571[_0xcea9('0x40')];_0x2520af['Smtp']=_0x40e571[_0xcea9('0x43')];return db[_0xcea9('0x5b')][_0xcea9('0x6e')](_0x2520af,{'include':[{'model':db[_0xcea9('0x5f')],'as':_0xcea9('0x43')},{'model':db[_0xcea9('0x42')],'as':_0xcea9('0x40')}]})[_0xcea9('0x10')](function(_0x11858f){var _0x202ece=_0x492355[_0xcea9('0x35')][_0xcea9('0x79')]({'plain':!![]});if(!_0x202ece)throw new Error(_0xcea9('0x7a'));if(_0x202ece[_0xcea9('0x7b')]===_0xcea9('0x35')){var _0x5d7a34=_0x11858f[_0xcea9('0x79')]({'plain':!![]});return db['UserProfileSection'][_0xcea9('0x64')]({'where':{'name':'MailAccounts','userProfileId':_0x202ece['userProfileId']},'raw':!![]})[_0xcea9('0x10')](function(_0x9a63ed){if(_0x9a63ed&&_0x9a63ed[_0xcea9('0x7c')]===0x0){return db[_0xcea9('0x7d')][_0xcea9('0x6e')]({'name':_0x5d7a34['name'],'resourceId':_0x5d7a34['id'],'type':_0x9a63ed[_0xcea9('0x27')],'sectionId':_0x9a63ed['id']},{})[_0xcea9('0x10')](function(){return _0x11858f;});}else{return _0x11858f;}})['catch'](function(_0x53ee43){logger[_0xcea9('0x15')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53ee43);throw _0x53ee43;});}return _0x11858f;})['then'](respondWithResult(_0x261384,0xc9))[_0xcea9('0x65')](handleError(_0x261384,null));};exports[_0xcea9('0x7e')]=function(_0x31eff2,_0x59a459){return db[_0xcea9('0x5b')][_0xcea9('0x70')]({'where':{'id':_0x31eff2[_0xcea9('0x5e')]['id']}})[_0xcea9('0x10')](handleEntityNotFound(_0x59a459,null))[_0xcea9('0x10')](function(_0x41da35){if(_0x41da35){return _0x41da35[_0xcea9('0x7e')]();}return null;})[_0xcea9('0x10')](respondWithResult(_0x59a459,null))[_0xcea9('0x65')](handleError(_0x59a459,null));};exports[_0xcea9('0x7f')]=function(_0x15570f,_0x4fe0a8){if(_0x15570f[_0xcea9('0x66')]['id']){delete _0x15570f[_0xcea9('0x66')]['id'];}return db[_0xcea9('0x5b')][_0xcea9('0x64')]({'where':{'id':_0x15570f[_0xcea9('0x5e')]['id']}})[_0xcea9('0x10')](handleEntityNotFound(_0x4fe0a8,null))[_0xcea9('0x10')](function(_0x54945a){if(_0x54945a){_0x15570f['body'][_0xcea9('0x6c')]=_0x54945a['id'];return db['MailServerIn'][_0xcea9('0x6e')](_0x15570f[_0xcea9('0x66')]);}})[_0xcea9('0x10')](respondWithResult(_0x4fe0a8,null))[_0xcea9('0x65')](handleError(_0x4fe0a8,null));};exports[_0xcea9('0x80')]=function(_0x3c4d92,_0x63fe96){return db[_0xcea9('0x5b')][_0xcea9('0x70')]({'where':{'id':_0x3c4d92[_0xcea9('0x5e')]['id']}})[_0xcea9('0x10')](handleEntityNotFound(_0x63fe96,null))[_0xcea9('0x10')](function(_0x31b4a6){if(_0x31b4a6){return _0x31b4a6[_0xcea9('0x81')](null);}return null;})[_0xcea9('0x10')](respondWithStatusCode(_0x63fe96,null))[_0xcea9('0x65')](handleError(_0x63fe96,null));};exports['getSmtp']=function(_0x356b73,_0x50c5d3){return db[_0xcea9('0x5b')][_0xcea9('0x70')]({'where':{'id':_0x356b73[_0xcea9('0x5e')]['id']}})[_0xcea9('0x10')](handleEntityNotFound(_0x50c5d3,null))[_0xcea9('0x10')](function(_0x104c89){if(_0x104c89){return _0x104c89[_0xcea9('0x82')]();}return null;})['then'](respondWithResult(_0x50c5d3,null))[_0xcea9('0x65')](handleError(_0x50c5d3,null));};exports[_0xcea9('0x83')]=function(_0xbc3779,_0x2b6cd6){if(_0xbc3779[_0xcea9('0x66')]['id']){delete _0xbc3779[_0xcea9('0x66')]['id'];}return db[_0xcea9('0x5b')]['find']({'where':{'id':_0xbc3779['params']['id']}})[_0xcea9('0x10')](handleEntityNotFound(_0x2b6cd6,null))[_0xcea9('0x10')](function(_0x40470d){if(_0x40470d){_0xbc3779[_0xcea9('0x66')][_0xcea9('0x6c')]=_0x40470d['id'];return db[_0xcea9('0x5f')][_0xcea9('0x6e')](_0xbc3779[_0xcea9('0x66')]);}})[_0xcea9('0x10')](respondWithResult(_0x2b6cd6,null))[_0xcea9('0x65')](handleError(_0x2b6cd6,null));};exports[_0xcea9('0x84')]=function(_0x36627b,_0x29a91f){return db[_0xcea9('0x5b')][_0xcea9('0x70')]({'where':{'id':_0x36627b[_0xcea9('0x5e')]['id']}})[_0xcea9('0x10')](handleEntityNotFound(_0x29a91f,null))[_0xcea9('0x10')](function(_0x4afd8e){if(_0x4afd8e){return _0x4afd8e[_0xcea9('0x85')](null);}return null;})['then'](respondWithStatusCode(_0x29a91f,null))['catch'](handleError(_0x29a91f,null));};exports[_0xcea9('0x86')]=function(_0x464867,_0xdb875a){return db[_0xcea9('0x87')][_0xcea9('0x64')]({'where':{'id':_0x464867[_0xcea9('0x5e')]['id']}})['then'](handleEntityNotFound(_0xdb875a,null))[_0xcea9('0x10')](function(_0x2c7cac){if(_0x2c7cac){return _0x2c7cac[_0xcea9('0x86')](_0x464867[_0xcea9('0x66')][_0xcea9('0x88')],_[_0xcea9('0x89')](_0x464867[_0xcea9('0x66')],[_0xcea9('0x88'),'id'])||{});}})['then'](respondWithResult(_0xdb875a,null))[_0xcea9('0x65')](handleError(_0xdb875a,null));};exports['getInteractions']=function(_0x353c2b,_0x3f386c){var _0x59830b={'raw':![],'where':{}};var _0x2bd404={};var _0xc4bcf2={'count':0x0,'rows':[]};return db['MailAccount'][_0xcea9('0x70')]({'where':{'id':_0x353c2b[_0xcea9('0x5e')]['id']}})[_0xcea9('0x10')](handleEntityNotFound(_0x3f386c,null))[_0xcea9('0x10')](function(_0x4cdaaa){if(_0x4cdaaa){_0x2bd404[_0xcea9('0x4a')]=_['keys'](db[_0xcea9('0x87')][_0xcea9('0x46')]);_0x2bd404[_0xcea9('0x4b')]=_[_0xcea9('0x4c')](_0x353c2b[_0xcea9('0x4b')]);_0x2bd404[_0xcea9('0x4d')]=_[_0xcea9('0x4e')](_0x2bd404[_0xcea9('0x4a')],_0x2bd404[_0xcea9('0x4b')]);_0x59830b['attributes']=_[_0xcea9('0x4e')](_0x2bd404[_0xcea9('0x4a')],qs[_0xcea9('0x50')](_0x353c2b[_0xcea9('0x4b')]['fields']));_0x59830b[_0xcea9('0x4f')]=_0x59830b['attributes']['length']?_0x59830b[_0xcea9('0x4f')]:_0x2bd404['model'];if(!_0x353c2b[_0xcea9('0x4b')][_0xcea9('0x52')](_0xcea9('0x53'))){_0x59830b['limit']=qs[_0xcea9('0x1f')](_0x353c2b['query']['limit']);_0x59830b['offset']=qs[_0xcea9('0x1d')](_0x353c2b[_0xcea9('0x4b')][_0xcea9('0x1d')]);}_0x59830b[_0xcea9('0x54')]=qs[_0xcea9('0x55')](_0x353c2b['query']['sort']);_0x59830b[_0xcea9('0x56')]=qs['filters'](_[_0xcea9('0x57')](_0x353c2b['query'],_0x2bd404[_0xcea9('0x4d')]));_0x59830b[_0xcea9('0x56')][_0xcea9('0x6c')]=_0x4cdaaa['id'];if(_0x353c2b[_0xcea9('0x4b')][_0xcea9('0x58')]){_0x59830b[_0xcea9('0x56')]=_[_0xcea9('0x59')](_0x59830b[_0xcea9('0x56')],{'$or':_[_0xcea9('0x45')](_0x59830b['attributes'],function(_0x57ed6b){var _0x15b593={};_0x15b593[_0x57ed6b]={'$like':'%'+_0x353c2b[_0xcea9('0x4b')][_0xcea9('0x58')]+'%'};return _0x15b593;})});}_0x59830b=_[_0xcea9('0x59')]({},_0x59830b,_0x353c2b[_0xcea9('0x63')]);return db['MailInteraction']['count']({'where':_0x59830b['where']})[_0xcea9('0x10')](function(_0x503dbc){_0xc4bcf2[_0xcea9('0x20')]=_0x503dbc;if(_0x353c2b['query'][_0xcea9('0x61')]){_0x59830b[_0xcea9('0x62')]=[{'model':db[_0xcea9('0x8a')],'as':_0xcea9('0x8b'),'required':![]},{'model':db[_0xcea9('0x8c')],'as':_0xcea9('0x8d'),'attributes':['name','fullname',_0xcea9('0x8e')],'required':![]},{'model':db[_0xcea9('0x8f')],'as':'Tags','attributes':['id',_0xcea9('0x27'),_0xcea9('0x90')],'where':_0x353c2b[_0xcea9('0x4b')][_0xcea9('0x91')]?{'id':_0x353c2b[_0xcea9('0x4b')][_0xcea9('0x91')]}:undefined,'required':_0x353c2b[_0xcea9('0x4b')]['tag']?!![]:![]}];}return db[_0xcea9('0x87')]['findAll'](_0x59830b);})[_0xcea9('0x10')](function(_0x311b39){_0xc4bcf2['rows']=_0x311b39;return _0xc4bcf2;});}})[_0xcea9('0x10')](respondWithFilteredResult(_0x3f386c,_0x59830b))[_0xcea9('0x65')](handleError(_0x3f386c,null));};exports[_0xcea9('0x92')]=function addApplications(_0x4986f4,_0x47dc23){var _0x24821f=_0x4986f4[_0xcea9('0x5e')]['id'];var _0x1400b3=_0x4986f4['body'];var _0x5c5d06=0xc8;var _0x1e8d31=null;return db[_0xcea9('0x93')][_0xcea9('0x94')]({'isolationLevel':db['sequelize'][_0xcea9('0x95')][_0xcea9('0x96')]['READ_COMMITTED']},function(_0x3c7478){return db[_0xcea9('0x5b')][_0xcea9('0x70')]({'where':{'id':_0x24821f},'transaction':_0x3c7478})[_0xcea9('0x10')](function(_0xd677d9){if(_0xd677d9){return db[_0xcea9('0x97')][_0xcea9('0x25')]({'where':{'MailAccountId':_0x24821f},'transaction':_0x3c7478})['then'](function(){var _0x481547=_[_0xcea9('0x45')](_0x1400b3,function(_0x4e27b7){_0x4e27b7[_0xcea9('0x6c')]=_0x24821f;return _0x4e27b7;});return db[_0xcea9('0x97')][_0xcea9('0x98')](_0x481547,{'transaction':_0x3c7478});});}else{_0x5c5d06=0x194;_0x1e8d31=[];}});})[_0xcea9('0x10')](function(){if(_0x5c5d06!==0x194){return db[_0xcea9('0x97')]['findAndCountAll']({'where':{'MailAccountId':_0x24821f},'order':_0xcea9('0x99')})[_0xcea9('0x10')](function(_0x255a25){_0x1e8d31=_0x255a25;});}})[_0xcea9('0x65')](function(_0x1fb7b3){_0x5c5d06=0x1f4;logger['error'](_0x1fb7b3['stack']);if(_0x1fb7b3[_0xcea9('0x27')]){delete _0x1fb7b3[_0xcea9('0x27')];}_0x1e8d31=_0x1fb7b3;})[_0xcea9('0x9a')](function(){if(_0x1e8d31===null){_0x47dc23[_0xcea9('0x1a')](_0x5c5d06);}else{if(_0x5c5d06===0x1f4){_0x47dc23[_0xcea9('0x1b')](_0x5c5d06)[_0xcea9('0x28')](_0x1e8d31);}else{_0x47dc23[_0xcea9('0x1b')](_0x5c5d06)[_0xcea9('0x23')](_0x1e8d31);}}});};exports[_0xcea9('0x9b')]=function(_0x184f91,_0x2be604){var _0x3b5326={};var _0x1aab10={};var _0x14ebfc;var _0x1bfadb;return db[_0xcea9('0x5b')][_0xcea9('0x70')]({'where':{'id':_0x184f91[_0xcea9('0x5e')]['id']}})[_0xcea9('0x10')](handleEntityNotFound(_0x2be604,null))[_0xcea9('0x10')](function(_0x4670c){if(_0x4670c){_0x14ebfc=_0x4670c;_0x1aab10['model']=_[_0xcea9('0x4c')](db['MailApplication'][_0xcea9('0x46')]);_0x1aab10['query']=_[_0xcea9('0x4c')](_0x184f91[_0xcea9('0x4b')]);_0x1aab10[_0xcea9('0x4d')]=_[_0xcea9('0x4e')](_0x1aab10['model'],_0x1aab10[_0xcea9('0x4b')]);_0x3b5326[_0xcea9('0x4f')]=_[_0xcea9('0x4e')](_0x1aab10[_0xcea9('0x4a')],qs[_0xcea9('0x50')](_0x184f91[_0xcea9('0x4b')][_0xcea9('0x50')]));_0x3b5326[_0xcea9('0x4f')]=_0x3b5326[_0xcea9('0x4f')]['length']?_0x3b5326['attributes']:_0x1aab10[_0xcea9('0x4a')];_0x3b5326[_0xcea9('0x54')]=qs['sort'](_0x184f91[_0xcea9('0x4b')][_0xcea9('0x55')]);_0x3b5326['where']=qs[_0xcea9('0x4d')](_[_0xcea9('0x57')](_0x184f91[_0xcea9('0x4b')],_0x1aab10[_0xcea9('0x4d')]));if(_0x184f91[_0xcea9('0x4b')][_0xcea9('0x58')]){_0x3b5326['where']=_[_0xcea9('0x59')](_0x3b5326['where'],{'$or':_[_0xcea9('0x45')](_0x3b5326[_0xcea9('0x4f')],function(_0x1a8e91){var _0x27c255={};_0x27c255[_0x1a8e91]={'$like':'%'+_0x184f91[_0xcea9('0x4b')]['filter']+'%'};return _0x27c255;})});}_0x3b5326=_['merge']({},_0x3b5326,_0x184f91['options']);return _0x14ebfc[_0xcea9('0x9b')](_0x3b5326);}})[_0xcea9('0x10')](function(_0x90a8d1){if(_0x90a8d1){_0x1bfadb=_0x90a8d1[_0xcea9('0x51')];if(!_0x184f91[_0xcea9('0x4b')][_0xcea9('0x52')](_0xcea9('0x53'))){_0x3b5326[_0xcea9('0x1f')]=qs[_0xcea9('0x1f')](_0x184f91[_0xcea9('0x4b')][_0xcea9('0x1f')]);_0x3b5326[_0xcea9('0x1d')]=qs[_0xcea9('0x1d')](_0x184f91[_0xcea9('0x4b')][_0xcea9('0x1d')]);}return _0x14ebfc[_0xcea9('0x9b')](_0x3b5326);}})[_0xcea9('0x10')](function(_0x52acb3){if(_0x52acb3){return _0x52acb3?{'count':_0x1bfadb,'rows':_0x52acb3}:null;}})['then'](respondWithResult(_0x2be604,null))[_0xcea9('0x65')](handleError(_0x2be604,null));};exports[_0xcea9('0x9c')]=function(_0x2dbb2d,_0x412359){var _0x12f699={'raw':!![],'where':{}};var _0x5bda09={};var _0x30cf92={'count':0x0,'rows':[]};return db['MailAccount'][_0xcea9('0x70')]({'where':{'id':_0x2dbb2d[_0xcea9('0x5e')]['id']}})['then'](handleEntityNotFound(_0x412359,null))[_0xcea9('0x10')](function(_0xce15c8){if(_0xce15c8){_0x5bda09[_0xcea9('0x4a')]=_['keys'](db[_0xcea9('0x9d')][_0xcea9('0x46')]);_0x5bda09[_0xcea9('0x4b')]=_[_0xcea9('0x4c')](_0x2dbb2d[_0xcea9('0x4b')]);_0x5bda09[_0xcea9('0x4d')]=_['intersection'](_0x5bda09['model'],_0x5bda09[_0xcea9('0x4b')]);_0x12f699[_0xcea9('0x4f')]=_[_0xcea9('0x4e')](_0x5bda09[_0xcea9('0x4a')],qs[_0xcea9('0x50')](_0x2dbb2d[_0xcea9('0x4b')][_0xcea9('0x50')]));_0x12f699[_0xcea9('0x4f')]=_0x12f699[_0xcea9('0x4f')][_0xcea9('0x51')]?_0x12f699[_0xcea9('0x4f')]:_0x5bda09[_0xcea9('0x4a')];if(!_0x2dbb2d['query'][_0xcea9('0x52')](_0xcea9('0x53'))){_0x12f699[_0xcea9('0x1f')]=qs['limit'](_0x2dbb2d['query'][_0xcea9('0x1f')]);_0x12f699[_0xcea9('0x1d')]=qs[_0xcea9('0x1d')](_0x2dbb2d['query'][_0xcea9('0x1d')]);}_0x12f699[_0xcea9('0x54')]=qs['sort'](_0x2dbb2d['query'][_0xcea9('0x55')]);_0x12f699[_0xcea9('0x56')]=qs['filters'](_[_0xcea9('0x57')](_0x2dbb2d['query'],_0x5bda09[_0xcea9('0x4d')]));_0x12f699[_0xcea9('0x56')][_0xcea9('0x6c')]=_0xce15c8['id'];if(_0x2dbb2d['query'][_0xcea9('0x58')]){_0x12f699[_0xcea9('0x56')]=_['merge'](_0x12f699[_0xcea9('0x56')],{'$or':_[_0xcea9('0x45')](_0x12f699['attributes'],function(_0x28fb0c){var _0x25b3a5={};_0x25b3a5[_0x28fb0c]={'$like':'%'+_0x2dbb2d[_0xcea9('0x4b')]['filter']+'%'};return _0x25b3a5;})});}if(_0x2dbb2d[_0xcea9('0x4b')][_0xcea9('0x9e')]){var _0x318135=_0x2dbb2d[_0xcea9('0x4b')]['$gte'][_0xcea9('0x9f')](',');var _0x1fc720={};_0x1fc720[_0x318135[0x0]]={'$gte':moment(_0x318135[0x1])['format'](_0xcea9('0xa0'))};_0x12f699['where']=_['merge'](_0x12f699['where'],_0x1fc720);}_0x12f699=_[_0xcea9('0x59')]({},_0x12f699,_0x2dbb2d[_0xcea9('0x63')]);return db[_0xcea9('0x9d')][_0xcea9('0x20')]({'where':_0x12f699[_0xcea9('0x56')]})['then'](function(_0x817046){_0x30cf92[_0xcea9('0x20')]=_0x817046;if(_0x2dbb2d['query'][_0xcea9('0x61')]){_0x12f699[_0xcea9('0x62')]=[{'all':!![]}];}return db[_0xcea9('0x9d')][_0xcea9('0x5c')](_0x12f699);})['then'](function(_0x58b058){if(_0x2dbb2d[_0xcea9('0x4b')][_0xcea9('0xa1')]==='true'){for(var _0x4ffc02=0x0;_0x4ffc02<_0x58b058['length'];_0x4ffc02++){_0x58b058[_0x4ffc02][_0xcea9('0x66')]=juice(_0x58b058[_0x4ffc02][_0xcea9('0x66')]);}}_0x30cf92[_0xcea9('0x5d')]=_0x58b058;return _0x30cf92;});}})[_0xcea9('0x10')](respondWithFilteredResult(_0x412359,_0x12f699))[_0xcea9('0x65')](handleError(_0x412359,null));};exports['send']=function(_0x2ac0fb,_0x25c96d){var _0x44c09b,_0x1a92d3={},_0x54c5a1;if(_0x2ac0fb[_0xcea9('0x66')]['to']){_0x54c5a1=_0x2ac0fb['body']['to']['split'](',')[0x0];}return db[_0xcea9('0x5b')]['find']({'where':{'id':_0x2ac0fb[_0xcea9('0x5e')]['id']},'include':[{'model':db['CmList'],'as':_0xcea9('0xa2'),'include':[{'model':db[_0xcea9('0x8a')],'as':_0xcea9('0xa3'),'where':{'email':_0x54c5a1},'limit':0x1,'order':[[_0xcea9('0xa4'),_0xcea9('0xa5')]]}]},{'model':db[_0xcea9('0x5f')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xcea9('0xa6')],'as':'CloudProvider','raw':!![]}]}]})[_0xcea9('0x10')](handleEntityNotFound(_0x25c96d,null))[_0xcea9('0x10')](function(_0x4cab37){if(!_0x4cab37)return;_0x44c09b=_0x4cab37;if(!_0x4cab37['Smtp'])throw new Error('Smtp\x20configuration\x20not\x20found');if(_['isNil'](_0x2ac0fb[_0xcea9('0x66')]['from'])){_0x2ac0fb[_0xcea9('0x66')]['from']=util[_0xcea9('0xa7')](_0xcea9('0xa8'),_0x4cab37[_0xcea9('0x27')],_0x4cab37['email']||_0x4cab37[_0xcea9('0x43')][_0xcea9('0x35')]);}if(_0x2ac0fb['body'][_0xcea9('0xa9')]&&_0x2ac0fb[_0xcea9('0x66')][_0xcea9('0xa9')][_0xcea9('0x51')]){for(var _0x2609a7=0x0;_0x2609a7<_0x2ac0fb[_0xcea9('0x66')][_0xcea9('0xa9')]['length'];_0x2609a7+=0x1){_0x2ac0fb[_0xcea9('0x66')][_0xcea9('0xa9')][_0x2609a7]={'filename':_0x2ac0fb[_0xcea9('0x66')]['attachments'][_0x2609a7][_0xcea9('0x27')],'path':path[_0xcea9('0xaa')](config[_0xcea9('0xab')],'server/files/attachments',_0x2ac0fb['body'][_0xcea9('0xa9')][_0x2609a7][_0xcea9('0xac')])};}}var _0x46befd=_0x4cab37[_0xcea9('0xad')]();return respondWithRpcPromise(_0xcea9('0xae'),_0xcea9('0xaf'),{'account':_0x46befd,'message':_0x2ac0fb['body']});})[_0xcea9('0x10')](function(_0x251c50){if(!_0x251c50)return;_0x1a92d3=_0x251c50;if(!_0x44c09b[_0xcea9('0xa2')])throw new Error(_0xcea9('0xb0'));if(_0x44c09b['List'][_0xcea9('0xa3')][_0xcea9('0x51')])return _0x44c09b[_0xcea9('0xa2')]['Contacts'][0x0];return db['CmContact'][_0xcea9('0x6e')](_[_0xcea9('0xc')](_0x2ac0fb['body'],{'firstName':_0x2ac0fb['body']['to'],'email':_0x2ac0fb[_0xcea9('0x66')]['to'],'phone':_0x2ac0fb[_0xcea9('0x66')]['to'],'ListId':_0x44c09b[_0xcea9('0x76')]}));})[_0xcea9('0x10')](function(_0x295f5f){if(!_0x295f5f)return;var _0xb4148c={'UserId':_0x2ac0fb[_0xcea9('0x35')]['id'],'ContactId':_0x295f5f['id'],'MailAccountId':_0x44c09b['id'],'inReplyTo':_0x1a92d3[_0xcea9('0xb1')],'to':_0x2ac0fb[_0xcea9('0x66')]['from'],'cc':_0x2ac0fb[_0xcea9('0x66')]['cc'],'subject':_0x2ac0fb['body'][_0xcea9('0xb2')],'attach':_0x2ac0fb[_0xcea9('0x66')][_0xcea9('0xb3')],'firstMsgDirection':_0xcea9('0xb4'),'lastMsgAt':moment()[_0xcea9('0xa7')](_0xcea9('0xa0')),'lastMsgDirection':_0xcea9('0xb4'),'Messages':[_[_0xcea9('0x59')](_0x2ac0fb[_0xcea9('0x66')],{'messageId':_0x1a92d3[_0xcea9('0xb1')],'sentAt':moment()[_0xcea9('0xa7')](_0xcea9('0xa0')),'read':!![],'MailAccountId':_0x44c09b['id'],'UserId':_0x2ac0fb[_0xcea9('0x35')]['id'],'ContactId':_0x295f5f['id']})]};if(_0x2ac0fb['body'][_0xcea9('0xb5')]){_0xb4148c=_[_0xcea9('0x59')](_0xb4148c,_0x2ac0fb[_0xcea9('0x66')]['Interaction']);}return db[_0xcea9('0x87')][_0xcea9('0x6e')](_0xb4148c,{'include':[{'model':db[_0xcea9('0x9d')],'as':_0xcea9('0xb6')}]});})['then'](respondWithResult(_0x25c96d,null))[_0xcea9('0x65')](handleError(_0x25c96d,null));};exports[_0xcea9('0xb7')]=function(_0x2561ae,_0x10b74f){return db['MailAccount'][_0xcea9('0x64')]({'where':{'id':_0x2561ae[_0xcea9('0x5e')]['id']},'include':[{'model':db[_0xcea9('0x5f')],'as':_0xcea9('0x43'),'raw':!![],'include':[{'model':db[_0xcea9('0xa6')],'as':_0xcea9('0xa6'),'raw':!![]}]}]})[_0xcea9('0x10')](handleEntityNotFound(_0x10b74f,null))[_0xcea9('0x10')](function(_0x5853f0){if(!_0x5853f0[_0xcea9('0x43')])return;var _0x2d739d=_0x5853f0['getSmtpOptions']();return respondWithRpcPromise(_0xcea9('0xb8'),'verifySmtp',{'account':_0x2d739d});})[_0xcea9('0x10')](respondWithResult(_0x10b74f,null))[_0xcea9('0x65')](handleError(_0x10b74f,null));};exports[_0xcea9('0x25')]=function(_0x1b6b33,_0x6e019e){return db[_0xcea9('0x5b')][_0xcea9('0x64')]({'where':{'id':_0x1b6b33[_0xcea9('0x5e')]['id']}})[_0xcea9('0x10')](handleEntityNotFound(_0x6e019e,null))[_0xcea9('0x10')](function(_0x391d53){if(_0x391d53&&_0x391d53['service']){throw new db[(_0xcea9('0xb9'))][(_0xcea9('0xba'))](_0xcea9('0xbb'));}return _0x391d53;})[_0xcea9('0x10')](removeEntity(_0x6e019e,null))[_0xcea9('0x65')](handleError(_0x6e019e,null));};exports[_0xcea9('0xbc')]=function(_0x56d03c,_0x38a96d){return db[_0xcea9('0x5b')][_0xcea9('0x64')]({'where':{'id':_0x56d03c[_0xcea9('0x5e')]['id']}})[_0xcea9('0x10')](handleEntityNotFound(_0x38a96d,null))[_0xcea9('0x10')](function(_0x1e18c){if(_0x1e18c){return _0x1e18c[_0xcea9('0xbc')](_0x56d03c[_0xcea9('0x66')][_0xcea9('0x88')],_['omit'](_0x56d03c[_0xcea9('0x66')],[_0xcea9('0x88'),'id'])||{})['spread'](function(_0x4c57a4){for(var _0x2d65e3=0x0;_0x2d65e3<_0x56d03c[_0xcea9('0x66')][_0xcea9('0x88')]['length'];_0x2d65e3+=0x1){socket[_0xcea9('0xbd')](_0xcea9('0xbe'),{'UserId':Number(_0x56d03c[_0xcea9('0x66')][_0xcea9('0x88')][_0x2d65e3]),'MailAccountId':Number(_0x56d03c[_0xcea9('0x5e')]['id'])});}return _0x4c57a4;});}})[_0xcea9('0x10')](respondWithResult(_0x38a96d,null))['catch'](handleError(_0x38a96d,null));};exports[_0xcea9('0xbf')]=function(_0x5861ba,_0xc0d160){return db[_0xcea9('0x5b')][_0xcea9('0x64')]({'where':{'id':_0x5861ba['params']['id']}})['then'](handleEntityNotFound(_0xc0d160,null))[_0xcea9('0x10')](function(_0x2e1f97){if(_0x2e1f97){return _0x2e1f97[_0xcea9('0xbf')](_0x5861ba[_0xcea9('0x4b')]['ids'])[_0xcea9('0x10')](function(){if(_[_0xcea9('0xc0')](_0x5861ba[_0xcea9('0x4b')][_0xcea9('0x88')])){for(var _0x5c0222=0x0;_0x5c0222<_0x5861ba[_0xcea9('0x4b')][_0xcea9('0x88')][_0xcea9('0x51')];_0x5c0222+=0x1){socket[_0xcea9('0xbd')](_0xcea9('0xc1'),{'UserId':Number(_0x5861ba[_0xcea9('0x4b')]['ids'][_0x5c0222]),'MailAccountId':Number(_0x5861ba[_0xcea9('0x5e')]['id'])});}}else{socket[_0xcea9('0xbd')]('userMailAccount:remove',{'UserId':Number(_0x5861ba[_0xcea9('0x4b')]['ids']),'MailAccountId':Number(_0x5861ba[_0xcea9('0x5e')]['id'])});}});}})[_0xcea9('0x10')](respondWithStatusCode(_0xc0d160,null))[_0xcea9('0x65')](handleError(_0xc0d160,null));};exports[_0xcea9('0xc2')]=function(_0x17cce1,_0x126be0){var _0x3d0bdd={};var _0x581801={};var _0x582e9b;var _0x5bc95a;return db[_0xcea9('0x5b')]['findOne']({'where':{'id':_0x17cce1[_0xcea9('0x5e')]['id']}})[_0xcea9('0x10')](handleEntityNotFound(_0x126be0,null))[_0xcea9('0x10')](function(_0x5c9d9b){if(_0x5c9d9b){_0x582e9b=_0x5c9d9b;_0x581801[_0xcea9('0x4a')]=_['keys'](db['User'][_0xcea9('0x46')]);_0x581801['query']=_['keys'](_0x17cce1[_0xcea9('0x4b')]);_0x581801['filters']=_[_0xcea9('0x4e')](_0x581801[_0xcea9('0x4a')],_0x581801[_0xcea9('0x4b')]);_0x3d0bdd['attributes']=_[_0xcea9('0x4e')](_0x581801[_0xcea9('0x4a')],qs[_0xcea9('0x50')](_0x17cce1[_0xcea9('0x4b')][_0xcea9('0x50')]));_0x3d0bdd[_0xcea9('0x4f')]=_0x3d0bdd['attributes'][_0xcea9('0x51')]?_0x3d0bdd[_0xcea9('0x4f')]:_0x581801['model'];_0x3d0bdd[_0xcea9('0x54')]=qs[_0xcea9('0x55')](_0x17cce1[_0xcea9('0x4b')][_0xcea9('0x55')]);_0x3d0bdd[_0xcea9('0x56')]=qs[_0xcea9('0x4d')](_[_0xcea9('0x57')](_0x17cce1[_0xcea9('0x4b')],_0x581801[_0xcea9('0x4d')]));if(_0x17cce1['query'][_0xcea9('0x58')]){_0x3d0bdd[_0xcea9('0x56')]=_[_0xcea9('0x59')](_0x3d0bdd['where'],{'$or':_[_0xcea9('0x45')](_0x3d0bdd['attributes'],function(_0x4f3291){var _0x38375a={};_0x38375a[_0x4f3291]={'$like':'%'+_0x17cce1[_0xcea9('0x4b')][_0xcea9('0x58')]+'%'};return _0x38375a;})});}_0x3d0bdd=_[_0xcea9('0x59')]({},_0x3d0bdd,_0x17cce1[_0xcea9('0x63')]);return _0x582e9b[_0xcea9('0xc2')](_0x3d0bdd);}})[_0xcea9('0x10')](function(_0x529295){if(_0x529295){_0x5bc95a=_0x529295[_0xcea9('0x51')];if(!_0x17cce1[_0xcea9('0x4b')][_0xcea9('0x52')](_0xcea9('0x53'))){_0x3d0bdd['limit']=qs[_0xcea9('0x1f')](_0x17cce1[_0xcea9('0x4b')]['limit']);_0x3d0bdd[_0xcea9('0x1d')]=qs[_0xcea9('0x1d')](_0x17cce1['query'][_0xcea9('0x1d')]);}return _0x582e9b[_0xcea9('0xc2')](_0x3d0bdd);}})[_0xcea9('0x10')](function(_0x4c57a1){if(_0x4c57a1){return _0x4c57a1?{'count':_0x5bc95a,'rows':_0x4c57a1}:null;}})[_0xcea9('0x10')](respondWithResult(_0x126be0,null))[_0xcea9('0x65')](handleError(_0x126be0,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 9a5b849..c914359 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 _0x3914=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x55afc6,_0x58ad8c){var _0x2758d3=function(_0x4b8f14){while(--_0x4b8f14){_0x55afc6['push'](_0x55afc6['shift']());}};_0x2758d3(++_0x58ad8c);}(_0x3914,0xeb));var _0x4391=function(_0x3e478c,_0x152670){_0x3e478c=_0x3e478c-0x0;var _0x29ef89=_0x3914[_0x3e478c];return _0x29ef89;};'use strict';var EventEmitter=require(_0x4391('0x0'));var MailAccount=require(_0x4391('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4391('0x2')](0x0);var events={'afterCreate':_0x4391('0x3'),'afterUpdate':'update','afterDestroy':_0x4391('0x4')};function emitEvent(_0x343fb7){return function(_0x175dbc,_0x5b5acb,_0x1eecd4){MailAccountEvents[_0x4391('0x5')](_0x343fb7+':'+_0x175dbc['id'],_0x175dbc);MailAccountEvents['emit'](_0x343fb7,_0x175dbc);_0x1eecd4(null);};}for(var e in events){if(events[_0x4391('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x4391('0x7')]=MailAccountEvents; \ No newline at end of file +var _0xb90a=['setMaxListeners','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3feecc,_0x2eb732){var _0x294678=function(_0x125af6){while(--_0x125af6){_0x3feecc['push'](_0x3feecc['shift']());}};_0x294678(++_0x2eb732);}(_0xb90a,0x12a));var _0xab90=function(_0x546f1c,_0x523911){_0x546f1c=_0x546f1c-0x0;var _0x46e4fc=_0xb90a[_0x546f1c];return _0x46e4fc;};'use strict';var EventEmitter=require(_0xab90('0x0'));var MailAccount=require(_0xab90('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xab90('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5eaa1d){return function(_0x57672e,_0x3912db,_0x178509){MailAccountEvents['emit'](_0x5eaa1d+':'+_0x57672e['id'],_0x57672e);MailAccountEvents['emit'](_0x5eaa1d,_0x57672e);_0x178509(null);};}for(var e in events){if(events[_0xab90('0x3')](e)){var event=events[e];MailAccount[_0xab90('0x4')](e,emitEvent(event));}}module[_0xab90('0x5')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 16b025d..626a9b7 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 _0x1bd3=['./mailAccount.attributes','exports','define','mail_accounts','provider','Smtp','host','port','secure','modernAuthentication','auth','user','CloudProvider','pass'];(function(_0x3ce937,_0x24bd88){var _0x3e6188=function(_0x45d2a9){while(--_0x45d2a9){_0x3ce937['push'](_0x3ce937['shift']());}};_0x3e6188(++_0x24bd88);}(_0x1bd3,0x1c0));var _0x31bd=function(_0x5e2db0,_0x5e9ffd){_0x5e2db0=_0x5e2db0-0x0;var _0x320e13=_0x1bd3[_0x5e2db0];return _0x320e13;};'use strict';var attributes=require(_0x31bd('0x0'));module[_0x31bd('0x1')]=function(_0x42fc37){return _0x42fc37[_0x31bd('0x2')]('MailAccount',attributes,{'tableName':_0x31bd('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0xe77116=this;var _0x41bb91={'id':_0xe77116['id'],'tls':{'rejectUnauthorized':![]}};if(_0xe77116['provider']!=='custom'){_0x41bb91['service']=_0xe77116[_0x31bd('0x4')];}else{_0x41bb91['host']=_0xe77116[_0x31bd('0x5')][_0x31bd('0x6')];_0x41bb91[_0x31bd('0x7')]=_0xe77116[_0x31bd('0x5')][_0x31bd('0x7')];_0x41bb91[_0x31bd('0x8')]=_0xe77116[_0x31bd('0x5')][_0x31bd('0x8')];}if(_0xe77116[_0x31bd('0x5')]['authentication']){if(_0xe77116[_0x31bd('0x5')][_0x31bd('0x9')]){if(!_0xe77116[_0x31bd('0x5')]['CloudProvider'])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x41bb91[_0x31bd('0xa')]={'type':'OAuth2','user':_0xe77116[_0x31bd('0x5')][_0x31bd('0xb')],'accessToken':_0xe77116['Smtp'][_0x31bd('0xc')]['data5']};}else{_0x41bb91[_0x31bd('0xa')]={'user':_0xe77116[_0x31bd('0x5')][_0x31bd('0xb')],'pass':_0xe77116[_0x31bd('0x5')][_0x31bd('0xd')]};}}return _0x41bb91;}}});}; \ No newline at end of file +var _0x5443=['custom','provider','host','Smtp','port','secure','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','data5','./mailAccount.attributes','exports','define','MailAccount'];(function(_0x30f781,_0x1ce35d){var _0x461df7=function(_0xaacb71){while(--_0xaacb71){_0x30f781['push'](_0x30f781['shift']());}};_0x461df7(++_0x1ce35d);}(_0x5443,0x119));var _0x3544=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5443[_0x40a045];return _0x1a687c;};'use strict';var attributes=require(_0x3544('0x0'));module[_0x3544('0x1')]=function(_0x528466){return _0x528466[_0x3544('0x2')](_0x3544('0x3'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x5d733b=this;var _0x4c7319={'id':_0x5d733b['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5d733b['provider']!==_0x3544('0x4')){_0x4c7319['service']=_0x5d733b[_0x3544('0x5')];}else{_0x4c7319[_0x3544('0x6')]=_0x5d733b[_0x3544('0x7')][_0x3544('0x6')];_0x4c7319[_0x3544('0x8')]=_0x5d733b['Smtp'][_0x3544('0x8')];_0x4c7319[_0x3544('0x9')]=_0x5d733b[_0x3544('0x7')][_0x3544('0x9')];}if(_0x5d733b['Smtp']['authentication']){if(_0x5d733b['Smtp'][_0x3544('0xa')]){if(!_0x5d733b[_0x3544('0x7')]['CloudProvider'])throw new Error(_0x3544('0xb'));_0x4c7319[_0x3544('0xc')]={'type':'OAuth2','user':_0x5d733b[_0x3544('0x7')][_0x3544('0xd')],'accessToken':_0x5d733b[_0x3544('0x7')]['CloudProvider'][_0x3544('0xe')]};}else{_0x4c7319[_0x3544('0xc')]={'user':_0x5d733b[_0x3544('0x7')][_0x3544('0xd')],'pass':_0x5d733b[_0x3544('0x7')]['pass']};}}return _0x4c7319;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index c863df7..f533cf1 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 _0x24ca=['localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','raw','attributes','limit','include','map','model','GetMailAccount','debug','ShowMailAccount','MailAccount','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','difference','keys','CmContact','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','list','applications','orderBy','priority','asc','autoclose','push','length','close','create','List\x20not\x20found','contact','messageId','generate','attach','format','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','update','subject','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','name','unshift','agent','*,*,*,*','MailQueue','queue','waitForTheAssignedQueue','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0x24ca,0x1bc));var _0xa24c=function(_0x3ed054,_0x4d4f16){_0x3ed054=_0x3ed054-0x0;var _0x16dd95=_0x24ca[_0x3ed054];return _0x16dd95;};'use strict';var _=require(_0xa24c('0x0'));var moment=require('moment');var BPromise=require(_0xa24c('0x1'));var rs=require(_0xa24c('0x2'));var Redis=require(_0xa24c('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xa24c('0x4'))(_0xa24c('0x5'));var config=require(_0xa24c('0x6'));var jayson=require(_0xa24c('0x7'));var client=jayson[_0xa24c('0x8')][_0xa24c('0x9')]({'port':0x232c});config[_0xa24c('0xa')]=_[_0xa24c('0xb')](config[_0xa24c('0xa')],{'host':_0xa24c('0xc'),'port':0x18eb});var socket=require(_0xa24c('0xd'))(new Redis(config['redis']));require(_0xa24c('0xe'))[_0xa24c('0xf')](socket);function respondWithRpcPromise(_0x2d645c,_0x5eac78,_0x399f32){return new BPromise(function(_0x325c6d,_0x288f76){return client[_0xa24c('0x10')](_0x2d645c,_0x399f32)[_0xa24c('0x11')](function(_0x43aa5a){logger[_0xa24c('0x12')](_0xa24c('0x13'),_0x5eac78,_0xa24c('0x14'));logger['debug'](_0xa24c('0x15'),_0x5eac78,_0xa24c('0x14'),JSON[_0xa24c('0x16')](_0x43aa5a));if(_0x43aa5a[_0xa24c('0x17')]){if(_0x43aa5a['error'][_0xa24c('0x18')]===0x1f4){logger[_0xa24c('0x17')](_0xa24c('0x13'),_0x5eac78,_0x43aa5a[_0xa24c('0x17')][_0xa24c('0x19')]);return _0x288f76(_0x43aa5a[_0xa24c('0x17')][_0xa24c('0x19')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x5eac78,_0x43aa5a[_0xa24c('0x17')][_0xa24c('0x19')]);return _0x325c6d(_0x43aa5a['error']['message']);}else{logger[_0xa24c('0x12')](_0xa24c('0x13'),_0x5eac78,'request\x20sent');_0x325c6d(_0x43aa5a[_0xa24c('0x1a')]['message']);}})[_0xa24c('0x1b')](function(_0x2a610a){logger[_0xa24c('0x17')](_0xa24c('0x13'),_0x5eac78,_0x2a610a);_0x288f76(_0x2a610a);});});}exports['GetMailAccount']=function(_0x16d363){var _0x18b7e0=this;return new Promise(function(_0x773f70,_0x4d4bab){return db['MailAccount']['findAll']({'raw':_0x16d363['options']?_0x16d363[_0xa24c('0x1c')][_0xa24c('0x1d')]===undefined?!![]:![]:!![],'where':_0x16d363[_0xa24c('0x1c')]?_0x16d363[_0xa24c('0x1c')]['where']||null:null,'attributes':_0x16d363[_0xa24c('0x1c')]?_0x16d363['options'][_0xa24c('0x1e')]||null:null,'limit':_0x16d363[_0xa24c('0x1c')]?_0x16d363['options'][_0xa24c('0x1f')]||null:null,'include':_0x16d363[_0xa24c('0x1c')]?_0x16d363[_0xa24c('0x1c')][_0xa24c('0x20')]?_[_0xa24c('0x21')](_0x16d363['options'][_0xa24c('0x20')],function(_0x5cc9cb){return{'model':db[_0x5cc9cb[_0xa24c('0x22')]],'as':_0x5cc9cb['as'],'attributes':_0x5cc9cb[_0xa24c('0x1e')],'include':_0x5cc9cb[_0xa24c('0x20')]?_['map'](_0x5cc9cb[_0xa24c('0x20')],function(_0x31c4d9){return{'model':db[_0x31c4d9[_0xa24c('0x22')]],'as':_0x31c4d9['as'],'attributes':_0x31c4d9[_0xa24c('0x1e')],'include':_0x31c4d9[_0xa24c('0x20')]?_[_0xa24c('0x21')](_0x31c4d9[_0xa24c('0x20')],function(_0x5b23f4){return{'model':db[_0x5b23f4[_0xa24c('0x22')]],'as':_0x5b23f4['as'],'attributes':_0x5b23f4[_0xa24c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa24c('0x11')](function(_0x12dbdc){logger['info'](_0xa24c('0x23'),_0x16d363);logger[_0xa24c('0x24')](_0xa24c('0x23'),_0x16d363,JSON['stringify'](_0x12dbdc));_0x773f70(_0x12dbdc);})[_0xa24c('0x1b')](function(_0x3dcb1b){logger[_0xa24c('0x17')]('GetMailAccount',_0x3dcb1b[_0xa24c('0x19')],_0x16d363);_0x4d4bab(_0x18b7e0['error'](0x1f4,_0x3dcb1b[_0xa24c('0x19')]));});});};exports[_0xa24c('0x25')]=function(_0x1a247b){var _0x5d025a=this;return new Promise(function(_0x1f52f8,_0x53f90){return db[_0xa24c('0x26')]['find']({'raw':_0x1a247b[_0xa24c('0x1c')]?_0x1a247b['options'][_0xa24c('0x1d')]===undefined?!![]:![]:!![],'where':_0x1a247b[_0xa24c('0x1c')]?_0x1a247b['options']['where']||null:null,'attributes':_0x1a247b[_0xa24c('0x1c')]?_0x1a247b[_0xa24c('0x1c')][_0xa24c('0x1e')]||null:null,'include':_0x1a247b[_0xa24c('0x1c')]?_0x1a247b[_0xa24c('0x1c')][_0xa24c('0x20')]?_[_0xa24c('0x21')](_0x1a247b['options'][_0xa24c('0x20')],function(_0x3ea442){return{'model':db[_0x3ea442[_0xa24c('0x22')]],'as':_0x3ea442['as'],'attributes':_0x3ea442[_0xa24c('0x1e')],'include':_0x3ea442[_0xa24c('0x20')]?_[_0xa24c('0x21')](_0x3ea442[_0xa24c('0x20')],function(_0x81d471){return{'model':db[_0x81d471[_0xa24c('0x22')]],'as':_0x81d471['as'],'attributes':_0x81d471[_0xa24c('0x1e')],'include':_0x81d471['include']?_[_0xa24c('0x21')](_0x81d471[_0xa24c('0x20')],function(_0x2b362d){return{'model':db[_0x2b362d[_0xa24c('0x22')]],'as':_0x2b362d['as'],'attributes':_0x2b362d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x19a65f){if(_0x1a247b['options'][_0xa24c('0x27')]===!![])_0x19a65f[_0xa24c('0x28')](_0xa24c('0x29'),_0x19a65f[_0xa24c('0x2a')]());logger[_0xa24c('0x12')]('ShowMailAccount',_0x1a247b);logger['debug'](_0xa24c('0x25'),_0x1a247b,JSON[_0xa24c('0x16')](_0x19a65f));_0x1f52f8(_0x19a65f);})[_0xa24c('0x1b')](function(_0x213dc3){logger[_0xa24c('0x17')](_0xa24c('0x25'),_0x213dc3['message'],_0x1a247b);_0x53f90(_0x5d025a['error'](0x1f4,_0x213dc3[_0xa24c('0x19')]));});});};exports[_0xa24c('0x2b')]=function(_0x4037d6){var _0x2101f8=this;return new Promise(function(_0x43beff,_0x4c5b7e){var _0x171c51={'body':_0x4037d6[_0xa24c('0x2c')],'channel':'mail'};var _0x599627=_[_0xa24c('0x2d')](_[_0xa24c('0x2e')](db[_0xa24c('0x2f')]['rawAttributes']),['createdAt',_0xa24c('0x30'),_0xa24c('0x31'),_0xa24c('0x32')]);var _0x3ccc37=![];if(_0x4037d6[_0xa24c('0x2c')]['id']){delete _0x4037d6[_0xa24c('0x2c')]['id'];}if(_[_0xa24c('0x33')](_0x4037d6[_0xa24c('0x2c')]['from'])){return _0x4c5b7e(_0x2101f8['error'](0x1f4,_0xa24c('0x34')));}if(_[_0xa24c('0x33')](_0x4037d6[_0xa24c('0x2c')]['body'])||_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x2c')]===''){return _0x4c5b7e(_0x2101f8[_0xa24c('0x17')](0x1f4,_0xa24c('0x35')));}if(_[_0xa24c('0x33')](_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x36')])){return _0x4c5b7e(_0x2101f8[_0xa24c('0x17')](0x1f4,_0xa24c('0x37')+_0x599627));}if(!_[_0xa24c('0x38')](_0x599627,_0x4037d6['body'][_0xa24c('0x36')])){return _0x4c5b7e(_0x2101f8[_0xa24c('0x17')](0x1f4,_0xa24c('0x39')+_0x599627));}var _0x5aa2b2={};_0x5aa2b2[_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x36')]]=_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x3a')];return db[_0xa24c('0x26')][_0xa24c('0x3b')]({'where':{'id':_0x4037d6[_0xa24c('0x3c')]['id']},'include':[{'model':db[_0xa24c('0x3d')],'as':_0xa24c('0x3e'),'include':[{'model':db[_0xa24c('0x2f')],'as':_0xa24c('0x3f'),'where':_0x5aa2b2,'limit':0x1,'order':[['updatedAt',_0xa24c('0x40')]]}]},{'model':db[_0xa24c('0x41')],'as':_0xa24c('0x42')},{'model':db[_0xa24c('0x43')],'as':_0xa24c('0x44'),'include':[{'model':db[_0xa24c('0x45')],'as':_0xa24c('0x45')}]}]})[_0xa24c('0x11')](function(_0x184179){if(_0x184179&&_0x184179['List']){var _0x540da8=_0x184179[_0xa24c('0x46')]({'plain':!![]});_0x171c51['account']=_[_0xa24c('0x47')](_0x540da8,[_0xa24c('0x42'),'List']);_0x171c51[_0xa24c('0x3c')][_0xa24c('0x29')]=_0x184179[_0xa24c('0x2a')]();_0x171c51['applications']=_0x540da8['Applications'];_0x171c51[_0xa24c('0x48')]=_0x540da8['List'];_0x171c51[_0xa24c('0x49')]=_[_0xa24c('0x4a')](_0x171c51[_0xa24c('0x49')],[_0xa24c('0x4b')],[_0xa24c('0x4c')]);if(_0x171c51[_0xa24c('0x3c')]&&_0x171c51[_0xa24c('0x3c')][_0xa24c('0x4d')]){_0x171c51[_0xa24c('0x49')][_0xa24c('0x4e')]({'id':0x0,'priority':_0x171c51['applications'][_0xa24c('0x4f')]+0x1,'app':_0xa24c('0x50'),'appdata':_0xa24c('0x4d'),'interval':'*,*,*,*'});}if(_0x171c51['account']['Applications']){delete _0x171c51[_0xa24c('0x3c')]['Applications'];}if(_0x171c51[_0xa24c('0x3c')][_0xa24c('0x3e')]){delete _0x171c51['account'][_0xa24c('0x3e')];}if(_0x540da8[_0xa24c('0x3e')][_0xa24c('0x3f')][_0xa24c('0x4f')]){return _0x540da8[_0xa24c('0x3e')][_0xa24c('0x3f')][0x0];}var _0x3816f7=_[_0xa24c('0xb')](_0x4037d6['body'],{'firstName':_0x4037d6[_0xa24c('0x2c')]['from'],'ListId':_0x540da8['ListId']});_0x3816f7[_0x4037d6['body']['mapKey']]=_0x4037d6['body'][_0xa24c('0x3a')];return db['CmContact'][_0xa24c('0x51')](_0x3816f7);}else{throw new Error(_0xa24c('0x52'));}})[_0xa24c('0x11')](function(_0x1a5f17){_0x171c51[_0xa24c('0x53')]=_0x1a5f17;if(_0x1a5f17){if(!_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x54')]){_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x54')]=rs[_0xa24c('0x55')]()+'\x20'+_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x3a')];}var _0x5c3d11={'ContactId':_0x1a5f17['id'],'MailAccountId':_0x4037d6[_0xa24c('0x3c')]['id'],'inReplyTo':_0x4037d6[_0xa24c('0x2c')]['message'][_0xa24c('0x54')],'to':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x3a')],'cc':_0x4037d6['body']['message']['cc'],'subject':_0x4037d6[_0xa24c('0x2c')]['message']['subject'],'attach':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x56')],'lastMsgAt':moment()[_0xa24c('0x57')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0xa24c('0x3b')]({'where':{'closed':![],'MailAccountId':_0x4037d6['account']['id']},'include':[{'model':db['MailMessage'],'as':_0xa24c('0x58'),'attributes':[_0xa24c('0x54')],'where':{'messageId':_0x4037d6[_0xa24c('0x2c')]['message'][_0xa24c('0x59')]}}]})[_0xa24c('0x11')](function(_0x5c3285){if(_0x5c3285){return[_0x5c3285,![]];}return db[_0xa24c('0x5a')][_0xa24c('0x51')](_0x5c3d11)[_0xa24c('0x11')](function(_0x4bee5c){return[_0x4bee5c,!![]];});});}else{throw new Error(_0xa24c('0x5b'));}})[_0xa24c('0x5c')](function(_0x21439a,_0x7aab6e){if(_0x21439a){_0x3ccc37=_0x7aab6e;if(!_0x7aab6e){return _0x21439a[_0xa24c('0x5d')]({'inReplyTo':_0x4037d6['body'][_0xa24c('0x19')][_0xa24c('0x54')],'to':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x3a')],'cc':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')]['cc'],'subject':_0x4037d6['body'][_0xa24c('0x19')][_0xa24c('0x5e')],'attach':_0x21439a['attach']?_0x21439a[_0xa24c('0x56')]:_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x56')],'substatus':null,'substatusAt':moment()[_0xa24c('0x57')](_0xa24c('0x5f')),'lastMsgAt':moment()[_0xa24c('0x57')](_0xa24c('0x5f')),'lastMsgDirection':'in'});}else{return _0x21439a;}}})[_0xa24c('0x11')](function(_0x32ddc3){_0x171c51['interaction']=_0x32ddc3[_0xa24c('0x46')]({'plain':!![]});_0x171c51[_0xa24c('0x60')][_0xa24c('0x61')]=_0x3ccc37;return db['MailMessage'][_0xa24c('0x51')]({'body':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x2c')],'MailAccountId':_0x4037d6['account']['id'],'MailInteractionId':_0x32ddc3['id'],'direction':'in','ContactId':_0x171c51[_0xa24c('0x53')]['id'],'messageId':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x54')],'from':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')]['from'],'to':_0x4037d6['body'][_0xa24c('0x19')]['to'],'cc':_0x4037d6['body'][_0xa24c('0x19')]['cc'],'subject':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x5e')],'attach':_0x4037d6[_0xa24c('0x2c')]['message'][_0xa24c('0x56')],'Attachments':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x62')],'originTo':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')]['originTo'],'originCc':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x63')],'bcc':_0x4037d6[_0xa24c('0x2c')]['message'][_0xa24c('0x64')],'ChatWebsiteId':_0x4037d6['body'][_0xa24c('0x19')][_0xa24c('0x65')]||null,'originChannel':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')]['originChannel']||_0xa24c('0x66'),'ChatOfflineMessageId':_0x4037d6[_0xa24c('0x2c')]['message'][_0xa24c('0x67')]||null},{'include':[{'model':db[_0xa24c('0x68')],'as':_0xa24c('0x69')}]});})[_0xa24c('0x11')](function(_0x8bd3fb){_0x171c51[_0xa24c('0x19')]=_0x8bd3fb;if(!_0x171c51[_0xa24c('0x60')][_0xa24c('0x6a')]){return;}return db['User'][_0xa24c('0x3b')]({'attributes':['id',_0xa24c('0x6b')],'where':{'id':_0x171c51[_0xa24c('0x60')][_0xa24c('0x6a')]}});})[_0xa24c('0x11')](function(_0x209b42){if(_0x209b42){_0x171c51[_0xa24c('0x49')][_0xa24c('0x6c')]({'id':0x0,'priority':0x0,'app':_0xa24c('0x6d'),'appdata':_0x209b42[_0xa24c('0x6b')]+','+(_0x171c51[_0xa24c('0x3c')]['waitForTheAssignedAgent']||0xa),'interval':_0xa24c('0x6e')});}if(!_0x171c51[_0xa24c('0x60')]['queueId']){return;}return db[_0xa24c('0x6f')][_0xa24c('0x3b')]({'attributes':['id',_0xa24c('0x6b')],'where':{'id':_0x171c51['interaction']['queueId']}});})[_0xa24c('0x11')](function(_0x4c9b19){if(_0x4c9b19){_0x171c51['applications'][_0xa24c('0x6c')]({'id':0x0,'priority':0x1,'app':_0xa24c('0x70'),'appdata':_0x4c9b19[_0xa24c('0x6b')]+','+(_0x171c51[_0xa24c('0x3c')][_0xa24c('0x71')]||0x12c),'interval':_0xa24c('0x6e')});}return respondWithRpcPromise('Start','startRouting',_0x171c51);})['then'](function(_0x263dab){_0x43beff(_0x263dab);})['catch'](function(_0x53462e){_0x4c5b7e(_0x2101f8[_0xa24c('0x17')](0x1f4,_0x53462e[_0xa24c('0x19')]));});});}; \ No newline at end of file +var _0x0618=['ChatOfflineMessageId','Attachment','User','agent','name','queueId','unshift','queue','waitForTheAssignedQueue','Start','lodash','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','options','raw','include','attributes','map','GetMailAccount','debug','ShowMailAccount','find','model','then','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','List','Contacts','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','account','omit','applications','list','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','create','Contact\x20not\x20found','spread','update','subject','interaction','created','attachments','originTo','originCc','bcc','originChannel','Email'];(function(_0x4e9b5f,_0xbfb45b){var _0x23a694=function(_0x26243c){while(--_0x26243c){_0x4e9b5f['push'](_0x4e9b5f['shift']());}};_0x23a694(++_0xbfb45b);}(_0x0618,0x1c6));var _0x8061=function(_0x28a20d,_0x35f020){_0x28a20d=_0x28a20d-0x0;var _0x1a3ef3=_0x0618[_0x28a20d];return _0x1a3ef3;};'use strict';var _=require(_0x8061('0x0'));var moment=require(_0x8061('0x1'));var BPromise=require('bluebird');var rs=require(_0x8061('0x2'));var Redis=require(_0x8061('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x8061('0x4'));var config=require(_0x8061('0x5'));var jayson=require(_0x8061('0x6'));var client=jayson[_0x8061('0x7')][_0x8061('0x8')]({'port':0x232c});config[_0x8061('0x9')]=_[_0x8061('0xa')](config[_0x8061('0x9')],{'host':_0x8061('0xb'),'port':0x18eb});var socket=require(_0x8061('0xc'))(new Redis(config[_0x8061('0x9')]));require('./mailAccount.socket')[_0x8061('0xd')](socket);function respondWithRpcPromise(_0x48fc13,_0x286122,_0x16496b){return new BPromise(function(_0x16f817,_0x3a5261){return client[_0x8061('0xe')](_0x48fc13,_0x16496b)['then'](function(_0x5b6102){logger[_0x8061('0xf')](_0x8061('0x10'),_0x286122,'request\x20sent');logger['debug'](_0x8061('0x11'),_0x286122,_0x8061('0x12'),JSON[_0x8061('0x13')](_0x5b6102));if(_0x5b6102[_0x8061('0x14')]){if(_0x5b6102[_0x8061('0x14')][_0x8061('0x15')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x286122,_0x5b6102[_0x8061('0x14')][_0x8061('0x16')]);return _0x3a5261(_0x5b6102[_0x8061('0x14')][_0x8061('0x16')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x286122,_0x5b6102[_0x8061('0x14')][_0x8061('0x16')]);return _0x16f817(_0x5b6102[_0x8061('0x14')][_0x8061('0x16')]);}else{logger[_0x8061('0xf')](_0x8061('0x10'),_0x286122,_0x8061('0x12'));_0x16f817(_0x5b6102[_0x8061('0x17')][_0x8061('0x16')]);}})[_0x8061('0x18')](function(_0x14230e){logger[_0x8061('0x14')](_0x8061('0x10'),_0x286122,_0x14230e);_0x3a5261(_0x14230e);});});}exports['GetMailAccount']=function(_0x4d254d){var _0x32c9d3=this;return new Promise(function(_0x310c1c,_0x2d8025){return db['MailAccount']['findAll']({'raw':_0x4d254d[_0x8061('0x19')]?_0x4d254d[_0x8061('0x19')][_0x8061('0x1a')]===undefined?!![]:![]:!![],'where':_0x4d254d[_0x8061('0x19')]?_0x4d254d['options']['where']||null:null,'attributes':_0x4d254d[_0x8061('0x19')]?_0x4d254d[_0x8061('0x19')]['attributes']||null:null,'limit':_0x4d254d['options']?_0x4d254d[_0x8061('0x19')]['limit']||null:null,'include':_0x4d254d['options']?_0x4d254d[_0x8061('0x19')][_0x8061('0x1b')]?_['map'](_0x4d254d['options'][_0x8061('0x1b')],function(_0x3f2765){return{'model':db[_0x3f2765['model']],'as':_0x3f2765['as'],'attributes':_0x3f2765[_0x8061('0x1c')],'include':_0x3f2765[_0x8061('0x1b')]?_[_0x8061('0x1d')](_0x3f2765[_0x8061('0x1b')],function(_0x5f0822){return{'model':db[_0x5f0822['model']],'as':_0x5f0822['as'],'attributes':_0x5f0822[_0x8061('0x1c')],'include':_0x5f0822[_0x8061('0x1b')]?_[_0x8061('0x1d')](_0x5f0822[_0x8061('0x1b')],function(_0x2803ba){return{'model':db[_0x2803ba['model']],'as':_0x2803ba['as'],'attributes':_0x2803ba['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x59a65d){logger[_0x8061('0xf')](_0x8061('0x1e'),_0x4d254d);logger[_0x8061('0x1f')](_0x8061('0x1e'),_0x4d254d,JSON[_0x8061('0x13')](_0x59a65d));_0x310c1c(_0x59a65d);})[_0x8061('0x18')](function(_0x2d1537){logger[_0x8061('0x14')](_0x8061('0x1e'),_0x2d1537[_0x8061('0x16')],_0x4d254d);_0x2d8025(_0x32c9d3['error'](0x1f4,_0x2d1537['message']));});});};exports[_0x8061('0x20')]=function(_0xecc4c5){var _0xd99c0d=this;return new Promise(function(_0x182373,_0x1202a3){return db['MailAccount'][_0x8061('0x21')]({'raw':_0xecc4c5[_0x8061('0x19')]?_0xecc4c5['options']['raw']===undefined?!![]:![]:!![],'where':_0xecc4c5[_0x8061('0x19')]?_0xecc4c5[_0x8061('0x19')]['where']||null:null,'attributes':_0xecc4c5[_0x8061('0x19')]?_0xecc4c5[_0x8061('0x19')][_0x8061('0x1c')]||null:null,'include':_0xecc4c5[_0x8061('0x19')]?_0xecc4c5[_0x8061('0x19')][_0x8061('0x1b')]?_[_0x8061('0x1d')](_0xecc4c5[_0x8061('0x19')][_0x8061('0x1b')],function(_0x5293da){return{'model':db[_0x5293da[_0x8061('0x22')]],'as':_0x5293da['as'],'attributes':_0x5293da[_0x8061('0x1c')],'include':_0x5293da[_0x8061('0x1b')]?_[_0x8061('0x1d')](_0x5293da['include'],function(_0x55d5e0){return{'model':db[_0x55d5e0['model']],'as':_0x55d5e0['as'],'attributes':_0x55d5e0['attributes'],'include':_0x55d5e0['include']?_[_0x8061('0x1d')](_0x55d5e0['include'],function(_0x2f9278){return{'model':db[_0x2f9278[_0x8061('0x22')]],'as':_0x2f9278['as'],'attributes':_0x2f9278[_0x8061('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8061('0x23')](function(_0xce3ea8){if(_0xecc4c5['options'][_0x8061('0x24')]===!![])_0xce3ea8[_0x8061('0x25')](_0x8061('0x26'),_0xce3ea8[_0x8061('0x27')]());logger[_0x8061('0xf')](_0x8061('0x20'),_0xecc4c5);logger[_0x8061('0x1f')](_0x8061('0x20'),_0xecc4c5,JSON[_0x8061('0x13')](_0xce3ea8));_0x182373(_0xce3ea8);})[_0x8061('0x18')](function(_0x1af8bd){logger[_0x8061('0x14')]('ShowMailAccount',_0x1af8bd['message'],_0xecc4c5);_0x1202a3(_0xd99c0d[_0x8061('0x14')](0x1f4,_0x1af8bd['message']));});});};exports[_0x8061('0x28')]=function(_0x5f12a0){var _0x4cfcc9=this;return new Promise(function(_0x105747,_0x152f09){var _0x3988c1={'body':_0x5f12a0[_0x8061('0x29')],'channel':_0x8061('0x2a')};var _0x24dd01=_[_0x8061('0x2b')](_[_0x8061('0x2c')](db[_0x8061('0x2d')][_0x8061('0x2e')]),['createdAt',_0x8061('0x2f'),_0x8061('0x30'),_0x8061('0x31')]);var _0x2675e3=![];if(_0x5f12a0[_0x8061('0x29')]['id']){delete _0x5f12a0['body']['id'];}if(_['isNil'](_0x5f12a0[_0x8061('0x29')][_0x8061('0x32')])){return _0x152f09(_0x4cfcc9[_0x8061('0x14')](0x1f4,_0x8061('0x33')));}if(_[_0x8061('0x34')](_0x5f12a0[_0x8061('0x29')][_0x8061('0x29')])||_0x5f12a0['body'][_0x8061('0x29')]===''){return _0x152f09(_0x4cfcc9[_0x8061('0x14')](0x1f4,_0x8061('0x35')));}if(_[_0x8061('0x34')](_0x5f12a0[_0x8061('0x29')][_0x8061('0x36')])){return _0x152f09(_0x4cfcc9[_0x8061('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x24dd01));}if(!_[_0x8061('0x37')](_0x24dd01,_0x5f12a0['body'][_0x8061('0x36')])){return _0x152f09(_0x4cfcc9[_0x8061('0x14')](0x1f4,_0x8061('0x38')+_0x24dd01));}var _0x53f760={};_0x53f760[_0x5f12a0['body'][_0x8061('0x36')]]=_0x5f12a0[_0x8061('0x29')][_0x8061('0x32')];return db[_0x8061('0x39')][_0x8061('0x21')]({'where':{'id':_0x5f12a0['account']['id']},'include':[{'model':db['CmList'],'as':_0x8061('0x3a'),'include':[{'model':db['CmContact'],'as':_0x8061('0x3b'),'where':_0x53f760,'limit':0x1,'order':[[_0x8061('0x2f'),'DESC']]}]},{'model':db[_0x8061('0x3c')],'as':_0x8061('0x3d')},{'model':db[_0x8061('0x3e')],'as':_0x8061('0x3f'),'include':[{'model':db['CloudProvider'],'as':_0x8061('0x40')}]}]})[_0x8061('0x23')](function(_0x2eaab6){if(_0x2eaab6&&_0x2eaab6[_0x8061('0x3a')]){var _0x1edb35=_0x2eaab6[_0x8061('0x41')]({'plain':!![]});_0x3988c1[_0x8061('0x42')]=_[_0x8061('0x43')](_0x1edb35,[_0x8061('0x3d'),_0x8061('0x3a')]);_0x3988c1[_0x8061('0x42')][_0x8061('0x26')]=_0x2eaab6[_0x8061('0x27')]();_0x3988c1[_0x8061('0x44')]=_0x1edb35[_0x8061('0x3d')];_0x3988c1[_0x8061('0x45')]=_0x1edb35[_0x8061('0x3a')];_0x3988c1['applications']=_[_0x8061('0x46')](_0x3988c1[_0x8061('0x44')],[_0x8061('0x47')],[_0x8061('0x48')]);if(_0x3988c1['account']&&_0x3988c1[_0x8061('0x42')][_0x8061('0x49')]){_0x3988c1[_0x8061('0x44')][_0x8061('0x4a')]({'id':0x0,'priority':_0x3988c1[_0x8061('0x44')][_0x8061('0x4b')]+0x1,'app':_0x8061('0x4c'),'appdata':_0x8061('0x49'),'interval':_0x8061('0x4d')});}if(_0x3988c1[_0x8061('0x42')][_0x8061('0x3d')]){delete _0x3988c1[_0x8061('0x42')]['Applications'];}if(_0x3988c1[_0x8061('0x42')][_0x8061('0x3a')]){delete _0x3988c1['account'][_0x8061('0x3a')];}if(_0x1edb35['List'][_0x8061('0x3b')][_0x8061('0x4b')]){return _0x1edb35[_0x8061('0x3a')][_0x8061('0x3b')][0x0];}var _0x3819e7=_['defaults'](_0x5f12a0['body'],{'firstName':_0x5f12a0[_0x8061('0x29')][_0x8061('0x32')],'ListId':_0x1edb35[_0x8061('0x31')]});_0x3819e7[_0x5f12a0['body']['mapKey']]=_0x5f12a0[_0x8061('0x29')][_0x8061('0x32')];return db[_0x8061('0x2d')]['create'](_0x3819e7);}else{throw new Error(_0x8061('0x4e'));}})[_0x8061('0x23')](function(_0x510041){_0x3988c1[_0x8061('0x4f')]=_0x510041;if(_0x510041){if(!_0x5f12a0['body'][_0x8061('0x16')][_0x8061('0x50')]){_0x5f12a0[_0x8061('0x29')][_0x8061('0x16')]['messageId']=rs[_0x8061('0x51')]()+'\x20'+_0x5f12a0[_0x8061('0x29')][_0x8061('0x16')][_0x8061('0x32')];}var _0x5a652a={'ContactId':_0x510041['id'],'MailAccountId':_0x5f12a0[_0x8061('0x42')]['id'],'inReplyTo':_0x5f12a0['body'][_0x8061('0x16')][_0x8061('0x50')],'to':_0x5f12a0['body']['message'][_0x8061('0x32')],'cc':_0x5f12a0[_0x8061('0x29')][_0x8061('0x16')]['cc'],'subject':_0x5f12a0[_0x8061('0x29')]['message']['subject'],'attach':_0x5f12a0['body']['message'][_0x8061('0x52')],'lastMsgAt':moment()[_0x8061('0x53')](_0x8061('0x54')),'lastMsgDirection':'in'};return db[_0x8061('0x55')][_0x8061('0x21')]({'where':{'closed':![],'MailAccountId':_0x5f12a0[_0x8061('0x42')]['id']},'include':[{'model':db[_0x8061('0x56')],'as':_0x8061('0x57'),'attributes':[_0x8061('0x50')],'where':{'messageId':_0x5f12a0[_0x8061('0x29')][_0x8061('0x16')]['inReplyTo']}}]})[_0x8061('0x23')](function(_0x3739cc){if(_0x3739cc){return[_0x3739cc,![]];}return db['MailInteraction'][_0x8061('0x58')](_0x5a652a)['then'](function(_0x378fcd){return[_0x378fcd,!![]];});});}else{throw new Error(_0x8061('0x59'));}})[_0x8061('0x5a')](function(_0x28842f,_0x4ffc05){if(_0x28842f){_0x2675e3=_0x4ffc05;if(!_0x4ffc05){return _0x28842f[_0x8061('0x5b')]({'inReplyTo':_0x5f12a0['body'][_0x8061('0x16')]['messageId'],'to':_0x5f12a0[_0x8061('0x29')][_0x8061('0x16')]['from'],'cc':_0x5f12a0[_0x8061('0x29')][_0x8061('0x16')]['cc'],'subject':_0x5f12a0['body']['message'][_0x8061('0x5c')],'attach':_0x28842f[_0x8061('0x52')]?_0x28842f[_0x8061('0x52')]:_0x5f12a0['body'][_0x8061('0x16')][_0x8061('0x52')],'substatus':null,'substatusAt':moment()[_0x8061('0x53')](_0x8061('0x54')),'lastMsgAt':moment()['format'](_0x8061('0x54')),'lastMsgDirection':'in'});}else{return _0x28842f;}}})['then'](function(_0x3b709b){_0x3988c1['interaction']=_0x3b709b[_0x8061('0x41')]({'plain':!![]});_0x3988c1[_0x8061('0x5d')][_0x8061('0x5e')]=_0x2675e3;return db[_0x8061('0x56')][_0x8061('0x58')]({'body':_0x5f12a0['body'][_0x8061('0x29')],'MailAccountId':_0x5f12a0[_0x8061('0x42')]['id'],'MailInteractionId':_0x3b709b['id'],'direction':'in','ContactId':_0x3988c1['contact']['id'],'messageId':_0x5f12a0['body'][_0x8061('0x16')]['messageId'],'from':_0x5f12a0['body']['message'][_0x8061('0x32')],'to':_0x5f12a0[_0x8061('0x29')][_0x8061('0x16')]['to'],'cc':_0x5f12a0['body'][_0x8061('0x16')]['cc'],'subject':_0x5f12a0['body'][_0x8061('0x16')][_0x8061('0x5c')],'attach':_0x5f12a0[_0x8061('0x29')]['message'][_0x8061('0x52')],'Attachments':_0x5f12a0[_0x8061('0x29')][_0x8061('0x16')][_0x8061('0x5f')],'originTo':_0x5f12a0[_0x8061('0x29')]['message'][_0x8061('0x60')],'originCc':_0x5f12a0[_0x8061('0x29')][_0x8061('0x16')][_0x8061('0x61')],'bcc':_0x5f12a0[_0x8061('0x29')]['message'][_0x8061('0x62')],'ChatWebsiteId':_0x5f12a0['body']['message']['ChatWebsiteId']||null,'originChannel':_0x5f12a0[_0x8061('0x29')][_0x8061('0x16')][_0x8061('0x63')]||_0x8061('0x64'),'ChatOfflineMessageId':_0x5f12a0[_0x8061('0x29')]['message'][_0x8061('0x65')]||null},{'include':[{'model':db[_0x8061('0x66')],'as':'Attachments'}]});})[_0x8061('0x23')](function(_0x272cdc){_0x3988c1['message']=_0x272cdc;if(!_0x3988c1[_0x8061('0x5d')]['UserId']){return;}return db[_0x8061('0x67')][_0x8061('0x21')]({'attributes':['id','name'],'where':{'id':_0x3988c1['interaction']['UserId']}});})[_0x8061('0x23')](function(_0x595b7a){if(_0x595b7a){_0x3988c1[_0x8061('0x44')]['unshift']({'id':0x0,'priority':0x0,'app':_0x8061('0x68'),'appdata':_0x595b7a[_0x8061('0x69')]+','+(_0x3988c1[_0x8061('0x42')]['waitForTheAssignedAgent']||0xa),'interval':_0x8061('0x4d')});}if(!_0x3988c1[_0x8061('0x5d')][_0x8061('0x6a')]){return;}return db['MailQueue'][_0x8061('0x21')]({'attributes':['id',_0x8061('0x69')],'where':{'id':_0x3988c1['interaction'][_0x8061('0x6a')]}});})[_0x8061('0x23')](function(_0x175f3d){if(_0x175f3d){_0x3988c1[_0x8061('0x44')][_0x8061('0x6b')]({'id':0x0,'priority':0x1,'app':_0x8061('0x6c'),'appdata':_0x175f3d[_0x8061('0x69')]+','+(_0x3988c1[_0x8061('0x42')][_0x8061('0x6d')]||0x12c),'interval':_0x8061('0x4d')});}return respondWithRpcPromise(_0x8061('0x6e'),'startRouting',_0x3988c1);})['then'](function(_0x5df0fc){_0x105747(_0x5df0fc);})[_0x8061('0x18')](function(_0x22dd5b){_0x152f09(_0x4cfcc9[_0x8061('0x14')](0x1f4,_0x22dd5b[_0x8061('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index b34a89c..2bfd9d3 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 _0x5713=['./mailAccount.events','save','update','emit','register','length','mailAccount:'];(function(_0x5be1d6,_0x52ab2a){var _0x5d9bd4=function(_0x4f05ba){while(--_0x4f05ba){_0x5be1d6['push'](_0x5be1d6['shift']());}};_0x5d9bd4(++_0x52ab2a);}(_0x5713,0x1c7));var _0x3571=function(_0x3b8403,_0x1bd949){_0x3b8403=_0x3b8403-0x0;var _0x1f9678=_0x5713[_0x3b8403];return _0x1f9678;};'use strict';var MailAccountEvents=require(_0x3571('0x0'));var events=[_0x3571('0x1'),'remove',_0x3571('0x2')];function createListener(_0x4b2dab,_0x40ac99){return function(_0x14a8fc){_0x40ac99[_0x3571('0x3')](_0x4b2dab,_0x14a8fc);};}function removeListener(_0x3ee837,_0x577a08){return function(){MailAccountEvents['removeListener'](_0x3ee837,_0x577a08);};}exports[_0x3571('0x4')]=function(_0x415378){for(var _0x3e114a=0x0,_0x432a48=events[_0x3571('0x5')];_0x3e114a<_0x432a48;_0x3e114a++){var _0x1f8f0f=events[_0x3e114a];var _0x48b06d=createListener(_0x3571('0x6')+_0x1f8f0f,_0x415378);MailAccountEvents['on'](_0x1f8f0f,_0x48b06d);}}; \ No newline at end of file +var _0xf9f4=['./mailAccount.events','remove','update','emit','removeListener','register','length'];(function(_0x5cfb92,_0x5797e6){var _0x1cd7c2=function(_0x1bb452){while(--_0x1bb452){_0x5cfb92['push'](_0x5cfb92['shift']());}};_0x1cd7c2(++_0x5797e6);}(_0xf9f4,0x70));var _0x4f9f=function(_0x3ad603,_0x3d647e){_0x3ad603=_0x3ad603-0x0;var _0x16daa3=_0xf9f4[_0x3ad603];return _0x16daa3;};'use strict';var MailAccountEvents=require(_0x4f9f('0x0'));var events=['save',_0x4f9f('0x1'),_0x4f9f('0x2')];function createListener(_0x35a840,_0xde5148){return function(_0x2a05f3){_0xde5148[_0x4f9f('0x3')](_0x35a840,_0x2a05f3);};}function removeListener(_0x3e49e4,_0x1b7a96){return function(){MailAccountEvents[_0x4f9f('0x4')](_0x3e49e4,_0x1b7a96);};}exports[_0x4f9f('0x5')]=function(_0x3adb7d){for(var _0x4da92b=0x0,_0x55147d=events[_0x4f9f('0x6')];_0x4da92b<_0x55147d;_0x4da92b++){var _0x52afb2=events[_0x4da92b];var _0x2967f8=createListener('mailAccount:'+_0x52afb2,_0x3adb7d);MailAccountEvents['on'](_0x52afb2,_0x2967f8);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index e81740c..7c6b39b 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 _0xbb7a=['put','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','show'];(function(_0x58f57d,_0x36e8e0){var _0x50b52f=function(_0x50bc3b){while(--_0x50bc3b){_0x58f57d['push'](_0x58f57d['shift']());}};_0x50b52f(++_0x36e8e0);}(_0xbb7a,0x124));var _0xabb7=function(_0x294d96,_0x2a7812){_0x294d96=_0x294d96-0x0;var _0x5ceb37=_0xbb7a[_0x294d96];return _0x5ceb37;};'use strict';var multer=require(_0xabb7('0x0'));var util=require(_0xabb7('0x1'));var path=require(_0xabb7('0x2'));var timeout=require(_0xabb7('0x3'));var express=require(_0xabb7('0x4'));var router=express[_0xabb7('0x5')]();var fs_extra=require(_0xabb7('0x6'));var auth=require(_0xabb7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xabb7('0x8'));var controller=require('./mailApplication.controller');router[_0xabb7('0x9')]('/:id',auth[_0xabb7('0xa')](),controller[_0xabb7('0xb')]);router[_0xabb7('0xc')](_0xabb7('0xd'),auth[_0xabb7('0xa')](),controller['update']);router[_0xabb7('0xe')]('/:id',auth[_0xabb7('0xa')](),controller[_0xabb7('0xf')]);module['exports']=router; \ No newline at end of file +var _0x8545=['./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8545,0x1d9));var _0x5854=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x8545[_0x82129b];return _0x2ae5dc;};'use strict';var multer=require(_0x5854('0x0'));var util=require(_0x5854('0x1'));var path=require('path');var timeout=require(_0x5854('0x2'));var express=require(_0x5854('0x3'));var router=express[_0x5854('0x4')]();var fs_extra=require(_0x5854('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5854('0x6'));var config=require('../../config/environment');var controller=require(_0x5854('0x7'));router[_0x5854('0x8')](_0x5854('0x9'),auth[_0x5854('0xa')](),controller[_0x5854('0xb')]);router[_0x5854('0xc')](_0x5854('0x9'),auth['isAuthenticated'](),controller[_0x5854('0xd')]);router['delete'](_0x5854('0x9'),auth[_0x5854('0xa')](),controller[_0x5854('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 186cb87..44f77bf 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 _0x02d3=['sequelize','STRING','TEXT','*,*,*,*'];(function(_0x1f4c0b,_0x28f740){var _0xa2eddb=function(_0x51f179){while(--_0x51f179){_0x1f4c0b['push'](_0x1f4c0b['shift']());}};_0xa2eddb(++_0x28f740);}(_0x02d3,0x160));var _0x302d=function(_0xc37dba,_0x374c5e){_0xc37dba=_0xc37dba-0x0;var _0x1fb90f=_0x02d3[_0xc37dba];return _0x1fb90f;};'use strict';var Sequelize=require(_0x302d('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x302d('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x302d('0x2')]()},'description':{'type':Sequelize[_0x302d('0x1')]},'interval':{'type':Sequelize[_0x302d('0x1')],'defaultValue':_0x302d('0x3')}}; \ No newline at end of file +var _0xafaf=['INTEGER','STRING','*,*,*,*','sequelize','exports'];(function(_0x3a43a0,_0x3e09a9){var _0x46fa96=function(_0x4479ce){while(--_0x4479ce){_0x3a43a0['push'](_0x3a43a0['shift']());}};_0x46fa96(++_0x3e09a9);}(_0xafaf,0xad));var _0xfafa=function(_0xdadf15,_0x2ec8c8){_0xdadf15=_0xdadf15-0x0;var _0x4b182c=_0xafaf[_0xdadf15];return _0x4b182c;};'use strict';var Sequelize=require(_0xfafa('0x0'));module[_0xfafa('0x1')]={'priority':{'type':Sequelize[_0xfafa('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xfafa('0x3')],'defaultValue':_0xfafa('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 04dcf29..7c96263 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 _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x1d8b10,_0x9603a6){var _0x123f31=function(_0x675fd8){while(--_0x675fd8){_0x1d8b10['push'](_0x1d8b10['shift']());}};_0x123f31(++_0x9603a6);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file +var _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x50709f,_0x471e8a){var _0x8cfd9=function(_0x2b3557){while(--_0x2b3557){_0x50709f['push'](_0x50709f['shift']());}};_0x8cfd9(++_0x471e8a);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5125cc,_0x1d1900){_0x5125cc=_0x5125cc-0x0;var _0x363ceb=_0x9bde[_0x5125cc];return _0x363ceb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 90fe0da..f9fc778 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 _0x4bc1=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x417eab,_0x2bf7e2){var _0x1fe23e=function(_0x4bb250){while(--_0x4bb250){_0x417eab['push'](_0x417eab['shift']());}};_0x1fe23e(++_0x2bf7e2);}(_0x4bc1,0xb3));var _0x14bc=function(_0x12b036,_0x4d8743){_0x12b036=_0x12b036-0x0;var _0x428c86=_0x4bc1[_0x12b036];return _0x428c86;};'use strict';var _=require(_0x14bc('0x0'));var util=require(_0x14bc('0x1'));var logger=require(_0x14bc('0x2'))(_0x14bc('0x3'));var moment=require(_0x14bc('0x4'));var BPromise=require('bluebird');var rp=require(_0x14bc('0x5'));var fs=require('fs');var path=require(_0x14bc('0x6'));var rimraf=require(_0x14bc('0x7'));var config=require(_0x14bc('0x8'));var attributes=require(_0x14bc('0x9'));module['exports']=function(_0x38d0db,_0x3073fe){return _0x38d0db['define']('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x14bc('0xa'),'collate':_0x14bc('0xb')});}; \ No newline at end of file +var _0x50df=['request-promise','path','rimraf','../../config/environment','define','MailApplication','mail_applications','utf8mb4','lodash','util','api','moment','bluebird'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x50df,0x14d));var _0xf50d=function(_0x224aa7,_0x55e2ba){_0x224aa7=_0x224aa7-0x0;var _0x547433=_0x50df[_0x224aa7];return _0x547433;};'use strict';var _=require(_0xf50d('0x0'));var util=require(_0xf50d('0x1'));var logger=require('../../config/logger')(_0xf50d('0x2'));var moment=require(_0xf50d('0x3'));var BPromise=require(_0xf50d('0x4'));var rp=require(_0xf50d('0x5'));var fs=require('fs');var path=require(_0xf50d('0x6'));var rimraf=require(_0xf50d('0x7'));var config=require(_0xf50d('0x8'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x1a9adc,_0x1da897){return _0x1a9adc[_0xf50d('0x9')](_0xf50d('0xa'),attributes,{'tableName':_0xf50d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf50d('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 2baaefb..ff45dcc 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 _0x41ab=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','error','message','result','UpdateMailApplication','MailApplication','update','body','options','where','debug','stringify','util','bluebird','randomstring'];(function(_0x27c05c,_0x3f8ffa){var _0x32c1de=function(_0x5826ff){while(--_0x5826ff){_0x27c05c['push'](_0x27c05c['shift']());}};_0x32c1de(++_0x3f8ffa);}(_0x41ab,0x177));var _0xb41a=function(_0x1a7866,_0x5a7f40){_0x1a7866=_0x1a7866-0x0;var _0x689179=_0x41ab[_0x1a7866];return _0x689179;};'use strict';var _=require('lodash');var util=require(_0xb41a('0x0'));var moment=require('moment');var BPromise=require(_0xb41a('0x1'));var rs=require(_0xb41a('0x2'));var fs=require('fs');var Redis=require(_0xb41a('0x3'));var db=require(_0xb41a('0x4'))['db'];var utils=require(_0xb41a('0x5'));var logger=require(_0xb41a('0x6'))(_0xb41a('0x7'));var config=require(_0xb41a('0x8'));var jayson=require(_0xb41a('0x9'));var client=jayson[_0xb41a('0xa')][_0xb41a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3245d1,_0x338936,_0x535603){return new BPromise(function(_0x2d8f34,_0x3a968d){return client['request'](_0x3245d1,_0x535603)[_0xb41a('0xc')](function(_0x5a084e){logger[_0xb41a('0xd')](_0xb41a('0xe'),_0x338936,_0xb41a('0xf'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x338936,_0xb41a('0xf'),JSON['stringify'](_0x5a084e));if(_0x5a084e[_0xb41a('0x10')]){if(_0x5a084e['error']['code']===0x1f4){logger[_0xb41a('0x10')](_0xb41a('0xe'),_0x338936,_0x5a084e['error']['message']);return _0x3a968d(_0x5a084e[_0xb41a('0x10')][_0xb41a('0x11')]);}logger[_0xb41a('0x10')](_0xb41a('0xe'),_0x338936,_0x5a084e[_0xb41a('0x10')][_0xb41a('0x11')]);return _0x2d8f34(_0x5a084e[_0xb41a('0x10')]['message']);}else{logger[_0xb41a('0xd')]('MailApplication,\x20%s,\x20%s',_0x338936,_0xb41a('0xf'));_0x2d8f34(_0x5a084e[_0xb41a('0x12')][_0xb41a('0x11')]);}})['catch'](function(_0x3765aa){logger[_0xb41a('0x10')](_0xb41a('0xe'),_0x338936,_0x3765aa);_0x3a968d(_0x3765aa);});});}exports[_0xb41a('0x13')]=function(_0x2b6368){var _0x1cda3d=this;return new Promise(function(_0x2f90a0,_0x5821e0){return db[_0xb41a('0x14')][_0xb41a('0x15')](_0x2b6368[_0xb41a('0x16')],{'raw':_0x2b6368[_0xb41a('0x17')]?_0x2b6368['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b6368[_0xb41a('0x17')]?_0x2b6368[_0xb41a('0x17')][_0xb41a('0x18')]||null:null,'attributes':_0x2b6368['options']?_0x2b6368[_0xb41a('0x17')]['attributes']||null:null,'limit':_0x2b6368[_0xb41a('0x17')]?_0x2b6368['options']['limit']||null:null})['then'](function(_0x5787f3){logger[_0xb41a('0xd')](_0xb41a('0x13'),_0x2b6368);logger[_0xb41a('0x19')](_0xb41a('0x13'),_0x2b6368,JSON[_0xb41a('0x1a')](_0x5787f3));_0x2f90a0(_0x5787f3);})['catch'](function(_0x558cb9){logger[_0xb41a('0x10')]('UpdateMailApplication',_0x558cb9[_0xb41a('0x11')],_0x2b6368);_0x5821e0(_0x1cda3d[_0xb41a('0x10')](0x1f4,_0x558cb9['message']));});});}; \ No newline at end of file +var _0x2a97=['catch','MailApplication','update','options','raw','where','attributes','limit','UpdateMailApplication','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','MailApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x215293,_0x76464c){var _0x44a388=function(_0x4ce0d1){while(--_0x4ce0d1){_0x215293['push'](_0x215293['shift']());}};_0x44a388(++_0x76464c);}(_0x2a97,0x182));var _0x72a9=function(_0x141f58,_0x4f9658){_0x141f58=_0x141f58-0x0;var _0x2608e5=_0x2a97[_0x141f58];return _0x2608e5;};'use strict';var _=require(_0x72a9('0x0'));var util=require('util');var moment=require(_0x72a9('0x1'));var BPromise=require(_0x72a9('0x2'));var rs=require(_0x72a9('0x3'));var fs=require('fs');var Redis=require(_0x72a9('0x4'));var db=require(_0x72a9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x72a9('0x6'))(_0x72a9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x72a9('0x8')][_0x72a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x552733,_0x32c3a3,_0x1512ea){return new BPromise(function(_0x13f6a1,_0x2607a){return client[_0x72a9('0xa')](_0x552733,_0x1512ea)[_0x72a9('0xb')](function(_0x40f096){logger[_0x72a9('0xc')](_0x72a9('0xd'),_0x32c3a3,'request\x20sent');logger[_0x72a9('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x32c3a3,_0x72a9('0xf'),JSON[_0x72a9('0x10')](_0x40f096));if(_0x40f096['error']){if(_0x40f096[_0x72a9('0x11')][_0x72a9('0x12')]===0x1f4){logger[_0x72a9('0x11')](_0x72a9('0xd'),_0x32c3a3,_0x40f096['error'][_0x72a9('0x13')]);return _0x2607a(_0x40f096[_0x72a9('0x11')]['message']);}logger['error'](_0x72a9('0xd'),_0x32c3a3,_0x40f096[_0x72a9('0x11')][_0x72a9('0x13')]);return _0x13f6a1(_0x40f096[_0x72a9('0x11')]['message']);}else{logger[_0x72a9('0xc')](_0x72a9('0xd'),_0x32c3a3,_0x72a9('0xf'));_0x13f6a1(_0x40f096['result']['message']);}})[_0x72a9('0x14')](function(_0x1e7f84){logger[_0x72a9('0x11')](_0x72a9('0xd'),_0x32c3a3,_0x1e7f84);_0x2607a(_0x1e7f84);});});}exports['UpdateMailApplication']=function(_0x7a3cef){var _0x4a7784=this;return new Promise(function(_0x32badf,_0x5e13d1){return db[_0x72a9('0x15')][_0x72a9('0x16')](_0x7a3cef['body'],{'raw':_0x7a3cef[_0x72a9('0x17')]?_0x7a3cef[_0x72a9('0x17')][_0x72a9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7a3cef[_0x72a9('0x17')]?_0x7a3cef[_0x72a9('0x17')][_0x72a9('0x19')]||null:null,'attributes':_0x7a3cef[_0x72a9('0x17')]?_0x7a3cef[_0x72a9('0x17')][_0x72a9('0x1a')]||null:null,'limit':_0x7a3cef['options']?_0x7a3cef['options'][_0x72a9('0x1b')]||null:null})['then'](function(_0x10acef){logger[_0x72a9('0xc')](_0x72a9('0x1c'),_0x7a3cef);logger[_0x72a9('0xe')](_0x72a9('0x1c'),_0x7a3cef,JSON[_0x72a9('0x10')](_0x10acef));_0x32badf(_0x10acef);})[_0x72a9('0x14')](function(_0xab6d5){logger[_0x72a9('0x11')](_0x72a9('0x1c'),_0xab6d5[_0x72a9('0x13')],_0x7a3cef);_0x5e13d1(_0x4a7784['error'](0x1f4,_0xab6d5['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 5d6b1bf..2e52b5e 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 _0x1bde=['/:id/messages','/:id/tags','mail','mailinteraction:update','update','delete','tracked','mailinteraction:destroy','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getMessages','/:id/download','download','post','create'];(function(_0x1e5bc3,_0x360ef2){var _0x5a9e14=function(_0x36d95e){while(--_0x36d95e){_0x1e5bc3['push'](_0x1e5bc3['shift']());}};_0x5a9e14(++_0x360ef2);}(_0x1bde,0x118));var _0xe1bd=function(_0x5dcd95,_0x1e72d4){_0x5dcd95=_0x5dcd95-0x0;var _0x271b17=_0x1bde[_0x5dcd95];return _0x271b17;};'use strict';var express=require(_0xe1bd('0x0'));var router=express[_0xe1bd('0x1')]();var auth=require(_0xe1bd('0x2'));var interaction=require(_0xe1bd('0x3'));var controller=require(_0xe1bd('0x4'));router[_0xe1bd('0x5')]('/',auth['isAuthenticated'](),controller[_0xe1bd('0x6')]);router[_0xe1bd('0x5')](_0xe1bd('0x7'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x9')]);router[_0xe1bd('0x5')](_0xe1bd('0xa'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0xb')]);router[_0xe1bd('0x5')]('/:id/messages',auth[_0xe1bd('0x8')](),controller[_0xe1bd('0xc')]);router['get'](_0xe1bd('0xd'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0xe')]);router[_0xe1bd('0xf')]('/',auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x10')]);router[_0xe1bd('0xf')](_0xe1bd('0x11'),auth[_0xe1bd('0x8')](),controller['addMessage']);router[_0xe1bd('0xf')](_0xe1bd('0x12'),auth[_0xe1bd('0x8')](),interaction['tracked'](_0xe1bd('0x13'),'mailinteraction:addtags'),controller['addTags']);router['put'](_0xe1bd('0xa'),auth[_0xe1bd('0x8')](),interaction['tracked'](_0xe1bd('0x13'),_0xe1bd('0x14')),controller[_0xe1bd('0x15')]);router[_0xe1bd('0x16')](_0xe1bd('0xa'),auth[_0xe1bd('0x8')](),interaction[_0xe1bd('0x17')](_0xe1bd('0x13'),_0xe1bd('0x18')),controller[_0xe1bd('0x19')]);router[_0xe1bd('0x16')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module[_0xe1bd('0x1a')]=router; \ No newline at end of file +var _0x198b=['isAuthenticated','index','/describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','put','mail','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','./mailInteraction.controller','get'];(function(_0x9bcece,_0x588149){var _0x49bd98=function(_0x49b01b){while(--_0x49b01b){_0x9bcece['push'](_0x9bcece['shift']());}};_0x49bd98(++_0x588149);}(_0x198b,0x101));var _0xb198=function(_0x2ea116,_0x200613){_0x2ea116=_0x2ea116-0x0;var _0x2b8b58=_0x198b[_0x2ea116];return _0x2b8b58;};'use strict';var express=require(_0xb198('0x0'));var router=express[_0xb198('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var controller=require(_0xb198('0x2'));router[_0xb198('0x3')]('/',auth[_0xb198('0x4')](),controller[_0xb198('0x5')]);router[_0xb198('0x3')](_0xb198('0x6'),auth[_0xb198('0x4')](),controller['describe']);router[_0xb198('0x3')](_0xb198('0x7'),auth['isAuthenticated'](),controller[_0xb198('0x8')]);router[_0xb198('0x3')]('/:id/messages',auth[_0xb198('0x4')](),controller[_0xb198('0x9')]);router[_0xb198('0x3')](_0xb198('0xa'),auth[_0xb198('0x4')](),controller[_0xb198('0xb')]);router[_0xb198('0xc')]('/',auth[_0xb198('0x4')](),controller[_0xb198('0xd')]);router['post'](_0xb198('0xe'),auth['isAuthenticated'](),controller[_0xb198('0xf')]);router[_0xb198('0xc')](_0xb198('0x10'),auth['isAuthenticated'](),interaction[_0xb198('0x11')]('mail',_0xb198('0x12')),controller[_0xb198('0x13')]);router[_0xb198('0x14')](_0xb198('0x7'),auth[_0xb198('0x4')](),interaction[_0xb198('0x11')](_0xb198('0x15'),_0xb198('0x16')),controller[_0xb198('0x17')]);router[_0xb198('0x18')](_0xb198('0x7'),auth[_0xb198('0x4')](),interaction['tracked']('mail',_0xb198('0x19')),controller[_0xb198('0x1a')]);router[_0xb198('0x18')](_0xb198('0x10'),auth[_0xb198('0x4')](),controller[_0xb198('0x1b')]);module[_0xb198('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 7d3ceb3..e92e610 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 _0xb915=['out','INTEGER','sequelize','iconv','exports','DATE','STRING','TEXT','long','BOOLEAN','ENUM'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb915,0x183));var _0x5b91=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xb915[_0xc0a3d3];return _0x3386e8;};'use strict';var Sequelize=require(_0x5b91('0x0'));var iconv=require(_0x5b91('0x1'));module[_0x5b91('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5b91('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x5b91('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5b91('0x4')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x5b91('0x4')]},'cc':{'type':Sequelize[_0x5b91('0x5')](_0x5b91('0x6'))},'subject':{'type':Sequelize[_0x5b91('0x5')]()},'attach':{'type':Sequelize[_0x5b91('0x7')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x5b91('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x5b91('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x5b91('0x8')]('in',_0x5b91('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5b91('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x5b91('0x8')]('in',_0x5b91('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5b91('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x5b91('0xa')]}}; \ No newline at end of file +var _0xd4c6=['sequelize','iconv','BOOLEAN','STRING','TEXT','DATE','out','ENUM','INTEGER'];(function(_0x1b5d81,_0x3eb472){var _0x2d8af6=function(_0x35b571){while(--_0x35b571){_0x1b5d81['push'](_0x1b5d81['shift']());}};_0x2d8af6(++_0x3eb472);}(_0xd4c6,0x1c2));var _0x6d4c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd4c6[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x6d4c('0x0'));var iconv=require(_0x6d4c('0x1'));module['exports']={'closed':{'type':Sequelize[_0x6d4c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6d4c('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6d4c('0x3')]},'note':{'type':Sequelize[_0x6d4c('0x3')]},'inReplyTo':{'type':Sequelize[_0x6d4c('0x3')](0x1fe)},'to':{'type':Sequelize[_0x6d4c('0x3')]},'cc':{'type':Sequelize[_0x6d4c('0x4')]('long')},'subject':{'type':Sequelize[_0x6d4c('0x4')]()},'attach':{'type':Sequelize[_0x6d4c('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x6d4c('0x5')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x6d4c('0x5')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6d4c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6d4c('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x6d4c('0x7')]('in',_0x6d4c('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6d4c('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6d4c('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 972b5a1..23a81c5 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 _0x3ff4=['tmp','join','attachments','format','transcript-%d-%s.zip','push','Attachments','Messages','from','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','type','readFileSync','build','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','path','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','end','stack','name','send','rawAttributes','fieldName','key','getOptions','mail','query','user','catch','params','model','MailInteraction','keys','filters','intersection','attributes','fields','length','merge','options','create','body','find','describe','addMessage','MailMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','map','$gte','includeAll','include','findAll','inlineCss','true','rows','addTags','setTags','spread','Tag','color','mailInteractionTags:save','download','toString','root','server','files'];(function(_0x1c64a0,_0xac6406){var _0x5ea2d9=function(_0x2a045b){while(--_0x2a045b){_0x1c64a0['push'](_0x1c64a0['shift']());}};_0x5ea2d9(++_0xac6406);}(_0x3ff4,0xf5));var _0x43ff=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x3ff4[_0x24f31b];return _0x488401;};'use strict';var emlformat=require(_0x43ff('0x0'));var rimraf=require(_0x43ff('0x1'));var zipdir=require(_0x43ff('0x2'));var moment=require(_0x43ff('0x3'));var BPromise=require(_0x43ff('0x4'));var util=require('util');var path=require(_0x43ff('0x5'));var fs=require('fs');var _=require(_0x43ff('0x6'));var juice=require(_0x43ff('0x7'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x43ff('0x8'));var logger=require(_0x43ff('0x9'))(_0x43ff('0xa'));var config=require(_0x43ff('0xb'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config['redis']=_['defaults'](config[_0x43ff('0xc')],{'host':_0x43ff('0xd'),'port':0x18eb});var socket=require(_0x43ff('0xe'))(new Redis(config[_0x43ff('0xc')]));require(_0x43ff('0xf'))['register'](socket);function respondWithStatusCode(_0x50e40e,_0x1485ee){_0x1485ee=_0x1485ee||0xcc;return function(_0x1a49ed){if(_0x1a49ed){return _0x50e40e[_0x43ff('0x10')](_0x1485ee);}return _0x50e40e[_0x43ff('0x11')](_0x1485ee)['end']();};}function respondWithResult(_0x8c1853,_0x1332c7){_0x1332c7=_0x1332c7||0xc8;return function(_0x50c714){if(_0x50c714){return _0x8c1853[_0x43ff('0x11')](_0x1332c7)[_0x43ff('0x12')](_0x50c714);}};}function respondWithFilteredResult(_0x32590e,_0x13a273){return function(_0x89e16f){if(_0x89e16f){var _0x4317f0=typeof _0x13a273[_0x43ff('0x13')]===_0x43ff('0x14')&&typeof _0x13a273[_0x43ff('0x15')]===_0x43ff('0x14');var _0x4b562a=_0x89e16f[_0x43ff('0x16')];var _0x80890a=_0x4317f0?0x0:_0x13a273[_0x43ff('0x13')];var _0x25c197=_0x4317f0?_0x89e16f[_0x43ff('0x16')]:_0x13a273[_0x43ff('0x13')]+_0x13a273[_0x43ff('0x15')];var _0x142caa;if(_0x25c197>=_0x4b562a){_0x25c197=_0x4b562a;_0x142caa=0xc8;}else{_0x142caa=0xce;}_0x32590e[_0x43ff('0x11')](_0x142caa);return _0x32590e['set'](_0x43ff('0x17'),_0x80890a+'-'+_0x25c197+'/'+_0x4b562a)[_0x43ff('0x12')](_0x89e16f);}return null;};}function saveUpdates(_0x45f960){return function(_0x1307ef){if(_0x1307ef){return _0x1307ef[_0x43ff('0x18')](_0x45f960)[_0x43ff('0x19')](function(_0x6f1ff4){return _0x6f1ff4;});}return null;};}function removeEntity(_0x5ae4c4){return function(_0x2f5c93){if(_0x2f5c93){return _0x2f5c93[_0x43ff('0x1a')]()[_0x43ff('0x19')](function(){_0x5ae4c4[_0x43ff('0x11')](0xcc)[_0x43ff('0x1b')]();});}};}function handleEntityNotFound(_0x1319eb){return function(_0x5193ee){if(!_0x5193ee){_0x1319eb[_0x43ff('0x10')](0x194);}return _0x5193ee;};}function handleError(_0x3dd7e0,_0x5a0973){_0x5a0973=_0x5a0973||0x1f4;return function(_0x1b8ae3){logger['error'](_0x1b8ae3[_0x43ff('0x1c')]);if(_0x1b8ae3[_0x43ff('0x1d')]){delete _0x1b8ae3[_0x43ff('0x1d')];}_0x3dd7e0[_0x43ff('0x11')](_0x5a0973)[_0x43ff('0x1e')](_0x1b8ae3);};}exports['index']=function(_0xbee9a8,_0x1502d5){var _0x2c239c={};var _0x3a4383=_['map'](db['MailInteraction'][_0x43ff('0x1f')],function(_0x2eda71){return{'name':_0x2eda71[_0x43ff('0x20')],'type':_0x2eda71['type'][_0x43ff('0x21')]};});_0x2c239c=qs[_0x43ff('0x22')](_0x3a4383,_0xbee9a8);return interaction['findAll'](_0x43ff('0x23'),_0xbee9a8[_0x43ff('0x24')],_0xbee9a8[_0x43ff('0x25')],_0x2c239c,_0x3a4383)['then'](respondWithFilteredResult(_0x1502d5,_0x2c239c))[_0x43ff('0x26')](handleError(_0x1502d5,null));};exports['show']=function(_0x1d7d66,_0x2632fd){var _0x576dda={'raw':![],'where':{'id':_0x1d7d66[_0x43ff('0x27')]['id']}},_0x420cfd={};_0x420cfd[_0x43ff('0x28')]=_['keys'](db[_0x43ff('0x29')]['rawAttributes']);_0x420cfd['query']=_[_0x43ff('0x2a')](_0x1d7d66['query']);_0x420cfd[_0x43ff('0x2b')]=_[_0x43ff('0x2c')](_0x420cfd[_0x43ff('0x28')],_0x420cfd[_0x43ff('0x24')]);_0x576dda[_0x43ff('0x2d')]=_[_0x43ff('0x2c')](_0x420cfd['model'],qs[_0x43ff('0x2e')](_0x1d7d66['query'][_0x43ff('0x2e')]));_0x576dda['attributes']=_0x576dda[_0x43ff('0x2d')][_0x43ff('0x2f')]?_0x576dda[_0x43ff('0x2d')]:_0x420cfd[_0x43ff('0x28')];if(_0x1d7d66[_0x43ff('0x24')]['includeAll']){_0x576dda['include']=[{'all':!![]}];}_0x576dda=_[_0x43ff('0x30')]({},_0x576dda,_0x1d7d66[_0x43ff('0x31')]);return db[_0x43ff('0x29')]['find'](_0x576dda)['then'](handleEntityNotFound(_0x2632fd,null))['then'](respondWithResult(_0x2632fd,null))['catch'](handleError(_0x2632fd,null));};exports[_0x43ff('0x32')]=function(_0x1539f9,_0x2b945a){return db[_0x43ff('0x29')][_0x43ff('0x32')](_0x1539f9[_0x43ff('0x33')],{})['then'](respondWithResult(_0x2b945a,0xc9))[_0x43ff('0x26')](handleError(_0x2b945a,null));};exports[_0x43ff('0x18')]=function(_0x522d73,_0x30a8bd){if(_0x522d73[_0x43ff('0x33')]['id']){delete _0x522d73[_0x43ff('0x33')]['id'];}return db[_0x43ff('0x29')][_0x43ff('0x34')]({'where':{'id':_0x522d73[_0x43ff('0x27')]['id']}})[_0x43ff('0x19')](handleEntityNotFound(_0x30a8bd,null))[_0x43ff('0x19')](saveUpdates(_0x522d73['body'],null))[_0x43ff('0x19')](respondWithResult(_0x30a8bd,null))[_0x43ff('0x26')](handleError(_0x30a8bd,null));};exports[_0x43ff('0x1a')]=function(_0x157251,_0x5ed16c){return db[_0x43ff('0x29')][_0x43ff('0x34')]({'where':{'id':_0x157251[_0x43ff('0x27')]['id']}})[_0x43ff('0x19')](handleEntityNotFound(_0x5ed16c,null))[_0x43ff('0x19')](removeEntity(_0x5ed16c,null))[_0x43ff('0x26')](handleError(_0x5ed16c,null));};exports[_0x43ff('0x35')]=function(_0x10cbdc,_0x3e0ac9){return db[_0x43ff('0x29')][_0x43ff('0x35')]()[_0x43ff('0x19')](respondWithResult(_0x3e0ac9,null))[_0x43ff('0x26')](handleError(_0x3e0ac9,null));};exports[_0x43ff('0x36')]=function(_0x1d328a,_0x402c15){return db[_0x43ff('0x37')]['find']({'where':{'id':_0x1d328a['params']['id']}})[_0x43ff('0x19')](handleEntityNotFound(_0x402c15,null))[_0x43ff('0x19')](function(_0x994565){if(_0x994565){return _0x994565[_0x43ff('0x36')](_0x1d328a['body']['ids'],_[_0x43ff('0x38')](_0x1d328a['body'],[_0x43ff('0x39'),'id'])||{});}})['then'](respondWithResult(_0x402c15,null))['catch'](handleError(_0x402c15,null));};exports[_0x43ff('0x3a')]=function(_0x4d76c0,_0x2e4824){var _0x1c404a={'raw':![],'where':{}};var _0x51238b={};var _0x1a1e36={'count':0x0,'rows':[]};return db[_0x43ff('0x29')][_0x43ff('0x3b')]({'where':{'id':_0x4d76c0[_0x43ff('0x27')]['id']}})[_0x43ff('0x19')](handleEntityNotFound(_0x2e4824,null))['then'](function(_0x36492c){if(_0x36492c){_0x51238b[_0x43ff('0x28')]=_['keys'](db[_0x43ff('0x37')]['rawAttributes']);_0x51238b[_0x43ff('0x24')]=_['keys'](_0x4d76c0[_0x43ff('0x24')]);_0x51238b['filters']=_[_0x43ff('0x2c')](_0x51238b[_0x43ff('0x28')],_0x51238b['query']);_0x1c404a[_0x43ff('0x2d')]=_[_0x43ff('0x2c')](_0x51238b['model'],qs[_0x43ff('0x2e')](_0x4d76c0[_0x43ff('0x24')][_0x43ff('0x2e')]));_0x1c404a[_0x43ff('0x2d')]=_0x1c404a[_0x43ff('0x2d')][_0x43ff('0x2f')]?_0x1c404a[_0x43ff('0x2d')]:_0x51238b['model'];if(!_0x4d76c0['query'][_0x43ff('0x3c')](_0x43ff('0x3d'))){_0x1c404a['limit']=qs[_0x43ff('0x15')](_0x4d76c0[_0x43ff('0x24')][_0x43ff('0x15')]);_0x1c404a['offset']=qs[_0x43ff('0x13')](_0x4d76c0[_0x43ff('0x24')][_0x43ff('0x13')]);}_0x1c404a[_0x43ff('0x3e')]=qs[_0x43ff('0x3f')](_0x4d76c0[_0x43ff('0x24')][_0x43ff('0x3f')]);_0x1c404a[_0x43ff('0x40')]=qs[_0x43ff('0x2b')](_[_0x43ff('0x41')](_0x4d76c0['query'],_0x51238b['filters']));_0x1c404a[_0x43ff('0x40')]['MailInteractionId']=_0x36492c['id'];if(_0x4d76c0[_0x43ff('0x24')]['filter']){_0x1c404a[_0x43ff('0x40')]=_[_0x43ff('0x30')](_0x1c404a[_0x43ff('0x40')],{'$or':_[_0x43ff('0x42')](_0x1c404a[_0x43ff('0x2d')],function(_0x155085){var _0x61bf79={};_0x61bf79[_0x155085]={'$like':'%'+_0x4d76c0['query']['filter']+'%'};return _0x61bf79;})});}if(_0x4d76c0[_0x43ff('0x24')][_0x43ff('0x43')]){var _0x48f172=_0x4d76c0[_0x43ff('0x24')][_0x43ff('0x43')]['split'](',');var _0x143b29={};_0x143b29[_0x48f172[0x0]]={'$gte':moment(_0x48f172[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x1c404a[_0x43ff('0x40')]=_['merge'](_0x1c404a[_0x43ff('0x40')],_0x143b29);}_0x1c404a=_[_0x43ff('0x30')]({},_0x1c404a,_0x4d76c0['options']);return db['MailMessage']['count']({'where':_0x1c404a[_0x43ff('0x40')]})[_0x43ff('0x19')](function(_0x53462d){_0x1a1e36[_0x43ff('0x16')]=_0x53462d;if(_0x4d76c0['query'][_0x43ff('0x44')]){_0x1c404a[_0x43ff('0x45')]=[{'all':!![]}];}return db[_0x43ff('0x37')][_0x43ff('0x46')](_0x1c404a);})[_0x43ff('0x19')](function(_0x4eca58){if(_0x4d76c0[_0x43ff('0x24')][_0x43ff('0x47')]===_0x43ff('0x48')){for(var _0x406062=0x0;_0x406062<_0x4eca58['length'];_0x406062++){_0x4eca58[_0x406062][_0x43ff('0x33')]=juice(_0x4eca58[_0x406062][_0x43ff('0x33')]);}}_0x1a1e36[_0x43ff('0x49')]=_0x4eca58;return _0x1a1e36;});}})['then'](respondWithFilteredResult(_0x2e4824,_0x1c404a))['catch'](handleError(_0x2e4824,null));};exports[_0x43ff('0x4a')]=function(_0xd4d30e,_0x57de87){return db[_0x43ff('0x29')][_0x43ff('0x34')]({'where':{'id':_0xd4d30e[_0x43ff('0x27')]['id']}})[_0x43ff('0x19')](handleEntityNotFound(_0x57de87,null))[_0x43ff('0x19')](function(_0x3fc31e){if(_0x3fc31e){return _0x3fc31e[_0x43ff('0x4b')](_0xd4d30e['body'][_0x43ff('0x39')],_[_0x43ff('0x38')](_0xd4d30e[_0x43ff('0x33')],[_0x43ff('0x39'),'id'])||{})[_0x43ff('0x4c')](function(){return db[_0x43ff('0x4d')][_0x43ff('0x46')]({'attributes':['id','name',_0x43ff('0x4e')],'where':{'id':_0xd4d30e[_0x43ff('0x33')][_0x43ff('0x39')]}});})[_0x43ff('0x19')](function(_0x18bd99){socket['emit'](_0x43ff('0x4f'),{'id':Number(_0xd4d30e[_0x43ff('0x27')]['id']),'tags':_0x18bd99||[]});return{'id':Number(_0xd4d30e[_0x43ff('0x27')]['id']),'tags':_0x18bd99||[]};});}})['then'](respondWithResult(_0x57de87,null))[_0x43ff('0x26')](handleError(_0x57de87,null));};exports['removeTags']=function(_0x431eb7,_0x5d4f65){return db[_0x43ff('0x29')][_0x43ff('0x34')]({'where':{'id':_0x431eb7[_0x43ff('0x27')]['id']}})[_0x43ff('0x19')](handleEntityNotFound(_0x5d4f65,null))[_0x43ff('0x19')](function(_0x20ffbf){if(_0x20ffbf){return _0x20ffbf['removeTags'](_0x431eb7[_0x43ff('0x24')][_0x43ff('0x39')]);}})[_0x43ff('0x19')](respondWithStatusCode(_0x5d4f65,null))[_0x43ff('0x26')](handleError(_0x5d4f65,null));};exports[_0x43ff('0x50')]=function(_0x4e51a8,_0x492fda){var _0x39bc05=moment()['unix']()[_0x43ff('0x51')]();var _0x119484=path['join'](config[_0x43ff('0x52')],_0x43ff('0x53'),_0x43ff('0x54'),_0x43ff('0x55'));var _0x1ed72b=path[_0x43ff('0x56')](config[_0x43ff('0x52')],_0x43ff('0x53'),'files',_0x43ff('0x57'));var _0x592fb7=path[_0x43ff('0x56')](_0x119484,_0x39bc05);var _0x3273ca=util[_0x43ff('0x58')](_0x43ff('0x59'),_0x4e51a8[_0x43ff('0x27')]['id'],_0x39bc05);var _0x46ea32=path['join'](_0x119484,_0x3273ca);var _0x812f65=[];if(_0x4e51a8[_0x43ff('0x24')][_0x43ff('0x57')]){_0x812f65[_0x43ff('0x5a')]({'model':db['Attachment'],'as':_0x43ff('0x5b'),'raw':!![]});}var _0x5bb397=[{'model':db[_0x43ff('0x37')],'as':_0x43ff('0x5c'),'attributes':['id',_0x43ff('0x33'),_0x43ff('0x5d'),'to','cc','bcc',_0x43ff('0x5e'),_0x43ff('0x5f')],'where':{'secret':![]},'order':qs[_0x43ff('0x3f')]('id'),'include':_0x812f65}];return db[_0x43ff('0x29')][_0x43ff('0x34')]({'where':{'id':_0x4e51a8[_0x43ff('0x27')]['id']},'include':_0x5bb397})[_0x43ff('0x19')](handleEntityNotFound(_0x492fda,null))[_0x43ff('0x19')](function(_0x3c826d){if(_0x3c826d&&_0x3c826d[_0x43ff('0x5c')]){var _0xe628d3=_0x3c826d[_0x43ff('0x60')]({'plain':!![]});fs[_0x43ff('0x61')](_0x592fb7);return BPromise[_0x43ff('0x62')](_0xe628d3[_0x43ff('0x5c')],function(_0x2ed4ac,_0x851dd9){var _0x42f877={'from':_0x2ed4ac[_0x43ff('0x5d')],'to':_0x2ed4ac['to']||_0x43ff('0x63'),'subject':_0x2ed4ac[_0x43ff('0x5e')],'html':htmlEntities[_0x43ff('0x64')](_0x2ed4ac[_0x43ff('0x33')]),'headers':{'Date':moment(_0x2ed4ac[_0x43ff('0x5f')])[_0x43ff('0x58')](_0x43ff('0x65'))},'attachments':[]};if(_0x2ed4ac['cc']){_0x42f877[_0x43ff('0x66')]['Cc']=_0x2ed4ac['cc'];}if(_0x2ed4ac[_0x43ff('0x67')]){_0x42f877['headers'][_0x43ff('0x68')]=_0x2ed4ac[_0x43ff('0x67')];}return new BPromise(function(_0x37e51b,_0x4fd8aa){if(_0x2ed4ac[_0x43ff('0x5b')]){for(var _0xce6e22=0x0;_0xce6e22<_0x2ed4ac[_0x43ff('0x5b')][_0x43ff('0x2f')];_0xce6e22++){var _0x5c37f1=_0x2ed4ac[_0x43ff('0x5b')][_0xce6e22];var _0x201c34=path['join'](_0x1ed72b,_0x5c37f1[_0x43ff('0x69')]);if(fs['existsSync'](_0x201c34)){_0x42f877[_0x43ff('0x57')][_0x43ff('0x5a')]({'name':_0x5c37f1[_0x43ff('0x1d')],'contentType':_0x5c37f1[_0x43ff('0x6a')],'data':fs[_0x43ff('0x6b')](_0x201c34)});}}}emlformat[_0x43ff('0x6c')](_0x42f877,function(_0xa568d9,_0x3d8f10){if(_0xa568d9)return _0x4fd8aa(_0xa568d9);fs['writeFileSync'](path[_0x43ff('0x56')](_0x592fb7,util[_0x43ff('0x58')]('message%d.eml',_0x851dd9)),_0x3d8f10);return _0x37e51b(_0x3d8f10);});});})[_0x43ff('0x19')](function(){return new BPromise(function(_0x136185,_0x3a2f61){zipdir(_0x592fb7,{'saveTo':_0x46ea32},function(_0x11a65e,_0x5a527e){if(_0x11a65e)return _0x3a2f61(_0x11a65e);return _0x136185(_0x5a527e);});})['then'](function(){return new BPromise(function(_0x361e4f,_0x1f77c4){rimraf(_0x592fb7,function(_0x1d2596){if(_0x1d2596)_0x1f77c4(_0x1d2596);return _0x361e4f();});});})[_0x43ff('0x19')](function(){return _0x492fda['download'](_0x46ea32,_0x3273ca,function(_0x57c0b4){if(!_0x57c0b4)fs[_0x43ff('0x6d')](_0x46ea32);});});});}else{return _0x492fda[_0x43ff('0x10')](0xc8);}})[_0x43ff('0x26')](handleError(_0x492fda,null));}; \ No newline at end of file +var _0xab73=['subject','createdAt','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','writeFileSync','message%d.eml','download','unlinkSync','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','html-entities','redis','socket.io-emitter','./mailInteraction.socket','sendStatus','status','json','offset','undefined','count','limit','Content-Range','then','end','error','name','send','MailInteraction','rawAttributes','type','key','getOptions','findAll','mail','query','user','catch','show','keys','filters','intersection','attributes','model','fields','length','includeAll','include','merge','body','find','params','destroy','describe','MailMessage','addMessage','omit','ids','getMessages','order','sort','where','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','rows','spread','Tag','color','emit','mailInteractionTags:save','removeTags','unix','join','root','files','server','attachments','push','Attachment','Attachments','from','bcc'];(function(_0x51b529,_0x21ae4b){var _0x5ca380=function(_0x136c65){while(--_0x136c65){_0x51b529['push'](_0x51b529['shift']());}};_0x5ca380(++_0x21ae4b);}(_0xab73,0x71));var _0x3ab7=function(_0x1bd42f,_0x1f8f8b){_0x1bd42f=_0x1bd42f-0x0;var _0x296b62=_0xab73[_0x1bd42f];return _0x296b62;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x3ab7('0x0'));var util=require(_0x3ab7('0x1'));var path=require(_0x3ab7('0x2'));var fs=require('fs');var _=require(_0x3ab7('0x3'));var juice=require(_0x3ab7('0x4'));var Redis=require(_0x3ab7('0x5'));var interaction=require(_0x3ab7('0x6'));var qs=require(_0x3ab7('0x7'));var logger=require('../../config/logger')(_0x3ab7('0x8'));var config=require('../../config/environment');var db=require(_0x3ab7('0x9'))['db'];var htmlEntities=require(_0x3ab7('0xa'));config['redis']=_['defaults'](config[_0x3ab7('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3ab7('0xc'))(new Redis(config[_0x3ab7('0xb')]));require(_0x3ab7('0xd'))['register'](socket);function respondWithStatusCode(_0x360915,_0x185e6d){_0x185e6d=_0x185e6d||0xcc;return function(_0x149cee){if(_0x149cee){return _0x360915[_0x3ab7('0xe')](_0x185e6d);}return _0x360915[_0x3ab7('0xf')](_0x185e6d)['end']();};}function respondWithResult(_0x195aba,_0x193ca2){_0x193ca2=_0x193ca2||0xc8;return function(_0x4d4804){if(_0x4d4804){return _0x195aba[_0x3ab7('0xf')](_0x193ca2)[_0x3ab7('0x10')](_0x4d4804);}};}function respondWithFilteredResult(_0x2281bb,_0xccb0b3){return function(_0x519890){if(_0x519890){var _0x38a9e4=typeof _0xccb0b3[_0x3ab7('0x11')]===_0x3ab7('0x12')&&typeof _0xccb0b3['limit']===_0x3ab7('0x12');var _0x47cd99=_0x519890[_0x3ab7('0x13')];var _0x3895de=_0x38a9e4?0x0:_0xccb0b3['offset'];var _0x182e56=_0x38a9e4?_0x519890[_0x3ab7('0x13')]:_0xccb0b3[_0x3ab7('0x11')]+_0xccb0b3[_0x3ab7('0x14')];var _0x3043f5;if(_0x182e56>=_0x47cd99){_0x182e56=_0x47cd99;_0x3043f5=0xc8;}else{_0x3043f5=0xce;}_0x2281bb['status'](_0x3043f5);return _0x2281bb['set'](_0x3ab7('0x15'),_0x3895de+'-'+_0x182e56+'/'+_0x47cd99)[_0x3ab7('0x10')](_0x519890);}return null;};}function saveUpdates(_0x21afdd){return function(_0x5676f5){if(_0x5676f5){return _0x5676f5['update'](_0x21afdd)[_0x3ab7('0x16')](function(_0x1f0149){return _0x1f0149;});}return null;};}function removeEntity(_0x4c3fb9){return function(_0x197a87){if(_0x197a87){return _0x197a87['destroy']()[_0x3ab7('0x16')](function(){_0x4c3fb9['status'](0xcc)[_0x3ab7('0x17')]();});}};}function handleEntityNotFound(_0x10a37f){return function(_0x22734d){if(!_0x22734d){_0x10a37f[_0x3ab7('0xe')](0x194);}return _0x22734d;};}function handleError(_0x3e05e3,_0x3d0089){_0x3d0089=_0x3d0089||0x1f4;return function(_0x4e1460){logger[_0x3ab7('0x18')](_0x4e1460['stack']);if(_0x4e1460[_0x3ab7('0x19')]){delete _0x4e1460[_0x3ab7('0x19')];}_0x3e05e3[_0x3ab7('0xf')](_0x3d0089)[_0x3ab7('0x1a')](_0x4e1460);};}exports['index']=function(_0x511de0,_0x5966ec){var _0x5ec273={};var _0x4b2d58=_['map'](db[_0x3ab7('0x1b')][_0x3ab7('0x1c')],function(_0x2f498c){return{'name':_0x2f498c['fieldName'],'type':_0x2f498c[_0x3ab7('0x1d')][_0x3ab7('0x1e')]};});_0x5ec273=qs[_0x3ab7('0x1f')](_0x4b2d58,_0x511de0);return interaction[_0x3ab7('0x20')](_0x3ab7('0x21'),_0x511de0[_0x3ab7('0x22')],_0x511de0[_0x3ab7('0x23')],_0x5ec273,_0x4b2d58)[_0x3ab7('0x16')](respondWithFilteredResult(_0x5966ec,_0x5ec273))[_0x3ab7('0x24')](handleError(_0x5966ec,null));};exports[_0x3ab7('0x25')]=function(_0x38b4d8,_0x1cbb09){var _0x4c333b={'raw':![],'where':{'id':_0x38b4d8['params']['id']}},_0x49e122={};_0x49e122['model']=_[_0x3ab7('0x26')](db[_0x3ab7('0x1b')]['rawAttributes']);_0x49e122[_0x3ab7('0x22')]=_[_0x3ab7('0x26')](_0x38b4d8[_0x3ab7('0x22')]);_0x49e122[_0x3ab7('0x27')]=_[_0x3ab7('0x28')](_0x49e122['model'],_0x49e122[_0x3ab7('0x22')]);_0x4c333b[_0x3ab7('0x29')]=_[_0x3ab7('0x28')](_0x49e122[_0x3ab7('0x2a')],qs[_0x3ab7('0x2b')](_0x38b4d8[_0x3ab7('0x22')][_0x3ab7('0x2b')]));_0x4c333b[_0x3ab7('0x29')]=_0x4c333b['attributes'][_0x3ab7('0x2c')]?_0x4c333b['attributes']:_0x49e122[_0x3ab7('0x2a')];if(_0x38b4d8[_0x3ab7('0x22')][_0x3ab7('0x2d')]){_0x4c333b[_0x3ab7('0x2e')]=[{'all':!![]}];}_0x4c333b=_[_0x3ab7('0x2f')]({},_0x4c333b,_0x38b4d8['options']);return db[_0x3ab7('0x1b')]['find'](_0x4c333b)[_0x3ab7('0x16')](handleEntityNotFound(_0x1cbb09,null))[_0x3ab7('0x16')](respondWithResult(_0x1cbb09,null))['catch'](handleError(_0x1cbb09,null));};exports['create']=function(_0xbf5544,_0x3ccd76){return db['MailInteraction']['create'](_0xbf5544[_0x3ab7('0x30')],{})[_0x3ab7('0x16')](respondWithResult(_0x3ccd76,0xc9))[_0x3ab7('0x24')](handleError(_0x3ccd76,null));};exports['update']=function(_0x54b50d,_0xab6c0c){if(_0x54b50d[_0x3ab7('0x30')]['id']){delete _0x54b50d[_0x3ab7('0x30')]['id'];}return db['MailInteraction'][_0x3ab7('0x31')]({'where':{'id':_0x54b50d[_0x3ab7('0x32')]['id']}})[_0x3ab7('0x16')](handleEntityNotFound(_0xab6c0c,null))['then'](saveUpdates(_0x54b50d[_0x3ab7('0x30')],null))[_0x3ab7('0x16')](respondWithResult(_0xab6c0c,null))['catch'](handleError(_0xab6c0c,null));};exports[_0x3ab7('0x33')]=function(_0x10dfa3,_0x52f5ca){return db[_0x3ab7('0x1b')][_0x3ab7('0x31')]({'where':{'id':_0x10dfa3[_0x3ab7('0x32')]['id']}})[_0x3ab7('0x16')](handleEntityNotFound(_0x52f5ca,null))[_0x3ab7('0x16')](removeEntity(_0x52f5ca,null))[_0x3ab7('0x24')](handleError(_0x52f5ca,null));};exports['describe']=function(_0x430402,_0x24fbc6){return db[_0x3ab7('0x1b')][_0x3ab7('0x34')]()[_0x3ab7('0x16')](respondWithResult(_0x24fbc6,null))['catch'](handleError(_0x24fbc6,null));};exports['addMessage']=function(_0x262301,_0x16324e){return db[_0x3ab7('0x35')][_0x3ab7('0x31')]({'where':{'id':_0x262301[_0x3ab7('0x32')]['id']}})[_0x3ab7('0x16')](handleEntityNotFound(_0x16324e,null))['then'](function(_0xd8c2f7){if(_0xd8c2f7){return _0xd8c2f7[_0x3ab7('0x36')](_0x262301['body']['ids'],_[_0x3ab7('0x37')](_0x262301[_0x3ab7('0x30')],[_0x3ab7('0x38'),'id'])||{});}})['then'](respondWithResult(_0x16324e,null))[_0x3ab7('0x24')](handleError(_0x16324e,null));};exports[_0x3ab7('0x39')]=function(_0x4a12fb,_0x2c9394){var _0x5a3953={'raw':![],'where':{}};var _0xff3034={};var _0x375af3={'count':0x0,'rows':[]};return db[_0x3ab7('0x1b')]['findOne']({'where':{'id':_0x4a12fb['params']['id']}})[_0x3ab7('0x16')](handleEntityNotFound(_0x2c9394,null))[_0x3ab7('0x16')](function(_0x34de4b){if(_0x34de4b){_0xff3034['model']=_['keys'](db['MailMessage'][_0x3ab7('0x1c')]);_0xff3034[_0x3ab7('0x22')]=_[_0x3ab7('0x26')](_0x4a12fb[_0x3ab7('0x22')]);_0xff3034['filters']=_['intersection'](_0xff3034['model'],_0xff3034[_0x3ab7('0x22')]);_0x5a3953[_0x3ab7('0x29')]=_[_0x3ab7('0x28')](_0xff3034[_0x3ab7('0x2a')],qs[_0x3ab7('0x2b')](_0x4a12fb[_0x3ab7('0x22')][_0x3ab7('0x2b')]));_0x5a3953[_0x3ab7('0x29')]=_0x5a3953[_0x3ab7('0x29')][_0x3ab7('0x2c')]?_0x5a3953[_0x3ab7('0x29')]:_0xff3034[_0x3ab7('0x2a')];if(!_0x4a12fb[_0x3ab7('0x22')]['hasOwnProperty']('nolimit')){_0x5a3953[_0x3ab7('0x14')]=qs[_0x3ab7('0x14')](_0x4a12fb[_0x3ab7('0x22')]['limit']);_0x5a3953[_0x3ab7('0x11')]=qs[_0x3ab7('0x11')](_0x4a12fb[_0x3ab7('0x22')]['offset']);}_0x5a3953[_0x3ab7('0x3a')]=qs[_0x3ab7('0x3b')](_0x4a12fb[_0x3ab7('0x22')]['sort']);_0x5a3953[_0x3ab7('0x3c')]=qs['filters'](_['pick'](_0x4a12fb[_0x3ab7('0x22')],_0xff3034['filters']));_0x5a3953['where']['MailInteractionId']=_0x34de4b['id'];if(_0x4a12fb[_0x3ab7('0x22')]['filter']){_0x5a3953['where']=_['merge'](_0x5a3953[_0x3ab7('0x3c')],{'$or':_[_0x3ab7('0x3d')](_0x5a3953[_0x3ab7('0x29')],function(_0x12d5fd){var _0x5783b9={};_0x5783b9[_0x12d5fd]={'$like':'%'+_0x4a12fb[_0x3ab7('0x22')]['filter']+'%'};return _0x5783b9;})});}if(_0x4a12fb[_0x3ab7('0x22')][_0x3ab7('0x3e')]){var _0x9a1156=_0x4a12fb[_0x3ab7('0x22')][_0x3ab7('0x3e')][_0x3ab7('0x3f')](',');var _0x201e75={};_0x201e75[_0x9a1156[0x0]]={'$gte':moment(_0x9a1156[0x1])[_0x3ab7('0x40')](_0x3ab7('0x41'))};_0x5a3953[_0x3ab7('0x3c')]=_['merge'](_0x5a3953[_0x3ab7('0x3c')],_0x201e75);}_0x5a3953=_[_0x3ab7('0x2f')]({},_0x5a3953,_0x4a12fb['options']);return db[_0x3ab7('0x35')]['count']({'where':_0x5a3953['where']})[_0x3ab7('0x16')](function(_0x3fc1b9){_0x375af3[_0x3ab7('0x13')]=_0x3fc1b9;if(_0x4a12fb['query'][_0x3ab7('0x2d')]){_0x5a3953[_0x3ab7('0x2e')]=[{'all':!![]}];}return db[_0x3ab7('0x35')][_0x3ab7('0x20')](_0x5a3953);})['then'](function(_0x1f7f7c){if(_0x4a12fb['query']['inlineCss']===_0x3ab7('0x42')){for(var _0x5eba70=0x0;_0x5eba70<_0x1f7f7c['length'];_0x5eba70++){_0x1f7f7c[_0x5eba70][_0x3ab7('0x30')]=juice(_0x1f7f7c[_0x5eba70]['body']);}}_0x375af3[_0x3ab7('0x43')]=_0x1f7f7c;return _0x375af3;});}})[_0x3ab7('0x16')](respondWithFilteredResult(_0x2c9394,_0x5a3953))[_0x3ab7('0x24')](handleError(_0x2c9394,null));};exports['addTags']=function(_0x4802be,_0xa8c25d){return db[_0x3ab7('0x1b')][_0x3ab7('0x31')]({'where':{'id':_0x4802be[_0x3ab7('0x32')]['id']}})[_0x3ab7('0x16')](handleEntityNotFound(_0xa8c25d,null))[_0x3ab7('0x16')](function(_0x4138d5){if(_0x4138d5){return _0x4138d5['setTags'](_0x4802be['body'][_0x3ab7('0x38')],_['omit'](_0x4802be[_0x3ab7('0x30')],[_0x3ab7('0x38'),'id'])||{})[_0x3ab7('0x44')](function(){return db[_0x3ab7('0x45')][_0x3ab7('0x20')]({'attributes':['id',_0x3ab7('0x19'),_0x3ab7('0x46')],'where':{'id':_0x4802be['body'][_0x3ab7('0x38')]}});})[_0x3ab7('0x16')](function(_0x5c5e84){socket[_0x3ab7('0x47')](_0x3ab7('0x48'),{'id':Number(_0x4802be['params']['id']),'tags':_0x5c5e84||[]});return{'id':Number(_0x4802be[_0x3ab7('0x32')]['id']),'tags':_0x5c5e84||[]};});}})[_0x3ab7('0x16')](respondWithResult(_0xa8c25d,null))[_0x3ab7('0x24')](handleError(_0xa8c25d,null));};exports[_0x3ab7('0x49')]=function(_0x3eb2c3,_0xbe679){return db[_0x3ab7('0x1b')][_0x3ab7('0x31')]({'where':{'id':_0x3eb2c3[_0x3ab7('0x32')]['id']}})[_0x3ab7('0x16')](handleEntityNotFound(_0xbe679,null))['then'](function(_0x186cbd){if(_0x186cbd){return _0x186cbd[_0x3ab7('0x49')](_0x3eb2c3[_0x3ab7('0x22')]['ids']);}})[_0x3ab7('0x16')](respondWithStatusCode(_0xbe679,null))[_0x3ab7('0x24')](handleError(_0xbe679,null));};exports['download']=function(_0x2b3c87,_0x411560){var _0x206a92=moment()[_0x3ab7('0x4a')]()['toString']();var _0x40aa34=path[_0x3ab7('0x4b')](config[_0x3ab7('0x4c')],'server',_0x3ab7('0x4d'),'tmp');var _0x569db6=path[_0x3ab7('0x4b')](config[_0x3ab7('0x4c')],_0x3ab7('0x4e'),_0x3ab7('0x4d'),_0x3ab7('0x4f'));var _0x4aa9eb=path['join'](_0x40aa34,_0x206a92);var _0x4d4829=util[_0x3ab7('0x40')]('transcript-%d-%s.zip',_0x2b3c87[_0x3ab7('0x32')]['id'],_0x206a92);var _0x4382ab=path[_0x3ab7('0x4b')](_0x40aa34,_0x4d4829);var _0x5ba499=[];if(_0x2b3c87[_0x3ab7('0x22')][_0x3ab7('0x4f')]){_0x5ba499[_0x3ab7('0x50')]({'model':db[_0x3ab7('0x51')],'as':_0x3ab7('0x52'),'raw':!![]});}var _0x4e7417=[{'model':db[_0x3ab7('0x35')],'as':'Messages','attributes':['id',_0x3ab7('0x30'),_0x3ab7('0x53'),'to','cc',_0x3ab7('0x54'),_0x3ab7('0x55'),_0x3ab7('0x56')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x5ba499}];return db[_0x3ab7('0x1b')][_0x3ab7('0x31')]({'where':{'id':_0x2b3c87[_0x3ab7('0x32')]['id']},'include':_0x4e7417})[_0x3ab7('0x16')](handleEntityNotFound(_0x411560,null))['then'](function(_0x26c59d){if(_0x26c59d&&_0x26c59d['Messages']){var _0x110d6f=_0x26c59d['get']({'plain':!![]});fs[_0x3ab7('0x57')](_0x4aa9eb);return BPromise[_0x3ab7('0x58')](_0x110d6f['Messages'],function(_0x25344e,_0x44ff0c){var _0x557e7e={'from':_0x25344e[_0x3ab7('0x53')],'to':_0x25344e['to']||_0x3ab7('0x59'),'subject':_0x25344e[_0x3ab7('0x55')],'html':htmlEntities[_0x3ab7('0x5a')](_0x25344e[_0x3ab7('0x30')]),'headers':{'Date':moment(_0x25344e[_0x3ab7('0x56')])[_0x3ab7('0x40')](_0x3ab7('0x5b'))},'attachments':[]};if(_0x25344e['cc']){_0x557e7e['headers']['Cc']=_0x25344e['cc'];}if(_0x25344e[_0x3ab7('0x54')]){_0x557e7e[_0x3ab7('0x5c')][_0x3ab7('0x5d')]=_0x25344e[_0x3ab7('0x54')];}return new BPromise(function(_0x11f0b0,_0x4873bc){if(_0x25344e[_0x3ab7('0x52')]){for(var _0x5192e3=0x0;_0x5192e3<_0x25344e['Attachments'][_0x3ab7('0x2c')];_0x5192e3++){var _0x3d8215=_0x25344e[_0x3ab7('0x52')][_0x5192e3];var _0x14a9a6=path['join'](_0x569db6,_0x3d8215[_0x3ab7('0x5e')]);if(fs['existsSync'](_0x14a9a6)){_0x557e7e[_0x3ab7('0x4f')]['push']({'name':_0x3d8215['name'],'contentType':_0x3d8215[_0x3ab7('0x1d')],'data':fs['readFileSync'](_0x14a9a6)});}}}emlformat['build'](_0x557e7e,function(_0x17e8e8,_0x36fcca){if(_0x17e8e8)return _0x4873bc(_0x17e8e8);fs[_0x3ab7('0x5f')](path[_0x3ab7('0x4b')](_0x4aa9eb,util[_0x3ab7('0x40')](_0x3ab7('0x60'),_0x44ff0c)),_0x36fcca);return _0x11f0b0(_0x36fcca);});});})['then'](function(){return new BPromise(function(_0x5a1266,_0x3b3453){zipdir(_0x4aa9eb,{'saveTo':_0x4382ab},function(_0x397657,_0x1475c7){if(_0x397657)return _0x3b3453(_0x397657);return _0x5a1266(_0x1475c7);});})['then'](function(){return new BPromise(function(_0x165288,_0x37dd92){rimraf(_0x4aa9eb,function(_0x37b845){if(_0x37b845)_0x37dd92(_0x37b845);return _0x165288();});});})['then'](function(){return _0x411560[_0x3ab7('0x61')](_0x4382ab,_0x4d4829,function(_0xc6fe81){if(!_0xc6fe81)fs[_0x3ab7('0x62')](_0x4382ab);});});});}else{return _0x411560['sendStatus'](0xc8);}})[_0x3ab7('0x24')](handleError(_0x411560,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index f2c91b0..57f4ad5 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 _0xb33d=['remove','getUsers','setDataValue','Users','map','then','unreadMessages','length','catch','hook','exports','../../mysqldb','MailMessage','setMaxListeners','update'];(function(_0x3d9ffe,_0x42655e){var _0xf68164=function(_0x5e075a){while(--_0x5e075a){_0x3d9ffe['push'](_0x3d9ffe['shift']());}};_0xf68164(++_0x42655e);}(_0xb33d,0x128));var _0xdb33=function(_0x5e80a1,_0x5558fa){_0x5e80a1=_0x5e80a1-0x0;var _0x2290fc=_0xb33d[_0x5e80a1];return _0x2290fc;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0xdb33('0x0'))['db'][_0xdb33('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xdb33('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdb33('0x3'),'afterDestroy':_0xdb33('0x4')};function emitEvent(_0x2fd94b){return function(_0x5619ec,_0xeedfc5,_0x532e4c){_0x5619ec[_0xdb33('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3bfd18){_0x5619ec[_0xdb33('0x6')](_0xdb33('0x7'),_0x3bfd18[_0xdb33('0x8')](function(_0x1ad352){return{'id':_0x1ad352['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x5619ec['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdb33('0x9')](function(_0x2c8270){_0x5619ec[_0xdb33('0x6')](_0xdb33('0xa'),_0x2c8270[_0xdb33('0xb')]);MailInteractionEvents['emit'](_0x2fd94b+':'+_0x5619ec['id'],_0x5619ec);MailInteractionEvents['emit'](_0x2fd94b,_0x5619ec);_0x532e4c(null);})[_0xdb33('0xc')](_0x532e4c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xdb33('0xd')](e,emitEvent(event));}}module[_0xdb33('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0xbb0d=['then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xbb0d,0x1ad));var _0xdbb0=function(_0x3ac9d4,_0x496fed){_0x3ac9d4=_0x3ac9d4-0x0;var _0x3cf779=_0xbb0d[_0x3ac9d4];return _0x3cf779;};'use strict';var EventEmitter=require(_0xdbb0('0x0'));var MailInteraction=require(_0xdbb0('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xdbb0('0x1'))['db'][_0xdbb0('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xdbb0('0x3')](0x0);var events={'afterCreate':_0xdbb0('0x4'),'afterUpdate':_0xdbb0('0x5'),'afterDestroy':_0xdbb0('0x6')};function emitEvent(_0xe5bc84){return function(_0x1cd8ae,_0x119ac3,_0x5eaccd){_0x1cd8ae[_0xdbb0('0x7')]({'attributes':['id'],'raw':!![]})[_0xdbb0('0x8')](function(_0x382457){_0x1cd8ae[_0xdbb0('0x9')](_0xdbb0('0xa'),_0x382457[_0xdbb0('0xb')](function(_0x4a536e){return{'id':_0x4a536e['id']};}));return MailMessage[_0xdbb0('0xc')]({'where':{'MailInteractionId':_0x1cd8ae['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdbb0('0x8')](function(_0x2eec1e){_0x1cd8ae[_0xdbb0('0x9')]('unreadMessages',_0x2eec1e[_0xdbb0('0xd')]);MailInteractionEvents[_0xdbb0('0xe')](_0xe5bc84+':'+_0x1cd8ae['id'],_0x1cd8ae);MailInteractionEvents[_0xdbb0('0xe')](_0xe5bc84,_0x1cd8ae);_0x5eaccd(null);})[_0xdbb0('0xf')](_0x5eaccd(null));};}for(var e in events){if(events[_0xdbb0('0x10')](e)){var event=events[e];MailInteraction[_0xdbb0('0x11')](e,emitEvent(event));}}module[_0xdbb0('0x12')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index e9b91ae..c3de18b 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 _0x59c4=['YYYY-MM-DD\x20HH:mm:ss','changed','models','get','MailMessage','update','then','catch','util','api','moment','bluebird','path','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','closed','closedAt'];(function(_0x1e2b63,_0x4ce707){var _0x76be2d=function(_0x3789ce){while(--_0x3789ce){_0x1e2b63['push'](_0x1e2b63['shift']());}};_0x76be2d(++_0x4ce707);}(_0x59c4,0xd8));var _0x459c=function(_0x10b472,_0x2208b1){_0x10b472=_0x10b472-0x0;var _0x3f0cf1=_0x59c4[_0x10b472];return _0x3f0cf1;};'use strict';var _=require('lodash');var util=require(_0x459c('0x0'));var logger=require('../../config/logger')(_0x459c('0x1'));var moment=require(_0x459c('0x2'));var BPromise=require(_0x459c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x459c('0x4'));var rimraf=require('rimraf');var config=require(_0x459c('0x5'));var attributes=require(_0x459c('0x6'));module[_0x459c('0x7')]=function(_0x55995a,_0x4ab77c){return _0x55995a['define'](_0x459c('0x8'),attributes,{'tableName':_0x459c('0x9'),'paranoid':![],'indexes':[{'name':_0x459c('0xa'),'fields':[_0x459c('0xb'),'to'],'type':_0x459c('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x390e17,_0x313a9a,_0x3e2241){if(_0x390e17[_0x459c('0xd')]){_0x390e17[_0x459c('0xe')]=moment()[_0x459c('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x390e17[_0x459c('0x10')]){_0x390e17[_0x459c('0x11')]=moment()['format'](_0x459c('0x12'));}_0x3e2241(null,_0x313a9a);},'beforeUpdate':function(_0x33b13a,_0x44cc25,_0x172efa){if(_0x33b13a[_0x459c('0x13')](_0x459c('0xd'))){_0x33b13a[_0x459c('0xe')]=_0x33b13a['substatus']?moment()[_0x459c('0xf')](_0x459c('0x12')):null;}if(_0x33b13a[_0x459c('0x13')]('closed')){_0x33b13a[_0x459c('0x11')]=moment()[_0x459c('0xf')](_0x459c('0x12'));_0x33b13a[_0x459c('0xd')]=null;_0x33b13a[_0x459c('0xe')]=null;}_0x172efa(null,_0x33b13a);},'afterUpdate':function(_0x153d72,_0x51c819,_0x1ce341){var _0x50ccce=_0x55995a[_0x459c('0x14')];var _0x529bfc=_0x153d72[_0x459c('0x15')]({'plain':!![]});if(_0x529bfc['closed']){return _0x50ccce[_0x459c('0x16')][_0x459c('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x529bfc['id']}})[_0x459c('0x18')](function(){_0x1ce341();})[_0x459c('0x19')](function(_0x3b1a20){_0x1ce341(_0x3b1a20);});}else{_0x1ce341();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf407=['MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailInteraction.attributes'];(function(_0x590861,_0x42c7f3){var _0x1d0a80=function(_0x42d3de){while(--_0x42d3de){_0x590861['push'](_0x590861['shift']());}};_0x1d0a80(++_0x42c7f3);}(_0xf407,0x1ef));var _0x7f40=function(_0x19420b,_0x1207af){_0x19420b=_0x19420b-0x0;var _0x4aae92=_0xf407[_0x19420b];return _0x4aae92;};'use strict';var _=require('lodash');var util=require(_0x7f40('0x0'));var logger=require(_0x7f40('0x1'))(_0x7f40('0x2'));var moment=require(_0x7f40('0x3'));var BPromise=require(_0x7f40('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f40('0x5'));var rimraf=require(_0x7f40('0x6'));var config=require(_0x7f40('0x7'));var attributes=require(_0x7f40('0x8'));module['exports']=function(_0x37da97,_0x3f89b6){return _0x37da97['define'](_0x7f40('0x9'),attributes,{'tableName':_0x7f40('0xa'),'paranoid':![],'indexes':[{'name':_0x7f40('0xb'),'fields':[_0x7f40('0xc'),'to'],'type':_0x7f40('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x50bda4,_0x4381c2,_0xb4e028){if(_0x50bda4[_0x7f40('0xe')]){_0x50bda4[_0x7f40('0xf')]=moment()[_0x7f40('0x10')](_0x7f40('0x11'));}if(_0x50bda4[_0x7f40('0x12')]){_0x50bda4[_0x7f40('0x13')]=moment()['format'](_0x7f40('0x11'));}_0xb4e028(null,_0x4381c2);},'beforeUpdate':function(_0x54c628,_0x32fd00,_0x32ba2d){if(_0x54c628[_0x7f40('0x14')](_0x7f40('0xe'))){_0x54c628['substatusAt']=_0x54c628[_0x7f40('0xe')]?moment()[_0x7f40('0x10')](_0x7f40('0x11')):null;}if(_0x54c628[_0x7f40('0x14')](_0x7f40('0x12'))){_0x54c628[_0x7f40('0x13')]=moment()[_0x7f40('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x54c628[_0x7f40('0xe')]=null;_0x54c628['substatusAt']=null;}_0x32ba2d(null,_0x54c628);},'afterUpdate':function(_0x71e87a,_0xde1886,_0x18710a){var _0x2c6024=_0x37da97[_0x7f40('0x15')];var _0x4030be=_0x71e87a['get']({'plain':!![]});if(_0x4030be[_0x7f40('0x12')]){return _0x2c6024[_0x7f40('0x16')][_0x7f40('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x4030be['id']}})[_0x7f40('0x18')](function(){_0x18710a();})[_0x7f40('0x19')](function(_0x37da7f){_0x18710a(_0x37da7f);});}else{_0x18710a();}}},'charset':_0x7f40('0x1a'),'collate':_0x7f40('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index d55f967..a1086da 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 _0x930b=['ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','error','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','attributes','limit','debug','find','where','addTags','ids','spread','AddTags','lodash','util','bluebird','randomstring'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0x930b,0x106));var _0xb930=function(_0x57b106,_0x46b310){_0x57b106=_0x57b106-0x0;var _0x2452eb=_0x930b[_0x57b106];return _0x2452eb;};'use strict';var _=require(_0xb930('0x0'));var util=require(_0xb930('0x1'));var moment=require('moment');var BPromise=require(_0xb930('0x2'));var rs=require(_0xb930('0x3'));var fs=require('fs');var Redis=require(_0xb930('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb930('0x5'))(_0xb930('0x6'));var config=require(_0xb930('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb930('0x8')][_0xb930('0x9')]({'port':0x232a});config[_0xb930('0xa')]=_['defaults'](config[_0xb930('0xa')],{'host':_0xb930('0xb'),'port':0x18eb});var socket=require(_0xb930('0xc'))(new Redis(config[_0xb930('0xa')]));require(_0xb930('0xd'))['register'](socket);function respondWithRpcPromise(_0x4b9d0e,_0x373a77,_0x47c05a){return new BPromise(function(_0x400032,_0x117654){return client[_0xb930('0xe')](_0x4b9d0e,_0x47c05a)[_0xb930('0xf')](function(_0x28dcb0){logger[_0xb930('0x10')](_0xb930('0x11'),_0x373a77,_0xb930('0x12'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x373a77,_0xb930('0x12'),JSON['stringify'](_0x28dcb0));if(_0x28dcb0[_0xb930('0x13')]){if(_0x28dcb0[_0xb930('0x13')]['code']===0x1f4){logger[_0xb930('0x13')](_0xb930('0x11'),_0x373a77,_0x28dcb0[_0xb930('0x13')][_0xb930('0x14')]);return _0x117654(_0x28dcb0['error'][_0xb930('0x14')]);}logger[_0xb930('0x13')](_0xb930('0x11'),_0x373a77,_0x28dcb0[_0xb930('0x13')][_0xb930('0x14')]);return _0x400032(_0x28dcb0['error'][_0xb930('0x14')]);}else{logger[_0xb930('0x10')](_0xb930('0x11'),_0x373a77,_0xb930('0x12'));_0x400032(_0x28dcb0[_0xb930('0x15')][_0xb930('0x14')]);}})[_0xb930('0x16')](function(_0x435460){logger[_0xb930('0x13')](_0xb930('0x11'),_0x373a77,_0x435460);_0x117654(_0x435460);});});}exports[_0xb930('0x17')]=function(_0x56281b){var _0x134c7f=this;return new Promise(function(_0x5de749,_0x27b0d3){return db[_0xb930('0x18')][_0xb930('0x19')](_0x56281b[_0xb930('0x1a')],{'raw':_0x56281b[_0xb930('0x1b')]?_0x56281b['options'][_0xb930('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56281b['options']?_0x56281b[_0xb930('0x1b')]['where']||null:null,'attributes':_0x56281b[_0xb930('0x1b')]?_0x56281b[_0xb930('0x1b')][_0xb930('0x1d')]||null:null,'limit':_0x56281b[_0xb930('0x1b')]?_0x56281b[_0xb930('0x1b')][_0xb930('0x1e')]||null:null})[_0xb930('0xf')](function(_0x599c76){logger[_0xb930('0x10')](_0xb930('0x17'),_0x56281b);logger[_0xb930('0x1f')](_0xb930('0x17'),_0x56281b,JSON['stringify'](_0x599c76));_0x5de749(_0x599c76);})[_0xb930('0x16')](function(_0x56f524){logger['error'](_0xb930('0x17'),_0x56f524[_0xb930('0x14')],_0x56281b);_0x27b0d3(_0x134c7f[_0xb930('0x13')](0x1f4,_0x56f524[_0xb930('0x14')]));});});};exports['AddTagsToMailInteraction']=function(_0x4206ea){return new Promise(function(_0x2b0cab,_0x4f79ef){return db[_0xb930('0x18')][_0xb930('0x20')]({'where':_0x4206ea[_0xb930('0x1b')]?_0x4206ea[_0xb930('0x1b')][_0xb930('0x21')]||null:null})[_0xb930('0xf')](function(_0x36a00e){if(_0x36a00e){return _0x36a00e[_0xb930('0x22')](_0x4206ea[_0xb930('0x1a')][_0xb930('0x23')],_['omit'](_0x4206ea[_0xb930('0x1a')],[_0xb930('0x23'),'id'])||{});}})[_0xb930('0x24')](function(_0x115df0){logger[_0xb930('0x10')]('AddTags',_0x4206ea);logger['debug'](_0xb930('0x25'),_0x4206ea,JSON['stringify'](_0x115df0));_0x2b0cab(_0x115df0);})[_0xb930('0x16')](function(_0x1c7e5a){logger[_0xb930('0x13')](_0xb930('0x25'),_0x1c7e5a[_0xb930('0x14')],_0x4206ea);_0x4f79ef(_this[_0xb930('0x13')](0x1f4,_0x1c7e5a[_0xb930('0x14')]));});});}; \ No newline at end of file +var _0x1488=['info','UpdateMailInteraction','catch','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','MailInteraction','update','body','options','raw','where','attributes'];(function(_0xdc0c5d,_0x1f4def){var _0x388210=function(_0x4ea26d){while(--_0x4ea26d){_0xdc0c5d['push'](_0xdc0c5d['shift']());}};_0x388210(++_0x1f4def);}(_0x1488,0x88));var _0x8148=function(_0x590b63,_0x14debb){_0x590b63=_0x590b63-0x0;var _0x3c9380=_0x1488[_0x590b63];return _0x3c9380;};'use strict';var _=require(_0x8148('0x0'));var util=require('util');var moment=require(_0x8148('0x1'));var BPromise=require(_0x8148('0x2'));var rs=require(_0x8148('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8148('0x4'));var logger=require('../../config/logger')(_0x8148('0x5'));var config=require(_0x8148('0x6'));var jayson=require(_0x8148('0x7'));var client=jayson[_0x8148('0x8')][_0x8148('0x9')]({'port':0x232a});config[_0x8148('0xa')]=_[_0x8148('0xb')](config[_0x8148('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8148('0xc'))(new Redis(config[_0x8148('0xa')]));require(_0x8148('0xd'))[_0x8148('0xe')](socket);function respondWithRpcPromise(_0x2e3e7e,_0x210c0a,_0x2deea3){return new BPromise(function(_0x372409,_0x3bbb42){return client[_0x8148('0xf')](_0x2e3e7e,_0x2deea3)[_0x8148('0x10')](function(_0x1e03f3){logger['info'](_0x8148('0x11'),_0x210c0a,_0x8148('0x12'));logger[_0x8148('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x210c0a,'request\x20sent',JSON[_0x8148('0x14')](_0x1e03f3));if(_0x1e03f3[_0x8148('0x15')]){if(_0x1e03f3['error'][_0x8148('0x16')]===0x1f4){logger[_0x8148('0x15')](_0x8148('0x11'),_0x210c0a,_0x1e03f3[_0x8148('0x15')][_0x8148('0x17')]);return _0x3bbb42(_0x1e03f3['error'][_0x8148('0x17')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x210c0a,_0x1e03f3[_0x8148('0x15')]['message']);return _0x372409(_0x1e03f3['error'][_0x8148('0x17')]);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x210c0a,'request\x20sent');_0x372409(_0x1e03f3[_0x8148('0x18')]['message']);}})['catch'](function(_0x32cdba){logger['error'](_0x8148('0x11'),_0x210c0a,_0x32cdba);_0x3bbb42(_0x32cdba);});});}exports['UpdateMailInteraction']=function(_0x16d63a){var _0x214ed0=this;return new Promise(function(_0x269fa7,_0x3d1e67){return db[_0x8148('0x19')][_0x8148('0x1a')](_0x16d63a[_0x8148('0x1b')],{'raw':_0x16d63a[_0x8148('0x1c')]?_0x16d63a[_0x8148('0x1c')][_0x8148('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16d63a[_0x8148('0x1c')]?_0x16d63a[_0x8148('0x1c')][_0x8148('0x1e')]||null:null,'attributes':_0x16d63a[_0x8148('0x1c')]?_0x16d63a['options'][_0x8148('0x1f')]||null:null,'limit':_0x16d63a[_0x8148('0x1c')]?_0x16d63a['options']['limit']||null:null})[_0x8148('0x10')](function(_0x4bb8a2){logger[_0x8148('0x20')](_0x8148('0x21'),_0x16d63a);logger[_0x8148('0x13')]('UpdateMailInteraction',_0x16d63a,JSON['stringify'](_0x4bb8a2));_0x269fa7(_0x4bb8a2);})[_0x8148('0x22')](function(_0x25c2b9){logger['error'](_0x8148('0x21'),_0x25c2b9[_0x8148('0x17')],_0x16d63a);_0x3d1e67(_0x214ed0['error'](0x1f4,_0x25c2b9[_0x8148('0x17')]));});});};exports[_0x8148('0x23')]=function(_0x37089e){return new Promise(function(_0x4ed683,_0x37deec){return db[_0x8148('0x19')][_0x8148('0x24')]({'where':_0x37089e[_0x8148('0x1c')]?_0x37089e['options'][_0x8148('0x1e')]||null:null})['then'](function(_0x5547cd){if(_0x5547cd){return _0x5547cd[_0x8148('0x25')](_0x37089e['body'][_0x8148('0x26')],_[_0x8148('0x27')](_0x37089e[_0x8148('0x1b')],[_0x8148('0x26'),'id'])||{});}})[_0x8148('0x28')](function(_0x4716d1){logger[_0x8148('0x20')]('AddTags',_0x37089e);logger[_0x8148('0x13')](_0x8148('0x29'),_0x37089e,JSON[_0x8148('0x14')](_0x4716d1));_0x4ed683(_0x4716d1);})['catch'](function(_0x181d7b){logger[_0x8148('0x15')](_0x8148('0x29'),_0x181d7b[_0x8148('0x17')],_0x37089e);_0x37deec(_this[_0x8148('0x15')](0x1f4,_0x181d7b['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 404769d..d0687e7 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 _0x2b55=['length','mailInteraction:','./mailInteraction.events','save','remove','update','register'];(function(_0x14aba7,_0x44971f){var _0xd61156=function(_0x1bdd1b){while(--_0x1bdd1b){_0x14aba7['push'](_0x14aba7['shift']());}};_0xd61156(++_0x44971f);}(_0x2b55,0x95));var _0x52b5=function(_0x167c2a,_0x140850){_0x167c2a=_0x167c2a-0x0;var _0x352979=_0x2b55[_0x167c2a];return _0x352979;};'use strict';var MailInteractionEvents=require(_0x52b5('0x0'));var events=[_0x52b5('0x1'),_0x52b5('0x2'),_0x52b5('0x3')];function createListener(_0x250c97,_0x2a6acf){return function(_0x2600b7){_0x2a6acf['emit'](_0x250c97,_0x2600b7);};}function removeListener(_0x3b04a8,_0x4f173){return function(){MailInteractionEvents['removeListener'](_0x3b04a8,_0x4f173);};}exports[_0x52b5('0x4')]=function(_0x418e00){for(var _0x1a6d37=0x0,_0x57ec40=events[_0x52b5('0x5')];_0x1a6d37<_0x57ec40;_0x1a6d37++){var _0x2e9f72=events[_0x1a6d37];var _0x3f9b25=createListener(_0x52b5('0x6')+_0x2e9f72,_0x418e00);MailInteractionEvents['on'](_0x2e9f72,_0x3f9b25);}}; \ No newline at end of file +var _0x2b9a=['update','removeListener','register','mailInteraction:','./mailInteraction.events','save','remove'];(function(_0x598685,_0x14aa32){var _0x20087e=function(_0x5b4e95){while(--_0x5b4e95){_0x598685['push'](_0x598685['shift']());}};_0x20087e(++_0x14aa32);}(_0x2b9a,0xb3));var _0xa2b9=function(_0x37d0e9,_0x2c5cf3){_0x37d0e9=_0x37d0e9-0x0;var _0x28bd3a=_0x2b9a[_0x37d0e9];return _0x28bd3a;};'use strict';var MailInteractionEvents=require(_0xa2b9('0x0'));var events=[_0xa2b9('0x1'),_0xa2b9('0x2'),_0xa2b9('0x3')];function createListener(_0x237b3a,_0x17d1d5){return function(_0x586381){_0x17d1d5['emit'](_0x237b3a,_0x586381);};}function removeListener(_0x26b879,_0x4b1788){return function(){MailInteractionEvents[_0xa2b9('0x4')](_0x26b879,_0x4b1788);};}exports[_0xa2b9('0x5')]=function(_0x2095f8){for(var _0x371668=0x0,_0x279080=events['length'];_0x371668<_0x279080;_0x371668++){var _0x1182e8=events[_0x371668];var _0x3523c6=createListener(_0xa2b9('0x6')+_0x1182e8,_0x2095f8);MailInteractionEvents['on'](_0x1182e8,_0x3523c6);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index dc53557..e93cae0 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 _0xf981=['Router','../../components/auth/service','get','describe','exports','express'];(function(_0x140202,_0x4245c7){var _0x3037c2=function(_0x525d19){while(--_0x525d19){_0x140202['push'](_0x140202['shift']());}};_0x3037c2(++_0x4245c7);}(_0xf981,0x1af));var _0x1f98=function(_0x7835e3,_0x21309b){_0x7835e3=_0x7835e3-0x0;var _0x1b296f=_0xf981[_0x7835e3];return _0x1b296f;};'use strict';var express=require(_0x1f98('0x0'));var router=express[_0x1f98('0x1')]();var auth=require(_0x1f98('0x2'));var controller=require('./mailInteractionHasTag.controller');router[_0x1f98('0x3')]('/describe',auth['isAuthenticated'](),controller[_0x1f98('0x4')]);module[_0x1f98('0x5')]=router; \ No newline at end of file +var _0x686c=['./mailInteractionHasTag.controller','isAuthenticated','express','../../components/auth/service'];(function(_0x1329c4,_0x3f4e0f){var _0x16e33e=function(_0x2c70d7){while(--_0x2c70d7){_0x1329c4['push'](_0x1329c4['shift']());}};_0x16e33e(++_0x3f4e0f);}(_0x686c,0x1de));var _0xc686=function(_0x56039b,_0x3de8d8){_0x56039b=_0x56039b-0x0;var _0xc90792=_0x686c[_0x56039b];return _0xc90792;};'use strict';var express=require(_0xc686('0x0'));var router=express['Router']();var auth=require(_0xc686('0x1'));var controller=require(_0xc686('0x2'));router['get']('/describe',auth[_0xc686('0x3')](),controller['describe']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 76f13aa..a7c6581 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(_0x411ab3,_0x2b8d1d){var _0x410bcf=function(_0x331359){while(--_0x331359){_0x411ab3['push'](_0x411ab3['shift']());}};_0x410bcf(++_0x2b8d1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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(_0x865226,_0xdc4694){var _0x19e905=function(_0x479f38){while(--_0x479f38){_0x865226['push'](_0x865226['shift']());}};_0x19e905(++_0xdc4694);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 a601878..ae5c047 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 _0xca8f=['INTEGER','sequelize','exports'];(function(_0x3029ed,_0x5d617e){var _0x227757=function(_0x7585f3){while(--_0x7585f3){_0x3029ed['push'](_0x3029ed['shift']());}};_0x227757(++_0x5d617e);}(_0xca8f,0x1db));var _0xfca8=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xca8f[_0x3b0731];return _0x4204d7;};'use strict';var Sequelize=require(_0xfca8('0x0'));module[_0xfca8('0x1')]={'MailInteractionId':{'type':Sequelize[_0xfca8('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xfca8('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x65fa=['exports','INTEGER','sequelize'];(function(_0x39eaa0,_0x2cea62){var _0x2402c5=function(_0x3c308a){while(--_0x3c308a){_0x39eaa0['push'](_0x39eaa0['shift']());}};_0x2402c5(++_0x2cea62);}(_0x65fa,0x122));var _0xa65f=function(_0x4f18e0,_0x35563d){_0x4f18e0=_0x4f18e0-0x0;var _0x196cd3=_0x65fa[_0x4f18e0];return _0x196cd3;};'use strict';var Sequelize=require(_0xa65f('0x0'));module[_0xa65f('0x1')]={'MailInteractionId':{'type':Sequelize[_0xa65f('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xa65f('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index d935a33..b33a42b 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 _0x372d=['define','MailInteractionHasTag','mail_interaction_has_tags','./mailInteractionHasTag'];(function(_0x351449,_0x152f5a){var _0x513969=function(_0x15cfc8){while(--_0x15cfc8){_0x351449['push'](_0x351449['shift']());}};_0x513969(++_0x152f5a);}(_0x372d,0x9f));var _0xd372=function(_0x78eeee,_0x53aceb){_0x78eeee=_0x78eeee-0x0;var _0x365b9a=_0x372d[_0x78eeee];return _0x365b9a;};'use strict';var attributes=require(_0xd372('0x0'));module['exports']=function(_0x2484b9){return _0x2484b9[_0xd372('0x1')](_0xd372('0x2'),attributes,{'tableName':_0xd372('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x007d=['exports','define','MailInteractionHasTag','mail_interaction_has_tags','./mailInteractionHasTag'];(function(_0xee3051,_0xbe4f18){var _0x139e81=function(_0xac81c3){while(--_0xac81c3){_0xee3051['push'](_0xee3051['shift']());}};_0x139e81(++_0xbe4f18);}(_0x007d,0x180));var _0xd007=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x007d[_0x57b54c];return _0x59cc19;};'use strict';var attributes=require(_0xd007('0x0'));module[_0xd007('0x1')]=function(_0x3fe975){return _0x3fe975[_0xd007('0x2')](_0xd007('0x3'),attributes,{'tableName':_0xd007('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 6cf4038..42d7bbd 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 _0x2c59=['exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','tracked','create','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x2c59,0xb7));var _0x92c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c59[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x92c5('0x0'));var timeout=require(_0x92c5('0x1'));var express=require(_0x92c5('0x2'));var router=express[_0x92c5('0x3')]();var fs_extra=require(_0x92c5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x92c5('0x5'));var config=require(_0x92c5('0x6'));var controller=require(_0x92c5('0x7'));router[_0x92c5('0x8')]('/',auth[_0x92c5('0x9')](),controller[_0x92c5('0xa')]);router[_0x92c5('0x8')](_0x92c5('0xb'),auth[_0x92c5('0x9')](),controller[_0x92c5('0xc')]);router[_0x92c5('0x8')](_0x92c5('0xd'),auth[_0x92c5('0x9')](),controller[_0x92c5('0xe')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x92c5('0xf')]);router['post']('/',auth[_0x92c5('0x9')](),interaction[_0x92c5('0x10')]('mail','mailmessage:create'),controller[_0x92c5('0x11')]);router[_0x92c5('0x12')](_0x92c5('0xd'),auth['isAuthenticated'](),controller[_0x92c5('0x13')]);router[_0x92c5('0x12')](_0x92c5('0x14'),auth['isAuthenticated'](),controller[_0x92c5('0x15')]);router[_0x92c5('0x12')](_0x92c5('0x16'),auth[_0x92c5('0x9')](),controller[_0x92c5('0x17')]);router[_0x92c5('0x18')](_0x92c5('0xd'),auth[_0x92c5('0x9')](),controller['destroy']);module[_0x92c5('0x19')]=router; \ No newline at end of file +var _0xf990=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','/:id/download','download','tracked','mail','mailmessage:create','update','put','/:id/accept','accept','destroy','exports','multer','path','connect-timeout'];(function(_0xbe74a0,_0x46b4fa){var _0x45ded2=function(_0x5954f9){while(--_0x5954f9){_0xbe74a0['push'](_0xbe74a0['shift']());}};_0x45ded2(++_0x46b4fa);}(_0xf990,0x87));var _0x0f99=function(_0x249b47,_0x5df562){_0x249b47=_0x249b47-0x0;var _0xab6dea=_0xf990[_0x249b47];return _0xab6dea;};'use strict';var multer=require(_0x0f99('0x0'));var util=require('util');var path=require(_0x0f99('0x1'));var timeout=require(_0x0f99('0x2'));var express=require('express');var router=express[_0x0f99('0x3')]();var fs_extra=require(_0x0f99('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0f99('0x5'));var config=require(_0x0f99('0x6'));var controller=require('./mailMessage.controller');router[_0x0f99('0x7')]('/',auth[_0x0f99('0x8')](),controller[_0x0f99('0x9')]);router[_0x0f99('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x0f99('0xa')]);router[_0x0f99('0x7')](_0x0f99('0xb'),auth[_0x0f99('0x8')](),controller['show']);router[_0x0f99('0x7')](_0x0f99('0xc'),auth[_0x0f99('0x8')](),controller[_0x0f99('0xd')]);router['post']('/',auth[_0x0f99('0x8')](),interaction[_0x0f99('0xe')](_0x0f99('0xf'),_0x0f99('0x10')),controller['create']);router['put'](_0x0f99('0xb'),auth[_0x0f99('0x8')](),controller[_0x0f99('0x11')]);router[_0x0f99('0x12')](_0x0f99('0x13'),auth[_0x0f99('0x8')](),controller[_0x0f99('0x14')]);router[_0x0f99('0x12')]('/:id/reject',auth[_0x0f99('0x8')](),controller['reject']);router['delete'](_0x0f99('0xb'),auth[_0x0f99('0x8')](),controller[_0x0f99('0x15')]);module[_0x0f99('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 5ba37d1..e716ecf 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 _0x2d1a=['BOOLEAN','out','STRING','DATE','ENUM','Email','Chat','sequelize','TEXT','long','medium'];(function(_0x42ae96,_0x48c45b){var _0x5ada45=function(_0x1ccad8){while(--_0x1ccad8){_0x42ae96['push'](_0x42ae96['shift']());}};_0x5ada45(++_0x48c45b);}(_0x2d1a,0xe3));var _0xa2d1=function(_0x2868ec,_0x3aef29){_0x2868ec=_0x2868ec-0x0;var _0x2ad998=_0x2d1a[_0x2868ec];return _0x2ad998;};'use strict';var Sequelize=require(_0xa2d1('0x0'));var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0xa2d1('0x1')](_0xa2d1('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xa2d1('0x1')](_0xa2d1('0x3'))},'read':{'type':Sequelize[_0xa2d1('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xa2d1('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa2d1('0x6')](0x1fe)},'from':{'type':Sequelize[_0xa2d1('0x6')]},'to':{'type':Sequelize['TEXT'](_0xa2d1('0x2'))},'cc':{'type':Sequelize['TEXT'](_0xa2d1('0x2'))},'bcc':{'type':Sequelize[_0xa2d1('0x1')](_0xa2d1('0x2'))},'subject':{'type':Sequelize[_0xa2d1('0x1')]},'sentAt':{'type':Sequelize[_0xa2d1('0x7')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa2d1('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xa2d1('0x7')]},'originTo':{'type':Sequelize[_0xa2d1('0x1')]('long')},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize[_0xa2d1('0x8')](_0xa2d1('0x9'),_0xa2d1('0xa')),'defaultValue':_0xa2d1('0x9'),'allowNull':![]}}; \ No newline at end of file +var _0x1abe=['TEXT','medium','BOOLEAN','out','STRING','long','INTEGER','DATE','ENUM','Email','exports'];(function(_0x206f5d,_0x3f6c1d){var _0x4432af=function(_0x1ae29e){while(--_0x1ae29e){_0x206f5d['push'](_0x206f5d['shift']());}};_0x4432af(++_0x3f6c1d);}(_0x1abe,0x8e));var _0xe1ab=function(_0x40e132,_0x1a5f2e){_0x40e132=_0x40e132-0x0;var _0x2b934b=_0x1abe[_0x40e132];return _0x2b934b;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0xe1ab('0x0')]={'body':{'type':Sequelize[_0xe1ab('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe1ab('0x1')](_0xe1ab('0x2'))},'read':{'type':Sequelize[_0xe1ab('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe1ab('0x4')),'defaultValue':_0xe1ab('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe1ab('0x5')](0x1fe)},'from':{'type':Sequelize[_0xe1ab('0x5')]},'to':{'type':Sequelize[_0xe1ab('0x1')](_0xe1ab('0x6'))},'cc':{'type':Sequelize['TEXT'](_0xe1ab('0x6'))},'bcc':{'type':Sequelize[_0xe1ab('0x1')](_0xe1ab('0x6'))},'subject':{'type':Sequelize[_0xe1ab('0x1')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xe1ab('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xe1ab('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xe1ab('0x8')]},'originTo':{'type':Sequelize[_0xe1ab('0x1')]('long')},'originCc':{'type':Sequelize[_0xe1ab('0x1')](_0xe1ab('0x6'))},'originChannel':{'type':Sequelize[_0xe1ab('0x9')](_0xe1ab('0xa'),'Chat'),'defaultValue':_0xe1ab('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index dc99583..e966de7 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 _0x4ad6=['stringify','error','code','message','info','result','catch','status','limit','undefined','count','offset','set','Content-Range','json','update','destroy','name','index','MailMessage','rawAttributes','type','model','map','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','body','describe','create','out','secret','split','MailAccount','List','CmContact','Contacts','DESC','MailServerOut','CloudProvider','Smtp','getSmtpOptions','attachments','join','root','server/files/attachments','basename','defaults','ListId','List\x20not\x20found','SendMail','format','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','MailInteraction','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','agent','fullname','email','internal','manual','interface','channel','motionChannel','fromString','EventManager','acceptmessage','reject','mail','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','event','rejectmessage','download','unix','toString','server','tmp','files','message-%s.eml','from','bcc','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','readFileSync','build','unlinkSync','eml-format','moment','bluebird','path','lodash','ioredis','../../config/logger','api','mail-interactions','redis','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2c8802,_0x4ad8e4){var _0x29fefc=function(_0x92772b){while(--_0x92772b){_0x2c8802['push'](_0x2c8802['shift']());}};_0x29fefc(++_0x4ad8e4);}(_0x4ad6,0x82));var _0x64ad=function(_0x57601a,_0x26f5b2){_0x57601a=_0x57601a-0x0;var _0x3aeee5=_0x4ad6[_0x57601a];return _0x3aeee5;};'use strict';var emlformat=require(_0x64ad('0x0'));var moment=require(_0x64ad('0x1'));var BPromise=require(_0x64ad('0x2'));var util=require('util');var path=require(_0x64ad('0x3'));var fs=require('fs');var _=require(_0x64ad('0x4'));var Redis=require(_0x64ad('0x5'));var htmlToText=require('html-to-text');var qs=require('../../components/parsers/qs');var logger=require(_0x64ad('0x6'))(_0x64ad('0x7'));var interaction_log=require(_0x64ad('0x6'))(_0x64ad('0x8'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x64ad('0x9')]=_['defaults'](config[_0x64ad('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x64ad('0xa'))(new Redis(config[_0x64ad('0x9')]));var htmlEntities=require('html-entities');require(_0x64ad('0xb'))[_0x64ad('0xc')](socket);var jayson=require(_0x64ad('0xd'));var client=jayson[_0x64ad('0xe')]['http']({'port':0x232c});var client9003=jayson['client'][_0x64ad('0xf')]({'port':0x232b});var client9002=jayson['client'][_0x64ad('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x35d9f1,_0x4c1382,_0x3bfc84,_0x72b79d){return new BPromise(function(_0x1c4230,_0x5da656){var _0x9c8b6=_0x72b79d||client;return _0x9c8b6[_0x64ad('0x10')](_0x35d9f1,_0x3bfc84)[_0x64ad('0x11')](function(_0x582cc0){logger['info'](_0x64ad('0x12'),_0x4c1382,_0x64ad('0x13'));logger[_0x64ad('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x4c1382,_0x64ad('0x13'),JSON[_0x64ad('0x15')](_0x582cc0));if(_0x582cc0['error']){if(_0x582cc0[_0x64ad('0x16')][_0x64ad('0x17')]===0x1f4){logger[_0x64ad('0x16')](_0x64ad('0x12'),_0x4c1382,_0x582cc0[_0x64ad('0x16')][_0x64ad('0x18')]);return _0x5da656(_0x582cc0[_0x64ad('0x16')][_0x64ad('0x18')]);}logger[_0x64ad('0x16')](_0x64ad('0x12'),_0x4c1382,_0x582cc0[_0x64ad('0x16')][_0x64ad('0x18')]);return _0x1c4230(_0x582cc0[_0x64ad('0x16')][_0x64ad('0x18')]);}else{logger[_0x64ad('0x19')](_0x64ad('0x12'),_0x4c1382,'request\x20sent');_0x1c4230(_0x582cc0[_0x64ad('0x1a')][_0x64ad('0x18')]);}})[_0x64ad('0x1b')](function(_0x31b993){logger[_0x64ad('0x16')](_0x64ad('0x12'),_0x4c1382,_0x31b993);_0x5da656(_0x31b993);});});}function respondWithResult(_0x387c56,_0x1a85b3){_0x1a85b3=_0x1a85b3||0xc8;return function(_0x59e102){if(_0x59e102){return _0x387c56[_0x64ad('0x1c')](_0x1a85b3)['json'](_0x59e102);}};}function respondWithFilteredResult(_0x3a9037,_0x183fac){return function(_0x4378ce){if(_0x4378ce){var _0x1f23b5=typeof _0x183fac['offset']==='undefined'&&typeof _0x183fac[_0x64ad('0x1d')]===_0x64ad('0x1e');var _0x5073c9=_0x4378ce[_0x64ad('0x1f')];var _0x613a9e=_0x1f23b5?0x0:_0x183fac['offset'];var _0x42b74e=_0x1f23b5?_0x4378ce['count']:_0x183fac[_0x64ad('0x20')]+_0x183fac[_0x64ad('0x1d')];var _0x5a3fa9;if(_0x42b74e>=_0x5073c9){_0x42b74e=_0x5073c9;_0x5a3fa9=0xc8;}else{_0x5a3fa9=0xce;}_0x3a9037[_0x64ad('0x1c')](_0x5a3fa9);return _0x3a9037[_0x64ad('0x21')](_0x64ad('0x22'),_0x613a9e+'-'+_0x42b74e+'/'+_0x5073c9)[_0x64ad('0x23')](_0x4378ce);}return null;};}function saveUpdates(_0x1caaff){return function(_0xdcad30){if(_0xdcad30){return _0xdcad30[_0x64ad('0x24')](_0x1caaff)['then'](function(_0x34f7a9){return _0x34f7a9;});}return null;};}function removeEntity(_0x26b8fb){return function(_0x20af7c){if(_0x20af7c){return _0x20af7c[_0x64ad('0x25')]()[_0x64ad('0x11')](function(){_0x26b8fb[_0x64ad('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a29e6){return function(_0x47efbd){if(!_0x47efbd){_0x2a29e6['sendStatus'](0x194);}return _0x47efbd;};}function handleError(_0x2b3ab2,_0x5c3bd8){_0x5c3bd8=_0x5c3bd8||0x1f4;return function(_0x781f42){logger[_0x64ad('0x16')](_0x781f42['stack']);if(_0x781f42['name']){delete _0x781f42[_0x64ad('0x26')];}_0x2b3ab2[_0x64ad('0x1c')](_0x5c3bd8)['send'](_0x781f42);};}exports[_0x64ad('0x27')]=function(_0x41ac38,_0x840902){var _0x1d55ad={},_0x44d0dd={},_0x4ad518={'count':0x0,'rows':[]};var _0x14a7b1=_['map'](db[_0x64ad('0x28')][_0x64ad('0x29')],function(_0x7375f3){return{'name':_0x7375f3['fieldName'],'type':_0x7375f3[_0x64ad('0x2a')]['key']};});_0x44d0dd[_0x64ad('0x2b')]=_[_0x64ad('0x2c')](_0x14a7b1,_0x64ad('0x26'));_0x44d0dd['query']=_[_0x64ad('0x2d')](_0x41ac38[_0x64ad('0x2e')]);_0x44d0dd[_0x64ad('0x2f')]=_[_0x64ad('0x30')](_0x44d0dd[_0x64ad('0x2b')],_0x44d0dd['query']);_0x1d55ad['attributes']=_[_0x64ad('0x30')](_0x44d0dd[_0x64ad('0x2b')],qs[_0x64ad('0x31')](_0x41ac38[_0x64ad('0x2e')]['fields']));_0x1d55ad[_0x64ad('0x32')]=_0x1d55ad[_0x64ad('0x32')][_0x64ad('0x33')]?_0x1d55ad[_0x64ad('0x32')]:_0x44d0dd[_0x64ad('0x2b')];if(!_0x41ac38[_0x64ad('0x2e')]['hasOwnProperty'](_0x64ad('0x34'))){_0x1d55ad[_0x64ad('0x1d')]=qs[_0x64ad('0x1d')](_0x41ac38[_0x64ad('0x2e')]['limit']);_0x1d55ad['offset']=qs[_0x64ad('0x20')](_0x41ac38[_0x64ad('0x2e')][_0x64ad('0x20')]);}_0x1d55ad[_0x64ad('0x35')]=qs[_0x64ad('0x36')](_0x41ac38['query'][_0x64ad('0x36')]);_0x1d55ad['where']=qs[_0x64ad('0x2f')](_[_0x64ad('0x37')](_0x41ac38['query'],_0x44d0dd[_0x64ad('0x2f')]),_0x14a7b1);if(_0x41ac38[_0x64ad('0x2e')]['filter']){_0x1d55ad[_0x64ad('0x38')]=_[_0x64ad('0x39')](_0x1d55ad[_0x64ad('0x38')],{'$or':_[_0x64ad('0x2c')](_0x14a7b1,function(_0x106f24){if(_0x106f24[_0x64ad('0x2a')]!==_0x64ad('0x3a')){var _0x25c1ed={};_0x25c1ed[_0x106f24['name']]={'$like':'%'+_0x41ac38['query'][_0x64ad('0x3b')]+'%'};return _0x25c1ed;}})});}_0x1d55ad=_[_0x64ad('0x39')]({},_0x1d55ad,_0x41ac38[_0x64ad('0x3c')]);var _0x4fa0e6={'where':_0x1d55ad[_0x64ad('0x38')]};return db[_0x64ad('0x28')]['count'](_0x4fa0e6)[_0x64ad('0x11')](function(_0x4c6109){_0x4ad518[_0x64ad('0x1f')]=_0x4c6109;if(_0x41ac38[_0x64ad('0x2e')][_0x64ad('0x3d')]){_0x1d55ad['include']=[{'all':!![]}];}return db['MailMessage'][_0x64ad('0x3e')](_0x1d55ad);})[_0x64ad('0x11')](function(_0x1e1a27){_0x4ad518[_0x64ad('0x3f')]=_0x1e1a27;return _0x4ad518;})[_0x64ad('0x11')](respondWithFilteredResult(_0x840902,_0x1d55ad))[_0x64ad('0x1b')](handleError(_0x840902,null));};exports[_0x64ad('0x40')]=function(_0x2ec983,_0xe8e881){var _0xb797a3={'raw':!![],'where':{'id':_0x2ec983[_0x64ad('0x41')]['id']}},_0x350b1c={};_0x350b1c[_0x64ad('0x2b')]=_[_0x64ad('0x2d')](db[_0x64ad('0x28')]['rawAttributes']);_0x350b1c[_0x64ad('0x2e')]=_[_0x64ad('0x2d')](_0x2ec983[_0x64ad('0x2e')]);_0x350b1c[_0x64ad('0x2f')]=_[_0x64ad('0x30')](_0x350b1c[_0x64ad('0x2b')],_0x350b1c['query']);_0xb797a3[_0x64ad('0x32')]=_[_0x64ad('0x30')](_0x350b1c['model'],qs['fields'](_0x2ec983[_0x64ad('0x2e')][_0x64ad('0x31')]));_0xb797a3['attributes']=_0xb797a3[_0x64ad('0x32')][_0x64ad('0x33')]?_0xb797a3[_0x64ad('0x32')]:_0x350b1c['model'];if(_0x2ec983[_0x64ad('0x2e')][_0x64ad('0x3d')]){_0xb797a3[_0x64ad('0x42')]=[{'all':!![]}];}_0xb797a3=_['merge']({},_0xb797a3,_0x2ec983[_0x64ad('0x3c')]);return db[_0x64ad('0x28')][_0x64ad('0x43')](_0xb797a3)[_0x64ad('0x11')](handleEntityNotFound(_0xe8e881,null))['then'](respondWithResult(_0xe8e881,null))[_0x64ad('0x1b')](handleError(_0xe8e881,null));};exports[_0x64ad('0x24')]=function(_0x4f68c1,_0x3b440f){if(_0x4f68c1[_0x64ad('0x44')]['id']){delete _0x4f68c1[_0x64ad('0x44')]['id'];}return db[_0x64ad('0x28')][_0x64ad('0x43')]({'where':{'id':_0x4f68c1['params']['id']}})['then'](handleEntityNotFound(_0x3b440f,null))[_0x64ad('0x11')](saveUpdates(_0x4f68c1[_0x64ad('0x44')],null))[_0x64ad('0x11')](respondWithResult(_0x3b440f,null))[_0x64ad('0x1b')](handleError(_0x3b440f,null));};exports[_0x64ad('0x25')]=function(_0x55a217,_0x43b3bb){return db[_0x64ad('0x28')]['find']({'where':{'id':_0x55a217[_0x64ad('0x41')]['id']}})['then'](handleEntityNotFound(_0x43b3bb,null))['then'](removeEntity(_0x43b3bb,null))[_0x64ad('0x1b')](handleError(_0x43b3bb,null));};exports[_0x64ad('0x45')]=function(_0x898e31,_0x16ebd4){return db[_0x64ad('0x28')][_0x64ad('0x45')]()[_0x64ad('0x11')](respondWithResult(_0x16ebd4,null))[_0x64ad('0x1b')](handleError(_0x16ebd4,null));};exports[_0x64ad('0x46')]=function(_0x3eb394,_0x3d3852){return db['MailMessage']['create'](_0x3eb394[_0x64ad('0x44')])[_0x64ad('0x11')](function(_0x821289){if(_0x821289){if(_0x821289['direction']===_0x64ad('0x47')&&!_0x821289[_0x64ad('0x48')]){var _0x24f86e,_0x968e53,_0x560941;if(_0x3eb394[_0x64ad('0x44')]['to']){_0x968e53=_0x3eb394['body']['to'][_0x64ad('0x49')](',')[0x0];}return db[_0x64ad('0x4a')]['findOne']({'where':{'id':_0x821289['MailAccountId']},'include':[{'model':db['CmList'],'as':_0x64ad('0x4b'),'include':[{'model':db[_0x64ad('0x4c')],'as':_0x64ad('0x4d'),'where':{'email':_0x968e53},'limit':0x1,'order':[['updatedAt',_0x64ad('0x4e')]]}]},{'model':db[_0x64ad('0x4f')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x64ad('0x50')],'as':_0x64ad('0x50'),'raw':!![]}]}]})['then'](function(_0x31868f){_0x24f86e=_0x31868f;if(!_0x24f86e||!_0x24f86e[_0x64ad('0x51')])return;var _0x54d053=_0x24f86e[_0x64ad('0x52')]();if(_0x3eb394[_0x64ad('0x44')][_0x64ad('0x53')]&&_0x3eb394['body'][_0x64ad('0x53')][_0x64ad('0x33')]){for(var _0x2e8f19=0x0;_0x2e8f19<_0x3eb394[_0x64ad('0x44')]['attachments'][_0x64ad('0x33')];_0x2e8f19+=0x1){_0x3eb394[_0x64ad('0x44')]['attachments'][_0x2e8f19]={'filename':_0x3eb394[_0x64ad('0x44')]['attachments'][_0x2e8f19][_0x64ad('0x26')],'path':path[_0x64ad('0x54')](config[_0x64ad('0x55')],_0x64ad('0x56'),_0x3eb394[_0x64ad('0x44')]['attachments'][_0x2e8f19][_0x64ad('0x57')])};}}_0x560941={'account':_0x54d053,'message':_0x3eb394[_0x64ad('0x44')]};return;})[_0x64ad('0x11')](function(){if(_0x24f86e['List']){if(_0x24f86e[_0x64ad('0x4b')][_0x64ad('0x4d')]['length']){return _0x24f86e[_0x64ad('0x4b')][_0x64ad('0x4d')][0x0];}else{return db[_0x64ad('0x4c')]['create'](_[_0x64ad('0x58')](_0x3eb394['body'],{'firstName':_0x3eb394[_0x64ad('0x44')]['to'],'email':_0x3eb394[_0x64ad('0x44')]['to'],'phone':_0x3eb394[_0x64ad('0x44')]['to'],'ListId':_0x24f86e[_0x64ad('0x59')]}));}}else{throw new Error(_0x64ad('0x5a'));}})[_0x64ad('0x11')](function(){if(_0x560941){return respondWithRpcPromise(_0x64ad('0x5b'),'sendMail',_0x560941,client9003)[_0x64ad('0x11')](function(_0x50a741){return _0x821289[_0x64ad('0x24')]({'read':!![],'messageId':_0x50a741['messageId'],'sentAt':moment()[_0x64ad('0x5c')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x64ad('0x1b')](function(_0x1a324d){logger[_0x64ad('0x16')]('%s',JSON[_0x64ad('0x15')](_0x1a324d));return _0x821289;});}return _0x821289;});}return _0x821289;}})['then'](respondWithResult(_0x3d3852,0xc9))[_0x64ad('0x1b')](handleError(_0x3d3852,null));};exports[_0x64ad('0x5d')]=function(_0x135c92,_0x4655b8){var _0x276abd={'agent':{},'channel':'mail'};if(_0x135c92['body']['id']){delete _0x135c92[_0x64ad('0x44')]['id'];}_0x135c92[_0x64ad('0x44')][_0x64ad('0x5e')]=!![];_0x135c92[_0x64ad('0x44')][_0x64ad('0x5f')]=moment()[_0x64ad('0x5c')](_0x64ad('0x60'));_0x135c92[_0x64ad('0x44')][_0x64ad('0x61')]=_0x135c92[_0x64ad('0x44')]['UserId']||_0x135c92['user']['id'];_0x276abd['agent']['id']=_0x135c92[_0x64ad('0x44')][_0x64ad('0x61')];return db[_0x64ad('0x28')]['find']({'where':{'id':_0x135c92[_0x64ad('0x41')]['id'],'UserId':null}})[_0x64ad('0x11')](handleEntityNotFound(_0x4655b8,null))[_0x64ad('0x11')](saveUpdates(_0x135c92[_0x64ad('0x44')],null))[_0x64ad('0x11')](function(_0x544977){if(_0x544977){_0x276abd[_0x64ad('0x18')]=_0x544977[_0x64ad('0x62')]({'plain':!![]});return db[_0x64ad('0x63')][_0x64ad('0x43')]({'where':{'id':_0x544977['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4655b8,null))[_0x64ad('0x11')](function(_0x1ac5ed){if(_0x1ac5ed){return _0x1ac5ed[_0x64ad('0x24')]({'UserId':_0x135c92[_0x64ad('0x44')][_0x64ad('0x61')],'read1stAt':_['isNil'](_0x1ac5ed['read1stAt'])?moment()[_0x64ad('0x5c')](_0x64ad('0x60')):undefined});}return null;})['then'](function(_0x4bd40e){if(_0x4bd40e){_0x276abd[_0x64ad('0x64')]=_0x4bd40e[_0x64ad('0x62')]({'plain':!![]});interaction_log[_0x64ad('0x19')](_0x64ad('0x65'),_0x135c92['user']['id'],_0x135c92[_0x64ad('0x66')][_0x64ad('0x26')],_0x135c92[_0x64ad('0x66')][_0x64ad('0x67')],_0x276abd[_0x64ad('0x64')]['id'],_0x135c92[_0x64ad('0x44')]?JSON['stringify'](_0x135c92[_0x64ad('0x44')]):'null');return respondWithRpcPromise(_0x64ad('0x68'),_0x64ad('0x69'),_0x276abd);}return null;})['then'](function(_0xa0e895){var _0xb4d3c5=_0x64ad('0x6a')+_0xa0e895[_0x64ad('0x18')][_0x64ad('0x6b')];return db['sequelize'][_0x64ad('0x2e')](_0xb4d3c5,{'type':db[_0x64ad('0x6c')][_0x64ad('0x6d')]['SELECT'],'raw':!![]})[_0x64ad('0x11')](function(_0xaf01b7){return _0xaf01b7;});})[_0x64ad('0x11')](function(_0x55af81){if(_0x55af81){_0x276abd[_0x64ad('0x18')][_0x64ad('0x6e')]=_0x55af81[0x0];if(!_0x135c92[_0x64ad('0x44')][_0x64ad('0x61')])return;return db[_0x64ad('0x6f')]['find']({'where':{'id':_0x135c92[_0x64ad('0x44')][_0x64ad('0x61')],'role':_0x64ad('0x70')},'attributes':['id','name',_0x64ad('0x71'),_0x64ad('0x72'),_0x64ad('0x73')],'raw':!![]});}return null;})[_0x64ad('0x11')](function(_0x2b0e01){if(!_0x2b0e01)return null;_0x276abd['message'][_0x64ad('0x70')]=_0x2b0e01;return _0x276abd;})['then'](function(_0x5bf7a7){if(_0x5bf7a7){if(_0x135c92[_0x64ad('0x44')][_0x64ad('0x74')]){_0x276abd[_0x64ad('0x18')][_0x64ad('0x75')]=util[_0x64ad('0x5c')]('SIP/%s',_0x135c92[_0x64ad('0x66')][_0x64ad('0x26')]);_0x276abd[_0x64ad('0x18')][_0x64ad('0x76')]=_0x276abd[_0x64ad('0x76')];_0x276abd[_0x64ad('0x18')][_0x64ad('0x77')]=_0x276abd[_0x64ad('0x76')];_0x276abd['message']['event']=_0x64ad('0x5d');_0x276abd['message'][_0x64ad('0x44')]=htmlToText[_0x64ad('0x78')](_0x276abd['message'][_0x64ad('0x44')]);return respondWithRpcPromise(_0x64ad('0x79'),_0x64ad('0x79'),{'event':_0x64ad('0x7a'),'message':_0x276abd[_0x64ad('0x18')]},client9002)[_0x64ad('0x11')](function(){return _0x276abd;});}return _0x276abd;}return null;})[_0x64ad('0x11')](respondWithResult(_0x4655b8,null))[_0x64ad('0x1b')](handleError(_0x4655b8,null));};exports[_0x64ad('0x7b')]=function(_0x13c4d6,_0x291f92){var _0x41a084={'agent':{},'channel':_0x64ad('0x7c')};if(_0x13c4d6[_0x64ad('0x44')]['id']){delete _0x13c4d6[_0x64ad('0x44')]['id'];}_0x13c4d6[_0x64ad('0x44')][_0x64ad('0x61')]=_0x13c4d6[_0x64ad('0x44')]['UserId']||_0x13c4d6[_0x64ad('0x66')]['id'];_0x41a084[_0x64ad('0x70')]['id']=_0x13c4d6[_0x64ad('0x44')][_0x64ad('0x61')];return db[_0x64ad('0x28')]['find']({'where':{'id':_0x13c4d6[_0x64ad('0x41')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x291f92,null))[_0x64ad('0x11')](function(_0x5b85da){if(_0x5b85da){_0x41a084[_0x64ad('0x18')]=_0x5b85da[_0x64ad('0x62')]({'plain':!![]});return db['MailInteraction'][_0x64ad('0x43')]({'where':{'id':_0x5b85da[_0x64ad('0x7d')]}});}return null;})[_0x64ad('0x11')](handleEntityNotFound(_0x291f92,null))[_0x64ad('0x11')](function(_0x4a328b){if(_0x4a328b){_0x41a084[_0x64ad('0x64')]=_0x4a328b[_0x64ad('0x62')]({'plain':!![]});interaction_log['info'](_0x64ad('0x7e'),_0x13c4d6[_0x64ad('0x66')]['id'],_0x13c4d6[_0x64ad('0x66')]['name'],_0x13c4d6[_0x64ad('0x66')]['role'],_0x41a084[_0x64ad('0x64')]['id'],_0x13c4d6[_0x64ad('0x44')]?JSON[_0x64ad('0x15')](_0x13c4d6[_0x64ad('0x44')]):_0x64ad('0x7f'));return respondWithRpcPromise(_0x64ad('0x80'),_0x64ad('0x81'),_0x41a084);}return null;})[_0x64ad('0x11')](function(_0x934185){var _0x457915='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x934185[_0x64ad('0x18')][_0x64ad('0x6b')];return db[_0x64ad('0x82')][_0x64ad('0x2e')](_0x457915,{'type':db[_0x64ad('0x6c')][_0x64ad('0x6d')]['SELECT'],'raw':!![]})[_0x64ad('0x11')](function(_0x197643){return _0x197643;});})[_0x64ad('0x11')](function(_0x25cbdb){if(_0x25cbdb){_0x41a084[_0x64ad('0x18')][_0x64ad('0x6e')]=_0x25cbdb[0x0];if(!_0x13c4d6[_0x64ad('0x44')]['UserId'])return;return db[_0x64ad('0x6f')][_0x64ad('0x43')]({'where':{'id':_0x13c4d6['body'][_0x64ad('0x61')],'role':_0x64ad('0x70')},'attributes':['id','name',_0x64ad('0x71'),_0x64ad('0x72'),'internal'],'raw':!![]});}return null;})['then'](function(_0x4d293e){if(!_0x4d293e)return null;_0x41a084[_0x64ad('0x18')]['agent']=_0x4d293e;return _0x41a084;})[_0x64ad('0x11')](function(_0x35e8ec){if(_0x35e8ec){_0x35e8ec[_0x64ad('0x18')][_0x64ad('0x75')]=util['format']('SIP/%s',_0x13c4d6[_0x64ad('0x66')]['name']);_0x35e8ec[_0x64ad('0x18')][_0x64ad('0x76')]=_0x41a084[_0x64ad('0x76')];_0x35e8ec[_0x64ad('0x18')][_0x64ad('0x77')]=_0x41a084[_0x64ad('0x76')];_0x35e8ec[_0x64ad('0x18')][_0x64ad('0x83')]='reject';_0x35e8ec[_0x64ad('0x18')][_0x64ad('0x44')]=htmlToText[_0x64ad('0x78')](_0x41a084[_0x64ad('0x18')][_0x64ad('0x44')]);respondWithRpcPromise(_0x64ad('0x79'),_0x64ad('0x79'),{'event':_0x64ad('0x84'),'message':_0x35e8ec[_0x64ad('0x18')]},client9002);return _0x41a084;}return null;})[_0x64ad('0x11')](respondWithResult(_0x291f92,null))['catch'](handleError(_0x291f92,null));};exports[_0x64ad('0x85')]=function(_0x2e8120,_0x31cd5a){var _0x3b2775=moment()[_0x64ad('0x86')]()[_0x64ad('0x87')]();var _0x89f8b6=path[_0x64ad('0x54')](config['root'],_0x64ad('0x88'),'files',_0x64ad('0x89'));var _0xa077ee=path[_0x64ad('0x54')](config['root'],_0x64ad('0x88'),_0x64ad('0x8a'),_0x64ad('0x53'));var _0x30124b=util[_0x64ad('0x5c')](_0x64ad('0x8b'),_0x3b2775);return db['MailMessage'][_0x64ad('0x43')]({'where':{'id':_0x2e8120[_0x64ad('0x41')]['id']},'attributes':['id',_0x64ad('0x44'),_0x64ad('0x8c'),'to','cc',_0x64ad('0x8d'),'subject','createdAt'],'include':_0x2e8120[_0x64ad('0x2e')]['attachments']?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0x64ad('0x11')](handleEntityNotFound(_0x31cd5a,null))['then'](function(_0x4eb2d9){if(_0x4eb2d9){var _0x184749=_0x4eb2d9;var _0x444fc9={'from':_0x184749[_0x64ad('0x8c')],'to':_0x184749['to'],'subject':_0x184749[_0x64ad('0x8e')],'html':htmlEntities[_0x64ad('0x8f')](_0x184749[_0x64ad('0x44')]),'headers':{'Date':moment(_0x184749['createdAt'])[_0x64ad('0x5c')](_0x64ad('0x90'))},'attachments':[]};if(_0x4eb2d9['cc']){_0x444fc9[_0x64ad('0x91')]['Cc']=_0x4eb2d9['cc'];}if(_0x4eb2d9[_0x64ad('0x8d')]){_0x444fc9[_0x64ad('0x91')][_0x64ad('0x92')]=_0x4eb2d9['bcc'];}return new BPromise(function(_0x440566,_0x49dbfd){if(_0x4eb2d9[_0x64ad('0x93')]){for(var _0x348047=0x0;_0x348047<_0x4eb2d9[_0x64ad('0x93')]['length'];_0x348047++){var _0x534776=_0x4eb2d9['Attachments'][_0x348047];var _0x1b7249=path[_0x64ad('0x54')](_0xa077ee,_0x534776[_0x64ad('0x57')]);if(fs['existsSync'](_0x1b7249)){_0x444fc9[_0x64ad('0x53')]['push']({'name':_0x534776['name'],'contentType':_0x534776[_0x64ad('0x2a')],'data':fs[_0x64ad('0x94')](_0x1b7249)});}}}emlformat[_0x64ad('0x95')](_0x444fc9,function(_0x3f2d84,_0x2692a0){if(_0x3f2d84)return _0x49dbfd(_0x3f2d84);fs['writeFileSync'](path[_0x64ad('0x54')](_0x89f8b6,_0x30124b),_0x2692a0);return _0x440566(_0x2692a0);});});}})[_0x64ad('0x11')](function(_0x144400){if(_0x144400){return _0x31cd5a[_0x64ad('0x85')](path[_0x64ad('0x54')](_0x89f8b6,_0x30124b),_0x30124b,function(_0x1d21a7){if(!_0x1d21a7)fs[_0x64ad('0x96')](path[_0x64ad('0x54')](_0x89f8b6,_0x30124b));});}})[_0x64ad('0x1b')](handleError(_0x31cd5a,null));}; \ No newline at end of file +var _0x2b60=['register','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','filter','includeAll','findAll','rows','show','params','include','update','body','find','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','Contacts','defaults','ListId','List\x20not\x20found','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','agent','get','MailInteraction','MailInteractionId','isNil','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','manual','SIP/%s','motionChannel','channel','event','fromString','EventManager','acceptmessage','reject','RejectMessage','rejectMessage','email','internal','interface','download','unix','toString','server','files','message-%s.eml','bcc','subject','createdAt','Attachment','Attachments','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','lodash','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket'];(function(_0x2aaf91,_0x3c7fa1){var _0x709352=function(_0x4851eb){while(--_0x4851eb){_0x2aaf91['push'](_0x2aaf91['shift']());}};_0x709352(++_0x3c7fa1);}(_0x2b60,0x13b));var _0x02b6=function(_0x4fbe5f,_0x47ebaa){_0x4fbe5f=_0x4fbe5f-0x0;var _0x84e514=_0x2b60[_0x4fbe5f];return _0x84e514;};'use strict';var emlformat=require(_0x02b6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x02b6('0x1'));var Redis=require('ioredis');var htmlToText=require(_0x02b6('0x2'));var qs=require(_0x02b6('0x3'));var logger=require(_0x02b6('0x4'))('api');var interaction_log=require('../../config/logger')(_0x02b6('0x5'));var config=require(_0x02b6('0x6'));var db=require(_0x02b6('0x7'))['db'];config['redis']=_['defaults'](config[_0x02b6('0x8')],{'host':_0x02b6('0x9'),'port':0x18eb});var socket=require(_0x02b6('0xa'))(new Redis(config[_0x02b6('0x8')]));var htmlEntities=require(_0x02b6('0xb'));require(_0x02b6('0xc'))[_0x02b6('0xd')](socket);var jayson=require('jayson/promise');var client=jayson[_0x02b6('0xe')][_0x02b6('0xf')]({'port':0x232c});var client9003=jayson[_0x02b6('0xe')][_0x02b6('0xf')]({'port':0x232b});var client9002=jayson[_0x02b6('0xe')][_0x02b6('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x15d6c1,_0x3e74d9,_0x1d6df0,_0x392fec){return new BPromise(function(_0xab2cb9,_0x41f150){var _0x19c49b=_0x392fec||client;return _0x19c49b['request'](_0x15d6c1,_0x1d6df0)[_0x02b6('0x10')](function(_0x2557e5){logger[_0x02b6('0x11')](_0x02b6('0x12'),_0x3e74d9,_0x02b6('0x13'));logger[_0x02b6('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x3e74d9,_0x02b6('0x13'),JSON[_0x02b6('0x15')](_0x2557e5));if(_0x2557e5[_0x02b6('0x16')]){if(_0x2557e5['error'][_0x02b6('0x17')]===0x1f4){logger[_0x02b6('0x16')](_0x02b6('0x12'),_0x3e74d9,_0x2557e5[_0x02b6('0x16')][_0x02b6('0x18')]);return _0x41f150(_0x2557e5[_0x02b6('0x16')][_0x02b6('0x18')]);}logger[_0x02b6('0x16')](_0x02b6('0x12'),_0x3e74d9,_0x2557e5[_0x02b6('0x16')][_0x02b6('0x18')]);return _0xab2cb9(_0x2557e5[_0x02b6('0x16')][_0x02b6('0x18')]);}else{logger['info'](_0x02b6('0x12'),_0x3e74d9,'request\x20sent');_0xab2cb9(_0x2557e5[_0x02b6('0x19')]['message']);}})[_0x02b6('0x1a')](function(_0x164b48){logger[_0x02b6('0x16')](_0x02b6('0x12'),_0x3e74d9,_0x164b48);_0x41f150(_0x164b48);});});}function respondWithResult(_0x5dfd6d,_0x32ab3b){_0x32ab3b=_0x32ab3b||0xc8;return function(_0x14d97d){if(_0x14d97d){return _0x5dfd6d[_0x02b6('0x1b')](_0x32ab3b)[_0x02b6('0x1c')](_0x14d97d);}};}function respondWithFilteredResult(_0x24db71,_0x1799c0){return function(_0x482a9d){if(_0x482a9d){var _0x3b68da=typeof _0x1799c0['offset']===_0x02b6('0x1d')&&typeof _0x1799c0[_0x02b6('0x1e')]===_0x02b6('0x1d');var _0x5f3250=_0x482a9d[_0x02b6('0x1f')];var _0x4982b5=_0x3b68da?0x0:_0x1799c0[_0x02b6('0x20')];var _0x18330d=_0x3b68da?_0x482a9d[_0x02b6('0x1f')]:_0x1799c0[_0x02b6('0x20')]+_0x1799c0['limit'];var _0x3ff071;if(_0x18330d>=_0x5f3250){_0x18330d=_0x5f3250;_0x3ff071=0xc8;}else{_0x3ff071=0xce;}_0x24db71[_0x02b6('0x1b')](_0x3ff071);return _0x24db71[_0x02b6('0x21')](_0x02b6('0x22'),_0x4982b5+'-'+_0x18330d+'/'+_0x5f3250)['json'](_0x482a9d);}return null;};}function saveUpdates(_0x3ba86a){return function(_0x2f881e){if(_0x2f881e){return _0x2f881e['update'](_0x3ba86a)[_0x02b6('0x10')](function(_0xf2da9c){return _0xf2da9c;});}return null;};}function removeEntity(_0x232e8e){return function(_0x209ac9){if(_0x209ac9){return _0x209ac9[_0x02b6('0x23')]()[_0x02b6('0x10')](function(){_0x232e8e['status'](0xcc)[_0x02b6('0x24')]();});}};}function handleEntityNotFound(_0x4383cf){return function(_0x2294a9){if(!_0x2294a9){_0x4383cf[_0x02b6('0x25')](0x194);}return _0x2294a9;};}function handleError(_0x53c2f6,_0x22cdaf){_0x22cdaf=_0x22cdaf||0x1f4;return function(_0x3cce93){logger['error'](_0x3cce93[_0x02b6('0x26')]);if(_0x3cce93[_0x02b6('0x27')]){delete _0x3cce93[_0x02b6('0x27')];}_0x53c2f6[_0x02b6('0x1b')](_0x22cdaf)[_0x02b6('0x28')](_0x3cce93);};}exports[_0x02b6('0x29')]=function(_0x5dc7c1,_0x5c275f){var _0x2ea065={},_0xd1242c={},_0x47592f={'count':0x0,'rows':[]};var _0x1291bc=_[_0x02b6('0x2a')](db[_0x02b6('0x2b')][_0x02b6('0x2c')],function(_0x48b198){return{'name':_0x48b198[_0x02b6('0x2d')],'type':_0x48b198[_0x02b6('0x2e')][_0x02b6('0x2f')]};});_0xd1242c['model']=_[_0x02b6('0x2a')](_0x1291bc,_0x02b6('0x27'));_0xd1242c[_0x02b6('0x30')]=_[_0x02b6('0x31')](_0x5dc7c1[_0x02b6('0x30')]);_0xd1242c['filters']=_[_0x02b6('0x32')](_0xd1242c['model'],_0xd1242c[_0x02b6('0x30')]);_0x2ea065[_0x02b6('0x33')]=_['intersection'](_0xd1242c[_0x02b6('0x34')],qs['fields'](_0x5dc7c1[_0x02b6('0x30')][_0x02b6('0x35')]));_0x2ea065[_0x02b6('0x33')]=_0x2ea065[_0x02b6('0x33')][_0x02b6('0x36')]?_0x2ea065['attributes']:_0xd1242c[_0x02b6('0x34')];if(!_0x5dc7c1[_0x02b6('0x30')][_0x02b6('0x37')](_0x02b6('0x38'))){_0x2ea065[_0x02b6('0x1e')]=qs[_0x02b6('0x1e')](_0x5dc7c1['query'][_0x02b6('0x1e')]);_0x2ea065[_0x02b6('0x20')]=qs[_0x02b6('0x20')](_0x5dc7c1['query'][_0x02b6('0x20')]);}_0x2ea065['order']=qs[_0x02b6('0x39')](_0x5dc7c1['query']['sort']);_0x2ea065['where']=qs[_0x02b6('0x3a')](_[_0x02b6('0x3b')](_0x5dc7c1['query'],_0xd1242c[_0x02b6('0x3a')]),_0x1291bc);if(_0x5dc7c1[_0x02b6('0x30')]['filter']){_0x2ea065[_0x02b6('0x3c')]=_[_0x02b6('0x3d')](_0x2ea065[_0x02b6('0x3c')],{'$or':_[_0x02b6('0x2a')](_0x1291bc,function(_0x3febb4){if(_0x3febb4['type']!=='VIRTUAL'){var _0x3b5350={};_0x3b5350[_0x3febb4[_0x02b6('0x27')]]={'$like':'%'+_0x5dc7c1[_0x02b6('0x30')][_0x02b6('0x3e')]+'%'};return _0x3b5350;}})});}_0x2ea065=_[_0x02b6('0x3d')]({},_0x2ea065,_0x5dc7c1['options']);var _0x2be117={'where':_0x2ea065[_0x02b6('0x3c')]};return db[_0x02b6('0x2b')][_0x02b6('0x1f')](_0x2be117)[_0x02b6('0x10')](function(_0x4bf4a7){_0x47592f['count']=_0x4bf4a7;if(_0x5dc7c1['query'][_0x02b6('0x3f')]){_0x2ea065['include']=[{'all':!![]}];}return db[_0x02b6('0x2b')][_0x02b6('0x40')](_0x2ea065);})['then'](function(_0x14eee3){_0x47592f[_0x02b6('0x41')]=_0x14eee3;return _0x47592f;})['then'](respondWithFilteredResult(_0x5c275f,_0x2ea065))[_0x02b6('0x1a')](handleError(_0x5c275f,null));};exports[_0x02b6('0x42')]=function(_0x43ffab,_0x400deb){var _0x2527b7={'raw':!![],'where':{'id':_0x43ffab[_0x02b6('0x43')]['id']}},_0x3cafb1={};_0x3cafb1[_0x02b6('0x34')]=_[_0x02b6('0x31')](db[_0x02b6('0x2b')][_0x02b6('0x2c')]);_0x3cafb1['query']=_[_0x02b6('0x31')](_0x43ffab[_0x02b6('0x30')]);_0x3cafb1[_0x02b6('0x3a')]=_[_0x02b6('0x32')](_0x3cafb1['model'],_0x3cafb1[_0x02b6('0x30')]);_0x2527b7[_0x02b6('0x33')]=_[_0x02b6('0x32')](_0x3cafb1['model'],qs[_0x02b6('0x35')](_0x43ffab[_0x02b6('0x30')]['fields']));_0x2527b7['attributes']=_0x2527b7['attributes'][_0x02b6('0x36')]?_0x2527b7[_0x02b6('0x33')]:_0x3cafb1['model'];if(_0x43ffab[_0x02b6('0x30')][_0x02b6('0x3f')]){_0x2527b7[_0x02b6('0x44')]=[{'all':!![]}];}_0x2527b7=_[_0x02b6('0x3d')]({},_0x2527b7,_0x43ffab['options']);return db[_0x02b6('0x2b')]['find'](_0x2527b7)['then'](handleEntityNotFound(_0x400deb,null))[_0x02b6('0x10')](respondWithResult(_0x400deb,null))[_0x02b6('0x1a')](handleError(_0x400deb,null));};exports[_0x02b6('0x45')]=function(_0x57bd6c,_0x3dee95){if(_0x57bd6c[_0x02b6('0x46')]['id']){delete _0x57bd6c[_0x02b6('0x46')]['id'];}return db[_0x02b6('0x2b')][_0x02b6('0x47')]({'where':{'id':_0x57bd6c[_0x02b6('0x43')]['id']}})[_0x02b6('0x10')](handleEntityNotFound(_0x3dee95,null))['then'](saveUpdates(_0x57bd6c['body'],null))['then'](respondWithResult(_0x3dee95,null))[_0x02b6('0x1a')](handleError(_0x3dee95,null));};exports['destroy']=function(_0x35566c,_0x257aa8){return db['MailMessage']['find']({'where':{'id':_0x35566c[_0x02b6('0x43')]['id']}})['then'](handleEntityNotFound(_0x257aa8,null))[_0x02b6('0x10')](removeEntity(_0x257aa8,null))[_0x02b6('0x1a')](handleError(_0x257aa8,null));};exports['describe']=function(_0xa68031,_0x3989c5){return db[_0x02b6('0x2b')][_0x02b6('0x48')]()[_0x02b6('0x10')](respondWithResult(_0x3989c5,null))['catch'](handleError(_0x3989c5,null));};exports[_0x02b6('0x49')]=function(_0x2e9d25,_0x48f98f){return db[_0x02b6('0x2b')]['create'](_0x2e9d25['body'])[_0x02b6('0x10')](function(_0x8cc3f0){if(_0x8cc3f0){if(_0x8cc3f0[_0x02b6('0x4a')]===_0x02b6('0x4b')&&!_0x8cc3f0[_0x02b6('0x4c')]){var _0x232c16,_0x4497b1,_0x68e9f5;if(_0x2e9d25[_0x02b6('0x46')]['to']){_0x4497b1=_0x2e9d25['body']['to'][_0x02b6('0x4d')](',')[0x0];}return db[_0x02b6('0x4e')][_0x02b6('0x4f')]({'where':{'id':_0x8cc3f0[_0x02b6('0x50')]},'include':[{'model':db[_0x02b6('0x51')],'as':_0x02b6('0x52'),'include':[{'model':db[_0x02b6('0x53')],'as':'Contacts','where':{'email':_0x4497b1},'limit':0x1,'order':[[_0x02b6('0x54'),'DESC']]}]},{'model':db[_0x02b6('0x55')],'as':_0x02b6('0x56'),'raw':!![],'include':[{'model':db[_0x02b6('0x57')],'as':'CloudProvider','raw':!![]}]}]})[_0x02b6('0x10')](function(_0x1221c4){_0x232c16=_0x1221c4;if(!_0x232c16||!_0x232c16['Smtp'])return;var _0x342dbd=_0x232c16[_0x02b6('0x58')]();if(_0x2e9d25[_0x02b6('0x46')][_0x02b6('0x59')]&&_0x2e9d25[_0x02b6('0x46')][_0x02b6('0x59')][_0x02b6('0x36')]){for(var _0x4e3ef0=0x0;_0x4e3ef0<_0x2e9d25[_0x02b6('0x46')][_0x02b6('0x59')][_0x02b6('0x36')];_0x4e3ef0+=0x1){_0x2e9d25[_0x02b6('0x46')][_0x02b6('0x59')][_0x4e3ef0]={'filename':_0x2e9d25[_0x02b6('0x46')][_0x02b6('0x59')][_0x4e3ef0][_0x02b6('0x27')],'path':path[_0x02b6('0x5a')](config[_0x02b6('0x5b')],_0x02b6('0x5c'),_0x2e9d25[_0x02b6('0x46')][_0x02b6('0x59')][_0x4e3ef0][_0x02b6('0x5d')])};}}_0x68e9f5={'account':_0x342dbd,'message':_0x2e9d25[_0x02b6('0x46')]};return;})['then'](function(){if(_0x232c16[_0x02b6('0x52')]){if(_0x232c16['List'][_0x02b6('0x5e')][_0x02b6('0x36')]){return _0x232c16[_0x02b6('0x52')][_0x02b6('0x5e')][0x0];}else{return db[_0x02b6('0x53')][_0x02b6('0x49')](_[_0x02b6('0x5f')](_0x2e9d25[_0x02b6('0x46')],{'firstName':_0x2e9d25['body']['to'],'email':_0x2e9d25[_0x02b6('0x46')]['to'],'phone':_0x2e9d25[_0x02b6('0x46')]['to'],'ListId':_0x232c16[_0x02b6('0x60')]}));}}else{throw new Error(_0x02b6('0x61'));}})[_0x02b6('0x10')](function(){if(_0x68e9f5){return respondWithRpcPromise(_0x02b6('0x62'),_0x02b6('0x63'),_0x68e9f5,client9003)[_0x02b6('0x10')](function(_0xb4d499){return _0x8cc3f0[_0x02b6('0x45')]({'read':!![],'messageId':_0xb4d499['messageId'],'sentAt':moment()[_0x02b6('0x64')](_0x02b6('0x65'))});})[_0x02b6('0x1a')](function(_0x2cc098){logger['error']('%s',JSON['stringify'](_0x2cc098));return _0x8cc3f0;});}return _0x8cc3f0;});}return _0x8cc3f0;}})[_0x02b6('0x10')](respondWithResult(_0x48f98f,0xc9))[_0x02b6('0x1a')](handleError(_0x48f98f,null));};exports[_0x02b6('0x66')]=function(_0x18b131,_0x4d5266){var _0x13e545={'agent':{},'channel':_0x02b6('0x67')};if(_0x18b131[_0x02b6('0x46')]['id']){delete _0x18b131[_0x02b6('0x46')]['id'];}_0x18b131[_0x02b6('0x46')][_0x02b6('0x68')]=!![];_0x18b131[_0x02b6('0x46')][_0x02b6('0x69')]=moment()[_0x02b6('0x64')]('YYYY-MM-DD\x20HH:mm:ss');_0x18b131['body'][_0x02b6('0x6a')]=_0x18b131[_0x02b6('0x46')][_0x02b6('0x6a')]||_0x18b131['user']['id'];_0x13e545[_0x02b6('0x6b')]['id']=_0x18b131['body'][_0x02b6('0x6a')];return db[_0x02b6('0x2b')]['find']({'where':{'id':_0x18b131[_0x02b6('0x43')]['id'],'UserId':null}})[_0x02b6('0x10')](handleEntityNotFound(_0x4d5266,null))['then'](saveUpdates(_0x18b131[_0x02b6('0x46')],null))['then'](function(_0x5d48e4){if(_0x5d48e4){_0x13e545[_0x02b6('0x18')]=_0x5d48e4[_0x02b6('0x6c')]({'plain':!![]});return db[_0x02b6('0x6d')][_0x02b6('0x47')]({'where':{'id':_0x5d48e4[_0x02b6('0x6e')]}});}return null;})['then'](handleEntityNotFound(_0x4d5266,null))[_0x02b6('0x10')](function(_0x2ef5a9){if(_0x2ef5a9){return _0x2ef5a9[_0x02b6('0x45')]({'UserId':_0x18b131['body']['UserId'],'read1stAt':_[_0x02b6('0x6f')](_0x2ef5a9['read1stAt'])?moment()['format'](_0x02b6('0x65')):undefined});}return null;})[_0x02b6('0x10')](function(_0x5beaa9){if(_0x5beaa9){_0x13e545[_0x02b6('0x70')]=_0x5beaa9[_0x02b6('0x6c')]({'plain':!![]});interaction_log[_0x02b6('0x11')](_0x02b6('0x71'),_0x18b131[_0x02b6('0x72')]['id'],_0x18b131[_0x02b6('0x72')][_0x02b6('0x27')],_0x18b131[_0x02b6('0x72')][_0x02b6('0x73')],_0x13e545[_0x02b6('0x70')]['id'],_0x18b131[_0x02b6('0x46')]?JSON[_0x02b6('0x15')](_0x18b131[_0x02b6('0x46')]):_0x02b6('0x74'));return respondWithRpcPromise(_0x02b6('0x75'),_0x02b6('0x76'),_0x13e545);}return null;})[_0x02b6('0x10')](function(_0x1ed9a4){var _0x31b2e6=_0x02b6('0x77')+_0x1ed9a4[_0x02b6('0x18')][_0x02b6('0x78')];return db[_0x02b6('0x79')]['query'](_0x31b2e6,{'type':db[_0x02b6('0x7a')][_0x02b6('0x7b')][_0x02b6('0x7c')],'raw':!![]})[_0x02b6('0x10')](function(_0xcdcbad){return _0xcdcbad;});})['then'](function(_0x8e7848){if(_0x8e7848){_0x13e545['message'][_0x02b6('0x7d')]=_0x8e7848[0x0];if(!_0x18b131['body']['UserId'])return;return db[_0x02b6('0x7e')]['find']({'where':{'id':_0x18b131[_0x02b6('0x46')][_0x02b6('0x6a')],'role':_0x02b6('0x6b')},'attributes':['id',_0x02b6('0x27'),_0x02b6('0x7f'),'email','internal'],'raw':!![]});}return null;})[_0x02b6('0x10')](function(_0x56a8f6){if(!_0x56a8f6)return null;_0x13e545['message'][_0x02b6('0x6b')]=_0x56a8f6;return _0x13e545;})[_0x02b6('0x10')](function(_0x2b6dce){if(_0x2b6dce){if(_0x18b131[_0x02b6('0x46')][_0x02b6('0x80')]){_0x13e545[_0x02b6('0x18')]['interface']=util[_0x02b6('0x64')](_0x02b6('0x81'),_0x18b131[_0x02b6('0x72')][_0x02b6('0x27')]);_0x13e545[_0x02b6('0x18')]['channel']=_0x13e545['channel'];_0x13e545[_0x02b6('0x18')][_0x02b6('0x82')]=_0x13e545[_0x02b6('0x83')];_0x13e545[_0x02b6('0x18')][_0x02b6('0x84')]=_0x02b6('0x66');_0x13e545[_0x02b6('0x18')]['body']=htmlToText[_0x02b6('0x85')](_0x13e545[_0x02b6('0x18')]['body']);return respondWithRpcPromise(_0x02b6('0x86'),_0x02b6('0x86'),{'event':_0x02b6('0x87'),'message':_0x13e545['message']},client9002)[_0x02b6('0x10')](function(){return _0x13e545;});}return _0x13e545;}return null;})['then'](respondWithResult(_0x4d5266,null))[_0x02b6('0x1a')](handleError(_0x4d5266,null));};exports[_0x02b6('0x88')]=function(_0x1d7ba2,_0x409505){var _0x46b45d={'agent':{},'channel':_0x02b6('0x67')};if(_0x1d7ba2[_0x02b6('0x46')]['id']){delete _0x1d7ba2[_0x02b6('0x46')]['id'];}_0x1d7ba2['body'][_0x02b6('0x6a')]=_0x1d7ba2['body'][_0x02b6('0x6a')]||_0x1d7ba2['user']['id'];_0x46b45d['agent']['id']=_0x1d7ba2[_0x02b6('0x46')]['UserId'];return db['MailMessage'][_0x02b6('0x47')]({'where':{'id':_0x1d7ba2[_0x02b6('0x43')]['id'],'UserId':null}})[_0x02b6('0x10')](handleEntityNotFound(_0x409505,null))[_0x02b6('0x10')](function(_0x51aa93){if(_0x51aa93){_0x46b45d[_0x02b6('0x18')]=_0x51aa93[_0x02b6('0x6c')]({'plain':!![]});return db[_0x02b6('0x6d')][_0x02b6('0x47')]({'where':{'id':_0x51aa93['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x409505,null))[_0x02b6('0x10')](function(_0x5eff31){if(_0x5eff31){_0x46b45d[_0x02b6('0x70')]=_0x5eff31[_0x02b6('0x6c')]({'plain':!![]});interaction_log[_0x02b6('0x11')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1d7ba2[_0x02b6('0x72')]['id'],_0x1d7ba2['user'][_0x02b6('0x27')],_0x1d7ba2[_0x02b6('0x72')]['role'],_0x46b45d['interaction']['id'],_0x1d7ba2['body']?JSON[_0x02b6('0x15')](_0x1d7ba2[_0x02b6('0x46')]):'null');return respondWithRpcPromise(_0x02b6('0x89'),_0x02b6('0x8a'),_0x46b45d);}return null;})[_0x02b6('0x10')](function(_0x3d071f){var _0x53dbd4=_0x02b6('0x77')+_0x3d071f[_0x02b6('0x18')][_0x02b6('0x78')];return db['sequelize'][_0x02b6('0x30')](_0x53dbd4,{'type':db[_0x02b6('0x7a')][_0x02b6('0x7b')][_0x02b6('0x7c')],'raw':!![]})['then'](function(_0xd24141){return _0xd24141;});})['then'](function(_0x3a9652){if(_0x3a9652){_0x46b45d['message'][_0x02b6('0x7d')]=_0x3a9652[0x0];if(!_0x1d7ba2[_0x02b6('0x46')][_0x02b6('0x6a')])return;return db[_0x02b6('0x7e')][_0x02b6('0x47')]({'where':{'id':_0x1d7ba2[_0x02b6('0x46')][_0x02b6('0x6a')],'role':_0x02b6('0x6b')},'attributes':['id',_0x02b6('0x27'),'fullname',_0x02b6('0x8b'),_0x02b6('0x8c')],'raw':!![]});}return null;})[_0x02b6('0x10')](function(_0x46ff41){if(!_0x46ff41)return null;_0x46b45d['message'][_0x02b6('0x6b')]=_0x46ff41;return _0x46b45d;})['then'](function(_0x416180){if(_0x416180){_0x416180[_0x02b6('0x18')][_0x02b6('0x8d')]=util[_0x02b6('0x64')]('SIP/%s',_0x1d7ba2[_0x02b6('0x72')][_0x02b6('0x27')]);_0x416180[_0x02b6('0x18')]['channel']=_0x46b45d[_0x02b6('0x83')];_0x416180['message']['motionChannel']=_0x46b45d[_0x02b6('0x83')];_0x416180[_0x02b6('0x18')][_0x02b6('0x84')]='reject';_0x416180[_0x02b6('0x18')]['body']=htmlToText['fromString'](_0x46b45d[_0x02b6('0x18')][_0x02b6('0x46')]);respondWithRpcPromise(_0x02b6('0x86'),_0x02b6('0x86'),{'event':'rejectmessage','message':_0x416180[_0x02b6('0x18')]},client9002);return _0x46b45d;}return null;})['then'](respondWithResult(_0x409505,null))[_0x02b6('0x1a')](handleError(_0x409505,null));};exports[_0x02b6('0x8e')]=function(_0x197cde,_0x37aa45){var _0x1d60b4=moment()[_0x02b6('0x8f')]()[_0x02b6('0x90')]();var _0x4dbfd0=path[_0x02b6('0x5a')](config[_0x02b6('0x5b')],_0x02b6('0x91'),'files','tmp');var _0x390d75=path['join'](config[_0x02b6('0x5b')],_0x02b6('0x91'),_0x02b6('0x92'),_0x02b6('0x59'));var _0x4fe87b=util['format'](_0x02b6('0x93'),_0x1d60b4);return db[_0x02b6('0x2b')][_0x02b6('0x47')]({'where':{'id':_0x197cde[_0x02b6('0x43')]['id']},'attributes':['id',_0x02b6('0x46'),'from','to','cc',_0x02b6('0x94'),_0x02b6('0x95'),_0x02b6('0x96')],'include':_0x197cde[_0x02b6('0x30')][_0x02b6('0x59')]?[{'model':db[_0x02b6('0x97')],'as':_0x02b6('0x98')}]:undefined})[_0x02b6('0x10')](handleEntityNotFound(_0x37aa45,null))[_0x02b6('0x10')](function(_0x3b24d4){if(_0x3b24d4){var _0xb6feba=_0x3b24d4;var _0x538eaa={'from':_0xb6feba[_0x02b6('0x99')],'to':_0xb6feba['to'],'subject':_0xb6feba['subject'],'html':htmlEntities[_0x02b6('0x9a')](_0xb6feba[_0x02b6('0x46')]),'headers':{'Date':moment(_0xb6feba['createdAt'])['format'](_0x02b6('0x9b'))},'attachments':[]};if(_0x3b24d4['cc']){_0x538eaa[_0x02b6('0x9c')]['Cc']=_0x3b24d4['cc'];}if(_0x3b24d4[_0x02b6('0x94')]){_0x538eaa[_0x02b6('0x9c')][_0x02b6('0x9d')]=_0x3b24d4[_0x02b6('0x94')];}return new BPromise(function(_0x266937,_0x86620a){if(_0x3b24d4['Attachments']){for(var _0x28ce88=0x0;_0x28ce88<_0x3b24d4[_0x02b6('0x98')][_0x02b6('0x36')];_0x28ce88++){var _0x1548ab=_0x3b24d4[_0x02b6('0x98')][_0x28ce88];var _0x4a3df7=path[_0x02b6('0x5a')](_0x390d75,_0x1548ab[_0x02b6('0x5d')]);if(fs[_0x02b6('0x9e')](_0x4a3df7)){_0x538eaa[_0x02b6('0x59')][_0x02b6('0x9f')]({'name':_0x1548ab[_0x02b6('0x27')],'contentType':_0x1548ab[_0x02b6('0x2e')],'data':fs[_0x02b6('0xa0')](_0x4a3df7)});}}}emlformat[_0x02b6('0xa1')](_0x538eaa,function(_0x19a9fb,_0xdcfcf8){if(_0x19a9fb)return _0x86620a(_0x19a9fb);fs[_0x02b6('0xa2')](path[_0x02b6('0x5a')](_0x4dbfd0,_0x4fe87b),_0xdcfcf8);return _0x266937(_0xdcfcf8);});});}})[_0x02b6('0x10')](function(_0x369d95){if(_0x369d95){return _0x37aa45['download'](path[_0x02b6('0x5a')](_0x4dbfd0,_0x4fe87b),_0x4fe87b,function(_0x5a50ef){if(!_0x5a50ef)fs[_0x02b6('0xa3')](path['join'](_0x4dbfd0,_0x4fe87b));});}})['catch'](handleError(_0x37aa45,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 45adbef..73aa8b7 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 _0x1c5c=['../../mysqldb','MailMessage','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x4d7145,_0x1270c7){var _0x441d1d=function(_0x3933b2){while(--_0x3933b2){_0x4d7145['push'](_0x4d7145['shift']());}};_0x441d1d(++_0x1270c7);}(_0x1c5c,0xa1));var _0xc1c5=function(_0x5cda1d,_0x48a0c5){_0x5cda1d=_0x5cda1d-0x0;var _0x17c014=_0x1c5c[_0x5cda1d];return _0x17c014;};'use strict';var EventEmitter=require(_0xc1c5('0x0'));var MailMessage=require(_0xc1c5('0x1'))['db'][_0xc1c5('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc1c5('0x3'),'afterUpdate':_0xc1c5('0x4'),'afterDestroy':_0xc1c5('0x5')};function emitEvent(_0x57052e){return function(_0xb84111,_0x6cdf86,_0x134966){MailMessageEvents[_0xc1c5('0x6')](_0x57052e+':'+_0xb84111['id'],_0xb84111);MailMessageEvents['emit'](_0x57052e,_0xb84111);_0x134966(null);};}for(var e in events){if(events[_0xc1c5('0x7')](e)){var event=events[e];MailMessage[_0xc1c5('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xa6ec=['hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','remove','emit'];(function(_0x4fc971,_0x317c8f){var _0xd70e26=function(_0x19b1ec){while(--_0x19b1ec){_0x4fc971['push'](_0x4fc971['shift']());}};_0xd70e26(++_0x317c8f);}(_0xa6ec,0x1aa));var _0xca6e=function(_0x133851,_0x4d6780){_0x133851=_0x133851-0x0;var _0x188215=_0xa6ec[_0x133851];return _0x188215;};'use strict';var EventEmitter=require(_0xca6e('0x0'));var MailMessage=require(_0xca6e('0x1'))['db'][_0xca6e('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xca6e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xca6e('0x4')};function emitEvent(_0x216a6e){return function(_0x421e67,_0x5bae20,_0x37a207){MailMessageEvents['emit'](_0x216a6e+':'+_0x421e67['id'],_0x421e67);MailMessageEvents[_0xca6e('0x5')](_0x216a6e,_0x421e67);_0x37a207(null);};}for(var e in events){if(events[_0xca6e('0x6')](e)){var event=events[e];MailMessage[_0xca6e('0x7')](e,emitEvent(event));}}module[_0xca6e('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index d97aec7..e2fafd9 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 _0x6f82=['rimraf','../../config/environment','./mailMessage.attributes','exports','define','mail_messages','messageId','fti_mail_messages','subject','body','plainBody','fromString','models','get','direction','toLowerCase','out','secret','UserId','MailInteraction','findOne','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','html-to-text','path'];(function(_0x1629a9,_0x3b1393){var _0x534939=function(_0x25f54e){while(--_0x25f54e){_0x1629a9['push'](_0x1629a9['shift']());}};_0x534939(++_0x3b1393);}(_0x6f82,0x165));var _0x26f8=function(_0x1deee5,_0x1d4485){_0x1deee5=_0x1deee5-0x0;var _0x1d6c3a=_0x6f82[_0x1deee5];return _0x1d6c3a;};'use strict';var _=require(_0x26f8('0x0'));var util=require('util');var logger=require(_0x26f8('0x1'))('api');var moment=require(_0x26f8('0x2'));var BPromise=require(_0x26f8('0x3'));var rp=require('request-promise');var htmlToText=require(_0x26f8('0x4'));var fs=require('fs');var path=require(_0x26f8('0x5'));var rimraf=require(_0x26f8('0x6'));var config=require(_0x26f8('0x7'));var attributes=require(_0x26f8('0x8'));module[_0x26f8('0x9')]=function(_0x4944e9,_0xcee3b8){return _0x4944e9[_0x26f8('0xa')]('MailMessage',attributes,{'tableName':_0x26f8('0xb'),'paranoid':![],'indexes':[{'name':_0x26f8('0xc'),'fields':[_0x26f8('0xc')]},{'name':_0x26f8('0xd'),'fields':['plainBody',_0x26f8('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1b3849,_0x5656d6,_0x895fcb){if(_0x1b3849[_0x26f8('0xf')]){_0x1b3849[_0x26f8('0x10')]=htmlToText[_0x26f8('0x11')](_0x1b3849[_0x26f8('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x895fcb(null,_0x5656d6);},'afterCreate':function(_0x35f41e,_0x54e8d8,_0x55717a){var _0x2a8722=_0x4944e9[_0x26f8('0x12')];var _0x21f558=_0x35f41e[_0x26f8('0x13')]({'plain':!![]});if(_0x21f558[_0x26f8('0x14')][_0x26f8('0x15')]()==='in'||_0x21f558['direction'][_0x26f8('0x15')]()===_0x26f8('0x16')&&!_0x21f558[_0x26f8('0x17')]&&!_['isNil'](_0x21f558[_0x26f8('0x18')])){_0x2a8722[_0x26f8('0x19')][_0x26f8('0x1a')]({'where':{'id':_0x21f558['MailInteractionId']}})['then'](function(_0x1474e9){if(_0x1474e9){_0x1474e9[_0x26f8('0x1b')]({'lastMsgAt':_0x21f558[_0x26f8('0x1c')],'lastMsgDirection':_0x21f558[_0x26f8('0x14')][_0x26f8('0x15')]()});}})[_0x26f8('0x1d')](function(_0x1062d9){console[_0x26f8('0x1e')](_0x1062d9);});}_0x55717a();}},'charset':_0x26f8('0x1f'),'collate':_0x26f8('0x20')});}; \ No newline at end of file +var _0x4caa=['moment','bluebird','html-to-text','path','rimraf','./mailMessage.attributes','exports','define','mail_messages','messageId','plainBody','subject','body','fromString','models','get','direction','toLowerCase','out','secret','UserId','MailInteraction','findOne','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0xc77dce,_0x4d66e6){var _0xd6a410=function(_0x981dc6){while(--_0x981dc6){_0xc77dce['push'](_0xc77dce['shift']());}};_0xd6a410(++_0x4d66e6);}(_0x4caa,0xdd));var _0xa4ca=function(_0x4146bf,_0x25c865){_0x4146bf=_0x4146bf-0x0;var _0x5d189a=_0x4caa[_0x4146bf];return _0x5d189a;};'use strict';var _=require(_0xa4ca('0x0'));var util=require(_0xa4ca('0x1'));var logger=require(_0xa4ca('0x2'))('api');var moment=require(_0xa4ca('0x3'));var BPromise=require(_0xa4ca('0x4'));var rp=require('request-promise');var htmlToText=require(_0xa4ca('0x5'));var fs=require('fs');var path=require(_0xa4ca('0x6'));var rimraf=require(_0xa4ca('0x7'));var config=require('../../config/environment');var attributes=require(_0xa4ca('0x8'));module[_0xa4ca('0x9')]=function(_0x357523,_0x8eddbc){return _0x357523[_0xa4ca('0xa')]('MailMessage',attributes,{'tableName':_0xa4ca('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xa4ca('0xc')]},{'name':'fti_mail_messages','fields':[_0xa4ca('0xd'),_0xa4ca('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2d0e08,_0x5e4d8a,_0xc3451c){if(_0x2d0e08[_0xa4ca('0xf')]){_0x2d0e08['plainBody']=htmlToText[_0xa4ca('0x10')](_0x2d0e08['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xc3451c(null,_0x5e4d8a);},'afterCreate':function(_0xc02343,_0x2578e5,_0x5c3947){var _0x13496d=_0x357523[_0xa4ca('0x11')];var _0x186ab5=_0xc02343[_0xa4ca('0x12')]({'plain':!![]});if(_0x186ab5[_0xa4ca('0x13')][_0xa4ca('0x14')]()==='in'||_0x186ab5['direction']['toLowerCase']()===_0xa4ca('0x15')&&!_0x186ab5[_0xa4ca('0x16')]&&!_['isNil'](_0x186ab5[_0xa4ca('0x17')])){_0x13496d[_0xa4ca('0x18')][_0xa4ca('0x19')]({'where':{'id':_0x186ab5['MailInteractionId']}})[_0xa4ca('0x1a')](function(_0x5ff018){if(_0x5ff018){_0x5ff018[_0xa4ca('0x1b')]({'lastMsgAt':_0x186ab5['createdAt'],'lastMsgDirection':_0x186ab5['direction']['toLowerCase']()});}})[_0xa4ca('0x1c')](function(_0x43e432){console[_0xa4ca('0x1d')](_0x43e432);});}_0x5c3947();}},'charset':_0xa4ca('0x1e'),'collate':_0xa4ca('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 9fc262a..8c88565 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 _0x66fa=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','request','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','CreateMailMessage','MailMessage','create','body','options','raw','stringify'];(function(_0x4a3f23,_0x4d2fed){var _0x5a6b22=function(_0x5ac4d6){while(--_0x5ac4d6){_0x4a3f23['push'](_0x4a3f23['shift']());}};_0x5a6b22(++_0x4d2fed);}(_0x66fa,0x117));var _0xa66f=function(_0x24e1aa,_0x203b42){_0x24e1aa=_0x24e1aa-0x0;var _0x3cfd6a=_0x66fa[_0x24e1aa];return _0x3cfd6a;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});config[_0xa66f('0xb')]=_[_0xa66f('0xc')](config[_0xa66f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa66f('0xd'))(new Redis(config['redis']));require(_0xa66f('0xe'))['register'](socket);function respondWithRpcPromise(_0x101e10,_0x53ca76,_0x52d802){return new BPromise(function(_0x55e6dc,_0x1e1997){return client[_0xa66f('0xf')](_0x101e10,_0x52d802)['then'](function(_0x14d31e){logger['info'](_0xa66f('0x10'),_0x53ca76,'request\x20sent');logger[_0xa66f('0x11')](_0xa66f('0x12'),_0x53ca76,_0xa66f('0x13'),JSON['stringify'](_0x14d31e));if(_0x14d31e['error']){if(_0x14d31e[_0xa66f('0x14')]['code']===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x53ca76,_0x14d31e[_0xa66f('0x14')][_0xa66f('0x15')]);return _0x1e1997(_0x14d31e[_0xa66f('0x14')][_0xa66f('0x15')]);}logger[_0xa66f('0x14')]('MailMessage,\x20%s,\x20%s',_0x53ca76,_0x14d31e['error'][_0xa66f('0x15')]);return _0x55e6dc(_0x14d31e[_0xa66f('0x14')][_0xa66f('0x15')]);}else{logger[_0xa66f('0x16')]('MailMessage,\x20%s,\x20%s',_0x53ca76,_0xa66f('0x13'));_0x55e6dc(_0x14d31e['result']['message']);}})[_0xa66f('0x17')](function(_0x413e80){logger[_0xa66f('0x14')](_0xa66f('0x10'),_0x53ca76,_0x413e80);_0x1e1997(_0x413e80);});});}exports[_0xa66f('0x18')]=function(_0x408bc7){var _0x251f60=this;return new Promise(function(_0x150291,_0x2033a4){return db[_0xa66f('0x19')][_0xa66f('0x1a')](_0x408bc7[_0xa66f('0x1b')],{'raw':_0x408bc7[_0xa66f('0x1c')]?_0x408bc7[_0xa66f('0x1c')][_0xa66f('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x27f570){logger[_0xa66f('0x16')](_0xa66f('0x18'),_0x408bc7);logger[_0xa66f('0x11')]('CreateMailMessage',_0x408bc7,JSON[_0xa66f('0x1e')](_0x27f570));_0x150291(_0x27f570);})[_0xa66f('0x17')](function(_0x209f4d){logger[_0xa66f('0x14')]('CreateMailMessage',_0x209f4d['message'],_0x408bc7);_0x2033a4(_0x251f60[_0xa66f('0x14')](0x1f4,_0x209f4d['message']));});});}; \ No newline at end of file +var _0x0120=['then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','body','options','raw','CreateMailMessage','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x0120,0x6f));var _0x0012=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0120[_0x3947c9];return _0x2e7871;};'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});config['redis']=_[_0x0012('0xc')](config[_0x0012('0xd')],{'host':_0x0012('0xe'),'port':0x18eb});var socket=require(_0x0012('0xf'))(new Redis(config[_0x0012('0xd')]));require('./mailMessage.socket')[_0x0012('0x10')](socket);function respondWithRpcPromise(_0x2d484c,_0x1dc1b2,_0x323282){return new BPromise(function(_0x520171,_0x2d4674){return client['request'](_0x2d484c,_0x323282)[_0x0012('0x11')](function(_0x1d1c02){logger[_0x0012('0x12')](_0x0012('0x13'),_0x1dc1b2,_0x0012('0x14'));logger['debug'](_0x0012('0x15'),_0x1dc1b2,'request\x20sent',JSON['stringify'](_0x1d1c02));if(_0x1d1c02['error']){if(_0x1d1c02['error'][_0x0012('0x16')]===0x1f4){logger['error'](_0x0012('0x13'),_0x1dc1b2,_0x1d1c02[_0x0012('0x17')]['message']);return _0x2d4674(_0x1d1c02[_0x0012('0x17')][_0x0012('0x18')]);}logger[_0x0012('0x17')](_0x0012('0x13'),_0x1dc1b2,_0x1d1c02['error']['message']);return _0x520171(_0x1d1c02[_0x0012('0x17')][_0x0012('0x18')]);}else{logger[_0x0012('0x12')](_0x0012('0x13'),_0x1dc1b2,_0x0012('0x14'));_0x520171(_0x1d1c02[_0x0012('0x19')][_0x0012('0x18')]);}})[_0x0012('0x1a')](function(_0x5b236f){logger[_0x0012('0x17')](_0x0012('0x13'),_0x1dc1b2,_0x5b236f);_0x2d4674(_0x5b236f);});});}exports['CreateMailMessage']=function(_0x45d00b){var _0x1f54fc=this;return new Promise(function(_0xa2e623,_0x2c837e){return db['MailMessage']['create'](_0x45d00b[_0x0012('0x1b')],{'raw':_0x45d00b[_0x0012('0x1c')]?_0x45d00b[_0x0012('0x1c')][_0x0012('0x1d')]===undefined?!![]:![]:!![]})[_0x0012('0x11')](function(_0x2e6a2c){logger[_0x0012('0x12')](_0x0012('0x1e'),_0x45d00b);logger['debug'](_0x0012('0x1e'),_0x45d00b,JSON[_0x0012('0x1f')](_0x2e6a2c));_0xa2e623(_0x2e6a2c);})['catch'](function(_0x36cf42){logger[_0x0012('0x17')](_0x0012('0x1e'),_0x36cf42[_0x0012('0x18')],_0x45d00b);_0x2c837e(_0x1f54fc[_0x0012('0x17')](0x1f4,_0x36cf42['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 17cd7bd..a53c83f 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 _0xded4=['save','remove','update','removeListener','register','mailMessage:','./mailMessage.events'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xded4,0x19c));var _0x4ded=function(_0x59c4f0,_0x1e2bd5){_0x59c4f0=_0x59c4f0-0x0;var _0x2c0a2c=_0xded4[_0x59c4f0];return _0x2c0a2c;};'use strict';var MailMessageEvents=require(_0x4ded('0x0'));var events=[_0x4ded('0x1'),_0x4ded('0x2'),_0x4ded('0x3')];function createListener(_0x17a9a3,_0x2ec6bc){return function(_0x4c704b){_0x2ec6bc['emit'](_0x17a9a3,_0x4c704b);};}function removeListener(_0xe4e727,_0x5b35cc){return function(){MailMessageEvents[_0x4ded('0x4')](_0xe4e727,_0x5b35cc);};}exports[_0x4ded('0x5')]=function(_0x247ef5){for(var _0x54851c=0x0,_0x3ed48d=events['length'];_0x54851c<_0x3ed48d;_0x54851c++){var _0x233a04=events[_0x54851c];var _0x1828f4=createListener(_0x4ded('0x6')+_0x233a04,_0x247ef5);MailMessageEvents['on'](_0x233a04,_0x1828f4);}}; \ No newline at end of file +var _0x8f1f=['removeListener','length','mailMessage:','./mailMessage.events','update','emit'];(function(_0x70b06f,_0x57d602){var _0x2a1404=function(_0x16aac1){while(--_0x16aac1){_0x70b06f['push'](_0x70b06f['shift']());}};_0x2a1404(++_0x57d602);}(_0x8f1f,0xe1));var _0xf8f1=function(_0x195a3b,_0x6e9cf1){_0x195a3b=_0x195a3b-0x0;var _0x3b915f=_0x8f1f[_0x195a3b];return _0x3b915f;};'use strict';var MailMessageEvents=require(_0xf8f1('0x0'));var events=['save','remove',_0xf8f1('0x1')];function createListener(_0x10b66a,_0x37e621){return function(_0x46c11e){_0x37e621[_0xf8f1('0x2')](_0x10b66a,_0x46c11e);};}function removeListener(_0x1d2233,_0x2c6a47){return function(){MailMessageEvents[_0xf8f1('0x3')](_0x1d2233,_0x2c6a47);};}exports['register']=function(_0x18a890){for(var _0x1fee13=0x0,_0x122134=events[_0xf8f1('0x4')];_0x1fee13<_0x122134;_0x1fee13++){var _0x9609e9=events[_0x1fee13];var _0x4bd078=createListener(_0xf8f1('0x5')+_0x9609e9,_0x18a890);MailMessageEvents['on'](_0x9609e9,_0x4bd078);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 91eba79..bd7eae7 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 _0xcb0b=['fs-extra','../../components/auth/service','../../config/environment','./mailQueue.controller','get','describe','/:id','/:id/members','isAuthenticated','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0xcb0b,0xf7));var _0xbcb0=function(_0x25f642,_0x158db4){_0x25f642=_0x25f642-0x0;var _0x3c658e=_0xcb0b[_0x25f642];return _0x3c658e;};'use strict';var multer=require(_0xbcb0('0x0'));var util=require(_0xbcb0('0x1'));var path=require('path');var timeout=require(_0xbcb0('0x2'));var express=require(_0xbcb0('0x3'));var router=express[_0xbcb0('0x4')]();var fs_extra=require(_0xbcb0('0x5'));var auth=require(_0xbcb0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbcb0('0x7'));var controller=require(_0xbcb0('0x8'));router[_0xbcb0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xbcb0('0xa')]);router[_0xbcb0('0x9')](_0xbcb0('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xbcb0('0x9')](_0xbcb0('0xc'),auth[_0xbcb0('0xd')](),controller[_0xbcb0('0xe')]);router[_0xbcb0('0x9')](_0xbcb0('0xf'),auth[_0xbcb0('0xd')](),controller[_0xbcb0('0x10')]);router['get'](_0xbcb0('0x11'),auth[_0xbcb0('0xd')](),controller[_0xbcb0('0x12')]);router['post']('/',auth[_0xbcb0('0xd')](),controller[_0xbcb0('0x13')]);router[_0xbcb0('0x14')]('/:id/teams',auth[_0xbcb0('0xd')](),controller['addTeams']);router[_0xbcb0('0x14')](_0xbcb0('0x11'),auth['isAuthenticated'](),controller[_0xbcb0('0x15')]);router['put'](_0xbcb0('0xb'),auth['isAuthenticated'](),controller[_0xbcb0('0x16')]);router[_0xbcb0('0x17')](_0xbcb0('0xb'),auth[_0xbcb0('0xd')](),controller[_0xbcb0('0x18')]);router[_0xbcb0('0x17')](_0xbcb0('0xf'),auth[_0xbcb0('0xd')](),controller[_0xbcb0('0x19')]);router[_0xbcb0('0x17')](_0xbcb0('0x11'),auth[_0xbcb0('0xd')](),controller[_0xbcb0('0x1a')]);module[_0xbcb0('0x1b')]=router; \ No newline at end of file +var _0xc705=['show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4450b1,_0x214ace){var _0x399b0b=function(_0x2197df){while(--_0x2197df){_0x4450b1['push'](_0x4450b1['shift']());}};_0x399b0b(++_0x214ace);}(_0xc705,0x125));var _0x5c70=function(_0x31b31b,_0x5f044e){_0x31b31b=_0x31b31b-0x0;var _0x2c8fc2=_0xc705[_0x31b31b];return _0x2c8fc2;};'use strict';var multer=require(_0x5c70('0x0'));var util=require(_0x5c70('0x1'));var path=require(_0x5c70('0x2'));var timeout=require(_0x5c70('0x3'));var express=require(_0x5c70('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5c70('0x5'));var interaction=require(_0x5c70('0x6'));var config=require(_0x5c70('0x7'));var controller=require(_0x5c70('0x8'));router[_0x5c70('0x9')]('/',auth[_0x5c70('0xa')](),controller[_0x5c70('0xb')]);router[_0x5c70('0x9')](_0x5c70('0xc'),auth[_0x5c70('0xa')](),controller[_0x5c70('0xd')]);router[_0x5c70('0x9')](_0x5c70('0xe'),auth['isAuthenticated'](),controller[_0x5c70('0xf')]);router[_0x5c70('0x9')](_0x5c70('0x10'),auth['isAuthenticated'](),controller[_0x5c70('0x11')]);router[_0x5c70('0x9')](_0x5c70('0x12'),auth[_0x5c70('0xa')](),controller[_0x5c70('0x13')]);router['get'](_0x5c70('0x14'),auth['isAuthenticated'](),controller[_0x5c70('0x15')]);router['post']('/',auth[_0x5c70('0xa')](),controller['create']);router[_0x5c70('0x16')](_0x5c70('0x12'),auth[_0x5c70('0xa')](),controller[_0x5c70('0x17')]);router[_0x5c70('0x16')](_0x5c70('0x14'),auth[_0x5c70('0xa')](),controller[_0x5c70('0x18')]);router['put'](_0x5c70('0xe'),auth[_0x5c70('0xa')](),controller['update']);router[_0x5c70('0x19')]('/:id',auth[_0x5c70('0xa')](),controller['destroy']);router['delete'](_0x5c70('0x12'),auth['isAuthenticated'](),controller[_0x5c70('0x1a')]);router[_0x5c70('0x19')](_0x5c70('0x14'),auth[_0x5c70('0xa')](),controller[_0x5c70('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 1982310..b403a3c 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 _0xe739=['INTEGER','ENUM','roundrobin','sequelize','exports','name','STRING'];(function(_0x4b6bb3,_0x2a5c7c){var _0x2ae946=function(_0xf65e57){while(--_0xf65e57){_0x4b6bb3['push'](_0x4b6bb3['shift']());}};_0x2ae946(++_0x2a5c7c);}(_0xe739,0x7a));var _0x9e73=function(_0x4e6e0c,_0x1def73){_0x4e6e0c=_0x4e6e0c-0x0;var _0x514e31=_0xe739[_0x4e6e0c];return _0x514e31;};'use strict';var Sequelize=require(_0x9e73('0x0'));module[_0x9e73('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9e73('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9e73('0x3')]},'timeout':{'type':Sequelize[_0x9e73('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9e73('0x5')]('rrmemory','beepall',_0x9e73('0x6'))}}; \ No newline at end of file +var _0x4a55=['sequelize','exports','name','INTEGER','ENUM','beepall'];(function(_0x2ff739,_0x1c8e0f){var _0x12dc13=function(_0x26fc97){while(--_0x26fc97){_0x2ff739['push'](_0x2ff739['shift']());}};_0x12dc13(++_0x1c8e0f);}(_0x4a55,0x126));var _0x54a5=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x4a55[_0x50007c];return _0x5c1ec7;};'use strict';var Sequelize=require(_0x54a5('0x0'));module[_0x54a5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x54a5('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x54a5('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x54a5('0x4')]('rrmemory',_0x54a5('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index e14fbd9..03fe5e8 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 _0xd80e=['MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','getAgents','bluebird','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./mailQueue.socket','sendStatus','status','json','undefined','count','offset','limit','Content-Range','update','then','destroy','get','end','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','length','nolimit','order','sort','pick','MailQueueId','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','%s/%s','SIP','Team','filter','getTeams','hasOwnProperty','ids','Agents','online','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','field','from','join','user_has_teams'];(function(_0x5e4624,_0x3fc116){var _0x104047=function(_0x522799){while(--_0x522799){_0x5e4624['push'](_0x5e4624['shift']());}};_0x104047(++_0x3fc116);}(_0xd80e,0x174));var _0xed80=function(_0x797d7e,_0xc00354){_0x797d7e=_0x797d7e-0x0;var _0x36552c=_0xd80e[_0x797d7e];return _0x36552c;};'use strict';var BPromise=require(_0xed80('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0xed80('0x1'));var Redis=require('ioredis');var qs=require(_0xed80('0x2'));var logger=require(_0xed80('0x3'))(_0xed80('0x4'));var config=require(_0xed80('0x5'));var db=require(_0xed80('0x6'))['db'];config[_0xed80('0x7')]=_['defaults'](config[_0xed80('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xed80('0x8'))(new Redis(config[_0xed80('0x7')]));require(_0xed80('0x9'))['register'](socket);function respondWithStatusCode(_0x60766e,_0x47b190){_0x47b190=_0x47b190||0xcc;return function(_0x59ce4e){if(_0x59ce4e){return _0x60766e[_0xed80('0xa')](_0x47b190);}return _0x60766e[_0xed80('0xb')](_0x47b190)['end']();};}function respondWithResult(_0x26a7c1,_0x5648bd){_0x5648bd=_0x5648bd||0xc8;return function(_0x29a3b8){if(_0x29a3b8){return _0x26a7c1[_0xed80('0xb')](_0x5648bd)[_0xed80('0xc')](_0x29a3b8);}};}function respondWithFilteredResult(_0x3064ab,_0x20583f){return function(_0x2eb50b){if(_0x2eb50b){var _0x672ca8=typeof _0x20583f['offset']===_0xed80('0xd')&&typeof _0x20583f['limit']===_0xed80('0xd');var _0x53957f=_0x2eb50b[_0xed80('0xe')];var _0x16d243=_0x672ca8?0x0:_0x20583f[_0xed80('0xf')];var _0x5a38d0=_0x672ca8?_0x2eb50b[_0xed80('0xe')]:_0x20583f[_0xed80('0xf')]+_0x20583f[_0xed80('0x10')];var _0x190bec;if(_0x5a38d0>=_0x53957f){_0x5a38d0=_0x53957f;_0x190bec=0xc8;}else{_0x190bec=0xce;}_0x3064ab['status'](_0x190bec);return _0x3064ab['set'](_0xed80('0x11'),_0x16d243+'-'+_0x5a38d0+'/'+_0x53957f)[_0xed80('0xc')](_0x2eb50b);}return null;};}function saveUpdates(_0x43fe4d){return function(_0x2b13f5){if(_0x2b13f5){return _0x2b13f5[_0xed80('0x12')](_0x43fe4d)[_0xed80('0x13')](function(_0x2f92d5){return _0x2f92d5;});}return null;};}function removeEntity(_0x1b3d38){return function(_0xe1ae28){if(_0xe1ae28){return _0xe1ae28[_0xed80('0x14')]()[_0xed80('0x13')](function(){var _0x2e774d=_0xe1ae28[_0xed80('0x15')]({'plain':!![]});var _0x146f8a='MailQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x146f8a,'resourceId':_0x2e774d['id']}})[_0xed80('0x13')](function(){return _0xe1ae28;});})[_0xed80('0x13')](function(){_0x1b3d38[_0xed80('0xb')](0xcc)[_0xed80('0x16')]();});}};}function handleEntityNotFound(_0x2a02dc){return function(_0x331ea6){if(!_0x331ea6){_0x2a02dc[_0xed80('0xa')](0x194);}return _0x331ea6;};}function handleError(_0x24337b,_0xef516){_0xef516=_0xef516||0x1f4;return function(_0x5dbc10){logger['error'](_0x5dbc10[_0xed80('0x17')]);if(_0x5dbc10[_0xed80('0x18')]){delete _0x5dbc10[_0xed80('0x18')];}_0x24337b['status'](_0xef516)[_0xed80('0x19')](_0x5dbc10);};}exports[_0xed80('0x1a')]=function(_0x5dc7b8,_0x494b98){var _0xc6caa3={};var _0x221ece={'count':0x0,'rows':[]};var _0x4e2e46=_[_0xed80('0x1b')](db[_0xed80('0x1c')][_0xed80('0x1d')],function(_0x19f60b){return{'name':_0x19f60b[_0xed80('0x1e')],'type':_0x19f60b[_0xed80('0x1f')][_0xed80('0x20')]};});_0xc6caa3=qs[_0xed80('0x21')](_0x4e2e46,_0x5dc7b8);var _0x395a5a={'where':_0xc6caa3[_0xed80('0x22')]};return db[_0xed80('0x1c')][_0xed80('0xe')](_0x395a5a)[_0xed80('0x13')](function(_0x49ad20){_0x221ece[_0xed80('0xe')]=_0x49ad20;_0xc6caa3[_0xed80('0x23')]=qs[_0xed80('0x23')](_0x5dc7b8[_0xed80('0x24')]);return db[_0xed80('0x1c')][_0xed80('0x25')](_0xc6caa3);})[_0xed80('0x13')](function(_0x5b90bf){_0x221ece[_0xed80('0x26')]=_0x5b90bf;return _0x221ece;})[_0xed80('0x13')](respondWithFilteredResult(_0x494b98,_0xc6caa3))[_0xed80('0x27')](handleError(_0x494b98,null));};exports[_0xed80('0x28')]=function(_0x195946,_0xd7df44){var _0x50cfde={'raw':!![],'where':{'id':_0x195946[_0xed80('0x29')]['id']}},_0x8cc3a9={};_0x8cc3a9[_0xed80('0x2a')]=_[_0xed80('0x2b')](db[_0xed80('0x1c')][_0xed80('0x1d')]);_0x8cc3a9[_0xed80('0x24')]=_[_0xed80('0x2b')](_0x195946['query']);_0x8cc3a9[_0xed80('0x2c')]=_[_0xed80('0x2d')](_0x8cc3a9[_0xed80('0x2a')],_0x8cc3a9['query']);_0x50cfde[_0xed80('0x2e')]=_['intersection'](_0x8cc3a9['model'],qs[_0xed80('0x2f')](_0x195946[_0xed80('0x24')]['fields']));_0x50cfde[_0xed80('0x2e')]=_0x50cfde[_0xed80('0x2e')]['length']?_0x50cfde[_0xed80('0x2e')]:_0x8cc3a9['model'];if(_0x195946[_0xed80('0x24')]['includeAll']){_0x50cfde['include']=[{'all':!![]}];}_0x50cfde=_[_0xed80('0x30')]({},_0x50cfde,_0x195946[_0xed80('0x31')]);return db[_0xed80('0x1c')][_0xed80('0x32')](_0x50cfde)['then'](handleEntityNotFound(_0xd7df44,null))[_0xed80('0x13')](respondWithResult(_0xd7df44,null))[_0xed80('0x27')](handleError(_0xd7df44,null));};exports['create']=function(_0xf87901,_0x3c0a05){return db['MailQueue'][_0xed80('0x33')](_0xf87901[_0xed80('0x34')],{})[_0xed80('0x13')](function(_0x32901f){var _0x583b55=_0xf87901[_0xed80('0x35')][_0xed80('0x15')]({'plain':!![]});if(!_0x583b55)throw new Error(_0xed80('0x36'));if(_0x583b55[_0xed80('0x37')]==='user'){var _0x4fa547=_0x32901f[_0xed80('0x15')]({'plain':!![]});var _0x4eea2a=_0xed80('0x38');return db['UserProfileSection'][_0xed80('0x32')]({'where':{'name':_0x4eea2a,'userProfileId':_0x583b55[_0xed80('0x39')]},'raw':!![]})[_0xed80('0x13')](function(_0x5257e6){if(_0x5257e6&&_0x5257e6[_0xed80('0x3a')]===0x0){return db[_0xed80('0x3b')]['create']({'name':_0x4fa547[_0xed80('0x18')],'resourceId':_0x4fa547['id'],'type':_0x5257e6['name'],'sectionId':_0x5257e6['id']},{})[_0xed80('0x13')](function(){return _0x32901f;});}else{return _0x32901f;}})[_0xed80('0x27')](function(_0xf31278){logger[_0xed80('0x3c')](_0xed80('0x3d'),_0xf31278);throw _0xf31278;});}return _0x32901f;})['then'](respondWithResult(_0x3c0a05,0xc9))[_0xed80('0x27')](handleError(_0x3c0a05,null));};exports[_0xed80('0x12')]=function(_0x51cb4d,_0x3fafb4){if(_0x51cb4d[_0xed80('0x34')]['id']){delete _0x51cb4d[_0xed80('0x34')]['id'];}return db[_0xed80('0x1c')][_0xed80('0x32')]({'where':{'id':_0x51cb4d[_0xed80('0x29')]['id']}})['then'](handleEntityNotFound(_0x3fafb4,null))['then'](saveUpdates(_0x51cb4d['body'],null))[_0xed80('0x13')](respondWithResult(_0x3fafb4,null))[_0xed80('0x27')](handleError(_0x3fafb4,null));};exports['destroy']=function(_0x330be1,_0x5b7e69){return db[_0xed80('0x1c')]['find']({'where':{'id':_0x330be1[_0xed80('0x29')]['id']}})[_0xed80('0x13')](handleEntityNotFound(_0x5b7e69,null))['then'](removeEntity(_0x5b7e69,null))['catch'](handleError(_0x5b7e69,null));};exports[_0xed80('0x3e')]=function(_0x51a07f,_0x595436){return db[_0xed80('0x1c')][_0xed80('0x3e')]()[_0xed80('0x13')](respondWithResult(_0x595436,null))['catch'](handleError(_0x595436,null));};exports[_0xed80('0x3f')]=function(_0x154c69,_0x43487b){var _0x223f4a={'raw':!![],'where':{}},_0x5b24be={},_0x30a855;return db['MailQueue'][_0xed80('0x40')]({'where':{'id':_0x154c69[_0xed80('0x29')]['id']}})['then'](handleEntityNotFound(_0x43487b,null))[_0xed80('0x13')](function(_0x193a91){if(_0x193a91){_0x30a855=_0x193a91[_0xed80('0x15')]({'plain':!![]});_0x5b24be[_0xed80('0x2a')]=_[_0xed80('0x2b')](db[_0xed80('0x41')][_0xed80('0x1d')]);_0x5b24be['query']=_[_0xed80('0x2b')](_0x154c69[_0xed80('0x24')]);_0x5b24be['filters']=_[_0xed80('0x2d')](_0x5b24be[_0xed80('0x2a')],_0x5b24be[_0xed80('0x24')]);_0x223f4a[_0xed80('0x2e')]=_[_0xed80('0x2d')](_0x5b24be[_0xed80('0x2a')],qs[_0xed80('0x2f')](_0x154c69['query']['fields']));_0x223f4a['attributes']=_0x223f4a[_0xed80('0x2e')][_0xed80('0x42')]?_0x223f4a[_0xed80('0x2e')]:_0x5b24be[_0xed80('0x2a')];if(!_0x154c69['query']['hasOwnProperty'](_0xed80('0x43'))){_0x223f4a[_0xed80('0x10')]=qs[_0xed80('0x10')](_0x154c69[_0xed80('0x24')]['limit']);_0x223f4a[_0xed80('0xf')]=qs[_0xed80('0xf')](_0x154c69[_0xed80('0x24')][_0xed80('0xf')]);}_0x223f4a[_0xed80('0x44')]=qs[_0xed80('0x45')](_0x154c69[_0xed80('0x24')][_0xed80('0x45')]);_0x223f4a[_0xed80('0x22')]=qs[_0xed80('0x2c')](_[_0xed80('0x46')](_0x154c69[_0xed80('0x24')],_0x5b24be[_0xed80('0x2c')]));_0x223f4a[_0xed80('0x22')][_0xed80('0x47')]=_0x193a91['id'];if(_0x154c69[_0xed80('0x24')]['filter']){_0x223f4a['where']=_[_0xed80('0x30')](_0x223f4a[_0xed80('0x22')],{'$or':_[_0xed80('0x1b')](_0x223f4a[_0xed80('0x2e')],function(_0x14f3ee){var _0x546a60={};_0x546a60[_0x14f3ee]={'$like':'%'+_0x154c69['query']['filter']+'%'};return _0x546a60;})});}_0x223f4a=_[_0xed80('0x30')]({},_0x223f4a,_0x154c69['options']);return db[_0xed80('0x41')][_0xed80('0x25')](_0x223f4a);}})[_0xed80('0x13')](function(_0x35991d){if(_0x35991d){return db[_0xed80('0x48')][_0xed80('0x49')]({'where':{'id':_['map'](_0x35991d,_0xed80('0x4a')),'role':'agent'},'attributes':['id',_0xed80('0x18'),_0xed80('0x4b'),_0xed80('0x4c'),_0xed80('0x4d')]});}})[_0xed80('0x13')](function(_0x40a610){if(_0x40a610){return{'count':_0x40a610[_0xed80('0xe')],'rows':_[_0xed80('0x1b')](_0x40a610[_0xed80('0x26')],function(_0x3e7752){return{'membername':_0x3e7752[_0xed80('0x18')],'UserId':_0x3e7752['id'],'queue_name':_0x30a855['name'],'MailQueueId':_0x30a855['id'],'interface':util[_0xed80('0x4e')](_0xed80('0x4f'),_0xed80('0x50'),_0x3e7752['name']),'penalty':0x0,'paused':_0x3e7752[_0xed80('0x4b')],'createdAt':_0x3e7752[_0xed80('0x4d')],'updatedAt':_0x3e7752[_0xed80('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xed80('0x13')](respondWithFilteredResult(_0x43487b,_0x223f4a))[_0xed80('0x27')](handleError(_0x43487b,null));};exports['getTeams']=function(_0x388d99,_0x1d9a5a){var _0x2f1b56={};var _0x494070={};var _0x26edac;var _0x5ecd25;return db['MailQueue'][_0xed80('0x40')]({'where':{'id':_0x388d99['params']['id']}})[_0xed80('0x13')](handleEntityNotFound(_0x1d9a5a,null))[_0xed80('0x13')](function(_0x318078){if(_0x318078){_0x26edac=_0x318078;_0x494070[_0xed80('0x2a')]=_[_0xed80('0x2b')](db[_0xed80('0x51')][_0xed80('0x1d')]);_0x494070[_0xed80('0x24')]=_['keys'](_0x388d99[_0xed80('0x24')]);_0x494070['filters']=_['intersection'](_0x494070['model'],_0x494070['query']);_0x2f1b56[_0xed80('0x2e')]=_[_0xed80('0x2d')](_0x494070['model'],qs[_0xed80('0x2f')](_0x388d99[_0xed80('0x24')]['fields']));_0x2f1b56[_0xed80('0x2e')]=_0x2f1b56[_0xed80('0x2e')]['length']?_0x2f1b56[_0xed80('0x2e')]:_0x494070[_0xed80('0x2a')];_0x2f1b56['order']=qs[_0xed80('0x45')](_0x388d99[_0xed80('0x24')][_0xed80('0x45')]);_0x2f1b56[_0xed80('0x22')]=qs['filters'](_[_0xed80('0x46')](_0x388d99[_0xed80('0x24')],_0x494070[_0xed80('0x2c')]));if(_0x388d99['query'][_0xed80('0x52')]){_0x2f1b56[_0xed80('0x22')]=_[_0xed80('0x30')](_0x2f1b56[_0xed80('0x22')],{'$or':_[_0xed80('0x1b')](_0x2f1b56['attributes'],function(_0x2fbe46){var _0x4ce4a1={};_0x4ce4a1[_0x2fbe46]={'$like':'%'+_0x388d99['query'][_0xed80('0x52')]+'%'};return _0x4ce4a1;})});}_0x2f1b56=_[_0xed80('0x30')]({},_0x2f1b56,_0x388d99[_0xed80('0x31')]);return _0x26edac[_0xed80('0x53')](_0x2f1b56);}})['then'](function(_0x21e9d3){if(_0x21e9d3){_0x5ecd25=_0x21e9d3[_0xed80('0x42')];if(!_0x388d99[_0xed80('0x24')][_0xed80('0x54')](_0xed80('0x43'))){_0x2f1b56['limit']=qs[_0xed80('0x10')](_0x388d99[_0xed80('0x24')][_0xed80('0x10')]);_0x2f1b56['offset']=qs[_0xed80('0xf')](_0x388d99['query'][_0xed80('0xf')]);}return _0x26edac['getTeams'](_0x2f1b56);}})[_0xed80('0x13')](function(_0x1527ec){if(_0x1527ec){return _0x1527ec?{'count':_0x5ecd25,'rows':_0x1527ec}:null;}})['then'](respondWithResult(_0x1d9a5a,null))['catch'](handleError(_0x1d9a5a,null));};exports['addTeams']=function(_0x291d3f,_0x1729f7){var _0x320832=_0x291d3f[_0xed80('0x34')][_0xed80('0x55')];return db[_0xed80('0x51')][_0xed80('0x25')]({'where':{'id':_0x320832},'attributes':['id'],'include':[{'model':db[_0xed80('0x48')],'as':_0xed80('0x56'),'attributes':['id','name',_0xed80('0x57'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x539e69){if(_0x539e69){var _0x49ff9e=_[_0xed80('0x58')](_0x539e69,function(_0x1e4b2){var _0x5a0163=_0x1e4b2['get']({'plain':!![]});return _0x5a0163[_0xed80('0x56')];});return db[_0xed80('0x1c')][_0xed80('0x32')]({'where':{'id':_0x291d3f[_0xed80('0x29')]['id']}})['then'](function(_0x53f4ce){return db[_0xed80('0x59')][_0xed80('0x5a')](function(_0x5ba17e){return _0x53f4ce['addTeams'](_0x320832,{'transaction':_0x5ba17e})[_0xed80('0x13')](function(){return BPromise['each'](_0x49ff9e,function(_0x27a66a){return db['UserMailQueue'][_0xed80('0x5b')]({'where':{'UserId':_0x27a66a['id'],'MailQueueId':_0x291d3f['params']['id']},'transaction':_0x5ba17e});});})[_0xed80('0x13')](function(){_0x49ff9e[_0xed80('0x5c')](function(_0x26af72){socket[_0xed80('0x5d')](_0xed80('0x5e'),{'UserId':_0x26af72['id'],'MailQueueId':_0x53f4ce['id']});});});});});}})['then'](respondWithStatusCode(_0x1729f7,null))['catch'](handleError(_0x1729f7,null));};exports[_0xed80('0x5f')]=function(_0x47887c,_0x9ff647){return db[_0xed80('0x51')][_0xed80('0x25')]({'where':{'id':_0x47887c[_0xed80('0x24')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xed80('0x56'),'attributes':['id'],'raw':!![]}]})[_0xed80('0x13')](handleEntityNotFound(_0x9ff647,null))[_0xed80('0x13')](function(_0x33b143){var _0x4f884c=_[_0xed80('0x1b')](_0x33b143,'id');var _0x4fa5ee=[];var _0x3bdf13=[];var _0x3f2f23=squel['select']();_0x3f2f23[_0xed80('0x60')]('tq.TeamId')[_0xed80('0x61')]('team_has_mail_queues','tq')[_0xed80('0x62')](_0xed80('0x63'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xed80('0x22')](_0xed80('0x64'),_0x47887c[_0xed80('0x29')]['id']);for(var _0x56dce8=0x0;_0x56dce8<_0x33b143['length'];_0x56dce8+=0x1){let _0x1b21f7=_0x33b143[_0x56dce8];for(var _0x7cce84=0x0;_0x7cce84<_0x1b21f7[_0xed80('0x56')]['length'];_0x7cce84+=0x1){let _0x11af08=_0x1b21f7[_0xed80('0x56')][_0x7cce84];var _0x3431b7=_0x3f2f23[_0xed80('0x65')]();_0x3431b7['where'](_0xed80('0x66'),_0x11af08['id']);_0x3bdf13[_0xed80('0x67')](db[_0xed80('0x59')]['query'](_0x3431b7[_0xed80('0x68')](),{'type':db['sequelize'][_0xed80('0x69')][_0xed80('0x6a')]})[_0xed80('0x13')](function(_0x3200f9){if(_0x3200f9[_0xed80('0x42')]===0x1){return _0x11af08['id'];}else{var _0x56b954=_['every'](_[_0xed80('0x1b')](_0x3200f9,'TeamId'),function(_0x589ea1){return _[_0xed80('0x6b')](_0x4f884c,_0x589ea1);});if(_0x56b954){return _0x11af08['id'];}}}));}}return BPromise['all'](_0x3bdf13)[_0xed80('0x13')](function(_0x164659){_0x4fa5ee=_(_0x4fa5ee)[_0xed80('0x6c')](_0x164659)[_0xed80('0x6d')]()[_0xed80('0x6e')]();return db[_0xed80('0x1c')]['find']({'where':{'id':_0x47887c['params']['id']}})[_0xed80('0x13')](function(_0x1df050){return db[_0xed80('0x59')][_0xed80('0x5a')](function(_0x60c4e6){return _0x1df050['removeTeams'](_0x47887c[_0xed80('0x24')][_0xed80('0x55')],{'transaction':_0x60c4e6})[_0xed80('0x13')](function(){if(!_[_0xed80('0x6f')](_0x4fa5ee)){return _0x1df050[_0xed80('0x70')](_0x4fa5ee,{'transaction':_0x60c4e6});}})[_0xed80('0x13')](function(){_0x4fa5ee[_0xed80('0x5c')](function(_0x4b6925){socket[_0xed80('0x5d')](_0xed80('0x71'),{'UserId':_0x4b6925,'MailQueueId':_0x1df050['id']});});});});});});})['then'](respondWithStatusCode(_0x9ff647,null))[_0xed80('0x27')](handleError(_0x9ff647,null));};exports[_0xed80('0x72')]=function(_0x3abdb4,_0x1b4672){return db[_0xed80('0x1c')]['find']({'where':{'id':_0x3abdb4[_0xed80('0x29')]['id']}})[_0xed80('0x13')](handleEntityNotFound(_0x1b4672,null))['then'](function(_0x35a475){if(_0x35a475){return _0x35a475['addAgents'](_0x3abdb4['body'][_0xed80('0x55')],_[_0xed80('0x73')](_0x3abdb4['body'],['ids','id'])||{})[_0xed80('0x74')](function(_0x330d62){for(var _0x3143f5=0x0;_0x3143f5<_0x3abdb4[_0xed80('0x34')]['ids'][_0xed80('0x42')];_0x3143f5+=0x1){socket[_0xed80('0x5d')](_0xed80('0x5e'),{'UserId':Number(_0x3abdb4[_0xed80('0x34')][_0xed80('0x55')][_0x3143f5]),'MailQueueId':Number(_0x3abdb4[_0xed80('0x29')]['id'])});}return _0x330d62;});}})['then'](respondWithResult(_0x1b4672,null))[_0xed80('0x27')](handleError(_0x1b4672,null));};exports['removeAgents']=function(_0x3cbfdf,_0x21b56e){return db[_0xed80('0x1c')][_0xed80('0x32')]({'where':{'id':_0x3cbfdf[_0xed80('0x29')]['id']}})[_0xed80('0x13')](handleEntityNotFound(_0x21b56e,null))[_0xed80('0x13')](function(_0x3b48cb){if(_0x3b48cb){return _0x3b48cb[_0xed80('0x70')](_0x3cbfdf[_0xed80('0x24')][_0xed80('0x55')])[_0xed80('0x13')](function(){if(_['isArray'](_0x3cbfdf[_0xed80('0x24')][_0xed80('0x55')])){for(var _0xbce533=0x0;_0xbce533<_0x3cbfdf[_0xed80('0x24')][_0xed80('0x55')][_0xed80('0x42')];_0xbce533+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x3cbfdf[_0xed80('0x24')][_0xed80('0x55')][_0xbce533]),'MailQueueId':Number(_0x3cbfdf['params']['id'])});}}else{socket[_0xed80('0x5d')](_0xed80('0x71'),{'UserId':Number(_0x3cbfdf[_0xed80('0x24')][_0xed80('0x55')]),'MailQueueId':Number(_0x3cbfdf['params']['id'])});}});}})[_0xed80('0x13')](respondWithStatusCode(_0x21b56e,null))['catch'](handleError(_0x21b56e,null));};exports[_0xed80('0x75')]=function(_0x284d3e,_0x4b8e32){var _0x298d7b={};var _0x9b7c5c={};var _0xf85198;var _0x4f4d24;return db[_0xed80('0x1c')][_0xed80('0x40')]({'where':{'id':_0x284d3e[_0xed80('0x29')]['id']}})['then'](handleEntityNotFound(_0x4b8e32,null))[_0xed80('0x13')](function(_0x203250){if(_0x203250){_0xf85198=_0x203250;_0x9b7c5c[_0xed80('0x2a')]=_[_0xed80('0x2b')](db[_0xed80('0x48')][_0xed80('0x1d')]);_0x9b7c5c[_0xed80('0x24')]=_[_0xed80('0x2b')](_0x284d3e[_0xed80('0x24')]);_0x9b7c5c[_0xed80('0x2c')]=_['intersection'](_0x9b7c5c[_0xed80('0x2a')],_0x9b7c5c['query']);_0x298d7b[_0xed80('0x2e')]=_[_0xed80('0x2d')](_0x9b7c5c[_0xed80('0x2a')],qs['fields'](_0x284d3e[_0xed80('0x24')][_0xed80('0x2f')]));_0x298d7b[_0xed80('0x2e')]=_0x298d7b['attributes'][_0xed80('0x42')]?_0x298d7b[_0xed80('0x2e')]:_0x9b7c5c[_0xed80('0x2a')];_0x298d7b['order']=qs[_0xed80('0x45')](_0x284d3e[_0xed80('0x24')][_0xed80('0x45')]);_0x298d7b[_0xed80('0x22')]=qs[_0xed80('0x2c')](_[_0xed80('0x46')](_0x284d3e['query'],_0x9b7c5c['filters']));if(_0x284d3e[_0xed80('0x24')][_0xed80('0x52')]){_0x298d7b[_0xed80('0x22')]=_[_0xed80('0x30')](_0x298d7b[_0xed80('0x22')],{'$or':_[_0xed80('0x1b')](_0x298d7b[_0xed80('0x2e')],function(_0x1ad937){var _0x5b76b5={};_0x5b76b5[_0x1ad937]={'$like':'%'+_0x284d3e['query'][_0xed80('0x52')]+'%'};return _0x5b76b5;})});}_0x298d7b=_['merge']({},_0x298d7b,_0x284d3e[_0xed80('0x31')]);return _0xf85198[_0xed80('0x75')](_0x298d7b);}})[_0xed80('0x13')](function(_0x8b9103){if(_0x8b9103){_0x4f4d24=_0x8b9103['length'];if(!_0x284d3e[_0xed80('0x24')][_0xed80('0x54')](_0xed80('0x43'))){_0x298d7b[_0xed80('0x10')]=qs[_0xed80('0x10')](_0x284d3e[_0xed80('0x24')]['limit']);_0x298d7b[_0xed80('0xf')]=qs[_0xed80('0xf')](_0x284d3e[_0xed80('0x24')][_0xed80('0xf')]);}return _0xf85198['getAgents'](_0x298d7b);}})['then'](function(_0x1eb556){if(_0x1eb556){return _0x1eb556?{'count':_0x4f4d24,'rows':_0x1eb556}:null;}})[_0xed80('0x13')](respondWithResult(_0x4b8e32,null))[_0xed80('0x27')](handleError(_0x4b8e32,null));}; \ No newline at end of file +var _0x18a5=['hasOwnProperty','nolimit','order','sort','pick','MailQueueId','filter','User','findAndCountAll','agent','mailPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','forEach','emit','userMailQueue:save','removeTeams','Team','select','field','tq.TeamId','from','team_has_mail_queues','user_has_teams','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','includes','all','union','transaction','isEmpty','addAgents','omit','removeAgents','isArray','getAgents','bluebird','util','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','MailQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','getOptions','where','MailQueue','include','findAll','rows','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserMailQueue','filters'];(function(_0x47b71c,_0x3ba6ca){var _0x2250aa=function(_0x354f99){while(--_0x354f99){_0x47b71c['push'](_0x47b71c['shift']());}};_0x2250aa(++_0x3ba6ca);}(_0x18a5,0xac));var _0x518a=function(_0x33c272,_0x3e3b33){_0x33c272=_0x33c272-0x0;var _0x23634c=_0x18a5[_0x33c272];return _0x23634c;};'use strict';var BPromise=require(_0x518a('0x0'));var util=require(_0x518a('0x1'));var _=require('lodash');var squel=require(_0x518a('0x2'));var Redis=require(_0x518a('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x518a('0x4'))(_0x518a('0x5'));var config=require(_0x518a('0x6'));var db=require(_0x518a('0x7'))['db'];config[_0x518a('0x8')]=_[_0x518a('0x9')](config['redis'],{'host':_0x518a('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x518a('0x8')]));require(_0x518a('0xb'))[_0x518a('0xc')](socket);function respondWithStatusCode(_0x5caaaf,_0x4d895b){_0x4d895b=_0x4d895b||0xcc;return function(_0x12a455){if(_0x12a455){return _0x5caaaf[_0x518a('0xd')](_0x4d895b);}return _0x5caaaf[_0x518a('0xe')](_0x4d895b)['end']();};}function respondWithResult(_0x119d6d,_0x4d7f91){_0x4d7f91=_0x4d7f91||0xc8;return function(_0x5f5acb){if(_0x5f5acb){return _0x119d6d['status'](_0x4d7f91)['json'](_0x5f5acb);}};}function respondWithFilteredResult(_0x11286a,_0x50b012){return function(_0x5bbabf){if(_0x5bbabf){var _0x5e3336=typeof _0x50b012[_0x518a('0xf')]===_0x518a('0x10')&&typeof _0x50b012[_0x518a('0x11')]===_0x518a('0x10');var _0x5c0c9f=_0x5bbabf[_0x518a('0x12')];var _0x49f4b9=_0x5e3336?0x0:_0x50b012[_0x518a('0xf')];var _0x326dc2=_0x5e3336?_0x5bbabf[_0x518a('0x12')]:_0x50b012['offset']+_0x50b012['limit'];var _0x50307c;if(_0x326dc2>=_0x5c0c9f){_0x326dc2=_0x5c0c9f;_0x50307c=0xc8;}else{_0x50307c=0xce;}_0x11286a[_0x518a('0xe')](_0x50307c);return _0x11286a[_0x518a('0x13')](_0x518a('0x14'),_0x49f4b9+'-'+_0x326dc2+'/'+_0x5c0c9f)[_0x518a('0x15')](_0x5bbabf);}return null;};}function saveUpdates(_0x55cfa2){return function(_0x2d5653){if(_0x2d5653){return _0x2d5653[_0x518a('0x16')](_0x55cfa2)[_0x518a('0x17')](function(_0x331281){return _0x331281;});}return null;};}function removeEntity(_0xe2dbce){return function(_0x2f9e3e){if(_0x2f9e3e){return _0x2f9e3e[_0x518a('0x18')]()[_0x518a('0x17')](function(){var _0x45a99d=_0x2f9e3e['get']({'plain':!![]});var _0x142bd6=_0x518a('0x19');return db[_0x518a('0x1a')][_0x518a('0x18')]({'where':{'type':_0x142bd6,'resourceId':_0x45a99d['id']}})[_0x518a('0x17')](function(){return _0x2f9e3e;});})[_0x518a('0x17')](function(){_0xe2dbce[_0x518a('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12fccd){return function(_0x718895){if(!_0x718895){_0x12fccd['sendStatus'](0x194);}return _0x718895;};}function handleError(_0x15be87,_0x5bba15){_0x5bba15=_0x5bba15||0x1f4;return function(_0xc6185){logger[_0x518a('0x1b')](_0xc6185[_0x518a('0x1c')]);if(_0xc6185[_0x518a('0x1d')]){delete _0xc6185[_0x518a('0x1d')];}_0x15be87[_0x518a('0xe')](_0x5bba15)[_0x518a('0x1e')](_0xc6185);};}exports[_0x518a('0x1f')]=function(_0x4aa6f2,_0x3b3698){var _0x6acead={};var _0x25fe08={'count':0x0,'rows':[]};var _0x49a213=_[_0x518a('0x20')](db['MailQueue'][_0x518a('0x21')],function(_0x2c8595){return{'name':_0x2c8595['fieldName'],'type':_0x2c8595['type']['key']};});_0x6acead=qs[_0x518a('0x22')](_0x49a213,_0x4aa6f2);var _0x3d8163={'where':_0x6acead[_0x518a('0x23')]};return db[_0x518a('0x24')][_0x518a('0x12')](_0x3d8163)['then'](function(_0x3d31ca){_0x25fe08[_0x518a('0x12')]=_0x3d31ca;_0x6acead[_0x518a('0x25')]=qs[_0x518a('0x25')](_0x4aa6f2['query']);return db[_0x518a('0x24')][_0x518a('0x26')](_0x6acead);})[_0x518a('0x17')](function(_0x63dfba){_0x25fe08[_0x518a('0x27')]=_0x63dfba;return _0x25fe08;})[_0x518a('0x17')](respondWithFilteredResult(_0x3b3698,_0x6acead))['catch'](handleError(_0x3b3698,null));};exports[_0x518a('0x28')]=function(_0x4f9f02,_0x369266){var _0x2fd5c6={'raw':!![],'where':{'id':_0x4f9f02[_0x518a('0x29')]['id']}},_0xb0df65={};_0xb0df65[_0x518a('0x2a')]=_[_0x518a('0x2b')](db['MailQueue'][_0x518a('0x21')]);_0xb0df65[_0x518a('0x2c')]=_[_0x518a('0x2b')](_0x4f9f02[_0x518a('0x2c')]);_0xb0df65['filters']=_[_0x518a('0x2d')](_0xb0df65[_0x518a('0x2a')],_0xb0df65['query']);_0x2fd5c6[_0x518a('0x2e')]=_['intersection'](_0xb0df65[_0x518a('0x2a')],qs[_0x518a('0x2f')](_0x4f9f02[_0x518a('0x2c')]['fields']));_0x2fd5c6['attributes']=_0x2fd5c6[_0x518a('0x2e')][_0x518a('0x30')]?_0x2fd5c6[_0x518a('0x2e')]:_0xb0df65[_0x518a('0x2a')];if(_0x4f9f02[_0x518a('0x2c')][_0x518a('0x31')]){_0x2fd5c6[_0x518a('0x25')]=[{'all':!![]}];}_0x2fd5c6=_[_0x518a('0x32')]({},_0x2fd5c6,_0x4f9f02[_0x518a('0x33')]);return db[_0x518a('0x24')][_0x518a('0x34')](_0x2fd5c6)[_0x518a('0x17')](handleEntityNotFound(_0x369266,null))[_0x518a('0x17')](respondWithResult(_0x369266,null))[_0x518a('0x35')](handleError(_0x369266,null));};exports['create']=function(_0xeed623,_0x748337){return db[_0x518a('0x24')][_0x518a('0x36')](_0xeed623[_0x518a('0x37')],{})[_0x518a('0x17')](function(_0x1bf83c){var _0x5284e0=_0xeed623[_0x518a('0x38')][_0x518a('0x39')]({'plain':!![]});if(!_0x5284e0)throw new Error(_0x518a('0x3a'));if(_0x5284e0[_0x518a('0x3b')]===_0x518a('0x38')){var _0x13f13e=_0x1bf83c[_0x518a('0x39')]({'plain':!![]});var _0xad6b0b='MailQueues';return db[_0x518a('0x3c')][_0x518a('0x34')]({'where':{'name':_0xad6b0b,'userProfileId':_0x5284e0['userProfileId']},'raw':!![]})[_0x518a('0x17')](function(_0x1eca02){if(_0x1eca02&&_0x1eca02[_0x518a('0x3d')]===0x0){return db[_0x518a('0x1a')][_0x518a('0x36')]({'name':_0x13f13e[_0x518a('0x1d')],'resourceId':_0x13f13e['id'],'type':_0x1eca02[_0x518a('0x1d')],'sectionId':_0x1eca02['id']},{})[_0x518a('0x17')](function(){return _0x1bf83c;});}else{return _0x1bf83c;}})[_0x518a('0x35')](function(_0x4113c6){logger[_0x518a('0x1b')](_0x518a('0x3e'),_0x4113c6);throw _0x4113c6;});}return _0x1bf83c;})[_0x518a('0x17')](respondWithResult(_0x748337,0xc9))[_0x518a('0x35')](handleError(_0x748337,null));};exports['update']=function(_0x182a89,_0x45b343){if(_0x182a89[_0x518a('0x37')]['id']){delete _0x182a89[_0x518a('0x37')]['id'];}return db['MailQueue'][_0x518a('0x34')]({'where':{'id':_0x182a89['params']['id']}})[_0x518a('0x17')](handleEntityNotFound(_0x45b343,null))[_0x518a('0x17')](saveUpdates(_0x182a89[_0x518a('0x37')],null))[_0x518a('0x17')](respondWithResult(_0x45b343,null))[_0x518a('0x35')](handleError(_0x45b343,null));};exports[_0x518a('0x18')]=function(_0x4398e6,_0x317b61){return db[_0x518a('0x24')][_0x518a('0x34')]({'where':{'id':_0x4398e6['params']['id']}})['then'](handleEntityNotFound(_0x317b61,null))[_0x518a('0x17')](removeEntity(_0x317b61,null))[_0x518a('0x35')](handleError(_0x317b61,null));};exports[_0x518a('0x3f')]=function(_0x1156e8,_0x4ceffa){return db[_0x518a('0x24')][_0x518a('0x3f')]()['then'](respondWithResult(_0x4ceffa,null))[_0x518a('0x35')](handleError(_0x4ceffa,null));};exports['getMembers']=function(_0x564b41,_0x4a090d){var _0x2f798f={'raw':!![],'where':{}},_0x53ac25={},_0x1599ae;return db[_0x518a('0x24')]['findOne']({'where':{'id':_0x564b41[_0x518a('0x29')]['id']}})[_0x518a('0x17')](handleEntityNotFound(_0x4a090d,null))[_0x518a('0x17')](function(_0x34d16a){if(_0x34d16a){_0x1599ae=_0x34d16a[_0x518a('0x39')]({'plain':!![]});_0x53ac25[_0x518a('0x2a')]=_[_0x518a('0x2b')](db[_0x518a('0x40')][_0x518a('0x21')]);_0x53ac25[_0x518a('0x2c')]=_['keys'](_0x564b41[_0x518a('0x2c')]);_0x53ac25[_0x518a('0x41')]=_[_0x518a('0x2d')](_0x53ac25['model'],_0x53ac25[_0x518a('0x2c')]);_0x2f798f['attributes']=_[_0x518a('0x2d')](_0x53ac25[_0x518a('0x2a')],qs[_0x518a('0x2f')](_0x564b41['query'][_0x518a('0x2f')]));_0x2f798f['attributes']=_0x2f798f['attributes'][_0x518a('0x30')]?_0x2f798f[_0x518a('0x2e')]:_0x53ac25[_0x518a('0x2a')];if(!_0x564b41[_0x518a('0x2c')][_0x518a('0x42')](_0x518a('0x43'))){_0x2f798f[_0x518a('0x11')]=qs[_0x518a('0x11')](_0x564b41[_0x518a('0x2c')]['limit']);_0x2f798f[_0x518a('0xf')]=qs[_0x518a('0xf')](_0x564b41[_0x518a('0x2c')][_0x518a('0xf')]);}_0x2f798f[_0x518a('0x44')]=qs[_0x518a('0x45')](_0x564b41['query'][_0x518a('0x45')]);_0x2f798f[_0x518a('0x23')]=qs[_0x518a('0x41')](_[_0x518a('0x46')](_0x564b41['query'],_0x53ac25[_0x518a('0x41')]));_0x2f798f[_0x518a('0x23')][_0x518a('0x47')]=_0x34d16a['id'];if(_0x564b41[_0x518a('0x2c')]['filter']){_0x2f798f[_0x518a('0x23')]=_[_0x518a('0x32')](_0x2f798f[_0x518a('0x23')],{'$or':_[_0x518a('0x20')](_0x2f798f['attributes'],function(_0x524058){var _0x8dccc3={};_0x8dccc3[_0x524058]={'$like':'%'+_0x564b41[_0x518a('0x2c')][_0x518a('0x48')]+'%'};return _0x8dccc3;})});}_0x2f798f=_[_0x518a('0x32')]({},_0x2f798f,_0x564b41[_0x518a('0x33')]);return db[_0x518a('0x40')][_0x518a('0x26')](_0x2f798f);}})[_0x518a('0x17')](function(_0x3e475c){if(_0x3e475c){return db[_0x518a('0x49')][_0x518a('0x4a')]({'where':{'id':_['map'](_0x3e475c,'UserId'),'role':_0x518a('0x4b')},'attributes':['id',_0x518a('0x1d'),_0x518a('0x4c'),'updatedAt',_0x518a('0x4d')]});}})[_0x518a('0x17')](function(_0x45ffab){if(_0x45ffab){return{'count':_0x45ffab[_0x518a('0x12')],'rows':_['map'](_0x45ffab[_0x518a('0x27')],function(_0x267879){return{'membername':_0x267879[_0x518a('0x1d')],'UserId':_0x267879['id'],'queue_name':_0x1599ae[_0x518a('0x1d')],'MailQueueId':_0x1599ae['id'],'interface':util[_0x518a('0x4e')](_0x518a('0x4f'),_0x518a('0x50'),_0x267879[_0x518a('0x1d')]),'penalty':0x0,'paused':_0x267879['mailPause'],'createdAt':_0x267879[_0x518a('0x4d')],'updatedAt':_0x267879[_0x518a('0x51')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x518a('0x17')](respondWithFilteredResult(_0x4a090d,_0x2f798f))[_0x518a('0x35')](handleError(_0x4a090d,null));};exports[_0x518a('0x52')]=function(_0x5063db,_0x1bf669){var _0x3bdaa7={};var _0x156ce7={};var _0x294de2;var _0x56c97d;return db[_0x518a('0x24')][_0x518a('0x53')]({'where':{'id':_0x5063db['params']['id']}})[_0x518a('0x17')](handleEntityNotFound(_0x1bf669,null))['then'](function(_0x43a444){if(_0x43a444){_0x294de2=_0x43a444;_0x156ce7[_0x518a('0x2a')]=_[_0x518a('0x2b')](db['Team'][_0x518a('0x21')]);_0x156ce7[_0x518a('0x2c')]=_[_0x518a('0x2b')](_0x5063db['query']);_0x156ce7[_0x518a('0x41')]=_['intersection'](_0x156ce7[_0x518a('0x2a')],_0x156ce7[_0x518a('0x2c')]);_0x3bdaa7[_0x518a('0x2e')]=_[_0x518a('0x2d')](_0x156ce7[_0x518a('0x2a')],qs[_0x518a('0x2f')](_0x5063db['query'][_0x518a('0x2f')]));_0x3bdaa7[_0x518a('0x2e')]=_0x3bdaa7[_0x518a('0x2e')][_0x518a('0x30')]?_0x3bdaa7[_0x518a('0x2e')]:_0x156ce7['model'];_0x3bdaa7['order']=qs[_0x518a('0x45')](_0x5063db[_0x518a('0x2c')][_0x518a('0x45')]);_0x3bdaa7['where']=qs[_0x518a('0x41')](_[_0x518a('0x46')](_0x5063db[_0x518a('0x2c')],_0x156ce7[_0x518a('0x41')]));if(_0x5063db[_0x518a('0x2c')][_0x518a('0x48')]){_0x3bdaa7[_0x518a('0x23')]=_['merge'](_0x3bdaa7[_0x518a('0x23')],{'$or':_['map'](_0x3bdaa7[_0x518a('0x2e')],function(_0x3df067){var _0x1fe9aa={};_0x1fe9aa[_0x3df067]={'$like':'%'+_0x5063db[_0x518a('0x2c')][_0x518a('0x48')]+'%'};return _0x1fe9aa;})});}_0x3bdaa7=_[_0x518a('0x32')]({},_0x3bdaa7,_0x5063db['options']);return _0x294de2['getTeams'](_0x3bdaa7);}})[_0x518a('0x17')](function(_0x43fa1c){if(_0x43fa1c){_0x56c97d=_0x43fa1c['length'];if(!_0x5063db[_0x518a('0x2c')][_0x518a('0x42')](_0x518a('0x43'))){_0x3bdaa7['limit']=qs['limit'](_0x5063db[_0x518a('0x2c')][_0x518a('0x11')]);_0x3bdaa7[_0x518a('0xf')]=qs[_0x518a('0xf')](_0x5063db[_0x518a('0x2c')][_0x518a('0xf')]);}return _0x294de2['getTeams'](_0x3bdaa7);}})[_0x518a('0x17')](function(_0x404153){if(_0x404153){return _0x404153?{'count':_0x56c97d,'rows':_0x404153}:null;}})[_0x518a('0x17')](respondWithResult(_0x1bf669,null))[_0x518a('0x35')](handleError(_0x1bf669,null));};exports[_0x518a('0x54')]=function(_0x2e9302,_0x35be4e){var _0x30a8e0=_0x2e9302[_0x518a('0x37')][_0x518a('0x55')];return db['Team'][_0x518a('0x26')]({'where':{'id':_0x30a8e0},'attributes':['id'],'include':[{'model':db[_0x518a('0x49')],'as':_0x518a('0x56'),'attributes':['id',_0x518a('0x1d'),_0x518a('0x57'),_0x518a('0x58'),_0x518a('0x59')],'raw':!![]}]})['then'](function(_0x32225d){if(_0x32225d){var _0x10e3d5=_[_0x518a('0x5a')](_0x32225d,function(_0x43f0f0){var _0x545212=_0x43f0f0[_0x518a('0x39')]({'plain':!![]});return _0x545212[_0x518a('0x56')];});return db[_0x518a('0x24')][_0x518a('0x34')]({'where':{'id':_0x2e9302[_0x518a('0x29')]['id']}})[_0x518a('0x17')](function(_0x1ee9ca){return db[_0x518a('0x5b')]['transaction'](function(_0x449cea){return _0x1ee9ca[_0x518a('0x54')](_0x30a8e0,{'transaction':_0x449cea})['then'](function(){return BPromise['each'](_0x10e3d5,function(_0x6d5c68){return db[_0x518a('0x40')]['findOrCreate']({'where':{'UserId':_0x6d5c68['id'],'MailQueueId':_0x2e9302[_0x518a('0x29')]['id']},'transaction':_0x449cea});});})[_0x518a('0x17')](function(){_0x10e3d5[_0x518a('0x5c')](function(_0x210259){socket[_0x518a('0x5d')](_0x518a('0x5e'),{'UserId':_0x210259['id'],'MailQueueId':_0x1ee9ca['id']});});});});});}})[_0x518a('0x17')](respondWithStatusCode(_0x35be4e,null))[_0x518a('0x35')](handleError(_0x35be4e,null));};exports[_0x518a('0x5f')]=function(_0x33c53b,_0x24678a){return db[_0x518a('0x60')][_0x518a('0x26')]({'where':{'id':_0x33c53b['query'][_0x518a('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x518a('0x17')](handleEntityNotFound(_0x24678a,null))[_0x518a('0x17')](function(_0x243854){var _0x43174=_[_0x518a('0x20')](_0x243854,'id');var _0x46a281=[];var _0x15a9a1=[];var _0x3850fb=squel[_0x518a('0x61')]();_0x3850fb[_0x518a('0x62')](_0x518a('0x63'))[_0x518a('0x64')](_0x518a('0x65'),'tq')['join'](_0x518a('0x66'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x518a('0x23')]('MailQueueId\x20=\x20?',_0x33c53b[_0x518a('0x29')]['id']);for(var _0x3dcf21=0x0;_0x3dcf21<_0x243854[_0x518a('0x30')];_0x3dcf21+=0x1){let _0x5579ed=_0x243854[_0x3dcf21];for(var _0x40a369=0x0;_0x40a369<_0x5579ed[_0x518a('0x56')][_0x518a('0x30')];_0x40a369+=0x1){let _0x20d040=_0x5579ed[_0x518a('0x56')][_0x40a369];var _0x59c14e=_0x3850fb[_0x518a('0x67')]();_0x59c14e[_0x518a('0x23')](_0x518a('0x68'),_0x20d040['id']);_0x15a9a1[_0x518a('0x69')](db[_0x518a('0x5b')][_0x518a('0x2c')](_0x59c14e['toString'](),{'type':db['sequelize'][_0x518a('0x6a')][_0x518a('0x6b')]})[_0x518a('0x17')](function(_0x50c7b0){if(_0x50c7b0['length']===0x1){return _0x20d040['id'];}else{var _0x4eee44=_['every'](_[_0x518a('0x20')](_0x50c7b0,_0x518a('0x6c')),function(_0x202f0c){return _[_0x518a('0x6d')](_0x43174,_0x202f0c);});if(_0x4eee44){return _0x20d040['id'];}}}));}}return BPromise[_0x518a('0x6e')](_0x15a9a1)['then'](function(_0x5ca5a5){_0x46a281=_(_0x46a281)[_0x518a('0x6f')](_0x5ca5a5)['compact']()['value']();return db[_0x518a('0x24')][_0x518a('0x34')]({'where':{'id':_0x33c53b[_0x518a('0x29')]['id']}})[_0x518a('0x17')](function(_0x5d7261){return db[_0x518a('0x5b')][_0x518a('0x70')](function(_0x10d613){return _0x5d7261[_0x518a('0x5f')](_0x33c53b[_0x518a('0x2c')]['ids'],{'transaction':_0x10d613})[_0x518a('0x17')](function(){if(!_[_0x518a('0x71')](_0x46a281)){return _0x5d7261['removeAgents'](_0x46a281,{'transaction':_0x10d613});}})[_0x518a('0x17')](function(){_0x46a281[_0x518a('0x5c')](function(_0x5ad932){socket[_0x518a('0x5d')]('userMailQueue:remove',{'UserId':_0x5ad932,'MailQueueId':_0x5d7261['id']});});});});});});})[_0x518a('0x17')](respondWithStatusCode(_0x24678a,null))[_0x518a('0x35')](handleError(_0x24678a,null));};exports['addAgents']=function(_0x1fe6f3,_0x31af42){return db[_0x518a('0x24')][_0x518a('0x34')]({'where':{'id':_0x1fe6f3[_0x518a('0x29')]['id']}})['then'](handleEntityNotFound(_0x31af42,null))[_0x518a('0x17')](function(_0x4fbc14){if(_0x4fbc14){return _0x4fbc14[_0x518a('0x72')](_0x1fe6f3[_0x518a('0x37')][_0x518a('0x55')],_[_0x518a('0x73')](_0x1fe6f3[_0x518a('0x37')],[_0x518a('0x55'),'id'])||{})['spread'](function(_0x5b1f8c){for(var _0x4b7ed5=0x0;_0x4b7ed5<_0x1fe6f3[_0x518a('0x37')][_0x518a('0x55')][_0x518a('0x30')];_0x4b7ed5+=0x1){socket['emit'](_0x518a('0x5e'),{'UserId':Number(_0x1fe6f3[_0x518a('0x37')]['ids'][_0x4b7ed5]),'MailQueueId':Number(_0x1fe6f3[_0x518a('0x29')]['id'])});}return _0x5b1f8c;});}})[_0x518a('0x17')](respondWithResult(_0x31af42,null))[_0x518a('0x35')](handleError(_0x31af42,null));};exports[_0x518a('0x74')]=function(_0x20ac8e,_0x268b56){return db[_0x518a('0x24')][_0x518a('0x34')]({'where':{'id':_0x20ac8e['params']['id']}})[_0x518a('0x17')](handleEntityNotFound(_0x268b56,null))[_0x518a('0x17')](function(_0x23b949){if(_0x23b949){return _0x23b949[_0x518a('0x74')](_0x20ac8e[_0x518a('0x2c')][_0x518a('0x55')])[_0x518a('0x17')](function(){if(_[_0x518a('0x75')](_0x20ac8e[_0x518a('0x2c')][_0x518a('0x55')])){for(var _0x4d4ca2=0x0;_0x4d4ca2<_0x20ac8e[_0x518a('0x2c')]['ids']['length'];_0x4d4ca2+=0x1){socket[_0x518a('0x5d')]('userMailQueue:remove',{'UserId':Number(_0x20ac8e['query'][_0x518a('0x55')][_0x4d4ca2]),'MailQueueId':Number(_0x20ac8e[_0x518a('0x29')]['id'])});}}else{socket[_0x518a('0x5d')]('userMailQueue:remove',{'UserId':Number(_0x20ac8e['query']['ids']),'MailQueueId':Number(_0x20ac8e['params']['id'])});}});}})[_0x518a('0x17')](respondWithStatusCode(_0x268b56,null))[_0x518a('0x35')](handleError(_0x268b56,null));};exports[_0x518a('0x76')]=function(_0x229e9b,_0x341d80){var _0x296cb2={};var _0x1d562b={};var _0x1ae10e;var _0x111436;return db[_0x518a('0x24')]['findOne']({'where':{'id':_0x229e9b[_0x518a('0x29')]['id']}})[_0x518a('0x17')](handleEntityNotFound(_0x341d80,null))[_0x518a('0x17')](function(_0x253ad0){if(_0x253ad0){_0x1ae10e=_0x253ad0;_0x1d562b[_0x518a('0x2a')]=_['keys'](db[_0x518a('0x49')][_0x518a('0x21')]);_0x1d562b['query']=_[_0x518a('0x2b')](_0x229e9b['query']);_0x1d562b[_0x518a('0x41')]=_[_0x518a('0x2d')](_0x1d562b['model'],_0x1d562b[_0x518a('0x2c')]);_0x296cb2[_0x518a('0x2e')]=_[_0x518a('0x2d')](_0x1d562b[_0x518a('0x2a')],qs[_0x518a('0x2f')](_0x229e9b[_0x518a('0x2c')][_0x518a('0x2f')]));_0x296cb2[_0x518a('0x2e')]=_0x296cb2[_0x518a('0x2e')][_0x518a('0x30')]?_0x296cb2[_0x518a('0x2e')]:_0x1d562b[_0x518a('0x2a')];_0x296cb2[_0x518a('0x44')]=qs['sort'](_0x229e9b[_0x518a('0x2c')][_0x518a('0x45')]);_0x296cb2[_0x518a('0x23')]=qs[_0x518a('0x41')](_[_0x518a('0x46')](_0x229e9b[_0x518a('0x2c')],_0x1d562b[_0x518a('0x41')]));if(_0x229e9b[_0x518a('0x2c')][_0x518a('0x48')]){_0x296cb2[_0x518a('0x23')]=_[_0x518a('0x32')](_0x296cb2[_0x518a('0x23')],{'$or':_[_0x518a('0x20')](_0x296cb2[_0x518a('0x2e')],function(_0x2e6b4a){var _0x478250={};_0x478250[_0x2e6b4a]={'$like':'%'+_0x229e9b['query'][_0x518a('0x48')]+'%'};return _0x478250;})});}_0x296cb2=_[_0x518a('0x32')]({},_0x296cb2,_0x229e9b[_0x518a('0x33')]);return _0x1ae10e[_0x518a('0x76')](_0x296cb2);}})[_0x518a('0x17')](function(_0xda5a44){if(_0xda5a44){_0x111436=_0xda5a44[_0x518a('0x30')];if(!_0x229e9b[_0x518a('0x2c')]['hasOwnProperty'](_0x518a('0x43'))){_0x296cb2[_0x518a('0x11')]=qs[_0x518a('0x11')](_0x229e9b[_0x518a('0x2c')][_0x518a('0x11')]);_0x296cb2[_0x518a('0xf')]=qs[_0x518a('0xf')](_0x229e9b[_0x518a('0x2c')]['offset']);}return _0x1ae10e['getAgents'](_0x296cb2);}})[_0x518a('0x17')](function(_0x49a1ef){if(_0x49a1ef){return _0x49a1ef?{'count':_0x111436,'rows':_0x49a1ef}:null;}})['then'](respondWithResult(_0x341d80,null))[_0x518a('0x35')](handleError(_0x341d80,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 5029321..80efb1d 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 _0xe67f=['exports','events','MailQueue','save','update','remove','hasOwnProperty'];(function(_0x540b03,_0x17311a){var _0x2fdd92=function(_0x434cf9){while(--_0x434cf9){_0x540b03['push'](_0x540b03['shift']());}};_0x2fdd92(++_0x17311a);}(_0xe67f,0x120));var _0xfe67=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe67f[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require(_0xfe67('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xfe67('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfe67('0x2'),'afterUpdate':_0xfe67('0x3'),'afterDestroy':_0xfe67('0x4')};function emitEvent(_0x52e9a9){return function(_0x747362,_0xa300ce,_0x23e41e){MailQueueEvents['emit'](_0x52e9a9+':'+_0x747362['id'],_0x747362);MailQueueEvents['emit'](_0x52e9a9,_0x747362);_0x23e41e(null);};}for(var e in events){if(events[_0xfe67('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xfe67('0x6')]=MailQueueEvents; \ No newline at end of file +var _0x5003=['exports','events','../../mysqldb','MailQueue','save','emit','hasOwnProperty','hook'];(function(_0x346949,_0x20eb65){var _0x1f284f=function(_0x5dd29c){while(--_0x5dd29c){_0x346949['push'](_0x346949['shift']());}};_0x1f284f(++_0x20eb65);}(_0x5003,0x91));var _0x3500=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5003[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x3500('0x0'));var MailQueue=require(_0x3500('0x1'))['db'][_0x3500('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3500('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2b9598){return function(_0x1507f0,_0x13cea9,_0x36aef2){MailQueueEvents[_0x3500('0x4')](_0x2b9598+':'+_0x1507f0['id'],_0x1507f0);MailQueueEvents[_0x3500('0x4')](_0x2b9598,_0x1507f0);_0x36aef2(null);};}for(var e in events){if(events[_0x3500('0x5')](e)){var event=events[e];MailQueue[_0x3500('0x6')](e,emitEvent(event));}}module[_0x3500('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index c8e4e47..8443542 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 _0x027b=['define','MailQueue','mail_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x113a6c,_0x10df30){var _0x1ac632=function(_0xbd4fb9){while(--_0xbd4fb9){_0x113a6c['push'](_0x113a6c['shift']());}};_0x1ac632(++_0x10df30);}(_0x027b,0x123));var _0xb027=function(_0x23cee9,_0xa0c8d){_0x23cee9=_0x23cee9-0x0;var _0x152648=_0x027b[_0x23cee9];return _0x152648;};'use strict';var _=require('lodash');var util=require(_0xb027('0x0'));var logger=require(_0xb027('0x1'))(_0xb027('0x2'));var moment=require(_0xb027('0x3'));var BPromise=require('bluebird');var rp=require(_0xb027('0x4'));var fs=require('fs');var path=require(_0xb027('0x5'));var rimraf=require(_0xb027('0x6'));var config=require(_0xb027('0x7'));var attributes=require('./mailQueue.attributes');module[_0xb027('0x8')]=function(_0x43dbd0,_0xa72a26){return _0x43dbd0[_0xb027('0x9')](_0xb027('0xa'),attributes,{'tableName':_0xb027('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa899=['lodash','api','moment','bluebird','request-promise','path','../../config/environment','exports','MailQueue','mail_queues'];(function(_0x3ed907,_0x198882){var _0x535b37=function(_0x2d3423){while(--_0x2d3423){_0x3ed907['push'](_0x3ed907['shift']());}};_0x535b37(++_0x198882);}(_0xa899,0x17c));var _0x9a89=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xa899[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0x9a89('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9a89('0x1'));var moment=require(_0x9a89('0x2'));var BPromise=require(_0x9a89('0x3'));var rp=require(_0x9a89('0x4'));var fs=require('fs');var path=require(_0x9a89('0x5'));var rimraf=require('rimraf');var config=require(_0x9a89('0x6'));var attributes=require('./mailQueue.attributes');module[_0x9a89('0x7')]=function(_0x490f5a,_0xa90357){return _0x490f5a['define'](_0x9a89('0x8'),attributes,{'tableName':_0x9a89('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 6dd53a0..673ccc1 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 _0xada7=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','./mailQueue.socket','register','request','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','options','raw','attributes','include','map','model','then','GetMailQueue','ShowMailQueue','MailQueue','find','where'];(function(_0x366195,_0x50da84){var _0xf37646=function(_0x53a253){while(--_0x53a253){_0x366195['push'](_0x366195['shift']());}};_0xf37646(++_0x50da84);}(_0xada7,0x1ee));var _0x7ada=function(_0x99764b,_0xab9cb7){_0x99764b=_0x99764b-0x0;var _0x457a42=_0xada7[_0x99764b];return _0x457a42;};'use strict';var _=require(_0x7ada('0x0'));var util=require(_0x7ada('0x1'));var moment=require(_0x7ada('0x2'));var BPromise=require(_0x7ada('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ada('0x4'));var db=require(_0x7ada('0x5'))['db'];var utils=require(_0x7ada('0x6'));var logger=require(_0x7ada('0x7'))(_0x7ada('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7ada('0x9')]['http']({'port':0x232a});config[_0x7ada('0xa')]=_[_0x7ada('0xb')](config[_0x7ada('0xa')],{'host':_0x7ada('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ada('0xa')]));require(_0x7ada('0xd'))[_0x7ada('0xe')](socket);function respondWithRpcPromise(_0x25834f,_0x3be401,_0x2cac88){return new BPromise(function(_0x129c22,_0x3530a0){return client[_0x7ada('0xf')](_0x25834f,_0x2cac88)['then'](function(_0x21d33e){logger['info'](_0x7ada('0x10'),_0x3be401,'request\x20sent');logger[_0x7ada('0x11')](_0x7ada('0x12'),_0x3be401,_0x7ada('0x13'),JSON[_0x7ada('0x14')](_0x21d33e));if(_0x21d33e[_0x7ada('0x15')]){if(_0x21d33e[_0x7ada('0x15')]['code']===0x1f4){logger['error'](_0x7ada('0x10'),_0x3be401,_0x21d33e['error'][_0x7ada('0x16')]);return _0x3530a0(_0x21d33e['error'][_0x7ada('0x16')]);}logger[_0x7ada('0x15')]('MailQueue,\x20%s,\x20%s',_0x3be401,_0x21d33e['error'][_0x7ada('0x16')]);return _0x129c22(_0x21d33e[_0x7ada('0x15')]['message']);}else{logger[_0x7ada('0x17')](_0x7ada('0x10'),_0x3be401,_0x7ada('0x13'));_0x129c22(_0x21d33e[_0x7ada('0x18')][_0x7ada('0x16')]);}})[_0x7ada('0x19')](function(_0x5ab23e){logger[_0x7ada('0x15')]('MailQueue,\x20%s,\x20%s',_0x3be401,_0x5ab23e);_0x3530a0(_0x5ab23e);});});}exports['GetMailQueue']=function(_0x234097){var _0x2b7263=this;return new Promise(function(_0x742f66,_0x4fb5cd){return db['MailQueue']['findAll']({'raw':_0x234097[_0x7ada('0x1a')]?_0x234097['options'][_0x7ada('0x1b')]===undefined?!![]:![]:!![],'where':_0x234097[_0x7ada('0x1a')]?_0x234097[_0x7ada('0x1a')]['where']||null:null,'attributes':_0x234097[_0x7ada('0x1a')]?_0x234097[_0x7ada('0x1a')][_0x7ada('0x1c')]||null:null,'limit':_0x234097[_0x7ada('0x1a')]?_0x234097[_0x7ada('0x1a')]['limit']||null:null,'include':_0x234097['options']?_0x234097[_0x7ada('0x1a')][_0x7ada('0x1d')]?_[_0x7ada('0x1e')](_0x234097['options']['include'],function(_0x4298ef){return{'model':db[_0x4298ef[_0x7ada('0x1f')]],'as':_0x4298ef['as'],'attributes':_0x4298ef[_0x7ada('0x1c')],'include':_0x4298ef[_0x7ada('0x1d')]?_[_0x7ada('0x1e')](_0x4298ef[_0x7ada('0x1d')],function(_0x35d3b6){return{'model':db[_0x35d3b6['model']],'as':_0x35d3b6['as'],'attributes':_0x35d3b6[_0x7ada('0x1c')],'include':_0x35d3b6['include']?_[_0x7ada('0x1e')](_0x35d3b6[_0x7ada('0x1d')],function(_0x45cd55){return{'model':db[_0x45cd55['model']],'as':_0x45cd55['as'],'attributes':_0x45cd55[_0x7ada('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7ada('0x20')](function(_0x17bbfd){logger[_0x7ada('0x17')]('GetMailQueue',_0x234097);logger[_0x7ada('0x11')](_0x7ada('0x21'),_0x234097,JSON[_0x7ada('0x14')](_0x17bbfd));_0x742f66(_0x17bbfd);})[_0x7ada('0x19')](function(_0x363d5c){logger[_0x7ada('0x15')](_0x7ada('0x21'),_0x363d5c[_0x7ada('0x16')],_0x234097);_0x4fb5cd(_0x2b7263['error'](0x1f4,_0x363d5c[_0x7ada('0x16')]));});});};exports[_0x7ada('0x22')]=function(_0x22bdf5){var _0x3ff9e1=this;return new Promise(function(_0x366bb6,_0x2afca6){return db[_0x7ada('0x23')][_0x7ada('0x24')]({'raw':_0x22bdf5[_0x7ada('0x1a')]?_0x22bdf5[_0x7ada('0x1a')][_0x7ada('0x1b')]===undefined?!![]:![]:!![],'where':_0x22bdf5[_0x7ada('0x1a')]?_0x22bdf5['options'][_0x7ada('0x25')]||null:null,'attributes':_0x22bdf5[_0x7ada('0x1a')]?_0x22bdf5[_0x7ada('0x1a')][_0x7ada('0x1c')]||null:null,'include':_0x22bdf5[_0x7ada('0x1a')]?_0x22bdf5['options'][_0x7ada('0x1d')]?_[_0x7ada('0x1e')](_0x22bdf5[_0x7ada('0x1a')][_0x7ada('0x1d')],function(_0xff6d5){return{'model':db[_0xff6d5['model']],'as':_0xff6d5['as'],'attributes':_0xff6d5['attributes'],'include':_0xff6d5[_0x7ada('0x1d')]?_[_0x7ada('0x1e')](_0xff6d5[_0x7ada('0x1d')],function(_0x1bf9ca){return{'model':db[_0x1bf9ca[_0x7ada('0x1f')]],'as':_0x1bf9ca['as'],'attributes':_0x1bf9ca[_0x7ada('0x1c')],'include':_0x1bf9ca[_0x7ada('0x1d')]?_[_0x7ada('0x1e')](_0x1bf9ca[_0x7ada('0x1d')],function(_0x3a0ece){return{'model':db[_0x3a0ece['model']],'as':_0x3a0ece['as'],'attributes':_0x3a0ece['attributes']};}):[]};}):[]};}):[]:[]})[_0x7ada('0x20')](function(_0x2e1064){logger[_0x7ada('0x17')](_0x7ada('0x22'),_0x22bdf5);logger[_0x7ada('0x11')]('ShowMailQueue',_0x22bdf5,JSON[_0x7ada('0x14')](_0x2e1064));_0x366bb6(_0x2e1064);})[_0x7ada('0x19')](function(_0x239a0c){logger['error'](_0x7ada('0x22'),_0x239a0c['message'],_0x22bdf5);_0x2afca6(_0x3ff9e1[_0x7ada('0x15')](0x1f4,_0x239a0c[_0x7ada('0x16')]));});});}; \ No newline at end of file +var _0xe608=['defaults','redis','localhost','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailQueue','MailQueue','findAll','options','raw','where','limit','include','model','attributes','map','debug','ShowMailQueue','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http'];(function(_0x519228,_0x2bcbc2){var _0xc3c605=function(_0x4d3811){while(--_0x4d3811){_0x519228['push'](_0x519228['shift']());}};_0xc3c605(++_0x2bcbc2);}(_0xe608,0xb5));var _0x8e60=function(_0x134467,_0x40bd2a){_0x134467=_0x134467-0x0;var _0x2ab317=_0xe608[_0x134467];return _0x2ab317;};'use strict';var _=require(_0x8e60('0x0'));var util=require('util');var moment=require(_0x8e60('0x1'));var BPromise=require(_0x8e60('0x2'));var rs=require(_0x8e60('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e60('0x4'))['db'];var utils=require(_0x8e60('0x5'));var logger=require(_0x8e60('0x6'))(_0x8e60('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8e60('0x8')]({'port':0x232a});config['redis']=_[_0x8e60('0x9')](config[_0x8e60('0xa')],{'host':_0x8e60('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8e60('0xc'))['register'](socket);function respondWithRpcPromise(_0x5204d5,_0x3b92bb,_0x12e423){return new BPromise(function(_0x30f267,_0x2fa2e4){return client[_0x8e60('0xd')](_0x5204d5,_0x12e423)[_0x8e60('0xe')](function(_0xf76941){logger[_0x8e60('0xf')](_0x8e60('0x10'),_0x3b92bb,_0x8e60('0x11'));logger['debug'](_0x8e60('0x12'),_0x3b92bb,_0x8e60('0x11'),JSON[_0x8e60('0x13')](_0xf76941));if(_0xf76941[_0x8e60('0x14')]){if(_0xf76941['error'][_0x8e60('0x15')]===0x1f4){logger[_0x8e60('0x14')](_0x8e60('0x10'),_0x3b92bb,_0xf76941[_0x8e60('0x14')][_0x8e60('0x16')]);return _0x2fa2e4(_0xf76941[_0x8e60('0x14')][_0x8e60('0x16')]);}logger[_0x8e60('0x14')]('MailQueue,\x20%s,\x20%s',_0x3b92bb,_0xf76941[_0x8e60('0x14')]['message']);return _0x30f267(_0xf76941[_0x8e60('0x14')][_0x8e60('0x16')]);}else{logger[_0x8e60('0xf')](_0x8e60('0x10'),_0x3b92bb,'request\x20sent');_0x30f267(_0xf76941['result'][_0x8e60('0x16')]);}})[_0x8e60('0x17')](function(_0x490379){logger[_0x8e60('0x14')](_0x8e60('0x10'),_0x3b92bb,_0x490379);_0x2fa2e4(_0x490379);});});}exports[_0x8e60('0x18')]=function(_0x2d6bf0){var _0x2be024=this;return new Promise(function(_0x36c496,_0xda28a3){return db[_0x8e60('0x19')][_0x8e60('0x1a')]({'raw':_0x2d6bf0[_0x8e60('0x1b')]?_0x2d6bf0[_0x8e60('0x1b')][_0x8e60('0x1c')]===undefined?!![]:![]:!![],'where':_0x2d6bf0['options']?_0x2d6bf0[_0x8e60('0x1b')][_0x8e60('0x1d')]||null:null,'attributes':_0x2d6bf0['options']?_0x2d6bf0[_0x8e60('0x1b')]['attributes']||null:null,'limit':_0x2d6bf0['options']?_0x2d6bf0[_0x8e60('0x1b')][_0x8e60('0x1e')]||null:null,'include':_0x2d6bf0[_0x8e60('0x1b')]?_0x2d6bf0['options'][_0x8e60('0x1f')]?_['map'](_0x2d6bf0[_0x8e60('0x1b')][_0x8e60('0x1f')],function(_0x3afd1e){return{'model':db[_0x3afd1e[_0x8e60('0x20')]],'as':_0x3afd1e['as'],'attributes':_0x3afd1e[_0x8e60('0x21')],'include':_0x3afd1e[_0x8e60('0x1f')]?_[_0x8e60('0x22')](_0x3afd1e[_0x8e60('0x1f')],function(_0x3a7ad7){return{'model':db[_0x3a7ad7['model']],'as':_0x3a7ad7['as'],'attributes':_0x3a7ad7[_0x8e60('0x21')],'include':_0x3a7ad7['include']?_[_0x8e60('0x22')](_0x3a7ad7[_0x8e60('0x1f')],function(_0x324e49){return{'model':db[_0x324e49['model']],'as':_0x324e49['as'],'attributes':_0x324e49[_0x8e60('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10f218){logger[_0x8e60('0xf')]('GetMailQueue',_0x2d6bf0);logger[_0x8e60('0x23')](_0x8e60('0x18'),_0x2d6bf0,JSON['stringify'](_0x10f218));_0x36c496(_0x10f218);})[_0x8e60('0x17')](function(_0x82553e){logger[_0x8e60('0x14')](_0x8e60('0x18'),_0x82553e[_0x8e60('0x16')],_0x2d6bf0);_0xda28a3(_0x2be024[_0x8e60('0x14')](0x1f4,_0x82553e[_0x8e60('0x16')]));});});};exports[_0x8e60('0x24')]=function(_0x4e4acf){var _0x530a1c=this;return new Promise(function(_0x3aace3,_0x56d9b0){return db[_0x8e60('0x19')][_0x8e60('0x25')]({'raw':_0x4e4acf[_0x8e60('0x1b')]?_0x4e4acf[_0x8e60('0x1b')][_0x8e60('0x1c')]===undefined?!![]:![]:!![],'where':_0x4e4acf['options']?_0x4e4acf[_0x8e60('0x1b')]['where']||null:null,'attributes':_0x4e4acf[_0x8e60('0x1b')]?_0x4e4acf[_0x8e60('0x1b')][_0x8e60('0x21')]||null:null,'include':_0x4e4acf[_0x8e60('0x1b')]?_0x4e4acf[_0x8e60('0x1b')][_0x8e60('0x1f')]?_[_0x8e60('0x22')](_0x4e4acf[_0x8e60('0x1b')][_0x8e60('0x1f')],function(_0x24cc08){return{'model':db[_0x24cc08[_0x8e60('0x20')]],'as':_0x24cc08['as'],'attributes':_0x24cc08[_0x8e60('0x21')],'include':_0x24cc08['include']?_[_0x8e60('0x22')](_0x24cc08['include'],function(_0xce2667){return{'model':db[_0xce2667[_0x8e60('0x20')]],'as':_0xce2667['as'],'attributes':_0xce2667['attributes'],'include':_0xce2667[_0x8e60('0x1f')]?_[_0x8e60('0x22')](_0xce2667[_0x8e60('0x1f')],function(_0x351de3){return{'model':db[_0x351de3['model']],'as':_0x351de3['as'],'attributes':_0x351de3[_0x8e60('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8e60('0xe')](function(_0x1d60ff){logger['info'](_0x8e60('0x24'),_0x4e4acf);logger[_0x8e60('0x23')](_0x8e60('0x24'),_0x4e4acf,JSON[_0x8e60('0x13')](_0x1d60ff));_0x3aace3(_0x1d60ff);})[_0x8e60('0x17')](function(_0x22fa8e){logger[_0x8e60('0x14')]('ShowMailQueue',_0x22fa8e[_0x8e60('0x16')],_0x4e4acf);_0x56d9b0(_0x530a1c['error'](0x1f4,_0x22fa8e['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index fd9a467..a15b83f 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 _0xa354=['remove','update','emit','removeListener','register','length','mailQueue:','./mailQueue.events','save'];(function(_0x218994,_0x2cf487){var _0x3f350b=function(_0x2e2065){while(--_0x2e2065){_0x218994['push'](_0x218994['shift']());}};_0x3f350b(++_0x2cf487);}(_0xa354,0xd6));var _0x4a35=function(_0x2f29c7,_0x31b7c9){_0x2f29c7=_0x2f29c7-0x0;var _0x2f6d18=_0xa354[_0x2f29c7];return _0x2f6d18;};'use strict';var MailQueueEvents=require(_0x4a35('0x0'));var events=[_0x4a35('0x1'),_0x4a35('0x2'),_0x4a35('0x3')];function createListener(_0x436d49,_0x53f8c4){return function(_0xd702bb){_0x53f8c4[_0x4a35('0x4')](_0x436d49,_0xd702bb);};}function removeListener(_0x531ded,_0x544487){return function(){MailQueueEvents[_0x4a35('0x5')](_0x531ded,_0x544487);};}exports[_0x4a35('0x6')]=function(_0x410a5c){for(var _0x131c03=0x0,_0x50e355=events[_0x4a35('0x7')];_0x131c03<_0x50e355;_0x131c03++){var _0x3ba7a4=events[_0x131c03];var _0x54d8b1=createListener(_0x4a35('0x8')+_0x3ba7a4,_0x410a5c);MailQueueEvents['on'](_0x3ba7a4,_0x54d8b1);}}; \ No newline at end of file +var _0x99d4=['./mailQueue.events','remove','removeListener','register','length'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x99d4,0x122));var _0x499d=function(_0x1c2156,_0x35e65e){_0x1c2156=_0x1c2156-0x0;var _0x2b92e7=_0x99d4[_0x1c2156];return _0x2b92e7;};'use strict';var MailQueueEvents=require(_0x499d('0x0'));var events=['save',_0x499d('0x1'),'update'];function createListener(_0x597cff,_0x30890f){return function(_0x23139a){_0x30890f['emit'](_0x597cff,_0x23139a);};}function removeListener(_0x48e2fb,_0x57fc4c){return function(){MailQueueEvents[_0x499d('0x2')](_0x48e2fb,_0x57fc4c);};}exports[_0x499d('0x3')]=function(_0x4748bc){for(var _0x53264c=0x0,_0x1b8134=events[_0x499d('0x4')];_0x53264c<_0x1b8134;_0x53264c++){var _0x470d12=events[_0x53264c];var _0x4e75b0=createListener('mailQueue:'+_0x470d12,_0x4748bc);MailQueueEvents['on'](_0x470d12,_0x4e75b0);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 5fcb9f3..458c464 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 _0x8c8a=['fs-extra','../../components/interaction/service','./mailQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','exports','multer','path','express','Router'];(function(_0x44dc99,_0x326111){var _0xe53489=function(_0x1b3344){while(--_0x1b3344){_0x44dc99['push'](_0x44dc99['shift']());}};_0xe53489(++_0x326111);}(_0x8c8a,0x8c));var _0xa8c8=function(_0x485539,_0x5491b7){_0x485539=_0x485539-0x0;var _0x2d3d75=_0x8c8a[_0x485539];return _0x2d3d75;};'use strict';var multer=require(_0xa8c8('0x0'));var util=require('util');var path=require(_0xa8c8('0x1'));var timeout=require('connect-timeout');var express=require(_0xa8c8('0x2'));var router=express[_0xa8c8('0x3')]();var fs_extra=require(_0xa8c8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa8c8('0x5'));var config=require('../../config/environment');var controller=require(_0xa8c8('0x6'));router['get']('/',auth[_0xa8c8('0x7')](),controller[_0xa8c8('0x8')]);router[_0xa8c8('0x9')](_0xa8c8('0xa'),auth['isAuthenticated'](),controller[_0xa8c8('0xb')]);router[_0xa8c8('0x9')](_0xa8c8('0xc'),auth[_0xa8c8('0x7')](),controller[_0xa8c8('0xd')]);router['post']('/',auth[_0xa8c8('0x7')](),controller[_0xa8c8('0xe')]);router['put'](_0xa8c8('0xc'),auth[_0xa8c8('0x7')](),controller['update']);router['delete'](_0xa8c8('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xa8c8('0xf')]=router; \ No newline at end of file +var _0x9e5a=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','post','put','/:id','update','delete','exports','util'];(function(_0x3c5701,_0x49225a){var _0xac9415=function(_0x37e5aa){while(--_0x37e5aa){_0x3c5701['push'](_0x3c5701['shift']());}};_0xac9415(++_0x49225a);}(_0x9e5a,0x1c1));var _0xa9e5=function(_0x19983a,_0x47753a){_0x19983a=_0x19983a-0x0;var _0x5c2d84=_0x9e5a[_0x19983a];return _0x5c2d84;};'use strict';var multer=require('multer');var util=require(_0xa9e5('0x0'));var path=require(_0xa9e5('0x1'));var timeout=require(_0xa9e5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa9e5('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa9e5('0x4'));var config=require(_0xa9e5('0x5'));var controller=require(_0xa9e5('0x6'));router[_0xa9e5('0x7')]('/',auth[_0xa9e5('0x8')](),controller[_0xa9e5('0x9')]);router['get'](_0xa9e5('0xa'),auth[_0xa9e5('0x8')](),controller[_0xa9e5('0xb')]);router[_0xa9e5('0x7')]('/:id',auth[_0xa9e5('0x8')](),controller['show']);router[_0xa9e5('0xc')]('/',auth[_0xa9e5('0x8')](),controller['create']);router[_0xa9e5('0xd')](_0xa9e5('0xe'),auth[_0xa9e5('0x8')](),controller[_0xa9e5('0xf')]);router[_0xa9e5('0x10')](_0xa9e5('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xa9e5('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index e0746fa..a3106a8 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 _0xb733=['exports','DATE','STRING','moment'];(function(_0x4971a7,_0x2e9b32){var _0x4c754d=function(_0x9c56dc){while(--_0x9c56dc){_0x4971a7['push'](_0x4971a7['shift']());}};_0x4c754d(++_0x2e9b32);}(_0xb733,0xab));var _0x3b73=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb733[_0x3947c9];return _0x2e7871;};'use strict';var moment=require(_0x3b73('0x0'));var Sequelize=require('sequelize');module[_0x3b73('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3b73('0x2')]},'leaveAt':{'type':Sequelize[_0x3b73('0x2')]},'acceptAt':{'type':Sequelize[_0x3b73('0x2')]},'exitAt':{'type':Sequelize[_0x3b73('0x2')]},'reason':{'type':Sequelize[_0x3b73('0x3')]}}; \ No newline at end of file +var _0x50e3=['sequelize','STRING','DATE'];(function(_0x1103c4,_0x562d1d){var _0x1c19ab=function(_0x10e254){while(--_0x10e254){_0x1103c4['push'](_0x1103c4['shift']());}};_0x1c19ab(++_0x562d1d);}(_0x50e3,0xea));var _0x350e=function(_0x3d29a6,_0x5e72ac){_0x3d29a6=_0x3d29a6-0x0;var _0x113581=_0x50e3[_0x3d29a6];return _0x113581;};'use strict';var moment=require('moment');var Sequelize=require(_0x350e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x350e('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x350e('0x1')]},'joinAt':{'type':Sequelize[_0x350e('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x350e('0x2')]},'exitAt':{'type':Sequelize[_0x350e('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 86bc386..576f094 100644 --- a/server/api/mailQueueReport/mailQueueReport.controller.js +++ b/server/api/mailQueueReport/mailQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6050=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','name','send','index','map','MailQueueReport','rawAttributes','type','key','model','query','keys'];(function(_0x40db41,_0x494d29){var _0x31f18b=function(_0x4e2f98){while(--_0x4e2f98){_0x40db41['push'](_0x40db41['shift']());}};_0x31f18b(++_0x494d29);}(_0x6050,0x196));var _0x0605=function(_0x14d8b5,_0x2e71d5){_0x14d8b5=_0x14d8b5-0x0;var _0x29e967=_0x6050[_0x14d8b5];return _0x29e967;};'use strict';var emlformat=require(_0x0605('0x0'));var rimraf=require(_0x0605('0x1'));var zipdir=require(_0x0605('0x2'));var jsonpatch=require(_0x0605('0x3'));var rp=require(_0x0605('0x4'));var moment=require(_0x0605('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0605('0x6'));var util=require(_0x0605('0x7'));var path=require(_0x0605('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0605('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0605('0xa'));var deskjs=require(_0x0605('0xb'));var toCsv=require(_0x0605('0xc'));var querystring=require(_0x0605('0xd'));var Papa=require(_0x0605('0xe'));var Redis=require('ioredis');var authService=require(_0x0605('0xf'));var qs=require(_0x0605('0x10'));var as=require(_0x0605('0x11'));var hardwareService=require(_0x0605('0x12'));var logger=require(_0x0605('0x13'))(_0x0605('0x14'));var utils=require(_0x0605('0x15'));var config=require(_0x0605('0x16'));var licenseUtil=require(_0x0605('0x17'));var db=require(_0x0605('0x18'))['db'];function respondWithStatusCode(_0xd22e35,_0x39e288){_0x39e288=_0x39e288||0xcc;return function(_0x34c9e6){if(_0x34c9e6){return _0xd22e35[_0x0605('0x19')](_0x39e288);}return _0xd22e35[_0x0605('0x1a')](_0x39e288)[_0x0605('0x1b')]();};}function respondWithResult(_0x169a70,_0x65a20b){_0x65a20b=_0x65a20b||0xc8;return function(_0x1b944f){if(_0x1b944f){return _0x169a70['status'](_0x65a20b)[_0x0605('0x1c')](_0x1b944f);}};}function respondWithFilteredResult(_0x1a802b,_0x4993ab){return function(_0x5ce56a){if(_0x5ce56a){var _0x4eefe9=typeof _0x4993ab[_0x0605('0x1d')]===_0x0605('0x1e')&&typeof _0x4993ab[_0x0605('0x1f')]===_0x0605('0x1e');var _0xefc557=_0x5ce56a[_0x0605('0x20')];var _0x2b7b5a=_0x4eefe9?0x0:_0x4993ab[_0x0605('0x1d')];var _0x193520=_0x4eefe9?_0x5ce56a[_0x0605('0x20')]:_0x4993ab[_0x0605('0x1d')]+_0x4993ab[_0x0605('0x1f')];var _0x2e2204;if(_0x193520>=_0xefc557){_0x193520=_0xefc557;_0x2e2204=0xc8;}else{_0x2e2204=0xce;}_0x1a802b[_0x0605('0x1a')](_0x2e2204);return _0x1a802b['set'](_0x0605('0x21'),_0x2b7b5a+'-'+_0x193520+'/'+_0xefc557)[_0x0605('0x1c')](_0x5ce56a);}return null;};}function patchUpdates(_0x430f28){return function(_0x443326){try{jsonpatch[_0x0605('0x22')](_0x443326,_0x430f28,!![]);}catch(_0x90b2e1){return BPromise[_0x0605('0x23')](_0x90b2e1);}return _0x443326[_0x0605('0x24')]();};}function saveUpdates(_0x226ef5,_0x5b0d44){return function(_0xc334b8){if(_0xc334b8){return _0xc334b8['update'](_0x226ef5)[_0x0605('0x25')](function(_0x118e9c){return _0x118e9c;});}return null;};}function removeEntity(_0x110098,_0xf182c4){return function(_0x10c575){if(_0x10c575){return _0x10c575[_0x0605('0x26')]()[_0x0605('0x25')](function(){_0x110098[_0x0605('0x1a')](0xcc)[_0x0605('0x1b')]();});}};}function handleEntityNotFound(_0x2896d7,_0x9f2833){return function(_0x1c3722){if(!_0x1c3722){_0x2896d7['sendStatus'](0x194);}return _0x1c3722;};}function handleError(_0x6bc204,_0x3c8e36){_0x3c8e36=_0x3c8e36||0x1f4;return function(_0x4b1e0c){logger['error'](_0x4b1e0c['stack']);if(_0x4b1e0c[_0x0605('0x27')]){delete _0x4b1e0c[_0x0605('0x27')];}_0x6bc204[_0x0605('0x1a')](_0x3c8e36)[_0x0605('0x28')](_0x4b1e0c);};}exports[_0x0605('0x29')]=function(_0x4554df,_0x4e32ef){var _0x34f25d={},_0x5daef6={},_0xa836f2={'count':0x0,'rows':[]};var _0x3640b9=_[_0x0605('0x2a')](db[_0x0605('0x2b')][_0x0605('0x2c')],function(_0x352dd6){return{'name':_0x352dd6['fieldName'],'type':_0x352dd6[_0x0605('0x2d')][_0x0605('0x2e')]};});_0x5daef6[_0x0605('0x2f')]=_[_0x0605('0x2a')](_0x3640b9,_0x0605('0x27'));_0x5daef6[_0x0605('0x30')]=_[_0x0605('0x31')](_0x4554df[_0x0605('0x30')]);_0x5daef6[_0x0605('0x32')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],_0x5daef6[_0x0605('0x30')]);_0x34f25d[_0x0605('0x34')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x4554df[_0x0605('0x30')][_0x0605('0x35')]));_0x34f25d[_0x0605('0x34')]=_0x34f25d[_0x0605('0x34')][_0x0605('0x36')]?_0x34f25d[_0x0605('0x34')]:_0x5daef6[_0x0605('0x2f')];if(!_0x4554df[_0x0605('0x30')][_0x0605('0x37')](_0x0605('0x38'))){_0x34f25d[_0x0605('0x1f')]=qs['limit'](_0x4554df[_0x0605('0x30')][_0x0605('0x1f')]);_0x34f25d['offset']=qs[_0x0605('0x1d')](_0x4554df[_0x0605('0x30')]['offset']);}_0x34f25d[_0x0605('0x39')]=qs[_0x0605('0x3a')](_0x4554df[_0x0605('0x30')][_0x0605('0x3a')]);_0x34f25d[_0x0605('0x3b')]=qs[_0x0605('0x32')](_['pick'](_0x4554df['query'],_0x5daef6[_0x0605('0x32')]),_0x3640b9);if(_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]){_0x34f25d['where']=_[_0x0605('0x3d')](_0x34f25d['where'],{'$or':_[_0x0605('0x2a')](_0x3640b9,function(_0x1e98f6){if(_0x1e98f6[_0x0605('0x2d')]!==_0x0605('0x3e')){var _0x42f7ce={};_0x42f7ce[_0x1e98f6[_0x0605('0x27')]]={'$like':'%'+_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]+'%'};return _0x42f7ce;}})});}_0x34f25d=_[_0x0605('0x3d')]({},_0x34f25d,_0x4554df[_0x0605('0x3f')]);var _0x57aa15={'where':_0x34f25d[_0x0605('0x3b')]};return db['MailQueueReport'][_0x0605('0x20')](_0x57aa15)[_0x0605('0x25')](function(_0x45787e){_0xa836f2['count']=_0x45787e;if(_0x4554df['query'][_0x0605('0x40')]){_0x34f25d['include']=[{'all':!![]}];}return db[_0x0605('0x2b')][_0x0605('0x41')](_0x34f25d);})[_0x0605('0x25')](function(_0x3de34a){_0xa836f2[_0x0605('0x42')]=_0x3de34a;return _0xa836f2;})[_0x0605('0x25')](respondWithFilteredResult(_0x4e32ef,_0x34f25d))[_0x0605('0x43')](handleError(_0x4e32ef,null));};exports[_0x0605('0x44')]=function(_0x3fa553,_0x10bb36){var _0x18d3ce={'raw':!![],'where':{'id':_0x3fa553[_0x0605('0x45')]['id']}},_0x3616a3={};_0x3616a3['model']=_['keys'](db[_0x0605('0x2b')]['rawAttributes']);_0x3616a3[_0x0605('0x30')]=_[_0x0605('0x31')](_0x3fa553['query']);_0x3616a3[_0x0605('0x32')]=_[_0x0605('0x33')](_0x3616a3['model'],_0x3616a3[_0x0605('0x30')]);_0x18d3ce[_0x0605('0x34')]=_['intersection'](_0x3616a3[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x3fa553['query'][_0x0605('0x35')]));_0x18d3ce['attributes']=_0x18d3ce['attributes'][_0x0605('0x36')]?_0x18d3ce[_0x0605('0x34')]:_0x3616a3[_0x0605('0x2f')];if(_0x3fa553[_0x0605('0x30')][_0x0605('0x40')]){_0x18d3ce[_0x0605('0x46')]=[{'all':!![]}];}_0x18d3ce=_[_0x0605('0x3d')]({},_0x18d3ce,_0x3fa553[_0x0605('0x3f')]);return db['MailQueueReport'][_0x0605('0x47')](_0x18d3ce)[_0x0605('0x25')](handleEntityNotFound(_0x10bb36,null))[_0x0605('0x25')](respondWithResult(_0x10bb36,null))['catch'](handleError(_0x10bb36,null));};exports[_0x0605('0x48')]=function(_0x1fb70b,_0x45cc1a){return db[_0x0605('0x2b')][_0x0605('0x48')](_0x1fb70b[_0x0605('0x49')],{})[_0x0605('0x25')](respondWithResult(_0x45cc1a,0xc9))[_0x0605('0x43')](handleError(_0x45cc1a,null));};exports[_0x0605('0x4a')]=function(_0x4bc55e,_0x3c597c){if(_0x4bc55e[_0x0605('0x49')]['id']){delete _0x4bc55e[_0x0605('0x49')]['id'];}return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4bc55e[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x3c597c,null))[_0x0605('0x25')](saveUpdates(_0x4bc55e[_0x0605('0x49')],null))[_0x0605('0x25')](respondWithResult(_0x3c597c,null))['catch'](handleError(_0x3c597c,null));};exports['destroy']=function(_0x4876c7,_0x2687a8){return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4876c7[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x2687a8,null))[_0x0605('0x25')](removeEntity(_0x2687a8,null))['catch'](handleError(_0x2687a8,null));};exports[_0x0605('0x4b')]=function(_0x286485,_0x184232){return db[_0x0605('0x2b')]['describe']()[_0x0605('0x25')](respondWithResult(_0x184232,null))[_0x0605('0x43')](handleError(_0x184232,null));}; \ No newline at end of file +var _0x5c3c=['findAll','rows','params','merge','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','limit','count','offset','Content-Range','json','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','MailQueueReport','includeAll','include'];(function(_0x17fa3a,_0x1ef24b){var _0x85e306=function(_0x541bc7){while(--_0x541bc7){_0x17fa3a['push'](_0x17fa3a['shift']());}};_0x85e306(++_0x1ef24b);}(_0x5c3c,0x132));var _0xc5c3=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x5c3c[_0x24259d];return _0x5a701;};'use strict';var emlformat=require(_0xc5c3('0x0'));var rimraf=require(_0xc5c3('0x1'));var zipdir=require(_0xc5c3('0x2'));var jsonpatch=require(_0xc5c3('0x3'));var rp=require('request-promise');var moment=require(_0xc5c3('0x4'));var BPromise=require(_0xc5c3('0x5'));var Mustache=require(_0xc5c3('0x6'));var util=require(_0xc5c3('0x7'));var path=require(_0xc5c3('0x8'));var sox=require(_0xc5c3('0x9'));var csv=require(_0xc5c3('0xa'));var ejs=require(_0xc5c3('0xb'));var fs=require('fs');var fs_extra=require(_0xc5c3('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc5c3('0xd'));var deskjs=require(_0xc5c3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc5c3('0xf'));var Papa=require(_0xc5c3('0x10'));var Redis=require('ioredis');var authService=require(_0xc5c3('0x11'));var qs=require(_0xc5c3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5c3('0x13'));var logger=require(_0xc5c3('0x14'))(_0xc5c3('0x15'));var utils=require('../../config/utils');var config=require(_0xc5c3('0x16'));var licenseUtil=require(_0xc5c3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b56e6,_0x44d2b9){_0x44d2b9=_0x44d2b9||0xcc;return function(_0x3f0f45){if(_0x3f0f45){return _0x2b56e6['sendStatus'](_0x44d2b9);}return _0x2b56e6[_0xc5c3('0x18')](_0x44d2b9)[_0xc5c3('0x19')]();};}function respondWithResult(_0x1488ab,_0x13a740){_0x13a740=_0x13a740||0xc8;return function(_0xc8a636){if(_0xc8a636){return _0x1488ab['status'](_0x13a740)['json'](_0xc8a636);}};}function respondWithFilteredResult(_0x4445ea,_0x577e1a){return function(_0x1bae87){if(_0x1bae87){var _0xef8b21=typeof _0x577e1a['offset']==='undefined'&&typeof _0x577e1a[_0xc5c3('0x1a')]==='undefined';var _0xa9bc84=_0x1bae87[_0xc5c3('0x1b')];var _0x2ff158=_0xef8b21?0x0:_0x577e1a[_0xc5c3('0x1c')];var _0x28bae6=_0xef8b21?_0x1bae87['count']:_0x577e1a[_0xc5c3('0x1c')]+_0x577e1a[_0xc5c3('0x1a')];var _0x123dba;if(_0x28bae6>=_0xa9bc84){_0x28bae6=_0xa9bc84;_0x123dba=0xc8;}else{_0x123dba=0xce;}_0x4445ea[_0xc5c3('0x18')](_0x123dba);return _0x4445ea['set'](_0xc5c3('0x1d'),_0x2ff158+'-'+_0x28bae6+'/'+_0xa9bc84)[_0xc5c3('0x1e')](_0x1bae87);}return null;};}function patchUpdates(_0x3cc612){return function(_0x3ca20a){try{jsonpatch[_0xc5c3('0x1f')](_0x3ca20a,_0x3cc612,!![]);}catch(_0x564815){return BPromise[_0xc5c3('0x20')](_0x564815);}return _0x3ca20a[_0xc5c3('0x21')]();};}function saveUpdates(_0x370254,_0x2de266){return function(_0x1c5793){if(_0x1c5793){return _0x1c5793[_0xc5c3('0x22')](_0x370254)[_0xc5c3('0x23')](function(_0x5996a0){return _0x5996a0;});}return null;};}function removeEntity(_0x52d638,_0x45affe){return function(_0x38dd9e){if(_0x38dd9e){return _0x38dd9e['destroy']()['then'](function(){_0x52d638[_0xc5c3('0x18')](0xcc)[_0xc5c3('0x19')]();});}};}function handleEntityNotFound(_0x38a3df,_0x52e54a){return function(_0x4af067){if(!_0x4af067){_0x38a3df[_0xc5c3('0x24')](0x194);}return _0x4af067;};}function handleError(_0x22f607,_0x20c506){_0x20c506=_0x20c506||0x1f4;return function(_0x29791c){logger['error'](_0x29791c[_0xc5c3('0x25')]);if(_0x29791c['name']){delete _0x29791c[_0xc5c3('0x26')];}_0x22f607['status'](_0x20c506)[_0xc5c3('0x27')](_0x29791c);};}exports[_0xc5c3('0x28')]=function(_0x4269eb,_0x4773c5){var _0x15361c={},_0x2d07e1={},_0x35a397={'count':0x0,'rows':[]};var _0x4b5a0c=_[_0xc5c3('0x29')](db['MailQueueReport'][_0xc5c3('0x2a')],function(_0x43ebfc){return{'name':_0x43ebfc['fieldName'],'type':_0x43ebfc['type'][_0xc5c3('0x2b')]};});_0x2d07e1[_0xc5c3('0x2c')]=_[_0xc5c3('0x29')](_0x4b5a0c,_0xc5c3('0x26'));_0x2d07e1['query']=_[_0xc5c3('0x2d')](_0x4269eb[_0xc5c3('0x2e')]);_0x2d07e1[_0xc5c3('0x2f')]=_[_0xc5c3('0x30')](_0x2d07e1[_0xc5c3('0x2c')],_0x2d07e1[_0xc5c3('0x2e')]);_0x15361c[_0xc5c3('0x31')]=_[_0xc5c3('0x30')](_0x2d07e1[_0xc5c3('0x2c')],qs['fields'](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x32')]));_0x15361c[_0xc5c3('0x31')]=_0x15361c[_0xc5c3('0x31')][_0xc5c3('0x33')]?_0x15361c[_0xc5c3('0x31')]:_0x2d07e1[_0xc5c3('0x2c')];if(!_0x4269eb['query']['hasOwnProperty'](_0xc5c3('0x34'))){_0x15361c['limit']=qs[_0xc5c3('0x1a')](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x1a')]);_0x15361c[_0xc5c3('0x1c')]=qs[_0xc5c3('0x1c')](_0x4269eb['query'][_0xc5c3('0x1c')]);}_0x15361c[_0xc5c3('0x35')]=qs['sort'](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x36')]);_0x15361c[_0xc5c3('0x37')]=qs[_0xc5c3('0x2f')](_[_0xc5c3('0x38')](_0x4269eb[_0xc5c3('0x2e')],_0x2d07e1[_0xc5c3('0x2f')]),_0x4b5a0c);if(_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x39')]){_0x15361c[_0xc5c3('0x37')]=_['merge'](_0x15361c[_0xc5c3('0x37')],{'$or':_['map'](_0x4b5a0c,function(_0x4fdbe6){if(_0x4fdbe6[_0xc5c3('0x3a')]!==_0xc5c3('0x3b')){var _0x1b546e={};_0x1b546e[_0x4fdbe6[_0xc5c3('0x26')]]={'$like':'%'+_0x4269eb[_0xc5c3('0x2e')]['filter']+'%'};return _0x1b546e;}})});}_0x15361c=_['merge']({},_0x15361c,_0x4269eb[_0xc5c3('0x3c')]);var _0xa7cb91={'where':_0x15361c['where']};return db[_0xc5c3('0x3d')]['count'](_0xa7cb91)[_0xc5c3('0x23')](function(_0x2dfd19){_0x35a397[_0xc5c3('0x1b')]=_0x2dfd19;if(_0x4269eb['query'][_0xc5c3('0x3e')]){_0x15361c[_0xc5c3('0x3f')]=[{'all':!![]}];}return db['MailQueueReport'][_0xc5c3('0x40')](_0x15361c);})['then'](function(_0x33936c){_0x35a397[_0xc5c3('0x41')]=_0x33936c;return _0x35a397;})['then'](respondWithFilteredResult(_0x4773c5,_0x15361c))['catch'](handleError(_0x4773c5,null));};exports['show']=function(_0xfb64bb,_0x2f02ab){var _0x49b1fc={'raw':!![],'where':{'id':_0xfb64bb[_0xc5c3('0x42')]['id']}},_0x1a8490={};_0x1a8490[_0xc5c3('0x2c')]=_[_0xc5c3('0x2d')](db['MailQueueReport'][_0xc5c3('0x2a')]);_0x1a8490['query']=_['keys'](_0xfb64bb[_0xc5c3('0x2e')]);_0x1a8490[_0xc5c3('0x2f')]=_['intersection'](_0x1a8490[_0xc5c3('0x2c')],_0x1a8490[_0xc5c3('0x2e')]);_0x49b1fc['attributes']=_[_0xc5c3('0x30')](_0x1a8490['model'],qs[_0xc5c3('0x32')](_0xfb64bb[_0xc5c3('0x2e')]['fields']));_0x49b1fc[_0xc5c3('0x31')]=_0x49b1fc['attributes'][_0xc5c3('0x33')]?_0x49b1fc[_0xc5c3('0x31')]:_0x1a8490['model'];if(_0xfb64bb[_0xc5c3('0x2e')][_0xc5c3('0x3e')]){_0x49b1fc[_0xc5c3('0x3f')]=[{'all':!![]}];}_0x49b1fc=_[_0xc5c3('0x43')]({},_0x49b1fc,_0xfb64bb[_0xc5c3('0x3c')]);return db[_0xc5c3('0x3d')]['find'](_0x49b1fc)[_0xc5c3('0x23')](handleEntityNotFound(_0x2f02ab,null))[_0xc5c3('0x23')](respondWithResult(_0x2f02ab,null))[_0xc5c3('0x44')](handleError(_0x2f02ab,null));};exports[_0xc5c3('0x45')]=function(_0x23002b,_0x4a7330){return db['MailQueueReport'][_0xc5c3('0x45')](_0x23002b[_0xc5c3('0x46')],{})[_0xc5c3('0x23')](respondWithResult(_0x4a7330,0xc9))['catch'](handleError(_0x4a7330,null));};exports[_0xc5c3('0x22')]=function(_0x65f720,_0x3a901f){if(_0x65f720[_0xc5c3('0x46')]['id']){delete _0x65f720[_0xc5c3('0x46')]['id'];}return db[_0xc5c3('0x3d')][_0xc5c3('0x47')]({'where':{'id':_0x65f720['params']['id']}})[_0xc5c3('0x23')](handleEntityNotFound(_0x3a901f,null))[_0xc5c3('0x23')](saveUpdates(_0x65f720[_0xc5c3('0x46')],null))['then'](respondWithResult(_0x3a901f,null))[_0xc5c3('0x44')](handleError(_0x3a901f,null));};exports[_0xc5c3('0x48')]=function(_0x3b1bc2,_0x103bde){return db[_0xc5c3('0x3d')]['find']({'where':{'id':_0x3b1bc2[_0xc5c3('0x42')]['id']}})['then'](handleEntityNotFound(_0x103bde,null))[_0xc5c3('0x23')](removeEntity(_0x103bde,null))['catch'](handleError(_0x103bde,null));};exports[_0xc5c3('0x49')]=function(_0x34a2c3,_0x4add6b){return db[_0xc5c3('0x3d')][_0xc5c3('0x49')]()['then'](respondWithResult(_0x4add6b,null))[_0xc5c3('0x44')](handleError(_0x4add6b,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 3b447f5..dbc886b 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 _0xf4de=['report_mail_queue','uniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','MailQueueReport'];(function(_0x8ba642,_0x4e13b4){var _0x3ba896=function(_0x55672d){while(--_0x55672d){_0x8ba642['push'](_0x8ba642['shift']());}};_0x3ba896(++_0x4e13b4);}(_0xf4de,0xdf));var _0xef4d=function(_0x21176a,_0x12a3c6){_0x21176a=_0x21176a-0x0;var _0x205749=_0xf4de[_0x21176a];return _0x205749;};'use strict';var _=require(_0xef4d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xef4d('0x1'));var moment=require(_0xef4d('0x2'));var BPromise=require(_0xef4d('0x3'));var rp=require(_0xef4d('0x4'));var fs=require('fs');var path=require(_0xef4d('0x5'));var rimraf=require(_0xef4d('0x6'));var config=require(_0xef4d('0x7'));var attributes=require(_0xef4d('0x8'));module[_0xef4d('0x9')]=function(_0x183ea6,_0x2e4625){return _0x183ea6['define'](_0xef4d('0xa'),attributes,{'tableName':_0xef4d('0xb'),'paranoid':![],'indexes':[{'name':_0xef4d('0xc'),'fields':[_0xef4d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaa16=['bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment'];(function(_0xfb4ab,_0x140882){var _0x459ff6=function(_0x595174){while(--_0x595174){_0xfb4ab['push'](_0xfb4ab['shift']());}};_0x459ff6(++_0x140882);}(_0xaa16,0x146));var _0x6aa1=function(_0x4dddcc,_0x5dae19){_0x4dddcc=_0x4dddcc-0x0;var _0x2e9da1=_0xaa16[_0x4dddcc];return _0x2e9da1;};'use strict';var _=require(_0x6aa1('0x0'));var util=require(_0x6aa1('0x1'));var logger=require(_0x6aa1('0x2'))('api');var moment=require(_0x6aa1('0x3'));var BPromise=require(_0x6aa1('0x4'));var rp=require(_0x6aa1('0x5'));var fs=require('fs');var path=require(_0x6aa1('0x6'));var rimraf=require(_0x6aa1('0x7'));var config=require(_0x6aa1('0x8'));var attributes=require(_0x6aa1('0x9'));module[_0x6aa1('0xa')]=function(_0x549a32,_0x1336e7){return _0x549a32[_0x6aa1('0xb')](_0x6aa1('0xc'),attributes,{'tableName':_0x6aa1('0xd'),'paranoid':![],'indexes':[{'name':_0x6aa1('0xe'),'fields':[_0x6aa1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index e9ab770..264cc60 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 _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x23e608,_0x5a524f){var _0x2909e9=function(_0x30fe2c){while(--_0x30fe2c){_0x23e608['push'](_0x23e608['shift']());}};_0x2909e9(++_0x5a524f);}(_0x5f2f,0x73));var _0xf5f2=function(_0xfcc29e,_0x5a456d){_0xfcc29e=_0xfcc29e-0x0;var _0x340c45=_0x5f2f[_0xfcc29e];return _0x340c45;};'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')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['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(_0x1eb82d,_0x1e23cb){var _0x2c9502=function(_0x4a3500){while(--_0x4a3500){_0x1eb82d['push'](_0x1eb82d['shift']());}};_0x2c9502(++_0x1e23cb);}(_0x2ef3,0xba));var _0x32ef=function(_0x4a3c00,_0x2f7502){_0x4a3c00=_0x4a3c00-0x0;var _0x541d37=_0x2ef3[_0x4a3c00];return _0x541d37;};'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 d90cd13..4fdeefb 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x23322d,_0x2f503c){var _0x3e5152=function(_0x141687){while(--_0x141687){_0x23322d['push'](_0x23322d['shift']());}};_0x3e5152(++_0x2f503c);}(_0xedd9,0xfc));var _0x9edd=function(_0x447b93,_0x2670ae){_0x447b93=_0x447b93-0x0;var _0x1fd738=_0xedd9[_0x447b93];return _0x1fd738;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3323f0,_0x155677){var _0x2e25cf=function(_0x26f6d9){while(--_0x26f6d9){_0x3323f0['push'](_0x3323f0['shift']());}};_0x2e25cf(++_0x155677);}(_0x70e0,0x17b));var _0x070e=function(_0x4a9aef,_0x1a28ae){_0x4a9aef=_0x4a9aef-0x0;var _0x12058a=_0x70e0[_0x4a9aef];return _0x12058a;};'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 f508839..a63c1e1 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 _0xcf85=['BOOLEAN','INBOX','exports','STRING'];(function(_0x483652,_0x52a991){var _0x1a9cff=function(_0x127bdd){while(--_0x127bdd){_0x483652['push'](_0x483652['shift']());}};_0x1a9cff(++_0x52a991);}(_0xcf85,0x13e));var _0x5cf8=function(_0x1e8a13,_0x150633){_0x1e8a13=_0x1e8a13-0x0;var _0x1b5c34=_0xcf85[_0x1e8a13];return _0x1b5c34;};'use strict';var Sequelize=require('sequelize');module[_0x5cf8('0x0')]={'description':{'type':Sequelize[_0x5cf8('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x5cf8('0x1')]},'password':{'type':Sequelize[_0x5cf8('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x5cf8('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x5cf8('0x1')],'defaultValue':_0x5cf8('0x3')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x5cf8('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x42a8=['BOOLEAN','INBOX','INTEGER','sequelize','exports','STRING'];(function(_0x3d6faf,_0x434bba){var _0x3953e2=function(_0x295fce){while(--_0x295fce){_0x3d6faf['push'](_0x3d6faf['shift']());}};_0x3953e2(++_0x434bba);}(_0x42a8,0x1a1));var _0x842a=function(_0x2a1c1c,_0x2c664e){_0x2a1c1c=_0x2a1c1c-0x0;var _0xbf4766=_0x42a8[_0x2a1c1c];return _0xbf4766;};'use strict';var Sequelize=require(_0x842a('0x0'));module[_0x842a('0x1')]={'description':{'type':Sequelize[_0x842a('0x2')]},'host':{'type':Sequelize[_0x842a('0x2')]},'authentication':{'type':Sequelize[_0x842a('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x842a('0x2')]},'password':{'type':Sequelize[_0x842a('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x842a('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x842a('0x2')],'defaultValue':_0x842a('0x4')},'connTimeout':{'type':Sequelize[_0x842a('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x842a('0x2')]},'modernAuthentication':{'type':Sequelize[_0x842a('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 02d6857..a913f39 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 _0x4980=['lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./mailServerIn.attributes','exports','MailServerIn'];(function(_0x36ae3a,_0x39d3e5){var _0x11cd9a=function(_0x410c65){while(--_0x410c65){_0x36ae3a['push'](_0x36ae3a['shift']());}};_0x11cd9a(++_0x39d3e5);}(_0x4980,0x14a));var _0x0498=function(_0x30c0af,_0x17a5b5){_0x30c0af=_0x30c0af-0x0;var _0x3314fa=_0x4980[_0x30c0af];return _0x3314fa;};'use strict';var _=require(_0x0498('0x0'));var util=require(_0x0498('0x1'));var logger=require(_0x0498('0x2'))(_0x0498('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0498('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0498('0x5'));var config=require(_0x0498('0x6'));var attributes=require(_0x0498('0x7'));module[_0x0498('0x8')]=function(_0x10f1fb,_0x79d518){return _0x10f1fb['define'](_0x0498('0x9'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x449e=['MailServerIn','lodash','util','../../config/logger','api','bluebird','request-promise','path','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x449e,0xfb));var _0xe449=function(_0x517909,_0x5cd3c5){_0x517909=_0x517909-0x0;var _0x304c58=_0x449e[_0x517909];return _0x304c58;};'use strict';var _=require(_0xe449('0x0'));var util=require(_0xe449('0x1'));var logger=require(_0xe449('0x2'))(_0xe449('0x3'));var moment=require('moment');var BPromise=require(_0xe449('0x4'));var rp=require(_0xe449('0x5'));var fs=require('fs');var path=require(_0xe449('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0xe449('0x7')]=function(_0x40a0a5,_0x321025){return _0x40a0a5[_0xe449('0x8')](_0xe449('0x9'),attributes,{'tableName':'mail_servers_in','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 e77ba13..5268153 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 _0x8d84=['error','message','info','result','catch','findAll','options','attributes','limit','include','map','model','GetMailServerIn','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s'];(function(_0x4814ff,_0x58c0e4){var _0x53e652=function(_0x1d8b71){while(--_0x1d8b71){_0x4814ff['push'](_0x4814ff['shift']());}};_0x53e652(++_0x58c0e4);}(_0x8d84,0xfe));var _0x48d8=function(_0x5e40e8,_0x12ad3a){_0x5e40e8=_0x5e40e8-0x0;var _0x5ae767=_0x8d84[_0x5e40e8];return _0x5ae767;};'use strict';var _=require(_0x48d8('0x0'));var util=require(_0x48d8('0x1'));var moment=require(_0x48d8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x48d8('0x3'));var db=require(_0x48d8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x48d8('0x5'))(_0x48d8('0x6'));var config=require(_0x48d8('0x7'));var jayson=require(_0x48d8('0x8'));var client=jayson[_0x48d8('0x9')][_0x48d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x185938,_0x159889,_0x400545){return new BPromise(function(_0x2543e1,_0x210d4e){return client['request'](_0x185938,_0x400545)[_0x48d8('0xb')](function(_0x389b5d){logger['info'](_0x48d8('0xc'),_0x159889,_0x48d8('0xd'));logger[_0x48d8('0xe')](_0x48d8('0xf'),_0x159889,'request\x20sent',JSON['stringify'](_0x389b5d));if(_0x389b5d[_0x48d8('0x10')]){if(_0x389b5d[_0x48d8('0x10')]['code']===0x1f4){logger[_0x48d8('0x10')](_0x48d8('0xc'),_0x159889,_0x389b5d[_0x48d8('0x10')][_0x48d8('0x11')]);return _0x210d4e(_0x389b5d[_0x48d8('0x10')]['message']);}logger[_0x48d8('0x10')](_0x48d8('0xc'),_0x159889,_0x389b5d[_0x48d8('0x10')]['message']);return _0x2543e1(_0x389b5d['error'][_0x48d8('0x11')]);}else{logger[_0x48d8('0x12')](_0x48d8('0xc'),_0x159889,'request\x20sent');_0x2543e1(_0x389b5d[_0x48d8('0x13')][_0x48d8('0x11')]);}})[_0x48d8('0x14')](function(_0x31ef49){logger[_0x48d8('0x10')](_0x48d8('0xc'),_0x159889,_0x31ef49);_0x210d4e(_0x31ef49);});});}exports['GetMailServerIn']=function(_0x521dab){var _0x28bea3=this;return new Promise(function(_0x32e271,_0x1d7567){return db['MailServerIn'][_0x48d8('0x15')]({'raw':_0x521dab['options']?_0x521dab['options']['raw']===undefined?!![]:![]:!![],'where':_0x521dab[_0x48d8('0x16')]?_0x521dab[_0x48d8('0x16')]['where']||null:null,'attributes':_0x521dab[_0x48d8('0x16')]?_0x521dab[_0x48d8('0x16')][_0x48d8('0x17')]||null:null,'limit':_0x521dab[_0x48d8('0x16')]?_0x521dab[_0x48d8('0x16')][_0x48d8('0x18')]||null:null,'include':_0x521dab[_0x48d8('0x16')]?_0x521dab[_0x48d8('0x16')][_0x48d8('0x19')]?_[_0x48d8('0x1a')](_0x521dab[_0x48d8('0x16')][_0x48d8('0x19')],function(_0x532ebb){return{'model':db[_0x532ebb[_0x48d8('0x1b')]],'as':_0x532ebb['as'],'attributes':_0x532ebb['attributes'],'include':_0x532ebb[_0x48d8('0x19')]?_['map'](_0x532ebb[_0x48d8('0x19')],function(_0x543628){return{'model':db[_0x543628[_0x48d8('0x1b')]],'as':_0x543628['as'],'attributes':_0x543628['attributes'],'include':_0x543628[_0x48d8('0x19')]?_[_0x48d8('0x1a')](_0x543628['include'],function(_0x4fc4a3){return{'model':db[_0x4fc4a3[_0x48d8('0x1b')]],'as':_0x4fc4a3['as'],'attributes':_0x4fc4a3[_0x48d8('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39892f){logger[_0x48d8('0x12')]('GetMailServerIn',_0x521dab);logger['debug'](_0x48d8('0x1c'),_0x521dab,JSON[_0x48d8('0x1d')](_0x39892f));_0x32e271(_0x39892f);})['catch'](function(_0x59dc6e){logger['error']('GetMailServerIn',_0x59dc6e[_0x48d8('0x11')],_0x521dab);_0x1d7567(_0x28bea3[_0x48d8('0x10')](0x1f4,_0x59dc6e[_0x48d8('0x11')]));});});}; \ No newline at end of file +var _0x7341=['include','map','model','GetMailServerIn','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','attributes'];(function(_0x403440,_0x2b54c7){var _0x1d3bb9=function(_0x13a1b5){while(--_0x13a1b5){_0x403440['push'](_0x403440['shift']());}};_0x1d3bb9(++_0x2b54c7);}(_0x7341,0xe4));var _0x1734=function(_0x2f4b21,_0x3336e0){_0x2f4b21=_0x2f4b21-0x0;var _0x25f325=_0x7341[_0x2f4b21];return _0x25f325;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1734('0x0'));var BPromise=require('bluebird');var rs=require(_0x1734('0x1'));var fs=require('fs');var Redis=require(_0x1734('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1734('0x3'));var logger=require(_0x1734('0x4'))(_0x1734('0x5'));var config=require(_0x1734('0x6'));var jayson=require(_0x1734('0x7'));var client=jayson[_0x1734('0x8')][_0x1734('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c7349,_0x1ca30b,_0x2c223d){return new BPromise(function(_0x45c529,_0x5b8977){return client[_0x1734('0xa')](_0x4c7349,_0x2c223d)['then'](function(_0x56f0d5){logger[_0x1734('0xb')](_0x1734('0xc'),_0x1ca30b,_0x1734('0xd'));logger[_0x1734('0xe')](_0x1734('0xf'),_0x1ca30b,_0x1734('0xd'),JSON[_0x1734('0x10')](_0x56f0d5));if(_0x56f0d5[_0x1734('0x11')]){if(_0x56f0d5[_0x1734('0x11')][_0x1734('0x12')]===0x1f4){logger['error'](_0x1734('0xc'),_0x1ca30b,_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);return _0x5b8977(_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);}logger[_0x1734('0x11')](_0x1734('0xc'),_0x1ca30b,_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);return _0x45c529(_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);}else{logger[_0x1734('0xb')](_0x1734('0xc'),_0x1ca30b,_0x1734('0xd'));_0x45c529(_0x56f0d5[_0x1734('0x14')][_0x1734('0x13')]);}})[_0x1734('0x15')](function(_0x1ea188){logger[_0x1734('0x11')]('MailServerIn,\x20%s,\x20%s',_0x1ca30b,_0x1ea188);_0x5b8977(_0x1ea188);});});}exports['GetMailServerIn']=function(_0x1fa9c0){var _0x665ddc=this;return new Promise(function(_0x4a86d1,_0x212e63){return db['MailServerIn']['findAll']({'raw':_0x1fa9c0['options']?_0x1fa9c0[_0x1734('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1fa9c0[_0x1734('0x16')]?_0x1fa9c0[_0x1734('0x16')]['where']||null:null,'attributes':_0x1fa9c0['options']?_0x1fa9c0['options'][_0x1734('0x17')]||null:null,'limit':_0x1fa9c0['options']?_0x1fa9c0[_0x1734('0x16')]['limit']||null:null,'include':_0x1fa9c0[_0x1734('0x16')]?_0x1fa9c0[_0x1734('0x16')][_0x1734('0x18')]?_[_0x1734('0x19')](_0x1fa9c0[_0x1734('0x16')][_0x1734('0x18')],function(_0x4285ee){return{'model':db[_0x4285ee[_0x1734('0x1a')]],'as':_0x4285ee['as'],'attributes':_0x4285ee[_0x1734('0x17')],'include':_0x4285ee['include']?_[_0x1734('0x19')](_0x4285ee['include'],function(_0x5e0023){return{'model':db[_0x5e0023[_0x1734('0x1a')]],'as':_0x5e0023['as'],'attributes':_0x5e0023[_0x1734('0x17')],'include':_0x5e0023[_0x1734('0x18')]?_[_0x1734('0x19')](_0x5e0023[_0x1734('0x18')],function(_0x2a95e3){return{'model':db[_0x2a95e3[_0x1734('0x1a')]],'as':_0x2a95e3['as'],'attributes':_0x2a95e3[_0x1734('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x381960){logger['info'](_0x1734('0x1b'),_0x1fa9c0);logger[_0x1734('0xe')](_0x1734('0x1b'),_0x1fa9c0,JSON['stringify'](_0x381960));_0x4a86d1(_0x381960);})[_0x1734('0x15')](function(_0x3f9abe){logger[_0x1734('0x11')]('GetMailServerIn',_0x3f9abe[_0x1734('0x13')],_0x1fa9c0);_0x212e63(_0x665ddc[_0x1734('0x11')](0x1f4,_0x3f9abe['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 7607c30..09764e4 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x7a54,0x106));var _0x47a5=function(_0x46a526,_0xeda259){_0x46a526=_0x46a526-0x0;var _0x3074cc=_0x7a54[_0x46a526];return _0x3074cc;};'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 584b14a..f2b4a63 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 _0xcf66=['BOOLEAN','sequelize','exports','STRING'];(function(_0x3d3d2b,_0x3ede6a){var _0x538fce=function(_0x4c08cd){while(--_0x4c08cd){_0x3d3d2b['push'](_0x3d3d2b['shift']());}};_0x538fce(++_0x3ede6a);}(_0xcf66,0x71));var _0x6cf6=function(_0x346477,_0x51075d){_0x346477=_0x346477-0x0;var _0x15f4a0=_0xcf66[_0x346477];return _0x15f4a0;};'use strict';var Sequelize=require(_0x6cf6('0x0'));module[_0x6cf6('0x1')]={'description':{'type':Sequelize[_0x6cf6('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x6cf6('0x2')]},'pass':{'type':Sequelize[_0x6cf6('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x6cf6('0x2')]},'authentication':{'type':Sequelize[_0x6cf6('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3de3=['INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x1d3c94,_0x2a0864){var _0x3a4ae8=function(_0x4026cf){while(--_0x4026cf){_0x1d3c94['push'](_0x1d3c94['shift']());}};_0x3a4ae8(++_0x2a0864);}(_0x3de3,0x1ce));var _0x33de=function(_0x1cfde8,_0x27dcee){_0x1cfde8=_0x1cfde8-0x0;var _0x45f7ba=_0x3de3[_0x1cfde8];return _0x45f7ba;};'use strict';var Sequelize=require(_0x33de('0x0'));module['exports']={'description':{'type':Sequelize[_0x33de('0x1')]},'host':{'type':Sequelize[_0x33de('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x33de('0x1')]},'port':{'type':Sequelize[_0x33de('0x2')]},'secure':{'type':Sequelize[_0x33de('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x33de('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x33de('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 024ac07..c676dfc 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 _0x48f1=['Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','MailServerOut','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','find','catch','create','body','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set'];(function(_0x16c9e6,_0x562403){var _0x3cb3f7=function(_0x3fadf8){while(--_0x3fadf8){_0x16c9e6['push'](_0x16c9e6['shift']());}};_0x3cb3f7(++_0x562403);}(_0x48f1,0x72));var _0x148f=function(_0x15771c,_0x1137e2){_0x15771c=_0x15771c-0x0;var _0x395924=_0x48f1[_0x15771c];return _0x395924;};'use strict';var emlformat=require(_0x148f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x148f('0x1'));var jsonpatch=require(_0x148f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x148f('0x3'));var Mustache=require(_0x148f('0x4'));var util=require(_0x148f('0x5'));var path=require(_0x148f('0x6'));var sox=require(_0x148f('0x7'));var csv=require(_0x148f('0x8'));var ejs=require(_0x148f('0x9'));var fs=require('fs');var fs_extra=require(_0x148f('0xa'));var _=require('lodash');var squel=require(_0x148f('0xb'));var crypto=require('crypto');var jsforce=require(_0x148f('0xc'));var deskjs=require(_0x148f('0xd'));var toCsv=require(_0x148f('0x8'));var querystring=require(_0x148f('0xe'));var Papa=require(_0x148f('0xf'));var Redis=require(_0x148f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x148f('0x11'));var as=require(_0x148f('0x12'));var hardwareService=require(_0x148f('0x13'));var logger=require('../../config/logger')(_0x148f('0x14'));var utils=require(_0x148f('0x15'));var config=require(_0x148f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x148f('0x17'))['db'];function respondWithStatusCode(_0x4e251d,_0x269fa5){_0x269fa5=_0x269fa5||0xcc;return function(_0x8069de){if(_0x8069de){return _0x4e251d[_0x148f('0x18')](_0x269fa5);}return _0x4e251d[_0x148f('0x19')](_0x269fa5)[_0x148f('0x1a')]();};}function respondWithResult(_0x43a318,_0x1e8b38){_0x1e8b38=_0x1e8b38||0xc8;return function(_0x497a29){if(_0x497a29){return _0x43a318[_0x148f('0x19')](_0x1e8b38)[_0x148f('0x1b')](_0x497a29);}};}function respondWithFilteredResult(_0x5be8c9,_0x344f7a){return function(_0x12b145){if(_0x12b145){var _0x14fb3e=typeof _0x344f7a[_0x148f('0x1c')]===_0x148f('0x1d')&&typeof _0x344f7a['limit']===_0x148f('0x1d');var _0x1f3dcb=_0x12b145[_0x148f('0x1e')];var _0x3db5ca=_0x14fb3e?0x0:_0x344f7a[_0x148f('0x1c')];var _0x34c65d=_0x14fb3e?_0x12b145[_0x148f('0x1e')]:_0x344f7a[_0x148f('0x1c')]+_0x344f7a['limit'];var _0x1a5e84;if(_0x34c65d>=_0x1f3dcb){_0x34c65d=_0x1f3dcb;_0x1a5e84=0xc8;}else{_0x1a5e84=0xce;}_0x5be8c9['status'](_0x1a5e84);return _0x5be8c9[_0x148f('0x1f')](_0x148f('0x20'),_0x3db5ca+'-'+_0x34c65d+'/'+_0x1f3dcb)['json'](_0x12b145);}return null;};}function patchUpdates(_0x5373e3){return function(_0x152abe){try{jsonpatch[_0x148f('0x21')](_0x152abe,_0x5373e3,!![]);}catch(_0x12f250){return BPromise[_0x148f('0x22')](_0x12f250);}return _0x152abe['save']();};}function saveUpdates(_0x45eae2,_0x4c6d95){return function(_0x4ea5d6){if(_0x4ea5d6){return _0x4ea5d6[_0x148f('0x23')](_0x45eae2)['then'](function(_0x35d798){return _0x35d798;});}return null;};}function removeEntity(_0x5256f2,_0x5a6b7c){return function(_0x5d98ad){if(_0x5d98ad){return _0x5d98ad[_0x148f('0x24')]()[_0x148f('0x25')](function(){_0x5256f2[_0x148f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a9c96,_0x4c0fbe){return function(_0x2346c5){if(!_0x2346c5){_0x3a9c96[_0x148f('0x18')](0x194);}return _0x2346c5;};}function handleError(_0xf5f314,_0x1abff1){_0x1abff1=_0x1abff1||0x1f4;return function(_0x4de127){logger[_0x148f('0x26')](_0x4de127['stack']);if(_0x4de127[_0x148f('0x27')]){delete _0x4de127[_0x148f('0x27')];}_0xf5f314[_0x148f('0x19')](_0x1abff1)[_0x148f('0x28')](_0x4de127);};}exports[_0x148f('0x29')]=function(_0x17de5d,_0x2633ae){var _0x584bbd={},_0x5dd166={},_0x33b093={'count':0x0,'rows':[]};var _0xfc9a6b=_[_0x148f('0x2a')](db[_0x148f('0x2b')]['rawAttributes'],function(_0x8a7b75){return{'name':_0x8a7b75[_0x148f('0x2c')],'type':_0x8a7b75['type'][_0x148f('0x2d')]};});_0x5dd166['model']=_[_0x148f('0x2a')](_0xfc9a6b,_0x148f('0x27'));_0x5dd166[_0x148f('0x2e')]=_[_0x148f('0x2f')](_0x17de5d['query']);_0x5dd166[_0x148f('0x30')]=_[_0x148f('0x31')](_0x5dd166['model'],_0x5dd166[_0x148f('0x2e')]);_0x584bbd['attributes']=_[_0x148f('0x31')](_0x5dd166[_0x148f('0x32')],qs['fields'](_0x17de5d[_0x148f('0x2e')][_0x148f('0x33')]));_0x584bbd['attributes']=_0x584bbd[_0x148f('0x34')][_0x148f('0x35')]?_0x584bbd['attributes']:_0x5dd166[_0x148f('0x32')];if(!_0x17de5d[_0x148f('0x2e')][_0x148f('0x36')](_0x148f('0x37'))){_0x584bbd['limit']=qs[_0x148f('0x38')](_0x17de5d[_0x148f('0x2e')]['limit']);_0x584bbd[_0x148f('0x1c')]=qs[_0x148f('0x1c')](_0x17de5d[_0x148f('0x2e')]['offset']);}_0x584bbd['order']=qs[_0x148f('0x39')](_0x17de5d[_0x148f('0x2e')][_0x148f('0x39')]);_0x584bbd[_0x148f('0x3a')]=qs[_0x148f('0x30')](_[_0x148f('0x3b')](_0x17de5d[_0x148f('0x2e')],_0x5dd166[_0x148f('0x30')]),_0xfc9a6b);if(_0x17de5d[_0x148f('0x2e')][_0x148f('0x3c')]){_0x584bbd[_0x148f('0x3a')]=_[_0x148f('0x3d')](_0x584bbd[_0x148f('0x3a')],{'$or':_[_0x148f('0x2a')](_0xfc9a6b,function(_0x399246){if(_0x399246['type']!==_0x148f('0x3e')){var _0x4bc17e={};_0x4bc17e[_0x399246[_0x148f('0x27')]]={'$like':'%'+_0x17de5d[_0x148f('0x2e')][_0x148f('0x3c')]+'%'};return _0x4bc17e;}})});}_0x584bbd=_[_0x148f('0x3d')]({},_0x584bbd,_0x17de5d[_0x148f('0x3f')]);var _0xb3c534={'where':_0x584bbd[_0x148f('0x3a')]};return db[_0x148f('0x2b')][_0x148f('0x1e')](_0xb3c534)['then'](function(_0x33632d){_0x33b093[_0x148f('0x1e')]=_0x33632d;if(_0x17de5d['query'][_0x148f('0x40')]){_0x584bbd['include']=[{'all':!![]}];}return db[_0x148f('0x2b')][_0x148f('0x41')](_0x584bbd);})['then'](function(_0x185a86){_0x33b093[_0x148f('0x42')]=_0x185a86;return _0x33b093;})['then'](respondWithFilteredResult(_0x2633ae,_0x584bbd))['catch'](handleError(_0x2633ae,null));};exports[_0x148f('0x43')]=function(_0x201f4f,_0x59872d){var _0x5d4887={'raw':!![],'where':{'id':_0x201f4f[_0x148f('0x44')]['id']}},_0x5c17dd={};_0x5c17dd['model']=_[_0x148f('0x2f')](db[_0x148f('0x2b')]['rawAttributes']);_0x5c17dd[_0x148f('0x2e')]=_[_0x148f('0x2f')](_0x201f4f[_0x148f('0x2e')]);_0x5c17dd[_0x148f('0x30')]=_[_0x148f('0x31')](_0x5c17dd[_0x148f('0x32')],_0x5c17dd['query']);_0x5d4887[_0x148f('0x34')]=_[_0x148f('0x31')](_0x5c17dd[_0x148f('0x32')],qs[_0x148f('0x33')](_0x201f4f[_0x148f('0x2e')]['fields']));_0x5d4887[_0x148f('0x34')]=_0x5d4887[_0x148f('0x34')][_0x148f('0x35')]?_0x5d4887['attributes']:_0x5c17dd[_0x148f('0x32')];if(_0x201f4f['query'][_0x148f('0x40')]){_0x5d4887['include']=[{'all':!![]}];}_0x5d4887=_[_0x148f('0x3d')]({},_0x5d4887,_0x201f4f[_0x148f('0x3f')]);return db[_0x148f('0x2b')][_0x148f('0x45')](_0x5d4887)[_0x148f('0x25')](handleEntityNotFound(_0x59872d,null))[_0x148f('0x25')](respondWithResult(_0x59872d,null))[_0x148f('0x46')](handleError(_0x59872d,null));};exports['create']=function(_0x5a26d5,_0x333b62){return db[_0x148f('0x2b')][_0x148f('0x47')](_0x5a26d5['body'],{})['then'](respondWithResult(_0x333b62,0xc9))[_0x148f('0x46')](handleError(_0x333b62,null));};exports[_0x148f('0x23')]=function(_0x217bcc,_0x2cb521){if(_0x217bcc[_0x148f('0x48')]['id']){delete _0x217bcc[_0x148f('0x48')]['id'];}return db[_0x148f('0x2b')][_0x148f('0x45')]({'where':{'id':_0x217bcc[_0x148f('0x44')]['id']}})[_0x148f('0x25')](handleEntityNotFound(_0x2cb521,null))[_0x148f('0x25')](saveUpdates(_0x217bcc[_0x148f('0x48')],null))[_0x148f('0x25')](respondWithResult(_0x2cb521,null))[_0x148f('0x46')](handleError(_0x2cb521,null));};exports[_0x148f('0x24')]=function(_0x53c9d8,_0x48fc4d){return db[_0x148f('0x2b')][_0x148f('0x45')]({'where':{'id':_0x53c9d8[_0x148f('0x44')]['id']}})['then'](handleEntityNotFound(_0x48fc4d,null))[_0x148f('0x25')](removeEntity(_0x48fc4d,null))[_0x148f('0x46')](handleError(_0x48fc4d,null));}; \ No newline at end of file +var _0x0779=['desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','save','update','destroy','then','end','error','stack','name','map','MailServerOut','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','length','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','lodash','squel','crypto','jsforce'];(function(_0x89a001,_0x3a9a8c){var _0x5f3ec2=function(_0x3e849b){while(--_0x3e849b){_0x89a001['push'](_0x89a001['shift']());}};_0x5f3ec2(++_0x3a9a8c);}(_0x0779,0xc9));var _0x9077=function(_0x232199,_0x28638a){_0x232199=_0x232199-0x0;var _0x59e6d9=_0x0779[_0x232199];return _0x59e6d9;};'use strict';var emlformat=require(_0x9077('0x0'));var rimraf=require(_0x9077('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9077('0x2'));var rp=require(_0x9077('0x3'));var moment=require(_0x9077('0x4'));var BPromise=require(_0x9077('0x5'));var Mustache=require(_0x9077('0x6'));var util=require('util');var path=require(_0x9077('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9077('0x8'));var squel=require(_0x9077('0x9'));var crypto=require(_0x9077('0xa'));var jsforce=require(_0x9077('0xb'));var deskjs=require(_0x9077('0xc'));var toCsv=require(_0x9077('0xd'));var querystring=require(_0x9077('0xe'));var Papa=require('papaparse');var Redis=require(_0x9077('0xf'));var authService=require(_0x9077('0x10'));var qs=require(_0x9077('0x11'));var as=require(_0x9077('0x12'));var hardwareService=require(_0x9077('0x13'));var logger=require('../../config/logger')(_0x9077('0x14'));var utils=require(_0x9077('0x15'));var config=require(_0x9077('0x16'));var licenseUtil=require(_0x9077('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x305290,_0x2e689d){_0x2e689d=_0x2e689d||0xcc;return function(_0x4b2a45){if(_0x4b2a45){return _0x305290[_0x9077('0x18')](_0x2e689d);}return _0x305290[_0x9077('0x19')](_0x2e689d)['end']();};}function respondWithResult(_0x19fc79,_0x311573){_0x311573=_0x311573||0xc8;return function(_0x2e6495){if(_0x2e6495){return _0x19fc79[_0x9077('0x19')](_0x311573)['json'](_0x2e6495);}};}function respondWithFilteredResult(_0x3dae1e,_0x441fd9){return function(_0x15f37c){if(_0x15f37c){var _0x4e50fe=typeof _0x441fd9[_0x9077('0x1a')]===_0x9077('0x1b')&&typeof _0x441fd9['limit']===_0x9077('0x1b');var _0x5121b3=_0x15f37c[_0x9077('0x1c')];var _0x5a281d=_0x4e50fe?0x0:_0x441fd9['offset'];var _0x13a516=_0x4e50fe?_0x15f37c[_0x9077('0x1c')]:_0x441fd9[_0x9077('0x1a')]+_0x441fd9[_0x9077('0x1d')];var _0xdf7cb9;if(_0x13a516>=_0x5121b3){_0x13a516=_0x5121b3;_0xdf7cb9=0xc8;}else{_0xdf7cb9=0xce;}_0x3dae1e[_0x9077('0x19')](_0xdf7cb9);return _0x3dae1e[_0x9077('0x1e')](_0x9077('0x1f'),_0x5a281d+'-'+_0x13a516+'/'+_0x5121b3)[_0x9077('0x20')](_0x15f37c);}return null;};}function patchUpdates(_0xbb508f){return function(_0x1b7478){try{jsonpatch['apply'](_0x1b7478,_0xbb508f,!![]);}catch(_0x1709e4){return BPromise['reject'](_0x1709e4);}return _0x1b7478[_0x9077('0x21')]();};}function saveUpdates(_0x5ada2b,_0x6c9b87){return function(_0x2bd036){if(_0x2bd036){return _0x2bd036[_0x9077('0x22')](_0x5ada2b)['then'](function(_0x5d53ef){return _0x5d53ef;});}return null;};}function removeEntity(_0x55fe6e,_0x21c55e){return function(_0x204137){if(_0x204137){return _0x204137[_0x9077('0x23')]()[_0x9077('0x24')](function(){_0x55fe6e[_0x9077('0x19')](0xcc)[_0x9077('0x25')]();});}};}function handleEntityNotFound(_0x11e070,_0x281c23){return function(_0x5f44e3){if(!_0x5f44e3){_0x11e070[_0x9077('0x18')](0x194);}return _0x5f44e3;};}function handleError(_0x43918e,_0x563d87){_0x563d87=_0x563d87||0x1f4;return function(_0x5c59f6){logger[_0x9077('0x26')](_0x5c59f6[_0x9077('0x27')]);if(_0x5c59f6[_0x9077('0x28')]){delete _0x5c59f6[_0x9077('0x28')];}_0x43918e[_0x9077('0x19')](_0x563d87)['send'](_0x5c59f6);};}exports['index']=function(_0x64f1f9,_0x3fc76e){var _0x543281={},_0x40c932={},_0x1e2c7c={'count':0x0,'rows':[]};var _0x3c7e5e=_[_0x9077('0x29')](db[_0x9077('0x2a')][_0x9077('0x2b')],function(_0x4447e0){return{'name':_0x4447e0['fieldName'],'type':_0x4447e0[_0x9077('0x2c')]['key']};});_0x40c932[_0x9077('0x2d')]=_[_0x9077('0x29')](_0x3c7e5e,_0x9077('0x28'));_0x40c932['query']=_[_0x9077('0x2e')](_0x64f1f9[_0x9077('0x2f')]);_0x40c932[_0x9077('0x30')]=_[_0x9077('0x31')](_0x40c932['model'],_0x40c932[_0x9077('0x2f')]);_0x543281[_0x9077('0x32')]=_[_0x9077('0x31')](_0x40c932[_0x9077('0x2d')],qs['fields'](_0x64f1f9[_0x9077('0x2f')][_0x9077('0x33')]));_0x543281[_0x9077('0x32')]=_0x543281['attributes']['length']?_0x543281[_0x9077('0x32')]:_0x40c932['model'];if(!_0x64f1f9[_0x9077('0x2f')][_0x9077('0x34')](_0x9077('0x35'))){_0x543281['limit']=qs['limit'](_0x64f1f9['query'][_0x9077('0x1d')]);_0x543281[_0x9077('0x1a')]=qs['offset'](_0x64f1f9[_0x9077('0x2f')][_0x9077('0x1a')]);}_0x543281[_0x9077('0x36')]=qs[_0x9077('0x37')](_0x64f1f9['query'][_0x9077('0x37')]);_0x543281[_0x9077('0x38')]=qs[_0x9077('0x30')](_[_0x9077('0x39')](_0x64f1f9[_0x9077('0x2f')],_0x40c932[_0x9077('0x30')]),_0x3c7e5e);if(_0x64f1f9[_0x9077('0x2f')][_0x9077('0x3a')]){_0x543281['where']=_[_0x9077('0x3b')](_0x543281[_0x9077('0x38')],{'$or':_['map'](_0x3c7e5e,function(_0x55940e){if(_0x55940e[_0x9077('0x2c')]!==_0x9077('0x3c')){var _0x53365a={};_0x53365a[_0x55940e[_0x9077('0x28')]]={'$like':'%'+_0x64f1f9[_0x9077('0x2f')][_0x9077('0x3a')]+'%'};return _0x53365a;}})});}_0x543281=_[_0x9077('0x3b')]({},_0x543281,_0x64f1f9[_0x9077('0x3d')]);var _0x23fb7b={'where':_0x543281[_0x9077('0x38')]};return db[_0x9077('0x2a')]['count'](_0x23fb7b)[_0x9077('0x24')](function(_0x4a0655){_0x1e2c7c[_0x9077('0x1c')]=_0x4a0655;if(_0x64f1f9['query'][_0x9077('0x3e')]){_0x543281[_0x9077('0x3f')]=[{'all':!![]}];}return db[_0x9077('0x2a')]['findAll'](_0x543281);})[_0x9077('0x24')](function(_0x124f56){_0x1e2c7c[_0x9077('0x40')]=_0x124f56;return _0x1e2c7c;})[_0x9077('0x24')](respondWithFilteredResult(_0x3fc76e,_0x543281))[_0x9077('0x41')](handleError(_0x3fc76e,null));};exports['show']=function(_0x2ff5dd,_0x242f1c){var _0x5838f3={'raw':!![],'where':{'id':_0x2ff5dd['params']['id']}},_0x439e6c={};_0x439e6c[_0x9077('0x2d')]=_[_0x9077('0x2e')](db[_0x9077('0x2a')][_0x9077('0x2b')]);_0x439e6c[_0x9077('0x2f')]=_[_0x9077('0x2e')](_0x2ff5dd[_0x9077('0x2f')]);_0x439e6c[_0x9077('0x30')]=_['intersection'](_0x439e6c[_0x9077('0x2d')],_0x439e6c['query']);_0x5838f3['attributes']=_[_0x9077('0x31')](_0x439e6c[_0x9077('0x2d')],qs['fields'](_0x2ff5dd['query'][_0x9077('0x33')]));_0x5838f3[_0x9077('0x32')]=_0x5838f3[_0x9077('0x32')][_0x9077('0x42')]?_0x5838f3[_0x9077('0x32')]:_0x439e6c[_0x9077('0x2d')];if(_0x2ff5dd[_0x9077('0x2f')][_0x9077('0x3e')]){_0x5838f3[_0x9077('0x3f')]=[{'all':!![]}];}_0x5838f3=_[_0x9077('0x3b')]({},_0x5838f3,_0x2ff5dd['options']);return db['MailServerOut']['find'](_0x5838f3)[_0x9077('0x24')](handleEntityNotFound(_0x242f1c,null))[_0x9077('0x24')](respondWithResult(_0x242f1c,null))['catch'](handleError(_0x242f1c,null));};exports[_0x9077('0x43')]=function(_0xf89f83,_0x2cf81e){return db[_0x9077('0x2a')][_0x9077('0x43')](_0xf89f83[_0x9077('0x44')],{})['then'](respondWithResult(_0x2cf81e,0xc9))[_0x9077('0x41')](handleError(_0x2cf81e,null));};exports[_0x9077('0x22')]=function(_0x2d253e,_0x464790){if(_0x2d253e[_0x9077('0x44')]['id']){delete _0x2d253e[_0x9077('0x44')]['id'];}return db['MailServerOut'][_0x9077('0x45')]({'where':{'id':_0x2d253e[_0x9077('0x46')]['id']}})[_0x9077('0x24')](handleEntityNotFound(_0x464790,null))[_0x9077('0x24')](saveUpdates(_0x2d253e['body'],null))[_0x9077('0x24')](respondWithResult(_0x464790,null))[_0x9077('0x41')](handleError(_0x464790,null));};exports[_0x9077('0x23')]=function(_0x183d5d,_0x5dcd10){return db['MailServerOut'][_0x9077('0x45')]({'where':{'id':_0x183d5d['params']['id']}})[_0x9077('0x24')](handleEntityNotFound(_0x5dcd10,null))[_0x9077('0x24')](removeEntity(_0x5dcd10,null))['catch'](handleError(_0x5dcd10,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index c1197a9..59cba52 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 _0x5ad5=['lodash','util','api','bluebird','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out'];(function(_0x2e1db1,_0x963f33){var _0x2312d3=function(_0x5aece0){while(--_0x5aece0){_0x2e1db1['push'](_0x2e1db1['shift']());}};_0x2312d3(++_0x963f33);}(_0x5ad5,0xa5));var _0x55ad=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5ad5[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x55ad('0x0'));var util=require(_0x55ad('0x1'));var logger=require('../../config/logger')(_0x55ad('0x2'));var moment=require('moment');var BPromise=require(_0x55ad('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x55ad('0x4'));var config=require(_0x55ad('0x5'));var attributes=require(_0x55ad('0x6'));module[_0x55ad('0x7')]=function(_0x2c1b27,_0x3f5df7){return _0x2c1b27[_0x55ad('0x8')](_0x55ad('0x9'),attributes,{'tableName':_0x55ad('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17ac=['api','bluebird','rimraf','../../config/environment','./mailServerOut.attributes','define','mail_servers_out','../../config/logger'];(function(_0x3df1cc,_0xdb006b){var _0x58a360=function(_0xd335e3){while(--_0xd335e3){_0x3df1cc['push'](_0x3df1cc['shift']());}};_0x58a360(++_0xdb006b);}(_0x17ac,0xef));var _0xc17a=function(_0x1995b8,_0x318fe0){_0x1995b8=_0x1995b8-0x0;var _0x21d995=_0x17ac[_0x1995b8];return _0x21d995;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc17a('0x0'))(_0xc17a('0x1'));var moment=require('moment');var BPromise=require(_0xc17a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc17a('0x3'));var config=require(_0xc17a('0x4'));var attributes=require(_0xc17a('0x5'));module['exports']=function(_0x7ae9c0,_0x2025f1){return _0x7ae9c0[_0xc17a('0x6')]('MailServerOut',attributes,{'tableName':_0xc17a('0x7'),'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 39e3a63..c58fcea 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x1d0cc4,_0x51f97e){var _0x3a8204=function(_0x506396){while(--_0x506396){_0x1d0cc4['push'](_0x1d0cc4['shift']());}};_0x3a8204(++_0x51f97e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xc4aa[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x41b154,_0x116d1){var _0x19fd49=function(_0x143867){while(--_0x143867){_0x41b154['push'](_0x41b154['shift']());}};_0x19fd49(++_0x116d1);}(_0x1261,0x144));var _0x1126=function(_0x59522a,_0x14d1e5){_0x59522a=_0x59522a-0x0;var _0x30f09d=_0x1261[_0x59522a];return _0x30f09d;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 0bc0548..2995ff0 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 _0xc72b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x4ac1c6,_0x367224){var _0x141211=function(_0x116444){while(--_0x116444){_0x4ac1c6['push'](_0x4ac1c6['shift']());}};_0x141211(++_0x367224);}(_0xc72b,0x111));var _0xbc72=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0xc72b[_0x3b7a0c];return _0x3bb70f;};'use strict';var multer=require(_0xbc72('0x0'));var util=require(_0xbc72('0x1'));var path=require('path');var timeout=require(_0xbc72('0x2'));var express=require(_0xbc72('0x3'));var router=express[_0xbc72('0x4')]();var fs_extra=require(_0xbc72('0x5'));var auth=require(_0xbc72('0x6'));var interaction=require(_0xbc72('0x7'));var config=require('../../config/environment');var controller=require(_0xbc72('0x8'));router[_0xbc72('0x9')]('/',auth[_0xbc72('0xa')](),controller[_0xbc72('0xb')]);router['get'](_0xbc72('0xc'),auth[_0xbc72('0xa')](),controller[_0xbc72('0xd')]);router[_0xbc72('0x9')](_0xbc72('0xe'),auth[_0xbc72('0xa')](),controller[_0xbc72('0xf')]);router[_0xbc72('0x10')]('/',auth[_0xbc72('0xa')](),controller[_0xbc72('0x11')]);router[_0xbc72('0x12')](_0xbc72('0xe'),auth[_0xbc72('0xa')](),controller[_0xbc72('0x13')]);router[_0xbc72('0x14')]('/:id',auth[_0xbc72('0xa')](),controller[_0xbc72('0x15')]);module[_0xbc72('0x16')]=router; \ No newline at end of file +var _0x21af=['/:id','show','post','create','put','update','delete','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe'];(function(_0x4d4a30,_0x1c746b){var _0x80ca89=function(_0x30fc1f){while(--_0x30fc1f){_0x4d4a30['push'](_0x4d4a30['shift']());}};_0x80ca89(++_0x1c746b);}(_0x21af,0x184));var _0xf21a=function(_0x5af8bb,_0x17d264){_0x5af8bb=_0x5af8bb-0x0;var _0xfe44e6=_0x21af[_0x5af8bb];return _0xfe44e6;};'use strict';var multer=require(_0xf21a('0x0'));var util=require(_0xf21a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf21a('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf21a('0x3'));var interaction=require(_0xf21a('0x4'));var config=require(_0xf21a('0x5'));var controller=require(_0xf21a('0x6'));router[_0xf21a('0x7')]('/',auth[_0xf21a('0x8')](),controller[_0xf21a('0x9')]);router[_0xf21a('0x7')](_0xf21a('0xa'),auth[_0xf21a('0x8')](),controller['describe']);router['get'](_0xf21a('0xb'),auth[_0xf21a('0x8')](),controller[_0xf21a('0xc')]);router[_0xf21a('0xd')]('/',auth[_0xf21a('0x8')](),controller[_0xf21a('0xe')]);router[_0xf21a('0xf')](_0xf21a('0xb'),auth[_0xf21a('0x8')](),controller[_0xf21a('0x10')]);router[_0xf21a('0x11')]('/:id',auth[_0xf21a('0x8')](),controller['destroy']);module[_0xf21a('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 5eb58bb..a5b5ed2 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 _0x6c45=['STRING','sequelize','exports','name'];(function(_0x45f6fd,_0x2620b9){var _0x328b60=function(_0x1d06ce){while(--_0x1d06ce){_0x45f6fd['push'](_0x45f6fd['shift']());}};_0x328b60(++_0x2620b9);}(_0x6c45,0xb1));var _0x56c4=function(_0x58b524,_0xdb96d7){_0x58b524=_0x58b524-0x0;var _0x305d75=_0x6c45[_0x58b524];return _0x305d75;};'use strict';var Sequelize=require(_0x56c4('0x0'));module[_0x56c4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x56c4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x56c4('0x3')]}}; \ No newline at end of file +var _0xfc46=['name','sequelize','STRING'];(function(_0x1853dc,_0xb54663){var _0x1c8e1a=function(_0x2fc4ec){while(--_0x2fc4ec){_0x1853dc['push'](_0x1853dc['shift']());}};_0x1c8e1a(++_0xb54663);}(_0xfc46,0x9a));var _0x6fc4=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xfc46[_0x3a6efd];return _0x487b9a;};'use strict';var Sequelize=require(_0x6fc4('0x0'));module['exports']={'name':{'type':Sequelize[_0x6fc4('0x1')],'unique':_0x6fc4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6fc4('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index accd6e6..3d71d90 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 _0xc7d6=['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','sendStatus','end','status','json','offset','undefined','count','limit','apply','save','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xc7d6,0x131));var _0x6c7d=function(_0x16eafb,_0x3ef74c){_0x16eafb=_0x16eafb-0x0;var _0x3ed035=_0xc7d6[_0x16eafb];return _0x3ed035;};'use strict';var emlformat=require(_0x6c7d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6c7d('0x1'));var jsonpatch=require(_0x6c7d('0x2'));var rp=require(_0x6c7d('0x3'));var moment=require(_0x6c7d('0x4'));var BPromise=require(_0x6c7d('0x5'));var Mustache=require(_0x6c7d('0x6'));var util=require(_0x6c7d('0x7'));var path=require(_0x6c7d('0x8'));var sox=require(_0x6c7d('0x9'));var csv=require(_0x6c7d('0xa'));var ejs=require(_0x6c7d('0xb'));var fs=require('fs');var fs_extra=require(_0x6c7d('0xc'));var _=require(_0x6c7d('0xd'));var squel=require(_0x6c7d('0xe'));var crypto=require('crypto');var jsforce=require(_0x6c7d('0xf'));var deskjs=require(_0x6c7d('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6c7d('0x11'));var Papa=require(_0x6c7d('0x12'));var Redis=require(_0x6c7d('0x13'));var authService=require(_0x6c7d('0x14'));var qs=require(_0x6c7d('0x15'));var as=require(_0x6c7d('0x16'));var hardwareService=require(_0x6c7d('0x17'));var logger=require(_0x6c7d('0x18'))(_0x6c7d('0x19'));var utils=require(_0x6c7d('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4691bd,_0x3013ee){_0x3013ee=_0x3013ee||0xcc;return function(_0x23cdb3){if(_0x23cdb3){return _0x4691bd[_0x6c7d('0x1b')](_0x3013ee);}return _0x4691bd['status'](_0x3013ee)[_0x6c7d('0x1c')]();};}function respondWithResult(_0x5edba3,_0x9728e4){_0x9728e4=_0x9728e4||0xc8;return function(_0x247986){if(_0x247986){return _0x5edba3[_0x6c7d('0x1d')](_0x9728e4)[_0x6c7d('0x1e')](_0x247986);}};}function respondWithFilteredResult(_0x3dc797,_0x331063){return function(_0x2e5ab6){if(_0x2e5ab6){var _0x534591=typeof _0x331063[_0x6c7d('0x1f')]===_0x6c7d('0x20')&&typeof _0x331063['limit']===_0x6c7d('0x20');var _0x15b40a=_0x2e5ab6[_0x6c7d('0x21')];var _0x318924=_0x534591?0x0:_0x331063[_0x6c7d('0x1f')];var _0x1d2f28=_0x534591?_0x2e5ab6['count']:_0x331063['offset']+_0x331063[_0x6c7d('0x22')];var _0x2f89d7;if(_0x1d2f28>=_0x15b40a){_0x1d2f28=_0x15b40a;_0x2f89d7=0xc8;}else{_0x2f89d7=0xce;}_0x3dc797[_0x6c7d('0x1d')](_0x2f89d7);return _0x3dc797['set']('Content-Range',_0x318924+'-'+_0x1d2f28+'/'+_0x15b40a)['json'](_0x2e5ab6);}return null;};}function patchUpdates(_0xf51bf9){return function(_0x538fea){try{jsonpatch[_0x6c7d('0x23')](_0x538fea,_0xf51bf9,!![]);}catch(_0x3119ae){return BPromise['reject'](_0x3119ae);}return _0x538fea[_0x6c7d('0x24')]();};}function saveUpdates(_0x51793b,_0x1f3219){return function(_0x5a8c06){if(_0x5a8c06){return _0x5a8c06[_0x6c7d('0x25')](_0x51793b)[_0x6c7d('0x26')](function(_0x481724){return _0x481724;});}return null;};}function removeEntity(_0x50010d,_0x1e8c75){return function(_0x3d110b){if(_0x3d110b){return _0x3d110b[_0x6c7d('0x27')]()[_0x6c7d('0x26')](function(){_0x50010d[_0x6c7d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27a474,_0x3fa6a9){return function(_0x5681e6){if(!_0x5681e6){_0x27a474[_0x6c7d('0x1b')](0x194);}return _0x5681e6;};}function handleError(_0x51f521,_0x1e1d71){_0x1e1d71=_0x1e1d71||0x1f4;return function(_0x22fa1c){logger[_0x6c7d('0x28')](_0x22fa1c[_0x6c7d('0x29')]);if(_0x22fa1c[_0x6c7d('0x2a')]){delete _0x22fa1c['name'];}_0x51f521[_0x6c7d('0x1d')](_0x1e1d71)[_0x6c7d('0x2b')](_0x22fa1c);};}exports[_0x6c7d('0x2c')]=function(_0x3a1107,_0x4a4337){var _0x2540e1={},_0x549bb3={},_0x225b77={'count':0x0,'rows':[]};var _0x571c23=_[_0x6c7d('0x2d')](db[_0x6c7d('0x2e')][_0x6c7d('0x2f')],function(_0x864c22){return{'name':_0x864c22[_0x6c7d('0x30')],'type':_0x864c22[_0x6c7d('0x31')]['key']};});_0x549bb3[_0x6c7d('0x32')]=_['map'](_0x571c23,'name');_0x549bb3[_0x6c7d('0x33')]=_[_0x6c7d('0x34')](_0x3a1107[_0x6c7d('0x33')]);_0x549bb3[_0x6c7d('0x35')]=_['intersection'](_0x549bb3[_0x6c7d('0x32')],_0x549bb3[_0x6c7d('0x33')]);_0x2540e1[_0x6c7d('0x36')]=_[_0x6c7d('0x37')](_0x549bb3[_0x6c7d('0x32')],qs[_0x6c7d('0x38')](_0x3a1107[_0x6c7d('0x33')][_0x6c7d('0x38')]));_0x2540e1[_0x6c7d('0x36')]=_0x2540e1['attributes'][_0x6c7d('0x39')]?_0x2540e1[_0x6c7d('0x36')]:_0x549bb3['model'];if(!_0x3a1107[_0x6c7d('0x33')][_0x6c7d('0x3a')](_0x6c7d('0x3b'))){_0x2540e1[_0x6c7d('0x22')]=qs[_0x6c7d('0x22')](_0x3a1107[_0x6c7d('0x33')]['limit']);_0x2540e1[_0x6c7d('0x1f')]=qs[_0x6c7d('0x1f')](_0x3a1107[_0x6c7d('0x33')][_0x6c7d('0x1f')]);}_0x2540e1[_0x6c7d('0x3c')]=qs[_0x6c7d('0x3d')](_0x3a1107[_0x6c7d('0x33')][_0x6c7d('0x3d')]);_0x2540e1[_0x6c7d('0x3e')]=qs[_0x6c7d('0x35')](_['pick'](_0x3a1107['query'],_0x549bb3[_0x6c7d('0x35')]),_0x571c23);if(_0x3a1107[_0x6c7d('0x33')][_0x6c7d('0x3f')]){_0x2540e1[_0x6c7d('0x3e')]=_[_0x6c7d('0x40')](_0x2540e1['where'],{'$or':_['map'](_0x571c23,function(_0x2e0096){if(_0x2e0096[_0x6c7d('0x31')]!==_0x6c7d('0x41')){var _0x1b3966={};_0x1b3966[_0x2e0096[_0x6c7d('0x2a')]]={'$like':'%'+_0x3a1107[_0x6c7d('0x33')][_0x6c7d('0x3f')]+'%'};return _0x1b3966;}})});}_0x2540e1=_[_0x6c7d('0x40')]({},_0x2540e1,_0x3a1107[_0x6c7d('0x42')]);var _0x2fc2ed={'where':_0x2540e1[_0x6c7d('0x3e')]};return db[_0x6c7d('0x2e')][_0x6c7d('0x21')](_0x2fc2ed)['then'](function(_0x423902){_0x225b77[_0x6c7d('0x21')]=_0x423902;if(_0x3a1107[_0x6c7d('0x33')][_0x6c7d('0x43')]){_0x2540e1[_0x6c7d('0x44')]=[{'all':!![]}];}return db[_0x6c7d('0x2e')][_0x6c7d('0x45')](_0x2540e1);})[_0x6c7d('0x26')](function(_0x30f087){_0x225b77[_0x6c7d('0x46')]=_0x30f087;return _0x225b77;})[_0x6c7d('0x26')](respondWithFilteredResult(_0x4a4337,_0x2540e1))[_0x6c7d('0x47')](handleError(_0x4a4337,null));};exports[_0x6c7d('0x48')]=function(_0x2b0cbb,_0x34d591){var _0x4eda5b={'raw':!![],'where':{'id':_0x2b0cbb[_0x6c7d('0x49')]['id']}},_0x138d2b={};_0x138d2b[_0x6c7d('0x32')]=_[_0x6c7d('0x34')](db[_0x6c7d('0x2e')][_0x6c7d('0x2f')]);_0x138d2b['query']=_[_0x6c7d('0x34')](_0x2b0cbb[_0x6c7d('0x33')]);_0x138d2b[_0x6c7d('0x35')]=_[_0x6c7d('0x37')](_0x138d2b[_0x6c7d('0x32')],_0x138d2b[_0x6c7d('0x33')]);_0x4eda5b['attributes']=_[_0x6c7d('0x37')](_0x138d2b[_0x6c7d('0x32')],qs[_0x6c7d('0x38')](_0x2b0cbb[_0x6c7d('0x33')]['fields']));_0x4eda5b[_0x6c7d('0x36')]=_0x4eda5b[_0x6c7d('0x36')][_0x6c7d('0x39')]?_0x4eda5b[_0x6c7d('0x36')]:_0x138d2b[_0x6c7d('0x32')];if(_0x2b0cbb[_0x6c7d('0x33')][_0x6c7d('0x43')]){_0x4eda5b['include']=[{'all':!![]}];}_0x4eda5b=_[_0x6c7d('0x40')]({},_0x4eda5b,_0x2b0cbb['options']);return db[_0x6c7d('0x2e')]['find'](_0x4eda5b)['then'](handleEntityNotFound(_0x34d591,null))[_0x6c7d('0x26')](respondWithResult(_0x34d591,null))[_0x6c7d('0x47')](handleError(_0x34d591,null));};exports[_0x6c7d('0x4a')]=function(_0x37d6dd,_0x5138ac){return db[_0x6c7d('0x2e')][_0x6c7d('0x4a')](_0x37d6dd[_0x6c7d('0x4b')],{})[_0x6c7d('0x26')](respondWithResult(_0x5138ac,0xc9))[_0x6c7d('0x47')](handleError(_0x5138ac,null));};exports['update']=function(_0x559992,_0x15d075){if(_0x559992[_0x6c7d('0x4b')]['id']){delete _0x559992[_0x6c7d('0x4b')]['id'];}return db['MailSubstatus'][_0x6c7d('0x4c')]({'where':{'id':_0x559992['params']['id']}})['then'](handleEntityNotFound(_0x15d075,null))[_0x6c7d('0x26')](saveUpdates(_0x559992[_0x6c7d('0x4b')],null))[_0x6c7d('0x26')](respondWithResult(_0x15d075,null))[_0x6c7d('0x47')](handleError(_0x15d075,null));};exports['destroy']=function(_0x61a725,_0x2aabd7){return db[_0x6c7d('0x2e')][_0x6c7d('0x4c')]({'where':{'id':_0x61a725[_0x6c7d('0x49')]['id']}})['then'](handleEntityNotFound(_0x2aabd7,null))['then'](removeEntity(_0x2aabd7,null))[_0x6c7d('0x47')](handleError(_0x2aabd7,null));};exports['describe']=function(_0x1f3c75,_0x3a998b){return db[_0x6c7d('0x2e')][_0x6c7d('0x4d')]()[_0x6c7d('0x26')](respondWithResult(_0x3a998b,null))['catch'](handleError(_0x3a998b,null));}; \ No newline at end of file +var _0xf253=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','update','then','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','where','merge','VIRTUAL','filter','options','MailSubstatus','includeAll','include','findAll','rows','find','catch','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','desk.js'];(function(_0x58ae8a,_0x3c619e){var _0x2f0b6b=function(_0x6db940){while(--_0x6db940){_0x58ae8a['push'](_0x58ae8a['shift']());}};_0x2f0b6b(++_0x3c619e);}(_0xf253,0x15b));var _0x3f25=function(_0x79c37f,_0x2899a9){_0x79c37f=_0x79c37f-0x0;var _0x338ae8=_0xf253[_0x79c37f];return _0x338ae8;};'use strict';var emlformat=require(_0x3f25('0x0'));var rimraf=require(_0x3f25('0x1'));var zipdir=require(_0x3f25('0x2'));var jsonpatch=require(_0x3f25('0x3'));var rp=require(_0x3f25('0x4'));var moment=require('moment');var BPromise=require(_0x3f25('0x5'));var Mustache=require(_0x3f25('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3f25('0x7'));var csv=require(_0x3f25('0x8'));var ejs=require(_0x3f25('0x9'));var fs=require('fs');var fs_extra=require(_0x3f25('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3f25('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3f25('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3f25('0xd'));var Papa=require(_0x3f25('0xe'));var Redis=require(_0x3f25('0xf'));var authService=require(_0x3f25('0x10'));var qs=require(_0x3f25('0x11'));var as=require(_0x3f25('0x12'));var hardwareService=require(_0x3f25('0x13'));var logger=require(_0x3f25('0x14'))(_0x3f25('0x15'));var utils=require(_0x3f25('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3f25('0x17'))['db'];function respondWithStatusCode(_0x598919,_0x4cb480){_0x4cb480=_0x4cb480||0xcc;return function(_0x504a1a){if(_0x504a1a){return _0x598919[_0x3f25('0x18')](_0x4cb480);}return _0x598919[_0x3f25('0x19')](_0x4cb480)[_0x3f25('0x1a')]();};}function respondWithResult(_0x3f1df5,_0x5e7c98){_0x5e7c98=_0x5e7c98||0xc8;return function(_0x2ca6cb){if(_0x2ca6cb){return _0x3f1df5[_0x3f25('0x19')](_0x5e7c98)[_0x3f25('0x1b')](_0x2ca6cb);}};}function respondWithFilteredResult(_0x3aec2b,_0x167a19){return function(_0x4d98d9){if(_0x4d98d9){var _0x30230a=typeof _0x167a19['offset']===_0x3f25('0x1c')&&typeof _0x167a19[_0x3f25('0x1d')]===_0x3f25('0x1c');var _0x500fe8=_0x4d98d9[_0x3f25('0x1e')];var _0x35b2f5=_0x30230a?0x0:_0x167a19[_0x3f25('0x1f')];var _0x242966=_0x30230a?_0x4d98d9[_0x3f25('0x1e')]:_0x167a19[_0x3f25('0x1f')]+_0x167a19[_0x3f25('0x1d')];var _0x2628c8;if(_0x242966>=_0x500fe8){_0x242966=_0x500fe8;_0x2628c8=0xc8;}else{_0x2628c8=0xce;}_0x3aec2b[_0x3f25('0x19')](_0x2628c8);return _0x3aec2b[_0x3f25('0x20')]('Content-Range',_0x35b2f5+'-'+_0x242966+'/'+_0x500fe8)[_0x3f25('0x1b')](_0x4d98d9);}return null;};}function patchUpdates(_0x347405){return function(_0x45bba6){try{jsonpatch[_0x3f25('0x21')](_0x45bba6,_0x347405,!![]);}catch(_0x320c6c){return BPromise['reject'](_0x320c6c);}return _0x45bba6['save']();};}function saveUpdates(_0x1acc07,_0x42943a){return function(_0x1a74f7){if(_0x1a74f7){return _0x1a74f7[_0x3f25('0x22')](_0x1acc07)[_0x3f25('0x23')](function(_0x531993){return _0x531993;});}return null;};}function removeEntity(_0x19f289,_0x23b11e){return function(_0x2599a8){if(_0x2599a8){return _0x2599a8['destroy']()[_0x3f25('0x23')](function(){_0x19f289[_0x3f25('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b08ef,_0x413bf5){return function(_0x4ce2a9){if(!_0x4ce2a9){_0x5b08ef[_0x3f25('0x18')](0x194);}return _0x4ce2a9;};}function handleError(_0x58736c,_0x4c72a4){_0x4c72a4=_0x4c72a4||0x1f4;return function(_0x54bec4){logger['error'](_0x54bec4[_0x3f25('0x24')]);if(_0x54bec4[_0x3f25('0x25')]){delete _0x54bec4[_0x3f25('0x25')];}_0x58736c['status'](_0x4c72a4)['send'](_0x54bec4);};}exports[_0x3f25('0x26')]=function(_0x4ba4f7,_0x4259c2){var _0x498a0b={},_0x2f2de9={},_0x478adf={'count':0x0,'rows':[]};var _0x84c1d3=_[_0x3f25('0x27')](db['MailSubstatus'][_0x3f25('0x28')],function(_0x53a17a){return{'name':_0x53a17a[_0x3f25('0x29')],'type':_0x53a17a[_0x3f25('0x2a')][_0x3f25('0x2b')]};});_0x2f2de9['model']=_['map'](_0x84c1d3,_0x3f25('0x25'));_0x2f2de9[_0x3f25('0x2c')]=_[_0x3f25('0x2d')](_0x4ba4f7[_0x3f25('0x2c')]);_0x2f2de9['filters']=_[_0x3f25('0x2e')](_0x2f2de9[_0x3f25('0x2f')],_0x2f2de9[_0x3f25('0x2c')]);_0x498a0b[_0x3f25('0x30')]=_['intersection'](_0x2f2de9[_0x3f25('0x2f')],qs[_0x3f25('0x31')](_0x4ba4f7['query']['fields']));_0x498a0b[_0x3f25('0x30')]=_0x498a0b[_0x3f25('0x30')][_0x3f25('0x32')]?_0x498a0b['attributes']:_0x2f2de9[_0x3f25('0x2f')];if(!_0x4ba4f7[_0x3f25('0x2c')][_0x3f25('0x33')]('nolimit')){_0x498a0b[_0x3f25('0x1d')]=qs['limit'](_0x4ba4f7[_0x3f25('0x2c')][_0x3f25('0x1d')]);_0x498a0b[_0x3f25('0x1f')]=qs[_0x3f25('0x1f')](_0x4ba4f7[_0x3f25('0x2c')][_0x3f25('0x1f')]);}_0x498a0b[_0x3f25('0x34')]=qs[_0x3f25('0x35')](_0x4ba4f7[_0x3f25('0x2c')][_0x3f25('0x35')]);_0x498a0b['where']=qs[_0x3f25('0x36')](_['pick'](_0x4ba4f7[_0x3f25('0x2c')],_0x2f2de9[_0x3f25('0x36')]),_0x84c1d3);if(_0x4ba4f7[_0x3f25('0x2c')]['filter']){_0x498a0b[_0x3f25('0x37')]=_[_0x3f25('0x38')](_0x498a0b['where'],{'$or':_[_0x3f25('0x27')](_0x84c1d3,function(_0x5bc392){if(_0x5bc392[_0x3f25('0x2a')]!==_0x3f25('0x39')){var _0x11820d={};_0x11820d[_0x5bc392[_0x3f25('0x25')]]={'$like':'%'+_0x4ba4f7[_0x3f25('0x2c')][_0x3f25('0x3a')]+'%'};return _0x11820d;}})});}_0x498a0b=_[_0x3f25('0x38')]({},_0x498a0b,_0x4ba4f7[_0x3f25('0x3b')]);var _0x5c419f={'where':_0x498a0b['where']};return db[_0x3f25('0x3c')][_0x3f25('0x1e')](_0x5c419f)[_0x3f25('0x23')](function(_0x4832e2){_0x478adf['count']=_0x4832e2;if(_0x4ba4f7[_0x3f25('0x2c')][_0x3f25('0x3d')]){_0x498a0b[_0x3f25('0x3e')]=[{'all':!![]}];}return db[_0x3f25('0x3c')][_0x3f25('0x3f')](_0x498a0b);})['then'](function(_0x35c89a){_0x478adf[_0x3f25('0x40')]=_0x35c89a;return _0x478adf;})[_0x3f25('0x23')](respondWithFilteredResult(_0x4259c2,_0x498a0b))['catch'](handleError(_0x4259c2,null));};exports['show']=function(_0x3660aa,_0x2f2429){var _0x127428={'raw':!![],'where':{'id':_0x3660aa['params']['id']}},_0x2a6801={};_0x2a6801[_0x3f25('0x2f')]=_[_0x3f25('0x2d')](db['MailSubstatus']['rawAttributes']);_0x2a6801['query']=_['keys'](_0x3660aa[_0x3f25('0x2c')]);_0x2a6801[_0x3f25('0x36')]=_[_0x3f25('0x2e')](_0x2a6801['model'],_0x2a6801[_0x3f25('0x2c')]);_0x127428[_0x3f25('0x30')]=_['intersection'](_0x2a6801[_0x3f25('0x2f')],qs[_0x3f25('0x31')](_0x3660aa[_0x3f25('0x2c')]['fields']));_0x127428[_0x3f25('0x30')]=_0x127428[_0x3f25('0x30')][_0x3f25('0x32')]?_0x127428[_0x3f25('0x30')]:_0x2a6801['model'];if(_0x3660aa[_0x3f25('0x2c')][_0x3f25('0x3d')]){_0x127428[_0x3f25('0x3e')]=[{'all':!![]}];}_0x127428=_[_0x3f25('0x38')]({},_0x127428,_0x3660aa[_0x3f25('0x3b')]);return db[_0x3f25('0x3c')][_0x3f25('0x41')](_0x127428)[_0x3f25('0x23')](handleEntityNotFound(_0x2f2429,null))[_0x3f25('0x23')](respondWithResult(_0x2f2429,null))[_0x3f25('0x42')](handleError(_0x2f2429,null));};exports[_0x3f25('0x43')]=function(_0x2c90d7,_0x415b3b){return db[_0x3f25('0x3c')]['create'](_0x2c90d7[_0x3f25('0x44')],{})[_0x3f25('0x23')](respondWithResult(_0x415b3b,0xc9))['catch'](handleError(_0x415b3b,null));};exports['update']=function(_0xf988f6,_0x3d08a2){if(_0xf988f6[_0x3f25('0x44')]['id']){delete _0xf988f6['body']['id'];}return db[_0x3f25('0x3c')][_0x3f25('0x41')]({'where':{'id':_0xf988f6[_0x3f25('0x45')]['id']}})['then'](handleEntityNotFound(_0x3d08a2,null))[_0x3f25('0x23')](saveUpdates(_0xf988f6[_0x3f25('0x44')],null))[_0x3f25('0x23')](respondWithResult(_0x3d08a2,null))[_0x3f25('0x42')](handleError(_0x3d08a2,null));};exports[_0x3f25('0x46')]=function(_0x2c17cb,_0x18cb0f){return db[_0x3f25('0x3c')][_0x3f25('0x41')]({'where':{'id':_0x2c17cb[_0x3f25('0x45')]['id']}})[_0x3f25('0x23')](handleEntityNotFound(_0x18cb0f,null))['then'](removeEntity(_0x18cb0f,null))[_0x3f25('0x42')](handleError(_0x18cb0f,null));};exports[_0x3f25('0x47')]=function(_0x4dbd19,_0x2115b6){return db[_0x3f25('0x3c')]['describe']()['then'](respondWithResult(_0x2115b6,null))[_0x3f25('0x42')](handleError(_0x2115b6,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 44c9358..0d80733 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 _0x9735=['hasOwnProperty','exports','../../mysqldb','MailSubstatus','update','emit'];(function(_0x173fd1,_0x28db53){var _0x36a3d1=function(_0x2f72a4){while(--_0x2f72a4){_0x173fd1['push'](_0x173fd1['shift']());}};_0x36a3d1(++_0x28db53);}(_0x9735,0xc2));var _0x5973=function(_0x22e62f,_0x4c811a){_0x22e62f=_0x22e62f-0x0;var _0x2fef10=_0x9735[_0x22e62f];return _0x2fef10;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x5973('0x0'))['db'][_0x5973('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x5973('0x2')};function emitEvent(_0x57dcae){return function(_0x5c8ac8,_0x4126fa,_0x15006c){MailSubstatusEvents[_0x5973('0x3')](_0x57dcae+':'+_0x5c8ac8['id'],_0x5c8ac8);MailSubstatusEvents[_0x5973('0x3')](_0x57dcae,_0x5c8ac8);_0x15006c(null);};}for(var e in events){if(events[_0x5973('0x4')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x5973('0x5')]=MailSubstatusEvents; \ No newline at end of file +var _0xc582=['hook','exports','../../mysqldb','MailSubstatus','setMaxListeners','emit','hasOwnProperty'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc582,0x11a));var _0x2c58=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xc582[_0x12fc8d];return _0x3f9d04;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x2c58('0x0'))['db'][_0x2c58('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x2c58('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0xd6b8f5){return function(_0x2d857d,_0x2d958b,_0x5efbba){MailSubstatusEvents[_0x2c58('0x3')](_0xd6b8f5+':'+_0x2d857d['id'],_0x2d857d);MailSubstatusEvents[_0x2c58('0x3')](_0xd6b8f5,_0x2d857d);_0x5efbba(null);};}for(var e in events){if(events[_0x2c58('0x4')](e)){var event=events[e];MailSubstatus[_0x2c58('0x5')](e,emitEvent(event));}}module[_0x2c58('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 345a44d..d97f7b4 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 _0x9b67=['Condition','name','mailSubstatus','then','catch','./mailSubstatus.attributes','define','mail_substatuses'];(function(_0x4850af,_0x57348f){var _0x4b046d=function(_0x39009b){while(--_0x39009b){_0x4850af['push'](_0x4850af['shift']());}};_0x4b046d(++_0x57348f);}(_0x9b67,0xed));var _0x79b6=function(_0x2935fa,_0x2eef2b){_0x2935fa=_0x2935fa-0x0;var _0x283aff=_0x9b67[_0x2935fa];return _0x283aff;};'use strict';var attributes=require(_0x79b6('0x0'));module['exports']=function(_0x23503c){var _0x336ad8=_0x23503c['models'];return _0x23503c[_0x79b6('0x1')]('MailSubstatus',attributes,{'tableName':_0x79b6('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4f4e39,_0x4ca068,_0x2bee45){return _0x336ad8[_0x79b6('0x3')]['update']({'value':_0x4f4e39[_0x79b6('0x4')]},{'where':{'field':_0x79b6('0x5'),'value':_0x4f4e39['_previousDataValues'][_0x79b6('0x4')]}})[_0x79b6('0x6')](function(){_0x2bee45();})[_0x79b6('0x7')](function(_0x312585){_0x2bee45(_0x312585);});}}});}; \ No newline at end of file +var _0x004b=['MailSubstatus','Condition','update','name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','models','define'];(function(_0x2806f6,_0x294105){var _0x32ebb1=function(_0x5e875d){while(--_0x5e875d){_0x2806f6['push'](_0x2806f6['shift']());}};_0x32ebb1(++_0x294105);}(_0x004b,0xfa));var _0xb004=function(_0x577669,_0x3fa500){_0x577669=_0x577669-0x0;var _0x3eaca4=_0x004b[_0x577669];return _0x3eaca4;};'use strict';var attributes=require(_0xb004('0x0'));module['exports']=function(_0x5013a2){var _0x15e48d=_0x5013a2[_0xb004('0x1')];return _0x5013a2[_0xb004('0x2')](_0xb004('0x3'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x528929,_0x129313,_0x261a6c){return _0x15e48d[_0xb004('0x4')][_0xb004('0x5')]({'value':_0x528929[_0xb004('0x6')]},{'where':{'field':_0xb004('0x7'),'value':_0x528929[_0xb004('0x8')][_0xb004('0x6')]}})[_0xb004('0x9')](function(){_0x261a6c();})[_0xb004('0xa')](function(_0x13c797){_0x261a6c(_0x13c797);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 89b426a..2f1345b 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 _0x25ea=['info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x4fb127,_0x11261a){var _0x2a656d=function(_0x33b23f){while(--_0x33b23f){_0x4fb127['push'](_0x4fb127['shift']());}};_0x2a656d(++_0x11261a);}(_0x25ea,0xc9));var _0xa25e=function(_0x1e91eb,_0x5829a3){_0x1e91eb=_0x1e91eb-0x0;var _0x2af75a=_0x25ea[_0x1e91eb];return _0x2af75a;};'use strict';var _=require('lodash');var util=require(_0xa25e('0x0'));var moment=require(_0xa25e('0x1'));var BPromise=require(_0xa25e('0x2'));var rs=require(_0xa25e('0x3'));var fs=require('fs');var Redis=require(_0xa25e('0x4'));var db=require(_0xa25e('0x5'))['db'];var utils=require(_0xa25e('0x6'));var logger=require('../../config/logger')(_0xa25e('0x7'));var config=require('../../config/environment');var jayson=require(_0xa25e('0x8'));var client=jayson[_0xa25e('0x9')][_0xa25e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f5787,_0x17b5e2,_0x1576d4){return new BPromise(function(_0x3e1fa,_0x54ea51){return client[_0xa25e('0xb')](_0x3f5787,_0x1576d4)[_0xa25e('0xc')](function(_0x468f94){logger['info'](_0xa25e('0xd'),_0x17b5e2,_0xa25e('0xe'));logger[_0xa25e('0xf')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x17b5e2,_0xa25e('0xe'),JSON[_0xa25e('0x10')](_0x468f94));if(_0x468f94[_0xa25e('0x11')]){if(_0x468f94[_0xa25e('0x11')]['code']===0x1f4){logger[_0xa25e('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x17b5e2,_0x468f94[_0xa25e('0x11')]['message']);return _0x54ea51(_0x468f94[_0xa25e('0x11')][_0xa25e('0x12')]);}logger[_0xa25e('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x17b5e2,_0x468f94['error'][_0xa25e('0x12')]);return _0x3e1fa(_0x468f94[_0xa25e('0x11')][_0xa25e('0x12')]);}else{logger[_0xa25e('0x13')](_0xa25e('0xd'),_0x17b5e2,_0xa25e('0xe'));_0x3e1fa(_0x468f94[_0xa25e('0x14')][_0xa25e('0x12')]);}})[_0xa25e('0x15')](function(_0xbe454e){logger[_0xa25e('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x17b5e2,_0xbe454e);_0x54ea51(_0xbe454e);});});} \ No newline at end of file +var _0x292c=['debug','request\x20sent','stringify','error','message','info','catch','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','MailSubstatus,\x20%s,\x20%s'];(function(_0x338b9a,_0x3fa216){var _0x3df4d3=function(_0xdc3e93){while(--_0xdc3e93){_0x338b9a['push'](_0x338b9a['shift']());}};_0x3df4d3(++_0x3fa216);}(_0x292c,0x17d));var _0xc292=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0x292c[_0x555b2f];return _0x81c0a6;};'use strict';var _=require('lodash');var util=require(_0xc292('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc292('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc292('0x2'))['db'];var utils=require(_0xc292('0x3'));var logger=require(_0xc292('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc292('0x5'));var client=jayson[_0xc292('0x6')][_0xc292('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1a6014,_0x4940e1,_0x4f2704){return new BPromise(function(_0x2428ff,_0x5e1a31){return client[_0xc292('0x8')](_0x1a6014,_0x4f2704)['then'](function(_0x4ba00c){logger['info'](_0xc292('0x9'),_0x4940e1,'request\x20sent');logger[_0xc292('0xa')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x4940e1,_0xc292('0xb'),JSON[_0xc292('0xc')](_0x4ba00c));if(_0x4ba00c[_0xc292('0xd')]){if(_0x4ba00c['error']['code']===0x1f4){logger[_0xc292('0xd')](_0xc292('0x9'),_0x4940e1,_0x4ba00c[_0xc292('0xd')][_0xc292('0xe')]);return _0x5e1a31(_0x4ba00c['error'][_0xc292('0xe')]);}logger[_0xc292('0xd')](_0xc292('0x9'),_0x4940e1,_0x4ba00c[_0xc292('0xd')][_0xc292('0xe')]);return _0x2428ff(_0x4ba00c['error'][_0xc292('0xe')]);}else{logger[_0xc292('0xf')](_0xc292('0x9'),_0x4940e1,_0xc292('0xb'));_0x2428ff(_0x4ba00c['result']['message']);}})[_0xc292('0x10')](function(_0x51f606){logger[_0xc292('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x4940e1,_0x51f606);_0x5e1a31(_0x51f606);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index ba35bcc..f91eabd 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 _0x4a25=['delete','destroy','multer','util','connect-timeout','express','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update'];(function(_0x33960d,_0x17cda5){var _0xb1742e=function(_0x5b5b95){while(--_0x5b5b95){_0x33960d['push'](_0x33960d['shift']());}};_0xb1742e(++_0x17cda5);}(_0x4a25,0xfe));var _0x54a2=function(_0x4f34d8,_0x40f022){_0x4f34d8=_0x4f34d8-0x0;var _0xc97536=_0x4a25[_0x4f34d8];return _0xc97536;};'use strict';var multer=require(_0x54a2('0x0'));var util=require(_0x54a2('0x1'));var path=require('path');var timeout=require(_0x54a2('0x2'));var express=require(_0x54a2('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(_0x54a2('0x4'));var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0x54a2('0x5')](),controller[_0x54a2('0x6')]);router[_0x54a2('0x7')](_0x54a2('0x8'),auth[_0x54a2('0x5')](),controller[_0x54a2('0x9')]);router[_0x54a2('0x7')](_0x54a2('0xa'),auth[_0x54a2('0x5')](),controller[_0x54a2('0xb')]);router[_0x54a2('0xc')]('/',auth['isAuthenticated'](),controller[_0x54a2('0xd')]);router[_0x54a2('0xe')](_0x54a2('0xa'),auth[_0x54a2('0x5')](),controller[_0x54a2('0xf')]);router[_0x54a2('0x10')]('/:id',auth[_0x54a2('0x5')](),controller[_0x54a2('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa13c=['../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x25bba4,_0x314feb){var _0x392ad1=function(_0x3e3713){while(--_0x3e3713){_0x25bba4['push'](_0x25bba4['shift']());}};_0x392ad1(++_0x314feb);}(_0xa13c,0x130));var _0xca13=function(_0x1e54fd,_0x125b95){_0x1e54fd=_0x1e54fd-0x0;var _0x384109=_0xa13c[_0x1e54fd];return _0x384109;};'use strict';var multer=require(_0xca13('0x0'));var util=require(_0xca13('0x1'));var path=require(_0xca13('0x2'));var timeout=require(_0xca13('0x3'));var express=require(_0xca13('0x4'));var router=express[_0xca13('0x5')]();var fs_extra=require(_0xca13('0x6'));var auth=require(_0xca13('0x7'));var interaction=require(_0xca13('0x8'));var config=require(_0xca13('0x9'));var controller=require(_0xca13('0xa'));router[_0xca13('0xb')]('/',auth[_0xca13('0xc')](),controller[_0xca13('0xd')]);router[_0xca13('0xb')]('/describe',auth[_0xca13('0xc')](),controller[_0xca13('0xe')]);router['get'](_0xca13('0xf'),auth[_0xca13('0xc')](),controller[_0xca13('0x10')]);router[_0xca13('0x11')]('/',auth[_0xca13('0xc')](),controller[_0xca13('0x12')]);router[_0xca13('0x13')](_0xca13('0xf'),auth[_0xca13('0xc')](),controller[_0xca13('0x14')]);router[_0xca13('0x15')](_0xca13('0xf'),auth[_0xca13('0xc')](),controller[_0xca13('0x16')]);module[_0xca13('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 92cf595..ae55d2a 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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x3599f2,_0x256be6){var _0x15a194=function(_0x2e28cf){while(--_0x2e28cf){_0x3599f2['push'](_0x3599f2['shift']());}};_0x15a194(++_0x256be6);}(_0xe706,0xa3));var _0x6e70=function(_0x1446fc,_0x13d287){_0x1446fc=_0x1446fc-0x0;var _0x184ce1=_0xe706[_0x1446fc];return _0x184ce1;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x3b6066,_0xbdda76){var _0x235e82=function(_0x223643){while(--_0x223643){_0x3b6066['push'](_0x3b6066['shift']());}};_0x235e82(++_0xbdda76);}(_0xedd9,0xfc));var _0x9edd=function(_0x3b46d6,_0x1438c7){_0x3b46d6=_0x3b46d6-0x0;var _0x141de1=_0xedd9[_0x3b46d6];return _0x141de1;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 55c37a1..2884cab 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 _0x03d7=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','apply','reject','save','then','destroy','end','error','name','send','index','map','MailTransferReport','type','key','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','merge','VIRTUAL','filter','options','where','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x3a20f2,_0x4f68af){var _0x2fadd0=function(_0x142035){while(--_0x142035){_0x3a20f2['push'](_0x3a20f2['shift']());}};_0x2fadd0(++_0x4f68af);}(_0x03d7,0x8d));var _0x703d=function(_0x1c362a,_0x3b9fb8){_0x1c362a=_0x1c362a-0x0;var _0x475726=_0x03d7[_0x1c362a];return _0x475726;};'use strict';var emlformat=require(_0x703d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x703d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x703d('0x2'));var moment=require(_0x703d('0x3'));var BPromise=require(_0x703d('0x4'));var Mustache=require(_0x703d('0x5'));var util=require('util');var path=require(_0x703d('0x6'));var sox=require(_0x703d('0x7'));var csv=require(_0x703d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x703d('0x9'));var _=require(_0x703d('0xa'));var squel=require(_0x703d('0xb'));var crypto=require(_0x703d('0xc'));var jsforce=require(_0x703d('0xd'));var deskjs=require(_0x703d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x703d('0xf'));var Papa=require(_0x703d('0x10'));var Redis=require(_0x703d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x703d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x703d('0x13'));var logger=require(_0x703d('0x14'))(_0x703d('0x15'));var utils=require(_0x703d('0x16'));var config=require(_0x703d('0x17'));var licenseUtil=require(_0x703d('0x18'));var db=require(_0x703d('0x19'))['db'];function respondWithStatusCode(_0x5ae69f,_0x224f15){_0x224f15=_0x224f15||0xcc;return function(_0x4b1167){if(_0x4b1167){return _0x5ae69f[_0x703d('0x1a')](_0x224f15);}return _0x5ae69f[_0x703d('0x1b')](_0x224f15)['end']();};}function respondWithResult(_0x5025f2,_0x234ac5){_0x234ac5=_0x234ac5||0xc8;return function(_0x461f0b){if(_0x461f0b){return _0x5025f2[_0x703d('0x1b')](_0x234ac5)[_0x703d('0x1c')](_0x461f0b);}};}function respondWithFilteredResult(_0x5a65a2,_0x514575){return function(_0x39bbf3){if(_0x39bbf3){var _0x38e016=typeof _0x514575[_0x703d('0x1d')]==='undefined'&&typeof _0x514575[_0x703d('0x1e')]===_0x703d('0x1f');var _0x555be3=_0x39bbf3['count'];var _0x593f58=_0x38e016?0x0:_0x514575['offset'];var _0x587752=_0x38e016?_0x39bbf3[_0x703d('0x20')]:_0x514575[_0x703d('0x1d')]+_0x514575[_0x703d('0x1e')];var _0xb35ef1;if(_0x587752>=_0x555be3){_0x587752=_0x555be3;_0xb35ef1=0xc8;}else{_0xb35ef1=0xce;}_0x5a65a2[_0x703d('0x1b')](_0xb35ef1);return _0x5a65a2['set']('Content-Range',_0x593f58+'-'+_0x587752+'/'+_0x555be3)['json'](_0x39bbf3);}return null;};}function patchUpdates(_0x16c3c1){return function(_0x2afb2c){try{jsonpatch[_0x703d('0x21')](_0x2afb2c,_0x16c3c1,!![]);}catch(_0x5289ec){return BPromise[_0x703d('0x22')](_0x5289ec);}return _0x2afb2c[_0x703d('0x23')]();};}function saveUpdates(_0x52817a,_0x2aaafd){return function(_0x43f62c){if(_0x43f62c){return _0x43f62c['update'](_0x52817a)[_0x703d('0x24')](function(_0x3eed35){return _0x3eed35;});}return null;};}function removeEntity(_0x477ed1,_0x6ed410){return function(_0x25d705){if(_0x25d705){return _0x25d705[_0x703d('0x25')]()[_0x703d('0x24')](function(){_0x477ed1['status'](0xcc)[_0x703d('0x26')]();});}};}function handleEntityNotFound(_0x35d48a,_0x2cc519){return function(_0x2c6e02){if(!_0x2c6e02){_0x35d48a['sendStatus'](0x194);}return _0x2c6e02;};}function handleError(_0x55ecba,_0x3fd83b){_0x3fd83b=_0x3fd83b||0x1f4;return function(_0x5cbcce){logger[_0x703d('0x27')](_0x5cbcce['stack']);if(_0x5cbcce[_0x703d('0x28')]){delete _0x5cbcce[_0x703d('0x28')];}_0x55ecba['status'](_0x3fd83b)[_0x703d('0x29')](_0x5cbcce);};}exports[_0x703d('0x2a')]=function(_0x18317b,_0x2162dd){var _0x447f20={},_0x3c67b2={},_0x23f76f={'count':0x0,'rows':[]};var _0x182524=_[_0x703d('0x2b')](db[_0x703d('0x2c')]['rawAttributes'],function(_0xc030cd){return{'name':_0xc030cd['fieldName'],'type':_0xc030cd[_0x703d('0x2d')][_0x703d('0x2e')]};});_0x3c67b2[_0x703d('0x2f')]=_['map'](_0x182524,_0x703d('0x28'));_0x3c67b2['query']=_['keys'](_0x18317b[_0x703d('0x30')]);_0x3c67b2[_0x703d('0x31')]=_[_0x703d('0x32')](_0x3c67b2['model'],_0x3c67b2[_0x703d('0x30')]);_0x447f20['attributes']=_[_0x703d('0x32')](_0x3c67b2[_0x703d('0x2f')],qs[_0x703d('0x33')](_0x18317b[_0x703d('0x30')][_0x703d('0x33')]));_0x447f20['attributes']=_0x447f20['attributes'][_0x703d('0x34')]?_0x447f20[_0x703d('0x35')]:_0x3c67b2[_0x703d('0x2f')];if(!_0x18317b[_0x703d('0x30')][_0x703d('0x36')](_0x703d('0x37'))){_0x447f20['limit']=qs[_0x703d('0x1e')](_0x18317b[_0x703d('0x30')][_0x703d('0x1e')]);_0x447f20['offset']=qs[_0x703d('0x1d')](_0x18317b[_0x703d('0x30')][_0x703d('0x1d')]);}_0x447f20[_0x703d('0x38')]=qs['sort'](_0x18317b[_0x703d('0x30')][_0x703d('0x39')]);_0x447f20['where']=qs[_0x703d('0x31')](_['pick'](_0x18317b['query'],_0x3c67b2[_0x703d('0x31')]),_0x182524);if(_0x18317b['query']['filter']){_0x447f20['where']=_[_0x703d('0x3a')](_0x447f20['where'],{'$or':_['map'](_0x182524,function(_0x1bb42c){if(_0x1bb42c[_0x703d('0x2d')]!==_0x703d('0x3b')){var _0x11d87b={};_0x11d87b[_0x1bb42c[_0x703d('0x28')]]={'$like':'%'+_0x18317b['query'][_0x703d('0x3c')]+'%'};return _0x11d87b;}})});}_0x447f20=_[_0x703d('0x3a')]({},_0x447f20,_0x18317b[_0x703d('0x3d')]);var _0x459533={'where':_0x447f20[_0x703d('0x3e')]};return db['MailTransferReport']['count'](_0x459533)[_0x703d('0x24')](function(_0x5cf384){_0x23f76f[_0x703d('0x20')]=_0x5cf384;if(_0x18317b[_0x703d('0x30')][_0x703d('0x3f')]){_0x447f20['include']=[{'all':!![]}];}return db[_0x703d('0x2c')][_0x703d('0x40')](_0x447f20);})[_0x703d('0x24')](function(_0x3c37d5){_0x23f76f[_0x703d('0x41')]=_0x3c37d5;return _0x23f76f;})[_0x703d('0x24')](respondWithFilteredResult(_0x2162dd,_0x447f20))[_0x703d('0x42')](handleError(_0x2162dd,null));};exports[_0x703d('0x43')]=function(_0x1e1066,_0x29a419){var _0x31cf50={'raw':!![],'where':{'id':_0x1e1066[_0x703d('0x44')]['id']}},_0xc79613={};_0xc79613[_0x703d('0x2f')]=_[_0x703d('0x45')](db[_0x703d('0x2c')]['rawAttributes']);_0xc79613[_0x703d('0x30')]=_['keys'](_0x1e1066[_0x703d('0x30')]);_0xc79613['filters']=_[_0x703d('0x32')](_0xc79613[_0x703d('0x2f')],_0xc79613['query']);_0x31cf50[_0x703d('0x35')]=_['intersection'](_0xc79613['model'],qs[_0x703d('0x33')](_0x1e1066[_0x703d('0x30')][_0x703d('0x33')]));_0x31cf50[_0x703d('0x35')]=_0x31cf50[_0x703d('0x35')][_0x703d('0x34')]?_0x31cf50[_0x703d('0x35')]:_0xc79613['model'];if(_0x1e1066[_0x703d('0x30')][_0x703d('0x3f')]){_0x31cf50[_0x703d('0x46')]=[{'all':!![]}];}_0x31cf50=_[_0x703d('0x3a')]({},_0x31cf50,_0x1e1066[_0x703d('0x3d')]);return db[_0x703d('0x2c')][_0x703d('0x47')](_0x31cf50)[_0x703d('0x24')](handleEntityNotFound(_0x29a419,null))['then'](respondWithResult(_0x29a419,null))[_0x703d('0x42')](handleError(_0x29a419,null));};exports[_0x703d('0x48')]=function(_0x253231,_0x4dc8b8){return db[_0x703d('0x2c')]['create'](_0x253231[_0x703d('0x49')],{})[_0x703d('0x24')](respondWithResult(_0x4dc8b8,0xc9))[_0x703d('0x42')](handleError(_0x4dc8b8,null));};exports['update']=function(_0x2bca84,_0x57bbfd){if(_0x2bca84[_0x703d('0x49')]['id']){delete _0x2bca84[_0x703d('0x49')]['id'];}return db[_0x703d('0x2c')][_0x703d('0x47')]({'where':{'id':_0x2bca84[_0x703d('0x44')]['id']}})[_0x703d('0x24')](handleEntityNotFound(_0x57bbfd,null))[_0x703d('0x24')](saveUpdates(_0x2bca84[_0x703d('0x49')],null))[_0x703d('0x24')](respondWithResult(_0x57bbfd,null))[_0x703d('0x42')](handleError(_0x57bbfd,null));};exports['destroy']=function(_0x4a6e71,_0x129f7e){return db['MailTransferReport'][_0x703d('0x47')]({'where':{'id':_0x4a6e71['params']['id']}})[_0x703d('0x24')](handleEntityNotFound(_0x129f7e,null))[_0x703d('0x24')](removeEntity(_0x129f7e,null))[_0x703d('0x42')](handleError(_0x129f7e,null));};exports[_0x703d('0x4a')]=function(_0x33ac03,_0x1072c0){return db[_0x703d('0x2c')][_0x703d('0x4a')]()[_0x703d('0x24')](respondWithResult(_0x1072c0,null))[_0x703d('0x42')](handleError(_0x1072c0,null));}; \ No newline at end of file +var _0x8a47=['rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','index','map','MailTransferReport'];(function(_0x316b13,_0x21c7b3){var _0x29ab59=function(_0x4e5145){while(--_0x4e5145){_0x316b13['push'](_0x316b13['shift']());}};_0x29ab59(++_0x21c7b3);}(_0x8a47,0x69));var _0x78a4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8a47[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x78a4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x78a4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x78a4('0x2'));var util=require(_0x78a4('0x3'));var path=require('path');var sox=require(_0x78a4('0x4'));var csv=require(_0x78a4('0x5'));var ejs=require(_0x78a4('0x6'));var fs=require('fs');var fs_extra=require(_0x78a4('0x7'));var _=require(_0x78a4('0x8'));var squel=require(_0x78a4('0x9'));var crypto=require(_0x78a4('0xa'));var jsforce=require(_0x78a4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x78a4('0xc'));var Papa=require(_0x78a4('0xd'));var Redis=require(_0x78a4('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x78a4('0xf'));var as=require(_0x78a4('0x10'));var hardwareService=require(_0x78a4('0x11'));var logger=require(_0x78a4('0x12'))(_0x78a4('0x13'));var utils=require(_0x78a4('0x14'));var config=require(_0x78a4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x78a4('0x16'))['db'];function respondWithStatusCode(_0x26771e,_0xa4624f){_0xa4624f=_0xa4624f||0xcc;return function(_0x344787){if(_0x344787){return _0x26771e[_0x78a4('0x17')](_0xa4624f);}return _0x26771e[_0x78a4('0x18')](_0xa4624f)[_0x78a4('0x19')]();};}function respondWithResult(_0x112fcc,_0x5cc908){_0x5cc908=_0x5cc908||0xc8;return function(_0x8cfce4){if(_0x8cfce4){return _0x112fcc[_0x78a4('0x18')](_0x5cc908)['json'](_0x8cfce4);}};}function respondWithFilteredResult(_0x3a8e44,_0x497466){return function(_0x2e1af5){if(_0x2e1af5){var _0x442b2f=typeof _0x497466['offset']===_0x78a4('0x1a')&&typeof _0x497466[_0x78a4('0x1b')]==='undefined';var _0xae44db=_0x2e1af5[_0x78a4('0x1c')];var _0x17c1b0=_0x442b2f?0x0:_0x497466['offset'];var _0x315a13=_0x442b2f?_0x2e1af5[_0x78a4('0x1c')]:_0x497466['offset']+_0x497466[_0x78a4('0x1b')];var _0x3bc913;if(_0x315a13>=_0xae44db){_0x315a13=_0xae44db;_0x3bc913=0xc8;}else{_0x3bc913=0xce;}_0x3a8e44[_0x78a4('0x18')](_0x3bc913);return _0x3a8e44[_0x78a4('0x1d')](_0x78a4('0x1e'),_0x17c1b0+'-'+_0x315a13+'/'+_0xae44db)[_0x78a4('0x1f')](_0x2e1af5);}return null;};}function patchUpdates(_0x5398c8){return function(_0x56b4b0){try{jsonpatch['apply'](_0x56b4b0,_0x5398c8,!![]);}catch(_0xd2ffc){return BPromise[_0x78a4('0x20')](_0xd2ffc);}return _0x56b4b0[_0x78a4('0x21')]();};}function saveUpdates(_0x35a6f5,_0x2638fa){return function(_0x119662){if(_0x119662){return _0x119662[_0x78a4('0x22')](_0x35a6f5)[_0x78a4('0x23')](function(_0x2a863c){return _0x2a863c;});}return null;};}function removeEntity(_0x3e6192,_0x1b80f0){return function(_0x22aedd){if(_0x22aedd){return _0x22aedd[_0x78a4('0x24')]()[_0x78a4('0x23')](function(){_0x3e6192['status'](0xcc)[_0x78a4('0x19')]();});}};}function handleEntityNotFound(_0xaf6f42,_0x2aa238){return function(_0x579951){if(!_0x579951){_0xaf6f42[_0x78a4('0x17')](0x194);}return _0x579951;};}function handleError(_0x35ea10,_0x2c1c5c){_0x2c1c5c=_0x2c1c5c||0x1f4;return function(_0x5b0dbf){logger[_0x78a4('0x25')](_0x5b0dbf['stack']);if(_0x5b0dbf[_0x78a4('0x26')]){delete _0x5b0dbf[_0x78a4('0x26')];}_0x35ea10[_0x78a4('0x18')](_0x2c1c5c)[_0x78a4('0x27')](_0x5b0dbf);};}exports[_0x78a4('0x28')]=function(_0x322405,_0x4830ee){var _0x411a1c={},_0x1d49df={},_0xd03b02={'count':0x0,'rows':[]};var _0x47c582=_[_0x78a4('0x29')](db[_0x78a4('0x2a')][_0x78a4('0x2b')],function(_0x369358){return{'name':_0x369358['fieldName'],'type':_0x369358[_0x78a4('0x2c')][_0x78a4('0x2d')]};});_0x1d49df[_0x78a4('0x2e')]=_[_0x78a4('0x29')](_0x47c582,'name');_0x1d49df[_0x78a4('0x2f')]=_[_0x78a4('0x30')](_0x322405[_0x78a4('0x2f')]);_0x1d49df[_0x78a4('0x31')]=_[_0x78a4('0x32')](_0x1d49df[_0x78a4('0x2e')],_0x1d49df[_0x78a4('0x2f')]);_0x411a1c[_0x78a4('0x33')]=_[_0x78a4('0x32')](_0x1d49df['model'],qs[_0x78a4('0x34')](_0x322405[_0x78a4('0x2f')][_0x78a4('0x34')]));_0x411a1c[_0x78a4('0x33')]=_0x411a1c['attributes'][_0x78a4('0x35')]?_0x411a1c[_0x78a4('0x33')]:_0x1d49df['model'];if(!_0x322405['query'][_0x78a4('0x36')](_0x78a4('0x37'))){_0x411a1c[_0x78a4('0x1b')]=qs[_0x78a4('0x1b')](_0x322405[_0x78a4('0x2f')][_0x78a4('0x1b')]);_0x411a1c[_0x78a4('0x38')]=qs[_0x78a4('0x38')](_0x322405[_0x78a4('0x2f')]['offset']);}_0x411a1c['order']=qs[_0x78a4('0x39')](_0x322405[_0x78a4('0x2f')][_0x78a4('0x39')]);_0x411a1c[_0x78a4('0x3a')]=qs['filters'](_[_0x78a4('0x3b')](_0x322405[_0x78a4('0x2f')],_0x1d49df[_0x78a4('0x31')]),_0x47c582);if(_0x322405[_0x78a4('0x2f')][_0x78a4('0x3c')]){_0x411a1c['where']=_[_0x78a4('0x3d')](_0x411a1c[_0x78a4('0x3a')],{'$or':_[_0x78a4('0x29')](_0x47c582,function(_0x53b0d1){if(_0x53b0d1['type']!==_0x78a4('0x3e')){var _0x14d257={};_0x14d257[_0x53b0d1[_0x78a4('0x26')]]={'$like':'%'+_0x322405[_0x78a4('0x2f')][_0x78a4('0x3c')]+'%'};return _0x14d257;}})});}_0x411a1c=_[_0x78a4('0x3d')]({},_0x411a1c,_0x322405[_0x78a4('0x3f')]);var _0x4f4f60={'where':_0x411a1c[_0x78a4('0x3a')]};return db['MailTransferReport'][_0x78a4('0x1c')](_0x4f4f60)['then'](function(_0x4b8d6b){_0xd03b02[_0x78a4('0x1c')]=_0x4b8d6b;if(_0x322405[_0x78a4('0x2f')][_0x78a4('0x40')]){_0x411a1c[_0x78a4('0x41')]=[{'all':!![]}];}return db['MailTransferReport'][_0x78a4('0x42')](_0x411a1c);})['then'](function(_0x4b6d59){_0xd03b02[_0x78a4('0x43')]=_0x4b6d59;return _0xd03b02;})['then'](respondWithFilteredResult(_0x4830ee,_0x411a1c))[_0x78a4('0x44')](handleError(_0x4830ee,null));};exports[_0x78a4('0x45')]=function(_0x5ab691,_0x280249){var _0x31bcd7={'raw':!![],'where':{'id':_0x5ab691[_0x78a4('0x46')]['id']}},_0x136998={};_0x136998[_0x78a4('0x2e')]=_['keys'](db[_0x78a4('0x2a')][_0x78a4('0x2b')]);_0x136998[_0x78a4('0x2f')]=_[_0x78a4('0x30')](_0x5ab691[_0x78a4('0x2f')]);_0x136998['filters']=_['intersection'](_0x136998[_0x78a4('0x2e')],_0x136998[_0x78a4('0x2f')]);_0x31bcd7[_0x78a4('0x33')]=_[_0x78a4('0x32')](_0x136998[_0x78a4('0x2e')],qs[_0x78a4('0x34')](_0x5ab691[_0x78a4('0x2f')][_0x78a4('0x34')]));_0x31bcd7[_0x78a4('0x33')]=_0x31bcd7[_0x78a4('0x33')][_0x78a4('0x35')]?_0x31bcd7[_0x78a4('0x33')]:_0x136998[_0x78a4('0x2e')];if(_0x5ab691[_0x78a4('0x2f')]['includeAll']){_0x31bcd7['include']=[{'all':!![]}];}_0x31bcd7=_[_0x78a4('0x3d')]({},_0x31bcd7,_0x5ab691[_0x78a4('0x3f')]);return db[_0x78a4('0x2a')][_0x78a4('0x47')](_0x31bcd7)['then'](handleEntityNotFound(_0x280249,null))[_0x78a4('0x23')](respondWithResult(_0x280249,null))[_0x78a4('0x44')](handleError(_0x280249,null));};exports[_0x78a4('0x48')]=function(_0x31a04f,_0x2ff236){return db[_0x78a4('0x2a')][_0x78a4('0x48')](_0x31a04f[_0x78a4('0x49')],{})[_0x78a4('0x23')](respondWithResult(_0x2ff236,0xc9))['catch'](handleError(_0x2ff236,null));};exports['update']=function(_0x298145,_0x50eab9){if(_0x298145[_0x78a4('0x49')]['id']){delete _0x298145[_0x78a4('0x49')]['id'];}return db[_0x78a4('0x2a')]['find']({'where':{'id':_0x298145[_0x78a4('0x46')]['id']}})['then'](handleEntityNotFound(_0x50eab9,null))[_0x78a4('0x23')](saveUpdates(_0x298145['body'],null))[_0x78a4('0x23')](respondWithResult(_0x50eab9,null))['catch'](handleError(_0x50eab9,null));};exports[_0x78a4('0x24')]=function(_0x1f409e,_0x2f92d6){return db[_0x78a4('0x2a')][_0x78a4('0x47')]({'where':{'id':_0x1f409e[_0x78a4('0x46')]['id']}})[_0x78a4('0x23')](handleEntityNotFound(_0x2f92d6,null))['then'](removeEntity(_0x2f92d6,null))[_0x78a4('0x44')](handleError(_0x2f92d6,null));};exports['describe']=function(_0x49cb4e,_0x52b592){return db['MailTransferReport']['describe']()[_0x78a4('0x23')](respondWithResult(_0x52b592,null))[_0x78a4('0x44')](handleError(_0x52b592,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 744679c..9de2b54 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 _0x386f=['report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','define','MailTransferReport'];(function(_0x24aa11,_0x4b8b35){var _0x41b154=function(_0x49b945){while(--_0x49b945){_0x24aa11['push'](_0x24aa11['shift']());}};_0x41b154(++_0x4b8b35);}(_0x386f,0x11a));var _0xf386=function(_0x277d9a,_0x864b9c){_0x277d9a=_0x277d9a-0x0;var _0x2ae33f=_0x386f[_0x277d9a];return _0x2ae33f;};'use strict';var _=require(_0xf386('0x0'));var util=require(_0xf386('0x1'));var logger=require(_0xf386('0x2'))(_0xf386('0x3'));var moment=require(_0xf386('0x4'));var BPromise=require(_0xf386('0x5'));var rp=require(_0xf386('0x6'));var fs=require('fs');var path=require(_0xf386('0x7'));var rimraf=require(_0xf386('0x8'));var config=require('../../config/environment');var attributes=require(_0xf386('0x9'));module['exports']=function(_0x445c3c,_0x288edc){return _0x445c3c[_0xf386('0xa')](_0xf386('0xb'),attributes,{'tableName':_0xf386('0xc'),'paranoid':![],'indexes':[{'name':_0xf386('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9752=['uniqueid','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','report_mail_transfer'];(function(_0x1a754d,_0x404328){var _0x1aec5b=function(_0x4fd1d0){while(--_0x4fd1d0){_0x1a754d['push'](_0x1a754d['shift']());}};_0x1aec5b(++_0x404328);}(_0x9752,0x90));var _0x2975=function(_0x4f253d,_0x4363b4){_0x4f253d=_0x4f253d-0x0;var _0x51dff3=_0x9752[_0x4f253d];return _0x51dff3;};'use strict';var _=require('lodash');var util=require(_0x2975('0x0'));var logger=require(_0x2975('0x1'))(_0x2975('0x2'));var moment=require(_0x2975('0x3'));var BPromise=require('bluebird');var rp=require(_0x2975('0x4'));var fs=require('fs');var path=require(_0x2975('0x5'));var rimraf=require(_0x2975('0x6'));var config=require(_0x2975('0x7'));var attributes=require(_0x2975('0x8'));module[_0x2975('0x9')]=function(_0x8d643d,_0x288fbd){return _0x8d643d[_0x2975('0xa')]('MailTransferReport',attributes,{'tableName':_0x2975('0xb'),'paranoid':![],'indexes':[{'name':_0x2975('0xc'),'fields':[_0x2975('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index dc2a469..597c45a 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 _0x9581=['client','http','request','request\x20sent','debug','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','info','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9581,0x182));var _0x1958=function(_0x1e0876,_0x2e8dc5){_0x1e0876=_0x1e0876-0x0;var _0xccecf8=_0x9581[_0x1e0876];return _0xccecf8;};'use strict';var _=require('lodash');var util=require(_0x1958('0x0'));var moment=require(_0x1958('0x1'));var BPromise=require(_0x1958('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1958('0x3'));var db=require(_0x1958('0x4'))['db'];var utils=require(_0x1958('0x5'));var logger=require(_0x1958('0x6'))(_0x1958('0x7'));var config=require(_0x1958('0x8'));var jayson=require(_0x1958('0x9'));var client=jayson[_0x1958('0xa')][_0x1958('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33f3f0,_0x5095ba,_0x1de6c0){return new BPromise(function(_0x36c06f,_0x264e75){return client[_0x1958('0xc')](_0x33f3f0,_0x1de6c0)['then'](function(_0x12908b){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x5095ba,_0x1958('0xd'));logger[_0x1958('0xe')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x5095ba,_0x1958('0xd'),JSON[_0x1958('0xf')](_0x12908b));if(_0x12908b[_0x1958('0x10')]){if(_0x12908b['error'][_0x1958('0x11')]===0x1f4){logger['error'](_0x1958('0x12'),_0x5095ba,_0x12908b['error'][_0x1958('0x13')]);return _0x264e75(_0x12908b['error'][_0x1958('0x13')]);}logger[_0x1958('0x10')](_0x1958('0x12'),_0x5095ba,_0x12908b[_0x1958('0x10')][_0x1958('0x13')]);return _0x36c06f(_0x12908b[_0x1958('0x10')][_0x1958('0x13')]);}else{logger[_0x1958('0x14')](_0x1958('0x12'),_0x5095ba,_0x1958('0xd'));_0x36c06f(_0x12908b[_0x1958('0x15')][_0x1958('0x13')]);}})['catch'](function(_0x4d750f){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x5095ba,_0x4d750f);_0x264e75(_0x4d750f);});});} \ No newline at end of file +var _0x77d6=['debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x5e0ba3,_0x43e5fd){var _0x1f15bf=function(_0x3a2840){while(--_0x3a2840){_0x5e0ba3['push'](_0x5e0ba3['shift']());}};_0x1f15bf(++_0x43e5fd);}(_0x77d6,0xcf));var _0x677d=function(_0x34b207,_0x445c91){_0x34b207=_0x34b207-0x0;var _0x572ba6=_0x77d6[_0x34b207];return _0x572ba6;};'use strict';var _=require(_0x677d('0x0'));var util=require(_0x677d('0x1'));var moment=require(_0x677d('0x2'));var BPromise=require('bluebird');var rs=require(_0x677d('0x3'));var fs=require('fs');var Redis=require(_0x677d('0x4'));var db=require(_0x677d('0x5'))['db'];var utils=require(_0x677d('0x6'));var logger=require(_0x677d('0x7'))(_0x677d('0x8'));var config=require(_0x677d('0x9'));var jayson=require(_0x677d('0xa'));var client=jayson[_0x677d('0xb')][_0x677d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4774d8,_0x5f76ed,_0x495cd3){return new BPromise(function(_0xab31f4,_0x2627d2){return client[_0x677d('0xd')](_0x4774d8,_0x495cd3)[_0x677d('0xe')](function(_0x1e3105){logger[_0x677d('0xf')](_0x677d('0x10'),_0x5f76ed,_0x677d('0x11'));logger[_0x677d('0x12')](_0x677d('0x13'),_0x5f76ed,_0x677d('0x11'),JSON[_0x677d('0x14')](_0x1e3105));if(_0x1e3105[_0x677d('0x15')]){if(_0x1e3105[_0x677d('0x15')][_0x677d('0x16')]===0x1f4){logger[_0x677d('0x15')](_0x677d('0x10'),_0x5f76ed,_0x1e3105[_0x677d('0x15')][_0x677d('0x17')]);return _0x2627d2(_0x1e3105[_0x677d('0x15')][_0x677d('0x17')]);}logger['error'](_0x677d('0x10'),_0x5f76ed,_0x1e3105[_0x677d('0x15')][_0x677d('0x17')]);return _0xab31f4(_0x1e3105[_0x677d('0x15')][_0x677d('0x17')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x5f76ed,_0x677d('0x11'));_0xab31f4(_0x1e3105['result'][_0x677d('0x17')]);}})[_0x677d('0x18')](function(_0x53a62d){logger[_0x677d('0x15')]('MailTransferReport,\x20%s,\x20%s',_0x5f76ed,_0x53a62d);_0x2627d2(_0x53a62d);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index f4875e3..1c674b6 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 _0xd1bf=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','destroy','exports'];(function(_0x540ad3,_0x390484){var _0x5acfbd=function(_0x381f60){while(--_0x381f60){_0x540ad3['push'](_0x540ad3['shift']());}};_0x5acfbd(++_0x390484);}(_0xd1bf,0x1a4));var _0xfd1b=function(_0x10f1e6,_0x42c9bd){_0x10f1e6=_0x10f1e6-0x0;var _0x173b3d=_0xd1bf[_0x10f1e6];return _0x173b3d;};'use strict';var multer=require(_0xfd1b('0x0'));var util=require(_0xfd1b('0x1'));var path=require(_0xfd1b('0x2'));var timeout=require(_0xfd1b('0x3'));var express=require(_0xfd1b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfd1b('0x5'));var interaction=require(_0xfd1b('0x6'));var config=require(_0xfd1b('0x7'));var controller=require(_0xfd1b('0x8'));router[_0xfd1b('0x9')]('/',auth[_0xfd1b('0xa')](),controller[_0xfd1b('0xb')]);router['get']('/describe',auth[_0xfd1b('0xa')](),controller[_0xfd1b('0xc')]);router[_0xfd1b('0x9')](_0xfd1b('0xd'),auth[_0xfd1b('0xa')](),controller[_0xfd1b('0xe')]);router['post']('/',auth[_0xfd1b('0xa')](),controller[_0xfd1b('0xf')]);router[_0xfd1b('0x10')](_0xfd1b('0xd'),auth[_0xfd1b('0xa')](),controller[_0xfd1b('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xfd1b('0x12')]);module[_0xfd1b('0x13')]=router; \ No newline at end of file +var _0x8bff=['connect-timeout','express','Router','fs-extra','../../config/environment','./memberReport.controller','get','isAuthenticated','describe','/:id','show','update','destroy','exports','multer','util'];(function(_0x2a38ac,_0x5b649c){var _0x590c18=function(_0x4437bd){while(--_0x4437bd){_0x2a38ac['push'](_0x2a38ac['shift']());}};_0x590c18(++_0x5b649c);}(_0x8bff,0x15e));var _0xf8bf=function(_0x231de6,_0x299da4){_0x231de6=_0x231de6-0x0;var _0x45afc5=_0x8bff[_0x231de6];return _0x45afc5;};'use strict';var multer=require(_0xf8bf('0x0'));var util=require(_0xf8bf('0x1'));var path=require('path');var timeout=require(_0xf8bf('0x2'));var express=require(_0xf8bf('0x3'));var router=express[_0xf8bf('0x4')]();var fs_extra=require(_0xf8bf('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf8bf('0x6'));var controller=require(_0xf8bf('0x7'));router[_0xf8bf('0x8')]('/',auth[_0xf8bf('0x9')](),controller['index']);router[_0xf8bf('0x8')]('/describe',auth[_0xf8bf('0x9')](),controller[_0xf8bf('0xa')]);router[_0xf8bf('0x8')](_0xf8bf('0xb'),auth[_0xf8bf('0x9')](),controller[_0xf8bf('0xc')]);router['post']('/',auth[_0xf8bf('0x9')](),controller['create']);router['put'](_0xf8bf('0xb'),auth[_0xf8bf('0x9')](),controller[_0xf8bf('0xd')]);router['delete']('/:id',auth[_0xf8bf('0x9')](),controller[_0xf8bf('0xe')]);module[_0xf8bf('0xf')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index a9d2bc6..cdb2871 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 _0xb007=['diff','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt'];(function(_0x46f4fe,_0xd18ed){var _0x163a08=function(_0xb43dbc){while(--_0xb43dbc){_0x46f4fe['push'](_0x46f4fe['shift']());}};_0x163a08(++_0xd18ed);}(_0xb007,0x19b));var _0x7b00=function(_0x21b84d,_0x4da029){_0x21b84d=_0x21b84d-0x0;var _0x3bd8ef=_0xb007[_0x21b84d];return _0x3bd8ef;};'use strict';var Sequelize=require(_0x7b00('0x0'));var moment=require(_0x7b00('0x1'));module[_0x7b00('0x2')]={'channel':{'type':Sequelize[_0x7b00('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x7b00('0x3')]},'type':{'type':Sequelize[_0x7b00('0x3')],'defaultValue':_0x7b00('0x4'),'comment':_0x7b00('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x7b00('0x6')]},'exitAt':{'type':Sequelize[_0x7b00('0x6')],'set':function(_0x4fe781){var _0x4bdd16=moment(_0x4fe781);var _0x35d4c5=moment(this[_0x7b00('0x7')](_0x7b00('0x8')));var _0x2a5c00=_0x4bdd16[_0x7b00('0x9')](_0x35d4c5,'seconds');this['setDataValue'](_0x7b00('0xa'),_0x4fe781);this['setDataValue'](_0x7b00('0xb'),_0x2a5c00>=0x0?_0x2a5c00:null);}},'data1':{'type':Sequelize[_0x7b00('0x3')],'comment':_0x7b00('0xc')},'data2':{'type':Sequelize[_0x7b00('0x3')],'comment':_0x7b00('0xd')},'data3':{'type':Sequelize[_0x7b00('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x7b00('0x3')],'comment':_0x7b00('0xe')},'data5':{'type':Sequelize[_0x7b00('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x7b00('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x7b00('0x3')]}}; \ No newline at end of file +var _0x9c61=['sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[queue]'];(function(_0x587c78,_0x3aa597){var _0xe92b85=function(_0x3289e8){while(--_0x3289e8){_0x587c78['push'](_0x587c78['shift']());}};_0xe92b85(++_0x3aa597);}(_0x9c61,0x145));var _0x19c6=function(_0x15a033,_0x379888){_0x15a033=_0x15a033-0x0;var _0x44b426=_0x9c61[_0x15a033];return _0x44b426;};'use strict';var Sequelize=require(_0x19c6('0x0'));var moment=require(_0x19c6('0x1'));module[_0x19c6('0x2')]={'channel':{'type':Sequelize[_0x19c6('0x3')]},'membername':{'type':Sequelize[_0x19c6('0x3')]},'interface':{'type':Sequelize[_0x19c6('0x3')]},'type':{'type':Sequelize[_0x19c6('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x19c6('0x4')},'duration':{'type':Sequelize[_0x19c6('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x19c6('0x6')],'set':function(_0x335ea6){var _0x545a26=moment(_0x335ea6);var _0x35f18a=moment(this[_0x19c6('0x7')](_0x19c6('0x8')));var _0x38bca4=_0x545a26['diff'](_0x35f18a,_0x19c6('0x9'));this['setDataValue']('exitAt',_0x335ea6);this['setDataValue']('duration',_0x38bca4>=0x0?_0x38bca4:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x19c6('0xa')},'data2':{'type':Sequelize[_0x19c6('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x19c6('0x3')],'comment':_0x19c6('0xb')},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x19c6('0x3')],'comment':_0x19c6('0xc')},'role':{'type':Sequelize[_0x19c6('0x3')]},'internal':{'type':Sequelize[_0x19c6('0x5')]},'uniqueid':{'type':Sequelize[_0x19c6('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 1b7f42c..aaef161 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0x34e8,0x12c));var _0x834e=function(_0x40f1e2,_0x33863a){_0x40f1e2=_0x40f1e2-0x0;var _0x2e6abe=_0x34e8[_0x40f1e2];return _0x2e6abe;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file +var _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(_0x2cf37f,_0x2217b7){var _0x1bd369=function(_0x12d071){while(--_0x12d071){_0x2cf37f['push'](_0x2cf37f['shift']());}};_0x1bd369(++_0x2217b7);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 16c18eb..51ee7b8 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 _0xeac9=['./memberReport.attributes','exports','MemberReport','membername_interface','interface','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x3872c3,_0x1d5a76){var _0x59939e=function(_0x1f6d66){while(--_0x1f6d66){_0x3872c3['push'](_0x3872c3['shift']());}};_0x59939e(++_0x1d5a76);}(_0xeac9,0xae));var _0x9eac=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xeac9[_0x122096];return _0x3d1966;};'use strict';var _=require(_0x9eac('0x0'));var util=require(_0x9eac('0x1'));var logger=require(_0x9eac('0x2'))(_0x9eac('0x3'));var moment=require(_0x9eac('0x4'));var BPromise=require(_0x9eac('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9eac('0x6'));var rimraf=require('rimraf');var config=require(_0x9eac('0x7'));var attributes=require(_0x9eac('0x8'));module[_0x9eac('0x9')]=function(_0x55f912,_0x1397bc){return _0x55f912['define'](_0x9eac('0xa'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x9eac('0xb'),'fields':['membername',_0x9eac('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc3fc=['request-promise','path','../../config/environment','./memberReport.attributes','define','MemberReport','membername','interface','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4c7bb8,_0x480191){var _0x280d07=function(_0x2364b0){while(--_0x2364b0){_0x4c7bb8['push'](_0x4c7bb8['shift']());}};_0x280d07(++_0x480191);}(_0xc3fc,0xcc));var _0xcc3f=function(_0x305ba3,_0x1aa87d){_0x305ba3=_0x305ba3-0x0;var _0x23af7b=_0xc3fc[_0x305ba3];return _0x23af7b;};'use strict';var _=require(_0xcc3f('0x0'));var util=require(_0xcc3f('0x1'));var logger=require(_0xcc3f('0x2'))(_0xcc3f('0x3'));var moment=require(_0xcc3f('0x4'));var BPromise=require(_0xcc3f('0x5'));var rp=require(_0xcc3f('0x6'));var fs=require('fs');var path=require(_0xcc3f('0x7'));var rimraf=require('rimraf');var config=require(_0xcc3f('0x8'));var attributes=require(_0xcc3f('0x9'));module['exports']=function(_0x127e86,_0x537698){return _0x127e86[_0xcc3f('0xa')](_0xcc3f('0xb'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xcc3f('0xc'),_0xcc3f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 8c63de2..074ae4a 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 _0xe75a=['include','map','model','info','create','body','then','CreateMemberReport','UpdateMemberReport','update','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request\x20sent','debug','stringify','error','code','message','MemberReport,\x20%s,\x20%s','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit'];(function(_0x370363,_0x15440a){var _0x1a941f=function(_0x584b05){while(--_0x584b05){_0x370363['push'](_0x370363['shift']());}};_0x1a941f(++_0x15440a);}(_0xe75a,0x1de));var _0xae75=function(_0x4a563b,_0x36f42d){_0x4a563b=_0x4a563b-0x0;var _0x2935ef=_0xe75a[_0x4a563b];return _0x2935ef;};'use strict';var _=require(_0xae75('0x0'));var util=require(_0xae75('0x1'));var moment=require('moment');var BPromise=require(_0xae75('0x2'));var rs=require(_0xae75('0x3'));var fs=require('fs');var Redis=require(_0xae75('0x4'));var db=require(_0xae75('0x5'))['db'];var utils=require(_0xae75('0x6'));var logger=require(_0xae75('0x7'))(_0xae75('0x8'));var config=require(_0xae75('0x9'));var jayson=require(_0xae75('0xa'));var client=jayson[_0xae75('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x207d6f,_0x55c165,_0x49ae5b){return new BPromise(function(_0x38e6b4,_0x56114b){return client['request'](_0x207d6f,_0x49ae5b)['then'](function(_0x2124be){logger['info']('MemberReport,\x20%s,\x20%s',_0x55c165,_0xae75('0xc'));logger[_0xae75('0xd')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x55c165,_0xae75('0xc'),JSON[_0xae75('0xe')](_0x2124be));if(_0x2124be['error']){if(_0x2124be[_0xae75('0xf')][_0xae75('0x10')]===0x1f4){logger[_0xae75('0xf')]('MemberReport,\x20%s,\x20%s',_0x55c165,_0x2124be[_0xae75('0xf')][_0xae75('0x11')]);return _0x56114b(_0x2124be[_0xae75('0xf')][_0xae75('0x11')]);}logger[_0xae75('0xf')](_0xae75('0x12'),_0x55c165,_0x2124be[_0xae75('0xf')][_0xae75('0x11')]);return _0x38e6b4(_0x2124be[_0xae75('0xf')][_0xae75('0x11')]);}else{logger['info'](_0xae75('0x12'),_0x55c165,_0xae75('0xc'));_0x38e6b4(_0x2124be[_0xae75('0x13')][_0xae75('0x11')]);}})[_0xae75('0x14')](function(_0x40f0c5){logger['error']('MemberReport,\x20%s,\x20%s',_0x55c165,_0x40f0c5);_0x56114b(_0x40f0c5);});});}exports[_0xae75('0x15')]=function(_0x2cffc8){var _0x3be46c=this;return new Promise(function(_0x582740,_0x6f3141){return db[_0xae75('0x16')][_0xae75('0x17')]({'raw':_0x2cffc8[_0xae75('0x18')]?_0x2cffc8[_0xae75('0x18')][_0xae75('0x19')]===undefined?!![]:![]:!![],'where':_0x2cffc8['options']?_0x2cffc8[_0xae75('0x18')][_0xae75('0x1a')]||null:null,'attributes':_0x2cffc8[_0xae75('0x18')]?_0x2cffc8[_0xae75('0x18')][_0xae75('0x1b')]||null:null,'limit':_0x2cffc8[_0xae75('0x18')]?_0x2cffc8[_0xae75('0x18')][_0xae75('0x1c')]||null:null,'include':_0x2cffc8[_0xae75('0x18')]?_0x2cffc8['options'][_0xae75('0x1d')]?_[_0xae75('0x1e')](_0x2cffc8[_0xae75('0x18')][_0xae75('0x1d')],function(_0x4bdbba){return{'model':db[_0x4bdbba['model']],'as':_0x4bdbba['as'],'attributes':_0x4bdbba[_0xae75('0x1b')],'include':_0x4bdbba['include']?_[_0xae75('0x1e')](_0x4bdbba[_0xae75('0x1d')],function(_0x3f8b21){return{'model':db[_0x3f8b21[_0xae75('0x1f')]],'as':_0x3f8b21['as'],'attributes':_0x3f8b21[_0xae75('0x1b')],'include':_0x3f8b21[_0xae75('0x1d')]?_[_0xae75('0x1e')](_0x3f8b21[_0xae75('0x1d')],function(_0x2af640){return{'model':db[_0x2af640['model']],'as':_0x2af640['as'],'attributes':_0x2af640[_0xae75('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x451304){logger[_0xae75('0x20')]('GetMemberReport',_0x2cffc8);logger['debug'](_0xae75('0x15'),_0x2cffc8,JSON['stringify'](_0x451304));_0x582740(_0x451304);})[_0xae75('0x14')](function(_0x1b5c2f){logger[_0xae75('0xf')](_0xae75('0x15'),_0x1b5c2f['message'],_0x2cffc8);_0x6f3141(_0x3be46c['error'](0x1f4,_0x1b5c2f[_0xae75('0x11')]));});});};exports['CreateMemberReport']=function(_0x182ad6){var _0x58104d=this;return new Promise(function(_0x3e5569,_0xa46550){return db[_0xae75('0x16')][_0xae75('0x21')](_0x182ad6[_0xae75('0x22')],{'raw':_0x182ad6[_0xae75('0x18')]?_0x182ad6[_0xae75('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xae75('0x23')](function(_0x21dcef){logger[_0xae75('0x20')](_0xae75('0x24'),_0x182ad6);logger['debug'](_0xae75('0x24'),_0x182ad6,JSON[_0xae75('0xe')](_0x21dcef));_0x3e5569(_0x21dcef);})[_0xae75('0x14')](function(_0x1b1b4a){logger[_0xae75('0xf')](_0xae75('0x24'),_0x1b1b4a['message'],_0x182ad6);_0xa46550(_0x58104d[_0xae75('0xf')](0x1f4,_0x1b1b4a[_0xae75('0x11')]));});});};exports[_0xae75('0x25')]=function(_0x5f29cd){var _0x2b2384=this;return new Promise(function(_0x298c59,_0x217d7d){return db[_0xae75('0x16')][_0xae75('0x26')](_0x5f29cd[_0xae75('0x22')],{'raw':_0x5f29cd[_0xae75('0x18')]?_0x5f29cd[_0xae75('0x18')][_0xae75('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f29cd['options']?_0x5f29cd['options'][_0xae75('0x1a')]||null:null,'attributes':_0x5f29cd[_0xae75('0x18')]?_0x5f29cd[_0xae75('0x18')][_0xae75('0x1b')]||null:null,'limit':_0x5f29cd[_0xae75('0x18')]?_0x5f29cd['options']['limit']||null:null})[_0xae75('0x23')](function(_0x1c3aa8){logger[_0xae75('0x20')](_0xae75('0x25'),_0x5f29cd);logger[_0xae75('0xd')](_0xae75('0x25'),_0x5f29cd,JSON[_0xae75('0xe')](_0x1c3aa8));_0x298c59(_0x1c3aa8);})[_0xae75('0x14')](function(_0x41c3a3){logger['error'](_0xae75('0x25'),_0x41c3a3[_0xae75('0x11')],_0x5f29cd);_0x217d7d(_0x2b2384[_0xae75('0xf')](0x1f4,_0x41c3a3['message']));});});}; \ No newline at end of file +var _0x6a83=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateMemberReport','create','body','UpdateMemberReport','update'];(function(_0x47ab74,_0x1ebbed){var _0x4522fe=function(_0x5b4caa){while(--_0x5b4caa){_0x47ab74['push'](_0x47ab74['shift']());}};_0x4522fe(++_0x1ebbed);}(_0x6a83,0xd2));var _0x36a8=function(_0x35b14c,_0x11d7fd){_0x35b14c=_0x35b14c-0x0;var _0x3ba50e=_0x6a83[_0x35b14c];return _0x3ba50e;};'use strict';var _=require(_0x36a8('0x0'));var util=require(_0x36a8('0x1'));var moment=require(_0x36a8('0x2'));var BPromise=require(_0x36a8('0x3'));var rs=require(_0x36a8('0x4'));var fs=require('fs');var Redis=require(_0x36a8('0x5'));var db=require(_0x36a8('0x6'))['db'];var utils=require(_0x36a8('0x7'));var logger=require(_0x36a8('0x8'))(_0x36a8('0x9'));var config=require(_0x36a8('0xa'));var jayson=require(_0x36a8('0xb'));var client=jayson[_0x36a8('0xc')][_0x36a8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2a0ba3,_0x2e1d01,_0x31b8d3){return new BPromise(function(_0xf312a6,_0x1f5d99){return client['request'](_0x2a0ba3,_0x31b8d3)[_0x36a8('0xe')](function(_0x545750){logger[_0x36a8('0xf')](_0x36a8('0x10'),_0x2e1d01,'request\x20sent');logger[_0x36a8('0x11')](_0x36a8('0x12'),_0x2e1d01,'request\x20sent',JSON[_0x36a8('0x13')](_0x545750));if(_0x545750[_0x36a8('0x14')]){if(_0x545750[_0x36a8('0x14')][_0x36a8('0x15')]===0x1f4){logger[_0x36a8('0x14')](_0x36a8('0x10'),_0x2e1d01,_0x545750[_0x36a8('0x14')][_0x36a8('0x16')]);return _0x1f5d99(_0x545750['error'][_0x36a8('0x16')]);}logger[_0x36a8('0x14')](_0x36a8('0x10'),_0x2e1d01,_0x545750[_0x36a8('0x14')]['message']);return _0xf312a6(_0x545750['error'][_0x36a8('0x16')]);}else{logger[_0x36a8('0xf')](_0x36a8('0x10'),_0x2e1d01,_0x36a8('0x17'));_0xf312a6(_0x545750[_0x36a8('0x18')][_0x36a8('0x16')]);}})[_0x36a8('0x19')](function(_0x4840b0){logger[_0x36a8('0x14')](_0x36a8('0x10'),_0x2e1d01,_0x4840b0);_0x1f5d99(_0x4840b0);});});}exports[_0x36a8('0x1a')]=function(_0x5f0671){var _0x37156f=this;return new Promise(function(_0x50fc0f,_0x33005b){return db[_0x36a8('0x1b')][_0x36a8('0x1c')]({'raw':_0x5f0671['options']?_0x5f0671[_0x36a8('0x1d')][_0x36a8('0x1e')]===undefined?!![]:![]:!![],'where':_0x5f0671['options']?_0x5f0671[_0x36a8('0x1d')][_0x36a8('0x1f')]||null:null,'attributes':_0x5f0671['options']?_0x5f0671[_0x36a8('0x1d')][_0x36a8('0x20')]||null:null,'limit':_0x5f0671[_0x36a8('0x1d')]?_0x5f0671[_0x36a8('0x1d')][_0x36a8('0x21')]||null:null,'include':_0x5f0671[_0x36a8('0x1d')]?_0x5f0671['options'][_0x36a8('0x22')]?_[_0x36a8('0x23')](_0x5f0671['options']['include'],function(_0x4813fd){return{'model':db[_0x4813fd[_0x36a8('0x24')]],'as':_0x4813fd['as'],'attributes':_0x4813fd[_0x36a8('0x20')],'include':_0x4813fd[_0x36a8('0x22')]?_[_0x36a8('0x23')](_0x4813fd['include'],function(_0xf0e6b7){return{'model':db[_0xf0e6b7['model']],'as':_0xf0e6b7['as'],'attributes':_0xf0e6b7[_0x36a8('0x20')],'include':_0xf0e6b7['include']?_[_0x36a8('0x23')](_0xf0e6b7['include'],function(_0x15f7e0){return{'model':db[_0x15f7e0[_0x36a8('0x24')]],'as':_0x15f7e0['as'],'attributes':_0x15f7e0[_0x36a8('0x20')]};}):[]};}):[]};}):[]:[]})[_0x36a8('0xe')](function(_0x27bd18){logger['info'](_0x36a8('0x1a'),_0x5f0671);logger[_0x36a8('0x11')](_0x36a8('0x1a'),_0x5f0671,JSON['stringify'](_0x27bd18));_0x50fc0f(_0x27bd18);})[_0x36a8('0x19')](function(_0x2b9b9c){logger[_0x36a8('0x14')]('GetMemberReport',_0x2b9b9c['message'],_0x5f0671);_0x33005b(_0x37156f[_0x36a8('0x14')](0x1f4,_0x2b9b9c[_0x36a8('0x16')]));});});};exports[_0x36a8('0x25')]=function(_0x8f440a){var _0x460b47=this;return new Promise(function(_0x174f75,_0x49bfe5){return db[_0x36a8('0x1b')][_0x36a8('0x26')](_0x8f440a[_0x36a8('0x27')],{'raw':_0x8f440a[_0x36a8('0x1d')]?_0x8f440a[_0x36a8('0x1d')][_0x36a8('0x1e')]===undefined?!![]:![]:!![]})[_0x36a8('0xe')](function(_0x9682bf){logger[_0x36a8('0xf')](_0x36a8('0x25'),_0x8f440a);logger[_0x36a8('0x11')](_0x36a8('0x25'),_0x8f440a,JSON[_0x36a8('0x13')](_0x9682bf));_0x174f75(_0x9682bf);})[_0x36a8('0x19')](function(_0x20b990){logger[_0x36a8('0x14')](_0x36a8('0x25'),_0x20b990[_0x36a8('0x16')],_0x8f440a);_0x49bfe5(_0x460b47[_0x36a8('0x14')](0x1f4,_0x20b990['message']));});});};exports[_0x36a8('0x28')]=function(_0x517890){var _0x2198f6=this;return new Promise(function(_0x5346fa,_0x48fc2e){return db['MemberReport'][_0x36a8('0x29')](_0x517890['body'],{'raw':_0x517890[_0x36a8('0x1d')]?_0x517890['options'][_0x36a8('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x517890[_0x36a8('0x1d')]?_0x517890[_0x36a8('0x1d')][_0x36a8('0x1f')]||null:null,'attributes':_0x517890[_0x36a8('0x1d')]?_0x517890['options']['attributes']||null:null,'limit':_0x517890[_0x36a8('0x1d')]?_0x517890[_0x36a8('0x1d')][_0x36a8('0x21')]||null:null})['then'](function(_0x1fa209){logger[_0x36a8('0xf')](_0x36a8('0x28'),_0x517890);logger[_0x36a8('0x11')](_0x36a8('0x28'),_0x517890,JSON[_0x36a8('0x13')](_0x1fa209));_0x5346fa(_0x1fa209);})['catch'](function(_0x408f86){logger[_0x36a8('0x14')](_0x36a8('0x28'),_0x408f86[_0x36a8('0x16')],_0x517890);_0x48fc2e(_0x2198f6[_0x36a8('0x14')](0x1f4,_0x408f86[_0x36a8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 7b21bf6..72a6159 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 _0xa921=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','multer','path','connect-timeout','express','Router'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xa921,0x181));var _0x1a92=function(_0x577cde,_0x5c6ffe){_0x577cde=_0x577cde-0x0;var _0x23edc1=_0xa921[_0x577cde];return _0x23edc1;};'use strict';var multer=require(_0x1a92('0x0'));var util=require('util');var path=require(_0x1a92('0x1'));var timeout=require(_0x1a92('0x2'));var express=require(_0x1a92('0x3'));var router=express[_0x1a92('0x4')]();var fs_extra=require(_0x1a92('0x5'));var auth=require(_0x1a92('0x6'));var interaction=require(_0x1a92('0x7'));var config=require(_0x1a92('0x8'));var controller=require('./migration.controller');router[_0x1a92('0x9')]('/',controller['index']);module['exports']=router; \ No newline at end of file +var _0x0fcd=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get','exports'];(function(_0x5d003e,_0x31afda){var _0xff3eba=function(_0x504d3e){while(--_0x504d3e){_0x5d003e['push'](_0x5d003e['shift']());}};_0xff3eba(++_0x31afda);}(_0x0fcd,0x129));var _0xd0fc=function(_0x2293fd,_0x3320b9){_0x2293fd=_0x2293fd-0x0;var _0x46e575=_0x0fcd[_0x2293fd];return _0x46e575;};'use strict';var multer=require('multer');var util=require(_0xd0fc('0x0'));var path=require(_0xd0fc('0x1'));var timeout=require(_0xd0fc('0x2'));var express=require(_0xd0fc('0x3'));var router=express[_0xd0fc('0x4')]();var fs_extra=require(_0xd0fc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd0fc('0x6'));var config=require(_0xd0fc('0x7'));var controller=require(_0xd0fc('0x8'));router[_0xd0fc('0x9')]('/',controller['index']);module[_0xd0fc('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 2011c26..468b355 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 _0xbe97=['version','exports','STRING'];(function(_0x399cdd,_0x38df94){var _0x2fefba=function(_0xd74909){while(--_0xd74909){_0x399cdd['push'](_0x399cdd['shift']());}};_0x2fefba(++_0x38df94);}(_0xbe97,0x163));var _0x7be9=function(_0x32e0b6,_0x43e20f){_0x32e0b6=_0x32e0b6-0x0;var _0x315dad=_0xbe97[_0x32e0b6];return _0x315dad;};'use strict';var Sequelize=require('sequelize');module[_0x7be9('0x0')]={'version':{'type':Sequelize[_0x7be9('0x1')],'unique':_0x7be9('0x2')}}; \ No newline at end of file +var _0xc47b=['STRING','version','exports'];(function(_0x422081,_0x5c3b58){var _0x2f6e33=function(_0x2faa22){while(--_0x2faa22){_0x422081['push'](_0x422081['shift']());}};_0x2f6e33(++_0x5c3b58);}(_0xc47b,0xb0));var _0xbc47=function(_0x4161d1,_0x310c7c){_0x4161d1=_0x4161d1-0x0;var _0x38391d=_0xc47b[_0x4161d1];return _0x38391d;};'use strict';var Sequelize=require('sequelize');module[_0xbc47('0x0')]={'version':{'type':Sequelize[_0xbc47('0x1')],'unique':_0xbc47('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 03000c9..ff9a80f 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 _0x5fd3=['hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','options','findAll','catch','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','map','Migration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5fd3,0x191));var _0x35fd=function(_0x412433,_0x4245cc){_0x412433=_0x412433-0x0;var _0x505545=_0x5fd3[_0x412433];return _0x505545;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x35fd('0x0'));var zipdir=require(_0x35fd('0x1'));var jsonpatch=require(_0x35fd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x35fd('0x3'));var Mustache=require(_0x35fd('0x4'));var util=require(_0x35fd('0x5'));var path=require('path');var sox=require(_0x35fd('0x6'));var csv=require(_0x35fd('0x7'));var ejs=require(_0x35fd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fd('0x9'));var squel=require(_0x35fd('0xa'));var crypto=require(_0x35fd('0xb'));var jsforce=require(_0x35fd('0xc'));var deskjs=require(_0x35fd('0xd'));var toCsv=require(_0x35fd('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x35fd('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x35fd('0xf'));var hardwareService=require(_0x35fd('0x10'));var logger=require(_0x35fd('0x11'))(_0x35fd('0x12'));var utils=require(_0x35fd('0x13'));var config=require(_0x35fd('0x14'));var licenseUtil=require(_0x35fd('0x15'));var db=require(_0x35fd('0x16'))['db'];function respondWithStatusCode(_0x12f545,_0x1779d6){_0x1779d6=_0x1779d6||0xcc;return function(_0x26c6fb){if(_0x26c6fb){return _0x12f545[_0x35fd('0x17')](_0x1779d6);}return _0x12f545[_0x35fd('0x18')](_0x1779d6)['end']();};}function respondWithResult(_0x30591d,_0x2b37c7){_0x2b37c7=_0x2b37c7||0xc8;return function(_0x5a63e9){if(_0x5a63e9){return _0x30591d[_0x35fd('0x18')](_0x2b37c7)[_0x35fd('0x19')](_0x5a63e9);}};}function respondWithFilteredResult(_0x5b5313,_0x5b03a7){return function(_0x412f47){if(_0x412f47){var _0x371eb1=typeof _0x5b03a7['offset']==='undefined'&&typeof _0x5b03a7[_0x35fd('0x1a')]===_0x35fd('0x1b');var _0x766d41=_0x412f47[_0x35fd('0x1c')];var _0x2f1513=_0x371eb1?0x0:_0x5b03a7['offset'];var _0x5e4719=_0x371eb1?_0x412f47[_0x35fd('0x1c')]:_0x5b03a7['offset']+_0x5b03a7[_0x35fd('0x1a')];var _0x4f5ba2;if(_0x5e4719>=_0x766d41){_0x5e4719=_0x766d41;_0x4f5ba2=0xc8;}else{_0x4f5ba2=0xce;}_0x5b5313[_0x35fd('0x18')](_0x4f5ba2);return _0x5b5313[_0x35fd('0x1d')](_0x35fd('0x1e'),_0x2f1513+'-'+_0x5e4719+'/'+_0x766d41)[_0x35fd('0x19')](_0x412f47);}return null;};}function patchUpdates(_0x369e7d){return function(_0xcd084){try{jsonpatch[_0x35fd('0x1f')](_0xcd084,_0x369e7d,!![]);}catch(_0x3eac95){return BPromise[_0x35fd('0x20')](_0x3eac95);}return _0xcd084[_0x35fd('0x21')]();};}function saveUpdates(_0x489b45,_0x3551fc){return function(_0x57f5bb){if(_0x57f5bb){return _0x57f5bb[_0x35fd('0x22')](_0x489b45)[_0x35fd('0x23')](function(_0x3b5c72){return _0x3b5c72;});}return null;};}function removeEntity(_0x2e8773,_0x1e287b){return function(_0x241da8){if(_0x241da8){return _0x241da8[_0x35fd('0x24')]()[_0x35fd('0x23')](function(){_0x2e8773[_0x35fd('0x18')](0xcc)[_0x35fd('0x25')]();});}};}function handleEntityNotFound(_0xc37ed3,_0x4d4762){return function(_0x363e5e){if(!_0x363e5e){_0xc37ed3[_0x35fd('0x17')](0x194);}return _0x363e5e;};}function handleError(_0x5971e7,_0x2b62a9){_0x2b62a9=_0x2b62a9||0x1f4;return function(_0x1d92f5){logger[_0x35fd('0x26')](_0x1d92f5['stack']);if(_0x1d92f5[_0x35fd('0x27')]){delete _0x1d92f5[_0x35fd('0x27')];}_0x5971e7[_0x35fd('0x18')](_0x2b62a9)[_0x35fd('0x28')](_0x1d92f5);};}exports['index']=function(_0xf746f6,_0x4e0210){var _0x45585f={},_0x409101={},_0x2a68f7={'count':0x0,'rows':[]};var _0x45f7c1=_[_0x35fd('0x29')](db[_0x35fd('0x2a')][_0x35fd('0x2b')],function(_0x7af4b2){return{'name':_0x7af4b2[_0x35fd('0x2c')],'type':_0x7af4b2[_0x35fd('0x2d')][_0x35fd('0x2e')]};});_0x409101[_0x35fd('0x2f')]=_['map'](_0x45f7c1,_0x35fd('0x27'));_0x409101[_0x35fd('0x30')]=_['keys'](_0xf746f6['query']);_0x409101[_0x35fd('0x31')]=_[_0x35fd('0x32')](_0x409101[_0x35fd('0x2f')],_0x409101[_0x35fd('0x30')]);_0x45585f[_0x35fd('0x33')]=_[_0x35fd('0x32')](_0x409101[_0x35fd('0x2f')],qs[_0x35fd('0x34')](_0xf746f6['query']['fields']));_0x45585f['attributes']=_0x45585f[_0x35fd('0x33')][_0x35fd('0x35')]?_0x45585f['attributes']:_0x409101['model'];if(!_0xf746f6['query'][_0x35fd('0x36')](_0x35fd('0x37'))){_0x45585f[_0x35fd('0x1a')]=qs[_0x35fd('0x1a')](_0xf746f6['query'][_0x35fd('0x1a')]);_0x45585f['offset']=qs[_0x35fd('0x38')](_0xf746f6[_0x35fd('0x30')][_0x35fd('0x38')]);}_0x45585f['order']=qs['sort'](_0xf746f6['query'][_0x35fd('0x39')]);_0x45585f[_0x35fd('0x3a')]=qs[_0x35fd('0x31')](_[_0x35fd('0x3b')](_0xf746f6[_0x35fd('0x30')],_0x409101[_0x35fd('0x31')]),_0x45f7c1);if(_0xf746f6[_0x35fd('0x30')][_0x35fd('0x3c')]){_0x45585f[_0x35fd('0x3a')]=_[_0x35fd('0x3d')](_0x45585f[_0x35fd('0x3a')],{'$or':_[_0x35fd('0x29')](_0x45f7c1,function(_0x5cf040){if(_0x5cf040[_0x35fd('0x2d')]!=='VIRTUAL'){var _0x24ab6c={};_0x24ab6c[_0x5cf040['name']]={'$like':'%'+_0xf746f6[_0x35fd('0x30')]['filter']+'%'};return _0x24ab6c;}})});}_0x45585f=_[_0x35fd('0x3d')]({},_0x45585f,_0xf746f6[_0x35fd('0x3e')]);var _0x481e21={'where':_0x45585f[_0x35fd('0x3a')]};return db[_0x35fd('0x2a')]['count'](_0x481e21)['then'](function(_0x1693be){_0x2a68f7[_0x35fd('0x1c')]=_0x1693be;if(_0xf746f6[_0x35fd('0x30')]['includeAll']){_0x45585f['include']=[{'all':!![]}];}return db['Migration'][_0x35fd('0x3f')](_0x45585f);})[_0x35fd('0x23')](function(_0x4e50e4){_0x2a68f7['rows']=_0x4e50e4;return _0x2a68f7;})['then'](respondWithFilteredResult(_0x4e0210,_0x45585f))[_0x35fd('0x40')](handleError(_0x4e0210,null));}; \ No newline at end of file +var _0xbc70=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','destroy','then','error','stack','name','index','Migration','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','desk.js','querystring'];(function(_0x3d300b,_0x5f37d9){var _0x9561b9=function(_0x3356d6){while(--_0x3356d6){_0x3d300b['push'](_0x3d300b['shift']());}};_0x9561b9(++_0x5f37d9);}(_0xbc70,0xb2));var _0x0bc7=function(_0x645c29,_0x2d14f8){_0x645c29=_0x645c29-0x0;var _0x302294=_0xbc70[_0x645c29];return _0x302294;};'use strict';var emlformat=require(_0x0bc7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0bc7('0x1'));var jsonpatch=require(_0x0bc7('0x2'));var rp=require(_0x0bc7('0x3'));var moment=require(_0x0bc7('0x4'));var BPromise=require(_0x0bc7('0x5'));var Mustache=require(_0x0bc7('0x6'));var util=require(_0x0bc7('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x0bc7('0x8'));var ejs=require(_0x0bc7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0bc7('0xa'));var squel=require(_0x0bc7('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0bc7('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0bc7('0xd'));var Papa=require(_0x0bc7('0xe'));var Redis=require(_0x0bc7('0xf'));var authService=require(_0x0bc7('0x10'));var qs=require(_0x0bc7('0x11'));var as=require(_0x0bc7('0x12'));var hardwareService=require(_0x0bc7('0x13'));var logger=require('../../config/logger')(_0x0bc7('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0bc7('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a2df3,_0xf179b9){_0xf179b9=_0xf179b9||0xcc;return function(_0x44cafd){if(_0x44cafd){return _0x5a2df3[_0x0bc7('0x16')](_0xf179b9);}return _0x5a2df3[_0x0bc7('0x17')](_0xf179b9)[_0x0bc7('0x18')]();};}function respondWithResult(_0x4bd297,_0x87677b){_0x87677b=_0x87677b||0xc8;return function(_0x5c1291){if(_0x5c1291){return _0x4bd297['status'](_0x87677b)[_0x0bc7('0x19')](_0x5c1291);}};}function respondWithFilteredResult(_0x4c7d8a,_0x3c635b){return function(_0x1d5ef8){if(_0x1d5ef8){var _0x2466f0=typeof _0x3c635b[_0x0bc7('0x1a')]==='undefined'&&typeof _0x3c635b[_0x0bc7('0x1b')]===_0x0bc7('0x1c');var _0x368788=_0x1d5ef8['count'];var _0x45df91=_0x2466f0?0x0:_0x3c635b['offset'];var _0x1d4da5=_0x2466f0?_0x1d5ef8[_0x0bc7('0x1d')]:_0x3c635b[_0x0bc7('0x1a')]+_0x3c635b['limit'];var _0x10e8fd;if(_0x1d4da5>=_0x368788){_0x1d4da5=_0x368788;_0x10e8fd=0xc8;}else{_0x10e8fd=0xce;}_0x4c7d8a[_0x0bc7('0x17')](_0x10e8fd);return _0x4c7d8a[_0x0bc7('0x1e')]('Content-Range',_0x45df91+'-'+_0x1d4da5+'/'+_0x368788)[_0x0bc7('0x19')](_0x1d5ef8);}return null;};}function patchUpdates(_0x5d2d41){return function(_0x559c88){try{jsonpatch['apply'](_0x559c88,_0x5d2d41,!![]);}catch(_0x24c7c9){return BPromise[_0x0bc7('0x1f')](_0x24c7c9);}return _0x559c88[_0x0bc7('0x20')]();};}function saveUpdates(_0x1d7d18,_0x36c4a8){return function(_0x3dc043){if(_0x3dc043){return _0x3dc043['update'](_0x1d7d18)['then'](function(_0x444b4d){return _0x444b4d;});}return null;};}function removeEntity(_0x497890,_0x539634){return function(_0xc31849){if(_0xc31849){return _0xc31849[_0x0bc7('0x21')]()[_0x0bc7('0x22')](function(){_0x497890[_0x0bc7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd21fd0,_0x4594a9){return function(_0x43c8c3){if(!_0x43c8c3){_0xd21fd0[_0x0bc7('0x16')](0x194);}return _0x43c8c3;};}function handleError(_0x39f36a,_0x2c99e5){_0x2c99e5=_0x2c99e5||0x1f4;return function(_0x234d14){logger[_0x0bc7('0x23')](_0x234d14[_0x0bc7('0x24')]);if(_0x234d14[_0x0bc7('0x25')]){delete _0x234d14[_0x0bc7('0x25')];}_0x39f36a['status'](_0x2c99e5)['send'](_0x234d14);};}exports[_0x0bc7('0x26')]=function(_0x444783,_0x35c92b){var _0x42152d={},_0x432b08={},_0x1ce174={'count':0x0,'rows':[]};var _0x58a920=_['map'](db[_0x0bc7('0x27')]['rawAttributes'],function(_0x398b1a){return{'name':_0x398b1a['fieldName'],'type':_0x398b1a[_0x0bc7('0x28')][_0x0bc7('0x29')]};});_0x432b08[_0x0bc7('0x2a')]=_[_0x0bc7('0x2b')](_0x58a920,_0x0bc7('0x25'));_0x432b08[_0x0bc7('0x2c')]=_[_0x0bc7('0x2d')](_0x444783[_0x0bc7('0x2c')]);_0x432b08[_0x0bc7('0x2e')]=_[_0x0bc7('0x2f')](_0x432b08['model'],_0x432b08[_0x0bc7('0x2c')]);_0x42152d[_0x0bc7('0x30')]=_['intersection'](_0x432b08[_0x0bc7('0x2a')],qs['fields'](_0x444783[_0x0bc7('0x2c')][_0x0bc7('0x31')]));_0x42152d['attributes']=_0x42152d[_0x0bc7('0x30')][_0x0bc7('0x32')]?_0x42152d[_0x0bc7('0x30')]:_0x432b08['model'];if(!_0x444783[_0x0bc7('0x2c')][_0x0bc7('0x33')](_0x0bc7('0x34'))){_0x42152d[_0x0bc7('0x1b')]=qs[_0x0bc7('0x1b')](_0x444783[_0x0bc7('0x2c')][_0x0bc7('0x1b')]);_0x42152d[_0x0bc7('0x1a')]=qs[_0x0bc7('0x1a')](_0x444783[_0x0bc7('0x2c')][_0x0bc7('0x1a')]);}_0x42152d['order']=qs[_0x0bc7('0x35')](_0x444783[_0x0bc7('0x2c')][_0x0bc7('0x35')]);_0x42152d['where']=qs[_0x0bc7('0x2e')](_[_0x0bc7('0x36')](_0x444783[_0x0bc7('0x2c')],_0x432b08['filters']),_0x58a920);if(_0x444783[_0x0bc7('0x2c')][_0x0bc7('0x37')]){_0x42152d[_0x0bc7('0x38')]=_['merge'](_0x42152d[_0x0bc7('0x38')],{'$or':_[_0x0bc7('0x2b')](_0x58a920,function(_0x40b4a0){if(_0x40b4a0['type']!==_0x0bc7('0x39')){var _0x4b7459={};_0x4b7459[_0x40b4a0[_0x0bc7('0x25')]]={'$like':'%'+_0x444783['query'][_0x0bc7('0x37')]+'%'};return _0x4b7459;}})});}_0x42152d=_[_0x0bc7('0x3a')]({},_0x42152d,_0x444783[_0x0bc7('0x3b')]);var _0x1415e4={'where':_0x42152d[_0x0bc7('0x38')]};return db['Migration'][_0x0bc7('0x1d')](_0x1415e4)[_0x0bc7('0x22')](function(_0x5670d6){_0x1ce174[_0x0bc7('0x1d')]=_0x5670d6;if(_0x444783[_0x0bc7('0x2c')][_0x0bc7('0x3c')]){_0x42152d['include']=[{'all':!![]}];}return db[_0x0bc7('0x27')][_0x0bc7('0x3d')](_0x42152d);})[_0x0bc7('0x22')](function(_0x122920){_0x1ce174[_0x0bc7('0x3e')]=_0x122920;return _0x1ce174;})[_0x0bc7('0x22')](respondWithFilteredResult(_0x35c92b,_0x42152d))[_0x0bc7('0x3f')](handleError(_0x35c92b,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 224f9b9..eb485b8 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 _0x7357=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','Migration','migrations'];(function(_0xd4e208,_0x10f34e){var _0x1d5ae3=function(_0x39d514){while(--_0x39d514){_0xd4e208['push'](_0xd4e208['shift']());}};_0x1d5ae3(++_0x10f34e);}(_0x7357,0x18c));var _0x7735=function(_0x14ef59,_0x331571){_0x14ef59=_0x14ef59-0x0;var _0x2cf4c5=_0x7357[_0x14ef59];return _0x2cf4c5;};'use strict';var _=require(_0x7735('0x0'));var util=require(_0x7735('0x1'));var logger=require(_0x7735('0x2'))(_0x7735('0x3'));var moment=require(_0x7735('0x4'));var BPromise=require('bluebird');var rp=require(_0x7735('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7735('0x6'));var config=require(_0x7735('0x7'));var attributes=require('./migration.attributes');module[_0x7735('0x8')]=function(_0x1c81a9,_0x18c90c){return _0x1c81a9[_0x7735('0x9')](_0x7735('0xa'),attributes,{'tableName':_0x7735('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc36c=['bluebird','request-promise','path','./migration.attributes','define','Migration','migrations','../../config/logger','moment'];(function(_0x4def91,_0x8028a9){var _0x1a8431=function(_0x4007d5){while(--_0x4007d5){_0x4def91['push'](_0x4def91['shift']());}};_0x1a8431(++_0x8028a9);}(_0xc36c,0x1a5));var _0xcc36=function(_0x112a88,_0x2fd106){_0x112a88=_0x112a88-0x0;var _0x5f0f56=_0xc36c[_0x112a88];return _0x5f0f56;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcc36('0x0'))('api');var moment=require(_0xcc36('0x1'));var BPromise=require(_0xcc36('0x2'));var rp=require(_0xcc36('0x3'));var fs=require('fs');var path=require(_0xcc36('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcc36('0x5'));module['exports']=function(_0x3d1f49,_0x301ce3){return _0x3d1f49[_0xcc36('0x6')](_0xcc36('0x7'),attributes,{'tableName':_0xcc36('0x8'),'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 1ec7fd3..6022fec 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 _0xa047=['rpc','../../config/environment','jayson/promise','http','then','Migration,\x20%s,\x20%s','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x7c4782,_0x14edc9){var _0x1c5595=function(_0x465e2a){while(--_0x465e2a){_0x7c4782['push'](_0x7c4782['shift']());}};_0x1c5595(++_0x14edc9);}(_0xa047,0x1c5));var _0x7a04=function(_0x37e845,_0x219f9f){_0x37e845=_0x37e845-0x0;var _0x59e55b=_0xa047[_0x37e845];return _0x59e55b;};'use strict';var _=require(_0x7a04('0x0'));var util=require(_0x7a04('0x1'));var moment=require(_0x7a04('0x2'));var BPromise=require(_0x7a04('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a04('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a04('0x5'));var logger=require(_0x7a04('0x6'))(_0x7a04('0x7'));var config=require(_0x7a04('0x8'));var jayson=require(_0x7a04('0x9'));var client=jayson['client'][_0x7a04('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3166ff,_0x1dc89f,_0x5c183c){return new BPromise(function(_0x10d92f,_0x10faf9){return client['request'](_0x3166ff,_0x5c183c)[_0x7a04('0xb')](function(_0xc64317){logger['info'](_0x7a04('0xc'),_0x1dc89f,'request\x20sent');logger['debug'](_0x7a04('0xd'),_0x1dc89f,_0x7a04('0xe'),JSON['stringify'](_0xc64317));if(_0xc64317['error']){if(_0xc64317['error'][_0x7a04('0xf')]===0x1f4){logger[_0x7a04('0x10')](_0x7a04('0xc'),_0x1dc89f,_0xc64317[_0x7a04('0x10')][_0x7a04('0x11')]);return _0x10faf9(_0xc64317[_0x7a04('0x10')][_0x7a04('0x11')]);}logger[_0x7a04('0x10')](_0x7a04('0xc'),_0x1dc89f,_0xc64317['error'][_0x7a04('0x11')]);return _0x10d92f(_0xc64317[_0x7a04('0x10')][_0x7a04('0x11')]);}else{logger[_0x7a04('0x12')](_0x7a04('0xc'),_0x1dc89f,_0x7a04('0xe'));_0x10d92f(_0xc64317['result'][_0x7a04('0x11')]);}})[_0x7a04('0x13')](function(_0x400468){logger['error']('Migration,\x20%s,\x20%s',_0x1dc89f,_0x400468);_0x10faf9(_0x400468);});});} \ No newline at end of file +var _0x2750=['jayson/promise','http','request','then','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2c55b8,_0xf2f1bd){var _0x5b4dbd=function(_0x18bdcb){while(--_0x18bdcb){_0x2c55b8['push'](_0x2c55b8['shift']());}};_0x5b4dbd(++_0xf2f1bd);}(_0x2750,0x13b));var _0x0275=function(_0x3b8e3c,_0x3bbc71){_0x3b8e3c=_0x3b8e3c-0x0;var _0x3a5a25=_0x2750[_0x3b8e3c];return _0x3a5a25;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var moment=require(_0x0275('0x1'));var BPromise=require(_0x0275('0x2'));var rs=require(_0x0275('0x3'));var fs=require('fs');var Redis=require(_0x0275('0x4'));var db=require(_0x0275('0x5'))['db'];var utils=require(_0x0275('0x6'));var logger=require(_0x0275('0x7'))(_0x0275('0x8'));var config=require(_0x0275('0x9'));var jayson=require(_0x0275('0xa'));var client=jayson['client'][_0x0275('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2421fd,_0x2fa0eb,_0x2e4b5c){return new BPromise(function(_0x4dffd1,_0x1f7c4a){return client[_0x0275('0xc')](_0x2421fd,_0x2e4b5c)[_0x0275('0xd')](function(_0x5e0e4a){logger['info'](_0x0275('0xe'),_0x2fa0eb,'request\x20sent');logger[_0x0275('0xf')](_0x0275('0x10'),_0x2fa0eb,_0x0275('0x11'),JSON[_0x0275('0x12')](_0x5e0e4a));if(_0x5e0e4a[_0x0275('0x13')]){if(_0x5e0e4a['error'][_0x0275('0x14')]===0x1f4){logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a['error']['message']);return _0x1f7c4a(_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);}logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);return _0x4dffd1(_0x5e0e4a['error'][_0x0275('0x15')]);}else{logger[_0x0275('0x16')]('Migration,\x20%s,\x20%s',_0x2fa0eb,_0x0275('0x11'));_0x4dffd1(_0x5e0e4a[_0x0275('0x17')]['message']);}})[_0x0275('0x18')](function(_0x31c76b){logger['error']('Migration,\x20%s,\x20%s',_0x2fa0eb,_0x31c76b);_0x1f7c4a(_0x31c76b);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index a9e88dc..b020edf 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 _0x9f37=['exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','get','/:id','isAuthenticated','show','create','update','delete','destroy'];(function(_0x437757,_0x1ae060){var _0x37e514=function(_0x3d914f){while(--_0x3d914f){_0x437757['push'](_0x437757['shift']());}};_0x37e514(++_0x1ae060);}(_0x9f37,0xd1));var _0x79f3=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x9f37[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x79f3('0x0'));var util=require(_0x79f3('0x1'));var path=require('path');var timeout=require(_0x79f3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x79f3('0x3'));var auth=require(_0x79f3('0x4'));var interaction=require(_0x79f3('0x5'));var config=require('../../config/environment');var controller=require(_0x79f3('0x6'));router[_0x79f3('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x79f3('0x7')](_0x79f3('0x8'),auth[_0x79f3('0x9')](),controller[_0x79f3('0xa')]);router['post']('/',auth[_0x79f3('0x9')](),controller[_0x79f3('0xb')]);router['put'](_0x79f3('0x8'),auth[_0x79f3('0x9')](),controller[_0x79f3('0xc')]);router[_0x79f3('0xd')](_0x79f3('0x8'),auth['isAuthenticated'](),controller[_0x79f3('0xe')]);module[_0x79f3('0xf')]=router; \ No newline at end of file +var _0x9802=['../../components/auth/service','../../components/interaction/service','./network.controller','get','/:id','isAuthenticated','post','create','put','update','delete','exports','multer','util','path','express','Router','fs-extra'];(function(_0x350182,_0x2a9feb){var _0x4a0892=function(_0x2c994d){while(--_0x2c994d){_0x350182['push'](_0x350182['shift']());}};_0x4a0892(++_0x2a9feb);}(_0x9802,0xf6));var _0x2980=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9802[_0x21549c];return _0x426cbd;};'use strict';var multer=require(_0x2980('0x0'));var util=require(_0x2980('0x1'));var path=require(_0x2980('0x2'));var timeout=require('connect-timeout');var express=require(_0x2980('0x3'));var router=express[_0x2980('0x4')]();var fs_extra=require(_0x2980('0x5'));var auth=require(_0x2980('0x6'));var interaction=require(_0x2980('0x7'));var config=require('../../config/environment');var controller=require(_0x2980('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2980('0x9')](_0x2980('0xa'),auth[_0x2980('0xb')](),controller['show']);router[_0x2980('0xc')]('/',auth[_0x2980('0xb')](),controller[_0x2980('0xd')]);router[_0x2980('0xe')](_0x2980('0xa'),auth[_0x2980('0xb')](),controller[_0x2980('0xf')]);router[_0x2980('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2980('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 006e497..c51b58b 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 _0xb183=['ENUM','localnet','externip','turn','STRING','sequelize','exports'];(function(_0x506033,_0x7fe3c4){var _0x3d1e67=function(_0x19244c){while(--_0x19244c){_0x506033['push'](_0x506033['shift']());}};_0x3d1e67(++_0x7fe3c4);}(_0xb183,0x1e8));var _0x3b18=function(_0x2f5c6c,_0x5e3539){_0x2f5c6c=_0x2f5c6c-0x0;var _0x1c91a1=_0xb183[_0x2f5c6c];return _0x1c91a1;};'use strict';var Sequelize=require(_0x3b18('0x0'));module[_0x3b18('0x1')]={'type':{'type':Sequelize[_0x3b18('0x2')](_0x3b18('0x3'),_0x3b18('0x4'),'stun',_0x3b18('0x5'))},'value':{'type':Sequelize[_0x3b18('0x6')]},'username':{'type':Sequelize[_0x3b18('0x6')]},'password':{'type':Sequelize[_0x3b18('0x6')]}}; \ No newline at end of file +var _0x30b9=['externip','stun','turn','STRING','sequelize','exports','ENUM','localnet'];(function(_0x5d3274,_0x9f06dc){var _0x3cad0a=function(_0x36864a){while(--_0x36864a){_0x5d3274['push'](_0x5d3274['shift']());}};_0x3cad0a(++_0x9f06dc);}(_0x30b9,0x1b4));var _0x930b=function(_0x40e7cf,_0x387cce){_0x40e7cf=_0x40e7cf-0x0;var _0x4ed4d7=_0x30b9[_0x40e7cf];return _0x4ed4d7;};'use strict';var Sequelize=require(_0x930b('0x0'));module[_0x930b('0x1')]={'type':{'type':Sequelize[_0x930b('0x2')](_0x930b('0x3'),_0x930b('0x4'),_0x930b('0x5'),_0x930b('0x6'))},'value':{'type':Sequelize[_0x930b('0x7')]},'username':{'type':Sequelize[_0x930b('0x7')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 9354417..a9fab3d 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 _0x2bc8=['server/files/templates/stun_multiple.ejs','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','root','server/files/templates/turn_multiple.ejs','utf8','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','toLowerCase','destroy','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','undefined','limit','count','offset','Content-Range','update','sendStatus','stack','name','send','index','Network','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','sort','where','pick','merge','filter','options','then','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','create','body','type','STUN','readFileSync','join'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2bc8,0x166));var _0x82bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bc8[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var path=require(_0x82bc('0x0'));var ejs=require(_0x82bc('0x1'));var fs=require('fs');var _=require(_0x82bc('0x2'));var qs=require(_0x82bc('0x3'));var logger=require(_0x82bc('0x4'))(_0x82bc('0x5'));var config=require('../../config/environment');var db=require(_0x82bc('0x6'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x82bc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x458391,_0x5522e9,_0x478686,_0x3b01f2){return new Promise(function(_0x4f9718,_0x49bcd0){var _0x15b9c8=_0x3b01f2||client;return _0x15b9c8[_0x82bc('0x8')](_0x458391,_0x478686)['then'](function(_0xba8c4b){logger[_0x82bc('0x9')](_0x82bc('0xa'),_0x5522e9,_0x82bc('0xb'));logger[_0x82bc('0xc')](_0x82bc('0xd'),_0x5522e9,_0x82bc('0xb'),JSON[_0x82bc('0xe')](_0xba8c4b));if(_0xba8c4b[_0x82bc('0xf')]){if(_0xba8c4b[_0x82bc('0xf')][_0x82bc('0x10')]===0x1f4){logger[_0x82bc('0xf')](_0x82bc('0xa'),_0x5522e9,_0xba8c4b['error'][_0x82bc('0x11')]);return _0x49bcd0(_0xba8c4b[_0x82bc('0xf')][_0x82bc('0x11')]);}logger[_0x82bc('0xf')](_0x82bc('0xa'),_0x5522e9,_0xba8c4b[_0x82bc('0xf')]['message']);return _0x4f9718(_0xba8c4b['error'][_0x82bc('0x11')]);}else{logger[_0x82bc('0x9')]('Network,\x20%s,\x20%s',_0x5522e9,_0x82bc('0xb'));_0x4f9718(_0xba8c4b[_0x82bc('0x12')]['message']);}})[_0x82bc('0x13')](function(_0x856da9){logger['error'](_0x82bc('0xa'),_0x5522e9,_0x856da9);_0x49bcd0(_0x856da9);});});}function respondWithResult(_0x13c3d7,_0xb48e44){_0xb48e44=_0xb48e44||0xc8;return function(_0x53a9ef){if(_0x53a9ef){return _0x13c3d7[_0x82bc('0x14')](_0xb48e44)[_0x82bc('0x15')](_0x53a9ef);}};}function respondWithFilteredResult(_0x9dd203,_0x4c5d21){return function(_0x1e2729){if(_0x1e2729){var _0x4b7d9b=typeof _0x4c5d21['offset']===_0x82bc('0x16')&&typeof _0x4c5d21[_0x82bc('0x17')]===_0x82bc('0x16');var _0x6573c9=_0x1e2729[_0x82bc('0x18')];var _0x50df49=_0x4b7d9b?0x0:_0x4c5d21['offset'];var _0x145ee6=_0x4b7d9b?_0x1e2729[_0x82bc('0x18')]:_0x4c5d21[_0x82bc('0x19')]+_0x4c5d21['limit'];var _0x344c4d;if(_0x145ee6>=_0x6573c9){_0x145ee6=_0x6573c9;_0x344c4d=0xc8;}else{_0x344c4d=0xce;}_0x9dd203['status'](_0x344c4d);return _0x9dd203['set'](_0x82bc('0x1a'),_0x50df49+'-'+_0x145ee6+'/'+_0x6573c9)['json'](_0x1e2729);}return null;};}function saveUpdates(_0x460688){return function(_0xfd1864){if(_0xfd1864){return _0xfd1864[_0x82bc('0x1b')](_0x460688)['then'](function(_0x15df05){return _0x15df05;});}return null;};}function removeEntity(_0x3c4068){return function(_0x3c9244){if(_0x3c9244){return _0x3c9244['destroy']()['then'](function(){_0x3c4068['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e4806){return function(_0x2eca81){if(!_0x2eca81){_0x3e4806[_0x82bc('0x1c')](0x194);}return _0x2eca81;};}function handleError(_0x35e89b,_0x2f510c){_0x2f510c=_0x2f510c||0x1f4;return function(_0x4aecec){logger[_0x82bc('0xf')](_0x4aecec[_0x82bc('0x1d')]);if(_0x4aecec[_0x82bc('0x1e')]){delete _0x4aecec[_0x82bc('0x1e')];}_0x35e89b['status'](_0x2f510c)[_0x82bc('0x1f')](_0x4aecec);};}exports[_0x82bc('0x20')]=function(_0xc1c907,_0x14d9ad){var _0x278cdf={},_0x2544a2={},_0x5bc7d9={'count':0x0,'rows':[]};var _0x3c61f8=_['map'](db[_0x82bc('0x21')]['rawAttributes'],function(_0xfe19b4){return{'name':_0xfe19b4[_0x82bc('0x22')],'type':_0xfe19b4['type'][_0x82bc('0x23')]};});_0x2544a2[_0x82bc('0x24')]=_[_0x82bc('0x25')](_0x3c61f8,_0x82bc('0x1e'));_0x2544a2[_0x82bc('0x26')]=_[_0x82bc('0x27')](_0xc1c907[_0x82bc('0x26')]);_0x2544a2[_0x82bc('0x28')]=_['intersection'](_0x2544a2[_0x82bc('0x24')],_0x2544a2['query']);_0x278cdf[_0x82bc('0x29')]=_[_0x82bc('0x2a')](_0x2544a2[_0x82bc('0x24')],qs[_0x82bc('0x2b')](_0xc1c907[_0x82bc('0x26')][_0x82bc('0x2b')]));_0x278cdf[_0x82bc('0x29')]=_0x278cdf[_0x82bc('0x29')]['length']?_0x278cdf[_0x82bc('0x29')]:_0x2544a2[_0x82bc('0x24')];if(!_0xc1c907['query'][_0x82bc('0x2c')]('nolimit')){_0x278cdf[_0x82bc('0x17')]=qs[_0x82bc('0x17')](_0xc1c907[_0x82bc('0x26')]['limit']);_0x278cdf['offset']=qs['offset'](_0xc1c907[_0x82bc('0x26')][_0x82bc('0x19')]);}_0x278cdf['order']=qs[_0x82bc('0x2d')](_0xc1c907[_0x82bc('0x26')][_0x82bc('0x2d')]);_0x278cdf[_0x82bc('0x2e')]=qs[_0x82bc('0x28')](_[_0x82bc('0x2f')](_0xc1c907['query'],_0x2544a2[_0x82bc('0x28')]),_0x3c61f8);if(_0xc1c907[_0x82bc('0x26')]['filter']){_0x278cdf[_0x82bc('0x2e')]=_[_0x82bc('0x30')](_0x278cdf[_0x82bc('0x2e')],{'$or':_['map'](_0x3c61f8,function(_0x525c30){if(_0x525c30['type']!=='VIRTUAL'){var _0x38767b={};_0x38767b[_0x525c30['name']]={'$like':'%'+_0xc1c907['query'][_0x82bc('0x31')]+'%'};return _0x38767b;}})});}_0x278cdf=_[_0x82bc('0x30')]({},_0x278cdf,_0xc1c907[_0x82bc('0x32')]);var _0x4d124c={'where':_0x278cdf['where']};return db[_0x82bc('0x21')][_0x82bc('0x18')](_0x4d124c)[_0x82bc('0x33')](function(_0xcb66a2){_0x5bc7d9[_0x82bc('0x18')]=_0xcb66a2;if(_0xc1c907[_0x82bc('0x26')][_0x82bc('0x34')]){_0x278cdf[_0x82bc('0x35')]=[{'all':!![]}];}return db[_0x82bc('0x21')][_0x82bc('0x36')](_0x278cdf);})[_0x82bc('0x33')](function(_0x26fbfb){_0x5bc7d9[_0x82bc('0x37')]=_0x26fbfb;return _0x5bc7d9;})[_0x82bc('0x33')](respondWithFilteredResult(_0x14d9ad,_0x278cdf))[_0x82bc('0x13')](handleError(_0x14d9ad,null));};exports[_0x82bc('0x38')]=function(_0x5c2274,_0x587c43){var _0x3d24fe={'raw':!![],'where':{'id':_0x5c2274[_0x82bc('0x39')]['id']}},_0x5dd0a3={};_0x5dd0a3[_0x82bc('0x24')]=_[_0x82bc('0x27')](db[_0x82bc('0x21')][_0x82bc('0x3a')]);_0x5dd0a3[_0x82bc('0x26')]=_[_0x82bc('0x27')](_0x5c2274[_0x82bc('0x26')]);_0x5dd0a3[_0x82bc('0x28')]=_[_0x82bc('0x2a')](_0x5dd0a3[_0x82bc('0x24')],_0x5dd0a3['query']);_0x3d24fe[_0x82bc('0x29')]=_['intersection'](_0x5dd0a3['model'],qs[_0x82bc('0x2b')](_0x5c2274[_0x82bc('0x26')][_0x82bc('0x2b')]));_0x3d24fe['attributes']=_0x3d24fe[_0x82bc('0x29')][_0x82bc('0x3b')]?_0x3d24fe[_0x82bc('0x29')]:_0x5dd0a3[_0x82bc('0x24')];if(_0x5c2274[_0x82bc('0x26')][_0x82bc('0x34')]){_0x3d24fe['include']=[{'all':!![]}];}_0x3d24fe=_['merge']({},_0x3d24fe,_0x5c2274[_0x82bc('0x32')]);return db[_0x82bc('0x21')][_0x82bc('0x3c')](_0x3d24fe)[_0x82bc('0x33')](handleEntityNotFound(_0x587c43,null))[_0x82bc('0x33')](respondWithResult(_0x587c43,null))[_0x82bc('0x13')](handleError(_0x587c43,null));};exports['create']=function(_0x5b6f05,_0x11138f){var _0x1a6cf2;return db[_0x82bc('0x21')][_0x82bc('0x3d')](_0x5b6f05['body'],{'raw':!![]})[_0x82bc('0x33')](function(_0x5519be){_0x1a6cf2=_0x5519be;return db['Network'][_0x82bc('0x36')]({'where':{'type':_0x5b6f05[_0x82bc('0x3e')][_0x82bc('0x3f')]},'raw':!![]});})[_0x82bc('0x33')](function(_0x7fa9a6){if(_0x1a6cf2[_0x82bc('0x3f')]['toUpperCase']()==_0x82bc('0x40')){var _0x3594ad=fs[_0x82bc('0x41')](path[_0x82bc('0x42')](config['root'],_0x82bc('0x43')),'utf8');var _0x594217=ejs[_0x82bc('0x44')](_0x3594ad,{'networks':_0x7fa9a6||[]});fs['writeFileSync'](_0x82bc('0x45'),_0x594217);return respondWithRpcPromise(_0x82bc('0x46'),_0x82bc('0x3d'),{'module':_0x82bc('0x47')});}else if(_0x1a6cf2['type'][_0x82bc('0x48')]()==_0x82bc('0x49')){var _0x44f291=fs[_0x82bc('0x41')](path[_0x82bc('0x42')](config[_0x82bc('0x4a')],_0x82bc('0x4b')),_0x82bc('0x4c'));var _0x56f8b6=ejs['render'](_0x44f291,{'networks':_0x7fa9a6||[]});fs[_0x82bc('0x4d')](_0x82bc('0x4e'),_0x56f8b6);return respondWithRpcPromise(_0x82bc('0x46'),_0x82bc('0x3d'),{'module':_0x82bc('0x47')});}else{var _0x2866d1=fs[_0x82bc('0x41')](path['join'](config['root'],_0x82bc('0x4f')),_0x82bc('0x4c'));var _0x3d91f3=ejs[_0x82bc('0x44')](_0x2866d1,{'networks':_0x7fa9a6||[]});fs['writeFileSync'](util[_0x82bc('0x50')](_0x82bc('0x51'),_0x5b6f05[_0x82bc('0x3e')][_0x82bc('0x3f')]['toLowerCase']()),_0x3d91f3);return respondWithRpcPromise(_0x82bc('0x46'),_0x82bc('0x3d'),{'module':_0x82bc('0x52')});}})[_0x82bc('0x33')](function(){return _0x1a6cf2;})[_0x82bc('0x33')](respondWithResult(_0x11138f,0xc9))[_0x82bc('0x13')](handleError(_0x11138f,null));};exports[_0x82bc('0x1b')]=function(_0x364a33,_0x340cbd){var _0x31d623;return db[_0x82bc('0x21')][_0x82bc('0x3c')]({'where':{'id':_0x364a33[_0x82bc('0x39')]['id']}})[_0x82bc('0x33')](handleEntityNotFound(_0x340cbd,null))['then'](saveUpdates(_0x364a33['body'],null))[_0x82bc('0x33')](function(_0x3e2bab){if(_0x3e2bab){_0x31d623=_0x3e2bab;return db[_0x82bc('0x21')][_0x82bc('0x36')]({'where':{'type':_0x31d623[_0x82bc('0x3f')]},'raw':!![]});}return null;})['then'](function(_0x126614){if(_0x31d623['type'][_0x82bc('0x48')]()==_0x82bc('0x40')){var _0x5071bb=fs[_0x82bc('0x41')](path[_0x82bc('0x42')](config[_0x82bc('0x4a')],_0x82bc('0x43')),'utf8');var _0x259fa5=ejs[_0x82bc('0x44')](_0x5071bb,{'networks':_0x126614||[]});fs[_0x82bc('0x4d')]('/etc/asterisk/stun_xcally.conf',_0x259fa5);return respondWithRpcPromise(_0x82bc('0x46'),'update',{'module':_0x82bc('0x47')});}else if(_0x31d623[_0x82bc('0x3f')]['toUpperCase']()=='TURN'){var _0x29c83a=fs['readFileSync'](path['join'](config[_0x82bc('0x4a')],'server/files/templates/turn_multiple.ejs'),_0x82bc('0x4c'));var _0x147a37=ejs[_0x82bc('0x44')](_0x29c83a,{'networks':_0x126614||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x147a37);return respondWithRpcPromise(_0x82bc('0x46'),_0x82bc('0x1b'),{'module':_0x82bc('0x47')});}else{var _0x359db6=fs['readFileSync'](path[_0x82bc('0x42')](config[_0x82bc('0x4a')],'server/files/templates/network.ejs'),_0x82bc('0x4c'));var _0x35b18f=ejs[_0x82bc('0x44')](_0x359db6,{'networks':_0x126614||[]});fs['writeFileSync'](util[_0x82bc('0x50')](_0x82bc('0x51'),_0x364a33[_0x82bc('0x3e')][_0x82bc('0x3f')][_0x82bc('0x53')]()),_0x35b18f);return respondWithRpcPromise(_0x82bc('0x46'),'update',{'module':'chan_sip.so'});}})['then'](function(_0x6d4d67){if(_0x6d4d67){return _0x31d623;}return null;})[_0x82bc('0x33')](respondWithResult(_0x340cbd,null))[_0x82bc('0x13')](handleError(_0x340cbd,null));};exports['destroy']=function(_0x371820,_0x19193d){var _0x17851e;return db[_0x82bc('0x21')][_0x82bc('0x3c')]({'where':{'id':_0x371820[_0x82bc('0x39')]['id']}})[_0x82bc('0x33')](function(_0x168531){_0x17851e=_0x168531;return _0x168531;})['then'](handleEntityNotFound(_0x19193d,null))[_0x82bc('0x33')](removeEntity(_0x19193d,null))[_0x82bc('0x33')](function(){if(_0x17851e){return db[_0x82bc('0x21')][_0x82bc('0x36')]({'where':{'type':_0x17851e[_0x82bc('0x3f')]},'raw':!![]});}})['then'](function(_0x26c366){if(_0x17851e['type'][_0x82bc('0x48')]()==_0x82bc('0x40')){var _0x2bb8ac=fs[_0x82bc('0x41')](path[_0x82bc('0x42')](config[_0x82bc('0x4a')],_0x82bc('0x43')),_0x82bc('0x4c'));var _0x1fc1f3=ejs[_0x82bc('0x44')](_0x2bb8ac,{'networks':_0x26c366||[]});fs[_0x82bc('0x4d')](_0x82bc('0x45'),_0x1fc1f3);return respondWithRpcPromise(_0x82bc('0x46'),'destroy',{'module':_0x82bc('0x47')});}else if(_0x17851e[_0x82bc('0x3f')][_0x82bc('0x48')]()==_0x82bc('0x49')){var _0x5845ab=fs['readFileSync'](path[_0x82bc('0x42')](config[_0x82bc('0x4a')],_0x82bc('0x4b')),_0x82bc('0x4c'));var _0x14f63b=ejs[_0x82bc('0x44')](_0x5845ab,{'networks':_0x26c366||[]});fs['writeFileSync'](_0x82bc('0x4e'),_0x14f63b);return respondWithRpcPromise(_0x82bc('0x46'),_0x82bc('0x54'),{'module':_0x82bc('0x47')});}else{var _0x4dd81e=fs[_0x82bc('0x41')](path[_0x82bc('0x42')](config[_0x82bc('0x4a')],_0x82bc('0x4f')),_0x82bc('0x4c'));var _0x2b278e=ejs[_0x82bc('0x44')](_0x4dd81e,{'networks':_0x26c366||[]});fs[_0x82bc('0x4d')](util['format'](_0x82bc('0x51'),_0x17851e['type'][_0x82bc('0x53')]()),_0x2b278e);return respondWithRpcPromise(_0x82bc('0x46'),'destroy',{'module':_0x82bc('0x52')});}})['catch'](handleError(_0x19193d,null));}; \ No newline at end of file +var _0x0f7d=['then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','json','offset','undefined','limit','count','set','destroy','end','sendStatus','stack','name','index','map','Network','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','keys','find','create','body','toUpperCase','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','readFileSync','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','toLowerCase','update','STUN','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','params','util','../../config/logger','api','../../config/environment','../../mysqldb','http','request'];(function(_0x39f34f,_0x298f45){var _0x59fee1=function(_0x6ebbb7){while(--_0x6ebbb7){_0x39f34f['push'](_0x39f34f['shift']());}};_0x59fee1(++_0x298f45);}(_0x0f7d,0x9f));var _0xd0f7=function(_0x487ab4,_0x1e24e8){_0x487ab4=_0x487ab4-0x0;var _0x3bef77=_0x0f7d[_0x487ab4];return _0x3bef77;};'use strict';var util=require(_0xd0f7('0x0'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0xd0f7('0x1'))(_0xd0f7('0x2'));var config=require(_0xd0f7('0x3'));var db=require(_0xd0f7('0x4'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xd0f7('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x288901,_0x53811b,_0x295367,_0x48eda6){return new Promise(function(_0xe78766,_0x340047){var _0x1bc279=_0x48eda6||client;return _0x1bc279[_0xd0f7('0x6')](_0x288901,_0x295367)[_0xd0f7('0x7')](function(_0x3372d7){logger['info'](_0xd0f7('0x8'),_0x53811b,_0xd0f7('0x9'));logger[_0xd0f7('0xa')](_0xd0f7('0xb'),_0x53811b,'request\x20sent',JSON['stringify'](_0x3372d7));if(_0x3372d7[_0xd0f7('0xc')]){if(_0x3372d7[_0xd0f7('0xc')][_0xd0f7('0xd')]===0x1f4){logger['error'](_0xd0f7('0x8'),_0x53811b,_0x3372d7['error'][_0xd0f7('0xe')]);return _0x340047(_0x3372d7['error'][_0xd0f7('0xe')]);}logger[_0xd0f7('0xc')](_0xd0f7('0x8'),_0x53811b,_0x3372d7[_0xd0f7('0xc')][_0xd0f7('0xe')]);return _0xe78766(_0x3372d7[_0xd0f7('0xc')][_0xd0f7('0xe')]);}else{logger[_0xd0f7('0xf')](_0xd0f7('0x8'),_0x53811b,_0xd0f7('0x9'));_0xe78766(_0x3372d7[_0xd0f7('0x10')][_0xd0f7('0xe')]);}})[_0xd0f7('0x11')](function(_0x56d5c3){logger[_0xd0f7('0xc')](_0xd0f7('0x8'),_0x53811b,_0x56d5c3);_0x340047(_0x56d5c3);});});}function respondWithResult(_0x5ef184,_0x2c51ce){_0x2c51ce=_0x2c51ce||0xc8;return function(_0x15ab52){if(_0x15ab52){return _0x5ef184[_0xd0f7('0x12')](_0x2c51ce)[_0xd0f7('0x13')](_0x15ab52);}};}function respondWithFilteredResult(_0x42ca3e,_0x188061){return function(_0x47e411){if(_0x47e411){var _0x52304b=typeof _0x188061[_0xd0f7('0x14')]===_0xd0f7('0x15')&&typeof _0x188061[_0xd0f7('0x16')]==='undefined';var _0x1f6e17=_0x47e411[_0xd0f7('0x17')];var _0x262590=_0x52304b?0x0:_0x188061[_0xd0f7('0x14')];var _0x19b04b=_0x52304b?_0x47e411[_0xd0f7('0x17')]:_0x188061['offset']+_0x188061['limit'];var _0x92237a;if(_0x19b04b>=_0x1f6e17){_0x19b04b=_0x1f6e17;_0x92237a=0xc8;}else{_0x92237a=0xce;}_0x42ca3e[_0xd0f7('0x12')](_0x92237a);return _0x42ca3e[_0xd0f7('0x18')]('Content-Range',_0x262590+'-'+_0x19b04b+'/'+_0x1f6e17)[_0xd0f7('0x13')](_0x47e411);}return null;};}function saveUpdates(_0x4767b7){return function(_0x4a96f1){if(_0x4a96f1){return _0x4a96f1['update'](_0x4767b7)['then'](function(_0x2ccfc0){return _0x2ccfc0;});}return null;};}function removeEntity(_0x1b8d2d){return function(_0x2f525c){if(_0x2f525c){return _0x2f525c[_0xd0f7('0x19')]()['then'](function(){_0x1b8d2d[_0xd0f7('0x12')](0xcc)[_0xd0f7('0x1a')]();});}};}function handleEntityNotFound(_0x505f70){return function(_0x1788cd){if(!_0x1788cd){_0x505f70[_0xd0f7('0x1b')](0x194);}return _0x1788cd;};}function handleError(_0x1a05c8,_0x23d111){_0x23d111=_0x23d111||0x1f4;return function(_0x52c5c2){logger[_0xd0f7('0xc')](_0x52c5c2[_0xd0f7('0x1c')]);if(_0x52c5c2[_0xd0f7('0x1d')]){delete _0x52c5c2[_0xd0f7('0x1d')];}_0x1a05c8[_0xd0f7('0x12')](_0x23d111)['send'](_0x52c5c2);};}exports[_0xd0f7('0x1e')]=function(_0x45b1de,_0x31a91c){var _0x3147b8={},_0x33f0ea={},_0x509c61={'count':0x0,'rows':[]};var _0x2e2370=_[_0xd0f7('0x1f')](db[_0xd0f7('0x20')][_0xd0f7('0x21')],function(_0x301522){return{'name':_0x301522[_0xd0f7('0x22')],'type':_0x301522[_0xd0f7('0x23')][_0xd0f7('0x24')]};});_0x33f0ea[_0xd0f7('0x25')]=_[_0xd0f7('0x1f')](_0x2e2370,'name');_0x33f0ea['query']=_['keys'](_0x45b1de[_0xd0f7('0x26')]);_0x33f0ea[_0xd0f7('0x27')]=_[_0xd0f7('0x28')](_0x33f0ea[_0xd0f7('0x25')],_0x33f0ea[_0xd0f7('0x26')]);_0x3147b8[_0xd0f7('0x29')]=_[_0xd0f7('0x28')](_0x33f0ea[_0xd0f7('0x25')],qs[_0xd0f7('0x2a')](_0x45b1de[_0xd0f7('0x26')][_0xd0f7('0x2a')]));_0x3147b8[_0xd0f7('0x29')]=_0x3147b8[_0xd0f7('0x29')][_0xd0f7('0x2b')]?_0x3147b8[_0xd0f7('0x29')]:_0x33f0ea['model'];if(!_0x45b1de['query'][_0xd0f7('0x2c')](_0xd0f7('0x2d'))){_0x3147b8['limit']=qs[_0xd0f7('0x16')](_0x45b1de[_0xd0f7('0x26')][_0xd0f7('0x16')]);_0x3147b8[_0xd0f7('0x14')]=qs[_0xd0f7('0x14')](_0x45b1de[_0xd0f7('0x26')][_0xd0f7('0x14')]);}_0x3147b8[_0xd0f7('0x2e')]=qs[_0xd0f7('0x2f')](_0x45b1de[_0xd0f7('0x26')][_0xd0f7('0x2f')]);_0x3147b8[_0xd0f7('0x30')]=qs[_0xd0f7('0x27')](_[_0xd0f7('0x31')](_0x45b1de[_0xd0f7('0x26')],_0x33f0ea[_0xd0f7('0x27')]),_0x2e2370);if(_0x45b1de[_0xd0f7('0x26')][_0xd0f7('0x32')]){_0x3147b8[_0xd0f7('0x30')]=_[_0xd0f7('0x33')](_0x3147b8[_0xd0f7('0x30')],{'$or':_[_0xd0f7('0x1f')](_0x2e2370,function(_0x3cb02f){if(_0x3cb02f[_0xd0f7('0x23')]!==_0xd0f7('0x34')){var _0x1dd1c8={};_0x1dd1c8[_0x3cb02f[_0xd0f7('0x1d')]]={'$like':'%'+_0x45b1de[_0xd0f7('0x26')][_0xd0f7('0x32')]+'%'};return _0x1dd1c8;}})});}_0x3147b8=_[_0xd0f7('0x33')]({},_0x3147b8,_0x45b1de[_0xd0f7('0x35')]);var _0x352022={'where':_0x3147b8[_0xd0f7('0x30')]};return db[_0xd0f7('0x20')][_0xd0f7('0x17')](_0x352022)[_0xd0f7('0x7')](function(_0x209207){_0x509c61[_0xd0f7('0x17')]=_0x209207;if(_0x45b1de[_0xd0f7('0x26')][_0xd0f7('0x36')]){_0x3147b8['include']=[{'all':!![]}];}return db[_0xd0f7('0x20')][_0xd0f7('0x37')](_0x3147b8);})[_0xd0f7('0x7')](function(_0x1e7b57){_0x509c61[_0xd0f7('0x38')]=_0x1e7b57;return _0x509c61;})['then'](respondWithFilteredResult(_0x31a91c,_0x3147b8))[_0xd0f7('0x11')](handleError(_0x31a91c,null));};exports['show']=function(_0x5b4ec9,_0xc98b6f){var _0x239190={'raw':!![],'where':{'id':_0x5b4ec9['params']['id']}},_0x57f43d={};_0x57f43d['model']=_[_0xd0f7('0x39')](db['Network'][_0xd0f7('0x21')]);_0x57f43d['query']=_[_0xd0f7('0x39')](_0x5b4ec9['query']);_0x57f43d[_0xd0f7('0x27')]=_[_0xd0f7('0x28')](_0x57f43d[_0xd0f7('0x25')],_0x57f43d[_0xd0f7('0x26')]);_0x239190[_0xd0f7('0x29')]=_['intersection'](_0x57f43d[_0xd0f7('0x25')],qs['fields'](_0x5b4ec9['query'][_0xd0f7('0x2a')]));_0x239190[_0xd0f7('0x29')]=_0x239190[_0xd0f7('0x29')]['length']?_0x239190[_0xd0f7('0x29')]:_0x57f43d[_0xd0f7('0x25')];if(_0x5b4ec9[_0xd0f7('0x26')]['includeAll']){_0x239190['include']=[{'all':!![]}];}_0x239190=_[_0xd0f7('0x33')]({},_0x239190,_0x5b4ec9[_0xd0f7('0x35')]);return db['Network'][_0xd0f7('0x3a')](_0x239190)['then'](handleEntityNotFound(_0xc98b6f,null))['then'](respondWithResult(_0xc98b6f,null))[_0xd0f7('0x11')](handleError(_0xc98b6f,null));};exports[_0xd0f7('0x3b')]=function(_0x3512f6,_0x18f939){var _0x5bedac;return db[_0xd0f7('0x20')][_0xd0f7('0x3b')](_0x3512f6['body'],{'raw':!![]})[_0xd0f7('0x7')](function(_0x3b19a4){_0x5bedac=_0x3b19a4;return db['Network'][_0xd0f7('0x37')]({'where':{'type':_0x3512f6[_0xd0f7('0x3c')][_0xd0f7('0x23')]},'raw':!![]});})[_0xd0f7('0x7')](function(_0x5e7c50){if(_0x5bedac['type'][_0xd0f7('0x3d')]()=='STUN'){var _0x13a77e=fs['readFileSync'](path[_0xd0f7('0x3e')](config[_0xd0f7('0x3f')],_0xd0f7('0x40')),_0xd0f7('0x41'));var _0xaaffc0=ejs[_0xd0f7('0x42')](_0x13a77e,{'networks':_0x5e7c50||[]});fs[_0xd0f7('0x43')](_0xd0f7('0x44'),_0xaaffc0);return respondWithRpcPromise(_0xd0f7('0x45'),_0xd0f7('0x3b'),{'module':_0xd0f7('0x46')});}else if(_0x5bedac[_0xd0f7('0x23')]['toUpperCase']()==_0xd0f7('0x47')){var _0x40284d=fs[_0xd0f7('0x48')](path['join'](config[_0xd0f7('0x3f')],_0xd0f7('0x49')),_0xd0f7('0x41'));var _0x1a7909=ejs['render'](_0x40284d,{'networks':_0x5e7c50||[]});fs[_0xd0f7('0x43')](_0xd0f7('0x4a'),_0x1a7909);return respondWithRpcPromise(_0xd0f7('0x45'),_0xd0f7('0x3b'),{'module':_0xd0f7('0x46')});}else{var _0x4f36be=fs[_0xd0f7('0x48')](path[_0xd0f7('0x3e')](config[_0xd0f7('0x3f')],_0xd0f7('0x4b')),'utf8');var _0x2527cd=ejs['render'](_0x4f36be,{'networks':_0x5e7c50||[]});fs[_0xd0f7('0x43')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x3512f6[_0xd0f7('0x3c')]['type'][_0xd0f7('0x4c')]()),_0x2527cd);return respondWithRpcPromise(_0xd0f7('0x45'),_0xd0f7('0x3b'),{'module':'chan_sip.so'});}})[_0xd0f7('0x7')](function(){return _0x5bedac;})[_0xd0f7('0x7')](respondWithResult(_0x18f939,0xc9))[_0xd0f7('0x11')](handleError(_0x18f939,null));};exports[_0xd0f7('0x4d')]=function(_0x457516,_0x41c6f5){var _0x32258f;return db[_0xd0f7('0x20')]['find']({'where':{'id':_0x457516['params']['id']}})['then'](handleEntityNotFound(_0x41c6f5,null))[_0xd0f7('0x7')](saveUpdates(_0x457516[_0xd0f7('0x3c')],null))[_0xd0f7('0x7')](function(_0x4e9435){if(_0x4e9435){_0x32258f=_0x4e9435;return db[_0xd0f7('0x20')]['findAll']({'where':{'type':_0x32258f['type']},'raw':!![]});}return null;})[_0xd0f7('0x7')](function(_0x61113e){if(_0x32258f['type'][_0xd0f7('0x3d')]()==_0xd0f7('0x4e')){var _0x11c14b=fs[_0xd0f7('0x48')](path['join'](config[_0xd0f7('0x3f')],_0xd0f7('0x40')),_0xd0f7('0x41'));var _0x1175ca=ejs[_0xd0f7('0x42')](_0x11c14b,{'networks':_0x61113e||[]});fs[_0xd0f7('0x43')]('/etc/asterisk/stun_xcally.conf',_0x1175ca);return respondWithRpcPromise(_0xd0f7('0x45'),_0xd0f7('0x4d'),{'module':_0xd0f7('0x46')});}else if(_0x32258f[_0xd0f7('0x23')][_0xd0f7('0x3d')]()==_0xd0f7('0x47')){var _0x441433=fs[_0xd0f7('0x48')](path[_0xd0f7('0x3e')](config[_0xd0f7('0x3f')],_0xd0f7('0x49')),_0xd0f7('0x41'));var _0x18e36f=ejs['render'](_0x441433,{'networks':_0x61113e||[]});fs[_0xd0f7('0x43')](_0xd0f7('0x4a'),_0x18e36f);return respondWithRpcPromise('Reload',_0xd0f7('0x4d'),{'module':_0xd0f7('0x46')});}else{var _0x11fa95=fs['readFileSync'](path[_0xd0f7('0x3e')](config[_0xd0f7('0x3f')],_0xd0f7('0x4b')),_0xd0f7('0x41'));var _0x223d6c=ejs[_0xd0f7('0x42')](_0x11fa95,{'networks':_0x61113e||[]});fs[_0xd0f7('0x43')](util[_0xd0f7('0x4f')](_0xd0f7('0x50'),_0x457516['body'][_0xd0f7('0x23')][_0xd0f7('0x4c')]()),_0x223d6c);return respondWithRpcPromise(_0xd0f7('0x45'),_0xd0f7('0x4d'),{'module':_0xd0f7('0x51')});}})[_0xd0f7('0x7')](function(_0x2e102e){if(_0x2e102e){return _0x32258f;}return null;})[_0xd0f7('0x7')](respondWithResult(_0x41c6f5,null))[_0xd0f7('0x11')](handleError(_0x41c6f5,null));};exports[_0xd0f7('0x19')]=function(_0x5ef24a,_0x1467c8){var _0x98d95b;return db['Network']['find']({'where':{'id':_0x5ef24a[_0xd0f7('0x52')]['id']}})[_0xd0f7('0x7')](function(_0x435b9e){_0x98d95b=_0x435b9e;return _0x435b9e;})[_0xd0f7('0x7')](handleEntityNotFound(_0x1467c8,null))[_0xd0f7('0x7')](removeEntity(_0x1467c8,null))[_0xd0f7('0x7')](function(){if(_0x98d95b){return db[_0xd0f7('0x20')][_0xd0f7('0x37')]({'where':{'type':_0x98d95b[_0xd0f7('0x23')]},'raw':!![]});}})[_0xd0f7('0x7')](function(_0x108e5d){if(_0x98d95b[_0xd0f7('0x23')][_0xd0f7('0x3d')]()==_0xd0f7('0x4e')){var _0x5cda22=fs[_0xd0f7('0x48')](path[_0xd0f7('0x3e')](config['root'],_0xd0f7('0x40')),_0xd0f7('0x41'));var _0x2583de=ejs[_0xd0f7('0x42')](_0x5cda22,{'networks':_0x108e5d||[]});fs[_0xd0f7('0x43')](_0xd0f7('0x44'),_0x2583de);return respondWithRpcPromise(_0xd0f7('0x45'),_0xd0f7('0x19'),{'module':'res_stun_monitor.so'});}else if(_0x98d95b['type'][_0xd0f7('0x3d')]()==_0xd0f7('0x47')){var _0x1c3227=fs[_0xd0f7('0x48')](path[_0xd0f7('0x3e')](config[_0xd0f7('0x3f')],_0xd0f7('0x49')),_0xd0f7('0x41'));var _0x58d9de=ejs[_0xd0f7('0x42')](_0x1c3227,{'networks':_0x108e5d||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x58d9de);return respondWithRpcPromise(_0xd0f7('0x45'),_0xd0f7('0x19'),{'module':_0xd0f7('0x46')});}else{var _0x234f6b=fs['readFileSync'](path[_0xd0f7('0x3e')](config[_0xd0f7('0x3f')],'server/files/templates/network.ejs'),'utf8');var _0x5f4f16=ejs[_0xd0f7('0x42')](_0x234f6b,{'networks':_0x108e5d||[]});fs['writeFileSync'](util[_0xd0f7('0x4f')](_0xd0f7('0x50'),_0x98d95b[_0xd0f7('0x23')][_0xd0f7('0x4c')]()),_0x5f4f16);return respondWithRpcPromise(_0xd0f7('0x45'),_0xd0f7('0x19'),{'module':_0xd0f7('0x51')});}})[_0xd0f7('0x11')](handleError(_0x1467c8,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 13a8da5..4cda8f5 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 _0xe644=['path','rimraf','../../config/environment','./network.attributes','exports','define','Network','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x12a7a3,_0x3a2bbb){var _0x335ac1=function(_0x422377){while(--_0x422377){_0x12a7a3['push'](_0x12a7a3['shift']());}};_0x335ac1(++_0x3a2bbb);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4e64('0x0'));var util=require(_0x4e64('0x1'));var logger=require(_0x4e64('0x2'))(_0x4e64('0x3'));var moment=require(_0x4e64('0x4'));var BPromise=require(_0x4e64('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e64('0x6'));var rimraf=require(_0x4e64('0x7'));var config=require(_0x4e64('0x8'));var attributes=require(_0x4e64('0x9'));module[_0x4e64('0xa')]=function(_0x13fa90,_0x55c23b){return _0x13fa90[_0x4e64('0xb')](_0x4e64('0xc'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcea2=['../../config/environment','./network.attributes','define','Network','network','lodash','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x23925d,_0x1ad3cd){var _0x304939=function(_0x332c4e){while(--_0x332c4e){_0x23925d['push'](_0x23925d['shift']());}};_0x304939(++_0x1ad3cd);}(_0xcea2,0x15a));var _0x2cea=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xcea2[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x2cea('0x0'));var util=require('util');var logger=require(_0x2cea('0x1'))('api');var moment=require(_0x2cea('0x2'));var BPromise=require(_0x2cea('0x3'));var rp=require(_0x2cea('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2cea('0x5'));var config=require(_0x2cea('0x6'));var attributes=require(_0x2cea('0x7'));module['exports']=function(_0x34f0f2,_0x485c26){return _0x34f0f2[_0x2cea('0x8')](_0x2cea('0x9'),attributes,{'tableName':_0x2cea('0xa'),'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 f0d1602..97b3d56 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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x84bb3f,_0x5a8e7f){_0x84bb3f=_0x84bb3f-0x0;var _0x1c2a91=_0x7a54[_0x84bb3f];return _0x1c2a91;};'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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xbec931,_0x1b3548){var _0x567d72=function(_0x2e92a9){while(--_0x2e92a9){_0xbec931['push'](_0xbec931['shift']());}};_0x567d72(++_0x1b3548);}(_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 db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index ba0f652..4950290 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 _0x5204=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','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','addAnswer','/:id/notify','notify','addApplications','put','delete','removeDispositions','removeAnswers','removeAgents'];(function(_0x1438c4,_0x1a8cd6){var _0x30050e=function(_0x5cc971){while(--_0x5cc971){_0x1438c4['push'](_0x1438c4['shift']());}};_0x30050e(++_0x1a8cd6);}(_0x5204,0xdf));var _0x4520=function(_0x17882c,_0x4b964b){_0x17882c=_0x17882c-0x0;var _0x355a59=_0x5204[_0x17882c];return _0x355a59;};'use strict';var multer=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var path=require('path');var timeout=require(_0x4520('0x2'));var express=require(_0x4520('0x3'));var router=express[_0x4520('0x4')]();var fs_extra=require(_0x4520('0x5'));var auth=require(_0x4520('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4520('0x7'));var controller=require('./openchannelAccount.controller');router[_0x4520('0x8')]('/',auth[_0x4520('0x9')](),controller[_0x4520('0xa')]);router[_0x4520('0x8')](_0x4520('0xb'),auth[_0x4520('0x9')](),controller[_0x4520('0xc')]);router['get'](_0x4520('0xd'),auth['isAuthenticated'](),controller[_0x4520('0xe')]);router[_0x4520('0x8')](_0x4520('0xf'),auth[_0x4520('0x9')](),controller[_0x4520('0x10')]);router[_0x4520('0x8')](_0x4520('0x11'),auth[_0x4520('0x9')](),controller[_0x4520('0x12')]);router[_0x4520('0x8')](_0x4520('0x13'),auth[_0x4520('0x9')](),controller[_0x4520('0x14')]);router[_0x4520('0x8')](_0x4520('0x15'),auth[_0x4520('0x9')](),controller[_0x4520('0x16')]);router[_0x4520('0x8')](_0x4520('0x17'),auth[_0x4520('0x9')](),controller[_0x4520('0x18')]);router['post']('/',auth[_0x4520('0x9')](),controller[_0x4520('0x19')]);router[_0x4520('0x1a')](_0x4520('0xf'),auth[_0x4520('0x9')](),controller['addDisposition']);router[_0x4520('0x1a')](_0x4520('0x11'),auth[_0x4520('0x9')](),controller[_0x4520('0x1b')]);router[_0x4520('0x1a')](_0x4520('0x1c'),controller[_0x4520('0x1d')]);router[_0x4520('0x1a')](_0x4520('0x13'),auth[_0x4520('0x9')](),controller[_0x4520('0x1e')]);router[_0x4520('0x1a')]('/:id/users',auth[_0x4520('0x9')](),controller['addAgents']);router['post']('/:id/send',auth[_0x4520('0x9')](),controller['send']);router[_0x4520('0x1f')](_0x4520('0xd'),auth[_0x4520('0x9')](),controller['update']);router[_0x4520('0x20')](_0x4520('0xd'),auth[_0x4520('0x9')](),controller['destroy']);router[_0x4520('0x20')](_0x4520('0xf'),auth[_0x4520('0x9')](),controller[_0x4520('0x21')]);router[_0x4520('0x20')]('/:id/canned_answers',auth[_0x4520('0x9')](),controller[_0x4520('0x22')]);router[_0x4520('0x20')](_0x4520('0x17'),auth['isAuthenticated'](),controller[_0x4520('0x23')]);module[_0x4520('0x24')]=router; \ No newline at end of file +var _0xdd4f=['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','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2b0d88,_0x5b5ef2){var _0x1c9256=function(_0x1ea041){while(--_0x1ea041){_0x2b0d88['push'](_0x2b0d88['shift']());}};_0x1c9256(++_0x5b5ef2);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x26e15e,_0x3beab6){_0x26e15e=_0x26e15e-0x0;var _0x2c40ca=_0xdd4f[_0x26e15e];return _0x2c40ca;};'use strict';var multer=require(_0xfdd4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfdd4('0x1'));var router=express[_0xfdd4('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfdd4('0x3'));var interaction=require(_0xfdd4('0x4'));var config=require(_0xfdd4('0x5'));var controller=require('./openchannelAccount.controller');router[_0xfdd4('0x6')]('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x8')]);router[_0xfdd4('0x6')](_0xfdd4('0x9'),auth['isAuthenticated'](),controller[_0xfdd4('0xa')]);router['get'](_0xfdd4('0xb'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0xc')]);router['get'](_0xfdd4('0xd'),auth['isAuthenticated'](),controller[_0xfdd4('0xe')]);router[_0xfdd4('0x6')](_0xfdd4('0xf'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x10')]);router[_0xfdd4('0x6')](_0xfdd4('0x11'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x12')]);router[_0xfdd4('0x6')](_0xfdd4('0x13'),auth['isAuthenticated'](),controller[_0xfdd4('0x14')]);router[_0xfdd4('0x6')](_0xfdd4('0x15'),auth['isAuthenticated'](),controller[_0xfdd4('0x16')]);router['post']('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x17')]);router[_0xfdd4('0x18')](_0xfdd4('0xd'),auth[_0xfdd4('0x7')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x19')]);router[_0xfdd4('0x18')](_0xfdd4('0x1a'),controller[_0xfdd4('0x1b')]);router[_0xfdd4('0x18')](_0xfdd4('0x11'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x1c')]);router['post'](_0xfdd4('0x15'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x1d')]);router[_0xfdd4('0x18')](_0xfdd4('0x1e'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x1f')]);router[_0xfdd4('0x20')]('/:id',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x21')]);router[_0xfdd4('0x22')](_0xfdd4('0xb'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x23')]);router[_0xfdd4('0x22')](_0xfdd4('0xd'),auth['isAuthenticated'](),controller[_0xfdd4('0x24')]);router[_0xfdd4('0x22')](_0xfdd4('0xf'),auth['isAuthenticated'](),controller[_0xfdd4('0x25')]);router[_0xfdd4('0x22')](_0xfdd4('0x15'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x26')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index cb4210d..502ebfb 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 _0x3599=['generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','randomstring','exports','STRING','name'];(function(_0x2234a9,_0x468140){var _0x1410e2=function(_0x24b2f2){while(--_0x24b2f2){_0x2234a9['push'](_0x2234a9['shift']());}};_0x1410e2(++_0x468140);}(_0x3599,0x1eb));var _0x9359=function(_0x10cc8d,_0x1a423a){_0x10cc8d=_0x10cc8d-0x0;var _0x1af106=_0x3599[_0x10cc8d];return _0x1af106;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x9359('0x0'));module[_0x9359('0x1')]={'name':{'type':Sequelize[_0x9359('0x2')],'unique':_0x9359('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9359('0x2')]},'token':{'type':Sequelize[_0x9359('0x2')],'defaultValue':function(){return rs[_0x9359('0x4')]();}},'replyUri':{'type':Sequelize[_0x9359('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9359('0x5');}},'notificationSound':{'type':Sequelize[_0x9359('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9359('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9359('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9359('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x9359('0x2')]},'queueTransfer':{'type':Sequelize[_0x9359('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9359('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9359('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x9359('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x9359('0x6')],'defaultValue':![],'comment':_0x9359('0x9'),'set':function(_0x4a02e4){if(!_0x4a02e4)this[_0x9359('0xa')]('mandatoryDispositionPauseId',null);this[_0x9359('0xa')]('mandatoryDisposition',_0x4a02e4);}}}; \ No newline at end of file +var _0x9bf2=['STRING','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','randomstring','exports','name','generate'];(function(_0x3c8fec,_0x545f6f){var _0x5ca6cf=function(_0x1e7e66){while(--_0x1e7e66){_0x3c8fec['push'](_0x3c8fec['shift']());}};_0x5ca6cf(++_0x545f6f);}(_0x9bf2,0x1a8));var _0x29bf=function(_0x1f0477,_0x1d169b){_0x1f0477=_0x1f0477-0x0;var _0x589ffc=_0x9bf2[_0x1f0477];return _0x589ffc;};'use strict';var Sequelize=require(_0x29bf('0x0'));var rs=require(_0x29bf('0x1'));module[_0x29bf('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x29bf('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x29bf('0x4')]();}},'replyUri':{'type':Sequelize[_0x29bf('0x5')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x29bf('0x5')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x29bf('0x6')],'defaultValue':function(){return _0x29bf('0x7');}},'notificationSound':{'type':Sequelize[_0x29bf('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x29bf('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x29bf('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x29bf('0x5')]},'queueTransfer':{'type':Sequelize[_0x29bf('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x29bf('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x29bf('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x29bf('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0x29bf('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x29bf('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x173a1c){if(!_0x173a1c)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x29bf('0xb')](_0x29bf('0xc'),_0x173a1c);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index a1424d3..5aa92e5 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 _0xef66=['removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','CmContact','difference','createdAt','updatedAt','CompanyId','isNil','from','Sequelize','ValidationError','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','OpenchannelApplication','Applications','List','account','list','orderBy','applications','priority','asc','ListId','contact','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','push','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','*,*,*,*','Start','startRouting','EventManager','notify','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','UserProfileResource','then','name','send','index','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','OpenchannelAccounts','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Pause','describe','addDisposition','OpenchannelAccountId','Disposition','findOne','map'];(function(_0xcf0d77,_0x2195aa){var _0x13b05f=function(_0x2e798b){while(--_0x2e798b){_0xcf0d77['push'](_0xcf0d77['shift']());}};_0x13b05f(++_0x2195aa);}(_0xef66,0x1db));var _0x6ef6=function(_0x4fd311,_0x29decd){_0x4fd311=_0x4fd311-0x0;var _0x281e83=_0xef66[_0x4fd311];return _0x281e83;};'use strict';var emlformat=require(_0x6ef6('0x0'));var rimraf=require(_0x6ef6('0x1'));var zipdir=require(_0x6ef6('0x2'));var jsonpatch=require(_0x6ef6('0x3'));var rp=require(_0x6ef6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6ef6('0x5'));var util=require(_0x6ef6('0x6'));var path=require(_0x6ef6('0x7'));var sox=require(_0x6ef6('0x8'));var csv=require(_0x6ef6('0x9'));var ejs=require(_0x6ef6('0xa'));var fs=require('fs');var fs_extra=require(_0x6ef6('0xb'));var _=require(_0x6ef6('0xc'));var squel=require(_0x6ef6('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6ef6('0xe'));var toCsv=require(_0x6ef6('0x9'));var querystring=require(_0x6ef6('0xf'));var Papa=require(_0x6ef6('0x10'));var Redis=require(_0x6ef6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6ef6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ef6('0x13'))('api');var utils=require(_0x6ef6('0x14'));var config=require(_0x6ef6('0x15'));var licenseUtil=require(_0x6ef6('0x16'));var db=require(_0x6ef6('0x17'))['db'];config['redis']=_[_0x6ef6('0x18')](config[_0x6ef6('0x19')],{'host':_0x6ef6('0x1a'),'port':0x18eb});var socket=require(_0x6ef6('0x1b'))(new Redis(config['redis']));require(_0x6ef6('0x1c'))['register'](socket);var jayson=require(_0x6ef6('0x1d'));var client=jayson[_0x6ef6('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x6ef6('0x1e')][_0x6ef6('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x453aa3,_0x3f0a84,_0x3fa688,_0x2e6eb6){return new BPromise(function(_0x4ea222,_0x30b8e8){var _0x1ed381=_0x2e6eb6||client;return _0x1ed381[_0x6ef6('0x20')](_0x453aa3,_0x3fa688)['then'](function(_0x3fc3d1){logger[_0x6ef6('0x21')](_0x6ef6('0x22'),_0x3f0a84,_0x6ef6('0x23'));logger[_0x6ef6('0x24')](_0x6ef6('0x25'),_0x3f0a84,_0x6ef6('0x23'),JSON['stringify'](_0x3fc3d1));if(_0x3fc3d1[_0x6ef6('0x26')]){if(_0x3fc3d1[_0x6ef6('0x26')][_0x6ef6('0x27')]===0x1f4){logger[_0x6ef6('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x3f0a84,_0x3fc3d1[_0x6ef6('0x26')][_0x6ef6('0x28')]);return _0x30b8e8(_0x3fc3d1[_0x6ef6('0x26')]['message']);}logger[_0x6ef6('0x26')](_0x6ef6('0x22'),_0x3f0a84,_0x3fc3d1['error'][_0x6ef6('0x28')]);return _0x4ea222(_0x3fc3d1[_0x6ef6('0x26')]['message']);}else{logger[_0x6ef6('0x21')](_0x6ef6('0x22'),_0x3f0a84,_0x6ef6('0x23'));_0x4ea222(_0x3fc3d1[_0x6ef6('0x29')][_0x6ef6('0x28')]);}})[_0x6ef6('0x2a')](function(_0x1cd549){logger['error'](_0x6ef6('0x22'),_0x3f0a84,_0x1cd549);_0x30b8e8(_0x1cd549);});});}function respondWithStatusCode(_0x503379,_0x39d3cc){_0x39d3cc=_0x39d3cc||0xcc;return function(_0x692c3d){if(_0x692c3d){return _0x503379[_0x6ef6('0x2b')](_0x39d3cc);}return _0x503379[_0x6ef6('0x2c')](_0x39d3cc)[_0x6ef6('0x2d')]();};}function respondWithResult(_0xf69d3d,_0x23eb77){_0x23eb77=_0x23eb77||0xc8;return function(_0x3e027d){if(_0x3e027d){return _0xf69d3d[_0x6ef6('0x2c')](_0x23eb77)[_0x6ef6('0x2e')](_0x3e027d);}};}function respondWithFilteredResult(_0x136d20,_0x2d87a8){return function(_0x483f4d){if(_0x483f4d){var _0x40f9f6=typeof _0x2d87a8[_0x6ef6('0x2f')]===_0x6ef6('0x30')&&typeof _0x2d87a8[_0x6ef6('0x31')]===_0x6ef6('0x30');var _0x24eeae=_0x483f4d[_0x6ef6('0x32')];var _0x512dda=_0x40f9f6?0x0:_0x2d87a8[_0x6ef6('0x2f')];var _0x5f3179=_0x40f9f6?_0x483f4d[_0x6ef6('0x32')]:_0x2d87a8[_0x6ef6('0x2f')]+_0x2d87a8[_0x6ef6('0x31')];var _0x50c9e4;if(_0x5f3179>=_0x24eeae){_0x5f3179=_0x24eeae;_0x50c9e4=0xc8;}else{_0x50c9e4=0xce;}_0x136d20['status'](_0x50c9e4);return _0x136d20[_0x6ef6('0x33')](_0x6ef6('0x34'),_0x512dda+'-'+_0x5f3179+'/'+_0x24eeae)[_0x6ef6('0x2e')](_0x483f4d);}return null;};}function patchUpdates(_0x47b87b){return function(_0x364d4d){try{jsonpatch['apply'](_0x364d4d,_0x47b87b,!![]);}catch(_0x3cc6a3){return BPromise[_0x6ef6('0x35')](_0x3cc6a3);}return _0x364d4d['save']();};}function saveUpdates(_0x4830bf,_0x31a564){return function(_0x5395a3){if(_0x5395a3){return _0x5395a3[_0x6ef6('0x36')](_0x4830bf)['then'](function(_0x3f0ada){return _0x3f0ada;});}return null;};}function removeEntity(_0x4b8d24,_0x5e132a){return function(_0x72c277){if(_0x72c277){return _0x72c277[_0x6ef6('0x37')]()['then'](function(){var _0x3df4da=_0x72c277['get']({'plain':!![]});var _0xf1aaf2='OpenchannelAccounts';return db[_0x6ef6('0x38')]['destroy']({'where':{'type':_0xf1aaf2,'resourceId':_0x3df4da['id']}})[_0x6ef6('0x39')](function(){return _0x72c277;});})[_0x6ef6('0x39')](function(){_0x4b8d24[_0x6ef6('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x546bc3,_0xf186c1){return function(_0x101427){if(!_0x101427){_0x546bc3[_0x6ef6('0x2b')](0x194);}return _0x101427;};}function handleError(_0x2f3f3e,_0x47b474){_0x47b474=_0x47b474||0x1f4;return function(_0x538757){logger[_0x6ef6('0x26')](_0x538757['stack']);if(_0x538757['name']){delete _0x538757[_0x6ef6('0x3a')];}_0x2f3f3e['status'](_0x47b474)[_0x6ef6('0x3b')](_0x538757);};}exports[_0x6ef6('0x3c')]=function(_0x30649c,_0x31facc){var _0x2828ef={'include':[{'model':db['Pause'],'as':_0x6ef6('0x3d')}]},_0xed6093={},_0x13b3c0={'count':0x0,'rows':[]};var _0x58fed8=_['map'](db[_0x6ef6('0x3e')][_0x6ef6('0x3f')],function(_0x1e4375){return{'name':_0x1e4375['fieldName'],'type':_0x1e4375[_0x6ef6('0x40')][_0x6ef6('0x41')]};});_0xed6093[_0x6ef6('0x42')]=_['map'](_0x58fed8,_0x6ef6('0x3a'));_0xed6093[_0x6ef6('0x43')]=_[_0x6ef6('0x44')](_0x30649c[_0x6ef6('0x43')]);_0xed6093[_0x6ef6('0x45')]=_[_0x6ef6('0x46')](_0xed6093[_0x6ef6('0x42')],_0xed6093[_0x6ef6('0x43')]);_0x2828ef[_0x6ef6('0x47')]=_[_0x6ef6('0x46')](_0xed6093['model'],qs[_0x6ef6('0x48')](_0x30649c[_0x6ef6('0x43')][_0x6ef6('0x48')]));_0x2828ef[_0x6ef6('0x47')]=_0x2828ef[_0x6ef6('0x47')][_0x6ef6('0x49')]?_0x2828ef[_0x6ef6('0x47')]:_0xed6093[_0x6ef6('0x42')];if(!_0x30649c[_0x6ef6('0x43')][_0x6ef6('0x4a')](_0x6ef6('0x4b'))){_0x2828ef['limit']=qs[_0x6ef6('0x31')](_0x30649c['query'][_0x6ef6('0x31')]);_0x2828ef['offset']=qs[_0x6ef6('0x2f')](_0x30649c[_0x6ef6('0x43')]['offset']);}_0x2828ef[_0x6ef6('0x4c')]=qs[_0x6ef6('0x4d')](_0x30649c[_0x6ef6('0x43')][_0x6ef6('0x4d')]);_0x2828ef[_0x6ef6('0x4e')]=qs['filters'](_[_0x6ef6('0x4f')](_0x30649c[_0x6ef6('0x43')],_0xed6093[_0x6ef6('0x45')]),_0x58fed8);if(_0x30649c[_0x6ef6('0x43')][_0x6ef6('0x50')]){_0x2828ef[_0x6ef6('0x4e')]=_[_0x6ef6('0x51')](_0x2828ef[_0x6ef6('0x4e')],{'$or':_['map'](_0x58fed8,function(_0x367df3){if(_0x367df3[_0x6ef6('0x40')]!=='VIRTUAL'){var _0x5d6b40={};_0x5d6b40[_0x367df3[_0x6ef6('0x3a')]]={'$like':'%'+_0x30649c['query'][_0x6ef6('0x50')]+'%'};return _0x5d6b40;}})});}_0x2828ef=_['merge']({},_0x2828ef,_0x30649c[_0x6ef6('0x52')]);var _0x712015={'where':_0x2828ef[_0x6ef6('0x4e')]};return db[_0x6ef6('0x3e')]['count'](_0x712015)['then'](function(_0x560f19){_0x13b3c0['count']=_0x560f19;if(_0x30649c[_0x6ef6('0x43')][_0x6ef6('0x53')]){_0x2828ef[_0x6ef6('0x54')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x6ef6('0x55')](_0x2828ef);})[_0x6ef6('0x39')](function(_0x30a2a5){_0x13b3c0[_0x6ef6('0x56')]=_0x30a2a5;return _0x13b3c0;})[_0x6ef6('0x39')](respondWithFilteredResult(_0x31facc,_0x2828ef))[_0x6ef6('0x2a')](handleError(_0x31facc,null));};exports[_0x6ef6('0x57')]=function(_0x4f547e,_0x260497){var _0x4bdaed={'raw':![],'where':{'id':_0x4f547e[_0x6ef6('0x58')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x36665e={};_0x36665e[_0x6ef6('0x42')]=_[_0x6ef6('0x44')](db[_0x6ef6('0x3e')][_0x6ef6('0x3f')]);_0x36665e[_0x6ef6('0x43')]=_[_0x6ef6('0x44')](_0x4f547e[_0x6ef6('0x43')]);_0x36665e['filters']=_[_0x6ef6('0x46')](_0x36665e[_0x6ef6('0x42')],_0x36665e[_0x6ef6('0x43')]);_0x4bdaed['attributes']=_[_0x6ef6('0x46')](_0x36665e[_0x6ef6('0x42')],qs['fields'](_0x4f547e[_0x6ef6('0x43')][_0x6ef6('0x48')]));_0x4bdaed[_0x6ef6('0x47')]=_0x4bdaed[_0x6ef6('0x47')][_0x6ef6('0x49')]?_0x4bdaed[_0x6ef6('0x47')]:_0x36665e[_0x6ef6('0x42')];if(_0x4f547e[_0x6ef6('0x43')]['includeAll']){_0x4bdaed[_0x6ef6('0x54')]=[{'all':!![]}];}_0x4bdaed=_[_0x6ef6('0x51')]({},_0x4bdaed,_0x4f547e[_0x6ef6('0x52')]);return db[_0x6ef6('0x3e')]['find'](_0x4bdaed)[_0x6ef6('0x39')](handleEntityNotFound(_0x260497,null))['then'](respondWithResult(_0x260497,null))[_0x6ef6('0x2a')](handleError(_0x260497,null));};exports[_0x6ef6('0x59')]=function(_0xf02140,_0x4b0066){return db[_0x6ef6('0x3e')][_0x6ef6('0x59')](_0xf02140['body'],{})['then'](function(_0xd33336){var _0x287f39=_0xf02140[_0x6ef6('0x5a')]['get']({'plain':!![]});if(!_0x287f39)throw new Error(_0x6ef6('0x5b'));if(_0x287f39['role']==='user'){var _0x3b951b=_0xd33336[_0x6ef6('0x5c')]({'plain':!![]});var _0x5d2c94=_0x6ef6('0x5d');return db[_0x6ef6('0x5e')][_0x6ef6('0x5f')]({'where':{'name':_0x5d2c94,'userProfileId':_0x287f39[_0x6ef6('0x60')]},'raw':!![]})['then'](function(_0x377a8f){if(_0x377a8f&&_0x377a8f[_0x6ef6('0x61')]===0x0){return db[_0x6ef6('0x38')][_0x6ef6('0x59')]({'name':_0x3b951b[_0x6ef6('0x3a')],'resourceId':_0x3b951b['id'],'type':_0x377a8f[_0x6ef6('0x3a')],'sectionId':_0x377a8f['id']},{})['then'](function(){return _0xd33336;});}else{return _0xd33336;}})['catch'](function(_0x549e4c){logger[_0x6ef6('0x26')](_0x6ef6('0x62'),_0x549e4c);throw _0x549e4c;});}return _0xd33336;})[_0x6ef6('0x39')](respondWithResult(_0x4b0066,0xc9))[_0x6ef6('0x2a')](handleError(_0x4b0066,null));};exports[_0x6ef6('0x36')]=function(_0x3de2f3,_0x1b8052){if(_0x3de2f3[_0x6ef6('0x63')]['id']){delete _0x3de2f3[_0x6ef6('0x63')]['id'];}return db[_0x6ef6('0x3e')][_0x6ef6('0x5f')]({'where':{'id':_0x3de2f3['params']['id']},'include':[{'model':db[_0x6ef6('0x64')],'as':_0x6ef6('0x3d')}]})[_0x6ef6('0x39')](handleEntityNotFound(_0x1b8052,null))[_0x6ef6('0x39')](saveUpdates(_0x3de2f3[_0x6ef6('0x63')],null))[_0x6ef6('0x39')](respondWithResult(_0x1b8052,null))[_0x6ef6('0x2a')](handleError(_0x1b8052,null));};exports[_0x6ef6('0x37')]=function(_0x5d3d70,_0x28f39b){return db['OpenchannelAccount'][_0x6ef6('0x5f')]({'where':{'id':_0x5d3d70[_0x6ef6('0x58')]['id']}})[_0x6ef6('0x39')](handleEntityNotFound(_0x28f39b,null))['then'](removeEntity(_0x28f39b,null))[_0x6ef6('0x2a')](handleError(_0x28f39b,null));};exports[_0x6ef6('0x65')]=function(_0x1999df,_0x43e63b){return db['OpenchannelAccount'][_0x6ef6('0x65')]()[_0x6ef6('0x39')](respondWithResult(_0x43e63b,null))[_0x6ef6('0x2a')](handleError(_0x43e63b,null));};exports[_0x6ef6('0x66')]=function(_0x3c6975,_0x5b4005,_0x3593b3){if(_0x3c6975[_0x6ef6('0x63')]['id']){delete _0x3c6975[_0x6ef6('0x63')]['id'];}return db[_0x6ef6('0x3e')]['find']({'where':{'id':_0x3c6975[_0x6ef6('0x58')]['id']}})[_0x6ef6('0x39')](handleEntityNotFound(_0x5b4005,null))[_0x6ef6('0x39')](function(_0x633850){if(_0x633850){_0x3c6975['body'][_0x6ef6('0x67')]=_0x633850['id'];return db[_0x6ef6('0x68')][_0x6ef6('0x59')](_0x3c6975[_0x6ef6('0x63')]);}})[_0x6ef6('0x39')](respondWithResult(_0x5b4005,null))['catch'](handleError(_0x5b4005,null));};exports['getDispositions']=function(_0x25ab5f,_0x49a26b,_0x34f9ea){var _0x2c69b8={'raw':![],'where':{}};var _0x2fb30f={};var _0x3f217a={'count':0x0,'rows':[]};return db[_0x6ef6('0x3e')][_0x6ef6('0x69')]({'where':{'id':_0x25ab5f[_0x6ef6('0x58')]['id']}})[_0x6ef6('0x39')](handleEntityNotFound(_0x49a26b,null))['then'](function(_0x589f12){if(_0x589f12){_0x2fb30f['model']=_[_0x6ef6('0x44')](db[_0x6ef6('0x68')][_0x6ef6('0x3f')]);_0x2fb30f['query']=_[_0x6ef6('0x44')](_0x25ab5f['query']);_0x2fb30f['filters']=_[_0x6ef6('0x46')](_0x2fb30f[_0x6ef6('0x42')],_0x2fb30f['query']);_0x2c69b8['attributes']=_[_0x6ef6('0x46')](_0x2fb30f['model'],qs['fields'](_0x25ab5f[_0x6ef6('0x43')][_0x6ef6('0x48')]));_0x2c69b8[_0x6ef6('0x47')]=_0x2c69b8[_0x6ef6('0x47')][_0x6ef6('0x49')]?_0x2c69b8[_0x6ef6('0x47')]:_0x2fb30f['model'];if(!_0x25ab5f[_0x6ef6('0x43')][_0x6ef6('0x4a')](_0x6ef6('0x4b'))){_0x2c69b8['limit']=qs[_0x6ef6('0x31')](_0x25ab5f[_0x6ef6('0x43')][_0x6ef6('0x31')]);_0x2c69b8[_0x6ef6('0x2f')]=qs['offset'](_0x25ab5f[_0x6ef6('0x43')]['offset']);}_0x2c69b8[_0x6ef6('0x4c')]=qs[_0x6ef6('0x4d')](_0x25ab5f[_0x6ef6('0x43')][_0x6ef6('0x4d')]);_0x2c69b8[_0x6ef6('0x4e')]=qs[_0x6ef6('0x45')](_[_0x6ef6('0x4f')](_0x25ab5f[_0x6ef6('0x43')],_0x2fb30f[_0x6ef6('0x45')]));_0x2c69b8[_0x6ef6('0x4e')]['OpenchannelAccountId']=_0x589f12['id'];if(_0x25ab5f[_0x6ef6('0x43')][_0x6ef6('0x50')]){_0x2c69b8[_0x6ef6('0x4e')]=_[_0x6ef6('0x51')](_0x2c69b8[_0x6ef6('0x4e')],{'$or':_[_0x6ef6('0x6a')](_0x2c69b8[_0x6ef6('0x47')],function(_0x4028f1){var _0x5774ff={};_0x5774ff[_0x4028f1]={'$like':'%'+_0x25ab5f[_0x6ef6('0x43')]['filter']+'%'};return _0x5774ff;})});}_0x2c69b8=_[_0x6ef6('0x51')]({},_0x2c69b8,_0x25ab5f['options']);return db[_0x6ef6('0x68')][_0x6ef6('0x32')]({'where':_0x2c69b8[_0x6ef6('0x4e')]})['then'](function(_0x5677f2){_0x3f217a[_0x6ef6('0x32')]=_0x5677f2;if(_0x25ab5f[_0x6ef6('0x43')]['includeAll']){_0x2c69b8[_0x6ef6('0x54')]=[{'all':!![]}];}return db[_0x6ef6('0x68')][_0x6ef6('0x55')](_0x2c69b8);})[_0x6ef6('0x39')](function(_0x384231){_0x3f217a[_0x6ef6('0x56')]=_0x384231;return _0x3f217a;});}})[_0x6ef6('0x39')](respondWithFilteredResult(_0x49a26b,_0x2c69b8))[_0x6ef6('0x2a')](handleError(_0x49a26b,null));};exports[_0x6ef6('0x6b')]=function(_0x1d40ac,_0x37bffb,_0x1c0320){return db['OpenchannelAccount'][_0x6ef6('0x5f')]({'where':{'id':_0x1d40ac[_0x6ef6('0x58')]['id']}})['then'](handleEntityNotFound(_0x37bffb,null))['then'](function(_0x79816c){if(_0x79816c){return _0x79816c[_0x6ef6('0x6b')](_0x1d40ac[_0x6ef6('0x43')][_0x6ef6('0x6c')]);}})[_0x6ef6('0x39')](respondWithStatusCode(_0x37bffb,null))[_0x6ef6('0x2a')](handleError(_0x37bffb,null));};exports[_0x6ef6('0x6d')]=function(_0x562597,_0x26bb7c,_0x4ec67a){if(_0x562597[_0x6ef6('0x63')]['id']){delete _0x562597[_0x6ef6('0x63')]['id'];}return db[_0x6ef6('0x3e')][_0x6ef6('0x5f')]({'where':{'id':_0x562597[_0x6ef6('0x58')]['id']}})['then'](handleEntityNotFound(_0x26bb7c,null))[_0x6ef6('0x39')](function(_0x40d669){if(_0x40d669){_0x562597[_0x6ef6('0x63')]['OpenchannelAccountId']=_0x40d669['id'];return db[_0x6ef6('0x6e')]['create'](_0x562597[_0x6ef6('0x63')]);}})['then'](respondWithResult(_0x26bb7c,null))['catch'](handleError(_0x26bb7c,null));};exports['getAnswers']=function(_0x3287bc,_0x1fbfb5,_0x1209b4){var _0x116b08={'raw':![],'where':{}};var _0x31d0d4={};var _0x4c479a={'count':0x0,'rows':[]};return db[_0x6ef6('0x3e')][_0x6ef6('0x69')]({'where':{'id':_0x3287bc['params']['id']}})[_0x6ef6('0x39')](handleEntityNotFound(_0x1fbfb5,null))[_0x6ef6('0x39')](function(_0x15ebf0){if(_0x15ebf0){_0x31d0d4['model']=_[_0x6ef6('0x44')](db['CannedAnswer'][_0x6ef6('0x3f')]);_0x31d0d4[_0x6ef6('0x43')]=_[_0x6ef6('0x44')](_0x3287bc[_0x6ef6('0x43')]);_0x31d0d4[_0x6ef6('0x45')]=_['intersection'](_0x31d0d4['model'],_0x31d0d4[_0x6ef6('0x43')]);_0x116b08[_0x6ef6('0x47')]=_['intersection'](_0x31d0d4[_0x6ef6('0x42')],qs[_0x6ef6('0x48')](_0x3287bc[_0x6ef6('0x43')][_0x6ef6('0x48')]));_0x116b08[_0x6ef6('0x47')]=_0x116b08['attributes'][_0x6ef6('0x49')]?_0x116b08['attributes']:_0x31d0d4['model'];if(!_0x3287bc[_0x6ef6('0x43')][_0x6ef6('0x4a')](_0x6ef6('0x4b'))){_0x116b08[_0x6ef6('0x31')]=qs[_0x6ef6('0x31')](_0x3287bc[_0x6ef6('0x43')]['limit']);_0x116b08[_0x6ef6('0x2f')]=qs[_0x6ef6('0x2f')](_0x3287bc['query'][_0x6ef6('0x2f')]);}_0x116b08['order']=qs[_0x6ef6('0x4d')](_0x3287bc[_0x6ef6('0x43')][_0x6ef6('0x4d')]);_0x116b08['where']=qs[_0x6ef6('0x45')](_[_0x6ef6('0x4f')](_0x3287bc[_0x6ef6('0x43')],_0x31d0d4[_0x6ef6('0x45')]));_0x116b08['where'][_0x6ef6('0x67')]=_0x15ebf0['id'];if(_0x3287bc[_0x6ef6('0x43')][_0x6ef6('0x50')]){_0x116b08[_0x6ef6('0x4e')]=_[_0x6ef6('0x51')](_0x116b08['where'],{'$or':_[_0x6ef6('0x6a')](_0x116b08[_0x6ef6('0x47')],function(_0x1b6cb6){var _0x2d3e60={};_0x2d3e60[_0x1b6cb6]={'$like':'%'+_0x3287bc[_0x6ef6('0x43')][_0x6ef6('0x50')]+'%'};return _0x2d3e60;})});}_0x116b08=_[_0x6ef6('0x51')]({},_0x116b08,_0x3287bc[_0x6ef6('0x52')]);return db['CannedAnswer'][_0x6ef6('0x32')]({'where':_0x116b08[_0x6ef6('0x4e')]})[_0x6ef6('0x39')](function(_0x5ec655){_0x4c479a['count']=_0x5ec655;if(_0x3287bc[_0x6ef6('0x43')][_0x6ef6('0x53')]){_0x116b08[_0x6ef6('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0x6ef6('0x55')](_0x116b08);})[_0x6ef6('0x39')](function(_0x561a62){_0x4c479a['rows']=_0x561a62;return _0x4c479a;});}})['then'](respondWithFilteredResult(_0x1fbfb5,_0x116b08))['catch'](handleError(_0x1fbfb5,null));};exports[_0x6ef6('0x6f')]=function(_0x5cfa09,_0x2c70fe,_0x188949){return db[_0x6ef6('0x3e')][_0x6ef6('0x5f')]({'where':{'id':_0x5cfa09[_0x6ef6('0x58')]['id']}})[_0x6ef6('0x39')](handleEntityNotFound(_0x2c70fe,null))[_0x6ef6('0x39')](function(_0x51b0d2){if(_0x51b0d2){return _0x51b0d2[_0x6ef6('0x6f')](_0x5cfa09[_0x6ef6('0x43')][_0x6ef6('0x6c')]);}})[_0x6ef6('0x39')](respondWithStatusCode(_0x2c70fe,null))[_0x6ef6('0x2a')](handleError(_0x2c70fe,null));};exports['notify']=function(_0x3144e8,_0xa61bf9,_0x4bf0fd){var _0x2dafc1={'body':_0x3144e8[_0x6ef6('0x63')],'channel':'openchannel'};var _0x450517=[];var _0x35eefa=[];var _0x2f7640={};var _0x1419cd=![];return db[_0x6ef6('0x70')][_0x6ef6('0x65')]()[_0x6ef6('0x39')](function(_0x50d124){if(!_0x50d124){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x450517=_[_0x6ef6('0x71')](_[_0x6ef6('0x44')](_0x50d124),[_0x6ef6('0x72'),_0x6ef6('0x73')]);_0x35eefa=_[_0x6ef6('0x71')](_[_0x6ef6('0x44')](_0x50d124),[_0x6ef6('0x72'),'updatedAt',_0x6ef6('0x74'),'ListId']);if(_0x3144e8[_0x6ef6('0x63')]['id']){delete _0x3144e8[_0x6ef6('0x63')]['id'];}if(_[_0x6ef6('0x75')](_0x3144e8['body'][_0x6ef6('0x76')])){throw new db[(_0x6ef6('0x77'))][(_0x6ef6('0x78'))](_0x6ef6('0x79'));}if(_['isNil'](_0x3144e8[_0x6ef6('0x63')]['body'])||_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x63')]===''){throw new db[(_0x6ef6('0x77'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x3144e8[_0x6ef6('0x63')]['mapKey'])){throw new db['Sequelize'][(_0x6ef6('0x78'))](_0x6ef6('0x7a')+_0x35eefa);}if(!_['includes'](_0x35eefa,_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x7b')])){throw new db[(_0x6ef6('0x77'))][(_0x6ef6('0x78'))](_0x6ef6('0x7c')+_0x35eefa);}_0x2f7640[_0x3144e8['body'][_0x6ef6('0x7b')]]=_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x76')];})[_0x6ef6('0x39')](function(){return db[_0x6ef6('0x3e')][_0x6ef6('0x5f')]({'where':{'id':_0x3144e8['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x6ef6('0x70')],'as':_0x6ef6('0x7d'),'where':_0x2f7640,'limit':0x1,'order':[[_0x6ef6('0x73'),_0x6ef6('0x7e')]]}]},{'model':db[_0x6ef6('0x7f')],'as':_0x6ef6('0x80')}]});})['then'](handleEntityNotFound(_0xa61bf9,null))[_0x6ef6('0x39')](function(_0x47a73e){if(_0x47a73e&&_0x47a73e[_0x6ef6('0x81')]){_0x2dafc1[_0x6ef6('0x82')]=_0x47a73e;_0x2dafc1['applications']=_0x47a73e[_0x6ef6('0x80')];_0x2dafc1[_0x6ef6('0x83')]=_0x47a73e[_0x6ef6('0x81')];_0x2dafc1['applications']=_[_0x6ef6('0x84')](_0x2dafc1[_0x6ef6('0x85')],[_0x6ef6('0x86')],[_0x6ef6('0x87')]);if(_0x2dafc1[_0x6ef6('0x82')][_0x6ef6('0x80')]){delete _0x2dafc1[_0x6ef6('0x82')][_0x6ef6('0x80')];}if(_0x2dafc1['account']['List']&&_0x2dafc1[_0x6ef6('0x82')]['List'][_0x6ef6('0x7d')][_0x6ef6('0x49')]){return _0x2dafc1[_0x6ef6('0x82')][_0x6ef6('0x81')][_0x6ef6('0x7d')][0x0];}var _0x4c6dfa=_[_0x6ef6('0x18')](_0x3144e8[_0x6ef6('0x63')],{'firstName':_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x76')],'ListId':_0x47a73e[_0x6ef6('0x88')]});_0x4c6dfa[_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x7b')]]=_0x3144e8['body'][_0x6ef6('0x76')];return db[_0x6ef6('0x70')][_0x6ef6('0x59')](_0x4c6dfa,{'fields':_0x450517,'raw':!![]});}})['then'](handleEntityNotFound(_0xa61bf9,null))[_0x6ef6('0x39')](function(_0x4fe0b9){_0x2dafc1[_0x6ef6('0x89')]=_0x4fe0b9;if(_0x4fe0b9){var _0x29c581={'ContactId':_0x4fe0b9['id'],'OpenchannelAccountId':_0x3144e8['params']['id'],'from':(_0x4fe0b9['firstName']||'')+'\x20'+(_0x4fe0b9[_0x6ef6('0x8a')]||'')};var _0x5477a5={'OpenchannelAccountId':_0x3144e8['params']['id'],'closed':![]};if(_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x8b')]){_0x5477a5[_0x6ef6('0x8b')]=_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x8b')];return db[_0x6ef6('0x8c')][_0x6ef6('0x5f')]({'where':_0x5477a5})[_0x6ef6('0x39')](function(_0x3a344e){if(_0x3a344e){return[_0x3a344e,![]];}_0x29c581[_0x6ef6('0x8b')]=_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x8b')];_0x29c581[_0x6ef6('0x8d')]=_0x3144e8[_0x6ef6('0x63')]['externalUrl'];return db[_0x6ef6('0x8c')]['create'](_0x29c581)[_0x6ef6('0x39')](function(_0x5db9ff){return[_0x5db9ff,!![]];});});}else{_0x5477a5[_0x6ef6('0x8b')]=null;}_0x5477a5['ContactId']=_0x4fe0b9['id'];return db[_0x6ef6('0x8c')]['find']({'where':_0x5477a5})[_0x6ef6('0x39')](function(_0x4bd21c){if(_0x4bd21c){return[_0x4bd21c,![]];}return db[_0x6ef6('0x8c')][_0x6ef6('0x59')](_0x29c581)[_0x6ef6('0x39')](function(_0x1c571a){return[_0x1c571a,!![]];});});}})[_0x6ef6('0x8e')](function(_0x46fabd,_0x167473){if(_0x46fabd){_0x1419cd=_0x167473;if(!_0x167473){var _0x3e59e2={'from':(_0x2dafc1[_0x6ef6('0x89')]['firstName']||'')+'\x20'+(_0x2dafc1[_0x6ef6('0x89')]['lastName']||'')};if(_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x8b')]&&_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x8f')]&&_0x3144e8[_0x6ef6('0x63')]['threadId']!=_0x3144e8['body'][_0x6ef6('0x8f')]){_0x3e59e2['threadId']=_0x3144e8[_0x6ef6('0x63')]['messageId'];}return _0x46fabd[_0x6ef6('0x36')](_0x3e59e2);}else{return _0x46fabd;}}})[_0x6ef6('0x39')](function(_0x3c392c){_0x2dafc1[_0x6ef6('0x90')]=_0x3c392c[_0x6ef6('0x5c')]({'plain':!![]});_0x2dafc1[_0x6ef6('0x90')][_0x6ef6('0x91')]=_0x1419cd;if(_0x2dafc1[_0x6ef6('0x90')]['created']){if(_0x2dafc1[_0x6ef6('0x82')][_0x6ef6('0x92')]){_0x2dafc1['applications'][_0x6ef6('0x93')]({'id':0x0,'priority':_0x2dafc1[_0x6ef6('0x85')][_0x6ef6('0x49')]+0x1,'app':'close','appdata':_0x6ef6('0x94'),'interval':'*,*,*,*'});}}return db[_0x6ef6('0x95')][_0x6ef6('0x59')]({'body':_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x63')],'OpenchannelAccountId':_0x3144e8[_0x6ef6('0x58')]['id'],'OpenchannelInteractionId':_0x3c392c['id'],'direction':'in','ContactId':_0x2dafc1[_0x6ef6('0x89')]['id'],'AttachmentId':_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x96')]});})[_0x6ef6('0x39')](function(_0x162297){_0x2dafc1['message']=_0x162297;if(!_0x2dafc1[_0x6ef6('0x90')][_0x6ef6('0x97')])return;return db[_0x6ef6('0x98')][_0x6ef6('0x5f')]({'attributes':['id',_0x6ef6('0x3a')],'where':{'id':_0x2dafc1[_0x6ef6('0x90')][_0x6ef6('0x97')]}});})[_0x6ef6('0x39')](function(_0x216614){if(_0x216614){_0x2dafc1[_0x6ef6('0x85')][_0x6ef6('0x99')]({'id':0x0,'priority':0x0,'app':_0x6ef6('0x9a'),'appdata':_0x216614[_0x6ef6('0x3a')]+','+(_0x2dafc1['account'][_0x6ef6('0x9b')]||0xa),'interval':'*,*,*,*'});}if(!_0x2dafc1[_0x6ef6('0x90')][_0x6ef6('0x9c')])return;return db[_0x6ef6('0x9d')][_0x6ef6('0x5f')]({'attributes':['id',_0x6ef6('0x3a')],'where':{'id':_0x2dafc1['interaction'][_0x6ef6('0x9c')]}});})[_0x6ef6('0x39')](function(_0x3714ea){if(_0x3714ea){_0x2dafc1[_0x6ef6('0x85')][_0x6ef6('0x99')]({'id':0x0,'priority':0x1,'app':_0x6ef6('0x9e'),'appdata':_0x3714ea['name']+','+(_0x2dafc1[_0x6ef6('0x82')][_0x6ef6('0x9f')]||0x12c),'interval':_0x6ef6('0xa0')});}return respondWithRpcPromise(_0x6ef6('0xa1'),_0x6ef6('0xa2'),_0x2dafc1);})['then'](function(_0x36e4ce){respondWithRpcPromise(_0x6ef6('0xa3'),_0x6ef6('0xa3'),{'event':_0x6ef6('0xa4'),'message':_0x36e4ce},client9002);return _0x36e4ce;})[_0x6ef6('0x39')](respondWithResult(_0xa61bf9,null))[_0x6ef6('0x2a')](handleError(_0xa61bf9,null));};exports[_0x6ef6('0xa5')]=function(_0x2dd3d0,_0x34b762){var _0x2066ed=_0x2dd3d0[_0x6ef6('0x58')]['id'];var _0x326fd1=_0x2dd3d0['body'];var _0x53b9cc=0xc8;var _0x1326ba=null;return db['sequelize'][_0x6ef6('0xa6')]({'isolationLevel':db[_0x6ef6('0xa7')][_0x6ef6('0xa8')][_0x6ef6('0xa9')]['READ_COMMITTED']},function(_0x8db77e){return db[_0x6ef6('0x3e')]['findOne']({'where':{'id':_0x2066ed},'transaction':_0x8db77e})[_0x6ef6('0x39')](function(_0x18247b){if(_0x18247b){return db[_0x6ef6('0x7f')]['destroy']({'where':{'OpenchannelAccountId':_0x2066ed},'transaction':_0x8db77e})[_0x6ef6('0x39')](function(){var _0x1a935e=_[_0x6ef6('0x6a')](_0x326fd1,function(_0x1d3f9e){_0x1d3f9e[_0x6ef6('0x67')]=_0x2066ed;return _0x1d3f9e;});return db['OpenchannelApplication'][_0x6ef6('0xaa')](_0x1a935e,{'transaction':_0x8db77e});});}else{_0x53b9cc=0x194;_0x1326ba=[];}});})['then'](function(){if(_0x53b9cc!==0x194){return db[_0x6ef6('0x7f')][_0x6ef6('0xab')]({'where':{'OpenchannelAccountId':_0x2066ed},'order':_0x6ef6('0x86')})[_0x6ef6('0x39')](function(_0x2390d1){_0x1326ba=_0x2390d1;});}})['catch'](function(_0x427f0f){_0x53b9cc=0x1f4;logger[_0x6ef6('0x26')](_0x427f0f[_0x6ef6('0xac')]);if(_0x427f0f[_0x6ef6('0x3a')]){delete _0x427f0f['name'];}_0x1326ba=_0x427f0f;})[_0x6ef6('0xad')](function(){if(_0x1326ba===null){_0x34b762['sendStatus'](_0x53b9cc);}else{if(_0x53b9cc===0x1f4){_0x34b762[_0x6ef6('0x2c')](_0x53b9cc)['send'](_0x1326ba);}else{_0x34b762[_0x6ef6('0x2c')](_0x53b9cc)['json'](_0x1326ba);}}});};exports['getApplications']=function(_0x1f8c84,_0x25a137,_0x51dc28){var _0x56b52d={};var _0xee13cd={};var _0x4c6c6a;var _0x27eb7d;return db['OpenchannelAccount'][_0x6ef6('0x69')]({'where':{'id':_0x1f8c84[_0x6ef6('0x58')]['id']}})[_0x6ef6('0x39')](handleEntityNotFound(_0x25a137,null))[_0x6ef6('0x39')](function(_0x5c952e){if(_0x5c952e){_0x4c6c6a=_0x5c952e;_0xee13cd['model']=_['keys'](db['OpenchannelApplication'][_0x6ef6('0x3f')]);_0xee13cd[_0x6ef6('0x43')]=_[_0x6ef6('0x44')](_0x1f8c84[_0x6ef6('0x43')]);_0xee13cd[_0x6ef6('0x45')]=_[_0x6ef6('0x46')](_0xee13cd[_0x6ef6('0x42')],_0xee13cd[_0x6ef6('0x43')]);_0x56b52d[_0x6ef6('0x47')]=_['intersection'](_0xee13cd['model'],qs['fields'](_0x1f8c84[_0x6ef6('0x43')][_0x6ef6('0x48')]));_0x56b52d[_0x6ef6('0x47')]=_0x56b52d['attributes'][_0x6ef6('0x49')]?_0x56b52d['attributes']:_0xee13cd[_0x6ef6('0x42')];_0x56b52d[_0x6ef6('0x4c')]=qs[_0x6ef6('0x4d')](_0x1f8c84['query'][_0x6ef6('0x4d')]);_0x56b52d[_0x6ef6('0x4e')]=qs[_0x6ef6('0x45')](_[_0x6ef6('0x4f')](_0x1f8c84[_0x6ef6('0x43')],_0xee13cd['filters']));if(_0x1f8c84['query'][_0x6ef6('0x50')]){_0x56b52d[_0x6ef6('0x4e')]=_[_0x6ef6('0x51')](_0x56b52d[_0x6ef6('0x4e')],{'$or':_['map'](_0x56b52d[_0x6ef6('0x47')],function(_0x36dfe3){var _0x479784={};_0x479784[_0x36dfe3]={'$like':'%'+_0x1f8c84['query'][_0x6ef6('0x50')]+'%'};return _0x479784;})});}_0x56b52d=_['merge']({},_0x56b52d,_0x1f8c84[_0x6ef6('0x52')]);return _0x4c6c6a[_0x6ef6('0xae')](_0x56b52d);}})[_0x6ef6('0x39')](function(_0x1b151a){if(_0x1b151a){_0x27eb7d=_0x1b151a['length'];if(!_0x1f8c84[_0x6ef6('0x43')][_0x6ef6('0x4a')](_0x6ef6('0x4b'))){_0x56b52d[_0x6ef6('0x31')]=qs[_0x6ef6('0x31')](_0x1f8c84[_0x6ef6('0x43')][_0x6ef6('0x31')]);_0x56b52d[_0x6ef6('0x2f')]=qs[_0x6ef6('0x2f')](_0x1f8c84[_0x6ef6('0x43')]['offset']);}return _0x4c6c6a['getApplications'](_0x56b52d);}})[_0x6ef6('0x39')](function(_0x4c5a8a){if(_0x4c5a8a){return _0x4c5a8a?{'count':_0x27eb7d,'rows':_0x4c5a8a}:null;}})['then'](respondWithResult(_0x25a137,null))[_0x6ef6('0x2a')](handleError(_0x25a137,null));};exports[_0x6ef6('0xaf')]=function(_0x5dee07,_0x4701a7,_0x248c75){var _0x176a63={'raw':![],'where':{}};var _0xa0357a={};var _0x229de1={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x6ef6('0x69')]({'where':{'id':_0x5dee07[_0x6ef6('0x58')]['id']}})[_0x6ef6('0x39')](handleEntityNotFound(_0x4701a7,null))[_0x6ef6('0x39')](function(_0x3ebd90){if(_0x3ebd90){_0xa0357a['model']=_[_0x6ef6('0x44')](db[_0x6ef6('0x8c')][_0x6ef6('0x3f')]);_0xa0357a[_0x6ef6('0x43')]=_[_0x6ef6('0x44')](_0x5dee07[_0x6ef6('0x43')]);_0xa0357a['filters']=_[_0x6ef6('0x46')](_0xa0357a['model'],_0xa0357a[_0x6ef6('0x43')]);_0x176a63[_0x6ef6('0x47')]=_['intersection'](_0xa0357a['model'],qs[_0x6ef6('0x48')](_0x5dee07[_0x6ef6('0x43')][_0x6ef6('0x48')]));_0x176a63['attributes']=_0x176a63[_0x6ef6('0x47')][_0x6ef6('0x49')]?_0x176a63[_0x6ef6('0x47')]:_0xa0357a[_0x6ef6('0x42')];if(!_0x5dee07[_0x6ef6('0x43')]['hasOwnProperty']('nolimit')){_0x176a63[_0x6ef6('0x31')]=qs['limit'](_0x5dee07[_0x6ef6('0x43')][_0x6ef6('0x31')]);_0x176a63[_0x6ef6('0x2f')]=qs['offset'](_0x5dee07['query'][_0x6ef6('0x2f')]);}_0x176a63['order']=qs[_0x6ef6('0x4d')](_0x5dee07[_0x6ef6('0x43')][_0x6ef6('0x4d')]);_0x176a63[_0x6ef6('0x4e')]=qs['filters'](_[_0x6ef6('0x4f')](_0x5dee07[_0x6ef6('0x43')],_0xa0357a['filters']));_0x176a63['where'][_0x6ef6('0x67')]=_0x3ebd90['id'];if(_0x5dee07[_0x6ef6('0x43')]['filter']){_0x176a63[_0x6ef6('0x4e')]=_[_0x6ef6('0x51')](_0x176a63[_0x6ef6('0x4e')],{'$or':_[_0x6ef6('0x6a')](_0x176a63[_0x6ef6('0x47')],function(_0x365cab){var _0x15cb1e={};_0x15cb1e[_0x365cab]={'$like':'%'+_0x5dee07[_0x6ef6('0x43')]['filter']+'%'};return _0x15cb1e;})});}_0x176a63=_['merge']({},_0x176a63,_0x5dee07['options']);return db[_0x6ef6('0x8c')][_0x6ef6('0x32')]({'where':_0x176a63[_0x6ef6('0x4e')]})[_0x6ef6('0x39')](function(_0x108634){_0x229de1[_0x6ef6('0x32')]=_0x108634;if(_0x5dee07['query'][_0x6ef6('0x53')]){_0x176a63[_0x6ef6('0x54')]=[{'model':db[_0x6ef6('0x70')],'as':_0x6ef6('0xb0'),'required':![]},{'model':db[_0x6ef6('0x98')],'as':_0x6ef6('0xb1'),'attributes':[_0x6ef6('0x3a'),_0x6ef6('0xb2'),_0x6ef6('0xb3')],'required':![]},{'model':db[_0x6ef6('0xb4')],'as':_0x6ef6('0xb5'),'attributes':['id',_0x6ef6('0x3a'),_0x6ef6('0xb6')],'where':_0x5dee07['query'][_0x6ef6('0xb7')]?{'id':_0x5dee07['query'][_0x6ef6('0xb7')]}:undefined,'required':_0x5dee07['query'][_0x6ef6('0xb7')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x6ef6('0x55')](_0x176a63);})[_0x6ef6('0x39')](function(_0x331c56){_0x229de1[_0x6ef6('0x56')]=_0x331c56;return _0x229de1;});}})[_0x6ef6('0x39')](respondWithFilteredResult(_0x4701a7,_0x176a63))[_0x6ef6('0x2a')](handleError(_0x4701a7,null));};exports['addAgents']=function(_0x1d8f7d,_0x4710cb,_0x5598e5){return db[_0x6ef6('0x3e')][_0x6ef6('0x5f')]({'where':{'id':_0x1d8f7d[_0x6ef6('0x58')]['id']}})['then'](handleEntityNotFound(_0x4710cb,null))[_0x6ef6('0x39')](function(_0x1e0f66){if(_0x1e0f66){return _0x1e0f66['addAgents'](_0x1d8f7d[_0x6ef6('0x63')][_0x6ef6('0x6c')],_[_0x6ef6('0xb8')](_0x1d8f7d[_0x6ef6('0x63')],[_0x6ef6('0x6c'),'id'])||{})[_0x6ef6('0x8e')](function(_0x1fd548){for(var _0x42ec5e=0x0;_0x42ec5e<_0x1d8f7d['body'][_0x6ef6('0x6c')][_0x6ef6('0x49')];_0x42ec5e+=0x1){socket[_0x6ef6('0xb9')]('userOpenchannelAccount:save',{'UserId':Number(_0x1d8f7d['body'][_0x6ef6('0x6c')][_0x42ec5e]),'OpenchannelAccountId':Number(_0x1d8f7d[_0x6ef6('0x58')]['id'])});}return _0x1fd548;});}})['then'](respondWithResult(_0x4710cb,null))[_0x6ef6('0x2a')](handleError(_0x4710cb,null));};exports[_0x6ef6('0xba')]=function(_0x5a24ef,_0x9e5aee,_0x5d9d65){return db[_0x6ef6('0x3e')]['find']({'where':{'id':_0x5a24ef[_0x6ef6('0x58')]['id']}})[_0x6ef6('0x39')](handleEntityNotFound(_0x9e5aee,null))[_0x6ef6('0x39')](function(_0xa990f5){if(_0xa990f5){return _0xa990f5[_0x6ef6('0xba')](_0x5a24ef['query'][_0x6ef6('0x6c')])[_0x6ef6('0x39')](function(){if(_[_0x6ef6('0xbb')](_0x5a24ef['query'][_0x6ef6('0x6c')])){for(var _0x87c8c5=0x0;_0x87c8c5<_0x5a24ef[_0x6ef6('0x43')]['ids']['length'];_0x87c8c5+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x5a24ef['query'][_0x6ef6('0x6c')][_0x87c8c5]),'OpenchannelAccountId':Number(_0x5a24ef[_0x6ef6('0x58')]['id'])});}}else{socket[_0x6ef6('0xb9')](_0x6ef6('0xbc'),{'UserId':Number(_0x5a24ef['query']['ids']),'OpenchannelAccountId':Number(_0x5a24ef[_0x6ef6('0x58')]['id'])});}});}})[_0x6ef6('0x39')](respondWithStatusCode(_0x9e5aee,null))['catch'](handleError(_0x9e5aee,null));};exports['getAgents']=function(_0x535ef4,_0x5b48d5,_0x867242){var _0x331a15={};var _0x7e5bd3={};var _0x41997e;var _0xfe39c4;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x535ef4[_0x6ef6('0x58')]['id']}})['then'](handleEntityNotFound(_0x5b48d5,null))['then'](function(_0x2a1f78){if(_0x2a1f78){_0x41997e=_0x2a1f78;_0x7e5bd3[_0x6ef6('0x42')]=_['keys'](db[_0x6ef6('0x98')]['rawAttributes']);_0x7e5bd3[_0x6ef6('0x43')]=_['keys'](_0x535ef4[_0x6ef6('0x43')]);_0x7e5bd3[_0x6ef6('0x45')]=_[_0x6ef6('0x46')](_0x7e5bd3[_0x6ef6('0x42')],_0x7e5bd3['query']);_0x331a15[_0x6ef6('0x47')]=_['intersection'](_0x7e5bd3[_0x6ef6('0x42')],qs['fields'](_0x535ef4[_0x6ef6('0x43')]['fields']));_0x331a15[_0x6ef6('0x47')]=_0x331a15[_0x6ef6('0x47')][_0x6ef6('0x49')]?_0x331a15[_0x6ef6('0x47')]:_0x7e5bd3[_0x6ef6('0x42')];_0x331a15[_0x6ef6('0x4c')]=qs[_0x6ef6('0x4d')](_0x535ef4['query'][_0x6ef6('0x4d')]);_0x331a15[_0x6ef6('0x4e')]=qs[_0x6ef6('0x45')](_[_0x6ef6('0x4f')](_0x535ef4[_0x6ef6('0x43')],_0x7e5bd3[_0x6ef6('0x45')]));if(_0x535ef4[_0x6ef6('0x43')][_0x6ef6('0x50')]){_0x331a15[_0x6ef6('0x4e')]=_[_0x6ef6('0x51')](_0x331a15[_0x6ef6('0x4e')],{'$or':_[_0x6ef6('0x6a')](_0x331a15['attributes'],function(_0x193508){var _0x47e358={};_0x47e358[_0x193508]={'$like':'%'+_0x535ef4[_0x6ef6('0x43')][_0x6ef6('0x50')]+'%'};return _0x47e358;})});}_0x331a15=_['merge']({},_0x331a15,_0x535ef4[_0x6ef6('0x52')]);return _0x41997e['getAgents'](_0x331a15);}})[_0x6ef6('0x39')](function(_0x367ae6){if(_0x367ae6){_0xfe39c4=_0x367ae6['length'];if(!_0x535ef4[_0x6ef6('0x43')]['hasOwnProperty'](_0x6ef6('0x4b'))){_0x331a15['limit']=qs[_0x6ef6('0x31')](_0x535ef4['query']['limit']);_0x331a15[_0x6ef6('0x2f')]=qs['offset'](_0x535ef4[_0x6ef6('0x43')][_0x6ef6('0x2f')]);}return _0x41997e[_0x6ef6('0xbd')](_0x331a15);}})['then'](function(_0x21530a){if(_0x21530a){return _0x21530a?{'count':_0xfe39c4,'rows':_0x21530a}:null;}})['then'](respondWithResult(_0x5b48d5,null))['catch'](handleError(_0x5b48d5,null));};exports['send']=function(_0x5ed26e,_0x25abb2,_0x2eadab){var _0x357172,_0x5ccd85,_0x43e1d4;if(_[_0x6ef6('0x75')](_0x5ed26e['body'][_0x6ef6('0x63')])||_0x5ed26e[_0x6ef6('0x63')]['body']===''){throw new db[(_0x6ef6('0x77'))][(_0x6ef6('0x78'))](_0x6ef6('0xbe'));}if(_['isNil'](_0x5ed26e[_0x6ef6('0x63')]['to'])){}_0x357172=_0x5ed26e[_0x6ef6('0x63')]['to'];return db[_0x6ef6('0x3e')][_0x6ef6('0x69')]({'where':{'id':_0x5ed26e[_0x6ef6('0x58')]['id']}})[_0x6ef6('0x39')](handleEntityNotFound(_0x25abb2,null))[_0x6ef6('0x39')](function(_0x2ae1d4){if(_0x2ae1d4){return db[_0x6ef6('0x3e')]['find']({'where':{'id':_0x2ae1d4['id']},'include':[{'model':db['CmList'],'as':_0x6ef6('0x81'),'include':[{'model':db[_0x6ef6('0x70')],'as':_0x6ef6('0x7d'),'where':{[_0x2ae1d4[_0x6ef6('0x7b')]]:_0x357172},'limit':0x1,'order':[[_0x6ef6('0x73'),_0x6ef6('0x7e')]]}]}]})[_0x6ef6('0x39')](handleEntityNotFound(_0x25abb2,null))[_0x6ef6('0x39')](function(_0x5b9a47){if(_0x5b9a47&&_0x5b9a47['List']){_0x5ccd85=_0x5b9a47[_0x6ef6('0x5c')]({'plain':!![]});if(_0x5ccd85[_0x6ef6('0x81')]&&_0x5ccd85[_0x6ef6('0x81')][_0x6ef6('0x7d')]['length']){return _0x5ccd85[_0x6ef6('0x81')][_0x6ef6('0x7d')][0x0];}return db[_0x6ef6('0x70')][_0x6ef6('0x59')](_['defaults'](_0x5ed26e['body'],{'firstName':_0x357172,[_0x5b9a47[_0x6ef6('0x7b')]]:_0x357172,'phone':_0x357172,'ListId':_0x5ccd85[_0x6ef6('0x88')]}));}})[_0x6ef6('0x39')](handleEntityNotFound(_0x25abb2,null))[_0x6ef6('0x39')](function(_0x354caa){if(_0x354caa){_0x43e1d4=_0x354caa;return db[_0x6ef6('0x8c')][_0x6ef6('0x5f')]({'where':{'ContactId':_0x43e1d4['id'],'closed':![],'OpenchannelAccountId':_0x5ccd85['id']}})['then'](function(_0x239f99){if(_0x239f99){return[_0x239f99,![]];}return db[_0x6ef6('0x8c')][_0x6ef6('0x59')]({'UserId':_0x5ed26e[_0x6ef6('0x5a')]['id'],'ContactId':_0x43e1d4['id'],'OpenchannelAccountId':_0x5ccd85['id'],'lastMsgDirection':_0x6ef6('0xbf'),'firstMsgDirection':_0x6ef6('0xbf'),'Messages':[_[_0x6ef6('0x51')](_0x5ed26e['body'],{'read':![],'body':_0x5ed26e[_0x6ef6('0x63')][_0x6ef6('0x63')],'OpenchannelAccountId':_0x5ccd85['id'],'UserId':_0x5ed26e['user']['id'],'ContactId':_0x43e1d4['id']})]},{'include':[{'model':db[_0x6ef6('0x95')],'as':_0x6ef6('0xc0')}]})[_0x6ef6('0x39')](function(_0x1e8216){return[_0x1e8216,!![]];});});}})['spread'](function(_0x42313a,_0x1e553f){if(_0x1e553f){return _0x42313a;}return db[_0x6ef6('0x95')]['create'](_['merge'](_0x5ed26e['body'],{'read':![],'body':_0x5ed26e[_0x6ef6('0x63')][_0x6ef6('0x63')],'OpenchannelAccountId':_0x5ccd85['id'],'OpenchannelInteractionId':_0x42313a['id'],'UserId':_0x5ed26e[_0x6ef6('0x5a')]['id'],'ContactId':_0x43e1d4['id']}))[_0x6ef6('0x39')](function(_0x358934){_0x42313a[_0x6ef6('0xc1')]['Messages']=[];_0x42313a[_0x6ef6('0xc1')][_0x6ef6('0xc0')][_0x6ef6('0x93')](_0x358934[_0x6ef6('0xc1')]);return _0x42313a;});});}})[_0x6ef6('0x39')](respondWithResult(_0x25abb2,null))[_0x6ef6('0x2a')](handleError(_0x25abb2,null));}; \ No newline at end of file +var _0xb073=['color','tag','addAgents','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','register','jayson/promise','client','http','request','then','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','OpenchannelAccount','includeAll','include','findAll','rows','catch','show','params','Pause','mandatoryDispositionPause','filters','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','find','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','removeAnswers','openchannel','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','OpenchannelApplication','account','applications','Applications','list','orderBy','priority','asc','Contacts','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','autoclose','push','close','unmanaged','OpenchannelMessage','User','UserId','agent','waitForTheAssignedAgent','OpenchannelQueue','queue','waitForTheAssignedQueue','startRouting','EventManager','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xb073,0x187));var _0x3b07=function(_0x141775,_0x16fba4){_0x141775=_0x141775-0x0;var _0xf5accf=_0xb073[_0x141775];return _0xf5accf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b07('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3b07('0x1'));var rp=require(_0x3b07('0x2'));var moment=require(_0x3b07('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3b07('0x4'));var util=require(_0x3b07('0x5'));var path=require(_0x3b07('0x6'));var sox=require('sox');var csv=require(_0x3b07('0x7'));var ejs=require(_0x3b07('0x8'));var fs=require('fs');var fs_extra=require(_0x3b07('0x9'));var _=require(_0x3b07('0xa'));var squel=require(_0x3b07('0xb'));var crypto=require(_0x3b07('0xc'));var jsforce=require(_0x3b07('0xd'));var deskjs=require(_0x3b07('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3b07('0xf'));var Redis=require(_0x3b07('0x10'));var authService=require(_0x3b07('0x11'));var qs=require(_0x3b07('0x12'));var as=require(_0x3b07('0x13'));var hardwareService=require(_0x3b07('0x14'));var logger=require(_0x3b07('0x15'))(_0x3b07('0x16'));var utils=require(_0x3b07('0x17'));var config=require(_0x3b07('0x18'));var licenseUtil=require(_0x3b07('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x3b07('0x1a')](config[_0x3b07('0x1b')],{'host':_0x3b07('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3b07('0x1b')]));require('./openchannelAccount.socket')[_0x3b07('0x1d')](socket);var jayson=require(_0x3b07('0x1e'));var client=jayson[_0x3b07('0x1f')][_0x3b07('0x20')]({'port':0x232c});var client9002=jayson[_0x3b07('0x1f')][_0x3b07('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2e1f12,_0x33d648,_0x4560db,_0x268f0b){return new BPromise(function(_0x4f38b2,_0x5622ac){var _0x5e956d=_0x268f0b||client;return _0x5e956d[_0x3b07('0x21')](_0x2e1f12,_0x4560db)[_0x3b07('0x22')](function(_0x4d28a0){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x33d648,_0x3b07('0x23'));logger['debug'](_0x3b07('0x24'),_0x33d648,_0x3b07('0x23'),JSON[_0x3b07('0x25')](_0x4d28a0));if(_0x4d28a0[_0x3b07('0x26')]){if(_0x4d28a0[_0x3b07('0x26')][_0x3b07('0x27')]===0x1f4){logger[_0x3b07('0x26')](_0x3b07('0x28'),_0x33d648,_0x4d28a0[_0x3b07('0x26')][_0x3b07('0x29')]);return _0x5622ac(_0x4d28a0[_0x3b07('0x26')]['message']);}logger[_0x3b07('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x33d648,_0x4d28a0[_0x3b07('0x26')]['message']);return _0x4f38b2(_0x4d28a0[_0x3b07('0x26')]['message']);}else{logger[_0x3b07('0x2a')](_0x3b07('0x28'),_0x33d648,_0x3b07('0x23'));_0x4f38b2(_0x4d28a0['result'][_0x3b07('0x29')]);}})['catch'](function(_0x248e4e){logger['error'](_0x3b07('0x28'),_0x33d648,_0x248e4e);_0x5622ac(_0x248e4e);});});}function respondWithStatusCode(_0x33e124,_0x1779ba){_0x1779ba=_0x1779ba||0xcc;return function(_0x751c07){if(_0x751c07){return _0x33e124[_0x3b07('0x2b')](_0x1779ba);}return _0x33e124[_0x3b07('0x2c')](_0x1779ba)[_0x3b07('0x2d')]();};}function respondWithResult(_0x4a67c3,_0x2b3c96){_0x2b3c96=_0x2b3c96||0xc8;return function(_0x10e38a){if(_0x10e38a){return _0x4a67c3[_0x3b07('0x2c')](_0x2b3c96)[_0x3b07('0x2e')](_0x10e38a);}};}function respondWithFilteredResult(_0x15c1a1,_0x17d7cb){return function(_0x47e70a){if(_0x47e70a){var _0x583a23=typeof _0x17d7cb['offset']==='undefined'&&typeof _0x17d7cb[_0x3b07('0x2f')]===_0x3b07('0x30');var _0xbc12a2=_0x47e70a[_0x3b07('0x31')];var _0xe5fdc7=_0x583a23?0x0:_0x17d7cb[_0x3b07('0x32')];var _0x517866=_0x583a23?_0x47e70a['count']:_0x17d7cb[_0x3b07('0x32')]+_0x17d7cb[_0x3b07('0x2f')];var _0xf1c54;if(_0x517866>=_0xbc12a2){_0x517866=_0xbc12a2;_0xf1c54=0xc8;}else{_0xf1c54=0xce;}_0x15c1a1['status'](_0xf1c54);return _0x15c1a1[_0x3b07('0x33')](_0x3b07('0x34'),_0xe5fdc7+'-'+_0x517866+'/'+_0xbc12a2)[_0x3b07('0x2e')](_0x47e70a);}return null;};}function patchUpdates(_0x2b99ba){return function(_0x4dbe41){try{jsonpatch[_0x3b07('0x35')](_0x4dbe41,_0x2b99ba,!![]);}catch(_0x66d9dd){return BPromise[_0x3b07('0x36')](_0x66d9dd);}return _0x4dbe41[_0x3b07('0x37')]();};}function saveUpdates(_0x53df4d,_0x270126){return function(_0x19532c){if(_0x19532c){return _0x19532c[_0x3b07('0x38')](_0x53df4d)[_0x3b07('0x22')](function(_0xf867ee){return _0xf867ee;});}return null;};}function removeEntity(_0x3f0c3c,_0xac17a4){return function(_0x32f3dd){if(_0x32f3dd){return _0x32f3dd[_0x3b07('0x39')]()['then'](function(){var _0xb4e09c=_0x32f3dd[_0x3b07('0x3a')]({'plain':!![]});var _0x580076='OpenchannelAccounts';return db['UserProfileResource'][_0x3b07('0x39')]({'where':{'type':_0x580076,'resourceId':_0xb4e09c['id']}})[_0x3b07('0x22')](function(){return _0x32f3dd;});})[_0x3b07('0x22')](function(){_0x3f0c3c[_0x3b07('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x354cf6,_0x1c47b7){return function(_0x261eb6){if(!_0x261eb6){_0x354cf6['sendStatus'](0x194);}return _0x261eb6;};}function handleError(_0x2baf3e,_0x5e32bc){_0x5e32bc=_0x5e32bc||0x1f4;return function(_0x2ae8c6){logger[_0x3b07('0x26')](_0x2ae8c6[_0x3b07('0x3b')]);if(_0x2ae8c6[_0x3b07('0x3c')]){delete _0x2ae8c6[_0x3b07('0x3c')];}_0x2baf3e[_0x3b07('0x2c')](_0x5e32bc)[_0x3b07('0x3d')](_0x2ae8c6);};}exports[_0x3b07('0x3e')]=function(_0x4f59ec,_0x2451ae){var _0x3e6109={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x52fb94={},_0x383daf={'count':0x0,'rows':[]};var _0x447ec7=_[_0x3b07('0x3f')](db['OpenchannelAccount'][_0x3b07('0x40')],function(_0x2d9cb9){return{'name':_0x2d9cb9[_0x3b07('0x41')],'type':_0x2d9cb9[_0x3b07('0x42')][_0x3b07('0x43')]};});_0x52fb94[_0x3b07('0x44')]=_[_0x3b07('0x3f')](_0x447ec7,_0x3b07('0x3c'));_0x52fb94[_0x3b07('0x45')]=_[_0x3b07('0x46')](_0x4f59ec['query']);_0x52fb94['filters']=_[_0x3b07('0x47')](_0x52fb94[_0x3b07('0x44')],_0x52fb94[_0x3b07('0x45')]);_0x3e6109['attributes']=_[_0x3b07('0x47')](_0x52fb94[_0x3b07('0x44')],qs[_0x3b07('0x48')](_0x4f59ec['query']['fields']));_0x3e6109['attributes']=_0x3e6109[_0x3b07('0x49')][_0x3b07('0x4a')]?_0x3e6109[_0x3b07('0x49')]:_0x52fb94[_0x3b07('0x44')];if(!_0x4f59ec[_0x3b07('0x45')][_0x3b07('0x4b')](_0x3b07('0x4c'))){_0x3e6109[_0x3b07('0x2f')]=qs[_0x3b07('0x2f')](_0x4f59ec['query'][_0x3b07('0x2f')]);_0x3e6109[_0x3b07('0x32')]=qs[_0x3b07('0x32')](_0x4f59ec[_0x3b07('0x45')]['offset']);}_0x3e6109[_0x3b07('0x4d')]=qs[_0x3b07('0x4e')](_0x4f59ec[_0x3b07('0x45')]['sort']);_0x3e6109[_0x3b07('0x4f')]=qs['filters'](_[_0x3b07('0x50')](_0x4f59ec[_0x3b07('0x45')],_0x52fb94['filters']),_0x447ec7);if(_0x4f59ec[_0x3b07('0x45')][_0x3b07('0x51')]){_0x3e6109['where']=_[_0x3b07('0x52')](_0x3e6109[_0x3b07('0x4f')],{'$or':_[_0x3b07('0x3f')](_0x447ec7,function(_0x2f7335){if(_0x2f7335[_0x3b07('0x42')]!=='VIRTUAL'){var _0x3655cd={};_0x3655cd[_0x2f7335['name']]={'$like':'%'+_0x4f59ec[_0x3b07('0x45')][_0x3b07('0x51')]+'%'};return _0x3655cd;}})});}_0x3e6109=_[_0x3b07('0x52')]({},_0x3e6109,_0x4f59ec[_0x3b07('0x53')]);var _0x4e5bac={'where':_0x3e6109['where']};return db[_0x3b07('0x54')]['count'](_0x4e5bac)[_0x3b07('0x22')](function(_0x51d2fa){_0x383daf[_0x3b07('0x31')]=_0x51d2fa;if(_0x4f59ec[_0x3b07('0x45')][_0x3b07('0x55')]){_0x3e6109[_0x3b07('0x56')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x3b07('0x57')](_0x3e6109);})[_0x3b07('0x22')](function(_0x27ee5d){_0x383daf[_0x3b07('0x58')]=_0x27ee5d;return _0x383daf;})[_0x3b07('0x22')](respondWithFilteredResult(_0x2451ae,_0x3e6109))[_0x3b07('0x59')](handleError(_0x2451ae,null));};exports[_0x3b07('0x5a')]=function(_0x2547ff,_0x515c8b){var _0x29dd65={'raw':![],'where':{'id':_0x2547ff[_0x3b07('0x5b')]['id']},'include':[{'model':db[_0x3b07('0x5c')],'as':_0x3b07('0x5d')}]},_0x40c758={};_0x40c758['model']=_['keys'](db[_0x3b07('0x54')][_0x3b07('0x40')]);_0x40c758[_0x3b07('0x45')]=_[_0x3b07('0x46')](_0x2547ff['query']);_0x40c758[_0x3b07('0x5e')]=_[_0x3b07('0x47')](_0x40c758[_0x3b07('0x44')],_0x40c758[_0x3b07('0x45')]);_0x29dd65[_0x3b07('0x49')]=_[_0x3b07('0x47')](_0x40c758[_0x3b07('0x44')],qs[_0x3b07('0x48')](_0x2547ff['query'][_0x3b07('0x48')]));_0x29dd65[_0x3b07('0x49')]=_0x29dd65[_0x3b07('0x49')][_0x3b07('0x4a')]?_0x29dd65[_0x3b07('0x49')]:_0x40c758['model'];if(_0x2547ff[_0x3b07('0x45')]['includeAll']){_0x29dd65[_0x3b07('0x56')]=[{'all':!![]}];}_0x29dd65=_['merge']({},_0x29dd65,_0x2547ff[_0x3b07('0x53')]);return db[_0x3b07('0x54')]['find'](_0x29dd65)[_0x3b07('0x22')](handleEntityNotFound(_0x515c8b,null))[_0x3b07('0x22')](respondWithResult(_0x515c8b,null))[_0x3b07('0x59')](handleError(_0x515c8b,null));};exports['create']=function(_0x324a5d,_0x2de889){return db[_0x3b07('0x54')]['create'](_0x324a5d['body'],{})[_0x3b07('0x22')](function(_0x315c7e){var _0x37a282=_0x324a5d[_0x3b07('0x5f')][_0x3b07('0x3a')]({'plain':!![]});if(!_0x37a282)throw new Error(_0x3b07('0x60'));if(_0x37a282[_0x3b07('0x61')]==='user'){var _0x2dd324=_0x315c7e[_0x3b07('0x3a')]({'plain':!![]});var _0x5769db=_0x3b07('0x62');return db[_0x3b07('0x63')][_0x3b07('0x64')]({'where':{'name':_0x5769db,'userProfileId':_0x37a282[_0x3b07('0x65')]},'raw':!![]})[_0x3b07('0x22')](function(_0x3661f7){if(_0x3661f7&&_0x3661f7['autoAssociation']===0x0){return db[_0x3b07('0x66')][_0x3b07('0x67')]({'name':_0x2dd324[_0x3b07('0x3c')],'resourceId':_0x2dd324['id'],'type':_0x3661f7[_0x3b07('0x3c')],'sectionId':_0x3661f7['id']},{})['then'](function(){return _0x315c7e;});}else{return _0x315c7e;}})[_0x3b07('0x59')](function(_0x2cb01f){logger[_0x3b07('0x26')](_0x3b07('0x68'),_0x2cb01f);throw _0x2cb01f;});}return _0x315c7e;})['then'](respondWithResult(_0x2de889,0xc9))['catch'](handleError(_0x2de889,null));};exports['update']=function(_0x592a82,_0x3d9b32){if(_0x592a82['body']['id']){delete _0x592a82[_0x3b07('0x69')]['id'];}return db[_0x3b07('0x54')][_0x3b07('0x64')]({'where':{'id':_0x592a82[_0x3b07('0x5b')]['id']},'include':[{'model':db[_0x3b07('0x5c')],'as':_0x3b07('0x5d')}]})[_0x3b07('0x22')](handleEntityNotFound(_0x3d9b32,null))['then'](saveUpdates(_0x592a82[_0x3b07('0x69')],null))[_0x3b07('0x22')](respondWithResult(_0x3d9b32,null))['catch'](handleError(_0x3d9b32,null));};exports[_0x3b07('0x39')]=function(_0x108bfe,_0x3da832){return db[_0x3b07('0x54')][_0x3b07('0x64')]({'where':{'id':_0x108bfe['params']['id']}})[_0x3b07('0x22')](handleEntityNotFound(_0x3da832,null))[_0x3b07('0x22')](removeEntity(_0x3da832,null))['catch'](handleError(_0x3da832,null));};exports[_0x3b07('0x6a')]=function(_0x2eadfb,_0x482461){return db['OpenchannelAccount'][_0x3b07('0x6a')]()['then'](respondWithResult(_0x482461,null))[_0x3b07('0x59')](handleError(_0x482461,null));};exports[_0x3b07('0x6b')]=function(_0x39f9fc,_0x83e042,_0x33e5f6){if(_0x39f9fc[_0x3b07('0x69')]['id']){delete _0x39f9fc['body']['id'];}return db['OpenchannelAccount'][_0x3b07('0x64')]({'where':{'id':_0x39f9fc['params']['id']}})[_0x3b07('0x22')](handleEntityNotFound(_0x83e042,null))[_0x3b07('0x22')](function(_0x129950){if(_0x129950){_0x39f9fc['body']['OpenchannelAccountId']=_0x129950['id'];return db[_0x3b07('0x6c')][_0x3b07('0x67')](_0x39f9fc[_0x3b07('0x69')]);}})[_0x3b07('0x22')](respondWithResult(_0x83e042,null))['catch'](handleError(_0x83e042,null));};exports[_0x3b07('0x6d')]=function(_0x2afeaf,_0x547bbb,_0x5c3d4a){var _0x3956e7={'raw':![],'where':{}};var _0x333d16={};var _0x5b8889={'count':0x0,'rows':[]};return db[_0x3b07('0x54')][_0x3b07('0x6e')]({'where':{'id':_0x2afeaf['params']['id']}})[_0x3b07('0x22')](handleEntityNotFound(_0x547bbb,null))[_0x3b07('0x22')](function(_0x45726a){if(_0x45726a){_0x333d16[_0x3b07('0x44')]=_[_0x3b07('0x46')](db[_0x3b07('0x6c')]['rawAttributes']);_0x333d16[_0x3b07('0x45')]=_[_0x3b07('0x46')](_0x2afeaf[_0x3b07('0x45')]);_0x333d16[_0x3b07('0x5e')]=_['intersection'](_0x333d16[_0x3b07('0x44')],_0x333d16[_0x3b07('0x45')]);_0x3956e7[_0x3b07('0x49')]=_[_0x3b07('0x47')](_0x333d16['model'],qs['fields'](_0x2afeaf['query'][_0x3b07('0x48')]));_0x3956e7[_0x3b07('0x49')]=_0x3956e7[_0x3b07('0x49')]['length']?_0x3956e7['attributes']:_0x333d16['model'];if(!_0x2afeaf[_0x3b07('0x45')][_0x3b07('0x4b')](_0x3b07('0x4c'))){_0x3956e7[_0x3b07('0x2f')]=qs[_0x3b07('0x2f')](_0x2afeaf[_0x3b07('0x45')][_0x3b07('0x2f')]);_0x3956e7[_0x3b07('0x32')]=qs[_0x3b07('0x32')](_0x2afeaf[_0x3b07('0x45')][_0x3b07('0x32')]);}_0x3956e7[_0x3b07('0x4d')]=qs['sort'](_0x2afeaf[_0x3b07('0x45')][_0x3b07('0x4e')]);_0x3956e7['where']=qs[_0x3b07('0x5e')](_[_0x3b07('0x50')](_0x2afeaf[_0x3b07('0x45')],_0x333d16[_0x3b07('0x5e')]));_0x3956e7[_0x3b07('0x4f')]['OpenchannelAccountId']=_0x45726a['id'];if(_0x2afeaf[_0x3b07('0x45')][_0x3b07('0x51')]){_0x3956e7[_0x3b07('0x4f')]=_['merge'](_0x3956e7[_0x3b07('0x4f')],{'$or':_[_0x3b07('0x3f')](_0x3956e7['attributes'],function(_0x5db046){var _0xe4e6f3={};_0xe4e6f3[_0x5db046]={'$like':'%'+_0x2afeaf[_0x3b07('0x45')][_0x3b07('0x51')]+'%'};return _0xe4e6f3;})});}_0x3956e7=_[_0x3b07('0x52')]({},_0x3956e7,_0x2afeaf['options']);return db['Disposition']['count']({'where':_0x3956e7['where']})[_0x3b07('0x22')](function(_0x2e9afb){_0x5b8889[_0x3b07('0x31')]=_0x2e9afb;if(_0x2afeaf[_0x3b07('0x45')][_0x3b07('0x55')]){_0x3956e7[_0x3b07('0x56')]=[{'all':!![]}];}return db[_0x3b07('0x6c')][_0x3b07('0x57')](_0x3956e7);})['then'](function(_0x56b55b){_0x5b8889[_0x3b07('0x58')]=_0x56b55b;return _0x5b8889;});}})[_0x3b07('0x22')](respondWithFilteredResult(_0x547bbb,_0x3956e7))[_0x3b07('0x59')](handleError(_0x547bbb,null));};exports[_0x3b07('0x6f')]=function(_0x49cc0b,_0x3bdb53,_0x55a8dd){return db[_0x3b07('0x54')][_0x3b07('0x64')]({'where':{'id':_0x49cc0b['params']['id']}})[_0x3b07('0x22')](handleEntityNotFound(_0x3bdb53,null))['then'](function(_0x3ea077){if(_0x3ea077){return _0x3ea077[_0x3b07('0x6f')](_0x49cc0b['query'][_0x3b07('0x70')]);}})[_0x3b07('0x22')](respondWithStatusCode(_0x3bdb53,null))[_0x3b07('0x59')](handleError(_0x3bdb53,null));};exports[_0x3b07('0x71')]=function(_0x5d2424,_0x2753e1,_0x53cdb1){if(_0x5d2424[_0x3b07('0x69')]['id']){delete _0x5d2424[_0x3b07('0x69')]['id'];}return db[_0x3b07('0x54')][_0x3b07('0x64')]({'where':{'id':_0x5d2424['params']['id']}})[_0x3b07('0x22')](handleEntityNotFound(_0x2753e1,null))[_0x3b07('0x22')](function(_0x3f00d1){if(_0x3f00d1){_0x5d2424[_0x3b07('0x69')][_0x3b07('0x72')]=_0x3f00d1['id'];return db[_0x3b07('0x73')][_0x3b07('0x67')](_0x5d2424['body']);}})[_0x3b07('0x22')](respondWithResult(_0x2753e1,null))[_0x3b07('0x59')](handleError(_0x2753e1,null));};exports['getAnswers']=function(_0xa2427d,_0x3a600c,_0x22ee9a){var _0x4ad9a6={'raw':![],'where':{}};var _0x507b13={};var _0x999e55={'count':0x0,'rows':[]};return db[_0x3b07('0x54')][_0x3b07('0x6e')]({'where':{'id':_0xa2427d['params']['id']}})[_0x3b07('0x22')](handleEntityNotFound(_0x3a600c,null))[_0x3b07('0x22')](function(_0x345193){if(_0x345193){_0x507b13[_0x3b07('0x44')]=_[_0x3b07('0x46')](db[_0x3b07('0x73')][_0x3b07('0x40')]);_0x507b13[_0x3b07('0x45')]=_['keys'](_0xa2427d[_0x3b07('0x45')]);_0x507b13[_0x3b07('0x5e')]=_[_0x3b07('0x47')](_0x507b13[_0x3b07('0x44')],_0x507b13['query']);_0x4ad9a6[_0x3b07('0x49')]=_[_0x3b07('0x47')](_0x507b13['model'],qs['fields'](_0xa2427d[_0x3b07('0x45')][_0x3b07('0x48')]));_0x4ad9a6[_0x3b07('0x49')]=_0x4ad9a6[_0x3b07('0x49')]['length']?_0x4ad9a6[_0x3b07('0x49')]:_0x507b13[_0x3b07('0x44')];if(!_0xa2427d[_0x3b07('0x45')][_0x3b07('0x4b')](_0x3b07('0x4c'))){_0x4ad9a6['limit']=qs['limit'](_0xa2427d[_0x3b07('0x45')][_0x3b07('0x2f')]);_0x4ad9a6[_0x3b07('0x32')]=qs[_0x3b07('0x32')](_0xa2427d[_0x3b07('0x45')][_0x3b07('0x32')]);}_0x4ad9a6[_0x3b07('0x4d')]=qs[_0x3b07('0x4e')](_0xa2427d[_0x3b07('0x45')]['sort']);_0x4ad9a6['where']=qs[_0x3b07('0x5e')](_[_0x3b07('0x50')](_0xa2427d[_0x3b07('0x45')],_0x507b13[_0x3b07('0x5e')]));_0x4ad9a6['where'][_0x3b07('0x72')]=_0x345193['id'];if(_0xa2427d['query'][_0x3b07('0x51')]){_0x4ad9a6[_0x3b07('0x4f')]=_[_0x3b07('0x52')](_0x4ad9a6['where'],{'$or':_[_0x3b07('0x3f')](_0x4ad9a6[_0x3b07('0x49')],function(_0x2d3e04){var _0x35584d={};_0x35584d[_0x2d3e04]={'$like':'%'+_0xa2427d[_0x3b07('0x45')][_0x3b07('0x51')]+'%'};return _0x35584d;})});}_0x4ad9a6=_['merge']({},_0x4ad9a6,_0xa2427d[_0x3b07('0x53')]);return db[_0x3b07('0x73')][_0x3b07('0x31')]({'where':_0x4ad9a6[_0x3b07('0x4f')]})[_0x3b07('0x22')](function(_0x1d0d84){_0x999e55[_0x3b07('0x31')]=_0x1d0d84;if(_0xa2427d[_0x3b07('0x45')][_0x3b07('0x55')]){_0x4ad9a6[_0x3b07('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0x3b07('0x57')](_0x4ad9a6);})[_0x3b07('0x22')](function(_0x291083){_0x999e55[_0x3b07('0x58')]=_0x291083;return _0x999e55;});}})[_0x3b07('0x22')](respondWithFilteredResult(_0x3a600c,_0x4ad9a6))[_0x3b07('0x59')](handleError(_0x3a600c,null));};exports[_0x3b07('0x74')]=function(_0x4c708a,_0x3c2711,_0x4d2f65){return db['OpenchannelAccount'][_0x3b07('0x64')]({'where':{'id':_0x4c708a[_0x3b07('0x5b')]['id']}})[_0x3b07('0x22')](handleEntityNotFound(_0x3c2711,null))[_0x3b07('0x22')](function(_0xb8e23a){if(_0xb8e23a){return _0xb8e23a[_0x3b07('0x74')](_0x4c708a[_0x3b07('0x45')][_0x3b07('0x70')]);}})[_0x3b07('0x22')](respondWithStatusCode(_0x3c2711,null))[_0x3b07('0x59')](handleError(_0x3c2711,null));};exports['notify']=function(_0x48e0f8,_0x3e940e,_0x2b0b76){var _0x234ee3={'body':_0x48e0f8[_0x3b07('0x69')],'channel':_0x3b07('0x75')};var _0x2b937c=[];var _0x2745bf=[];var _0x22a3f3={};var _0x17258d=![];return db[_0x3b07('0x76')][_0x3b07('0x6a')]()[_0x3b07('0x22')](function(_0x100e45){if(!_0x100e45){throw new db[(_0x3b07('0x77'))]['ValidationError'](_0x3b07('0x78'));}_0x2b937c=_['difference'](_['keys'](_0x100e45),[_0x3b07('0x79'),_0x3b07('0x7a')]);_0x2745bf=_[_0x3b07('0x7b')](_[_0x3b07('0x46')](_0x100e45),[_0x3b07('0x79'),'updatedAt',_0x3b07('0x7c'),_0x3b07('0x7d')]);if(_0x48e0f8['body']['id']){delete _0x48e0f8[_0x3b07('0x69')]['id'];}if(_['isNil'](_0x48e0f8['body'][_0x3b07('0x7e')])){throw new db[(_0x3b07('0x77'))][(_0x3b07('0x7f'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x48e0f8[_0x3b07('0x69')]['body'])||_0x48e0f8[_0x3b07('0x69')][_0x3b07('0x69')]===''){throw new db['Sequelize'][(_0x3b07('0x7f'))](_0x3b07('0x80'));}if(_[_0x3b07('0x81')](_0x48e0f8[_0x3b07('0x69')]['mapKey'])){throw new db[(_0x3b07('0x77'))][(_0x3b07('0x7f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2745bf);}if(!_['includes'](_0x2745bf,_0x48e0f8['body'][_0x3b07('0x82')])){throw new db[(_0x3b07('0x77'))][(_0x3b07('0x7f'))](_0x3b07('0x83')+_0x2745bf);}_0x22a3f3[_0x48e0f8[_0x3b07('0x69')][_0x3b07('0x82')]]=_0x48e0f8[_0x3b07('0x69')][_0x3b07('0x7e')];})[_0x3b07('0x22')](function(){return db[_0x3b07('0x54')]['find']({'where':{'id':_0x48e0f8[_0x3b07('0x5b')]['id']},'include':[{'model':db[_0x3b07('0x84')],'as':_0x3b07('0x85'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x22a3f3,'limit':0x1,'order':[['updatedAt',_0x3b07('0x86')]]}]},{'model':db[_0x3b07('0x87')],'as':'Applications'}]});})[_0x3b07('0x22')](handleEntityNotFound(_0x3e940e,null))[_0x3b07('0x22')](function(_0x468b79){if(_0x468b79&&_0x468b79['List']){_0x234ee3[_0x3b07('0x88')]=_0x468b79;_0x234ee3[_0x3b07('0x89')]=_0x468b79[_0x3b07('0x8a')];_0x234ee3[_0x3b07('0x8b')]=_0x468b79[_0x3b07('0x85')];_0x234ee3[_0x3b07('0x89')]=_[_0x3b07('0x8c')](_0x234ee3[_0x3b07('0x89')],[_0x3b07('0x8d')],[_0x3b07('0x8e')]);if(_0x234ee3['account'][_0x3b07('0x8a')]){delete _0x234ee3['account'][_0x3b07('0x8a')];}if(_0x234ee3['account'][_0x3b07('0x85')]&&_0x234ee3['account']['List'][_0x3b07('0x8f')][_0x3b07('0x4a')]){return _0x234ee3[_0x3b07('0x88')][_0x3b07('0x85')][_0x3b07('0x8f')][0x0];}var _0x2b6559=_[_0x3b07('0x1a')](_0x48e0f8[_0x3b07('0x69')],{'firstName':_0x48e0f8[_0x3b07('0x69')][_0x3b07('0x7e')],'ListId':_0x468b79[_0x3b07('0x7d')]});_0x2b6559[_0x48e0f8['body'][_0x3b07('0x82')]]=_0x48e0f8[_0x3b07('0x69')][_0x3b07('0x7e')];return db[_0x3b07('0x76')][_0x3b07('0x67')](_0x2b6559,{'fields':_0x2b937c,'raw':!![]});}})[_0x3b07('0x22')](handleEntityNotFound(_0x3e940e,null))['then'](function(_0x567bbf){_0x234ee3['contact']=_0x567bbf;if(_0x567bbf){var _0x6ae3e1={'ContactId':_0x567bbf['id'],'OpenchannelAccountId':_0x48e0f8[_0x3b07('0x5b')]['id'],'from':(_0x567bbf['firstName']||'')+'\x20'+(_0x567bbf[_0x3b07('0x90')]||'')};var _0x25afae={'OpenchannelAccountId':_0x48e0f8[_0x3b07('0x5b')]['id'],'closed':![]};if(_0x48e0f8[_0x3b07('0x69')][_0x3b07('0x91')]){_0x25afae[_0x3b07('0x91')]=_0x48e0f8[_0x3b07('0x69')][_0x3b07('0x91')];return db[_0x3b07('0x92')][_0x3b07('0x64')]({'where':_0x25afae})[_0x3b07('0x22')](function(_0xea229d){if(_0xea229d){return[_0xea229d,![]];}_0x6ae3e1[_0x3b07('0x91')]=_0x48e0f8['body'][_0x3b07('0x91')];_0x6ae3e1[_0x3b07('0x93')]=_0x48e0f8[_0x3b07('0x69')][_0x3b07('0x93')];return db[_0x3b07('0x92')]['create'](_0x6ae3e1)[_0x3b07('0x22')](function(_0x3943ed){return[_0x3943ed,!![]];});});}else{_0x25afae['threadId']=null;}_0x25afae[_0x3b07('0x94')]=_0x567bbf['id'];return db[_0x3b07('0x92')][_0x3b07('0x64')]({'where':_0x25afae})['then'](function(_0x2869d0){if(_0x2869d0){return[_0x2869d0,![]];}return db[_0x3b07('0x92')]['create'](_0x6ae3e1)[_0x3b07('0x22')](function(_0x221bb6){return[_0x221bb6,!![]];});});}})[_0x3b07('0x95')](function(_0x45bc34,_0x48125e){if(_0x45bc34){_0x17258d=_0x48125e;if(!_0x48125e){var _0x4fcf9a={'from':(_0x234ee3[_0x3b07('0x96')]['firstName']||'')+'\x20'+(_0x234ee3[_0x3b07('0x96')][_0x3b07('0x90')]||'')};if(_0x48e0f8[_0x3b07('0x69')]['threadId']&&_0x48e0f8[_0x3b07('0x69')][_0x3b07('0x97')]&&_0x48e0f8['body'][_0x3b07('0x91')]!=_0x48e0f8[_0x3b07('0x69')][_0x3b07('0x97')]){_0x4fcf9a[_0x3b07('0x91')]=_0x48e0f8['body'][_0x3b07('0x97')];}return _0x45bc34['update'](_0x4fcf9a);}else{return _0x45bc34;}}})[_0x3b07('0x22')](function(_0x2fa7f2){_0x234ee3[_0x3b07('0x98')]=_0x2fa7f2[_0x3b07('0x3a')]({'plain':!![]});_0x234ee3[_0x3b07('0x98')][_0x3b07('0x99')]=_0x17258d;if(_0x234ee3[_0x3b07('0x98')]['created']){if(_0x234ee3[_0x3b07('0x88')][_0x3b07('0x9a')]){_0x234ee3['applications'][_0x3b07('0x9b')]({'id':0x0,'priority':_0x234ee3[_0x3b07('0x89')][_0x3b07('0x4a')]+0x1,'app':_0x3b07('0x9c'),'appdata':_0x3b07('0x9d'),'interval':'*,*,*,*'});}}return db[_0x3b07('0x9e')][_0x3b07('0x67')]({'body':_0x48e0f8[_0x3b07('0x69')][_0x3b07('0x69')],'OpenchannelAccountId':_0x48e0f8['params']['id'],'OpenchannelInteractionId':_0x2fa7f2['id'],'direction':'in','ContactId':_0x234ee3[_0x3b07('0x96')]['id'],'AttachmentId':_0x48e0f8[_0x3b07('0x69')]['AttachmentId']});})[_0x3b07('0x22')](function(_0x2a829b){_0x234ee3['message']=_0x2a829b;if(!_0x234ee3[_0x3b07('0x98')]['UserId'])return;return db[_0x3b07('0x9f')][_0x3b07('0x64')]({'attributes':['id',_0x3b07('0x3c')],'where':{'id':_0x234ee3['interaction'][_0x3b07('0xa0')]}});})['then'](function(_0x17b838){if(_0x17b838){_0x234ee3['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x3b07('0xa1'),'appdata':_0x17b838[_0x3b07('0x3c')]+','+(_0x234ee3[_0x3b07('0x88')][_0x3b07('0xa2')]||0xa),'interval':'*,*,*,*'});}if(!_0x234ee3[_0x3b07('0x98')]['queueId'])return;return db[_0x3b07('0xa3')]['find']({'attributes':['id',_0x3b07('0x3c')],'where':{'id':_0x234ee3[_0x3b07('0x98')]['queueId']}});})[_0x3b07('0x22')](function(_0xc5fa8e){if(_0xc5fa8e){_0x234ee3[_0x3b07('0x89')]['unshift']({'id':0x0,'priority':0x1,'app':_0x3b07('0xa4'),'appdata':_0xc5fa8e[_0x3b07('0x3c')]+','+(_0x234ee3[_0x3b07('0x88')][_0x3b07('0xa5')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x3b07('0xa6'),_0x234ee3);})[_0x3b07('0x22')](function(_0x2502dc){respondWithRpcPromise(_0x3b07('0xa7'),_0x3b07('0xa7'),{'event':'notify','message':_0x2502dc},client9002);return _0x2502dc;})['then'](respondWithResult(_0x3e940e,null))['catch'](handleError(_0x3e940e,null));};exports[_0x3b07('0xa8')]=function(_0x36b7fb,_0x4a9655){var _0x20c7c7=_0x36b7fb[_0x3b07('0x5b')]['id'];var _0x47b1ce=_0x36b7fb['body'];var _0x332dd4=0xc8;var _0x8b5873=null;return db['sequelize'][_0x3b07('0xa9')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x2d98e9){return db[_0x3b07('0x54')]['findOne']({'where':{'id':_0x20c7c7},'transaction':_0x2d98e9})[_0x3b07('0x22')](function(_0x4198fc){if(_0x4198fc){return db[_0x3b07('0x87')][_0x3b07('0x39')]({'where':{'OpenchannelAccountId':_0x20c7c7},'transaction':_0x2d98e9})[_0x3b07('0x22')](function(){var _0x1db517=_[_0x3b07('0x3f')](_0x47b1ce,function(_0x49f6d3){_0x49f6d3[_0x3b07('0x72')]=_0x20c7c7;return _0x49f6d3;});return db[_0x3b07('0x87')][_0x3b07('0xaa')](_0x1db517,{'transaction':_0x2d98e9});});}else{_0x332dd4=0x194;_0x8b5873=[];}});})['then'](function(){if(_0x332dd4!==0x194){return db[_0x3b07('0x87')][_0x3b07('0xab')]({'where':{'OpenchannelAccountId':_0x20c7c7},'order':_0x3b07('0x8d')})[_0x3b07('0x22')](function(_0x20de83){_0x8b5873=_0x20de83;});}})[_0x3b07('0x59')](function(_0x2ce993){_0x332dd4=0x1f4;logger['error'](_0x2ce993[_0x3b07('0x3b')]);if(_0x2ce993[_0x3b07('0x3c')]){delete _0x2ce993[_0x3b07('0x3c')];}_0x8b5873=_0x2ce993;})['finally'](function(){if(_0x8b5873===null){_0x4a9655[_0x3b07('0x2b')](_0x332dd4);}else{if(_0x332dd4===0x1f4){_0x4a9655[_0x3b07('0x2c')](_0x332dd4)[_0x3b07('0x3d')](_0x8b5873);}else{_0x4a9655[_0x3b07('0x2c')](_0x332dd4)[_0x3b07('0x2e')](_0x8b5873);}}});};exports[_0x3b07('0xac')]=function(_0x145100,_0x7f36b,_0x31ce81){var _0xc150c1={};var _0xfdb597={};var _0x2795e7;var _0xb341e7;return db['OpenchannelAccount'][_0x3b07('0x6e')]({'where':{'id':_0x145100[_0x3b07('0x5b')]['id']}})[_0x3b07('0x22')](handleEntityNotFound(_0x7f36b,null))['then'](function(_0x5e2f0f){if(_0x5e2f0f){_0x2795e7=_0x5e2f0f;_0xfdb597[_0x3b07('0x44')]=_[_0x3b07('0x46')](db[_0x3b07('0x87')][_0x3b07('0x40')]);_0xfdb597[_0x3b07('0x45')]=_['keys'](_0x145100[_0x3b07('0x45')]);_0xfdb597[_0x3b07('0x5e')]=_['intersection'](_0xfdb597[_0x3b07('0x44')],_0xfdb597[_0x3b07('0x45')]);_0xc150c1[_0x3b07('0x49')]=_[_0x3b07('0x47')](_0xfdb597[_0x3b07('0x44')],qs['fields'](_0x145100[_0x3b07('0x45')]['fields']));_0xc150c1[_0x3b07('0x49')]=_0xc150c1['attributes'][_0x3b07('0x4a')]?_0xc150c1[_0x3b07('0x49')]:_0xfdb597['model'];_0xc150c1[_0x3b07('0x4d')]=qs[_0x3b07('0x4e')](_0x145100['query'][_0x3b07('0x4e')]);_0xc150c1['where']=qs[_0x3b07('0x5e')](_[_0x3b07('0x50')](_0x145100[_0x3b07('0x45')],_0xfdb597['filters']));if(_0x145100['query'][_0x3b07('0x51')]){_0xc150c1['where']=_['merge'](_0xc150c1[_0x3b07('0x4f')],{'$or':_[_0x3b07('0x3f')](_0xc150c1[_0x3b07('0x49')],function(_0xd1b34c){var _0x494e03={};_0x494e03[_0xd1b34c]={'$like':'%'+_0x145100[_0x3b07('0x45')]['filter']+'%'};return _0x494e03;})});}_0xc150c1=_['merge']({},_0xc150c1,_0x145100['options']);return _0x2795e7[_0x3b07('0xac')](_0xc150c1);}})[_0x3b07('0x22')](function(_0x2b6dea){if(_0x2b6dea){_0xb341e7=_0x2b6dea[_0x3b07('0x4a')];if(!_0x145100[_0x3b07('0x45')][_0x3b07('0x4b')](_0x3b07('0x4c'))){_0xc150c1['limit']=qs['limit'](_0x145100[_0x3b07('0x45')]['limit']);_0xc150c1[_0x3b07('0x32')]=qs['offset'](_0x145100[_0x3b07('0x45')]['offset']);}return _0x2795e7['getApplications'](_0xc150c1);}})[_0x3b07('0x22')](function(_0x2f1bb5){if(_0x2f1bb5){return _0x2f1bb5?{'count':_0xb341e7,'rows':_0x2f1bb5}:null;}})['then'](respondWithResult(_0x7f36b,null))['catch'](handleError(_0x7f36b,null));};exports[_0x3b07('0xad')]=function(_0xa6156a,_0x232460,_0xc67821){var _0x191776={'raw':![],'where':{}};var _0x5a5637={};var _0x209716={'count':0x0,'rows':[]};return db[_0x3b07('0x54')][_0x3b07('0x6e')]({'where':{'id':_0xa6156a[_0x3b07('0x5b')]['id']}})['then'](handleEntityNotFound(_0x232460,null))[_0x3b07('0x22')](function(_0x1c9eef){if(_0x1c9eef){_0x5a5637[_0x3b07('0x44')]=_['keys'](db['OpenchannelInteraction'][_0x3b07('0x40')]);_0x5a5637[_0x3b07('0x45')]=_[_0x3b07('0x46')](_0xa6156a['query']);_0x5a5637['filters']=_[_0x3b07('0x47')](_0x5a5637[_0x3b07('0x44')],_0x5a5637['query']);_0x191776[_0x3b07('0x49')]=_[_0x3b07('0x47')](_0x5a5637[_0x3b07('0x44')],qs[_0x3b07('0x48')](_0xa6156a[_0x3b07('0x45')][_0x3b07('0x48')]));_0x191776[_0x3b07('0x49')]=_0x191776['attributes'][_0x3b07('0x4a')]?_0x191776['attributes']:_0x5a5637[_0x3b07('0x44')];if(!_0xa6156a[_0x3b07('0x45')][_0x3b07('0x4b')]('nolimit')){_0x191776[_0x3b07('0x2f')]=qs[_0x3b07('0x2f')](_0xa6156a['query'][_0x3b07('0x2f')]);_0x191776[_0x3b07('0x32')]=qs[_0x3b07('0x32')](_0xa6156a[_0x3b07('0x45')][_0x3b07('0x32')]);}_0x191776[_0x3b07('0x4d')]=qs[_0x3b07('0x4e')](_0xa6156a[_0x3b07('0x45')][_0x3b07('0x4e')]);_0x191776[_0x3b07('0x4f')]=qs[_0x3b07('0x5e')](_[_0x3b07('0x50')](_0xa6156a[_0x3b07('0x45')],_0x5a5637['filters']));_0x191776[_0x3b07('0x4f')][_0x3b07('0x72')]=_0x1c9eef['id'];if(_0xa6156a[_0x3b07('0x45')][_0x3b07('0x51')]){_0x191776[_0x3b07('0x4f')]=_[_0x3b07('0x52')](_0x191776[_0x3b07('0x4f')],{'$or':_['map'](_0x191776[_0x3b07('0x49')],function(_0x3335f7){var _0x2dddad={};_0x2dddad[_0x3335f7]={'$like':'%'+_0xa6156a[_0x3b07('0x45')]['filter']+'%'};return _0x2dddad;})});}_0x191776=_[_0x3b07('0x52')]({},_0x191776,_0xa6156a[_0x3b07('0x53')]);return db['OpenchannelInteraction'][_0x3b07('0x31')]({'where':_0x191776[_0x3b07('0x4f')]})[_0x3b07('0x22')](function(_0x36f032){_0x209716[_0x3b07('0x31')]=_0x36f032;if(_0xa6156a[_0x3b07('0x45')]['includeAll']){_0x191776[_0x3b07('0x56')]=[{'model':db['CmContact'],'as':_0x3b07('0xae'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x3b07('0x3c'),_0x3b07('0xaf'),_0x3b07('0xb0')],'required':![]},{'model':db[_0x3b07('0xb1')],'as':_0x3b07('0xb2'),'attributes':['id',_0x3b07('0x3c'),_0x3b07('0xb3')],'where':_0xa6156a['query']['tag']?{'id':_0xa6156a['query'][_0x3b07('0xb4')]}:undefined,'required':_0xa6156a['query'][_0x3b07('0xb4')]?!![]:![]}];}return db[_0x3b07('0x92')][_0x3b07('0x57')](_0x191776);})['then'](function(_0x26a70a){_0x209716[_0x3b07('0x58')]=_0x26a70a;return _0x209716;});}})['then'](respondWithFilteredResult(_0x232460,_0x191776))[_0x3b07('0x59')](handleError(_0x232460,null));};exports['addAgents']=function(_0x253cd0,_0x549713,_0x3a6ceb){return db[_0x3b07('0x54')][_0x3b07('0x64')]({'where':{'id':_0x253cd0['params']['id']}})['then'](handleEntityNotFound(_0x549713,null))[_0x3b07('0x22')](function(_0x13530d){if(_0x13530d){return _0x13530d[_0x3b07('0xb5')](_0x253cd0['body'][_0x3b07('0x70')],_['omit'](_0x253cd0[_0x3b07('0x69')],[_0x3b07('0x70'),'id'])||{})[_0x3b07('0x95')](function(_0x3fccbe){for(var _0x2b3536=0x0;_0x2b3536<_0x253cd0['body'][_0x3b07('0x70')]['length'];_0x2b3536+=0x1){socket[_0x3b07('0xb6')]('userOpenchannelAccount:save',{'UserId':Number(_0x253cd0[_0x3b07('0x69')][_0x3b07('0x70')][_0x2b3536]),'OpenchannelAccountId':Number(_0x253cd0[_0x3b07('0x5b')]['id'])});}return _0x3fccbe;});}})['then'](respondWithResult(_0x549713,null))[_0x3b07('0x59')](handleError(_0x549713,null));};exports[_0x3b07('0xb7')]=function(_0x1c6248,_0x455bbf,_0x28ebc2){return db[_0x3b07('0x54')]['find']({'where':{'id':_0x1c6248[_0x3b07('0x5b')]['id']}})['then'](handleEntityNotFound(_0x455bbf,null))[_0x3b07('0x22')](function(_0xba5258){if(_0xba5258){return _0xba5258[_0x3b07('0xb7')](_0x1c6248[_0x3b07('0x45')][_0x3b07('0x70')])[_0x3b07('0x22')](function(){if(_[_0x3b07('0xb8')](_0x1c6248[_0x3b07('0x45')][_0x3b07('0x70')])){for(var _0x24b6f9=0x0;_0x24b6f9<_0x1c6248[_0x3b07('0x45')][_0x3b07('0x70')]['length'];_0x24b6f9+=0x1){socket['emit'](_0x3b07('0xb9'),{'UserId':Number(_0x1c6248['query'][_0x3b07('0x70')][_0x24b6f9]),'OpenchannelAccountId':Number(_0x1c6248['params']['id'])});}}else{socket[_0x3b07('0xb6')]('userOpenchannelAccount:remove',{'UserId':Number(_0x1c6248['query'][_0x3b07('0x70')]),'OpenchannelAccountId':Number(_0x1c6248[_0x3b07('0x5b')]['id'])});}});}})[_0x3b07('0x22')](respondWithStatusCode(_0x455bbf,null))['catch'](handleError(_0x455bbf,null));};exports['getAgents']=function(_0x428c0c,_0x396729,_0x3d65c5){var _0x293da7={};var _0x21a96a={};var _0x5b5d59;var _0x49a224;return db['OpenchannelAccount'][_0x3b07('0x6e')]({'where':{'id':_0x428c0c[_0x3b07('0x5b')]['id']}})[_0x3b07('0x22')](handleEntityNotFound(_0x396729,null))['then'](function(_0x2eb10c){if(_0x2eb10c){_0x5b5d59=_0x2eb10c;_0x21a96a[_0x3b07('0x44')]=_[_0x3b07('0x46')](db[_0x3b07('0x9f')]['rawAttributes']);_0x21a96a[_0x3b07('0x45')]=_[_0x3b07('0x46')](_0x428c0c[_0x3b07('0x45')]);_0x21a96a[_0x3b07('0x5e')]=_[_0x3b07('0x47')](_0x21a96a[_0x3b07('0x44')],_0x21a96a[_0x3b07('0x45')]);_0x293da7[_0x3b07('0x49')]=_[_0x3b07('0x47')](_0x21a96a[_0x3b07('0x44')],qs[_0x3b07('0x48')](_0x428c0c['query']['fields']));_0x293da7[_0x3b07('0x49')]=_0x293da7[_0x3b07('0x49')][_0x3b07('0x4a')]?_0x293da7[_0x3b07('0x49')]:_0x21a96a['model'];_0x293da7[_0x3b07('0x4d')]=qs[_0x3b07('0x4e')](_0x428c0c[_0x3b07('0x45')][_0x3b07('0x4e')]);_0x293da7[_0x3b07('0x4f')]=qs[_0x3b07('0x5e')](_[_0x3b07('0x50')](_0x428c0c['query'],_0x21a96a[_0x3b07('0x5e')]));if(_0x428c0c[_0x3b07('0x45')][_0x3b07('0x51')]){_0x293da7[_0x3b07('0x4f')]=_[_0x3b07('0x52')](_0x293da7[_0x3b07('0x4f')],{'$or':_['map'](_0x293da7[_0x3b07('0x49')],function(_0x10bcee){var _0x5b5424={};_0x5b5424[_0x10bcee]={'$like':'%'+_0x428c0c[_0x3b07('0x45')]['filter']+'%'};return _0x5b5424;})});}_0x293da7=_['merge']({},_0x293da7,_0x428c0c[_0x3b07('0x53')]);return _0x5b5d59[_0x3b07('0xba')](_0x293da7);}})[_0x3b07('0x22')](function(_0x494c91){if(_0x494c91){_0x49a224=_0x494c91['length'];if(!_0x428c0c[_0x3b07('0x45')]['hasOwnProperty'](_0x3b07('0x4c'))){_0x293da7['limit']=qs['limit'](_0x428c0c[_0x3b07('0x45')][_0x3b07('0x2f')]);_0x293da7[_0x3b07('0x32')]=qs[_0x3b07('0x32')](_0x428c0c[_0x3b07('0x45')][_0x3b07('0x32')]);}return _0x5b5d59[_0x3b07('0xba')](_0x293da7);}})[_0x3b07('0x22')](function(_0x388d88){if(_0x388d88){return _0x388d88?{'count':_0x49a224,'rows':_0x388d88}:null;}})[_0x3b07('0x22')](respondWithResult(_0x396729,null))[_0x3b07('0x59')](handleError(_0x396729,null));};exports['send']=function(_0x3888db,_0x4cbf0e,_0x58f5a6){var _0x5e06ef,_0x5c2a87,_0x1b8ee4;if(_['isNil'](_0x3888db[_0x3b07('0x69')]['body'])||_0x3888db['body'][_0x3b07('0x69')]===''){throw new db[(_0x3b07('0x77'))][(_0x3b07('0x7f'))](_0x3b07('0x80'));}if(_['isNil'](_0x3888db[_0x3b07('0x69')]['to'])){}_0x5e06ef=_0x3888db[_0x3b07('0x69')]['to'];return db[_0x3b07('0x54')][_0x3b07('0x6e')]({'where':{'id':_0x3888db[_0x3b07('0x5b')]['id']}})[_0x3b07('0x22')](handleEntityNotFound(_0x4cbf0e,null))[_0x3b07('0x22')](function(_0x1ebecf){if(_0x1ebecf){return db[_0x3b07('0x54')][_0x3b07('0x64')]({'where':{'id':_0x1ebecf['id']},'include':[{'model':db[_0x3b07('0x84')],'as':'List','include':[{'model':db[_0x3b07('0x76')],'as':_0x3b07('0x8f'),'where':{[_0x1ebecf['mapKey']]:_0x5e06ef},'limit':0x1,'order':[['updatedAt',_0x3b07('0x86')]]}]}]})[_0x3b07('0x22')](handleEntityNotFound(_0x4cbf0e,null))[_0x3b07('0x22')](function(_0xa6add4){if(_0xa6add4&&_0xa6add4[_0x3b07('0x85')]){_0x5c2a87=_0xa6add4['get']({'plain':!![]});if(_0x5c2a87['List']&&_0x5c2a87[_0x3b07('0x85')]['Contacts'][_0x3b07('0x4a')]){return _0x5c2a87[_0x3b07('0x85')]['Contacts'][0x0];}return db['CmContact'][_0x3b07('0x67')](_['defaults'](_0x3888db['body'],{'firstName':_0x5e06ef,[_0xa6add4[_0x3b07('0x82')]]:_0x5e06ef,'phone':_0x5e06ef,'ListId':_0x5c2a87[_0x3b07('0x7d')]}));}})[_0x3b07('0x22')](handleEntityNotFound(_0x4cbf0e,null))[_0x3b07('0x22')](function(_0x596df8){if(_0x596df8){_0x1b8ee4=_0x596df8;return db[_0x3b07('0x92')][_0x3b07('0x64')]({'where':{'ContactId':_0x1b8ee4['id'],'closed':![],'OpenchannelAccountId':_0x5c2a87['id']}})[_0x3b07('0x22')](function(_0x328787){if(_0x328787){return[_0x328787,![]];}return db[_0x3b07('0x92')][_0x3b07('0x67')]({'UserId':_0x3888db['user']['id'],'ContactId':_0x1b8ee4['id'],'OpenchannelAccountId':_0x5c2a87['id'],'lastMsgDirection':_0x3b07('0xbb'),'firstMsgDirection':_0x3b07('0xbb'),'Messages':[_[_0x3b07('0x52')](_0x3888db['body'],{'read':![],'body':_0x3888db[_0x3b07('0x69')]['body'],'OpenchannelAccountId':_0x5c2a87['id'],'UserId':_0x3888db[_0x3b07('0x5f')]['id'],'ContactId':_0x1b8ee4['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0x3b07('0x22')](function(_0x592d71){return[_0x592d71,!![]];});});}})['spread'](function(_0x17183c,_0x4b3ba0){if(_0x4b3ba0){return _0x17183c;}return db['OpenchannelMessage'][_0x3b07('0x67')](_[_0x3b07('0x52')](_0x3888db[_0x3b07('0x69')],{'read':![],'body':_0x3888db[_0x3b07('0x69')][_0x3b07('0x69')],'OpenchannelAccountId':_0x5c2a87['id'],'OpenchannelInteractionId':_0x17183c['id'],'UserId':_0x3888db[_0x3b07('0x5f')]['id'],'ContactId':_0x1b8ee4['id']}))[_0x3b07('0x22')](function(_0x114b0d){_0x17183c['dataValues'][_0x3b07('0xbc')]=[];_0x17183c[_0x3b07('0xbd')][_0x3b07('0xbc')][_0x3b07('0x9b')](_0x114b0d[_0x3b07('0xbd')]);return _0x17183c;});});}})[_0x3b07('0x22')](respondWithResult(_0x4cbf0e,null))['catch'](handleError(_0x4cbf0e,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index add5b0e..60fcb31 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 _0xb821=['OpenchannelAccount','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x1f8c44,_0x1adff8){var _0x406e5a=function(_0x29097b){while(--_0x29097b){_0x1f8c44['push'](_0x1f8c44['shift']());}};_0x406e5a(++_0x1adff8);}(_0xb821,0xa7));var _0x1b82=function(_0x4f44db,_0x4e52a1){_0x4f44db=_0x4f44db-0x0;var _0x20d85d=_0xb821[_0x4f44db];return _0x20d85d;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x1b82('0x0'))['db'][_0x1b82('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1b82('0x2'),'afterDestroy':'remove'};function emitEvent(_0x4b1809){return function(_0x3b1d14,_0x1403ab,_0x3fadf0){OpenchannelAccountEvents[_0x1b82('0x3')](_0x4b1809+':'+_0x3b1d14['id'],_0x3b1d14);OpenchannelAccountEvents['emit'](_0x4b1809,_0x3b1d14);_0x3fadf0(null);};}for(var e in events){if(events[_0x1b82('0x4')](e)){var event=events[e];OpenchannelAccount[_0x1b82('0x5')](e,emitEvent(event));}}module[_0x1b82('0x6')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xaa88=['../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','hasOwnProperty','exports','events'];(function(_0x1e6607,_0x346b3a){var _0xa1a87a=function(_0x2c48ae){while(--_0x2c48ae){_0x1e6607['push'](_0x1e6607['shift']());}};_0xa1a87a(++_0x346b3a);}(_0xaa88,0x137));var _0x8aa8=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xaa88[_0x49ca18];return _0x145d54;};'use strict';var EventEmitter=require(_0x8aa8('0x0'));var OpenchannelAccount=require(_0x8aa8('0x1'))['db'][_0x8aa8('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8aa8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8aa8('0x4'),'afterDestroy':_0x8aa8('0x5')};function emitEvent(_0x43f7e4){return function(_0x3b2c88,_0x3e3b70,_0x350e8b){OpenchannelAccountEvents['emit'](_0x43f7e4+':'+_0x3b2c88['id'],_0x3b2c88);OpenchannelAccountEvents['emit'](_0x43f7e4,_0x3b2c88);_0x350e8b(null);};}for(var e in events){if(events[_0x8aa8('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x8aa8('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 394ab13..9dfe6a8 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(_0x387585,_0x5e7203){var _0x776c31=function(_0x106441){while(--_0x106441){_0x387585['push'](_0x387585['shift']());}};_0x776c31(++_0x5e7203);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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(_0x13f1e2,_0x4fa853){var _0xf03211=function(_0x3b4828){while(--_0x3b4828){_0x13f1e2['push'](_0x13f1e2['shift']());}};_0xf03211(++_0x4fa853);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 8c2d557..bde458a 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 _0xe511=['jayson/promise','http','redis','localhost','socket.io-emitter','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe511,0x16f));var _0x1e51=function(_0x137f1a,_0x2887df){_0x137f1a=_0x137f1a-0x0;var _0x439923=_0xe511[_0x137f1a];return _0x439923;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var moment=require('moment');var BPromise=require(_0x1e51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e51('0x3'));var db=require(_0x1e51('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e51('0x5'))(_0x1e51('0x6'));var config=require(_0x1e51('0x7'));var jayson=require(_0x1e51('0x8'));var client=jayson['client'][_0x1e51('0x9')]({'port':0x232a});config[_0x1e51('0xa')]=_['defaults'](config['redis'],{'host':_0x1e51('0xb'),'port':0x18eb});var socket=require(_0x1e51('0xc'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x1e51('0xd')](socket);function respondWithRpcPromise(_0x2712e0,_0x29da1f,_0x706e60){return new BPromise(function(_0x4241a6,_0x141e2e){return client['request'](_0x2712e0,_0x706e60)[_0x1e51('0xe')](function(_0xcdfa5d){logger[_0x1e51('0xf')](_0x1e51('0x10'),_0x29da1f,_0x1e51('0x11'));logger[_0x1e51('0x12')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x29da1f,_0x1e51('0x11'),JSON[_0x1e51('0x13')](_0xcdfa5d));if(_0xcdfa5d[_0x1e51('0x14')]){if(_0xcdfa5d[_0x1e51('0x14')][_0x1e51('0x15')]===0x1f4){logger[_0x1e51('0x14')](_0x1e51('0x10'),_0x29da1f,_0xcdfa5d[_0x1e51('0x14')][_0x1e51('0x16')]);return _0x141e2e(_0xcdfa5d[_0x1e51('0x14')]['message']);}logger[_0x1e51('0x14')](_0x1e51('0x10'),_0x29da1f,_0xcdfa5d[_0x1e51('0x14')]['message']);return _0x4241a6(_0xcdfa5d[_0x1e51('0x14')]['message']);}else{logger['info'](_0x1e51('0x10'),_0x29da1f,_0x1e51('0x11'));_0x4241a6(_0xcdfa5d[_0x1e51('0x17')][_0x1e51('0x16')]);}})[_0x1e51('0x18')](function(_0x3e4234){logger['error'](_0x1e51('0x10'),_0x29da1f,_0x3e4234);_0x141e2e(_0x3e4234);});});} \ No newline at end of file +var _0x9354=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','catch'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9354,0x96));var _0x4935=function(_0xd67723,_0x1e576f){_0xd67723=_0xd67723-0x0;var _0x53b62b=_0x9354[_0xd67723];return _0x53b62b;};'use strict';var _=require('lodash');var util=require(_0x4935('0x0'));var moment=require(_0x4935('0x1'));var BPromise=require('bluebird');var rs=require(_0x4935('0x2'));var fs=require('fs');var Redis=require(_0x4935('0x3'));var db=require(_0x4935('0x4'))['db'];var utils=require(_0x4935('0x5'));var logger=require('../../config/logger')(_0x4935('0x6'));var config=require(_0x4935('0x7'));var jayson=require(_0x4935('0x8'));var client=jayson[_0x4935('0x9')][_0x4935('0xa')]({'port':0x232a});config[_0x4935('0xb')]=_[_0x4935('0xc')](config[_0x4935('0xb')],{'host':_0x4935('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4935('0xb')]));require('./openchannelAccount.socket')[_0x4935('0xe')](socket);function respondWithRpcPromise(_0x38de96,_0xd5b117,_0x22a83f){return new BPromise(function(_0x261462,_0x319b72){return client['request'](_0x38de96,_0x22a83f)['then'](function(_0x2ebd4c){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0xd5b117,_0x4935('0xf'));logger[_0x4935('0x10')](_0x4935('0x11'),_0xd5b117,_0x4935('0xf'),JSON[_0x4935('0x12')](_0x2ebd4c));if(_0x2ebd4c[_0x4935('0x13')]){if(_0x2ebd4c[_0x4935('0x13')][_0x4935('0x14')]===0x1f4){logger[_0x4935('0x13')](_0x4935('0x15'),_0xd5b117,_0x2ebd4c[_0x4935('0x13')][_0x4935('0x16')]);return _0x319b72(_0x2ebd4c[_0x4935('0x13')][_0x4935('0x16')]);}logger[_0x4935('0x13')](_0x4935('0x15'),_0xd5b117,_0x2ebd4c['error'][_0x4935('0x16')]);return _0x261462(_0x2ebd4c[_0x4935('0x13')][_0x4935('0x16')]);}else{logger[_0x4935('0x17')](_0x4935('0x15'),_0xd5b117,_0x4935('0xf'));_0x261462(_0x2ebd4c['result'][_0x4935('0x16')]);}})[_0x4935('0x18')](function(_0x4fe356){logger[_0x4935('0x13')](_0x4935('0x15'),_0xd5b117,_0x4fe356);_0x319b72(_0x4fe356);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 91dbbb2..b4e447a 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 _0x36f1=['register','length','./openchannelAccount.events','remove','emit','removeListener'];(function(_0xd5a5f9,_0x44ea90){var _0xf05a30=function(_0x5e4701){while(--_0x5e4701){_0xd5a5f9['push'](_0xd5a5f9['shift']());}};_0xf05a30(++_0x44ea90);}(_0x36f1,0xb0));var _0x136f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x36f1[_0x397e5f];return _0x5302b8;};'use strict';var OpenchannelAccountEvents=require(_0x136f('0x0'));var events=['save',_0x136f('0x1'),'update'];function createListener(_0x338a88,_0x31045f){return function(_0x5a7bbe){_0x31045f[_0x136f('0x2')](_0x338a88,_0x5a7bbe);};}function removeListener(_0x3c8abd,_0x46dc4d){return function(){OpenchannelAccountEvents[_0x136f('0x3')](_0x3c8abd,_0x46dc4d);};}exports[_0x136f('0x4')]=function(_0x5b00b5){for(var _0x430433=0x0,_0x525663=events[_0x136f('0x5')];_0x430433<_0x525663;_0x430433++){var _0x29e9c5=events[_0x430433];var _0x3c7a1c=createListener('openchannelAccount:'+_0x29e9c5,_0x5b00b5);OpenchannelAccountEvents['on'](_0x29e9c5,_0x3c7a1c);}}; \ No newline at end of file +var _0xe920=['remove','update','emit','register','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xe920,0xbe));var _0x0e92=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0xe920[_0x476bf4];return _0x788ffe;};'use strict';var OpenchannelAccountEvents=require(_0x0e92('0x0'));var events=[_0x0e92('0x1'),_0x0e92('0x2'),_0x0e92('0x3')];function createListener(_0x38e0b6,_0x75ebc6){return function(_0x3dc575){_0x75ebc6[_0x0e92('0x4')](_0x38e0b6,_0x3dc575);};}function removeListener(_0xfaa87e,_0xd22921){return function(){OpenchannelAccountEvents['removeListener'](_0xfaa87e,_0xd22921);};}exports[_0x0e92('0x5')]=function(_0x5291e2){for(var _0x40d9f2=0x0,_0x33a315=events[_0x0e92('0x6')];_0x40d9f2<_0x33a315;_0x40d9f2++){var _0x176c3b=events[_0x40d9f2];var _0x5662dc=createListener(_0x0e92('0x7')+_0x176c3b,_0x5291e2);OpenchannelAccountEvents['on'](_0x176c3b,_0x5662dc);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index c13abe8..756e8f8 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 _0xbee3=['isAuthenticated','index','show','/:id','update','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get'];(function(_0x116246,_0x5c35d2){var _0x46d099=function(_0x25ddc9){while(--_0x25ddc9){_0x116246['push'](_0x116246['shift']());}};_0x46d099(++_0x5c35d2);}(_0xbee3,0x12c));var _0x3bee=function(_0x45d7c2,_0x1c3d69){_0x45d7c2=_0x45d7c2-0x0;var _0x1c181a=_0xbee3[_0x45d7c2];return _0x1c181a;};'use strict';var multer=require(_0x3bee('0x0'));var util=require('util');var path=require(_0x3bee('0x1'));var timeout=require('connect-timeout');var express=require(_0x3bee('0x2'));var router=express['Router']();var fs_extra=require(_0x3bee('0x3'));var auth=require(_0x3bee('0x4'));var interaction=require(_0x3bee('0x5'));var config=require('../../config/environment');var controller=require(_0x3bee('0x6'));router[_0x3bee('0x7')]('/',auth[_0x3bee('0x8')](),controller[_0x3bee('0x9')]);router[_0x3bee('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x3bee('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x3bee('0xb'),auth[_0x3bee('0x8')](),controller[_0x3bee('0xc')]);router['delete']('/:id',auth[_0x3bee('0x8')](),controller['destroy']);module[_0x3bee('0xd')]=router; \ No newline at end of file +var _0x16e4=['show','post','create','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','index','get','/:id','isAuthenticated'];(function(_0x4c06a3,_0x1e6b6f){var _0x7ff53c=function(_0x559eff){while(--_0x559eff){_0x4c06a3['push'](_0x4c06a3['shift']());}};_0x7ff53c(++_0x1e6b6f);}(_0x16e4,0x77));var _0x416e=function(_0x266104,_0x8904ed){_0x266104=_0x266104-0x0;var _0x1fc0ae=_0x16e4[_0x266104];return _0x1fc0ae;};'use strict';var multer=require(_0x416e('0x0'));var util=require(_0x416e('0x1'));var path=require(_0x416e('0x2'));var timeout=require(_0x416e('0x3'));var express=require(_0x416e('0x4'));var router=express[_0x416e('0x5')]();var fs_extra=require(_0x416e('0x6'));var auth=require(_0x416e('0x7'));var interaction=require(_0x416e('0x8'));var config=require('../../config/environment');var controller=require(_0x416e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x416e('0xa')]);router[_0x416e('0xb')](_0x416e('0xc'),auth[_0x416e('0xd')](),controller[_0x416e('0xe')]);router[_0x416e('0xf')]('/',auth[_0x416e('0xd')](),controller[_0x416e('0x10')]);router['put']('/:id',auth[_0x416e('0xd')](),controller['update']);router[_0x416e('0x11')](_0x416e('0xc'),auth[_0x416e('0xd')](),controller['destroy']);module[_0x416e('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index e347021..f6ee169 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 _0xad01=['exports','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xad01,0x17f));var _0x1ad0=function(_0x4eea4b,_0x2df371){_0x4eea4b=_0x4eea4b-0x0;var _0xe8bec8=_0xad01[_0x4eea4b];return _0xe8bec8;};'use strict';var Sequelize=require(_0x1ad0('0x0'));module[_0x1ad0('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1ad0('0x2')},'appdata':{'type':Sequelize[_0x1ad0('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1ad0('0x4')],'defaultValue':_0x1ad0('0x5')}}; \ No newline at end of file +var _0xa293=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x3fa580,_0x4f467d){var _0x4d2d19=function(_0x452ccb){while(--_0x452ccb){_0x3fa580['push'](_0x3fa580['shift']());}};_0x4d2d19(++_0x4f467d);}(_0xa293,0x161));var _0x3a29=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xa293[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x3a29('0x0'));module[_0x3a29('0x1')]={'priority':{'type':Sequelize[_0x3a29('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3a29('0x3')],'allowNull':![],'defaultValue':_0x3a29('0x4')},'appdata':{'type':Sequelize[_0x3a29('0x5')]()},'description':{'type':Sequelize[_0x3a29('0x3')]},'interval':{'type':Sequelize[_0x3a29('0x3')],'defaultValue':_0x3a29('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 56cd9d2..1ca7c81 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 _0x13ef=['offset','undefined','limit','count','set','Content-Range','then','destroy','error','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json'];(function(_0x1dad08,_0x306709){var _0xab33f1=function(_0x2a75a5){while(--_0x2a75a5){_0x1dad08['push'](_0x1dad08['shift']());}};_0xab33f1(++_0x306709);}(_0x13ef,0x1e4));var _0xf13e=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x13ef[_0x2dadb9];return _0x2f0097;};'use strict';var emlformat=require(_0xf13e('0x0'));var rimraf=require(_0xf13e('0x1'));var zipdir=require(_0xf13e('0x2'));var jsonpatch=require(_0xf13e('0x3'));var rp=require(_0xf13e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf13e('0x5'));var util=require('util');var path=require(_0xf13e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf13e('0x7'));var _=require('lodash');var squel=require(_0xf13e('0x8'));var crypto=require(_0xf13e('0x9'));var jsforce=require(_0xf13e('0xa'));var deskjs=require(_0xf13e('0xb'));var toCsv=require(_0xf13e('0xc'));var querystring=require(_0xf13e('0xd'));var Papa=require(_0xf13e('0xe'));var Redis=require('ioredis');var authService=require(_0xf13e('0xf'));var qs=require(_0xf13e('0x10'));var as=require(_0xf13e('0x11'));var hardwareService=require(_0xf13e('0x12'));var logger=require(_0xf13e('0x13'))('api');var utils=require(_0xf13e('0x14'));var config=require(_0xf13e('0x15'));var licenseUtil=require(_0xf13e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa7596c,_0x5e69de){_0x5e69de=_0x5e69de||0xcc;return function(_0x102753){if(_0x102753){return _0xa7596c[_0xf13e('0x17')](_0x5e69de);}return _0xa7596c['status'](_0x5e69de)[_0xf13e('0x18')]();};}function respondWithResult(_0x252ca6,_0x10ce9c){_0x10ce9c=_0x10ce9c||0xc8;return function(_0x515941){if(_0x515941){return _0x252ca6[_0xf13e('0x19')](_0x10ce9c)[_0xf13e('0x1a')](_0x515941);}};}function respondWithFilteredResult(_0x5a4355,_0x1424ee){return function(_0x5a9c06){if(_0x5a9c06){var _0xea42b2=typeof _0x1424ee[_0xf13e('0x1b')]===_0xf13e('0x1c')&&typeof _0x1424ee[_0xf13e('0x1d')]===_0xf13e('0x1c');var _0x454600=_0x5a9c06[_0xf13e('0x1e')];var _0x4821fa=_0xea42b2?0x0:_0x1424ee[_0xf13e('0x1b')];var _0x188ea9=_0xea42b2?_0x5a9c06['count']:_0x1424ee[_0xf13e('0x1b')]+_0x1424ee['limit'];var _0x37f222;if(_0x188ea9>=_0x454600){_0x188ea9=_0x454600;_0x37f222=0xc8;}else{_0x37f222=0xce;}_0x5a4355['status'](_0x37f222);return _0x5a4355[_0xf13e('0x1f')](_0xf13e('0x20'),_0x4821fa+'-'+_0x188ea9+'/'+_0x454600)[_0xf13e('0x1a')](_0x5a9c06);}return null;};}function patchUpdates(_0x10d1d2){return function(_0xdd1234){try{jsonpatch['apply'](_0xdd1234,_0x10d1d2,!![]);}catch(_0x265a0b){return BPromise['reject'](_0x265a0b);}return _0xdd1234['save']();};}function saveUpdates(_0x4e2710,_0x3a0b7e){return function(_0x47b727){if(_0x47b727){return _0x47b727['update'](_0x4e2710)[_0xf13e('0x21')](function(_0x57803d){return _0x57803d;});}return null;};}function removeEntity(_0x2fd8cb,_0x3a7741){return function(_0x567c06){if(_0x567c06){return _0x567c06[_0xf13e('0x22')]()[_0xf13e('0x21')](function(){_0x2fd8cb[_0xf13e('0x19')](0xcc)[_0xf13e('0x18')]();});}};}function handleEntityNotFound(_0x210c54,_0x1292d9){return function(_0x5df80f){if(!_0x5df80f){_0x210c54[_0xf13e('0x17')](0x194);}return _0x5df80f;};}function handleError(_0x158ef4,_0x5b7bbe){_0x5b7bbe=_0x5b7bbe||0x1f4;return function(_0x160580){logger[_0xf13e('0x23')](_0x160580['stack']);if(_0x160580[_0xf13e('0x24')]){delete _0x160580['name'];}_0x158ef4['status'](_0x5b7bbe)[_0xf13e('0x25')](_0x160580);};}exports[_0xf13e('0x26')]=function(_0x331e0f,_0x283a35){var _0x32564b={},_0x573f0c={},_0x2a57c5={'count':0x0,'rows':[]};var _0x38bb0e=_[_0xf13e('0x27')](db[_0xf13e('0x28')][_0xf13e('0x29')],function(_0xfc51c4){return{'name':_0xfc51c4[_0xf13e('0x2a')],'type':_0xfc51c4[_0xf13e('0x2b')][_0xf13e('0x2c')]};});_0x573f0c[_0xf13e('0x2d')]=_[_0xf13e('0x27')](_0x38bb0e,_0xf13e('0x24'));_0x573f0c[_0xf13e('0x2e')]=_[_0xf13e('0x2f')](_0x331e0f[_0xf13e('0x2e')]);_0x573f0c[_0xf13e('0x30')]=_[_0xf13e('0x31')](_0x573f0c[_0xf13e('0x2d')],_0x573f0c[_0xf13e('0x2e')]);_0x32564b[_0xf13e('0x32')]=_[_0xf13e('0x31')](_0x573f0c['model'],qs['fields'](_0x331e0f[_0xf13e('0x2e')][_0xf13e('0x33')]));_0x32564b[_0xf13e('0x32')]=_0x32564b[_0xf13e('0x32')][_0xf13e('0x34')]?_0x32564b[_0xf13e('0x32')]:_0x573f0c[_0xf13e('0x2d')];if(!_0x331e0f[_0xf13e('0x2e')][_0xf13e('0x35')](_0xf13e('0x36'))){_0x32564b[_0xf13e('0x1d')]=qs[_0xf13e('0x1d')](_0x331e0f['query'][_0xf13e('0x1d')]);_0x32564b[_0xf13e('0x1b')]=qs[_0xf13e('0x1b')](_0x331e0f[_0xf13e('0x2e')]['offset']);}_0x32564b[_0xf13e('0x37')]=qs[_0xf13e('0x38')](_0x331e0f[_0xf13e('0x2e')][_0xf13e('0x38')]);_0x32564b[_0xf13e('0x39')]=qs[_0xf13e('0x30')](_[_0xf13e('0x3a')](_0x331e0f[_0xf13e('0x2e')],_0x573f0c[_0xf13e('0x30')]),_0x38bb0e);if(_0x331e0f['query'][_0xf13e('0x3b')]){_0x32564b[_0xf13e('0x39')]=_['merge'](_0x32564b[_0xf13e('0x39')],{'$or':_['map'](_0x38bb0e,function(_0x1ffbb8){if(_0x1ffbb8[_0xf13e('0x2b')]!=='VIRTUAL'){var _0x20b4ca={};_0x20b4ca[_0x1ffbb8[_0xf13e('0x24')]]={'$like':'%'+_0x331e0f['query'][_0xf13e('0x3b')]+'%'};return _0x20b4ca;}})});}_0x32564b=_['merge']({},_0x32564b,_0x331e0f[_0xf13e('0x3c')]);var _0x43570e={'where':_0x32564b[_0xf13e('0x39')]};return db[_0xf13e('0x28')][_0xf13e('0x1e')](_0x43570e)[_0xf13e('0x21')](function(_0x51bedd){_0x2a57c5[_0xf13e('0x1e')]=_0x51bedd;if(_0x331e0f['query'][_0xf13e('0x3d')]){_0x32564b[_0xf13e('0x3e')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0xf13e('0x3f')](_0x32564b);})['then'](function(_0x173b64){_0x2a57c5[_0xf13e('0x40')]=_0x173b64;return _0x2a57c5;})[_0xf13e('0x21')](respondWithFilteredResult(_0x283a35,_0x32564b))[_0xf13e('0x41')](handleError(_0x283a35,null));};exports[_0xf13e('0x42')]=function(_0x5dd0af,_0x3d5cb6){var _0x1e06b0={'raw':!![],'where':{'id':_0x5dd0af[_0xf13e('0x43')]['id']}},_0x480426={};_0x480426['model']=_[_0xf13e('0x2f')](db[_0xf13e('0x28')][_0xf13e('0x29')]);_0x480426['query']=_[_0xf13e('0x2f')](_0x5dd0af[_0xf13e('0x2e')]);_0x480426[_0xf13e('0x30')]=_[_0xf13e('0x31')](_0x480426[_0xf13e('0x2d')],_0x480426[_0xf13e('0x2e')]);_0x1e06b0['attributes']=_[_0xf13e('0x31')](_0x480426[_0xf13e('0x2d')],qs[_0xf13e('0x33')](_0x5dd0af['query']['fields']));_0x1e06b0['attributes']=_0x1e06b0[_0xf13e('0x32')]['length']?_0x1e06b0['attributes']:_0x480426[_0xf13e('0x2d')];if(_0x5dd0af[_0xf13e('0x2e')]['includeAll']){_0x1e06b0[_0xf13e('0x3e')]=[{'all':!![]}];}_0x1e06b0=_[_0xf13e('0x44')]({},_0x1e06b0,_0x5dd0af[_0xf13e('0x3c')]);return db['OpenchannelApplication'][_0xf13e('0x45')](_0x1e06b0)[_0xf13e('0x21')](handleEntityNotFound(_0x3d5cb6,null))['then'](respondWithResult(_0x3d5cb6,null))['catch'](handleError(_0x3d5cb6,null));};exports[_0xf13e('0x46')]=function(_0x4cda77,_0x2100ca){return db['OpenchannelApplication'][_0xf13e('0x46')](_0x4cda77['body'],{})[_0xf13e('0x21')](respondWithResult(_0x2100ca,0xc9))['catch'](handleError(_0x2100ca,null));};exports[_0xf13e('0x47')]=function(_0xf3ff4f,_0x5818e4){if(_0xf3ff4f['body']['id']){delete _0xf3ff4f[_0xf13e('0x48')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0xf3ff4f[_0xf13e('0x43')]['id']}})[_0xf13e('0x21')](handleEntityNotFound(_0x5818e4,null))[_0xf13e('0x21')](saveUpdates(_0xf3ff4f[_0xf13e('0x48')],null))['then'](respondWithResult(_0x5818e4,null))[_0xf13e('0x41')](handleError(_0x5818e4,null));};exports[_0xf13e('0x22')]=function(_0x1fa915,_0x205056){return db[_0xf13e('0x28')][_0xf13e('0x45')]({'where':{'id':_0x1fa915[_0xf13e('0x43')]['id']}})[_0xf13e('0x21')](handleEntityNotFound(_0x205056,null))[_0xf13e('0x21')](removeEntity(_0x205056,null))[_0xf13e('0x41')](handleError(_0x205056,null));}; \ No newline at end of file +var _0x01ba=['show','keys','length','find','create','body','params','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','stack','name','send','index','OpenchannelApplication','rawAttributes','fieldName','model','map','query','attributes','intersection','fields','nolimit','order','sort','where','filters','filter','merge','type','options','count','includeAll','include','findAll','catch'];(function(_0x8c2d18,_0x203b20){var _0x1d4a90=function(_0x1cfdac){while(--_0x1cfdac){_0x8c2d18['push'](_0x8c2d18['shift']());}};_0x1d4a90(++_0x203b20);}(_0x01ba,0x16b));var _0xa01b=function(_0x3b0ee1,_0x22d638){_0x3b0ee1=_0x3b0ee1-0x0;var _0x519b7a=_0x01ba[_0x3b0ee1];return _0x519b7a;};'use strict';var emlformat=require(_0xa01b('0x0'));var rimraf=require(_0xa01b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa01b('0x2'));var rp=require(_0xa01b('0x3'));var moment=require(_0xa01b('0x4'));var BPromise=require(_0xa01b('0x5'));var Mustache=require(_0xa01b('0x6'));var util=require(_0xa01b('0x7'));var path=require('path');var sox=require(_0xa01b('0x8'));var csv=require(_0xa01b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa01b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa01b('0xb'));var toCsv=require(_0xa01b('0x9'));var querystring=require(_0xa01b('0xc'));var Papa=require(_0xa01b('0xd'));var Redis=require(_0xa01b('0xe'));var authService=require(_0xa01b('0xf'));var qs=require(_0xa01b('0x10'));var as=require(_0xa01b('0x11'));var hardwareService=require(_0xa01b('0x12'));var logger=require(_0xa01b('0x13'))('api');var utils=require(_0xa01b('0x14'));var config=require(_0xa01b('0x15'));var licenseUtil=require(_0xa01b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x569535,_0x4ccc9e){_0x4ccc9e=_0x4ccc9e||0xcc;return function(_0x5d0abf){if(_0x5d0abf){return _0x569535[_0xa01b('0x17')](_0x4ccc9e);}return _0x569535['status'](_0x4ccc9e)[_0xa01b('0x18')]();};}function respondWithResult(_0xb51f6c,_0x48725c){_0x48725c=_0x48725c||0xc8;return function(_0x403868){if(_0x403868){return _0xb51f6c[_0xa01b('0x19')](_0x48725c)[_0xa01b('0x1a')](_0x403868);}};}function respondWithFilteredResult(_0x40d09a,_0x5d5116){return function(_0xb80c38){if(_0xb80c38){var _0x40f213=typeof _0x5d5116[_0xa01b('0x1b')]===_0xa01b('0x1c')&&typeof _0x5d5116[_0xa01b('0x1d')]==='undefined';var _0x368ce5=_0xb80c38['count'];var _0x582d69=_0x40f213?0x0:_0x5d5116[_0xa01b('0x1b')];var _0x4df9c7=_0x40f213?_0xb80c38['count']:_0x5d5116[_0xa01b('0x1b')]+_0x5d5116['limit'];var _0x5248c3;if(_0x4df9c7>=_0x368ce5){_0x4df9c7=_0x368ce5;_0x5248c3=0xc8;}else{_0x5248c3=0xce;}_0x40d09a['status'](_0x5248c3);return _0x40d09a[_0xa01b('0x1e')](_0xa01b('0x1f'),_0x582d69+'-'+_0x4df9c7+'/'+_0x368ce5)[_0xa01b('0x1a')](_0xb80c38);}return null;};}function patchUpdates(_0xca6ede){return function(_0x7c6004){try{jsonpatch[_0xa01b('0x20')](_0x7c6004,_0xca6ede,!![]);}catch(_0x46f9be){return BPromise[_0xa01b('0x21')](_0x46f9be);}return _0x7c6004['save']();};}function saveUpdates(_0x5986b0,_0x280697){return function(_0x7b9483){if(_0x7b9483){return _0x7b9483[_0xa01b('0x22')](_0x5986b0)[_0xa01b('0x23')](function(_0x198ac2){return _0x198ac2;});}return null;};}function removeEntity(_0xf60458,_0x41a22b){return function(_0x5711a9){if(_0x5711a9){return _0x5711a9['destroy']()[_0xa01b('0x23')](function(){_0xf60458[_0xa01b('0x19')](0xcc)[_0xa01b('0x18')]();});}};}function handleEntityNotFound(_0x5d4d6b,_0xcf7176){return function(_0x36b2c6){if(!_0x36b2c6){_0x5d4d6b['sendStatus'](0x194);}return _0x36b2c6;};}function handleError(_0x133660,_0x5690ea){_0x5690ea=_0x5690ea||0x1f4;return function(_0x533625){logger['error'](_0x533625[_0xa01b('0x24')]);if(_0x533625[_0xa01b('0x25')]){delete _0x533625[_0xa01b('0x25')];}_0x133660[_0xa01b('0x19')](_0x5690ea)[_0xa01b('0x26')](_0x533625);};}exports[_0xa01b('0x27')]=function(_0x593644,_0x41650e){var _0x2db016={},_0x4e2f5d={},_0x4ef62b={'count':0x0,'rows':[]};var _0x223c80=_['map'](db[_0xa01b('0x28')][_0xa01b('0x29')],function(_0x5d5379){return{'name':_0x5d5379[_0xa01b('0x2a')],'type':_0x5d5379['type']['key']};});_0x4e2f5d[_0xa01b('0x2b')]=_[_0xa01b('0x2c')](_0x223c80,'name');_0x4e2f5d[_0xa01b('0x2d')]=_['keys'](_0x593644[_0xa01b('0x2d')]);_0x4e2f5d['filters']=_['intersection'](_0x4e2f5d[_0xa01b('0x2b')],_0x4e2f5d['query']);_0x2db016[_0xa01b('0x2e')]=_[_0xa01b('0x2f')](_0x4e2f5d['model'],qs[_0xa01b('0x30')](_0x593644[_0xa01b('0x2d')][_0xa01b('0x30')]));_0x2db016[_0xa01b('0x2e')]=_0x2db016[_0xa01b('0x2e')]['length']?_0x2db016['attributes']:_0x4e2f5d[_0xa01b('0x2b')];if(!_0x593644['query']['hasOwnProperty'](_0xa01b('0x31'))){_0x2db016[_0xa01b('0x1d')]=qs[_0xa01b('0x1d')](_0x593644['query'][_0xa01b('0x1d')]);_0x2db016['offset']=qs['offset'](_0x593644['query'][_0xa01b('0x1b')]);}_0x2db016[_0xa01b('0x32')]=qs[_0xa01b('0x33')](_0x593644[_0xa01b('0x2d')][_0xa01b('0x33')]);_0x2db016[_0xa01b('0x34')]=qs['filters'](_['pick'](_0x593644[_0xa01b('0x2d')],_0x4e2f5d[_0xa01b('0x35')]),_0x223c80);if(_0x593644['query'][_0xa01b('0x36')]){_0x2db016[_0xa01b('0x34')]=_[_0xa01b('0x37')](_0x2db016[_0xa01b('0x34')],{'$or':_[_0xa01b('0x2c')](_0x223c80,function(_0x3af244){if(_0x3af244[_0xa01b('0x38')]!=='VIRTUAL'){var _0x3043f7={};_0x3043f7[_0x3af244[_0xa01b('0x25')]]={'$like':'%'+_0x593644['query'][_0xa01b('0x36')]+'%'};return _0x3043f7;}})});}_0x2db016=_[_0xa01b('0x37')]({},_0x2db016,_0x593644[_0xa01b('0x39')]);var _0x3ffdb7={'where':_0x2db016[_0xa01b('0x34')]};return db[_0xa01b('0x28')][_0xa01b('0x3a')](_0x3ffdb7)['then'](function(_0x1ced9d){_0x4ef62b[_0xa01b('0x3a')]=_0x1ced9d;if(_0x593644['query'][_0xa01b('0x3b')]){_0x2db016[_0xa01b('0x3c')]=[{'all':!![]}];}return db[_0xa01b('0x28')][_0xa01b('0x3d')](_0x2db016);})[_0xa01b('0x23')](function(_0x5ad2c1){_0x4ef62b['rows']=_0x5ad2c1;return _0x4ef62b;})['then'](respondWithFilteredResult(_0x41650e,_0x2db016))[_0xa01b('0x3e')](handleError(_0x41650e,null));};exports[_0xa01b('0x3f')]=function(_0x128e49,_0xcf7988){var _0x5b5042={'raw':!![],'where':{'id':_0x128e49['params']['id']}},_0x8a3a27={};_0x8a3a27[_0xa01b('0x2b')]=_[_0xa01b('0x40')](db['OpenchannelApplication'][_0xa01b('0x29')]);_0x8a3a27['query']=_[_0xa01b('0x40')](_0x128e49[_0xa01b('0x2d')]);_0x8a3a27[_0xa01b('0x35')]=_['intersection'](_0x8a3a27[_0xa01b('0x2b')],_0x8a3a27[_0xa01b('0x2d')]);_0x5b5042[_0xa01b('0x2e')]=_['intersection'](_0x8a3a27['model'],qs[_0xa01b('0x30')](_0x128e49[_0xa01b('0x2d')][_0xa01b('0x30')]));_0x5b5042['attributes']=_0x5b5042[_0xa01b('0x2e')][_0xa01b('0x41')]?_0x5b5042[_0xa01b('0x2e')]:_0x8a3a27[_0xa01b('0x2b')];if(_0x128e49['query'][_0xa01b('0x3b')]){_0x5b5042[_0xa01b('0x3c')]=[{'all':!![]}];}_0x5b5042=_[_0xa01b('0x37')]({},_0x5b5042,_0x128e49['options']);return db[_0xa01b('0x28')][_0xa01b('0x42')](_0x5b5042)['then'](handleEntityNotFound(_0xcf7988,null))['then'](respondWithResult(_0xcf7988,null))[_0xa01b('0x3e')](handleError(_0xcf7988,null));};exports[_0xa01b('0x43')]=function(_0x328e70,_0x4d7781){return db[_0xa01b('0x28')][_0xa01b('0x43')](_0x328e70[_0xa01b('0x44')],{})[_0xa01b('0x23')](respondWithResult(_0x4d7781,0xc9))['catch'](handleError(_0x4d7781,null));};exports[_0xa01b('0x22')]=function(_0x126c34,_0x2b79cf){if(_0x126c34[_0xa01b('0x44')]['id']){delete _0x126c34['body']['id'];}return db[_0xa01b('0x28')][_0xa01b('0x42')]({'where':{'id':_0x126c34[_0xa01b('0x45')]['id']}})[_0xa01b('0x23')](handleEntityNotFound(_0x2b79cf,null))[_0xa01b('0x23')](saveUpdates(_0x126c34[_0xa01b('0x44')],null))['then'](respondWithResult(_0x2b79cf,null))[_0xa01b('0x3e')](handleError(_0x2b79cf,null));};exports[_0xa01b('0x46')]=function(_0x338178,_0x453529){return db[_0xa01b('0x28')]['find']({'where':{'id':_0x338178[_0xa01b('0x45')]['id']}})[_0xa01b('0x23')](handleEntityNotFound(_0x453529,null))[_0xa01b('0x23')](removeEntity(_0x453529,null))[_0xa01b('0x3e')](handleError(_0x453529,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index b37af7c..0cea457 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 _0x535a=['OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x535a,0xd5));var _0xa535=function(_0x1f8ed6,_0x280d14){_0x1f8ed6=_0x1f8ed6-0x0;var _0x1bdd65=_0x535a[_0x1f8ed6];return _0x1bdd65;};'use strict';var _=require(_0xa535('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa535('0x1'));var moment=require(_0xa535('0x2'));var BPromise=require(_0xa535('0x3'));var rp=require(_0xa535('0x4'));var fs=require('fs');var path=require(_0xa535('0x5'));var rimraf=require(_0xa535('0x6'));var config=require(_0xa535('0x7'));var attributes=require(_0xa535('0x8'));module[_0xa535('0x9')]=function(_0x35f6f2,_0x49684e){return _0x35f6f2[_0xa535('0xa')](_0xa535('0xb'),attributes,{'tableName':_0xa535('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa535('0xd')});}; \ No newline at end of file +var _0x7701=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash'];(function(_0xb7202,_0x4aa500){var _0x6488bb=function(_0x27d9ec){while(--_0x27d9ec){_0xb7202['push'](_0xb7202['shift']());}};_0x6488bb(++_0x4aa500);}(_0x7701,0x125));var _0x1770=function(_0x170762,_0x59776b){_0x170762=_0x170762-0x0;var _0x50b567=_0x7701[_0x170762];return _0x50b567;};'use strict';var _=require(_0x1770('0x0'));var util=require(_0x1770('0x1'));var logger=require(_0x1770('0x2'))(_0x1770('0x3'));var moment=require(_0x1770('0x4'));var BPromise=require('bluebird');var rp=require(_0x1770('0x5'));var fs=require('fs');var path=require(_0x1770('0x6'));var rimraf=require(_0x1770('0x7'));var config=require(_0x1770('0x8'));var attributes=require(_0x1770('0x9'));module['exports']=function(_0x3017c0,_0x4a1785){return _0x3017c0[_0x1770('0xa')](_0x1770('0xb'),attributes,{'tableName':_0x1770('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1770('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 8d2dac8..de4776a 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 _0x7f24=['../../config/environment','jayson/promise','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','update','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4be58d,_0x58fa60){var _0x1eab79=function(_0x6d252f){while(--_0x6d252f){_0x4be58d['push'](_0x4be58d['shift']());}};_0x1eab79(++_0x58fa60);}(_0x7f24,0x10f));var _0x47f2=function(_0xfed299,_0x21b8d0){_0xfed299=_0xfed299-0x0;var _0x4ef1f2=_0x7f24[_0xfed299];return _0x4ef1f2;};'use strict';var _=require(_0x47f2('0x0'));var util=require(_0x47f2('0x1'));var moment=require(_0x47f2('0x2'));var BPromise=require(_0x47f2('0x3'));var rs=require(_0x47f2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x47f2('0x5'))['db'];var utils=require(_0x47f2('0x6'));var logger=require(_0x47f2('0x7'))('rpc');var config=require(_0x47f2('0x8'));var jayson=require(_0x47f2('0x9'));var client=jayson['client'][_0x47f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5536b4,_0xa286f2,_0x49e869){return new BPromise(function(_0xb1b820,_0x3e062d){return client[_0x47f2('0xb')](_0x5536b4,_0x49e869)[_0x47f2('0xc')](function(_0x1a9e28){logger[_0x47f2('0xd')](_0x47f2('0xe'),_0xa286f2,_0x47f2('0xf'));logger[_0x47f2('0x10')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0xa286f2,'request\x20sent',JSON[_0x47f2('0x11')](_0x1a9e28));if(_0x1a9e28[_0x47f2('0x12')]){if(_0x1a9e28['error'][_0x47f2('0x13')]===0x1f4){logger[_0x47f2('0x12')](_0x47f2('0xe'),_0xa286f2,_0x1a9e28[_0x47f2('0x12')][_0x47f2('0x14')]);return _0x3e062d(_0x1a9e28[_0x47f2('0x12')][_0x47f2('0x14')]);}logger[_0x47f2('0x12')](_0x47f2('0xe'),_0xa286f2,_0x1a9e28[_0x47f2('0x12')][_0x47f2('0x14')]);return _0xb1b820(_0x1a9e28[_0x47f2('0x12')]['message']);}else{logger[_0x47f2('0xd')](_0x47f2('0xe'),_0xa286f2,_0x47f2('0xf'));_0xb1b820(_0x1a9e28[_0x47f2('0x15')][_0x47f2('0x14')]);}})[_0x47f2('0x16')](function(_0x55d5d4){logger[_0x47f2('0x12')](_0x47f2('0xe'),_0xa286f2,_0x55d5d4);_0x3e062d(_0x55d5d4);});});}exports[_0x47f2('0x17')]=function(_0x20b426){var _0x4a4a3f=this;return new Promise(function(_0x1ae761,_0x394062){return db['OpenchannelApplication'][_0x47f2('0x18')](_0x20b426[_0x47f2('0x19')],{'raw':_0x20b426[_0x47f2('0x1a')]?_0x20b426[_0x47f2('0x1a')][_0x47f2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20b426[_0x47f2('0x1a')]?_0x20b426[_0x47f2('0x1a')][_0x47f2('0x1c')]||null:null,'attributes':_0x20b426[_0x47f2('0x1a')]?_0x20b426[_0x47f2('0x1a')][_0x47f2('0x1d')]||null:null,'limit':_0x20b426[_0x47f2('0x1a')]?_0x20b426['options'][_0x47f2('0x1e')]||null:null})['then'](function(_0x238b02){logger[_0x47f2('0xd')]('UpdateOpenchannelApplication',_0x20b426);logger[_0x47f2('0x10')](_0x47f2('0x17'),_0x20b426,JSON[_0x47f2('0x11')](_0x238b02));_0x1ae761(_0x238b02);})[_0x47f2('0x16')](function(_0x215231){logger[_0x47f2('0x12')](_0x47f2('0x17'),_0x215231['message'],_0x20b426);_0x394062(_0x4a4a3f[_0x47f2('0x12')](0x1f4,_0x215231[_0x47f2('0x14')]));});});}; \ No newline at end of file +var _0x30a6=['randomstring','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','limit','stringify','util','moment','bluebird'];(function(_0x181594,_0x297c98){var _0x45bb5c=function(_0x2d4839){while(--_0x2d4839){_0x181594['push'](_0x181594['shift']());}};_0x45bb5c(++_0x297c98);}(_0x30a6,0xe7));var _0x630a=function(_0x34ed1f,_0x4ae65c){_0x34ed1f=_0x34ed1f-0x0;var _0x315d83=_0x30a6[_0x34ed1f];return _0x315d83;};'use strict';var _=require('lodash');var util=require(_0x630a('0x0'));var moment=require(_0x630a('0x1'));var BPromise=require(_0x630a('0x2'));var rs=require(_0x630a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x630a('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x630a('0x5')][_0x630a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x731ebf,_0x430e5a,_0x3fb51c){return new BPromise(function(_0x2b5875,_0xa61b68){return client[_0x630a('0x7')](_0x731ebf,_0x3fb51c)[_0x630a('0x8')](function(_0x280970){logger[_0x630a('0x9')](_0x630a('0xa'),_0x430e5a,_0x630a('0xb'));logger[_0x630a('0xc')](_0x630a('0xd'),_0x430e5a,'request\x20sent',JSON['stringify'](_0x280970));if(_0x280970[_0x630a('0xe')]){if(_0x280970['error'][_0x630a('0xf')]===0x1f4){logger[_0x630a('0xe')](_0x630a('0xa'),_0x430e5a,_0x280970[_0x630a('0xe')]['message']);return _0xa61b68(_0x280970[_0x630a('0xe')][_0x630a('0x10')]);}logger[_0x630a('0xe')](_0x630a('0xa'),_0x430e5a,_0x280970[_0x630a('0xe')][_0x630a('0x10')]);return _0x2b5875(_0x280970[_0x630a('0xe')][_0x630a('0x10')]);}else{logger[_0x630a('0x9')](_0x630a('0xa'),_0x430e5a,'request\x20sent');_0x2b5875(_0x280970[_0x630a('0x11')][_0x630a('0x10')]);}})[_0x630a('0x12')](function(_0x4b910e){logger[_0x630a('0xe')](_0x630a('0xa'),_0x430e5a,_0x4b910e);_0xa61b68(_0x4b910e);});});}exports[_0x630a('0x13')]=function(_0xa6763a){var _0xfe64a8=this;return new Promise(function(_0x5530cd,_0x80e9d3){return db[_0x630a('0x14')][_0x630a('0x15')](_0xa6763a[_0x630a('0x16')],{'raw':_0xa6763a['options']?_0xa6763a[_0x630a('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa6763a[_0x630a('0x17')]?_0xa6763a[_0x630a('0x17')]['where']||null:null,'attributes':_0xa6763a[_0x630a('0x17')]?_0xa6763a[_0x630a('0x17')]['attributes']||null:null,'limit':_0xa6763a[_0x630a('0x17')]?_0xa6763a[_0x630a('0x17')][_0x630a('0x18')]||null:null})[_0x630a('0x8')](function(_0x53fefc){logger['info'](_0x630a('0x13'),_0xa6763a);logger[_0x630a('0xc')](_0x630a('0x13'),_0xa6763a,JSON[_0x630a('0x19')](_0x53fefc));_0x5530cd(_0x53fefc);})[_0x630a('0x12')](function(_0x4cab9a){logger[_0x630a('0xe')](_0x630a('0x13'),_0x4cab9a[_0x630a('0x10')],_0xa6763a);_0x80e9d3(_0xfe64a8['error'](0x1f4,_0x4cab9a[_0x630a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 3e8b14c..03803a3 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 _0xf129=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/messages','download','post','create','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','destroy','/:id/tags','removeTags','exports','util','path','connect-timeout','express','Router'];(function(_0x90a39a,_0x32020d){var _0x2b62f7=function(_0x6841cc){while(--_0x6841cc){_0x90a39a['push'](_0x90a39a['shift']());}};_0x2b62f7(++_0x32020d);}(_0xf129,0x1ad));var _0x9f12=function(_0x3789dc,_0x4316a8){_0x3789dc=_0x3789dc-0x0;var _0x1a840f=_0xf129[_0x3789dc];return _0x1a840f;};'use strict';var multer=require('multer');var util=require(_0x9f12('0x0'));var path=require(_0x9f12('0x1'));var timeout=require(_0x9f12('0x2'));var express=require(_0x9f12('0x3'));var router=express[_0x9f12('0x4')]();var fs_extra=require(_0x9f12('0x5'));var auth=require(_0x9f12('0x6'));var interaction=require(_0x9f12('0x7'));var config=require(_0x9f12('0x8'));var controller=require(_0x9f12('0x9'));router[_0x9f12('0xa')]('/',auth[_0x9f12('0xb')](),controller[_0x9f12('0xc')]);router[_0x9f12('0xa')](_0x9f12('0xd'),auth[_0x9f12('0xb')](),controller['describe']);router['get'](_0x9f12('0xe'),auth[_0x9f12('0xb')](),controller['show']);router[_0x9f12('0xa')](_0x9f12('0xf'),auth['isAuthenticated'](),controller['getMessages']);router[_0x9f12('0xa')]('/:id/download',auth[_0x9f12('0xb')](),controller[_0x9f12('0x10')]);router[_0x9f12('0x11')]('/',auth[_0x9f12('0xb')](),controller[_0x9f12('0x12')]);router[_0x9f12('0x11')](_0x9f12('0xf'),auth['isAuthenticated'](),controller[_0x9f12('0x13')]);router[_0x9f12('0x11')]('/:id/tags',auth[_0x9f12('0xb')](),interaction[_0x9f12('0x14')](_0x9f12('0x15'),_0x9f12('0x16')),controller[_0x9f12('0x17')]);router[_0x9f12('0x18')]('/:id',auth[_0x9f12('0xb')](),interaction['tracked']('openchannel',_0x9f12('0x19')),controller[_0x9f12('0x1a')]);router['delete'](_0x9f12('0xe'),auth[_0x9f12('0xb')](),interaction[_0x9f12('0x14')](_0x9f12('0x15'),'openchannelinteraction:destroy'),controller[_0x9f12('0x1b')]);router['delete'](_0x9f12('0x1c'),auth[_0x9f12('0xb')](),controller[_0x9f12('0x1d')]);module[_0x9f12('0x1e')]=router; \ No newline at end of file +var _0x5a0f=['/:id/download','download','create','post','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','getMessages'];(function(_0x43c3db,_0x36ea7b){var _0x45e6b0=function(_0x56c691){while(--_0x56c691){_0x43c3db['push'](_0x43c3db['shift']());}};_0x45e6b0(++_0x36ea7b);}(_0x5a0f,0x12a));var _0xf5a0=function(_0x4384fe,_0x166622){_0x4384fe=_0x4384fe-0x0;var _0x38f157=_0x5a0f[_0x4384fe];return _0x38f157;};'use strict';var multer=require(_0xf5a0('0x0'));var util=require(_0xf5a0('0x1'));var path=require('path');var timeout=require(_0xf5a0('0x2'));var express=require(_0xf5a0('0x3'));var router=express[_0xf5a0('0x4')]();var fs_extra=require(_0xf5a0('0x5'));var auth=require(_0xf5a0('0x6'));var interaction=require(_0xf5a0('0x7'));var config=require(_0xf5a0('0x8'));var controller=require('./openchannelInteraction.controller');router[_0xf5a0('0x9')]('/',auth['isAuthenticated'](),controller[_0xf5a0('0xa')]);router[_0xf5a0('0x9')](_0xf5a0('0xb'),auth[_0xf5a0('0xc')](),controller[_0xf5a0('0xd')]);router[_0xf5a0('0x9')](_0xf5a0('0xe'),auth[_0xf5a0('0xc')](),controller[_0xf5a0('0xf')]);router[_0xf5a0('0x9')]('/:id/messages',auth[_0xf5a0('0xc')](),controller[_0xf5a0('0x10')]);router[_0xf5a0('0x9')](_0xf5a0('0x11'),auth['isAuthenticated'](),controller[_0xf5a0('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf5a0('0x13')]);router[_0xf5a0('0x14')](_0xf5a0('0x15'),auth[_0xf5a0('0xc')](),controller[_0xf5a0('0x16')]);router['post'](_0xf5a0('0x17'),auth[_0xf5a0('0xc')](),interaction[_0xf5a0('0x18')](_0xf5a0('0x19'),_0xf5a0('0x1a')),controller['addTags']);router[_0xf5a0('0x1b')](_0xf5a0('0xe'),auth['isAuthenticated'](),interaction['tracked'](_0xf5a0('0x19'),_0xf5a0('0x1c')),controller[_0xf5a0('0x1d')]);router[_0xf5a0('0x1e')](_0xf5a0('0xe'),auth['isAuthenticated'](),interaction['tracked'](_0xf5a0('0x19'),_0xf5a0('0x1f')),controller[_0xf5a0('0x20')]);router[_0xf5a0('0x1e')](_0xf5a0('0x17'),auth[_0xf5a0('0xc')](),controller[_0xf5a0('0x21')]);module[_0xf5a0('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 20bffa3..731095b 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 _0x1219=['STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0x7729b1,_0x468322){var _0x349504=function(_0x401cee){while(--_0x401cee){_0x7729b1['push'](_0x7729b1['shift']());}};_0x349504(++_0x468322);}(_0x1219,0x17c));var _0x9121=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1219[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9121('0x0'));module[_0x9121('0x1')]={'closed':{'type':Sequelize[_0x9121('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9121('0x3')]},'disposition':{'type':Sequelize[_0x9121('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x9121('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x9121('0x3')]},'threadId':{'type':Sequelize[_0x9121('0x4')]},'externalUrl':{'type':Sequelize[_0x9121('0x4')]},'lastMsgAt':{'type':Sequelize[_0x9121('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x9121('0x5')]('in',_0x9121('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x9121('0x5')]('in',_0x9121('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x9121('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x9121('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9121('0x7')]}}; \ No newline at end of file +var _0x287b=['ENUM','out','INTEGER','sequelize','BOOLEAN','DATE','STRING'];(function(_0x55000e,_0x378eab){var _0x474383=function(_0x3ee2c9){while(--_0x3ee2c9){_0x55000e['push'](_0x55000e['shift']());}};_0x474383(++_0x378eab);}(_0x287b,0x96));var _0xb287=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x287b[_0x59c301];return _0x3866b9;};'use strict';var Sequelize=require(_0xb287('0x0'));module['exports']={'closed':{'type':Sequelize[_0xb287('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb287('0x2')]},'disposition':{'type':Sequelize[_0xb287('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb287('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xb287('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xb287('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xb287('0x4')]('in',_0xb287('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xb287('0x4')]('in',_0xb287('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xb287('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xb287('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xb287('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 8cf0cfd..28e316e 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 _0x317e=['set','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','findAll','openchannel','user','catch','show','query','from','params','model','keys','OpenchannelInteraction','intersection','attributes','fields','includeAll','include','options','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','filters','hasOwnProperty','nolimit','sort','where','pick','OpenchannelInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','join','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','Attachment','Messages','createdAt','secret','read','OpenchannelAccount','Account','Owner','mkdirSync','closed','closedAt','disposition','threadId','Public','createReadStream','pipe','createWriteStream','basename','out','System','Contact','lastName','direction','value','renderFile','root','downloadInteraction.ejs','transcript-','.pdf','Openchannel','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x5c3aea,_0x15b367){var _0x3f8152=function(_0x2ab22e){while(--_0x2ab22e){_0x5c3aea['push'](_0x5c3aea['shift']());}};_0x3f8152(++_0x15b367);}(_0x317e,0x6b));var _0xe317=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0x317e[_0x999b85];return _0x1d7124;};'use strict';var rimraf=require(_0xe317('0x0'));var zipdir=require('zip-dir');var moment=require(_0xe317('0x1'));var util=require(_0xe317('0x2'));var path=require(_0xe317('0x3'));var ejs=require(_0xe317('0x4'));var fs=require('fs');var _=require(_0xe317('0x5'));var Redis=require(_0xe317('0x6'));var interaction=require(_0xe317('0x7'));var qs=require(_0xe317('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0xe317('0x9'))(_0xe317('0xa'));var config=require(_0xe317('0xb'));var db=require(_0xe317('0xc'))['db'];config[_0xe317('0xd')]=_[_0xe317('0xe')](config[_0xe317('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xe317('0xf'))(new Redis(config['redis']));require(_0xe317('0x10'))[_0xe317('0x11')](socket);function respondWithStatusCode(_0x58575f,_0x3c48ca){_0x3c48ca=_0x3c48ca||0xcc;return function(_0x5c3834){if(_0x5c3834){return _0x58575f[_0xe317('0x12')](_0x3c48ca);}return _0x58575f[_0xe317('0x13')](_0x3c48ca)[_0xe317('0x14')]();};}function respondWithResult(_0x3e3560,_0x5860ba){_0x5860ba=_0x5860ba||0xc8;return function(_0x1991a3){if(_0x1991a3){return _0x3e3560[_0xe317('0x13')](_0x5860ba)[_0xe317('0x15')](_0x1991a3);}};}function respondWithFilteredResult(_0x44fb99,_0x1c3c39){return function(_0x4c8f3f){if(_0x4c8f3f){var _0x1c49ca=typeof _0x1c3c39[_0xe317('0x16')]===_0xe317('0x17')&&typeof _0x1c3c39['limit']===_0xe317('0x17');var _0x956642=_0x4c8f3f['count'];var _0x204824=_0x1c49ca?0x0:_0x1c3c39[_0xe317('0x16')];var _0x42d03f=_0x1c49ca?_0x4c8f3f[_0xe317('0x18')]:_0x1c3c39[_0xe317('0x16')]+_0x1c3c39[_0xe317('0x19')];var _0x2dfbfa;if(_0x42d03f>=_0x956642){_0x42d03f=_0x956642;_0x2dfbfa=0xc8;}else{_0x2dfbfa=0xce;}_0x44fb99['status'](_0x2dfbfa);return _0x44fb99[_0xe317('0x1a')]('Content-Range',_0x204824+'-'+_0x42d03f+'/'+_0x956642)[_0xe317('0x15')](_0x4c8f3f);}return null;};}function saveUpdates(_0x20cb7e){return function(_0x3e612d){if(_0x3e612d){return _0x3e612d[_0xe317('0x1b')](_0x20cb7e)[_0xe317('0x1c')](function(_0x2a281b){return _0x2a281b;});}return null;};}function removeEntity(_0x9a990e){return function(_0x55e038){if(_0x55e038){return _0x55e038[_0xe317('0x1d')]()[_0xe317('0x1c')](function(){_0x9a990e[_0xe317('0x13')](0xcc)[_0xe317('0x14')]();});}};}function handleEntityNotFound(_0x5c27ae){return function(_0xdccf15){if(!_0xdccf15){_0x5c27ae[_0xe317('0x12')](0x194);}return _0xdccf15;};}function handleError(_0x32596c,_0x51add3){_0x51add3=_0x51add3||0x1f4;return function(_0x58e005){logger[_0xe317('0x1e')](_0x58e005[_0xe317('0x1f')]);if(_0x58e005[_0xe317('0x20')]){delete _0x58e005[_0xe317('0x20')];}_0x32596c[_0xe317('0x13')](_0x51add3)[_0xe317('0x21')](_0x58e005);};}exports['index']=function(_0x291175,_0x3e7c36){var _0x56f9fe={};var _0x4fa1b6=_['map'](db['OpenchannelInteraction'][_0xe317('0x22')],function(_0x13d9de){return{'name':_0x13d9de[_0xe317('0x23')],'type':_0x13d9de[_0xe317('0x24')][_0xe317('0x25')]};});_0x56f9fe=qs['getOptions'](_0x4fa1b6,_0x291175);return interaction[_0xe317('0x26')](_0xe317('0x27'),_0x291175['query'],_0x291175[_0xe317('0x28')],_0x56f9fe,_0x4fa1b6)[_0xe317('0x1c')](respondWithFilteredResult(_0x3e7c36,_0x56f9fe))[_0xe317('0x29')](handleError(_0x3e7c36,null));};exports[_0xe317('0x2a')]=function(_0x254e30,_0xcdaeab){var _0x148d8a={};if(_0x254e30[_0xe317('0x2b')][_0xe317('0x24')]&&_0x254e30[_0xe317('0x2b')]['type']===_0xe317('0x2c')){_0x148d8a[_0xe317('0x2c')]=_0x254e30[_0xe317('0x2d')]['id'];}else{_0x148d8a['id']=_0x254e30[_0xe317('0x2d')]['id'];}var _0x1201e7={'raw':![],'where':_0x148d8a},_0x24727d={};_0x24727d[_0xe317('0x2e')]=_[_0xe317('0x2f')](db[_0xe317('0x30')][_0xe317('0x22')]);_0x24727d[_0xe317('0x2b')]=_['keys'](_0x254e30['query']);_0x24727d['filters']=_[_0xe317('0x31')](_0x24727d[_0xe317('0x2e')],_0x24727d[_0xe317('0x2b')]);_0x1201e7[_0xe317('0x32')]=_[_0xe317('0x31')](_0x24727d[_0xe317('0x2e')],qs[_0xe317('0x33')](_0x254e30[_0xe317('0x2b')][_0xe317('0x33')]));_0x1201e7[_0xe317('0x32')]=_0x1201e7[_0xe317('0x32')]['length']?_0x1201e7[_0xe317('0x32')]:_0x24727d[_0xe317('0x2e')];if(_0x254e30[_0xe317('0x2b')][_0xe317('0x34')]){_0x1201e7[_0xe317('0x35')]=[{'all':!![]}];}_0x1201e7=_['merge']({},_0x1201e7,_0x254e30[_0xe317('0x36')]);return db['OpenchannelInteraction'][_0xe317('0x37')](_0x1201e7)[_0xe317('0x1c')](handleEntityNotFound(_0xcdaeab,null))['then'](respondWithResult(_0xcdaeab,null))['catch'](handleError(_0xcdaeab,null));};exports['create']=function(_0x286e39,_0x503014){return db[_0xe317('0x30')][_0xe317('0x38')](_0x286e39['body'],{})['then'](respondWithResult(_0x503014,0xc9))[_0xe317('0x29')](handleError(_0x503014,null));};exports['update']=function(_0x46c931,_0x246796){if(_0x46c931[_0xe317('0x39')]['id']){delete _0x46c931['body']['id'];}return db[_0xe317('0x30')][_0xe317('0x37')]({'where':{'id':_0x46c931['params']['id']}})[_0xe317('0x1c')](handleEntityNotFound(_0x246796,null))['then'](saveUpdates(_0x46c931[_0xe317('0x39')],null))[_0xe317('0x1c')](respondWithResult(_0x246796,null))[_0xe317('0x29')](handleError(_0x246796,null));};exports[_0xe317('0x1d')]=function(_0x4f74ea,_0xc56b92){return db[_0xe317('0x30')][_0xe317('0x37')]({'where':{'id':_0x4f74ea['params']['id']}})[_0xe317('0x1c')](handleEntityNotFound(_0xc56b92,null))[_0xe317('0x1c')](removeEntity(_0xc56b92,null))[_0xe317('0x29')](handleError(_0xc56b92,null));};exports[_0xe317('0x3a')]=function(_0x387f02,_0x50e940){return db[_0xe317('0x30')][_0xe317('0x3a')]()[_0xe317('0x1c')](respondWithResult(_0x50e940,null))[_0xe317('0x29')](handleError(_0x50e940,null));};exports[_0xe317('0x3b')]=function(_0x495fea,_0x2074bf){return db['OpenchannelMessage']['find']({'where':{'id':_0x495fea[_0xe317('0x2d')]['id']}})[_0xe317('0x1c')](handleEntityNotFound(_0x2074bf,null))['then'](function(_0x29d93a){if(_0x29d93a){return _0x29d93a['addMessage'](_0x495fea[_0xe317('0x39')][_0xe317('0x3c')],_[_0xe317('0x3d')](_0x495fea['body'],[_0xe317('0x3c'),'id'])||{});}})[_0xe317('0x1c')](respondWithResult(_0x2074bf,null))['catch'](handleError(_0x2074bf,null));};exports[_0xe317('0x3e')]=function(_0x8b40a8,_0x59f73d){var _0x12259b={'raw':![],'where':{}};var _0x4ae973={};var _0x3177bb={'count':0x0,'rows':[]};return db[_0xe317('0x30')][_0xe317('0x3f')]({'where':{'id':_0x8b40a8[_0xe317('0x2d')]['id']}})[_0xe317('0x1c')](handleEntityNotFound(_0x59f73d,null))['then'](function(_0x400842){if(_0x400842){_0x4ae973[_0xe317('0x2e')]=_[_0xe317('0x2f')](db[_0xe317('0x40')][_0xe317('0x22')]);_0x4ae973[_0xe317('0x2b')]=_[_0xe317('0x2f')](_0x8b40a8['query']);_0x4ae973[_0xe317('0x41')]=_['intersection'](_0x4ae973[_0xe317('0x2e')],_0x4ae973['query']);_0x12259b['attributes']=_['intersection'](_0x4ae973[_0xe317('0x2e')],qs[_0xe317('0x33')](_0x8b40a8[_0xe317('0x2b')][_0xe317('0x33')]));_0x12259b[_0xe317('0x32')]=_0x12259b['attributes']['length']?_0x12259b[_0xe317('0x32')]:_0x4ae973['model'];if(!_0x8b40a8[_0xe317('0x2b')][_0xe317('0x42')](_0xe317('0x43'))){_0x12259b['limit']=qs[_0xe317('0x19')](_0x8b40a8[_0xe317('0x2b')][_0xe317('0x19')]);_0x12259b[_0xe317('0x16')]=qs[_0xe317('0x16')](_0x8b40a8[_0xe317('0x2b')]['offset']);}_0x12259b['order']=qs[_0xe317('0x44')](_0x8b40a8['query'][_0xe317('0x44')]);_0x12259b[_0xe317('0x45')]=qs['filters'](_[_0xe317('0x46')](_0x8b40a8[_0xe317('0x2b')],_0x4ae973[_0xe317('0x41')]));_0x12259b[_0xe317('0x45')][_0xe317('0x47')]=_0x400842['id'];if(_0x8b40a8['query'][_0xe317('0x48')]){_0x12259b[_0xe317('0x45')]=_[_0xe317('0x49')](_0x12259b[_0xe317('0x45')],{'$or':_['map'](_0x12259b[_0xe317('0x32')],function(_0x6ff752){var _0x5cbe77={};_0x5cbe77[_0x6ff752]={'$like':'%'+_0x8b40a8[_0xe317('0x2b')][_0xe317('0x48')]+'%'};return _0x5cbe77;})});}if(_0x8b40a8[_0xe317('0x2b')][_0xe317('0x4a')]){var _0x3592dd=_0x8b40a8['query']['$gte'][_0xe317('0x4b')](',');var _0x25d864={};_0x25d864[_0x3592dd[0x0]]={'$gte':moment(_0x3592dd[0x1])[_0xe317('0x4c')](_0xe317('0x4d'))};_0x12259b[_0xe317('0x45')]=_[_0xe317('0x49')](_0x12259b[_0xe317('0x45')],_0x25d864);}_0x12259b=_[_0xe317('0x49')]({},_0x12259b,_0x8b40a8[_0xe317('0x36')]);return db['OpenchannelMessage']['count']({'where':_0x12259b['where']})[_0xe317('0x1c')](function(_0x575a55){_0x3177bb[_0xe317('0x18')]=_0x575a55;if(_0x8b40a8[_0xe317('0x2b')][_0xe317('0x34')]){_0x12259b['include']=[{'all':!![]}];}return db[_0xe317('0x40')][_0xe317('0x26')](_0x12259b);})['then'](function(_0x64856){_0x3177bb[_0xe317('0x4e')]=_0x64856;return _0x3177bb;});}})['then'](respondWithFilteredResult(_0x59f73d,_0x12259b))[_0xe317('0x29')](handleError(_0x59f73d,null));};exports[_0xe317('0x4f')]=function(_0x25db33,_0x59ffd9){return db[_0xe317('0x30')]['find']({'where':{'id':_0x25db33[_0xe317('0x2d')]['id']}})['then'](handleEntityNotFound(_0x59ffd9,null))[_0xe317('0x1c')](function(_0x97c3f2){if(_0x97c3f2){return _0x97c3f2[_0xe317('0x50')](_0x25db33[_0xe317('0x39')]['ids'],_[_0xe317('0x3d')](_0x25db33[_0xe317('0x39')],[_0xe317('0x3c'),'id'])||{})[_0xe317('0x51')](function(){return db[_0xe317('0x52')]['findAll']({'attributes':['id','name',_0xe317('0x53')],'where':{'id':_0x25db33['body'][_0xe317('0x3c')]}});})[_0xe317('0x1c')](function(_0x1a0869){socket[_0xe317('0x54')]('openchannelInteractionTags:save',{'id':Number(_0x25db33[_0xe317('0x2d')]['id']),'tags':_0x1a0869||[]});return{'id':Number(_0x25db33['params']['id']),'tags':_0x1a0869||[]};});}})[_0xe317('0x1c')](respondWithResult(_0x59ffd9,null))['catch'](handleError(_0x59ffd9,null));};exports[_0xe317('0x55')]=function(_0x3a58e9,_0x78e9ac){return db[_0xe317('0x30')][_0xe317('0x37')]({'where':{'id':_0x3a58e9[_0xe317('0x2d')]['id']}})['then'](handleEntityNotFound(_0x78e9ac,null))[_0xe317('0x1c')](function(_0x45d5da){if(_0x45d5da){return _0x45d5da[_0xe317('0x55')](_0x3a58e9['query'][_0xe317('0x3c')]);}})[_0xe317('0x1c')](respondWithStatusCode(_0x78e9ac,null))[_0xe317('0x29')](handleError(_0x78e9ac,null));};exports[_0xe317('0x56')]=function(_0x16da29,_0x40af55){var _0x927291=moment()[_0xe317('0x57')]()[_0xe317('0x58')]();var _0x150221=path[_0xe317('0x59')](config['root'],_0xe317('0x5a'),_0xe317('0x5b'),_0xe317('0x5c'));var _0xa6df91=path[_0xe317('0x59')](config['root'],_0xe317('0x5a'),'files',_0xe317('0x5d'));var _0x40bd26=path[_0xe317('0x59')](_0x150221,_0x927291);var _0x59167f=util[_0xe317('0x4c')](_0xe317('0x5e'),_0x16da29[_0xe317('0x2d')]['id'],_0x927291);var _0x1b24f8=path[_0xe317('0x59')](_0x150221,_0x59167f);var _0x114670=[];_0x114670[_0xe317('0x5f')]({'model':db[_0xe317('0x60')],'as':_0xe317('0x60'),'attributes':['id',_0xe317('0x61')],'raw':!![]});_0x114670[_0xe317('0x5f')]({'model':db[_0xe317('0x62')],'as':'Contact','attributes':['id',_0xe317('0x63'),'lastName'],'raw':!![]});if(_0x16da29['query']['attachments']){_0x114670['push']({'model':db[_0xe317('0x64')],'as':_0xe317('0x64'),'raw':!![]});}var _0x76f5ee=[{'model':db[_0xe317('0x40')],'as':_0xe317('0x65'),'attributes':['id','body',_0xe317('0x66'),'direction',_0xe317('0x67'),_0xe317('0x68')],'include':_0x114670}];_0x76f5ee['push']({'model':db[_0xe317('0x69')],'as':_0xe317('0x6a'),'attributes':['id',_0xe317('0x20')]});_0x76f5ee['push']({'model':db[_0xe317('0x60')],'as':_0xe317('0x6b'),'attributes':['id',_0xe317('0x61')]});return db[_0xe317('0x30')][_0xe317('0x37')]({'where':{'id':_0x16da29[_0xe317('0x2d')]['id']},'include':_0x76f5ee})[_0xe317('0x1c')](handleEntityNotFound(_0x40af55,null))[_0xe317('0x1c')](function(_0x1a7a12){if(_0x1a7a12){var _0x3e17af=_0x1a7a12['get']({'plain':!![]});fs[_0xe317('0x6c')](_0x40bd26);var _0x3977d1={'channel':'Openchannel','account':_0x3e17af[_0xe317('0x6a')][_0xe317('0x20')],'agent':_0x3e17af[_0xe317('0x6b')]?_0x3e17af[_0xe317('0x6b')][_0xe317('0x61')]:'N.A.','createdAt':moment(_0x3e17af[_0xe317('0x66')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xe317('0x58')](),'closedAt':_0x3e17af[_0xe317('0x6d')]?moment(_0x3e17af[_0xe317('0x6e')])['format'](_0xe317('0x4d'))[_0xe317('0x58')]():'','disposition':_0x3e17af[_0xe317('0x6f')],'visibility':_0x3e17af[_0xe317('0x70')]?_0xe317('0x71'):'Private','messages':_(_0x3e17af[_0xe317('0x65')])['filter']({'secret':![]})['map'](function(_0x42f009){if(_0x42f009['Attachment']){var _0x42fd2d=path[_0xe317('0x59')](_0xa6df91,_0x42f009[_0xe317('0x64')]['basename']);if(fs['existsSync'](_0x42fd2d)){fs[_0xe317('0x72')](_0x42fd2d)[_0xe317('0x73')](fs[_0xe317('0x74')](path[_0xe317('0x59')](_0x40bd26,_0x42f009[_0xe317('0x64')][_0xe317('0x75')])));}}return{'date':moment(_0x42f009['createdAt'])['format'](_0xe317('0x4d'))[_0xe317('0x58')](),'sender':_0x42f009['direction']===_0xe317('0x76')?_0x42f009['User']?_0x42f009[_0xe317('0x60')][_0xe317('0x61')]:_0xe317('0x77'):_0x42f009[_0xe317('0x78')][_0xe317('0x63')]+(_0x42f009['Contact']['lastName']?'\x20'+_0x42f009[_0xe317('0x78')][_0xe317('0x79')]:''),'body':_0x42f009[_0xe317('0x64')]?_0x42f009[_0xe317('0x64')][_0xe317('0x75')]:_0x42f009[_0xe317('0x39')],'direction':_0x42f009[_0xe317('0x7a')]===_0xe317('0x76')?'A':'C','secret':_0x42f009[_0xe317('0x67')],'read':_0x42f009[_0xe317('0x68')],'attachment':_0x42f009[_0xe317('0x64')]};})[_0xe317('0x7b')]()};return ejs[_0xe317('0x7c')](path['join'](config[_0xe317('0x7d')],_0xe317('0x5a'),'views',_0xe317('0x7e')),{'interaction':_0x3977d1})[_0xe317('0x1c')](function(_0x40e6fa){var _0x4b7032=path['join'](_0x40bd26,_0xe317('0x7f')+_0x3e17af['id']+'-'+_0x927291+_0xe317('0x80'));var _0x38dc34={'path':_0x4b7032,'channel':_0xe317('0x81'),'interactionId':_0x3e17af['id']};return pdf[_0xe317('0x82')](_0x40e6fa,_0x38dc34);})['then'](function(){return new Promise(function(_0x47ce7e,_0x2bf127){zipdir(_0x40bd26,{'saveTo':_0x1b24f8},function(_0x2b8ee2,_0x5cdc45){if(_0x2b8ee2)return _0x2bf127(_0x2b8ee2);return _0x47ce7e(_0x5cdc45);});})[_0xe317('0x1c')](function(){return new Promise(function(_0x162d5a,_0x3805d0){rimraf(_0x40bd26,function(_0x41bd18){if(_0x41bd18)_0x3805d0(_0x41bd18);return _0x162d5a();});});})[_0xe317('0x1c')](function(){return _0x40af55[_0xe317('0x56')](_0x1b24f8,_0x59167f,function(_0xcd9f2e){if(_0xcd9f2e){logger[_0xe317('0x1e')](_0xe317('0x83'),_0xcd9f2e);}else{fs[_0xe317('0x84')](_0x1b24f8);}});});});}else{return _0x40af55[_0xe317('0x12')](0xc8);}})[_0xe317('0x29')](handleError(_0x40af55,null));}; \ No newline at end of file +var _0x4194=['filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','unix','toString','join','server','root','files','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','lastName','Attachment','Messages','direction','secret','read','OpenchannelAccount','Owner','get','Account','createdAt','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','createWriteStream','out','System','Contact','firstName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Openchannel','download','Unable\x20to\x20delete\x20zip\x20file','zip-dir','moment','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./openchannelInteraction.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','end','sendStatus','error','name','send','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','catch','show','from','params','keys','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','findOne','hasOwnProperty','order','sort','where','pick','OpenchannelInteractionId'];(function(_0x18ad7f,_0x34ddd1){var _0x5223d1=function(_0x633c09){while(--_0x633c09){_0x18ad7f['push'](_0x18ad7f['shift']());}};_0x5223d1(++_0x34ddd1);}(_0x4194,0x1c2));var _0x4419=function(_0x34d114,_0x30ddca){_0x34d114=_0x34d114-0x0;var _0x3b66c4=_0x4194[_0x34d114];return _0x3b66c4;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x4419('0x0'));var moment=require(_0x4419('0x1'));var util=require(_0x4419('0x2'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4419('0x3'));var Redis=require(_0x4419('0x4'));var interaction=require(_0x4419('0x5'));var qs=require(_0x4419('0x6'));var pdf=require(_0x4419('0x7'));var logger=require(_0x4419('0x8'))(_0x4419('0x9'));var config=require(_0x4419('0xa'));var db=require('../../mysqldb')['db'];config[_0x4419('0xb')]=_['defaults'](config[_0x4419('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x4419('0xc'))(new Redis(config[_0x4419('0xb')]));require(_0x4419('0xd'))[_0x4419('0xe')](socket);function respondWithStatusCode(_0x5288fa,_0xd76c63){_0xd76c63=_0xd76c63||0xcc;return function(_0x3819f5){if(_0x3819f5){return _0x5288fa['sendStatus'](_0xd76c63);}return _0x5288fa[_0x4419('0xf')](_0xd76c63)['end']();};}function respondWithResult(_0x285b2e,_0x13ae75){_0x13ae75=_0x13ae75||0xc8;return function(_0x35bbc6){if(_0x35bbc6){return _0x285b2e[_0x4419('0xf')](_0x13ae75)[_0x4419('0x10')](_0x35bbc6);}};}function respondWithFilteredResult(_0x3525c0,_0x2b0872){return function(_0x7027d1){if(_0x7027d1){var _0x2586f3=typeof _0x2b0872[_0x4419('0x11')]==='undefined'&&typeof _0x2b0872[_0x4419('0x12')]===_0x4419('0x13');var _0x158c71=_0x7027d1[_0x4419('0x14')];var _0x1bc076=_0x2586f3?0x0:_0x2b0872[_0x4419('0x11')];var _0x5e1b14=_0x2586f3?_0x7027d1[_0x4419('0x14')]:_0x2b0872['offset']+_0x2b0872[_0x4419('0x12')];var _0x30f8fe;if(_0x5e1b14>=_0x158c71){_0x5e1b14=_0x158c71;_0x30f8fe=0xc8;}else{_0x30f8fe=0xce;}_0x3525c0[_0x4419('0xf')](_0x30f8fe);return _0x3525c0[_0x4419('0x15')](_0x4419('0x16'),_0x1bc076+'-'+_0x5e1b14+'/'+_0x158c71)['json'](_0x7027d1);}return null;};}function saveUpdates(_0x2db857){return function(_0x2e1103){if(_0x2e1103){return _0x2e1103[_0x4419('0x17')](_0x2db857)[_0x4419('0x18')](function(_0x5010c6){return _0x5010c6;});}return null;};}function removeEntity(_0x565a08){return function(_0x42ff64){if(_0x42ff64){return _0x42ff64[_0x4419('0x19')]()[_0x4419('0x18')](function(){_0x565a08[_0x4419('0xf')](0xcc)[_0x4419('0x1a')]();});}};}function handleEntityNotFound(_0x4cc4d3){return function(_0x2da40d){if(!_0x2da40d){_0x4cc4d3[_0x4419('0x1b')](0x194);}return _0x2da40d;};}function handleError(_0x2e7707,_0x362ce5){_0x362ce5=_0x362ce5||0x1f4;return function(_0x4e6849){logger[_0x4419('0x1c')](_0x4e6849['stack']);if(_0x4e6849[_0x4419('0x1d')]){delete _0x4e6849[_0x4419('0x1d')];}_0x2e7707['status'](_0x362ce5)[_0x4419('0x1e')](_0x4e6849);};}exports['index']=function(_0x35c724,_0x2502f6){var _0x20c817={};var _0x13a328=_['map'](db[_0x4419('0x1f')][_0x4419('0x20')],function(_0x459a9e){return{'name':_0x459a9e[_0x4419('0x21')],'type':_0x459a9e[_0x4419('0x22')][_0x4419('0x23')]};});_0x20c817=qs[_0x4419('0x24')](_0x13a328,_0x35c724);return interaction[_0x4419('0x25')]('openchannel',_0x35c724[_0x4419('0x26')],_0x35c724[_0x4419('0x27')],_0x20c817,_0x13a328)[_0x4419('0x18')](respondWithFilteredResult(_0x2502f6,_0x20c817))[_0x4419('0x28')](handleError(_0x2502f6,null));};exports[_0x4419('0x29')]=function(_0x3fcac4,_0x337c6e){var _0x33d0e8={};if(_0x3fcac4[_0x4419('0x26')][_0x4419('0x22')]&&_0x3fcac4[_0x4419('0x26')]['type']===_0x4419('0x2a')){_0x33d0e8[_0x4419('0x2a')]=_0x3fcac4[_0x4419('0x2b')]['id'];}else{_0x33d0e8['id']=_0x3fcac4[_0x4419('0x2b')]['id'];}var _0x816841={'raw':![],'where':_0x33d0e8},_0x50f8dc={};_0x50f8dc['model']=_[_0x4419('0x2c')](db[_0x4419('0x1f')]['rawAttributes']);_0x50f8dc[_0x4419('0x26')]=_[_0x4419('0x2c')](_0x3fcac4[_0x4419('0x26')]);_0x50f8dc[_0x4419('0x2d')]=_[_0x4419('0x2e')](_0x50f8dc[_0x4419('0x2f')],_0x50f8dc[_0x4419('0x26')]);_0x816841[_0x4419('0x30')]=_[_0x4419('0x2e')](_0x50f8dc[_0x4419('0x2f')],qs[_0x4419('0x31')](_0x3fcac4['query']['fields']));_0x816841[_0x4419('0x30')]=_0x816841[_0x4419('0x30')][_0x4419('0x32')]?_0x816841[_0x4419('0x30')]:_0x50f8dc[_0x4419('0x2f')];if(_0x3fcac4[_0x4419('0x26')][_0x4419('0x33')]){_0x816841[_0x4419('0x34')]=[{'all':!![]}];}_0x816841=_[_0x4419('0x35')]({},_0x816841,_0x3fcac4[_0x4419('0x36')]);return db['OpenchannelInteraction'][_0x4419('0x37')](_0x816841)['then'](handleEntityNotFound(_0x337c6e,null))[_0x4419('0x18')](respondWithResult(_0x337c6e,null))[_0x4419('0x28')](handleError(_0x337c6e,null));};exports[_0x4419('0x38')]=function(_0x4145e2,_0x11dfed){return db[_0x4419('0x1f')]['create'](_0x4145e2[_0x4419('0x39')],{})['then'](respondWithResult(_0x11dfed,0xc9))[_0x4419('0x28')](handleError(_0x11dfed,null));};exports[_0x4419('0x17')]=function(_0x1a0adc,_0x58db87){if(_0x1a0adc['body']['id']){delete _0x1a0adc[_0x4419('0x39')]['id'];}return db[_0x4419('0x1f')][_0x4419('0x37')]({'where':{'id':_0x1a0adc['params']['id']}})[_0x4419('0x18')](handleEntityNotFound(_0x58db87,null))[_0x4419('0x18')](saveUpdates(_0x1a0adc['body'],null))[_0x4419('0x18')](respondWithResult(_0x58db87,null))['catch'](handleError(_0x58db87,null));};exports[_0x4419('0x19')]=function(_0x60daae,_0x4c5776){return db['OpenchannelInteraction'][_0x4419('0x37')]({'where':{'id':_0x60daae[_0x4419('0x2b')]['id']}})[_0x4419('0x18')](handleEntityNotFound(_0x4c5776,null))[_0x4419('0x18')](removeEntity(_0x4c5776,null))[_0x4419('0x28')](handleError(_0x4c5776,null));};exports[_0x4419('0x3a')]=function(_0x52e1b2,_0x5d72ec){return db[_0x4419('0x1f')][_0x4419('0x3a')]()['then'](respondWithResult(_0x5d72ec,null))[_0x4419('0x28')](handleError(_0x5d72ec,null));};exports[_0x4419('0x3b')]=function(_0x28892b,_0x188c00){return db[_0x4419('0x3c')][_0x4419('0x37')]({'where':{'id':_0x28892b['params']['id']}})[_0x4419('0x18')](handleEntityNotFound(_0x188c00,null))['then'](function(_0x34c0b8){if(_0x34c0b8){return _0x34c0b8[_0x4419('0x3b')](_0x28892b[_0x4419('0x39')][_0x4419('0x3d')],_[_0x4419('0x3e')](_0x28892b[_0x4419('0x39')],[_0x4419('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x188c00,null))['catch'](handleError(_0x188c00,null));};exports['getMessages']=function(_0x35715a,_0xdbb168){var _0x32a61d={'raw':![],'where':{}};var _0x29490e={};var _0xccd5dc={'count':0x0,'rows':[]};return db[_0x4419('0x1f')][_0x4419('0x3f')]({'where':{'id':_0x35715a['params']['id']}})[_0x4419('0x18')](handleEntityNotFound(_0xdbb168,null))['then'](function(_0x459858){if(_0x459858){_0x29490e[_0x4419('0x2f')]=_[_0x4419('0x2c')](db[_0x4419('0x3c')][_0x4419('0x20')]);_0x29490e[_0x4419('0x26')]=_[_0x4419('0x2c')](_0x35715a[_0x4419('0x26')]);_0x29490e['filters']=_[_0x4419('0x2e')](_0x29490e[_0x4419('0x2f')],_0x29490e[_0x4419('0x26')]);_0x32a61d[_0x4419('0x30')]=_[_0x4419('0x2e')](_0x29490e['model'],qs['fields'](_0x35715a[_0x4419('0x26')][_0x4419('0x31')]));_0x32a61d['attributes']=_0x32a61d['attributes'][_0x4419('0x32')]?_0x32a61d[_0x4419('0x30')]:_0x29490e[_0x4419('0x2f')];if(!_0x35715a[_0x4419('0x26')][_0x4419('0x40')]('nolimit')){_0x32a61d[_0x4419('0x12')]=qs[_0x4419('0x12')](_0x35715a[_0x4419('0x26')][_0x4419('0x12')]);_0x32a61d[_0x4419('0x11')]=qs[_0x4419('0x11')](_0x35715a[_0x4419('0x26')][_0x4419('0x11')]);}_0x32a61d[_0x4419('0x41')]=qs[_0x4419('0x42')](_0x35715a['query'][_0x4419('0x42')]);_0x32a61d[_0x4419('0x43')]=qs['filters'](_[_0x4419('0x44')](_0x35715a['query'],_0x29490e[_0x4419('0x2d')]));_0x32a61d[_0x4419('0x43')][_0x4419('0x45')]=_0x459858['id'];if(_0x35715a['query'][_0x4419('0x46')]){_0x32a61d[_0x4419('0x43')]=_[_0x4419('0x35')](_0x32a61d['where'],{'$or':_[_0x4419('0x47')](_0x32a61d[_0x4419('0x30')],function(_0x5b9f81){var _0x949bbc={};_0x949bbc[_0x5b9f81]={'$like':'%'+_0x35715a[_0x4419('0x26')][_0x4419('0x46')]+'%'};return _0x949bbc;})});}if(_0x35715a['query'][_0x4419('0x48')]){var _0x13d39d=_0x35715a[_0x4419('0x26')][_0x4419('0x48')][_0x4419('0x49')](',');var _0x3fda77={};_0x3fda77[_0x13d39d[0x0]]={'$gte':moment(_0x13d39d[0x1])[_0x4419('0x4a')](_0x4419('0x4b'))};_0x32a61d['where']=_[_0x4419('0x35')](_0x32a61d[_0x4419('0x43')],_0x3fda77);}_0x32a61d=_[_0x4419('0x35')]({},_0x32a61d,_0x35715a[_0x4419('0x36')]);return db[_0x4419('0x3c')]['count']({'where':_0x32a61d[_0x4419('0x43')]})[_0x4419('0x18')](function(_0x1a8000){_0xccd5dc[_0x4419('0x14')]=_0x1a8000;if(_0x35715a[_0x4419('0x26')][_0x4419('0x33')]){_0x32a61d[_0x4419('0x34')]=[{'all':!![]}];}return db[_0x4419('0x3c')][_0x4419('0x25')](_0x32a61d);})[_0x4419('0x18')](function(_0x127fcd){_0xccd5dc[_0x4419('0x4c')]=_0x127fcd;return _0xccd5dc;});}})[_0x4419('0x18')](respondWithFilteredResult(_0xdbb168,_0x32a61d))['catch'](handleError(_0xdbb168,null));};exports[_0x4419('0x4d')]=function(_0x13b8e5,_0x298751){return db[_0x4419('0x1f')][_0x4419('0x37')]({'where':{'id':_0x13b8e5[_0x4419('0x2b')]['id']}})['then'](handleEntityNotFound(_0x298751,null))[_0x4419('0x18')](function(_0x383d27){if(_0x383d27){return _0x383d27[_0x4419('0x4e')](_0x13b8e5[_0x4419('0x39')][_0x4419('0x3d')],_[_0x4419('0x3e')](_0x13b8e5[_0x4419('0x39')],[_0x4419('0x3d'),'id'])||{})[_0x4419('0x4f')](function(){return db[_0x4419('0x50')]['findAll']({'attributes':['id',_0x4419('0x1d'),_0x4419('0x51')],'where':{'id':_0x13b8e5['body'][_0x4419('0x3d')]}});})[_0x4419('0x18')](function(_0x581798){socket[_0x4419('0x52')](_0x4419('0x53'),{'id':Number(_0x13b8e5['params']['id']),'tags':_0x581798||[]});return{'id':Number(_0x13b8e5['params']['id']),'tags':_0x581798||[]};});}})[_0x4419('0x18')](respondWithResult(_0x298751,null))['catch'](handleError(_0x298751,null));};exports[_0x4419('0x54')]=function(_0x3ba6b2,_0x3b7e67){return db['OpenchannelInteraction'][_0x4419('0x37')]({'where':{'id':_0x3ba6b2['params']['id']}})[_0x4419('0x18')](handleEntityNotFound(_0x3b7e67,null))[_0x4419('0x18')](function(_0x187e71){if(_0x187e71){return _0x187e71[_0x4419('0x54')](_0x3ba6b2[_0x4419('0x26')][_0x4419('0x3d')]);}})[_0x4419('0x18')](respondWithStatusCode(_0x3b7e67,null))[_0x4419('0x28')](handleError(_0x3b7e67,null));};exports['download']=function(_0x318e34,_0x2be440){var _0x34515e=moment()[_0x4419('0x55')]()[_0x4419('0x56')]();var _0x4c37eb=path[_0x4419('0x57')](config['root'],_0x4419('0x58'),'files','tmp');var _0x50b120=path[_0x4419('0x57')](config[_0x4419('0x59')],_0x4419('0x58'),_0x4419('0x5a'),_0x4419('0x5b'));var _0x546ba9=path['join'](_0x4c37eb,_0x34515e);var _0x2a939f=util[_0x4419('0x4a')](_0x4419('0x5c'),_0x318e34[_0x4419('0x2b')]['id'],_0x34515e);var _0x554812=path[_0x4419('0x57')](_0x4c37eb,_0x2a939f);var _0x12d80d=[];_0x12d80d[_0x4419('0x5d')]({'model':db[_0x4419('0x5e')],'as':_0x4419('0x5e'),'attributes':['id',_0x4419('0x5f')],'raw':!![]});_0x12d80d['push']({'model':db[_0x4419('0x60')],'as':'Contact','attributes':['id','firstName',_0x4419('0x61')],'raw':!![]});if(_0x318e34[_0x4419('0x26')]['attachments']){_0x12d80d['push']({'model':db[_0x4419('0x62')],'as':_0x4419('0x62'),'raw':!![]});}var _0x13da21=[{'model':db[_0x4419('0x3c')],'as':_0x4419('0x63'),'attributes':['id',_0x4419('0x39'),'createdAt',_0x4419('0x64'),_0x4419('0x65'),_0x4419('0x66')],'include':_0x12d80d}];_0x13da21[_0x4419('0x5d')]({'model':db[_0x4419('0x67')],'as':'Account','attributes':['id',_0x4419('0x1d')]});_0x13da21[_0x4419('0x5d')]({'model':db[_0x4419('0x5e')],'as':_0x4419('0x68'),'attributes':['id',_0x4419('0x5f')]});return db[_0x4419('0x1f')][_0x4419('0x37')]({'where':{'id':_0x318e34['params']['id']},'include':_0x13da21})['then'](handleEntityNotFound(_0x2be440,null))['then'](function(_0x359d14){if(_0x359d14){var _0x1cd550=_0x359d14[_0x4419('0x69')]({'plain':!![]});fs['mkdirSync'](_0x546ba9);var _0x36ab35={'channel':'Openchannel','account':_0x1cd550[_0x4419('0x6a')][_0x4419('0x1d')],'agent':_0x1cd550[_0x4419('0x68')]?_0x1cd550[_0x4419('0x68')][_0x4419('0x5f')]:'N.A.','createdAt':moment(_0x1cd550[_0x4419('0x6b')])[_0x4419('0x4a')](_0x4419('0x4b'))[_0x4419('0x56')](),'closedAt':_0x1cd550[_0x4419('0x6c')]?moment(_0x1cd550[_0x4419('0x6d')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x4419('0x56')]():'','disposition':_0x1cd550[_0x4419('0x6e')],'visibility':_0x1cd550[_0x4419('0x6f')]?_0x4419('0x70'):_0x4419('0x71'),'messages':_(_0x1cd550[_0x4419('0x63')])[_0x4419('0x46')]({'secret':![]})['map'](function(_0x10bfd0){if(_0x10bfd0[_0x4419('0x62')]){var _0x1a0054=path[_0x4419('0x57')](_0x50b120,_0x10bfd0['Attachment'][_0x4419('0x72')]);if(fs[_0x4419('0x73')](_0x1a0054)){fs[_0x4419('0x74')](_0x1a0054)['pipe'](fs[_0x4419('0x75')](path[_0x4419('0x57')](_0x546ba9,_0x10bfd0[_0x4419('0x62')][_0x4419('0x72')])));}}return{'date':moment(_0x10bfd0['createdAt'])[_0x4419('0x4a')](_0x4419('0x4b'))[_0x4419('0x56')](),'sender':_0x10bfd0[_0x4419('0x64')]===_0x4419('0x76')?_0x10bfd0['User']?_0x10bfd0[_0x4419('0x5e')][_0x4419('0x5f')]:_0x4419('0x77'):_0x10bfd0[_0x4419('0x78')][_0x4419('0x79')]+(_0x10bfd0[_0x4419('0x78')][_0x4419('0x61')]?'\x20'+_0x10bfd0[_0x4419('0x78')]['lastName']:''),'body':_0x10bfd0[_0x4419('0x62')]?_0x10bfd0[_0x4419('0x62')][_0x4419('0x72')]:_0x10bfd0[_0x4419('0x39')],'direction':_0x10bfd0[_0x4419('0x64')]===_0x4419('0x76')?'A':'C','secret':_0x10bfd0[_0x4419('0x65')],'read':_0x10bfd0[_0x4419('0x66')],'attachment':_0x10bfd0['Attachment']};})['value']()};return ejs[_0x4419('0x7a')](path[_0x4419('0x57')](config[_0x4419('0x59')],'server',_0x4419('0x7b'),_0x4419('0x7c')),{'interaction':_0x36ab35})[_0x4419('0x18')](function(_0x18be0d){var _0x55b47f=path[_0x4419('0x57')](_0x546ba9,_0x4419('0x7d')+_0x1cd550['id']+'-'+_0x34515e+_0x4419('0x7e'));var _0xa52c67={'path':_0x55b47f,'channel':_0x4419('0x7f'),'interactionId':_0x1cd550['id']};return pdf['createPdfFromHTML'](_0x18be0d,_0xa52c67);})[_0x4419('0x18')](function(){return new Promise(function(_0x585060,_0x1f1247){zipdir(_0x546ba9,{'saveTo':_0x554812},function(_0x1526b0,_0x3fadef){if(_0x1526b0)return _0x1f1247(_0x1526b0);return _0x585060(_0x3fadef);});})[_0x4419('0x18')](function(){return new Promise(function(_0x2c6b5a,_0x56fe82){rimraf(_0x546ba9,function(_0x35e764){if(_0x35e764)_0x56fe82(_0x35e764);return _0x2c6b5a();});});})[_0x4419('0x18')](function(){return _0x2be440[_0x4419('0x80')](_0x554812,_0x2a939f,function(_0x5df79f){if(_0x5df79f){logger[_0x4419('0x1c')](_0x4419('0x81'),_0x5df79f);}else{fs['unlinkSync'](_0x554812);}});});});}else{return _0x2be440[_0x4419('0x1b')](0xc8);}})[_0x4419('0x28')](handleError(_0x2be440,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index d43393a..fd09209 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 _0xb107=['findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction','setMaxListeners','getUsers','then'];(function(_0x1f909a,_0x15d56f){var _0x543f16=function(_0x17a991){while(--_0x17a991){_0x1f909a['push'](_0x1f909a['shift']());}};_0x543f16(++_0x15d56f);}(_0xb107,0x1c2));var _0x7b10=function(_0x47fe37,_0x43cb27){_0x47fe37=_0x47fe37-0x0;var _0x8d0e01=_0xb107[_0x47fe37];return _0x8d0e01;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x7b10('0x0'))['db'][_0x7b10('0x1')];var OpenchannelMessage=require(_0x7b10('0x0'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7b10('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x145e23){return function(_0x563280,_0x2b89c3,_0x5f0075){_0x563280[_0x7b10('0x3')]({'attributes':['id'],'raw':!![]})[_0x7b10('0x4')](function(_0x1d5104){_0x563280['setDataValue']('Users',_0x1d5104['map'](function(_0x2ca06){return{'id':_0x2ca06['id']};}));return OpenchannelMessage[_0x7b10('0x5')]({'where':{'OpenchannelInteractionId':_0x563280['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x22d194){_0x563280[_0x7b10('0x6')](_0x7b10('0x7'),_0x22d194['length']);OpenchannelInteractionEvents['emit'](_0x145e23+':'+_0x563280['id'],_0x563280);OpenchannelInteractionEvents[_0x7b10('0x8')](_0x145e23,_0x563280);_0x5f0075(null);})[_0x7b10('0x9')](_0x5f0075(null));};}for(var e in events){if(events[_0x7b10('0xa')](e)){var event=events[e];OpenchannelInteraction[_0x7b10('0xb')](e,emitEvent(event));}}module[_0x7b10('0xc')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xf917=['then','unreadMessages','length','emit','hasOwnProperty','hook','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','update','getUsers','setDataValue','Users','map','findAll'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf917,0x106));var _0x7f91=function(_0x60337,_0x163a14){_0x60337=_0x60337-0x0;var _0x48e690=_0xf917[_0x60337];return _0x48e690;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x7f91('0x0'))['db'][_0x7f91('0x1')];var OpenchannelMessage=require(_0x7f91('0x0'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7f91('0x2')](0x0);var events={'afterCreate':_0x7f91('0x3'),'afterUpdate':_0x7f91('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5485f4){return function(_0x4b8756,_0x52a01a,_0xb25946){_0x4b8756[_0x7f91('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x33c3aa){_0x4b8756[_0x7f91('0x6')](_0x7f91('0x7'),_0x33c3aa[_0x7f91('0x8')](function(_0x32a140){return{'id':_0x32a140['id']};}));return OpenchannelMessage[_0x7f91('0x9')]({'where':{'OpenchannelInteractionId':_0x4b8756['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7f91('0xa')](function(_0x3f8bb0){_0x4b8756[_0x7f91('0x6')](_0x7f91('0xb'),_0x3f8bb0[_0x7f91('0xc')]);OpenchannelInteractionEvents[_0x7f91('0xd')](_0x5485f4+':'+_0x4b8756['id'],_0x4b8756);OpenchannelInteractionEvents[_0x7f91('0xd')](_0x5485f4,_0x4b8756);_0xb25946(null);})['catch'](_0xb25946(null));};}for(var e in events){if(events[_0x7f91('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x7f91('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 66b8326..376e77b 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 _0x8185=['bluebird','rimraf','../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment'];(function(_0x32244a,_0x4f2de2){var _0x15e26b=function(_0x117e05){while(--_0x117e05){_0x32244a['push'](_0x32244a['shift']());}};_0x15e26b(++_0x4f2de2);}(_0x8185,0x188));var _0x5818=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x8185[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x5818('0x0'));var util=require(_0x5818('0x1'));var logger=require(_0x5818('0x2'))('api');var moment=require(_0x5818('0x3'));var BPromise=require(_0x5818('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5818('0x5'));var config=require(_0x5818('0x6'));var attributes=require('./openchannelInteraction.attributes');module[_0x5818('0x7')]=function(_0x58388a,_0x1af0e3){return _0x58388a[_0x5818('0x8')](_0x5818('0x9'),attributes,{'tableName':_0x5818('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5818('0xb'),'collate':_0x5818('0xc'),'hooks':{'beforeUpdate':function(_0x1921b8,_0xb40883,_0x460b7f){if(_0x1921b8[_0x5818('0xd')](_0x5818('0xe'))){_0x1921b8[_0x5818('0xf')]=moment()[_0x5818('0x10')](_0x5818('0x11'));}_0x460b7f(null,_0x1921b8);}}});}; \ No newline at end of file +var _0xf18a=['api','moment','bluebird','../../config/environment','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x4e1862,_0x34cc0c){var _0x183190=function(_0x19b0fe){while(--_0x19b0fe){_0x4e1862['push'](_0x4e1862['shift']());}};_0x183190(++_0x34cc0c);}(_0xf18a,0x19d));var _0xaf18=function(_0x259651,_0x1ecfe8){_0x259651=_0x259651-0x0;var _0x5624f3=_0xf18a[_0x259651];return _0x5624f3;};'use strict';var _=require(_0xaf18('0x0'));var util=require(_0xaf18('0x1'));var logger=require(_0xaf18('0x2'))(_0xaf18('0x3'));var moment=require(_0xaf18('0x4'));var BPromise=require(_0xaf18('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaf18('0x6'));var attributes=require(_0xaf18('0x7'));module[_0xaf18('0x8')]=function(_0x594367,_0x5f50d4){return _0x594367[_0xaf18('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0xaf18('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaf18('0xb'),'collate':_0xaf18('0xc'),'hooks':{'beforeUpdate':function(_0x5dd145,_0x55fac8,_0x1ac538){if(_0x5dd145[_0xaf18('0xd')](_0xaf18('0xe'))){_0x5dd145['closedAt']=moment()['format'](_0xaf18('0xf'));}_0x1ac538(null,_0x5dd145);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index dee81ea..92afd6a 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 _0x087f=['find','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction'];(function(_0x441b1a,_0x1a470e){var _0x13a718=function(_0x3674c5){while(--_0x3674c5){_0x441b1a['push'](_0x441b1a['shift']());}};_0x13a718(++_0x1a470e);}(_0x087f,0x1be));var _0xf087=function(_0x934c00,_0x40d18d){_0x934c00=_0x934c00-0x0;var _0x323115=_0x087f[_0x934c00];return _0x323115;};'use strict';var _=require(_0xf087('0x0'));var util=require(_0xf087('0x1'));var moment=require(_0xf087('0x2'));var BPromise=require('bluebird');var rs=require(_0xf087('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf087('0x4'))['db'];var utils=require(_0xf087('0x5'));var logger=require(_0xf087('0x6'))('rpc');var config=require(_0xf087('0x7'));var jayson=require(_0xf087('0x8'));var client=jayson[_0xf087('0x9')][_0xf087('0xa')]({'port':0x232a});config[_0xf087('0xb')]=_[_0xf087('0xc')](config[_0xf087('0xb')],{'host':_0xf087('0xd'),'port':0x18eb});var socket=require(_0xf087('0xe'))(new Redis(config[_0xf087('0xb')]));require(_0xf087('0xf'))['register'](socket);function respondWithRpcPromise(_0x4d7116,_0x4e888e,_0x58160c){return new BPromise(function(_0x508449,_0x10cf74){return client[_0xf087('0x10')](_0x4d7116,_0x58160c)[_0xf087('0x11')](function(_0x1e56a3){logger['info'](_0xf087('0x12'),_0x4e888e,_0xf087('0x13'));logger[_0xf087('0x14')](_0xf087('0x15'),_0x4e888e,_0xf087('0x13'),JSON[_0xf087('0x16')](_0x1e56a3));if(_0x1e56a3[_0xf087('0x17')]){if(_0x1e56a3[_0xf087('0x17')][_0xf087('0x18')]===0x1f4){logger[_0xf087('0x17')](_0xf087('0x12'),_0x4e888e,_0x1e56a3[_0xf087('0x17')][_0xf087('0x19')]);return _0x10cf74(_0x1e56a3[_0xf087('0x17')][_0xf087('0x19')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x4e888e,_0x1e56a3[_0xf087('0x17')]['message']);return _0x508449(_0x1e56a3['error']['message']);}else{logger[_0xf087('0x1a')](_0xf087('0x12'),_0x4e888e,_0xf087('0x13'));_0x508449(_0x1e56a3[_0xf087('0x1b')][_0xf087('0x19')]);}})[_0xf087('0x1c')](function(_0x39dc7d){logger[_0xf087('0x17')](_0xf087('0x12'),_0x4e888e,_0x39dc7d);_0x10cf74(_0x39dc7d);});});}exports[_0xf087('0x1d')]=function(_0x5c61b5){var _0x267d2c=this;return new Promise(function(_0x48e392,_0x6a9c81){return db[_0xf087('0x1e')]['update'](_0x5c61b5[_0xf087('0x1f')],{'raw':_0x5c61b5[_0xf087('0x20')]?_0x5c61b5['options'][_0xf087('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c61b5[_0xf087('0x20')]?_0x5c61b5[_0xf087('0x20')][_0xf087('0x22')]||null:null,'attributes':_0x5c61b5[_0xf087('0x20')]?_0x5c61b5[_0xf087('0x20')][_0xf087('0x23')]||null:null,'limit':_0x5c61b5[_0xf087('0x20')]?_0x5c61b5[_0xf087('0x20')][_0xf087('0x24')]||null:null})[_0xf087('0x11')](function(_0x4b0b81){logger['info']('UpdateOpenchannelInteraction',_0x5c61b5);logger[_0xf087('0x14')]('UpdateOpenchannelInteraction',_0x5c61b5,JSON[_0xf087('0x16')](_0x4b0b81));_0x48e392(_0x4b0b81);})['catch'](function(_0x508fe2){logger['error'](_0xf087('0x1d'),_0x508fe2[_0xf087('0x19')],_0x5c61b5);_0x6a9c81(_0x267d2c[_0xf087('0x17')](0x1f4,_0x508fe2['message']));});});};exports[_0xf087('0x25')]=function(_0x49ee12){return new Promise(function(_0xca6ad1,_0x1c4069){return db[_0xf087('0x1e')][_0xf087('0x26')]({'where':_0x49ee12[_0xf087('0x20')]?_0x49ee12['options'][_0xf087('0x22')]||null:null})[_0xf087('0x11')](function(_0x5ee35a){if(_0x5ee35a){return _0x5ee35a[_0xf087('0x27')](_0x49ee12['body'][_0xf087('0x28')],_[_0xf087('0x29')](_0x49ee12['body'],[_0xf087('0x28'),'id'])||{});}})[_0xf087('0x2a')](function(_0x3a98c4){logger['info']('AddTags',_0x49ee12);logger[_0xf087('0x14')](_0xf087('0x2b'),_0x49ee12,JSON[_0xf087('0x16')](_0x3a98c4));_0xca6ad1(_0x3a98c4);})['catch'](function(_0x2a87b8){logger[_0xf087('0x17')](_0xf087('0x2b'),_0x2a87b8['message'],_0x49ee12);_0x1c4069(_this[_0xf087('0x17')](0x1f4,_0x2a87b8[_0xf087('0x19')]));});});}; \ No newline at end of file +var _0xeb49=['limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTags','omit','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','OpenchannelInteraction','update','body','options','attributes'];(function(_0x154d92,_0x5b249a){var _0x55afa6=function(_0x3adc13){while(--_0x3adc13){_0x154d92['push'](_0x154d92['shift']());}};_0x55afa6(++_0x5b249a);}(_0xeb49,0xf8));var _0x9eb4=function(_0x1700f6,_0x5069ee){_0x1700f6=_0x1700f6-0x0;var _0x539e8b=_0xeb49[_0x1700f6];return _0x539e8b;};'use strict';var _=require(_0x9eb4('0x0'));var util=require(_0x9eb4('0x1'));var moment=require(_0x9eb4('0x2'));var BPromise=require('bluebird');var rs=require(_0x9eb4('0x3'));var fs=require('fs');var Redis=require(_0x9eb4('0x4'));var db=require(_0x9eb4('0x5'))['db'];var utils=require(_0x9eb4('0x6'));var logger=require('../../config/logger')(_0x9eb4('0x7'));var config=require('../../config/environment');var jayson=require(_0x9eb4('0x8'));var client=jayson[_0x9eb4('0x9')]['http']({'port':0x232a});config[_0x9eb4('0xa')]=_[_0x9eb4('0xb')](config[_0x9eb4('0xa')],{'host':_0x9eb4('0xc'),'port':0x18eb});var socket=require(_0x9eb4('0xd'))(new Redis(config[_0x9eb4('0xa')]));require(_0x9eb4('0xe'))[_0x9eb4('0xf')](socket);function respondWithRpcPromise(_0x508383,_0x1d01c7,_0x2d8eef){return new BPromise(function(_0x39cd79,_0x591d07){return client['request'](_0x508383,_0x2d8eef)[_0x9eb4('0x10')](function(_0x43bb2d){logger[_0x9eb4('0x11')](_0x9eb4('0x12'),_0x1d01c7,'request\x20sent');logger[_0x9eb4('0x13')](_0x9eb4('0x14'),_0x1d01c7,_0x9eb4('0x15'),JSON[_0x9eb4('0x16')](_0x43bb2d));if(_0x43bb2d[_0x9eb4('0x17')]){if(_0x43bb2d[_0x9eb4('0x17')]['code']===0x1f4){logger[_0x9eb4('0x17')](_0x9eb4('0x12'),_0x1d01c7,_0x43bb2d[_0x9eb4('0x17')][_0x9eb4('0x18')]);return _0x591d07(_0x43bb2d[_0x9eb4('0x17')][_0x9eb4('0x18')]);}logger[_0x9eb4('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1d01c7,_0x43bb2d[_0x9eb4('0x17')][_0x9eb4('0x18')]);return _0x39cd79(_0x43bb2d['error'][_0x9eb4('0x18')]);}else{logger[_0x9eb4('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1d01c7,_0x9eb4('0x15'));_0x39cd79(_0x43bb2d[_0x9eb4('0x19')][_0x9eb4('0x18')]);}})[_0x9eb4('0x1a')](function(_0x5d71ed){logger[_0x9eb4('0x17')](_0x9eb4('0x12'),_0x1d01c7,_0x5d71ed);_0x591d07(_0x5d71ed);});});}exports['UpdateOpenchannelInteraction']=function(_0x14637f){var _0x2a2936=this;return new Promise(function(_0x2ab9ba,_0x1145e1){return db[_0x9eb4('0x1b')][_0x9eb4('0x1c')](_0x14637f[_0x9eb4('0x1d')],{'raw':_0x14637f['options']?_0x14637f[_0x9eb4('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14637f['options']?_0x14637f[_0x9eb4('0x1e')]['where']||null:null,'attributes':_0x14637f[_0x9eb4('0x1e')]?_0x14637f[_0x9eb4('0x1e')][_0x9eb4('0x1f')]||null:null,'limit':_0x14637f['options']?_0x14637f[_0x9eb4('0x1e')][_0x9eb4('0x20')]||null:null})[_0x9eb4('0x10')](function(_0x74de4e){logger[_0x9eb4('0x11')](_0x9eb4('0x21'),_0x14637f);logger[_0x9eb4('0x13')]('UpdateOpenchannelInteraction',_0x14637f,JSON[_0x9eb4('0x16')](_0x74de4e));_0x2ab9ba(_0x74de4e);})[_0x9eb4('0x1a')](function(_0x2fc1d2){logger[_0x9eb4('0x17')](_0x9eb4('0x21'),_0x2fc1d2[_0x9eb4('0x18')],_0x14637f);_0x1145e1(_0x2a2936[_0x9eb4('0x17')](0x1f4,_0x2fc1d2[_0x9eb4('0x18')]));});});};exports[_0x9eb4('0x22')]=function(_0x2dacc8){return new Promise(function(_0x2e8810,_0x4eb31a){return db[_0x9eb4('0x1b')]['find']({'where':_0x2dacc8[_0x9eb4('0x1e')]?_0x2dacc8['options']['where']||null:null})[_0x9eb4('0x10')](function(_0x507679){if(_0x507679){return _0x507679[_0x9eb4('0x23')](_0x2dacc8['body']['ids'],_[_0x9eb4('0x24')](_0x2dacc8[_0x9eb4('0x1d')],[_0x9eb4('0x25'),'id'])||{});}})[_0x9eb4('0x26')](function(_0x3a559b){logger[_0x9eb4('0x11')]('AddTags',_0x2dacc8);logger[_0x9eb4('0x13')]('AddTags',_0x2dacc8,JSON['stringify'](_0x3a559b));_0x2e8810(_0x3a559b);})[_0x9eb4('0x1a')](function(_0xc3ed5f){logger['error'](_0x9eb4('0x27'),_0xc3ed5f[_0x9eb4('0x18')],_0x2dacc8);_0x4eb31a(_this[_0x9eb4('0x17')](0x1f4,_0xc3ed5f[_0x9eb4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index a37a31c..59b7f38 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 _0xdc62=['emit','removeListener','register','length','openchannelInteraction:','save','remove'];(function(_0x41d476,_0xf9b1d2){var _0x29f30e=function(_0x48e4dd){while(--_0x48e4dd){_0x41d476['push'](_0x41d476['shift']());}};_0x29f30e(++_0xf9b1d2);}(_0xdc62,0x1c5));var _0x2dc6=function(_0x3513fd,_0x47aa02){_0x3513fd=_0x3513fd-0x0;var _0x478188=_0xdc62[_0x3513fd];return _0x478188;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x2dc6('0x0'),_0x2dc6('0x1'),'update'];function createListener(_0x3437b0,_0x661cb8){return function(_0x1fb01a){_0x661cb8[_0x2dc6('0x2')](_0x3437b0,_0x1fb01a);};}function removeListener(_0x5c5944,_0x124ae8){return function(){OpenchannelInteractionEvents[_0x2dc6('0x3')](_0x5c5944,_0x124ae8);};}exports[_0x2dc6('0x4')]=function(_0x18ab74){for(var _0x13f465=0x0,_0x878c0e=events[_0x2dc6('0x5')];_0x13f465<_0x878c0e;_0x13f465++){var _0x1db633=events[_0x13f465];var _0x15f9ec=createListener(_0x2dc6('0x6')+_0x1db633,_0x18ab74);OpenchannelInteractionEvents['on'](_0x1db633,_0x15f9ec);}}; \ No newline at end of file +var _0x6403=['save','remove','update','emit','removeListener','register','./openchannelInteraction.events'];(function(_0x3f2450,_0x26220d){var _0xfab67e=function(_0x43f14d){while(--_0x43f14d){_0x3f2450['push'](_0x3f2450['shift']());}};_0xfab67e(++_0x26220d);}(_0x6403,0x6f));var _0x3640=function(_0x1e1101,_0x4bfc18){_0x1e1101=_0x1e1101-0x0;var _0x57ad9f=_0x6403[_0x1e1101];return _0x57ad9f;};'use strict';var OpenchannelInteractionEvents=require(_0x3640('0x0'));var events=[_0x3640('0x1'),_0x3640('0x2'),_0x3640('0x3')];function createListener(_0x52f9e6,_0x310c97){return function(_0x4c3d39){_0x310c97[_0x3640('0x4')](_0x52f9e6,_0x4c3d39);};}function removeListener(_0x143482,_0x348758){return function(){OpenchannelInteractionEvents[_0x3640('0x5')](_0x143482,_0x348758);};}exports[_0x3640('0x6')]=function(_0x23ae99){for(var _0x24dee7=0x0,_0x18810c=events['length'];_0x24dee7<_0x18810c;_0x24dee7++){var _0x1df9b6=events[_0x24dee7];var _0x23bfb0=createListener('openchannelInteraction:'+_0x1df9b6,_0x23ae99);OpenchannelInteractionEvents['on'](_0x1df9b6,_0x23bfb0);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 165c39e..aed7cf6 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x19d5a0,_0x2892a3){_0x19d5a0=_0x19d5a0-0x0;var _0x5a368b=_0x70e0[_0x19d5a0];return _0x5a368b;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x15de81,_0x2f17c4){var _0x3d7088=function(_0x390de8){while(--_0x390de8){_0x15de81['push'](_0x15de81['shift']());}};_0x3d7088(++_0x2f17c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index abca6de..c392f80 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 _0x4dd3=['exports','TEXT','BOOLEAN','out','DATE','sequelize'];(function(_0x43112d,_0x56bd6c){var _0xc37ced=function(_0x2de066){while(--_0x2de066){_0x43112d['push'](_0x43112d['shift']());}};_0xc37ced(++_0x56bd6c);}(_0x4dd3,0xf5));var _0x34dd=function(_0x491cbe,_0x45c8ba){_0x491cbe=_0x491cbe-0x0;var _0x59449d=_0x4dd3[_0x491cbe];return _0x59449d;};'use strict';var Sequelize=require(_0x34dd('0x0'));module[_0x34dd('0x1')]={'body':{'type':Sequelize[_0x34dd('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x34dd('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x34dd('0x4')),'defaultValue':_0x34dd('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x34dd('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x34dd('0x2')]}}; \ No newline at end of file +var _0xbb35=['medium','BOOLEAN','out','DATE','STRING','exports','TEXT'];(function(_0x377e08,_0x2eb9b3){var _0x3e43f8=function(_0x76207d){while(--_0x76207d){_0x377e08['push'](_0x377e08['shift']());}};_0x3e43f8(++_0x2eb9b3);}(_0xbb35,0x1d3));var _0x5bb3=function(_0x5187ba,_0x50e8ee){_0x5187ba=_0x5187ba-0x0;var _0x33d898=_0xbb35[_0x5187ba];return _0x33d898;};'use strict';var Sequelize=require('sequelize');module[_0x5bb3('0x0')]={'body':{'type':Sequelize[_0x5bb3('0x1')](_0x5bb3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5bb3('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x5bb3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5bb3('0x4')),'defaultValue':_0x5bb3('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x5bb3('0x5')]},'providerName':{'type':Sequelize[_0x5bb3('0x6')]},'providerResponse':{'type':Sequelize[_0x5bb3('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 708eae5..1dc0ad9 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 _0x325a=['params','describe','openchannel-interactions','accept','openchannel','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','role','null','acceptMessage','ContactId','QueryTypes','SELECT','contact','User','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','fullname','email','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','json','offset','limit','undefined','count','status','apply','reject','end','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','show','keys','find','create','body','update'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x325a,0x1b5));var _0xa325=function(_0x30a5d6,_0x27e5b2){_0x30a5d6=_0x30a5d6-0x0;var _0x2db33e=_0x325a[_0x30a5d6];return _0x2db33e;};'use strict';var emlformat=require(_0xa325('0x0'));var rimraf=require(_0xa325('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa325('0x2'));var rp=require(_0xa325('0x3'));var moment=require('moment');var BPromise=require(_0xa325('0x4'));var Mustache=require(_0xa325('0x5'));var util=require(_0xa325('0x6'));var path=require(_0xa325('0x7'));var sox=require(_0xa325('0x8'));var csv=require('to-csv');var ejs=require(_0xa325('0x9'));var fs=require('fs');var fs_extra=require(_0xa325('0xa'));var _=require(_0xa325('0xb'));var squel=require(_0xa325('0xc'));var crypto=require(_0xa325('0xd'));var jsforce=require(_0xa325('0xe'));var deskjs=require(_0xa325('0xf'));var toCsv=require(_0xa325('0x10'));var querystring=require('querystring');var Papa=require(_0xa325('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa325('0x12'));var as=require(_0xa325('0x13'));var hardwareService=require(_0xa325('0x14'));var logger=require(_0xa325('0x15'))('api');var utils=require(_0xa325('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa325('0x17'));var db=require(_0xa325('0x18'))['db'];config['redis']=_['defaults'](config[_0xa325('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xa325('0x1a'))(new Redis(config[_0xa325('0x19')]));require(_0xa325('0x1b'))[_0xa325('0x1c')](socket);var jayson=require(_0xa325('0x1d'));var client=jayson[_0xa325('0x1e')][_0xa325('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xa325('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1fd878,_0xec3c75,_0x5d3e0c,_0x243fdc){return new BPromise(function(_0x2e0ec2,_0x49960b){var _0x3406b7=_0x243fdc||client;return _0x3406b7['request'](_0x1fd878,_0x5d3e0c)[_0xa325('0x20')](function(_0xe6a0c9){logger[_0xa325('0x21')](_0xa325('0x22'),_0xec3c75,_0xa325('0x23'));logger[_0xa325('0x24')](_0xa325('0x25'),_0xec3c75,_0xa325('0x23'),JSON[_0xa325('0x26')](_0xe6a0c9));if(_0xe6a0c9[_0xa325('0x27')]){if(_0xe6a0c9[_0xa325('0x27')]['code']===0x1f4){logger[_0xa325('0x27')](_0xa325('0x22'),_0xec3c75,_0xe6a0c9[_0xa325('0x27')][_0xa325('0x28')]);return _0x49960b(_0xe6a0c9[_0xa325('0x27')]['message']);}logger[_0xa325('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0xec3c75,_0xe6a0c9['error'][_0xa325('0x28')]);return _0x2e0ec2(_0xe6a0c9['error'][_0xa325('0x28')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0xec3c75,'request\x20sent');_0x2e0ec2(_0xe6a0c9[_0xa325('0x29')][_0xa325('0x28')]);}})[_0xa325('0x2a')](function(_0x495a25){logger['error'](_0xa325('0x22'),_0xec3c75,_0x495a25);_0x49960b(_0x495a25);});});}function respondWithStatusCode(_0x5d10ae,_0x34c8ac){_0x34c8ac=_0x34c8ac||0xcc;return function(_0xfceeeb){if(_0xfceeeb){return _0x5d10ae[_0xa325('0x2b')](_0x34c8ac);}return _0x5d10ae['status'](_0x34c8ac)['end']();};}function respondWithResult(_0x54e2f9,_0x137423){_0x137423=_0x137423||0xc8;return function(_0x206733){if(_0x206733){return _0x54e2f9['status'](_0x137423)[_0xa325('0x2c')](_0x206733);}};}function respondWithFilteredResult(_0x4e4ae8,_0x37473c){return function(_0x2427cf){if(_0x2427cf){var _0x4e80e7=typeof _0x37473c[_0xa325('0x2d')]==='undefined'&&typeof _0x37473c[_0xa325('0x2e')]===_0xa325('0x2f');var _0x23ad6f=_0x2427cf[_0xa325('0x30')];var _0x437dfe=_0x4e80e7?0x0:_0x37473c[_0xa325('0x2d')];var _0x373d56=_0x4e80e7?_0x2427cf[_0xa325('0x30')]:_0x37473c[_0xa325('0x2d')]+_0x37473c[_0xa325('0x2e')];var _0x15df43;if(_0x373d56>=_0x23ad6f){_0x373d56=_0x23ad6f;_0x15df43=0xc8;}else{_0x15df43=0xce;}_0x4e4ae8[_0xa325('0x31')](_0x15df43);return _0x4e4ae8['set']('Content-Range',_0x437dfe+'-'+_0x373d56+'/'+_0x23ad6f)[_0xa325('0x2c')](_0x2427cf);}return null;};}function patchUpdates(_0x2bdbd6){return function(_0x539d61){try{jsonpatch[_0xa325('0x32')](_0x539d61,_0x2bdbd6,!![]);}catch(_0x244956){return BPromise[_0xa325('0x33')](_0x244956);}return _0x539d61['save']();};}function saveUpdates(_0x1e9b4b,_0x988f48){return function(_0x5c7255){if(_0x5c7255){return _0x5c7255['update'](_0x1e9b4b)['then'](function(_0x17169f){return _0x17169f;});}return null;};}function removeEntity(_0x2d5895,_0x4f0a7b){return function(_0x25d489){if(_0x25d489){return _0x25d489['destroy']()['then'](function(){_0x2d5895['status'](0xcc)[_0xa325('0x34')]();});}};}function handleEntityNotFound(_0x22879e,_0x5210d3){return function(_0x401c1b){if(!_0x401c1b){_0x22879e[_0xa325('0x2b')](0x194);}return _0x401c1b;};}function handleError(_0x7b68f2,_0x4bfef1){_0x4bfef1=_0x4bfef1||0x1f4;return function(_0x24bc7a){logger[_0xa325('0x27')](_0x24bc7a[_0xa325('0x35')]);if(_0x24bc7a[_0xa325('0x36')]){delete _0x24bc7a[_0xa325('0x36')];}_0x7b68f2['status'](_0x4bfef1)[_0xa325('0x37')](_0x24bc7a);};}exports[_0xa325('0x38')]=function(_0x54d280,_0x4542c8){var _0x3f2968={},_0x2f6ec8={},_0x82547c={'count':0x0,'rows':[]};var _0x20ae80=_['map'](db[_0xa325('0x39')][_0xa325('0x3a')],function(_0x111846){return{'name':_0x111846[_0xa325('0x3b')],'type':_0x111846[_0xa325('0x3c')][_0xa325('0x3d')]};});_0x2f6ec8['model']=_['map'](_0x20ae80,_0xa325('0x36'));_0x2f6ec8[_0xa325('0x3e')]=_['keys'](_0x54d280['query']);_0x2f6ec8[_0xa325('0x3f')]=_[_0xa325('0x40')](_0x2f6ec8['model'],_0x2f6ec8['query']);_0x3f2968[_0xa325('0x41')]=_[_0xa325('0x40')](_0x2f6ec8[_0xa325('0x42')],qs[_0xa325('0x43')](_0x54d280[_0xa325('0x3e')][_0xa325('0x43')]));_0x3f2968[_0xa325('0x41')]=_0x3f2968[_0xa325('0x41')][_0xa325('0x44')]?_0x3f2968[_0xa325('0x41')]:_0x2f6ec8[_0xa325('0x42')];if(!_0x54d280[_0xa325('0x3e')][_0xa325('0x45')]('nolimit')){_0x3f2968[_0xa325('0x2e')]=qs[_0xa325('0x2e')](_0x54d280[_0xa325('0x3e')]['limit']);_0x3f2968[_0xa325('0x2d')]=qs[_0xa325('0x2d')](_0x54d280['query'][_0xa325('0x2d')]);}_0x3f2968[_0xa325('0x46')]=qs['sort'](_0x54d280[_0xa325('0x3e')][_0xa325('0x47')]);_0x3f2968[_0xa325('0x48')]=qs[_0xa325('0x3f')](_[_0xa325('0x49')](_0x54d280[_0xa325('0x3e')],_0x2f6ec8[_0xa325('0x3f')]),_0x20ae80);if(_0x54d280[_0xa325('0x3e')]['filter']){_0x3f2968[_0xa325('0x48')]=_[_0xa325('0x4a')](_0x3f2968['where'],{'$or':_[_0xa325('0x4b')](_0x20ae80,function(_0x1a6b4e){if(_0x1a6b4e['type']!==_0xa325('0x4c')){var _0x29a180={};_0x29a180[_0x1a6b4e[_0xa325('0x36')]]={'$like':'%'+_0x54d280[_0xa325('0x3e')][_0xa325('0x4d')]+'%'};return _0x29a180;}})});}_0x3f2968=_['merge']({},_0x3f2968,_0x54d280[_0xa325('0x4e')]);var _0x1e1ed8={'where':_0x3f2968[_0xa325('0x48')]};return db[_0xa325('0x39')][_0xa325('0x30')](_0x1e1ed8)[_0xa325('0x20')](function(_0x1ff39d){_0x82547c[_0xa325('0x30')]=_0x1ff39d;if(_0x54d280[_0xa325('0x3e')][_0xa325('0x4f')]){_0x3f2968[_0xa325('0x50')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x3f2968);})[_0xa325('0x20')](function(_0x490fca){_0x82547c['rows']=_0x490fca;return _0x82547c;})['then'](respondWithFilteredResult(_0x4542c8,_0x3f2968))['catch'](handleError(_0x4542c8,null));};exports[_0xa325('0x51')]=function(_0x3a4714,_0x1dcba1){var _0x7a3b42={'raw':!![],'where':{'id':_0x3a4714['params']['id']}},_0x98bbb9={};_0x98bbb9[_0xa325('0x42')]=_[_0xa325('0x52')](db[_0xa325('0x39')]['rawAttributes']);_0x98bbb9[_0xa325('0x3e')]=_['keys'](_0x3a4714['query']);_0x98bbb9[_0xa325('0x3f')]=_[_0xa325('0x40')](_0x98bbb9[_0xa325('0x42')],_0x98bbb9[_0xa325('0x3e')]);_0x7a3b42[_0xa325('0x41')]=_[_0xa325('0x40')](_0x98bbb9[_0xa325('0x42')],qs['fields'](_0x3a4714[_0xa325('0x3e')][_0xa325('0x43')]));_0x7a3b42[_0xa325('0x41')]=_0x7a3b42[_0xa325('0x41')][_0xa325('0x44')]?_0x7a3b42[_0xa325('0x41')]:_0x98bbb9['model'];if(_0x3a4714[_0xa325('0x3e')][_0xa325('0x4f')]){_0x7a3b42[_0xa325('0x50')]=[{'all':!![]}];}_0x7a3b42=_['merge']({},_0x7a3b42,_0x3a4714[_0xa325('0x4e')]);return db[_0xa325('0x39')][_0xa325('0x53')](_0x7a3b42)[_0xa325('0x20')](handleEntityNotFound(_0x1dcba1,null))['then'](respondWithResult(_0x1dcba1,null))['catch'](handleError(_0x1dcba1,null));};exports[_0xa325('0x54')]=function(_0x5d70ef,_0x4bab8a){return db[_0xa325('0x39')]['create'](_0x5d70ef[_0xa325('0x55')],{})[_0xa325('0x20')](respondWithResult(_0x4bab8a,0xc9))[_0xa325('0x2a')](handleError(_0x4bab8a,null));};exports[_0xa325('0x56')]=function(_0x11f9d7,_0x485f63){if(_0x11f9d7[_0xa325('0x55')]['id']){delete _0x11f9d7[_0xa325('0x55')]['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0x11f9d7[_0xa325('0x57')]['id']}})[_0xa325('0x20')](handleEntityNotFound(_0x485f63,null))[_0xa325('0x20')](saveUpdates(_0x11f9d7[_0xa325('0x55')],null))[_0xa325('0x20')](respondWithResult(_0x485f63,null))[_0xa325('0x2a')](handleError(_0x485f63,null));};exports['destroy']=function(_0x375c77,_0x1a5048){return db[_0xa325('0x39')][_0xa325('0x53')]({'where':{'id':_0x375c77['params']['id']}})['then'](handleEntityNotFound(_0x1a5048,null))['then'](removeEntity(_0x1a5048,null))[_0xa325('0x2a')](handleError(_0x1a5048,null));};exports['describe']=function(_0xfe42a2,_0x47b333){return db[_0xa325('0x39')][_0xa325('0x58')]()[_0xa325('0x20')](respondWithResult(_0x47b333,null))[_0xa325('0x2a')](handleError(_0x47b333,null));};var interaction_log=require(_0xa325('0x15'))(_0xa325('0x59'));exports[_0xa325('0x5a')]=function(_0x5bde69,_0x2ca780,_0x104335){var _0xf95c63={'agent':{},'channel':_0xa325('0x5b')};if(_0x5bde69[_0xa325('0x55')]['id']){delete _0x5bde69[_0xa325('0x55')]['id'];}_0x5bde69['body'][_0xa325('0x5c')]=!![];_0x5bde69[_0xa325('0x55')][_0xa325('0x5d')]=moment()[_0xa325('0x5e')](_0xa325('0x5f'));_0x5bde69[_0xa325('0x55')]['UserId']=_0x5bde69[_0xa325('0x55')][_0xa325('0x60')]||_0x5bde69[_0xa325('0x61')]['id'];_0xf95c63[_0xa325('0x62')]['id']=_0x5bde69[_0xa325('0x55')][_0xa325('0x60')];return db[_0xa325('0x39')][_0xa325('0x53')]({'where':{'id':_0x5bde69[_0xa325('0x57')]['id'],'UserId':null}})[_0xa325('0x20')](handleEntityNotFound(_0x2ca780,null))[_0xa325('0x20')](saveUpdates(_0x5bde69[_0xa325('0x55')],null))[_0xa325('0x20')](function(_0x21b631){if(_0x21b631){_0xf95c63[_0xa325('0x28')]=_0x21b631[_0xa325('0x63')]({'plain':!![]});return db[_0xa325('0x64')]['find']({'where':{'id':_0x21b631[_0xa325('0x65')]}});}return null;})[_0xa325('0x20')](handleEntityNotFound(_0x2ca780,null))['then'](function(_0x5888fd){if(_0x5888fd){return _0x5888fd['update']({'UserId':_0x5bde69[_0xa325('0x55')][_0xa325('0x60')],'read1stAt':_[_0xa325('0x66')](_0x5888fd[_0xa325('0x67')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xa325('0x20')](function(_0x566abf){if(_0x566abf){_0xf95c63[_0xa325('0x68')]=_0x566abf['get']({'plain':!![]});interaction_log[_0xa325('0x21')](_0xa325('0x69'),_0x5bde69[_0xa325('0x61')]['id'],_0x5bde69[_0xa325('0x61')][_0xa325('0x36')],_0x5bde69[_0xa325('0x61')][_0xa325('0x6a')],_0xf95c63['interaction']['id'],_0x5bde69[_0xa325('0x55')]?JSON[_0xa325('0x26')](_0x5bde69[_0xa325('0x55')]):_0xa325('0x6b'));return respondWithRpcPromise('AcceptMessage',_0xa325('0x6c'),_0xf95c63);}return null;})['then'](function(_0x5dc15d){var _0x2b9e4b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5dc15d[_0xa325('0x28')][_0xa325('0x6d')];return db['sequelize'][_0xa325('0x3e')](_0x2b9e4b,{'type':db['Sequelize'][_0xa325('0x6e')][_0xa325('0x6f')],'raw':!![]})[_0xa325('0x20')](function(_0xbe24ba){return _0xbe24ba;});})[_0xa325('0x20')](function(_0x227cff){if(_0x227cff){_0xf95c63[_0xa325('0x28')][_0xa325('0x70')]=_0x227cff[0x0];if(!_0x5bde69[_0xa325('0x55')][_0xa325('0x60')])return;return db[_0xa325('0x71')]['find']({'where':{'id':_0x5bde69[_0xa325('0x55')][_0xa325('0x60')],'role':_0xa325('0x62')},'attributes':['id','name','fullname','email',_0xa325('0x72')],'raw':!![]});}return null;})[_0xa325('0x20')](function(_0x42631e){if(!_0x42631e)return null;_0xf95c63[_0xa325('0x28')][_0xa325('0x62')]=_0x42631e;return _0xf95c63;})['then'](function(_0x2b4fda){if(_0x2b4fda){if(_0x5bde69[_0xa325('0x55')][_0xa325('0x73')]){_0xf95c63[_0xa325('0x28')][_0xa325('0x74')]=util[_0xa325('0x5e')](_0xa325('0x75'),_0x5bde69['user'][_0xa325('0x36')]);_0xf95c63['message'][_0xa325('0x76')]=_0xf95c63[_0xa325('0x76')];_0xf95c63['message'][_0xa325('0x77')]=_0xf95c63[_0xa325('0x76')];_0xf95c63[_0xa325('0x28')][_0xa325('0x78')]='accept';return respondWithRpcPromise(_0xa325('0x79'),_0xa325('0x79'),{'event':_0xa325('0x7a'),'message':_0xf95c63[_0xa325('0x28')]},client9002)[_0xa325('0x20')](function(){return _0xf95c63;});}return _0xf95c63;}return null;})[_0xa325('0x20')](respondWithResult(_0x2ca780,null))[_0xa325('0x2a')](handleError(_0x2ca780,null));};var interaction_log=require(_0xa325('0x15'))(_0xa325('0x59'));exports['reject']=function(_0x53010a,_0x7fb6a3,_0x5303d1){var _0x3df391={'agent':{},'channel':_0xa325('0x5b')};if(_0x53010a['body']['id']){delete _0x53010a['body']['id'];}_0x53010a[_0xa325('0x55')][_0xa325('0x60')]=_0x53010a[_0xa325('0x55')][_0xa325('0x60')]||_0x53010a[_0xa325('0x61')]['id'];_0x3df391[_0xa325('0x62')]['id']=_0x53010a['body']['UserId'];return db['OpenchannelMessage']['find']({'where':{'id':_0x53010a[_0xa325('0x57')]['id'],'UserId':null}})[_0xa325('0x20')](handleEntityNotFound(_0x7fb6a3,null))['then'](function(_0x340d22){if(_0x340d22){_0x3df391[_0xa325('0x28')]=_0x340d22[_0xa325('0x63')]({'plain':!![]});return db[_0xa325('0x64')][_0xa325('0x53')]({'where':{'id':_0x340d22['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x7fb6a3,null))[_0xa325('0x20')](function(_0x3abf3b){if(_0x3abf3b){_0x3df391[_0xa325('0x68')]=_0x3abf3b[_0xa325('0x63')]({'plain':!![]});interaction_log[_0xa325('0x21')](_0xa325('0x7b'),_0x53010a['user']['id'],_0x53010a[_0xa325('0x61')][_0xa325('0x36')],_0x53010a[_0xa325('0x61')][_0xa325('0x6a')],_0x3df391[_0xa325('0x68')]['id'],_0x53010a[_0xa325('0x55')]?JSON['stringify'](_0x53010a[_0xa325('0x55')]):_0xa325('0x6b'));return respondWithRpcPromise(_0xa325('0x7c'),_0xa325('0x7d'),_0x3df391);}return null;})[_0xa325('0x20')](function(_0x49a150){var _0x549068=_0xa325('0x7e')+_0x49a150[_0xa325('0x28')][_0xa325('0x6d')];return db[_0xa325('0x7f')][_0xa325('0x3e')](_0x549068,{'type':db[_0xa325('0x80')][_0xa325('0x6e')][_0xa325('0x6f')],'raw':!![]})['then'](function(_0x5d8f21){return _0x5d8f21;});})[_0xa325('0x20')](function(_0x33c43a){if(_0x33c43a){_0x3df391[_0xa325('0x28')][_0xa325('0x70')]=_0x33c43a[0x0];if(!_0x53010a[_0xa325('0x55')]['UserId'])return;return db[_0xa325('0x71')][_0xa325('0x53')]({'where':{'id':_0x53010a[_0xa325('0x55')][_0xa325('0x60')],'role':_0xa325('0x62')},'attributes':['id',_0xa325('0x36'),_0xa325('0x81'),_0xa325('0x82'),_0xa325('0x72')],'raw':!![]});}return null;})[_0xa325('0x20')](function(_0x21ade8){if(!_0x21ade8)return null;_0x3df391[_0xa325('0x28')][_0xa325('0x62')]=_0x21ade8;return _0x3df391;})[_0xa325('0x20')](function(_0x153e37){if(_0x153e37){_0x153e37[_0xa325('0x28')]['interface']=util['format'](_0xa325('0x75'),_0x53010a['user']['name']);_0x153e37['message'][_0xa325('0x76')]=_0x3df391['channel'];_0x153e37[_0xa325('0x28')][_0xa325('0x77')]=_0x3df391['channel'];_0x153e37[_0xa325('0x28')][_0xa325('0x78')]=_0xa325('0x33');respondWithRpcPromise(_0xa325('0x79'),'EventManager',{'event':'rejectmessage','message':_0x153e37[_0xa325('0x28')]},client9002);return _0x3df391;}return null;})['then'](respondWithResult(_0x7fb6a3,null))[_0xa325('0x2a')](handleError(_0x7fb6a3,null));}; \ No newline at end of file +var _0x9d76=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','client','http','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','status','end','json','undefined','count','limit','set','Content-Range','reject','save','destroy','sendStatus','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','body','update','describe','accept','openchannel','read','readAt','format','UserId','user','agent','get','OpenchannelInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','internal','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x38c3c4,_0x22fa29){var _0x2cf445=function(_0x31a6cd){while(--_0x31a6cd){_0x38c3c4['push'](_0x38c3c4['shift']());}};_0x2cf445(++_0x22fa29);}(_0x9d76,0x76));var _0x69d7=function(_0x38b011,_0x7427f5){_0x38b011=_0x38b011-0x0;var _0x3179c2=_0x9d76[_0x38b011];return _0x3179c2;};'use strict';var emlformat=require(_0x69d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x69d7('0x1'));var jsonpatch=require(_0x69d7('0x2'));var rp=require(_0x69d7('0x3'));var moment=require(_0x69d7('0x4'));var BPromise=require(_0x69d7('0x5'));var Mustache=require(_0x69d7('0x6'));var util=require('util');var path=require('path');var sox=require(_0x69d7('0x7'));var csv=require(_0x69d7('0x8'));var ejs=require(_0x69d7('0x9'));var fs=require('fs');var fs_extra=require(_0x69d7('0xa'));var _=require('lodash');var squel=require(_0x69d7('0xb'));var crypto=require(_0x69d7('0xc'));var jsforce=require(_0x69d7('0xd'));var deskjs=require(_0x69d7('0xe'));var toCsv=require(_0x69d7('0x8'));var querystring=require(_0x69d7('0xf'));var Papa=require(_0x69d7('0x10'));var Redis=require(_0x69d7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x69d7('0x12'));var as=require(_0x69d7('0x13'));var hardwareService=require(_0x69d7('0x14'));var logger=require(_0x69d7('0x15'))(_0x69d7('0x16'));var utils=require(_0x69d7('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x69d7('0x18'))['db'];config[_0x69d7('0x19')]=_['defaults'](config[_0x69d7('0x19')],{'host':_0x69d7('0x1a'),'port':0x18eb});var socket=require(_0x69d7('0x1b'))(new Redis(config[_0x69d7('0x19')]));require(_0x69d7('0x1c'))[_0x69d7('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x69d7('0x1e')][_0x69d7('0x1f')]({'port':0x232c});var client9002=jayson[_0x69d7('0x1e')][_0x69d7('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x54a95c,_0x545c85,_0x3f2937,_0xb6b940){return new BPromise(function(_0x1134a9,_0x251413){var _0x215715=_0xb6b940||client;return _0x215715[_0x69d7('0x20')](_0x54a95c,_0x3f2937)[_0x69d7('0x21')](function(_0x162c9f){logger[_0x69d7('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x545c85,_0x69d7('0x23'));logger[_0x69d7('0x24')](_0x69d7('0x25'),_0x545c85,'request\x20sent',JSON[_0x69d7('0x26')](_0x162c9f));if(_0x162c9f[_0x69d7('0x27')]){if(_0x162c9f['error']['code']===0x1f4){logger[_0x69d7('0x27')](_0x69d7('0x28'),_0x545c85,_0x162c9f[_0x69d7('0x27')][_0x69d7('0x29')]);return _0x251413(_0x162c9f['error'][_0x69d7('0x29')]);}logger[_0x69d7('0x27')](_0x69d7('0x28'),_0x545c85,_0x162c9f[_0x69d7('0x27')][_0x69d7('0x29')]);return _0x1134a9(_0x162c9f[_0x69d7('0x27')][_0x69d7('0x29')]);}else{logger[_0x69d7('0x22')](_0x69d7('0x28'),_0x545c85,'request\x20sent');_0x1134a9(_0x162c9f[_0x69d7('0x2a')][_0x69d7('0x29')]);}})[_0x69d7('0x2b')](function(_0x4b8cbe){logger[_0x69d7('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x545c85,_0x4b8cbe);_0x251413(_0x4b8cbe);});});}function respondWithStatusCode(_0xee939c,_0x1012d7){_0x1012d7=_0x1012d7||0xcc;return function(_0x3a9b2c){if(_0x3a9b2c){return _0xee939c['sendStatus'](_0x1012d7);}return _0xee939c[_0x69d7('0x2c')](_0x1012d7)[_0x69d7('0x2d')]();};}function respondWithResult(_0x3c261e,_0x182153){_0x182153=_0x182153||0xc8;return function(_0x23f911){if(_0x23f911){return _0x3c261e[_0x69d7('0x2c')](_0x182153)[_0x69d7('0x2e')](_0x23f911);}};}function respondWithFilteredResult(_0x285922,_0x355503){return function(_0x37c21e){if(_0x37c21e){var _0x2e0895=typeof _0x355503['offset']==='undefined'&&typeof _0x355503['limit']===_0x69d7('0x2f');var _0x5d602e=_0x37c21e[_0x69d7('0x30')];var _0x7d86b=_0x2e0895?0x0:_0x355503['offset'];var _0x20ae7f=_0x2e0895?_0x37c21e[_0x69d7('0x30')]:_0x355503['offset']+_0x355503[_0x69d7('0x31')];var _0x8fd9c4;if(_0x20ae7f>=_0x5d602e){_0x20ae7f=_0x5d602e;_0x8fd9c4=0xc8;}else{_0x8fd9c4=0xce;}_0x285922['status'](_0x8fd9c4);return _0x285922[_0x69d7('0x32')](_0x69d7('0x33'),_0x7d86b+'-'+_0x20ae7f+'/'+_0x5d602e)[_0x69d7('0x2e')](_0x37c21e);}return null;};}function patchUpdates(_0x24ef11){return function(_0x1ec1e9){try{jsonpatch['apply'](_0x1ec1e9,_0x24ef11,!![]);}catch(_0x532d46){return BPromise[_0x69d7('0x34')](_0x532d46);}return _0x1ec1e9[_0x69d7('0x35')]();};}function saveUpdates(_0x938a42,_0x1d5910){return function(_0x53c7af){if(_0x53c7af){return _0x53c7af['update'](_0x938a42)[_0x69d7('0x21')](function(_0x34fdeb){return _0x34fdeb;});}return null;};}function removeEntity(_0x19e74a,_0x1e6a2f){return function(_0x3fd8fd){if(_0x3fd8fd){return _0x3fd8fd[_0x69d7('0x36')]()['then'](function(){_0x19e74a[_0x69d7('0x2c')](0xcc)[_0x69d7('0x2d')]();});}};}function handleEntityNotFound(_0x2a530c,_0x2ada9c){return function(_0x858a02){if(!_0x858a02){_0x2a530c[_0x69d7('0x37')](0x194);}return _0x858a02;};}function handleError(_0x82b4dd,_0x4c34bb){_0x4c34bb=_0x4c34bb||0x1f4;return function(_0x51823e){logger[_0x69d7('0x27')](_0x51823e['stack']);if(_0x51823e['name']){delete _0x51823e['name'];}_0x82b4dd[_0x69d7('0x2c')](_0x4c34bb)[_0x69d7('0x38')](_0x51823e);};}exports[_0x69d7('0x39')]=function(_0x18d68b,_0x353b22){var _0x1a5057={},_0x1946c0={},_0x28c5ec={'count':0x0,'rows':[]};var _0x1dd5d3=_[_0x69d7('0x3a')](db[_0x69d7('0x3b')][_0x69d7('0x3c')],function(_0x49a2ff){return{'name':_0x49a2ff[_0x69d7('0x3d')],'type':_0x49a2ff[_0x69d7('0x3e')][_0x69d7('0x3f')]};});_0x1946c0[_0x69d7('0x40')]=_['map'](_0x1dd5d3,_0x69d7('0x41'));_0x1946c0[_0x69d7('0x42')]=_['keys'](_0x18d68b[_0x69d7('0x42')]);_0x1946c0[_0x69d7('0x43')]=_[_0x69d7('0x44')](_0x1946c0[_0x69d7('0x40')],_0x1946c0[_0x69d7('0x42')]);_0x1a5057[_0x69d7('0x45')]=_['intersection'](_0x1946c0[_0x69d7('0x40')],qs['fields'](_0x18d68b[_0x69d7('0x42')][_0x69d7('0x46')]));_0x1a5057[_0x69d7('0x45')]=_0x1a5057[_0x69d7('0x45')][_0x69d7('0x47')]?_0x1a5057[_0x69d7('0x45')]:_0x1946c0[_0x69d7('0x40')];if(!_0x18d68b[_0x69d7('0x42')]['hasOwnProperty']('nolimit')){_0x1a5057[_0x69d7('0x31')]=qs[_0x69d7('0x31')](_0x18d68b[_0x69d7('0x42')][_0x69d7('0x31')]);_0x1a5057[_0x69d7('0x48')]=qs['offset'](_0x18d68b['query']['offset']);}_0x1a5057[_0x69d7('0x49')]=qs['sort'](_0x18d68b[_0x69d7('0x42')][_0x69d7('0x4a')]);_0x1a5057[_0x69d7('0x4b')]=qs[_0x69d7('0x43')](_[_0x69d7('0x4c')](_0x18d68b[_0x69d7('0x42')],_0x1946c0['filters']),_0x1dd5d3);if(_0x18d68b[_0x69d7('0x42')][_0x69d7('0x4d')]){_0x1a5057[_0x69d7('0x4b')]=_[_0x69d7('0x4e')](_0x1a5057[_0x69d7('0x4b')],{'$or':_[_0x69d7('0x3a')](_0x1dd5d3,function(_0x3e7543){if(_0x3e7543[_0x69d7('0x3e')]!==_0x69d7('0x4f')){var _0x201428={};_0x201428[_0x3e7543['name']]={'$like':'%'+_0x18d68b[_0x69d7('0x42')][_0x69d7('0x4d')]+'%'};return _0x201428;}})});}_0x1a5057=_['merge']({},_0x1a5057,_0x18d68b[_0x69d7('0x50')]);var _0x3edce9={'where':_0x1a5057[_0x69d7('0x4b')]};return db['OpenchannelMessage'][_0x69d7('0x30')](_0x3edce9)[_0x69d7('0x21')](function(_0x3f01be){_0x28c5ec[_0x69d7('0x30')]=_0x3f01be;if(_0x18d68b['query'][_0x69d7('0x51')]){_0x1a5057[_0x69d7('0x52')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x69d7('0x53')](_0x1a5057);})[_0x69d7('0x21')](function(_0x84d140){_0x28c5ec[_0x69d7('0x54')]=_0x84d140;return _0x28c5ec;})['then'](respondWithFilteredResult(_0x353b22,_0x1a5057))[_0x69d7('0x2b')](handleError(_0x353b22,null));};exports[_0x69d7('0x55')]=function(_0x471b93,_0xcd8fca){var _0x37a312={'raw':!![],'where':{'id':_0x471b93[_0x69d7('0x56')]['id']}},_0x47f22e={};_0x47f22e[_0x69d7('0x40')]=_[_0x69d7('0x57')](db[_0x69d7('0x3b')][_0x69d7('0x3c')]);_0x47f22e[_0x69d7('0x42')]=_[_0x69d7('0x57')](_0x471b93[_0x69d7('0x42')]);_0x47f22e[_0x69d7('0x43')]=_[_0x69d7('0x44')](_0x47f22e[_0x69d7('0x40')],_0x47f22e[_0x69d7('0x42')]);_0x37a312[_0x69d7('0x45')]=_[_0x69d7('0x44')](_0x47f22e[_0x69d7('0x40')],qs[_0x69d7('0x46')](_0x471b93[_0x69d7('0x42')][_0x69d7('0x46')]));_0x37a312[_0x69d7('0x45')]=_0x37a312[_0x69d7('0x45')][_0x69d7('0x47')]?_0x37a312['attributes']:_0x47f22e[_0x69d7('0x40')];if(_0x471b93['query'][_0x69d7('0x51')]){_0x37a312[_0x69d7('0x52')]=[{'all':!![]}];}_0x37a312=_[_0x69d7('0x4e')]({},_0x37a312,_0x471b93[_0x69d7('0x50')]);return db[_0x69d7('0x3b')][_0x69d7('0x58')](_0x37a312)['then'](handleEntityNotFound(_0xcd8fca,null))['then'](respondWithResult(_0xcd8fca,null))['catch'](handleError(_0xcd8fca,null));};exports['create']=function(_0x27fea6,_0x1bbced){return db[_0x69d7('0x3b')]['create'](_0x27fea6[_0x69d7('0x59')],{})['then'](respondWithResult(_0x1bbced,0xc9))[_0x69d7('0x2b')](handleError(_0x1bbced,null));};exports[_0x69d7('0x5a')]=function(_0x4f1704,_0x3fc443){if(_0x4f1704['body']['id']){delete _0x4f1704[_0x69d7('0x59')]['id'];}return db[_0x69d7('0x3b')][_0x69d7('0x58')]({'where':{'id':_0x4f1704[_0x69d7('0x56')]['id']}})[_0x69d7('0x21')](handleEntityNotFound(_0x3fc443,null))[_0x69d7('0x21')](saveUpdates(_0x4f1704['body'],null))['then'](respondWithResult(_0x3fc443,null))[_0x69d7('0x2b')](handleError(_0x3fc443,null));};exports[_0x69d7('0x36')]=function(_0x32a06c,_0x12fbb9){return db['OpenchannelMessage'][_0x69d7('0x58')]({'where':{'id':_0x32a06c[_0x69d7('0x56')]['id']}})[_0x69d7('0x21')](handleEntityNotFound(_0x12fbb9,null))['then'](removeEntity(_0x12fbb9,null))[_0x69d7('0x2b')](handleError(_0x12fbb9,null));};exports[_0x69d7('0x5b')]=function(_0x2c9621,_0xe2a836){return db['OpenchannelMessage'][_0x69d7('0x5b')]()[_0x69d7('0x21')](respondWithResult(_0xe2a836,null))['catch'](handleError(_0xe2a836,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0x69d7('0x5c')]=function(_0xe38935,_0x23997c,_0x16036f){var _0x464af7={'agent':{},'channel':_0x69d7('0x5d')};if(_0xe38935[_0x69d7('0x59')]['id']){delete _0xe38935[_0x69d7('0x59')]['id'];}_0xe38935[_0x69d7('0x59')][_0x69d7('0x5e')]=!![];_0xe38935[_0x69d7('0x59')][_0x69d7('0x5f')]=moment()[_0x69d7('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0xe38935[_0x69d7('0x59')][_0x69d7('0x61')]=_0xe38935[_0x69d7('0x59')][_0x69d7('0x61')]||_0xe38935[_0x69d7('0x62')]['id'];_0x464af7[_0x69d7('0x63')]['id']=_0xe38935['body'][_0x69d7('0x61')];return db[_0x69d7('0x3b')][_0x69d7('0x58')]({'where':{'id':_0xe38935[_0x69d7('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x23997c,null))[_0x69d7('0x21')](saveUpdates(_0xe38935[_0x69d7('0x59')],null))[_0x69d7('0x21')](function(_0x26def8){if(_0x26def8){_0x464af7['message']=_0x26def8[_0x69d7('0x64')]({'plain':!![]});return db['OpenchannelInteraction'][_0x69d7('0x58')]({'where':{'id':_0x26def8[_0x69d7('0x65')]}});}return null;})[_0x69d7('0x21')](handleEntityNotFound(_0x23997c,null))[_0x69d7('0x21')](function(_0x44f872){if(_0x44f872){return _0x44f872[_0x69d7('0x5a')]({'UserId':_0xe38935[_0x69d7('0x59')][_0x69d7('0x61')],'read1stAt':_['isNil'](_0x44f872[_0x69d7('0x66')])?moment()[_0x69d7('0x60')](_0x69d7('0x67')):undefined});}return null;})[_0x69d7('0x21')](function(_0x213e94){if(_0x213e94){_0x464af7[_0x69d7('0x68')]=_0x213e94[_0x69d7('0x64')]({'plain':!![]});interaction_log['info'](_0x69d7('0x69'),_0xe38935[_0x69d7('0x62')]['id'],_0xe38935['user']['name'],_0xe38935[_0x69d7('0x62')][_0x69d7('0x6a')],_0x464af7['interaction']['id'],_0xe38935['body']?JSON[_0x69d7('0x26')](_0xe38935[_0x69d7('0x59')]):_0x69d7('0x6b'));return respondWithRpcPromise(_0x69d7('0x6c'),_0x69d7('0x6d'),_0x464af7);}return null;})[_0x69d7('0x21')](function(_0x1695a9){var _0x1dcdb5=_0x69d7('0x6e')+_0x1695a9['message'][_0x69d7('0x6f')];return db[_0x69d7('0x70')][_0x69d7('0x42')](_0x1dcdb5,{'type':db[_0x69d7('0x71')][_0x69d7('0x72')][_0x69d7('0x73')],'raw':!![]})[_0x69d7('0x21')](function(_0x54330c){return _0x54330c;});})[_0x69d7('0x21')](function(_0xb52eb){if(_0xb52eb){_0x464af7[_0x69d7('0x29')][_0x69d7('0x74')]=_0xb52eb[0x0];if(!_0xe38935[_0x69d7('0x59')]['UserId'])return;return db[_0x69d7('0x75')][_0x69d7('0x58')]({'where':{'id':_0xe38935[_0x69d7('0x59')][_0x69d7('0x61')],'role':_0x69d7('0x63')},'attributes':['id','name',_0x69d7('0x76'),_0x69d7('0x77'),'internal'],'raw':!![]});}return null;})[_0x69d7('0x21')](function(_0xb9dc4b){if(!_0xb9dc4b)return null;_0x464af7[_0x69d7('0x29')][_0x69d7('0x63')]=_0xb9dc4b;return _0x464af7;})[_0x69d7('0x21')](function(_0xe9cc3f){if(_0xe9cc3f){if(_0xe38935['body'][_0x69d7('0x78')]){_0x464af7[_0x69d7('0x29')][_0x69d7('0x79')]=util[_0x69d7('0x60')](_0x69d7('0x7a'),_0xe38935[_0x69d7('0x62')][_0x69d7('0x41')]);_0x464af7[_0x69d7('0x29')][_0x69d7('0x7b')]=_0x464af7['channel'];_0x464af7['message'][_0x69d7('0x7c')]=_0x464af7[_0x69d7('0x7b')];_0x464af7[_0x69d7('0x29')][_0x69d7('0x7d')]=_0x69d7('0x5c');return respondWithRpcPromise('EventManager',_0x69d7('0x7e'),{'event':_0x69d7('0x7f'),'message':_0x464af7['message']},client9002)[_0x69d7('0x21')](function(){return _0x464af7;});}return _0x464af7;}return null;})[_0x69d7('0x21')](respondWithResult(_0x23997c,null))['catch'](handleError(_0x23997c,null));};var interaction_log=require(_0x69d7('0x15'))(_0x69d7('0x80'));exports[_0x69d7('0x34')]=function(_0xb775d9,_0x34c9df,_0x33d1c1){var _0x439daa={'agent':{},'channel':_0x69d7('0x5d')};if(_0xb775d9[_0x69d7('0x59')]['id']){delete _0xb775d9[_0x69d7('0x59')]['id'];}_0xb775d9[_0x69d7('0x59')]['UserId']=_0xb775d9[_0x69d7('0x59')][_0x69d7('0x61')]||_0xb775d9[_0x69d7('0x62')]['id'];_0x439daa[_0x69d7('0x63')]['id']=_0xb775d9[_0x69d7('0x59')][_0x69d7('0x61')];return db[_0x69d7('0x3b')][_0x69d7('0x58')]({'where':{'id':_0xb775d9['params']['id'],'UserId':null}})[_0x69d7('0x21')](handleEntityNotFound(_0x34c9df,null))[_0x69d7('0x21')](function(_0x3379bc){if(_0x3379bc){_0x439daa[_0x69d7('0x29')]=_0x3379bc[_0x69d7('0x64')]({'plain':!![]});return db[_0x69d7('0x81')][_0x69d7('0x58')]({'where':{'id':_0x3379bc['OpenchannelInteractionId']}});}return null;})[_0x69d7('0x21')](handleEntityNotFound(_0x34c9df,null))[_0x69d7('0x21')](function(_0x5e3a2b){if(_0x5e3a2b){_0x439daa[_0x69d7('0x68')]=_0x5e3a2b[_0x69d7('0x64')]({'plain':!![]});interaction_log[_0x69d7('0x22')](_0x69d7('0x82'),_0xb775d9[_0x69d7('0x62')]['id'],_0xb775d9[_0x69d7('0x62')][_0x69d7('0x41')],_0xb775d9[_0x69d7('0x62')][_0x69d7('0x6a')],_0x439daa['interaction']['id'],_0xb775d9[_0x69d7('0x59')]?JSON[_0x69d7('0x26')](_0xb775d9[_0x69d7('0x59')]):_0x69d7('0x6b'));return respondWithRpcPromise(_0x69d7('0x83'),_0x69d7('0x84'),_0x439daa);}return null;})['then'](function(_0x59842a){var _0x1b1199=_0x69d7('0x6e')+_0x59842a[_0x69d7('0x29')][_0x69d7('0x6f')];return db[_0x69d7('0x70')][_0x69d7('0x42')](_0x1b1199,{'type':db['Sequelize'][_0x69d7('0x72')][_0x69d7('0x73')],'raw':!![]})[_0x69d7('0x21')](function(_0x4ba150){return _0x4ba150;});})[_0x69d7('0x21')](function(_0x340fdc){if(_0x340fdc){_0x439daa[_0x69d7('0x29')][_0x69d7('0x74')]=_0x340fdc[0x0];if(!_0xb775d9[_0x69d7('0x59')][_0x69d7('0x61')])return;return db['User'][_0x69d7('0x58')]({'where':{'id':_0xb775d9[_0x69d7('0x59')][_0x69d7('0x61')],'role':_0x69d7('0x63')},'attributes':['id',_0x69d7('0x41'),'fullname','email',_0x69d7('0x85')],'raw':!![]});}return null;})[_0x69d7('0x21')](function(_0x4aef8e){if(!_0x4aef8e)return null;_0x439daa[_0x69d7('0x29')]['agent']=_0x4aef8e;return _0x439daa;})[_0x69d7('0x21')](function(_0x20f12c){if(_0x20f12c){_0x20f12c[_0x69d7('0x29')][_0x69d7('0x79')]=util[_0x69d7('0x60')](_0x69d7('0x7a'),_0xb775d9[_0x69d7('0x62')][_0x69d7('0x41')]);_0x20f12c[_0x69d7('0x29')][_0x69d7('0x7b')]=_0x439daa['channel'];_0x20f12c[_0x69d7('0x29')][_0x69d7('0x7c')]=_0x439daa[_0x69d7('0x7b')];_0x20f12c[_0x69d7('0x29')][_0x69d7('0x7d')]='reject';respondWithRpcPromise(_0x69d7('0x7e'),_0x69d7('0x7e'),{'event':_0x69d7('0x86'),'message':_0x20f12c[_0x69d7('0x29')]},client9002);return _0x439daa;}return null;})[_0x69d7('0x21')](respondWithResult(_0x34c9df,null))[_0x69d7('0x2b')](handleError(_0x34c9df,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index e81a497..6e6fa4c 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 _0x78d6=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x1b5aea,_0x1afe6f){var _0x51cae9=function(_0x1494a6){while(--_0x1494a6){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x51cae9(++_0x1afe6f);}(_0x78d6,0xa4));var _0x678d=function(_0x11c558,_0x1ba70c){_0x11c558=_0x11c558-0x0;var _0x447204=_0x78d6[_0x11c558];return _0x447204;};'use strict';var EventEmitter=require(_0x678d('0x0'));var OpenchannelMessage=require(_0x678d('0x1'))['db'][_0x678d('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x678d('0x3')](0x0);var events={'afterCreate':_0x678d('0x4'),'afterUpdate':_0x678d('0x5'),'afterDestroy':_0x678d('0x6')};function emitEvent(_0x159497){return function(_0x2dc16b,_0x435b71,_0x3967ef){OpenchannelMessageEvents['emit'](_0x159497+':'+_0x2dc16b['id'],_0x2dc16b);OpenchannelMessageEvents[_0x678d('0x7')](_0x159497,_0x2dc16b);_0x3967ef(null);};}for(var e in events){if(events[_0x678d('0x8')](e)){var event=events[e];OpenchannelMessage[_0x678d('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xa235=['emit','hasOwnProperty','exports','events','OpenchannelMessage','setMaxListeners','update','remove'];(function(_0x165857,_0x7bfc15){var _0x37e412=function(_0x561628){while(--_0x561628){_0x165857['push'](_0x165857['shift']());}};_0x37e412(++_0x7bfc15);}(_0xa235,0xab));var _0x5a23=function(_0x418435,_0x57744f){_0x418435=_0x418435-0x0;var _0x157e90=_0xa235[_0x418435];return _0x157e90;};'use strict';var EventEmitter=require(_0x5a23('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x5a23('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x5a23('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5a23('0x3'),'afterDestroy':_0x5a23('0x4')};function emitEvent(_0x17bc45){return function(_0x392f49,_0x233ccc,_0x45aa32){OpenchannelMessageEvents[_0x5a23('0x5')](_0x17bc45+':'+_0x392f49['id'],_0x392f49);OpenchannelMessageEvents[_0x5a23('0x5')](_0x17bc45,_0x392f49);_0x45aa32(null);};}for(var e in events){if(events[_0x5a23('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x5a23('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 547aea8..71813b8 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 _0x4269=['isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','createdAt','toLowerCase','catch','error','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','info','OpenchannelMessage,\x20%s,\x20%s','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','POST','replyUri','method','GET','body','afterCreate','format','threadId','update','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','direction','out','secret'];(function(_0x40015a,_0x415db5){var _0x42f8a4=function(_0x5685ad){while(--_0x5685ad){_0x40015a['push'](_0x40015a['shift']());}};_0x42f8a4(++_0x415db5);}(_0x4269,0x11b));var _0x9426=function(_0x57ff3d,_0x551fbd){_0x57ff3d=_0x57ff3d-0x0;var _0xf4ab01=_0x4269[_0x57ff3d];return _0xf4ab01;};'use strict';var _=require(_0x9426('0x0'));var util=require(_0x9426('0x1'));var logger=require(_0x9426('0x2'))(_0x9426('0x3'));var moment=require(_0x9426('0x4'));var BPromise=require('bluebird');var rp=require(_0x9426('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9426('0x6'));module['exports']=function(_0xf1bd92,_0x4a382d){return _0xf1bd92[_0x9426('0x7')](_0x9426('0x8'),attributes,{'tableName':_0x9426('0x9'),'paranoid':![],'indexes':[{'name':_0x9426('0xa'),'fields':['body'],'type':_0x9426('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2ff934,_0x1f05ff,_0x34867e){var _0x1f300a=_0xf1bd92[_0x9426('0xc')];var _0x26b261=_0x2ff934[_0x9426('0xd')]({'plain':!![]});if(_0x26b261[_0x9426('0xe')]['toLowerCase']()==='in'||_0x26b261['direction']['toLowerCase']()===_0x9426('0xf')&&!_0x26b261[_0x9426('0x10')]&&!_[_0x9426('0x11')](_0x26b261[_0x9426('0x12')])){_0x1f300a[_0x9426('0x13')]['findOne']({'where':{'id':_0x26b261[_0x9426('0x14')]}})['then'](function(_0x306f65){if(_0x306f65){_0x306f65['update']({'lastMsgAt':_0x26b261[_0x9426('0x15')],'lastMsgDirection':_0x26b261[_0x9426('0xe')][_0x9426('0x16')]()});}})[_0x9426('0x17')](function(_0x32d3e3){console[_0x9426('0x18')](_0x32d3e3);});}if(_0x26b261[_0x9426('0xe')]===_0x9426('0xf')&&!_0x26b261[_0x9426('0x10')]){var _0x25e30a;_0x1f300a[_0x9426('0x19')][_0x9426('0x1a')]()[_0x9426('0x1b')](function(_0x598a8){return _0x1f300a[_0x9426('0x1c')][_0x9426('0x1d')]({'where':{'id':_0x26b261[_0x9426('0x1e')]},'include':[{'model':_0x1f300a[_0x9426('0x13')],'as':_0x9426('0x1f'),'where':{'id':_0x26b261[_0x9426('0x14')]},'limit':0x1,'include':[{'model':_0x1f300a[_0x9426('0x19')],'as':_0x9426('0x20'),'attributes':_['keys'](_0x598a8)}]}]});})['then'](function(_0x37e77e){_0x25e30a=_0x37e77e[_0x9426('0xd')]({'plain':!![]});if(_0x25e30a&&_0x25e30a['replyUri']){logger[_0x9426('0x21')](_0x9426('0x22'),'afterCreate',util['format'](_0x9426('0x23'),_0x26b261['id'],_0x25e30a['replyUri']));if(_0x25e30a[_0x9426('0x1f')]&&_0x25e30a['Interactions']['length']){_0x26b261[_0x9426('0x24')]=_['omit'](_0x25e30a[_0x9426('0x1f')][0x0],_0x9426('0x20'));_0x26b261[_0x9426('0x20')]=_0x25e30a[_0x9426('0x1f')][0x0][_0x9426('0x20')];}var _0x1f05ff={'method':_0x9426('0x25'),'uri':encodeURI(_0x25e30a[_0x9426('0x26')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1f05ff[_0x9426('0x27')]){case _0x9426('0x28'):_0x1f05ff['qs']=_0x26b261;break;case _0x9426('0x25'):_0x1f05ff[_0x9426('0x29')]=_0x26b261;break;}return rp(_0x1f05ff)[_0x9426('0x1b')](function(_0x587d31){logger[_0x9426('0x21')](_0x9426('0x22'),_0x9426('0x2a'),util[_0x9426('0x2b')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x26b261['id'],_0x25e30a[_0x9426('0x26')]));if(_0x587d31[_0x9426('0x29')]['threadId']&&_0x587d31['body'][_0x9426('0x2c')]!=_0x26b261['Interaction'][_0x9426('0x2c')]){return _0x1f300a[_0x9426('0x13')][_0x9426('0x2d')]({'threadId':_0x587d31['body'][_0x9426('0x2c')]},{'where':{'id':_0x26b261['Interaction']['id']}});}else{return;}})[_0x9426('0x1b')](function(){return _0x2ff934['update']({'read':!![]});})['catch'](function(_0x2caa47){logger[_0x9426('0x18')](_0x9426('0x22'),'afterCreate',util[_0x9426('0x2e')](_0x2caa47,{'showHidden':![],'depth':null}));_0x34867e();});}else{_0x34867e();}})[_0x9426('0x2f')](function(){_0x34867e();});}else{_0x34867e();}}},'charset':_0x9426('0x30'),'collate':_0x9426('0x31')});}; \ No newline at end of file +var _0x5573=['openchannel_messages','fti_openchannel_messages','FULLTEXT','direction','toLowerCase','out','secret','UserId','findOne','then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','OpenchannelInteractionId','Contact','keys','get','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','GET','body','info','threadId','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x5573,0x138));var _0x3557=function(_0xf04c6d,_0xe98786){_0xf04c6d=_0xf04c6d-0x0;var _0x4a804e=_0x5573[_0xf04c6d];return _0x4a804e;};'use strict';var _=require(_0x3557('0x0'));var util=require(_0x3557('0x1'));var logger=require(_0x3557('0x2'))('api');var moment=require(_0x3557('0x3'));var BPromise=require(_0x3557('0x4'));var rp=require(_0x3557('0x5'));var fs=require('fs');var path=require(_0x3557('0x6'));var rimraf=require(_0x3557('0x7'));var config=require('../../config/environment');var attributes=require(_0x3557('0x8'));module[_0x3557('0x9')]=function(_0x49ea77,_0x3d5866){return _0x49ea77[_0x3557('0xa')](_0x3557('0xb'),attributes,{'tableName':_0x3557('0xc'),'paranoid':![],'indexes':[{'name':_0x3557('0xd'),'fields':['body'],'type':_0x3557('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x51323f,_0xf72be6,_0x4d0c9d){var _0x768817=_0x49ea77['models'];var _0x40b383=_0x51323f['get']({'plain':!![]});if(_0x40b383[_0x3557('0xf')][_0x3557('0x10')]()==='in'||_0x40b383[_0x3557('0xf')][_0x3557('0x10')]()===_0x3557('0x11')&&!_0x40b383[_0x3557('0x12')]&&!_['isNil'](_0x40b383[_0x3557('0x13')])){_0x768817['OpenchannelInteraction'][_0x3557('0x14')]({'where':{'id':_0x40b383['OpenchannelInteractionId']}})[_0x3557('0x15')](function(_0x8318e2){if(_0x8318e2){_0x8318e2[_0x3557('0x16')]({'lastMsgAt':_0x40b383[_0x3557('0x17')],'lastMsgDirection':_0x40b383[_0x3557('0xf')][_0x3557('0x10')]()});}})[_0x3557('0x18')](function(_0x20e500){console[_0x3557('0x19')](_0x20e500);});}if(_0x40b383['direction']===_0x3557('0x11')&&!_0x40b383[_0x3557('0x12')]){var _0x314593;_0x768817[_0x3557('0x1a')][_0x3557('0x1b')]()[_0x3557('0x15')](function(_0x3c20bd){return _0x768817[_0x3557('0x1c')][_0x3557('0x1d')]({'where':{'id':_0x40b383[_0x3557('0x1e')]},'include':[{'model':_0x768817[_0x3557('0x1f')],'as':_0x3557('0x20'),'where':{'id':_0x40b383[_0x3557('0x21')]},'limit':0x1,'include':[{'model':_0x768817['CmContact'],'as':_0x3557('0x22'),'attributes':_[_0x3557('0x23')](_0x3c20bd)}]}]});})[_0x3557('0x15')](function(_0x24b45f){_0x314593=_0x24b45f[_0x3557('0x24')]({'plain':!![]});if(_0x314593&&_0x314593[_0x3557('0x25')]){logger['info'](_0x3557('0x26'),_0x3557('0x27'),util[_0x3557('0x28')](_0x3557('0x29'),_0x40b383['id'],_0x314593[_0x3557('0x25')]));if(_0x314593['Interactions']&&_0x314593[_0x3557('0x20')][_0x3557('0x2a')]){_0x40b383[_0x3557('0x2b')]=_[_0x3557('0x2c')](_0x314593[_0x3557('0x20')][0x0],_0x3557('0x22'));_0x40b383[_0x3557('0x22')]=_0x314593[_0x3557('0x20')][0x0][_0x3557('0x22')];}var _0xf72be6={'method':_0x3557('0x2d'),'uri':encodeURI(_0x314593[_0x3557('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0xf72be6[_0x3557('0x2e')]){case _0x3557('0x2f'):_0xf72be6['qs']=_0x40b383;break;case _0x3557('0x2d'):_0xf72be6[_0x3557('0x30')]=_0x40b383;break;}return rp(_0xf72be6)[_0x3557('0x15')](function(_0x5bcaf4){logger[_0x3557('0x31')]('OpenchannelMessage,\x20%s,\x20%s',_0x3557('0x27'),util[_0x3557('0x28')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x40b383['id'],_0x314593[_0x3557('0x25')]));if(_0x5bcaf4[_0x3557('0x30')]['threadId']&&_0x5bcaf4[_0x3557('0x30')][_0x3557('0x32')]!=_0x40b383['Interaction'][_0x3557('0x32')]){return _0x768817['OpenchannelInteraction'][_0x3557('0x16')]({'threadId':_0x5bcaf4[_0x3557('0x30')]['threadId']},{'where':{'id':_0x40b383[_0x3557('0x2b')]['id']}});}else{return;}})[_0x3557('0x15')](function(){return _0x51323f[_0x3557('0x16')]({'read':!![]});})[_0x3557('0x18')](function(_0x24a005){logger[_0x3557('0x19')](_0x3557('0x26'),_0x3557('0x27'),util[_0x3557('0x33')](_0x24a005,{'showHidden':![],'depth':null}));_0x4d0c9d();});}else{_0x4d0c9d();}})['finally'](function(){_0x4d0c9d();});}else{_0x4d0c9d();}}},'charset':_0x3557('0x34'),'collate':_0x3557('0x35')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 41da733..bf3d933 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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1da78e,_0x1fdd07){var _0x11685e=function(_0x32c492){while(--_0x32c492){_0x1da78e['push'](_0x1da78e['shift']());}};_0x11685e(++_0x1fdd07);}(_0x1261,0x144));var _0x1126=function(_0x3e948f,_0x19484d){_0x3e948f=_0x3e948f-0x0;var _0x4cc3de=_0x1261[_0x3e948f];return _0x4cc3de;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file +var _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x1af046,_0x218baa){var _0x479abf=function(_0x250048){while(--_0x250048){_0x1af046['push'](_0x1af046['shift']());}};_0x479abf(++_0x218baa);}(_0xdb28,0x106));var _0x8db2=function(_0x47458e,_0x1fae8a){_0x47458e=_0x47458e-0x0;var _0x2f08b3=_0xdb28[_0x47458e];return _0x2f08b3;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 7f0484e..857867f 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 _0x9a6e=['emit','removeListener','register','openchannelMessage:','./openchannelMessage.events','save','update'];(function(_0xfd5afd,_0x44dc0a){var _0x4110a9=function(_0x377e26){while(--_0x377e26){_0xfd5afd['push'](_0xfd5afd['shift']());}};_0x4110a9(++_0x44dc0a);}(_0x9a6e,0xc1));var _0xe9a6=function(_0x38d64b,_0x56a8ac){_0x38d64b=_0x38d64b-0x0;var _0x58868c=_0x9a6e[_0x38d64b];return _0x58868c;};'use strict';var OpenchannelMessageEvents=require(_0xe9a6('0x0'));var events=[_0xe9a6('0x1'),'remove',_0xe9a6('0x2')];function createListener(_0x3731b6,_0x2e8449){return function(_0x219397){_0x2e8449[_0xe9a6('0x3')](_0x3731b6,_0x219397);};}function removeListener(_0x9febd8,_0x5292c9){return function(){OpenchannelMessageEvents[_0xe9a6('0x4')](_0x9febd8,_0x5292c9);};}exports[_0xe9a6('0x5')]=function(_0x52d7b8){for(var _0x4a8fba=0x0,_0x4ed4a4=events['length'];_0x4a8fba<_0x4ed4a4;_0x4a8fba++){var _0x422d0d=events[_0x4a8fba];var _0x334b63=createListener(_0xe9a6('0x6')+_0x422d0d,_0x52d7b8);OpenchannelMessageEvents['on'](_0x422d0d,_0x334b63);}}; \ No newline at end of file +var _0x4677=['./openchannelMessage.events','save','remove','update','emit','removeListener','register','length','openchannelMessage:'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x4677,0x105));var _0x7467=function(_0x2ea065,_0x70c69b){_0x2ea065=_0x2ea065-0x0;var _0x395ed9=_0x4677[_0x2ea065];return _0x395ed9;};'use strict';var OpenchannelMessageEvents=require(_0x7467('0x0'));var events=[_0x7467('0x1'),_0x7467('0x2'),_0x7467('0x3')];function createListener(_0x2b1f7b,_0x13ba71){return function(_0x1d7c83){_0x13ba71[_0x7467('0x4')](_0x2b1f7b,_0x1d7c83);};}function removeListener(_0x242012,_0x344a0e){return function(){OpenchannelMessageEvents[_0x7467('0x5')](_0x242012,_0x344a0e);};}exports[_0x7467('0x6')]=function(_0x22af71){for(var _0xf8b5c0=0x0,_0x4af1ba=events[_0x7467('0x7')];_0xf8b5c0<_0x4af1ba;_0xf8b5c0++){var _0x234234=events[_0xf8b5c0];var _0x5b9b83=createListener(_0x7467('0x8')+_0x234234,_0x22af71);OpenchannelMessageEvents['on'](_0x234234,_0x5b9b83);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index ef3d25b..5aea34f 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 _0xf216=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','post','create','addTeams','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xf216,0x15a));var _0x6f21=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0xf216[_0x3207aa];return _0x51758f;};'use strict';var multer=require(_0x6f21('0x0'));var util=require(_0x6f21('0x1'));var path=require(_0x6f21('0x2'));var timeout=require(_0x6f21('0x3'));var express=require(_0x6f21('0x4'));var router=express[_0x6f21('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6f21('0x6'));var interaction=require(_0x6f21('0x7'));var config=require(_0x6f21('0x8'));var controller=require(_0x6f21('0x9'));router[_0x6f21('0xa')]('/',auth[_0x6f21('0xb')](),controller['index']);router[_0x6f21('0xa')](_0x6f21('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x6f21('0xa')](_0x6f21('0xd'),auth[_0x6f21('0xb')](),controller[_0x6f21('0xe')]);router[_0x6f21('0xa')](_0x6f21('0xf'),auth[_0x6f21('0xb')](),controller['getMembers']);router['get'](_0x6f21('0x10'),auth['isAuthenticated'](),controller[_0x6f21('0x11')]);router[_0x6f21('0xa')](_0x6f21('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0x6f21('0x13')]('/',auth['isAuthenticated'](),controller[_0x6f21('0x14')]);router[_0x6f21('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6f21('0x15')]);router[_0x6f21('0x13')](_0x6f21('0x12'),auth[_0x6f21('0xb')](),controller['addAgents']);router['put'](_0x6f21('0xd'),auth[_0x6f21('0xb')](),controller[_0x6f21('0x16')]);router[_0x6f21('0x17')](_0x6f21('0xd'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x6f21('0x10'),auth[_0x6f21('0xb')](),controller[_0x6f21('0x18')]);router[_0x6f21('0x17')](_0x6f21('0x12'),auth['isAuthenticated'](),controller[_0x6f21('0x19')]);module[_0x6f21('0x1a')]=router; \ No newline at end of file +var _0xeb9c=['describe','show','getMembers','/:id/teams','/:id/users','getAgents','create','post','addTeams','addAgents','put','/:id','update','delete','removeTeams','removeAgents','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated'];(function(_0x5ce689,_0x573e2b){var _0x1df0d0=function(_0x4e98ff){while(--_0x4e98ff){_0x5ce689['push'](_0x5ce689['shift']());}};_0x1df0d0(++_0x573e2b);}(_0xeb9c,0x1b0));var _0xceb9=function(_0x3f0e61,_0x50c404){_0x3f0e61=_0x3f0e61-0x0;var _0x1063b4=_0xeb9c[_0x3f0e61];return _0x1063b4;};'use strict';var multer=require('multer');var util=require(_0xceb9('0x0'));var path=require(_0xceb9('0x1'));var timeout=require('connect-timeout');var express=require(_0xceb9('0x2'));var router=express[_0xceb9('0x3')]();var fs_extra=require(_0xceb9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xceb9('0x5'));var config=require(_0xceb9('0x6'));var controller=require(_0xceb9('0x7'));router[_0xceb9('0x8')]('/',auth[_0xceb9('0x9')](),controller['index']);router[_0xceb9('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xceb9('0xa')]);router[_0xceb9('0x8')]('/:id',auth[_0xceb9('0x9')](),controller[_0xceb9('0xb')]);router['get']('/:id/members',auth[_0xceb9('0x9')](),controller[_0xceb9('0xc')]);router[_0xceb9('0x8')](_0xceb9('0xd'),auth[_0xceb9('0x9')](),controller['getTeams']);router['get'](_0xceb9('0xe'),auth['isAuthenticated'](),controller[_0xceb9('0xf')]);router['post']('/',auth[_0xceb9('0x9')](),controller[_0xceb9('0x10')]);router[_0xceb9('0x11')](_0xceb9('0xd'),auth['isAuthenticated'](),controller[_0xceb9('0x12')]);router[_0xceb9('0x11')]('/:id/users',auth[_0xceb9('0x9')](),controller[_0xceb9('0x13')]);router[_0xceb9('0x14')](_0xceb9('0x15'),auth[_0xceb9('0x9')](),controller[_0xceb9('0x16')]);router[_0xceb9('0x17')]('/:id',auth[_0xceb9('0x9')](),controller['destroy']);router['delete'](_0xceb9('0xd'),auth[_0xceb9('0x9')](),controller[_0xceb9('0x18')]);router[_0xceb9('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xceb9('0x19')]);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 f7cfbb6..a96ffb7 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 _0x9972=['rrmemory','beepall','roundrobin','sequelize','exports','name','STRING','ENUM'];(function(_0x5852b2,_0x41633c){var _0x304d23=function(_0x5f521a){while(--_0x5f521a){_0x5852b2['push'](_0x5852b2['shift']());}};_0x304d23(++_0x41633c);}(_0x9972,0xab));var _0x2997=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9972[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x2997('0x0'));module[_0x2997('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2997('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2997('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2997('0x4')](_0x2997('0x5'),_0x2997('0x6'),_0x2997('0x7'))}}; \ No newline at end of file +var _0x919b=['INTEGER','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0x3fc21e,_0x31a624){var _0x423270=function(_0x463e33){while(--_0x463e33){_0x3fc21e['push'](_0x3fc21e['shift']());}};_0x423270(++_0x31a624);}(_0x919b,0xc4));var _0xb919=function(_0x1cf9fb,_0x2e281b){_0x1cf9fb=_0x1cf9fb-0x0;var _0x4cff83=_0x919b[_0x1cf9fb];return _0x4cff83;};'use strict';var Sequelize=require('sequelize');module[_0xb919('0x0')]={'name':{'type':Sequelize[_0xb919('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb919('0x1')]},'timeout':{'type':Sequelize[_0xb919('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xb919('0x3'),_0xb919('0x4'),_0xb919('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index cdbb5d0..54e76e9 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 _0x78f0=['undefined','limit','Content-Range','update','destroy','then','UserProfileResource','end','stack','name','send','index','OpenchannelQueue','fieldName','type','getOptions','where','count','include','query','findAll','rows','catch','params','model','keys','rawAttributes','intersection','attributes','fields','length','options','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','filters','hasOwnProperty','nolimit','sort','pick','OpenchannelQueueId','map','filter','merge','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','SIP','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','forEach','emit','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','all','union','compact','value','removeTeams','removeAgents','userOpenchannelQueue:remove','addAgents','spread','userOpenchannelQueue:save','isArray','getAgents','order','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','offset'];(function(_0x341602,_0x22f918){var _0x257b25=function(_0x2b3140){while(--_0x2b3140){_0x341602['push'](_0x341602['shift']());}};_0x257b25(++_0x22f918);}(_0x78f0,0x67));var _0x078f=function(_0x2372dc,_0x3c7ce4){_0x2372dc=_0x2372dc-0x0;var _0x518fb1=_0x78f0[_0x2372dc];return _0x518fb1;};'use strict';var BPromise=require('bluebird');var util=require(_0x078f('0x0'));var _=require(_0x078f('0x1'));var squel=require('squel');var Redis=require(_0x078f('0x2'));var qs=require(_0x078f('0x3'));var logger=require(_0x078f('0x4'))(_0x078f('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x078f('0x6')]=_[_0x078f('0x7')](config[_0x078f('0x6')],{'host':_0x078f('0x8'),'port':0x18eb});var socket=require(_0x078f('0x9'))(new Redis(config['redis']));require(_0x078f('0xa'))[_0x078f('0xb')](socket);function respondWithStatusCode(_0x4f03ac,_0xde9f85){_0xde9f85=_0xde9f85||0xcc;return function(_0x4920e5){if(_0x4920e5){return _0x4f03ac[_0x078f('0xc')](_0xde9f85);}return _0x4f03ac[_0x078f('0xd')](_0xde9f85)['end']();};}function respondWithResult(_0x31d579,_0x36f44d){_0x36f44d=_0x36f44d||0xc8;return function(_0x461f4d){if(_0x461f4d){return _0x31d579[_0x078f('0xd')](_0x36f44d)[_0x078f('0xe')](_0x461f4d);}};}function respondWithFilteredResult(_0xfa972e,_0x132293){return function(_0x364fcc){if(_0x364fcc){var _0x24d990=typeof _0x132293[_0x078f('0xf')]===_0x078f('0x10')&&typeof _0x132293[_0x078f('0x11')]===_0x078f('0x10');var _0x4f54cc=_0x364fcc['count'];var _0x462f40=_0x24d990?0x0:_0x132293[_0x078f('0xf')];var _0x453a98=_0x24d990?_0x364fcc['count']:_0x132293[_0x078f('0xf')]+_0x132293[_0x078f('0x11')];var _0x297e69;if(_0x453a98>=_0x4f54cc){_0x453a98=_0x4f54cc;_0x297e69=0xc8;}else{_0x297e69=0xce;}_0xfa972e[_0x078f('0xd')](_0x297e69);return _0xfa972e['set'](_0x078f('0x12'),_0x462f40+'-'+_0x453a98+'/'+_0x4f54cc)[_0x078f('0xe')](_0x364fcc);}return null;};}function saveUpdates(_0xce2a0b){return function(_0x27595e){if(_0x27595e){return _0x27595e[_0x078f('0x13')](_0xce2a0b)['then'](function(_0x505a74){return _0x505a74;});}return null;};}function removeEntity(_0x3429ef){return function(_0x51683b){if(_0x51683b){return _0x51683b[_0x078f('0x14')]()[_0x078f('0x15')](function(){var _0x24cb33=_0x51683b['get']({'plain':!![]});var _0x567cde='OpenchannelQueues';return db[_0x078f('0x16')][_0x078f('0x14')]({'where':{'type':_0x567cde,'resourceId':_0x24cb33['id']}})[_0x078f('0x15')](function(){return _0x51683b;});})[_0x078f('0x15')](function(){_0x3429ef[_0x078f('0xd')](0xcc)[_0x078f('0x17')]();});}};}function handleEntityNotFound(_0x209338){return function(_0xee9a5d){if(!_0xee9a5d){_0x209338[_0x078f('0xc')](0x194);}return _0xee9a5d;};}function handleError(_0x2d5fcc,_0x246a8b){_0x246a8b=_0x246a8b||0x1f4;return function(_0xe5d9d){logger['error'](_0xe5d9d[_0x078f('0x18')]);if(_0xe5d9d['name']){delete _0xe5d9d[_0x078f('0x19')];}_0x2d5fcc[_0x078f('0xd')](_0x246a8b)[_0x078f('0x1a')](_0xe5d9d);};}exports[_0x078f('0x1b')]=function(_0x4ef4ac,_0xfefe7d){var _0x32bbf1={};var _0x4803cf={'count':0x0,'rows':[]};var _0x1c8006=_['map'](db[_0x078f('0x1c')]['rawAttributes'],function(_0x518743){return{'name':_0x518743[_0x078f('0x1d')],'type':_0x518743[_0x078f('0x1e')]['key']};});_0x32bbf1=qs[_0x078f('0x1f')](_0x1c8006,_0x4ef4ac);var _0x20f22a={'where':_0x32bbf1[_0x078f('0x20')]};return db[_0x078f('0x1c')][_0x078f('0x21')](_0x20f22a)['then'](function(_0x59da4a){_0x4803cf[_0x078f('0x21')]=_0x59da4a;_0x32bbf1['include']=qs[_0x078f('0x22')](_0x4ef4ac[_0x078f('0x23')]);return db[_0x078f('0x1c')][_0x078f('0x24')](_0x32bbf1);})[_0x078f('0x15')](function(_0x386840){_0x4803cf[_0x078f('0x25')]=_0x386840;return _0x4803cf;})['then'](respondWithFilteredResult(_0xfefe7d,_0x32bbf1))[_0x078f('0x26')](handleError(_0xfefe7d,null));};exports['show']=function(_0xdb63ef,_0x5480fb){var _0x5d308b={'raw':!![],'where':{'id':_0xdb63ef[_0x078f('0x27')]['id']}},_0x4a8b8e={};_0x4a8b8e[_0x078f('0x28')]=_[_0x078f('0x29')](db[_0x078f('0x1c')][_0x078f('0x2a')]);_0x4a8b8e[_0x078f('0x23')]=_[_0x078f('0x29')](_0xdb63ef['query']);_0x4a8b8e['filters']=_[_0x078f('0x2b')](_0x4a8b8e[_0x078f('0x28')],_0x4a8b8e[_0x078f('0x23')]);_0x5d308b[_0x078f('0x2c')]=_[_0x078f('0x2b')](_0x4a8b8e[_0x078f('0x28')],qs[_0x078f('0x2d')](_0xdb63ef[_0x078f('0x23')][_0x078f('0x2d')]));_0x5d308b[_0x078f('0x2c')]=_0x5d308b[_0x078f('0x2c')][_0x078f('0x2e')]?_0x5d308b[_0x078f('0x2c')]:_0x4a8b8e[_0x078f('0x28')];if(_0xdb63ef[_0x078f('0x23')]['includeAll']){_0x5d308b[_0x078f('0x22')]=[{'all':!![]}];}_0x5d308b=_['merge']({},_0x5d308b,_0xdb63ef[_0x078f('0x2f')]);return db[_0x078f('0x1c')][_0x078f('0x30')](_0x5d308b)['then'](handleEntityNotFound(_0x5480fb,null))[_0x078f('0x15')](respondWithResult(_0x5480fb,null))[_0x078f('0x26')](handleError(_0x5480fb,null));};exports[_0x078f('0x31')]=function(_0x87f017,_0x590b1c){return db['OpenchannelQueue'][_0x078f('0x31')](_0x87f017[_0x078f('0x32')],{})[_0x078f('0x15')](function(_0x561475){var _0x499b32=_0x87f017[_0x078f('0x33')][_0x078f('0x34')]({'plain':!![]});if(!_0x499b32)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x499b32[_0x078f('0x35')]===_0x078f('0x33')){var _0xbb0e6a=_0x561475[_0x078f('0x34')]({'plain':!![]});var _0x2ee201='OpenchannelQueues';return db[_0x078f('0x36')]['find']({'where':{'name':_0x2ee201,'userProfileId':_0x499b32[_0x078f('0x37')]},'raw':!![]})[_0x078f('0x15')](function(_0x5e5a4c){if(_0x5e5a4c&&_0x5e5a4c[_0x078f('0x38')]===0x0){return db['UserProfileResource']['create']({'name':_0xbb0e6a[_0x078f('0x19')],'resourceId':_0xbb0e6a['id'],'type':_0x5e5a4c[_0x078f('0x19')],'sectionId':_0x5e5a4c['id']},{})[_0x078f('0x15')](function(){return _0x561475;});}else{return _0x561475;}})[_0x078f('0x26')](function(_0x4adfda){logger[_0x078f('0x39')](_0x078f('0x3a'),_0x4adfda);throw _0x4adfda;});}return _0x561475;})[_0x078f('0x15')](respondWithResult(_0x590b1c,0xc9))[_0x078f('0x26')](handleError(_0x590b1c,null));};exports[_0x078f('0x13')]=function(_0x34b3b7,_0x58707c){if(_0x34b3b7[_0x078f('0x32')]['id']){delete _0x34b3b7[_0x078f('0x32')]['id'];}return db[_0x078f('0x1c')][_0x078f('0x30')]({'where':{'id':_0x34b3b7[_0x078f('0x27')]['id']}})[_0x078f('0x15')](handleEntityNotFound(_0x58707c,null))[_0x078f('0x15')](saveUpdates(_0x34b3b7['body'],null))[_0x078f('0x15')](respondWithResult(_0x58707c,null))[_0x078f('0x26')](handleError(_0x58707c,null));};exports['destroy']=function(_0x3dd593,_0x3702bf){return db['OpenchannelQueue']['find']({'where':{'id':_0x3dd593['params']['id']}})[_0x078f('0x15')](handleEntityNotFound(_0x3702bf,null))[_0x078f('0x15')](removeEntity(_0x3702bf,null))[_0x078f('0x26')](handleError(_0x3702bf,null));};exports['describe']=function(_0x40cae1,_0x3092ce){return db[_0x078f('0x1c')][_0x078f('0x3b')]()['then'](respondWithResult(_0x3092ce,null))[_0x078f('0x26')](handleError(_0x3092ce,null));};exports[_0x078f('0x3c')]=function(_0x2ce67c,_0x4052b7){var _0x5b8db7={'raw':!![],'where':{}},_0x44a493={},_0x1263be;return db[_0x078f('0x1c')][_0x078f('0x3d')]({'where':{'id':_0x2ce67c[_0x078f('0x27')]['id']}})['then'](handleEntityNotFound(_0x4052b7,null))['then'](function(_0x22f7da){if(_0x22f7da){_0x1263be=_0x22f7da[_0x078f('0x34')]({'plain':!![]});_0x44a493['model']=_['keys'](db[_0x078f('0x3e')]['rawAttributes']);_0x44a493['query']=_['keys'](_0x2ce67c[_0x078f('0x23')]);_0x44a493[_0x078f('0x3f')]=_['intersection'](_0x44a493[_0x078f('0x28')],_0x44a493['query']);_0x5b8db7[_0x078f('0x2c')]=_[_0x078f('0x2b')](_0x44a493[_0x078f('0x28')],qs[_0x078f('0x2d')](_0x2ce67c[_0x078f('0x23')]['fields']));_0x5b8db7[_0x078f('0x2c')]=_0x5b8db7[_0x078f('0x2c')][_0x078f('0x2e')]?_0x5b8db7[_0x078f('0x2c')]:_0x44a493[_0x078f('0x28')];if(!_0x2ce67c[_0x078f('0x23')][_0x078f('0x40')](_0x078f('0x41'))){_0x5b8db7[_0x078f('0x11')]=qs[_0x078f('0x11')](_0x2ce67c[_0x078f('0x23')][_0x078f('0x11')]);_0x5b8db7[_0x078f('0xf')]=qs[_0x078f('0xf')](_0x2ce67c['query'][_0x078f('0xf')]);}_0x5b8db7['order']=qs[_0x078f('0x42')](_0x2ce67c['query'][_0x078f('0x42')]);_0x5b8db7[_0x078f('0x20')]=qs[_0x078f('0x3f')](_[_0x078f('0x43')](_0x2ce67c[_0x078f('0x23')],_0x44a493[_0x078f('0x3f')]));_0x5b8db7[_0x078f('0x20')][_0x078f('0x44')]=_0x22f7da['id'];if(_0x2ce67c[_0x078f('0x23')]['filter']){_0x5b8db7[_0x078f('0x20')]=_['merge'](_0x5b8db7[_0x078f('0x20')],{'$or':_[_0x078f('0x45')](_0x5b8db7[_0x078f('0x2c')],function(_0xf4bf01){var _0x350a2b={};_0x350a2b[_0xf4bf01]={'$like':'%'+_0x2ce67c[_0x078f('0x23')][_0x078f('0x46')]+'%'};return _0x350a2b;})});}_0x5b8db7=_[_0x078f('0x47')]({},_0x5b8db7,_0x2ce67c[_0x078f('0x2f')]);return db[_0x078f('0x3e')][_0x078f('0x24')](_0x5b8db7);}})['then'](function(_0x2352fe){if(_0x2352fe){return db[_0x078f('0x48')][_0x078f('0x49')]({'where':{'id':_[_0x078f('0x45')](_0x2352fe,_0x078f('0x4a')),'role':_0x078f('0x4b')},'attributes':['id',_0x078f('0x19'),'openchannelPause',_0x078f('0x4c'),_0x078f('0x4d')]});}})[_0x078f('0x15')](function(_0x402842){if(_0x402842){return{'count':_0x402842[_0x078f('0x21')],'rows':_[_0x078f('0x45')](_0x402842['rows'],function(_0x50d8c5){return{'membername':_0x50d8c5[_0x078f('0x19')],'UserId':_0x50d8c5['id'],'queue_name':_0x1263be[_0x078f('0x19')],'OpenchannelQueueId':_0x1263be['id'],'interface':util[_0x078f('0x4e')]('%s/%s',_0x078f('0x4f'),_0x50d8c5[_0x078f('0x19')]),'penalty':0x0,'paused':_0x50d8c5['openchannelPause'],'createdAt':_0x50d8c5['createdAt'],'updatedAt':_0x50d8c5[_0x078f('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4052b7,_0x5b8db7))[_0x078f('0x26')](handleError(_0x4052b7,null));};exports[_0x078f('0x50')]=function(_0x4f2105,_0x43a6b6){var _0x532957={};var _0x38cc2e={};var _0x57708d;var _0x532098;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x4f2105[_0x078f('0x27')]['id']}})[_0x078f('0x15')](handleEntityNotFound(_0x43a6b6,null))[_0x078f('0x15')](function(_0x7196c3){if(_0x7196c3){_0x57708d=_0x7196c3;_0x38cc2e[_0x078f('0x28')]=_[_0x078f('0x29')](db[_0x078f('0x51')]['rawAttributes']);_0x38cc2e['query']=_[_0x078f('0x29')](_0x4f2105['query']);_0x38cc2e['filters']=_[_0x078f('0x2b')](_0x38cc2e[_0x078f('0x28')],_0x38cc2e[_0x078f('0x23')]);_0x532957[_0x078f('0x2c')]=_[_0x078f('0x2b')](_0x38cc2e[_0x078f('0x28')],qs[_0x078f('0x2d')](_0x4f2105[_0x078f('0x23')][_0x078f('0x2d')]));_0x532957[_0x078f('0x2c')]=_0x532957[_0x078f('0x2c')][_0x078f('0x2e')]?_0x532957[_0x078f('0x2c')]:_0x38cc2e[_0x078f('0x28')];_0x532957['order']=qs['sort'](_0x4f2105[_0x078f('0x23')][_0x078f('0x42')]);_0x532957[_0x078f('0x20')]=qs[_0x078f('0x3f')](_[_0x078f('0x43')](_0x4f2105[_0x078f('0x23')],_0x38cc2e[_0x078f('0x3f')]));if(_0x4f2105[_0x078f('0x23')][_0x078f('0x46')]){_0x532957[_0x078f('0x20')]=_[_0x078f('0x47')](_0x532957[_0x078f('0x20')],{'$or':_[_0x078f('0x45')](_0x532957['attributes'],function(_0x236321){var _0x5087c6={};_0x5087c6[_0x236321]={'$like':'%'+_0x4f2105[_0x078f('0x23')][_0x078f('0x46')]+'%'};return _0x5087c6;})});}_0x532957=_[_0x078f('0x47')]({},_0x532957,_0x4f2105[_0x078f('0x2f')]);return _0x57708d[_0x078f('0x50')](_0x532957);}})['then'](function(_0x8e1fae){if(_0x8e1fae){_0x532098=_0x8e1fae[_0x078f('0x2e')];if(!_0x4f2105['query'][_0x078f('0x40')]('nolimit')){_0x532957[_0x078f('0x11')]=qs[_0x078f('0x11')](_0x4f2105[_0x078f('0x23')][_0x078f('0x11')]);_0x532957[_0x078f('0xf')]=qs['offset'](_0x4f2105[_0x078f('0x23')][_0x078f('0xf')]);}return _0x57708d[_0x078f('0x50')](_0x532957);}})['then'](function(_0x59d969){if(_0x59d969){return _0x59d969?{'count':_0x532098,'rows':_0x59d969}:null;}})[_0x078f('0x15')](respondWithResult(_0x43a6b6,null))['catch'](handleError(_0x43a6b6,null));};exports['addTeams']=function(_0x4051c5,_0x45886f){var _0x44be81=_0x4051c5[_0x078f('0x32')][_0x078f('0x52')];return db[_0x078f('0x51')]['findAll']({'where':{'id':_0x44be81},'attributes':['id'],'include':[{'model':db[_0x078f('0x48')],'as':_0x078f('0x53'),'attributes':['id',_0x078f('0x19'),_0x078f('0x54'),_0x078f('0x55'),_0x078f('0x56')],'raw':!![]}]})[_0x078f('0x15')](function(_0x2cfbbd){if(_0x2cfbbd){var _0x377469=_[_0x078f('0x57')](_0x2cfbbd,function(_0x5b1cae){var _0x413fdd=_0x5b1cae[_0x078f('0x34')]({'plain':!![]});return _0x413fdd[_0x078f('0x53')];});return db['OpenchannelQueue'][_0x078f('0x30')]({'where':{'id':_0x4051c5['params']['id']}})[_0x078f('0x15')](function(_0x13fa59){return db[_0x078f('0x58')][_0x078f('0x59')](function(_0x1a1fc1){return _0x13fa59[_0x078f('0x5a')](_0x44be81,{'transaction':_0x1a1fc1})[_0x078f('0x15')](function(){return BPromise[_0x078f('0x5b')](_0x377469,function(_0x39157e){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x39157e['id'],'OpenchannelQueueId':_0x4051c5['params']['id']},'transaction':_0x1a1fc1});});})['then'](function(){_0x377469[_0x078f('0x5c')](function(_0x116556){socket[_0x078f('0x5d')]('userOpenchannelQueue:save',{'UserId':_0x116556['id'],'OpenchannelQueueId':_0x13fa59['id']});});});});});}})[_0x078f('0x15')](respondWithStatusCode(_0x45886f,null))[_0x078f('0x26')](handleError(_0x45886f,null));};exports['removeTeams']=function(_0x3c210f,_0x5bc776){return db[_0x078f('0x51')][_0x078f('0x24')]({'where':{'id':_0x3c210f[_0x078f('0x23')]['ids']},'attributes':['id'],'include':[{'model':db[_0x078f('0x48')],'as':_0x078f('0x53'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5bc776,null))[_0x078f('0x15')](function(_0x43edc3){var _0x1a8832=_[_0x078f('0x45')](_0x43edc3,'id');var _0x3be4a1=[];var _0x1491dc=[];var _0x1bb648=squel['select']();_0x1bb648[_0x078f('0x5e')](_0x078f('0x5f'))['from'](_0x078f('0x60'),'tq')[_0x078f('0x61')](_0x078f('0x62'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x078f('0x20')]('OpenchannelQueueId\x20=\x20?',_0x3c210f[_0x078f('0x27')]['id']);for(var _0x34c9fa=0x0;_0x34c9fa<_0x43edc3['length'];_0x34c9fa+=0x1){let _0xd5844d=_0x43edc3[_0x34c9fa];for(var _0x51c70a=0x0;_0x51c70a<_0xd5844d['Agents'][_0x078f('0x2e')];_0x51c70a+=0x1){let _0x3f27cf=_0xd5844d[_0x078f('0x53')][_0x51c70a];var _0x488b43=_0x1bb648[_0x078f('0x63')]();_0x488b43[_0x078f('0x20')](_0x078f('0x64'),_0x3f27cf['id']);_0x1491dc[_0x078f('0x65')](db[_0x078f('0x58')]['query'](_0x488b43[_0x078f('0x66')](),{'type':db[_0x078f('0x58')]['QueryTypes'][_0x078f('0x67')]})[_0x078f('0x15')](function(_0x7789f9){if(_0x7789f9['length']===0x1){return _0x3f27cf['id'];}else{var _0x54d9da=_[_0x078f('0x68')](_[_0x078f('0x45')](_0x7789f9,'TeamId'),function(_0x1c4124){return _[_0x078f('0x69')](_0x1a8832,_0x1c4124);});if(_0x54d9da){return _0x3f27cf['id'];}}}));}}return BPromise[_0x078f('0x6a')](_0x1491dc)['then'](function(_0x2ff726){_0x3be4a1=_(_0x3be4a1)[_0x078f('0x6b')](_0x2ff726)[_0x078f('0x6c')]()[_0x078f('0x6d')]();return db['OpenchannelQueue'][_0x078f('0x30')]({'where':{'id':_0x3c210f[_0x078f('0x27')]['id']}})[_0x078f('0x15')](function(_0x1428b2){return db[_0x078f('0x58')]['transaction'](function(_0x2da27d){return _0x1428b2[_0x078f('0x6e')](_0x3c210f[_0x078f('0x23')]['ids'],{'transaction':_0x2da27d})['then'](function(){if(!_['isEmpty'](_0x3be4a1)){return _0x1428b2[_0x078f('0x6f')](_0x3be4a1,{'transaction':_0x2da27d});}})[_0x078f('0x15')](function(){_0x3be4a1[_0x078f('0x5c')](function(_0x2b9fb9){socket['emit'](_0x078f('0x70'),{'UserId':_0x2b9fb9,'OpenchannelQueueId':_0x1428b2['id']});});});});});});})[_0x078f('0x15')](respondWithStatusCode(_0x5bc776,null))[_0x078f('0x26')](handleError(_0x5bc776,null));};exports[_0x078f('0x71')]=function(_0x3becb8,_0x601054){return db['OpenchannelQueue']['find']({'where':{'id':_0x3becb8[_0x078f('0x27')]['id']}})['then'](handleEntityNotFound(_0x601054,null))[_0x078f('0x15')](function(_0x310d0d){if(_0x310d0d){return _0x310d0d[_0x078f('0x71')](_0x3becb8[_0x078f('0x32')]['ids'],_['omit'](_0x3becb8[_0x078f('0x32')],['ids','id'])||{})[_0x078f('0x72')](function(_0x29cf6f){for(var _0x120bde=0x0;_0x120bde<_0x3becb8[_0x078f('0x32')][_0x078f('0x52')][_0x078f('0x2e')];_0x120bde+=0x1){socket[_0x078f('0x5d')](_0x078f('0x73'),{'UserId':Number(_0x3becb8[_0x078f('0x32')][_0x078f('0x52')][_0x120bde]),'OpenchannelQueueId':Number(_0x3becb8[_0x078f('0x27')]['id'])});}return _0x29cf6f;});}})[_0x078f('0x15')](respondWithResult(_0x601054,null))[_0x078f('0x26')](handleError(_0x601054,null));};exports[_0x078f('0x6f')]=function(_0x185788,_0x246d3d){return db[_0x078f('0x1c')]['find']({'where':{'id':_0x185788['params']['id']}})[_0x078f('0x15')](handleEntityNotFound(_0x246d3d,null))[_0x078f('0x15')](function(_0x3a191d){if(_0x3a191d){return _0x3a191d[_0x078f('0x6f')](_0x185788[_0x078f('0x23')][_0x078f('0x52')])[_0x078f('0x15')](function(){if(_[_0x078f('0x74')](_0x185788[_0x078f('0x23')][_0x078f('0x52')])){for(var _0x15902e=0x0;_0x15902e<_0x185788[_0x078f('0x23')]['ids'][_0x078f('0x2e')];_0x15902e+=0x1){socket['emit'](_0x078f('0x70'),{'UserId':Number(_0x185788[_0x078f('0x23')][_0x078f('0x52')][_0x15902e]),'OpenchannelQueueId':Number(_0x185788[_0x078f('0x27')]['id'])});}}else{socket[_0x078f('0x5d')](_0x078f('0x70'),{'UserId':Number(_0x185788[_0x078f('0x23')]['ids']),'OpenchannelQueueId':Number(_0x185788['params']['id'])});}});}})[_0x078f('0x15')](respondWithStatusCode(_0x246d3d,null))['catch'](handleError(_0x246d3d,null));};exports[_0x078f('0x75')]=function(_0x3eed6b,_0x38e3ba){var _0x597a63={};var _0xf9ac3={};var _0x5ae236;var _0x2727ab;return db[_0x078f('0x1c')]['findOne']({'where':{'id':_0x3eed6b[_0x078f('0x27')]['id']}})[_0x078f('0x15')](handleEntityNotFound(_0x38e3ba,null))[_0x078f('0x15')](function(_0x421c4e){if(_0x421c4e){_0x5ae236=_0x421c4e;_0xf9ac3[_0x078f('0x28')]=_['keys'](db[_0x078f('0x48')][_0x078f('0x2a')]);_0xf9ac3[_0x078f('0x23')]=_[_0x078f('0x29')](_0x3eed6b[_0x078f('0x23')]);_0xf9ac3[_0x078f('0x3f')]=_[_0x078f('0x2b')](_0xf9ac3[_0x078f('0x28')],_0xf9ac3[_0x078f('0x23')]);_0x597a63[_0x078f('0x2c')]=_[_0x078f('0x2b')](_0xf9ac3[_0x078f('0x28')],qs['fields'](_0x3eed6b[_0x078f('0x23')][_0x078f('0x2d')]));_0x597a63['attributes']=_0x597a63[_0x078f('0x2c')][_0x078f('0x2e')]?_0x597a63['attributes']:_0xf9ac3[_0x078f('0x28')];_0x597a63[_0x078f('0x76')]=qs[_0x078f('0x42')](_0x3eed6b[_0x078f('0x23')][_0x078f('0x42')]);_0x597a63[_0x078f('0x20')]=qs[_0x078f('0x3f')](_['pick'](_0x3eed6b['query'],_0xf9ac3[_0x078f('0x3f')]));if(_0x3eed6b[_0x078f('0x23')][_0x078f('0x46')]){_0x597a63[_0x078f('0x20')]=_[_0x078f('0x47')](_0x597a63[_0x078f('0x20')],{'$or':_['map'](_0x597a63[_0x078f('0x2c')],function(_0x16a867){var _0x27d2aa={};_0x27d2aa[_0x16a867]={'$like':'%'+_0x3eed6b[_0x078f('0x23')][_0x078f('0x46')]+'%'};return _0x27d2aa;})});}_0x597a63=_[_0x078f('0x47')]({},_0x597a63,_0x3eed6b['options']);return _0x5ae236['getAgents'](_0x597a63);}})[_0x078f('0x15')](function(_0x5c5122){if(_0x5c5122){_0x2727ab=_0x5c5122['length'];if(!_0x3eed6b[_0x078f('0x23')]['hasOwnProperty']('nolimit')){_0x597a63[_0x078f('0x11')]=qs[_0x078f('0x11')](_0x3eed6b[_0x078f('0x23')][_0x078f('0x11')]);_0x597a63[_0x078f('0xf')]=qs[_0x078f('0xf')](_0x3eed6b[_0x078f('0x23')][_0x078f('0xf')]);}return _0x5ae236['getAgents'](_0x597a63);}})['then'](function(_0x4d49cd){if(_0x4d49cd){return _0x4d49cd?{'count':_0x2727ab,'rows':_0x4d49cd}:null;}})[_0x078f('0x15')](respondWithResult(_0x38e3ba,null))[_0x078f('0x26')](handleError(_0x38e3ba,null));}; \ No newline at end of file +var _0x3500=['transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','nolimit','bluebird','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','end','json','offset','undefined','limit','count','status','set','Content-Range','update','then','destroy','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','order','where','pick','OpenchannelQueueId','filter','options','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','sort','ids','Agents','online','voicePause','sequelize'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3500,0x197));var _0x0350=function(_0x790b12,_0x564961){_0x790b12=_0x790b12-0x0;var _0x251acf=_0x3500[_0x790b12];return _0x251acf;};'use strict';var BPromise=require(_0x0350('0x0'));var util=require('util');var _=require(_0x0350('0x1'));var squel=require(_0x0350('0x2'));var Redis=require(_0x0350('0x3'));var qs=require(_0x0350('0x4'));var logger=require('../../config/logger')(_0x0350('0x5'));var config=require(_0x0350('0x6'));var db=require(_0x0350('0x7'))['db'];config[_0x0350('0x8')]=_[_0x0350('0x9')](config[_0x0350('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x0350('0xa'))(new Redis(config['redis']));require(_0x0350('0xb'))['register'](socket);function respondWithStatusCode(_0x54b3ed,_0x429e26){_0x429e26=_0x429e26||0xcc;return function(_0xdf2664){if(_0xdf2664){return _0x54b3ed['sendStatus'](_0x429e26);}return _0x54b3ed['status'](_0x429e26)[_0x0350('0xc')]();};}function respondWithResult(_0x3429ce,_0x39c55d){_0x39c55d=_0x39c55d||0xc8;return function(_0x349efa){if(_0x349efa){return _0x3429ce['status'](_0x39c55d)[_0x0350('0xd')](_0x349efa);}};}function respondWithFilteredResult(_0x4dfb46,_0x1021c2){return function(_0x15b5ed){if(_0x15b5ed){var _0x12eb1c=typeof _0x1021c2[_0x0350('0xe')]===_0x0350('0xf')&&typeof _0x1021c2[_0x0350('0x10')]==='undefined';var _0x3d3671=_0x15b5ed[_0x0350('0x11')];var _0xc5f58f=_0x12eb1c?0x0:_0x1021c2[_0x0350('0xe')];var _0x3e9137=_0x12eb1c?_0x15b5ed[_0x0350('0x11')]:_0x1021c2[_0x0350('0xe')]+_0x1021c2[_0x0350('0x10')];var _0x520616;if(_0x3e9137>=_0x3d3671){_0x3e9137=_0x3d3671;_0x520616=0xc8;}else{_0x520616=0xce;}_0x4dfb46[_0x0350('0x12')](_0x520616);return _0x4dfb46[_0x0350('0x13')](_0x0350('0x14'),_0xc5f58f+'-'+_0x3e9137+'/'+_0x3d3671)[_0x0350('0xd')](_0x15b5ed);}return null;};}function saveUpdates(_0x370d97){return function(_0x2ae8d0){if(_0x2ae8d0){return _0x2ae8d0[_0x0350('0x15')](_0x370d97)[_0x0350('0x16')](function(_0x26cbc3){return _0x26cbc3;});}return null;};}function removeEntity(_0x452980){return function(_0x339ee7){if(_0x339ee7){return _0x339ee7[_0x0350('0x17')]()[_0x0350('0x16')](function(){var _0x47842a=_0x339ee7['get']({'plain':!![]});var _0x41fb69=_0x0350('0x18');return db[_0x0350('0x19')][_0x0350('0x17')]({'where':{'type':_0x41fb69,'resourceId':_0x47842a['id']}})[_0x0350('0x16')](function(){return _0x339ee7;});})['then'](function(){_0x452980[_0x0350('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39709e){return function(_0x1303b3){if(!_0x1303b3){_0x39709e[_0x0350('0x1a')](0x194);}return _0x1303b3;};}function handleError(_0x1b325b,_0x31282e){_0x31282e=_0x31282e||0x1f4;return function(_0x51e229){logger[_0x0350('0x1b')](_0x51e229[_0x0350('0x1c')]);if(_0x51e229[_0x0350('0x1d')]){delete _0x51e229[_0x0350('0x1d')];}_0x1b325b[_0x0350('0x12')](_0x31282e)[_0x0350('0x1e')](_0x51e229);};}exports[_0x0350('0x1f')]=function(_0x873758,_0x5bf6dc){var _0x73f1fb={};var _0x3303ad={'count':0x0,'rows':[]};var _0x2fc60e=_[_0x0350('0x20')](db[_0x0350('0x21')][_0x0350('0x22')],function(_0x2d8eb5){return{'name':_0x2d8eb5[_0x0350('0x23')],'type':_0x2d8eb5[_0x0350('0x24')][_0x0350('0x25')]};});_0x73f1fb=qs['getOptions'](_0x2fc60e,_0x873758);var _0xafc4b1={'where':_0x73f1fb['where']};return db[_0x0350('0x21')]['count'](_0xafc4b1)[_0x0350('0x16')](function(_0x49d4ff){_0x3303ad[_0x0350('0x11')]=_0x49d4ff;_0x73f1fb['include']=qs[_0x0350('0x26')](_0x873758[_0x0350('0x27')]);return db['OpenchannelQueue'][_0x0350('0x28')](_0x73f1fb);})[_0x0350('0x16')](function(_0x222f2d){_0x3303ad[_0x0350('0x29')]=_0x222f2d;return _0x3303ad;})['then'](respondWithFilteredResult(_0x5bf6dc,_0x73f1fb))[_0x0350('0x2a')](handleError(_0x5bf6dc,null));};exports[_0x0350('0x2b')]=function(_0x2c6341,_0x3d8e13){var _0x2277f0={'raw':!![],'where':{'id':_0x2c6341[_0x0350('0x2c')]['id']}},_0x3d9a58={};_0x3d9a58[_0x0350('0x2d')]=_[_0x0350('0x2e')](db[_0x0350('0x21')][_0x0350('0x22')]);_0x3d9a58['query']=_['keys'](_0x2c6341['query']);_0x3d9a58[_0x0350('0x2f')]=_[_0x0350('0x30')](_0x3d9a58[_0x0350('0x2d')],_0x3d9a58[_0x0350('0x27')]);_0x2277f0['attributes']=_[_0x0350('0x30')](_0x3d9a58[_0x0350('0x2d')],qs[_0x0350('0x31')](_0x2c6341[_0x0350('0x27')][_0x0350('0x31')]));_0x2277f0[_0x0350('0x32')]=_0x2277f0[_0x0350('0x32')][_0x0350('0x33')]?_0x2277f0['attributes']:_0x3d9a58['model'];if(_0x2c6341['query'][_0x0350('0x34')]){_0x2277f0[_0x0350('0x26')]=[{'all':!![]}];}_0x2277f0=_[_0x0350('0x35')]({},_0x2277f0,_0x2c6341['options']);return db[_0x0350('0x21')][_0x0350('0x36')](_0x2277f0)[_0x0350('0x16')](handleEntityNotFound(_0x3d8e13,null))[_0x0350('0x16')](respondWithResult(_0x3d8e13,null))[_0x0350('0x2a')](handleError(_0x3d8e13,null));};exports[_0x0350('0x37')]=function(_0x2b4f50,_0xe2a4af){return db['OpenchannelQueue']['create'](_0x2b4f50['body'],{})[_0x0350('0x16')](function(_0x31077d){var _0x5004da=_0x2b4f50[_0x0350('0x38')][_0x0350('0x39')]({'plain':!![]});if(!_0x5004da)throw new Error(_0x0350('0x3a'));if(_0x5004da[_0x0350('0x3b')]==='user'){var _0x3ff6a5=_0x31077d[_0x0350('0x39')]({'plain':!![]});var _0x16f80d=_0x0350('0x18');return db[_0x0350('0x3c')][_0x0350('0x36')]({'where':{'name':_0x16f80d,'userProfileId':_0x5004da['userProfileId']},'raw':!![]})[_0x0350('0x16')](function(_0x476ce5){if(_0x476ce5&&_0x476ce5[_0x0350('0x3d')]===0x0){return db[_0x0350('0x19')][_0x0350('0x37')]({'name':_0x3ff6a5[_0x0350('0x1d')],'resourceId':_0x3ff6a5['id'],'type':_0x476ce5[_0x0350('0x1d')],'sectionId':_0x476ce5['id']},{})[_0x0350('0x16')](function(){return _0x31077d;});}else{return _0x31077d;}})[_0x0350('0x2a')](function(_0x20ec25){logger[_0x0350('0x1b')](_0x0350('0x3e'),_0x20ec25);throw _0x20ec25;});}return _0x31077d;})[_0x0350('0x16')](respondWithResult(_0xe2a4af,0xc9))[_0x0350('0x2a')](handleError(_0xe2a4af,null));};exports[_0x0350('0x15')]=function(_0x5f0ae5,_0x59b13b){if(_0x5f0ae5[_0x0350('0x3f')]['id']){delete _0x5f0ae5['body']['id'];}return db[_0x0350('0x21')][_0x0350('0x36')]({'where':{'id':_0x5f0ae5['params']['id']}})[_0x0350('0x16')](handleEntityNotFound(_0x59b13b,null))['then'](saveUpdates(_0x5f0ae5[_0x0350('0x3f')],null))[_0x0350('0x16')](respondWithResult(_0x59b13b,null))[_0x0350('0x2a')](handleError(_0x59b13b,null));};exports[_0x0350('0x17')]=function(_0x2957fd,_0x5598d6){return db[_0x0350('0x21')][_0x0350('0x36')]({'where':{'id':_0x2957fd['params']['id']}})[_0x0350('0x16')](handleEntityNotFound(_0x5598d6,null))[_0x0350('0x16')](removeEntity(_0x5598d6,null))['catch'](handleError(_0x5598d6,null));};exports['describe']=function(_0x489eef,_0x2918c8){return db[_0x0350('0x21')][_0x0350('0x40')]()[_0x0350('0x16')](respondWithResult(_0x2918c8,null))[_0x0350('0x2a')](handleError(_0x2918c8,null));};exports[_0x0350('0x41')]=function(_0x56af08,_0x200ad2){var _0x2dcf92={'raw':!![],'where':{}},_0x17e86a={},_0x2c2373;return db[_0x0350('0x21')][_0x0350('0x42')]({'where':{'id':_0x56af08[_0x0350('0x2c')]['id']}})['then'](handleEntityNotFound(_0x200ad2,null))[_0x0350('0x16')](function(_0x40ae85){if(_0x40ae85){_0x2c2373=_0x40ae85['get']({'plain':!![]});_0x17e86a['model']=_[_0x0350('0x2e')](db[_0x0350('0x43')][_0x0350('0x22')]);_0x17e86a[_0x0350('0x27')]=_[_0x0350('0x2e')](_0x56af08['query']);_0x17e86a['filters']=_[_0x0350('0x30')](_0x17e86a[_0x0350('0x2d')],_0x17e86a[_0x0350('0x27')]);_0x2dcf92[_0x0350('0x32')]=_[_0x0350('0x30')](_0x17e86a['model'],qs[_0x0350('0x31')](_0x56af08['query'][_0x0350('0x31')]));_0x2dcf92['attributes']=_0x2dcf92[_0x0350('0x32')][_0x0350('0x33')]?_0x2dcf92[_0x0350('0x32')]:_0x17e86a['model'];if(!_0x56af08[_0x0350('0x27')][_0x0350('0x44')]('nolimit')){_0x2dcf92['limit']=qs['limit'](_0x56af08[_0x0350('0x27')][_0x0350('0x10')]);_0x2dcf92['offset']=qs[_0x0350('0xe')](_0x56af08[_0x0350('0x27')]['offset']);}_0x2dcf92[_0x0350('0x45')]=qs['sort'](_0x56af08[_0x0350('0x27')]['sort']);_0x2dcf92[_0x0350('0x46')]=qs[_0x0350('0x2f')](_[_0x0350('0x47')](_0x56af08[_0x0350('0x27')],_0x17e86a['filters']));_0x2dcf92['where'][_0x0350('0x48')]=_0x40ae85['id'];if(_0x56af08[_0x0350('0x27')]['filter']){_0x2dcf92[_0x0350('0x46')]=_[_0x0350('0x35')](_0x2dcf92[_0x0350('0x46')],{'$or':_['map'](_0x2dcf92[_0x0350('0x32')],function(_0x4130f8){var _0x36cb2c={};_0x36cb2c[_0x4130f8]={'$like':'%'+_0x56af08['query'][_0x0350('0x49')]+'%'};return _0x36cb2c;})});}_0x2dcf92=_[_0x0350('0x35')]({},_0x2dcf92,_0x56af08[_0x0350('0x4a')]);return db[_0x0350('0x43')][_0x0350('0x28')](_0x2dcf92);}})[_0x0350('0x16')](function(_0x1e7f72){if(_0x1e7f72){return db[_0x0350('0x4b')][_0x0350('0x4c')]({'where':{'id':_[_0x0350('0x20')](_0x1e7f72,_0x0350('0x4d')),'role':_0x0350('0x4e')},'attributes':['id','name',_0x0350('0x4f'),_0x0350('0x50'),_0x0350('0x51')]});}})['then'](function(_0x53602c){if(_0x53602c){return{'count':_0x53602c[_0x0350('0x11')],'rows':_[_0x0350('0x20')](_0x53602c['rows'],function(_0x4d707e){return{'membername':_0x4d707e['name'],'UserId':_0x4d707e['id'],'queue_name':_0x2c2373[_0x0350('0x1d')],'OpenchannelQueueId':_0x2c2373['id'],'interface':util[_0x0350('0x52')](_0x0350('0x53'),_0x0350('0x54'),_0x4d707e[_0x0350('0x1d')]),'penalty':0x0,'paused':_0x4d707e[_0x0350('0x4f')],'createdAt':_0x4d707e[_0x0350('0x51')],'updatedAt':_0x4d707e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x0350('0x16')](respondWithFilteredResult(_0x200ad2,_0x2dcf92))[_0x0350('0x2a')](handleError(_0x200ad2,null));};exports[_0x0350('0x55')]=function(_0x3de2c1,_0x44b31f){var _0x5e41b3={};var _0x147290={};var _0x213fc8;var _0x14fc34;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x3de2c1[_0x0350('0x2c')]['id']}})[_0x0350('0x16')](handleEntityNotFound(_0x44b31f,null))[_0x0350('0x16')](function(_0x12eb62){if(_0x12eb62){_0x213fc8=_0x12eb62;_0x147290[_0x0350('0x2d')]=_[_0x0350('0x2e')](db[_0x0350('0x56')][_0x0350('0x22')]);_0x147290[_0x0350('0x27')]=_[_0x0350('0x2e')](_0x3de2c1[_0x0350('0x27')]);_0x147290[_0x0350('0x2f')]=_[_0x0350('0x30')](_0x147290[_0x0350('0x2d')],_0x147290['query']);_0x5e41b3['attributes']=_[_0x0350('0x30')](_0x147290[_0x0350('0x2d')],qs[_0x0350('0x31')](_0x3de2c1[_0x0350('0x27')][_0x0350('0x31')]));_0x5e41b3['attributes']=_0x5e41b3['attributes']['length']?_0x5e41b3['attributes']:_0x147290[_0x0350('0x2d')];_0x5e41b3['order']=qs['sort'](_0x3de2c1[_0x0350('0x27')][_0x0350('0x57')]);_0x5e41b3[_0x0350('0x46')]=qs['filters'](_[_0x0350('0x47')](_0x3de2c1['query'],_0x147290[_0x0350('0x2f')]));if(_0x3de2c1[_0x0350('0x27')]['filter']){_0x5e41b3['where']=_['merge'](_0x5e41b3['where'],{'$or':_[_0x0350('0x20')](_0x5e41b3['attributes'],function(_0xfe1229){var _0xf0cbfb={};_0xf0cbfb[_0xfe1229]={'$like':'%'+_0x3de2c1[_0x0350('0x27')]['filter']+'%'};return _0xf0cbfb;})});}_0x5e41b3=_[_0x0350('0x35')]({},_0x5e41b3,_0x3de2c1['options']);return _0x213fc8[_0x0350('0x55')](_0x5e41b3);}})[_0x0350('0x16')](function(_0x5cc5bf){if(_0x5cc5bf){_0x14fc34=_0x5cc5bf[_0x0350('0x33')];if(!_0x3de2c1['query'][_0x0350('0x44')]('nolimit')){_0x5e41b3[_0x0350('0x10')]=qs[_0x0350('0x10')](_0x3de2c1[_0x0350('0x27')]['limit']);_0x5e41b3[_0x0350('0xe')]=qs[_0x0350('0xe')](_0x3de2c1['query'][_0x0350('0xe')]);}return _0x213fc8['getTeams'](_0x5e41b3);}})[_0x0350('0x16')](function(_0x27827e){if(_0x27827e){return _0x27827e?{'count':_0x14fc34,'rows':_0x27827e}:null;}})[_0x0350('0x16')](respondWithResult(_0x44b31f,null))[_0x0350('0x2a')](handleError(_0x44b31f,null));};exports['addTeams']=function(_0x20d104,_0xc51a51){var _0x3d89f5=_0x20d104[_0x0350('0x3f')][_0x0350('0x58')];return db['Team'][_0x0350('0x28')]({'where':{'id':_0x3d89f5},'attributes':['id'],'include':[{'model':db[_0x0350('0x4b')],'as':_0x0350('0x59'),'attributes':['id',_0x0350('0x1d'),_0x0350('0x5a'),_0x0350('0x5b'),'interface'],'raw':!![]}]})[_0x0350('0x16')](function(_0x549a1a){if(_0x549a1a){var _0x3b3f5f=_['flatMap'](_0x549a1a,function(_0x2910c){var _0x1d3ace=_0x2910c[_0x0350('0x39')]({'plain':!![]});return _0x1d3ace[_0x0350('0x59')];});return db[_0x0350('0x21')][_0x0350('0x36')]({'where':{'id':_0x20d104[_0x0350('0x2c')]['id']}})[_0x0350('0x16')](function(_0x95fe1d){return db[_0x0350('0x5c')][_0x0350('0x5d')](function(_0x46eadd){return _0x95fe1d['addTeams'](_0x3d89f5,{'transaction':_0x46eadd})[_0x0350('0x16')](function(){return BPromise[_0x0350('0x5e')](_0x3b3f5f,function(_0x57a02c){return db['UserOpenchannelQueue'][_0x0350('0x5f')]({'where':{'UserId':_0x57a02c['id'],'OpenchannelQueueId':_0x20d104[_0x0350('0x2c')]['id']},'transaction':_0x46eadd});});})[_0x0350('0x16')](function(){_0x3b3f5f[_0x0350('0x60')](function(_0x444949){socket[_0x0350('0x61')]('userOpenchannelQueue:save',{'UserId':_0x444949['id'],'OpenchannelQueueId':_0x95fe1d['id']});});});});});}})[_0x0350('0x16')](respondWithStatusCode(_0xc51a51,null))[_0x0350('0x2a')](handleError(_0xc51a51,null));};exports[_0x0350('0x62')]=function(_0x454035,_0x156a1b){return db[_0x0350('0x56')]['findAll']({'where':{'id':_0x454035[_0x0350('0x27')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0350('0x4b')],'as':_0x0350('0x59'),'attributes':['id'],'raw':!![]}]})[_0x0350('0x16')](handleEntityNotFound(_0x156a1b,null))[_0x0350('0x16')](function(_0x4682ac){var _0x35b928=_[_0x0350('0x20')](_0x4682ac,'id');var _0x21d300=[];var _0x4fe9d9=[];var _0x388123=squel[_0x0350('0x63')]();_0x388123[_0x0350('0x64')]('tq.TeamId')['from']('team_has_openchannel_queues','tq')[_0x0350('0x65')](_0x0350('0x66'),'ut',_0x0350('0x67'))[_0x0350('0x46')](_0x0350('0x68'),_0x454035[_0x0350('0x2c')]['id']);for(var _0xc8b8de=0x0;_0xc8b8de<_0x4682ac[_0x0350('0x33')];_0xc8b8de+=0x1){let _0x3e5664=_0x4682ac[_0xc8b8de];for(var _0x4ff023=0x0;_0x4ff023<_0x3e5664[_0x0350('0x59')][_0x0350('0x33')];_0x4ff023+=0x1){let _0x33bdea=_0x3e5664[_0x0350('0x59')][_0x4ff023];var _0xce4c44=_0x388123[_0x0350('0x69')]();_0xce4c44[_0x0350('0x46')](_0x0350('0x6a'),_0x33bdea['id']);_0x4fe9d9[_0x0350('0x6b')](db[_0x0350('0x5c')][_0x0350('0x27')](_0xce4c44[_0x0350('0x6c')](),{'type':db[_0x0350('0x5c')][_0x0350('0x6d')][_0x0350('0x6e')]})['then'](function(_0x4b67f0){if(_0x4b67f0[_0x0350('0x33')]===0x1){return _0x33bdea['id'];}else{var _0x59cbcc=_[_0x0350('0x6f')](_[_0x0350('0x20')](_0x4b67f0,_0x0350('0x70')),function(_0x528469){return _[_0x0350('0x71')](_0x35b928,_0x528469);});if(_0x59cbcc){return _0x33bdea['id'];}}}));}}return BPromise['all'](_0x4fe9d9)[_0x0350('0x16')](function(_0xef43bc){_0x21d300=_(_0x21d300)['union'](_0xef43bc)[_0x0350('0x72')]()[_0x0350('0x73')]();return db[_0x0350('0x21')][_0x0350('0x36')]({'where':{'id':_0x454035['params']['id']}})[_0x0350('0x16')](function(_0x36205a){return db[_0x0350('0x5c')][_0x0350('0x5d')](function(_0x35db55){return _0x36205a[_0x0350('0x62')](_0x454035[_0x0350('0x27')][_0x0350('0x58')],{'transaction':_0x35db55})[_0x0350('0x16')](function(){if(!_[_0x0350('0x74')](_0x21d300)){return _0x36205a[_0x0350('0x75')](_0x21d300,{'transaction':_0x35db55});}})[_0x0350('0x16')](function(){_0x21d300[_0x0350('0x60')](function(_0x366058){socket[_0x0350('0x61')](_0x0350('0x76'),{'UserId':_0x366058,'OpenchannelQueueId':_0x36205a['id']});});});});});});})[_0x0350('0x16')](respondWithStatusCode(_0x156a1b,null))[_0x0350('0x2a')](handleError(_0x156a1b,null));};exports[_0x0350('0x77')]=function(_0x2dc14d,_0x4554e9){return db['OpenchannelQueue'][_0x0350('0x36')]({'where':{'id':_0x2dc14d[_0x0350('0x2c')]['id']}})[_0x0350('0x16')](handleEntityNotFound(_0x4554e9,null))['then'](function(_0x3c6314){if(_0x3c6314){return _0x3c6314['addAgents'](_0x2dc14d[_0x0350('0x3f')][_0x0350('0x58')],_[_0x0350('0x78')](_0x2dc14d[_0x0350('0x3f')],[_0x0350('0x58'),'id'])||{})[_0x0350('0x79')](function(_0x1484a3){for(var _0x4c4a45=0x0;_0x4c4a45<_0x2dc14d[_0x0350('0x3f')][_0x0350('0x58')]['length'];_0x4c4a45+=0x1){socket[_0x0350('0x61')]('userOpenchannelQueue:save',{'UserId':Number(_0x2dc14d[_0x0350('0x3f')][_0x0350('0x58')][_0x4c4a45]),'OpenchannelQueueId':Number(_0x2dc14d['params']['id'])});}return _0x1484a3;});}})['then'](respondWithResult(_0x4554e9,null))[_0x0350('0x2a')](handleError(_0x4554e9,null));};exports['removeAgents']=function(_0x1932ae,_0x12f31b){return db[_0x0350('0x21')][_0x0350('0x36')]({'where':{'id':_0x1932ae['params']['id']}})['then'](handleEntityNotFound(_0x12f31b,null))[_0x0350('0x16')](function(_0x58e3b5){if(_0x58e3b5){return _0x58e3b5[_0x0350('0x75')](_0x1932ae[_0x0350('0x27')][_0x0350('0x58')])['then'](function(){if(_[_0x0350('0x7a')](_0x1932ae[_0x0350('0x27')][_0x0350('0x58')])){for(var _0x2db5f6=0x0;_0x2db5f6<_0x1932ae['query'][_0x0350('0x58')][_0x0350('0x33')];_0x2db5f6+=0x1){socket[_0x0350('0x61')](_0x0350('0x76'),{'UserId':Number(_0x1932ae[_0x0350('0x27')][_0x0350('0x58')][_0x2db5f6]),'OpenchannelQueueId':Number(_0x1932ae['params']['id'])});}}else{socket[_0x0350('0x61')](_0x0350('0x76'),{'UserId':Number(_0x1932ae['query'][_0x0350('0x58')]),'OpenchannelQueueId':Number(_0x1932ae[_0x0350('0x2c')]['id'])});}});}})[_0x0350('0x16')](respondWithStatusCode(_0x12f31b,null))[_0x0350('0x2a')](handleError(_0x12f31b,null));};exports[_0x0350('0x7b')]=function(_0x1d27ab,_0x5e918b){var _0x4a2d21={};var _0x42e4a7={};var _0x106bd1;var _0x1663c9;return db[_0x0350('0x21')]['findOne']({'where':{'id':_0x1d27ab[_0x0350('0x2c')]['id']}})[_0x0350('0x16')](handleEntityNotFound(_0x5e918b,null))[_0x0350('0x16')](function(_0x96218d){if(_0x96218d){_0x106bd1=_0x96218d;_0x42e4a7[_0x0350('0x2d')]=_[_0x0350('0x2e')](db['User'][_0x0350('0x22')]);_0x42e4a7['query']=_[_0x0350('0x2e')](_0x1d27ab[_0x0350('0x27')]);_0x42e4a7['filters']=_['intersection'](_0x42e4a7[_0x0350('0x2d')],_0x42e4a7[_0x0350('0x27')]);_0x4a2d21[_0x0350('0x32')]=_[_0x0350('0x30')](_0x42e4a7[_0x0350('0x2d')],qs[_0x0350('0x31')](_0x1d27ab[_0x0350('0x27')][_0x0350('0x31')]));_0x4a2d21[_0x0350('0x32')]=_0x4a2d21[_0x0350('0x32')][_0x0350('0x33')]?_0x4a2d21[_0x0350('0x32')]:_0x42e4a7[_0x0350('0x2d')];_0x4a2d21[_0x0350('0x45')]=qs[_0x0350('0x57')](_0x1d27ab['query'][_0x0350('0x57')]);_0x4a2d21[_0x0350('0x46')]=qs[_0x0350('0x2f')](_[_0x0350('0x47')](_0x1d27ab[_0x0350('0x27')],_0x42e4a7[_0x0350('0x2f')]));if(_0x1d27ab[_0x0350('0x27')][_0x0350('0x49')]){_0x4a2d21['where']=_['merge'](_0x4a2d21[_0x0350('0x46')],{'$or':_[_0x0350('0x20')](_0x4a2d21[_0x0350('0x32')],function(_0x339da4){var _0x1e5248={};_0x1e5248[_0x339da4]={'$like':'%'+_0x1d27ab[_0x0350('0x27')][_0x0350('0x49')]+'%'};return _0x1e5248;})});}_0x4a2d21=_[_0x0350('0x35')]({},_0x4a2d21,_0x1d27ab[_0x0350('0x4a')]);return _0x106bd1['getAgents'](_0x4a2d21);}})['then'](function(_0x58245e){if(_0x58245e){_0x1663c9=_0x58245e['length'];if(!_0x1d27ab[_0x0350('0x27')]['hasOwnProperty'](_0x0350('0x7c'))){_0x4a2d21['limit']=qs[_0x0350('0x10')](_0x1d27ab[_0x0350('0x27')][_0x0350('0x10')]);_0x4a2d21[_0x0350('0xe')]=qs[_0x0350('0xe')](_0x1d27ab['query'][_0x0350('0xe')]);}return _0x106bd1['getAgents'](_0x4a2d21);}})[_0x0350('0x16')](function(_0x1de587){if(_0x1de587){return _0x1de587?{'count':_0x1663c9,'rows':_0x1de587}:null;}})[_0x0350('0x16')](respondWithResult(_0x5e918b,null))[_0x0350('0x2a')](handleError(_0x5e918b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index a30fd19..962c4a9 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 _0x1a99=['hasOwnProperty','hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit'];(function(_0x56c358,_0x3c0712){var _0x4b0030=function(_0x54dd66){while(--_0x54dd66){_0x56c358['push'](_0x56c358['shift']());}};_0x4b0030(++_0x3c0712);}(_0x1a99,0x98));var _0x91a9=function(_0x153738,_0xe704c1){_0x153738=_0x153738-0x0;var _0x3028d9=_0x1a99[_0x153738];return _0x3028d9;};'use strict';var EventEmitter=require(_0x91a9('0x0'));var OpenchannelQueue=require(_0x91a9('0x1'))['db'][_0x91a9('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x91a9('0x3')](0x0);var events={'afterCreate':_0x91a9('0x4'),'afterUpdate':_0x91a9('0x5'),'afterDestroy':_0x91a9('0x6')};function emitEvent(_0x1f4645){return function(_0x53de9c,_0x200d60,_0x7ea080){OpenchannelQueueEvents['emit'](_0x1f4645+':'+_0x53de9c['id'],_0x53de9c);OpenchannelQueueEvents[_0x91a9('0x7')](_0x1f4645,_0x53de9c);_0x7ea080(null);};}for(var e in events){if(events[_0x91a9('0x8')](e)){var event=events[e];OpenchannelQueue[_0x91a9('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0xb69f=['exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0xe03532,_0x1532c2){var _0x48e7d1=function(_0x1fc718){while(--_0x1fc718){_0xe03532['push'](_0xe03532['shift']());}};_0x48e7d1(++_0x1532c2);}(_0xb69f,0x105));var _0xfb69=function(_0x36abd5,_0x403f60){_0x36abd5=_0x36abd5-0x0;var _0x4cab15=_0xb69f[_0x36abd5];return _0x4cab15;};'use strict';var EventEmitter=require(_0xfb69('0x0'));var OpenchannelQueue=require(_0xfb69('0x1'))['db'][_0xfb69('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xfb69('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfb69('0x4'),'afterDestroy':_0xfb69('0x5')};function emitEvent(_0x1d5bae){return function(_0x41696c,_0x426388,_0x5b4eb5){OpenchannelQueueEvents[_0xfb69('0x6')](_0x1d5bae+':'+_0x41696c['id'],_0x41696c);OpenchannelQueueEvents[_0xfb69('0x6')](_0x1d5bae,_0x41696c);_0x5b4eb5(null);};}for(var e in events){if(events[_0xfb69('0x7')](e)){var event=events[e];OpenchannelQueue[_0xfb69('0x8')](e,emitEvent(event));}}module[_0xfb69('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 53e33a2..6595bdf 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 _0xb64f=['../../config/logger','api','moment','bluebird','request-promise','path','./openchannelQueue.attributes','exports','OpenchannelQueue','lodash'];(function(_0x3b3362,_0x202631){var _0x223f5b=function(_0x21a21d){while(--_0x21a21d){_0x3b3362['push'](_0x3b3362['shift']());}};_0x223f5b(++_0x202631);}(_0xb64f,0x1b7));var _0xfb64=function(_0x5e3a45,_0x45f0c5){_0x5e3a45=_0x5e3a45-0x0;var _0x13419f=_0xb64f[_0x5e3a45];return _0x13419f;};'use strict';var _=require(_0xfb64('0x0'));var util=require('util');var logger=require(_0xfb64('0x1'))(_0xfb64('0x2'));var moment=require(_0xfb64('0x3'));var BPromise=require(_0xfb64('0x4'));var rp=require(_0xfb64('0x5'));var fs=require('fs');var path=require(_0xfb64('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfb64('0x7'));module[_0xfb64('0x8')]=function(_0x1aa76f,_0x340e46){return _0x1aa76f['define'](_0xfb64('0x9'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7289=['lodash','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','define','openchannel_queues'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7289,0x17c));var _0x9728=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x7289[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x9728('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9728('0x1'));var moment=require(_0x9728('0x2'));var BPromise=require('bluebird');var rp=require(_0x9728('0x3'));var fs=require('fs');var path=require(_0x9728('0x4'));var rimraf=require(_0x9728('0x5'));var config=require(_0x9728('0x6'));var attributes=require(_0x9728('0x7'));module['exports']=function(_0x296b84,_0x57f6c0){return _0x296b84[_0x9728('0x8')]('OpenchannelQueue',attributes,{'tableName':_0x9728('0x9'),'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 831e841..139fe36 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 _0x6d4d=['OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','OpenchannelQueue','findAll','options','where','limit','include','map','model','attributes','then','GetOpenchannelQueue','debug','stringify','find','raw','ShowOpenchannelQueue','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','request'];(function(_0x5a4c60,_0x5a4a28){var _0xbc97b4=function(_0x928577){while(--_0x928577){_0x5a4c60['push'](_0x5a4c60['shift']());}};_0xbc97b4(++_0x5a4a28);}(_0x6d4d,0x16e));var _0xd6d4=function(_0x16e0c8,_0x4861eb){_0x16e0c8=_0x16e0c8-0x0;var _0xe4b5af=_0x6d4d[_0x16e0c8];return _0xe4b5af;};'use strict';var _=require('lodash');var util=require(_0xd6d4('0x0'));var moment=require(_0xd6d4('0x1'));var BPromise=require('bluebird');var rs=require(_0xd6d4('0x2'));var fs=require('fs');var Redis=require(_0xd6d4('0x3'));var db=require(_0xd6d4('0x4'))['db'];var utils=require(_0xd6d4('0x5'));var logger=require(_0xd6d4('0x6'))(_0xd6d4('0x7'));var config=require(_0xd6d4('0x8'));var jayson=require(_0xd6d4('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xd6d4('0xa')]=_[_0xd6d4('0xb')](config[_0xd6d4('0xa')],{'host':_0xd6d4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd6d4('0xa')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x3fd830,_0x48f3ea,_0x44ba51){return new BPromise(function(_0x423faa,_0x12f90a){return client[_0xd6d4('0xd')](_0x3fd830,_0x44ba51)['then'](function(_0x2b5ad6){logger['info'](_0xd6d4('0xe'),_0x48f3ea,_0xd6d4('0xf'));logger['debug'](_0xd6d4('0x10'),_0x48f3ea,_0xd6d4('0xf'),JSON['stringify'](_0x2b5ad6));if(_0x2b5ad6[_0xd6d4('0x11')]){if(_0x2b5ad6['error']['code']===0x1f4){logger[_0xd6d4('0x11')](_0xd6d4('0xe'),_0x48f3ea,_0x2b5ad6['error'][_0xd6d4('0x12')]);return _0x12f90a(_0x2b5ad6[_0xd6d4('0x11')][_0xd6d4('0x12')]);}logger[_0xd6d4('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x48f3ea,_0x2b5ad6['error']['message']);return _0x423faa(_0x2b5ad6[_0xd6d4('0x11')][_0xd6d4('0x12')]);}else{logger[_0xd6d4('0x13')](_0xd6d4('0xe'),_0x48f3ea,_0xd6d4('0xf'));_0x423faa(_0x2b5ad6[_0xd6d4('0x14')][_0xd6d4('0x12')]);}})[_0xd6d4('0x15')](function(_0x5e7a64){logger[_0xd6d4('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x48f3ea,_0x5e7a64);_0x12f90a(_0x5e7a64);});});}exports['GetOpenchannelQueue']=function(_0x45d513){var _0x3be668=this;return new Promise(function(_0x1fc5dd,_0x22f2e6){return db[_0xd6d4('0x16')][_0xd6d4('0x17')]({'raw':_0x45d513[_0xd6d4('0x18')]?_0x45d513[_0xd6d4('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x45d513[_0xd6d4('0x18')]?_0x45d513['options'][_0xd6d4('0x19')]||null:null,'attributes':_0x45d513[_0xd6d4('0x18')]?_0x45d513[_0xd6d4('0x18')]['attributes']||null:null,'limit':_0x45d513[_0xd6d4('0x18')]?_0x45d513[_0xd6d4('0x18')][_0xd6d4('0x1a')]||null:null,'include':_0x45d513['options']?_0x45d513[_0xd6d4('0x18')][_0xd6d4('0x1b')]?_[_0xd6d4('0x1c')](_0x45d513[_0xd6d4('0x18')][_0xd6d4('0x1b')],function(_0x4d5013){return{'model':db[_0x4d5013[_0xd6d4('0x1d')]],'as':_0x4d5013['as'],'attributes':_0x4d5013[_0xd6d4('0x1e')],'include':_0x4d5013[_0xd6d4('0x1b')]?_['map'](_0x4d5013[_0xd6d4('0x1b')],function(_0x5d169f){return{'model':db[_0x5d169f[_0xd6d4('0x1d')]],'as':_0x5d169f['as'],'attributes':_0x5d169f[_0xd6d4('0x1e')],'include':_0x5d169f[_0xd6d4('0x1b')]?_['map'](_0x5d169f['include'],function(_0x257f1e){return{'model':db[_0x257f1e[_0xd6d4('0x1d')]],'as':_0x257f1e['as'],'attributes':_0x257f1e[_0xd6d4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd6d4('0x1f')](function(_0x49e828){logger[_0xd6d4('0x13')](_0xd6d4('0x20'),_0x45d513);logger[_0xd6d4('0x21')]('GetOpenchannelQueue',_0x45d513,JSON[_0xd6d4('0x22')](_0x49e828));_0x1fc5dd(_0x49e828);})[_0xd6d4('0x15')](function(_0x124575){logger['error']('GetOpenchannelQueue',_0x124575['message'],_0x45d513);_0x22f2e6(_0x3be668[_0xd6d4('0x11')](0x1f4,_0x124575[_0xd6d4('0x12')]));});});};exports['ShowOpenchannelQueue']=function(_0x175f5a){var _0x6eff45=this;return new Promise(function(_0xb7f806,_0x67dd30){return db['OpenchannelQueue'][_0xd6d4('0x23')]({'raw':_0x175f5a[_0xd6d4('0x18')]?_0x175f5a[_0xd6d4('0x18')][_0xd6d4('0x24')]===undefined?!![]:![]:!![],'where':_0x175f5a[_0xd6d4('0x18')]?_0x175f5a[_0xd6d4('0x18')][_0xd6d4('0x19')]||null:null,'attributes':_0x175f5a['options']?_0x175f5a['options'][_0xd6d4('0x1e')]||null:null,'include':_0x175f5a[_0xd6d4('0x18')]?_0x175f5a[_0xd6d4('0x18')][_0xd6d4('0x1b')]?_[_0xd6d4('0x1c')](_0x175f5a[_0xd6d4('0x18')][_0xd6d4('0x1b')],function(_0x57f14a){return{'model':db[_0x57f14a['model']],'as':_0x57f14a['as'],'attributes':_0x57f14a['attributes'],'include':_0x57f14a[_0xd6d4('0x1b')]?_['map'](_0x57f14a[_0xd6d4('0x1b')],function(_0x36d902){return{'model':db[_0x36d902[_0xd6d4('0x1d')]],'as':_0x36d902['as'],'attributes':_0x36d902[_0xd6d4('0x1e')],'include':_0x36d902['include']?_[_0xd6d4('0x1c')](_0x36d902['include'],function(_0x24d61d){return{'model':db[_0x24d61d[_0xd6d4('0x1d')]],'as':_0x24d61d['as'],'attributes':_0x24d61d[_0xd6d4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd6d4('0x1f')](function(_0x2bb048){logger['info']('ShowOpenchannelQueue',_0x175f5a);logger[_0xd6d4('0x21')](_0xd6d4('0x25'),_0x175f5a,JSON[_0xd6d4('0x22')](_0x2bb048));_0xb7f806(_0x2bb048);})[_0xd6d4('0x15')](function(_0x31c421){logger[_0xd6d4('0x11')]('ShowOpenchannelQueue',_0x31c421[_0xd6d4('0x12')],_0x175f5a);_0x67dd30(_0x6eff45[_0xd6d4('0x11')](0x1f4,_0x31c421[_0xd6d4('0x12')]));});});}; \ No newline at end of file +var _0xfebc=['redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','OpenchannelQueue','options','raw','where','limit','include','map','model','attributes','info','GetOpenchannelQueue','ShowOpenchannelQueue','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x34bfd8,_0x24eaa3){var _0x122c91=function(_0x17081a){while(--_0x17081a){_0x34bfd8['push'](_0x34bfd8['shift']());}};_0x122c91(++_0x24eaa3);}(_0xfebc,0x136));var _0xcfeb=function(_0x57aa39,_0x5b7dd9){_0x57aa39=_0x57aa39-0x0;var _0x1d9f2e=_0xfebc[_0x57aa39];return _0x1d9f2e;};'use strict';var _=require('lodash');var util=require(_0xcfeb('0x0'));var moment=require('moment');var BPromise=require(_0xcfeb('0x1'));var rs=require(_0xcfeb('0x2'));var fs=require('fs');var Redis=require(_0xcfeb('0x3'));var db=require(_0xcfeb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcfeb('0x5'))(_0xcfeb('0x6'));var config=require(_0xcfeb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcfeb('0x8')][_0xcfeb('0x9')]({'port':0x232a});config[_0xcfeb('0xa')]=_[_0xcfeb('0xb')](config['redis'],{'host':_0xcfeb('0xc'),'port':0x18eb});var socket=require(_0xcfeb('0xd'))(new Redis(config[_0xcfeb('0xa')]));require(_0xcfeb('0xe'))['register'](socket);function respondWithRpcPromise(_0x1d906c,_0x4ca7ef,_0x561222){return new BPromise(function(_0x4fd4e7,_0x5553e4){return client[_0xcfeb('0xf')](_0x1d906c,_0x561222)[_0xcfeb('0x10')](function(_0x11359c){logger['info'](_0xcfeb('0x11'),_0x4ca7ef,'request\x20sent');logger[_0xcfeb('0x12')](_0xcfeb('0x13'),_0x4ca7ef,_0xcfeb('0x14'),JSON[_0xcfeb('0x15')](_0x11359c));if(_0x11359c[_0xcfeb('0x16')]){if(_0x11359c['error'][_0xcfeb('0x17')]===0x1f4){logger[_0xcfeb('0x16')](_0xcfeb('0x11'),_0x4ca7ef,_0x11359c['error'][_0xcfeb('0x18')]);return _0x5553e4(_0x11359c[_0xcfeb('0x16')]['message']);}logger['error'](_0xcfeb('0x11'),_0x4ca7ef,_0x11359c[_0xcfeb('0x16')][_0xcfeb('0x18')]);return _0x4fd4e7(_0x11359c[_0xcfeb('0x16')][_0xcfeb('0x18')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x4ca7ef,'request\x20sent');_0x4fd4e7(_0x11359c[_0xcfeb('0x19')][_0xcfeb('0x18')]);}})[_0xcfeb('0x1a')](function(_0x3698b7){logger[_0xcfeb('0x16')](_0xcfeb('0x11'),_0x4ca7ef,_0x3698b7);_0x5553e4(_0x3698b7);});});}exports['GetOpenchannelQueue']=function(_0x2b76fc){var _0x20030b=this;return new Promise(function(_0x2e2273,_0x12ea8b){return db[_0xcfeb('0x1b')]['findAll']({'raw':_0x2b76fc['options']?_0x2b76fc[_0xcfeb('0x1c')][_0xcfeb('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b76fc['options']?_0x2b76fc['options'][_0xcfeb('0x1e')]||null:null,'attributes':_0x2b76fc['options']?_0x2b76fc[_0xcfeb('0x1c')]['attributes']||null:null,'limit':_0x2b76fc[_0xcfeb('0x1c')]?_0x2b76fc[_0xcfeb('0x1c')][_0xcfeb('0x1f')]||null:null,'include':_0x2b76fc[_0xcfeb('0x1c')]?_0x2b76fc[_0xcfeb('0x1c')][_0xcfeb('0x20')]?_[_0xcfeb('0x21')](_0x2b76fc[_0xcfeb('0x1c')][_0xcfeb('0x20')],function(_0x34f82a){return{'model':db[_0x34f82a[_0xcfeb('0x22')]],'as':_0x34f82a['as'],'attributes':_0x34f82a['attributes'],'include':_0x34f82a[_0xcfeb('0x20')]?_[_0xcfeb('0x21')](_0x34f82a['include'],function(_0x2cb69e){return{'model':db[_0x2cb69e['model']],'as':_0x2cb69e['as'],'attributes':_0x2cb69e['attributes'],'include':_0x2cb69e[_0xcfeb('0x20')]?_[_0xcfeb('0x21')](_0x2cb69e[_0xcfeb('0x20')],function(_0x58a1a0){return{'model':db[_0x58a1a0['model']],'as':_0x58a1a0['as'],'attributes':_0x58a1a0[_0xcfeb('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52be27){logger[_0xcfeb('0x24')](_0xcfeb('0x25'),_0x2b76fc);logger[_0xcfeb('0x12')](_0xcfeb('0x25'),_0x2b76fc,JSON[_0xcfeb('0x15')](_0x52be27));_0x2e2273(_0x52be27);})[_0xcfeb('0x1a')](function(_0x5a9eb0){logger[_0xcfeb('0x16')](_0xcfeb('0x25'),_0x5a9eb0['message'],_0x2b76fc);_0x12ea8b(_0x20030b['error'](0x1f4,_0x5a9eb0[_0xcfeb('0x18')]));});});};exports[_0xcfeb('0x26')]=function(_0x4538df){var _0x35bf87=this;return new Promise(function(_0x2b419c,_0x3a8c7c){return db[_0xcfeb('0x1b')][_0xcfeb('0x27')]({'raw':_0x4538df[_0xcfeb('0x1c')]?_0x4538df[_0xcfeb('0x1c')][_0xcfeb('0x1d')]===undefined?!![]:![]:!![],'where':_0x4538df[_0xcfeb('0x1c')]?_0x4538df['options'][_0xcfeb('0x1e')]||null:null,'attributes':_0x4538df[_0xcfeb('0x1c')]?_0x4538df['options'][_0xcfeb('0x23')]||null:null,'include':_0x4538df[_0xcfeb('0x1c')]?_0x4538df['options'][_0xcfeb('0x20')]?_['map'](_0x4538df[_0xcfeb('0x1c')][_0xcfeb('0x20')],function(_0x3835dc){return{'model':db[_0x3835dc[_0xcfeb('0x22')]],'as':_0x3835dc['as'],'attributes':_0x3835dc[_0xcfeb('0x23')],'include':_0x3835dc[_0xcfeb('0x20')]?_[_0xcfeb('0x21')](_0x3835dc[_0xcfeb('0x20')],function(_0x206454){return{'model':db[_0x206454['model']],'as':_0x206454['as'],'attributes':_0x206454[_0xcfeb('0x23')],'include':_0x206454['include']?_['map'](_0x206454[_0xcfeb('0x20')],function(_0x3ea93f){return{'model':db[_0x3ea93f[_0xcfeb('0x22')]],'as':_0x3ea93f['as'],'attributes':_0x3ea93f[_0xcfeb('0x23')]};}):[]};}):[]};}):[]:[]})[_0xcfeb('0x10')](function(_0x181278){logger['info'](_0xcfeb('0x26'),_0x4538df);logger['debug']('ShowOpenchannelQueue',_0x4538df,JSON[_0xcfeb('0x15')](_0x181278));_0x2b419c(_0x181278);})[_0xcfeb('0x1a')](function(_0x4797fc){logger[_0xcfeb('0x16')](_0xcfeb('0x26'),_0x4797fc[_0xcfeb('0x18')],_0x4538df);_0x3a8c7c(_0x35bf87[_0xcfeb('0x16')](0x1f4,_0x4797fc['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index b6ee1f7..8e3ad17 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 _0x4fd0=['openchannelQueue:','update','removeListener','length'];(function(_0x20a310,_0x5e32b7){var _0x10ae7b=function(_0x57b81f){while(--_0x57b81f){_0x20a310['push'](_0x20a310['shift']());}};_0x10ae7b(++_0x5e32b7);}(_0x4fd0,0x1f1));var _0x04fd=function(_0x4b6a01,_0x386039){_0x4b6a01=_0x4b6a01-0x0;var _0xc374a3=_0x4fd0[_0x4b6a01];return _0xc374a3;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save','remove',_0x04fd('0x0')];function createListener(_0x56871b,_0xd72991){return function(_0x36f6cb){_0xd72991['emit'](_0x56871b,_0x36f6cb);};}function removeListener(_0x33c417,_0x27096a){return function(){OpenchannelQueueEvents[_0x04fd('0x1')](_0x33c417,_0x27096a);};}exports['register']=function(_0x516f33){for(var _0x7f8f7d=0x0,_0x5bc61c=events[_0x04fd('0x2')];_0x7f8f7d<_0x5bc61c;_0x7f8f7d++){var _0x44bdf6=events[_0x7f8f7d];var _0x3be3c2=createListener(_0x04fd('0x3')+_0x44bdf6,_0x516f33);OpenchannelQueueEvents['on'](_0x44bdf6,_0x3be3c2);}}; \ No newline at end of file +var _0x5a92=['openchannelQueue:','save','remove','update','removeListener','register'];(function(_0x1f27df,_0x4f1a64){var _0x286ee2=function(_0x255ea7){while(--_0x255ea7){_0x1f27df['push'](_0x1f27df['shift']());}};_0x286ee2(++_0x4f1a64);}(_0x5a92,0xfd));var _0x25a9=function(_0xb31d86,_0x331de0){_0xb31d86=_0xb31d86-0x0;var _0x5b989e=_0x5a92[_0xb31d86];return _0x5b989e;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x25a9('0x0'),_0x25a9('0x1'),_0x25a9('0x2')];function createListener(_0x44bf22,_0xd5e0a2){return function(_0x250aad){_0xd5e0a2['emit'](_0x44bf22,_0x250aad);};}function removeListener(_0x231dae,_0x2b7a4e){return function(){OpenchannelQueueEvents[_0x25a9('0x3')](_0x231dae,_0x2b7a4e);};}exports[_0x25a9('0x4')]=function(_0x2956d9){for(var _0x1b9a84=0x0,_0x4eefdc=events['length'];_0x1b9a84<_0x4eefdc;_0x1b9a84++){var _0x41e066=events[_0x1b9a84];var _0x2a1dd8=createListener(_0x25a9('0x5')+_0x41e066,_0x2956d9);OpenchannelQueueEvents['on'](_0x41e066,_0x2a1dd8);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index b895551..12f5f48 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 _0xe3a2=['index','describe','/:id','show','post','put','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xe3a2,0x106));var _0x2e3a=function(_0x5bc680,_0x2d59f6){_0x5bc680=_0x5bc680-0x0;var _0x98254f=_0xe3a2[_0x5bc680];return _0x98254f;};'use strict';var multer=require('multer');var util=require(_0x2e3a('0x0'));var path=require(_0x2e3a('0x1'));var timeout=require(_0x2e3a('0x2'));var express=require(_0x2e3a('0x3'));var router=express['Router']();var fs_extra=require(_0x2e3a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2e3a('0x5'));var controller=require('./openchannelQueueReport.controller');router[_0x2e3a('0x6')]('/',auth[_0x2e3a('0x7')](),controller[_0x2e3a('0x8')]);router[_0x2e3a('0x6')]('/describe',auth[_0x2e3a('0x7')](),controller[_0x2e3a('0x9')]);router['get'](_0x2e3a('0xa'),auth[_0x2e3a('0x7')](),controller[_0x2e3a('0xb')]);router[_0x2e3a('0xc')]('/',auth[_0x2e3a('0x7')](),controller['create']);router[_0x2e3a('0xd')](_0x2e3a('0xa'),auth[_0x2e3a('0x7')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2e3a('0xe')]=router; \ No newline at end of file +var _0x4c67=['destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete'];(function(_0x5d5799,_0x3a5e06){var _0x3af61b=function(_0x2f02e3){while(--_0x2f02e3){_0x5d5799['push'](_0x5d5799['shift']());}};_0x3af61b(++_0x3a5e06);}(_0x4c67,0x86));var _0x74c6=function(_0x168037,_0x478d01){_0x168037=_0x168037-0x0;var _0x2e3e0e=_0x4c67[_0x168037];return _0x2e3e0e;};'use strict';var multer=require(_0x74c6('0x0'));var util=require('util');var path=require(_0x74c6('0x1'));var timeout=require(_0x74c6('0x2'));var express=require(_0x74c6('0x3'));var router=express['Router']();var fs_extra=require(_0x74c6('0x4'));var auth=require(_0x74c6('0x5'));var interaction=require(_0x74c6('0x6'));var config=require(_0x74c6('0x7'));var controller=require(_0x74c6('0x8'));router[_0x74c6('0x9')]('/',auth[_0x74c6('0xa')](),controller[_0x74c6('0xb')]);router[_0x74c6('0x9')](_0x74c6('0xc'),auth[_0x74c6('0xa')](),controller[_0x74c6('0xd')]);router[_0x74c6('0x9')](_0x74c6('0xe'),auth[_0x74c6('0xa')](),controller[_0x74c6('0xf')]);router['post']('/',auth[_0x74c6('0xa')](),controller[_0x74c6('0x10')]);router[_0x74c6('0x11')]('/:id',auth[_0x74c6('0xa')](),controller[_0x74c6('0x12')]);router[_0x74c6('0x13')](_0x74c6('0xe'),auth['isAuthenticated'](),controller[_0x74c6('0x14')]);module[_0x74c6('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 3878dbd..c8fe4e6 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 _0xf7ed=['DATE','sequelize','exports','STRING'];(function(_0xc575b1,_0x3f55d3){var _0x2779f0=function(_0x44e7da){while(--_0x44e7da){_0xc575b1['push'](_0xc575b1['shift']());}};_0x2779f0(++_0x3f55d3);}(_0xf7ed,0x1a1));var _0xdf7e=function(_0x5b474c,_0x426d87){_0x5b474c=_0x5b474c-0x0;var _0x273b2c=_0xf7ed[_0x5b474c];return _0x273b2c;};'use strict';var moment=require('moment');var Sequelize=require(_0xdf7e('0x0'));module[_0xdf7e('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xdf7e('0x2')]},'joinAt':{'type':Sequelize[_0xdf7e('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xdf7e('0x3')]},'exitAt':{'type':Sequelize[_0xdf7e('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x08ab=['DATE','moment','sequelize','exports','STRING'];(function(_0x535a63,_0x28ffd0){var _0x56e7a7=function(_0x3fd738){while(--_0x3fd738){_0x535a63['push'](_0x535a63['shift']());}};_0x56e7a7(++_0x28ffd0);}(_0x08ab,0x173));var _0xb08a=function(_0x36b8ee,_0x530b84){_0x36b8ee=_0x36b8ee-0x0;var _0x54223f=_0x08ab[_0x36b8ee];return _0x54223f;};'use strict';var moment=require(_0xb08a('0x0'));var Sequelize=require(_0xb08a('0x1'));module[_0xb08a('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb08a('0x3')]},'joinAt':{'type':Sequelize[_0xb08a('0x4')]},'leaveAt':{'type':Sequelize[_0xb08a('0x4')]},'acceptAt':{'type':Sequelize[_0xb08a('0x4')]},'exitAt':{'type':Sequelize[_0xb08a('0x4')]},'reason':{'type':Sequelize[_0xb08a('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index d533c1b..38368b6 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 _0x6967=['rows','catch','params','rawAttributes','include','options','find','create','body','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','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','json','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','OpenchannelQueueReport','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','offset','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x6967,0x99));var _0x7696=function(_0x518365,_0x1eb1a3){_0x518365=_0x518365-0x0;var _0x1d904b=_0x6967[_0x518365];return _0x1d904b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7696('0x0'));var zipdir=require(_0x7696('0x1'));var jsonpatch=require(_0x7696('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7696('0x3'));var Mustache=require(_0x7696('0x4'));var util=require('util');var path=require(_0x7696('0x5'));var sox=require(_0x7696('0x6'));var csv=require(_0x7696('0x7'));var ejs=require(_0x7696('0x8'));var fs=require('fs');var fs_extra=require(_0x7696('0x9'));var _=require('lodash');var squel=require(_0x7696('0xa'));var crypto=require(_0x7696('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7696('0xc'));var Papa=require(_0x7696('0xd'));var Redis=require(_0x7696('0xe'));var authService=require(_0x7696('0xf'));var qs=require(_0x7696('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7696('0x11'));var logger=require(_0x7696('0x12'))('api');var utils=require(_0x7696('0x13'));var config=require(_0x7696('0x14'));var licenseUtil=require(_0x7696('0x15'));var db=require(_0x7696('0x16'))['db'];function respondWithStatusCode(_0x3d81cb,_0x425427){_0x425427=_0x425427||0xcc;return function(_0x5509e5){if(_0x5509e5){return _0x3d81cb[_0x7696('0x17')](_0x425427);}return _0x3d81cb[_0x7696('0x18')](_0x425427)[_0x7696('0x19')]();};}function respondWithResult(_0x3850bd,_0x277f1f){_0x277f1f=_0x277f1f||0xc8;return function(_0x57f642){if(_0x57f642){return _0x3850bd[_0x7696('0x18')](_0x277f1f)[_0x7696('0x1a')](_0x57f642);}};}function respondWithFilteredResult(_0x5f10cd,_0x2c745d){return function(_0x5f3ac3){if(_0x5f3ac3){var _0x2b7447=typeof _0x2c745d['offset']===_0x7696('0x1b')&&typeof _0x2c745d[_0x7696('0x1c')]==='undefined';var _0x2c7ec1=_0x5f3ac3['count'];var _0x41ad83=_0x2b7447?0x0:_0x2c745d['offset'];var _0x39d47e=_0x2b7447?_0x5f3ac3[_0x7696('0x1d')]:_0x2c745d['offset']+_0x2c745d[_0x7696('0x1c')];var _0x24d93f;if(_0x39d47e>=_0x2c7ec1){_0x39d47e=_0x2c7ec1;_0x24d93f=0xc8;}else{_0x24d93f=0xce;}_0x5f10cd[_0x7696('0x18')](_0x24d93f);return _0x5f10cd['set'](_0x7696('0x1e'),_0x41ad83+'-'+_0x39d47e+'/'+_0x2c7ec1)['json'](_0x5f3ac3);}return null;};}function patchUpdates(_0x22f578){return function(_0x243a33){try{jsonpatch[_0x7696('0x1f')](_0x243a33,_0x22f578,!![]);}catch(_0x85fbba){return BPromise[_0x7696('0x20')](_0x85fbba);}return _0x243a33[_0x7696('0x21')]();};}function saveUpdates(_0x36e3e2,_0x2f8dab){return function(_0x13512e){if(_0x13512e){return _0x13512e[_0x7696('0x22')](_0x36e3e2)[_0x7696('0x23')](function(_0x8e21cc){return _0x8e21cc;});}return null;};}function removeEntity(_0x46487f,_0x5ead0f){return function(_0x5c5069){if(_0x5c5069){return _0x5c5069[_0x7696('0x24')]()[_0x7696('0x23')](function(){_0x46487f[_0x7696('0x18')](0xcc)[_0x7696('0x19')]();});}};}function handleEntityNotFound(_0x54a582,_0x281f03){return function(_0x152e92){if(!_0x152e92){_0x54a582[_0x7696('0x17')](0x194);}return _0x152e92;};}function handleError(_0x404699,_0x5224b2){_0x5224b2=_0x5224b2||0x1f4;return function(_0x415b41){logger['error'](_0x415b41[_0x7696('0x25')]);if(_0x415b41[_0x7696('0x26')]){delete _0x415b41[_0x7696('0x26')];}_0x404699[_0x7696('0x18')](_0x5224b2)[_0x7696('0x27')](_0x415b41);};}exports[_0x7696('0x28')]=function(_0x4c7b8a,_0x1b3fa6){var _0x12eccd={},_0x45f52b={},_0x5ceec5={'count':0x0,'rows':[]};var _0x675238=_[_0x7696('0x29')](db[_0x7696('0x2a')]['rawAttributes'],function(_0xf13ecd){return{'name':_0xf13ecd['fieldName'],'type':_0xf13ecd['type'][_0x7696('0x2b')]};});_0x45f52b[_0x7696('0x2c')]=_[_0x7696('0x29')](_0x675238,_0x7696('0x26'));_0x45f52b[_0x7696('0x2d')]=_[_0x7696('0x2e')](_0x4c7b8a[_0x7696('0x2d')]);_0x45f52b['filters']=_[_0x7696('0x2f')](_0x45f52b['model'],_0x45f52b[_0x7696('0x2d')]);_0x12eccd[_0x7696('0x30')]=_[_0x7696('0x2f')](_0x45f52b[_0x7696('0x2c')],qs[_0x7696('0x31')](_0x4c7b8a[_0x7696('0x2d')]['fields']));_0x12eccd['attributes']=_0x12eccd[_0x7696('0x30')][_0x7696('0x32')]?_0x12eccd[_0x7696('0x30')]:_0x45f52b[_0x7696('0x2c')];if(!_0x4c7b8a[_0x7696('0x2d')][_0x7696('0x33')]('nolimit')){_0x12eccd[_0x7696('0x1c')]=qs[_0x7696('0x1c')](_0x4c7b8a[_0x7696('0x2d')][_0x7696('0x1c')]);_0x12eccd[_0x7696('0x34')]=qs[_0x7696('0x34')](_0x4c7b8a[_0x7696('0x2d')][_0x7696('0x34')]);}_0x12eccd['order']=qs[_0x7696('0x35')](_0x4c7b8a[_0x7696('0x2d')][_0x7696('0x35')]);_0x12eccd[_0x7696('0x36')]=qs[_0x7696('0x37')](_[_0x7696('0x38')](_0x4c7b8a[_0x7696('0x2d')],_0x45f52b[_0x7696('0x37')]),_0x675238);if(_0x4c7b8a[_0x7696('0x2d')][_0x7696('0x39')]){_0x12eccd['where']=_[_0x7696('0x3a')](_0x12eccd[_0x7696('0x36')],{'$or':_['map'](_0x675238,function(_0x366ec3){if(_0x366ec3[_0x7696('0x3b')]!==_0x7696('0x3c')){var _0x2bf0b1={};_0x2bf0b1[_0x366ec3[_0x7696('0x26')]]={'$like':'%'+_0x4c7b8a['query'][_0x7696('0x39')]+'%'};return _0x2bf0b1;}})});}_0x12eccd=_['merge']({},_0x12eccd,_0x4c7b8a['options']);var _0x47cded={'where':_0x12eccd[_0x7696('0x36')]};return db[_0x7696('0x2a')][_0x7696('0x1d')](_0x47cded)[_0x7696('0x23')](function(_0x2b583d){_0x5ceec5[_0x7696('0x1d')]=_0x2b583d;if(_0x4c7b8a['query'][_0x7696('0x3d')]){_0x12eccd['include']=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x7696('0x3e')](_0x12eccd);})[_0x7696('0x23')](function(_0x412d53){_0x5ceec5[_0x7696('0x3f')]=_0x412d53;return _0x5ceec5;})[_0x7696('0x23')](respondWithFilteredResult(_0x1b3fa6,_0x12eccd))[_0x7696('0x40')](handleError(_0x1b3fa6,null));};exports['show']=function(_0x1d2192,_0x2463a6){var _0x25eacc={'raw':!![],'where':{'id':_0x1d2192[_0x7696('0x41')]['id']}},_0x3413e7={};_0x3413e7[_0x7696('0x2c')]=_[_0x7696('0x2e')](db[_0x7696('0x2a')][_0x7696('0x42')]);_0x3413e7[_0x7696('0x2d')]=_[_0x7696('0x2e')](_0x1d2192[_0x7696('0x2d')]);_0x3413e7[_0x7696('0x37')]=_[_0x7696('0x2f')](_0x3413e7['model'],_0x3413e7['query']);_0x25eacc[_0x7696('0x30')]=_[_0x7696('0x2f')](_0x3413e7[_0x7696('0x2c')],qs[_0x7696('0x31')](_0x1d2192[_0x7696('0x2d')][_0x7696('0x31')]));_0x25eacc[_0x7696('0x30')]=_0x25eacc[_0x7696('0x30')][_0x7696('0x32')]?_0x25eacc[_0x7696('0x30')]:_0x3413e7[_0x7696('0x2c')];if(_0x1d2192[_0x7696('0x2d')][_0x7696('0x3d')]){_0x25eacc[_0x7696('0x43')]=[{'all':!![]}];}_0x25eacc=_[_0x7696('0x3a')]({},_0x25eacc,_0x1d2192[_0x7696('0x44')]);return db[_0x7696('0x2a')][_0x7696('0x45')](_0x25eacc)[_0x7696('0x23')](handleEntityNotFound(_0x2463a6,null))['then'](respondWithResult(_0x2463a6,null))[_0x7696('0x40')](handleError(_0x2463a6,null));};exports[_0x7696('0x46')]=function(_0x14436f,_0x322b35){return db['OpenchannelQueueReport'][_0x7696('0x46')](_0x14436f['body'],{})[_0x7696('0x23')](respondWithResult(_0x322b35,0xc9))['catch'](handleError(_0x322b35,null));};exports['update']=function(_0x13a6e3,_0x5ce7e9){if(_0x13a6e3['body']['id']){delete _0x13a6e3[_0x7696('0x47')]['id'];}return db[_0x7696('0x2a')]['find']({'where':{'id':_0x13a6e3[_0x7696('0x41')]['id']}})['then'](handleEntityNotFound(_0x5ce7e9,null))['then'](saveUpdates(_0x13a6e3[_0x7696('0x47')],null))[_0x7696('0x23')](respondWithResult(_0x5ce7e9,null))[_0x7696('0x40')](handleError(_0x5ce7e9,null));};exports[_0x7696('0x24')]=function(_0x102565,_0xbe09){return db['OpenchannelQueueReport'][_0x7696('0x45')]({'where':{'id':_0x102565[_0x7696('0x41')]['id']}})['then'](handleEntityNotFound(_0xbe09,null))[_0x7696('0x23')](removeEntity(_0xbe09,null))[_0x7696('0x40')](handleError(_0xbe09,null));};exports['describe']=function(_0x188d61,_0x5ae711){return db[_0x7696('0x2a')]['describe']()[_0x7696('0x23')](respondWithResult(_0x5ae711,null))['catch'](handleError(_0x5ae711,null));}; \ No newline at end of file +var _0xc4be=['find','create','body','catch','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','show'];(function(_0x2c33cc,_0x22393f){var _0x5d86b8=function(_0x285eb4){while(--_0x285eb4){_0x2c33cc['push'](_0x2c33cc['shift']());}};_0x5d86b8(++_0x22393f);}(_0xc4be,0xe7));var _0xec4b=function(_0x2946bc,_0x44bec2){_0x2946bc=_0x2946bc-0x0;var _0x32cfb8=_0xc4be[_0x2946bc];return _0x32cfb8;};'use strict';var emlformat=require(_0xec4b('0x0'));var rimraf=require(_0xec4b('0x1'));var zipdir=require(_0xec4b('0x2'));var jsonpatch=require(_0xec4b('0x3'));var rp=require(_0xec4b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xec4b('0x5'));var util=require(_0xec4b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec4b('0x7'));var _=require('lodash');var squel=require(_0xec4b('0x8'));var crypto=require(_0xec4b('0x9'));var jsforce=require(_0xec4b('0xa'));var deskjs=require(_0xec4b('0xb'));var toCsv=require(_0xec4b('0xc'));var querystring=require(_0xec4b('0xd'));var Papa=require(_0xec4b('0xe'));var Redis=require(_0xec4b('0xf'));var authService=require(_0xec4b('0x10'));var qs=require(_0xec4b('0x11'));var as=require(_0xec4b('0x12'));var hardwareService=require(_0xec4b('0x13'));var logger=require(_0xec4b('0x14'))(_0xec4b('0x15'));var utils=require(_0xec4b('0x16'));var config=require(_0xec4b('0x17'));var licenseUtil=require(_0xec4b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5881ef,_0x3fce26){_0x3fce26=_0x3fce26||0xcc;return function(_0x3386f7){if(_0x3386f7){return _0x5881ef[_0xec4b('0x19')](_0x3fce26);}return _0x5881ef['status'](_0x3fce26)[_0xec4b('0x1a')]();};}function respondWithResult(_0x5361f9,_0x2164b4){_0x2164b4=_0x2164b4||0xc8;return function(_0x84f0ec){if(_0x84f0ec){return _0x5361f9[_0xec4b('0x1b')](_0x2164b4)[_0xec4b('0x1c')](_0x84f0ec);}};}function respondWithFilteredResult(_0x4fa255,_0xff538a){return function(_0x2b67fd){if(_0x2b67fd){var _0x415779=typeof _0xff538a[_0xec4b('0x1d')]===_0xec4b('0x1e')&&typeof _0xff538a[_0xec4b('0x1f')]===_0xec4b('0x1e');var _0x477175=_0x2b67fd['count'];var _0x3c308c=_0x415779?0x0:_0xff538a[_0xec4b('0x1d')];var _0x5ddb7d=_0x415779?_0x2b67fd['count']:_0xff538a['offset']+_0xff538a['limit'];var _0x2aee94;if(_0x5ddb7d>=_0x477175){_0x5ddb7d=_0x477175;_0x2aee94=0xc8;}else{_0x2aee94=0xce;}_0x4fa255[_0xec4b('0x1b')](_0x2aee94);return _0x4fa255['set'](_0xec4b('0x20'),_0x3c308c+'-'+_0x5ddb7d+'/'+_0x477175)['json'](_0x2b67fd);}return null;};}function patchUpdates(_0x53c0e2){return function(_0x3e852b){try{jsonpatch[_0xec4b('0x21')](_0x3e852b,_0x53c0e2,!![]);}catch(_0x3c84fa){return BPromise['reject'](_0x3c84fa);}return _0x3e852b[_0xec4b('0x22')]();};}function saveUpdates(_0x23fd4f,_0x2036e9){return function(_0x4edf08){if(_0x4edf08){return _0x4edf08[_0xec4b('0x23')](_0x23fd4f)[_0xec4b('0x24')](function(_0x2eebb3){return _0x2eebb3;});}return null;};}function removeEntity(_0x4b22bc,_0x58bf7a){return function(_0x459b80){if(_0x459b80){return _0x459b80[_0xec4b('0x25')]()[_0xec4b('0x24')](function(){_0x4b22bc[_0xec4b('0x1b')](0xcc)[_0xec4b('0x1a')]();});}};}function handleEntityNotFound(_0xadc47f,_0x300876){return function(_0x5a3918){if(!_0x5a3918){_0xadc47f['sendStatus'](0x194);}return _0x5a3918;};}function handleError(_0x5dc3b1,_0x4cc726){_0x4cc726=_0x4cc726||0x1f4;return function(_0x2c9cc7){logger[_0xec4b('0x26')](_0x2c9cc7[_0xec4b('0x27')]);if(_0x2c9cc7[_0xec4b('0x28')]){delete _0x2c9cc7[_0xec4b('0x28')];}_0x5dc3b1['status'](_0x4cc726)['send'](_0x2c9cc7);};}exports['index']=function(_0x1abedf,_0x5f4f41){var _0x4b74b7={},_0x3f5176={},_0x5b7765={'count':0x0,'rows':[]};var _0x2ff26f=_[_0xec4b('0x29')](db[_0xec4b('0x2a')][_0xec4b('0x2b')],function(_0x3ccdf0){return{'name':_0x3ccdf0[_0xec4b('0x2c')],'type':_0x3ccdf0[_0xec4b('0x2d')][_0xec4b('0x2e')]};});_0x3f5176[_0xec4b('0x2f')]=_['map'](_0x2ff26f,_0xec4b('0x28'));_0x3f5176[_0xec4b('0x30')]=_[_0xec4b('0x31')](_0x1abedf[_0xec4b('0x30')]);_0x3f5176['filters']=_['intersection'](_0x3f5176[_0xec4b('0x2f')],_0x3f5176[_0xec4b('0x30')]);_0x4b74b7[_0xec4b('0x32')]=_[_0xec4b('0x33')](_0x3f5176[_0xec4b('0x2f')],qs[_0xec4b('0x34')](_0x1abedf[_0xec4b('0x30')]['fields']));_0x4b74b7['attributes']=_0x4b74b7[_0xec4b('0x32')][_0xec4b('0x35')]?_0x4b74b7[_0xec4b('0x32')]:_0x3f5176[_0xec4b('0x2f')];if(!_0x1abedf[_0xec4b('0x30')]['hasOwnProperty'](_0xec4b('0x36'))){_0x4b74b7[_0xec4b('0x1f')]=qs[_0xec4b('0x1f')](_0x1abedf[_0xec4b('0x30')]['limit']);_0x4b74b7[_0xec4b('0x1d')]=qs[_0xec4b('0x1d')](_0x1abedf[_0xec4b('0x30')][_0xec4b('0x1d')]);}_0x4b74b7[_0xec4b('0x37')]=qs['sort'](_0x1abedf[_0xec4b('0x30')][_0xec4b('0x38')]);_0x4b74b7[_0xec4b('0x39')]=qs[_0xec4b('0x3a')](_[_0xec4b('0x3b')](_0x1abedf[_0xec4b('0x30')],_0x3f5176[_0xec4b('0x3a')]),_0x2ff26f);if(_0x1abedf[_0xec4b('0x30')][_0xec4b('0x3c')]){_0x4b74b7[_0xec4b('0x39')]=_[_0xec4b('0x3d')](_0x4b74b7['where'],{'$or':_[_0xec4b('0x29')](_0x2ff26f,function(_0xb37678){if(_0xb37678[_0xec4b('0x2d')]!==_0xec4b('0x3e')){var _0x8e3889={};_0x8e3889[_0xb37678['name']]={'$like':'%'+_0x1abedf['query'][_0xec4b('0x3c')]+'%'};return _0x8e3889;}})});}_0x4b74b7=_[_0xec4b('0x3d')]({},_0x4b74b7,_0x1abedf[_0xec4b('0x3f')]);var _0x5e2f48={'where':_0x4b74b7[_0xec4b('0x39')]};return db[_0xec4b('0x2a')][_0xec4b('0x40')](_0x5e2f48)[_0xec4b('0x24')](function(_0x57cfa2){_0x5b7765[_0xec4b('0x40')]=_0x57cfa2;if(_0x1abedf['query'][_0xec4b('0x41')]){_0x4b74b7[_0xec4b('0x42')]=[{'all':!![]}];}return db[_0xec4b('0x2a')][_0xec4b('0x43')](_0x4b74b7);})[_0xec4b('0x24')](function(_0x340307){_0x5b7765['rows']=_0x340307;return _0x5b7765;})[_0xec4b('0x24')](respondWithFilteredResult(_0x5f4f41,_0x4b74b7))['catch'](handleError(_0x5f4f41,null));};exports[_0xec4b('0x44')]=function(_0x1d32ee,_0x515670){var _0x38c000={'raw':!![],'where':{'id':_0x1d32ee['params']['id']}},_0x3713e9={};_0x3713e9[_0xec4b('0x2f')]=_[_0xec4b('0x31')](db['OpenchannelQueueReport'][_0xec4b('0x2b')]);_0x3713e9['query']=_[_0xec4b('0x31')](_0x1d32ee['query']);_0x3713e9['filters']=_[_0xec4b('0x33')](_0x3713e9[_0xec4b('0x2f')],_0x3713e9[_0xec4b('0x30')]);_0x38c000[_0xec4b('0x32')]=_[_0xec4b('0x33')](_0x3713e9[_0xec4b('0x2f')],qs['fields'](_0x1d32ee[_0xec4b('0x30')][_0xec4b('0x34')]));_0x38c000[_0xec4b('0x32')]=_0x38c000['attributes'][_0xec4b('0x35')]?_0x38c000[_0xec4b('0x32')]:_0x3713e9[_0xec4b('0x2f')];if(_0x1d32ee[_0xec4b('0x30')][_0xec4b('0x41')]){_0x38c000['include']=[{'all':!![]}];}_0x38c000=_[_0xec4b('0x3d')]({},_0x38c000,_0x1d32ee[_0xec4b('0x3f')]);return db[_0xec4b('0x2a')][_0xec4b('0x45')](_0x38c000)[_0xec4b('0x24')](handleEntityNotFound(_0x515670,null))[_0xec4b('0x24')](respondWithResult(_0x515670,null))['catch'](handleError(_0x515670,null));};exports[_0xec4b('0x46')]=function(_0x51efad,_0x58d2ad){return db[_0xec4b('0x2a')]['create'](_0x51efad[_0xec4b('0x47')],{})[_0xec4b('0x24')](respondWithResult(_0x58d2ad,0xc9))[_0xec4b('0x48')](handleError(_0x58d2ad,null));};exports[_0xec4b('0x23')]=function(_0x1e32c1,_0x4ae33b){if(_0x1e32c1[_0xec4b('0x47')]['id']){delete _0x1e32c1['body']['id'];}return db[_0xec4b('0x2a')][_0xec4b('0x45')]({'where':{'id':_0x1e32c1[_0xec4b('0x49')]['id']}})[_0xec4b('0x24')](handleEntityNotFound(_0x4ae33b,null))[_0xec4b('0x24')](saveUpdates(_0x1e32c1['body'],null))[_0xec4b('0x24')](respondWithResult(_0x4ae33b,null))[_0xec4b('0x48')](handleError(_0x4ae33b,null));};exports[_0xec4b('0x25')]=function(_0x3471e2,_0x530377){return db[_0xec4b('0x2a')]['find']({'where':{'id':_0x3471e2[_0xec4b('0x49')]['id']}})[_0xec4b('0x24')](handleEntityNotFound(_0x530377,null))['then'](removeEntity(_0x530377,null))[_0xec4b('0x48')](handleError(_0x530377,null));};exports[_0xec4b('0x4a')]=function(_0x4a1b21,_0x4eac6d){return db[_0xec4b('0x2a')]['describe']()[_0xec4b('0x24')](respondWithResult(_0x4eac6d,null))[_0xec4b('0x48')](handleError(_0x4eac6d,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 129032f..1aa9281 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x2f2bfa,_0x181de8){var _0x550a27=function(_0x50a970){while(--_0x50a970){_0x2f2bfa['push'](_0x2f2bfa['shift']());}};_0x550a27(++_0x181de8);}(_0x1261,0x144));var _0x1126=function(_0x4314d7,_0x355218){_0x4314d7=_0x4314d7-0x0;var _0x5c599b=_0x1261[_0x4314d7];return _0x5c599b;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x17ff7b,_0x476c07){var _0x38ff27=function(_0x162e3a){while(--_0x162e3a){_0x17ff7b['push'](_0x17ff7b['shift']());}};_0x38ff27(++_0x476c07);}(_0x7a54,0x106));var _0x47a5=function(_0x5ae20c,_0x26e8a0){_0x5ae20c=_0x5ae20c-0x0;var _0x359c4c=_0x7a54[_0x5ae20c];return _0x359c4c;};'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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index b78cd72..253f13d 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 _0x4325=['result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','update','where','attributes','UpdateOpenchannelQueueReport','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info'];(function(_0x56c2bd,_0x307141){var _0x1edc9c=function(_0x12d5e2){while(--_0x12d5e2){_0x56c2bd['push'](_0x56c2bd['shift']());}};_0x1edc9c(++_0x307141);}(_0x4325,0x1da));var _0x5432=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4325[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6e76,_0x106ec9,_0x50394d){return new BPromise(function(_0xc8252e,_0x1c9762){return client[_0x5432('0xa')](_0x4a6e76,_0x50394d)[_0x5432('0xb')](function(_0x263a0c){logger['info'](_0x5432('0xc'),_0x106ec9,'request\x20sent');logger[_0x5432('0xd')](_0x5432('0xe'),_0x106ec9,_0x5432('0xf'),JSON[_0x5432('0x10')](_0x263a0c));if(_0x263a0c['error']){if(_0x263a0c['error'][_0x5432('0x11')]===0x1f4){logger[_0x5432('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x106ec9,_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);return _0x1c9762(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x263a0c['error']['message']);return _0xc8252e(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}else{logger[_0x5432('0x14')](_0x5432('0xc'),_0x106ec9,_0x5432('0xf'));_0xc8252e(_0x263a0c[_0x5432('0x15')]['message']);}})[_0x5432('0x16')](function(_0x49e8fd){logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x49e8fd);_0x1c9762(_0x49e8fd);});});}exports[_0x5432('0x17')]=function(_0x32fe60){var _0x4221a8=this;return new Promise(function(_0x5f011f,_0x3f3873){return db[_0x5432('0x18')][_0x5432('0x19')](_0x32fe60[_0x5432('0x1a')],{'raw':_0x32fe60[_0x5432('0x1b')]?_0x32fe60[_0x5432('0x1b')][_0x5432('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x66911a){logger[_0x5432('0x14')](_0x5432('0x17'),_0x32fe60);logger[_0x5432('0xd')](_0x5432('0x17'),_0x32fe60,JSON['stringify'](_0x66911a));_0x5f011f(_0x66911a);})['catch'](function(_0x4d09cd){logger[_0x5432('0x12')](_0x5432('0x17'),_0x4d09cd[_0x5432('0x13')],_0x32fe60);_0x3f3873(_0x4221a8[_0x5432('0x12')](0x1f4,_0x4d09cd['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x3e0b66){var _0x8ed74b=this;return new Promise(function(_0x4a40fc,_0x19e6b2){return db[_0x5432('0x18')][_0x5432('0x1d')](_0x3e0b66['body'],{'raw':_0x3e0b66[_0x5432('0x1b')]?_0x3e0b66[_0x5432('0x1b')][_0x5432('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e0b66['options']?_0x3e0b66['options'][_0x5432('0x1e')]||null:null,'attributes':_0x3e0b66[_0x5432('0x1b')]?_0x3e0b66['options'][_0x5432('0x1f')]||null:null,'limit':_0x3e0b66[_0x5432('0x1b')]?_0x3e0b66[_0x5432('0x1b')]['limit']||null:null})[_0x5432('0xb')](function(_0x5be867){logger['info'](_0x5432('0x20'),_0x3e0b66);logger['debug'](_0x5432('0x20'),_0x3e0b66,JSON['stringify'](_0x5be867));_0x4a40fc(_0x5be867);})['catch'](function(_0x465a09){logger[_0x5432('0x12')](_0x5432('0x20'),_0x465a09['message'],_0x3e0b66);_0x19e6b2(_0x8ed74b[_0x5432('0x12')](0x1f4,_0x465a09[_0x5432('0x13')]));});});}; \ No newline at end of file +var _0x3cae=['catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','options','UpdateOpenchannelQueueReport','update','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x5e47b2,_0x238c50){var _0x34f8e2=function(_0x5cc40e){while(--_0x5cc40e){_0x5e47b2['push'](_0x5e47b2['shift']());}};_0x34f8e2(++_0x238c50);}(_0x3cae,0x117));var _0xe3ca=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x3cae[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0xe3ca('0x0'));var util=require(_0xe3ca('0x1'));var moment=require(_0xe3ca('0x2'));var BPromise=require(_0xe3ca('0x3'));var rs=require(_0xe3ca('0x4'));var fs=require('fs');var Redis=require(_0xe3ca('0x5'));var db=require(_0xe3ca('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3ca('0x7'))(_0xe3ca('0x8'));var config=require('../../config/environment');var jayson=require(_0xe3ca('0x9'));var client=jayson['client'][_0xe3ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7fafb4,_0x36d17a,_0x578178){return new BPromise(function(_0x2c4863,_0x100c20){return client[_0xe3ca('0xb')](_0x7fafb4,_0x578178)[_0xe3ca('0xc')](function(_0x1ae7bf){logger[_0xe3ca('0xd')](_0xe3ca('0xe'),_0x36d17a,'request\x20sent');logger[_0xe3ca('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x36d17a,_0xe3ca('0x10'),JSON[_0xe3ca('0x11')](_0x1ae7bf));if(_0x1ae7bf[_0xe3ca('0x12')]){if(_0x1ae7bf[_0xe3ca('0x12')][_0xe3ca('0x13')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x36d17a,_0x1ae7bf[_0xe3ca('0x12')]['message']);return _0x100c20(_0x1ae7bf[_0xe3ca('0x12')][_0xe3ca('0x14')]);}logger['error'](_0xe3ca('0xe'),_0x36d17a,_0x1ae7bf[_0xe3ca('0x12')][_0xe3ca('0x14')]);return _0x2c4863(_0x1ae7bf[_0xe3ca('0x12')][_0xe3ca('0x14')]);}else{logger[_0xe3ca('0xd')](_0xe3ca('0xe'),_0x36d17a,_0xe3ca('0x10'));_0x2c4863(_0x1ae7bf['result']['message']);}})[_0xe3ca('0x15')](function(_0x4296ae){logger[_0xe3ca('0x12')](_0xe3ca('0xe'),_0x36d17a,_0x4296ae);_0x100c20(_0x4296ae);});});}exports[_0xe3ca('0x16')]=function(_0x2d73d9){var _0x5bb8d8=this;return new Promise(function(_0x2eafde,_0xda5841){return db[_0xe3ca('0x17')]['create'](_0x2d73d9['body'],{'raw':_0x2d73d9['options']?_0x2d73d9[_0xe3ca('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3b7591){logger[_0xe3ca('0xd')](_0xe3ca('0x16'),_0x2d73d9);logger[_0xe3ca('0xf')](_0xe3ca('0x16'),_0x2d73d9,JSON['stringify'](_0x3b7591));_0x2eafde(_0x3b7591);})[_0xe3ca('0x15')](function(_0x3ab26e){logger['error'](_0xe3ca('0x16'),_0x3ab26e[_0xe3ca('0x14')],_0x2d73d9);_0xda5841(_0x5bb8d8[_0xe3ca('0x12')](0x1f4,_0x3ab26e[_0xe3ca('0x14')]));});});};exports[_0xe3ca('0x19')]=function(_0x392bdb){var _0x2b571f=this;return new Promise(function(_0x25b39e,_0x477ec7){return db[_0xe3ca('0x17')][_0xe3ca('0x1a')](_0x392bdb['body'],{'raw':_0x392bdb[_0xe3ca('0x18')]?_0x392bdb['options'][_0xe3ca('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x392bdb[_0xe3ca('0x18')]?_0x392bdb[_0xe3ca('0x18')][_0xe3ca('0x1c')]||null:null,'attributes':_0x392bdb['options']?_0x392bdb['options'][_0xe3ca('0x1d')]||null:null,'limit':_0x392bdb[_0xe3ca('0x18')]?_0x392bdb[_0xe3ca('0x18')]['limit']||null:null})[_0xe3ca('0xc')](function(_0x39dd6e){logger[_0xe3ca('0xd')](_0xe3ca('0x19'),_0x392bdb);logger['debug']('UpdateOpenchannelQueueReport',_0x392bdb,JSON[_0xe3ca('0x11')](_0x39dd6e));_0x25b39e(_0x39dd6e);})['catch'](function(_0x24d40a){logger['error']('UpdateOpenchannelQueueReport',_0x24d40a[_0xe3ca('0x14')],_0x392bdb);_0x477ec7(_0x2b571f[_0xe3ca('0x12')](0x1f4,_0x24d40a[_0xe3ca('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 4e22352..1b8f634 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 _0xb8f3=['multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy'];(function(_0x422faf,_0x6967d5){var _0x341573=function(_0x5d2f0e){while(--_0x5d2f0e){_0x422faf['push'](_0x422faf['shift']());}};_0x341573(++_0x6967d5);}(_0xb8f3,0xbe));var _0x3b8f=function(_0x48df04,_0x1522b1){_0x48df04=_0x48df04-0x0;var _0x4de5fa=_0xb8f3[_0x48df04];return _0x4de5fa;};'use strict';var multer=require(_0x3b8f('0x0'));var util=require('util');var path=require(_0x3b8f('0x1'));var timeout=require(_0x3b8f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3b8f('0x3'));var auth=require(_0x3b8f('0x4'));var interaction=require(_0x3b8f('0x5'));var config=require('../../config/environment');var controller=require(_0x3b8f('0x6'));router[_0x3b8f('0x7')]('/',auth['isAuthenticated'](),controller[_0x3b8f('0x8')]);router[_0x3b8f('0x7')](_0x3b8f('0x9'),auth[_0x3b8f('0xa')](),controller[_0x3b8f('0xb')]);router['get'](_0x3b8f('0xc'),auth[_0x3b8f('0xa')](),controller[_0x3b8f('0xd')]);router[_0x3b8f('0xe')]('/',auth['isAuthenticated'](),controller[_0x3b8f('0xf')]);router[_0x3b8f('0x10')](_0x3b8f('0xc'),auth[_0x3b8f('0xa')](),controller[_0x3b8f('0x11')]);router['delete']('/:id',auth[_0x3b8f('0xa')](),controller[_0x3b8f('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2bb5=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index','show','post','put','update','delete','/:id','destroy','util','path','connect-timeout'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0x2bb5,0x1c5));var _0x52bb=function(_0x34c1ea,_0x5e3a54){_0x34c1ea=_0x34c1ea-0x0;var _0x3dcca5=_0x2bb5[_0x34c1ea];return _0x3dcca5;};'use strict';var multer=require('multer');var util=require(_0x52bb('0x0'));var path=require(_0x52bb('0x1'));var timeout=require(_0x52bb('0x2'));var express=require(_0x52bb('0x3'));var router=express[_0x52bb('0x4')]();var fs_extra=require(_0x52bb('0x5'));var auth=require(_0x52bb('0x6'));var interaction=require(_0x52bb('0x7'));var config=require('../../config/environment');var controller=require(_0x52bb('0x8'));router[_0x52bb('0x9')]('/',auth[_0x52bb('0xa')](),controller[_0x52bb('0xb')]);router['get']('/describe',auth[_0x52bb('0xa')](),controller['describe']);router[_0x52bb('0x9')]('/:id',auth[_0x52bb('0xa')](),controller[_0x52bb('0xc')]);router[_0x52bb('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x52bb('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x52bb('0xf')]);router[_0x52bb('0x10')](_0x52bb('0x11'),auth[_0x52bb('0xa')](),controller[_0x52bb('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index aee5afb..8879424 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0xb2b7a,_0x36536){var _0x126c5c=function(_0x5c7b44){while(--_0x5c7b44){_0xb2b7a['push'](_0xb2b7a['shift']());}};_0x126c5c(++_0x36536);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x57ee1d,_0x54111b){_0x57ee1d=_0x57ee1d-0x0;var _0x12a933=_0xf3cd[_0x57ee1d];return _0x12a933;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x428b74,_0x40e9a9){var _0x25060d=function(_0x21b330){while(--_0x21b330){_0x428b74['push'](_0x428b74['shift']());}};_0x25060d(++_0x40e9a9);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x1be790,_0x112549){_0x1be790=_0x1be790-0x0;var _0x7668c8=_0xf3cd[_0x1be790];return _0x7668c8;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 5d56813..5893ce8 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 _0x103f=['name','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','options','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','error','stack'];(function(_0x1c90a7,_0x115e4d){var _0x408b33=function(_0x4b2b46){while(--_0x4b2b46){_0x1c90a7['push'](_0x1c90a7['shift']());}};_0x408b33(++_0x115e4d);}(_0x103f,0x14c));var _0xf103=function(_0x33e9b2,_0x26890f){_0x33e9b2=_0x33e9b2-0x0;var _0x48c872=_0x103f[_0x33e9b2];return _0x48c872;};'use strict';var emlformat=require(_0xf103('0x0'));var rimraf=require(_0xf103('0x1'));var zipdir=require(_0xf103('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf103('0x3'));var moment=require(_0xf103('0x4'));var BPromise=require(_0xf103('0x5'));var Mustache=require('mustache');var util=require(_0xf103('0x6'));var path=require('path');var sox=require(_0xf103('0x7'));var csv=require(_0xf103('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf103('0x9'));var _=require(_0xf103('0xa'));var squel=require(_0xf103('0xb'));var crypto=require('crypto');var jsforce=require(_0xf103('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf103('0xd'));var Papa=require('papaparse');var Redis=require(_0xf103('0xe'));var authService=require(_0xf103('0xf'));var qs=require(_0xf103('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf103('0x11'))(_0xf103('0x12'));var utils=require(_0xf103('0x13'));var config=require(_0xf103('0x14'));var licenseUtil=require(_0xf103('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2091bc,_0x2c508e){_0x2c508e=_0x2c508e||0xcc;return function(_0x20ac9a){if(_0x20ac9a){return _0x2091bc[_0xf103('0x16')](_0x2c508e);}return _0x2091bc['status'](_0x2c508e)[_0xf103('0x17')]();};}function respondWithResult(_0x41a5fe,_0x2115a6){_0x2115a6=_0x2115a6||0xc8;return function(_0x481ebf){if(_0x481ebf){return _0x41a5fe[_0xf103('0x18')](_0x2115a6)[_0xf103('0x19')](_0x481ebf);}};}function respondWithFilteredResult(_0xdbca86,_0x104b6e){return function(_0x2a428c){if(_0x2a428c){var _0x21cd34=typeof _0x104b6e[_0xf103('0x1a')]===_0xf103('0x1b')&&typeof _0x104b6e[_0xf103('0x1c')]===_0xf103('0x1b');var _0x79be7c=_0x2a428c[_0xf103('0x1d')];var _0x2a8e5a=_0x21cd34?0x0:_0x104b6e[_0xf103('0x1a')];var _0x36ac3d=_0x21cd34?_0x2a428c[_0xf103('0x1d')]:_0x104b6e[_0xf103('0x1a')]+_0x104b6e[_0xf103('0x1c')];var _0xead0f9;if(_0x36ac3d>=_0x79be7c){_0x36ac3d=_0x79be7c;_0xead0f9=0xc8;}else{_0xead0f9=0xce;}_0xdbca86[_0xf103('0x18')](_0xead0f9);return _0xdbca86[_0xf103('0x1e')](_0xf103('0x1f'),_0x2a8e5a+'-'+_0x36ac3d+'/'+_0x79be7c)[_0xf103('0x19')](_0x2a428c);}return null;};}function patchUpdates(_0x563741){return function(_0x355a5e){try{jsonpatch['apply'](_0x355a5e,_0x563741,!![]);}catch(_0x4dccd9){return BPromise[_0xf103('0x20')](_0x4dccd9);}return _0x355a5e[_0xf103('0x21')]();};}function saveUpdates(_0x53151d,_0x4666ff){return function(_0x26d8ba){if(_0x26d8ba){return _0x26d8ba['update'](_0x53151d)['then'](function(_0x5854f6){return _0x5854f6;});}return null;};}function removeEntity(_0x58c562,_0x46249a){return function(_0x130548){if(_0x130548){return _0x130548[_0xf103('0x22')]()[_0xf103('0x23')](function(){_0x58c562[_0xf103('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21da6f,_0x233995){return function(_0xe0549){if(!_0xe0549){_0x21da6f['sendStatus'](0x194);}return _0xe0549;};}function handleError(_0x448f92,_0x22d0c0){_0x22d0c0=_0x22d0c0||0x1f4;return function(_0x12f4a5){logger[_0xf103('0x24')](_0x12f4a5[_0xf103('0x25')]);if(_0x12f4a5[_0xf103('0x26')]){delete _0x12f4a5[_0xf103('0x26')];}_0x448f92[_0xf103('0x18')](_0x22d0c0)['send'](_0x12f4a5);};}exports['index']=function(_0x7cac2d,_0x3715cc){var _0x40af05={},_0x296988={},_0x548415={'count':0x0,'rows':[]};var _0x12822e=_[_0xf103('0x27')](db[_0xf103('0x28')][_0xf103('0x29')],function(_0x452397){return{'name':_0x452397[_0xf103('0x2a')],'type':_0x452397[_0xf103('0x2b')][_0xf103('0x2c')]};});_0x296988['model']=_['map'](_0x12822e,_0xf103('0x26'));_0x296988['query']=_[_0xf103('0x2d')](_0x7cac2d[_0xf103('0x2e')]);_0x296988['filters']=_[_0xf103('0x2f')](_0x296988[_0xf103('0x30')],_0x296988['query']);_0x40af05[_0xf103('0x31')]=_[_0xf103('0x2f')](_0x296988['model'],qs['fields'](_0x7cac2d['query'][_0xf103('0x32')]));_0x40af05['attributes']=_0x40af05[_0xf103('0x31')][_0xf103('0x33')]?_0x40af05[_0xf103('0x31')]:_0x296988[_0xf103('0x30')];if(!_0x7cac2d[_0xf103('0x2e')][_0xf103('0x34')]('nolimit')){_0x40af05[_0xf103('0x1c')]=qs[_0xf103('0x1c')](_0x7cac2d[_0xf103('0x2e')][_0xf103('0x1c')]);_0x40af05['offset']=qs['offset'](_0x7cac2d[_0xf103('0x2e')][_0xf103('0x1a')]);}_0x40af05[_0xf103('0x35')]=qs['sort'](_0x7cac2d[_0xf103('0x2e')][_0xf103('0x36')]);_0x40af05[_0xf103('0x37')]=qs['filters'](_[_0xf103('0x38')](_0x7cac2d[_0xf103('0x2e')],_0x296988[_0xf103('0x39')]),_0x12822e);if(_0x7cac2d[_0xf103('0x2e')][_0xf103('0x3a')]){_0x40af05[_0xf103('0x37')]=_['merge'](_0x40af05[_0xf103('0x37')],{'$or':_[_0xf103('0x27')](_0x12822e,function(_0x14712a){if(_0x14712a[_0xf103('0x2b')]!==_0xf103('0x3b')){var _0x44c266={};_0x44c266[_0x14712a[_0xf103('0x26')]]={'$like':'%'+_0x7cac2d[_0xf103('0x2e')]['filter']+'%'};return _0x44c266;}})});}_0x40af05=_[_0xf103('0x3c')]({},_0x40af05,_0x7cac2d['options']);var _0x1a6c82={'where':_0x40af05['where']};return db['OpenchannelTransferReport'][_0xf103('0x1d')](_0x1a6c82)[_0xf103('0x23')](function(_0x5c4f51){_0x548415[_0xf103('0x1d')]=_0x5c4f51;if(_0x7cac2d[_0xf103('0x2e')][_0xf103('0x3d')]){_0x40af05[_0xf103('0x3e')]=[{'all':!![]}];}return db[_0xf103('0x28')][_0xf103('0x3f')](_0x40af05);})[_0xf103('0x23')](function(_0x2f2d61){_0x548415[_0xf103('0x40')]=_0x2f2d61;return _0x548415;})[_0xf103('0x23')](respondWithFilteredResult(_0x3715cc,_0x40af05))[_0xf103('0x41')](handleError(_0x3715cc,null));};exports[_0xf103('0x42')]=function(_0x270118,_0x138f0b){var _0x3c9576={'raw':!![],'where':{'id':_0x270118['params']['id']}},_0x52bfd8={};_0x52bfd8[_0xf103('0x30')]=_[_0xf103('0x2d')](db[_0xf103('0x28')][_0xf103('0x29')]);_0x52bfd8[_0xf103('0x2e')]=_[_0xf103('0x2d')](_0x270118['query']);_0x52bfd8[_0xf103('0x39')]=_[_0xf103('0x2f')](_0x52bfd8[_0xf103('0x30')],_0x52bfd8[_0xf103('0x2e')]);_0x3c9576[_0xf103('0x31')]=_[_0xf103('0x2f')](_0x52bfd8[_0xf103('0x30')],qs['fields'](_0x270118[_0xf103('0x2e')][_0xf103('0x32')]));_0x3c9576[_0xf103('0x31')]=_0x3c9576[_0xf103('0x31')][_0xf103('0x33')]?_0x3c9576[_0xf103('0x31')]:_0x52bfd8[_0xf103('0x30')];if(_0x270118['query'][_0xf103('0x3d')]){_0x3c9576[_0xf103('0x3e')]=[{'all':!![]}];}_0x3c9576=_[_0xf103('0x3c')]({},_0x3c9576,_0x270118[_0xf103('0x43')]);return db[_0xf103('0x28')][_0xf103('0x44')](_0x3c9576)['then'](handleEntityNotFound(_0x138f0b,null))[_0xf103('0x23')](respondWithResult(_0x138f0b,null))['catch'](handleError(_0x138f0b,null));};exports[_0xf103('0x45')]=function(_0x282f09,_0x2f6c46){return db[_0xf103('0x28')][_0xf103('0x45')](_0x282f09[_0xf103('0x46')],{})[_0xf103('0x23')](respondWithResult(_0x2f6c46,0xc9))[_0xf103('0x41')](handleError(_0x2f6c46,null));};exports[_0xf103('0x47')]=function(_0x29d5c8,_0x16d75a){if(_0x29d5c8['body']['id']){delete _0x29d5c8[_0xf103('0x46')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x29d5c8[_0xf103('0x48')]['id']}})[_0xf103('0x23')](handleEntityNotFound(_0x16d75a,null))['then'](saveUpdates(_0x29d5c8[_0xf103('0x46')],null))[_0xf103('0x23')](respondWithResult(_0x16d75a,null))['catch'](handleError(_0x16d75a,null));};exports[_0xf103('0x22')]=function(_0x475f95,_0x1a3813){return db['OpenchannelTransferReport'][_0xf103('0x44')]({'where':{'id':_0x475f95['params']['id']}})[_0xf103('0x23')](handleEntityNotFound(_0x1a3813,null))[_0xf103('0x23')](removeEntity(_0x1a3813,null))[_0xf103('0x41')](handleError(_0x1a3813,null));};exports['describe']=function(_0x10c823,_0x59ee94){return db['OpenchannelTransferReport'][_0xf103('0x49')]()[_0xf103('0x23')](respondWithResult(_0x59ee94,null))[_0xf103('0x41')](handleError(_0x59ee94,null));}; \ No newline at end of file +var _0x4621=['VIRTUAL','filter','options','OpenchannelTransferReport','catch','show','params','keys','length','includeAll','include','find','create','body','describe','moment','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','index','rawAttributes','key','model','map','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','type'];(function(_0x339517,_0x297dba){var _0x55538b=function(_0x3826f2){while(--_0x3826f2){_0x339517['push'](_0x339517['shift']());}};_0x55538b(++_0x297dba);}(_0x4621,0x16d));var _0x1462=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4621[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1462('0x0'));var BPromise=require('bluebird');var Mustache=require(_0x1462('0x1'));var util=require(_0x1462('0x2'));var path=require(_0x1462('0x3'));var sox=require(_0x1462('0x4'));var csv=require('to-csv');var ejs=require(_0x1462('0x5'));var fs=require('fs');var fs_extra=require(_0x1462('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1462('0x7'));var jsforce=require(_0x1462('0x8'));var deskjs=require(_0x1462('0x9'));var toCsv=require(_0x1462('0xa'));var querystring=require(_0x1462('0xb'));var Papa=require(_0x1462('0xc'));var Redis=require(_0x1462('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x1462('0xe'));var as=require(_0x1462('0xf'));var hardwareService=require(_0x1462('0x10'));var logger=require(_0x1462('0x11'))(_0x1462('0x12'));var utils=require('../../config/utils');var config=require(_0x1462('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1462('0x14'))['db'];function respondWithStatusCode(_0x2fcebe,_0xd931aa){_0xd931aa=_0xd931aa||0xcc;return function(_0x202fbb){if(_0x202fbb){return _0x2fcebe[_0x1462('0x15')](_0xd931aa);}return _0x2fcebe[_0x1462('0x16')](_0xd931aa)[_0x1462('0x17')]();};}function respondWithResult(_0x37e96a,_0x1abe01){_0x1abe01=_0x1abe01||0xc8;return function(_0x5d3db7){if(_0x5d3db7){return _0x37e96a[_0x1462('0x16')](_0x1abe01)[_0x1462('0x18')](_0x5d3db7);}};}function respondWithFilteredResult(_0xfd61f6,_0x535db7){return function(_0x3714b1){if(_0x3714b1){var _0x3007b1=typeof _0x535db7[_0x1462('0x19')]===_0x1462('0x1a')&&typeof _0x535db7[_0x1462('0x1b')]==='undefined';var _0x8604f=_0x3714b1[_0x1462('0x1c')];var _0x322e8d=_0x3007b1?0x0:_0x535db7[_0x1462('0x19')];var _0x1ab5e7=_0x3007b1?_0x3714b1[_0x1462('0x1c')]:_0x535db7[_0x1462('0x19')]+_0x535db7[_0x1462('0x1b')];var _0x2e2322;if(_0x1ab5e7>=_0x8604f){_0x1ab5e7=_0x8604f;_0x2e2322=0xc8;}else{_0x2e2322=0xce;}_0xfd61f6['status'](_0x2e2322);return _0xfd61f6[_0x1462('0x1d')](_0x1462('0x1e'),_0x322e8d+'-'+_0x1ab5e7+'/'+_0x8604f)[_0x1462('0x18')](_0x3714b1);}return null;};}function patchUpdates(_0x522417){return function(_0x42cf4d){try{jsonpatch['apply'](_0x42cf4d,_0x522417,!![]);}catch(_0x135290){return BPromise[_0x1462('0x1f')](_0x135290);}return _0x42cf4d[_0x1462('0x20')]();};}function saveUpdates(_0x2f4535,_0x17e331){return function(_0x3ee120){if(_0x3ee120){return _0x3ee120['update'](_0x2f4535)[_0x1462('0x21')](function(_0x29495b){return _0x29495b;});}return null;};}function removeEntity(_0x146676,_0x4ee79b){return function(_0x1af73a){if(_0x1af73a){return _0x1af73a[_0x1462('0x22')]()[_0x1462('0x21')](function(){_0x146676['status'](0xcc)[_0x1462('0x17')]();});}};}function handleEntityNotFound(_0x1e0a18,_0xdd0cd7){return function(_0x35555f){if(!_0x35555f){_0x1e0a18[_0x1462('0x15')](0x194);}return _0x35555f;};}function handleError(_0x53d4bb,_0x51b278){_0x51b278=_0x51b278||0x1f4;return function(_0x295290){logger[_0x1462('0x23')](_0x295290[_0x1462('0x24')]);if(_0x295290[_0x1462('0x25')]){delete _0x295290[_0x1462('0x25')];}_0x53d4bb[_0x1462('0x16')](_0x51b278)['send'](_0x295290);};}exports[_0x1462('0x26')]=function(_0x2b1d78,_0x65b7b7){var _0x4319c9={},_0x14ac9e={},_0xa4c008={'count':0x0,'rows':[]};var _0x53c27a=_['map'](db['OpenchannelTransferReport'][_0x1462('0x27')],function(_0x38f9c6){return{'name':_0x38f9c6['fieldName'],'type':_0x38f9c6['type'][_0x1462('0x28')]};});_0x14ac9e[_0x1462('0x29')]=_[_0x1462('0x2a')](_0x53c27a,_0x1462('0x25'));_0x14ac9e[_0x1462('0x2b')]=_['keys'](_0x2b1d78[_0x1462('0x2b')]);_0x14ac9e[_0x1462('0x2c')]=_[_0x1462('0x2d')](_0x14ac9e[_0x1462('0x29')],_0x14ac9e[_0x1462('0x2b')]);_0x4319c9[_0x1462('0x2e')]=_[_0x1462('0x2d')](_0x14ac9e[_0x1462('0x29')],qs[_0x1462('0x2f')](_0x2b1d78['query'][_0x1462('0x2f')]));_0x4319c9[_0x1462('0x2e')]=_0x4319c9[_0x1462('0x2e')]['length']?_0x4319c9[_0x1462('0x2e')]:_0x14ac9e[_0x1462('0x29')];if(!_0x2b1d78[_0x1462('0x2b')]['hasOwnProperty'](_0x1462('0x30'))){_0x4319c9[_0x1462('0x1b')]=qs[_0x1462('0x1b')](_0x2b1d78[_0x1462('0x2b')]['limit']);_0x4319c9['offset']=qs[_0x1462('0x19')](_0x2b1d78['query'][_0x1462('0x19')]);}_0x4319c9[_0x1462('0x31')]=qs[_0x1462('0x32')](_0x2b1d78[_0x1462('0x2b')][_0x1462('0x32')]);_0x4319c9[_0x1462('0x33')]=qs[_0x1462('0x2c')](_[_0x1462('0x34')](_0x2b1d78[_0x1462('0x2b')],_0x14ac9e[_0x1462('0x2c')]),_0x53c27a);if(_0x2b1d78['query']['filter']){_0x4319c9['where']=_[_0x1462('0x35')](_0x4319c9['where'],{'$or':_[_0x1462('0x2a')](_0x53c27a,function(_0x267328){if(_0x267328[_0x1462('0x36')]!==_0x1462('0x37')){var _0x217cb8={};_0x217cb8[_0x267328[_0x1462('0x25')]]={'$like':'%'+_0x2b1d78[_0x1462('0x2b')][_0x1462('0x38')]+'%'};return _0x217cb8;}})});}_0x4319c9=_[_0x1462('0x35')]({},_0x4319c9,_0x2b1d78[_0x1462('0x39')]);var _0x343a2d={'where':_0x4319c9[_0x1462('0x33')]};return db[_0x1462('0x3a')][_0x1462('0x1c')](_0x343a2d)[_0x1462('0x21')](function(_0x3c89a6){_0xa4c008[_0x1462('0x1c')]=_0x3c89a6;if(_0x2b1d78[_0x1462('0x2b')]['includeAll']){_0x4319c9['include']=[{'all':!![]}];}return db[_0x1462('0x3a')]['findAll'](_0x4319c9);})['then'](function(_0x5aa7fa){_0xa4c008['rows']=_0x5aa7fa;return _0xa4c008;})[_0x1462('0x21')](respondWithFilteredResult(_0x65b7b7,_0x4319c9))[_0x1462('0x3b')](handleError(_0x65b7b7,null));};exports[_0x1462('0x3c')]=function(_0x4b436e,_0x4cb4c2){var _0x1b3eb5={'raw':!![],'where':{'id':_0x4b436e[_0x1462('0x3d')]['id']}},_0x34d168={};_0x34d168[_0x1462('0x29')]=_[_0x1462('0x3e')](db['OpenchannelTransferReport'][_0x1462('0x27')]);_0x34d168['query']=_[_0x1462('0x3e')](_0x4b436e[_0x1462('0x2b')]);_0x34d168[_0x1462('0x2c')]=_[_0x1462('0x2d')](_0x34d168['model'],_0x34d168[_0x1462('0x2b')]);_0x1b3eb5['attributes']=_[_0x1462('0x2d')](_0x34d168[_0x1462('0x29')],qs[_0x1462('0x2f')](_0x4b436e[_0x1462('0x2b')][_0x1462('0x2f')]));_0x1b3eb5[_0x1462('0x2e')]=_0x1b3eb5[_0x1462('0x2e')][_0x1462('0x3f')]?_0x1b3eb5[_0x1462('0x2e')]:_0x34d168[_0x1462('0x29')];if(_0x4b436e[_0x1462('0x2b')][_0x1462('0x40')]){_0x1b3eb5[_0x1462('0x41')]=[{'all':!![]}];}_0x1b3eb5=_[_0x1462('0x35')]({},_0x1b3eb5,_0x4b436e['options']);return db[_0x1462('0x3a')][_0x1462('0x42')](_0x1b3eb5)['then'](handleEntityNotFound(_0x4cb4c2,null))['then'](respondWithResult(_0x4cb4c2,null))[_0x1462('0x3b')](handleError(_0x4cb4c2,null));};exports[_0x1462('0x43')]=function(_0x2717c0,_0x3240ab){return db[_0x1462('0x3a')][_0x1462('0x43')](_0x2717c0[_0x1462('0x44')],{})[_0x1462('0x21')](respondWithResult(_0x3240ab,0xc9))[_0x1462('0x3b')](handleError(_0x3240ab,null));};exports['update']=function(_0x3e04e5,_0x58d197){if(_0x3e04e5[_0x1462('0x44')]['id']){delete _0x3e04e5[_0x1462('0x44')]['id'];}return db[_0x1462('0x3a')][_0x1462('0x42')]({'where':{'id':_0x3e04e5['params']['id']}})['then'](handleEntityNotFound(_0x58d197,null))[_0x1462('0x21')](saveUpdates(_0x3e04e5[_0x1462('0x44')],null))[_0x1462('0x21')](respondWithResult(_0x58d197,null))['catch'](handleError(_0x58d197,null));};exports[_0x1462('0x22')]=function(_0x153017,_0x3cf66a){return db[_0x1462('0x3a')][_0x1462('0x42')]({'where':{'id':_0x153017['params']['id']}})[_0x1462('0x21')](handleEntityNotFound(_0x3cf66a,null))[_0x1462('0x21')](removeEntity(_0x3cf66a,null))['catch'](handleError(_0x3cf66a,null));};exports[_0x1462('0x45')]=function(_0x507c3c,_0x154e5b){return db[_0x1462('0x3a')][_0x1462('0x45')]()[_0x1462('0x21')](respondWithResult(_0x154e5b,null))['catch'](handleError(_0x154e5b,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index fb4a0d5..ca8a35b 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 _0xb8b0=['define','OpenchannelTransferReport','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports'];(function(_0xb9f1bf,_0x2b62a3){var _0x521fe7=function(_0x2bc7a4){while(--_0x2bc7a4){_0xb9f1bf['push'](_0xb9f1bf['shift']());}};_0x521fe7(++_0x2b62a3);}(_0xb8b0,0x115));var _0x0b8b=function(_0x509a63,_0x42dba8){_0x509a63=_0x509a63-0x0;var _0x25c908=_0xb8b0[_0x509a63];return _0x25c908;};'use strict';var _=require(_0x0b8b('0x0'));var util=require(_0x0b8b('0x1'));var logger=require(_0x0b8b('0x2'))(_0x0b8b('0x3'));var moment=require('moment');var BPromise=require(_0x0b8b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b8b('0x5'));var rimraf=require(_0x0b8b('0x6'));var config=require(_0x0b8b('0x7'));var attributes=require('./openchannelTransferReport.attributes');module[_0x0b8b('0x8')]=function(_0x3ab3b1,_0x29cb20){return _0x3ab3b1[_0x0b8b('0x9')](_0x0b8b('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9ef7=['rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9ef7,0x120));var _0x79ef=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x9ef7[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x79ef('0x0'));var util=require(_0x79ef('0x1'));var logger=require(_0x79ef('0x2'))(_0x79ef('0x3'));var moment=require(_0x79ef('0x4'));var BPromise=require('bluebird');var rp=require(_0x79ef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x79ef('0x6'));var config=require(_0x79ef('0x7'));var attributes=require(_0x79ef('0x8'));module[_0x79ef('0x9')]=function(_0x20cf68,_0x3ee7ae){return _0x20cf68[_0x79ef('0xa')](_0x79ef('0xb'),attributes,{'tableName':_0x79ef('0xc'),'paranoid':![],'indexes':[{'name':_0x79ef('0xd'),'fields':[_0x79ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 9569aa0..37bbce6 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 _0xc21e=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x365a31,_0x542d3f){var _0xe860a5=function(_0x59a0c5){while(--_0x59a0c5){_0x365a31['push'](_0x365a31['shift']());}};_0xe860a5(++_0x542d3f);}(_0xc21e,0x1ca));var _0xec21=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc21e[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0xec21('0x0'));var moment=require(_0xec21('0x1'));var BPromise=require(_0xec21('0x2'));var rs=require(_0xec21('0x3'));var fs=require('fs');var Redis=require(_0xec21('0x4'));var db=require(_0xec21('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xec21('0x6'))(_0xec21('0x7'));var config=require(_0xec21('0x8'));var jayson=require(_0xec21('0x9'));var client=jayson[_0xec21('0xa')][_0xec21('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x406b66,_0x2f15e7,_0x51f6dc){return new BPromise(function(_0x2b1396,_0x3d74a2){return client[_0xec21('0xc')](_0x406b66,_0x51f6dc)[_0xec21('0xd')](function(_0x4d478){logger['info'](_0xec21('0xe'),_0x2f15e7,_0xec21('0xf'));logger[_0xec21('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x2f15e7,'request\x20sent',JSON[_0xec21('0x11')](_0x4d478));if(_0x4d478[_0xec21('0x12')]){if(_0x4d478['error'][_0xec21('0x13')]===0x1f4){logger[_0xec21('0x12')](_0xec21('0xe'),_0x2f15e7,_0x4d478[_0xec21('0x12')][_0xec21('0x14')]);return _0x3d74a2(_0x4d478['error'][_0xec21('0x14')]);}logger['error'](_0xec21('0xe'),_0x2f15e7,_0x4d478[_0xec21('0x12')][_0xec21('0x14')]);return _0x2b1396(_0x4d478['error'][_0xec21('0x14')]);}else{logger[_0xec21('0x15')](_0xec21('0xe'),_0x2f15e7,_0xec21('0xf'));_0x2b1396(_0x4d478[_0xec21('0x16')][_0xec21('0x14')]);}})[_0xec21('0x17')](function(_0x350a53){logger['error'](_0xec21('0xe'),_0x2f15e7,_0x350a53);_0x3d74a2(_0x350a53);});});} \ No newline at end of file +var _0xfd20=['result','catch','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message'];(function(_0xc3c95,_0x2b4271){var _0x13b546=function(_0x5da826){while(--_0x5da826){_0xc3c95['push'](_0xc3c95['shift']());}};_0x13b546(++_0x2b4271);}(_0xfd20,0x66));var _0x0fd2=function(_0x9d679d,_0x4dd38a){_0x9d679d=_0x9d679d-0x0;var _0x3ce1dc=_0xfd20[_0x9d679d];return _0x3ce1dc;};'use strict';var _=require('lodash');var util=require(_0x0fd2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0fd2('0x1'));var fs=require('fs');var Redis=require(_0x0fd2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0fd2('0x3'));var logger=require('../../config/logger')(_0x0fd2('0x4'));var config=require(_0x0fd2('0x5'));var jayson=require(_0x0fd2('0x6'));var client=jayson[_0x0fd2('0x7')][_0x0fd2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d114c,_0x55467b,_0x32d460){return new BPromise(function(_0x15ba86,_0x24d6f4){return client[_0x0fd2('0x9')](_0x4d114c,_0x32d460)[_0x0fd2('0xa')](function(_0x195948){logger[_0x0fd2('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x55467b,_0x0fd2('0xc'));logger[_0x0fd2('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x55467b,_0x0fd2('0xc'),JSON['stringify'](_0x195948));if(_0x195948[_0x0fd2('0xe')]){if(_0x195948[_0x0fd2('0xe')][_0x0fd2('0xf')]===0x1f4){logger[_0x0fd2('0xe')](_0x0fd2('0x10'),_0x55467b,_0x195948[_0x0fd2('0xe')][_0x0fd2('0x11')]);return _0x24d6f4(_0x195948[_0x0fd2('0xe')]['message']);}logger['error'](_0x0fd2('0x10'),_0x55467b,_0x195948[_0x0fd2('0xe')][_0x0fd2('0x11')]);return _0x15ba86(_0x195948[_0x0fd2('0xe')]['message']);}else{logger[_0x0fd2('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x55467b,'request\x20sent');_0x15ba86(_0x195948[_0x0fd2('0x12')]['message']);}})[_0x0fd2('0x13')](function(_0x55e070){logger[_0x0fd2('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x55467b,_0x55e070);_0x24d6f4(_0x55e070);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index f516844..1fe6f12 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 _0x1194=['get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./pause.controller'];(function(_0x5d246e,_0x30caa1){var _0x3a118f=function(_0x32cee9){while(--_0x32cee9){_0x5d246e['push'](_0x5d246e['shift']());}};_0x3a118f(++_0x30caa1);}(_0x1194,0x1c4));var _0x4119=function(_0x24243b,_0x55c567){_0x24243b=_0x24243b-0x0;var _0x1a85ce=_0x1194[_0x24243b];return _0x1a85ce;};'use strict';var multer=require('multer');var util=require(_0x4119('0x0'));var path=require(_0x4119('0x1'));var timeout=require(_0x4119('0x2'));var express=require(_0x4119('0x3'));var router=express['Router']();var fs_extra=require(_0x4119('0x4'));var auth=require(_0x4119('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4119('0x6'));router[_0x4119('0x7')]('/',auth[_0x4119('0x8')](),controller['index']);router[_0x4119('0x7')](_0x4119('0x9'),auth[_0x4119('0x8')](),controller[_0x4119('0xa')]);router[_0x4119('0xb')]('/',auth['isAuthenticated'](),controller[_0x4119('0xc')]);router['put'](_0x4119('0x9'),auth[_0x4119('0x8')](),controller[_0x4119('0xd')]);router[_0x4119('0xe')]('/:id',auth[_0x4119('0x8')](),controller[_0x4119('0xf')]);module[_0x4119('0x10')]=router; \ No newline at end of file +var _0x805c=['index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0x805c,0x19a));var _0xc805=function(_0x3613e8,_0x40304d){_0x3613e8=_0x3613e8-0x0;var _0x587fa8=_0x805c[_0x3613e8];return _0x587fa8;};'use strict';var multer=require(_0xc805('0x0'));var util=require(_0xc805('0x1'));var path=require(_0xc805('0x2'));var timeout=require(_0xc805('0x3'));var express=require(_0xc805('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc805('0x5'));var interaction=require(_0xc805('0x6'));var config=require(_0xc805('0x7'));var controller=require(_0xc805('0x8'));router[_0xc805('0x9')]('/',auth['isAuthenticated'](),controller[_0xc805('0xa')]);router['get'](_0xc805('0xb'),auth['isAuthenticated'](),controller[_0xc805('0xc')]);router[_0xc805('0xd')]('/',auth[_0xc805('0xe')](),controller[_0xc805('0xf')]);router[_0xc805('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc805('0x11')]);router[_0xc805('0x12')](_0xc805('0xb'),auth[_0xc805('0xe')](),controller[_0xc805('0x13')]);module[_0xc805('0x14')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 459a947..ea0a2e5 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 _0x159d=['STRING','sequelize','exports'];(function(_0x24388b,_0x2bfa63){var _0x1a10d0=function(_0x5e539c){while(--_0x5e539c){_0x24388b['push'](_0x24388b['shift']());}};_0x1a10d0(++_0x2bfa63);}(_0x159d,0xd3));var _0xd159=function(_0x16e583,_0x31eceb){_0x16e583=_0x16e583-0x0;var _0x352683=_0x159d[_0x16e583];return _0x352683;};'use strict';var Sequelize=require(_0xd159('0x0'));module[_0xd159('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xd159('0x2')]}}; \ No newline at end of file +var _0x20ca=['name','STRING'];(function(_0x35a140,_0x3aeac6){var _0x30ab82=function(_0x15a7c3){while(--_0x15a7c3){_0x35a140['push'](_0x35a140['shift']());}};_0x30ab82(++_0x3aeac6);}(_0x20ca,0x193));var _0xa20c=function(_0x1708a6,_0x2f40c5){_0x1708a6=_0x1708a6-0x0;var _0x778b25=_0x20ca[_0x1708a6];return _0x778b25;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa20c('0x0')],'unique':_0xa20c('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index e28f54e..b1a9fec 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 _0x8fd4=['offset','set','Content-Range','reject','update','then','destroy','get','Pauses','UserProfileResource','error','stack','send','index','Pause','fieldName','type','key','model','map','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count'];(function(_0x183fae,_0x5cd92a){var _0x10a422=function(_0x5ac94b){while(--_0x5ac94b){_0x183fae['push'](_0x183fae['shift']());}};_0x10a422(++_0x5cd92a);}(_0x8fd4,0x1e7));var _0x48fd=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x8fd4[_0x2dadb9];return _0x2f0097;};'use strict';var emlformat=require(_0x48fd('0x0'));var rimraf=require(_0x48fd('0x1'));var zipdir=require(_0x48fd('0x2'));var jsonpatch=require(_0x48fd('0x3'));var rp=require(_0x48fd('0x4'));var moment=require(_0x48fd('0x5'));var BPromise=require(_0x48fd('0x6'));var Mustache=require(_0x48fd('0x7'));var util=require(_0x48fd('0x8'));var path=require(_0x48fd('0x9'));var sox=require(_0x48fd('0xa'));var csv=require(_0x48fd('0xb'));var ejs=require(_0x48fd('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x48fd('0xd'));var squel=require(_0x48fd('0xe'));var crypto=require(_0x48fd('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x48fd('0x10'));var toCsv=require(_0x48fd('0xb'));var querystring=require(_0x48fd('0x11'));var Papa=require(_0x48fd('0x12'));var Redis=require(_0x48fd('0x13'));var authService=require(_0x48fd('0x14'));var qs=require(_0x48fd('0x15'));var as=require(_0x48fd('0x16'));var hardwareService=require(_0x48fd('0x17'));var logger=require('../../config/logger')(_0x48fd('0x18'));var utils=require(_0x48fd('0x19'));var config=require(_0x48fd('0x1a'));var licenseUtil=require(_0x48fd('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3263f2,_0x19c2ed){_0x19c2ed=_0x19c2ed||0xcc;return function(_0x288a6f){if(_0x288a6f){return _0x3263f2[_0x48fd('0x1c')](_0x19c2ed);}return _0x3263f2[_0x48fd('0x1d')](_0x19c2ed)[_0x48fd('0x1e')]();};}function respondWithResult(_0x129cd6,_0x251008){_0x251008=_0x251008||0xc8;return function(_0x7ea043){if(_0x7ea043){return _0x129cd6[_0x48fd('0x1d')](_0x251008)[_0x48fd('0x1f')](_0x7ea043);}};}function respondWithFilteredResult(_0x28251d,_0xb58008){return function(_0x2e3632){if(_0x2e3632){var _0x13cf30=typeof _0xb58008['offset']==='undefined'&&typeof _0xb58008[_0x48fd('0x20')]===_0x48fd('0x21');var _0xafe172=_0x2e3632[_0x48fd('0x22')];var _0x44e18b=_0x13cf30?0x0:_0xb58008['offset'];var _0x32494a=_0x13cf30?_0x2e3632['count']:_0xb58008[_0x48fd('0x23')]+_0xb58008[_0x48fd('0x20')];var _0x59ef38;if(_0x32494a>=_0xafe172){_0x32494a=_0xafe172;_0x59ef38=0xc8;}else{_0x59ef38=0xce;}_0x28251d[_0x48fd('0x1d')](_0x59ef38);return _0x28251d[_0x48fd('0x24')](_0x48fd('0x25'),_0x44e18b+'-'+_0x32494a+'/'+_0xafe172)[_0x48fd('0x1f')](_0x2e3632);}return null;};}function patchUpdates(_0x41724a){return function(_0x521380){try{jsonpatch['apply'](_0x521380,_0x41724a,!![]);}catch(_0x1c1efc){return BPromise[_0x48fd('0x26')](_0x1c1efc);}return _0x521380['save']();};}function saveUpdates(_0x52fa37,_0x201c58){return function(_0x426017){if(_0x426017){return _0x426017[_0x48fd('0x27')](_0x52fa37)[_0x48fd('0x28')](function(_0x1c2789){return _0x1c2789;});}return null;};}function removeEntity(_0x261b1d,_0x446d0e){return function(_0x396a70){if(_0x396a70){return _0x396a70[_0x48fd('0x29')]()[_0x48fd('0x28')](function(){var _0x1f6977=_0x396a70[_0x48fd('0x2a')]({'plain':!![]});var _0x59c87e=_0x48fd('0x2b');return db[_0x48fd('0x2c')][_0x48fd('0x29')]({'where':{'type':_0x59c87e,'resourceId':_0x1f6977['id']}})[_0x48fd('0x28')](function(){return _0x396a70;});})['then'](function(){_0x261b1d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bd049,_0x4f3a5e){return function(_0x4a9e7b){if(!_0x4a9e7b){_0x1bd049['sendStatus'](0x194);}return _0x4a9e7b;};}function handleError(_0x3c348b,_0x5cdbd7){_0x5cdbd7=_0x5cdbd7||0x1f4;return function(_0x43e9db){logger[_0x48fd('0x2d')](_0x43e9db[_0x48fd('0x2e')]);if(_0x43e9db['name']){delete _0x43e9db['name'];}_0x3c348b[_0x48fd('0x1d')](_0x5cdbd7)[_0x48fd('0x2f')](_0x43e9db);};}exports[_0x48fd('0x30')]=function(_0xf1c2f7,_0x13be37){var _0x14d889={},_0x22c90d={},_0x2cffa1={'count':0x0,'rows':[]};var _0x54b147=_['map'](db[_0x48fd('0x31')]['rawAttributes'],function(_0x6a77f2){return{'name':_0x6a77f2[_0x48fd('0x32')],'type':_0x6a77f2[_0x48fd('0x33')][_0x48fd('0x34')]};});_0x22c90d[_0x48fd('0x35')]=_[_0x48fd('0x36')](_0x54b147,_0x48fd('0x37'));_0x22c90d[_0x48fd('0x38')]=_[_0x48fd('0x39')](_0xf1c2f7[_0x48fd('0x38')]);_0x22c90d[_0x48fd('0x3a')]=_['intersection'](_0x22c90d[_0x48fd('0x35')],_0x22c90d[_0x48fd('0x38')]);_0x14d889[_0x48fd('0x3b')]=_[_0x48fd('0x3c')](_0x22c90d[_0x48fd('0x35')],qs[_0x48fd('0x3d')](_0xf1c2f7[_0x48fd('0x38')][_0x48fd('0x3d')]));_0x14d889[_0x48fd('0x3b')]=_0x14d889[_0x48fd('0x3b')][_0x48fd('0x3e')]?_0x14d889[_0x48fd('0x3b')]:_0x22c90d[_0x48fd('0x35')];if(!_0xf1c2f7[_0x48fd('0x38')][_0x48fd('0x3f')](_0x48fd('0x40'))){_0x14d889['limit']=qs['limit'](_0xf1c2f7[_0x48fd('0x38')][_0x48fd('0x20')]);_0x14d889[_0x48fd('0x23')]=qs[_0x48fd('0x23')](_0xf1c2f7[_0x48fd('0x38')][_0x48fd('0x23')]);}_0x14d889['order']=qs['sort'](_0xf1c2f7[_0x48fd('0x38')][_0x48fd('0x41')]);_0x14d889[_0x48fd('0x42')]=qs[_0x48fd('0x3a')](_[_0x48fd('0x43')](_0xf1c2f7['query'],_0x22c90d[_0x48fd('0x3a')]),_0x54b147);if(_0xf1c2f7[_0x48fd('0x38')][_0x48fd('0x44')]){_0x14d889[_0x48fd('0x42')]=_[_0x48fd('0x45')](_0x14d889[_0x48fd('0x42')],{'$or':_[_0x48fd('0x36')](_0x54b147,function(_0x2d0d76){if(_0x2d0d76[_0x48fd('0x33')]!=='VIRTUAL'){var _0x1b6555={};_0x1b6555[_0x2d0d76['name']]={'$like':'%'+_0xf1c2f7['query'][_0x48fd('0x44')]+'%'};return _0x1b6555;}})});}_0x14d889=_[_0x48fd('0x45')]({},_0x14d889,_0xf1c2f7[_0x48fd('0x46')]);var _0x3730ca={'where':_0x14d889[_0x48fd('0x42')]};return db[_0x48fd('0x31')][_0x48fd('0x22')](_0x3730ca)['then'](function(_0x1e9c59){_0x2cffa1[_0x48fd('0x22')]=_0x1e9c59;if(_0xf1c2f7[_0x48fd('0x38')][_0x48fd('0x47')]){_0x14d889[_0x48fd('0x48')]=[{'all':!![]}];}return db[_0x48fd('0x31')][_0x48fd('0x49')](_0x14d889);})[_0x48fd('0x28')](function(_0x1dc0fc){_0x2cffa1[_0x48fd('0x4a')]=_0x1dc0fc;return _0x2cffa1;})['then'](respondWithFilteredResult(_0x13be37,_0x14d889))['catch'](handleError(_0x13be37,null));};exports['show']=function(_0xd325c8,_0x1e00c4){var _0x4b6774={'raw':!![],'where':{'id':_0xd325c8['params']['id']}},_0x481c11={};_0x481c11[_0x48fd('0x35')]=_[_0x48fd('0x39')](db['Pause'][_0x48fd('0x4b')]);_0x481c11[_0x48fd('0x38')]=_[_0x48fd('0x39')](_0xd325c8[_0x48fd('0x38')]);_0x481c11[_0x48fd('0x3a')]=_[_0x48fd('0x3c')](_0x481c11[_0x48fd('0x35')],_0x481c11[_0x48fd('0x38')]);_0x4b6774[_0x48fd('0x3b')]=_[_0x48fd('0x3c')](_0x481c11[_0x48fd('0x35')],qs[_0x48fd('0x3d')](_0xd325c8[_0x48fd('0x38')][_0x48fd('0x3d')]));_0x4b6774[_0x48fd('0x3b')]=_0x4b6774[_0x48fd('0x3b')][_0x48fd('0x3e')]?_0x4b6774[_0x48fd('0x3b')]:_0x481c11[_0x48fd('0x35')];if(_0xd325c8[_0x48fd('0x38')][_0x48fd('0x47')]){_0x4b6774[_0x48fd('0x48')]=[{'all':!![]}];}_0x4b6774=_['merge']({},_0x4b6774,_0xd325c8[_0x48fd('0x46')]);return db[_0x48fd('0x31')][_0x48fd('0x4c')](_0x4b6774)[_0x48fd('0x28')](handleEntityNotFound(_0x1e00c4,null))[_0x48fd('0x28')](respondWithResult(_0x1e00c4,null))[_0x48fd('0x4d')](handleError(_0x1e00c4,null));};exports['create']=function(_0x2eac84,_0x58146d){return db[_0x48fd('0x31')][_0x48fd('0x4e')](_0x2eac84[_0x48fd('0x4f')],{})[_0x48fd('0x28')](function(_0x1bdc4b){var _0x26768b=_0x2eac84[_0x48fd('0x50')][_0x48fd('0x2a')]({'plain':!![]});if(!_0x26768b)throw new Error(_0x48fd('0x51'));if(_0x26768b[_0x48fd('0x52')]===_0x48fd('0x50')){var _0x1fdc49=_0x1bdc4b[_0x48fd('0x2a')]({'plain':!![]});var _0x288b8c=_0x48fd('0x2b');return db['UserProfileSection'][_0x48fd('0x4c')]({'where':{'name':_0x288b8c,'userProfileId':_0x26768b[_0x48fd('0x53')]},'raw':!![]})[_0x48fd('0x28')](function(_0x11b1e2){if(_0x11b1e2&&_0x11b1e2[_0x48fd('0x54')]===0x0){return db['UserProfileResource'][_0x48fd('0x4e')]({'name':_0x1fdc49['name'],'resourceId':_0x1fdc49['id'],'type':_0x11b1e2[_0x48fd('0x37')],'sectionId':_0x11b1e2['id']},{})[_0x48fd('0x28')](function(){return _0x1bdc4b;});}else{return _0x1bdc4b;}})[_0x48fd('0x4d')](function(_0x586ed3){logger['error'](_0x48fd('0x55'),_0x586ed3);throw _0x586ed3;});}return _0x1bdc4b;})[_0x48fd('0x28')](respondWithResult(_0x58146d,0xc9))[_0x48fd('0x4d')](handleError(_0x58146d,null));};exports[_0x48fd('0x27')]=function(_0x2aedee,_0x490240){if(_0x2aedee[_0x48fd('0x4f')]['id']){delete _0x2aedee['body']['id'];}return db['Pause'][_0x48fd('0x4c')]({'where':{'id':_0x2aedee['params']['id']}})['then'](handleEntityNotFound(_0x490240,null))['then'](saveUpdates(_0x2aedee[_0x48fd('0x4f')],null))[_0x48fd('0x28')](respondWithResult(_0x490240,null))[_0x48fd('0x4d')](handleError(_0x490240,null));};exports[_0x48fd('0x29')]=function(_0x11c316,_0x543502){return db[_0x48fd('0x31')]['find']({'where':{'id':_0x11c316[_0x48fd('0x56')]['id']}})[_0x48fd('0x28')](handleEntityNotFound(_0x543502,null))[_0x48fd('0x28')](removeEntity(_0x543502,null))[_0x48fd('0x4d')](handleError(_0x543502,null));}; \ No newline at end of file +var _0xc314=['model','name','query','keys','attributes','intersection','fields','length','offset','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','Pause','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Pauses','error','stack','send','index','map','rawAttributes'];(function(_0x2e5a17,_0x558f0e){var _0x24f53d=function(_0x564eb5){while(--_0x564eb5){_0x2e5a17['push'](_0x2e5a17['shift']());}};_0x24f53d(++_0x558f0e);}(_0xc314,0xbd));var _0x4c31=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc314[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x4c31('0x0'));var rimraf=require(_0x4c31('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4c31('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4c31('0x3'));var Mustache=require('mustache');var util=require(_0x4c31('0x4'));var path=require(_0x4c31('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4c31('0x6'));var fs=require('fs');var fs_extra=require(_0x4c31('0x7'));var _=require(_0x4c31('0x8'));var squel=require(_0x4c31('0x9'));var crypto=require(_0x4c31('0xa'));var jsforce=require(_0x4c31('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4c31('0xc'));var querystring=require(_0x4c31('0xd'));var Papa=require(_0x4c31('0xe'));var Redis=require(_0x4c31('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4c31('0x10'));var as=require(_0x4c31('0x11'));var hardwareService=require(_0x4c31('0x12'));var logger=require(_0x4c31('0x13'))(_0x4c31('0x14'));var utils=require('../../config/utils');var config=require(_0x4c31('0x15'));var licenseUtil=require(_0x4c31('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x656f8,_0x326ef7){_0x326ef7=_0x326ef7||0xcc;return function(_0xa479f3){if(_0xa479f3){return _0x656f8[_0x4c31('0x17')](_0x326ef7);}return _0x656f8['status'](_0x326ef7)[_0x4c31('0x18')]();};}function respondWithResult(_0x4c3361,_0xa0245d){_0xa0245d=_0xa0245d||0xc8;return function(_0x17ef20){if(_0x17ef20){return _0x4c3361[_0x4c31('0x19')](_0xa0245d)[_0x4c31('0x1a')](_0x17ef20);}};}function respondWithFilteredResult(_0x399a5d,_0x7fbeee){return function(_0x34ab0d){if(_0x34ab0d){var _0x61c284=typeof _0x7fbeee['offset']===_0x4c31('0x1b')&&typeof _0x7fbeee[_0x4c31('0x1c')]===_0x4c31('0x1b');var _0x3db238=_0x34ab0d[_0x4c31('0x1d')];var _0xac205=_0x61c284?0x0:_0x7fbeee['offset'];var _0x45cd6d=_0x61c284?_0x34ab0d[_0x4c31('0x1d')]:_0x7fbeee['offset']+_0x7fbeee[_0x4c31('0x1c')];var _0x275045;if(_0x45cd6d>=_0x3db238){_0x45cd6d=_0x3db238;_0x275045=0xc8;}else{_0x275045=0xce;}_0x399a5d[_0x4c31('0x19')](_0x275045);return _0x399a5d[_0x4c31('0x1e')]('Content-Range',_0xac205+'-'+_0x45cd6d+'/'+_0x3db238)[_0x4c31('0x1a')](_0x34ab0d);}return null;};}function patchUpdates(_0x594b0c){return function(_0x23a818){try{jsonpatch[_0x4c31('0x1f')](_0x23a818,_0x594b0c,!![]);}catch(_0x39f3c6){return BPromise[_0x4c31('0x20')](_0x39f3c6);}return _0x23a818[_0x4c31('0x21')]();};}function saveUpdates(_0x4dcb70,_0x4e1b2a){return function(_0x38ddba){if(_0x38ddba){return _0x38ddba[_0x4c31('0x22')](_0x4dcb70)[_0x4c31('0x23')](function(_0x27f187){return _0x27f187;});}return null;};}function removeEntity(_0x42c81e,_0x15f973){return function(_0x45ce37){if(_0x45ce37){return _0x45ce37[_0x4c31('0x24')]()['then'](function(){var _0x256aa2=_0x45ce37[_0x4c31('0x25')]({'plain':!![]});var _0x416ab1=_0x4c31('0x26');return db['UserProfileResource'][_0x4c31('0x24')]({'where':{'type':_0x416ab1,'resourceId':_0x256aa2['id']}})[_0x4c31('0x23')](function(){return _0x45ce37;});})[_0x4c31('0x23')](function(){_0x42c81e[_0x4c31('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x416a94,_0x16a0c1){return function(_0x364630){if(!_0x364630){_0x416a94[_0x4c31('0x17')](0x194);}return _0x364630;};}function handleError(_0x5e27b9,_0x3a1b27){_0x3a1b27=_0x3a1b27||0x1f4;return function(_0x379616){logger[_0x4c31('0x27')](_0x379616[_0x4c31('0x28')]);if(_0x379616['name']){delete _0x379616['name'];}_0x5e27b9[_0x4c31('0x19')](_0x3a1b27)[_0x4c31('0x29')](_0x379616);};}exports[_0x4c31('0x2a')]=function(_0xce57ce,_0x183f3f){var _0x48b8d6={},_0x3ac98b={},_0x2800b4={'count':0x0,'rows':[]};var _0x3da062=_[_0x4c31('0x2b')](db['Pause'][_0x4c31('0x2c')],function(_0x398b6c){return{'name':_0x398b6c['fieldName'],'type':_0x398b6c['type']['key']};});_0x3ac98b[_0x4c31('0x2d')]=_['map'](_0x3da062,_0x4c31('0x2e'));_0x3ac98b[_0x4c31('0x2f')]=_[_0x4c31('0x30')](_0xce57ce[_0x4c31('0x2f')]);_0x3ac98b['filters']=_['intersection'](_0x3ac98b['model'],_0x3ac98b[_0x4c31('0x2f')]);_0x48b8d6[_0x4c31('0x31')]=_[_0x4c31('0x32')](_0x3ac98b['model'],qs[_0x4c31('0x33')](_0xce57ce[_0x4c31('0x2f')]['fields']));_0x48b8d6['attributes']=_0x48b8d6[_0x4c31('0x31')][_0x4c31('0x34')]?_0x48b8d6['attributes']:_0x3ac98b[_0x4c31('0x2d')];if(!_0xce57ce[_0x4c31('0x2f')]['hasOwnProperty']('nolimit')){_0x48b8d6[_0x4c31('0x1c')]=qs[_0x4c31('0x1c')](_0xce57ce['query'][_0x4c31('0x1c')]);_0x48b8d6[_0x4c31('0x35')]=qs[_0x4c31('0x35')](_0xce57ce[_0x4c31('0x2f')][_0x4c31('0x35')]);}_0x48b8d6['order']=qs[_0x4c31('0x36')](_0xce57ce[_0x4c31('0x2f')][_0x4c31('0x36')]);_0x48b8d6[_0x4c31('0x37')]=qs['filters'](_['pick'](_0xce57ce[_0x4c31('0x2f')],_0x3ac98b[_0x4c31('0x38')]),_0x3da062);if(_0xce57ce['query'][_0x4c31('0x39')]){_0x48b8d6[_0x4c31('0x37')]=_['merge'](_0x48b8d6[_0x4c31('0x37')],{'$or':_[_0x4c31('0x2b')](_0x3da062,function(_0xe22ac8){if(_0xe22ac8['type']!==_0x4c31('0x3a')){var _0x2a528c={};_0x2a528c[_0xe22ac8[_0x4c31('0x2e')]]={'$like':'%'+_0xce57ce['query'][_0x4c31('0x39')]+'%'};return _0x2a528c;}})});}_0x48b8d6=_[_0x4c31('0x3b')]({},_0x48b8d6,_0xce57ce[_0x4c31('0x3c')]);var _0x6e66ef={'where':_0x48b8d6[_0x4c31('0x37')]};return db['Pause']['count'](_0x6e66ef)[_0x4c31('0x23')](function(_0x44f19d){_0x2800b4[_0x4c31('0x1d')]=_0x44f19d;if(_0xce57ce[_0x4c31('0x2f')][_0x4c31('0x3d')]){_0x48b8d6[_0x4c31('0x3e')]=[{'all':!![]}];}return db[_0x4c31('0x3f')][_0x4c31('0x40')](_0x48b8d6);})[_0x4c31('0x23')](function(_0x296210){_0x2800b4[_0x4c31('0x41')]=_0x296210;return _0x2800b4;})[_0x4c31('0x23')](respondWithFilteredResult(_0x183f3f,_0x48b8d6))[_0x4c31('0x42')](handleError(_0x183f3f,null));};exports[_0x4c31('0x43')]=function(_0x310793,_0x37d418){var _0x322e08={'raw':!![],'where':{'id':_0x310793[_0x4c31('0x44')]['id']}},_0x197d19={};_0x197d19[_0x4c31('0x2d')]=_[_0x4c31('0x30')](db[_0x4c31('0x3f')]['rawAttributes']);_0x197d19[_0x4c31('0x2f')]=_[_0x4c31('0x30')](_0x310793['query']);_0x197d19[_0x4c31('0x38')]=_[_0x4c31('0x32')](_0x197d19['model'],_0x197d19[_0x4c31('0x2f')]);_0x322e08['attributes']=_[_0x4c31('0x32')](_0x197d19['model'],qs[_0x4c31('0x33')](_0x310793[_0x4c31('0x2f')][_0x4c31('0x33')]));_0x322e08['attributes']=_0x322e08[_0x4c31('0x31')]['length']?_0x322e08[_0x4c31('0x31')]:_0x197d19[_0x4c31('0x2d')];if(_0x310793[_0x4c31('0x2f')][_0x4c31('0x3d')]){_0x322e08[_0x4c31('0x3e')]=[{'all':!![]}];}_0x322e08=_['merge']({},_0x322e08,_0x310793['options']);return db[_0x4c31('0x3f')][_0x4c31('0x45')](_0x322e08)[_0x4c31('0x23')](handleEntityNotFound(_0x37d418,null))[_0x4c31('0x23')](respondWithResult(_0x37d418,null))[_0x4c31('0x42')](handleError(_0x37d418,null));};exports[_0x4c31('0x46')]=function(_0x17b9c7,_0x4a5558){return db[_0x4c31('0x3f')][_0x4c31('0x46')](_0x17b9c7[_0x4c31('0x47')],{})[_0x4c31('0x23')](function(_0x4d2ace){var _0x38bd30=_0x17b9c7['user']['get']({'plain':!![]});if(!_0x38bd30)throw new Error(_0x4c31('0x48'));if(_0x38bd30[_0x4c31('0x49')]==='user'){var _0x536bde=_0x4d2ace[_0x4c31('0x25')]({'plain':!![]});var _0x5113bb=_0x4c31('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x5113bb,'userProfileId':_0x38bd30[_0x4c31('0x4a')]},'raw':!![]})[_0x4c31('0x23')](function(_0x3093dd){if(_0x3093dd&&_0x3093dd[_0x4c31('0x4b')]===0x0){return db[_0x4c31('0x4c')][_0x4c31('0x46')]({'name':_0x536bde[_0x4c31('0x2e')],'resourceId':_0x536bde['id'],'type':_0x3093dd[_0x4c31('0x2e')],'sectionId':_0x3093dd['id']},{})['then'](function(){return _0x4d2ace;});}else{return _0x4d2ace;}})[_0x4c31('0x42')](function(_0x220912){logger[_0x4c31('0x27')](_0x4c31('0x4d'),_0x220912);throw _0x220912;});}return _0x4d2ace;})[_0x4c31('0x23')](respondWithResult(_0x4a5558,0xc9))[_0x4c31('0x42')](handleError(_0x4a5558,null));};exports[_0x4c31('0x22')]=function(_0x3e9afd,_0x1619bc){if(_0x3e9afd[_0x4c31('0x47')]['id']){delete _0x3e9afd['body']['id'];}return db[_0x4c31('0x3f')][_0x4c31('0x45')]({'where':{'id':_0x3e9afd[_0x4c31('0x44')]['id']}})[_0x4c31('0x23')](handleEntityNotFound(_0x1619bc,null))[_0x4c31('0x23')](saveUpdates(_0x3e9afd[_0x4c31('0x47')],null))[_0x4c31('0x23')](respondWithResult(_0x1619bc,null))[_0x4c31('0x42')](handleError(_0x1619bc,null));};exports[_0x4c31('0x24')]=function(_0x2c84fa,_0x2c9343){return db[_0x4c31('0x3f')]['find']({'where':{'id':_0x2c84fa[_0x4c31('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c9343,null))['then'](removeEntity(_0x2c9343,null))['catch'](handleError(_0x2c9343,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 68669bd..1fe2c42 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2f6e47,_0x40ba6b){_0x2f6e47=_0x2f6e47-0x0;var _0x29c331=_0x7fbe[_0x2f6e47];return _0x29c331;};'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 _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x5b29b6,_0x2083e3){var _0x1633d8=function(_0x2a674f){while(--_0x2a674f){_0x5b29b6['push'](_0x5b29b6['shift']());}};_0x1633d8(++_0x2083e3);}(_0xe14b,0x93));var _0xbe14=function(_0x455680,_0x3891d0){_0x455680=_0x455680-0x0;var _0x19d21c=_0xe14b[_0x455680];return _0x19d21c;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 17942ca..a2ea496 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(_0x5ed40b,_0x2b743d){var _0x505c2e=function(_0x4dfa89){while(--_0x4dfa89){_0x5ed40b['push'](_0x5ed40b['shift']());}};_0x505c2e(++_0x2b743d);}(_0xb10b,0x12a));var _0xbb10=function(_0x488616,_0x516a25){_0x488616=_0x488616-0x0;var _0x217fb3=_0xb10b[_0x488616];return _0x217fb3;};'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(_0x5a7a78,_0x163d3e){var _0x1ad79e=function(_0x2ecc69){while(--_0x2ecc69){_0x5a7a78['push'](_0x5a7a78['shift']());}};_0x1ad79e(++_0x163d3e);}(_0xb10b,0x12a));var _0xbb10=function(_0x5cfa4f,_0x4d8fe9){_0x5cfa4f=_0x5cfa4f-0x0;var _0x2e5acd=_0xb10b[_0x5cfa4f];return _0x2e5acd;};'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 8fd0d60..db8eaee 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 _0x3667=['download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download'];(function(_0x5ec548,_0xf21387){var _0x4093fb=function(_0xa22522){while(--_0xa22522){_0x5ec548['push'](_0x5ec548['shift']());}};_0x4093fb(++_0xf21387);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7366('0x0'));var util=require(_0x7366('0x1'));var path=require(_0x7366('0x2'));var timeout=require(_0x7366('0x3'));var express=require(_0x7366('0x4'));var router=express['Router']();var fs_extra=require(_0x7366('0x5'));var auth=require(_0x7366('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7366('0x7'));var controller=require(_0x7366('0x8'));router[_0x7366('0x9')]('/',auth[_0x7366('0xa')](),controller[_0x7366('0xb')]);router['get'](_0x7366('0xc'),controller[_0x7366('0xd')]);router[_0x7366('0x9')](_0x7366('0xe'),auth[_0x7366('0xa')](),controller[_0x7366('0xf')]);router[_0x7366('0x9')](_0x7366('0x10'),auth[_0x7366('0xa')](),controller[_0x7366('0x11')]);var upload=multer({'storage':multer[_0x7366('0x12')]({'destination':function(_0x2d7e38,_0x57ea7f,_0x425ee4){_0x425ee4(null,path[_0x7366('0x13')](config[_0x7366('0x14')],_0x7366('0x15')));},'filename':function(_0x25a565,_0xd5bac8,_0x3e3a73){_0xd5bac8[_0x7366('0x16')]=_0xd5bac8[_0x7366('0x16')][_0x7366('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3e3a73(null,util[_0x7366('0x18')](_0x7366('0x19'),path[_0x7366('0x1a')](_0xd5bac8[_0x7366('0x16')],path[_0x7366('0x1b')](_0xd5bac8['originalname'])),Date[_0x7366('0x1c')](),path[_0x7366('0x1b')](_0xd5bac8[_0x7366('0x16')])));}})});router[_0x7366('0x1d')]('/',upload[_0x7366('0x1e')](_0x7366('0x1f')),controller[_0x7366('0x20')]);router[_0x7366('0x1d')](_0x7366('0xc'),controller[_0x7366('0x21')]);router[_0x7366('0x22')]('/:id',auth[_0x7366('0xa')](),controller['update']);router[_0x7366('0x23')](_0x7366('0xe'),auth[_0x7366('0xa')](),controller['delete']);module[_0x7366('0x24')]=router; \ No newline at end of file +var _0x4bc3=['single','file','webhookPost','put','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','/:id','show','/:id/download','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','post'];(function(_0x396a26,_0x58bce8){var _0x824089=function(_0x2117fc){while(--_0x2117fc){_0x396a26['push'](_0x396a26['shift']());}};_0x824089(++_0x58bce8);}(_0x4bc3,0x16e));var _0x34bc=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x4bc3[_0x2070da];return _0x4f9fe1;};'use strict';var multer=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var path=require('path');var timeout=require(_0x34bc('0x2'));var express=require(_0x34bc('0x3'));var router=express['Router']();var fs_extra=require(_0x34bc('0x4'));var auth=require(_0x34bc('0x5'));var interaction=require(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var controller=require(_0x34bc('0x8'));router[_0x34bc('0x9')]('/',auth[_0x34bc('0xa')](),controller['index']);router[_0x34bc('0x9')]('/webhook',controller['webhookGet']);router[_0x34bc('0x9')](_0x34bc('0xb'),auth[_0x34bc('0xa')](),controller[_0x34bc('0xc')]);router[_0x34bc('0x9')](_0x34bc('0xd'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x34bc('0xe')]({'destination':function(_0x33025c,_0x2a35f3,_0x5a608a){_0x5a608a(null,path[_0x34bc('0xf')](config['root'],_0x34bc('0x10')));},'filename':function(_0x124b87,_0x164fb2,_0x536ebd){_0x164fb2[_0x34bc('0x11')]=_0x164fb2['originalname'][_0x34bc('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x536ebd(null,util[_0x34bc('0x13')](_0x34bc('0x14'),path['basename'](_0x164fb2['originalname'],path[_0x34bc('0x15')](_0x164fb2['originalname'])),Date[_0x34bc('0x16')](),path[_0x34bc('0x15')](_0x164fb2[_0x34bc('0x11')])));}})});router[_0x34bc('0x17')]('/',upload[_0x34bc('0x18')](_0x34bc('0x19')),controller['upload']);router['post']('/webhook',controller[_0x34bc('0x1a')]);router[_0x34bc('0x1b')](_0x34bc('0xb'),auth[_0x34bc('0xa')](),controller['update']);router[_0x34bc('0x1c')](_0x34bc('0xb'),auth['isAuthenticated'](),controller[_0x34bc('0x1c')]);module[_0x34bc('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index fbd5f9d..a478851 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 _0x6a33=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0x4eb18d,_0x2288b7){var _0x5277cb=function(_0x154ee6){while(--_0x154ee6){_0x4eb18d['push'](_0x4eb18d['shift']());}};_0x5277cb(++_0x2288b7);}(_0x6a33,0x171));var _0x36a3=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x6a33[_0xaa0309];return _0x5de7ce;};'use strict';var Sequelize=require(_0x36a3('0x0'));module[_0x36a3('0x1')]={'name':{'type':Sequelize[_0x36a3('0x2')]},'type':{'type':Sequelize[_0x36a3('0x3')](_0x36a3('0x4'),'script')},'description':{'type':Sequelize[_0x36a3('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x36a3('0x2')],'comment':_0x36a3('0x6')},'active':{'type':Sequelize[_0x36a3('0x7')],'defaultValue':0x0,'comment':_0x36a3('0x8')},'sidebar':{'type':Sequelize[_0x36a3('0x3')](_0x36a3('0x9'),_0x36a3('0xa'),'always','never'),'defaultValue':_0x36a3('0xb'),'comment':_0x36a3('0xc')},'icon':{'type':Sequelize[_0x36a3('0x2')]},'adminUrl':{'type':Sequelize[_0x36a3('0x2')]},'agentUrl':{'type':Sequelize[_0x36a3('0x2')]},'scriptName':{'type':Sequelize[_0x36a3('0x2')]},'scriptPath':{'type':Sequelize[_0x36a3('0x2')]}}; \ No newline at end of file +var _0x332c=['BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x2ab431,_0x5ee971){var _0x47278e=function(_0xf157ab){while(--_0xf157ab){_0x2ab431['push'](_0x2ab431['shift']());}};_0x47278e(++_0x5ee971);}(_0x332c,0x1db));var _0xc332=function(_0x469e57,_0x45b860){_0x469e57=_0x469e57-0x0;var _0x5de368=_0x332c[_0x469e57];return _0x5de368;};'use strict';var Sequelize=require(_0xc332('0x0'));module[_0xc332('0x1')]={'name':{'type':Sequelize[_0xc332('0x2')]},'type':{'type':Sequelize['ENUM'](_0xc332('0x3'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xc332('0x4')]},'path':{'type':Sequelize[_0xc332('0x2')],'comment':_0xc332('0x5')},'active':{'type':Sequelize[_0xc332('0x6')],'defaultValue':0x0,'comment':_0xc332('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0xc332('0x8'),_0xc332('0x9'),_0xc332('0xa'),_0xc332('0xb')),'defaultValue':'always','comment':_0xc332('0xc')},'icon':{'type':Sequelize[_0xc332('0x2')]},'adminUrl':{'type':Sequelize[_0xc332('0x2')]},'agentUrl':{'type':Sequelize[_0xc332('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xc332('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 45ecf20..b1e2e65 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 _0x2d42=['include','findAll','rows','show','params','keys','length','includeAll','options','find','catch','join','root','server/files/plugins','format','basename','createWriteStream','zip','warning','ENOENT','Sequelize','Error','error','pipe','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','info','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','admin','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','download','statusCode','webhookPost','http://localhost:','rimraf','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','UserProfileResource','stack','name','send','map','Plugin','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','filter','merge','where','VIRTUAL'];(function(_0x2d7747,_0x431871){var _0xe4f41a=function(_0x3cd214){while(--_0x3cd214){_0x2d7747['push'](_0x2d7747['shift']());}};_0xe4f41a(++_0x431871);}(_0x2d42,0xff));var _0x22d4=function(_0x2804f0,_0x38d0a9){_0x2804f0=_0x2804f0-0x0;var _0x4437d3=_0x2d42[_0x2804f0];return _0x4437d3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x22d4('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(_0x22d4('0x1'));var util=require(_0x22d4('0x2'));var path=require(_0x22d4('0x3'));var sox=require(_0x22d4('0x4'));var csv=require(_0x22d4('0x5'));var ejs=require(_0x22d4('0x6'));var fs=require('fs');var fs_extra=require(_0x22d4('0x7'));var _=require(_0x22d4('0x8'));var squel=require(_0x22d4('0x9'));var crypto=require(_0x22d4('0xa'));var jsforce=require(_0x22d4('0xb'));var deskjs=require(_0x22d4('0xc'));var toCsv=require(_0x22d4('0x5'));var querystring=require(_0x22d4('0xd'));var Papa=require('papaparse');var extract=require(_0x22d4('0xe'));var rimraf=require(_0x22d4('0x0'));var archiver=require(_0x22d4('0xf'));var Redis=require(_0x22d4('0x10'));var authService=require(_0x22d4('0x11'));var qs=require(_0x22d4('0x12'));var as=require(_0x22d4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x22d4('0x14'));var config=require(_0x22d4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x22d4('0x16'))['db'];config['redis']=_['defaults'](config[_0x22d4('0x17')],{'host':_0x22d4('0x18'),'port':0x18eb});var socket=require(_0x22d4('0x19'))(new Redis(config['redis']));require(_0x22d4('0x1a'))[_0x22d4('0x1b')](socket);function respondWithStatusCode(_0xc274c0,_0x5bc16d){_0x5bc16d=_0x5bc16d||0xcc;return function(_0xcb9f20){if(_0xcb9f20){return _0xc274c0[_0x22d4('0x1c')](_0x5bc16d);}return _0xc274c0[_0x22d4('0x1d')](_0x5bc16d)[_0x22d4('0x1e')]();};}function respondWithResult(_0x586a70,_0x76e3c7){_0x76e3c7=_0x76e3c7||0xc8;return function(_0x390c27){if(_0x390c27){return _0x586a70['status'](_0x76e3c7)[_0x22d4('0x1f')](_0x390c27);}};}function respondWithFilteredResult(_0x217c0e,_0x1a74d2){return function(_0x4f1e35){if(_0x4f1e35){var _0xaf13b6=typeof _0x1a74d2[_0x22d4('0x20')]===_0x22d4('0x21')&&typeof _0x1a74d2[_0x22d4('0x22')]===_0x22d4('0x21');var _0x4aabd5=_0x4f1e35[_0x22d4('0x23')];var _0x2db801=_0xaf13b6?0x0:_0x1a74d2['offset'];var _0x4cd64c=_0xaf13b6?_0x4f1e35[_0x22d4('0x23')]:_0x1a74d2[_0x22d4('0x20')]+_0x1a74d2[_0x22d4('0x22')];var _0x1d8e8e;if(_0x4cd64c>=_0x4aabd5){_0x4cd64c=_0x4aabd5;_0x1d8e8e=0xc8;}else{_0x1d8e8e=0xce;}_0x217c0e['status'](_0x1d8e8e);return _0x217c0e[_0x22d4('0x24')]('Content-Range',_0x2db801+'-'+_0x4cd64c+'/'+_0x4aabd5)[_0x22d4('0x1f')](_0x4f1e35);}return null;};}function patchUpdates(_0x4441cb){return function(_0x2f7381){try{jsonpatch[_0x22d4('0x25')](_0x2f7381,_0x4441cb,!![]);}catch(_0x431dfb){return BPromise[_0x22d4('0x26')](_0x431dfb);}return _0x2f7381[_0x22d4('0x27')]();};}function saveUpdates(_0x201bed,_0x3339ca){return function(_0x229db3){if(_0x229db3){return _0x229db3[_0x22d4('0x28')](_0x201bed)['then'](function(_0x5723c3){return _0x5723c3;});}return null;};}function removeEntity(_0x2f6869,_0x67f304){return function(_0xbc7b91){if(_0xbc7b91){return _0xbc7b91[_0x22d4('0x29')]()[_0x22d4('0x2a')](function(){var _0x4a07c8=_0xbc7b91['get']({'plain':!![]});var _0x42407c='Plugins';return db[_0x22d4('0x2b')]['destroy']({'where':{'type':_0x42407c,'resourceId':_0x4a07c8['id']}})[_0x22d4('0x2a')](function(){return _0xbc7b91;});})['then'](function(){_0x2f6869[_0x22d4('0x1d')](0xcc)[_0x22d4('0x1e')]();});}};}function handleEntityNotFound(_0x13e3d7,_0x616fed){return function(_0x3f2498){if(!_0x3f2498){_0x13e3d7[_0x22d4('0x1c')](0x194);}return _0x3f2498;};}function handleError(_0x5ab1bf,_0x2305b2){_0x2305b2=_0x2305b2||0x1f4;return function(_0x3e80d0){logger['error'](_0x3e80d0[_0x22d4('0x2c')]);if(_0x3e80d0[_0x22d4('0x2d')]){delete _0x3e80d0[_0x22d4('0x2d')];}_0x5ab1bf[_0x22d4('0x1d')](_0x2305b2)[_0x22d4('0x2e')](_0x3e80d0);};}exports['index']=function(_0x1352dc,_0x3a249e){var _0x3e1119={},_0x2a208f={},_0x3390e5={'count':0x0,'rows':[]};var _0x3b2ce9=_[_0x22d4('0x2f')](db[_0x22d4('0x30')][_0x22d4('0x31')],function(_0x3b75e9){return{'name':_0x3b75e9['fieldName'],'type':_0x3b75e9[_0x22d4('0x32')][_0x22d4('0x33')]};});_0x2a208f[_0x22d4('0x34')]=_['map'](_0x3b2ce9,'name');_0x2a208f[_0x22d4('0x35')]=_['keys'](_0x1352dc[_0x22d4('0x35')]);_0x2a208f[_0x22d4('0x36')]=_['intersection'](_0x2a208f['model'],_0x2a208f[_0x22d4('0x35')]);_0x3e1119[_0x22d4('0x37')]=_[_0x22d4('0x38')](_0x2a208f[_0x22d4('0x34')],qs[_0x22d4('0x39')](_0x1352dc[_0x22d4('0x35')]['fields']));_0x3e1119['attributes']=_0x3e1119[_0x22d4('0x37')]['length']?_0x3e1119['attributes']:_0x2a208f[_0x22d4('0x34')];if(!_0x1352dc[_0x22d4('0x35')][_0x22d4('0x3a')]('nolimit')){_0x3e1119['limit']=qs[_0x22d4('0x22')](_0x1352dc['query'][_0x22d4('0x22')]);_0x3e1119[_0x22d4('0x20')]=qs[_0x22d4('0x20')](_0x1352dc[_0x22d4('0x35')][_0x22d4('0x20')]);}_0x3e1119['order']=qs['sort'](_0x1352dc['query']['sort']);_0x3e1119['where']=qs[_0x22d4('0x36')](_['pick'](_0x1352dc['query'],_0x2a208f['filters']),_0x3b2ce9);if(_0x1352dc[_0x22d4('0x35')][_0x22d4('0x3b')]){_0x3e1119['where']=_[_0x22d4('0x3c')](_0x3e1119[_0x22d4('0x3d')],{'$or':_[_0x22d4('0x2f')](_0x3b2ce9,function(_0xf40687){if(_0xf40687[_0x22d4('0x32')]!==_0x22d4('0x3e')){var _0x4f4139={};_0x4f4139[_0xf40687[_0x22d4('0x2d')]]={'$like':'%'+_0x1352dc[_0x22d4('0x35')][_0x22d4('0x3b')]+'%'};return _0x4f4139;}})});}_0x3e1119=_[_0x22d4('0x3c')]({},_0x3e1119,_0x1352dc['options']);var _0x3e2d8d={'where':_0x3e1119['where']};return db[_0x22d4('0x30')]['count'](_0x3e2d8d)[_0x22d4('0x2a')](function(_0x3b3ba5){_0x3390e5['count']=_0x3b3ba5;if(_0x1352dc[_0x22d4('0x35')]['includeAll']){_0x3e1119[_0x22d4('0x3f')]=[{'all':!![]}];}return db[_0x22d4('0x30')][_0x22d4('0x40')](_0x3e1119);})[_0x22d4('0x2a')](function(_0x37dac6){_0x3390e5[_0x22d4('0x41')]=_0x37dac6;return _0x3390e5;})[_0x22d4('0x2a')](respondWithFilteredResult(_0x3a249e,_0x3e1119))['catch'](handleError(_0x3a249e,null));};exports[_0x22d4('0x42')]=function(_0xe36808,_0x5e3e14){var _0x25e0ca={'raw':!![],'where':{'id':_0xe36808[_0x22d4('0x43')]['id']}},_0x1d3a6b={};_0x1d3a6b[_0x22d4('0x34')]=_[_0x22d4('0x44')](db['Plugin'][_0x22d4('0x31')]);_0x1d3a6b[_0x22d4('0x35')]=_[_0x22d4('0x44')](_0xe36808[_0x22d4('0x35')]);_0x1d3a6b[_0x22d4('0x36')]=_[_0x22d4('0x38')](_0x1d3a6b[_0x22d4('0x34')],_0x1d3a6b[_0x22d4('0x35')]);_0x25e0ca[_0x22d4('0x37')]=_[_0x22d4('0x38')](_0x1d3a6b[_0x22d4('0x34')],qs['fields'](_0xe36808['query'][_0x22d4('0x39')]));_0x25e0ca[_0x22d4('0x37')]=_0x25e0ca['attributes'][_0x22d4('0x45')]?_0x25e0ca[_0x22d4('0x37')]:_0x1d3a6b['model'];if(_0xe36808[_0x22d4('0x35')][_0x22d4('0x46')]){_0x25e0ca['include']=[{'all':!![]}];}_0x25e0ca=_[_0x22d4('0x3c')]({},_0x25e0ca,_0xe36808[_0x22d4('0x47')]);return db[_0x22d4('0x30')][_0x22d4('0x48')](_0x25e0ca)['then'](handleEntityNotFound(_0x5e3e14,null))[_0x22d4('0x2a')](respondWithResult(_0x5e3e14,null))[_0x22d4('0x49')](handleError(_0x5e3e14,null));};exports['download']=function(_0x27b7d8,_0x1a0475,_0x30bce3){return db[_0x22d4('0x30')][_0x22d4('0x48')]({'where':{'id':_0x27b7d8[_0x22d4('0x43')]['id']},'attributes':[_0x22d4('0x2d'),_0x22d4('0x3')],'raw':!![]})[_0x22d4('0x2a')](handleEntityNotFound(_0x1a0475,null))[_0x22d4('0x2a')](function(_0x142c70){if(_0x142c70){var _0x4bfc1f=path[_0x22d4('0x4a')](config[_0x22d4('0x4b')],_0x22d4('0x4c'),util[_0x22d4('0x4d')]('%s.zip',path[_0x22d4('0x4e')](_0x142c70[_0x22d4('0x3')])));var _0x4e6a81=fs[_0x22d4('0x4f')](_0x4bfc1f);var _0x547121=archiver(_0x22d4('0x50'),{'zlib':{'level':0x9}});_0x547121['on'](_0x22d4('0x51'),function(_0x5b83ee){if(_0x5b83ee['code']===_0x22d4('0x52')){logger['error'](_0x5b83ee);}else{throw new db[(_0x22d4('0x53'))][(_0x22d4('0x54'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x547121['on'](_0x22d4('0x55'),function(_0x256382){throw new db[(_0x22d4('0x53'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x547121[_0x22d4('0x56')](_0x4e6a81);_0x547121['glob'](_0x22d4('0x57'),{'cwd':path[_0x22d4('0x4a')](config[_0x22d4('0x4b')],_0x22d4('0x4c'),path[_0x22d4('0x58')](_0x142c70[_0x22d4('0x3')])),'ignore':[path['join'](path[_0x22d4('0x4e')](_0x142c70[_0x22d4('0x3')]),_0x22d4('0x59')),path[_0x22d4('0x4a')](path['basename'](_0x142c70[_0x22d4('0x3')]),_0x22d4('0x5a'))],'nodir':!![]})[_0x22d4('0x5b')]();_0x4e6a81['on'](_0x22d4('0x5c'),function(){if(!fs['existsSync'](_0x4bfc1f)){throw new db[(_0x22d4('0x53'))][(_0x22d4('0x54'))]('Plugin\x20not\x20found');}return _0x1a0475['download'](_0x4bfc1f,util['format']('%s.zip',path[_0x22d4('0x4e')](_0x142c70[_0x22d4('0x3')])),function(_0x2cc409){if(_0x2cc409){throw new db[(_0x22d4('0x53'))][(_0x22d4('0x54'))](_0x22d4('0x5d'));}fs['unlinkSync'](_0x4bfc1f);logger['info'](_0x22d4('0x5e'));logger[_0x22d4('0x5f')]('Temporary\x20file\x20removed');});});}return null;})[_0x22d4('0x49')](handleError(_0x1a0475,null));};exports['upload']=function(_0x17fe1f,_0x53ae35,_0x2cbe31){var _0x39d85d=path[_0x22d4('0x4e')](_0x17fe1f[_0x22d4('0x60')][_0x22d4('0x61')],path[_0x22d4('0x62')](_0x17fe1f[_0x22d4('0x60')]['filename']));var _0x402a92=path['join'](config[_0x22d4('0x4b')],'server/files/plugins',_0x17fe1f[_0x22d4('0x60')]['filename']);var _0x1c611c=path[_0x22d4('0x4a')](config[_0x22d4('0x4b')],_0x22d4('0x4c'),_0x39d85d);logger[_0x22d4('0x5f')](_0x22d4('0x63'),_0x402a92);logger[_0x22d4('0x5f')](_0x22d4('0x64'),_0x1c611c);try{fs[_0x22d4('0x65')](_0x402a92,parseInt('0777',0x8));extract(_0x402a92,{'dir':_0x1c611c},function(_0x4748b8){if(_0x4748b8){logger['error'](_0x4748b8);handleError(_0x4748b8,!![]);};var _0x1252b9=fs[_0x22d4('0x66')](_0x1c611c);if(_0x1252b9[_0x22d4('0x45')]>0x1){removeReferences(_0x402a92,_0x1c611c);logger[_0x22d4('0x55')]('Invalid\x20plugin\x20structure');return _0x2cbe31(new Error(_0x22d4('0x67')));}var _0x56dc56=fs[_0x22d4('0x68')](path[_0x22d4('0x4a')](_0x1c611c,_0x1252b9[0x0]));if(_0x56dc56[_0x22d4('0x69')]()){removeReferences(_0x402a92,_0x1c611c);logger[_0x22d4('0x55')]('Invalid\x20plugin\x20structure');return _0x2cbe31(new Error(_0x22d4('0x67')));}if(_0x56dc56[_0x22d4('0x6a')]()){var _0x315f83=fs[_0x22d4('0x66')](path[_0x22d4('0x4a')](_0x1c611c,_0x1252b9[0x0]));if(_0x315f83[_0x22d4('0x45')]===0x0){removeReferences(_0x402a92,_0x1c611c);logger['error'](_0x22d4('0x67'));return _0x2cbe31(new Error(_0x22d4('0x67')));}var _0x366a7c=_0x315f83['some'](function(_0x596204){return _0x596204===_0x22d4('0x6b');});if(!_0x366a7c){return _0x2cbe31(new Error(_0x22d4('0x6c')));}var _0x5392c6=fs[_0x22d4('0x6d')](path[_0x22d4('0x4a')](_0x1c611c,_0x1252b9[0x0],_0x22d4('0x6b')));var _0x195af8=JSON['parse'](_0x5392c6);if('undefined'==typeof _0x195af8[_0x22d4('0x2d')]){return _0x2cbe31(new Error(_0x22d4('0x6e')));}if(_0x22d4('0x21')==typeof _0x195af8[_0x22d4('0x32')]){return _0x2cbe31(new Error(_0x22d4('0x6f')));}if('undefined'==typeof _0x195af8[_0x22d4('0x70')]){return _0x2cbe31(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x22d4('0x21')==typeof _0x195af8['parameters']){return _0x2cbe31(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x195af8[_0x22d4('0x32')]==='html'){if('undefined'==typeof _0x195af8['parameters']['views']){return _0x2cbe31(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x195af8[_0x22d4('0x71')][_0x22d4('0x72')]['admin']&&_0x22d4('0x21')==typeof _0x195af8['parameters'][_0x22d4('0x72')][_0x22d4('0x73')]){return _0x2cbe31(new Error(_0x22d4('0x74')));}}else if(_0x195af8[_0x22d4('0x32')]==='script'){if('undefined'==typeof _0x195af8[_0x22d4('0x71')]['scriptName']){return _0x2cbe31(new Error(_0x22d4('0x75')));}if(_0x22d4('0x21')==typeof _0x195af8['parameters'][_0x22d4('0x76')]){return _0x2cbe31(new Error(_0x22d4('0x77')));}}else{return _0x2cbe31(new Error(_0x22d4('0x78')));}var _0x2c4bb9=_0x195af8[_0x22d4('0x2d')];var _0x584db0=_0x195af8[_0x22d4('0x79')];var _0x30f7de=_0x195af8[_0x22d4('0x32')];var _0xd72c38=_0x195af8[_0x22d4('0x7a')]?_0x195af8[_0x22d4('0x7a')]:'always';var _0x48a08=_0x195af8['icon']?_0x195af8[_0x22d4('0x7b')]:_0x22d4('0x7c');var _0x20a337='';var _0x50e2ef='';var _0x4f97cb='';var _0x1f62bb='';var _0x292dfa=_0x195af8[_0x22d4('0x70')];if(_0x30f7de==='html'){if('undefined'!=typeof _0x195af8[_0x22d4('0x71')]['views'][_0x22d4('0x7d')]){var _0x46b65d=_0x195af8[_0x22d4('0x71')][_0x22d4('0x72')][_0x22d4('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x22d4('0x7e')](_0x46b65d)){_0x20a337=path['join']('plugins',_0x39d85d,_0x1252b9[0x0],_0x46b65d);}else{_0x20a337=_0x46b65d;}}else{logger[_0x22d4('0x5f')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x22d4('0x21')!=typeof _0x195af8[_0x22d4('0x71')]['views'][_0x22d4('0x73')]){var _0x2a4a73=_0x195af8[_0x22d4('0x71')]['views'][_0x22d4('0x73')];if(!/^(f|ht)tps?:\/\//i[_0x22d4('0x7e')](_0x2a4a73)){_0x50e2ef=path[_0x22d4('0x4a')](_0x22d4('0x7f'),_0x39d85d,_0x1252b9[0x0],_0x2a4a73);}else{_0x50e2ef=_0x2a4a73;}}else{logger[_0x22d4('0x5f')](_0x22d4('0x80'));}}else if(_0x30f7de==='script'){_0x4f97cb=_0x195af8['parameters'][_0x22d4('0x81')];_0x1f62bb=_0x195af8[_0x22d4('0x71')]['scriptPath'];if(_0x22d4('0x21')!=typeof _0x195af8[_0x22d4('0x71')][_0x22d4('0x72')]){if('undefined'!=typeof _0x195af8[_0x22d4('0x71')][_0x22d4('0x72')][_0x22d4('0x7d')]){var _0x46b65d=_0x195af8['parameters']['views'][_0x22d4('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x22d4('0x7e')](_0x46b65d)){_0x20a337=path[_0x22d4('0x4a')](_0x22d4('0x7f'),_0x39d85d,_0x1252b9[0x0],_0x46b65d);}else{_0x20a337=_0x46b65d;}}if('undefined'!=typeof _0x195af8[_0x22d4('0x71')][_0x22d4('0x72')][_0x22d4('0x73')]){var _0x2a4a73=_0x195af8[_0x22d4('0x71')][_0x22d4('0x72')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x2a4a73)){_0x50e2ef=path[_0x22d4('0x4a')](_0x22d4('0x7f'),_0x39d85d,_0x1252b9[0x0],_0x2a4a73);}else{_0x50e2ef=_0x2a4a73;}}}}var _0x31c3e4={'name':_0x2c4bb9,'description':_0x584db0,'path':path[_0x22d4('0x4a')](_0x39d85d,_0x1252b9[0x0]),'type':_0x30f7de,'sidebar':_0xd72c38,'icon':_0x48a08,'adminUrl':_0x20a337,'agentUrl':_0x50e2ef,'scriptName':_0x4f97cb,'scriptPath':_0x1f62bb,'version':_0x292dfa};removeReferences(_0x402a92,null);return db[_0x22d4('0x30')][_0x22d4('0x82')](_0x31c3e4)[_0x22d4('0x2a')](function(_0x4885d5){var _0x27475b={'role':_0x17fe1f[_0x22d4('0x83')][_0x22d4('0x84')],'userProfileId':_0x17fe1f[_0x22d4('0x83')][_0x22d4('0x85')]};if(!_0x27475b)throw new Error(_0x22d4('0x86'));if(_0x27475b['role']===_0x22d4('0x87')){var _0x4c8459=_0x4885d5['get']({'plain':!![]});return db[_0x22d4('0x88')][_0x22d4('0x48')]({'where':{'name':'Plugins','userProfileId':_0x27475b['userProfileId']},'raw':!![]})['then'](function(_0x5bf899){if(_0x5bf899&&_0x5bf899[_0x22d4('0x89')]===0x0){return db[_0x22d4('0x2b')]['create']({'name':_0x4c8459['name'],'resourceId':_0x4c8459['id'],'type':_0x5bf899['name'],'sectionId':_0x5bf899['id']},{})['then'](function(){return _0x4885d5;});}else{return _0x4885d5;}})[_0x22d4('0x49')](function(_0x5794ad){logger['error'](_0x22d4('0x8a'),_0x5794ad);throw _0x5794ad;});}return _0x4885d5;})[_0x22d4('0x2a')](respondWithResult(_0x53ae35,null))[_0x22d4('0x49')](handleError(_0x53ae35,null));}});}catch(_0xa24d19){_0x53ae35[_0x22d4('0x1d')](0x1f4)[_0x22d4('0x2e')](_0xa24d19);}};function removeReferences(_0x9dd273,_0x407ed9){try{if(_0x9dd273){fs['unlinkSync'](_0x9dd273);logger[_0x22d4('0x5f')](_0x22d4('0x8b'));}if(_0x407ed9){rimraf(_0x407ed9,function(){});logger[_0x22d4('0x5f')](_0x22d4('0x8c'));}}catch(_0x45f13f){logger['error'](_0x45f13f);}}exports[_0x22d4('0x28')]=function(_0x331ebb,_0x551a1a,_0x2ffb62){return db[_0x22d4('0x30')]['find']({'where':{'id':_0x331ebb[_0x22d4('0x43')]['id']}})[_0x22d4('0x2a')](handleEntityNotFound(_0x551a1a,null))[_0x22d4('0x2a')](saveUpdates(_0x331ebb[_0x22d4('0x83')],null))['then'](respondWithResult(_0x551a1a,null))[_0x22d4('0x49')](handleError(_0x551a1a,null));};exports[_0x22d4('0x8d')]=function(_0x45590c,_0x16e33c,_0x435d89){return db['Plugin'][_0x22d4('0x48')]({'where':{'id':_0x45590c[_0x22d4('0x43')]['id']}})[_0x22d4('0x2a')](function(_0x34d818){if(_0x34d818){return _0x34d818['destroy']();}})[_0x22d4('0x2a')](function(_0x25baf5){rimraf(path[_0x22d4('0x4a')](config[_0x22d4('0x4b')],_0x22d4('0x4c'),path[_0x22d4('0x58')](_0x25baf5[_0x22d4('0x3')])),function(){});return _0x25baf5;})[_0x22d4('0x2a')](handleEntityNotFound(_0x16e33c,null))[_0x22d4('0x2a')](respondWithStatusCode(_0x16e33c,null))[_0x22d4('0x49')](handleError(_0x16e33c,null));};exports[_0x22d4('0x8e')]=function(_0x31808f,_0x54c3ee,_0x426c58){return BPromise[_0x22d4('0x8f')]()['then'](function(){if(!_0x31808f[_0x22d4('0x35')][_0x22d4('0x3')]){throw new Error(_0x22d4('0x90'));}if(!_0x31808f[_0x22d4('0x35')][_0x22d4('0x91')]){throw new Error(_0x22d4('0x92'));}var _0x3c2603=_0x31808f[_0x22d4('0x35')]['hostname']?_0x31808f[_0x22d4('0x35')][_0x22d4('0x93')]+':'+_0x31808f['query'][_0x22d4('0x91')]:'http://localhost:'+_0x31808f[_0x22d4('0x35')][_0x22d4('0x91')];var _0x9e0ad2=_0x31808f[_0x22d4('0x35')][_0x22d4('0x1f')]?_0x31808f[_0x22d4('0x35')]['json']:!![];var _0x57cc62=_0x31808f[_0x22d4('0x35')][_0x22d4('0x94')]?_0x31808f[_0x22d4('0x35')][_0x22d4('0x94')]:null;var _0x1faafc={'method':_0x31808f[_0x22d4('0x95')],'uri':util[_0x22d4('0x4d')](_0x22d4('0x96'),_0x3c2603,_0x31808f[_0x22d4('0x35')][_0x22d4('0x3')]),'json':_0x9e0ad2,'resolveWithFullResponse':!![],'encoding':_0x57cc62,'qs':_0x31808f[_0x22d4('0x35')]};if(_0x31808f['headers']){_0x1faafc[_0x22d4('0x97')]=_0x31808f[_0x22d4('0x97')];if(_0x1faafc['headers'][_0x22d4('0x98')]){delete _0x1faafc['headers'][_0x22d4('0x98')];}}if(_0x1faafc[_0x22d4('0x97')][_0x22d4('0x99')]){delete _0x1faafc[_0x22d4('0x97')]['content-type'];}return rp(_0x1faafc);})['then'](function(_0x2f8bff){if(_0x2f8bff){_0x54c3ee[_0x22d4('0x24')](_0x2f8bff[_0x22d4('0x97')]);logger['info'](_0x2f8bff[_0x22d4('0x83')]);if(_[_0x22d4('0x9a')](_0x31808f[_0x22d4('0x35')][_0x22d4('0x3')],_0x22d4('0x9b'))&&_0x2f8bff[_0x22d4('0x9c')]==0x1f4){return _0x54c3ee[_0x22d4('0x1c')](_0x2f8bff[_0x22d4('0x9c')]);}else{return _0x54c3ee[_0x22d4('0x1d')](_0x2f8bff[_0x22d4('0x9c')])['send'](_0x2f8bff[_0x22d4('0x83')]);}}else{return _0x54c3ee[_0x22d4('0x1c')](0xc8);}})['catch'](handleError(_0x54c3ee,null));};exports[_0x22d4('0x9d')]=function(_0x506012,_0x564d01,_0x3f48b1){return BPromise[_0x22d4('0x8f')]()[_0x22d4('0x2a')](function(){if(!_0x506012[_0x22d4('0x35')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x506012[_0x22d4('0x35')]['port']){throw new Error(_0x22d4('0x92'));}var _0xb26d97=_0x506012[_0x22d4('0x35')][_0x22d4('0x93')]?_0x506012[_0x22d4('0x35')]['hostname']+':'+_0x506012[_0x22d4('0x35')][_0x22d4('0x91')]:_0x22d4('0x9e')+_0x506012['query']['port'];var _0x57bb55=_0x506012[_0x22d4('0x35')][_0x22d4('0x1f')]?_0x506012[_0x22d4('0x35')][_0x22d4('0x1f')]:!![];var _0x3e5d06=_0x506012[_0x22d4('0x35')][_0x22d4('0x94')]?_0x506012['query'][_0x22d4('0x94')]:null;var _0x4e207e={'method':_0x506012[_0x22d4('0x95')],'uri':util[_0x22d4('0x4d')]('%s%s',_0xb26d97,_0x506012[_0x22d4('0x35')]['path']),'json':_0x57bb55,'resolveWithFullResponse':!![],'encoding':_0x3e5d06,'body':_0x506012[_0x22d4('0x83')]};if(_0x506012[_0x22d4('0x97')]){_0x4e207e[_0x22d4('0x97')]=_0x506012[_0x22d4('0x97')];if(_0x4e207e[_0x22d4('0x97')][_0x22d4('0x98')]){delete _0x4e207e['headers'][_0x22d4('0x98')];}}if(_0x4e207e[_0x22d4('0x97')]['content-type']){delete _0x4e207e[_0x22d4('0x97')][_0x22d4('0x99')];}return rp(_0x4e207e);})[_0x22d4('0x2a')](function(_0xba5617){if(_0xba5617){_0x564d01[_0x22d4('0x24')](_0xba5617[_0x22d4('0x97')]);logger[_0x22d4('0x5f')](_0xba5617['body']);return _0x564d01[_0x22d4('0x1d')](_0xba5617[_0x22d4('0x9c')])[_0x22d4('0x2e')](_0xba5617[_0x22d4('0x83')]);}else{return _0x564d01[_0x22d4('0x1c')](0xc8);}})[_0x22d4('0x49')](handleError(_0x564d01,null));}; \ No newline at end of file +var _0x7075=['rimraf','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','map','fieldName','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','filter','merge','where','type','VIRTUAL','options','Plugin','includeAll','findAll','rows','catch','show','params','rawAttributes','fields','include','find','download','join','root','server/files/plugins','format','basename','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','dirname','node_modules/**/*','finalize','existsSync','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','plugins','test','Warning:\x20agent\x20view\x20not\x20specified','script','scriptName','create','body','role','user','UserProfileSection','Plugins','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7075,0x1f4));var _0x5707=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7075[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x5707('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5707('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5707('0x2'));var moment=require(_0x5707('0x3'));var BPromise=require(_0x5707('0x4'));var Mustache=require(_0x5707('0x5'));var util=require(_0x5707('0x6'));var path=require(_0x5707('0x7'));var sox=require('sox');var csv=require(_0x5707('0x8'));var ejs=require(_0x5707('0x9'));var fs=require('fs');var fs_extra=require(_0x5707('0xa'));var _=require(_0x5707('0xb'));var squel=require(_0x5707('0xc'));var crypto=require(_0x5707('0xd'));var jsforce=require(_0x5707('0xe'));var deskjs=require(_0x5707('0xf'));var toCsv=require(_0x5707('0x8'));var querystring=require(_0x5707('0x10'));var Papa=require(_0x5707('0x11'));var extract=require(_0x5707('0x12'));var rimraf=require(_0x5707('0x13'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0x5707('0x14'));var qs=require(_0x5707('0x15'));var as=require(_0x5707('0x16'));var hardwareService=require(_0x5707('0x17'));var logger=require(_0x5707('0x18'))(_0x5707('0x19'));var utils=require(_0x5707('0x1a'));var config=require(_0x5707('0x1b'));var licenseUtil=require(_0x5707('0x1c'));var db=require(_0x5707('0x1d'))['db'];config[_0x5707('0x1e')]=_['defaults'](config[_0x5707('0x1e')],{'host':_0x5707('0x1f'),'port':0x18eb});var socket=require(_0x5707('0x20'))(new Redis(config['redis']));require(_0x5707('0x21'))[_0x5707('0x22')](socket);function respondWithStatusCode(_0x59cfb1,_0x439fed){_0x439fed=_0x439fed||0xcc;return function(_0x29ffe1){if(_0x29ffe1){return _0x59cfb1[_0x5707('0x23')](_0x439fed);}return _0x59cfb1[_0x5707('0x24')](_0x439fed)['end']();};}function respondWithResult(_0x4d2ead,_0x4aa102){_0x4aa102=_0x4aa102||0xc8;return function(_0x153b98){if(_0x153b98){return _0x4d2ead[_0x5707('0x24')](_0x4aa102)[_0x5707('0x25')](_0x153b98);}};}function respondWithFilteredResult(_0x2a48b4,_0x3ea022){return function(_0x1b8d5e){if(_0x1b8d5e){var _0x33c8d7=typeof _0x3ea022[_0x5707('0x26')]===_0x5707('0x27')&&typeof _0x3ea022[_0x5707('0x28')]===_0x5707('0x27');var _0x5d5a10=_0x1b8d5e[_0x5707('0x29')];var _0x1ab910=_0x33c8d7?0x0:_0x3ea022[_0x5707('0x26')];var _0x43b711=_0x33c8d7?_0x1b8d5e[_0x5707('0x29')]:_0x3ea022[_0x5707('0x26')]+_0x3ea022[_0x5707('0x28')];var _0xa18368;if(_0x43b711>=_0x5d5a10){_0x43b711=_0x5d5a10;_0xa18368=0xc8;}else{_0xa18368=0xce;}_0x2a48b4[_0x5707('0x24')](_0xa18368);return _0x2a48b4[_0x5707('0x2a')](_0x5707('0x2b'),_0x1ab910+'-'+_0x43b711+'/'+_0x5d5a10)[_0x5707('0x25')](_0x1b8d5e);}return null;};}function patchUpdates(_0x5687de){return function(_0x20007c){try{jsonpatch[_0x5707('0x2c')](_0x20007c,_0x5687de,!![]);}catch(_0x4fad59){return BPromise[_0x5707('0x2d')](_0x4fad59);}return _0x20007c['save']();};}function saveUpdates(_0x53d54f,_0xcff2b9){return function(_0x4223be){if(_0x4223be){return _0x4223be[_0x5707('0x2e')](_0x53d54f)[_0x5707('0x2f')](function(_0x403fe0){return _0x403fe0;});}return null;};}function removeEntity(_0x450700,_0x165a78){return function(_0x4d1142){if(_0x4d1142){return _0x4d1142[_0x5707('0x30')]()[_0x5707('0x2f')](function(){var _0x27d572=_0x4d1142[_0x5707('0x31')]({'plain':!![]});var _0x296d8d='Plugins';return db[_0x5707('0x32')][_0x5707('0x30')]({'where':{'type':_0x296d8d,'resourceId':_0x27d572['id']}})[_0x5707('0x2f')](function(){return _0x4d1142;});})[_0x5707('0x2f')](function(){_0x450700['status'](0xcc)[_0x5707('0x33')]();});}};}function handleEntityNotFound(_0x3beb1c,_0x73379b){return function(_0x552324){if(!_0x552324){_0x3beb1c[_0x5707('0x23')](0x194);}return _0x552324;};}function handleError(_0x536e9c,_0x471d14){_0x471d14=_0x471d14||0x1f4;return function(_0x1e0a84){logger[_0x5707('0x34')](_0x1e0a84[_0x5707('0x35')]);if(_0x1e0a84[_0x5707('0x36')]){delete _0x1e0a84[_0x5707('0x36')];}_0x536e9c[_0x5707('0x24')](_0x471d14)[_0x5707('0x37')](_0x1e0a84);};}exports['index']=function(_0x3745ce,_0x348932){var _0x40b09f={},_0x4b7877={},_0x17cfe0={'count':0x0,'rows':[]};var _0x3a5a34=_[_0x5707('0x38')](db['Plugin']['rawAttributes'],function(_0x478cef){return{'name':_0x478cef[_0x5707('0x39')],'type':_0x478cef['type'][_0x5707('0x3a')]};});_0x4b7877[_0x5707('0x3b')]=_['map'](_0x3a5a34,_0x5707('0x36'));_0x4b7877[_0x5707('0x3c')]=_[_0x5707('0x3d')](_0x3745ce[_0x5707('0x3c')]);_0x4b7877[_0x5707('0x3e')]=_[_0x5707('0x3f')](_0x4b7877['model'],_0x4b7877[_0x5707('0x3c')]);_0x40b09f[_0x5707('0x40')]=_[_0x5707('0x3f')](_0x4b7877[_0x5707('0x3b')],qs['fields'](_0x3745ce[_0x5707('0x3c')]['fields']));_0x40b09f[_0x5707('0x40')]=_0x40b09f[_0x5707('0x40')][_0x5707('0x41')]?_0x40b09f[_0x5707('0x40')]:_0x4b7877['model'];if(!_0x3745ce[_0x5707('0x3c')]['hasOwnProperty'](_0x5707('0x42'))){_0x40b09f[_0x5707('0x28')]=qs[_0x5707('0x28')](_0x3745ce['query'][_0x5707('0x28')]);_0x40b09f['offset']=qs[_0x5707('0x26')](_0x3745ce[_0x5707('0x3c')][_0x5707('0x26')]);}_0x40b09f[_0x5707('0x43')]=qs[_0x5707('0x44')](_0x3745ce[_0x5707('0x3c')]['sort']);_0x40b09f['where']=qs[_0x5707('0x3e')](_['pick'](_0x3745ce['query'],_0x4b7877[_0x5707('0x3e')]),_0x3a5a34);if(_0x3745ce[_0x5707('0x3c')][_0x5707('0x45')]){_0x40b09f['where']=_[_0x5707('0x46')](_0x40b09f[_0x5707('0x47')],{'$or':_[_0x5707('0x38')](_0x3a5a34,function(_0x478db1){if(_0x478db1[_0x5707('0x48')]!==_0x5707('0x49')){var _0x1791de={};_0x1791de[_0x478db1[_0x5707('0x36')]]={'$like':'%'+_0x3745ce[_0x5707('0x3c')][_0x5707('0x45')]+'%'};return _0x1791de;}})});}_0x40b09f=_['merge']({},_0x40b09f,_0x3745ce[_0x5707('0x4a')]);var _0x2581c9={'where':_0x40b09f[_0x5707('0x47')]};return db[_0x5707('0x4b')][_0x5707('0x29')](_0x2581c9)['then'](function(_0x427d5f){_0x17cfe0[_0x5707('0x29')]=_0x427d5f;if(_0x3745ce[_0x5707('0x3c')][_0x5707('0x4c')]){_0x40b09f['include']=[{'all':!![]}];}return db[_0x5707('0x4b')][_0x5707('0x4d')](_0x40b09f);})[_0x5707('0x2f')](function(_0x3dc849){_0x17cfe0[_0x5707('0x4e')]=_0x3dc849;return _0x17cfe0;})[_0x5707('0x2f')](respondWithFilteredResult(_0x348932,_0x40b09f))[_0x5707('0x4f')](handleError(_0x348932,null));};exports[_0x5707('0x50')]=function(_0x37741f,_0x39a7e3){var _0xc5a3a8={'raw':!![],'where':{'id':_0x37741f[_0x5707('0x51')]['id']}},_0x70b75b={};_0x70b75b[_0x5707('0x3b')]=_['keys'](db['Plugin'][_0x5707('0x52')]);_0x70b75b[_0x5707('0x3c')]=_[_0x5707('0x3d')](_0x37741f[_0x5707('0x3c')]);_0x70b75b[_0x5707('0x3e')]=_[_0x5707('0x3f')](_0x70b75b['model'],_0x70b75b['query']);_0xc5a3a8[_0x5707('0x40')]=_[_0x5707('0x3f')](_0x70b75b[_0x5707('0x3b')],qs['fields'](_0x37741f[_0x5707('0x3c')][_0x5707('0x53')]));_0xc5a3a8[_0x5707('0x40')]=_0xc5a3a8['attributes']['length']?_0xc5a3a8[_0x5707('0x40')]:_0x70b75b[_0x5707('0x3b')];if(_0x37741f[_0x5707('0x3c')]['includeAll']){_0xc5a3a8[_0x5707('0x54')]=[{'all':!![]}];}_0xc5a3a8=_[_0x5707('0x46')]({},_0xc5a3a8,_0x37741f[_0x5707('0x4a')]);return db[_0x5707('0x4b')][_0x5707('0x55')](_0xc5a3a8)[_0x5707('0x2f')](handleEntityNotFound(_0x39a7e3,null))[_0x5707('0x2f')](respondWithResult(_0x39a7e3,null))[_0x5707('0x4f')](handleError(_0x39a7e3,null));};exports[_0x5707('0x56')]=function(_0xe95e0b,_0x18feee,_0x3f2151){return db[_0x5707('0x4b')][_0x5707('0x55')]({'where':{'id':_0xe95e0b[_0x5707('0x51')]['id']},'attributes':[_0x5707('0x36'),_0x5707('0x7')],'raw':!![]})[_0x5707('0x2f')](handleEntityNotFound(_0x18feee,null))['then'](function(_0x4cc948){if(_0x4cc948){var _0x1d350e=path[_0x5707('0x57')](config[_0x5707('0x58')],_0x5707('0x59'),util[_0x5707('0x5a')]('%s.zip',path[_0x5707('0x5b')](_0x4cc948[_0x5707('0x7')])));var _0x23900d=fs['createWriteStream'](_0x1d350e);var _0x3533f1=archiver('zip',{'zlib':{'level':0x9}});_0x3533f1['on'](_0x5707('0x5c'),function(_0x563b7b){if(_0x563b7b[_0x5707('0x5d')]===_0x5707('0x5e')){logger[_0x5707('0x34')](_0x563b7b);}else{throw new db[(_0x5707('0x5f'))][(_0x5707('0x60'))](_0x5707('0x61'));}});_0x3533f1['on']('error',function(_0x5af491){throw new db[(_0x5707('0x5f'))][(_0x5707('0x60'))](_0x5707('0x61'));});_0x3533f1['pipe'](_0x23900d);_0x3533f1[_0x5707('0x62')](_0x5707('0x63'),{'cwd':path['join'](config[_0x5707('0x58')],_0x5707('0x59'),path[_0x5707('0x64')](_0x4cc948[_0x5707('0x7')])),'ignore':[path[_0x5707('0x57')](path[_0x5707('0x5b')](_0x4cc948['path']),_0x5707('0x65')),path['join'](path[_0x5707('0x5b')](_0x4cc948[_0x5707('0x7')]),'attachments/**/*')],'nodir':!![]})[_0x5707('0x66')]();_0x23900d['on']('close',function(){if(!fs[_0x5707('0x67')](_0x1d350e)){throw new db[(_0x5707('0x5f'))]['Error'](_0x5707('0x68'));}return _0x18feee['download'](_0x1d350e,util['format'](_0x5707('0x69'),path[_0x5707('0x5b')](_0x4cc948['path'])),function(_0x424888){if(_0x424888){throw new db[(_0x5707('0x5f'))][(_0x5707('0x60'))](_0x5707('0x6a'));}fs[_0x5707('0x6b')](_0x1d350e);logger[_0x5707('0x6c')](_0x5707('0x6d'));logger[_0x5707('0x6c')](_0x5707('0x6e'));});});}return null;})[_0x5707('0x4f')](handleError(_0x18feee,null));};exports['upload']=function(_0x443d4c,_0xc967b6,_0x5a9623){var _0x3aa577=path['basename'](_0x443d4c[_0x5707('0x6f')]['filename'],path[_0x5707('0x70')](_0x443d4c[_0x5707('0x6f')][_0x5707('0x71')]));var _0x494447=path[_0x5707('0x57')](config[_0x5707('0x58')],_0x5707('0x59'),_0x443d4c[_0x5707('0x6f')][_0x5707('0x71')]);var _0x19ffaf=path['join'](config[_0x5707('0x58')],'server/files/plugins',_0x3aa577);logger[_0x5707('0x6c')](_0x5707('0x72'),_0x494447);logger[_0x5707('0x6c')](_0x5707('0x73'),_0x19ffaf);try{fs[_0x5707('0x74')](_0x494447,parseInt(_0x5707('0x75'),0x8));extract(_0x494447,{'dir':_0x19ffaf},function(_0x3ad0b1){if(_0x3ad0b1){logger['error'](_0x3ad0b1);handleError(_0x3ad0b1,!![]);};var _0x93e2=fs['readdirSync'](_0x19ffaf);if(_0x93e2[_0x5707('0x41')]>0x1){removeReferences(_0x494447,_0x19ffaf);logger['error'](_0x5707('0x76'));return _0x5a9623(new Error('Invalid\x20plugin\x20structure'));}var _0x38bac5=fs[_0x5707('0x77')](path[_0x5707('0x57')](_0x19ffaf,_0x93e2[0x0]));if(_0x38bac5[_0x5707('0x78')]()){removeReferences(_0x494447,_0x19ffaf);logger[_0x5707('0x34')](_0x5707('0x76'));return _0x5a9623(new Error(_0x5707('0x76')));}if(_0x38bac5[_0x5707('0x79')]()){var _0x84093d=fs[_0x5707('0x7a')](path[_0x5707('0x57')](_0x19ffaf,_0x93e2[0x0]));if(_0x84093d[_0x5707('0x41')]===0x0){removeReferences(_0x494447,_0x19ffaf);logger[_0x5707('0x34')](_0x5707('0x76'));return _0x5a9623(new Error('Invalid\x20plugin\x20structure'));}var _0x10455d=_0x84093d[_0x5707('0x7b')](function(_0x44d6d2){return _0x44d6d2===_0x5707('0x7c');});if(!_0x10455d){return _0x5a9623(new Error('Plugin\x20manifest\x20missing'));}var _0x46911b=fs[_0x5707('0x7d')](path[_0x5707('0x57')](_0x19ffaf,_0x93e2[0x0],_0x5707('0x7c')));var _0x2c9539=JSON[_0x5707('0x7e')](_0x46911b);if(_0x5707('0x27')==typeof _0x2c9539[_0x5707('0x36')]){return _0x5a9623(new Error(_0x5707('0x7f')));}if(_0x5707('0x27')==typeof _0x2c9539[_0x5707('0x48')]){return _0x5a9623(new Error(_0x5707('0x80')));}if(_0x5707('0x27')==typeof _0x2c9539[_0x5707('0x81')]){return _0x5a9623(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x2c9539[_0x5707('0x82')]){return _0x5a9623(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x2c9539[_0x5707('0x48')]==='html'){if(_0x5707('0x27')==typeof _0x2c9539['parameters'][_0x5707('0x83')]){return _0x5a9623(new Error(_0x5707('0x84')));}if(_0x5707('0x27')==typeof _0x2c9539[_0x5707('0x82')]['views'][_0x5707('0x85')]&&_0x5707('0x27')==typeof _0x2c9539['parameters'][_0x5707('0x83')][_0x5707('0x86')]){return _0x5a9623(new Error(_0x5707('0x87')));}}else if(_0x2c9539[_0x5707('0x48')]==='script'){if(_0x5707('0x27')==typeof _0x2c9539[_0x5707('0x82')]['scriptName']){return _0x5a9623(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x5707('0x27')==typeof _0x2c9539[_0x5707('0x82')][_0x5707('0x88')]){return _0x5a9623(new Error(_0x5707('0x89')));}}else{return _0x5a9623(new Error(_0x5707('0x8a')));}var _0x4ad6de=_0x2c9539[_0x5707('0x36')];var _0x432847=_0x2c9539['description'];var _0x22532e=_0x2c9539['type'];var _0x581701=_0x2c9539[_0x5707('0x8b')]?_0x2c9539['sidebar']:_0x5707('0x8c');var _0x1c127f=_0x2c9539[_0x5707('0x8d')]?_0x2c9539[_0x5707('0x8d')]:_0x5707('0x8e');var _0xc06c2f='';var _0x59fbd4='';var _0x2dcc3d='';var _0x27f5ed='';var _0x86f5cf=_0x2c9539[_0x5707('0x81')];if(_0x22532e==='html'){if(_0x5707('0x27')!=typeof _0x2c9539[_0x5707('0x82')]['views'][_0x5707('0x85')]){var _0x2ef6e0=_0x2c9539['parameters'][_0x5707('0x83')][_0x5707('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2ef6e0)){_0xc06c2f=path['join'](_0x5707('0x8f'),_0x3aa577,_0x93e2[0x0],_0x2ef6e0);}else{_0xc06c2f=_0x2ef6e0;}}else{logger[_0x5707('0x6c')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x5707('0x27')!=typeof _0x2c9539[_0x5707('0x82')][_0x5707('0x83')][_0x5707('0x86')]){var _0x330f16=_0x2c9539[_0x5707('0x82')]['views'][_0x5707('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x5707('0x90')](_0x330f16)){_0x59fbd4=path['join'](_0x5707('0x8f'),_0x3aa577,_0x93e2[0x0],_0x330f16);}else{_0x59fbd4=_0x330f16;}}else{logger['info'](_0x5707('0x91'));}}else if(_0x22532e===_0x5707('0x92')){_0x2dcc3d=_0x2c9539[_0x5707('0x82')][_0x5707('0x93')];_0x27f5ed=_0x2c9539[_0x5707('0x82')][_0x5707('0x88')];if(_0x5707('0x27')!=typeof _0x2c9539[_0x5707('0x82')][_0x5707('0x83')]){if(_0x5707('0x27')!=typeof _0x2c9539[_0x5707('0x82')]['views'][_0x5707('0x85')]){var _0x2ef6e0=_0x2c9539['parameters'][_0x5707('0x83')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x2ef6e0)){_0xc06c2f=path[_0x5707('0x57')](_0x5707('0x8f'),_0x3aa577,_0x93e2[0x0],_0x2ef6e0);}else{_0xc06c2f=_0x2ef6e0;}}if('undefined'!=typeof _0x2c9539[_0x5707('0x82')][_0x5707('0x83')][_0x5707('0x86')]){var _0x330f16=_0x2c9539['parameters'][_0x5707('0x83')][_0x5707('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x5707('0x90')](_0x330f16)){_0x59fbd4=path['join'](_0x5707('0x8f'),_0x3aa577,_0x93e2[0x0],_0x330f16);}else{_0x59fbd4=_0x330f16;}}}}var _0x4a4e4a={'name':_0x4ad6de,'description':_0x432847,'path':path[_0x5707('0x57')](_0x3aa577,_0x93e2[0x0]),'type':_0x22532e,'sidebar':_0x581701,'icon':_0x1c127f,'adminUrl':_0xc06c2f,'agentUrl':_0x59fbd4,'scriptName':_0x2dcc3d,'scriptPath':_0x27f5ed,'version':_0x86f5cf};removeReferences(_0x494447,null);return db[_0x5707('0x4b')][_0x5707('0x94')](_0x4a4e4a)[_0x5707('0x2f')](function(_0x145cb2){var _0xb3a8a3={'role':_0x443d4c[_0x5707('0x95')]['role'],'userProfileId':_0x443d4c[_0x5707('0x95')]['userProfileId']};if(!_0xb3a8a3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb3a8a3[_0x5707('0x96')]===_0x5707('0x97')){var _0x34c637=_0x145cb2[_0x5707('0x31')]({'plain':!![]});return db[_0x5707('0x98')]['find']({'where':{'name':_0x5707('0x99'),'userProfileId':_0xb3a8a3[_0x5707('0x9a')]},'raw':!![]})[_0x5707('0x2f')](function(_0x10c4e8){if(_0x10c4e8&&_0x10c4e8[_0x5707('0x9b')]===0x0){return db['UserProfileResource']['create']({'name':_0x34c637[_0x5707('0x36')],'resourceId':_0x34c637['id'],'type':_0x10c4e8['name'],'sectionId':_0x10c4e8['id']},{})[_0x5707('0x2f')](function(){return _0x145cb2;});}else{return _0x145cb2;}})[_0x5707('0x4f')](function(_0x9ecf61){logger[_0x5707('0x34')](_0x5707('0x9c'),_0x9ecf61);throw _0x9ecf61;});}return _0x145cb2;})[_0x5707('0x2f')](respondWithResult(_0xc967b6,null))[_0x5707('0x4f')](handleError(_0xc967b6,null));}});}catch(_0x544207){_0xc967b6[_0x5707('0x24')](0x1f4)['send'](_0x544207);}};function removeReferences(_0x3968e3,_0x10939d){try{if(_0x3968e3){fs[_0x5707('0x6b')](_0x3968e3);logger[_0x5707('0x6c')]('Zip\x20archive\x20removed');}if(_0x10939d){rimraf(_0x10939d,function(){});logger[_0x5707('0x6c')](_0x5707('0x9d'));}}catch(_0xa19510){logger[_0x5707('0x34')](_0xa19510);}}exports['update']=function(_0x4b8dcd,_0x3ab38f,_0x359658){return db[_0x5707('0x4b')][_0x5707('0x55')]({'where':{'id':_0x4b8dcd['params']['id']}})[_0x5707('0x2f')](handleEntityNotFound(_0x3ab38f,null))[_0x5707('0x2f')](saveUpdates(_0x4b8dcd[_0x5707('0x95')],null))[_0x5707('0x2f')](respondWithResult(_0x3ab38f,null))[_0x5707('0x4f')](handleError(_0x3ab38f,null));};exports[_0x5707('0x9e')]=function(_0x57cc9f,_0x481565,_0x3d9bee){return db[_0x5707('0x4b')][_0x5707('0x55')]({'where':{'id':_0x57cc9f['params']['id']}})['then'](function(_0x123a66){if(_0x123a66){return _0x123a66[_0x5707('0x30')]();}})[_0x5707('0x2f')](function(_0x74501f){rimraf(path[_0x5707('0x57')](config['root'],'server/files/plugins',path[_0x5707('0x64')](_0x74501f[_0x5707('0x7')])),function(){});return _0x74501f;})['then'](handleEntityNotFound(_0x481565,null))[_0x5707('0x2f')](respondWithStatusCode(_0x481565,null))[_0x5707('0x4f')](handleError(_0x481565,null));};exports[_0x5707('0x9f')]=function(_0x143b15,_0x4084a5,_0x105390){return BPromise['resolve']()['then'](function(){if(!_0x143b15[_0x5707('0x3c')][_0x5707('0x7')]){throw new Error(_0x5707('0xa0'));}if(!_0x143b15[_0x5707('0x3c')]['port']){throw new Error(_0x5707('0xa1'));}var _0x30ff5c=_0x143b15['query']['hostname']?_0x143b15[_0x5707('0x3c')][_0x5707('0xa2')]+':'+_0x143b15[_0x5707('0x3c')][_0x5707('0xa3')]:_0x5707('0xa4')+_0x143b15[_0x5707('0x3c')][_0x5707('0xa3')];var _0x5a3234=_0x143b15[_0x5707('0x3c')]['json']?_0x143b15['query'][_0x5707('0x25')]:!![];var _0x26b71a=_0x143b15[_0x5707('0x3c')][_0x5707('0xa5')]?_0x143b15['query'][_0x5707('0xa5')]:null;var _0x3720d5={'method':_0x143b15['method'],'uri':util[_0x5707('0x5a')](_0x5707('0xa6'),_0x30ff5c,_0x143b15[_0x5707('0x3c')][_0x5707('0x7')]),'json':_0x5a3234,'resolveWithFullResponse':!![],'encoding':_0x26b71a,'qs':_0x143b15[_0x5707('0x3c')]};if(_0x143b15['headers']){_0x3720d5[_0x5707('0xa7')]=_0x143b15['headers'];if(_0x3720d5['headers'][_0x5707('0xa8')]){delete _0x3720d5['headers'][_0x5707('0xa8')];}}if(_0x3720d5[_0x5707('0xa7')][_0x5707('0xa9')]){delete _0x3720d5[_0x5707('0xa7')][_0x5707('0xa9')];}return rp(_0x3720d5);})[_0x5707('0x2f')](function(_0x418777){if(_0x418777){_0x4084a5[_0x5707('0x2a')](_0x418777[_0x5707('0xa7')]);logger[_0x5707('0x6c')](_0x418777[_0x5707('0x95')]);if(_[_0x5707('0xaa')](_0x143b15[_0x5707('0x3c')]['path'],_0x5707('0x56'))&&_0x418777[_0x5707('0xab')]==0x1f4){return _0x4084a5[_0x5707('0x23')](_0x418777[_0x5707('0xab')]);}else{return _0x4084a5[_0x5707('0x24')](_0x418777[_0x5707('0xab')])[_0x5707('0x37')](_0x418777['body']);}}else{return _0x4084a5['sendStatus'](0xc8);}})[_0x5707('0x4f')](handleError(_0x4084a5,null));};exports[_0x5707('0xac')]=function(_0x3d9006,_0xb56a46,_0x3c13c3){return BPromise['resolve']()['then'](function(){if(!_0x3d9006['query']['path']){throw new Error(_0x5707('0xa0'));}if(!_0x3d9006[_0x5707('0x3c')][_0x5707('0xa3')]){throw new Error(_0x5707('0xa1'));}var _0x53beb4=_0x3d9006[_0x5707('0x3c')][_0x5707('0xa2')]?_0x3d9006[_0x5707('0x3c')][_0x5707('0xa2')]+':'+_0x3d9006[_0x5707('0x3c')][_0x5707('0xa3')]:_0x5707('0xa4')+_0x3d9006[_0x5707('0x3c')][_0x5707('0xa3')];var _0x1f8624=_0x3d9006[_0x5707('0x3c')][_0x5707('0x25')]?_0x3d9006[_0x5707('0x3c')][_0x5707('0x25')]:!![];var _0x5e0a4a=_0x3d9006[_0x5707('0x3c')]['encoding']?_0x3d9006[_0x5707('0x3c')]['encoding']:null;var _0x408bb0={'method':_0x3d9006['method'],'uri':util[_0x5707('0x5a')]('%s%s',_0x53beb4,_0x3d9006[_0x5707('0x3c')][_0x5707('0x7')]),'json':_0x1f8624,'resolveWithFullResponse':!![],'encoding':_0x5e0a4a,'body':_0x3d9006[_0x5707('0x95')]};if(_0x3d9006[_0x5707('0xa7')]){_0x408bb0['headers']=_0x3d9006[_0x5707('0xa7')];if(_0x408bb0[_0x5707('0xa7')][_0x5707('0xa8')]){delete _0x408bb0[_0x5707('0xa7')]['content-length'];}}if(_0x408bb0['headers'][_0x5707('0xa9')]){delete _0x408bb0[_0x5707('0xa7')]['content-type'];}return rp(_0x408bb0);})[_0x5707('0x2f')](function(_0x2ce693){if(_0x2ce693){_0xb56a46[_0x5707('0x2a')](_0x2ce693[_0x5707('0xa7')]);logger[_0x5707('0x6c')](_0x2ce693[_0x5707('0x95')]);return _0xb56a46['status'](_0x2ce693[_0x5707('0xab')])[_0x5707('0x37')](_0x2ce693['body']);}else{return _0xb56a46['sendStatus'](0xc8);}})[_0x5707('0x4f')](handleError(_0xb56a46,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index ab824e8..16dda60 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 _0xfc91=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','save'];(function(_0x1f0d06,_0x31ff98){var _0x58a7c4=function(_0x34ad9e){while(--_0x34ad9e){_0x1f0d06['push'](_0x1f0d06['shift']());}};_0x58a7c4(++_0x31ff98);}(_0xfc91,0xb5));var _0x1fc9=function(_0x21f880,_0x25a045){_0x21f880=_0x21f880-0x0;var _0x427b6e=_0xfc91[_0x21f880];return _0x427b6e;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x1fc9('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x1fc9('0x1')](0x0);var events={'afterCreate':_0x1fc9('0x2'),'afterUpdate':_0x1fc9('0x3'),'afterDestroy':_0x1fc9('0x4')};function emitEvent(_0x2199cd){return function(_0xa16e01,_0x471692,_0x6d3bcc){PluginEvents[_0x1fc9('0x5')](_0x2199cd+':'+_0xa16e01['id'],_0xa16e01);PluginEvents[_0x1fc9('0x5')](_0x2199cd,_0xa16e01);_0x6d3bcc(null);};}for(var e in events){if(events[_0x1fc9('0x6')](e)){var event=events[e];Plugin[_0x1fc9('0x7')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x5655=['../../mysqldb','Plugin','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x239d5e,_0x184a03){var _0x513afe=function(_0x1e9a92){while(--_0x1e9a92){_0x239d5e['push'](_0x239d5e['shift']());}};_0x513afe(++_0x184a03);}(_0x5655,0x15e));var _0x5565=function(_0x57664f,_0x1d54a0){_0x57664f=_0x57664f-0x0;var _0x35ff14=_0x5655[_0x57664f];return _0x35ff14;};'use strict';var EventEmitter=require(_0x5565('0x0'));var Plugin=require(_0x5565('0x1'))['db'][_0x5565('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x5565('0x3')](0x0);var events={'afterCreate':_0x5565('0x4'),'afterUpdate':_0x5565('0x5'),'afterDestroy':'remove'};function emitEvent(_0x480b69){return function(_0x307c01,_0x58e4f5,_0x247aa3){PluginEvents[_0x5565('0x6')](_0x480b69+':'+_0x307c01['id'],_0x307c01);PluginEvents[_0x5565('0x6')](_0x480b69,_0x307c01);_0x247aa3(null);};}for(var e in events){if(events[_0x5565('0x7')](e)){var event=events[e];Plugin[_0x5565('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 25b97e8..ea6ac44 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 _0x0a05=['exports','define','Plugin','plugins','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./plugin.attributes'];(function(_0x16780f,_0x355eff){var _0x1e8480=function(_0x213328){while(--_0x213328){_0x16780f['push'](_0x16780f['shift']());}};_0x1e8480(++_0x355eff);}(_0x0a05,0x1e4));var _0x50a0=function(_0x48c615,_0x4cc757){_0x48c615=_0x48c615-0x0;var _0x3d9e22=_0x0a05[_0x48c615];return _0x3d9e22;};'use strict';var _=require(_0x50a0('0x0'));var util=require(_0x50a0('0x1'));var logger=require(_0x50a0('0x2'))('api');var moment=require(_0x50a0('0x3'));var BPromise=require(_0x50a0('0x4'));var rp=require(_0x50a0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x50a0('0x6'));var attributes=require(_0x50a0('0x7'));module[_0x50a0('0x8')]=function(_0x120258,_0x5255aa){return _0x120258[_0x50a0('0x9')](_0x50a0('0xa'),attributes,{'tableName':_0x50a0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb72d=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','define','Plugin','plugins','lodash','util'];(function(_0x1c0a91,_0x444a0f){var _0x3139a2=function(_0x215d54){while(--_0x215d54){_0x1c0a91['push'](_0x1c0a91['shift']());}};_0x3139a2(++_0x444a0f);}(_0xb72d,0xc4));var _0xdb72=function(_0x56a0f4,_0x29d808){_0x56a0f4=_0x56a0f4-0x0;var _0x40f573=_0xb72d[_0x56a0f4];return _0x40f573;};'use strict';var _=require(_0xdb72('0x0'));var util=require(_0xdb72('0x1'));var logger=require(_0xdb72('0x2'))(_0xdb72('0x3'));var moment=require('moment');var BPromise=require(_0xdb72('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdb72('0x5'));var rimraf=require(_0xdb72('0x6'));var config=require(_0xdb72('0x7'));var attributes=require('./plugin.attributes');module['exports']=function(_0x3389f0,_0x3a00e5){return _0x3389f0[_0xdb72('0x8')](_0xdb72('0x9'),attributes,{'tableName':_0xdb72('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 e5f9c06..ff52588 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 _0x294b=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreatePlugin','Plugin','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x294b,0x120));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb294('0x0'));var util=require(_0xb294('0x1'));var moment=require(_0xb294('0x2'));var BPromise=require(_0xb294('0x3'));var rs=require(_0xb294('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb294('0x5'));var logger=require(_0xb294('0x6'))(_0xb294('0x7'));var config=require(_0xb294('0x8'));var jayson=require(_0xb294('0x9'));var client=jayson[_0xb294('0xa')][_0xb294('0xb')]({'port':0x232a});config[_0xb294('0xc')]=_[_0xb294('0xd')](config[_0xb294('0xc')],{'host':_0xb294('0xe'),'port':0x18eb});var socket=require(_0xb294('0xf'))(new Redis(config['redis']));require(_0xb294('0x10'))[_0xb294('0x11')](socket);function respondWithRpcPromise(_0x42abac,_0x1dce5c,_0x3bbec0){return new BPromise(function(_0x2da53e,_0x20f6af){return client[_0xb294('0x12')](_0x42abac,_0x3bbec0)[_0xb294('0x13')](function(_0x7c3ce){logger['info'](_0xb294('0x14'),_0x1dce5c,_0xb294('0x15'));logger[_0xb294('0x16')](_0xb294('0x17'),_0x1dce5c,'request\x20sent',JSON[_0xb294('0x18')](_0x7c3ce));if(_0x7c3ce[_0xb294('0x19')]){if(_0x7c3ce[_0xb294('0x19')][_0xb294('0x1a')]===0x1f4){logger[_0xb294('0x19')](_0xb294('0x14'),_0x1dce5c,_0x7c3ce[_0xb294('0x19')]['message']);return _0x20f6af(_0x7c3ce['error'][_0xb294('0x1b')]);}logger['error'](_0xb294('0x14'),_0x1dce5c,_0x7c3ce[_0xb294('0x19')][_0xb294('0x1b')]);return _0x2da53e(_0x7c3ce['error'][_0xb294('0x1b')]);}else{logger[_0xb294('0x1c')](_0xb294('0x14'),_0x1dce5c,_0xb294('0x15'));_0x2da53e(_0x7c3ce[_0xb294('0x1d')][_0xb294('0x1b')]);}})[_0xb294('0x1e')](function(_0x463b3f){logger[_0xb294('0x19')](_0xb294('0x14'),_0x1dce5c,_0x463b3f);_0x20f6af(_0x463b3f);});});}exports[_0xb294('0x1f')]=function(_0x407f59){var _0x594387=this;return new Promise(function(_0x1eaf18,_0x2b15a){return db[_0xb294('0x20')][_0xb294('0x21')](_0x407f59[_0xb294('0x22')],{'raw':_0x407f59[_0xb294('0x23')]?_0x407f59[_0xb294('0x23')][_0xb294('0x24')]===undefined?!![]:![]:!![]})[_0xb294('0x13')](function(_0x20354d){logger[_0xb294('0x1c')]('CreatePlugin',_0x407f59);logger[_0xb294('0x16')](_0xb294('0x1f'),_0x407f59,JSON['stringify'](_0x20354d));_0x1eaf18(_0x20354d);})[_0xb294('0x1e')](function(_0x2f4110){logger['error']('CreatePlugin',_0x2f4110['message'],_0x407f59);_0x2b15a(_0x594387['error'](0x1f4,_0x2f4110[_0xb294('0x1b')]));});});}; \ No newline at end of file +var _0xf467=['stringify','error','code','Plugin,\x20%s,\x20%s','message','result','CreatePlugin','Plugin','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./plugin.socket','request','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s'];(function(_0x382982,_0x2e36d6){var _0x3c9b77=function(_0x5397e4){while(--_0x5397e4){_0x382982['push'](_0x382982['shift']());}};_0x3c9b77(++_0x2e36d6);}(_0xf467,0x1b9));var _0x7f46=function(_0x4d0a5d,_0x5a3109){_0x4d0a5d=_0x4d0a5d-0x0;var _0x325655=_0xf467[_0x4d0a5d];return _0x325655;};'use strict';var _=require(_0x7f46('0x0'));var util=require(_0x7f46('0x1'));var moment=require('moment');var BPromise=require(_0x7f46('0x2'));var rs=require(_0x7f46('0x3'));var fs=require('fs');var Redis=require(_0x7f46('0x4'));var db=require(_0x7f46('0x5'))['db'];var utils=require(_0x7f46('0x6'));var logger=require(_0x7f46('0x7'))('rpc');var config=require(_0x7f46('0x8'));var jayson=require(_0x7f46('0x9'));var client=jayson[_0x7f46('0xa')]['http']({'port':0x232a});config[_0x7f46('0xb')]=_[_0x7f46('0xc')](config[_0x7f46('0xb')],{'host':_0x7f46('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7f46('0xb')]));require(_0x7f46('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f9b7f,_0x41653f,_0x5b5c06){return new BPromise(function(_0xa67cb4,_0x10d469){return client[_0x7f46('0xf')](_0x3f9b7f,_0x5b5c06)[_0x7f46('0x10')](function(_0x5d1288){logger[_0x7f46('0x11')]('Plugin,\x20%s,\x20%s',_0x41653f,_0x7f46('0x12'));logger[_0x7f46('0x13')](_0x7f46('0x14'),_0x41653f,_0x7f46('0x12'),JSON[_0x7f46('0x15')](_0x5d1288));if(_0x5d1288[_0x7f46('0x16')]){if(_0x5d1288['error'][_0x7f46('0x17')]===0x1f4){logger[_0x7f46('0x16')](_0x7f46('0x18'),_0x41653f,_0x5d1288[_0x7f46('0x16')][_0x7f46('0x19')]);return _0x10d469(_0x5d1288['error']['message']);}logger[_0x7f46('0x16')](_0x7f46('0x18'),_0x41653f,_0x5d1288['error'][_0x7f46('0x19')]);return _0xa67cb4(_0x5d1288[_0x7f46('0x16')]['message']);}else{logger[_0x7f46('0x11')]('Plugin,\x20%s,\x20%s',_0x41653f,'request\x20sent');_0xa67cb4(_0x5d1288[_0x7f46('0x1a')][_0x7f46('0x19')]);}})['catch'](function(_0x3644ec){logger[_0x7f46('0x16')]('Plugin,\x20%s,\x20%s',_0x41653f,_0x3644ec);_0x10d469(_0x3644ec);});});}exports[_0x7f46('0x1b')]=function(_0x44e638){var _0x3915ff=this;return new Promise(function(_0x15188e,_0x2a6243){return db[_0x7f46('0x1c')][_0x7f46('0x1d')](_0x44e638[_0x7f46('0x1e')],{'raw':_0x44e638[_0x7f46('0x1f')]?_0x44e638[_0x7f46('0x1f')][_0x7f46('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x348347){logger[_0x7f46('0x11')](_0x7f46('0x1b'),_0x44e638);logger['debug']('CreatePlugin',_0x44e638,JSON[_0x7f46('0x15')](_0x348347));_0x15188e(_0x348347);})['catch'](function(_0x52c3c4){logger['error'](_0x7f46('0x1b'),_0x52c3c4[_0x7f46('0x19')],_0x44e638);_0x2a6243(_0x3915ff[_0x7f46('0x16')](0x1f4,_0x52c3c4[_0x7f46('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 4bed10d..546250d 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 _0xeeae=['plugin:','./plugin.events','save','update','length'];(function(_0x26017a,_0x9389b7){var _0x2dc7f3=function(_0xf05634){while(--_0xf05634){_0x26017a['push'](_0x26017a['shift']());}};_0x2dc7f3(++_0x9389b7);}(_0xeeae,0x79));var _0xeeea=function(_0x41a9b4,_0x4aad69){_0x41a9b4=_0x41a9b4-0x0;var _0x32f712=_0xeeae[_0x41a9b4];return _0x32f712;};'use strict';var PluginEvents=require(_0xeeea('0x0'));var events=[_0xeeea('0x1'),'remove',_0xeeea('0x2')];function createListener(_0x3ee4cd,_0xfb1b2){return function(_0x4af46e){_0xfb1b2['emit'](_0x3ee4cd,_0x4af46e);};}function removeListener(_0x331bfa,_0x36a8b0){return function(){PluginEvents['removeListener'](_0x331bfa,_0x36a8b0);};}exports['register']=function(_0x3527e0){for(var _0x275b00=0x0,_0xd4cd5e=events[_0xeeea('0x3')];_0x275b00<_0xd4cd5e;_0x275b00++){var _0x3ffe6b=events[_0x275b00];var _0x2c6643=createListener(_0xeeea('0x4')+_0x3ffe6b,_0x3527e0);PluginEvents['on'](_0x3ffe6b,_0x2c6643);}}; \ No newline at end of file +var _0x6195=['./plugin.events','save','remove','update','removeListener','register','length','plugin:'];(function(_0xf0e391,_0x5433d4){var _0x1c126d=function(_0x520c70){while(--_0x520c70){_0xf0e391['push'](_0xf0e391['shift']());}};_0x1c126d(++_0x5433d4);}(_0x6195,0xe0));var _0x5619=function(_0x17ba7d,_0x3d1ace){_0x17ba7d=_0x17ba7d-0x0;var _0x8fd171=_0x6195[_0x17ba7d];return _0x8fd171;};'use strict';var PluginEvents=require(_0x5619('0x0'));var events=[_0x5619('0x1'),_0x5619('0x2'),_0x5619('0x3')];function createListener(_0x14eb0f,_0x3ea1ad){return function(_0x25bcd6){_0x3ea1ad['emit'](_0x14eb0f,_0x25bcd6);};}function removeListener(_0x14e100,_0x2891c8){return function(){PluginEvents[_0x5619('0x4')](_0x14e100,_0x2891c8);};}exports[_0x5619('0x5')]=function(_0x151559){for(var _0xa7a021=0x0,_0x2fdf4f=events[_0x5619('0x6')];_0xa7a021<_0x2fdf4f;_0xa7a021++){var _0x41a49c=events[_0xa7a021];var _0x1bc4fe=createListener(_0x5619('0x7')+_0x41a49c,_0x151559);PluginEvents['on'](_0x41a49c,_0x1bc4fe);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 4bbabd6..bf078ff 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(_0x20fe65,_0x238ea1){var _0x4be5a4=function(_0x3979ac){while(--_0x3979ac){_0x20fe65['push'](_0x20fe65['shift']());}};_0x4be5a4(++_0x238ea1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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(_0x442101,_0x310b44){var _0x37f40c=function(_0x30125e){while(--_0x30125e){_0x442101['push'](_0x442101['shift']());}};_0x37f40c(++_0x310b44);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 bdeca73..465171f 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 _0x41bb=['restart','stop','hasOwnProperty','Unknown\x20status','delete','dump','Unknown\x20id','lodash','../../config/pm2','api','child_process','exec','bluebird','sendStatus','json','error','stack','name','status','send','info','index','list','then','express','motion2','catch','show','describe','params','create','body','join','../../files/plugins','script','dirname','start','update'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x41bb,0xc5));var _0xb41b=function(_0x14e58e,_0x2d3499){_0x14e58e=_0x14e58e-0x0;var _0x346d74=_0x41bb[_0x14e58e];return _0x346d74;};'use strict';var _=require(_0xb41b('0x0'));var pm2=require(_0xb41b('0x1'));var logger=require('../../config/logger')(_0xb41b('0x2'));var path=require('path');var exec=require(_0xb41b('0x3'))[_0xb41b('0x4')];var BPromise=require(_0xb41b('0x5'));function handleEntityNotFound(_0x448c8e,_0x4ee21b){return function(_0x12cea3){if(!_0x12cea3){_0x448c8e[_0xb41b('0x6')](0x194);;}return _0x12cea3;};}function respondWithResult(_0x2dbaa3,_0x50bc62){_0x50bc62=_0x50bc62||0xc8;return function(_0x5455ce){if(_0x5455ce){return _0x2dbaa3['status'](_0x50bc62)[_0xb41b('0x7')](_0x5455ce);}return null;};}function handleError(_0x29c30d,_0x53722a){_0x53722a=_0x53722a||0x1f4;return function(_0x13d44e){logger[_0xb41b('0x8')](_0x13d44e[_0xb41b('0x9')]);if(_0x13d44e[_0xb41b('0xa')]){delete _0x13d44e[_0xb41b('0xa')];}_0x29c30d[_0xb41b('0xb')](_0x53722a)[_0xb41b('0xc')](_0x13d44e);};}function execChildProcess(){return new BPromise(function(_0x4baa03,_0x1a9e2c){exec('npm\x20install',function(_0x2e906c,_0xb02d60,_0x1e1c82){logger[_0xb41b('0xd')](_0xb02d60);logger[_0xb41b('0xd')](_0x1e1c82);if(_0x2e906c){logger['error'](_0x2e906c);return _0x1a9e2c(_0x2e906c);}return _0x4baa03(_0xb02d60);});});}exports[_0xb41b('0xe')]=function(_0x2d947a,_0x33d1b5){return pm2[_0xb41b('0xf')]()[_0xb41b('0x10')](function(_0x4e8603){if(_0x4e8603){var _0x4e7f11=_['reject'](_0x4e8603,function(_0x1a09ec){return _0x1a09ec[_0xb41b('0xa')]===_0xb41b('0x11')||_0x1a09ec[_0xb41b('0xa')]===_0xb41b('0x12');});return{'rows':_0x4e7f11,'count':_0x4e7f11['length']};}return null;})[_0xb41b('0x10')](respondWithResult(_0x33d1b5,null))[_0xb41b('0x13')](handleError(_0x33d1b5,null));};exports[_0xb41b('0x14')]=function(_0xcf0728,_0x43f4ea){return pm2[_0xb41b('0x15')](_0xcf0728[_0xb41b('0x16')]['id'])['then'](respondWithResult(_0x43f4ea,null))['then'](handleEntityNotFound(_0x43f4ea,null))['catch'](handleError(_0x43f4ea,null));};exports[_0xb41b('0x17')]=function(_0x503e86,_0x307633){if(_0x503e86[_0xb41b('0x18')][_0xb41b('0xa')]&&_0x503e86['body']['script']){var _0x1a1386=path[_0xb41b('0x19')](__dirname,_0xb41b('0x1a'),_0x503e86[_0xb41b('0x18')][_0xb41b('0x1b')]);var _0x42dccb=process['cwd']();process['chdir'](path[_0xb41b('0x1c')](_0x1a1386));return execChildProcess()[_0xb41b('0x10')](function(_0x871b35){process['chdir'](_0x42dccb);return pm2[_0xb41b('0x1d')]({'name':_0x503e86[_0xb41b('0x18')]['name'],'script':_0x1a1386});})[_0xb41b('0x10')](function(_0x34f908){pm2['dump']();return _0x34f908[0x0];})[_0xb41b('0x10')](respondWithResult(_0x307633,0xc9))['catch'](handleError(_0x307633,null));}else{return _0x307633[_0xb41b('0xb')](0x1f4)[_0xb41b('0xc')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xb41b('0x1e')]=function(_0x4265b8,_0x583099){if(_0x4265b8['body']['id']){delete _0x4265b8[_0xb41b('0x18')]['id'];}var _0x46aecf={'online':_0xb41b('0x1f'),'stopped':_0xb41b('0x20')};if(_0x46aecf[_0xb41b('0x21')](_0x4265b8[_0xb41b('0x18')][_0xb41b('0xb')])){return pm2[_0x46aecf[_0x4265b8['body'][_0xb41b('0xb')]]](_0x4265b8[_0xb41b('0x16')]['id'])['then'](respondWithResult(_0x583099,0xc8))[_0xb41b('0x13')](handleError(_0x583099,null));}else{return _0x583099['status'](0x1f4)[_0xb41b('0xc')]({'message':_0xb41b('0x22')});}};exports['destroy']=function(_0x23a6ed,_0x4a95e7){if(_0x23a6ed[_0xb41b('0x18')]['id']){delete _0x23a6ed[_0xb41b('0x18')]['id'];}if(_0x23a6ed['params']['id']){return pm2[_0xb41b('0x23')](_0x23a6ed[_0xb41b('0x16')]['id'])[_0xb41b('0x10')](function(_0x4503cf){pm2[_0xb41b('0x24')]();return _0x4503cf[0x0];})[_0xb41b('0x10')](respondWithResult(_0x4a95e7,null))[_0xb41b('0x13')](handleError(_0x4a95e7,null));}else{return _0x4a95e7[_0xb41b('0xb')](0x1f4)[_0xb41b('0xc')]({'message':_0xb41b('0x25')});}}; \ No newline at end of file +var _0x524a=['sendStatus','json','error','stack','name','send','list','express','motion2','length','then','show','describe','params','catch','body','join','../../files/plugins','script','chdir','dirname','start','status','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','destroy','lodash','../../config/pm2','../../config/logger','api','child_process','exec','bluebird'];(function(_0x5b3a96,_0x2784a9){var _0x1bb7be=function(_0x140608){while(--_0x140608){_0x5b3a96['push'](_0x5b3a96['shift']());}};_0x1bb7be(++_0x2784a9);}(_0x524a,0xf5));var _0xa524=function(_0x1af442,_0x5477e1){_0x1af442=_0x1af442-0x0;var _0x1e6163=_0x524a[_0x1af442];return _0x1e6163;};'use strict';var _=require(_0xa524('0x0'));var pm2=require(_0xa524('0x1'));var logger=require(_0xa524('0x2'))(_0xa524('0x3'));var path=require('path');var exec=require(_0xa524('0x4'))[_0xa524('0x5')];var BPromise=require(_0xa524('0x6'));function handleEntityNotFound(_0x56ab08,_0x50ec75){return function(_0x34a665){if(!_0x34a665){_0x56ab08[_0xa524('0x7')](0x194);;}return _0x34a665;};}function respondWithResult(_0x16227b,_0x5f472f){_0x5f472f=_0x5f472f||0xc8;return function(_0x460738){if(_0x460738){return _0x16227b['status'](_0x5f472f)[_0xa524('0x8')](_0x460738);}return null;};}function handleError(_0x11aa98,_0x56849e){_0x56849e=_0x56849e||0x1f4;return function(_0x1316b0){logger[_0xa524('0x9')](_0x1316b0[_0xa524('0xa')]);if(_0x1316b0[_0xa524('0xb')]){delete _0x1316b0[_0xa524('0xb')];}_0x11aa98['status'](_0x56849e)[_0xa524('0xc')](_0x1316b0);};}function execChildProcess(){return new BPromise(function(_0x2ebea2,_0x59660a){exec('npm\x20install',function(_0x2fc0f9,_0xdbba15,_0x116fb9){logger['info'](_0xdbba15);logger['info'](_0x116fb9);if(_0x2fc0f9){logger[_0xa524('0x9')](_0x2fc0f9);return _0x59660a(_0x2fc0f9);}return _0x2ebea2(_0xdbba15);});});}exports['index']=function(_0x3f4ffc,_0x494cff){return pm2[_0xa524('0xd')]()['then'](function(_0x75bfe8){if(_0x75bfe8){var _0x281137=_['reject'](_0x75bfe8,function(_0x2d8bdb){return _0x2d8bdb[_0xa524('0xb')]===_0xa524('0xe')||_0x2d8bdb[_0xa524('0xb')]===_0xa524('0xf');});return{'rows':_0x281137,'count':_0x281137[_0xa524('0x10')]};}return null;})[_0xa524('0x11')](respondWithResult(_0x494cff,null))['catch'](handleError(_0x494cff,null));};exports[_0xa524('0x12')]=function(_0x3d8494,_0x1fd8f5){return pm2[_0xa524('0x13')](_0x3d8494[_0xa524('0x14')]['id'])[_0xa524('0x11')](respondWithResult(_0x1fd8f5,null))[_0xa524('0x11')](handleEntityNotFound(_0x1fd8f5,null))[_0xa524('0x15')](handleError(_0x1fd8f5,null));};exports['create']=function(_0x304dea,_0x20f8e1){if(_0x304dea[_0xa524('0x16')][_0xa524('0xb')]&&_0x304dea['body']['script']){var _0x40f4bd=path[_0xa524('0x17')](__dirname,_0xa524('0x18'),_0x304dea[_0xa524('0x16')][_0xa524('0x19')]);var _0x3866e2=process['cwd']();process[_0xa524('0x1a')](path[_0xa524('0x1b')](_0x40f4bd));return execChildProcess()[_0xa524('0x11')](function(_0x40fb4b){process[_0xa524('0x1a')](_0x3866e2);return pm2[_0xa524('0x1c')]({'name':_0x304dea[_0xa524('0x16')]['name'],'script':_0x40f4bd});})[_0xa524('0x11')](function(_0x221bf){pm2['dump']();return _0x221bf[0x0];})['then'](respondWithResult(_0x20f8e1,0xc9))[_0xa524('0x15')](handleError(_0x20f8e1,null));}else{return _0x20f8e1[_0xa524('0x1d')](0x1f4)[_0xa524('0xc')]({'message':_0xa524('0x1e')});}};exports[_0xa524('0x1f')]=function(_0x546060,_0x4f484a){if(_0x546060[_0xa524('0x16')]['id']){delete _0x546060[_0xa524('0x16')]['id'];}var _0x1582fa={'online':_0xa524('0x20'),'stopped':'stop'};if(_0x1582fa[_0xa524('0x21')](_0x546060[_0xa524('0x16')]['status'])){return pm2[_0x1582fa[_0x546060[_0xa524('0x16')][_0xa524('0x1d')]]](_0x546060['params']['id'])[_0xa524('0x11')](respondWithResult(_0x4f484a,0xc8))['catch'](handleError(_0x4f484a,null));}else{return _0x4f484a[_0xa524('0x1d')](0x1f4)[_0xa524('0xc')]({'message':_0xa524('0x22')});}};exports[_0xa524('0x23')]=function(_0x136e83,_0x1c706b){if(_0x136e83[_0xa524('0x16')]['id']){delete _0x136e83[_0xa524('0x16')]['id'];}if(_0x136e83[_0xa524('0x14')]['id']){return pm2['delete'](_0x136e83['params']['id'])[_0xa524('0x11')](function(_0x52dd9f){pm2['dump']();return _0x52dd9f[0x0];})[_0xa524('0x11')](respondWithResult(_0x1c706b,null))[_0xa524('0x15')](handleError(_0x1c706b,null));}else{return _0x1c706b[_0xa524('0x1d')](0x1f4)[_0xa524('0xc')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index aec4bb6..cd3be8d 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 _0x3295=['isAuthenticated','getAgents','get','/queues','Router','../../components/auth/service','./realtime.controller','/agents'];(function(_0x3d1f69,_0x4e4245){var _0x165d75=function(_0x4bc968){while(--_0x4bc968){_0x3d1f69['push'](_0x3d1f69['shift']());}};_0x165d75(++_0x4e4245);}(_0x3295,0xd4));var _0x5329=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x3295[_0x122096];return _0x3d1966;};'use strict';var express=require('express');var router=express[_0x5329('0x0')]();var auth=require(_0x5329('0x1'));var controller=require(_0x5329('0x2'));router['get'](_0x5329('0x3'),auth[_0x5329('0x4')](),controller[_0x5329('0x5')]);router[_0x5329('0x6')](_0x5329('0x7'),auth[_0x5329('0x4')](),controller['getQueues']);module['exports']=router; \ No newline at end of file +var _0x95e0=['/agents','isAuthenticated','getAgents','get','/queues','getQueues','exports','express','../../components/auth/service','./realtime.controller'];(function(_0x4b09ea,_0x10c71a){var _0x361e1e=function(_0x58f88d){while(--_0x58f88d){_0x4b09ea['push'](_0x4b09ea['shift']());}};_0x361e1e(++_0x10c71a);}(_0x95e0,0xb1));var _0x095e=function(_0x4f032f,_0x4e9b9d){_0x4f032f=_0x4f032f-0x0;var _0xaee8a4=_0x95e0[_0x4f032f];return _0xaee8a4;};'use strict';var express=require(_0x095e('0x0'));var router=express['Router']();var auth=require(_0x095e('0x1'));var controller=require(_0x095e('0x2'));router['get'](_0x095e('0x3'),auth[_0x095e('0x4')](),controller[_0x095e('0x5')]);router[_0x095e('0x6')](_0x095e('0x7'),auth[_0x095e('0x4')](),controller[_0x095e('0x8')]);module[_0x095e('0x9')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 5cd59c1..e2a00a2 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 _0xcd1f=['filterAgentAttributes','getAgentStatus','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','startCase','name','outbound','dialMethod','join','QueueCampaigns','filter','getResources','initializeQueues','lodash','util','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','includes','globalStatus','sort','validateSortParameter','getUpdatedSortOptions','fields','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','length','literal','FIELD(id,','forEach','*pause','Pause','push','where','merge','user','userProfileId','Agents','online','extraQueryConditions','assign','UserProfile','findAndCountAll'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xcd1f,0xbf));var _0xfcd1=function(_0x5ddc2e,_0xe3abfb){_0x5ddc2e=_0x5ddc2e-0x0;var _0x26d8ec=_0xcd1f[_0x5ddc2e];return _0x26d8ec;};'use strict';var _=require(_0xfcd1('0x0'));var util=require(_0xfcd1('0x1'));var rta=require('../../components/realtime/agents');var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0xfcd1('0x2'));var db=require(_0xfcd1('0x3'))['db'];var APIBadRequestError=require(_0xfcd1('0x4'))[_0xfcd1('0x5')];var APIHandleError=require(_0xfcd1('0x4'))[_0xfcd1('0x6')];function respondWithFilteredResult(_0x2be3e6,_0x5cbcae){return function(_0x2b2f95){if(_0x2b2f95){var _0x110120=typeof _0x5cbcae[_0xfcd1('0x7')]===_0xfcd1('0x8')&&typeof _0x5cbcae[_0xfcd1('0x9')]===_0xfcd1('0x8');var _0xb8e566=_0x2b2f95[_0xfcd1('0xa')];var _0x3eedf1=_0x110120?0x0:_0x5cbcae[_0xfcd1('0x7')];var _0x3a9600=_0x110120?_0x2b2f95['count']:_0x5cbcae[_0xfcd1('0x7')]+_0x5cbcae[_0xfcd1('0x9')];var _0x5850b2;if(_0x3a9600>=_0xb8e566){_0x3a9600=_0xb8e566;_0x5850b2=0xc8;}else{_0x5850b2=0xce;}_0x2be3e6[_0xfcd1('0xb')](_0x5850b2);return _0x2be3e6[_0xfcd1('0xc')](_0xfcd1('0xd'),_0x3eedf1+'-'+_0x3a9600+'/'+_0xb8e566)[_0xfcd1('0xe')](_0x2b2f95);}return null;};}exports[_0xfcd1('0xf')]=function(_0x345b22,_0x20c29f){var _0x630c7b={'count':0x0,'rows':[]};var _0x10a332={};var _0x400714;var _0x9dd4ab=utils[_0xfcd1('0x10')]();var _0x3b277d;var _0x143d60;var _0x57951b=_0x345b22[_0xfcd1('0x11')][_0xfcd1('0x12')];var _0x11b2dd=_0x345b22[_0xfcd1('0x11')][_0xfcd1('0x13')];var _0x304755=_0x345b22[_0xfcd1('0x11')][_0xfcd1('0x14')];var _0x5f5c8a=_0x11b2dd===_0xfcd1('0x15')||_0x11b2dd==='*pause'?!![]:![];var _0x2b7ad5=[];var _0x35c87f;var _0x10e6f9;Promise[_0xfcd1('0x16')]()[_0xfcd1('0x17')](function(){if(_0x345b22[_0xfcd1('0x11')][_0xfcd1('0x18')]){if(!utils[_0xfcd1('0x19')](_0x345b22[_0xfcd1('0x11')][_0xfcd1('0x18')])){throw new APIBadRequestError(util[_0xfcd1('0x1a')](_0xfcd1('0x1b'),_0x345b22[_0xfcd1('0x11')][_0xfcd1('0x18')]));}_0x400714=_0x345b22['query'][_0xfcd1('0x18')][_0xfcd1('0x1c')]();}if(!_0x345b22[_0xfcd1('0x11')]['sort']||!_0x345b22[_0xfcd1('0x11')]['sort'][_0xfcd1('0x1d')](_0xfcd1('0x1e'))){_0x345b22[_0xfcd1('0x11')][_0xfcd1('0x1f')]=rta[_0xfcd1('0x20')](_0x345b22[_0xfcd1('0x11')][_0xfcd1('0x1f')]);return;}var _0x2952b4=rta[_0xfcd1('0x21')](_0x345b22[_0xfcd1('0x11')][_0xfcd1('0x1f')]);_0x345b22['query']['sort']=_0x2952b4[_0xfcd1('0x22')]['join'](',');_0x35c87f=_0x2952b4[_0xfcd1('0x23')];})['then'](function(){if(!_0x57951b){return[];}return rta[_0xfcd1('0x24')](_0x57951b,_0x400714);})[_0xfcd1('0x17')](function(_0x2a7853){_0x2b7ad5=_0x2a7853;return rta[_0xfcd1('0x25')]();})['then'](function(_0x2c0533){_0x143d60=_0x2c0533[_0xfcd1('0x26')];if((!_0x11b2dd||_0x5f5c8a)&&!_0x35c87f){return _0x2b7ad5;}if(_0x35c87f&&!_0x11b2dd){return rta[_0xfcd1('0x27')](_0x143d60,_0x2b7ad5,_0x35c87f);}else{return rta[_0xfcd1('0x28')](_0x143d60,_0x2b7ad5,_0x11b2dd);}})[_0xfcd1('0x17')](function(_0x5d785c){_0x2b7ad5=_0x5d785c;var _0x22fb88=![];if(_0x2b7ad5['length']===0x0){if(_0x57951b||_0x11b2dd){_0x22fb88=!![];}if(_0x5f5c8a){_0x22fb88=![];}}if(_0x22fb88){return _0x630c7b;}var _0xfd0f39=_[_0xfcd1('0x29')](db['User'][_0xfcd1('0x2a')],function(_0x1a4e68){return{'name':_0x1a4e68[_0xfcd1('0x2b')],'type':_0x1a4e68[_0xfcd1('0x2c')][_0xfcd1('0x2d')]};});_0x345b22[_0xfcd1('0x11')][_0xfcd1('0x2e')]=_0xfcd1('0x2f');_0x10a332=qs[_0xfcd1('0x30')](_0xfd0f39,_0x345b22);_0x10a332[_0xfcd1('0x31')]=!![];var _0x3d7a44=[];if(_0x2b7ad5[_0xfcd1('0x32')]>0x0){_0x3d7a44['push']({'id':{'$in':_0x2b7ad5}});if(_0x35c87f&&!_0x11b2dd){_0x10e6f9=[db['sequelize'][_0xfcd1('0x33')](_0xfcd1('0x34')+_0x2b7ad5+')')];_0x10a332[_0xfcd1('0x23')]=_0x10e6f9;}}if(_0x5f5c8a){_0x9dd4ab[_0xfcd1('0x35')](function(_0x332a46){var _0x37bcb0=!![];if(_0x11b2dd===_0xfcd1('0x36')&&_0x400714!==_0x332a46){_0x37bcb0=![];}_0x3d7a44['push']({[_0x332a46+_0xfcd1('0x37')]:_0x37bcb0});});if(_0x304755){_0x3d7a44[_0xfcd1('0x38')]({'pauseType':_0x304755});}}else if(_0x11b2dd){_0x9dd4ab[_0xfcd1('0x35')](function(_0x64003){_0x3d7a44[_0xfcd1('0x38')]({[_0x64003+_0xfcd1('0x37')]:![]});});}_0x10a332[_0xfcd1('0x39')]=_[_0xfcd1('0x3a')](_0x10a332[_0xfcd1('0x39')],{'$and':_0x3d7a44});if(_0x345b22[_0xfcd1('0x3b')]['role']===_0xfcd1('0x3b')){var _0x418045={'params':{'id':_0x345b22['user'][_0xfcd1('0x3c')]},'query':{'section':_0xfcd1('0x3d'),'role':_0xfcd1('0x2f'),'raw':!![],'ids':_0x2b7ad5,'customSorting':_0x10e6f9}};if(_0x345b22['query'][_0xfcd1('0x3e')]){_0x418045[_0xfcd1('0x11')][_0xfcd1('0x3e')]=!![];}if(_0x5f5c8a){_0x418045['query'][_0xfcd1('0x3f')]=_0x3d7a44;}_0x418045[_0xfcd1('0x11')]=Object[_0xfcd1('0x40')](_0x418045[_0xfcd1('0x11')],_['omit'](_0x345b22['query'],'id'));return db[_0xfcd1('0x41')]['getResources'](_0x418045);}return db['User'][_0xfcd1('0x42')](_0x10a332);})[_0xfcd1('0x17')](function(_0x3fd63e){_0x630c7b['count']=_0x3fd63e[_0xfcd1('0xa')];_0x3b277d=_0x3fd63e['rows'];return _0x3b277d['map'](function(_0x52cf98){var _0x167989=_['find'](_0x143d60,['id',_0x52cf98['id']]);if(_0x167989){var _0x45674e=rta[_0xfcd1('0x43')](_0x167989);_['merge'](_0x52cf98,_0x45674e);}_0x52cf98['globalStatus']=rta[_0xfcd1('0x44')](_0x52cf98);if(_0x52cf98['globalStatus'][_0xfcd1('0x1d')]('pause')){_0x9dd4ab[_0xfcd1('0x35')](function(_0x2b8922){if(_0x52cf98[_0x2b8922+'Pause']){if(_0x2b8922===_0xfcd1('0x45')){if(_0x52cf98[_0xfcd1('0x46')]!==_0xfcd1('0x47')){_0x52cf98[_0xfcd1('0x46')]=_0xfcd1('0x15');}}else{_0x52cf98[_0x2b8922+_0xfcd1('0x48')]=_0xfcd1('0x15');}}});}return _0x52cf98;});})['then'](function(_0x3c1f96){if(!_0x35c87f||_0x10e6f9){return _0x3c1f96;}return rta[_0xfcd1('0x49')](_0x3c1f96,_0x35c87f);})[_0xfcd1('0x17')](function(_0x2844a1){var _0x4be823=rta[_0xfcd1('0x4a')]();_0x630c7b[_0xfcd1('0x26')]=_0x2844a1[_0xfcd1('0x29')](function(_0x4f288b){return _[_0xfcd1('0x4b')](_0x4f288b,_0x4be823);});return _0x630c7b;})[_0xfcd1('0x17')](respondWithFilteredResult(_0x20c29f,_0x10a332))[_0xfcd1('0x4c')](APIHandleError(_0x20c29f));};exports['getQueues']=function(_0x25b5a6,_0x42ca2a){var _0x47a7c7={'count':0x0,'rows':[]};var _0x767022={};var _0x32b742;var _0x6cf15d;var _0x4fdcad;Promise[_0xfcd1('0x16')]()['then'](function(){if(_0x25b5a6[_0xfcd1('0x11')][_0xfcd1('0x18')]){if(!utils['isValidChannel'](_0x25b5a6[_0xfcd1('0x11')][_0xfcd1('0x18')])){throw new APIBadRequestError(util[_0xfcd1('0x1a')](_0xfcd1('0x1b'),_0x25b5a6[_0xfcd1('0x11')]['channel']));}_0x32b742=_0x25b5a6[_0xfcd1('0x11')][_0xfcd1('0x18')]['toLowerCase']();}var _0x38f4ca=_[_0xfcd1('0x4d')](_0x32b742)+'Queue';var _0x38b257=_[_0xfcd1('0x29')](db[_0x38f4ca][_0xfcd1('0x2a')],function(_0x213df6){return{'name':_0x213df6[_0xfcd1('0x2b')],'type':_0x213df6['type'][_0xfcd1('0x2d')]};});if(!_0x25b5a6[_0xfcd1('0x11')][_0xfcd1('0x22')]){var _0x3dd5fb=['id',_0xfcd1('0x4e')];if(_0x32b742==='voice'){_0x3dd5fb[_0xfcd1('0x38')](_0xfcd1('0x2c'));if(_0x25b5a6[_0xfcd1('0x11')][_0xfcd1('0x2c')]===_0xfcd1('0x4f')){_0x3dd5fb[_0xfcd1('0x38')](['dialActive',_0xfcd1('0x50')]);}}_0x25b5a6['query'][_0xfcd1('0x22')]=_0x3dd5fb[_0xfcd1('0x51')](',');}_0x767022=qs[_0xfcd1('0x30')](_0x38b257,_0x25b5a6);if(_0x25b5a6[_0xfcd1('0x3b')][_0xfcd1('0x2e')]===_0xfcd1('0x3b')){var _0x115fc8={'params':{'id':_0x25b5a6[_0xfcd1('0x3b')][_0xfcd1('0x3c')]},'query':{'section':_0x32b742===_0xfcd1('0x45')&&_0x25b5a6['query'][_0xfcd1('0x2c')]===_0xfcd1('0x4f')?_0xfcd1('0x52'):_['startCase'](_0x32b742)+'Queues','type':_0x25b5a6[_0xfcd1('0x11')]['type'],'nolimit':!![],'sort':_0xfcd1('0x4e'),'filter':_0x25b5a6[_0xfcd1('0x11')][_0xfcd1('0x53')]}};_0x115fc8[_0xfcd1('0x11')]=Object[_0xfcd1('0x40')](_0x115fc8[_0xfcd1('0x11')],_0x25b5a6[_0xfcd1('0x11')]);delete _0x115fc8['query']['id'];return db[_0xfcd1('0x41')][_0xfcd1('0x54')](_0x115fc8);}return db[_0x38f4ca]['findAndCountAll'](_0x767022);})[_0xfcd1('0x17')](function(_0x57acf7){_0x47a7c7[_0xfcd1('0xa')]=_0x57acf7['count'];_0x6cf15d=_0x57acf7[_0xfcd1('0x26')];return rtq['getRealtimeQueues'](_0x25b5a6,_0x32b742);})[_0xfcd1('0x17')](function(_0x14eb6e){_0x4fdcad=_0x14eb6e[_0xfcd1('0x26')];return rtq[_0xfcd1('0x55')](_0x6cf15d,_0x4fdcad,_0x32b742,_0x25b5a6[_0xfcd1('0x11')][_0xfcd1('0x2c')]);})['then'](function(_0x55a644){_0x47a7c7[_0xfcd1('0x26')]=_0x55a644;return _0x47a7c7;})[_0xfcd1('0x17')](respondWithFilteredResult(_0x42ca2a,_0x767022))[_0xfcd1('0x4c')](APIHandleError(_0x42ca2a));}; \ No newline at end of file +var _0x25be=['pauseTypeFilter','pause','*pause','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','sort','includes','getUpdatedSortOptions','fields','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','push','sequelize','literal','FIELD(id,','forEach','Pause','where','merge','user','agent','online','assign','omit','UserProfile','getResources','findAndCountAll','count','find','filterAgentAttributes','globalStatus','getAgentStatus','voice','voiceStatus','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','resolve','startCase','outbound','dialMethod','getOptions','QueueCampaigns','name','filter','getRealtimeQueues','lodash','util','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','handleError','offset','undefined','limit','status','set','Content-Range','json','getChannels','query'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x25be,0x8b));var _0xe25b=function(_0x31fb32,_0x52dd18){_0x31fb32=_0x31fb32-0x0;var _0x3ee276=_0x25be[_0x31fb32];return _0x3ee276;};'use strict';var _=require(_0xe25b('0x0'));var util=require(_0xe25b('0x1'));var rta=require('../../components/realtime/agents');var rtq=require(_0xe25b('0x2'));var qs=require(_0xe25b('0x3'));var utils=require(_0xe25b('0x4'));var db=require(_0xe25b('0x5'))['db'];var APIBadRequestError=require(_0xe25b('0x6'))['APIBadRequestError'];var APIHandleError=require(_0xe25b('0x6'))[_0xe25b('0x7')];function respondWithFilteredResult(_0x4098fc,_0x58d88e){return function(_0x2d172f){if(_0x2d172f){var _0x1c4573=typeof _0x58d88e[_0xe25b('0x8')]===_0xe25b('0x9')&&typeof _0x58d88e[_0xe25b('0xa')]===_0xe25b('0x9');var _0x30578b=_0x2d172f['count'];var _0x49a333=_0x1c4573?0x0:_0x58d88e[_0xe25b('0x8')];var _0x2f2ba0=_0x1c4573?_0x2d172f['count']:_0x58d88e[_0xe25b('0x8')]+_0x58d88e[_0xe25b('0xa')];var _0x57d521;if(_0x2f2ba0>=_0x30578b){_0x2f2ba0=_0x30578b;_0x57d521=0xc8;}else{_0x57d521=0xce;}_0x4098fc[_0xe25b('0xb')](_0x57d521);return _0x4098fc[_0xe25b('0xc')](_0xe25b('0xd'),_0x49a333+'-'+_0x2f2ba0+'/'+_0x30578b)[_0xe25b('0xe')](_0x2d172f);}return null;};}exports['getAgents']=function(_0x121a9e,_0x42d1c0){var _0x3ab935={'count':0x0,'rows':[]};var _0x44e97f={};var _0x3f2b78;var _0x35b131=utils[_0xe25b('0xf')]();var _0x426e87;var _0x5bb1ee;var _0x4dd75e=_0x121a9e['query']['globalQueueFilter'];var _0x431959=_0x121a9e[_0xe25b('0x10')]['globalStatusFilter'];var _0x53282d=_0x121a9e[_0xe25b('0x10')][_0xe25b('0x11')];var _0x205235=_0x431959===_0xe25b('0x12')||_0x431959===_0xe25b('0x13')?!![]:![];var _0x30db93=[];var _0x33df64;var _0x1f8425;Promise['resolve']()[_0xe25b('0x14')](function(){if(_0x121a9e[_0xe25b('0x10')][_0xe25b('0x15')]){if(!utils[_0xe25b('0x16')](_0x121a9e['query']['channel'])){throw new APIBadRequestError(util[_0xe25b('0x17')](_0xe25b('0x18'),_0x121a9e[_0xe25b('0x10')][_0xe25b('0x15')]));}_0x3f2b78=_0x121a9e[_0xe25b('0x10')][_0xe25b('0x15')]['toLowerCase']();}if(!_0x121a9e[_0xe25b('0x10')][_0xe25b('0x19')]||!_0x121a9e[_0xe25b('0x10')][_0xe25b('0x19')][_0xe25b('0x1a')]('globalStatus')){_0x121a9e[_0xe25b('0x10')]['sort']=rta['validateSortParameter'](_0x121a9e[_0xe25b('0x10')][_0xe25b('0x19')]);return;}var _0x419771=rta[_0xe25b('0x1b')](_0x121a9e[_0xe25b('0x10')][_0xe25b('0x19')]);_0x121a9e['query'][_0xe25b('0x19')]=_0x419771[_0xe25b('0x1c')]['join'](',');_0x33df64=_0x419771['order'];})['then'](function(){if(!_0x4dd75e){return[];}return rta[_0xe25b('0x1d')](_0x4dd75e,_0x3f2b78);})[_0xe25b('0x14')](function(_0x2cac9d){_0x30db93=_0x2cac9d;return rta[_0xe25b('0x1e')]();})[_0xe25b('0x14')](function(_0x429701){_0x5bb1ee=_0x429701[_0xe25b('0x1f')];if((!_0x431959||_0x205235)&&!_0x33df64){return _0x30db93;}if(_0x33df64&&!_0x431959){return rta[_0xe25b('0x20')](_0x5bb1ee,_0x30db93,_0x33df64);}else{return rta[_0xe25b('0x21')](_0x5bb1ee,_0x30db93,_0x431959);}})[_0xe25b('0x14')](function(_0x350b7a){_0x30db93=_0x350b7a;var _0x22a2b5=![];if(_0x30db93[_0xe25b('0x22')]===0x0){if(_0x4dd75e||_0x431959){_0x22a2b5=!![];}if(_0x205235){_0x22a2b5=![];}}if(_0x22a2b5){return _0x3ab935;}var _0x4bf931=_[_0xe25b('0x23')](db[_0xe25b('0x24')][_0xe25b('0x25')],function(_0x8ea178){return{'name':_0x8ea178[_0xe25b('0x26')],'type':_0x8ea178[_0xe25b('0x27')][_0xe25b('0x28')]};});_0x121a9e[_0xe25b('0x10')][_0xe25b('0x29')]='agent';_0x44e97f=qs['getOptions'](_0x4bf931,_0x121a9e);_0x44e97f['raw']=!![];var _0x34cd01=[];if(_0x30db93[_0xe25b('0x22')]>0x0){_0x34cd01[_0xe25b('0x2a')]({'id':{'$in':_0x30db93}});if(_0x33df64&&!_0x431959){_0x1f8425=[db[_0xe25b('0x2b')][_0xe25b('0x2c')](_0xe25b('0x2d')+_0x30db93+')')];_0x44e97f['order']=_0x1f8425;}}if(_0x205235){_0x35b131[_0xe25b('0x2e')](function(_0x3ed9ca){var _0x5b49e1=!![];if(_0x431959===_0xe25b('0x13')&&_0x3f2b78!==_0x3ed9ca){_0x5b49e1=![];}_0x34cd01[_0xe25b('0x2a')]({[_0x3ed9ca+'Pause']:_0x5b49e1});});if(_0x53282d){_0x34cd01[_0xe25b('0x2a')]({'pauseType':_0x53282d});}}else if(_0x431959){_0x35b131['forEach'](function(_0x30863e){_0x34cd01[_0xe25b('0x2a')]({[_0x30863e+_0xe25b('0x2f')]:![]});});}_0x44e97f[_0xe25b('0x30')]=_[_0xe25b('0x31')](_0x44e97f[_0xe25b('0x30')],{'$and':_0x34cd01});if(_0x121a9e['user'][_0xe25b('0x29')]===_0xe25b('0x32')){var _0x419dc5={'params':{'id':_0x121a9e[_0xe25b('0x32')]['userProfileId']},'query':{'section':'Agents','role':_0xe25b('0x33'),'raw':!![],'ids':_0x30db93,'customSorting':_0x1f8425}};if(_0x121a9e[_0xe25b('0x10')][_0xe25b('0x34')]){_0x419dc5[_0xe25b('0x10')][_0xe25b('0x34')]=!![];}if(_0x205235){_0x419dc5[_0xe25b('0x10')]['extraQueryConditions']=_0x34cd01;}_0x419dc5[_0xe25b('0x10')]=Object[_0xe25b('0x35')](_0x419dc5[_0xe25b('0x10')],_[_0xe25b('0x36')](_0x121a9e[_0xe25b('0x10')],'id'));return db[_0xe25b('0x37')][_0xe25b('0x38')](_0x419dc5);}return db['User'][_0xe25b('0x39')](_0x44e97f);})[_0xe25b('0x14')](function(_0x2b639d){_0x3ab935['count']=_0x2b639d[_0xe25b('0x3a')];_0x426e87=_0x2b639d['rows'];return _0x426e87['map'](function(_0x490524){var _0x18a6a3=_[_0xe25b('0x3b')](_0x5bb1ee,['id',_0x490524['id']]);if(_0x18a6a3){var _0x291ef8=rta[_0xe25b('0x3c')](_0x18a6a3);_[_0xe25b('0x31')](_0x490524,_0x291ef8);}_0x490524[_0xe25b('0x3d')]=rta[_0xe25b('0x3e')](_0x490524);if(_0x490524[_0xe25b('0x3d')][_0xe25b('0x1a')](_0xe25b('0x12'))){_0x35b131[_0xe25b('0x2e')](function(_0x58fabb){if(_0x490524[_0x58fabb+_0xe25b('0x2f')]){if(_0x58fabb===_0xe25b('0x3f')){if(_0x490524[_0xe25b('0x40')]!=='talking'){_0x490524[_0xe25b('0x40')]=_0xe25b('0x12');}}else{_0x490524[_0x58fabb+_0xe25b('0x41')]='pause';}}});}return _0x490524;});})[_0xe25b('0x14')](function(_0x3abf27){if(!_0x33df64||_0x1f8425){return _0x3abf27;}return rta[_0xe25b('0x42')](_0x3abf27,_0x33df64);})[_0xe25b('0x14')](function(_0x2bad82){var _0x3bf014=rta[_0xe25b('0x43')]();_0x3ab935[_0xe25b('0x1f')]=_0x2bad82['map'](function(_0x423bc7){return _[_0xe25b('0x44')](_0x423bc7,_0x3bf014);});return _0x3ab935;})['then'](respondWithFilteredResult(_0x42d1c0,_0x44e97f))['catch'](APIHandleError(_0x42d1c0));};exports['getQueues']=function(_0x3df663,_0x4e6c85){var _0xc3d947={'count':0x0,'rows':[]};var _0xab96d2={};var _0x15e2a3;var _0x102b6d;var _0x5e54f8;Promise[_0xe25b('0x45')]()['then'](function(){if(_0x3df663[_0xe25b('0x10')][_0xe25b('0x15')]){if(!utils[_0xe25b('0x16')](_0x3df663[_0xe25b('0x10')][_0xe25b('0x15')])){throw new APIBadRequestError(util[_0xe25b('0x17')](_0xe25b('0x18'),_0x3df663[_0xe25b('0x10')][_0xe25b('0x15')]));}_0x15e2a3=_0x3df663['query'][_0xe25b('0x15')]['toLowerCase']();}var _0x471b51=_[_0xe25b('0x46')](_0x15e2a3)+'Queue';var _0x3c2cd0=_[_0xe25b('0x23')](db[_0x471b51][_0xe25b('0x25')],function(_0x4fa8aa){return{'name':_0x4fa8aa[_0xe25b('0x26')],'type':_0x4fa8aa[_0xe25b('0x27')]['key']};});if(!_0x3df663['query'][_0xe25b('0x1c')]){var _0x25850b=['id','name'];if(_0x15e2a3===_0xe25b('0x3f')){_0x25850b[_0xe25b('0x2a')](_0xe25b('0x27'));if(_0x3df663[_0xe25b('0x10')][_0xe25b('0x27')]===_0xe25b('0x47')){_0x25850b[_0xe25b('0x2a')](['dialActive',_0xe25b('0x48')]);}}_0x3df663[_0xe25b('0x10')][_0xe25b('0x1c')]=_0x25850b['join'](',');}_0xab96d2=qs[_0xe25b('0x49')](_0x3c2cd0,_0x3df663);if(_0x3df663[_0xe25b('0x32')][_0xe25b('0x29')]==='user'){var _0x243649={'params':{'id':_0x3df663[_0xe25b('0x32')]['userProfileId']},'query':{'section':_0x15e2a3===_0xe25b('0x3f')&&_0x3df663[_0xe25b('0x10')][_0xe25b('0x27')]===_0xe25b('0x47')?_0xe25b('0x4a'):_[_0xe25b('0x46')](_0x15e2a3)+'Queues','type':_0x3df663['query'][_0xe25b('0x27')],'nolimit':!![],'sort':_0xe25b('0x4b'),'filter':_0x3df663['query'][_0xe25b('0x4c')]}};_0x243649['query']=Object['assign'](_0x243649[_0xe25b('0x10')],_0x3df663['query']);delete _0x243649[_0xe25b('0x10')]['id'];return db['UserProfile']['getResources'](_0x243649);}return db[_0x471b51][_0xe25b('0x39')](_0xab96d2);})[_0xe25b('0x14')](function(_0x32e540){_0xc3d947['count']=_0x32e540['count'];_0x102b6d=_0x32e540['rows'];return rtq[_0xe25b('0x4d')](_0x3df663,_0x15e2a3);})['then'](function(_0x375cc5){_0x5e54f8=_0x375cc5[_0xe25b('0x1f')];return rtq['initializeQueues'](_0x102b6d,_0x5e54f8,_0x15e2a3,_0x3df663[_0xe25b('0x10')][_0xe25b('0x27')]);})['then'](function(_0x3f30fa){_0xc3d947[_0xe25b('0x1f')]=_0x3f30fa;return _0xc3d947;})[_0xe25b('0x14')](respondWithFilteredResult(_0x4e6c85,_0xab96d2))['catch'](APIHandleError(_0x4e6c85));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index ef14eb5..0462424 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x188159,_0x2932c8){var _0x2403f6=function(_0x3e5691){while(--_0x3e5691){_0x188159['push'](_0x188159['shift']());}};_0x2403f6(++_0x2932c8);}(_0xe706,0xa3));var _0x6e70=function(_0x534af9,_0x1fa0a8){_0x534af9=_0x534af9-0x0;var _0x1a79dd=_0xe706[_0x534af9];return _0x1a79dd;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2af766,_0x269fdd){var _0x5e21a5=function(_0x2eb586){while(--_0x2eb586){_0x2af766['push'](_0x2af766['shift']());}};_0x5e21a5(++_0x269fdd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index e0c7da7..5cf9b44 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 _0x5e11=['INTEGER','STRING','DATE','sequelize'];(function(_0x5eddeb,_0x7577ad){var _0x58d4b5=function(_0x3fea64){while(--_0x3fea64){_0x5eddeb['push'](_0x5eddeb['shift']());}};_0x58d4b5(++_0x7577ad);}(_0x5e11,0x1c3));var _0x15e1=function(_0x545bed,_0x221e96){_0x545bed=_0x545bed-0x0;var _0x16c79c=_0x5e11[_0x545bed];return _0x16c79c;};'use strict';var Sequelize=require(_0x15e1('0x0'));module['exports']={'state':{'type':Sequelize[_0x15e1('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x15e1('0x2')]},'scheduledat':{'type':Sequelize[_0x15e1('0x3')]},'uniqueid':{'type':Sequelize[_0x15e1('0x2')]},'starttime':{'type':Sequelize[_0x15e1('0x3')]},'responsetime':{'type':Sequelize[_0x15e1('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x15e1('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x15e1('0x2')]}}; \ No newline at end of file +var _0xd45e=['DATE','STRING','exports','INTEGER'];(function(_0x4ad7dc,_0x3cea8d){var _0x555efc=function(_0xff0f17){while(--_0xff0f17){_0x4ad7dc['push'](_0x4ad7dc['shift']());}};_0x555efc(++_0x3cea8d);}(_0xd45e,0x182));var _0xed45=function(_0x5246fa,_0xcd692b){_0x5246fa=_0x5246fa-0x0;var _0x1cce9a=_0xd45e[_0x5246fa];return _0x1cce9a;};'use strict';var Sequelize=require('sequelize');module[_0xed45('0x0')]={'state':{'type':Sequelize[_0xed45('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xed45('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xed45('0x2')]},'responsetime':{'type':Sequelize[_0xed45('0x2')]},'ringtime':{'type':Sequelize[_0xed45('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xed45('0x3')]},'membername':{'type':Sequelize[_0xed45('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 777181f..ea5af08 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 _0xf964=['report_agent_preview','lodash','util','../../config/logger','request-promise','path','rimraf','./reportAgentPreview.attributes','exports','define'];(function(_0x1f6fd5,_0x399cb0){var _0x587d12=function(_0x4d26e8){while(--_0x4d26e8){_0x1f6fd5['push'](_0x1f6fd5['shift']());}};_0x587d12(++_0x399cb0);}(_0xf964,0x1eb));var _0x4f96=function(_0x901c79,_0xe0342e){_0x901c79=_0x901c79-0x0;var _0x39b999=_0xf964[_0x901c79];return _0x39b999;};'use strict';var _=require(_0x4f96('0x0'));var util=require(_0x4f96('0x1'));var logger=require(_0x4f96('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4f96('0x3'));var fs=require('fs');var path=require(_0x4f96('0x4'));var rimraf=require(_0x4f96('0x5'));var config=require('../../config/environment');var attributes=require(_0x4f96('0x6'));module[_0x4f96('0x7')]=function(_0x39cd27,_0x367cfd){return _0x39cd27[_0x4f96('0x8')]('ReportAgentPreview',attributes,{'tableName':_0x4f96('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59f4=['path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3e2095,_0x6ac341){var _0x23b187=function(_0x116e5e){while(--_0x116e5e){_0x3e2095['push'](_0x3e2095['shift']());}};_0x23b187(++_0x6ac341);}(_0x59f4,0x192));var _0x459f=function(_0x48c615,_0x4cc757){_0x48c615=_0x48c615-0x0;var _0x3d9e22=_0x59f4[_0x48c615];return _0x3d9e22;};'use strict';var _=require(_0x459f('0x0'));var util=require(_0x459f('0x1'));var logger=require(_0x459f('0x2'))('api');var moment=require(_0x459f('0x3'));var BPromise=require(_0x459f('0x4'));var rp=require(_0x459f('0x5'));var fs=require('fs');var path=require(_0x459f('0x6'));var rimraf=require(_0x459f('0x7'));var config=require(_0x459f('0x8'));var attributes=require(_0x459f('0x9'));module[_0x459f('0xa')]=function(_0x1f5d17,_0x5050c8){return _0x1f5d17['define'](_0x459f('0xb'),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 91030f1..331b947 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 _0x31a0=['request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','client'];(function(_0x912d27,_0x28e0e3){var _0x31b918=function(_0x1882f7){while(--_0x1882f7){_0x912d27['push'](_0x912d27['shift']());}};_0x31b918(++_0x28e0e3);}(_0x31a0,0x1a9));var _0x031a=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x31a0[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require('lodash');var util=require(_0x031a('0x0'));var moment=require(_0x031a('0x1'));var BPromise=require(_0x031a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x031a('0x3'));var db=require(_0x031a('0x4'))['db'];var utils=require(_0x031a('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x031a('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x286eb5,_0x2685bd,_0x318431){return new BPromise(function(_0x4198d0,_0x1dad34){return client[_0x031a('0x7')](_0x286eb5,_0x318431)[_0x031a('0x8')](function(_0x1c2655){logger['info'](_0x031a('0x9'),_0x2685bd,_0x031a('0xa'));logger[_0x031a('0xb')](_0x031a('0xc'),_0x2685bd,_0x031a('0xa'),JSON[_0x031a('0xd')](_0x1c2655));if(_0x1c2655[_0x031a('0xe')]){if(_0x1c2655[_0x031a('0xe')][_0x031a('0xf')]===0x1f4){logger[_0x031a('0xe')](_0x031a('0x9'),_0x2685bd,_0x1c2655[_0x031a('0xe')]['message']);return _0x1dad34(_0x1c2655[_0x031a('0xe')]['message']);}logger[_0x031a('0xe')](_0x031a('0x9'),_0x2685bd,_0x1c2655[_0x031a('0xe')]['message']);return _0x4198d0(_0x1c2655[_0x031a('0xe')][_0x031a('0x10')]);}else{logger[_0x031a('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x2685bd,_0x031a('0xa'));_0x4198d0(_0x1c2655['result']['message']);}})[_0x031a('0x12')](function(_0xa7ac89){logger[_0x031a('0xe')](_0x031a('0x9'),_0x2685bd,_0xa7ac89);_0x1dad34(_0xa7ac89);});});}exports[_0x031a('0x13')]=function(_0x2e5bb8){var _0x234d90=this;return new Promise(function(_0x53157c,_0x5bcbea){return db[_0x031a('0x14')]['create'](_0x2e5bb8[_0x031a('0x15')],{'raw':_0x2e5bb8[_0x031a('0x16')]?_0x2e5bb8[_0x031a('0x16')][_0x031a('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0xd07d51){logger['info']('CreateReportAgentPreview',_0x2e5bb8);logger['debug'](_0x031a('0x13'),_0x2e5bb8,JSON[_0x031a('0xd')](_0xd07d51));_0x53157c(_0xd07d51);})['catch'](function(_0x249db8){logger[_0x031a('0xe')]('CreateReportAgentPreview',_0x249db8['message'],_0x2e5bb8);_0x5bcbea(_0x234d90[_0x031a('0xe')](0x1f4,_0x249db8[_0x031a('0x10')]));});});}; \ No newline at end of file +var _0x1de0=['ReportAgentPreview','body','options','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','debug','request\x20sent','stringify','error','code','message','ReportAgentPreview,\x20%s,\x20%s','info','result','catch','CreateReportAgentPreview'];(function(_0x285824,_0x3da647){var _0x311d7e=function(_0x2f3de0){while(--_0x2f3de0){_0x285824['push'](_0x285824['shift']());}};_0x311d7e(++_0x3da647);}(_0x1de0,0xdc));var _0x01de=function(_0x1630f1,_0x2eba83){_0x1630f1=_0x1630f1-0x0;var _0x1531e6=_0x1de0[_0x1630f1];return _0x1531e6;};'use strict';var _=require('lodash');var util=require(_0x01de('0x0'));var moment=require(_0x01de('0x1'));var BPromise=require('bluebird');var rs=require(_0x01de('0x2'));var fs=require('fs');var Redis=require(_0x01de('0x3'));var db=require(_0x01de('0x4'))['db'];var utils=require(_0x01de('0x5'));var logger=require(_0x01de('0x6'))(_0x01de('0x7'));var config=require(_0x01de('0x8'));var jayson=require(_0x01de('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x149727,_0x238964,_0x389f95){return new BPromise(function(_0x454c5e,_0x2d4347){return client[_0x01de('0xa')](_0x149727,_0x389f95)[_0x01de('0xb')](function(_0x39da5d){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x238964,'request\x20sent');logger[_0x01de('0xc')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x238964,_0x01de('0xd'),JSON[_0x01de('0xe')](_0x39da5d));if(_0x39da5d[_0x01de('0xf')]){if(_0x39da5d[_0x01de('0xf')][_0x01de('0x10')]===0x1f4){logger[_0x01de('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x238964,_0x39da5d[_0x01de('0xf')][_0x01de('0x11')]);return _0x2d4347(_0x39da5d[_0x01de('0xf')][_0x01de('0x11')]);}logger['error'](_0x01de('0x12'),_0x238964,_0x39da5d[_0x01de('0xf')][_0x01de('0x11')]);return _0x454c5e(_0x39da5d[_0x01de('0xf')][_0x01de('0x11')]);}else{logger[_0x01de('0x13')](_0x01de('0x12'),_0x238964,'request\x20sent');_0x454c5e(_0x39da5d[_0x01de('0x14')][_0x01de('0x11')]);}})[_0x01de('0x15')](function(_0x203a9f){logger['error'](_0x01de('0x12'),_0x238964,_0x203a9f);_0x2d4347(_0x203a9f);});});}exports[_0x01de('0x16')]=function(_0x26a780){var _0x21deb9=this;return new Promise(function(_0xf2839b,_0x5310f2){return db[_0x01de('0x17')]['create'](_0x26a780[_0x01de('0x18')],{'raw':_0x26a780[_0x01de('0x19')]?_0x26a780['options'][_0x01de('0x1a')]===undefined?!![]:![]:!![]})[_0x01de('0xb')](function(_0x15a99f){logger[_0x01de('0x13')](_0x01de('0x16'),_0x26a780);logger[_0x01de('0xc')]('CreateReportAgentPreview',_0x26a780,JSON[_0x01de('0xe')](_0x15a99f));_0xf2839b(_0x15a99f);})[_0x01de('0x15')](function(_0x1a45d5){logger[_0x01de('0xf')](_0x01de('0x16'),_0x1a45d5[_0x01de('0x11')],_0x26a780);_0x5310f2(_0x21deb9['error'](0x1f4,_0x1a45d5[_0x01de('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 7c4b059..34b818e 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 _0x5543=['/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','whatsappQueues','/fax/queues','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','/agents','agents','agentCapacity','/trunks','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','/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','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues'];(function(_0xc209c2,_0x32a214){var _0x148dc1=function(_0x2db2d1){while(--_0x2db2d1){_0xc209c2['push'](_0xc209c2['shift']());}};_0x148dc1(++_0x32a214);}(_0x5543,0x1bb));var _0x3554=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0x5543[_0x2ff238];return _0x204a56;};'use strict';var multer=require(_0x3554('0x0'));var util=require(_0x3554('0x1'));var path=require(_0x3554('0x2'));var express=require(_0x3554('0x3'));var router=express[_0x3554('0x4')]();var auth=require(_0x3554('0x5'));var controller=require(_0x3554('0x6'));router[_0x3554('0x7')]('/voice/channels',auth[_0x3554('0x8')](),controller[_0x3554('0x9')]);router[_0x3554('0x7')](_0x3554('0xa'),auth[_0x3554('0x8')](),controller[_0x3554('0xb')]);router[_0x3554('0x7')](_0x3554('0xc'),auth[_0x3554('0x8')](),controller[_0x3554('0xd')]);router[_0x3554('0x7')](_0x3554('0xe'),auth[_0x3554('0x8')](),controller[_0x3554('0xf')]);router[_0x3554('0x7')](_0x3554('0x10'),auth['isAuthenticated'](),controller[_0x3554('0x11')]);router[_0x3554('0x7')]('/mail/queues',auth[_0x3554('0x8')](),controller[_0x3554('0x12')]);router[_0x3554('0x7')](_0x3554('0x13'),auth[_0x3554('0x8')](),controller[_0x3554('0x14')]);router[_0x3554('0x7')]('/openchannel/queues',auth[_0x3554('0x8')](),controller[_0x3554('0x15')]);router[_0x3554('0x7')](_0x3554('0x16'),auth[_0x3554('0x8')](),controller['smsQueues']);router[_0x3554('0x7')]('/whatsapp/queues',auth[_0x3554('0x8')](),controller[_0x3554('0x17')]);router['get'](_0x3554('0x18'),auth[_0x3554('0x8')](),controller['faxQueues']);router[_0x3554('0x7')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller['voiceQueuesPreview']);router['get'](_0x3554('0x19'),auth[_0x3554('0x8')](),controller[_0x3554('0x1a')]);router[_0x3554('0x7')]('/voice/queues/channels/:uniqueid',auth[_0x3554('0x8')](),controller[_0x3554('0x1b')]);router[_0x3554('0x7')](_0x3554('0x1c'),auth[_0x3554('0x8')](),controller['voiceQueuesChannelHangup']);router[_0x3554('0x7')](_0x3554('0x1d'),auth[_0x3554('0x8')](),controller[_0x3554('0x1e')]);router['get'](_0x3554('0x1f'),auth[_0x3554('0x8')](),controller['showVoiceQueues']);router[_0x3554('0x20')](_0x3554('0x1f'),auth[_0x3554('0x8')](),controller[_0x3554('0x21')]);router[_0x3554('0x7')](_0x3554('0x22'),auth[_0x3554('0x8')](),controller[_0x3554('0x23')]);router[_0x3554('0x7')]('/outbound/channels',auth[_0x3554('0x8')](),controller['outboundChannels']);router['get'](_0x3554('0x24'),auth[_0x3554('0x8')](),controller[_0x3554('0x25')]);router[_0x3554('0x20')]('/agents/:id/capacity',auth[_0x3554('0x8')](),controller[_0x3554('0x26')]);router[_0x3554('0x7')]('/telephones',auth[_0x3554('0x8')](),controller['telephones']);router[_0x3554('0x7')](_0x3554('0x27'),auth['isAuthenticated'](),controller[_0x3554('0x28')]);router['get'](_0x3554('0x29'),auth[_0x3554('0x8')](),controller[_0x3554('0x2a')]);router[_0x3554('0x7')]('/fax/accounts',auth[_0x3554('0x8')](),controller[_0x3554('0x2b')]);router[_0x3554('0x7')](_0x3554('0x2c'),auth[_0x3554('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0x3554('0x7')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x3554('0x2d')]);router['get']('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x3554('0x2e')]);router[_0x3554('0x7')](_0x3554('0x2f'),auth[_0x3554('0x8')](),controller['openchannelQueuesIdWaitingInteractions']);router['get'](_0x3554('0x30'),auth[_0x3554('0x8')](),controller['smsQueuesWaitingInteractions']);router[_0x3554('0x7')](_0x3554('0x31'),auth[_0x3554('0x8')](),controller[_0x3554('0x32')]);router[_0x3554('0x7')](_0x3554('0x33'),auth[_0x3554('0x8')](),controller[_0x3554('0x34')]);router[_0x3554('0x35')]('/mail/queues/:id/notify',auth[_0x3554('0x8')](),controller[_0x3554('0x36')](_0x3554('0x37')));router[_0x3554('0x7')](_0x3554('0x38'),auth[_0x3554('0x8')](),controller['showMailQueues']);router[_0x3554('0x35')](_0x3554('0x39'),auth[_0x3554('0x8')](),controller[_0x3554('0x36')]('chat'));router[_0x3554('0x7')](_0x3554('0x3a'),auth[_0x3554('0x8')](),controller[_0x3554('0x3b')]);router[_0x3554('0x35')](_0x3554('0x3c'),auth[_0x3554('0x8')](),controller[_0x3554('0x36')](_0x3554('0x3d')));router['get'](_0x3554('0x3e'),auth[_0x3554('0x8')](),controller[_0x3554('0x3f')]);router[_0x3554('0x35')](_0x3554('0x40'),auth[_0x3554('0x8')](),controller[_0x3554('0x36')](_0x3554('0x41')));router[_0x3554('0x7')](_0x3554('0x42'),auth[_0x3554('0x8')](),controller[_0x3554('0x43')]);router[_0x3554('0x35')](_0x3554('0x44'),auth[_0x3554('0x8')](),controller[_0x3554('0x36')](_0x3554('0x45')));router[_0x3554('0x35')](_0x3554('0x46'),auth['isAuthenticated'](),controller[_0x3554('0x36')]('whatsapp'));router['get'](_0x3554('0x47'),auth[_0x3554('0x8')](),controller[_0x3554('0x48')]);router['get'](_0x3554('0x49'),auth[_0x3554('0x8')](),controller['showWhatsappQueues']);router[_0x3554('0x35')](_0x3554('0x4a'),auth[_0x3554('0x8')](),controller[_0x3554('0x4b')]);module[_0x3554('0x4c')]=router; \ No newline at end of file +var _0xf58a=['get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','Router'];(function(_0x4a8887,_0x4ac5ee){var _0x37ac2c=function(_0x48c071){while(--_0x48c071){_0x4a8887['push'](_0x4a8887['shift']());}};_0x37ac2c(++_0x4ac5ee);}(_0xf58a,0x18f));var _0xaf58=function(_0x983ba4,_0x6babf5){_0x983ba4=_0x983ba4-0x0;var _0x3a91b9=_0xf58a[_0x983ba4];return _0x3a91b9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require('express');var router=express[_0xaf58('0x0')]();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router[_0xaf58('0x1')](_0xaf58('0x2'),auth[_0xaf58('0x3')](),controller[_0xaf58('0x4')]);router[_0xaf58('0x1')](_0xaf58('0x5'),auth['isAuthenticated'](),controller[_0xaf58('0x6')]);router[_0xaf58('0x1')](_0xaf58('0x7'),auth[_0xaf58('0x3')](),controller[_0xaf58('0x8')]);router[_0xaf58('0x1')](_0xaf58('0x9'),auth[_0xaf58('0x3')](),controller[_0xaf58('0xa')]);router[_0xaf58('0x1')]('/chat/queues',auth['isAuthenticated'](),controller[_0xaf58('0xb')]);router[_0xaf58('0x1')](_0xaf58('0xc'),auth[_0xaf58('0x3')](),controller[_0xaf58('0xd')]);router['get'](_0xaf58('0xe'),auth['isAuthenticated'](),controller[_0xaf58('0xf')]);router[_0xaf58('0x1')](_0xaf58('0x10'),auth[_0xaf58('0x3')](),controller[_0xaf58('0x11')]);router['get'](_0xaf58('0x12'),auth[_0xaf58('0x3')](),controller[_0xaf58('0x13')]);router['get'](_0xaf58('0x14'),auth[_0xaf58('0x3')](),controller[_0xaf58('0x15')]);router[_0xaf58('0x1')](_0xaf58('0x16'),auth[_0xaf58('0x3')](),controller[_0xaf58('0x17')]);router[_0xaf58('0x1')](_0xaf58('0x18'),auth['isAuthenticated'](),controller['voiceQueuesPreview']);router[_0xaf58('0x1')](_0xaf58('0x19'),auth[_0xaf58('0x3')](),controller['voiceQueuesChannels']);router[_0xaf58('0x1')](_0xaf58('0x1a'),auth[_0xaf58('0x3')](),controller[_0xaf58('0x1b')]);router[_0xaf58('0x1')](_0xaf58('0x1c'),auth[_0xaf58('0x3')](),controller[_0xaf58('0x1d')]);router[_0xaf58('0x1')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xaf58('0x3')](),controller['voiceQueuesChannelRedirect']);router['get'](_0xaf58('0x1e'),auth[_0xaf58('0x3')](),controller['showVoiceQueues']);router[_0xaf58('0x1f')](_0xaf58('0x1e'),auth[_0xaf58('0x3')](),controller[_0xaf58('0x20')]);router['get'](_0xaf58('0x21'),auth[_0xaf58('0x3')](),controller[_0xaf58('0x22')]);router[_0xaf58('0x1')](_0xaf58('0x23'),auth[_0xaf58('0x3')](),controller[_0xaf58('0x24')]);router[_0xaf58('0x1')](_0xaf58('0x25'),auth['isAuthenticated'](),controller[_0xaf58('0x26')]);router['put']('/agents/:id/capacity',auth['isAuthenticated'](),controller['agentCapacity']);router[_0xaf58('0x1')](_0xaf58('0x27'),auth['isAuthenticated'](),controller['telephones']);router['get'](_0xaf58('0x28'),auth['isAuthenticated'](),controller[_0xaf58('0x29')]);router[_0xaf58('0x1')](_0xaf58('0x2a'),auth['isAuthenticated'](),controller['campaigns']);router[_0xaf58('0x1')](_0xaf58('0x2b'),auth[_0xaf58('0x3')](),controller[_0xaf58('0x2c')]);router[_0xaf58('0x1')](_0xaf58('0x2d'),auth[_0xaf58('0x3')](),controller[_0xaf58('0x2e')]);router[_0xaf58('0x1')](_0xaf58('0x2f'),auth[_0xaf58('0x3')](),controller[_0xaf58('0x30')]);router['get'](_0xaf58('0x31'),auth['isAuthenticated'](),controller[_0xaf58('0x32')]);router[_0xaf58('0x1')](_0xaf58('0x33'),auth[_0xaf58('0x3')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xaf58('0x1')](_0xaf58('0x34'),auth[_0xaf58('0x3')](),controller[_0xaf58('0x35')]);router['get']('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xaf58('0x36')]);router[_0xaf58('0x1')]('/fax/queues/waitinginteractions',auth[_0xaf58('0x3')](),controller[_0xaf58('0x37')]);router[_0xaf58('0x38')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0xaf58('0x39')](_0xaf58('0x3a')));router['get']('/mail/queues/:id',auth[_0xaf58('0x3')](),controller[_0xaf58('0x3b')]);router[_0xaf58('0x38')](_0xaf58('0x3c'),auth[_0xaf58('0x3')](),controller[_0xaf58('0x39')](_0xaf58('0x3d')));router[_0xaf58('0x1')](_0xaf58('0x3e'),auth['isAuthenticated'](),controller['showChatQueues']);router[_0xaf58('0x38')](_0xaf58('0x3f'),auth[_0xaf58('0x3')](),controller[_0xaf58('0x39')](_0xaf58('0x40')));router['get'](_0xaf58('0x41'),auth[_0xaf58('0x3')](),controller[_0xaf58('0x42')]);router[_0xaf58('0x38')](_0xaf58('0x43'),auth[_0xaf58('0x3')](),controller['queueNotify'](_0xaf58('0x44')));router[_0xaf58('0x1')](_0xaf58('0x45'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0xaf58('0x38')](_0xaf58('0x46'),auth[_0xaf58('0x3')](),controller[_0xaf58('0x39')](_0xaf58('0x47')));router['post'](_0xaf58('0x48'),auth[_0xaf58('0x3')](),controller[_0xaf58('0x39')](_0xaf58('0x49')));router['get'](_0xaf58('0x4a'),auth[_0xaf58('0x3')](),controller[_0xaf58('0x4b')]);router['get'](_0xaf58('0x4c'),auth['isAuthenticated'](),controller[_0xaf58('0x4d')]);router[_0xaf58('0x38')](_0xaf58('0x4e'),auth[_0xaf58('0x3')](),controller['agentNotify']);module[_0xaf58('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 b4df54a..8362d98 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 _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(_0x20a9a3,_0x5436b5){var _0x278441=function(_0x3d1eac){while(--_0x3d1eac){_0x20a9a3['push'](_0x20a9a3['shift']());}};_0x278441(++_0x5436b5);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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 +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(_0x365061,_0x238db3){var _0x23dbc2=function(_0x28414c){while(--_0x28414c){_0x365061['push'](_0x365061['shift']());}};_0x23dbc2(++_0x238db3);}(_0xe706,0xa3));var _0x6e70=function(_0x3793bb,_0x39dfdd){_0x3793bb=_0x3793bb-0x0;var _0x380006=_0xe706[_0x3793bb];return _0x380006;};'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 diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 92bc806..99ab050 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 _0x5eea=['destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','/:id/run','run','post','put','update','delete'];(function(_0x4bf61a,_0x3a649b){var _0x27f463=function(_0x62b90){while(--_0x62b90){_0x4bf61a['push'](_0x4bf61a['shift']());}};_0x27f463(++_0x3a649b);}(_0x5eea,0xd3));var _0xa5ee=function(_0x5ba1b9,_0x543aaa){_0x5ba1b9=_0x5ba1b9-0x0;var _0x38334f=_0x5eea[_0x5ba1b9];return _0x38334f;};'use strict';var multer=require(_0xa5ee('0x0'));var util=require(_0xa5ee('0x1'));var path=require(_0xa5ee('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa5ee('0x3'));var auth=require(_0xa5ee('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa5ee('0x5'));var controller=require(_0xa5ee('0x6'));router[_0xa5ee('0x7')]('/',auth[_0xa5ee('0x8')](),controller[_0xa5ee('0x9')]);router[_0xa5ee('0x7')](_0xa5ee('0xa'),auth[_0xa5ee('0x8')](),controller['show']);router[_0xa5ee('0x7')](_0xa5ee('0xb'),auth[_0xa5ee('0x8')](),controller[_0xa5ee('0xc')]);router[_0xa5ee('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa5ee('0xe')](_0xa5ee('0xa'),auth[_0xa5ee('0x8')](),controller[_0xa5ee('0xf')]);router[_0xa5ee('0x10')](_0xa5ee('0xa'),auth[_0xa5ee('0x8')](),controller[_0xa5ee('0x11')]);module[_0xa5ee('0x12')]=router; \ No newline at end of file +var _0xb772=['../../config/environment','get','isAuthenticated','/:id','/:id/run','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x480391,_0x13c3ad){var _0x18a535=function(_0x7e146d){while(--_0x7e146d){_0x480391['push'](_0x480391['shift']());}};_0x18a535(++_0x13c3ad);}(_0xb772,0x1e6));var _0x2b77=function(_0x230738,_0x1e1646){_0x230738=_0x230738-0x0;var _0x324203=_0xb772[_0x230738];return _0x324203;};'use strict';var multer=require(_0x2b77('0x0'));var util=require(_0x2b77('0x1'));var path=require(_0x2b77('0x2'));var timeout=require(_0x2b77('0x3'));var express=require(_0x2b77('0x4'));var router=express[_0x2b77('0x5')]();var fs_extra=require(_0x2b77('0x6'));var auth=require(_0x2b77('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2b77('0x8'));var controller=require('./schedule.controller');router[_0x2b77('0x9')]('/',auth[_0x2b77('0xa')](),controller['index']);router[_0x2b77('0x9')](_0x2b77('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x2b77('0xc'),auth['isAuthenticated'](),controller['run']);router[_0x2b77('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2b77('0xe')](_0x2b77('0xb'),auth[_0x2b77('0xa')](),controller[_0x2b77('0xf')]);router[_0x2b77('0x10')](_0x2b77('0xb'),auth[_0x2b77('0xa')](),controller[_0x2b77('0x11')]);module[_0x2b77('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index fadfcb9..a7c1578 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 _0x36f0=['exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','minutes','csv','pdf','xlsx','custom','TEXT','sequelize'];(function(_0x32411c,_0x3518e4){var _0x13cb80=function(_0x50bb1f){while(--_0x50bb1f){_0x32411c['push'](_0x32411c['shift']());}};_0x13cb80(++_0x3518e4);}(_0x36f0,0xaa));var _0x036f=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0x36f0[_0x5e6ea3];return _0x4048b5;};'use strict';var Sequelize=require(_0x036f('0x0'));module[_0x036f('0x1')]={'name':{'type':Sequelize[_0x036f('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x036f('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x036f('0x2')],'allowNull':![],'defaultValue':_0x036f('0x4')},'startAt':{'type':Sequelize[_0x036f('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x036f('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x036f('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x036f('0x7')](_0x036f('0x8'),_0x036f('0x9'),_0x036f('0xa'),_0x036f('0xb'),_0x036f('0xc'),'hours',_0x036f('0xd')),'allowNull':![],'defaultValue':_0x036f('0xc')},'output':{'type':Sequelize[_0x036f('0x7')](_0x036f('0xe'),_0x036f('0xf'),_0x036f('0x10')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x036f('0x7')]('custom','default'),'allowNull':![],'defaultValue':_0x036f('0x11')},'sendMail':{'type':Sequelize[_0x036f('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x036f('0x12')]},'bcc':{'type':Sequelize[_0x036f('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x036f('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc933=['weeks','days','hours','minutes','csv','pdf','xlsx','custom','default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','months'];(function(_0x7a29b7,_0x2e44fe){var _0x3bdfdf=function(_0x4927a4){while(--_0x4927a4){_0x7a29b7['push'](_0x7a29b7['shift']());}};_0x3bdfdf(++_0x2e44fe);}(_0xc933,0xac));var _0x3c93=function(_0x306a09,_0x4eacf6){_0x306a09=_0x306a09-0x0;var _0x86e2c1=_0xc933[_0x306a09];return _0x86e2c1;};'use strict';var Sequelize=require('sequelize');module[_0x3c93('0x0')]={'name':{'type':Sequelize[_0x3c93('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x3c93('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x3c93('0x1')],'allowNull':![],'defaultValue':_0x3c93('0x3')},'startAt':{'type':Sequelize[_0x3c93('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x3c93('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x3c93('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x3c93('0x6')]('years','quarters',_0x3c93('0x7'),_0x3c93('0x8'),_0x3c93('0x9'),_0x3c93('0xa'),_0x3c93('0xb')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM'](_0x3c93('0xc'),_0x3c93('0xd'),_0x3c93('0xe')),'allowNull':![],'defaultValue':_0x3c93('0xc')},'type':{'type':Sequelize['ENUM'](_0x3c93('0xf'),_0x3c93('0x10')),'allowNull':![],'defaultValue':_0x3c93('0xf')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x3c93('0x1')]},'cc':{'type':Sequelize[_0x3c93('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 861b632..1385100 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 _0x6535=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','Scheduler','UserProfileResource','destroy','sendStatus','error','stack','send','index','Schedule','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','where','merge','map','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','keys','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId'];(function(_0x100e0c,_0x5523b8){var _0x4db1aa=function(_0x29f480){while(--_0x29f480){_0x100e0c['push'](_0x100e0c['shift']());}};_0x4db1aa(++_0x5523b8);}(_0x6535,0xb2));var _0x5653=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x6535[_0x5a776b];return _0xbbef59;};'use strict';var emlformat=require(_0x5653('0x0'));var rimraf=require(_0x5653('0x1'));var zipdir=require(_0x5653('0x2'));var jsonpatch=require(_0x5653('0x3'));var rp=require(_0x5653('0x4'));var moment=require(_0x5653('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5653('0x6'));var path=require(_0x5653('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5653('0x8'));var fs=require('fs');var fs_extra=require(_0x5653('0x9'));var _=require('lodash');var squel=require(_0x5653('0xa'));var crypto=require(_0x5653('0xb'));var jsforce=require(_0x5653('0xc'));var deskjs=require(_0x5653('0xd'));var toCsv=require(_0x5653('0xe'));var querystring=require(_0x5653('0xf'));var Papa=require(_0x5653('0x10'));var Redis=require(_0x5653('0x11'));var authService=require(_0x5653('0x12'));var qs=require(_0x5653('0x13'));var as=require(_0x5653('0x14'));var hardwareService=require(_0x5653('0x15'));var logger=require(_0x5653('0x16'))(_0x5653('0x17'));var utils=require(_0x5653('0x18'));var config=require(_0x5653('0x19'));var licenseUtil=require(_0x5653('0x1a'));var db=require(_0x5653('0x1b'))['db'];function respondWithStatusCode(_0x53bc64,_0x2f3701){_0x2f3701=_0x2f3701||0xcc;return function(_0x3fc17d){if(_0x3fc17d){return _0x53bc64['sendStatus'](_0x2f3701);}return _0x53bc64['status'](_0x2f3701)[_0x5653('0x1c')]();};}function respondWithResult(_0x5b80c7,_0x2c38df){_0x2c38df=_0x2c38df||0xc8;return function(_0x41d85e){if(_0x41d85e){return _0x5b80c7[_0x5653('0x1d')](_0x2c38df)[_0x5653('0x1e')](_0x41d85e);}};}function respondWithFilteredResult(_0x1bd5cb,_0x50a5dd){return function(_0x473d43){if(_0x473d43){var _0x5ab60a=typeof _0x50a5dd[_0x5653('0x1f')]==='undefined'&&typeof _0x50a5dd[_0x5653('0x20')]===_0x5653('0x21');var _0x35b1ef=_0x473d43[_0x5653('0x22')];var _0x1502a3=_0x5ab60a?0x0:_0x50a5dd['offset'];var _0x1ce23d=_0x5ab60a?_0x473d43[_0x5653('0x22')]:_0x50a5dd['offset']+_0x50a5dd[_0x5653('0x20')];var _0x4884a2;if(_0x1ce23d>=_0x35b1ef){_0x1ce23d=_0x35b1ef;_0x4884a2=0xc8;}else{_0x4884a2=0xce;}_0x1bd5cb[_0x5653('0x1d')](_0x4884a2);return _0x1bd5cb[_0x5653('0x23')](_0x5653('0x24'),_0x1502a3+'-'+_0x1ce23d+'/'+_0x35b1ef)[_0x5653('0x1e')](_0x473d43);}return null;};}function patchUpdates(_0x2595ff){return function(_0x152621){try{jsonpatch[_0x5653('0x25')](_0x152621,_0x2595ff,!![]);}catch(_0x4e2fa6){return BPromise[_0x5653('0x26')](_0x4e2fa6);}return _0x152621[_0x5653('0x27')]();};}function saveUpdates(_0x5515c9,_0x5283f0){return function(_0x3cbe21){if(_0x3cbe21){return _0x3cbe21[_0x5653('0x28')](_0x5515c9)['then'](function(_0xd0df15){return _0xd0df15;});}return null;};}function removeEntity(_0xbd1aa3,_0x5f4f8d){return function(_0x2fb761){if(_0x2fb761){return _0x2fb761['destroy']()[_0x5653('0x29')](function(){var _0x4e7e24=_0x2fb761[_0x5653('0x2a')]({'plain':!![]});var _0x39f680=_0x5653('0x2b');return db[_0x5653('0x2c')][_0x5653('0x2d')]({'where':{'type':_0x39f680,'resourceId':_0x4e7e24['id']}})[_0x5653('0x29')](function(){return _0x2fb761;});})[_0x5653('0x29')](function(){_0xbd1aa3[_0x5653('0x1d')](0xcc)[_0x5653('0x1c')]();});}};}function handleEntityNotFound(_0x3022eb,_0x320155){return function(_0xc71130){if(!_0xc71130){_0x3022eb[_0x5653('0x2e')](0x194);}return _0xc71130;};}function handleError(_0x2cd7a4,_0xeb5fbb){_0xeb5fbb=_0xeb5fbb||0x1f4;return function(_0x4169d7){logger[_0x5653('0x2f')](_0x4169d7[_0x5653('0x30')]);if(_0x4169d7['name']){delete _0x4169d7['name'];}_0x2cd7a4[_0x5653('0x1d')](_0xeb5fbb)[_0x5653('0x31')](_0x4169d7);};}exports[_0x5653('0x32')]=function(_0x4d5bcf,_0x520e30){var _0x389641={},_0x27e6c8={},_0x41c9ec={'count':0x0,'rows':[]};var _0x55f645=_['map'](db[_0x5653('0x33')][_0x5653('0x34')],function(_0x258815){return{'name':_0x258815[_0x5653('0x35')],'type':_0x258815[_0x5653('0x36')][_0x5653('0x37')]};});_0x27e6c8[_0x5653('0x38')]=_['map'](_0x55f645,_0x5653('0x39'));_0x27e6c8[_0x5653('0x3a')]=_['keys'](_0x4d5bcf[_0x5653('0x3a')]);_0x27e6c8[_0x5653('0x3b')]=_[_0x5653('0x3c')](_0x27e6c8[_0x5653('0x38')],_0x27e6c8[_0x5653('0x3a')]);_0x389641[_0x5653('0x3d')]=_[_0x5653('0x3c')](_0x27e6c8['model'],qs[_0x5653('0x3e')](_0x4d5bcf[_0x5653('0x3a')][_0x5653('0x3e')]));_0x389641[_0x5653('0x3d')]=_0x389641[_0x5653('0x3d')][_0x5653('0x3f')]?_0x389641[_0x5653('0x3d')]:_0x27e6c8[_0x5653('0x38')];if(!_0x4d5bcf[_0x5653('0x3a')][_0x5653('0x40')](_0x5653('0x41'))){_0x389641[_0x5653('0x20')]=qs[_0x5653('0x20')](_0x4d5bcf[_0x5653('0x3a')][_0x5653('0x20')]);_0x389641[_0x5653('0x1f')]=qs[_0x5653('0x1f')](_0x4d5bcf[_0x5653('0x3a')][_0x5653('0x1f')]);}_0x389641[_0x5653('0x42')]=qs['sort'](_0x4d5bcf[_0x5653('0x3a')]['sort']);_0x389641['where']=qs[_0x5653('0x3b')](_[_0x5653('0x43')](_0x4d5bcf[_0x5653('0x3a')],_0x27e6c8['filters']),_0x55f645);if(_0x4d5bcf[_0x5653('0x3a')]['filter']){_0x389641[_0x5653('0x44')]=_[_0x5653('0x45')](_0x389641[_0x5653('0x44')],{'$or':_[_0x5653('0x46')](_0x55f645,function(_0x35fb31){if(_0x35fb31[_0x5653('0x36')]!==_0x5653('0x47')){var _0x502223={};_0x502223[_0x35fb31[_0x5653('0x39')]]={'$like':'%'+_0x4d5bcf[_0x5653('0x3a')][_0x5653('0x48')]+'%'};return _0x502223;}})});}_0x389641=_[_0x5653('0x45')]({},_0x389641,_0x4d5bcf[_0x5653('0x49')]);var _0x411729={'where':_0x389641[_0x5653('0x44')]};return db[_0x5653('0x33')][_0x5653('0x22')](_0x411729)['then'](function(_0x2bdcad){_0x41c9ec[_0x5653('0x22')]=_0x2bdcad;if(_0x4d5bcf[_0x5653('0x3a')][_0x5653('0x4a')]){_0x389641['include']=[{'all':!![]}];}return db[_0x5653('0x33')][_0x5653('0x4b')](_0x389641);})[_0x5653('0x29')](function(_0x3682e5){_0x41c9ec['rows']=_0x3682e5;return _0x41c9ec;})[_0x5653('0x29')](respondWithFilteredResult(_0x520e30,_0x389641))[_0x5653('0x4c')](handleError(_0x520e30,null));};exports[_0x5653('0x4d')]=function(_0x105af8,_0x2bd209){var _0x48a7ea={'raw':![],'where':{'id':_0x105af8[_0x5653('0x4e')]['id']}},_0x2d8d42={};_0x2d8d42[_0x5653('0x38')]=_[_0x5653('0x4f')](db[_0x5653('0x33')][_0x5653('0x34')]);_0x2d8d42[_0x5653('0x3a')]=_[_0x5653('0x4f')](_0x105af8['query']);_0x2d8d42['filters']=_[_0x5653('0x3c')](_0x2d8d42[_0x5653('0x38')],_0x2d8d42[_0x5653('0x3a')]);_0x48a7ea['attributes']=_[_0x5653('0x3c')](_0x2d8d42[_0x5653('0x38')],qs['fields'](_0x105af8['query'][_0x5653('0x3e')]));_0x48a7ea[_0x5653('0x3d')]=_0x48a7ea[_0x5653('0x3d')][_0x5653('0x3f')]?_0x48a7ea[_0x5653('0x3d')]:_0x2d8d42[_0x5653('0x38')];if(_0x105af8['query'][_0x5653('0x4a')]){_0x48a7ea['include']=[{'all':!![]}];}_0x48a7ea=_[_0x5653('0x45')]({},_0x48a7ea,_0x105af8[_0x5653('0x49')]);return db[_0x5653('0x33')][_0x5653('0x50')](_0x48a7ea)['then'](handleEntityNotFound(_0x2bd209,null))[_0x5653('0x29')](respondWithResult(_0x2bd209,null))[_0x5653('0x4c')](handleError(_0x2bd209,null));};exports['create']=function(_0xcd3d0d,_0x318200){return db[_0x5653('0x33')]['create'](_0xcd3d0d[_0x5653('0x51')],{})['then'](function(_0x13edf9){var _0x33401f=_0xcd3d0d[_0x5653('0x52')][_0x5653('0x2a')]({'plain':!![]});if(!_0x33401f)throw new Error(_0x5653('0x53'));if(_0x33401f[_0x5653('0x54')]==='user'){var _0x5dcaed=_0x13edf9['get']({'plain':!![]});var _0x5cedb2='Scheduler';return db['UserProfileSection']['find']({'where':{'name':_0x5cedb2,'userProfileId':_0x33401f[_0x5653('0x55')]},'raw':!![]})[_0x5653('0x29')](function(_0x30b59f){if(_0x30b59f&&_0x30b59f['autoAssociation']===0x0){return db[_0x5653('0x2c')]['create']({'name':_0x5dcaed[_0x5653('0x39')],'resourceId':_0x5dcaed['id'],'type':_0x30b59f[_0x5653('0x39')],'sectionId':_0x30b59f['id']},{})[_0x5653('0x29')](function(){return _0x13edf9;});}else{return _0x13edf9;}})[_0x5653('0x4c')](function(_0x3c58d1){logger[_0x5653('0x2f')](_0x5653('0x56'),_0x3c58d1);throw _0x3c58d1;});}return _0x13edf9;})[_0x5653('0x29')](respondWithResult(_0x318200,0xc9))['catch'](handleError(_0x318200,null));};exports[_0x5653('0x28')]=function(_0x32ade4,_0x516c81){if(_0x32ade4[_0x5653('0x51')]['id']){delete _0x32ade4[_0x5653('0x51')]['id'];}return db[_0x5653('0x33')][_0x5653('0x50')]({'where':{'id':_0x32ade4[_0x5653('0x4e')]['id']}})[_0x5653('0x29')](handleEntityNotFound(_0x516c81,null))[_0x5653('0x29')](saveUpdates(_0x32ade4['body'],null))[_0x5653('0x29')](respondWithResult(_0x516c81,null))[_0x5653('0x4c')](handleError(_0x516c81,null));};exports[_0x5653('0x2d')]=function(_0x368a7a,_0x1a88f6){return db['Schedule'][_0x5653('0x50')]({'where':{'id':_0x368a7a[_0x5653('0x4e')]['id']}})[_0x5653('0x29')](handleEntityNotFound(_0x1a88f6,null))[_0x5653('0x29')](removeEntity(_0x1a88f6,null))[_0x5653('0x4c')](handleError(_0x1a88f6,null));};exports['run']=function(_0x2d1e84,_0x311f92,_0x16a614){var _0x10eaad=require('../../config/schedule');return db['Schedule'][_0x5653('0x50')]({'where':{'id':_0x2d1e84[_0x5653('0x4e')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x311f92,null))['then'](function(){_0x10eaad[_0x5653('0x57')](_0x2d1e84[_0x5653('0x4e')]['id']);})[_0x5653('0x29')](respondWithStatusCode(_0x311f92,null))[_0x5653('0x4c')](handleError(_0x311f92,null));}; \ No newline at end of file +var _0xd28e=['undefined','count','limit','Content-Range','reject','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','send','index','map','Schedule','rawAttributes','type','model','name','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','params','find','catch','create','body','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x485f35,_0x45a0fc){var _0x2ad118=function(_0x296650){while(--_0x296650){_0x485f35['push'](_0x485f35['shift']());}};_0x2ad118(++_0x45a0fc);}(_0xd28e,0x1c1));var _0xed28=function(_0x12022e,_0x3a5222){_0x12022e=_0x12022e-0x0;var _0x2aeb64=_0xd28e[_0x12022e];return _0x2aeb64;};'use strict';var emlformat=require(_0xed28('0x0'));var rimraf=require(_0xed28('0x1'));var zipdir=require(_0xed28('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed28('0x3'));var moment=require(_0xed28('0x4'));var BPromise=require(_0xed28('0x5'));var Mustache=require(_0xed28('0x6'));var util=require('util');var path=require('path');var sox=require(_0xed28('0x7'));var csv=require('to-csv');var ejs=require(_0xed28('0x8'));var fs=require('fs');var fs_extra=require(_0xed28('0x9'));var _=require(_0xed28('0xa'));var squel=require(_0xed28('0xb'));var crypto=require('crypto');var jsforce=require(_0xed28('0xc'));var deskjs=require(_0xed28('0xd'));var toCsv=require(_0xed28('0xe'));var querystring=require(_0xed28('0xf'));var Papa=require('papaparse');var Redis=require(_0xed28('0x10'));var authService=require(_0xed28('0x11'));var qs=require(_0xed28('0x12'));var as=require(_0xed28('0x13'));var hardwareService=require(_0xed28('0x14'));var logger=require(_0xed28('0x15'))(_0xed28('0x16'));var utils=require('../../config/utils');var config=require(_0xed28('0x17'));var licenseUtil=require(_0xed28('0x18'));var db=require(_0xed28('0x19'))['db'];function respondWithStatusCode(_0x99a27b,_0x3ed744){_0x3ed744=_0x3ed744||0xcc;return function(_0x309795){if(_0x309795){return _0x99a27b[_0xed28('0x1a')](_0x3ed744);}return _0x99a27b[_0xed28('0x1b')](_0x3ed744)[_0xed28('0x1c')]();};}function respondWithResult(_0x250e89,_0x2793a5){_0x2793a5=_0x2793a5||0xc8;return function(_0x3bcf03){if(_0x3bcf03){return _0x250e89[_0xed28('0x1b')](_0x2793a5)[_0xed28('0x1d')](_0x3bcf03);}};}function respondWithFilteredResult(_0xb9ef17,_0x22691b){return function(_0x2898cd){if(_0x2898cd){var _0x2586f2=typeof _0x22691b[_0xed28('0x1e')]===_0xed28('0x1f')&&typeof _0x22691b['limit']===_0xed28('0x1f');var _0x293119=_0x2898cd[_0xed28('0x20')];var _0x1aa577=_0x2586f2?0x0:_0x22691b[_0xed28('0x1e')];var _0x17a951=_0x2586f2?_0x2898cd[_0xed28('0x20')]:_0x22691b['offset']+_0x22691b[_0xed28('0x21')];var _0x2d902b;if(_0x17a951>=_0x293119){_0x17a951=_0x293119;_0x2d902b=0xc8;}else{_0x2d902b=0xce;}_0xb9ef17[_0xed28('0x1b')](_0x2d902b);return _0xb9ef17['set'](_0xed28('0x22'),_0x1aa577+'-'+_0x17a951+'/'+_0x293119)['json'](_0x2898cd);}return null;};}function patchUpdates(_0x5bfd92){return function(_0x3fc3c2){try{jsonpatch['apply'](_0x3fc3c2,_0x5bfd92,!![]);}catch(_0x13b9ce){return BPromise[_0xed28('0x23')](_0x13b9ce);}return _0x3fc3c2['save']();};}function saveUpdates(_0x4969ff,_0xd1f75b){return function(_0x4ff7ba){if(_0x4ff7ba){return _0x4ff7ba[_0xed28('0x24')](_0x4969ff)[_0xed28('0x25')](function(_0xb524){return _0xb524;});}return null;};}function removeEntity(_0x61bc79,_0x30e957){return function(_0x1c42f5){if(_0x1c42f5){return _0x1c42f5[_0xed28('0x26')]()['then'](function(){var _0xa2df0d=_0x1c42f5[_0xed28('0x27')]({'plain':!![]});var _0x43c4f9=_0xed28('0x28');return db[_0xed28('0x29')]['destroy']({'where':{'type':_0x43c4f9,'resourceId':_0xa2df0d['id']}})[_0xed28('0x25')](function(){return _0x1c42f5;});})[_0xed28('0x25')](function(){_0x61bc79[_0xed28('0x1b')](0xcc)[_0xed28('0x1c')]();});}};}function handleEntityNotFound(_0x27facd,_0x86a719){return function(_0x3d5a55){if(!_0x3d5a55){_0x27facd[_0xed28('0x1a')](0x194);}return _0x3d5a55;};}function handleError(_0x58b60d,_0x5f31d9){_0x5f31d9=_0x5f31d9||0x1f4;return function(_0x4011b9){logger[_0xed28('0x2a')](_0x4011b9[_0xed28('0x2b')]);if(_0x4011b9['name']){delete _0x4011b9['name'];}_0x58b60d[_0xed28('0x1b')](_0x5f31d9)[_0xed28('0x2c')](_0x4011b9);};}exports[_0xed28('0x2d')]=function(_0x55409b,_0x289679){var _0x4c7b83={},_0x189f6c={},_0x22a7af={'count':0x0,'rows':[]};var _0x1998bc=_[_0xed28('0x2e')](db[_0xed28('0x2f')][_0xed28('0x30')],function(_0x40c007){return{'name':_0x40c007['fieldName'],'type':_0x40c007[_0xed28('0x31')]['key']};});_0x189f6c[_0xed28('0x32')]=_['map'](_0x1998bc,_0xed28('0x33'));_0x189f6c['query']=_[_0xed28('0x34')](_0x55409b[_0xed28('0x35')]);_0x189f6c[_0xed28('0x36')]=_[_0xed28('0x37')](_0x189f6c[_0xed28('0x32')],_0x189f6c[_0xed28('0x35')]);_0x4c7b83[_0xed28('0x38')]=_[_0xed28('0x37')](_0x189f6c[_0xed28('0x32')],qs[_0xed28('0x39')](_0x55409b[_0xed28('0x35')][_0xed28('0x39')]));_0x4c7b83['attributes']=_0x4c7b83[_0xed28('0x38')][_0xed28('0x3a')]?_0x4c7b83[_0xed28('0x38')]:_0x189f6c['model'];if(!_0x55409b[_0xed28('0x35')]['hasOwnProperty'](_0xed28('0x3b'))){_0x4c7b83['limit']=qs[_0xed28('0x21')](_0x55409b[_0xed28('0x35')]['limit']);_0x4c7b83[_0xed28('0x1e')]=qs['offset'](_0x55409b[_0xed28('0x35')][_0xed28('0x1e')]);}_0x4c7b83[_0xed28('0x3c')]=qs['sort'](_0x55409b[_0xed28('0x35')][_0xed28('0x3d')]);_0x4c7b83['where']=qs[_0xed28('0x36')](_['pick'](_0x55409b['query'],_0x189f6c['filters']),_0x1998bc);if(_0x55409b['query'][_0xed28('0x3e')]){_0x4c7b83[_0xed28('0x3f')]=_['merge'](_0x4c7b83[_0xed28('0x3f')],{'$or':_[_0xed28('0x2e')](_0x1998bc,function(_0x148f24){if(_0x148f24['type']!==_0xed28('0x40')){var _0x26d2bd={};_0x26d2bd[_0x148f24['name']]={'$like':'%'+_0x55409b[_0xed28('0x35')][_0xed28('0x3e')]+'%'};return _0x26d2bd;}})});}_0x4c7b83=_[_0xed28('0x41')]({},_0x4c7b83,_0x55409b[_0xed28('0x42')]);var _0x5a4db1={'where':_0x4c7b83[_0xed28('0x3f')]};return db[_0xed28('0x2f')][_0xed28('0x20')](_0x5a4db1)['then'](function(_0x3eca85){_0x22a7af['count']=_0x3eca85;if(_0x55409b[_0xed28('0x35')][_0xed28('0x43')]){_0x4c7b83[_0xed28('0x44')]=[{'all':!![]}];}return db[_0xed28('0x2f')]['findAll'](_0x4c7b83);})['then'](function(_0x432cec){_0x22a7af['rows']=_0x432cec;return _0x22a7af;})['then'](respondWithFilteredResult(_0x289679,_0x4c7b83))['catch'](handleError(_0x289679,null));};exports['show']=function(_0x5a05f1,_0x2b5e70){var _0x140353={'raw':![],'where':{'id':_0x5a05f1[_0xed28('0x45')]['id']}},_0x1a0c6d={};_0x1a0c6d[_0xed28('0x32')]=_['keys'](db[_0xed28('0x2f')]['rawAttributes']);_0x1a0c6d['query']=_[_0xed28('0x34')](_0x5a05f1[_0xed28('0x35')]);_0x1a0c6d[_0xed28('0x36')]=_[_0xed28('0x37')](_0x1a0c6d['model'],_0x1a0c6d[_0xed28('0x35')]);_0x140353[_0xed28('0x38')]=_[_0xed28('0x37')](_0x1a0c6d[_0xed28('0x32')],qs[_0xed28('0x39')](_0x5a05f1[_0xed28('0x35')][_0xed28('0x39')]));_0x140353[_0xed28('0x38')]=_0x140353['attributes'][_0xed28('0x3a')]?_0x140353[_0xed28('0x38')]:_0x1a0c6d[_0xed28('0x32')];if(_0x5a05f1[_0xed28('0x35')][_0xed28('0x43')]){_0x140353[_0xed28('0x44')]=[{'all':!![]}];}_0x140353=_['merge']({},_0x140353,_0x5a05f1[_0xed28('0x42')]);return db[_0xed28('0x2f')][_0xed28('0x46')](_0x140353)['then'](handleEntityNotFound(_0x2b5e70,null))[_0xed28('0x25')](respondWithResult(_0x2b5e70,null))[_0xed28('0x47')](handleError(_0x2b5e70,null));};exports[_0xed28('0x48')]=function(_0x77b3a8,_0x54ec58){return db[_0xed28('0x2f')][_0xed28('0x48')](_0x77b3a8[_0xed28('0x49')],{})['then'](function(_0x3f27ee){var _0x29b653=_0x77b3a8['user'][_0xed28('0x27')]({'plain':!![]});if(!_0x29b653)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29b653[_0xed28('0x4a')]===_0xed28('0x4b')){var _0xe31a11=_0x3f27ee[_0xed28('0x27')]({'plain':!![]});var _0x4e0bb4=_0xed28('0x28');return db[_0xed28('0x4c')][_0xed28('0x46')]({'where':{'name':_0x4e0bb4,'userProfileId':_0x29b653['userProfileId']},'raw':!![]})['then'](function(_0x4c1c28){if(_0x4c1c28&&_0x4c1c28[_0xed28('0x4d')]===0x0){return db[_0xed28('0x29')]['create']({'name':_0xe31a11[_0xed28('0x33')],'resourceId':_0xe31a11['id'],'type':_0x4c1c28['name'],'sectionId':_0x4c1c28['id']},{})[_0xed28('0x25')](function(){return _0x3f27ee;});}else{return _0x3f27ee;}})[_0xed28('0x47')](function(_0x48168f){logger[_0xed28('0x2a')](_0xed28('0x4e'),_0x48168f);throw _0x48168f;});}return _0x3f27ee;})[_0xed28('0x25')](respondWithResult(_0x54ec58,0xc9))[_0xed28('0x47')](handleError(_0x54ec58,null));};exports['update']=function(_0x2fa581,_0x9d2c4){if(_0x2fa581['body']['id']){delete _0x2fa581[_0xed28('0x49')]['id'];}return db[_0xed28('0x2f')][_0xed28('0x46')]({'where':{'id':_0x2fa581[_0xed28('0x45')]['id']}})[_0xed28('0x25')](handleEntityNotFound(_0x9d2c4,null))['then'](saveUpdates(_0x2fa581[_0xed28('0x49')],null))[_0xed28('0x25')](respondWithResult(_0x9d2c4,null))[_0xed28('0x47')](handleError(_0x9d2c4,null));};exports['destroy']=function(_0x51432b,_0x3d0029){return db[_0xed28('0x2f')][_0xed28('0x46')]({'where':{'id':_0x51432b[_0xed28('0x45')]['id']}})[_0xed28('0x25')](handleEntityNotFound(_0x3d0029,null))[_0xed28('0x25')](removeEntity(_0x3d0029,null))[_0xed28('0x47')](handleError(_0x3d0029,null));};exports[_0xed28('0x4f')]=function(_0x1b95f6,_0x1e94f5,_0x40a5b2){var _0x54bcc2=require('../../config/schedule');return db[_0xed28('0x2f')]['find']({'where':{'id':_0x1b95f6[_0xed28('0x45')]['id']},'raw':!![]})[_0xed28('0x25')](handleEntityNotFound(_0x1e94f5,null))[_0xed28('0x25')](function(){_0x54bcc2['run'](_0x1b95f6[_0xed28('0x45')]['id']);})[_0xed28('0x25')](respondWithStatusCode(_0x1e94f5,null))[_0xed28('0x47')](handleError(_0x1e94f5,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 365317b..5426ed2 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 _0x9fad=['./schedule.attributes','exports','Schedule','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x25a57b,_0x1c468e){var _0x1c25bc=function(_0x355e20){while(--_0x355e20){_0x25a57b['push'](_0x25a57b['shift']());}};_0x1c25bc(++_0x1c468e);}(_0x9fad,0x87));var _0xd9fa=function(_0x35ea58,_0x28e1ea){_0x35ea58=_0x35ea58-0x0;var _0x44cd99=_0x9fad[_0x35ea58];return _0x44cd99;};'use strict';var _=require('lodash');var util=require(_0xd9fa('0x0'));var logger=require(_0xd9fa('0x1'))('api');var moment=require(_0xd9fa('0x2'));var BPromise=require(_0xd9fa('0x3'));var rp=require(_0xd9fa('0x4'));var fs=require('fs');var path=require(_0xd9fa('0x5'));var rimraf=require(_0xd9fa('0x6'));var config=require(_0xd9fa('0x7'));var attributes=require(_0xd9fa('0x8'));module[_0xd9fa('0x9')]=function(_0x19a5b9,_0x19df08){return _0x19a5b9['define'](_0xd9fa('0xa'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5af1=['bluebird','request-promise','path','exports','define','Schedule','tools_schedules','lodash','util','api','moment'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x5af1,0xb7));var _0x15af=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x5af1[_0x34843e];return _0x598f7f;};'use strict';var _=require(_0x15af('0x0'));var util=require(_0x15af('0x1'));var logger=require('../../config/logger')(_0x15af('0x2'));var moment=require(_0x15af('0x3'));var BPromise=require(_0x15af('0x4'));var rp=require(_0x15af('0x5'));var fs=require('fs');var path=require(_0x15af('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0x15af('0x7')]=function(_0x23dbbf,_0x3feef7){return _0x23dbbf[_0x15af('0x8')](_0x15af('0x9'),attributes,{'tableName':_0x15af('0xa'),'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 c3ea531..389186a 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 _0xc6a9=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xc6a9,0x1f0));var _0x9c6a=function(_0x30a457,_0x2aa6b5){_0x30a457=_0x30a457-0x0;var _0x2ae5cd=_0xc6a9[_0x30a457];return _0x2ae5cd;};'use strict';var _=require(_0x9c6a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9c6a('0x1'));var rs=require(_0x9c6a('0x2'));var fs=require('fs');var Redis=require(_0x9c6a('0x3'));var db=require(_0x9c6a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9c6a('0x5'))(_0x9c6a('0x6'));var config=require('../../config/environment');var jayson=require(_0x9c6a('0x7'));var client=jayson['client'][_0x9c6a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14a899,_0x29c5c7,_0x152e7f){return new BPromise(function(_0x14f08a,_0x5a33aa){return client[_0x9c6a('0x9')](_0x14a899,_0x152e7f)['then'](function(_0x4be58a){logger['info'](_0x9c6a('0xa'),_0x29c5c7,_0x9c6a('0xb'));logger['debug'](_0x9c6a('0xc'),_0x29c5c7,_0x9c6a('0xb'),JSON['stringify'](_0x4be58a));if(_0x4be58a['error']){if(_0x4be58a[_0x9c6a('0xd')][_0x9c6a('0xe')]===0x1f4){logger[_0x9c6a('0xd')]('Schedule,\x20%s,\x20%s',_0x29c5c7,_0x4be58a['error']['message']);return _0x5a33aa(_0x4be58a[_0x9c6a('0xd')][_0x9c6a('0xf')]);}logger[_0x9c6a('0xd')](_0x9c6a('0xa'),_0x29c5c7,_0x4be58a[_0x9c6a('0xd')][_0x9c6a('0xf')]);return _0x14f08a(_0x4be58a[_0x9c6a('0xd')][_0x9c6a('0xf')]);}else{logger['info'](_0x9c6a('0xa'),_0x29c5c7,_0x9c6a('0xb'));_0x14f08a(_0x4be58a['result'][_0x9c6a('0xf')]);}})['catch'](function(_0x1c40c1){logger[_0x9c6a('0xd')](_0x9c6a('0xa'),_0x29c5c7,_0x1c40c1);_0x5a33aa(_0x1c40c1);});});} \ No newline at end of file +var _0x7381=['client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7381,0x16c));var _0x1738=function(_0x21a2b3,_0x5d6564){_0x21a2b3=_0x21a2b3-0x0;var _0x4651a7=_0x7381[_0x21a2b3];return _0x4651a7;};'use strict';var _=require(_0x1738('0x0'));var util=require(_0x1738('0x1'));var moment=require(_0x1738('0x2'));var BPromise=require('bluebird');var rs=require(_0x1738('0x3'));var fs=require('fs');var Redis=require(_0x1738('0x4'));var db=require(_0x1738('0x5'))['db'];var utils=require(_0x1738('0x6'));var logger=require(_0x1738('0x7'))(_0x1738('0x8'));var config=require(_0x1738('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1738('0xa')][_0x1738('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x408828,_0x29bdbc,_0x2f850b){return new BPromise(function(_0xa79bab,_0x3f9247){return client[_0x1738('0xc')](_0x408828,_0x2f850b)[_0x1738('0xd')](function(_0x23ee77){logger[_0x1738('0xe')](_0x1738('0xf'),_0x29bdbc,_0x1738('0x10'));logger['debug'](_0x1738('0x11'),_0x29bdbc,_0x1738('0x10'),JSON['stringify'](_0x23ee77));if(_0x23ee77[_0x1738('0x12')]){if(_0x23ee77[_0x1738('0x12')][_0x1738('0x13')]===0x1f4){logger[_0x1738('0x12')](_0x1738('0xf'),_0x29bdbc,_0x23ee77[_0x1738('0x12')]['message']);return _0x3f9247(_0x23ee77[_0x1738('0x12')][_0x1738('0x14')]);}logger[_0x1738('0x12')](_0x1738('0xf'),_0x29bdbc,_0x23ee77[_0x1738('0x12')][_0x1738('0x14')]);return _0xa79bab(_0x23ee77['error']['message']);}else{logger[_0x1738('0xe')](_0x1738('0xf'),_0x29bdbc,'request\x20sent');_0xa79bab(_0x23ee77['result'][_0x1738('0x14')]);}})[_0x1738('0x15')](function(_0x2fae3f){logger['error']('Schedule,\x20%s,\x20%s',_0x29bdbc,_0x2fae3f);_0x3f9247(_0x2fae3f);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 2b9cf9e..f978536 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 _0x27af=['delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','isAuthenticated','index','get','/:id','show','/:id/download','post','put','update'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0x27af,0xec));var _0xf27a=function(_0xb04c42,_0x48b583){_0xb04c42=_0xb04c42-0x0;var _0xdb2896=_0x27af[_0xb04c42];return _0xdb2896;};'use strict';var multer=require(_0xf27a('0x0'));var util=require('util');var path=require(_0xf27a('0x1'));var timeout=require(_0xf27a('0x2'));var express=require('express');var router=express[_0xf27a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf27a('0x4'));var interaction=require(_0xf27a('0x5'));var config=require('../../config/environment');var controller=require(_0xf27a('0x6'));router['get']('/',auth[_0xf27a('0x7')](),controller[_0xf27a('0x8')]);router[_0xf27a('0x9')]('/describe',auth[_0xf27a('0x7')](),controller['describe']);router[_0xf27a('0x9')](_0xf27a('0xa'),auth[_0xf27a('0x7')](),controller[_0xf27a('0xb')]);router[_0xf27a('0x9')](_0xf27a('0xc'),auth[_0xf27a('0x7')](),controller['download']);router[_0xf27a('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf27a('0xe')](_0xf27a('0xa'),auth[_0xf27a('0x7')](),controller[_0xf27a('0xf')]);router[_0xf27a('0x10')]('/:id',auth[_0xf27a('0x7')](),controller['destroy']);module[_0xf27a('0x11')]=router; \ No newline at end of file +var _0xbf54=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','post','create','put','delete','exports','util'];(function(_0x2cdb50,_0x31cff7){var _0x5378df=function(_0x33f762){while(--_0x33f762){_0x2cdb50['push'](_0x2cdb50['shift']());}};_0x5378df(++_0x31cff7);}(_0xbf54,0x1a3));var _0x4bf5=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xbf54[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require('multer');var util=require(_0x4bf5('0x0'));var path=require(_0x4bf5('0x1'));var timeout=require('connect-timeout');var express=require(_0x4bf5('0x2'));var router=express[_0x4bf5('0x3')]();var fs_extra=require(_0x4bf5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4bf5('0x5'));var config=require(_0x4bf5('0x6'));var controller=require(_0x4bf5('0x7'));router[_0x4bf5('0x8')]('/',auth[_0x4bf5('0x9')](),controller[_0x4bf5('0xa')]);router['get'](_0x4bf5('0xb'),auth['isAuthenticated'](),controller[_0x4bf5('0xc')]);router['get'](_0x4bf5('0xd'),auth[_0x4bf5('0x9')](),controller['show']);router[_0x4bf5('0x8')](_0x4bf5('0xe'),auth[_0x4bf5('0x9')](),controller['download']);router[_0x4bf5('0xf')]('/',auth[_0x4bf5('0x9')](),controller[_0x4bf5('0x10')]);router[_0x4bf5('0x11')](_0x4bf5('0xd'),auth[_0x4bf5('0x9')](),controller['update']);router[_0x4bf5('0x12')](_0x4bf5('0xd'),auth[_0x4bf5('0x9')](),controller['destroy']);module[_0x4bf5('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index f935496..46d9e55 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 _0x084b=['format','createdAt','MM-DD-YYYY\x20HH:mm','updatedAt','sequelize','exports','VIRTUAL','value','extname','getDataValue','STRING','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','DATE','toString'];(function(_0x5d716d,_0x5102c2){var _0x223c29=function(_0x1f0974){while(--_0x1f0974){_0x5d716d['push'](_0x5d716d['shift']());}};_0x223c29(++_0x5102c2);}(_0x084b,0xd5));var _0xb084=function(_0x45f646,_0x27d415){_0x45f646=_0x45f646-0x0;var _0x1d0d8a=_0x084b[_0x45f646];return _0x1d0d8a;};'use strict';var Sequelize=require(_0xb084('0x0'));var moment=require('moment');var path=require('path');var config=require('../../config/environment');module[_0xb084('0x1')]={'format':{'type':Sequelize[_0xb084('0x2')],'get':function(){return this['getDataValue'](_0xb084('0x3'))?path[_0xb084('0x4')](this[_0xb084('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xb084('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xb084('0x6')],'set':function(_0x449c7a){var _0x275c8c=_0x449c7a['replace'](/\\/g,'/');this['setDataValue'](_0xb084('0x3'),_0x275c8c);}},'rating':{'type':Sequelize[_0xb084('0x7')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xb084('0x7')],'set':function(_0xec1e0d){this[_0xb084('0x8')](_0xb084('0x9'),moment()[_0xb084('0xa')](_0xec1e0d,'ms'));this[_0xb084('0x8')](_0xb084('0xb'),moment());this[_0xb084('0x8')](_0xb084('0xc'),_0xec1e0d);}},'startedAt':{'type':Sequelize[_0xb084('0xd')],'get':function(){return moment(this[_0xb084('0x5')](_0xb084('0x9')))['format']('MM-DD-YYYY\x20HH:mm')[_0xb084('0xe')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xb084('0xb')))[_0xb084('0xf')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0xb084('0xd')],'get':function(){return moment(this[_0xb084('0x5')](_0xb084('0x10')))[_0xb084('0xf')](_0xb084('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0xb084('0xd')],'get':function(){return moment(this[_0xb084('0x5')](_0xb084('0x12')))[_0xb084('0xf')](_0xb084('0x11'))[_0xb084('0xe')]();}}}; \ No newline at end of file +var _0xbe9d=['extname','STRING','replace','INTEGER','startedAt','subtract','setDataValue','closedAt','duration','DATE','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','format','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value'];(function(_0x44a65a,_0x41b290){var _0x301006=function(_0x2aaf42){while(--_0x2aaf42){_0x44a65a['push'](_0x44a65a['shift']());}};_0x301006(++_0x41b290);}(_0xbe9d,0x99));var _0xdbe9=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xbe9d[_0xc4001c];return _0x49f7bc;};'use strict';var Sequelize=require(_0xdbe9('0x0'));var moment=require(_0xdbe9('0x1'));var path=require(_0xdbe9('0x2'));var config=require(_0xdbe9('0x3'));module[_0xdbe9('0x4')]={'format':{'type':Sequelize[_0xdbe9('0x5')],'get':function(){return this[_0xdbe9('0x6')](_0xdbe9('0x7'))?path[_0xdbe9('0x8')](this[_0xdbe9('0x6')](_0xdbe9('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0xdbe9('0x9')]},'channel':{'type':Sequelize[_0xdbe9('0x9')]},'value':{'type':Sequelize['STRING'],'set':function(_0x56e9be){var _0x3d5165=_0x56e9be[_0xdbe9('0xa')](/\\/g,'/');this['setDataValue'](_0xdbe9('0x7'),_0x3d5165);}},'rating':{'type':Sequelize[_0xdbe9('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xdbe9('0xb')],'set':function(_0x56470c){this['setDataValue'](_0xdbe9('0xc'),moment()[_0xdbe9('0xd')](_0x56470c,'ms'));this[_0xdbe9('0xe')](_0xdbe9('0xf'),moment());this['setDataValue'](_0xdbe9('0x10'),_0x56470c);}},'startedAt':{'type':Sequelize[_0xdbe9('0x11')],'get':function(){return moment(this[_0xdbe9('0x6')](_0xdbe9('0xc')))['format'](_0xdbe9('0x12'))['toString']();}},'closedAt':{'type':Sequelize[_0xdbe9('0x11')],'get':function(){return moment(this[_0xdbe9('0x6')](_0xdbe9('0xf')))['format'](_0xdbe9('0x12'))[_0xdbe9('0x13')]();}},'createdAt':{'type':Sequelize[_0xdbe9('0x11')],'get':function(){return moment(this['getDataValue'](_0xdbe9('0x14')))['format'](_0xdbe9('0x12'))[_0xdbe9('0x13')]();}},'updatedAt':{'type':Sequelize[_0xdbe9('0x11')],'get':function(){return moment(this['getDataValue'](_0xdbe9('0x15')))[_0xdbe9('0x16')](_0xdbe9('0x12'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 1c10efe..a5c9d68 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 _0x3e74=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','show','params','catch','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','find','value','join','root','decryptFile','secrets','server/files/screen_recordings','Sequelize','ValidationError','filename','unlink','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','existsSync','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox'];(function(_0x194499,_0x27658a){var _0x298ffa=function(_0x2ac2a4){while(--_0x2ac2a4){_0x194499['push'](_0x194499['shift']());}};_0x298ffa(++_0x27658a);}(_0x3e74,0x175));var _0x43e7=function(_0x3161b5,_0x50a1f4){_0x3161b5=_0x3161b5-0x0;var _0x223ad5=_0x3e74[_0x3161b5];return _0x223ad5;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](_[_0x43e7('0x27')](_0x50f9f5,'name'),[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0xb1fc63[_0x43e7('0x30')]);_0x4690a6[_0x43e7('0x32')]=_['intersection'](_0x4690a6[_0x43e7('0x2d')],_0x4690a6[_0x43e7('0x30')]);_0x33a1a5[_0x43e7('0x33')]=_[_0x43e7('0x34')](_0x4690a6['model'],qs['fields'](_0xb1fc63['query'][_0x43e7('0x35')]));_0x33a1a5[_0x43e7('0x33')]=_0x33a1a5[_0x43e7('0x33')][_0x43e7('0x36')]?_0x33a1a5[_0x43e7('0x33')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63['query']['hasOwnProperty']('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5[_0x43e7('0x19')]=qs['offset'](_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x19')]);}_0x33a1a5[_0x43e7('0x37')]=qs[_0x43e7('0x38')](_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x38')]);_0x33a1a5[_0x43e7('0x39')]=qs['filters'](_['pick'](_0xb1fc63['query'],_0x4690a6[_0x43e7('0x32')]),_0x50f9f5);if(_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x39')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x39')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x2ffd43){if(_0x2ffd43['type']!==_0x43e7('0x3c')){var _0x2b0ffe={};_0x2b0ffe[_0x2ffd43['name']]={'$like':'%'+_0xb1fc63[_0x43e7('0x30')]['filter']+'%'};return _0x2b0ffe;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63[_0x43e7('0x3d')]);var _0x1c6f45={'where':_0x33a1a5[_0x43e7('0x39')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x1c6f45)['then'](function(_0x574a93){_0x45b675[_0x43e7('0x1a')]=_0x574a93;if(_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x3e')]){_0x33a1a5[_0x43e7('0x3f')]=[{'all':!![]}];}return db[_0x43e7('0x28')]['findAll'](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4227c4){_0x45b675['rows']=_0x4227c4;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x40')]=function(_0x504101,_0x3d81ae){var _0x3b4235={'raw':![],'where':{'id':_0x504101[_0x43e7('0x41')]['id']}},_0x3a5807={};_0x3a5807['model']=_['keys'](db[_0x43e7('0x28')][_0x43e7('0x29')]);_0x3a5807[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x504101['query']);_0x3a5807['filters']=_['intersection'](_0x3a5807[_0x43e7('0x2d')],_0x3a5807['query']);_0x3b4235[_0x43e7('0x33')]=_['intersection'](_0x3a5807['model'],qs[_0x43e7('0x35')](_0x504101['query'][_0x43e7('0x35')]));_0x3b4235[_0x43e7('0x33')]=_0x3b4235[_0x43e7('0x33')][_0x43e7('0x36')]?_0x3b4235['attributes']:_0x3a5807[_0x43e7('0x2d')];if(_0x504101[_0x43e7('0x30')][_0x43e7('0x3e')]){_0x3b4235[_0x43e7('0x3f')]=[{'all':!![]}];}_0x3b4235=_[_0x43e7('0x3b')]({},_0x3b4235,_0x504101[_0x43e7('0x3d')]);return db['ScreenRecording']['find'](_0x3b4235)[_0x43e7('0x21')](handleEntityNotFound(_0x3d81ae,null))[_0x43e7('0x21')](respondWithResult(_0x3d81ae,null))[_0x43e7('0x42')](handleError(_0x3d81ae,null));};exports['create']=function(_0x5c1c18,_0x56489b){return db[_0x43e7('0x28')][_0x43e7('0x43')](_0x5c1c18['body'],{})[_0x43e7('0x21')](respondWithResult(_0x56489b,0xc9))[_0x43e7('0x42')](handleError(_0x56489b,null));};exports[_0x43e7('0x20')]=function(_0x560329,_0x593155){if(_0x560329['body']['id']){delete _0x560329['body']['id'];}delete _0x560329[_0x43e7('0x44')][_0x43e7('0x45')];delete _0x560329['body'][_0x43e7('0x46')];delete _0x560329[_0x43e7('0x44')][_0x43e7('0x47')];delete _0x560329[_0x43e7('0x44')]['value'];return db[_0x43e7('0x28')]['find']({'where':{'id':_0x560329['params']['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x593155,null))[_0x43e7('0x21')](saveUpdates(_0x560329[_0x43e7('0x44')],null))[_0x43e7('0x21')](respondWithResult(_0x593155,null))[_0x43e7('0x42')](handleError(_0x593155,null));};exports[_0x43e7('0x48')]=function(_0x1cd87c,_0x256ddd){return db[_0x43e7('0x28')][_0x43e7('0x48')]()['then'](respondWithResult(_0x256ddd,null))[_0x43e7('0x42')](handleError(_0x256ddd,null));};exports[_0x43e7('0x49')]=function(_0x499c03,_0x39e3ca,_0x4e6f6d){var _0x35b799=require(_0x43e7('0x4a'));var _0x34e2ec=![];var _0x1f561f={};if(_0x499c03[_0x43e7('0x30')]['type']&&_0x499c03['query'][_0x43e7('0x2b')]===_0x43e7('0x4b')){_0x1f561f[_0x43e7('0x4b')]=_0x499c03[_0x43e7('0x41')]['id'];}else{_0x1f561f['id']=_0x499c03[_0x43e7('0x41')]['id'];}return db[_0x43e7('0x28')][_0x43e7('0x4c')]({'where':_0x1f561f,'attributes':['id',_0x43e7('0x4d')],'raw':!![]})[_0x43e7('0x21')](handleEntityNotFound(_0x39e3ca,null))[_0x43e7('0x21')](function(_0x312306){if(_0x312306){var _0x4ace49=path[_0x43e7('0x4e')](config[_0x43e7('0x4f')],'server/files/screen_recordings',_0x312306[_0x43e7('0x4d')]);var _0x220bf2=util[_0x43e7('0x2f')]('%s.cypher',_0x4ace49);if(fs['existsSync'](_0x220bf2)){_0x34e2ec=!![];return _0x35b799[_0x43e7('0x50')](_0x220bf2,_0x4ace49,config[_0x43e7('0x51')]['recording'])[_0x43e7('0x21')](function(){return _0x312306;});}return _0x312306;}})['then'](function(_0x49a6ce){if(_0x49a6ce){var _0x1fa3f6=path[_0x43e7('0x4e')](config[_0x43e7('0x4f')],_0x43e7('0x52'),_0x49a6ce[_0x43e7('0x4d')]);if(!fs['existsSync'](_0x1fa3f6)){throw new db[(_0x43e7('0x53'))][(_0x43e7('0x54'))]('ScreenRecording\x20not\x20found');}if(_0x49a6ce[_0x43e7('0x55')]){return _0x39e3ca[_0x43e7('0x49')](_0x1fa3f6,_0x49a6ce[_0x43e7('0x55')]+path['extname'](_0x1fa3f6),function(){if(_0x34e2ec){fs['unlink'](_0x1fa3f6);}});}else{return _0x39e3ca['download'](_0x1fa3f6,function(_0x2ada55){if(_0x34e2ec){fs[_0x43e7('0x56')](_0x1fa3f6);}});}}})[_0x43e7('0x42')](function(_0x3a6404){if(_0x3a6404['message']==='ScreenRecording\x20not\x20found'){_0x39e3ca[_0x43e7('0x1b')](0x194)[_0x43e7('0x25')](_0x43e7('0x57'));}else{return handleError(_0x39e3ca,null);}});};exports[_0x43e7('0x22')]=function(_0x5ea0db,_0x4438c0){return db[_0x43e7('0x28')][_0x43e7('0x4c')]({'where':{'id':_0x5ea0db[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](function(_0xd41e79){if(_[_0x43e7('0x58')](_0xd41e79)){throw new ReferenceError(_0x43e7('0x59'));}return _0xd41e79;})[_0x43e7('0x21')](function(_0x381208){var _0x252f00=path['join'](config['root'],_0x43e7('0x52'),_0x381208['value']);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x252f00);if(!_[_0x43e7('0x58')](_0x381208[_0x43e7('0x4d')])&&fs['existsSync'](_0x252f00)){logger[_0x43e7('0x5a')](_0x43e7('0x5b')+_0x252f00+_0x43e7('0x5c'));fs['unlinkSync'](_0x252f00);}_0x252f00=_0x252f00+_0x43e7('0x5d');if(!_[_0x43e7('0x58')](_0x381208[_0x43e7('0x4d')])&&fs[_0x43e7('0x5e')](_0x252f00)){logger[_0x43e7('0x5a')](_0x43e7('0x5b')+_0x252f00+_0x43e7('0x5c'));fs['unlinkSync'](_0x252f00);}return _0x381208;})[_0x43e7('0x21')](function(_0x40d0c0){if(!_0x40d0c0)throw new InternalError();return _0x40d0c0[_0x43e7('0x22')]();})['then'](function(){_0x4438c0['status'](0xcc)[_0x43e7('0x15')]();})['catch'](handleError(_0x4438c0,null));}; \ No newline at end of file +var _0x1cb9=['ValidationError','filename','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','findAll','rows','catch','show','keys','length','include','options','find','create','body','duration','createdAt','value','params','describe','download','../../components/encryptor','uniqueid','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','root','Sequelize'];(function(_0x4091ce,_0x509783){var _0x2d299f=function(_0x263be2){while(--_0x263be2){_0x4091ce['push'](_0x4091ce['shift']());}};_0x2d299f(++_0x509783);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2db242,_0x5eeb92){_0x2db242=_0x2db242-0x0;var _0x9e8731=_0x1cb9[_0x2db242];return _0x9e8731;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x423c4f,_0x264e9b){return function(_0x4c8438){if(!_0x4c8438){_0x423c4f['sendStatus'](0x194);}return _0x4c8438;};}function handleError(_0x234eb1,_0x554350){_0x554350=_0x554350||0x1f4;return function(_0x1c67d2){logger[_0x91cb('0x27')](_0x1c67d2[_0x91cb('0x28')]);if(_0x1c67d2['name']){delete _0x1c67d2[_0x91cb('0x29')];}_0x234eb1['status'](_0x554350)[_0x91cb('0x2a')](_0x1c67d2);};}exports[_0x91cb('0x2b')]=function(_0x3b3ee6,_0x2fb473){var _0x468908={},_0x504275={},_0x2f04a3={'count':0x0,'rows':[]};var _0x52670a=_[_0x91cb('0x2c')](db[_0x91cb('0x2d')][_0x91cb('0x2e')],function(_0x4944bd){return{'name':_0x4944bd[_0x91cb('0x2f')],'type':_0x4944bd[_0x91cb('0x30')][_0x91cb('0x31')]};});_0x504275[_0x91cb('0x32')]=_[_0x91cb('0x33')](_[_0x91cb('0x2c')](_0x52670a,_0x91cb('0x29')),[_0x91cb('0x34')]);_0x504275[_0x91cb('0x35')]=_['keys'](_0x3b3ee6[_0x91cb('0x35')]);_0x504275[_0x91cb('0x36')]=_[_0x91cb('0x37')](_0x504275[_0x91cb('0x32')],_0x504275[_0x91cb('0x35')]);_0x468908['attributes']=_[_0x91cb('0x37')](_0x504275[_0x91cb('0x32')],qs[_0x91cb('0x38')](_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x38')]));_0x468908['attributes']=_0x468908[_0x91cb('0x39')]['length']?_0x468908['attributes']:_0x504275['model'];if(!_0x3b3ee6[_0x91cb('0x35')]['hasOwnProperty'](_0x91cb('0x3a'))){_0x468908['limit']=qs['limit'](_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x1d')]);_0x468908[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x3b3ee6[_0x91cb('0x35')]['offset']);}_0x468908[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x3c')]);_0x468908['where']=qs['filters'](_[_0x91cb('0x3d')](_0x3b3ee6[_0x91cb('0x35')],_0x504275['filters']),_0x52670a);if(_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x3e')]){_0x468908['where']=_[_0x91cb('0x3f')](_0x468908[_0x91cb('0x40')],{'$or':_['map'](_0x52670a,function(_0x43d4fe){if(_0x43d4fe['type']!==_0x91cb('0x41')){var _0xabe6a3={};_0xabe6a3[_0x43d4fe[_0x91cb('0x29')]]={'$like':'%'+_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x3e')]+'%'};return _0xabe6a3;}})});}_0x468908=_[_0x91cb('0x3f')]({},_0x468908,_0x3b3ee6['options']);var _0xa90111={'where':_0x468908[_0x91cb('0x40')]};return db['ScreenRecording'][_0x91cb('0x1e')](_0xa90111)['then'](function(_0x2c6102){_0x2f04a3[_0x91cb('0x1e')]=_0x2c6102;if(_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x42')]){_0x468908['include']=[{'all':!![]}];}return db[_0x91cb('0x2d')][_0x91cb('0x43')](_0x468908);})[_0x91cb('0x25')](function(_0x37e777){_0x2f04a3[_0x91cb('0x44')]=_0x37e777;return _0x2f04a3;})[_0x91cb('0x25')](respondWithFilteredResult(_0x2fb473,_0x468908))[_0x91cb('0x45')](handleError(_0x2fb473,null));};exports[_0x91cb('0x46')]=function(_0x325dca,_0x3cc4c1){var _0x49bc42={'raw':![],'where':{'id':_0x325dca['params']['id']}},_0x16993f={};_0x16993f[_0x91cb('0x32')]=_['keys'](db[_0x91cb('0x2d')]['rawAttributes']);_0x16993f[_0x91cb('0x35')]=_[_0x91cb('0x47')](_0x325dca[_0x91cb('0x35')]);_0x16993f[_0x91cb('0x36')]=_['intersection'](_0x16993f[_0x91cb('0x32')],_0x16993f[_0x91cb('0x35')]);_0x49bc42['attributes']=_[_0x91cb('0x37')](_0x16993f[_0x91cb('0x32')],qs[_0x91cb('0x38')](_0x325dca[_0x91cb('0x35')][_0x91cb('0x38')]));_0x49bc42[_0x91cb('0x39')]=_0x49bc42[_0x91cb('0x39')][_0x91cb('0x48')]?_0x49bc42[_0x91cb('0x39')]:_0x16993f['model'];if(_0x325dca[_0x91cb('0x35')][_0x91cb('0x42')]){_0x49bc42[_0x91cb('0x49')]=[{'all':!![]}];}_0x49bc42=_[_0x91cb('0x3f')]({},_0x49bc42,_0x325dca[_0x91cb('0x4a')]);return db[_0x91cb('0x2d')][_0x91cb('0x4b')](_0x49bc42)[_0x91cb('0x25')](handleEntityNotFound(_0x3cc4c1,null))['then'](respondWithResult(_0x3cc4c1,null))[_0x91cb('0x45')](handleError(_0x3cc4c1,null));};exports[_0x91cb('0x4c')]=function(_0x2b8b7f,_0x3b8cfd){return db['ScreenRecording'][_0x91cb('0x4c')](_0x2b8b7f[_0x91cb('0x4d')],{})['then'](respondWithResult(_0x3b8cfd,0xc9))[_0x91cb('0x45')](handleError(_0x3b8cfd,null));};exports['update']=function(_0x2c419b,_0x4c0acd){if(_0x2c419b['body']['id']){delete _0x2c419b['body']['id'];}delete _0x2c419b[_0x91cb('0x4d')][_0x91cb('0x4e')];delete _0x2c419b[_0x91cb('0x4d')][_0x91cb('0x4f')];delete _0x2c419b[_0x91cb('0x4d')]['closedAt'];delete _0x2c419b['body'][_0x91cb('0x50')];return db[_0x91cb('0x2d')][_0x91cb('0x4b')]({'where':{'id':_0x2c419b[_0x91cb('0x51')]['id']}})['then'](handleEntityNotFound(_0x4c0acd,null))['then'](saveUpdates(_0x2c419b['body'],null))[_0x91cb('0x25')](respondWithResult(_0x4c0acd,null))['catch'](handleError(_0x4c0acd,null));};exports[_0x91cb('0x52')]=function(_0x4aa670,_0x21463a){return db[_0x91cb('0x2d')][_0x91cb('0x52')]()[_0x91cb('0x25')](respondWithResult(_0x21463a,null))[_0x91cb('0x45')](handleError(_0x21463a,null));};exports[_0x91cb('0x53')]=function(_0x3ec250,_0x30fd4e,_0xff7c3f){var _0x20fc0a=require(_0x91cb('0x54'));var _0x5752ed=![];var _0x1e445a={};if(_0x3ec250[_0x91cb('0x35')]['type']&&_0x3ec250[_0x91cb('0x35')][_0x91cb('0x30')]==='uniqueid'){_0x1e445a[_0x91cb('0x55')]=_0x3ec250[_0x91cb('0x51')]['id'];}else{_0x1e445a['id']=_0x3ec250[_0x91cb('0x51')]['id'];}return db[_0x91cb('0x2d')][_0x91cb('0x4b')]({'where':_0x1e445a,'attributes':['id',_0x91cb('0x50')],'raw':!![]})[_0x91cb('0x25')](handleEntityNotFound(_0x30fd4e,null))[_0x91cb('0x25')](function(_0x3320bd){if(_0x3320bd){var _0x93ef52=path[_0x91cb('0x56')](config['root'],_0x91cb('0x57'),_0x3320bd['value']);var _0x37221e=util['format'](_0x91cb('0x58'),_0x93ef52);if(fs[_0x91cb('0x59')](_0x37221e)){_0x5752ed=!![];return _0x20fc0a[_0x91cb('0x5a')](_0x37221e,_0x93ef52,config['secrets'][_0x91cb('0x5b')])[_0x91cb('0x25')](function(){return _0x3320bd;});}return _0x3320bd;}})['then'](function(_0xef4754){if(_0xef4754){var _0x102025=path[_0x91cb('0x56')](config[_0x91cb('0x5c')],'server/files/screen_recordings',_0xef4754[_0x91cb('0x50')]);if(!fs[_0x91cb('0x59')](_0x102025)){throw new db[(_0x91cb('0x5d'))][(_0x91cb('0x5e'))]('ScreenRecording\x20not\x20found');}if(_0xef4754[_0x91cb('0x5f')]){return _0x30fd4e[_0x91cb('0x53')](_0x102025,_0xef4754['filename']+path['extname'](_0x102025),function(){if(_0x5752ed){fs[_0x91cb('0x60')](_0x102025);}});}else{return _0x30fd4e['download'](_0x102025,function(_0x1180ac){if(_0x5752ed){fs[_0x91cb('0x60')](_0x102025);}});}}})['catch'](function(_0x4f19c8){if(_0x4f19c8[_0x91cb('0x61')]==='ScreenRecording\x20not\x20found'){_0x30fd4e[_0x91cb('0x1a')](0x194)[_0x91cb('0x2a')](_0x91cb('0x62'));}else{return handleError(_0x30fd4e,null);}});};exports['destroy']=function(_0x22fea8,_0x524400){return db[_0x91cb('0x2d')][_0x91cb('0x4b')]({'where':{'id':_0x22fea8[_0x91cb('0x51')]['id']}})[_0x91cb('0x25')](function(_0x483172){if(_[_0x91cb('0x63')](_0x483172)){throw new ReferenceError(_0x91cb('0x64'));}return _0x483172;})[_0x91cb('0x25')](function(_0x443c72){var _0xaf70c5=path[_0x91cb('0x56')](config[_0x91cb('0x5c')],_0x91cb('0x57'),_0x443c72[_0x91cb('0x50')]);logger[_0x91cb('0x65')](_0x91cb('0x66'),_0xaf70c5);if(!_[_0x91cb('0x63')](_0x443c72['value'])&&fs[_0x91cb('0x59')](_0xaf70c5)){logger[_0x91cb('0x65')](_0x91cb('0x67')+_0xaf70c5+_0x91cb('0x68'));fs[_0x91cb('0x69')](_0xaf70c5);}_0xaf70c5=_0xaf70c5+_0x91cb('0x6a');if(!_[_0x91cb('0x63')](_0x443c72['value'])&&fs[_0x91cb('0x59')](_0xaf70c5)){logger['info'](_0x91cb('0x67')+_0xaf70c5+_0x91cb('0x68'));fs[_0x91cb('0x69')](_0xaf70c5);}return _0x443c72;})[_0x91cb('0x25')](function(_0x48fcfe){if(!_0x48fcfe)throw new InternalError();return _0x48fcfe[_0x91cb('0x26')]();})[_0x91cb('0x25')](function(){_0x524400[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();})[_0x91cb('0x45')](handleError(_0x524400,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 278d847..c4a092a 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 _0x8b4a=['bluebird','request-promise','path','rimraf','exports','ScreenRecording','interactionid','lodash','util','../../config/logger','api','moment'];(function(_0xffe100,_0x19a361){var _0x1ce383=function(_0x4c9513){while(--_0x4c9513){_0xffe100['push'](_0xffe100['shift']());}};_0x1ce383(++_0x19a361);}(_0x8b4a,0x1e7));var _0xa8b4=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x8b4a[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xa8b4('0x0'));var util=require(_0xa8b4('0x1'));var logger=require(_0xa8b4('0x2'))(_0xa8b4('0x3'));var moment=require(_0xa8b4('0x4'));var BPromise=require(_0xa8b4('0x5'));var rp=require(_0xa8b4('0x6'));var fs=require('fs');var path=require(_0xa8b4('0x7'));var rimraf=require(_0xa8b4('0x8'));var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module[_0xa8b4('0x9')]=function(_0x2358c2,_0x419d70){return _0x2358c2['define'](_0xa8b4('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xa8b4('0xb'),'fields':[_0xa8b4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x517e=['exports','define','ScreenRecording','screen_recordings','interactionid','util','../../config/logger','api','moment','request-promise','rimraf','./screenRecording.attributes'];(function(_0x83ab9e,_0x3d6043){var _0x459e0a=function(_0x5a5653){while(--_0x5a5653){_0x83ab9e['push'](_0x83ab9e['shift']());}};_0x459e0a(++_0x3d6043);}(_0x517e,0xd1));var _0xe517=function(_0x24c537,_0x20d0a2){_0x24c537=_0x24c537-0x0;var _0x3908a=_0x517e[_0x24c537];return _0x3908a;};'use strict';var _=require('lodash');var util=require(_0xe517('0x0'));var logger=require(_0xe517('0x1'))(_0xe517('0x2'));var moment=require(_0xe517('0x3'));var BPromise=require('bluebird');var rp=require(_0xe517('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe517('0x5'));var config=require('../../config/environment');var attributes=require(_0xe517('0x6'));module[_0xe517('0x7')]=function(_0x4a7044,_0x44168d){return _0x4a7044[_0xe517('0x8')](_0xe517('0x9'),attributes,{'tableName':_0xe517('0xa'),'paranoid':![],'indexes':[{'name':_0xe517('0xb'),'fields':[_0xe517('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 9d4b1f0..9b2d60e 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 _0x4758=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x1aa055,_0x296de2){var _0x181893=function(_0xd6d2c1){while(--_0xd6d2c1){_0x1aa055['push'](_0x1aa055['shift']());}};_0x181893(++_0x296de2);}(_0x4758,0x1ba));var _0x8475=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4758[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8475('0x0'));var util=require(_0x8475('0x1'));var moment=require(_0x8475('0x2'));var BPromise=require('bluebird');var rs=require(_0x8475('0x3'));var fs=require('fs');var Redis=require(_0x8475('0x4'));var db=require(_0x8475('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8475('0x6'))(_0x8475('0x7'));var config=require(_0x8475('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8475('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x579b5e,_0x3235b7,_0x2aedcb){return new BPromise(function(_0x5125ab,_0x1d6629){return client[_0x8475('0xa')](_0x579b5e,_0x2aedcb)['then'](function(_0x52ba01){logger[_0x8475('0xb')](_0x8475('0xc'),_0x3235b7,_0x8475('0xd'));logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x3235b7,'request\x20sent',JSON[_0x8475('0xe')](_0x52ba01));if(_0x52ba01[_0x8475('0xf')]){if(_0x52ba01[_0x8475('0xf')]['code']===0x1f4){logger[_0x8475('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x3235b7,_0x52ba01[_0x8475('0xf')]['message']);return _0x1d6629(_0x52ba01['error'][_0x8475('0x10')]);}logger['error'](_0x8475('0xc'),_0x3235b7,_0x52ba01[_0x8475('0xf')][_0x8475('0x10')]);return _0x5125ab(_0x52ba01[_0x8475('0xf')]['message']);}else{logger['info'](_0x8475('0xc'),_0x3235b7,_0x8475('0xd'));_0x5125ab(_0x52ba01['result'][_0x8475('0x10')]);}})['catch'](function(_0x44bb24){logger[_0x8475('0xf')](_0x8475('0xc'),_0x3235b7,_0x44bb24);_0x1d6629(_0x44bb24);});});} \ No newline at end of file +var _0x55e0=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x44ef5f,_0x56c683){var _0x23db5c=function(_0x5f427d){while(--_0x5f427d){_0x44ef5f['push'](_0x44ef5f['shift']());}};_0x23db5c(++_0x56c683);}(_0x55e0,0x1f3));var _0x055e=function(_0x146481,_0x5664b3){_0x146481=_0x146481-0x0;var _0x31f7bb=_0x55e0[_0x146481];return _0x31f7bb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x055e('0x0'));var BPromise=require(_0x055e('0x1'));var rs=require(_0x055e('0x2'));var fs=require('fs');var Redis=require(_0x055e('0x3'));var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson[_0x055e('0xa')][_0x055e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x618ebc,_0x2dd78e,_0x32819d){return new BPromise(function(_0x1f93a5,_0x5f5295){return client[_0x055e('0xc')](_0x618ebc,_0x32819d)[_0x055e('0xd')](function(_0xda5c67){logger[_0x055e('0xe')](_0x055e('0xf'),_0x2dd78e,_0x055e('0x10'));logger[_0x055e('0x11')](_0x055e('0x12'),_0x2dd78e,_0x055e('0x10'),JSON[_0x055e('0x13')](_0xda5c67));if(_0xda5c67[_0x055e('0x14')]){if(_0xda5c67[_0x055e('0x14')]['code']===0x1f4){logger[_0x055e('0x14')](_0x055e('0xf'),_0x2dd78e,_0xda5c67[_0x055e('0x14')][_0x055e('0x15')]);return _0x5f5295(_0xda5c67[_0x055e('0x14')][_0x055e('0x15')]);}logger[_0x055e('0x14')](_0x055e('0xf'),_0x2dd78e,_0xda5c67[_0x055e('0x14')][_0x055e('0x15')]);return _0x1f93a5(_0xda5c67[_0x055e('0x14')][_0x055e('0x15')]);}else{logger['info'](_0x055e('0xf'),_0x2dd78e,_0x055e('0x10'));_0x1f93a5(_0xda5c67[_0x055e('0x16')]['message']);}})[_0x055e('0x17')](function(_0x1b6970){logger[_0x055e('0x14')]('ScreenRecording,\x20%s,\x20%s',_0x2dd78e,_0x1b6970);_0x5f5295(_0x1b6970);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 55d6186..d8d1100 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 _0xfe46=['%s%s','logo','extname','originalname','post','/:id/logo','single','addLogo','format','logologin','file','addLogoLogin','addPreferred','favicon','addFavicon','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe46,0x1b0));var _0x6fe4=function(_0x208613,_0x4d1b11){_0x208613=_0x208613-0x0;var _0xa01ab=_0xfe46[_0x208613];return _0xa01ab;};'use strict';var multer=require(_0x6fe4('0x0'));var util=require(_0x6fe4('0x1'));var path=require(_0x6fe4('0x2'));var timeout=require(_0x6fe4('0x3'));var express=require('express');var router=express[_0x6fe4('0x4')]();var fs_extra=require(_0x6fe4('0x5'));var auth=require(_0x6fe4('0x6'));var interaction=require(_0x6fe4('0x7'));var config=require(_0x6fe4('0x8'));var controller=require(_0x6fe4('0x9'));router[_0x6fe4('0xa')]('/',auth[_0x6fe4('0xb')](),controller[_0x6fe4('0xc')]);router[_0x6fe4('0xa')](_0x6fe4('0xd'),controller[_0x6fe4('0xe')]);router['get']('/:id',controller[_0x6fe4('0xf')]);router[_0x6fe4('0xa')]('/:id/logo',controller[_0x6fe4('0x10')]);router[_0x6fe4('0xa')](_0x6fe4('0x11'),controller[_0x6fe4('0x12')]);router[_0x6fe4('0xa')](_0x6fe4('0x13'),controller[_0x6fe4('0x14')]);router[_0x6fe4('0xa')](_0x6fe4('0x15'),controller['getPreferred']);router[_0x6fe4('0xa')](_0x6fe4('0x16'),controller[_0x6fe4('0x17')]);var upload=multer({'storage':multer[_0x6fe4('0x18')]({'destination':function(_0x59c0cf,_0x21c910,_0x1eb4ff){_0x1eb4ff(null,path[_0x6fe4('0x19')](config[_0x6fe4('0x1a')],_0x6fe4('0x1b')));},'filename':function(_0x51e230,_0x24a261,_0x3d8d30){_0x3d8d30(null,util['format'](_0x6fe4('0x1c'),_0x6fe4('0x1d'),path[_0x6fe4('0x1e')](_0x24a261[_0x6fe4('0x1f')])));}})});router[_0x6fe4('0x20')](_0x6fe4('0x21'),upload[_0x6fe4('0x22')]('file'),controller[_0x6fe4('0x23')]);var upload=multer({'storage':multer[_0x6fe4('0x18')]({'destination':function(_0x3d911c,_0x52fe06,_0x398248){_0x398248(null,path[_0x6fe4('0x19')](config[_0x6fe4('0x1a')],_0x6fe4('0x1b')));},'filename':function(_0x2d48de,_0x2c7b6c,_0x4ebc0d){_0x4ebc0d(null,util[_0x6fe4('0x24')](_0x6fe4('0x1c'),_0x6fe4('0x25'),path[_0x6fe4('0x1e')](_0x2c7b6c[_0x6fe4('0x1f')])));}})});router[_0x6fe4('0x20')](_0x6fe4('0x11'),upload[_0x6fe4('0x22')](_0x6fe4('0x26')),controller[_0x6fe4('0x27')]);var upload=multer({'storage':multer[_0x6fe4('0x18')]({'destination':function(_0x95c5f,_0x3b27f6,_0x23174a){_0x23174a(null,path[_0x6fe4('0x19')](config[_0x6fe4('0x1a')],_0x6fe4('0x1b')));},'filename':function(_0x28e3ce,_0x56e501,_0x8eea94){_0x8eea94(null,util[_0x6fe4('0x24')](_0x6fe4('0x1c'),'preferred',path[_0x6fe4('0x1e')](_0x56e501['originalname'])));}})});router[_0x6fe4('0x20')](_0x6fe4('0x15'),upload['single']('file'),controller[_0x6fe4('0x28')]);var upload=multer({'storage':multer[_0x6fe4('0x18')]({'destination':function(_0x13ed18,_0x586f93,_0x286e0b){_0x286e0b(null,path['join'](config[_0x6fe4('0x1a')],'server/files/images/logos/'));},'filename':function(_0x164c02,_0x118fb9,_0x218879){_0x218879(null,util[_0x6fe4('0x24')](_0x6fe4('0x1c'),_0x6fe4('0x29'),path[_0x6fe4('0x1e')](_0x118fb9[_0x6fe4('0x1f')])));}})});router[_0x6fe4('0x20')](_0x6fe4('0x16'),upload[_0x6fe4('0x22')](_0x6fe4('0x26')),controller[_0x6fe4('0x2a')]);router[_0x6fe4('0x2b')]('/:id',auth[_0x6fe4('0xb')](),controller[_0x6fe4('0x2c')]);module[_0x6fe4('0x2d')]=router; \ No newline at end of file +var _0x4bd1=['addFavicon','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','%s%s','logo','extname','originalname','single','file','diskStorage','server/files/images/logos/','format','post','/:id/logo_login','addLogoLogin','preferred','addPreferred','favicon'];(function(_0xd9f0a9,_0x562de9){var _0x1f1ca8=function(_0x17d165){while(--_0x17d165){_0xd9f0a9['push'](_0xd9f0a9['shift']());}};_0x1f1ca8(++_0x562de9);}(_0x4bd1,0x10b));var _0x14bd=function(_0x1c470d,_0x81d66b){_0x1c470d=_0x1c470d-0x0;var _0x12141b=_0x4bd1[_0x1c470d];return _0x12141b;};'use strict';var multer=require('multer');var util=require(_0x14bd('0x0'));var path=require(_0x14bd('0x1'));var timeout=require(_0x14bd('0x2'));var express=require(_0x14bd('0x3'));var router=express[_0x14bd('0x4')]();var fs_extra=require(_0x14bd('0x5'));var auth=require(_0x14bd('0x6'));var interaction=require(_0x14bd('0x7'));var config=require('../../config/environment');var controller=require(_0x14bd('0x8'));router[_0x14bd('0x9')]('/',auth[_0x14bd('0xa')](),controller[_0x14bd('0xb')]);router[_0x14bd('0x9')](_0x14bd('0xc'),controller[_0x14bd('0xd')]);router[_0x14bd('0x9')](_0x14bd('0xe'),controller[_0x14bd('0xf')]);router[_0x14bd('0x9')](_0x14bd('0x10'),controller[_0x14bd('0x11')]);router[_0x14bd('0x9')]('/:id/logo_login',controller[_0x14bd('0x12')]);router[_0x14bd('0x9')](_0x14bd('0x13'),controller['gdpr']);router[_0x14bd('0x9')](_0x14bd('0x14'),controller[_0x14bd('0x15')]);router['get'](_0x14bd('0x16'),controller[_0x14bd('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4d4ddf,_0x2ab416,_0x78caaf){_0x78caaf(null,path[_0x14bd('0x18')](config[_0x14bd('0x19')],'server/files/images/logos/'));},'filename':function(_0x137291,_0x413189,_0xb72dac){_0xb72dac(null,util['format'](_0x14bd('0x1a'),_0x14bd('0x1b'),path[_0x14bd('0x1c')](_0x413189[_0x14bd('0x1d')])));}})});router['post']('/:id/logo',upload[_0x14bd('0x1e')](_0x14bd('0x1f')),controller['addLogo']);var upload=multer({'storage':multer[_0x14bd('0x20')]({'destination':function(_0x358262,_0x44a690,_0x2a4534){_0x2a4534(null,path[_0x14bd('0x18')](config[_0x14bd('0x19')],_0x14bd('0x21')));},'filename':function(_0x5897b3,_0xc1a407,_0x5ad105){_0x5ad105(null,util[_0x14bd('0x22')](_0x14bd('0x1a'),'logologin',path[_0x14bd('0x1c')](_0xc1a407[_0x14bd('0x1d')])));}})});router[_0x14bd('0x23')](_0x14bd('0x24'),upload[_0x14bd('0x1e')]('file'),controller[_0x14bd('0x25')]);var upload=multer({'storage':multer[_0x14bd('0x20')]({'destination':function(_0x2e548c,_0x8c0ff2,_0x2201f5){_0x2201f5(null,path[_0x14bd('0x18')](config['root'],'server/files/images/logos/'));},'filename':function(_0x3f95b6,_0x56ffa3,_0x35d19e){_0x35d19e(null,util[_0x14bd('0x22')](_0x14bd('0x1a'),_0x14bd('0x26'),path[_0x14bd('0x1c')](_0x56ffa3[_0x14bd('0x1d')])));}})});router[_0x14bd('0x23')](_0x14bd('0x14'),upload[_0x14bd('0x1e')](_0x14bd('0x1f')),controller[_0x14bd('0x27')]);var upload=multer({'storage':multer[_0x14bd('0x20')]({'destination':function(_0x51d15b,_0x3209a2,_0x499418){_0x499418(null,path[_0x14bd('0x18')](config[_0x14bd('0x19')],_0x14bd('0x21')));},'filename':function(_0x46cbab,_0x309dbb,_0x47b238){_0x47b238(null,util[_0x14bd('0x22')](_0x14bd('0x1a'),_0x14bd('0x28'),path[_0x14bd('0x1c')](_0x309dbb['originalname'])));}})});router[_0x14bd('0x23')](_0x14bd('0x16'),upload[_0x14bd('0x1e')]('file'),controller[_0x14bd('0x29')]);router['put'](_0x14bd('0xe'),auth[_0x14bd('0xa')](),controller[_0x14bd('0x2a')]);module[_0x14bd('0x2b')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 75405c4..00aaca7 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 _0xd7a6=['STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xd7a6,0x1ea));var _0x6d7a=function(_0x14b6b2,_0x421715){_0x14b6b2=_0x14b6b2-0x0;var _0x324c9b=_0xd7a6[_0x14b6b2];return _0x324c9b;};'use strict';var Sequelize=require(_0x6d7a('0x0'));module[_0x6d7a('0x1')]={'min_internal':{'type':Sequelize[_0x6d7a('0x2')](0xb),'unique':_0x6d7a('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x6d7a('0x2')](0xb),'unique':_0x6d7a('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x6d7a('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x6d7a('0x5')],'defaultValue':_0x6d7a('0x6')},'logo':{'type':Sequelize[_0x6d7a('0x5')]},'defaultLogo':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x6d7a('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x6d7a('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x6d7a('0x5')]},'turnaddr':{'type':Sequelize[_0x6d7a('0x5')]},'turnusername':{'type':Sequelize[_0x6d7a('0x5')]},'turnpassword':{'type':Sequelize[_0x6d7a('0x5')]},'pageTitle':{'type':Sequelize[_0x6d7a('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x6d7a('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x6d7a('0x5')],'defaultValue':_0x6d7a('0x8')},'enableEmailPreview':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x6d7a('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x6d7a('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x6d7a('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x6d7a('0x5')],'defaultValue':_0x6d7a('0x9')},'chatTimeout':{'type':Sequelize[_0x6d7a('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x6d7a('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x6d7a('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x6d7a('0x5')]},'defaultFavicon':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x6d7a('0x2')]},'transcribeRegion':{'type':Sequelize[_0x6d7a('0x5')]},'sentiment':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x6d7a('0x5')]},'bucket':{'type':Sequelize[_0x6d7a('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x6d7a('0x2')](0x2)[_0x6d7a('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x6d7a('0x2')](0x2)[_0x6d7a('0xa')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x6d7a('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x6d7a('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x6d7a('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x6d7a('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x6d7a('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x6d7a('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x9179=['sequelize','INTEGER','min_internal','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED'];(function(_0x59606e,_0x429521){var _0x19e449=function(_0x1a0483){while(--_0x1a0483){_0x59606e['push'](_0x59606e['shift']());}};_0x19e449(++_0x429521);}(_0x9179,0x188));var _0x9917=function(_0x19a38f,_0xa1269a){_0x19a38f=_0x19a38f-0x0;var _0x4c6766=_0x9179[_0x19a38f];return _0x4c6766;};'use strict';var Sequelize=require(_0x9917('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x9917('0x1')](0xb),'unique':_0x9917('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x9917('0x1')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x9917('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x9917('0x3')],'defaultValue':_0x9917('0x4')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x9917('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0x9917('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x9917('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x9917('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x9917('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x9917('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x9917('0x3')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x9917('0x3')]},'pageTitle':{'type':Sequelize[_0x9917('0x3')]},'defaultPageTitle':{'type':Sequelize[_0x9917('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x9917('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x9917('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x9917('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x9917('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x9917('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x9917('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x9917('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x9917('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x9917('0x3')],'defaultValue':_0x9917('0x6')},'chatTimeout':{'type':Sequelize[_0x9917('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x9917('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x9917('0x3')]},'defaultPreferred':{'type':Sequelize[_0x9917('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x9917('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x9917('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0x9917('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x9917('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x9917('0x3')]},'defaultFavicon':{'type':Sequelize[_0x9917('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x9917('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x9917('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x9917('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x9917('0x3')]},'sentiment':{'type':Sequelize[_0x9917('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x9917('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x9917('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9917('0x3')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x9917('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x9917('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x9917('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0x9917('0x7')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x9917('0x1')](0x2)[_0x9917('0x7')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x9917('0x7')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x9917('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x9917('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x9917('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x9917('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x9917('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x9917('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x9917('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x9917('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x9917('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index a669ed6..a1832eb 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 _0x5c5f=['show','params','length','find','body','file','filename','logo','loginLogo','../../config/license/util','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','join','toLower','root','default_logo.svg','custom','existsSync','ValidationError','\x20not\x20found','getLogoLogin','server/files/images/logos','getLicense','defaultLoginLogo','default','Sequelize','upperFirst','download','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','format','send','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','Setting','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows'];(function(_0x5d8e3b,_0x59e6aa){var _0x42e192=function(_0x41d110){while(--_0x41d110){_0x5d8e3b['push'](_0x5d8e3b['shift']());}};_0x42e192(++_0x59e6aa);}(_0x5c5f,0x120));var _0xf5c5=function(_0x462bff,_0x151a16){_0x462bff=_0x462bff-0x0;var _0x27229a=_0x5c5f[_0x462bff];return _0x27229a;};'use strict';var emlformat=require(_0xf5c5('0x0'));var rimraf=require(_0xf5c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf5c5('0x2'));var rp=require(_0xf5c5('0x3'));var moment=require(_0xf5c5('0x4'));var BPromise=require(_0xf5c5('0x5'));var Mustache=require(_0xf5c5('0x6'));var util=require(_0xf5c5('0x7'));var path=require('path');var sox=require(_0xf5c5('0x8'));var csv=require(_0xf5c5('0x9'));var ejs=require(_0xf5c5('0xa'));var fs=require('fs');var fs_extra=require(_0xf5c5('0xb'));var _=require(_0xf5c5('0xc'));var squel=require(_0xf5c5('0xd'));var crypto=require(_0xf5c5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf5c5('0xf'));var toCsv=require(_0xf5c5('0x9'));var querystring=require(_0xf5c5('0x10'));var Papa=require(_0xf5c5('0x11'));var Redis=require(_0xf5c5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf5c5('0x13'));var as=require(_0xf5c5('0x14'));var hardwareService=require(_0xf5c5('0x15'));var logger=require(_0xf5c5('0x16'))(_0xf5c5('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf5c5('0x18'))['db'];var jayson=require(_0xf5c5('0x19'));var client=jayson[_0xf5c5('0x1a')][_0xf5c5('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x55bdc3,_0x5bd23d,_0x14846c,_0x391e1b){return new BPromise(function(_0x3f48ba,_0x23d922){var _0x1f6bc0=_0x391e1b||client;return _0x1f6bc0[_0xf5c5('0x1c')](_0x55bdc3,_0x14846c)['then'](function(_0x5cd00f){logger[_0xf5c5('0x1d')](_0xf5c5('0x1e'),_0x5bd23d,_0xf5c5('0x1f'));logger['debug'](_0xf5c5('0x20'),_0x5bd23d,_0xf5c5('0x1f'),JSON[_0xf5c5('0x21')](_0x5cd00f));if(_0x5cd00f['error']){if(_0x5cd00f[_0xf5c5('0x22')][_0xf5c5('0x23')]===0x1f4){logger[_0xf5c5('0x22')](_0xf5c5('0x1e'),_0x5bd23d,_0x5cd00f[_0xf5c5('0x22')][_0xf5c5('0x24')]);return _0x23d922(_0x5cd00f[_0xf5c5('0x22')][_0xf5c5('0x24')]);}logger[_0xf5c5('0x22')](_0xf5c5('0x1e'),_0x5bd23d,_0x5cd00f[_0xf5c5('0x22')]['message']);return _0x3f48ba(_0x5cd00f[_0xf5c5('0x22')]['message']);}else{logger[_0xf5c5('0x1d')](_0xf5c5('0x1e'),_0x5bd23d,_0xf5c5('0x1f'));_0x3f48ba(_0x5cd00f[_0xf5c5('0x25')][_0xf5c5('0x24')]);}})[_0xf5c5('0x26')](function(_0x4ee668){logger['error'](_0xf5c5('0x1e'),_0x5bd23d,_0x4ee668);_0x23d922(_0x4ee668);});});}function respondWithStatusCode(_0x31288f,_0x1fe148){_0x1fe148=_0x1fe148||0xcc;return function(_0x533ee0){if(_0x533ee0){return _0x31288f[_0xf5c5('0x27')](_0x1fe148);}return _0x31288f['status'](_0x1fe148)[_0xf5c5('0x28')]();};}function respondWithResult(_0x127acd,_0x2380cc){_0x2380cc=_0x2380cc||0xc8;return function(_0x4d13ad){if(_0x4d13ad){return _0x127acd[_0xf5c5('0x29')](_0x2380cc)[_0xf5c5('0x2a')](_0x4d13ad);}};}function respondWithFilteredResult(_0x2860af,_0x13ac01){return function(_0x4de7e6){if(_0x4de7e6){var _0x12b4de=typeof _0x13ac01['offset']==='undefined'&&typeof _0x13ac01[_0xf5c5('0x2b')]===_0xf5c5('0x2c');var _0x3abe0e=_0x4de7e6[_0xf5c5('0x2d')];var _0x9ac286=_0x12b4de?0x0:_0x13ac01['offset'];var _0x4e992c=_0x12b4de?_0x4de7e6[_0xf5c5('0x2d')]:_0x13ac01[_0xf5c5('0x2e')]+_0x13ac01[_0xf5c5('0x2b')];var _0x2b12c8;if(_0x4e992c>=_0x3abe0e){_0x4e992c=_0x3abe0e;_0x2b12c8=0xc8;}else{_0x2b12c8=0xce;}_0x2860af['status'](_0x2b12c8);return _0x2860af['set'](_0xf5c5('0x2f'),_0x9ac286+'-'+_0x4e992c+'/'+_0x3abe0e)['json'](_0x4de7e6);}return null;};}function patchUpdates(_0x2cb83f){return function(_0x1990f7){try{jsonpatch[_0xf5c5('0x30')](_0x1990f7,_0x2cb83f,!![]);}catch(_0x46a619){return BPromise[_0xf5c5('0x31')](_0x46a619);}return _0x1990f7[_0xf5c5('0x32')]();};}function saveUpdates(_0x4c2cae,_0x59accd){return function(_0x238fad){if(_0x238fad){return _0x238fad[_0xf5c5('0x33')](_0x4c2cae)[_0xf5c5('0x34')](function(_0x4480d2){return _0x4480d2;});}return null;};}function removeEntity(_0x511e3f,_0x45bb58){return function(_0x4de71b){if(_0x4de71b){return _0x4de71b[_0xf5c5('0x35')]()[_0xf5c5('0x34')](function(){_0x511e3f[_0xf5c5('0x29')](0xcc)[_0xf5c5('0x28')]();});}};}function handleEntityNotFound(_0x2973cc,_0x55b4fd){return function(_0x55d6ba){if(!_0x55d6ba){_0x2973cc[_0xf5c5('0x27')](0x194);}return _0x55d6ba;};}function handleError(_0x23ed3e,_0x459d66){_0x459d66=_0x459d66||0x1f4;return function(_0x3233d4){logger[_0xf5c5('0x22')](_0x3233d4[_0xf5c5('0x36')]);if(_0x3233d4[_0xf5c5('0x37')]){delete _0x3233d4[_0xf5c5('0x37')];}_0x23ed3e['status'](_0x459d66)['send'](_0x3233d4);};}exports[_0xf5c5('0x38')]=function(_0xd517f8,_0x4715a3){var _0x27068e={},_0x56c28b={},_0x5624a9={'count':0x0,'rows':[]};var _0x3feb5d=_[_0xf5c5('0x39')](db[_0xf5c5('0x3a')][_0xf5c5('0x3b')],function(_0x38206e){return{'name':_0x38206e[_0xf5c5('0x3c')],'type':_0x38206e[_0xf5c5('0x3d')]['key']};});_0x56c28b['model']=_[_0xf5c5('0x39')](_0x3feb5d,'name');_0x56c28b[_0xf5c5('0x3e')]=_[_0xf5c5('0x3f')](_0xd517f8[_0xf5c5('0x3e')]);_0x56c28b[_0xf5c5('0x40')]=_['intersection'](_0x56c28b[_0xf5c5('0x41')],_0x56c28b[_0xf5c5('0x3e')]);_0x27068e[_0xf5c5('0x42')]=_[_0xf5c5('0x43')](_0x56c28b[_0xf5c5('0x41')],qs[_0xf5c5('0x44')](_0xd517f8[_0xf5c5('0x3e')]['fields']));_0x27068e['attributes']=_0x27068e[_0xf5c5('0x42')]['length']?_0x27068e[_0xf5c5('0x42')]:_0x56c28b['model'];if(!_0xd517f8[_0xf5c5('0x3e')][_0xf5c5('0x45')](_0xf5c5('0x46'))){_0x27068e[_0xf5c5('0x2b')]=qs[_0xf5c5('0x2b')](_0xd517f8['query'][_0xf5c5('0x2b')]);_0x27068e[_0xf5c5('0x2e')]=qs['offset'](_0xd517f8[_0xf5c5('0x3e')]['offset']);}_0x27068e['order']=qs[_0xf5c5('0x47')](_0xd517f8[_0xf5c5('0x3e')]['sort']);_0x27068e['where']=qs[_0xf5c5('0x40')](_[_0xf5c5('0x48')](_0xd517f8[_0xf5c5('0x3e')],_0x56c28b[_0xf5c5('0x40')]),_0x3feb5d);if(_0xd517f8[_0xf5c5('0x3e')][_0xf5c5('0x49')]){_0x27068e[_0xf5c5('0x4a')]=_[_0xf5c5('0x4b')](_0x27068e[_0xf5c5('0x4a')],{'$or':_[_0xf5c5('0x39')](_0x3feb5d,function(_0x196df5){if(_0x196df5[_0xf5c5('0x3d')]!==_0xf5c5('0x4c')){var _0x32cf7c={};_0x32cf7c[_0x196df5[_0xf5c5('0x37')]]={'$like':'%'+_0xd517f8[_0xf5c5('0x3e')][_0xf5c5('0x49')]+'%'};return _0x32cf7c;}})});}_0x27068e=_[_0xf5c5('0x4b')]({},_0x27068e,_0xd517f8[_0xf5c5('0x4d')]);var _0x3db98b={'where':_0x27068e[_0xf5c5('0x4a')]};return db['Setting'][_0xf5c5('0x2d')](_0x3db98b)[_0xf5c5('0x34')](function(_0x6da529){_0x5624a9[_0xf5c5('0x2d')]=_0x6da529;if(_0xd517f8['query'][_0xf5c5('0x4e')]){_0x27068e[_0xf5c5('0x4f')]=[{'all':!![]}];}return db[_0xf5c5('0x3a')]['findAll'](_0x27068e);})['then'](function(_0x1d53de){_0x5624a9[_0xf5c5('0x50')]=_0x1d53de;return _0x5624a9;})[_0xf5c5('0x34')](respondWithFilteredResult(_0x4715a3,_0x27068e))[_0xf5c5('0x26')](handleError(_0x4715a3,null));};exports[_0xf5c5('0x51')]=function(_0xf9473a,_0x32a48b){var _0x31741f={'raw':![],'where':{'id':_0xf9473a[_0xf5c5('0x52')]['id']}},_0x27f644={};_0x27f644[_0xf5c5('0x41')]=_['keys'](db[_0xf5c5('0x3a')][_0xf5c5('0x3b')]);_0x27f644[_0xf5c5('0x3e')]=_[_0xf5c5('0x3f')](_0xf9473a['query']);_0x27f644[_0xf5c5('0x40')]=_[_0xf5c5('0x43')](_0x27f644[_0xf5c5('0x41')],_0x27f644[_0xf5c5('0x3e')]);_0x31741f[_0xf5c5('0x42')]=_[_0xf5c5('0x43')](_0x27f644['model'],qs['fields'](_0xf9473a[_0xf5c5('0x3e')]['fields']));_0x31741f[_0xf5c5('0x42')]=_0x31741f['attributes'][_0xf5c5('0x53')]?_0x31741f[_0xf5c5('0x42')]:_0x27f644[_0xf5c5('0x41')];if(_0xf9473a['query']['includeAll']){_0x31741f[_0xf5c5('0x4f')]=[{'all':!![]}];}_0x31741f=_[_0xf5c5('0x4b')]({},_0x31741f,_0xf9473a['options']);return db['Setting'][_0xf5c5('0x54')](_0x31741f)[_0xf5c5('0x34')](handleEntityNotFound(_0x32a48b,null))['then'](respondWithResult(_0x32a48b,null))[_0xf5c5('0x26')](handleError(_0x32a48b,null));};exports[_0xf5c5('0x33')]=function(_0xe67623,_0x4700d9){if(_0xe67623[_0xf5c5('0x55')]['id']){delete _0xe67623[_0xf5c5('0x55')]['id'];}return db[_0xf5c5('0x3a')][_0xf5c5('0x54')]({'where':{'id':_0xe67623[_0xf5c5('0x52')]['id']}})[_0xf5c5('0x34')](handleEntityNotFound(_0x4700d9,null))['then'](saveUpdates(_0xe67623[_0xf5c5('0x55')],null))[_0xf5c5('0x34')](respondWithResult(_0x4700d9,null))[_0xf5c5('0x26')](handleError(_0x4700d9,null));};exports['addLogo']=function(_0x117a63,_0x427617,_0x51df1d){if(_0x117a63[_0xf5c5('0x56')]&&_0x117a63[_0xf5c5('0x56')][_0xf5c5('0x57')]){_0x117a63[_0xf5c5('0x55')][_0xf5c5('0x58')]=_0x117a63[_0xf5c5('0x56')]['filename'];}return db[_0xf5c5('0x3a')][_0xf5c5('0x54')]({'where':{'id':_0x117a63[_0xf5c5('0x52')]['id']}})['then'](handleEntityNotFound(_0x427617,null))['then'](saveUpdates(_0x117a63[_0xf5c5('0x55')],null))[_0xf5c5('0x34')](respondWithResult(_0x427617,null))[_0xf5c5('0x26')](handleError(_0x427617,null));};exports['addLogoLogin']=function(_0x1e9061,_0x5b92c6,_0x117ac4){if(_0x1e9061['file']&&_0x1e9061[_0xf5c5('0x56')][_0xf5c5('0x57')]){_0x1e9061['body'][_0xf5c5('0x59')]=_0x1e9061[_0xf5c5('0x56')][_0xf5c5('0x57')];}return db[_0xf5c5('0x3a')][_0xf5c5('0x54')]({'where':{'id':_0x1e9061['params']['id']}})[_0xf5c5('0x34')](handleEntityNotFound(_0x5b92c6,null))[_0xf5c5('0x34')](saveUpdates(_0x1e9061[_0xf5c5('0x55')],null))[_0xf5c5('0x34')](respondWithResult(_0x5b92c6,null))[_0xf5c5('0x26')](handleError(_0x5b92c6,null));};var utilLicense=require(_0xf5c5('0x5a'));exports['getLogo']=function(_0x2b6dd0,_0x25ea88,_0xac3935){var _0x224499='server/files/images/logos';var _0x113fc8={'custom':![]};return utilLicense['getLicense']()[_0xf5c5('0x34')](function(_0x4fd4bf){if(_0x4fd4bf){_0x113fc8=_0x4fd4bf;}return db['Setting'][_0xf5c5('0x54')]({'where':{'id':_0x2b6dd0['params']['id']},'attributes':[_0xf5c5('0x58'),_0xf5c5('0x59'),_0xf5c5('0x5b'),_0xf5c5('0x5c'),_0xf5c5('0x5d'),'defaultLoginLogo',_0xf5c5('0x5e'),_0xf5c5('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x25ea88,null))[_0xf5c5('0x34')](function(_0x186ba1){if(_0x186ba1){var _0x361724=_0x186ba1[_0xf5c5('0x58')]&&fs['existsSync'](path[_0xf5c5('0x60')](config['root'],_0x224499,_[_0xf5c5('0x61')](_0x186ba1[_0xf5c5('0x58')])))?path['join'](config[_0xf5c5('0x62')],_0x224499,_['toLower'](_0x186ba1[_0xf5c5('0x58')])):path[_0xf5c5('0x60')](config['root'],_0x224499,_[_0xf5c5('0x61')](_0xf5c5('0x63')));var _0x2b7ffc='default'+_['upperFirst'](_0xf5c5('0x58'));if(_0x186ba1[_0x2b7ffc]||!_0x113fc8[_0xf5c5('0x64')]){_0x361724=path[_0xf5c5('0x60')](config[_0xf5c5('0x62')],_0x224499,_[_0xf5c5('0x61')](_0xf5c5('0x63')));}if(!fs[_0xf5c5('0x65')](_0x361724)){throw new db['Sequelize'][(_0xf5c5('0x66'))](_['upperFirst']('logo')+_0xf5c5('0x67'));}return _0x25ea88['download'](_0x361724);}})['catch'](handleError(_0x25ea88,null));};var utilLicense=require('../../config/license/util');exports[_0xf5c5('0x68')]=function(_0x322847,_0x48b2cc,_0x447d78){var _0x4581da=_0xf5c5('0x69');var _0x2eb8e3={'custom':![]};return utilLicense[_0xf5c5('0x6a')]()[_0xf5c5('0x34')](function(_0x16a273){if(_0x16a273){_0x2eb8e3=_0x16a273;}return db[_0xf5c5('0x3a')][_0xf5c5('0x54')]({'where':{'id':_0x322847['params']['id']},'attributes':[_0xf5c5('0x58'),_0xf5c5('0x59'),'preferred','favicon',_0xf5c5('0x5d'),_0xf5c5('0x6b'),_0xf5c5('0x5e'),'defaultFavicon'],'raw':!![]});})[_0xf5c5('0x34')](handleEntityNotFound(_0x48b2cc,null))[_0xf5c5('0x34')](function(_0x2cb249){if(_0x2cb249){var _0x5d6a8b=_0x2cb249['loginLogo']&&fs['existsSync'](path[_0xf5c5('0x60')](config[_0xf5c5('0x62')],_0x4581da,_[_0xf5c5('0x61')](_0x2cb249[_0xf5c5('0x59')])))?path[_0xf5c5('0x60')](config[_0xf5c5('0x62')],_0x4581da,_[_0xf5c5('0x61')](_0x2cb249[_0xf5c5('0x59')])):path[_0xf5c5('0x60')](config[_0xf5c5('0x62')],_0x4581da,_[_0xf5c5('0x61')]('default_loginLogo.svg'));var _0x30be56=_0xf5c5('0x6c')+_['upperFirst'](_0xf5c5('0x59'));if(_0x2cb249[_0x30be56]||!_0x2eb8e3['custom']){_0x5d6a8b=path['join'](config[_0xf5c5('0x62')],_0x4581da,_[_0xf5c5('0x61')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x5d6a8b)){throw new db[(_0xf5c5('0x6d'))][(_0xf5c5('0x66'))](_[_0xf5c5('0x6e')]('loginLogo')+_0xf5c5('0x67'));}return _0x48b2cc[_0xf5c5('0x6f')](_0x5d6a8b);}})['catch'](handleError(_0x48b2cc,null));};exports[_0xf5c5('0x70')]=function(_0x201c55,_0x447a33){return db[_0xf5c5('0x3a')][_0xf5c5('0x54')]({'where':{'id':_0x201c55['params']['id']},'attributes':[_0xf5c5('0x71')]})[_0xf5c5('0x34')](respondWithResult(_0x447a33,null))[_0xf5c5('0x26')](handleError(_0x447a33,null));};exports[_0xf5c5('0x72')]=function(_0x6b0596,_0x3c2859,_0x45f0be){if(_0x6b0596[_0xf5c5('0x56')]&&_0x6b0596[_0xf5c5('0x56')][_0xf5c5('0x57')]){_0x6b0596['body'][_0xf5c5('0x5b')]=_0x6b0596[_0xf5c5('0x56')]['filename'];}return db[_0xf5c5('0x3a')][_0xf5c5('0x54')]({'where':{'id':_0x6b0596[_0xf5c5('0x52')]['id']}})[_0xf5c5('0x34')](handleEntityNotFound(_0x3c2859,null))[_0xf5c5('0x34')](saveUpdates(_0x6b0596[_0xf5c5('0x55')],null))[_0xf5c5('0x34')](respondWithResult(_0x3c2859,null))[_0xf5c5('0x26')](handleError(_0x3c2859,null));};var utilLicense=require(_0xf5c5('0x5a'));exports[_0xf5c5('0x73')]=function(_0x5158d4,_0x14308b,_0x2b8c7a){var _0x548455='server/files/images/logos';var _0x75f7ef={'custom':![]};return utilLicense[_0xf5c5('0x6a')]()['then'](function(_0x2b955d){if(_0x2b955d){_0x75f7ef=_0x2b955d;}return db['Setting'][_0xf5c5('0x54')]({'where':{'id':_0x5158d4['params']['id']},'attributes':['logo','loginLogo',_0xf5c5('0x5b'),'favicon',_0xf5c5('0x5d'),'defaultLoginLogo','defaultPreferred',_0xf5c5('0x5f')],'raw':!![]});})[_0xf5c5('0x34')](handleEntityNotFound(_0x14308b,null))[_0xf5c5('0x34')](function(_0x4fc3d3){if(_0x4fc3d3){var _0x26c2f2=_0x4fc3d3['preferred']&&fs['existsSync'](path['join'](config[_0xf5c5('0x62')],_0x548455,_[_0xf5c5('0x61')](_0x4fc3d3['preferred'])))?path[_0xf5c5('0x60')](config[_0xf5c5('0x62')],_0x548455,_['toLower'](_0x4fc3d3['preferred'])):path[_0xf5c5('0x60')](config['root'],_0x548455,_[_0xf5c5('0x61')](_0xf5c5('0x74')));var _0x1b9fec='default'+_[_0xf5c5('0x6e')](_0xf5c5('0x5b'));if(_0x4fc3d3[_0x1b9fec]||!_0x75f7ef[_0xf5c5('0x64')]||!_0x75f7ef['preferred']){_0x26c2f2=path['join'](config[_0xf5c5('0x62')],_0x548455,_[_0xf5c5('0x61')](_0xf5c5('0x74')));}if(!fs['existsSync'](_0x26c2f2)){throw new db[(_0xf5c5('0x6d'))][(_0xf5c5('0x66'))](_[_0xf5c5('0x6e')](_0xf5c5('0x5b'))+_0xf5c5('0x67'));}return _0x14308b['download'](_0x26c2f2);}})[_0xf5c5('0x26')](handleError(_0x14308b,null));};exports[_0xf5c5('0x75')]=function(_0x4762c1,_0x450b3e,_0x36ae66){if(_0x4762c1[_0xf5c5('0x56')]&&_0x4762c1[_0xf5c5('0x56')]['filename']){_0x4762c1[_0xf5c5('0x55')]['favicon']=_0x4762c1[_0xf5c5('0x56')]['filename'];}return db[_0xf5c5('0x3a')][_0xf5c5('0x54')]({'where':{'id':_0x4762c1[_0xf5c5('0x52')]['id']}})[_0xf5c5('0x34')](handleEntityNotFound(_0x450b3e,null))[_0xf5c5('0x34')](saveUpdates(_0x4762c1[_0xf5c5('0x55')],null))[_0xf5c5('0x34')](respondWithResult(_0x450b3e,null))['catch'](handleError(_0x450b3e,null));};var utilLicense=require(_0xf5c5('0x5a'));exports['getFavicon']=function(_0x4723e3,_0x1b8b70,_0x316867){var _0x3274bd=_0xf5c5('0x69');var _0x1755bf={'custom':![]};return utilLicense['getLicense']()[_0xf5c5('0x34')](function(_0x346171){if(_0x346171){_0x1755bf=_0x346171;}return db[_0xf5c5('0x3a')][_0xf5c5('0x54')]({'where':{'id':_0x4723e3[_0xf5c5('0x52')]['id']},'attributes':['logo',_0xf5c5('0x59'),_0xf5c5('0x5b'),_0xf5c5('0x5c'),_0xf5c5('0x5d'),'defaultLoginLogo',_0xf5c5('0x5e'),'defaultFavicon'],'raw':!![]});})[_0xf5c5('0x34')](handleEntityNotFound(_0x1b8b70,null))['then'](function(_0x10ded8){if(_0x10ded8){var _0xc1c6e8=_0x10ded8[_0xf5c5('0x5c')]&&fs[_0xf5c5('0x65')](path[_0xf5c5('0x60')](config['root'],_0x3274bd,_[_0xf5c5('0x61')](_0x10ded8[_0xf5c5('0x5c')])))?path[_0xf5c5('0x60')](config[_0xf5c5('0x62')],_0x3274bd,_[_0xf5c5('0x61')](_0x10ded8[_0xf5c5('0x5c')])):path['join'](config[_0xf5c5('0x62')],_0x3274bd,_[_0xf5c5('0x61')](_0xf5c5('0x76')));var _0x189ba9='default'+_[_0xf5c5('0x6e')](_0xf5c5('0x5c'));if(_0x10ded8[_0x189ba9]||!_0x1755bf['custom']){_0xc1c6e8=path[_0xf5c5('0x60')](config[_0xf5c5('0x62')],_0x3274bd,_[_0xf5c5('0x61')](_0xf5c5('0x76')));}if(!fs['existsSync'](_0xc1c6e8)){throw new db[(_0xf5c5('0x6d'))][(_0xf5c5('0x66'))](_['upperFirst'](_0xf5c5('0x5c'))+_0xf5c5('0x67'));}return _0x1b8b70[_0xf5c5('0x6f')](_0xc1c6e8);}})[_0xf5c5('0x26')](handleError(_0x1b8b70,null));};exports[_0xf5c5('0x77')]=function(_0x4f3742,_0x52cf6f){var _0x3601f2={'offset':moment()[_0xf5c5('0x78')]()};_0x3601f2['now']=moment()[_0xf5c5('0x78')](_0x3601f2[_0xf5c5('0x2e')])[_0xf5c5('0x79')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x52cf6f[_0xf5c5('0x29')](0xc8)[_0xf5c5('0x7a')](_0x3601f2);}; \ No newline at end of file +var _0x6c84=['file','filename','addLogoLogin','loginLogo','getLogo','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','logo','existsSync','root','toLower','join','default_logo.svg','default','upperFirst','Sequelize','download','getLogoLogin','server/files/images/logos','default_loginLogo.svg','custom','ValidationError','securePassword','getPreferred','default_preferred.png','\x20not\x20found','addFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','then','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','destroy','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','catch','update','body','find'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x6c84,0x112));var _0x46c8=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x6c84[_0x4c12ec];return _0x3ae42c;};'use strict';var emlformat=require(_0x46c8('0x0'));var rimraf=require(_0x46c8('0x1'));var zipdir=require(_0x46c8('0x2'));var jsonpatch=require(_0x46c8('0x3'));var rp=require(_0x46c8('0x4'));var moment=require('moment');var BPromise=require(_0x46c8('0x5'));var Mustache=require('mustache');var util=require(_0x46c8('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x46c8('0x7'));var ejs=require(_0x46c8('0x8'));var fs=require('fs');var fs_extra=require(_0x46c8('0x9'));var _=require(_0x46c8('0xa'));var squel=require(_0x46c8('0xb'));var crypto=require(_0x46c8('0xc'));var jsforce=require(_0x46c8('0xd'));var deskjs=require(_0x46c8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x46c8('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x46c8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x46c8('0x11'));var logger=require(_0x46c8('0x12'))(_0x46c8('0x13'));var utils=require(_0x46c8('0x14'));var config=require(_0x46c8('0x15'));var licenseUtil=require(_0x46c8('0x16'));var db=require(_0x46c8('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x201cac,_0x5d5bb7,_0x2df7e8,_0xed016){return new BPromise(function(_0x30feb2,_0x1ae8c1){var _0x55d417=_0xed016||client;return _0x55d417['request'](_0x201cac,_0x2df7e8)[_0x46c8('0x18')](function(_0x26ab24){logger['info'](_0x46c8('0x19'),_0x5d5bb7,_0x46c8('0x1a'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x5d5bb7,_0x46c8('0x1a'),JSON[_0x46c8('0x1b')](_0x26ab24));if(_0x26ab24[_0x46c8('0x1c')]){if(_0x26ab24[_0x46c8('0x1c')][_0x46c8('0x1d')]===0x1f4){logger[_0x46c8('0x1c')](_0x46c8('0x19'),_0x5d5bb7,_0x26ab24[_0x46c8('0x1c')][_0x46c8('0x1e')]);return _0x1ae8c1(_0x26ab24['error'][_0x46c8('0x1e')]);}logger[_0x46c8('0x1c')](_0x46c8('0x19'),_0x5d5bb7,_0x26ab24[_0x46c8('0x1c')][_0x46c8('0x1e')]);return _0x30feb2(_0x26ab24['error'][_0x46c8('0x1e')]);}else{logger[_0x46c8('0x1f')]('Setting,\x20%s,\x20%s',_0x5d5bb7,'request\x20sent');_0x30feb2(_0x26ab24[_0x46c8('0x20')][_0x46c8('0x1e')]);}})['catch'](function(_0x124f5b){logger['error'](_0x46c8('0x19'),_0x5d5bb7,_0x124f5b);_0x1ae8c1(_0x124f5b);});});}function respondWithStatusCode(_0x1d724b,_0xa0e7bd){_0xa0e7bd=_0xa0e7bd||0xcc;return function(_0x18d230){if(_0x18d230){return _0x1d724b[_0x46c8('0x21')](_0xa0e7bd);}return _0x1d724b[_0x46c8('0x22')](_0xa0e7bd)[_0x46c8('0x23')]();};}function respondWithResult(_0x44a796,_0x8086ec){_0x8086ec=_0x8086ec||0xc8;return function(_0x2432cb){if(_0x2432cb){return _0x44a796[_0x46c8('0x22')](_0x8086ec)[_0x46c8('0x24')](_0x2432cb);}};}function respondWithFilteredResult(_0x17ea0f,_0x4da906){return function(_0x3a2d3f){if(_0x3a2d3f){var _0x310b3d=typeof _0x4da906[_0x46c8('0x25')]===_0x46c8('0x26')&&typeof _0x4da906[_0x46c8('0x27')]===_0x46c8('0x26');var _0x2c78f9=_0x3a2d3f[_0x46c8('0x28')];var _0x840dac=_0x310b3d?0x0:_0x4da906[_0x46c8('0x25')];var _0x1f3b79=_0x310b3d?_0x3a2d3f[_0x46c8('0x28')]:_0x4da906['offset']+_0x4da906[_0x46c8('0x27')];var _0x4426b2;if(_0x1f3b79>=_0x2c78f9){_0x1f3b79=_0x2c78f9;_0x4426b2=0xc8;}else{_0x4426b2=0xce;}_0x17ea0f[_0x46c8('0x22')](_0x4426b2);return _0x17ea0f['set']('Content-Range',_0x840dac+'-'+_0x1f3b79+'/'+_0x2c78f9)[_0x46c8('0x24')](_0x3a2d3f);}return null;};}function patchUpdates(_0x22057d){return function(_0x69eac8){try{jsonpatch[_0x46c8('0x29')](_0x69eac8,_0x22057d,!![]);}catch(_0x3d3988){return BPromise[_0x46c8('0x2a')](_0x3d3988);}return _0x69eac8[_0x46c8('0x2b')]();};}function saveUpdates(_0x2ddfa5,_0x24e0ab){return function(_0x226535){if(_0x226535){return _0x226535['update'](_0x2ddfa5)['then'](function(_0x3a98b1){return _0x3a98b1;});}return null;};}function removeEntity(_0x4b65d2,_0xa584be){return function(_0x2cff71){if(_0x2cff71){return _0x2cff71[_0x46c8('0x2c')]()[_0x46c8('0x18')](function(){_0x4b65d2[_0x46c8('0x22')](0xcc)[_0x46c8('0x23')]();});}};}function handleEntityNotFound(_0x5b641e,_0x2c809b){return function(_0xedde91){if(!_0xedde91){_0x5b641e[_0x46c8('0x21')](0x194);}return _0xedde91;};}function handleError(_0xa58756,_0x2e1c2f){_0x2e1c2f=_0x2e1c2f||0x1f4;return function(_0x295f00){logger['error'](_0x295f00[_0x46c8('0x2d')]);if(_0x295f00['name']){delete _0x295f00[_0x46c8('0x2e')];}_0xa58756[_0x46c8('0x22')](_0x2e1c2f)[_0x46c8('0x2f')](_0x295f00);};}exports[_0x46c8('0x30')]=function(_0x35870b,_0x2fd4f3){var _0x60b630={},_0x2019db={},_0x5e86c4={'count':0x0,'rows':[]};var _0x3a9fdc=_[_0x46c8('0x31')](db[_0x46c8('0x32')][_0x46c8('0x33')],function(_0x5818aa){return{'name':_0x5818aa[_0x46c8('0x34')],'type':_0x5818aa[_0x46c8('0x35')]['key']};});_0x2019db[_0x46c8('0x36')]=_[_0x46c8('0x31')](_0x3a9fdc,_0x46c8('0x2e'));_0x2019db['query']=_[_0x46c8('0x37')](_0x35870b[_0x46c8('0x38')]);_0x2019db[_0x46c8('0x39')]=_[_0x46c8('0x3a')](_0x2019db[_0x46c8('0x36')],_0x2019db[_0x46c8('0x38')]);_0x60b630[_0x46c8('0x3b')]=_[_0x46c8('0x3a')](_0x2019db[_0x46c8('0x36')],qs['fields'](_0x35870b[_0x46c8('0x38')][_0x46c8('0x3c')]));_0x60b630[_0x46c8('0x3b')]=_0x60b630[_0x46c8('0x3b')][_0x46c8('0x3d')]?_0x60b630[_0x46c8('0x3b')]:_0x2019db[_0x46c8('0x36')];if(!_0x35870b[_0x46c8('0x38')][_0x46c8('0x3e')]('nolimit')){_0x60b630[_0x46c8('0x27')]=qs[_0x46c8('0x27')](_0x35870b['query'][_0x46c8('0x27')]);_0x60b630['offset']=qs[_0x46c8('0x25')](_0x35870b[_0x46c8('0x38')][_0x46c8('0x25')]);}_0x60b630[_0x46c8('0x3f')]=qs[_0x46c8('0x40')](_0x35870b['query'][_0x46c8('0x40')]);_0x60b630['where']=qs[_0x46c8('0x39')](_[_0x46c8('0x41')](_0x35870b[_0x46c8('0x38')],_0x2019db[_0x46c8('0x39')]),_0x3a9fdc);if(_0x35870b['query']['filter']){_0x60b630[_0x46c8('0x42')]=_['merge'](_0x60b630[_0x46c8('0x42')],{'$or':_[_0x46c8('0x31')](_0x3a9fdc,function(_0x4d37bd){if(_0x4d37bd[_0x46c8('0x35')]!==_0x46c8('0x43')){var _0x33d300={};_0x33d300[_0x4d37bd[_0x46c8('0x2e')]]={'$like':'%'+_0x35870b[_0x46c8('0x38')][_0x46c8('0x44')]+'%'};return _0x33d300;}})});}_0x60b630=_['merge']({},_0x60b630,_0x35870b[_0x46c8('0x45')]);var _0x165de7={'where':_0x60b630[_0x46c8('0x42')]};return db[_0x46c8('0x32')][_0x46c8('0x28')](_0x165de7)[_0x46c8('0x18')](function(_0x4a1b89){_0x5e86c4['count']=_0x4a1b89;if(_0x35870b['query'][_0x46c8('0x46')]){_0x60b630['include']=[{'all':!![]}];}return db[_0x46c8('0x32')][_0x46c8('0x47')](_0x60b630);})[_0x46c8('0x18')](function(_0x5d19ed){_0x5e86c4[_0x46c8('0x48')]=_0x5d19ed;return _0x5e86c4;})[_0x46c8('0x18')](respondWithFilteredResult(_0x2fd4f3,_0x60b630))['catch'](handleError(_0x2fd4f3,null));};exports[_0x46c8('0x49')]=function(_0x2f71e2,_0x3a15f4){var _0x344231={'raw':![],'where':{'id':_0x2f71e2[_0x46c8('0x4a')]['id']}},_0x1f66c8={};_0x1f66c8[_0x46c8('0x36')]=_[_0x46c8('0x37')](db[_0x46c8('0x32')][_0x46c8('0x33')]);_0x1f66c8[_0x46c8('0x38')]=_[_0x46c8('0x37')](_0x2f71e2[_0x46c8('0x38')]);_0x1f66c8['filters']=_['intersection'](_0x1f66c8[_0x46c8('0x36')],_0x1f66c8['query']);_0x344231[_0x46c8('0x3b')]=_[_0x46c8('0x3a')](_0x1f66c8['model'],qs[_0x46c8('0x3c')](_0x2f71e2[_0x46c8('0x38')]['fields']));_0x344231[_0x46c8('0x3b')]=_0x344231[_0x46c8('0x3b')]['length']?_0x344231[_0x46c8('0x3b')]:_0x1f66c8[_0x46c8('0x36')];if(_0x2f71e2['query']['includeAll']){_0x344231[_0x46c8('0x4b')]=[{'all':!![]}];}_0x344231=_['merge']({},_0x344231,_0x2f71e2[_0x46c8('0x45')]);return db[_0x46c8('0x32')]['find'](_0x344231)['then'](handleEntityNotFound(_0x3a15f4,null))['then'](respondWithResult(_0x3a15f4,null))[_0x46c8('0x4c')](handleError(_0x3a15f4,null));};exports[_0x46c8('0x4d')]=function(_0x560fee,_0x4a178d){if(_0x560fee[_0x46c8('0x4e')]['id']){delete _0x560fee[_0x46c8('0x4e')]['id'];}return db[_0x46c8('0x32')][_0x46c8('0x4f')]({'where':{'id':_0x560fee[_0x46c8('0x4a')]['id']}})[_0x46c8('0x18')](handleEntityNotFound(_0x4a178d,null))[_0x46c8('0x18')](saveUpdates(_0x560fee[_0x46c8('0x4e')],null))[_0x46c8('0x18')](respondWithResult(_0x4a178d,null))[_0x46c8('0x4c')](handleError(_0x4a178d,null));};exports['addLogo']=function(_0xfac6ca,_0x52405a,_0x48db38){if(_0xfac6ca['file']&&_0xfac6ca[_0x46c8('0x50')][_0x46c8('0x51')]){_0xfac6ca[_0x46c8('0x4e')]['logo']=_0xfac6ca['file'][_0x46c8('0x51')];}return db[_0x46c8('0x32')][_0x46c8('0x4f')]({'where':{'id':_0xfac6ca[_0x46c8('0x4a')]['id']}})[_0x46c8('0x18')](handleEntityNotFound(_0x52405a,null))[_0x46c8('0x18')](saveUpdates(_0xfac6ca[_0x46c8('0x4e')],null))['then'](respondWithResult(_0x52405a,null))[_0x46c8('0x4c')](handleError(_0x52405a,null));};exports[_0x46c8('0x52')]=function(_0x5e7e29,_0x50db40,_0x49eb98){if(_0x5e7e29[_0x46c8('0x50')]&&_0x5e7e29['file']['filename']){_0x5e7e29['body'][_0x46c8('0x53')]=_0x5e7e29[_0x46c8('0x50')][_0x46c8('0x51')];}return db[_0x46c8('0x32')]['find']({'where':{'id':_0x5e7e29[_0x46c8('0x4a')]['id']}})[_0x46c8('0x18')](handleEntityNotFound(_0x50db40,null))['then'](saveUpdates(_0x5e7e29[_0x46c8('0x4e')],null))[_0x46c8('0x18')](respondWithResult(_0x50db40,null))[_0x46c8('0x4c')](handleError(_0x50db40,null));};var utilLicense=require(_0x46c8('0x16'));exports[_0x46c8('0x54')]=function(_0x5e2ffa,_0x27e9a2,_0x4f7de0){var _0x15e2aa='server/files/images/logos';var _0x279aa8={'custom':![]};return utilLicense[_0x46c8('0x55')]()[_0x46c8('0x18')](function(_0x4d8610){if(_0x4d8610){_0x279aa8=_0x4d8610;}return db[_0x46c8('0x32')][_0x46c8('0x4f')]({'where':{'id':_0x5e2ffa[_0x46c8('0x4a')]['id']},'attributes':['logo',_0x46c8('0x53'),_0x46c8('0x56'),_0x46c8('0x57'),_0x46c8('0x58'),_0x46c8('0x59'),_0x46c8('0x5a'),_0x46c8('0x5b')],'raw':!![]});})[_0x46c8('0x18')](handleEntityNotFound(_0x27e9a2,null))['then'](function(_0x39b532){if(_0x39b532){var _0x4a8a00=_0x39b532[_0x46c8('0x5c')]&&fs[_0x46c8('0x5d')](path['join'](config[_0x46c8('0x5e')],_0x15e2aa,_[_0x46c8('0x5f')](_0x39b532[_0x46c8('0x5c')])))?path[_0x46c8('0x60')](config[_0x46c8('0x5e')],_0x15e2aa,_[_0x46c8('0x5f')](_0x39b532[_0x46c8('0x5c')])):path[_0x46c8('0x60')](config[_0x46c8('0x5e')],_0x15e2aa,_['toLower'](_0x46c8('0x61')));var _0x516db3=_0x46c8('0x62')+_[_0x46c8('0x63')](_0x46c8('0x5c'));if(_0x39b532[_0x516db3]||!_0x279aa8['custom']){_0x4a8a00=path[_0x46c8('0x60')](config[_0x46c8('0x5e')],_0x15e2aa,_[_0x46c8('0x5f')](_0x46c8('0x61')));}if(!fs[_0x46c8('0x5d')](_0x4a8a00)){throw new db[(_0x46c8('0x64'))]['ValidationError'](_[_0x46c8('0x63')](_0x46c8('0x5c'))+'\x20not\x20found');}return _0x27e9a2[_0x46c8('0x65')](_0x4a8a00);}})[_0x46c8('0x4c')](handleError(_0x27e9a2,null));};var utilLicense=require(_0x46c8('0x16'));exports[_0x46c8('0x66')]=function(_0x28a874,_0x5c8670,_0x17cff7){var _0x164186=_0x46c8('0x67');var _0x222aea={'custom':![]};return utilLicense[_0x46c8('0x55')]()[_0x46c8('0x18')](function(_0x32f4d6){if(_0x32f4d6){_0x222aea=_0x32f4d6;}return db[_0x46c8('0x32')][_0x46c8('0x4f')]({'where':{'id':_0x28a874['params']['id']},'attributes':[_0x46c8('0x5c'),_0x46c8('0x53'),'preferred',_0x46c8('0x57'),'defaultLogo',_0x46c8('0x59'),_0x46c8('0x5a'),'defaultFavicon'],'raw':!![]});})[_0x46c8('0x18')](handleEntityNotFound(_0x5c8670,null))[_0x46c8('0x18')](function(_0x230972){if(_0x230972){var _0x5150a=_0x230972[_0x46c8('0x53')]&&fs[_0x46c8('0x5d')](path[_0x46c8('0x60')](config[_0x46c8('0x5e')],_0x164186,_[_0x46c8('0x5f')](_0x230972[_0x46c8('0x53')])))?path[_0x46c8('0x60')](config[_0x46c8('0x5e')],_0x164186,_[_0x46c8('0x5f')](_0x230972['loginLogo'])):path[_0x46c8('0x60')](config[_0x46c8('0x5e')],_0x164186,_['toLower'](_0x46c8('0x68')));var _0x5a3a35=_0x46c8('0x62')+_[_0x46c8('0x63')](_0x46c8('0x53'));if(_0x230972[_0x5a3a35]||!_0x222aea[_0x46c8('0x69')]){_0x5150a=path[_0x46c8('0x60')](config['root'],_0x164186,_['toLower'](_0x46c8('0x68')));}if(!fs['existsSync'](_0x5150a)){throw new db['Sequelize'][(_0x46c8('0x6a'))](_[_0x46c8('0x63')](_0x46c8('0x53'))+'\x20not\x20found');}return _0x5c8670[_0x46c8('0x65')](_0x5150a);}})[_0x46c8('0x4c')](handleError(_0x5c8670,null));};exports['gdpr']=function(_0x143a07,_0x5a197f){return db[_0x46c8('0x32')][_0x46c8('0x4f')]({'where':{'id':_0x143a07[_0x46c8('0x4a')]['id']},'attributes':[_0x46c8('0x6b')]})[_0x46c8('0x18')](respondWithResult(_0x5a197f,null))[_0x46c8('0x4c')](handleError(_0x5a197f,null));};exports['addPreferred']=function(_0x42b4dc,_0x328b2f,_0x18442b){if(_0x42b4dc[_0x46c8('0x50')]&&_0x42b4dc['file'][_0x46c8('0x51')]){_0x42b4dc['body']['preferred']=_0x42b4dc[_0x46c8('0x50')][_0x46c8('0x51')];}return db['Setting'][_0x46c8('0x4f')]({'where':{'id':_0x42b4dc[_0x46c8('0x4a')]['id']}})[_0x46c8('0x18')](handleEntityNotFound(_0x328b2f,null))['then'](saveUpdates(_0x42b4dc['body'],null))['then'](respondWithResult(_0x328b2f,null))[_0x46c8('0x4c')](handleError(_0x328b2f,null));};var utilLicense=require(_0x46c8('0x16'));exports[_0x46c8('0x6c')]=function(_0x19ed84,_0x24ff24,_0x5a1162){var _0x122b8c=_0x46c8('0x67');var _0xa0d800={'custom':![]};return utilLicense[_0x46c8('0x55')]()[_0x46c8('0x18')](function(_0x17b17c){if(_0x17b17c){_0xa0d800=_0x17b17c;}return db[_0x46c8('0x32')][_0x46c8('0x4f')]({'where':{'id':_0x19ed84['params']['id']},'attributes':[_0x46c8('0x5c'),_0x46c8('0x53'),_0x46c8('0x56'),_0x46c8('0x57'),_0x46c8('0x58'),_0x46c8('0x59'),_0x46c8('0x5a'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x24ff24,null))[_0x46c8('0x18')](function(_0x4e9603){if(_0x4e9603){var _0x4fb686=_0x4e9603['preferred']&&fs[_0x46c8('0x5d')](path[_0x46c8('0x60')](config[_0x46c8('0x5e')],_0x122b8c,_[_0x46c8('0x5f')](_0x4e9603[_0x46c8('0x56')])))?path[_0x46c8('0x60')](config[_0x46c8('0x5e')],_0x122b8c,_[_0x46c8('0x5f')](_0x4e9603[_0x46c8('0x56')])):path['join'](config[_0x46c8('0x5e')],_0x122b8c,_[_0x46c8('0x5f')](_0x46c8('0x6d')));var _0x445d6f=_0x46c8('0x62')+_[_0x46c8('0x63')](_0x46c8('0x56'));if(_0x4e9603[_0x445d6f]||!_0xa0d800[_0x46c8('0x69')]||!_0xa0d800['preferred']){_0x4fb686=path[_0x46c8('0x60')](config[_0x46c8('0x5e')],_0x122b8c,_[_0x46c8('0x5f')](_0x46c8('0x6d')));}if(!fs['existsSync'](_0x4fb686)){throw new db[(_0x46c8('0x64'))][(_0x46c8('0x6a'))](_[_0x46c8('0x63')](_0x46c8('0x56'))+_0x46c8('0x6e'));}return _0x24ff24['download'](_0x4fb686);}})[_0x46c8('0x4c')](handleError(_0x24ff24,null));};exports[_0x46c8('0x6f')]=function(_0x74be8f,_0x3ad8e3,_0xd4fbc8){if(_0x74be8f[_0x46c8('0x50')]&&_0x74be8f['file']['filename']){_0x74be8f[_0x46c8('0x4e')][_0x46c8('0x57')]=_0x74be8f[_0x46c8('0x50')][_0x46c8('0x51')];}return db[_0x46c8('0x32')][_0x46c8('0x4f')]({'where':{'id':_0x74be8f[_0x46c8('0x4a')]['id']}})[_0x46c8('0x18')](handleEntityNotFound(_0x3ad8e3,null))['then'](saveUpdates(_0x74be8f[_0x46c8('0x4e')],null))[_0x46c8('0x18')](respondWithResult(_0x3ad8e3,null))[_0x46c8('0x4c')](handleError(_0x3ad8e3,null));};var utilLicense=require(_0x46c8('0x16'));exports['getFavicon']=function(_0x2d76f3,_0x5ed0cf,_0xe38ece){var _0x1a0484=_0x46c8('0x67');var _0x4c1312={'custom':![]};return utilLicense[_0x46c8('0x55')]()['then'](function(_0x3a54bd){if(_0x3a54bd){_0x4c1312=_0x3a54bd;}return db[_0x46c8('0x32')][_0x46c8('0x4f')]({'where':{'id':_0x2d76f3[_0x46c8('0x4a')]['id']},'attributes':[_0x46c8('0x5c'),'loginLogo',_0x46c8('0x56'),'favicon','defaultLogo','defaultLoginLogo',_0x46c8('0x5a'),'defaultFavicon'],'raw':!![]});})[_0x46c8('0x18')](handleEntityNotFound(_0x5ed0cf,null))[_0x46c8('0x18')](function(_0x25c306){if(_0x25c306){var _0x336740=_0x25c306[_0x46c8('0x57')]&&fs[_0x46c8('0x5d')](path[_0x46c8('0x60')](config[_0x46c8('0x5e')],_0x1a0484,_['toLower'](_0x25c306[_0x46c8('0x57')])))?path['join'](config['root'],_0x1a0484,_[_0x46c8('0x5f')](_0x25c306[_0x46c8('0x57')])):path[_0x46c8('0x60')](config[_0x46c8('0x5e')],_0x1a0484,_['toLower'](_0x46c8('0x70')));var _0x560bb0='default'+_[_0x46c8('0x63')](_0x46c8('0x57'));if(_0x25c306[_0x560bb0]||!_0x4c1312[_0x46c8('0x69')]){_0x336740=path['join'](config['root'],_0x1a0484,_[_0x46c8('0x5f')](_0x46c8('0x70')));}if(!fs[_0x46c8('0x5d')](_0x336740)){throw new db[(_0x46c8('0x64'))]['ValidationError'](_[_0x46c8('0x63')](_0x46c8('0x57'))+'\x20not\x20found');}return _0x5ed0cf[_0x46c8('0x65')](_0x336740);}})['catch'](handleError(_0x5ed0cf,null));};exports[_0x46c8('0x71')]=function(_0x15ffed,_0x2ad40d){var _0x36b994={'offset':moment()[_0x46c8('0x72')]()};_0x36b994[_0x46c8('0x73')]=moment()[_0x46c8('0x72')](_0x36b994[_0x46c8('0x25')])[_0x46c8('0x74')](_0x46c8('0x75'));return _0x2ad40d[_0x46c8('0x22')](0xc8)[_0x46c8('0x2f')](_0x36b994);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index e279342..d13b142 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 _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0xb9d7be,_0x277001){var _0x21e31d=function(_0x15f53e){while(--_0x15f53e){_0xb9d7be['push'](_0xb9d7be['shift']());}};_0x21e31d(++_0x277001);}(_0xe14b,0x93));var _0xbe14=function(_0x488304,_0x5b5b0e){_0x488304=_0x488304-0x0;var _0x51f958=_0xe14b[_0x488304];return _0x51f958;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0x7217,0x19e));var _0x7721=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x7217[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 08bfa09..4622519 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 _0x49d5=['ioredis','../../config/utils','../../config/logger','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSetting','Setting','find','options','where','attributes','include','model','then','util','bluebird'];(function(_0x1156ad,_0x45f26d){var _0x49b797=function(_0x20a91a){while(--_0x20a91a){_0x1156ad['push'](_0x1156ad['shift']());}};_0x49b797(++_0x45f26d);}(_0x49d5,0x1f2));var _0x549d=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x49d5[_0xf50820];return _0x2a9b10;};'use strict';var _=require('lodash');var util=require(_0x549d('0x0'));var moment=require('moment');var BPromise=require(_0x549d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x549d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x549d('0x3'));var logger=require(_0x549d('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x24d7a6,_0x97cb8c,_0x5f3234){return new BPromise(function(_0x565626,_0x530499){return client[_0x549d('0x5')](_0x24d7a6,_0x5f3234)['then'](function(_0x5e7841){logger[_0x549d('0x6')](_0x549d('0x7'),_0x97cb8c,_0x549d('0x8'));logger[_0x549d('0x9')](_0x549d('0xa'),_0x97cb8c,_0x549d('0x8'),JSON[_0x549d('0xb')](_0x5e7841));if(_0x5e7841[_0x549d('0xc')]){if(_0x5e7841[_0x549d('0xc')]['code']===0x1f4){logger[_0x549d('0xc')](_0x549d('0x7'),_0x97cb8c,_0x5e7841[_0x549d('0xc')][_0x549d('0xd')]);return _0x530499(_0x5e7841[_0x549d('0xc')][_0x549d('0xd')]);}logger[_0x549d('0xc')](_0x549d('0x7'),_0x97cb8c,_0x5e7841[_0x549d('0xc')][_0x549d('0xd')]);return _0x565626(_0x5e7841['error']['message']);}else{logger[_0x549d('0x6')](_0x549d('0x7'),_0x97cb8c,'request\x20sent');_0x565626(_0x5e7841[_0x549d('0xe')][_0x549d('0xd')]);}})[_0x549d('0xf')](function(_0x21b880){logger[_0x549d('0xc')](_0x549d('0x7'),_0x97cb8c,_0x21b880);_0x530499(_0x21b880);});});}exports[_0x549d('0x10')]=function(_0x232596){var _0x5ca0eb=this;return new Promise(function(_0x5c93bf,_0x1261d1){return db[_0x549d('0x11')][_0x549d('0x12')]({'raw':_0x232596[_0x549d('0x13')]?_0x232596['options']['raw']===undefined?!![]:![]:!![],'where':_0x232596[_0x549d('0x13')]?_0x232596[_0x549d('0x13')][_0x549d('0x14')]||null:null,'attributes':_0x232596['options']?_0x232596[_0x549d('0x13')][_0x549d('0x15')]||null:null,'include':_0x232596[_0x549d('0x13')]?_0x232596[_0x549d('0x13')][_0x549d('0x16')]?_['map'](_0x232596[_0x549d('0x13')][_0x549d('0x16')],function(_0x5985c4){return{'model':db[_0x5985c4[_0x549d('0x17')]],'as':_0x5985c4['as'],'attributes':_0x5985c4['attributes'],'include':_0x5985c4[_0x549d('0x16')]?_['map'](_0x5985c4[_0x549d('0x16')],function(_0x2a3495){return{'model':db[_0x2a3495[_0x549d('0x17')]],'as':_0x2a3495['as'],'attributes':_0x2a3495[_0x549d('0x15')],'include':_0x2a3495[_0x549d('0x16')]?_['map'](_0x2a3495[_0x549d('0x16')],function(_0x45ec57){return{'model':db[_0x45ec57[_0x549d('0x17')]],'as':_0x45ec57['as'],'attributes':_0x45ec57[_0x549d('0x15')]};}):[]};}):[]};}):[]:[]})[_0x549d('0x18')](function(_0x319936){logger[_0x549d('0x6')]('ShowSetting',_0x232596);logger['debug'](_0x549d('0x10'),_0x232596,JSON[_0x549d('0xb')](_0x319936));_0x5c93bf(_0x319936);})[_0x549d('0xf')](function(_0x39107a){logger[_0x549d('0xc')]('ShowSetting',_0x39107a['message'],_0x232596);_0x1261d1(_0x5ca0eb['error'](0x1f4,_0x39107a[_0x549d('0xd')]));});});}; \ No newline at end of file +var _0x026f=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Setting','find','options','where','attributes','include','map','model','ShowSetting','lodash','util','bluebird','randomstring'];(function(_0x47c6b9,_0x210b3c){var _0x34f34d=function(_0x47c336){while(--_0x47c336){_0x47c6b9['push'](_0x47c6b9['shift']());}};_0x34f34d(++_0x210b3c);}(_0x026f,0x1cd));var _0xf026=function(_0xdab2d9,_0x45243e){_0xdab2d9=_0xdab2d9-0x0;var _0x144136=_0x026f[_0xdab2d9];return _0x144136;};'use strict';var _=require(_0xf026('0x0'));var util=require(_0xf026('0x1'));var moment=require('moment');var BPromise=require(_0xf026('0x2'));var rs=require(_0xf026('0x3'));var fs=require('fs');var Redis=require(_0xf026('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf026('0x5'));var logger=require(_0xf026('0x6'))(_0xf026('0x7'));var config=require('../../config/environment');var jayson=require(_0xf026('0x8'));var client=jayson[_0xf026('0x9')][_0xf026('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b3a86,_0x2445be,_0x2a1137){return new BPromise(function(_0x3ad0de,_0xde489c){return client['request'](_0x1b3a86,_0x2a1137)[_0xf026('0xb')](function(_0x51526b){logger[_0xf026('0xc')](_0xf026('0xd'),_0x2445be,_0xf026('0xe'));logger[_0xf026('0xf')](_0xf026('0x10'),_0x2445be,_0xf026('0xe'),JSON[_0xf026('0x11')](_0x51526b));if(_0x51526b[_0xf026('0x12')]){if(_0x51526b[_0xf026('0x12')][_0xf026('0x13')]===0x1f4){logger[_0xf026('0x12')](_0xf026('0xd'),_0x2445be,_0x51526b[_0xf026('0x12')][_0xf026('0x14')]);return _0xde489c(_0x51526b['error'][_0xf026('0x14')]);}logger[_0xf026('0x12')]('Setting,\x20%s,\x20%s',_0x2445be,_0x51526b['error'][_0xf026('0x14')]);return _0x3ad0de(_0x51526b[_0xf026('0x12')][_0xf026('0x14')]);}else{logger['info'](_0xf026('0xd'),_0x2445be,'request\x20sent');_0x3ad0de(_0x51526b['result']['message']);}})[_0xf026('0x15')](function(_0x59419f){logger[_0xf026('0x12')](_0xf026('0xd'),_0x2445be,_0x59419f);_0xde489c(_0x59419f);});});}exports['ShowSetting']=function(_0x2d953c){var _0x23ba02=this;return new Promise(function(_0x4ef498,_0x3d5d30){return db[_0xf026('0x16')][_0xf026('0x17')]({'raw':_0x2d953c[_0xf026('0x18')]?_0x2d953c[_0xf026('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2d953c[_0xf026('0x18')]?_0x2d953c[_0xf026('0x18')][_0xf026('0x19')]||null:null,'attributes':_0x2d953c['options']?_0x2d953c[_0xf026('0x18')][_0xf026('0x1a')]||null:null,'include':_0x2d953c['options']?_0x2d953c[_0xf026('0x18')][_0xf026('0x1b')]?_[_0xf026('0x1c')](_0x2d953c[_0xf026('0x18')][_0xf026('0x1b')],function(_0x2b1160){return{'model':db[_0x2b1160[_0xf026('0x1d')]],'as':_0x2b1160['as'],'attributes':_0x2b1160[_0xf026('0x1a')],'include':_0x2b1160[_0xf026('0x1b')]?_[_0xf026('0x1c')](_0x2b1160[_0xf026('0x1b')],function(_0x42a294){return{'model':db[_0x42a294[_0xf026('0x1d')]],'as':_0x42a294['as'],'attributes':_0x42a294[_0xf026('0x1a')],'include':_0x42a294['include']?_[_0xf026('0x1c')](_0x42a294['include'],function(_0x59b5c7){return{'model':db[_0x59b5c7['model']],'as':_0x59b5c7['as'],'attributes':_0x59b5c7[_0xf026('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf026('0xb')](function(_0xf840e6){logger[_0xf026('0xc')]('ShowSetting',_0x2d953c);logger['debug']('ShowSetting',_0x2d953c,JSON['stringify'](_0xf840e6));_0x4ef498(_0xf840e6);})[_0xf026('0x15')](function(_0x3d5f6d){logger[_0xf026('0x12')](_0xf026('0x1e'),_0x3d5f6d[_0xf026('0x14')],_0x2d953c);_0x3d5d30(_0x23ba02[_0xf026('0x12')](0x1f4,_0x3d5f6d[_0xf026('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index da05b30..b324b77 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(_0xa7c05d,_0x312374){var _0x47b002=function(_0x44aa2f){while(--_0x44aa2f){_0xa7c05d['push'](_0xa7c05d['shift']());}};_0x47b002(++_0x312374);}(_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',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(_0x1a3e33,_0xe419f4){var _0x545085=function(_0x563f55){while(--_0x563f55){_0x1a3e33['push'](_0x1a3e33['shift']());}};_0x545085(++_0xe419f4);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 2db1441..26d4628 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 _0xb628=['ENUM','skebby','clickatell','csc','infobip','intelepeer','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','mandatoryDisposition','sequelize','STRING','name','generate'];(function(_0x53b3b6,_0x80af30){var _0x1950dd=function(_0x4d1c07){while(--_0x4d1c07){_0x53b3b6['push'](_0x53b3b6['shift']());}};_0x1950dd(++_0x80af30);}(_0xb628,0x12e));var _0x8b62=function(_0x5b8fe0,_0x55e2bc){_0x5b8fe0=_0x5b8fe0-0x0;var _0x5f80a2=_0xb628[_0x5b8fe0];return _0x5f80a2;};'use strict';var Sequelize=require(_0x8b62('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x8b62('0x1')],'unique':_0x8b62('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x8b62('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x8b62('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x8b62('0x1')],'defaultValue':function(){return rs[_0x8b62('0x3')]();}},'phone':{'type':Sequelize[_0x8b62('0x1')]},'type':{'type':Sequelize[_0x8b62('0x4')]('twilio',_0x8b62('0x5'),'connectel','clicksend','plivo',_0x8b62('0x6'),'bandwidth',_0x8b62('0x7'),_0x8b62('0x8'),_0x8b62('0x9'))},'accountSid':{'type':Sequelize[_0x8b62('0x1')]},'authId':{'type':Sequelize[_0x8b62('0x1')]},'authToken':{'type':Sequelize[_0x8b62('0x1')]},'smsMethod':{'type':Sequelize[_0x8b62('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x8b62('0x1')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x8b62('0x1')]},'senderString':{'type':Sequelize[_0x8b62('0x1')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x8b62('0xa')],'defaultValue':function(){return _0x8b62('0xb');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8b62('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8b62('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8b62('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8b62('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8b62('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8b62('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8b62('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x8b62('0xc')],'defaultValue':![],'comment':_0x8b62('0xe'),'set':function(_0x5b901b){if(!_0x5b901b)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x8b62('0xf')](_0x8b62('0x10'),_0x5b901b);}}}; \ No newline at end of file +var _0xdef5=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x4eff38,_0x5b649d){var _0x482103=function(_0x1cc9c2){while(--_0x1cc9c2){_0x4eff38['push'](_0x4eff38['shift']());}};_0x482103(++_0x5b649d);}(_0xdef5,0x18c));var _0x5def=function(_0x395a4e,_0x4160c3){_0x395a4e=_0x395a4e-0x0;var _0x21f8bf=_0xdef5[_0x395a4e];return _0x21f8bf;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x5def('0x0'));module[_0x5def('0x1')]={'name':{'type':Sequelize[_0x5def('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x5def('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x5def('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x5def('0x2')],'defaultValue':function(){return rs[_0x5def('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5def('0x4')](_0x5def('0x5'),_0x5def('0x6'),_0x5def('0x7'),_0x5def('0x8'),_0x5def('0x9'),_0x5def('0xa'),_0x5def('0xb'),'csc',_0x5def('0xc'),_0x5def('0xd'))},'accountSid':{'type':Sequelize[_0x5def('0x2')]},'authId':{'type':Sequelize[_0x5def('0x2')]},'authToken':{'type':Sequelize[_0x5def('0x2')]},'smsMethod':{'type':Sequelize[_0x5def('0x4')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x5def('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x5def('0x2')]},'accountId':{'type':Sequelize[_0x5def('0x2')]},'senderString':{'type':Sequelize[_0x5def('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x5def('0x2')]},'notificationTemplate':{'type':Sequelize[_0x5def('0xe')],'defaultValue':function(){return _0x5def('0xf');}},'notificationSound':{'type':Sequelize[_0x5def('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5def('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5def('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5def('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x5def('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5def('0x11')],'comment':_0x5def('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x5def('0x10')],'defaultValue':![],'comment':_0x5def('0x13'),'set':function(_0x2cef4e){if(!_0x2cef4e)this[_0x5def('0x14')](_0x5def('0x15'),null);this[_0x5def('0x14')](_0x5def('0x16'),_0x2cef4e);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index c6e68da..e2c0c9f 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 _0xa8d7=['result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','SmsAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','SmsAccount','fieldName','type','map','keys','filters','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','filter','include','findAll','rows','show','params','rawAttributes','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','sort','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','priority','asc','ValidationError','difference','updatedAt','createdAt','CompanyId','mobile','twilio','from','From','Body','MessageSid','connectel','clicksend','message_id','messageId','MessageUUID','infobip','results','text','originatingAddress','segmentedMessage','fromNumber','bandwidth','intelepeer','isNil','Sequelize','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','CmContact','DESC','list','omit','Contacts','defaults','SmsInteraction','spread','interaction','push','unmanaged','*,*,*,*','created','ContactId','AttachmentId','UserId','User','waitForTheAssignedAgent','queueId','unshift','queue','waitForTheAssignedQueue','Start','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','order','getInteractions','Contact','Owner','fullname','Tag','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','skebby','statusInt','requestid','status_code','groupName','clickatell','redif','DELIVERED','error_code','inspect','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','statusGet','csc','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0xa8d7,0xbc));var _0x7a8d=function(_0x308374,_0x550e85){_0x308374=_0x308374-0x0;var _0x1f71e0=_0xa8d7[_0x308374];return _0x1f71e0;};'use strict';var emlformat=require(_0x7a8d('0x0'));var rimraf=require(_0x7a8d('0x1'));var zipdir=require(_0x7a8d('0x2'));var jsonpatch=require(_0x7a8d('0x3'));var rp=require(_0x7a8d('0x4'));var moment=require(_0x7a8d('0x5'));var BPromise=require(_0x7a8d('0x6'));var Mustache=require(_0x7a8d('0x7'));var util=require(_0x7a8d('0x8'));var path=require('path');var sox=require(_0x7a8d('0x9'));var csv=require(_0x7a8d('0xa'));var ejs=require(_0x7a8d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a8d('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7a8d('0xd'));var deskjs=require(_0x7a8d('0xe'));var toCsv=require(_0x7a8d('0xa'));var querystring=require(_0x7a8d('0xf'));var Papa=require(_0x7a8d('0x10'));var Redis=require('ioredis');var authService=require(_0x7a8d('0x11'));var qs=require(_0x7a8d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a8d('0x13'));var logger=require(_0x7a8d('0x14'))(_0x7a8d('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7a8d('0x16'));var db=require('../../mysqldb')['db'];config[_0x7a8d('0x17')]=_['defaults'](config[_0x7a8d('0x17')],{'host':_0x7a8d('0x18'),'port':0x18eb});var socket=require(_0x7a8d('0x19'))(new Redis(config['redis']));require(_0x7a8d('0x1a'))[_0x7a8d('0x1b')](socket);var jayson=require(_0x7a8d('0x1c'));var client=jayson[_0x7a8d('0x1d')][_0x7a8d('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x373372,_0x3eb597,_0x560be1,_0x1a1f40){return new BPromise(function(_0x1d1239,_0xb67a33){var _0x701479=_0x1a1f40||client;return _0x701479['request'](_0x373372,_0x560be1)[_0x7a8d('0x1f')](function(_0x5b73a1){logger['info'](_0x7a8d('0x20'),_0x3eb597,_0x7a8d('0x21'));logger['debug'](_0x7a8d('0x22'),_0x3eb597,_0x7a8d('0x21'),JSON[_0x7a8d('0x23')](_0x5b73a1));if(_0x5b73a1[_0x7a8d('0x24')]){if(_0x5b73a1['error'][_0x7a8d('0x25')]===0x1f4){logger['error'](_0x7a8d('0x20'),_0x3eb597,_0x5b73a1['error'][_0x7a8d('0x26')]);return _0xb67a33(_0x5b73a1[_0x7a8d('0x24')]['message']);}logger[_0x7a8d('0x24')](_0x7a8d('0x20'),_0x3eb597,_0x5b73a1[_0x7a8d('0x24')]['message']);return _0x1d1239(_0x5b73a1[_0x7a8d('0x24')][_0x7a8d('0x26')]);}else{logger[_0x7a8d('0x27')](_0x7a8d('0x20'),_0x3eb597,_0x7a8d('0x21'));_0x1d1239(_0x5b73a1[_0x7a8d('0x28')][_0x7a8d('0x26')]);}})[_0x7a8d('0x29')](function(_0x18f062){logger[_0x7a8d('0x24')](_0x7a8d('0x20'),_0x3eb597,_0x18f062);_0xb67a33(_0x18f062);});});}function respondWithStatusCode(_0x5b1d16,_0x29bcbd){_0x29bcbd=_0x29bcbd||0xcc;return function(_0x11702c){if(_0x11702c){return _0x5b1d16[_0x7a8d('0x2a')](_0x29bcbd);}return _0x5b1d16[_0x7a8d('0x2b')](_0x29bcbd)[_0x7a8d('0x2c')]();};}function respondWithResult(_0x2c7829,_0x4f01d9){_0x4f01d9=_0x4f01d9||0xc8;return function(_0x485ef8){if(_0x485ef8){return _0x2c7829[_0x7a8d('0x2b')](_0x4f01d9)[_0x7a8d('0x2d')](_0x485ef8);}};}function respondWithFilteredResult(_0x3cf8d7,_0x103a01){return function(_0x5d83ce){if(_0x5d83ce){var _0x366ef2=typeof _0x103a01[_0x7a8d('0x2e')]===_0x7a8d('0x2f')&&typeof _0x103a01[_0x7a8d('0x30')]===_0x7a8d('0x2f');var _0x2ce00e=_0x5d83ce['count'];var _0x5549aa=_0x366ef2?0x0:_0x103a01[_0x7a8d('0x2e')];var _0x537983=_0x366ef2?_0x5d83ce[_0x7a8d('0x31')]:_0x103a01[_0x7a8d('0x2e')]+_0x103a01[_0x7a8d('0x30')];var _0xa46479;if(_0x537983>=_0x2ce00e){_0x537983=_0x2ce00e;_0xa46479=0xc8;}else{_0xa46479=0xce;}_0x3cf8d7[_0x7a8d('0x2b')](_0xa46479);return _0x3cf8d7[_0x7a8d('0x32')](_0x7a8d('0x33'),_0x5549aa+'-'+_0x537983+'/'+_0x2ce00e)[_0x7a8d('0x2d')](_0x5d83ce);}return null;};}function patchUpdates(_0x1cebc2){return function(_0x5bd0aa){try{jsonpatch[_0x7a8d('0x34')](_0x5bd0aa,_0x1cebc2,!![]);}catch(_0x1f9b3a){return BPromise[_0x7a8d('0x35')](_0x1f9b3a);}return _0x5bd0aa[_0x7a8d('0x36')]();};}function saveUpdates(_0x415685,_0x2ddcf6){return function(_0x500eff){if(_0x500eff){return _0x500eff[_0x7a8d('0x37')](_0x415685)['then'](function(_0x43e680){return _0x43e680;});}return null;};}function removeEntity(_0x4b7acf,_0xa9a1db){return function(_0x3da257){if(_0x3da257){return _0x3da257['destroy']()[_0x7a8d('0x1f')](function(){var _0x2a0392=_0x3da257[_0x7a8d('0x38')]({'plain':!![]});var _0x4b458f=_0x7a8d('0x39');return db[_0x7a8d('0x3a')][_0x7a8d('0x3b')]({'where':{'type':_0x4b458f,'resourceId':_0x2a0392['id']}})[_0x7a8d('0x1f')](function(){return _0x3da257;});})[_0x7a8d('0x1f')](function(){_0x4b7acf[_0x7a8d('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f1261,_0x41107d){return function(_0x2a20ea){if(!_0x2a20ea){_0x5f1261[_0x7a8d('0x2a')](0x194);}return _0x2a20ea;};}function handleError(_0x2ea4b9,_0x59458d){_0x59458d=_0x59458d||0x1f4;return function(_0x3e6933){logger[_0x7a8d('0x24')](_0x3e6933[_0x7a8d('0x3c')]);if(_0x3e6933[_0x7a8d('0x3d')]){delete _0x3e6933[_0x7a8d('0x3d')];}_0x2ea4b9[_0x7a8d('0x2b')](_0x59458d)[_0x7a8d('0x3e')](_0x3e6933);};}exports[_0x7a8d('0x3f')]=function(_0x15919b,_0x48d426){var _0x28929b={'include':[{'model':db[_0x7a8d('0x40')],'as':_0x7a8d('0x41')}]},_0xe57f98={},_0x22f4ec={'count':0x0,'rows':[]};var _0x364f1b=_['map'](db[_0x7a8d('0x42')]['rawAttributes'],function(_0x1357d6){return{'name':_0x1357d6[_0x7a8d('0x43')],'type':_0x1357d6[_0x7a8d('0x44')]['key']};});_0xe57f98['model']=_[_0x7a8d('0x45')](_0x364f1b,_0x7a8d('0x3d'));_0xe57f98['query']=_[_0x7a8d('0x46')](_0x15919b['query']);_0xe57f98[_0x7a8d('0x47')]=_[_0x7a8d('0x48')](_0xe57f98[_0x7a8d('0x49')],_0xe57f98['query']);_0x28929b[_0x7a8d('0x4a')]=_[_0x7a8d('0x48')](_0xe57f98[_0x7a8d('0x49')],qs[_0x7a8d('0x4b')](_0x15919b[_0x7a8d('0x4c')][_0x7a8d('0x4b')]));_0x28929b[_0x7a8d('0x4a')]=_0x28929b[_0x7a8d('0x4a')][_0x7a8d('0x4d')]?_0x28929b[_0x7a8d('0x4a')]:_0xe57f98[_0x7a8d('0x49')];if(!_0x15919b[_0x7a8d('0x4c')][_0x7a8d('0x4e')](_0x7a8d('0x4f'))){_0x28929b[_0x7a8d('0x30')]=qs['limit'](_0x15919b[_0x7a8d('0x4c')][_0x7a8d('0x30')]);_0x28929b[_0x7a8d('0x2e')]=qs[_0x7a8d('0x2e')](_0x15919b['query'][_0x7a8d('0x2e')]);}_0x28929b['order']=qs['sort'](_0x15919b['query']['sort']);_0x28929b[_0x7a8d('0x50')]=qs['filters'](_[_0x7a8d('0x51')](_0x15919b[_0x7a8d('0x4c')],_0xe57f98['filters']),_0x364f1b);if(_0x15919b['query']['filter']){_0x28929b[_0x7a8d('0x50')]=_[_0x7a8d('0x52')](_0x28929b[_0x7a8d('0x50')],{'$or':_['map'](_0x364f1b,function(_0xc89139){if(_0xc89139[_0x7a8d('0x44')]!==_0x7a8d('0x53')){var _0xd7902e={};_0xd7902e[_0xc89139[_0x7a8d('0x3d')]]={'$like':'%'+_0x15919b['query'][_0x7a8d('0x54')]+'%'};return _0xd7902e;}})});}_0x28929b=_[_0x7a8d('0x52')]({},_0x28929b,_0x15919b['options']);var _0x364bca={'where':_0x28929b[_0x7a8d('0x50')]};return db[_0x7a8d('0x42')][_0x7a8d('0x31')](_0x364bca)['then'](function(_0x1de8ca){_0x22f4ec[_0x7a8d('0x31')]=_0x1de8ca;if(_0x15919b[_0x7a8d('0x4c')]['includeAll']){_0x28929b[_0x7a8d('0x55')]=[{'all':!![]}];}return db['SmsAccount'][_0x7a8d('0x56')](_0x28929b);})['then'](function(_0x169ba4){_0x22f4ec[_0x7a8d('0x57')]=_0x169ba4;return _0x22f4ec;})['then'](respondWithFilteredResult(_0x48d426,_0x28929b))[_0x7a8d('0x29')](handleError(_0x48d426,null));};exports[_0x7a8d('0x58')]=function(_0x54f134,_0x11654e){var _0x1a8448={'raw':![],'where':{'id':_0x54f134[_0x7a8d('0x59')]['id']},'include':[{'model':db[_0x7a8d('0x40')],'as':_0x7a8d('0x41')}]},_0x3b707f={};_0x3b707f[_0x7a8d('0x49')]=_[_0x7a8d('0x46')](db[_0x7a8d('0x42')][_0x7a8d('0x5a')]);_0x3b707f[_0x7a8d('0x4c')]=_[_0x7a8d('0x46')](_0x54f134[_0x7a8d('0x4c')]);_0x3b707f[_0x7a8d('0x47')]=_['intersection'](_0x3b707f[_0x7a8d('0x49')],_0x3b707f[_0x7a8d('0x4c')]);_0x1a8448['attributes']=_['intersection'](_0x3b707f[_0x7a8d('0x49')],qs[_0x7a8d('0x4b')](_0x54f134[_0x7a8d('0x4c')][_0x7a8d('0x4b')]));_0x1a8448[_0x7a8d('0x4a')]=_0x1a8448['attributes'][_0x7a8d('0x4d')]?_0x1a8448[_0x7a8d('0x4a')]:_0x3b707f[_0x7a8d('0x49')];if(_0x54f134[_0x7a8d('0x4c')][_0x7a8d('0x5b')]){_0x1a8448[_0x7a8d('0x55')]=[{'all':!![]}];}_0x1a8448=_[_0x7a8d('0x52')]({},_0x1a8448,_0x54f134[_0x7a8d('0x5c')]);return db['SmsAccount'][_0x7a8d('0x5d')](_0x1a8448)[_0x7a8d('0x1f')](handleEntityNotFound(_0x11654e,null))[_0x7a8d('0x1f')](respondWithResult(_0x11654e,null))[_0x7a8d('0x29')](handleError(_0x11654e,null));};exports[_0x7a8d('0x5e')]=function(_0x17a47f,_0x3f4f07){return db[_0x7a8d('0x42')][_0x7a8d('0x5e')](_0x17a47f[_0x7a8d('0x5f')],{})[_0x7a8d('0x1f')](function(_0x3f861b){var _0x161b04=_0x17a47f[_0x7a8d('0x60')][_0x7a8d('0x38')]({'plain':!![]});if(!_0x161b04)throw new Error(_0x7a8d('0x61'));if(_0x161b04[_0x7a8d('0x62')]==='user'){var _0x55ceba=_0x3f861b[_0x7a8d('0x38')]({'plain':!![]});var _0x2782b5=_0x7a8d('0x39');return db['UserProfileSection']['find']({'where':{'name':_0x2782b5,'userProfileId':_0x161b04['userProfileId']},'raw':!![]})[_0x7a8d('0x1f')](function(_0x124f39){if(_0x124f39&&_0x124f39[_0x7a8d('0x63')]===0x0){return db[_0x7a8d('0x3a')][_0x7a8d('0x5e')]({'name':_0x55ceba['name'],'resourceId':_0x55ceba['id'],'type':_0x124f39['name'],'sectionId':_0x124f39['id']},{})[_0x7a8d('0x1f')](function(){return _0x3f861b;});}else{return _0x3f861b;}})[_0x7a8d('0x29')](function(_0x418a0c){logger['error'](_0x7a8d('0x64'),_0x418a0c);throw _0x418a0c;});}return _0x3f861b;})[_0x7a8d('0x1f')](respondWithResult(_0x3f4f07,0xc9))[_0x7a8d('0x29')](handleError(_0x3f4f07,null));};exports['update']=function(_0x563fd0,_0x33e4e7){if(_0x563fd0['body']['id']){delete _0x563fd0[_0x7a8d('0x5f')]['id'];}return db[_0x7a8d('0x42')][_0x7a8d('0x5d')]({'where':{'id':_0x563fd0[_0x7a8d('0x59')]['id']},'include':[{'model':db[_0x7a8d('0x40')],'as':_0x7a8d('0x41')}]})['then'](handleEntityNotFound(_0x33e4e7,null))[_0x7a8d('0x1f')](saveUpdates(_0x563fd0['body'],null))[_0x7a8d('0x1f')](respondWithResult(_0x33e4e7,null))['catch'](handleError(_0x33e4e7,null));};exports[_0x7a8d('0x3b')]=function(_0x22d05a,_0x29ea79){return db[_0x7a8d('0x42')]['find']({'where':{'id':_0x22d05a[_0x7a8d('0x59')]['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x29ea79,null))[_0x7a8d('0x1f')](removeEntity(_0x29ea79,null))[_0x7a8d('0x29')](handleError(_0x29ea79,null));};exports[_0x7a8d('0x65')]=function(_0x2eb0c0,_0x1583c8){return db['SmsAccount']['describe']()[_0x7a8d('0x1f')](respondWithResult(_0x1583c8,null))[_0x7a8d('0x29')](handleError(_0x1583c8,null));};exports[_0x7a8d('0x66')]=function(_0xdd31de,_0x2a6e66,_0x193121){if(_0xdd31de['body']['id']){delete _0xdd31de['body']['id'];}return db[_0x7a8d('0x42')][_0x7a8d('0x5d')]({'where':{'id':_0xdd31de[_0x7a8d('0x59')]['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x2a6e66,null))[_0x7a8d('0x1f')](function(_0x416e22){if(_0x416e22){_0xdd31de[_0x7a8d('0x5f')][_0x7a8d('0x67')]=_0x416e22['id'];return db[_0x7a8d('0x68')][_0x7a8d('0x5e')](_0xdd31de[_0x7a8d('0x5f')]);}})[_0x7a8d('0x1f')](respondWithResult(_0x2a6e66,null))[_0x7a8d('0x29')](handleError(_0x2a6e66,null));};exports[_0x7a8d('0x69')]=function(_0x2f4987,_0x4d9680,_0x5b04cc){var _0x58b765={'raw':![],'where':{}};var _0x434e11={};var _0x1f3c13={'count':0x0,'rows':[]};return db[_0x7a8d('0x42')]['findOne']({'where':{'id':_0x2f4987['params']['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x4d9680,null))[_0x7a8d('0x1f')](function(_0x511b1f){if(_0x511b1f){_0x434e11['model']=_[_0x7a8d('0x46')](db[_0x7a8d('0x68')][_0x7a8d('0x5a')]);_0x434e11[_0x7a8d('0x4c')]=_[_0x7a8d('0x46')](_0x2f4987[_0x7a8d('0x4c')]);_0x434e11[_0x7a8d('0x47')]=_['intersection'](_0x434e11[_0x7a8d('0x49')],_0x434e11[_0x7a8d('0x4c')]);_0x58b765[_0x7a8d('0x4a')]=_[_0x7a8d('0x48')](_0x434e11[_0x7a8d('0x49')],qs['fields'](_0x2f4987[_0x7a8d('0x4c')][_0x7a8d('0x4b')]));_0x58b765[_0x7a8d('0x4a')]=_0x58b765[_0x7a8d('0x4a')][_0x7a8d('0x4d')]?_0x58b765[_0x7a8d('0x4a')]:_0x434e11[_0x7a8d('0x49')];if(!_0x2f4987['query']['hasOwnProperty'](_0x7a8d('0x4f'))){_0x58b765[_0x7a8d('0x30')]=qs[_0x7a8d('0x30')](_0x2f4987[_0x7a8d('0x4c')][_0x7a8d('0x30')]);_0x58b765[_0x7a8d('0x2e')]=qs[_0x7a8d('0x2e')](_0x2f4987[_0x7a8d('0x4c')][_0x7a8d('0x2e')]);}_0x58b765['order']=qs[_0x7a8d('0x6a')](_0x2f4987[_0x7a8d('0x4c')][_0x7a8d('0x6a')]);_0x58b765[_0x7a8d('0x50')]=qs[_0x7a8d('0x47')](_['pick'](_0x2f4987[_0x7a8d('0x4c')],_0x434e11[_0x7a8d('0x47')]));_0x58b765[_0x7a8d('0x50')][_0x7a8d('0x67')]=_0x511b1f['id'];if(_0x2f4987['query']['filter']){_0x58b765[_0x7a8d('0x50')]=_[_0x7a8d('0x52')](_0x58b765[_0x7a8d('0x50')],{'$or':_[_0x7a8d('0x45')](_0x58b765['attributes'],function(_0x54099d){var _0x1bdabe={};_0x1bdabe[_0x54099d]={'$like':'%'+_0x2f4987['query'][_0x7a8d('0x54')]+'%'};return _0x1bdabe;})});}_0x58b765=_['merge']({},_0x58b765,_0x2f4987[_0x7a8d('0x5c')]);return db[_0x7a8d('0x68')][_0x7a8d('0x31')]({'where':_0x58b765[_0x7a8d('0x50')]})[_0x7a8d('0x1f')](function(_0x13bb96){_0x1f3c13['count']=_0x13bb96;if(_0x2f4987[_0x7a8d('0x4c')][_0x7a8d('0x5b')]){_0x58b765[_0x7a8d('0x55')]=[{'all':!![]}];}return db[_0x7a8d('0x68')]['findAll'](_0x58b765);})['then'](function(_0xe37ba4){_0x1f3c13[_0x7a8d('0x57')]=_0xe37ba4;return _0x1f3c13;});}})[_0x7a8d('0x1f')](respondWithFilteredResult(_0x4d9680,_0x58b765))[_0x7a8d('0x29')](handleError(_0x4d9680,null));};exports[_0x7a8d('0x6b')]=function(_0x245b71,_0x553155,_0xe1fbe5){return db['SmsAccount'][_0x7a8d('0x5d')]({'where':{'id':_0x245b71[_0x7a8d('0x59')]['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x553155,null))[_0x7a8d('0x1f')](function(_0x4795ee){if(_0x4795ee){return _0x4795ee['removeDispositions'](_0x245b71[_0x7a8d('0x4c')][_0x7a8d('0x6c')]);}})['then'](respondWithStatusCode(_0x553155,null))[_0x7a8d('0x29')](handleError(_0x553155,null));};exports[_0x7a8d('0x6d')]=function(_0x318bbc,_0x5b5387,_0x39c169){if(_0x318bbc[_0x7a8d('0x5f')]['id']){delete _0x318bbc['body']['id'];}return db[_0x7a8d('0x42')][_0x7a8d('0x5d')]({'where':{'id':_0x318bbc[_0x7a8d('0x59')]['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x5b5387,null))['then'](function(_0x3199c6){if(_0x3199c6){_0x318bbc[_0x7a8d('0x5f')][_0x7a8d('0x67')]=_0x3199c6['id'];return db['CannedAnswer']['create'](_0x318bbc[_0x7a8d('0x5f')]);}})[_0x7a8d('0x1f')](respondWithResult(_0x5b5387,null))[_0x7a8d('0x29')](handleError(_0x5b5387,null));};exports[_0x7a8d('0x6e')]=function(_0x2528e5,_0x175bdd,_0x599048){var _0x2780c9={'raw':![],'where':{}};var _0x45234b={};var _0x1b60d6={'count':0x0,'rows':[]};return db[_0x7a8d('0x42')][_0x7a8d('0x6f')]({'where':{'id':_0x2528e5['params']['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x175bdd,null))[_0x7a8d('0x1f')](function(_0x1fa17e){if(_0x1fa17e){_0x45234b[_0x7a8d('0x49')]=_[_0x7a8d('0x46')](db[_0x7a8d('0x70')][_0x7a8d('0x5a')]);_0x45234b[_0x7a8d('0x4c')]=_[_0x7a8d('0x46')](_0x2528e5[_0x7a8d('0x4c')]);_0x45234b['filters']=_[_0x7a8d('0x48')](_0x45234b[_0x7a8d('0x49')],_0x45234b['query']);_0x2780c9['attributes']=_[_0x7a8d('0x48')](_0x45234b[_0x7a8d('0x49')],qs[_0x7a8d('0x4b')](_0x2528e5[_0x7a8d('0x4c')][_0x7a8d('0x4b')]));_0x2780c9[_0x7a8d('0x4a')]=_0x2780c9[_0x7a8d('0x4a')][_0x7a8d('0x4d')]?_0x2780c9['attributes']:_0x45234b[_0x7a8d('0x49')];if(!_0x2528e5[_0x7a8d('0x4c')]['hasOwnProperty'](_0x7a8d('0x4f'))){_0x2780c9['limit']=qs[_0x7a8d('0x30')](_0x2528e5[_0x7a8d('0x4c')]['limit']);_0x2780c9[_0x7a8d('0x2e')]=qs[_0x7a8d('0x2e')](_0x2528e5[_0x7a8d('0x4c')][_0x7a8d('0x2e')]);}_0x2780c9['order']=qs[_0x7a8d('0x6a')](_0x2528e5[_0x7a8d('0x4c')]['sort']);_0x2780c9[_0x7a8d('0x50')]=qs[_0x7a8d('0x47')](_[_0x7a8d('0x51')](_0x2528e5[_0x7a8d('0x4c')],_0x45234b['filters']));_0x2780c9[_0x7a8d('0x50')][_0x7a8d('0x67')]=_0x1fa17e['id'];if(_0x2528e5[_0x7a8d('0x4c')][_0x7a8d('0x54')]){_0x2780c9[_0x7a8d('0x50')]=_['merge'](_0x2780c9[_0x7a8d('0x50')],{'$or':_[_0x7a8d('0x45')](_0x2780c9[_0x7a8d('0x4a')],function(_0x3c9a44){var _0x2e0991={};_0x2e0991[_0x3c9a44]={'$like':'%'+_0x2528e5[_0x7a8d('0x4c')][_0x7a8d('0x54')]+'%'};return _0x2e0991;})});}_0x2780c9=_[_0x7a8d('0x52')]({},_0x2780c9,_0x2528e5[_0x7a8d('0x5c')]);return db['CannedAnswer'][_0x7a8d('0x31')]({'where':_0x2780c9[_0x7a8d('0x50')]})[_0x7a8d('0x1f')](function(_0x28d10d){_0x1b60d6[_0x7a8d('0x31')]=_0x28d10d;if(_0x2528e5[_0x7a8d('0x4c')][_0x7a8d('0x5b')]){_0x2780c9[_0x7a8d('0x55')]=[{'all':!![]}];}return db[_0x7a8d('0x70')][_0x7a8d('0x56')](_0x2780c9);})[_0x7a8d('0x1f')](function(_0x3bba95){_0x1b60d6[_0x7a8d('0x57')]=_0x3bba95;return _0x1b60d6;});}})[_0x7a8d('0x1f')](respondWithFilteredResult(_0x175bdd,_0x2780c9))['catch'](handleError(_0x175bdd,null));};exports[_0x7a8d('0x71')]=function(_0x48ab2e,_0x33c0d3,_0x2bdbf8){return db[_0x7a8d('0x42')][_0x7a8d('0x5d')]({'where':{'id':_0x48ab2e['params']['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x33c0d3,null))[_0x7a8d('0x1f')](function(_0xf20b61){if(_0xf20b61){return _0xf20b61[_0x7a8d('0x71')](_0x48ab2e[_0x7a8d('0x4c')][_0x7a8d('0x6c')]);}})['then'](respondWithStatusCode(_0x33c0d3,null))[_0x7a8d('0x29')](handleError(_0x33c0d3,null));};exports[_0x7a8d('0x72')]=function(_0x4e0a53,_0x10b9cd,_0x414825){var _0x154f75={'channel':_0x7a8d('0x73')};var _0x28a751=[];var _0x44ae4a=[];var _0x4c75c7={};return db[_0x7a8d('0x42')]['find']({'where':{'id':_0x4e0a53['params']['id']},'include':[{'model':db[_0x7a8d('0x74')],'as':_0x7a8d('0x75')}]})[_0x7a8d('0x1f')](handleEntityNotFound(_0x10b9cd,null))[_0x7a8d('0x1f')](function(_0x4f5379){_0x154f75[_0x7a8d('0x76')]=_0x4f5379;_0x154f75[_0x7a8d('0x77')]=_['orderBy'](_0x4f5379[_0x7a8d('0x75')],[_0x7a8d('0x78')],[_0x7a8d('0x79')]);if(_0x154f75[_0x7a8d('0x76')][_0x7a8d('0x75')]){delete _0x154f75[_0x7a8d('0x76')][_0x7a8d('0x75')];}return db['CmContact'][_0x7a8d('0x65')]();})[_0x7a8d('0x1f')](function(_0x1dc595){if(!_0x1dc595){throw new db['Sequelize'][(_0x7a8d('0x7a'))]('no\x20available\x20attributes');}_0x28a751=_[_0x7a8d('0x7b')](_[_0x7a8d('0x46')](_0x1dc595),['createdAt',_0x7a8d('0x7c')]);_0x44ae4a=_[_0x7a8d('0x7b')](_['keys'](_0x1dc595),[_0x7a8d('0x7d'),'updatedAt',_0x7a8d('0x7e'),'ListId']);_0x154f75[_0x7a8d('0x5f')]={'mapKey':_0x7a8d('0x7f')};if(_0x154f75[_0x7a8d('0x76')][_0x7a8d('0x44')]){switch(_0x154f75[_0x7a8d('0x76')]['type']){case _0x7a8d('0x80'):_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x81')]=_0x4e0a53['body'][_0x7a8d('0x82')];_0x154f75['body'][_0x7a8d('0x5f')]=_0x4e0a53['body'][_0x7a8d('0x83')];_0x154f75[_0x7a8d('0x5f')]['messageId']=_0x4e0a53[_0x7a8d('0x5f')][_0x7a8d('0x84')];break;case'skebby':_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x81')]='+'+_0x4e0a53[_0x7a8d('0x5f')]['sender'];_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x5f')]=_0x4e0a53['body']['text'];break;case _0x7a8d('0x85'):_0x154f75['body']['from']=_0x4e0a53[_0x7a8d('0x5f')]['from'];_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x5f')]=_0x4e0a53[_0x7a8d('0x5f')]['message'];break;case _0x7a8d('0x86'):_0x154f75[_0x7a8d('0x5f')]['from']=_0x4e0a53['body'][_0x7a8d('0x81')];_0x154f75[_0x7a8d('0x5f')]['body']=_0x4e0a53['body'][_0x7a8d('0x5f')];_0x154f75[_0x7a8d('0x5f')]['messageId']=_0x4e0a53[_0x7a8d('0x5f')][_0x7a8d('0x87')];break;case'plivo':_0x154f75[_0x7a8d('0x5f')]['from']=_0x4e0a53[_0x7a8d('0x5f')]['From'];_0x154f75[_0x7a8d('0x5f')]['body']=_0x4e0a53[_0x7a8d('0x5f')]['Text'];_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x88')]=_0x4e0a53[_0x7a8d('0x5f')][_0x7a8d('0x89')];break;case _0x7a8d('0x8a'):_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x81')]='+'+_0x4e0a53[_0x7a8d('0x5f')][_0x7a8d('0x8b')][0x0]['from'];_0x154f75['body'][_0x7a8d('0x5f')]=_0x4e0a53['body'][_0x7a8d('0x8b')][0x0][_0x7a8d('0x8c')];_0x154f75[_0x7a8d('0x5f')]['messageId']=_0x4e0a53[_0x7a8d('0x5f')][_0x7a8d('0x8b')][0x0][_0x7a8d('0x88')];break;case'csc':_0x154f75[_0x7a8d('0x5f')]['from']=_0x4e0a53[_0x7a8d('0x5f')][_0x7a8d('0x8d')];_0x154f75[_0x7a8d('0x5f')]['body']=_0x4e0a53['body'][_0x7a8d('0x8e')][_0x7a8d('0x26')];break;case'clickatell':_0x154f75['body'][_0x7a8d('0x81')]=_0x4e0a53[_0x7a8d('0x5f')][_0x7a8d('0x8f')];_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x5f')]=_0x4e0a53['body']['text'];_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x88')]=_0x4e0a53[_0x7a8d('0x5f')]['replyMessageId'];break;case _0x7a8d('0x90'):_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x88')]=_0x4e0a53['body'][0x0][_0x7a8d('0x26')]['id'];_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x81')]=_0x4e0a53[_0x7a8d('0x5f')][0x0][_0x7a8d('0x26')]['from'];_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x5f')]=_0x4e0a53[_0x7a8d('0x5f')][0x0][_0x7a8d('0x26')][_0x7a8d('0x8c')];break;case _0x7a8d('0x91'):_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x81')]=_0x4e0a53['body'][_0x7a8d('0x81')];_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x5f')]=_0x4e0a53[_0x7a8d('0x5f')][_0x7a8d('0x26')];_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x88')]=_0x4e0a53[_0x7a8d('0x5f')]['refid'];break;}}if(_0x154f75[_0x7a8d('0x5f')]['id']){delete _0x154f75[_0x7a8d('0x5f')]['id'];}if(_[_0x7a8d('0x92')](_0x154f75[_0x7a8d('0x5f')]['from'])){throw new db[(_0x7a8d('0x93'))][(_0x7a8d('0x7a'))](_0x7a8d('0x94'));}if(_[_0x7a8d('0x92')](_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x5f')])||_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x5f')]===''){throw new db[(_0x7a8d('0x93'))][(_0x7a8d('0x7a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7a8d('0x92')](_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x95')])){throw new db['Sequelize'][(_0x7a8d('0x7a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x44ae4a);}if(!_[_0x7a8d('0x96')](_0x44ae4a,_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x95')])){throw new db['Sequelize']['ValidationError'](_0x7a8d('0x97')+_0x44ae4a);}_0x4c75c7[_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x95')]]=_0x154f75[_0x7a8d('0x5f')]['from'];return db[_0x7a8d('0x98')][_0x7a8d('0x5d')]({'where':{'id':_0x154f75[_0x7a8d('0x76')][_0x7a8d('0x99')]},'include':[{'model':db[_0x7a8d('0x9a')],'as':'Contacts','where':_0x4c75c7,'limit':0x1,'order':[[_0x7a8d('0x7c'),_0x7a8d('0x9b')]]}]});})['then'](handleEntityNotFound(_0x10b9cd,null))[_0x7a8d('0x1f')](function(_0x4d7ef7){if(_0x4d7ef7){_0x154f75[_0x7a8d('0x9c')]=_[_0x7a8d('0x9d')](_0x4d7ef7,[_0x7a8d('0x9e')]);if(_0x4d7ef7[_0x7a8d('0x9e')][_0x7a8d('0x4d')]){return _0x4d7ef7[_0x7a8d('0x9e')][0x0];}var _0x43a200=_[_0x7a8d('0x9f')](_0x154f75['body'],{'firstName':_0x154f75[_0x7a8d('0x5f')]['from'],'ListId':_0x4d7ef7['id']});_0x43a200[_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x95')]]=_0x154f75['body']['from'];return db[_0x7a8d('0x9a')][_0x7a8d('0x5e')](_0x43a200,{'fields':_0x28a751,'raw':!![]});}})['then'](handleEntityNotFound(_0x10b9cd,null))[_0x7a8d('0x1f')](function(_0x78a409){if(_0x78a409){_0x154f75['contact']=_0x78a409;var _0x5e3f9d={'ContactId':_0x78a409['id'],'phone':_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x81')],'SmsAccountId':_0x4e0a53['params']['id']};var _0x40374b={'ContactId':_0x78a409['id'],'SmsAccountId':_0x4e0a53[_0x7a8d('0x59')]['id'],'closed':![]};return db[_0x7a8d('0xa0')][_0x7a8d('0x5d')]({'where':_0x40374b})[_0x7a8d('0x1f')](function(_0x59711c){if(_0x59711c){return[_0x59711c,![]];}return db[_0x7a8d('0xa0')]['create'](_0x5e3f9d)[_0x7a8d('0x1f')](function(_0x4f8d74){return[_0x4f8d74,!![]];});});}})[_0x7a8d('0xa1')](function(_0x4a0111,_0x5aefcc){_0x154f75[_0x7a8d('0xa2')]=_0x4a0111['get']({'plain':!![]});_0x154f75[_0x7a8d('0xa2')]['created']=![];if(_0x5aefcc){if(_0x154f75[_0x7a8d('0x76')]['autoclose']){_0x154f75[_0x7a8d('0x77')][_0x7a8d('0xa3')]({'id':0x0,'priority':_0x154f75['applications'][_0x7a8d('0x4d')]+0x1,'app':'close','appdata':_0x7a8d('0xa4'),'interval':_0x7a8d('0xa5')});}_0x154f75[_0x7a8d('0xa2')][_0x7a8d('0xa6')]=!![];}return db['SmsMessage'][_0x7a8d('0x5e')]({'phone':_0x154f75['body'][_0x7a8d('0x81')],'messageId':_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x88')],'body':_0x154f75['body'][_0x7a8d('0x5f')],'SmsAccountId':_0x4e0a53['params']['id'],'SmsInteractionId':_0x4a0111['id'],'direction':'in','ContactId':_0x4a0111[_0x7a8d('0xa7')],'AttachmentId':_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0xa8')]});})[_0x7a8d('0x1f')](function(_0x451d5e){_0x154f75[_0x7a8d('0x26')]=_0x451d5e;if(!_0x154f75[_0x7a8d('0xa2')][_0x7a8d('0xa9')])return;return db[_0x7a8d('0xaa')][_0x7a8d('0x5d')]({'attributes':['id',_0x7a8d('0x3d')],'where':{'id':_0x154f75[_0x7a8d('0xa2')][_0x7a8d('0xa9')]}});})[_0x7a8d('0x1f')](function(_0x597de5){if(_0x597de5){_0x154f75[_0x7a8d('0x77')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x597de5[_0x7a8d('0x3d')]+','+(_0x154f75[_0x7a8d('0x76')][_0x7a8d('0xab')]||0xa),'interval':'*,*,*,*'});}if(!_0x154f75[_0x7a8d('0xa2')][_0x7a8d('0xac')])return;return db['SmsQueue'][_0x7a8d('0x5d')]({'attributes':['id',_0x7a8d('0x3d')],'where':{'id':_0x154f75['interaction'][_0x7a8d('0xac')]}});})[_0x7a8d('0x1f')](function(_0x176302){if(_0x176302){_0x154f75[_0x7a8d('0x77')][_0x7a8d('0xad')]({'id':0x0,'priority':0x1,'app':_0x7a8d('0xae'),'appdata':_0x176302['name']+','+(_0x154f75['account'][_0x7a8d('0xaf')]||0x12c),'interval':_0x7a8d('0xa5')});}return respondWithRpcPromise(_0x7a8d('0xb0'),'startRouting',_0x154f75);})[_0x7a8d('0x1f')](function(_0x496e1f){if(_0x496e1f){var _0x3afcd7=0xc8;var _0x1c883f=_0x7a8d('0xb1');logger[_0x7a8d('0x27')](_0x7a8d('0x22'),_0x1c883f,_0x3afcd7,_0x7a8d('0xb2'));logger[_0x7a8d('0xb3')](_0x7a8d('0xb4'),_0x1c883f,_0x3afcd7,'entity\x20found',JSON['stringify'](_0x496e1f));if(_0x154f75[_0x7a8d('0x76')][_0x7a8d('0x44')]===_0x7a8d('0x80')){return _0x10b9cd[_0x7a8d('0x2b')](_0x3afcd7)['set']('Content-Type',_0x7a8d('0xb5'))['send']('\x0a');}else{return _0x10b9cd['status'](_0x3afcd7)[_0x7a8d('0x2d')](_0x496e1f);}}})[_0x7a8d('0x29')](handleError(_0x10b9cd,null));};exports['addApplications']=function(_0x3a3157,_0x547155){var _0x9346f4=_0x3a3157[_0x7a8d('0x59')]['id'];var _0x5183a2=_0x3a3157['body'];var _0x4dca49=0xc8;var _0x41f386=null;return db[_0x7a8d('0xb6')]['transaction']({'isolationLevel':db[_0x7a8d('0xb6')][_0x7a8d('0xb7')][_0x7a8d('0xb8')][_0x7a8d('0xb9')]},function(_0x9dcff0){return db[_0x7a8d('0x42')][_0x7a8d('0x6f')]({'where':{'id':_0x9346f4},'transaction':_0x9dcff0})['then'](function(_0x2ae49b){if(_0x2ae49b){return db[_0x7a8d('0x74')][_0x7a8d('0x3b')]({'where':{'SmsAccountId':_0x9346f4},'transaction':_0x9dcff0})[_0x7a8d('0x1f')](function(){var _0x15cad1=_[_0x7a8d('0x45')](_0x5183a2,function(_0x56a62e){_0x56a62e['SmsAccountId']=_0x9346f4;return _0x56a62e;});return db[_0x7a8d('0x74')]['bulkCreate'](_0x15cad1,{'transaction':_0x9dcff0});});}else{_0x4dca49=0x194;_0x41f386=[];}});})[_0x7a8d('0x1f')](function(){if(_0x4dca49!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x9346f4},'order':_0x7a8d('0x78')})[_0x7a8d('0x1f')](function(_0x31e752){_0x41f386=_0x31e752;});}})['catch'](function(_0x12fc73){_0x4dca49=0x1f4;logger['error'](_0x12fc73[_0x7a8d('0x3c')]);if(_0x12fc73[_0x7a8d('0x3d')]){delete _0x12fc73[_0x7a8d('0x3d')];}_0x41f386=_0x12fc73;})[_0x7a8d('0xba')](function(){if(_0x41f386===null){_0x547155[_0x7a8d('0x2a')](_0x4dca49);}else{if(_0x4dca49===0x1f4){_0x547155[_0x7a8d('0x2b')](_0x4dca49)[_0x7a8d('0x3e')](_0x41f386);}else{_0x547155[_0x7a8d('0x2b')](_0x4dca49)[_0x7a8d('0x2d')](_0x41f386);}}});};exports[_0x7a8d('0xbb')]=function(_0x4299ac,_0x2ff85f,_0x26ca1c){var _0x1960a2={};var _0x2493d8={};var _0x494a96;var _0x42570c;return db['SmsAccount'][_0x7a8d('0x6f')]({'where':{'id':_0x4299ac['params']['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x2ff85f,null))[_0x7a8d('0x1f')](function(_0x5b01de){if(_0x5b01de){_0x494a96=_0x5b01de;_0x2493d8['model']=_['keys'](db[_0x7a8d('0x74')][_0x7a8d('0x5a')]);_0x2493d8[_0x7a8d('0x4c')]=_[_0x7a8d('0x46')](_0x4299ac['query']);_0x2493d8[_0x7a8d('0x47')]=_[_0x7a8d('0x48')](_0x2493d8[_0x7a8d('0x49')],_0x2493d8[_0x7a8d('0x4c')]);_0x1960a2[_0x7a8d('0x4a')]=_[_0x7a8d('0x48')](_0x2493d8[_0x7a8d('0x49')],qs[_0x7a8d('0x4b')](_0x4299ac[_0x7a8d('0x4c')][_0x7a8d('0x4b')]));_0x1960a2[_0x7a8d('0x4a')]=_0x1960a2[_0x7a8d('0x4a')][_0x7a8d('0x4d')]?_0x1960a2[_0x7a8d('0x4a')]:_0x2493d8['model'];_0x1960a2[_0x7a8d('0xbc')]=qs['sort'](_0x4299ac['query'][_0x7a8d('0x6a')]);_0x1960a2[_0x7a8d('0x50')]=qs[_0x7a8d('0x47')](_['pick'](_0x4299ac[_0x7a8d('0x4c')],_0x2493d8[_0x7a8d('0x47')]));if(_0x4299ac[_0x7a8d('0x4c')][_0x7a8d('0x54')]){_0x1960a2[_0x7a8d('0x50')]=_['merge'](_0x1960a2[_0x7a8d('0x50')],{'$or':_[_0x7a8d('0x45')](_0x1960a2[_0x7a8d('0x4a')],function(_0x31a90b){var _0x4f140e={};_0x4f140e[_0x31a90b]={'$like':'%'+_0x4299ac[_0x7a8d('0x4c')][_0x7a8d('0x54')]+'%'};return _0x4f140e;})});}_0x1960a2=_[_0x7a8d('0x52')]({},_0x1960a2,_0x4299ac[_0x7a8d('0x5c')]);return _0x494a96[_0x7a8d('0xbb')](_0x1960a2);}})[_0x7a8d('0x1f')](function(_0x4fbc3a){if(_0x4fbc3a){_0x42570c=_0x4fbc3a[_0x7a8d('0x4d')];if(!_0x4299ac['query']['hasOwnProperty'](_0x7a8d('0x4f'))){_0x1960a2[_0x7a8d('0x30')]=qs[_0x7a8d('0x30')](_0x4299ac[_0x7a8d('0x4c')][_0x7a8d('0x30')]);_0x1960a2[_0x7a8d('0x2e')]=qs[_0x7a8d('0x2e')](_0x4299ac['query']['offset']);}return _0x494a96[_0x7a8d('0xbb')](_0x1960a2);}})['then'](function(_0x2a21a0){if(_0x2a21a0){return _0x2a21a0?{'count':_0x42570c,'rows':_0x2a21a0}:null;}})[_0x7a8d('0x1f')](respondWithResult(_0x2ff85f,null))[_0x7a8d('0x29')](handleError(_0x2ff85f,null));};exports[_0x7a8d('0xbd')]=function(_0x579917,_0x1570a7,_0x12ff0b){var _0x42f3f1={'raw':![],'where':{}};var _0x126153={};var _0x5c120d={'count':0x0,'rows':[]};return db[_0x7a8d('0x42')][_0x7a8d('0x6f')]({'where':{'id':_0x579917['params']['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x1570a7,null))[_0x7a8d('0x1f')](function(_0x4ddffa){if(_0x4ddffa){_0x126153[_0x7a8d('0x49')]=_['keys'](db['SmsInteraction']['rawAttributes']);_0x126153[_0x7a8d('0x4c')]=_[_0x7a8d('0x46')](_0x579917['query']);_0x126153[_0x7a8d('0x47')]=_['intersection'](_0x126153['model'],_0x126153['query']);_0x42f3f1[_0x7a8d('0x4a')]=_[_0x7a8d('0x48')](_0x126153[_0x7a8d('0x49')],qs[_0x7a8d('0x4b')](_0x579917[_0x7a8d('0x4c')][_0x7a8d('0x4b')]));_0x42f3f1[_0x7a8d('0x4a')]=_0x42f3f1[_0x7a8d('0x4a')][_0x7a8d('0x4d')]?_0x42f3f1[_0x7a8d('0x4a')]:_0x126153['model'];if(!_0x579917[_0x7a8d('0x4c')][_0x7a8d('0x4e')]('nolimit')){_0x42f3f1[_0x7a8d('0x30')]=qs['limit'](_0x579917['query']['limit']);_0x42f3f1[_0x7a8d('0x2e')]=qs['offset'](_0x579917[_0x7a8d('0x4c')][_0x7a8d('0x2e')]);}_0x42f3f1[_0x7a8d('0xbc')]=qs['sort'](_0x579917[_0x7a8d('0x4c')]['sort']);_0x42f3f1[_0x7a8d('0x50')]=qs[_0x7a8d('0x47')](_['pick'](_0x579917['query'],_0x126153[_0x7a8d('0x47')]));_0x42f3f1[_0x7a8d('0x50')]['SmsAccountId']=_0x4ddffa['id'];if(_0x579917[_0x7a8d('0x4c')][_0x7a8d('0x54')]){_0x42f3f1[_0x7a8d('0x50')]=_[_0x7a8d('0x52')](_0x42f3f1[_0x7a8d('0x50')],{'$or':_[_0x7a8d('0x45')](_0x42f3f1[_0x7a8d('0x4a')],function(_0x30a2bc){var _0x105df5={};_0x105df5[_0x30a2bc]={'$like':'%'+_0x579917['query']['filter']+'%'};return _0x105df5;})});}_0x42f3f1=_['merge']({},_0x42f3f1,_0x579917[_0x7a8d('0x5c')]);return db[_0x7a8d('0xa0')][_0x7a8d('0x31')]({'where':_0x42f3f1[_0x7a8d('0x50')]})[_0x7a8d('0x1f')](function(_0x104c29){_0x5c120d[_0x7a8d('0x31')]=_0x104c29;if(_0x579917[_0x7a8d('0x4c')][_0x7a8d('0x5b')]){_0x42f3f1['include']=[{'model':db[_0x7a8d('0x9a')],'as':_0x7a8d('0xbe'),'required':![]},{'model':db[_0x7a8d('0xaa')],'as':_0x7a8d('0xbf'),'attributes':[_0x7a8d('0x3d'),_0x7a8d('0xc0'),'internal'],'required':![]},{'model':db[_0x7a8d('0xc1')],'as':'Tags','attributes':['id',_0x7a8d('0x3d'),_0x7a8d('0xc2')],'where':_0x579917[_0x7a8d('0x4c')][_0x7a8d('0xc3')]?{'id':_0x579917['query']['tag']}:undefined,'required':_0x579917['query'][_0x7a8d('0xc3')]?!![]:![]}];}return db[_0x7a8d('0xa0')][_0x7a8d('0x56')](_0x42f3f1);})[_0x7a8d('0x1f')](function(_0x30221f){_0x5c120d['rows']=_0x30221f;return _0x5c120d;});}})[_0x7a8d('0x1f')](respondWithFilteredResult(_0x1570a7,_0x42f3f1))[_0x7a8d('0x29')](handleError(_0x1570a7,null));};exports[_0x7a8d('0x3e')]=function(_0x3ed641,_0x346667,_0x40d493){var _0x51741b,_0x4b07bd,_0x57bd79;if(_[_0x7a8d('0x92')](_0x3ed641['body'][_0x7a8d('0x5f')])||_0x3ed641['body'][_0x7a8d('0x5f')]===''){throw new db['Sequelize'][(_0x7a8d('0x7a'))](_0x7a8d('0xc4'));}if(_['isNil'](_0x3ed641[_0x7a8d('0x5f')]['to'])){throw new db[(_0x7a8d('0x93'))][(_0x7a8d('0x7a'))](_0x7a8d('0xc5'));}_0x51741b=_0x3ed641['body']['to'];return db['SmsAccount']['find']({'where':{'id':_0x3ed641['params']['id']},'include':[{'model':db[_0x7a8d('0x98')],'as':_0x7a8d('0xc6'),'include':[{'model':db[_0x7a8d('0x9a')],'as':_0x7a8d('0x9e'),'where':{'mobile':_0x51741b},'limit':0x1,'order':[[_0x7a8d('0x7c'),_0x7a8d('0x9b')]]}]}]})[_0x7a8d('0x1f')](handleEntityNotFound(_0x346667,null))['then'](function(_0x3a7480){if(_0x3a7480&&_0x3a7480[_0x7a8d('0xc6')]){_0x4b07bd=_0x3a7480['get']({'plain':!![]});if(_0x4b07bd[_0x7a8d('0xc6')]&&_0x4b07bd[_0x7a8d('0xc6')]['Contacts'][_0x7a8d('0x4d')]){return _0x4b07bd[_0x7a8d('0xc6')][_0x7a8d('0x9e')][0x0];}return db[_0x7a8d('0x9a')][_0x7a8d('0x5e')](_[_0x7a8d('0x9f')](_0x3ed641['body'],{'firstName':_0x51741b,'mobile':_0x51741b,'phone':_0x51741b,'ListId':_0x4b07bd[_0x7a8d('0x99')]}));}})['then'](handleEntityNotFound(_0x346667,null))[_0x7a8d('0x1f')](function(_0x340d13){if(_0x340d13){_0x57bd79=_0x340d13;return db['SmsInteraction'][_0x7a8d('0x5d')]({'where':{'ContactId':_0x57bd79['id'],'closed':![],'SmsAccountId':_0x4b07bd['id']}})['then'](function(_0x403561){if(_0x403561){return[_0x403561,![]];}return db[_0x7a8d('0xa0')][_0x7a8d('0x5e')]({'UserId':_0x3ed641['user']['id'],'ContactId':_0x57bd79['id'],'SmsAccountId':_0x4b07bd['id'],'phone':_0x51741b,'firstMsgDirection':_0x7a8d('0xc7'),'Messages':[_['merge'](_0x3ed641[_0x7a8d('0x5f')],{'read':![],'body':_0x3ed641['body'][_0x7a8d('0x5f')],'phone':_0x51741b,'SmsAccountId':_0x4b07bd['id'],'UserId':_0x3ed641[_0x7a8d('0x60')]['id'],'ContactId':_0x57bd79['id']})]},{'include':[{'model':db[_0x7a8d('0xc8')],'as':_0x7a8d('0xc9')}]})[_0x7a8d('0x1f')](function(_0x36a327){return[_0x36a327,!![]];});});}})[_0x7a8d('0xa1')](function(_0x51a2b9,_0x517b56){if(_0x517b56){return _0x51a2b9;}return db[_0x7a8d('0xc8')][_0x7a8d('0x5e')](_[_0x7a8d('0x52')](_0x3ed641[_0x7a8d('0x5f')],{'read':![],'body':_0x3ed641[_0x7a8d('0x5f')][_0x7a8d('0x5f')],'phone':_0x51741b,'SmsAccountId':_0x4b07bd['id'],'SmsInteractionId':_0x51a2b9['id'],'UserId':_0x3ed641[_0x7a8d('0x60')]['id'],'ContactId':_0x57bd79['id']}))[_0x7a8d('0x1f')](function(_0x2d1aef){_0x51a2b9[_0x7a8d('0xca')][_0x7a8d('0xc9')]=[];_0x51a2b9[_0x7a8d('0xca')]['Messages'][_0x7a8d('0xa3')](_0x2d1aef[_0x7a8d('0xca')]);return _0x51a2b9;});})['then'](respondWithResult(_0x346667,null))['catch'](handleError(_0x346667,null));};exports[_0x7a8d('0x2b')]=function(_0x2c27e9,_0x29f1d9,_0x20b221){if(_0x2c27e9[_0x7a8d('0x5f')]['id']){delete _0x2c27e9[_0x7a8d('0x5f')]['id'];}var _0x1f7c50,_0x12e53a,_0x4ba36d;return db['SmsAccount'][_0x7a8d('0x5d')]({'where':{'id':_0x2c27e9['params']['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x29f1d9,null))['then'](function(_0x4451ca){if(_0x4451ca){_0x4ba36d=_0x4451ca;logger[_0x7a8d('0xb3')](_0x7a8d('0x22'),'status',_0x7a8d('0xcb'),_0x4451ca['type'],util['inspect'](_0x2c27e9[_0x7a8d('0x5f')],{'showHidden':![],'depth':null}));switch(_0x4451ca[_0x7a8d('0x44')]){case _0x7a8d('0xcc'):if(_0x2c27e9[_0x7a8d('0x5f')]['skebby_dispatch_id']&&_0x2c27e9['body'][_0x7a8d('0x2b')]){_0x12e53a=_0x2c27e9['body'][_0x7a8d('0x2b')];return db[_0x7a8d('0xc8')][_0x7a8d('0x5d')]({'where':{'messageId':_0x2c27e9[_0x7a8d('0x5f')]['skebby_dispatch_id']}});}break;case _0x7a8d('0x85'):if(_0x2c27e9[_0x7a8d('0x5f')]['requestid']&&_0x2c27e9['body'][_0x7a8d('0xcd')]){_0x12e53a=_0x2c27e9[_0x7a8d('0x5f')]['statusInt'];return db[_0x7a8d('0xc8')]['find']({'where':{'messageId':_0x2c27e9[_0x7a8d('0x5f')][_0x7a8d('0xce')]}});}break;case _0x7a8d('0x86'):if(_0x2c27e9[_0x7a8d('0x5f')]['message_id']&&_0x2c27e9[_0x7a8d('0x5f')]['status_code']){_0x12e53a=_0x2c27e9[_0x7a8d('0x5f')][_0x7a8d('0xcf')];return db[_0x7a8d('0xc8')]['find']({'where':{'messageId':_0x2c27e9[_0x7a8d('0x5f')]['message_id']}});}break;case'infobip':var _0x16bdc1=_0x2c27e9[_0x7a8d('0x5f')][_0x7a8d('0x8b')][0x0];if(_0x16bdc1['messageId']&&_0x16bdc1[_0x7a8d('0x2b')]['groupName']==='DELIVERED'){_0x12e53a=_0x16bdc1['status'][_0x7a8d('0xd0')];return db[_0x7a8d('0xc8')][_0x7a8d('0x5d')]({'where':{'messageId':_0x16bdc1['messageId']}});}break;case _0x7a8d('0xd1'):if(_0x2c27e9['body'][_0x7a8d('0x88')]&&_0x2c27e9[_0x7a8d('0x5f')]['status']){_0x12e53a=_0x2c27e9['body'][_0x7a8d('0x2b')];return db['SmsMessage'][_0x7a8d('0x5d')]({'where':{'messageId':_0x2c27e9['body'][_0x7a8d('0x88')]}});}break;case _0x7a8d('0x90'):if(_0x2c27e9[_0x7a8d('0x5f')][0x0]['message']['id']){_0x12e53a=_0x2c27e9[_0x7a8d('0x5f')][0x0][_0x7a8d('0x44')];return db[_0x7a8d('0xc8')][_0x7a8d('0x5d')]({'where':{'messageId':_0x2c27e9['body'][0x0][_0x7a8d('0x26')]['id']}});}break;case _0x7a8d('0x91'):if(_0x2c27e9[_0x7a8d('0x5f')][_0x7a8d('0xd2')]&&_0x2c27e9[_0x7a8d('0x5f')]['status']){_0x12e53a=_0x2c27e9[_0x7a8d('0x5f')][_0x7a8d('0x2b')];return db['SmsMessage'][_0x7a8d('0x5d')]({'where':{'messageId':_0x2c27e9[_0x7a8d('0x5f')][_0x7a8d('0xd2')]}});}break;}}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x29f1d9,null))['then'](function(_0x30502e){if(_0x30502e){_0x1f7c50=_0x30502e;switch(_0x4ba36d[_0x7a8d('0x44')]){case _0x7a8d('0xcc'):if(_0x12e53a===_0x7a8d('0xd3')){return _0x1f7c50[_0x7a8d('0x37')]({'read':!![]});}else{logger[_0x7a8d('0x24')](_0x7a8d('0x22'),_0x7a8d('0x2b'),'skebby',util['inspect'](_0x2c27e9[_0x7a8d('0x5f')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x12e53a==='1'){return _0x1f7c50['update']({'read':!![]});}else{logger['error'](_0x7a8d('0x22'),'status',_0x7a8d('0xcc'),util['inspect'](_0x2c27e9[_0x7a8d('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x7a8d('0x86'):if(!_0x2c27e9[_0x7a8d('0x5f')][_0x7a8d('0xd4')]&&_0x12e53a>=0xc8&&_0x12e53a<=0xce){return _0x1f7c50[_0x7a8d('0x37')]({'read':!![]});}else{logger['error'](_0x7a8d('0x22'),'status','clicksend',util[_0x7a8d('0xd5')](_0x2c27e9[_0x7a8d('0x5f')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x41cab9=_0x2c27e9[_0x7a8d('0x5f')][_0x7a8d('0x8b')][0x0];if(_0x41cab9[_0x7a8d('0x2b')][_0x7a8d('0xd0')]===_0x7a8d('0xd3')){return _0x1f7c50['update']({'read':!![]});}else{logger[_0x7a8d('0x24')](_0x7a8d('0x22'),_0x7a8d('0x2b'),_0x7a8d('0x8a'),util[_0x7a8d('0xd5')](_0x2c27e9[_0x7a8d('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x7a8d('0xd1'):if(_0x12e53a==_0x7a8d('0xd6')||_0x12e53a=='RECEIVED_BY_RECIPIENT'){return _0x1f7c50[_0x7a8d('0x37')]({'read':!![]});}else{logger[_0x7a8d('0x24')](_0x7a8d('0x22'),_0x7a8d('0x2b'),_0x7a8d('0xd1'),util[_0x7a8d('0xd5')](_0x2c27e9[_0x7a8d('0x5f')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x12e53a==_0x7a8d('0xd7')){return _0x1f7c50[_0x7a8d('0x37')]({'read':!![]});}else{logger['error'](_0x7a8d('0x22'),_0x7a8d('0x2b'),_0x7a8d('0x90'),util[_0x7a8d('0xd5')](_0x2c27e9[_0x7a8d('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x7a8d('0x91'):if(_0x12e53a===_0x7a8d('0xd8')||_0x12e53a==='ACCEPTD'){return _0x1f7c50[_0x7a8d('0x37')]({'read':!![]});}else{logger[_0x7a8d('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x7a8d('0x91'),util['inspect'](_0x2c27e9['body'],{'showHidden':![],'depth':null}));}break;}return _0x1f7c50;}})[_0x7a8d('0x1f')](respondWithResult(_0x29f1d9,null))['catch'](handleError(_0x29f1d9,null));};exports[_0x7a8d('0xd9')]=function(_0x41c51c,_0x4cdd25,_0x39b7ff){var _0x204ec8,_0x2937c3,_0x2bdbe1;return db[_0x7a8d('0x42')]['find']({'where':{'id':_0x41c51c[_0x7a8d('0x59')]['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x4cdd25,null))[_0x7a8d('0x1f')](function(_0x492f16){if(_0x492f16){_0x2bdbe1=_0x492f16;logger['debug'](_0x7a8d('0x22'),_0x7a8d('0x2b'),_0x7a8d('0xcb'),_0x492f16[_0x7a8d('0x44')],util['inspect'](_0x41c51c[_0x7a8d('0x4c')],{'showHidden':![],'depth':null}));switch(_0x492f16[_0x7a8d('0x44')]){case _0x7a8d('0xda'):if(_0x41c51c[_0x7a8d('0x4c')][_0x7a8d('0xdb')]&&_0x41c51c['query'][_0x7a8d('0xdc')]){_0x2937c3=_0x41c51c[_0x7a8d('0x4c')][_0x7a8d('0xdc')];return db['SmsMessage']['find']({'where':{'messageId':_0x41c51c['query'][_0x7a8d('0xdb')]}});}break;}}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x4cdd25,null))[_0x7a8d('0x1f')](function(_0x599083){if(_0x599083){_0x204ec8=_0x599083;switch(_0x2bdbe1[_0x7a8d('0x44')]){case _0x7a8d('0xda'):if(_0x2937c3==='2'||_0x2937c3==='6'){return _0x204ec8[_0x7a8d('0x37')]({'read':!![]});}else{logger[_0x7a8d('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7a8d('0x2b'),_0x7a8d('0xda'),util['inspect'](_0x41c51c[_0x7a8d('0x4c')],{'showHidden':![],'depth':null}));};break;}return _0x204ec8;}})['then'](respondWithResult(_0x4cdd25,null))[_0x7a8d('0x29')](handleError(_0x4cdd25,null));};exports['addAgents']=function(_0x37649b,_0x223e90,_0x36fb68){return db[_0x7a8d('0x42')][_0x7a8d('0x5d')]({'where':{'id':_0x37649b['params']['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x223e90,null))[_0x7a8d('0x1f')](function(_0x3f5c99){if(_0x3f5c99){return _0x3f5c99[_0x7a8d('0xdd')](_0x37649b[_0x7a8d('0x5f')][_0x7a8d('0x6c')],_[_0x7a8d('0x9d')](_0x37649b[_0x7a8d('0x5f')],[_0x7a8d('0x6c'),'id'])||{})[_0x7a8d('0xa1')](function(_0x484c29){for(var _0x160839=0x0;_0x160839<_0x37649b[_0x7a8d('0x5f')][_0x7a8d('0x6c')]['length'];_0x160839+=0x1){socket[_0x7a8d('0xde')](_0x7a8d('0xdf'),{'UserId':Number(_0x37649b[_0x7a8d('0x5f')]['ids'][_0x160839]),'SmsAccountId':Number(_0x37649b[_0x7a8d('0x59')]['id'])});}return _0x484c29;});}})[_0x7a8d('0x1f')](respondWithResult(_0x223e90,null))[_0x7a8d('0x29')](handleError(_0x223e90,null));};exports['removeAgents']=function(_0x580664,_0x3e758c,_0x233b5b){return db[_0x7a8d('0x42')][_0x7a8d('0x5d')]({'where':{'id':_0x580664[_0x7a8d('0x59')]['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x3e758c,null))[_0x7a8d('0x1f')](function(_0x1b97ed){if(_0x1b97ed){return _0x1b97ed[_0x7a8d('0xe0')](_0x580664[_0x7a8d('0x4c')][_0x7a8d('0x6c')])[_0x7a8d('0x1f')](function(){if(_[_0x7a8d('0xe1')](_0x580664['query']['ids'])){for(var _0x11ac88=0x0;_0x11ac88<_0x580664[_0x7a8d('0x4c')][_0x7a8d('0x6c')][_0x7a8d('0x4d')];_0x11ac88+=0x1){socket['emit'](_0x7a8d('0xe2'),{'UserId':Number(_0x580664[_0x7a8d('0x4c')][_0x7a8d('0x6c')][_0x11ac88]),'SmsAccountId':Number(_0x580664['params']['id'])});}}else{socket[_0x7a8d('0xde')](_0x7a8d('0xe2'),{'UserId':Number(_0x580664[_0x7a8d('0x4c')][_0x7a8d('0x6c')]),'SmsAccountId':Number(_0x580664[_0x7a8d('0x59')]['id'])});}});}})[_0x7a8d('0x1f')](respondWithStatusCode(_0x3e758c,null))[_0x7a8d('0x29')](handleError(_0x3e758c,null));};exports[_0x7a8d('0xe3')]=function(_0x44e696,_0x2eac6c,_0x36329a){var _0x10cf1f={};var _0x3e3e29={};var _0x1e7b07;var _0x2ee88b;return db[_0x7a8d('0x42')][_0x7a8d('0x6f')]({'where':{'id':_0x44e696[_0x7a8d('0x59')]['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x2eac6c,null))[_0x7a8d('0x1f')](function(_0x1a8262){if(_0x1a8262){_0x1e7b07=_0x1a8262;_0x3e3e29[_0x7a8d('0x49')]=_[_0x7a8d('0x46')](db[_0x7a8d('0xaa')][_0x7a8d('0x5a')]);_0x3e3e29[_0x7a8d('0x4c')]=_[_0x7a8d('0x46')](_0x44e696[_0x7a8d('0x4c')]);_0x3e3e29[_0x7a8d('0x47')]=_[_0x7a8d('0x48')](_0x3e3e29[_0x7a8d('0x49')],_0x3e3e29['query']);_0x10cf1f[_0x7a8d('0x4a')]=_[_0x7a8d('0x48')](_0x3e3e29[_0x7a8d('0x49')],qs['fields'](_0x44e696[_0x7a8d('0x4c')][_0x7a8d('0x4b')]));_0x10cf1f[_0x7a8d('0x4a')]=_0x10cf1f['attributes'][_0x7a8d('0x4d')]?_0x10cf1f[_0x7a8d('0x4a')]:_0x3e3e29[_0x7a8d('0x49')];_0x10cf1f['order']=qs['sort'](_0x44e696[_0x7a8d('0x4c')][_0x7a8d('0x6a')]);_0x10cf1f[_0x7a8d('0x50')]=qs[_0x7a8d('0x47')](_[_0x7a8d('0x51')](_0x44e696[_0x7a8d('0x4c')],_0x3e3e29[_0x7a8d('0x47')]));if(_0x44e696[_0x7a8d('0x4c')][_0x7a8d('0x54')]){_0x10cf1f['where']=_[_0x7a8d('0x52')](_0x10cf1f['where'],{'$or':_[_0x7a8d('0x45')](_0x10cf1f[_0x7a8d('0x4a')],function(_0x81016d){var _0xd5aa1={};_0xd5aa1[_0x81016d]={'$like':'%'+_0x44e696['query'][_0x7a8d('0x54')]+'%'};return _0xd5aa1;})});}_0x10cf1f=_[_0x7a8d('0x52')]({},_0x10cf1f,_0x44e696[_0x7a8d('0x5c')]);return _0x1e7b07[_0x7a8d('0xe3')](_0x10cf1f);}})[_0x7a8d('0x1f')](function(_0x451c9c){if(_0x451c9c){_0x2ee88b=_0x451c9c[_0x7a8d('0x4d')];if(!_0x44e696['query'][_0x7a8d('0x4e')]('nolimit')){_0x10cf1f[_0x7a8d('0x30')]=qs[_0x7a8d('0x30')](_0x44e696[_0x7a8d('0x4c')]['limit']);_0x10cf1f[_0x7a8d('0x2e')]=qs['offset'](_0x44e696[_0x7a8d('0x4c')][_0x7a8d('0x2e')]);}return _0x1e7b07[_0x7a8d('0xe3')](_0x10cf1f);}})['then'](function(_0x1ae813){if(_0x1ae813){return _0x1ae813?{'count':_0x2ee88b,'rows':_0x1ae813}:null;}})[_0x7a8d('0x1f')](respondWithResult(_0x2eac6c,null))[_0x7a8d('0x29')](handleError(_0x2eac6c,null));}; \ No newline at end of file +var _0x9f26=['Contacts','DESC','omit','defaults','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','UserId','User','unshift','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','receiveMessage','entity\x20found','Content-Type','\x0a','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','stack','json','getApplications','getInteractions','Owner','fullname','internal','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','List','out','SmsMessage','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','apply','save','update','destroy','get','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','include','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','describe','addDisposition','SmsAccountId','getDispositions','Disposition','includeAll','findAll','rows','removeDispositions','CannedAnswer','findOne','order','pick','removeAnswers','ids','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','Sequelize','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmContact'];(function(_0x1c34e7,_0x33f9a8){var _0x378cb1=function(_0x10b5e3){while(--_0x10b5e3){_0x1c34e7['push'](_0x1c34e7['shift']());}};_0x378cb1(++_0x33f9a8);}(_0x9f26,0x132));var _0x69f2=function(_0x17f11f,_0x5512ce){_0x17f11f=_0x17f11f-0x0;var _0x30e8f3=_0x9f26[_0x17f11f];return _0x30e8f3;};'use strict';var emlformat=require(_0x69f2('0x0'));var rimraf=require(_0x69f2('0x1'));var zipdir=require(_0x69f2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x69f2('0x3'));var moment=require(_0x69f2('0x4'));var BPromise=require(_0x69f2('0x5'));var Mustache=require(_0x69f2('0x6'));var util=require('util');var path=require(_0x69f2('0x7'));var sox=require(_0x69f2('0x8'));var csv=require(_0x69f2('0x9'));var ejs=require(_0x69f2('0xa'));var fs=require('fs');var fs_extra=require(_0x69f2('0xb'));var _=require('lodash');var squel=require(_0x69f2('0xc'));var crypto=require(_0x69f2('0xd'));var jsforce=require(_0x69f2('0xe'));var deskjs=require(_0x69f2('0xf'));var toCsv=require(_0x69f2('0x9'));var querystring=require(_0x69f2('0x10'));var Papa=require(_0x69f2('0x11'));var Redis=require(_0x69f2('0x12'));var authService=require(_0x69f2('0x13'));var qs=require(_0x69f2('0x14'));var as=require(_0x69f2('0x15'));var hardwareService=require(_0x69f2('0x16'));var logger=require(_0x69f2('0x17'))(_0x69f2('0x18'));var utils=require(_0x69f2('0x19'));var config=require(_0x69f2('0x1a'));var licenseUtil=require(_0x69f2('0x1b'));var db=require(_0x69f2('0x1c'))['db'];config[_0x69f2('0x1d')]=_['defaults'](config[_0x69f2('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x69f2('0x1e'))(new Redis(config[_0x69f2('0x1d')]));require('./smsAccount.socket')[_0x69f2('0x1f')](socket);var jayson=require(_0x69f2('0x20'));var client=jayson['client'][_0x69f2('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x34d2e7,_0x588a3a,_0x26f05c,_0x35501b){return new BPromise(function(_0x3f8d8b,_0x1e0506){var _0x35b611=_0x35501b||client;return _0x35b611[_0x69f2('0x22')](_0x34d2e7,_0x26f05c)[_0x69f2('0x23')](function(_0x499cce){logger[_0x69f2('0x24')](_0x69f2('0x25'),_0x588a3a,_0x69f2('0x26'));logger[_0x69f2('0x27')](_0x69f2('0x28'),_0x588a3a,_0x69f2('0x26'),JSON[_0x69f2('0x29')](_0x499cce));if(_0x499cce[_0x69f2('0x2a')]){if(_0x499cce[_0x69f2('0x2a')][_0x69f2('0x2b')]===0x1f4){logger[_0x69f2('0x2a')]('SmsAccount,\x20%s,\x20%s',_0x588a3a,_0x499cce['error'][_0x69f2('0x2c')]);return _0x1e0506(_0x499cce[_0x69f2('0x2a')][_0x69f2('0x2c')]);}logger[_0x69f2('0x2a')](_0x69f2('0x25'),_0x588a3a,_0x499cce[_0x69f2('0x2a')]['message']);return _0x3f8d8b(_0x499cce['error'][_0x69f2('0x2c')]);}else{logger[_0x69f2('0x24')]('SmsAccount,\x20%s,\x20%s',_0x588a3a,'request\x20sent');_0x3f8d8b(_0x499cce[_0x69f2('0x2d')][_0x69f2('0x2c')]);}})[_0x69f2('0x2e')](function(_0x16238e){logger[_0x69f2('0x2a')](_0x69f2('0x25'),_0x588a3a,_0x16238e);_0x1e0506(_0x16238e);});});}function respondWithStatusCode(_0x498814,_0x307649){_0x307649=_0x307649||0xcc;return function(_0x13156f){if(_0x13156f){return _0x498814[_0x69f2('0x2f')](_0x307649);}return _0x498814[_0x69f2('0x30')](_0x307649)[_0x69f2('0x31')]();};}function respondWithResult(_0x532018,_0x40a863){_0x40a863=_0x40a863||0xc8;return function(_0x50fca2){if(_0x50fca2){return _0x532018[_0x69f2('0x30')](_0x40a863)['json'](_0x50fca2);}};}function respondWithFilteredResult(_0x50641a,_0x494bae){return function(_0x28619c){if(_0x28619c){var _0x2baccf=typeof _0x494bae[_0x69f2('0x32')]===_0x69f2('0x33')&&typeof _0x494bae['limit']==='undefined';var _0xbe524=_0x28619c['count'];var _0x3d0c92=_0x2baccf?0x0:_0x494bae[_0x69f2('0x32')];var _0x4b89b4=_0x2baccf?_0x28619c[_0x69f2('0x34')]:_0x494bae[_0x69f2('0x32')]+_0x494bae[_0x69f2('0x35')];var _0x3d59fa;if(_0x4b89b4>=_0xbe524){_0x4b89b4=_0xbe524;_0x3d59fa=0xc8;}else{_0x3d59fa=0xce;}_0x50641a[_0x69f2('0x30')](_0x3d59fa);return _0x50641a[_0x69f2('0x36')]('Content-Range',_0x3d0c92+'-'+_0x4b89b4+'/'+_0xbe524)['json'](_0x28619c);}return null;};}function patchUpdates(_0x295fbe){return function(_0x317cac){try{jsonpatch[_0x69f2('0x37')](_0x317cac,_0x295fbe,!![]);}catch(_0x1e0eb9){return BPromise['reject'](_0x1e0eb9);}return _0x317cac[_0x69f2('0x38')]();};}function saveUpdates(_0x5a8235,_0x287372){return function(_0xf7af89){if(_0xf7af89){return _0xf7af89[_0x69f2('0x39')](_0x5a8235)[_0x69f2('0x23')](function(_0x2e846b){return _0x2e846b;});}return null;};}function removeEntity(_0x59d230,_0x10e68d){return function(_0x3733bb){if(_0x3733bb){return _0x3733bb[_0x69f2('0x3a')]()[_0x69f2('0x23')](function(){var _0x457d9a=_0x3733bb[_0x69f2('0x3b')]({'plain':!![]});var _0x545a49='SmsAccounts';return db[_0x69f2('0x3c')][_0x69f2('0x3a')]({'where':{'type':_0x545a49,'resourceId':_0x457d9a['id']}})[_0x69f2('0x23')](function(){return _0x3733bb;});})['then'](function(){_0x59d230[_0x69f2('0x30')](0xcc)[_0x69f2('0x31')]();});}};}function handleEntityNotFound(_0xef5aa7,_0x2bfa9e){return function(_0x61857b){if(!_0x61857b){_0xef5aa7[_0x69f2('0x2f')](0x194);}return _0x61857b;};}function handleError(_0x4255a4,_0x57bfe5){_0x57bfe5=_0x57bfe5||0x1f4;return function(_0x11ad5a){logger[_0x69f2('0x2a')](_0x11ad5a['stack']);if(_0x11ad5a[_0x69f2('0x3d')]){delete _0x11ad5a[_0x69f2('0x3d')];}_0x4255a4['status'](_0x57bfe5)[_0x69f2('0x3e')](_0x11ad5a);};}exports[_0x69f2('0x3f')]=function(_0x54ecea,_0x37ce7a){var _0x7ad775={'include':[{'model':db[_0x69f2('0x40')],'as':_0x69f2('0x41')}]},_0x5d6f24={},_0x20d27a={'count':0x0,'rows':[]};var _0x50446d=_[_0x69f2('0x42')](db[_0x69f2('0x43')][_0x69f2('0x44')],function(_0x4c34ed){return{'name':_0x4c34ed['fieldName'],'type':_0x4c34ed[_0x69f2('0x45')]['key']};});_0x5d6f24[_0x69f2('0x46')]=_['map'](_0x50446d,'name');_0x5d6f24[_0x69f2('0x47')]=_[_0x69f2('0x48')](_0x54ecea['query']);_0x5d6f24[_0x69f2('0x49')]=_['intersection'](_0x5d6f24[_0x69f2('0x46')],_0x5d6f24['query']);_0x7ad775[_0x69f2('0x4a')]=_[_0x69f2('0x4b')](_0x5d6f24[_0x69f2('0x46')],qs['fields'](_0x54ecea[_0x69f2('0x47')][_0x69f2('0x4c')]));_0x7ad775[_0x69f2('0x4a')]=_0x7ad775[_0x69f2('0x4a')][_0x69f2('0x4d')]?_0x7ad775[_0x69f2('0x4a')]:_0x5d6f24[_0x69f2('0x46')];if(!_0x54ecea[_0x69f2('0x47')][_0x69f2('0x4e')](_0x69f2('0x4f'))){_0x7ad775[_0x69f2('0x35')]=qs[_0x69f2('0x35')](_0x54ecea['query'][_0x69f2('0x35')]);_0x7ad775[_0x69f2('0x32')]=qs[_0x69f2('0x32')](_0x54ecea[_0x69f2('0x47')]['offset']);}_0x7ad775['order']=qs[_0x69f2('0x50')](_0x54ecea[_0x69f2('0x47')][_0x69f2('0x50')]);_0x7ad775['where']=qs[_0x69f2('0x49')](_['pick'](_0x54ecea['query'],_0x5d6f24[_0x69f2('0x49')]),_0x50446d);if(_0x54ecea['query']['filter']){_0x7ad775[_0x69f2('0x51')]=_[_0x69f2('0x52')](_0x7ad775['where'],{'$or':_[_0x69f2('0x42')](_0x50446d,function(_0x367f1f){if(_0x367f1f['type']!==_0x69f2('0x53')){var _0x1101ce={};_0x1101ce[_0x367f1f[_0x69f2('0x3d')]]={'$like':'%'+_0x54ecea[_0x69f2('0x47')][_0x69f2('0x54')]+'%'};return _0x1101ce;}})});}_0x7ad775=_[_0x69f2('0x52')]({},_0x7ad775,_0x54ecea[_0x69f2('0x55')]);var _0x1caadc={'where':_0x7ad775[_0x69f2('0x51')]};return db['SmsAccount'][_0x69f2('0x34')](_0x1caadc)[_0x69f2('0x23')](function(_0xcad705){_0x20d27a[_0x69f2('0x34')]=_0xcad705;if(_0x54ecea[_0x69f2('0x47')]['includeAll']){_0x7ad775[_0x69f2('0x56')]=[{'all':!![]}];}return db[_0x69f2('0x43')]['findAll'](_0x7ad775);})[_0x69f2('0x23')](function(_0x31b7ad){_0x20d27a['rows']=_0x31b7ad;return _0x20d27a;})[_0x69f2('0x23')](respondWithFilteredResult(_0x37ce7a,_0x7ad775))[_0x69f2('0x2e')](handleError(_0x37ce7a,null));};exports['show']=function(_0x450ddf,_0x437017){var _0x36bab2={'raw':![],'where':{'id':_0x450ddf[_0x69f2('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x69f2('0x41')}]},_0xf65464={};_0xf65464['model']=_[_0x69f2('0x48')](db[_0x69f2('0x43')][_0x69f2('0x44')]);_0xf65464['query']=_[_0x69f2('0x48')](_0x450ddf[_0x69f2('0x47')]);_0xf65464[_0x69f2('0x49')]=_[_0x69f2('0x4b')](_0xf65464[_0x69f2('0x46')],_0xf65464[_0x69f2('0x47')]);_0x36bab2[_0x69f2('0x4a')]=_[_0x69f2('0x4b')](_0xf65464[_0x69f2('0x46')],qs['fields'](_0x450ddf[_0x69f2('0x47')][_0x69f2('0x4c')]));_0x36bab2[_0x69f2('0x4a')]=_0x36bab2[_0x69f2('0x4a')]['length']?_0x36bab2[_0x69f2('0x4a')]:_0xf65464[_0x69f2('0x46')];if(_0x450ddf[_0x69f2('0x47')]['includeAll']){_0x36bab2[_0x69f2('0x56')]=[{'all':!![]}];}_0x36bab2=_[_0x69f2('0x52')]({},_0x36bab2,_0x450ddf[_0x69f2('0x55')]);return db[_0x69f2('0x43')][_0x69f2('0x58')](_0x36bab2)[_0x69f2('0x23')](handleEntityNotFound(_0x437017,null))[_0x69f2('0x23')](respondWithResult(_0x437017,null))[_0x69f2('0x2e')](handleError(_0x437017,null));};exports[_0x69f2('0x59')]=function(_0x37bcd9,_0x13f74d){return db[_0x69f2('0x43')][_0x69f2('0x59')](_0x37bcd9[_0x69f2('0x5a')],{})['then'](function(_0x8415b){var _0x3045dc=_0x37bcd9[_0x69f2('0x5b')][_0x69f2('0x3b')]({'plain':!![]});if(!_0x3045dc)throw new Error(_0x69f2('0x5c'));if(_0x3045dc[_0x69f2('0x5d')]==='user'){var _0x10096e=_0x8415b[_0x69f2('0x3b')]({'plain':!![]});var _0xf2283c='SmsAccounts';return db['UserProfileSection'][_0x69f2('0x58')]({'where':{'name':_0xf2283c,'userProfileId':_0x3045dc[_0x69f2('0x5e')]},'raw':!![]})['then'](function(_0x177857){if(_0x177857&&_0x177857[_0x69f2('0x5f')]===0x0){return db[_0x69f2('0x3c')][_0x69f2('0x59')]({'name':_0x10096e[_0x69f2('0x3d')],'resourceId':_0x10096e['id'],'type':_0x177857[_0x69f2('0x3d')],'sectionId':_0x177857['id']},{})[_0x69f2('0x23')](function(){return _0x8415b;});}else{return _0x8415b;}})[_0x69f2('0x2e')](function(_0x117ac2){logger[_0x69f2('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x117ac2);throw _0x117ac2;});}return _0x8415b;})[_0x69f2('0x23')](respondWithResult(_0x13f74d,0xc9))['catch'](handleError(_0x13f74d,null));};exports[_0x69f2('0x39')]=function(_0x5c9c97,_0x543515){if(_0x5c9c97[_0x69f2('0x5a')]['id']){delete _0x5c9c97[_0x69f2('0x5a')]['id'];}return db[_0x69f2('0x43')]['find']({'where':{'id':_0x5c9c97['params']['id']},'include':[{'model':db[_0x69f2('0x40')],'as':'mandatoryDispositionPause'}]})[_0x69f2('0x23')](handleEntityNotFound(_0x543515,null))[_0x69f2('0x23')](saveUpdates(_0x5c9c97[_0x69f2('0x5a')],null))[_0x69f2('0x23')](respondWithResult(_0x543515,null))['catch'](handleError(_0x543515,null));};exports[_0x69f2('0x3a')]=function(_0x23bab7,_0x390927){return db[_0x69f2('0x43')]['find']({'where':{'id':_0x23bab7[_0x69f2('0x57')]['id']}})[_0x69f2('0x23')](handleEntityNotFound(_0x390927,null))[_0x69f2('0x23')](removeEntity(_0x390927,null))['catch'](handleError(_0x390927,null));};exports[_0x69f2('0x60')]=function(_0x184f31,_0x5a9e08){return db[_0x69f2('0x43')][_0x69f2('0x60')]()[_0x69f2('0x23')](respondWithResult(_0x5a9e08,null))[_0x69f2('0x2e')](handleError(_0x5a9e08,null));};exports[_0x69f2('0x61')]=function(_0x1339a4,_0x4d6d8c,_0x42f236){if(_0x1339a4[_0x69f2('0x5a')]['id']){delete _0x1339a4[_0x69f2('0x5a')]['id'];}return db['SmsAccount'][_0x69f2('0x58')]({'where':{'id':_0x1339a4[_0x69f2('0x57')]['id']}})['then'](handleEntityNotFound(_0x4d6d8c,null))[_0x69f2('0x23')](function(_0x434d53){if(_0x434d53){_0x1339a4[_0x69f2('0x5a')][_0x69f2('0x62')]=_0x434d53['id'];return db['Disposition'][_0x69f2('0x59')](_0x1339a4[_0x69f2('0x5a')]);}})[_0x69f2('0x23')](respondWithResult(_0x4d6d8c,null))['catch'](handleError(_0x4d6d8c,null));};exports[_0x69f2('0x63')]=function(_0x533e03,_0x186f57,_0x33d754){var _0x28ca7b={'raw':![],'where':{}};var _0x54f8a5={};var _0x422417={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x533e03[_0x69f2('0x57')]['id']}})[_0x69f2('0x23')](handleEntityNotFound(_0x186f57,null))['then'](function(_0x13d92b){if(_0x13d92b){_0x54f8a5['model']=_[_0x69f2('0x48')](db[_0x69f2('0x64')]['rawAttributes']);_0x54f8a5['query']=_['keys'](_0x533e03[_0x69f2('0x47')]);_0x54f8a5[_0x69f2('0x49')]=_[_0x69f2('0x4b')](_0x54f8a5[_0x69f2('0x46')],_0x54f8a5[_0x69f2('0x47')]);_0x28ca7b['attributes']=_[_0x69f2('0x4b')](_0x54f8a5[_0x69f2('0x46')],qs[_0x69f2('0x4c')](_0x533e03[_0x69f2('0x47')][_0x69f2('0x4c')]));_0x28ca7b['attributes']=_0x28ca7b['attributes'][_0x69f2('0x4d')]?_0x28ca7b[_0x69f2('0x4a')]:_0x54f8a5[_0x69f2('0x46')];if(!_0x533e03[_0x69f2('0x47')]['hasOwnProperty'](_0x69f2('0x4f'))){_0x28ca7b[_0x69f2('0x35')]=qs['limit'](_0x533e03[_0x69f2('0x47')][_0x69f2('0x35')]);_0x28ca7b['offset']=qs[_0x69f2('0x32')](_0x533e03[_0x69f2('0x47')]['offset']);}_0x28ca7b['order']=qs[_0x69f2('0x50')](_0x533e03[_0x69f2('0x47')][_0x69f2('0x50')]);_0x28ca7b[_0x69f2('0x51')]=qs[_0x69f2('0x49')](_['pick'](_0x533e03[_0x69f2('0x47')],_0x54f8a5[_0x69f2('0x49')]));_0x28ca7b[_0x69f2('0x51')][_0x69f2('0x62')]=_0x13d92b['id'];if(_0x533e03[_0x69f2('0x47')][_0x69f2('0x54')]){_0x28ca7b[_0x69f2('0x51')]=_['merge'](_0x28ca7b[_0x69f2('0x51')],{'$or':_[_0x69f2('0x42')](_0x28ca7b[_0x69f2('0x4a')],function(_0x4caae2){var _0x19f567={};_0x19f567[_0x4caae2]={'$like':'%'+_0x533e03[_0x69f2('0x47')][_0x69f2('0x54')]+'%'};return _0x19f567;})});}_0x28ca7b=_[_0x69f2('0x52')]({},_0x28ca7b,_0x533e03[_0x69f2('0x55')]);return db['Disposition'][_0x69f2('0x34')]({'where':_0x28ca7b['where']})['then'](function(_0x311908){_0x422417['count']=_0x311908;if(_0x533e03[_0x69f2('0x47')][_0x69f2('0x65')]){_0x28ca7b[_0x69f2('0x56')]=[{'all':!![]}];}return db[_0x69f2('0x64')][_0x69f2('0x66')](_0x28ca7b);})[_0x69f2('0x23')](function(_0x569d3e){_0x422417[_0x69f2('0x67')]=_0x569d3e;return _0x422417;});}})['then'](respondWithFilteredResult(_0x186f57,_0x28ca7b))[_0x69f2('0x2e')](handleError(_0x186f57,null));};exports[_0x69f2('0x68')]=function(_0xce590d,_0x4d15ad,_0x5050fc){return db['SmsAccount'][_0x69f2('0x58')]({'where':{'id':_0xce590d[_0x69f2('0x57')]['id']}})[_0x69f2('0x23')](handleEntityNotFound(_0x4d15ad,null))[_0x69f2('0x23')](function(_0x5c307f){if(_0x5c307f){return _0x5c307f[_0x69f2('0x68')](_0xce590d[_0x69f2('0x47')]['ids']);}})[_0x69f2('0x23')](respondWithStatusCode(_0x4d15ad,null))[_0x69f2('0x2e')](handleError(_0x4d15ad,null));};exports['addAnswer']=function(_0x47cc75,_0x2b51fc,_0x558f37){if(_0x47cc75[_0x69f2('0x5a')]['id']){delete _0x47cc75[_0x69f2('0x5a')]['id'];}return db[_0x69f2('0x43')][_0x69f2('0x58')]({'where':{'id':_0x47cc75[_0x69f2('0x57')]['id']}})[_0x69f2('0x23')](handleEntityNotFound(_0x2b51fc,null))[_0x69f2('0x23')](function(_0x2ae0ad){if(_0x2ae0ad){_0x47cc75[_0x69f2('0x5a')][_0x69f2('0x62')]=_0x2ae0ad['id'];return db[_0x69f2('0x69')][_0x69f2('0x59')](_0x47cc75['body']);}})[_0x69f2('0x23')](respondWithResult(_0x2b51fc,null))[_0x69f2('0x2e')](handleError(_0x2b51fc,null));};exports['getAnswers']=function(_0x4489fa,_0x3d69b7,_0x21050e){var _0x597ae0={'raw':![],'where':{}};var _0x42cd85={};var _0x4adffc={'count':0x0,'rows':[]};return db[_0x69f2('0x43')][_0x69f2('0x6a')]({'where':{'id':_0x4489fa['params']['id']}})[_0x69f2('0x23')](handleEntityNotFound(_0x3d69b7,null))[_0x69f2('0x23')](function(_0x4d29eb){if(_0x4d29eb){_0x42cd85[_0x69f2('0x46')]=_[_0x69f2('0x48')](db[_0x69f2('0x69')]['rawAttributes']);_0x42cd85['query']=_['keys'](_0x4489fa[_0x69f2('0x47')]);_0x42cd85[_0x69f2('0x49')]=_[_0x69f2('0x4b')](_0x42cd85['model'],_0x42cd85[_0x69f2('0x47')]);_0x597ae0[_0x69f2('0x4a')]=_[_0x69f2('0x4b')](_0x42cd85[_0x69f2('0x46')],qs[_0x69f2('0x4c')](_0x4489fa[_0x69f2('0x47')][_0x69f2('0x4c')]));_0x597ae0[_0x69f2('0x4a')]=_0x597ae0[_0x69f2('0x4a')][_0x69f2('0x4d')]?_0x597ae0['attributes']:_0x42cd85[_0x69f2('0x46')];if(!_0x4489fa[_0x69f2('0x47')][_0x69f2('0x4e')](_0x69f2('0x4f'))){_0x597ae0[_0x69f2('0x35')]=qs[_0x69f2('0x35')](_0x4489fa['query']['limit']);_0x597ae0[_0x69f2('0x32')]=qs[_0x69f2('0x32')](_0x4489fa[_0x69f2('0x47')]['offset']);}_0x597ae0[_0x69f2('0x6b')]=qs[_0x69f2('0x50')](_0x4489fa[_0x69f2('0x47')][_0x69f2('0x50')]);_0x597ae0[_0x69f2('0x51')]=qs[_0x69f2('0x49')](_[_0x69f2('0x6c')](_0x4489fa[_0x69f2('0x47')],_0x42cd85[_0x69f2('0x49')]));_0x597ae0['where'][_0x69f2('0x62')]=_0x4d29eb['id'];if(_0x4489fa[_0x69f2('0x47')]['filter']){_0x597ae0[_0x69f2('0x51')]=_[_0x69f2('0x52')](_0x597ae0[_0x69f2('0x51')],{'$or':_[_0x69f2('0x42')](_0x597ae0[_0x69f2('0x4a')],function(_0x585dbd){var _0x53b1f4={};_0x53b1f4[_0x585dbd]={'$like':'%'+_0x4489fa[_0x69f2('0x47')][_0x69f2('0x54')]+'%'};return _0x53b1f4;})});}_0x597ae0=_[_0x69f2('0x52')]({},_0x597ae0,_0x4489fa[_0x69f2('0x55')]);return db[_0x69f2('0x69')][_0x69f2('0x34')]({'where':_0x597ae0[_0x69f2('0x51')]})[_0x69f2('0x23')](function(_0x25c17e){_0x4adffc[_0x69f2('0x34')]=_0x25c17e;if(_0x4489fa[_0x69f2('0x47')][_0x69f2('0x65')]){_0x597ae0[_0x69f2('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0x69f2('0x66')](_0x597ae0);})[_0x69f2('0x23')](function(_0x18b190){_0x4adffc[_0x69f2('0x67')]=_0x18b190;return _0x4adffc;});}})[_0x69f2('0x23')](respondWithFilteredResult(_0x3d69b7,_0x597ae0))['catch'](handleError(_0x3d69b7,null));};exports[_0x69f2('0x6d')]=function(_0x4efdde,_0x10a65d,_0x228248){return db[_0x69f2('0x43')][_0x69f2('0x58')]({'where':{'id':_0x4efdde[_0x69f2('0x57')]['id']}})[_0x69f2('0x23')](handleEntityNotFound(_0x10a65d,null))[_0x69f2('0x23')](function(_0x5cccc3){if(_0x5cccc3){return _0x5cccc3[_0x69f2('0x6d')](_0x4efdde[_0x69f2('0x47')][_0x69f2('0x6e')]);}})[_0x69f2('0x23')](respondWithStatusCode(_0x10a65d,null))[_0x69f2('0x2e')](handleError(_0x10a65d,null));};exports['notify']=function(_0x4c09b8,_0x17c29a,_0x20e754){var _0x5f5681={'channel':_0x69f2('0x6f')};var _0x5853ad=[];var _0x5b6c8e=[];var _0x241541={};return db['SmsAccount'][_0x69f2('0x58')]({'where':{'id':_0x4c09b8[_0x69f2('0x57')]['id']},'include':[{'model':db[_0x69f2('0x70')],'as':_0x69f2('0x71')}]})[_0x69f2('0x23')](handleEntityNotFound(_0x17c29a,null))['then'](function(_0x1654bf){_0x5f5681[_0x69f2('0x72')]=_0x1654bf;_0x5f5681[_0x69f2('0x73')]=_[_0x69f2('0x74')](_0x1654bf[_0x69f2('0x71')],[_0x69f2('0x75')],[_0x69f2('0x76')]);if(_0x5f5681['account']['Applications']){delete _0x5f5681[_0x69f2('0x72')][_0x69f2('0x71')];}return db['CmContact'][_0x69f2('0x60')]();})[_0x69f2('0x23')](function(_0x143c48){if(!_0x143c48){throw new db['Sequelize']['ValidationError'](_0x69f2('0x77'));}_0x5853ad=_[_0x69f2('0x78')](_[_0x69f2('0x48')](_0x143c48),['createdAt','updatedAt']);_0x5b6c8e=_[_0x69f2('0x78')](_[_0x69f2('0x48')](_0x143c48),[_0x69f2('0x79'),_0x69f2('0x7a'),_0x69f2('0x7b'),_0x69f2('0x7c')]);_0x5f5681[_0x69f2('0x5a')]={'mapKey':_0x69f2('0x7d')};if(_0x5f5681['account']['type']){switch(_0x5f5681[_0x69f2('0x72')][_0x69f2('0x45')]){case _0x69f2('0x7e'):_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x7f')]=_0x4c09b8['body'][_0x69f2('0x80')];_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x5a')]=_0x4c09b8['body'][_0x69f2('0x81')];_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x82')]=_0x4c09b8[_0x69f2('0x5a')][_0x69f2('0x83')];break;case _0x69f2('0x84'):_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x7f')]='+'+_0x4c09b8['body']['sender'];_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x5a')]=_0x4c09b8[_0x69f2('0x5a')][_0x69f2('0x85')];break;case _0x69f2('0x86'):_0x5f5681['body'][_0x69f2('0x7f')]=_0x4c09b8[_0x69f2('0x5a')]['from'];_0x5f5681['body'][_0x69f2('0x5a')]=_0x4c09b8['body'][_0x69f2('0x2c')];break;case _0x69f2('0x87'):_0x5f5681['body']['from']=_0x4c09b8[_0x69f2('0x5a')]['from'];_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x5a')]=_0x4c09b8['body'][_0x69f2('0x5a')];_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x82')]=_0x4c09b8[_0x69f2('0x5a')][_0x69f2('0x88')];break;case _0x69f2('0x89'):_0x5f5681[_0x69f2('0x5a')]['from']=_0x4c09b8[_0x69f2('0x5a')][_0x69f2('0x80')];_0x5f5681['body']['body']=_0x4c09b8['body'][_0x69f2('0x8a')];_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x82')]=_0x4c09b8[_0x69f2('0x5a')][_0x69f2('0x8b')];break;case _0x69f2('0x8c'):_0x5f5681[_0x69f2('0x5a')]['from']='+'+_0x4c09b8['body'][_0x69f2('0x8d')][0x0]['from'];_0x5f5681['body'][_0x69f2('0x5a')]=_0x4c09b8[_0x69f2('0x5a')][_0x69f2('0x8d')][0x0][_0x69f2('0x85')];_0x5f5681['body']['messageId']=_0x4c09b8[_0x69f2('0x5a')][_0x69f2('0x8d')][0x0][_0x69f2('0x82')];break;case _0x69f2('0x8e'):_0x5f5681[_0x69f2('0x5a')]['from']=_0x4c09b8[_0x69f2('0x5a')][_0x69f2('0x8f')];_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x5a')]=_0x4c09b8[_0x69f2('0x5a')][_0x69f2('0x90')][_0x69f2('0x2c')];break;case _0x69f2('0x91'):_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x7f')]=_0x4c09b8[_0x69f2('0x5a')][_0x69f2('0x92')];_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x5a')]=_0x4c09b8['body'][_0x69f2('0x85')];_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x82')]=_0x4c09b8['body'][_0x69f2('0x93')];break;case _0x69f2('0x94'):_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x82')]=_0x4c09b8[_0x69f2('0x5a')][0x0][_0x69f2('0x2c')]['id'];_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x7f')]=_0x4c09b8['body'][0x0]['message'][_0x69f2('0x7f')];_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x5a')]=_0x4c09b8[_0x69f2('0x5a')][0x0]['message'][_0x69f2('0x85')];break;case _0x69f2('0x95'):_0x5f5681['body'][_0x69f2('0x7f')]=_0x4c09b8[_0x69f2('0x5a')]['from'];_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x5a')]=_0x4c09b8['body'][_0x69f2('0x2c')];_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x82')]=_0x4c09b8[_0x69f2('0x5a')][_0x69f2('0x96')];break;}}if(_0x5f5681[_0x69f2('0x5a')]['id']){delete _0x5f5681[_0x69f2('0x5a')]['id'];}if(_[_0x69f2('0x97')](_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x7f')])){throw new db[(_0x69f2('0x98'))][(_0x69f2('0x99'))](_0x69f2('0x9a'));}if(_[_0x69f2('0x97')](_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x5a')])||_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x5a')]===''){throw new db[(_0x69f2('0x98'))][(_0x69f2('0x99'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x9b')])){throw new db['Sequelize']['ValidationError'](_0x69f2('0x9c')+_0x5b6c8e);}if(!_[_0x69f2('0x9d')](_0x5b6c8e,_0x5f5681['body'][_0x69f2('0x9b')])){throw new db[(_0x69f2('0x98'))][(_0x69f2('0x99'))](_0x69f2('0x9e')+_0x5b6c8e);}_0x241541[_0x5f5681[_0x69f2('0x5a')]['mapKey']]=_0x5f5681['body']['from'];return db['CmList'][_0x69f2('0x58')]({'where':{'id':_0x5f5681['account'][_0x69f2('0x7c')]},'include':[{'model':db[_0x69f2('0x9f')],'as':_0x69f2('0xa0'),'where':_0x241541,'limit':0x1,'order':[[_0x69f2('0x7a'),_0x69f2('0xa1')]]}]});})[_0x69f2('0x23')](handleEntityNotFound(_0x17c29a,null))[_0x69f2('0x23')](function(_0xa2a792){if(_0xa2a792){_0x5f5681['list']=_[_0x69f2('0xa2')](_0xa2a792,[_0x69f2('0xa0')]);if(_0xa2a792[_0x69f2('0xa0')][_0x69f2('0x4d')]){return _0xa2a792['Contacts'][0x0];}var _0x3971b5=_[_0x69f2('0xa3')](_0x5f5681[_0x69f2('0x5a')],{'firstName':_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x7f')],'ListId':_0xa2a792['id']});_0x3971b5[_0x5f5681[_0x69f2('0x5a')]['mapKey']]=_0x5f5681['body']['from'];return db['CmContact'][_0x69f2('0x59')](_0x3971b5,{'fields':_0x5853ad,'raw':!![]});}})[_0x69f2('0x23')](handleEntityNotFound(_0x17c29a,null))[_0x69f2('0x23')](function(_0x3cc354){if(_0x3cc354){_0x5f5681[_0x69f2('0xa4')]=_0x3cc354;var _0xf6c33c={'ContactId':_0x3cc354['id'],'phone':_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x7f')],'SmsAccountId':_0x4c09b8[_0x69f2('0x57')]['id']};var _0x582ef8={'ContactId':_0x3cc354['id'],'SmsAccountId':_0x4c09b8[_0x69f2('0x57')]['id'],'closed':![]};return db[_0x69f2('0xa5')][_0x69f2('0x58')]({'where':_0x582ef8})['then'](function(_0x57dd4f){if(_0x57dd4f){return[_0x57dd4f,![]];}return db[_0x69f2('0xa5')][_0x69f2('0x59')](_0xf6c33c)[_0x69f2('0x23')](function(_0x4393a8){return[_0x4393a8,!![]];});});}})[_0x69f2('0xa6')](function(_0x244763,_0x2bb7bb){_0x5f5681[_0x69f2('0xa7')]=_0x244763['get']({'plain':!![]});_0x5f5681['interaction'][_0x69f2('0xa8')]=![];if(_0x2bb7bb){if(_0x5f5681['account'][_0x69f2('0xa9')]){_0x5f5681[_0x69f2('0x73')][_0x69f2('0xaa')]({'id':0x0,'priority':_0x5f5681[_0x69f2('0x73')][_0x69f2('0x4d')]+0x1,'app':_0x69f2('0xab'),'appdata':_0x69f2('0xac'),'interval':_0x69f2('0xad')});}_0x5f5681[_0x69f2('0xa7')]['created']=!![];}return db['SmsMessage'][_0x69f2('0x59')]({'phone':_0x5f5681[_0x69f2('0x5a')]['from'],'messageId':_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x82')],'body':_0x5f5681[_0x69f2('0x5a')][_0x69f2('0x5a')],'SmsAccountId':_0x4c09b8['params']['id'],'SmsInteractionId':_0x244763['id'],'direction':'in','ContactId':_0x244763[_0x69f2('0xae')],'AttachmentId':_0x5f5681[_0x69f2('0x5a')]['AttachmentId']});})[_0x69f2('0x23')](function(_0x20613d){_0x5f5681['message']=_0x20613d;if(!_0x5f5681[_0x69f2('0xa7')][_0x69f2('0xaf')])return;return db[_0x69f2('0xb0')][_0x69f2('0x58')]({'attributes':['id','name'],'where':{'id':_0x5f5681['interaction'][_0x69f2('0xaf')]}});})['then'](function(_0x13cd2d){if(_0x13cd2d){_0x5f5681['applications'][_0x69f2('0xb1')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x13cd2d[_0x69f2('0x3d')]+','+(_0x5f5681['account'][_0x69f2('0xb2')]||0xa),'interval':_0x69f2('0xad')});}if(!_0x5f5681[_0x69f2('0xa7')][_0x69f2('0xb3')])return;return db['SmsQueue'][_0x69f2('0x58')]({'attributes':['id','name'],'where':{'id':_0x5f5681[_0x69f2('0xa7')]['queueId']}});})['then'](function(_0x412ed9){if(_0x412ed9){_0x5f5681[_0x69f2('0x73')][_0x69f2('0xb1')]({'id':0x0,'priority':0x1,'app':_0x69f2('0xb4'),'appdata':_0x412ed9['name']+','+(_0x5f5681[_0x69f2('0x72')][_0x69f2('0xb5')]||0x12c),'interval':_0x69f2('0xad')});}return respondWithRpcPromise(_0x69f2('0xb6'),'startRouting',_0x5f5681);})['then'](function(_0x31dd10){if(_0x31dd10){var _0xaf3bdb=0xc8;var _0x3db139=_0x69f2('0xb7');logger[_0x69f2('0x24')](_0x69f2('0x28'),_0x3db139,_0xaf3bdb,_0x69f2('0xb8'));logger[_0x69f2('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x3db139,_0xaf3bdb,'entity\x20found',JSON[_0x69f2('0x29')](_0x31dd10));if(_0x5f5681['account']['type']===_0x69f2('0x7e')){return _0x17c29a[_0x69f2('0x30')](_0xaf3bdb)[_0x69f2('0x36')](_0x69f2('0xb9'),'text/xml')[_0x69f2('0x3e')](_0x69f2('0xba'));}else{return _0x17c29a[_0x69f2('0x30')](_0xaf3bdb)['json'](_0x31dd10);}}})['catch'](handleError(_0x17c29a,null));};exports[_0x69f2('0xbb')]=function(_0x37ccc1,_0x1b40f9){var _0x29abd7=_0x37ccc1[_0x69f2('0x57')]['id'];var _0x2ab76c=_0x37ccc1[_0x69f2('0x5a')];var _0x3f95fe=0xc8;var _0x4788c8=null;return db[_0x69f2('0xbc')][_0x69f2('0xbd')]({'isolationLevel':db['sequelize'][_0x69f2('0xbe')]['ISOLATION_LEVELS'][_0x69f2('0xbf')]},function(_0x15e1a2){return db['SmsAccount'][_0x69f2('0x6a')]({'where':{'id':_0x29abd7},'transaction':_0x15e1a2})[_0x69f2('0x23')](function(_0x38ea4b){if(_0x38ea4b){return db[_0x69f2('0x70')][_0x69f2('0x3a')]({'where':{'SmsAccountId':_0x29abd7},'transaction':_0x15e1a2})['then'](function(){var _0x5e619d=_[_0x69f2('0x42')](_0x2ab76c,function(_0x27947a){_0x27947a['SmsAccountId']=_0x29abd7;return _0x27947a;});return db[_0x69f2('0x70')][_0x69f2('0xc0')](_0x5e619d,{'transaction':_0x15e1a2});});}else{_0x3f95fe=0x194;_0x4788c8=[];}});})[_0x69f2('0x23')](function(){if(_0x3f95fe!==0x194){return db[_0x69f2('0x70')]['findAndCountAll']({'where':{'SmsAccountId':_0x29abd7},'order':_0x69f2('0x75')})[_0x69f2('0x23')](function(_0x4b4b9d){_0x4788c8=_0x4b4b9d;});}})[_0x69f2('0x2e')](function(_0x5cc82e){_0x3f95fe=0x1f4;logger[_0x69f2('0x2a')](_0x5cc82e[_0x69f2('0xc1')]);if(_0x5cc82e[_0x69f2('0x3d')]){delete _0x5cc82e['name'];}_0x4788c8=_0x5cc82e;})['finally'](function(){if(_0x4788c8===null){_0x1b40f9[_0x69f2('0x2f')](_0x3f95fe);}else{if(_0x3f95fe===0x1f4){_0x1b40f9['status'](_0x3f95fe)[_0x69f2('0x3e')](_0x4788c8);}else{_0x1b40f9['status'](_0x3f95fe)[_0x69f2('0xc2')](_0x4788c8);}}});};exports[_0x69f2('0xc3')]=function(_0x5eda63,_0x288f5e,_0x4834b6){var _0x130d85={};var _0x3653c4={};var _0x5791b0;var _0x3d9746;return db[_0x69f2('0x43')][_0x69f2('0x6a')]({'where':{'id':_0x5eda63['params']['id']}})[_0x69f2('0x23')](handleEntityNotFound(_0x288f5e,null))[_0x69f2('0x23')](function(_0x34a578){if(_0x34a578){_0x5791b0=_0x34a578;_0x3653c4[_0x69f2('0x46')]=_[_0x69f2('0x48')](db[_0x69f2('0x70')]['rawAttributes']);_0x3653c4[_0x69f2('0x47')]=_[_0x69f2('0x48')](_0x5eda63[_0x69f2('0x47')]);_0x3653c4[_0x69f2('0x49')]=_[_0x69f2('0x4b')](_0x3653c4['model'],_0x3653c4[_0x69f2('0x47')]);_0x130d85[_0x69f2('0x4a')]=_[_0x69f2('0x4b')](_0x3653c4[_0x69f2('0x46')],qs[_0x69f2('0x4c')](_0x5eda63[_0x69f2('0x47')][_0x69f2('0x4c')]));_0x130d85[_0x69f2('0x4a')]=_0x130d85[_0x69f2('0x4a')]['length']?_0x130d85[_0x69f2('0x4a')]:_0x3653c4[_0x69f2('0x46')];_0x130d85[_0x69f2('0x6b')]=qs[_0x69f2('0x50')](_0x5eda63[_0x69f2('0x47')][_0x69f2('0x50')]);_0x130d85[_0x69f2('0x51')]=qs[_0x69f2('0x49')](_[_0x69f2('0x6c')](_0x5eda63['query'],_0x3653c4[_0x69f2('0x49')]));if(_0x5eda63[_0x69f2('0x47')]['filter']){_0x130d85[_0x69f2('0x51')]=_[_0x69f2('0x52')](_0x130d85[_0x69f2('0x51')],{'$or':_[_0x69f2('0x42')](_0x130d85['attributes'],function(_0x189f4c){var _0x438561={};_0x438561[_0x189f4c]={'$like':'%'+_0x5eda63[_0x69f2('0x47')][_0x69f2('0x54')]+'%'};return _0x438561;})});}_0x130d85=_[_0x69f2('0x52')]({},_0x130d85,_0x5eda63[_0x69f2('0x55')]);return _0x5791b0[_0x69f2('0xc3')](_0x130d85);}})[_0x69f2('0x23')](function(_0x4e588b){if(_0x4e588b){_0x3d9746=_0x4e588b[_0x69f2('0x4d')];if(!_0x5eda63[_0x69f2('0x47')][_0x69f2('0x4e')](_0x69f2('0x4f'))){_0x130d85[_0x69f2('0x35')]=qs[_0x69f2('0x35')](_0x5eda63[_0x69f2('0x47')][_0x69f2('0x35')]);_0x130d85[_0x69f2('0x32')]=qs[_0x69f2('0x32')](_0x5eda63[_0x69f2('0x47')][_0x69f2('0x32')]);}return _0x5791b0[_0x69f2('0xc3')](_0x130d85);}})[_0x69f2('0x23')](function(_0x45cbae){if(_0x45cbae){return _0x45cbae?{'count':_0x3d9746,'rows':_0x45cbae}:null;}})[_0x69f2('0x23')](respondWithResult(_0x288f5e,null))[_0x69f2('0x2e')](handleError(_0x288f5e,null));};exports[_0x69f2('0xc4')]=function(_0x31c741,_0x472b9e,_0x29dc86){var _0x2795b0={'raw':![],'where':{}};var _0x5e794b={};var _0x3e76ce={'count':0x0,'rows':[]};return db[_0x69f2('0x43')][_0x69f2('0x6a')]({'where':{'id':_0x31c741[_0x69f2('0x57')]['id']}})['then'](handleEntityNotFound(_0x472b9e,null))[_0x69f2('0x23')](function(_0x7ecece){if(_0x7ecece){_0x5e794b[_0x69f2('0x46')]=_[_0x69f2('0x48')](db[_0x69f2('0xa5')][_0x69f2('0x44')]);_0x5e794b[_0x69f2('0x47')]=_[_0x69f2('0x48')](_0x31c741[_0x69f2('0x47')]);_0x5e794b['filters']=_[_0x69f2('0x4b')](_0x5e794b['model'],_0x5e794b[_0x69f2('0x47')]);_0x2795b0[_0x69f2('0x4a')]=_[_0x69f2('0x4b')](_0x5e794b[_0x69f2('0x46')],qs['fields'](_0x31c741[_0x69f2('0x47')][_0x69f2('0x4c')]));_0x2795b0[_0x69f2('0x4a')]=_0x2795b0[_0x69f2('0x4a')][_0x69f2('0x4d')]?_0x2795b0[_0x69f2('0x4a')]:_0x5e794b[_0x69f2('0x46')];if(!_0x31c741[_0x69f2('0x47')][_0x69f2('0x4e')](_0x69f2('0x4f'))){_0x2795b0['limit']=qs[_0x69f2('0x35')](_0x31c741['query'][_0x69f2('0x35')]);_0x2795b0['offset']=qs[_0x69f2('0x32')](_0x31c741[_0x69f2('0x47')]['offset']);}_0x2795b0[_0x69f2('0x6b')]=qs[_0x69f2('0x50')](_0x31c741[_0x69f2('0x47')][_0x69f2('0x50')]);_0x2795b0[_0x69f2('0x51')]=qs[_0x69f2('0x49')](_[_0x69f2('0x6c')](_0x31c741[_0x69f2('0x47')],_0x5e794b[_0x69f2('0x49')]));_0x2795b0[_0x69f2('0x51')]['SmsAccountId']=_0x7ecece['id'];if(_0x31c741['query']['filter']){_0x2795b0[_0x69f2('0x51')]=_[_0x69f2('0x52')](_0x2795b0['where'],{'$or':_['map'](_0x2795b0['attributes'],function(_0x5b31e5){var _0x5ad40a={};_0x5ad40a[_0x5b31e5]={'$like':'%'+_0x31c741[_0x69f2('0x47')][_0x69f2('0x54')]+'%'};return _0x5ad40a;})});}_0x2795b0=_[_0x69f2('0x52')]({},_0x2795b0,_0x31c741[_0x69f2('0x55')]);return db[_0x69f2('0xa5')][_0x69f2('0x34')]({'where':_0x2795b0[_0x69f2('0x51')]})[_0x69f2('0x23')](function(_0x52af56){_0x3e76ce[_0x69f2('0x34')]=_0x52af56;if(_0x31c741[_0x69f2('0x47')][_0x69f2('0x65')]){_0x2795b0['include']=[{'model':db[_0x69f2('0x9f')],'as':'Contact','required':![]},{'model':db[_0x69f2('0xb0')],'as':_0x69f2('0xc5'),'attributes':[_0x69f2('0x3d'),_0x69f2('0xc6'),_0x69f2('0xc7')],'required':![]},{'model':db['Tag'],'as':_0x69f2('0xc8'),'attributes':['id',_0x69f2('0x3d'),_0x69f2('0xc9')],'where':_0x31c741['query'][_0x69f2('0xca')]?{'id':_0x31c741[_0x69f2('0x47')]['tag']}:undefined,'required':_0x31c741['query']['tag']?!![]:![]}];}return db[_0x69f2('0xa5')][_0x69f2('0x66')](_0x2795b0);})['then'](function(_0x2698dd){_0x3e76ce['rows']=_0x2698dd;return _0x3e76ce;});}})[_0x69f2('0x23')](respondWithFilteredResult(_0x472b9e,_0x2795b0))['catch'](handleError(_0x472b9e,null));};exports[_0x69f2('0x3e')]=function(_0x5c03e4,_0x1c65a6,_0x4267c1){var _0x485e59,_0x44a74b,_0xf9f9b2;if(_[_0x69f2('0x97')](_0x5c03e4[_0x69f2('0x5a')][_0x69f2('0x5a')])||_0x5c03e4[_0x69f2('0x5a')][_0x69f2('0x5a')]===''){throw new db[(_0x69f2('0x98'))][(_0x69f2('0x99'))](_0x69f2('0xcb'));}if(_[_0x69f2('0x97')](_0x5c03e4[_0x69f2('0x5a')]['to'])){throw new db[(_0x69f2('0x98'))][(_0x69f2('0x99'))]('to\x20is\x20mandatory');}_0x485e59=_0x5c03e4['body']['to'];return db['SmsAccount']['find']({'where':{'id':_0x5c03e4[_0x69f2('0x57')]['id']},'include':[{'model':db[_0x69f2('0xcc')],'as':_0x69f2('0xcd'),'include':[{'model':db[_0x69f2('0x9f')],'as':_0x69f2('0xa0'),'where':{'mobile':_0x485e59},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x69f2('0x23')](handleEntityNotFound(_0x1c65a6,null))[_0x69f2('0x23')](function(_0x438c5c){if(_0x438c5c&&_0x438c5c[_0x69f2('0xcd')]){_0x44a74b=_0x438c5c['get']({'plain':!![]});if(_0x44a74b[_0x69f2('0xcd')]&&_0x44a74b['List'][_0x69f2('0xa0')]['length']){return _0x44a74b['List']['Contacts'][0x0];}return db[_0x69f2('0x9f')][_0x69f2('0x59')](_[_0x69f2('0xa3')](_0x5c03e4[_0x69f2('0x5a')],{'firstName':_0x485e59,'mobile':_0x485e59,'phone':_0x485e59,'ListId':_0x44a74b[_0x69f2('0x7c')]}));}})[_0x69f2('0x23')](handleEntityNotFound(_0x1c65a6,null))['then'](function(_0x33239b){if(_0x33239b){_0xf9f9b2=_0x33239b;return db['SmsInteraction'][_0x69f2('0x58')]({'where':{'ContactId':_0xf9f9b2['id'],'closed':![],'SmsAccountId':_0x44a74b['id']}})['then'](function(_0xd93384){if(_0xd93384){return[_0xd93384,![]];}return db[_0x69f2('0xa5')][_0x69f2('0x59')]({'UserId':_0x5c03e4[_0x69f2('0x5b')]['id'],'ContactId':_0xf9f9b2['id'],'SmsAccountId':_0x44a74b['id'],'phone':_0x485e59,'firstMsgDirection':_0x69f2('0xce'),'Messages':[_['merge'](_0x5c03e4[_0x69f2('0x5a')],{'read':![],'body':_0x5c03e4[_0x69f2('0x5a')][_0x69f2('0x5a')],'phone':_0x485e59,'SmsAccountId':_0x44a74b['id'],'UserId':_0x5c03e4[_0x69f2('0x5b')]['id'],'ContactId':_0xf9f9b2['id']})]},{'include':[{'model':db[_0x69f2('0xcf')],'as':'Messages'}]})['then'](function(_0x56b096){return[_0x56b096,!![]];});});}})['spread'](function(_0x220cf7,_0x16844e){if(_0x16844e){return _0x220cf7;}return db['SmsMessage'][_0x69f2('0x59')](_['merge'](_0x5c03e4['body'],{'read':![],'body':_0x5c03e4[_0x69f2('0x5a')][_0x69f2('0x5a')],'phone':_0x485e59,'SmsAccountId':_0x44a74b['id'],'SmsInteractionId':_0x220cf7['id'],'UserId':_0x5c03e4[_0x69f2('0x5b')]['id'],'ContactId':_0xf9f9b2['id']}))[_0x69f2('0x23')](function(_0xaa0e56){_0x220cf7[_0x69f2('0xd0')][_0x69f2('0xd1')]=[];_0x220cf7[_0x69f2('0xd0')][_0x69f2('0xd1')]['push'](_0xaa0e56[_0x69f2('0xd0')]);return _0x220cf7;});})['then'](respondWithResult(_0x1c65a6,null))[_0x69f2('0x2e')](handleError(_0x1c65a6,null));};exports[_0x69f2('0x30')]=function(_0x56d340,_0x238ad8,_0x4e04af){if(_0x56d340['body']['id']){delete _0x56d340[_0x69f2('0x5a')]['id'];}var _0x2e1073,_0x4a1acf,_0x4d1289;return db[_0x69f2('0x43')][_0x69f2('0x58')]({'where':{'id':_0x56d340[_0x69f2('0x57')]['id']}})['then'](handleEntityNotFound(_0x238ad8,null))[_0x69f2('0x23')](function(_0x3a3e16){if(_0x3a3e16){_0x4d1289=_0x3a3e16;logger[_0x69f2('0x27')](_0x69f2('0x28'),_0x69f2('0x30'),_0x69f2('0xd2'),_0x3a3e16[_0x69f2('0x45')],util[_0x69f2('0xd3')](_0x56d340[_0x69f2('0x5a')],{'showHidden':![],'depth':null}));switch(_0x3a3e16[_0x69f2('0x45')]){case _0x69f2('0x84'):if(_0x56d340[_0x69f2('0x5a')]['skebby_dispatch_id']&&_0x56d340[_0x69f2('0x5a')][_0x69f2('0x30')]){_0x4a1acf=_0x56d340[_0x69f2('0x5a')]['status'];return db[_0x69f2('0xcf')]['find']({'where':{'messageId':_0x56d340[_0x69f2('0x5a')][_0x69f2('0xd4')]}});}break;case'connectel':if(_0x56d340[_0x69f2('0x5a')]['requestid']&&_0x56d340['body'][_0x69f2('0xd5')]){_0x4a1acf=_0x56d340[_0x69f2('0x5a')][_0x69f2('0xd5')];return db[_0x69f2('0xcf')][_0x69f2('0x58')]({'where':{'messageId':_0x56d340[_0x69f2('0x5a')][_0x69f2('0xd6')]}});}break;case _0x69f2('0x87'):if(_0x56d340[_0x69f2('0x5a')]['message_id']&&_0x56d340[_0x69f2('0x5a')]['status_code']){_0x4a1acf=_0x56d340[_0x69f2('0x5a')][_0x69f2('0xd7')];return db['SmsMessage'][_0x69f2('0x58')]({'where':{'messageId':_0x56d340[_0x69f2('0x5a')][_0x69f2('0x88')]}});}break;case'infobip':var _0x3846c4=_0x56d340[_0x69f2('0x5a')]['results'][0x0];if(_0x3846c4[_0x69f2('0x82')]&&_0x3846c4[_0x69f2('0x30')]['groupName']==='DELIVERED'){_0x4a1acf=_0x3846c4[_0x69f2('0x30')][_0x69f2('0xd8')];return db['SmsMessage'][_0x69f2('0x58')]({'where':{'messageId':_0x3846c4[_0x69f2('0x82')]}});}break;case _0x69f2('0x91'):if(_0x56d340[_0x69f2('0x5a')]['messageId']&&_0x56d340['body'][_0x69f2('0x30')]){_0x4a1acf=_0x56d340[_0x69f2('0x5a')]['status'];return db['SmsMessage'][_0x69f2('0x58')]({'where':{'messageId':_0x56d340['body']['messageId']}});}break;case _0x69f2('0x94'):if(_0x56d340[_0x69f2('0x5a')][0x0][_0x69f2('0x2c')]['id']){_0x4a1acf=_0x56d340[_0x69f2('0x5a')][0x0][_0x69f2('0x45')];return db[_0x69f2('0xcf')][_0x69f2('0x58')]({'where':{'messageId':_0x56d340[_0x69f2('0x5a')][0x0]['message']['id']}});}break;case'intelepeer':if(_0x56d340[_0x69f2('0x5a')][_0x69f2('0xd9')]&&_0x56d340[_0x69f2('0x5a')][_0x69f2('0x30')]){_0x4a1acf=_0x56d340[_0x69f2('0x5a')][_0x69f2('0x30')];return db[_0x69f2('0xcf')][_0x69f2('0x58')]({'where':{'messageId':_0x56d340[_0x69f2('0x5a')]['redif']}});}break;}}})[_0x69f2('0x23')](handleEntityNotFound(_0x238ad8,null))[_0x69f2('0x23')](function(_0x5010bc){if(_0x5010bc){_0x2e1073=_0x5010bc;switch(_0x4d1289[_0x69f2('0x45')]){case _0x69f2('0x84'):if(_0x4a1acf===_0x69f2('0xda')){return _0x2e1073['update']({'read':!![]});}else{logger[_0x69f2('0x2a')](_0x69f2('0x28'),_0x69f2('0x30'),'skebby',util[_0x69f2('0xd3')](_0x56d340['body'],{'showHidden':![],'depth':null}));}break;case _0x69f2('0x86'):if(_0x4a1acf==='1'){return _0x2e1073[_0x69f2('0x39')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x69f2('0x30'),'skebby',util[_0x69f2('0xd3')](_0x56d340[_0x69f2('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x69f2('0x87'):if(!_0x56d340[_0x69f2('0x5a')][_0x69f2('0xdb')]&&_0x4a1acf>=0xc8&&_0x4a1acf<=0xce){return _0x2e1073[_0x69f2('0x39')]({'read':!![]});}else{logger[_0x69f2('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x69f2('0x30'),_0x69f2('0x87'),util['inspect'](_0x56d340[_0x69f2('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x69f2('0x8c'):var _0xc60eef=_0x56d340[_0x69f2('0x5a')][_0x69f2('0x8d')][0x0];if(_0xc60eef[_0x69f2('0x30')][_0x69f2('0xd8')]==='DELIVERED'){return _0x2e1073[_0x69f2('0x39')]({'read':!![]});}else{logger[_0x69f2('0x2a')](_0x69f2('0x28'),_0x69f2('0x30'),_0x69f2('0x8c'),util[_0x69f2('0xd3')](_0x56d340[_0x69f2('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x69f2('0x91'):if(_0x4a1acf==_0x69f2('0xdc')||_0x4a1acf=='RECEIVED_BY_RECIPIENT'){return _0x2e1073['update']({'read':!![]});}else{logger[_0x69f2('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x69f2('0x91'),util[_0x69f2('0xd3')](_0x56d340[_0x69f2('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x69f2('0x94'):if(_0x4a1acf==_0x69f2('0xdd')){return _0x2e1073['update']({'read':!![]});}else{logger[_0x69f2('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x69f2('0x94'),util[_0x69f2('0xd3')](_0x56d340[_0x69f2('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x69f2('0x95'):if(_0x4a1acf===_0x69f2('0xde')||_0x4a1acf===_0x69f2('0xdf')){return _0x2e1073[_0x69f2('0x39')]({'read':!![]});}else{logger[_0x69f2('0x2a')](_0x69f2('0x28'),_0x69f2('0x30'),'intelepeer',util[_0x69f2('0xd3')](_0x56d340[_0x69f2('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x2e1073;}})[_0x69f2('0x23')](respondWithResult(_0x238ad8,null))[_0x69f2('0x2e')](handleError(_0x238ad8,null));};exports['statusGet']=function(_0x41d32f,_0x1de16f,_0x2a011b){var _0x920a5e,_0x4c687f,_0x3a6e58;return db[_0x69f2('0x43')][_0x69f2('0x58')]({'where':{'id':_0x41d32f[_0x69f2('0x57')]['id']}})[_0x69f2('0x23')](handleEntityNotFound(_0x1de16f,null))[_0x69f2('0x23')](function(_0x223405){if(_0x223405){_0x3a6e58=_0x223405;logger[_0x69f2('0x27')](_0x69f2('0x28'),_0x69f2('0x30'),_0x69f2('0xd2'),_0x223405[_0x69f2('0x45')],util[_0x69f2('0xd3')](_0x41d32f[_0x69f2('0x47')],{'showHidden':![],'depth':null}));switch(_0x223405[_0x69f2('0x45')]){case _0x69f2('0x8e'):if(_0x41d32f[_0x69f2('0x47')][_0x69f2('0xe0')]&&_0x41d32f[_0x69f2('0x47')][_0x69f2('0xe1')]){_0x4c687f=_0x41d32f['query']['state'];return db[_0x69f2('0xcf')][_0x69f2('0x58')]({'where':{'messageId':_0x41d32f['query']['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x1de16f,null))['then'](function(_0x260c65){if(_0x260c65){_0x920a5e=_0x260c65;switch(_0x3a6e58[_0x69f2('0x45')]){case _0x69f2('0x8e'):if(_0x4c687f==='2'||_0x4c687f==='6'){return _0x920a5e['update']({'read':!![]});}else{logger[_0x69f2('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x69f2('0x30'),_0x69f2('0x8e'),util[_0x69f2('0xd3')](_0x41d32f[_0x69f2('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x920a5e;}})['then'](respondWithResult(_0x1de16f,null))[_0x69f2('0x2e')](handleError(_0x1de16f,null));};exports[_0x69f2('0xe2')]=function(_0x482fb0,_0x3b1c38,_0x210125){return db[_0x69f2('0x43')][_0x69f2('0x58')]({'where':{'id':_0x482fb0[_0x69f2('0x57')]['id']}})[_0x69f2('0x23')](handleEntityNotFound(_0x3b1c38,null))[_0x69f2('0x23')](function(_0x2c223a){if(_0x2c223a){return _0x2c223a[_0x69f2('0xe2')](_0x482fb0['body']['ids'],_[_0x69f2('0xa2')](_0x482fb0[_0x69f2('0x5a')],['ids','id'])||{})[_0x69f2('0xa6')](function(_0x33a590){for(var _0x212d01=0x0;_0x212d01<_0x482fb0[_0x69f2('0x5a')][_0x69f2('0x6e')][_0x69f2('0x4d')];_0x212d01+=0x1){socket[_0x69f2('0xe3')](_0x69f2('0xe4'),{'UserId':Number(_0x482fb0[_0x69f2('0x5a')][_0x69f2('0x6e')][_0x212d01]),'SmsAccountId':Number(_0x482fb0['params']['id'])});}return _0x33a590;});}})[_0x69f2('0x23')](respondWithResult(_0x3b1c38,null))[_0x69f2('0x2e')](handleError(_0x3b1c38,null));};exports['removeAgents']=function(_0x289b2b,_0x29fed9,_0x3602aa){return db[_0x69f2('0x43')][_0x69f2('0x58')]({'where':{'id':_0x289b2b[_0x69f2('0x57')]['id']}})[_0x69f2('0x23')](handleEntityNotFound(_0x29fed9,null))[_0x69f2('0x23')](function(_0x5ae9b9){if(_0x5ae9b9){return _0x5ae9b9[_0x69f2('0xe5')](_0x289b2b[_0x69f2('0x47')]['ids'])[_0x69f2('0x23')](function(){if(_[_0x69f2('0xe6')](_0x289b2b['query'][_0x69f2('0x6e')])){for(var _0x732127=0x0;_0x732127<_0x289b2b[_0x69f2('0x47')][_0x69f2('0x6e')][_0x69f2('0x4d')];_0x732127+=0x1){socket[_0x69f2('0xe3')]('userSmsAccount:remove',{'UserId':Number(_0x289b2b[_0x69f2('0x47')][_0x69f2('0x6e')][_0x732127]),'SmsAccountId':Number(_0x289b2b[_0x69f2('0x57')]['id'])});}}else{socket['emit'](_0x69f2('0xe7'),{'UserId':Number(_0x289b2b[_0x69f2('0x47')][_0x69f2('0x6e')]),'SmsAccountId':Number(_0x289b2b[_0x69f2('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x29fed9,null))[_0x69f2('0x2e')](handleError(_0x29fed9,null));};exports[_0x69f2('0xe8')]=function(_0x1a7a0f,_0x40509e,_0xe5e9e2){var _0x4668e8={};var _0x71ca68={};var _0x4cfa98;var _0x685164;return db['SmsAccount'][_0x69f2('0x6a')]({'where':{'id':_0x1a7a0f[_0x69f2('0x57')]['id']}})[_0x69f2('0x23')](handleEntityNotFound(_0x40509e,null))['then'](function(_0x197ef9){if(_0x197ef9){_0x4cfa98=_0x197ef9;_0x71ca68[_0x69f2('0x46')]=_[_0x69f2('0x48')](db[_0x69f2('0xb0')][_0x69f2('0x44')]);_0x71ca68['query']=_[_0x69f2('0x48')](_0x1a7a0f[_0x69f2('0x47')]);_0x71ca68[_0x69f2('0x49')]=_[_0x69f2('0x4b')](_0x71ca68[_0x69f2('0x46')],_0x71ca68[_0x69f2('0x47')]);_0x4668e8[_0x69f2('0x4a')]=_[_0x69f2('0x4b')](_0x71ca68[_0x69f2('0x46')],qs[_0x69f2('0x4c')](_0x1a7a0f[_0x69f2('0x47')][_0x69f2('0x4c')]));_0x4668e8[_0x69f2('0x4a')]=_0x4668e8[_0x69f2('0x4a')]['length']?_0x4668e8[_0x69f2('0x4a')]:_0x71ca68['model'];_0x4668e8[_0x69f2('0x6b')]=qs[_0x69f2('0x50')](_0x1a7a0f['query'][_0x69f2('0x50')]);_0x4668e8[_0x69f2('0x51')]=qs['filters'](_[_0x69f2('0x6c')](_0x1a7a0f[_0x69f2('0x47')],_0x71ca68[_0x69f2('0x49')]));if(_0x1a7a0f[_0x69f2('0x47')][_0x69f2('0x54')]){_0x4668e8[_0x69f2('0x51')]=_[_0x69f2('0x52')](_0x4668e8[_0x69f2('0x51')],{'$or':_[_0x69f2('0x42')](_0x4668e8[_0x69f2('0x4a')],function(_0x4c743d){var _0x2eced6={};_0x2eced6[_0x4c743d]={'$like':'%'+_0x1a7a0f[_0x69f2('0x47')][_0x69f2('0x54')]+'%'};return _0x2eced6;})});}_0x4668e8=_[_0x69f2('0x52')]({},_0x4668e8,_0x1a7a0f['options']);return _0x4cfa98['getAgents'](_0x4668e8);}})[_0x69f2('0x23')](function(_0xf68cae){if(_0xf68cae){_0x685164=_0xf68cae[_0x69f2('0x4d')];if(!_0x1a7a0f['query'][_0x69f2('0x4e')]('nolimit')){_0x4668e8[_0x69f2('0x35')]=qs[_0x69f2('0x35')](_0x1a7a0f['query'][_0x69f2('0x35')]);_0x4668e8[_0x69f2('0x32')]=qs[_0x69f2('0x32')](_0x1a7a0f[_0x69f2('0x47')][_0x69f2('0x32')]);}return _0x4cfa98[_0x69f2('0xe8')](_0x4668e8);}})['then'](function(_0x183dbf){if(_0x183dbf){return _0x183dbf?{'count':_0x685164,'rows':_0x183dbf}:null;}})[_0x69f2('0x23')](respondWithResult(_0x40509e,null))[_0x69f2('0x2e')](handleError(_0x40509e,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 2b0abed..f6fcc56 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 _0xb3f2=['exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x22944d,_0x208b4f){var _0x459bac=function(_0x1cdc28){while(--_0x1cdc28){_0x22944d['push'](_0x22944d['shift']());}};_0x459bac(++_0x208b4f);}(_0xb3f2,0x105));var _0x2b3f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3f2[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x2b3f('0x0'));var SmsAccount=require(_0x2b3f('0x1'))['db'][_0x2b3f('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x2b3f('0x3')](0x0);var events={'afterCreate':_0x2b3f('0x4'),'afterUpdate':_0x2b3f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1f73aa){return function(_0x434c9a,_0x564110,_0xc01300){SmsAccountEvents['emit'](_0x1f73aa+':'+_0x434c9a['id'],_0x434c9a);SmsAccountEvents[_0x2b3f('0x6')](_0x1f73aa,_0x434c9a);_0xc01300(null);};}for(var e in events){if(events[_0x2b3f('0x7')](e)){var event=events[e];SmsAccount[_0x2b3f('0x8')](e,emitEvent(event));}}module[_0x2b3f('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0xaa2a=['SmsAccount','setMaxListeners','update','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x45f47e,_0x19ad08){var _0xcf30e9=function(_0x24713a){while(--_0x24713a){_0x45f47e['push'](_0x45f47e['shift']());}};_0xcf30e9(++_0x19ad08);}(_0xaa2a,0x1f0));var _0xaaa2=function(_0x5c1352,_0x1da832){_0x5c1352=_0x5c1352-0x0;var _0x13c430=_0xaa2a[_0x5c1352];return _0x13c430;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xaaa2('0x0'))['db'][_0xaaa2('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xaaa2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaaa2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x23f848){return function(_0xd26fb7,_0x1daaa8,_0x3fcfe1){SmsAccountEvents[_0xaaa2('0x4')](_0x23f848+':'+_0xd26fb7['id'],_0xd26fb7);SmsAccountEvents[_0xaaa2('0x4')](_0x23f848,_0xd26fb7);_0x3fcfe1(null);};}for(var e in events){if(events[_0xaaa2('0x5')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xaaa2('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 6d65ef2..b1f1d59 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 _0xada7=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','sms_accounts'];(function(_0x49f4e7,_0x1dcbd4){var _0xcabbf4=function(_0x426f19){while(--_0x426f19){_0x49f4e7['push'](_0x49f4e7['shift']());}};_0xcabbf4(++_0x1dcbd4);}(_0xada7,0x120));var _0x7ada=function(_0x38023b,_0x961a2f){_0x38023b=_0x38023b-0x0;var _0x4ac13a=_0xada7[_0x38023b];return _0x4ac13a;};'use strict';var _=require(_0x7ada('0x0'));var util=require('util');var logger=require(_0x7ada('0x1'))('api');var moment=require(_0x7ada('0x2'));var BPromise=require(_0x7ada('0x3'));var rp=require(_0x7ada('0x4'));var fs=require('fs');var path=require(_0x7ada('0x5'));var rimraf=require(_0x7ada('0x6'));var config=require(_0x7ada('0x7'));var attributes=require(_0x7ada('0x8'));module[_0x7ada('0x9')]=function(_0x36065a,_0xf42292){return _0x36065a['define'](_0x7ada('0xa'),attributes,{'tableName':_0x7ada('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc29e=['request-promise','rimraf','exports','SmsAccount','lodash','util','../../config/logger','moment','bluebird'];(function(_0x1d52a4,_0xd93994){var _0x32abb5=function(_0x20a687){while(--_0x20a687){_0x1d52a4['push'](_0x1d52a4['shift']());}};_0x32abb5(++_0xd93994);}(_0xc29e,0x70));var _0xec29=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xc29e[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0xec29('0x0'));var util=require(_0xec29('0x1'));var logger=require(_0xec29('0x2'))('api');var moment=require(_0xec29('0x3'));var BPromise=require(_0xec29('0x4'));var rp=require(_0xec29('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec29('0x6'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0xec29('0x7')]=function(_0x3c9b85,_0x48c39e){return _0x3c9b85['define'](_0xec29('0x8'),attributes,{'tableName':'sms_accounts','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 a56f465..0a32618 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 _0xf957=['../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','ShowSmsAccount','SmsAccount','find','options','where','attributes','include','map','model','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0xf957,0x69));var _0x7f95=function(_0x5f4e09,_0x5158de){_0x5f4e09=_0x5f4e09-0x0;var _0x25817a=_0xf957[_0x5f4e09];return _0x25817a;};'use strict';var _=require(_0x7f95('0x0'));var util=require('util');var moment=require(_0x7f95('0x1'));var BPromise=require('bluebird');var rs=require(_0x7f95('0x2'));var fs=require('fs');var Redis=require(_0x7f95('0x3'));var db=require(_0x7f95('0x4'))['db'];var utils=require(_0x7f95('0x5'));var logger=require(_0x7f95('0x6'))('rpc');var config=require(_0x7f95('0x7'));var jayson=require(_0x7f95('0x8'));var client=jayson[_0x7f95('0x9')][_0x7f95('0xa')]({'port':0x232a});config['redis']=_[_0x7f95('0xb')](config['redis'],{'host':_0x7f95('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7f95('0xd')]));require(_0x7f95('0xe'))[_0x7f95('0xf')](socket);function respondWithRpcPromise(_0x1d4476,_0x3813d3,_0x5af294){return new BPromise(function(_0x5562db,_0x56c385){return client[_0x7f95('0x10')](_0x1d4476,_0x5af294)[_0x7f95('0x11')](function(_0x234590){logger['info'](_0x7f95('0x12'),_0x3813d3,_0x7f95('0x13'));logger['debug'](_0x7f95('0x14'),_0x3813d3,_0x7f95('0x13'),JSON[_0x7f95('0x15')](_0x234590));if(_0x234590[_0x7f95('0x16')]){if(_0x234590[_0x7f95('0x16')]['code']===0x1f4){logger[_0x7f95('0x16')]('SmsAccount,\x20%s,\x20%s',_0x3813d3,_0x234590[_0x7f95('0x16')][_0x7f95('0x17')]);return _0x56c385(_0x234590['error']['message']);}logger[_0x7f95('0x16')](_0x7f95('0x12'),_0x3813d3,_0x234590['error'][_0x7f95('0x17')]);return _0x5562db(_0x234590[_0x7f95('0x16')][_0x7f95('0x17')]);}else{logger[_0x7f95('0x18')](_0x7f95('0x12'),_0x3813d3,_0x7f95('0x13'));_0x5562db(_0x234590[_0x7f95('0x19')][_0x7f95('0x17')]);}})[_0x7f95('0x1a')](function(_0x5db109){logger['error'](_0x7f95('0x12'),_0x3813d3,_0x5db109);_0x56c385(_0x5db109);});});}exports[_0x7f95('0x1b')]=function(_0x411720){var _0x25611e=this;return new Promise(function(_0x151680,_0x23f5a1){return db[_0x7f95('0x1c')][_0x7f95('0x1d')]({'raw':_0x411720[_0x7f95('0x1e')]?_0x411720[_0x7f95('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x411720[_0x7f95('0x1e')]?_0x411720[_0x7f95('0x1e')][_0x7f95('0x1f')]||null:null,'attributes':_0x411720[_0x7f95('0x1e')]?_0x411720['options'][_0x7f95('0x20')]||null:null,'include':_0x411720['options']?_0x411720[_0x7f95('0x1e')][_0x7f95('0x21')]?_[_0x7f95('0x22')](_0x411720['options'][_0x7f95('0x21')],function(_0x253545){return{'model':db[_0x253545[_0x7f95('0x23')]],'as':_0x253545['as'],'attributes':_0x253545[_0x7f95('0x20')],'include':_0x253545[_0x7f95('0x21')]?_[_0x7f95('0x22')](_0x253545[_0x7f95('0x21')],function(_0x263c2f){return{'model':db[_0x263c2f[_0x7f95('0x23')]],'as':_0x263c2f['as'],'attributes':_0x263c2f[_0x7f95('0x20')],'include':_0x263c2f[_0x7f95('0x21')]?_['map'](_0x263c2f['include'],function(_0x5ebdd4){return{'model':db[_0x5ebdd4[_0x7f95('0x23')]],'as':_0x5ebdd4['as'],'attributes':_0x5ebdd4['attributes']};}):[]};}):[]};}):[]:[]})[_0x7f95('0x11')](function(_0x55af71){logger[_0x7f95('0x18')]('ShowSmsAccount',_0x411720);logger[_0x7f95('0x24')](_0x7f95('0x1b'),_0x411720,JSON[_0x7f95('0x15')](_0x55af71));_0x151680(_0x55af71);})[_0x7f95('0x1a')](function(_0x47e6e8){logger[_0x7f95('0x16')](_0x7f95('0x1b'),_0x47e6e8[_0x7f95('0x17')],_0x411720);_0x23f5a1(_0x25611e[_0x7f95('0x16')](0x1f4,_0x47e6e8['message']));});});}; \ No newline at end of file +var _0x24e9=['raw','options','where','attributes','include','model','map','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','socket.io-emitter','redis','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','SmsAccount,\x20%s,\x20%s','message','catch','ShowSmsAccount','SmsAccount','find'];(function(_0x403454,_0x4688ad){var _0x535214=function(_0x11b380){while(--_0x11b380){_0x403454['push'](_0x403454['shift']());}};_0x535214(++_0x4688ad);}(_0x24e9,0x144));var _0x924e=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x24e9[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x924e('0x0'));var util=require(_0x924e('0x1'));var moment=require(_0x924e('0x2'));var BPromise=require(_0x924e('0x3'));var rs=require(_0x924e('0x4'));var fs=require('fs');var Redis=require(_0x924e('0x5'));var db=require(_0x924e('0x6'))['db'];var utils=require(_0x924e('0x7'));var logger=require('../../config/logger')(_0x924e('0x8'));var config=require('../../config/environment');var jayson=require(_0x924e('0x9'));var client=jayson[_0x924e('0xa')]['http']({'port':0x232a});config['redis']=_[_0x924e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x924e('0xc'))(new Redis(config[_0x924e('0xd')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x331aaf,_0x570555,_0x3844e7){return new BPromise(function(_0x3898a2,_0x326862){return client['request'](_0x331aaf,_0x3844e7)['then'](function(_0x1a7372){logger[_0x924e('0xe')]('SmsAccount,\x20%s,\x20%s',_0x570555,_0x924e('0xf'));logger[_0x924e('0x10')](_0x924e('0x11'),_0x570555,'request\x20sent',JSON['stringify'](_0x1a7372));if(_0x1a7372['error']){if(_0x1a7372[_0x924e('0x12')][_0x924e('0x13')]===0x1f4){logger[_0x924e('0x12')](_0x924e('0x14'),_0x570555,_0x1a7372[_0x924e('0x12')]['message']);return _0x326862(_0x1a7372['error'][_0x924e('0x15')]);}logger[_0x924e('0x12')](_0x924e('0x14'),_0x570555,_0x1a7372['error'][_0x924e('0x15')]);return _0x3898a2(_0x1a7372[_0x924e('0x12')]['message']);}else{logger[_0x924e('0xe')](_0x924e('0x14'),_0x570555,_0x924e('0xf'));_0x3898a2(_0x1a7372['result']['message']);}})[_0x924e('0x16')](function(_0x2e61b5){logger[_0x924e('0x12')](_0x924e('0x14'),_0x570555,_0x2e61b5);_0x326862(_0x2e61b5);});});}exports[_0x924e('0x17')]=function(_0x4fcb3b){var _0x3cb8e3=this;return new Promise(function(_0x3e9477,_0x22ab4d){return db[_0x924e('0x18')][_0x924e('0x19')]({'raw':_0x4fcb3b['options']?_0x4fcb3b['options'][_0x924e('0x1a')]===undefined?!![]:![]:!![],'where':_0x4fcb3b[_0x924e('0x1b')]?_0x4fcb3b[_0x924e('0x1b')][_0x924e('0x1c')]||null:null,'attributes':_0x4fcb3b[_0x924e('0x1b')]?_0x4fcb3b['options'][_0x924e('0x1d')]||null:null,'include':_0x4fcb3b[_0x924e('0x1b')]?_0x4fcb3b['options'][_0x924e('0x1e')]?_['map'](_0x4fcb3b[_0x924e('0x1b')][_0x924e('0x1e')],function(_0x5380f9){return{'model':db[_0x5380f9[_0x924e('0x1f')]],'as':_0x5380f9['as'],'attributes':_0x5380f9[_0x924e('0x1d')],'include':_0x5380f9[_0x924e('0x1e')]?_[_0x924e('0x20')](_0x5380f9[_0x924e('0x1e')],function(_0x18a61a){return{'model':db[_0x18a61a[_0x924e('0x1f')]],'as':_0x18a61a['as'],'attributes':_0x18a61a['attributes'],'include':_0x18a61a[_0x924e('0x1e')]?_[_0x924e('0x20')](_0x18a61a[_0x924e('0x1e')],function(_0x2a66cd){return{'model':db[_0x2a66cd[_0x924e('0x1f')]],'as':_0x2a66cd['as'],'attributes':_0x2a66cd[_0x924e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x924e('0x21')](function(_0x2cd3a3){logger['info'](_0x924e('0x17'),_0x4fcb3b);logger['debug'](_0x924e('0x17'),_0x4fcb3b,JSON[_0x924e('0x22')](_0x2cd3a3));_0x3e9477(_0x2cd3a3);})[_0x924e('0x16')](function(_0x494008){logger[_0x924e('0x12')](_0x924e('0x17'),_0x494008[_0x924e('0x15')],_0x4fcb3b);_0x22ab4d(_0x3cb8e3[_0x924e('0x12')](0x1f4,_0x494008['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index b4e06ba..69b7cbb 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 fed0ac3..a93125f 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 _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x3e5cd5,_0x58272b){var _0x1b8d19=function(_0x3e216b){while(--_0x3e216b){_0x3e5cd5['push'](_0x3e5cd5['shift']());}};_0x1b8d19(++_0x58272b);}(_0x3e74,0x175));var _0x43e7=function(_0x1eda19,_0x4678ef){_0x1eda19=_0x1eda19-0x0;var _0x2cb79d=_0x3e74[_0x1eda19];return _0x2cb79d;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x4a440b,_0xedaa5b){var _0x25c667=function(_0x5c04db){while(--_0x5c04db){_0x4a440b['push'](_0x4a440b['shift']());}};_0x25c667(++_0xedaa5b);}(_0x3e74,0x175));var _0x43e7=function(_0x25b9fe,_0xc217c6){_0x25b9fe=_0x25b9fe-0x0;var _0x2d3be5=_0x3e74[_0x25b9fe];return _0x2d3be5;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index d7b2d84..5a9099a 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 _0xd662=['TEXT','*,*,*,*','sequelize','STRING','noop'];(function(_0x39cb83,_0x42c4a2){var _0x568b71=function(_0xb84dc1){while(--_0xb84dc1){_0x39cb83['push'](_0x39cb83['shift']());}};_0x568b71(++_0x42c4a2);}(_0xd662,0x75));var _0x2d66=function(_0x46685f,_0x5795b3){_0x46685f=_0x46685f-0x0;var _0x7da24c=_0xd662[_0x46685f];return _0x7da24c;};'use strict';var Sequelize=require(_0x2d66('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2d66('0x1')],'allowNull':![],'defaultValue':_0x2d66('0x2')},'appdata':{'type':Sequelize[_0x2d66('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2d66('0x1')],'defaultValue':_0x2d66('0x4')}}; \ No newline at end of file +var _0x38dc=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x1b1a41,_0x37fdba){var _0x2ef3b7=function(_0x4ee4e0){while(--_0x4ee4e0){_0x1b1a41['push'](_0x1b1a41['shift']());}};_0x2ef3b7(++_0x37fdba);}(_0x38dc,0xf7));var _0xc38d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x38dc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc38d('0x0'));module[_0xc38d('0x1')]={'priority':{'type':Sequelize[_0xc38d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc38d('0x3')],'allowNull':![],'defaultValue':_0xc38d('0x4')},'appdata':{'type':Sequelize[_0xc38d('0x5')]()},'description':{'type':Sequelize[_0xc38d('0x3')]},'interval':{'type':Sequelize[_0xc38d('0x3')],'defaultValue':_0xc38d('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index d9e5ee1..98c9432 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 _0x4cfc=['util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','SmsApplication','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','keys','find','catch','create','body','eml-format','zip-dir','request-promise','mustache'];(function(_0x343fcd,_0x3584ed){var _0xfeb398=function(_0x500f3c){while(--_0x500f3c){_0x343fcd['push'](_0x343fcd['shift']());}};_0xfeb398(++_0x3584ed);}(_0x4cfc,0x1b8));var _0xc4cf=function(_0x85daa4,_0x1bc8e9){_0x85daa4=_0x85daa4-0x0;var _0x1f912b=_0x4cfc[_0x85daa4];return _0x1f912b;};'use strict';var emlformat=require(_0xc4cf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc4cf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc4cf('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc4cf('0x3'));var util=require(_0xc4cf('0x4'));var path=require(_0xc4cf('0x5'));var sox=require(_0xc4cf('0x6'));var csv=require(_0xc4cf('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc4cf('0x8'));var _=require(_0xc4cf('0x9'));var squel=require(_0xc4cf('0xa'));var crypto=require('crypto');var jsforce=require(_0xc4cf('0xb'));var deskjs=require(_0xc4cf('0xc'));var toCsv=require(_0xc4cf('0x7'));var querystring=require(_0xc4cf('0xd'));var Papa=require('papaparse');var Redis=require(_0xc4cf('0xe'));var authService=require(_0xc4cf('0xf'));var qs=require(_0xc4cf('0x10'));var as=require(_0xc4cf('0x11'));var hardwareService=require(_0xc4cf('0x12'));var logger=require(_0xc4cf('0x13'))(_0xc4cf('0x14'));var utils=require(_0xc4cf('0x15'));var config=require(_0xc4cf('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc4cf('0x17'))['db'];function respondWithStatusCode(_0x54b113,_0x4f28f0){_0x4f28f0=_0x4f28f0||0xcc;return function(_0x188d89){if(_0x188d89){return _0x54b113[_0xc4cf('0x18')](_0x4f28f0);}return _0x54b113[_0xc4cf('0x19')](_0x4f28f0)[_0xc4cf('0x1a')]();};}function respondWithResult(_0x5e851e,_0x39a4e7){_0x39a4e7=_0x39a4e7||0xc8;return function(_0x26a0e3){if(_0x26a0e3){return _0x5e851e['status'](_0x39a4e7)[_0xc4cf('0x1b')](_0x26a0e3);}};}function respondWithFilteredResult(_0x53266c,_0x22d679){return function(_0x2c8817){if(_0x2c8817){var _0x3d9b01=typeof _0x22d679[_0xc4cf('0x1c')]===_0xc4cf('0x1d')&&typeof _0x22d679['limit']===_0xc4cf('0x1d');var _0x47d1e0=_0x2c8817[_0xc4cf('0x1e')];var _0x43959d=_0x3d9b01?0x0:_0x22d679['offset'];var _0xcbf452=_0x3d9b01?_0x2c8817['count']:_0x22d679[_0xc4cf('0x1c')]+_0x22d679[_0xc4cf('0x1f')];var _0x12575e;if(_0xcbf452>=_0x47d1e0){_0xcbf452=_0x47d1e0;_0x12575e=0xc8;}else{_0x12575e=0xce;}_0x53266c[_0xc4cf('0x19')](_0x12575e);return _0x53266c[_0xc4cf('0x20')](_0xc4cf('0x21'),_0x43959d+'-'+_0xcbf452+'/'+_0x47d1e0)[_0xc4cf('0x1b')](_0x2c8817);}return null;};}function patchUpdates(_0x4e98b4){return function(_0x1583b5){try{jsonpatch['apply'](_0x1583b5,_0x4e98b4,!![]);}catch(_0x2ee047){return BPromise[_0xc4cf('0x22')](_0x2ee047);}return _0x1583b5[_0xc4cf('0x23')]();};}function saveUpdates(_0x4b43b1,_0x106fbf){return function(_0x2cdf6c){if(_0x2cdf6c){return _0x2cdf6c[_0xc4cf('0x24')](_0x4b43b1)[_0xc4cf('0x25')](function(_0x5ebb49){return _0x5ebb49;});}return null;};}function removeEntity(_0x20c486,_0x183c40){return function(_0x1a36d8){if(_0x1a36d8){return _0x1a36d8[_0xc4cf('0x26')]()['then'](function(){_0x20c486[_0xc4cf('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb1f1f0,_0x1f9a2a){return function(_0x43f3c0){if(!_0x43f3c0){_0xb1f1f0[_0xc4cf('0x18')](0x194);}return _0x43f3c0;};}function handleError(_0x58f733,_0x102899){_0x102899=_0x102899||0x1f4;return function(_0x322c9d){logger[_0xc4cf('0x27')](_0x322c9d[_0xc4cf('0x28')]);if(_0x322c9d['name']){delete _0x322c9d[_0xc4cf('0x29')];}_0x58f733[_0xc4cf('0x19')](_0x102899)[_0xc4cf('0x2a')](_0x322c9d);};}exports['index']=function(_0x12595a,_0x5ed6cd){var _0x3f0d33={},_0x50c91b={},_0xb6ee98={'count':0x0,'rows':[]};var _0x512a59=_[_0xc4cf('0x2b')](db[_0xc4cf('0x2c')]['rawAttributes'],function(_0x5cb0cc){return{'name':_0x5cb0cc[_0xc4cf('0x2d')],'type':_0x5cb0cc['type'][_0xc4cf('0x2e')]};});_0x50c91b[_0xc4cf('0x2f')]=_['map'](_0x512a59,_0xc4cf('0x29'));_0x50c91b[_0xc4cf('0x30')]=_['keys'](_0x12595a['query']);_0x50c91b[_0xc4cf('0x31')]=_[_0xc4cf('0x32')](_0x50c91b[_0xc4cf('0x2f')],_0x50c91b['query']);_0x3f0d33[_0xc4cf('0x33')]=_[_0xc4cf('0x32')](_0x50c91b[_0xc4cf('0x2f')],qs[_0xc4cf('0x34')](_0x12595a[_0xc4cf('0x30')][_0xc4cf('0x34')]));_0x3f0d33[_0xc4cf('0x33')]=_0x3f0d33[_0xc4cf('0x33')][_0xc4cf('0x35')]?_0x3f0d33[_0xc4cf('0x33')]:_0x50c91b[_0xc4cf('0x2f')];if(!_0x12595a[_0xc4cf('0x30')][_0xc4cf('0x36')](_0xc4cf('0x37'))){_0x3f0d33['limit']=qs['limit'](_0x12595a[_0xc4cf('0x30')][_0xc4cf('0x1f')]);_0x3f0d33[_0xc4cf('0x1c')]=qs[_0xc4cf('0x1c')](_0x12595a['query']['offset']);}_0x3f0d33['order']=qs[_0xc4cf('0x38')](_0x12595a[_0xc4cf('0x30')][_0xc4cf('0x38')]);_0x3f0d33[_0xc4cf('0x39')]=qs[_0xc4cf('0x31')](_[_0xc4cf('0x3a')](_0x12595a[_0xc4cf('0x30')],_0x50c91b[_0xc4cf('0x31')]),_0x512a59);if(_0x12595a[_0xc4cf('0x30')][_0xc4cf('0x3b')]){_0x3f0d33['where']=_[_0xc4cf('0x3c')](_0x3f0d33['where'],{'$or':_[_0xc4cf('0x2b')](_0x512a59,function(_0x1ded1a){if(_0x1ded1a[_0xc4cf('0x3d')]!==_0xc4cf('0x3e')){var _0x51978e={};_0x51978e[_0x1ded1a[_0xc4cf('0x29')]]={'$like':'%'+_0x12595a[_0xc4cf('0x30')][_0xc4cf('0x3b')]+'%'};return _0x51978e;}})});}_0x3f0d33=_['merge']({},_0x3f0d33,_0x12595a[_0xc4cf('0x3f')]);var _0x4f508={'where':_0x3f0d33[_0xc4cf('0x39')]};return db[_0xc4cf('0x2c')]['count'](_0x4f508)[_0xc4cf('0x25')](function(_0x5612bb){_0xb6ee98[_0xc4cf('0x1e')]=_0x5612bb;if(_0x12595a[_0xc4cf('0x30')]['includeAll']){_0x3f0d33[_0xc4cf('0x40')]=[{'all':!![]}];}return db[_0xc4cf('0x2c')][_0xc4cf('0x41')](_0x3f0d33);})[_0xc4cf('0x25')](function(_0x3cf58e){_0xb6ee98[_0xc4cf('0x42')]=_0x3cf58e;return _0xb6ee98;})[_0xc4cf('0x25')](respondWithFilteredResult(_0x5ed6cd,_0x3f0d33))['catch'](handleError(_0x5ed6cd,null));};exports[_0xc4cf('0x43')]=function(_0x89727d,_0x16d44c){var _0x593753={'raw':!![],'where':{'id':_0x89727d[_0xc4cf('0x44')]['id']}},_0x3da880={};_0x3da880[_0xc4cf('0x2f')]=_[_0xc4cf('0x45')](db[_0xc4cf('0x2c')]['rawAttributes']);_0x3da880['query']=_['keys'](_0x89727d[_0xc4cf('0x30')]);_0x3da880[_0xc4cf('0x31')]=_[_0xc4cf('0x32')](_0x3da880[_0xc4cf('0x2f')],_0x3da880[_0xc4cf('0x30')]);_0x593753[_0xc4cf('0x33')]=_[_0xc4cf('0x32')](_0x3da880[_0xc4cf('0x2f')],qs[_0xc4cf('0x34')](_0x89727d[_0xc4cf('0x30')][_0xc4cf('0x34')]));_0x593753[_0xc4cf('0x33')]=_0x593753[_0xc4cf('0x33')][_0xc4cf('0x35')]?_0x593753['attributes']:_0x3da880[_0xc4cf('0x2f')];if(_0x89727d[_0xc4cf('0x30')]['includeAll']){_0x593753[_0xc4cf('0x40')]=[{'all':!![]}];}_0x593753=_['merge']({},_0x593753,_0x89727d[_0xc4cf('0x3f')]);return db[_0xc4cf('0x2c')][_0xc4cf('0x46')](_0x593753)[_0xc4cf('0x25')](handleEntityNotFound(_0x16d44c,null))[_0xc4cf('0x25')](respondWithResult(_0x16d44c,null))[_0xc4cf('0x47')](handleError(_0x16d44c,null));};exports['create']=function(_0x14545a,_0x506df5){return db[_0xc4cf('0x2c')][_0xc4cf('0x48')](_0x14545a[_0xc4cf('0x49')],{})['then'](respondWithResult(_0x506df5,0xc9))[_0xc4cf('0x47')](handleError(_0x506df5,null));};exports[_0xc4cf('0x24')]=function(_0xf05a9d,_0x301136){if(_0xf05a9d['body']['id']){delete _0xf05a9d['body']['id'];}return db[_0xc4cf('0x2c')][_0xc4cf('0x46')]({'where':{'id':_0xf05a9d['params']['id']}})[_0xc4cf('0x25')](handleEntityNotFound(_0x301136,null))['then'](saveUpdates(_0xf05a9d[_0xc4cf('0x49')],null))[_0xc4cf('0x25')](respondWithResult(_0x301136,null))[_0xc4cf('0x47')](handleError(_0x301136,null));};exports[_0xc4cf('0x26')]=function(_0x59f01e,_0x13a6a3){return db[_0xc4cf('0x2c')]['find']({'where':{'id':_0x59f01e[_0xc4cf('0x44')]['id']}})[_0xc4cf('0x25')](handleEntityNotFound(_0x13a6a3,null))[_0xc4cf('0x25')](removeEntity(_0x13a6a3,null))[_0xc4cf('0x47')](handleError(_0x13a6a3,null));}; \ No newline at end of file +var _0x273d=['keys','filters','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','filter','merge','options','SmsApplication','findAll','rows','catch','show','params','includeAll','include','find','create','body','update','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','reject','save','then','stack','send','index','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x273d,0x1d0));var _0xd273=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x273d[_0xae7c2f];return _0x5d7001;};'use strict';var emlformat=require(_0xd273('0x0'));var rimraf=require(_0xd273('0x1'));var zipdir=require(_0xd273('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd273('0x3'));var moment=require(_0xd273('0x4'));var BPromise=require(_0xd273('0x5'));var Mustache=require('mustache');var util=require(_0xd273('0x6'));var path=require(_0xd273('0x7'));var sox=require(_0xd273('0x8'));var csv=require(_0xd273('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd273('0xa'));var squel=require(_0xd273('0xb'));var crypto=require(_0xd273('0xc'));var jsforce=require(_0xd273('0xd'));var deskjs=require(_0xd273('0xe'));var toCsv=require(_0xd273('0x9'));var querystring=require(_0xd273('0xf'));var Papa=require('papaparse');var Redis=require(_0xd273('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd273('0x11'));var as=require(_0xd273('0x12'));var hardwareService=require(_0xd273('0x13'));var logger=require(_0xd273('0x14'))(_0xd273('0x15'));var utils=require(_0xd273('0x16'));var config=require(_0xd273('0x17'));var licenseUtil=require(_0xd273('0x18'));var db=require(_0xd273('0x19'))['db'];function respondWithStatusCode(_0x2c7493,_0x4a9272){_0x4a9272=_0x4a9272||0xcc;return function(_0x596cbf){if(_0x596cbf){return _0x2c7493[_0xd273('0x1a')](_0x4a9272);}return _0x2c7493[_0xd273('0x1b')](_0x4a9272)[_0xd273('0x1c')]();};}function respondWithResult(_0x87967,_0x17bba9){_0x17bba9=_0x17bba9||0xc8;return function(_0x41474c){if(_0x41474c){return _0x87967[_0xd273('0x1b')](_0x17bba9)[_0xd273('0x1d')](_0x41474c);}};}function respondWithFilteredResult(_0x2001b7,_0x288234){return function(_0x338d48){if(_0x338d48){var _0xaae27=typeof _0x288234['offset']===_0xd273('0x1e')&&typeof _0x288234['limit']==='undefined';var _0x5e6f7c=_0x338d48[_0xd273('0x1f')];var _0x3fe1a6=_0xaae27?0x0:_0x288234[_0xd273('0x20')];var _0x1eb886=_0xaae27?_0x338d48['count']:_0x288234[_0xd273('0x20')]+_0x288234['limit'];var _0x35ed7b;if(_0x1eb886>=_0x5e6f7c){_0x1eb886=_0x5e6f7c;_0x35ed7b=0xc8;}else{_0x35ed7b=0xce;}_0x2001b7[_0xd273('0x1b')](_0x35ed7b);return _0x2001b7[_0xd273('0x21')]('Content-Range',_0x3fe1a6+'-'+_0x1eb886+'/'+_0x5e6f7c)[_0xd273('0x1d')](_0x338d48);}return null;};}function patchUpdates(_0xbef7a7){return function(_0x28606e){try{jsonpatch['apply'](_0x28606e,_0xbef7a7,!![]);}catch(_0x2eb6ce){return BPromise[_0xd273('0x22')](_0x2eb6ce);}return _0x28606e[_0xd273('0x23')]();};}function saveUpdates(_0x40a7d3,_0x2d97bc){return function(_0x5e71e7){if(_0x5e71e7){return _0x5e71e7['update'](_0x40a7d3)[_0xd273('0x24')](function(_0x5c8c3d){return _0x5c8c3d;});}return null;};}function removeEntity(_0x506099,_0x5f2f2e){return function(_0x47d199){if(_0x47d199){return _0x47d199['destroy']()['then'](function(){_0x506099[_0xd273('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d7a88,_0x466063){return function(_0x4b8942){if(!_0x4b8942){_0x3d7a88['sendStatus'](0x194);}return _0x4b8942;};}function handleError(_0x365526,_0x584398){_0x584398=_0x584398||0x1f4;return function(_0x1a02ad){logger['error'](_0x1a02ad[_0xd273('0x25')]);if(_0x1a02ad['name']){delete _0x1a02ad['name'];}_0x365526[_0xd273('0x1b')](_0x584398)[_0xd273('0x26')](_0x1a02ad);};}exports[_0xd273('0x27')]=function(_0x838226,_0x3dca1d){var _0x51d556={},_0x470658={},_0x58d445={'count':0x0,'rows':[]};var _0x5f41fa=_[_0xd273('0x28')](db['SmsApplication'][_0xd273('0x29')],function(_0x23cc41){return{'name':_0x23cc41[_0xd273('0x2a')],'type':_0x23cc41[_0xd273('0x2b')][_0xd273('0x2c')]};});_0x470658[_0xd273('0x2d')]=_[_0xd273('0x28')](_0x5f41fa,'name');_0x470658[_0xd273('0x2e')]=_[_0xd273('0x2f')](_0x838226[_0xd273('0x2e')]);_0x470658[_0xd273('0x30')]=_['intersection'](_0x470658['model'],_0x470658[_0xd273('0x2e')]);_0x51d556[_0xd273('0x31')]=_[_0xd273('0x32')](_0x470658[_0xd273('0x2d')],qs[_0xd273('0x33')](_0x838226[_0xd273('0x2e')][_0xd273('0x33')]));_0x51d556[_0xd273('0x31')]=_0x51d556[_0xd273('0x31')]['length']?_0x51d556[_0xd273('0x31')]:_0x470658[_0xd273('0x2d')];if(!_0x838226['query'][_0xd273('0x34')]('nolimit')){_0x51d556[_0xd273('0x35')]=qs[_0xd273('0x35')](_0x838226[_0xd273('0x2e')][_0xd273('0x35')]);_0x51d556[_0xd273('0x20')]=qs[_0xd273('0x20')](_0x838226['query'][_0xd273('0x20')]);}_0x51d556[_0xd273('0x36')]=qs[_0xd273('0x37')](_0x838226[_0xd273('0x2e')][_0xd273('0x37')]);_0x51d556[_0xd273('0x38')]=qs[_0xd273('0x30')](_['pick'](_0x838226[_0xd273('0x2e')],_0x470658['filters']),_0x5f41fa);if(_0x838226['query'][_0xd273('0x39')]){_0x51d556[_0xd273('0x38')]=_[_0xd273('0x3a')](_0x51d556[_0xd273('0x38')],{'$or':_[_0xd273('0x28')](_0x5f41fa,function(_0xb8737e){if(_0xb8737e[_0xd273('0x2b')]!=='VIRTUAL'){var _0xf66cf9={};_0xf66cf9[_0xb8737e['name']]={'$like':'%'+_0x838226[_0xd273('0x2e')][_0xd273('0x39')]+'%'};return _0xf66cf9;}})});}_0x51d556=_[_0xd273('0x3a')]({},_0x51d556,_0x838226[_0xd273('0x3b')]);var _0x342cc0={'where':_0x51d556[_0xd273('0x38')]};return db['SmsApplication'][_0xd273('0x1f')](_0x342cc0)[_0xd273('0x24')](function(_0x481493){_0x58d445['count']=_0x481493;if(_0x838226[_0xd273('0x2e')]['includeAll']){_0x51d556['include']=[{'all':!![]}];}return db[_0xd273('0x3c')][_0xd273('0x3d')](_0x51d556);})[_0xd273('0x24')](function(_0x16552e){_0x58d445[_0xd273('0x3e')]=_0x16552e;return _0x58d445;})['then'](respondWithFilteredResult(_0x3dca1d,_0x51d556))[_0xd273('0x3f')](handleError(_0x3dca1d,null));};exports[_0xd273('0x40')]=function(_0x429953,_0x3b0fa9){var _0x289fb9={'raw':!![],'where':{'id':_0x429953[_0xd273('0x41')]['id']}},_0x235158={};_0x235158[_0xd273('0x2d')]=_[_0xd273('0x2f')](db[_0xd273('0x3c')]['rawAttributes']);_0x235158[_0xd273('0x2e')]=_['keys'](_0x429953[_0xd273('0x2e')]);_0x235158['filters']=_['intersection'](_0x235158[_0xd273('0x2d')],_0x235158[_0xd273('0x2e')]);_0x289fb9['attributes']=_['intersection'](_0x235158[_0xd273('0x2d')],qs[_0xd273('0x33')](_0x429953['query'][_0xd273('0x33')]));_0x289fb9[_0xd273('0x31')]=_0x289fb9[_0xd273('0x31')]['length']?_0x289fb9[_0xd273('0x31')]:_0x235158[_0xd273('0x2d')];if(_0x429953[_0xd273('0x2e')][_0xd273('0x42')]){_0x289fb9[_0xd273('0x43')]=[{'all':!![]}];}_0x289fb9=_[_0xd273('0x3a')]({},_0x289fb9,_0x429953['options']);return db['SmsApplication'][_0xd273('0x44')](_0x289fb9)[_0xd273('0x24')](handleEntityNotFound(_0x3b0fa9,null))['then'](respondWithResult(_0x3b0fa9,null))['catch'](handleError(_0x3b0fa9,null));};exports[_0xd273('0x45')]=function(_0x12ad8,_0x3a7151){return db[_0xd273('0x3c')]['create'](_0x12ad8[_0xd273('0x46')],{})[_0xd273('0x24')](respondWithResult(_0x3a7151,0xc9))[_0xd273('0x3f')](handleError(_0x3a7151,null));};exports[_0xd273('0x47')]=function(_0xa32d1,_0x4ed039){if(_0xa32d1[_0xd273('0x46')]['id']){delete _0xa32d1[_0xd273('0x46')]['id'];}return db[_0xd273('0x3c')]['find']({'where':{'id':_0xa32d1[_0xd273('0x41')]['id']}})[_0xd273('0x24')](handleEntityNotFound(_0x4ed039,null))['then'](saveUpdates(_0xa32d1['body'],null))['then'](respondWithResult(_0x4ed039,null))[_0xd273('0x3f')](handleError(_0x4ed039,null));};exports[_0xd273('0x48')]=function(_0x2e85e2,_0xa20b41){return db[_0xd273('0x3c')][_0xd273('0x44')]({'where':{'id':_0x2e85e2[_0xd273('0x41')]['id']}})[_0xd273('0x24')](handleEntityNotFound(_0xa20b41,null))[_0xd273('0x24')](removeEntity(_0xa20b41,null))[_0xd273('0x3f')](handleError(_0xa20b41,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index fe2fd63..55e0908 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 _0x8d84=['bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x1d0582,_0x41c23f){var _0x2fb015=function(_0x32d966){while(--_0x32d966){_0x1d0582['push'](_0x1d0582['shift']());}};_0x2fb015(++_0x41c23f);}(_0x8d84,0x64));var _0x48d8=function(_0x3f8119,_0x3eb3b3){_0x3f8119=_0x3f8119-0x0;var _0x4e4e35=_0x8d84[_0x3f8119];return _0x4e4e35;};'use strict';var _=require(_0x48d8('0x0'));var util=require(_0x48d8('0x1'));var logger=require(_0x48d8('0x2'))(_0x48d8('0x3'));var moment=require(_0x48d8('0x4'));var BPromise=require(_0x48d8('0x5'));var rp=require(_0x48d8('0x6'));var fs=require('fs');var path=require(_0x48d8('0x7'));var rimraf=require(_0x48d8('0x8'));var config=require(_0x48d8('0x9'));var attributes=require(_0x48d8('0xa'));module[_0x48d8('0xb')]=function(_0x46cd76,_0x248654){return _0x46cd76['define']('SmsApplication',attributes,{'tableName':_0x48d8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x48d8('0xd'),'collate':_0x48d8('0xe')});}; \ No newline at end of file +var _0xba27=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0xba27,0x15c));var _0x7ba2=function(_0x54d52c,_0x55b8d9){_0x54d52c=_0x54d52c-0x0;var _0x28f99e=_0xba27[_0x54d52c];return _0x28f99e;};'use strict';var _=require('lodash');var util=require(_0x7ba2('0x0'));var logger=require(_0x7ba2('0x1'))(_0x7ba2('0x2'));var moment=require(_0x7ba2('0x3'));var BPromise=require(_0x7ba2('0x4'));var rp=require(_0x7ba2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7ba2('0x6'));var config=require(_0x7ba2('0x7'));var attributes=require('./smsApplication.attributes');module[_0x7ba2('0x8')]=function(_0x349622,_0x5587cd){return _0x349622[_0x7ba2('0x9')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7ba2('0xa'),'collate':_0x7ba2('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index b7e2e45..630210b 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 _0x9264=['bluebird','../../mysqldb','rpc','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9264,0xb1));var _0x4926=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9264[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4926('0x0'));var util=require(_0x4926('0x1'));var moment=require(_0x4926('0x2'));var BPromise=require(_0x4926('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4926('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4926('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4926('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1dbcbe,_0x57c13c,_0x1299c8){return new BPromise(function(_0x2f5445,_0x4da9b6){return client[_0x4926('0x7')](_0x1dbcbe,_0x1299c8)[_0x4926('0x8')](function(_0x2a5ce3){logger['info'](_0x4926('0x9'),_0x57c13c,_0x4926('0xa'));logger[_0x4926('0xb')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x57c13c,_0x4926('0xa'),JSON['stringify'](_0x2a5ce3));if(_0x2a5ce3['error']){if(_0x2a5ce3[_0x4926('0xc')][_0x4926('0xd')]===0x1f4){logger[_0x4926('0xc')]('SmsApplication,\x20%s,\x20%s',_0x57c13c,_0x2a5ce3[_0x4926('0xc')][_0x4926('0xe')]);return _0x4da9b6(_0x2a5ce3[_0x4926('0xc')][_0x4926('0xe')]);}logger[_0x4926('0xc')](_0x4926('0x9'),_0x57c13c,_0x2a5ce3[_0x4926('0xc')][_0x4926('0xe')]);return _0x2f5445(_0x2a5ce3[_0x4926('0xc')][_0x4926('0xe')]);}else{logger[_0x4926('0xf')](_0x4926('0x9'),_0x57c13c,_0x4926('0xa'));_0x2f5445(_0x2a5ce3[_0x4926('0x10')]['message']);}})[_0x4926('0x11')](function(_0x258914){logger[_0x4926('0xc')]('SmsApplication,\x20%s,\x20%s',_0x57c13c,_0x258914);_0x4da9b6(_0x258914);});});} \ No newline at end of file +var _0x7cdc=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xb09774,_0x5051b2){var _0x2a0442=function(_0x1ca0e6){while(--_0x1ca0e6){_0xb09774['push'](_0xb09774['shift']());}};_0x2a0442(++_0x5051b2);}(_0x7cdc,0x190));var _0xc7cd=function(_0x6e4049,_0xa3c3ac){_0x6e4049=_0x6e4049-0x0;var _0x39aff7=_0x7cdc[_0x6e4049];return _0x39aff7;};'use strict';var _=require('lodash');var util=require(_0xc7cd('0x0'));var moment=require(_0xc7cd('0x1'));var BPromise=require('bluebird');var rs=require(_0xc7cd('0x2'));var fs=require('fs');var Redis=require(_0xc7cd('0x3'));var db=require(_0xc7cd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc7cd('0x5'))(_0xc7cd('0x6'));var config=require('../../config/environment');var jayson=require(_0xc7cd('0x7'));var client=jayson[_0xc7cd('0x8')][_0xc7cd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c168c,_0x13ffeb,_0x30089e){return new BPromise(function(_0x42a4b8,_0x5b5d3d){return client[_0xc7cd('0xa')](_0x2c168c,_0x30089e)['then'](function(_0x36d8b9){logger[_0xc7cd('0xb')](_0xc7cd('0xc'),_0x13ffeb,_0xc7cd('0xd'));logger['debug'](_0xc7cd('0xe'),_0x13ffeb,_0xc7cd('0xd'),JSON[_0xc7cd('0xf')](_0x36d8b9));if(_0x36d8b9[_0xc7cd('0x10')]){if(_0x36d8b9['error'][_0xc7cd('0x11')]===0x1f4){logger['error'](_0xc7cd('0xc'),_0x13ffeb,_0x36d8b9[_0xc7cd('0x10')][_0xc7cd('0x12')]);return _0x5b5d3d(_0x36d8b9[_0xc7cd('0x10')]['message']);}logger[_0xc7cd('0x10')](_0xc7cd('0xc'),_0x13ffeb,_0x36d8b9['error'][_0xc7cd('0x12')]);return _0x42a4b8(_0x36d8b9['error'][_0xc7cd('0x12')]);}else{logger['info'](_0xc7cd('0xc'),_0x13ffeb,_0xc7cd('0xd'));_0x42a4b8(_0x36d8b9[_0xc7cd('0x13')][_0xc7cd('0x12')]);}})['catch'](function(_0x211e6d){logger[_0xc7cd('0x10')](_0xc7cd('0xc'),_0x13ffeb,_0x211e6d);_0x5b5d3d(_0x211e6d);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index ed82ee3..72005b0 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 _0xe511=['addTags','put','update','smsinteraction:destroy','destroy','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','describe','show','/:id/messages','isAuthenticated','getMessages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xe511,0x16f));var _0x1e51=function(_0x28c766,_0x3d710c){_0x28c766=_0x28c766-0x0;var _0x164c34=_0xe511[_0x28c766];return _0x164c34;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var fs_extra=require(_0x1e51('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var controller=require(_0x1e51('0x7'));router[_0x1e51('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x9')]);router[_0x1e51('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x1e51('0xa')]);router[_0x1e51('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xb')]);router[_0x1e51('0x8')](_0x1e51('0xc'),auth[_0x1e51('0xd')](),controller[_0x1e51('0xe')]);router[_0x1e51('0x8')]('/:id/download',auth[_0x1e51('0xd')](),controller[_0x1e51('0xf')]);router[_0x1e51('0x10')]('/',auth[_0x1e51('0xd')](),controller[_0x1e51('0x11')]);router[_0x1e51('0x10')]('/:id/messages',auth[_0x1e51('0xd')](),controller[_0x1e51('0x12')]);router[_0x1e51('0x10')](_0x1e51('0x13'),auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),_0x1e51('0x16')),controller[_0x1e51('0x17')]);router[_0x1e51('0x18')]('/:id',auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),'smsinteraction:update'),controller[_0x1e51('0x19')]);router['delete']('/:id',auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),_0x1e51('0x1a')),controller[_0x1e51('0x1b')]);router[_0x1e51('0x1c')]('/:id/tags',auth[_0x1e51('0xd')](),controller['removeTags']);module[_0x1e51('0x1d')]=router; \ No newline at end of file +var _0x0b0e=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','smsinteraction:update','delete','exports','multer'];(function(_0x3bada2,_0x1dec98){var _0x553d4b=function(_0x29ab45){while(--_0x29ab45){_0x3bada2['push'](_0x3bada2['shift']());}};_0x553d4b(++_0x1dec98);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4e5d67,_0x54dffc){_0x4e5d67=_0x4e5d67-0x0;var _0x4acdf3=_0x0b0e[_0x4e5d67];return _0x4acdf3;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['show']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/download',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x11')](_0xe0b0('0xe'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x13')]);router['post'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),interaction[_0xe0b0('0x15')](_0xe0b0('0x16'),_0xe0b0('0x17')),controller['addTags']);router[_0xe0b0('0x18')]('/:id',auth[_0xe0b0('0xa')](),interaction[_0xe0b0('0x15')]('sms',_0xe0b0('0x19')),controller['update']);router[_0xe0b0('0x1a')](_0xe0b0('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0xe0b0('0x16'),'smsinteraction:destroy'),controller['destroy']);router['delete'](_0xe0b0('0x14'),auth['isAuthenticated'](),controller['removeTags']);module[_0xe0b0('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index fb9dd37..51d3bee 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 _0x1c52=['STRING','DATE','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x3a818a,_0x5d39ed){var _0xa1b136=function(_0x506dd5){while(--_0x506dd5){_0x3a818a['push'](_0x3a818a['shift']());}};_0xa1b136(++_0x5d39ed);}(_0x1c52,0x7c));var _0x21c5=function(_0x13bb8e,_0x332fd8){_0x13bb8e=_0x13bb8e-0x0;var _0x44f0f6=_0x1c52[_0x13bb8e];return _0x44f0f6;};'use strict';var Sequelize=require(_0x21c5('0x0'));var moment=require(_0x21c5('0x1'));module[_0x21c5('0x2')]={'closed':{'type':Sequelize[_0x21c5('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x21c5('0x4')]},'note':{'type':Sequelize[_0x21c5('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x21c5('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x21c5('0x6')]('in',_0x21c5('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x21c5('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x21c5('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x21c5('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xbb8d=['DATE','out','ENUM','INTEGER','sequelize','exports','STRING'];(function(_0x3064af,_0x240a17){var _0x372cd8=function(_0x46c105){while(--_0x46c105){_0x3064af['push'](_0x3064af['shift']());}};_0x372cd8(++_0x240a17);}(_0xbb8d,0x146));var _0xdbb8=function(_0x412b78,_0x5dab3e){_0x412b78=_0x412b78-0x0;var _0x5e1e5f=_0xbb8d[_0x412b78];return _0x5e1e5f;};'use strict';var Sequelize=require(_0xdbb8('0x0'));var moment=require('moment');module[_0xdbb8('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xdbb8('0x2')]},'thirdDisposition':{'type':Sequelize[_0xdbb8('0x2')]},'note':{'type':Sequelize[_0xdbb8('0x2')]},'phone':{'type':Sequelize[_0xdbb8('0x2')]},'read1stAt':{'type':Sequelize[_0xdbb8('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xdbb8('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xdbb8('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xdbb8('0x5')]('in',_0xdbb8('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xdbb8('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 3529709..7182c12 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 _0xabf1=['format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Messages','createdAt','secret','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','toString','closedAt','disposition','direction','out','System','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','then','stack','name','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','create','body','find','destroy','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','SmsInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','join','server','files','tmp'];(function(_0x395af7,_0x32901c){var _0x3d15cb=function(_0x2e373a){while(--_0x2e373a){_0x395af7['push'](_0x395af7['shift']());}};_0x3d15cb(++_0x32901c);}(_0xabf1,0xa0));var _0x1abf=function(_0x52cbf8,_0x15934f){_0x52cbf8=_0x52cbf8-0x0;var _0x5a38af=_0xabf1[_0x52cbf8];return _0x5a38af;};'use strict';var rimraf=require(_0x1abf('0x0'));var zipdir=require(_0x1abf('0x1'));var moment=require(_0x1abf('0x2'));var BPromise=require(_0x1abf('0x3'));var util=require('util');var path=require(_0x1abf('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x1abf('0x5'));var interaction=require(_0x1abf('0x6'));var qs=require(_0x1abf('0x7'));var pdf=require(_0x1abf('0x8'));var logger=require('../../config/logger')(_0x1abf('0x9'));var config=require(_0x1abf('0xa'));var db=require(_0x1abf('0xb'))['db'];config['redis']=_[_0x1abf('0xc')](config[_0x1abf('0xd')],{'host':_0x1abf('0xe'),'port':0x18eb});var socket=require(_0x1abf('0xf'))(new Redis(config[_0x1abf('0xd')]));require('./smsInteraction.socket')[_0x1abf('0x10')](socket);function respondWithStatusCode(_0x2d4226,_0x4dbe02){_0x4dbe02=_0x4dbe02||0xcc;return function(_0x96a2c8){if(_0x96a2c8){return _0x2d4226[_0x1abf('0x11')](_0x4dbe02);}return _0x2d4226[_0x1abf('0x12')](_0x4dbe02)[_0x1abf('0x13')]();};}function respondWithResult(_0x361f6d,_0x10aa26){_0x10aa26=_0x10aa26||0xc8;return function(_0x393f05){if(_0x393f05){return _0x361f6d[_0x1abf('0x12')](_0x10aa26)[_0x1abf('0x14')](_0x393f05);}};}function respondWithFilteredResult(_0x28ea33,_0x43e561){return function(_0x2cc1b6){if(_0x2cc1b6){var _0x7978a9=typeof _0x43e561[_0x1abf('0x15')]==='undefined'&&typeof _0x43e561[_0x1abf('0x16')]==='undefined';var _0x1efef5=_0x2cc1b6[_0x1abf('0x17')];var _0x11fb2d=_0x7978a9?0x0:_0x43e561[_0x1abf('0x15')];var _0xb1c766=_0x7978a9?_0x2cc1b6[_0x1abf('0x17')]:_0x43e561[_0x1abf('0x15')]+_0x43e561[_0x1abf('0x16')];var _0x3b093c;if(_0xb1c766>=_0x1efef5){_0xb1c766=_0x1efef5;_0x3b093c=0xc8;}else{_0x3b093c=0xce;}_0x28ea33[_0x1abf('0x12')](_0x3b093c);return _0x28ea33[_0x1abf('0x18')](_0x1abf('0x19'),_0x11fb2d+'-'+_0xb1c766+'/'+_0x1efef5)[_0x1abf('0x14')](_0x2cc1b6);}return null;};}function saveUpdates(_0x29b3c6){return function(_0x484a0e){if(_0x484a0e){return _0x484a0e[_0x1abf('0x1a')](_0x29b3c6)[_0x1abf('0x1b')](function(_0x33dc96){return _0x33dc96;});}return null;};}function removeEntity(_0x4b1eb1){return function(_0x5b26be){if(_0x5b26be){return _0x5b26be['destroy']()[_0x1abf('0x1b')](function(){_0x4b1eb1[_0x1abf('0x12')](0xcc)[_0x1abf('0x13')]();});}};}function handleEntityNotFound(_0x489b94){return function(_0x55fe5d){if(!_0x55fe5d){_0x489b94[_0x1abf('0x11')](0x194);}return _0x55fe5d;};}function handleError(_0x3dc17a,_0x8b621f){_0x8b621f=_0x8b621f||0x1f4;return function(_0x3344c9){logger['error'](_0x3344c9[_0x1abf('0x1c')]);if(_0x3344c9[_0x1abf('0x1d')]){delete _0x3344c9[_0x1abf('0x1d')];}_0x3dc17a[_0x1abf('0x12')](_0x8b621f)['send'](_0x3344c9);};}exports[_0x1abf('0x1e')]=function(_0x7e6939,_0x31a752){var _0x1cacc6={};var _0x15202a=_[_0x1abf('0x1f')](db[_0x1abf('0x20')][_0x1abf('0x21')],function(_0x5bbc04){return{'name':_0x5bbc04[_0x1abf('0x22')],'type':_0x5bbc04[_0x1abf('0x23')][_0x1abf('0x24')]};});_0x1cacc6=qs[_0x1abf('0x25')](_0x15202a,_0x7e6939);return interaction[_0x1abf('0x26')](_0x1abf('0x27'),_0x7e6939[_0x1abf('0x28')],_0x7e6939['user'],_0x1cacc6,_0x15202a)[_0x1abf('0x1b')](respondWithFilteredResult(_0x31a752,_0x1cacc6))[_0x1abf('0x29')](handleError(_0x31a752,null));};exports[_0x1abf('0x2a')]=function(_0x9031b0,_0x26f7b3){var _0x1f4fc7={'raw':![],'where':{'id':_0x9031b0[_0x1abf('0x2b')]['id']}},_0x8cdb50={};_0x8cdb50[_0x1abf('0x2c')]=_['keys'](db[_0x1abf('0x20')][_0x1abf('0x21')]);_0x8cdb50[_0x1abf('0x28')]=_[_0x1abf('0x2d')](_0x9031b0[_0x1abf('0x28')]);_0x8cdb50[_0x1abf('0x2e')]=_[_0x1abf('0x2f')](_0x8cdb50[_0x1abf('0x2c')],_0x8cdb50[_0x1abf('0x28')]);_0x1f4fc7[_0x1abf('0x30')]=_[_0x1abf('0x2f')](_0x8cdb50[_0x1abf('0x2c')],qs[_0x1abf('0x31')](_0x9031b0[_0x1abf('0x28')][_0x1abf('0x31')]));_0x1f4fc7['attributes']=_0x1f4fc7[_0x1abf('0x30')][_0x1abf('0x32')]?_0x1f4fc7[_0x1abf('0x30')]:_0x8cdb50[_0x1abf('0x2c')];if(_0x9031b0[_0x1abf('0x28')][_0x1abf('0x33')]){_0x1f4fc7['include']=[{'all':!![]}];}_0x1f4fc7=_[_0x1abf('0x34')]({},_0x1f4fc7,_0x9031b0[_0x1abf('0x35')]);return db[_0x1abf('0x20')]['find'](_0x1f4fc7)[_0x1abf('0x1b')](handleEntityNotFound(_0x26f7b3,null))[_0x1abf('0x1b')](respondWithResult(_0x26f7b3,null))['catch'](handleError(_0x26f7b3,null));};exports['create']=function(_0x3d871e,_0x1d7b25){return db[_0x1abf('0x20')][_0x1abf('0x36')](_0x3d871e[_0x1abf('0x37')],{})['then'](respondWithResult(_0x1d7b25,0xc9))[_0x1abf('0x29')](handleError(_0x1d7b25,null));};exports[_0x1abf('0x1a')]=function(_0x461fe4,_0x55a97a){if(_0x461fe4[_0x1abf('0x37')]['id']){delete _0x461fe4[_0x1abf('0x37')]['id'];}return db[_0x1abf('0x20')][_0x1abf('0x38')]({'where':{'id':_0x461fe4[_0x1abf('0x2b')]['id']}})[_0x1abf('0x1b')](handleEntityNotFound(_0x55a97a,null))['then'](saveUpdates(_0x461fe4[_0x1abf('0x37')],null))['then'](respondWithResult(_0x55a97a,null))[_0x1abf('0x29')](handleError(_0x55a97a,null));};exports[_0x1abf('0x39')]=function(_0x1bc04a,_0x48f8dc){return db[_0x1abf('0x20')][_0x1abf('0x38')]({'where':{'id':_0x1bc04a[_0x1abf('0x2b')]['id']}})['then'](handleEntityNotFound(_0x48f8dc,null))['then'](removeEntity(_0x48f8dc,null))[_0x1abf('0x29')](handleError(_0x48f8dc,null));};exports[_0x1abf('0x3a')]=function(_0x119955,_0x29a8f3){return db['SmsInteraction'][_0x1abf('0x3a')]()[_0x1abf('0x1b')](respondWithResult(_0x29a8f3,null))[_0x1abf('0x29')](handleError(_0x29a8f3,null));};exports[_0x1abf('0x3b')]=function(_0x23c459,_0x3d4e89){return db[_0x1abf('0x3c')][_0x1abf('0x38')]({'where':{'id':_0x23c459[_0x1abf('0x2b')]['id']}})[_0x1abf('0x1b')](handleEntityNotFound(_0x3d4e89,null))[_0x1abf('0x1b')](function(_0x35d86f){if(_0x35d86f){return _0x35d86f['addMessage'](_0x23c459[_0x1abf('0x37')]['ids'],_[_0x1abf('0x3d')](_0x23c459[_0x1abf('0x37')],[_0x1abf('0x3e'),'id'])||{});}})[_0x1abf('0x1b')](respondWithResult(_0x3d4e89,null))['catch'](handleError(_0x3d4e89,null));};exports[_0x1abf('0x3f')]=function(_0x45c8c2,_0x3ca230){var _0xf914c7={'raw':![],'where':{}};var _0x1b0ac4={};var _0x29b4c1={'count':0x0,'rows':[]};return db[_0x1abf('0x20')][_0x1abf('0x40')]({'where':{'id':_0x45c8c2['params']['id']}})[_0x1abf('0x1b')](handleEntityNotFound(_0x3ca230,null))[_0x1abf('0x1b')](function(_0x36b593){if(_0x36b593){_0x1b0ac4[_0x1abf('0x2c')]=_[_0x1abf('0x2d')](db['SmsMessage'][_0x1abf('0x21')]);_0x1b0ac4[_0x1abf('0x28')]=_[_0x1abf('0x2d')](_0x45c8c2[_0x1abf('0x28')]);_0x1b0ac4[_0x1abf('0x2e')]=_[_0x1abf('0x2f')](_0x1b0ac4[_0x1abf('0x2c')],_0x1b0ac4[_0x1abf('0x28')]);_0xf914c7[_0x1abf('0x30')]=_[_0x1abf('0x2f')](_0x1b0ac4[_0x1abf('0x2c')],qs[_0x1abf('0x31')](_0x45c8c2[_0x1abf('0x28')][_0x1abf('0x31')]));_0xf914c7[_0x1abf('0x30')]=_0xf914c7['attributes']['length']?_0xf914c7[_0x1abf('0x30')]:_0x1b0ac4[_0x1abf('0x2c')];if(!_0x45c8c2[_0x1abf('0x28')][_0x1abf('0x41')](_0x1abf('0x42'))){_0xf914c7['limit']=qs[_0x1abf('0x16')](_0x45c8c2[_0x1abf('0x28')][_0x1abf('0x16')]);_0xf914c7['offset']=qs['offset'](_0x45c8c2[_0x1abf('0x28')]['offset']);}_0xf914c7[_0x1abf('0x43')]=qs[_0x1abf('0x44')](_0x45c8c2['query']['sort']);_0xf914c7[_0x1abf('0x45')]=qs[_0x1abf('0x2e')](_['pick'](_0x45c8c2[_0x1abf('0x28')],_0x1b0ac4[_0x1abf('0x2e')]));_0xf914c7['where'][_0x1abf('0x46')]=_0x36b593['id'];if(_0x45c8c2[_0x1abf('0x28')][_0x1abf('0x47')]){_0xf914c7[_0x1abf('0x45')]=_[_0x1abf('0x34')](_0xf914c7['where'],{'$or':_['map'](_0xf914c7['attributes'],function(_0x76205c){var _0x353733={};_0x353733[_0x76205c]={'$like':'%'+_0x45c8c2['query'][_0x1abf('0x47')]+'%'};return _0x353733;})});}if(_0x45c8c2['query']['$gte']){var _0x554e19=_0x45c8c2[_0x1abf('0x28')][_0x1abf('0x48')]['split'](',');var _0x13e01f={};_0x13e01f[_0x554e19[0x0]]={'$gte':moment(_0x554e19[0x1])['format'](_0x1abf('0x49'))};_0xf914c7[_0x1abf('0x45')]=_[_0x1abf('0x34')](_0xf914c7[_0x1abf('0x45')],_0x13e01f);}_0xf914c7=_[_0x1abf('0x34')]({},_0xf914c7,_0x45c8c2[_0x1abf('0x35')]);return db[_0x1abf('0x3c')][_0x1abf('0x17')]({'where':_0xf914c7[_0x1abf('0x45')]})[_0x1abf('0x1b')](function(_0x309aa9){_0x29b4c1[_0x1abf('0x17')]=_0x309aa9;if(_0x45c8c2[_0x1abf('0x28')][_0x1abf('0x33')]){_0xf914c7[_0x1abf('0x4a')]=[{'all':!![]}];}return db[_0x1abf('0x3c')][_0x1abf('0x26')](_0xf914c7);})['then'](function(_0x5da65a){_0x29b4c1[_0x1abf('0x4b')]=_0x5da65a;return _0x29b4c1;});}})[_0x1abf('0x1b')](respondWithFilteredResult(_0x3ca230,_0xf914c7))[_0x1abf('0x29')](handleError(_0x3ca230,null));};exports[_0x1abf('0x4c')]=function(_0x5e1c4,_0x2eea51){return db['SmsInteraction'][_0x1abf('0x38')]({'where':{'id':_0x5e1c4[_0x1abf('0x2b')]['id']}})[_0x1abf('0x1b')](handleEntityNotFound(_0x2eea51,null))[_0x1abf('0x1b')](function(_0x131de6){if(_0x131de6){return _0x131de6[_0x1abf('0x4d')](_0x5e1c4[_0x1abf('0x37')][_0x1abf('0x3e')],_[_0x1abf('0x3d')](_0x5e1c4[_0x1abf('0x37')],['ids','id'])||{})[_0x1abf('0x4e')](function(){return db[_0x1abf('0x4f')][_0x1abf('0x26')]({'attributes':['id',_0x1abf('0x1d'),_0x1abf('0x50')],'where':{'id':_0x5e1c4[_0x1abf('0x37')]['ids']}});})[_0x1abf('0x1b')](function(_0x269056){socket[_0x1abf('0x51')](_0x1abf('0x52'),{'id':Number(_0x5e1c4['params']['id']),'tags':_0x269056||[]});return{'id':Number(_0x5e1c4['params']['id']),'tags':_0x269056||[]};});}})[_0x1abf('0x1b')](respondWithResult(_0x2eea51,null))['catch'](handleError(_0x2eea51,null));};exports[_0x1abf('0x53')]=function(_0x2f9124,_0x3cae1f){return db[_0x1abf('0x20')][_0x1abf('0x38')]({'where':{'id':_0x2f9124[_0x1abf('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3cae1f,null))[_0x1abf('0x1b')](function(_0xca1d23){if(_0xca1d23){return _0xca1d23[_0x1abf('0x53')](_0x2f9124[_0x1abf('0x28')][_0x1abf('0x3e')]);}})[_0x1abf('0x1b')](respondWithStatusCode(_0x3cae1f,null))[_0x1abf('0x29')](handleError(_0x3cae1f,null));};exports[_0x1abf('0x54')]=function(_0x2669ad,_0x41b25b){var _0x5bd917=moment()[_0x1abf('0x55')]()['toString']();var _0x181b3d=path[_0x1abf('0x56')](config['root'],_0x1abf('0x57'),_0x1abf('0x58'),_0x1abf('0x59'));var _0xfae143=path[_0x1abf('0x56')](_0x181b3d,_0x5bd917);var _0x226fc6=util[_0x1abf('0x5a')](_0x1abf('0x5b'),_0x2669ad[_0x1abf('0x2b')]['id'],_0x5bd917);var _0x3fc7ee=path[_0x1abf('0x56')](_0x181b3d,_0x226fc6);var _0x259955=[];_0x259955[_0x1abf('0x5c')]({'model':db['User'],'as':_0x1abf('0x5d'),'attributes':['id',_0x1abf('0x5e')],'raw':!![]});_0x259955[_0x1abf('0x5c')]({'model':db[_0x1abf('0x5f')],'as':_0x1abf('0x60'),'attributes':['id',_0x1abf('0x61'),_0x1abf('0x62')],'raw':!![]});var _0x4b7681=[{'model':db[_0x1abf('0x3c')],'as':_0x1abf('0x63'),'attributes':['id','body',_0x1abf('0x64'),'direction',_0x1abf('0x65'),_0x1abf('0x66')],'include':_0x259955}];_0x4b7681[_0x1abf('0x5c')]({'model':db[_0x1abf('0x67')],'as':_0x1abf('0x68'),'attributes':['id',_0x1abf('0x1d')]});_0x4b7681[_0x1abf('0x5c')]({'model':db[_0x1abf('0x5d')],'as':_0x1abf('0x69'),'attributes':['id','fullname']});return db[_0x1abf('0x20')][_0x1abf('0x38')]({'where':{'id':_0x2669ad['params']['id']},'include':_0x4b7681})[_0x1abf('0x1b')](handleEntityNotFound(_0x41b25b,null))['then'](function(_0x14180f){if(_0x14180f){var _0x20cc60=_0x14180f[_0x1abf('0x6a')]({'plain':!![]});fs[_0x1abf('0x6b')](_0xfae143);var _0x2b2c64={'channel':_0x1abf('0x6c'),'account':_0x20cc60['Account'][_0x1abf('0x1d')],'agent':_0x20cc60[_0x1abf('0x69')]?_0x20cc60[_0x1abf('0x69')][_0x1abf('0x5e')]:_0x1abf('0x6d'),'createdAt':moment(_0x20cc60[_0x1abf('0x64')])['format'](_0x1abf('0x49'))[_0x1abf('0x6e')](),'closedAt':_0x20cc60['closed']?moment(_0x20cc60[_0x1abf('0x6f')])[_0x1abf('0x5a')](_0x1abf('0x49'))[_0x1abf('0x6e')]():'','disposition':_0x20cc60[_0x1abf('0x70')],'messages':_(_0x20cc60[_0x1abf('0x63')])[_0x1abf('0x47')]({'secret':![]})[_0x1abf('0x1f')](function(_0x16c4c6){return{'date':moment(_0x16c4c6[_0x1abf('0x64')])[_0x1abf('0x5a')](_0x1abf('0x49'))[_0x1abf('0x6e')](),'sender':_0x16c4c6[_0x1abf('0x71')]===_0x1abf('0x72')?_0x16c4c6[_0x1abf('0x5d')]?_0x16c4c6[_0x1abf('0x5d')][_0x1abf('0x5e')]:_0x1abf('0x73'):_0x16c4c6[_0x1abf('0x60')][_0x1abf('0x61')]+(_0x16c4c6[_0x1abf('0x60')][_0x1abf('0x62')]?'\x20'+_0x16c4c6[_0x1abf('0x60')][_0x1abf('0x62')]:''),'body':_0x16c4c6[_0x1abf('0x37')],'direction':_0x16c4c6[_0x1abf('0x71')]===_0x1abf('0x72')?'A':'C','secret':_0x16c4c6[_0x1abf('0x65')],'read':_0x16c4c6[_0x1abf('0x66')]};})[_0x1abf('0x74')]()};return ejs[_0x1abf('0x75')](path['join'](config['root'],_0x1abf('0x57'),'views',_0x1abf('0x76')),{'interaction':_0x2b2c64})['then'](function(_0x27853a){var _0x392d6d=path[_0x1abf('0x56')](_0xfae143,_0x1abf('0x77')+_0x20cc60['id']+'-'+_0x5bd917+_0x1abf('0x78'));var _0x26ae1b={'path':_0x392d6d,'channel':'Sms','interactionId':_0x20cc60['id']};return pdf[_0x1abf('0x79')](_0x27853a,_0x26ae1b);})[_0x1abf('0x1b')](function(){return new BPromise(function(_0x4ff4f4,_0x579e57){zipdir(_0xfae143,{'saveTo':_0x3fc7ee},function(_0x5ec52c,_0x3d563d){if(_0x5ec52c)return _0x579e57(_0x5ec52c);return _0x4ff4f4(_0x3d563d);});})['then'](function(){return new BPromise(function(_0x3f1c6c,_0x41cab5){rimraf(_0xfae143,function(_0x1586b3){if(_0x1586b3)_0x41cab5(_0x1586b3);return _0x3f1c6c();});});})[_0x1abf('0x1b')](function(){return _0x41b25b[_0x1abf('0x54')](_0x3fc7ee,_0x226fc6,function(_0xbc81c4){if(_0xbc81c4){console[_0x1abf('0x7a')](_0x1abf('0x7b'),_0xbc81c4);}else{fs[_0x1abf('0x7c')](_0x3fc7ee);}});});});}else{return _0x41b25b[_0x1abf('0x11')](0xc8);}})['catch'](handleError(_0x41b25b,null));}; \ No newline at end of file +var _0x130b=['undefined','count','limit','Content-Range','then','error','stack','name','send','map','SmsInteraction','fieldName','type','key','getOptions','findAll','sms','query','user','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','update','body','destroy','describe','SmsMessage','addMessage','omit','getMessages','findOne','rawAttributes','hasOwnProperty','nolimit','order','sort','pick','where','filter','$gte','format','addTags','ids','spread','Tag','color','emit','download','unix','toString','join','server','tmp','push','User','fullname','Contact','firstName','Messages','createdAt','read','SmsAccount','Account','Owner','get','mkdirSync','YYYY-MM-DD\x20HH:mm:ss','closedAt','direction','out','System','lastName','renderFile','views','downloadInteraction.ejs','.pdf','Sms','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset'];(function(_0x23101c,_0xb416de){var _0x30e9af=function(_0xb32fd8){while(--_0xb32fd8){_0x23101c['push'](_0x23101c['shift']());}};_0x30e9af(++_0xb416de);}(_0x130b,0x1b6));var _0xb130=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x130b[_0x5f0089];return _0x193892;};'use strict';var rimraf=require(_0xb130('0x0'));var zipdir=require(_0xb130('0x1'));var moment=require(_0xb130('0x2'));var BPromise=require(_0xb130('0x3'));var util=require('util');var path=require(_0xb130('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb130('0x5'));var Redis=require(_0xb130('0x6'));var interaction=require(_0xb130('0x7'));var qs=require(_0xb130('0x8'));var pdf=require(_0xb130('0x9'));var logger=require('../../config/logger')('api');var config=require(_0xb130('0xa'));var db=require(_0xb130('0xb'))['db'];config[_0xb130('0xc')]=_['defaults'](config[_0xb130('0xc')],{'host':_0xb130('0xd'),'port':0x18eb});var socket=require(_0xb130('0xe'))(new Redis(config[_0xb130('0xc')]));require(_0xb130('0xf'))[_0xb130('0x10')](socket);function respondWithStatusCode(_0x4a9325,_0x110a28){_0x110a28=_0x110a28||0xcc;return function(_0x4847c5){if(_0x4847c5){return _0x4a9325[_0xb130('0x11')](_0x110a28);}return _0x4a9325[_0xb130('0x12')](_0x110a28)[_0xb130('0x13')]();};}function respondWithResult(_0x29c03c,_0x548be3){_0x548be3=_0x548be3||0xc8;return function(_0x5ef820){if(_0x5ef820){return _0x29c03c[_0xb130('0x12')](_0x548be3)[_0xb130('0x14')](_0x5ef820);}};}function respondWithFilteredResult(_0x2f6353,_0x3580ff){return function(_0x5ba624){if(_0x5ba624){var _0x119061=typeof _0x3580ff[_0xb130('0x15')]===_0xb130('0x16')&&typeof _0x3580ff['limit']===_0xb130('0x16');var _0x883299=_0x5ba624[_0xb130('0x17')];var _0x5d826e=_0x119061?0x0:_0x3580ff[_0xb130('0x15')];var _0x6f754f=_0x119061?_0x5ba624[_0xb130('0x17')]:_0x3580ff[_0xb130('0x15')]+_0x3580ff[_0xb130('0x18')];var _0x1025e5;if(_0x6f754f>=_0x883299){_0x6f754f=_0x883299;_0x1025e5=0xc8;}else{_0x1025e5=0xce;}_0x2f6353[_0xb130('0x12')](_0x1025e5);return _0x2f6353['set'](_0xb130('0x19'),_0x5d826e+'-'+_0x6f754f+'/'+_0x883299)[_0xb130('0x14')](_0x5ba624);}return null;};}function saveUpdates(_0x1c7e6c){return function(_0x22dff2){if(_0x22dff2){return _0x22dff2['update'](_0x1c7e6c)[_0xb130('0x1a')](function(_0x45da87){return _0x45da87;});}return null;};}function removeEntity(_0x72f910){return function(_0x3ddbaf){if(_0x3ddbaf){return _0x3ddbaf['destroy']()[_0xb130('0x1a')](function(){_0x72f910[_0xb130('0x12')](0xcc)[_0xb130('0x13')]();});}};}function handleEntityNotFound(_0xeacc93){return function(_0x584380){if(!_0x584380){_0xeacc93['sendStatus'](0x194);}return _0x584380;};}function handleError(_0xad42b4,_0x350df9){_0x350df9=_0x350df9||0x1f4;return function(_0x1ed818){logger[_0xb130('0x1b')](_0x1ed818[_0xb130('0x1c')]);if(_0x1ed818[_0xb130('0x1d')]){delete _0x1ed818[_0xb130('0x1d')];}_0xad42b4[_0xb130('0x12')](_0x350df9)[_0xb130('0x1e')](_0x1ed818);};}exports['index']=function(_0x325785,_0x4f17b9){var _0x47f15e={};var _0x15d4db=_[_0xb130('0x1f')](db[_0xb130('0x20')]['rawAttributes'],function(_0x149457){return{'name':_0x149457[_0xb130('0x21')],'type':_0x149457[_0xb130('0x22')][_0xb130('0x23')]};});_0x47f15e=qs[_0xb130('0x24')](_0x15d4db,_0x325785);return interaction[_0xb130('0x25')](_0xb130('0x26'),_0x325785[_0xb130('0x27')],_0x325785[_0xb130('0x28')],_0x47f15e,_0x15d4db)[_0xb130('0x1a')](respondWithFilteredResult(_0x4f17b9,_0x47f15e))[_0xb130('0x29')](handleError(_0x4f17b9,null));};exports['show']=function(_0x3a1941,_0xe0c422){var _0x19920a={'raw':![],'where':{'id':_0x3a1941[_0xb130('0x2a')]['id']}},_0x1cf034={};_0x1cf034[_0xb130('0x2b')]=_[_0xb130('0x2c')](db['SmsInteraction']['rawAttributes']);_0x1cf034[_0xb130('0x27')]=_[_0xb130('0x2c')](_0x3a1941[_0xb130('0x27')]);_0x1cf034[_0xb130('0x2d')]=_[_0xb130('0x2e')](_0x1cf034[_0xb130('0x2b')],_0x1cf034[_0xb130('0x27')]);_0x19920a[_0xb130('0x2f')]=_[_0xb130('0x2e')](_0x1cf034[_0xb130('0x2b')],qs[_0xb130('0x30')](_0x3a1941[_0xb130('0x27')][_0xb130('0x30')]));_0x19920a[_0xb130('0x2f')]=_0x19920a[_0xb130('0x2f')][_0xb130('0x31')]?_0x19920a[_0xb130('0x2f')]:_0x1cf034[_0xb130('0x2b')];if(_0x3a1941[_0xb130('0x27')][_0xb130('0x32')]){_0x19920a[_0xb130('0x33')]=[{'all':!![]}];}_0x19920a=_[_0xb130('0x34')]({},_0x19920a,_0x3a1941[_0xb130('0x35')]);return db[_0xb130('0x20')][_0xb130('0x36')](_0x19920a)[_0xb130('0x1a')](handleEntityNotFound(_0xe0c422,null))[_0xb130('0x1a')](respondWithResult(_0xe0c422,null))[_0xb130('0x29')](handleError(_0xe0c422,null));};exports[_0xb130('0x37')]=function(_0x5f451a,_0x48e321){return db[_0xb130('0x20')][_0xb130('0x37')](_0x5f451a['body'],{})['then'](respondWithResult(_0x48e321,0xc9))[_0xb130('0x29')](handleError(_0x48e321,null));};exports[_0xb130('0x38')]=function(_0x253d54,_0x521633){if(_0x253d54[_0xb130('0x39')]['id']){delete _0x253d54[_0xb130('0x39')]['id'];}return db[_0xb130('0x20')][_0xb130('0x36')]({'where':{'id':_0x253d54[_0xb130('0x2a')]['id']}})[_0xb130('0x1a')](handleEntityNotFound(_0x521633,null))['then'](saveUpdates(_0x253d54['body'],null))[_0xb130('0x1a')](respondWithResult(_0x521633,null))['catch'](handleError(_0x521633,null));};exports[_0xb130('0x3a')]=function(_0x154811,_0x6aac37){return db['SmsInteraction'][_0xb130('0x36')]({'where':{'id':_0x154811[_0xb130('0x2a')]['id']}})[_0xb130('0x1a')](handleEntityNotFound(_0x6aac37,null))['then'](removeEntity(_0x6aac37,null))[_0xb130('0x29')](handleError(_0x6aac37,null));};exports[_0xb130('0x3b')]=function(_0x16fb40,_0x13d95a){return db['SmsInteraction'][_0xb130('0x3b')]()[_0xb130('0x1a')](respondWithResult(_0x13d95a,null))[_0xb130('0x29')](handleError(_0x13d95a,null));};exports['addMessage']=function(_0x31325d,_0x5bfb6e){return db[_0xb130('0x3c')][_0xb130('0x36')]({'where':{'id':_0x31325d[_0xb130('0x2a')]['id']}})[_0xb130('0x1a')](handleEntityNotFound(_0x5bfb6e,null))[_0xb130('0x1a')](function(_0x347341){if(_0x347341){return _0x347341[_0xb130('0x3d')](_0x31325d['body']['ids'],_[_0xb130('0x3e')](_0x31325d[_0xb130('0x39')],['ids','id'])||{});}})['then'](respondWithResult(_0x5bfb6e,null))[_0xb130('0x29')](handleError(_0x5bfb6e,null));};exports[_0xb130('0x3f')]=function(_0x3acdc7,_0x4086d5){var _0x499812={'raw':![],'where':{}};var _0x3a8260={};var _0x5d4191={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xb130('0x40')]({'where':{'id':_0x3acdc7[_0xb130('0x2a')]['id']}})[_0xb130('0x1a')](handleEntityNotFound(_0x4086d5,null))[_0xb130('0x1a')](function(_0x4cd29a){if(_0x4cd29a){_0x3a8260[_0xb130('0x2b')]=_[_0xb130('0x2c')](db['SmsMessage'][_0xb130('0x41')]);_0x3a8260[_0xb130('0x27')]=_['keys'](_0x3acdc7['query']);_0x3a8260[_0xb130('0x2d')]=_[_0xb130('0x2e')](_0x3a8260[_0xb130('0x2b')],_0x3a8260['query']);_0x499812[_0xb130('0x2f')]=_[_0xb130('0x2e')](_0x3a8260[_0xb130('0x2b')],qs['fields'](_0x3acdc7['query'][_0xb130('0x30')]));_0x499812[_0xb130('0x2f')]=_0x499812[_0xb130('0x2f')][_0xb130('0x31')]?_0x499812[_0xb130('0x2f')]:_0x3a8260[_0xb130('0x2b')];if(!_0x3acdc7[_0xb130('0x27')][_0xb130('0x42')](_0xb130('0x43'))){_0x499812['limit']=qs[_0xb130('0x18')](_0x3acdc7['query'][_0xb130('0x18')]);_0x499812[_0xb130('0x15')]=qs[_0xb130('0x15')](_0x3acdc7[_0xb130('0x27')]['offset']);}_0x499812[_0xb130('0x44')]=qs[_0xb130('0x45')](_0x3acdc7[_0xb130('0x27')]['sort']);_0x499812['where']=qs[_0xb130('0x2d')](_[_0xb130('0x46')](_0x3acdc7[_0xb130('0x27')],_0x3a8260[_0xb130('0x2d')]));_0x499812[_0xb130('0x47')]['SmsInteractionId']=_0x4cd29a['id'];if(_0x3acdc7[_0xb130('0x27')][_0xb130('0x48')]){_0x499812[_0xb130('0x47')]=_['merge'](_0x499812[_0xb130('0x47')],{'$or':_[_0xb130('0x1f')](_0x499812[_0xb130('0x2f')],function(_0xa2bb2){var _0xf6f547={};_0xf6f547[_0xa2bb2]={'$like':'%'+_0x3acdc7['query'][_0xb130('0x48')]+'%'};return _0xf6f547;})});}if(_0x3acdc7[_0xb130('0x27')][_0xb130('0x49')]){var _0x5e326e=_0x3acdc7['query'][_0xb130('0x49')]['split'](',');var _0x3feda0={};_0x3feda0[_0x5e326e[0x0]]={'$gte':moment(_0x5e326e[0x1])[_0xb130('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x499812[_0xb130('0x47')]=_[_0xb130('0x34')](_0x499812[_0xb130('0x47')],_0x3feda0);}_0x499812=_['merge']({},_0x499812,_0x3acdc7['options']);return db[_0xb130('0x3c')]['count']({'where':_0x499812['where']})['then'](function(_0x2ad405){_0x5d4191[_0xb130('0x17')]=_0x2ad405;if(_0x3acdc7[_0xb130('0x27')][_0xb130('0x32')]){_0x499812[_0xb130('0x33')]=[{'all':!![]}];}return db['SmsMessage'][_0xb130('0x25')](_0x499812);})[_0xb130('0x1a')](function(_0x175294){_0x5d4191['rows']=_0x175294;return _0x5d4191;});}})[_0xb130('0x1a')](respondWithFilteredResult(_0x4086d5,_0x499812))[_0xb130('0x29')](handleError(_0x4086d5,null));};exports[_0xb130('0x4b')]=function(_0x332d15,_0x25cdd8){return db['SmsInteraction'][_0xb130('0x36')]({'where':{'id':_0x332d15['params']['id']}})[_0xb130('0x1a')](handleEntityNotFound(_0x25cdd8,null))[_0xb130('0x1a')](function(_0x53805f){if(_0x53805f){return _0x53805f['setTags'](_0x332d15['body'][_0xb130('0x4c')],_[_0xb130('0x3e')](_0x332d15[_0xb130('0x39')],[_0xb130('0x4c'),'id'])||{})[_0xb130('0x4d')](function(){return db[_0xb130('0x4e')][_0xb130('0x25')]({'attributes':['id',_0xb130('0x1d'),_0xb130('0x4f')],'where':{'id':_0x332d15['body'][_0xb130('0x4c')]}});})[_0xb130('0x1a')](function(_0x4e071b){socket[_0xb130('0x50')]('smsInteractionTags:save',{'id':Number(_0x332d15[_0xb130('0x2a')]['id']),'tags':_0x4e071b||[]});return{'id':Number(_0x332d15[_0xb130('0x2a')]['id']),'tags':_0x4e071b||[]};});}})['then'](respondWithResult(_0x25cdd8,null))[_0xb130('0x29')](handleError(_0x25cdd8,null));};exports['removeTags']=function(_0x1c6aee,_0x15d529){return db[_0xb130('0x20')]['find']({'where':{'id':_0x1c6aee['params']['id']}})['then'](handleEntityNotFound(_0x15d529,null))[_0xb130('0x1a')](function(_0x178bf2){if(_0x178bf2){return _0x178bf2['removeTags'](_0x1c6aee[_0xb130('0x27')][_0xb130('0x4c')]);}})[_0xb130('0x1a')](respondWithStatusCode(_0x15d529,null))['catch'](handleError(_0x15d529,null));};exports[_0xb130('0x51')]=function(_0x37e404,_0x2bcb93){var _0x548adb=moment()[_0xb130('0x52')]()[_0xb130('0x53')]();var _0x5b84d9=path[_0xb130('0x54')](config['root'],_0xb130('0x55'),'files',_0xb130('0x56'));var _0xd7bc92=path[_0xb130('0x54')](_0x5b84d9,_0x548adb);var _0x128b5c=util[_0xb130('0x4a')]('transcript-%d-%s.zip',_0x37e404[_0xb130('0x2a')]['id'],_0x548adb);var _0x1f50c9=path['join'](_0x5b84d9,_0x128b5c);var _0xd39a3c=[];_0xd39a3c[_0xb130('0x57')]({'model':db[_0xb130('0x58')],'as':_0xb130('0x58'),'attributes':['id',_0xb130('0x59')],'raw':!![]});_0xd39a3c[_0xb130('0x57')]({'model':db['CmContact'],'as':_0xb130('0x5a'),'attributes':['id',_0xb130('0x5b'),'lastName'],'raw':!![]});var _0x424da1=[{'model':db[_0xb130('0x3c')],'as':_0xb130('0x5c'),'attributes':['id',_0xb130('0x39'),_0xb130('0x5d'),'direction','secret',_0xb130('0x5e')],'include':_0xd39a3c}];_0x424da1[_0xb130('0x57')]({'model':db[_0xb130('0x5f')],'as':_0xb130('0x60'),'attributes':['id','name']});_0x424da1['push']({'model':db['User'],'as':_0xb130('0x61'),'attributes':['id',_0xb130('0x59')]});return db['SmsInteraction'][_0xb130('0x36')]({'where':{'id':_0x37e404['params']['id']},'include':_0x424da1})['then'](handleEntityNotFound(_0x2bcb93,null))[_0xb130('0x1a')](function(_0x477314){if(_0x477314){var _0x26a91f=_0x477314[_0xb130('0x62')]({'plain':!![]});fs[_0xb130('0x63')](_0xd7bc92);var _0x7e55bf={'channel':'Sms','account':_0x26a91f[_0xb130('0x60')][_0xb130('0x1d')],'agent':_0x26a91f[_0xb130('0x61')]?_0x26a91f['Owner'][_0xb130('0x59')]:'N.A.','createdAt':moment(_0x26a91f[_0xb130('0x5d')])[_0xb130('0x4a')](_0xb130('0x64'))['toString'](),'closedAt':_0x26a91f['closed']?moment(_0x26a91f[_0xb130('0x65')])[_0xb130('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb130('0x53')]():'','disposition':_0x26a91f['disposition'],'messages':_(_0x26a91f['Messages'])['filter']({'secret':![]})['map'](function(_0x337baa){return{'date':moment(_0x337baa[_0xb130('0x5d')])[_0xb130('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb130('0x53')](),'sender':_0x337baa[_0xb130('0x66')]===_0xb130('0x67')?_0x337baa[_0xb130('0x58')]?_0x337baa[_0xb130('0x58')][_0xb130('0x59')]:_0xb130('0x68'):_0x337baa[_0xb130('0x5a')][_0xb130('0x5b')]+(_0x337baa[_0xb130('0x5a')][_0xb130('0x69')]?'\x20'+_0x337baa['Contact'][_0xb130('0x69')]:''),'body':_0x337baa[_0xb130('0x39')],'direction':_0x337baa['direction']===_0xb130('0x67')?'A':'C','secret':_0x337baa['secret'],'read':_0x337baa[_0xb130('0x5e')]};})['value']()};return ejs[_0xb130('0x6a')](path[_0xb130('0x54')](config['root'],_0xb130('0x55'),_0xb130('0x6b'),_0xb130('0x6c')),{'interaction':_0x7e55bf})[_0xb130('0x1a')](function(_0x405b86){var _0x493a86=path['join'](_0xd7bc92,'transcript-'+_0x26a91f['id']+'-'+_0x548adb+_0xb130('0x6d'));var _0x4f8b92={'path':_0x493a86,'channel':_0xb130('0x6e'),'interactionId':_0x26a91f['id']};return pdf[_0xb130('0x6f')](_0x405b86,_0x4f8b92);})[_0xb130('0x1a')](function(){return new BPromise(function(_0x2d4981,_0xa14f22){zipdir(_0xd7bc92,{'saveTo':_0x1f50c9},function(_0x297603,_0x4dec16){if(_0x297603)return _0xa14f22(_0x297603);return _0x2d4981(_0x4dec16);});})[_0xb130('0x1a')](function(){return new BPromise(function(_0x24f5ce,_0x273d68){rimraf(_0xd7bc92,function(_0x1f8f28){if(_0x1f8f28)_0x273d68(_0x1f8f28);return _0x24f5ce();});});})[_0xb130('0x1a')](function(){return _0x2bcb93[_0xb130('0x51')](_0x1f50c9,_0x128b5c,function(_0x327c8b){if(_0x327c8b){console[_0xb130('0x70')](_0xb130('0x71'),_0x327c8b);}else{fs[_0xb130('0x72')](_0x1f50c9);}});});});}else{return _0x2bcb93['sendStatus'](0xc8);}})[_0xb130('0x29')](handleError(_0x2bcb93,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 867bad2..f60847b 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 _0x5f2f=['catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','getUsers','then','Users','map','setDataValue','length'];(function(_0x5b58ab,_0x7d4fd){var _0x258035=function(_0x56a985){while(--_0x56a985){_0x5b58ab['push'](_0x5b58ab['shift']());}};_0x258035(++_0x7d4fd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2c9e19,_0x185c17){_0x2c9e19=_0x2c9e19-0x0;var _0x5af8d5=_0x5f2f[_0x2c9e19];return _0x5af8d5;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var SmsInteraction=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var SmsMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xf5f2('0x4')](0x0);var events={'afterCreate':_0xf5f2('0x5'),'afterUpdate':_0xf5f2('0x6'),'afterDestroy':'remove'};function emitEvent(_0x4854b6){return function(_0x1665c7,_0x192215,_0xad7f65){_0x1665c7[_0xf5f2('0x7')]({'attributes':['id'],'raw':!![]})[_0xf5f2('0x8')](function(_0x473100){_0x1665c7['setDataValue'](_0xf5f2('0x9'),_0x473100[_0xf5f2('0xa')](function(_0x2ec345){return{'id':_0x2ec345['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x1665c7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf5f2('0x8')](function(_0x15dd7c){_0x1665c7[_0xf5f2('0xb')]('unreadMessages',_0x15dd7c[_0xf5f2('0xc')]);SmsInteractionEvents['emit'](_0x4854b6+':'+_0x1665c7['id'],_0x1665c7);SmsInteractionEvents['emit'](_0x4854b6,_0x1665c7);_0xad7f65(null);})[_0xf5f2('0xd')](_0xad7f65(null));};}for(var e in events){if(events[_0xf5f2('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xf5f2('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0xd914=['length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages'];(function(_0x229326,_0x45cb5a){var _0xdb6750=function(_0x4f63e9){while(--_0x4f63e9){_0x229326['push'](_0x229326['shift']());}};_0xdb6750(++_0x45cb5a);}(_0xd914,0x17f));var _0x4d91=function(_0x32f6b9,_0x2d4aa9){_0x32f6b9=_0x32f6b9-0x0;var _0x267d52=_0xd914[_0x32f6b9];return _0x267d52;};'use strict';var EventEmitter=require(_0x4d91('0x0'));var SmsInteraction=require(_0x4d91('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x4d91('0x1'))['db'][_0x4d91('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x4d91('0x3')](0x0);var events={'afterCreate':_0x4d91('0x4'),'afterUpdate':_0x4d91('0x5'),'afterDestroy':_0x4d91('0x6')};function emitEvent(_0x4875a2){return function(_0x1b256e,_0x5d8af4,_0x3ab6f8){_0x1b256e[_0x4d91('0x7')]({'attributes':['id'],'raw':!![]})[_0x4d91('0x8')](function(_0x27c0d5){_0x1b256e[_0x4d91('0x9')](_0x4d91('0xa'),_0x27c0d5[_0x4d91('0xb')](function(_0x2a3ca1){return{'id':_0x2a3ca1['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x1b256e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4d91('0x8')](function(_0xa4bb25){_0x1b256e[_0x4d91('0x9')](_0x4d91('0xc'),_0xa4bb25[_0x4d91('0xd')]);SmsInteractionEvents[_0x4d91('0xe')](_0x4875a2+':'+_0x1b256e['id'],_0x1b256e);SmsInteractionEvents['emit'](_0x4875a2,_0x1b256e);_0x3ab6f8(null);})['catch'](_0x3ab6f8(null));};}for(var e in events){if(events[_0x4d91('0xf')](e)){var event=events[e];SmsInteraction[_0x4d91('0x10')](e,emitEvent(event));}}module[_0x4d91('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index c3e89ee..d6c6ace 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 _0x007d=['api','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0xb2c34a,_0xee6321){var _0x489e06=function(_0x1f2525){while(--_0x1f2525){_0xb2c34a['push'](_0xb2c34a['shift']());}};_0x489e06(++_0xee6321);}(_0x007d,0x1be));var _0xd007=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x007d[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xd007('0x0'));var util=require(_0xd007('0x1'));var logger=require('../../config/logger')(_0xd007('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd007('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd007('0x4'));var config=require(_0xd007('0x5'));var attributes=require(_0xd007('0x6'));module[_0xd007('0x7')]=function(_0x2992a1,_0x5009d7){return _0x2992a1[_0xd007('0x8')]('SmsInteraction',attributes,{'tableName':_0xd007('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x46a11e,_0x4d55a9,_0x28d95f){if(_0x46a11e[_0xd007('0xa')](_0xd007('0xb'))){_0x46a11e[_0xd007('0xc')]=moment()['format'](_0xd007('0xd'));}_0x28d95f(null,_0x46a11e);}}});}; \ No newline at end of file +var _0x0aec=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x200aa5,_0x197802){var _0x458200=function(_0x594959){while(--_0x594959){_0x200aa5['push'](_0x200aa5['shift']());}};_0x458200(++_0x197802);}(_0x0aec,0x98));var _0xc0ae=function(_0x5c956b,_0xa87d11){_0x5c956b=_0x5c956b-0x0;var _0xaff46a=_0x0aec[_0x5c956b];return _0xaff46a;};'use strict';var _=require(_0xc0ae('0x0'));var util=require(_0xc0ae('0x1'));var logger=require(_0xc0ae('0x2'))(_0xc0ae('0x3'));var moment=require(_0xc0ae('0x4'));var BPromise=require(_0xc0ae('0x5'));var rp=require(_0xc0ae('0x6'));var fs=require('fs');var path=require(_0xc0ae('0x7'));var rimraf=require(_0xc0ae('0x8'));var config=require(_0xc0ae('0x9'));var attributes=require(_0xc0ae('0xa'));module[_0xc0ae('0xb')]=function(_0x21e142,_0x145bcd){return _0x21e142['define'](_0xc0ae('0xc'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x486639,_0x7221e0,_0x2953f9){if(_0x486639['changed'](_0xc0ae('0xd'))){_0x486639[_0xc0ae('0xe')]=moment()[_0xc0ae('0xf')](_0xc0ae('0x10'));}_0x2953f9(null,_0x486639);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index ba16a41..69d5bf7 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 _0xca0c=['lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','limit','find','addTags','omit','ids','AddTags'];(function(_0x25a4f8,_0x3505f8){var _0x4936ff=function(_0x45cb58){while(--_0x45cb58){_0x25a4f8['push'](_0x25a4f8['shift']());}};_0x4936ff(++_0x3505f8);}(_0xca0c,0x1ad));var _0xcca0=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xca0c[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xcca0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcca0('0x1'));var fs=require('fs');var Redis=require(_0xcca0('0x2'));var db=require(_0xcca0('0x3'))['db'];var utils=require(_0xcca0('0x4'));var logger=require(_0xcca0('0x5'))(_0xcca0('0x6'));var config=require(_0xcca0('0x7'));var jayson=require(_0xcca0('0x8'));var client=jayson[_0xcca0('0x9')][_0xcca0('0xa')]({'port':0x232a});config[_0xcca0('0xb')]=_[_0xcca0('0xc')](config[_0xcca0('0xb')],{'host':_0xcca0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcca0('0xb')]));require(_0xcca0('0xe'))[_0xcca0('0xf')](socket);function respondWithRpcPromise(_0x2dfb3e,_0x11c988,_0xb5271d){return new BPromise(function(_0x2aa3c6,_0x34d39f){return client['request'](_0x2dfb3e,_0xb5271d)[_0xcca0('0x10')](function(_0xc2105a){logger[_0xcca0('0x11')](_0xcca0('0x12'),_0x11c988,_0xcca0('0x13'));logger[_0xcca0('0x14')](_0xcca0('0x15'),_0x11c988,_0xcca0('0x13'),JSON[_0xcca0('0x16')](_0xc2105a));if(_0xc2105a[_0xcca0('0x17')]){if(_0xc2105a[_0xcca0('0x17')][_0xcca0('0x18')]===0x1f4){logger[_0xcca0('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x11c988,_0xc2105a[_0xcca0('0x17')][_0xcca0('0x19')]);return _0x34d39f(_0xc2105a[_0xcca0('0x17')]['message']);}logger[_0xcca0('0x17')](_0xcca0('0x12'),_0x11c988,_0xc2105a[_0xcca0('0x17')][_0xcca0('0x19')]);return _0x2aa3c6(_0xc2105a[_0xcca0('0x17')][_0xcca0('0x19')]);}else{logger['info'](_0xcca0('0x12'),_0x11c988,_0xcca0('0x13'));_0x2aa3c6(_0xc2105a['result']['message']);}})[_0xcca0('0x1a')](function(_0x21292c){logger['error'](_0xcca0('0x12'),_0x11c988,_0x21292c);_0x34d39f(_0x21292c);});});}exports[_0xcca0('0x1b')]=function(_0x547f5f){var _0x3189fd=this;return new Promise(function(_0x6eedba,_0x139b5b){return db[_0xcca0('0x1c')][_0xcca0('0x1d')](_0x547f5f[_0xcca0('0x1e')],{'raw':_0x547f5f[_0xcca0('0x1f')]?_0x547f5f['options'][_0xcca0('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x547f5f[_0xcca0('0x1f')]?_0x547f5f[_0xcca0('0x1f')]['where']||null:null,'attributes':_0x547f5f[_0xcca0('0x1f')]?_0x547f5f[_0xcca0('0x1f')]['attributes']||null:null,'limit':_0x547f5f[_0xcca0('0x1f')]?_0x547f5f['options'][_0xcca0('0x21')]||null:null})[_0xcca0('0x10')](function(_0x37dfd3){logger['info']('UpdateSmsInteraction',_0x547f5f);logger[_0xcca0('0x14')](_0xcca0('0x1b'),_0x547f5f,JSON[_0xcca0('0x16')](_0x37dfd3));_0x6eedba(_0x37dfd3);})[_0xcca0('0x1a')](function(_0x344902){logger['error']('UpdateSmsInteraction',_0x344902[_0xcca0('0x19')],_0x547f5f);_0x139b5b(_0x3189fd[_0xcca0('0x17')](0x1f4,_0x344902[_0xcca0('0x19')]));});});};exports['AddTagsToSmsInteraction']=function(_0x4e75f5){return new Promise(function(_0xa49b52,_0x46e1ed){return db['SmsInteraction'][_0xcca0('0x22')]({'where':_0x4e75f5[_0xcca0('0x1f')]?_0x4e75f5[_0xcca0('0x1f')]['where']||null:null})['then'](function(_0x1b5ccb){if(_0x1b5ccb){return _0x1b5ccb[_0xcca0('0x23')](_0x4e75f5[_0xcca0('0x1e')]['ids'],_[_0xcca0('0x24')](_0x4e75f5[_0xcca0('0x1e')],[_0xcca0('0x25'),'id'])||{});}})['spread'](function(_0x2540a2){logger[_0xcca0('0x11')](_0xcca0('0x26'),_0x4e75f5);logger[_0xcca0('0x14')](_0xcca0('0x26'),_0x4e75f5,JSON[_0xcca0('0x16')](_0x2540a2));_0xa49b52(_0x2540a2);})['catch'](function(_0x324ffb){logger['error'](_0xcca0('0x26'),_0x324ffb[_0xcca0('0x19')],_0x4e75f5);_0x46e1ed(_this[_0xcca0('0x17')](0x1f4,_0x324ffb['message']));});});}; \ No newline at end of file +var _0x8743=['ids','body','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','./smsInteraction.socket','request','info','debug','request\x20sent','error','code','SmsInteraction,\x20%s,\x20%s','message','result','SmsInteraction','update','options','raw','where','attributes','limit','then','UpdateSmsInteraction','stringify','catch','AddTagsToSmsInteraction','find','addTags'];(function(_0x347f3f,_0x362793){var _0x5c16ef=function(_0x89fb2e){while(--_0x89fb2e){_0x347f3f['push'](_0x347f3f['shift']());}};_0x5c16ef(++_0x362793);}(_0x8743,0xee));var _0x3874=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x8743[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x3874('0x0'));var util=require(_0x3874('0x1'));var moment=require(_0x3874('0x2'));var BPromise=require('bluebird');var rs=require(_0x3874('0x3'));var fs=require('fs');var Redis=require(_0x3874('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3874('0x5'))('rpc');var config=require(_0x3874('0x6'));var jayson=require(_0x3874('0x7'));var client=jayson[_0x3874('0x8')]['http']({'port':0x232a});config[_0x3874('0x9')]=_[_0x3874('0xa')](config[_0x3874('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3874('0x9')]));require(_0x3874('0xb'))['register'](socket);function respondWithRpcPromise(_0x516143,_0x27d515,_0x4168d9){return new BPromise(function(_0x2276a9,_0x328038){return client[_0x3874('0xc')](_0x516143,_0x4168d9)['then'](function(_0x408812){logger[_0x3874('0xd')]('SmsInteraction,\x20%s,\x20%s',_0x27d515,'request\x20sent');logger[_0x3874('0xe')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x27d515,_0x3874('0xf'),JSON['stringify'](_0x408812));if(_0x408812[_0x3874('0x10')]){if(_0x408812[_0x3874('0x10')][_0x3874('0x11')]===0x1f4){logger[_0x3874('0x10')](_0x3874('0x12'),_0x27d515,_0x408812['error'][_0x3874('0x13')]);return _0x328038(_0x408812[_0x3874('0x10')][_0x3874('0x13')]);}logger[_0x3874('0x10')](_0x3874('0x12'),_0x27d515,_0x408812[_0x3874('0x10')][_0x3874('0x13')]);return _0x2276a9(_0x408812[_0x3874('0x10')][_0x3874('0x13')]);}else{logger[_0x3874('0xd')](_0x3874('0x12'),_0x27d515,_0x3874('0xf'));_0x2276a9(_0x408812[_0x3874('0x14')]['message']);}})['catch'](function(_0x18e3e6){logger[_0x3874('0x10')](_0x3874('0x12'),_0x27d515,_0x18e3e6);_0x328038(_0x18e3e6);});});}exports['UpdateSmsInteraction']=function(_0x1149ee){var _0x3f3b96=this;return new Promise(function(_0x24ee58,_0x4e9b30){return db[_0x3874('0x15')][_0x3874('0x16')](_0x1149ee['body'],{'raw':_0x1149ee['options']?_0x1149ee[_0x3874('0x17')][_0x3874('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1149ee['options']?_0x1149ee['options'][_0x3874('0x19')]||null:null,'attributes':_0x1149ee['options']?_0x1149ee[_0x3874('0x17')][_0x3874('0x1a')]||null:null,'limit':_0x1149ee[_0x3874('0x17')]?_0x1149ee['options'][_0x3874('0x1b')]||null:null})[_0x3874('0x1c')](function(_0x3e3e14){logger['info'](_0x3874('0x1d'),_0x1149ee);logger[_0x3874('0xe')](_0x3874('0x1d'),_0x1149ee,JSON[_0x3874('0x1e')](_0x3e3e14));_0x24ee58(_0x3e3e14);})[_0x3874('0x1f')](function(_0x37307c){logger[_0x3874('0x10')](_0x3874('0x1d'),_0x37307c['message'],_0x1149ee);_0x4e9b30(_0x3f3b96['error'](0x1f4,_0x37307c[_0x3874('0x13')]));});});};exports[_0x3874('0x20')]=function(_0x353485){return new Promise(function(_0x71681d,_0x8426ae){return db[_0x3874('0x15')][_0x3874('0x21')]({'where':_0x353485[_0x3874('0x17')]?_0x353485[_0x3874('0x17')][_0x3874('0x19')]||null:null})[_0x3874('0x1c')](function(_0x2d7f2d){if(_0x2d7f2d){return _0x2d7f2d[_0x3874('0x22')](_0x353485['body'][_0x3874('0x23')],_['omit'](_0x353485[_0x3874('0x24')],[_0x3874('0x23'),'id'])||{});}})[_0x3874('0x25')](function(_0x1fad34){logger[_0x3874('0xd')](_0x3874('0x26'),_0x353485);logger[_0x3874('0xe')](_0x3874('0x26'),_0x353485,JSON[_0x3874('0x1e')](_0x1fad34));_0x71681d(_0x1fad34);})[_0x3874('0x1f')](function(_0x4d17dc){logger[_0x3874('0x10')]('AddTags',_0x4d17dc[_0x3874('0x13')],_0x353485);_0x8426ae(_this[_0x3874('0x10')](0x1f4,_0x4d17dc['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index d4741b9..993e685 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 _0x98db=['register','length','smsInteraction:','./smsInteraction.events','save','remove','emit','removeListener'];(function(_0x2bf888,_0x374f0b){var _0x3038d6=function(_0xe1b6d9){while(--_0xe1b6d9){_0x2bf888['push'](_0x2bf888['shift']());}};_0x3038d6(++_0x374f0b);}(_0x98db,0x143));var _0xb98d=function(_0x6f1a87,_0x5d5bcf){_0x6f1a87=_0x6f1a87-0x0;var _0x2495c7=_0x98db[_0x6f1a87];return _0x2495c7;};'use strict';var SmsInteractionEvents=require(_0xb98d('0x0'));var events=[_0xb98d('0x1'),_0xb98d('0x2'),'update'];function createListener(_0x46e56f,_0x28a80f){return function(_0x38a647){_0x28a80f[_0xb98d('0x3')](_0x46e56f,_0x38a647);};}function removeListener(_0x2eb810,_0x4d9dab){return function(){SmsInteractionEvents[_0xb98d('0x4')](_0x2eb810,_0x4d9dab);};}exports[_0xb98d('0x5')]=function(_0x50a8a5){for(var _0x2eff79=0x0,_0x844e55=events[_0xb98d('0x6')];_0x2eff79<_0x844e55;_0x2eff79++){var _0x3a93d7=events[_0x2eff79];var _0x240e61=createListener(_0xb98d('0x7')+_0x3a93d7,_0x50a8a5);SmsInteractionEvents['on'](_0x3a93d7,_0x240e61);}}; \ No newline at end of file +var _0x1c4b=['register','length','smsInteraction:','./smsInteraction.events','save','remove','update','emit'];(function(_0x3c0dcc,_0x18c419){var _0x1a224c=function(_0x238ae7){while(--_0x238ae7){_0x3c0dcc['push'](_0x3c0dcc['shift']());}};_0x1a224c(++_0x18c419);}(_0x1c4b,0x9b));var _0xb1c4=function(_0xced708,_0x3fac63){_0xced708=_0xced708-0x0;var _0x3e176f=_0x1c4b[_0xced708];return _0x3e176f;};'use strict';var SmsInteractionEvents=require(_0xb1c4('0x0'));var events=[_0xb1c4('0x1'),_0xb1c4('0x2'),_0xb1c4('0x3')];function createListener(_0x10beaa,_0xca243f){return function(_0x592548){_0xca243f[_0xb1c4('0x4')](_0x10beaa,_0x592548);};}function removeListener(_0x4018a2,_0x1254b4){return function(){SmsInteractionEvents['removeListener'](_0x4018a2,_0x1254b4);};}exports[_0xb1c4('0x5')]=function(_0x309d68){for(var _0x283472=0x0,_0x4097d1=events[_0xb1c4('0x6')];_0x283472<_0x4097d1;_0x283472++){var _0x5c3163=events[_0x283472];var _0x549c79=createListener(_0xb1c4('0x7')+_0x5c3163,_0x309d68);SmsInteractionEvents['on'](_0x5c3163,_0x549c79);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index b6b2888..f7a8356 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 _0x059a=['get','index','/describe','/:id','isAuthenticated','post','tracked','create','/:id/status','status','update','put','/:id/reject','reject','destroy','util','Router','fs-extra','../../config/environment'];(function(_0x1f3c1a,_0x386e2b){var _0x27fb1a=function(_0x52991f){while(--_0x52991f){_0x1f3c1a['push'](_0x1f3c1a['shift']());}};_0x27fb1a(++_0x386e2b);}(_0x059a,0x18b));var _0xa059=function(_0x126977,_0x25df7f){_0x126977=_0x126977-0x0;var _0x15e83e=_0x059a[_0x126977];return _0x15e83e;};'use strict';var multer=require('multer');var util=require(_0xa059('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa059('0x1')]();var fs_extra=require(_0xa059('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa059('0x3'));var controller=require('./smsMessage.controller');router[_0xa059('0x4')]('/',auth['isAuthenticated'](),controller[_0xa059('0x5')]);router[_0xa059('0x4')](_0xa059('0x6'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xa059('0x7'),auth[_0xa059('0x8')](),controller['show']);router[_0xa059('0x9')]('/',auth['isAuthenticated'](),interaction[_0xa059('0xa')]('sms','smsmessage:create'),controller[_0xa059('0xb')]);router[_0xa059('0x9')](_0xa059('0xc'),controller[_0xa059('0xd')]);router['put'](_0xa059('0x7'),auth[_0xa059('0x8')](),controller[_0xa059('0xe')]);router[_0xa059('0xf')]('/:id/accept',auth[_0xa059('0x8')](),controller['accept']);router[_0xa059('0xf')](_0xa059('0x10'),auth[_0xa059('0x8')](),controller[_0xa059('0x11')]);router['delete'](_0xa059('0x7'),auth[_0xa059('0x8')](),controller[_0xa059('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5e1e=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','smsmessage:create','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5c1b05,_0x213768){var _0x1a65e7=function(_0x2845d7){while(--_0x2845d7){_0x5c1b05['push'](_0x5c1b05['shift']());}};_0x1a65e7(++_0x213768);}(_0x5e1e,0x137));var _0xe5e1=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x5e1e[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0xe5e1('0x0'));var util=require(_0xe5e1('0x1'));var path=require(_0xe5e1('0x2'));var timeout=require('connect-timeout');var express=require(_0xe5e1('0x3'));var router=express[_0xe5e1('0x4')]();var fs_extra=require(_0xe5e1('0x5'));var auth=require(_0xe5e1('0x6'));var interaction=require(_0xe5e1('0x7'));var config=require(_0xe5e1('0x8'));var controller=require('./smsMessage.controller');router[_0xe5e1('0x9')]('/',auth[_0xe5e1('0xa')](),controller[_0xe5e1('0xb')]);router[_0xe5e1('0x9')](_0xe5e1('0xc'),auth[_0xe5e1('0xa')](),controller[_0xe5e1('0xd')]);router[_0xe5e1('0x9')](_0xe5e1('0xe'),auth[_0xe5e1('0xa')](),controller[_0xe5e1('0xf')]);router[_0xe5e1('0x10')]('/',auth[_0xe5e1('0xa')](),interaction[_0xe5e1('0x11')]('sms',_0xe5e1('0x12')),controller['create']);router[_0xe5e1('0x10')]('/:id/status',controller[_0xe5e1('0x13')]);router[_0xe5e1('0x14')](_0xe5e1('0xe'),auth['isAuthenticated'](),controller[_0xe5e1('0x15')]);router[_0xe5e1('0x14')](_0xe5e1('0x16'),auth[_0xe5e1('0xa')](),controller[_0xe5e1('0x17')]);router['put'](_0xe5e1('0x18'),auth['isAuthenticated'](),controller[_0xe5e1('0x19')]);router[_0xe5e1('0x1a')](_0xe5e1('0xe'),auth['isAuthenticated'](),controller[_0xe5e1('0x1b')]);module[_0xe5e1('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 6f9dd47..ecd3ad4 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 _0xe521=['out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x186c19,_0x2e1fdf){var _0x20c566=function(_0x18268d){while(--_0x18268d){_0x186c19['push'](_0x186c19['shift']());}};_0x20c566(++_0x2e1fdf);}(_0xe521,0x1a1));var _0x1e52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe521[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1e52('0x0'));module[_0x1e52('0x1')]={'body':{'type':Sequelize[_0x1e52('0x2')](_0x1e52('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1e52('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1e52('0x5')]('in',_0x1e52('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x1e52('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x1e52('0x8')]},'secret':{'type':Sequelize[_0x1e52('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1e52('0x7')]},'providerResponse':{'type':Sequelize[_0x1e52('0x2')]}}; \ No newline at end of file +var _0x7a59=['medium','BOOLEAN','STRING','DATE','exports'];(function(_0x31c3be,_0x5e540f){var _0x48314d=function(_0x65134b){while(--_0x65134b){_0x31c3be['push'](_0x31c3be['shift']());}};_0x48314d(++_0x5e540f);}(_0x7a59,0x199));var _0x97a5=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x7a59[_0x36ed48];return _0x51c63a;};'use strict';var Sequelize=require('sequelize');module[_0x97a5('0x0')]={'body':{'type':Sequelize['TEXT'](_0x97a5('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x97a5('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x97a5('0x3')](0xbe)},'phone':{'type':Sequelize[_0x97a5('0x3')]},'readAt':{'type':Sequelize[_0x97a5('0x4')]},'secret':{'type':Sequelize[_0x97a5('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x97a5('0x3')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 2d77e64..49c27af 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 _0xaebd=['sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','channel','event','accept','EventManager','../../config/logger','reject','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','motionChannel','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','end','status','json','offset','limit','count','set','Content-Range','apply','save','update','sendStatus','stack','name','send','index','map','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','SmsMessage','includeAll','rows','show','keys','rawAttributes','find','create','body','params','destroy','describe','sms-interactions'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x3562a8,_0x5cfc6c){_0x3562a8=_0x3562a8-0x0;var _0x1748c9=_0xaebd[_0x3562a8];return _0x1748c9;};'use strict';var emlformat=require(_0xdaeb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdaeb('0x1'));var jsonpatch=require(_0xdaeb('0x2'));var rp=require(_0xdaeb('0x3'));var moment=require(_0xdaeb('0x4'));var BPromise=require(_0xdaeb('0x5'));var Mustache=require('mustache');var util=require(_0xdaeb('0x6'));var path=require(_0xdaeb('0x7'));var sox=require(_0xdaeb('0x8'));var csv=require(_0xdaeb('0x9'));var ejs=require(_0xdaeb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdaeb('0xb'));var squel=require(_0xdaeb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdaeb('0xd'));var toCsv=require(_0xdaeb('0x9'));var querystring=require(_0xdaeb('0xe'));var Papa=require('papaparse');var Redis=require(_0xdaeb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdaeb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdaeb('0x11'));var logger=require('../../config/logger')(_0xdaeb('0x12'));var utils=require(_0xdaeb('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdaeb('0x14'))['db'];config['redis']=_[_0xdaeb('0x15')](config[_0xdaeb('0x16')],{'host':_0xdaeb('0x17'),'port':0x18eb});var socket=require(_0xdaeb('0x18'))(new Redis(config[_0xdaeb('0x16')]));require(_0xdaeb('0x19'))[_0xdaeb('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xdaeb('0x1b')]({'port':0x232c});var client9002=jayson[_0xdaeb('0x1c')][_0xdaeb('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x18ec4e,_0x538a25,_0x4c3bf3,_0x24b898){return new BPromise(function(_0x4dd803,_0x47984b){var _0x42e509=_0x24b898||client;return _0x42e509[_0xdaeb('0x1d')](_0x18ec4e,_0x4c3bf3)[_0xdaeb('0x1e')](function(_0x1fe84e){logger[_0xdaeb('0x1f')](_0xdaeb('0x20'),_0x538a25,'request\x20sent');logger[_0xdaeb('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x538a25,_0xdaeb('0x22'),JSON[_0xdaeb('0x23')](_0x1fe84e));if(_0x1fe84e[_0xdaeb('0x24')]){if(_0x1fe84e['error']['code']===0x1f4){logger[_0xdaeb('0x24')](_0xdaeb('0x20'),_0x538a25,_0x1fe84e[_0xdaeb('0x24')][_0xdaeb('0x25')]);return _0x47984b(_0x1fe84e[_0xdaeb('0x24')]['message']);}logger['error'](_0xdaeb('0x20'),_0x538a25,_0x1fe84e[_0xdaeb('0x24')][_0xdaeb('0x25')]);return _0x4dd803(_0x1fe84e[_0xdaeb('0x24')][_0xdaeb('0x25')]);}else{logger['info'](_0xdaeb('0x20'),_0x538a25,'request\x20sent');_0x4dd803(_0x1fe84e[_0xdaeb('0x26')][_0xdaeb('0x25')]);}})[_0xdaeb('0x27')](function(_0x3b0770){logger[_0xdaeb('0x24')]('SmsMessage,\x20%s,\x20%s',_0x538a25,_0x3b0770);_0x47984b(_0x3b0770);});});}function respondWithStatusCode(_0x3a0b9c,_0x34fa21){_0x34fa21=_0x34fa21||0xcc;return function(_0x338687){if(_0x338687){return _0x3a0b9c['sendStatus'](_0x34fa21);}return _0x3a0b9c['status'](_0x34fa21)[_0xdaeb('0x28')]();};}function respondWithResult(_0x4e7f44,_0x5045f8){_0x5045f8=_0x5045f8||0xc8;return function(_0x16cee7){if(_0x16cee7){return _0x4e7f44[_0xdaeb('0x29')](_0x5045f8)[_0xdaeb('0x2a')](_0x16cee7);}};}function respondWithFilteredResult(_0x5eb7b5,_0x5e6f97){return function(_0x32966f){if(_0x32966f){var _0x440022=typeof _0x5e6f97[_0xdaeb('0x2b')]==='undefined'&&typeof _0x5e6f97[_0xdaeb('0x2c')]==='undefined';var _0x4da82d=_0x32966f[_0xdaeb('0x2d')];var _0x21f6cf=_0x440022?0x0:_0x5e6f97[_0xdaeb('0x2b')];var _0x28c15c=_0x440022?_0x32966f[_0xdaeb('0x2d')]:_0x5e6f97[_0xdaeb('0x2b')]+_0x5e6f97[_0xdaeb('0x2c')];var _0x5f1c84;if(_0x28c15c>=_0x4da82d){_0x28c15c=_0x4da82d;_0x5f1c84=0xc8;}else{_0x5f1c84=0xce;}_0x5eb7b5[_0xdaeb('0x29')](_0x5f1c84);return _0x5eb7b5[_0xdaeb('0x2e')](_0xdaeb('0x2f'),_0x21f6cf+'-'+_0x28c15c+'/'+_0x4da82d)[_0xdaeb('0x2a')](_0x32966f);}return null;};}function patchUpdates(_0x2c89ae){return function(_0x557ba9){try{jsonpatch[_0xdaeb('0x30')](_0x557ba9,_0x2c89ae,!![]);}catch(_0x3de2bd){return BPromise['reject'](_0x3de2bd);}return _0x557ba9[_0xdaeb('0x31')]();};}function saveUpdates(_0x1464ac,_0x304abe){return function(_0x2247d1){if(_0x2247d1){return _0x2247d1[_0xdaeb('0x32')](_0x1464ac)[_0xdaeb('0x1e')](function(_0x2e83a6){return _0x2e83a6;});}return null;};}function removeEntity(_0x2eb63d,_0x2aed8e){return function(_0x1cf04b){if(_0x1cf04b){return _0x1cf04b['destroy']()['then'](function(){_0x2eb63d[_0xdaeb('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a45aa,_0x3dc058){return function(_0x164307){if(!_0x164307){_0x1a45aa[_0xdaeb('0x33')](0x194);}return _0x164307;};}function handleError(_0x1917e9,_0xfa78c1){_0xfa78c1=_0xfa78c1||0x1f4;return function(_0x5b2a73){logger[_0xdaeb('0x24')](_0x5b2a73[_0xdaeb('0x34')]);if(_0x5b2a73[_0xdaeb('0x35')]){delete _0x5b2a73['name'];}_0x1917e9[_0xdaeb('0x29')](_0xfa78c1)[_0xdaeb('0x36')](_0x5b2a73);};}exports[_0xdaeb('0x37')]=function(_0x104c90,_0x62fd11){var _0x168bd5={},_0x3c983d={},_0x5a0252={'count':0x0,'rows':[]};var _0x3afd0c=_[_0xdaeb('0x38')](db['SmsMessage']['rawAttributes'],function(_0x2ef310){return{'name':_0x2ef310[_0xdaeb('0x39')],'type':_0x2ef310['type'][_0xdaeb('0x3a')]};});_0x3c983d[_0xdaeb('0x3b')]=_['map'](_0x3afd0c,_0xdaeb('0x35'));_0x3c983d[_0xdaeb('0x3c')]=_['keys'](_0x104c90['query']);_0x3c983d[_0xdaeb('0x3d')]=_[_0xdaeb('0x3e')](_0x3c983d[_0xdaeb('0x3b')],_0x3c983d[_0xdaeb('0x3c')]);_0x168bd5[_0xdaeb('0x3f')]=_[_0xdaeb('0x3e')](_0x3c983d['model'],qs[_0xdaeb('0x40')](_0x104c90['query'][_0xdaeb('0x40')]));_0x168bd5['attributes']=_0x168bd5['attributes'][_0xdaeb('0x41')]?_0x168bd5['attributes']:_0x3c983d[_0xdaeb('0x3b')];if(!_0x104c90['query'][_0xdaeb('0x42')](_0xdaeb('0x43'))){_0x168bd5[_0xdaeb('0x2c')]=qs[_0xdaeb('0x2c')](_0x104c90['query'][_0xdaeb('0x2c')]);_0x168bd5['offset']=qs[_0xdaeb('0x2b')](_0x104c90[_0xdaeb('0x3c')][_0xdaeb('0x2b')]);}_0x168bd5['order']=qs[_0xdaeb('0x44')](_0x104c90[_0xdaeb('0x3c')][_0xdaeb('0x44')]);_0x168bd5[_0xdaeb('0x45')]=qs[_0xdaeb('0x3d')](_[_0xdaeb('0x46')](_0x104c90[_0xdaeb('0x3c')],_0x3c983d[_0xdaeb('0x3d')]),_0x3afd0c);if(_0x104c90[_0xdaeb('0x3c')][_0xdaeb('0x47')]){_0x168bd5[_0xdaeb('0x45')]=_[_0xdaeb('0x48')](_0x168bd5['where'],{'$or':_[_0xdaeb('0x38')](_0x3afd0c,function(_0x17fb13){if(_0x17fb13['type']!=='VIRTUAL'){var _0x3bfe4f={};_0x3bfe4f[_0x17fb13[_0xdaeb('0x35')]]={'$like':'%'+_0x104c90[_0xdaeb('0x3c')]['filter']+'%'};return _0x3bfe4f;}})});}_0x168bd5=_[_0xdaeb('0x48')]({},_0x168bd5,_0x104c90[_0xdaeb('0x49')]);var _0xc3671e={'where':_0x168bd5[_0xdaeb('0x45')]};return db[_0xdaeb('0x4a')][_0xdaeb('0x2d')](_0xc3671e)[_0xdaeb('0x1e')](function(_0x2e4327){_0x5a0252['count']=_0x2e4327;if(_0x104c90[_0xdaeb('0x3c')][_0xdaeb('0x4b')]){_0x168bd5['include']=[{'all':!![]}];}return db[_0xdaeb('0x4a')]['findAll'](_0x168bd5);})[_0xdaeb('0x1e')](function(_0x138d53){_0x5a0252[_0xdaeb('0x4c')]=_0x138d53;return _0x5a0252;})[_0xdaeb('0x1e')](respondWithFilteredResult(_0x62fd11,_0x168bd5))[_0xdaeb('0x27')](handleError(_0x62fd11,null));};exports[_0xdaeb('0x4d')]=function(_0x33a4d7,_0xfe595){var _0x2bd2fd={'raw':!![],'where':{'id':_0x33a4d7['params']['id']}},_0x4b8720={};_0x4b8720[_0xdaeb('0x3b')]=_[_0xdaeb('0x4e')](db[_0xdaeb('0x4a')][_0xdaeb('0x4f')]);_0x4b8720[_0xdaeb('0x3c')]=_[_0xdaeb('0x4e')](_0x33a4d7['query']);_0x4b8720[_0xdaeb('0x3d')]=_[_0xdaeb('0x3e')](_0x4b8720[_0xdaeb('0x3b')],_0x4b8720['query']);_0x2bd2fd[_0xdaeb('0x3f')]=_['intersection'](_0x4b8720[_0xdaeb('0x3b')],qs[_0xdaeb('0x40')](_0x33a4d7[_0xdaeb('0x3c')][_0xdaeb('0x40')]));_0x2bd2fd[_0xdaeb('0x3f')]=_0x2bd2fd[_0xdaeb('0x3f')]['length']?_0x2bd2fd['attributes']:_0x4b8720['model'];if(_0x33a4d7[_0xdaeb('0x3c')][_0xdaeb('0x4b')]){_0x2bd2fd['include']=[{'all':!![]}];}_0x2bd2fd=_['merge']({},_0x2bd2fd,_0x33a4d7['options']);return db[_0xdaeb('0x4a')][_0xdaeb('0x50')](_0x2bd2fd)[_0xdaeb('0x1e')](handleEntityNotFound(_0xfe595,null))[_0xdaeb('0x1e')](respondWithResult(_0xfe595,null))[_0xdaeb('0x27')](handleError(_0xfe595,null));};exports['create']=function(_0x619c7b,_0x4a8804){return db[_0xdaeb('0x4a')][_0xdaeb('0x51')](_0x619c7b[_0xdaeb('0x52')],{})[_0xdaeb('0x1e')](respondWithResult(_0x4a8804,0xc9))[_0xdaeb('0x27')](handleError(_0x4a8804,null));};exports[_0xdaeb('0x32')]=function(_0x51b98f,_0x583c1c){if(_0x51b98f[_0xdaeb('0x52')]['id']){delete _0x51b98f['body']['id'];}return db[_0xdaeb('0x4a')][_0xdaeb('0x50')]({'where':{'id':_0x51b98f[_0xdaeb('0x53')]['id']}})['then'](handleEntityNotFound(_0x583c1c,null))[_0xdaeb('0x1e')](saveUpdates(_0x51b98f[_0xdaeb('0x52')],null))[_0xdaeb('0x1e')](respondWithResult(_0x583c1c,null))[_0xdaeb('0x27')](handleError(_0x583c1c,null));};exports[_0xdaeb('0x54')]=function(_0x23a3f7,_0x1241c5){return db[_0xdaeb('0x4a')][_0xdaeb('0x50')]({'where':{'id':_0x23a3f7['params']['id']}})[_0xdaeb('0x1e')](handleEntityNotFound(_0x1241c5,null))[_0xdaeb('0x1e')](removeEntity(_0x1241c5,null))[_0xdaeb('0x27')](handleError(_0x1241c5,null));};exports[_0xdaeb('0x55')]=function(_0x4de959,_0x4879a1){return db[_0xdaeb('0x4a')][_0xdaeb('0x55')]()[_0xdaeb('0x1e')](respondWithResult(_0x4879a1,null))[_0xdaeb('0x27')](handleError(_0x4879a1,null));};var interaction_log=require('../../config/logger')(_0xdaeb('0x56'));exports['accept']=function(_0x1ff5b3,_0x4a0af5,_0x1e5406){var _0x58e6c7={'agent':{},'channel':_0xdaeb('0x57')};if(_0x1ff5b3[_0xdaeb('0x52')]['id']){delete _0x1ff5b3[_0xdaeb('0x52')]['id'];}_0x1ff5b3[_0xdaeb('0x52')][_0xdaeb('0x58')]=!![];_0x1ff5b3[_0xdaeb('0x52')][_0xdaeb('0x59')]=moment()[_0xdaeb('0x5a')](_0xdaeb('0x5b'));_0x1ff5b3[_0xdaeb('0x52')][_0xdaeb('0x5c')]=_0x1ff5b3[_0xdaeb('0x52')]['UserId']||_0x1ff5b3[_0xdaeb('0x5d')]['id'];_0x58e6c7[_0xdaeb('0x5e')]['id']=_0x1ff5b3['body'][_0xdaeb('0x5c')];return db['SmsMessage'][_0xdaeb('0x50')]({'where':{'id':_0x1ff5b3[_0xdaeb('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4a0af5,null))[_0xdaeb('0x1e')](saveUpdates(_0x1ff5b3[_0xdaeb('0x52')],null))[_0xdaeb('0x1e')](function(_0x285815){if(_0x285815){_0x58e6c7[_0xdaeb('0x25')]=_0x285815[_0xdaeb('0x5f')]({'plain':!![]});return db['SmsInteraction'][_0xdaeb('0x50')]({'where':{'id':_0x285815[_0xdaeb('0x60')]}});}return null;})[_0xdaeb('0x1e')](handleEntityNotFound(_0x4a0af5,null))[_0xdaeb('0x1e')](function(_0x41cf4c){if(_0x41cf4c){return _0x41cf4c[_0xdaeb('0x32')]({'UserId':_0x1ff5b3[_0xdaeb('0x52')]['UserId'],'read1stAt':_[_0xdaeb('0x61')](_0x41cf4c[_0xdaeb('0x62')])?moment()[_0xdaeb('0x5a')](_0xdaeb('0x5b')):undefined});}return null;})[_0xdaeb('0x1e')](function(_0x4bb961){if(_0x4bb961){_0x58e6c7[_0xdaeb('0x63')]=_0x4bb961[_0xdaeb('0x5f')]({'plain':!![]});interaction_log[_0xdaeb('0x1f')](_0xdaeb('0x64'),_0x1ff5b3['user']['id'],_0x1ff5b3[_0xdaeb('0x5d')][_0xdaeb('0x35')],_0x1ff5b3[_0xdaeb('0x5d')]['role'],_0x58e6c7[_0xdaeb('0x63')]['id'],_0x1ff5b3[_0xdaeb('0x52')]?JSON['stringify'](_0x1ff5b3[_0xdaeb('0x52')]):_0xdaeb('0x65'));return respondWithRpcPromise(_0xdaeb('0x66'),_0xdaeb('0x67'),_0x58e6c7);}return null;})['then'](function(_0x1ad405){var _0x549e4c=_0xdaeb('0x68')+_0x1ad405[_0xdaeb('0x25')][_0xdaeb('0x69')];return db[_0xdaeb('0x6a')][_0xdaeb('0x3c')](_0x549e4c,{'type':db[_0xdaeb('0x6b')][_0xdaeb('0x6c')][_0xdaeb('0x6d')],'raw':!![]})['then'](function(_0x16e76a){return _0x16e76a;});})[_0xdaeb('0x1e')](function(_0x257e5b){if(_0x257e5b){_0x58e6c7[_0xdaeb('0x25')][_0xdaeb('0x6e')]=_0x257e5b[0x0];if(!_0x1ff5b3[_0xdaeb('0x52')][_0xdaeb('0x5c')])return;return db[_0xdaeb('0x6f')]['find']({'where':{'id':_0x1ff5b3['body'][_0xdaeb('0x5c')],'role':_0xdaeb('0x5e')},'attributes':['id',_0xdaeb('0x35'),_0xdaeb('0x70'),_0xdaeb('0x71'),_0xdaeb('0x72')],'raw':!![]});}return null;})['then'](function(_0xce453d){if(!_0xce453d)return null;_0x58e6c7[_0xdaeb('0x25')][_0xdaeb('0x5e')]=_0xce453d;return _0x58e6c7;})[_0xdaeb('0x1e')](function(_0x352772){if(_0x352772){if(_0x1ff5b3['body']['manual']){_0x58e6c7[_0xdaeb('0x25')][_0xdaeb('0x73')]=util[_0xdaeb('0x5a')]('SIP/%s',_0x1ff5b3[_0xdaeb('0x5d')][_0xdaeb('0x35')]);_0x58e6c7[_0xdaeb('0x25')][_0xdaeb('0x74')]=_0x58e6c7[_0xdaeb('0x74')];_0x58e6c7[_0xdaeb('0x25')]['motionChannel']=_0x58e6c7[_0xdaeb('0x74')];_0x58e6c7['message'][_0xdaeb('0x75')]=_0xdaeb('0x76');return respondWithRpcPromise(_0xdaeb('0x77'),_0xdaeb('0x77'),{'event':'acceptmessage','message':_0x58e6c7[_0xdaeb('0x25')]},client9002)[_0xdaeb('0x1e')](function(){return _0x58e6c7;});}return _0x58e6c7;}return null;})[_0xdaeb('0x1e')](respondWithResult(_0x4a0af5,null))['catch'](handleError(_0x4a0af5,null));};var interaction_log=require(_0xdaeb('0x78'))(_0xdaeb('0x56'));exports[_0xdaeb('0x79')]=function(_0x128408,_0x10c7d7,_0x59b7f6){var _0x4efc54={'agent':{},'channel':'sms'};if(_0x128408[_0xdaeb('0x52')]['id']){delete _0x128408['body']['id'];}_0x128408[_0xdaeb('0x52')][_0xdaeb('0x5c')]=_0x128408['body'][_0xdaeb('0x5c')]||_0x128408['user']['id'];_0x4efc54[_0xdaeb('0x5e')]['id']=_0x128408[_0xdaeb('0x52')][_0xdaeb('0x5c')];return db[_0xdaeb('0x4a')][_0xdaeb('0x50')]({'where':{'id':_0x128408[_0xdaeb('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x10c7d7,null))[_0xdaeb('0x1e')](function(_0x411828){if(_0x411828){_0x4efc54[_0xdaeb('0x25')]=_0x411828['get']({'plain':!![]});return db[_0xdaeb('0x7a')][_0xdaeb('0x50')]({'where':{'id':_0x411828[_0xdaeb('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x10c7d7,null))[_0xdaeb('0x1e')](function(_0x4eda32){if(_0x4eda32){_0x4efc54[_0xdaeb('0x63')]=_0x4eda32[_0xdaeb('0x5f')]({'plain':!![]});interaction_log[_0xdaeb('0x1f')](_0xdaeb('0x7b'),_0x128408['user']['id'],_0x128408['user'][_0xdaeb('0x35')],_0x128408[_0xdaeb('0x5d')]['role'],_0x4efc54[_0xdaeb('0x63')]['id'],_0x128408[_0xdaeb('0x52')]?JSON[_0xdaeb('0x23')](_0x128408[_0xdaeb('0x52')]):_0xdaeb('0x65'));return respondWithRpcPromise(_0xdaeb('0x7c'),_0xdaeb('0x7d'),_0x4efc54);}return null;})[_0xdaeb('0x1e')](function(_0x4ccb03){var _0x26132a=_0xdaeb('0x68')+_0x4ccb03[_0xdaeb('0x25')][_0xdaeb('0x69')];return db[_0xdaeb('0x6a')][_0xdaeb('0x3c')](_0x26132a,{'type':db[_0xdaeb('0x6b')]['QueryTypes'][_0xdaeb('0x6d')],'raw':!![]})[_0xdaeb('0x1e')](function(_0xca2b76){return _0xca2b76;});})[_0xdaeb('0x1e')](function(_0x250608){if(_0x250608){_0x4efc54[_0xdaeb('0x25')]['contact']=_0x250608[0x0];if(!_0x128408[_0xdaeb('0x52')][_0xdaeb('0x5c')])return;return db['User']['find']({'where':{'id':_0x128408[_0xdaeb('0x52')][_0xdaeb('0x5c')],'role':_0xdaeb('0x5e')},'attributes':['id','name',_0xdaeb('0x70'),_0xdaeb('0x71'),_0xdaeb('0x72')],'raw':!![]});}return null;})[_0xdaeb('0x1e')](function(_0x38171d){if(!_0x38171d)return null;_0x4efc54['message'][_0xdaeb('0x5e')]=_0x38171d;return _0x4efc54;})[_0xdaeb('0x1e')](function(_0x4ed05c){if(_0x4ed05c){_0x4ed05c[_0xdaeb('0x25')][_0xdaeb('0x73')]=util['format']('SIP/%s',_0x128408[_0xdaeb('0x5d')][_0xdaeb('0x35')]);_0x4ed05c[_0xdaeb('0x25')][_0xdaeb('0x74')]=_0x4efc54[_0xdaeb('0x74')];_0x4ed05c[_0xdaeb('0x25')][_0xdaeb('0x7e')]=_0x4efc54[_0xdaeb('0x74')];_0x4ed05c[_0xdaeb('0x25')][_0xdaeb('0x75')]=_0xdaeb('0x79');respondWithRpcPromise(_0xdaeb('0x77'),'EventManager',{'event':_0xdaeb('0x7f'),'message':_0x4ed05c[_0xdaeb('0x25')]},client9002);return _0x4efc54;}return null;})['then'](respondWithResult(_0x10c7d7,null))['catch'](handleError(_0x10c7d7,null));};exports[_0xdaeb('0x29')]=function(_0x3c096d,_0x2a7af6,_0x1c69b8){if(_0x3c096d['body']['id']){delete _0x3c096d[_0xdaeb('0x52')]['id'];}var _0x124102;return db[_0xdaeb('0x4a')][_0xdaeb('0x50')]({'where':{'id':_0x3c096d[_0xdaeb('0x53')]['id']}})['then'](handleEntityNotFound(_0x2a7af6,null))['then'](function(_0x20cc70){if(_0x20cc70){_0x124102=_0x20cc70;return db[_0xdaeb('0x80')][_0xdaeb('0x50')]({'where':{'id':_0x20cc70[_0xdaeb('0x81')]}});}})[_0xdaeb('0x1e')](handleEntityNotFound(_0x2a7af6,null))[_0xdaeb('0x1e')](function(_0x440798){if(_0x440798){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0xdaeb('0x82'),_0x440798['type'],util[_0xdaeb('0x83')](_0x3c096d['body'],{'showHidden':![],'depth':null}));switch(_0x440798['type']){case _0xdaeb('0x84'):if(_0x3c096d['body'][_0xdaeb('0x85')]&&_0x3c096d[_0xdaeb('0x52')][_0xdaeb('0x85')]===_0x124102[_0xdaeb('0x86')]){return _0x124102[_0xdaeb('0x32')]({'read':!![]});}else{logger[_0xdaeb('0x24')](_0xdaeb('0x87'),_0xdaeb('0x29'),_0xdaeb('0x84'),util[_0xdaeb('0x83')](_0x3c096d[_0xdaeb('0x52')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x3c096d[_0xdaeb('0x52')]['MessageUUID']&&_0x3c096d[_0xdaeb('0x52')]['MessageUUID']===_0x124102['messageId']&&_[_0xdaeb('0x88')]([_0xdaeb('0x89'),_0xdaeb('0x8a')],_0x3c096d[_0xdaeb('0x52')][_0xdaeb('0x8b')])>=0x0){return _0x124102[_0xdaeb('0x32')]({'read':!![]});}else{logger[_0xdaeb('0x24')](_0xdaeb('0x87'),_0xdaeb('0x29'),_0xdaeb('0x8c'),util[_0xdaeb('0x83')](_0x3c096d[_0xdaeb('0x52')],{'showHidden':![],'depth':null}));}break;case _0xdaeb('0x8d'):var _0x671eea=_0x3c096d[_0xdaeb('0x52')][_0xdaeb('0x8e')][0x0];if(_0x671eea[_0xdaeb('0x29')][_0xdaeb('0x8f')]==='DELIVERED'){return _0x124102[_0xdaeb('0x32')]({'read':!![]});}else{logger[_0xdaeb('0x24')](_0xdaeb('0x87'),'status',_0xdaeb('0x8d'),util['inspect'](_0x3c096d[_0xdaeb('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x124102;}})['then'](respondWithResult(_0x2a7af6,null))[_0xdaeb('0x27')](handleError(_0x2a7af6,null));}; \ No newline at end of file +var _0x68ee=['keys','rawAttributes','catch','create','body','update','destroy','describe','sms-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','find','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','Sequelize','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','indexOf','sent','delivered','Status','infobip','results','groupName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','save','end','stack','name','send','index','SmsMessage','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params'];(function(_0x42de6d,_0x353834){var _0x37a916=function(_0x34eaaf){while(--_0x34eaaf){_0x42de6d['push'](_0x42de6d['shift']());}};_0x37a916(++_0x353834);}(_0x68ee,0xd3));var _0xe68e=function(_0xa284e,_0xd12953){_0xa284e=_0xa284e-0x0;var _0x294f71=_0x68ee[_0xa284e];return _0x294f71;};'use strict';var emlformat=require(_0xe68e('0x0'));var rimraf=require(_0xe68e('0x1'));var zipdir=require(_0xe68e('0x2'));var jsonpatch=require(_0xe68e('0x3'));var rp=require(_0xe68e('0x4'));var moment=require(_0xe68e('0x5'));var BPromise=require(_0xe68e('0x6'));var Mustache=require(_0xe68e('0x7'));var util=require('util');var path=require(_0xe68e('0x8'));var sox=require('sox');var csv=require(_0xe68e('0x9'));var ejs=require(_0xe68e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe68e('0xb'));var squel=require(_0xe68e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe68e('0xd'));var deskjs=require(_0xe68e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe68e('0xf'));var Papa=require(_0xe68e('0x10'));var Redis=require('ioredis');var authService=require(_0xe68e('0x11'));var qs=require(_0xe68e('0x12'));var as=require(_0xe68e('0x13'));var hardwareService=require(_0xe68e('0x14'));var logger=require(_0xe68e('0x15'))(_0xe68e('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe68e('0x17'));var db=require(_0xe68e('0x18'))['db'];config[_0xe68e('0x19')]=_[_0xe68e('0x1a')](config[_0xe68e('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xe68e('0x1b'))(new Redis(config['redis']));require(_0xe68e('0x1c'))[_0xe68e('0x1d')](socket);var jayson=require(_0xe68e('0x1e'));var client=jayson[_0xe68e('0x1f')][_0xe68e('0x20')]({'port':0x232c});var client9002=jayson['client'][_0xe68e('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x215a9e,_0x14a53c,_0x25cc4f,_0x504645){return new BPromise(function(_0x18ed40,_0x57aee8){var _0xa263af=_0x504645||client;return _0xa263af[_0xe68e('0x21')](_0x215a9e,_0x25cc4f)[_0xe68e('0x22')](function(_0x329044){logger[_0xe68e('0x23')](_0xe68e('0x24'),_0x14a53c,_0xe68e('0x25'));logger[_0xe68e('0x26')](_0xe68e('0x27'),_0x14a53c,_0xe68e('0x25'),JSON[_0xe68e('0x28')](_0x329044));if(_0x329044[_0xe68e('0x29')]){if(_0x329044[_0xe68e('0x29')][_0xe68e('0x2a')]===0x1f4){logger['error'](_0xe68e('0x24'),_0x14a53c,_0x329044[_0xe68e('0x29')][_0xe68e('0x2b')]);return _0x57aee8(_0x329044[_0xe68e('0x29')][_0xe68e('0x2b')]);}logger[_0xe68e('0x29')](_0xe68e('0x24'),_0x14a53c,_0x329044[_0xe68e('0x29')][_0xe68e('0x2b')]);return _0x18ed40(_0x329044['error'][_0xe68e('0x2b')]);}else{logger['info'](_0xe68e('0x24'),_0x14a53c,_0xe68e('0x25'));_0x18ed40(_0x329044[_0xe68e('0x2c')][_0xe68e('0x2b')]);}})['catch'](function(_0x343cd7){logger[_0xe68e('0x29')](_0xe68e('0x24'),_0x14a53c,_0x343cd7);_0x57aee8(_0x343cd7);});});}function respondWithStatusCode(_0x5c5a6f,_0x5dea74){_0x5dea74=_0x5dea74||0xcc;return function(_0x1a72aa){if(_0x1a72aa){return _0x5c5a6f[_0xe68e('0x2d')](_0x5dea74);}return _0x5c5a6f[_0xe68e('0x2e')](_0x5dea74)['end']();};}function respondWithResult(_0x20bfdf,_0x183de9){_0x183de9=_0x183de9||0xc8;return function(_0x35895d){if(_0x35895d){return _0x20bfdf['status'](_0x183de9)['json'](_0x35895d);}};}function respondWithFilteredResult(_0x2429cc,_0x5510b3){return function(_0x3a78b7){if(_0x3a78b7){var _0x34938e=typeof _0x5510b3[_0xe68e('0x2f')]===_0xe68e('0x30')&&typeof _0x5510b3[_0xe68e('0x31')]===_0xe68e('0x30');var _0x468a24=_0x3a78b7['count'];var _0x38c6eb=_0x34938e?0x0:_0x5510b3[_0xe68e('0x2f')];var _0x563a10=_0x34938e?_0x3a78b7[_0xe68e('0x32')]:_0x5510b3['offset']+_0x5510b3[_0xe68e('0x31')];var _0x23cdcd;if(_0x563a10>=_0x468a24){_0x563a10=_0x468a24;_0x23cdcd=0xc8;}else{_0x23cdcd=0xce;}_0x2429cc[_0xe68e('0x2e')](_0x23cdcd);return _0x2429cc['set'](_0xe68e('0x33'),_0x38c6eb+'-'+_0x563a10+'/'+_0x468a24)['json'](_0x3a78b7);}return null;};}function patchUpdates(_0x249ab2){return function(_0x4e6a27){try{jsonpatch[_0xe68e('0x34')](_0x4e6a27,_0x249ab2,!![]);}catch(_0x5d3531){return BPromise[_0xe68e('0x35')](_0x5d3531);}return _0x4e6a27[_0xe68e('0x36')]();};}function saveUpdates(_0x58e558,_0x178ab8){return function(_0x42cc0b){if(_0x42cc0b){return _0x42cc0b['update'](_0x58e558)[_0xe68e('0x22')](function(_0x3dfabd){return _0x3dfabd;});}return null;};}function removeEntity(_0x26a80b,_0x4ba3bc){return function(_0x27d414){if(_0x27d414){return _0x27d414['destroy']()[_0xe68e('0x22')](function(){_0x26a80b[_0xe68e('0x2e')](0xcc)[_0xe68e('0x37')]();});}};}function handleEntityNotFound(_0x292acf,_0x1da1d7){return function(_0x4689d8){if(!_0x4689d8){_0x292acf['sendStatus'](0x194);}return _0x4689d8;};}function handleError(_0x4a7b7c,_0xe57ec0){_0xe57ec0=_0xe57ec0||0x1f4;return function(_0x2fc403){logger[_0xe68e('0x29')](_0x2fc403[_0xe68e('0x38')]);if(_0x2fc403[_0xe68e('0x39')]){delete _0x2fc403[_0xe68e('0x39')];}_0x4a7b7c[_0xe68e('0x2e')](_0xe57ec0)[_0xe68e('0x3a')](_0x2fc403);};}exports[_0xe68e('0x3b')]=function(_0xd96811,_0x1a3aa9){var _0x1aacb1={},_0xa6387c={},_0x5a6b7d={'count':0x0,'rows':[]};var _0x548ed4=_['map'](db[_0xe68e('0x3c')]['rawAttributes'],function(_0x15e60b){return{'name':_0x15e60b[_0xe68e('0x3d')],'type':_0x15e60b[_0xe68e('0x3e')][_0xe68e('0x3f')]};});_0xa6387c['model']=_[_0xe68e('0x40')](_0x548ed4,_0xe68e('0x39'));_0xa6387c[_0xe68e('0x41')]=_['keys'](_0xd96811[_0xe68e('0x41')]);_0xa6387c[_0xe68e('0x42')]=_[_0xe68e('0x43')](_0xa6387c[_0xe68e('0x44')],_0xa6387c[_0xe68e('0x41')]);_0x1aacb1['attributes']=_[_0xe68e('0x43')](_0xa6387c['model'],qs[_0xe68e('0x45')](_0xd96811[_0xe68e('0x41')][_0xe68e('0x45')]));_0x1aacb1['attributes']=_0x1aacb1[_0xe68e('0x46')][_0xe68e('0x47')]?_0x1aacb1[_0xe68e('0x46')]:_0xa6387c[_0xe68e('0x44')];if(!_0xd96811[_0xe68e('0x41')][_0xe68e('0x48')]('nolimit')){_0x1aacb1[_0xe68e('0x31')]=qs[_0xe68e('0x31')](_0xd96811['query'][_0xe68e('0x31')]);_0x1aacb1[_0xe68e('0x2f')]=qs[_0xe68e('0x2f')](_0xd96811[_0xe68e('0x41')]['offset']);}_0x1aacb1[_0xe68e('0x49')]=qs[_0xe68e('0x4a')](_0xd96811[_0xe68e('0x41')]['sort']);_0x1aacb1[_0xe68e('0x4b')]=qs[_0xe68e('0x42')](_[_0xe68e('0x4c')](_0xd96811[_0xe68e('0x41')],_0xa6387c[_0xe68e('0x42')]),_0x548ed4);if(_0xd96811[_0xe68e('0x41')][_0xe68e('0x4d')]){_0x1aacb1[_0xe68e('0x4b')]=_[_0xe68e('0x4e')](_0x1aacb1['where'],{'$or':_[_0xe68e('0x40')](_0x548ed4,function(_0x51ac19){if(_0x51ac19[_0xe68e('0x3e')]!==_0xe68e('0x4f')){var _0x43a728={};_0x43a728[_0x51ac19['name']]={'$like':'%'+_0xd96811['query'][_0xe68e('0x4d')]+'%'};return _0x43a728;}})});}_0x1aacb1=_[_0xe68e('0x4e')]({},_0x1aacb1,_0xd96811[_0xe68e('0x50')]);var _0x688d6d={'where':_0x1aacb1[_0xe68e('0x4b')]};return db[_0xe68e('0x3c')][_0xe68e('0x32')](_0x688d6d)['then'](function(_0x5e3cd1){_0x5a6b7d[_0xe68e('0x32')]=_0x5e3cd1;if(_0xd96811[_0xe68e('0x41')][_0xe68e('0x51')]){_0x1aacb1[_0xe68e('0x52')]=[{'all':!![]}];}return db['SmsMessage'][_0xe68e('0x53')](_0x1aacb1);})['then'](function(_0xec34a6){_0x5a6b7d[_0xe68e('0x54')]=_0xec34a6;return _0x5a6b7d;})['then'](respondWithFilteredResult(_0x1a3aa9,_0x1aacb1))['catch'](handleError(_0x1a3aa9,null));};exports[_0xe68e('0x55')]=function(_0x31a119,_0x47d049){var _0x5ac6d0={'raw':!![],'where':{'id':_0x31a119[_0xe68e('0x56')]['id']}},_0x283d93={};_0x283d93[_0xe68e('0x44')]=_[_0xe68e('0x57')](db['SmsMessage'][_0xe68e('0x58')]);_0x283d93[_0xe68e('0x41')]=_[_0xe68e('0x57')](_0x31a119[_0xe68e('0x41')]);_0x283d93[_0xe68e('0x42')]=_['intersection'](_0x283d93['model'],_0x283d93[_0xe68e('0x41')]);_0x5ac6d0['attributes']=_[_0xe68e('0x43')](_0x283d93[_0xe68e('0x44')],qs[_0xe68e('0x45')](_0x31a119[_0xe68e('0x41')][_0xe68e('0x45')]));_0x5ac6d0[_0xe68e('0x46')]=_0x5ac6d0['attributes'][_0xe68e('0x47')]?_0x5ac6d0[_0xe68e('0x46')]:_0x283d93[_0xe68e('0x44')];if(_0x31a119[_0xe68e('0x41')]['includeAll']){_0x5ac6d0[_0xe68e('0x52')]=[{'all':!![]}];}_0x5ac6d0=_[_0xe68e('0x4e')]({},_0x5ac6d0,_0x31a119[_0xe68e('0x50')]);return db['SmsMessage']['find'](_0x5ac6d0)['then'](handleEntityNotFound(_0x47d049,null))[_0xe68e('0x22')](respondWithResult(_0x47d049,null))[_0xe68e('0x59')](handleError(_0x47d049,null));};exports[_0xe68e('0x5a')]=function(_0x32d3ab,_0x45d1ba){return db[_0xe68e('0x3c')][_0xe68e('0x5a')](_0x32d3ab[_0xe68e('0x5b')],{})[_0xe68e('0x22')](respondWithResult(_0x45d1ba,0xc9))[_0xe68e('0x59')](handleError(_0x45d1ba,null));};exports[_0xe68e('0x5c')]=function(_0x1cecb9,_0x4c3a7e){if(_0x1cecb9[_0xe68e('0x5b')]['id']){delete _0x1cecb9[_0xe68e('0x5b')]['id'];}return db[_0xe68e('0x3c')]['find']({'where':{'id':_0x1cecb9[_0xe68e('0x56')]['id']}})[_0xe68e('0x22')](handleEntityNotFound(_0x4c3a7e,null))[_0xe68e('0x22')](saveUpdates(_0x1cecb9[_0xe68e('0x5b')],null))['then'](respondWithResult(_0x4c3a7e,null))[_0xe68e('0x59')](handleError(_0x4c3a7e,null));};exports[_0xe68e('0x5d')]=function(_0x3fb561,_0x7334f5){return db['SmsMessage']['find']({'where':{'id':_0x3fb561[_0xe68e('0x56')]['id']}})[_0xe68e('0x22')](handleEntityNotFound(_0x7334f5,null))[_0xe68e('0x22')](removeEntity(_0x7334f5,null))['catch'](handleError(_0x7334f5,null));};exports[_0xe68e('0x5e')]=function(_0x89ab9f,_0x440742){return db[_0xe68e('0x3c')][_0xe68e('0x5e')]()[_0xe68e('0x22')](respondWithResult(_0x440742,null))[_0xe68e('0x59')](handleError(_0x440742,null));};var interaction_log=require(_0xe68e('0x15'))(_0xe68e('0x5f'));exports[_0xe68e('0x60')]=function(_0x48ee0d,_0x5e9a03,_0x1aa421){var _0x392cef={'agent':{},'channel':'sms'};if(_0x48ee0d['body']['id']){delete _0x48ee0d[_0xe68e('0x5b')]['id'];}_0x48ee0d['body'][_0xe68e('0x61')]=!![];_0x48ee0d[_0xe68e('0x5b')]['readAt']=moment()[_0xe68e('0x62')](_0xe68e('0x63'));_0x48ee0d[_0xe68e('0x5b')][_0xe68e('0x64')]=_0x48ee0d[_0xe68e('0x5b')][_0xe68e('0x64')]||_0x48ee0d[_0xe68e('0x65')]['id'];_0x392cef['agent']['id']=_0x48ee0d['body'][_0xe68e('0x64')];return db['SmsMessage'][_0xe68e('0x66')]({'where':{'id':_0x48ee0d[_0xe68e('0x56')]['id'],'UserId':null}})[_0xe68e('0x22')](handleEntityNotFound(_0x5e9a03,null))['then'](saveUpdates(_0x48ee0d['body'],null))[_0xe68e('0x22')](function(_0x1ffcfb){if(_0x1ffcfb){_0x392cef[_0xe68e('0x2b')]=_0x1ffcfb['get']({'plain':!![]});return db[_0xe68e('0x67')]['find']({'where':{'id':_0x1ffcfb[_0xe68e('0x68')]}});}return null;})[_0xe68e('0x22')](handleEntityNotFound(_0x5e9a03,null))[_0xe68e('0x22')](function(_0x287ce3){if(_0x287ce3){return _0x287ce3[_0xe68e('0x5c')]({'UserId':_0x48ee0d[_0xe68e('0x5b')][_0xe68e('0x64')],'read1stAt':_[_0xe68e('0x69')](_0x287ce3[_0xe68e('0x6a')])?moment()[_0xe68e('0x62')](_0xe68e('0x63')):undefined});}return null;})[_0xe68e('0x22')](function(_0x5581cd){if(_0x5581cd){_0x392cef[_0xe68e('0x6b')]=_0x5581cd['get']({'plain':!![]});interaction_log[_0xe68e('0x23')](_0xe68e('0x6c'),_0x48ee0d[_0xe68e('0x65')]['id'],_0x48ee0d['user'][_0xe68e('0x39')],_0x48ee0d[_0xe68e('0x65')][_0xe68e('0x6d')],_0x392cef[_0xe68e('0x6b')]['id'],_0x48ee0d[_0xe68e('0x5b')]?JSON[_0xe68e('0x28')](_0x48ee0d[_0xe68e('0x5b')]):_0xe68e('0x6e'));return respondWithRpcPromise(_0xe68e('0x6f'),_0xe68e('0x70'),_0x392cef);}return null;})[_0xe68e('0x22')](function(_0x33d2ff){var _0x1bcaa7=_0xe68e('0x71')+_0x33d2ff[_0xe68e('0x2b')]['ContactId'];return db[_0xe68e('0x72')][_0xe68e('0x41')](_0x1bcaa7,{'type':db['Sequelize'][_0xe68e('0x73')]['SELECT'],'raw':!![]})['then'](function(_0x137193){return _0x137193;});})[_0xe68e('0x22')](function(_0x4607db){if(_0x4607db){_0x392cef['message'][_0xe68e('0x74')]=_0x4607db[0x0];if(!_0x48ee0d[_0xe68e('0x5b')][_0xe68e('0x64')])return;return db['User']['find']({'where':{'id':_0x48ee0d['body']['UserId'],'role':_0xe68e('0x75')},'attributes':['id',_0xe68e('0x39'),_0xe68e('0x76'),_0xe68e('0x77'),_0xe68e('0x78')],'raw':!![]});}return null;})[_0xe68e('0x22')](function(_0x18453b){if(!_0x18453b)return null;_0x392cef[_0xe68e('0x2b')][_0xe68e('0x75')]=_0x18453b;return _0x392cef;})[_0xe68e('0x22')](function(_0x2c371c){if(_0x2c371c){if(_0x48ee0d[_0xe68e('0x5b')][_0xe68e('0x79')]){_0x392cef['message'][_0xe68e('0x7a')]=util[_0xe68e('0x62')](_0xe68e('0x7b'),_0x48ee0d[_0xe68e('0x65')][_0xe68e('0x39')]);_0x392cef[_0xe68e('0x2b')][_0xe68e('0x7c')]=_0x392cef['channel'];_0x392cef[_0xe68e('0x2b')][_0xe68e('0x7d')]=_0x392cef[_0xe68e('0x7c')];_0x392cef[_0xe68e('0x2b')][_0xe68e('0x7e')]=_0xe68e('0x60');return respondWithRpcPromise('EventManager',_0xe68e('0x7f'),{'event':_0xe68e('0x80'),'message':_0x392cef['message']},client9002)[_0xe68e('0x22')](function(){return _0x392cef;});}return _0x392cef;}return null;})[_0xe68e('0x22')](respondWithResult(_0x5e9a03,null))['catch'](handleError(_0x5e9a03,null));};var interaction_log=require(_0xe68e('0x15'))(_0xe68e('0x5f'));exports[_0xe68e('0x35')]=function(_0x28e793,_0x5338c2,_0x548a10){var _0x22ba77={'agent':{},'channel':'sms'};if(_0x28e793[_0xe68e('0x5b')]['id']){delete _0x28e793[_0xe68e('0x5b')]['id'];}_0x28e793[_0xe68e('0x5b')][_0xe68e('0x64')]=_0x28e793['body'][_0xe68e('0x64')]||_0x28e793[_0xe68e('0x65')]['id'];_0x22ba77['agent']['id']=_0x28e793[_0xe68e('0x5b')][_0xe68e('0x64')];return db[_0xe68e('0x3c')][_0xe68e('0x66')]({'where':{'id':_0x28e793[_0xe68e('0x56')]['id'],'UserId':null}})[_0xe68e('0x22')](handleEntityNotFound(_0x5338c2,null))['then'](function(_0x2f0799){if(_0x2f0799){_0x22ba77[_0xe68e('0x2b')]=_0x2f0799[_0xe68e('0x81')]({'plain':!![]});return db[_0xe68e('0x67')]['find']({'where':{'id':_0x2f0799[_0xe68e('0x68')]}});}return null;})[_0xe68e('0x22')](handleEntityNotFound(_0x5338c2,null))[_0xe68e('0x22')](function(_0x471070){if(_0x471070){_0x22ba77[_0xe68e('0x6b')]=_0x471070[_0xe68e('0x81')]({'plain':!![]});interaction_log[_0xe68e('0x23')](_0xe68e('0x82'),_0x28e793[_0xe68e('0x65')]['id'],_0x28e793[_0xe68e('0x65')]['name'],_0x28e793[_0xe68e('0x65')][_0xe68e('0x6d')],_0x22ba77[_0xe68e('0x6b')]['id'],_0x28e793[_0xe68e('0x5b')]?JSON[_0xe68e('0x28')](_0x28e793[_0xe68e('0x5b')]):_0xe68e('0x6e'));return respondWithRpcPromise(_0xe68e('0x83'),_0xe68e('0x84'),_0x22ba77);}return null;})['then'](function(_0x25787e){var _0x4a8db2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x25787e[_0xe68e('0x2b')][_0xe68e('0x85')];return db[_0xe68e('0x72')][_0xe68e('0x41')](_0x4a8db2,{'type':db[_0xe68e('0x86')][_0xe68e('0x73')]['SELECT'],'raw':!![]})[_0xe68e('0x22')](function(_0x173d08){return _0x173d08;});})[_0xe68e('0x22')](function(_0x5efc8d){if(_0x5efc8d){_0x22ba77[_0xe68e('0x2b')][_0xe68e('0x74')]=_0x5efc8d[0x0];if(!_0x28e793['body']['UserId'])return;return db['User'][_0xe68e('0x66')]({'where':{'id':_0x28e793['body'][_0xe68e('0x64')],'role':_0xe68e('0x75')},'attributes':['id',_0xe68e('0x39'),_0xe68e('0x76'),_0xe68e('0x77'),_0xe68e('0x78')],'raw':!![]});}return null;})['then'](function(_0x444a6b){if(!_0x444a6b)return null;_0x22ba77['message'][_0xe68e('0x75')]=_0x444a6b;return _0x22ba77;})['then'](function(_0x42ee75){if(_0x42ee75){_0x42ee75['message']['interface']=util['format'](_0xe68e('0x7b'),_0x28e793[_0xe68e('0x65')][_0xe68e('0x39')]);_0x42ee75[_0xe68e('0x2b')][_0xe68e('0x7c')]=_0x22ba77[_0xe68e('0x7c')];_0x42ee75[_0xe68e('0x2b')][_0xe68e('0x7d')]=_0x22ba77[_0xe68e('0x7c')];_0x42ee75[_0xe68e('0x2b')][_0xe68e('0x7e')]=_0xe68e('0x35');respondWithRpcPromise(_0xe68e('0x7f'),_0xe68e('0x7f'),{'event':'rejectmessage','message':_0x42ee75[_0xe68e('0x2b')]},client9002);return _0x22ba77;}return null;})['then'](respondWithResult(_0x5338c2,null))[_0xe68e('0x59')](handleError(_0x5338c2,null));};exports['status']=function(_0x2213cf,_0x55a0fa,_0x4e3f58){if(_0x2213cf[_0xe68e('0x5b')]['id']){delete _0x2213cf[_0xe68e('0x5b')]['id'];}var _0x1e0d54;return db[_0xe68e('0x3c')][_0xe68e('0x66')]({'where':{'id':_0x2213cf[_0xe68e('0x56')]['id']}})[_0xe68e('0x22')](handleEntityNotFound(_0x55a0fa,null))[_0xe68e('0x22')](function(_0x19b3fc){if(_0x19b3fc){_0x1e0d54=_0x19b3fc;return db[_0xe68e('0x87')][_0xe68e('0x66')]({'where':{'id':_0x19b3fc['SmsAccountId']}});}})[_0xe68e('0x22')](handleEntityNotFound(_0x55a0fa,null))['then'](function(_0x42e687){if(_0x42e687){logger[_0xe68e('0x26')](_0xe68e('0x27'),_0xe68e('0x2e'),_0xe68e('0x88'),_0x42e687[_0xe68e('0x3e')],util[_0xe68e('0x89')](_0x2213cf[_0xe68e('0x5b')],{'showHidden':![],'depth':null}));switch(_0x42e687['type']){case _0xe68e('0x8a'):if(_0x2213cf[_0xe68e('0x5b')]['MessageSid']&&_0x2213cf[_0xe68e('0x5b')][_0xe68e('0x8b')]===_0x1e0d54[_0xe68e('0x8c')]){return _0x1e0d54[_0xe68e('0x5c')]({'read':!![]});}else{logger[_0xe68e('0x29')](_0xe68e('0x8d'),_0xe68e('0x2e'),_0xe68e('0x8a'),util[_0xe68e('0x89')](_0x2213cf['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x2213cf[_0xe68e('0x5b')]['MessageUUID']&&_0x2213cf[_0xe68e('0x5b')]['MessageUUID']===_0x1e0d54[_0xe68e('0x8c')]&&_[_0xe68e('0x8e')]([_0xe68e('0x8f'),_0xe68e('0x90')],_0x2213cf['body'][_0xe68e('0x91')])>=0x0){return _0x1e0d54['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe68e('0x2e'),'plivio',util[_0xe68e('0x89')](_0x2213cf[_0xe68e('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe68e('0x92'):var _0x1ecb9d=_0x2213cf['body'][_0xe68e('0x93')][0x0];if(_0x1ecb9d[_0xe68e('0x2e')][_0xe68e('0x94')]==='DELIVERED'){return _0x1e0d54[_0xe68e('0x5c')]({'read':!![]});}else{logger[_0xe68e('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xe68e('0x92'),util[_0xe68e('0x89')](_0x2213cf[_0xe68e('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x1e0d54;}})[_0xe68e('0x22')](respondWithResult(_0x55a0fa,null))[_0xe68e('0x59')](handleError(_0x55a0fa,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 8ac0fd9..4a10ce6 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 _0x7a2a=['SmsMessage','setMaxListeners','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x1bbd8a,_0xdf8df7){var _0x1465e1=function(_0x112190){while(--_0x112190){_0x1bbd8a['push'](_0x1bbd8a['shift']());}};_0x1465e1(++_0xdf8df7);}(_0x7a2a,0x8e));var _0xa7a2=function(_0x28e984,_0x9ddfb6){_0x28e984=_0x28e984-0x0;var _0x3938bb=_0x7a2a[_0x28e984];return _0x3938bb;};'use strict';var EventEmitter=require(_0xa7a2('0x0'));var SmsMessage=require(_0xa7a2('0x1'))['db'][_0xa7a2('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xa7a2('0x3')](0x0);var events={'afterCreate':_0xa7a2('0x4'),'afterUpdate':_0xa7a2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x53a9d6){return function(_0x38b063,_0x1f31bd,_0x35ff16){SmsMessageEvents[_0xa7a2('0x6')](_0x53a9d6+':'+_0x38b063['id'],_0x38b063);SmsMessageEvents['emit'](_0x53a9d6,_0x38b063);_0x35ff16(null);};}for(var e in events){if(events[_0xa7a2('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xa7a2('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x7823=['update','remove','emit','exports','events','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x1ab300,_0x3529e1){var _0x49a9c4=function(_0x4180a4){while(--_0x4180a4){_0x1ab300['push'](_0x1ab300['shift']());}};_0x49a9c4(++_0x3529e1);}(_0x7823,0x194));var _0x3782=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7823[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x3782('0x0'));var SmsMessage=require(_0x3782('0x1'))['db'][_0x3782('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x3782('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3782('0x4'),'afterDestroy':_0x3782('0x5')};function emitEvent(_0xbeb57b){return function(_0x6b8b76,_0x28ed75,_0x364a28){SmsMessageEvents[_0x3782('0x6')](_0xbeb57b+':'+_0x6b8b76['id'],_0x6b8b76);SmsMessageEvents[_0x3782('0x6')](_0xbeb57b,_0x6b8b76);_0x364a28(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x3782('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 63da4ab..7611068 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 _0x9fee=['digest','GET','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','Bearer\x20','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','catch','error','secret','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','create','remote','/api/sms/messages/','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','&password=','password','split','sms','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','requestid','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','message_id','clickSend','plivo','https://api.plivo.com/v1/Account/%s/Message/','authId','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','messages','csc','crypto','apiKey','login','keys','sort','length','createHash'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x9fee,0x101));var _0xe9fe=function(_0x58d8a1,_0x53b67f){_0x58d8a1=_0x58d8a1-0x0;var _0x7a615e=_0x9fee[_0x58d8a1];return _0x7a615e;};'use strict';var _=require(_0xe9fe('0x0'));var util=require('util');var logger=require(_0xe9fe('0x1'))('api');var moment=require(_0xe9fe('0x2'));var BPromise=require(_0xe9fe('0x3'));var rp=require(_0xe9fe('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe9fe('0x5'));var config=require(_0xe9fe('0x6'));var attributes=require('./smsMessage.attributes');module[_0xe9fe('0x7')]=function(_0x2c28df,_0x134412){return _0x2c28df[_0xe9fe('0x8')](_0xe9fe('0x9'),attributes,{'tableName':_0xe9fe('0xa'),'paranoid':![],'indexes':[{'name':_0xe9fe('0xb'),'fields':[_0xe9fe('0xb')]},{'name':_0xe9fe('0xc'),'fields':[_0xe9fe('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5404ed,_0x3691b4,_0x3c0a51){var _0x1455d0=_0x2c28df[_0xe9fe('0xe')];var _0x2dd661=_0x5404ed[_0xe9fe('0xf')]({'plain':!![]});if(_0x2dd661[_0xe9fe('0x10')][_0xe9fe('0x11')]()==='in'||_0x2dd661[_0xe9fe('0x10')][_0xe9fe('0x11')]()===_0xe9fe('0x12')&&!_0x2dd661['secret']&&!_[_0xe9fe('0x13')](_0x2dd661[_0xe9fe('0x14')])&&!_['isNil'](_0x2dd661[_0xe9fe('0x15')])){_0x1455d0[_0xe9fe('0x16')][_0xe9fe('0x17')]({'where':{'id':_0x2dd661[_0xe9fe('0x15')]}})['then'](function(_0x48537f){if(_0x48537f){_0x48537f['update']({'lastMsgAt':_0x2dd661['createdAt'],'lastMsgDirection':_0x2dd661[_0xe9fe('0x10')][_0xe9fe('0x11')]()});}})[_0xe9fe('0x18')](function(_0xda0256){console[_0xe9fe('0x19')](_0xda0256);});}if(_0x2dd661[_0xe9fe('0x10')]===_0xe9fe('0x12')&&!_0x2dd661[_0xe9fe('0x1a')]){var _0x3c7155;_0x1455d0['SmsAccount'][_0xe9fe('0x1b')]({'where':{'id':_0x2dd661[_0xe9fe('0x1c')]},'raw':!![]})[_0xe9fe('0x1d')](function(_0x3eb3db){_0x3c7155=_0x3eb3db;if(_0x3c7155&&_0x3c7155[_0xe9fe('0x1e')]){switch(_0x3c7155[_0xe9fe('0x1e')]){case'twilio':var _0x297ccd=require(_0xe9fe('0x1f'));if(_0x3c7155[_0xe9fe('0x20')]&&_0x3c7155[_0xe9fe('0x21')]&&_0x3c7155[_0xe9fe('0x22')]){var _0x3a2884=new _0x297ccd(_0x3c7155[_0xe9fe('0x20')],_0x3c7155[_0xe9fe('0x21')]);_0x3a2884['messages'][_0xe9fe('0x23')]({'body':_0x2dd661['body'],'to':_0x2dd661[_0xe9fe('0x22')],'from':_0x3c7155[_0xe9fe('0x22')],'statusCallback':_0x3c7155[_0xe9fe('0x24')]+_0xe9fe('0x25')+_0x2dd661['id']+_0xe9fe('0x26')+_0x3c7155[_0xe9fe('0x27')]})[_0xe9fe('0x1d')](function(_0x5a822f){if(_0x5a822f[_0xe9fe('0x28')]){return _0x5404ed[_0xe9fe('0x29')]({'messageId':_0x5a822f['sid']});}})[_0xe9fe('0x18')](function(_0x47828e){logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),'afterCreate',_0xe9fe('0x1f'),util['inspect'](_0x47828e,{'showHidden':![],'depth':null}));});}else{logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x1f'),_0xe9fe('0x2c'));}break;case _0xe9fe('0x2d'):var _0x1524d0=_0xe9fe('0x2e');if(_0x3c7155[_0xe9fe('0x2f')]&&_0x3c7155['password']){var _0xf64c9a={'recipient':[_0x2dd661[_0xe9fe('0x22')]],'message':_0x2dd661[_0xe9fe('0xd')],'message_type':_0x3c7155[_0xe9fe('0x30')]};if(_0x3c7155[_0xe9fe('0x30')]&&_0x3c7155[_0xe9fe('0x30')]!=='SI'){_0xf64c9a[_0xe9fe('0x31')]=_0x3c7155['phone'];}var _0xf27871={'url':_0x1524d0+'login?username='+_0x3c7155[_0xe9fe('0x2f')]+_0xe9fe('0x32')+_0x3c7155[_0xe9fe('0x33')],'method':'GET'};rp(_0xf27871)[_0xe9fe('0x1d')](function(_0x169a12){var _0x111c0e=_0x169a12[_0xe9fe('0x34')](';');var _0x14d436={'user_key':_0x111c0e[0x0],'session_key':_0x111c0e[0x1]};_0xf27871={'url':_0x1524d0+_0xe9fe('0x35'),'method':'POST','headers':{'user_key':_0x14d436['user_key'],'Session_key':_0x14d436[_0xe9fe('0x36')]},'json':!![],'body':_0xf64c9a};return rp(_0xf27871);})[_0xe9fe('0x1d')](function(_0x26bc6f){if(_0x26bc6f[_0xe9fe('0x37')]>=0x1){var _0x4a65af={'messageId':_0x26bc6f[_0xe9fe('0x38')]};if(_0x3c7155[_0xe9fe('0x30')]!=='GP'||!_0x3c7155[_0xe9fe('0x39')]){_0x4a65af[_0xe9fe('0x3a')]=!![];}return _0x5404ed[_0xe9fe('0x29')](_0x4a65af);}else{return logger['error'](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x2d'),util['inspect'](_0x26bc6f,{'showHidden':![],'depth':null}));}})[_0xe9fe('0x18')](function(_0x424a89){return logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x2d'),util[_0xe9fe('0x3b')](_0x424a89,{'showHidden':![],'depth':null}));});}else{logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x2d'),_0xe9fe('0x3c'));}break;case _0xe9fe('0x3d'):if(_0x3c7155['authToken']){var _0x244976={'recipient':_0x2dd661['phone'],'message':_0x2dd661[_0xe9fe('0xd')],'sender':_0x3c7155[_0xe9fe('0x3e')]||_0x3c7155[_0xe9fe('0x22')],'authorization':_0x3c7155[_0xe9fe('0x21')]};var _0x3691b4={'method':_0xe9fe('0x3f'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x244976,'json':!![]};rp(_0x3691b4)[_0xe9fe('0x1d')](function(_0x58daa1){var _0x4f6a5f={'messageId':_0x58daa1[_0xe9fe('0x40')]};if(!_0x3c7155['deliveryReport']){_0x4f6a5f[_0xe9fe('0x3a')]=!![];}return _0x5404ed['update'](_0x4f6a5f);})[_0xe9fe('0x18')](function(_0x553a50){logger[_0xe9fe('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe9fe('0x2b'),_0xe9fe('0x3d'),util[_0xe9fe('0x3b')](_0x553a50,{'showHidden':![],'depth':null}));});}else{logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),'afterCreate',_0xe9fe('0x3d'),'Missing\x20parameters:\x20authToken');}break;case _0xe9fe('0x41'):if(_0x3c7155[_0xe9fe('0x2f')]&&_0x3c7155[_0xe9fe('0x33')]){var _0x244976={'messages':[{'source':_0xe9fe('0x42'),'to':_0x2dd661['phone'],'body':_0x2dd661[_0xe9fe('0xd')],'from':_0x3c7155[_0xe9fe('0x3e')]||_0x3c7155['phone']}]};var _0x483af9=util[_0xe9fe('0x43')](_0xe9fe('0x44'),_0x3c7155[_0xe9fe('0x2f')],_0x3c7155[_0xe9fe('0x33')]);var _0x3691b4={'method':_0xe9fe('0x3f'),'uri':_0xe9fe('0x45'),'body':_0x244976,'headers':{'Authorization':util['format'](_0xe9fe('0x46'),new Buffer(_0x483af9)[_0xe9fe('0x47')](_0xe9fe('0x48')))},'json':!![]};rp(_0x3691b4)[_0xe9fe('0x1d')](function(_0x342981){if(_0x342981[_0xe9fe('0x49')]>=0xc8&&_0x342981['http_code']<=0xce){if(_0x342981[_0xe9fe('0x4a')]&&_0x342981[_0xe9fe('0x4a')][_0xe9fe('0x4b')]>0x0){var _0x2d972f=_['head'](_0x342981[_0xe9fe('0x4a')]['messages']);var _0x19e82c={'messageId':_0x2d972f[_0xe9fe('0x4c')]};if(!_0x3c7155['deliveryReport']){_0x19e82c[_0xe9fe('0x3a')]=!![];}return _0x5404ed[_0xe9fe('0x29')](_0x19e82c);}else{logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x4d'),util[_0xe9fe('0x3b')](_0x342981,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x4d'),util[_0xe9fe('0x3b')](_0x342981,{'showHidden':![],'depth':null}));}})[_0xe9fe('0x18')](function(_0x511a55){logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),_0xe9fe('0x2b'),'clickSend',util['inspect'](_0x511a55,{'showHidden':![],'depth':null}));});}else{logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x4d'),_0xe9fe('0x3c'));}break;case _0xe9fe('0x4e'):if(_0x3c7155['authId']&&_0x3c7155['authToken']){var _0x244976={'dst':_0x2dd661[_0xe9fe('0x22')],'text':_0x2dd661[_0xe9fe('0xd')],'src':_0x3c7155[_0xe9fe('0x3e')]||_0x3c7155[_0xe9fe('0x22')],'url':_0x3c7155['remote']+_0xe9fe('0x25')+_0x2dd661['id']+_0xe9fe('0x26')+_0x3c7155[_0xe9fe('0x27')]};var _0x483af9=util['format']('%s:%s',_0x3c7155['authId'],_0x3c7155[_0xe9fe('0x21')]);var _0x3691b4={'method':_0xe9fe('0x3f'),'uri':util[_0xe9fe('0x43')](_0xe9fe('0x4f'),_0x3c7155[_0xe9fe('0x50')]),'body':_0x244976,'headers':{'Authorization':util[_0xe9fe('0x43')](_0xe9fe('0x46'),new Buffer(_0x483af9)[_0xe9fe('0x47')]('base64'))},'json':!![]};rp(_0x3691b4)[_0xe9fe('0x1d')](function(_0x2c4eec){var _0x57f44f={'messageId':_0x2c4eec['message_uuid'][0x0]};return _0x5404ed[_0xe9fe('0x29')](_0x57f44f);})[_0xe9fe('0x18')](function(_0x1c8808){logger[_0xe9fe('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe9fe('0x2b'),_0xe9fe('0x4e'),util[_0xe9fe('0x3b')](_0x1c8808,{'showHidden':![],'depth':null}));});}else{logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x4e'),_0xe9fe('0x51'));}break;case _0xe9fe('0x52'):if(_0x3c7155['username']&&_0x3c7155[_0xe9fe('0x33')]){if(_0x3c7155[_0xe9fe('0x53')]){var _0x1b6879={'method':_0xe9fe('0x3f'),'uri':_0x3c7155[_0xe9fe('0x53')]+_0xe9fe('0x54'),'body':{'username':_0x3c7155[_0xe9fe('0x2f')],'password':_0x3c7155[_0xe9fe('0x33')]},'json':!![]};return rp(_0x1b6879)[_0xe9fe('0x1d')](function(_0x5d18d3){var _0x322a60={'method':'POST','uri':_0x3c7155['baseUrl']+_0xe9fe('0x55'),'body':{'messages':[{'from':_0x3c7155[_0xe9fe('0x22')],'destinations':[{'to':_0x2dd661[_0xe9fe('0x22')]}],'text':_0x2dd661[_0xe9fe('0xd')],'notifyUrl':_0x3c7155[_0xe9fe('0x24')]+_0xe9fe('0x25')+_0x2dd661['id']+_0xe9fe('0x26')+_0x3c7155['token'],'notifyContentType':_0xe9fe('0x56'),'callbackData':_0x3c7155['phone']+';'+_0x2dd661[_0xe9fe('0xd')]}]},'headers':{'Authorization':_0xe9fe('0x57')+_0x5d18d3[_0xe9fe('0x27')]},'json':!![]};return rp(_0x322a60)['then'](function(_0xae329f){if(_0xae329f[_0xe9fe('0x58')]){var _0x18def5={'messageId':_0xae329f[_0xe9fe('0x58')][0x0][_0xe9fe('0xb')]};if(!_0x3c7155[_0xe9fe('0x39')]){_0x18def5['read']=!![];}return _0x5404ed[_0xe9fe('0x29')](_0x18def5);}else{return logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x52'),util[_0xe9fe('0x3b')](_0xae329f,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x27e36e){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe9fe('0x52'),util[_0xe9fe('0x3b')](_0x27e36e,{'showHidden':![],'depth':null}));});}else{logger[_0xe9fe('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe9fe('0x2b'),_0xe9fe('0x52'),'Missing\x20parameters:\x20base_url');}}else{logger['error'](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x52'),_0xe9fe('0x3c'));}break;case _0xe9fe('0x59'):var _0x5751e3=require(_0xe9fe('0x5a'));if(_0x3c7155[_0xe9fe('0x5b')]){var _0x17cefd={};_0x17cefd[_0xe9fe('0x5c')]=_0x3c7155[_0xe9fe('0x2f')];_0x17cefd[_0xe9fe('0x22')]=_0x2dd661['phone'];_0x17cefd[_0xe9fe('0x31')]=_0x3c7155['phone'];_0x17cefd['text']=_0x2dd661[_0xe9fe('0xd')];_0x17cefd['timestamp']=+new Date();var _0x287b7c='';var _0x14b4e8='';var _0x57cc3b=Object[_0xe9fe('0x5d')](_0x17cefd);_0x57cc3b[_0xe9fe('0x5e')]();for(var _0xa8de66=0x0;_0xa8de66<_0x57cc3b[_0xe9fe('0x5f')];_0xa8de66++){if(_0x287b7c!=''){_0x287b7c+='&';}_0x287b7c+=_0x57cc3b[_0xa8de66]+'='+encodeURIComponent(_0x17cefd[_0x57cc3b[_0xa8de66]]);_0x14b4e8+=_0x17cefd[_0x57cc3b[_0xa8de66]];}_0x14b4e8+=_0x3c7155[_0xe9fe('0x5b')];_0x14b4e8=_0x5751e3[_0xe9fe('0x60')]('md5')[_0xe9fe('0x29')](_0x14b4e8)[_0xe9fe('0x61')]('hex');if(_0x287b7c!==''){_0x287b7c+='&';}_0x287b7c+='signature='+_0x14b4e8;var _0xf27871={'method':_0xe9fe('0x62'),'uri':_0x3c7155[_0xe9fe('0x53')]+'/external/get/send.php?'+_0x287b7c,'json':!![]};return rp(_0xf27871)['then'](function(_0x4c5eee){var _0xec3f1c=Object[_0xe9fe('0x5d')](_0x4c5eee);if(_0x4c5eee[_0xec3f1c[0x0]][_0xe9fe('0x19')]&&parseInt(_0x4c5eee[_0xec3f1c[0x0]][_0xe9fe('0x19')])===0x0){var _0x3b5859={'messageId':_0x4c5eee[_0xec3f1c[0x0]][_0xe9fe('0x63')]};if(!_0x3c7155[_0xe9fe('0x39')]){_0x3b5859[_0xe9fe('0x3a')]=!![];}return _0x5404ed[_0xe9fe('0x29')](_0x3b5859);}else{return logger['error'](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x59'),util[_0xe9fe('0x3b')](_0x4c5eee[_0xe9fe('0x19')],{'showHidden':![],'depth':null}));}})[_0xe9fe('0x18')](function(_0x4a609d){return logger[_0xe9fe('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe9fe('0x2b'),_0xe9fe('0x59'),util[_0xe9fe('0x3b')](_0x4a609d,{'showHidden':![],'depth':null}));});}else{logger[_0xe9fe('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe9fe('0x2b'),_0xe9fe('0x59'),_0xe9fe('0x64'));}break;case _0xe9fe('0x65'):if(_0x3c7155['apiKey']){var _0x570e0c={'method':_0xe9fe('0x3f'),'uri':_0xe9fe('0x66'),'headers':{'Authorization':_0x3c7155[_0xe9fe('0x5b')]},'body':{'content':_0x2dd661['body'],'to':[_0x2dd661[_0xe9fe('0x22')]],'from':_0x3c7155['phone'],'binary':![],'clientMessageId':_0xe9fe('0x67'),'charset':'UTF-8'},'json':!![]};rp(_0x570e0c)[_0xe9fe('0x1d')](function(_0x2c67dd){if(!_0x2c67dd[_0xe9fe('0x19')]){var _0x3c7f9a={'messageId':_0x2c67dd['messages'][0x0][_0xe9fe('0x68')]};if(!_0x3c7155[_0xe9fe('0x39')]){_0x3c7f9a[_0xe9fe('0x3a')]=!![];}return _0x5404ed[_0xe9fe('0x29')](_0x3c7f9a);}else{return logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),'afterCreate',_0xe9fe('0x65'),util[_0xe9fe('0x3b')](_0x2c67dd[_0xe9fe('0x19')],{'showHidden':![],'depth':null}));}})[_0xe9fe('0x18')](function(_0x1338b1){return logger['error'](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x65'),util[_0xe9fe('0x3b')](_0x1338b1,{'showHidden':![],'depth':null}));});}else{logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x65'),_0xe9fe('0x64'));}break;case _0xe9fe('0x69'):if(_0x3c7155['username']&&_0x3c7155[_0xe9fe('0x33')]){var _0x483af9=util[_0xe9fe('0x43')](_0xe9fe('0x44'),_0x3c7155[_0xe9fe('0x2f')],_0x3c7155[_0xe9fe('0x33')]);var _0x3691b4={'method':_0xe9fe('0x3f'),'uri':_0xe9fe('0x6a')+_0x3c7155['accountId']+_0xe9fe('0x6b'),'body':{'to':[_0x2dd661[_0xe9fe('0x22')]],'text':_0x2dd661[_0xe9fe('0xd')],'from':_0x3c7155[_0xe9fe('0x22')],'applicationId':_0x3c7155['applicationId']},'headers':{'Authorization':util[_0xe9fe('0x43')](_0xe9fe('0x46'),new Buffer(_0x483af9)[_0xe9fe('0x47')](_0xe9fe('0x48')))},'json':!![]};rp(_0x3691b4)[_0xe9fe('0x1d')](function(_0x286c07){if(_0x286c07['id']){var _0x5a7836={'messageId':_0x286c07['id']};return _0x5404ed[_0xe9fe('0x29')](_0x5a7836);}else{logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x69'),util['inspect'](_0x286c07,{'showHidden':![],'depth':null}));}})[_0xe9fe('0x18')](function(_0x5d7dd2){logger['error'](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x69'),util[_0xe9fe('0x3b')](_0x5d7dd2,{'showHidden':![],'depth':null}));});}else{logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x69'),_0xe9fe('0x3c'));}break;case _0xe9fe('0x6c'):if(_0x3c7155[_0xe9fe('0x5b')]){var _0x287d6f={};var _0xf27871={'method':'POST','uri':_0xe9fe('0x6d'),'headers':{'Authorization':'Bearer\x20'+_0x3c7155[_0xe9fe('0x5b')],'Content-Type':_0xe9fe('0x56')},'body':{'from':_0x3c7155[_0xe9fe('0x22')],'to':_0x2dd661[_0xe9fe('0x22')],'text':_0x2dd661[_0xe9fe('0xd')]},'json':!![]};return rp(_0xf27871)[_0xe9fe('0x1d')](function(_0x48d3a4){if(_0x48d3a4[_0xe9fe('0x6e')]==0xca){_0x287d6f[_0xe9fe('0x6f')]=_0x48d3a4;var _0x368529={'method':_0xe9fe('0x3f'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xe9fe('0x70')+_0x3c7155[_0xe9fe('0x5b')],'Content-Type':_0xe9fe('0x56')},'body':{'refid':_0x287d6f[_0xe9fe('0x6f')][_0xe9fe('0x71')]},'json':!![]};return rp(_0x368529)[_0xe9fe('0x1d')](function(_0x20dca7){_0x287d6f['status']=_0x20dca7;var _0x35bcd9={'messageId':_0x287d6f[_0xe9fe('0x6f')]['refid'],'read':!![]};return _0x5404ed['update'](_0x35bcd9);});}else{return logger[_0xe9fe('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe9fe('0x6c'),util[_0xe9fe('0x3b')](_0x48d3a4,{'showHidden':![],'depth':null}));}})[_0xe9fe('0x18')](function(_0xb78112){return logger['error'](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x6c'),util[_0xe9fe('0x3b')](_0xb78112,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x6c'),_0xe9fe('0x72'));}break;}}})[_0xe9fe('0x73')](function(){_0x3c0a51();});}else{_0x3c0a51();}}},'charset':_0xe9fe('0x74'),'collate':_0xe9fe('0x75')});}; \ No newline at end of file +var _0x1be3=['messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','isNil','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','SmsAccount','find','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','Basic\x20%s','base64','http_code','data','head','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','IBSSO\x20','csc','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','hex','signature=','GET','/external/get/send.php?','uuid','apiMessageId','clickatell','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages'];(function(_0x456a4b,_0x51df8){var _0x42957c=function(_0x431de8){while(--_0x431de8){_0x456a4b['push'](_0x456a4b['shift']());}};_0x42957c(++_0x51df8);}(_0x1be3,0x172));var _0x31be=function(_0x513561,_0x22333d){_0x513561=_0x513561-0x0;var _0xfda2bf=_0x1be3[_0x513561];return _0xfda2bf;};'use strict';var _=require(_0x31be('0x0'));var util=require(_0x31be('0x1'));var logger=require('../../config/logger')(_0x31be('0x2'));var moment=require(_0x31be('0x3'));var BPromise=require(_0x31be('0x4'));var rp=require(_0x31be('0x5'));var fs=require('fs');var path=require(_0x31be('0x6'));var rimraf=require(_0x31be('0x7'));var config=require(_0x31be('0x8'));var attributes=require(_0x31be('0x9'));module[_0x31be('0xa')]=function(_0x3f7a68,_0x23ab13){return _0x3f7a68[_0x31be('0xb')](_0x31be('0xc'),attributes,{'tableName':_0x31be('0xd'),'paranoid':![],'indexes':[{'name':_0x31be('0xe'),'fields':[_0x31be('0xe')]},{'name':'fti_sms_messages','fields':[_0x31be('0xf')],'type':_0x31be('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x271ba8,_0x34ee6e,_0x352700){var _0x43c330=_0x3f7a68[_0x31be('0x11')];var _0x533342=_0x271ba8[_0x31be('0x12')]({'plain':!![]});if(_0x533342[_0x31be('0x13')][_0x31be('0x14')]()==='in'||_0x533342['direction'][_0x31be('0x14')]()===_0x31be('0x15')&&!_0x533342[_0x31be('0x16')]&&!_['isNil'](_0x533342[_0x31be('0x17')])&&!_[_0x31be('0x18')](_0x533342['SmsInteractionId'])){_0x43c330[_0x31be('0x19')][_0x31be('0x1a')]({'where':{'id':_0x533342[_0x31be('0x1b')]}})[_0x31be('0x1c')](function(_0x19f603){if(_0x19f603){_0x19f603[_0x31be('0x1d')]({'lastMsgAt':_0x533342[_0x31be('0x1e')],'lastMsgDirection':_0x533342[_0x31be('0x13')]['toLowerCase']()});}})[_0x31be('0x1f')](function(_0x2b284e){console['error'](_0x2b284e);});}if(_0x533342[_0x31be('0x13')]===_0x31be('0x15')&&!_0x533342[_0x31be('0x16')]){var _0x3cec6f;_0x43c330[_0x31be('0x20')][_0x31be('0x21')]({'where':{'id':_0x533342['SmsAccountId']},'raw':!![]})[_0x31be('0x1c')](function(_0x45118d){_0x3cec6f=_0x45118d;if(_0x3cec6f&&_0x3cec6f[_0x31be('0x22')]){switch(_0x3cec6f[_0x31be('0x22')]){case _0x31be('0x23'):var _0x494e36=require(_0x31be('0x23'));if(_0x3cec6f[_0x31be('0x24')]&&_0x3cec6f[_0x31be('0x25')]&&_0x3cec6f[_0x31be('0x26')]){var _0x1aeca0=new _0x494e36(_0x3cec6f[_0x31be('0x24')],_0x3cec6f['authToken']);_0x1aeca0[_0x31be('0x27')][_0x31be('0x28')]({'body':_0x533342['body'],'to':_0x533342[_0x31be('0x26')],'from':_0x3cec6f[_0x31be('0x26')],'statusCallback':_0x3cec6f[_0x31be('0x29')]+_0x31be('0x2a')+_0x533342['id']+_0x31be('0x2b')+_0x3cec6f[_0x31be('0x2c')]})[_0x31be('0x1c')](function(_0x2186c1){if(_0x2186c1['sid']){return _0x271ba8[_0x31be('0x1d')]({'messageId':_0x2186c1[_0x31be('0x2d')]});}})[_0x31be('0x1f')](function(_0x4b06af){logger[_0x31be('0x2e')](_0x31be('0x2f'),_0x31be('0x30'),_0x31be('0x23'),util[_0x31be('0x31')](_0x4b06af,{'showHidden':![],'depth':null}));});}else{logger[_0x31be('0x2e')](_0x31be('0x2f'),'afterCreate',_0x31be('0x23'),_0x31be('0x32'));}break;case'skebby':var _0x4248ca=_0x31be('0x33');if(_0x3cec6f[_0x31be('0x34')]&&_0x3cec6f[_0x31be('0x35')]){var _0x5a3b0e={'recipient':[_0x533342['phone']],'message':_0x533342[_0x31be('0xf')],'message_type':_0x3cec6f[_0x31be('0x36')]};if(_0x3cec6f[_0x31be('0x36')]&&_0x3cec6f[_0x31be('0x36')]!=='SI'){_0x5a3b0e[_0x31be('0x37')]=_0x3cec6f[_0x31be('0x26')];}var _0x5d3732={'url':_0x4248ca+_0x31be('0x38')+_0x3cec6f['username']+'&password='+_0x3cec6f[_0x31be('0x35')],'method':'GET'};rp(_0x5d3732)[_0x31be('0x1c')](function(_0x54280f){var _0xf32e37=_0x54280f[_0x31be('0x39')](';');var _0x296329={'user_key':_0xf32e37[0x0],'session_key':_0xf32e37[0x1]};_0x5d3732={'url':_0x4248ca+_0x31be('0x3a'),'method':_0x31be('0x3b'),'headers':{'user_key':_0x296329[_0x31be('0x3c')],'Session_key':_0x296329[_0x31be('0x3d')]},'json':!![],'body':_0x5a3b0e};return rp(_0x5d3732);})[_0x31be('0x1c')](function(_0x2e2acd){if(_0x2e2acd[_0x31be('0x3e')]>=0x1){var _0x5ee160={'messageId':_0x2e2acd[_0x31be('0x3f')]};if(_0x3cec6f['smsMethod']!=='GP'||!_0x3cec6f[_0x31be('0x40')]){_0x5ee160[_0x31be('0x41')]=!![];}return _0x271ba8[_0x31be('0x1d')](_0x5ee160);}else{return logger[_0x31be('0x2e')](_0x31be('0x2f'),_0x31be('0x30'),_0x31be('0x42'),util[_0x31be('0x31')](_0x2e2acd,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2241d3){return logger[_0x31be('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x31be('0x30'),'skebby',util[_0x31be('0x31')](_0x2241d3,{'showHidden':![],'depth':null}));});}else{logger[_0x31be('0x2e')](_0x31be('0x2f'),'afterCreate',_0x31be('0x42'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x31be('0x43'):if(_0x3cec6f['authToken']){var _0x485bb4={'recipient':_0x533342[_0x31be('0x26')],'message':_0x533342[_0x31be('0xf')],'sender':_0x3cec6f[_0x31be('0x44')]||_0x3cec6f[_0x31be('0x26')],'authorization':_0x3cec6f[_0x31be('0x25')]};var _0x34ee6e={'method':'POST','uri':_0x31be('0x45'),'body':_0x485bb4,'json':!![]};rp(_0x34ee6e)[_0x31be('0x1c')](function(_0x3fb42b){var _0x460687={'messageId':_0x3fb42b[_0x31be('0x46')]};if(!_0x3cec6f[_0x31be('0x40')]){_0x460687[_0x31be('0x41')]=!![];}return _0x271ba8[_0x31be('0x1d')](_0x460687);})[_0x31be('0x1f')](function(_0xc09fdd){logger[_0x31be('0x2e')](_0x31be('0x2f'),_0x31be('0x30'),_0x31be('0x43'),util[_0x31be('0x31')](_0xc09fdd,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x31be('0x43'),_0x31be('0x47'));}break;case _0x31be('0x48'):if(_0x3cec6f['username']&&_0x3cec6f[_0x31be('0x35')]){var _0x485bb4={'messages':[{'source':_0x31be('0x49'),'to':_0x533342[_0x31be('0x26')],'body':_0x533342[_0x31be('0xf')],'from':_0x3cec6f[_0x31be('0x44')]||_0x3cec6f[_0x31be('0x26')]}]};var _0x2d5c59=util[_0x31be('0x4a')](_0x31be('0x4b'),_0x3cec6f[_0x31be('0x34')],_0x3cec6f[_0x31be('0x35')]);var _0x34ee6e={'method':_0x31be('0x3b'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x485bb4,'headers':{'Authorization':util[_0x31be('0x4a')](_0x31be('0x4c'),new Buffer(_0x2d5c59)['toString'](_0x31be('0x4d')))},'json':!![]};rp(_0x34ee6e)[_0x31be('0x1c')](function(_0x1790a3){if(_0x1790a3[_0x31be('0x4e')]>=0xc8&&_0x1790a3[_0x31be('0x4e')]<=0xce){if(_0x1790a3[_0x31be('0x4f')]&&_0x1790a3[_0x31be('0x4f')]['queued_count']>0x0){var _0x1cff6a=_[_0x31be('0x50')](_0x1790a3[_0x31be('0x4f')][_0x31be('0x27')]);var _0x5780e4={'messageId':_0x1cff6a['message_id']};if(!_0x3cec6f[_0x31be('0x40')]){_0x5780e4[_0x31be('0x41')]=!![];}return _0x271ba8[_0x31be('0x1d')](_0x5780e4);}else{logger[_0x31be('0x2e')](_0x31be('0x2f'),_0x31be('0x30'),_0x31be('0x51'),util[_0x31be('0x31')](_0x1790a3,{'showHidden':![],'depth':null}));}}else{logger[_0x31be('0x2e')](_0x31be('0x2f'),_0x31be('0x30'),_0x31be('0x51'),util['inspect'](_0x1790a3,{'showHidden':![],'depth':null}));}})[_0x31be('0x1f')](function(_0x267a9c){logger[_0x31be('0x2e')](_0x31be('0x2f'),'afterCreate','clickSend',util[_0x31be('0x31')](_0x267a9c,{'showHidden':![],'depth':null}));});}else{logger[_0x31be('0x2e')](_0x31be('0x2f'),_0x31be('0x30'),_0x31be('0x51'),_0x31be('0x52'));}break;case _0x31be('0x53'):if(_0x3cec6f[_0x31be('0x54')]&&_0x3cec6f[_0x31be('0x25')]){var _0x485bb4={'dst':_0x533342[_0x31be('0x26')],'text':_0x533342[_0x31be('0xf')],'src':_0x3cec6f[_0x31be('0x44')]||_0x3cec6f[_0x31be('0x26')],'url':_0x3cec6f['remote']+'/api/sms/messages/'+_0x533342['id']+_0x31be('0x2b')+_0x3cec6f[_0x31be('0x2c')]};var _0x2d5c59=util[_0x31be('0x4a')](_0x31be('0x4b'),_0x3cec6f[_0x31be('0x54')],_0x3cec6f[_0x31be('0x25')]);var _0x34ee6e={'method':_0x31be('0x3b'),'uri':util[_0x31be('0x4a')]('https://api.plivo.com/v1/Account/%s/Message/',_0x3cec6f[_0x31be('0x54')]),'body':_0x485bb4,'headers':{'Authorization':util['format'](_0x31be('0x4c'),new Buffer(_0x2d5c59)[_0x31be('0x55')](_0x31be('0x4d')))},'json':!![]};rp(_0x34ee6e)[_0x31be('0x1c')](function(_0x268b62){var _0x8e9110={'messageId':_0x268b62[_0x31be('0x56')][0x0]};return _0x271ba8['update'](_0x8e9110);})['catch'](function(_0x343be3){logger[_0x31be('0x2e')](_0x31be('0x2f'),_0x31be('0x30'),_0x31be('0x53'),util[_0x31be('0x31')](_0x343be3,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x31be('0x2f'),_0x31be('0x30'),_0x31be('0x53'),_0x31be('0x57'));}break;case _0x31be('0x58'):if(_0x3cec6f[_0x31be('0x34')]&&_0x3cec6f['password']){if(_0x3cec6f[_0x31be('0x59')]){var _0x1ca3da={'method':_0x31be('0x3b'),'uri':_0x3cec6f[_0x31be('0x59')]+_0x31be('0x5a'),'body':{'username':_0x3cec6f[_0x31be('0x34')],'password':_0x3cec6f[_0x31be('0x35')]},'json':!![]};return rp(_0x1ca3da)[_0x31be('0x1c')](function(_0x294d61){var _0x208c09={'method':'POST','uri':_0x3cec6f[_0x31be('0x59')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x3cec6f['phone'],'destinations':[{'to':_0x533342[_0x31be('0x26')]}],'text':_0x533342['body'],'notifyUrl':_0x3cec6f['remote']+_0x31be('0x2a')+_0x533342['id']+_0x31be('0x2b')+_0x3cec6f[_0x31be('0x2c')],'notifyContentType':'application/json','callbackData':_0x3cec6f[_0x31be('0x26')]+';'+_0x533342[_0x31be('0xf')]}]},'headers':{'Authorization':_0x31be('0x5b')+_0x294d61[_0x31be('0x2c')]},'json':!![]};return rp(_0x208c09)[_0x31be('0x1c')](function(_0xe61892){if(_0xe61892['messages']){var _0x5f11ae={'messageId':_0xe61892[_0x31be('0x27')][0x0][_0x31be('0xe')]};if(!_0x3cec6f['deliveryReport']){_0x5f11ae[_0x31be('0x41')]=!![];}return _0x271ba8['update'](_0x5f11ae);}else{return logger[_0x31be('0x2e')](_0x31be('0x2f'),'afterCreate',_0x31be('0x58'),util[_0x31be('0x31')](_0xe61892,{'showHidden':![],'depth':null}));}});})[_0x31be('0x1f')](function(_0x3d2e1c){return logger[_0x31be('0x2e')](_0x31be('0x2f'),_0x31be('0x30'),_0x31be('0x58'),util[_0x31be('0x31')](_0x3d2e1c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x31be('0x2f'),_0x31be('0x30'),_0x31be('0x58'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x31be('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',_0x31be('0x52'));}break;case _0x31be('0x5c'):var _0x353f07=require('crypto');if(_0x3cec6f[_0x31be('0x5d')]){var _0x439c4e={};_0x439c4e[_0x31be('0x5e')]=_0x3cec6f['username'];_0x439c4e[_0x31be('0x26')]=_0x533342['phone'];_0x439c4e[_0x31be('0x37')]=_0x3cec6f[_0x31be('0x26')];_0x439c4e[_0x31be('0x5f')]=_0x533342['body'];_0x439c4e[_0x31be('0x60')]=+new Date();var _0x5f1be3='';var _0x3dcb6f='';var _0x2bfb1d=Object[_0x31be('0x61')](_0x439c4e);_0x2bfb1d[_0x31be('0x62')]();for(var _0x43eb1c=0x0;_0x43eb1c<_0x2bfb1d[_0x31be('0x63')];_0x43eb1c++){if(_0x5f1be3!=''){_0x5f1be3+='&';}_0x5f1be3+=_0x2bfb1d[_0x43eb1c]+'='+encodeURIComponent(_0x439c4e[_0x2bfb1d[_0x43eb1c]]);_0x3dcb6f+=_0x439c4e[_0x2bfb1d[_0x43eb1c]];}_0x3dcb6f+=_0x3cec6f[_0x31be('0x5d')];_0x3dcb6f=_0x353f07[_0x31be('0x64')](_0x31be('0x65'))[_0x31be('0x1d')](_0x3dcb6f)['digest'](_0x31be('0x66'));if(_0x5f1be3!==''){_0x5f1be3+='&';}_0x5f1be3+=_0x31be('0x67')+_0x3dcb6f;var _0x5d3732={'method':_0x31be('0x68'),'uri':_0x3cec6f[_0x31be('0x59')]+_0x31be('0x69')+_0x5f1be3,'json':!![]};return rp(_0x5d3732)['then'](function(_0xb3fb13){var _0x560767=Object['keys'](_0xb3fb13);if(_0xb3fb13[_0x560767[0x0]][_0x31be('0x2e')]&&parseInt(_0xb3fb13[_0x560767[0x0]][_0x31be('0x2e')])===0x0){var _0x40c1e4={'messageId':_0xb3fb13[_0x560767[0x0]]['id_sms']};if(!_0x3cec6f[_0x31be('0x40')]){_0x40c1e4['read']=!![];}return _0x271ba8['update'](_0x40c1e4);}else{return logger[_0x31be('0x2e')](_0x31be('0x2f'),_0x31be('0x30'),_0x31be('0x5c'),util[_0x31be('0x31')](_0xb3fb13[_0x31be('0x2e')],{'showHidden':![],'depth':null}));}})[_0x31be('0x1f')](function(_0x3db14b){return logger[_0x31be('0x2e')](_0x31be('0x2f'),_0x31be('0x30'),'csc',util[_0x31be('0x31')](_0x3db14b,{'showHidden':![],'depth':null}));});}else{logger[_0x31be('0x2e')](_0x31be('0x2f'),_0x31be('0x30'),_0x31be('0x5c'),'Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x3cec6f[_0x31be('0x5d')]){var _0x3f085f={'method':_0x31be('0x3b'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x3cec6f[_0x31be('0x5d')]},'body':{'content':_0x533342['body'],'to':[_0x533342[_0x31be('0x26')]],'from':_0x3cec6f['phone'],'binary':![],'clientMessageId':_0x31be('0x6a'),'charset':'UTF-8'},'json':!![]};rp(_0x3f085f)[_0x31be('0x1c')](function(_0x50f62d){if(!_0x50f62d['error']){var _0x1eabb7={'messageId':_0x50f62d[_0x31be('0x27')][0x0][_0x31be('0x6b')]};if(!_0x3cec6f[_0x31be('0x40')]){_0x1eabb7[_0x31be('0x41')]=!![];}return _0x271ba8[_0x31be('0x1d')](_0x1eabb7);}else{return logger[_0x31be('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x31be('0x30'),_0x31be('0x6c'),util['inspect'](_0x50f62d[_0x31be('0x2e')],{'showHidden':![],'depth':null}));}})[_0x31be('0x1f')](function(_0x392a81){return logger['error'](_0x31be('0x2f'),_0x31be('0x30'),'clickatell',util[_0x31be('0x31')](_0x392a81,{'showHidden':![],'depth':null}));});}else{logger[_0x31be('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x31be('0x6c'),_0x31be('0x6d'));}break;case _0x31be('0x6e'):if(_0x3cec6f[_0x31be('0x34')]&&_0x3cec6f[_0x31be('0x35')]){var _0x2d5c59=util[_0x31be('0x4a')]('%s:%s',_0x3cec6f[_0x31be('0x34')],_0x3cec6f[_0x31be('0x35')]);var _0x34ee6e={'method':_0x31be('0x3b'),'uri':_0x31be('0x6f')+_0x3cec6f[_0x31be('0x70')]+_0x31be('0x71'),'body':{'to':[_0x533342[_0x31be('0x26')]],'text':_0x533342[_0x31be('0xf')],'from':_0x3cec6f['phone'],'applicationId':_0x3cec6f[_0x31be('0x72')]},'headers':{'Authorization':util[_0x31be('0x4a')](_0x31be('0x4c'),new Buffer(_0x2d5c59)['toString'](_0x31be('0x4d')))},'json':!![]};rp(_0x34ee6e)[_0x31be('0x1c')](function(_0x19f060){if(_0x19f060['id']){var _0x47b662={'messageId':_0x19f060['id']};return _0x271ba8['update'](_0x47b662);}else{logger[_0x31be('0x2e')](_0x31be('0x2f'),_0x31be('0x30'),_0x31be('0x6e'),util[_0x31be('0x31')](_0x19f060,{'showHidden':![],'depth':null}));}})[_0x31be('0x1f')](function(_0x102afe){logger[_0x31be('0x2e')](_0x31be('0x2f'),_0x31be('0x30'),_0x31be('0x6e'),util[_0x31be('0x31')](_0x102afe,{'showHidden':![],'depth':null}));});}else{logger[_0x31be('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x31be('0x6e'),_0x31be('0x52'));}break;case _0x31be('0x73'):if(_0x3cec6f[_0x31be('0x5d')]){var _0x32ad6f={};var _0x5d3732={'method':_0x31be('0x3b'),'uri':_0x31be('0x74'),'headers':{'Authorization':_0x31be('0x75')+_0x3cec6f[_0x31be('0x5d')],'Content-Type':_0x31be('0x76')},'body':{'from':_0x3cec6f[_0x31be('0x26')],'to':_0x533342[_0x31be('0x26')],'text':_0x533342[_0x31be('0xf')]},'json':!![]};return rp(_0x5d3732)[_0x31be('0x1c')](function(_0x3ad3ac){if(_0x3ad3ac[_0x31be('0x77')]==0xca){_0x32ad6f[_0x31be('0x78')]=_0x3ad3ac;var _0x25f7b2={'method':_0x31be('0x3b'),'uri':_0x31be('0x79'),'headers':{'Authorization':'Bearer\x20'+_0x3cec6f[_0x31be('0x5d')],'Content-Type':_0x31be('0x76')},'body':{'refid':_0x32ad6f[_0x31be('0x78')][_0x31be('0x7a')]},'json':!![]};return rp(_0x25f7b2)[_0x31be('0x1c')](function(_0x25d319){_0x32ad6f[_0x31be('0x7b')]=_0x25d319;var _0x1dbd44={'messageId':_0x32ad6f[_0x31be('0x78')][_0x31be('0x7a')],'read':!![]};return _0x271ba8[_0x31be('0x1d')](_0x1dbd44);});}else{return logger[_0x31be('0x2e')](_0x31be('0x2f'),_0x31be('0x30'),'intelepeer',util[_0x31be('0x31')](_0x3ad3ac,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1367a0){return logger[_0x31be('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x31be('0x30'),'intelepeer',util[_0x31be('0x31')](_0x1367a0,{'showHidden':![],'depth':null}));});}else{return logger[_0x31be('0x2e')](_0x31be('0x2f'),'afterCreate',_0x31be('0x73'),_0x31be('0x7c'));}break;}}})[_0x31be('0x7d')](function(){_0x352700();});}else{_0x352700();}}},'charset':_0x31be('0x7e'),'collate':_0x31be('0x7f')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 6fdd674..ef25c48 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 _0x18dd=['jayson/promise','client','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','SmsMessage','create','options','raw','CreateSmsMessage','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2d566b,_0x47c52d){var _0xd90686=function(_0x184772){while(--_0x184772){_0x2d566b['push'](_0x2d566b['shift']());}};_0xd90686(++_0x47c52d);}(_0x18dd,0x1a4));var _0xd18d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x18dd[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xd18d('0x0'));var util=require(_0xd18d('0x1'));var moment=require(_0xd18d('0x2'));var BPromise=require(_0xd18d('0x3'));var rs=require(_0xd18d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd18d('0x5'))['db'];var utils=require(_0xd18d('0x6'));var logger=require('../../config/logger')(_0xd18d('0x7'));var config=require(_0xd18d('0x8'));var jayson=require(_0xd18d('0x9'));var client=jayson[_0xd18d('0xa')]['http']({'port':0x232a});config[_0xd18d('0xb')]=_['defaults'](config[_0xd18d('0xb')],{'host':_0xd18d('0xc'),'port':0x18eb});var socket=require(_0xd18d('0xd'))(new Redis(config[_0xd18d('0xb')]));require(_0xd18d('0xe'))[_0xd18d('0xf')](socket);function respondWithRpcPromise(_0x2c2778,_0x37d07d,_0x12193b){return new BPromise(function(_0x5e6780,_0x21039c){return client[_0xd18d('0x10')](_0x2c2778,_0x12193b)[_0xd18d('0x11')](function(_0x1457e3){logger[_0xd18d('0x12')](_0xd18d('0x13'),_0x37d07d,_0xd18d('0x14'));logger[_0xd18d('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x37d07d,_0xd18d('0x14'),JSON[_0xd18d('0x16')](_0x1457e3));if(_0x1457e3[_0xd18d('0x17')]){if(_0x1457e3[_0xd18d('0x17')][_0xd18d('0x18')]===0x1f4){logger[_0xd18d('0x17')](_0xd18d('0x13'),_0x37d07d,_0x1457e3[_0xd18d('0x17')][_0xd18d('0x19')]);return _0x21039c(_0x1457e3[_0xd18d('0x17')][_0xd18d('0x19')]);}logger[_0xd18d('0x17')](_0xd18d('0x13'),_0x37d07d,_0x1457e3['error'][_0xd18d('0x19')]);return _0x5e6780(_0x1457e3['error'][_0xd18d('0x19')]);}else{logger[_0xd18d('0x12')]('SmsMessage,\x20%s,\x20%s',_0x37d07d,_0xd18d('0x14'));_0x5e6780(_0x1457e3[_0xd18d('0x1a')][_0xd18d('0x19')]);}})[_0xd18d('0x1b')](function(_0x26bf8f){logger[_0xd18d('0x17')](_0xd18d('0x13'),_0x37d07d,_0x26bf8f);_0x21039c(_0x26bf8f);});});}exports['CreateSmsMessage']=function(_0x31ef32){var _0x3f65cb=this;return new Promise(function(_0x56be77,_0x566d83){return db[_0xd18d('0x1c')][_0xd18d('0x1d')](_0x31ef32['body'],{'raw':_0x31ef32[_0xd18d('0x1e')]?_0x31ef32['options'][_0xd18d('0x1f')]===undefined?!![]:![]:!![]})[_0xd18d('0x11')](function(_0xa74019){logger[_0xd18d('0x12')](_0xd18d('0x20'),_0x31ef32);logger[_0xd18d('0x15')](_0xd18d('0x20'),_0x31ef32,JSON[_0xd18d('0x16')](_0xa74019));_0x56be77(_0xa74019);})['catch'](function(_0x26b09d){logger[_0xd18d('0x17')]('CreateSmsMessage',_0x26b09d[_0xd18d('0x19')],_0x31ef32);_0x566d83(_0x3f65cb[_0xd18d('0x17')](0x1f4,_0x26b09d[_0xd18d('0x19')]));});});}; \ No newline at end of file +var _0x4c11=['client','http','defaults','localhost','socket.io-emitter','redis','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','create','options','raw','CreateSmsMessage','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xfd3327,_0xc4f4f5){var _0xdc121c=function(_0x14a93c){while(--_0x14a93c){_0xfd3327['push'](_0xfd3327['shift']());}};_0xdc121c(++_0xc4f4f5);}(_0x4c11,0x78));var _0x14c1=function(_0x1c4865,_0x163598){_0x1c4865=_0x1c4865-0x0;var _0x2a3640=_0x4c11[_0x1c4865];return _0x2a3640;};'use strict';var _=require(_0x14c1('0x0'));var util=require('util');var moment=require(_0x14c1('0x1'));var BPromise=require(_0x14c1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14c1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x14c1('0x4'));var logger=require(_0x14c1('0x5'))(_0x14c1('0x6'));var config=require(_0x14c1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x14c1('0x8')][_0x14c1('0x9')]({'port':0x232a});config['redis']=_[_0x14c1('0xa')](config['redis'],{'host':_0x14c1('0xb'),'port':0x18eb});var socket=require(_0x14c1('0xc'))(new Redis(config[_0x14c1('0xd')]));require(_0x14c1('0xe'))[_0x14c1('0xf')](socket);function respondWithRpcPromise(_0x1b605a,_0x10a910,_0x5d9e7d){return new BPromise(function(_0x4caf8e,_0x5a8276){return client[_0x14c1('0x10')](_0x1b605a,_0x5d9e7d)[_0x14c1('0x11')](function(_0x29601c){logger['info'](_0x14c1('0x12'),_0x10a910,_0x14c1('0x13'));logger[_0x14c1('0x14')](_0x14c1('0x15'),_0x10a910,_0x14c1('0x13'),JSON['stringify'](_0x29601c));if(_0x29601c[_0x14c1('0x16')]){if(_0x29601c[_0x14c1('0x16')][_0x14c1('0x17')]===0x1f4){logger[_0x14c1('0x16')](_0x14c1('0x12'),_0x10a910,_0x29601c['error'][_0x14c1('0x18')]);return _0x5a8276(_0x29601c[_0x14c1('0x16')][_0x14c1('0x18')]);}logger['error'](_0x14c1('0x12'),_0x10a910,_0x29601c[_0x14c1('0x16')][_0x14c1('0x18')]);return _0x4caf8e(_0x29601c[_0x14c1('0x16')]['message']);}else{logger[_0x14c1('0x19')](_0x14c1('0x12'),_0x10a910,_0x14c1('0x13'));_0x4caf8e(_0x29601c[_0x14c1('0x1a')][_0x14c1('0x18')]);}})[_0x14c1('0x1b')](function(_0x2136c3){logger[_0x14c1('0x16')](_0x14c1('0x12'),_0x10a910,_0x2136c3);_0x5a8276(_0x2136c3);});});}exports['CreateSmsMessage']=function(_0xc30bf2){var _0x2bdd07=this;return new Promise(function(_0x40feb4,_0x461e59){return db['SmsMessage'][_0x14c1('0x1c')](_0xc30bf2['body'],{'raw':_0xc30bf2[_0x14c1('0x1d')]?_0xc30bf2[_0x14c1('0x1d')][_0x14c1('0x1e')]===undefined?!![]:![]:!![]})[_0x14c1('0x11')](function(_0x606b1c){logger[_0x14c1('0x19')](_0x14c1('0x1f'),_0xc30bf2);logger['debug'](_0x14c1('0x1f'),_0xc30bf2,JSON['stringify'](_0x606b1c));_0x40feb4(_0x606b1c);})[_0x14c1('0x1b')](function(_0x4b88e5){logger['error']('CreateSmsMessage',_0x4b88e5[_0x14c1('0x18')],_0xc30bf2);_0x461e59(_0x2bdd07[_0x14c1('0x16')](0x1f4,_0x4b88e5[_0x14c1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index a58ac38..ce9e46c 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 _0x7e71=['removeListener','length','smsMessage:','./smsMessage.events','save'];(function(_0x11ab2c,_0x4ebf1c){var _0x41af3d=function(_0x406746){while(--_0x406746){_0x11ab2c['push'](_0x11ab2c['shift']());}};_0x41af3d(++_0x4ebf1c);}(_0x7e71,0x152));var _0x17e7=function(_0x4629ed,_0x59ef85){_0x4629ed=_0x4629ed-0x0;var _0x52ca04=_0x7e71[_0x4629ed];return _0x52ca04;};'use strict';var SmsMessageEvents=require(_0x17e7('0x0'));var events=[_0x17e7('0x1'),'remove','update'];function createListener(_0x2fa22a,_0x13e66f){return function(_0x515c13){_0x13e66f['emit'](_0x2fa22a,_0x515c13);};}function removeListener(_0x3ef622,_0x10b861){return function(){SmsMessageEvents[_0x17e7('0x2')](_0x3ef622,_0x10b861);};}exports['register']=function(_0x461316){for(var _0x103b70=0x0,_0x591991=events[_0x17e7('0x3')];_0x103b70<_0x591991;_0x103b70++){var _0x1475ed=events[_0x103b70];var _0x68d08c=createListener(_0x17e7('0x4')+_0x1475ed,_0x461316);SmsMessageEvents['on'](_0x1475ed,_0x68d08c);}}; \ No newline at end of file +var _0x37d6=['smsMessage:','./smsMessage.events','save','remove','emit','removeListener','register','length'];(function(_0x423797,_0x3d393b){var _0x57ec0c=function(_0x24c145){while(--_0x24c145){_0x423797['push'](_0x423797['shift']());}};_0x57ec0c(++_0x3d393b);}(_0x37d6,0x199));var _0x637d=function(_0x42cf3b,_0x3bb5d7){_0x42cf3b=_0x42cf3b-0x0;var _0x416c2d=_0x37d6[_0x42cf3b];return _0x416c2d;};'use strict';var SmsMessageEvents=require(_0x637d('0x0'));var events=[_0x637d('0x1'),_0x637d('0x2'),'update'];function createListener(_0x433cda,_0x204bb4){return function(_0x3d93fd){_0x204bb4[_0x637d('0x3')](_0x433cda,_0x3d93fd);};}function removeListener(_0x3eac51,_0x39c394){return function(){SmsMessageEvents[_0x637d('0x4')](_0x3eac51,_0x39c394);};}exports[_0x637d('0x5')]=function(_0x32518d){for(var _0xfbd525=0x0,_0x5d3d82=events[_0x637d('0x6')];_0xfbd525<_0x5d3d82;_0xfbd525++){var _0x86972e=events[_0xfbd525];var _0x37f51f=createListener(_0x637d('0x7')+_0x86972e,_0x32518d);SmsMessageEvents['on'](_0x86972e,_0x37f51f);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index f7fbb62..985f65b 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 _0xd442=['addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','addTeams','post'];(function(_0x4da605,_0x3c2895){var _0x596deb=function(_0x26c52e){while(--_0x26c52e){_0x4da605['push'](_0x4da605['shift']());}};_0x596deb(++_0x3c2895);}(_0xd442,0xef));var _0x2d44=function(_0x147994,_0x4b9eb2){_0x147994=_0x147994-0x0;var _0x5e78ed=_0xd442[_0x147994];return _0x5e78ed;};'use strict';var multer=require(_0x2d44('0x0'));var util=require(_0x2d44('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2d44('0x2'));var router=express[_0x2d44('0x3')]();var fs_extra=require(_0x2d44('0x4'));var auth=require(_0x2d44('0x5'));var interaction=require(_0x2d44('0x6'));var config=require(_0x2d44('0x7'));var controller=require(_0x2d44('0x8'));router[_0x2d44('0x9')]('/',auth[_0x2d44('0xa')](),controller[_0x2d44('0xb')]);router[_0x2d44('0x9')]('/describe',auth[_0x2d44('0xa')](),controller[_0x2d44('0xc')]);router['get'](_0x2d44('0xd'),auth[_0x2d44('0xa')](),controller[_0x2d44('0xe')]);router[_0x2d44('0x9')](_0x2d44('0xf'),auth[_0x2d44('0xa')](),controller[_0x2d44('0x10')]);router['get'](_0x2d44('0x11'),auth[_0x2d44('0xa')](),controller['getTeams']);router['get'](_0x2d44('0x12'),auth[_0x2d44('0xa')](),controller[_0x2d44('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x2d44('0x11'),auth[_0x2d44('0xa')](),controller[_0x2d44('0x14')]);router[_0x2d44('0x15')](_0x2d44('0x12'),auth[_0x2d44('0xa')](),controller[_0x2d44('0x16')]);router['put'](_0x2d44('0xd'),auth[_0x2d44('0xa')](),controller[_0x2d44('0x17')]);router[_0x2d44('0x18')](_0x2d44('0xd'),auth[_0x2d44('0xa')](),controller[_0x2d44('0x19')]);router[_0x2d44('0x18')]('/:id/teams',auth[_0x2d44('0xa')](),controller[_0x2d44('0x1a')]);router[_0x2d44('0x18')](_0x2d44('0x12'),auth[_0x2d44('0xa')](),controller[_0x2d44('0x1b')]);module[_0x2d44('0x1c')]=router; \ No newline at end of file +var _0x52e2=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller'];(function(_0x45ff85,_0x1485d1){var _0x214889=function(_0x2706f5){while(--_0x2706f5){_0x45ff85['push'](_0x45ff85['shift']());}};_0x214889(++_0x1485d1);}(_0x52e2,0x1e6));var _0x252e=function(_0x3e68a8,_0x3cb2b0){_0x3e68a8=_0x3e68a8-0x0;var _0x57c0a6=_0x52e2[_0x3e68a8];return _0x57c0a6;};'use strict';var multer=require(_0x252e('0x0'));var util=require(_0x252e('0x1'));var path=require(_0x252e('0x2'));var timeout=require('connect-timeout');var express=require(_0x252e('0x3'));var router=express[_0x252e('0x4')]();var fs_extra=require(_0x252e('0x5'));var auth=require(_0x252e('0x6'));var interaction=require(_0x252e('0x7'));var config=require(_0x252e('0x8'));var controller=require(_0x252e('0x9'));router[_0x252e('0xa')]('/',auth[_0x252e('0xb')](),controller[_0x252e('0xc')]);router['get'](_0x252e('0xd'),auth[_0x252e('0xb')](),controller[_0x252e('0xe')]);router[_0x252e('0xa')](_0x252e('0xf'),auth[_0x252e('0xb')](),controller[_0x252e('0x10')]);router[_0x252e('0xa')](_0x252e('0x11'),auth[_0x252e('0xb')](),controller['getMembers']);router['get'](_0x252e('0x12'),auth[_0x252e('0xb')](),controller[_0x252e('0x13')]);router['get'](_0x252e('0x14'),auth['isAuthenticated'](),controller[_0x252e('0x15')]);router[_0x252e('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x252e('0x16')](_0x252e('0x12'),auth[_0x252e('0xb')](),controller[_0x252e('0x17')]);router['post'](_0x252e('0x14'),auth[_0x252e('0xb')](),controller[_0x252e('0x18')]);router[_0x252e('0x19')](_0x252e('0xf'),auth[_0x252e('0xb')](),controller[_0x252e('0x1a')]);router['delete']('/:id',auth[_0x252e('0xb')](),controller[_0x252e('0x1b')]);router[_0x252e('0x1c')](_0x252e('0x12'),auth[_0x252e('0xb')](),controller[_0x252e('0x1d')]);router[_0x252e('0x1c')]('/:id/users',auth[_0x252e('0xb')](),controller[_0x252e('0x1e')]);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 8e07501..1d12038 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 _0x8b5e=['exports','name','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x2f40b0,_0x40122e){var _0x5bc71b=function(_0xcb1864){while(--_0xcb1864){_0x2f40b0['push'](_0x2f40b0['shift']());}};_0x5bc71b(++_0x40122e);}(_0x8b5e,0x1bb));var _0xe8b5=function(_0x2c5df6,_0x40f469){_0x2c5df6=_0x2c5df6-0x0;var _0x33298a=_0x8b5e[_0x2c5df6];return _0x33298a;};'use strict';var Sequelize=require(_0xe8b5('0x0'));module[_0xe8b5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xe8b5('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe8b5('0x3')](_0xe8b5('0x4'),'beepall',_0xe8b5('0x5'))}}; \ No newline at end of file +var _0x81a0=['ENUM','rrmemory','exports','name','STRING','INTEGER'];(function(_0x463d36,_0x589dc7){var _0x546dc9=function(_0x1a563d){while(--_0x1a563d){_0x463d36['push'](_0x463d36['shift']());}};_0x546dc9(++_0x589dc7);}(_0x81a0,0xb6));var _0x081a=function(_0x1a60cf,_0xa5cf48){_0x1a60cf=_0x1a60cf-0x0;var _0x4b806b=_0x81a0[_0x1a60cf];return _0x4b806b;};'use strict';var Sequelize=require('sequelize');module[_0x081a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x081a('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x081a('0x2')]},'timeout':{'type':Sequelize[_0x081a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x081a('0x4')](_0x081a('0x5'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 3495cd4..d106883 100644 --- a/server/api/smsQueue/smsQueue.controller.js +++ b/server/api/smsQueue/smsQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['show','params','model','keys','intersection','attributes','fields','includeAll','merge','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','rawAttributes','filters','hasOwnProperty','order','sort','pick','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','length','filter','nolimit','ids','Team','Agents','interface','flatMap','sequelize','transaction','addTeams','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','findOne','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','./smsQueue.socket','register','end','json','offset','limit','undefined','count','status','update','then','UserProfileResource','destroy','sendStatus','stack','name','send','index','fieldName','key','getOptions','where','SmsQueue','include','query','findAll','catch'];(function(_0x4d572e,_0x59ceb7){var _0x43a969=function(_0x2184d1){while(--_0x2184d1){_0x4d572e['push'](_0x4d572e['shift']());}};_0x43a969(++_0x59ceb7);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var BPromise=require('bluebird');var util=require(_0x65f6('0x0'));var _=require('lodash');var squel=require(_0x65f6('0x1'));var Redis=require(_0x65f6('0x2'));var qs=require(_0x65f6('0x3'));var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../config/environment');var db=require(_0x65f6('0x6'))['db'];config['redis']=_[_0x65f6('0x7')](config[_0x65f6('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65f6('0x8')]));require(_0x65f6('0x9'))[_0x65f6('0xa')](socket);function respondWithStatusCode(_0x8f6451,_0xc44c70){_0xc44c70=_0xc44c70||0xcc;return function(_0x14f4c7){if(_0x14f4c7){return _0x8f6451['sendStatus'](_0xc44c70);}return _0x8f6451['status'](_0xc44c70)[_0x65f6('0xb')]();};}function respondWithResult(_0x2f6d5b,_0x264647){_0x264647=_0x264647||0xc8;return function(_0x25c416){if(_0x25c416){return _0x2f6d5b['status'](_0x264647)[_0x65f6('0xc')](_0x25c416);}};}function respondWithFilteredResult(_0x571436,_0x497cf3){return function(_0x2d2dfa){if(_0x2d2dfa){var _0x576875=typeof _0x497cf3[_0x65f6('0xd')]==='undefined'&&typeof _0x497cf3[_0x65f6('0xe')]===_0x65f6('0xf');var _0x2c4ee5=_0x2d2dfa[_0x65f6('0x10')];var _0x369f96=_0x576875?0x0:_0x497cf3[_0x65f6('0xd')];var _0x44144b=_0x576875?_0x2d2dfa[_0x65f6('0x10')]:_0x497cf3[_0x65f6('0xd')]+_0x497cf3[_0x65f6('0xe')];var _0x59154e;if(_0x44144b>=_0x2c4ee5){_0x44144b=_0x2c4ee5;_0x59154e=0xc8;}else{_0x59154e=0xce;}_0x571436[_0x65f6('0x11')](_0x59154e);return _0x571436['set']('Content-Range',_0x369f96+'-'+_0x44144b+'/'+_0x2c4ee5)[_0x65f6('0xc')](_0x2d2dfa);}return null;};}function saveUpdates(_0x5c69f8){return function(_0x37330d){if(_0x37330d){return _0x37330d[_0x65f6('0x12')](_0x5c69f8)[_0x65f6('0x13')](function(_0x1f974c){return _0x1f974c;});}return null;};}function removeEntity(_0xc8660c){return function(_0x18380e){if(_0x18380e){return _0x18380e['destroy']()['then'](function(){var _0x2d538c=_0x18380e['get']({'plain':!![]});var _0x4c81f3='SmsQueues';return db[_0x65f6('0x14')][_0x65f6('0x15')]({'where':{'type':_0x4c81f3,'resourceId':_0x2d538c['id']}})['then'](function(){return _0x18380e;});})[_0x65f6('0x13')](function(){_0xc8660c[_0x65f6('0x11')](0xcc)[_0x65f6('0xb')]();});}};}function handleEntityNotFound(_0x3876ed){return function(_0x219ab2){if(!_0x219ab2){_0x3876ed[_0x65f6('0x16')](0x194);}return _0x219ab2;};}function handleError(_0x581374,_0x197a49){_0x197a49=_0x197a49||0x1f4;return function(_0x4bb39e){logger['error'](_0x4bb39e[_0x65f6('0x17')]);if(_0x4bb39e[_0x65f6('0x18')]){delete _0x4bb39e['name'];}_0x581374[_0x65f6('0x11')](_0x197a49)[_0x65f6('0x19')](_0x4bb39e);};}exports[_0x65f6('0x1a')]=function(_0x2774a1,_0x4f5a69){var _0x9d7bb0={};var _0x59ea32={'count':0x0,'rows':[]};var _0x20a161=_['map'](db['SmsQueue']['rawAttributes'],function(_0x29abdb){return{'name':_0x29abdb[_0x65f6('0x1b')],'type':_0x29abdb['type'][_0x65f6('0x1c')]};});_0x9d7bb0=qs[_0x65f6('0x1d')](_0x20a161,_0x2774a1);var _0x52277c={'where':_0x9d7bb0[_0x65f6('0x1e')]};return db[_0x65f6('0x1f')][_0x65f6('0x10')](_0x52277c)['then'](function(_0x4ac04b){_0x59ea32['count']=_0x4ac04b;_0x9d7bb0[_0x65f6('0x20')]=qs[_0x65f6('0x20')](_0x2774a1[_0x65f6('0x21')]);return db[_0x65f6('0x1f')][_0x65f6('0x22')](_0x9d7bb0);})[_0x65f6('0x13')](function(_0x144e55){_0x59ea32['rows']=_0x144e55;return _0x59ea32;})['then'](respondWithFilteredResult(_0x4f5a69,_0x9d7bb0))[_0x65f6('0x23')](handleError(_0x4f5a69,null));};exports[_0x65f6('0x24')]=function(_0x5878bc,_0x4e50c0){var _0x10b368={'raw':!![],'where':{'id':_0x5878bc[_0x65f6('0x25')]['id']}},_0x1ce43c={};_0x1ce43c[_0x65f6('0x26')]=_[_0x65f6('0x27')](db[_0x65f6('0x1f')]['rawAttributes']);_0x1ce43c[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x5878bc[_0x65f6('0x21')]);_0x1ce43c['filters']=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],_0x1ce43c[_0x65f6('0x21')]);_0x10b368[_0x65f6('0x29')]=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],qs['fields'](_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x10b368['attributes']=_0x10b368[_0x65f6('0x29')]['length']?_0x10b368[_0x65f6('0x29')]:_0x1ce43c['model'];if(_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2b')]){_0x10b368['include']=[{'all':!![]}];}_0x10b368=_[_0x65f6('0x2c')]({},_0x10b368,_0x5878bc[_0x65f6('0x2d')]);return db[_0x65f6('0x1f')]['find'](_0x10b368)['then'](handleEntityNotFound(_0x4e50c0,null))[_0x65f6('0x13')](respondWithResult(_0x4e50c0,null))['catch'](handleError(_0x4e50c0,null));};exports[_0x65f6('0x2e')]=function(_0x4e6653,_0x22d760){return db[_0x65f6('0x1f')]['create'](_0x4e6653[_0x65f6('0x2f')],{})['then'](function(_0x5edd04){var _0x71b16b=_0x4e6653[_0x65f6('0x30')][_0x65f6('0x31')]({'plain':!![]});if(!_0x71b16b)throw new Error(_0x65f6('0x32'));if(_0x71b16b[_0x65f6('0x33')]===_0x65f6('0x30')){var _0x1a55da=_0x5edd04[_0x65f6('0x31')]({'plain':!![]});var _0x4f933b=_0x65f6('0x34');return db['UserProfileSection'][_0x65f6('0x35')]({'where':{'name':_0x4f933b,'userProfileId':_0x71b16b[_0x65f6('0x36')]},'raw':!![]})[_0x65f6('0x13')](function(_0x2ea7f7){if(_0x2ea7f7&&_0x2ea7f7['autoAssociation']===0x0){return db[_0x65f6('0x14')][_0x65f6('0x2e')]({'name':_0x1a55da[_0x65f6('0x18')],'resourceId':_0x1a55da['id'],'type':_0x2ea7f7[_0x65f6('0x18')],'sectionId':_0x2ea7f7['id']},{})[_0x65f6('0x13')](function(){return _0x5edd04;});}else{return _0x5edd04;}})[_0x65f6('0x23')](function(_0xed4c96){logger[_0x65f6('0x37')](_0x65f6('0x38'),_0xed4c96);throw _0xed4c96;});}return _0x5edd04;})['then'](respondWithResult(_0x22d760,0xc9))[_0x65f6('0x23')](handleError(_0x22d760,null));};exports[_0x65f6('0x12')]=function(_0x377ae5,_0x181798){if(_0x377ae5[_0x65f6('0x2f')]['id']){delete _0x377ae5[_0x65f6('0x2f')]['id'];}return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x377ae5[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x181798,null))[_0x65f6('0x13')](saveUpdates(_0x377ae5[_0x65f6('0x2f')],null))[_0x65f6('0x13')](respondWithResult(_0x181798,null))[_0x65f6('0x23')](handleError(_0x181798,null));};exports[_0x65f6('0x15')]=function(_0x2cb38d,_0x5119ee){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x2cb38d[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x5119ee,null))['then'](removeEntity(_0x5119ee,null))[_0x65f6('0x23')](handleError(_0x5119ee,null));};exports[_0x65f6('0x39')]=function(_0x2b01eb,_0x5e69b4){return db[_0x65f6('0x1f')][_0x65f6('0x39')]()[_0x65f6('0x13')](respondWithResult(_0x5e69b4,null))[_0x65f6('0x23')](handleError(_0x5e69b4,null));};exports['getMembers']=function(_0x2ec114,_0x512527){var _0x3f1baa={'raw':!![],'where':{}},_0x6968b={},_0x577c93;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x2ec114[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x512527,null))[_0x65f6('0x13')](function(_0xc0db01){if(_0xc0db01){_0x577c93=_0xc0db01[_0x65f6('0x31')]({'plain':!![]});_0x6968b[_0x65f6('0x26')]=_['keys'](db['UserSmsQueue'][_0x65f6('0x3a')]);_0x6968b[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x2ec114[_0x65f6('0x21')]);_0x6968b[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x6968b[_0x65f6('0x26')],_0x6968b[_0x65f6('0x21')]);_0x3f1baa[_0x65f6('0x29')]=_['intersection'](_0x6968b[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x2ec114[_0x65f6('0x21')]['fields']));_0x3f1baa[_0x65f6('0x29')]=_0x3f1baa[_0x65f6('0x29')]['length']?_0x3f1baa[_0x65f6('0x29')]:_0x6968b[_0x65f6('0x26')];if(!_0x2ec114['query'][_0x65f6('0x3c')]('nolimit')){_0x3f1baa[_0x65f6('0xe')]=qs[_0x65f6('0xe')](_0x2ec114[_0x65f6('0x21')]['limit']);_0x3f1baa[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x2ec114['query'][_0x65f6('0xd')]);}_0x3f1baa[_0x65f6('0x3d')]=qs['sort'](_0x2ec114[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x3f1baa[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x2ec114[_0x65f6('0x21')],_0x6968b[_0x65f6('0x3b')]));_0x3f1baa[_0x65f6('0x1e')]['SmsQueueId']=_0xc0db01['id'];if(_0x2ec114['query']['filter']){_0x3f1baa[_0x65f6('0x1e')]=_[_0x65f6('0x2c')](_0x3f1baa[_0x65f6('0x1e')],{'$or':_[_0x65f6('0x40')](_0x3f1baa['attributes'],function(_0x183c08){var _0x2032b9={};_0x2032b9[_0x183c08]={'$like':'%'+_0x2ec114[_0x65f6('0x21')]['filter']+'%'};return _0x2032b9;})});}_0x3f1baa=_[_0x65f6('0x2c')]({},_0x3f1baa,_0x2ec114[_0x65f6('0x2d')]);return db[_0x65f6('0x41')]['findAll'](_0x3f1baa);}})['then'](function(_0x1d337d){if(_0x1d337d){return db[_0x65f6('0x42')][_0x65f6('0x43')]({'where':{'id':_[_0x65f6('0x40')](_0x1d337d,_0x65f6('0x44')),'role':_0x65f6('0x45')},'attributes':['id',_0x65f6('0x18'),_0x65f6('0x46'),_0x65f6('0x47'),_0x65f6('0x48')]});}})[_0x65f6('0x13')](function(_0x141fcc){if(_0x141fcc){return{'count':_0x141fcc[_0x65f6('0x10')],'rows':_[_0x65f6('0x40')](_0x141fcc['rows'],function(_0x47610a){return{'membername':_0x47610a[_0x65f6('0x18')],'UserId':_0x47610a['id'],'queue_name':_0x577c93[_0x65f6('0x18')],'SmsQueueId':_0x577c93['id'],'interface':util['format'](_0x65f6('0x49'),_0x65f6('0x4a'),_0x47610a[_0x65f6('0x18')]),'penalty':0x0,'paused':_0x47610a[_0x65f6('0x46')],'createdAt':_0x47610a['createdAt'],'updatedAt':_0x47610a[_0x65f6('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x65f6('0x13')](respondWithFilteredResult(_0x512527,_0x3f1baa))[_0x65f6('0x23')](handleError(_0x512527,null));};exports[_0x65f6('0x4b')]=function(_0x553ff0,_0x2923ff){var _0x2fc20f={};var _0x5c55e4={};var _0x28682b;var _0x26481e;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x553ff0[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x2923ff,null))[_0x65f6('0x13')](function(_0x3c23e3){if(_0x3c23e3){_0x28682b=_0x3c23e3;_0x5c55e4[_0x65f6('0x26')]=_[_0x65f6('0x27')](db['Team']['rawAttributes']);_0x5c55e4['query']=_[_0x65f6('0x27')](_0x553ff0[_0x65f6('0x21')]);_0x5c55e4[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],_0x5c55e4[_0x65f6('0x21')]);_0x2fc20f['attributes']=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],qs['fields'](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x2fc20f[_0x65f6('0x29')]=_0x2fc20f['attributes'][_0x65f6('0x4c')]?_0x2fc20f[_0x65f6('0x29')]:_0x5c55e4['model'];_0x2fc20f[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x2fc20f[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x553ff0['query'],_0x5c55e4['filters']));if(_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x2fc20f['where']=_[_0x65f6('0x2c')](_0x2fc20f['where'],{'$or':_[_0x65f6('0x40')](_0x2fc20f['attributes'],function(_0x440df1){var _0xdc8989={};_0xdc8989[_0x440df1]={'$like':'%'+_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0xdc8989;})});}_0x2fc20f=_[_0x65f6('0x2c')]({},_0x2fc20f,_0x553ff0[_0x65f6('0x2d')]);return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})[_0x65f6('0x13')](function(_0x2405a7){if(_0x2405a7){_0x26481e=_0x2405a7['length'];if(!_0x553ff0['query'][_0x65f6('0x3c')](_0x65f6('0x4e'))){_0x2fc20f[_0x65f6('0xe')]=qs['limit'](_0x553ff0['query'][_0x65f6('0xe')]);_0x2fc20f[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0xd')]);}return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})['then'](function(_0x4f42ae){if(_0x4f42ae){return _0x4f42ae?{'count':_0x26481e,'rows':_0x4f42ae}:null;}})[_0x65f6('0x13')](respondWithResult(_0x2923ff,null))[_0x65f6('0x23')](handleError(_0x2923ff,null));};exports['addTeams']=function(_0x219bf8,_0x4a8b60){var _0x254e9f=_0x219bf8[_0x65f6('0x2f')][_0x65f6('0x4f')];return db[_0x65f6('0x50')]['findAll']({'where':{'id':_0x254e9f},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id',_0x65f6('0x18'),'online','voicePause',_0x65f6('0x52')],'raw':!![]}]})['then'](function(_0x305967){if(_0x305967){var _0xf6de=_[_0x65f6('0x53')](_0x305967,function(_0x354b90){var _0x512776=_0x354b90['get']({'plain':!![]});return _0x512776['Agents'];});return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x219bf8[_0x65f6('0x25')]['id']}})['then'](function(_0x46cbde){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x49cee2){return _0x46cbde[_0x65f6('0x56')](_0x254e9f,{'transaction':_0x49cee2})[_0x65f6('0x13')](function(){return BPromise['each'](_0xf6de,function(_0x758e80){return db[_0x65f6('0x41')]['findOrCreate']({'where':{'UserId':_0x758e80['id'],'SmsQueueId':_0x219bf8[_0x65f6('0x25')]['id']},'transaction':_0x49cee2});});})['then'](function(){_0xf6de[_0x65f6('0x57')](function(_0x55ea91){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':_0x55ea91['id'],'SmsQueueId':_0x46cbde['id']});});});});});}})['then'](respondWithStatusCode(_0x4a8b60,null))[_0x65f6('0x23')](handleError(_0x4a8b60,null));};exports[_0x65f6('0x5a')]=function(_0x2a700b,_0x299b85){return db[_0x65f6('0x50')][_0x65f6('0x22')]({'where':{'id':_0x2a700b[_0x65f6('0x21')][_0x65f6('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id'],'raw':!![]}]})[_0x65f6('0x13')](handleEntityNotFound(_0x299b85,null))['then'](function(_0x10a661){var _0x1cf1bd=_[_0x65f6('0x40')](_0x10a661,'id');var _0x219e42=[];var _0x5694f9=[];var _0x453080=squel[_0x65f6('0x5b')]();_0x453080['field'](_0x65f6('0x5c'))['from'](_0x65f6('0x5d'),'tq')['join'](_0x65f6('0x5e'),'ut',_0x65f6('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x2a700b[_0x65f6('0x25')]['id']);for(var _0x413c21=0x0;_0x413c21<_0x10a661['length'];_0x413c21+=0x1){let _0x2d86c8=_0x10a661[_0x413c21];for(var _0x3b3bd5=0x0;_0x3b3bd5<_0x2d86c8[_0x65f6('0x51')]['length'];_0x3b3bd5+=0x1){let _0x1348ec=_0x2d86c8[_0x65f6('0x51')][_0x3b3bd5];var _0x5889dc=_0x453080[_0x65f6('0x60')]();_0x5889dc['where'](_0x65f6('0x61'),_0x1348ec['id']);_0x5694f9['push'](db['sequelize'][_0x65f6('0x21')](_0x5889dc[_0x65f6('0x62')](),{'type':db[_0x65f6('0x54')][_0x65f6('0x63')][_0x65f6('0x64')]})[_0x65f6('0x13')](function(_0x1ac46f){if(_0x1ac46f[_0x65f6('0x4c')]===0x1){return _0x1348ec['id'];}else{var _0x4d66fe=_['every'](_[_0x65f6('0x40')](_0x1ac46f,'TeamId'),function(_0x1ee28a){return _[_0x65f6('0x65')](_0x1cf1bd,_0x1ee28a);});if(_0x4d66fe){return _0x1348ec['id'];}}}));}}return BPromise[_0x65f6('0x66')](_0x5694f9)[_0x65f6('0x13')](function(_0x43127b){_0x219e42=_(_0x219e42)['union'](_0x43127b)[_0x65f6('0x67')]()[_0x65f6('0x68')]();return db[_0x65f6('0x1f')]['find']({'where':{'id':_0x2a700b[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](function(_0x4254c2){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x16bf93){return _0x4254c2['removeTeams'](_0x2a700b['query'][_0x65f6('0x4f')],{'transaction':_0x16bf93})[_0x65f6('0x13')](function(){if(!_[_0x65f6('0x69')](_0x219e42)){return _0x4254c2[_0x65f6('0x6a')](_0x219e42,{'transaction':_0x16bf93});}})['then'](function(){_0x219e42['forEach'](function(_0x336076){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':_0x336076,'SmsQueueId':_0x4254c2['id']});});});});});});})[_0x65f6('0x13')](respondWithStatusCode(_0x299b85,null))[_0x65f6('0x23')](handleError(_0x299b85,null));};exports[_0x65f6('0x6c')]=function(_0x5daaf4,_0x4d607a){return db['SmsQueue'][_0x65f6('0x35')]({'where':{'id':_0x5daaf4[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x4d607a,null))[_0x65f6('0x13')](function(_0x53b11c){if(_0x53b11c){return _0x53b11c['addAgents'](_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')],_['omit'](_0x5daaf4[_0x65f6('0x2f')],['ids','id'])||{})[_0x65f6('0x6d')](function(_0x4f3ef8){for(var _0x3a30ed=0x0;_0x3a30ed<_0x5daaf4[_0x65f6('0x2f')]['ids'][_0x65f6('0x4c')];_0x3a30ed+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':Number(_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')][_0x3a30ed]),'SmsQueueId':Number(_0x5daaf4[_0x65f6('0x25')]['id'])});}return _0x4f3ef8;});}})['then'](respondWithResult(_0x4d607a,null))[_0x65f6('0x23')](handleError(_0x4d607a,null));};exports['removeAgents']=function(_0x24495c,_0x56336a){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x24495c[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x56336a,null))['then'](function(_0x2b6f98){if(_0x2b6f98){return _0x2b6f98[_0x65f6('0x6a')](_0x24495c[_0x65f6('0x21')]['ids'])['then'](function(){if(_[_0x65f6('0x6e')](_0x24495c[_0x65f6('0x21')]['ids'])){for(var _0x180cde=0x0;_0x180cde<_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]['length'];_0x180cde+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':Number(_0x24495c['query'][_0x65f6('0x4f')][_0x180cde]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}}else{socket[_0x65f6('0x58')]('userSmsQueue:remove',{'UserId':Number(_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}});}})['then'](respondWithStatusCode(_0x56336a,null))[_0x65f6('0x23')](handleError(_0x56336a,null));};exports['getAgents']=function(_0x1beaa7,_0x87a9e4){var _0x31ec61={};var _0x22be6e={};var _0x29b2de;var _0x430fb8;return db['SmsQueue'][_0x65f6('0x6f')]({'where':{'id':_0x1beaa7[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x87a9e4,null))[_0x65f6('0x13')](function(_0x207d15){if(_0x207d15){_0x29b2de=_0x207d15;_0x22be6e['model']=_['keys'](db['User'][_0x65f6('0x3a')]);_0x22be6e[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x1beaa7['query']);_0x22be6e[_0x65f6('0x3b')]=_['intersection'](_0x22be6e['model'],_0x22be6e[_0x65f6('0x21')]);_0x31ec61[_0x65f6('0x29')]=_['intersection'](_0x22be6e[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x31ec61[_0x65f6('0x29')]=_0x31ec61[_0x65f6('0x29')][_0x65f6('0x4c')]?_0x31ec61[_0x65f6('0x29')]:_0x22be6e[_0x65f6('0x26')];_0x31ec61[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x1beaa7[_0x65f6('0x21')]['sort']);_0x31ec61[_0x65f6('0x1e')]=qs['filters'](_['pick'](_0x1beaa7[_0x65f6('0x21')],_0x22be6e[_0x65f6('0x3b')]));if(_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x31ec61['where']=_[_0x65f6('0x2c')](_0x31ec61['where'],{'$or':_['map'](_0x31ec61[_0x65f6('0x29')],function(_0x99fe6e){var _0x1a7e52={};_0x1a7e52[_0x99fe6e]={'$like':'%'+_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0x1a7e52;})});}_0x31ec61=_[_0x65f6('0x2c')]({},_0x31ec61,_0x1beaa7['options']);return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})['then'](function(_0x1ef2a0){if(_0x1ef2a0){_0x430fb8=_0x1ef2a0[_0x65f6('0x4c')];if(!_0x1beaa7[_0x65f6('0x21')]['hasOwnProperty'](_0x65f6('0x4e'))){_0x31ec61['limit']=qs['limit'](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0xe')]);_0x31ec61[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x1beaa7[_0x65f6('0x21')]['offset']);}return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})[_0x65f6('0x13')](function(_0x3bebe3){if(_0x3bebe3){return _0x3bebe3?{'count':_0x430fb8,'rows':_0x3bebe3}:null;}})[_0x65f6('0x13')](respondWithResult(_0x87a9e4,null))['catch'](handleError(_0x87a9e4,null));}; \ No newline at end of file +var _0x0b0e=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','SmsQueues','destroy','then','error','stack','name','send','SmsQueue','fieldName','type','key','getOptions','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','nolimit','order','sort','where','SmsQueueId','filter','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','pick','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x0b0e,0x187));var _0xe0b0=function(_0x249e96,_0x3ea39d){_0x249e96=_0x249e96-0x0;var _0x17444c=_0x0b0e[_0x249e96];return _0x17444c;};'use strict';var BPromise=require(_0xe0b0('0x0'));var util=require('util');var _=require(_0xe0b0('0x1'));var squel=require('squel');var Redis=require(_0xe0b0('0x2'));var qs=require(_0xe0b0('0x3'));var logger=require(_0xe0b0('0x4'))(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var db=require(_0xe0b0('0x7'))['db'];config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config[_0xe0b0('0x8')],{'host':_0xe0b0('0xa'),'port':0x18eb});var socket=require(_0xe0b0('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe0b0('0xc')](socket);function respondWithStatusCode(_0x435060,_0xc4a085){_0xc4a085=_0xc4a085||0xcc;return function(_0x2ac27e){if(_0x2ac27e){return _0x435060['sendStatus'](_0xc4a085);}return _0x435060[_0xe0b0('0xd')](_0xc4a085)[_0xe0b0('0xe')]();};}function respondWithResult(_0x553d4f,_0x1fef28){_0x1fef28=_0x1fef28||0xc8;return function(_0x2f32b6){if(_0x2f32b6){return _0x553d4f['status'](_0x1fef28)[_0xe0b0('0xf')](_0x2f32b6);}};}function respondWithFilteredResult(_0x2cdad2,_0x39b1c2){return function(_0x585615){if(_0x585615){var _0x3068c0=typeof _0x39b1c2[_0xe0b0('0x10')]===_0xe0b0('0x11')&&typeof _0x39b1c2[_0xe0b0('0x12')]===_0xe0b0('0x11');var _0x4d2bf7=_0x585615[_0xe0b0('0x13')];var _0x154de6=_0x3068c0?0x0:_0x39b1c2[_0xe0b0('0x10')];var _0x24babd=_0x3068c0?_0x585615[_0xe0b0('0x13')]:_0x39b1c2['offset']+_0x39b1c2[_0xe0b0('0x12')];var _0x5adb01;if(_0x24babd>=_0x4d2bf7){_0x24babd=_0x4d2bf7;_0x5adb01=0xc8;}else{_0x5adb01=0xce;}_0x2cdad2[_0xe0b0('0xd')](_0x5adb01);return _0x2cdad2[_0xe0b0('0x14')]('Content-Range',_0x154de6+'-'+_0x24babd+'/'+_0x4d2bf7)[_0xe0b0('0xf')](_0x585615);}return null;};}function saveUpdates(_0x4a4cc0){return function(_0x2d6fb6){if(_0x2d6fb6){return _0x2d6fb6[_0xe0b0('0x15')](_0x4a4cc0)['then'](function(_0x54a3eb){return _0x54a3eb;});}return null;};}function removeEntity(_0x46bb44){return function(_0x50a441){if(_0x50a441){return _0x50a441['destroy']()['then'](function(){var _0x1920ee=_0x50a441['get']({'plain':!![]});var _0x52598b=_0xe0b0('0x16');return db['UserProfileResource'][_0xe0b0('0x17')]({'where':{'type':_0x52598b,'resourceId':_0x1920ee['id']}})['then'](function(){return _0x50a441;});})[_0xe0b0('0x18')](function(){_0x46bb44[_0xe0b0('0xd')](0xcc)[_0xe0b0('0xe')]();});}};}function handleEntityNotFound(_0x310a6d){return function(_0x2cf6a1){if(!_0x2cf6a1){_0x310a6d['sendStatus'](0x194);}return _0x2cf6a1;};}function handleError(_0x4cae54,_0x2fa820){_0x2fa820=_0x2fa820||0x1f4;return function(_0x5512bb){logger[_0xe0b0('0x19')](_0x5512bb[_0xe0b0('0x1a')]);if(_0x5512bb['name']){delete _0x5512bb[_0xe0b0('0x1b')];}_0x4cae54['status'](_0x2fa820)[_0xe0b0('0x1c')](_0x5512bb);};}exports['index']=function(_0x28586d,_0x576352){var _0x3e5c88={};var _0x4de537={'count':0x0,'rows':[]};var _0x4700cc=_['map'](db[_0xe0b0('0x1d')]['rawAttributes'],function(_0x362aba){return{'name':_0x362aba[_0xe0b0('0x1e')],'type':_0x362aba[_0xe0b0('0x1f')][_0xe0b0('0x20')]};});_0x3e5c88=qs[_0xe0b0('0x21')](_0x4700cc,_0x28586d);var _0x10745d={'where':_0x3e5c88['where']};return db[_0xe0b0('0x1d')][_0xe0b0('0x13')](_0x10745d)['then'](function(_0x15e13b){_0x4de537[_0xe0b0('0x13')]=_0x15e13b;_0x3e5c88[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x28586d[_0xe0b0('0x23')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x24')](_0x3e5c88);})['then'](function(_0x1854b8){_0x4de537[_0xe0b0('0x25')]=_0x1854b8;return _0x4de537;})['then'](respondWithFilteredResult(_0x576352,_0x3e5c88))['catch'](handleError(_0x576352,null));};exports[_0xe0b0('0x26')]=function(_0x33e672,_0x422575){var _0x3f81d5={'raw':!![],'where':{'id':_0x33e672['params']['id']}},_0x2ab1b1={};_0x2ab1b1[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db[_0xe0b0('0x1d')][_0xe0b0('0x29')]);_0x2ab1b1[_0xe0b0('0x23')]=_['keys'](_0x33e672[_0xe0b0('0x23')]);_0x2ab1b1[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],_0x2ab1b1[_0xe0b0('0x23')]);_0x3f81d5[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3f81d5[_0xe0b0('0x2c')]=_0x3f81d5[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x3f81d5[_0xe0b0('0x2c')]:_0x2ab1b1['model'];if(_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2f')]){_0x3f81d5[_0xe0b0('0x22')]=[{'all':!![]}];}_0x3f81d5=_[_0xe0b0('0x30')]({},_0x3f81d5,_0x33e672[_0xe0b0('0x31')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x32')](_0x3f81d5)['then'](handleEntityNotFound(_0x422575,null))['then'](respondWithResult(_0x422575,null))['catch'](handleError(_0x422575,null));};exports['create']=function(_0x26137c,_0xc3d967){return db[_0xe0b0('0x1d')]['create'](_0x26137c[_0xe0b0('0x33')],{})[_0xe0b0('0x18')](function(_0x1cd705){var _0x297c64=_0x26137c['user'][_0xe0b0('0x34')]({'plain':!![]});if(!_0x297c64)throw new Error(_0xe0b0('0x35'));if(_0x297c64[_0xe0b0('0x36')]===_0xe0b0('0x37')){var _0x4265e3=_0x1cd705[_0xe0b0('0x34')]({'plain':!![]});var _0x8b745=_0xe0b0('0x16');return db[_0xe0b0('0x38')]['find']({'where':{'name':_0x8b745,'userProfileId':_0x297c64[_0xe0b0('0x39')]},'raw':!![]})['then'](function(_0x34178d){if(_0x34178d&&_0x34178d[_0xe0b0('0x3a')]===0x0){return db[_0xe0b0('0x3b')][_0xe0b0('0x3c')]({'name':_0x4265e3['name'],'resourceId':_0x4265e3['id'],'type':_0x34178d[_0xe0b0('0x1b')],'sectionId':_0x34178d['id']},{})[_0xe0b0('0x18')](function(){return _0x1cd705;});}else{return _0x1cd705;}})[_0xe0b0('0x3d')](function(_0x402a0e){logger[_0xe0b0('0x19')](_0xe0b0('0x3e'),_0x402a0e);throw _0x402a0e;});}return _0x1cd705;})[_0xe0b0('0x18')](respondWithResult(_0xc3d967,0xc9))[_0xe0b0('0x3d')](handleError(_0xc3d967,null));};exports['update']=function(_0x2aad80,_0x309bbf){if(_0x2aad80['body']['id']){delete _0x2aad80['body']['id'];}return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x2aad80['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x309bbf,null))[_0xe0b0('0x18')](saveUpdates(_0x2aad80[_0xe0b0('0x33')],null))[_0xe0b0('0x18')](respondWithResult(_0x309bbf,null))[_0xe0b0('0x3d')](handleError(_0x309bbf,null));};exports['destroy']=function(_0x5d2fa2,_0x51c580){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x5d2fa2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x51c580,null))[_0xe0b0('0x18')](removeEntity(_0x51c580,null))[_0xe0b0('0x3d')](handleError(_0x51c580,null));};exports[_0xe0b0('0x3f')]=function(_0x16ccca,_0x5c6f94){return db['SmsQueue'][_0xe0b0('0x3f')]()[_0xe0b0('0x18')](respondWithResult(_0x5c6f94,null))[_0xe0b0('0x3d')](handleError(_0x5c6f94,null));};exports[_0xe0b0('0x40')]=function(_0x1bf77d,_0x575c7d){var _0x3b1474={'raw':!![],'where':{}},_0x11d4fd={},_0x534340;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf77d[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x575c7d,null))[_0xe0b0('0x18')](function(_0x364877){if(_0x364877){_0x534340=_0x364877['get']({'plain':!![]});_0x11d4fd[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db['UserSmsQueue']['rawAttributes']);_0x11d4fd[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x1bf77d['query']);_0x11d4fd[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x11d4fd['model'],_0x11d4fd['query']);_0x3b1474[_0xe0b0('0x2c')]=_['intersection'](_0x11d4fd[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3b1474[_0xe0b0('0x2c')]=_0x3b1474[_0xe0b0('0x2c')]['length']?_0x3b1474['attributes']:_0x11d4fd[_0xe0b0('0x27')];if(!_0x1bf77d['query']['hasOwnProperty'](_0xe0b0('0x42'))){_0x3b1474[_0xe0b0('0x12')]=qs['limit'](_0x1bf77d['query'][_0xe0b0('0x12')]);_0x3b1474[_0xe0b0('0x10')]=qs[_0xe0b0('0x10')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x10')]);}_0x3b1474[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x1bf77d['query'][_0xe0b0('0x44')]);_0x3b1474['where']=qs[_0xe0b0('0x2a')](_['pick'](_0x1bf77d['query'],_0x11d4fd[_0xe0b0('0x2a')]));_0x3b1474[_0xe0b0('0x45')][_0xe0b0('0x46')]=_0x364877['id'];if(_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x3b1474[_0xe0b0('0x45')]=_[_0xe0b0('0x30')](_0x3b1474[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x3b1474['attributes'],function(_0x253ab0){var _0x57ccc9={};_0x57ccc9[_0x253ab0]={'$like':'%'+_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x57ccc9;})});}_0x3b1474=_[_0xe0b0('0x30')]({},_0x3b1474,_0x1bf77d[_0xe0b0('0x31')]);return db[_0xe0b0('0x49')][_0xe0b0('0x24')](_0x3b1474);}})['then'](function(_0x1a057c){if(_0x1a057c){return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'id':_[_0xe0b0('0x48')](_0x1a057c,_0xe0b0('0x4c')),'role':_0xe0b0('0x4d')},'attributes':['id',_0xe0b0('0x1b'),_0xe0b0('0x4e'),_0xe0b0('0x4f'),_0xe0b0('0x50')]});}})[_0xe0b0('0x18')](function(_0x18ab99){if(_0x18ab99){return{'count':_0x18ab99[_0xe0b0('0x13')],'rows':_[_0xe0b0('0x48')](_0x18ab99[_0xe0b0('0x25')],function(_0x34c642){return{'membername':_0x34c642[_0xe0b0('0x1b')],'UserId':_0x34c642['id'],'queue_name':_0x534340[_0xe0b0('0x1b')],'SmsQueueId':_0x534340['id'],'interface':util['format'](_0xe0b0('0x51'),_0xe0b0('0x52'),_0x34c642[_0xe0b0('0x1b')]),'penalty':0x0,'paused':_0x34c642[_0xe0b0('0x4e')],'createdAt':_0x34c642[_0xe0b0('0x50')],'updatedAt':_0x34c642[_0xe0b0('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x18')](respondWithFilteredResult(_0x575c7d,_0x3b1474))['catch'](handleError(_0x575c7d,null));};exports['getTeams']=function(_0x139014,_0x2a0415){var _0x157556={};var _0x47ecc1={};var _0x117d20;var _0x13fb4b;return db[_0xe0b0('0x1d')][_0xe0b0('0x53')]({'where':{'id':_0x139014[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0415,null))[_0xe0b0('0x18')](function(_0x242120){if(_0x242120){_0x117d20=_0x242120;_0x47ecc1[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x54')][_0xe0b0('0x29')]);_0x47ecc1['query']=_[_0xe0b0('0x28')](_0x139014['query']);_0x47ecc1['filters']=_[_0xe0b0('0x2b')](_0x47ecc1['model'],_0x47ecc1['query']);_0x157556[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x47ecc1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x139014['query'][_0xe0b0('0x2d')]));_0x157556[_0xe0b0('0x2c')]=_0x157556[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x157556[_0xe0b0('0x2c')]:_0x47ecc1[_0xe0b0('0x27')];_0x157556[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x139014['query']['sort']);_0x157556[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x139014['query'],_0x47ecc1['filters']));if(_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x157556['where']=_['merge'](_0x157556[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x157556[_0xe0b0('0x2c')],function(_0x29175a){var _0x3b263f={};_0x3b263f[_0x29175a]={'$like':'%'+_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3b263f;})});}_0x157556=_[_0xe0b0('0x30')]({},_0x157556,_0x139014['options']);return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0x1673bc){if(_0x1673bc){_0x13fb4b=_0x1673bc['length'];if(!_0x139014['query']['hasOwnProperty']('nolimit')){_0x157556['limit']=qs['limit'](_0x139014[_0xe0b0('0x23')]['limit']);_0x157556['offset']=qs[_0xe0b0('0x10')](_0x139014[_0xe0b0('0x23')][_0xe0b0('0x10')]);}return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0xd0629e){if(_0xd0629e){return _0xd0629e?{'count':_0x13fb4b,'rows':_0xd0629e}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x2a0415,null))[_0xe0b0('0x3d')](handleError(_0x2a0415,null));};exports['addTeams']=function(_0x3097fb,_0x5da8fd){var _0x86e90=_0x3097fb[_0xe0b0('0x33')][_0xe0b0('0x57')];return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x86e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x58'),'attributes':['id','name',_0xe0b0('0x59'),_0xe0b0('0x5a'),_0xe0b0('0x5b')],'raw':!![]}]})[_0xe0b0('0x18')](function(_0x4a78f8){if(_0x4a78f8){var _0x311f79=_[_0xe0b0('0x5c')](_0x4a78f8,function(_0x49deef){var _0x4cf60a=_0x49deef[_0xe0b0('0x34')]({'plain':!![]});return _0x4cf60a[_0xe0b0('0x58')];});return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x3097fb[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](function(_0x34f4ff){return db[_0xe0b0('0x5d')][_0xe0b0('0x5e')](function(_0x24571b){return _0x34f4ff['addTeams'](_0x86e90,{'transaction':_0x24571b})['then'](function(){return BPromise[_0xe0b0('0x5f')](_0x311f79,function(_0x4880d5){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4880d5['id'],'SmsQueueId':_0x3097fb['params']['id']},'transaction':_0x24571b});});})[_0xe0b0('0x18')](function(){_0x311f79['forEach'](function(_0x654d2b){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':_0x654d2b['id'],'SmsQueueId':_0x34f4ff['id']});});});});});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x5da8fd,null))['catch'](handleError(_0x5da8fd,null));};exports[_0xe0b0('0x62')]=function(_0x948708,_0x5a0817){return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')]},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0817,null))['then'](function(_0x545694){var _0x5c258b=_[_0xe0b0('0x48')](_0x545694,'id');var _0x567e1a=[];var _0x3c09af=[];var _0x5f4aaf=squel[_0xe0b0('0x63')]();_0x5f4aaf[_0xe0b0('0x64')](_0xe0b0('0x65'))[_0xe0b0('0x66')](_0xe0b0('0x67'),'tq')[_0xe0b0('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948708[_0xe0b0('0x41')]['id']);for(var _0x261381=0x0;_0x261381<_0x545694[_0xe0b0('0x2e')];_0x261381+=0x1){let _0x4377f7=_0x545694[_0x261381];for(var _0x2c1149=0x0;_0x2c1149<_0x4377f7['Agents'][_0xe0b0('0x2e')];_0x2c1149+=0x1){let _0x39a07b=_0x4377f7[_0xe0b0('0x58')][_0x2c1149];var _0xc6090e=_0x5f4aaf[_0xe0b0('0x69')]();_0xc6090e[_0xe0b0('0x45')](_0xe0b0('0x6a'),_0x39a07b['id']);_0x3c09af[_0xe0b0('0x6b')](db[_0xe0b0('0x5d')]['query'](_0xc6090e['toString'](),{'type':db[_0xe0b0('0x5d')][_0xe0b0('0x6c')]['SELECT']})[_0xe0b0('0x18')](function(_0x4593f1){if(_0x4593f1[_0xe0b0('0x2e')]===0x1){return _0x39a07b['id'];}else{var _0x3fcffd=_[_0xe0b0('0x6d')](_[_0xe0b0('0x48')](_0x4593f1,_0xe0b0('0x6e')),function(_0xc8eba3){return _['includes'](_0x5c258b,_0xc8eba3);});if(_0x3fcffd){return _0x39a07b['id'];}}}));}}return BPromise['all'](_0x3c09af)['then'](function(_0xc19743){_0x567e1a=_(_0x567e1a)[_0xe0b0('0x6f')](_0xc19743)['compact']()[_0xe0b0('0x70')]();return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x948708[_0xe0b0('0x41')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x5e')](function(_0x266835){return _0x56c4b9['removeTeams'](_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')],{'transaction':_0x266835})['then'](function(){if(!_['isEmpty'](_0x567e1a)){return _0x56c4b9[_0xe0b0('0x71')](_0x567e1a,{'transaction':_0x266835});}})['then'](function(){_0x567e1a[_0xe0b0('0x72')](function(_0x5f06c0){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':_0x5f06c0,'SmsQueueId':_0x56c4b9['id']});});});});});});})[_0xe0b0('0x18')](respondWithStatusCode(_0x5a0817,null))[_0xe0b0('0x3d')](handleError(_0x5a0817,null));};exports[_0xe0b0('0x74')]=function(_0x1ec7c2,_0x434dfa){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x1ec7c2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x434dfa,null))[_0xe0b0('0x18')](function(_0x2b40eb){if(_0x2b40eb){return _0x2b40eb['addAgents'](_0x1ec7c2[_0xe0b0('0x33')]['ids'],_[_0xe0b0('0x75')](_0x1ec7c2[_0xe0b0('0x33')],['ids','id'])||{})[_0xe0b0('0x76')](function(_0x4e4b45){for(var _0x528932=0x0;_0x528932<_0x1ec7c2[_0xe0b0('0x33')]['ids']['length'];_0x528932+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':Number(_0x1ec7c2[_0xe0b0('0x33')][_0xe0b0('0x57')][_0x528932]),'SmsQueueId':Number(_0x1ec7c2[_0xe0b0('0x41')]['id'])});}return _0x4e4b45;});}})[_0xe0b0('0x18')](respondWithResult(_0x434dfa,null))['catch'](handleError(_0x434dfa,null));};exports[_0xe0b0('0x71')]=function(_0x4609d5,_0x421b3b){return db['SmsQueue'][_0xe0b0('0x32')]({'where':{'id':_0x4609d5[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x421b3b,null))['then'](function(_0x33f89a){if(_0x33f89a){return _0x33f89a['removeAgents'](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])[_0xe0b0('0x18')](function(){if(_[_0xe0b0('0x77')](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])){for(var _0x3d70d7=0x0;_0x3d70d7<_0x4609d5['query'][_0xe0b0('0x57')][_0xe0b0('0x2e')];_0x3d70d7+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')]['ids'][_0x3d70d7]),'SmsQueueId':Number(_0x4609d5['params']['id'])});}}else{socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')]),'SmsQueueId':Number(_0x4609d5[_0xe0b0('0x41')]['id'])});}});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x421b3b,null))[_0xe0b0('0x3d')](handleError(_0x421b3b,null));};exports[_0xe0b0('0x78')]=function(_0x932e,_0x1b3f4d){var _0x4fe048={};var _0xac45e6={};var _0x401c4b;var _0x3e18a3;return db[_0xe0b0('0x1d')]['findOne']({'where':{'id':_0x932e[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x1b3f4d,null))[_0xe0b0('0x18')](function(_0x116c16){if(_0x116c16){_0x401c4b=_0x116c16;_0xac45e6[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x4a')]['rawAttributes']);_0xac45e6[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x932e[_0xe0b0('0x23')]);_0xac45e6[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0xac45e6['model'],_0xac45e6['query']);_0x4fe048[_0xe0b0('0x2c')]=_['intersection'](_0xac45e6[_0xe0b0('0x27')],qs['fields'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x4fe048[_0xe0b0('0x2c')]=_0x4fe048[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x4fe048[_0xe0b0('0x2c')]:_0xac45e6[_0xe0b0('0x27')];_0x4fe048['order']=qs['sort'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x44')]);_0x4fe048[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x932e[_0xe0b0('0x23')],_0xac45e6[_0xe0b0('0x2a')]));if(_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x4fe048[_0xe0b0('0x45')]=_['merge'](_0x4fe048['where'],{'$or':_[_0xe0b0('0x48')](_0x4fe048[_0xe0b0('0x2c')],function(_0x187465){var _0x3f9e6b={};_0x3f9e6b[_0x187465]={'$like':'%'+_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3f9e6b;})});}_0x4fe048=_[_0xe0b0('0x30')]({},_0x4fe048,_0x932e['options']);return _0x401c4b['getAgents'](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x1ea4d5){if(_0x1ea4d5){_0x3e18a3=_0x1ea4d5[_0xe0b0('0x2e')];if(!_0x932e[_0xe0b0('0x23')][_0xe0b0('0x79')](_0xe0b0('0x42'))){_0x4fe048[_0xe0b0('0x12')]=qs[_0xe0b0('0x12')](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x12')]);_0x4fe048['offset']=qs[_0xe0b0('0x10')](_0x932e[_0xe0b0('0x23')]['offset']);}return _0x401c4b[_0xe0b0('0x78')](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x3615f9){if(_0x3615f9){return _0x3615f9?{'count':_0x3e18a3,'rows':_0x3615f9}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x1b3f4d,null))[_0xe0b0('0x3d')](handleError(_0x1b3f4d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index ffa7b5d..4b9df90 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 _0x84de=['exports','events','../../mysqldb','SmsQueue','update','remove','emit'];(function(_0x3fba97,_0x48a0d3){var _0x32e110=function(_0x177f01){while(--_0x177f01){_0x3fba97['push'](_0x3fba97['shift']());}};_0x32e110(++_0x48a0d3);}(_0x84de,0x94));var _0xe84d=function(_0x36da2a,_0x139b77){_0x36da2a=_0x36da2a-0x0;var _0x457b21=_0x84de[_0x36da2a];return _0x457b21;};'use strict';var EventEmitter=require(_0xe84d('0x0'));var SmsQueue=require(_0xe84d('0x1'))['db'][_0xe84d('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe84d('0x3'),'afterDestroy':_0xe84d('0x4')};function emitEvent(_0x45e2c4){return function(_0x2bf62f,_0x42cbda,_0x3e919a){SmsQueueEvents['emit'](_0x45e2c4+':'+_0x2bf62f['id'],_0x2bf62f);SmsQueueEvents[_0xe84d('0x5')](_0x45e2c4,_0x2bf62f);_0x3e919a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xe84d('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0x4a51=['SmsQueue','save','update','emit','events','../../mysqldb'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x4a51,0x14e));var _0x14a5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4a51[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x14a5('0x0'));var SmsQueue=require(_0x14a5('0x1'))['db'][_0x14a5('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x14a5('0x3'),'afterUpdate':_0x14a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0xfad8b3){return function(_0x37f29d,_0x51ab5f,_0x57065a){SmsQueueEvents[_0x14a5('0x5')](_0xfad8b3+':'+_0x37f29d['id'],_0x37f29d);SmsQueueEvents['emit'](_0xfad8b3,_0x37f29d);_0x57065a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index c035d31..4ee883e 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 _0x8d74=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues'];(function(_0x40cbd7,_0x35ee47){var _0x3caf4f=function(_0x50b87a){while(--_0x50b87a){_0x40cbd7['push'](_0x40cbd7['shift']());}};_0x3caf4f(++_0x35ee47);}(_0x8d74,0x1e0));var _0x48d7=function(_0x435b2f,_0x49be4e){_0x435b2f=_0x435b2f-0x0;var _0x1a78a9=_0x8d74[_0x435b2f];return _0x1a78a9;};'use strict';var _=require('lodash');var util=require(_0x48d7('0x0'));var logger=require(_0x48d7('0x1'))('api');var moment=require(_0x48d7('0x2'));var BPromise=require(_0x48d7('0x3'));var rp=require(_0x48d7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x48d7('0x5'));var config=require(_0x48d7('0x6'));var attributes=require(_0x48d7('0x7'));module[_0x48d7('0x8')]=function(_0x297aa8,_0x3f24f4){return _0x297aa8[_0x48d7('0x9')](_0x48d7('0xa'),attributes,{'tableName':_0x48d7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x101a=['define','SmsQueue','sms_queues','lodash','util','api','request-promise','rimraf','./smsQueue.attributes'];(function(_0x4d0c49,_0x56e5fe){var _0x45262a=function(_0x234a14){while(--_0x234a14){_0x4d0c49['push'](_0x4d0c49['shift']());}};_0x45262a(++_0x56e5fe);}(_0x101a,0x162));var _0xa101=function(_0x1d88c4,_0x563728){_0x1d88c4=_0x1d88c4-0x0;var _0x2c2f36=_0x101a[_0x1d88c4];return _0x2c2f36;};'use strict';var _=require(_0xa101('0x0'));var util=require(_0xa101('0x1'));var logger=require('../../config/logger')(_0xa101('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa101('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa101('0x4'));var config=require('../../config/environment');var attributes=require(_0xa101('0x5'));module['exports']=function(_0x21fc3,_0x2245b3){return _0x21fc3[_0xa101('0x6')](_0xa101('0x7'),attributes,{'tableName':_0xa101('0x8'),'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 34dda4e..7803d21 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 _0x79cc=['find','ShowSmsQueue','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','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','options','where','attributes','limit','include','model','map','GetSmsQueue'];(function(_0x4f1c19,_0x26d41b){var _0x220fb8=function(_0xc1240a){while(--_0xc1240a){_0x4f1c19['push'](_0x4f1c19['shift']());}};_0x220fb8(++_0x26d41b);}(_0x79cc,0x15b));var _0xc79c=function(_0x4fde87,_0x2f8f7c){_0x4fde87=_0x4fde87-0x0;var _0x5ae112=_0x79cc[_0x4fde87];return _0x5ae112;};'use strict';var _=require(_0xc79c('0x0'));var util=require(_0xc79c('0x1'));var moment=require(_0xc79c('0x2'));var BPromise=require(_0xc79c('0x3'));var rs=require(_0xc79c('0x4'));var fs=require('fs');var Redis=require(_0xc79c('0x5'));var db=require(_0xc79c('0x6'))['db'];var utils=require(_0xc79c('0x7'));var logger=require(_0xc79c('0x8'))('rpc');var config=require(_0xc79c('0x9'));var jayson=require(_0xc79c('0xa'));var client=jayson[_0xc79c('0xb')][_0xc79c('0xc')]({'port':0x232a});config['redis']=_[_0xc79c('0xd')](config[_0xc79c('0xe')],{'host':_0xc79c('0xf'),'port':0x18eb});var socket=require(_0xc79c('0x10'))(new Redis(config[_0xc79c('0xe')]));require(_0xc79c('0x11'))[_0xc79c('0x12')](socket);function respondWithRpcPromise(_0x21a73a,_0x495747,_0x486600){return new BPromise(function(_0x19ab6e,_0x4be2c9){return client[_0xc79c('0x13')](_0x21a73a,_0x486600)[_0xc79c('0x14')](function(_0x556793){logger[_0xc79c('0x15')](_0xc79c('0x16'),_0x495747,_0xc79c('0x17'));logger[_0xc79c('0x18')](_0xc79c('0x19'),_0x495747,_0xc79c('0x17'),JSON[_0xc79c('0x1a')](_0x556793));if(_0x556793[_0xc79c('0x1b')]){if(_0x556793['error'][_0xc79c('0x1c')]===0x1f4){logger['error'](_0xc79c('0x16'),_0x495747,_0x556793[_0xc79c('0x1b')][_0xc79c('0x1d')]);return _0x4be2c9(_0x556793[_0xc79c('0x1b')][_0xc79c('0x1d')]);}logger['error'](_0xc79c('0x16'),_0x495747,_0x556793[_0xc79c('0x1b')][_0xc79c('0x1d')]);return _0x19ab6e(_0x556793[_0xc79c('0x1b')][_0xc79c('0x1d')]);}else{logger['info'](_0xc79c('0x16'),_0x495747,_0xc79c('0x17'));_0x19ab6e(_0x556793[_0xc79c('0x1e')]['message']);}})['catch'](function(_0x546c87){logger[_0xc79c('0x1b')](_0xc79c('0x16'),_0x495747,_0x546c87);_0x4be2c9(_0x546c87);});});}exports['GetSmsQueue']=function(_0x3e4b93){var _0x3870ab=this;return new Promise(function(_0x2b3822,_0x3ec40a){return db[_0xc79c('0x1f')]['findAll']({'raw':_0x3e4b93[_0xc79c('0x20')]?_0x3e4b93[_0xc79c('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x3e4b93[_0xc79c('0x20')]?_0x3e4b93[_0xc79c('0x20')][_0xc79c('0x21')]||null:null,'attributes':_0x3e4b93['options']?_0x3e4b93['options'][_0xc79c('0x22')]||null:null,'limit':_0x3e4b93[_0xc79c('0x20')]?_0x3e4b93['options'][_0xc79c('0x23')]||null:null,'include':_0x3e4b93['options']?_0x3e4b93[_0xc79c('0x20')][_0xc79c('0x24')]?_['map'](_0x3e4b93['options'][_0xc79c('0x24')],function(_0x22d1d8){return{'model':db[_0x22d1d8[_0xc79c('0x25')]],'as':_0x22d1d8['as'],'attributes':_0x22d1d8[_0xc79c('0x22')],'include':_0x22d1d8['include']?_[_0xc79c('0x26')](_0x22d1d8[_0xc79c('0x24')],function(_0x5d3c21){return{'model':db[_0x5d3c21[_0xc79c('0x25')]],'as':_0x5d3c21['as'],'attributes':_0x5d3c21[_0xc79c('0x22')],'include':_0x5d3c21['include']?_['map'](_0x5d3c21[_0xc79c('0x24')],function(_0xbd2689){return{'model':db[_0xbd2689['model']],'as':_0xbd2689['as'],'attributes':_0xbd2689[_0xc79c('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc79c('0x14')](function(_0x2d16cd){logger[_0xc79c('0x15')](_0xc79c('0x27'),_0x3e4b93);logger[_0xc79c('0x18')](_0xc79c('0x27'),_0x3e4b93,JSON[_0xc79c('0x1a')](_0x2d16cd));_0x2b3822(_0x2d16cd);})['catch'](function(_0x55564a){logger[_0xc79c('0x1b')]('GetSmsQueue',_0x55564a['message'],_0x3e4b93);_0x3ec40a(_0x3870ab[_0xc79c('0x1b')](0x1f4,_0x55564a[_0xc79c('0x1d')]));});});};exports['ShowSmsQueue']=function(_0x5b4e89){var _0x4d44fd=this;return new Promise(function(_0x1c709c,_0x591d0f){return db[_0xc79c('0x1f')][_0xc79c('0x28')]({'raw':_0x5b4e89[_0xc79c('0x20')]?_0x5b4e89[_0xc79c('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x5b4e89[_0xc79c('0x20')]?_0x5b4e89[_0xc79c('0x20')]['where']||null:null,'attributes':_0x5b4e89[_0xc79c('0x20')]?_0x5b4e89['options'][_0xc79c('0x22')]||null:null,'include':_0x5b4e89['options']?_0x5b4e89[_0xc79c('0x20')][_0xc79c('0x24')]?_[_0xc79c('0x26')](_0x5b4e89[_0xc79c('0x20')]['include'],function(_0x46312d){return{'model':db[_0x46312d[_0xc79c('0x25')]],'as':_0x46312d['as'],'attributes':_0x46312d[_0xc79c('0x22')],'include':_0x46312d[_0xc79c('0x24')]?_[_0xc79c('0x26')](_0x46312d['include'],function(_0x4aeb81){return{'model':db[_0x4aeb81['model']],'as':_0x4aeb81['as'],'attributes':_0x4aeb81[_0xc79c('0x22')],'include':_0x4aeb81[_0xc79c('0x24')]?_[_0xc79c('0x26')](_0x4aeb81['include'],function(_0x1edbe4){return{'model':db[_0x1edbe4[_0xc79c('0x25')]],'as':_0x1edbe4['as'],'attributes':_0x1edbe4[_0xc79c('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f4ac6){logger[_0xc79c('0x15')](_0xc79c('0x29'),_0x5b4e89);logger['debug'](_0xc79c('0x29'),_0x5b4e89,JSON[_0xc79c('0x1a')](_0x3f4ac6));_0x1c709c(_0x3f4ac6);})[_0xc79c('0x2a')](function(_0x422d57){logger[_0xc79c('0x1b')](_0xc79c('0x29'),_0x422d57[_0xc79c('0x1d')],_0x5b4e89);_0x591d0f(_0x4d44fd[_0xc79c('0x1b')](0x1f4,_0x422d57[_0xc79c('0x1d')]));});});}; \ No newline at end of file +var _0xfe82=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','redis','defaults','localhost','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','where','attributes','limit','include','map','model','ShowSmsQueue','raw','lodash','util','moment','bluebird'];(function(_0x3385c3,_0x1457d8){var _0x304331=function(_0x3cfe04){while(--_0x3cfe04){_0x3385c3['push'](_0x3385c3['shift']());}};_0x304331(++_0x1457d8);}(_0xfe82,0x182));var _0x2fe8=function(_0x11e9a3,_0x20cc45){_0x11e9a3=_0x11e9a3-0x0;var _0x512eb1=_0xfe82[_0x11e9a3];return _0x512eb1;};'use strict';var _=require(_0x2fe8('0x0'));var util=require(_0x2fe8('0x1'));var moment=require(_0x2fe8('0x2'));var BPromise=require(_0x2fe8('0x3'));var rs=require(_0x2fe8('0x4'));var fs=require('fs');var Redis=require(_0x2fe8('0x5'));var db=require(_0x2fe8('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2fe8('0x7'));var config=require(_0x2fe8('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2fe8('0x9')]({'port':0x232a});config[_0x2fe8('0xa')]=_[_0x2fe8('0xb')](config[_0x2fe8('0xa')],{'host':_0x2fe8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2fe8('0xa')]));require(_0x2fe8('0xd'))['register'](socket);function respondWithRpcPromise(_0x24f622,_0x1aa06b,_0x5b61a8){return new BPromise(function(_0x2fcb71,_0x24950f){return client[_0x2fe8('0xe')](_0x24f622,_0x5b61a8)[_0x2fe8('0xf')](function(_0x3a8d53){logger[_0x2fe8('0x10')](_0x2fe8('0x11'),_0x1aa06b,_0x2fe8('0x12'));logger[_0x2fe8('0x13')](_0x2fe8('0x14'),_0x1aa06b,_0x2fe8('0x12'),JSON[_0x2fe8('0x15')](_0x3a8d53));if(_0x3a8d53['error']){if(_0x3a8d53[_0x2fe8('0x16')][_0x2fe8('0x17')]===0x1f4){logger[_0x2fe8('0x16')](_0x2fe8('0x11'),_0x1aa06b,_0x3a8d53[_0x2fe8('0x16')]['message']);return _0x24950f(_0x3a8d53[_0x2fe8('0x16')][_0x2fe8('0x18')]);}logger['error'](_0x2fe8('0x11'),_0x1aa06b,_0x3a8d53[_0x2fe8('0x16')][_0x2fe8('0x18')]);return _0x2fcb71(_0x3a8d53[_0x2fe8('0x16')][_0x2fe8('0x18')]);}else{logger['info'](_0x2fe8('0x11'),_0x1aa06b,'request\x20sent');_0x2fcb71(_0x3a8d53[_0x2fe8('0x19')][_0x2fe8('0x18')]);}})[_0x2fe8('0x1a')](function(_0x77a045){logger[_0x2fe8('0x16')](_0x2fe8('0x11'),_0x1aa06b,_0x77a045);_0x24950f(_0x77a045);});});}exports[_0x2fe8('0x1b')]=function(_0x4e5ac2){var _0x696a5c=this;return new Promise(function(_0xf945b6,_0x4215f5){return db[_0x2fe8('0x1c')][_0x2fe8('0x1d')]({'raw':_0x4e5ac2[_0x2fe8('0x1e')]?_0x4e5ac2['options']['raw']===undefined?!![]:![]:!![],'where':_0x4e5ac2[_0x2fe8('0x1e')]?_0x4e5ac2[_0x2fe8('0x1e')][_0x2fe8('0x1f')]||null:null,'attributes':_0x4e5ac2[_0x2fe8('0x1e')]?_0x4e5ac2['options'][_0x2fe8('0x20')]||null:null,'limit':_0x4e5ac2[_0x2fe8('0x1e')]?_0x4e5ac2['options'][_0x2fe8('0x21')]||null:null,'include':_0x4e5ac2[_0x2fe8('0x1e')]?_0x4e5ac2[_0x2fe8('0x1e')][_0x2fe8('0x22')]?_[_0x2fe8('0x23')](_0x4e5ac2[_0x2fe8('0x1e')][_0x2fe8('0x22')],function(_0x2b54a8){return{'model':db[_0x2b54a8['model']],'as':_0x2b54a8['as'],'attributes':_0x2b54a8[_0x2fe8('0x20')],'include':_0x2b54a8['include']?_[_0x2fe8('0x23')](_0x2b54a8[_0x2fe8('0x22')],function(_0x3f3e41){return{'model':db[_0x3f3e41[_0x2fe8('0x24')]],'as':_0x3f3e41['as'],'attributes':_0x3f3e41[_0x2fe8('0x20')],'include':_0x3f3e41[_0x2fe8('0x22')]?_[_0x2fe8('0x23')](_0x3f3e41['include'],function(_0x3b737b){return{'model':db[_0x3b737b['model']],'as':_0x3b737b['as'],'attributes':_0x3b737b['attributes']};}):[]};}):[]};}):[]:[]})[_0x2fe8('0xf')](function(_0x4b5f95){logger['info'](_0x2fe8('0x1b'),_0x4e5ac2);logger['debug'](_0x2fe8('0x1b'),_0x4e5ac2,JSON[_0x2fe8('0x15')](_0x4b5f95));_0xf945b6(_0x4b5f95);})[_0x2fe8('0x1a')](function(_0x1a1c5e){logger[_0x2fe8('0x16')](_0x2fe8('0x1b'),_0x1a1c5e[_0x2fe8('0x18')],_0x4e5ac2);_0x4215f5(_0x696a5c[_0x2fe8('0x16')](0x1f4,_0x1a1c5e[_0x2fe8('0x18')]));});});};exports[_0x2fe8('0x25')]=function(_0x306b62){var _0x2bdfd4=this;return new Promise(function(_0x2f28e8,_0x331867){return db['SmsQueue']['find']({'raw':_0x306b62[_0x2fe8('0x1e')]?_0x306b62[_0x2fe8('0x1e')][_0x2fe8('0x26')]===undefined?!![]:![]:!![],'where':_0x306b62[_0x2fe8('0x1e')]?_0x306b62[_0x2fe8('0x1e')][_0x2fe8('0x1f')]||null:null,'attributes':_0x306b62[_0x2fe8('0x1e')]?_0x306b62['options'][_0x2fe8('0x20')]||null:null,'include':_0x306b62['options']?_0x306b62['options']['include']?_[_0x2fe8('0x23')](_0x306b62['options'][_0x2fe8('0x22')],function(_0x75cdd2){return{'model':db[_0x75cdd2[_0x2fe8('0x24')]],'as':_0x75cdd2['as'],'attributes':_0x75cdd2[_0x2fe8('0x20')],'include':_0x75cdd2[_0x2fe8('0x22')]?_['map'](_0x75cdd2[_0x2fe8('0x22')],function(_0x2e20eb){return{'model':db[_0x2e20eb[_0x2fe8('0x24')]],'as':_0x2e20eb['as'],'attributes':_0x2e20eb[_0x2fe8('0x20')],'include':_0x2e20eb[_0x2fe8('0x22')]?_[_0x2fe8('0x23')](_0x2e20eb['include'],function(_0x301d27){return{'model':db[_0x301d27[_0x2fe8('0x24')]],'as':_0x301d27['as'],'attributes':_0x301d27['attributes']};}):[]};}):[]};}):[]:[]})[_0x2fe8('0xf')](function(_0x5d67b5){logger[_0x2fe8('0x10')]('ShowSmsQueue',_0x306b62);logger[_0x2fe8('0x13')]('ShowSmsQueue',_0x306b62,JSON['stringify'](_0x5d67b5));_0x2f28e8(_0x5d67b5);})['catch'](function(_0xe77d0d){logger['error'](_0x2fe8('0x25'),_0xe77d0d['message'],_0x306b62);_0x331867(_0x2bdfd4[_0x2fe8('0x16')](0x1f4,_0xe77d0d[_0x2fe8('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index f1e7e68..f37e92a 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 _0xa324=['length','smsQueue:','update','emit','removeListener'];(function(_0x5678c2,_0xd8cb89){var _0x263105=function(_0x4bb4e9){while(--_0x4bb4e9){_0x5678c2['push'](_0x5678c2['shift']());}};_0x263105(++_0xd8cb89);}(_0xa324,0x129));var _0x4a32=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0xa324[_0x2aecb2];return _0x3ebb80;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save','remove',_0x4a32('0x0')];function createListener(_0x4179e2,_0x1b9f89){return function(_0x5573fc){_0x1b9f89[_0x4a32('0x1')](_0x4179e2,_0x5573fc);};}function removeListener(_0x3d6034,_0x242e54){return function(){SmsQueueEvents[_0x4a32('0x2')](_0x3d6034,_0x242e54);};}exports['register']=function(_0x281488){for(var _0x9f5e35=0x0,_0xa3b6ef=events[_0x4a32('0x3')];_0x9f5e35<_0xa3b6ef;_0x9f5e35++){var _0x402957=events[_0x9f5e35];var _0x2c4a3f=createListener(_0x4a32('0x4')+_0x402957,_0x281488);SmsQueueEvents['on'](_0x402957,_0x2c4a3f);}}; \ No newline at end of file +var _0x05ee=['./smsQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x5df6b6,_0x23bb8e){var _0x1bb438=function(_0x345e23){while(--_0x345e23){_0x5df6b6['push'](_0x5df6b6['shift']());}};_0x1bb438(++_0x23bb8e);}(_0x05ee,0xa8));var _0xe05e=function(_0x205b46,_0x3ca65b){_0x205b46=_0x205b46-0x0;var _0x2b6ae8=_0x05ee[_0x205b46];return _0x2b6ae8;};'use strict';var SmsQueueEvents=require(_0xe05e('0x0'));var events=[_0xe05e('0x1'),_0xe05e('0x2'),_0xe05e('0x3')];function createListener(_0x2594ce,_0x21fd46){return function(_0x25a61a){_0x21fd46[_0xe05e('0x4')](_0x2594ce,_0x25a61a);};}function removeListener(_0x185d9a,_0x5ca600){return function(){SmsQueueEvents[_0xe05e('0x5')](_0x185d9a,_0x5ca600);};}exports[_0xe05e('0x6')]=function(_0x2d1871){for(var _0xc3d0b0=0x0,_0x3568ce=events[_0xe05e('0x7')];_0xc3d0b0<_0x3568ce;_0xc3d0b0++){var _0x418cde=events[_0xc3d0b0];var _0x54c7b6=createListener('smsQueue:'+_0x418cde,_0x2d1871);SmsQueueEvents['on'](_0x418cde,_0x54c7b6);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index d58c0d1..b8b1f52 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 _0x5d99=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','show','post','create','put','update','delete','/:id'];(function(_0x18af13,_0x1a0693){var _0x37a567=function(_0x2e42e3){while(--_0x2e42e3){_0x18af13['push'](_0x18af13['shift']());}};_0x37a567(++_0x1a0693);}(_0x5d99,0x1b7));var _0x95d9=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0x5d99[_0x59e821];return _0x5333f6;};'use strict';var multer=require(_0x95d9('0x0'));var util=require(_0x95d9('0x1'));var path=require(_0x95d9('0x2'));var timeout=require(_0x95d9('0x3'));var express=require(_0x95d9('0x4'));var router=express[_0x95d9('0x5')]();var fs_extra=require(_0x95d9('0x6'));var auth=require(_0x95d9('0x7'));var interaction=require(_0x95d9('0x8'));var config=require(_0x95d9('0x9'));var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0x95d9('0xa')](),controller[_0x95d9('0xb')]);router[_0x95d9('0xc')]('/describe',auth['isAuthenticated'](),controller[_0x95d9('0xd')]);router[_0x95d9('0xc')]('/:id',auth[_0x95d9('0xa')](),controller[_0x95d9('0xe')]);router[_0x95d9('0xf')]('/',auth['isAuthenticated'](),controller[_0x95d9('0x10')]);router[_0x95d9('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x95d9('0x12')]);router[_0x95d9('0x13')](_0x95d9('0x14'),auth[_0x95d9('0xa')](),controller[_0x95d9('0x15')]);module[_0x95d9('0x16')]=router; \ No newline at end of file +var _0xf4ac=['isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','exports','multer','util','path','fs-extra','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0xf4ac,0xd0));var _0xcf4a=function(_0x10c34d,_0x126581){_0x10c34d=_0x10c34d-0x0;var _0x52c1c8=_0xf4ac[_0x10c34d];return _0x52c1c8;};'use strict';var multer=require(_0xcf4a('0x0'));var util=require(_0xcf4a('0x1'));var path=require(_0xcf4a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xcf4a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xcf4a('0x4'));var config=require(_0xcf4a('0x5'));var controller=require(_0xcf4a('0x6'));router[_0xcf4a('0x7')]('/',auth[_0xcf4a('0x8')](),controller[_0xcf4a('0x9')]);router[_0xcf4a('0x7')](_0xcf4a('0xa'),auth[_0xcf4a('0x8')](),controller[_0xcf4a('0xb')]);router['get'](_0xcf4a('0xc'),auth[_0xcf4a('0x8')](),controller[_0xcf4a('0xd')]);router['post']('/',auth[_0xcf4a('0x8')](),controller[_0xcf4a('0xe')]);router['put'](_0xcf4a('0xc'),auth['isAuthenticated'](),controller[_0xcf4a('0xf')]);router[_0xcf4a('0x10')](_0xcf4a('0xc'),auth[_0xcf4a('0x8')](),controller['destroy']);module[_0xcf4a('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 462e45a..e8db9a3 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 _0x9eb7=['exports','STRING','DATE'];(function(_0x553956,_0x57a991){var _0x2e4172=function(_0x2b5dda){while(--_0x2b5dda){_0x553956['push'](_0x553956['shift']());}};_0x2e4172(++_0x57a991);}(_0x9eb7,0x117));var _0x79eb=function(_0x367941,_0x1c847d){_0x367941=_0x367941-0x0;var _0x17bd3f=_0x9eb7[_0x367941];return _0x17bd3f;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x79eb('0x0')]={'uniqueid':{'type':Sequelize[_0x79eb('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x79eb('0x1')]},'joinAt':{'type':Sequelize[_0x79eb('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x79eb('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc42f=['exports','STRING','DATE','sequelize'];(function(_0x15c23e,_0x162305){var _0x4ed7d1=function(_0x3d65e7){while(--_0x3d65e7){_0x15c23e['push'](_0x15c23e['shift']());}};_0x4ed7d1(++_0x162305);}(_0xc42f,0xab));var _0xfc42=function(_0x2941a8,_0x57ffb9){_0x2941a8=_0x2941a8-0x0;var _0x382d9e=_0xc42f[_0x2941a8];return _0x382d9e;};'use strict';var moment=require('moment');var Sequelize=require(_0xfc42('0x0'));module[_0xfc42('0x1')]={'uniqueid':{'type':Sequelize[_0xfc42('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xfc42('0x2')]},'joinAt':{'type':Sequelize[_0xfc42('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xfc42('0x3')]},'exitAt':{'type':Sequelize[_0xfc42('0x3')]},'reason':{'type':Sequelize[_0xfc42('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 3eabc47..46f595f 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 _0x1a50=['update','then','destroy','end','error','stack','name','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','SmsQueueReport','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','describe','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','apply','reject'];(function(_0x2c94a5,_0x128193){var _0x472eac=function(_0x4ab9af){while(--_0x4ab9af){_0x2c94a5['push'](_0x2c94a5['shift']());}};_0x472eac(++_0x128193);}(_0x1a50,0x14d));var _0x01a5=function(_0x212a37,_0xf35b2e){_0x212a37=_0x212a37-0x0;var _0x5d0bf9=_0x1a50[_0x212a37];return _0x5d0bf9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01a5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x01a5('0x1'));var moment=require(_0x01a5('0x2'));var BPromise=require(_0x01a5('0x3'));var Mustache=require('mustache');var util=require(_0x01a5('0x4'));var path=require(_0x01a5('0x5'));var sox=require(_0x01a5('0x6'));var csv=require(_0x01a5('0x7'));var ejs=require(_0x01a5('0x8'));var fs=require('fs');var fs_extra=require(_0x01a5('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x01a5('0xa'));var jsforce=require(_0x01a5('0xb'));var deskjs=require(_0x01a5('0xc'));var toCsv=require(_0x01a5('0x7'));var querystring=require('querystring');var Papa=require(_0x01a5('0xd'));var Redis=require('ioredis');var authService=require(_0x01a5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x01a5('0xf'));var hardwareService=require(_0x01a5('0x10'));var logger=require('../../config/logger')(_0x01a5('0x11'));var utils=require(_0x01a5('0x12'));var config=require(_0x01a5('0x13'));var licenseUtil=require(_0x01a5('0x14'));var db=require(_0x01a5('0x15'))['db'];function respondWithStatusCode(_0xbb5598,_0x6f210f){_0x6f210f=_0x6f210f||0xcc;return function(_0x2e6e73){if(_0x2e6e73){return _0xbb5598[_0x01a5('0x16')](_0x6f210f);}return _0xbb5598[_0x01a5('0x17')](_0x6f210f)['end']();};}function respondWithResult(_0x210e3c,_0x347a59){_0x347a59=_0x347a59||0xc8;return function(_0xa62ad6){if(_0xa62ad6){return _0x210e3c[_0x01a5('0x17')](_0x347a59)[_0x01a5('0x18')](_0xa62ad6);}};}function respondWithFilteredResult(_0x296d5d,_0x59a957){return function(_0x52d554){if(_0x52d554){var _0x2a3a72=typeof _0x59a957['offset']===_0x01a5('0x19')&&typeof _0x59a957['limit']==='undefined';var _0x40b358=_0x52d554[_0x01a5('0x1a')];var _0x56456f=_0x2a3a72?0x0:_0x59a957[_0x01a5('0x1b')];var _0x5350cc=_0x2a3a72?_0x52d554[_0x01a5('0x1a')]:_0x59a957[_0x01a5('0x1b')]+_0x59a957[_0x01a5('0x1c')];var _0xbc3efc;if(_0x5350cc>=_0x40b358){_0x5350cc=_0x40b358;_0xbc3efc=0xc8;}else{_0xbc3efc=0xce;}_0x296d5d[_0x01a5('0x17')](_0xbc3efc);return _0x296d5d[_0x01a5('0x1d')]('Content-Range',_0x56456f+'-'+_0x5350cc+'/'+_0x40b358)[_0x01a5('0x18')](_0x52d554);}return null;};}function patchUpdates(_0xd19286){return function(_0x352fcb){try{jsonpatch[_0x01a5('0x1e')](_0x352fcb,_0xd19286,!![]);}catch(_0x3c199b){return BPromise[_0x01a5('0x1f')](_0x3c199b);}return _0x352fcb['save']();};}function saveUpdates(_0x58cdb0,_0x535166){return function(_0x4aa5cf){if(_0x4aa5cf){return _0x4aa5cf[_0x01a5('0x20')](_0x58cdb0)[_0x01a5('0x21')](function(_0x4cdec7){return _0x4cdec7;});}return null;};}function removeEntity(_0x2bc8e2,_0x58147d){return function(_0xd6987f){if(_0xd6987f){return _0xd6987f[_0x01a5('0x22')]()[_0x01a5('0x21')](function(){_0x2bc8e2['status'](0xcc)[_0x01a5('0x23')]();});}};}function handleEntityNotFound(_0x562865,_0x8d0f43){return function(_0x459feb){if(!_0x459feb){_0x562865[_0x01a5('0x16')](0x194);}return _0x459feb;};}function handleError(_0x55e86c,_0x47ec3d){_0x47ec3d=_0x47ec3d||0x1f4;return function(_0x34aec1){logger[_0x01a5('0x24')](_0x34aec1[_0x01a5('0x25')]);if(_0x34aec1['name']){delete _0x34aec1[_0x01a5('0x26')];}_0x55e86c['status'](_0x47ec3d)['send'](_0x34aec1);};}exports['index']=function(_0x37eed3,_0x287150){var _0x5ebc1c={},_0x4c2058={},_0x4b3c65={'count':0x0,'rows':[]};var _0x38cbed=_['map'](db['SmsQueueReport'][_0x01a5('0x27')],function(_0x847e3e){return{'name':_0x847e3e[_0x01a5('0x28')],'type':_0x847e3e[_0x01a5('0x29')][_0x01a5('0x2a')]};});_0x4c2058[_0x01a5('0x2b')]=_['map'](_0x38cbed,_0x01a5('0x26'));_0x4c2058[_0x01a5('0x2c')]=_['keys'](_0x37eed3[_0x01a5('0x2c')]);_0x4c2058[_0x01a5('0x2d')]=_[_0x01a5('0x2e')](_0x4c2058[_0x01a5('0x2b')],_0x4c2058['query']);_0x5ebc1c[_0x01a5('0x2f')]=_['intersection'](_0x4c2058[_0x01a5('0x2b')],qs[_0x01a5('0x30')](_0x37eed3[_0x01a5('0x2c')][_0x01a5('0x30')]));_0x5ebc1c['attributes']=_0x5ebc1c[_0x01a5('0x2f')][_0x01a5('0x31')]?_0x5ebc1c[_0x01a5('0x2f')]:_0x4c2058[_0x01a5('0x2b')];if(!_0x37eed3['query'][_0x01a5('0x32')]('nolimit')){_0x5ebc1c[_0x01a5('0x1c')]=qs[_0x01a5('0x1c')](_0x37eed3[_0x01a5('0x2c')][_0x01a5('0x1c')]);_0x5ebc1c[_0x01a5('0x1b')]=qs['offset'](_0x37eed3[_0x01a5('0x2c')][_0x01a5('0x1b')]);}_0x5ebc1c[_0x01a5('0x33')]=qs[_0x01a5('0x34')](_0x37eed3[_0x01a5('0x2c')][_0x01a5('0x34')]);_0x5ebc1c[_0x01a5('0x35')]=qs[_0x01a5('0x2d')](_[_0x01a5('0x36')](_0x37eed3[_0x01a5('0x2c')],_0x4c2058[_0x01a5('0x2d')]),_0x38cbed);if(_0x37eed3['query'][_0x01a5('0x37')]){_0x5ebc1c[_0x01a5('0x35')]=_[_0x01a5('0x38')](_0x5ebc1c[_0x01a5('0x35')],{'$or':_[_0x01a5('0x39')](_0x38cbed,function(_0x3a9921){if(_0x3a9921[_0x01a5('0x29')]!==_0x01a5('0x3a')){var _0x5764df={};_0x5764df[_0x3a9921['name']]={'$like':'%'+_0x37eed3[_0x01a5('0x2c')][_0x01a5('0x37')]+'%'};return _0x5764df;}})});}_0x5ebc1c=_[_0x01a5('0x38')]({},_0x5ebc1c,_0x37eed3[_0x01a5('0x3b')]);var _0x246888={'where':_0x5ebc1c[_0x01a5('0x35')]};return db[_0x01a5('0x3c')][_0x01a5('0x1a')](_0x246888)[_0x01a5('0x21')](function(_0x367e9b){_0x4b3c65[_0x01a5('0x1a')]=_0x367e9b;if(_0x37eed3['query'][_0x01a5('0x3d')]){_0x5ebc1c[_0x01a5('0x3e')]=[{'all':!![]}];}return db[_0x01a5('0x3c')][_0x01a5('0x3f')](_0x5ebc1c);})[_0x01a5('0x21')](function(_0x438f4e){_0x4b3c65[_0x01a5('0x40')]=_0x438f4e;return _0x4b3c65;})[_0x01a5('0x21')](respondWithFilteredResult(_0x287150,_0x5ebc1c))[_0x01a5('0x41')](handleError(_0x287150,null));};exports[_0x01a5('0x42')]=function(_0x2a6cec,_0x21f678){var _0x27f033={'raw':!![],'where':{'id':_0x2a6cec[_0x01a5('0x43')]['id']}},_0x4f9806={};_0x4f9806[_0x01a5('0x2b')]=_[_0x01a5('0x44')](db[_0x01a5('0x3c')]['rawAttributes']);_0x4f9806[_0x01a5('0x2c')]=_[_0x01a5('0x44')](_0x2a6cec[_0x01a5('0x2c')]);_0x4f9806[_0x01a5('0x2d')]=_[_0x01a5('0x2e')](_0x4f9806['model'],_0x4f9806[_0x01a5('0x2c')]);_0x27f033[_0x01a5('0x2f')]=_[_0x01a5('0x2e')](_0x4f9806[_0x01a5('0x2b')],qs[_0x01a5('0x30')](_0x2a6cec[_0x01a5('0x2c')][_0x01a5('0x30')]));_0x27f033['attributes']=_0x27f033[_0x01a5('0x2f')][_0x01a5('0x31')]?_0x27f033['attributes']:_0x4f9806[_0x01a5('0x2b')];if(_0x2a6cec['query'][_0x01a5('0x3d')]){_0x27f033[_0x01a5('0x3e')]=[{'all':!![]}];}_0x27f033=_[_0x01a5('0x38')]({},_0x27f033,_0x2a6cec[_0x01a5('0x3b')]);return db['SmsQueueReport']['find'](_0x27f033)[_0x01a5('0x21')](handleEntityNotFound(_0x21f678,null))[_0x01a5('0x21')](respondWithResult(_0x21f678,null))[_0x01a5('0x41')](handleError(_0x21f678,null));};exports[_0x01a5('0x45')]=function(_0x4bb363,_0x27a3dd){return db[_0x01a5('0x3c')]['create'](_0x4bb363['body'],{})[_0x01a5('0x21')](respondWithResult(_0x27a3dd,0xc9))[_0x01a5('0x41')](handleError(_0x27a3dd,null));};exports[_0x01a5('0x20')]=function(_0x22cb76,_0x443d6b){if(_0x22cb76['body']['id']){delete _0x22cb76[_0x01a5('0x46')]['id'];}return db[_0x01a5('0x3c')][_0x01a5('0x47')]({'where':{'id':_0x22cb76[_0x01a5('0x43')]['id']}})[_0x01a5('0x21')](handleEntityNotFound(_0x443d6b,null))[_0x01a5('0x21')](saveUpdates(_0x22cb76['body'],null))['then'](respondWithResult(_0x443d6b,null))['catch'](handleError(_0x443d6b,null));};exports[_0x01a5('0x22')]=function(_0x5ec38a,_0x346889){return db[_0x01a5('0x3c')][_0x01a5('0x47')]({'where':{'id':_0x5ec38a[_0x01a5('0x43')]['id']}})[_0x01a5('0x21')](handleEntityNotFound(_0x346889,null))[_0x01a5('0x21')](removeEntity(_0x346889,null))['catch'](handleError(_0x346889,null));};exports[_0x01a5('0x48')]=function(_0x16f0eb,_0x1a247f){return db[_0x01a5('0x3c')]['describe']()[_0x01a5('0x21')](respondWithResult(_0x1a247f,null))[_0x01a5('0x41')](handleError(_0x1a247f,null));}; \ No newline at end of file +var _0xf9f0=['squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','then','destroy','stack','name','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','rows','params','include','find','catch','create','body','update','describe','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra'];(function(_0x40579e,_0x1f4bcc){var _0x406aee=function(_0x149f47){while(--_0x149f47){_0x40579e['push'](_0x40579e['shift']());}};_0x406aee(++_0x1f4bcc);}(_0xf9f0,0x82));var _0x0f9f=function(_0x51d127,_0x3c35bd){_0x51d127=_0x51d127-0x0;var _0xa4c017=_0xf9f0[_0x51d127];return _0xa4c017;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0f9f('0x0'));var rp=require(_0x0f9f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0f9f('0x2'));var util=require(_0x0f9f('0x3'));var path=require(_0x0f9f('0x4'));var sox=require(_0x0f9f('0x5'));var csv=require('to-csv');var ejs=require(_0x0f9f('0x6'));var fs=require('fs');var fs_extra=require(_0x0f9f('0x7'));var _=require('lodash');var squel=require(_0x0f9f('0x8'));var crypto=require('crypto');var jsforce=require(_0x0f9f('0x9'));var deskjs=require(_0x0f9f('0xa'));var toCsv=require(_0x0f9f('0xb'));var querystring=require('querystring');var Papa=require(_0x0f9f('0xc'));var Redis=require(_0x0f9f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x0f9f('0xe'));var as=require(_0x0f9f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f9f('0x10'))(_0x0f9f('0x11'));var utils=require('../../config/utils');var config=require(_0x0f9f('0x12'));var licenseUtil=require(_0x0f9f('0x13'));var db=require(_0x0f9f('0x14'))['db'];function respondWithStatusCode(_0x5c4778,_0x5dcaa8){_0x5dcaa8=_0x5dcaa8||0xcc;return function(_0x1420a4){if(_0x1420a4){return _0x5c4778[_0x0f9f('0x15')](_0x5dcaa8);}return _0x5c4778[_0x0f9f('0x16')](_0x5dcaa8)[_0x0f9f('0x17')]();};}function respondWithResult(_0xdf3865,_0x307057){_0x307057=_0x307057||0xc8;return function(_0x1d1102){if(_0x1d1102){return _0xdf3865['status'](_0x307057)[_0x0f9f('0x18')](_0x1d1102);}};}function respondWithFilteredResult(_0x3d374b,_0x2d6633){return function(_0x2c5b9e){if(_0x2c5b9e){var _0x55470d=typeof _0x2d6633[_0x0f9f('0x19')]===_0x0f9f('0x1a')&&typeof _0x2d6633['limit']===_0x0f9f('0x1a');var _0x3e818f=_0x2c5b9e['count'];var _0x1369c8=_0x55470d?0x0:_0x2d6633[_0x0f9f('0x19')];var _0x2da612=_0x55470d?_0x2c5b9e['count']:_0x2d6633[_0x0f9f('0x19')]+_0x2d6633[_0x0f9f('0x1b')];var _0x2617ff;if(_0x2da612>=_0x3e818f){_0x2da612=_0x3e818f;_0x2617ff=0xc8;}else{_0x2617ff=0xce;}_0x3d374b[_0x0f9f('0x16')](_0x2617ff);return _0x3d374b[_0x0f9f('0x1c')](_0x0f9f('0x1d'),_0x1369c8+'-'+_0x2da612+'/'+_0x3e818f)[_0x0f9f('0x18')](_0x2c5b9e);}return null;};}function patchUpdates(_0x541945){return function(_0x4e9ac9){try{jsonpatch['apply'](_0x4e9ac9,_0x541945,!![]);}catch(_0x3d5c84){return BPromise[_0x0f9f('0x1e')](_0x3d5c84);}return _0x4e9ac9[_0x0f9f('0x1f')]();};}function saveUpdates(_0x2b6487,_0x5956c5){return function(_0x5bd2ec){if(_0x5bd2ec){return _0x5bd2ec['update'](_0x2b6487)[_0x0f9f('0x20')](function(_0x168f18){return _0x168f18;});}return null;};}function removeEntity(_0xe8b323,_0x7346fb){return function(_0x260583){if(_0x260583){return _0x260583[_0x0f9f('0x21')]()[_0x0f9f('0x20')](function(){_0xe8b323[_0x0f9f('0x16')](0xcc)[_0x0f9f('0x17')]();});}};}function handleEntityNotFound(_0x3198bf,_0x47f555){return function(_0x4e196c){if(!_0x4e196c){_0x3198bf[_0x0f9f('0x15')](0x194);}return _0x4e196c;};}function handleError(_0x263f2e,_0x6ac535){_0x6ac535=_0x6ac535||0x1f4;return function(_0x323dd1){logger['error'](_0x323dd1[_0x0f9f('0x22')]);if(_0x323dd1[_0x0f9f('0x23')]){delete _0x323dd1['name'];}_0x263f2e[_0x0f9f('0x16')](_0x6ac535)['send'](_0x323dd1);};}exports['index']=function(_0x40c142,_0x25fe22){var _0x10791f={},_0x529801={},_0x2a1361={'count':0x0,'rows':[]};var _0x6f481a=_[_0x0f9f('0x24')](db[_0x0f9f('0x25')][_0x0f9f('0x26')],function(_0x57af9f){return{'name':_0x57af9f[_0x0f9f('0x27')],'type':_0x57af9f[_0x0f9f('0x28')][_0x0f9f('0x29')]};});_0x529801[_0x0f9f('0x2a')]=_[_0x0f9f('0x24')](_0x6f481a,_0x0f9f('0x23'));_0x529801['query']=_[_0x0f9f('0x2b')](_0x40c142[_0x0f9f('0x2c')]);_0x529801[_0x0f9f('0x2d')]=_[_0x0f9f('0x2e')](_0x529801[_0x0f9f('0x2a')],_0x529801[_0x0f9f('0x2c')]);_0x10791f[_0x0f9f('0x2f')]=_[_0x0f9f('0x2e')](_0x529801[_0x0f9f('0x2a')],qs[_0x0f9f('0x30')](_0x40c142['query'][_0x0f9f('0x30')]));_0x10791f[_0x0f9f('0x2f')]=_0x10791f[_0x0f9f('0x2f')][_0x0f9f('0x31')]?_0x10791f[_0x0f9f('0x2f')]:_0x529801[_0x0f9f('0x2a')];if(!_0x40c142[_0x0f9f('0x2c')][_0x0f9f('0x32')]('nolimit')){_0x10791f[_0x0f9f('0x1b')]=qs[_0x0f9f('0x1b')](_0x40c142['query']['limit']);_0x10791f['offset']=qs[_0x0f9f('0x19')](_0x40c142[_0x0f9f('0x2c')]['offset']);}_0x10791f[_0x0f9f('0x33')]=qs[_0x0f9f('0x34')](_0x40c142[_0x0f9f('0x2c')]['sort']);_0x10791f[_0x0f9f('0x35')]=qs[_0x0f9f('0x2d')](_['pick'](_0x40c142[_0x0f9f('0x2c')],_0x529801['filters']),_0x6f481a);if(_0x40c142[_0x0f9f('0x2c')][_0x0f9f('0x36')]){_0x10791f['where']=_[_0x0f9f('0x37')](_0x10791f[_0x0f9f('0x35')],{'$or':_['map'](_0x6f481a,function(_0x5213a4){if(_0x5213a4[_0x0f9f('0x28')]!==_0x0f9f('0x38')){var _0x286397={};_0x286397[_0x5213a4[_0x0f9f('0x23')]]={'$like':'%'+_0x40c142[_0x0f9f('0x2c')]['filter']+'%'};return _0x286397;}})});}_0x10791f=_[_0x0f9f('0x37')]({},_0x10791f,_0x40c142[_0x0f9f('0x39')]);var _0x29115b={'where':_0x10791f[_0x0f9f('0x35')]};return db[_0x0f9f('0x25')][_0x0f9f('0x3a')](_0x29115b)['then'](function(_0xed62f){_0x2a1361['count']=_0xed62f;if(_0x40c142['query'][_0x0f9f('0x3b')]){_0x10791f['include']=[{'all':!![]}];}return db[_0x0f9f('0x25')]['findAll'](_0x10791f);})['then'](function(_0x17ea48){_0x2a1361[_0x0f9f('0x3c')]=_0x17ea48;return _0x2a1361;})[_0x0f9f('0x20')](respondWithFilteredResult(_0x25fe22,_0x10791f))['catch'](handleError(_0x25fe22,null));};exports['show']=function(_0x25a895,_0x1fad08){var _0x138db2={'raw':!![],'where':{'id':_0x25a895[_0x0f9f('0x3d')]['id']}},_0x34c736={};_0x34c736[_0x0f9f('0x2a')]=_[_0x0f9f('0x2b')](db['SmsQueueReport'][_0x0f9f('0x26')]);_0x34c736['query']=_[_0x0f9f('0x2b')](_0x25a895[_0x0f9f('0x2c')]);_0x34c736['filters']=_[_0x0f9f('0x2e')](_0x34c736[_0x0f9f('0x2a')],_0x34c736['query']);_0x138db2[_0x0f9f('0x2f')]=_['intersection'](_0x34c736[_0x0f9f('0x2a')],qs['fields'](_0x25a895['query']['fields']));_0x138db2[_0x0f9f('0x2f')]=_0x138db2[_0x0f9f('0x2f')]['length']?_0x138db2[_0x0f9f('0x2f')]:_0x34c736[_0x0f9f('0x2a')];if(_0x25a895[_0x0f9f('0x2c')]['includeAll']){_0x138db2[_0x0f9f('0x3e')]=[{'all':!![]}];}_0x138db2=_[_0x0f9f('0x37')]({},_0x138db2,_0x25a895[_0x0f9f('0x39')]);return db['SmsQueueReport'][_0x0f9f('0x3f')](_0x138db2)[_0x0f9f('0x20')](handleEntityNotFound(_0x1fad08,null))[_0x0f9f('0x20')](respondWithResult(_0x1fad08,null))[_0x0f9f('0x40')](handleError(_0x1fad08,null));};exports[_0x0f9f('0x41')]=function(_0x2bda0b,_0x5276b2){return db[_0x0f9f('0x25')][_0x0f9f('0x41')](_0x2bda0b[_0x0f9f('0x42')],{})[_0x0f9f('0x20')](respondWithResult(_0x5276b2,0xc9))[_0x0f9f('0x40')](handleError(_0x5276b2,null));};exports[_0x0f9f('0x43')]=function(_0x11a1a1,_0x3311dd){if(_0x11a1a1[_0x0f9f('0x42')]['id']){delete _0x11a1a1[_0x0f9f('0x42')]['id'];}return db[_0x0f9f('0x25')][_0x0f9f('0x3f')]({'where':{'id':_0x11a1a1[_0x0f9f('0x3d')]['id']}})[_0x0f9f('0x20')](handleEntityNotFound(_0x3311dd,null))[_0x0f9f('0x20')](saveUpdates(_0x11a1a1[_0x0f9f('0x42')],null))['then'](respondWithResult(_0x3311dd,null))[_0x0f9f('0x40')](handleError(_0x3311dd,null));};exports['destroy']=function(_0x3887c8,_0x693766){return db['SmsQueueReport'][_0x0f9f('0x3f')]({'where':{'id':_0x3887c8[_0x0f9f('0x3d')]['id']}})[_0x0f9f('0x20')](handleEntityNotFound(_0x693766,null))[_0x0f9f('0x20')](removeEntity(_0x693766,null))[_0x0f9f('0x40')](handleError(_0x693766,null));};exports[_0x0f9f('0x44')]=function(_0x4d1081,_0x4597be){return db[_0x0f9f('0x25')][_0x0f9f('0x44')]()[_0x0f9f('0x20')](respondWithResult(_0x4597be,null))[_0x0f9f('0x40')](handleError(_0x4597be,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 2afed89..77eef34 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x1f958e,_0x1941cc){var _0x31311a=function(_0x1a8ea6){while(--_0x1a8ea6){_0x1f958e['push'](_0x1f958e['shift']());}};_0x31311a(++_0x1941cc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0xcb91[_0x4b12ae];return _0x16957b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x41131e,_0x50e136){var _0x5bd545=function(_0x1a70b8){while(--_0x1a70b8){_0x41131e['push'](_0x41131e['shift']());}};_0x5bd545(++_0x50e136);}(_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('./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 diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index b72e438..936e644 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 _0xf0e1=['result','catch','CreateSmsQueueReport','create','body','options','raw','then','UpdateSmsQueueReport','SmsQueueReport','update','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xf0e1,0x1a5));var _0x1f0e=function(_0xdb357c,_0x3786b6){_0xdb357c=_0xdb357c-0x0;var _0x5c8735=_0xf0e1[_0xdb357c];return _0x5c8735;};'use strict';var _=require(_0x1f0e('0x0'));var util=require(_0x1f0e('0x1'));var moment=require(_0x1f0e('0x2'));var BPromise=require('bluebird');var rs=require(_0x1f0e('0x3'));var fs=require('fs');var Redis=require(_0x1f0e('0x4'));var db=require(_0x1f0e('0x5'))['db'];var utils=require(_0x1f0e('0x6'));var logger=require(_0x1f0e('0x7'))(_0x1f0e('0x8'));var config=require(_0x1f0e('0x9'));var jayson=require(_0x1f0e('0xa'));var client=jayson[_0x1f0e('0xb')][_0x1f0e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x157b98,_0x676abb,_0x4e8620){return new BPromise(function(_0x4ef1a3,_0x3cbdc0){return client[_0x1f0e('0xd')](_0x157b98,_0x4e8620)['then'](function(_0x24aaf6){logger[_0x1f0e('0xe')](_0x1f0e('0xf'),_0x676abb,_0x1f0e('0x10'));logger[_0x1f0e('0x11')](_0x1f0e('0x12'),_0x676abb,_0x1f0e('0x10'),JSON[_0x1f0e('0x13')](_0x24aaf6));if(_0x24aaf6[_0x1f0e('0x14')]){if(_0x24aaf6[_0x1f0e('0x14')][_0x1f0e('0x15')]===0x1f4){logger[_0x1f0e('0x14')](_0x1f0e('0xf'),_0x676abb,_0x24aaf6['error'][_0x1f0e('0x16')]);return _0x3cbdc0(_0x24aaf6[_0x1f0e('0x14')][_0x1f0e('0x16')]);}logger[_0x1f0e('0x14')]('SmsQueueReport,\x20%s,\x20%s',_0x676abb,_0x24aaf6[_0x1f0e('0x14')]['message']);return _0x4ef1a3(_0x24aaf6[_0x1f0e('0x14')][_0x1f0e('0x16')]);}else{logger[_0x1f0e('0xe')](_0x1f0e('0xf'),_0x676abb,_0x1f0e('0x10'));_0x4ef1a3(_0x24aaf6[_0x1f0e('0x17')]['message']);}})[_0x1f0e('0x18')](function(_0x2c1b37){logger[_0x1f0e('0x14')]('SmsQueueReport,\x20%s,\x20%s',_0x676abb,_0x2c1b37);_0x3cbdc0(_0x2c1b37);});});}exports[_0x1f0e('0x19')]=function(_0x31d8fc){var _0x473e9d=this;return new Promise(function(_0xc6d71e,_0x4dfc4b){return db['SmsQueueReport'][_0x1f0e('0x1a')](_0x31d8fc[_0x1f0e('0x1b')],{'raw':_0x31d8fc[_0x1f0e('0x1c')]?_0x31d8fc[_0x1f0e('0x1c')][_0x1f0e('0x1d')]===undefined?!![]:![]:!![]})[_0x1f0e('0x1e')](function(_0x484096){logger[_0x1f0e('0xe')](_0x1f0e('0x19'),_0x31d8fc);logger[_0x1f0e('0x11')](_0x1f0e('0x19'),_0x31d8fc,JSON[_0x1f0e('0x13')](_0x484096));_0xc6d71e(_0x484096);})[_0x1f0e('0x18')](function(_0x4a1962){logger['error']('CreateSmsQueueReport',_0x4a1962[_0x1f0e('0x16')],_0x31d8fc);_0x4dfc4b(_0x473e9d[_0x1f0e('0x14')](0x1f4,_0x4a1962[_0x1f0e('0x16')]));});});};exports[_0x1f0e('0x1f')]=function(_0x2858a4){var _0x397e4d=this;return new Promise(function(_0x14b4a2,_0x154b48){return db[_0x1f0e('0x20')][_0x1f0e('0x21')](_0x2858a4[_0x1f0e('0x1b')],{'raw':_0x2858a4[_0x1f0e('0x1c')]?_0x2858a4['options'][_0x1f0e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2858a4[_0x1f0e('0x1c')]?_0x2858a4['options'][_0x1f0e('0x22')]||null:null,'attributes':_0x2858a4[_0x1f0e('0x1c')]?_0x2858a4[_0x1f0e('0x1c')][_0x1f0e('0x23')]||null:null,'limit':_0x2858a4[_0x1f0e('0x1c')]?_0x2858a4[_0x1f0e('0x1c')][_0x1f0e('0x24')]||null:null})[_0x1f0e('0x1e')](function(_0x14f6a3){logger[_0x1f0e('0xe')](_0x1f0e('0x1f'),_0x2858a4);logger[_0x1f0e('0x11')]('UpdateSmsQueueReport',_0x2858a4,JSON[_0x1f0e('0x13')](_0x14f6a3));_0x14b4a2(_0x14f6a3);})[_0x1f0e('0x18')](function(_0x28cc2b){logger[_0x1f0e('0x14')](_0x1f0e('0x1f'),_0x28cc2b[_0x1f0e('0x16')],_0x2858a4);_0x154b48(_0x397e4d['error'](0x1f4,_0x28cc2b[_0x1f0e('0x16')]));});});}; \ No newline at end of file +var _0xc4ac=['http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SmsQueueReport','create','body','options','raw','CreateSmsQueueReport','update','where','attributes','limit','info','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x576bd0,_0x2ba60b){var _0x2491cb=function(_0x254846){while(--_0x254846){_0x576bd0['push'](_0x576bd0['shift']());}};_0x2491cb(++_0x2ba60b);}(_0xc4ac,0xa0));var _0xcc4a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4ac[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcc4a('0x0'));var util=require(_0xcc4a('0x1'));var moment=require(_0xcc4a('0x2'));var BPromise=require(_0xcc4a('0x3'));var rs=require(_0xcc4a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc4a('0x5'))['db'];var utils=require(_0xcc4a('0x6'));var logger=require('../../config/logger')(_0xcc4a('0x7'));var config=require(_0xcc4a('0x8'));var jayson=require(_0xcc4a('0x9'));var client=jayson['client'][_0xcc4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fc5e4,_0x5f17be,_0x913310){return new BPromise(function(_0xead959,_0x5347c9){return client[_0xcc4a('0xb')](_0x2fc5e4,_0x913310)[_0xcc4a('0xc')](function(_0x2c95c0){logger['info'](_0xcc4a('0xd'),_0x5f17be,_0xcc4a('0xe'));logger[_0xcc4a('0xf')](_0xcc4a('0x10'),_0x5f17be,'request\x20sent',JSON[_0xcc4a('0x11')](_0x2c95c0));if(_0x2c95c0[_0xcc4a('0x12')]){if(_0x2c95c0[_0xcc4a('0x12')][_0xcc4a('0x13')]===0x1f4){logger[_0xcc4a('0x12')](_0xcc4a('0xd'),_0x5f17be,_0x2c95c0['error'][_0xcc4a('0x14')]);return _0x5347c9(_0x2c95c0[_0xcc4a('0x12')][_0xcc4a('0x14')]);}logger[_0xcc4a('0x12')](_0xcc4a('0xd'),_0x5f17be,_0x2c95c0['error'][_0xcc4a('0x14')]);return _0xead959(_0x2c95c0[_0xcc4a('0x12')][_0xcc4a('0x14')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x5f17be,'request\x20sent');_0xead959(_0x2c95c0['result']['message']);}})[_0xcc4a('0x15')](function(_0x402858){logger[_0xcc4a('0x12')](_0xcc4a('0xd'),_0x5f17be,_0x402858);_0x5347c9(_0x402858);});});}exports['CreateSmsQueueReport']=function(_0x5a78c2){var _0x13a9b7=this;return new Promise(function(_0x1f7dce,_0x28dddd){return db[_0xcc4a('0x16')][_0xcc4a('0x17')](_0x5a78c2[_0xcc4a('0x18')],{'raw':_0x5a78c2['options']?_0x5a78c2[_0xcc4a('0x19')][_0xcc4a('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1c4f74){logger['info'](_0xcc4a('0x1b'),_0x5a78c2);logger[_0xcc4a('0xf')](_0xcc4a('0x1b'),_0x5a78c2,JSON[_0xcc4a('0x11')](_0x1c4f74));_0x1f7dce(_0x1c4f74);})[_0xcc4a('0x15')](function(_0x1a3544){logger['error'](_0xcc4a('0x1b'),_0x1a3544['message'],_0x5a78c2);_0x28dddd(_0x13a9b7[_0xcc4a('0x12')](0x1f4,_0x1a3544['message']));});});};exports['UpdateSmsQueueReport']=function(_0xc1afb4){var _0x58d7d3=this;return new Promise(function(_0x1a29d6,_0x236073){return db[_0xcc4a('0x16')][_0xcc4a('0x1c')](_0xc1afb4[_0xcc4a('0x18')],{'raw':_0xc1afb4[_0xcc4a('0x19')]?_0xc1afb4[_0xcc4a('0x19')][_0xcc4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc1afb4[_0xcc4a('0x19')]?_0xc1afb4['options'][_0xcc4a('0x1d')]||null:null,'attributes':_0xc1afb4[_0xcc4a('0x19')]?_0xc1afb4[_0xcc4a('0x19')][_0xcc4a('0x1e')]||null:null,'limit':_0xc1afb4[_0xcc4a('0x19')]?_0xc1afb4['options'][_0xcc4a('0x1f')]||null:null})['then'](function(_0x12d378){logger[_0xcc4a('0x20')](_0xcc4a('0x21'),_0xc1afb4);logger[_0xcc4a('0xf')]('UpdateSmsQueueReport',_0xc1afb4,JSON[_0xcc4a('0x11')](_0x12d378));_0x1a29d6(_0x12d378);})[_0xcc4a('0x15')](function(_0x28ce5e){logger[_0xcc4a('0x12')](_0xcc4a('0x21'),_0x28ce5e[_0xcc4a('0x14')],_0xc1afb4);_0x236073(_0x58d7d3[_0xcc4a('0x12')](0x1f4,_0x28ce5e['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index ab3fb81..7f4e9a6 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 _0x7f42=['delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update'];(function(_0x900a62,_0x52889d){var _0x1f537a=function(_0x26b331){while(--_0x26b331){_0x900a62['push'](_0x900a62['shift']());}};_0x1f537a(++_0x52889d);}(_0x7f42,0x1dd));var _0x27f4=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x7f42[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0x27f4('0x0'));var util=require('util');var path=require(_0x27f4('0x1'));var timeout=require(_0x27f4('0x2'));var express=require('express');var router=express[_0x27f4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x27f4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x27f4('0x5'));var controller=require('./smsTransferReport.controller');router[_0x27f4('0x6')]('/',auth['isAuthenticated'](),controller[_0x27f4('0x7')]);router[_0x27f4('0x6')](_0x27f4('0x8'),auth[_0x27f4('0x9')](),controller[_0x27f4('0xa')]);router[_0x27f4('0x6')](_0x27f4('0xb'),auth[_0x27f4('0x9')](),controller[_0x27f4('0xc')]);router[_0x27f4('0xd')]('/',auth[_0x27f4('0x9')](),controller[_0x27f4('0xe')]);router[_0x27f4('0xf')](_0x27f4('0xb'),auth[_0x27f4('0x9')](),controller[_0x27f4('0x10')]);router[_0x27f4('0x11')](_0x27f4('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x27f4('0x12')]=router; \ No newline at end of file +var _0xa990=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','update','delete','destroy'];(function(_0x340274,_0x20c1a8){var _0x3ac573=function(_0x563786){while(--_0x563786){_0x340274['push'](_0x340274['shift']());}};_0x3ac573(++_0x20c1a8);}(_0xa990,0xc9));var _0x0a99=function(_0x342611,_0xbd73b6){_0x342611=_0x342611-0x0;var _0x10856e=_0xa990[_0x342611];return _0x10856e;};'use strict';var multer=require(_0x0a99('0x0'));var util=require(_0x0a99('0x1'));var path=require(_0x0a99('0x2'));var timeout=require(_0x0a99('0x3'));var express=require(_0x0a99('0x4'));var router=express[_0x0a99('0x5')]();var fs_extra=require(_0x0a99('0x6'));var auth=require(_0x0a99('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0a99('0x8'));router[_0x0a99('0x9')]('/',auth[_0x0a99('0xa')](),controller[_0x0a99('0xb')]);router[_0x0a99('0x9')](_0x0a99('0xc'),auth[_0x0a99('0xa')](),controller[_0x0a99('0xd')]);router[_0x0a99('0x9')](_0x0a99('0xe'),auth[_0x0a99('0xa')](),controller['show']);router[_0x0a99('0xf')]('/',auth[_0x0a99('0xa')](),controller['create']);router['put'](_0x0a99('0xe'),auth[_0x0a99('0xa')](),controller[_0x0a99('0x10')]);router[_0x0a99('0x11')](_0x0a99('0xe'),auth['isAuthenticated'](),controller[_0x0a99('0x12')]);module[_0x0a99('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index eca5309..6764f95 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x3a9690,_0x5e06e8){var _0x146bef=function(_0x28f514){while(--_0x28f514){_0x3a9690['push'](_0x3a9690['shift']());}};_0x146bef(++_0x5e06e8);}(_0x008c,0x188));var _0xc008=function(_0x39ef0e,_0x1dd6b9){_0x39ef0e=_0x39ef0e-0x0;var _0x1b96e6=_0x008c[_0x39ef0e];return _0x1b96e6;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x52c3c3,_0x5af662){var _0x34389a=function(_0x58ea91){while(--_0x58ea91){_0x52c3c3['push'](_0x52c3c3['shift']());}};_0x34389a(++_0x5af662);}(_0x34e8,0x12c));var _0x834e=function(_0x26c436,_0x575fe4){_0x26c436=_0x26c436-0x0;var _0xa525=_0x34e8[_0x26c436];return _0xa525;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index e6398da..aa702e1 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 _0x1546=['key','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','params','keys','rawAttributes','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','SmsTransferReport','fieldName','type'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x1546,0x6a));var _0x6154=function(_0x350b59,_0x28bc2f){_0x350b59=_0x350b59-0x0;var _0x29fbb8=_0x1546[_0x350b59];return _0x29fbb8;};'use strict';var emlformat=require(_0x6154('0x0'));var rimraf=require(_0x6154('0x1'));var zipdir=require(_0x6154('0x2'));var jsonpatch=require(_0x6154('0x3'));var rp=require('request-promise');var moment=require(_0x6154('0x4'));var BPromise=require(_0x6154('0x5'));var Mustache=require(_0x6154('0x6'));var util=require('util');var path=require(_0x6154('0x7'));var sox=require(_0x6154('0x8'));var csv=require(_0x6154('0x9'));var ejs=require(_0x6154('0xa'));var fs=require('fs');var fs_extra=require(_0x6154('0xb'));var _=require(_0x6154('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6154('0xd'));var deskjs=require(_0x6154('0xe'));var toCsv=require(_0x6154('0x9'));var querystring=require(_0x6154('0xf'));var Papa=require(_0x6154('0x10'));var Redis=require('ioredis');var authService=require(_0x6154('0x11'));var qs=require(_0x6154('0x12'));var as=require(_0x6154('0x13'));var hardwareService=require(_0x6154('0x14'));var logger=require(_0x6154('0x15'))(_0x6154('0x16'));var utils=require(_0x6154('0x17'));var config=require(_0x6154('0x18'));var licenseUtil=require(_0x6154('0x19'));var db=require(_0x6154('0x1a'))['db'];function respondWithStatusCode(_0x5586d1,_0x5faab8){_0x5faab8=_0x5faab8||0xcc;return function(_0x1eecd3){if(_0x1eecd3){return _0x5586d1[_0x6154('0x1b')](_0x5faab8);}return _0x5586d1[_0x6154('0x1c')](_0x5faab8)[_0x6154('0x1d')]();};}function respondWithResult(_0x22edd3,_0x151bb5){_0x151bb5=_0x151bb5||0xc8;return function(_0x5ee958){if(_0x5ee958){return _0x22edd3[_0x6154('0x1c')](_0x151bb5)[_0x6154('0x1e')](_0x5ee958);}};}function respondWithFilteredResult(_0x2cc444,_0x1e3b54){return function(_0x2b5a27){if(_0x2b5a27){var _0x2ea6cd=typeof _0x1e3b54['offset']===_0x6154('0x1f')&&typeof _0x1e3b54[_0x6154('0x20')]===_0x6154('0x1f');var _0x25a2a2=_0x2b5a27[_0x6154('0x21')];var _0x3cccb1=_0x2ea6cd?0x0:_0x1e3b54[_0x6154('0x22')];var _0x28130e=_0x2ea6cd?_0x2b5a27['count']:_0x1e3b54[_0x6154('0x22')]+_0x1e3b54[_0x6154('0x20')];var _0x4e8acb;if(_0x28130e>=_0x25a2a2){_0x28130e=_0x25a2a2;_0x4e8acb=0xc8;}else{_0x4e8acb=0xce;}_0x2cc444['status'](_0x4e8acb);return _0x2cc444[_0x6154('0x23')](_0x6154('0x24'),_0x3cccb1+'-'+_0x28130e+'/'+_0x25a2a2)[_0x6154('0x1e')](_0x2b5a27);}return null;};}function patchUpdates(_0x4c2687){return function(_0x24cd6c){try{jsonpatch[_0x6154('0x25')](_0x24cd6c,_0x4c2687,!![]);}catch(_0x4f753c){return BPromise[_0x6154('0x26')](_0x4f753c);}return _0x24cd6c[_0x6154('0x27')]();};}function saveUpdates(_0x4e98c1,_0x543710){return function(_0x2193d6){if(_0x2193d6){return _0x2193d6[_0x6154('0x28')](_0x4e98c1)[_0x6154('0x29')](function(_0x337ecd){return _0x337ecd;});}return null;};}function removeEntity(_0x58e5d6,_0x25265d){return function(_0x207aeb){if(_0x207aeb){return _0x207aeb[_0x6154('0x2a')]()[_0x6154('0x29')](function(){_0x58e5d6['status'](0xcc)[_0x6154('0x1d')]();});}};}function handleEntityNotFound(_0x1231a4,_0x3c9f26){return function(_0x329268){if(!_0x329268){_0x1231a4[_0x6154('0x1b')](0x194);}return _0x329268;};}function handleError(_0x26bdde,_0x5c8ca2){_0x5c8ca2=_0x5c8ca2||0x1f4;return function(_0x56ca41){logger['error'](_0x56ca41['stack']);if(_0x56ca41[_0x6154('0x2b')]){delete _0x56ca41[_0x6154('0x2b')];}_0x26bdde[_0x6154('0x1c')](_0x5c8ca2)[_0x6154('0x2c')](_0x56ca41);};}exports[_0x6154('0x2d')]=function(_0x42bc96,_0x1d8e5a){var _0x5d9bb7={},_0x51ad55={},_0x583ec5={'count':0x0,'rows':[]};var _0x1ffdaa=_[_0x6154('0x2e')](db[_0x6154('0x2f')]['rawAttributes'],function(_0x3dde90){return{'name':_0x3dde90[_0x6154('0x30')],'type':_0x3dde90[_0x6154('0x31')][_0x6154('0x32')]};});_0x51ad55['model']=_[_0x6154('0x2e')](_0x1ffdaa,_0x6154('0x2b'));_0x51ad55[_0x6154('0x33')]=_['keys'](_0x42bc96['query']);_0x51ad55[_0x6154('0x34')]=_[_0x6154('0x35')](_0x51ad55[_0x6154('0x36')],_0x51ad55[_0x6154('0x33')]);_0x5d9bb7[_0x6154('0x37')]=_[_0x6154('0x35')](_0x51ad55['model'],qs['fields'](_0x42bc96[_0x6154('0x33')][_0x6154('0x38')]));_0x5d9bb7[_0x6154('0x37')]=_0x5d9bb7[_0x6154('0x37')][_0x6154('0x39')]?_0x5d9bb7[_0x6154('0x37')]:_0x51ad55[_0x6154('0x36')];if(!_0x42bc96['query']['hasOwnProperty']('nolimit')){_0x5d9bb7['limit']=qs['limit'](_0x42bc96['query'][_0x6154('0x20')]);_0x5d9bb7[_0x6154('0x22')]=qs[_0x6154('0x22')](_0x42bc96[_0x6154('0x33')][_0x6154('0x22')]);}_0x5d9bb7[_0x6154('0x3a')]=qs[_0x6154('0x3b')](_0x42bc96[_0x6154('0x33')][_0x6154('0x3b')]);_0x5d9bb7[_0x6154('0x3c')]=qs['filters'](_[_0x6154('0x3d')](_0x42bc96[_0x6154('0x33')],_0x51ad55[_0x6154('0x34')]),_0x1ffdaa);if(_0x42bc96[_0x6154('0x33')][_0x6154('0x3e')]){_0x5d9bb7['where']=_['merge'](_0x5d9bb7[_0x6154('0x3c')],{'$or':_[_0x6154('0x2e')](_0x1ffdaa,function(_0x9c11f3){if(_0x9c11f3[_0x6154('0x31')]!==_0x6154('0x3f')){var _0x1ba443={};_0x1ba443[_0x9c11f3[_0x6154('0x2b')]]={'$like':'%'+_0x42bc96[_0x6154('0x33')]['filter']+'%'};return _0x1ba443;}})});}_0x5d9bb7=_[_0x6154('0x40')]({},_0x5d9bb7,_0x42bc96[_0x6154('0x41')]);var _0x4fd6c1={'where':_0x5d9bb7[_0x6154('0x3c')]};return db[_0x6154('0x2f')][_0x6154('0x21')](_0x4fd6c1)[_0x6154('0x29')](function(_0x51a44d){_0x583ec5['count']=_0x51a44d;if(_0x42bc96[_0x6154('0x33')]['includeAll']){_0x5d9bb7[_0x6154('0x42')]=[{'all':!![]}];}return db[_0x6154('0x2f')][_0x6154('0x43')](_0x5d9bb7);})[_0x6154('0x29')](function(_0x22f689){_0x583ec5[_0x6154('0x44')]=_0x22f689;return _0x583ec5;})['then'](respondWithFilteredResult(_0x1d8e5a,_0x5d9bb7))[_0x6154('0x45')](handleError(_0x1d8e5a,null));};exports['show']=function(_0x3919c2,_0x167eb9){var _0x2aae8a={'raw':!![],'where':{'id':_0x3919c2[_0x6154('0x46')]['id']}},_0x2993a3={};_0x2993a3[_0x6154('0x36')]=_[_0x6154('0x47')](db[_0x6154('0x2f')][_0x6154('0x48')]);_0x2993a3['query']=_['keys'](_0x3919c2['query']);_0x2993a3[_0x6154('0x34')]=_[_0x6154('0x35')](_0x2993a3['model'],_0x2993a3[_0x6154('0x33')]);_0x2aae8a[_0x6154('0x37')]=_[_0x6154('0x35')](_0x2993a3[_0x6154('0x36')],qs['fields'](_0x3919c2[_0x6154('0x33')][_0x6154('0x38')]));_0x2aae8a[_0x6154('0x37')]=_0x2aae8a[_0x6154('0x37')][_0x6154('0x39')]?_0x2aae8a[_0x6154('0x37')]:_0x2993a3[_0x6154('0x36')];if(_0x3919c2['query'][_0x6154('0x49')]){_0x2aae8a['include']=[{'all':!![]}];}_0x2aae8a=_[_0x6154('0x40')]({},_0x2aae8a,_0x3919c2[_0x6154('0x41')]);return db[_0x6154('0x2f')][_0x6154('0x4a')](_0x2aae8a)[_0x6154('0x29')](handleEntityNotFound(_0x167eb9,null))[_0x6154('0x29')](respondWithResult(_0x167eb9,null))[_0x6154('0x45')](handleError(_0x167eb9,null));};exports[_0x6154('0x4b')]=function(_0xa065be,_0xb4ba8b){return db[_0x6154('0x2f')][_0x6154('0x4b')](_0xa065be['body'],{})[_0x6154('0x29')](respondWithResult(_0xb4ba8b,0xc9))[_0x6154('0x45')](handleError(_0xb4ba8b,null));};exports['update']=function(_0x5e71cf,_0x507e43){if(_0x5e71cf[_0x6154('0x4c')]['id']){delete _0x5e71cf['body']['id'];}return db[_0x6154('0x2f')][_0x6154('0x4a')]({'where':{'id':_0x5e71cf[_0x6154('0x46')]['id']}})[_0x6154('0x29')](handleEntityNotFound(_0x507e43,null))['then'](saveUpdates(_0x5e71cf[_0x6154('0x4c')],null))[_0x6154('0x29')](respondWithResult(_0x507e43,null))['catch'](handleError(_0x507e43,null));};exports[_0x6154('0x2a')]=function(_0x1281e0,_0x103313){return db['SmsTransferReport'][_0x6154('0x4a')]({'where':{'id':_0x1281e0[_0x6154('0x46')]['id']}})[_0x6154('0x29')](handleEntityNotFound(_0x103313,null))[_0x6154('0x29')](removeEntity(_0x103313,null))['catch'](handleError(_0x103313,null));};exports[_0x6154('0x4d')]=function(_0x1862c1,_0x3090cb){return db['SmsTransferReport']['describe']()[_0x6154('0x29')](respondWithResult(_0x3090cb,null))[_0x6154('0x45')](handleError(_0x3090cb,null));}; \ No newline at end of file +var _0xa4fe=['fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','include','findAll','rows','catch','params','includeAll','options','find','create','body','describe','eml-format','rimraf'];(function(_0x461925,_0x2bee39){var _0x504bd8=function(_0x188ec9){while(--_0x188ec9){_0x461925['push'](_0x461925['shift']());}};_0x504bd8(++_0x2bee39);}(_0xa4fe,0xd6));var _0xea4f=function(_0x547042,_0x51a1cb){_0x547042=_0x547042-0x0;var _0x4d8b9c=_0xa4fe[_0x547042];return _0x4d8b9c;};'use strict';var emlformat=require(_0xea4f('0x0'));var rimraf=require(_0xea4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xea4f('0x2'));var rp=require(_0xea4f('0x3'));var moment=require(_0xea4f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xea4f('0x5'));var path=require(_0xea4f('0x6'));var sox=require('sox');var csv=require(_0xea4f('0x7'));var ejs=require(_0xea4f('0x8'));var fs=require('fs');var fs_extra=require(_0xea4f('0x9'));var _=require(_0xea4f('0xa'));var squel=require(_0xea4f('0xb'));var crypto=require(_0xea4f('0xc'));var jsforce=require(_0xea4f('0xd'));var deskjs=require(_0xea4f('0xe'));var toCsv=require(_0xea4f('0x7'));var querystring=require('querystring');var Papa=require(_0xea4f('0xf'));var Redis=require('ioredis');var authService=require(_0xea4f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xea4f('0x11'));var hardwareService=require(_0xea4f('0x12'));var logger=require(_0xea4f('0x13'))(_0xea4f('0x14'));var utils=require(_0xea4f('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x220fa8,_0x1ba74b){_0x1ba74b=_0x1ba74b||0xcc;return function(_0x37cc28){if(_0x37cc28){return _0x220fa8[_0xea4f('0x16')](_0x1ba74b);}return _0x220fa8['status'](_0x1ba74b)[_0xea4f('0x17')]();};}function respondWithResult(_0x503d0,_0x5b1197){_0x5b1197=_0x5b1197||0xc8;return function(_0x1f279b){if(_0x1f279b){return _0x503d0[_0xea4f('0x18')](_0x5b1197)[_0xea4f('0x19')](_0x1f279b);}};}function respondWithFilteredResult(_0x5d1023,_0x15cd72){return function(_0x2c4862){if(_0x2c4862){var _0x4773c3=typeof _0x15cd72[_0xea4f('0x1a')]===_0xea4f('0x1b')&&typeof _0x15cd72[_0xea4f('0x1c')]===_0xea4f('0x1b');var _0x376075=_0x2c4862[_0xea4f('0x1d')];var _0x4779d2=_0x4773c3?0x0:_0x15cd72[_0xea4f('0x1a')];var _0x27b432=_0x4773c3?_0x2c4862[_0xea4f('0x1d')]:_0x15cd72[_0xea4f('0x1a')]+_0x15cd72['limit'];var _0x99c5ee;if(_0x27b432>=_0x376075){_0x27b432=_0x376075;_0x99c5ee=0xc8;}else{_0x99c5ee=0xce;}_0x5d1023[_0xea4f('0x18')](_0x99c5ee);return _0x5d1023[_0xea4f('0x1e')]('Content-Range',_0x4779d2+'-'+_0x27b432+'/'+_0x376075)[_0xea4f('0x19')](_0x2c4862);}return null;};}function patchUpdates(_0x175cfa){return function(_0x498e77){try{jsonpatch[_0xea4f('0x1f')](_0x498e77,_0x175cfa,!![]);}catch(_0x13e41f){return BPromise['reject'](_0x13e41f);}return _0x498e77[_0xea4f('0x20')]();};}function saveUpdates(_0x44eafa,_0x275f54){return function(_0x5b4e4e){if(_0x5b4e4e){return _0x5b4e4e[_0xea4f('0x21')](_0x44eafa)[_0xea4f('0x22')](function(_0x5149dd){return _0x5149dd;});}return null;};}function removeEntity(_0x7f5bf7,_0x48340d){return function(_0x31f987){if(_0x31f987){return _0x31f987[_0xea4f('0x23')]()[_0xea4f('0x22')](function(){_0x7f5bf7[_0xea4f('0x18')](0xcc)[_0xea4f('0x17')]();});}};}function handleEntityNotFound(_0x3a3ed2,_0x5d5f56){return function(_0x3755ab){if(!_0x3755ab){_0x3a3ed2[_0xea4f('0x16')](0x194);}return _0x3755ab;};}function handleError(_0x3c0931,_0x4677a1){_0x4677a1=_0x4677a1||0x1f4;return function(_0x5bd93a){logger[_0xea4f('0x24')](_0x5bd93a[_0xea4f('0x25')]);if(_0x5bd93a['name']){delete _0x5bd93a[_0xea4f('0x26')];}_0x3c0931[_0xea4f('0x18')](_0x4677a1)['send'](_0x5bd93a);};}exports[_0xea4f('0x27')]=function(_0x363938,_0x498d51){var _0x23626b={},_0x4fd4bb={},_0x8e45de={'count':0x0,'rows':[]};var _0x41d5f6=_[_0xea4f('0x28')](db[_0xea4f('0x29')][_0xea4f('0x2a')],function(_0x24baa7){return{'name':_0x24baa7[_0xea4f('0x2b')],'type':_0x24baa7[_0xea4f('0x2c')][_0xea4f('0x2d')]};});_0x4fd4bb[_0xea4f('0x2e')]=_[_0xea4f('0x28')](_0x41d5f6,_0xea4f('0x26'));_0x4fd4bb[_0xea4f('0x2f')]=_[_0xea4f('0x30')](_0x363938['query']);_0x4fd4bb['filters']=_[_0xea4f('0x31')](_0x4fd4bb[_0xea4f('0x2e')],_0x4fd4bb[_0xea4f('0x2f')]);_0x23626b[_0xea4f('0x32')]=_['intersection'](_0x4fd4bb[_0xea4f('0x2e')],qs['fields'](_0x363938['query'][_0xea4f('0x33')]));_0x23626b['attributes']=_0x23626b[_0xea4f('0x32')][_0xea4f('0x34')]?_0x23626b[_0xea4f('0x32')]:_0x4fd4bb[_0xea4f('0x2e')];if(!_0x363938[_0xea4f('0x2f')]['hasOwnProperty'](_0xea4f('0x35'))){_0x23626b['limit']=qs[_0xea4f('0x1c')](_0x363938[_0xea4f('0x2f')][_0xea4f('0x1c')]);_0x23626b[_0xea4f('0x1a')]=qs['offset'](_0x363938[_0xea4f('0x2f')][_0xea4f('0x1a')]);}_0x23626b[_0xea4f('0x36')]=qs[_0xea4f('0x37')](_0x363938[_0xea4f('0x2f')][_0xea4f('0x37')]);_0x23626b['where']=qs[_0xea4f('0x38')](_[_0xea4f('0x39')](_0x363938[_0xea4f('0x2f')],_0x4fd4bb['filters']),_0x41d5f6);if(_0x363938[_0xea4f('0x2f')]['filter']){_0x23626b[_0xea4f('0x3a')]=_[_0xea4f('0x3b')](_0x23626b[_0xea4f('0x3a')],{'$or':_[_0xea4f('0x28')](_0x41d5f6,function(_0xe7c9a9){if(_0xe7c9a9[_0xea4f('0x2c')]!==_0xea4f('0x3c')){var _0x251be3={};_0x251be3[_0xe7c9a9[_0xea4f('0x26')]]={'$like':'%'+_0x363938[_0xea4f('0x2f')]['filter']+'%'};return _0x251be3;}})});}_0x23626b=_[_0xea4f('0x3b')]({},_0x23626b,_0x363938['options']);var _0x1fa526={'where':_0x23626b[_0xea4f('0x3a')]};return db[_0xea4f('0x29')][_0xea4f('0x1d')](_0x1fa526)[_0xea4f('0x22')](function(_0xad586e){_0x8e45de[_0xea4f('0x1d')]=_0xad586e;if(_0x363938[_0xea4f('0x2f')]['includeAll']){_0x23626b[_0xea4f('0x3d')]=[{'all':!![]}];}return db[_0xea4f('0x29')][_0xea4f('0x3e')](_0x23626b);})[_0xea4f('0x22')](function(_0x4c5587){_0x8e45de[_0xea4f('0x3f')]=_0x4c5587;return _0x8e45de;})['then'](respondWithFilteredResult(_0x498d51,_0x23626b))[_0xea4f('0x40')](handleError(_0x498d51,null));};exports['show']=function(_0x31e370,_0x3370ba){var _0xefbd89={'raw':!![],'where':{'id':_0x31e370[_0xea4f('0x41')]['id']}},_0xbd2a07={};_0xbd2a07[_0xea4f('0x2e')]=_[_0xea4f('0x30')](db[_0xea4f('0x29')][_0xea4f('0x2a')]);_0xbd2a07['query']=_['keys'](_0x31e370[_0xea4f('0x2f')]);_0xbd2a07['filters']=_[_0xea4f('0x31')](_0xbd2a07[_0xea4f('0x2e')],_0xbd2a07[_0xea4f('0x2f')]);_0xefbd89[_0xea4f('0x32')]=_[_0xea4f('0x31')](_0xbd2a07[_0xea4f('0x2e')],qs[_0xea4f('0x33')](_0x31e370['query'][_0xea4f('0x33')]));_0xefbd89[_0xea4f('0x32')]=_0xefbd89[_0xea4f('0x32')][_0xea4f('0x34')]?_0xefbd89['attributes']:_0xbd2a07[_0xea4f('0x2e')];if(_0x31e370['query'][_0xea4f('0x42')]){_0xefbd89[_0xea4f('0x3d')]=[{'all':!![]}];}_0xefbd89=_[_0xea4f('0x3b')]({},_0xefbd89,_0x31e370[_0xea4f('0x43')]);return db['SmsTransferReport'][_0xea4f('0x44')](_0xefbd89)[_0xea4f('0x22')](handleEntityNotFound(_0x3370ba,null))[_0xea4f('0x22')](respondWithResult(_0x3370ba,null))[_0xea4f('0x40')](handleError(_0x3370ba,null));};exports[_0xea4f('0x45')]=function(_0x5eb2b4,_0x1a8526){return db[_0xea4f('0x29')]['create'](_0x5eb2b4[_0xea4f('0x46')],{})[_0xea4f('0x22')](respondWithResult(_0x1a8526,0xc9))[_0xea4f('0x40')](handleError(_0x1a8526,null));};exports[_0xea4f('0x21')]=function(_0x7f2b71,_0x50b110){if(_0x7f2b71[_0xea4f('0x46')]['id']){delete _0x7f2b71[_0xea4f('0x46')]['id'];}return db[_0xea4f('0x29')][_0xea4f('0x44')]({'where':{'id':_0x7f2b71[_0xea4f('0x41')]['id']}})['then'](handleEntityNotFound(_0x50b110,null))['then'](saveUpdates(_0x7f2b71[_0xea4f('0x46')],null))[_0xea4f('0x22')](respondWithResult(_0x50b110,null))[_0xea4f('0x40')](handleError(_0x50b110,null));};exports[_0xea4f('0x23')]=function(_0x53a3de,_0x49695e){return db[_0xea4f('0x29')][_0xea4f('0x44')]({'where':{'id':_0x53a3de[_0xea4f('0x41')]['id']}})[_0xea4f('0x22')](handleEntityNotFound(_0x49695e,null))[_0xea4f('0x22')](removeEntity(_0x49695e,null))[_0xea4f('0x40')](handleError(_0x49695e,null));};exports['describe']=function(_0x562f51,_0x112639){return db[_0xea4f('0x29')][_0xea4f('0x47')]()[_0xea4f('0x22')](respondWithResult(_0x112639,null))[_0xea4f('0x40')](handleError(_0x112639,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index d59f112..377f2ee 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 _0x18b8=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsTransferReport','report_sms_transfer','uniqueid'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x18b8,0xff));var _0x818b=function(_0x2124d5,_0x2bbc57){_0x2124d5=_0x2124d5-0x0;var _0x4af97d=_0x18b8[_0x2124d5];return _0x4af97d;};'use strict';var _=require(_0x818b('0x0'));var util=require(_0x818b('0x1'));var logger=require(_0x818b('0x2'))(_0x818b('0x3'));var moment=require(_0x818b('0x4'));var BPromise=require(_0x818b('0x5'));var rp=require(_0x818b('0x6'));var fs=require('fs');var path=require(_0x818b('0x7'));var rimraf=require(_0x818b('0x8'));var config=require(_0x818b('0x9'));var attributes=require('./smsTransferReport.attributes');module[_0x818b('0xa')]=function(_0x152a07,_0x653fd7){return _0x152a07[_0x818b('0xb')](_0x818b('0xc'),attributes,{'tableName':_0x818b('0xd'),'paranoid':![],'indexes':[{'name':_0x818b('0xe'),'fields':[_0x818b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe920=['../../config/environment','exports','define','uniqueid','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0x4a6b92,_0x53929c){var _0x303f17=function(_0x30a218){while(--_0x30a218){_0x4a6b92['push'](_0x4a6b92['shift']());}};_0x303f17(++_0x53929c);}(_0xe920,0x11c));var _0x0e92=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xe920[_0xef8146];return _0x5a6cb0;};'use strict';var _=require(_0x0e92('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0e92('0x1'));var BPromise=require(_0x0e92('0x2'));var rp=require(_0x0e92('0x3'));var fs=require('fs');var path=require(_0x0e92('0x4'));var rimraf=require(_0x0e92('0x5'));var config=require(_0x0e92('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0x0e92('0x7')]=function(_0xfdfcfe,_0x20020a){return _0xfdfcfe[_0x0e92('0x8')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x0e92('0x9'),'fields':[_0x0e92('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index d8a2bc2..ea4c99a 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 _0x102b=['error','code','SmsTransferReport,\x20%s,\x20%s','message','info','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request\x20sent','debug','stringify'];(function(_0x3779c1,_0x1ba85d){var _0x35ca38=function(_0x336c73){while(--_0x336c73){_0x3779c1['push'](_0x3779c1['shift']());}};_0x35ca38(++_0x1ba85d);}(_0x102b,0x1be));var _0xb102=function(_0x4428a1,_0x22b67d){_0x4428a1=_0x4428a1-0x0;var _0x1631ac=_0x102b[_0x4428a1];return _0x1631ac;};'use strict';var _=require('lodash');var util=require(_0xb102('0x0'));var moment=require('moment');var BPromise=require(_0xb102('0x1'));var rs=require(_0xb102('0x2'));var fs=require('fs');var Redis=require(_0xb102('0x3'));var db=require(_0xb102('0x4'))['db'];var utils=require(_0xb102('0x5'));var logger=require(_0xb102('0x6'))(_0xb102('0x7'));var config=require(_0xb102('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb102('0x9')][_0xb102('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd131eb,_0x256052,_0x1ee0c0){return new BPromise(function(_0x5879bb,_0x338e0f){return client['request'](_0xd131eb,_0x1ee0c0)['then'](function(_0xee2164){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x256052,_0xb102('0xb'));logger[_0xb102('0xc')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x256052,_0xb102('0xb'),JSON[_0xb102('0xd')](_0xee2164));if(_0xee2164[_0xb102('0xe')]){if(_0xee2164[_0xb102('0xe')][_0xb102('0xf')]===0x1f4){logger[_0xb102('0xe')](_0xb102('0x10'),_0x256052,_0xee2164['error'][_0xb102('0x11')]);return _0x338e0f(_0xee2164['error'][_0xb102('0x11')]);}logger[_0xb102('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x256052,_0xee2164[_0xb102('0xe')][_0xb102('0x11')]);return _0x5879bb(_0xee2164['error'][_0xb102('0x11')]);}else{logger[_0xb102('0x12')](_0xb102('0x10'),_0x256052,'request\x20sent');_0x5879bb(_0xee2164['result']['message']);}})[_0xb102('0x13')](function(_0x7f3487){logger[_0xb102('0xe')](_0xb102('0x10'),_0x256052,_0x7f3487);_0x338e0f(_0x7f3487);});});} \ No newline at end of file +var _0x1a8f=['../../mysqldb','jayson/promise','client','http','request','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3a3549,_0x4c6648){var _0x1540d6=function(_0x18a3da){while(--_0x18a3da){_0x3a3549['push'](_0x3a3549['shift']());}};_0x1540d6(++_0x4c6648);}(_0x1a8f,0x87));var _0xf1a8=function(_0x53767b,_0x3aa30b){_0x53767b=_0x53767b-0x0;var _0x29f67b=_0x1a8f[_0x53767b];return _0x29f67b;};'use strict';var _=require(_0xf1a8('0x0'));var util=require('util');var moment=require(_0xf1a8('0x1'));var BPromise=require(_0xf1a8('0x2'));var rs=require(_0xf1a8('0x3'));var fs=require('fs');var Redis=require(_0xf1a8('0x4'));var db=require(_0xf1a8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf1a8('0x6'));var client=jayson[_0xf1a8('0x7')][_0xf1a8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x540101,_0x3f2b04,_0x4bf52d){return new BPromise(function(_0xea1eb2,_0xa74b7f){return client[_0xf1a8('0x9')](_0x540101,_0x4bf52d)['then'](function(_0x3e0a25){logger['info'](_0xf1a8('0xa'),_0x3f2b04,'request\x20sent');logger[_0xf1a8('0xb')](_0xf1a8('0xc'),_0x3f2b04,_0xf1a8('0xd'),JSON[_0xf1a8('0xe')](_0x3e0a25));if(_0x3e0a25['error']){if(_0x3e0a25[_0xf1a8('0xf')]['code']===0x1f4){logger[_0xf1a8('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x3f2b04,_0x3e0a25[_0xf1a8('0xf')][_0xf1a8('0x10')]);return _0xa74b7f(_0x3e0a25[_0xf1a8('0xf')][_0xf1a8('0x10')]);}logger[_0xf1a8('0xf')](_0xf1a8('0xa'),_0x3f2b04,_0x3e0a25[_0xf1a8('0xf')][_0xf1a8('0x10')]);return _0xea1eb2(_0x3e0a25[_0xf1a8('0xf')]['message']);}else{logger[_0xf1a8('0x11')](_0xf1a8('0xa'),_0x3f2b04,_0xf1a8('0xd'));_0xea1eb2(_0x3e0a25[_0xf1a8('0x12')][_0xf1a8('0x10')]);}})[_0xf1a8('0x13')](function(_0x671ef3){logger[_0xf1a8('0xf')](_0xf1a8('0xa'),_0x3f2b04,_0x671ef3);_0xa74b7f(_0x671ef3);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 9a68fb9..c7282cc 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 _0x0ee6=['originalname','replace','format','extname','now','single','file','create','put','/:id','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','index','show','download','diskStorage','join'];(function(_0x311307,_0x26126c){var _0x46358c=function(_0x12f5a0){while(--_0x12f5a0){_0x311307['push'](_0x311307['shift']());}};_0x46358c(++_0x26126c);}(_0x0ee6,0xc9));var _0x60ee=function(_0x59c890,_0x47fcae){_0x59c890=_0x59c890-0x0;var _0x4c20c4=_0x0ee6[_0x59c890];return _0x4c20c4;};'use strict';var multer=require(_0x60ee('0x0'));var util=require(_0x60ee('0x1'));var path=require('path');var timeout=require(_0x60ee('0x2'));var express=require(_0x60ee('0x3'));var router=express['Router']();var fs_extra=require(_0x60ee('0x4'));var auth=require(_0x60ee('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x60ee('0x6'));var controller=require(_0x60ee('0x7'));router[_0x60ee('0x8')]('/',auth[_0x60ee('0x9')](),controller[_0x60ee('0xa')]);router[_0x60ee('0x8')]('/:id',auth[_0x60ee('0x9')](),controller[_0x60ee('0xb')]);router['get']('/:id/download',auth[_0x60ee('0x9')](),controller[_0x60ee('0xc')]);var upload=multer({'storage':multer[_0x60ee('0xd')]({'destination':function(_0x2400bd,_0x106713,_0x57757d){_0x57757d(null,path[_0x60ee('0xe')](config['root'],'server/files/sounds/original/'));},'filename':function(_0xf5d4c0,_0x212592,_0x469340){_0x212592[_0x60ee('0xf')]=_0x212592[_0x60ee('0xf')][_0x60ee('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x469340(null,util[_0x60ee('0x11')]('%s-%s%s',path['basename'](_0x212592[_0x60ee('0xf')],path[_0x60ee('0x12')](_0x212592[_0x60ee('0xf')])),Date[_0x60ee('0x13')](),path['extname'](_0x212592[_0x60ee('0xf')])));}})});router['post']('/',upload[_0x60ee('0x14')](_0x60ee('0x15')),controller[_0x60ee('0x16')]);router[_0x60ee('0x17')](_0x60ee('0x18'),auth['isAuthenticated'](),controller['update']);router[_0x60ee('0x19')]('/:id',auth[_0x60ee('0x9')](),controller[_0x60ee('0x19')]);module[_0x60ee('0x1a')]=router; \ No newline at end of file +var _0xbede=['Router','fs-extra','../../components/auth/service','../../config/environment','./sound.controller','isAuthenticated','index','show','get','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','now','post','single','file','create','put','update','delete','/:id','exports','multer','util','path','express'];(function(_0xa0e0d5,_0x4ca2ba){var _0x45f242=function(_0x2c392d){while(--_0x2c392d){_0xa0e0d5['push'](_0xa0e0d5['shift']());}};_0x45f242(++_0x4ca2ba);}(_0xbede,0xa6));var _0xebed=function(_0xe08e3b,_0x19c924){_0xe08e3b=_0xe08e3b-0x0;var _0x5853ad=_0xbede[_0xe08e3b];return _0x5853ad;};'use strict';var multer=require(_0xebed('0x0'));var util=require(_0xebed('0x1'));var path=require(_0xebed('0x2'));var timeout=require('connect-timeout');var express=require(_0xebed('0x3'));var router=express[_0xebed('0x4')]();var fs_extra=require(_0xebed('0x5'));var auth=require(_0xebed('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xebed('0x7'));var controller=require(_0xebed('0x8'));router['get']('/',auth[_0xebed('0x9')](),controller[_0xebed('0xa')]);router['get']('/:id',auth[_0xebed('0x9')](),controller[_0xebed('0xb')]);router[_0xebed('0xc')](_0xebed('0xd'),auth[_0xebed('0x9')](),controller[_0xebed('0xe')]);var upload=multer({'storage':multer[_0xebed('0xf')]({'destination':function(_0x5eb899,_0x92c5a8,_0x1125a8){_0x1125a8(null,path[_0xebed('0x10')](config[_0xebed('0x11')],_0xebed('0x12')));},'filename':function(_0x1ea877,_0x4968e4,_0x180a5a){_0x4968e4[_0xebed('0x13')]=_0x4968e4['originalname'][_0xebed('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x180a5a(null,util[_0xebed('0x15')](_0xebed('0x16'),path['basename'](_0x4968e4[_0xebed('0x13')],path[_0xebed('0x17')](_0x4968e4[_0xebed('0x13')])),Date[_0xebed('0x18')](),path[_0xebed('0x17')](_0x4968e4[_0xebed('0x13')])));}})});router[_0xebed('0x19')]('/',upload[_0xebed('0x1a')](_0xebed('0x1b')),controller[_0xebed('0x1c')]);router[_0xebed('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0xebed('0x1e')]);router[_0xebed('0x1f')](_0xebed('0x20'),auth[_0xebed('0x9')](),controller[_0xebed('0x1f')]);module[_0xebed('0x21')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 9c268d4..a73fa4a 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 _0xc347=['STRING','name','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0x2f5544,_0x134b17){var _0x186801=function(_0xa85bf0){while(--_0xa85bf0){_0x2f5544['push'](_0x2f5544['shift']());}};_0x186801(++_0x134b17);}(_0xc347,0x132));var _0x7c34=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xc347[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require(_0x7c34('0x0'));module[_0x7c34('0x1')]={'name':{'type':Sequelize[_0x7c34('0x2')],'unique':_0x7c34('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x7c34('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x7c34('0x2')]},'original_format':{'type':Sequelize[_0x7c34('0x2')]},'original_duration':{'type':Sequelize[_0x7c34('0x4')]},'original_sampleCount':{'type':Sequelize[_0x7c34('0x5')]},'original_channelCount':{'type':Sequelize[_0x7c34('0x6')]},'original_bitRate':{'type':Sequelize[_0x7c34('0x5')]},'original_sampleRate':{'type':Sequelize[_0x7c34('0x6')]},'converted_format':{'type':Sequelize[_0x7c34('0x2')]},'converted_duration':{'type':Sequelize[_0x7c34('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x7c34('0x5')]},'converted_channelCount':{'type':Sequelize[_0x7c34('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x7c34('0x6')]}}; \ No newline at end of file +var _0xdec1=['FLOAT','BIGINT','INTEGER','sequelize','STRING','name'];(function(_0x517681,_0x342a5e){var _0x24dac7=function(_0xd139dd){while(--_0xd139dd){_0x517681['push'](_0x517681['shift']());}};_0x24dac7(++_0x342a5e);}(_0xdec1,0x11d));var _0x1dec=function(_0x6e1bd2,_0x1dab54){_0x6e1bd2=_0x6e1bd2-0x0;var _0x3f21d4=_0xdec1[_0x6e1bd2];return _0x3f21d4;};'use strict';var Sequelize=require(_0x1dec('0x0'));module['exports']={'name':{'type':Sequelize[_0x1dec('0x1')],'unique':_0x1dec('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x1dec('0x1')]},'display_name':{'type':Sequelize[_0x1dec('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x1dec('0x1')]},'original_format':{'type':Sequelize[_0x1dec('0x1')]},'original_duration':{'type':Sequelize[_0x1dec('0x3')]},'original_sampleCount':{'type':Sequelize[_0x1dec('0x4')]},'original_channelCount':{'type':Sequelize[_0x1dec('0x5')]},'original_bitRate':{'type':Sequelize[_0x1dec('0x4')]},'original_sampleRate':{'type':Sequelize[_0x1dec('0x5')]},'converted_format':{'type':Sequelize[_0x1dec('0x1')]},'converted_duration':{'type':Sequelize[_0x1dec('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x1dec('0x4')]},'converted_channelCount':{'type':Sequelize[_0x1dec('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x1dec('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index cc24029..ba031b5 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 _0xe300=['keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','filter','type','merge','Sound','findAll','rows','catch','length','includeAll','include','find','download','params','save_name','converted_format','existsSync','join','root','ValidationError','Sound\x20not\x20found','format','%s.%s','originalname','file','basename','extname','filename','substring','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','transcode','wav','error','src','original_duration','duration','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Sounds','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','get','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xe300,0x1b5));var _0x0e30=function(_0xdf7a0d,_0x213f65){_0xdf7a0d=_0xdf7a0d-0x0;var _0x3a5d96=_0xe300[_0xdf7a0d];return _0x3a5d96;};'use strict';var emlformat=require(_0x0e30('0x0'));var rimraf=require(_0x0e30('0x1'));var zipdir=require(_0x0e30('0x2'));var jsonpatch=require(_0x0e30('0x3'));var rp=require(_0x0e30('0x4'));var moment=require(_0x0e30('0x5'));var BPromise=require(_0x0e30('0x6'));var Mustache=require(_0x0e30('0x7'));var util=require(_0x0e30('0x8'));var path=require(_0x0e30('0x9'));var sox=require(_0x0e30('0xa'));var csv=require(_0x0e30('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0e30('0xc'));var _=require(_0x0e30('0xd'));var squel=require('squel');var crypto=require(_0x0e30('0xe'));var jsforce=require(_0x0e30('0xf'));var deskjs=require(_0x0e30('0x10'));var toCsv=require(_0x0e30('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0e30('0x11'));var authService=require(_0x0e30('0x12'));var qs=require(_0x0e30('0x13'));var as=require(_0x0e30('0x14'));var hardwareService=require(_0x0e30('0x15'));var logger=require(_0x0e30('0x16'))(_0x0e30('0x17'));var utils=require(_0x0e30('0x18'));var config=require(_0x0e30('0x19'));var licenseUtil=require(_0x0e30('0x1a'));var db=require(_0x0e30('0x1b'))['db'];function respondWithStatusCode(_0x531132,_0xa42f48){_0xa42f48=_0xa42f48||0xcc;return function(_0x2c11b4){if(_0x2c11b4){return _0x531132['sendStatus'](_0xa42f48);}return _0x531132['status'](_0xa42f48)[_0x0e30('0x1c')]();};}function respondWithResult(_0x4f649e,_0x3c34c9){_0x3c34c9=_0x3c34c9||0xc8;return function(_0x4f01e8){if(_0x4f01e8){return _0x4f649e[_0x0e30('0x1d')](_0x3c34c9)[_0x0e30('0x1e')](_0x4f01e8);}};}function respondWithFilteredResult(_0x5ffce1,_0x570f6e){return function(_0x220f2e){if(_0x220f2e){var _0x478e53=typeof _0x570f6e['offset']===_0x0e30('0x1f')&&typeof _0x570f6e[_0x0e30('0x20')]===_0x0e30('0x1f');var _0x439a68=_0x220f2e[_0x0e30('0x21')];var _0x52c7be=_0x478e53?0x0:_0x570f6e[_0x0e30('0x22')];var _0x16e732=_0x478e53?_0x220f2e[_0x0e30('0x21')]:_0x570f6e[_0x0e30('0x22')]+_0x570f6e[_0x0e30('0x20')];var _0x5d3306;if(_0x16e732>=_0x439a68){_0x16e732=_0x439a68;_0x5d3306=0xc8;}else{_0x5d3306=0xce;}_0x5ffce1['status'](_0x5d3306);return _0x5ffce1[_0x0e30('0x23')](_0x0e30('0x24'),_0x52c7be+'-'+_0x16e732+'/'+_0x439a68)[_0x0e30('0x1e')](_0x220f2e);}return null;};}function patchUpdates(_0x301a44){return function(_0x1af50f){try{jsonpatch[_0x0e30('0x25')](_0x1af50f,_0x301a44,!![]);}catch(_0x2b161c){return BPromise[_0x0e30('0x26')](_0x2b161c);}return _0x1af50f['save']();};}function saveUpdates(_0x287ab1,_0x4a4a09){return function(_0xb08e02){if(_0xb08e02){return _0xb08e02[_0x0e30('0x27')](_0x287ab1)['then'](function(_0x686a97){return _0x686a97;});}return null;};}function removeEntity(_0x2e308d,_0x2f2b7a){return function(_0x5f52ea){if(_0x5f52ea){return _0x5f52ea[_0x0e30('0x28')]()[_0x0e30('0x29')](function(){var _0x28a815=_0x5f52ea[_0x0e30('0x2a')]({'plain':!![]});var _0x43cf73='Sounds';return db[_0x0e30('0x2b')]['destroy']({'where':{'type':_0x43cf73,'resourceId':_0x28a815['id']}})[_0x0e30('0x29')](function(){return _0x5f52ea;});})[_0x0e30('0x29')](function(){_0x2e308d[_0x0e30('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xab3b66,_0x1156f5){return function(_0xcbeec6){if(!_0xcbeec6){_0xab3b66[_0x0e30('0x2c')](0x194);}return _0xcbeec6;};}function handleError(_0x50bb4d,_0x55dcab){_0x55dcab=_0x55dcab||0x1f4;return function(_0x5a7c86){logger['error'](_0x5a7c86[_0x0e30('0x2d')]);if(_0x5a7c86[_0x0e30('0x2e')]){delete _0x5a7c86[_0x0e30('0x2e')];}_0x50bb4d['status'](_0x55dcab)[_0x0e30('0x2f')](_0x5a7c86);};}exports[_0x0e30('0x30')]=function(_0x57d29e,_0x2bc454){var _0x471482={},_0x334f60={},_0x3958d9={'count':0x0,'rows':[]};var _0xffe73f=_[_0x0e30('0x31')](db['Sound'][_0x0e30('0x32')],function(_0x353be6){return{'name':_0x353be6[_0x0e30('0x33')],'type':_0x353be6['type'][_0x0e30('0x34')]};});_0x334f60[_0x0e30('0x35')]=_[_0x0e30('0x31')](_0xffe73f,_0x0e30('0x2e'));_0x334f60[_0x0e30('0x36')]=_[_0x0e30('0x37')](_0x57d29e['query']);_0x334f60['filters']=_['intersection'](_0x334f60['model'],_0x334f60[_0x0e30('0x36')]);_0x471482[_0x0e30('0x38')]=_[_0x0e30('0x39')](_0x334f60[_0x0e30('0x35')],qs[_0x0e30('0x3a')](_0x57d29e[_0x0e30('0x36')]['fields']));_0x471482['attributes']=_0x471482[_0x0e30('0x38')]['length']?_0x471482['attributes']:_0x334f60[_0x0e30('0x35')];if(!_0x57d29e['query'][_0x0e30('0x3b')](_0x0e30('0x3c'))){_0x471482[_0x0e30('0x20')]=qs[_0x0e30('0x20')](_0x57d29e[_0x0e30('0x36')]['limit']);_0x471482[_0x0e30('0x22')]=qs[_0x0e30('0x22')](_0x57d29e['query'][_0x0e30('0x22')]);}_0x471482['order']=qs[_0x0e30('0x3d')](_0x57d29e[_0x0e30('0x36')][_0x0e30('0x3d')]);_0x471482[_0x0e30('0x3e')]=qs['filters'](_['pick'](_0x57d29e['query'],_0x334f60[_0x0e30('0x3f')]),_0xffe73f);if(_0x57d29e['query'][_0x0e30('0x40')]){_0x471482['where']=_['merge'](_0x471482[_0x0e30('0x3e')],{'$or':_[_0x0e30('0x31')](_0xffe73f,function(_0x2fa3df){if(_0x2fa3df[_0x0e30('0x41')]!=='VIRTUAL'){var _0x2db074={};_0x2db074[_0x2fa3df[_0x0e30('0x2e')]]={'$like':'%'+_0x57d29e[_0x0e30('0x36')][_0x0e30('0x40')]+'%'};return _0x2db074;}})});}_0x471482=_[_0x0e30('0x42')]({},_0x471482,_0x57d29e['options']);var _0x5f3678={'where':_0x471482[_0x0e30('0x3e')]};return db[_0x0e30('0x43')][_0x0e30('0x21')](_0x5f3678)[_0x0e30('0x29')](function(_0x2eca97){_0x3958d9['count']=_0x2eca97;if(_0x57d29e[_0x0e30('0x36')]['includeAll']){_0x471482['include']=[{'all':!![]}];}return db[_0x0e30('0x43')][_0x0e30('0x44')](_0x471482);})['then'](function(_0x1380e7){_0x3958d9[_0x0e30('0x45')]=_0x1380e7;return _0x3958d9;})['then'](respondWithFilteredResult(_0x2bc454,_0x471482))[_0x0e30('0x46')](handleError(_0x2bc454,null));};exports['show']=function(_0x3dfeeb,_0x409194){var _0x4d4cd0={'raw':!![],'where':{'id':_0x3dfeeb['params']['id']}},_0x346a46={};_0x346a46[_0x0e30('0x35')]=_[_0x0e30('0x37')](db[_0x0e30('0x43')][_0x0e30('0x32')]);_0x346a46[_0x0e30('0x36')]=_[_0x0e30('0x37')](_0x3dfeeb['query']);_0x346a46[_0x0e30('0x3f')]=_[_0x0e30('0x39')](_0x346a46[_0x0e30('0x35')],_0x346a46[_0x0e30('0x36')]);_0x4d4cd0[_0x0e30('0x38')]=_[_0x0e30('0x39')](_0x346a46['model'],qs[_0x0e30('0x3a')](_0x3dfeeb[_0x0e30('0x36')][_0x0e30('0x3a')]));_0x4d4cd0[_0x0e30('0x38')]=_0x4d4cd0['attributes'][_0x0e30('0x47')]?_0x4d4cd0[_0x0e30('0x38')]:_0x346a46[_0x0e30('0x35')];if(_0x3dfeeb['query'][_0x0e30('0x48')]){_0x4d4cd0[_0x0e30('0x49')]=[{'all':!![]}];}_0x4d4cd0=_[_0x0e30('0x42')]({},_0x4d4cd0,_0x3dfeeb['options']);return db[_0x0e30('0x43')][_0x0e30('0x4a')](_0x4d4cd0)[_0x0e30('0x29')](handleEntityNotFound(_0x409194,null))[_0x0e30('0x29')](respondWithResult(_0x409194,null))[_0x0e30('0x46')](handleError(_0x409194,null));};exports[_0x0e30('0x4b')]=function(_0x417aca,_0x2b3b45,_0x73b407){return db['Sound']['find']({'where':{'id':_0x417aca[_0x0e30('0x4c')]['id']},'attributes':[_0x0e30('0x2e'),_0x0e30('0x4d'),_0x0e30('0x4e')],'raw':!![]})[_0x0e30('0x29')](handleEntityNotFound(_0x2b3b45,null))[_0x0e30('0x29')](function(_0x4f9277){if(_0x4f9277){if(!fs[_0x0e30('0x4f')](path[_0x0e30('0x50')](config[_0x0e30('0x51')],'server/files/sounds/converted',_0x4f9277[_0x0e30('0x4d')]+'.'+_0x4f9277['converted_format']))){throw new db['Sequelize'][(_0x0e30('0x52'))](_0x0e30('0x53'));}return _0x2b3b45[_0x0e30('0x4b')](path['join'](config[_0x0e30('0x51')],'server/files/sounds/converted',util[_0x0e30('0x54')](_0x0e30('0x55'),_0x4f9277[_0x0e30('0x4d')],_0x4f9277[_0x0e30('0x4e')])),util[_0x0e30('0x54')](_0x0e30('0x55'),_0x4f9277[_0x0e30('0x2e')],_0x4f9277['converted_format']));}return null;})[_0x0e30('0x46')](handleError(_0x2b3b45,null));};exports['create']=function(_0x1636ec,_0x39596c,_0x5e57e1){var _0x53de4c={'name':path['basename'](_0x1636ec['file'][_0x0e30('0x56')],path['extname'](_0x1636ec[_0x0e30('0x57')][_0x0e30('0x56')])),'save_name':path[_0x0e30('0x58')](_0x1636ec['file']['filename'],path[_0x0e30('0x59')](_0x1636ec['file'][_0x0e30('0x5a')])),'original_format':path[_0x0e30('0x59')](_0x1636ec[_0x0e30('0x57')][_0x0e30('0x56')])[_0x0e30('0x5b')](0x1),'converted_format':'wav'};var _0x2a5bc1=path[_0x0e30('0x50')](config[_0x0e30('0x51')],_0x0e30('0x5c'),_0x1636ec['file'][_0x0e30('0x5a')]);var _0x5caa42=path[_0x0e30('0x50')](config[_0x0e30('0x51')],'server/files/sounds/converted',util[_0x0e30('0x54')]('%s.%s',path[_0x0e30('0x58')](_0x1636ec[_0x0e30('0x57')]['filename'],path['extname'](_0x1636ec[_0x0e30('0x57')][_0x0e30('0x5a')])),_0x53de4c[_0x0e30('0x4e')]));logger['info'](_0x0e30('0x5d'),_0x2a5bc1);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x5caa42);try{fs['chmodSync'](_0x2a5bc1,parseInt('0777',0x8));var _0x413cfe=sox[_0x0e30('0x5e')](_0x2a5bc1,_0x5caa42,{'sampleRate':0x1f40,'format':_0x0e30('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x413cfe['on'](_0x0e30('0x60'),function(_0x447ae0){fs['unlinkSync'](_0x2a5bc1);_0x39596c[_0x0e30('0x1d')](0x1f4)[_0x0e30('0x2f')](_0x447ae0);});_0x413cfe['on'](_0x0e30('0x61'),function(_0x421b6b){_0x53de4c[_0x0e30('0x62')]=isNaN(_0x421b6b['duration'])?null:_0x421b6b[_0x0e30('0x63')]*0x3e8;_0x53de4c['original_sampleCount']=isNaN(_0x421b6b[_0x0e30('0x64')])?null:_0x421b6b['sampleCount'];_0x53de4c[_0x0e30('0x65')]=isNaN(_0x421b6b[_0x0e30('0x66')])?null:_0x421b6b[_0x0e30('0x66')];_0x53de4c['original_bitRate']=isNaN(_0x421b6b[_0x0e30('0x67')])?null:_0x421b6b[_0x0e30('0x67')];_0x53de4c[_0x0e30('0x68')]=isNaN(_0x421b6b[_0x0e30('0x69')])?null:_0x421b6b[_0x0e30('0x69')];});_0x413cfe['on'](_0x0e30('0x6a'),function(_0x53c95c){_0x53de4c[_0x0e30('0x6b')]=isNaN(_0x53c95c['duration'])?null:_0x53c95c[_0x0e30('0x63')]*0x3e8;_0x53de4c['converted_sampleCount']=isNaN(_0x53c95c['sampleCount'])?null:_0x53c95c[_0x0e30('0x64')];_0x53de4c[_0x0e30('0x6c')]=isNaN(_0x53c95c[_0x0e30('0x66')])?null:_0x53c95c['channelCount'];_0x53de4c[_0x0e30('0x6d')]=isNaN(_0x53c95c[_0x0e30('0x67')])?null:_0x53c95c[_0x0e30('0x67')];_0x53de4c[_0x0e30('0x6e')]=isNaN(_0x53c95c[_0x0e30('0x69')])?null:_0x53c95c[_0x0e30('0x69')];});_0x413cfe['on'](_0x0e30('0x1c'),function(){fs[_0x0e30('0x6f')](_0x5caa42,parseInt('0777',0x8));return db[_0x0e30('0x43')][_0x0e30('0x70')](_0x53de4c)[_0x0e30('0x29')](function(_0xe8aca5){var _0x45ead6={'role':_0x1636ec[_0x0e30('0x71')][_0x0e30('0x72')],'userProfileId':_0x1636ec[_0x0e30('0x71')][_0x0e30('0x73')]};if(!_0x45ead6)throw new Error(_0x0e30('0x74'));if(_0x45ead6[_0x0e30('0x72')]===_0x0e30('0x75')){var _0x1158a7=_0xe8aca5[_0x0e30('0x2a')]({'plain':!![]});return db[_0x0e30('0x76')][_0x0e30('0x4a')]({'where':{'name':_0x0e30('0x77'),'userProfileId':_0x45ead6[_0x0e30('0x73')]},'raw':!![]})[_0x0e30('0x29')](function(_0x2733e5){if(_0x2733e5&&_0x2733e5['autoAssociation']===0x0){return db[_0x0e30('0x2b')]['create']({'name':_0x1158a7[_0x0e30('0x2e')],'resourceId':_0x1158a7['id'],'type':_0x2733e5[_0x0e30('0x2e')],'sectionId':_0x2733e5['id']},{})['then'](function(){return _0xe8aca5;});}else{return _0xe8aca5;}})['catch'](function(_0x28adcd){logger[_0x0e30('0x60')](_0x0e30('0x78'),_0x28adcd);throw _0x28adcd;});}return _0xe8aca5;})[_0x0e30('0x29')](respondWithResult(_0x39596c,null))[_0x0e30('0x46')](handleError(_0x39596c,null));});_0x413cfe['start']();}catch(_0x3af178){_0x39596c[_0x0e30('0x1d')](0x1f4)[_0x0e30('0x2f')](_0x3af178);}};exports['update']=function(_0x4f8124,_0x5b531f,_0x1f3b26){return db[_0x0e30('0x43')]['find']({'where':{'id':_0x4f8124[_0x0e30('0x4c')]['id']}})[_0x0e30('0x29')](handleEntityNotFound(_0x5b531f,null))['then'](saveUpdates(_['pick'](_0x4f8124[_0x0e30('0x71')],[_0x0e30('0x2e'),_0x0e30('0x79')]),null))[_0x0e30('0x29')](respondWithResult(_0x5b531f,null))[_0x0e30('0x46')](handleError(_0x5b531f,null));};exports[_0x0e30('0x7a')]=function(_0x49f285,_0x20a274,_0x1db2f5){return db[_0x0e30('0x43')]['find']({'where':{'id':_0x49f285[_0x0e30('0x4c')]['id']}})[_0x0e30('0x29')](function(_0x591db3){if(_0x591db3){return _0x591db3['destroy']();}})[_0x0e30('0x29')](function(_0x3eae61){var _0x15e4c6=path[_0x0e30('0x50')](config['root'],_0x0e30('0x5c'),util[_0x0e30('0x54')](_0x0e30('0x55'),_0x3eae61['save_name'],_0x3eae61['original_format']));var _0x238daa=path[_0x0e30('0x50')](config[_0x0e30('0x51')],'server/files/sounds/converted',util[_0x0e30('0x54')]('%s.%s',_0x3eae61[_0x0e30('0x4d')],_0x3eae61[_0x0e30('0x4e')]));fs['unlinkSync'](_0x15e4c6);fs['unlinkSync'](_0x238daa);return _0x3eae61;})[_0x0e30('0x29')](function(_0x2ff9c3){if(_0x2ff9c3){return _0x20a274[_0x0e30('0x1d')](0xcc)[_0x0e30('0x1c')]();}})[_0x0e30('0x29')](handleEntityNotFound(_0x20a274,null))['catch'](handleError(_0x20a274,null));}; \ No newline at end of file +var _0x6ba7=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','end','sendStatus','error','stack','name','send','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','show','params','includeAll','options','find','save_name','converted_format','existsSync','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','download','format','%s.%s','catch','create','originalname','extname','file','basename','filename','substring','wav','join','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','transcode','unlinkSync','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','0777','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Sounds','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','desk.js','papaparse'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x6ba7,0x16d));var _0x76ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6ba7[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x76ba('0x0'));var rimraf=require(_0x76ba('0x1'));var zipdir=require(_0x76ba('0x2'));var jsonpatch=require(_0x76ba('0x3'));var rp=require(_0x76ba('0x4'));var moment=require(_0x76ba('0x5'));var BPromise=require(_0x76ba('0x6'));var Mustache=require(_0x76ba('0x7'));var util=require(_0x76ba('0x8'));var path=require(_0x76ba('0x9'));var sox=require('sox');var csv=require(_0x76ba('0xa'));var ejs=require(_0x76ba('0xb'));var fs=require('fs');var fs_extra=require(_0x76ba('0xc'));var _=require('lodash');var squel=require(_0x76ba('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x76ba('0xe'));var toCsv=require(_0x76ba('0xa'));var querystring=require('querystring');var Papa=require(_0x76ba('0xf'));var Redis=require('ioredis');var authService=require(_0x76ba('0x10'));var qs=require(_0x76ba('0x11'));var as=require(_0x76ba('0x12'));var hardwareService=require(_0x76ba('0x13'));var logger=require(_0x76ba('0x14'))(_0x76ba('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x76ba('0x16'));var db=require(_0x76ba('0x17'))['db'];function respondWithStatusCode(_0x467742,_0x173788){_0x173788=_0x173788||0xcc;return function(_0x6a103e){if(_0x6a103e){return _0x467742['sendStatus'](_0x173788);}return _0x467742[_0x76ba('0x18')](_0x173788)['end']();};}function respondWithResult(_0x241a1f,_0x2df2e3){_0x2df2e3=_0x2df2e3||0xc8;return function(_0xf477c0){if(_0xf477c0){return _0x241a1f[_0x76ba('0x18')](_0x2df2e3)[_0x76ba('0x19')](_0xf477c0);}};}function respondWithFilteredResult(_0x48611e,_0x38cd6a){return function(_0x37ffc3){if(_0x37ffc3){var _0xb7cbad=typeof _0x38cd6a[_0x76ba('0x1a')]===_0x76ba('0x1b')&&typeof _0x38cd6a[_0x76ba('0x1c')]===_0x76ba('0x1b');var _0x21e564=_0x37ffc3['count'];var _0x16c3f2=_0xb7cbad?0x0:_0x38cd6a[_0x76ba('0x1a')];var _0x337386=_0xb7cbad?_0x37ffc3[_0x76ba('0x1d')]:_0x38cd6a[_0x76ba('0x1a')]+_0x38cd6a[_0x76ba('0x1c')];var _0x347dc8;if(_0x337386>=_0x21e564){_0x337386=_0x21e564;_0x347dc8=0xc8;}else{_0x347dc8=0xce;}_0x48611e[_0x76ba('0x18')](_0x347dc8);return _0x48611e[_0x76ba('0x1e')](_0x76ba('0x1f'),_0x16c3f2+'-'+_0x337386+'/'+_0x21e564)[_0x76ba('0x19')](_0x37ffc3);}return null;};}function patchUpdates(_0x51f947){return function(_0x7b8d40){try{jsonpatch[_0x76ba('0x20')](_0x7b8d40,_0x51f947,!![]);}catch(_0xecc9a5){return BPromise[_0x76ba('0x21')](_0xecc9a5);}return _0x7b8d40['save']();};}function saveUpdates(_0x3a43de,_0x4ee27d){return function(_0x525ea0){if(_0x525ea0){return _0x525ea0['update'](_0x3a43de)[_0x76ba('0x22')](function(_0x5f1861){return _0x5f1861;});}return null;};}function removeEntity(_0x581215,_0x32e5b0){return function(_0x119865){if(_0x119865){return _0x119865[_0x76ba('0x23')]()[_0x76ba('0x22')](function(){var _0x24bafd=_0x119865[_0x76ba('0x24')]({'plain':!![]});var _0x4feecf='Sounds';return db['UserProfileResource'][_0x76ba('0x23')]({'where':{'type':_0x4feecf,'resourceId':_0x24bafd['id']}})[_0x76ba('0x22')](function(){return _0x119865;});})['then'](function(){_0x581215['status'](0xcc)[_0x76ba('0x25')]();});}};}function handleEntityNotFound(_0x31879b,_0x343e51){return function(_0xbc39b8){if(!_0xbc39b8){_0x31879b[_0x76ba('0x26')](0x194);}return _0xbc39b8;};}function handleError(_0x2b3ca3,_0x4a3b7f){_0x4a3b7f=_0x4a3b7f||0x1f4;return function(_0x1a0e77){logger[_0x76ba('0x27')](_0x1a0e77[_0x76ba('0x28')]);if(_0x1a0e77['name']){delete _0x1a0e77[_0x76ba('0x29')];}_0x2b3ca3['status'](_0x4a3b7f)[_0x76ba('0x2a')](_0x1a0e77);};}exports['index']=function(_0x1471c1,_0x1d30f8){var _0x4bdb73={},_0x4645f6={},_0x1f3fac={'count':0x0,'rows':[]};var _0x3994f1=_[_0x76ba('0x2b')](db[_0x76ba('0x2c')][_0x76ba('0x2d')],function(_0x46b15d){return{'name':_0x46b15d[_0x76ba('0x2e')],'type':_0x46b15d[_0x76ba('0x2f')][_0x76ba('0x30')]};});_0x4645f6[_0x76ba('0x31')]=_[_0x76ba('0x2b')](_0x3994f1,_0x76ba('0x29'));_0x4645f6[_0x76ba('0x32')]=_[_0x76ba('0x33')](_0x1471c1[_0x76ba('0x32')]);_0x4645f6[_0x76ba('0x34')]=_[_0x76ba('0x35')](_0x4645f6[_0x76ba('0x31')],_0x4645f6[_0x76ba('0x32')]);_0x4bdb73[_0x76ba('0x36')]=_[_0x76ba('0x35')](_0x4645f6['model'],qs[_0x76ba('0x37')](_0x1471c1[_0x76ba('0x32')][_0x76ba('0x37')]));_0x4bdb73[_0x76ba('0x36')]=_0x4bdb73[_0x76ba('0x36')][_0x76ba('0x38')]?_0x4bdb73[_0x76ba('0x36')]:_0x4645f6[_0x76ba('0x31')];if(!_0x1471c1['query'][_0x76ba('0x39')](_0x76ba('0x3a'))){_0x4bdb73['limit']=qs['limit'](_0x1471c1['query'][_0x76ba('0x1c')]);_0x4bdb73[_0x76ba('0x1a')]=qs[_0x76ba('0x1a')](_0x1471c1['query'][_0x76ba('0x1a')]);}_0x4bdb73[_0x76ba('0x3b')]=qs[_0x76ba('0x3c')](_0x1471c1['query'][_0x76ba('0x3c')]);_0x4bdb73[_0x76ba('0x3d')]=qs[_0x76ba('0x34')](_[_0x76ba('0x3e')](_0x1471c1[_0x76ba('0x32')],_0x4645f6[_0x76ba('0x34')]),_0x3994f1);if(_0x1471c1[_0x76ba('0x32')]['filter']){_0x4bdb73[_0x76ba('0x3d')]=_[_0x76ba('0x3f')](_0x4bdb73['where'],{'$or':_[_0x76ba('0x2b')](_0x3994f1,function(_0x25db2f){if(_0x25db2f[_0x76ba('0x2f')]!==_0x76ba('0x40')){var _0x39e873={};_0x39e873[_0x25db2f[_0x76ba('0x29')]]={'$like':'%'+_0x1471c1[_0x76ba('0x32')][_0x76ba('0x41')]+'%'};return _0x39e873;}})});}_0x4bdb73=_[_0x76ba('0x3f')]({},_0x4bdb73,_0x1471c1['options']);var _0x4e3536={'where':_0x4bdb73[_0x76ba('0x3d')]};return db[_0x76ba('0x2c')]['count'](_0x4e3536)[_0x76ba('0x22')](function(_0x5c6abb){_0x1f3fac[_0x76ba('0x1d')]=_0x5c6abb;if(_0x1471c1[_0x76ba('0x32')]['includeAll']){_0x4bdb73[_0x76ba('0x42')]=[{'all':!![]}];}return db[_0x76ba('0x2c')][_0x76ba('0x43')](_0x4bdb73);})[_0x76ba('0x22')](function(_0x3fdb7c){_0x1f3fac['rows']=_0x3fdb7c;return _0x1f3fac;})['then'](respondWithFilteredResult(_0x1d30f8,_0x4bdb73))['catch'](handleError(_0x1d30f8,null));};exports[_0x76ba('0x44')]=function(_0xae0971,_0x187a4c){var _0x525954={'raw':!![],'where':{'id':_0xae0971[_0x76ba('0x45')]['id']}},_0x2dfe1b={};_0x2dfe1b[_0x76ba('0x31')]=_[_0x76ba('0x33')](db[_0x76ba('0x2c')][_0x76ba('0x2d')]);_0x2dfe1b[_0x76ba('0x32')]=_[_0x76ba('0x33')](_0xae0971[_0x76ba('0x32')]);_0x2dfe1b[_0x76ba('0x34')]=_[_0x76ba('0x35')](_0x2dfe1b[_0x76ba('0x31')],_0x2dfe1b[_0x76ba('0x32')]);_0x525954[_0x76ba('0x36')]=_[_0x76ba('0x35')](_0x2dfe1b[_0x76ba('0x31')],qs[_0x76ba('0x37')](_0xae0971[_0x76ba('0x32')][_0x76ba('0x37')]));_0x525954[_0x76ba('0x36')]=_0x525954['attributes'][_0x76ba('0x38')]?_0x525954[_0x76ba('0x36')]:_0x2dfe1b[_0x76ba('0x31')];if(_0xae0971[_0x76ba('0x32')][_0x76ba('0x46')]){_0x525954[_0x76ba('0x42')]=[{'all':!![]}];}_0x525954=_[_0x76ba('0x3f')]({},_0x525954,_0xae0971[_0x76ba('0x47')]);return db[_0x76ba('0x2c')]['find'](_0x525954)[_0x76ba('0x22')](handleEntityNotFound(_0x187a4c,null))['then'](respondWithResult(_0x187a4c,null))['catch'](handleError(_0x187a4c,null));};exports['download']=function(_0xf6d3a7,_0x1904b0,_0x429c04){return db[_0x76ba('0x2c')][_0x76ba('0x48')]({'where':{'id':_0xf6d3a7[_0x76ba('0x45')]['id']},'attributes':[_0x76ba('0x29'),_0x76ba('0x49'),_0x76ba('0x4a')],'raw':!![]})[_0x76ba('0x22')](handleEntityNotFound(_0x1904b0,null))[_0x76ba('0x22')](function(_0x1c54a4){if(_0x1c54a4){if(!fs[_0x76ba('0x4b')](path['join'](config[_0x76ba('0x4c')],_0x76ba('0x4d'),_0x1c54a4[_0x76ba('0x49')]+'.'+_0x1c54a4[_0x76ba('0x4a')]))){throw new db['Sequelize'][(_0x76ba('0x4e'))](_0x76ba('0x4f'));}return _0x1904b0[_0x76ba('0x50')](path['join'](config[_0x76ba('0x4c')],_0x76ba('0x4d'),util[_0x76ba('0x51')](_0x76ba('0x52'),_0x1c54a4[_0x76ba('0x49')],_0x1c54a4['converted_format'])),util['format'](_0x76ba('0x52'),_0x1c54a4[_0x76ba('0x29')],_0x1c54a4[_0x76ba('0x4a')]));}return null;})[_0x76ba('0x53')](handleError(_0x1904b0,null));};exports[_0x76ba('0x54')]=function(_0x21e7bc,_0x57e26b,_0x3590e4){var _0x5b4f7b={'name':path['basename'](_0x21e7bc['file'][_0x76ba('0x55')],path[_0x76ba('0x56')](_0x21e7bc[_0x76ba('0x57')][_0x76ba('0x55')])),'save_name':path[_0x76ba('0x58')](_0x21e7bc[_0x76ba('0x57')][_0x76ba('0x59')],path[_0x76ba('0x56')](_0x21e7bc[_0x76ba('0x57')][_0x76ba('0x59')])),'original_format':path[_0x76ba('0x56')](_0x21e7bc['file'][_0x76ba('0x55')])[_0x76ba('0x5a')](0x1),'converted_format':_0x76ba('0x5b')};var _0x3e3c9b=path[_0x76ba('0x5c')](config[_0x76ba('0x4c')],_0x76ba('0x5d'),_0x21e7bc['file'][_0x76ba('0x59')]);var _0x2581e0=path['join'](config['root'],'server/files/sounds/converted',util[_0x76ba('0x51')]('%s.%s',path[_0x76ba('0x58')](_0x21e7bc['file'][_0x76ba('0x59')],path[_0x76ba('0x56')](_0x21e7bc[_0x76ba('0x57')]['filename'])),_0x5b4f7b[_0x76ba('0x4a')]));logger[_0x76ba('0x5e')](_0x76ba('0x5f'),_0x3e3c9b);logger[_0x76ba('0x5e')](_0x76ba('0x60'),_0x2581e0);try{fs['chmodSync'](_0x3e3c9b,parseInt('0777',0x8));var _0x2a527f=sox[_0x76ba('0x61')](_0x3e3c9b,_0x2581e0,{'sampleRate':0x1f40,'format':_0x76ba('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2a527f['on'](_0x76ba('0x27'),function(_0x260605){fs[_0x76ba('0x62')](_0x3e3c9b);_0x57e26b[_0x76ba('0x18')](0x1f4)[_0x76ba('0x2a')](_0x260605);});_0x2a527f['on'](_0x76ba('0x63'),function(_0x260054){_0x5b4f7b['original_duration']=isNaN(_0x260054['duration'])?null:_0x260054[_0x76ba('0x64')]*0x3e8;_0x5b4f7b[_0x76ba('0x65')]=isNaN(_0x260054[_0x76ba('0x66')])?null:_0x260054[_0x76ba('0x66')];_0x5b4f7b[_0x76ba('0x67')]=isNaN(_0x260054[_0x76ba('0x68')])?null:_0x260054[_0x76ba('0x68')];_0x5b4f7b[_0x76ba('0x69')]=isNaN(_0x260054[_0x76ba('0x6a')])?null:_0x260054[_0x76ba('0x6a')];_0x5b4f7b[_0x76ba('0x6b')]=isNaN(_0x260054['sampleRate'])?null:_0x260054[_0x76ba('0x6c')];});_0x2a527f['on'](_0x76ba('0x6d'),function(_0x312564){_0x5b4f7b[_0x76ba('0x6e')]=isNaN(_0x312564['duration'])?null:_0x312564[_0x76ba('0x64')]*0x3e8;_0x5b4f7b[_0x76ba('0x6f')]=isNaN(_0x312564['sampleCount'])?null:_0x312564['sampleCount'];_0x5b4f7b['converted_channelCount']=isNaN(_0x312564['channelCount'])?null:_0x312564[_0x76ba('0x68')];_0x5b4f7b[_0x76ba('0x70')]=isNaN(_0x312564[_0x76ba('0x6a')])?null:_0x312564[_0x76ba('0x6a')];_0x5b4f7b['converted_sampleRate']=isNaN(_0x312564[_0x76ba('0x6c')])?null:_0x312564[_0x76ba('0x6c')];});_0x2a527f['on'](_0x76ba('0x25'),function(){fs['chmodSync'](_0x2581e0,parseInt(_0x76ba('0x71'),0x8));return db[_0x76ba('0x2c')][_0x76ba('0x54')](_0x5b4f7b)['then'](function(_0x322b88){var _0x54bcf4={'role':_0x21e7bc[_0x76ba('0x72')][_0x76ba('0x73')],'userProfileId':_0x21e7bc[_0x76ba('0x72')]['userProfileId']};if(!_0x54bcf4)throw new Error(_0x76ba('0x74'));if(_0x54bcf4[_0x76ba('0x73')]===_0x76ba('0x75')){var _0x5483f9=_0x322b88[_0x76ba('0x24')]({'plain':!![]});return db[_0x76ba('0x76')][_0x76ba('0x48')]({'where':{'name':_0x76ba('0x77'),'userProfileId':_0x54bcf4[_0x76ba('0x78')]},'raw':!![]})[_0x76ba('0x22')](function(_0x17cc8c){if(_0x17cc8c&&_0x17cc8c[_0x76ba('0x79')]===0x0){return db[_0x76ba('0x7a')]['create']({'name':_0x5483f9[_0x76ba('0x29')],'resourceId':_0x5483f9['id'],'type':_0x17cc8c['name'],'sectionId':_0x17cc8c['id']},{})[_0x76ba('0x22')](function(){return _0x322b88;});}else{return _0x322b88;}})[_0x76ba('0x53')](function(_0x41e4e7){logger['error'](_0x76ba('0x7b'),_0x41e4e7);throw _0x41e4e7;});}return _0x322b88;})[_0x76ba('0x22')](respondWithResult(_0x57e26b,null))[_0x76ba('0x53')](handleError(_0x57e26b,null));});_0x2a527f[_0x76ba('0x7c')]();}catch(_0x1d0160){_0x57e26b[_0x76ba('0x18')](0x1f4)['send'](_0x1d0160);}};exports[_0x76ba('0x7d')]=function(_0x56115d,_0x3c78da,_0x5bcd82){return db[_0x76ba('0x2c')][_0x76ba('0x48')]({'where':{'id':_0x56115d[_0x76ba('0x45')]['id']}})[_0x76ba('0x22')](handleEntityNotFound(_0x3c78da,null))[_0x76ba('0x22')](saveUpdates(_[_0x76ba('0x3e')](_0x56115d['body'],[_0x76ba('0x29'),'description']),null))[_0x76ba('0x22')](respondWithResult(_0x3c78da,null))[_0x76ba('0x53')](handleError(_0x3c78da,null));};exports['delete']=function(_0x2cde0d,_0x10443c,_0x58347a){return db[_0x76ba('0x2c')]['find']({'where':{'id':_0x2cde0d[_0x76ba('0x45')]['id']}})[_0x76ba('0x22')](function(_0x156d1e){if(_0x156d1e){return _0x156d1e['destroy']();}})['then'](function(_0x184c83){var _0x3564a7=path['join'](config['root'],_0x76ba('0x5d'),util[_0x76ba('0x51')](_0x76ba('0x52'),_0x184c83['save_name'],_0x184c83[_0x76ba('0x7e')]));var _0x3d894d=path['join'](config[_0x76ba('0x4c')],_0x76ba('0x4d'),util[_0x76ba('0x51')](_0x76ba('0x52'),_0x184c83[_0x76ba('0x49')],_0x184c83[_0x76ba('0x4a')]));fs[_0x76ba('0x62')](_0x3564a7);fs[_0x76ba('0x62')](_0x3d894d);return _0x184c83;})[_0x76ba('0x22')](function(_0x119b1a){if(_0x119b1a){return _0x10443c[_0x76ba('0x18')](0xcc)['end']();}})[_0x76ba('0x22')](handleEntityNotFound(_0x10443c,null))[_0x76ba('0x53')](handleError(_0x10443c,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 6c7c314..7d649c3 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 _0xd319=['bluebird','request-promise','rimraf','../../config/environment','exports','Sound','tools_sounds','lodash','util','api','moment'];(function(_0x296167,_0x11ac12){var _0x1aa559=function(_0x1d51c4){while(--_0x1d51c4){_0x296167['push'](_0x296167['shift']());}};_0x1aa559(++_0x11ac12);}(_0xd319,0x130));var _0x9d31=function(_0x4b5922,_0x218cbc){_0x4b5922=_0x4b5922-0x0;var _0x952eeb=_0xd319[_0x4b5922];return _0x952eeb;};'use strict';var _=require(_0x9d31('0x0'));var util=require(_0x9d31('0x1'));var logger=require('../../config/logger')(_0x9d31('0x2'));var moment=require(_0x9d31('0x3'));var BPromise=require(_0x9d31('0x4'));var rp=require(_0x9d31('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9d31('0x6'));var config=require(_0x9d31('0x7'));var attributes=require('./sound.attributes');module[_0x9d31('0x8')]=function(_0x306a2c,_0x2bb402){return _0x306a2c['define'](_0x9d31('0x9'),attributes,{'tableName':_0x9d31('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f65=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','Sound','tools_sounds','lodash','util','api'];(function(_0x895358,_0x32f914){var _0x26e26e=function(_0xf2da4a){while(--_0xf2da4a){_0x895358['push'](_0x895358['shift']());}};_0x26e26e(++_0x32f914);}(_0x4f65,0x1d1));var _0x54f6=function(_0x2d0a93,_0x499e5d){_0x2d0a93=_0x2d0a93-0x0;var _0xaff0cb=_0x4f65[_0x2d0a93];return _0xaff0cb;};'use strict';var _=require(_0x54f6('0x0'));var util=require(_0x54f6('0x1'));var logger=require('../../config/logger')(_0x54f6('0x2'));var moment=require(_0x54f6('0x3'));var BPromise=require(_0x54f6('0x4'));var rp=require(_0x54f6('0x5'));var fs=require('fs');var path=require(_0x54f6('0x6'));var rimraf=require(_0x54f6('0x7'));var config=require(_0x54f6('0x8'));var attributes=require('./sound.attributes');module[_0x54f6('0x9')]=function(_0x56ffa8,_0x194250){return _0x56ffa8['define'](_0x54f6('0xa'),attributes,{'tableName':_0x54f6('0xb'),'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 a845836..3574560 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 _0x5eec=['attributes','then','ShowSound','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','result','catch','Sound','find','options','raw','where','include','map','model'];(function(_0x4659eb,_0x4fc95e){var _0x3beab2=function(_0x27d1ae){while(--_0x27d1ae){_0x4659eb['push'](_0x4659eb['shift']());}};_0x3beab2(++_0x4fc95e);}(_0x5eec,0x6c));var _0xc5ee=function(_0x4b5c3e,_0x37d42d){_0x4b5c3e=_0x4b5c3e-0x0;var _0x58a5e2=_0x5eec[_0x4b5c3e];return _0x58a5e2;};'use strict';var _=require('lodash');var util=require(_0xc5ee('0x0'));var moment=require(_0xc5ee('0x1'));var BPromise=require('bluebird');var rs=require(_0xc5ee('0x2'));var fs=require('fs');var Redis=require(_0xc5ee('0x3'));var db=require(_0xc5ee('0x4'))['db'];var utils=require(_0xc5ee('0x5'));var logger=require(_0xc5ee('0x6'))(_0xc5ee('0x7'));var config=require(_0xc5ee('0x8'));var jayson=require(_0xc5ee('0x9'));var client=jayson[_0xc5ee('0xa')][_0xc5ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f3d80,_0x538d16,_0x2fe885){return new BPromise(function(_0x367006,_0x453942){return client[_0xc5ee('0xc')](_0x2f3d80,_0x2fe885)['then'](function(_0x4626ef){logger[_0xc5ee('0xd')]('Sound,\x20%s,\x20%s',_0x538d16,_0xc5ee('0xe'));logger[_0xc5ee('0xf')](_0xc5ee('0x10'),_0x538d16,_0xc5ee('0xe'),JSON[_0xc5ee('0x11')](_0x4626ef));if(_0x4626ef[_0xc5ee('0x12')]){if(_0x4626ef[_0xc5ee('0x12')][_0xc5ee('0x13')]===0x1f4){logger[_0xc5ee('0x12')](_0xc5ee('0x14'),_0x538d16,_0x4626ef[_0xc5ee('0x12')][_0xc5ee('0x15')]);return _0x453942(_0x4626ef['error'][_0xc5ee('0x15')]);}logger[_0xc5ee('0x12')](_0xc5ee('0x14'),_0x538d16,_0x4626ef['error']['message']);return _0x367006(_0x4626ef['error']['message']);}else{logger[_0xc5ee('0xd')](_0xc5ee('0x14'),_0x538d16,_0xc5ee('0xe'));_0x367006(_0x4626ef[_0xc5ee('0x16')][_0xc5ee('0x15')]);}})[_0xc5ee('0x17')](function(_0x40beaa){logger[_0xc5ee('0x12')](_0xc5ee('0x14'),_0x538d16,_0x40beaa);_0x453942(_0x40beaa);});});}exports['ShowSound']=function(_0xfd536e){var _0x529647=this;return new Promise(function(_0x1aed56,_0x80b740){return db[_0xc5ee('0x18')][_0xc5ee('0x19')]({'raw':_0xfd536e[_0xc5ee('0x1a')]?_0xfd536e[_0xc5ee('0x1a')][_0xc5ee('0x1b')]===undefined?!![]:![]:!![],'where':_0xfd536e[_0xc5ee('0x1a')]?_0xfd536e[_0xc5ee('0x1a')][_0xc5ee('0x1c')]||null:null,'attributes':_0xfd536e[_0xc5ee('0x1a')]?_0xfd536e[_0xc5ee('0x1a')]['attributes']||null:null,'include':_0xfd536e[_0xc5ee('0x1a')]?_0xfd536e[_0xc5ee('0x1a')][_0xc5ee('0x1d')]?_[_0xc5ee('0x1e')](_0xfd536e[_0xc5ee('0x1a')][_0xc5ee('0x1d')],function(_0x3fa3ef){return{'model':db[_0x3fa3ef[_0xc5ee('0x1f')]],'as':_0x3fa3ef['as'],'attributes':_0x3fa3ef[_0xc5ee('0x20')],'include':_0x3fa3ef[_0xc5ee('0x1d')]?_[_0xc5ee('0x1e')](_0x3fa3ef['include'],function(_0x4e8a27){return{'model':db[_0x4e8a27[_0xc5ee('0x1f')]],'as':_0x4e8a27['as'],'attributes':_0x4e8a27[_0xc5ee('0x20')],'include':_0x4e8a27[_0xc5ee('0x1d')]?_['map'](_0x4e8a27[_0xc5ee('0x1d')],function(_0x3b1c82){return{'model':db[_0x3b1c82[_0xc5ee('0x1f')]],'as':_0x3b1c82['as'],'attributes':_0x3b1c82[_0xc5ee('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc5ee('0x21')](function(_0x6050f2){logger['info'](_0xc5ee('0x22'),_0xfd536e);logger[_0xc5ee('0xf')]('ShowSound',_0xfd536e,JSON['stringify'](_0x6050f2));_0x1aed56(_0x6050f2);})[_0xc5ee('0x17')](function(_0x16518f){logger['error'](_0xc5ee('0x22'),_0x16518f[_0xc5ee('0x15')],_0xfd536e);_0x80b740(_0x529647[_0xc5ee('0x12')](0x1f4,_0x16518f['message']));});});}; \ No newline at end of file +var _0x143f=['then','info','Sound,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','Sound','options','raw','where','attributes','include','model','map','ShowSound','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x8b631b,_0x386724){var _0x3e6832=function(_0x17a132){while(--_0x17a132){_0x8b631b['push'](_0x8b631b['shift']());}};_0x3e6832(++_0x386724);}(_0x143f,0x16e));var _0xf143=function(_0x532c93,_0xdac2fe){_0x532c93=_0x532c93-0x0;var _0x177d91=_0x143f[_0x532c93];return _0x177d91;};'use strict';var _=require(_0xf143('0x0'));var util=require('util');var moment=require(_0xf143('0x1'));var BPromise=require(_0xf143('0x2'));var rs=require(_0xf143('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf143('0x4'))['db'];var utils=require(_0xf143('0x5'));var logger=require(_0xf143('0x6'))('rpc');var config=require(_0xf143('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf143('0x8')][_0xf143('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x577983,_0x4ded1f,_0xba2502){return new BPromise(function(_0x17a0e6,_0x553091){return client[_0xf143('0xa')](_0x577983,_0xba2502)[_0xf143('0xb')](function(_0x510d26){logger[_0xf143('0xc')](_0xf143('0xd'),_0x4ded1f,_0xf143('0xe'));logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x4ded1f,_0xf143('0xe'),JSON[_0xf143('0xf')](_0x510d26));if(_0x510d26['error']){if(_0x510d26[_0xf143('0x10')]['code']===0x1f4){logger['error'](_0xf143('0xd'),_0x4ded1f,_0x510d26['error'][_0xf143('0x11')]);return _0x553091(_0x510d26[_0xf143('0x10')]['message']);}logger['error'](_0xf143('0xd'),_0x4ded1f,_0x510d26[_0xf143('0x10')]['message']);return _0x17a0e6(_0x510d26[_0xf143('0x10')][_0xf143('0x11')]);}else{logger[_0xf143('0xc')](_0xf143('0xd'),_0x4ded1f,_0xf143('0xe'));_0x17a0e6(_0x510d26[_0xf143('0x12')][_0xf143('0x11')]);}})['catch'](function(_0x110b31){logger[_0xf143('0x10')](_0xf143('0xd'),_0x4ded1f,_0x110b31);_0x553091(_0x110b31);});});}exports['ShowSound']=function(_0x6765cd){var _0x471110=this;return new Promise(function(_0x18bcf1,_0xcbf3a){return db[_0xf143('0x13')]['find']({'raw':_0x6765cd[_0xf143('0x14')]?_0x6765cd[_0xf143('0x14')][_0xf143('0x15')]===undefined?!![]:![]:!![],'where':_0x6765cd[_0xf143('0x14')]?_0x6765cd[_0xf143('0x14')][_0xf143('0x16')]||null:null,'attributes':_0x6765cd['options']?_0x6765cd['options'][_0xf143('0x17')]||null:null,'include':_0x6765cd[_0xf143('0x14')]?_0x6765cd[_0xf143('0x14')][_0xf143('0x18')]?_['map'](_0x6765cd['options'][_0xf143('0x18')],function(_0x3df12a){return{'model':db[_0x3df12a[_0xf143('0x19')]],'as':_0x3df12a['as'],'attributes':_0x3df12a[_0xf143('0x17')],'include':_0x3df12a[_0xf143('0x18')]?_['map'](_0x3df12a[_0xf143('0x18')],function(_0x1ee8ec){return{'model':db[_0x1ee8ec['model']],'as':_0x1ee8ec['as'],'attributes':_0x1ee8ec[_0xf143('0x17')],'include':_0x1ee8ec[_0xf143('0x18')]?_[_0xf143('0x1a')](_0x1ee8ec[_0xf143('0x18')],function(_0x2ea8c1){return{'model':db[_0x2ea8c1[_0xf143('0x19')]],'as':_0x2ea8c1['as'],'attributes':_0x2ea8c1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3844ea){logger[_0xf143('0xc')](_0xf143('0x1b'),_0x6765cd);logger['debug'](_0xf143('0x1b'),_0x6765cd,JSON[_0xf143('0xf')](_0x3844ea));_0x18bcf1(_0x3844ea);})[_0xf143('0x1c')](function(_0x54ae92){logger[_0xf143('0x10')]('ShowSound',_0x54ae92[_0xf143('0x11')],_0x6765cd);_0xcbf3a(_0x471110[_0xf143('0x10')](0x1f4,_0x54ae92[_0xf143('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 964530e..565b470 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 _0x9ffd=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1ac94a,_0x4faa73){_0x1ac94a=_0x1ac94a-0x0;var _0x32c65a=_0x9ffd[_0x1ac94a];return _0x32c65a;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xe')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9ff('0x10')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('0x12')]=router; \ No newline at end of file +var _0x757a=['destroy','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0x490b05,_0x7f0934){var _0x37ad3c=function(_0x4260d0){while(--_0x4260d0){_0x490b05['push'](_0x490b05['shift']());}};_0x37ad3c(++_0x7f0934);}(_0x757a,0xde));var _0xa757=function(_0x4679b8,_0x244102){_0x4679b8=_0x4679b8-0x0;var _0xd51d7c=_0x757a[_0x4679b8];return _0xd51d7c;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0xb')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xc')]);router['put'](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 6f8c495..bc59c0d 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 _0xfee7=['sequelize','exports','STRING','medium','ENUM','out','TEXT'];(function(_0x30543f,_0x5760a3){var _0x323d1d=function(_0xd8fe23){while(--_0xd8fe23){_0x30543f['push'](_0x30543f['shift']());}};_0x323d1d(++_0x5760a3);}(_0xfee7,0x11f));var _0x7fee=function(_0x4e5d19,_0x1c8866){_0x4e5d19=_0x4e5d19-0x0;var _0x38de5e=_0xfee7[_0x4e5d19];return _0x38de5e;};'use strict';var Sequelize=require(_0x7fee('0x0'));module[_0x7fee('0x1')]={'uniqueid':{'type':Sequelize[_0x7fee('0x2')]},'body':{'type':Sequelize['TEXT'](_0x7fee('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x7fee('0x4')]('in',_0x7fee('0x5')),'defaultValue':_0x7fee('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x7fee('0x2')]},'providerResponse':{'type':Sequelize[_0x7fee('0x6')]}}; \ No newline at end of file +var _0x91d3=['TEXT','medium','ENUM','sequelize','STRING'];(function(_0x513a3e,_0xa7d9c5){var _0x2c8d04=function(_0xd47298){while(--_0xd47298){_0x513a3e['push'](_0x513a3e['shift']());}};_0x2c8d04(++_0xa7d9c5);}(_0x91d3,0xa8));var _0x391d=function(_0x2dfebc,_0x5a3398){_0x2dfebc=_0x2dfebc-0x0;var _0x361b39=_0x91d3[_0x2dfebc];return _0x361b39;};'use strict';var Sequelize=require(_0x391d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x391d('0x1')]},'body':{'type':Sequelize[_0x391d('0x2')](_0x391d('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x391d('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x391d('0x1')]},'providerResponse':{'type':Sequelize[_0x391d('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index cd8c7fe..2dd4164 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 _0xffdd=['jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','stack','name','send','index','rawAttributes','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','map','VIRTUAL','options','SquareMessage','include','findAll','catch','show','params','includeAll','create','body','find','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','squel','crypto'];(function(_0x2fff83,_0x29d5fe){var _0xa2a722=function(_0x18b6b0){while(--_0x18b6b0){_0x2fff83['push'](_0x2fff83['shift']());}};_0xa2a722(++_0x29d5fe);}(_0xffdd,0x193));var _0xdffd=function(_0x1021ad,_0x322fdf){_0x1021ad=_0x1021ad-0x0;var _0x38dc6c=_0xffdd[_0x1021ad];return _0x38dc6c;};'use strict';var emlformat=require(_0xdffd('0x0'));var rimraf=require(_0xdffd('0x1'));var zipdir=require(_0xdffd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdffd('0x3'));var BPromise=require(_0xdffd('0x4'));var Mustache=require('mustache');var util=require(_0xdffd('0x5'));var path=require(_0xdffd('0x6'));var sox=require(_0xdffd('0x7'));var csv=require(_0xdffd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdffd('0x9'));var crypto=require(_0xdffd('0xa'));var jsforce=require(_0xdffd('0xb'));var deskjs=require(_0xdffd('0xc'));var toCsv=require(_0xdffd('0x8'));var querystring=require(_0xdffd('0xd'));var Papa=require(_0xdffd('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdffd('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdffd('0x10'));var utils=require(_0xdffd('0x11'));var config=require(_0xdffd('0x12'));var licenseUtil=require(_0xdffd('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a77c0,_0x38f7c0){_0x38f7c0=_0x38f7c0||0xcc;return function(_0x5df90b){if(_0x5df90b){return _0x5a77c0[_0xdffd('0x14')](_0x38f7c0);}return _0x5a77c0[_0xdffd('0x15')](_0x38f7c0)[_0xdffd('0x16')]();};}function respondWithResult(_0x5f4b1f,_0xd83407){_0xd83407=_0xd83407||0xc8;return function(_0x2cf7eb){if(_0x2cf7eb){return _0x5f4b1f[_0xdffd('0x15')](_0xd83407)[_0xdffd('0x17')](_0x2cf7eb);}};}function respondWithFilteredResult(_0x155e89,_0x1436e3){return function(_0xa38188){if(_0xa38188){var _0x5cb5f7=typeof _0x1436e3[_0xdffd('0x18')]==='undefined'&&typeof _0x1436e3[_0xdffd('0x19')]===_0xdffd('0x1a');var _0x2eb70b=_0xa38188['count'];var _0xdcc09f=_0x5cb5f7?0x0:_0x1436e3['offset'];var _0x16a733=_0x5cb5f7?_0xa38188[_0xdffd('0x1b')]:_0x1436e3[_0xdffd('0x18')]+_0x1436e3[_0xdffd('0x19')];var _0x7ee422;if(_0x16a733>=_0x2eb70b){_0x16a733=_0x2eb70b;_0x7ee422=0xc8;}else{_0x7ee422=0xce;}_0x155e89[_0xdffd('0x15')](_0x7ee422);return _0x155e89[_0xdffd('0x1c')]('Content-Range',_0xdcc09f+'-'+_0x16a733+'/'+_0x2eb70b)[_0xdffd('0x17')](_0xa38188);}return null;};}function patchUpdates(_0x4f7eef){return function(_0x3c33b9){try{jsonpatch[_0xdffd('0x1d')](_0x3c33b9,_0x4f7eef,!![]);}catch(_0x4a03fd){return BPromise[_0xdffd('0x1e')](_0x4a03fd);}return _0x3c33b9['save']();};}function saveUpdates(_0x1e2cff,_0xdb4b1){return function(_0x1a8d64){if(_0x1a8d64){return _0x1a8d64[_0xdffd('0x1f')](_0x1e2cff)[_0xdffd('0x20')](function(_0x5a35dd){return _0x5a35dd;});}return null;};}function removeEntity(_0x38ebb2,_0x1a5926){return function(_0x507eca){if(_0x507eca){return _0x507eca[_0xdffd('0x21')]()[_0xdffd('0x20')](function(){_0x38ebb2[_0xdffd('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x324b3e,_0x55140d){return function(_0x13273a){if(!_0x13273a){_0x324b3e[_0xdffd('0x14')](0x194);}return _0x13273a;};}function handleError(_0x33d9a7,_0x30d802){_0x30d802=_0x30d802||0x1f4;return function(_0x2f0c69){logger['error'](_0x2f0c69[_0xdffd('0x22')]);if(_0x2f0c69[_0xdffd('0x23')]){delete _0x2f0c69['name'];}_0x33d9a7[_0xdffd('0x15')](_0x30d802)[_0xdffd('0x24')](_0x2f0c69);};}exports[_0xdffd('0x25')]=function(_0x29d3e5,_0x709ad1){var _0x2b43fb={},_0x1c3289={},_0xd758d5={'count':0x0,'rows':[]};var _0x5bd0e7=_['map'](db['SquareMessage'][_0xdffd('0x26')],function(_0x4d12fd){return{'name':_0x4d12fd['fieldName'],'type':_0x4d12fd[_0xdffd('0x27')][_0xdffd('0x28')]};});_0x1c3289['model']=_['map'](_0x5bd0e7,_0xdffd('0x23'));_0x1c3289[_0xdffd('0x29')]=_[_0xdffd('0x2a')](_0x29d3e5[_0xdffd('0x29')]);_0x1c3289['filters']=_['intersection'](_0x1c3289[_0xdffd('0x2b')],_0x1c3289[_0xdffd('0x29')]);_0x2b43fb['attributes']=_[_0xdffd('0x2c')](_0x1c3289['model'],qs[_0xdffd('0x2d')](_0x29d3e5[_0xdffd('0x29')][_0xdffd('0x2d')]));_0x2b43fb[_0xdffd('0x2e')]=_0x2b43fb['attributes'][_0xdffd('0x2f')]?_0x2b43fb['attributes']:_0x1c3289[_0xdffd('0x2b')];if(!_0x29d3e5['query'][_0xdffd('0x30')](_0xdffd('0x31'))){_0x2b43fb[_0xdffd('0x19')]=qs[_0xdffd('0x19')](_0x29d3e5[_0xdffd('0x29')][_0xdffd('0x19')]);_0x2b43fb[_0xdffd('0x18')]=qs[_0xdffd('0x18')](_0x29d3e5['query']['offset']);}_0x2b43fb['order']=qs[_0xdffd('0x32')](_0x29d3e5[_0xdffd('0x29')][_0xdffd('0x32')]);_0x2b43fb[_0xdffd('0x33')]=qs['filters'](_[_0xdffd('0x34')](_0x29d3e5[_0xdffd('0x29')],_0x1c3289[_0xdffd('0x35')]),_0x5bd0e7);if(_0x29d3e5[_0xdffd('0x29')][_0xdffd('0x36')]){_0x2b43fb[_0xdffd('0x33')]=_[_0xdffd('0x37')](_0x2b43fb[_0xdffd('0x33')],{'$or':_[_0xdffd('0x38')](_0x5bd0e7,function(_0x383e57){if(_0x383e57[_0xdffd('0x27')]!==_0xdffd('0x39')){var _0x409b17={};_0x409b17[_0x383e57[_0xdffd('0x23')]]={'$like':'%'+_0x29d3e5[_0xdffd('0x29')]['filter']+'%'};return _0x409b17;}})});}_0x2b43fb=_[_0xdffd('0x37')]({},_0x2b43fb,_0x29d3e5[_0xdffd('0x3a')]);var _0x34e680={'where':_0x2b43fb[_0xdffd('0x33')]};return db[_0xdffd('0x3b')][_0xdffd('0x1b')](_0x34e680)[_0xdffd('0x20')](function(_0x5c82eb){_0xd758d5['count']=_0x5c82eb;if(_0x29d3e5['query']['includeAll']){_0x2b43fb[_0xdffd('0x3c')]=[{'all':!![]}];}return db[_0xdffd('0x3b')][_0xdffd('0x3d')](_0x2b43fb);})['then'](function(_0x3b29a2){_0xd758d5['rows']=_0x3b29a2;return _0xd758d5;})[_0xdffd('0x20')](respondWithFilteredResult(_0x709ad1,_0x2b43fb))[_0xdffd('0x3e')](handleError(_0x709ad1,null));};exports[_0xdffd('0x3f')]=function(_0x4e8021,_0x11c258){var _0xf48c69={'raw':!![],'where':{'id':_0x4e8021[_0xdffd('0x40')]['id']}},_0x50d676={};_0x50d676[_0xdffd('0x2b')]=_[_0xdffd('0x2a')](db['SquareMessage']['rawAttributes']);_0x50d676[_0xdffd('0x29')]=_[_0xdffd('0x2a')](_0x4e8021[_0xdffd('0x29')]);_0x50d676['filters']=_[_0xdffd('0x2c')](_0x50d676[_0xdffd('0x2b')],_0x50d676[_0xdffd('0x29')]);_0xf48c69['attributes']=_['intersection'](_0x50d676[_0xdffd('0x2b')],qs[_0xdffd('0x2d')](_0x4e8021[_0xdffd('0x29')][_0xdffd('0x2d')]));_0xf48c69[_0xdffd('0x2e')]=_0xf48c69[_0xdffd('0x2e')][_0xdffd('0x2f')]?_0xf48c69['attributes']:_0x50d676[_0xdffd('0x2b')];if(_0x4e8021[_0xdffd('0x29')][_0xdffd('0x41')]){_0xf48c69[_0xdffd('0x3c')]=[{'all':!![]}];}_0xf48c69=_[_0xdffd('0x37')]({},_0xf48c69,_0x4e8021[_0xdffd('0x3a')]);return db[_0xdffd('0x3b')]['find'](_0xf48c69)[_0xdffd('0x20')](handleEntityNotFound(_0x11c258,null))[_0xdffd('0x20')](respondWithResult(_0x11c258,null))['catch'](handleError(_0x11c258,null));};exports[_0xdffd('0x42')]=function(_0x3a9f1f,_0x5b07bb){return db[_0xdffd('0x3b')][_0xdffd('0x42')](_0x3a9f1f[_0xdffd('0x43')],{})['then'](respondWithResult(_0x5b07bb,0xc9))[_0xdffd('0x3e')](handleError(_0x5b07bb,null));};exports['update']=function(_0x3a8de7,_0x4520c3){if(_0x3a8de7[_0xdffd('0x43')]['id']){delete _0x3a8de7[_0xdffd('0x43')]['id'];}return db[_0xdffd('0x3b')]['find']({'where':{'id':_0x3a8de7[_0xdffd('0x40')]['id']}})['then'](handleEntityNotFound(_0x4520c3,null))[_0xdffd('0x20')](saveUpdates(_0x3a8de7['body'],null))[_0xdffd('0x20')](respondWithResult(_0x4520c3,null))[_0xdffd('0x3e')](handleError(_0x4520c3,null));};exports[_0xdffd('0x21')]=function(_0x3c2fb3,_0x4651c5){return db[_0xdffd('0x3b')][_0xdffd('0x44')]({'where':{'id':_0x3c2fb3[_0xdffd('0x40')]['id']}})[_0xdffd('0x20')](handleEntityNotFound(_0x4651c5,null))[_0xdffd('0x20')](removeEntity(_0x4651c5,null))[_0xdffd('0x3e')](handleError(_0x4651c5,null));}; \ No newline at end of file +var _0x7610=['type','VIRTUAL','options','includeAll','include','rows','show','keys','fields','find','create','catch','body','params','eml-format','zip-dir','moment','bluebird','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','api','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','sendStatus','stack','name','send','SquareMessage','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','merge'];(function(_0x56756f,_0x33660f){var _0x5c87b3=function(_0x399811){while(--_0x399811){_0x56756f['push'](_0x56756f['shift']());}};_0x5c87b3(++_0x33660f);}(_0x7610,0x167));var _0x0761=function(_0x5928de,_0x40ca03){_0x5928de=_0x5928de-0x0;var _0x47e533=_0x7610[_0x5928de];return _0x47e533;};'use strict';var emlformat=require(_0x0761('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0761('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0761('0x2'));var BPromise=require(_0x0761('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0761('0x4'));var sox=require(_0x0761('0x5'));var csv=require(_0x0761('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0761('0x7'));var _=require(_0x0761('0x8'));var squel=require('squel');var crypto=require(_0x0761('0x9'));var jsforce=require(_0x0761('0xa'));var deskjs=require(_0x0761('0xb'));var toCsv=require(_0x0761('0x6'));var querystring=require(_0x0761('0xc'));var Papa=require('papaparse');var Redis=require(_0x0761('0xd'));var authService=require(_0x0761('0xe'));var qs=require(_0x0761('0xf'));var as=require(_0x0761('0x10'));var hardwareService=require(_0x0761('0x11'));var logger=require('../../config/logger')(_0x0761('0x12'));var utils=require('../../config/utils');var config=require(_0x0761('0x13'));var licenseUtil=require(_0x0761('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f52d5,_0x4ac78b){_0x4ac78b=_0x4ac78b||0xcc;return function(_0x5dd133){if(_0x5dd133){return _0x4f52d5['sendStatus'](_0x4ac78b);}return _0x4f52d5[_0x0761('0x15')](_0x4ac78b)[_0x0761('0x16')]();};}function respondWithResult(_0x3d4eb0,_0x42448d){_0x42448d=_0x42448d||0xc8;return function(_0x48a615){if(_0x48a615){return _0x3d4eb0[_0x0761('0x15')](_0x42448d)[_0x0761('0x17')](_0x48a615);}};}function respondWithFilteredResult(_0x2ad3d7,_0x4d7b3f){return function(_0x5b4998){if(_0x5b4998){var _0x56a857=typeof _0x4d7b3f['offset']===_0x0761('0x18')&&typeof _0x4d7b3f[_0x0761('0x19')]===_0x0761('0x18');var _0x514022=_0x5b4998[_0x0761('0x1a')];var _0x4f0d0b=_0x56a857?0x0:_0x4d7b3f[_0x0761('0x1b')];var _0x4a0525=_0x56a857?_0x5b4998[_0x0761('0x1a')]:_0x4d7b3f[_0x0761('0x1b')]+_0x4d7b3f[_0x0761('0x19')];var _0x4965bf;if(_0x4a0525>=_0x514022){_0x4a0525=_0x514022;_0x4965bf=0xc8;}else{_0x4965bf=0xce;}_0x2ad3d7[_0x0761('0x15')](_0x4965bf);return _0x2ad3d7[_0x0761('0x1c')](_0x0761('0x1d'),_0x4f0d0b+'-'+_0x4a0525+'/'+_0x514022)[_0x0761('0x17')](_0x5b4998);}return null;};}function patchUpdates(_0x3f7f11){return function(_0x7df392){try{jsonpatch[_0x0761('0x1e')](_0x7df392,_0x3f7f11,!![]);}catch(_0x5cd9c8){return BPromise['reject'](_0x5cd9c8);}return _0x7df392[_0x0761('0x1f')]();};}function saveUpdates(_0x2cc68c,_0x5230a2){return function(_0x5ce49f){if(_0x5ce49f){return _0x5ce49f['update'](_0x2cc68c)[_0x0761('0x20')](function(_0x4fd4cb){return _0x4fd4cb;});}return null;};}function removeEntity(_0x252926,_0x5953b8){return function(_0x52b458){if(_0x52b458){return _0x52b458[_0x0761('0x21')]()[_0x0761('0x20')](function(){_0x252926['status'](0xcc)[_0x0761('0x16')]();});}};}function handleEntityNotFound(_0x5ccefc,_0x3f8f80){return function(_0x26f687){if(!_0x26f687){_0x5ccefc[_0x0761('0x22')](0x194);}return _0x26f687;};}function handleError(_0x3a9c88,_0x569249){_0x569249=_0x569249||0x1f4;return function(_0x3c1349){logger['error'](_0x3c1349[_0x0761('0x23')]);if(_0x3c1349[_0x0761('0x24')]){delete _0x3c1349[_0x0761('0x24')];}_0x3a9c88[_0x0761('0x15')](_0x569249)[_0x0761('0x25')](_0x3c1349);};}exports['index']=function(_0x589f66,_0x1e2d88){var _0x2e1957={},_0x23274a={},_0x1803fa={'count':0x0,'rows':[]};var _0x426ac3=_['map'](db[_0x0761('0x26')][_0x0761('0x27')],function(_0x5c2853){return{'name':_0x5c2853[_0x0761('0x28')],'type':_0x5c2853['type'][_0x0761('0x29')]};});_0x23274a[_0x0761('0x2a')]=_[_0x0761('0x2b')](_0x426ac3,'name');_0x23274a[_0x0761('0x2c')]=_['keys'](_0x589f66['query']);_0x23274a[_0x0761('0x2d')]=_[_0x0761('0x2e')](_0x23274a[_0x0761('0x2a')],_0x23274a[_0x0761('0x2c')]);_0x2e1957[_0x0761('0x2f')]=_[_0x0761('0x2e')](_0x23274a[_0x0761('0x2a')],qs['fields'](_0x589f66['query']['fields']));_0x2e1957[_0x0761('0x2f')]=_0x2e1957['attributes'][_0x0761('0x30')]?_0x2e1957[_0x0761('0x2f')]:_0x23274a[_0x0761('0x2a')];if(!_0x589f66[_0x0761('0x2c')][_0x0761('0x31')]('nolimit')){_0x2e1957['limit']=qs[_0x0761('0x19')](_0x589f66['query']['limit']);_0x2e1957[_0x0761('0x1b')]=qs[_0x0761('0x1b')](_0x589f66[_0x0761('0x2c')][_0x0761('0x1b')]);}_0x2e1957['order']=qs[_0x0761('0x32')](_0x589f66['query']['sort']);_0x2e1957[_0x0761('0x33')]=qs[_0x0761('0x2d')](_[_0x0761('0x34')](_0x589f66['query'],_0x23274a[_0x0761('0x2d')]),_0x426ac3);if(_0x589f66[_0x0761('0x2c')][_0x0761('0x35')]){_0x2e1957['where']=_[_0x0761('0x36')](_0x2e1957[_0x0761('0x33')],{'$or':_['map'](_0x426ac3,function(_0x2ef99d){if(_0x2ef99d[_0x0761('0x37')]!==_0x0761('0x38')){var _0x4ac694={};_0x4ac694[_0x2ef99d[_0x0761('0x24')]]={'$like':'%'+_0x589f66[_0x0761('0x2c')][_0x0761('0x35')]+'%'};return _0x4ac694;}})});}_0x2e1957=_[_0x0761('0x36')]({},_0x2e1957,_0x589f66[_0x0761('0x39')]);var _0x4b1ecc={'where':_0x2e1957[_0x0761('0x33')]};return db['SquareMessage']['count'](_0x4b1ecc)[_0x0761('0x20')](function(_0x1c19a0){_0x1803fa[_0x0761('0x1a')]=_0x1c19a0;if(_0x589f66[_0x0761('0x2c')][_0x0761('0x3a')]){_0x2e1957[_0x0761('0x3b')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x2e1957);})[_0x0761('0x20')](function(_0x58f272){_0x1803fa[_0x0761('0x3c')]=_0x58f272;return _0x1803fa;})[_0x0761('0x20')](respondWithFilteredResult(_0x1e2d88,_0x2e1957))['catch'](handleError(_0x1e2d88,null));};exports[_0x0761('0x3d')]=function(_0xf71c74,_0x70377c){var _0x5d8eb5={'raw':!![],'where':{'id':_0xf71c74['params']['id']}},_0x1c1c0d={};_0x1c1c0d[_0x0761('0x2a')]=_[_0x0761('0x3e')](db[_0x0761('0x26')][_0x0761('0x27')]);_0x1c1c0d[_0x0761('0x2c')]=_[_0x0761('0x3e')](_0xf71c74[_0x0761('0x2c')]);_0x1c1c0d[_0x0761('0x2d')]=_[_0x0761('0x2e')](_0x1c1c0d['model'],_0x1c1c0d[_0x0761('0x2c')]);_0x5d8eb5['attributes']=_[_0x0761('0x2e')](_0x1c1c0d['model'],qs[_0x0761('0x3f')](_0xf71c74['query'][_0x0761('0x3f')]));_0x5d8eb5[_0x0761('0x2f')]=_0x5d8eb5[_0x0761('0x2f')][_0x0761('0x30')]?_0x5d8eb5[_0x0761('0x2f')]:_0x1c1c0d[_0x0761('0x2a')];if(_0xf71c74[_0x0761('0x2c')][_0x0761('0x3a')]){_0x5d8eb5[_0x0761('0x3b')]=[{'all':!![]}];}_0x5d8eb5=_[_0x0761('0x36')]({},_0x5d8eb5,_0xf71c74['options']);return db['SquareMessage'][_0x0761('0x40')](_0x5d8eb5)[_0x0761('0x20')](handleEntityNotFound(_0x70377c,null))[_0x0761('0x20')](respondWithResult(_0x70377c,null))['catch'](handleError(_0x70377c,null));};exports[_0x0761('0x41')]=function(_0x20bc98,_0x54eaa6){return db[_0x0761('0x26')][_0x0761('0x41')](_0x20bc98['body'],{})[_0x0761('0x20')](respondWithResult(_0x54eaa6,0xc9))[_0x0761('0x42')](handleError(_0x54eaa6,null));};exports['update']=function(_0x40bbd4,_0x39b248){if(_0x40bbd4['body']['id']){delete _0x40bbd4[_0x0761('0x43')]['id'];}return db[_0x0761('0x26')]['find']({'where':{'id':_0x40bbd4[_0x0761('0x44')]['id']}})['then'](handleEntityNotFound(_0x39b248,null))['then'](saveUpdates(_0x40bbd4[_0x0761('0x43')],null))['then'](respondWithResult(_0x39b248,null))[_0x0761('0x42')](handleError(_0x39b248,null));};exports[_0x0761('0x21')]=function(_0x4c2a24,_0x2cad21){return db[_0x0761('0x26')][_0x0761('0x40')]({'where':{'id':_0x4c2a24[_0x0761('0x44')]['id']}})[_0x0761('0x20')](handleEntityNotFound(_0x2cad21,null))['then'](removeEntity(_0x2cad21,null))[_0x0761('0x42')](handleError(_0x2cad21,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 6cad390..21662fc 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 _0x0384=['moment','bluebird','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','lodash','api'];(function(_0x4a300c,_0xd6e060){var _0x5dcf92=function(_0x2a0e93){while(--_0x2a0e93){_0x4a300c['push'](_0x4a300c['shift']());}};_0x5dcf92(++_0xd6e060);}(_0x0384,0xb2));var _0x4038=function(_0x4a5a2e,_0x521a84){_0x4a5a2e=_0x4a5a2e-0x0;var _0x8040fa=_0x0384[_0x4a5a2e];return _0x8040fa;};'use strict';var _=require(_0x4038('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4038('0x1'));var moment=require(_0x4038('0x2'));var BPromise=require(_0x4038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4038('0x4'));var config=require(_0x4038('0x5'));var attributes=require(_0x4038('0x6'));module[_0x4038('0x7')]=function(_0xf481ed,_0x50592a){return _0xf481ed[_0x4038('0x8')](_0x4038('0x9'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2740=['SquareMessage','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x4b0890,_0x3e63eb){var _0x5398eb=function(_0xd98954){while(--_0xd98954){_0x4b0890['push'](_0x4b0890['shift']());}};_0x5398eb(++_0x3e63eb);}(_0x2740,0x1c4));var _0x0274=function(_0x206b24,_0x15fefb){_0x206b24=_0x206b24-0x0;var _0x41fb12=_0x2740[_0x206b24];return _0x41fb12;};'use strict';var _=require(_0x0274('0x0'));var util=require(_0x0274('0x1'));var logger=require(_0x0274('0x2'))(_0x0274('0x3'));var moment=require(_0x0274('0x4'));var BPromise=require(_0x0274('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0274('0x6'));var rimraf=require(_0x0274('0x7'));var config=require(_0x0274('0x8'));var attributes=require('./squareMessage.attributes');module['exports']=function(_0xa047bc,_0x49ce01){return _0xa047bc[_0x0274('0x9')](_0x0274('0xa'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 0f3e346..e850601 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 _0x8731=['../../config/environment','jayson/promise','client','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x412221,_0x236100){var _0x28c7af=function(_0x5635ee){while(--_0x5635ee){_0x412221['push'](_0x412221['shift']());}};_0x28c7af(++_0x236100);}(_0x8731,0x18e));var _0x1873=function(_0x461fd5,_0x51747e){_0x461fd5=_0x461fd5-0x0;var _0x4e025b=_0x8731[_0x461fd5];return _0x4e025b;};'use strict';var _=require(_0x1873('0x0'));var util=require('util');var moment=require(_0x1873('0x1'));var BPromise=require(_0x1873('0x2'));var rs=require(_0x1873('0x3'));var fs=require('fs');var Redis=require(_0x1873('0x4'));var db=require(_0x1873('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1873('0x6'));var config=require(_0x1873('0x7'));var jayson=require(_0x1873('0x8'));var client=jayson[_0x1873('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b8197,_0x3dfd45,_0x324344){return new BPromise(function(_0x22edeb,_0x20bfd0){return client[_0x1873('0xa')](_0x5b8197,_0x324344)['then'](function(_0x2d6497){logger[_0x1873('0xb')](_0x1873('0xc'),_0x3dfd45,_0x1873('0xd'));logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x3dfd45,'request\x20sent',JSON[_0x1873('0xe')](_0x2d6497));if(_0x2d6497[_0x1873('0xf')]){if(_0x2d6497[_0x1873('0xf')][_0x1873('0x10')]===0x1f4){logger[_0x1873('0xf')](_0x1873('0xc'),_0x3dfd45,_0x2d6497[_0x1873('0xf')]['message']);return _0x20bfd0(_0x2d6497[_0x1873('0xf')]['message']);}logger[_0x1873('0xf')](_0x1873('0xc'),_0x3dfd45,_0x2d6497[_0x1873('0xf')]['message']);return _0x22edeb(_0x2d6497[_0x1873('0xf')][_0x1873('0x11')]);}else{logger[_0x1873('0xb')](_0x1873('0xc'),_0x3dfd45,_0x1873('0xd'));_0x22edeb(_0x2d6497[_0x1873('0x12')][_0x1873('0x11')]);}})[_0x1873('0x13')](function(_0x4f24fb){logger[_0x1873('0xf')]('SquareMessage,\x20%s,\x20%s',_0x3dfd45,_0x4f24fb);_0x20bfd0(_0x4f24fb);});});}exports['CreateSquareMessage']=function(_0x1cfe27){var _0x24c5a1=this;return new Promise(function(_0x1cda0a,_0x2deb1e){return db[_0x1873('0x14')][_0x1873('0x15')](_0x1cfe27[_0x1873('0x16')],{'raw':_0x1cfe27['options']?_0x1cfe27[_0x1873('0x17')][_0x1873('0x18')]===undefined?!![]:![]:!![]})[_0x1873('0x19')](function(_0x23c0d1){logger['info'](_0x1873('0x1a'),_0x1cfe27);logger['debug']('CreateSquareMessage',_0x1cfe27,JSON['stringify'](_0x23c0d1));_0x1cda0a(_0x23c0d1);})['catch'](function(_0x3d2bb0){logger[_0x1873('0xf')](_0x1873('0x1a'),_0x3d2bb0[_0x1873('0x11')],_0x1cfe27);_0x2deb1e(_0x24c5a1[_0x1873('0xf')](0x1f4,_0x3d2bb0['message']));});});}; \ No newline at end of file +var _0xdeb5=['rpc','../../config/environment','client','request','then','request\x20sent','debug','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','info','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3e6bcf,_0x504ede){var _0x32e75f=function(_0x4b5ba9){while(--_0x4b5ba9){_0x3e6bcf['push'](_0x3e6bcf['shift']());}};_0x32e75f(++_0x504ede);}(_0xdeb5,0x170));var _0x5deb=function(_0x4c7996,_0x325fdb){_0x4c7996=_0x4c7996-0x0;var _0xd0a069=_0xdeb5[_0x4c7996];return _0xd0a069;};'use strict';var _=require(_0x5deb('0x0'));var util=require(_0x5deb('0x1'));var moment=require(_0x5deb('0x2'));var BPromise=require(_0x5deb('0x3'));var rs=require(_0x5deb('0x4'));var fs=require('fs');var Redis=require(_0x5deb('0x5'));var db=require(_0x5deb('0x6'))['db'];var utils=require(_0x5deb('0x7'));var logger=require(_0x5deb('0x8'))(_0x5deb('0x9'));var config=require(_0x5deb('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x5deb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbfcb83,_0x3387d2,_0x4fc552){return new BPromise(function(_0x459772,_0x4b06b5){return client[_0x5deb('0xc')](_0xbfcb83,_0x4fc552)[_0x5deb('0xd')](function(_0x3a01bd){logger['info']('SquareMessage,\x20%s,\x20%s',_0x3387d2,_0x5deb('0xe'));logger[_0x5deb('0xf')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x3387d2,_0x5deb('0xe'),JSON[_0x5deb('0x10')](_0x3a01bd));if(_0x3a01bd[_0x5deb('0x11')]){if(_0x3a01bd[_0x5deb('0x11')][_0x5deb('0x12')]===0x1f4){logger['error'](_0x5deb('0x13'),_0x3387d2,_0x3a01bd[_0x5deb('0x11')][_0x5deb('0x14')]);return _0x4b06b5(_0x3a01bd['error'][_0x5deb('0x14')]);}logger[_0x5deb('0x11')]('SquareMessage,\x20%s,\x20%s',_0x3387d2,_0x3a01bd['error']['message']);return _0x459772(_0x3a01bd[_0x5deb('0x11')][_0x5deb('0x14')]);}else{logger[_0x5deb('0x15')]('SquareMessage,\x20%s,\x20%s',_0x3387d2,_0x5deb('0xe'));_0x459772(_0x3a01bd['result'][_0x5deb('0x14')]);}})[_0x5deb('0x16')](function(_0x36e002){logger[_0x5deb('0x11')](_0x5deb('0x13'),_0x3387d2,_0x36e002);_0x4b06b5(_0x36e002);});});}exports[_0x5deb('0x17')]=function(_0xf976fb){var _0x29c9bd=this;return new Promise(function(_0x4e762a,_0x4948d8){return db[_0x5deb('0x18')][_0x5deb('0x19')](_0xf976fb[_0x5deb('0x1a')],{'raw':_0xf976fb[_0x5deb('0x1b')]?_0xf976fb['options'][_0x5deb('0x1c')]===undefined?!![]:![]:!![]})[_0x5deb('0xd')](function(_0x37d2de){logger[_0x5deb('0x15')](_0x5deb('0x17'),_0xf976fb);logger[_0x5deb('0xf')]('CreateSquareMessage',_0xf976fb,JSON[_0x5deb('0x10')](_0x37d2de));_0x4e762a(_0x37d2de);})[_0x5deb('0x16')](function(_0x157b37){logger[_0x5deb('0x11')](_0x5deb('0x17'),_0x157b37['message'],_0xf976fb);_0x4948d8(_0x29c9bd[_0x5deb('0x11')](0x1f4,_0x157b37[_0x5deb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index d8a2ae0..c5d439a 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 _0x0d23=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/test','test','post','create','put','update','delete','destroy','multer'];(function(_0x4d211c,_0x51ff78){var _0x58fd52=function(_0x24e62a){while(--_0x24e62a){_0x4d211c['push'](_0x4d211c['shift']());}};_0x58fd52(++_0x51ff78);}(_0x0d23,0xc7));var _0x30d2=function(_0x4e46e7,_0x4bdf26){_0x4e46e7=_0x4e46e7-0x0;var _0x2ecebb=_0x0d23[_0x4e46e7];return _0x2ecebb;};'use strict';var multer=require(_0x30d2('0x0'));var util=require(_0x30d2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x30d2('0x2'));var router=express[_0x30d2('0x3')]();var fs_extra=require(_0x30d2('0x4'));var auth=require(_0x30d2('0x5'));var interaction=require(_0x30d2('0x6'));var config=require(_0x30d2('0x7'));var controller=require('./squareOdbc.controller');router[_0x30d2('0x8')]('/',auth['isAuthenticated'](),controller[_0x30d2('0x9')]);router[_0x30d2('0x8')](_0x30d2('0xa'),auth[_0x30d2('0xb')](),controller['show']);router['get'](_0x30d2('0xc'),auth[_0x30d2('0xb')](),timeout('15s'),controller[_0x30d2('0xd')]);router[_0x30d2('0xe')]('/',auth[_0x30d2('0xb')](),controller[_0x30d2('0xf')]);router[_0x30d2('0x10')]('/:id',auth[_0x30d2('0xb')](),controller[_0x30d2('0x11')]);router[_0x30d2('0x12')](_0x30d2('0xa'),auth['isAuthenticated'](),controller[_0x30d2('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5c80=['isAuthenticated','index','show','15s','test','create','put','/:id','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get'];(function(_0x3f4cd0,_0x303070){var _0x3f9f01=function(_0x6ced93){while(--_0x6ced93){_0x3f4cd0['push'](_0x3f4cd0['shift']());}};_0x3f9f01(++_0x303070);}(_0x5c80,0x90));var _0x05c8=function(_0x25a1b8,_0x474ad9){_0x25a1b8=_0x25a1b8-0x0;var _0x1843d9=_0x5c80[_0x25a1b8];return _0x1843d9;};'use strict';var multer=require(_0x05c8('0x0'));var util=require('util');var path=require(_0x05c8('0x1'));var timeout=require('connect-timeout');var express=require(_0x05c8('0x2'));var router=express[_0x05c8('0x3')]();var fs_extra=require(_0x05c8('0x4'));var auth=require(_0x05c8('0x5'));var interaction=require(_0x05c8('0x6'));var config=require(_0x05c8('0x7'));var controller=require(_0x05c8('0x8'));router[_0x05c8('0x9')]('/',auth[_0x05c8('0xa')](),controller[_0x05c8('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x05c8('0xc')]);router[_0x05c8('0x9')]('/:id/test',auth[_0x05c8('0xa')](),timeout(_0x05c8('0xd')),controller[_0x05c8('0xe')]);router['post']('/',auth[_0x05c8('0xa')](),controller[_0x05c8('0xf')]);router[_0x05c8('0x10')](_0x05c8('0x11'),auth['isAuthenticated'](),controller[_0x05c8('0x12')]);router[_0x05c8('0x13')](_0x05c8('0x11'),auth[_0x05c8('0xa')](),controller[_0x05c8('0x14')]);module[_0x05c8('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 3c7c1fa..32324bc 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 _0xd9e5=['STRING','sequelize','exports'];(function(_0x47f694,_0x2d9fa3){var _0x2f417e=function(_0x531a3b){while(--_0x531a3b){_0x47f694['push'](_0x47f694['shift']());}};_0x2f417e(++_0x2d9fa3);}(_0xd9e5,0x15d));var _0x5d9e=function(_0x946941,_0x28be10){_0x946941=_0x946941-0x0;var _0x1a08fd=_0xd9e5[_0x946941];return _0x1a08fd;};'use strict';var Sequelize=require(_0x5d9e('0x0'));module[_0x5d9e('0x1')]={'name':{'type':Sequelize[_0x5d9e('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x5d9e('0x2')]},'description':{'type':Sequelize[_0x5d9e('0x2')]}}; \ No newline at end of file +var _0x5acb=['STRING','name','sequelize'];(function(_0x5bd010,_0x5bccb2){var _0x2f213e=function(_0x4807cb){while(--_0x4807cb){_0x5bd010['push'](_0x5bd010['shift']());}};_0x2f213e(++_0x5bccb2);}(_0x5acb,0x1a6));var _0xb5ac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5acb[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb5ac('0x0'));module['exports']={'name':{'type':Sequelize[_0xb5ac('0x1')],'unique':_0xb5ac('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb5ac('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 1156be8..d366096 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 _0xeeaa=['where','pick','merge','filter','include','findAll','rows','catch','params','keys','length','includeAll','create','body','user','role','ODBC','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','get','UserProfileResource','destroy','sendStatus','error','name','send','index','map','SquareOdbc','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xeeaa,0x172));var _0xaeea=function(_0x42f9ec,_0x48e1b2){_0x42f9ec=_0x42f9ec-0x0;var _0x2cbbff=_0xeeaa[_0x42f9ec];return _0x2cbbff;};'use strict';var emlformat=require(_0xaeea('0x0'));var rimraf=require(_0xaeea('0x1'));var zipdir=require(_0xaeea('0x2'));var jsonpatch=require(_0xaeea('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaeea('0x4'));var util=require(_0xaeea('0x5'));var path=require(_0xaeea('0x6'));var sox=require(_0xaeea('0x7'));var csv=require('to-csv');var ejs=require(_0xaeea('0x8'));var fs=require('fs');var fs_extra=require(_0xaeea('0x9'));var _=require(_0xaeea('0xa'));var squel=require(_0xaeea('0xb'));var crypto=require(_0xaeea('0xc'));var jsforce=require(_0xaeea('0xd'));var deskjs=require(_0xaeea('0xe'));var toCsv=require(_0xaeea('0xf'));var querystring=require(_0xaeea('0x10'));var Papa=require(_0xaeea('0x11'));var Redis=require(_0xaeea('0x12'));var authService=require(_0xaeea('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xaeea('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaeea('0x15'))(_0xaeea('0x16'));var utils=require('../../config/utils');var config=require(_0xaeea('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xaeea('0x18'))['db'];function respondWithStatusCode(_0x5128c0,_0x4ebcd0){_0x4ebcd0=_0x4ebcd0||0xcc;return function(_0x187251){if(_0x187251){return _0x5128c0['sendStatus'](_0x4ebcd0);}return _0x5128c0[_0xaeea('0x19')](_0x4ebcd0)[_0xaeea('0x1a')]();};}function respondWithResult(_0x374a97,_0x8af131){_0x8af131=_0x8af131||0xc8;return function(_0x514991){if(_0x514991){return _0x374a97[_0xaeea('0x19')](_0x8af131)['json'](_0x514991);}};}function respondWithFilteredResult(_0x8f03d9,_0x12e6e0){return function(_0x3ba413){if(_0x3ba413){var _0x222bb5=typeof _0x12e6e0[_0xaeea('0x1b')]===_0xaeea('0x1c')&&typeof _0x12e6e0['limit']===_0xaeea('0x1c');var _0x12ebdf=_0x3ba413['count'];var _0x20f304=_0x222bb5?0x0:_0x12e6e0[_0xaeea('0x1b')];var _0x38ba08=_0x222bb5?_0x3ba413[_0xaeea('0x1d')]:_0x12e6e0['offset']+_0x12e6e0[_0xaeea('0x1e')];var _0x6717cf;if(_0x38ba08>=_0x12ebdf){_0x38ba08=_0x12ebdf;_0x6717cf=0xc8;}else{_0x6717cf=0xce;}_0x8f03d9[_0xaeea('0x19')](_0x6717cf);return _0x8f03d9[_0xaeea('0x1f')](_0xaeea('0x20'),_0x20f304+'-'+_0x38ba08+'/'+_0x12ebdf)[_0xaeea('0x21')](_0x3ba413);}return null;};}function patchUpdates(_0x478f97){return function(_0x4ab443){try{jsonpatch[_0xaeea('0x22')](_0x4ab443,_0x478f97,!![]);}catch(_0x1d9658){return BPromise['reject'](_0x1d9658);}return _0x4ab443[_0xaeea('0x23')]();};}function saveUpdates(_0x4b6e0f,_0x252d06){return function(_0x4e7439){if(_0x4e7439){return _0x4e7439[_0xaeea('0x24')](_0x4b6e0f)['then'](function(_0x44f660){return _0x44f660;});}return null;};}function removeEntity(_0x192f5f,_0x58ab66){return function(_0x329dc9){if(_0x329dc9){return _0x329dc9['destroy']()[_0xaeea('0x25')](function(){var _0x4e2b99=_0x329dc9[_0xaeea('0x26')]({'plain':!![]});var _0x21f976='ODBC';return db[_0xaeea('0x27')][_0xaeea('0x28')]({'where':{'type':_0x21f976,'resourceId':_0x4e2b99['id']}})[_0xaeea('0x25')](function(){return _0x329dc9;});})[_0xaeea('0x25')](function(){_0x192f5f['status'](0xcc)[_0xaeea('0x1a')]();});}};}function handleEntityNotFound(_0x535412,_0xb0ce03){return function(_0x4531c8){if(!_0x4531c8){_0x535412[_0xaeea('0x29')](0x194);}return _0x4531c8;};}function handleError(_0x62d924,_0x4aac41){_0x4aac41=_0x4aac41||0x1f4;return function(_0x40b72d){logger[_0xaeea('0x2a')](_0x40b72d['stack']);if(_0x40b72d[_0xaeea('0x2b')]){delete _0x40b72d['name'];}_0x62d924[_0xaeea('0x19')](_0x4aac41)[_0xaeea('0x2c')](_0x40b72d);};}exports[_0xaeea('0x2d')]=function(_0x265f42,_0x554df4){var _0xb45e6b={},_0x145453={},_0x35483e={'count':0x0,'rows':[]};var _0x522942=_[_0xaeea('0x2e')](db[_0xaeea('0x2f')][_0xaeea('0x30')],function(_0x6d0852){return{'name':_0x6d0852['fieldName'],'type':_0x6d0852[_0xaeea('0x31')][_0xaeea('0x32')]};});_0x145453[_0xaeea('0x33')]=_['map'](_0x522942,_0xaeea('0x2b'));_0x145453[_0xaeea('0x34')]=_['keys'](_0x265f42[_0xaeea('0x34')]);_0x145453[_0xaeea('0x35')]=_[_0xaeea('0x36')](_0x145453[_0xaeea('0x33')],_0x145453['query']);_0xb45e6b[_0xaeea('0x37')]=_[_0xaeea('0x36')](_0x145453[_0xaeea('0x33')],qs[_0xaeea('0x38')](_0x265f42[_0xaeea('0x34')][_0xaeea('0x38')]));_0xb45e6b[_0xaeea('0x37')]=_0xb45e6b[_0xaeea('0x37')]['length']?_0xb45e6b['attributes']:_0x145453[_0xaeea('0x33')];if(!_0x265f42[_0xaeea('0x34')]['hasOwnProperty'](_0xaeea('0x39'))){_0xb45e6b[_0xaeea('0x1e')]=qs[_0xaeea('0x1e')](_0x265f42[_0xaeea('0x34')][_0xaeea('0x1e')]);_0xb45e6b[_0xaeea('0x1b')]=qs[_0xaeea('0x1b')](_0x265f42[_0xaeea('0x34')][_0xaeea('0x1b')]);}_0xb45e6b[_0xaeea('0x3a')]=qs[_0xaeea('0x3b')](_0x265f42[_0xaeea('0x34')][_0xaeea('0x3b')]);_0xb45e6b[_0xaeea('0x3c')]=qs['filters'](_[_0xaeea('0x3d')](_0x265f42['query'],_0x145453['filters']),_0x522942);if(_0x265f42[_0xaeea('0x34')]['filter']){_0xb45e6b[_0xaeea('0x3c')]=_[_0xaeea('0x3e')](_0xb45e6b['where'],{'$or':_[_0xaeea('0x2e')](_0x522942,function(_0x1c4e73){if(_0x1c4e73[_0xaeea('0x31')]!=='VIRTUAL'){var _0x2eb838={};_0x2eb838[_0x1c4e73[_0xaeea('0x2b')]]={'$like':'%'+_0x265f42[_0xaeea('0x34')][_0xaeea('0x3f')]+'%'};return _0x2eb838;}})});}_0xb45e6b=_[_0xaeea('0x3e')]({},_0xb45e6b,_0x265f42['options']);var _0x23bbb1={'where':_0xb45e6b['where']};return db[_0xaeea('0x2f')][_0xaeea('0x1d')](_0x23bbb1)[_0xaeea('0x25')](function(_0x3c42cc){_0x35483e[_0xaeea('0x1d')]=_0x3c42cc;if(_0x265f42[_0xaeea('0x34')]['includeAll']){_0xb45e6b[_0xaeea('0x40')]=[{'all':!![]}];}return db[_0xaeea('0x2f')][_0xaeea('0x41')](_0xb45e6b);})[_0xaeea('0x25')](function(_0x4c04ff){_0x35483e[_0xaeea('0x42')]=_0x4c04ff;return _0x35483e;})['then'](respondWithFilteredResult(_0x554df4,_0xb45e6b))[_0xaeea('0x43')](handleError(_0x554df4,null));};exports['show']=function(_0x59204a,_0x1ecf7a){var _0x29a676={'raw':!![],'where':{'id':_0x59204a[_0xaeea('0x44')]['id']}},_0x1b379b={};_0x1b379b['model']=_[_0xaeea('0x45')](db[_0xaeea('0x2f')]['rawAttributes']);_0x1b379b[_0xaeea('0x34')]=_[_0xaeea('0x45')](_0x59204a[_0xaeea('0x34')]);_0x1b379b[_0xaeea('0x35')]=_[_0xaeea('0x36')](_0x1b379b['model'],_0x1b379b[_0xaeea('0x34')]);_0x29a676[_0xaeea('0x37')]=_['intersection'](_0x1b379b['model'],qs[_0xaeea('0x38')](_0x59204a[_0xaeea('0x34')]['fields']));_0x29a676[_0xaeea('0x37')]=_0x29a676[_0xaeea('0x37')][_0xaeea('0x46')]?_0x29a676[_0xaeea('0x37')]:_0x1b379b[_0xaeea('0x33')];if(_0x59204a[_0xaeea('0x34')][_0xaeea('0x47')]){_0x29a676['include']=[{'all':!![]}];}_0x29a676=_['merge']({},_0x29a676,_0x59204a['options']);return db[_0xaeea('0x2f')]['find'](_0x29a676)[_0xaeea('0x25')](handleEntityNotFound(_0x1ecf7a,null))[_0xaeea('0x25')](respondWithResult(_0x1ecf7a,null))[_0xaeea('0x43')](handleError(_0x1ecf7a,null));};exports[_0xaeea('0x48')]=function(_0x471129,_0xebe788){return db[_0xaeea('0x2f')][_0xaeea('0x48')](_0x471129[_0xaeea('0x49')],{})[_0xaeea('0x25')](function(_0x47f1e1){var _0x254708=_0x471129[_0xaeea('0x4a')][_0xaeea('0x26')]({'plain':!![]});if(!_0x254708)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x254708[_0xaeea('0x4b')]===_0xaeea('0x4a')){var _0x3485e3=_0x47f1e1['get']({'plain':!![]});var _0x487189=_0xaeea('0x4c');return db[_0xaeea('0x4d')][_0xaeea('0x4e')]({'where':{'name':_0x487189,'userProfileId':_0x254708[_0xaeea('0x4f')]},'raw':!![]})[_0xaeea('0x25')](function(_0x1da797){if(_0x1da797&&_0x1da797[_0xaeea('0x50')]===0x0){return db[_0xaeea('0x27')][_0xaeea('0x48')]({'name':_0x3485e3[_0xaeea('0x2b')],'resourceId':_0x3485e3['id'],'type':_0x1da797[_0xaeea('0x2b')],'sectionId':_0x1da797['id']},{})[_0xaeea('0x25')](function(){return _0x47f1e1;});}else{return _0x47f1e1;}})['catch'](function(_0x866512){logger['error'](_0xaeea('0x51'),_0x866512);throw _0x866512;});}return _0x47f1e1;})[_0xaeea('0x25')](respondWithResult(_0xebe788,0xc9))[_0xaeea('0x43')](handleError(_0xebe788,null));};exports['update']=function(_0xaba19c,_0x54e70d){if(_0xaba19c[_0xaeea('0x49')]['id']){delete _0xaba19c[_0xaeea('0x49')]['id'];}return db[_0xaeea('0x2f')]['find']({'where':{'id':_0xaba19c[_0xaeea('0x44')]['id']}})[_0xaeea('0x25')](handleEntityNotFound(_0x54e70d,null))[_0xaeea('0x25')](saveUpdates(_0xaba19c[_0xaeea('0x49')],null))['then'](respondWithResult(_0x54e70d,null))[_0xaeea('0x43')](handleError(_0x54e70d,null));};exports[_0xaeea('0x28')]=function(_0x43b0a1,_0x4c577b){return db[_0xaeea('0x2f')]['find']({'where':{'id':_0x43b0a1['params']['id']}})[_0xaeea('0x25')](handleEntityNotFound(_0x4c577b,null))[_0xaeea('0x25')](removeEntity(_0x4c577b,null))[_0xaeea('0x43')](handleError(_0x4c577b,null));};exports[_0xaeea('0x52')]=function(_0x1d9e2a,_0x51201b,_0x4e29ac){var _0x2777e6;return db[_0xaeea('0x2f')]['find']({'where':{'id':_0x1d9e2a[_0xaeea('0x44')]['id']},'attributes':['id',_0xaeea('0x53')]})[_0xaeea('0x25')](handleEntityNotFound(_0x51201b,null))[_0xaeea('0x25')](function(_0xf8ec0f){if(_0xf8ec0f){var _0x3e2818=require(_0xaeea('0x54'))();_0x3e2818['openSync'](_0xf8ec0f[_0xaeea('0x53')]);_0x3e2818[_0xaeea('0x55')]();return _0xf8ec0f;}})[_0xaeea('0x25')](respondWithResult(_0x51201b,null))[_0xaeea('0x43')](handleError(_0x51201b,null));}; \ No newline at end of file +var _0x52a4=['lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','ODBC','error','stack','name','send','map','SquareOdbc','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','type','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','rawAttributes','options','create','body','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','odbc','openSync','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x484234,_0x2e7e90){var _0x498efc=function(_0x191c60){while(--_0x191c60){_0x484234['push'](_0x484234['shift']());}};_0x498efc(++_0x2e7e90);}(_0x52a4,0x140));var _0x452a=function(_0x340ecd,_0x1a47fb){_0x340ecd=_0x340ecd-0x0;var _0x3610ab=_0x52a4[_0x340ecd];return _0x3610ab;};'use strict';var emlformat=require(_0x452a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x452a('0x1'));var rp=require(_0x452a('0x2'));var moment=require(_0x452a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x452a('0x4'));var util=require(_0x452a('0x5'));var path=require(_0x452a('0x6'));var sox=require(_0x452a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x452a('0x8'));var squel=require(_0x452a('0x9'));var crypto=require(_0x452a('0xa'));var jsforce=require(_0x452a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x452a('0xc'));var querystring=require(_0x452a('0xd'));var Papa=require(_0x452a('0xe'));var Redis=require('ioredis');var authService=require(_0x452a('0xf'));var qs=require(_0x452a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x452a('0x11'));var logger=require(_0x452a('0x12'))('api');var utils=require(_0x452a('0x13'));var config=require(_0x452a('0x14'));var licenseUtil=require(_0x452a('0x15'));var db=require(_0x452a('0x16'))['db'];function respondWithStatusCode(_0x18e38a,_0x58cfab){_0x58cfab=_0x58cfab||0xcc;return function(_0x1d4cd9){if(_0x1d4cd9){return _0x18e38a[_0x452a('0x17')](_0x58cfab);}return _0x18e38a[_0x452a('0x18')](_0x58cfab)[_0x452a('0x19')]();};}function respondWithResult(_0x2d8033,_0x4cf084){_0x4cf084=_0x4cf084||0xc8;return function(_0x110445){if(_0x110445){return _0x2d8033[_0x452a('0x18')](_0x4cf084)['json'](_0x110445);}};}function respondWithFilteredResult(_0xa6d7b5,_0x530d24){return function(_0x2e6481){if(_0x2e6481){var _0xdb0461=typeof _0x530d24[_0x452a('0x1a')]===_0x452a('0x1b')&&typeof _0x530d24[_0x452a('0x1c')]===_0x452a('0x1b');var _0x4c56f5=_0x2e6481[_0x452a('0x1d')];var _0x5509c3=_0xdb0461?0x0:_0x530d24[_0x452a('0x1a')];var _0x236969=_0xdb0461?_0x2e6481[_0x452a('0x1d')]:_0x530d24[_0x452a('0x1a')]+_0x530d24[_0x452a('0x1c')];var _0x4fba29;if(_0x236969>=_0x4c56f5){_0x236969=_0x4c56f5;_0x4fba29=0xc8;}else{_0x4fba29=0xce;}_0xa6d7b5[_0x452a('0x18')](_0x4fba29);return _0xa6d7b5[_0x452a('0x1e')]('Content-Range',_0x5509c3+'-'+_0x236969+'/'+_0x4c56f5)['json'](_0x2e6481);}return null;};}function patchUpdates(_0x49d5bd){return function(_0x4bb3d1){try{jsonpatch[_0x452a('0x1f')](_0x4bb3d1,_0x49d5bd,!![]);}catch(_0x2f1d70){return BPromise[_0x452a('0x20')](_0x2f1d70);}return _0x4bb3d1[_0x452a('0x21')]();};}function saveUpdates(_0x211636,_0x4d223f){return function(_0x371388){if(_0x371388){return _0x371388[_0x452a('0x22')](_0x211636)[_0x452a('0x23')](function(_0x5c36bd){return _0x5c36bd;});}return null;};}function removeEntity(_0x155ce2,_0x2206b7){return function(_0x4d47bf){if(_0x4d47bf){return _0x4d47bf[_0x452a('0x24')]()[_0x452a('0x23')](function(){var _0xfb05ba=_0x4d47bf[_0x452a('0x25')]({'plain':!![]});var _0x4dcabf=_0x452a('0x26');return db['UserProfileResource'][_0x452a('0x24')]({'where':{'type':_0x4dcabf,'resourceId':_0xfb05ba['id']}})[_0x452a('0x23')](function(){return _0x4d47bf;});})[_0x452a('0x23')](function(){_0x155ce2[_0x452a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x89b6a3,_0x25b418){return function(_0x1f8dde){if(!_0x1f8dde){_0x89b6a3[_0x452a('0x17')](0x194);}return _0x1f8dde;};}function handleError(_0x47d47e,_0xc8781c){_0xc8781c=_0xc8781c||0x1f4;return function(_0x1004f5){logger[_0x452a('0x27')](_0x1004f5[_0x452a('0x28')]);if(_0x1004f5[_0x452a('0x29')]){delete _0x1004f5[_0x452a('0x29')];}_0x47d47e[_0x452a('0x18')](_0xc8781c)[_0x452a('0x2a')](_0x1004f5);};}exports['index']=function(_0x5bdcc8,_0x3293ab){var _0x1a533f={},_0x49388b={},_0x51ea6f={'count':0x0,'rows':[]};var _0x40a081=_[_0x452a('0x2b')](db[_0x452a('0x2c')]['rawAttributes'],function(_0x248b28){return{'name':_0x248b28['fieldName'],'type':_0x248b28['type'][_0x452a('0x2d')]};});_0x49388b[_0x452a('0x2e')]=_['map'](_0x40a081,_0x452a('0x29'));_0x49388b[_0x452a('0x2f')]=_[_0x452a('0x30')](_0x5bdcc8[_0x452a('0x2f')]);_0x49388b['filters']=_[_0x452a('0x31')](_0x49388b[_0x452a('0x2e')],_0x49388b[_0x452a('0x2f')]);_0x1a533f[_0x452a('0x32')]=_[_0x452a('0x31')](_0x49388b[_0x452a('0x2e')],qs[_0x452a('0x33')](_0x5bdcc8[_0x452a('0x2f')][_0x452a('0x33')]));_0x1a533f[_0x452a('0x32')]=_0x1a533f[_0x452a('0x32')][_0x452a('0x34')]?_0x1a533f['attributes']:_0x49388b[_0x452a('0x2e')];if(!_0x5bdcc8[_0x452a('0x2f')][_0x452a('0x35')](_0x452a('0x36'))){_0x1a533f['limit']=qs[_0x452a('0x1c')](_0x5bdcc8[_0x452a('0x2f')][_0x452a('0x1c')]);_0x1a533f['offset']=qs[_0x452a('0x1a')](_0x5bdcc8[_0x452a('0x2f')][_0x452a('0x1a')]);}_0x1a533f[_0x452a('0x37')]=qs[_0x452a('0x38')](_0x5bdcc8[_0x452a('0x2f')][_0x452a('0x38')]);_0x1a533f['where']=qs[_0x452a('0x39')](_['pick'](_0x5bdcc8[_0x452a('0x2f')],_0x49388b[_0x452a('0x39')]),_0x40a081);if(_0x5bdcc8[_0x452a('0x2f')]['filter']){_0x1a533f[_0x452a('0x3a')]=_[_0x452a('0x3b')](_0x1a533f[_0x452a('0x3a')],{'$or':_[_0x452a('0x2b')](_0x40a081,function(_0x4d429b){if(_0x4d429b[_0x452a('0x3c')]!==_0x452a('0x3d')){var _0x1d6f0d={};_0x1d6f0d[_0x4d429b[_0x452a('0x29')]]={'$like':'%'+_0x5bdcc8[_0x452a('0x2f')][_0x452a('0x3e')]+'%'};return _0x1d6f0d;}})});}_0x1a533f=_[_0x452a('0x3b')]({},_0x1a533f,_0x5bdcc8['options']);var _0x202367={'where':_0x1a533f['where']};return db[_0x452a('0x2c')][_0x452a('0x1d')](_0x202367)[_0x452a('0x23')](function(_0x2dc4fd){_0x51ea6f[_0x452a('0x1d')]=_0x2dc4fd;if(_0x5bdcc8[_0x452a('0x2f')][_0x452a('0x3f')]){_0x1a533f[_0x452a('0x40')]=[{'all':!![]}];}return db['SquareOdbc'][_0x452a('0x41')](_0x1a533f);})['then'](function(_0x507ee9){_0x51ea6f['rows']=_0x507ee9;return _0x51ea6f;})[_0x452a('0x23')](respondWithFilteredResult(_0x3293ab,_0x1a533f))[_0x452a('0x42')](handleError(_0x3293ab,null));};exports[_0x452a('0x43')]=function(_0x26e4d1,_0x159310){var _0x5d3c9f={'raw':!![],'where':{'id':_0x26e4d1[_0x452a('0x44')]['id']}},_0xe48ec3={};_0xe48ec3[_0x452a('0x2e')]=_['keys'](db['SquareOdbc'][_0x452a('0x45')]);_0xe48ec3[_0x452a('0x2f')]=_[_0x452a('0x30')](_0x26e4d1[_0x452a('0x2f')]);_0xe48ec3[_0x452a('0x39')]=_['intersection'](_0xe48ec3[_0x452a('0x2e')],_0xe48ec3['query']);_0x5d3c9f[_0x452a('0x32')]=_['intersection'](_0xe48ec3[_0x452a('0x2e')],qs[_0x452a('0x33')](_0x26e4d1['query'][_0x452a('0x33')]));_0x5d3c9f[_0x452a('0x32')]=_0x5d3c9f['attributes']['length']?_0x5d3c9f[_0x452a('0x32')]:_0xe48ec3[_0x452a('0x2e')];if(_0x26e4d1['query'][_0x452a('0x3f')]){_0x5d3c9f['include']=[{'all':!![]}];}_0x5d3c9f=_[_0x452a('0x3b')]({},_0x5d3c9f,_0x26e4d1[_0x452a('0x46')]);return db[_0x452a('0x2c')]['find'](_0x5d3c9f)['then'](handleEntityNotFound(_0x159310,null))[_0x452a('0x23')](respondWithResult(_0x159310,null))[_0x452a('0x42')](handleError(_0x159310,null));};exports[_0x452a('0x47')]=function(_0x11c8b4,_0xd2ad11){return db['SquareOdbc'][_0x452a('0x47')](_0x11c8b4[_0x452a('0x48')],{})['then'](function(_0x4794e5){var _0x102324=_0x11c8b4['user'][_0x452a('0x25')]({'plain':!![]});if(!_0x102324)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x102324[_0x452a('0x49')]==='user'){var _0x46a02f=_0x4794e5[_0x452a('0x25')]({'plain':!![]});var _0x435953=_0x452a('0x26');return db['UserProfileSection'][_0x452a('0x4a')]({'where':{'name':_0x435953,'userProfileId':_0x102324[_0x452a('0x4b')]},'raw':!![]})['then'](function(_0x1c2723){if(_0x1c2723&&_0x1c2723[_0x452a('0x4c')]===0x0){return db[_0x452a('0x4d')][_0x452a('0x47')]({'name':_0x46a02f['name'],'resourceId':_0x46a02f['id'],'type':_0x1c2723['name'],'sectionId':_0x1c2723['id']},{})[_0x452a('0x23')](function(){return _0x4794e5;});}else{return _0x4794e5;}})[_0x452a('0x42')](function(_0x2b1935){logger['error'](_0x452a('0x4e'),_0x2b1935);throw _0x2b1935;});}return _0x4794e5;})[_0x452a('0x23')](respondWithResult(_0xd2ad11,0xc9))[_0x452a('0x42')](handleError(_0xd2ad11,null));};exports[_0x452a('0x22')]=function(_0xa77456,_0x3a0916){if(_0xa77456[_0x452a('0x48')]['id']){delete _0xa77456[_0x452a('0x48')]['id'];}return db[_0x452a('0x2c')][_0x452a('0x4a')]({'where':{'id':_0xa77456[_0x452a('0x44')]['id']}})['then'](handleEntityNotFound(_0x3a0916,null))[_0x452a('0x23')](saveUpdates(_0xa77456[_0x452a('0x48')],null))[_0x452a('0x23')](respondWithResult(_0x3a0916,null))['catch'](handleError(_0x3a0916,null));};exports[_0x452a('0x24')]=function(_0x45b0c1,_0x65961d){return db[_0x452a('0x2c')][_0x452a('0x4a')]({'where':{'id':_0x45b0c1['params']['id']}})['then'](handleEntityNotFound(_0x65961d,null))[_0x452a('0x23')](removeEntity(_0x65961d,null))['catch'](handleError(_0x65961d,null));};exports['test']=function(_0x54c6c5,_0x35101e,_0x536669){var _0x1a502a;return db[_0x452a('0x2c')][_0x452a('0x4a')]({'where':{'id':_0x54c6c5[_0x452a('0x44')]['id']},'attributes':['id',_0x452a('0x4f')]})['then'](handleEntityNotFound(_0x35101e,null))['then'](function(_0x373b41){if(_0x373b41){var _0x4c74d0=require(_0x452a('0x50'))();_0x4c74d0[_0x452a('0x51')](_0x373b41[_0x452a('0x4f')]);_0x4c74d0['closeSync']();return _0x373b41;}})[_0x452a('0x23')](respondWithResult(_0x35101e,null))[_0x452a('0x42')](handleError(_0x35101e,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index a8c92db..8d6890b 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 _0xc75d=['request-promise','path','./squareOdbc.attributes','exports','define','SquareOdbc','util','../../config/logger','api','moment','bluebird'];(function(_0x173452,_0x3aa870){var _0xee3fd0=function(_0x10eb01){while(--_0x10eb01){_0x173452['push'](_0x173452['shift']());}};_0xee3fd0(++_0x3aa870);}(_0xc75d,0x1a8));var _0xdc75=function(_0x2d6eff,_0x2f9934){_0x2d6eff=_0x2d6eff-0x0;var _0x4d1250=_0xc75d[_0x2d6eff];return _0x4d1250;};'use strict';var _=require('lodash');var util=require(_0xdc75('0x0'));var logger=require(_0xdc75('0x1'))(_0xdc75('0x2'));var moment=require(_0xdc75('0x3'));var BPromise=require(_0xdc75('0x4'));var rp=require(_0xdc75('0x5'));var fs=require('fs');var path=require(_0xdc75('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdc75('0x7'));module[_0xdc75('0x8')]=function(_0x192680,_0x548e9f){return _0x192680[_0xdc75('0x9')](_0xdc75('0xa'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c54=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','SquareOdbc','square_odbc','lodash'];(function(_0x880a93,_0x18ba9d){var _0x5bc3ce=function(_0x15a81c){while(--_0x15a81c){_0x880a93['push'](_0x880a93['shift']());}};_0x5bc3ce(++_0x18ba9d);}(_0x3c54,0x1bf));var _0x43c5=function(_0x208a6b,_0x36631e){_0x208a6b=_0x208a6b-0x0;var _0x427455=_0x3c54[_0x208a6b];return _0x427455;};'use strict';var _=require(_0x43c5('0x0'));var util=require(_0x43c5('0x1'));var logger=require(_0x43c5('0x2'))(_0x43c5('0x3'));var moment=require(_0x43c5('0x4'));var BPromise=require(_0x43c5('0x5'));var rp=require(_0x43c5('0x6'));var fs=require('fs');var path=require(_0x43c5('0x7'));var rimraf=require(_0x43c5('0x8'));var config=require(_0x43c5('0x9'));var attributes=require(_0x43c5('0xa'));module[_0x43c5('0xb')]=function(_0x3719ce,_0x2db3db){return _0x3719ce['define'](_0x43c5('0xc'),attributes,{'tableName':_0x43c5('0xd'),'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 d05f3e6..78c9040 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 _0xdaae=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','info','result','ShowSquareOdbc','SquareOdbc','find','options','raw','attributes','include','map','model','catch'];(function(_0x5d02ab,_0x28f2c7){var _0x2979c0=function(_0x146ba5){while(--_0x146ba5){_0x5d02ab['push'](_0x5d02ab['shift']());}};_0x2979c0(++_0x28f2c7);}(_0xdaae,0xf8));var _0xedaa=function(_0x2b3e7e,_0x37c887){_0x2b3e7e=_0x2b3e7e-0x0;var _0x1e24b2=_0xdaae[_0x2b3e7e];return _0x1e24b2;};'use strict';var _=require(_0xedaa('0x0'));var util=require(_0xedaa('0x1'));var moment=require(_0xedaa('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xedaa('0x3'));var db=require(_0xedaa('0x4'))['db'];var utils=require(_0xedaa('0x5'));var logger=require(_0xedaa('0x6'))(_0xedaa('0x7'));var config=require(_0xedaa('0x8'));var jayson=require(_0xedaa('0x9'));var client=jayson[_0xedaa('0xa')][_0xedaa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44d79a,_0x165689,_0x24180f){return new BPromise(function(_0x145238,_0x386416){return client['request'](_0x44d79a,_0x24180f)['then'](function(_0x39dbeb){logger['info'](_0xedaa('0xc'),_0x165689,_0xedaa('0xd'));logger[_0xedaa('0xe')](_0xedaa('0xf'),_0x165689,_0xedaa('0xd'),JSON['stringify'](_0x39dbeb));if(_0x39dbeb['error']){if(_0x39dbeb[_0xedaa('0x10')][_0xedaa('0x11')]===0x1f4){logger['error'](_0xedaa('0xc'),_0x165689,_0x39dbeb['error'][_0xedaa('0x12')]);return _0x386416(_0x39dbeb['error'][_0xedaa('0x12')]);}logger[_0xedaa('0x10')](_0xedaa('0xc'),_0x165689,_0x39dbeb[_0xedaa('0x10')][_0xedaa('0x12')]);return _0x145238(_0x39dbeb[_0xedaa('0x10')][_0xedaa('0x12')]);}else{logger[_0xedaa('0x13')](_0xedaa('0xc'),_0x165689,_0xedaa('0xd'));_0x145238(_0x39dbeb[_0xedaa('0x14')][_0xedaa('0x12')]);}})['catch'](function(_0xb19095){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x165689,_0xb19095);_0x386416(_0xb19095);});});}exports[_0xedaa('0x15')]=function(_0x41d15f){var _0x453629=this;return new Promise(function(_0x1a610a,_0x31b805){return db[_0xedaa('0x16')][_0xedaa('0x17')]({'raw':_0x41d15f[_0xedaa('0x18')]?_0x41d15f[_0xedaa('0x18')][_0xedaa('0x19')]===undefined?!![]:![]:!![],'where':_0x41d15f[_0xedaa('0x18')]?_0x41d15f[_0xedaa('0x18')]['where']||null:null,'attributes':_0x41d15f['options']?_0x41d15f[_0xedaa('0x18')][_0xedaa('0x1a')]||null:null,'include':_0x41d15f[_0xedaa('0x18')]?_0x41d15f['options'][_0xedaa('0x1b')]?_[_0xedaa('0x1c')](_0x41d15f[_0xedaa('0x18')][_0xedaa('0x1b')],function(_0x1dbaa6){return{'model':db[_0x1dbaa6['model']],'as':_0x1dbaa6['as'],'attributes':_0x1dbaa6[_0xedaa('0x1a')],'include':_0x1dbaa6[_0xedaa('0x1b')]?_[_0xedaa('0x1c')](_0x1dbaa6['include'],function(_0x3a0f75){return{'model':db[_0x3a0f75[_0xedaa('0x1d')]],'as':_0x3a0f75['as'],'attributes':_0x3a0f75[_0xedaa('0x1a')],'include':_0x3a0f75[_0xedaa('0x1b')]?_[_0xedaa('0x1c')](_0x3a0f75[_0xedaa('0x1b')],function(_0x464286){return{'model':db[_0x464286[_0xedaa('0x1d')]],'as':_0x464286['as'],'attributes':_0x464286[_0xedaa('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x33c35d){logger[_0xedaa('0x13')]('ShowSquareOdbc',_0x41d15f);logger['debug'](_0xedaa('0x15'),_0x41d15f,JSON['stringify'](_0x33c35d));_0x1a610a(_0x33c35d);})[_0xedaa('0x1e')](function(_0x50244d){logger[_0xedaa('0x10')]('ShowSquareOdbc',_0x50244d[_0xedaa('0x12')],_0x41d15f);_0x31b805(_0x453629[_0xedaa('0x10')](0x1f4,_0x50244d[_0xedaa('0x12')]));});});}; \ No newline at end of file +var _0x00ff=['map','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','ShowSquareOdbc','find','options','raw','attributes','include'];(function(_0x5a3702,_0x24693d){var _0x55c917=function(_0x1eeb53){while(--_0x1eeb53){_0x5a3702['push'](_0x5a3702['shift']());}};_0x55c917(++_0x24693d);}(_0x00ff,0x17c));var _0xf00f=function(_0x2e7b2a,_0xd0d864){_0x2e7b2a=_0x2e7b2a-0x0;var _0x2bddf2=_0x00ff[_0x2e7b2a];return _0x2bddf2;};'use strict';var _=require(_0xf00f('0x0'));var util=require(_0xf00f('0x1'));var moment=require(_0xf00f('0x2'));var BPromise=require(_0xf00f('0x3'));var rs=require(_0xf00f('0x4'));var fs=require('fs');var Redis=require(_0xf00f('0x5'));var db=require(_0xf00f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf00f('0x7'));var config=require(_0xf00f('0x8'));var jayson=require(_0xf00f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xe7791e,_0x247364,_0x1a6b50){return new BPromise(function(_0x10a1d5,_0x12f469){return client['request'](_0xe7791e,_0x1a6b50)[_0xf00f('0xa')](function(_0x5b294b){logger['info'](_0xf00f('0xb'),_0x247364,_0xf00f('0xc'));logger[_0xf00f('0xd')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x247364,_0xf00f('0xc'),JSON['stringify'](_0x5b294b));if(_0x5b294b['error']){if(_0x5b294b[_0xf00f('0xe')][_0xf00f('0xf')]===0x1f4){logger[_0xf00f('0xe')](_0xf00f('0xb'),_0x247364,_0x5b294b[_0xf00f('0xe')]['message']);return _0x12f469(_0x5b294b[_0xf00f('0xe')][_0xf00f('0x10')]);}logger[_0xf00f('0xe')](_0xf00f('0xb'),_0x247364,_0x5b294b['error']['message']);return _0x10a1d5(_0x5b294b[_0xf00f('0xe')][_0xf00f('0x10')]);}else{logger[_0xf00f('0x11')](_0xf00f('0xb'),_0x247364,_0xf00f('0xc'));_0x10a1d5(_0x5b294b[_0xf00f('0x12')][_0xf00f('0x10')]);}})[_0xf00f('0x13')](function(_0x585381){logger[_0xf00f('0xe')](_0xf00f('0xb'),_0x247364,_0x585381);_0x12f469(_0x585381);});});}exports[_0xf00f('0x14')]=function(_0x1672bc){var _0x944eff=this;return new Promise(function(_0x78ea95,_0x2c28e2){return db['SquareOdbc'][_0xf00f('0x15')]({'raw':_0x1672bc[_0xf00f('0x16')]?_0x1672bc[_0xf00f('0x16')][_0xf00f('0x17')]===undefined?!![]:![]:!![],'where':_0x1672bc[_0xf00f('0x16')]?_0x1672bc[_0xf00f('0x16')]['where']||null:null,'attributes':_0x1672bc[_0xf00f('0x16')]?_0x1672bc[_0xf00f('0x16')][_0xf00f('0x18')]||null:null,'include':_0x1672bc[_0xf00f('0x16')]?_0x1672bc[_0xf00f('0x16')][_0xf00f('0x19')]?_[_0xf00f('0x1a')](_0x1672bc[_0xf00f('0x16')][_0xf00f('0x19')],function(_0x5c3f81){return{'model':db[_0x5c3f81[_0xf00f('0x1b')]],'as':_0x5c3f81['as'],'attributes':_0x5c3f81[_0xf00f('0x18')],'include':_0x5c3f81[_0xf00f('0x19')]?_[_0xf00f('0x1a')](_0x5c3f81['include'],function(_0x2a083c){return{'model':db[_0x2a083c['model']],'as':_0x2a083c['as'],'attributes':_0x2a083c[_0xf00f('0x18')],'include':_0x2a083c[_0xf00f('0x19')]?_['map'](_0x2a083c[_0xf00f('0x19')],function(_0x5301e1){return{'model':db[_0x5301e1[_0xf00f('0x1b')]],'as':_0x5301e1['as'],'attributes':_0x5301e1['attributes']};}):[]};}):[]};}):[]:[]})[_0xf00f('0xa')](function(_0x494b44){logger[_0xf00f('0x11')](_0xf00f('0x14'),_0x1672bc);logger[_0xf00f('0xd')](_0xf00f('0x14'),_0x1672bc,JSON[_0xf00f('0x1c')](_0x494b44));_0x78ea95(_0x494b44);})[_0xf00f('0x13')](function(_0x5c4b5d){logger[_0xf00f('0xe')](_0xf00f('0x14'),_0x5c4b5d[_0xf00f('0x10')],_0x1672bc);_0x2c28e2(_0x944eff[_0xf00f('0xe')](0x1f4,_0x5c4b5d[_0xf00f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index aeb7996..71db1ad 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 _0xb257=['get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller'];(function(_0x54597a,_0x4ea42f){var _0x5a764f=function(_0x5c000b){while(--_0x5c000b){_0x54597a['push'](_0x54597a['shift']());}};_0x5a764f(++_0x4ea42f);}(_0xb257,0x13c));var _0x7b25=function(_0x59dffb,_0x5d27ee){_0x59dffb=_0x59dffb-0x0;var _0x15c9ac=_0xb257[_0x59dffb];return _0x15c9ac;};'use strict';var multer=require(_0x7b25('0x0'));var util=require(_0x7b25('0x1'));var path=require(_0x7b25('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7b25('0x3'));var auth=require(_0x7b25('0x4'));var interaction=require(_0x7b25('0x5'));var config=require(_0x7b25('0x6'));var controller=require(_0x7b25('0x7'));router[_0x7b25('0x8')]('/',auth[_0x7b25('0x9')](),controller[_0x7b25('0xa')]);router[_0x7b25('0x8')](_0x7b25('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x7b25('0xc')]('/',auth[_0x7b25('0x9')](),controller[_0x7b25('0xd')]);router[_0x7b25('0xe')](_0x7b25('0xb'),auth[_0x7b25('0x9')](),controller[_0x7b25('0xf')]);router[_0x7b25('0x10')](_0x7b25('0xb'),auth[_0x7b25('0x9')](),controller['destroy']);module[_0x7b25('0x11')]=router; \ No newline at end of file +var _0xf81e=['delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf81e,0x80));var _0xef81=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xf81e[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require(_0xef81('0x0'));var util=require(_0xef81('0x1'));var path=require(_0xef81('0x2'));var timeout=require('connect-timeout');var express=require(_0xef81('0x3'));var router=express[_0xef81('0x4')]();var fs_extra=require(_0xef81('0x5'));var auth=require(_0xef81('0x6'));var interaction=require(_0xef81('0x7'));var config=require(_0xef81('0x8'));var controller=require('./squareProject.controller');router['get']('/',auth[_0xef81('0x9')](),controller[_0xef81('0xa')]);router['get'](_0xef81('0xb'),auth['isAuthenticated'](),controller[_0xef81('0xc')]);router[_0xef81('0xd')]('/',auth[_0xef81('0x9')](),controller[_0xef81('0xe')]);router['put'](_0xef81('0xb'),auth[_0xef81('0x9')](),controller[_0xef81('0xf')]);router[_0xef81('0x10')](_0xef81('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xef81('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 fe92557..48c1526 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 _0x80e6=['BLOB','production','DATE','exports','STRING','TEXT','long','preproduction','getDataValue','toString','utf8'];(function(_0x349d1e,_0x38ebc1){var _0x14cfa3=function(_0x5b71ca){while(--_0x5b71ca){_0x349d1e['push'](_0x349d1e['shift']());}};_0x14cfa3(++_0x38ebc1);}(_0x80e6,0x1e7));var _0x680e=function(_0x4aabcd,_0x20d4e3){_0x4aabcd=_0x4aabcd-0x0;var _0xe5a42b=_0x80e6[_0x4aabcd];return _0xe5a42b;};'use strict';var Sequelize=require('sequelize');module[_0x680e('0x0')]={'name':{'type':Sequelize[_0x680e('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x680e('0x1')]},'notes':{'type':Sequelize[_0x680e('0x2')]},'preproduction':{'type':Sequelize['BLOB'](_0x680e('0x3')),'get':function(){if(this['getDataValue'](_0x680e('0x4'))){return this[_0x680e('0x5')](_0x680e('0x4'))[_0x680e('0x6')](_0x680e('0x7'));}}},'production':{'type':Sequelize[_0x680e('0x8')](_0x680e('0x3')),'get':function(){if(this[_0x680e('0x5')](_0x680e('0x9'))){return this[_0x680e('0x5')](_0x680e('0x9'))[_0x680e('0x6')](_0x680e('0x7'));}}},'savedAt':{'type':Sequelize[_0x680e('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x6b6b=['STRING','BLOB','long','preproduction','toString','utf8','getDataValue','production','DATE','sequelize','name'];(function(_0x2ee497,_0x56cc42){var _0x26ff38=function(_0x43a8a5){while(--_0x43a8a5){_0x2ee497['push'](_0x2ee497['shift']());}};_0x26ff38(++_0x56cc42);}(_0x6b6b,0x1a0));var _0xb6b6=function(_0x557d85,_0x30dd65){_0x557d85=_0x557d85-0x0;var _0x317282=_0x6b6b[_0x557d85];return _0x317282;};'use strict';var Sequelize=require(_0xb6b6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb6b6('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xb6b6('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xb6b6('0x3')](_0xb6b6('0x4')),'get':function(){if(this['getDataValue'](_0xb6b6('0x5'))){return this['getDataValue'](_0xb6b6('0x5'))[_0xb6b6('0x6')](_0xb6b6('0x7'));}}},'production':{'type':Sequelize[_0xb6b6('0x3')](_0xb6b6('0x4')),'get':function(){if(this[_0xb6b6('0x8')](_0xb6b6('0x9'))){return this[_0xb6b6('0x8')](_0xb6b6('0x9'))[_0xb6b6('0x6')](_0xb6b6('0x7'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xb6b6('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 0303aea..8ebb4bb 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 _0x24a3=['agi','stringify','error','stack','name','send','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','SquareProject','includeAll','rows','catch','show','params','rawAttributes','include','create','user','role','SquareProjects','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','production','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','register','status','json','undefined','limit','count','offset','set','Content-Range','update','then','get','UserProfileResource','destroy','publish'];(function(_0x532a08,_0x49ce0d){var _0x1706ef=function(_0x47d776){while(--_0x47d776){_0x532a08['push'](_0x532a08['shift']());}};_0x1706ef(++_0x49ce0d);}(_0x24a3,0x17f));var _0x324a=function(_0x288dcc,_0x22eba8){_0x288dcc=_0x288dcc-0x0;var _0x8c3b3d=_0x24a3[_0x288dcc];return _0x8c3b3d;};'use strict';var _=require('lodash');var Redis=require(_0x324a('0x0'));var qs=require(_0x324a('0x1'));var logger=require(_0x324a('0x2'))(_0x324a('0x3'));var config=require(_0x324a('0x4'));var db=require(_0x324a('0x5'))['db'];config[_0x324a('0x6')]=_[_0x324a('0x7')](config[_0x324a('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x324a('0x8'))(new Redis(config['redis']));require(_0x324a('0x9'))[_0x324a('0xa')](socket);function respondWithResult(_0x13b32f,_0x3a7d8c){_0x3a7d8c=_0x3a7d8c||0xc8;return function(_0x53f9c9){if(_0x53f9c9){return _0x13b32f[_0x324a('0xb')](_0x3a7d8c)[_0x324a('0xc')](_0x53f9c9);}};}function respondWithFilteredResult(_0x5e9626,_0x3611ad){return function(_0x23da5c){if(_0x23da5c){var _0x49be01=typeof _0x3611ad['offset']===_0x324a('0xd')&&typeof _0x3611ad[_0x324a('0xe')]===_0x324a('0xd');var _0xf0072d=_0x23da5c['count'];var _0x391a19=_0x49be01?0x0:_0x3611ad['offset'];var _0x505075=_0x49be01?_0x23da5c[_0x324a('0xf')]:_0x3611ad[_0x324a('0x10')]+_0x3611ad['limit'];var _0x4ca720;if(_0x505075>=_0xf0072d){_0x505075=_0xf0072d;_0x4ca720=0xc8;}else{_0x4ca720=0xce;}_0x5e9626[_0x324a('0xb')](_0x4ca720);return _0x5e9626[_0x324a('0x11')](_0x324a('0x12'),_0x391a19+'-'+_0x505075+'/'+_0xf0072d)['json'](_0x23da5c);}return null;};}function saveUpdates(_0x134201){return function(_0x4c26b1){if(_0x4c26b1){return _0x4c26b1[_0x324a('0x13')](_0x134201)[_0x324a('0x14')](function(_0x3bf119){return _0x3bf119;});}return null;};}function removeEntity(_0x67350c){return function(_0x4620b1){if(_0x4620b1){return _0x4620b1['destroy']()[_0x324a('0x14')](function(){var _0x2afd56=_0x4620b1[_0x324a('0x15')]({'plain':!![]});var _0x4efd28='SquareProjects';return db[_0x324a('0x16')][_0x324a('0x17')]({'where':{'type':_0x4efd28,'resourceId':_0x2afd56['id']}})[_0x324a('0x14')](function(){return _0x4620b1;});})[_0x324a('0x14')](function(){var _0x13281d=new Redis(config[_0x324a('0x6')]);_0x13281d[_0x324a('0x18')](_0x324a('0x19'),JSON[_0x324a('0x1a')]({'id':_0x4620b1['id'],'deleted':!![]}));})[_0x324a('0x14')](function(){_0x67350c[_0x324a('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a9c7a){return function(_0x44658f){if(!_0x44658f){_0x4a9c7a['sendStatus'](0x194);}return _0x44658f;};}function handleError(_0x687585,_0x54bf22){_0x54bf22=_0x54bf22||0x1f4;return function(_0x1f5b66){logger[_0x324a('0x1b')](_0x1f5b66[_0x324a('0x1c')]);if(_0x1f5b66[_0x324a('0x1d')]){delete _0x1f5b66['name'];}_0x687585[_0x324a('0xb')](_0x54bf22)[_0x324a('0x1e')](_0x1f5b66);};}exports['index']=function(_0x17bab5,_0x4a8191){var _0x10abd4={},_0x50038b={},_0x4a0e84={'count':0x0,'rows':[]};var _0x9b41a6=_['map'](db['SquareProject']['rawAttributes'],function(_0x178b33){return{'name':_0x178b33['fieldName'],'type':_0x178b33[_0x324a('0x1f')][_0x324a('0x20')]};});_0x50038b[_0x324a('0x21')]=_[_0x324a('0x22')](_0x9b41a6,_0x324a('0x1d'));_0x50038b[_0x324a('0x23')]=_[_0x324a('0x24')](_0x17bab5[_0x324a('0x23')]);_0x50038b[_0x324a('0x25')]=_[_0x324a('0x26')](_0x50038b[_0x324a('0x21')],_0x50038b[_0x324a('0x23')]);_0x10abd4[_0x324a('0x27')]=_[_0x324a('0x26')](_0x50038b[_0x324a('0x21')],qs[_0x324a('0x28')](_0x17bab5['query']['fields']));_0x10abd4['attributes']=_0x10abd4[_0x324a('0x27')][_0x324a('0x29')]?_0x10abd4[_0x324a('0x27')]:_0x50038b[_0x324a('0x21')];if(!_0x17bab5[_0x324a('0x23')][_0x324a('0x2a')]('nolimit')){_0x10abd4[_0x324a('0xe')]=qs['limit'](_0x17bab5['query'][_0x324a('0xe')]);_0x10abd4['offset']=qs[_0x324a('0x10')](_0x17bab5[_0x324a('0x23')]['offset']);}_0x10abd4[_0x324a('0x2b')]=qs[_0x324a('0x2c')](_0x17bab5['query']['sort']);_0x10abd4[_0x324a('0x2d')]=qs[_0x324a('0x25')](_[_0x324a('0x2e')](_0x17bab5[_0x324a('0x23')],_0x50038b[_0x324a('0x25')]),_0x9b41a6);if(_0x17bab5[_0x324a('0x23')][_0x324a('0x2f')]){_0x10abd4[_0x324a('0x2d')]=_[_0x324a('0x30')](_0x10abd4[_0x324a('0x2d')],{'$or':_[_0x324a('0x22')](_0x9b41a6,function(_0x379291){if(_0x379291[_0x324a('0x1f')]!=='VIRTUAL'){var _0x4805bc={};_0x4805bc[_0x379291['name']]={'$like':'%'+_0x17bab5[_0x324a('0x23')][_0x324a('0x2f')]+'%'};return _0x4805bc;}})});}_0x10abd4=_[_0x324a('0x30')]({},_0x10abd4,_0x17bab5[_0x324a('0x31')]);var _0x1b1f60={'where':_0x10abd4['where']};return db[_0x324a('0x32')][_0x324a('0xf')](_0x1b1f60)[_0x324a('0x14')](function(_0x48817b){_0x4a0e84[_0x324a('0xf')]=_0x48817b;if(_0x17bab5[_0x324a('0x23')][_0x324a('0x33')]){_0x10abd4['include']=[{'all':!![]}];}return db[_0x324a('0x32')]['findAll'](_0x10abd4);})[_0x324a('0x14')](function(_0x4a5661){_0x4a0e84[_0x324a('0x34')]=_0x4a5661;return _0x4a0e84;})[_0x324a('0x14')](respondWithFilteredResult(_0x4a8191,_0x10abd4))[_0x324a('0x35')](handleError(_0x4a8191,null));};exports[_0x324a('0x36')]=function(_0x556ea2,_0x3371ff){var _0x213090={'raw':![],'where':{'id':_0x556ea2[_0x324a('0x37')]['id']}},_0x178ac2={};_0x178ac2[_0x324a('0x21')]=_['keys'](db[_0x324a('0x32')][_0x324a('0x38')]);_0x178ac2['query']=_[_0x324a('0x24')](_0x556ea2['query']);_0x178ac2[_0x324a('0x25')]=_[_0x324a('0x26')](_0x178ac2[_0x324a('0x21')],_0x178ac2[_0x324a('0x23')]);_0x213090['attributes']=_[_0x324a('0x26')](_0x178ac2[_0x324a('0x21')],qs[_0x324a('0x28')](_0x556ea2[_0x324a('0x23')][_0x324a('0x28')]));_0x213090['attributes']=_0x213090[_0x324a('0x27')][_0x324a('0x29')]?_0x213090['attributes']:_0x178ac2[_0x324a('0x21')];if(_0x556ea2[_0x324a('0x23')][_0x324a('0x33')]){_0x213090[_0x324a('0x39')]=[{'all':!![]}];}_0x213090=_[_0x324a('0x30')]({},_0x213090,_0x556ea2['options']);return db[_0x324a('0x32')]['find'](_0x213090)['then'](handleEntityNotFound(_0x3371ff,null))['then'](respondWithResult(_0x3371ff,null))[_0x324a('0x35')](handleError(_0x3371ff,null));};exports[_0x324a('0x3a')]=function(_0x136850,_0x3b8130){return db[_0x324a('0x32')][_0x324a('0x3a')](_0x136850['body'],{})[_0x324a('0x14')](function(_0x2ba844){var _0x2b8832=_0x136850[_0x324a('0x3b')][_0x324a('0x15')]({'plain':!![]});if(!_0x2b8832)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b8832[_0x324a('0x3c')]===_0x324a('0x3b')){var _0x569873=_0x2ba844['get']({'plain':!![]});var _0x213f20=_0x324a('0x3d');return db['UserProfileSection'][_0x324a('0x3e')]({'where':{'name':_0x213f20,'userProfileId':_0x2b8832[_0x324a('0x3f')]},'raw':!![]})[_0x324a('0x14')](function(_0x2aec88){if(_0x2aec88&&_0x2aec88[_0x324a('0x40')]===0x0){return db[_0x324a('0x16')]['create']({'name':_0x569873[_0x324a('0x1d')],'resourceId':_0x569873['id'],'type':_0x2aec88[_0x324a('0x1d')],'sectionId':_0x2aec88['id']},{})[_0x324a('0x14')](function(){return _0x2ba844;});}else{return _0x2ba844;}})[_0x324a('0x35')](function(_0x1363ee){logger[_0x324a('0x1b')](_0x324a('0x41'),_0x1363ee);throw _0x1363ee;});}return _0x2ba844;})['then'](respondWithResult(_0x3b8130,0xc9))[_0x324a('0x35')](handleError(_0x3b8130,null));};exports[_0x324a('0x13')]=function(_0x6c0df8,_0x2031ef){if(_0x6c0df8[_0x324a('0x42')]['id']){delete _0x6c0df8[_0x324a('0x42')]['id'];}return db['SquareProject'][_0x324a('0x3e')]({'where':{'id':_0x6c0df8[_0x324a('0x37')]['id']}})[_0x324a('0x14')](handleEntityNotFound(_0x2031ef,null))[_0x324a('0x14')](saveUpdates(_0x6c0df8['body'],null))[_0x324a('0x14')](function(_0x3143d2){if(!_0x3143d2)return;var _0x116dc0=_0x3143d2[_0x324a('0x15')]({'plain':!![]});return _0x116dc0;})[_0x324a('0x14')](function(_0x29f5bf){var _0x3ddd79=new Redis(config[_0x324a('0x6')]);_0x3ddd79[_0x324a('0x18')](_0x324a('0x19'),JSON[_0x324a('0x1a')](_['pick'](_0x29f5bf,['id',_0x324a('0x1d'),_0x324a('0x43')])));return _0x29f5bf;})[_0x324a('0x14')](respondWithResult(_0x2031ef,null))[_0x324a('0x35')](handleError(_0x2031ef,null));};exports['destroy']=function(_0x4ff7e3,_0x88738b){return db[_0x324a('0x32')]['find']({'where':{'id':_0x4ff7e3[_0x324a('0x37')]['id']}})[_0x324a('0x14')](handleEntityNotFound(_0x88738b,null))['then'](removeEntity(_0x88738b,null))[_0x324a('0x35')](handleError(_0x88738b,null));}; \ No newline at end of file +var _0x2c88=['destroy','SquareProjects','UserProfileResource','publish','agi','stringify','end','sendStatus','error','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','catch','show','params','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','lodash','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','then'];(function(_0x256e32,_0x4013bc){var _0x464070=function(_0x449398){while(--_0x449398){_0x256e32['push'](_0x256e32['shift']());}};_0x464070(++_0x4013bc);}(_0x2c88,0xfe));var _0x82c8=function(_0x2eb886,_0xcd7ebe){_0x2eb886=_0x2eb886-0x0;var _0x2d2fe7=_0x2c88[_0x2eb886];return _0x2d2fe7;};'use strict';var _=require(_0x82c8('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0x82c8('0x1'));var db=require(_0x82c8('0x2'))['db'];config[_0x82c8('0x3')]=_[_0x82c8('0x4')](config['redis'],{'host':_0x82c8('0x5'),'port':0x18eb});var socket=require(_0x82c8('0x6'))(new Redis(config[_0x82c8('0x3')]));require(_0x82c8('0x7'))[_0x82c8('0x8')](socket);function respondWithResult(_0x53b782,_0x4cbba3){_0x4cbba3=_0x4cbba3||0xc8;return function(_0x380a69){if(_0x380a69){return _0x53b782[_0x82c8('0x9')](_0x4cbba3)[_0x82c8('0xa')](_0x380a69);}};}function respondWithFilteredResult(_0x10545d,_0x3e9c56){return function(_0x24d0d9){if(_0x24d0d9){var _0x21f4b5=typeof _0x3e9c56[_0x82c8('0xb')]==='undefined'&&typeof _0x3e9c56['limit']===_0x82c8('0xc');var _0x1805dc=_0x24d0d9[_0x82c8('0xd')];var _0x49664a=_0x21f4b5?0x0:_0x3e9c56['offset'];var _0x4782c9=_0x21f4b5?_0x24d0d9[_0x82c8('0xd')]:_0x3e9c56[_0x82c8('0xb')]+_0x3e9c56[_0x82c8('0xe')];var _0x42c189;if(_0x4782c9>=_0x1805dc){_0x4782c9=_0x1805dc;_0x42c189=0xc8;}else{_0x42c189=0xce;}_0x10545d['status'](_0x42c189);return _0x10545d[_0x82c8('0xf')](_0x82c8('0x10'),_0x49664a+'-'+_0x4782c9+'/'+_0x1805dc)['json'](_0x24d0d9);}return null;};}function saveUpdates(_0xb93191){return function(_0xf7c81){if(_0xf7c81){return _0xf7c81['update'](_0xb93191)[_0x82c8('0x11')](function(_0x1495f1){return _0x1495f1;});}return null;};}function removeEntity(_0x536409){return function(_0x1f3921){if(_0x1f3921){return _0x1f3921[_0x82c8('0x12')]()[_0x82c8('0x11')](function(){var _0x588c0e=_0x1f3921['get']({'plain':!![]});var _0xc76e88=_0x82c8('0x13');return db[_0x82c8('0x14')][_0x82c8('0x12')]({'where':{'type':_0xc76e88,'resourceId':_0x588c0e['id']}})[_0x82c8('0x11')](function(){return _0x1f3921;});})[_0x82c8('0x11')](function(){var _0x36e6b1=new Redis(config['redis']);_0x36e6b1[_0x82c8('0x15')](_0x82c8('0x16'),JSON[_0x82c8('0x17')]({'id':_0x1f3921['id'],'deleted':!![]}));})[_0x82c8('0x11')](function(){_0x536409[_0x82c8('0x9')](0xcc)[_0x82c8('0x18')]();});}};}function handleEntityNotFound(_0xde78e0){return function(_0xced83f){if(!_0xced83f){_0xde78e0[_0x82c8('0x19')](0x194);}return _0xced83f;};}function handleError(_0x5e7655,_0x21d2fd){_0x21d2fd=_0x21d2fd||0x1f4;return function(_0x4db1a8){logger[_0x82c8('0x1a')](_0x4db1a8['stack']);if(_0x4db1a8[_0x82c8('0x1b')]){delete _0x4db1a8[_0x82c8('0x1b')];}_0x5e7655[_0x82c8('0x9')](_0x21d2fd)[_0x82c8('0x1c')](_0x4db1a8);};}exports[_0x82c8('0x1d')]=function(_0xb61da4,_0x132df2){var _0x4cadbf={},_0x380980={},_0x29daa1={'count':0x0,'rows':[]};var _0x31bc48=_[_0x82c8('0x1e')](db[_0x82c8('0x1f')][_0x82c8('0x20')],function(_0x4b3d13){return{'name':_0x4b3d13[_0x82c8('0x21')],'type':_0x4b3d13[_0x82c8('0x22')][_0x82c8('0x23')]};});_0x380980['model']=_['map'](_0x31bc48,_0x82c8('0x1b'));_0x380980['query']=_[_0x82c8('0x24')](_0xb61da4[_0x82c8('0x25')]);_0x380980[_0x82c8('0x26')]=_[_0x82c8('0x27')](_0x380980[_0x82c8('0x28')],_0x380980[_0x82c8('0x25')]);_0x4cadbf['attributes']=_['intersection'](_0x380980[_0x82c8('0x28')],qs[_0x82c8('0x29')](_0xb61da4['query']['fields']));_0x4cadbf['attributes']=_0x4cadbf[_0x82c8('0x2a')]['length']?_0x4cadbf[_0x82c8('0x2a')]:_0x380980[_0x82c8('0x28')];if(!_0xb61da4[_0x82c8('0x25')][_0x82c8('0x2b')](_0x82c8('0x2c'))){_0x4cadbf[_0x82c8('0xe')]=qs[_0x82c8('0xe')](_0xb61da4[_0x82c8('0x25')][_0x82c8('0xe')]);_0x4cadbf[_0x82c8('0xb')]=qs[_0x82c8('0xb')](_0xb61da4[_0x82c8('0x25')][_0x82c8('0xb')]);}_0x4cadbf[_0x82c8('0x2d')]=qs[_0x82c8('0x2e')](_0xb61da4['query'][_0x82c8('0x2e')]);_0x4cadbf[_0x82c8('0x2f')]=qs[_0x82c8('0x26')](_[_0x82c8('0x30')](_0xb61da4[_0x82c8('0x25')],_0x380980['filters']),_0x31bc48);if(_0xb61da4[_0x82c8('0x25')][_0x82c8('0x31')]){_0x4cadbf[_0x82c8('0x2f')]=_[_0x82c8('0x32')](_0x4cadbf[_0x82c8('0x2f')],{'$or':_[_0x82c8('0x1e')](_0x31bc48,function(_0x90ec1c){if(_0x90ec1c['type']!=='VIRTUAL'){var _0x43b4ad={};_0x43b4ad[_0x90ec1c[_0x82c8('0x1b')]]={'$like':'%'+_0xb61da4['query'][_0x82c8('0x31')]+'%'};return _0x43b4ad;}})});}_0x4cadbf=_[_0x82c8('0x32')]({},_0x4cadbf,_0xb61da4[_0x82c8('0x33')]);var _0x12f56d={'where':_0x4cadbf[_0x82c8('0x2f')]};return db[_0x82c8('0x1f')][_0x82c8('0xd')](_0x12f56d)[_0x82c8('0x11')](function(_0x4daacf){_0x29daa1[_0x82c8('0xd')]=_0x4daacf;if(_0xb61da4['query']['includeAll']){_0x4cadbf['include']=[{'all':!![]}];}return db[_0x82c8('0x1f')][_0x82c8('0x34')](_0x4cadbf);})[_0x82c8('0x11')](function(_0x427aff){_0x29daa1['rows']=_0x427aff;return _0x29daa1;})[_0x82c8('0x11')](respondWithFilteredResult(_0x132df2,_0x4cadbf))[_0x82c8('0x35')](handleError(_0x132df2,null));};exports[_0x82c8('0x36')]=function(_0x2530ff,_0x74b5b2){var _0x2d730d={'raw':![],'where':{'id':_0x2530ff[_0x82c8('0x37')]['id']}},_0x458315={};_0x458315[_0x82c8('0x28')]=_[_0x82c8('0x24')](db[_0x82c8('0x1f')]['rawAttributes']);_0x458315[_0x82c8('0x25')]=_[_0x82c8('0x24')](_0x2530ff['query']);_0x458315[_0x82c8('0x26')]=_['intersection'](_0x458315[_0x82c8('0x28')],_0x458315['query']);_0x2d730d[_0x82c8('0x2a')]=_['intersection'](_0x458315['model'],qs[_0x82c8('0x29')](_0x2530ff['query'][_0x82c8('0x29')]));_0x2d730d['attributes']=_0x2d730d[_0x82c8('0x2a')]['length']?_0x2d730d[_0x82c8('0x2a')]:_0x458315[_0x82c8('0x28')];if(_0x2530ff[_0x82c8('0x25')][_0x82c8('0x38')]){_0x2d730d['include']=[{'all':!![]}];}_0x2d730d=_[_0x82c8('0x32')]({},_0x2d730d,_0x2530ff['options']);return db[_0x82c8('0x1f')]['find'](_0x2d730d)[_0x82c8('0x11')](handleEntityNotFound(_0x74b5b2,null))['then'](respondWithResult(_0x74b5b2,null))['catch'](handleError(_0x74b5b2,null));};exports['create']=function(_0x2c1f73,_0x1ccfc7){return db[_0x82c8('0x1f')][_0x82c8('0x39')](_0x2c1f73[_0x82c8('0x3a')],{})['then'](function(_0x4d356f){var _0x42fc38=_0x2c1f73[_0x82c8('0x3b')][_0x82c8('0x3c')]({'plain':!![]});if(!_0x42fc38)throw new Error(_0x82c8('0x3d'));if(_0x42fc38[_0x82c8('0x3e')]==='user'){var _0x27687f=_0x4d356f[_0x82c8('0x3c')]({'plain':!![]});var _0x1e2379=_0x82c8('0x13');return db[_0x82c8('0x3f')]['find']({'where':{'name':_0x1e2379,'userProfileId':_0x42fc38['userProfileId']},'raw':!![]})[_0x82c8('0x11')](function(_0x420681){if(_0x420681&&_0x420681[_0x82c8('0x40')]===0x0){return db[_0x82c8('0x14')]['create']({'name':_0x27687f['name'],'resourceId':_0x27687f['id'],'type':_0x420681['name'],'sectionId':_0x420681['id']},{})[_0x82c8('0x11')](function(){return _0x4d356f;});}else{return _0x4d356f;}})[_0x82c8('0x35')](function(_0x40f93c){logger['error'](_0x82c8('0x41'),_0x40f93c);throw _0x40f93c;});}return _0x4d356f;})[_0x82c8('0x11')](respondWithResult(_0x1ccfc7,0xc9))[_0x82c8('0x35')](handleError(_0x1ccfc7,null));};exports[_0x82c8('0x42')]=function(_0x3ab928,_0x58a159){if(_0x3ab928[_0x82c8('0x3a')]['id']){delete _0x3ab928[_0x82c8('0x3a')]['id'];}return db[_0x82c8('0x1f')]['find']({'where':{'id':_0x3ab928['params']['id']}})[_0x82c8('0x11')](handleEntityNotFound(_0x58a159,null))['then'](saveUpdates(_0x3ab928[_0x82c8('0x3a')],null))[_0x82c8('0x11')](function(_0x29fb07){if(!_0x29fb07)return;var _0x9ee1ca=_0x29fb07[_0x82c8('0x3c')]({'plain':!![]});return _0x9ee1ca;})[_0x82c8('0x11')](function(_0xd7ae5a){var _0x4f66b7=new Redis(config[_0x82c8('0x3')]);_0x4f66b7['publish'](_0x82c8('0x16'),JSON[_0x82c8('0x17')](_[_0x82c8('0x30')](_0xd7ae5a,['id',_0x82c8('0x1b'),'production'])));return _0xd7ae5a;})[_0x82c8('0x11')](respondWithResult(_0x58a159,null))[_0x82c8('0x35')](handleError(_0x58a159,null));};exports['destroy']=function(_0x54edda,_0x2693a3){return db['SquareProject'][_0x82c8('0x43')]({'where':{'id':_0x54edda[_0x82c8('0x37')]['id']}})['then'](handleEntityNotFound(_0x2693a3,null))[_0x82c8('0x11')](removeEntity(_0x2693a3,null))[_0x82c8('0x35')](handleError(_0x2693a3,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 0404e70..6e44919 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 _0x3394=['hook','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0xf6fc32,_0x175c5e){var _0x32a988=function(_0x42f16f){while(--_0x42f16f){_0xf6fc32['push'](_0xf6fc32['shift']());}};_0x32a988(++_0x175c5e);}(_0x3394,0x181));var _0x4339=function(_0x5b1c65,_0x3f70ed){_0x5b1c65=_0x5b1c65-0x0;var _0x3e178d=_0x3394[_0x5b1c65];return _0x3e178d;};'use strict';var EventEmitter=require(_0x4339('0x0'));var SquareProject=require(_0x4339('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x4339('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4339('0x3'),'afterDestroy':_0x4339('0x4')};function emitEvent(_0x14cb30){return function(_0x7ba519,_0x2e41ec,_0x244eb9){SquareProjectEvents['emit'](_0x14cb30+':'+_0x7ba519['id'],_0x7ba519);SquareProjectEvents[_0x4339('0x5')](_0x14cb30,_0x7ba519);_0x244eb9(null);};}for(var e in events){if(events[_0x4339('0x6')](e)){var event=events[e];SquareProject[_0x4339('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x8824=['remove','emit','hook','exports','events','SquareProject','setMaxListeners','save'];(function(_0x2ae2dd,_0x2bacf3){var _0x5d9904=function(_0x2994e4){while(--_0x2994e4){_0x2ae2dd['push'](_0x2ae2dd['shift']());}};_0x5d9904(++_0x2bacf3);}(_0x8824,0x10c));var _0x4882=function(_0x193161,_0x32443a){_0x193161=_0x193161-0x0;var _0xe45131=_0x8824[_0x193161];return _0xe45131;};'use strict';var EventEmitter=require(_0x4882('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x4882('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x4882('0x2')](0x0);var events={'afterCreate':_0x4882('0x3'),'afterUpdate':'update','afterDestroy':_0x4882('0x4')};function emitEvent(_0x31f626){return function(_0x4eab9b,_0x2abd5e,_0xacc731){SquareProjectEvents[_0x4882('0x5')](_0x31f626+':'+_0x4eab9b['id'],_0x4eab9b);SquareProjectEvents[_0x4882('0x5')](_0x31f626,_0x4eab9b);_0xacc731(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x4882('0x6')](e,emitEvent(event));}}module[_0x4882('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 608e677..4f15058 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 _0x70e4=['util','api','moment','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','lodash'];(function(_0x6955fa,_0xfc21ed){var _0x5c0670=function(_0x12317f){while(--_0x12317f){_0x6955fa['push'](_0x6955fa['shift']());}};_0x5c0670(++_0xfc21ed);}(_0x70e4,0xdf));var _0x470e=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x70e4[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x470e('0x0'));var util=require(_0x470e('0x1'));var logger=require('../../config/logger')(_0x470e('0x2'));var moment=require(_0x470e('0x3'));var BPromise=require(_0x470e('0x4'));var rp=require(_0x470e('0x5'));var fs=require('fs');var path=require(_0x470e('0x6'));var rimraf=require('rimraf');var config=require(_0x470e('0x7'));var attributes=require(_0x470e('0x8'));module['exports']=function(_0x25ed8b,_0x24afa1){return _0x25ed8b['define']('SquareProject',attributes,{'tableName':_0x470e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2934a9,_0x4a22fc,_0x183b2c){if(_0x2934a9['changed'](_0x470e('0xa'))){_0x2934a9[_0x470e('0xb')]=moment()[_0x470e('0xc')](_0x470e('0xd'));}if(_0x2934a9[_0x470e('0xe')](_0x470e('0xf'))){_0x2934a9['publishedAt']=moment()[_0x470e('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x183b2c(null,_0x2934a9);}}});}; \ No newline at end of file +var _0xd204=['preproduction','savedAt','format','changed','production','publishedAt','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','SquareProject','square_projects'];(function(_0x477502,_0x479111){var _0x1e1e8a=function(_0x33f2ba){while(--_0x33f2ba){_0x477502['push'](_0x477502['shift']());}};_0x1e1e8a(++_0x479111);}(_0xd204,0x138));var _0x4d20=function(_0x1e52ef,_0x2195e5){_0x1e52ef=_0x1e52ef-0x0;var _0x6658e9=_0xd204[_0x1e52ef];return _0x6658e9;};'use strict';var _=require(_0x4d20('0x0'));var util=require(_0x4d20('0x1'));var logger=require('../../config/logger')(_0x4d20('0x2'));var moment=require(_0x4d20('0x3'));var BPromise=require(_0x4d20('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d20('0x5'));var rimraf=require(_0x4d20('0x6'));var config=require(_0x4d20('0x7'));var attributes=require('./squareProject.attributes');module[_0x4d20('0x8')]=function(_0x197023,_0x1211af){return _0x197023[_0x4d20('0x9')](_0x4d20('0xa'),attributes,{'tableName':_0x4d20('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x24cfaf,_0x863c19,_0x4eca8b){if(_0x24cfaf['changed'](_0x4d20('0xc'))){_0x24cfaf[_0x4d20('0xd')]=moment()[_0x4d20('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x24cfaf[_0x4d20('0xf')](_0x4d20('0x10'))){_0x24cfaf[_0x4d20('0x11')]=moment()[_0x4d20('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4eca8b(null,_0x24cfaf);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 8827da4..77a91d1 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 _0x8ee4=['findAll','options','raw','where','limit','include','map','model','attributes','then','info','debug','catch','error','message','ShowSquareProject','stringify','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','localhost','./squareProject.socket','GetSquareProjects','SquareProject'];(function(_0x14b46c,_0x573d42){var _0x437b62=function(_0x7b716a){while(--_0x7b716a){_0x14b46c['push'](_0x14b46c['shift']());}};_0x437b62(++_0x573d42);}(_0x8ee4,0x7d));var _0x48ee=function(_0x2c68e1,_0x4dc473){_0x2c68e1=_0x2c68e1-0x0;var _0x1f1550=_0x8ee4[_0x2c68e1];return _0x1f1550;};'use strict';var _=require('lodash');var Redis=require(_0x48ee('0x0'));var db=require(_0x48ee('0x1'))['db'];var logger=require(_0x48ee('0x2'))('rpc');var config=require(_0x48ee('0x3'));config[_0x48ee('0x4')]=_[_0x48ee('0x5')](config[_0x48ee('0x4')],{'host':_0x48ee('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x48ee('0x4')]));require(_0x48ee('0x7'))['register'](socket);exports[_0x48ee('0x8')]=function(_0x2c8046){var _0x1c8ddc=this;return new Promise(function(_0x4c2da1,_0x4ae808){return db[_0x48ee('0x9')][_0x48ee('0xa')]({'raw':_0x2c8046[_0x48ee('0xb')]?_0x2c8046[_0x48ee('0xb')][_0x48ee('0xc')]===undefined?!![]:![]:!![],'where':_0x2c8046[_0x48ee('0xb')]?_0x2c8046[_0x48ee('0xb')][_0x48ee('0xd')]||null:null,'attributes':_0x2c8046[_0x48ee('0xb')]?_0x2c8046[_0x48ee('0xb')]['attributes']||null:null,'limit':_0x2c8046[_0x48ee('0xb')]?_0x2c8046[_0x48ee('0xb')][_0x48ee('0xe')]||null:null,'include':_0x2c8046[_0x48ee('0xb')]?_0x2c8046[_0x48ee('0xb')][_0x48ee('0xf')]?_[_0x48ee('0x10')](_0x2c8046['options'][_0x48ee('0xf')],function(_0x5d8c02){return{'model':db[_0x5d8c02['model']],'as':_0x5d8c02['as'],'attributes':_0x5d8c02['attributes'],'include':_0x5d8c02[_0x48ee('0xf')]?_[_0x48ee('0x10')](_0x5d8c02['include'],function(_0x115f76){return{'model':db[_0x115f76[_0x48ee('0x11')]],'as':_0x115f76['as'],'attributes':_0x115f76[_0x48ee('0x12')],'include':_0x115f76[_0x48ee('0xf')]?_[_0x48ee('0x10')](_0x115f76['include'],function(_0x3ab862){return{'model':db[_0x3ab862[_0x48ee('0x11')]],'as':_0x3ab862['as'],'attributes':_0x3ab862[_0x48ee('0x12')]};}):[]};}):[]};}):[]:[]})[_0x48ee('0x13')](function(_0xba4335){logger[_0x48ee('0x14')](_0x48ee('0x8'),_0x2c8046);logger[_0x48ee('0x15')](_0x48ee('0x8'),_0x2c8046,JSON['stringify'](_0xba4335));_0x4c2da1(_0xba4335);})[_0x48ee('0x16')](function(_0x1e8a12){logger[_0x48ee('0x17')](_0x48ee('0x8'),_0x1e8a12[_0x48ee('0x18')],_0x2c8046);_0x4ae808(_0x1c8ddc[_0x48ee('0x17')](0x1f4,_0x1e8a12[_0x48ee('0x18')]));});});};exports[_0x48ee('0x19')]=function(_0x4b3cf1){var _0x173f9d=this;return new Promise(function(_0x1ce48e,_0x3a46ae){return db[_0x48ee('0x9')]['find']({'raw':_0x4b3cf1[_0x48ee('0xb')]?_0x4b3cf1['options'][_0x48ee('0xc')]===undefined?!![]:![]:!![],'where':_0x4b3cf1[_0x48ee('0xb')]?_0x4b3cf1[_0x48ee('0xb')][_0x48ee('0xd')]||null:null,'attributes':_0x4b3cf1[_0x48ee('0xb')]?_0x4b3cf1[_0x48ee('0xb')][_0x48ee('0x12')]||null:null,'include':_0x4b3cf1[_0x48ee('0xb')]?_0x4b3cf1['options']['include']?_[_0x48ee('0x10')](_0x4b3cf1[_0x48ee('0xb')]['include'],function(_0x5af453){return{'model':db[_0x5af453[_0x48ee('0x11')]],'as':_0x5af453['as'],'attributes':_0x5af453[_0x48ee('0x12')],'include':_0x5af453['include']?_[_0x48ee('0x10')](_0x5af453[_0x48ee('0xf')],function(_0x1b9570){return{'model':db[_0x1b9570['model']],'as':_0x1b9570['as'],'attributes':_0x1b9570[_0x48ee('0x12')],'include':_0x1b9570['include']?_[_0x48ee('0x10')](_0x1b9570['include'],function(_0x45d1f2){return{'model':db[_0x45d1f2[_0x48ee('0x11')]],'as':_0x45d1f2['as'],'attributes':_0x45d1f2[_0x48ee('0x12')]};}):[]};}):[]};}):[]:[]})[_0x48ee('0x13')](function(_0x176caa){logger[_0x48ee('0x14')](_0x48ee('0x19'),_0x4b3cf1);logger[_0x48ee('0x15')](_0x48ee('0x19'),_0x4b3cf1,JSON[_0x48ee('0x1a')](_0x176caa));_0x1ce48e(_0x176caa);})['catch'](function(_0x4b8940){logger[_0x48ee('0x17')](_0x48ee('0x19'),_0x4b8940[_0x48ee('0x18')],_0x4b3cf1);_0x3a46ae(_0x173f9d[_0x48ee('0x17')](0x1f4,_0x4b8940[_0x48ee('0x18')]));});});}; \ No newline at end of file +var _0xfed6=['debug','catch','error','message','find','raw','then','info','ShowSquareProject','stringify','lodash','ioredis','../../mysqldb','../../config/logger','rpc','redis','socket.io-emitter','./squareProject.socket','GetSquareProjects','SquareProject','findAll','options','where','attributes','limit','include','map','model'];(function(_0x3b2b9e,_0x24aedf){var _0x2ffff3=function(_0x5b95b2){while(--_0x5b95b2){_0x3b2b9e['push'](_0x3b2b9e['shift']());}};_0x2ffff3(++_0x24aedf);}(_0xfed6,0xb2));var _0x6fed=function(_0x389c88,_0x46d30a){_0x389c88=_0x389c88-0x0;var _0x32b899=_0xfed6[_0x389c88];return _0x32b899;};'use strict';var _=require(_0x6fed('0x0'));var Redis=require(_0x6fed('0x1'));var db=require(_0x6fed('0x2'))['db'];var logger=require(_0x6fed('0x3'))(_0x6fed('0x4'));var config=require('../../config/environment');config[_0x6fed('0x5')]=_['defaults'](config[_0x6fed('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x6fed('0x6'))(new Redis(config[_0x6fed('0x5')]));require(_0x6fed('0x7'))['register'](socket);exports[_0x6fed('0x8')]=function(_0x2674a5){var _0x143e16=this;return new Promise(function(_0xa78c2,_0x10fdef){return db[_0x6fed('0x9')][_0x6fed('0xa')]({'raw':_0x2674a5[_0x6fed('0xb')]?_0x2674a5[_0x6fed('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x2674a5[_0x6fed('0xb')]?_0x2674a5[_0x6fed('0xb')][_0x6fed('0xc')]||null:null,'attributes':_0x2674a5[_0x6fed('0xb')]?_0x2674a5[_0x6fed('0xb')][_0x6fed('0xd')]||null:null,'limit':_0x2674a5['options']?_0x2674a5[_0x6fed('0xb')][_0x6fed('0xe')]||null:null,'include':_0x2674a5[_0x6fed('0xb')]?_0x2674a5['options'][_0x6fed('0xf')]?_[_0x6fed('0x10')](_0x2674a5[_0x6fed('0xb')][_0x6fed('0xf')],function(_0x5a64cc){return{'model':db[_0x5a64cc[_0x6fed('0x11')]],'as':_0x5a64cc['as'],'attributes':_0x5a64cc['attributes'],'include':_0x5a64cc[_0x6fed('0xf')]?_[_0x6fed('0x10')](_0x5a64cc[_0x6fed('0xf')],function(_0x4f6695){return{'model':db[_0x4f6695[_0x6fed('0x11')]],'as':_0x4f6695['as'],'attributes':_0x4f6695[_0x6fed('0xd')],'include':_0x4f6695['include']?_['map'](_0x4f6695[_0x6fed('0xf')],function(_0x55aaba){return{'model':db[_0x55aaba[_0x6fed('0x11')]],'as':_0x55aaba['as'],'attributes':_0x55aaba[_0x6fed('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2942f1){logger['info'](_0x6fed('0x8'),_0x2674a5);logger[_0x6fed('0x12')](_0x6fed('0x8'),_0x2674a5,JSON['stringify'](_0x2942f1));_0xa78c2(_0x2942f1);})[_0x6fed('0x13')](function(_0xf2378f){logger[_0x6fed('0x14')]('GetSquareProjects',_0xf2378f['message'],_0x2674a5);_0x10fdef(_0x143e16[_0x6fed('0x14')](0x1f4,_0xf2378f[_0x6fed('0x15')]));});});};exports['ShowSquareProject']=function(_0x14cb78){var _0x39c7c1=this;return new Promise(function(_0x113d17,_0x52b8ed){return db[_0x6fed('0x9')][_0x6fed('0x16')]({'raw':_0x14cb78['options']?_0x14cb78[_0x6fed('0xb')][_0x6fed('0x17')]===undefined?!![]:![]:!![],'where':_0x14cb78[_0x6fed('0xb')]?_0x14cb78[_0x6fed('0xb')][_0x6fed('0xc')]||null:null,'attributes':_0x14cb78[_0x6fed('0xb')]?_0x14cb78[_0x6fed('0xb')]['attributes']||null:null,'include':_0x14cb78[_0x6fed('0xb')]?_0x14cb78[_0x6fed('0xb')][_0x6fed('0xf')]?_['map'](_0x14cb78['options']['include'],function(_0x1d19a8){return{'model':db[_0x1d19a8['model']],'as':_0x1d19a8['as'],'attributes':_0x1d19a8[_0x6fed('0xd')],'include':_0x1d19a8['include']?_[_0x6fed('0x10')](_0x1d19a8[_0x6fed('0xf')],function(_0x1bfdb2){return{'model':db[_0x1bfdb2[_0x6fed('0x11')]],'as':_0x1bfdb2['as'],'attributes':_0x1bfdb2[_0x6fed('0xd')],'include':_0x1bfdb2[_0x6fed('0xf')]?_[_0x6fed('0x10')](_0x1bfdb2['include'],function(_0x45d48a){return{'model':db[_0x45d48a[_0x6fed('0x11')]],'as':_0x45d48a['as'],'attributes':_0x45d48a[_0x6fed('0xd')]};}):[]};}):[]};}):[]:[]})[_0x6fed('0x18')](function(_0x3cbe4a){logger[_0x6fed('0x19')](_0x6fed('0x1a'),_0x14cb78);logger[_0x6fed('0x12')](_0x6fed('0x1a'),_0x14cb78,JSON[_0x6fed('0x1b')](_0x3cbe4a));_0x113d17(_0x3cbe4a);})[_0x6fed('0x13')](function(_0x39c811){logger['error'](_0x6fed('0x1a'),_0x39c811[_0x6fed('0x15')],_0x14cb78);_0x52b8ed(_0x39c7c1[_0x6fed('0x14')](0x1f4,_0x39c811[_0x6fed('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 8398ac9..8150513 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 _0xf219=['squareProject:','save','remove','update','removeListener','register','length'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0xf219,0x12e));var _0x9f21=function(_0x21d3d5,_0x38163c){_0x21d3d5=_0x21d3d5-0x0;var _0xf0057b=_0xf219[_0x21d3d5];return _0xf0057b;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x9f21('0x0'),_0x9f21('0x1'),_0x9f21('0x2')];function createListener(_0x13bfa2,_0x1b083d){return function(_0x1c152a){_0x1b083d['emit'](_0x13bfa2,_0x1c152a);};}function removeListener(_0xea7b62,_0x520493){return function(){SquareProjectEvents[_0x9f21('0x3')](_0xea7b62,_0x520493);};}exports[_0x9f21('0x4')]=function(_0x56a894){for(var _0x38d5e9=0x0,_0x56661a=events[_0x9f21('0x5')];_0x38d5e9<_0x56661a;_0x38d5e9++){var _0x2b9ddf=events[_0x38d5e9];var _0xd15f11=createListener(_0x9f21('0x6')+_0x2b9ddf,_0x56a894);SquareProjectEvents['on'](_0x2b9ddf,_0xd15f11);}}; \ No newline at end of file +var _0x7bba=['length','squareProject:','./squareProject.events','save','remove','update','removeListener','register'];(function(_0x15e2a9,_0x229aa0){var _0x33848d=function(_0x193c72){while(--_0x193c72){_0x15e2a9['push'](_0x15e2a9['shift']());}};_0x33848d(++_0x229aa0);}(_0x7bba,0xd2));var _0xa7bb=function(_0x291e73,_0x240beb){_0x291e73=_0x291e73-0x0;var _0x15a90f=_0x7bba[_0x291e73];return _0x15a90f;};'use strict';var SquareProjectEvents=require(_0xa7bb('0x0'));var events=[_0xa7bb('0x1'),_0xa7bb('0x2'),_0xa7bb('0x3')];function createListener(_0x3e809b,_0x2d2916){return function(_0x47e2ad){_0x2d2916['emit'](_0x3e809b,_0x47e2ad);};}function removeListener(_0x333d56,_0x54c096){return function(){SquareProjectEvents[_0xa7bb('0x4')](_0x333d56,_0x54c096);};}exports[_0xa7bb('0x5')]=function(_0x5502c2){for(var _0x10493f=0x0,_0x215750=events[_0xa7bb('0x6')];_0x10493f<_0x215750;_0x10493f++){var _0x5e6342=events[_0x10493f];var _0xde417e=createListener(_0xa7bb('0x7')+_0x5e6342,_0x5502c2);SquareProjectEvents['on'](_0x5e6342,_0xde417e);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index e762b0f..40b13c3 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x52d6d3,_0x58246d){var _0x41ada6=function(_0x1dfcd3){while(--_0x1dfcd3){_0x52d6d3['push'](_0x52d6d3['shift']());}};_0x41ada6(++_0x58246d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc4aa[_0x36c5b0];return _0xf19333;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file +var _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0x2db1ee,_0x58b1e8){var _0x36320b=function(_0x1fe208){while(--_0x1fe208){_0x2db1ee['push'](_0x2db1ee['shift']());}};_0x36320b(++_0x58b1e8);}(_0x5fc3,0xa8));var _0x35fc=function(_0x95942,_0x85da80){_0x95942=_0x95942-0x0;var _0x6d7f81=_0x5fc3[_0x95942];return _0x6d7f81;};'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')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index f90c363..e790c1b 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 _0x7217=['lastIndexOf','sequelize','STRING','VIRTUAL','getDataValue','savePath','substring'];(function(_0x7fd5df,_0x3d7fd0){var _0x58c1b7=function(_0x2a8766){while(--_0x2a8766){_0x7fd5df['push'](_0x7fd5df['shift']());}};_0x58c1b7(++_0x3d7fd0);}(_0x7217,0x19e));var _0x7721=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x7217[_0x110c3d];return _0x226d67;};'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 +var _0x7dfd=['substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','savePath'];(function(_0x3daf7e,_0x445461){var _0x6e99d0=function(_0x41b78e){while(--_0x41b78e){_0x3daf7e['push'](_0x3daf7e['shift']());}};_0x6e99d0(++_0x445461);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'uniqueid':{'type':Sequelize[_0xd7df('0x2')]},'callerid':{'type':Sequelize[_0xd7df('0x2')]},'calleridname':{'type':Sequelize[_0xd7df('0x2')]},'context':{'type':Sequelize[_0xd7df('0x2')]},'extension':{'type':Sequelize[_0xd7df('0x2')]},'priority':{'type':Sequelize[_0xd7df('0x2')]},'accountcode':{'type':Sequelize[_0xd7df('0x2')]},'dnid':{'type':Sequelize[_0xd7df('0x2')]},'projectName':{'type':Sequelize[_0xd7df('0x2')]},'saveName':{'type':Sequelize[_0xd7df('0x2')]},'filename':{'type':Sequelize[_0xd7df('0x2')]},'savePath':{'type':Sequelize[_0xd7df('0x2')]},'format':{'type':Sequelize[_0xd7df('0x3')],'get':function(){var _0x16e50='';var _0x2c48a4=this['getDataValue'](_0xd7df('0x4'));if(_0x2c48a4){_0x16e50=_0x2c48a4[_0xd7df('0x5')](_0x2c48a4[_0xd7df('0x6')]('.'));}return _0x16e50;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index be9ccaa..0951dc1 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 _0x902d=['recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','Not\x20found','Entity\x20not\x20found','isNil','info','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','stack','name','send','map','SquareRecording','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','params','create','body','find','../../components/encryptor','type','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets'];(function(_0x5bb568,_0x1d3159){var _0x2f6e0d=function(_0x2033a0){while(--_0x2033a0){_0x5bb568['push'](_0x5bb568['shift']());}};_0x2f6e0d(++_0x1d3159);}(_0x902d,0x1a0));var _0xd902=function(_0x479904,_0x70604c){_0x479904=_0x479904-0x0;var _0x160af4=_0x902d[_0x479904];return _0x160af4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd902('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd902('0x1'));var rp=require(_0xd902('0x2'));var moment=require(_0xd902('0x3'));var BPromise=require(_0xd902('0x4'));var Mustache=require('mustache');var util=require(_0xd902('0x5'));var path=require(_0xd902('0x6'));var sox=require(_0xd902('0x7'));var csv=require('to-csv');var ejs=require(_0xd902('0x8'));var fs=require('fs');var fs_extra=require(_0xd902('0x9'));var _=require(_0xd902('0xa'));var squel=require(_0xd902('0xb'));var crypto=require('crypto');var jsforce=require(_0xd902('0xc'));var deskjs=require(_0xd902('0xd'));var toCsv=require(_0xd902('0xe'));var querystring=require(_0xd902('0xf'));var Papa=require(_0xd902('0x10'));var Redis=require(_0xd902('0x11'));var authService=require(_0xd902('0x12'));var qs=require(_0xd902('0x13'));var as=require(_0xd902('0x14'));var hardwareService=require(_0xd902('0x15'));var logger=require(_0xd902('0x16'))('api');var utils=require(_0xd902('0x17'));var config=require(_0xd902('0x18'));var licenseUtil=require(_0xd902('0x19'));var db=require(_0xd902('0x1a'))['db'];function respondWithStatusCode(_0x33be3d,_0x4cae0a){_0x4cae0a=_0x4cae0a||0xcc;return function(_0x55ea53){if(_0x55ea53){return _0x33be3d[_0xd902('0x1b')](_0x4cae0a);}return _0x33be3d[_0xd902('0x1c')](_0x4cae0a)[_0xd902('0x1d')]();};}function respondWithResult(_0x4ea5ab,_0x591c37){_0x591c37=_0x591c37||0xc8;return function(_0x40adb5){if(_0x40adb5){return _0x4ea5ab[_0xd902('0x1c')](_0x591c37)[_0xd902('0x1e')](_0x40adb5);}};}function respondWithFilteredResult(_0x53a15c,_0x829063){return function(_0x40d3f8){if(_0x40d3f8){var _0x54fe38=typeof _0x829063[_0xd902('0x1f')]===_0xd902('0x20')&&typeof _0x829063['limit']===_0xd902('0x20');var _0x3e1aa3=_0x40d3f8[_0xd902('0x21')];var _0x4d738b=_0x54fe38?0x0:_0x829063[_0xd902('0x1f')];var _0x1656aa=_0x54fe38?_0x40d3f8['count']:_0x829063['offset']+_0x829063['limit'];var _0x27bf26;if(_0x1656aa>=_0x3e1aa3){_0x1656aa=_0x3e1aa3;_0x27bf26=0xc8;}else{_0x27bf26=0xce;}_0x53a15c[_0xd902('0x1c')](_0x27bf26);return _0x53a15c[_0xd902('0x22')]('Content-Range',_0x4d738b+'-'+_0x1656aa+'/'+_0x3e1aa3)[_0xd902('0x1e')](_0x40d3f8);}return null;};}function patchUpdates(_0x98b96b){return function(_0x5071c9){try{jsonpatch[_0xd902('0x23')](_0x5071c9,_0x98b96b,!![]);}catch(_0x3f5baa){return BPromise[_0xd902('0x24')](_0x3f5baa);}return _0x5071c9[_0xd902('0x25')]();};}function saveUpdates(_0x57df23,_0x28c3d0){return function(_0x326cb0){if(_0x326cb0){return _0x326cb0[_0xd902('0x26')](_0x57df23)[_0xd902('0x27')](function(_0x38a63d){return _0x38a63d;});}return null;};}function removeEntity(_0x3a6c6e,_0x48326a){return function(_0xc2cfb5){if(_0xc2cfb5){return _0xc2cfb5[_0xd902('0x28')]()[_0xd902('0x27')](function(){_0x3a6c6e[_0xd902('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11f485,_0x22e2ba){return function(_0x41c717){if(!_0x41c717){_0x11f485[_0xd902('0x1b')](0x194);}return _0x41c717;};}function handleError(_0xa91877,_0x318de0){_0x318de0=_0x318de0||0x1f4;return function(_0x171620){logger['error'](_0x171620[_0xd902('0x29')]);if(_0x171620[_0xd902('0x2a')]){delete _0x171620[_0xd902('0x2a')];}_0xa91877[_0xd902('0x1c')](_0x318de0)[_0xd902('0x2b')](_0x171620);};}exports['index']=function(_0xcaad36,_0x3312c8){var _0x624d84={},_0x446af9={},_0x14b414={'count':0x0,'rows':[]};var _0x152d39=_[_0xd902('0x2c')](db[_0xd902('0x2d')][_0xd902('0x2e')],function(_0x30e2f5){return{'name':_0x30e2f5[_0xd902('0x2f')],'type':_0x30e2f5['type'][_0xd902('0x30')]};});_0x446af9[_0xd902('0x31')]=_['map'](_0x152d39,_0xd902('0x2a'));_0x446af9['query']=_[_0xd902('0x32')](_0xcaad36[_0xd902('0x33')]);_0x446af9[_0xd902('0x34')]=_[_0xd902('0x35')](_0x446af9[_0xd902('0x31')],_0x446af9[_0xd902('0x33')]);_0x624d84['attributes']=_[_0xd902('0x35')](_0x446af9['model'],qs[_0xd902('0x36')](_0xcaad36[_0xd902('0x33')]['fields']));_0x624d84[_0xd902('0x37')]=_0x624d84[_0xd902('0x37')][_0xd902('0x38')]?_0x624d84[_0xd902('0x37')]:_0x446af9[_0xd902('0x31')];if(!_0xcaad36['query'][_0xd902('0x39')]('nolimit')){_0x624d84[_0xd902('0x3a')]=qs[_0xd902('0x3a')](_0xcaad36[_0xd902('0x33')][_0xd902('0x3a')]);_0x624d84['offset']=qs[_0xd902('0x1f')](_0xcaad36[_0xd902('0x33')][_0xd902('0x1f')]);}_0x624d84[_0xd902('0x3b')]=qs['sort'](_0xcaad36['query'][_0xd902('0x3c')]);_0x624d84[_0xd902('0x3d')]=qs[_0xd902('0x34')](_[_0xd902('0x3e')](_0xcaad36['query'],_0x446af9[_0xd902('0x34')]),_0x152d39);if(_0xcaad36[_0xd902('0x33')][_0xd902('0x3f')]){_0x624d84[_0xd902('0x3d')]=_['merge'](_0x624d84[_0xd902('0x3d')],{'$or':_['map'](_0x152d39,function(_0x54963b){if(_0x54963b['type']!==_0xd902('0x40')){var _0x2e81fe={};_0x2e81fe[_0x54963b[_0xd902('0x2a')]]={'$like':'%'+_0xcaad36[_0xd902('0x33')][_0xd902('0x3f')]+'%'};return _0x2e81fe;}})});}_0x624d84=_[_0xd902('0x41')]({},_0x624d84,_0xcaad36['options']);var _0x177fe6={'where':_0x624d84[_0xd902('0x3d')]};return db[_0xd902('0x2d')][_0xd902('0x21')](_0x177fe6)['then'](function(_0x5cab8){_0x14b414['count']=_0x5cab8;if(_0xcaad36[_0xd902('0x33')][_0xd902('0x42')]){_0x624d84[_0xd902('0x43')]=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x624d84);})[_0xd902('0x27')](function(_0x4e4c3e){_0x14b414[_0xd902('0x44')]=_0x4e4c3e;return _0x14b414;})[_0xd902('0x27')](respondWithFilteredResult(_0x3312c8,_0x624d84))[_0xd902('0x45')](handleError(_0x3312c8,null));};exports['show']=function(_0x28a87e,_0x56c346){var _0x219774={'raw':!![],'where':{'id':_0x28a87e[_0xd902('0x46')]['id']}},_0x142e13={};_0x142e13[_0xd902('0x31')]=_['keys'](db['SquareRecording']['rawAttributes']);_0x142e13[_0xd902('0x33')]=_[_0xd902('0x32')](_0x28a87e[_0xd902('0x33')]);_0x142e13['filters']=_[_0xd902('0x35')](_0x142e13[_0xd902('0x31')],_0x142e13['query']);_0x219774[_0xd902('0x37')]=_[_0xd902('0x35')](_0x142e13['model'],qs['fields'](_0x28a87e[_0xd902('0x33')]['fields']));_0x219774['attributes']=_0x219774[_0xd902('0x37')][_0xd902('0x38')]?_0x219774[_0xd902('0x37')]:_0x142e13[_0xd902('0x31')];if(_0x28a87e[_0xd902('0x33')][_0xd902('0x42')]){_0x219774[_0xd902('0x43')]=[{'all':!![]}];}_0x219774=_[_0xd902('0x41')]({},_0x219774,_0x28a87e['options']);return db[_0xd902('0x2d')]['find'](_0x219774)['then'](handleEntityNotFound(_0x56c346,null))[_0xd902('0x27')](respondWithResult(_0x56c346,null))[_0xd902('0x45')](handleError(_0x56c346,null));};exports[_0xd902('0x47')]=function(_0x446743,_0x3ec0e0){return db[_0xd902('0x2d')][_0xd902('0x47')](_0x446743[_0xd902('0x48')],{})[_0xd902('0x27')](respondWithResult(_0x3ec0e0,0xc9))[_0xd902('0x45')](handleError(_0x3ec0e0,null));};exports[_0xd902('0x26')]=function(_0x4a6664,_0x36df40){if(_0x4a6664[_0xd902('0x48')]['id']){delete _0x4a6664[_0xd902('0x48')]['id'];}return db[_0xd902('0x2d')][_0xd902('0x49')]({'where':{'id':_0x4a6664['params']['id']}})[_0xd902('0x27')](handleEntityNotFound(_0x36df40,null))[_0xd902('0x27')](saveUpdates(_0x4a6664['body'],null))[_0xd902('0x27')](respondWithResult(_0x36df40,null))[_0xd902('0x45')](handleError(_0x36df40,null));};exports['download']=function(_0x4c9b0d,_0x31cd85,_0x6eba89){var _0x183a51=require(_0xd902('0x4a'));var _0x5b37da=![];var _0x194f64={};if(_0x4c9b0d['query'][_0xd902('0x4b')]&&_0x4c9b0d[_0xd902('0x33')][_0xd902('0x4b')]===_0xd902('0x4c')){_0x194f64[_0xd902('0x4c')]=_0x4c9b0d['params']['id'];}else{_0x194f64['id']=_0x4c9b0d['params']['id'];}return db[_0xd902('0x2d')][_0xd902('0x49')]({'where':_0x194f64,'attributes':['id',_0xd902('0x4d'),_0xd902('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x31cd85,null))[_0xd902('0x27')](function(_0x37b98d){if(_0x37b98d){var _0x34af31=_0x37b98d['savePath'];var _0x127544=util[_0xd902('0x4f')](_0xd902('0x50'),_0x34af31);if(fs[_0xd902('0x51')](_0x127544)){_0x5b37da=!![];return _0x183a51[_0xd902('0x52')](_0x127544,_0x34af31,config[_0xd902('0x53')][_0xd902('0x54')])[_0xd902('0x27')](function(){return _0x37b98d;});}return _0x37b98d;}})[_0xd902('0x27')](function(_0x3d5c9a){if(_0x3d5c9a){var _0x75ce61=_0x3d5c9a[_0xd902('0x4d')];if(!fs[_0xd902('0x51')](_0x75ce61)){throw new db[(_0xd902('0x55'))][(_0xd902('0x56'))](_0xd902('0x57'));}if(_0x3d5c9a[_0xd902('0x4e')]){return _0x31cd85[_0xd902('0x58')](_0x75ce61,_0x3d5c9a[_0xd902('0x4e')]+path[_0xd902('0x59')](_0x75ce61),function(){if(_0x5b37da){fs['unlink'](_0x75ce61);}});}else{return _0x31cd85[_0xd902('0x58')](_0x75ce61,function(_0xb17f4){if(_0x5b37da){fs[_0xd902('0x5a')](_0x75ce61);}});}}})[_0xd902('0x45')](function(_0x4f057e){if(_0x4f057e[_0xd902('0x5b')]===_0xd902('0x57')){_0x31cd85[_0xd902('0x1c')](0x194)[_0xd902('0x2b')](_0xd902('0x5c'));}else{return handleError(_0x31cd85,null);}});};exports[_0xd902('0x28')]=function(_0x541913,_0x16e9da){return db['SquareRecording']['find']({'where':{'id':_0x541913[_0xd902('0x46')]['id']}})['then'](function(_0x15e85e){if(_['isNil'](_0x15e85e)){throw new ReferenceError(_0xd902('0x5d'));}return _0x15e85e;})[_0xd902('0x27')](function(_0x3a3e12){var _0x3d566d=_0x3a3e12[_0xd902('0x4d')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x3d566d);if(!_[_0xd902('0x5e')](_0x3a3e12[_0xd902('0x4d')])&&fs[_0xd902('0x51')](_0x3d566d)){logger[_0xd902('0x5f')](_0xd902('0x60')+_0x3d566d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x3d566d);}_0x3d566d=_0x3d566d+_0xd902('0x61');if(!_['isNil'](_0x3a3e12[_0xd902('0x4d')])&&fs[_0xd902('0x51')](_0x3d566d)){logger[_0xd902('0x5f')]('File:\x20\x22'+_0x3d566d+_0xd902('0x62'));fs[_0xd902('0x63')](_0x3d566d);}return _0x3a3e12;})[_0xd902('0x27')](function(_0x3a73a2){if(!_0x3a73a2)throw new InternalError();return _0x3a73a2[_0xd902('0x28')]();})[_0xd902('0x27')](function(){_0x16e9da[_0xd902('0x1c')](0xcc)[_0xd902('0x1d')]();})[_0xd902('0x45')](handleError(_0x16e9da,null));}; \ No newline at end of file +var _0x30a7=['rows','params','find','catch','create','body','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','decryptFile','secrets','existsSync','Sequelize','ValidationError','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','destroy','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','SquareRecording','includeAll'];(function(_0x3f4574,_0x4f6461){var _0x4d139a=function(_0x21fca2){while(--_0x21fca2){_0x3f4574['push'](_0x3f4574['shift']());}};_0x4d139a(++_0x4f6461);}(_0x30a7,0x19e));var _0x730a=function(_0x1aab62,_0x27952){_0x1aab62=_0x1aab62-0x0;var _0x48531a=_0x30a7[_0x1aab62];return _0x48531a;};'use strict';var emlformat=require(_0x730a('0x0'));var rimraf=require(_0x730a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x730a('0x2'));var rp=require(_0x730a('0x3'));var moment=require('moment');var BPromise=require(_0x730a('0x4'));var Mustache=require(_0x730a('0x5'));var util=require('util');var path=require(_0x730a('0x6'));var sox=require(_0x730a('0x7'));var csv=require(_0x730a('0x8'));var ejs=require(_0x730a('0x9'));var fs=require('fs');var fs_extra=require(_0x730a('0xa'));var _=require('lodash');var squel=require(_0x730a('0xb'));var crypto=require('crypto');var jsforce=require(_0x730a('0xc'));var deskjs=require(_0x730a('0xd'));var toCsv=require(_0x730a('0x8'));var querystring=require('querystring');var Papa=require(_0x730a('0xe'));var Redis=require('ioredis');var authService=require(_0x730a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x730a('0x10'));var hardwareService=require(_0x730a('0x11'));var logger=require(_0x730a('0x12'))(_0x730a('0x13'));var utils=require(_0x730a('0x14'));var config=require(_0x730a('0x15'));var licenseUtil=require(_0x730a('0x16'));var db=require(_0x730a('0x17'))['db'];function respondWithStatusCode(_0x28828d,_0x545ee4){_0x545ee4=_0x545ee4||0xcc;return function(_0x2d8713){if(_0x2d8713){return _0x28828d[_0x730a('0x18')](_0x545ee4);}return _0x28828d[_0x730a('0x19')](_0x545ee4)[_0x730a('0x1a')]();};}function respondWithResult(_0x231dc1,_0x4923a7){_0x4923a7=_0x4923a7||0xc8;return function(_0x23949e){if(_0x23949e){return _0x231dc1[_0x730a('0x19')](_0x4923a7)[_0x730a('0x1b')](_0x23949e);}};}function respondWithFilteredResult(_0x42c33f,_0x107f70){return function(_0x39b1ef){if(_0x39b1ef){var _0x54137b=typeof _0x107f70[_0x730a('0x1c')]===_0x730a('0x1d')&&typeof _0x107f70['limit']===_0x730a('0x1d');var _0x3d4dc5=_0x39b1ef[_0x730a('0x1e')];var _0x57161b=_0x54137b?0x0:_0x107f70[_0x730a('0x1c')];var _0x157721=_0x54137b?_0x39b1ef['count']:_0x107f70[_0x730a('0x1c')]+_0x107f70[_0x730a('0x1f')];var _0x28292f;if(_0x157721>=_0x3d4dc5){_0x157721=_0x3d4dc5;_0x28292f=0xc8;}else{_0x28292f=0xce;}_0x42c33f[_0x730a('0x19')](_0x28292f);return _0x42c33f[_0x730a('0x20')]('Content-Range',_0x57161b+'-'+_0x157721+'/'+_0x3d4dc5)[_0x730a('0x1b')](_0x39b1ef);}return null;};}function patchUpdates(_0x430918){return function(_0xa1c272){try{jsonpatch[_0x730a('0x21')](_0xa1c272,_0x430918,!![]);}catch(_0x1d495d){return BPromise[_0x730a('0x22')](_0x1d495d);}return _0xa1c272[_0x730a('0x23')]();};}function saveUpdates(_0x188a92,_0x475507){return function(_0x338b72){if(_0x338b72){return _0x338b72[_0x730a('0x24')](_0x188a92)[_0x730a('0x25')](function(_0x6cfbe3){return _0x6cfbe3;});}return null;};}function removeEntity(_0x1ba6ca,_0x450e0b){return function(_0x1ef6d2){if(_0x1ef6d2){return _0x1ef6d2['destroy']()[_0x730a('0x25')](function(){_0x1ba6ca[_0x730a('0x19')](0xcc)[_0x730a('0x1a')]();});}};}function handleEntityNotFound(_0x15720c,_0x19493d){return function(_0x286f41){if(!_0x286f41){_0x15720c['sendStatus'](0x194);}return _0x286f41;};}function handleError(_0x12b629,_0x15a551){_0x15a551=_0x15a551||0x1f4;return function(_0x2e8e12){logger[_0x730a('0x26')](_0x2e8e12[_0x730a('0x27')]);if(_0x2e8e12['name']){delete _0x2e8e12[_0x730a('0x28')];}_0x12b629[_0x730a('0x19')](_0x15a551)[_0x730a('0x29')](_0x2e8e12);};}exports[_0x730a('0x2a')]=function(_0x46879e,_0x23d541){var _0x4baca1={},_0x13ab29={},_0x3e7f94={'count':0x0,'rows':[]};var _0x18f96d=_[_0x730a('0x2b')](db['SquareRecording'][_0x730a('0x2c')],function(_0x2e03ae){return{'name':_0x2e03ae[_0x730a('0x2d')],'type':_0x2e03ae[_0x730a('0x2e')]['key']};});_0x13ab29['model']=_[_0x730a('0x2b')](_0x18f96d,'name');_0x13ab29[_0x730a('0x2f')]=_[_0x730a('0x30')](_0x46879e[_0x730a('0x2f')]);_0x13ab29['filters']=_['intersection'](_0x13ab29[_0x730a('0x31')],_0x13ab29[_0x730a('0x2f')]);_0x4baca1[_0x730a('0x32')]=_[_0x730a('0x33')](_0x13ab29[_0x730a('0x31')],qs['fields'](_0x46879e['query'][_0x730a('0x34')]));_0x4baca1[_0x730a('0x32')]=_0x4baca1[_0x730a('0x32')][_0x730a('0x35')]?_0x4baca1['attributes']:_0x13ab29['model'];if(!_0x46879e['query'][_0x730a('0x36')](_0x730a('0x37'))){_0x4baca1[_0x730a('0x1f')]=qs[_0x730a('0x1f')](_0x46879e[_0x730a('0x2f')][_0x730a('0x1f')]);_0x4baca1[_0x730a('0x1c')]=qs[_0x730a('0x1c')](_0x46879e[_0x730a('0x2f')][_0x730a('0x1c')]);}_0x4baca1['order']=qs[_0x730a('0x38')](_0x46879e[_0x730a('0x2f')][_0x730a('0x38')]);_0x4baca1[_0x730a('0x39')]=qs[_0x730a('0x3a')](_[_0x730a('0x3b')](_0x46879e[_0x730a('0x2f')],_0x13ab29['filters']),_0x18f96d);if(_0x46879e[_0x730a('0x2f')][_0x730a('0x3c')]){_0x4baca1[_0x730a('0x39')]=_[_0x730a('0x3d')](_0x4baca1['where'],{'$or':_['map'](_0x18f96d,function(_0x3e5baa){if(_0x3e5baa[_0x730a('0x2e')]!==_0x730a('0x3e')){var _0x30cfa3={};_0x30cfa3[_0x3e5baa[_0x730a('0x28')]]={'$like':'%'+_0x46879e[_0x730a('0x2f')]['filter']+'%'};return _0x30cfa3;}})});}_0x4baca1=_[_0x730a('0x3d')]({},_0x4baca1,_0x46879e[_0x730a('0x3f')]);var _0x26a214={'where':_0x4baca1[_0x730a('0x39')]};return db[_0x730a('0x40')]['count'](_0x26a214)[_0x730a('0x25')](function(_0x9204e6){_0x3e7f94[_0x730a('0x1e')]=_0x9204e6;if(_0x46879e['query'][_0x730a('0x41')]){_0x4baca1['include']=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x4baca1);})['then'](function(_0x9510de){_0x3e7f94[_0x730a('0x42')]=_0x9510de;return _0x3e7f94;})[_0x730a('0x25')](respondWithFilteredResult(_0x23d541,_0x4baca1))['catch'](handleError(_0x23d541,null));};exports['show']=function(_0x1d6819,_0x3a95d6){var _0x2b63fc={'raw':!![],'where':{'id':_0x1d6819[_0x730a('0x43')]['id']}},_0x296880={};_0x296880[_0x730a('0x31')]=_[_0x730a('0x30')](db[_0x730a('0x40')]['rawAttributes']);_0x296880[_0x730a('0x2f')]=_[_0x730a('0x30')](_0x1d6819['query']);_0x296880[_0x730a('0x3a')]=_[_0x730a('0x33')](_0x296880[_0x730a('0x31')],_0x296880['query']);_0x2b63fc[_0x730a('0x32')]=_[_0x730a('0x33')](_0x296880[_0x730a('0x31')],qs[_0x730a('0x34')](_0x1d6819[_0x730a('0x2f')][_0x730a('0x34')]));_0x2b63fc[_0x730a('0x32')]=_0x2b63fc['attributes'][_0x730a('0x35')]?_0x2b63fc[_0x730a('0x32')]:_0x296880[_0x730a('0x31')];if(_0x1d6819[_0x730a('0x2f')]['includeAll']){_0x2b63fc['include']=[{'all':!![]}];}_0x2b63fc=_['merge']({},_0x2b63fc,_0x1d6819[_0x730a('0x3f')]);return db['SquareRecording'][_0x730a('0x44')](_0x2b63fc)[_0x730a('0x25')](handleEntityNotFound(_0x3a95d6,null))[_0x730a('0x25')](respondWithResult(_0x3a95d6,null))[_0x730a('0x45')](handleError(_0x3a95d6,null));};exports[_0x730a('0x46')]=function(_0x1ad355,_0x3dffa4){return db[_0x730a('0x40')]['create'](_0x1ad355[_0x730a('0x47')],{})[_0x730a('0x25')](respondWithResult(_0x3dffa4,0xc9))[_0x730a('0x45')](handleError(_0x3dffa4,null));};exports[_0x730a('0x24')]=function(_0x36645f,_0x14f441){if(_0x36645f['body']['id']){delete _0x36645f[_0x730a('0x47')]['id'];}return db[_0x730a('0x40')][_0x730a('0x44')]({'where':{'id':_0x36645f['params']['id']}})[_0x730a('0x25')](handleEntityNotFound(_0x14f441,null))[_0x730a('0x25')](saveUpdates(_0x36645f[_0x730a('0x47')],null))['then'](respondWithResult(_0x14f441,null))['catch'](handleError(_0x14f441,null));};exports[_0x730a('0x48')]=function(_0x1a99e4,_0x565659,_0xdd4700){var _0x2115e0=require(_0x730a('0x49'));var _0x2dcf68=![];var _0x20666b={};if(_0x1a99e4[_0x730a('0x2f')][_0x730a('0x2e')]&&_0x1a99e4['query'][_0x730a('0x2e')]===_0x730a('0x4a')){_0x20666b[_0x730a('0x4a')]=_0x1a99e4[_0x730a('0x43')]['id'];}else{_0x20666b['id']=_0x1a99e4['params']['id'];}return db[_0x730a('0x40')][_0x730a('0x44')]({'where':_0x20666b,'attributes':['id',_0x730a('0x4b'),_0x730a('0x4c')],'raw':!![]})[_0x730a('0x25')](handleEntityNotFound(_0x565659,null))[_0x730a('0x25')](function(_0x5224e0){if(_0x5224e0){var _0x779527=_0x5224e0[_0x730a('0x4b')];var _0x2bac41=util['format'](_0x730a('0x4d'),_0x779527);if(fs['existsSync'](_0x2bac41)){_0x2dcf68=!![];return _0x2115e0[_0x730a('0x4e')](_0x2bac41,_0x779527,config[_0x730a('0x4f')]['recording'])[_0x730a('0x25')](function(){return _0x5224e0;});}return _0x5224e0;}})[_0x730a('0x25')](function(_0x55fec4){if(_0x55fec4){var _0x3b6628=_0x55fec4['savePath'];if(!fs[_0x730a('0x50')](_0x3b6628)){throw new db[(_0x730a('0x51'))][(_0x730a('0x52'))]('SquareRecording\x20not\x20found');}if(_0x55fec4[_0x730a('0x4c')]){return _0x565659[_0x730a('0x48')](_0x3b6628,_0x55fec4[_0x730a('0x4c')]+path[_0x730a('0x53')](_0x3b6628),function(){if(_0x2dcf68){fs[_0x730a('0x54')](_0x3b6628);}});}else{return _0x565659[_0x730a('0x48')](_0x3b6628,function(_0x13e430){if(_0x2dcf68){fs[_0x730a('0x54')](_0x3b6628);}});}}})[_0x730a('0x45')](function(_0x37e968){if(_0x37e968[_0x730a('0x55')]===_0x730a('0x56')){_0x565659['status'](0x194)[_0x730a('0x29')](_0x730a('0x57'));}else{return handleError(_0x565659,null);}});};exports[_0x730a('0x58')]=function(_0x447b6f,_0x3f4851){return db[_0x730a('0x40')][_0x730a('0x44')]({'where':{'id':_0x447b6f['params']['id']}})[_0x730a('0x25')](function(_0x59ef3e){if(_[_0x730a('0x59')](_0x59ef3e)){throw new ReferenceError('Entity\x20not\x20found');}return _0x59ef3e;})[_0x730a('0x25')](function(_0x596ce7){var _0x3a3c25=_0x596ce7[_0x730a('0x4b')];logger['info'](_0x730a('0x5a'),_0x3a3c25);if(!_[_0x730a('0x59')](_0x596ce7[_0x730a('0x4b')])&&fs['existsSync'](_0x3a3c25)){logger[_0x730a('0x5b')](_0x730a('0x5c')+_0x3a3c25+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x730a('0x5d')](_0x3a3c25);}_0x3a3c25=_0x3a3c25+_0x730a('0x5e');if(!_['isNil'](_0x596ce7[_0x730a('0x4b')])&&fs[_0x730a('0x50')](_0x3a3c25)){logger[_0x730a('0x5b')]('File:\x20\x22'+_0x3a3c25+_0x730a('0x5f'));fs[_0x730a('0x5d')](_0x3a3c25);}return _0x596ce7;})['then'](function(_0x320117){if(!_0x320117)throw new InternalError();return _0x320117[_0x730a('0x58')]();})[_0x730a('0x25')](function(){_0x3f4851[_0x730a('0x19')](0xcc)[_0x730a('0x1a')]();})[_0x730a('0x45')](handleError(_0x3f4851,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index b185b9e..91e8de4 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 _0x9b2c=['request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','util','../../config/logger','moment'];(function(_0x9b4c52,_0x2f7c28){var _0x4e13dd=function(_0xf7e85c){while(--_0xf7e85c){_0x9b4c52['push'](_0x9b4c52['shift']());}};_0x4e13dd(++_0x2f7c28);}(_0x9b2c,0x189));var _0xc9b2=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0x9b2c[_0xa990b7];return _0x52c99c;};'use strict';var _=require('lodash');var util=require(_0xc9b2('0x0'));var logger=require(_0xc9b2('0x1'))('api');var moment=require(_0xc9b2('0x2'));var BPromise=require('bluebird');var rp=require(_0xc9b2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc9b2('0x4'));var config=require(_0xc9b2('0x5'));var attributes=require(_0xc9b2('0x6'));module[_0xc9b2('0x7')]=function(_0x15be55,_0x3e6343){return _0x15be55[_0xc9b2('0x8')](_0xc9b2('0x9'),attributes,{'tableName':_0xc9b2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6db4=['moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','square_recordings','util','../../config/logger','api'];(function(_0x58096c,_0x5ebdaa){var _0x21e800=function(_0x5b3235){while(--_0x5b3235){_0x58096c['push'](_0x58096c['shift']());}};_0x21e800(++_0x5ebdaa);}(_0x6db4,0x111));var _0x46db=function(_0x4c266d,_0x3e7eaa){_0x4c266d=_0x4c266d-0x0;var _0x38b954=_0x6db4[_0x4c266d];return _0x38b954;};'use strict';var _=require('lodash');var util=require(_0x46db('0x0'));var logger=require(_0x46db('0x1'))(_0x46db('0x2'));var moment=require(_0x46db('0x3'));var BPromise=require(_0x46db('0x4'));var rp=require(_0x46db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x46db('0x6'));var config=require(_0x46db('0x7'));var attributes=require(_0x46db('0x8'));module[_0x46db('0x9')]=function(_0x331e67,_0x2abfd4){return _0x331e67[_0x46db('0xa')]('SquareRecording',attributes,{'tableName':_0x46db('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 3926ee5..bb48bf5 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 _0xee8c=['result','catch','CreateSquareRecording','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message'];(function(_0x44c768,_0x552a5e){var _0x55daf5=function(_0x4958e8){while(--_0x4958e8){_0x44c768['push'](_0x44c768['shift']());}};_0x55daf5(++_0x552a5e);}(_0xee8c,0x12f));var _0xcee8=function(_0x4769ff,_0x127733){_0x4769ff=_0x4769ff-0x0;var _0x2362ba=_0xee8c[_0x4769ff];return _0x2362ba;};'use strict';var _=require(_0xcee8('0x0'));var util=require('util');var moment=require(_0xcee8('0x1'));var BPromise=require(_0xcee8('0x2'));var rs=require(_0xcee8('0x3'));var fs=require('fs');var Redis=require(_0xcee8('0x4'));var db=require(_0xcee8('0x5'))['db'];var utils=require(_0xcee8('0x6'));var logger=require(_0xcee8('0x7'))('rpc');var config=require(_0xcee8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcee8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5dab19,_0x3ed480,_0x50a692){return new BPromise(function(_0x43cea3,_0x24d131){return client[_0xcee8('0xa')](_0x5dab19,_0x50a692)[_0xcee8('0xb')](function(_0x433de8){logger[_0xcee8('0xc')]('SquareRecording,\x20%s,\x20%s',_0x3ed480,_0xcee8('0xd'));logger[_0xcee8('0xe')](_0xcee8('0xf'),_0x3ed480,_0xcee8('0xd'),JSON[_0xcee8('0x10')](_0x433de8));if(_0x433de8[_0xcee8('0x11')]){if(_0x433de8[_0xcee8('0x11')][_0xcee8('0x12')]===0x1f4){logger[_0xcee8('0x11')](_0xcee8('0x13'),_0x3ed480,_0x433de8['error'][_0xcee8('0x14')]);return _0x24d131(_0x433de8['error'][_0xcee8('0x14')]);}logger['error'](_0xcee8('0x13'),_0x3ed480,_0x433de8[_0xcee8('0x11')]['message']);return _0x43cea3(_0x433de8[_0xcee8('0x11')][_0xcee8('0x14')]);}else{logger[_0xcee8('0xc')](_0xcee8('0x13'),_0x3ed480,_0xcee8('0xd'));_0x43cea3(_0x433de8[_0xcee8('0x15')][_0xcee8('0x14')]);}})[_0xcee8('0x16')](function(_0x52d8e9){logger[_0xcee8('0x11')]('SquareRecording,\x20%s,\x20%s',_0x3ed480,_0x52d8e9);_0x24d131(_0x52d8e9);});});}exports[_0xcee8('0x17')]=function(_0x59a194){var _0x9cc867=this;return new Promise(function(_0x520123,_0x5bb932){return db['SquareRecording']['create'](_0x59a194[_0xcee8('0x18')],{'raw':_0x59a194[_0xcee8('0x19')]?_0x59a194['options'][_0xcee8('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3ccbca){logger[_0xcee8('0xc')](_0xcee8('0x17'),_0x59a194);logger[_0xcee8('0xe')](_0xcee8('0x17'),_0x59a194,JSON[_0xcee8('0x10')](_0x3ccbca));_0x520123(_0x3ccbca);})['catch'](function(_0x1031c){logger[_0xcee8('0x11')](_0xcee8('0x17'),_0x1031c[_0xcee8('0x14')],_0x59a194);_0x5bb932(_0x9cc867[_0xcee8('0x11')](0x1f4,_0x1031c[_0xcee8('0x14')]));});});}; \ No newline at end of file +var _0x99e4=['catch','CreateSquareRecording','create','body','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','debug','stringify','error','SquareRecording,\x20%s,\x20%s','message','info'];(function(_0x19e448,_0x86b898){var _0x67e5d2=function(_0xe3043){while(--_0xe3043){_0x19e448['push'](_0x19e448['shift']());}};_0x67e5d2(++_0x86b898);}(_0x99e4,0x1e0));var _0x499e=function(_0x2833c2,_0x11b66c){_0x2833c2=_0x2833c2-0x0;var _0xa30287=_0x99e4[_0x2833c2];return _0xa30287;};'use strict';var _=require(_0x499e('0x0'));var util=require(_0x499e('0x1'));var moment=require(_0x499e('0x2'));var BPromise=require('bluebird');var rs=require(_0x499e('0x3'));var fs=require('fs');var Redis=require(_0x499e('0x4'));var db=require(_0x499e('0x5'))['db'];var utils=require(_0x499e('0x6'));var logger=require(_0x499e('0x7'))(_0x499e('0x8'));var config=require(_0x499e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x499e('0xa')][_0x499e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3cda82,_0x3345af,_0x3bc952){return new BPromise(function(_0x35323e,_0x2d1f23){return client['request'](_0x3cda82,_0x3bc952)[_0x499e('0xc')](function(_0x3c28d0){logger['info']('SquareRecording,\x20%s,\x20%s',_0x3345af,_0x499e('0xd'));logger[_0x499e('0xe')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x3345af,'request\x20sent',JSON[_0x499e('0xf')](_0x3c28d0));if(_0x3c28d0[_0x499e('0x10')]){if(_0x3c28d0[_0x499e('0x10')]['code']===0x1f4){logger[_0x499e('0x10')](_0x499e('0x11'),_0x3345af,_0x3c28d0[_0x499e('0x10')]['message']);return _0x2d1f23(_0x3c28d0[_0x499e('0x10')][_0x499e('0x12')]);}logger[_0x499e('0x10')](_0x499e('0x11'),_0x3345af,_0x3c28d0['error']['message']);return _0x35323e(_0x3c28d0[_0x499e('0x10')][_0x499e('0x12')]);}else{logger[_0x499e('0x13')](_0x499e('0x11'),_0x3345af,_0x499e('0xd'));_0x35323e(_0x3c28d0['result'][_0x499e('0x12')]);}})[_0x499e('0x14')](function(_0x15350c){logger[_0x499e('0x10')]('SquareRecording,\x20%s,\x20%s',_0x3345af,_0x15350c);_0x2d1f23(_0x15350c);});});}exports[_0x499e('0x15')]=function(_0x14a6f9){var _0x50bfe3=this;return new Promise(function(_0x3cd788,_0x4829b6){return db['SquareRecording'][_0x499e('0x16')](_0x14a6f9[_0x499e('0x17')],{'raw':_0x14a6f9['options']?_0x14a6f9['options'][_0x499e('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x5ab86d){logger[_0x499e('0x13')]('CreateSquareRecording',_0x14a6f9);logger[_0x499e('0xe')]('CreateSquareRecording',_0x14a6f9,JSON['stringify'](_0x5ab86d));_0x3cd788(_0x5ab86d);})[_0x499e('0x14')](function(_0x583a34){logger[_0x499e('0x10')](_0x499e('0x15'),_0x583a34[_0x499e('0x12')],_0x14a6f9);_0x4829b6(_0x50bfe3[_0x499e('0x10')](0x1f4,_0x583a34['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 3cefe96..301b335 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x1a285a,_0xa0539a){var _0x2b180b=function(_0x1480d1){while(--_0x1480d1){_0x1a285a['push'](_0x1a285a['shift']());}};_0x2b180b(++_0xa0539a);}(_0xe706,0xa3));var _0x6e70=function(_0x36de53,_0x4a0679){_0x36de53=_0x36de53-0x0;var _0x2b04cb=_0xe706[_0x36de53];return _0x2b04cb;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x2624f7,_0x4175b9){var _0x3ea815=function(_0x3e0c8a){while(--_0x3e0c8a){_0x2624f7['push'](_0x2624f7['shift']());}};_0x3ea815(++_0x4175b9);}(_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 6e6d277..060460a 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 _0xf672=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x3d613e,_0x511d0c){var _0x411507=function(_0xf286d9){while(--_0xf286d9){_0x3d613e['push'](_0x3d613e['shift']());}};_0x411507(++_0x511d0c);}(_0xf672,0xc5));var _0x2f67=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf672[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x2f67('0x0'));module[_0x2f67('0x1')]={'network':{'type':Sequelize[_0x2f67('0x2')]},'network_script':{'type':Sequelize[_0x2f67('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2f67('0x2')]},'language':{'type':Sequelize[_0x2f67('0x2')]},'type':{'type':Sequelize[_0x2f67('0x2')]},'uniqueid':{'type':Sequelize[_0x2f67('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x2f67('0x2')]},'calleridname':{'type':Sequelize[_0x2f67('0x2')]},'callingpres':{'type':Sequelize[_0x2f67('0x2')]},'callingani2':{'type':Sequelize[_0x2f67('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x2f67('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x2f67('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x2f67('0x2')]},'enhanced':{'type':Sequelize[_0x2f67('0x2')]},'accountcode':{'type':Sequelize[_0x2f67('0x2')]},'threadid':{'type':Sequelize[_0x2f67('0x2')]},'project_name':{'type':Sequelize[_0x2f67('0x2')]},'joinAt':{'type':Sequelize[_0x2f67('0x3')]},'leaveAt':{'type':Sequelize[_0x2f67('0x3')]},'bot':{'type':Sequelize[_0x2f67('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xf100=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x11a1fe,_0x572c9b){var _0x303f1c=function(_0x4cae5d){while(--_0x4cae5d){_0x11a1fe['push'](_0x11a1fe['shift']());}};_0x303f1c(++_0x572c9b);}(_0xf100,0x119));var _0x0f10=function(_0x30b124,_0x173345){_0x30b124=_0x30b124-0x0;var _0xbabab0=_0xf100[_0x30b124];return _0xbabab0;};'use strict';var Sequelize=require(_0x0f10('0x0'));module[_0x0f10('0x1')]={'network':{'type':Sequelize[_0x0f10('0x2')]},'network_script':{'type':Sequelize[_0x0f10('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0f10('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0f10('0x2')]},'uniqueid':{'type':Sequelize[_0x0f10('0x2')]},'version':{'type':Sequelize[_0x0f10('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0f10('0x2')]},'callingpres':{'type':Sequelize[_0x0f10('0x2')]},'callingani2':{'type':Sequelize[_0x0f10('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x0f10('0x2')]},'dnid':{'type':Sequelize[_0x0f10('0x2')]},'rdnis':{'type':Sequelize[_0x0f10('0x2')]},'context':{'type':Sequelize[_0x0f10('0x2')]},'extension':{'type':Sequelize[_0x0f10('0x2')]},'priority':{'type':Sequelize[_0x0f10('0x2')]},'enhanced':{'type':Sequelize[_0x0f10('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x0f10('0x2')]},'project_name':{'type':Sequelize[_0x0f10('0x2')]},'joinAt':{'type':Sequelize[_0x0f10('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x0f10('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 3f35710..0123d55 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 _0xfab2=['sendStatus','error','stack','index','SquareReport','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','count','include','findAll','rows','catch','params','keys','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy'];(function(_0x12cdfa,_0x28318f){var _0x2da9d8=function(_0x3b42ef){while(--_0x3b42ef){_0x12cdfa['push'](_0x12cdfa['shift']());}};_0x2da9d8(++_0x28318f);}(_0xfab2,0x14a));var _0x2fab=function(_0x1ab4f4,_0x576f7b){_0x1ab4f4=_0x1ab4f4-0x0;var _0x11f5a9=_0xfab2[_0x1ab4f4];return _0x11f5a9;};'use strict';var emlformat=require(_0x2fab('0x0'));var rimraf=require(_0x2fab('0x1'));var zipdir=require(_0x2fab('0x2'));var jsonpatch=require(_0x2fab('0x3'));var rp=require('request-promise');var moment=require(_0x2fab('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2fab('0x5'));var util=require(_0x2fab('0x6'));var path=require(_0x2fab('0x7'));var sox=require(_0x2fab('0x8'));var csv=require(_0x2fab('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2fab('0xa'));var _=require(_0x2fab('0xb'));var squel=require('squel');var crypto=require(_0x2fab('0xc'));var jsforce=require(_0x2fab('0xd'));var deskjs=require(_0x2fab('0xe'));var toCsv=require(_0x2fab('0x9'));var querystring=require(_0x2fab('0xf'));var Papa=require('papaparse');var Redis=require(_0x2fab('0x10'));var authService=require(_0x2fab('0x11'));var qs=require(_0x2fab('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2fab('0x13'));var logger=require('../../config/logger')(_0x2fab('0x14'));var utils=require(_0x2fab('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2fab('0x16'));var db=require(_0x2fab('0x17'))['db'];function respondWithStatusCode(_0x44f976,_0x40ca59){_0x40ca59=_0x40ca59||0xcc;return function(_0x78205){if(_0x78205){return _0x44f976['sendStatus'](_0x40ca59);}return _0x44f976[_0x2fab('0x18')](_0x40ca59)[_0x2fab('0x19')]();};}function respondWithResult(_0x3f648f,_0x3e20de){_0x3e20de=_0x3e20de||0xc8;return function(_0x2916f2){if(_0x2916f2){return _0x3f648f['status'](_0x3e20de)[_0x2fab('0x1a')](_0x2916f2);}};}function respondWithFilteredResult(_0x2d7fc7,_0x1d1201){return function(_0x566f4c){if(_0x566f4c){var _0x46c967=typeof _0x1d1201[_0x2fab('0x1b')]===_0x2fab('0x1c')&&typeof _0x1d1201[_0x2fab('0x1d')]===_0x2fab('0x1c');var _0x2148cf=_0x566f4c['count'];var _0x13e911=_0x46c967?0x0:_0x1d1201[_0x2fab('0x1b')];var _0xc3f978=_0x46c967?_0x566f4c['count']:_0x1d1201[_0x2fab('0x1b')]+_0x1d1201['limit'];var _0x43befa;if(_0xc3f978>=_0x2148cf){_0xc3f978=_0x2148cf;_0x43befa=0xc8;}else{_0x43befa=0xce;}_0x2d7fc7[_0x2fab('0x18')](_0x43befa);return _0x2d7fc7[_0x2fab('0x1e')](_0x2fab('0x1f'),_0x13e911+'-'+_0xc3f978+'/'+_0x2148cf)[_0x2fab('0x1a')](_0x566f4c);}return null;};}function patchUpdates(_0x4d7eca){return function(_0x5833a3){try{jsonpatch['apply'](_0x5833a3,_0x4d7eca,!![]);}catch(_0x4729c8){return BPromise['reject'](_0x4729c8);}return _0x5833a3['save']();};}function saveUpdates(_0x1a930b,_0x2be264){return function(_0x1c6bf9){if(_0x1c6bf9){return _0x1c6bf9[_0x2fab('0x20')](_0x1a930b)[_0x2fab('0x21')](function(_0x2599b5){return _0x2599b5;});}return null;};}function removeEntity(_0x2af215,_0x3f966f){return function(_0x408d38){if(_0x408d38){return _0x408d38[_0x2fab('0x22')]()[_0x2fab('0x21')](function(){_0x2af215['status'](0xcc)[_0x2fab('0x19')]();});}};}function handleEntityNotFound(_0x583383,_0x5edcd){return function(_0x3ee017){if(!_0x3ee017){_0x583383[_0x2fab('0x23')](0x194);}return _0x3ee017;};}function handleError(_0xb2712,_0x2c863f){_0x2c863f=_0x2c863f||0x1f4;return function(_0x50eb1f){logger[_0x2fab('0x24')](_0x50eb1f[_0x2fab('0x25')]);if(_0x50eb1f['name']){delete _0x50eb1f['name'];}_0xb2712[_0x2fab('0x18')](_0x2c863f)['send'](_0x50eb1f);};}exports[_0x2fab('0x26')]=function(_0x34e109,_0x344749){var _0x3be5bf={},_0x102149={},_0x434a46={'count':0x0,'rows':[]};var _0x1736d9=_['map'](db[_0x2fab('0x27')][_0x2fab('0x28')],function(_0x54bc2a){return{'name':_0x54bc2a['fieldName'],'type':_0x54bc2a[_0x2fab('0x29')][_0x2fab('0x2a')]};});_0x102149[_0x2fab('0x2b')]=_['map'](_0x1736d9,_0x2fab('0x2c'));_0x102149[_0x2fab('0x2d')]=_['keys'](_0x34e109[_0x2fab('0x2d')]);_0x102149[_0x2fab('0x2e')]=_[_0x2fab('0x2f')](_0x102149[_0x2fab('0x2b')],_0x102149[_0x2fab('0x2d')]);_0x3be5bf[_0x2fab('0x30')]=_['intersection'](_0x102149[_0x2fab('0x2b')],qs[_0x2fab('0x31')](_0x34e109[_0x2fab('0x2d')][_0x2fab('0x31')]));_0x3be5bf[_0x2fab('0x30')]=_0x3be5bf['attributes'][_0x2fab('0x32')]?_0x3be5bf[_0x2fab('0x30')]:_0x102149['model'];if(!_0x34e109['query']['hasOwnProperty'](_0x2fab('0x33'))){_0x3be5bf['limit']=qs['limit'](_0x34e109['query'][_0x2fab('0x1d')]);_0x3be5bf[_0x2fab('0x1b')]=qs['offset'](_0x34e109[_0x2fab('0x2d')]['offset']);}_0x3be5bf[_0x2fab('0x34')]=qs[_0x2fab('0x35')](_0x34e109['query'][_0x2fab('0x35')]);_0x3be5bf[_0x2fab('0x36')]=qs[_0x2fab('0x2e')](_[_0x2fab('0x37')](_0x34e109[_0x2fab('0x2d')],_0x102149[_0x2fab('0x2e')]),_0x1736d9);if(_0x34e109['query'][_0x2fab('0x38')]){_0x3be5bf[_0x2fab('0x36')]=_[_0x2fab('0x39')](_0x3be5bf[_0x2fab('0x36')],{'$or':_[_0x2fab('0x3a')](_0x1736d9,function(_0x20fb80){if(_0x20fb80[_0x2fab('0x29')]!==_0x2fab('0x3b')){var _0x16305f={};_0x16305f[_0x20fb80[_0x2fab('0x2c')]]={'$like':'%'+_0x34e109['query'][_0x2fab('0x38')]+'%'};return _0x16305f;}})});}_0x3be5bf=_[_0x2fab('0x39')]({},_0x3be5bf,_0x34e109['options']);var _0x5aa69c={'where':_0x3be5bf[_0x2fab('0x36')]};return db['SquareReport'][_0x2fab('0x3c')](_0x5aa69c)[_0x2fab('0x21')](function(_0x5bef5d){_0x434a46['count']=_0x5bef5d;if(_0x34e109[_0x2fab('0x2d')]['includeAll']){_0x3be5bf[_0x2fab('0x3d')]=[{'all':!![]}];}return db[_0x2fab('0x27')][_0x2fab('0x3e')](_0x3be5bf);})[_0x2fab('0x21')](function(_0x33458d){_0x434a46[_0x2fab('0x3f')]=_0x33458d;return _0x434a46;})[_0x2fab('0x21')](respondWithFilteredResult(_0x344749,_0x3be5bf))[_0x2fab('0x40')](handleError(_0x344749,null));};exports['show']=function(_0x124f20,_0x12c06e){var _0x270e71={'raw':!![],'where':{'id':_0x124f20[_0x2fab('0x41')]['id']}},_0x4a14be={};_0x4a14be[_0x2fab('0x2b')]=_[_0x2fab('0x42')](db['SquareReport'][_0x2fab('0x28')]);_0x4a14be[_0x2fab('0x2d')]=_[_0x2fab('0x42')](_0x124f20[_0x2fab('0x2d')]);_0x4a14be['filters']=_[_0x2fab('0x2f')](_0x4a14be[_0x2fab('0x2b')],_0x4a14be[_0x2fab('0x2d')]);_0x270e71[_0x2fab('0x30')]=_['intersection'](_0x4a14be[_0x2fab('0x2b')],qs['fields'](_0x124f20[_0x2fab('0x2d')]['fields']));_0x270e71[_0x2fab('0x30')]=_0x270e71[_0x2fab('0x30')]['length']?_0x270e71[_0x2fab('0x30')]:_0x4a14be[_0x2fab('0x2b')];if(_0x124f20['query'][_0x2fab('0x43')]){_0x270e71[_0x2fab('0x3d')]=[{'all':!![]}];}_0x270e71=_[_0x2fab('0x39')]({},_0x270e71,_0x124f20[_0x2fab('0x44')]);return db[_0x2fab('0x27')][_0x2fab('0x45')](_0x270e71)['then'](handleEntityNotFound(_0x12c06e,null))[_0x2fab('0x21')](respondWithResult(_0x12c06e,null))[_0x2fab('0x40')](handleError(_0x12c06e,null));};exports[_0x2fab('0x46')]=function(_0x3e7456,_0x480abd){return db[_0x2fab('0x27')][_0x2fab('0x46')](_0x3e7456[_0x2fab('0x47')],{})[_0x2fab('0x21')](respondWithResult(_0x480abd,0xc9))[_0x2fab('0x40')](handleError(_0x480abd,null));};exports['update']=function(_0x52e05b,_0x20abe6){if(_0x52e05b[_0x2fab('0x47')]['id']){delete _0x52e05b[_0x2fab('0x47')]['id'];}return db[_0x2fab('0x27')]['find']({'where':{'id':_0x52e05b[_0x2fab('0x41')]['id']}})[_0x2fab('0x21')](handleEntityNotFound(_0x20abe6,null))[_0x2fab('0x21')](saveUpdates(_0x52e05b['body'],null))[_0x2fab('0x21')](respondWithResult(_0x20abe6,null))[_0x2fab('0x40')](handleError(_0x20abe6,null));};exports['destroy']=function(_0x52dd1a,_0x5ea710){return db[_0x2fab('0x27')][_0x2fab('0x45')]({'where':{'id':_0x52dd1a[_0x2fab('0x41')]['id']}})[_0x2fab('0x21')](handleEntityNotFound(_0x5ea710,null))[_0x2fab('0x21')](removeEntity(_0x5ea710,null))[_0x2fab('0x40')](handleError(_0x5ea710,null));};exports['describe']=function(_0x39d2db,_0x1ccc63){return db[_0x2fab('0x27')][_0x2fab('0x48')]()['then'](respondWithResult(_0x1ccc63,null))[_0x2fab('0x40')](handleError(_0x1ccc63,null));}; \ No newline at end of file +var _0x92e4=['bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','SquareReport','includeAll','include','findAll','catch','show','params','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x246faf,_0x12f669){var _0x52cd05=function(_0x2fd103){while(--_0x2fd103){_0x246faf['push'](_0x246faf['shift']());}};_0x52cd05(++_0x12f669);}(_0x92e4,0xd1));var _0x492e=function(_0x424be8,_0x342b0c){_0x424be8=_0x424be8-0x0;var _0x1fbc0e=_0x92e4[_0x424be8];return _0x1fbc0e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x492e('0x0'));var zipdir=require(_0x492e('0x1'));var jsonpatch=require(_0x492e('0x2'));var rp=require('request-promise');var moment=require(_0x492e('0x3'));var BPromise=require(_0x492e('0x4'));var Mustache=require(_0x492e('0x5'));var util=require(_0x492e('0x6'));var path=require('path');var sox=require(_0x492e('0x7'));var csv=require(_0x492e('0x8'));var ejs=require(_0x492e('0x9'));var fs=require('fs');var fs_extra=require(_0x492e('0xa'));var _=require(_0x492e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x492e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x492e('0xd'));var Papa=require(_0x492e('0xe'));var Redis=require(_0x492e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x492e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x492e('0x11'));var utils=require(_0x492e('0x12'));var config=require(_0x492e('0x13'));var licenseUtil=require(_0x492e('0x14'));var db=require(_0x492e('0x15'))['db'];function respondWithStatusCode(_0x17744e,_0x2cf349){_0x2cf349=_0x2cf349||0xcc;return function(_0x402a3a){if(_0x402a3a){return _0x17744e[_0x492e('0x16')](_0x2cf349);}return _0x17744e[_0x492e('0x17')](_0x2cf349)[_0x492e('0x18')]();};}function respondWithResult(_0x2aefb9,_0x2b377a){_0x2b377a=_0x2b377a||0xc8;return function(_0x57c938){if(_0x57c938){return _0x2aefb9[_0x492e('0x17')](_0x2b377a)[_0x492e('0x19')](_0x57c938);}};}function respondWithFilteredResult(_0x120bd5,_0x3e2d48){return function(_0x575ffe){if(_0x575ffe){var _0x4270c7=typeof _0x3e2d48['offset']===_0x492e('0x1a')&&typeof _0x3e2d48[_0x492e('0x1b')]===_0x492e('0x1a');var _0x5d1084=_0x575ffe[_0x492e('0x1c')];var _0xa347ac=_0x4270c7?0x0:_0x3e2d48[_0x492e('0x1d')];var _0xd8db0=_0x4270c7?_0x575ffe[_0x492e('0x1c')]:_0x3e2d48['offset']+_0x3e2d48['limit'];var _0x39749a;if(_0xd8db0>=_0x5d1084){_0xd8db0=_0x5d1084;_0x39749a=0xc8;}else{_0x39749a=0xce;}_0x120bd5[_0x492e('0x17')](_0x39749a);return _0x120bd5['set'](_0x492e('0x1e'),_0xa347ac+'-'+_0xd8db0+'/'+_0x5d1084)[_0x492e('0x19')](_0x575ffe);}return null;};}function patchUpdates(_0x4546b7){return function(_0x51cc75){try{jsonpatch[_0x492e('0x1f')](_0x51cc75,_0x4546b7,!![]);}catch(_0x4c805f){return BPromise['reject'](_0x4c805f);}return _0x51cc75['save']();};}function saveUpdates(_0x3dd5be,_0x173408){return function(_0x337eb4){if(_0x337eb4){return _0x337eb4['update'](_0x3dd5be)[_0x492e('0x20')](function(_0x4b22fe){return _0x4b22fe;});}return null;};}function removeEntity(_0x48a17b,_0x1e4881){return function(_0x183070){if(_0x183070){return _0x183070[_0x492e('0x21')]()[_0x492e('0x20')](function(){_0x48a17b[_0x492e('0x17')](0xcc)[_0x492e('0x18')]();});}};}function handleEntityNotFound(_0x47a89d,_0x943fc4){return function(_0x49a08c){if(!_0x49a08c){_0x47a89d[_0x492e('0x16')](0x194);}return _0x49a08c;};}function handleError(_0x34f41b,_0x1b3d43){_0x1b3d43=_0x1b3d43||0x1f4;return function(_0x4dd39d){logger['error'](_0x4dd39d[_0x492e('0x22')]);if(_0x4dd39d['name']){delete _0x4dd39d[_0x492e('0x23')];}_0x34f41b[_0x492e('0x17')](_0x1b3d43)[_0x492e('0x24')](_0x4dd39d);};}exports[_0x492e('0x25')]=function(_0x247bf7,_0x4c9965){var _0x3a4f4e={},_0x1733d1={},_0x39de85={'count':0x0,'rows':[]};var _0x296ac4=_[_0x492e('0x26')](db['SquareReport'][_0x492e('0x27')],function(_0x373606){return{'name':_0x373606[_0x492e('0x28')],'type':_0x373606['type'][_0x492e('0x29')]};});_0x1733d1[_0x492e('0x2a')]=_['map'](_0x296ac4,_0x492e('0x23'));_0x1733d1[_0x492e('0x2b')]=_[_0x492e('0x2c')](_0x247bf7[_0x492e('0x2b')]);_0x1733d1[_0x492e('0x2d')]=_[_0x492e('0x2e')](_0x1733d1[_0x492e('0x2a')],_0x1733d1['query']);_0x3a4f4e[_0x492e('0x2f')]=_['intersection'](_0x1733d1[_0x492e('0x2a')],qs[_0x492e('0x30')](_0x247bf7[_0x492e('0x2b')][_0x492e('0x30')]));_0x3a4f4e[_0x492e('0x2f')]=_0x3a4f4e[_0x492e('0x2f')][_0x492e('0x31')]?_0x3a4f4e[_0x492e('0x2f')]:_0x1733d1[_0x492e('0x2a')];if(!_0x247bf7[_0x492e('0x2b')][_0x492e('0x32')](_0x492e('0x33'))){_0x3a4f4e[_0x492e('0x1b')]=qs[_0x492e('0x1b')](_0x247bf7[_0x492e('0x2b')][_0x492e('0x1b')]);_0x3a4f4e[_0x492e('0x1d')]=qs['offset'](_0x247bf7[_0x492e('0x2b')]['offset']);}_0x3a4f4e['order']=qs[_0x492e('0x34')](_0x247bf7[_0x492e('0x2b')][_0x492e('0x34')]);_0x3a4f4e['where']=qs[_0x492e('0x2d')](_[_0x492e('0x35')](_0x247bf7[_0x492e('0x2b')],_0x1733d1[_0x492e('0x2d')]),_0x296ac4);if(_0x247bf7[_0x492e('0x2b')][_0x492e('0x36')]){_0x3a4f4e[_0x492e('0x37')]=_[_0x492e('0x38')](_0x3a4f4e[_0x492e('0x37')],{'$or':_[_0x492e('0x26')](_0x296ac4,function(_0x42836b){if(_0x42836b[_0x492e('0x39')]!==_0x492e('0x3a')){var _0x1f28b5={};_0x1f28b5[_0x42836b[_0x492e('0x23')]]={'$like':'%'+_0x247bf7[_0x492e('0x2b')][_0x492e('0x36')]+'%'};return _0x1f28b5;}})});}_0x3a4f4e=_['merge']({},_0x3a4f4e,_0x247bf7['options']);var _0x17ee1a={'where':_0x3a4f4e[_0x492e('0x37')]};return db[_0x492e('0x3b')][_0x492e('0x1c')](_0x17ee1a)[_0x492e('0x20')](function(_0x34851c){_0x39de85[_0x492e('0x1c')]=_0x34851c;if(_0x247bf7['query'][_0x492e('0x3c')]){_0x3a4f4e[_0x492e('0x3d')]=[{'all':!![]}];}return db[_0x492e('0x3b')][_0x492e('0x3e')](_0x3a4f4e);})['then'](function(_0x5a51fc){_0x39de85['rows']=_0x5a51fc;return _0x39de85;})[_0x492e('0x20')](respondWithFilteredResult(_0x4c9965,_0x3a4f4e))[_0x492e('0x3f')](handleError(_0x4c9965,null));};exports[_0x492e('0x40')]=function(_0x346b4a,_0x4aff82){var _0x5dfde2={'raw':!![],'where':{'id':_0x346b4a[_0x492e('0x41')]['id']}},_0x6168bd={};_0x6168bd[_0x492e('0x2a')]=_['keys'](db['SquareReport'][_0x492e('0x27')]);_0x6168bd[_0x492e('0x2b')]=_[_0x492e('0x2c')](_0x346b4a[_0x492e('0x2b')]);_0x6168bd[_0x492e('0x2d')]=_[_0x492e('0x2e')](_0x6168bd[_0x492e('0x2a')],_0x6168bd[_0x492e('0x2b')]);_0x5dfde2[_0x492e('0x2f')]=_[_0x492e('0x2e')](_0x6168bd[_0x492e('0x2a')],qs['fields'](_0x346b4a['query'][_0x492e('0x30')]));_0x5dfde2['attributes']=_0x5dfde2['attributes'][_0x492e('0x31')]?_0x5dfde2['attributes']:_0x6168bd[_0x492e('0x2a')];if(_0x346b4a['query'][_0x492e('0x3c')]){_0x5dfde2['include']=[{'all':!![]}];}_0x5dfde2=_['merge']({},_0x5dfde2,_0x346b4a[_0x492e('0x42')]);return db[_0x492e('0x3b')][_0x492e('0x43')](_0x5dfde2)[_0x492e('0x20')](handleEntityNotFound(_0x4aff82,null))['then'](respondWithResult(_0x4aff82,null))[_0x492e('0x3f')](handleError(_0x4aff82,null));};exports[_0x492e('0x44')]=function(_0x58c9e1,_0x9754bc){return db[_0x492e('0x3b')]['create'](_0x58c9e1[_0x492e('0x45')],{})[_0x492e('0x20')](respondWithResult(_0x9754bc,0xc9))['catch'](handleError(_0x9754bc,null));};exports['update']=function(_0xd07223,_0x1b3f41){if(_0xd07223[_0x492e('0x45')]['id']){delete _0xd07223['body']['id'];}return db[_0x492e('0x3b')]['find']({'where':{'id':_0xd07223['params']['id']}})[_0x492e('0x20')](handleEntityNotFound(_0x1b3f41,null))['then'](saveUpdates(_0xd07223[_0x492e('0x45')],null))[_0x492e('0x20')](respondWithResult(_0x1b3f41,null))[_0x492e('0x3f')](handleError(_0x1b3f41,null));};exports[_0x492e('0x21')]=function(_0xe4afe,_0x58cc7c){return db[_0x492e('0x3b')][_0x492e('0x43')]({'where':{'id':_0xe4afe[_0x492e('0x41')]['id']}})[_0x492e('0x20')](handleEntityNotFound(_0x58cc7c,null))[_0x492e('0x20')](removeEntity(_0x58cc7c,null))[_0x492e('0x3f')](handleError(_0x58cc7c,null));};exports['describe']=function(_0xa6e566,_0x4cc838){return db[_0x492e('0x3b')][_0x492e('0x46')]()[_0x492e('0x20')](respondWithResult(_0x4cc838,null))[_0x492e('0x3f')](handleError(_0x4cc838,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 9f8a9b7..7ef7ae4 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 _0xffb1=['./squareReport.attributes','define','report_square','uid_pname','uniqueid','leaveAt','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xf3d167,_0x3ea98e){var _0x3cd413=function(_0x4deb88){while(--_0x4deb88){_0xf3d167['push'](_0xf3d167['shift']());}};_0x3cd413(++_0x3ea98e);}(_0xffb1,0x172));var _0x1ffb=function(_0x3eb630,_0x552586){_0x3eb630=_0x3eb630-0x0;var _0x1b840d=_0xffb1[_0x3eb630];return _0x1b840d;};'use strict';var _=require('lodash');var util=require(_0x1ffb('0x0'));var logger=require(_0x1ffb('0x1'))(_0x1ffb('0x2'));var moment=require(_0x1ffb('0x3'));var BPromise=require(_0x1ffb('0x4'));var rp=require(_0x1ffb('0x5'));var fs=require('fs');var path=require(_0x1ffb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1ffb('0x7'));module['exports']=function(_0x2f515b,_0x3de5e7){return _0x2f515b[_0x1ffb('0x8')]('SquareReport',attributes,{'tableName':_0x1ffb('0x9'),'paranoid':![],'indexes':[{'name':_0x1ffb('0xa'),'fields':[_0x1ffb('0xb'),'project_name']},{'name':_0x1ffb('0xc'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c0c=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash'];(function(_0x97def9,_0x320c56){var _0x53c5ad=function(_0x24cb55){while(--_0x24cb55){_0x97def9['push'](_0x97def9['shift']());}};_0x53c5ad(++_0x320c56);}(_0x5c0c,0xcb));var _0xc5c0=function(_0x2560b5,_0x4fee88){_0x2560b5=_0x2560b5-0x0;var _0x22958d=_0x5c0c[_0x2560b5];return _0x22958d;};'use strict';var _=require(_0xc5c0('0x0'));var util=require('util');var logger=require(_0xc5c0('0x1'))(_0xc5c0('0x2'));var moment=require(_0xc5c0('0x3'));var BPromise=require(_0xc5c0('0x4'));var rp=require(_0xc5c0('0x5'));var fs=require('fs');var path=require(_0xc5c0('0x6'));var rimraf=require(_0xc5c0('0x7'));var config=require(_0xc5c0('0x8'));var attributes=require('./squareReport.attributes');module[_0xc5c0('0x9')]=function(_0x4d7ded,_0x1380fc){return _0x4d7ded[_0xc5c0('0xa')](_0xc5c0('0xb'),attributes,{'tableName':_0xc5c0('0xc'),'paranoid':![],'indexes':[{'name':_0xc5c0('0xd'),'fields':[_0xc5c0('0xe'),_0xc5c0('0xf')]},{'name':'leaveAt','fields':[_0xc5c0('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 81e0dea..17ef217 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 _0xe75d=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','request','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateSquareReport','SquareReport','body','options','raw','UpdateSquareReport','where','attributes','limit','stringify'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xe75d,0xf0));var _0xde75=function(_0x4bda94,_0x279d5c){_0x4bda94=_0x4bda94-0x0;var _0x1116ec=_0xe75d[_0x4bda94];return _0x1116ec;};'use strict';var _=require('lodash');var util=require(_0xde75('0x0'));var moment=require(_0xde75('0x1'));var BPromise=require(_0xde75('0x2'));var rs=require(_0xde75('0x3'));var fs=require('fs');var Redis=require(_0xde75('0x4'));var db=require(_0xde75('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xde75('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xde75('0x7')][_0xde75('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d1ae8,_0x214172,_0xc1532c){return new BPromise(function(_0x20cb31,_0x4f5684){return client[_0xde75('0x9')](_0x5d1ae8,_0xc1532c)[_0xde75('0xa')](function(_0x884d29){logger[_0xde75('0xb')](_0xde75('0xc'),_0x214172,'request\x20sent');logger[_0xde75('0xd')](_0xde75('0xe'),_0x214172,_0xde75('0xf'),JSON['stringify'](_0x884d29));if(_0x884d29[_0xde75('0x10')]){if(_0x884d29[_0xde75('0x10')]['code']===0x1f4){logger[_0xde75('0x10')](_0xde75('0xc'),_0x214172,_0x884d29[_0xde75('0x10')][_0xde75('0x11')]);return _0x4f5684(_0x884d29[_0xde75('0x10')]['message']);}logger['error'](_0xde75('0xc'),_0x214172,_0x884d29['error'][_0xde75('0x11')]);return _0x20cb31(_0x884d29[_0xde75('0x10')][_0xde75('0x11')]);}else{logger[_0xde75('0xb')](_0xde75('0xc'),_0x214172,_0xde75('0xf'));_0x20cb31(_0x884d29[_0xde75('0x12')][_0xde75('0x11')]);}})[_0xde75('0x13')](function(_0x10b052){logger[_0xde75('0x10')](_0xde75('0xc'),_0x214172,_0x10b052);_0x4f5684(_0x10b052);});});}exports[_0xde75('0x14')]=function(_0x483e89){var _0x2cde81=this;return new Promise(function(_0x475222,_0x157299){return db[_0xde75('0x15')]['create'](_0x483e89[_0xde75('0x16')],{'raw':_0x483e89[_0xde75('0x17')]?_0x483e89[_0xde75('0x17')][_0xde75('0x18')]===undefined?!![]:![]:!![]})[_0xde75('0xa')](function(_0x324353){logger[_0xde75('0xb')](_0xde75('0x14'),_0x483e89);logger['debug']('CreateSquareReport',_0x483e89,JSON['stringify'](_0x324353));_0x475222(_0x324353);})['catch'](function(_0x47c683){logger[_0xde75('0x10')](_0xde75('0x14'),_0x47c683[_0xde75('0x11')],_0x483e89);_0x157299(_0x2cde81[_0xde75('0x10')](0x1f4,_0x47c683[_0xde75('0x11')]));});});};exports[_0xde75('0x19')]=function(_0x1c90be){var _0x565e44=this;return new Promise(function(_0x14975e,_0x2563dd){return db[_0xde75('0x15')]['update'](_0x1c90be[_0xde75('0x16')],{'raw':_0x1c90be[_0xde75('0x17')]?_0x1c90be[_0xde75('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c90be[_0xde75('0x17')]?_0x1c90be[_0xde75('0x17')][_0xde75('0x1a')]||null:null,'attributes':_0x1c90be['options']?_0x1c90be[_0xde75('0x17')][_0xde75('0x1b')]||null:null,'limit':_0x1c90be['options']?_0x1c90be[_0xde75('0x17')][_0xde75('0x1c')]||null:null})['then'](function(_0x14a69a){logger[_0xde75('0xb')](_0xde75('0x19'),_0x1c90be);logger[_0xde75('0xd')](_0xde75('0x19'),_0x1c90be,JSON[_0xde75('0x1d')](_0x14a69a));_0x14975e(_0x14a69a);})[_0xde75('0x13')](function(_0x5d57f2){logger[_0xde75('0x10')](_0xde75('0x19'),_0x5d57f2[_0xde75('0x11')],_0x1c90be);_0x2563dd(_0x565e44['error'](0x1f4,_0x5d57f2[_0xde75('0x11')]));});});}; \ No newline at end of file +var _0xc96c=['create','body','options','raw','then','UpdateSquareReport','SquareReport','update','where','attributes','lodash','util','client','http','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateSquareReport'];(function(_0xb431e3,_0x2fce12){var _0x2f2948=function(_0x143633){while(--_0x143633){_0xb431e3['push'](_0xb431e3['shift']());}};_0x2f2948(++_0x2fce12);}(_0xc96c,0xca));var _0xcc96=function(_0x4c23a1,_0x5e630c){_0x4c23a1=_0x4c23a1-0x0;var _0x524a39=_0xc96c[_0x4c23a1];return _0x524a39;};'use strict';var _=require(_0xcc96('0x0'));var util=require(_0xcc96('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcc96('0x2')][_0xcc96('0x3')]({'port':0x232a});function respondWithRpcPromise(_0x41fe76,_0x3f4798,_0x4ce841){return new BPromise(function(_0x5c5fbf,_0x478fb9){return client['request'](_0x41fe76,_0x4ce841)['then'](function(_0x3761c9){logger[_0xcc96('0x4')](_0xcc96('0x5'),_0x3f4798,_0xcc96('0x6'));logger[_0xcc96('0x7')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x3f4798,_0xcc96('0x6'),JSON[_0xcc96('0x8')](_0x3761c9));if(_0x3761c9[_0xcc96('0x9')]){if(_0x3761c9[_0xcc96('0x9')]['code']===0x1f4){logger[_0xcc96('0x9')](_0xcc96('0x5'),_0x3f4798,_0x3761c9[_0xcc96('0x9')]['message']);return _0x478fb9(_0x3761c9['error']['message']);}logger[_0xcc96('0x9')]('SquareReport,\x20%s,\x20%s',_0x3f4798,_0x3761c9[_0xcc96('0x9')][_0xcc96('0xa')]);return _0x5c5fbf(_0x3761c9[_0xcc96('0x9')][_0xcc96('0xa')]);}else{logger[_0xcc96('0x4')](_0xcc96('0x5'),_0x3f4798,_0xcc96('0x6'));_0x5c5fbf(_0x3761c9[_0xcc96('0xb')][_0xcc96('0xa')]);}})[_0xcc96('0xc')](function(_0x3dbe64){logger[_0xcc96('0x9')](_0xcc96('0x5'),_0x3f4798,_0x3dbe64);_0x478fb9(_0x3dbe64);});});}exports[_0xcc96('0xd')]=function(_0xac2fc7){var _0x80513=this;return new Promise(function(_0x1a8674,_0x4c4f8d){return db['SquareReport'][_0xcc96('0xe')](_0xac2fc7[_0xcc96('0xf')],{'raw':_0xac2fc7['options']?_0xac2fc7[_0xcc96('0x10')][_0xcc96('0x11')]===undefined?!![]:![]:!![]})[_0xcc96('0x12')](function(_0x1735d9){logger[_0xcc96('0x4')](_0xcc96('0xd'),_0xac2fc7);logger['debug'](_0xcc96('0xd'),_0xac2fc7,JSON[_0xcc96('0x8')](_0x1735d9));_0x1a8674(_0x1735d9);})['catch'](function(_0x1032cc){logger[_0xcc96('0x9')]('CreateSquareReport',_0x1032cc[_0xcc96('0xa')],_0xac2fc7);_0x4c4f8d(_0x80513['error'](0x1f4,_0x1032cc['message']));});});};exports[_0xcc96('0x13')]=function(_0x4df46f){var _0x2c665a=this;return new Promise(function(_0x2dc246,_0xffb626){return db[_0xcc96('0x14')][_0xcc96('0x15')](_0x4df46f[_0xcc96('0xf')],{'raw':_0x4df46f[_0xcc96('0x10')]?_0x4df46f['options'][_0xcc96('0x11')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4df46f[_0xcc96('0x10')]?_0x4df46f['options'][_0xcc96('0x16')]||null:null,'attributes':_0x4df46f['options']?_0x4df46f[_0xcc96('0x10')][_0xcc96('0x17')]||null:null,'limit':_0x4df46f[_0xcc96('0x10')]?_0x4df46f[_0xcc96('0x10')]['limit']||null:null})[_0xcc96('0x12')](function(_0x2d6424){logger[_0xcc96('0x4')](_0xcc96('0x13'),_0x4df46f);logger[_0xcc96('0x7')]('UpdateSquareReport',_0x4df46f,JSON[_0xcc96('0x8')](_0x2d6424));_0x2dc246(_0x2d6424);})[_0xcc96('0xc')](function(_0x1d302a){logger[_0xcc96('0x9')](_0xcc96('0x13'),_0x1d302a[_0xcc96('0xa')],_0x4df46f);_0xffb626(_0x2c665a['error'](0x1f4,_0x1d302a[_0xcc96('0xa')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 2a96b57..e875feb 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 _0xdac8=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0xdac8,0x7c));var _0x8dac=function(_0x106d25,_0x247cc4){_0x106d25=_0x106d25-0x0;var _0x7e5a07=_0xdac8[_0x106d25];return _0x7e5a07;};'use strict';var multer=require('multer');var util=require(_0x8dac('0x0'));var path=require(_0x8dac('0x1'));var timeout=require(_0x8dac('0x2'));var express=require('express');var router=express[_0x8dac('0x3')]();var fs_extra=require(_0x8dac('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8dac('0x5'));var config=require(_0x8dac('0x6'));var controller=require(_0x8dac('0x7'));router[_0x8dac('0x8')]('/',auth[_0x8dac('0x9')](),controller[_0x8dac('0xa')]);router['get']('/describe',auth[_0x8dac('0x9')](),controller['describe']);router[_0x8dac('0x8')](_0x8dac('0xb'),auth[_0x8dac('0x9')](),controller[_0x8dac('0xc')]);router[_0x8dac('0xd')]('/',auth[_0x8dac('0x9')](),controller[_0x8dac('0xe')]);router[_0x8dac('0xf')](_0x8dac('0xb'),auth[_0x8dac('0x9')](),controller['update']);router[_0x8dac('0x10')](_0x8dac('0xb'),auth[_0x8dac('0x9')](),controller[_0x8dac('0x11')]);module[_0x8dac('0x12')]=router; \ No newline at end of file +var _0x860b=['../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','show','create','put','update','delete','/:id','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x4a468d,_0x48d3b3){var _0x2fa697=function(_0x177259){while(--_0x177259){_0x4a468d['push'](_0x4a468d['shift']());}};_0x2fa697(++_0x48d3b3);}(_0x860b,0xa2));var _0xb860=function(_0x5622c7,_0x158cf0){_0x5622c7=_0x5622c7-0x0;var _0x38dc18=_0x860b[_0x5622c7];return _0x38dc18;};'use strict';var multer=require(_0xb860('0x0'));var util=require(_0xb860('0x1'));var path=require('path');var timeout=require(_0xb860('0x2'));var express=require(_0xb860('0x3'));var router=express[_0xb860('0x4')]();var fs_extra=require(_0xb860('0x5'));var auth=require(_0xb860('0x6'));var interaction=require(_0xb860('0x7'));var config=require('../../config/environment');var controller=require(_0xb860('0x8'));router[_0xb860('0x9')]('/',auth[_0xb860('0xa')](),controller[_0xb860('0xb')]);router['get'](_0xb860('0xc'),auth['isAuthenticated'](),controller[_0xb860('0xd')]);router[_0xb860('0x9')]('/:id',auth[_0xb860('0xa')](),controller[_0xb860('0xe')]);router['post']('/',auth[_0xb860('0xa')](),controller[_0xb860('0xf')]);router[_0xb860('0x10')]('/:id',auth[_0xb860('0xa')](),controller[_0xb860('0x11')]);router[_0xb860('0x12')](_0xb860('0x13'),auth[_0xb860('0xa')](),controller[_0xb860('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 7e02d81..fd912b2 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 _0xffb5=['TEXT','exports','STRING'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xffb5,0x70));var _0x5ffb=function(_0x1d9dd1,_0x189813){_0x1d9dd1=_0x1d9dd1-0x0;var _0x33a326=_0xffb5[_0x1d9dd1];return _0x33a326;};'use strict';var Sequelize=require('sequelize');module[_0x5ffb('0x0')]={'uniqueid':{'type':Sequelize[_0x5ffb('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x5ffb('0x2')]},'project_name':{'type':Sequelize[_0x5ffb('0x1')]},'callerid':{'type':Sequelize[_0x5ffb('0x1')]}}; \ No newline at end of file +var _0x749e=['TEXT','sequelize','exports','STRING'];(function(_0x40edbb,_0x4b8e85){var _0x1c34e1=function(_0x4cb6dc){while(--_0x4cb6dc){_0x40edbb['push'](_0x40edbb['shift']());}};_0x1c34e1(++_0x4b8e85);}(_0x749e,0x171));var _0xe749=function(_0x1d0b0a,_0x4966a0){_0x1d0b0a=_0x1d0b0a-0x0;var _0x15ad1d=_0x749e[_0x1d0b0a];return _0x15ad1d;};'use strict';var Sequelize=require(_0xe749('0x0'));module[_0xe749('0x1')]={'uniqueid':{'type':Sequelize[_0xe749('0x2')]},'node':{'type':Sequelize[_0xe749('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xe749('0x3')]},'project_name':{'type':Sequelize[_0xe749('0x2')]},'callerid':{'type':Sequelize[_0xe749('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 9829b93..7bec766 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 _0xe40f=['key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','SquareDetailsReport','rawAttributes'];(function(_0x4a8127,_0x983d77){var _0x4f0d36=function(_0x36b07c){while(--_0x36b07c){_0x4a8127['push'](_0x4a8127['shift']());}};_0x4f0d36(++_0x983d77);}(_0xe40f,0x1d3));var _0xfe40=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xe40f[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfe40('0x0'));var jsonpatch=require(_0xfe40('0x1'));var rp=require(_0xfe40('0x2'));var moment=require(_0xfe40('0x3'));var BPromise=require(_0xfe40('0x4'));var Mustache=require(_0xfe40('0x5'));var util=require('util');var path=require(_0xfe40('0x6'));var sox=require(_0xfe40('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfe40('0x8'));var _=require(_0xfe40('0x9'));var squel=require(_0xfe40('0xa'));var crypto=require(_0xfe40('0xb'));var jsforce=require(_0xfe40('0xc'));var deskjs=require(_0xfe40('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfe40('0xe'));var Papa=require(_0xfe40('0xf'));var Redis=require(_0xfe40('0x10'));var authService=require(_0xfe40('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xfe40('0x12'));var config=require(_0xfe40('0x13'));var licenseUtil=require(_0xfe40('0x14'));var db=require(_0xfe40('0x15'))['db'];function respondWithStatusCode(_0x51384d,_0x1ed140){_0x1ed140=_0x1ed140||0xcc;return function(_0x2d46f8){if(_0x2d46f8){return _0x51384d[_0xfe40('0x16')](_0x1ed140);}return _0x51384d[_0xfe40('0x17')](_0x1ed140)[_0xfe40('0x18')]();};}function respondWithResult(_0x4eaaba,_0x20f921){_0x20f921=_0x20f921||0xc8;return function(_0xd49ee2){if(_0xd49ee2){return _0x4eaaba['status'](_0x20f921)[_0xfe40('0x19')](_0xd49ee2);}};}function respondWithFilteredResult(_0x7f0243,_0x2b0393){return function(_0x33c7ea){if(_0x33c7ea){var _0x95a6c9=typeof _0x2b0393[_0xfe40('0x1a')]===_0xfe40('0x1b')&&typeof _0x2b0393[_0xfe40('0x1c')]==='undefined';var _0x8e9239=_0x33c7ea[_0xfe40('0x1d')];var _0x1e5c07=_0x95a6c9?0x0:_0x2b0393[_0xfe40('0x1a')];var _0x1cd5c3=_0x95a6c9?_0x33c7ea[_0xfe40('0x1d')]:_0x2b0393['offset']+_0x2b0393[_0xfe40('0x1c')];var _0x50fa69;if(_0x1cd5c3>=_0x8e9239){_0x1cd5c3=_0x8e9239;_0x50fa69=0xc8;}else{_0x50fa69=0xce;}_0x7f0243[_0xfe40('0x17')](_0x50fa69);return _0x7f0243[_0xfe40('0x1e')]('Content-Range',_0x1e5c07+'-'+_0x1cd5c3+'/'+_0x8e9239)['json'](_0x33c7ea);}return null;};}function patchUpdates(_0x509364){return function(_0x4b4d87){try{jsonpatch[_0xfe40('0x1f')](_0x4b4d87,_0x509364,!![]);}catch(_0x5cfdbd){return BPromise[_0xfe40('0x20')](_0x5cfdbd);}return _0x4b4d87[_0xfe40('0x21')]();};}function saveUpdates(_0x480dd0,_0x23bd42){return function(_0x5e28c2){if(_0x5e28c2){return _0x5e28c2[_0xfe40('0x22')](_0x480dd0)[_0xfe40('0x23')](function(_0x4d8ca6){return _0x4d8ca6;});}return null;};}function removeEntity(_0x8db831,_0x179b0e){return function(_0x566662){if(_0x566662){return _0x566662[_0xfe40('0x24')]()[_0xfe40('0x23')](function(){_0x8db831[_0xfe40('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x172d04,_0x5ad8c0){return function(_0x1788be){if(!_0x1788be){_0x172d04[_0xfe40('0x16')](0x194);}return _0x1788be;};}function handleError(_0x1e0d93,_0x5cb385){_0x5cb385=_0x5cb385||0x1f4;return function(_0x543d2a){logger['error'](_0x543d2a[_0xfe40('0x25')]);if(_0x543d2a['name']){delete _0x543d2a[_0xfe40('0x26')];}_0x1e0d93[_0xfe40('0x17')](_0x5cb385)[_0xfe40('0x27')](_0x543d2a);};}exports[_0xfe40('0x28')]=function(_0x3989fd,_0x41d30d){var _0x28aa07={},_0x559a3f={},_0x4edfd7={'count':0x0,'rows':[]};var _0xedc67c=_[_0xfe40('0x29')](db[_0xfe40('0x2a')][_0xfe40('0x2b')],function(_0x3693a4){return{'name':_0x3693a4['fieldName'],'type':_0x3693a4['type'][_0xfe40('0x2c')]};});_0x559a3f[_0xfe40('0x2d')]=_[_0xfe40('0x29')](_0xedc67c,_0xfe40('0x26'));_0x559a3f[_0xfe40('0x2e')]=_['keys'](_0x3989fd[_0xfe40('0x2e')]);_0x559a3f[_0xfe40('0x2f')]=_[_0xfe40('0x30')](_0x559a3f[_0xfe40('0x2d')],_0x559a3f['query']);_0x28aa07[_0xfe40('0x31')]=_[_0xfe40('0x30')](_0x559a3f[_0xfe40('0x2d')],qs[_0xfe40('0x32')](_0x3989fd['query'][_0xfe40('0x32')]));_0x28aa07[_0xfe40('0x31')]=_0x28aa07['attributes']['length']?_0x28aa07['attributes']:_0x559a3f[_0xfe40('0x2d')];if(!_0x3989fd[_0xfe40('0x2e')][_0xfe40('0x33')](_0xfe40('0x34'))){_0x28aa07[_0xfe40('0x1c')]=qs[_0xfe40('0x1c')](_0x3989fd[_0xfe40('0x2e')]['limit']);_0x28aa07[_0xfe40('0x1a')]=qs[_0xfe40('0x1a')](_0x3989fd[_0xfe40('0x2e')][_0xfe40('0x1a')]);}_0x28aa07[_0xfe40('0x35')]=qs[_0xfe40('0x36')](_0x3989fd[_0xfe40('0x2e')]['sort']);_0x28aa07[_0xfe40('0x37')]=qs[_0xfe40('0x2f')](_[_0xfe40('0x38')](_0x3989fd['query'],_0x559a3f[_0xfe40('0x2f')]),_0xedc67c);if(_0x3989fd['query']['filter']){_0x28aa07['where']=_['merge'](_0x28aa07[_0xfe40('0x37')],{'$or':_[_0xfe40('0x29')](_0xedc67c,function(_0x456870){if(_0x456870['type']!==_0xfe40('0x39')){var _0x2ed9b0={};_0x2ed9b0[_0x456870[_0xfe40('0x26')]]={'$like':'%'+_0x3989fd['query']['filter']+'%'};return _0x2ed9b0;}})});}_0x28aa07=_[_0xfe40('0x3a')]({},_0x28aa07,_0x3989fd[_0xfe40('0x3b')]);var _0xa2954f={'where':_0x28aa07[_0xfe40('0x37')]};return db[_0xfe40('0x2a')][_0xfe40('0x1d')](_0xa2954f)[_0xfe40('0x23')](function(_0x4e62f8){_0x4edfd7[_0xfe40('0x1d')]=_0x4e62f8;if(_0x3989fd[_0xfe40('0x2e')][_0xfe40('0x3c')]){_0x28aa07[_0xfe40('0x3d')]=[{'all':!![]}];}return db[_0xfe40('0x2a')][_0xfe40('0x3e')](_0x28aa07);})['then'](function(_0x3b2213){_0x4edfd7[_0xfe40('0x3f')]=_0x3b2213;return _0x4edfd7;})[_0xfe40('0x23')](respondWithFilteredResult(_0x41d30d,_0x28aa07))[_0xfe40('0x40')](handleError(_0x41d30d,null));};exports[_0xfe40('0x41')]=function(_0x282f20,_0x3e291b){var _0x32ed0d={'raw':!![],'where':{'id':_0x282f20['params']['id']}},_0xbb763b={};_0xbb763b[_0xfe40('0x2d')]=_['keys'](db[_0xfe40('0x2a')][_0xfe40('0x2b')]);_0xbb763b[_0xfe40('0x2e')]=_[_0xfe40('0x42')](_0x282f20[_0xfe40('0x2e')]);_0xbb763b[_0xfe40('0x2f')]=_[_0xfe40('0x30')](_0xbb763b[_0xfe40('0x2d')],_0xbb763b[_0xfe40('0x2e')]);_0x32ed0d[_0xfe40('0x31')]=_[_0xfe40('0x30')](_0xbb763b[_0xfe40('0x2d')],qs['fields'](_0x282f20[_0xfe40('0x2e')][_0xfe40('0x32')]));_0x32ed0d[_0xfe40('0x31')]=_0x32ed0d[_0xfe40('0x31')][_0xfe40('0x43')]?_0x32ed0d[_0xfe40('0x31')]:_0xbb763b[_0xfe40('0x2d')];if(_0x282f20['query'][_0xfe40('0x3c')]){_0x32ed0d[_0xfe40('0x3d')]=[{'all':!![]}];}_0x32ed0d=_[_0xfe40('0x3a')]({},_0x32ed0d,_0x282f20[_0xfe40('0x3b')]);return db[_0xfe40('0x2a')][_0xfe40('0x44')](_0x32ed0d)[_0xfe40('0x23')](handleEntityNotFound(_0x3e291b,null))[_0xfe40('0x23')](respondWithResult(_0x3e291b,null))[_0xfe40('0x40')](handleError(_0x3e291b,null));};exports['create']=function(_0x3b07df,_0x2b5d31){return db[_0xfe40('0x2a')][_0xfe40('0x45')](_0x3b07df['body'],{})[_0xfe40('0x23')](respondWithResult(_0x2b5d31,0xc9))[_0xfe40('0x40')](handleError(_0x2b5d31,null));};exports[_0xfe40('0x22')]=function(_0x43f4f6,_0x4dbc2d){if(_0x43f4f6[_0xfe40('0x46')]['id']){delete _0x43f4f6[_0xfe40('0x46')]['id'];}return db['SquareDetailsReport'][_0xfe40('0x44')]({'where':{'id':_0x43f4f6['params']['id']}})[_0xfe40('0x23')](handleEntityNotFound(_0x4dbc2d,null))[_0xfe40('0x23')](saveUpdates(_0x43f4f6['body'],null))[_0xfe40('0x23')](respondWithResult(_0x4dbc2d,null))[_0xfe40('0x40')](handleError(_0x4dbc2d,null));};exports[_0xfe40('0x24')]=function(_0x49fa9d,_0x5bf4db){return db[_0xfe40('0x2a')]['find']({'where':{'id':_0x49fa9d[_0xfe40('0x47')]['id']}})['then'](handleEntityNotFound(_0x5bf4db,null))[_0xfe40('0x23')](removeEntity(_0x5bf4db,null))[_0xfe40('0x40')](handleError(_0x5bf4db,null));};exports['describe']=function(_0x18acd1,_0x58c6d0){return db[_0xfe40('0x2a')][_0xfe40('0x48')]()[_0xfe40('0x23')](respondWithResult(_0x58c6d0,null))[_0xfe40('0x40')](handleError(_0x58c6d0,null));}; \ No newline at end of file +var _0xce6b=['bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','limit','offset','count','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','SquareDetailsReport','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0xce6b,0x1c9));var _0xbce6=function(_0x328577,_0x307c18){_0x328577=_0x328577-0x0;var _0x130f1d=_0xce6b[_0x328577];return _0x130f1d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbce6('0x0'));var zipdir=require(_0xbce6('0x1'));var jsonpatch=require(_0xbce6('0x2'));var rp=require(_0xbce6('0x3'));var moment=require(_0xbce6('0x4'));var BPromise=require(_0xbce6('0x5'));var Mustache=require(_0xbce6('0x6'));var util=require(_0xbce6('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xbce6('0x8'));var ejs=require(_0xbce6('0x9'));var fs=require('fs');var fs_extra=require(_0xbce6('0xa'));var _=require(_0xbce6('0xb'));var squel=require(_0xbce6('0xc'));var crypto=require(_0xbce6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbce6('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbce6('0xf'));var Papa=require('papaparse');var Redis=require(_0xbce6('0x10'));var authService=require(_0xbce6('0x11'));var qs=require(_0xbce6('0x12'));var as=require(_0xbce6('0x13'));var hardwareService=require(_0xbce6('0x14'));var logger=require(_0xbce6('0x15'))(_0xbce6('0x16'));var utils=require(_0xbce6('0x17'));var config=require(_0xbce6('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbce6('0x19'))['db'];function respondWithStatusCode(_0x12d7a7,_0x503133){_0x503133=_0x503133||0xcc;return function(_0x3f0717){if(_0x3f0717){return _0x12d7a7['sendStatus'](_0x503133);}return _0x12d7a7[_0xbce6('0x1a')](_0x503133)['end']();};}function respondWithResult(_0x22c7a4,_0x586b9e){_0x586b9e=_0x586b9e||0xc8;return function(_0x1fd40b){if(_0x1fd40b){return _0x22c7a4[_0xbce6('0x1a')](_0x586b9e)[_0xbce6('0x1b')](_0x1fd40b);}};}function respondWithFilteredResult(_0x15610b,_0x4622db){return function(_0x1ade9c){if(_0x1ade9c){var _0x327739=typeof _0x4622db['offset']==='undefined'&&typeof _0x4622db[_0xbce6('0x1c')]==='undefined';var _0x391476=_0x1ade9c['count'];var _0x4bb91a=_0x327739?0x0:_0x4622db[_0xbce6('0x1d')];var _0x10a75e=_0x327739?_0x1ade9c[_0xbce6('0x1e')]:_0x4622db[_0xbce6('0x1d')]+_0x4622db['limit'];var _0x55648f;if(_0x10a75e>=_0x391476){_0x10a75e=_0x391476;_0x55648f=0xc8;}else{_0x55648f=0xce;}_0x15610b[_0xbce6('0x1a')](_0x55648f);return _0x15610b[_0xbce6('0x1f')](_0xbce6('0x20'),_0x4bb91a+'-'+_0x10a75e+'/'+_0x391476)[_0xbce6('0x1b')](_0x1ade9c);}return null;};}function patchUpdates(_0x20965b){return function(_0x46a8ba){try{jsonpatch[_0xbce6('0x21')](_0x46a8ba,_0x20965b,!![]);}catch(_0x20fb51){return BPromise['reject'](_0x20fb51);}return _0x46a8ba[_0xbce6('0x22')]();};}function saveUpdates(_0x6726b3,_0x23ed0f){return function(_0x9971d){if(_0x9971d){return _0x9971d[_0xbce6('0x23')](_0x6726b3)['then'](function(_0x210da9){return _0x210da9;});}return null;};}function removeEntity(_0x35bc0d,_0x25ab15){return function(_0x35b1c3){if(_0x35b1c3){return _0x35b1c3['destroy']()[_0xbce6('0x24')](function(){_0x35bc0d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2db104,_0x4c02bb){return function(_0x26e5df){if(!_0x26e5df){_0x2db104[_0xbce6('0x25')](0x194);}return _0x26e5df;};}function handleError(_0x530622,_0x1de759){_0x1de759=_0x1de759||0x1f4;return function(_0x3ae154){logger[_0xbce6('0x26')](_0x3ae154[_0xbce6('0x27')]);if(_0x3ae154[_0xbce6('0x28')]){delete _0x3ae154[_0xbce6('0x28')];}_0x530622[_0xbce6('0x1a')](_0x1de759)[_0xbce6('0x29')](_0x3ae154);};}exports['index']=function(_0x4490ea,_0xacec83){var _0x4073ab={},_0xb0d8aa={},_0x3d3757={'count':0x0,'rows':[]};var _0x59d84a=_['map'](db['SquareDetailsReport'][_0xbce6('0x2a')],function(_0x307f86){return{'name':_0x307f86[_0xbce6('0x2b')],'type':_0x307f86['type'][_0xbce6('0x2c')]};});_0xb0d8aa[_0xbce6('0x2d')]=_[_0xbce6('0x2e')](_0x59d84a,'name');_0xb0d8aa[_0xbce6('0x2f')]=_[_0xbce6('0x30')](_0x4490ea[_0xbce6('0x2f')]);_0xb0d8aa[_0xbce6('0x31')]=_[_0xbce6('0x32')](_0xb0d8aa[_0xbce6('0x2d')],_0xb0d8aa[_0xbce6('0x2f')]);_0x4073ab[_0xbce6('0x33')]=_[_0xbce6('0x32')](_0xb0d8aa[_0xbce6('0x2d')],qs[_0xbce6('0x34')](_0x4490ea[_0xbce6('0x2f')][_0xbce6('0x34')]));_0x4073ab[_0xbce6('0x33')]=_0x4073ab[_0xbce6('0x33')]['length']?_0x4073ab[_0xbce6('0x33')]:_0xb0d8aa[_0xbce6('0x2d')];if(!_0x4490ea[_0xbce6('0x2f')][_0xbce6('0x35')](_0xbce6('0x36'))){_0x4073ab[_0xbce6('0x1c')]=qs[_0xbce6('0x1c')](_0x4490ea['query'][_0xbce6('0x1c')]);_0x4073ab[_0xbce6('0x1d')]=qs['offset'](_0x4490ea[_0xbce6('0x2f')][_0xbce6('0x1d')]);}_0x4073ab[_0xbce6('0x37')]=qs[_0xbce6('0x38')](_0x4490ea[_0xbce6('0x2f')]['sort']);_0x4073ab[_0xbce6('0x39')]=qs[_0xbce6('0x31')](_[_0xbce6('0x3a')](_0x4490ea[_0xbce6('0x2f')],_0xb0d8aa[_0xbce6('0x31')]),_0x59d84a);if(_0x4490ea[_0xbce6('0x2f')][_0xbce6('0x3b')]){_0x4073ab['where']=_['merge'](_0x4073ab['where'],{'$or':_['map'](_0x59d84a,function(_0x57dc9c){if(_0x57dc9c[_0xbce6('0x3c')]!=='VIRTUAL'){var _0x4b6df4={};_0x4b6df4[_0x57dc9c[_0xbce6('0x28')]]={'$like':'%'+_0x4490ea[_0xbce6('0x2f')][_0xbce6('0x3b')]+'%'};return _0x4b6df4;}})});}_0x4073ab=_[_0xbce6('0x3d')]({},_0x4073ab,_0x4490ea[_0xbce6('0x3e')]);var _0x21c3c8={'where':_0x4073ab[_0xbce6('0x39')]};return db[_0xbce6('0x3f')][_0xbce6('0x1e')](_0x21c3c8)[_0xbce6('0x24')](function(_0x496479){_0x3d3757['count']=_0x496479;if(_0x4490ea[_0xbce6('0x2f')]['includeAll']){_0x4073ab[_0xbce6('0x40')]=[{'all':!![]}];}return db[_0xbce6('0x3f')][_0xbce6('0x41')](_0x4073ab);})[_0xbce6('0x24')](function(_0x3b3d2f){_0x3d3757[_0xbce6('0x42')]=_0x3b3d2f;return _0x3d3757;})[_0xbce6('0x24')](respondWithFilteredResult(_0xacec83,_0x4073ab))[_0xbce6('0x43')](handleError(_0xacec83,null));};exports[_0xbce6('0x44')]=function(_0x383e02,_0x505eac){var _0x809bc7={'raw':!![],'where':{'id':_0x383e02[_0xbce6('0x45')]['id']}},_0xba97dd={};_0xba97dd['model']=_[_0xbce6('0x30')](db['SquareDetailsReport'][_0xbce6('0x2a')]);_0xba97dd[_0xbce6('0x2f')]=_[_0xbce6('0x30')](_0x383e02['query']);_0xba97dd['filters']=_[_0xbce6('0x32')](_0xba97dd[_0xbce6('0x2d')],_0xba97dd[_0xbce6('0x2f')]);_0x809bc7[_0xbce6('0x33')]=_['intersection'](_0xba97dd[_0xbce6('0x2d')],qs[_0xbce6('0x34')](_0x383e02[_0xbce6('0x2f')][_0xbce6('0x34')]));_0x809bc7[_0xbce6('0x33')]=_0x809bc7['attributes'][_0xbce6('0x46')]?_0x809bc7[_0xbce6('0x33')]:_0xba97dd[_0xbce6('0x2d')];if(_0x383e02['query'][_0xbce6('0x47')]){_0x809bc7[_0xbce6('0x40')]=[{'all':!![]}];}_0x809bc7=_[_0xbce6('0x3d')]({},_0x809bc7,_0x383e02[_0xbce6('0x3e')]);return db[_0xbce6('0x3f')][_0xbce6('0x48')](_0x809bc7)[_0xbce6('0x24')](handleEntityNotFound(_0x505eac,null))['then'](respondWithResult(_0x505eac,null))[_0xbce6('0x43')](handleError(_0x505eac,null));};exports[_0xbce6('0x49')]=function(_0x17f081,_0x307171){return db[_0xbce6('0x3f')][_0xbce6('0x49')](_0x17f081[_0xbce6('0x4a')],{})['then'](respondWithResult(_0x307171,0xc9))[_0xbce6('0x43')](handleError(_0x307171,null));};exports[_0xbce6('0x23')]=function(_0x583922,_0x19b5f2){if(_0x583922[_0xbce6('0x4a')]['id']){delete _0x583922['body']['id'];}return db[_0xbce6('0x3f')][_0xbce6('0x48')]({'where':{'id':_0x583922[_0xbce6('0x45')]['id']}})[_0xbce6('0x24')](handleEntityNotFound(_0x19b5f2,null))[_0xbce6('0x24')](saveUpdates(_0x583922[_0xbce6('0x4a')],null))[_0xbce6('0x24')](respondWithResult(_0x19b5f2,null))[_0xbce6('0x43')](handleError(_0x19b5f2,null));};exports[_0xbce6('0x4b')]=function(_0x15df46,_0x3c1bfb){return db[_0xbce6('0x3f')]['find']({'where':{'id':_0x15df46[_0xbce6('0x45')]['id']}})['then'](handleEntityNotFound(_0x3c1bfb,null))['then'](removeEntity(_0x3c1bfb,null))['catch'](handleError(_0x3c1bfb,null));};exports['describe']=function(_0x210e3f,_0x35020c){return db[_0xbce6('0x3f')][_0xbce6('0x4c')]()[_0xbce6('0x24')](respondWithResult(_0x35020c,null))[_0xbce6('0x43')](handleError(_0x35020c,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index ea731e7..0a2862b 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 _0x96cf=['define','report_square_details','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x1161eb,_0x1d33ea){var _0x5b6184=function(_0x495bb1){while(--_0x495bb1){_0x1161eb['push'](_0x1161eb['shift']());}};_0x5b6184(++_0x1d33ea);}(_0x96cf,0x6a));var _0xf96c=function(_0x1d99b0,_0x218fc8){_0x1d99b0=_0x1d99b0-0x0;var _0xff07fa=_0x96cf[_0x1d99b0];return _0xff07fa;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf96c('0x0'));var BPromise=require(_0xf96c('0x1'));var rp=require(_0xf96c('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf96c('0x3'));var config=require(_0xf96c('0x4'));var attributes=require('./squareReportDetail.attributes');module[_0xf96c('0x5')]=function(_0x17a0b8,_0x4906b7){return _0x17a0b8[_0xf96c('0x6')]('SquareDetailsReport',attributes,{'tableName':_0xf96c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x818f=['rimraf','../../config/environment','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3f8a03,_0x319b9c){var _0x147fb2=function(_0x523c1c){while(--_0x523c1c){_0x3f8a03['push'](_0x3f8a03['shift']());}};_0x147fb2(++_0x319b9c);}(_0x818f,0x149));var _0xf818=function(_0x17784b,_0x575ba5){_0x17784b=_0x17784b-0x0;var _0x5d8fc0=_0x818f[_0x17784b];return _0x5d8fc0;};'use strict';var _=require(_0xf818('0x0'));var util=require(_0xf818('0x1'));var logger=require(_0xf818('0x2'))(_0xf818('0x3'));var moment=require(_0xf818('0x4'));var BPromise=require(_0xf818('0x5'));var rp=require(_0xf818('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf818('0x7'));var config=require(_0xf818('0x8'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x42aeb6,_0x51d372){return _0x42aeb6[_0xf818('0x9')](_0xf818('0xa'),attributes,{'tableName':_0xf818('0xb'),'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 6e8b0c3..d5778fc 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 _0x594d=['then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','create','options','raw','CreateSquareDetailsReport','stringify','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x7bab0,_0x1d95eb){var _0x2508d4=function(_0x3137c9){while(--_0x3137c9){_0x7bab0['push'](_0x7bab0['shift']());}};_0x2508d4(++_0x1d95eb);}(_0x594d,0x92));var _0xd594=function(_0x1d2c32,_0x39976a){_0x1d2c32=_0x1d2c32-0x0;var _0x2d0f4f=_0x594d[_0x1d2c32];return _0x2d0f4f;};'use strict';var _=require(_0xd594('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd594('0x1'));var rs=require(_0xd594('0x2'));var fs=require('fs');var Redis=require(_0xd594('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd594('0x4'));var logger=require(_0xd594('0x5'))(_0xd594('0x6'));var config=require(_0xd594('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd594('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b1c64,_0x446711,_0xeedad0){return new BPromise(function(_0x20325a,_0x20718a){return client[_0xd594('0x9')](_0x3b1c64,_0xeedad0)[_0xd594('0xa')](function(_0xf3043e){logger[_0xd594('0xb')](_0xd594('0xc'),_0x446711,'request\x20sent');logger[_0xd594('0xd')](_0xd594('0xe'),_0x446711,_0xd594('0xf'),JSON['stringify'](_0xf3043e));if(_0xf3043e[_0xd594('0x10')]){if(_0xf3043e[_0xd594('0x10')][_0xd594('0x11')]===0x1f4){logger[_0xd594('0x10')](_0xd594('0xc'),_0x446711,_0xf3043e[_0xd594('0x10')][_0xd594('0x12')]);return _0x20718a(_0xf3043e['error']['message']);}logger[_0xd594('0x10')](_0xd594('0xc'),_0x446711,_0xf3043e['error'][_0xd594('0x12')]);return _0x20325a(_0xf3043e['error'][_0xd594('0x12')]);}else{logger[_0xd594('0xb')](_0xd594('0xc'),_0x446711,'request\x20sent');_0x20325a(_0xf3043e[_0xd594('0x13')]['message']);}})['catch'](function(_0x2a5f17){logger[_0xd594('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x446711,_0x2a5f17);_0x20718a(_0x2a5f17);});});}exports['CreateSquareDetailsReport']=function(_0x232776){var _0x4ea0d5=this;return new Promise(function(_0x54f640,_0x3ae9be){return db['SquareDetailsReport'][_0xd594('0x14')](_0x232776['body'],{'raw':_0x232776[_0xd594('0x15')]?_0x232776['options'][_0xd594('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x3b0fda){logger[_0xd594('0xb')](_0xd594('0x17'),_0x232776);logger[_0xd594('0xd')](_0xd594('0x17'),_0x232776,JSON[_0xd594('0x18')](_0x3b0fda));_0x54f640(_0x3b0fda);})[_0xd594('0x19')](function(_0x2b8495){logger[_0xd594('0x10')](_0xd594('0x17'),_0x2b8495[_0xd594('0x12')],_0x232776);_0x3ae9be(_0x4ea0d5[_0xd594('0x10')](0x1f4,_0x2b8495[_0xd594('0x12')]));});});}; \ No newline at end of file +var _0x373d=['result','catch','body','options','raw','then','CreateSquareDetailsReport','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','info','request\x20sent','debug','stringify','error','code','message','SquareDetailsReport,\x20%s,\x20%s'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x373d,0x1e2));var _0xd373=function(_0x5adf94,_0x23557e){_0x5adf94=_0x5adf94-0x0;var _0x4fdf60=_0x373d[_0x5adf94];return _0x4fdf60;};'use strict';var _=require(_0xd373('0x0'));var util=require('util');var moment=require(_0xd373('0x1'));var BPromise=require(_0xd373('0x2'));var rs=require(_0xd373('0x3'));var fs=require('fs');var Redis=require(_0xd373('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd373('0x5'));var logger=require(_0xd373('0x6'))(_0xd373('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd373('0x8')][_0xd373('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x446be6,_0x4008c5,_0x48d977){return new BPromise(function(_0xe79819,_0x51c074){return client['request'](_0x446be6,_0x48d977)['then'](function(_0x14472a){logger[_0xd373('0xa')]('SquareDetailsReport,\x20%s,\x20%s',_0x4008c5,_0xd373('0xb'));logger[_0xd373('0xc')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x4008c5,'request\x20sent',JSON[_0xd373('0xd')](_0x14472a));if(_0x14472a[_0xd373('0xe')]){if(_0x14472a[_0xd373('0xe')][_0xd373('0xf')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x4008c5,_0x14472a['error'][_0xd373('0x10')]);return _0x51c074(_0x14472a[_0xd373('0xe')]['message']);}logger[_0xd373('0xe')](_0xd373('0x11'),_0x4008c5,_0x14472a[_0xd373('0xe')][_0xd373('0x10')]);return _0xe79819(_0x14472a[_0xd373('0xe')][_0xd373('0x10')]);}else{logger[_0xd373('0xa')](_0xd373('0x11'),_0x4008c5,_0xd373('0xb'));_0xe79819(_0x14472a[_0xd373('0x12')][_0xd373('0x10')]);}})[_0xd373('0x13')](function(_0x1921dd){logger['error'](_0xd373('0x11'),_0x4008c5,_0x1921dd);_0x51c074(_0x1921dd);});});}exports['CreateSquareDetailsReport']=function(_0x460259){var _0x36d47a=this;return new Promise(function(_0x55c5c7,_0x1bbdbd){return db['SquareDetailsReport']['create'](_0x460259[_0xd373('0x14')],{'raw':_0x460259[_0xd373('0x15')]?_0x460259[_0xd373('0x15')][_0xd373('0x16')]===undefined?!![]:![]:!![]})[_0xd373('0x17')](function(_0x181eb2){logger['info'](_0xd373('0x18'),_0x460259);logger[_0xd373('0xc')](_0xd373('0x18'),_0x460259,JSON[_0xd373('0xd')](_0x181eb2));_0x55c5c7(_0x181eb2);})[_0xd373('0x13')](function(_0x3aa1c5){logger['error'](_0xd373('0x18'),_0x3aa1c5[_0xd373('0x10')],_0x460259);_0x1bbdbd(_0x36d47a[_0xd373('0xe')](0x1f4,_0x3aa1c5[_0xd373('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 17446b1..e86eb3c 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 _0x4fb0=['killProcess','exports','../../components/auth/service','./system.controller','isAuthenticated','index','/process/:pid/kill'];(function(_0x29343c,_0x59361b){var _0x167d3d=function(_0x88af44){while(--_0x88af44){_0x29343c['push'](_0x29343c['shift']());}};_0x167d3d(++_0x59361b);}(_0x4fb0,0x121));var _0x04fb=function(_0x1599f1,_0x4f379d){_0x1599f1=_0x1599f1-0x0;var _0x1bf213=_0x4fb0[_0x1599f1];return _0x1bf213;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x04fb('0x0'));var controller=require(_0x04fb('0x1'));router['get']('/',auth[_0x04fb('0x2')](),controller[_0x04fb('0x3')]);router['get'](_0x04fb('0x4'),auth[_0x04fb('0x2')](),controller[_0x04fb('0x5')]);module[_0x04fb('0x6')]=router; \ No newline at end of file +var _0x946b=['index','/process/:pid/kill','killProcess','exports','Router','../../components/auth/service','get','isAuthenticated'];(function(_0x55aa92,_0xdfcdcc){var _0x3553d6=function(_0x59366a){while(--_0x59366a){_0x55aa92['push'](_0x55aa92['shift']());}};_0x3553d6(++_0xdfcdcc);}(_0x946b,0x1d4));var _0xb946=function(_0x2b4af6,_0x256323){_0x2b4af6=_0x2b4af6-0x0;var _0x5a2f51=_0x946b[_0x2b4af6];return _0x5a2f51;};'use strict';var express=require('express');var router=express[_0xb946('0x0')]();var auth=require(_0xb946('0x1'));var controller=require('./system.controller');router[_0xb946('0x2')]('/',auth[_0xb946('0x3')](),controller[_0xb946('0x4')]);router[_0xb946('0x2')](_0xb946('0x5'),auth[_0xb946('0x3')](),controller[_0xb946('0x6')]);module[_0xb946('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index c88d1a8..89fba19 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 _0xbbfb=['error','inspect','name','status','send','index','getAllData','then','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','child_process','exec','../../config/logger','api','util','lodash'];(function(_0x5056d9,_0x1f678c){var _0x166f29=function(_0x4e761c){while(--_0x4e761c){_0x5056d9['push'](_0x5056d9['shift']());}};_0x166f29(++_0x1f678c);}(_0xbbfb,0x66));var _0xbbbf=function(_0x202858,_0x35fcb6){_0x202858=_0x202858-0x0;var _0x11ec38=_0xbbfb[_0x202858];return _0x11ec38;};'use strict';var info=require('systeminformation');var exec=require(_0xbbbf('0x0'))[_0xbbbf('0x1')];var logger=require(_0xbbbf('0x2'))(_0xbbbf('0x3'));var util=require(_0xbbbf('0x4'));var BPromise=require('bluebird');var _=require(_0xbbbf('0x5'));function handleError(_0xc2544f,_0x1e6ae1,_0x4fddac){_0x1e6ae1=_0x1e6ae1||0x1f4;return function(_0x2c4a58){logger[_0xbbbf('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x4fddac,_0x1e6ae1,util[_0xbbbf('0x7')](_0x2c4a58,{'showHidden':![],'depth':null}));delete _0x2c4a58[_0xbbbf('0x8')];_0xc2544f[_0xbbbf('0x9')](_0x1e6ae1)[_0xbbbf('0xa')](_0x2c4a58);};}exports[_0xbbbf('0xb')]=function(_0x1a9369,_0x2ad1a6){return info[_0xbbbf('0xc')]()[_0xbbbf('0xd')](function(_0x2fc902){return _0x2ad1a6[_0xbbbf('0x9')](0xc8)['json'](_0x2fc902);})['catch'](function(_0x5278ba){return _0x2ad1a6['status'](0x1f4)['json'](_0x5278ba);});};exports[_0xbbbf('0xe')]=function(_0x1966fe,_0x55da24){var _0x45e96d=['components/import/cm'];return new BPromise(function(_0x6da440,_0x42a6bb){return exec(util[_0xbbbf('0xf')](_0xbbbf('0x10'),_0x1966fe[_0xbbbf('0x11')][_0xbbbf('0x12')]),function(_0x48c9ed,_0x13cc2b,_0x3a97a0){if(_0x48c9ed){return _0x42a6bb(_0x48c9ed);}return _0x6da440(_0x13cc2b);});})['then'](function(_0x2f7839){var _0x368bfb=![];var _0x2df70c=_0x2f7839[_0xbbbf('0x13')](/\n/);for(var _0x1ae50f=0x0,_0x1b7bb9=_0x45e96d[_0xbbbf('0x14')];_0x1ae50f<_0x1b7bb9,_0x368bfb===![];_0x1ae50f+=0x1){if(_0x2f7839[_0xbbbf('0x15')](_0x45e96d[_0x1ae50f])>=0x0){_0x368bfb=!![];}}if(!_0x368bfb){throw new Error(util[_0xbbbf('0xf')](_0xbbbf('0x16'),_0x1966fe['params'][_0xbbbf('0x12')]));}process[_0xbbbf('0x17')](_0x1966fe[_0xbbbf('0x11')]['pid'],_0xbbbf('0x18'));return _0x55da24[_0xbbbf('0x9')](0xc8)['json']({'message':util[_0xbbbf('0xf')](_0xbbbf('0x19'),_0x1966fe[_0xbbbf('0x11')][_0xbbbf('0x12')])});})[_0xbbbf('0x1a')](handleError(_0x55da24,null,_0xbbbf('0xe')));}; \ No newline at end of file +var _0xb13c=['bluebird','lodash','inspect','name','status','send','index','getAllData','json','catch','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','split','indexOf','format','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','child_process','exec','../../config/logger','api','util'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0xb13c,0x19e));var _0xcb13=function(_0xdd0313,_0x251c2b){_0xdd0313=_0xdd0313-0x0;var _0x2bd7e8=_0xb13c[_0xdd0313];return _0x2bd7e8;};'use strict';var info=require(_0xcb13('0x0'));var exec=require(_0xcb13('0x1'))[_0xcb13('0x2')];var logger=require(_0xcb13('0x3'))(_0xcb13('0x4'));var util=require(_0xcb13('0x5'));var BPromise=require(_0xcb13('0x6'));var _=require(_0xcb13('0x7'));function handleError(_0x5ec924,_0x4fe277,_0x5ef0ea){_0x4fe277=_0x4fe277||0x1f4;return function(_0x5034d1){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x5ef0ea,_0x4fe277,util[_0xcb13('0x8')](_0x5034d1,{'showHidden':![],'depth':null}));delete _0x5034d1[_0xcb13('0x9')];_0x5ec924[_0xcb13('0xa')](_0x4fe277)[_0xcb13('0xb')](_0x5034d1);};}exports[_0xcb13('0xc')]=function(_0x3c3826,_0x1ac6b6){return info[_0xcb13('0xd')]()['then'](function(_0x4628f7){return _0x1ac6b6[_0xcb13('0xa')](0xc8)[_0xcb13('0xe')](_0x4628f7);})[_0xcb13('0xf')](function(_0xb46a6){return _0x1ac6b6[_0xcb13('0xa')](0x1f4)[_0xcb13('0xe')](_0xb46a6);});};exports['killProcess']=function(_0x1c215a,_0x395036){var _0x3d94bf=[_0xcb13('0x10')];return new BPromise(function(_0x3a1f69,_0x28c936){return exec(util['format'](_0xcb13('0x11'),_0x1c215a[_0xcb13('0x12')][_0xcb13('0x13')]),function(_0x4dfa24,_0x4e2a2b,_0x21ea72){if(_0x4dfa24){return _0x28c936(_0x4dfa24);}return _0x3a1f69(_0x4e2a2b);});})[_0xcb13('0x14')](function(_0x239189){var _0xff078f=![];var _0x5c1bae=_0x239189[_0xcb13('0x15')](/\n/);for(var _0x5731b1=0x0,_0x1d83a0=_0x3d94bf['length'];_0x5731b1<_0x1d83a0,_0xff078f===![];_0x5731b1+=0x1){if(_0x239189[_0xcb13('0x16')](_0x3d94bf[_0x5731b1])>=0x0){_0xff078f=!![];}}if(!_0xff078f){throw new Error(util[_0xcb13('0x17')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x1c215a['params'][_0xcb13('0x13')]));}process[_0xcb13('0x18')](_0x1c215a[_0xcb13('0x12')][_0xcb13('0x13')],_0xcb13('0x19'));return _0x395036[_0xcb13('0xa')](0xc8)['json']({'message':util['format'](_0xcb13('0x1a'),_0x1c215a[_0xcb13('0x12')][_0xcb13('0x13')])});})['catch'](handleError(_0x395036,null,_0xcb13('0x1b')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index a370174..12170fa 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 _0xd2ea=['./tag.controller','get','isAuthenticated','/describe','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1c6471,_0x383e24){var _0x14e3b9=function(_0x31f799){while(--_0x31f799){_0x1c6471['push'](_0x1c6471['shift']());}};_0x14e3b9(++_0x383e24);}(_0xd2ea,0x15f));var _0xad2e=function(_0x3d1f29,_0x36e7d5){_0x3d1f29=_0x3d1f29-0x0;var _0x458cb5=_0xd2ea[_0x3d1f29];return _0x458cb5;};'use strict';var multer=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var path=require(_0xad2e('0x2'));var timeout=require(_0xad2e('0x3'));var express=require(_0xad2e('0x4'));var router=express['Router']();var fs_extra=require(_0xad2e('0x5'));var auth=require(_0xad2e('0x6'));var interaction=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var controller=require(_0xad2e('0x9'));router[_0xad2e('0xa')]('/',auth[_0xad2e('0xb')](),controller['index']);router[_0xad2e('0xa')](_0xad2e('0xc'),auth[_0xad2e('0xb')](),controller['describe']);router[_0xad2e('0xa')](_0xad2e('0xd'),auth['isAuthenticated'](),controller[_0xad2e('0xe')]);router['post']('/',auth[_0xad2e('0xb')](),controller[_0xad2e('0xf')]);router[_0xad2e('0x10')](_0xad2e('0xd'),auth['isAuthenticated'](),controller[_0xad2e('0x11')]);router['delete'](_0xad2e('0xd'),auth[_0xad2e('0xb')](),controller[_0xad2e('0x12')]);module[_0xad2e('0x13')]=router; \ No newline at end of file +var _0x70e0=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','isAuthenticated','describe','get','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x85e478,_0xd5204){var _0x37338b=function(_0x1999d8){while(--_0x1999d8){_0x85e478['push'](_0x85e478['shift']());}};_0x37338b(++_0xd5204);}(_0x70e0,0x17b));var _0x070e=function(_0x23c7b6,_0x3dcacf){_0x23c7b6=_0x23c7b6-0x0;var _0xcdd84=_0x70e0[_0x23c7b6];return _0xcdd84;};'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'](),controller['create']);router[_0x070e('0xe')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xf')]);router[_0x070e('0x10')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x11')]);module[_0x070e('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 6323308..e14512a 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 _0x0d74=['STRING','#0091EA','sequelize','exports'];(function(_0x3e1613,_0x4f7e71){var _0x1e969d=function(_0x1dfd2e){while(--_0x1dfd2e){_0x3e1613['push'](_0x3e1613['shift']());}};_0x1e969d(++_0x4f7e71);}(_0x0d74,0x146));var _0x40d7=function(_0x2a4346,_0x3b51fb){_0x2a4346=_0x2a4346-0x0;var _0x13ff78=_0x0d74[_0x2a4346];return _0x13ff78;};'use strict';var Sequelize=require(_0x40d7('0x0'));module[_0x40d7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x40d7('0x2')],'defaultValue':_0x40d7('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9b00=['sequelize','exports','STRING','#0091EA'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x9b00,0xcc));var _0x09b0=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9b00[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x09b0('0x0'));module[_0x09b0('0x1')]={'name':{'type':Sequelize[_0x09b0('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x09b0('0x2')],'defaultValue':_0x09b0('0x3')},'description':{'type':Sequelize[_0x09b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index ba0ae6f..09e0412 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 _0x04d9=['show','params','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','json','apply','reject','save','update','then','destroy','Tags','UserProfileResource','end','error','stack','name','send','index','Tag','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch'];(function(_0x896541,_0x73439f){var _0x30a725=function(_0x1fd479){while(--_0x1fd479){_0x896541['push'](_0x896541['shift']());}};_0x30a725(++_0x73439f);}(_0x04d9,0x105));var _0x904d=function(_0x440955,_0x473e56){_0x440955=_0x440955-0x0;var _0x3a6fb1=_0x04d9[_0x440955];return _0x3a6fb1;};'use strict';var emlformat=require(_0x904d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x904d('0x1'));var rp=require(_0x904d('0x2'));var moment=require(_0x904d('0x3'));var BPromise=require(_0x904d('0x4'));var Mustache=require(_0x904d('0x5'));var util=require(_0x904d('0x6'));var path=require(_0x904d('0x7'));var sox=require(_0x904d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x904d('0x9'));var _=require(_0x904d('0xa'));var squel=require('squel');var crypto=require(_0x904d('0xb'));var jsforce=require(_0x904d('0xc'));var deskjs=require(_0x904d('0xd'));var toCsv=require(_0x904d('0xe'));var querystring=require('querystring');var Papa=require(_0x904d('0xf'));var Redis=require(_0x904d('0x10'));var authService=require(_0x904d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x904d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x904d('0x13'))('api');var utils=require(_0x904d('0x14'));var config=require(_0x904d('0x15'));var licenseUtil=require(_0x904d('0x16'));var db=require(_0x904d('0x17'))['db'];function respondWithStatusCode(_0xb3a2fb,_0x3e9792){_0x3e9792=_0x3e9792||0xcc;return function(_0x25b122){if(_0x25b122){return _0xb3a2fb[_0x904d('0x18')](_0x3e9792);}return _0xb3a2fb[_0x904d('0x19')](_0x3e9792)['end']();};}function respondWithResult(_0x4ad2bf,_0x534091){_0x534091=_0x534091||0xc8;return function(_0x4d54c8){if(_0x4d54c8){return _0x4ad2bf[_0x904d('0x19')](_0x534091)['json'](_0x4d54c8);}};}function respondWithFilteredResult(_0x322d17,_0x1a16e6){return function(_0x3b50dd){if(_0x3b50dd){var _0x4bcfc2=typeof _0x1a16e6[_0x904d('0x1a')]===_0x904d('0x1b')&&typeof _0x1a16e6['limit']===_0x904d('0x1b');var _0x9b96b9=_0x3b50dd[_0x904d('0x1c')];var _0x3aa58f=_0x4bcfc2?0x0:_0x1a16e6[_0x904d('0x1a')];var _0x2054c3=_0x4bcfc2?_0x3b50dd[_0x904d('0x1c')]:_0x1a16e6[_0x904d('0x1a')]+_0x1a16e6[_0x904d('0x1d')];var _0x28d26a;if(_0x2054c3>=_0x9b96b9){_0x2054c3=_0x9b96b9;_0x28d26a=0xc8;}else{_0x28d26a=0xce;}_0x322d17[_0x904d('0x19')](_0x28d26a);return _0x322d17['set']('Content-Range',_0x3aa58f+'-'+_0x2054c3+'/'+_0x9b96b9)[_0x904d('0x1e')](_0x3b50dd);}return null;};}function patchUpdates(_0x593bcb){return function(_0x534585){try{jsonpatch[_0x904d('0x1f')](_0x534585,_0x593bcb,!![]);}catch(_0x131b6b){return BPromise[_0x904d('0x20')](_0x131b6b);}return _0x534585[_0x904d('0x21')]();};}function saveUpdates(_0x265cfa,_0x395709){return function(_0xc31bc9){if(_0xc31bc9){return _0xc31bc9[_0x904d('0x22')](_0x265cfa)[_0x904d('0x23')](function(_0xf4ed36){return _0xf4ed36;});}return null;};}function removeEntity(_0x7ac02a,_0x385ef8){return function(_0x355979){if(_0x355979){return _0x355979[_0x904d('0x24')]()[_0x904d('0x23')](function(){var _0x1a94eb=_0x355979['get']({'plain':!![]});var _0x4cf259=_0x904d('0x25');return db[_0x904d('0x26')][_0x904d('0x24')]({'where':{'type':_0x4cf259,'resourceId':_0x1a94eb['id']}})[_0x904d('0x23')](function(){return _0x355979;});})[_0x904d('0x23')](function(){_0x7ac02a[_0x904d('0x19')](0xcc)[_0x904d('0x27')]();});}};}function handleEntityNotFound(_0x12f463,_0x23a107){return function(_0x508350){if(!_0x508350){_0x12f463[_0x904d('0x18')](0x194);}return _0x508350;};}function handleError(_0x4e3dd8,_0x47ae03){_0x47ae03=_0x47ae03||0x1f4;return function(_0x1cd3b5){logger[_0x904d('0x28')](_0x1cd3b5[_0x904d('0x29')]);if(_0x1cd3b5[_0x904d('0x2a')]){delete _0x1cd3b5['name'];}_0x4e3dd8[_0x904d('0x19')](_0x47ae03)[_0x904d('0x2b')](_0x1cd3b5);};}exports[_0x904d('0x2c')]=function(_0x200b30,_0x1d6a84){var _0x324993={},_0x635cef={},_0x2ef0dd={'count':0x0,'rows':[]};var _0x2d4107=_['map'](db[_0x904d('0x2d')][_0x904d('0x2e')],function(_0x12c378){return{'name':_0x12c378[_0x904d('0x2f')],'type':_0x12c378[_0x904d('0x30')][_0x904d('0x31')]};});_0x635cef['model']=_[_0x904d('0x32')](_0x2d4107,'name');_0x635cef['query']=_[_0x904d('0x33')](_0x200b30[_0x904d('0x34')]);_0x635cef[_0x904d('0x35')]=_['intersection'](_0x635cef['model'],_0x635cef[_0x904d('0x34')]);_0x324993['attributes']=_[_0x904d('0x36')](_0x635cef[_0x904d('0x37')],qs[_0x904d('0x38')](_0x200b30[_0x904d('0x34')][_0x904d('0x38')]));_0x324993[_0x904d('0x39')]=_0x324993[_0x904d('0x39')][_0x904d('0x3a')]?_0x324993[_0x904d('0x39')]:_0x635cef['model'];if(!_0x200b30[_0x904d('0x34')]['hasOwnProperty'](_0x904d('0x3b'))){_0x324993[_0x904d('0x1d')]=qs['limit'](_0x200b30[_0x904d('0x34')][_0x904d('0x1d')]);_0x324993[_0x904d('0x1a')]=qs['offset'](_0x200b30[_0x904d('0x34')][_0x904d('0x1a')]);}_0x324993[_0x904d('0x3c')]=qs[_0x904d('0x3d')](_0x200b30[_0x904d('0x34')][_0x904d('0x3d')]);_0x324993[_0x904d('0x3e')]=qs['filters'](_['pick'](_0x200b30[_0x904d('0x34')],_0x635cef[_0x904d('0x35')]),_0x2d4107);if(_0x200b30[_0x904d('0x34')][_0x904d('0x3f')]){_0x324993[_0x904d('0x3e')]=_[_0x904d('0x40')](_0x324993[_0x904d('0x3e')],{'$or':_[_0x904d('0x32')](_0x2d4107,function(_0x4446fa){if(_0x4446fa[_0x904d('0x30')]!==_0x904d('0x41')){var _0x87ca7e={};_0x87ca7e[_0x4446fa[_0x904d('0x2a')]]={'$like':'%'+_0x200b30[_0x904d('0x34')][_0x904d('0x3f')]+'%'};return _0x87ca7e;}})});}_0x324993=_['merge']({},_0x324993,_0x200b30['options']);var _0x4dfe90={'where':_0x324993[_0x904d('0x3e')]};return db[_0x904d('0x2d')][_0x904d('0x1c')](_0x4dfe90)[_0x904d('0x23')](function(_0x140939){_0x2ef0dd[_0x904d('0x1c')]=_0x140939;if(_0x200b30[_0x904d('0x34')][_0x904d('0x42')]){_0x324993[_0x904d('0x43')]=[{'all':!![]}];}return db[_0x904d('0x2d')][_0x904d('0x44')](_0x324993);})[_0x904d('0x23')](function(_0x26e557){_0x2ef0dd[_0x904d('0x45')]=_0x26e557;return _0x2ef0dd;})[_0x904d('0x23')](respondWithFilteredResult(_0x1d6a84,_0x324993))[_0x904d('0x46')](handleError(_0x1d6a84,null));};exports[_0x904d('0x47')]=function(_0x219777,_0x10de26){var _0x2865bf={'raw':!![],'where':{'id':_0x219777[_0x904d('0x48')]['id']}},_0x42e220={};_0x42e220['model']=_[_0x904d('0x33')](db['Tag'][_0x904d('0x2e')]);_0x42e220[_0x904d('0x34')]=_[_0x904d('0x33')](_0x219777['query']);_0x42e220[_0x904d('0x35')]=_[_0x904d('0x36')](_0x42e220[_0x904d('0x37')],_0x42e220['query']);_0x2865bf[_0x904d('0x39')]=_[_0x904d('0x36')](_0x42e220[_0x904d('0x37')],qs['fields'](_0x219777[_0x904d('0x34')][_0x904d('0x38')]));_0x2865bf[_0x904d('0x39')]=_0x2865bf[_0x904d('0x39')][_0x904d('0x3a')]?_0x2865bf[_0x904d('0x39')]:_0x42e220[_0x904d('0x37')];if(_0x219777[_0x904d('0x34')][_0x904d('0x42')]){_0x2865bf['include']=[{'all':!![]}];}_0x2865bf=_[_0x904d('0x40')]({},_0x2865bf,_0x219777[_0x904d('0x49')]);return db[_0x904d('0x2d')]['find'](_0x2865bf)[_0x904d('0x23')](handleEntityNotFound(_0x10de26,null))['then'](respondWithResult(_0x10de26,null))[_0x904d('0x46')](handleError(_0x10de26,null));};exports[_0x904d('0x4a')]=function(_0x4c63d1,_0x55365e){return db[_0x904d('0x2d')][_0x904d('0x4a')](_0x4c63d1[_0x904d('0x4b')],{})[_0x904d('0x23')](function(_0x1b5fe5){var _0x2b298d=_0x4c63d1[_0x904d('0x4c')][_0x904d('0x4d')]({'plain':!![]});if(!_0x2b298d)throw new Error(_0x904d('0x4e'));if(_0x2b298d['role']===_0x904d('0x4c')){var _0x5ecc23=_0x1b5fe5['get']({'plain':!![]});var _0x1d7ff5=_0x904d('0x25');return db[_0x904d('0x4f')][_0x904d('0x50')]({'where':{'name':_0x1d7ff5,'userProfileId':_0x2b298d[_0x904d('0x51')]},'raw':!![]})[_0x904d('0x23')](function(_0x3fa113){if(_0x3fa113&&_0x3fa113['autoAssociation']===0x0){return db[_0x904d('0x26')][_0x904d('0x4a')]({'name':_0x5ecc23[_0x904d('0x2a')],'resourceId':_0x5ecc23['id'],'type':_0x3fa113[_0x904d('0x2a')],'sectionId':_0x3fa113['id']},{})[_0x904d('0x23')](function(){return _0x1b5fe5;});}else{return _0x1b5fe5;}})[_0x904d('0x46')](function(_0x19be4e){logger[_0x904d('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19be4e);throw _0x19be4e;});}return _0x1b5fe5;})[_0x904d('0x23')](respondWithResult(_0x55365e,0xc9))[_0x904d('0x46')](handleError(_0x55365e,null));};exports['update']=function(_0x136733,_0x44f3af){if(_0x136733[_0x904d('0x4b')]['id']){delete _0x136733[_0x904d('0x4b')]['id'];}return db['Tag'][_0x904d('0x50')]({'where':{'id':_0x136733[_0x904d('0x48')]['id']}})[_0x904d('0x23')](handleEntityNotFound(_0x44f3af,null))[_0x904d('0x23')](saveUpdates(_0x136733[_0x904d('0x4b')],null))['then'](respondWithResult(_0x44f3af,null))[_0x904d('0x46')](handleError(_0x44f3af,null));};exports[_0x904d('0x24')]=function(_0x2441bf,_0x5b6cf3){return db[_0x904d('0x2d')][_0x904d('0x50')]({'where':{'id':_0x2441bf[_0x904d('0x48')]['id']}})[_0x904d('0x23')](handleEntityNotFound(_0x5b6cf3,null))[_0x904d('0x23')](removeEntity(_0x5b6cf3,null))['catch'](handleError(_0x5b6cf3,null));};exports[_0x904d('0x52')]=function(_0xa575db,_0x176349){return db[_0x904d('0x2d')][_0x904d('0x52')]()[_0x904d('0x23')](respondWithResult(_0x176349,null))['catch'](handleError(_0x176349,null));}; \ No newline at end of file +var _0x7f43=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','Tags','UserProfileResource','error','name','send','index','map','Tag','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','ejs'];(function(_0xa042af,_0x575e96){var _0x550730=function(_0x4fe4ff){while(--_0x4fe4ff){_0xa042af['push'](_0xa042af['shift']());}};_0x550730(++_0x575e96);}(_0x7f43,0x1a0));var _0x37f4=function(_0x1237c9,_0x588fc8){_0x1237c9=_0x1237c9-0x0;var _0x5d1f29=_0x7f43[_0x1237c9];return _0x5d1f29;};'use strict';var emlformat=require(_0x37f4('0x0'));var rimraf=require(_0x37f4('0x1'));var zipdir=require(_0x37f4('0x2'));var jsonpatch=require(_0x37f4('0x3'));var rp=require('request-promise');var moment=require(_0x37f4('0x4'));var BPromise=require(_0x37f4('0x5'));var Mustache=require('mustache');var util=require(_0x37f4('0x6'));var path=require('path');var sox=require(_0x37f4('0x7'));var csv=require('to-csv');var ejs=require(_0x37f4('0x8'));var fs=require('fs');var fs_extra=require(_0x37f4('0x9'));var _=require(_0x37f4('0xa'));var squel=require(_0x37f4('0xb'));var crypto=require(_0x37f4('0xc'));var jsforce=require(_0x37f4('0xd'));var deskjs=require(_0x37f4('0xe'));var toCsv=require(_0x37f4('0xf'));var querystring=require('querystring');var Papa=require(_0x37f4('0x10'));var Redis=require(_0x37f4('0x11'));var authService=require(_0x37f4('0x12'));var qs=require(_0x37f4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x37f4('0x14'));var utils=require(_0x37f4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x37f4('0x16'));var db=require(_0x37f4('0x17'))['db'];function respondWithStatusCode(_0x212f8b,_0xb33f8a){_0xb33f8a=_0xb33f8a||0xcc;return function(_0x1c99d3){if(_0x1c99d3){return _0x212f8b[_0x37f4('0x18')](_0xb33f8a);}return _0x212f8b['status'](_0xb33f8a)[_0x37f4('0x19')]();};}function respondWithResult(_0x28af8f,_0x235d19){_0x235d19=_0x235d19||0xc8;return function(_0x39e927){if(_0x39e927){return _0x28af8f[_0x37f4('0x1a')](_0x235d19)[_0x37f4('0x1b')](_0x39e927);}};}function respondWithFilteredResult(_0x54a906,_0x5a8c27){return function(_0x22b0cd){if(_0x22b0cd){var _0x2c9686=typeof _0x5a8c27['offset']===_0x37f4('0x1c')&&typeof _0x5a8c27[_0x37f4('0x1d')]==='undefined';var _0x3ba993=_0x22b0cd[_0x37f4('0x1e')];var _0x3b5bbd=_0x2c9686?0x0:_0x5a8c27[_0x37f4('0x1f')];var _0x100742=_0x2c9686?_0x22b0cd[_0x37f4('0x1e')]:_0x5a8c27['offset']+_0x5a8c27['limit'];var _0x2ecf86;if(_0x100742>=_0x3ba993){_0x100742=_0x3ba993;_0x2ecf86=0xc8;}else{_0x2ecf86=0xce;}_0x54a906['status'](_0x2ecf86);return _0x54a906[_0x37f4('0x20')](_0x37f4('0x21'),_0x3b5bbd+'-'+_0x100742+'/'+_0x3ba993)['json'](_0x22b0cd);}return null;};}function patchUpdates(_0x5a1c59){return function(_0x217874){try{jsonpatch[_0x37f4('0x22')](_0x217874,_0x5a1c59,!![]);}catch(_0x3d6e27){return BPromise[_0x37f4('0x23')](_0x3d6e27);}return _0x217874[_0x37f4('0x24')]();};}function saveUpdates(_0x23756a,_0x5d5ba9){return function(_0x159e96){if(_0x159e96){return _0x159e96[_0x37f4('0x25')](_0x23756a)['then'](function(_0xaa160d){return _0xaa160d;});}return null;};}function removeEntity(_0x1b9740,_0x75c9ae){return function(_0x43934c){if(_0x43934c){return _0x43934c[_0x37f4('0x26')]()[_0x37f4('0x27')](function(){var _0x421461=_0x43934c['get']({'plain':!![]});var _0x3be377=_0x37f4('0x28');return db[_0x37f4('0x29')][_0x37f4('0x26')]({'where':{'type':_0x3be377,'resourceId':_0x421461['id']}})[_0x37f4('0x27')](function(){return _0x43934c;});})[_0x37f4('0x27')](function(){_0x1b9740[_0x37f4('0x1a')](0xcc)[_0x37f4('0x19')]();});}};}function handleEntityNotFound(_0x181ff7,_0x2cfa60){return function(_0x418df9){if(!_0x418df9){_0x181ff7[_0x37f4('0x18')](0x194);}return _0x418df9;};}function handleError(_0x232365,_0x3eb0d9){_0x3eb0d9=_0x3eb0d9||0x1f4;return function(_0x3d039e){logger[_0x37f4('0x2a')](_0x3d039e['stack']);if(_0x3d039e[_0x37f4('0x2b')]){delete _0x3d039e[_0x37f4('0x2b')];}_0x232365[_0x37f4('0x1a')](_0x3eb0d9)[_0x37f4('0x2c')](_0x3d039e);};}exports[_0x37f4('0x2d')]=function(_0x1f21fd,_0x13df58){var _0x5a9179={},_0x593c2a={},_0x150a4d={'count':0x0,'rows':[]};var _0x30253f=_[_0x37f4('0x2e')](db[_0x37f4('0x2f')][_0x37f4('0x30')],function(_0x49a85c){return{'name':_0x49a85c['fieldName'],'type':_0x49a85c[_0x37f4('0x31')][_0x37f4('0x32')]};});_0x593c2a[_0x37f4('0x33')]=_['map'](_0x30253f,_0x37f4('0x2b'));_0x593c2a[_0x37f4('0x34')]=_[_0x37f4('0x35')](_0x1f21fd[_0x37f4('0x34')]);_0x593c2a['filters']=_[_0x37f4('0x36')](_0x593c2a[_0x37f4('0x33')],_0x593c2a[_0x37f4('0x34')]);_0x5a9179[_0x37f4('0x37')]=_['intersection'](_0x593c2a['model'],qs[_0x37f4('0x38')](_0x1f21fd[_0x37f4('0x34')][_0x37f4('0x38')]));_0x5a9179[_0x37f4('0x37')]=_0x5a9179['attributes']['length']?_0x5a9179['attributes']:_0x593c2a['model'];if(!_0x1f21fd[_0x37f4('0x34')][_0x37f4('0x39')](_0x37f4('0x3a'))){_0x5a9179[_0x37f4('0x1d')]=qs[_0x37f4('0x1d')](_0x1f21fd[_0x37f4('0x34')][_0x37f4('0x1d')]);_0x5a9179[_0x37f4('0x1f')]=qs[_0x37f4('0x1f')](_0x1f21fd[_0x37f4('0x34')][_0x37f4('0x1f')]);}_0x5a9179[_0x37f4('0x3b')]=qs[_0x37f4('0x3c')](_0x1f21fd[_0x37f4('0x34')][_0x37f4('0x3c')]);_0x5a9179[_0x37f4('0x3d')]=qs[_0x37f4('0x3e')](_['pick'](_0x1f21fd[_0x37f4('0x34')],_0x593c2a['filters']),_0x30253f);if(_0x1f21fd[_0x37f4('0x34')]['filter']){_0x5a9179['where']=_[_0x37f4('0x3f')](_0x5a9179[_0x37f4('0x3d')],{'$or':_[_0x37f4('0x2e')](_0x30253f,function(_0x4d1bfd){if(_0x4d1bfd[_0x37f4('0x31')]!==_0x37f4('0x40')){var _0x10d164={};_0x10d164[_0x4d1bfd[_0x37f4('0x2b')]]={'$like':'%'+_0x1f21fd[_0x37f4('0x34')][_0x37f4('0x41')]+'%'};return _0x10d164;}})});}_0x5a9179=_[_0x37f4('0x3f')]({},_0x5a9179,_0x1f21fd[_0x37f4('0x42')]);var _0x128127={'where':_0x5a9179[_0x37f4('0x3d')]};return db[_0x37f4('0x2f')][_0x37f4('0x1e')](_0x128127)[_0x37f4('0x27')](function(_0x450e8f){_0x150a4d[_0x37f4('0x1e')]=_0x450e8f;if(_0x1f21fd[_0x37f4('0x34')][_0x37f4('0x43')]){_0x5a9179[_0x37f4('0x44')]=[{'all':!![]}];}return db['Tag'][_0x37f4('0x45')](_0x5a9179);})[_0x37f4('0x27')](function(_0x59f255){_0x150a4d['rows']=_0x59f255;return _0x150a4d;})[_0x37f4('0x27')](respondWithFilteredResult(_0x13df58,_0x5a9179))[_0x37f4('0x46')](handleError(_0x13df58,null));};exports[_0x37f4('0x47')]=function(_0x477376,_0x241d4f){var _0x251db2={'raw':!![],'where':{'id':_0x477376[_0x37f4('0x48')]['id']}},_0x46bc4c={};_0x46bc4c[_0x37f4('0x33')]=_[_0x37f4('0x35')](db[_0x37f4('0x2f')][_0x37f4('0x30')]);_0x46bc4c[_0x37f4('0x34')]=_[_0x37f4('0x35')](_0x477376[_0x37f4('0x34')]);_0x46bc4c['filters']=_[_0x37f4('0x36')](_0x46bc4c[_0x37f4('0x33')],_0x46bc4c[_0x37f4('0x34')]);_0x251db2['attributes']=_[_0x37f4('0x36')](_0x46bc4c[_0x37f4('0x33')],qs[_0x37f4('0x38')](_0x477376['query'][_0x37f4('0x38')]));_0x251db2[_0x37f4('0x37')]=_0x251db2[_0x37f4('0x37')][_0x37f4('0x49')]?_0x251db2['attributes']:_0x46bc4c[_0x37f4('0x33')];if(_0x477376['query']['includeAll']){_0x251db2[_0x37f4('0x44')]=[{'all':!![]}];}_0x251db2=_['merge']({},_0x251db2,_0x477376[_0x37f4('0x42')]);return db['Tag'][_0x37f4('0x4a')](_0x251db2)[_0x37f4('0x27')](handleEntityNotFound(_0x241d4f,null))['then'](respondWithResult(_0x241d4f,null))[_0x37f4('0x46')](handleError(_0x241d4f,null));};exports[_0x37f4('0x4b')]=function(_0x34e5dd,_0xda9272){return db[_0x37f4('0x2f')][_0x37f4('0x4b')](_0x34e5dd[_0x37f4('0x4c')],{})[_0x37f4('0x27')](function(_0x5bc0a7){var _0x2c7cd0=_0x34e5dd[_0x37f4('0x4d')][_0x37f4('0x4e')]({'plain':!![]});if(!_0x2c7cd0)throw new Error(_0x37f4('0x4f'));if(_0x2c7cd0[_0x37f4('0x50')]===_0x37f4('0x4d')){var _0x8b7d2c=_0x5bc0a7[_0x37f4('0x4e')]({'plain':!![]});var _0x1ef6f2=_0x37f4('0x28');return db['UserProfileSection'][_0x37f4('0x4a')]({'where':{'name':_0x1ef6f2,'userProfileId':_0x2c7cd0[_0x37f4('0x51')]},'raw':!![]})[_0x37f4('0x27')](function(_0x5189ac){if(_0x5189ac&&_0x5189ac[_0x37f4('0x52')]===0x0){return db['UserProfileResource'][_0x37f4('0x4b')]({'name':_0x8b7d2c[_0x37f4('0x2b')],'resourceId':_0x8b7d2c['id'],'type':_0x5189ac[_0x37f4('0x2b')],'sectionId':_0x5189ac['id']},{})[_0x37f4('0x27')](function(){return _0x5bc0a7;});}else{return _0x5bc0a7;}})[_0x37f4('0x46')](function(_0x37b111){logger[_0x37f4('0x2a')](_0x37f4('0x53'),_0x37b111);throw _0x37b111;});}return _0x5bc0a7;})[_0x37f4('0x27')](respondWithResult(_0xda9272,0xc9))['catch'](handleError(_0xda9272,null));};exports[_0x37f4('0x25')]=function(_0x6825fd,_0xe4f0a){if(_0x6825fd[_0x37f4('0x4c')]['id']){delete _0x6825fd[_0x37f4('0x4c')]['id'];}return db[_0x37f4('0x2f')][_0x37f4('0x4a')]({'where':{'id':_0x6825fd[_0x37f4('0x48')]['id']}})[_0x37f4('0x27')](handleEntityNotFound(_0xe4f0a,null))[_0x37f4('0x27')](saveUpdates(_0x6825fd[_0x37f4('0x4c')],null))[_0x37f4('0x27')](respondWithResult(_0xe4f0a,null))[_0x37f4('0x46')](handleError(_0xe4f0a,null));};exports[_0x37f4('0x26')]=function(_0x26775c,_0x3cda46){return db['Tag'][_0x37f4('0x4a')]({'where':{'id':_0x26775c['params']['id']}})[_0x37f4('0x27')](handleEntityNotFound(_0x3cda46,null))['then'](removeEntity(_0x3cda46,null))['catch'](handleError(_0x3cda46,null));};exports[_0x37f4('0x54')]=function(_0x36f84a,_0x3fdb48){return db['Tag'][_0x37f4('0x54')]()['then'](respondWithResult(_0x3fdb48,null))[_0x37f4('0x46')](handleError(_0x3fdb48,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index d7253a9..7092127 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 _0xaff1=['request-promise','path','rimraf','../../config/environment','./tag.attributes','define','tools_tags','util','api','moment'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xaff1,0x1d3));var _0x1aff=function(_0x4da5ff,_0x146876){_0x4da5ff=_0x4da5ff-0x0;var _0x2e1ad5=_0xaff1[_0x4da5ff];return _0x2e1ad5;};'use strict';var _=require('lodash');var util=require(_0x1aff('0x0'));var logger=require('../../config/logger')(_0x1aff('0x1'));var moment=require(_0x1aff('0x2'));var BPromise=require('bluebird');var rp=require(_0x1aff('0x3'));var fs=require('fs');var path=require(_0x1aff('0x4'));var rimraf=require(_0x1aff('0x5'));var config=require(_0x1aff('0x6'));var attributes=require(_0x1aff('0x7'));module['exports']=function(_0x16a474,_0x191b69){return _0x16a474[_0x1aff('0x8')]('Tag',attributes,{'tableName':_0x1aff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5900=['Tag','tools_tags','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','exports'];(function(_0x39853d,_0x2501bf){var _0x5864ca=function(_0xbc99d5){while(--_0xbc99d5){_0x39853d['push'](_0x39853d['shift']());}};_0x5864ca(++_0x2501bf);}(_0x5900,0x122));var _0x0590=function(_0x1103c4,_0x562d1d){_0x1103c4=_0x1103c4-0x0;var _0x1c19ab=_0x5900[_0x1103c4];return _0x1c19ab;};'use strict';var _=require(_0x0590('0x0'));var util=require(_0x0590('0x1'));var logger=require(_0x0590('0x2'))(_0x0590('0x3'));var moment=require('moment');var BPromise=require(_0x0590('0x4'));var rp=require(_0x0590('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0590('0x6'));var config=require(_0x0590('0x7'));var attributes=require(_0x0590('0x8'));module[_0x0590('0x9')]=function(_0x1334fa,_0x299b40){return _0x1334fa['define'](_0x0590('0xa'),attributes,{'tableName':_0x0590('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 3bb5112..2b82516 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 _0x0c02=['Tag,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2963b0,_0x45456b){var _0x3fd0f5=function(_0x34d8a8){while(--_0x34d8a8){_0x2963b0['push'](_0x2963b0['shift']());}};_0x3fd0f5(++_0x45456b);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x20c0('0x0'));var moment=require(_0x20c0('0x1'));var BPromise=require('bluebird');var rs=require(_0x20c0('0x2'));var fs=require('fs');var Redis=require(_0x20c0('0x3'));var db=require(_0x20c0('0x4'))['db'];var utils=require(_0x20c0('0x5'));var logger=require(_0x20c0('0x6'))(_0x20c0('0x7'));var config=require(_0x20c0('0x8'));var jayson=require(_0x20c0('0x9'));var client=jayson[_0x20c0('0xa')][_0x20c0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d6408,_0x4e1dac,_0x5da127){return new BPromise(function(_0x4db532,_0x1e35e2){return client[_0x20c0('0xc')](_0x5d6408,_0x5da127)[_0x20c0('0xd')](function(_0x41a4af){logger[_0x20c0('0xe')](_0x20c0('0xf'),_0x4e1dac,'request\x20sent');logger['debug']('Tag,\x20%s,\x20%s,\x20%s',_0x4e1dac,'request\x20sent',JSON['stringify'](_0x41a4af));if(_0x41a4af[_0x20c0('0x10')]){if(_0x41a4af[_0x20c0('0x10')][_0x20c0('0x11')]===0x1f4){logger[_0x20c0('0x10')]('Tag,\x20%s,\x20%s',_0x4e1dac,_0x41a4af[_0x20c0('0x10')]['message']);return _0x1e35e2(_0x41a4af['error'][_0x20c0('0x12')]);}logger[_0x20c0('0x10')](_0x20c0('0xf'),_0x4e1dac,_0x41a4af[_0x20c0('0x10')][_0x20c0('0x12')]);return _0x4db532(_0x41a4af[_0x20c0('0x10')][_0x20c0('0x12')]);}else{logger[_0x20c0('0xe')](_0x20c0('0xf'),_0x4e1dac,'request\x20sent');_0x4db532(_0x41a4af[_0x20c0('0x13')][_0x20c0('0x12')]);}})[_0x20c0('0x14')](function(_0x46b9e5){logger[_0x20c0('0x10')](_0x20c0('0xf'),_0x4e1dac,_0x46b9e5);_0x1e35e2(_0x46b9e5);});});} \ No newline at end of file +var _0xb821=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','ioredis'];(function(_0x58d3a5,_0x2c1b61){var _0x278711=function(_0x283915){while(--_0x283915){_0x58d3a5['push'](_0x58d3a5['shift']());}};_0x278711(++_0x2c1b61);}(_0xb821,0xa7));var _0x1b82=function(_0x489d5e,_0x2a38ff){_0x489d5e=_0x489d5e-0x0;var _0x5e0489=_0xb821[_0x489d5e];return _0x5e0489;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x192434,_0x202a5f,_0x3632dd){return new BPromise(function(_0x18f45f,_0x7b87e8){return client[_0x1b82('0x8')](_0x192434,_0x3632dd)[_0x1b82('0x9')](function(_0x141673){logger['info'](_0x1b82('0xa'),_0x202a5f,_0x1b82('0xb'));logger[_0x1b82('0xc')](_0x1b82('0xd'),_0x202a5f,_0x1b82('0xb'),JSON[_0x1b82('0xe')](_0x141673));if(_0x141673[_0x1b82('0xf')]){if(_0x141673[_0x1b82('0xf')]['code']===0x1f4){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);return _0x7b87e8(_0x141673['error'][_0x1b82('0x10')]);}logger['error']('Tag,\x20%s,\x20%s',_0x202a5f,_0x141673[_0x1b82('0xf')]['message']);return _0x18f45f(_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);}else{logger['info'](_0x1b82('0xa'),_0x202a5f,'request\x20sent');_0x18f45f(_0x141673['result'][_0x1b82('0x10')]);}})['catch'](function(_0x111247){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x111247);_0x7b87e8(_0x111247);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index f0ec766..90c7440 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 0929373..cf2f2be 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','sequelize','STRING'];(function(_0x1ec8e5,_0x49d790){var _0x26cbbb=function(_0x4895f6){while(--_0x4895f6){_0x1ec8e5['push'](_0x1ec8e5['shift']());}};_0x26cbbb(++_0x49d790);}(_0xb10b,0x12a));var _0xbb10=function(_0x1af482,_0x1af5b7){_0x1af482=_0x1af482-0x0;var _0x7e7580=_0xb10b[_0x1af482];return _0x7e7580;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index e9b6898..11714f0 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 _0x8a52=['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','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','reject','save','update','then','error','send','index','Team','rawAttributes','fieldName','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','rows','catch','show','params','includeAll','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','UserId','Sequelize','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','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserFaxQueue','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','findOne','channel','Unknown\x20channel','capitalize','toLowerCase','pick','isValidChannel','ValidationError','Queues','ids','remove','addAgents','isArray','Voice','Mail','Sms','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','User','Queue','findOrCreate','emit','Queue:save','findAll','voicePause','upsert','interface','format','SIP/%s','all','removeAgents','Chat','Fax','Openchannel','transaction','UserVoiceQueueRt','getAgents','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x32341b,_0x54e01f){var _0x258ce6=function(_0x2bd19a){while(--_0x2bd19a){_0x32341b['push'](_0x32341b['shift']());}};_0x258ce6(++_0x54e01f);}(_0x8a52,0x126));var _0x28a5=function(_0x28bf79,_0xcde4cb){_0x28bf79=_0x28bf79-0x0;var _0xda2c6f=_0x8a52[_0x28bf79];return _0xda2c6f;};'use strict';var emlformat=require(_0x28a5('0x0'));var rimraf=require(_0x28a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x28a5('0x2'));var rp=require(_0x28a5('0x3'));var moment=require(_0x28a5('0x4'));var BPromise=require(_0x28a5('0x5'));var Mustache=require(_0x28a5('0x6'));var util=require(_0x28a5('0x7'));var path=require(_0x28a5('0x8'));var sox=require(_0x28a5('0x9'));var csv=require(_0x28a5('0xa'));var ejs=require(_0x28a5('0xb'));var fs=require('fs');var fs_extra=require(_0x28a5('0xc'));var _=require(_0x28a5('0xd'));var squel=require(_0x28a5('0xe'));var crypto=require(_0x28a5('0xf'));var jsforce=require(_0x28a5('0x10'));var deskjs=require(_0x28a5('0x11'));var toCsv=require(_0x28a5('0xa'));var querystring=require(_0x28a5('0x12'));var Papa=require(_0x28a5('0x13'));var Redis=require(_0x28a5('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x28a5('0x15'));var as=require(_0x28a5('0x16'));var hardwareService=require(_0x28a5('0x17'));var logger=require('../../config/logger')(_0x28a5('0x18'));var utils=require(_0x28a5('0x19'));var config=require(_0x28a5('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x28a5('0x1b'))['db'];config[_0x28a5('0x1c')]=_[_0x28a5('0x1d')](config[_0x28a5('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x28a5('0x1e'))(new Redis(config[_0x28a5('0x1c')]));require(_0x28a5('0x1f'))[_0x28a5('0x20')](socket);function respondWithStatusCode(_0x4f8f80,_0x1bac07){_0x1bac07=_0x1bac07||0xcc;return function(_0x508469){if(_0x508469){return _0x4f8f80[_0x28a5('0x21')](_0x1bac07);}return _0x4f8f80['status'](_0x1bac07)[_0x28a5('0x22')]();};}function respondWithResult(_0x4262c4,_0x39f1dd){_0x39f1dd=_0x39f1dd||0xc8;return function(_0x13f2dd){if(_0x13f2dd){return _0x4262c4[_0x28a5('0x23')](_0x39f1dd)[_0x28a5('0x24')](_0x13f2dd);}};}function respondWithFilteredResult(_0x475b68,_0x2c17c8){return function(_0x5227d4){if(_0x5227d4){var _0x4aa22b=typeof _0x2c17c8[_0x28a5('0x25')]===_0x28a5('0x26')&&typeof _0x2c17c8[_0x28a5('0x27')]===_0x28a5('0x26');var _0x2a3504=_0x5227d4[_0x28a5('0x28')];var _0x4d0afd=_0x4aa22b?0x0:_0x2c17c8[_0x28a5('0x25')];var _0x3bdf69=_0x4aa22b?_0x5227d4[_0x28a5('0x28')]:_0x2c17c8[_0x28a5('0x25')]+_0x2c17c8[_0x28a5('0x27')];var _0x22161c;if(_0x3bdf69>=_0x2a3504){_0x3bdf69=_0x2a3504;_0x22161c=0xc8;}else{_0x22161c=0xce;}_0x475b68[_0x28a5('0x23')](_0x22161c);return _0x475b68['set']('Content-Range',_0x4d0afd+'-'+_0x3bdf69+'/'+_0x2a3504)[_0x28a5('0x24')](_0x5227d4);}return null;};}function patchUpdates(_0x31a4dd){return function(_0x11e3f4){try{jsonpatch['apply'](_0x11e3f4,_0x31a4dd,!![]);}catch(_0x1b5a55){return BPromise[_0x28a5('0x29')](_0x1b5a55);}return _0x11e3f4[_0x28a5('0x2a')]();};}function saveUpdates(_0x458bd3,_0x5a76d6){return function(_0x47c9fd){if(_0x47c9fd){return _0x47c9fd[_0x28a5('0x2b')](_0x458bd3)[_0x28a5('0x2c')](function(_0x52dbe2){return _0x52dbe2;});}return null;};}function handleEntityNotFound(_0x50e217,_0x455d0d){return function(_0xe666a2){if(!_0xe666a2){_0x50e217['sendStatus'](0x194);}return _0xe666a2;};}function handleError(_0x39a9a8,_0xf3c0a2){_0xf3c0a2=_0xf3c0a2||0x1f4;return function(_0x4a5232){logger[_0x28a5('0x2d')](_0x4a5232['stack']);if(_0x4a5232['name']){delete _0x4a5232['name'];}_0x39a9a8[_0x28a5('0x23')](_0xf3c0a2)[_0x28a5('0x2e')](_0x4a5232);};}exports[_0x28a5('0x2f')]=function(_0x10da0d,_0x364082){var _0x27a5e4={},_0x26dd10={},_0x2ddd74={'count':0x0,'rows':[]};var _0x51945c=_['map'](db[_0x28a5('0x30')][_0x28a5('0x31')],function(_0x5189a7){return{'name':_0x5189a7[_0x28a5('0x32')],'type':_0x5189a7['type']['key']};});_0x26dd10[_0x28a5('0x33')]=_[_0x28a5('0x34')](_0x51945c,_0x28a5('0x35'));_0x26dd10[_0x28a5('0x36')]=_[_0x28a5('0x37')](_0x10da0d['query']);_0x26dd10[_0x28a5('0x38')]=_[_0x28a5('0x39')](_0x26dd10[_0x28a5('0x33')],_0x26dd10['query']);_0x27a5e4['attributes']=_[_0x28a5('0x39')](_0x26dd10[_0x28a5('0x33')],qs[_0x28a5('0x3a')](_0x10da0d[_0x28a5('0x36')][_0x28a5('0x3a')]));_0x27a5e4['attributes']=_0x27a5e4[_0x28a5('0x3b')][_0x28a5('0x3c')]?_0x27a5e4[_0x28a5('0x3b')]:_0x26dd10[_0x28a5('0x33')];if(!_0x10da0d[_0x28a5('0x36')][_0x28a5('0x3d')](_0x28a5('0x3e'))){_0x27a5e4['limit']=qs[_0x28a5('0x27')](_0x10da0d[_0x28a5('0x36')][_0x28a5('0x27')]);_0x27a5e4[_0x28a5('0x25')]=qs[_0x28a5('0x25')](_0x10da0d[_0x28a5('0x36')][_0x28a5('0x25')]);}_0x27a5e4[_0x28a5('0x3f')]=qs['sort'](_0x10da0d[_0x28a5('0x36')][_0x28a5('0x40')]);_0x27a5e4[_0x28a5('0x41')]=qs[_0x28a5('0x38')](_['pick'](_0x10da0d[_0x28a5('0x36')],_0x26dd10[_0x28a5('0x38')]),_0x51945c);if(_0x10da0d['query'][_0x28a5('0x42')]){_0x27a5e4[_0x28a5('0x41')]=_[_0x28a5('0x43')](_0x27a5e4[_0x28a5('0x41')],{'$or':_[_0x28a5('0x34')](_0x51945c,function(_0x4ee433){if(_0x4ee433[_0x28a5('0x44')]!==_0x28a5('0x45')){var _0x3b2de3={};_0x3b2de3[_0x4ee433['name']]={'$like':'%'+_0x10da0d['query'][_0x28a5('0x42')]+'%'};return _0x3b2de3;}})});}_0x27a5e4=_[_0x28a5('0x43')]({},_0x27a5e4,_0x10da0d['options']);var _0x5b95e4={'where':_0x27a5e4[_0x28a5('0x41')]};return db[_0x28a5('0x30')][_0x28a5('0x28')](_0x5b95e4)['then'](function(_0x347b23){_0x2ddd74[_0x28a5('0x28')]=_0x347b23;if(_0x10da0d[_0x28a5('0x36')]['includeAll']){_0x27a5e4['include']=[{'all':!![]}];}return db[_0x28a5('0x30')]['findAll'](_0x27a5e4);})[_0x28a5('0x2c')](function(_0x31e399){_0x2ddd74[_0x28a5('0x46')]=_0x31e399;return _0x2ddd74;})[_0x28a5('0x2c')](respondWithFilteredResult(_0x364082,_0x27a5e4))[_0x28a5('0x47')](handleError(_0x364082,null));};exports[_0x28a5('0x48')]=function(_0xe3b1d8,_0x5a5a1c){var _0x508995={'raw':![],'where':{'id':_0xe3b1d8[_0x28a5('0x49')]['id']}},_0x306464={};_0x306464[_0x28a5('0x33')]=_['keys'](db[_0x28a5('0x30')][_0x28a5('0x31')]);_0x306464['query']=_[_0x28a5('0x37')](_0xe3b1d8[_0x28a5('0x36')]);_0x306464['filters']=_[_0x28a5('0x39')](_0x306464[_0x28a5('0x33')],_0x306464[_0x28a5('0x36')]);_0x508995[_0x28a5('0x3b')]=_[_0x28a5('0x39')](_0x306464['model'],qs['fields'](_0xe3b1d8['query'][_0x28a5('0x3a')]));_0x508995[_0x28a5('0x3b')]=_0x508995[_0x28a5('0x3b')]['length']?_0x508995[_0x28a5('0x3b')]:_0x306464['model'];if(_0xe3b1d8[_0x28a5('0x36')][_0x28a5('0x4a')]){_0x508995[_0x28a5('0x4b')]=[{'all':!![]}];}_0x508995=_[_0x28a5('0x43')]({},_0x508995,_0xe3b1d8[_0x28a5('0x4c')]);return db[_0x28a5('0x30')][_0x28a5('0x4d')](_0x508995)[_0x28a5('0x2c')](handleEntityNotFound(_0x5a5a1c,null))[_0x28a5('0x2c')](respondWithResult(_0x5a5a1c,null))['catch'](handleError(_0x5a5a1c,null));};exports[_0x28a5('0x4e')]=function(_0x101b3b,_0xbadcc6){return db['Team']['create'](_0x101b3b[_0x28a5('0x4f')],{})[_0x28a5('0x2c')](function(_0xb2a6b3){var _0x39fed1=_0x101b3b[_0x28a5('0x50')][_0x28a5('0x51')]({'plain':!![]});if(!_0x39fed1)throw new Error(_0x28a5('0x52'));if(_0x39fed1['role']===_0x28a5('0x50')){var _0x4207da=_0xb2a6b3['get']({'plain':!![]});var _0x138c7d=_0x28a5('0x53');return db[_0x28a5('0x54')][_0x28a5('0x4d')]({'where':{'name':_0x138c7d,'userProfileId':_0x39fed1[_0x28a5('0x55')]},'raw':!![]})['then'](function(_0x3dc5bc){if(_0x3dc5bc&&_0x3dc5bc['autoAssociation']===0x0){return db['UserProfileResource'][_0x28a5('0x4e')]({'name':_0x4207da[_0x28a5('0x35')],'resourceId':_0x4207da['id'],'type':_0x3dc5bc[_0x28a5('0x35')],'sectionId':_0x3dc5bc['id']},{})[_0x28a5('0x2c')](function(){return _0xb2a6b3;});}else{return _0xb2a6b3;}})['catch'](function(_0x338420){logger[_0x28a5('0x2d')](_0x28a5('0x56'),_0x338420);throw _0x338420;});}return _0xb2a6b3;})[_0x28a5('0x2c')](respondWithResult(_0xbadcc6,0xc9))['catch'](handleError(_0xbadcc6,null));};exports[_0x28a5('0x2b')]=function(_0x1549a8,_0x2bd347){if(_0x1549a8[_0x28a5('0x4f')]['id']){delete _0x1549a8[_0x28a5('0x4f')]['id'];}return db[_0x28a5('0x30')][_0x28a5('0x4d')]({'where':{'id':_0x1549a8[_0x28a5('0x49')]['id']}})[_0x28a5('0x2c')](handleEntityNotFound(_0x2bd347,null))[_0x28a5('0x2c')](saveUpdates(_0x1549a8[_0x28a5('0x4f')],null))[_0x28a5('0x2c')](respondWithResult(_0x2bd347,null))['catch'](handleError(_0x2bd347,null));};exports[_0x28a5('0x57')]=function(_0x59ff0b,_0x228a5c){var _0x460f33=_0x59ff0b[_0x28a5('0x49')]['id'];var _0x44fd03=[];return db[_0x28a5('0x58')]['transaction'](function(_0x2b075f){var _0x56726f=_0x28a5('0x59')+_0x460f33;return db[_0x28a5('0x58')][_0x28a5('0x36')](_0x56726f,{'type':db['Sequelize'][_0x28a5('0x5a')][_0x28a5('0x5b')],'raw':!![],'transaction':_0x2b075f})['then'](function(_0x52db09){_0x44fd03=_['map'](_0x52db09,function(_0x30c7b3){return Number(_0x30c7b3[_0x28a5('0x5c')]);});})[_0x28a5('0x2c')](function(){var _0x346217='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x460f33;return db[_0x28a5('0x58')]['query'](_0x346217,{'type':db[_0x28a5('0x5d')][_0x28a5('0x5a')][_0x28a5('0x5b')],'raw':!![],'transaction':_0x2b075f});})['then'](function(_0x335dba){var _0x2a8353=_['map'](_0x335dba,function(_0x2f29d0){return Number(_0x2f29d0[_0x28a5('0x5e')]);});return db[_0x28a5('0x5f')]['destroy']({'where':{'UserId':{'$in':_0x44fd03},'VoiceQueueId':{'$in':_0x2a8353}},'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(){var _0x1d2ce=_0x28a5('0x60')+_0x460f33;return db[_0x28a5('0x58')][_0x28a5('0x36')](_0x1d2ce,{'type':db[_0x28a5('0x5d')][_0x28a5('0x5a')][_0x28a5('0x5b')],'raw':!![],'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(_0x3bdc46){var _0x5ac0c1=_[_0x28a5('0x34')](_0x3bdc46,function(_0x2bc95b){return Number(_0x2bc95b['MailQueueId']);});return db[_0x28a5('0x61')][_0x28a5('0x57')]({'where':{'UserId':{'$in':_0x44fd03},'MailQueueId':{'$in':_0x5ac0c1}},'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(){var _0x39822d=_0x28a5('0x62')+_0x460f33;return db[_0x28a5('0x58')][_0x28a5('0x36')](_0x39822d,{'type':db[_0x28a5('0x5d')]['QueryTypes'][_0x28a5('0x5b')],'raw':!![],'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(_0x15dcb8){var _0x42cbef=_[_0x28a5('0x34')](_0x15dcb8,function(_0x16b717){return Number(_0x16b717[_0x28a5('0x63')]);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x44fd03},'SmsQueueId':{'$in':_0x42cbef}},'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(){var _0x379728=_0x28a5('0x64')+_0x460f33;return db[_0x28a5('0x58')][_0x28a5('0x36')](_0x379728,{'type':db[_0x28a5('0x5d')][_0x28a5('0x5a')][_0x28a5('0x5b')],'raw':!![],'transaction':_0x2b075f});})['then'](function(_0x35df63){var _0x2a7dcf=_[_0x28a5('0x34')](_0x35df63,function(_0x39b9f5){return Number(_0x39b9f5[_0x28a5('0x65')]);});return db['UserChatQueue'][_0x28a5('0x57')]({'where':{'UserId':{'$in':_0x44fd03},'ChatQueueId':{'$in':_0x2a7dcf}},'transaction':_0x2b075f});})['then'](function(){var _0x470d00='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x460f33;return db['sequelize'][_0x28a5('0x36')](_0x470d00,{'type':db[_0x28a5('0x5d')][_0x28a5('0x5a')]['SELECT'],'raw':!![],'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(_0x44684d){var _0x204a11=_[_0x28a5('0x34')](_0x44684d,function(_0xe20f03){return Number(_0xe20f03['FaxQueueId']);});return db[_0x28a5('0x66')][_0x28a5('0x57')]({'where':{'UserId':{'$in':_0x44fd03},'FaxQueueId':{'$in':_0x204a11}},'transaction':_0x2b075f});})['then'](function(){var _0x199eee='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x460f33;return db['sequelize'][_0x28a5('0x36')](_0x199eee,{'type':db[_0x28a5('0x5d')][_0x28a5('0x5a')]['SELECT'],'raw':!![],'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(_0x7c6890){var _0x515cc1=_[_0x28a5('0x34')](_0x7c6890,function(_0x2a6e1a){return Number(_0x2a6e1a['OpenchannelQueueId']);});return db[_0x28a5('0x67')][_0x28a5('0x57')]({'where':{'UserId':{'$in':_0x44fd03},'OpenchannelQueueId':{'$in':_0x515cc1}},'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(){var _0xf506d2=_0x28a5('0x68')+_0x460f33;return db['sequelize'][_0x28a5('0x36')](_0xf506d2,{'type':db[_0x28a5('0x5d')][_0x28a5('0x5a')][_0x28a5('0x5b')],'raw':!![],'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(_0x948012){var _0x1e23f0=_[_0x28a5('0x34')](_0x948012,function(_0x47b1db){return Number(_0x47b1db['WhatsappQueueId']);});return db[_0x28a5('0x69')]['destroy']({'where':{'UserId':{'$in':_0x44fd03},'WhatsappQueueId':{'$in':_0x1e23f0}},'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(){return db[_0x28a5('0x6a')][_0x28a5('0x4d')]({'where':{'TeamId':_0x460f33}});})[_0x28a5('0x2c')](function(_0x4bfb8d){if(_0x4bfb8d===null){return;}return db[_0x28a5('0x6b')]['destroy']({'where':{'UserId':{'$in':_0x44fd03},'VoicePrefixId':_0x4bfb8d[_0x28a5('0x6c')]},'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(){return db['Team'][_0x28a5('0x57')]({'where':{'id':_0x460f33},'cascade':!![],'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(_0x4e097f){if(_0x4e097f===0x0){_0x228a5c[_0x28a5('0x21')](0x194);}else{return db['UserProfileResource'][_0x28a5('0x57')]({'where':{'type':_0x28a5('0x53'),'resourceId':_0x460f33},'cascade':!![],'transaction':_0x2b075f})['then'](function(){_0x228a5c[_0x28a5('0x23')](0xcc)[_0x28a5('0x22')]();});}})[_0x28a5('0x47')](function(_0xf29232){_0x228a5c[_0x28a5('0x23')](0x1f4)['send'](_0xf29232);});});};exports['getQueues']=function(_0x586dd5,_0x549543,_0x401588){return db[_0x28a5('0x30')][_0x28a5('0x6d')]({'where':{'id':_0x586dd5['params']['id']}})['then'](handleEntityNotFound(_0x549543,null))[_0x28a5('0x2c')](function(_0x33ebf7){if(!_0x586dd5[_0x28a5('0x36')][_0x28a5('0x6e')]||!utils['isValidChannel'](_0x586dd5[_0x28a5('0x36')][_0x28a5('0x6e')])){throw new db['Sequelize']['ValidationError'](_0x28a5('0x6f'));}var _0x17055d={};var _0x34d0f9={};_0x34d0f9[_0x28a5('0x33')]=_[_0x28a5('0x37')](db[_[_0x28a5('0x70')](_0x586dd5[_0x28a5('0x36')][_0x28a5('0x6e')][_0x28a5('0x71')]())+'Queue'][_0x28a5('0x31')]);_0x34d0f9[_0x28a5('0x36')]=_[_0x28a5('0x37')](_0x586dd5[_0x28a5('0x36')]);_0x34d0f9[_0x28a5('0x38')]=_[_0x28a5('0x39')](_0x34d0f9['model'],_0x34d0f9[_0x28a5('0x36')]);_0x17055d[_0x28a5('0x3b')]=_[_0x28a5('0x39')](_0x34d0f9[_0x28a5('0x33')],qs[_0x28a5('0x3a')](_0x586dd5[_0x28a5('0x36')]['fields']));_0x17055d[_0x28a5('0x3b')]=_0x17055d[_0x28a5('0x3b')]['length']?_0x17055d[_0x28a5('0x3b')]:_0x34d0f9['model'];_0x17055d[_0x28a5('0x27')]=qs[_0x28a5('0x27')](_0x586dd5[_0x28a5('0x36')][_0x28a5('0x27')]);_0x17055d[_0x28a5('0x25')]=qs[_0x28a5('0x25')](_0x586dd5[_0x28a5('0x36')][_0x28a5('0x25')]);_0x17055d[_0x28a5('0x3f')]=qs['sort'](_0x586dd5[_0x28a5('0x36')][_0x28a5('0x40')]);_0x17055d[_0x28a5('0x41')]=qs[_0x28a5('0x38')](_[_0x28a5('0x72')](_0x586dd5[_0x28a5('0x36')],_0x34d0f9[_0x28a5('0x38')]));_0x17055d=_[_0x28a5('0x43')]({},_0x17055d,_0x586dd5[_0x28a5('0x4c')]);return _0x33ebf7[_0x28a5('0x51')+_[_0x28a5('0x70')](_0x586dd5[_0x28a5('0x36')]['channel'][_0x28a5('0x71')]())+'Queues'](_0x17055d);})[_0x28a5('0x2c')](respondWithResult(_0x549543,null))[_0x28a5('0x47')](handleError(_0x549543,null));};exports['addQueues']=function(_0x2c8a61,_0x309aa5,_0x1dbf1e){return db[_0x28a5('0x30')][_0x28a5('0x6d')]({'where':{'id':_0x2c8a61[_0x28a5('0x49')]['id']}})['then'](function(_0xc1a5){if(_0xc1a5){if(!_0x2c8a61[_0x28a5('0x4f')][_0x28a5('0x6e')]||!utils[_0x28a5('0x73')](_0x2c8a61[_0x28a5('0x4f')]['channel'])){throw new db[(_0x28a5('0x5d'))][(_0x28a5('0x74'))]('Unknown\x20channel');}return _0xc1a5['add'+_[_0x28a5('0x70')](_0x2c8a61[_0x28a5('0x4f')]['channel']['toLowerCase']())+_0x28a5('0x75')](_0x2c8a61[_0x28a5('0x4f')][_0x28a5('0x76')]);}return null;})[_0x28a5('0x2c')](handleEntityNotFound(_0x309aa5,null))[_0x28a5('0x2c')](respondWithStatusCode(_0x309aa5,null))[_0x28a5('0x47')](handleError(_0x309aa5,null));};exports['removeQueues']=function(_0x5a009f,_0x3e5c02,_0x1a5ecc){return db[_0x28a5('0x30')][_0x28a5('0x6d')]({'where':{'id':_0x5a009f[_0x28a5('0x49')]['id']}})[_0x28a5('0x2c')](function(_0x2ade90){if(_0x2ade90){if(!_0x5a009f[_0x28a5('0x36')][_0x28a5('0x6e')]||!utils[_0x28a5('0x73')](_0x5a009f[_0x28a5('0x36')][_0x28a5('0x6e')])){throw new db[(_0x28a5('0x5d'))][(_0x28a5('0x74'))](_0x28a5('0x6f'));}return _0x2ade90[_0x28a5('0x77')+_[_0x28a5('0x70')](_0x5a009f[_0x28a5('0x36')][_0x28a5('0x6e')]['toLowerCase']())+_0x28a5('0x75')](_0x5a009f[_0x28a5('0x36')][_0x28a5('0x76')]);}return null;})[_0x28a5('0x2c')](handleEntityNotFound(_0x3e5c02,null))[_0x28a5('0x2c')](respondWithStatusCode(_0x3e5c02,null))[_0x28a5('0x47')](handleError(_0x3e5c02,null));};exports[_0x28a5('0x78')]=function(_0x1a79dd,_0x2ed76c){var _0x2d8b15=_[_0x28a5('0x79')](_0x1a79dd[_0x28a5('0x4f')][_0x28a5('0x76')])?_0x1a79dd[_0x28a5('0x4f')]['ids']:[_0x1a79dd[_0x28a5('0x4f')][_0x28a5('0x76')]];var _0x5b82cd=_0x1a79dd[_0x28a5('0x49')]['id'];return db['Team'][_0x28a5('0x4d')]({'where':{'id':_0x5b82cd}})[_0x28a5('0x2c')](handleEntityNotFound(_0x2ed76c,null))['then'](function(_0xf7f5d4){if(_0xf7f5d4){var _0x406205=[_0x28a5('0x7a'),'Chat',_0x28a5('0x7b'),_0x28a5('0x7c'),'Fax','Openchannel',_0x28a5('0x7d')];return db['sequelize']['transaction'](function(_0x3915e0){var _0x522ba9=_['map'](_0x406205,function(_0x7b797f){var _0x49f4fe={'attributes':['id',_0x28a5('0x35')]};if(_0x7b797f===_0x28a5('0x7a')){_0x49f4fe[_0x28a5('0x7e')]={'attributes':[_0x28a5('0x7f')]};}return _0xf7f5d4[_0x28a5('0x51')+_0x7b797f+_0x28a5('0x75')](_0x49f4fe)[_0x28a5('0x2c')](function(_0x5e2f7e){var _0x19e617=_[_0x28a5('0x34')](_0x5e2f7e,function(_0x2ce5d4){var _0x4b0dc7=_[_0x28a5('0x34')](_0x2d8b15,function(_0x45c1d7){var _0x2c38f6={'where':{'UserId':_0x45c1d7,[_0x7b797f+_0x28a5('0x80')]:_0x2ce5d4['id']},'transaction':_0x3915e0};if(_0x7b797f===_0x28a5('0x7a')){_0x2c38f6['defaults']={'penalty':_0x2ce5d4[_0x28a5('0x81')][_0x28a5('0x7f')]};}return db[_0x28a5('0x82')+_0x7b797f+_0x28a5('0x83')][_0x28a5('0x84')](_0x2c38f6)['then'](function(){socket[_0x28a5('0x85')](_0x28a5('0x50')+_0x7b797f+_0x28a5('0x86'),{'UserId':_0x45c1d7,[_0x7b797f+_0x28a5('0x80')]:_0x2ce5d4['id']});if(_0x7b797f!==_0x28a5('0x7a')){return;}return db[_0x28a5('0x82')][_0x28a5('0x87')]({'where':{'id':_0x2d8b15,'online':0x1},'attributes':['id','name','online',_0x28a5('0x88'),'interface'],'raw':!![]})['then'](function(_0x435b2b){var _0x42860f=_[_0x28a5('0x34')](_0x435b2b,function(_0x512ea8){return db['UserVoiceQueueRt'][_0x28a5('0x89')]({'membername':_0x512ea8[_0x28a5('0x35')],'UserId':_0x512ea8['id'],'queue_name':_0x2ce5d4[_0x28a5('0x35')],'VoiceQueueId':_0x2ce5d4['id'],'interface':_['isNil'](_0x512ea8[_0x28a5('0x8a')])?util[_0x28a5('0x8b')](_0x28a5('0x8c'),_0x512ea8[_0x28a5('0x35')]):_0x512ea8[_0x28a5('0x8a')],'paused':_0x512ea8[_0x28a5('0x88')]||![],'penalty':_0x2ce5d4[_0x28a5('0x81')][_0x28a5('0x7f')]},{'transaction':_0x3915e0});});return Promise[_0x28a5('0x8d')](_0x42860f);});});});return Promise[_0x28a5('0x8d')](_0x4b0dc7);});return Promise['all'](_0x19e617);})[_0x28a5('0x2c')](function(){return db[_0x28a5('0x6a')][_0x28a5('0x6d')]({'where':{'teamId':_0x5b82cd}})[_0x28a5('0x2c')](function(_0x46d389){if(_0x46d389){var _0x2a9912=_[_0x28a5('0x34')](_0x2d8b15,function(_0x5310e0){db['UserVoicePrefix']['upsert']({'UserId':_0x5310e0,'VoicePrefixId':_0x46d389['VoicePrefixId']});});return Promise[_0x28a5('0x8d')](_0x2a9912);}});});});return Promise[_0x28a5('0x8d')](_0x522ba9)[_0x28a5('0x2c')](function(){return _0xf7f5d4[_0x28a5('0x78')](_0x2d8b15,{'transaction':_0x3915e0})['spread'](function(_0x5849ac){return _0x5849ac;});});});}})[_0x28a5('0x2c')](respondWithResult(_0x2ed76c,null))['catch'](handleError(_0x2ed76c,null));};exports[_0x28a5('0x8e')]=function(_0x24abbd,_0x5984d4){var _0x2810ab=_['isArray'](_0x24abbd['query'][_0x28a5('0x76')])?_0x24abbd[_0x28a5('0x36')][_0x28a5('0x76')]:[_0x24abbd[_0x28a5('0x36')][_0x28a5('0x76')]];var _0x36287b=_0x24abbd[_0x28a5('0x49')]['id'];return db[_0x28a5('0x30')][_0x28a5('0x4d')]({'where':{'id':_0x36287b}})[_0x28a5('0x2c')](handleEntityNotFound(_0x5984d4,null))[_0x28a5('0x2c')](function(_0xf33655){if(_0xf33655){var _0x4ef8ef=[_0x28a5('0x7a'),_0x28a5('0x8f'),_0x28a5('0x7b'),'Sms',_0x28a5('0x90'),_0x28a5('0x91'),_0x28a5('0x7d')];return db[_0x28a5('0x58')][_0x28a5('0x92')](function(_0x3559ae){var _0x1ff727=_[_0x28a5('0x34')](_0x4ef8ef,function(_0x192d00){var _0x3aef4f={'attributes':['id',_0x28a5('0x35')]};return _0xf33655[_0x28a5('0x51')+_0x192d00+'Queues'](_0x3aef4f)['then'](function(_0x40c63f){var _0x67206b=_[_0x28a5('0x34')](_0x40c63f,function(_0x32c0a7){return _0x32c0a7[_0x28a5('0x8e')](_0x2810ab,{'transaction':_0x3559ae})[_0x28a5('0x2c')](function(){var _0x2aaf26=_[_0x28a5('0x34')](_0x2810ab,function(_0x62d8ff){socket[_0x28a5('0x85')]('user'+_0x192d00+'Queue:remove',{'UserId':Number(_0x62d8ff),[_0x192d00+_0x28a5('0x80')]:_0x32c0a7['id']});if(_0x192d00!=='Voice'){return;}return db[_0x28a5('0x93')][_0x28a5('0x57')]({'where':{'VoiceQueueId':_0x32c0a7['id'],'UserId':_0x62d8ff},'transaction':_0x3559ae});});return Promise[_0x28a5('0x8d')](_0x2aaf26);});});return Promise[_0x28a5('0x8d')](_0x67206b);});});return Promise[_0x28a5('0x8d')](_0x1ff727)[_0x28a5('0x2c')](function(){return _0xf33655['removeAgents'](_0x2810ab,{'transaction':_0x3559ae});})[_0x28a5('0x2c')](function(){return db[_0x28a5('0x6a')][_0x28a5('0x6d')]({'where':{'teamId':_0x36287b}})[_0x28a5('0x2c')](function(_0x23fcb6){if(_0x23fcb6){var _0x1c3f07=_[_0x28a5('0x34')](_0x2810ab,function(_0x5c4a0d){db[_0x28a5('0x6b')][_0x28a5('0x57')]({'where':{'UserId':_0x5c4a0d,'VoicePrefixId':_0x23fcb6[_0x28a5('0x6c')]}});});return Promise[_0x28a5('0x8d')](_0x1c3f07);}});});});}})[_0x28a5('0x2c')](respondWithStatusCode(_0x5984d4,null))['catch'](handleError(_0x5984d4,null));};exports[_0x28a5('0x94')]=function(_0x3eeada,_0x5b4815,_0x5b8bc1){var _0x32f820={};var _0x4c6fb7={};var _0x68c7dd;var _0x1bf7cf;return db[_0x28a5('0x30')]['findOne']({'where':{'id':_0x3eeada[_0x28a5('0x49')]['id']}})[_0x28a5('0x2c')](handleEntityNotFound(_0x5b4815,null))['then'](function(_0x8e4c8e){if(_0x8e4c8e){_0x68c7dd=_0x8e4c8e;_0x4c6fb7['model']=_[_0x28a5('0x37')](db[_0x28a5('0x82')][_0x28a5('0x31')]);_0x4c6fb7['query']=_[_0x28a5('0x37')](_0x3eeada[_0x28a5('0x36')]);_0x4c6fb7[_0x28a5('0x38')]=_[_0x28a5('0x39')](_0x4c6fb7['model'],_0x4c6fb7[_0x28a5('0x36')]);_0x32f820[_0x28a5('0x3b')]=_['intersection'](_0x4c6fb7['model'],qs[_0x28a5('0x3a')](_0x3eeada['query'][_0x28a5('0x3a')]));_0x32f820[_0x28a5('0x3b')]=_0x32f820[_0x28a5('0x3b')]['length']?_0x32f820[_0x28a5('0x3b')]:_0x4c6fb7[_0x28a5('0x33')];_0x32f820[_0x28a5('0x3f')]=qs[_0x28a5('0x40')](_0x3eeada['query']['sort']);_0x32f820[_0x28a5('0x41')]=qs[_0x28a5('0x38')](_[_0x28a5('0x72')](_0x3eeada['query'],_0x4c6fb7[_0x28a5('0x38')]));if(_0x3eeada[_0x28a5('0x36')]['filter']){_0x32f820[_0x28a5('0x41')]=_[_0x28a5('0x43')](_0x32f820[_0x28a5('0x41')],{'$or':_[_0x28a5('0x34')](_0x32f820[_0x28a5('0x3b')],function(_0xe9f498){var _0x2e5249={};_0x2e5249[_0xe9f498]={'$like':'%'+_0x3eeada[_0x28a5('0x36')]['filter']+'%'};return _0x2e5249;})});}_0x32f820=_[_0x28a5('0x43')]({},_0x32f820,_0x3eeada[_0x28a5('0x4c')]);return _0x68c7dd[_0x28a5('0x94')](_0x32f820);}})[_0x28a5('0x2c')](function(_0x1be5e1){if(_0x1be5e1){_0x1bf7cf=_0x1be5e1['length'];if(!_0x3eeada['query'][_0x28a5('0x3d')](_0x28a5('0x3e'))){_0x32f820[_0x28a5('0x27')]=qs[_0x28a5('0x27')](_0x3eeada[_0x28a5('0x36')][_0x28a5('0x27')]);_0x32f820[_0x28a5('0x25')]=qs[_0x28a5('0x25')](_0x3eeada[_0x28a5('0x36')][_0x28a5('0x25')]);}return _0x68c7dd[_0x28a5('0x94')](_0x32f820);}})[_0x28a5('0x2c')](function(_0x543d80){if(_0x543d80){return _0x543d80?{'count':_0x1bf7cf,'rows':_0x543d80}:null;}})[_0x28a5('0x2c')](respondWithResult(_0x5b4815,null))[_0x28a5('0x47')](handleError(_0x5b4815,null));}; \ No newline at end of file +var _0x3ca4=['where','filters','pick','filter','VIRTUAL','merge','options','then','includeAll','rows','show','params','keys','include','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','destroy','sequelize','transaction','Sequelize','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','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserVoicePrefix','getQueues','isValidChannel','ValidationError','Unknown\x20channel','capitalize','channel','toLowerCase','Queue','length','Queues','addQueues','findOne','removeQueues','ids','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','User','emit','Queue:save','online','interface','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','all','upsert','VoicePrefixId','spread','Queue:remove','TeamVoicePrefix','order','getAgents','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','save','update','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort'];(function(_0x522c1b,_0x56a232){var _0x2dbc7f=function(_0x1a8b1f){while(--_0x1a8b1f){_0x522c1b['push'](_0x522c1b['shift']());}};_0x2dbc7f(++_0x56a232);}(_0x3ca4,0xf8));var _0x43ca=function(_0x378d90,_0x3effe9){_0x378d90=_0x378d90-0x0;var _0x5574a1=_0x3ca4[_0x378d90];return _0x5574a1;};'use strict';var emlformat=require(_0x43ca('0x0'));var rimraf=require(_0x43ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x43ca('0x2'));var rp=require(_0x43ca('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43ca('0x4'));var util=require(_0x43ca('0x5'));var path=require(_0x43ca('0x6'));var sox=require(_0x43ca('0x7'));var csv=require('to-csv');var ejs=require(_0x43ca('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x43ca('0x9'));var squel=require(_0x43ca('0xa'));var crypto=require('crypto');var jsforce=require(_0x43ca('0xb'));var deskjs=require(_0x43ca('0xc'));var toCsv=require(_0x43ca('0xd'));var querystring=require(_0x43ca('0xe'));var Papa=require(_0x43ca('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43ca('0x10'));var as=require(_0x43ca('0x11'));var hardwareService=require(_0x43ca('0x12'));var logger=require(_0x43ca('0x13'))(_0x43ca('0x14'));var utils=require(_0x43ca('0x15'));var config=require(_0x43ca('0x16'));var licenseUtil=require(_0x43ca('0x17'));var db=require(_0x43ca('0x18'))['db'];config[_0x43ca('0x19')]=_[_0x43ca('0x1a')](config[_0x43ca('0x19')],{'host':_0x43ca('0x1b'),'port':0x18eb});var socket=require(_0x43ca('0x1c'))(new Redis(config['redis']));require(_0x43ca('0x1d'))[_0x43ca('0x1e')](socket);function respondWithStatusCode(_0x5ce25b,_0x1168a8){_0x1168a8=_0x1168a8||0xcc;return function(_0x2f66db){if(_0x2f66db){return _0x5ce25b[_0x43ca('0x1f')](_0x1168a8);}return _0x5ce25b[_0x43ca('0x20')](_0x1168a8)[_0x43ca('0x21')]();};}function respondWithResult(_0x5bbee1,_0x5cee25){_0x5cee25=_0x5cee25||0xc8;return function(_0x1365e3){if(_0x1365e3){return _0x5bbee1['status'](_0x5cee25)['json'](_0x1365e3);}};}function respondWithFilteredResult(_0x53a842,_0xfc6c64){return function(_0x2fbfdb){if(_0x2fbfdb){var _0x49c94d=typeof _0xfc6c64['offset']===_0x43ca('0x22')&&typeof _0xfc6c64['limit']===_0x43ca('0x22');var _0x57543d=_0x2fbfdb[_0x43ca('0x23')];var _0x53ea78=_0x49c94d?0x0:_0xfc6c64[_0x43ca('0x24')];var _0x318694=_0x49c94d?_0x2fbfdb[_0x43ca('0x23')]:_0xfc6c64[_0x43ca('0x24')]+_0xfc6c64[_0x43ca('0x25')];var _0x55dd2a;if(_0x318694>=_0x57543d){_0x318694=_0x57543d;_0x55dd2a=0xc8;}else{_0x55dd2a=0xce;}_0x53a842[_0x43ca('0x20')](_0x55dd2a);return _0x53a842[_0x43ca('0x26')](_0x43ca('0x27'),_0x53ea78+'-'+_0x318694+'/'+_0x57543d)[_0x43ca('0x28')](_0x2fbfdb);}return null;};}function patchUpdates(_0x119c13){return function(_0x1f90bf){try{jsonpatch[_0x43ca('0x29')](_0x1f90bf,_0x119c13,!![]);}catch(_0x59ab21){return BPromise['reject'](_0x59ab21);}return _0x1f90bf[_0x43ca('0x2a')]();};}function saveUpdates(_0x4c0b51,_0x1da16d){return function(_0x79ace6){if(_0x79ace6){return _0x79ace6[_0x43ca('0x2b')](_0x4c0b51)['then'](function(_0x49746c){return _0x49746c;});}return null;};}function handleEntityNotFound(_0x3ed91f,_0x1b7462){return function(_0x3d6ca6){if(!_0x3d6ca6){_0x3ed91f[_0x43ca('0x1f')](0x194);}return _0x3d6ca6;};}function handleError(_0x1742bd,_0x29ab24){_0x29ab24=_0x29ab24||0x1f4;return function(_0x1eac8e){logger['error'](_0x1eac8e[_0x43ca('0x2c')]);if(_0x1eac8e[_0x43ca('0x2d')]){delete _0x1eac8e[_0x43ca('0x2d')];}_0x1742bd['status'](_0x29ab24)[_0x43ca('0x2e')](_0x1eac8e);};}exports[_0x43ca('0x2f')]=function(_0xb957dc,_0x41d516){var _0x262a98={},_0x19df48={},_0x325da8={'count':0x0,'rows':[]};var _0x4b79c8=_[_0x43ca('0x30')](db[_0x43ca('0x31')][_0x43ca('0x32')],function(_0x3177f7){return{'name':_0x3177f7[_0x43ca('0x33')],'type':_0x3177f7[_0x43ca('0x34')][_0x43ca('0x35')]};});_0x19df48[_0x43ca('0x36')]=_[_0x43ca('0x30')](_0x4b79c8,_0x43ca('0x2d'));_0x19df48['query']=_['keys'](_0xb957dc[_0x43ca('0x37')]);_0x19df48['filters']=_[_0x43ca('0x38')](_0x19df48['model'],_0x19df48[_0x43ca('0x37')]);_0x262a98['attributes']=_[_0x43ca('0x38')](_0x19df48['model'],qs[_0x43ca('0x39')](_0xb957dc[_0x43ca('0x37')]['fields']));_0x262a98[_0x43ca('0x3a')]=_0x262a98[_0x43ca('0x3a')]['length']?_0x262a98[_0x43ca('0x3a')]:_0x19df48[_0x43ca('0x36')];if(!_0xb957dc['query'][_0x43ca('0x3b')](_0x43ca('0x3c'))){_0x262a98[_0x43ca('0x25')]=qs[_0x43ca('0x25')](_0xb957dc[_0x43ca('0x37')][_0x43ca('0x25')]);_0x262a98[_0x43ca('0x24')]=qs[_0x43ca('0x24')](_0xb957dc[_0x43ca('0x37')][_0x43ca('0x24')]);}_0x262a98['order']=qs[_0x43ca('0x3d')](_0xb957dc[_0x43ca('0x37')][_0x43ca('0x3d')]);_0x262a98[_0x43ca('0x3e')]=qs[_0x43ca('0x3f')](_[_0x43ca('0x40')](_0xb957dc[_0x43ca('0x37')],_0x19df48[_0x43ca('0x3f')]),_0x4b79c8);if(_0xb957dc['query'][_0x43ca('0x41')]){_0x262a98['where']=_['merge'](_0x262a98[_0x43ca('0x3e')],{'$or':_[_0x43ca('0x30')](_0x4b79c8,function(_0x10f5e3){if(_0x10f5e3[_0x43ca('0x34')]!==_0x43ca('0x42')){var _0x561b34={};_0x561b34[_0x10f5e3['name']]={'$like':'%'+_0xb957dc[_0x43ca('0x37')][_0x43ca('0x41')]+'%'};return _0x561b34;}})});}_0x262a98=_[_0x43ca('0x43')]({},_0x262a98,_0xb957dc[_0x43ca('0x44')]);var _0xba8e64={'where':_0x262a98['where']};return db['Team'][_0x43ca('0x23')](_0xba8e64)[_0x43ca('0x45')](function(_0x4e24f3){_0x325da8[_0x43ca('0x23')]=_0x4e24f3;if(_0xb957dc[_0x43ca('0x37')][_0x43ca('0x46')]){_0x262a98['include']=[{'all':!![]}];}return db[_0x43ca('0x31')]['findAll'](_0x262a98);})[_0x43ca('0x45')](function(_0x96f71c){_0x325da8[_0x43ca('0x47')]=_0x96f71c;return _0x325da8;})[_0x43ca('0x45')](respondWithFilteredResult(_0x41d516,_0x262a98))['catch'](handleError(_0x41d516,null));};exports[_0x43ca('0x48')]=function(_0x35ea2c,_0x40f442){var _0x5cfc24={'raw':![],'where':{'id':_0x35ea2c[_0x43ca('0x49')]['id']}},_0x39c339={};_0x39c339['model']=_[_0x43ca('0x4a')](db['Team'][_0x43ca('0x32')]);_0x39c339[_0x43ca('0x37')]=_[_0x43ca('0x4a')](_0x35ea2c[_0x43ca('0x37')]);_0x39c339[_0x43ca('0x3f')]=_['intersection'](_0x39c339[_0x43ca('0x36')],_0x39c339[_0x43ca('0x37')]);_0x5cfc24[_0x43ca('0x3a')]=_[_0x43ca('0x38')](_0x39c339[_0x43ca('0x36')],qs[_0x43ca('0x39')](_0x35ea2c['query']['fields']));_0x5cfc24[_0x43ca('0x3a')]=_0x5cfc24[_0x43ca('0x3a')]['length']?_0x5cfc24[_0x43ca('0x3a')]:_0x39c339[_0x43ca('0x36')];if(_0x35ea2c[_0x43ca('0x37')]['includeAll']){_0x5cfc24[_0x43ca('0x4b')]=[{'all':!![]}];}_0x5cfc24=_[_0x43ca('0x43')]({},_0x5cfc24,_0x35ea2c[_0x43ca('0x44')]);return db['Team']['find'](_0x5cfc24)[_0x43ca('0x45')](handleEntityNotFound(_0x40f442,null))['then'](respondWithResult(_0x40f442,null))[_0x43ca('0x4c')](handleError(_0x40f442,null));};exports[_0x43ca('0x4d')]=function(_0x3e6e7a,_0x2180d8){return db[_0x43ca('0x31')][_0x43ca('0x4d')](_0x3e6e7a[_0x43ca('0x4e')],{})[_0x43ca('0x45')](function(_0x18c4c0){var _0x9f76ef=_0x3e6e7a[_0x43ca('0x4f')][_0x43ca('0x50')]({'plain':!![]});if(!_0x9f76ef)throw new Error(_0x43ca('0x51'));if(_0x9f76ef[_0x43ca('0x52')]===_0x43ca('0x4f')){var _0x41b58e=_0x18c4c0[_0x43ca('0x50')]({'plain':!![]});var _0x2b5c29='Teams';return db[_0x43ca('0x53')]['find']({'where':{'name':_0x2b5c29,'userProfileId':_0x9f76ef['userProfileId']},'raw':!![]})[_0x43ca('0x45')](function(_0x51b30f){if(_0x51b30f&&_0x51b30f[_0x43ca('0x54')]===0x0){return db[_0x43ca('0x55')][_0x43ca('0x4d')]({'name':_0x41b58e[_0x43ca('0x2d')],'resourceId':_0x41b58e['id'],'type':_0x51b30f[_0x43ca('0x2d')],'sectionId':_0x51b30f['id']},{})[_0x43ca('0x45')](function(){return _0x18c4c0;});}else{return _0x18c4c0;}})[_0x43ca('0x4c')](function(_0x5cf200){logger['error'](_0x43ca('0x56'),_0x5cf200);throw _0x5cf200;});}return _0x18c4c0;})[_0x43ca('0x45')](respondWithResult(_0x2180d8,0xc9))[_0x43ca('0x4c')](handleError(_0x2180d8,null));};exports[_0x43ca('0x2b')]=function(_0x3df3e3,_0x2d7914){if(_0x3df3e3[_0x43ca('0x4e')]['id']){delete _0x3df3e3[_0x43ca('0x4e')]['id'];}return db[_0x43ca('0x31')][_0x43ca('0x57')]({'where':{'id':_0x3df3e3[_0x43ca('0x49')]['id']}})[_0x43ca('0x45')](handleEntityNotFound(_0x2d7914,null))[_0x43ca('0x45')](saveUpdates(_0x3df3e3[_0x43ca('0x4e')],null))[_0x43ca('0x45')](respondWithResult(_0x2d7914,null))[_0x43ca('0x4c')](handleError(_0x2d7914,null));};exports[_0x43ca('0x58')]=function(_0x11a6dd,_0x30f6a4){var _0x446966=_0x11a6dd['params']['id'];var _0x5b33b5=[];return db[_0x43ca('0x59')][_0x43ca('0x5a')](function(_0x4cea04){var _0x46d85d='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x446966;return db[_0x43ca('0x59')][_0x43ca('0x37')](_0x46d85d,{'type':db[_0x43ca('0x5b')][_0x43ca('0x5c')]['SELECT'],'raw':!![],'transaction':_0x4cea04})['then'](function(_0x4f9230){_0x5b33b5=_[_0x43ca('0x30')](_0x4f9230,function(_0x545f52){return Number(_0x545f52['UserId']);});})['then'](function(){var _0x8158c1='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x446966;return db[_0x43ca('0x59')][_0x43ca('0x37')](_0x8158c1,{'type':db[_0x43ca('0x5b')][_0x43ca('0x5c')][_0x43ca('0x5d')],'raw':!![],'transaction':_0x4cea04});})[_0x43ca('0x45')](function(_0x31469e){var _0x5cedc2=_[_0x43ca('0x30')](_0x31469e,function(_0x2abde7){return Number(_0x2abde7['VoiceQueueId']);});return db[_0x43ca('0x5e')]['destroy']({'where':{'UserId':{'$in':_0x5b33b5},'VoiceQueueId':{'$in':_0x5cedc2}},'transaction':_0x4cea04});})[_0x43ca('0x45')](function(){var _0x2a2d99=_0x43ca('0x5f')+_0x446966;return db[_0x43ca('0x59')]['query'](_0x2a2d99,{'type':db[_0x43ca('0x5b')]['QueryTypes'][_0x43ca('0x5d')],'raw':!![],'transaction':_0x4cea04});})[_0x43ca('0x45')](function(_0x284eb1){var _0x45dc90=_[_0x43ca('0x30')](_0x284eb1,function(_0x53c449){return Number(_0x53c449[_0x43ca('0x60')]);});return db[_0x43ca('0x61')]['destroy']({'where':{'UserId':{'$in':_0x5b33b5},'MailQueueId':{'$in':_0x45dc90}},'transaction':_0x4cea04});})[_0x43ca('0x45')](function(){var _0x53f031=_0x43ca('0x62')+_0x446966;return db[_0x43ca('0x59')][_0x43ca('0x37')](_0x53f031,{'type':db[_0x43ca('0x5b')]['QueryTypes'][_0x43ca('0x5d')],'raw':!![],'transaction':_0x4cea04});})[_0x43ca('0x45')](function(_0x4605f9){var _0xd0ca3e=_[_0x43ca('0x30')](_0x4605f9,function(_0x413224){return Number(_0x413224['SmsQueueId']);});return db[_0x43ca('0x63')][_0x43ca('0x58')]({'where':{'UserId':{'$in':_0x5b33b5},'SmsQueueId':{'$in':_0xd0ca3e}},'transaction':_0x4cea04});})[_0x43ca('0x45')](function(){var _0x94708e=_0x43ca('0x64')+_0x446966;return db[_0x43ca('0x59')][_0x43ca('0x37')](_0x94708e,{'type':db['Sequelize'][_0x43ca('0x5c')][_0x43ca('0x5d')],'raw':!![],'transaction':_0x4cea04});})[_0x43ca('0x45')](function(_0x3524af){var _0x39173e=_[_0x43ca('0x30')](_0x3524af,function(_0x271efe){return Number(_0x271efe[_0x43ca('0x65')]);});return db[_0x43ca('0x66')]['destroy']({'where':{'UserId':{'$in':_0x5b33b5},'ChatQueueId':{'$in':_0x39173e}},'transaction':_0x4cea04});})[_0x43ca('0x45')](function(){var _0x4c9c44='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x446966;return db[_0x43ca('0x59')][_0x43ca('0x37')](_0x4c9c44,{'type':db['Sequelize']['QueryTypes'][_0x43ca('0x5d')],'raw':!![],'transaction':_0x4cea04});})[_0x43ca('0x45')](function(_0x13abe5){var _0xb909ab=_[_0x43ca('0x30')](_0x13abe5,function(_0x2d9b5c){return Number(_0x2d9b5c[_0x43ca('0x67')]);});return db[_0x43ca('0x68')]['destroy']({'where':{'UserId':{'$in':_0x5b33b5},'FaxQueueId':{'$in':_0xb909ab}},'transaction':_0x4cea04});})[_0x43ca('0x45')](function(){var _0x9d1f8f=_0x43ca('0x69')+_0x446966;return db[_0x43ca('0x59')][_0x43ca('0x37')](_0x9d1f8f,{'type':db[_0x43ca('0x5b')]['QueryTypes'][_0x43ca('0x5d')],'raw':!![],'transaction':_0x4cea04});})[_0x43ca('0x45')](function(_0x4a6c04){var _0x2c9e16=_[_0x43ca('0x30')](_0x4a6c04,function(_0xd329a9){return Number(_0xd329a9[_0x43ca('0x6a')]);});return db[_0x43ca('0x6b')][_0x43ca('0x58')]({'where':{'UserId':{'$in':_0x5b33b5},'OpenchannelQueueId':{'$in':_0x2c9e16}},'transaction':_0x4cea04});})['then'](function(){var _0x3af842=_0x43ca('0x6c')+_0x446966;return db[_0x43ca('0x59')][_0x43ca('0x37')](_0x3af842,{'type':db[_0x43ca('0x5b')][_0x43ca('0x5c')][_0x43ca('0x5d')],'raw':!![],'transaction':_0x4cea04});})['then'](function(_0x487b82){var _0x420817=_['map'](_0x487b82,function(_0x299736){return Number(_0x299736[_0x43ca('0x6d')]);});return db['UserWhatsappQueue']['destroy']({'where':{'UserId':{'$in':_0x5b33b5},'WhatsappQueueId':{'$in':_0x420817}},'transaction':_0x4cea04});})[_0x43ca('0x45')](function(){return db['TeamVoicePrefix']['find']({'where':{'TeamId':_0x446966}});})['then'](function(_0x179543){if(_0x179543===null){return;}return db[_0x43ca('0x6e')][_0x43ca('0x58')]({'where':{'UserId':{'$in':_0x5b33b5},'VoicePrefixId':_0x179543['VoicePrefixId']},'transaction':_0x4cea04});})[_0x43ca('0x45')](function(){return db[_0x43ca('0x31')][_0x43ca('0x58')]({'where':{'id':_0x446966},'cascade':!![],'transaction':_0x4cea04});})[_0x43ca('0x45')](function(_0x1f4a72){if(_0x1f4a72===0x0){_0x30f6a4['sendStatus'](0x194);}else{return db['UserProfileResource'][_0x43ca('0x58')]({'where':{'type':'Teams','resourceId':_0x446966},'cascade':!![],'transaction':_0x4cea04})[_0x43ca('0x45')](function(){_0x30f6a4[_0x43ca('0x20')](0xcc)[_0x43ca('0x21')]();});}})[_0x43ca('0x4c')](function(_0x1265c2){_0x30f6a4[_0x43ca('0x20')](0x1f4)[_0x43ca('0x2e')](_0x1265c2);});});};exports[_0x43ca('0x6f')]=function(_0x491155,_0x190cef,_0x2f99ce){return db['Team']['findOne']({'where':{'id':_0x491155[_0x43ca('0x49')]['id']}})[_0x43ca('0x45')](handleEntityNotFound(_0x190cef,null))[_0x43ca('0x45')](function(_0x292141){if(!_0x491155[_0x43ca('0x37')]['channel']||!utils[_0x43ca('0x70')](_0x491155['query']['channel'])){throw new db['Sequelize'][(_0x43ca('0x71'))](_0x43ca('0x72'));}var _0x54a9aa={};var _0x512a73={};_0x512a73[_0x43ca('0x36')]=_[_0x43ca('0x4a')](db[_[_0x43ca('0x73')](_0x491155[_0x43ca('0x37')][_0x43ca('0x74')][_0x43ca('0x75')]())+_0x43ca('0x76')][_0x43ca('0x32')]);_0x512a73[_0x43ca('0x37')]=_['keys'](_0x491155[_0x43ca('0x37')]);_0x512a73['filters']=_[_0x43ca('0x38')](_0x512a73[_0x43ca('0x36')],_0x512a73[_0x43ca('0x37')]);_0x54a9aa[_0x43ca('0x3a')]=_[_0x43ca('0x38')](_0x512a73[_0x43ca('0x36')],qs['fields'](_0x491155['query'][_0x43ca('0x39')]));_0x54a9aa[_0x43ca('0x3a')]=_0x54a9aa['attributes'][_0x43ca('0x77')]?_0x54a9aa[_0x43ca('0x3a')]:_0x512a73[_0x43ca('0x36')];_0x54a9aa[_0x43ca('0x25')]=qs[_0x43ca('0x25')](_0x491155[_0x43ca('0x37')]['limit']);_0x54a9aa[_0x43ca('0x24')]=qs[_0x43ca('0x24')](_0x491155[_0x43ca('0x37')]['offset']);_0x54a9aa['order']=qs[_0x43ca('0x3d')](_0x491155[_0x43ca('0x37')][_0x43ca('0x3d')]);_0x54a9aa[_0x43ca('0x3e')]=qs[_0x43ca('0x3f')](_[_0x43ca('0x40')](_0x491155[_0x43ca('0x37')],_0x512a73[_0x43ca('0x3f')]));_0x54a9aa=_[_0x43ca('0x43')]({},_0x54a9aa,_0x491155[_0x43ca('0x44')]);return _0x292141[_0x43ca('0x50')+_[_0x43ca('0x73')](_0x491155[_0x43ca('0x37')][_0x43ca('0x74')]['toLowerCase']())+_0x43ca('0x78')](_0x54a9aa);})['then'](respondWithResult(_0x190cef,null))['catch'](handleError(_0x190cef,null));};exports[_0x43ca('0x79')]=function(_0x90750a,_0x374f78,_0x445c7b){return db[_0x43ca('0x31')][_0x43ca('0x7a')]({'where':{'id':_0x90750a[_0x43ca('0x49')]['id']}})[_0x43ca('0x45')](function(_0x153dd5){if(_0x153dd5){if(!_0x90750a[_0x43ca('0x4e')][_0x43ca('0x74')]||!utils[_0x43ca('0x70')](_0x90750a[_0x43ca('0x4e')][_0x43ca('0x74')])){throw new db[(_0x43ca('0x5b'))][(_0x43ca('0x71'))]('Unknown\x20channel');}return _0x153dd5['add'+_[_0x43ca('0x73')](_0x90750a[_0x43ca('0x4e')][_0x43ca('0x74')][_0x43ca('0x75')]())+'Queues'](_0x90750a[_0x43ca('0x4e')]['ids']);}return null;})['then'](handleEntityNotFound(_0x374f78,null))[_0x43ca('0x45')](respondWithStatusCode(_0x374f78,null))[_0x43ca('0x4c')](handleError(_0x374f78,null));};exports[_0x43ca('0x7b')]=function(_0x48d365,_0x1b1ea8,_0x39ffc3){return db[_0x43ca('0x31')][_0x43ca('0x7a')]({'where':{'id':_0x48d365['params']['id']}})['then'](function(_0x465489){if(_0x465489){if(!_0x48d365[_0x43ca('0x37')]['channel']||!utils[_0x43ca('0x70')](_0x48d365[_0x43ca('0x37')][_0x43ca('0x74')])){throw new db['Sequelize'][(_0x43ca('0x71'))](_0x43ca('0x72'));}return _0x465489['remove'+_[_0x43ca('0x73')](_0x48d365[_0x43ca('0x37')][_0x43ca('0x74')][_0x43ca('0x75')]())+_0x43ca('0x78')](_0x48d365['query'][_0x43ca('0x7c')]);}return null;})[_0x43ca('0x45')](handleEntityNotFound(_0x1b1ea8,null))[_0x43ca('0x45')](respondWithStatusCode(_0x1b1ea8,null))['catch'](handleError(_0x1b1ea8,null));};exports[_0x43ca('0x7d')]=function(_0x5c456a,_0x23ed01){var _0x505bf0=_[_0x43ca('0x7e')](_0x5c456a[_0x43ca('0x4e')][_0x43ca('0x7c')])?_0x5c456a['body'][_0x43ca('0x7c')]:[_0x5c456a[_0x43ca('0x4e')][_0x43ca('0x7c')]];var _0x179158=_0x5c456a[_0x43ca('0x49')]['id'];return db[_0x43ca('0x31')][_0x43ca('0x57')]({'where':{'id':_0x179158}})[_0x43ca('0x45')](handleEntityNotFound(_0x23ed01,null))[_0x43ca('0x45')](function(_0x1f1c6d){if(_0x1f1c6d){var _0x104c26=[_0x43ca('0x7f'),_0x43ca('0x80'),_0x43ca('0x81'),_0x43ca('0x82'),_0x43ca('0x83'),'Openchannel',_0x43ca('0x84')];return db[_0x43ca('0x59')][_0x43ca('0x5a')](function(_0x5241e1){var _0x4f8310=_[_0x43ca('0x30')](_0x104c26,function(_0x20e313){var _0x425cf4={'attributes':['id','name']};if(_0x20e313===_0x43ca('0x7f')){_0x425cf4[_0x43ca('0x85')]={'attributes':[_0x43ca('0x86')]};}return _0x1f1c6d[_0x43ca('0x50')+_0x20e313+'Queues'](_0x425cf4)[_0x43ca('0x45')](function(_0x2d9386){var _0x12a3b7=_['map'](_0x2d9386,function(_0x261cdb){var _0x2c5185=_[_0x43ca('0x30')](_0x505bf0,function(_0x4adc40){var _0x1db6a7={'where':{'UserId':_0x4adc40,[_0x20e313+_0x43ca('0x87')]:_0x261cdb['id']},'transaction':_0x5241e1};if(_0x20e313===_0x43ca('0x7f')){_0x1db6a7[_0x43ca('0x1a')]={'penalty':_0x261cdb[_0x43ca('0x88')][_0x43ca('0x86')]};}return db[_0x43ca('0x89')+_0x20e313+_0x43ca('0x76')]['findOrCreate'](_0x1db6a7)['then'](function(){socket[_0x43ca('0x8a')](_0x43ca('0x4f')+_0x20e313+_0x43ca('0x8b'),{'UserId':_0x4adc40,[_0x20e313+_0x43ca('0x87')]:_0x261cdb['id']});if(_0x20e313!==_0x43ca('0x7f')){return;}return db['User']['findAll']({'where':{'id':_0x505bf0,'online':0x1},'attributes':['id','name',_0x43ca('0x8c'),'voicePause',_0x43ca('0x8d')],'raw':!![]})['then'](function(_0x192526){var _0x646285=_['map'](_0x192526,function(_0x2316ee){return db[_0x43ca('0x8e')]['upsert']({'membername':_0x2316ee[_0x43ca('0x2d')],'UserId':_0x2316ee['id'],'queue_name':_0x261cdb['name'],'VoiceQueueId':_0x261cdb['id'],'interface':_[_0x43ca('0x8f')](_0x2316ee[_0x43ca('0x8d')])?util[_0x43ca('0x90')](_0x43ca('0x91'),_0x2316ee['name']):_0x2316ee['interface'],'paused':_0x2316ee[_0x43ca('0x92')]||![],'penalty':_0x261cdb[_0x43ca('0x88')][_0x43ca('0x86')]},{'transaction':_0x5241e1});});return Promise['all'](_0x646285);});});});return Promise[_0x43ca('0x93')](_0x2c5185);});return Promise[_0x43ca('0x93')](_0x12a3b7);})[_0x43ca('0x45')](function(){return db['TeamVoicePrefix'][_0x43ca('0x7a')]({'where':{'teamId':_0x179158}})[_0x43ca('0x45')](function(_0x345cde){if(_0x345cde){var _0x480fac=_[_0x43ca('0x30')](_0x505bf0,function(_0x4749c0){db[_0x43ca('0x6e')][_0x43ca('0x94')]({'UserId':_0x4749c0,'VoicePrefixId':_0x345cde[_0x43ca('0x95')]});});return Promise['all'](_0x480fac);}});});});return Promise['all'](_0x4f8310)[_0x43ca('0x45')](function(){return _0x1f1c6d['addAgents'](_0x505bf0,{'transaction':_0x5241e1})[_0x43ca('0x96')](function(_0x321688){return _0x321688;});});});}})[_0x43ca('0x45')](respondWithResult(_0x23ed01,null))[_0x43ca('0x4c')](handleError(_0x23ed01,null));};exports['removeAgents']=function(_0x3ff022,_0x481ea8){var _0x545953=_[_0x43ca('0x7e')](_0x3ff022[_0x43ca('0x37')][_0x43ca('0x7c')])?_0x3ff022[_0x43ca('0x37')][_0x43ca('0x7c')]:[_0x3ff022[_0x43ca('0x37')][_0x43ca('0x7c')]];var _0x42f648=_0x3ff022[_0x43ca('0x49')]['id'];return db['Team'][_0x43ca('0x57')]({'where':{'id':_0x42f648}})[_0x43ca('0x45')](handleEntityNotFound(_0x481ea8,null))[_0x43ca('0x45')](function(_0x214f21){if(_0x214f21){var _0x1bd3b8=['Voice',_0x43ca('0x80'),_0x43ca('0x81'),_0x43ca('0x82'),_0x43ca('0x83'),'Openchannel','Whatsapp'];return db[_0x43ca('0x59')]['transaction'](function(_0x2edfe2){var _0x537640=_[_0x43ca('0x30')](_0x1bd3b8,function(_0x3b19f){var _0xb9cafb={'attributes':['id',_0x43ca('0x2d')]};return _0x214f21['get'+_0x3b19f+_0x43ca('0x78')](_0xb9cafb)[_0x43ca('0x45')](function(_0x42a0ea){var _0x8e225=_[_0x43ca('0x30')](_0x42a0ea,function(_0x2a890d){return _0x2a890d['removeAgents'](_0x545953,{'transaction':_0x2edfe2})['then'](function(){var _0x5b72b4=_['map'](_0x545953,function(_0x2b9493){socket[_0x43ca('0x8a')](_0x43ca('0x4f')+_0x3b19f+_0x43ca('0x97'),{'UserId':Number(_0x2b9493),[_0x3b19f+_0x43ca('0x87')]:_0x2a890d['id']});if(_0x3b19f!==_0x43ca('0x7f')){return;}return db[_0x43ca('0x8e')][_0x43ca('0x58')]({'where':{'VoiceQueueId':_0x2a890d['id'],'UserId':_0x2b9493},'transaction':_0x2edfe2});});return Promise[_0x43ca('0x93')](_0x5b72b4);});});return Promise[_0x43ca('0x93')](_0x8e225);});});return Promise[_0x43ca('0x93')](_0x537640)['then'](function(){return _0x214f21['removeAgents'](_0x545953,{'transaction':_0x2edfe2});})['then'](function(){return db[_0x43ca('0x98')]['findOne']({'where':{'teamId':_0x42f648}})[_0x43ca('0x45')](function(_0x5076f4){if(_0x5076f4){var _0x247715=_[_0x43ca('0x30')](_0x545953,function(_0x33b1be){db[_0x43ca('0x6e')][_0x43ca('0x58')]({'where':{'UserId':_0x33b1be,'VoicePrefixId':_0x5076f4[_0x43ca('0x95')]}});});return Promise[_0x43ca('0x93')](_0x247715);}});});});}})[_0x43ca('0x45')](respondWithStatusCode(_0x481ea8,null))[_0x43ca('0x4c')](handleError(_0x481ea8,null));};exports['getAgents']=function(_0x593483,_0x176dbd,_0x1b5f36){var _0x580da6={};var _0x481405={};var _0x2262ad;var _0x732777;return db[_0x43ca('0x31')]['findOne']({'where':{'id':_0x593483[_0x43ca('0x49')]['id']}})[_0x43ca('0x45')](handleEntityNotFound(_0x176dbd,null))[_0x43ca('0x45')](function(_0x5a5011){if(_0x5a5011){_0x2262ad=_0x5a5011;_0x481405[_0x43ca('0x36')]=_[_0x43ca('0x4a')](db[_0x43ca('0x89')][_0x43ca('0x32')]);_0x481405[_0x43ca('0x37')]=_['keys'](_0x593483[_0x43ca('0x37')]);_0x481405['filters']=_[_0x43ca('0x38')](_0x481405['model'],_0x481405[_0x43ca('0x37')]);_0x580da6['attributes']=_[_0x43ca('0x38')](_0x481405[_0x43ca('0x36')],qs[_0x43ca('0x39')](_0x593483[_0x43ca('0x37')]['fields']));_0x580da6[_0x43ca('0x3a')]=_0x580da6[_0x43ca('0x3a')]['length']?_0x580da6['attributes']:_0x481405['model'];_0x580da6[_0x43ca('0x99')]=qs[_0x43ca('0x3d')](_0x593483['query'][_0x43ca('0x3d')]);_0x580da6[_0x43ca('0x3e')]=qs[_0x43ca('0x3f')](_[_0x43ca('0x40')](_0x593483[_0x43ca('0x37')],_0x481405[_0x43ca('0x3f')]));if(_0x593483[_0x43ca('0x37')][_0x43ca('0x41')]){_0x580da6[_0x43ca('0x3e')]=_[_0x43ca('0x43')](_0x580da6[_0x43ca('0x3e')],{'$or':_[_0x43ca('0x30')](_0x580da6[_0x43ca('0x3a')],function(_0x4caaa4){var _0x577599={};_0x577599[_0x4caaa4]={'$like':'%'+_0x593483[_0x43ca('0x37')][_0x43ca('0x41')]+'%'};return _0x577599;})});}_0x580da6=_[_0x43ca('0x43')]({},_0x580da6,_0x593483['options']);return _0x2262ad['getAgents'](_0x580da6);}})[_0x43ca('0x45')](function(_0x9e58ba){if(_0x9e58ba){_0x732777=_0x9e58ba[_0x43ca('0x77')];if(!_0x593483[_0x43ca('0x37')][_0x43ca('0x3b')](_0x43ca('0x3c'))){_0x580da6['limit']=qs['limit'](_0x593483['query']['limit']);_0x580da6['offset']=qs[_0x43ca('0x24')](_0x593483[_0x43ca('0x37')][_0x43ca('0x24')]);}return _0x2262ad[_0x43ca('0x9a')](_0x580da6);}})[_0x43ca('0x45')](function(_0x10695e){if(_0x10695e){return _0x10695e?{'count':_0x732777,'rows':_0x10695e}:null;}})['then'](respondWithResult(_0x176dbd,null))['catch'](handleError(_0x176dbd,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 3c23614..c5a42bf 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 _0x7605=['hasOwnProperty','hook','events','Team','setMaxListeners','remove','emit'];(function(_0xb725be,_0x45bd01){var _0x2f2424=function(_0x2566ca){while(--_0x2566ca){_0xb725be['push'](_0xb725be['shift']());}};_0x2f2424(++_0x45bd01);}(_0x7605,0x1ec));var _0x5760=function(_0x21e0b1,_0x39b9af){_0x21e0b1=_0x21e0b1-0x0;var _0x1e8f5a=_0x7605[_0x21e0b1];return _0x1e8f5a;};'use strict';var EventEmitter=require(_0x5760('0x0'));var Team=require('../../mysqldb')['db'][_0x5760('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x5760('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5760('0x3')};function emitEvent(_0x4be3f3){return function(_0x118c2c,_0x3f46c8,_0x2bee37){TeamEvents[_0x5760('0x4')](_0x4be3f3+':'+_0x118c2c['id'],_0x118c2c);TeamEvents[_0x5760('0x4')](_0x4be3f3,_0x118c2c);_0x2bee37(null);};}for(var e in events){if(events[_0x5760('0x5')](e)){var event=events[e];Team[_0x5760('0x6')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0xddf5=['exports','events','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x22074d,_0x33df85){var _0x3a24ce=function(_0x1dfb83){while(--_0x1dfb83){_0x22074d['push'](_0x22074d['shift']());}};_0x3a24ce(++_0x33df85);}(_0xddf5,0xa1));var _0x5ddf=function(_0x2a3653,_0x56be80){_0x2a3653=_0x2a3653-0x0;var _0x3cbd1c=_0xddf5[_0x2a3653];return _0x3cbd1c;};'use strict';var EventEmitter=require(_0x5ddf('0x0'));var Team=require('../../mysqldb')['db'][_0x5ddf('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x5ddf('0x2')](0x0);var events={'afterCreate':_0x5ddf('0x3'),'afterUpdate':_0x5ddf('0x4'),'afterDestroy':_0x5ddf('0x5')};function emitEvent(_0x40de0f){return function(_0x40fea6,_0x434467,_0x226134){TeamEvents['emit'](_0x40de0f+':'+_0x40fea6['id'],_0x40fea6);TeamEvents[_0x5ddf('0x6')](_0x40de0f,_0x40fea6);_0x226134(null);};}for(var e in events){if(events[_0x5ddf('0x7')](e)){var event=events[e];Team[_0x5ddf('0x8')](e,emitEvent(event));}}module[_0x5ddf('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 061625d..6a7aece 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 _0x3f55=['Sms','Whatsapp','resolve','all','lodash','Queues','then','map','setDataValue','channel','catch','exports','define','Team','teams','Chat','Fax','Mail','Openchannel'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x3f55,0xaf));var _0x53f5=function(_0x3d71a3,_0x3a33b7){_0x3d71a3=_0x3d71a3-0x0;var _0x5bb3ab=_0x3f55[_0x3d71a3];return _0x5bb3ab;};'use strict';var _=require(_0x53f5('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x2fb471,_0x1b9ee8){var _0x1affb7='get'+_0x1b9ee8+_0x53f5('0x1');return _0x2fb471[_0x1affb7]()[_0x53f5('0x2')](function(_0x31082a){return _[_0x53f5('0x3')](_0x31082a,function(_0x103cf6){_0x103cf6[_0x53f5('0x4')](_0x53f5('0x5'),_0x1b9ee8);return _0x103cf6;});})[_0x53f5('0x6')](function(_0x573a17){throw _0x573a17;});}module[_0x53f5('0x7')]=function(_0x5a90d9){return _0x5a90d9[_0x53f5('0x8')](_0x53f5('0x9'),attributes,{'tableName':_0x53f5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x3a94e6=this;var _0x3eba96=[_0x53f5('0xb'),_0x53f5('0xc'),_0x53f5('0xd'),_0x53f5('0xe'),_0x53f5('0xf'),'Voice',_0x53f5('0x10')];return Promise[_0x53f5('0x11')]()[_0x53f5('0x2')](function(){var _0x238bff=_['map'](_0x3eba96,function(_0x5163b6){return getQueuesByChannel(_0x3a94e6,_0x5163b6);});return Promise[_0x53f5('0x12')](_0x238bff);})[_0x53f5('0x6')](function(_0x3119b4){throw _0x3119b4;});}}});}; \ No newline at end of file +var _0xbdec=['teams','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','map','all','lodash','./team.attributes','get','then','setDataValue','catch','exports','Team'];(function(_0x31e5cb,_0x2f5adf){var _0x4170df=function(_0x31c53e){while(--_0x31c53e){_0x31e5cb['push'](_0x31e5cb['shift']());}};_0x4170df(++_0x2f5adf);}(_0xbdec,0x64));var _0xcbde=function(_0x2618d5,_0x40996a){_0x2618d5=_0x2618d5-0x0;var _0x3d9e60=_0xbdec[_0x2618d5];return _0x3d9e60;};'use strict';var _=require(_0xcbde('0x0'));var attributes=require(_0xcbde('0x1'));function getQueuesByChannel(_0x4bce29,_0x709f21){var _0x16b159=_0xcbde('0x2')+_0x709f21+'Queues';return _0x4bce29[_0x16b159]()[_0xcbde('0x3')](function(_0x342cdb){return _['map'](_0x342cdb,function(_0x2cb0f4){_0x2cb0f4[_0xcbde('0x4')]('channel',_0x709f21);return _0x2cb0f4;});})[_0xcbde('0x5')](function(_0x579795){throw _0x579795;});}module[_0xcbde('0x6')]=function(_0x535601){return _0x535601['define'](_0xcbde('0x7'),attributes,{'tableName':_0xcbde('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5647d8=this;var _0x3bc995=['Chat',_0xcbde('0x9'),_0xcbde('0xa'),_0xcbde('0xb'),_0xcbde('0xc'),_0xcbde('0xd'),_0xcbde('0xe')];return Promise[_0xcbde('0xf')]()['then'](function(){var _0x5e3519=_[_0xcbde('0x10')](_0x3bc995,function(_0x119859){return getQueuesByChannel(_0x5647d8,_0x119859);});return Promise[_0xcbde('0x11')](_0x5e3519);})[_0xcbde('0x5')](function(_0x4d7235){throw _0x4d7235;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index b37ffd3..5956ecb 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 _0xacd3=['request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','Team,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','./team.socket','register','then','info'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xacd3,0x70));var _0x3acd=function(_0x3203f7,_0x16e652){_0x3203f7=_0x3203f7-0x0;var _0x58dd36=_0xacd3[_0x3203f7];return _0x58dd36;};'use strict';var _=require(_0x3acd('0x0'));var util=require(_0x3acd('0x1'));var moment=require(_0x3acd('0x2'));var BPromise=require(_0x3acd('0x3'));var rs=require(_0x3acd('0x4'));var fs=require('fs');var Redis=require(_0x3acd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3acd('0x6'));var logger=require(_0x3acd('0x7'))('rpc');var config=require(_0x3acd('0x8'));var jayson=require(_0x3acd('0x9'));var client=jayson[_0x3acd('0xa')][_0x3acd('0xb')]({'port':0x232a});config['redis']=_[_0x3acd('0xc')](config[_0x3acd('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3acd('0xd')]));require(_0x3acd('0xe'))[_0x3acd('0xf')](socket);function respondWithRpcPromise(_0xa835e8,_0x3971a4,_0xea2f0b){return new BPromise(function(_0x5c2f64,_0xc1c595){return client['request'](_0xa835e8,_0xea2f0b)[_0x3acd('0x10')](function(_0xd723f9){logger[_0x3acd('0x11')]('Team,\x20%s,\x20%s',_0x3971a4,_0x3acd('0x12'));logger[_0x3acd('0x13')](_0x3acd('0x14'),_0x3971a4,_0x3acd('0x12'),JSON[_0x3acd('0x15')](_0xd723f9));if(_0xd723f9['error']){if(_0xd723f9['error']['code']===0x1f4){logger[_0x3acd('0x16')](_0x3acd('0x17'),_0x3971a4,_0xd723f9['error'][_0x3acd('0x18')]);return _0xc1c595(_0xd723f9[_0x3acd('0x16')][_0x3acd('0x18')]);}logger[_0x3acd('0x16')](_0x3acd('0x17'),_0x3971a4,_0xd723f9[_0x3acd('0x16')][_0x3acd('0x18')]);return _0x5c2f64(_0xd723f9[_0x3acd('0x16')][_0x3acd('0x18')]);}else{logger[_0x3acd('0x11')](_0x3acd('0x17'),_0x3971a4,'request\x20sent');_0x5c2f64(_0xd723f9[_0x3acd('0x19')]['message']);}})['catch'](function(_0x4f5dee){logger[_0x3acd('0x16')](_0x3acd('0x17'),_0x3971a4,_0x4f5dee);_0xc1c595(_0x4f5dee);});});} \ No newline at end of file +var _0x2112=['request','info','Team,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register'];(function(_0x3623f6,_0x462f31){var _0x4ae68a=function(_0x54a07a){while(--_0x54a07a){_0x3623f6['push'](_0x3623f6['shift']());}};_0x4ae68a(++_0x462f31);}(_0x2112,0x14a));var _0x2211=function(_0x22c94a,_0x4d7ff0){_0x22c94a=_0x22c94a-0x0;var _0x2d0c75=_0x2112[_0x22c94a];return _0x2d0c75;};'use strict';var _=require(_0x2211('0x0'));var util=require(_0x2211('0x1'));var moment=require(_0x2211('0x2'));var BPromise=require('bluebird');var rs=require(_0x2211('0x3'));var fs=require('fs');var Redis=require(_0x2211('0x4'));var db=require(_0x2211('0x5'))['db'];var utils=require(_0x2211('0x6'));var logger=require('../../config/logger')(_0x2211('0x7'));var config=require(_0x2211('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2211('0x9')][_0x2211('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2211('0xb')],{'host':_0x2211('0xc'),'port':0x18eb});var socket=require(_0x2211('0xd'))(new Redis(config[_0x2211('0xb')]));require('./team.socket')[_0x2211('0xe')](socket);function respondWithRpcPromise(_0x5a2e6b,_0x204f46,_0x27ec44){return new BPromise(function(_0x115d22,_0x33beb9){return client[_0x2211('0xf')](_0x5a2e6b,_0x27ec44)['then'](function(_0x43c4f9){logger[_0x2211('0x10')](_0x2211('0x11'),_0x204f46,'request\x20sent');logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x204f46,_0x2211('0x12'),JSON['stringify'](_0x43c4f9));if(_0x43c4f9[_0x2211('0x13')]){if(_0x43c4f9['error'][_0x2211('0x14')]===0x1f4){logger[_0x2211('0x13')](_0x2211('0x11'),_0x204f46,_0x43c4f9['error']['message']);return _0x33beb9(_0x43c4f9[_0x2211('0x13')][_0x2211('0x15')]);}logger['error'](_0x2211('0x11'),_0x204f46,_0x43c4f9[_0x2211('0x13')][_0x2211('0x15')]);return _0x115d22(_0x43c4f9[_0x2211('0x13')]['message']);}else{logger[_0x2211('0x10')](_0x2211('0x11'),_0x204f46,'request\x20sent');_0x115d22(_0x43c4f9['result'][_0x2211('0x15')]);}})[_0x2211('0x16')](function(_0x36ba01){logger[_0x2211('0x13')](_0x2211('0x11'),_0x204f46,_0x36ba01);_0x33beb9(_0x36ba01);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 2962dae..80d3fcc 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 _0x19c7=['emit','removeListener','register','length','team:','save','remove','update'];(function(_0x16b992,_0x43d74c){var _0x385c78=function(_0x5c904){while(--_0x5c904){_0x16b992['push'](_0x16b992['shift']());}};_0x385c78(++_0x43d74c);}(_0x19c7,0x16d));var _0x719c=function(_0x5d5ce9,_0x202d6a){_0x5d5ce9=_0x5d5ce9-0x0;var _0x538547=_0x19c7[_0x5d5ce9];return _0x538547;};'use strict';var TeamEvents=require('./team.events');var events=[_0x719c('0x0'),_0x719c('0x1'),_0x719c('0x2')];function createListener(_0x6df9ba,_0x28ff12){return function(_0x761800){_0x28ff12[_0x719c('0x3')](_0x6df9ba,_0x761800);};}function removeListener(_0x144405,_0x3ad380){return function(){TeamEvents[_0x719c('0x4')](_0x144405,_0x3ad380);};}exports[_0x719c('0x5')]=function(_0x21db87){for(var _0x521b57=0x0,_0x2e7d0e=events[_0x719c('0x6')];_0x521b57<_0x2e7d0e;_0x521b57++){var _0x30af86=events[_0x521b57];var _0x178991=createListener(_0x719c('0x7')+_0x30af86,_0x21db87);TeamEvents['on'](_0x30af86,_0x178991);}}; \ No newline at end of file +var _0x48cb=['save','remove','update','emit','removeListener','register','length','./team.events'];(function(_0x281187,_0x5c7cb0){var _0x4c2c02=function(_0x83748b){while(--_0x83748b){_0x281187['push'](_0x281187['shift']());}};_0x4c2c02(++_0x5c7cb0);}(_0x48cb,0x16f));var _0xb48c=function(_0x6d3bc3,_0x45ff31){_0x6d3bc3=_0x6d3bc3-0x0;var _0x3c13e3=_0x48cb[_0x6d3bc3];return _0x3c13e3;};'use strict';var TeamEvents=require(_0xb48c('0x0'));var events=[_0xb48c('0x1'),_0xb48c('0x2'),_0xb48c('0x3')];function createListener(_0x53306f,_0x269cb5){return function(_0x5e27eb){_0x269cb5[_0xb48c('0x4')](_0x53306f,_0x5e27eb);};}function removeListener(_0x447481,_0x852166){return function(){TeamEvents[_0xb48c('0x5')](_0x447481,_0x852166);};}exports[_0xb48c('0x6')]=function(_0x46ed6b){for(var _0x512041=0x0,_0x51cec9=events[_0xb48c('0x7')];_0x512041<_0x51cec9;_0x512041++){var _0x6f840e=events[_0x512041];var _0x346c74=createListener('team:'+_0x6f840e,_0x46ed6b);TeamEvents['on'](_0x6f840e,_0x346c74);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index b94feeb..190331b 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 _0x5e14=['exports','INTEGER','sequelize'];(function(_0x551906,_0x569941){var _0x58bfb6=function(_0x1eb6de){while(--_0x1eb6de){_0x551906['push'](_0x551906['shift']());}};_0x58bfb6(++_0x569941);}(_0x5e14,0x164));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x45e1('0x0'));module[_0x45e1('0x1')]={'TeamId':{'type':Sequelize[_0x45e1('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x45e1('0x2')]}}; \ No newline at end of file +var _0xd909=['INTEGER','exports'];(function(_0x9f5593,_0x5928bc){var _0x2d0f51=function(_0x5c3909){while(--_0x5c3909){_0x9f5593['push'](_0x9f5593['shift']());}};_0x2d0f51(++_0x5928bc);}(_0xd909,0x1c1));var _0x9d90=function(_0x4939c0,_0x3b3e7f){_0x4939c0=_0x4939c0-0x0;var _0x5c7e06=_0xd909[_0x4939c0];return _0x5c7e06;};'use strict';var Sequelize=require('sequelize');module[_0x9d90('0x0')]={'TeamId':{'type':Sequelize[_0x9d90('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x9d90('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 84258d3..64f7a3f 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 _0xc698=['team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','path','../../config/environment','exports','define','TeamVoicePrefix'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc698,0x85));var _0x8c69=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xc698[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x8c69('0x0'));var util=require(_0x8c69('0x1'));var logger=require(_0x8c69('0x2'))(_0x8c69('0x3'));var moment=require(_0x8c69('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c69('0x5'));var rimraf=require('rimraf');var config=require(_0x8c69('0x6'));var attributes=require('./teamVoicePrefix.attributes');module[_0x8c69('0x7')]=function(_0x5e8069,_0x5c0109){return _0x5e8069[_0x8c69('0x8')](_0x8c69('0x9'),attributes,{'tableName':_0x8c69('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf60=['lodash','util','../../config/logger','bluebird','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','team_has_voice_prefixes'];(function(_0x3f825d,_0x403495){var _0x4ff6ed=function(_0x1458a8){while(--_0x1458a8){_0x3f825d['push'](_0x3f825d['shift']());}};_0x4ff6ed(++_0x403495);}(_0xaf60,0x82));var _0x0af6=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xaf60[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x0af6('0x0'));var util=require(_0x0af6('0x1'));var logger=require(_0x0af6('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0af6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0af6('0x4'));var config=require(_0x0af6('0x5'));var attributes=require(_0x0af6('0x6'));module[_0x0af6('0x7')]=function(_0x463023,_0x333ce1){return _0x463023[_0x0af6('0x8')]('TeamVoicePrefix',attributes,{'tableName':_0x0af6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index d7e8c66..7aae66b 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1bbb5a,_0x186179){var _0x4e27af=function(_0x3aa53d){while(--_0x3aa53d){_0x1bbb5a['push'](_0x1bbb5a['shift']());}};_0x4e27af(++_0x186179);}(_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 +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x341796,_0x2b2bb3){var _0x19d0bf=function(_0x359714){while(--_0x359714){_0x341796['push'](_0x341796['shift']());}};_0x19d0bf(++_0x2b2bb3);}(_0x70e0,0x17b));var _0x070e=function(_0x43e3b4,_0x1bd3b5){_0x43e3b4=_0x43e3b4-0x0;var _0x1b2b82=_0x70e0[_0x43e3b4];return _0x1b2b82;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 197adf4..8d1cf6f 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 _0x740a=['INTEGER','sequelize','exports'];(function(_0x380df2,_0x281a15){var _0x47f4df=function(_0x132241){while(--_0x132241){_0x380df2['push'](_0x380df2['shift']());}};_0x47f4df(++_0x281a15);}(_0x740a,0x175));var _0xa740=function(_0xfe5566,_0x5e541f){_0xfe5566=_0xfe5566-0x0;var _0x4ec1bd=_0x740a[_0xfe5566];return _0x4ec1bd;};'use strict';var Sequelize=require(_0xa740('0x0'));module[_0xa740('0x1')]={'penalty':{'type':Sequelize[_0xa740('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x19d9=['exports','sequelize'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x19d9,0xf7));var _0x919d=function(_0x478579,_0x5e1ddd){_0x478579=_0x478579-0x0;var _0x51b2cd=_0x19d9[_0x478579];return _0x51b2cd;};'use strict';var Sequelize=require(_0x919d('0x0'));module[_0x919d('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 639400a..a0b0ef8 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 _0x5a8c=['rimraf','../../config/environment','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5b2809,_0x48b226){var _0x572dee=function(_0x4b3e82){while(--_0x4b3e82){_0x5b2809['push'](_0x5b2809['shift']());}};_0x572dee(++_0x48b226);}(_0x5a8c,0x1da));var _0xc5a8=function(_0x2d554f,_0x284acd){_0x2d554f=_0x2d554f-0x0;var _0x579473=_0x5a8c[_0x2d554f];return _0x579473;};'use strict';var _=require(_0xc5a8('0x0'));var util=require(_0xc5a8('0x1'));var logger=require('../../config/logger')(_0xc5a8('0x2'));var moment=require(_0xc5a8('0x3'));var BPromise=require(_0xc5a8('0x4'));var rp=require(_0xc5a8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc5a8('0x6'));var config=require(_0xc5a8('0x7'));var attributes=require('./teamVoiceQueue.attributes');module[_0xc5a8('0x8')]=function(_0x3c8f1e,_0x373d40){return _0x3c8f1e[_0xc5a8('0x9')](_0xc5a8('0xa'),attributes,{'tableName':_0xc5a8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95d9=['request-promise','path','../../config/environment','./teamVoiceQueue.attributes','exports','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x365697,_0x539ff1){var _0x2979f5=function(_0x4d328e){while(--_0x4d328e){_0x365697['push'](_0x365697['shift']());}};_0x2979f5(++_0x539ff1);}(_0x95d9,0x97));var _0x995d=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x95d9[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x995d('0x0'));var util=require(_0x995d('0x1'));var logger=require(_0x995d('0x2'))(_0x995d('0x3'));var moment=require('moment');var BPromise=require(_0x995d('0x4'));var rp=require(_0x995d('0x5'));var fs=require('fs');var path=require(_0x995d('0x6'));var rimraf=require('rimraf');var config=require(_0x995d('0x7'));var attributes=require(_0x995d('0x8'));module[_0x995d('0x9')]=function(_0x226250,_0xe6d244){return _0x226250['define'](_0x995d('0xa'),attributes,{'tableName':_0x995d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 3bd173e..17f4741 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 _0xbefb=['request','then','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client'];(function(_0x3c25d7,_0x50ebd0){var _0xd8d3a6=function(_0xfa4124){while(--_0xfa4124){_0x3c25d7['push'](_0x3c25d7['shift']());}};_0xd8d3a6(++_0x50ebd0);}(_0xbefb,0x13c));var _0xbbef=function(_0x4d1d85,_0x24b672){_0x4d1d85=_0x4d1d85-0x0;var _0x5dedab=_0xbefb[_0x4d1d85];return _0x5dedab;};'use strict';var _=require(_0xbbef('0x0'));var util=require(_0xbbef('0x1'));var moment=require('moment');var BPromise=require(_0xbbef('0x2'));var rs=require(_0xbbef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbbef('0x4'))['db'];var utils=require(_0xbbef('0x5'));var logger=require(_0xbbef('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbbef('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3bbb5f,_0x1faba8,_0x14254c){return new BPromise(function(_0x4b86ca,_0x471cc1){return client[_0xbbef('0x8')](_0x3bbb5f,_0x14254c)[_0xbbef('0x9')](function(_0x345e5b){logger['info'](_0xbbef('0xa'),_0x1faba8,'request\x20sent');logger[_0xbbef('0xb')](_0xbbef('0xc'),_0x1faba8,_0xbbef('0xd'),JSON['stringify'](_0x345e5b));if(_0x345e5b['error']){if(_0x345e5b[_0xbbef('0xe')][_0xbbef('0xf')]===0x1f4){logger[_0xbbef('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1faba8,_0x345e5b['error'][_0xbbef('0x10')]);return _0x471cc1(_0x345e5b[_0xbbef('0xe')]['message']);}logger[_0xbbef('0xe')](_0xbbef('0xa'),_0x1faba8,_0x345e5b['error'][_0xbbef('0x10')]);return _0x4b86ca(_0x345e5b[_0xbbef('0xe')][_0xbbef('0x10')]);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x1faba8,_0xbbef('0xd'));_0x4b86ca(_0x345e5b['result'][_0xbbef('0x10')]);}})[_0xbbef('0x11')](function(_0x104137){logger[_0xbbef('0xe')](_0xbbef('0xa'),_0x1faba8,_0x104137);_0x471cc1(_0x104137);});});} \ No newline at end of file +var _0x547b=['../../config/environment','client','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x200d5c,_0x5d182a){var _0x3f6d10=function(_0x29c4d5){while(--_0x29c4d5){_0x200d5c['push'](_0x200d5c['shift']());}};_0x3f6d10(++_0x5d182a);}(_0x547b,0x150));var _0xb547=function(_0x3bdfa8,_0x3cd674){_0x3bdfa8=_0x3bdfa8-0x0;var _0x3cf63f=_0x547b[_0x3bdfa8];return _0x3cf63f;};'use strict';var _=require(_0xb547('0x0'));var util=require(_0xb547('0x1'));var moment=require(_0xb547('0x2'));var BPromise=require(_0xb547('0x3'));var rs=require(_0xb547('0x4'));var fs=require('fs');var Redis=require(_0xb547('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb547('0x6'));var logger=require(_0xb547('0x7'))(_0xb547('0x8'));var config=require(_0xb547('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb547('0xa')][_0xb547('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b82c7,_0x21e9e1,_0x5e8f98){return new BPromise(function(_0x49a877,_0x21a532){return client[_0xb547('0xc')](_0x5b82c7,_0x5e8f98)[_0xb547('0xd')](function(_0x2acded){logger['info'](_0xb547('0xe'),_0x21e9e1,'request\x20sent');logger['debug'](_0xb547('0xf'),_0x21e9e1,_0xb547('0x10'),JSON['stringify'](_0x2acded));if(_0x2acded['error']){if(_0x2acded['error'][_0xb547('0x11')]===0x1f4){logger[_0xb547('0x12')](_0xb547('0xe'),_0x21e9e1,_0x2acded[_0xb547('0x12')][_0xb547('0x13')]);return _0x21a532(_0x2acded[_0xb547('0x12')][_0xb547('0x13')]);}logger['error'](_0xb547('0xe'),_0x21e9e1,_0x2acded[_0xb547('0x12')][_0xb547('0x13')]);return _0x49a877(_0x2acded[_0xb547('0x12')][_0xb547('0x13')]);}else{logger[_0xb547('0x14')](_0xb547('0xe'),_0x21e9e1,_0xb547('0x10'));_0x49a877(_0x2acded[_0xb547('0x15')]['message']);}})[_0xb547('0x16')](function(_0x4336c5){logger[_0xb547('0x12')](_0xb547('0xe'),_0x21e9e1,_0x4336c5);_0x21a532(_0x4336c5);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index cf6b53e..19060c5 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 _0x6fad=['multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./template.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','exports'];(function(_0x420735,_0x3eda47){var _0x59d1d3=function(_0x540445){while(--_0x540445){_0x420735['push'](_0x420735['shift']());}};_0x59d1d3(++_0x3eda47);}(_0x6fad,0x17a));var _0xd6fa=function(_0x42db23,_0x112b01){_0x42db23=_0x42db23-0x0;var _0x2d1e4e=_0x6fad[_0x42db23];return _0x2d1e4e;};'use strict';var multer=require(_0xd6fa('0x0'));var util=require(_0xd6fa('0x1'));var path=require(_0xd6fa('0x2'));var timeout=require(_0xd6fa('0x3'));var express=require(_0xd6fa('0x4'));var router=express['Router']();var fs_extra=require(_0xd6fa('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd6fa('0x6'));var config=require('../../config/environment');var controller=require(_0xd6fa('0x7'));router['get']('/',auth[_0xd6fa('0x8')](),controller[_0xd6fa('0x9')]);router[_0xd6fa('0xa')](_0xd6fa('0xb'),auth[_0xd6fa('0x8')](),controller[_0xd6fa('0xc')]);router[_0xd6fa('0xd')]('/',auth['isAuthenticated'](),controller[_0xd6fa('0xe')]);router['put'](_0xd6fa('0xb'),auth[_0xd6fa('0x8')](),controller[_0xd6fa('0xf')]);router[_0xd6fa('0x10')](_0xd6fa('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xd6fa('0x11')]=router; \ No newline at end of file +var _0x341c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','index','/:id','isAuthenticated','show','create','put','update','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0x29f86a,_0x15f9c8){var _0x1825e1=function(_0xfcf82f){while(--_0xfcf82f){_0x29f86a['push'](_0x29f86a['shift']());}};_0x1825e1(++_0x15f9c8);}(_0x341c,0xcc));var _0xc341=function(_0x461b52,_0x20b9ed){_0x461b52=_0x461b52-0x0;var _0x2c3811=_0x341c[_0x461b52];return _0x2c3811;};'use strict';var multer=require(_0xc341('0x0'));var util=require('util');var path=require(_0xc341('0x1'));var timeout=require('connect-timeout');var express=require(_0xc341('0x2'));var router=express[_0xc341('0x3')]();var fs_extra=require(_0xc341('0x4'));var auth=require(_0xc341('0x5'));var interaction=require(_0xc341('0x6'));var config=require(_0xc341('0x7'));var controller=require(_0xc341('0x8'));router[_0xc341('0x9')]('/',auth['isAuthenticated'](),controller[_0xc341('0xa')]);router[_0xc341('0x9')](_0xc341('0xb'),auth[_0xc341('0xc')](),controller[_0xc341('0xd')]);router['post']('/',auth[_0xc341('0xc')](),controller[_0xc341('0xe')]);router[_0xc341('0xf')](_0xc341('0xb'),auth[_0xc341('0xc')](),controller[_0xc341('0x10')]);router['delete'](_0xc341('0xb'),auth[_0xc341('0xc')](),controller[_0xc341('0x11')]);module[_0xc341('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 76c7dd8..1669a77 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 _0x9e16=['sequelize','exports','STRING','TEXT'];(function(_0x161a18,_0x16f64b){var _0x5da98f=function(_0x170d62){while(--_0x170d62){_0x161a18['push'](_0x161a18['shift']());}};_0x5da98f(++_0x16f64b);}(_0x9e16,0x1b0));var _0x69e1=function(_0x3252d6,_0x3a3d28){_0x3252d6=_0x3252d6-0x0;var _0x7744d0=_0x9e16[_0x3252d6];return _0x7744d0;};'use strict';var Sequelize=require(_0x69e1('0x0'));module[_0x69e1('0x1')]={'name':{'type':Sequelize[_0x69e1('0x2')]},'description':{'type':Sequelize[_0x69e1('0x2')]},'html':{'type':Sequelize[_0x69e1('0x3')]}}; \ No newline at end of file +var _0x6bfe=['exports','TEXT','sequelize'];(function(_0x2e0e95,_0xcf1eff){var _0x173ef4=function(_0x23eb55){while(--_0x23eb55){_0x2e0e95['push'](_0x2e0e95['shift']());}};_0x173ef4(++_0xcf1eff);}(_0x6bfe,0x1e5));var _0xe6bf=function(_0x132a31,_0x129826){_0x132a31=_0x132a31-0x0;var _0x5b53db=_0x6bfe[_0x132a31];return _0x5b53db;};'use strict';var Sequelize=require(_0xe6bf('0x0'));module[_0xe6bf('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xe6bf('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index e87699f..cf8edb8 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 _0xee56=['query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','Template','findAll','rows','catch','show','params','keys','intersection','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','get','Templates','UserProfileResource','destroy','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','model'];(function(_0x497858,_0x321746){var _0x34baeb=function(_0x1473d7){while(--_0x1473d7){_0x497858['push'](_0x497858['shift']());}};_0x34baeb(++_0x321746);}(_0xee56,0x7a));var _0x6ee5=function(_0x1de4b8,_0x529b41){_0x1de4b8=_0x1de4b8-0x0;var _0x557699=_0xee56[_0x1de4b8];return _0x557699;};'use strict';var emlformat=require(_0x6ee5('0x0'));var rimraf=require(_0x6ee5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6ee5('0x2'));var rp=require(_0x6ee5('0x3'));var moment=require(_0x6ee5('0x4'));var BPromise=require(_0x6ee5('0x5'));var Mustache=require(_0x6ee5('0x6'));var util=require('util');var path=require(_0x6ee5('0x7'));var sox=require(_0x6ee5('0x8'));var csv=require(_0x6ee5('0x9'));var ejs=require(_0x6ee5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6ee5('0xb'));var squel=require(_0x6ee5('0xc'));var crypto=require(_0x6ee5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6ee5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6ee5('0xf'));var Papa=require('papaparse');var Redis=require(_0x6ee5('0x10'));var authService=require(_0x6ee5('0x11'));var qs=require(_0x6ee5('0x12'));var as=require(_0x6ee5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ee5('0x14'))(_0x6ee5('0x15'));var utils=require(_0x6ee5('0x16'));var config=require(_0x6ee5('0x17'));var licenseUtil=require(_0x6ee5('0x18'));var db=require(_0x6ee5('0x19'))['db'];function respondWithStatusCode(_0x2e9e4a,_0x56168a){_0x56168a=_0x56168a||0xcc;return function(_0x46a784){if(_0x46a784){return _0x2e9e4a['sendStatus'](_0x56168a);}return _0x2e9e4a[_0x6ee5('0x1a')](_0x56168a)['end']();};}function respondWithResult(_0x5a0d1b,_0x5cb4bc){_0x5cb4bc=_0x5cb4bc||0xc8;return function(_0x2056e0){if(_0x2056e0){return _0x5a0d1b['status'](_0x5cb4bc)['json'](_0x2056e0);}};}function respondWithFilteredResult(_0x539779,_0xbbc830){return function(_0x137b47){if(_0x137b47){var _0x2c3613=typeof _0xbbc830[_0x6ee5('0x1b')]===_0x6ee5('0x1c')&&typeof _0xbbc830[_0x6ee5('0x1d')]==='undefined';var _0x32138=_0x137b47[_0x6ee5('0x1e')];var _0x18ce28=_0x2c3613?0x0:_0xbbc830[_0x6ee5('0x1b')];var _0x855998=_0x2c3613?_0x137b47[_0x6ee5('0x1e')]:_0xbbc830[_0x6ee5('0x1b')]+_0xbbc830['limit'];var _0x553d87;if(_0x855998>=_0x32138){_0x855998=_0x32138;_0x553d87=0xc8;}else{_0x553d87=0xce;}_0x539779['status'](_0x553d87);return _0x539779[_0x6ee5('0x1f')]('Content-Range',_0x18ce28+'-'+_0x855998+'/'+_0x32138)[_0x6ee5('0x20')](_0x137b47);}return null;};}function patchUpdates(_0x7e79e4){return function(_0x171998){try{jsonpatch[_0x6ee5('0x21')](_0x171998,_0x7e79e4,!![]);}catch(_0x9ff7d1){return BPromise[_0x6ee5('0x22')](_0x9ff7d1);}return _0x171998[_0x6ee5('0x23')]();};}function saveUpdates(_0x508918,_0x98306d){return function(_0x4ad40){if(_0x4ad40){return _0x4ad40[_0x6ee5('0x24')](_0x508918)[_0x6ee5('0x25')](function(_0x2e0a5f){return _0x2e0a5f;});}return null;};}function removeEntity(_0x21ef70,_0x2b1332){return function(_0x35fd73){if(_0x35fd73){return _0x35fd73['destroy']()[_0x6ee5('0x25')](function(){var _0x4b9052=_0x35fd73[_0x6ee5('0x26')]({'plain':!![]});var _0x1b9664=_0x6ee5('0x27');return db[_0x6ee5('0x28')][_0x6ee5('0x29')]({'where':{'type':_0x1b9664,'resourceId':_0x4b9052['id']}})[_0x6ee5('0x25')](function(){return _0x35fd73;});})[_0x6ee5('0x25')](function(){_0x21ef70['status'](0xcc)[_0x6ee5('0x2a')]();});}};}function handleEntityNotFound(_0x2fc186,_0x40a33f){return function(_0x8868c0){if(!_0x8868c0){_0x2fc186[_0x6ee5('0x2b')](0x194);}return _0x8868c0;};}function handleError(_0x59f6cf,_0x410c18){_0x410c18=_0x410c18||0x1f4;return function(_0x4ea93f){logger[_0x6ee5('0x2c')](_0x4ea93f[_0x6ee5('0x2d')]);if(_0x4ea93f[_0x6ee5('0x2e')]){delete _0x4ea93f[_0x6ee5('0x2e')];}_0x59f6cf[_0x6ee5('0x1a')](_0x410c18)[_0x6ee5('0x2f')](_0x4ea93f);};}exports['index']=function(_0x41229e,_0x23f79f){var _0x1385f9={},_0x4609ff={},_0x330834={'count':0x0,'rows':[]};var _0x83dd2=_[_0x6ee5('0x30')](db['Template'][_0x6ee5('0x31')],function(_0x32bf3d){return{'name':_0x32bf3d[_0x6ee5('0x32')],'type':_0x32bf3d['type']['key']};});_0x4609ff[_0x6ee5('0x33')]=_[_0x6ee5('0x30')](_0x83dd2,_0x6ee5('0x2e'));_0x4609ff[_0x6ee5('0x34')]=_['keys'](_0x41229e[_0x6ee5('0x34')]);_0x4609ff[_0x6ee5('0x35')]=_['intersection'](_0x4609ff[_0x6ee5('0x33')],_0x4609ff[_0x6ee5('0x34')]);_0x1385f9['attributes']=_['intersection'](_0x4609ff[_0x6ee5('0x33')],qs[_0x6ee5('0x36')](_0x41229e[_0x6ee5('0x34')][_0x6ee5('0x36')]));_0x1385f9[_0x6ee5('0x37')]=_0x1385f9[_0x6ee5('0x37')][_0x6ee5('0x38')]?_0x1385f9[_0x6ee5('0x37')]:_0x4609ff[_0x6ee5('0x33')];if(!_0x41229e['query'][_0x6ee5('0x39')](_0x6ee5('0x3a'))){_0x1385f9[_0x6ee5('0x1d')]=qs[_0x6ee5('0x1d')](_0x41229e[_0x6ee5('0x34')][_0x6ee5('0x1d')]);_0x1385f9[_0x6ee5('0x1b')]=qs[_0x6ee5('0x1b')](_0x41229e['query'][_0x6ee5('0x1b')]);}_0x1385f9[_0x6ee5('0x3b')]=qs[_0x6ee5('0x3c')](_0x41229e[_0x6ee5('0x34')][_0x6ee5('0x3c')]);_0x1385f9[_0x6ee5('0x3d')]=qs[_0x6ee5('0x35')](_[_0x6ee5('0x3e')](_0x41229e[_0x6ee5('0x34')],_0x4609ff[_0x6ee5('0x35')]),_0x83dd2);if(_0x41229e[_0x6ee5('0x34')]['filter']){_0x1385f9['where']=_[_0x6ee5('0x3f')](_0x1385f9[_0x6ee5('0x3d')],{'$or':_['map'](_0x83dd2,function(_0x35bf28){if(_0x35bf28[_0x6ee5('0x40')]!==_0x6ee5('0x41')){var _0x4d3943={};_0x4d3943[_0x35bf28['name']]={'$like':'%'+_0x41229e['query'][_0x6ee5('0x42')]+'%'};return _0x4d3943;}})});}_0x1385f9=_[_0x6ee5('0x3f')]({},_0x1385f9,_0x41229e[_0x6ee5('0x43')]);var _0x3197b0={'where':_0x1385f9[_0x6ee5('0x3d')]};return db['Template'][_0x6ee5('0x1e')](_0x3197b0)[_0x6ee5('0x25')](function(_0x2ec317){_0x330834[_0x6ee5('0x1e')]=_0x2ec317;if(_0x41229e[_0x6ee5('0x34')][_0x6ee5('0x44')]){_0x1385f9['include']=[{'all':!![]}];}return db[_0x6ee5('0x45')][_0x6ee5('0x46')](_0x1385f9);})[_0x6ee5('0x25')](function(_0x7c36c6){_0x330834[_0x6ee5('0x47')]=_0x7c36c6;return _0x330834;})[_0x6ee5('0x25')](respondWithFilteredResult(_0x23f79f,_0x1385f9))[_0x6ee5('0x48')](handleError(_0x23f79f,null));};exports[_0x6ee5('0x49')]=function(_0x47472c,_0x5a46df){var _0x1ef0fd={'raw':!![],'where':{'id':_0x47472c[_0x6ee5('0x4a')]['id']}},_0x1efe9c={};_0x1efe9c[_0x6ee5('0x33')]=_[_0x6ee5('0x4b')](db['Template']['rawAttributes']);_0x1efe9c[_0x6ee5('0x34')]=_['keys'](_0x47472c[_0x6ee5('0x34')]);_0x1efe9c['filters']=_[_0x6ee5('0x4c')](_0x1efe9c[_0x6ee5('0x33')],_0x1efe9c[_0x6ee5('0x34')]);_0x1ef0fd[_0x6ee5('0x37')]=_[_0x6ee5('0x4c')](_0x1efe9c[_0x6ee5('0x33')],qs[_0x6ee5('0x36')](_0x47472c[_0x6ee5('0x34')][_0x6ee5('0x36')]));_0x1ef0fd[_0x6ee5('0x37')]=_0x1ef0fd[_0x6ee5('0x37')][_0x6ee5('0x38')]?_0x1ef0fd['attributes']:_0x1efe9c[_0x6ee5('0x33')];if(_0x47472c[_0x6ee5('0x34')]['includeAll']){_0x1ef0fd[_0x6ee5('0x4d')]=[{'all':!![]}];}_0x1ef0fd=_[_0x6ee5('0x3f')]({},_0x1ef0fd,_0x47472c[_0x6ee5('0x43')]);return db[_0x6ee5('0x45')][_0x6ee5('0x4e')](_0x1ef0fd)[_0x6ee5('0x25')](handleEntityNotFound(_0x5a46df,null))[_0x6ee5('0x25')](respondWithResult(_0x5a46df,null))[_0x6ee5('0x48')](handleError(_0x5a46df,null));};exports['create']=function(_0x16c4c2,_0x217186){return db['Template']['create'](_0x16c4c2[_0x6ee5('0x4f')],{})[_0x6ee5('0x25')](function(_0x531402){var _0x529e94=_0x16c4c2[_0x6ee5('0x50')][_0x6ee5('0x26')]({'plain':!![]});if(!_0x529e94)throw new Error(_0x6ee5('0x51'));if(_0x529e94[_0x6ee5('0x52')]===_0x6ee5('0x50')){var _0x224085=_0x531402[_0x6ee5('0x26')]({'plain':!![]});var _0x5aaca4='Templates';return db['UserProfileSection']['find']({'where':{'name':_0x5aaca4,'userProfileId':_0x529e94[_0x6ee5('0x53')]},'raw':!![]})[_0x6ee5('0x25')](function(_0x593688){if(_0x593688&&_0x593688[_0x6ee5('0x54')]===0x0){return db[_0x6ee5('0x28')][_0x6ee5('0x55')]({'name':_0x224085[_0x6ee5('0x2e')],'resourceId':_0x224085['id'],'type':_0x593688[_0x6ee5('0x2e')],'sectionId':_0x593688['id']},{})[_0x6ee5('0x25')](function(){return _0x531402;});}else{return _0x531402;}})[_0x6ee5('0x48')](function(_0xfe9867){logger[_0x6ee5('0x2c')](_0x6ee5('0x56'),_0xfe9867);throw _0xfe9867;});}return _0x531402;})[_0x6ee5('0x25')](respondWithResult(_0x217186,0xc9))[_0x6ee5('0x48')](handleError(_0x217186,null));};exports['update']=function(_0x4f7c41,_0x31c1f4){if(_0x4f7c41[_0x6ee5('0x4f')]['id']){delete _0x4f7c41[_0x6ee5('0x4f')]['id'];}return db[_0x6ee5('0x45')][_0x6ee5('0x4e')]({'where':{'id':_0x4f7c41[_0x6ee5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x31c1f4,null))[_0x6ee5('0x25')](saveUpdates(_0x4f7c41[_0x6ee5('0x4f')],null))[_0x6ee5('0x25')](respondWithResult(_0x31c1f4,null))['catch'](handleError(_0x31c1f4,null));};exports[_0x6ee5('0x29')]=function(_0x37fe0b,_0x403795){return db[_0x6ee5('0x45')][_0x6ee5('0x4e')]({'where':{'id':_0x37fe0b['params']['id']}})[_0x6ee5('0x25')](handleEntityNotFound(_0x403795,null))[_0x6ee5('0x25')](removeEntity(_0x403795,null))['catch'](handleError(_0x403795,null));}; \ No newline at end of file +var _0xf429=['reject','save','update','then','destroy','get','Templates','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','Template','includeAll','include','findAll','rows','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xf429,0x18c));var _0x9f42=function(_0x19babd,_0x1d4ef7){_0x19babd=_0x19babd-0x0;var _0x314eaf=_0xf429[_0x19babd];return _0x314eaf;};'use strict';var emlformat=require(_0x9f42('0x0'));var rimraf=require(_0x9f42('0x1'));var zipdir=require(_0x9f42('0x2'));var jsonpatch=require(_0x9f42('0x3'));var rp=require(_0x9f42('0x4'));var moment=require(_0x9f42('0x5'));var BPromise=require(_0x9f42('0x6'));var Mustache=require(_0x9f42('0x7'));var util=require('util');var path=require('path');var sox=require(_0x9f42('0x8'));var csv=require(_0x9f42('0x9'));var ejs=require(_0x9f42('0xa'));var fs=require('fs');var fs_extra=require(_0x9f42('0xb'));var _=require(_0x9f42('0xc'));var squel=require(_0x9f42('0xd'));var crypto=require(_0x9f42('0xe'));var jsforce=require(_0x9f42('0xf'));var deskjs=require(_0x9f42('0x10'));var toCsv=require(_0x9f42('0x9'));var querystring=require('querystring');var Papa=require(_0x9f42('0x11'));var Redis=require(_0x9f42('0x12'));var authService=require(_0x9f42('0x13'));var qs=require(_0x9f42('0x14'));var as=require(_0x9f42('0x15'));var hardwareService=require(_0x9f42('0x16'));var logger=require(_0x9f42('0x17'))(_0x9f42('0x18'));var utils=require(_0x9f42('0x19'));var config=require(_0x9f42('0x1a'));var licenseUtil=require(_0x9f42('0x1b'));var db=require(_0x9f42('0x1c'))['db'];function respondWithStatusCode(_0x4c46b3,_0x1d94fa){_0x1d94fa=_0x1d94fa||0xcc;return function(_0x348e36){if(_0x348e36){return _0x4c46b3[_0x9f42('0x1d')](_0x1d94fa);}return _0x4c46b3[_0x9f42('0x1e')](_0x1d94fa)[_0x9f42('0x1f')]();};}function respondWithResult(_0x3b1f2d,_0x378bb6){_0x378bb6=_0x378bb6||0xc8;return function(_0x22eb7a){if(_0x22eb7a){return _0x3b1f2d['status'](_0x378bb6)[_0x9f42('0x20')](_0x22eb7a);}};}function respondWithFilteredResult(_0x11aec4,_0x4af993){return function(_0x1917ca){if(_0x1917ca){var _0x10b309=typeof _0x4af993['offset']===_0x9f42('0x21')&&typeof _0x4af993[_0x9f42('0x22')]===_0x9f42('0x21');var _0x1e4fe0=_0x1917ca[_0x9f42('0x23')];var _0x1460e5=_0x10b309?0x0:_0x4af993[_0x9f42('0x24')];var _0x2d96b1=_0x10b309?_0x1917ca[_0x9f42('0x23')]:_0x4af993[_0x9f42('0x24')]+_0x4af993['limit'];var _0x4b6f10;if(_0x2d96b1>=_0x1e4fe0){_0x2d96b1=_0x1e4fe0;_0x4b6f10=0xc8;}else{_0x4b6f10=0xce;}_0x11aec4[_0x9f42('0x1e')](_0x4b6f10);return _0x11aec4[_0x9f42('0x25')](_0x9f42('0x26'),_0x1460e5+'-'+_0x2d96b1+'/'+_0x1e4fe0)['json'](_0x1917ca);}return null;};}function patchUpdates(_0x2413b3){return function(_0x566e99){try{jsonpatch['apply'](_0x566e99,_0x2413b3,!![]);}catch(_0x2de1b6){return BPromise[_0x9f42('0x27')](_0x2de1b6);}return _0x566e99[_0x9f42('0x28')]();};}function saveUpdates(_0x1ead31,_0x598772){return function(_0xfa798){if(_0xfa798){return _0xfa798[_0x9f42('0x29')](_0x1ead31)[_0x9f42('0x2a')](function(_0x26f49b){return _0x26f49b;});}return null;};}function removeEntity(_0x1eae49,_0xeb6b7f){return function(_0x24c554){if(_0x24c554){return _0x24c554[_0x9f42('0x2b')]()['then'](function(){var _0x59ec59=_0x24c554[_0x9f42('0x2c')]({'plain':!![]});var _0x2feb1b=_0x9f42('0x2d');return db[_0x9f42('0x2e')]['destroy']({'where':{'type':_0x2feb1b,'resourceId':_0x59ec59['id']}})[_0x9f42('0x2a')](function(){return _0x24c554;});})[_0x9f42('0x2a')](function(){_0x1eae49[_0x9f42('0x1e')](0xcc)[_0x9f42('0x1f')]();});}};}function handleEntityNotFound(_0x1b3c74,_0x37427e){return function(_0x3cb801){if(!_0x3cb801){_0x1b3c74[_0x9f42('0x1d')](0x194);}return _0x3cb801;};}function handleError(_0x6afe7b,_0x1b5d21){_0x1b5d21=_0x1b5d21||0x1f4;return function(_0x1988d3){logger['error'](_0x1988d3[_0x9f42('0x2f')]);if(_0x1988d3[_0x9f42('0x30')]){delete _0x1988d3[_0x9f42('0x30')];}_0x6afe7b[_0x9f42('0x1e')](_0x1b5d21)[_0x9f42('0x31')](_0x1988d3);};}exports[_0x9f42('0x32')]=function(_0x1853d3,_0x1e17de){var _0x318242={},_0x43980a={},_0x33ae64={'count':0x0,'rows':[]};var _0x7b2e43=_['map'](db['Template'][_0x9f42('0x33')],function(_0x46ded4){return{'name':_0x46ded4[_0x9f42('0x34')],'type':_0x46ded4[_0x9f42('0x35')][_0x9f42('0x36')]};});_0x43980a[_0x9f42('0x37')]=_[_0x9f42('0x38')](_0x7b2e43,'name');_0x43980a[_0x9f42('0x39')]=_[_0x9f42('0x3a')](_0x1853d3['query']);_0x43980a[_0x9f42('0x3b')]=_[_0x9f42('0x3c')](_0x43980a['model'],_0x43980a['query']);_0x318242[_0x9f42('0x3d')]=_['intersection'](_0x43980a[_0x9f42('0x37')],qs[_0x9f42('0x3e')](_0x1853d3[_0x9f42('0x39')][_0x9f42('0x3e')]));_0x318242[_0x9f42('0x3d')]=_0x318242[_0x9f42('0x3d')][_0x9f42('0x3f')]?_0x318242[_0x9f42('0x3d')]:_0x43980a[_0x9f42('0x37')];if(!_0x1853d3[_0x9f42('0x39')][_0x9f42('0x40')](_0x9f42('0x41'))){_0x318242['limit']=qs[_0x9f42('0x22')](_0x1853d3['query'][_0x9f42('0x22')]);_0x318242[_0x9f42('0x24')]=qs[_0x9f42('0x24')](_0x1853d3[_0x9f42('0x39')]['offset']);}_0x318242['order']=qs[_0x9f42('0x42')](_0x1853d3[_0x9f42('0x39')][_0x9f42('0x42')]);_0x318242[_0x9f42('0x43')]=qs['filters'](_[_0x9f42('0x44')](_0x1853d3[_0x9f42('0x39')],_0x43980a[_0x9f42('0x3b')]),_0x7b2e43);if(_0x1853d3[_0x9f42('0x39')][_0x9f42('0x45')]){_0x318242[_0x9f42('0x43')]=_[_0x9f42('0x46')](_0x318242['where'],{'$or':_[_0x9f42('0x38')](_0x7b2e43,function(_0x299d11){if(_0x299d11['type']!=='VIRTUAL'){var _0x582256={};_0x582256[_0x299d11[_0x9f42('0x30')]]={'$like':'%'+_0x1853d3[_0x9f42('0x39')][_0x9f42('0x45')]+'%'};return _0x582256;}})});}_0x318242=_[_0x9f42('0x46')]({},_0x318242,_0x1853d3[_0x9f42('0x47')]);var _0x48f2eb={'where':_0x318242[_0x9f42('0x43')]};return db[_0x9f42('0x48')][_0x9f42('0x23')](_0x48f2eb)[_0x9f42('0x2a')](function(_0x334226){_0x33ae64[_0x9f42('0x23')]=_0x334226;if(_0x1853d3['query'][_0x9f42('0x49')]){_0x318242[_0x9f42('0x4a')]=[{'all':!![]}];}return db[_0x9f42('0x48')][_0x9f42('0x4b')](_0x318242);})['then'](function(_0x31e3c4){_0x33ae64[_0x9f42('0x4c')]=_0x31e3c4;return _0x33ae64;})[_0x9f42('0x2a')](respondWithFilteredResult(_0x1e17de,_0x318242))['catch'](handleError(_0x1e17de,null));};exports['show']=function(_0x4ec790,_0x321692){var _0x1111fa={'raw':!![],'where':{'id':_0x4ec790[_0x9f42('0x4d')]['id']}},_0x34ba17={};_0x34ba17[_0x9f42('0x37')]=_['keys'](db[_0x9f42('0x48')][_0x9f42('0x33')]);_0x34ba17[_0x9f42('0x39')]=_['keys'](_0x4ec790[_0x9f42('0x39')]);_0x34ba17[_0x9f42('0x3b')]=_[_0x9f42('0x3c')](_0x34ba17[_0x9f42('0x37')],_0x34ba17[_0x9f42('0x39')]);_0x1111fa['attributes']=_[_0x9f42('0x3c')](_0x34ba17[_0x9f42('0x37')],qs['fields'](_0x4ec790[_0x9f42('0x39')]['fields']));_0x1111fa[_0x9f42('0x3d')]=_0x1111fa[_0x9f42('0x3d')][_0x9f42('0x3f')]?_0x1111fa[_0x9f42('0x3d')]:_0x34ba17[_0x9f42('0x37')];if(_0x4ec790[_0x9f42('0x39')][_0x9f42('0x49')]){_0x1111fa[_0x9f42('0x4a')]=[{'all':!![]}];}_0x1111fa=_[_0x9f42('0x46')]({},_0x1111fa,_0x4ec790[_0x9f42('0x47')]);return db[_0x9f42('0x48')]['find'](_0x1111fa)['then'](handleEntityNotFound(_0x321692,null))[_0x9f42('0x2a')](respondWithResult(_0x321692,null))[_0x9f42('0x4e')](handleError(_0x321692,null));};exports[_0x9f42('0x4f')]=function(_0x1157df,_0x8da0f8){return db[_0x9f42('0x48')][_0x9f42('0x4f')](_0x1157df[_0x9f42('0x50')],{})[_0x9f42('0x2a')](function(_0x1ed316){var _0x407ab8=_0x1157df[_0x9f42('0x51')]['get']({'plain':!![]});if(!_0x407ab8)throw new Error(_0x9f42('0x52'));if(_0x407ab8['role']===_0x9f42('0x51')){var _0x311756=_0x1ed316[_0x9f42('0x2c')]({'plain':!![]});var _0x559cdf=_0x9f42('0x2d');return db['UserProfileSection']['find']({'where':{'name':_0x559cdf,'userProfileId':_0x407ab8[_0x9f42('0x53')]},'raw':!![]})[_0x9f42('0x2a')](function(_0x3ee111){if(_0x3ee111&&_0x3ee111[_0x9f42('0x54')]===0x0){return db[_0x9f42('0x2e')][_0x9f42('0x4f')]({'name':_0x311756[_0x9f42('0x30')],'resourceId':_0x311756['id'],'type':_0x3ee111[_0x9f42('0x30')],'sectionId':_0x3ee111['id']},{})[_0x9f42('0x2a')](function(){return _0x1ed316;});}else{return _0x1ed316;}})[_0x9f42('0x4e')](function(_0x3ee067){logger[_0x9f42('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ee067);throw _0x3ee067;});}return _0x1ed316;})[_0x9f42('0x2a')](respondWithResult(_0x8da0f8,0xc9))['catch'](handleError(_0x8da0f8,null));};exports[_0x9f42('0x29')]=function(_0x1103b3,_0x376491){if(_0x1103b3[_0x9f42('0x50')]['id']){delete _0x1103b3[_0x9f42('0x50')]['id'];}return db[_0x9f42('0x48')][_0x9f42('0x56')]({'where':{'id':_0x1103b3[_0x9f42('0x4d')]['id']}})[_0x9f42('0x2a')](handleEntityNotFound(_0x376491,null))['then'](saveUpdates(_0x1103b3[_0x9f42('0x50')],null))['then'](respondWithResult(_0x376491,null))[_0x9f42('0x4e')](handleError(_0x376491,null));};exports['destroy']=function(_0x2a1b0f,_0x40e3f4){return db[_0x9f42('0x48')][_0x9f42('0x56')]({'where':{'id':_0x2a1b0f[_0x9f42('0x4d')]['id']}})[_0x9f42('0x2a')](handleEntityNotFound(_0x40e3f4,null))['then'](removeEntity(_0x40e3f4,null))['catch'](handleError(_0x40e3f4,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 62380b6..00436a8 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 _0x79e2=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','define','Template','tools_templates','lodash','util'];(function(_0x49a7bc,_0x3fb7e6){var _0x121531=function(_0x593612){while(--_0x593612){_0x49a7bc['push'](_0x49a7bc['shift']());}};_0x121531(++_0x3fb7e6);}(_0x79e2,0x1ed));var _0x279e=function(_0x3e6811,_0x2a28c0){_0x3e6811=_0x3e6811-0x0;var _0x21b6b0=_0x79e2[_0x3e6811];return _0x21b6b0;};'use strict';var _=require(_0x279e('0x0'));var util=require(_0x279e('0x1'));var logger=require(_0x279e('0x2'))(_0x279e('0x3'));var moment=require(_0x279e('0x4'));var BPromise=require(_0x279e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x279e('0x6'));var config=require(_0x279e('0x7'));var attributes=require('./template.attributes');module['exports']=function(_0x262bd6,_0x186861){return _0x262bd6[_0x279e('0x8')](_0x279e('0x9'),attributes,{'tableName':_0x279e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x132a=['Template','tools_templates','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x42d230,_0x4e845d){var _0x1817e5=function(_0x20df36){while(--_0x20df36){_0x42d230['push'](_0x42d230['shift']());}};_0x1817e5(++_0x4e845d);}(_0x132a,0x142));var _0xa132=function(_0x81d804,_0x545f0d){_0x81d804=_0x81d804-0x0;var _0x6f7a2b=_0x132a[_0x81d804];return _0x6f7a2b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa132('0x0'));var moment=require(_0xa132('0x1'));var BPromise=require('bluebird');var rp=require(_0xa132('0x2'));var fs=require('fs');var path=require(_0xa132('0x3'));var rimraf=require(_0xa132('0x4'));var config=require(_0xa132('0x5'));var attributes=require('./template.attributes');module['exports']=function(_0xf145ec,_0x3ca8d6){return _0xf145ec['define'](_0xa132('0x6'),attributes,{'tableName':_0xa132('0x7'),'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 9ce8c5d..fa572fa 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 _0x061a=['request','then','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetTemplate','options','raw','where','attributes','map','model','include','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x061a,0x13e));var _0xa061=function(_0x1edd97,_0x4e02b5){_0x1edd97=_0x1edd97-0x0;var _0xb27f8a=_0x061a[_0x1edd97];return _0xb27f8a;};'use strict';var _=require(_0xa061('0x0'));var util=require(_0xa061('0x1'));var moment=require(_0xa061('0x2'));var BPromise=require(_0xa061('0x3'));var rs=require(_0xa061('0x4'));var fs=require('fs');var Redis=require(_0xa061('0x5'));var db=require(_0xa061('0x6'))['db'];var utils=require(_0xa061('0x7'));var logger=require('../../config/logger')(_0xa061('0x8'));var config=require(_0xa061('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa061('0xa')][_0xa061('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a9db5,_0x2bd646,_0x30fbee){return new BPromise(function(_0x500397,_0x405f12){return client[_0xa061('0xc')](_0x1a9db5,_0x30fbee)[_0xa061('0xd')](function(_0x5d9254){logger['info'](_0xa061('0xe'),_0x2bd646,'request\x20sent');logger[_0xa061('0xf')](_0xa061('0x10'),_0x2bd646,_0xa061('0x11'),JSON[_0xa061('0x12')](_0x5d9254));if(_0x5d9254[_0xa061('0x13')]){if(_0x5d9254[_0xa061('0x13')][_0xa061('0x14')]===0x1f4){logger[_0xa061('0x13')]('Template,\x20%s,\x20%s',_0x2bd646,_0x5d9254['error'][_0xa061('0x15')]);return _0x405f12(_0x5d9254[_0xa061('0x13')][_0xa061('0x15')]);}logger['error'](_0xa061('0xe'),_0x2bd646,_0x5d9254[_0xa061('0x13')][_0xa061('0x15')]);return _0x500397(_0x5d9254[_0xa061('0x13')]['message']);}else{logger[_0xa061('0x16')](_0xa061('0xe'),_0x2bd646,_0xa061('0x11'));_0x500397(_0x5d9254[_0xa061('0x17')][_0xa061('0x15')]);}})['catch'](function(_0x22c8f0){logger[_0xa061('0x13')]('Template,\x20%s,\x20%s',_0x2bd646,_0x22c8f0);_0x405f12(_0x22c8f0);});});}exports[_0xa061('0x18')]=function(_0x53df14){var _0x330403=this;return new Promise(function(_0x416704,_0x463e4b){return db['Template']['findAll']({'raw':_0x53df14['options']?_0x53df14[_0xa061('0x19')][_0xa061('0x1a')]===undefined?!![]:![]:!![],'where':_0x53df14['options']?_0x53df14[_0xa061('0x19')][_0xa061('0x1b')]||null:null,'attributes':_0x53df14['options']?_0x53df14[_0xa061('0x19')][_0xa061('0x1c')]||null:null,'limit':_0x53df14[_0xa061('0x19')]?_0x53df14[_0xa061('0x19')]['limit']||null:null,'include':_0x53df14[_0xa061('0x19')]?_0x53df14[_0xa061('0x19')]['include']?_[_0xa061('0x1d')](_0x53df14[_0xa061('0x19')]['include'],function(_0x587ad7){return{'model':db[_0x587ad7[_0xa061('0x1e')]],'as':_0x587ad7['as'],'attributes':_0x587ad7[_0xa061('0x1c')],'include':_0x587ad7[_0xa061('0x1f')]?_[_0xa061('0x1d')](_0x587ad7[_0xa061('0x1f')],function(_0x13c548){return{'model':db[_0x13c548[_0xa061('0x1e')]],'as':_0x13c548['as'],'attributes':_0x13c548[_0xa061('0x1c')],'include':_0x13c548[_0xa061('0x1f')]?_[_0xa061('0x1d')](_0x13c548[_0xa061('0x1f')],function(_0x33f9e8){return{'model':db[_0x33f9e8['model']],'as':_0x33f9e8['as'],'attributes':_0x33f9e8['attributes']};}):[]};}):[]};}):[]:[]})[_0xa061('0xd')](function(_0x236466){logger[_0xa061('0x16')]('GetTemplate',_0x53df14);logger[_0xa061('0xf')](_0xa061('0x18'),_0x53df14,JSON['stringify'](_0x236466));_0x416704(_0x236466);})[_0xa061('0x20')](function(_0x327434){logger[_0xa061('0x13')](_0xa061('0x18'),_0x327434['message'],_0x53df14);_0x463e4b(_0x330403['error'](0x1f4,_0x327434[_0xa061('0x15')]));});});}; \ No newline at end of file +var _0x4c0e=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTemplate','Template','options','raw','where','limit','map','include','model','attributes','lodash'];(function(_0x39157f,_0x3d8c1e){var _0x1ae4e2=function(_0x3429af){while(--_0x3429af){_0x39157f['push'](_0x39157f['shift']());}};_0x1ae4e2(++_0x3d8c1e);}(_0x4c0e,0x128));var _0xe4c0=function(_0x30f68d,_0x12cb44){_0x30f68d=_0x30f68d-0x0;var _0x4ac6bf=_0x4c0e[_0x30f68d];return _0x4ac6bf;};'use strict';var _=require(_0xe4c0('0x0'));var util=require(_0xe4c0('0x1'));var moment=require(_0xe4c0('0x2'));var BPromise=require(_0xe4c0('0x3'));var rs=require(_0xe4c0('0x4'));var fs=require('fs');var Redis=require(_0xe4c0('0x5'));var db=require(_0xe4c0('0x6'))['db'];var utils=require(_0xe4c0('0x7'));var logger=require(_0xe4c0('0x8'))('rpc');var config=require(_0xe4c0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe4c0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4488b0,_0x503cd9,_0x5dee9f){return new BPromise(function(_0x46fcfa,_0x3ab99d){return client['request'](_0x4488b0,_0x5dee9f)[_0xe4c0('0xb')](function(_0x15b3d0){logger[_0xe4c0('0xc')](_0xe4c0('0xd'),_0x503cd9,'request\x20sent');logger[_0xe4c0('0xe')](_0xe4c0('0xf'),_0x503cd9,_0xe4c0('0x10'),JSON[_0xe4c0('0x11')](_0x15b3d0));if(_0x15b3d0[_0xe4c0('0x12')]){if(_0x15b3d0[_0xe4c0('0x12')][_0xe4c0('0x13')]===0x1f4){logger[_0xe4c0('0x12')](_0xe4c0('0xd'),_0x503cd9,_0x15b3d0[_0xe4c0('0x12')][_0xe4c0('0x14')]);return _0x3ab99d(_0x15b3d0['error'][_0xe4c0('0x14')]);}logger[_0xe4c0('0x12')](_0xe4c0('0xd'),_0x503cd9,_0x15b3d0[_0xe4c0('0x12')]['message']);return _0x46fcfa(_0x15b3d0[_0xe4c0('0x12')][_0xe4c0('0x14')]);}else{logger[_0xe4c0('0xc')](_0xe4c0('0xd'),_0x503cd9,'request\x20sent');_0x46fcfa(_0x15b3d0[_0xe4c0('0x15')]['message']);}})[_0xe4c0('0x16')](function(_0x3d3bcf){logger[_0xe4c0('0x12')]('Template,\x20%s,\x20%s',_0x503cd9,_0x3d3bcf);_0x3ab99d(_0x3d3bcf);});});}exports[_0xe4c0('0x17')]=function(_0x4acbc0){var _0x2a2e43=this;return new Promise(function(_0x1af64b,_0x5ad150){return db[_0xe4c0('0x18')]['findAll']({'raw':_0x4acbc0[_0xe4c0('0x19')]?_0x4acbc0[_0xe4c0('0x19')][_0xe4c0('0x1a')]===undefined?!![]:![]:!![],'where':_0x4acbc0[_0xe4c0('0x19')]?_0x4acbc0[_0xe4c0('0x19')][_0xe4c0('0x1b')]||null:null,'attributes':_0x4acbc0[_0xe4c0('0x19')]?_0x4acbc0['options']['attributes']||null:null,'limit':_0x4acbc0[_0xe4c0('0x19')]?_0x4acbc0[_0xe4c0('0x19')][_0xe4c0('0x1c')]||null:null,'include':_0x4acbc0['options']?_0x4acbc0[_0xe4c0('0x19')]['include']?_[_0xe4c0('0x1d')](_0x4acbc0['options'][_0xe4c0('0x1e')],function(_0x34254a){return{'model':db[_0x34254a[_0xe4c0('0x1f')]],'as':_0x34254a['as'],'attributes':_0x34254a[_0xe4c0('0x20')],'include':_0x34254a['include']?_[_0xe4c0('0x1d')](_0x34254a[_0xe4c0('0x1e')],function(_0x306f59){return{'model':db[_0x306f59[_0xe4c0('0x1f')]],'as':_0x306f59['as'],'attributes':_0x306f59['attributes'],'include':_0x306f59[_0xe4c0('0x1e')]?_[_0xe4c0('0x1d')](_0x306f59[_0xe4c0('0x1e')],function(_0x3bd747){return{'model':db[_0x3bd747[_0xe4c0('0x1f')]],'as':_0x3bd747['as'],'attributes':_0x3bd747[_0xe4c0('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe4c0('0xb')](function(_0x592a1a){logger[_0xe4c0('0xc')](_0xe4c0('0x17'),_0x4acbc0);logger[_0xe4c0('0xe')](_0xe4c0('0x17'),_0x4acbc0,JSON[_0xe4c0('0x11')](_0x592a1a));_0x1af64b(_0x592a1a);})[_0xe4c0('0x16')](function(_0x3cf407){logger['error'](_0xe4c0('0x17'),_0x3cf407[_0xe4c0('0x14')],_0x4acbc0);_0x5ad150(_0x2a2e43[_0xe4c0('0x12')](0x1f4,_0x3cf407[_0xe4c0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 2b6ef2c..cbcb3b5 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 _0x45d8=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./trigger.controller','index','/:id','isAuthenticated','show','get','/:id/all_conditions','/:id/any_conditions','/:id/actions','getActions','post','create','addAnyCondition','addAction','update','delete','exports','multer','util','path'];(function(_0x58cb18,_0x31d91f){var _0x22a308=function(_0x10e3ce){while(--_0x10e3ce){_0x58cb18['push'](_0x58cb18['shift']());}};_0x22a308(++_0x31d91f);}(_0x45d8,0x174));var _0x845d=function(_0x345307,_0x11b6f3){_0x345307=_0x345307-0x0;var _0x1e07a7=_0x45d8[_0x345307];return _0x1e07a7;};'use strict';var multer=require(_0x845d('0x0'));var util=require(_0x845d('0x1'));var path=require(_0x845d('0x2'));var timeout=require(_0x845d('0x3'));var express=require(_0x845d('0x4'));var router=express[_0x845d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x845d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x845d('0x7'));var controller=require(_0x845d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x845d('0x9')]);router['get'](_0x845d('0xa'),auth[_0x845d('0xb')](),controller[_0x845d('0xc')]);router[_0x845d('0xd')](_0x845d('0xe'),auth[_0x845d('0xb')](),controller['getAllConditions']);router[_0x845d('0xd')](_0x845d('0xf'),auth['isAuthenticated'](),controller['getAnyConditions']);router[_0x845d('0xd')](_0x845d('0x10'),auth[_0x845d('0xb')](),controller[_0x845d('0x11')]);router[_0x845d('0x12')]('/',auth['isAuthenticated'](),controller[_0x845d('0x13')]);router[_0x845d('0x12')](_0x845d('0xe'),auth[_0x845d('0xb')](),controller['addAllCondition']);router['post'](_0x845d('0xf'),auth[_0x845d('0xb')](),controller[_0x845d('0x14')]);router['post'](_0x845d('0x10'),auth['isAuthenticated'](),controller[_0x845d('0x15')]);router['put'](_0x845d('0xa'),auth[_0x845d('0xb')](),controller[_0x845d('0x16')]);router[_0x845d('0x17')](_0x845d('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x845d('0x18')]=router; \ No newline at end of file +var _0xabf9=['../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','getAllConditions','getAnyConditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1188a8,_0xc1498d){var _0x50c1c1=function(_0x174536){while(--_0x174536){_0x1188a8['push'](_0x1188a8['shift']());}};_0x50c1c1(++_0xc1498d);}(_0xabf9,0x1e4));var _0x9abf=function(_0x662e03,_0x21a0f9){_0x662e03=_0x662e03-0x0;var _0x5c9a23=_0xabf9[_0x662e03];return _0x5c9a23;};'use strict';var multer=require(_0x9abf('0x0'));var util=require(_0x9abf('0x1'));var path=require(_0x9abf('0x2'));var timeout=require(_0x9abf('0x3'));var express=require(_0x9abf('0x4'));var router=express[_0x9abf('0x5')]();var fs_extra=require(_0x9abf('0x6'));var auth=require(_0x9abf('0x7'));var interaction=require(_0x9abf('0x8'));var config=require(_0x9abf('0x9'));var controller=require(_0x9abf('0xa'));router[_0x9abf('0xb')]('/',auth[_0x9abf('0xc')](),controller[_0x9abf('0xd')]);router[_0x9abf('0xb')](_0x9abf('0xe'),auth[_0x9abf('0xc')](),controller['show']);router[_0x9abf('0xb')]('/:id/all_conditions',auth[_0x9abf('0xc')](),controller[_0x9abf('0xf')]);router[_0x9abf('0xb')]('/:id/any_conditions',auth[_0x9abf('0xc')](),controller[_0x9abf('0x10')]);router[_0x9abf('0xb')](_0x9abf('0x11'),auth[_0x9abf('0xc')](),controller[_0x9abf('0x12')]);router[_0x9abf('0x13')]('/',auth['isAuthenticated'](),controller[_0x9abf('0x14')]);router[_0x9abf('0x13')](_0x9abf('0x15'),auth['isAuthenticated'](),controller[_0x9abf('0x16')]);router[_0x9abf('0x13')](_0x9abf('0x17'),auth[_0x9abf('0xc')](),controller[_0x9abf('0x18')]);router[_0x9abf('0x13')]('/:id/actions',auth[_0x9abf('0xc')](),controller[_0x9abf('0x19')]);router['put'](_0x9abf('0xe'),auth[_0x9abf('0xc')](),controller['update']);router[_0x9abf('0x1a')](_0x9abf('0xe'),auth[_0x9abf('0xc')](),controller[_0x9abf('0x1b')]);module[_0x9abf('0x1c')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 3701122..a1576a5 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 _0x7b58=['BOOLEAN','STRING'];(function(_0x4c218d,_0x5c32c2){var _0x32b1dc=function(_0x380f4e){while(--_0x380f4e){_0x4c218d['push'](_0x4c218d['shift']());}};_0x32b1dc(++_0x5c32c2);}(_0x7b58,0xad));var _0x87b5=function(_0x11503f,_0x30de86){_0x11503f=_0x11503f-0x0;var _0x34caab=_0x7b58[_0x11503f];return _0x34caab;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x87b5('0x0')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x87b5('0x0')]},'status':{'type':Sequelize[_0x87b5('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xc9de=['STRING','BOOLEAN','sequelize'];(function(_0x3f4d08,_0x2d8448){var _0x40e51d=function(_0x45d30c){while(--_0x45d30c){_0x3f4d08['push'](_0x3f4d08['shift']());}};_0x40e51d(++_0x2d8448);}(_0xc9de,0x125));var _0xec9d=function(_0x21c53d,_0x3f7ef8){_0x21c53d=_0x21c53d-0x0;var _0x28e0a5=_0xc9de[_0x21c53d];return _0x28e0a5;};'use strict';var Sequelize=require(_0xec9d('0x0'));module['exports']={'name':{'type':Sequelize[_0xec9d('0x1')]},'channel':{'type':Sequelize[_0xec9d('0x1')]},'description':{'type':Sequelize[_0xec9d('0x1')]},'status':{'type':Sequelize[_0xec9d('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 1d0595e..6b6f82b 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 _0x8a97=['then','includeAll','include','findAll','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','Content-Range','reject','update','destroy','get','Triggers','UserProfileResource','error','stack','name','send','Trigger','rawAttributes','fieldName','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options'];(function(_0x54c42d,_0x23975d){var _0x16d161=function(_0x2a9a68){while(--_0x2a9a68){_0x54c42d['push'](_0x54c42d['shift']());}};_0x16d161(++_0x23975d);}(_0x8a97,0x134));var _0x78a9=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8a97[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x78a9('0x0'));var rimraf=require(_0x78a9('0x1'));var zipdir=require(_0x78a9('0x2'));var jsonpatch=require(_0x78a9('0x3'));var rp=require(_0x78a9('0x4'));var moment=require(_0x78a9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x78a9('0x6'));var util=require('util');var path=require(_0x78a9('0x7'));var sox=require(_0x78a9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x78a9('0x9'));var _=require('lodash');var squel=require(_0x78a9('0xa'));var crypto=require(_0x78a9('0xb'));var jsforce=require(_0x78a9('0xc'));var deskjs=require(_0x78a9('0xd'));var toCsv=require(_0x78a9('0xe'));var querystring=require(_0x78a9('0xf'));var Papa=require(_0x78a9('0x10'));var Redis=require(_0x78a9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x78a9('0x12'));var as=require(_0x78a9('0x13'));var hardwareService=require(_0x78a9('0x14'));var logger=require('../../config/logger')(_0x78a9('0x15'));var utils=require(_0x78a9('0x16'));var config=require(_0x78a9('0x17'));var licenseUtil=require(_0x78a9('0x18'));var db=require(_0x78a9('0x19'))['db'];function respondWithStatusCode(_0x10930f,_0x46070c){_0x46070c=_0x46070c||0xcc;return function(_0x55ec63){if(_0x55ec63){return _0x10930f[_0x78a9('0x1a')](_0x46070c);}return _0x10930f['status'](_0x46070c)[_0x78a9('0x1b')]();};}function respondWithResult(_0x13bc26,_0x1178a6){_0x1178a6=_0x1178a6||0xc8;return function(_0x34bae2){if(_0x34bae2){return _0x13bc26['status'](_0x1178a6)[_0x78a9('0x1c')](_0x34bae2);}};}function respondWithFilteredResult(_0x34573a,_0x205c7b){return function(_0x3bcfd3){if(_0x3bcfd3){var _0x325db7=typeof _0x205c7b['offset']===_0x78a9('0x1d')&&typeof _0x205c7b[_0x78a9('0x1e')]===_0x78a9('0x1d');var _0x1d476d=_0x3bcfd3[_0x78a9('0x1f')];var _0x3c2523=_0x325db7?0x0:_0x205c7b[_0x78a9('0x20')];var _0x154fa2=_0x325db7?_0x3bcfd3['count']:_0x205c7b[_0x78a9('0x20')]+_0x205c7b['limit'];var _0x348f2c;if(_0x154fa2>=_0x1d476d){_0x154fa2=_0x1d476d;_0x348f2c=0xc8;}else{_0x348f2c=0xce;}_0x34573a[_0x78a9('0x21')](_0x348f2c);return _0x34573a['set'](_0x78a9('0x22'),_0x3c2523+'-'+_0x154fa2+'/'+_0x1d476d)[_0x78a9('0x1c')](_0x3bcfd3);}return null;};}function patchUpdates(_0x32fee5){return function(_0x32ff27){try{jsonpatch['apply'](_0x32ff27,_0x32fee5,!![]);}catch(_0x30c7c7){return BPromise[_0x78a9('0x23')](_0x30c7c7);}return _0x32ff27['save']();};}function saveUpdates(_0x510c5c,_0x4e3e12){return function(_0x397d08){if(_0x397d08){return _0x397d08[_0x78a9('0x24')](_0x510c5c)['then'](function(_0x29b48e){return _0x29b48e;});}return null;};}function removeEntity(_0x5362d0,_0x240364){return function(_0x458321){if(_0x458321){return _0x458321[_0x78a9('0x25')]()['then'](function(){var _0x3ec99d=_0x458321[_0x78a9('0x26')]({'plain':!![]});var _0x4ffda2=_0x78a9('0x27');return db[_0x78a9('0x28')][_0x78a9('0x25')]({'where':{'type':_0x4ffda2,'resourceId':_0x3ec99d['id']}})['then'](function(){return _0x458321;});})['then'](function(){_0x5362d0[_0x78a9('0x21')](0xcc)[_0x78a9('0x1b')]();});}};}function handleEntityNotFound(_0x2a6ea6,_0x480e23){return function(_0x28abc1){if(!_0x28abc1){_0x2a6ea6[_0x78a9('0x1a')](0x194);}return _0x28abc1;};}function handleError(_0x1cc2c1,_0x764a49){_0x764a49=_0x764a49||0x1f4;return function(_0x5c1080){logger[_0x78a9('0x29')](_0x5c1080[_0x78a9('0x2a')]);if(_0x5c1080[_0x78a9('0x2b')]){delete _0x5c1080[_0x78a9('0x2b')];}_0x1cc2c1[_0x78a9('0x21')](_0x764a49)[_0x78a9('0x2c')](_0x5c1080);};}exports['index']=function(_0x20b733,_0x34c3a9){var _0x32de88={},_0x1b920a={},_0x1a2bc0={'count':0x0,'rows':[]};var _0x1a86c2=_['map'](db[_0x78a9('0x2d')][_0x78a9('0x2e')],function(_0x49cf5d){return{'name':_0x49cf5d[_0x78a9('0x2f')],'type':_0x49cf5d['type']['key']};});_0x1b920a['model']=_[_0x78a9('0x30')](_0x1a86c2,_0x78a9('0x2b'));_0x1b920a[_0x78a9('0x31')]=_[_0x78a9('0x32')](_0x20b733['query']);_0x1b920a[_0x78a9('0x33')]=_['intersection'](_0x1b920a[_0x78a9('0x34')],_0x1b920a[_0x78a9('0x31')]);_0x32de88['attributes']=_[_0x78a9('0x35')](_0x1b920a['model'],qs[_0x78a9('0x36')](_0x20b733[_0x78a9('0x31')][_0x78a9('0x36')]));_0x32de88[_0x78a9('0x37')]=_0x32de88[_0x78a9('0x37')][_0x78a9('0x38')]?_0x32de88[_0x78a9('0x37')]:_0x1b920a[_0x78a9('0x34')];if(!_0x20b733[_0x78a9('0x31')][_0x78a9('0x39')](_0x78a9('0x3a'))){_0x32de88[_0x78a9('0x1e')]=qs[_0x78a9('0x1e')](_0x20b733[_0x78a9('0x31')]['limit']);_0x32de88[_0x78a9('0x20')]=qs[_0x78a9('0x20')](_0x20b733[_0x78a9('0x31')][_0x78a9('0x20')]);}_0x32de88[_0x78a9('0x3b')]=qs['sort'](_0x20b733['query'][_0x78a9('0x3c')]);_0x32de88[_0x78a9('0x3d')]=qs[_0x78a9('0x33')](_[_0x78a9('0x3e')](_0x20b733[_0x78a9('0x31')],_0x1b920a[_0x78a9('0x33')]),_0x1a86c2);if(_0x20b733[_0x78a9('0x31')][_0x78a9('0x3f')]){_0x32de88[_0x78a9('0x3d')]=_[_0x78a9('0x40')](_0x32de88[_0x78a9('0x3d')],{'$or':_['map'](_0x1a86c2,function(_0xaf116b){if(_0xaf116b[_0x78a9('0x41')]!==_0x78a9('0x42')){var _0x4feef5={};_0x4feef5[_0xaf116b['name']]={'$like':'%'+_0x20b733[_0x78a9('0x31')][_0x78a9('0x3f')]+'%'};return _0x4feef5;}})});}_0x32de88=_['merge']({},_0x32de88,_0x20b733[_0x78a9('0x43')]);var _0x5a6a47={'where':_0x32de88[_0x78a9('0x3d')]};return db[_0x78a9('0x2d')][_0x78a9('0x1f')](_0x5a6a47)[_0x78a9('0x44')](function(_0xdc4e53){_0x1a2bc0[_0x78a9('0x1f')]=_0xdc4e53;if(_0x20b733[_0x78a9('0x31')][_0x78a9('0x45')]){_0x32de88[_0x78a9('0x46')]=[{'all':!![]}];}return db[_0x78a9('0x2d')][_0x78a9('0x47')](_0x32de88);})[_0x78a9('0x44')](function(_0x47fca3){_0x1a2bc0['rows']=_0x47fca3;return _0x1a2bc0;})['then'](respondWithFilteredResult(_0x34c3a9,_0x32de88))['catch'](handleError(_0x34c3a9,null));};exports[_0x78a9('0x48')]=function(_0x486dce,_0x19ab98){var _0x251f69={'raw':![],'where':{'id':_0x486dce[_0x78a9('0x49')]['id']}},_0x4a2634={};_0x4a2634[_0x78a9('0x34')]=_[_0x78a9('0x32')](db['Trigger'][_0x78a9('0x2e')]);_0x4a2634['query']=_[_0x78a9('0x32')](_0x486dce[_0x78a9('0x31')]);_0x4a2634[_0x78a9('0x33')]=_[_0x78a9('0x35')](_0x4a2634['model'],_0x4a2634[_0x78a9('0x31')]);_0x251f69['attributes']=_[_0x78a9('0x35')](_0x4a2634['model'],qs[_0x78a9('0x36')](_0x486dce[_0x78a9('0x31')]['fields']));_0x251f69[_0x78a9('0x37')]=_0x251f69[_0x78a9('0x37')][_0x78a9('0x38')]?_0x251f69[_0x78a9('0x37')]:_0x4a2634[_0x78a9('0x34')];if(_0x486dce[_0x78a9('0x31')][_0x78a9('0x45')]){_0x251f69[_0x78a9('0x46')]=[{'all':!![]}];}_0x251f69=_[_0x78a9('0x40')]({},_0x251f69,_0x486dce['options']);return db[_0x78a9('0x2d')]['find'](_0x251f69)[_0x78a9('0x44')](handleEntityNotFound(_0x19ab98,null))['then'](respondWithResult(_0x19ab98,null))[_0x78a9('0x4a')](handleError(_0x19ab98,null));};exports[_0x78a9('0x4b')]=function(_0x29600f,_0x211211){return db['Trigger'][_0x78a9('0x4b')](_0x29600f[_0x78a9('0x4c')],{})[_0x78a9('0x44')](function(_0x4a712c){var _0x32b70a=_0x29600f[_0x78a9('0x4d')][_0x78a9('0x26')]({'plain':!![]});if(!_0x32b70a)throw new Error(_0x78a9('0x4e'));if(_0x32b70a[_0x78a9('0x4f')]==='user'){var _0x429b78=_0x4a712c[_0x78a9('0x26')]({'plain':!![]});var _0x4b9bae=_0x78a9('0x27');return db['UserProfileSection'][_0x78a9('0x50')]({'where':{'name':_0x4b9bae,'userProfileId':_0x32b70a['userProfileId']},'raw':!![]})[_0x78a9('0x44')](function(_0x3dc228){if(_0x3dc228&&_0x3dc228[_0x78a9('0x51')]===0x0){return db[_0x78a9('0x28')][_0x78a9('0x4b')]({'name':_0x429b78['name'],'resourceId':_0x429b78['id'],'type':_0x3dc228[_0x78a9('0x2b')],'sectionId':_0x3dc228['id']},{})[_0x78a9('0x44')](function(){return _0x4a712c;});}else{return _0x4a712c;}})[_0x78a9('0x4a')](function(_0x22916b){logger[_0x78a9('0x29')](_0x78a9('0x52'),_0x22916b);throw _0x22916b;});}return _0x4a712c;})['then'](respondWithResult(_0x211211,0xc9))['catch'](handleError(_0x211211,null));};exports[_0x78a9('0x24')]=function(_0x1343df,_0x1562b8){if(_0x1343df['body']['id']){delete _0x1343df[_0x78a9('0x4c')]['id'];}return db[_0x78a9('0x2d')][_0x78a9('0x50')]({'where':{'id':_0x1343df['params']['id']}})['then'](handleEntityNotFound(_0x1562b8,null))[_0x78a9('0x44')](saveUpdates(_0x1343df[_0x78a9('0x4c')],null))[_0x78a9('0x44')](respondWithResult(_0x1562b8,null))[_0x78a9('0x4a')](handleError(_0x1562b8,null));};exports[_0x78a9('0x25')]=function(_0x3f72ad,_0x324e22){return db[_0x78a9('0x2d')][_0x78a9('0x50')]({'where':{'id':_0x3f72ad[_0x78a9('0x49')]['id']}})[_0x78a9('0x44')](handleEntityNotFound(_0x324e22,null))[_0x78a9('0x44')](removeEntity(_0x324e22,null))[_0x78a9('0x4a')](handleError(_0x324e22,null));};exports[_0x78a9('0x53')]=function(_0x4a6007,_0x4b9db8,_0x57cbd6){if(_0x4a6007['body']['id']){delete _0x4a6007[_0x78a9('0x4c')]['id'];}return db[_0x78a9('0x2d')]['find']({'where':{'id':_0x4a6007[_0x78a9('0x49')]['id']}})['then'](handleEntityNotFound(_0x4b9db8,null))[_0x78a9('0x44')](function(_0x21bdcd){if(_0x21bdcd){_0x4a6007['body'][_0x78a9('0x54')]=_0x21bdcd['id'];return db[_0x78a9('0x55')][_0x78a9('0x4b')](_0x4a6007[_0x78a9('0x4c')]);}})[_0x78a9('0x44')](respondWithResult(_0x4b9db8,null))['catch'](handleError(_0x4b9db8,null));};exports[_0x78a9('0x56')]=function(_0x1aed08,_0x520a47,_0x4c17e7){if(_0x1aed08[_0x78a9('0x4c')]['id']){delete _0x1aed08['body']['id'];}return db[_0x78a9('0x2d')]['find']({'where':{'id':_0x1aed08[_0x78a9('0x49')]['id']}})['then'](handleEntityNotFound(_0x520a47,null))[_0x78a9('0x44')](function(_0x1fdd98){if(_0x1fdd98){_0x1aed08[_0x78a9('0x4c')]['TriggerAnyId']=_0x1fdd98['id'];return db[_0x78a9('0x55')][_0x78a9('0x4b')](_0x1aed08[_0x78a9('0x4c')]);}})[_0x78a9('0x44')](respondWithResult(_0x520a47,null))['catch'](handleError(_0x520a47,null));};exports[_0x78a9('0x57')]=function(_0x9a65a0,_0x39221b,_0x7b61f9){var _0x5be95c={};var _0x17c5b5={};var _0x3937f5;var _0x4127f3;return db[_0x78a9('0x2d')][_0x78a9('0x58')]({'where':{'id':_0x9a65a0[_0x78a9('0x49')]['id']}})[_0x78a9('0x44')](handleEntityNotFound(_0x39221b,null))[_0x78a9('0x44')](function(_0x22f3c8){if(_0x22f3c8){_0x3937f5=_0x22f3c8;_0x17c5b5[_0x78a9('0x34')]=_[_0x78a9('0x32')](db[_0x78a9('0x55')][_0x78a9('0x2e')]);_0x17c5b5[_0x78a9('0x31')]=_['keys'](_0x9a65a0[_0x78a9('0x31')]);_0x17c5b5[_0x78a9('0x33')]=_[_0x78a9('0x35')](_0x17c5b5['model'],_0x17c5b5[_0x78a9('0x31')]);_0x5be95c[_0x78a9('0x37')]=_[_0x78a9('0x35')](_0x17c5b5[_0x78a9('0x34')],qs[_0x78a9('0x36')](_0x9a65a0['query']['fields']));_0x5be95c[_0x78a9('0x37')]=_0x5be95c[_0x78a9('0x37')]['length']?_0x5be95c[_0x78a9('0x37')]:_0x17c5b5[_0x78a9('0x34')];_0x5be95c['order']=qs[_0x78a9('0x3c')](_0x9a65a0[_0x78a9('0x31')][_0x78a9('0x3c')]);_0x5be95c['where']=qs[_0x78a9('0x33')](_['pick'](_0x9a65a0['query'],_0x17c5b5[_0x78a9('0x33')]));if(_0x9a65a0[_0x78a9('0x31')][_0x78a9('0x3f')]){_0x5be95c[_0x78a9('0x3d')]=_[_0x78a9('0x40')](_0x5be95c[_0x78a9('0x3d')],{'$or':_[_0x78a9('0x30')](_0x5be95c[_0x78a9('0x37')],function(_0x486fcc){var _0xde4387={};_0xde4387[_0x486fcc]={'$like':'%'+_0x9a65a0[_0x78a9('0x31')][_0x78a9('0x3f')]+'%'};return _0xde4387;})});}_0x5be95c=_['merge']({},_0x5be95c,_0x9a65a0[_0x78a9('0x43')]);return _0x3937f5['getAllConditions'](_0x5be95c);}})['then'](function(_0x209966){if(_0x209966){_0x4127f3=_0x209966[_0x78a9('0x38')];if(!_0x9a65a0['query'][_0x78a9('0x39')]('nolimit')){_0x5be95c[_0x78a9('0x1e')]=qs[_0x78a9('0x1e')](_0x9a65a0['query'][_0x78a9('0x1e')]);_0x5be95c['offset']=qs[_0x78a9('0x20')](_0x9a65a0['query'][_0x78a9('0x20')]);}return _0x3937f5[_0x78a9('0x57')](_0x5be95c);}})[_0x78a9('0x44')](function(_0x563bd0){if(_0x563bd0){return _0x563bd0?{'count':_0x4127f3,'rows':_0x563bd0}:null;}})[_0x78a9('0x44')](respondWithResult(_0x39221b,null))[_0x78a9('0x4a')](handleError(_0x39221b,null));};exports[_0x78a9('0x59')]=function(_0x2ca7eb,_0x38b6a9,_0x4ef8e0){var _0x576d2d={};var _0x409537={};var _0x388183;var _0x243893;return db[_0x78a9('0x2d')][_0x78a9('0x58')]({'where':{'id':_0x2ca7eb[_0x78a9('0x49')]['id']}})['then'](handleEntityNotFound(_0x38b6a9,null))[_0x78a9('0x44')](function(_0x1d058f){if(_0x1d058f){_0x388183=_0x1d058f;_0x409537[_0x78a9('0x34')]=_[_0x78a9('0x32')](db['Condition']['rawAttributes']);_0x409537[_0x78a9('0x31')]=_['keys'](_0x2ca7eb[_0x78a9('0x31')]);_0x409537[_0x78a9('0x33')]=_[_0x78a9('0x35')](_0x409537[_0x78a9('0x34')],_0x409537[_0x78a9('0x31')]);_0x576d2d['attributes']=_['intersection'](_0x409537[_0x78a9('0x34')],qs[_0x78a9('0x36')](_0x2ca7eb['query'][_0x78a9('0x36')]));_0x576d2d['attributes']=_0x576d2d[_0x78a9('0x37')][_0x78a9('0x38')]?_0x576d2d[_0x78a9('0x37')]:_0x409537[_0x78a9('0x34')];_0x576d2d[_0x78a9('0x3b')]=qs[_0x78a9('0x3c')](_0x2ca7eb[_0x78a9('0x31')]['sort']);_0x576d2d[_0x78a9('0x3d')]=qs['filters'](_[_0x78a9('0x3e')](_0x2ca7eb[_0x78a9('0x31')],_0x409537[_0x78a9('0x33')]));if(_0x2ca7eb['query']['filter']){_0x576d2d[_0x78a9('0x3d')]=_[_0x78a9('0x40')](_0x576d2d[_0x78a9('0x3d')],{'$or':_[_0x78a9('0x30')](_0x576d2d[_0x78a9('0x37')],function(_0x53fbe3){var _0x35b459={};_0x35b459[_0x53fbe3]={'$like':'%'+_0x2ca7eb[_0x78a9('0x31')][_0x78a9('0x3f')]+'%'};return _0x35b459;})});}_0x576d2d=_['merge']({},_0x576d2d,_0x2ca7eb[_0x78a9('0x43')]);return _0x388183['getAnyConditions'](_0x576d2d);}})[_0x78a9('0x44')](function(_0x566ff6){if(_0x566ff6){_0x243893=_0x566ff6[_0x78a9('0x38')];if(!_0x2ca7eb[_0x78a9('0x31')][_0x78a9('0x39')](_0x78a9('0x3a'))){_0x576d2d[_0x78a9('0x1e')]=qs[_0x78a9('0x1e')](_0x2ca7eb[_0x78a9('0x31')][_0x78a9('0x1e')]);_0x576d2d['offset']=qs['offset'](_0x2ca7eb['query']['offset']);}return _0x388183['getAnyConditions'](_0x576d2d);}})['then'](function(_0x1b745a){if(_0x1b745a){return _0x1b745a?{'count':_0x243893,'rows':_0x1b745a}:null;}})[_0x78a9('0x44')](respondWithResult(_0x38b6a9,null))[_0x78a9('0x4a')](handleError(_0x38b6a9,null));};exports[_0x78a9('0x5a')]=function(_0x9b72b8,_0x45ecff,_0x4d7068){if(_0x9b72b8[_0x78a9('0x4c')]['id']){delete _0x9b72b8['body']['id'];}return db[_0x78a9('0x2d')]['find']({'where':{'id':_0x9b72b8[_0x78a9('0x49')]['id']}})['then'](handleEntityNotFound(_0x45ecff,null))[_0x78a9('0x44')](function(_0x24abb0){if(_0x24abb0){_0x9b72b8[_0x78a9('0x4c')][_0x78a9('0x5b')]=_0x24abb0['id'];return db[_0x78a9('0x5c')][_0x78a9('0x4b')](_0x9b72b8[_0x78a9('0x4c')]);}})['then'](respondWithResult(_0x45ecff,null))[_0x78a9('0x4a')](handleError(_0x45ecff,null));};exports['getActions']=function(_0x1a4966,_0xf7d881,_0x4e3453){var _0x5102ab={};var _0x1faa12={};var _0x16769f;var _0x52dad6;return db[_0x78a9('0x2d')][_0x78a9('0x58')]({'where':{'id':_0x1a4966[_0x78a9('0x49')]['id']}})['then'](handleEntityNotFound(_0xf7d881,null))['then'](function(_0x10ef82){if(_0x10ef82){_0x16769f=_0x10ef82;_0x1faa12['model']=_[_0x78a9('0x32')](db[_0x78a9('0x5c')]['rawAttributes']);_0x1faa12[_0x78a9('0x31')]=_[_0x78a9('0x32')](_0x1a4966['query']);_0x1faa12[_0x78a9('0x33')]=_[_0x78a9('0x35')](_0x1faa12['model'],_0x1faa12[_0x78a9('0x31')]);_0x5102ab[_0x78a9('0x37')]=_[_0x78a9('0x35')](_0x1faa12[_0x78a9('0x34')],qs[_0x78a9('0x36')](_0x1a4966['query']['fields']));_0x5102ab[_0x78a9('0x37')]=_0x5102ab[_0x78a9('0x37')][_0x78a9('0x38')]?_0x5102ab[_0x78a9('0x37')]:_0x1faa12[_0x78a9('0x34')];_0x5102ab[_0x78a9('0x3b')]=qs[_0x78a9('0x3c')](_0x1a4966[_0x78a9('0x31')]['sort']);_0x5102ab[_0x78a9('0x3d')]=qs[_0x78a9('0x33')](_['pick'](_0x1a4966[_0x78a9('0x31')],_0x1faa12[_0x78a9('0x33')]));if(_0x1a4966[_0x78a9('0x31')]['filter']){_0x5102ab[_0x78a9('0x3d')]=_['merge'](_0x5102ab[_0x78a9('0x3d')],{'$or':_['map'](_0x5102ab[_0x78a9('0x37')],function(_0x2cf0c8){var _0xfe3637={};_0xfe3637[_0x2cf0c8]={'$like':'%'+_0x1a4966[_0x78a9('0x31')][_0x78a9('0x3f')]+'%'};return _0xfe3637;})});}_0x5102ab=_[_0x78a9('0x40')]({},_0x5102ab,_0x1a4966[_0x78a9('0x43')]);return _0x16769f['getActions'](_0x5102ab);}})[_0x78a9('0x44')](function(_0x3d85f2){if(_0x3d85f2){_0x52dad6=_0x3d85f2[_0x78a9('0x38')];if(!_0x1a4966[_0x78a9('0x31')][_0x78a9('0x39')](_0x78a9('0x3a'))){_0x5102ab[_0x78a9('0x1e')]=qs[_0x78a9('0x1e')](_0x1a4966[_0x78a9('0x31')][_0x78a9('0x1e')]);_0x5102ab[_0x78a9('0x20')]=qs['offset'](_0x1a4966[_0x78a9('0x31')][_0x78a9('0x20')]);}return _0x16769f[_0x78a9('0x5d')](_0x5102ab);}})['then'](function(_0x4cdc3a){if(_0x4cdc3a){return _0x4cdc3a?{'count':_0x52dad6,'rows':_0x4cdc3a}:null;}})[_0x78a9('0x44')](respondWithResult(_0xf7d881,null))[_0x78a9('0x4a')](handleError(_0xf7d881,null));}; \ No newline at end of file +var _0xe082=['name','send','index','Trigger','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','map','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','reject','save','then','destroy','get','Triggers','UserProfileResource'];(function(_0x900295,_0x4ddc46){var _0x29d425=function(_0x25717b){while(--_0x25717b){_0x900295['push'](_0x900295['shift']());}};_0x29d425(++_0x4ddc46);}(_0xe082,0x9e));var _0x2e08=function(_0x5ad0d7,_0x2645f8){_0x5ad0d7=_0x5ad0d7-0x0;var _0xd83bd=_0xe082[_0x5ad0d7];return _0xd83bd;};'use strict';var emlformat=require(_0x2e08('0x0'));var rimraf=require(_0x2e08('0x1'));var zipdir=require(_0x2e08('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2e08('0x3'));var moment=require(_0x2e08('0x4'));var BPromise=require(_0x2e08('0x5'));var Mustache=require(_0x2e08('0x6'));var util=require(_0x2e08('0x7'));var path=require(_0x2e08('0x8'));var sox=require(_0x2e08('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2e08('0xa'));var _=require(_0x2e08('0xb'));var squel=require(_0x2e08('0xc'));var crypto=require(_0x2e08('0xd'));var jsforce=require(_0x2e08('0xe'));var deskjs=require(_0x2e08('0xf'));var toCsv=require(_0x2e08('0x10'));var querystring=require(_0x2e08('0x11'));var Papa=require(_0x2e08('0x12'));var Redis=require('ioredis');var authService=require(_0x2e08('0x13'));var qs=require(_0x2e08('0x14'));var as=require(_0x2e08('0x15'));var hardwareService=require(_0x2e08('0x16'));var logger=require(_0x2e08('0x17'))(_0x2e08('0x18'));var utils=require('../../config/utils');var config=require(_0x2e08('0x19'));var licenseUtil=require(_0x2e08('0x1a'));var db=require(_0x2e08('0x1b'))['db'];function respondWithStatusCode(_0x271657,_0x43bcc2){_0x43bcc2=_0x43bcc2||0xcc;return function(_0x5696b2){if(_0x5696b2){return _0x271657[_0x2e08('0x1c')](_0x43bcc2);}return _0x271657[_0x2e08('0x1d')](_0x43bcc2)[_0x2e08('0x1e')]();};}function respondWithResult(_0x1d384a,_0xfa1c10){_0xfa1c10=_0xfa1c10||0xc8;return function(_0x32ef48){if(_0x32ef48){return _0x1d384a['status'](_0xfa1c10)['json'](_0x32ef48);}};}function respondWithFilteredResult(_0x56a3b2,_0x47f82c){return function(_0x5ef501){if(_0x5ef501){var _0x39a0a8=typeof _0x47f82c[_0x2e08('0x1f')]===_0x2e08('0x20')&&typeof _0x47f82c['limit']===_0x2e08('0x20');var _0x17d1c2=_0x5ef501[_0x2e08('0x21')];var _0x12693e=_0x39a0a8?0x0:_0x47f82c[_0x2e08('0x1f')];var _0x3a1177=_0x39a0a8?_0x5ef501[_0x2e08('0x21')]:_0x47f82c[_0x2e08('0x1f')]+_0x47f82c['limit'];var _0xbc7c4f;if(_0x3a1177>=_0x17d1c2){_0x3a1177=_0x17d1c2;_0xbc7c4f=0xc8;}else{_0xbc7c4f=0xce;}_0x56a3b2['status'](_0xbc7c4f);return _0x56a3b2[_0x2e08('0x22')](_0x2e08('0x23'),_0x12693e+'-'+_0x3a1177+'/'+_0x17d1c2)[_0x2e08('0x24')](_0x5ef501);}return null;};}function patchUpdates(_0x53eaa6){return function(_0x46f688){try{jsonpatch['apply'](_0x46f688,_0x53eaa6,!![]);}catch(_0x7f8448){return BPromise[_0x2e08('0x25')](_0x7f8448);}return _0x46f688[_0x2e08('0x26')]();};}function saveUpdates(_0x581e32,_0x5c084c){return function(_0x434af4){if(_0x434af4){return _0x434af4['update'](_0x581e32)[_0x2e08('0x27')](function(_0xfa9c3){return _0xfa9c3;});}return null;};}function removeEntity(_0x393938,_0x40b03a){return function(_0x25c43e){if(_0x25c43e){return _0x25c43e[_0x2e08('0x28')]()[_0x2e08('0x27')](function(){var _0x552421=_0x25c43e[_0x2e08('0x29')]({'plain':!![]});var _0x21e74b=_0x2e08('0x2a');return db[_0x2e08('0x2b')][_0x2e08('0x28')]({'where':{'type':_0x21e74b,'resourceId':_0x552421['id']}})[_0x2e08('0x27')](function(){return _0x25c43e;});})['then'](function(){_0x393938[_0x2e08('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b257d,_0x3ae2fd){return function(_0x51cd67){if(!_0x51cd67){_0x2b257d[_0x2e08('0x1c')](0x194);}return _0x51cd67;};}function handleError(_0x21e52c,_0x3997e2){_0x3997e2=_0x3997e2||0x1f4;return function(_0x18ebe9){logger['error'](_0x18ebe9['stack']);if(_0x18ebe9[_0x2e08('0x2c')]){delete _0x18ebe9['name'];}_0x21e52c['status'](_0x3997e2)[_0x2e08('0x2d')](_0x18ebe9);};}exports[_0x2e08('0x2e')]=function(_0x13ca5e,_0x143700){var _0x216e4d={},_0x4c2947={},_0x121ec7={'count':0x0,'rows':[]};var _0x39e5a9=_['map'](db[_0x2e08('0x2f')]['rawAttributes'],function(_0x3b8403){return{'name':_0x3b8403[_0x2e08('0x30')],'type':_0x3b8403[_0x2e08('0x31')][_0x2e08('0x32')]};});_0x4c2947[_0x2e08('0x33')]=_['map'](_0x39e5a9,_0x2e08('0x2c'));_0x4c2947[_0x2e08('0x34')]=_['keys'](_0x13ca5e[_0x2e08('0x34')]);_0x4c2947[_0x2e08('0x35')]=_['intersection'](_0x4c2947[_0x2e08('0x33')],_0x4c2947['query']);_0x216e4d[_0x2e08('0x36')]=_[_0x2e08('0x37')](_0x4c2947['model'],qs[_0x2e08('0x38')](_0x13ca5e['query'][_0x2e08('0x38')]));_0x216e4d[_0x2e08('0x36')]=_0x216e4d[_0x2e08('0x36')][_0x2e08('0x39')]?_0x216e4d[_0x2e08('0x36')]:_0x4c2947[_0x2e08('0x33')];if(!_0x13ca5e[_0x2e08('0x34')][_0x2e08('0x3a')](_0x2e08('0x3b'))){_0x216e4d[_0x2e08('0x3c')]=qs[_0x2e08('0x3c')](_0x13ca5e[_0x2e08('0x34')][_0x2e08('0x3c')]);_0x216e4d['offset']=qs[_0x2e08('0x1f')](_0x13ca5e['query'][_0x2e08('0x1f')]);}_0x216e4d[_0x2e08('0x3d')]=qs[_0x2e08('0x3e')](_0x13ca5e[_0x2e08('0x34')][_0x2e08('0x3e')]);_0x216e4d['where']=qs[_0x2e08('0x35')](_[_0x2e08('0x3f')](_0x13ca5e[_0x2e08('0x34')],_0x4c2947[_0x2e08('0x35')]),_0x39e5a9);if(_0x13ca5e[_0x2e08('0x34')][_0x2e08('0x40')]){_0x216e4d['where']=_[_0x2e08('0x41')](_0x216e4d['where'],{'$or':_[_0x2e08('0x42')](_0x39e5a9,function(_0x4cb1e5){if(_0x4cb1e5['type']!==_0x2e08('0x43')){var _0x38384f={};_0x38384f[_0x4cb1e5[_0x2e08('0x2c')]]={'$like':'%'+_0x13ca5e[_0x2e08('0x34')][_0x2e08('0x40')]+'%'};return _0x38384f;}})});}_0x216e4d=_[_0x2e08('0x41')]({},_0x216e4d,_0x13ca5e[_0x2e08('0x44')]);var _0x4bcf72={'where':_0x216e4d[_0x2e08('0x45')]};return db['Trigger'][_0x2e08('0x21')](_0x4bcf72)['then'](function(_0x4510a9){_0x121ec7['count']=_0x4510a9;if(_0x13ca5e['query'][_0x2e08('0x46')]){_0x216e4d[_0x2e08('0x47')]=[{'all':!![]}];}return db[_0x2e08('0x2f')][_0x2e08('0x48')](_0x216e4d);})[_0x2e08('0x27')](function(_0x122b82){_0x121ec7[_0x2e08('0x49')]=_0x122b82;return _0x121ec7;})[_0x2e08('0x27')](respondWithFilteredResult(_0x143700,_0x216e4d))[_0x2e08('0x4a')](handleError(_0x143700,null));};exports[_0x2e08('0x4b')]=function(_0x4160c3,_0x3f9a18){var _0x24dff3={'raw':![],'where':{'id':_0x4160c3[_0x2e08('0x4c')]['id']}},_0x56399b={};_0x56399b[_0x2e08('0x33')]=_[_0x2e08('0x4d')](db[_0x2e08('0x2f')][_0x2e08('0x4e')]);_0x56399b['query']=_[_0x2e08('0x4d')](_0x4160c3[_0x2e08('0x34')]);_0x56399b[_0x2e08('0x35')]=_[_0x2e08('0x37')](_0x56399b['model'],_0x56399b['query']);_0x24dff3[_0x2e08('0x36')]=_[_0x2e08('0x37')](_0x56399b['model'],qs['fields'](_0x4160c3['query']['fields']));_0x24dff3[_0x2e08('0x36')]=_0x24dff3[_0x2e08('0x36')]['length']?_0x24dff3[_0x2e08('0x36')]:_0x56399b[_0x2e08('0x33')];if(_0x4160c3[_0x2e08('0x34')]['includeAll']){_0x24dff3[_0x2e08('0x47')]=[{'all':!![]}];}_0x24dff3=_[_0x2e08('0x41')]({},_0x24dff3,_0x4160c3['options']);return db[_0x2e08('0x2f')][_0x2e08('0x4f')](_0x24dff3)[_0x2e08('0x27')](handleEntityNotFound(_0x3f9a18,null))['then'](respondWithResult(_0x3f9a18,null))[_0x2e08('0x4a')](handleError(_0x3f9a18,null));};exports['create']=function(_0x5bf82f,_0x51cd6d){return db['Trigger'][_0x2e08('0x50')](_0x5bf82f[_0x2e08('0x51')],{})[_0x2e08('0x27')](function(_0x444652){var _0x452f4b=_0x5bf82f[_0x2e08('0x52')][_0x2e08('0x29')]({'plain':!![]});if(!_0x452f4b)throw new Error(_0x2e08('0x53'));if(_0x452f4b['role']==='user'){var _0x57cfff=_0x444652[_0x2e08('0x29')]({'plain':!![]});var _0x468b4c=_0x2e08('0x2a');return db[_0x2e08('0x54')][_0x2e08('0x4f')]({'where':{'name':_0x468b4c,'userProfileId':_0x452f4b[_0x2e08('0x55')]},'raw':!![]})[_0x2e08('0x27')](function(_0x3aaa84){if(_0x3aaa84&&_0x3aaa84['autoAssociation']===0x0){return db[_0x2e08('0x2b')]['create']({'name':_0x57cfff[_0x2e08('0x2c')],'resourceId':_0x57cfff['id'],'type':_0x3aaa84['name'],'sectionId':_0x3aaa84['id']},{})[_0x2e08('0x27')](function(){return _0x444652;});}else{return _0x444652;}})['catch'](function(_0x5b81a7){logger[_0x2e08('0x56')](_0x2e08('0x57'),_0x5b81a7);throw _0x5b81a7;});}return _0x444652;})[_0x2e08('0x27')](respondWithResult(_0x51cd6d,0xc9))['catch'](handleError(_0x51cd6d,null));};exports[_0x2e08('0x58')]=function(_0x5c8a2b,_0x31cb04){if(_0x5c8a2b[_0x2e08('0x51')]['id']){delete _0x5c8a2b[_0x2e08('0x51')]['id'];}return db['Trigger'][_0x2e08('0x4f')]({'where':{'id':_0x5c8a2b['params']['id']}})[_0x2e08('0x27')](handleEntityNotFound(_0x31cb04,null))[_0x2e08('0x27')](saveUpdates(_0x5c8a2b[_0x2e08('0x51')],null))[_0x2e08('0x27')](respondWithResult(_0x31cb04,null))[_0x2e08('0x4a')](handleError(_0x31cb04,null));};exports[_0x2e08('0x28')]=function(_0x3c4768,_0x54017c){return db[_0x2e08('0x2f')]['find']({'where':{'id':_0x3c4768[_0x2e08('0x4c')]['id']}})[_0x2e08('0x27')](handleEntityNotFound(_0x54017c,null))['then'](removeEntity(_0x54017c,null))[_0x2e08('0x4a')](handleError(_0x54017c,null));};exports[_0x2e08('0x59')]=function(_0x4e89f1,_0x24fa6e,_0x1cf4ad){if(_0x4e89f1[_0x2e08('0x51')]['id']){delete _0x4e89f1[_0x2e08('0x51')]['id'];}return db['Trigger'][_0x2e08('0x4f')]({'where':{'id':_0x4e89f1[_0x2e08('0x4c')]['id']}})[_0x2e08('0x27')](handleEntityNotFound(_0x24fa6e,null))[_0x2e08('0x27')](function(_0x214526){if(_0x214526){_0x4e89f1[_0x2e08('0x51')][_0x2e08('0x5a')]=_0x214526['id'];return db['Condition'][_0x2e08('0x50')](_0x4e89f1[_0x2e08('0x51')]);}})['then'](respondWithResult(_0x24fa6e,null))[_0x2e08('0x4a')](handleError(_0x24fa6e,null));};exports[_0x2e08('0x5b')]=function(_0x714c77,_0x589ca2,_0x52d8be){if(_0x714c77[_0x2e08('0x51')]['id']){delete _0x714c77[_0x2e08('0x51')]['id'];}return db[_0x2e08('0x2f')]['find']({'where':{'id':_0x714c77[_0x2e08('0x4c')]['id']}})['then'](handleEntityNotFound(_0x589ca2,null))[_0x2e08('0x27')](function(_0x503935){if(_0x503935){_0x714c77['body'][_0x2e08('0x5c')]=_0x503935['id'];return db[_0x2e08('0x5d')][_0x2e08('0x50')](_0x714c77['body']);}})[_0x2e08('0x27')](respondWithResult(_0x589ca2,null))[_0x2e08('0x4a')](handleError(_0x589ca2,null));};exports[_0x2e08('0x5e')]=function(_0x9eabcb,_0x286baf,_0x2e302e){var _0x202d5d={};var _0x32bbe4={};var _0x5af46d;var _0x5e6097;return db['Trigger'][_0x2e08('0x5f')]({'where':{'id':_0x9eabcb['params']['id']}})[_0x2e08('0x27')](handleEntityNotFound(_0x286baf,null))['then'](function(_0x99b62){if(_0x99b62){_0x5af46d=_0x99b62;_0x32bbe4[_0x2e08('0x33')]=_['keys'](db[_0x2e08('0x5d')][_0x2e08('0x4e')]);_0x32bbe4[_0x2e08('0x34')]=_[_0x2e08('0x4d')](_0x9eabcb[_0x2e08('0x34')]);_0x32bbe4['filters']=_[_0x2e08('0x37')](_0x32bbe4[_0x2e08('0x33')],_0x32bbe4[_0x2e08('0x34')]);_0x202d5d[_0x2e08('0x36')]=_[_0x2e08('0x37')](_0x32bbe4[_0x2e08('0x33')],qs[_0x2e08('0x38')](_0x9eabcb[_0x2e08('0x34')][_0x2e08('0x38')]));_0x202d5d['attributes']=_0x202d5d[_0x2e08('0x36')][_0x2e08('0x39')]?_0x202d5d[_0x2e08('0x36')]:_0x32bbe4[_0x2e08('0x33')];_0x202d5d[_0x2e08('0x3d')]=qs['sort'](_0x9eabcb[_0x2e08('0x34')][_0x2e08('0x3e')]);_0x202d5d[_0x2e08('0x45')]=qs['filters'](_[_0x2e08('0x3f')](_0x9eabcb['query'],_0x32bbe4[_0x2e08('0x35')]));if(_0x9eabcb[_0x2e08('0x34')][_0x2e08('0x40')]){_0x202d5d['where']=_[_0x2e08('0x41')](_0x202d5d[_0x2e08('0x45')],{'$or':_[_0x2e08('0x42')](_0x202d5d[_0x2e08('0x36')],function(_0x1f5212){var _0xff2d4a={};_0xff2d4a[_0x1f5212]={'$like':'%'+_0x9eabcb[_0x2e08('0x34')]['filter']+'%'};return _0xff2d4a;})});}_0x202d5d=_[_0x2e08('0x41')]({},_0x202d5d,_0x9eabcb[_0x2e08('0x44')]);return _0x5af46d[_0x2e08('0x5e')](_0x202d5d);}})[_0x2e08('0x27')](function(_0x3c06e0){if(_0x3c06e0){_0x5e6097=_0x3c06e0['length'];if(!_0x9eabcb[_0x2e08('0x34')][_0x2e08('0x3a')](_0x2e08('0x3b'))){_0x202d5d[_0x2e08('0x3c')]=qs[_0x2e08('0x3c')](_0x9eabcb['query'][_0x2e08('0x3c')]);_0x202d5d[_0x2e08('0x1f')]=qs[_0x2e08('0x1f')](_0x9eabcb[_0x2e08('0x34')]['offset']);}return _0x5af46d[_0x2e08('0x5e')](_0x202d5d);}})[_0x2e08('0x27')](function(_0x4477f1){if(_0x4477f1){return _0x4477f1?{'count':_0x5e6097,'rows':_0x4477f1}:null;}})[_0x2e08('0x27')](respondWithResult(_0x286baf,null))[_0x2e08('0x4a')](handleError(_0x286baf,null));};exports[_0x2e08('0x60')]=function(_0xfb91ed,_0x56b31e,_0x441c96){var _0x4de267={};var _0x1bfa4d={};var _0x245938;var _0x375c5f;return db[_0x2e08('0x2f')][_0x2e08('0x5f')]({'where':{'id':_0xfb91ed[_0x2e08('0x4c')]['id']}})[_0x2e08('0x27')](handleEntityNotFound(_0x56b31e,null))[_0x2e08('0x27')](function(_0x5b5d7d){if(_0x5b5d7d){_0x245938=_0x5b5d7d;_0x1bfa4d[_0x2e08('0x33')]=_[_0x2e08('0x4d')](db[_0x2e08('0x5d')][_0x2e08('0x4e')]);_0x1bfa4d['query']=_['keys'](_0xfb91ed[_0x2e08('0x34')]);_0x1bfa4d['filters']=_[_0x2e08('0x37')](_0x1bfa4d[_0x2e08('0x33')],_0x1bfa4d[_0x2e08('0x34')]);_0x4de267[_0x2e08('0x36')]=_[_0x2e08('0x37')](_0x1bfa4d[_0x2e08('0x33')],qs[_0x2e08('0x38')](_0xfb91ed['query']['fields']));_0x4de267[_0x2e08('0x36')]=_0x4de267[_0x2e08('0x36')][_0x2e08('0x39')]?_0x4de267[_0x2e08('0x36')]:_0x1bfa4d[_0x2e08('0x33')];_0x4de267[_0x2e08('0x3d')]=qs[_0x2e08('0x3e')](_0xfb91ed['query']['sort']);_0x4de267[_0x2e08('0x45')]=qs[_0x2e08('0x35')](_[_0x2e08('0x3f')](_0xfb91ed[_0x2e08('0x34')],_0x1bfa4d[_0x2e08('0x35')]));if(_0xfb91ed['query'][_0x2e08('0x40')]){_0x4de267[_0x2e08('0x45')]=_[_0x2e08('0x41')](_0x4de267[_0x2e08('0x45')],{'$or':_[_0x2e08('0x42')](_0x4de267[_0x2e08('0x36')],function(_0x480003){var _0x26e38f={};_0x26e38f[_0x480003]={'$like':'%'+_0xfb91ed[_0x2e08('0x34')][_0x2e08('0x40')]+'%'};return _0x26e38f;})});}_0x4de267=_[_0x2e08('0x41')]({},_0x4de267,_0xfb91ed[_0x2e08('0x44')]);return _0x245938[_0x2e08('0x60')](_0x4de267);}})[_0x2e08('0x27')](function(_0x468f10){if(_0x468f10){_0x375c5f=_0x468f10[_0x2e08('0x39')];if(!_0xfb91ed[_0x2e08('0x34')]['hasOwnProperty'](_0x2e08('0x3b'))){_0x4de267[_0x2e08('0x3c')]=qs[_0x2e08('0x3c')](_0xfb91ed[_0x2e08('0x34')]['limit']);_0x4de267[_0x2e08('0x1f')]=qs[_0x2e08('0x1f')](_0xfb91ed['query'][_0x2e08('0x1f')]);}return _0x245938[_0x2e08('0x60')](_0x4de267);}})[_0x2e08('0x27')](function(_0x2ffb49){if(_0x2ffb49){return _0x2ffb49?{'count':_0x375c5f,'rows':_0x2ffb49}:null;}})['then'](respondWithResult(_0x56b31e,null))['catch'](handleError(_0x56b31e,null));};exports[_0x2e08('0x61')]=function(_0x280dc5,_0xbaa664,_0x413f14){if(_0x280dc5['body']['id']){delete _0x280dc5[_0x2e08('0x51')]['id'];}return db[_0x2e08('0x2f')][_0x2e08('0x4f')]({'where':{'id':_0x280dc5[_0x2e08('0x4c')]['id']}})[_0x2e08('0x27')](handleEntityNotFound(_0xbaa664,null))[_0x2e08('0x27')](function(_0x19bbd2){if(_0x19bbd2){_0x280dc5[_0x2e08('0x51')][_0x2e08('0x62')]=_0x19bbd2['id'];return db[_0x2e08('0x63')][_0x2e08('0x50')](_0x280dc5[_0x2e08('0x51')]);}})['then'](respondWithResult(_0xbaa664,null))[_0x2e08('0x4a')](handleError(_0xbaa664,null));};exports[_0x2e08('0x64')]=function(_0x1326b4,_0x192e3f,_0x5d8e24){var _0x5bbd88={};var _0xb5aa77={};var _0x566708;var _0x1dbca1;return db[_0x2e08('0x2f')]['findOne']({'where':{'id':_0x1326b4[_0x2e08('0x4c')]['id']}})[_0x2e08('0x27')](handleEntityNotFound(_0x192e3f,null))['then'](function(_0x39e662){if(_0x39e662){_0x566708=_0x39e662;_0xb5aa77['model']=_[_0x2e08('0x4d')](db[_0x2e08('0x63')][_0x2e08('0x4e')]);_0xb5aa77[_0x2e08('0x34')]=_[_0x2e08('0x4d')](_0x1326b4['query']);_0xb5aa77[_0x2e08('0x35')]=_[_0x2e08('0x37')](_0xb5aa77['model'],_0xb5aa77[_0x2e08('0x34')]);_0x5bbd88['attributes']=_[_0x2e08('0x37')](_0xb5aa77[_0x2e08('0x33')],qs['fields'](_0x1326b4[_0x2e08('0x34')][_0x2e08('0x38')]));_0x5bbd88[_0x2e08('0x36')]=_0x5bbd88[_0x2e08('0x36')][_0x2e08('0x39')]?_0x5bbd88[_0x2e08('0x36')]:_0xb5aa77[_0x2e08('0x33')];_0x5bbd88[_0x2e08('0x3d')]=qs[_0x2e08('0x3e')](_0x1326b4[_0x2e08('0x34')][_0x2e08('0x3e')]);_0x5bbd88[_0x2e08('0x45')]=qs[_0x2e08('0x35')](_[_0x2e08('0x3f')](_0x1326b4['query'],_0xb5aa77[_0x2e08('0x35')]));if(_0x1326b4['query'][_0x2e08('0x40')]){_0x5bbd88[_0x2e08('0x45')]=_[_0x2e08('0x41')](_0x5bbd88[_0x2e08('0x45')],{'$or':_[_0x2e08('0x42')](_0x5bbd88[_0x2e08('0x36')],function(_0x5ecf0d){var _0x35a94b={};_0x35a94b[_0x5ecf0d]={'$like':'%'+_0x1326b4['query']['filter']+'%'};return _0x35a94b;})});}_0x5bbd88=_[_0x2e08('0x41')]({},_0x5bbd88,_0x1326b4[_0x2e08('0x44')]);return _0x566708['getActions'](_0x5bbd88);}})['then'](function(_0x223aab){if(_0x223aab){_0x1dbca1=_0x223aab[_0x2e08('0x39')];if(!_0x1326b4[_0x2e08('0x34')]['hasOwnProperty'](_0x2e08('0x3b'))){_0x5bbd88[_0x2e08('0x3c')]=qs[_0x2e08('0x3c')](_0x1326b4[_0x2e08('0x34')][_0x2e08('0x3c')]);_0x5bbd88[_0x2e08('0x1f')]=qs['offset'](_0x1326b4[_0x2e08('0x34')][_0x2e08('0x1f')]);}return _0x566708[_0x2e08('0x64')](_0x5bbd88);}})[_0x2e08('0x27')](function(_0x3ce268){if(_0x3ce268){return _0x3ce268?{'count':_0x1dbca1,'rows':_0x3ce268}:null;}})[_0x2e08('0x27')](respondWithResult(_0x192e3f,null))['catch'](handleError(_0x192e3f,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index ab16f66..772c482 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 _0xdc0d=['path','rimraf','../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers','lodash','util','api','bluebird','request-promise'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xdc0d,0x1db));var _0xddc0=function(_0x38bdf7,_0x5de981){_0x38bdf7=_0x38bdf7-0x0;var _0x1400e4=_0xdc0d[_0x38bdf7];return _0x1400e4;};'use strict';var _=require(_0xddc0('0x0'));var util=require(_0xddc0('0x1'));var logger=require('../../config/logger')(_0xddc0('0x2'));var moment=require('moment');var BPromise=require(_0xddc0('0x3'));var rp=require(_0xddc0('0x4'));var fs=require('fs');var path=require(_0xddc0('0x5'));var rimraf=require(_0xddc0('0x6'));var config=require(_0xddc0('0x7'));var attributes=require(_0xddc0('0x8'));module[_0xddc0('0x9')]=function(_0x39a8da,_0x20f5a9){return _0x39a8da['define'](_0xddc0('0xa'),attributes,{'tableName':_0xddc0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda55=['util','moment','bluebird','request-promise','path','rimraf','./trigger.attributes','define','Trigger','tools_triggers','lodash'];(function(_0x288371,_0x410496){var _0x33fda8=function(_0x35e0b3){while(--_0x35e0b3){_0x288371['push'](_0x288371['shift']());}};_0x33fda8(++_0x410496);}(_0xda55,0x6d));var _0x5da5=function(_0x9c1f48,_0x25da55){_0x9c1f48=_0x9c1f48-0x0;var _0x52ecd4=_0xda55[_0x9c1f48];return _0x52ecd4;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5da5('0x2'));var BPromise=require(_0x5da5('0x3'));var rp=require(_0x5da5('0x4'));var fs=require('fs');var path=require(_0x5da5('0x5'));var rimraf=require(_0x5da5('0x6'));var config=require('../../config/environment');var attributes=require(_0x5da5('0x7'));module['exports']=function(_0x356a37,_0x58e7b3){return _0x356a37[_0x5da5('0x8')](_0x5da5('0x9'),attributes,{'tableName':_0x5da5('0xa'),'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 13672e3..b3b8b4a 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 _0x23d8=['code','message','result','catch','GetTrigger','Trigger','options','where','attributes','include','map','model','find','raw','debug','ShowTrigger','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x96c9a2,_0x1e99f4){var _0x472e6e=function(_0x8f3a28){while(--_0x8f3a28){_0x96c9a2['push'](_0x96c9a2['shift']());}};_0x472e6e(++_0x1e99f4);}(_0x23d8,0x1b4));var _0x823d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x23d8[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x823d('0x0'));var moment=require(_0x823d('0x1'));var BPromise=require(_0x823d('0x2'));var rs=require(_0x823d('0x3'));var fs=require('fs');var Redis=require(_0x823d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x823d('0x5'));var logger=require(_0x823d('0x6'))(_0x823d('0x7'));var config=require(_0x823d('0x8'));var jayson=require(_0x823d('0x9'));var client=jayson[_0x823d('0xa')][_0x823d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ca2b8,_0x549764,_0x3d498f){return new BPromise(function(_0x1b0ed9,_0x36d481){return client[_0x823d('0xc')](_0x2ca2b8,_0x3d498f)[_0x823d('0xd')](function(_0x871fb5){logger[_0x823d('0xe')](_0x823d('0xf'),_0x549764,_0x823d('0x10'));logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x549764,_0x823d('0x10'),JSON[_0x823d('0x11')](_0x871fb5));if(_0x871fb5[_0x823d('0x12')]){if(_0x871fb5[_0x823d('0x12')][_0x823d('0x13')]===0x1f4){logger['error'](_0x823d('0xf'),_0x549764,_0x871fb5[_0x823d('0x12')][_0x823d('0x14')]);return _0x36d481(_0x871fb5[_0x823d('0x12')][_0x823d('0x14')]);}logger['error'](_0x823d('0xf'),_0x549764,_0x871fb5[_0x823d('0x12')]['message']);return _0x1b0ed9(_0x871fb5[_0x823d('0x12')][_0x823d('0x14')]);}else{logger[_0x823d('0xe')](_0x823d('0xf'),_0x549764,_0x823d('0x10'));_0x1b0ed9(_0x871fb5[_0x823d('0x15')][_0x823d('0x14')]);}})[_0x823d('0x16')](function(_0x49107b){logger[_0x823d('0x12')]('Trigger,\x20%s,\x20%s',_0x549764,_0x49107b);_0x36d481(_0x49107b);});});}exports[_0x823d('0x17')]=function(_0x34d915){var _0x15bbfd=this;return new Promise(function(_0x2fa12c,_0x5a8920){return db[_0x823d('0x18')]['findAll']({'raw':_0x34d915[_0x823d('0x19')]?_0x34d915[_0x823d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x34d915[_0x823d('0x19')]?_0x34d915['options'][_0x823d('0x1a')]||null:null,'attributes':_0x34d915['options']?_0x34d915[_0x823d('0x19')][_0x823d('0x1b')]||null:null,'limit':_0x34d915[_0x823d('0x19')]?_0x34d915[_0x823d('0x19')]['limit']||null:null,'include':_0x34d915[_0x823d('0x19')]?_0x34d915[_0x823d('0x19')][_0x823d('0x1c')]?_[_0x823d('0x1d')](_0x34d915['options'][_0x823d('0x1c')],function(_0xc24c94){return{'model':db[_0xc24c94[_0x823d('0x1e')]],'as':_0xc24c94['as'],'attributes':_0xc24c94[_0x823d('0x1b')],'include':_0xc24c94[_0x823d('0x1c')]?_[_0x823d('0x1d')](_0xc24c94[_0x823d('0x1c')],function(_0x454ace){return{'model':db[_0x454ace['model']],'as':_0x454ace['as'],'attributes':_0x454ace[_0x823d('0x1b')],'include':_0x454ace[_0x823d('0x1c')]?_[_0x823d('0x1d')](_0x454ace[_0x823d('0x1c')],function(_0x5994e0){return{'model':db[_0x5994e0['model']],'as':_0x5994e0['as'],'attributes':_0x5994e0[_0x823d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x93aba0){logger[_0x823d('0xe')](_0x823d('0x17'),_0x34d915);logger['debug']('GetTrigger',_0x34d915,JSON[_0x823d('0x11')](_0x93aba0));_0x2fa12c(_0x93aba0);})[_0x823d('0x16')](function(_0x4b98f0){logger[_0x823d('0x12')](_0x823d('0x17'),_0x4b98f0[_0x823d('0x14')],_0x34d915);_0x5a8920(_0x15bbfd['error'](0x1f4,_0x4b98f0['message']));});});};exports['ShowTrigger']=function(_0xab9fae){var _0x511340=this;return new Promise(function(_0x777b2a,_0x56808e){return db[_0x823d('0x18')][_0x823d('0x1f')]({'raw':_0xab9fae[_0x823d('0x19')]?_0xab9fae[_0x823d('0x19')][_0x823d('0x20')]===undefined?!![]:![]:!![],'where':_0xab9fae[_0x823d('0x19')]?_0xab9fae[_0x823d('0x19')]['where']||null:null,'attributes':_0xab9fae['options']?_0xab9fae[_0x823d('0x19')][_0x823d('0x1b')]||null:null,'include':_0xab9fae[_0x823d('0x19')]?_0xab9fae['options'][_0x823d('0x1c')]?_[_0x823d('0x1d')](_0xab9fae[_0x823d('0x19')][_0x823d('0x1c')],function(_0x545ad9){return{'model':db[_0x545ad9[_0x823d('0x1e')]],'as':_0x545ad9['as'],'attributes':_0x545ad9[_0x823d('0x1b')],'include':_0x545ad9['include']?_[_0x823d('0x1d')](_0x545ad9[_0x823d('0x1c')],function(_0xfb7fe0){return{'model':db[_0xfb7fe0[_0x823d('0x1e')]],'as':_0xfb7fe0['as'],'attributes':_0xfb7fe0[_0x823d('0x1b')],'include':_0xfb7fe0[_0x823d('0x1c')]?_[_0x823d('0x1d')](_0xfb7fe0[_0x823d('0x1c')],function(_0x134c64){return{'model':db[_0x134c64[_0x823d('0x1e')]],'as':_0x134c64['as'],'attributes':_0x134c64[_0x823d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x823d('0xd')](function(_0x506626){logger[_0x823d('0xe')]('ShowTrigger',_0xab9fae);logger[_0x823d('0x21')](_0x823d('0x22'),_0xab9fae,JSON[_0x823d('0x11')](_0x506626));_0x777b2a(_0x506626);})['catch'](function(_0x368728){logger['error'](_0x823d('0x22'),_0x368728[_0x823d('0x14')],_0xab9fae);_0x56808e(_0x511340[_0x823d('0x12')](0x1f4,_0x368728[_0x823d('0x14')]));});});}; \ No newline at end of file +var _0xbaf4=['jayson/promise','client','request','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetTrigger','findAll','raw','options','where','attributes','include','map','model','then','ShowTrigger','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x56ba45,_0xfd4fec){var _0x4a6799=function(_0x3c3ce0){while(--_0x3c3ce0){_0x56ba45['push'](_0x56ba45['shift']());}};_0x4a6799(++_0xfd4fec);}(_0xbaf4,0xa6));var _0x4baf=function(_0x4b19b3,_0x1b43f0){_0x4b19b3=_0x4b19b3-0x0;var _0x1fb070=_0xbaf4[_0x4b19b3];return _0x1fb070;};'use strict';var _=require('lodash');var util=require(_0x4baf('0x0'));var moment=require(_0x4baf('0x1'));var BPromise=require(_0x4baf('0x2'));var rs=require(_0x4baf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4baf('0x4'))['db'];var utils=require(_0x4baf('0x5'));var logger=require(_0x4baf('0x6'))(_0x4baf('0x7'));var config=require(_0x4baf('0x8'));var jayson=require(_0x4baf('0x9'));var client=jayson[_0x4baf('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4df751,_0x1a796a,_0x55daef){return new BPromise(function(_0x2cd2c4,_0xc5c3aa){return client[_0x4baf('0xb')](_0x4df751,_0x55daef)['then'](function(_0x3893bb){logger['info'](_0x4baf('0xc'),_0x1a796a,_0x4baf('0xd'));logger[_0x4baf('0xe')](_0x4baf('0xf'),_0x1a796a,'request\x20sent',JSON[_0x4baf('0x10')](_0x3893bb));if(_0x3893bb[_0x4baf('0x11')]){if(_0x3893bb[_0x4baf('0x11')][_0x4baf('0x12')]===0x1f4){logger[_0x4baf('0x11')]('Trigger,\x20%s,\x20%s',_0x1a796a,_0x3893bb[_0x4baf('0x11')]['message']);return _0xc5c3aa(_0x3893bb[_0x4baf('0x11')][_0x4baf('0x13')]);}logger['error'](_0x4baf('0xc'),_0x1a796a,_0x3893bb[_0x4baf('0x11')]['message']);return _0x2cd2c4(_0x3893bb['error'][_0x4baf('0x13')]);}else{logger[_0x4baf('0x14')](_0x4baf('0xc'),_0x1a796a,_0x4baf('0xd'));_0x2cd2c4(_0x3893bb[_0x4baf('0x15')]['message']);}})[_0x4baf('0x16')](function(_0x3c5b1d){logger[_0x4baf('0x11')](_0x4baf('0xc'),_0x1a796a,_0x3c5b1d);_0xc5c3aa(_0x3c5b1d);});});}exports[_0x4baf('0x17')]=function(_0x44889c){var _0x2b3ff1=this;return new Promise(function(_0x228d0a,_0x472952){return db['Trigger'][_0x4baf('0x18')]({'raw':_0x44889c['options']?_0x44889c['options'][_0x4baf('0x19')]===undefined?!![]:![]:!![],'where':_0x44889c['options']?_0x44889c[_0x4baf('0x1a')][_0x4baf('0x1b')]||null:null,'attributes':_0x44889c[_0x4baf('0x1a')]?_0x44889c[_0x4baf('0x1a')][_0x4baf('0x1c')]||null:null,'limit':_0x44889c[_0x4baf('0x1a')]?_0x44889c[_0x4baf('0x1a')]['limit']||null:null,'include':_0x44889c['options']?_0x44889c[_0x4baf('0x1a')][_0x4baf('0x1d')]?_[_0x4baf('0x1e')](_0x44889c[_0x4baf('0x1a')][_0x4baf('0x1d')],function(_0x52b5a0){return{'model':db[_0x52b5a0['model']],'as':_0x52b5a0['as'],'attributes':_0x52b5a0[_0x4baf('0x1c')],'include':_0x52b5a0['include']?_[_0x4baf('0x1e')](_0x52b5a0[_0x4baf('0x1d')],function(_0x1e80a6){return{'model':db[_0x1e80a6[_0x4baf('0x1f')]],'as':_0x1e80a6['as'],'attributes':_0x1e80a6[_0x4baf('0x1c')],'include':_0x1e80a6[_0x4baf('0x1d')]?_[_0x4baf('0x1e')](_0x1e80a6[_0x4baf('0x1d')],function(_0x1134e9){return{'model':db[_0x1134e9[_0x4baf('0x1f')]],'as':_0x1134e9['as'],'attributes':_0x1134e9[_0x4baf('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4baf('0x20')](function(_0x8f81f8){logger[_0x4baf('0x14')](_0x4baf('0x17'),_0x44889c);logger[_0x4baf('0xe')](_0x4baf('0x17'),_0x44889c,JSON[_0x4baf('0x10')](_0x8f81f8));_0x228d0a(_0x8f81f8);})[_0x4baf('0x16')](function(_0x552f7d){logger[_0x4baf('0x11')]('GetTrigger',_0x552f7d[_0x4baf('0x13')],_0x44889c);_0x472952(_0x2b3ff1['error'](0x1f4,_0x552f7d[_0x4baf('0x13')]));});});};exports[_0x4baf('0x21')]=function(_0x19d725){var _0x380076=this;return new Promise(function(_0x20e934,_0x1eb487){return db['Trigger'][_0x4baf('0x22')]({'raw':_0x19d725['options']?_0x19d725[_0x4baf('0x1a')][_0x4baf('0x19')]===undefined?!![]:![]:!![],'where':_0x19d725[_0x4baf('0x1a')]?_0x19d725[_0x4baf('0x1a')][_0x4baf('0x1b')]||null:null,'attributes':_0x19d725[_0x4baf('0x1a')]?_0x19d725[_0x4baf('0x1a')]['attributes']||null:null,'include':_0x19d725[_0x4baf('0x1a')]?_0x19d725[_0x4baf('0x1a')][_0x4baf('0x1d')]?_[_0x4baf('0x1e')](_0x19d725['options'][_0x4baf('0x1d')],function(_0x21a95a){return{'model':db[_0x21a95a[_0x4baf('0x1f')]],'as':_0x21a95a['as'],'attributes':_0x21a95a[_0x4baf('0x1c')],'include':_0x21a95a['include']?_['map'](_0x21a95a[_0x4baf('0x1d')],function(_0x4b469b){return{'model':db[_0x4b469b[_0x4baf('0x1f')]],'as':_0x4b469b['as'],'attributes':_0x4b469b[_0x4baf('0x1c')],'include':_0x4b469b[_0x4baf('0x1d')]?_['map'](_0x4b469b[_0x4baf('0x1d')],function(_0x11e1f9){return{'model':db[_0x11e1f9[_0x4baf('0x1f')]],'as':_0x11e1f9['as'],'attributes':_0x11e1f9['attributes']};}):[]};}):[]};}):[]:[]})[_0x4baf('0x20')](function(_0x25db74){logger[_0x4baf('0x14')](_0x4baf('0x21'),_0x19d725);logger[_0x4baf('0xe')](_0x4baf('0x21'),_0x19d725,JSON[_0x4baf('0x10')](_0x25db74));_0x20e934(_0x25db74);})[_0x4baf('0x16')](function(_0x21719e){logger[_0x4baf('0x11')](_0x4baf('0x21'),_0x21719e[_0x4baf('0x13')],_0x19d725);_0x1eb487(_0x380076[_0x4baf('0x11')](0x1f4,_0x21719e['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 20cd908..3f5f85d 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 _0x1f38=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','/:id/clone','clone','create','put','update','delete','destroy','exports','util','path'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x1f38,0x1a2));var _0x81f3=function(_0xd511d,_0x3546b9){_0xd511d=_0xd511d-0x0;var _0x3f148e=_0x1f38[_0xd511d];return _0x3f148e;};'use strict';var multer=require('multer');var util=require(_0x81f3('0x0'));var path=require(_0x81f3('0x1'));var timeout=require('connect-timeout');var express=require(_0x81f3('0x2'));var router=express[_0x81f3('0x3')]();var fs_extra=require(_0x81f3('0x4'));var auth=require(_0x81f3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x81f3('0x6'));var controller=require(_0x81f3('0x7'));router[_0x81f3('0x8')]('/',auth[_0x81f3('0x9')](),controller[_0x81f3('0xa')]);router[_0x81f3('0x8')](_0x81f3('0xb'),auth['isAuthenticated'](),controller[_0x81f3('0xc')]);router['post'](_0x81f3('0xd'),auth[_0x81f3('0x9')](),controller[_0x81f3('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x81f3('0xf')]);router[_0x81f3('0x10')](_0x81f3('0xb'),auth[_0x81f3('0x9')](),controller[_0x81f3('0x11')]);router[_0x81f3('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x81f3('0x13')]);module[_0x81f3('0x14')]=router; \ No newline at end of file +var _0xf45a=['./trunk.controller','get','show','post','clone','isAuthenticated','create','/:id','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x1a1c13,_0x49350f){var _0xce41cd=function(_0x2b948f){while(--_0x2b948f){_0x1a1c13['push'](_0x1a1c13['shift']());}};_0xce41cd(++_0x49350f);}(_0xf45a,0x170));var _0xaf45=function(_0x4c962a,_0x2bb331){_0x4c962a=_0x4c962a-0x0;var _0x26232f=_0xf45a[_0x4c962a];return _0x26232f;};'use strict';var multer=require(_0xaf45('0x0'));var util=require('util');var path=require(_0xaf45('0x1'));var timeout=require(_0xaf45('0x2'));var express=require(_0xaf45('0x3'));var router=express[_0xaf45('0x4')]();var fs_extra=require(_0xaf45('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaf45('0x6'));var controller=require(_0xaf45('0x7'));router[_0xaf45('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xaf45('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xaf45('0x9')]);router[_0xaf45('0xa')]('/:id/clone',auth['isAuthenticated'](),controller[_0xaf45('0xb')]);router[_0xaf45('0xa')]('/',auth[_0xaf45('0xc')](),controller[_0xaf45('0xd')]);router['put'](_0xaf45('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xaf45('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index da4e71e..3b2fd19 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 _0x397a=['passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','name','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','STRING','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','yes','update','outgoing','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','active'];(function(_0x14ddd4,_0x5b527d){var _0x421616=function(_0x4f0a42){while(--_0x4f0a42){_0x14ddd4['push'](_0x14ddd4['shift']());}};_0x421616(++_0x5b527d);}(_0x397a,0x11f));var _0xa397=function(_0x2b0d7e,_0x48ae97){_0x2b0d7e=_0x2b0d7e-0x0;var _0x4332b4=_0x397a[_0x2b0d7e];return _0x4332b4;};'use strict';var Sequelize=require(_0xa397('0x0'));module[_0xa397('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa397('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x4'),'user',_0xa397('0x5')),'allowNull':![],'defaultValue':_0xa397('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa397('0x6')},'callingpres':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x7'),_0xa397('0x8'),_0xa397('0x9'),'ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xa397('0xa'),_0xa397('0xb'))},'deny':{'type':Sequelize[_0xa397('0xc')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xa397('0xc')]},'md5secret':{'type':Sequelize[_0xa397('0xc')]},'remotesecret':{'type':Sequelize[_0xa397('0xc')]},'transport':{'type':Sequelize[_0xa397('0xc')],'defaultValue':'udp','set':function(_0x3bbafc){this['setDataValue'](_0xa397('0xd'),_0x3bbafc?_0x3bbafc[_0xa397('0xe')](','):null);},'get':function(){return this[_0xa397('0xf')]('transport')?this[_0xa397('0xf')](_0xa397('0xd'))[_0xa397('0x10')](','):null;},'comment':_0xa397('0x11')},'dtmfmode':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x12'),'info',_0xa397('0x13'),_0xa397('0x14'),'auto'),'defaultValue':_0xa397('0x12')},'directmedia':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no','nonat',_0xa397('0x16'),_0xa397('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa397('0xc')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xa397('0xc')],'defaultValue':'force_rport,comedia','set':function(_0x3f17da){this[_0xa397('0x18')](_0xa397('0x19'),_0x3f17da?_0x3f17da[_0xa397('0xe')](','):null);},'get':function(){return this[_0xa397('0xf')]('nat')?this['getDataValue'](_0xa397('0x19'))['split'](','):null;},'comment':_0xa397('0x1a')},'callgroup':{'type':Sequelize[_0xa397('0xc')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xa397('0xc')]},'language':{'type':Sequelize[_0xa397('0xc')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa397('0xc')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xa397('0xc')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xa397('0xc')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x147381){this['setDataValue'](_0xa397('0x1b'),_0x147381?_0x147381[_0xa397('0xe')](';'):_0xa397('0x1c'));},'get':function(){return this[_0xa397('0xf')]('allow')?this[_0xa397('0xf')]('allow')['split'](';'):null;},'comment':_0xa397('0x1d')},'autoframing':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no')},'insecure':{'type':Sequelize[_0xa397('0xc')],'defaultValue':'port,invite','set':function(_0x713289){this['setDataValue'](_0xa397('0x1e'),_0x713289?_0x713289[_0xa397('0xe')](','):null);},'get':function(){return this['getDataValue'](_0xa397('0x1e'))?this['getDataValue'](_0xa397('0x1e'))[_0xa397('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xa397('0x15'),'no',_0xa397('0x1f'))},'promiscredir':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no')},'useclientcode':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no')},'accountcode':{'type':Sequelize[_0xa397('0x20')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa397('0xc')],'defaultValue':_0xa397('0x21')},'amaflags':{'type':Sequelize[_0xa397('0xc')]},'callcounter':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xa397('0x15'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no')},'subscribecontext':{'type':Sequelize[_0xa397('0xc')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no',_0xa397('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa397('0x20')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xa397('0x3')]('yes','no')},'mailbox':{'type':Sequelize[_0xa397('0xc')]},'session_timers':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x23'),_0xa397('0x24'),_0xa397('0x25'))},'session_expires':{'type':Sequelize[_0xa397('0x20')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x26'),_0xa397('0x27')),'defaultValue':_0xa397('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0xa397('0xc')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xa397('0x20')](0x5)},'qualify':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no'),'defaultValue':_0xa397('0x15')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xa397('0xc')]},'defaultuser':{'type':Sequelize[_0xa397('0xc')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xa397('0x20')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xa397('0x20')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xa397('0x15'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa397('0xc')]},'callbackextension':{'type':Sequelize[_0xa397('0xc')]},'timert1':{'type':Sequelize[_0xa397('0x20')](0xb)},'timerb':{'type':Sequelize[_0xa397('0x20')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xa397('0xc')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xa397('0xc')]},'unsolicited_mailbox':{'type':Sequelize[_0xa397('0xc')]},'use_q850_reason':{'type':Sequelize[_0xa397('0xc')]},'maxforwards':{'type':Sequelize[_0xa397('0x20')](0xb)},'encryption':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa397('0x3')]('yes','no')},'force_avp':{'type':Sequelize['ENUM'](_0xa397('0x15'),'no')},'icesupport':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0xa397('0x28'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xa397('0xc')]},'dtlscipher':{'type':Sequelize[_0xa397('0xc')]},'dtlscafile':{'type':Sequelize[_0xa397('0xc')]},'dtlscapath':{'type':Sequelize[_0xa397('0xc')]},'dtlssetup':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x29'),_0xa397('0x2a'),_0xa397('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xa397('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa397('0xc')]},'recordofffeature':{'type':Sequelize[_0xa397('0xc')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xa397('0x15'),'no')},'subscribemwi':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xa397('0xc')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa397('0xc')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xa397('0x2c')},'canreinvite':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no','nonat',_0xa397('0x16'),_0xa397('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xa397('0xc')]},'otherFields':{'type':Sequelize[_0xa397('0xc')]},'active':{'type':Sequelize[_0xa397('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xa397('0xc')],'defaultValue':'no'}}; \ No newline at end of file +var _0x65e5=['STRING','name','ENUM','friend','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','fingerprint','certificate','passive','actpass','dynamic','BOOLEAN','sequelize','exports'];(function(_0x1d5370,_0x363f29){var _0x24e2e1=function(_0x4c6ce7){while(--_0x4c6ce7){_0x1d5370['push'](_0x1d5370['shift']());}};_0x24e2e1(++_0x363f29);}(_0x65e5,0xca));var _0x565e=function(_0x734ec7,_0x85423e){_0x734ec7=_0x734ec7-0x0;var _0x21c9eb=_0x65e5[_0x734ec7];return _0x21c9eb;};'use strict';var Sequelize=require(_0x565e('0x0'));module[_0x565e('0x1')]={'name':{'type':Sequelize[_0x565e('0x2')],'allowNull':![],'unique':_0x565e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x565e('0x4')](_0x565e('0x5'),'user',_0x565e('0x6')),'allowNull':![],'defaultValue':_0x565e('0x5')},'context':{'type':Sequelize[_0x565e('0x2')],'allowNull':![],'defaultValue':_0x565e('0x7')},'callingpres':{'type':Sequelize[_0x565e('0x4')]('ALLOWED_NOT_SCREENED',_0x565e('0x8'),_0x565e('0x9'),'ALLOWED',_0x565e('0xa'),_0x565e('0xb'),_0x565e('0xc'),_0x565e('0xd'))},'deny':{'type':Sequelize[_0x565e('0x2')]},'permit':{'type':Sequelize[_0x565e('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x565e('0x2')]},'transport':{'type':Sequelize[_0x565e('0x2')],'defaultValue':_0x565e('0xe'),'set':function(_0x52bf68){this[_0x565e('0xf')](_0x565e('0x10'),_0x52bf68?_0x52bf68[_0x565e('0x11')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x565e('0x12')]('transport')[_0x565e('0x13')](','):null;},'comment':_0x565e('0x14')},'dtmfmode':{'type':Sequelize[_0x565e('0x4')](_0x565e('0x15'),_0x565e('0x16'),'shortinfo',_0x565e('0x17'),_0x565e('0x18')),'defaultValue':_0x565e('0x15')},'directmedia':{'type':Sequelize[_0x565e('0x4')](_0x565e('0x19'),'no','nonat',_0x565e('0x1a'),_0x565e('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x565e('0x4')](_0x565e('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x565e('0x2')]},'directmediadeny':{'type':Sequelize[_0x565e('0x2')]},'nat':{'type':Sequelize[_0x565e('0x2')],'defaultValue':_0x565e('0x1c'),'set':function(_0x1337e5){this[_0x565e('0xf')](_0x565e('0x1d'),_0x1337e5?_0x1337e5[_0x565e('0x11')](','):null);},'get':function(){return this[_0x565e('0x12')]('nat')?this[_0x565e('0x12')](_0x565e('0x1d'))[_0x565e('0x13')](','):null;},'comment':_0x565e('0x1e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x565e('0x2')]},'pickupgroup':{'type':Sequelize[_0x565e('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x565e('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x565e('0x2')],'defaultValue':_0x565e('0x1f')},'allow':{'type':Sequelize[_0x565e('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4cedf8){this['setDataValue']('allow',_0x4cedf8?_0x4cedf8[_0x565e('0x11')](';'):_0x565e('0x20'));},'get':function(){return this['getDataValue'](_0x565e('0x21'))?this[_0x565e('0x12')](_0x565e('0x21'))[_0x565e('0x13')](';'):null;},'comment':_0x565e('0x22')},'autoframing':{'type':Sequelize[_0x565e('0x4')](_0x565e('0x19'),'no')},'insecure':{'type':Sequelize[_0x565e('0x2')],'defaultValue':_0x565e('0x23'),'set':function(_0x141c00){this[_0x565e('0xf')](_0x565e('0x24'),_0x141c00?_0x141c00['join'](','):null);},'get':function(){return this['getDataValue'](_0x565e('0x24'))?this['getDataValue'](_0x565e('0x24'))[_0x565e('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x565e('0x4')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x565e('0x4')](_0x565e('0x19'),'no',_0x565e('0x25'))},'promiscredir':{'type':Sequelize[_0x565e('0x4')](_0x565e('0x19'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x565e('0x19'),'no')},'accountcode':{'type':Sequelize[_0x565e('0x26')](0xb)},'setvar':{'type':Sequelize[_0x565e('0x2')]},'callerid':{'type':Sequelize[_0x565e('0x2')],'defaultValue':_0x565e('0x27')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x565e('0x4')](_0x565e('0x19'),'no'),'defaultValue':_0x565e('0x19')},'busylevel':{'type':Sequelize[_0x565e('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x565e('0x4')](_0x565e('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x565e('0x4')](_0x565e('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x565e('0x4')](_0x565e('0x19'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x565e('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x565e('0x2')]},'template':{'type':Sequelize[_0x565e('0x2')]},'videosupport':{'type':Sequelize[_0x565e('0x4')](_0x565e('0x19'),'no',_0x565e('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x565e('0x4')](_0x565e('0x19'),'no')},'mailbox':{'type':Sequelize[_0x565e('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x565e('0x29'),_0x565e('0x2a'),_0x565e('0x2b'))},'session_expires':{'type':Sequelize[_0x565e('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x565e('0x26')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x565e('0x2c'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x565e('0x2')]},'fromdomain':{'type':Sequelize[_0x565e('0x2')]},'fromuser':{'type':Sequelize[_0x565e('0x2')]},'port':{'type':Sequelize[_0x565e('0x26')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x565e('0x19'),'no'),'defaultValue':_0x565e('0x19')},'keepalive':{'type':Sequelize[_0x565e('0x26')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x565e('0x2')]},'rtptimeout':{'type':Sequelize[_0x565e('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x565e('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x565e('0x4')]('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x565e('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x565e('0x26')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x565e('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x565e('0x2')]},'contactdeny':{'type':Sequelize[_0x565e('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x565e('0x2')]},'use_q850_reason':{'type':Sequelize[_0x565e('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x565e('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x565e('0x19'),'no')},'force_avp':{'type':Sequelize[_0x565e('0x4')]('yes','no')},'icesupport':{'type':Sequelize['ENUM'](_0x565e('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x565e('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x565e('0x4')](_0x565e('0x19'),'no',_0x565e('0x2d'),_0x565e('0x2e'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x565e('0x2')]},'dtlscipher':{'type':Sequelize[_0x565e('0x2')]},'dtlscafile':{'type':Sequelize[_0x565e('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x565e('0x4')]('active',_0x565e('0x2f'),_0x565e('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x565e('0x2')]},'call_limit':{'type':Sequelize[_0x565e('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x565e('0x4')](_0x565e('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x565e('0x4')](_0x565e('0x19'),'no')},'vmexten':{'type':Sequelize[_0x565e('0x2')]},'mohinterpret':{'type':Sequelize[_0x565e('0x2')]},'mohsuggest':{'type':Sequelize[_0x565e('0x2')]},'parkinglot':{'type':Sequelize[_0x565e('0x2')]},'description':{'type':Sequelize[_0x565e('0x2')]},'host':{'type':Sequelize[_0x565e('0x2')],'defaultValue':_0x565e('0x31')},'canreinvite':{'type':Sequelize[_0x565e('0x4')](_0x565e('0x19'),'no','nonat','update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x565e('0x2')]},'active':{'type':Sequelize[_0x565e('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x565e('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 0199cfd..9a816cd 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 _0xedd9=['body','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','create','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Trunk,\x20%s,\x20%s','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','Trunk','findAll','rows','show','params','length','find','omit'];(function(_0x6da7e2,_0xfd5c26){var _0x4275cc=function(_0x558a66){while(--_0x558a66){_0x6da7e2['push'](_0x6da7e2['shift']());}};_0x4275cc(++_0xfd5c26);}(_0xedd9,0xfc));var _0x9edd=function(_0x36bf50,_0x2dfbe9){_0x36bf50=_0x36bf50-0x0;var _0x17b804=_0xedd9[_0x36bf50];return _0x17b804;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];var jayson=require(_0x9edd('0x18'));var client=jayson[_0x9edd('0x19')][_0x9edd('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xfca576,_0xef5498,_0x47eb64,_0x176bfa){return new BPromise(function(_0x44fc7c,_0x891832){var _0x4d9a7=_0x176bfa||client;return _0x4d9a7[_0x9edd('0x1b')](_0xfca576,_0x47eb64)[_0x9edd('0x1c')](function(_0x1042aa){logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x9edd('0x1e'));logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0xef5498,'request\x20sent',JSON[_0x9edd('0x21')](_0x1042aa));if(_0x1042aa[_0x9edd('0x22')]){if(_0x1042aa[_0x9edd('0x22')]['code']===0x1f4){logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')][_0x9edd('0x23')]);return _0x891832(_0x1042aa['error']['message']);}logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')]['message']);return _0x44fc7c(_0x1042aa['error'][_0x9edd('0x23')]);}else{logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,'request\x20sent');_0x44fc7c(_0x1042aa[_0x9edd('0x24')][_0x9edd('0x23')]);}})[_0x9edd('0x25')](function(_0x542172){logger[_0x9edd('0x22')](_0x9edd('0x26'),_0xef5498,_0x542172);_0x891832(_0x542172);});});}function respondWithStatusCode(_0x44a6c1,_0x2ca65f){_0x2ca65f=_0x2ca65f||0xcc;return function(_0x339a0d){if(_0x339a0d){return _0x44a6c1['sendStatus'](_0x2ca65f);}return _0x44a6c1[_0x9edd('0x27')](_0x2ca65f)[_0x9edd('0x28')]();};}function respondWithResult(_0x3a1ea5,_0x2f9f86){_0x2f9f86=_0x2f9f86||0xc8;return function(_0x310a4d){if(_0x310a4d){return _0x3a1ea5['status'](_0x2f9f86)['json'](_0x310a4d);}};}function respondWithFilteredResult(_0x3276ee,_0xfeca7b){return function(_0x8d67aa){if(_0x8d67aa){var _0x25e135=typeof _0xfeca7b[_0x9edd('0x29')]==='undefined'&&typeof _0xfeca7b['limit']===_0x9edd('0x2a');var _0x257a26=_0x8d67aa[_0x9edd('0x2b')];var _0x52746a=_0x25e135?0x0:_0xfeca7b[_0x9edd('0x29')];var _0x28cfae=_0x25e135?_0x8d67aa[_0x9edd('0x2b')]:_0xfeca7b[_0x9edd('0x29')]+_0xfeca7b['limit'];var _0x2155a1;if(_0x28cfae>=_0x257a26){_0x28cfae=_0x257a26;_0x2155a1=0xc8;}else{_0x2155a1=0xce;}_0x3276ee[_0x9edd('0x27')](_0x2155a1);return _0x3276ee[_0x9edd('0x2c')](_0x9edd('0x2d'),_0x52746a+'-'+_0x28cfae+'/'+_0x257a26)[_0x9edd('0x2e')](_0x8d67aa);}return null;};}function patchUpdates(_0x42e664){return function(_0x209aba){try{jsonpatch[_0x9edd('0x2f')](_0x209aba,_0x42e664,!![]);}catch(_0x19b6c1){return BPromise[_0x9edd('0x30')](_0x19b6c1);}return _0x209aba[_0x9edd('0x31')]();};}function saveUpdates(_0x138002,_0x6907a5){return function(_0xa55906){if(_0xa55906){return _0xa55906[_0x9edd('0x32')](_0x138002)['then'](function(_0x1453d2){return _0x1453d2;});}return null;};}function removeEntity(_0x259259,_0x267c74){return function(_0x5d1707){if(_0x5d1707){return _0x5d1707[_0x9edd('0x33')]()[_0x9edd('0x1c')](function(){var _0xde9b13=_0x5d1707[_0x9edd('0x34')]({'plain':!![]});var _0x21bc30=_0x9edd('0x35');return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'type':_0x21bc30,'resourceId':_0xde9b13['id']}})[_0x9edd('0x1c')](function(){return _0x5d1707;});})[_0x9edd('0x1c')](function(){_0x259259[_0x9edd('0x27')](0xcc)[_0x9edd('0x28')]();});}};}function handleEntityNotFound(_0x27eb7e,_0x14f780){return function(_0x5757fc){if(!_0x5757fc){_0x27eb7e[_0x9edd('0x37')](0x194);}return _0x5757fc;};}function handleError(_0x5ed62d,_0x968303){_0x968303=_0x968303||0x1f4;return function(_0x148630){logger[_0x9edd('0x22')](_0x148630[_0x9edd('0x38')]);if(_0x148630[_0x9edd('0x39')]){delete _0x148630['name'];}_0x5ed62d[_0x9edd('0x27')](_0x968303)[_0x9edd('0x3a')](_0x148630);};}exports[_0x9edd('0x3b')]=function(_0x38e9be,_0x1be77f){var _0x337e6c={},_0x5c0627={},_0x1cbbac={'count':0x0,'rows':[]};var _0x1ccee8=_[_0x9edd('0x3c')](db['Trunk'][_0x9edd('0x3d')],function(_0x56a228){return{'name':_0x56a228[_0x9edd('0x3e')],'type':_0x56a228['type'][_0x9edd('0x3f')]};});_0x5c0627[_0x9edd('0x40')]=_[_0x9edd('0x3c')](_0x1ccee8,'name');_0x5c0627[_0x9edd('0x41')]=_[_0x9edd('0x42')](_0x38e9be[_0x9edd('0x41')]);_0x5c0627['filters']=_[_0x9edd('0x43')](_0x5c0627['model'],_0x5c0627[_0x9edd('0x41')]);_0x337e6c[_0x9edd('0x44')]=_['intersection'](_0x5c0627[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x45')]));_0x337e6c['attributes']=_0x337e6c[_0x9edd('0x44')]['length']?_0x337e6c[_0x9edd('0x44')]:_0x5c0627[_0x9edd('0x40')];if(!_0x38e9be['query'][_0x9edd('0x46')]('nolimit')){_0x337e6c['limit']=qs[_0x9edd('0x47')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x47')]);_0x337e6c[_0x9edd('0x29')]=qs[_0x9edd('0x29')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x29')]);}_0x337e6c[_0x9edd('0x48')]=qs[_0x9edd('0x49')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x49')]);_0x337e6c[_0x9edd('0x4a')]=qs[_0x9edd('0x4b')](_[_0x9edd('0x4c')](_0x38e9be[_0x9edd('0x41')],_0x5c0627['filters']),_0x1ccee8);if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x4d')]){_0x337e6c[_0x9edd('0x4a')]=_[_0x9edd('0x4e')](_0x337e6c[_0x9edd('0x4a')],{'$or':_[_0x9edd('0x3c')](_0x1ccee8,function(_0x10d41e){if(_0x10d41e['type']!=='VIRTUAL'){var _0x4bc7a1={};_0x4bc7a1[_0x10d41e[_0x9edd('0x39')]]={'$like':'%'+_0x38e9be['query'][_0x9edd('0x4d')]+'%'};return _0x4bc7a1;}})});}_0x337e6c=_[_0x9edd('0x4e')]({},_0x337e6c,_0x38e9be[_0x9edd('0x4f')]);var _0x8db801={'where':_0x337e6c[_0x9edd('0x4a')]};return db['Trunk'][_0x9edd('0x2b')](_0x8db801)[_0x9edd('0x1c')](function(_0x40e33d){_0x1cbbac['count']=_0x40e33d;if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x50')]){_0x337e6c[_0x9edd('0x51')]=[{'all':!![]}];}return db[_0x9edd('0x52')][_0x9edd('0x53')](_0x337e6c);})[_0x9edd('0x1c')](function(_0x4d4f33){_0x1cbbac[_0x9edd('0x54')]=_0x4d4f33;return _0x1cbbac;})[_0x9edd('0x1c')](respondWithFilteredResult(_0x1be77f,_0x337e6c))['catch'](handleError(_0x1be77f,null));};exports[_0x9edd('0x55')]=function(_0x8d8701,_0x4bb324){var _0x2bd089={'raw':![],'where':{'id':_0x8d8701[_0x9edd('0x56')]['id']}},_0x8134cd={};_0x8134cd['model']=_[_0x9edd('0x42')](db[_0x9edd('0x52')][_0x9edd('0x3d')]);_0x8134cd[_0x9edd('0x41')]=_['keys'](_0x8d8701[_0x9edd('0x41')]);_0x8134cd[_0x9edd('0x4b')]=_[_0x9edd('0x43')](_0x8134cd['model'],_0x8134cd[_0x9edd('0x41')]);_0x2bd089[_0x9edd('0x44')]=_['intersection'](_0x8134cd[_0x9edd('0x40')],qs['fields'](_0x8d8701[_0x9edd('0x41')][_0x9edd('0x45')]));_0x2bd089[_0x9edd('0x44')]=_0x2bd089[_0x9edd('0x44')][_0x9edd('0x57')]?_0x2bd089[_0x9edd('0x44')]:_0x8134cd[_0x9edd('0x40')];if(_0x8d8701[_0x9edd('0x41')][_0x9edd('0x50')]){_0x2bd089[_0x9edd('0x51')]=[{'all':!![]}];}_0x2bd089=_[_0x9edd('0x4e')]({},_0x2bd089,_0x8d8701['options']);return db[_0x9edd('0x52')][_0x9edd('0x58')](_0x2bd089)[_0x9edd('0x1c')](handleEntityNotFound(_0x4bb324,null))['then'](respondWithResult(_0x4bb324,null))[_0x9edd('0x25')](handleError(_0x4bb324,null));};exports['clone']=function(_0x54d83d,_0x54ecfa){var _0x1348a7={'where':{'id':_0x54d83d[_0x9edd('0x56')]['id']}},_0x45f47c={};_0x45f47c[_0x9edd('0x40')]=_['keys'](db['Trunk']['rawAttributes']);_0x1348a7[_0x9edd('0x44')]=_[_0x9edd('0x43')](_0x45f47c[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x54d83d[_0x9edd('0x41')][_0x9edd('0x45')]));_0x1348a7[_0x9edd('0x44')]=_0x1348a7[_0x9edd('0x44')]['length']?_0x1348a7[_0x9edd('0x44')]:_0x45f47c['model'];if(_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]){_0x1348a7['include']=[{'all':!![]}];}_0x1348a7=_[_0x9edd('0x4e')]({},_0x1348a7,_0x54d83d[_0x9edd('0x4f')]);return db[_0x9edd('0x52')]['find'](_0x1348a7)[_0x9edd('0x1c')](handleEntityNotFound(_0x54ecfa,null))[_0x9edd('0x1c')](function(_0x430eb4){if(_0x430eb4){var _0x15ebfa=_0x430eb4[_0x9edd('0x34')]({'plain':!![]});_0x15ebfa=qs[_0x9edd('0x59')](_0x15ebfa,['id','createdAt','updatedAt']);_0x54d83d[_0x9edd('0x5a')]=_['omit'](_0x54d83d[_0x9edd('0x5a')],['id',_0x9edd('0x5b'),_0x9edd('0x5c')]);return db[_0x9edd('0x52')]['create'](_[_0x9edd('0x4e')](_0x15ebfa,_0x54d83d['body']),{'include':_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]?[{'all':!![]}]:undefined})[_0x9edd('0x1c')](function(_0x5ca123){var _0x2651a2=_0x54d83d['user'][_0x9edd('0x34')]({'plain':!![]});if(!_0x2651a2)throw new Error(_0x9edd('0x5d'));if(_0x2651a2['role']===_0x9edd('0x5e')){var _0x4a72d0=_0x5ca123[_0x9edd('0x34')]({'plain':!![]});var _0x134c9c=_0x9edd('0x35');return db['UserProfileSection'][_0x9edd('0x58')]({'where':{'name':_0x134c9c,'userProfileId':_0x2651a2[_0x9edd('0x5f')]},'raw':!![]})[_0x9edd('0x1c')](function(_0x2015fc){if(_0x2015fc&&_0x2015fc[_0x9edd('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x4a72d0[_0x9edd('0x39')],'resourceId':_0x4a72d0['id'],'type':_0x2015fc[_0x9edd('0x39')],'sectionId':_0x2015fc['id']},{})['then'](function(){return _0x5ca123;});}else{return _0x5ca123;}})['catch'](function(_0x52afd7){logger[_0x9edd('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52afd7);throw _0x52afd7;});}return _0x5ca123;});}})['then'](respondWithResult(_0x54ecfa,0xc9))[_0x9edd('0x25')](handleError(_0x54ecfa,null));};exports[_0x9edd('0x61')]=function(_0x589348,_0xb9ebeb,_0x11e082){var _0x34dff5;return db['Trunk'][_0x9edd('0x61')](_0x589348['body'],{'raw':!![]})[_0x9edd('0x1c')](function(_0x18d1a0){_0x34dff5=_0x18d1a0;return db['Trunk'][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x5c1746){var _0x2bd6d1=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/trunk.ejs'),_0x9edd('0x65'));var _0x58330c=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/registry.ejs'),_0x9edd('0x65'));var _0x286593=ejs[_0x9edd('0x66')](_0x2bd6d1,{'trunks':_0x5c1746||[]});fs[_0x9edd('0x67')](_0x9edd('0x68'),_0x286593);if(_0x34dff5[_0x9edd('0x69')]){var _0x3fa4a9=ejs['render'](_0x58330c,{'trunks':_0x5c1746||[]});fs['writeFileSync'](_0x9edd('0x6a'),_0x3fa4a9);}})[_0x9edd('0x1c')](function(){return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x61'),{'module':_0x9edd('0x6c')});})['then'](function(){var _0x2e40c8=_0x589348[_0x9edd('0x5e')][_0x9edd('0x34')]({'plain':!![]});if(!_0x2e40c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e40c8[_0x9edd('0x6d')]===_0x9edd('0x5e')){var _0x4b1c12=_0x34dff5[_0x9edd('0x34')]({'plain':!![]});return db[_0x9edd('0x6e')]['find']({'where':{'name':_0x9edd('0x35'),'userProfileId':_0x2e40c8[_0x9edd('0x5f')]},'raw':!![]})['then'](function(_0x3f08ac){if(_0x3f08ac&&_0x3f08ac['autoAssociation']===0x0){return db['UserProfileResource'][_0x9edd('0x61')]({'name':_0x4b1c12[_0x9edd('0x39')],'resourceId':_0x4b1c12['id'],'type':_0x3f08ac[_0x9edd('0x39')],'sectionId':_0x3f08ac['id']},{})['then'](function(){return _0x34dff5;});}else{return _0x34dff5;}})[_0x9edd('0x25')](function(_0x286e47){logger['error'](_0x9edd('0x6f'),_0x286e47);throw _0x286e47;});}return _0x34dff5;})[_0x9edd('0x1c')](respondWithResult(_0xb9ebeb,0xc9))[_0x9edd('0x25')](handleError(_0xb9ebeb,null));};exports[_0x9edd('0x32')]=function(_0x54ac71,_0x5e68db,_0x1129b7){var _0x5bb28c;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x54ac71[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x5e68db,null))[_0x9edd('0x1c')](saveUpdates(_0x54ac71[_0x9edd('0x5a')],null))[_0x9edd('0x1c')](function(_0x5a4d4b){if(_0x5a4d4b){_0x5bb28c=_0x5a4d4b;return db[_0x9edd('0x52')]['findAll']({'raw':!![]});}})[_0x9edd('0x1c')](function(_0x3c4db7){if(_0x3c4db7){var _0x2c7562=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),'utf8');var _0x25e3e7=fs[_0x9edd('0x62')](path['join'](config[_0x9edd('0x64')],_0x9edd('0x71')),'utf8');var _0x304e56=ejs[_0x9edd('0x66')](_0x2c7562,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_trunks.conf',_0x304e56);var _0x41cd76=ejs[_0x9edd('0x66')](_0x25e3e7,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x41cd76);return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});}return null;})[_0x9edd('0x1c')](function(_0x1a6d3d){if(_0x1a6d3d){return _0x5bb28c;}})[_0x9edd('0x1c')](respondWithResult(_0x5e68db,null))['catch'](handleError(_0x5e68db,null));};exports['destroy']=function(_0x49dc1d,_0x56d794,_0x388252){var _0x20762d;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x49dc1d[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x56d794,null))[_0x9edd('0x1c')](removeEntity(_0x56d794,null))[_0x9edd('0x1c')](function(){return db[_0x9edd('0x52')][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x4cfa99){var _0x367fc6=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),_0x9edd('0x65'));var _0x3d4890=fs[_0x9edd('0x62')](path['join'](config['root'],_0x9edd('0x71')),'utf8');var _0x35950b=ejs['render'](_0x367fc6,{'trunks':_0x4cfa99});var _0x21c35f=ejs[_0x9edd('0x66')](_0x3d4890,{'trunks':_0x4cfa99});fs['writeFileSync'](_0x9edd('0x68'),_0x35950b);fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x21c35f);return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x33'),{'module':_0x9edd('0x6c')});})[_0x9edd('0x25')](handleError(_0x56d794,null));}; \ No newline at end of file +var _0x3e74=['map','Trunk','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','type','filter','merge','options','includeAll','include','findAll','params','clone','find','get','omit','createdAt','body','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','writeFileSync','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','jayson/promise','client','http','request','then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','Trunks','UserProfileResource','stack','name','send','index'];(function(_0x369c02,_0x3f4e99){var _0x2e0aa9=function(_0x24b514){while(--_0x24b514){_0x369c02['push'](_0x369c02['shift']());}};_0x2e0aa9(++_0x3f4e99);}(_0x3e74,0x175));var _0x43e7=function(_0x4b7487,_0x49ef46){_0x4b7487=_0x4b7487-0x0;var _0x56a98d=_0x3e74[_0x4b7487];return _0x56a98d;};'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'];var jayson=require(_0x43e7('0x15'));var client=jayson[_0x43e7('0x16')][_0x43e7('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x4e008c,_0x583d85,_0x2fcb36,_0x21fdd3){return new BPromise(function(_0x44b0bd,_0x51b974){var _0x5e641c=_0x21fdd3||client;return _0x5e641c[_0x43e7('0x18')](_0x4e008c,_0x2fcb36)[_0x43e7('0x19')](function(_0x203378){logger[_0x43e7('0x1a')]('Trunk,\x20%s,\x20%s',_0x583d85,'request\x20sent');logger[_0x43e7('0x1b')](_0x43e7('0x1c'),_0x583d85,_0x43e7('0x1d'),JSON['stringify'](_0x203378));if(_0x203378['error']){if(_0x203378[_0x43e7('0x1e')][_0x43e7('0x1f')]===0x1f4){logger[_0x43e7('0x1e')](_0x43e7('0x20'),_0x583d85,_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);return _0x51b974(_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);}logger[_0x43e7('0x1e')](_0x43e7('0x20'),_0x583d85,_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);return _0x44b0bd(_0x203378['error'][_0x43e7('0x21')]);}else{logger[_0x43e7('0x1a')]('Trunk,\x20%s,\x20%s',_0x583d85,_0x43e7('0x1d'));_0x44b0bd(_0x203378[_0x43e7('0x22')][_0x43e7('0x21')]);}})[_0x43e7('0x23')](function(_0x4077fb){logger[_0x43e7('0x1e')]('Trunk,\x20%s,\x20%s',_0x583d85,_0x4077fb);_0x51b974(_0x4077fb);});});}function respondWithStatusCode(_0x454359,_0x4eea52){_0x4eea52=_0x4eea52||0xcc;return function(_0x4c9df3){if(_0x4c9df3){return _0x454359[_0x43e7('0x24')](_0x4eea52);}return _0x454359[_0x43e7('0x25')](_0x4eea52)['end']();};}function respondWithResult(_0x1f0673,_0x4ca5cf){_0x4ca5cf=_0x4ca5cf||0xc8;return function(_0x326dab){if(_0x326dab){return _0x1f0673['status'](_0x4ca5cf)[_0x43e7('0x26')](_0x326dab);}};}function respondWithFilteredResult(_0x1b5f50,_0x20888b){return function(_0x405f85){if(_0x405f85){var _0x51f4d7=typeof _0x20888b['offset']===_0x43e7('0x27')&&typeof _0x20888b['limit']===_0x43e7('0x27');var _0x40dc8f=_0x405f85[_0x43e7('0x28')];var _0xb1fc63=_0x51f4d7?0x0:_0x20888b['offset'];var _0x33a1a5=_0x51f4d7?_0x405f85[_0x43e7('0x28')]:_0x20888b[_0x43e7('0x29')]+_0x20888b[_0x43e7('0x2a')];var _0x442c3b;if(_0x33a1a5>=_0x40dc8f){_0x33a1a5=_0x40dc8f;_0x442c3b=0xc8;}else{_0x442c3b=0xce;}_0x1b5f50[_0x43e7('0x25')](_0x442c3b);return _0x1b5f50[_0x43e7('0x2b')](_0x43e7('0x2c'),_0xb1fc63+'-'+_0x33a1a5+'/'+_0x40dc8f)[_0x43e7('0x26')](_0x405f85);}return null;};}function patchUpdates(_0x35dbcd){return function(_0x17df44){try{jsonpatch[_0x43e7('0x2d')](_0x17df44,_0x35dbcd,!![]);}catch(_0x2bde44){return BPromise[_0x43e7('0x2e')](_0x2bde44);}return _0x17df44['save']();};}function saveUpdates(_0x238321,_0x44f6b0){return function(_0x3b8f78){if(_0x3b8f78){return _0x3b8f78[_0x43e7('0x2f')](_0x238321)[_0x43e7('0x19')](function(_0x4c8650){return _0x4c8650;});}return null;};}function removeEntity(_0x1eba65,_0x49b83d){return function(_0x30d47e){if(_0x30d47e){return _0x30d47e[_0x43e7('0x30')]()['then'](function(){var _0x5a7342=_0x30d47e['get']({'plain':!![]});var _0xf8320=_0x43e7('0x31');return db[_0x43e7('0x32')][_0x43e7('0x30')]({'where':{'type':_0xf8320,'resourceId':_0x5a7342['id']}})[_0x43e7('0x19')](function(){return _0x30d47e;});})[_0x43e7('0x19')](function(){_0x1eba65['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ac23d,_0x59e5b2){return function(_0x4e8e86){if(!_0x4e8e86){_0x4ac23d['sendStatus'](0x194);}return _0x4e8e86;};}function handleError(_0x5cb753,_0x14d888){_0x14d888=_0x14d888||0x1f4;return function(_0x49cda6){logger[_0x43e7('0x1e')](_0x49cda6[_0x43e7('0x33')]);if(_0x49cda6[_0x43e7('0x34')]){delete _0x49cda6[_0x43e7('0x34')];}_0x5cb753[_0x43e7('0x25')](_0x14d888)[_0x43e7('0x35')](_0x49cda6);};}exports[_0x43e7('0x36')]=function(_0x4f1a5f,_0x5332d9){var _0x5d84f4={},_0xfa0474={},_0xfe70e9={'count':0x0,'rows':[]};var _0x199ff6=_[_0x43e7('0x37')](db[_0x43e7('0x38')][_0x43e7('0x39')],function(_0x1d4589){return{'name':_0x1d4589[_0x43e7('0x3a')],'type':_0x1d4589['type'][_0x43e7('0x3b')]};});_0xfa0474[_0x43e7('0x3c')]=_['map'](_0x199ff6,_0x43e7('0x34'));_0xfa0474['query']=_[_0x43e7('0x3d')](_0x4f1a5f[_0x43e7('0x3e')]);_0xfa0474[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0xfa0474[_0x43e7('0x3c')],_0xfa0474[_0x43e7('0x3e')]);_0x5d84f4['attributes']=_['intersection'](_0xfa0474[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x41')]));_0x5d84f4[_0x43e7('0x42')]=_0x5d84f4['attributes'][_0x43e7('0x43')]?_0x5d84f4[_0x43e7('0x42')]:_0xfa0474['model'];if(!_0x4f1a5f[_0x43e7('0x3e')]['hasOwnProperty'](_0x43e7('0x44'))){_0x5d84f4['limit']=qs[_0x43e7('0x2a')](_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x2a')]);_0x5d84f4[_0x43e7('0x29')]=qs['offset'](_0x4f1a5f['query'][_0x43e7('0x29')]);}_0x5d84f4[_0x43e7('0x45')]=qs[_0x43e7('0x46')](_0x4f1a5f[_0x43e7('0x3e')]['sort']);_0x5d84f4['where']=qs['filters'](_[_0x43e7('0x47')](_0x4f1a5f['query'],_0xfa0474[_0x43e7('0x3f')]),_0x199ff6);if(_0x4f1a5f['query']['filter']){_0x5d84f4[_0x43e7('0x48')]=_['merge'](_0x5d84f4[_0x43e7('0x48')],{'$or':_[_0x43e7('0x37')](_0x199ff6,function(_0x257bd8){if(_0x257bd8[_0x43e7('0x49')]!=='VIRTUAL'){var _0x91f1e4={};_0x91f1e4[_0x257bd8[_0x43e7('0x34')]]={'$like':'%'+_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x4a')]+'%'};return _0x91f1e4;}})});}_0x5d84f4=_[_0x43e7('0x4b')]({},_0x5d84f4,_0x4f1a5f[_0x43e7('0x4c')]);var _0x51eef4={'where':_0x5d84f4['where']};return db[_0x43e7('0x38')][_0x43e7('0x28')](_0x51eef4)[_0x43e7('0x19')](function(_0x4c00a8){_0xfe70e9['count']=_0x4c00a8;if(_0x4f1a5f['query'][_0x43e7('0x4d')]){_0x5d84f4[_0x43e7('0x4e')]=[{'all':!![]}];}return db['Trunk'][_0x43e7('0x4f')](_0x5d84f4);})[_0x43e7('0x19')](function(_0x3c96fe){_0xfe70e9['rows']=_0x3c96fe;return _0xfe70e9;})['then'](respondWithFilteredResult(_0x5332d9,_0x5d84f4))['catch'](handleError(_0x5332d9,null));};exports['show']=function(_0x214e7e,_0xe955fc){var _0x52fea5={'raw':![],'where':{'id':_0x214e7e[_0x43e7('0x50')]['id']}},_0x23e7cb={};_0x23e7cb[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](db['Trunk'][_0x43e7('0x39')]);_0x23e7cb['query']=_['keys'](_0x214e7e[_0x43e7('0x3e')]);_0x23e7cb[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0x23e7cb[_0x43e7('0x3c')],_0x23e7cb[_0x43e7('0x3e')]);_0x52fea5[_0x43e7('0x42')]=_[_0x43e7('0x40')](_0x23e7cb[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x214e7e[_0x43e7('0x3e')]['fields']));_0x52fea5[_0x43e7('0x42')]=_0x52fea5[_0x43e7('0x42')]['length']?_0x52fea5[_0x43e7('0x42')]:_0x23e7cb['model'];if(_0x214e7e[_0x43e7('0x3e')][_0x43e7('0x4d')]){_0x52fea5[_0x43e7('0x4e')]=[{'all':!![]}];}_0x52fea5=_[_0x43e7('0x4b')]({},_0x52fea5,_0x214e7e[_0x43e7('0x4c')]);return db['Trunk']['find'](_0x52fea5)[_0x43e7('0x19')](handleEntityNotFound(_0xe955fc,null))[_0x43e7('0x19')](respondWithResult(_0xe955fc,null))[_0x43e7('0x23')](handleError(_0xe955fc,null));};exports[_0x43e7('0x51')]=function(_0x23d835,_0x25bb44){var _0xa47464={'where':{'id':_0x23d835[_0x43e7('0x50')]['id']}},_0x44f8a0={};_0x44f8a0[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](db['Trunk'][_0x43e7('0x39')]);_0xa47464[_0x43e7('0x42')]=_['intersection'](_0x44f8a0[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x23d835[_0x43e7('0x3e')]['fields']));_0xa47464['attributes']=_0xa47464[_0x43e7('0x42')][_0x43e7('0x43')]?_0xa47464['attributes']:_0x44f8a0[_0x43e7('0x3c')];if(_0x23d835['query']['includeAll']){_0xa47464[_0x43e7('0x4e')]=[{'all':!![]}];}_0xa47464=_[_0x43e7('0x4b')]({},_0xa47464,_0x23d835[_0x43e7('0x4c')]);return db[_0x43e7('0x38')][_0x43e7('0x52')](_0xa47464)['then'](handleEntityNotFound(_0x25bb44,null))[_0x43e7('0x19')](function(_0xdb9fbe){if(_0xdb9fbe){var _0x4d89bd=_0xdb9fbe[_0x43e7('0x53')]({'plain':!![]});_0x4d89bd=qs[_0x43e7('0x54')](_0x4d89bd,['id',_0x43e7('0x55'),'updatedAt']);_0x23d835['body']=_['omit'](_0x23d835[_0x43e7('0x56')],['id',_0x43e7('0x55'),_0x43e7('0x57')]);return db[_0x43e7('0x38')]['create'](_['merge'](_0x4d89bd,_0x23d835[_0x43e7('0x56')]),{'include':_0x23d835[_0x43e7('0x3e')][_0x43e7('0x4d')]?[{'all':!![]}]:undefined})[_0x43e7('0x19')](function(_0x5ea0db){var _0x4438c0=_0x23d835[_0x43e7('0x58')][_0x43e7('0x53')]({'plain':!![]});if(!_0x4438c0)throw new Error(_0x43e7('0x59'));if(_0x4438c0[_0x43e7('0x5a')]===_0x43e7('0x58')){var _0x4665db=_0x5ea0db[_0x43e7('0x53')]({'plain':!![]});var _0x406155=_0x43e7('0x31');return db[_0x43e7('0x5b')]['find']({'where':{'name':_0x406155,'userProfileId':_0x4438c0['userProfileId']},'raw':!![]})[_0x43e7('0x19')](function(_0x58a3a8){if(_0x58a3a8&&_0x58a3a8['autoAssociation']===0x0){return db['UserProfileResource'][_0x43e7('0x5c')]({'name':_0x4665db[_0x43e7('0x34')],'resourceId':_0x4665db['id'],'type':_0x58a3a8['name'],'sectionId':_0x58a3a8['id']},{})[_0x43e7('0x19')](function(){return _0x5ea0db;});}else{return _0x5ea0db;}})[_0x43e7('0x23')](function(_0x1d8438){logger['error'](_0x43e7('0x5d'),_0x1d8438);throw _0x1d8438;});}return _0x5ea0db;});}})[_0x43e7('0x19')](respondWithResult(_0x25bb44,0xc9))[_0x43e7('0x23')](handleError(_0x25bb44,null));};exports[_0x43e7('0x5c')]=function(_0x2f43d7,_0x472a19,_0x1e02fa){var _0x515f01;return db[_0x43e7('0x38')][_0x43e7('0x5c')](_0x2f43d7[_0x43e7('0x56')],{'raw':!![]})['then'](function(_0x56b06d){_0x515f01=_0x56b06d;return db[_0x43e7('0x38')]['findAll']({'raw':!![]});})['then'](function(_0x1b793d){var _0x154e47=fs['readFileSync'](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x60')),_0x43e7('0x61'));var _0x16499c=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config['root'],_0x43e7('0x63')),_0x43e7('0x61'));var _0x4e5956=ejs[_0x43e7('0x64')](_0x154e47,{'trunks':_0x1b793d||[]});fs['writeFileSync'](_0x43e7('0x65'),_0x4e5956);if(_0x515f01[_0x43e7('0x66')]){var _0x37301b=ejs[_0x43e7('0x64')](_0x16499c,{'trunks':_0x1b793d||[]});fs['writeFileSync'](_0x43e7('0x67'),_0x37301b);}})[_0x43e7('0x19')](function(){return respondWithRpcPromise(_0x43e7('0x68'),'create',{'module':_0x43e7('0x69')});})[_0x43e7('0x19')](function(){var _0x219dc6=_0x2f43d7[_0x43e7('0x58')][_0x43e7('0x53')]({'plain':!![]});if(!_0x219dc6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x219dc6[_0x43e7('0x5a')]===_0x43e7('0x58')){var _0x35d133=_0x515f01[_0x43e7('0x53')]({'plain':!![]});return db[_0x43e7('0x5b')][_0x43e7('0x52')]({'where':{'name':_0x43e7('0x31'),'userProfileId':_0x219dc6['userProfileId']},'raw':!![]})['then'](function(_0x405faa){if(_0x405faa&&_0x405faa['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x35d133[_0x43e7('0x34')],'resourceId':_0x35d133['id'],'type':_0x405faa[_0x43e7('0x34')],'sectionId':_0x405faa['id']},{})[_0x43e7('0x19')](function(){return _0x515f01;});}else{return _0x515f01;}})[_0x43e7('0x23')](function(_0x18713b){logger[_0x43e7('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18713b);throw _0x18713b;});}return _0x515f01;})[_0x43e7('0x19')](respondWithResult(_0x472a19,0xc9))[_0x43e7('0x23')](handleError(_0x472a19,null));};exports[_0x43e7('0x2f')]=function(_0x5b4c76,_0x2abca0,_0xea84ec){var _0x184ae3;return db[_0x43e7('0x38')][_0x43e7('0x52')]({'where':{'id':_0x5b4c76[_0x43e7('0x50')]['id']}})[_0x43e7('0x19')](handleEntityNotFound(_0x2abca0,null))[_0x43e7('0x19')](saveUpdates(_0x5b4c76['body'],null))['then'](function(_0x55990c){if(_0x55990c){_0x184ae3=_0x55990c;return db[_0x43e7('0x38')][_0x43e7('0x4f')]({'raw':!![]});}})['then'](function(_0x3fe23f){if(_0x3fe23f){var _0x39a787=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x177a7a=fs[_0x43e7('0x62')](path['join'](config['root'],_0x43e7('0x63')),_0x43e7('0x61'));var _0x3b7e5b=ejs['render'](_0x39a787,{'trunks':_0x3fe23f||[]});fs[_0x43e7('0x6a')](_0x43e7('0x65'),_0x3b7e5b);var _0x401654=ejs[_0x43e7('0x64')](_0x177a7a,{'trunks':_0x3fe23f||[]});fs['writeFileSync'](_0x43e7('0x67'),_0x401654);return respondWithRpcPromise('Reload',_0x43e7('0x2f'),{'module':_0x43e7('0x69')});}return null;})[_0x43e7('0x19')](function(_0x90667c){if(_0x90667c){return _0x184ae3;}})[_0x43e7('0x19')](respondWithResult(_0x2abca0,null))[_0x43e7('0x23')](handleError(_0x2abca0,null));};exports[_0x43e7('0x30')]=function(_0x5e8d4e,_0x109c86,_0x40257e){var _0x1aea4e;return db[_0x43e7('0x38')]['find']({'where':{'id':_0x5e8d4e['params']['id']}})['then'](handleEntityNotFound(_0x109c86,null))[_0x43e7('0x19')](removeEntity(_0x109c86,null))['then'](function(){return db[_0x43e7('0x38')][_0x43e7('0x4f')]({'raw':!![]});})[_0x43e7('0x19')](function(_0x7387f6){var _0xa75254=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x60')),_0x43e7('0x61'));var _0x3de22e=fs['readFileSync'](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x63')),_0x43e7('0x61'));var _0x206e54=ejs['render'](_0xa75254,{'trunks':_0x7387f6});var _0x5e04ec=ejs[_0x43e7('0x64')](_0x3de22e,{'trunks':_0x7387f6});fs[_0x43e7('0x6a')]('/etc/asterisk/sip_xcally_trunks.conf',_0x206e54);fs[_0x43e7('0x6a')](_0x43e7('0x67'),_0x5e04ec);return respondWithRpcPromise('Reload','destroy',{'module':_0x43e7('0x69')});})[_0x43e7('0x23')](handleError(_0x109c86,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 5931297..9e8afc0 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 _0x5f27=['path','rimraf','../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks','lodash','util','moment','bluebird','request-promise'];(function(_0x3aab30,_0x4dc40d){var _0x57d644=function(_0x4d1514){while(--_0x4d1514){_0x3aab30['push'](_0x3aab30['shift']());}};_0x57d644(++_0x4dc40d);}(_0x5f27,0x16f));var _0x75f2=function(_0x5a9816,_0x27f244){_0x5a9816=_0x5a9816-0x0;var _0x3c6adb=_0x5f27[_0x5a9816];return _0x3c6adb;};'use strict';var _=require(_0x75f2('0x0'));var util=require(_0x75f2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x75f2('0x2'));var BPromise=require(_0x75f2('0x3'));var rp=require(_0x75f2('0x4'));var fs=require('fs');var path=require(_0x75f2('0x5'));var rimraf=require(_0x75f2('0x6'));var config=require(_0x75f2('0x7'));var attributes=require(_0x75f2('0x8'));module[_0x75f2('0x9')]=function(_0xcd8a5,_0x562eed){return _0xcd8a5['define'](_0x75f2('0xa'),attributes,{'tableName':_0x75f2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x701c=['request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x327d36,_0x527700){var _0x530a10=function(_0x2473a8){while(--_0x2473a8){_0x327d36['push'](_0x327d36['shift']());}};_0x530a10(++_0x527700);}(_0x701c,0x112));var _0xc701=function(_0x2081c1,_0x25f8d2){_0x2081c1=_0x2081c1-0x0;var _0x5a8693=_0x701c[_0x2081c1];return _0x5a8693;};'use strict';var _=require(_0xc701('0x0'));var util=require(_0xc701('0x1'));var logger=require(_0xc701('0x2'))(_0xc701('0x3'));var moment=require(_0xc701('0x4'));var BPromise=require(_0xc701('0x5'));var rp=require(_0xc701('0x6'));var fs=require('fs');var path=require(_0xc701('0x7'));var rimraf=require(_0xc701('0x8'));var config=require(_0xc701('0x9'));var attributes=require(_0xc701('0xa'));module[_0xc701('0xb')]=function(_0x1efe6c,_0x1563c7){return _0x1efe6c['define'](_0xc701('0xc'),attributes,{'tableName':_0xc701('0xd'),'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 d2a2f24..34cee78 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 _0xfc7a=['attributes','limit','include','map','model','GetTrunk','debug','ShowTrunk','Trunk','lodash','util','bluebird','randomstring','../../config/logger','rpc','jayson/promise','http','then','info','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','catch','findAll','options','raw','where'];(function(_0x32fda6,_0x576776){var _0x58c818=function(_0x4bf68f){while(--_0x4bf68f){_0x32fda6['push'](_0x32fda6['shift']());}};_0x58c818(++_0x576776);}(_0xfc7a,0xbd));var _0xafc7=function(_0x1b25c1,_0x2c6ce6){_0x1b25c1=_0x1b25c1-0x0;var _0x1e4447=_0xfc7a[_0x1b25c1];return _0x1e4447;};'use strict';var _=require(_0xafc7('0x0'));var util=require(_0xafc7('0x1'));var moment=require('moment');var BPromise=require(_0xafc7('0x2'));var rs=require(_0xafc7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xafc7('0x4'))(_0xafc7('0x5'));var config=require('../../config/environment');var jayson=require(_0xafc7('0x6'));var client=jayson['client'][_0xafc7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1499f1,_0x320ac4,_0x5bfa47){return new BPromise(function(_0x564acc,_0x112a6f){return client['request'](_0x1499f1,_0x5bfa47)[_0xafc7('0x8')](function(_0x2aff3f){logger[_0xafc7('0x9')]('Trunk,\x20%s,\x20%s',_0x320ac4,'request\x20sent');logger['debug'](_0xafc7('0xa'),_0x320ac4,'request\x20sent',JSON[_0xafc7('0xb')](_0x2aff3f));if(_0x2aff3f[_0xafc7('0xc')]){if(_0x2aff3f[_0xafc7('0xc')][_0xafc7('0xd')]===0x1f4){logger[_0xafc7('0xc')](_0xafc7('0xe'),_0x320ac4,_0x2aff3f['error'][_0xafc7('0xf')]);return _0x112a6f(_0x2aff3f[_0xafc7('0xc')]['message']);}logger['error'](_0xafc7('0xe'),_0x320ac4,_0x2aff3f[_0xafc7('0xc')][_0xafc7('0xf')]);return _0x564acc(_0x2aff3f[_0xafc7('0xc')][_0xafc7('0xf')]);}else{logger[_0xafc7('0x9')](_0xafc7('0xe'),_0x320ac4,'request\x20sent');_0x564acc(_0x2aff3f['result'][_0xafc7('0xf')]);}})[_0xafc7('0x10')](function(_0x583b3b){logger[_0xafc7('0xc')]('Trunk,\x20%s,\x20%s',_0x320ac4,_0x583b3b);_0x112a6f(_0x583b3b);});});}exports['GetTrunk']=function(_0x19a65b){var _0x5bf94c=this;return new Promise(function(_0x10a0e0,_0x14b967){return db['Trunk'][_0xafc7('0x11')]({'raw':_0x19a65b[_0xafc7('0x12')]?_0x19a65b[_0xafc7('0x12')][_0xafc7('0x13')]===undefined?!![]:![]:!![],'where':_0x19a65b[_0xafc7('0x12')]?_0x19a65b[_0xafc7('0x12')][_0xafc7('0x14')]||null:null,'attributes':_0x19a65b[_0xafc7('0x12')]?_0x19a65b[_0xafc7('0x12')][_0xafc7('0x15')]||null:null,'limit':_0x19a65b[_0xafc7('0x12')]?_0x19a65b[_0xafc7('0x12')][_0xafc7('0x16')]||null:null,'include':_0x19a65b['options']?_0x19a65b[_0xafc7('0x12')][_0xafc7('0x17')]?_[_0xafc7('0x18')](_0x19a65b[_0xafc7('0x12')][_0xafc7('0x17')],function(_0x19a696){return{'model':db[_0x19a696['model']],'as':_0x19a696['as'],'attributes':_0x19a696[_0xafc7('0x15')],'include':_0x19a696['include']?_[_0xafc7('0x18')](_0x19a696[_0xafc7('0x17')],function(_0xfabda7){return{'model':db[_0xfabda7['model']],'as':_0xfabda7['as'],'attributes':_0xfabda7[_0xafc7('0x15')],'include':_0xfabda7['include']?_[_0xafc7('0x18')](_0xfabda7['include'],function(_0x5f13bf){return{'model':db[_0x5f13bf[_0xafc7('0x19')]],'as':_0x5f13bf['as'],'attributes':_0x5f13bf[_0xafc7('0x15')]};}):[]};}):[]};}):[]:[]})[_0xafc7('0x8')](function(_0x1e2383){logger['info'](_0xafc7('0x1a'),_0x19a65b);logger[_0xafc7('0x1b')](_0xafc7('0x1a'),_0x19a65b,JSON[_0xafc7('0xb')](_0x1e2383));_0x10a0e0(_0x1e2383);})[_0xafc7('0x10')](function(_0x23a28a){logger['error'](_0xafc7('0x1a'),_0x23a28a['message'],_0x19a65b);_0x14b967(_0x5bf94c[_0xafc7('0xc')](0x1f4,_0x23a28a['message']));});});};exports[_0xafc7('0x1c')]=function(_0x2f7f64){var _0x4049c0=this;return new Promise(function(_0x2d65a4,_0x5824e8){return db[_0xafc7('0x1d')]['find']({'raw':_0x2f7f64[_0xafc7('0x12')]?_0x2f7f64[_0xafc7('0x12')][_0xafc7('0x13')]===undefined?!![]:![]:!![],'where':_0x2f7f64['options']?_0x2f7f64[_0xafc7('0x12')][_0xafc7('0x14')]||null:null,'attributes':_0x2f7f64[_0xafc7('0x12')]?_0x2f7f64[_0xafc7('0x12')][_0xafc7('0x15')]||null:null,'include':_0x2f7f64[_0xafc7('0x12')]?_0x2f7f64[_0xafc7('0x12')]['include']?_['map'](_0x2f7f64[_0xafc7('0x12')][_0xafc7('0x17')],function(_0x244616){return{'model':db[_0x244616[_0xafc7('0x19')]],'as':_0x244616['as'],'attributes':_0x244616[_0xafc7('0x15')],'include':_0x244616[_0xafc7('0x17')]?_[_0xafc7('0x18')](_0x244616[_0xafc7('0x17')],function(_0xb39f8f){return{'model':db[_0xb39f8f['model']],'as':_0xb39f8f['as'],'attributes':_0xb39f8f[_0xafc7('0x15')],'include':_0xb39f8f[_0xafc7('0x17')]?_[_0xafc7('0x18')](_0xb39f8f[_0xafc7('0x17')],function(_0x515553){return{'model':db[_0x515553['model']],'as':_0x515553['as'],'attributes':_0x515553[_0xafc7('0x15')]};}):[]};}):[]};}):[]:[]})[_0xafc7('0x8')](function(_0x39361a){logger[_0xafc7('0x9')](_0xafc7('0x1c'),_0x2f7f64);logger['debug']('ShowTrunk',_0x2f7f64,JSON[_0xafc7('0xb')](_0x39361a));_0x2d65a4(_0x39361a);})[_0xafc7('0x10')](function(_0x1119c0){logger['error']('ShowTrunk',_0x1119c0[_0xafc7('0xf')],_0x2f7f64);_0x5824e8(_0x4049c0[_0xafc7('0xc')](0x1f4,_0x1119c0[_0xafc7('0xf')]));});});}; \ No newline at end of file +var _0xa0b1=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTrunk','options','raw','where','limit','include','map','model','attributes','catch','ShowTrunk','Trunk','find','then','lodash','util'];(function(_0x94326e,_0x2dd87f){var _0x53cc97=function(_0x16c5b8){while(--_0x16c5b8){_0x94326e['push'](_0x94326e['shift']());}};_0x53cc97(++_0x2dd87f);}(_0xa0b1,0x195));var _0x1a0b=function(_0x552b03,_0x48e023){_0x552b03=_0x552b03-0x0;var _0x14ab19=_0xa0b1[_0x552b03];return _0x14ab19;};'use strict';var _=require(_0x1a0b('0x0'));var util=require(_0x1a0b('0x1'));var moment=require(_0x1a0b('0x2'));var BPromise=require(_0x1a0b('0x3'));var rs=require(_0x1a0b('0x4'));var fs=require('fs');var Redis=require(_0x1a0b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a0b('0x6'));var logger=require(_0x1a0b('0x7'))(_0x1a0b('0x8'));var config=require('../../config/environment');var jayson=require(_0x1a0b('0x9'));var client=jayson[_0x1a0b('0xa')][_0x1a0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x371edc,_0x40d0a3,_0xb3fe49){return new BPromise(function(_0x447ee0,_0x4aae3e){return client[_0x1a0b('0xc')](_0x371edc,_0xb3fe49)['then'](function(_0x46ae78){logger[_0x1a0b('0xd')](_0x1a0b('0xe'),_0x40d0a3,_0x1a0b('0xf'));logger[_0x1a0b('0x10')](_0x1a0b('0x11'),_0x40d0a3,_0x1a0b('0xf'),JSON[_0x1a0b('0x12')](_0x46ae78));if(_0x46ae78[_0x1a0b('0x13')]){if(_0x46ae78[_0x1a0b('0x13')][_0x1a0b('0x14')]===0x1f4){logger[_0x1a0b('0x13')]('Trunk,\x20%s,\x20%s',_0x40d0a3,_0x46ae78[_0x1a0b('0x13')][_0x1a0b('0x15')]);return _0x4aae3e(_0x46ae78[_0x1a0b('0x13')][_0x1a0b('0x15')]);}logger['error'](_0x1a0b('0xe'),_0x40d0a3,_0x46ae78[_0x1a0b('0x13')][_0x1a0b('0x15')]);return _0x447ee0(_0x46ae78[_0x1a0b('0x13')][_0x1a0b('0x15')]);}else{logger[_0x1a0b('0xd')](_0x1a0b('0xe'),_0x40d0a3,_0x1a0b('0xf'));_0x447ee0(_0x46ae78[_0x1a0b('0x16')][_0x1a0b('0x15')]);}})['catch'](function(_0x2792f2){logger[_0x1a0b('0x13')](_0x1a0b('0xe'),_0x40d0a3,_0x2792f2);_0x4aae3e(_0x2792f2);});});}exports[_0x1a0b('0x17')]=function(_0x52dfba){var _0x24bc9e=this;return new Promise(function(_0x32a1d0,_0x5d523a){return db['Trunk']['findAll']({'raw':_0x52dfba[_0x1a0b('0x18')]?_0x52dfba[_0x1a0b('0x18')][_0x1a0b('0x19')]===undefined?!![]:![]:!![],'where':_0x52dfba[_0x1a0b('0x18')]?_0x52dfba[_0x1a0b('0x18')][_0x1a0b('0x1a')]||null:null,'attributes':_0x52dfba[_0x1a0b('0x18')]?_0x52dfba[_0x1a0b('0x18')]['attributes']||null:null,'limit':_0x52dfba['options']?_0x52dfba['options'][_0x1a0b('0x1b')]||null:null,'include':_0x52dfba[_0x1a0b('0x18')]?_0x52dfba[_0x1a0b('0x18')][_0x1a0b('0x1c')]?_[_0x1a0b('0x1d')](_0x52dfba[_0x1a0b('0x18')][_0x1a0b('0x1c')],function(_0x5072df){return{'model':db[_0x5072df[_0x1a0b('0x1e')]],'as':_0x5072df['as'],'attributes':_0x5072df[_0x1a0b('0x1f')],'include':_0x5072df[_0x1a0b('0x1c')]?_[_0x1a0b('0x1d')](_0x5072df['include'],function(_0x24ec48){return{'model':db[_0x24ec48['model']],'as':_0x24ec48['as'],'attributes':_0x24ec48[_0x1a0b('0x1f')],'include':_0x24ec48['include']?_[_0x1a0b('0x1d')](_0x24ec48[_0x1a0b('0x1c')],function(_0x4d114c){return{'model':db[_0x4d114c[_0x1a0b('0x1e')]],'as':_0x4d114c['as'],'attributes':_0x4d114c[_0x1a0b('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39ea8d){logger[_0x1a0b('0xd')](_0x1a0b('0x17'),_0x52dfba);logger[_0x1a0b('0x10')](_0x1a0b('0x17'),_0x52dfba,JSON[_0x1a0b('0x12')](_0x39ea8d));_0x32a1d0(_0x39ea8d);})[_0x1a0b('0x20')](function(_0x3534e4){logger[_0x1a0b('0x13')](_0x1a0b('0x17'),_0x3534e4[_0x1a0b('0x15')],_0x52dfba);_0x5d523a(_0x24bc9e[_0x1a0b('0x13')](0x1f4,_0x3534e4['message']));});});};exports[_0x1a0b('0x21')]=function(_0x264bf3){var _0xa2004c=this;return new Promise(function(_0x33a9e6,_0x2c5aa0){return db[_0x1a0b('0x22')][_0x1a0b('0x23')]({'raw':_0x264bf3[_0x1a0b('0x18')]?_0x264bf3[_0x1a0b('0x18')][_0x1a0b('0x19')]===undefined?!![]:![]:!![],'where':_0x264bf3['options']?_0x264bf3[_0x1a0b('0x18')]['where']||null:null,'attributes':_0x264bf3[_0x1a0b('0x18')]?_0x264bf3[_0x1a0b('0x18')][_0x1a0b('0x1f')]||null:null,'include':_0x264bf3[_0x1a0b('0x18')]?_0x264bf3[_0x1a0b('0x18')][_0x1a0b('0x1c')]?_[_0x1a0b('0x1d')](_0x264bf3['options'][_0x1a0b('0x1c')],function(_0x280f5d){return{'model':db[_0x280f5d[_0x1a0b('0x1e')]],'as':_0x280f5d['as'],'attributes':_0x280f5d[_0x1a0b('0x1f')],'include':_0x280f5d['include']?_['map'](_0x280f5d['include'],function(_0x4f4935){return{'model':db[_0x4f4935[_0x1a0b('0x1e')]],'as':_0x4f4935['as'],'attributes':_0x4f4935['attributes'],'include':_0x4f4935[_0x1a0b('0x1c')]?_[_0x1a0b('0x1d')](_0x4f4935[_0x1a0b('0x1c')],function(_0x194dc9){return{'model':db[_0x194dc9[_0x1a0b('0x1e')]],'as':_0x194dc9['as'],'attributes':_0x194dc9[_0x1a0b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1a0b('0x24')](function(_0x4b89c3){logger[_0x1a0b('0xd')](_0x1a0b('0x21'),_0x264bf3);logger[_0x1a0b('0x10')](_0x1a0b('0x21'),_0x264bf3,JSON['stringify'](_0x4b89c3));_0x33a9e6(_0x4b89c3);})[_0x1a0b('0x20')](function(_0x4eb1d1){logger[_0x1a0b('0x13')](_0x1a0b('0x21'),_0x4eb1d1['message'],_0x264bf3);_0x2c5aa0(_0xa2004c[_0x1a0b('0x13')](0x1f4,_0x4eb1d1[_0x1a0b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 8438c67..0d520b8 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 _0xb696=['isAuthenticated','update','express','../../components/auth/service','./user-setting.controller','put','/:id'];(function(_0x12a110,_0x2f5f52){var _0x1110c5=function(_0x18680c){while(--_0x18680c){_0x12a110['push'](_0x12a110['shift']());}};_0x1110c5(++_0x2f5f52);}(_0xb696,0x1bb));var _0x6b69=function(_0x309de0,_0x19506e){_0x309de0=_0x309de0-0x0;var _0x413379=_0xb696[_0x309de0];return _0x413379;};'use strict';var express=require(_0x6b69('0x0'));var router=express['Router']();var auth=require(_0x6b69('0x1'));var controller=require(_0x6b69('0x2'));router[_0x6b69('0x3')](_0x6b69('0x4'),auth[_0x6b69('0x5')](),controller[_0x6b69('0x6')]);module['exports']=router; \ No newline at end of file +var _0x9c5e=['express','Router','../../components/auth/service','./user-setting.controller','put','/:id','update'];(function(_0x186780,_0x144f34){var _0x307c3c=function(_0x4503a6){while(--_0x4503a6){_0x186780['push'](_0x186780['shift']());}};_0x307c3c(++_0x144f34);}(_0x9c5e,0x13b));var _0xe9c5=function(_0x236209,_0x51b840){_0x236209=_0x236209-0x0;var _0x2afd5b=_0x9c5e[_0x236209];return _0x2afd5b;};'use strict';var express=require(_0xe9c5('0x0'));var router=express[_0xe9c5('0x1')]();var auth=require(_0xe9c5('0x2'));var controller=require(_0xe9c5('0x3'));router[_0xe9c5('0x4')](_0xe9c5('0x5'),auth['isAuthenticated'](),controller[_0xe9c5('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 75a9d6e..04279cc 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 _0x5bcd=['BOOLEAN','INTEGER','sequelize','error','debug','exports','ENUM'];(function(_0x15d784,_0x58ed6d){var _0x38a36=function(_0x3ffd9b){while(--_0x3ffd9b){_0x15d784['push'](_0x15d784['shift']());}};_0x38a36(++_0x58ed6d);}(_0x5bcd,0x198));var _0xd5bc=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x5bcd[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0xd5bc('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xd5bc('0x1'),'warning','info',_0xd5bc('0x2')];module[_0xd5bc('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0xd5bc('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xd5bc('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xd5bc('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xd5bc('0x6')],'unique':'UserId'}}; \ No newline at end of file +var _0xe5b6=['sequelize','error','warning','ENUM','BOOLEAN','INTEGER','UserId'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0xe5b6,0x7e));var _0x6e5b=function(_0x4f49a3,_0x294285){_0x4f49a3=_0x4f49a3-0x0;var _0x3fe460=_0xe5b6[_0x4f49a3];return _0x3fe460;};'use strict';var Sequelize=require(_0x6e5b('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x6e5b('0x1'),_0x6e5b('0x2'),'info','debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x6e5b('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x6e5b('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x6e5b('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x6e5b('0x5')],'unique':_0x6e5b('0x6')}}; \ 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 6a570eb..b86eefa 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 _0x2821=['error','stack','name','send','update','user','role','admin','params','UserSetting','find','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','./user-setting.socket','defaults','localhost','json','then','sendStatus'];(function(_0x458ed6,_0x504646){var _0xa5dfd9=function(_0x504e7b){while(--_0x504e7b){_0x458ed6['push'](_0x458ed6['shift']());}};_0xa5dfd9(++_0x504646);}(_0x2821,0xc3));var _0x1282=function(_0x320873,_0x17e7d5){_0x320873=_0x320873-0x0;var _0x5cf0f4=_0x2821[_0x320873];return _0x5cf0f4;};'use strict';var _=require(_0x1282('0x0'));var Redis=require(_0x1282('0x1'));var logger=require(_0x1282('0x2'))(_0x1282('0x3'));var config=require(_0x1282('0x4'));var db=require(_0x1282('0x5'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x1282('0x6')]));require(_0x1282('0x7'))['register'](socket);config[_0x1282('0x6')]=_[_0x1282('0x8')](config[_0x1282('0x6')],{'host':_0x1282('0x9'),'port':0x18eb});function respondWithResult(_0xb5be26,_0x17a244){_0x17a244=_0x17a244||0xc8;return function(_0x296ffc){if(_0x296ffc){return _0xb5be26['status'](_0x17a244)[_0x1282('0xa')](_0x296ffc);}};}function saveUpdates(_0x48349c){return function(_0x5cb6b6){if(_0x5cb6b6){return _0x5cb6b6['update'](_0x48349c)[_0x1282('0xb')](function(_0xb4f761){return _0xb4f761;});}return null;};}function handleEntityNotFound(_0x3aba30){return function(_0x5c34ec){if(!_0x5c34ec){_0x3aba30[_0x1282('0xc')](0x194);}return _0x5c34ec;};}function handleError(_0x1cbfdd,_0x4c8105){_0x4c8105=_0x4c8105||0x1f4;return function(_0x484dca){logger[_0x1282('0xd')](_0x484dca[_0x1282('0xe')]);if(_0x484dca[_0x1282('0xf')]){delete _0x484dca['name'];}_0x1cbfdd['status'](_0x4c8105)[_0x1282('0x10')](_0x484dca);};}exports[_0x1282('0x11')]=function(_0x548899,_0x1ce472){if(_0x548899[_0x1282('0x12')][_0x1282('0x13')]!==_0x1282('0x14'))throw new Error('Unauthorized');if(isNaN(Number(_0x548899[_0x1282('0x15')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x1282('0x16')][_0x1282('0x17')]({'where':{'id':_0x548899['params']['id']}})[_0x1282('0xb')](handleEntityNotFound(_0x1ce472,null))[_0x1282('0xb')](saveUpdates(_0x548899[_0x1282('0x18')],null))['then'](respondWithResult(_0x1ce472,null))[_0x1282('0x19')](handleError(_0x1ce472,null));}; \ No newline at end of file +var _0xb377=['UserSetting','find','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','status','json','update','then','sendStatus','error','stack','name','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id'];(function(_0x23231b,_0x52d86c){var _0x180a5b=function(_0x4d183e){while(--_0x4d183e){_0x23231b['push'](_0x23231b['shift']());}};_0x180a5b(++_0x52d86c);}(_0xb377,0x1b6));var _0x7b37=function(_0x1c8485,_0x4c60ed){_0x1c8485=_0x1c8485-0x0;var _0x564fc6=_0xb377[_0x1c8485];return _0x564fc6;};'use strict';var _=require(_0x7b37('0x0'));var Redis=require(_0x7b37('0x1'));var logger=require(_0x7b37('0x2'))(_0x7b37('0x3'));var config=require(_0x7b37('0x4'));var db=require(_0x7b37('0x5'))['db'];var socket=require(_0x7b37('0x6'))(new Redis(config[_0x7b37('0x7')]));require(_0x7b37('0x8'))[_0x7b37('0x9')](socket);config[_0x7b37('0x7')]=_[_0x7b37('0xa')](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0x409d34,_0x4cb89b){_0x4cb89b=_0x4cb89b||0xc8;return function(_0x5afdb8){if(_0x5afdb8){return _0x409d34[_0x7b37('0xb')](_0x4cb89b)[_0x7b37('0xc')](_0x5afdb8);}};}function saveUpdates(_0x62d37a){return function(_0x23d483){if(_0x23d483){return _0x23d483[_0x7b37('0xd')](_0x62d37a)[_0x7b37('0xe')](function(_0x4610cd){return _0x4610cd;});}return null;};}function handleEntityNotFound(_0x39c4ef){return function(_0x59bd03){if(!_0x59bd03){_0x39c4ef[_0x7b37('0xf')](0x194);}return _0x59bd03;};}function handleError(_0x20f993,_0x4a51b0){_0x4a51b0=_0x4a51b0||0x1f4;return function(_0x5e5fb5){logger[_0x7b37('0x10')](_0x5e5fb5[_0x7b37('0x11')]);if(_0x5e5fb5[_0x7b37('0x12')]){delete _0x5e5fb5[_0x7b37('0x12')];}_0x20f993[_0x7b37('0xb')](_0x4a51b0)[_0x7b37('0x13')](_0x5e5fb5);};}exports[_0x7b37('0xd')]=function(_0x6de05b,_0x1262cd){if(_0x6de05b[_0x7b37('0x14')][_0x7b37('0x15')]!==_0x7b37('0x16'))throw new Error(_0x7b37('0x17'));if(isNaN(Number(_0x6de05b[_0x7b37('0x18')]['id'])))throw new Error(_0x7b37('0x19'));return db[_0x7b37('0x1a')][_0x7b37('0x1b')]({'where':{'id':_0x6de05b['params']['id']}})['then'](handleEntityNotFound(_0x1262cd,null))[_0x7b37('0xe')](saveUpdates(_0x6de05b['body'],null))['then'](respondWithResult(_0x1262cd,null))[_0x7b37('0x1c')](handleError(_0x1262cd,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 9d42a88..9c052f5 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 _0x6cfa=['UserSetting','setMaxListeners','save','update','hasOwnProperty','hook','exports'];(function(_0x430459,_0x58519c){var _0x3a2439=function(_0x27a0b3){while(--_0x27a0b3){_0x430459['push'](_0x430459['shift']());}};_0x3a2439(++_0x58519c);}(_0x6cfa,0xd9));var _0xa6cf=function(_0x3e7728,_0x57e609){_0x3e7728=_0x3e7728-0x0;var _0x5992ae=_0x6cfa[_0x3e7728];return _0x5992ae;};'use strict';var EventEmitter=require('events');var UserSetting=require('../../mysqldb')['db'][_0xa6cf('0x0')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xa6cf('0x1')](0x0);var events={'afterCreate':_0xa6cf('0x2'),'afterUpdate':_0xa6cf('0x3'),'afterDestroy':'remove'};function emitEvent(_0x24a3d1){return function(_0x5ae180,_0x6155e9,_0x2a6e5b){UserSettingEvents['emit'](_0x24a3d1+':'+_0x5ae180['id'],_0x5ae180);UserSettingEvents['emit'](_0x24a3d1,_0x5ae180);_0x2a6e5b(null);};}for(var e in events){if(events[_0xa6cf('0x4')](e)){var event=events[e];UserSetting[_0xa6cf('0x5')](e,emitEvent(event));}}module[_0xa6cf('0x6')]=UserSettingEvents; \ No newline at end of file +var _0xef19=['save','update','hasOwnProperty','exports','../../mysqldb','UserSetting','setMaxListeners'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xef19,0x15b));var _0x9ef1=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0xef19[_0x56740a];return _0x257144;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x9ef1('0x0'))['db'][_0x9ef1('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x9ef1('0x2')](0x0);var events={'afterCreate':_0x9ef1('0x3'),'afterUpdate':_0x9ef1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x535652){return function(_0x3621a6,_0x76e9a2,_0x16ed6e){UserSettingEvents['emit'](_0x535652+':'+_0x3621a6['id'],_0x3621a6);UserSettingEvents['emit'](_0x535652,_0x3621a6);_0x16ed6e(null);};}for(var e in events){if(events[_0x9ef1('0x5')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x9ef1('0x6')]=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 f2f4a0b..4072781 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 _0xa249=['UserSetting','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x15332e,_0x35090d){var _0x1e018d=function(_0x47238a){while(--_0x47238a){_0x15332e['push'](_0x15332e['shift']());}};_0x1e018d(++_0x35090d);}(_0xa249,0x183));var _0x9a24=function(_0x314039,_0x3641bb){_0x314039=_0x314039-0x0;var _0x3bcbbe=_0xa249[_0x314039];return _0x3bcbbe;};'use strict';var attributes=require(_0x9a24('0x0'));module[_0x9a24('0x1')]=function(_0x4811ed){return _0x4811ed[_0x9a24('0x2')](_0x9a24('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x12ef32){if(!_0x12ef32['clientSideLoggingEnabled'])_0x12ef32[_0x9a24('0x4')]=null;else if(_0x12ef32['clientSideLoggingEnabledSince']===null)_0x12ef32['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x235a=['./user-setting.attributes','exports','UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x4503c0,_0x33391f){var _0x581f21=function(_0x460341){while(--_0x460341){_0x4503c0['push'](_0x4503c0['shift']());}};_0x581f21(++_0x33391f);}(_0x235a,0x1ef));var _0xa235=function(_0x24ebe6,_0x10d126){_0x24ebe6=_0x24ebe6-0x0;var _0x1c4516=_0x235a[_0x24ebe6];return _0x1c4516;};'use strict';var attributes=require(_0xa235('0x0'));module[_0xa235('0x1')]=function(_0x95e7f5){return _0x95e7f5['define'](_0xa235('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ae786){if(!_0x3ae786[_0xa235('0x3')])_0x3ae786[_0xa235('0x4')]=null;else if(_0x3ae786[_0xa235('0x4')]===null)_0x3ae786[_0xa235('0x4')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 69dfdcc..2bc4e9c 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 _0x1bb4=['save','remove','update','user-setting:update','user-setting:update:user-','UserId','register','user-setting:','./user-setting.events'];(function(_0x3d2521,_0x510ca8){var _0x4afc98=function(_0x4c3d8c){while(--_0x4c3d8c){_0x3d2521['push'](_0x3d2521['shift']());}};_0x4afc98(++_0x510ca8);}(_0x1bb4,0x131));var _0x41bb=function(_0x43b8de,_0x4b3880){_0x43b8de=_0x43b8de-0x0;var _0x447485=_0x1bb4[_0x43b8de];return _0x447485;};'use strict';var UserSettingEvents=require(_0x41bb('0x0'));var events=[_0x41bb('0x1'),_0x41bb('0x2'),_0x41bb('0x3')];function createListener(_0x3fcf5b,_0x361ca4){return function(_0x3377b2){_0x361ca4['emit'](_0x3fcf5b,_0x3377b2);if(_0x3fcf5b===_0x41bb('0x4')){_0x361ca4['emit'](_0x41bb('0x5')+_0x3377b2[_0x41bb('0x6')],_0x3377b2);}};}exports[_0x41bb('0x7')]=function(_0x5688e4){for(var _0x11ce5b=0x0,_0x92b791=events['length'];_0x11ce5b<_0x92b791;_0x11ce5b++){var _0x35ada5=events[_0x11ce5b];var _0x1da9a2=createListener(_0x41bb('0x8')+_0x35ada5,_0x5688e4);UserSettingEvents['on'](_0x35ada5,_0x1da9a2);}}; \ No newline at end of file +var _0x3ccf=['user-setting:','./user-setting.events','update','emit','user-setting:update','user-setting:update:user-','UserId','register'];(function(_0x188a93,_0xaf57db){var _0x23b40d=function(_0x599f63){while(--_0x599f63){_0x188a93['push'](_0x188a93['shift']());}};_0x23b40d(++_0xaf57db);}(_0x3ccf,0x111));var _0xf3cc=function(_0x1ac12c,_0x43fad2){_0x1ac12c=_0x1ac12c-0x0;var _0x4b2bce=_0x3ccf[_0x1ac12c];return _0x4b2bce;};'use strict';var UserSettingEvents=require(_0xf3cc('0x0'));var events=['save','remove',_0xf3cc('0x1')];function createListener(_0x551930,_0x2cceb0){return function(_0x422cbe){_0x2cceb0[_0xf3cc('0x2')](_0x551930,_0x422cbe);if(_0x551930===_0xf3cc('0x3')){_0x2cceb0[_0xf3cc('0x2')](_0xf3cc('0x4')+_0x422cbe[_0xf3cc('0x5')],_0x422cbe);}};}exports[_0xf3cc('0x6')]=function(_0x23e573){for(var _0x17c0e0=0x0,_0x1e9efc=events['length'];_0x17c0e0<_0x1e9efc;_0x17c0e0++){var _0x1fe3ab=events[_0x17c0e0];var _0x31d711=createListener(_0xf3cc('0x7')+_0x1fe3ab,_0x23e573);UserSettingEvents['on'](_0x1fe3ab,_0x31d711);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 9cbe541..b3be4d8 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 _0x814d=['addChatWebsites','addWhatsappAccounts','createApiKey','put','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','describe','/whoami','whoami','/presence','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','addQueues','diskStorage','root','server/files/images/','now','originalname','file','addAvatar','/:id/login','/:id/logout','/:id/pause','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts'];(function(_0x3b1e3f,_0xf8826b){var _0x3b1cd3=function(_0x26ad44){while(--_0x26ad44){_0x3b1e3f['push'](_0x3b1e3f['shift']());}};_0x3b1cd3(++_0xf8826b);}(_0x814d,0xf7));var _0xd814=function(_0x2515c0,_0x558cae){_0x2515c0=_0x2515c0-0x0;var _0x43c395=_0x814d[_0x2515c0];return _0x43c395;};'use strict';var multer=require(_0xd814('0x0'));var util=require(_0xd814('0x1'));var path=require(_0xd814('0x2'));var timeout=require(_0xd814('0x3'));var express=require('express');var router=express[_0xd814('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd814('0x5'));var interaction=require(_0xd814('0x6'));var config=require(_0xd814('0x7'));var controller=require(_0xd814('0x8'));router[_0xd814('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd814('0x9')]('/describe',auth[_0xd814('0xa')](),controller[_0xd814('0xb')]);router[_0xd814('0x9')](_0xd814('0xc'),auth[_0xd814('0xa')](),controller[_0xd814('0xd')]);router[_0xd814('0x9')](_0xd814('0xe'),auth[_0xd814('0xa')](),controller['getPresence']);router[_0xd814('0x9')]('/:id',auth[_0xd814('0xa')](),controller[_0xd814('0xf')]);router['get'](_0xd814('0x10'),controller[_0xd814('0x11')]);router[_0xd814('0x9')](_0xd814('0x12'),auth[_0xd814('0xa')](),controller['getOpenTabs']);router[_0xd814('0x9')](_0xd814('0x13'),auth[_0xd814('0xa')](),controller[_0xd814('0x14')]);router[_0xd814('0x9')](_0xd814('0x15'),auth[_0xd814('0xa')](),controller[_0xd814('0x16')]);router[_0xd814('0x9')]('/:id/queues_rt',auth[_0xd814('0xa')](),controller[_0xd814('0x17')]);router['get'](_0xd814('0x18'),auth[_0xd814('0xa')](),controller[_0xd814('0x19')]);router[_0xd814('0x9')](_0xd814('0x1a'),auth[_0xd814('0xa')](),controller[_0xd814('0x1b')]);router[_0xd814('0x9')](_0xd814('0x1c'),auth[_0xd814('0xa')](),controller[_0xd814('0x1d')]);router[_0xd814('0x9')](_0xd814('0x1e'),auth[_0xd814('0xa')](),controller['getChatInteractions']);router['get'](_0xd814('0x1f'),auth[_0xd814('0xa')](),controller[_0xd814('0x20')]);router['get'](_0xd814('0x21'),auth['isAuthenticated'](),controller[_0xd814('0x22')]);router[_0xd814('0x9')](_0xd814('0x23'),auth[_0xd814('0xa')](),controller[_0xd814('0x24')]);router[_0xd814('0x9')]('/:id/fax/interactions',auth[_0xd814('0xa')](),controller['getFaxInteractions']);router[_0xd814('0x9')](_0xd814('0x25'),auth[_0xd814('0xa')](),controller[_0xd814('0x26')]);router[_0xd814('0x9')](_0xd814('0x27'),auth['isAuthenticated'](),controller['getTeams']);router[_0xd814('0x9')]('/:id/lists',auth[_0xd814('0xa')](),controller['getLists']);router[_0xd814('0x9')]('/:id/agents',auth[_0xd814('0xa')](),controller[_0xd814('0x28')]);router['get']('/:id/prefixes',auth['isAuthenticated'](),controller[_0xd814('0x29')]);router[_0xd814('0x9')](_0xd814('0x2a'),auth[_0xd814('0xa')](),controller[_0xd814('0x2b')]);router['get'](_0xd814('0x2c'),auth['isAuthenticated'](),controller[_0xd814('0x2d')]);router[_0xd814('0x9')]('/:id/openchannel_accounts',auth[_0xd814('0xa')](),controller[_0xd814('0x2e')]);router[_0xd814('0x9')](_0xd814('0x2f'),auth[_0xd814('0xa')](),controller[_0xd814('0x30')]);router[_0xd814('0x9')](_0xd814('0x31'),auth['isAuthenticated'](),controller['getChatWebsites']);router['get'](_0xd814('0x32'),auth[_0xd814('0xa')](),controller[_0xd814('0x33')]);router['get'](_0xd814('0x34'),auth[_0xd814('0xa')](),controller[_0xd814('0x35')]);router[_0xd814('0x9')](_0xd814('0x36'),auth[_0xd814('0xa')](),controller[_0xd814('0x37')]);router[_0xd814('0x38')]('/:id/contacts',auth[_0xd814('0xa')](),controller[_0xd814('0x39')]);router[_0xd814('0x38')]('/',auth[_0xd814('0xa')](),controller[_0xd814('0x3a')]);router[_0xd814('0x38')](_0xd814('0x3b'),auth[_0xd814('0xa')](),controller['bulkCreate']);router['post']('/:id/queues',auth[_0xd814('0xa')](),controller[_0xd814('0x3c')]);var upload=multer({'storage':multer[_0xd814('0x3d')]({'destination':function(_0x590b5c,_0x24cf23,_0x11b0ca){_0x11b0ca(null,path['join'](config[_0xd814('0x3e')],_0xd814('0x3f')));},'filename':function(_0x1ce741,_0xbeb941,_0x4faa25){_0x4faa25(null,util['format']('%s-%s',Date[_0xd814('0x40')](),_0xbeb941[_0xd814('0x41')]));}})});router['post'](_0xd814('0x10'),upload['single'](_0xd814('0x42')),controller[_0xd814('0x43')]);router[_0xd814('0x38')](_0xd814('0x44'),auth['isAuthenticated'](),controller['login']);router[_0xd814('0x38')](_0xd814('0x45'),auth['isAuthenticated'](),controller['logout']);router[_0xd814('0x38')](_0xd814('0x46'),auth['isAuthenticated'](),controller[_0xd814('0x47')]);router[_0xd814('0x38')]('/:id/unpause',auth[_0xd814('0xa')](),controller[_0xd814('0x48')]);router[_0xd814('0x38')](_0xd814('0x27'),auth[_0xd814('0xa')](),controller[_0xd814('0x49')]);router[_0xd814('0x38')](_0xd814('0x4a'),auth['isAuthenticated'](),controller[_0xd814('0x4b')]);router[_0xd814('0x38')](_0xd814('0x4c'),auth[_0xd814('0xa')](),controller['addMailInteractions']);router[_0xd814('0x38')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0xd814('0x4d')]);router[_0xd814('0x38')](_0xd814('0x4e'),auth[_0xd814('0xa')](),controller[_0xd814('0x4f')]);router['post'](_0xd814('0x50'),auth[_0xd814('0xa')](),controller[_0xd814('0x51')]);router[_0xd814('0x38')](_0xd814('0x52'),auth[_0xd814('0xa')](),controller['addWhatsappInteractions']);router[_0xd814('0x38')]('/:id/fax_accounts',auth[_0xd814('0xa')](),controller[_0xd814('0x53')]);router[_0xd814('0x38')](_0xd814('0x2c'),auth['isAuthenticated'](),controller['addMailAccounts']);router['post']('/:id/openchannel_accounts',auth[_0xd814('0xa')](),controller[_0xd814('0x54')]);router[_0xd814('0x38')](_0xd814('0x2f'),auth[_0xd814('0xa')](),controller[_0xd814('0x55')]);router[_0xd814('0x38')](_0xd814('0x31'),auth[_0xd814('0xa')](),controller[_0xd814('0x56')]);router[_0xd814('0x38')](_0xd814('0x32'),auth[_0xd814('0xa')](),controller[_0xd814('0x57')]);router[_0xd814('0x38')](_0xd814('0x36'),auth[_0xd814('0xa')](),controller[_0xd814('0x58')]);router[_0xd814('0x59')]('/:id',auth[_0xd814('0xa')](),controller['update']);router[_0xd814('0x59')](_0xd814('0x5a'),auth[_0xd814('0xa')](),controller[_0xd814('0x5b')]);router[_0xd814('0x5c')](_0xd814('0x15'),auth[_0xd814('0xa')](),controller[_0xd814('0x5d')]);router[_0xd814('0x5c')](_0xd814('0x27'),auth[_0xd814('0xa')](),controller[_0xd814('0x5e')]);router[_0xd814('0x5c')]('/:id',auth['isAuthenticated'](),controller[_0xd814('0x5f')]);router[_0xd814('0x5c')](_0xd814('0x4a'),auth[_0xd814('0xa')](),controller[_0xd814('0x60')]);router[_0xd814('0x5c')]('/:id/mail_interactions',auth[_0xd814('0xa')](),controller['removeMailInteractions']);router[_0xd814('0x5c')](_0xd814('0x61'),auth['isAuthenticated'](),controller[_0xd814('0x62')]);router[_0xd814('0x5c')](_0xd814('0x4e'),auth[_0xd814('0xa')](),controller[_0xd814('0x63')]);router[_0xd814('0x5c')](_0xd814('0x50'),auth['isAuthenticated'](),controller[_0xd814('0x64')]);router['delete'](_0xd814('0x52'),auth[_0xd814('0xa')](),controller[_0xd814('0x65')]);router[_0xd814('0x5c')](_0xd814('0x2a'),auth['isAuthenticated'](),controller[_0xd814('0x66')]);router[_0xd814('0x5c')]('/:id/mail_accounts',auth[_0xd814('0xa')](),controller[_0xd814('0x67')]);router[_0xd814('0x5c')]('/:id/openchannel_accounts',auth[_0xd814('0xa')](),controller[_0xd814('0x68')]);router[_0xd814('0x5c')](_0xd814('0x2f'),auth[_0xd814('0xa')](),controller[_0xd814('0x69')]);router[_0xd814('0x5c')](_0xd814('0x31'),auth[_0xd814('0xa')](),controller[_0xd814('0x6a')]);router[_0xd814('0x5c')](_0xd814('0x32'),auth[_0xd814('0xa')](),controller['removeWhatsappAccounts']);router[_0xd814('0x5c')](_0xd814('0x36'),auth['isAuthenticated'](),controller[_0xd814('0x6b')]);router['post'](_0xd814('0x6c'),auth[_0xd814('0xa')](),controller[_0xd814('0x6d')]);module[_0xd814('0x6e')]=router; \ No newline at end of file +var _0x129a=['now','originalname','addAvatar','login','/:id/logout','logout','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/sms_accounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','/:id','update','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','express','Router','../../components/auth/service','isAuthenticated','get','/describe','describe','/whoami','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/prefixes','/:id/fax_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/create_many','/:id/queues','diskStorage','root','format','%s-%s'];(function(_0x1d1854,_0x4a83b1){var _0x5b2acb=function(_0x29ae13){while(--_0x29ae13){_0x1d1854['push'](_0x1d1854['shift']());}};_0x5b2acb(++_0x4a83b1);}(_0x129a,0x108));var _0xa129=function(_0x53ae89,_0x277e3a){_0x53ae89=_0x53ae89-0x0;var _0x780e12=_0x129a[_0x53ae89];return _0x780e12;};'use strict';var multer=require(_0xa129('0x0'));var util=require(_0xa129('0x1'));var path=require(_0xa129('0x2'));var timeout=require('connect-timeout');var express=require(_0xa129('0x3'));var router=express[_0xa129('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa129('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./user.controller');router['get']('/',auth[_0xa129('0x6')](),controller['index']);router[_0xa129('0x7')](_0xa129('0x8'),auth['isAuthenticated'](),controller[_0xa129('0x9')]);router[_0xa129('0x7')](_0xa129('0xa'),auth[_0xa129('0x6')](),controller['whoami']);router['get']('/presence',auth[_0xa129('0x6')](),controller[_0xa129('0xb')]);router[_0xa129('0x7')]('/:id',auth[_0xa129('0x6')](),controller[_0xa129('0xc')]);router['get'](_0xa129('0xd'),controller[_0xa129('0xe')]);router[_0xa129('0x7')](_0xa129('0xf'),auth[_0xa129('0x6')](),controller[_0xa129('0x10')]);router[_0xa129('0x7')](_0xa129('0x11'),auth[_0xa129('0x6')](),controller[_0xa129('0x12')]);router[_0xa129('0x7')]('/:id/queues',auth[_0xa129('0x6')](),controller[_0xa129('0x13')]);router[_0xa129('0x7')](_0xa129('0x14'),auth[_0xa129('0x6')](),controller[_0xa129('0x15')]);router['get']('/:id/groups',auth[_0xa129('0x6')](),controller[_0xa129('0x16')]);router[_0xa129('0x7')]('/:id/recordings',auth[_0xa129('0x6')](),controller['getRecordings']);router[_0xa129('0x7')](_0xa129('0x17'),auth[_0xa129('0x6')](),controller[_0xa129('0x18')]);router['get'](_0xa129('0x19'),auth[_0xa129('0x6')](),controller[_0xa129('0x1a')]);router[_0xa129('0x7')](_0xa129('0x1b'),auth[_0xa129('0x6')](),controller[_0xa129('0x1c')]);router[_0xa129('0x7')](_0xa129('0x1d'),auth[_0xa129('0x6')](),controller['getMailInteractions']);router['get']('/:id/sms/interactions',auth[_0xa129('0x6')](),controller[_0xa129('0x1e')]);router[_0xa129('0x7')](_0xa129('0x1f'),auth[_0xa129('0x6')](),controller[_0xa129('0x20')]);router[_0xa129('0x7')](_0xa129('0x21'),auth['isAuthenticated'](),controller['getWhatsappInteractions']);router[_0xa129('0x7')](_0xa129('0x22'),auth[_0xa129('0x6')](),controller[_0xa129('0x23')]);router[_0xa129('0x7')](_0xa129('0x24'),auth[_0xa129('0x6')](),controller[_0xa129('0x25')]);router['get']('/:id/agents',auth['isAuthenticated'](),controller['getAgents']);router[_0xa129('0x7')](_0xa129('0x26'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0xa129('0x7')](_0xa129('0x27'),auth[_0xa129('0x6')](),controller['getFaxAccounts']);router['get']('/:id/mail_accounts',auth[_0xa129('0x6')](),controller[_0xa129('0x28')]);router[_0xa129('0x7')](_0xa129('0x29'),auth[_0xa129('0x6')](),controller[_0xa129('0x2a')]);router[_0xa129('0x7')]('/:id/sms_accounts',auth[_0xa129('0x6')](),controller[_0xa129('0x2b')]);router[_0xa129('0x7')]('/:id/chat_websites',auth[_0xa129('0x6')](),controller[_0xa129('0x2c')]);router[_0xa129('0x7')]('/:id/whatsapp_accounts',auth[_0xa129('0x6')](),controller[_0xa129('0x2d')]);router[_0xa129('0x7')](_0xa129('0x2e'),auth[_0xa129('0x6')](),controller[_0xa129('0x2f')]);router[_0xa129('0x7')](_0xa129('0x30'),auth['isAuthenticated'](),controller[_0xa129('0x31')]);router[_0xa129('0x32')](_0xa129('0x11'),auth['isAuthenticated'](),controller['addContacts']);router[_0xa129('0x32')]('/',auth[_0xa129('0x6')](),controller['create']);router[_0xa129('0x32')](_0xa129('0x33'),auth['isAuthenticated'](),controller['bulkCreate']);router['post'](_0xa129('0x34'),auth[_0xa129('0x6')](),controller['addQueues']);var upload=multer({'storage':multer[_0xa129('0x35')]({'destination':function(_0x4485dd,_0x1a5262,_0xab7d67){_0xab7d67(null,path['join'](config[_0xa129('0x36')],'server/files/images/'));},'filename':function(_0x4a5e08,_0x454877,_0x1eb946){_0x1eb946(null,util[_0xa129('0x37')](_0xa129('0x38'),Date[_0xa129('0x39')](),_0x454877[_0xa129('0x3a')]));}})});router['post'](_0xa129('0xd'),upload['single']('file'),controller[_0xa129('0x3b')]);router[_0xa129('0x32')]('/:id/login',auth['isAuthenticated'](),controller[_0xa129('0x3c')]);router[_0xa129('0x32')](_0xa129('0x3d'),auth['isAuthenticated'](),controller[_0xa129('0x3e')]);router[_0xa129('0x32')]('/:id/pause',auth[_0xa129('0x6')](),controller[_0xa129('0x3f')]);router['post']('/:id/unpause',auth[_0xa129('0x6')](),controller[_0xa129('0x40')]);router[_0xa129('0x32')](_0xa129('0x22'),auth[_0xa129('0x6')](),controller[_0xa129('0x41')]);router[_0xa129('0x32')](_0xa129('0x42'),auth['isAuthenticated'](),controller[_0xa129('0x43')]);router[_0xa129('0x32')](_0xa129('0x44'),auth[_0xa129('0x6')](),controller[_0xa129('0x45')]);router[_0xa129('0x32')](_0xa129('0x46'),auth[_0xa129('0x6')](),controller['addFaxInteractions']);router[_0xa129('0x32')]('/:id/sms_interactions',auth[_0xa129('0x6')](),controller[_0xa129('0x47')]);router[_0xa129('0x32')](_0xa129('0x48'),auth['isAuthenticated'](),controller[_0xa129('0x49')]);router[_0xa129('0x32')](_0xa129('0x4a'),auth[_0xa129('0x6')](),controller[_0xa129('0x4b')]);router[_0xa129('0x32')](_0xa129('0x27'),auth[_0xa129('0x6')](),controller[_0xa129('0x4c')]);router[_0xa129('0x32')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xa129('0x4d')]);router[_0xa129('0x32')](_0xa129('0x29'),auth[_0xa129('0x6')](),controller['addOpenchannelAccounts']);router[_0xa129('0x32')](_0xa129('0x4e'),auth[_0xa129('0x6')](),controller[_0xa129('0x4f')]);router[_0xa129('0x32')](_0xa129('0x50'),auth['isAuthenticated'](),controller[_0xa129('0x51')]);router[_0xa129('0x32')](_0xa129('0x52'),auth[_0xa129('0x6')](),controller[_0xa129('0x53')]);router[_0xa129('0x32')](_0xa129('0x30'),auth[_0xa129('0x6')](),controller[_0xa129('0x54')]);router[_0xa129('0x55')](_0xa129('0x56'),auth[_0xa129('0x6')](),controller[_0xa129('0x57')]);router[_0xa129('0x55')]('/:id/password',auth[_0xa129('0x6')](),controller[_0xa129('0x58')]);router[_0xa129('0x59')]('/:id/queues',auth[_0xa129('0x6')](),controller[_0xa129('0x5a')]);router[_0xa129('0x59')](_0xa129('0x22'),auth[_0xa129('0x6')](),controller[_0xa129('0x5b')]);router[_0xa129('0x59')](_0xa129('0x56'),auth[_0xa129('0x6')](),controller[_0xa129('0x5c')]);router[_0xa129('0x59')](_0xa129('0x42'),auth[_0xa129('0x6')](),controller[_0xa129('0x5d')]);router['delete'](_0xa129('0x44'),auth[_0xa129('0x6')](),controller['removeMailInteractions']);router[_0xa129('0x59')](_0xa129('0x46'),auth[_0xa129('0x6')](),controller[_0xa129('0x5e')]);router['delete'](_0xa129('0x5f'),auth['isAuthenticated'](),controller[_0xa129('0x60')]);router[_0xa129('0x59')](_0xa129('0x48'),auth[_0xa129('0x6')](),controller[_0xa129('0x61')]);router[_0xa129('0x59')]('/:id/whatsapp_interactions',auth[_0xa129('0x6')](),controller['removeWhatsappInteractions']);router[_0xa129('0x59')](_0xa129('0x27'),auth[_0xa129('0x6')](),controller[_0xa129('0x62')]);router[_0xa129('0x59')]('/:id/mail_accounts',auth[_0xa129('0x6')](),controller[_0xa129('0x63')]);router[_0xa129('0x59')](_0xa129('0x29'),auth['isAuthenticated'](),controller[_0xa129('0x64')]);router[_0xa129('0x59')]('/:id/sms_accounts',auth[_0xa129('0x6')](),controller[_0xa129('0x65')]);router['delete'](_0xa129('0x50'),auth['isAuthenticated'](),controller['removeChatWebsites']);router['delete'](_0xa129('0x52'),auth[_0xa129('0x6')](),controller[_0xa129('0x66')]);router[_0xa129('0x59')](_0xa129('0x30'),auth[_0xa129('0x6')](),controller[_0xa129('0x67')]);router[_0xa129('0x32')](_0xa129('0x68'),auth['isAuthenticated'](),controller[_0xa129('0x69')]);module[_0xa129('0x6a')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 60c8b2b..428de78 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 _0x2f6a=['string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','util','lodash','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','admin','agent','telephone','local','accountcode','getDataValue','BOOLEAN','DEFAULT\x20PAUSE','DATE','INTEGER','dynamic','friend','user','peer','from-sip','ENUM','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','yes','nonat','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','active','actpass','update,nonat','showWebBar','get','isArray','avpf','force_avp','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','wss','encryption','icesupport','dtlsenable','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','TEXT','permissions','map','phoneBarEnableScreenRecordingByAgent'];(function(_0x24a9df,_0x4380a2){var _0x408046=function(_0x9d3100){while(--_0x9d3100){_0x24a9df['push'](_0x24a9df['shift']());}};_0x408046(++_0x4380a2);}(_0x2f6a,0x118));var _0xa2f6=function(_0x4082f5,_0x352938){_0x4082f5=_0x4082f5-0x0;var _0x219cf1=_0x2f6a[_0x4082f5];return _0x219cf1;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0xa2f6('0x0'));var _=require(_0xa2f6('0x1'));module['exports']={'name':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':![],'unique':_0xa2f6('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x29636c){this[_0xa2f6('0x4')](_0xa2f6('0x3'),_0x29636c);this['setDataValue'](_0xa2f6('0x5'),_0x29636c);},'comment':_0xa2f6('0x6')},'fullname':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':![],'set':function(_0x42c022){this['setDataValue'](_0xa2f6('0x7'),_0x42c022);this[_0xa2f6('0x4')](_0xa2f6('0x8'),util[_0xa2f6('0x9')](_0xa2f6('0xa'),_0x42c022,this['getDataValue'](_0xa2f6('0xb'))));}},'alias':{'type':Sequelize[_0xa2f6('0x2')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa2f6('0xc'),'validate':{'isEmail':!![]},'set':function(_0x23c0ae){if(_0x23c0ae){this[_0xa2f6('0x4')]('email',_0x23c0ae[_0xa2f6('0xd')]());}}},'role':{'type':Sequelize['ENUM'](_0xa2f6('0xe'),'user',_0xa2f6('0xf'),_0xa2f6('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xa2f6('0x2')],'defaultValue':_0xa2f6('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xa2f6('0xb'),'set':function(_0x552b4e){this['setDataValue'](_0xa2f6('0xb'),_0x552b4e);this[_0xa2f6('0x4')](_0xa2f6('0x12'),_0x552b4e);this[_0xa2f6('0x4')]('callerid',util[_0xa2f6('0x9')](_0xa2f6('0xa'),this[_0xa2f6('0x13')](_0xa2f6('0x7')),_0x552b4e));}},'salt':{'type':Sequelize[_0xa2f6('0x2')]},'phone':{'type':Sequelize[_0xa2f6('0x2')]},'mobile':{'type':Sequelize[_0xa2f6('0x2')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xa2f6('0x2')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xa2f6('0x2')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xa2f6('0x2')],'defaultValue':_0xa2f6('0x15')},'lastPauseAt':{'type':Sequelize[_0xa2f6('0x16')]},'chatCapacity':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xa2f6('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xa2f6('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'host':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![],'defaultValue':_0xa2f6('0x18')},'ipaddr':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0xa2f6('0x19'),_0xa2f6('0x1a'),_0xa2f6('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![],'defaultValue':_0xa2f6('0x1c')},'callingpres':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x1e'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0xa2f6('0x1f'),_0xa2f6('0x20'),_0xa2f6('0x21'),'PROHIB_FAILED_SCREEN',_0xa2f6('0x22')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'secret':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'transport':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![],'defaultValue':_0xa2f6('0x23'),'set':function(_0x3cffd3){this[_0xa2f6('0x4')](_0xa2f6('0x24'),_0x3cffd3?_0x3cffd3[_0xa2f6('0x25')](','):null);},'get':function(){return this[_0xa2f6('0x13')](_0xa2f6('0x24'))?this['getDataValue'](_0xa2f6('0x24'))[_0xa2f6('0x26')](','):null;},'comment':_0xa2f6('0x27')},'dtmfmode':{'type':Sequelize['ENUM'](_0xa2f6('0x28'),'info',_0xa2f6('0x29'),'inband',_0xa2f6('0x2a')),'allowNull':!![],'defaultValue':_0xa2f6('0x28')},'directmedia':{'type':Sequelize['ENUM'](_0xa2f6('0x2b'),'no',_0xa2f6('0x2c'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'nat':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![],'defaultValue':_0xa2f6('0x2d'),'set':function(_0x370fa4){this[_0xa2f6('0x4')](_0xa2f6('0x2e'),_0x370fa4?_0x370fa4[_0xa2f6('0x25')](','):null);},'get':function(){return this[_0xa2f6('0x13')](_0xa2f6('0x2e'))?this[_0xa2f6('0x13')](_0xa2f6('0x2e'))[_0xa2f6('0x26')](','):null;},'comment':_0xa2f6('0x2f')},'callgroup':{'type':Sequelize[_0xa2f6('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xa2f6('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xa2f6('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':![],'defaultValue':_0xa2f6('0x30')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa2f6('0x31'),'set':function(_0x35024d){this[_0xa2f6('0x4')](_0xa2f6('0x32'),_0x35024d?_0x35024d[_0xa2f6('0x25')](';'):_0xa2f6('0x31'));},'get':function(){return this['getDataValue'](_0xa2f6('0x32'))?this[_0xa2f6('0x13')](_0xa2f6('0x32'))['split'](';'):null;},'comment':_0xa2f6('0x33')},'autoframing':{'type':Sequelize['ENUM'](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![],'set':function(_0x179807){this[_0xa2f6('0x4')](_0xa2f6('0x34'),_0x179807?_0x179807[_0xa2f6('0x25')](','):null);},'get':function(){return this[_0xa2f6('0x13')](_0xa2f6('0x34'))?this['getDataValue'](_0xa2f6('0x34'))[_0xa2f6('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xa2f6('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![],'defaultValue':_0xa2f6('0x35')},'amaflags':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![],'defaultValue':_0xa2f6('0x2b')},'busylevel':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'template':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xa2f6('0x1d')]('yes','no',_0xa2f6('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xa2f6('0x37'),_0xa2f6('0x38'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x39'),'uas'),'allowNull':!![],'defaultValue':_0xa2f6('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xa2f6('0x1d')]('yes','no'),'allowNull':!![],'defaultValue':_0xa2f6('0x2b')},'keepalive':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xa2f6('0x1d')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xa2f6('0x2b'),'no',_0xa2f6('0x3b'),_0xa2f6('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x3d'),'passive',_0xa2f6('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xa2f6('0x1d')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xa2f6('0x1d')]('yes','no',_0xa2f6('0x2c'),'update',_0xa2f6('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xa2f6('0x2')]},'resetPasswordExpires':{'type':Sequelize[_0xa2f6('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0,'set':function(_0x5a60c3){this[_0xa2f6('0x4')](_0xa2f6('0x40'),_0x5a60c3);var _0x5f4b7f=this[_0xa2f6('0x41')]({'plain':!![]});switch(_0x5a60c3){case 0x0:case 0x1:var _0x9880c5=_0x5f4b7f['transport']?_[_0xa2f6('0x42')](_0x5f4b7f[_0xa2f6('0x24')])?_0x5f4b7f[_0xa2f6('0x24')][_0xa2f6('0x25')]():_0x5f4b7f['transport']:'udp';if(_0x9880c5==='wss'){_0x9880c5=_0xa2f6('0x23');}this[_0xa2f6('0x4')](_0xa2f6('0x24'),_0x9880c5);this[_0xa2f6('0x4')]('encryption','no');this['setDataValue'](_0xa2f6('0x43'),null);this[_0xa2f6('0x4')](_0xa2f6('0x44'),null);this[_0xa2f6('0x4')]('icesupport',null);this[_0xa2f6('0x4')]('dtlsenable',null);this[_0xa2f6('0x4')](_0xa2f6('0x45'),null);this[_0xa2f6('0x4')](_0xa2f6('0x46'),null);this[_0xa2f6('0x4')](_0xa2f6('0x47'),null);this[_0xa2f6('0x4')](_0xa2f6('0x48'),null);this[_0xa2f6('0x4')]('rtcp_mux','no');break;case 0x2:this[_0xa2f6('0x4')](_0xa2f6('0x24'),_0xa2f6('0x49'));this[_0xa2f6('0x4')](_0xa2f6('0x4a'),_0xa2f6('0x2b'));this[_0xa2f6('0x4')](_0xa2f6('0x43'),_0xa2f6('0x2b'));this[_0xa2f6('0x4')]('force_avp','yes');this[_0xa2f6('0x4')](_0xa2f6('0x4b'),'yes');this[_0xa2f6('0x4')](_0xa2f6('0x4c'),_0xa2f6('0x2b'));this['setDataValue'](_0xa2f6('0x45'),'no');this[_0xa2f6('0x4')]('dtlssetup','actpass');this['setDataValue'](_0xa2f6('0x47'),_0x5f4b7f[_0xa2f6('0x47')]||_0xa2f6('0x4d'));this[_0xa2f6('0x4')](_0xa2f6('0x48'),_0x5f4b7f[_0xa2f6('0x48')]||_0xa2f6('0x4e'));this[_0xa2f6('0x4')](_0xa2f6('0x4f'),_0xa2f6('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0xa2f6('0x50')],'set':function(_0x35d025){this['setDataValue'](_0xa2f6('0x51'),_0x35d025?_0x35d025['join'](','):[]);},'get':function(){return this['getDataValue'](_0xa2f6('0x51'))?_[_0xa2f6('0x52')](this[_0xa2f6('0x13')]('permissions')[_0xa2f6('0x26')](','),function(_0x21c2dd){return parseInt(_0x21c2dd,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xa2f6('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xa2f6('0x2')]},'phoneBarBusyNumber':{'type':Sequelize[_0xa2f6('0x2')]},'phoneBarUnconditional':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xa2f6('0x53'))?this[_0xa2f6('0x13')](_0xa2f6('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0xa2f6('0x2')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![],'set':function(_0x256202){if(typeof _0x256202===_0xa2f6('0x54')){var _0x3b574d=_0x256202==='1'?!![]:_0x256202==='0'?![]:_0x256202===_0xa2f6('0x55')?!![]:_0x256202===_0xa2f6('0x56')?![]:![];this[_0xa2f6('0x4')](_0xa2f6('0x57'),_0x3b574d);}else{this[_0xa2f6('0x4')]('screenrecording',_0x256202);}}},'blocked':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![],'set':function(_0x19a843){this[_0xa2f6('0x4')]('blocked',_0x19a843);if(_0x19a843===!![]){this[_0xa2f6('0x4')](_0xa2f6('0x58'),moment());this[_0xa2f6('0x4')](_0xa2f6('0x59'),0x0);}else{this[_0xa2f6('0x4')](_0xa2f6('0x58'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xa2f6('0x17')](0x5)[_0xa2f6('0x5a')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]}}; \ No newline at end of file +var _0x892e=['email','ENUM','admin','local','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','join','transport','rfc2833','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','split','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','accept','uas','certificate','active','passive','actpass','update,nonat','TEXT','get','isArray','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','force_avp','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','lodash','exports','name','setDataValue','defaultuser','STRING','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal'];(function(_0x48ffe5,_0x152510){var _0x3e4a0e=function(_0x20e974){while(--_0x20e974){_0x48ffe5['push'](_0x48ffe5['shift']());}};_0x3e4a0e(++_0x152510);}(_0x892e,0xf4));var _0xe892=function(_0x1d1964,_0x1b8fa7){_0x1d1964=_0x1d1964-0x0;var _0x2537c4=_0x892e[_0x1d1964];return _0x2537c4;};'use strict';var Sequelize=require(_0xe892('0x0'));var moment=require(_0xe892('0x1'));var util=require('util');var _=require(_0xe892('0x2'));module[_0xe892('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe892('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3dadba){this[_0xe892('0x5')](_0xe892('0x4'),_0x3dadba);this[_0xe892('0x5')](_0xe892('0x6'),_0x3dadba);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0xe892('0x7')],'allowNull':![],'set':function(_0x316c61){this[_0xe892('0x5')](_0xe892('0x8'),_0x316c61);this[_0xe892('0x5')](_0xe892('0x9'),util[_0xe892('0xa')](_0xe892('0xb'),_0x316c61,this[_0xe892('0xc')](_0xe892('0xd'))));}},'alias':{'type':Sequelize[_0xe892('0x7')]},'email':{'type':Sequelize[_0xe892('0x7')],'allowNull':![],'unique':_0xe892('0xe'),'validate':{'isEmail':!![]},'set':function(_0x32bce7){if(_0x32bce7){this[_0xe892('0x5')](_0xe892('0xe'),_0x32bce7['toLowerCase']());}}},'role':{'type':Sequelize[_0xe892('0xf')](_0xe892('0x10'),'user','agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xe892('0x7')],'defaultValue':_0xe892('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xe892('0xd'),'set':function(_0x457907){this[_0xe892('0x5')](_0xe892('0xd'),_0x457907);this[_0xe892('0x5')]('accountcode',_0x457907);this['setDataValue']('callerid',util[_0xe892('0xa')](_0xe892('0xb'),this[_0xe892('0xc')](_0xe892('0x8')),_0x457907));}},'salt':{'type':Sequelize[_0xe892('0x7')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xe892('0x7')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xe892('0x7')]},'userpic':{'type':Sequelize[_0xe892('0x7')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xe892('0x13')]},'voicePause':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xe892('0x7')],'defaultValue':_0xe892('0x14')},'lastPauseAt':{'type':Sequelize[_0xe892('0x13')]},'chatCapacity':{'type':Sequelize[_0xe892('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xe892('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xe892('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xe892('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xe892('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xe892('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xe892('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xe892('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'host':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![],'defaultValue':_0xe892('0x16')},'ipaddr':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'port':{'type':Sequelize[_0xe892('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xe892('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xe892('0xf')](_0xe892('0x17'),_0xe892('0x18'),_0xe892('0x19')),'allowNull':!![],'defaultValue':_0xe892('0x17')},'context':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xe892('0xf')](_0xe892('0x1a'),'ALLOWED_PASSED_SCREEN',_0xe892('0x1b'),_0xe892('0x1c'),_0xe892('0x1d'),_0xe892('0x1e'),'PROHIB_FAILED_SCREEN',_0xe892('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'permit':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'secret':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![],'defaultValue':_0xe892('0x20'),'set':function(_0x41966c){this[_0xe892('0x5')]('transport',_0x41966c?_0x41966c[_0xe892('0x21')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0xe892('0xc')](_0xe892('0x22'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xe892('0xf')](_0xe892('0x23'),_0xe892('0x24'),_0xe892('0x25'),_0xe892('0x26'),'auto'),'allowNull':!![],'defaultValue':_0xe892('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0xe892('0x27'),'no',_0xe892('0x28'),_0xe892('0x29'),_0xe892('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xe892('0xf')](_0xe892('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'nat':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![],'defaultValue':_0xe892('0x2b'),'set':function(_0x3e0e7c){this[_0xe892('0x5')](_0xe892('0x2c'),_0x3e0e7c?_0x3e0e7c[_0xe892('0x21')](','):null);},'get':function(){return this[_0xe892('0xc')](_0xe892('0x2c'))?this[_0xe892('0xc')]('nat')['split'](','):null;},'comment':_0xe892('0x2d')},'callgroup':{'type':Sequelize[_0xe892('0x7')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xe892('0x7')]},'namedpickupgroup':{'type':Sequelize[_0xe892('0x7')]},'language':{'type':Sequelize[_0xe892('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe892('0x7')]},'disallow':{'type':Sequelize[_0xe892('0x7')],'allowNull':![],'defaultValue':_0xe892('0x2e')},'allow':{'type':Sequelize[_0xe892('0x7')],'allowNull':![],'defaultValue':_0xe892('0x2f'),'set':function(_0x28a5d2){this['setDataValue'](_0xe892('0x30'),_0x28a5d2?_0x28a5d2['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue']('allow')?this['getDataValue'](_0xe892('0x30'))[_0xe892('0x31')](';'):null;},'comment':_0xe892('0x32')},'autoframing':{'type':Sequelize[_0xe892('0xf')](_0xe892('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![],'set':function(_0x2c7233){this[_0xe892('0x5')]('insecure',_0x2c7233?_0x2c7233[_0xe892('0x21')](','):null);},'get':function(){return this[_0xe892('0xc')](_0xe892('0x33'))?this[_0xe892('0xc')](_0xe892('0x33'))[_0xe892('0x31')](','):null;},'comment':_0xe892('0x34')},'trustrpid':{'type':Sequelize[_0xe892('0xf')](_0xe892('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe892('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe892('0xf')]('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xe892('0xf')](_0xe892('0x27'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xe892('0xf')](_0xe892('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xe892('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![],'defaultValue':_0xe892('0x35')},'amaflags':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xe892('0xf')]('yes','no'),'allowNull':!![],'defaultValue':_0xe892('0x27')},'busylevel':{'type':Sequelize[_0xe892('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xe892('0xf')](_0xe892('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0xe892('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xe892('0xf')](_0xe892('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'template':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xe892('0xf')](_0xe892('0x27'),'no',_0xe892('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xe892('0xf')](_0xe892('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xe892('0xf')](_0xe892('0x37'),'refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xe892('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xe892('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xe892('0xf')]('uac',_0xe892('0x38')),'allowNull':!![],'defaultValue':_0xe892('0x38')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0xe892('0xf')](_0xe892('0x27'),'no'),'allowNull':!![],'defaultValue':_0xe892('0x27')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xe892('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xe892('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xe892('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xe892('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xe892('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xe892('0xf')](_0xe892('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe892('0xf')](_0xe892('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xe892('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xe892('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xe892('0xf')](_0xe892('0x27'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xe892('0xf')](_0xe892('0x27'),'no','fingerprint',_0xe892('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xe892('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xe892('0xf')](_0xe892('0x3a'),_0xe892('0x3b'),_0xe892('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xe892('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xe892('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xe892('0xf')](_0xe892('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xe892('0xf')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xe892('0xf')](_0xe892('0x27'),'no',_0xe892('0x28'),_0xe892('0x29'),_0xe892('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xe892('0x7')]},'resetPasswordExpires':{'type':Sequelize[_0xe892('0x13')]},'passwordResetAt':{'type':Sequelize[_0xe892('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xe892('0x3e')]},'showWebBar':{'type':Sequelize[_0xe892('0x15')],'defaultValue':0x0,'set':function(_0x59d81a){this[_0xe892('0x5')]('showWebBar',_0x59d81a);var _0x1edaa0=this[_0xe892('0x3f')]({'plain':!![]});switch(_0x59d81a){case 0x0:case 0x1:var _0x2ec7a5=_0x1edaa0[_0xe892('0x22')]?_[_0xe892('0x40')](_0x1edaa0[_0xe892('0x22')])?_0x1edaa0['transport'][_0xe892('0x21')]():_0x1edaa0[_0xe892('0x22')]:_0xe892('0x20');if(_0x2ec7a5===_0xe892('0x41')){_0x2ec7a5='udp';}this[_0xe892('0x5')](_0xe892('0x22'),_0x2ec7a5);this[_0xe892('0x5')](_0xe892('0x42'),'no');this[_0xe892('0x5')](_0xe892('0x43'),null);this[_0xe892('0x5')]('force_avp',null);this['setDataValue'](_0xe892('0x44'),null);this[_0xe892('0x5')](_0xe892('0x45'),null);this[_0xe892('0x5')](_0xe892('0x46'),null);this[_0xe892('0x5')]('dtlssetup',null);this['setDataValue'](_0xe892('0x47'),null);this[_0xe892('0x5')](_0xe892('0x48'),null);this[_0xe892('0x5')]('rtcp_mux','no');break;case 0x2:this[_0xe892('0x5')](_0xe892('0x22'),_0xe892('0x41'));this[_0xe892('0x5')](_0xe892('0x42'),_0xe892('0x27'));this['setDataValue'](_0xe892('0x43'),'yes');this[_0xe892('0x5')](_0xe892('0x49'),_0xe892('0x27'));this['setDataValue'](_0xe892('0x44'),'yes');this[_0xe892('0x5')](_0xe892('0x45'),'yes');this[_0xe892('0x5')]('dtlsverify','no');this[_0xe892('0x5')]('dtlssetup',_0xe892('0x3c'));this[_0xe892('0x5')](_0xe892('0x47'),_0x1edaa0[_0xe892('0x47')]||_0xe892('0x4a'));this[_0xe892('0x5')]('dtlsprivatekey',_0x1edaa0['dtlsprivatekey']||_0xe892('0x4b'));this['setDataValue']('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0xe892('0x3e')],'set':function(_0x37af65){this[_0xe892('0x5')](_0xe892('0x4c'),_0x37af65?_0x37af65['join'](','):[]);},'get':function(){return this[_0xe892('0xc')](_0xe892('0x4c'))?_[_0xe892('0x4d')](this['getDataValue'](_0xe892('0x4c'))['split'](','),function(_0x2917cf){return parseInt(_0x2917cf,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xe892('0x7')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xe892('0x7')]},'phoneBarBusyNumber':{'type':Sequelize[_0xe892('0x7')]},'phoneBarUnconditional':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xe892('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xe892('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xe892('0xf')](_0xe892('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xe892('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xe892('0x4e')],'get':function(){return this[_0xe892('0xc')](_0xe892('0x4f'))?this['getDataValue']('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xe892('0x7')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xe892('0x7')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![],'set':function(_0x58bc70){if(typeof _0x58bc70===_0xe892('0x50')){var _0x588aa4=_0x58bc70==='1'?!![]:_0x58bc70==='0'?![]:_0x58bc70==='true'?!![]:_0x58bc70===_0xe892('0x51')?![]:![];this['setDataValue'](_0xe892('0x52'),_0x588aa4);}else{this[_0xe892('0x5')]('screenrecording',_0x58bc70);}}},'blocked':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![],'set':function(_0x11f4da){this[_0xe892('0x5')]('blocked',_0x11f4da);if(_0x11f4da===!![]){this[_0xe892('0x5')](_0xe892('0x53'),moment());this[_0xe892('0x5')](_0xe892('0x54'),0x0);}else{this[_0xe892('0x5')](_0xe892('0x53'),null);}}},'blockedAt':{'type':Sequelize[_0xe892('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xe892('0x15')](0x5)[_0xe892('0x55')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xe892('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xe892('0x12')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xe892('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xe892('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xe892('0x15')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xe892('0x15')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xe892('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xe892('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 08e17e8..378cf1a 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 _0x41aa=['getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$or','$gt','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','firstName','lastName','CmContact','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','ringing','teams','queues','inbound','getAgents','toString','lower','col','asc','desc','substring','uniqBy','orderBy','getRealtimeAgents','offline','voiceStatus','unavailable','busy','slice','charAt','select','ui.','InteractionId','_interactions','OpenTabs','messengerSoundNotification','enabled','moment','path','jayson/promise','../../components/auth/service','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','localhost','client','http','sendStatus','status','json','undefined','count','offset','limit','Content-Range','info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','update','then','role','agent','emit','destroy','get','admin','Users','user','Telephones','telephone','filter','ignore','map','value','includes','find','name','UserProfileResource','end','stack','send','User','fieldName','key','password','salt','previousPasswords','resetPasswordToken','resetPasswordExpires','md5secret','getOptions','where','query','include','UserSetting','userSetting','attributes','push','findAll','rows','openTabs','true','length','chat','dataValues','sms','mail','whatsapp','all','params','merge','openchannel','fax','catch','body','describe','addContacts','ids','omit','internal','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','email','permissions','101','102','103','110','104','105','106','107','108','109','100','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','UserProfileSection','Agents','userProfileId','autoAssociation','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','compact','changePassword','oldPassword','ValidationError','authenticate','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Sequelize','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','voicePause','interface','isValidChannel','capitalize','toLowerCase','Queues','penalty','spread','voice','VoiceQueue','online','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','channel','Unknown\x20channel','remove','isArray','QueueId','Queue:remove','addAvatar','userpic','file','filename','getAvatar','root','download','existsSync','server/files/images/','join','getOpenTabs','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WHATSAPP','User\x20with\x20id\x20%s\x20not\x20found','includeAll','CmList','List','Tag','Tags','color','tag','getQueues','model','keys','rawAttributes','filters','intersection','sort','options','Queue','Unknown\x20role','nolimit','getVoiceQueuesRt','fields','order','pick','hasOwnProperty','getGroups','ChatGroup','VoiceRecording','UserId','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','WhatsappInteraction','login','phone','mobile','loginInPause','intrf','user:%s','headers','x-forwarded-for','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','MemberReport','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','concat','resolve','logout','pause','type','DEFAULT\x20PAUSE','mailPause','faxPause','smsPause','whatsappPause','pauseType','unpause','getTeams','Team','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','flattenDeep','addAgent','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getDataValue','Queue:save','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','getLists','getVoiceQueues','values','CmHopper','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts'];(function(_0x1fc1fe,_0x540174){var _0x3af644=function(_0x55bfc0){while(--_0x55bfc0){_0x1fc1fe['push'](_0x1fc1fe['shift']());}};_0x3af644(++_0x540174);}(_0x41aa,0x1d6));var _0xa41a=function(_0x251d9c,_0x580977){_0x251d9c=_0x251d9c-0x0;var _0x16ae64=_0x41aa[_0x251d9c];return _0x16ae64;};'use strict';var moment=require(_0xa41a('0x0'));var util=require('util');var path=require(_0xa41a('0x1'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var Redis=require('ioredis');var jayson=require(_0xa41a('0x2'));var authService=require(_0xa41a('0x3'));var contacts=require('../../components/contacts');var qs=require(_0xa41a('0x4'));var rta=require(_0xa41a('0x5'));var logger=require(_0xa41a('0x6'))(_0xa41a('0x7'));var utils=require(_0xa41a('0x8'));var config=require(_0xa41a('0x9'));var licenseUtil=require(_0xa41a('0xa'));var APIBadRequestError=require(_0xa41a('0xb'))['APIBadRequestError'];var APINotFoundError=require(_0xa41a('0xb'))[_0xa41a('0xc')];var APIForbiddenError=require('../../errors/api')['APIForbiddenrror'];var APIHandleError=require(_0xa41a('0xb'))[_0xa41a('0xd')];var db=require(_0xa41a('0xe'))['db'];var socket=require(_0xa41a('0xf'))(new Redis(config[_0xa41a('0x10')]));require(_0xa41a('0x11'))[_0xa41a('0x12')](socket);config[_0xa41a('0x10')]=_['defaults'](config['redis'],{'host':_0xa41a('0x13'),'port':0x18eb});var amiClient=jayson[_0xa41a('0x14')][_0xa41a('0x15')]({'port':0x232a});var values;function respondWithStatusCode(_0x47a4cc,_0xaf5cfa){_0xaf5cfa=_0xaf5cfa||0xcc;return function(_0x2e3a62){if(_0x2e3a62){return _0x47a4cc[_0xa41a('0x16')](_0xaf5cfa);}return _0x47a4cc[_0xa41a('0x17')](_0xaf5cfa)['end']();};}function respondWithResult(_0x524316,_0x39ca46){_0x39ca46=_0x39ca46||0xc8;return function(_0x30add6){if(_0x30add6){return _0x524316[_0xa41a('0x17')](_0x39ca46)[_0xa41a('0x18')](_0x30add6);}};}function respondWithFilteredResult(_0x1c9067,_0x15e840){return function(_0x287d62){if(_0x287d62){var _0x2bb361=typeof _0x15e840['offset']==='undefined'&&typeof _0x15e840['limit']===_0xa41a('0x19');var _0x112b01=_0x287d62[_0xa41a('0x1a')];var _0x577cd6=_0x2bb361?0x0:_0x15e840[_0xa41a('0x1b')];var _0xd844df=_0x2bb361?_0x287d62['count']:_0x15e840[_0xa41a('0x1b')]+_0x15e840[_0xa41a('0x1c')];var _0x7c404f;if(_0xd844df>=_0x112b01){_0xd844df=_0x112b01;_0x7c404f=0xc8;}else{_0x7c404f=0xce;}_0x1c9067[_0xa41a('0x17')](_0x7c404f);return _0x1c9067['set'](_0xa41a('0x1d'),_0x577cd6+'-'+_0xd844df+'/'+_0x112b01)[_0xa41a('0x18')](_0x287d62);}return null;};}function respondWithRpcPromise(_0xa0ab8c,_0xb9eebf,_0x5025c3,_0x4db65e){return new Promise(function(_0x3a26f9,_0x36c5ed){var _0x255b6e=_0x4db65e||amiClient;return _0x255b6e['request'](_0xa0ab8c,_0x5025c3)['then'](function(_0x43766b){logger[_0xa41a('0x1e')](_0xa41a('0x1f'),_0xb9eebf,_0xa41a('0x20'));logger[_0xa41a('0x21')]('User,\x20%s,\x20%s,\x20%s',_0xb9eebf,_0xa41a('0x20'),JSON[_0xa41a('0x22')](_0x43766b));if(_0x43766b[_0xa41a('0x23')]){if(_0x43766b['error']['code']===0x1f4){logger[_0xa41a('0x23')](_0xa41a('0x1f'),_0xb9eebf,_0x43766b[_0xa41a('0x23')]['message']);return _0x36c5ed(_0x43766b[_0xa41a('0x23')][_0xa41a('0x24')]);}logger[_0xa41a('0x23')]('User,\x20%s,\x20%s',_0xb9eebf,_0x43766b[_0xa41a('0x23')][_0xa41a('0x24')]);return _0x3a26f9(_0x43766b[_0xa41a('0x23')][_0xa41a('0x24')]);}else{logger[_0xa41a('0x1e')]('User,\x20%s,\x20%s',_0xb9eebf,_0xa41a('0x20'));_0x3a26f9(_0x43766b[_0xa41a('0x25')][_0xa41a('0x24')]);}})['catch'](function(_0x3e69ce){logger[_0xa41a('0x23')](_0xa41a('0x1f'),_0xb9eebf,_0x3e69ce);_0x36c5ed(_0x3e69ce);});});}function saveUpdates(_0x3e5bce){return function(_0x3f99b0){if(_0x3f99b0){return _0x3f99b0[_0xa41a('0x26')](_0x3e5bce)[_0xa41a('0x27')](function(_0x3d9563){if(_0x3d9563[_0xa41a('0x28')]===_0xa41a('0x29')){socket[_0xa41a('0x2a')]('userNotification:recalc:'+_0x3d9563['id'],_0x3d9563);}return _0x3d9563;});}return null;};}function removeEntity(_0x3e4578,_0x2a8226){return function(_0x2bf9f1){if(_0x2bf9f1){return _0x2bf9f1[_0xa41a('0x2b')]({'transaction':_0x2a8226})[_0xa41a('0x27')](function(){var _0x461f53=_0x2bf9f1[_0xa41a('0x2c')]({'plain':!![]});if(_0x461f53[_0xa41a('0x28')]===_0xa41a('0x2d'))return;var _0x474b04=[{'name':_0xa41a('0x2e'),'value':_0xa41a('0x2f'),'ignore':!![]},{'name':'Agents','value':_0xa41a('0x29'),'ignore':![]},{'name':_0xa41a('0x30'),'value':_0xa41a('0x31'),'ignore':![]}];var _0x4f1cb5=_(_0x474b04)[_0xa41a('0x32')](_0xa41a('0x33'))[_0xa41a('0x34')](_0xa41a('0x35'))['value']();if(_[_0xa41a('0x36')](_0x4f1cb5,_0x461f53['role'])){return;}var _0x37c734=_[_0xa41a('0x37')](_0x474b04,['value',_0x461f53[_0xa41a('0x28')]])[_0xa41a('0x38')];return db[_0xa41a('0x39')][_0xa41a('0x2b')]({'where':{'type':_0x37c734,'resourceId':_0x461f53['id']},'transaction':_0x2a8226})[_0xa41a('0x27')](function(){return _0x2bf9f1;});})['then'](function(){_0x3e4578['status'](0xcc)[_0xa41a('0x3a')]();});}};}function handleEntityNotFound(_0x48f8f1){return function(_0x52aa1d){if(!_0x52aa1d){_0x48f8f1[_0xa41a('0x16')](0x194);}return _0x52aa1d;};}function handleError(_0x37386e,_0x5d0b85){_0x5d0b85=_0x5d0b85||0x1f4;return function(_0x5ad663){logger['error'](_0x5ad663[_0xa41a('0x3b')]);if(_0x5ad663['name']){delete _0x5ad663['name'];}_0x37386e[_0xa41a('0x17')](_0x5d0b85)[_0xa41a('0x3c')](_0x5ad663);};}function getUserAttributes(){return _(db[_0xa41a('0x3d')]['rawAttributes'])[_0xa41a('0x34')](function(_0x25e1ba){return{'name':_0x25e1ba[_0xa41a('0x3e')],'type':_0x25e1ba['type'][_0xa41a('0x3f')]};})['filter'](function(_0x18659b){return![_0xa41a('0x40'),_0xa41a('0x41'),_0xa41a('0x42'),_0xa41a('0x43'),_0xa41a('0x44'),_0xa41a('0x45')][_0xa41a('0x36')](_0x18659b[_0xa41a('0x38')]);})['value']();}exports['index']=function(_0x100c56,_0x4760b2){var _0x47617c={},_0x34da9b={'count':0x0,'rows':[]};var _0x5d2cef=getUserAttributes();_0x47617c=qs[_0xa41a('0x46')](_0x5d2cef,_0x100c56);var _0x578c6a={'where':_0x47617c[_0xa41a('0x47')]};return db[_0xa41a('0x3d')][_0xa41a('0x1a')](_0x578c6a)[_0xa41a('0x27')](function(_0x169246){_0x34da9b['count']=_0x169246;if(_0x100c56[_0xa41a('0x48')]['includeAll']){_0x47617c[_0xa41a('0x49')]=[{'all':!![]}];}if(_0x100c56[_0xa41a('0x48')]['userSetting']==='true'){_0x47617c[_0xa41a('0x49')]=[{'model':db[_0xa41a('0x4a')],'as':_0xa41a('0x4b')}];}if(!_[_0xa41a('0x36')](_0x47617c['attributes'],'id')){_0x47617c[_0xa41a('0x4c')][_0xa41a('0x4d')]('id');}return db[_0xa41a('0x3d')][_0xa41a('0x4e')](_0x47617c);})[_0xa41a('0x27')](function(_0x243677){_0x34da9b[_0xa41a('0x4f')]=_0x243677;if(_0x100c56['query'][_0xa41a('0x50')]===_0xa41a('0x51')){var _0x96feb5=[];for(var _0x5d13e7=0x0;_0x5d13e7<_0x34da9b[_0xa41a('0x4f')][_0xa41a('0x52')];_0x5d13e7++){_0x96feb5['push'](get_open_tabs(_0xa41a('0x53'),_0x34da9b['rows'][_0x5d13e7][_0xa41a('0x54')]));_0x96feb5[_0xa41a('0x4d')](get_open_tabs(_0xa41a('0x55'),_0x34da9b[_0xa41a('0x4f')][_0x5d13e7]['dataValues']));_0x96feb5[_0xa41a('0x4d')](get_open_tabs('fax',_0x34da9b[_0xa41a('0x4f')][_0x5d13e7][_0xa41a('0x54')]));_0x96feb5[_0xa41a('0x4d')](get_open_tabs(_0xa41a('0x56'),_0x34da9b[_0xa41a('0x4f')][_0x5d13e7]['dataValues']));_0x96feb5[_0xa41a('0x4d')](get_open_tabs('openchannel',_0x34da9b[_0xa41a('0x4f')][_0x5d13e7][_0xa41a('0x54')]));_0x96feb5[_0xa41a('0x4d')](get_open_tabs(_0xa41a('0x57'),_0x34da9b['rows'][_0x5d13e7][_0xa41a('0x54')]));}return Promise[_0xa41a('0x58')](_0x96feb5)[_0xa41a('0x27')](function(){return _0x34da9b;});}else{return _0x34da9b;}})['then'](respondWithFilteredResult(_0x4760b2,_0x47617c))['catch'](handleError(_0x4760b2,null));};exports['show']=function(_0x1b89b5,_0x3d7b83){var _0x5a4c85=getUserAttributes();_0x1b89b5[_0xa41a('0x48')]['id']=_0x1b89b5[_0xa41a('0x59')]['id'];var _0x27197f=qs[_0xa41a('0x46')](_0x5a4c85,_0x1b89b5);if(_0x1b89b5['query']['includeAll']){_0x27197f[_0xa41a('0x49')]=[{'all':!![]}];}if(_0x1b89b5[_0xa41a('0x48')][_0xa41a('0x4b')]===_0xa41a('0x51')){_0x27197f[_0xa41a('0x49')]=[{'model':db[_0xa41a('0x4a')],'as':_0xa41a('0x4b')}];}_0x27197f=_[_0xa41a('0x5a')]({},_0x27197f,_0x1b89b5['options']);if(!_[_0xa41a('0x36')](_0x27197f[_0xa41a('0x4c')],'id')){_0x27197f[_0xa41a('0x4c')][_0xa41a('0x4d')]('id');}return db[_0xa41a('0x3d')][_0xa41a('0x37')](_0x27197f)[_0xa41a('0x27')](handleEntityNotFound(_0x3d7b83,null))['then'](function(_0x57d4ff){var _0xc2f2cd=[];values=_0x57d4ff;if(_0x1b89b5[_0xa41a('0x48')][_0xa41a('0x50')]===_0xa41a('0x51')){_0xc2f2cd[_0xa41a('0x4d')](get_open_tabs('chat',_0x57d4ff[_0xa41a('0x54')]));_0xc2f2cd[_0xa41a('0x4d')](get_open_tabs('sms',_0x57d4ff[_0xa41a('0x54')]));_0xc2f2cd[_0xa41a('0x4d')](get_open_tabs(_0xa41a('0x5b'),_0x57d4ff[_0xa41a('0x54')]));_0xc2f2cd['push'](get_open_tabs(_0xa41a('0x57'),_0x57d4ff[_0xa41a('0x54')]));_0xc2f2cd['push'](get_open_tabs(_0xa41a('0x5c'),_0x57d4ff[_0xa41a('0x54')]));_0xc2f2cd['push'](get_open_tabs(_0xa41a('0x56'),_0x57d4ff[_0xa41a('0x54')]));return Promise[_0xa41a('0x58')](_0xc2f2cd);}else{return values;}})[_0xa41a('0x27')](function(){return values;})['then'](respondWithResult(_0x3d7b83,null))[_0xa41a('0x5d')](handleError(_0x3d7b83,null));};exports[_0xa41a('0x26')]=function(_0x209f15,_0x3b0a28){if(_0x209f15[_0xa41a('0x5e')]['id']){delete _0x209f15[_0xa41a('0x5e')]['id'];}delete _0x209f15[_0xa41a('0x5e')][_0xa41a('0x28')];return db['User'][_0xa41a('0x37')]({'where':{'id':_0x209f15[_0xa41a('0x59')]['id']}})[_0xa41a('0x27')](handleEntityNotFound(_0x3b0a28,null))['then'](saveUpdates(_0x209f15['body'],null))[_0xa41a('0x27')](respondWithResult(_0x3b0a28,null))['catch'](handleError(_0x3b0a28,null));};exports[_0xa41a('0x5f')]=function(_0x473d54,_0xc68bb9){return db[_0xa41a('0x3d')]['describe']()[_0xa41a('0x27')](respondWithResult(_0xc68bb9,null))[_0xa41a('0x5d')](handleError(_0xc68bb9,null));};exports[_0xa41a('0x60')]=function(_0x500f5a,_0x4fd695){return db[_0xa41a('0x3d')]['find']({'where':{'id':_0x500f5a['params']['id']}})['then'](handleEntityNotFound(_0x4fd695,null))['then'](function(_0x2bdd5d){if(_0x2bdd5d){return _0x2bdd5d['addContacts'](_0x500f5a[_0xa41a('0x5e')][_0xa41a('0x61')],_[_0xa41a('0x62')](_0x500f5a[_0xa41a('0x5e')],[_0xa41a('0x61'),'id'])||{});}})[_0xa41a('0x27')](respondWithResult(_0x4fd695,null))['catch'](handleError(_0x4fd695,null));};function validateUser(_0x489e8b){return new Promise(function(_0x2e530c,_0x244e65){if(_0x489e8b[_0xa41a('0x63')])return _0x2e530c(_0x489e8b);return db['Setting']['findById'](0x1)[_0xa41a('0x27')](function(_0xb97530){if(_0xb97530['securePassword'])authService[_0xa41a('0x64')](_0x489e8b[_0xa41a('0x40')]);db[_0xa41a('0x3d')][_0xa41a('0x65')](_0xa41a('0x63'))[_0xa41a('0x27')](function(_0x36e6ae){if(_[_0xa41a('0x66')](_0x36e6ae)){_0x489e8b[_0xa41a('0x63')]=_0xb97530[_0xa41a('0x67')]||0x1;return;}if(_[_0xa41a('0x66')](_0xb97530[_0xa41a('0x67')])||_0xb97530[_0xa41a('0x67')]===_0x36e6ae){_0x489e8b[_0xa41a('0x63')]=_0x36e6ae+0x1;return;}if(_0xb97530[_0xa41a('0x67')]>_0x36e6ae){_0x489e8b['internal']=_0xb97530[_0xa41a('0x67')];return;}return db[_0xa41a('0x68')][_0xa41a('0x48')](_0xa41a('0x69'),{'type':db[_0xa41a('0x68')][_0xa41a('0x6a')][_0xa41a('0x6b')]})['then'](function(_0x5bfcf0){if(_0x5bfcf0&&_0x5bfcf0[_0xa41a('0x52')]){for(var _0x5afc40=0x0,_0x4cf0d7=_0x5bfcf0[_0xa41a('0x52')];_0x5afc40<_0x4cf0d7&&_[_0xa41a('0x66')](_0x489e8b[_0xa41a('0x63')]);_0x5afc40++){if(_0xb97530['min_internal']<=_0x5bfcf0[_0x5afc40]['from']){_0x489e8b[_0xa41a('0x63')]=_0x5bfcf0[_0x5afc40][_0xa41a('0x6c')];}else if(_0xb97530[_0xa41a('0x67')]>_0x5bfcf0[_0x5afc40][_0xa41a('0x6c')]&&_0xb97530[_0xa41a('0x67')]<=_0x5bfcf0[_0x5afc40]['to']){_0x489e8b[_0xa41a('0x63')]=_0xb97530[_0xa41a('0x67')];}}}if(_['isNil'](_0x489e8b[_0xa41a('0x63')])){_0x489e8b[_0xa41a('0x63')]=_0x36e6ae+0x1;}return _0x2e530c(_0x489e8b);});});})[_0xa41a('0x5d')](function(_0x379f6e){_0x244e65(_0x379f6e);});});}function updateUser(_0x28def2){return new Promise(function(_0x14ea14,_0x17a0c6){try{if(_0x28def2[_0xa41a('0x6d')]){_0x28def2[_0xa41a('0x6e')]=_0x28def2[_0xa41a('0x63')];_0x28def2[_0xa41a('0x6f')]={'mailbox':_0x28def2[_0xa41a('0x63')],'password':_0x28def2[_0xa41a('0x40')],'fullname':_0x28def2['fullname'],'email':_0x28def2[_0xa41a('0x70')]};}if(_0x28def2['role']===_0xa41a('0x29')){if(!_0x28def2[_0xa41a('0x71')])_0x28def2[_0xa41a('0x71')]=[_0xa41a('0x72'),_0xa41a('0x73'),_0xa41a('0x74'),'113',_0xa41a('0x75'),_0xa41a('0x76'),_0xa41a('0x77'),_0xa41a('0x78'),_0xa41a('0x79'),_0xa41a('0x7a'),_0xa41a('0x7b'),_0xa41a('0x7c'),'111',_0xa41a('0x7d'),_0xa41a('0x7e')];}_0x14ea14(_0x28def2);}catch(_0x47d71e){_0x17a0c6(_0x47d71e);}});}exports[_0xa41a('0x7f')]=function(_0x29d06a,_0x1deeb9){if(_0x29d06a[_0xa41a('0x2f')][_0xa41a('0x28')]==='agent')throw new Error(_0xa41a('0x80'));if(_0x29d06a['body'][_0xa41a('0x28')]===_0xa41a('0x2f')&&_0x29d06a['user']['role']!==_0xa41a('0x2d')){throw new Error(_0xa41a('0x81'));}if(_0x29d06a[_0xa41a('0x5e')][_0xa41a('0x28')]===_0xa41a('0x2d')&&_0x29d06a[_0xa41a('0x2f')][_0xa41a('0x28')]!=='admin'){throw new Error(_0xa41a('0x82'));}return licenseUtil[_0xa41a('0x83')]([_0x29d06a[_0xa41a('0x5e')]])[_0xa41a('0x27')](function(){return validateUser(_0x29d06a['body']);})[_0xa41a('0x27')](function(_0x3f0ce2){return updateUser(_0x3f0ce2)[_0xa41a('0x27')](function(_0x274a6b){if(_0x274a6b['role']===_0xa41a('0x2d')){_0x274a6b[_0xa41a('0x84')]=_0x29d06a['user'][_0xa41a('0x84')];delete _0x274a6b['userProfileId'];}return _0x274a6b;});})[_0xa41a('0x27')](function(_0xba1bb8){return db['User'][_0xa41a('0x7f')](_0xba1bb8,{'include':[{'model':db[_0xa41a('0x6f')],'as':_0xa41a('0x6f')}]});})[_0xa41a('0x27')](function(_0x34c353){if(_0x29d06a[_0xa41a('0x5e')]['role']===_0xa41a('0x2f'))return _0x34c353;if(_0x29d06a[_0xa41a('0x2f')][_0xa41a('0x28')]!=='user')return _0x34c353;return db[_0xa41a('0x85')][_0xa41a('0x37')]({'where':{'name':_0x34c353['role']===_0xa41a('0x29')?_0xa41a('0x86'):_0xa41a('0x30'),'userProfileId':_0x29d06a[_0xa41a('0x2f')][_0xa41a('0x87')]},'raw':!![]})[_0xa41a('0x27')](function(_0x4be9d7){if(!_0x4be9d7||_0x4be9d7[_0xa41a('0x88')]!=0x0)return _0x34c353;return db[_0xa41a('0x39')][_0xa41a('0x7f')]({'name':_0x34c353[_0xa41a('0x38')],'resourceId':_0x34c353['id'],'type':_0x4be9d7['name'],'sectionId':_0x4be9d7['id']},{})['then'](function(){return _0x34c353;});})['catch'](function(_0x1203f2){logger[_0xa41a('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1203f2);throw _0x1203f2;});})[_0xa41a('0x27')](respondWithResult(_0x1deeb9,0xc9))[_0xa41a('0x5d')](handleError(_0x1deeb9,null));};exports[_0xa41a('0x89')]=function(_0xad804a,_0x4c4f01){var _0x582d4a=_0xad804a[_0xa41a('0x5e')];var _0x3786a7=[];if(_0xad804a[_0xa41a('0x2f')][_0xa41a('0x28')]===_0xa41a('0x29'))throw new Error(_0xa41a('0x80'));if(_[_0xa41a('0x8a')](_0x582d4a,['role',_0xa41a('0x2f')])&&_0xad804a['user'][_0xa41a('0x28')]!=='admin'){throw new Error(_0xa41a('0x81'));}if(_[_0xa41a('0x8a')](_0x582d4a,['role','admin'])&&_0xad804a[_0xa41a('0x2f')][_0xa41a('0x28')]!==_0xa41a('0x2d')){throw new Error(_0xa41a('0x8b'));}return licenseUtil[_0xa41a('0x83')](_0x582d4a)[_0xa41a('0x27')](function(){return validateUser(_0x582d4a[0x0]);})[_0xa41a('0x27')](function(){for(var _0xa0a1af=0x1;_0xa0a1af<_0x582d4a['length'];_0xa0a1af++){var _0x36a62e=_0x582d4a[_0xa0a1af-0x1][_0xa41a('0x63')];if(!_0x582d4a[_0xa0a1af][_0xa41a('0x63')])_0x582d4a[_0xa0a1af][_0xa41a('0x63')]=_0x36a62e+0x1;_0x3786a7['push'](validateUser(_0x582d4a[_0xa0a1af]));}return Promise[_0xa41a('0x58')](_0x3786a7);})[_0xa41a('0x27')](function(){_0x3786a7=[];for(var _0x20f0ed=0x0;_0x20f0ed<_0x582d4a[_0xa41a('0x52')];_0x20f0ed++){_0x3786a7[_0xa41a('0x4d')](updateUser(_0x582d4a[_0x20f0ed]));}return Promise[_0xa41a('0x58')](_0x3786a7);})['then'](function(){_0x3786a7=_0x582d4a[_0xa41a('0x34')](function(_0x17f57b){return db[_0xa41a('0x3d')]['create'](_0x17f57b,{'include':[{'model':db[_0xa41a('0x6f')],'as':'VoiceMail'}]})[_0xa41a('0x27')](function(_0x1ce25c){_0x17f57b['id']=_0x1ce25c['id'];return _0x17f57b;});});return Promise[_0xa41a('0x58')](_0x3786a7);})[_0xa41a('0x27')](function(_0x501542){if(_0xad804a[_0xa41a('0x5e')][_0xa41a('0x28')]===_0xa41a('0x2f'))return _0x501542;if(_0xad804a['user']['role']!==_0xa41a('0x2f'))return _0x501542;var _0x42d487=_[_0xa41a('0x8a')](_0x501542,function(_0x1f1ef8){return _0x1f1ef8[_0xa41a('0x28')]===_0xa41a('0x29')||_0x1f1ef8['role']===_0xa41a('0x31');});if(!_0x42d487)return _0x501542;return db[_0xa41a('0x85')][_0xa41a('0x4e')]({'where':{'name':{'$or':[_0xa41a('0x86'),_0xa41a('0x30')]},'userProfileId':_0xad804a['user'][_0xa41a('0x87')]},'raw':!![]})[_0xa41a('0x27')](function(_0x55d7da){if(_[_0xa41a('0x8c')](_0x55d7da)||!_['some'](_0x55d7da,[_0xa41a('0x88'),0x0]))return _0x501542;_0x3786a7=[];var _0x30d898=_(_0x55d7da)['map'](function(_0x4051a5){if(_0x4051a5[_0xa41a('0x88')]===0x1)return;return _0x4051a5['name']===_0xa41a('0x86')?'agent':_0xa41a('0x31');})[_0xa41a('0x8d')]()[_0xa41a('0x35')]();for(var _0x5c6427=0x0;_0x5c6427<_0x501542['length'];_0x5c6427++){if(!_['includes'](_0x30d898,_0x501542[_0x5c6427]['role']))return;var _0x899bbf=_0x501542[_0x5c6427][_0xa41a('0x28')]===_0xa41a('0x29')?_0xa41a('0x86'):_0xa41a('0x30');_0x3786a7[_0xa41a('0x4d')](db['UserProfileResource'][_0xa41a('0x7f')]({'name':_0x501542[_0x5c6427][_0xa41a('0x38')],'resourceId':_0x501542[_0x5c6427]['id'],'type':_0x899bbf,'sectionId':_[_0xa41a('0x37')](_0x55d7da,[_0xa41a('0x38'),_0x899bbf])['id']},{}));}return Promise[_0xa41a('0x58')](_0x3786a7);});})['then'](respondWithResult(_0x4c4f01,0xc9))[_0xa41a('0x5d')](handleError(_0x4c4f01,null));};exports[_0xa41a('0x8e')]=function(_0x6213be,_0xf190f9){if(_0x6213be[_0xa41a('0x5e')]['id']){delete _0x6213be[_0xa41a('0x5e')]['id'];}return db[_0xa41a('0x3d')][_0xa41a('0x37')]({'where':{'id':_0x6213be[_0xa41a('0x59')]['id']}})[_0xa41a('0x27')](function(_0x3fe51a){if(!_0x3fe51a)return null;if(_0x3fe51a['id']===_0x6213be[_0xa41a('0x2f')]['id']){if(!_0x6213be[_0xa41a('0x5e')][_0xa41a('0x8f')]||!_0x6213be['body']['newPassword']){throw new db['Sequelize'][(_0xa41a('0x90'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x3fe51a[_0xa41a('0x91')](_0x6213be[_0xa41a('0x5e')]['oldPassword'])){throw new db['Sequelize'][(_0xa41a('0x90'))](_0xa41a('0x92'));}if(_0x6213be[_0xa41a('0x5e')][_0xa41a('0x8f')]===_0x6213be[_0xa41a('0x5e')][_0xa41a('0x93')]){throw new db['Sequelize'][(_0xa41a('0x90'))](_0xa41a('0x94'));}}else if(_0x6213be[_0xa41a('0x2f')][_0xa41a('0x28')]==='admin'){if(!_0x6213be[_0xa41a('0x5e')][_0xa41a('0x93')]){throw new db[(_0xa41a('0x95'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x6213be[_0xa41a('0x2f')][_0xa41a('0x28')]===_0xa41a('0x2f')){if(!_0x6213be[_0xa41a('0x5e')][_0xa41a('0x93')]){throw new db[(_0xa41a('0x95'))][(_0xa41a('0x90'))](_0xa41a('0x96'));}if(_0x3fe51a['role']!==_0xa41a('0x29')){throw new db[(_0xa41a('0x95'))]['ValidationError'](_0xa41a('0x80'));}}else{throw new db[(_0xa41a('0x95'))]['ValidationError'](_0xa41a('0x80'));}return _0x3fe51a;})[_0xa41a('0x27')](handleEntityNotFound(_0xf190f9,null))[_0xa41a('0x27')](function(_0x30a4ec){return db[_0xa41a('0x97')][_0xa41a('0x98')]({'attributes':['id',_0xa41a('0x99'),_0xa41a('0x9a'),_0xa41a('0x9b')]})[_0xa41a('0x27')](function(_0x6247f6){if(_0x6247f6[_0xa41a('0x99')])authService[_0xa41a('0x64')](_0x6213be['body']['newPassword']);if(!_0x6247f6[_0xa41a('0x9a')]||!_0x30a4ec[_0xa41a('0x42')])return _0x30a4ec;authService[_0xa41a('0x9c')](_0x6213be[_0xa41a('0x5e')][_0xa41a('0x93')],_0x30a4ec[_0xa41a('0x42')],_0x6247f6[_0xa41a('0x9b')]);return _0x30a4ec;})[_0xa41a('0x27')](saveUpdates({'password':_0x6213be[_0xa41a('0x5e')][_0xa41a('0x93')],'passwordResetAt':_0x6213be[_0xa41a('0x2f')]['id']==_0x6213be[_0xa41a('0x59')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x6213be['body']['newPassword'],_0x30a4ec['previousPasswords'])},null));})[_0xa41a('0x27')](respondWithResult(_0xf190f9,null))[_0xa41a('0x5d')](handleError(_0xf190f9,null));};exports['addQueues']=function(_0x8b310e,_0x30b76d){var _0x4138b9=_0x8b310e[_0xa41a('0x5e')]['channel'];return db[_0xa41a('0x3d')]['find']({'where':{'id':_0x8b310e[_0xa41a('0x59')]['id']},'attributes':['id',_0xa41a('0x38'),'role','online','loginInPause',_0xa41a('0x9d'),_0xa41a('0x9e')]})['then'](handleEntityNotFound(_0x30b76d,null))[_0xa41a('0x27')](function(_0x443c9b){if(_0x443c9b){if(!utils[_0xa41a('0x9f')](_0x4138b9)){throw new db['Sequelize'][(_0xa41a('0x90'))]('Unknown\x20channel');}return _0x443c9b['add'+_[_0xa41a('0xa0')](_0x4138b9[_0xa41a('0xa1')]())+_0xa41a('0xa2')](_0x8b310e[_0xa41a('0x5e')][_0xa41a('0x61')],{'penalty':_0x8b310e['body'][_0xa41a('0xa3')]||0x0})[_0xa41a('0xa4')](function(_0x5143cf){for(var _0xa83133=0x0;_0xa83133<_0x8b310e[_0xa41a('0x5e')]['ids'][_0xa41a('0x52')];_0xa83133+=0x1){var _0x42ca47={'UserId':Number(_0x8b310e[_0xa41a('0x59')]['id'])};_0x42ca47[_[_0xa41a('0xa0')](_0x4138b9['toLowerCase']())+'QueueId']=Number(_0x8b310e[_0xa41a('0x5e')][_0xa41a('0x61')][_0xa83133]);socket['emit'](_0xa41a('0x2f')+_[_0xa41a('0xa0')](_0x4138b9['toLowerCase']())+'Queue:save',_0x42ca47);}return _0x5143cf;})[_0xa41a('0x27')](function(){if(_0x4138b9===_0xa41a('0xa5')){return db[_0xa41a('0xa6')]['findAll']({'where':{'id':_0x8b310e[_0xa41a('0x5e')]['ids']||[]},'raw':!![],'attributes':['id',_0xa41a('0x38')]});}})[_0xa41a('0x27')](function(_0x1515ab){var _0x172d9d=_0x443c9b[_0xa41a('0x2c')]({'plain':!![]});var _0x488769=[];if(_0x4138b9===_0xa41a('0xa5')&&_0x172d9d[_0xa41a('0x28')]===_0xa41a('0x29')&&_0x172d9d[_0xa41a('0xa7')]){for(let _0x1b36ab=0x0;_0x1b36ab<_0x1515ab['length'];_0x1b36ab+=0x1){_0x488769[_0xa41a('0x4d')]({'membername':_0x172d9d[_0xa41a('0x38')],'UserId':_0x172d9d['id'],'queue_name':_0x1515ab[_0x1b36ab][_0xa41a('0x38')],'VoiceQueueId':_0x1515ab[_0x1b36ab]['id'],'interface':_[_0xa41a('0x66')](_0x172d9d[_0xa41a('0x9e')])?util[_0xa41a('0xa8')](_0xa41a('0xa9'),_0x172d9d['name']):_0x172d9d[_0xa41a('0x9e')],'paused':_0x172d9d[_0xa41a('0x9d')]||![],'penalty':_0x8b310e[_0xa41a('0x5e')][_0xa41a('0xa3')]||0x0});}return Promise[_0xa41a('0x58')](_0x488769[_0xa41a('0x34')](function(_0x1a5922){return db[_0xa41a('0xaa')][_0xa41a('0xab')](_0x1a5922);}));}return _0x443c9b;});}})[_0xa41a('0x27')](respondWithStatusCode(_0x30b76d,null))[_0xa41a('0x5d')](handleError(_0x30b76d,null));};exports[_0xa41a('0xac')]=function(_0x2a68ae,_0x460f69){var _0x2a52aa,_0x36cc05;return db[_0xa41a('0x3d')]['find']({'where':{'id':_0x2a68ae[_0xa41a('0x59')]['id']},'attributes':['id',_0xa41a('0x38'),'role']})['then'](handleEntityNotFound(_0x460f69,null))['then'](function(_0x21e3ec){if(_0x21e3ec){_0x2a52aa=_0x21e3ec;if(!_0x2a68ae[_0xa41a('0x48')][_0xa41a('0xad')]||!utils[_0xa41a('0x9f')](_0x2a68ae[_0xa41a('0x48')][_0xa41a('0xad')])){throw new db[(_0xa41a('0x95'))][(_0xa41a('0x90'))](_0xa41a('0xae'));}return _0x21e3ec[_0xa41a('0xaf')+_[_0xa41a('0xa0')](_0x2a68ae['query'][_0xa41a('0xad')][_0xa41a('0xa1')]())+_0xa41a('0xa2')](_0x2a68ae[_0xa41a('0x48')][_0xa41a('0x61')]);}})[_0xa41a('0x27')](function(_0x2690b){if(_[_0xa41a('0xb0')](_0x2a68ae['query'][_0xa41a('0x61')])){for(var _0x3fa68d=0x0;_0x3fa68d<_0x2a68ae[_0xa41a('0x48')]['ids']['length'];_0x3fa68d+=0x1){_0x36cc05={'UserId':Number(_0x2a68ae['params']['id'])};_0x36cc05[_[_0xa41a('0xa0')](_0x2a68ae[_0xa41a('0x48')]['channel']['toLowerCase']())+_0xa41a('0xb1')]=Number(_0x2a68ae['query'][_0xa41a('0x61')][_0x3fa68d]);socket[_0xa41a('0x2a')](_0xa41a('0x2f')+_[_0xa41a('0xa0')](_0x2a68ae[_0xa41a('0x48')][_0xa41a('0xad')][_0xa41a('0xa1')]())+_0xa41a('0xb2'),_0x36cc05);}}else{_0x36cc05={'UserId':Number(_0x2a68ae['params']['id'])};_0x36cc05[_[_0xa41a('0xa0')](_0x2a68ae[_0xa41a('0x48')][_0xa41a('0xad')][_0xa41a('0xa1')]())+_0xa41a('0xb1')]=Number(_0x2a68ae[_0xa41a('0x48')][_0xa41a('0x61')]);socket['emit'](_0xa41a('0x2f')+_['capitalize'](_0x2a68ae[_0xa41a('0x48')][_0xa41a('0xad')][_0xa41a('0xa1')]())+_0xa41a('0xb2'),_0x36cc05);}return _0x2690b;})[_0xa41a('0x27')](function(){if(_0x2a68ae[_0xa41a('0x48')][_0xa41a('0xad')]===_0xa41a('0xa5')){return db['UserVoiceQueueRt'][_0xa41a('0x2b')]({'where':{'UserId':_0x2a68ae[_0xa41a('0x59')]['id'],'VoiceQueueId':_0x2a68ae[_0xa41a('0x48')]['ids']},'individualHooks':!![]})['then'](function(){return _0x2a52aa;});}return _0x2a52aa;})[_0xa41a('0x27')](respondWithStatusCode(_0x460f69,null))['catch'](handleError(_0x460f69,null));};exports[_0xa41a('0xb3')]=function(_0x3a472b,_0x3100d6){_0x3a472b[_0xa41a('0x5e')][_0xa41a('0xb4')]=_0x3a472b[_0xa41a('0xb5')][_0xa41a('0xb6')];return db['User']['find']({'where':{'id':_0x3a472b[_0xa41a('0x59')]['id']}})[_0xa41a('0x27')](handleEntityNotFound(_0x3100d6,null))[_0xa41a('0x27')](saveUpdates(_0x3a472b[_0xa41a('0x5e')],null))[_0xa41a('0x27')](respondWithResult(_0x3100d6,null))[_0xa41a('0x5d')](handleError(_0x3100d6,null));};exports[_0xa41a('0xb7')]=function(_0x29b7b1,_0x5a3ff8){var _0x1f2564=path['join'](config[_0xa41a('0xb8')],'server/files/images/logos/default_profile.png');return db['User'][_0xa41a('0x37')]({'where':{'id':_0x29b7b1[_0xa41a('0x59')]['id']},'attributes':['id',_0xa41a('0xb4')],'raw':!![]})[_0xa41a('0x27')](handleEntityNotFound(_0x5a3ff8,null))['then'](function(_0x374bba){if(_0x374bba){if(_['isNil'](_0x374bba['userpic'])){return _0x5a3ff8[_0xa41a('0xb9')](_0x1f2564);}else{if(!fs[_0xa41a('0xba')](path['join'](config['root'],_0xa41a('0xbb'),_0x374bba[_0xa41a('0xb4')]))){return _0x5a3ff8[_0xa41a('0xb9')](_0x1f2564);}return _0x5a3ff8[_0xa41a('0xb9')](path[_0xa41a('0xbc')](config[_0xa41a('0xb8')],_0xa41a('0xbb'),_0x374bba[_0xa41a('0xb4')]));}}})[_0xa41a('0x5d')](handleError(_0x5a3ff8,null));};exports[_0xa41a('0xbd')]=function(_0x333623,_0x360737){return db[_0xa41a('0x3d')]['find']({'where':{'id':_0x333623[_0xa41a('0x59')]['id']},'attributes':['id']})[_0xa41a('0x27')](handleEntityNotFound(_0x360737,null))['then'](function(_0x314d60){var _0x65bc0=[];values=_0x314d60[_0xa41a('0x54')];_0x65bc0[_0xa41a('0x4d')](get_open_tabs('chat',_0x314d60[_0xa41a('0x54')]));_0x65bc0[_0xa41a('0x4d')](get_open_tabs(_0xa41a('0x55'),_0x314d60['dataValues']));_0x65bc0[_0xa41a('0x4d')](get_open_tabs('openchannel',_0x314d60[_0xa41a('0x54')]));_0x65bc0[_0xa41a('0x4d')](get_open_tabs(_0xa41a('0x57'),_0x314d60[_0xa41a('0x54')]));_0x65bc0[_0xa41a('0x4d')](get_open_tabs('fax',_0x314d60[_0xa41a('0x54')]));_0x65bc0['push'](get_open_tabs('mail',_0x314d60[_0xa41a('0x54')]));return Promise[_0xa41a('0x58')](_0x65bc0);})[_0xa41a('0x27')](function(_0x7353a7){if(_0x7353a7){var _0x26cd73=_['map'](values['ChatOpenTabs'],function(_0x117621){return{'channel':'CHAT','id':_0x117621['id'],'createdAt':_0x117621['createdAt']};});var _0x4c3bbf=_['map'](values[_0xa41a('0xbe')],function(_0x4bb87c){return{'channel':_0xa41a('0xbf'),'id':_0x4bb87c['id'],'createdAt':_0x4bb87c[_0xa41a('0xc0')]};});var _0x4c9e01=_[_0xa41a('0x34')](values[_0xa41a('0xc1')],function(_0x3aa2b8){return{'channel':_0xa41a('0xc2'),'id':_0x3aa2b8['id'],'createdAt':_0x3aa2b8['createdAt']};});var _0x4e8366=_[_0xa41a('0x34')](values[_0xa41a('0xc3')],function(_0x53dc98){return{'channel':_0xa41a('0xc4'),'id':_0x53dc98['id'],'createdAt':_0x53dc98[_0xa41a('0xc0')]};});var _0x733b03=_['map'](values[_0xa41a('0xc5')],function(_0x551168){return{'channel':_0xa41a('0xc6'),'id':_0x551168['id'],'createdAt':_0x551168[_0xa41a('0xc0')]};});var _0x3fefd5=_['map'](values['WhatsappOpenTabs'],function(_0x2e9163){return{'channel':_0xa41a('0xc7'),'id':_0x2e9163['id'],'createdAt':_0x2e9163[_0xa41a('0xc0')]};});var _0x5eac18=_['concat'](_0x26cd73,_0x4c3bbf,_0x4c9e01,_0x4e8366,_0x733b03,_0x3fefd5);var _0x1be431={'count':_0x5eac18[_0xa41a('0x52')],'rows':_0x5eac18};return _0x1be431;}else return null;})[_0xa41a('0x27')](respondWithResult(_0x360737,null))[_0xa41a('0x5d')](handleError(_0x360737,null));};exports['getContacts']=function(_0x2b84e4,_0x3a66dd){var _0x2b69bd={};return db[_0xa41a('0x3d')][_0xa41a('0x98')]({'where':{'id':_0x2b84e4[_0xa41a('0x59')]['id']}})[_0xa41a('0x27')](function(_0x47f720){if(!_0x47f720){throw new APINotFoundError(util[_0xa41a('0xa8')](_0xa41a('0xc8'),_0x2b84e4[_0xa41a('0x59')]['id']));}return contacts[_0xa41a('0x5f')]();})[_0xa41a('0x27')](function(_0x358961){_0x2b84e4[_0xa41a('0x48')]['User']=_0x2b84e4[_0xa41a('0x59')]['id'];_0x2b69bd=qs[_0xa41a('0x46')](_0x358961,_0x2b84e4);if(_0x2b84e4[_0xa41a('0x48')]['hasOwnProperty'](_0xa41a('0xc9'))){_0x2b69bd[_0xa41a('0x49')]=[{'model':db[_0xa41a('0xca')],'as':_0xa41a('0xcb'),'required':![]},{'model':db[_0xa41a('0xcc')],'as':_0xa41a('0xcd'),'attributes':['id',_0xa41a('0x38'),_0xa41a('0xce')],'where':_0x2b84e4['query']['tag']?{'id':_0x2b84e4[_0xa41a('0x48')]['tag']}:undefined,'required':_0x2b84e4[_0xa41a('0x48')][_0xa41a('0xcf')]?!![]:![]}];}return contacts['findAll'](_0x2b84e4[_0xa41a('0x48')],_0x2b84e4['user'],_0x2b69bd,_0x358961);})[_0xa41a('0x27')](respondWithFilteredResult(_0x3a66dd,_0x2b69bd))['catch'](APIHandleError(_0x3a66dd));};exports[_0xa41a('0xd0')]=function(_0x22b40e,_0x513229){var _0x2395f7;var _0x413bd8={};var _0x21dcd7;return db['User'][_0xa41a('0x98')]({'where':{'id':_0x22b40e[_0xa41a('0x59')]['id']},'attributes':['id',_0xa41a('0x38'),_0xa41a('0x28')]})[_0xa41a('0x27')](handleEntityNotFound(_0x513229,null))[_0xa41a('0x27')](function(_0x43e343){if(!utils[_0xa41a('0x9f')](_0x22b40e[_0xa41a('0x48')]['channel'])){throw new db[(_0xa41a('0x95'))][(_0xa41a('0x90'))](_0xa41a('0xae'));}_0x2395f7=_0x43e343;var _0x17cdf4={};_0x17cdf4[_0xa41a('0xd1')]=_[_0xa41a('0xd2')](db[_[_0xa41a('0xa0')](_0x22b40e['query'][_0xa41a('0xad')])+'Queue'][_0xa41a('0xd3')]);_0x17cdf4['query']=_[_0xa41a('0xd2')](_0x22b40e[_0xa41a('0x48')]);_0x17cdf4[_0xa41a('0xd4')]=_[_0xa41a('0xd5')](_0x17cdf4[_0xa41a('0xd1')],_0x17cdf4[_0xa41a('0x48')]);_0x413bd8[_0xa41a('0x4c')]=_[_0xa41a('0xd5')](_0x17cdf4['model'],qs['fields'](_0x22b40e[_0xa41a('0x48')]['fields']));_0x413bd8[_0xa41a('0x4c')]=_0x413bd8[_0xa41a('0x4c')][_0xa41a('0x52')]?_0x413bd8[_0xa41a('0x4c')]:_0x17cdf4[_0xa41a('0xd1')];_0x413bd8['order']=qs['sort'](_0x22b40e[_0xa41a('0x48')][_0xa41a('0xd6')]);_0x413bd8[_0xa41a('0x47')]=qs[_0xa41a('0xd4')](_['pick'](_0x22b40e[_0xa41a('0x48')],_0x17cdf4['filters']));if(_0x22b40e[_0xa41a('0x48')][_0xa41a('0x32')]){_0x413bd8['where']=_[_0xa41a('0x5a')](_0x413bd8[_0xa41a('0x47')],{'$or':_['map'](_0x413bd8[_0xa41a('0x4c')],function(_0x1752f1){var _0x4b3a0a={};_0x4b3a0a[_0x1752f1]={'$like':'%'+_0x22b40e['query']['filter']+'%'};return _0x4b3a0a;})});}_0x413bd8=_[_0xa41a('0x5a')]({},_0x413bd8,_0x22b40e[_0xa41a('0xd7')]);switch(_0x2395f7[_0xa41a('0x28')]){case _0xa41a('0x2d'):return db[_[_0xa41a('0xa0')](_0x22b40e['query'][_0xa41a('0xad')])+_0xa41a('0xd8')][_0xa41a('0x4e')](_0x413bd8);case _0xa41a('0x2f'):case _0xa41a('0x29'):return _0x2395f7[_0xa41a('0x2c')+_[_0xa41a('0xa0')](_0x22b40e['query'][_0xa41a('0xad')])+_0xa41a('0xa2')](_0x413bd8);default:throw new db[(_0xa41a('0x95'))][(_0xa41a('0x90'))](_0xa41a('0xd9'));}})[_0xa41a('0x27')](function(_0x4babab){_0x21dcd7=_0x4babab['length'];if(!_0x22b40e[_0xa41a('0x48')]['hasOwnProperty'](_0xa41a('0xda'))){_0x413bd8[_0xa41a('0x1c')]=qs[_0xa41a('0x1c')](_0x22b40e[_0xa41a('0x48')][_0xa41a('0x1c')]);_0x413bd8['offset']=qs[_0xa41a('0x1b')](_0x22b40e[_0xa41a('0x48')][_0xa41a('0x1b')]);}switch(_0x2395f7[_0xa41a('0x28')]){case _0xa41a('0x2d'):return db[_['capitalize'](_0x22b40e[_0xa41a('0x48')][_0xa41a('0xad')])+_0xa41a('0xd8')][_0xa41a('0x4e')](_0x413bd8);case _0xa41a('0x2f'):case _0xa41a('0x29'):return _0x2395f7[_0xa41a('0x2c')+_['capitalize'](_0x22b40e['query'][_0xa41a('0xad')])+'Queues'](_0x413bd8);}})[_0xa41a('0x27')](function(_0x4406e2){return{'count':_0x21dcd7,'rows':_0x4406e2};})[_0xa41a('0x27')](respondWithResult(_0x513229,null))[_0xa41a('0x5d')](handleError(_0x513229,null));};exports[_0xa41a('0xdb')]=function(_0x46a7b4,_0x3aac90){var _0x3f5410={};var _0xdb3713={};var _0x40d83a;var _0xfde287;return db[_0xa41a('0x3d')][_0xa41a('0x98')]({'where':{'id':_0x46a7b4[_0xa41a('0x59')]['id']}})[_0xa41a('0x27')](handleEntityNotFound(_0x3aac90,null))['then'](function(_0x10216a){if(_0x10216a){_0x40d83a=_0x10216a;_0xdb3713['model']=_['keys'](db[_0xa41a('0xaa')][_0xa41a('0xd3')]);_0xdb3713[_0xa41a('0x48')]=_[_0xa41a('0xd2')](_0x46a7b4['query']);_0xdb3713[_0xa41a('0xd4')]=_['intersection'](_0xdb3713[_0xa41a('0xd1')],_0xdb3713['query']);_0x3f5410[_0xa41a('0x4c')]=_[_0xa41a('0xd5')](_0xdb3713[_0xa41a('0xd1')],qs[_0xa41a('0xdc')](_0x46a7b4[_0xa41a('0x48')][_0xa41a('0xdc')]));_0x3f5410[_0xa41a('0x4c')]=_0x3f5410[_0xa41a('0x4c')][_0xa41a('0x52')]?_0x3f5410[_0xa41a('0x4c')]:_0xdb3713[_0xa41a('0xd1')];_0x3f5410[_0xa41a('0xdd')]=qs[_0xa41a('0xd6')](_0x46a7b4['query']['sort']);_0x3f5410[_0xa41a('0x47')]=qs[_0xa41a('0xd4')](_[_0xa41a('0xde')](_0x46a7b4[_0xa41a('0x48')],_0xdb3713[_0xa41a('0xd4')]));if(_0x46a7b4[_0xa41a('0x48')]['filter']){_0x3f5410[_0xa41a('0x47')]=_[_0xa41a('0x5a')](_0x3f5410[_0xa41a('0x47')],{'$or':_['map'](_0x3f5410['attributes'],function(_0x4a87d){var _0x53b8ef={};_0x53b8ef[_0x4a87d]={'$like':'%'+_0x46a7b4[_0xa41a('0x48')][_0xa41a('0x32')]+'%'};return _0x53b8ef;})});}_0x3f5410=_[_0xa41a('0x5a')]({},_0x3f5410,_0x46a7b4[_0xa41a('0xd7')]);return _0x40d83a[_0xa41a('0xdb')](_0x3f5410);}})[_0xa41a('0x27')](function(_0xf4fd28){if(_0xf4fd28){_0xfde287=_0xf4fd28[_0xa41a('0x52')];if(!_0x46a7b4['query'][_0xa41a('0xdf')](_0xa41a('0xda'))){_0x3f5410[_0xa41a('0x1c')]=qs[_0xa41a('0x1c')](_0x46a7b4[_0xa41a('0x48')][_0xa41a('0x1c')]);_0x3f5410[_0xa41a('0x1b')]=qs[_0xa41a('0x1b')](_0x46a7b4['query'][_0xa41a('0x1b')]);}return _0x40d83a[_0xa41a('0xdb')](_0x3f5410);}})[_0xa41a('0x27')](function(_0x5bb044){if(_0x5bb044){return _0x5bb044?{'count':_0xfde287,'rows':_0x5bb044}:null;}})[_0xa41a('0x27')](respondWithResult(_0x3aac90,null))[_0xa41a('0x5d')](handleError(_0x3aac90,null));};exports[_0xa41a('0xe0')]=function(_0x3583e6,_0x2eb9c4){var _0x5c0c48={};var _0x51d16f={};var _0x22fa98;var _0x217a3a;return db[_0xa41a('0x3d')][_0xa41a('0x98')]({'where':{'id':_0x3583e6[_0xa41a('0x59')]['id']}})[_0xa41a('0x27')](handleEntityNotFound(_0x2eb9c4,null))[_0xa41a('0x27')](function(_0x5725d7){if(_0x5725d7){_0x22fa98=_0x5725d7;_0x51d16f[_0xa41a('0xd1')]=_['keys'](db[_0xa41a('0xe1')][_0xa41a('0xd3')]);_0x51d16f['query']=_['keys'](_0x3583e6[_0xa41a('0x48')]);_0x51d16f[_0xa41a('0xd4')]=_['intersection'](_0x51d16f['model'],_0x51d16f[_0xa41a('0x48')]);_0x5c0c48[_0xa41a('0x4c')]=_[_0xa41a('0xd5')](_0x51d16f['model'],qs[_0xa41a('0xdc')](_0x3583e6[_0xa41a('0x48')]['fields']));_0x5c0c48[_0xa41a('0x4c')]=_0x5c0c48[_0xa41a('0x4c')]['length']?_0x5c0c48[_0xa41a('0x4c')]:_0x51d16f[_0xa41a('0xd1')];_0x5c0c48[_0xa41a('0xdd')]=qs[_0xa41a('0xd6')](_0x3583e6[_0xa41a('0x48')][_0xa41a('0xd6')]);_0x5c0c48[_0xa41a('0x47')]=qs[_0xa41a('0xd4')](_[_0xa41a('0xde')](_0x3583e6[_0xa41a('0x48')],_0x51d16f['filters']));if(_0x3583e6[_0xa41a('0x48')]['filter']){_0x5c0c48[_0xa41a('0x47')]=_[_0xa41a('0x5a')](_0x5c0c48[_0xa41a('0x47')],{'$or':_[_0xa41a('0x34')](_0x5c0c48[_0xa41a('0x4c')],function(_0x52ea42){var _0x451571={};_0x451571[_0x52ea42]={'$like':'%'+_0x3583e6[_0xa41a('0x48')][_0xa41a('0x32')]+'%'};return _0x451571;})});}_0x5c0c48=_[_0xa41a('0x5a')]({},_0x5c0c48,_0x3583e6[_0xa41a('0xd7')]);return _0x22fa98['getGroups'](_0x5c0c48);}})[_0xa41a('0x27')](function(_0x59d129){if(_0x59d129){_0x217a3a=_0x59d129[_0xa41a('0x52')];if(!_0x3583e6['query'][_0xa41a('0xdf')]('nolimit')){_0x5c0c48['limit']=qs[_0xa41a('0x1c')](_0x3583e6[_0xa41a('0x48')]['limit']);_0x5c0c48[_0xa41a('0x1b')]=qs['offset'](_0x3583e6[_0xa41a('0x48')]['offset']);}return _0x22fa98['getGroups'](_0x5c0c48);}})['then'](function(_0x446c74){if(_0x446c74){return _0x446c74?{'count':_0x217a3a,'rows':_0x446c74}:null;}})[_0xa41a('0x27')](respondWithResult(_0x2eb9c4,null))[_0xa41a('0x5d')](handleError(_0x2eb9c4,null));};exports['getRecordings']=function(_0x4b8cca,_0x31175d){var _0x4c293b={'raw':!![],'where':{}};var _0x1bf937={};var _0x3a93e5={'count':0x0,'rows':[]};return db[_0xa41a('0x3d')][_0xa41a('0x98')]({'where':{'id':_0x4b8cca[_0xa41a('0x59')]['id']}})[_0xa41a('0x27')](handleEntityNotFound(_0x31175d,null))[_0xa41a('0x27')](function(_0xeb6e7e){if(_0xeb6e7e){_0x1bf937['model']=_[_0xa41a('0xd2')](db[_0xa41a('0xe2')]['rawAttributes']);_0x1bf937[_0xa41a('0x48')]=_['keys'](_0x4b8cca[_0xa41a('0x48')]);_0x1bf937[_0xa41a('0xd4')]=_[_0xa41a('0xd5')](_0x1bf937['model'],_0x1bf937[_0xa41a('0x48')]);_0x4c293b['attributes']=_[_0xa41a('0xd5')](_0x1bf937['model'],qs[_0xa41a('0xdc')](_0x4b8cca[_0xa41a('0x48')][_0xa41a('0xdc')]));_0x4c293b[_0xa41a('0x4c')]=_0x4c293b[_0xa41a('0x4c')][_0xa41a('0x52')]?_0x4c293b[_0xa41a('0x4c')]:_0x1bf937[_0xa41a('0xd1')];if(!_0x4b8cca[_0xa41a('0x48')][_0xa41a('0xdf')](_0xa41a('0xda'))){_0x4c293b[_0xa41a('0x1c')]=qs[_0xa41a('0x1c')](_0x4b8cca[_0xa41a('0x48')][_0xa41a('0x1c')]);_0x4c293b[_0xa41a('0x1b')]=qs[_0xa41a('0x1b')](_0x4b8cca[_0xa41a('0x48')][_0xa41a('0x1b')]);}_0x4c293b['order']=qs[_0xa41a('0xd6')](_0x4b8cca['query'][_0xa41a('0xd6')]);_0x4c293b['where']=qs[_0xa41a('0xd4')](_[_0xa41a('0xde')](_0x4b8cca[_0xa41a('0x48')],_0x1bf937[_0xa41a('0xd4')]));_0x4c293b[_0xa41a('0x47')][_0xa41a('0xe3')]=_0xeb6e7e['id'];if(_0x4b8cca[_0xa41a('0x48')]['filter']){_0x4c293b['where']=_[_0xa41a('0x5a')](_0x4c293b[_0xa41a('0x47')],{'$or':_[_0xa41a('0x34')](_0x4c293b['attributes'],function(_0x337151){var _0x43e8e6={};_0x43e8e6[_0x337151]={'$like':'%'+_0x4b8cca[_0xa41a('0x48')][_0xa41a('0x32')]+'%'};return _0x43e8e6;})});}_0x4c293b=_[_0xa41a('0x5a')]({},_0x4c293b,_0x4b8cca[_0xa41a('0xd7')]);return db[_0xa41a('0xe2')][_0xa41a('0x1a')]({'where':_0x4c293b[_0xa41a('0x47')]})['then'](function(_0x16ba5b){_0x3a93e5[_0xa41a('0x1a')]=_0x16ba5b;if(_0x4b8cca[_0xa41a('0x48')][_0xa41a('0xc9')]){_0x4c293b['include']=[{'all':!![]}];}return db[_0xa41a('0xe2')][_0xa41a('0x4e')](_0x4c293b);})[_0xa41a('0x27')](function(_0x5c0389){_0x3a93e5[_0xa41a('0x4f')]=_0x5c0389;return _0x3a93e5;});}})[_0xa41a('0x27')](respondWithFilteredResult(_0x31175d,_0x4c293b))['catch'](handleError(_0x31175d,null));};exports['getScreenRecordings']=function(_0x3cb8f1,_0x5b41b1){var _0x2497a6={'raw':!![],'where':{}};var _0x81da6e={};var _0x574644={'count':0x0,'rows':[]};return db['User'][_0xa41a('0x98')]({'where':{'id':_0x3cb8f1[_0xa41a('0x59')]['id']}})[_0xa41a('0x27')](handleEntityNotFound(_0x5b41b1,null))[_0xa41a('0x27')](function(_0x5dd47e){if(_0x5dd47e){_0x81da6e[_0xa41a('0xd1')]=_[_0xa41a('0xd2')](db[_0xa41a('0xe4')][_0xa41a('0xd3')]);_0x81da6e[_0xa41a('0x48')]=_['keys'](_0x3cb8f1[_0xa41a('0x48')]);_0x81da6e[_0xa41a('0xd4')]=_[_0xa41a('0xd5')](_0x81da6e[_0xa41a('0xd1')],_0x81da6e[_0xa41a('0x48')]);_0x2497a6['attributes']=_[_0xa41a('0xd5')](_0x81da6e[_0xa41a('0xd1')],qs[_0xa41a('0xdc')](_0x3cb8f1['query'][_0xa41a('0xdc')]));_0x2497a6[_0xa41a('0x4c')]=_0x2497a6[_0xa41a('0x4c')][_0xa41a('0x52')]?_0x2497a6[_0xa41a('0x4c')]:_0x81da6e[_0xa41a('0xd1')];if(!_0x3cb8f1[_0xa41a('0x48')][_0xa41a('0xdf')](_0xa41a('0xda'))){_0x2497a6[_0xa41a('0x1c')]=qs[_0xa41a('0x1c')](_0x3cb8f1[_0xa41a('0x48')]['limit']);_0x2497a6[_0xa41a('0x1b')]=qs[_0xa41a('0x1b')](_0x3cb8f1[_0xa41a('0x48')][_0xa41a('0x1b')]);}_0x2497a6[_0xa41a('0xdd')]=qs[_0xa41a('0xd6')](_0x3cb8f1[_0xa41a('0x48')]['sort']);_0x2497a6['where']=qs[_0xa41a('0xd4')](_['pick'](_0x3cb8f1[_0xa41a('0x48')],_0x81da6e[_0xa41a('0xd4')]));_0x2497a6[_0xa41a('0x47')][_0xa41a('0xe3')]=_0x5dd47e['id'];if(_0x3cb8f1[_0xa41a('0x48')][_0xa41a('0x32')]){_0x2497a6[_0xa41a('0x47')]=_[_0xa41a('0x5a')](_0x2497a6['where'],{'$or':_[_0xa41a('0x34')](_0x2497a6[_0xa41a('0x4c')],function(_0x4c2cd1){var _0x13a3c7={};_0x13a3c7[_0x4c2cd1]={'$like':'%'+_0x3cb8f1[_0xa41a('0x48')][_0xa41a('0x32')]+'%'};return _0x13a3c7;})});}_0x2497a6=_['merge']({},_0x2497a6,_0x3cb8f1[_0xa41a('0xd7')]);return db[_0xa41a('0xe4')][_0xa41a('0x1a')]({'where':_0x2497a6[_0xa41a('0x47')]})[_0xa41a('0x27')](function(_0x424b78){_0x574644[_0xa41a('0x1a')]=_0x424b78;if(_0x3cb8f1['query'][_0xa41a('0xc9')]){_0x2497a6[_0xa41a('0x49')]=[{'all':!![]}];}return db[_0xa41a('0xe4')][_0xa41a('0x4e')](_0x2497a6);})[_0xa41a('0x27')](function(_0x31e8b2){_0x574644[_0xa41a('0x4f')]=_0x31e8b2;return _0x574644;});}})['then'](respondWithFilteredResult(_0x5b41b1,_0x2497a6))[_0xa41a('0x5d')](handleError(_0x5b41b1,null));};exports[_0xa41a('0xe5')]=function(_0x58ceec,_0x302b6e){var _0x37de64={};var _0x88b303={};var _0x2c1a62;var _0x131c74;return db[_0xa41a('0x3d')]['findOne']({'where':{'id':_0x58ceec[_0xa41a('0x59')]['id']}})[_0xa41a('0x27')](handleEntityNotFound(_0x302b6e,null))[_0xa41a('0x27')](function(_0x127e63){if(_0x127e63){_0x2c1a62=_0x127e63;_0x88b303[_0xa41a('0xd1')]=_[_0xa41a('0xd2')](db[_0xa41a('0xe6')]['rawAttributes']);_0x88b303[_0xa41a('0x48')]=_[_0xa41a('0xd2')](_0x58ceec[_0xa41a('0x48')]);_0x88b303['filters']=_['intersection'](_0x88b303[_0xa41a('0xd1')],_0x88b303[_0xa41a('0x48')]);_0x37de64[_0xa41a('0x4c')]=_[_0xa41a('0xd5')](_0x88b303['model'],qs[_0xa41a('0xdc')](_0x58ceec[_0xa41a('0x48')][_0xa41a('0xdc')]));_0x37de64[_0xa41a('0x4c')]=_0x37de64[_0xa41a('0x4c')]['length']?_0x37de64[_0xa41a('0x4c')]:_0x88b303[_0xa41a('0xd1')];_0x37de64[_0xa41a('0xdd')]=qs['sort'](_0x58ceec[_0xa41a('0x48')][_0xa41a('0xd6')]);_0x37de64['where']=qs['filters'](_['pick'](_0x58ceec[_0xa41a('0x48')],_0x88b303[_0xa41a('0xd4')]));if(_0x58ceec[_0xa41a('0x48')][_0xa41a('0x32')]){_0x37de64[_0xa41a('0x47')]=_[_0xa41a('0x5a')](_0x37de64[_0xa41a('0x47')],{'$or':_['map'](_0x37de64[_0xa41a('0x4c')],function(_0x306c7f){var _0x1a97fa={};_0x1a97fa[_0x306c7f]={'$like':'%'+_0x58ceec['query'][_0xa41a('0x32')]+'%'};return _0x1a97fa;})});}_0x37de64=_[_0xa41a('0x5a')]({},_0x37de64,_0x58ceec[_0xa41a('0xd7')]);return _0x2c1a62[_0xa41a('0xe5')](_0x37de64);}})['then'](function(_0x19b57c){if(_0x19b57c){_0x131c74=_0x19b57c[_0xa41a('0x52')];if(!_0x58ceec[_0xa41a('0x48')][_0xa41a('0xdf')](_0xa41a('0xda'))){_0x37de64[_0xa41a('0x1c')]=qs[_0xa41a('0x1c')](_0x58ceec['query']['limit']);_0x37de64[_0xa41a('0x1b')]=qs[_0xa41a('0x1b')](_0x58ceec['query'][_0xa41a('0x1b')]);}return _0x2c1a62[_0xa41a('0xe5')](_0x37de64);}})[_0xa41a('0x27')](function(_0xe7cfee){if(_0xe7cfee){return _0xe7cfee?{'count':_0x131c74,'rows':_0xe7cfee}:null;}})['then'](respondWithResult(_0x302b6e,null))[_0xa41a('0x5d')](handleError(_0x302b6e,null));};exports[_0xa41a('0xe7')]=function(_0x4ae4c9,_0x6953c4){var _0x35a33c={};var _0x577fc2={};var _0x10db82;var _0x3a93fa;return db[_0xa41a('0x3d')][_0xa41a('0x98')]({'where':{'id':_0x4ae4c9['params']['id']}})[_0xa41a('0x27')](handleEntityNotFound(_0x6953c4,null))[_0xa41a('0x27')](function(_0x4cabb0){if(_0x4cabb0){_0x10db82=_0x4cabb0;_0x577fc2[_0xa41a('0xd1')]=_[_0xa41a('0xd2')](db['OpenchannelInteraction']['rawAttributes']);_0x577fc2[_0xa41a('0x48')]=_[_0xa41a('0xd2')](_0x4ae4c9[_0xa41a('0x48')]);_0x577fc2['filters']=_['intersection'](_0x577fc2[_0xa41a('0xd1')],_0x577fc2[_0xa41a('0x48')]);_0x35a33c[_0xa41a('0x4c')]=_['intersection'](_0x577fc2['model'],qs[_0xa41a('0xdc')](_0x4ae4c9[_0xa41a('0x48')][_0xa41a('0xdc')]));_0x35a33c[_0xa41a('0x4c')]=_0x35a33c[_0xa41a('0x4c')][_0xa41a('0x52')]?_0x35a33c[_0xa41a('0x4c')]:_0x577fc2['model'];_0x35a33c[_0xa41a('0xdd')]=qs[_0xa41a('0xd6')](_0x4ae4c9['query'][_0xa41a('0xd6')]);_0x35a33c[_0xa41a('0x47')]=qs[_0xa41a('0xd4')](_[_0xa41a('0xde')](_0x4ae4c9['query'],_0x577fc2['filters']));if(_0x4ae4c9[_0xa41a('0x48')]['filter']){_0x35a33c[_0xa41a('0x47')]=_['merge'](_0x35a33c[_0xa41a('0x47')],{'$or':_[_0xa41a('0x34')](_0x35a33c['attributes'],function(_0x1cdd99){var _0x5f02d0={};_0x5f02d0[_0x1cdd99]={'$like':'%'+_0x4ae4c9[_0xa41a('0x48')][_0xa41a('0x32')]+'%'};return _0x5f02d0;})});}_0x35a33c=_['merge']({},_0x35a33c,_0x4ae4c9[_0xa41a('0xd7')]);return _0x10db82[_0xa41a('0xe7')](_0x35a33c);}})[_0xa41a('0x27')](function(_0x25f3cd){if(_0x25f3cd){_0x3a93fa=_0x25f3cd[_0xa41a('0x52')];if(!_0x4ae4c9[_0xa41a('0x48')][_0xa41a('0xdf')](_0xa41a('0xda'))){_0x35a33c['limit']=qs[_0xa41a('0x1c')](_0x4ae4c9[_0xa41a('0x48')]['limit']);_0x35a33c[_0xa41a('0x1b')]=qs['offset'](_0x4ae4c9['query'][_0xa41a('0x1b')]);}return _0x10db82[_0xa41a('0xe7')](_0x35a33c);}})[_0xa41a('0x27')](function(_0x283a28){if(_0x283a28){return _0x283a28?{'count':_0x3a93fa,'rows':_0x283a28}:null;}})['then'](respondWithResult(_0x6953c4,null))['catch'](handleError(_0x6953c4,null));};exports[_0xa41a('0xe8')]=function(_0x110d56,_0x7cb628){var _0x295c54={'raw':!![],'where':{}};var _0x509809={};var _0x1adfca={'count':0x0,'rows':[]};return db[_0xa41a('0x3d')][_0xa41a('0x98')]({'where':{'id':_0x110d56[_0xa41a('0x59')]['id']}})[_0xa41a('0x27')](handleEntityNotFound(_0x7cb628,null))[_0xa41a('0x27')](function(_0x33e2d0){if(_0x33e2d0){_0x509809[_0xa41a('0xd1')]=_['keys'](db[_0xa41a('0xe9')]['rawAttributes']);_0x509809[_0xa41a('0x48')]=_['keys'](_0x110d56[_0xa41a('0x48')]);_0x509809['filters']=_['intersection'](_0x509809[_0xa41a('0xd1')],_0x509809[_0xa41a('0x48')]);_0x295c54[_0xa41a('0x4c')]=_[_0xa41a('0xd5')](_0x509809[_0xa41a('0xd1')],qs[_0xa41a('0xdc')](_0x110d56['query'][_0xa41a('0xdc')]));_0x295c54[_0xa41a('0x4c')]=_0x295c54['attributes'][_0xa41a('0x52')]?_0x295c54[_0xa41a('0x4c')]:_0x509809[_0xa41a('0xd1')];if(!_0x110d56['query'][_0xa41a('0xdf')](_0xa41a('0xda'))){_0x295c54[_0xa41a('0x1c')]=qs['limit'](_0x110d56['query'][_0xa41a('0x1c')]);_0x295c54[_0xa41a('0x1b')]=qs[_0xa41a('0x1b')](_0x110d56[_0xa41a('0x48')][_0xa41a('0x1b')]);}_0x295c54[_0xa41a('0xdd')]=qs[_0xa41a('0xd6')](_0x110d56[_0xa41a('0x48')][_0xa41a('0xd6')]);_0x295c54[_0xa41a('0x47')]=qs[_0xa41a('0xd4')](_[_0xa41a('0xde')](_0x110d56[_0xa41a('0x48')],_0x509809[_0xa41a('0xd4')]));_0x295c54[_0xa41a('0x47')]['UserId']=_0x33e2d0['id'];if(_0x110d56[_0xa41a('0x48')][_0xa41a('0x32')]){_0x295c54[_0xa41a('0x47')]=_[_0xa41a('0x5a')](_0x295c54[_0xa41a('0x47')],{'$or':_[_0xa41a('0x34')](_0x295c54[_0xa41a('0x4c')],function(_0x1d6d39){var _0x44d02d={};_0x44d02d[_0x1d6d39]={'$like':'%'+_0x110d56[_0xa41a('0x48')][_0xa41a('0x32')]+'%'};return _0x44d02d;})});}_0x295c54=_[_0xa41a('0x5a')]({},_0x295c54,_0x110d56[_0xa41a('0xd7')]);return db[_0xa41a('0xe9')][_0xa41a('0x1a')]({'where':_0x295c54[_0xa41a('0x47')]})['then'](function(_0x67245){_0x1adfca[_0xa41a('0x1a')]=_0x67245;if(_0x110d56[_0xa41a('0x48')][_0xa41a('0xc9')]){_0x295c54[_0xa41a('0x49')]=[{'all':!![]}];}return db[_0xa41a('0xe9')]['findAll'](_0x295c54);})[_0xa41a('0x27')](function(_0x352b28){_0x1adfca[_0xa41a('0x4f')]=_0x352b28;return _0x1adfca;});}})['then'](respondWithFilteredResult(_0x7cb628,_0x295c54))[_0xa41a('0x5d')](handleError(_0x7cb628,null));};exports[_0xa41a('0xea')]=function(_0x539c4e,_0x27dee8){var _0x3649ce={};var _0x3f91c7={};var _0x2718dc;var _0x295b3b;return db[_0xa41a('0x3d')]['findOne']({'where':{'id':_0x539c4e[_0xa41a('0x59')]['id']}})['then'](handleEntityNotFound(_0x27dee8,null))['then'](function(_0x1348ca){if(_0x1348ca){_0x2718dc=_0x1348ca;_0x3f91c7['model']=_['keys'](db[_0xa41a('0xeb')][_0xa41a('0xd3')]);_0x3f91c7[_0xa41a('0x48')]=_[_0xa41a('0xd2')](_0x539c4e[_0xa41a('0x48')]);_0x3f91c7[_0xa41a('0xd4')]=_[_0xa41a('0xd5')](_0x3f91c7['model'],_0x3f91c7[_0xa41a('0x48')]);_0x3649ce['attributes']=_[_0xa41a('0xd5')](_0x3f91c7['model'],qs[_0xa41a('0xdc')](_0x539c4e[_0xa41a('0x48')]['fields']));_0x3649ce[_0xa41a('0x4c')]=_0x3649ce[_0xa41a('0x4c')][_0xa41a('0x52')]?_0x3649ce['attributes']:_0x3f91c7['model'];_0x3649ce[_0xa41a('0xdd')]=qs[_0xa41a('0xd6')](_0x539c4e[_0xa41a('0x48')][_0xa41a('0xd6')]);_0x3649ce[_0xa41a('0x47')]=qs[_0xa41a('0xd4')](_[_0xa41a('0xde')](_0x539c4e[_0xa41a('0x48')],_0x3f91c7[_0xa41a('0xd4')]));if(_0x539c4e[_0xa41a('0x48')][_0xa41a('0x32')]){_0x3649ce[_0xa41a('0x47')]=_['merge'](_0x3649ce['where'],{'$or':_[_0xa41a('0x34')](_0x3649ce[_0xa41a('0x4c')],function(_0x4538a3){var _0x3431a2={};_0x3431a2[_0x4538a3]={'$like':'%'+_0x539c4e[_0xa41a('0x48')]['filter']+'%'};return _0x3431a2;})});}_0x3649ce=_[_0xa41a('0x5a')]({},_0x3649ce,_0x539c4e[_0xa41a('0xd7')]);return _0x2718dc[_0xa41a('0xea')](_0x3649ce);}})[_0xa41a('0x27')](function(_0x412d83){if(_0x412d83){_0x295b3b=_0x412d83[_0xa41a('0x52')];if(!_0x539c4e[_0xa41a('0x48')][_0xa41a('0xdf')]('nolimit')){_0x3649ce[_0xa41a('0x1c')]=qs['limit'](_0x539c4e[_0xa41a('0x48')]['limit']);_0x3649ce['offset']=qs[_0xa41a('0x1b')](_0x539c4e[_0xa41a('0x48')][_0xa41a('0x1b')]);}return _0x2718dc['getSmsInteractions'](_0x3649ce);}})[_0xa41a('0x27')](function(_0x214e80){if(_0x214e80){return _0x214e80?{'count':_0x295b3b,'rows':_0x214e80}:null;}})[_0xa41a('0x27')](respondWithResult(_0x27dee8,null))['catch'](handleError(_0x27dee8,null));};exports[_0xa41a('0xec')]=function(_0x5ac35f,_0x372eaa){var _0xb35e04={};var _0x36ccc0={};var _0x5f34bc;var _0x4599b8;return db[_0xa41a('0x3d')]['findOne']({'where':{'id':_0x5ac35f[_0xa41a('0x59')]['id']}})['then'](handleEntityNotFound(_0x372eaa,null))['then'](function(_0x42a210){if(_0x42a210){_0x5f34bc=_0x42a210;_0x36ccc0[_0xa41a('0xd1')]=_[_0xa41a('0xd2')](db['FaxInteraction']['rawAttributes']);_0x36ccc0[_0xa41a('0x48')]=_['keys'](_0x5ac35f[_0xa41a('0x48')]);_0x36ccc0['filters']=_[_0xa41a('0xd5')](_0x36ccc0[_0xa41a('0xd1')],_0x36ccc0[_0xa41a('0x48')]);_0xb35e04[_0xa41a('0x4c')]=_['intersection'](_0x36ccc0[_0xa41a('0xd1')],qs['fields'](_0x5ac35f['query']['fields']));_0xb35e04[_0xa41a('0x4c')]=_0xb35e04[_0xa41a('0x4c')]['length']?_0xb35e04[_0xa41a('0x4c')]:_0x36ccc0[_0xa41a('0xd1')];_0xb35e04[_0xa41a('0xdd')]=qs['sort'](_0x5ac35f[_0xa41a('0x48')][_0xa41a('0xd6')]);_0xb35e04[_0xa41a('0x47')]=qs[_0xa41a('0xd4')](_[_0xa41a('0xde')](_0x5ac35f[_0xa41a('0x48')],_0x36ccc0[_0xa41a('0xd4')]));if(_0x5ac35f[_0xa41a('0x48')][_0xa41a('0x32')]){_0xb35e04[_0xa41a('0x47')]=_[_0xa41a('0x5a')](_0xb35e04[_0xa41a('0x47')],{'$or':_[_0xa41a('0x34')](_0xb35e04[_0xa41a('0x4c')],function(_0x2c3052){var _0x544abc={};_0x544abc[_0x2c3052]={'$like':'%'+_0x5ac35f[_0xa41a('0x48')][_0xa41a('0x32')]+'%'};return _0x544abc;})});}_0xb35e04=_[_0xa41a('0x5a')]({},_0xb35e04,_0x5ac35f[_0xa41a('0xd7')]);return _0x5f34bc[_0xa41a('0xec')](_0xb35e04);}})[_0xa41a('0x27')](function(_0x4873bc){if(_0x4873bc){_0x4599b8=_0x4873bc[_0xa41a('0x52')];if(!_0x5ac35f[_0xa41a('0x48')]['hasOwnProperty'](_0xa41a('0xda'))){_0xb35e04[_0xa41a('0x1c')]=qs[_0xa41a('0x1c')](_0x5ac35f[_0xa41a('0x48')][_0xa41a('0x1c')]);_0xb35e04['offset']=qs[_0xa41a('0x1b')](_0x5ac35f['query'][_0xa41a('0x1b')]);}return _0x5f34bc[_0xa41a('0xec')](_0xb35e04);}})[_0xa41a('0x27')](function(_0x91532a){if(_0x91532a){return _0x91532a?{'count':_0x4599b8,'rows':_0x91532a}:null;}})[_0xa41a('0x27')](respondWithResult(_0x372eaa,null))[_0xa41a('0x5d')](handleError(_0x372eaa,null));};exports['getWhatsappInteractions']=function(_0x423ae7,_0x4d7407){var _0x82ab53={};var _0x5e5cdc={};var _0x5d8ea3;var _0x14c461;return db[_0xa41a('0x3d')][_0xa41a('0x98')]({'where':{'id':_0x423ae7['params']['id']}})[_0xa41a('0x27')](handleEntityNotFound(_0x4d7407,null))['then'](function(_0x36bce8){if(_0x36bce8){_0x5d8ea3=_0x36bce8;_0x5e5cdc['model']=_['keys'](db[_0xa41a('0xed')]['rawAttributes']);_0x5e5cdc[_0xa41a('0x48')]=_[_0xa41a('0xd2')](_0x423ae7['query']);_0x5e5cdc[_0xa41a('0xd4')]=_[_0xa41a('0xd5')](_0x5e5cdc[_0xa41a('0xd1')],_0x5e5cdc[_0xa41a('0x48')]);_0x82ab53['attributes']=_[_0xa41a('0xd5')](_0x5e5cdc['model'],qs[_0xa41a('0xdc')](_0x423ae7[_0xa41a('0x48')]['fields']));_0x82ab53[_0xa41a('0x4c')]=_0x82ab53[_0xa41a('0x4c')]['length']?_0x82ab53[_0xa41a('0x4c')]:_0x5e5cdc[_0xa41a('0xd1')];_0x82ab53[_0xa41a('0xdd')]=qs['sort'](_0x423ae7['query'][_0xa41a('0xd6')]);_0x82ab53['where']=qs[_0xa41a('0xd4')](_[_0xa41a('0xde')](_0x423ae7[_0xa41a('0x48')],_0x5e5cdc[_0xa41a('0xd4')]));if(_0x423ae7[_0xa41a('0x48')][_0xa41a('0x32')]){_0x82ab53[_0xa41a('0x47')]=_[_0xa41a('0x5a')](_0x82ab53['where'],{'$or':_[_0xa41a('0x34')](_0x82ab53[_0xa41a('0x4c')],function(_0x12738e){var _0x200ec1={};_0x200ec1[_0x12738e]={'$like':'%'+_0x423ae7['query'][_0xa41a('0x32')]+'%'};return _0x200ec1;})});}_0x82ab53=_['merge']({},_0x82ab53,_0x423ae7[_0xa41a('0xd7')]);return _0x5d8ea3['getWhatsappInteractions'](_0x82ab53);}})[_0xa41a('0x27')](function(_0x469255){if(_0x469255){_0x14c461=_0x469255[_0xa41a('0x52')];if(!_0x423ae7['query'][_0xa41a('0xdf')](_0xa41a('0xda'))){_0x82ab53[_0xa41a('0x1c')]=qs[_0xa41a('0x1c')](_0x423ae7[_0xa41a('0x48')][_0xa41a('0x1c')]);_0x82ab53[_0xa41a('0x1b')]=qs[_0xa41a('0x1b')](_0x423ae7['query'][_0xa41a('0x1b')]);}return _0x5d8ea3['getWhatsappInteractions'](_0x82ab53);}})[_0xa41a('0x27')](function(_0x47866d){if(_0x47866d){return _0x47866d?{'count':_0x14c461,'rows':_0x47866d}:null;}})[_0xa41a('0x27')](respondWithResult(_0x4d7407,null))['catch'](handleError(_0x4d7407,null));};exports[_0xa41a('0xee')]=function(_0x51685e,_0x264c33,_0x2a3fe6){var _0x2d3c89;var _0x35a3a4;var _0x534edc;var _0x39d77d=!_[_0xa41a('0x66')](_0x51685e[_0xa41a('0x59')]['id'])?_0x51685e['params']['id']:!_['isNil'](_0x51685e[_0xa41a('0x2f')]['id'])?_0x51685e['user']['id']:null;return db[_0xa41a('0x3d')][_0xa41a('0x37')]({'where':{'id':_0x39d77d,'role':{'$or':[_0xa41a('0x2d'),'user','agent']}},'attributes':['id',_0xa41a('0x38'),_0xa41a('0xef'),_0xa41a('0xf0'),_0xa41a('0x28'),_0xa41a('0x63'),_0xa41a('0xf1')]})[_0xa41a('0x27')](function(_0x504d8f){if(_0x504d8f){if(_0x504d8f['role']===_0xa41a('0x29')){_0x2d3c89=_0x504d8f;if(_0x51685e['body']['interface']){_0x534edc=util[_0xa41a('0xa8')]('LOCAL/%s@from-sip/n',_0x2d3c89[_0x51685e[_0xa41a('0x5e')][_0xa41a('0x9e')]]);}else if(_0x51685e[_0xa41a('0x5e')][_0xa41a('0xf2')]){_0x534edc=util[_0xa41a('0xa8')](_0xa41a('0xa9'),_0x51685e[_0xa41a('0x5e')][_0xa41a('0xf2')]);}else{_0x534edc=util[_0xa41a('0xa8')]('SIP/%s',_0x2d3c89['name']);}socket['to'](util[_0xa41a('0xa8')](_0xa41a('0xf3'),_0x2d3c89[_0xa41a('0x38')]))['emit']('user:forcelogout',{'user':{'id':_0x2d3c89['id'],'name':_0x2d3c89[_0xa41a('0x38')]},'ip':_0x51685e[_0xa41a('0xf4')][_0xa41a('0xf5')]||_0x51685e[_0xa41a('0xf6')]['remoteAddress']||_0x51685e[_0xa41a('0xf7')][_0xa41a('0xf8')]||_0x51685e['connection']['socket'][_0xa41a('0xf8')]});return db[_0xa41a('0xaa')][_0xa41a('0x2b')]({'where':{'membername':_0x2d3c89[_0xa41a('0x38')]},'individualHooks':!![]});}}else{throw new db[(_0xa41a('0x95'))][(_0xa41a('0x90'))](_0xa41a('0xf9'));}})[_0xa41a('0x27')](function(){if(_0x2d3c89){return _0x2d3c89['getVoiceQueues']({'raw':!![]});}})[_0xa41a('0x27')](function(_0x4d4ca7){if(_0x2d3c89){if(_0x4d4ca7){_0x35a3a4=_0x4d4ca7;if(_0x35a3a4[_0xa41a('0x52')]){var _0x9eab16=_0x35a3a4[_0xa41a('0x34')](function(_0x4dd407){var _0x3e24b9={'membername':_0x2d3c89[_0xa41a('0x38')],'UserId':_0x2d3c89['id'],'queue_name':_0x4dd407['name'],'VoiceQueueId':_0x4dd407['id'],'interface':_0x534edc,'paused':_0x2d3c89[_0xa41a('0xf1')]||![],'penalty':_0x4dd407['UserVoiceQueue.penalty']||0x0};return db[_0xa41a('0xaa')][_0xa41a('0xab')](_0x3e24b9);});return Promise['all'](_0x9eab16);}}}})['then'](function(){if(_0x2d3c89){return db[_0xa41a('0xfa')][_0xa41a('0x4e')]({'where':{'membername':_0x2d3c89[_0xa41a('0x38')],'exitAt':null}});}})[_0xa41a('0x27')](function(_0x7157){if(_0x2d3c89){var _0x1c7535=[];_0x7157[_0xa41a('0xfb')](function(_0x2143b9){_0x1c7535[_0xa41a('0x4d')](_0x2143b9['update']({'exitAt':moment()[_0xa41a('0xa8')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x1c7535);}})[_0xa41a('0x27')](function(){if(_0x2d3c89){var _0x59aa97=[];var _0x736d24=[];var _0x4d07fa=utils[_0xa41a('0xfc')]();var _0x4790ba={'membername':_0x2d3c89[_0xa41a('0x38')],'interface':_0x534edc,'enterAt':moment()['format'](_0xa41a('0xfd')),'role':_0x2d3c89[_0xa41a('0x28')],'internal':_0x2d3c89[_0xa41a('0x63')]};_0x4d07fa[_0xa41a('0xfb')](function(_0x400ec1){_0x59aa97[_0xa41a('0x4d')](_['merge']({'channel':_0x400ec1,'type':_0xa41a('0xfe'),'data1':_0x51685e[_0xa41a('0x5e')][_0xa41a('0xff')],'data2':_0x534edc},_0x4790ba));if(_0x2d3c89[_0xa41a('0xf1')]){_0x736d24[_0xa41a('0x4d')](_[_0xa41a('0x5a')]({'channel':_0x400ec1,'type':_0xa41a('0x100'),'data1':_0xa41a('0x101')},_0x4790ba));}});return db[_0xa41a('0xfa')][_0xa41a('0x89')](_0x59aa97[_0xa41a('0x102')](_0x736d24),{'individualHooks':!![]});}})['then'](function(){if(_0x2d3c89){return _0x2d3c89[_0xa41a('0x26')]({'online':!![],'lastLoginAt':moment()['format'](_0xa41a('0xfd')),'voicePause':_0x2d3c89[_0xa41a('0xf1')]||![],'mailPause':_0x2d3c89['loginInPause']||![],'chatPause':_0x2d3c89[_0xa41a('0xf1')]||![],'faxPause':_0x2d3c89[_0xa41a('0xf1')]||![],'smsPause':_0x2d3c89[_0xa41a('0xf1')]||![],'openchannelPause':_0x2d3c89[_0xa41a('0xf1')]||![],'whatsappPause':_0x2d3c89[_0xa41a('0xf1')]||![],'pauseType':_0x2d3c89[_0xa41a('0xf1')]?'LOGININPAUSE':null,'interface':_0x534edc,'lastPauseAt':moment()[_0xa41a('0xa8')](_0xa41a('0xfd'))});}})[_0xa41a('0x27')](function(_0x97a0cc){if(_0x51685e['isMiddleware']){return _0x2a3fe6();}else{return Promise[_0xa41a('0x103')](_0x97a0cc)['then'](respondWithResult(_0x264c33,null));}})[_0xa41a('0x5d')](handleError(_0x264c33,null));};exports[_0xa41a('0x104')]=function(_0x27acb6,_0x33c297){var _0x538509;return db[_0xa41a('0x3d')][_0xa41a('0x37')]({'where':{'id':_0x27acb6[_0xa41a('0x59')]['id'],'role':'agent'},'attributes':['id',_0xa41a('0x38'),_0xa41a('0x28')]})[_0xa41a('0x27')](handleEntityNotFound(_0x33c297,null))[_0xa41a('0x27')](function(_0x2e0082){if(_0x2e0082){_0x538509=_0x2e0082;return db['UserVoiceQueueRt'][_0xa41a('0x2b')]({'where':{'membername':_0x538509[_0xa41a('0x38')]},'individualHooks':!![]});}})[_0xa41a('0x27')](function(){return db[_0xa41a('0xfa')][_0xa41a('0x4e')]({'where':{'membername':_0x538509[_0xa41a('0x38')],'exitAt':null}});})[_0xa41a('0x27')](function(_0x143bdf){var _0x1079e3=[];_0x143bdf[_0xa41a('0xfb')](function(_0x1e3c17){_0x1079e3[_0xa41a('0x4d')](_0x1e3c17[_0xa41a('0x26')]({'exitAt':moment()['format'](_0xa41a('0xfd'))}));});return Promise[_0xa41a('0x58')](_0x1079e3);})[_0xa41a('0x27')](function(){return _0x538509[_0xa41a('0x26')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xa41a('0x27')](respondWithResult(_0x33c297,null))['catch'](handleError(_0x33c297,null));};exports[_0xa41a('0x105')]=function(_0x3dbd5b,_0x589fb2){var _0x23bae8;return db[_0xa41a('0xaa')][_0xa41a('0x26')]({'paused':0x1},{'where':{'UserId':_0x3dbd5b[_0xa41a('0x59')]['id']},'individualHooks':!![]})['then'](function(){return db[_0xa41a('0x3d')]['find']({'where':{'id':_0x3dbd5b[_0xa41a('0x59')]['id'],'role':_0xa41a('0x29')},'attributes':['id','name',_0xa41a('0x28'),_0xa41a('0x63'),_0xa41a('0x9e'),_0xa41a('0xa7')]});})[_0xa41a('0x27')](handleEntityNotFound(_0x589fb2,null))[_0xa41a('0x27')](function(_0x5668ba){if(_0x5668ba){_0x23bae8=_0x5668ba;return respondWithRpcPromise('QueuePause',_0xa41a('0x105'),{'id':_0x23bae8['id'],'name':_0x23bae8['name'],'pause':!![]});}})[_0xa41a('0x27')](function(){if(_0x23bae8){return db[_0xa41a('0xfa')]['findAll']({'where':{'membername':_0x23bae8['name'],'type':_0xa41a('0x100'),'exitAt':null}});}})[_0xa41a('0x27')](function(_0x201d29){if(_0x201d29['length']){var _0x28afe3=moment()['format'](_0xa41a('0xfd'));for(var _0x3cb5c0=0x0,_0x5bd40f=_0x201d29['length'];_0x3cb5c0<_0x5bd40f;_0x3cb5c0++){_0x201d29[_0x3cb5c0]['updateAttributes']({'exitAt':_0x28afe3});}}})[_0xa41a('0x27')](function(){var _0x125921=[];var _0x4c0748=utils[_0xa41a('0xfc')]();_0x4c0748['forEach'](function(_0x2a6e08){_0x125921['push']({'channel':_0x2a6e08,'membername':_0x23bae8[_0xa41a('0x38')],'interface':_[_0xa41a('0x66')](_0x23bae8['interface'])?util[_0xa41a('0xa8')](_0xa41a('0xa9'),_0x23bae8['name']):_0x23bae8[_0xa41a('0x9e')],'type':_0xa41a('0x100'),'enterAt':moment()[_0xa41a('0xa8')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x3dbd5b[_0xa41a('0x5e')][_0xa41a('0x106')]||'DEFAULT\x20PAUSE','role':_0x23bae8[_0xa41a('0x28')],'internal':_0x23bae8['internal']});});return db[_0xa41a('0xfa')][_0xa41a('0x89')](_0x125921,{'individualHooks':!![]});})[_0xa41a('0x27')](function(){return _0x23bae8[_0xa41a('0x26')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3dbd5b[_0xa41a('0x5e')][_0xa41a('0x106')]||_0xa41a('0x107'),'lastPauseAt':moment()[_0xa41a('0xa8')](_0xa41a('0xfd'))});})[_0xa41a('0x27')](respondWithResult(_0x589fb2,null))[_0xa41a('0x5d')](handleError(_0x589fb2,null));};exports['unpause']=function(_0x174048,_0x3ec1c3){if(_0x174048[_0xa41a('0x5e')][_0xa41a('0xad')]&&!utils[_0xa41a('0x9f')](_0x174048[_0xa41a('0x5e')][_0xa41a('0xad')])){throw new APIBadRequestError(util[_0xa41a('0xa8')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x174048[_0xa41a('0x5e')]['channel']));}return db[_0xa41a('0x3d')]['find']({'where':{'id':_0x174048['params']['id']},'attributes':['id','name',_0xa41a('0x28'),_0xa41a('0x63'),'interface',_0xa41a('0xa7'),_0xa41a('0x9d'),_0xa41a('0x108'),'chatPause',_0xa41a('0x109'),'openchannelPause',_0xa41a('0x10a'),_0xa41a('0x10b'),_0xa41a('0x10c'),'lastPauseAt']})['then'](function(_0x476918){if(!_0x476918){throw new APINotFoundError(util[_0xa41a('0xa8')](_0xa41a('0xc8'),_0x174048[_0xa41a('0x59')]['id']));}return _0x476918[_0xa41a('0x10d')](_0x174048[_0xa41a('0x5e')][_0xa41a('0xad')]);})[_0xa41a('0x27')](respondWithResult(_0x3ec1c3,null))['catch'](APIHandleError(_0x3ec1c3));};exports[_0xa41a('0x10e')]=function(_0x336ab9,_0xbda710){var _0x427532={};var _0xadbf64={};var _0x59d16f;var _0x5b37f8;return db[_0xa41a('0x3d')]['findOne']({'where':{'id':_0x336ab9['params']['id']}})[_0xa41a('0x27')](handleEntityNotFound(_0xbda710,null))[_0xa41a('0x27')](function(_0x373d57){if(_0x373d57){_0x59d16f=_0x373d57;_0xadbf64['model']=_[_0xa41a('0xd2')](db[_0xa41a('0x10f')][_0xa41a('0xd3')]);_0xadbf64[_0xa41a('0x48')]=_[_0xa41a('0xd2')](_0x336ab9[_0xa41a('0x48')]);_0xadbf64[_0xa41a('0xd4')]=_['intersection'](_0xadbf64[_0xa41a('0xd1')],_0xadbf64[_0xa41a('0x48')]);_0x427532['attributes']=_[_0xa41a('0xd5')](_0xadbf64[_0xa41a('0xd1')],qs[_0xa41a('0xdc')](_0x336ab9[_0xa41a('0x48')][_0xa41a('0xdc')]));_0x427532[_0xa41a('0x4c')]=_0x427532[_0xa41a('0x4c')][_0xa41a('0x52')]?_0x427532['attributes']:_0xadbf64[_0xa41a('0xd1')];_0x427532[_0xa41a('0xdd')]=qs[_0xa41a('0xd6')](_0x336ab9[_0xa41a('0x48')][_0xa41a('0xd6')]);_0x427532['where']=qs[_0xa41a('0xd4')](_[_0xa41a('0xde')](_0x336ab9['query'],_0xadbf64[_0xa41a('0xd4')]));if(_0x336ab9[_0xa41a('0x48')][_0xa41a('0x32')]){_0x427532[_0xa41a('0x47')]=_[_0xa41a('0x5a')](_0x427532[_0xa41a('0x47')],{'$or':_[_0xa41a('0x34')](_0x427532[_0xa41a('0x4c')],function(_0x254dd2){var _0x9560a6={};_0x9560a6[_0x254dd2]={'$like':'%'+_0x336ab9[_0xa41a('0x48')][_0xa41a('0x32')]+'%'};return _0x9560a6;})});}_0x427532=_[_0xa41a('0x5a')]({},_0x427532,_0x336ab9['options']);return _0x59d16f['getTeams'](_0x427532);}})['then'](function(_0x463335){if(_0x463335){_0x5b37f8=_0x463335['length'];if(!_0x336ab9[_0xa41a('0x48')][_0xa41a('0xdf')]('nolimit')){_0x427532[_0xa41a('0x1c')]=qs['limit'](_0x336ab9[_0xa41a('0x48')][_0xa41a('0x1c')]);_0x427532['offset']=qs[_0xa41a('0x1b')](_0x336ab9[_0xa41a('0x48')][_0xa41a('0x1b')]);}return _0x59d16f[_0xa41a('0x10e')](_0x427532);}})[_0xa41a('0x27')](function(_0x1e98b3){if(_0x1e98b3){return _0x1e98b3?{'count':_0x5b37f8,'rows':_0x1e98b3}:null;}})['then'](respondWithResult(_0xbda710,null))[_0xa41a('0x5d')](handleError(_0xbda710,null));};exports['addTeams']=function(_0x310ca9,_0x2ab1cc){var _0xc4c3d8=_0x310ca9[_0xa41a('0x59')]['id'];var _0x27c87f=_0x310ca9[_0xa41a('0x5e')]?_0x310ca9[_0xa41a('0x5e')][_0xa41a('0x61')]:null;var _0x2aa45d=[];return Promise[_0xa41a('0x103')]()[_0xa41a('0x27')](function(){if(!_0x27c87f)throw new APIBadRequestError(_0xa41a('0x110'));})[_0xa41a('0x27')](function(){return db[_0xa41a('0x3d')]['findOne']({'where':{'id':_0xc4c3d8}});})[_0xa41a('0x27')](function(_0x341292){if(!_0x341292)throw new APINotFoundError(util[_0xa41a('0xa8')](_0xa41a('0xc8'),_0x310ca9[_0xa41a('0x59')]['id']));return db[_0xa41a('0x68')][_0xa41a('0x111')](function(_0x572fd2){return _0x341292['addTeams'](_0x27c87f,{'transaction':_0x572fd2})[_0xa41a('0x27')](function(){return db[_0xa41a('0x10f')][_0xa41a('0x4e')]({'where':{'id':{'$in':_0x27c87f}}});})['then'](function(_0x26b381){var _0x54379e=_['map'](_0x26b381,function(_0x501770){return _0x501770['getAssociatedQueues']();});return Promise[_0xa41a('0x58')](_0x54379e);})[_0xa41a('0x27')](function(_0x5694a5){_0x2aa45d=_[_0xa41a('0x112')](_0x5694a5);var _0x3b25ef=_[_0xa41a('0x34')](_0x2aa45d,function(_0x341fe1){return _0x341fe1[_0xa41a('0x113')](_0x341292['id'],{'transaction':_0x572fd2});});return Promise[_0xa41a('0x58')](_0x3b25ef);})['then'](function(){if(!_0x341292[_0xa41a('0xa7')])return;var _0x296ab4=_['filter'](_0x2aa45d,function(_0x8746df){return _0x8746df['getDataValue'](_0xa41a('0xad'))===_0xa41a('0x114');});var _0xde0ac0=_['map'](_0x296ab4,function(_0x42b202){return db[_0xa41a('0xaa')]['upsert']({'membername':_0x341292[_0xa41a('0x38')],'UserId':_0x341292['id'],'queue_name':_0x42b202[_0xa41a('0x38')],'VoiceQueueId':_0x42b202['id'],'interface':_['isNil'](_0x341292['interface'])?util[_0xa41a('0xa8')](_0xa41a('0xa9'),_0x341292['name']):_0x341292['interface'],'paused':_0x341292[_0xa41a('0x9d')]||![],'penalty':_0x341292['penalty']},{'transaction':_0x572fd2});});return Promise[_0xa41a('0x58')](_0xde0ac0);})[_0xa41a('0x27')](function(){return db[_0xa41a('0x115')]['findAll']({'where':{'teamId':{'$in':_0x27c87f}}});})[_0xa41a('0x27')](function(_0x1a19b6){var _0x550a6b=_[_0xa41a('0x34')](_0x1a19b6,function(_0x13f0e1){return db[_0xa41a('0x116')][_0xa41a('0x7f')]({'UserId':_0x341292['id'],'VoicePrefixId':_0x13f0e1[_0xa41a('0x117')]},{'transaction':_0x572fd2});});return Promise[_0xa41a('0x58')](_0x550a6b);});});})[_0xa41a('0x27')](function(){for(var _0x41a00c=0x0;_0x41a00c<_0x2aa45d[_0xa41a('0x52')];_0x41a00c++){var _0x20357a=_0x2aa45d[_0x41a00c][_0xa41a('0x118')](_0xa41a('0xad'));var _0x5c2309=_0x20357a+_0xa41a('0xb1');socket[_0xa41a('0x2a')]('user'+_0x20357a+_0xa41a('0x119'),{'UserId':_0xc4c3d8,['queueField']:_0x2aa45d[_0x41a00c]['id']});}})[_0xa41a('0x27')](respondWithStatusCode(_0x2ab1cc,null))['catch'](APIHandleError(_0x2ab1cc));};exports[_0xa41a('0x11a')]=function(_0x3e4ca2,_0x40789b){var _0x3f300e=_0x3e4ca2['params']['id'];var _0x513c5f=null;if(_0x3e4ca2[_0xa41a('0x48')][_0xa41a('0x61')]){_0x513c5f=_[_0xa41a('0xb0')](_0x3e4ca2[_0xa41a('0x48')][_0xa41a('0x61')])?_0x3e4ca2[_0xa41a('0x48')][_0xa41a('0x61')]:[_0x3e4ca2[_0xa41a('0x48')][_0xa41a('0x61')]];}var _0x5998ba=[];return Promise['resolve']()[_0xa41a('0x27')](function(){if(!_0x513c5f)throw new APIBadRequestError(_0xa41a('0x11b'));})[_0xa41a('0x27')](function(){return db['User'][_0xa41a('0x98')]({'where':{'id':_0x3f300e}});})[_0xa41a('0x27')](function(_0x265705){if(!_0x265705)throw new APINotFoundError(util[_0xa41a('0xa8')](_0xa41a('0xc8'),_0x3e4ca2['params']['id']));return db[_0xa41a('0x68')][_0xa41a('0x111')](function(_0x19a3fa){return _0x265705[_0xa41a('0x11a')](_0x513c5f,{'transaction':_0x19a3fa})[_0xa41a('0x27')](function(){return db[_0xa41a('0x10f')][_0xa41a('0x4e')]({'where':{'id':{'$in':_0x513c5f}}});})[_0xa41a('0x27')](function(_0x2fd2d2){var _0x1f8a7b=_['map'](_0x2fd2d2,function(_0x45057d){return _0x45057d['getAssociatedQueues']();});return Promise[_0xa41a('0x58')](_0x1f8a7b);})[_0xa41a('0x27')](function(_0x51c5c0){_0x5998ba=_[_0xa41a('0x112')](_0x51c5c0);var _0x30c028=_[_0xa41a('0x34')](_0x5998ba,function(_0x51db2f){return _0x51db2f[_0xa41a('0x11c')](_0x265705['id'],{'transaction':_0x19a3fa});});return Promise[_0xa41a('0x58')](_0x30c028);})[_0xa41a('0x27')](function(){if(!_0x265705[_0xa41a('0xa7')])return;var _0x32b429=_[_0xa41a('0x32')](_0x5998ba,function(_0x2ceeec){return _0x2ceeec[_0xa41a('0x118')](_0xa41a('0xad'))==='Voice';});var _0x49c1a2=_[_0xa41a('0x34')](_0x32b429,function(_0x37b127){return db['UserVoiceQueueRt'][_0xa41a('0x2b')]({'where':{'VoiceQueueId':_0x37b127['id'],'UserId':_0x265705['id']},'transaction':_0x19a3fa});});return Promise[_0xa41a('0x58')](_0x49c1a2);})[_0xa41a('0x27')](function(){return db[_0xa41a('0x115')][_0xa41a('0x4e')]({'where':{'teamId':{'$in':_0x513c5f}}});})[_0xa41a('0x27')](function(_0x50a9f7){var _0x3ea269=_['map'](_0x50a9f7,function(_0x94706a){return db[_0xa41a('0x116')]['destroy']({'where':{'UserId':_0x265705['id'],'VoicePrefixId':_0x94706a['VoicePrefixId']}},{'transaction':_0x19a3fa});});return Promise[_0xa41a('0x58')](_0x3ea269);});});})['then'](function(){for(var _0xa386e8=0x0;_0xa386e8<_0x5998ba['length'];_0xa386e8++){var _0x4fe2c6=_0x5998ba[_0xa386e8]['getDataValue'](_0xa41a('0xad'));var _0x2b8d7f=_0x4fe2c6+_0xa41a('0xb1');socket['emit']('user'+_0x4fe2c6+_0xa41a('0xb2'),{'UserId':_0x3f300e,['queueField']:_0x5998ba[_0xa386e8]['id']});}})[_0xa41a('0x27')](respondWithStatusCode(_0x40789b,null))[_0xa41a('0x5d')](APIHandleError(_0x40789b));};exports['getLists']=function(_0x435b52,_0x144750){var _0x4adf15={};var _0x56c8a5={};var _0x3d0eae;var _0x2b94d1;return db[_0xa41a('0x3d')][_0xa41a('0x98')]({'where':{'id':_0x435b52[_0xa41a('0x59')]['id']}})['then'](handleEntityNotFound(_0x144750,null))[_0xa41a('0x27')](function(_0x3d738d){if(_0x3d738d){_0x3d0eae=_0x3d738d;_0x56c8a5[_0xa41a('0xd1')]=_[_0xa41a('0xd2')](db[_0xa41a('0xca')][_0xa41a('0xd3')]);_0x56c8a5[_0xa41a('0x48')]=_[_0xa41a('0xd2')](_0x435b52[_0xa41a('0x48')]);_0x56c8a5[_0xa41a('0xd4')]=_[_0xa41a('0xd5')](_0x56c8a5[_0xa41a('0xd1')],_0x56c8a5['query']);_0x4adf15[_0xa41a('0x4c')]=_[_0xa41a('0xd5')](_0x56c8a5[_0xa41a('0xd1')],qs[_0xa41a('0xdc')](_0x435b52[_0xa41a('0x48')][_0xa41a('0xdc')]));_0x4adf15[_0xa41a('0x4c')]=_0x4adf15[_0xa41a('0x4c')][_0xa41a('0x52')]?_0x4adf15[_0xa41a('0x4c')]:_0x56c8a5[_0xa41a('0xd1')];_0x4adf15[_0xa41a('0xdd')]=qs[_0xa41a('0xd6')](_0x435b52[_0xa41a('0x48')][_0xa41a('0xd6')]);_0x4adf15['where']=qs[_0xa41a('0xd4')](_[_0xa41a('0xde')](_0x435b52[_0xa41a('0x48')],_0x56c8a5[_0xa41a('0xd4')]));if(_0x435b52[_0xa41a('0x48')][_0xa41a('0x32')]){_0x4adf15['where']=_[_0xa41a('0x5a')](_0x4adf15['where'],{'$or':_[_0xa41a('0x34')](_0x4adf15[_0xa41a('0x4c')],function(_0x228567){var _0x1d22e3={};_0x1d22e3[_0x228567]={'$like':'%'+_0x435b52[_0xa41a('0x48')]['filter']+'%'};return _0x1d22e3;})});}_0x4adf15=_[_0xa41a('0x5a')]({},_0x4adf15,_0x435b52['options']);return _0x3d0eae[_0xa41a('0x11d')](_0x4adf15);}})[_0xa41a('0x27')](function(_0x2072e3){if(_0x2072e3){_0x2b94d1=_0x2072e3[_0xa41a('0x52')];if(!_0x435b52['query']['hasOwnProperty']('nolimit')){_0x4adf15[_0xa41a('0x1c')]=qs[_0xa41a('0x1c')](_0x435b52[_0xa41a('0x48')][_0xa41a('0x1c')]);_0x4adf15[_0xa41a('0x1b')]=qs[_0xa41a('0x1b')](_0x435b52[_0xa41a('0x48')][_0xa41a('0x1b')]);}return _0x3d0eae[_0xa41a('0x11d')](_0x4adf15);}})[_0xa41a('0x27')](function(_0x26a34f){if(_0x26a34f){return _0x26a34f?{'count':_0x2b94d1,'rows':_0x26a34f}:null;}})[_0xa41a('0x27')](respondWithResult(_0x144750,null))[_0xa41a('0x5d')](handleError(_0x144750,null));};exports['getAgents']=function(_0x141fb1,_0x3578a1){var _0x1fe8d7={};var _0x563dc0={};var _0x7c890;return db[_0xa41a('0x3d')][_0xa41a('0x98')]({'where':{'id':_0x141fb1['params']['id']}})['then'](handleEntityNotFound(_0x3578a1,null))[_0xa41a('0x27')](function(_0x14e140){if(_0x14e140){_0x7c890=_0x14e140;_0x563dc0[_0xa41a('0xd1')]=_[_0xa41a('0xd2')](db[_0xa41a('0x3d')]['rawAttributes']);_0x563dc0[_0xa41a('0x48')]=_[_0xa41a('0xd2')](_0x141fb1[_0xa41a('0x48')]);_0x563dc0[_0xa41a('0xd4')]=_['intersection'](_0x563dc0[_0xa41a('0xd1')],_0x563dc0[_0xa41a('0x48')]);_0x1fe8d7[_0xa41a('0x4c')]=_['intersection'](_0x563dc0[_0xa41a('0xd1')],qs['fields'](_0x141fb1[_0xa41a('0x48')][_0xa41a('0xdc')]));_0x1fe8d7[_0xa41a('0x4c')]=_0x1fe8d7[_0xa41a('0x4c')][_0xa41a('0x52')]?_0x1fe8d7[_0xa41a('0x4c')]:_0x563dc0[_0xa41a('0xd1')];_0x1fe8d7[_0xa41a('0xdd')]=qs[_0xa41a('0xd6')](_0x141fb1[_0xa41a('0x48')]['sort']);_0x1fe8d7[_0xa41a('0x47')]=qs['filters'](_[_0xa41a('0xde')](_0x141fb1[_0xa41a('0x48')],_0x563dc0['filters']));if(_0x141fb1[_0xa41a('0x48')][_0xa41a('0x32')]){_0x1fe8d7[_0xa41a('0x47')]=_[_0xa41a('0x5a')](_0x1fe8d7[_0xa41a('0x47')],{'$or':_[_0xa41a('0x34')](_0x1fe8d7[_0xa41a('0x4c')],function(_0x58287c){var _0x32a547={};_0x32a547[_0x58287c]={'$like':'%'+_0x141fb1['query'][_0xa41a('0x32')]+'%'};return _0x32a547;})});}_0x1fe8d7[_0xa41a('0xd1')]=db[_0xa41a('0x3d')];_0x1fe8d7['as']=_0xa41a('0x86');_0x1fe8d7=_[_0xa41a('0x5a')]({},_0x1fe8d7,_0x141fb1[_0xa41a('0xd7')]);return _0x7c890[_0xa41a('0x11e')]({'include':[_0x1fe8d7]});}})[_0xa41a('0x27')](function(_0x288f0d){if(_0x288f0d){var _0x2fbb66={},_0x3eab12=[];for(var _0x4affa2=0x0;_0x4affa2<_0x288f0d[_0xa41a('0x52')];_0x4affa2+=0x1){for(var _0x4dc3ba=0x0,_0x24cb56;_0x4dc3ba<_0x288f0d[_0x4affa2][_0xa41a('0x86')]['length'];_0x4dc3ba+=0x1){_0x24cb56=_0x288f0d[_0x4affa2][_0xa41a('0x86')][_0x4dc3ba][_0xa41a('0x2c')]({'plain':!![]});_0x2fbb66[_0x24cb56['id']]=_0x24cb56;}}_0x2fbb66=_[_0xa41a('0x11f')](_0x2fbb66);for(var _0x59af8b=qs[_0xa41a('0x1b')](_0x141fb1[_0xa41a('0x48')]['offset']);_0x59af8b<_0x2fbb66[_0xa41a('0x52')]&&_0x3eab12[_0xa41a('0x52')]=_0xe500e3){_0x28ed9a=_0xe500e3;_0x4865ba=0xc8;}else{_0x4865ba=0xce;}_0x15f6a8[_0x4a12('0x17')](_0x4865ba);return _0x15f6a8['set'](_0x4a12('0x1e'),_0x1c5c0b+'-'+_0x28ed9a+'/'+_0xe500e3)[_0x4a12('0x19')](_0x31d40a);}return null;};}function respondWithRpcPromise(_0x1b7557,_0x26fdf8,_0x248211,_0x5d0714){return new Promise(function(_0x60c1a3,_0x44be1b){var _0x4c4868=_0x5d0714||amiClient;return _0x4c4868[_0x4a12('0x1f')](_0x1b7557,_0x248211)['then'](function(_0x2dab70){logger[_0x4a12('0x20')](_0x4a12('0x21'),_0x26fdf8,_0x4a12('0x22'));logger[_0x4a12('0x23')](_0x4a12('0x24'),_0x26fdf8,_0x4a12('0x22'),JSON['stringify'](_0x2dab70));if(_0x2dab70[_0x4a12('0x25')]){if(_0x2dab70['error'][_0x4a12('0x26')]===0x1f4){logger[_0x4a12('0x25')](_0x4a12('0x21'),_0x26fdf8,_0x2dab70[_0x4a12('0x25')][_0x4a12('0x27')]);return _0x44be1b(_0x2dab70['error'][_0x4a12('0x27')]);}logger[_0x4a12('0x25')](_0x4a12('0x21'),_0x26fdf8,_0x2dab70['error'][_0x4a12('0x27')]);return _0x60c1a3(_0x2dab70[_0x4a12('0x25')]['message']);}else{logger[_0x4a12('0x20')](_0x4a12('0x21'),_0x26fdf8,_0x4a12('0x22'));_0x60c1a3(_0x2dab70[_0x4a12('0x28')][_0x4a12('0x27')]);}})[_0x4a12('0x29')](function(_0x41180a){logger[_0x4a12('0x25')](_0x4a12('0x21'),_0x26fdf8,_0x41180a);_0x44be1b(_0x41180a);});});}function saveUpdates(_0x2510be){return function(_0x113cbe){if(_0x113cbe){return _0x113cbe[_0x4a12('0x2a')](_0x2510be)[_0x4a12('0x2b')](function(_0x301fa7){if(_0x301fa7['role']===_0x4a12('0x2c')){socket[_0x4a12('0x2d')]('userNotification:recalc:'+_0x301fa7['id'],_0x301fa7);}return _0x301fa7;});}return null;};}function removeEntity(_0x3687cf,_0x6a79e5){return function(_0xd68cb2){if(_0xd68cb2){return _0xd68cb2['destroy']({'transaction':_0x6a79e5})[_0x4a12('0x2b')](function(){var _0x28891b=_0xd68cb2['get']({'plain':!![]});if(_0x28891b[_0x4a12('0x2e')]===_0x4a12('0x2f'))return;var _0x4b8dbc=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x4a12('0x30'),'value':_0x4a12('0x2c'),'ignore':![]},{'name':_0x4a12('0x31'),'value':'telephone','ignore':![]}];var _0x5eaa04=_(_0x4b8dbc)[_0x4a12('0x32')]('ignore')[_0x4a12('0x33')](_0x4a12('0x34'))['value']();if(_[_0x4a12('0x35')](_0x5eaa04,_0x28891b[_0x4a12('0x2e')])){return;}var _0x59fbf5=_['find'](_0x4b8dbc,[_0x4a12('0x34'),_0x28891b[_0x4a12('0x2e')]])[_0x4a12('0x36')];return db[_0x4a12('0x37')][_0x4a12('0x38')]({'where':{'type':_0x59fbf5,'resourceId':_0x28891b['id']},'transaction':_0x6a79e5})[_0x4a12('0x2b')](function(){return _0xd68cb2;});})['then'](function(){_0x3687cf['status'](0xcc)[_0x4a12('0x18')]();});}};}function handleEntityNotFound(_0x27c2aa){return function(_0xfe4070){if(!_0xfe4070){_0x27c2aa[_0x4a12('0x39')](0x194);}return _0xfe4070;};}function handleError(_0x47da1c,_0x158164){_0x158164=_0x158164||0x1f4;return function(_0x32768b){logger[_0x4a12('0x25')](_0x32768b['stack']);if(_0x32768b['name']){delete _0x32768b[_0x4a12('0x36')];}_0x47da1c[_0x4a12('0x17')](_0x158164)[_0x4a12('0x3a')](_0x32768b);};}function getUserAttributes(){return _(db[_0x4a12('0x3b')][_0x4a12('0x3c')])[_0x4a12('0x33')](function(_0x3fd3d7){return{'name':_0x3fd3d7[_0x4a12('0x3d')],'type':_0x3fd3d7['type'][_0x4a12('0x3e')]};})[_0x4a12('0x32')](function(_0x3f3ff1){return!['password',_0x4a12('0x3f'),_0x4a12('0x40'),_0x4a12('0x41'),'resetPasswordExpires','md5secret'][_0x4a12('0x35')](_0x3f3ff1[_0x4a12('0x36')]);})[_0x4a12('0x34')]();}exports[_0x4a12('0x42')]=function(_0x426f6f,_0x5105ea){var _0x4ab678={},_0x395be9={'count':0x0,'rows':[]};var _0x202dc9=getUserAttributes();_0x4ab678=qs[_0x4a12('0x43')](_0x202dc9,_0x426f6f);var _0xb9c9b3={'where':_0x4ab678[_0x4a12('0x44')]};return db['User'][_0x4a12('0x1d')](_0xb9c9b3)[_0x4a12('0x2b')](function(_0x27a294){_0x395be9['count']=_0x27a294;if(_0x426f6f['query'][_0x4a12('0x45')]){_0x4ab678[_0x4a12('0x46')]=[{'all':!![]}];}if(_0x426f6f[_0x4a12('0x47')][_0x4a12('0x48')]===_0x4a12('0x49')){_0x4ab678[_0x4a12('0x46')]=[{'model':db[_0x4a12('0x4a')],'as':_0x4a12('0x48')}];}if(!_[_0x4a12('0x35')](_0x4ab678[_0x4a12('0x4b')],'id')){_0x4ab678[_0x4a12('0x4b')]['push']('id');}return db[_0x4a12('0x3b')][_0x4a12('0x4c')](_0x4ab678);})['then'](function(_0x4e0a22){_0x395be9[_0x4a12('0x4d')]=_0x4e0a22;if(_0x426f6f[_0x4a12('0x47')]['openTabs']===_0x4a12('0x49')){var _0x1449d6=[];for(var _0x5641d6=0x0;_0x5641d6<_0x395be9[_0x4a12('0x4d')][_0x4a12('0x4e')];_0x5641d6++){_0x1449d6[_0x4a12('0x4f')](get_open_tabs(_0x4a12('0x50'),_0x395be9[_0x4a12('0x4d')][_0x5641d6][_0x4a12('0x51')]));_0x1449d6[_0x4a12('0x4f')](get_open_tabs(_0x4a12('0x52'),_0x395be9[_0x4a12('0x4d')][_0x5641d6][_0x4a12('0x51')]));_0x1449d6[_0x4a12('0x4f')](get_open_tabs('fax',_0x395be9[_0x4a12('0x4d')][_0x5641d6]['dataValues']));_0x1449d6[_0x4a12('0x4f')](get_open_tabs(_0x4a12('0x53'),_0x395be9[_0x4a12('0x4d')][_0x5641d6]['dataValues']));_0x1449d6['push'](get_open_tabs(_0x4a12('0x54'),_0x395be9[_0x4a12('0x4d')][_0x5641d6][_0x4a12('0x51')]));_0x1449d6[_0x4a12('0x4f')](get_open_tabs('whatsapp',_0x395be9[_0x4a12('0x4d')][_0x5641d6][_0x4a12('0x51')]));}return Promise[_0x4a12('0x55')](_0x1449d6)[_0x4a12('0x2b')](function(){return _0x395be9;});}else{return _0x395be9;}})[_0x4a12('0x2b')](respondWithFilteredResult(_0x5105ea,_0x4ab678))[_0x4a12('0x29')](handleError(_0x5105ea,null));};exports['show']=function(_0x5416ce,_0x9d7c73){var _0x49ed57=getUserAttributes();_0x5416ce[_0x4a12('0x47')]['id']=_0x5416ce[_0x4a12('0x56')]['id'];var _0xfca1be=qs[_0x4a12('0x43')](_0x49ed57,_0x5416ce);if(_0x5416ce['query'][_0x4a12('0x45')]){_0xfca1be[_0x4a12('0x46')]=[{'all':!![]}];}if(_0x5416ce['query']['userSetting']===_0x4a12('0x49')){_0xfca1be[_0x4a12('0x46')]=[{'model':db[_0x4a12('0x4a')],'as':_0x4a12('0x48')}];}_0xfca1be=_[_0x4a12('0x57')]({},_0xfca1be,_0x5416ce[_0x4a12('0x58')]);if(!_[_0x4a12('0x35')](_0xfca1be['attributes'],'id')){_0xfca1be[_0x4a12('0x4b')][_0x4a12('0x4f')]('id');}return db[_0x4a12('0x3b')][_0x4a12('0x59')](_0xfca1be)['then'](handleEntityNotFound(_0x9d7c73,null))[_0x4a12('0x2b')](function(_0xad2ce4){var _0x2b04d7=[];values=_0xad2ce4;if(_0x5416ce[_0x4a12('0x47')][_0x4a12('0x5a')]===_0x4a12('0x49')){_0x2b04d7['push'](get_open_tabs(_0x4a12('0x50'),_0xad2ce4[_0x4a12('0x51')]));_0x2b04d7[_0x4a12('0x4f')](get_open_tabs(_0x4a12('0x52'),_0xad2ce4[_0x4a12('0x51')]));_0x2b04d7[_0x4a12('0x4f')](get_open_tabs(_0x4a12('0x54'),_0xad2ce4['dataValues']));_0x2b04d7[_0x4a12('0x4f')](get_open_tabs(_0x4a12('0x5b'),_0xad2ce4['dataValues']));_0x2b04d7[_0x4a12('0x4f')](get_open_tabs(_0x4a12('0x5c'),_0xad2ce4[_0x4a12('0x51')]));_0x2b04d7['push'](get_open_tabs('mail',_0xad2ce4[_0x4a12('0x51')]));return Promise[_0x4a12('0x55')](_0x2b04d7);}else{return values;}})[_0x4a12('0x2b')](function(){return values;})[_0x4a12('0x2b')](respondWithResult(_0x9d7c73,null))[_0x4a12('0x29')](handleError(_0x9d7c73,null));};exports['update']=function(_0x4ac6c4,_0x6669a7){if(_0x4ac6c4[_0x4a12('0x5d')]['id']){delete _0x4ac6c4[_0x4a12('0x5d')]['id'];}delete _0x4ac6c4[_0x4a12('0x5d')][_0x4a12('0x2e')];return db['User'][_0x4a12('0x59')]({'where':{'id':_0x4ac6c4['params']['id']}})[_0x4a12('0x2b')](handleEntityNotFound(_0x6669a7,null))[_0x4a12('0x2b')](saveUpdates(_0x4ac6c4['body'],null))[_0x4a12('0x2b')](respondWithResult(_0x6669a7,null))[_0x4a12('0x29')](handleError(_0x6669a7,null));};exports[_0x4a12('0x5e')]=function(_0x4871bb,_0x20fb39){return db['User'][_0x4a12('0x5e')]()['then'](respondWithResult(_0x20fb39,null))[_0x4a12('0x29')](handleError(_0x20fb39,null));};exports[_0x4a12('0x5f')]=function(_0xf029d8,_0x158d63){return db['User'][_0x4a12('0x59')]({'where':{'id':_0xf029d8['params']['id']}})['then'](handleEntityNotFound(_0x158d63,null))[_0x4a12('0x2b')](function(_0xb4d82d){if(_0xb4d82d){return _0xb4d82d['addContacts'](_0xf029d8[_0x4a12('0x5d')]['ids'],_[_0x4a12('0x60')](_0xf029d8[_0x4a12('0x5d')],[_0x4a12('0x61'),'id'])||{});}})['then'](respondWithResult(_0x158d63,null))[_0x4a12('0x29')](handleError(_0x158d63,null));};function validateUser(_0x7be9d7){return new Promise(function(_0x15a772,_0x57615d){if(_0x7be9d7['internal'])return _0x15a772(_0x7be9d7);return db[_0x4a12('0x62')][_0x4a12('0x63')](0x1)[_0x4a12('0x2b')](function(_0xf83e4b){if(_0xf83e4b[_0x4a12('0x64')])authService[_0x4a12('0x65')](_0x7be9d7[_0x4a12('0x66')]);db[_0x4a12('0x3b')][_0x4a12('0x67')](_0x4a12('0x68'))[_0x4a12('0x2b')](function(_0x1b03e2){if(_['isNil'](_0x1b03e2)){_0x7be9d7[_0x4a12('0x68')]=_0xf83e4b[_0x4a12('0x69')]||0x1;return;}if(_[_0x4a12('0x6a')](_0xf83e4b[_0x4a12('0x69')])||_0xf83e4b[_0x4a12('0x69')]===_0x1b03e2){_0x7be9d7[_0x4a12('0x68')]=_0x1b03e2+0x1;return;}if(_0xf83e4b[_0x4a12('0x69')]>_0x1b03e2){_0x7be9d7[_0x4a12('0x68')]=_0xf83e4b[_0x4a12('0x69')];return;}return db['sequelize'][_0x4a12('0x47')](_0x4a12('0x6b'),{'type':db[_0x4a12('0x6c')][_0x4a12('0x6d')][_0x4a12('0x6e')]})[_0x4a12('0x2b')](function(_0x4ca54d){if(_0x4ca54d&&_0x4ca54d[_0x4a12('0x4e')]){for(var _0x25896e=0x0,_0x243567=_0x4ca54d['length'];_0x25896e<_0x243567&&_[_0x4a12('0x6a')](_0x7be9d7[_0x4a12('0x68')]);_0x25896e++){if(_0xf83e4b[_0x4a12('0x69')]<=_0x4ca54d[_0x25896e]['from']){_0x7be9d7[_0x4a12('0x68')]=_0x4ca54d[_0x25896e]['from'];}else if(_0xf83e4b[_0x4a12('0x69')]>_0x4ca54d[_0x25896e][_0x4a12('0x6f')]&&_0xf83e4b[_0x4a12('0x69')]<=_0x4ca54d[_0x25896e]['to']){_0x7be9d7[_0x4a12('0x68')]=_0xf83e4b[_0x4a12('0x69')];}}}if(_[_0x4a12('0x6a')](_0x7be9d7[_0x4a12('0x68')])){_0x7be9d7[_0x4a12('0x68')]=_0x1b03e2+0x1;}return _0x15a772(_0x7be9d7);});});})[_0x4a12('0x29')](function(_0x3b644a){_0x57615d(_0x3b644a);});});}function updateUser(_0x5a72ce){return new Promise(function(_0x3e9db4,_0x3d2819){try{if(_0x5a72ce['voicemail']){_0x5a72ce['mailbox']=_0x5a72ce[_0x4a12('0x68')];_0x5a72ce['VoiceMail']={'mailbox':_0x5a72ce['internal'],'password':_0x5a72ce['password'],'fullname':_0x5a72ce[_0x4a12('0x70')],'email':_0x5a72ce[_0x4a12('0x71')]};}if(_0x5a72ce[_0x4a12('0x2e')]===_0x4a12('0x2c')){if(!_0x5a72ce[_0x4a12('0x72')])_0x5a72ce[_0x4a12('0x72')]=[_0x4a12('0x73'),_0x4a12('0x74'),_0x4a12('0x75'),_0x4a12('0x76'),_0x4a12('0x77'),_0x4a12('0x78'),_0x4a12('0x79'),_0x4a12('0x7a'),_0x4a12('0x7b'),_0x4a12('0x7c'),_0x4a12('0x7d'),_0x4a12('0x7e'),_0x4a12('0x7f'),'114','115'];}_0x3e9db4(_0x5a72ce);}catch(_0x52b39c){_0x3d2819(_0x52b39c);}});}exports['create']=function(_0x502b10,_0x2a3e27){if(_0x502b10[_0x4a12('0x80')]['role']===_0x4a12('0x2c'))throw new Error(_0x4a12('0x81'));if(_0x502b10['body']['role']==='user'&&_0x502b10[_0x4a12('0x80')][_0x4a12('0x2e')]!==_0x4a12('0x2f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x502b10['body']['role']===_0x4a12('0x2f')&&_0x502b10[_0x4a12('0x80')][_0x4a12('0x2e')]!==_0x4a12('0x2f')){throw new Error(_0x4a12('0x82'));}return licenseUtil[_0x4a12('0x83')]([_0x502b10[_0x4a12('0x5d')]])['then'](function(){return validateUser(_0x502b10[_0x4a12('0x5d')]);})[_0x4a12('0x2b')](function(_0x2e1c6f){return updateUser(_0x2e1c6f)['then'](function(_0x110214){if(_0x110214['role']==='admin'){_0x110214[_0x4a12('0x84')]=_0x502b10[_0x4a12('0x80')]['settingsEnabled'];delete _0x110214[_0x4a12('0x85')];}return _0x110214;});})[_0x4a12('0x2b')](function(_0x51bab1){return db[_0x4a12('0x3b')][_0x4a12('0x86')](_0x51bab1,{'include':[{'model':db['VoiceMail'],'as':_0x4a12('0x87')}]});})[_0x4a12('0x2b')](function(_0x43f4e5){if(_0x502b10[_0x4a12('0x5d')][_0x4a12('0x2e')]===_0x4a12('0x80'))return _0x43f4e5;if(_0x502b10[_0x4a12('0x80')][_0x4a12('0x2e')]!=='user')return _0x43f4e5;return db[_0x4a12('0x88')][_0x4a12('0x59')]({'where':{'name':_0x43f4e5[_0x4a12('0x2e')]===_0x4a12('0x2c')?_0x4a12('0x30'):'Telephones','userProfileId':_0x502b10[_0x4a12('0x80')][_0x4a12('0x85')]},'raw':!![]})[_0x4a12('0x2b')](function(_0x37276e){if(!_0x37276e||_0x37276e[_0x4a12('0x89')]!=0x0)return _0x43f4e5;return db[_0x4a12('0x37')]['create']({'name':_0x43f4e5['name'],'resourceId':_0x43f4e5['id'],'type':_0x37276e[_0x4a12('0x36')],'sectionId':_0x37276e['id']},{})[_0x4a12('0x2b')](function(){return _0x43f4e5;});})[_0x4a12('0x29')](function(_0x42b81f){logger[_0x4a12('0x25')](_0x4a12('0x8a'),_0x42b81f);throw _0x42b81f;});})['then'](respondWithResult(_0x2a3e27,0xc9))[_0x4a12('0x29')](handleError(_0x2a3e27,null));};exports[_0x4a12('0x8b')]=function(_0x253950,_0x49d06d){var _0xa10136=_0x253950[_0x4a12('0x5d')];var _0x5e362f=[];if(_0x253950[_0x4a12('0x80')]['role']===_0x4a12('0x2c'))throw new Error(_0x4a12('0x81'));if(_[_0x4a12('0x8c')](_0xa10136,[_0x4a12('0x2e'),_0x4a12('0x80')])&&_0x253950[_0x4a12('0x80')][_0x4a12('0x2e')]!==_0x4a12('0x2f')){throw new Error(_0x4a12('0x8d'));}if(_[_0x4a12('0x8c')](_0xa10136,[_0x4a12('0x2e'),'admin'])&&_0x253950[_0x4a12('0x80')][_0x4a12('0x2e')]!==_0x4a12('0x2f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x4a12('0x83')](_0xa10136)['then'](function(){return validateUser(_0xa10136[0x0]);})[_0x4a12('0x2b')](function(){for(var _0x23590d=0x1;_0x23590d<_0xa10136[_0x4a12('0x4e')];_0x23590d++){var _0x5d34cb=_0xa10136[_0x23590d-0x1][_0x4a12('0x68')];if(!_0xa10136[_0x23590d][_0x4a12('0x68')])_0xa10136[_0x23590d]['internal']=_0x5d34cb+0x1;_0x5e362f[_0x4a12('0x4f')](validateUser(_0xa10136[_0x23590d]));}return Promise['all'](_0x5e362f);})[_0x4a12('0x2b')](function(){_0x5e362f=[];for(var _0x3019dc=0x0;_0x3019dc<_0xa10136[_0x4a12('0x4e')];_0x3019dc++){_0x5e362f[_0x4a12('0x4f')](updateUser(_0xa10136[_0x3019dc]));}return Promise[_0x4a12('0x55')](_0x5e362f);})[_0x4a12('0x2b')](function(){_0x5e362f=_0xa10136[_0x4a12('0x33')](function(_0x2ca6ac){return db['User'][_0x4a12('0x86')](_0x2ca6ac,{'include':[{'model':db[_0x4a12('0x87')],'as':'VoiceMail'}]})['then'](function(_0x298f3e){_0x2ca6ac['id']=_0x298f3e['id'];return _0x2ca6ac;});});return Promise[_0x4a12('0x55')](_0x5e362f);})[_0x4a12('0x2b')](function(_0x38c897){if(_0x253950['body']['role']===_0x4a12('0x80'))return _0x38c897;if(_0x253950[_0x4a12('0x80')]['role']!==_0x4a12('0x80'))return _0x38c897;var _0x33b969=_['some'](_0x38c897,function(_0x2ffa8c){return _0x2ffa8c[_0x4a12('0x2e')]==='agent'||_0x2ffa8c[_0x4a12('0x2e')]==='telephone';});if(!_0x33b969)return _0x38c897;return db[_0x4a12('0x88')][_0x4a12('0x4c')]({'where':{'name':{'$or':[_0x4a12('0x30'),_0x4a12('0x31')]},'userProfileId':_0x253950[_0x4a12('0x80')][_0x4a12('0x85')]},'raw':!![]})['then'](function(_0x406358){if(_[_0x4a12('0x8e')](_0x406358)||!_['some'](_0x406358,[_0x4a12('0x89'),0x0]))return _0x38c897;_0x5e362f=[];var _0x59e3e6=_(_0x406358)[_0x4a12('0x33')](function(_0x263e7f){if(_0x263e7f['autoAssociation']===0x1)return;return _0x263e7f[_0x4a12('0x36')]===_0x4a12('0x30')?_0x4a12('0x2c'):'telephone';})[_0x4a12('0x8f')]()['value']();for(var _0x5ecf22=0x0;_0x5ecf22<_0x38c897['length'];_0x5ecf22++){if(!_[_0x4a12('0x35')](_0x59e3e6,_0x38c897[_0x5ecf22][_0x4a12('0x2e')]))return;var _0x144616=_0x38c897[_0x5ecf22][_0x4a12('0x2e')]==='agent'?_0x4a12('0x30'):'Telephones';_0x5e362f['push'](db[_0x4a12('0x37')][_0x4a12('0x86')]({'name':_0x38c897[_0x5ecf22][_0x4a12('0x36')],'resourceId':_0x38c897[_0x5ecf22]['id'],'type':_0x144616,'sectionId':_['find'](_0x406358,[_0x4a12('0x36'),_0x144616])['id']},{}));}return Promise[_0x4a12('0x55')](_0x5e362f);});})[_0x4a12('0x2b')](respondWithResult(_0x49d06d,0xc9))['catch'](handleError(_0x49d06d,null));};exports['changePassword']=function(_0x351aad,_0x16369e){if(_0x351aad[_0x4a12('0x5d')]['id']){delete _0x351aad[_0x4a12('0x5d')]['id'];}return db[_0x4a12('0x3b')]['find']({'where':{'id':_0x351aad[_0x4a12('0x56')]['id']}})['then'](function(_0x54db20){if(!_0x54db20)return null;if(_0x54db20['id']===_0x351aad[_0x4a12('0x80')]['id']){if(!_0x351aad[_0x4a12('0x5d')][_0x4a12('0x90')]||!_0x351aad[_0x4a12('0x5d')][_0x4a12('0x91')]){throw new db[(_0x4a12('0x92'))][(_0x4a12('0x93'))](_0x4a12('0x94'));}if(!_0x54db20[_0x4a12('0x95')](_0x351aad[_0x4a12('0x5d')][_0x4a12('0x90')])){throw new db[(_0x4a12('0x92'))][(_0x4a12('0x93'))](_0x4a12('0x96'));}if(_0x351aad['body'][_0x4a12('0x90')]===_0x351aad[_0x4a12('0x5d')]['newPassword']){throw new db[(_0x4a12('0x92'))]['ValidationError'](_0x4a12('0x97'));}}else if(_0x351aad['user'][_0x4a12('0x2e')]===_0x4a12('0x2f')){if(!_0x351aad[_0x4a12('0x5d')]['newPassword']){throw new db[(_0x4a12('0x92'))][(_0x4a12('0x93'))](_0x4a12('0x98'));}}else if(_0x351aad[_0x4a12('0x80')]['role']===_0x4a12('0x80')){if(!_0x351aad[_0x4a12('0x5d')][_0x4a12('0x91')]){throw new db[(_0x4a12('0x92'))][(_0x4a12('0x93'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x54db20[_0x4a12('0x2e')]!=='agent'){throw new db[(_0x4a12('0x92'))][(_0x4a12('0x93'))](_0x4a12('0x81'));}}else{throw new db[(_0x4a12('0x92'))][(_0x4a12('0x93'))](_0x4a12('0x81'));}return _0x54db20;})[_0x4a12('0x2b')](handleEntityNotFound(_0x16369e,null))[_0x4a12('0x2b')](function(_0x18c0d3){return db['Setting'][_0x4a12('0x99')]({'attributes':['id',_0x4a12('0x64'),_0x4a12('0x9a'),_0x4a12('0x9b')]})['then'](function(_0x536123){if(_0x536123[_0x4a12('0x64')])authService['validatePasswordPattern'](_0x351aad[_0x4a12('0x5d')][_0x4a12('0x91')]);if(!_0x536123['enforcePasswordHistory']||!_0x18c0d3['previousPasswords'])return _0x18c0d3;authService[_0x4a12('0x9c')](_0x351aad[_0x4a12('0x5d')][_0x4a12('0x91')],_0x18c0d3[_0x4a12('0x40')],_0x536123[_0x4a12('0x9b')]);return _0x18c0d3;})[_0x4a12('0x2b')](saveUpdates({'password':_0x351aad[_0x4a12('0x5d')][_0x4a12('0x91')],'passwordResetAt':_0x351aad[_0x4a12('0x80')]['id']==_0x351aad[_0x4a12('0x56')]['id']?moment():null,'previousPasswords':authService[_0x4a12('0x9d')](_0x351aad['body']['newPassword'],_0x18c0d3[_0x4a12('0x40')])},null));})['then'](respondWithResult(_0x16369e,null))[_0x4a12('0x29')](handleError(_0x16369e,null));};exports[_0x4a12('0x9e')]=function(_0x6e241d,_0x4783f3){var _0x4ee7ac=_0x6e241d[_0x4a12('0x5d')][_0x4a12('0x9f')];return db['User'][_0x4a12('0x59')]({'where':{'id':_0x6e241d[_0x4a12('0x56')]['id']},'attributes':['id',_0x4a12('0x36'),_0x4a12('0x2e'),_0x4a12('0xa0'),_0x4a12('0xa1'),_0x4a12('0xa2'),'interface']})[_0x4a12('0x2b')](handleEntityNotFound(_0x4783f3,null))[_0x4a12('0x2b')](function(_0x49c944){if(_0x49c944){if(!utils[_0x4a12('0xa3')](_0x4ee7ac)){throw new db['Sequelize'][(_0x4a12('0x93'))]('Unknown\x20channel');}return _0x49c944['add'+_[_0x4a12('0xa4')](_0x4ee7ac[_0x4a12('0xa5')]())+_0x4a12('0xa6')](_0x6e241d[_0x4a12('0x5d')][_0x4a12('0x61')],{'penalty':_0x6e241d[_0x4a12('0x5d')][_0x4a12('0xa7')]||0x0})[_0x4a12('0xa8')](function(_0x5c81c3){for(var _0x22336d=0x0;_0x22336d<_0x6e241d[_0x4a12('0x5d')][_0x4a12('0x61')]['length'];_0x22336d+=0x1){var _0x49c387={'UserId':Number(_0x6e241d[_0x4a12('0x56')]['id'])};_0x49c387[_[_0x4a12('0xa4')](_0x4ee7ac[_0x4a12('0xa5')]())+_0x4a12('0xa9')]=Number(_0x6e241d['body'][_0x4a12('0x61')][_0x22336d]);socket['emit'](_0x4a12('0x80')+_['capitalize'](_0x4ee7ac[_0x4a12('0xa5')]())+'Queue:save',_0x49c387);}return _0x5c81c3;})[_0x4a12('0x2b')](function(){if(_0x4ee7ac===_0x4a12('0xaa')){return db['VoiceQueue'][_0x4a12('0x4c')]({'where':{'id':_0x6e241d[_0x4a12('0x5d')][_0x4a12('0x61')]||[]},'raw':!![],'attributes':['id',_0x4a12('0x36')]});}})[_0x4a12('0x2b')](function(_0x19934a){var _0x5009fc=_0x49c944[_0x4a12('0xab')]({'plain':!![]});var _0x4f94b5=[];if(_0x4ee7ac==='voice'&&_0x5009fc[_0x4a12('0x2e')]==='agent'&&_0x5009fc['online']){for(let _0x100f7c=0x0;_0x100f7c<_0x19934a['length'];_0x100f7c+=0x1){_0x4f94b5[_0x4a12('0x4f')]({'membername':_0x5009fc[_0x4a12('0x36')],'UserId':_0x5009fc['id'],'queue_name':_0x19934a[_0x100f7c]['name'],'VoiceQueueId':_0x19934a[_0x100f7c]['id'],'interface':_[_0x4a12('0x6a')](_0x5009fc['interface'])?util[_0x4a12('0xac')]('SIP/%s',_0x5009fc['name']):_0x5009fc['interface'],'paused':_0x5009fc[_0x4a12('0xa2')]||![],'penalty':_0x6e241d[_0x4a12('0x5d')][_0x4a12('0xa7')]||0x0});}return Promise[_0x4a12('0x55')](_0x4f94b5[_0x4a12('0x33')](function(_0x5b3d4c){return db[_0x4a12('0xad')]['upsert'](_0x5b3d4c);}));}return _0x49c944;});}})['then'](respondWithStatusCode(_0x4783f3,null))['catch'](handleError(_0x4783f3,null));};exports['removeQueues']=function(_0x36ed36,_0x2cba9d){var _0x49bd7c,_0x508399;return db['User'][_0x4a12('0x59')]({'where':{'id':_0x36ed36['params']['id']},'attributes':['id','name',_0x4a12('0x2e')]})[_0x4a12('0x2b')](handleEntityNotFound(_0x2cba9d,null))[_0x4a12('0x2b')](function(_0xd9308a){if(_0xd9308a){_0x49bd7c=_0xd9308a;if(!_0x36ed36[_0x4a12('0x47')]['channel']||!utils[_0x4a12('0xa3')](_0x36ed36[_0x4a12('0x47')]['channel'])){throw new db[(_0x4a12('0x92'))]['ValidationError'](_0x4a12('0xae'));}return _0xd9308a['remove'+_[_0x4a12('0xa4')](_0x36ed36['query'][_0x4a12('0x9f')][_0x4a12('0xa5')]())+'Queues'](_0x36ed36[_0x4a12('0x47')][_0x4a12('0x61')]);}})[_0x4a12('0x2b')](function(_0x57e822){if(_[_0x4a12('0xaf')](_0x36ed36['query'][_0x4a12('0x61')])){for(var _0x586b3e=0x0;_0x586b3e<_0x36ed36[_0x4a12('0x47')][_0x4a12('0x61')][_0x4a12('0x4e')];_0x586b3e+=0x1){_0x508399={'UserId':Number(_0x36ed36['params']['id'])};_0x508399[_[_0x4a12('0xa4')](_0x36ed36['query'][_0x4a12('0x9f')]['toLowerCase']())+_0x4a12('0xa9')]=Number(_0x36ed36[_0x4a12('0x47')][_0x4a12('0x61')][_0x586b3e]);socket[_0x4a12('0x2d')](_0x4a12('0x80')+_[_0x4a12('0xa4')](_0x36ed36[_0x4a12('0x47')][_0x4a12('0x9f')][_0x4a12('0xa5')]())+_0x4a12('0xb0'),_0x508399);}}else{_0x508399={'UserId':Number(_0x36ed36['params']['id'])};_0x508399[_['capitalize'](_0x36ed36[_0x4a12('0x47')][_0x4a12('0x9f')][_0x4a12('0xa5')]())+_0x4a12('0xa9')]=Number(_0x36ed36[_0x4a12('0x47')]['ids']);socket[_0x4a12('0x2d')](_0x4a12('0x80')+_[_0x4a12('0xa4')](_0x36ed36[_0x4a12('0x47')][_0x4a12('0x9f')][_0x4a12('0xa5')]())+_0x4a12('0xb0'),_0x508399);}return _0x57e822;})[_0x4a12('0x2b')](function(){if(_0x36ed36[_0x4a12('0x47')][_0x4a12('0x9f')]==='voice'){return db[_0x4a12('0xad')][_0x4a12('0x38')]({'where':{'UserId':_0x36ed36[_0x4a12('0x56')]['id'],'VoiceQueueId':_0x36ed36[_0x4a12('0x47')][_0x4a12('0x61')]},'individualHooks':!![]})['then'](function(){return _0x49bd7c;});}return _0x49bd7c;})['then'](respondWithStatusCode(_0x2cba9d,null))[_0x4a12('0x29')](handleError(_0x2cba9d,null));};exports['addAvatar']=function(_0x3a5df6,_0x5a329e){_0x3a5df6['body'][_0x4a12('0xb1')]=_0x3a5df6['file'][_0x4a12('0xb2')];return db[_0x4a12('0x3b')]['find']({'where':{'id':_0x3a5df6['params']['id']}})[_0x4a12('0x2b')](handleEntityNotFound(_0x5a329e,null))[_0x4a12('0x2b')](saveUpdates(_0x3a5df6[_0x4a12('0x5d')],null))[_0x4a12('0x2b')](respondWithResult(_0x5a329e,null))['catch'](handleError(_0x5a329e,null));};exports[_0x4a12('0xb3')]=function(_0x4eb321,_0x5a46ad){var _0x3b498e=path[_0x4a12('0xb4')](config[_0x4a12('0xb5')],_0x4a12('0xb6'));return db[_0x4a12('0x3b')][_0x4a12('0x59')]({'where':{'id':_0x4eb321[_0x4a12('0x56')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x4a12('0x2b')](handleEntityNotFound(_0x5a46ad,null))['then'](function(_0x39ec2b){if(_0x39ec2b){if(_[_0x4a12('0x6a')](_0x39ec2b[_0x4a12('0xb1')])){return _0x5a46ad[_0x4a12('0xb7')](_0x3b498e);}else{if(!fs[_0x4a12('0xb8')](path[_0x4a12('0xb4')](config['root'],_0x4a12('0xb9'),_0x39ec2b[_0x4a12('0xb1')]))){return _0x5a46ad[_0x4a12('0xb7')](_0x3b498e);}return _0x5a46ad[_0x4a12('0xb7')](path['join'](config[_0x4a12('0xb5')],_0x4a12('0xb9'),_0x39ec2b['userpic']));}}})[_0x4a12('0x29')](handleError(_0x5a46ad,null));};exports[_0x4a12('0xba')]=function(_0x47b9e3,_0x42a004){return db[_0x4a12('0x3b')][_0x4a12('0x59')]({'where':{'id':_0x47b9e3[_0x4a12('0x56')]['id']},'attributes':['id']})[_0x4a12('0x2b')](handleEntityNotFound(_0x42a004,null))[_0x4a12('0x2b')](function(_0x28cf49){var _0x24ebc2=[];values=_0x28cf49[_0x4a12('0x51')];_0x24ebc2['push'](get_open_tabs(_0x4a12('0x50'),_0x28cf49[_0x4a12('0x51')]));_0x24ebc2['push'](get_open_tabs(_0x4a12('0x52'),_0x28cf49[_0x4a12('0x51')]));_0x24ebc2['push'](get_open_tabs(_0x4a12('0x54'),_0x28cf49['dataValues']));_0x24ebc2[_0x4a12('0x4f')](get_open_tabs(_0x4a12('0x5b'),_0x28cf49[_0x4a12('0x51')]));_0x24ebc2[_0x4a12('0x4f')](get_open_tabs(_0x4a12('0x5c'),_0x28cf49[_0x4a12('0x51')]));_0x24ebc2[_0x4a12('0x4f')](get_open_tabs(_0x4a12('0x53'),_0x28cf49['dataValues']));return Promise['all'](_0x24ebc2);})[_0x4a12('0x2b')](function(_0xa2caf9){if(_0xa2caf9){var _0xea0a3a=_['map'](values[_0x4a12('0xbb')],function(_0x5a2f2b){return{'channel':_0x4a12('0xbc'),'id':_0x5a2f2b['id'],'createdAt':_0x5a2f2b[_0x4a12('0xbd')]};});var _0x36693d=_[_0x4a12('0x33')](values[_0x4a12('0xbe')],function(_0x595d15){return{'channel':'FAX','id':_0x595d15['id'],'createdAt':_0x595d15[_0x4a12('0xbd')]};});var _0x3d2b88=_[_0x4a12('0x33')](values[_0x4a12('0xbf')],function(_0x183b58){return{'channel':_0x4a12('0xc0'),'id':_0x183b58['id'],'createdAt':_0x183b58[_0x4a12('0xbd')]};});var _0x28d8fa=_[_0x4a12('0x33')](values[_0x4a12('0xc1')],function(_0x429000){return{'channel':_0x4a12('0xc2'),'id':_0x429000['id'],'createdAt':_0x429000[_0x4a12('0xbd')]};});var _0x17b7fa=_[_0x4a12('0x33')](values['SmsOpenTabs'],function(_0x2458e5){return{'channel':'SMS','id':_0x2458e5['id'],'createdAt':_0x2458e5[_0x4a12('0xbd')]};});var _0x188139=_[_0x4a12('0x33')](values[_0x4a12('0xc3')],function(_0xa30a){return{'channel':'WHATSAPP','id':_0xa30a['id'],'createdAt':_0xa30a[_0x4a12('0xbd')]};});var _0x362546=_['concat'](_0xea0a3a,_0x36693d,_0x3d2b88,_0x28d8fa,_0x17b7fa,_0x188139);var _0x17319d={'count':_0x362546[_0x4a12('0x4e')],'rows':_0x362546};return _0x17319d;}else return null;})['then'](respondWithResult(_0x42a004,null))['catch'](handleError(_0x42a004,null));};exports['getContacts']=function(_0x273d80,_0xcbdd4d){var _0x4d9bf1={};return db['User']['findOne']({'where':{'id':_0x273d80[_0x4a12('0x56')]['id']}})[_0x4a12('0x2b')](function(_0x16daa2){if(!_0x16daa2){throw new APINotFoundError(util[_0x4a12('0xac')](_0x4a12('0xc4'),_0x273d80[_0x4a12('0x56')]['id']));}return contacts[_0x4a12('0x5e')]();})[_0x4a12('0x2b')](function(_0x130588){_0x273d80['query'][_0x4a12('0x3b')]=_0x273d80['params']['id'];_0x4d9bf1=qs[_0x4a12('0x43')](_0x130588,_0x273d80);if(_0x273d80[_0x4a12('0x47')]['hasOwnProperty'](_0x4a12('0x45'))){_0x4d9bf1[_0x4a12('0x46')]=[{'model':db[_0x4a12('0xc5')],'as':'List','required':![]},{'model':db[_0x4a12('0xc6')],'as':'Tags','attributes':['id','name','color'],'where':_0x273d80[_0x4a12('0x47')][_0x4a12('0xc7')]?{'id':_0x273d80[_0x4a12('0x47')][_0x4a12('0xc7')]}:undefined,'required':_0x273d80[_0x4a12('0x47')][_0x4a12('0xc7')]?!![]:![]}];}return contacts['findAll'](_0x273d80[_0x4a12('0x47')],_0x273d80[_0x4a12('0x80')],_0x4d9bf1,_0x130588);})['then'](respondWithFilteredResult(_0xcbdd4d,_0x4d9bf1))[_0x4a12('0x29')](APIHandleError(_0xcbdd4d));};exports[_0x4a12('0xc8')]=function(_0x251129,_0x5d379e){var _0x579fcb;var _0x2b56a1={};var _0x4e6d29;return db[_0x4a12('0x3b')][_0x4a12('0x99')]({'where':{'id':_0x251129[_0x4a12('0x56')]['id']},'attributes':['id',_0x4a12('0x36'),'role']})[_0x4a12('0x2b')](handleEntityNotFound(_0x5d379e,null))[_0x4a12('0x2b')](function(_0x31e9d1){if(!utils[_0x4a12('0xa3')](_0x251129[_0x4a12('0x47')][_0x4a12('0x9f')])){throw new db[(_0x4a12('0x92'))][(_0x4a12('0x93'))]('Unknown\x20channel');}_0x579fcb=_0x31e9d1;var _0x520743={};_0x520743[_0x4a12('0xc9')]=_[_0x4a12('0xca')](db[_['capitalize'](_0x251129[_0x4a12('0x47')][_0x4a12('0x9f')])+_0x4a12('0xcb')]['rawAttributes']);_0x520743[_0x4a12('0x47')]=_['keys'](_0x251129[_0x4a12('0x47')]);_0x520743[_0x4a12('0xcc')]=_[_0x4a12('0xcd')](_0x520743['model'],_0x520743[_0x4a12('0x47')]);_0x2b56a1[_0x4a12('0x4b')]=_['intersection'](_0x520743[_0x4a12('0xc9')],qs[_0x4a12('0xce')](_0x251129[_0x4a12('0x47')]['fields']));_0x2b56a1[_0x4a12('0x4b')]=_0x2b56a1[_0x4a12('0x4b')][_0x4a12('0x4e')]?_0x2b56a1[_0x4a12('0x4b')]:_0x520743[_0x4a12('0xc9')];_0x2b56a1[_0x4a12('0xcf')]=qs['sort'](_0x251129[_0x4a12('0x47')][_0x4a12('0xd0')]);_0x2b56a1[_0x4a12('0x44')]=qs[_0x4a12('0xcc')](_[_0x4a12('0xd1')](_0x251129[_0x4a12('0x47')],_0x520743[_0x4a12('0xcc')]));if(_0x251129[_0x4a12('0x47')][_0x4a12('0x32')]){_0x2b56a1['where']=_[_0x4a12('0x57')](_0x2b56a1[_0x4a12('0x44')],{'$or':_[_0x4a12('0x33')](_0x2b56a1['attributes'],function(_0x2b9df9){var _0x5a88c6={};_0x5a88c6[_0x2b9df9]={'$like':'%'+_0x251129['query'][_0x4a12('0x32')]+'%'};return _0x5a88c6;})});}_0x2b56a1=_['merge']({},_0x2b56a1,_0x251129[_0x4a12('0x58')]);switch(_0x579fcb[_0x4a12('0x2e')]){case'admin':return db[_[_0x4a12('0xa4')](_0x251129[_0x4a12('0x47')][_0x4a12('0x9f')])+_0x4a12('0xcb')][_0x4a12('0x4c')](_0x2b56a1);case _0x4a12('0x80'):case _0x4a12('0x2c'):return _0x579fcb['get'+_[_0x4a12('0xa4')](_0x251129[_0x4a12('0x47')][_0x4a12('0x9f')])+'Queues'](_0x2b56a1);default:throw new db['Sequelize'][(_0x4a12('0x93'))](_0x4a12('0xd2'));}})[_0x4a12('0x2b')](function(_0x455bfd){_0x4e6d29=_0x455bfd['length'];if(!_0x251129[_0x4a12('0x47')][_0x4a12('0xd3')](_0x4a12('0xd4'))){_0x2b56a1[_0x4a12('0x1b')]=qs['limit'](_0x251129['query'][_0x4a12('0x1b')]);_0x2b56a1[_0x4a12('0x1a')]=qs[_0x4a12('0x1a')](_0x251129[_0x4a12('0x47')][_0x4a12('0x1a')]);}switch(_0x579fcb[_0x4a12('0x2e')]){case _0x4a12('0x2f'):return db[_[_0x4a12('0xa4')](_0x251129[_0x4a12('0x47')]['channel'])+'Queue'][_0x4a12('0x4c')](_0x2b56a1);case _0x4a12('0x80'):case'agent':return _0x579fcb['get'+_[_0x4a12('0xa4')](_0x251129[_0x4a12('0x47')][_0x4a12('0x9f')])+_0x4a12('0xa6')](_0x2b56a1);}})[_0x4a12('0x2b')](function(_0x88f2e){return{'count':_0x4e6d29,'rows':_0x88f2e};})[_0x4a12('0x2b')](respondWithResult(_0x5d379e,null))['catch'](handleError(_0x5d379e,null));};exports[_0x4a12('0xd5')]=function(_0x571e22,_0x5ae0c4){var _0x16daf0={};var _0x4ce40c={};var _0x19dc16;var _0x1277bd;return db[_0x4a12('0x3b')]['findOne']({'where':{'id':_0x571e22['params']['id']}})['then'](handleEntityNotFound(_0x5ae0c4,null))[_0x4a12('0x2b')](function(_0x57169b){if(_0x57169b){_0x19dc16=_0x57169b;_0x4ce40c[_0x4a12('0xc9')]=_['keys'](db['UserVoiceQueueRt'][_0x4a12('0x3c')]);_0x4ce40c[_0x4a12('0x47')]=_[_0x4a12('0xca')](_0x571e22[_0x4a12('0x47')]);_0x4ce40c[_0x4a12('0xcc')]=_[_0x4a12('0xcd')](_0x4ce40c[_0x4a12('0xc9')],_0x4ce40c[_0x4a12('0x47')]);_0x16daf0['attributes']=_['intersection'](_0x4ce40c[_0x4a12('0xc9')],qs['fields'](_0x571e22[_0x4a12('0x47')]['fields']));_0x16daf0[_0x4a12('0x4b')]=_0x16daf0['attributes'][_0x4a12('0x4e')]?_0x16daf0[_0x4a12('0x4b')]:_0x4ce40c[_0x4a12('0xc9')];_0x16daf0[_0x4a12('0xcf')]=qs[_0x4a12('0xd0')](_0x571e22[_0x4a12('0x47')][_0x4a12('0xd0')]);_0x16daf0[_0x4a12('0x44')]=qs['filters'](_[_0x4a12('0xd1')](_0x571e22[_0x4a12('0x47')],_0x4ce40c[_0x4a12('0xcc')]));if(_0x571e22['query'][_0x4a12('0x32')]){_0x16daf0[_0x4a12('0x44')]=_[_0x4a12('0x57')](_0x16daf0[_0x4a12('0x44')],{'$or':_[_0x4a12('0x33')](_0x16daf0[_0x4a12('0x4b')],function(_0x8bbd3){var _0x4682b3={};_0x4682b3[_0x8bbd3]={'$like':'%'+_0x571e22['query']['filter']+'%'};return _0x4682b3;})});}_0x16daf0=_['merge']({},_0x16daf0,_0x571e22[_0x4a12('0x58')]);return _0x19dc16['getVoiceQueuesRt'](_0x16daf0);}})['then'](function(_0x5e0cb8){if(_0x5e0cb8){_0x1277bd=_0x5e0cb8[_0x4a12('0x4e')];if(!_0x571e22[_0x4a12('0x47')][_0x4a12('0xd3')](_0x4a12('0xd4'))){_0x16daf0[_0x4a12('0x1b')]=qs[_0x4a12('0x1b')](_0x571e22['query'][_0x4a12('0x1b')]);_0x16daf0[_0x4a12('0x1a')]=qs[_0x4a12('0x1a')](_0x571e22['query']['offset']);}return _0x19dc16[_0x4a12('0xd5')](_0x16daf0);}})[_0x4a12('0x2b')](function(_0x3d9a89){if(_0x3d9a89){return _0x3d9a89?{'count':_0x1277bd,'rows':_0x3d9a89}:null;}})['then'](respondWithResult(_0x5ae0c4,null))[_0x4a12('0x29')](handleError(_0x5ae0c4,null));};exports[_0x4a12('0xd6')]=function(_0x477fa2,_0x4bf71a){var _0x44a410={};var _0x315c77={};var _0x514d27;var _0x1966a0;return db[_0x4a12('0x3b')][_0x4a12('0x99')]({'where':{'id':_0x477fa2[_0x4a12('0x56')]['id']}})[_0x4a12('0x2b')](handleEntityNotFound(_0x4bf71a,null))[_0x4a12('0x2b')](function(_0x29e56b){if(_0x29e56b){_0x514d27=_0x29e56b;_0x315c77[_0x4a12('0xc9')]=_['keys'](db[_0x4a12('0xd7')][_0x4a12('0x3c')]);_0x315c77['query']=_[_0x4a12('0xca')](_0x477fa2[_0x4a12('0x47')]);_0x315c77[_0x4a12('0xcc')]=_[_0x4a12('0xcd')](_0x315c77[_0x4a12('0xc9')],_0x315c77[_0x4a12('0x47')]);_0x44a410[_0x4a12('0x4b')]=_['intersection'](_0x315c77['model'],qs[_0x4a12('0xce')](_0x477fa2['query']['fields']));_0x44a410[_0x4a12('0x4b')]=_0x44a410[_0x4a12('0x4b')]['length']?_0x44a410['attributes']:_0x315c77[_0x4a12('0xc9')];_0x44a410[_0x4a12('0xcf')]=qs[_0x4a12('0xd0')](_0x477fa2[_0x4a12('0x47')][_0x4a12('0xd0')]);_0x44a410[_0x4a12('0x44')]=qs[_0x4a12('0xcc')](_[_0x4a12('0xd1')](_0x477fa2[_0x4a12('0x47')],_0x315c77[_0x4a12('0xcc')]));if(_0x477fa2[_0x4a12('0x47')][_0x4a12('0x32')]){_0x44a410[_0x4a12('0x44')]=_['merge'](_0x44a410[_0x4a12('0x44')],{'$or':_['map'](_0x44a410[_0x4a12('0x4b')],function(_0x2a6fc3){var _0x4fb10d={};_0x4fb10d[_0x2a6fc3]={'$like':'%'+_0x477fa2['query'][_0x4a12('0x32')]+'%'};return _0x4fb10d;})});}_0x44a410=_[_0x4a12('0x57')]({},_0x44a410,_0x477fa2['options']);return _0x514d27['getGroups'](_0x44a410);}})['then'](function(_0x47bf64){if(_0x47bf64){_0x1966a0=_0x47bf64['length'];if(!_0x477fa2[_0x4a12('0x47')][_0x4a12('0xd3')]('nolimit')){_0x44a410['limit']=qs[_0x4a12('0x1b')](_0x477fa2[_0x4a12('0x47')]['limit']);_0x44a410[_0x4a12('0x1a')]=qs[_0x4a12('0x1a')](_0x477fa2[_0x4a12('0x47')][_0x4a12('0x1a')]);}return _0x514d27[_0x4a12('0xd6')](_0x44a410);}})[_0x4a12('0x2b')](function(_0x2e309d){if(_0x2e309d){return _0x2e309d?{'count':_0x1966a0,'rows':_0x2e309d}:null;}})['then'](respondWithResult(_0x4bf71a,null))[_0x4a12('0x29')](handleError(_0x4bf71a,null));};exports[_0x4a12('0xd8')]=function(_0x2c7e50,_0x54a41a){var _0x15d4fd={'raw':!![],'where':{}};var _0x280695={};var _0x589dae={'count':0x0,'rows':[]};return db[_0x4a12('0x3b')][_0x4a12('0x99')]({'where':{'id':_0x2c7e50[_0x4a12('0x56')]['id']}})[_0x4a12('0x2b')](handleEntityNotFound(_0x54a41a,null))[_0x4a12('0x2b')](function(_0x2fb73b){if(_0x2fb73b){_0x280695[_0x4a12('0xc9')]=_['keys'](db['VoiceRecording'][_0x4a12('0x3c')]);_0x280695[_0x4a12('0x47')]=_['keys'](_0x2c7e50['query']);_0x280695['filters']=_[_0x4a12('0xcd')](_0x280695[_0x4a12('0xc9')],_0x280695[_0x4a12('0x47')]);_0x15d4fd[_0x4a12('0x4b')]=_[_0x4a12('0xcd')](_0x280695[_0x4a12('0xc9')],qs[_0x4a12('0xce')](_0x2c7e50[_0x4a12('0x47')][_0x4a12('0xce')]));_0x15d4fd[_0x4a12('0x4b')]=_0x15d4fd[_0x4a12('0x4b')][_0x4a12('0x4e')]?_0x15d4fd[_0x4a12('0x4b')]:_0x280695[_0x4a12('0xc9')];if(!_0x2c7e50[_0x4a12('0x47')][_0x4a12('0xd3')](_0x4a12('0xd4'))){_0x15d4fd[_0x4a12('0x1b')]=qs[_0x4a12('0x1b')](_0x2c7e50[_0x4a12('0x47')][_0x4a12('0x1b')]);_0x15d4fd[_0x4a12('0x1a')]=qs[_0x4a12('0x1a')](_0x2c7e50[_0x4a12('0x47')][_0x4a12('0x1a')]);}_0x15d4fd[_0x4a12('0xcf')]=qs['sort'](_0x2c7e50['query'][_0x4a12('0xd0')]);_0x15d4fd[_0x4a12('0x44')]=qs[_0x4a12('0xcc')](_['pick'](_0x2c7e50['query'],_0x280695['filters']));_0x15d4fd[_0x4a12('0x44')][_0x4a12('0xd9')]=_0x2fb73b['id'];if(_0x2c7e50[_0x4a12('0x47')][_0x4a12('0x32')]){_0x15d4fd[_0x4a12('0x44')]=_[_0x4a12('0x57')](_0x15d4fd[_0x4a12('0x44')],{'$or':_[_0x4a12('0x33')](_0x15d4fd[_0x4a12('0x4b')],function(_0x4f701f){var _0xb4eaf2={};_0xb4eaf2[_0x4f701f]={'$like':'%'+_0x2c7e50['query'][_0x4a12('0x32')]+'%'};return _0xb4eaf2;})});}_0x15d4fd=_[_0x4a12('0x57')]({},_0x15d4fd,_0x2c7e50[_0x4a12('0x58')]);return db[_0x4a12('0xda')][_0x4a12('0x1d')]({'where':_0x15d4fd[_0x4a12('0x44')]})[_0x4a12('0x2b')](function(_0x24dd7e){_0x589dae[_0x4a12('0x1d')]=_0x24dd7e;if(_0x2c7e50[_0x4a12('0x47')][_0x4a12('0x45')]){_0x15d4fd[_0x4a12('0x46')]=[{'all':!![]}];}return db['VoiceRecording'][_0x4a12('0x4c')](_0x15d4fd);})[_0x4a12('0x2b')](function(_0xe0c64e){_0x589dae[_0x4a12('0x4d')]=_0xe0c64e;return _0x589dae;});}})[_0x4a12('0x2b')](respondWithFilteredResult(_0x54a41a,_0x15d4fd))[_0x4a12('0x29')](handleError(_0x54a41a,null));};exports[_0x4a12('0xdb')]=function(_0x1c397d,_0x5d7cc7){var _0x2db577={'raw':!![],'where':{}};var _0x92dcd0={};var _0x5ca103={'count':0x0,'rows':[]};return db[_0x4a12('0x3b')][_0x4a12('0x99')]({'where':{'id':_0x1c397d['params']['id']}})[_0x4a12('0x2b')](handleEntityNotFound(_0x5d7cc7,null))[_0x4a12('0x2b')](function(_0x141666){if(_0x141666){_0x92dcd0[_0x4a12('0xc9')]=_[_0x4a12('0xca')](db[_0x4a12('0xdc')]['rawAttributes']);_0x92dcd0[_0x4a12('0x47')]=_[_0x4a12('0xca')](_0x1c397d['query']);_0x92dcd0[_0x4a12('0xcc')]=_['intersection'](_0x92dcd0['model'],_0x92dcd0[_0x4a12('0x47')]);_0x2db577['attributes']=_['intersection'](_0x92dcd0['model'],qs[_0x4a12('0xce')](_0x1c397d['query'][_0x4a12('0xce')]));_0x2db577[_0x4a12('0x4b')]=_0x2db577['attributes']['length']?_0x2db577[_0x4a12('0x4b')]:_0x92dcd0[_0x4a12('0xc9')];if(!_0x1c397d[_0x4a12('0x47')][_0x4a12('0xd3')]('nolimit')){_0x2db577[_0x4a12('0x1b')]=qs[_0x4a12('0x1b')](_0x1c397d['query'][_0x4a12('0x1b')]);_0x2db577[_0x4a12('0x1a')]=qs[_0x4a12('0x1a')](_0x1c397d[_0x4a12('0x47')]['offset']);}_0x2db577['order']=qs[_0x4a12('0xd0')](_0x1c397d[_0x4a12('0x47')][_0x4a12('0xd0')]);_0x2db577['where']=qs[_0x4a12('0xcc')](_[_0x4a12('0xd1')](_0x1c397d[_0x4a12('0x47')],_0x92dcd0[_0x4a12('0xcc')]));_0x2db577[_0x4a12('0x44')][_0x4a12('0xd9')]=_0x141666['id'];if(_0x1c397d[_0x4a12('0x47')][_0x4a12('0x32')]){_0x2db577['where']=_[_0x4a12('0x57')](_0x2db577[_0x4a12('0x44')],{'$or':_[_0x4a12('0x33')](_0x2db577[_0x4a12('0x4b')],function(_0x306e97){var _0x1cf1c6={};_0x1cf1c6[_0x306e97]={'$like':'%'+_0x1c397d[_0x4a12('0x47')][_0x4a12('0x32')]+'%'};return _0x1cf1c6;})});}_0x2db577=_['merge']({},_0x2db577,_0x1c397d[_0x4a12('0x58')]);return db[_0x4a12('0xdc')]['count']({'where':_0x2db577[_0x4a12('0x44')]})[_0x4a12('0x2b')](function(_0x162e3f){_0x5ca103[_0x4a12('0x1d')]=_0x162e3f;if(_0x1c397d[_0x4a12('0x47')][_0x4a12('0x45')]){_0x2db577['include']=[{'all':!![]}];}return db[_0x4a12('0xdc')][_0x4a12('0x4c')](_0x2db577);})[_0x4a12('0x2b')](function(_0x303a86){_0x5ca103['rows']=_0x303a86;return _0x5ca103;});}})['then'](respondWithFilteredResult(_0x5d7cc7,_0x2db577))[_0x4a12('0x29')](handleError(_0x5d7cc7,null));};exports[_0x4a12('0xdd')]=function(_0x19edd3,_0x2e44a0){var _0x1fa25c={};var _0x1144a7={};var _0x4c9f42;var _0x1a89b3;return db[_0x4a12('0x3b')][_0x4a12('0x99')]({'where':{'id':_0x19edd3['params']['id']}})['then'](handleEntityNotFound(_0x2e44a0,null))['then'](function(_0xff04b0){if(_0xff04b0){_0x4c9f42=_0xff04b0;_0x1144a7[_0x4a12('0xc9')]=_[_0x4a12('0xca')](db['ChatInteraction'][_0x4a12('0x3c')]);_0x1144a7['query']=_[_0x4a12('0xca')](_0x19edd3['query']);_0x1144a7['filters']=_['intersection'](_0x1144a7[_0x4a12('0xc9')],_0x1144a7[_0x4a12('0x47')]);_0x1fa25c[_0x4a12('0x4b')]=_[_0x4a12('0xcd')](_0x1144a7[_0x4a12('0xc9')],qs[_0x4a12('0xce')](_0x19edd3['query']['fields']));_0x1fa25c[_0x4a12('0x4b')]=_0x1fa25c['attributes'][_0x4a12('0x4e')]?_0x1fa25c['attributes']:_0x1144a7['model'];_0x1fa25c['order']=qs['sort'](_0x19edd3[_0x4a12('0x47')][_0x4a12('0xd0')]);_0x1fa25c[_0x4a12('0x44')]=qs['filters'](_[_0x4a12('0xd1')](_0x19edd3[_0x4a12('0x47')],_0x1144a7[_0x4a12('0xcc')]));if(_0x19edd3[_0x4a12('0x47')][_0x4a12('0x32')]){_0x1fa25c[_0x4a12('0x44')]=_[_0x4a12('0x57')](_0x1fa25c[_0x4a12('0x44')],{'$or':_[_0x4a12('0x33')](_0x1fa25c['attributes'],function(_0x584560){var _0x46cc77={};_0x46cc77[_0x584560]={'$like':'%'+_0x19edd3[_0x4a12('0x47')]['filter']+'%'};return _0x46cc77;})});}_0x1fa25c=_['merge']({},_0x1fa25c,_0x19edd3['options']);return _0x4c9f42[_0x4a12('0xdd')](_0x1fa25c);}})['then'](function(_0x186951){if(_0x186951){_0x1a89b3=_0x186951[_0x4a12('0x4e')];if(!_0x19edd3['query'][_0x4a12('0xd3')](_0x4a12('0xd4'))){_0x1fa25c[_0x4a12('0x1b')]=qs['limit'](_0x19edd3[_0x4a12('0x47')][_0x4a12('0x1b')]);_0x1fa25c['offset']=qs['offset'](_0x19edd3[_0x4a12('0x47')][_0x4a12('0x1a')]);}return _0x4c9f42[_0x4a12('0xdd')](_0x1fa25c);}})['then'](function(_0x494124){if(_0x494124){return _0x494124?{'count':_0x1a89b3,'rows':_0x494124}:null;}})[_0x4a12('0x2b')](respondWithResult(_0x2e44a0,null))[_0x4a12('0x29')](handleError(_0x2e44a0,null));};exports[_0x4a12('0xde')]=function(_0x11d897,_0x326b7e){var _0x3c5b8e={};var _0x1f266e={};var _0x3dfa21;var _0x90855c;return db['User'][_0x4a12('0x99')]({'where':{'id':_0x11d897[_0x4a12('0x56')]['id']}})[_0x4a12('0x2b')](handleEntityNotFound(_0x326b7e,null))[_0x4a12('0x2b')](function(_0xd61140){if(_0xd61140){_0x3dfa21=_0xd61140;_0x1f266e[_0x4a12('0xc9')]=_['keys'](db[_0x4a12('0xdf')]['rawAttributes']);_0x1f266e['query']=_[_0x4a12('0xca')](_0x11d897[_0x4a12('0x47')]);_0x1f266e[_0x4a12('0xcc')]=_[_0x4a12('0xcd')](_0x1f266e[_0x4a12('0xc9')],_0x1f266e[_0x4a12('0x47')]);_0x3c5b8e['attributes']=_[_0x4a12('0xcd')](_0x1f266e['model'],qs['fields'](_0x11d897[_0x4a12('0x47')][_0x4a12('0xce')]));_0x3c5b8e['attributes']=_0x3c5b8e[_0x4a12('0x4b')][_0x4a12('0x4e')]?_0x3c5b8e[_0x4a12('0x4b')]:_0x1f266e[_0x4a12('0xc9')];_0x3c5b8e[_0x4a12('0xcf')]=qs[_0x4a12('0xd0')](_0x11d897[_0x4a12('0x47')][_0x4a12('0xd0')]);_0x3c5b8e[_0x4a12('0x44')]=qs[_0x4a12('0xcc')](_[_0x4a12('0xd1')](_0x11d897[_0x4a12('0x47')],_0x1f266e[_0x4a12('0xcc')]));if(_0x11d897[_0x4a12('0x47')][_0x4a12('0x32')]){_0x3c5b8e[_0x4a12('0x44')]=_[_0x4a12('0x57')](_0x3c5b8e[_0x4a12('0x44')],{'$or':_[_0x4a12('0x33')](_0x3c5b8e[_0x4a12('0x4b')],function(_0x3c8a22){var _0x1a10a2={};_0x1a10a2[_0x3c8a22]={'$like':'%'+_0x11d897[_0x4a12('0x47')][_0x4a12('0x32')]+'%'};return _0x1a10a2;})});}_0x3c5b8e=_['merge']({},_0x3c5b8e,_0x11d897['options']);return _0x3dfa21[_0x4a12('0xde')](_0x3c5b8e);}})[_0x4a12('0x2b')](function(_0xda61ff){if(_0xda61ff){_0x90855c=_0xda61ff[_0x4a12('0x4e')];if(!_0x11d897['query'][_0x4a12('0xd3')](_0x4a12('0xd4'))){_0x3c5b8e[_0x4a12('0x1b')]=qs[_0x4a12('0x1b')](_0x11d897[_0x4a12('0x47')][_0x4a12('0x1b')]);_0x3c5b8e[_0x4a12('0x1a')]=qs[_0x4a12('0x1a')](_0x11d897['query'][_0x4a12('0x1a')]);}return _0x3dfa21[_0x4a12('0xde')](_0x3c5b8e);}})['then'](function(_0x43cb8f){if(_0x43cb8f){return _0x43cb8f?{'count':_0x90855c,'rows':_0x43cb8f}:null;}})[_0x4a12('0x2b')](respondWithResult(_0x326b7e,null))[_0x4a12('0x29')](handleError(_0x326b7e,null));};exports[_0x4a12('0xe0')]=function(_0x2c7db2,_0x3c2478){var _0x1a172a={'raw':!![],'where':{}};var _0x2c8761={};var _0x34a0c6={'count':0x0,'rows':[]};return db[_0x4a12('0x3b')][_0x4a12('0x99')]({'where':{'id':_0x2c7db2[_0x4a12('0x56')]['id']}})[_0x4a12('0x2b')](handleEntityNotFound(_0x3c2478,null))['then'](function(_0x25fa6e){if(_0x25fa6e){_0x2c8761[_0x4a12('0xc9')]=_[_0x4a12('0xca')](db[_0x4a12('0xe1')][_0x4a12('0x3c')]);_0x2c8761['query']=_[_0x4a12('0xca')](_0x2c7db2['query']);_0x2c8761[_0x4a12('0xcc')]=_['intersection'](_0x2c8761['model'],_0x2c8761[_0x4a12('0x47')]);_0x1a172a[_0x4a12('0x4b')]=_['intersection'](_0x2c8761[_0x4a12('0xc9')],qs[_0x4a12('0xce')](_0x2c7db2[_0x4a12('0x47')][_0x4a12('0xce')]));_0x1a172a[_0x4a12('0x4b')]=_0x1a172a[_0x4a12('0x4b')][_0x4a12('0x4e')]?_0x1a172a[_0x4a12('0x4b')]:_0x2c8761[_0x4a12('0xc9')];if(!_0x2c7db2['query'][_0x4a12('0xd3')](_0x4a12('0xd4'))){_0x1a172a['limit']=qs[_0x4a12('0x1b')](_0x2c7db2[_0x4a12('0x47')][_0x4a12('0x1b')]);_0x1a172a[_0x4a12('0x1a')]=qs[_0x4a12('0x1a')](_0x2c7db2[_0x4a12('0x47')]['offset']);}_0x1a172a['order']=qs[_0x4a12('0xd0')](_0x2c7db2[_0x4a12('0x47')][_0x4a12('0xd0')]);_0x1a172a[_0x4a12('0x44')]=qs[_0x4a12('0xcc')](_['pick'](_0x2c7db2[_0x4a12('0x47')],_0x2c8761['filters']));_0x1a172a[_0x4a12('0x44')][_0x4a12('0xd9')]=_0x25fa6e['id'];if(_0x2c7db2[_0x4a12('0x47')]['filter']){_0x1a172a[_0x4a12('0x44')]=_[_0x4a12('0x57')](_0x1a172a[_0x4a12('0x44')],{'$or':_[_0x4a12('0x33')](_0x1a172a[_0x4a12('0x4b')],function(_0x538c65){var _0x422cf8={};_0x422cf8[_0x538c65]={'$like':'%'+_0x2c7db2['query'][_0x4a12('0x32')]+'%'};return _0x422cf8;})});}_0x1a172a=_[_0x4a12('0x57')]({},_0x1a172a,_0x2c7db2[_0x4a12('0x58')]);return db[_0x4a12('0xe1')][_0x4a12('0x1d')]({'where':_0x1a172a['where']})[_0x4a12('0x2b')](function(_0x483294){_0x34a0c6[_0x4a12('0x1d')]=_0x483294;if(_0x2c7db2[_0x4a12('0x47')]['includeAll']){_0x1a172a['include']=[{'all':!![]}];}return db['MailInteraction'][_0x4a12('0x4c')](_0x1a172a);})[_0x4a12('0x2b')](function(_0x5649b6){_0x34a0c6['rows']=_0x5649b6;return _0x34a0c6;});}})['then'](respondWithFilteredResult(_0x3c2478,_0x1a172a))[_0x4a12('0x29')](handleError(_0x3c2478,null));};exports['getSmsInteractions']=function(_0x353bc5,_0x1b1b0e){var _0x22697c={};var _0x509957={};var _0x211c36;var _0x3a2df1;return db[_0x4a12('0x3b')][_0x4a12('0x99')]({'where':{'id':_0x353bc5[_0x4a12('0x56')]['id']}})[_0x4a12('0x2b')](handleEntityNotFound(_0x1b1b0e,null))[_0x4a12('0x2b')](function(_0x45f754){if(_0x45f754){_0x211c36=_0x45f754;_0x509957[_0x4a12('0xc9')]=_[_0x4a12('0xca')](db[_0x4a12('0xe2')][_0x4a12('0x3c')]);_0x509957[_0x4a12('0x47')]=_['keys'](_0x353bc5[_0x4a12('0x47')]);_0x509957[_0x4a12('0xcc')]=_[_0x4a12('0xcd')](_0x509957[_0x4a12('0xc9')],_0x509957[_0x4a12('0x47')]);_0x22697c['attributes']=_['intersection'](_0x509957[_0x4a12('0xc9')],qs[_0x4a12('0xce')](_0x353bc5[_0x4a12('0x47')]['fields']));_0x22697c['attributes']=_0x22697c[_0x4a12('0x4b')][_0x4a12('0x4e')]?_0x22697c[_0x4a12('0x4b')]:_0x509957['model'];_0x22697c['order']=qs[_0x4a12('0xd0')](_0x353bc5['query'][_0x4a12('0xd0')]);_0x22697c['where']=qs[_0x4a12('0xcc')](_[_0x4a12('0xd1')](_0x353bc5['query'],_0x509957[_0x4a12('0xcc')]));if(_0x353bc5[_0x4a12('0x47')][_0x4a12('0x32')]){_0x22697c[_0x4a12('0x44')]=_[_0x4a12('0x57')](_0x22697c[_0x4a12('0x44')],{'$or':_[_0x4a12('0x33')](_0x22697c[_0x4a12('0x4b')],function(_0x233834){var _0x3d9a13={};_0x3d9a13[_0x233834]={'$like':'%'+_0x353bc5[_0x4a12('0x47')][_0x4a12('0x32')]+'%'};return _0x3d9a13;})});}_0x22697c=_['merge']({},_0x22697c,_0x353bc5['options']);return _0x211c36[_0x4a12('0xe3')](_0x22697c);}})['then'](function(_0x2e9f9a){if(_0x2e9f9a){_0x3a2df1=_0x2e9f9a['length'];if(!_0x353bc5[_0x4a12('0x47')][_0x4a12('0xd3')]('nolimit')){_0x22697c['limit']=qs[_0x4a12('0x1b')](_0x353bc5[_0x4a12('0x47')]['limit']);_0x22697c['offset']=qs[_0x4a12('0x1a')](_0x353bc5['query']['offset']);}return _0x211c36[_0x4a12('0xe3')](_0x22697c);}})[_0x4a12('0x2b')](function(_0xdb24c0){if(_0xdb24c0){return _0xdb24c0?{'count':_0x3a2df1,'rows':_0xdb24c0}:null;}})[_0x4a12('0x2b')](respondWithResult(_0x1b1b0e,null))['catch'](handleError(_0x1b1b0e,null));};exports[_0x4a12('0xe4')]=function(_0x1b38a2,_0x108de8){var _0x222032={};var _0x1e2959={};var _0x397a8e;var _0x463191;return db['User'][_0x4a12('0x99')]({'where':{'id':_0x1b38a2[_0x4a12('0x56')]['id']}})[_0x4a12('0x2b')](handleEntityNotFound(_0x108de8,null))[_0x4a12('0x2b')](function(_0x2e8380){if(_0x2e8380){_0x397a8e=_0x2e8380;_0x1e2959[_0x4a12('0xc9')]=_[_0x4a12('0xca')](db[_0x4a12('0xe5')][_0x4a12('0x3c')]);_0x1e2959[_0x4a12('0x47')]=_[_0x4a12('0xca')](_0x1b38a2[_0x4a12('0x47')]);_0x1e2959[_0x4a12('0xcc')]=_[_0x4a12('0xcd')](_0x1e2959[_0x4a12('0xc9')],_0x1e2959[_0x4a12('0x47')]);_0x222032[_0x4a12('0x4b')]=_['intersection'](_0x1e2959[_0x4a12('0xc9')],qs[_0x4a12('0xce')](_0x1b38a2['query'][_0x4a12('0xce')]));_0x222032[_0x4a12('0x4b')]=_0x222032['attributes'][_0x4a12('0x4e')]?_0x222032[_0x4a12('0x4b')]:_0x1e2959[_0x4a12('0xc9')];_0x222032[_0x4a12('0xcf')]=qs[_0x4a12('0xd0')](_0x1b38a2[_0x4a12('0x47')][_0x4a12('0xd0')]);_0x222032[_0x4a12('0x44')]=qs[_0x4a12('0xcc')](_[_0x4a12('0xd1')](_0x1b38a2[_0x4a12('0x47')],_0x1e2959[_0x4a12('0xcc')]));if(_0x1b38a2[_0x4a12('0x47')][_0x4a12('0x32')]){_0x222032['where']=_['merge'](_0x222032['where'],{'$or':_[_0x4a12('0x33')](_0x222032[_0x4a12('0x4b')],function(_0x36d9d8){var _0x4d4e4e={};_0x4d4e4e[_0x36d9d8]={'$like':'%'+_0x1b38a2[_0x4a12('0x47')][_0x4a12('0x32')]+'%'};return _0x4d4e4e;})});}_0x222032=_[_0x4a12('0x57')]({},_0x222032,_0x1b38a2[_0x4a12('0x58')]);return _0x397a8e['getFaxInteractions'](_0x222032);}})[_0x4a12('0x2b')](function(_0x1ccfb8){if(_0x1ccfb8){_0x463191=_0x1ccfb8[_0x4a12('0x4e')];if(!_0x1b38a2['query']['hasOwnProperty']('nolimit')){_0x222032[_0x4a12('0x1b')]=qs['limit'](_0x1b38a2[_0x4a12('0x47')][_0x4a12('0x1b')]);_0x222032[_0x4a12('0x1a')]=qs[_0x4a12('0x1a')](_0x1b38a2[_0x4a12('0x47')][_0x4a12('0x1a')]);}return _0x397a8e[_0x4a12('0xe4')](_0x222032);}})['then'](function(_0x310d08){if(_0x310d08){return _0x310d08?{'count':_0x463191,'rows':_0x310d08}:null;}})[_0x4a12('0x2b')](respondWithResult(_0x108de8,null))[_0x4a12('0x29')](handleError(_0x108de8,null));};exports[_0x4a12('0xe6')]=function(_0x1592de,_0x3a9054){var _0x18b72c={};var _0x5a4222={};var _0x2c9682;var _0x335a9b;return db[_0x4a12('0x3b')][_0x4a12('0x99')]({'where':{'id':_0x1592de['params']['id']}})[_0x4a12('0x2b')](handleEntityNotFound(_0x3a9054,null))[_0x4a12('0x2b')](function(_0x4fc1ab){if(_0x4fc1ab){_0x2c9682=_0x4fc1ab;_0x5a4222['model']=_[_0x4a12('0xca')](db[_0x4a12('0xe7')][_0x4a12('0x3c')]);_0x5a4222['query']=_[_0x4a12('0xca')](_0x1592de['query']);_0x5a4222[_0x4a12('0xcc')]=_['intersection'](_0x5a4222[_0x4a12('0xc9')],_0x5a4222[_0x4a12('0x47')]);_0x18b72c[_0x4a12('0x4b')]=_[_0x4a12('0xcd')](_0x5a4222[_0x4a12('0xc9')],qs[_0x4a12('0xce')](_0x1592de[_0x4a12('0x47')][_0x4a12('0xce')]));_0x18b72c[_0x4a12('0x4b')]=_0x18b72c[_0x4a12('0x4b')][_0x4a12('0x4e')]?_0x18b72c['attributes']:_0x5a4222[_0x4a12('0xc9')];_0x18b72c[_0x4a12('0xcf')]=qs[_0x4a12('0xd0')](_0x1592de['query']['sort']);_0x18b72c[_0x4a12('0x44')]=qs[_0x4a12('0xcc')](_[_0x4a12('0xd1')](_0x1592de[_0x4a12('0x47')],_0x5a4222[_0x4a12('0xcc')]));if(_0x1592de[_0x4a12('0x47')]['filter']){_0x18b72c[_0x4a12('0x44')]=_['merge'](_0x18b72c[_0x4a12('0x44')],{'$or':_[_0x4a12('0x33')](_0x18b72c['attributes'],function(_0x52f226){var _0x1378f9={};_0x1378f9[_0x52f226]={'$like':'%'+_0x1592de[_0x4a12('0x47')][_0x4a12('0x32')]+'%'};return _0x1378f9;})});}_0x18b72c=_[_0x4a12('0x57')]({},_0x18b72c,_0x1592de['options']);return _0x2c9682[_0x4a12('0xe6')](_0x18b72c);}})[_0x4a12('0x2b')](function(_0x44943d){if(_0x44943d){_0x335a9b=_0x44943d['length'];if(!_0x1592de[_0x4a12('0x47')][_0x4a12('0xd3')]('nolimit')){_0x18b72c[_0x4a12('0x1b')]=qs[_0x4a12('0x1b')](_0x1592de[_0x4a12('0x47')][_0x4a12('0x1b')]);_0x18b72c[_0x4a12('0x1a')]=qs['offset'](_0x1592de[_0x4a12('0x47')]['offset']);}return _0x2c9682[_0x4a12('0xe6')](_0x18b72c);}})[_0x4a12('0x2b')](function(_0x2b6f39){if(_0x2b6f39){return _0x2b6f39?{'count':_0x335a9b,'rows':_0x2b6f39}:null;}})['then'](respondWithResult(_0x3a9054,null))[_0x4a12('0x29')](handleError(_0x3a9054,null));};exports[_0x4a12('0xe8')]=function(_0x3b0c55,_0x24ec6f,_0x485afd){var _0x3cd39e;var _0x5b5fc2;var _0x28b199;var _0xf33b81=!_['isNil'](_0x3b0c55[_0x4a12('0x56')]['id'])?_0x3b0c55[_0x4a12('0x56')]['id']:!_[_0x4a12('0x6a')](_0x3b0c55[_0x4a12('0x80')]['id'])?_0x3b0c55[_0x4a12('0x80')]['id']:null;return db['User']['find']({'where':{'id':_0xf33b81,'role':{'$or':[_0x4a12('0x2f'),'user',_0x4a12('0x2c')]}},'attributes':['id',_0x4a12('0x36'),_0x4a12('0xe9'),'mobile',_0x4a12('0x2e'),_0x4a12('0x68'),_0x4a12('0xa1')]})['then'](function(_0x1ebb56){if(_0x1ebb56){if(_0x1ebb56[_0x4a12('0x2e')]==='agent'){_0x3cd39e=_0x1ebb56;if(_0x3b0c55[_0x4a12('0x5d')][_0x4a12('0xea')]){_0x28b199=util[_0x4a12('0xac')](_0x4a12('0xeb'),_0x3cd39e[_0x3b0c55['body'][_0x4a12('0xea')]]);}else if(_0x3b0c55[_0x4a12('0x5d')][_0x4a12('0xec')]){_0x28b199=util[_0x4a12('0xac')]('SIP/%s',_0x3b0c55[_0x4a12('0x5d')][_0x4a12('0xec')]);}else{_0x28b199=util[_0x4a12('0xac')](_0x4a12('0xed'),_0x3cd39e['name']);}socket['to'](util[_0x4a12('0xac')](_0x4a12('0xee'),_0x3cd39e[_0x4a12('0x36')]))[_0x4a12('0x2d')](_0x4a12('0xef'),{'user':{'id':_0x3cd39e['id'],'name':_0x3cd39e[_0x4a12('0x36')]},'ip':_0x3b0c55['headers'][_0x4a12('0xf0')]||_0x3b0c55[_0x4a12('0xf1')][_0x4a12('0xf2')]||_0x3b0c55[_0x4a12('0xf3')][_0x4a12('0xf2')]||_0x3b0c55[_0x4a12('0xf1')][_0x4a12('0xf3')][_0x4a12('0xf2')]});return db['UserVoiceQueueRt'][_0x4a12('0x38')]({'where':{'membername':_0x3cd39e[_0x4a12('0x36')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x4a12('0x93'))](_0x4a12('0xf4'));}})[_0x4a12('0x2b')](function(){if(_0x3cd39e){return _0x3cd39e[_0x4a12('0xf5')]({'raw':!![]});}})[_0x4a12('0x2b')](function(_0x337396){if(_0x3cd39e){if(_0x337396){_0x5b5fc2=_0x337396;if(_0x5b5fc2[_0x4a12('0x4e')]){var _0xaf123e=_0x5b5fc2[_0x4a12('0x33')](function(_0x4de170){var _0x417885={'membername':_0x3cd39e[_0x4a12('0x36')],'UserId':_0x3cd39e['id'],'queue_name':_0x4de170['name'],'VoiceQueueId':_0x4de170['id'],'interface':_0x28b199,'paused':_0x3cd39e[_0x4a12('0xa1')]||![],'penalty':_0x4de170[_0x4a12('0xf6')]||0x0};return db['UserVoiceQueueRt']['upsert'](_0x417885);});return Promise[_0x4a12('0x55')](_0xaf123e);}}}})[_0x4a12('0x2b')](function(){if(_0x3cd39e){return db['MemberReport']['findAll']({'where':{'membername':_0x3cd39e[_0x4a12('0x36')],'exitAt':null}});}})[_0x4a12('0x2b')](function(_0x4062a9){if(_0x3cd39e){var _0x304610=[];_0x4062a9[_0x4a12('0xf7')](function(_0xc68af6){_0x304610['push'](_0xc68af6['update']({'exitAt':moment()[_0x4a12('0xac')](_0x4a12('0xf8'))}));});return Promise[_0x4a12('0x55')](_0x304610);}})[_0x4a12('0x2b')](function(){if(_0x3cd39e){var _0xef5613=[];var _0x4c8bfe=[];var _0x429076=utils[_0x4a12('0xf9')]();var _0x5c0c9b={'membername':_0x3cd39e[_0x4a12('0x36')],'interface':_0x28b199,'enterAt':moment()[_0x4a12('0xac')](_0x4a12('0xf8')),'role':_0x3cd39e['role'],'internal':_0x3cd39e[_0x4a12('0x68')]};_0x429076[_0x4a12('0xf7')](function(_0x3ce619){_0xef5613[_0x4a12('0x4f')](_[_0x4a12('0x57')]({'channel':_0x3ce619,'type':_0x4a12('0xfa'),'data1':_0x3b0c55[_0x4a12('0x5d')][_0x4a12('0xfb')],'data2':_0x28b199},_0x5c0c9b));if(_0x3cd39e[_0x4a12('0xa1')]){_0x4c8bfe[_0x4a12('0x4f')](_[_0x4a12('0x57')]({'channel':_0x3ce619,'type':'PAUSE','data1':_0x4a12('0xfc')},_0x5c0c9b));}});return db['MemberReport'][_0x4a12('0x8b')](_0xef5613[_0x4a12('0xfd')](_0x4c8bfe),{'individualHooks':!![]});}})[_0x4a12('0x2b')](function(){if(_0x3cd39e){return _0x3cd39e[_0x4a12('0x2a')]({'online':!![],'lastLoginAt':moment()['format'](_0x4a12('0xf8')),'voicePause':_0x3cd39e[_0x4a12('0xa1')]||![],'mailPause':_0x3cd39e[_0x4a12('0xa1')]||![],'chatPause':_0x3cd39e[_0x4a12('0xa1')]||![],'faxPause':_0x3cd39e[_0x4a12('0xa1')]||![],'smsPause':_0x3cd39e['loginInPause']||![],'openchannelPause':_0x3cd39e['loginInPause']||![],'whatsappPause':_0x3cd39e[_0x4a12('0xa1')]||![],'pauseType':_0x3cd39e[_0x4a12('0xa1')]?_0x4a12('0xfc'):null,'interface':_0x28b199,'lastPauseAt':moment()[_0x4a12('0xac')](_0x4a12('0xf8'))});}})['then'](function(_0x3a0c09){if(_0x3b0c55['isMiddleware']){return _0x485afd();}else{return Promise['resolve'](_0x3a0c09)[_0x4a12('0x2b')](respondWithResult(_0x24ec6f,null));}})[_0x4a12('0x29')](handleError(_0x24ec6f,null));};exports[_0x4a12('0xfe')]=function(_0x4ca88e,_0x25c149){var _0x499c83;return db['User'][_0x4a12('0x59')]({'where':{'id':_0x4ca88e[_0x4a12('0x56')]['id'],'role':'agent'},'attributes':['id',_0x4a12('0x36'),_0x4a12('0x2e')]})[_0x4a12('0x2b')](handleEntityNotFound(_0x25c149,null))[_0x4a12('0x2b')](function(_0x3ee1e2){if(_0x3ee1e2){_0x499c83=_0x3ee1e2;return db[_0x4a12('0xad')][_0x4a12('0x38')]({'where':{'membername':_0x499c83['name']},'individualHooks':!![]});}})[_0x4a12('0x2b')](function(){return db[_0x4a12('0xff')][_0x4a12('0x4c')]({'where':{'membername':_0x499c83['name'],'exitAt':null}});})[_0x4a12('0x2b')](function(_0x11c6be){var _0x459d7a=[];_0x11c6be[_0x4a12('0xf7')](function(_0x51a7c5){_0x459d7a['push'](_0x51a7c5[_0x4a12('0x2a')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x4a12('0x55')](_0x459d7a);})['then'](function(){return _0x499c83[_0x4a12('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x4a12('0x2b')](respondWithResult(_0x25c149,null))[_0x4a12('0x29')](handleError(_0x25c149,null));};exports['pause']=function(_0x3292c2,_0xc5ee19){var _0x567adc;return db[_0x4a12('0xad')]['update']({'paused':0x1},{'where':{'UserId':_0x3292c2[_0x4a12('0x56')]['id']},'individualHooks':!![]})[_0x4a12('0x2b')](function(){return db[_0x4a12('0x3b')]['find']({'where':{'id':_0x3292c2[_0x4a12('0x56')]['id'],'role':_0x4a12('0x2c')},'attributes':['id','name','role',_0x4a12('0x68'),_0x4a12('0xea'),_0x4a12('0xa0')]});})[_0x4a12('0x2b')](handleEntityNotFound(_0xc5ee19,null))[_0x4a12('0x2b')](function(_0x595053){if(_0x595053){_0x567adc=_0x595053;return respondWithRpcPromise('QueuePause',_0x4a12('0x100'),{'id':_0x567adc['id'],'name':_0x567adc['name'],'pause':!![]});}})[_0x4a12('0x2b')](function(){if(_0x567adc){return db[_0x4a12('0xff')]['findAll']({'where':{'membername':_0x567adc['name'],'type':_0x4a12('0x101'),'exitAt':null}});}})[_0x4a12('0x2b')](function(_0x4fb869){if(_0x4fb869['length']){var _0xf8a421=moment()['format'](_0x4a12('0xf8'));for(var _0x4662f6=0x0,_0xb8701a=_0x4fb869[_0x4a12('0x4e')];_0x4662f6<_0xb8701a;_0x4662f6++){_0x4fb869[_0x4662f6][_0x4a12('0x102')]({'exitAt':_0xf8a421});}}})['then'](function(){var _0x4e77f2=[];var _0x5f3f48=utils['getChannels']();_0x5f3f48[_0x4a12('0xf7')](function(_0x22a08a){_0x4e77f2[_0x4a12('0x4f')]({'channel':_0x22a08a,'membername':_0x567adc[_0x4a12('0x36')],'interface':_[_0x4a12('0x6a')](_0x567adc[_0x4a12('0xea')])?util[_0x4a12('0xac')](_0x4a12('0xed'),_0x567adc[_0x4a12('0x36')]):_0x567adc[_0x4a12('0xea')],'type':'PAUSE','enterAt':moment()[_0x4a12('0xac')](_0x4a12('0xf8')),'data1':_0x3292c2[_0x4a12('0x5d')][_0x4a12('0x103')]||_0x4a12('0x104'),'role':_0x567adc[_0x4a12('0x2e')],'internal':_0x567adc[_0x4a12('0x68')]});});return db[_0x4a12('0xff')][_0x4a12('0x8b')](_0x4e77f2,{'individualHooks':!![]});})[_0x4a12('0x2b')](function(){return _0x567adc[_0x4a12('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3292c2['body']['type']||_0x4a12('0x104'),'lastPauseAt':moment()[_0x4a12('0xac')](_0x4a12('0xf8'))});})[_0x4a12('0x2b')](respondWithResult(_0xc5ee19,null))[_0x4a12('0x29')](handleError(_0xc5ee19,null));};exports[_0x4a12('0x105')]=function(_0x2e448e,_0x4a386b){if(_0x2e448e[_0x4a12('0x5d')]['channel']&&!utils['isValidChannel'](_0x2e448e['body'][_0x4a12('0x9f')])){throw new APIBadRequestError(util['format'](_0x4a12('0x106'),_0x2e448e[_0x4a12('0x5d')][_0x4a12('0x9f')]));}return db[_0x4a12('0x3b')]['find']({'where':{'id':_0x2e448e[_0x4a12('0x56')]['id']},'attributes':['id','name',_0x4a12('0x2e'),_0x4a12('0x68'),_0x4a12('0xea'),_0x4a12('0xa0'),_0x4a12('0xa2'),'mailPause',_0x4a12('0x107'),_0x4a12('0x108'),_0x4a12('0x109'),_0x4a12('0x10a'),_0x4a12('0x10b'),_0x4a12('0x10c'),_0x4a12('0x10d')]})[_0x4a12('0x2b')](function(_0x1c799b){if(!_0x1c799b){throw new APINotFoundError(util['format'](_0x4a12('0xc4'),_0x2e448e[_0x4a12('0x56')]['id']));}return _0x1c799b['unpause'](_0x2e448e[_0x4a12('0x5d')][_0x4a12('0x9f')]);})[_0x4a12('0x2b')](respondWithResult(_0x4a386b,null))[_0x4a12('0x29')](APIHandleError(_0x4a386b));};exports[_0x4a12('0x10e')]=function(_0x5b4835,_0x21c657){var _0x111a40={};var _0x289221={};var _0x35e907;var _0x4319a6;return db[_0x4a12('0x3b')]['findOne']({'where':{'id':_0x5b4835[_0x4a12('0x56')]['id']}})[_0x4a12('0x2b')](handleEntityNotFound(_0x21c657,null))[_0x4a12('0x2b')](function(_0x37c3b7){if(_0x37c3b7){_0x35e907=_0x37c3b7;_0x289221[_0x4a12('0xc9')]=_[_0x4a12('0xca')](db[_0x4a12('0x10f')][_0x4a12('0x3c')]);_0x289221[_0x4a12('0x47')]=_[_0x4a12('0xca')](_0x5b4835['query']);_0x289221[_0x4a12('0xcc')]=_['intersection'](_0x289221[_0x4a12('0xc9')],_0x289221['query']);_0x111a40['attributes']=_[_0x4a12('0xcd')](_0x289221[_0x4a12('0xc9')],qs[_0x4a12('0xce')](_0x5b4835['query'][_0x4a12('0xce')]));_0x111a40[_0x4a12('0x4b')]=_0x111a40[_0x4a12('0x4b')][_0x4a12('0x4e')]?_0x111a40[_0x4a12('0x4b')]:_0x289221['model'];_0x111a40[_0x4a12('0xcf')]=qs['sort'](_0x5b4835[_0x4a12('0x47')][_0x4a12('0xd0')]);_0x111a40[_0x4a12('0x44')]=qs['filters'](_[_0x4a12('0xd1')](_0x5b4835[_0x4a12('0x47')],_0x289221[_0x4a12('0xcc')]));if(_0x5b4835[_0x4a12('0x47')][_0x4a12('0x32')]){_0x111a40[_0x4a12('0x44')]=_[_0x4a12('0x57')](_0x111a40['where'],{'$or':_['map'](_0x111a40[_0x4a12('0x4b')],function(_0x4f0083){var _0x4c31f4={};_0x4c31f4[_0x4f0083]={'$like':'%'+_0x5b4835['query'][_0x4a12('0x32')]+'%'};return _0x4c31f4;})});}_0x111a40=_[_0x4a12('0x57')]({},_0x111a40,_0x5b4835[_0x4a12('0x58')]);return _0x35e907[_0x4a12('0x10e')](_0x111a40);}})[_0x4a12('0x2b')](function(_0x154fe3){if(_0x154fe3){_0x4319a6=_0x154fe3['length'];if(!_0x5b4835[_0x4a12('0x47')][_0x4a12('0xd3')]('nolimit')){_0x111a40[_0x4a12('0x1b')]=qs[_0x4a12('0x1b')](_0x5b4835[_0x4a12('0x47')][_0x4a12('0x1b')]);_0x111a40[_0x4a12('0x1a')]=qs[_0x4a12('0x1a')](_0x5b4835['query'][_0x4a12('0x1a')]);}return _0x35e907[_0x4a12('0x10e')](_0x111a40);}})['then'](function(_0x45ee45){if(_0x45ee45){return _0x45ee45?{'count':_0x4319a6,'rows':_0x45ee45}:null;}})[_0x4a12('0x2b')](respondWithResult(_0x21c657,null))['catch'](handleError(_0x21c657,null));};exports[_0x4a12('0x110')]=function(_0x4825ea,_0x5209d4){var _0x3754b2=_0x4825ea['params']['id'];var _0x32ecf5=_0x4825ea[_0x4a12('0x5d')]?_0x4825ea[_0x4a12('0x5d')]['ids']:null;var _0x4d2add=[];return Promise[_0x4a12('0x111')]()[_0x4a12('0x2b')](function(){if(!_0x32ecf5)throw new APIBadRequestError(_0x4a12('0x112'));})['then'](function(){return db['User'][_0x4a12('0x99')]({'where':{'id':_0x3754b2}});})[_0x4a12('0x2b')](function(_0x1bb571){if(!_0x1bb571)throw new APINotFoundError(util['format'](_0x4a12('0xc4'),_0x4825ea[_0x4a12('0x56')]['id']));return db['sequelize']['transaction'](function(_0x426718){return _0x1bb571['addTeams'](_0x32ecf5,{'transaction':_0x426718})['then'](function(){return db[_0x4a12('0x10f')]['findAll']({'where':{'id':{'$in':_0x32ecf5}}});})[_0x4a12('0x2b')](function(_0x1b34c2){var _0x1924c8=_[_0x4a12('0x33')](_0x1b34c2,function(_0x4f281f){return _0x4f281f[_0x4a12('0x113')]();});return Promise[_0x4a12('0x55')](_0x1924c8);})[_0x4a12('0x2b')](function(_0x2955fa){_0x4d2add=_[_0x4a12('0x114')](_0x2955fa);var _0x5e169f=_['map'](_0x4d2add,function(_0x4d88f8){return _0x4d88f8[_0x4a12('0x115')](_0x1bb571['id'],{'transaction':_0x426718});});return Promise[_0x4a12('0x55')](_0x5e169f);})[_0x4a12('0x2b')](function(){if(!_0x1bb571[_0x4a12('0xa0')])return;var _0x3a96eb=_['filter'](_0x4d2add,function(_0x4bf3f2){return _0x4bf3f2[_0x4a12('0x116')](_0x4a12('0x9f'))==='Voice';});var _0x5c1cb2=_[_0x4a12('0x33')](_0x3a96eb,function(_0x2d0718){return db[_0x4a12('0xad')]['upsert']({'membername':_0x1bb571[_0x4a12('0x36')],'UserId':_0x1bb571['id'],'queue_name':_0x2d0718[_0x4a12('0x36')],'VoiceQueueId':_0x2d0718['id'],'interface':_[_0x4a12('0x6a')](_0x1bb571[_0x4a12('0xea')])?util[_0x4a12('0xac')](_0x4a12('0xed'),_0x1bb571['name']):_0x1bb571[_0x4a12('0xea')],'paused':_0x1bb571['voicePause']||![],'penalty':_0x1bb571[_0x4a12('0xa7')]},{'transaction':_0x426718});});return Promise[_0x4a12('0x55')](_0x5c1cb2);})[_0x4a12('0x2b')](function(){return db[_0x4a12('0x117')]['findAll']({'where':{'teamId':{'$in':_0x32ecf5}}});})[_0x4a12('0x2b')](function(_0xebff6e){var _0x111448=_[_0x4a12('0x33')](_0xebff6e,function(_0xfef689){return db[_0x4a12('0x118')][_0x4a12('0x86')]({'UserId':_0x1bb571['id'],'VoicePrefixId':_0xfef689['VoicePrefixId']},{'transaction':_0x426718});});return Promise[_0x4a12('0x55')](_0x111448);});});})[_0x4a12('0x2b')](function(){for(var _0xa33c8d=0x0;_0xa33c8d<_0x4d2add['length'];_0xa33c8d++){var _0x301851=_0x4d2add[_0xa33c8d]['getDataValue']('channel');var _0x45cb2d=_0x301851+_0x4a12('0xa9');socket[_0x4a12('0x2d')]('user'+_0x301851+'Queue:save',{'UserId':_0x3754b2,['queueField']:_0x4d2add[_0xa33c8d]['id']});}})['then'](respondWithStatusCode(_0x5209d4,null))[_0x4a12('0x29')](APIHandleError(_0x5209d4));};exports[_0x4a12('0x119')]=function(_0x52cd18,_0x4bdf73){var _0x4cc1ae=_0x52cd18[_0x4a12('0x56')]['id'];var _0x445ec2=null;if(_0x52cd18[_0x4a12('0x47')][_0x4a12('0x61')]){_0x445ec2=_[_0x4a12('0xaf')](_0x52cd18[_0x4a12('0x47')][_0x4a12('0x61')])?_0x52cd18['query']['ids']:[_0x52cd18['query'][_0x4a12('0x61')]];}var _0x3231e3=[];return Promise['resolve']()[_0x4a12('0x2b')](function(){if(!_0x445ec2)throw new APIBadRequestError(_0x4a12('0x11a'));})[_0x4a12('0x2b')](function(){return db[_0x4a12('0x3b')][_0x4a12('0x99')]({'where':{'id':_0x4cc1ae}});})['then'](function(_0x3ffbc){if(!_0x3ffbc)throw new APINotFoundError(util[_0x4a12('0xac')]('User\x20with\x20id\x20%s\x20not\x20found',_0x52cd18[_0x4a12('0x56')]['id']));return db['sequelize'][_0x4a12('0x11b')](function(_0x3dea36){return _0x3ffbc['removeTeams'](_0x445ec2,{'transaction':_0x3dea36})[_0x4a12('0x2b')](function(){return db['Team'][_0x4a12('0x4c')]({'where':{'id':{'$in':_0x445ec2}}});})[_0x4a12('0x2b')](function(_0x5f26cf){var _0x95bf0a=_[_0x4a12('0x33')](_0x5f26cf,function(_0x6383af){return _0x6383af[_0x4a12('0x113')]();});return Promise[_0x4a12('0x55')](_0x95bf0a);})[_0x4a12('0x2b')](function(_0x102cda){_0x3231e3=_[_0x4a12('0x114')](_0x102cda);var _0x4d2e11=_[_0x4a12('0x33')](_0x3231e3,function(_0x1aee5d){return _0x1aee5d[_0x4a12('0x11c')](_0x3ffbc['id'],{'transaction':_0x3dea36});});return Promise[_0x4a12('0x55')](_0x4d2e11);})['then'](function(){if(!_0x3ffbc[_0x4a12('0xa0')])return;var _0x5d7711=_['filter'](_0x3231e3,function(_0x4c8455){return _0x4c8455[_0x4a12('0x116')](_0x4a12('0x9f'))==='Voice';});var _0x345b82=_[_0x4a12('0x33')](_0x5d7711,function(_0x5b024c){return db['UserVoiceQueueRt'][_0x4a12('0x38')]({'where':{'VoiceQueueId':_0x5b024c['id'],'UserId':_0x3ffbc['id']},'transaction':_0x3dea36});});return Promise[_0x4a12('0x55')](_0x345b82);})[_0x4a12('0x2b')](function(){return db[_0x4a12('0x117')]['findAll']({'where':{'teamId':{'$in':_0x445ec2}}});})['then'](function(_0x518bbd){var _0x48c427=_['map'](_0x518bbd,function(_0x562110){return db[_0x4a12('0x118')][_0x4a12('0x38')]({'where':{'UserId':_0x3ffbc['id'],'VoicePrefixId':_0x562110[_0x4a12('0x11d')]}},{'transaction':_0x3dea36});});return Promise[_0x4a12('0x55')](_0x48c427);});});})[_0x4a12('0x2b')](function(){for(var _0x4d4a04=0x0;_0x4d4a04<_0x3231e3[_0x4a12('0x4e')];_0x4d4a04++){var _0x4503fb=_0x3231e3[_0x4d4a04][_0x4a12('0x116')](_0x4a12('0x9f'));var _0x43386c=_0x4503fb+_0x4a12('0xa9');socket['emit']('user'+_0x4503fb+_0x4a12('0xb0'),{'UserId':_0x4cc1ae,['queueField']:_0x3231e3[_0x4d4a04]['id']});}})[_0x4a12('0x2b')](respondWithStatusCode(_0x4bdf73,null))['catch'](APIHandleError(_0x4bdf73));};exports[_0x4a12('0x11e')]=function(_0x2495ba,_0x33c03f){var _0x3ef93a={};var _0x38a308={};var _0x40540c;var _0x131578;return db[_0x4a12('0x3b')][_0x4a12('0x99')]({'where':{'id':_0x2495ba[_0x4a12('0x56')]['id']}})[_0x4a12('0x2b')](handleEntityNotFound(_0x33c03f,null))[_0x4a12('0x2b')](function(_0x3a2f78){if(_0x3a2f78){_0x40540c=_0x3a2f78;_0x38a308['model']=_[_0x4a12('0xca')](db['CmList'][_0x4a12('0x3c')]);_0x38a308[_0x4a12('0x47')]=_[_0x4a12('0xca')](_0x2495ba[_0x4a12('0x47')]);_0x38a308[_0x4a12('0xcc')]=_['intersection'](_0x38a308[_0x4a12('0xc9')],_0x38a308[_0x4a12('0x47')]);_0x3ef93a[_0x4a12('0x4b')]=_[_0x4a12('0xcd')](_0x38a308[_0x4a12('0xc9')],qs[_0x4a12('0xce')](_0x2495ba[_0x4a12('0x47')][_0x4a12('0xce')]));_0x3ef93a['attributes']=_0x3ef93a[_0x4a12('0x4b')]['length']?_0x3ef93a[_0x4a12('0x4b')]:_0x38a308[_0x4a12('0xc9')];_0x3ef93a[_0x4a12('0xcf')]=qs[_0x4a12('0xd0')](_0x2495ba['query'][_0x4a12('0xd0')]);_0x3ef93a['where']=qs[_0x4a12('0xcc')](_[_0x4a12('0xd1')](_0x2495ba['query'],_0x38a308[_0x4a12('0xcc')]));if(_0x2495ba['query'][_0x4a12('0x32')]){_0x3ef93a[_0x4a12('0x44')]=_[_0x4a12('0x57')](_0x3ef93a[_0x4a12('0x44')],{'$or':_[_0x4a12('0x33')](_0x3ef93a['attributes'],function(_0x410e9a){var _0x1a48ac={};_0x1a48ac[_0x410e9a]={'$like':'%'+_0x2495ba[_0x4a12('0x47')][_0x4a12('0x32')]+'%'};return _0x1a48ac;})});}_0x3ef93a=_[_0x4a12('0x57')]({},_0x3ef93a,_0x2495ba[_0x4a12('0x58')]);return _0x40540c[_0x4a12('0x11e')](_0x3ef93a);}})[_0x4a12('0x2b')](function(_0x2a3e5d){if(_0x2a3e5d){_0x131578=_0x2a3e5d[_0x4a12('0x4e')];if(!_0x2495ba['query'][_0x4a12('0xd3')](_0x4a12('0xd4'))){_0x3ef93a[_0x4a12('0x1b')]=qs[_0x4a12('0x1b')](_0x2495ba['query'][_0x4a12('0x1b')]);_0x3ef93a[_0x4a12('0x1a')]=qs[_0x4a12('0x1a')](_0x2495ba[_0x4a12('0x47')][_0x4a12('0x1a')]);}return _0x40540c['getLists'](_0x3ef93a);}})[_0x4a12('0x2b')](function(_0x4d4bca){if(_0x4d4bca){return _0x4d4bca?{'count':_0x131578,'rows':_0x4d4bca}:null;}})[_0x4a12('0x2b')](respondWithResult(_0x33c03f,null))['catch'](handleError(_0x33c03f,null));};exports[_0x4a12('0x11f')]=function(_0x4f1053,_0x28b0c4){var _0x2d5522={};var _0x569ed8={};var _0x31a5bc;return db['User'][_0x4a12('0x99')]({'where':{'id':_0x4f1053[_0x4a12('0x56')]['id']}})['then'](handleEntityNotFound(_0x28b0c4,null))[_0x4a12('0x2b')](function(_0x360a15){if(_0x360a15){_0x31a5bc=_0x360a15;_0x569ed8[_0x4a12('0xc9')]=_[_0x4a12('0xca')](db[_0x4a12('0x3b')][_0x4a12('0x3c')]);_0x569ed8['query']=_['keys'](_0x4f1053[_0x4a12('0x47')]);_0x569ed8[_0x4a12('0xcc')]=_[_0x4a12('0xcd')](_0x569ed8['model'],_0x569ed8[_0x4a12('0x47')]);_0x2d5522['attributes']=_[_0x4a12('0xcd')](_0x569ed8[_0x4a12('0xc9')],qs[_0x4a12('0xce')](_0x4f1053[_0x4a12('0x47')][_0x4a12('0xce')]));_0x2d5522['attributes']=_0x2d5522[_0x4a12('0x4b')][_0x4a12('0x4e')]?_0x2d5522[_0x4a12('0x4b')]:_0x569ed8[_0x4a12('0xc9')];_0x2d5522[_0x4a12('0xcf')]=qs['sort'](_0x4f1053['query'][_0x4a12('0xd0')]);_0x2d5522[_0x4a12('0x44')]=qs[_0x4a12('0xcc')](_['pick'](_0x4f1053[_0x4a12('0x47')],_0x569ed8['filters']));if(_0x4f1053[_0x4a12('0x47')]['filter']){_0x2d5522[_0x4a12('0x44')]=_['merge'](_0x2d5522[_0x4a12('0x44')],{'$or':_[_0x4a12('0x33')](_0x2d5522[_0x4a12('0x4b')],function(_0x2095fc){var _0x32cbac={};_0x32cbac[_0x2095fc]={'$like':'%'+_0x4f1053['query'][_0x4a12('0x32')]+'%'};return _0x32cbac;})});}_0x2d5522[_0x4a12('0xc9')]=db[_0x4a12('0x3b')];_0x2d5522['as']=_0x4a12('0x30');_0x2d5522=_[_0x4a12('0x57')]({},_0x2d5522,_0x4f1053[_0x4a12('0x58')]);return _0x31a5bc['getVoiceQueues']({'include':[_0x2d5522]});}})[_0x4a12('0x2b')](function(_0x5efd98){if(_0x5efd98){var _0x2197d1={},_0xf271bb=[];for(var _0x1d0498=0x0;_0x1d0498<_0x5efd98[_0x4a12('0x4e')];_0x1d0498+=0x1){for(var _0x5e786a=0x0,_0x3cbe26;_0x5e786a<_0x5efd98[_0x1d0498][_0x4a12('0x30')][_0x4a12('0x4e')];_0x5e786a+=0x1){_0x3cbe26=_0x5efd98[_0x1d0498][_0x4a12('0x30')][_0x5e786a][_0x4a12('0xab')]({'plain':!![]});_0x2197d1[_0x3cbe26['id']]=_0x3cbe26;}}_0x2197d1=_['values'](_0x2197d1);for(var _0x3a5d8b=qs[_0x4a12('0x1a')](_0x4f1053[_0x4a12('0x47')][_0x4a12('0x1a')]);_0x3a5d8b<_0x2197d1[_0x4a12('0x4e')]&&_0xf271bb['length']=_0x2239f5[_0x9ebf('0x51')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x9ebf('0x17')](function(){if(_0x5d4fa8){return db[_0x9ebf('0x24')]['destroy']({'where':{'membername':_0x5d4fa8[_0x9ebf('0x28')]},'individualHooks':!![]});}})[_0x9ebf('0x17')](function(){if(_0x5d4fa8){return _0x5d4fa8[_0x9ebf('0x52')]({'raw':!![]});}})[_0x9ebf('0x17')](function(_0x372361){if(_0x5d4fa8){if(_0x372361){var _0xee7e4f=[];_0x1d1647=_0x372361;if(_0x1d1647[_0x9ebf('0x2a')]){for(var _0x5d1fed=0x0;_0x5d1fed<_0x1d1647['length'];_0x5d1fed++){_0xee7e4f[_0x9ebf('0x2e')](db[_0x9ebf('0x24')][_0x9ebf('0x53')]({'membername':_0x5d4fa8[_0x9ebf('0x28')],'UserId':_0x5d4fa8['id'],'queue_name':_0x1d1647[_0x5d1fed]['name'],'VoiceQueueId':_0x1d1647[_0x5d1fed]['id'],'interface':_0x26ca18,'paused':_0x5d4fa8[_0x9ebf('0x54')]||![],'penalty':_0x1d1647[_0x5d1fed][_0x9ebf('0x55')]||0x0}));}return BPromise['all'](_0xee7e4f);}}}})['then'](function(){if(_0x5d4fa8){return db[_0x9ebf('0x26')]['findAll']({'where':{'membername':_0x5d4fa8[_0x9ebf('0x28')],'exitAt':null}});}})[_0x9ebf('0x17')](function(_0x45891d){if(_0x5d4fa8){if(_0x45891d&&_0x45891d['length']){var _0x4ecac8=[];_0x45891d[_0x9ebf('0x2d')](function(_0x10f6fb){_0x4ecac8[_0x9ebf('0x2e')](_0x10f6fb['update']({'exitAt':moment()[_0x9ebf('0x2f')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x9ebf('0x49')](_0x4ecac8);}}})[_0x9ebf('0x17')](function(){if(_0x5d4fa8){var _0x13700e=[];var _0x58eff0=[];var _0xa10a8f=utils[_0x9ebf('0x2c')]();var _0x1cc270={'membername':_0x5d4fa8[_0x9ebf('0x28')],'interface':_0x26ca18,'enterAt':moment()[_0x9ebf('0x2f')](_0x9ebf('0x36')),'role':_0x5d4fa8['role'],'internal':_0x5d4fa8['internal']};_0xa10a8f[_0x9ebf('0x2d')](function(_0x47b66e){_0x13700e[_0x9ebf('0x2e')](_['merge']({'channel':_0x47b66e,'type':_0x9ebf('0x56'),'data1':_0x9ebf('0x57'),'data2':_0x26ca18},_0x1cc270));if(_0x5d4fa8[_0x9ebf('0x54')]){_0x58eff0[_0x9ebf('0x2e')](_['merge']({'channel':_0x47b66e,'type':_0x9ebf('0x29'),'data1':'LOGININPAUSE'},_0x1cc270));}});return db[_0x9ebf('0x26')][_0x9ebf('0x35')](_0x13700e[_0x9ebf('0x58')](_0x58eff0),{'individualHooks':!![]});}})[_0x9ebf('0x17')](function(){if(_0x5d4fa8){return _0x5d4fa8[_0x9ebf('0x25')]({'online':!![],'lastLoginAt':moment()['format'](_0x9ebf('0x36')),'voicePause':_0x5d4fa8['loginInPause']||![],'mailPause':_0x5d4fa8[_0x9ebf('0x54')]||![],'chatPause':_0x5d4fa8[_0x9ebf('0x54')]||![],'faxPause':_0x5d4fa8[_0x9ebf('0x54')]||![],'smsPause':_0x5d4fa8[_0x9ebf('0x54')]||![],'openchannelPause':_0x5d4fa8[_0x9ebf('0x54')]||![],'pauseType':_0x5d4fa8[_0x9ebf('0x54')]?_0x9ebf('0x59'):null,'lastPauseAt':moment()[_0x9ebf('0x2f')](_0x9ebf('0x36')),'interface':_0x26ca18});}})[_0x9ebf('0x17')](function(_0xa92e9b){_0x21c153(_0xa92e9b);})[_0x9ebf('0x1a')](function(_0x28cf03){_0x282248(_0x94517c[_0x9ebf('0x1e')](0x1f4,_0x28cf03[_0x9ebf('0x1b')]));});});}; \ No newline at end of file +var _0x82c2=['internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','length','forEach','push','isNil','SIP/%s','PAUSE','YYYY-MM-DD\x20HH:mm:ss','body','MemberReport','bulkCreate','DEFAULT\x20PAUSE','UnpauseUser','resolve','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','voicePause','chatPause','faxPause','openchannelPause','smsPause','pauseType','all','LoginUser','role','mobile','phone','loginInPause','count','agent','getLicense','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','getChannels','LOGIN','callysquare','merge','LOGININPAUSE','concat','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter','./user.socket','register','User','findAll','options','raw','where','attributes','include','model','map','then','GetUser','stringify','catch','error','message','ShowUser','find','info','debug','PauseUser','name'];(function(_0x288df4,_0x33862d){var _0x42ddac=function(_0x2471ac){while(--_0x2471ac){_0x288df4['push'](_0x288df4['shift']());}};_0x42ddac(++_0x33862d);}(_0x82c2,0x80));var _0x282c=function(_0x2c3514,_0x5604d4){_0x2c3514=_0x2c3514-0x0;var _0x22ab07=_0x82c2[_0x2c3514];return _0x22ab07;};'use strict';var _=require(_0x282c('0x0'));var util=require('util');var moment=require(_0x282c('0x1'));var BPromise=require('bluebird');var Redis=require('ioredis');var db=require(_0x282c('0x2'))['db'];var utils=require(_0x282c('0x3'));var logger=require(_0x282c('0x4'))(_0x282c('0x5'));var config=require(_0x282c('0x6'));config['redis']=_[_0x282c('0x7')](config[_0x282c('0x8')],{'host':_0x282c('0x9'),'port':0x18eb});var socket=require(_0x282c('0xa'))(new Redis(config[_0x282c('0x8')]));require(_0x282c('0xb'))[_0x282c('0xc')](socket);exports['GetUser']=function(_0x44fcea){var _0x1bbc94=this;return new Promise(function(_0x4ce2b8,_0x5021b9){return db[_0x282c('0xd')][_0x282c('0xe')]({'raw':_0x44fcea[_0x282c('0xf')]?_0x44fcea[_0x282c('0xf')][_0x282c('0x10')]===undefined?!![]:![]:!![],'where':_0x44fcea[_0x282c('0xf')]?_0x44fcea[_0x282c('0xf')][_0x282c('0x11')]||null:null,'attributes':_0x44fcea[_0x282c('0xf')]?_0x44fcea[_0x282c('0xf')][_0x282c('0x12')]||null:null,'limit':_0x44fcea[_0x282c('0xf')]?_0x44fcea[_0x282c('0xf')]['limit']||null:null,'include':_0x44fcea['options']?_0x44fcea[_0x282c('0xf')]['include']?_['map'](_0x44fcea['options'][_0x282c('0x13')],function(_0x40694b){return{'model':db[_0x40694b['model']],'as':_0x40694b['as'],'attributes':_0x40694b[_0x282c('0x12')],'include':_0x40694b[_0x282c('0x13')]?_['map'](_0x40694b[_0x282c('0x13')],function(_0x4a4200){return{'model':db[_0x4a4200[_0x282c('0x14')]],'as':_0x4a4200['as'],'attributes':_0x4a4200['attributes'],'include':_0x4a4200[_0x282c('0x13')]?_[_0x282c('0x15')](_0x4a4200[_0x282c('0x13')],function(_0x1a9795){return{'model':db[_0x1a9795[_0x282c('0x14')]],'as':_0x1a9795['as'],'attributes':_0x1a9795[_0x282c('0x12')]};}):[]};}):[]};}):[]:[]})[_0x282c('0x16')](function(_0x4df529){logger['info'](_0x282c('0x17'),_0x44fcea);logger['debug']('GetUser',_0x44fcea,JSON[_0x282c('0x18')](_0x4df529));_0x4ce2b8(_0x4df529);})[_0x282c('0x19')](function(_0xddafa0){logger[_0x282c('0x1a')](_0x282c('0x17'),_0xddafa0['message'],_0x44fcea);_0x5021b9(_0x1bbc94[_0x282c('0x1a')](0x1f4,_0xddafa0[_0x282c('0x1b')]));});});};exports[_0x282c('0x1c')]=function(_0x3f62d3){var _0x3af986=this;return new Promise(function(_0x10d1cc,_0x3cc49e){return db[_0x282c('0xd')][_0x282c('0x1d')]({'raw':_0x3f62d3[_0x282c('0xf')]?_0x3f62d3['options'][_0x282c('0x10')]===undefined?!![]:![]:!![],'where':_0x3f62d3[_0x282c('0xf')]?_0x3f62d3[_0x282c('0xf')][_0x282c('0x11')]||null:null,'attributes':_0x3f62d3['options']?_0x3f62d3['options'][_0x282c('0x12')]||null:null,'include':_0x3f62d3[_0x282c('0xf')]?_0x3f62d3[_0x282c('0xf')][_0x282c('0x13')]?_[_0x282c('0x15')](_0x3f62d3[_0x282c('0xf')][_0x282c('0x13')],function(_0x4c61da){return{'model':db[_0x4c61da[_0x282c('0x14')]],'as':_0x4c61da['as'],'attributes':_0x4c61da[_0x282c('0x12')],'include':_0x4c61da[_0x282c('0x13')]?_['map'](_0x4c61da[_0x282c('0x13')],function(_0x5e6903){return{'model':db[_0x5e6903[_0x282c('0x14')]],'as':_0x5e6903['as'],'attributes':_0x5e6903['attributes'],'include':_0x5e6903[_0x282c('0x13')]?_[_0x282c('0x15')](_0x5e6903[_0x282c('0x13')],function(_0x445826){return{'model':db[_0x445826[_0x282c('0x14')]],'as':_0x445826['as'],'attributes':_0x445826[_0x282c('0x12')]};}):[]};}):[]};}):[]:[]})[_0x282c('0x16')](function(_0x11e438){logger[_0x282c('0x1e')](_0x282c('0x1c'),_0x3f62d3);logger[_0x282c('0x1f')]('ShowUser',_0x3f62d3,JSON['stringify'](_0x11e438));_0x10d1cc(_0x11e438);})[_0x282c('0x19')](function(_0x18b959){logger['error'](_0x282c('0x1c'),_0x18b959[_0x282c('0x1b')],_0x3f62d3);_0x3cc49e(_0x3af986[_0x282c('0x1a')](0x1f4,_0x18b959['message']));});});};exports[_0x282c('0x20')]=function(_0x350d64){var _0x12f6b5;return db[_0x282c('0xd')]['find']({'where':_0x350d64[_0x282c('0xf')]['where']||{},'attributes':['id',_0x282c('0x21'),'role',_0x282c('0x22'),_0x282c('0x23')]})[_0x282c('0x16')](function(_0x558053){if(!_0x558053){throw new Error(util[_0x282c('0x24')](_0x282c('0x25'),_0x350d64[_0x282c('0x26')]['id']));}_0x12f6b5=_0x558053;return db[_0x282c('0x27')][_0x282c('0x28')]({'paused':0x1},{'where':{'UserId':_0x12f6b5['id']},'individualHooks':!![]});})[_0x282c('0x16')](function(){return db['MemberReport'][_0x282c('0xe')]({'where':{'membername':_0x12f6b5[_0x282c('0x21')],'type':'PAUSE','exitAt':null}});})[_0x282c('0x16')](function(_0x34833f){if(_0x34833f&&_0x34833f[_0x282c('0x29')]){var _0x510e2b=moment()[_0x282c('0x24')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x2daae2=0x0,_0x3d9696=_0x34833f['length'];_0x2daae2<_0x3d9696;_0x2daae2++){_0x34833f[_0x2daae2]['updateAttributes']({'exitAt':_0x510e2b});}}})[_0x282c('0x16')](function(){var _0x3316bf=[];var _0x3ca5bd=utils['getChannels']();_0x3ca5bd[_0x282c('0x2a')](function(_0xce251d){_0x3316bf[_0x282c('0x2b')]({'channel':_0xce251d,'membername':_0x12f6b5[_0x282c('0x21')],'interface':_[_0x282c('0x2c')](_0x12f6b5['interface'])?util['format'](_0x282c('0x2d'),_0x12f6b5['name']):_0x12f6b5['interface'],'type':_0x282c('0x2e'),'enterAt':moment()[_0x282c('0x24')](_0x282c('0x2f')),'data1':_0x350d64[_0x282c('0x30')]['type']||'DEFAULT\x20PAUSE','role':_0x12f6b5['role'],'internal':_0x12f6b5['internal'],'uniqueid':_0x350d64[_0x282c('0x30')]['uniqueid']||null});});return db[_0x282c('0x31')][_0x282c('0x32')](_0x3316bf,{'individualHooks':!![]});})['then'](function(){return _0x12f6b5[_0x282c('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x350d64[_0x282c('0x30')]['type']||_0x282c('0x33'),'lastPauseAt':moment()['format'](_0x282c('0x2f'))});})[_0x282c('0x19')](function(_0x1b75bb){throw _0x1b75bb;});};exports[_0x282c('0x34')]=function(_0x329939){return Promise[_0x282c('0x35')]()[_0x282c('0x16')](function(){if(_0x329939[_0x282c('0x30')][_0x282c('0x36')]&&!utils['isValidChannel'](_0x329939['body']['channel'])){throw new Error(util[_0x282c('0x24')](_0x282c('0x37'),_0x329939[_0x282c('0x30')]['channel']));}return db[_0x282c('0xd')][_0x282c('0x38')]({'where':_0x329939[_0x282c('0xf')]['where']||{},'attributes':['id',_0x282c('0x21'),'role',_0x282c('0x22'),_0x282c('0x23'),'online',_0x282c('0x39'),'mailPause',_0x282c('0x3a'),_0x282c('0x3b'),_0x282c('0x3c'),_0x282c('0x3d'),'whatsappPause',_0x282c('0x3e'),'lastPauseAt']});})[_0x282c('0x16')](function(_0x4a5648){if(!_0x4a5648){throw new Error(util['format'](_0x282c('0x25'),_0x329939[_0x282c('0x26')]['id']));}return _0x4a5648['unpause'](_0x329939[_0x282c('0x30')][_0x282c('0x36')],'system');})[_0x282c('0x19')](function(_0x389d52){throw _0x389d52;});};exports['LogoutUser']=function(_0xf5b349){var _0x3526c2=this;return new Promise(function(_0x3028b0,_0x3a360d){var _0x43cd05;return db[_0x282c('0xd')][_0x282c('0x38')]({'where':_0xf5b349['options'][_0x282c('0x11')]||{},'attributes':['id',_0x282c('0x21')]})[_0x282c('0x16')](function(_0x2fd5b1){if(_0x2fd5b1){_0x43cd05=_0x2fd5b1;return db[_0x282c('0x27')]['destroy']({'where':{'membername':_0x43cd05[_0x282c('0x21')]},'individualHooks':!![]});}})[_0x282c('0x16')](function(){if(_0x43cd05){return db[_0x282c('0x31')][_0x282c('0xe')]({'where':{'membername':_0x43cd05[_0x282c('0x21')],'exitAt':null}});}})['then'](function(_0x39670d){if(_0x43cd05){if(_0x39670d&&_0x39670d[_0x282c('0x29')]){var _0x59a69f=[];_0x39670d[_0x282c('0x2a')](function(_0x5eb79b){_0x59a69f[_0x282c('0x2b')](_0x5eb79b['update']({'exitAt':moment()[_0x282c('0x24')](_0x282c('0x2f'))}));});return BPromise[_0x282c('0x3f')](_0x59a69f);}}})[_0x282c('0x16')](function(){if(_0x43cd05){return _0x43cd05['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x282c('0x16')](function(_0x27dc51){_0x3028b0(_0x27dc51);})[_0x282c('0x19')](function(_0x34c3df){_0x3a360d(_0x3526c2[_0x282c('0x1a')](0x1f4,_0x34c3df['message']));});});};exports[_0x282c('0x40')]=function(_0x3c866c){var _0x6fef14=this;return new Promise(function(_0x55bb99,_0x467c5d){var _0x1c8229;var _0x4811c3;var _0x4dedbf;var _0x5c6da1;return db[_0x282c('0xd')][_0x282c('0x38')]({'where':_0x3c866c[_0x282c('0xf')][_0x282c('0x11')]||{},'attributes':['id','name',_0x282c('0x41'),_0x282c('0x42'),_0x282c('0x43'),'internal',_0x282c('0x44'),_0x282c('0x23')]})[_0x282c('0x16')](function(_0x5d6cd5){if(_0x5d6cd5){_0x1c8229=_0x5d6cd5;_0x5c6da1=_0x3c866c[_0x282c('0x30')]['interface']?_0x3c866c[_0x282c('0x30')][_0x282c('0x23')]:util[_0x282c('0x24')](_0x282c('0x2d'),_0x1c8229[_0x282c('0x21')]);return db['User'][_0x282c('0x45')]({'where':{'role':_0x282c('0x46'),'online':!![],'id':{'$ne':_0x1c8229['id']}}});}})[_0x282c('0x16')](function(_0x3fdd56){if(_0x3fdd56){_0x4dedbf=_0x3fdd56;return require('../../config/license/util')[_0x282c('0x47')]();}})['then'](function(_0x58d0ca){if(_0x58d0ca&&_0x58d0ca['agents']&&_0x4dedbf>=_0x58d0ca['agents']){throw new Error(_0x282c('0x48'));}})[_0x282c('0x16')](function(){if(_0x1c8229){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x1c8229[_0x282c('0x21')]},'individualHooks':!![]});}})[_0x282c('0x16')](function(){if(_0x1c8229){return _0x1c8229['getVoiceQueues']({'raw':!![]});}})[_0x282c('0x16')](function(_0x57f0a5){if(_0x1c8229){if(_0x57f0a5){var _0x528517=[];_0x4811c3=_0x57f0a5;if(_0x4811c3[_0x282c('0x29')]){for(var _0x2bc481=0x0;_0x2bc481<_0x4811c3['length'];_0x2bc481++){_0x528517['push'](db['UserVoiceQueueRt'][_0x282c('0x49')]({'membername':_0x1c8229[_0x282c('0x21')],'UserId':_0x1c8229['id'],'queue_name':_0x4811c3[_0x2bc481][_0x282c('0x21')],'VoiceQueueId':_0x4811c3[_0x2bc481]['id'],'interface':_0x5c6da1,'paused':_0x1c8229[_0x282c('0x44')]||![],'penalty':_0x4811c3[_0x2bc481][_0x282c('0x4a')]||0x0}));}return BPromise[_0x282c('0x3f')](_0x528517);}}}})[_0x282c('0x16')](function(){if(_0x1c8229){return db['MemberReport'][_0x282c('0xe')]({'where':{'membername':_0x1c8229[_0x282c('0x21')],'exitAt':null}});}})[_0x282c('0x16')](function(_0x5cc666){if(_0x1c8229){if(_0x5cc666&&_0x5cc666[_0x282c('0x29')]){var _0x2fab33=[];_0x5cc666[_0x282c('0x2a')](function(_0x45d845){_0x2fab33[_0x282c('0x2b')](_0x45d845['update']({'exitAt':moment()[_0x282c('0x24')](_0x282c('0x2f'))}));});return BPromise[_0x282c('0x3f')](_0x2fab33);}}})[_0x282c('0x16')](function(){if(_0x1c8229){var _0x25888e=[];var _0x5a9ced=[];var _0x576114=utils[_0x282c('0x4b')]();var _0x30ed6f={'membername':_0x1c8229['name'],'interface':_0x5c6da1,'enterAt':moment()[_0x282c('0x24')](_0x282c('0x2f')),'role':_0x1c8229['role'],'internal':_0x1c8229[_0x282c('0x22')]};_0x576114[_0x282c('0x2a')](function(_0x530bd){_0x25888e[_0x282c('0x2b')](_['merge']({'channel':_0x530bd,'type':_0x282c('0x4c'),'data1':_0x282c('0x4d'),'data2':_0x5c6da1},_0x30ed6f));if(_0x1c8229[_0x282c('0x44')]){_0x5a9ced['push'](_[_0x282c('0x4e')]({'channel':_0x530bd,'type':'PAUSE','data1':_0x282c('0x4f')},_0x30ed6f));}});return db[_0x282c('0x31')]['bulkCreate'](_0x25888e[_0x282c('0x50')](_0x5a9ced),{'individualHooks':!![]});}})['then'](function(){if(_0x1c8229){return _0x1c8229['update']({'online':!![],'lastLoginAt':moment()[_0x282c('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x1c8229['loginInPause']||![],'mailPause':_0x1c8229[_0x282c('0x44')]||![],'chatPause':_0x1c8229['loginInPause']||![],'faxPause':_0x1c8229[_0x282c('0x44')]||![],'smsPause':_0x1c8229[_0x282c('0x44')]||![],'openchannelPause':_0x1c8229['loginInPause']||![],'pauseType':_0x1c8229[_0x282c('0x44')]?_0x282c('0x4f'):null,'lastPauseAt':moment()[_0x282c('0x24')](_0x282c('0x2f')),'interface':_0x5c6da1});}})[_0x282c('0x16')](function(_0x724901){_0x55bb99(_0x724901);})[_0x282c('0x19')](function(_0x53b1dd){_0x467c5d(_0x6fef14[_0x282c('0x1a')](0x1f4,_0x53b1dd['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index bf204dd..9bed148 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 _0x6a87=['removeListener','register','length','./user.events','save','update','emit'];(function(_0x527957,_0x5ddfb4){var _0x48b5c0=function(_0x4f8d5c){while(--_0x4f8d5c){_0x527957['push'](_0x527957['shift']());}};_0x48b5c0(++_0x5ddfb4);}(_0x6a87,0x1df));var _0x76a8=function(_0x444bfd,_0x1bde48){_0x444bfd=_0x444bfd-0x0;var _0x391184=_0x6a87[_0x444bfd];return _0x391184;};'use strict';var UserEvents=require(_0x76a8('0x0'));var events=[_0x76a8('0x1'),'remove',_0x76a8('0x2')];function createListener(_0x460d3c,_0x32a769){return function(_0xa69566){_0x32a769[_0x76a8('0x3')](_0x460d3c,_0xa69566);};}function removeListener(_0x2b55c4,_0x2c3d43){return function(){UserEvents[_0x76a8('0x4')](_0x2b55c4,_0x2c3d43);};}exports[_0x76a8('0x5')]=function(_0xd2cb88){for(var _0x4c27d0=0x0,_0x446d9a=events[_0x76a8('0x6')];_0x4c27d0<_0x446d9a;_0x4c27d0++){var _0x513663=events[_0x4c27d0];var _0x16548c=createListener('user:'+_0x513663,_0xd2cb88);UserEvents['on'](_0x513663,_0x16548c);}}; \ No newline at end of file +var _0x4e62=['remove','update','emit','removeListener','length','./user.events','save'];(function(_0x420746,_0x26dd66){var _0x1c6de2=function(_0x1162d7){while(--_0x1162d7){_0x420746['push'](_0x420746['shift']());}};_0x1c6de2(++_0x26dd66);}(_0x4e62,0xc9));var _0x24e6=function(_0x4dd2d8,_0x59335f){_0x4dd2d8=_0x4dd2d8-0x0;var _0x55cb4b=_0x4e62[_0x4dd2d8];return _0x55cb4b;};'use strict';var UserEvents=require(_0x24e6('0x0'));var events=[_0x24e6('0x1'),_0x24e6('0x2'),_0x24e6('0x3')];function createListener(_0x128028,_0x19ce74){return function(_0xac5201){_0x19ce74[_0x24e6('0x4')](_0x128028,_0xac5201);};}function removeListener(_0x17ccce,_0x5c990f){return function(){UserEvents[_0x24e6('0x5')](_0x17ccce,_0x5c990f);};}exports['register']=function(_0x51e2c4){for(var _0x2e8a5c=0x0,_0x255d04=events[_0x24e6('0x6')];_0x2e8a5c<_0x255d04;_0x2e8a5c++){var _0x34d0c5=events[_0x2e8a5c];var _0x18b34b=createListener('user:'+_0x34d0c5,_0x51e2c4);UserEvents['on'](_0x34d0c5,_0x18b34b);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index dfc4f70..5e4063c 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(_0x4a93e9,_0x5b569f){var _0x4b3ba7=function(_0x483c02){while(--_0x483c02){_0x4a93e9['push'](_0x4a93e9['shift']());}};_0x4b3ba7(++_0x5b569f);}(_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(_0xa7d77f,_0x34bc29){var _0x4351bf=function(_0x9ba889){while(--_0x9ba889){_0xa7d77f['push'](_0xa7d77f['shift']());}};_0x4351bf(++_0x34bc29);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('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 ff745f2..c3c5c18 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 _0xac47=['exports','INTEGER','sequelize'];(function(_0x57e794,_0x57221c){var _0x5cf6b4=function(_0x171981){while(--_0x171981){_0x57e794['push'](_0x57e794['shift']());}};_0x5cf6b4(++_0x57221c);}(_0xac47,0x1af));var _0x7ac4=function(_0x4b8980,_0x2559d8){_0x4b8980=_0x4b8980-0x0;var _0x2e93b4=_0xac47[_0x4b8980];return _0x2e93b4;};'use strict';var Sequelize=require(_0x7ac4('0x0'));module[_0x7ac4('0x1')]={'penalty':{'type':Sequelize[_0x7ac4('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb87c=['INTEGER','exports'];(function(_0x14e0d1,_0x15dd5a){var _0x453de6=function(_0x49717b){while(--_0x49717b){_0x14e0d1['push'](_0x14e0d1['shift']());}};_0x453de6(++_0x15dd5a);}(_0xb87c,0x1d7));var _0xcb87=function(_0x497576,_0x439927){_0x497576=_0x497576-0x0;var _0x5bb8e8=_0xb87c[_0x497576];return _0x5bb8e8;};'use strict';var Sequelize=require('sequelize');module[_0xcb87('0x0')]={'penalty':{'type':Sequelize[_0xcb87('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 afa508e..4210a9c 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 _0x4be6=['user_has_chat_queues','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','UserChatQueue'];(function(_0x2b1532,_0x18237d){var _0x2c2e98=function(_0x50401c){while(--_0x50401c){_0x2b1532['push'](_0x2b1532['shift']());}};_0x2c2e98(++_0x18237d);}(_0x4be6,0x1a3));var _0x64be=function(_0x31ec29,_0x58915c){_0x31ec29=_0x31ec29-0x0;var _0x3275fc=_0x4be6[_0x31ec29];return _0x3275fc;};'use strict';var _=require(_0x64be('0x0'));var util=require('util');var logger=require(_0x64be('0x1'))(_0x64be('0x2'));var moment=require(_0x64be('0x3'));var BPromise=require('bluebird');var rp=require(_0x64be('0x4'));var fs=require('fs');var path=require(_0x64be('0x5'));var rimraf=require(_0x64be('0x6'));var config=require(_0x64be('0x7'));var attributes=require(_0x64be('0x8'));module['exports']=function(_0x268e2d,_0x5d1f79){return _0x268e2d['define'](_0x64be('0x9'),attributes,{'tableName':_0x64be('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d8f=['bluebird','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x22c2c5,_0x4ed614){var _0x52242c=function(_0x47c6d5){while(--_0x47c6d5){_0x22c2c5['push'](_0x22c2c5['shift']());}};_0x52242c(++_0x4ed614);}(_0x2d8f,0x1cf));var _0xf2d8=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x2d8f[_0x1d50f2];return _0x3769b8;};'use strict';var _=require(_0xf2d8('0x0'));var util=require(_0xf2d8('0x1'));var logger=require(_0xf2d8('0x2'))(_0xf2d8('0x3'));var moment=require(_0xf2d8('0x4'));var BPromise=require(_0xf2d8('0x5'));var rp=require(_0xf2d8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf2d8('0x7'));var config=require(_0xf2d8('0x8'));var attributes=require(_0xf2d8('0x9'));module[_0xf2d8('0xa')]=function(_0x4d8c9c,_0x1fb560){return _0x4d8c9c[_0xf2d8('0xb')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 59c5fca..d9c7247 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 _0x92e2=['info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x92e2,0x13e));var _0x292e=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0x92e2[_0x2ca2d0];return _0x521c23;};'use strict';var _=require(_0x292e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x292e('0x1'));var rs=require(_0x292e('0x2'));var fs=require('fs');var Redis=require(_0x292e('0x3'));var db=require(_0x292e('0x4'))['db'];var utils=require(_0x292e('0x5'));var logger=require(_0x292e('0x6'))(_0x292e('0x7'));var config=require('../../config/environment');var jayson=require(_0x292e('0x8'));var client=jayson[_0x292e('0x9')][_0x292e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14e0b2,_0x5704f7,_0x4e280e){return new BPromise(function(_0x42009a,_0x584a89){return client[_0x292e('0xb')](_0x14e0b2,_0x4e280e)['then'](function(_0x50f376){logger[_0x292e('0xc')](_0x292e('0xd'),_0x5704f7,_0x292e('0xe'));logger[_0x292e('0xf')](_0x292e('0x10'),_0x5704f7,_0x292e('0xe'),JSON[_0x292e('0x11')](_0x50f376));if(_0x50f376[_0x292e('0x12')]){if(_0x50f376[_0x292e('0x12')][_0x292e('0x13')]===0x1f4){logger[_0x292e('0x12')](_0x292e('0xd'),_0x5704f7,_0x50f376[_0x292e('0x12')][_0x292e('0x14')]);return _0x584a89(_0x50f376[_0x292e('0x12')][_0x292e('0x14')]);}logger['error'](_0x292e('0xd'),_0x5704f7,_0x50f376[_0x292e('0x12')]['message']);return _0x42009a(_0x50f376['error'][_0x292e('0x14')]);}else{logger['info'](_0x292e('0xd'),_0x5704f7,'request\x20sent');_0x42009a(_0x50f376[_0x292e('0x15')][_0x292e('0x14')]);}})['catch'](function(_0x1eb2bc){logger[_0x292e('0x12')](_0x292e('0xd'),_0x5704f7,_0x1eb2bc);_0x584a89(_0x1eb2bc);});});} \ No newline at end of file +var _0xf94d=['moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xf94d,0x164));var _0xdf94=function(_0x273760,_0x259bfa){_0x273760=_0x273760-0x0;var _0xe642f0=_0xf94d[_0x273760];return _0xe642f0;};'use strict';var _=require(_0xdf94('0x0'));var util=require('util');var moment=require(_0xdf94('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf94('0x2'));var db=require(_0xdf94('0x3'))['db'];var utils=require(_0xdf94('0x4'));var logger=require('../../config/logger')(_0xdf94('0x5'));var config=require('../../config/environment');var jayson=require(_0xdf94('0x6'));var client=jayson[_0xdf94('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5634ab,_0x27efa7,_0x27cb4c){return new BPromise(function(_0x4bc948,_0x449081){return client['request'](_0x5634ab,_0x27cb4c)['then'](function(_0x48df13){logger[_0xdf94('0x8')](_0xdf94('0x9'),_0x27efa7,_0xdf94('0xa'));logger[_0xdf94('0xb')](_0xdf94('0xc'),_0x27efa7,'request\x20sent',JSON[_0xdf94('0xd')](_0x48df13));if(_0x48df13[_0xdf94('0xe')]){if(_0x48df13[_0xdf94('0xe')]['code']===0x1f4){logger[_0xdf94('0xe')](_0xdf94('0x9'),_0x27efa7,_0x48df13['error'][_0xdf94('0xf')]);return _0x449081(_0x48df13[_0xdf94('0xe')][_0xdf94('0xf')]);}logger[_0xdf94('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x27efa7,_0x48df13['error'][_0xdf94('0xf')]);return _0x4bc948(_0x48df13[_0xdf94('0xe')][_0xdf94('0xf')]);}else{logger[_0xdf94('0x8')]('UserChatQueue,\x20%s,\x20%s',_0x27efa7,_0xdf94('0xa'));_0x4bc948(_0x48df13[_0xdf94('0x10')]['message']);}})['catch'](function(_0x3a543c){logger[_0xdf94('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x27efa7,_0x3a543c);_0x449081(_0x3a543c);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index be6bcca..9529147 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x51c440,_0x3b6802){var _0x67a2d6=function(_0x3d15ab){while(--_0x3d15ab){_0x51c440['push'](_0x51c440['shift']());}};_0x67a2d6(++_0x3b6802);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'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(_0x536128,_0x205e2b){var _0x19eb75=function(_0x5d5aa0){while(--_0x5d5aa0){_0x536128['push'](_0x536128['shift']());}};_0x19eb75(++_0x205e2b);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index c074a03..654472d 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 _0x5733=['sequelize','INTEGER'];(function(_0x333798,_0x9f6561){var _0x389f4e=function(_0x193b28){while(--_0x193b28){_0x333798['push'](_0x333798['shift']());}};_0x389f4e(++_0x9f6561);}(_0x5733,0x180));var _0x3573=function(_0x25c9e9,_0x15c704){_0x25c9e9=_0x25c9e9-0x0;var _0x2e6cfc=_0x5733[_0x25c9e9];return _0x2e6cfc;};'use strict';var Sequelize=require(_0x3573('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x3573('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3573('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x02aa=['sequelize','exports','INTEGER','STRING'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x02aa,0x1f4));var _0xa02a=function(_0x48f7cf,_0x4baa04){_0x48f7cf=_0x48f7cf-0x0;var _0xc201c0=_0x02aa[_0x48f7cf];return _0xc201c0;};'use strict';var Sequelize=require(_0xa02a('0x0'));module[_0xa02a('0x1')]={'penalty':{'type':Sequelize[_0xa02a('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xa02a('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index c6153bf..8ee6af5 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 _0x5eef=['util','bluebird','request-promise','exports','UserFaxQueue','user_has_fax_queues','lodash'];(function(_0x419c0c,_0x2598ad){var _0x391694=function(_0x530772){while(--_0x530772){_0x419c0c['push'](_0x419c0c['shift']());}};_0x391694(++_0x2598ad);}(_0x5eef,0x172));var _0xf5ee=function(_0x58a2cd,_0x7cf5b7){_0x58a2cd=_0x58a2cd-0x0;var _0x4ea4ca=_0x5eef[_0x58a2cd];return _0x4ea4ca;};'use strict';var _=require(_0xf5ee('0x0'));var util=require(_0xf5ee('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf5ee('0x2'));var rp=require(_0xf5ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module[_0xf5ee('0x4')]=function(_0x99c5b2,_0x5e98e9){return _0x99c5b2['define'](_0xf5ee('0x5'),attributes,{'tableName':_0xf5ee('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2f6=['exports','define','UserFaxQueue','user_has_fax_queues','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4288c7,_0x3fdecd){var _0x498b2a=function(_0xcc02ff){while(--_0xcc02ff){_0x4288c7['push'](_0x4288c7['shift']());}};_0x498b2a(++_0x3fdecd);}(_0xa2f6,0xea));var _0x6a2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa2f6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6a2f('0x0'))(_0x6a2f('0x1'));var moment=require(_0x6a2f('0x2'));var BPromise=require(_0x6a2f('0x3'));var rp=require(_0x6a2f('0x4'));var fs=require('fs');var path=require(_0x6a2f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module[_0x6a2f('0x6')]=function(_0x48c59e,_0x3e41e2){return _0x48c59e[_0x6a2f('0x7')](_0x6a2f('0x8'),attributes,{'tableName':_0x6a2f('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 231a635..0c311cf 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 _0xd9b0=['result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x2e4c9f,_0x31a166){var _0x25a620=function(_0x5e9fdf){while(--_0x5e9fdf){_0x2e4c9f['push'](_0x2e4c9f['shift']());}};_0x25a620(++_0x31a166);}(_0xd9b0,0x188));var _0x0d9b=function(_0x24869e,_0x5d9a14){_0x24869e=_0x24869e-0x0;var _0x183df6=_0xd9b0[_0x24869e];return _0x183df6;};'use strict';var _=require('lodash');var util=require(_0x0d9b('0x0'));var moment=require(_0x0d9b('0x1'));var BPromise=require(_0x0d9b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d9b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d9b('0x4'))(_0x0d9b('0x5'));var config=require(_0x0d9b('0x6'));var jayson=require(_0x0d9b('0x7'));var client=jayson['client'][_0x0d9b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22c07e,_0x35499c,_0x410d03){return new BPromise(function(_0x5ccaff,_0x5a6e12){return client['request'](_0x22c07e,_0x410d03)['then'](function(_0xc11579){logger['info'](_0x0d9b('0x9'),_0x35499c,_0x0d9b('0xa'));logger['debug'](_0x0d9b('0xb'),_0x35499c,_0x0d9b('0xa'),JSON[_0x0d9b('0xc')](_0xc11579));if(_0xc11579['error']){if(_0xc11579[_0x0d9b('0xd')]['code']===0x1f4){logger[_0x0d9b('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x35499c,_0xc11579[_0x0d9b('0xd')][_0x0d9b('0xe')]);return _0x5a6e12(_0xc11579[_0x0d9b('0xd')][_0x0d9b('0xe')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x35499c,_0xc11579[_0x0d9b('0xd')][_0x0d9b('0xe')]);return _0x5ccaff(_0xc11579['error'][_0x0d9b('0xe')]);}else{logger[_0x0d9b('0xf')](_0x0d9b('0x9'),_0x35499c,_0x0d9b('0xa'));_0x5ccaff(_0xc11579[_0x0d9b('0x10')][_0x0d9b('0xe')]);}})['catch'](function(_0x5d10d8){logger[_0x0d9b('0xd')](_0x0d9b('0x9'),_0x35499c,_0x5d10d8);_0x5a6e12(_0x5d10d8);});});} \ No newline at end of file +var _0xedac=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x6182ff,_0x59d492){var _0x1cec22=function(_0x2e96f8){while(--_0x2e96f8){_0x6182ff['push'](_0x6182ff['shift']());}};_0x1cec22(++_0x59d492);}(_0xedac,0xf0));var _0xceda=function(_0x128ed5,_0x282b69){_0x128ed5=_0x128ed5-0x0;var _0x1cb68a=_0xedac[_0x128ed5];return _0x1cb68a;};'use strict';var _=require(_0xceda('0x0'));var util=require('util');var moment=require(_0xceda('0x1'));var BPromise=require(_0xceda('0x2'));var rs=require(_0xceda('0x3'));var fs=require('fs');var Redis=require(_0xceda('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xceda('0x5'));var logger=require(_0xceda('0x6'))(_0xceda('0x7'));var config=require(_0xceda('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xceda('0x9')][_0xceda('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cb216,_0x197cb2,_0x27d2d0){return new BPromise(function(_0x4409b9,_0x26903f){return client[_0xceda('0xb')](_0x4cb216,_0x27d2d0)[_0xceda('0xc')](function(_0x56586e){logger[_0xceda('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x197cb2,_0xceda('0xe'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x197cb2,_0xceda('0xe'),JSON[_0xceda('0xf')](_0x56586e));if(_0x56586e['error']){if(_0x56586e[_0xceda('0x10')][_0xceda('0x11')]===0x1f4){logger['error'](_0xceda('0x12'),_0x197cb2,_0x56586e[_0xceda('0x10')][_0xceda('0x13')]);return _0x26903f(_0x56586e[_0xceda('0x10')][_0xceda('0x13')]);}logger['error'](_0xceda('0x12'),_0x197cb2,_0x56586e[_0xceda('0x10')][_0xceda('0x13')]);return _0x4409b9(_0x56586e['error']['message']);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x197cb2,_0xceda('0xe'));_0x4409b9(_0x56586e[_0xceda('0x14')][_0xceda('0x13')]);}})[_0xceda('0x15')](function(_0x5b5f5a){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x197cb2,_0x5b5f5a);_0x26903f(_0x5b5f5a);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 22b64ec..df97ed3 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1de357,_0x10512b){var _0x56cd22=function(_0x51dee6){while(--_0x51dee6){_0x1de357['push'](_0x1de357['shift']());}};_0x56cd22(++_0x10512b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x107ca5,_0x4b7f1c){var _0x47e5ae=function(_0x4e2910){while(--_0x4e2910){_0x107ca5['push'](_0x107ca5['shift']());}};_0x47e5ae(++_0x4b7f1c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 6682d95..9006424 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 _0xed96=['sequelize','exports'];(function(_0x4acb0e,_0x323101){var _0x44a0ad=function(_0x20cf28){while(--_0x20cf28){_0x4acb0e['push'](_0x4acb0e['shift']());}};_0x44a0ad(++_0x323101);}(_0xed96,0x10e));var _0x6ed9=function(_0x4a6cf8,_0x5534ef){_0x4a6cf8=_0x4a6cf8-0x0;var _0x22205e=_0xed96[_0x4a6cf8];return _0x22205e;};'use strict';var Sequelize=require(_0x6ed9('0x0'));module[_0x6ed9('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index c1d267b..43a4991 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 _0xf7c3=['bluebird','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','lodash','util','moment'];(function(_0xfb4fd8,_0x516759){var _0x242073=function(_0x3704bd){while(--_0x3704bd){_0xfb4fd8['push'](_0xfb4fd8['shift']());}};_0x242073(++_0x516759);}(_0xf7c3,0xba));var _0x3f7c=function(_0x400406,_0x529b9f){_0x400406=_0x400406-0x0;var _0x1374e3=_0xf7c3[_0x400406];return _0x1374e3;};'use strict';var _=require(_0x3f7c('0x0'));var util=require(_0x3f7c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3f7c('0x2'));var BPromise=require(_0x3f7c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3f7c('0x4'));var config=require(_0x3f7c('0x5'));var attributes=require(_0x3f7c('0x6'));module[_0x3f7c('0x7')]=function(_0xeaa964,_0xf51afe){return _0xeaa964[_0x3f7c('0x8')]('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee95=['api','bluebird','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util'];(function(_0x29d989,_0x1c0c39){var _0x2dbf13=function(_0xf65a4f){while(--_0xf65a4f){_0x29d989['push'](_0x29d989['shift']());}};_0x2dbf13(++_0x1c0c39);}(_0xee95,0xc4));var _0x5ee9=function(_0x150e79,_0x5e1828){_0x150e79=_0x150e79-0x0;var _0x45ab90=_0xee95[_0x150e79];return _0x45ab90;};'use strict';var _=require(_0x5ee9('0x0'));var util=require(_0x5ee9('0x1'));var logger=require('../../config/logger')(_0x5ee9('0x2'));var moment=require('moment');var BPromise=require(_0x5ee9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5ee9('0x4'));var config=require(_0x5ee9('0x5'));var attributes=require(_0x5ee9('0x6'));module[_0x5ee9('0x7')]=function(_0x1364b0,_0x4b779b){return _0x1364b0[_0x5ee9('0x8')](_0x5ee9('0x9'),attributes,{'tableName':_0x5ee9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 1cfe3ea..883d2c0 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 _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x4323b7,_0x18d4d5){var _0x3d92e4=function(_0x1a9482){while(--_0x1a9482){_0x4323b7['push'](_0x4323b7['shift']());}};_0x3d92e4(++_0x18d4d5);}(_0x55ca,0x126));var _0xa55c=function(_0x269094,_0x4701b3){_0x269094=_0x269094-0x0;var _0x10344f=_0x55ca[_0x269094];return _0x10344f;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x1cb9,0x14e));var _0x91cb=function(_0x28cb02,_0x43c020){_0x28cb02=_0x28cb02-0x0;var _0x778862=_0x1cb9[_0x28cb02];return _0x778862;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 217048d..cbb46e6 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 _0x4359=['exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification'];(function(_0x4236a2,_0x5a7dbb){var _0x24f8eb=function(_0x44c65b){while(--_0x44c65b){_0x4236a2['push'](_0x4236a2['shift']());}};_0x24f8eb(++_0x5a7dbb);}(_0x4359,0xb5));var _0x9435=function(_0x29a2c2,_0xcafe3a){_0x29a2c2=_0x29a2c2-0x0;var _0x5d9e9b=_0x4359[_0x29a2c2];return _0x5d9e9b;};'use strict';var multer=require(_0x9435('0x0'));var util=require(_0x9435('0x1'));var path=require(_0x9435('0x2'));var timeout=require(_0x9435('0x3'));var express=require(_0x9435('0x4'));var router=express[_0x9435('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9435('0x6'));var controller=require(_0x9435('0x7'));router[_0x9435('0x8')]('/',auth[_0x9435('0x9')](),controller[_0x9435('0xa')]);module[_0x9435('0xb')]=router; \ No newline at end of file +var _0x208f=['../../config/environment','./userNotification.controller','post','isAuthenticated','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3ee2b0,_0xeaf075){var _0x2fb5c7=function(_0x478c6e){while(--_0x478c6e){_0x3ee2b0['push'](_0x3ee2b0['shift']());}};_0x2fb5c7(++_0xeaf075);}(_0x208f,0xb9));var _0xf208=function(_0x1f5a73,_0xea4710){_0x1f5a73=_0x1f5a73-0x0;var _0x3b8d32=_0x208f[_0x1f5a73];return _0x3b8d32;};'use strict';var multer=require('multer');var util=require(_0xf208('0x0'));var path=require(_0xf208('0x1'));var timeout=require(_0xf208('0x2'));var express=require(_0xf208('0x3'));var router=express[_0xf208('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf208('0x5'));var interaction=require(_0xf208('0x6'));var config=require(_0xf208('0x7'));var controller=require(_0xf208('0x8'));router[_0xf208('0x9')]('/',auth[_0xf208('0xa')](),controller['sendUserNotification']);module[_0xf208('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 12802f7..52c5df1 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 _0xe42e=['BOOLEAN','exports','STRING'];(function(_0x4bb4b1,_0x1959c2){var _0x10a8af=function(_0x3a7534){while(--_0x3a7534){_0x4bb4b1['push'](_0x4bb4b1['shift']());}};_0x10a8af(++_0x1959c2);}(_0xe42e,0xe2));var _0xee42=function(_0x3d7c7b,_0x161a3d){_0x3d7c7b=_0x3d7c7b-0x0;var _0x106c63=_0xe42e[_0x3d7c7b];return _0x106c63;};'use strict';var Sequelize=require('sequelize');module[_0xee42('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xee42('0x1')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xee42('0x1')]},'beep':{'type':Sequelize[_0xee42('0x2')]}}; \ No newline at end of file +var _0x13fa=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x96a50d,_0x4a3efe){var _0x1052a8=function(_0x27f8da){while(--_0x27f8da){_0x96a50d['push'](_0x96a50d['shift']());}};_0x1052a8(++_0x4a3efe);}(_0x13fa,0x156));var _0xa13f=function(_0x4b4638,_0xe99cda){_0x4b4638=_0x4b4638-0x0;var _0x59e92b=_0x13fa[_0x4b4638];return _0x59e92b;};'use strict';var Sequelize=require(_0xa13f('0x0'));module[_0xa13f('0x1')]={'body':{'type':Sequelize[_0xa13f('0x2')]},'senderName':{'type':Sequelize[_0xa13f('0x3')]},'recipientsId':{'type':Sequelize[_0xa13f('0x2')]},'recipientsDescription':{'type':Sequelize[_0xa13f('0x3')]},'beep':{'type':Sequelize[_0xa13f('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 6e4e91a..cf415e0 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 _0x48ee=['html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','union','ids','queue','replace','Queue','push','all','flatten','getAgents','map','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','./userNotification.socket','register','status','end','json','undefined','limit','count','offset','set','save','update','then','destroy','sendStatus','error','name','body','hasOwnProperty','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','Sequelize','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','catch','text','Template','findOne'];(function(_0xe575ed,_0x577854){var _0x4850a0=function(_0x4ddd26){while(--_0x4ddd26){_0xe575ed['push'](_0xe575ed['shift']());}};_0x4850a0(++_0x577854);}(_0x48ee,0x191));var _0xe48e=function(_0x33e34d,_0x4ae89d){_0x33e34d=_0x33e34d-0x0;var _0x244967=_0x48ee[_0x33e34d];return _0x244967;};'use strict';var emlformat=require(_0xe48e('0x0'));var rimraf=require(_0xe48e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe48e('0x2'));var rp=require(_0xe48e('0x3'));var moment=require(_0xe48e('0x4'));var BPromise=require(_0xe48e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe48e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe48e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe48e('0x8'));var squel=require(_0xe48e('0x9'));var crypto=require(_0xe48e('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe48e('0xb'));var querystring=require(_0xe48e('0xc'));var Papa=require(_0xe48e('0xd'));var Redis=require(_0xe48e('0xe'));var authService=require(_0xe48e('0xf'));var qs=require(_0xe48e('0x10'));var as=require(_0xe48e('0x11'));var hardwareService=require(_0xe48e('0x12'));var logger=require(_0xe48e('0x13'))(_0xe48e('0x14'));var utils=require(_0xe48e('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe48e('0x16')]=_[_0xe48e('0x17')](config[_0xe48e('0x16')],{'host':_0xe48e('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe48e('0x19'))[_0xe48e('0x1a')](socket);function respondWithStatusCode(_0x51aed7,_0x141461){_0x141461=_0x141461||0xcc;return function(_0x2b43ee){if(_0x2b43ee){return _0x51aed7['sendStatus'](_0x141461);}return _0x51aed7[_0xe48e('0x1b')](_0x141461)[_0xe48e('0x1c')]();};}function respondWithResult(_0x4f966c,_0x4b664b){_0x4b664b=_0x4b664b||0xc8;return function(_0xd69950){if(_0xd69950){return _0x4f966c[_0xe48e('0x1b')](_0x4b664b)[_0xe48e('0x1d')](_0xd69950);}};}function respondWithFilteredResult(_0x4c37d9,_0x2a331b){return function(_0x483f45){if(_0x483f45){var _0x39caa1=typeof _0x2a331b['offset']===_0xe48e('0x1e')&&typeof _0x2a331b[_0xe48e('0x1f')]===_0xe48e('0x1e');var _0x5c9f7f=_0x483f45[_0xe48e('0x20')];var _0x19ba4b=_0x39caa1?0x0:_0x2a331b[_0xe48e('0x21')];var _0x348757=_0x39caa1?_0x483f45['count']:_0x2a331b[_0xe48e('0x21')]+_0x2a331b[_0xe48e('0x1f')];var _0x3a3ac4;if(_0x348757>=_0x5c9f7f){_0x348757=_0x5c9f7f;_0x3a3ac4=0xc8;}else{_0x3a3ac4=0xce;}_0x4c37d9['status'](_0x3a3ac4);return _0x4c37d9[_0xe48e('0x22')]('Content-Range',_0x19ba4b+'-'+_0x348757+'/'+_0x5c9f7f)[_0xe48e('0x1d')](_0x483f45);}return null;};}function patchUpdates(_0x384166){return function(_0x1ccae9){try{jsonpatch['apply'](_0x1ccae9,_0x384166,!![]);}catch(_0x2d0b5c){return BPromise['reject'](_0x2d0b5c);}return _0x1ccae9[_0xe48e('0x23')]();};}function saveUpdates(_0xca8e07,_0x554c12){return function(_0x278746){if(_0x278746){return _0x278746[_0xe48e('0x24')](_0xca8e07)[_0xe48e('0x25')](function(_0x295d2d){return _0x295d2d;});}return null;};}function removeEntity(_0x206bc4,_0x423666){return function(_0x1cce60){if(_0x1cce60){return _0x1cce60[_0xe48e('0x26')]()['then'](function(){_0x206bc4['status'](0xcc)[_0xe48e('0x1c')]();});}};}function handleEntityNotFound(_0x806603,_0x452927){return function(_0x5289e9){if(!_0x5289e9){_0x806603[_0xe48e('0x27')](0x194);}return _0x5289e9;};}function handleError(_0x3029d1,_0x3598ac){_0x3598ac=_0x3598ac||0x1f4;return function(_0x2e1b40){logger[_0xe48e('0x28')](_0x2e1b40['stack']);if(_0x2e1b40[_0xe48e('0x29')]){delete _0x2e1b40['name'];}_0x3029d1['status'](_0x3598ac)['send'](_0x2e1b40);};}exports['sendUserNotification']=function(_0x5c16da,_0x3bd03c,_0x4560c5){if(!_0x5c16da[_0xe48e('0x2a')]['hasOwnProperty']('text')&&!_0x5c16da['body'][_0xe48e('0x2b')]('TemplateId')){throw new db['Sequelize'][(_0xe48e('0x2c'))](_0xe48e('0x2d'));}else{if(_0x5c16da[_0xe48e('0x2a')][_0xe48e('0x2b')](_0xe48e('0x2e'))&&!_0x5c16da[_0xe48e('0x2a')][_0xe48e('0x2b')](_0xe48e('0x2f'))){throw new db['Sequelize'][(_0xe48e('0x2c'))](_0xe48e('0x30'));}if(!_0x5c16da[_0xe48e('0x2a')][_0xe48e('0x2b')](_0xe48e('0x31'))){throw new db[(_0xe48e('0x32'))]['ValidationError'](_0xe48e('0x33'));}else{try{var _0x1a9918=JSON['parse'](_0x5c16da[_0xe48e('0x2a')][_0xe48e('0x31')]);}catch(_0x1042ff){logger['error'](_0x1042ff);throw new db[(_0xe48e('0x32'))][(_0xe48e('0x2c'))](_0xe48e('0x34'));}var _0x87db71=[_0xe48e('0x35'),_0xe48e('0x36'),_0xe48e('0x37'),'openchannelqueue',_0xe48e('0x38'),_0xe48e('0x39'),_0xe48e('0x3a'),_0xe48e('0x3b'),_0xe48e('0x3c')];if(_[_0xe48e('0x3d')](_0x1a9918,function(_0x478123){return!_[_0xe48e('0x3e')](_0x87db71,_0x478123[_0xe48e('0x3f')][_0xe48e('0x40')]());})){throw new db[(_0xe48e('0x32'))][(_0xe48e('0x2c'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x493910={};_0x493910[_0xe48e('0x41')]=_0x5c16da['body']['hasOwnProperty']('senderName')?_0x5c16da[_0xe48e('0x2a')][_0xe48e('0x41')]:_0x5c16da[_0xe48e('0x3c')]['fullname'];_0x493910[_0xe48e('0x42')]=_[_0xe48e('0x43')](_0x5c16da[_0xe48e('0x2a')][_0xe48e('0x42')])?null:_0x5c16da[_0xe48e('0x2a')][_0xe48e('0x42')];_0x493910[_0xe48e('0x44')]=_0x5c16da[_0xe48e('0x2a')][_0xe48e('0x44')]||![];_0x493910[_0xe48e('0x45')]=_0x5c16da[_0xe48e('0x3c')]['id'];return getContent(_0x5c16da['body'])[_0xe48e('0x25')](function(_0x4cf72f){_0x493910[_0xe48e('0x2a')]=_0x4cf72f;return getRecipients(_0x1a9918);})[_0xe48e('0x25')](function(_0x2bb762){_0x493910[_0xe48e('0x46')]=_[_0xe48e('0x47')](_0x2bb762)[_0xe48e('0x48')](',');return db[_0xe48e('0x49')][_0xe48e('0x4a')](function(_0x11d79){return db[_0xe48e('0x4b')][_0xe48e('0x4c')](_0x493910,{'raw':!![],'transaction':_0x11d79})[_0xe48e('0x25')](function(_0x466f47){var _0x15767c={'sender':_0x493910[_0xe48e('0x41')],'description':_0x493910[_0xe48e('0x42')],'content':_0x493910[_0xe48e('0x2a')],'beep':_0x493910[_0xe48e('0x44')]};_0x2bb762[_0xe48e('0x4d')](function(_0x30c028){_0x15767c[_0xe48e('0x4e')]=_0x30c028;socket[_0xe48e('0x4f')]('userNotification:send',_0x15767c);});return _0x466f47;});});})['then'](respondWithResult(_0x3bd03c,0xc9))[_0xe48e('0x50')](handleError(_0x3bd03c,null));};function getContent(_0x73a1bc){return new BPromise(function(_0x411394,_0x7cc71e){if(_0x73a1bc['text']){_0x411394(_0x73a1bc[_0xe48e('0x51')]);return;}return db[_0xe48e('0x52')][_0xe48e('0x53')]({'attributes':[_0xe48e('0x54')],'where':{'id':_0x73a1bc[_0xe48e('0x2e')]},'raw':!![]})[_0xe48e('0x25')](function(_0x58ed0f){if(!_0x58ed0f)throw new db[(_0xe48e('0x32'))][(_0xe48e('0x2c'))](_0xe48e('0x55'));var _0x56c3f8=Mustache['render'](_0x58ed0f['html'],_0x73a1bc['view']);_0x411394(_0x56c3f8);})[_0xe48e('0x50')](function(_0x302071){_0x7cc71e(_0x302071);});});}function getRecipients(_0x3b0a75){return new BPromise(function(_0x3dad77,_0x5350ae){var _0x226d9=[];var _0x3a2ee1=[];_0x3b0a75[_0xe48e('0x4d')](function(_0x17afdf){var _0x7e67dc=_[_0xe48e('0x56')](_0x17afdf[_0xe48e('0x3f')][_0xe48e('0x40')]());if(_0x7e67dc==='User'){_0x226d9=_[_0xe48e('0x57')](_0x226d9,_0x17afdf[_0xe48e('0x58')]);}else{if(_[_0xe48e('0x3e')](_0x7e67dc,_0xe48e('0x59')))_0x7e67dc=_0x7e67dc[_0xe48e('0x5a')](_0xe48e('0x59'),_0xe48e('0x5b'));_0x17afdf[_0xe48e('0x58')][_0xe48e('0x4d')](function(_0x10836c){_0x3a2ee1[_0xe48e('0x5c')](getAgents(_0x7e67dc,_0x10836c));});}});return BPromise[_0xe48e('0x5d')](_0x3a2ee1)['then'](function(_0x2bb1b0){_0x226d9=_[_0xe48e('0x57')](_0x226d9,_[_0xe48e('0x5e')](_0x2bb1b0));_0x3dad77(_0x226d9);})[_0xe48e('0x50')](function(_0x66c36e){_0x5350ae(_0x66c36e);});});}function getAgents(_0x3932c5,_0x1f9aa3){return new BPromise(function(_0x391a9b,_0x3d6c08){return db[_0x3932c5][_0xe48e('0x53')]({'where':{'id':_0x1f9aa3}})[_0xe48e('0x25')](function(_0x48235c){return _0x48235c[_0xe48e('0x5f')]({'attributes':['id'],'raw':!![]})[_0xe48e('0x25')](function(_0x40f4ae){var _0x1d1a9c=_[_0xe48e('0x60')](_0x40f4ae,'id');_0x391a9b(_0x1d1a9c);});})['catch'](function(_0x321f11){_0x3d6c08(_0x321f11);});});} \ No newline at end of file +var _0x174b=['hasOwnProperty','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','beep','join','sequelize','transaction','UserNotification','create','recipient','emit','userNotification:send','catch','text','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','forEach','startCase','User','ids','replace','queue','Queue','push','all','union','flatten','findOne','getAgents','map','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./userNotification.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','name','send','sendUserNotification','body','TemplateId','Sequelize','ValidationError'];(function(_0x9acaf3,_0x49734a){var _0x32f53b=function(_0x16667b){while(--_0x16667b){_0x9acaf3['push'](_0x9acaf3['shift']());}};_0x32f53b(++_0x49734a);}(_0x174b,0x9c));var _0xb174=function(_0x237e86,_0x46231e){_0x237e86=_0x237e86-0x0;var _0x68edf9=_0x174b[_0x237e86];return _0x68edf9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb174('0x0'));var zipdir=require(_0xb174('0x1'));var jsonpatch=require(_0xb174('0x2'));var rp=require(_0xb174('0x3'));var moment=require('moment');var BPromise=require(_0xb174('0x4'));var Mustache=require(_0xb174('0x5'));var util=require('util');var path=require(_0xb174('0x6'));var sox=require(_0xb174('0x7'));var csv=require(_0xb174('0x8'));var ejs=require(_0xb174('0x9'));var fs=require('fs');var fs_extra=require(_0xb174('0xa'));var _=require('lodash');var squel=require(_0xb174('0xb'));var crypto=require(_0xb174('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb174('0x8'));var querystring=require(_0xb174('0xd'));var Papa=require(_0xb174('0xe'));var Redis=require(_0xb174('0xf'));var authService=require(_0xb174('0x10'));var qs=require(_0xb174('0x11'));var as=require(_0xb174('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb174('0x13'))(_0xb174('0x14'));var utils=require(_0xb174('0x15'));var config=require(_0xb174('0x16'));var licenseUtil=require(_0xb174('0x17'));var db=require(_0xb174('0x18'))['db'];config['redis']=_[_0xb174('0x19')](config['redis'],{'host':_0xb174('0x1a'),'port':0x18eb});var socket=require(_0xb174('0x1b'))(new Redis(config[_0xb174('0x1c')]));require(_0xb174('0x1d'))[_0xb174('0x1e')](socket);function respondWithStatusCode(_0x3c1e77,_0x23aa60){_0x23aa60=_0x23aa60||0xcc;return function(_0x19e1a8){if(_0x19e1a8){return _0x3c1e77['sendStatus'](_0x23aa60);}return _0x3c1e77[_0xb174('0x1f')](_0x23aa60)[_0xb174('0x20')]();};}function respondWithResult(_0xa70bb1,_0x455cd9){_0x455cd9=_0x455cd9||0xc8;return function(_0x24e61e){if(_0x24e61e){return _0xa70bb1['status'](_0x455cd9)[_0xb174('0x21')](_0x24e61e);}};}function respondWithFilteredResult(_0x26e093,_0x184fbd){return function(_0x36c7df){if(_0x36c7df){var _0x351afb=typeof _0x184fbd['offset']===_0xb174('0x22')&&typeof _0x184fbd[_0xb174('0x23')]===_0xb174('0x22');var _0x1cd5e3=_0x36c7df[_0xb174('0x24')];var _0x49e336=_0x351afb?0x0:_0x184fbd[_0xb174('0x25')];var _0x40bfde=_0x351afb?_0x36c7df[_0xb174('0x24')]:_0x184fbd[_0xb174('0x25')]+_0x184fbd['limit'];var _0x2627e6;if(_0x40bfde>=_0x1cd5e3){_0x40bfde=_0x1cd5e3;_0x2627e6=0xc8;}else{_0x2627e6=0xce;}_0x26e093[_0xb174('0x1f')](_0x2627e6);return _0x26e093[_0xb174('0x26')](_0xb174('0x27'),_0x49e336+'-'+_0x40bfde+'/'+_0x1cd5e3)[_0xb174('0x21')](_0x36c7df);}return null;};}function patchUpdates(_0x36127a){return function(_0x35b50b){try{jsonpatch['apply'](_0x35b50b,_0x36127a,!![]);}catch(_0x5a7558){return BPromise[_0xb174('0x28')](_0x5a7558);}return _0x35b50b[_0xb174('0x29')]();};}function saveUpdates(_0x4d7419,_0x3abcb7){return function(_0x4721ea){if(_0x4721ea){return _0x4721ea[_0xb174('0x2a')](_0x4d7419)[_0xb174('0x2b')](function(_0x374d10){return _0x374d10;});}return null;};}function removeEntity(_0x49a918,_0x2526f0){return function(_0x37d47f){if(_0x37d47f){return _0x37d47f[_0xb174('0x2c')]()[_0xb174('0x2b')](function(){_0x49a918[_0xb174('0x1f')](0xcc)[_0xb174('0x20')]();});}};}function handleEntityNotFound(_0x3e5b33,_0x2d9b77){return function(_0x6fe67c){if(!_0x6fe67c){_0x3e5b33[_0xb174('0x2d')](0x194);}return _0x6fe67c;};}function handleError(_0x21ce07,_0x28f14e){_0x28f14e=_0x28f14e||0x1f4;return function(_0x94b1f1){logger[_0xb174('0x2e')](_0x94b1f1['stack']);if(_0x94b1f1[_0xb174('0x2f')]){delete _0x94b1f1[_0xb174('0x2f')];}_0x21ce07[_0xb174('0x1f')](_0x28f14e)[_0xb174('0x30')](_0x94b1f1);};}exports[_0xb174('0x31')]=function(_0x2e8eb5,_0x4bbe93,_0x38512e){if(!_0x2e8eb5[_0xb174('0x32')]['hasOwnProperty']('text')&&!_0x2e8eb5[_0xb174('0x32')]['hasOwnProperty'](_0xb174('0x33'))){throw new db[(_0xb174('0x34'))][(_0xb174('0x35'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x2e8eb5[_0xb174('0x32')][_0xb174('0x36')](_0xb174('0x33'))&&!_0x2e8eb5[_0xb174('0x32')][_0xb174('0x36')]('view')){throw new db['Sequelize'][(_0xb174('0x35'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x2e8eb5[_0xb174('0x32')]['hasOwnProperty'](_0xb174('0x37'))){throw new db['Sequelize'][(_0xb174('0x35'))](_0xb174('0x38'));}else{try{var _0x281843=JSON[_0xb174('0x39')](_0x2e8eb5[_0xb174('0x32')]['recipients']);}catch(_0x43d18b){logger[_0xb174('0x2e')](_0x43d18b);throw new db[(_0xb174('0x34'))][(_0xb174('0x35'))](_0xb174('0x3a'));}var _0x5dcc99=[_0xb174('0x3b'),_0xb174('0x3c'),'mailqueue',_0xb174('0x3d'),_0xb174('0x3e'),_0xb174('0x3f'),_0xb174('0x40'),_0xb174('0x41'),'user'];if(_[_0xb174('0x42')](_0x281843,function(_0x5b7d41){return!_[_0xb174('0x43')](_0x5dcc99,_0x5b7d41[_0xb174('0x44')][_0xb174('0x45')]());})){throw new db[(_0xb174('0x34'))][(_0xb174('0x35'))](_0xb174('0x46'));}}}var _0x4d155a={};_0x4d155a[_0xb174('0x47')]=_0x2e8eb5[_0xb174('0x32')][_0xb174('0x36')](_0xb174('0x47'))?_0x2e8eb5['body'][_0xb174('0x47')]:_0x2e8eb5[_0xb174('0x48')][_0xb174('0x49')];_0x4d155a[_0xb174('0x4a')]=_['isEmpty'](_0x2e8eb5['body'][_0xb174('0x4a')])?null:_0x2e8eb5[_0xb174('0x32')]['recipientsDescription'];_0x4d155a[_0xb174('0x4b')]=_0x2e8eb5[_0xb174('0x32')][_0xb174('0x4b')]||![];_0x4d155a['SenderId']=_0x2e8eb5[_0xb174('0x48')]['id'];return getContent(_0x2e8eb5[_0xb174('0x32')])[_0xb174('0x2b')](function(_0x43cf2d){_0x4d155a['body']=_0x43cf2d;return getRecipients(_0x281843);})[_0xb174('0x2b')](function(_0x189252){_0x4d155a['recipientsId']=_['sortBy'](_0x189252)[_0xb174('0x4c')](',');return db[_0xb174('0x4d')][_0xb174('0x4e')](function(_0x4882ef){return db[_0xb174('0x4f')][_0xb174('0x50')](_0x4d155a,{'raw':!![],'transaction':_0x4882ef})[_0xb174('0x2b')](function(_0x874ea0){var _0x3ff10a={'sender':_0x4d155a[_0xb174('0x47')],'description':_0x4d155a[_0xb174('0x4a')],'content':_0x4d155a['body'],'beep':_0x4d155a['beep']};_0x189252['forEach'](function(_0x2c4b18){_0x3ff10a[_0xb174('0x51')]=_0x2c4b18;socket[_0xb174('0x52')](_0xb174('0x53'),_0x3ff10a);});return _0x874ea0;});});})[_0xb174('0x2b')](respondWithResult(_0x4bbe93,0xc9))[_0xb174('0x54')](handleError(_0x4bbe93,null));};function getContent(_0x526029){return new BPromise(function(_0x3de02a,_0x1e9ed9){if(_0x526029[_0xb174('0x55')]){_0x3de02a(_0x526029[_0xb174('0x55')]);return;}return db[_0xb174('0x56')]['findOne']({'attributes':[_0xb174('0x57')],'where':{'id':_0x526029[_0xb174('0x33')]},'raw':!![]})[_0xb174('0x2b')](function(_0xc1a9a0){if(!_0xc1a9a0)throw new db[(_0xb174('0x34'))][(_0xb174('0x35'))](_0xb174('0x58'));var _0x2aa23d=Mustache[_0xb174('0x59')](_0xc1a9a0['html'],_0x526029[_0xb174('0x5a')]);_0x3de02a(_0x2aa23d);})[_0xb174('0x54')](function(_0x18ee6e){_0x1e9ed9(_0x18ee6e);});});}function getRecipients(_0x368e8d){return new BPromise(function(_0x479552,_0x55515e){var _0x4c9b02=[];var _0x330db7=[];_0x368e8d[_0xb174('0x5b')](function(_0x381188){var _0x15a509=_[_0xb174('0x5c')](_0x381188[_0xb174('0x44')]['toLowerCase']());if(_0x15a509===_0xb174('0x5d')){_0x4c9b02=_['union'](_0x4c9b02,_0x381188[_0xb174('0x5e')]);}else{if(_['includes'](_0x15a509,'queue'))_0x15a509=_0x15a509[_0xb174('0x5f')](_0xb174('0x60'),_0xb174('0x61'));_0x381188['ids'][_0xb174('0x5b')](function(_0xd2f803){_0x330db7[_0xb174('0x62')](getAgents(_0x15a509,_0xd2f803));});}});return BPromise[_0xb174('0x63')](_0x330db7)[_0xb174('0x2b')](function(_0x24e08a){_0x4c9b02=_[_0xb174('0x64')](_0x4c9b02,_[_0xb174('0x65')](_0x24e08a));_0x479552(_0x4c9b02);})[_0xb174('0x54')](function(_0x3092f6){_0x55515e(_0x3092f6);});});}function getAgents(_0x1982b5,_0x31d508){return new BPromise(function(_0x140c65,_0xb9e1e4){return db[_0x1982b5][_0xb174('0x66')]({'where':{'id':_0x31d508}})[_0xb174('0x2b')](function(_0x45ea38){return _0x45ea38[_0xb174('0x67')]({'attributes':['id'],'raw':!![]})[_0xb174('0x2b')](function(_0x34e803){var _0x5756c3=_[_0xb174('0x68')](_0x34e803,'id');_0x140c65(_0x5756c3);});})[_0xb174('0x54')](function(_0x40e9a9){_0xb9e1e4(_0x40e9a9);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 00c096f..98a24a5 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 _0x5ca4=['../../mysqldb','UserNotification','setMaxListeners','remove','hook'];(function(_0x458dd7,_0xe5602b){var _0x2a12f3=function(_0x547dee){while(--_0x547dee){_0x458dd7['push'](_0x458dd7['shift']());}};_0x2a12f3(++_0xe5602b);}(_0x5ca4,0x1a9));var _0x45ca=function(_0xc6c9ce,_0x47b96b){_0xc6c9ce=_0xc6c9ce-0x0;var _0x152be9=_0x5ca4[_0xc6c9ce];return _0x152be9;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x45ca('0x0'))['db'][_0x45ca('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x45ca('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x45ca('0x3')};function emitEvent(_0x372ce7){return function(_0x51e8ee,_0x49759a,_0xbc2d6f){UserNotificationEvents['emit'](_0x372ce7+':'+_0x51e8ee['id'],_0x51e8ee);UserNotificationEvents['emit'](_0x372ce7,_0x51e8ee);_0xbc2d6f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x45ca('0x4')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0xc55a=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0xb6e45c,_0x202b4f){var _0x4264c5=function(_0x3a607d){while(--_0x3a607d){_0xb6e45c['push'](_0xb6e45c['shift']());}};_0x4264c5(++_0x202b4f);}(_0xc55a,0x119));var _0xac55=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xc55a[_0x82129b];return _0x2ae5dc;};'use strict';var EventEmitter=require(_0xac55('0x0'));var UserNotification=require(_0xac55('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xac55('0x2')](0x0);var events={'afterCreate':_0xac55('0x3'),'afterUpdate':_0xac55('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4b5c18){return function(_0x3b3784,_0x3b21c2,_0x558a2b){UserNotificationEvents[_0xac55('0x5')](_0x4b5c18+':'+_0x3b3784['id'],_0x3b3784);UserNotificationEvents['emit'](_0x4b5c18,_0x3b3784);_0x558a2b(null);};}for(var e in events){if(events[_0xac55('0x6')](e)){var event=events[e];UserNotification[_0xac55('0x7')](e,emitEvent(event));}}module[_0xac55('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index fbd815b..bc21e88 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 _0x6a40=['../../config/environment','./userNotification.attributes','exports','userNotifications','utf8mb4','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x131bf8,_0x182d28){var _0x743556=function(_0x3ccf59){while(--_0x3ccf59){_0x131bf8['push'](_0x131bf8['shift']());}};_0x743556(++_0x182d28);}(_0x6a40,0x1a7));var _0x06a4=function(_0xdb72a0,_0x3e7b6c){_0xdb72a0=_0xdb72a0-0x0;var _0x4119e5=_0x6a40[_0xdb72a0];return _0x4119e5;};'use strict';var _=require(_0x06a4('0x0'));var util=require('util');var logger=require(_0x06a4('0x1'))(_0x06a4('0x2'));var moment=require(_0x06a4('0x3'));var BPromise=require('bluebird');var rp=require(_0x06a4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x06a4('0x5'));var config=require(_0x06a4('0x6'));var attributes=require(_0x06a4('0x7'));module[_0x06a4('0x8')]=function(_0x368276,_0x1c4f85){return _0x368276['define']('UserNotification',attributes,{'tableName':_0x06a4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x06a4('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7daf=['api','bluebird','request-promise','path','rimraf','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x3f0ed7,_0x1f439f){var _0x34578f=function(_0x498fe4){while(--_0x498fe4){_0x3f0ed7['push'](_0x3f0ed7['shift']());}};_0x34578f(++_0x1f439f);}(_0x7daf,0x84));var _0xf7da=function(_0x55cbb8,_0x3362d1){_0x55cbb8=_0x55cbb8-0x0;var _0x5d0e21=_0x7daf[_0x55cbb8];return _0x5d0e21;};'use strict';var _=require(_0xf7da('0x0'));var util=require(_0xf7da('0x1'));var logger=require(_0xf7da('0x2'))(_0xf7da('0x3'));var moment=require('moment');var BPromise=require(_0xf7da('0x4'));var rp=require(_0xf7da('0x5'));var fs=require('fs');var path=require(_0xf7da('0x6'));var rimraf=require(_0xf7da('0x7'));var config=require('../../config/environment');var attributes=require(_0xf7da('0x8'));module[_0xf7da('0x9')]=function(_0xeb9382,_0x3149fb){return _0xeb9382[_0xf7da('0xa')](_0xf7da('0xb'),attributes,{'tableName':_0xf7da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf7da('0xd'),'collate':_0xf7da('0xe')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 7b50f7c..ea657aa 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 _0x20cb=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userNotification.socket','register','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3b918b,_0x2edc55){var _0x57d988=function(_0x1a4463){while(--_0x1a4463){_0x3b918b['push'](_0x3b918b['shift']());}};_0x57d988(++_0x2edc55);}(_0x20cb,0xd5));var _0xb20c=function(_0x1aa082,_0x386639){_0x1aa082=_0x1aa082-0x0;var _0x5c3cc2=_0x20cb[_0x1aa082];return _0x5c3cc2;};'use strict';var _=require(_0xb20c('0x0'));var util=require(_0xb20c('0x1'));var moment=require(_0xb20c('0x2'));var BPromise=require(_0xb20c('0x3'));var rs=require(_0xb20c('0x4'));var fs=require('fs');var Redis=require(_0xb20c('0x5'));var db=require(_0xb20c('0x6'))['db'];var utils=require(_0xb20c('0x7'));var logger=require(_0xb20c('0x8'))(_0xb20c('0x9'));var config=require(_0xb20c('0xa'));var jayson=require(_0xb20c('0xb'));var client=jayson[_0xb20c('0xc')][_0xb20c('0xd')]({'port':0x232a});config[_0xb20c('0xe')]=_[_0xb20c('0xf')](config['redis'],{'host':_0xb20c('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb20c('0xe')]));require(_0xb20c('0x11'))[_0xb20c('0x12')](socket);function respondWithRpcPromise(_0x43db60,_0x479f43,_0x3dc0b5){return new BPromise(function(_0x2a43db,_0x266936){return client['request'](_0x43db60,_0x3dc0b5)[_0xb20c('0x13')](function(_0x48aa0f){logger['info'](_0xb20c('0x14'),_0x479f43,_0xb20c('0x15'));logger[_0xb20c('0x16')](_0xb20c('0x17'),_0x479f43,'request\x20sent',JSON[_0xb20c('0x18')](_0x48aa0f));if(_0x48aa0f[_0xb20c('0x19')]){if(_0x48aa0f[_0xb20c('0x19')][_0xb20c('0x1a')]===0x1f4){logger[_0xb20c('0x19')]('UserNotification,\x20%s,\x20%s',_0x479f43,_0x48aa0f['error'][_0xb20c('0x1b')]);return _0x266936(_0x48aa0f[_0xb20c('0x19')][_0xb20c('0x1b')]);}logger[_0xb20c('0x19')](_0xb20c('0x14'),_0x479f43,_0x48aa0f['error'][_0xb20c('0x1b')]);return _0x2a43db(_0x48aa0f[_0xb20c('0x19')][_0xb20c('0x1b')]);}else{logger['info'](_0xb20c('0x14'),_0x479f43,_0xb20c('0x15'));_0x2a43db(_0x48aa0f[_0xb20c('0x1c')][_0xb20c('0x1b')]);}})[_0xb20c('0x1d')](function(_0x3543d9){logger['error']('UserNotification,\x20%s,\x20%s',_0x479f43,_0x3543d9);_0x266936(_0x3543d9);});});} \ No newline at end of file +var _0x832f=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring'];(function(_0x42f7cd,_0x1c47b7){var _0x514f16=function(_0x7426ce){while(--_0x7426ce){_0x42f7cd['push'](_0x42f7cd['shift']());}};_0x514f16(++_0x1c47b7);}(_0x832f,0x1d8));var _0xf832=function(_0x582f72,_0x886d8){_0x582f72=_0x582f72-0x0;var _0x4cd5fe=_0x832f[_0x582f72];return _0x4cd5fe;};'use strict';var _=require(_0xf832('0x0'));var util=require('util');var moment=require(_0xf832('0x1'));var BPromise=require(_0xf832('0x2'));var rs=require(_0xf832('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf832('0x4'))['db'];var utils=require(_0xf832('0x5'));var logger=require(_0xf832('0x6'))(_0xf832('0x7'));var config=require(_0xf832('0x8'));var jayson=require(_0xf832('0x9'));var client=jayson[_0xf832('0xa')][_0xf832('0xb')]({'port':0x232a});config[_0xf832('0xc')]=_[_0xf832('0xd')](config[_0xf832('0xc')],{'host':_0xf832('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf832('0xc')]));require(_0xf832('0xf'))[_0xf832('0x10')](socket);function respondWithRpcPromise(_0x28d716,_0x8a059d,_0x5e36c2){return new BPromise(function(_0xa79e14,_0x5b3daf){return client[_0xf832('0x11')](_0x28d716,_0x5e36c2)[_0xf832('0x12')](function(_0x31b68c){logger[_0xf832('0x13')](_0xf832('0x14'),_0x8a059d,_0xf832('0x15'));logger['debug'](_0xf832('0x16'),_0x8a059d,'request\x20sent',JSON[_0xf832('0x17')](_0x31b68c));if(_0x31b68c['error']){if(_0x31b68c[_0xf832('0x18')][_0xf832('0x19')]===0x1f4){logger[_0xf832('0x18')](_0xf832('0x14'),_0x8a059d,_0x31b68c[_0xf832('0x18')][_0xf832('0x1a')]);return _0x5b3daf(_0x31b68c['error'][_0xf832('0x1a')]);}logger['error'](_0xf832('0x14'),_0x8a059d,_0x31b68c[_0xf832('0x18')]['message']);return _0xa79e14(_0x31b68c[_0xf832('0x18')]['message']);}else{logger[_0xf832('0x13')](_0xf832('0x14'),_0x8a059d,_0xf832('0x15'));_0xa79e14(_0x31b68c['result'][_0xf832('0x1a')]);}})[_0xf832('0x1b')](function(_0x4a7736){logger['error'](_0xf832('0x14'),_0x8a059d,_0x4a7736);_0x5b3daf(_0x4a7736);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index b1287be..832718b 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 _0x3755=['removeListener','length','./userNotification.events','save','remove','update','emit'];(function(_0x2a45a2,_0x1f36fb){var _0x2c2639=function(_0x1f8623){while(--_0x1f8623){_0x2a45a2['push'](_0x2a45a2['shift']());}};_0x2c2639(++_0x1f36fb);}(_0x3755,0x1bb));var _0x5375=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x3755[_0x2f5ac5];return _0x37c9a8;};'use strict';var UserNotificationEvents=require(_0x5375('0x0'));var events=[_0x5375('0x1'),_0x5375('0x2'),_0x5375('0x3')];function createListener(_0x55ce82,_0x3330f5){return function(_0x5789db){_0x3330f5[_0x5375('0x4')](_0x55ce82,_0x5789db);};}function removeListener(_0x34aaec,_0x26c911){return function(){UserNotificationEvents[_0x5375('0x5')](_0x34aaec,_0x26c911);};}exports['register']=function(_0xf7d823){for(var _0x97e569=0x0,_0x343094=events[_0x5375('0x6')];_0x97e569<_0x343094;_0x97e569++){var _0x3374f4=events[_0x97e569];var _0x28330a=createListener('userNotification:'+_0x3374f4,_0xf7d823);UserNotificationEvents['on'](_0x3374f4,_0x28330a);}}; \ No newline at end of file +var _0xc414=['userNotification:','./userNotification.events','save','update','emit','removeListener','register','length'];(function(_0x12c4cd,_0xdebe29){var _0x18a029=function(_0x4c4272){while(--_0x4c4272){_0x12c4cd['push'](_0x12c4cd['shift']());}};_0x18a029(++_0xdebe29);}(_0xc414,0x199));var _0x4c41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc414[_0x3dd15e];return _0x231fd0;};'use strict';var UserNotificationEvents=require(_0x4c41('0x0'));var events=[_0x4c41('0x1'),'remove',_0x4c41('0x2')];function createListener(_0x442870,_0x1a8f1f){return function(_0x1597ed){_0x1a8f1f[_0x4c41('0x3')](_0x442870,_0x1597ed);};}function removeListener(_0x221751,_0x18222f){return function(){UserNotificationEvents[_0x4c41('0x4')](_0x221751,_0x18222f);};}exports[_0x4c41('0x5')]=function(_0x1b4d6a){for(var _0x190490=0x0,_0x4df855=events[_0x4c41('0x6')];_0x190490<_0x4df855;_0x190490++){var _0x22a46c=events[_0x190490];var _0x12b214=createListener(_0x4c41('0x7')+_0x22a46c,_0x1b4d6a);UserNotificationEvents['on'](_0x22a46c,_0x12b214);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 2a4300c..3d8c201 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x36e963,_0x61d1f9){var _0x5e4971=function(_0x1d1eeb){while(--_0x1d1eeb){_0x36e963['push'](_0x36e963['shift']());}};_0x5e4971(++_0x61d1f9);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x546cbb,_0xef54e8){var _0x20062d=function(_0x48e83f){while(--_0x48e83f){_0x546cbb['push'](_0x546cbb['shift']());}};_0x20062d(++_0xef54e8);}(_0xedd9,0xfc));var _0x9edd=function(_0x2db027,_0x279255){_0x2db027=_0x2db027-0x0;var _0x16ab85=_0xedd9[_0x2db027];return _0x16ab85;};'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 55ab5b4..d2ab7a0 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 _0x9ce8=['INTEGER','sequelize'];(function(_0x35eb5b,_0x271615){var _0xaf0396=function(_0x4c7259){while(--_0x4c7259){_0x35eb5b['push'](_0x35eb5b['shift']());}};_0xaf0396(++_0x271615);}(_0x9ce8,0x163));var _0x89ce=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0x9ce8[_0x43b584];return _0x48f27b;};'use strict';var Sequelize=require(_0x89ce('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x89ce('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2bfa=['exports','INTEGER'];(function(_0x4fc666,_0x72b0ab){var _0x48766e=function(_0x236e58){while(--_0x236e58){_0x4fc666['push'](_0x4fc666['shift']());}};_0x48766e(++_0x72b0ab);}(_0x2bfa,0x7c));var _0xa2bf=function(_0x17a70a,_0x46fea9){_0x17a70a=_0x17a70a-0x0;var _0x490f68=_0x2bfa[_0x17a70a];return _0x490f68;};'use strict';var Sequelize=require('sequelize');module[_0xa2bf('0x0')]={'penalty':{'type':Sequelize[_0xa2bf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index a34e785..fc32bce 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 _0x6c5c=['bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','lodash','moment'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x6c5c,0x132));var _0xc6c5=function(_0x2178b6,_0x328d33){_0x2178b6=_0x2178b6-0x0;var _0x380237=_0x6c5c[_0x2178b6];return _0x380237;};'use strict';var _=require(_0xc6c5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc6c5('0x1'));var BPromise=require(_0xc6c5('0x2'));var rp=require(_0xc6c5('0x3'));var fs=require('fs');var path=require(_0xc6c5('0x4'));var rimraf=require(_0xc6c5('0x5'));var config=require(_0xc6c5('0x6'));var attributes=require(_0xc6c5('0x7'));module[_0xc6c5('0x8')]=function(_0x488b6b,_0x5ab235){return _0x488b6b[_0xc6c5('0x9')](_0xc6c5('0xa'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac4d=['./userOpenchannelQueue.attributes','exports','user_has_openchannel_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5955a5,_0xc714c){var _0xa14211=function(_0x16dabf){while(--_0x16dabf){_0x5955a5['push'](_0x5955a5['shift']());}};_0xa14211(++_0xc714c);}(_0xac4d,0x153));var _0xdac4=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xac4d[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xdac4('0x0'));var util=require(_0xdac4('0x1'));var logger=require(_0xdac4('0x2'))('api');var moment=require(_0xdac4('0x3'));var BPromise=require(_0xdac4('0x4'));var rp=require(_0xdac4('0x5'));var fs=require('fs');var path=require(_0xdac4('0x6'));var rimraf=require(_0xdac4('0x7'));var config=require(_0xdac4('0x8'));var attributes=require(_0xdac4('0x9'));module[_0xdac4('0xa')]=function(_0x3d4e4b,_0x319a2b){return _0x3d4e4b['define']('UserOpenchannelQueue',attributes,{'tableName':_0xdac4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 3b7de0e..f33788f 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 _0x832d=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UserOpenchannelQueue,\x20%s,\x20%s','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x832d,0x10e));var _0xd832=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x832d[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0xd832('0x0'));var moment=require(_0xd832('0x1'));var BPromise=require('bluebird');var rs=require(_0xd832('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd832('0x3'))['db'];var utils=require(_0xd832('0x4'));var logger=require(_0xd832('0x5'))(_0xd832('0x6'));var config=require(_0xd832('0x7'));var jayson=require(_0xd832('0x8'));var client=jayson[_0xd832('0x9')][_0xd832('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6c20a3,_0x423df1,_0x2c937a){return new BPromise(function(_0x405872,_0x29df10){return client[_0xd832('0xb')](_0x6c20a3,_0x2c937a)[_0xd832('0xc')](function(_0x29bf58){logger[_0xd832('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x423df1,'request\x20sent');logger[_0xd832('0xe')](_0xd832('0xf'),_0x423df1,_0xd832('0x10'),JSON[_0xd832('0x11')](_0x29bf58));if(_0x29bf58[_0xd832('0x12')]){if(_0x29bf58[_0xd832('0x12')][_0xd832('0x13')]===0x1f4){logger[_0xd832('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x423df1,_0x29bf58[_0xd832('0x12')]['message']);return _0x29df10(_0x29bf58[_0xd832('0x12')][_0xd832('0x14')]);}logger['error'](_0xd832('0x15'),_0x423df1,_0x29bf58[_0xd832('0x12')][_0xd832('0x14')]);return _0x405872(_0x29bf58[_0xd832('0x12')][_0xd832('0x14')]);}else{logger[_0xd832('0xd')](_0xd832('0x15'),_0x423df1,_0xd832('0x10'));_0x405872(_0x29bf58[_0xd832('0x16')][_0xd832('0x14')]);}})['catch'](function(_0x1b5926){logger[_0xd832('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x423df1,_0x1b5926);_0x29df10(_0x1b5926);});});} \ No newline at end of file +var _0xdc97=['rpc','../../config/environment','jayson/promise','client','request','then','UserOpenchannelQueue,\x20%s,\x20%s','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0xe4976c,_0x50e724){var _0xb69102=function(_0x41f58e){while(--_0x41f58e){_0xe4976c['push'](_0xe4976c['shift']());}};_0xb69102(++_0x50e724);}(_0xdc97,0xc7));var _0x7dc9=function(_0x22eac3,_0x447fbc){_0x22eac3=_0x22eac3-0x0;var _0x21c2b0=_0xdc97[_0x22eac3];return _0x21c2b0;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var moment=require(_0x7dc9('0x2'));var BPromise=require(_0x7dc9('0x3'));var rs=require(_0x7dc9('0x4'));var fs=require('fs');var Redis=require(_0x7dc9('0x5'));var db=require(_0x7dc9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7dc9('0x7'))(_0x7dc9('0x8'));var config=require(_0x7dc9('0x9'));var jayson=require(_0x7dc9('0xa'));var client=jayson[_0x7dc9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xff6133,_0x475dac,_0x4b7545){return new BPromise(function(_0x41e853,_0x3d79cf){return client[_0x7dc9('0xc')](_0xff6133,_0x4b7545)[_0x7dc9('0xd')](function(_0x3c6454){logger['info'](_0x7dc9('0xe'),_0x475dac,'request\x20sent');logger['debug'](_0x7dc9('0xf'),_0x475dac,_0x7dc9('0x10'),JSON['stringify'](_0x3c6454));if(_0x3c6454[_0x7dc9('0x11')]){if(_0x3c6454[_0x7dc9('0x11')][_0x7dc9('0x12')]===0x1f4){logger[_0x7dc9('0x11')](_0x7dc9('0xe'),_0x475dac,_0x3c6454[_0x7dc9('0x11')][_0x7dc9('0x13')]);return _0x3d79cf(_0x3c6454[_0x7dc9('0x11')][_0x7dc9('0x13')]);}logger[_0x7dc9('0x11')](_0x7dc9('0xe'),_0x475dac,_0x3c6454['error']['message']);return _0x41e853(_0x3c6454[_0x7dc9('0x11')][_0x7dc9('0x13')]);}else{logger[_0x7dc9('0x14')](_0x7dc9('0xe'),_0x475dac,_0x7dc9('0x10'));_0x41e853(_0x3c6454[_0x7dc9('0x15')][_0x7dc9('0x13')]);}})[_0x7dc9('0x16')](function(_0x42fd8e){logger[_0x7dc9('0x11')](_0x7dc9('0xe'),_0x475dac,_0x42fd8e);_0x3d79cf(_0x42fd8e);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index abf64d3..6756116 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 _0x085f=['exports','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/resources','post','create','clone','addSections','addResources','put','delete','removeResources'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0x085f,0x74));var _0xf085=function(_0x142b4e,_0x596ce8){_0x142b4e=_0x142b4e-0x0;var _0x3683f4=_0x085f[_0x142b4e];return _0x3683f4;};'use strict';var multer=require(_0xf085('0x0'));var util=require('util');var path=require(_0xf085('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xf085('0x2'));var auth=require(_0xf085('0x3'));var interaction=require(_0xf085('0x4'));var config=require(_0xf085('0x5'));var controller=require(_0xf085('0x6'));router[_0xf085('0x7')]('/',auth[_0xf085('0x8')](),controller[_0xf085('0x9')]);router[_0xf085('0x7')](_0xf085('0xa'),auth[_0xf085('0x8')](),controller[_0xf085('0xb')]);router[_0xf085('0x7')](_0xf085('0xc'),auth[_0xf085('0x8')](),controller['show']);router[_0xf085('0x7')]('/:id/sections',auth[_0xf085('0x8')](),controller['getSections']);router[_0xf085('0x7')](_0xf085('0xd'),auth[_0xf085('0x8')](),controller['getResources']);router[_0xf085('0xe')]('/',auth[_0xf085('0x8')](),controller[_0xf085('0xf')]);router[_0xf085('0xe')]('/:id/clone',auth[_0xf085('0x8')](),controller[_0xf085('0x10')]);router[_0xf085('0xe')]('/:id/sections',auth[_0xf085('0x8')](),controller[_0xf085('0x11')]);router[_0xf085('0xe')](_0xf085('0xd'),auth[_0xf085('0x8')](),controller[_0xf085('0x12')]);router[_0xf085('0x13')](_0xf085('0xc'),auth[_0xf085('0x8')](),controller['update']);router[_0xf085('0x14')](_0xf085('0xc'),auth[_0xf085('0x8')](),controller['destroy']);router[_0xf085('0x14')]('/:id/sections',auth[_0xf085('0x8')](),controller['removeSections']);router['delete'](_0xf085('0xd'),auth['isAuthenticated'](),controller[_0xf085('0x15')]);module[_0xf085('0x16')]=router; \ No newline at end of file +var _0x9584=['delete','removeResources','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','describe','show','/:id/sections','getSections','/:id/resources','getResources','create','post','clone','addResources','put','/:id','update'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x9584,0xc6));var _0x4958=function(_0x243ede,_0x81f78){_0x243ede=_0x243ede-0x0;var _0x2c388b=_0x9584[_0x243ede];return _0x2c388b;};'use strict';var multer=require('multer');var util=require(_0x4958('0x0'));var path=require(_0x4958('0x1'));var timeout=require(_0x4958('0x2'));var express=require(_0x4958('0x3'));var router=express[_0x4958('0x4')]();var fs_extra=require(_0x4958('0x5'));var auth=require(_0x4958('0x6'));var interaction=require(_0x4958('0x7'));var config=require(_0x4958('0x8'));var controller=require(_0x4958('0x9'));router[_0x4958('0xa')]('/',auth[_0x4958('0xb')](),controller[_0x4958('0xc')]);router[_0x4958('0xa')]('/describe',auth[_0x4958('0xb')](),controller[_0x4958('0xd')]);router[_0x4958('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4958('0xe')]);router[_0x4958('0xa')](_0x4958('0xf'),auth['isAuthenticated'](),controller[_0x4958('0x10')]);router['get'](_0x4958('0x11'),auth[_0x4958('0xb')](),controller[_0x4958('0x12')]);router['post']('/',auth[_0x4958('0xb')](),controller[_0x4958('0x13')]);router[_0x4958('0x14')]('/:id/clone',auth[_0x4958('0xb')](),controller[_0x4958('0x15')]);router[_0x4958('0x14')](_0x4958('0xf'),auth['isAuthenticated'](),controller['addSections']);router['post'](_0x4958('0x11'),auth[_0x4958('0xb')](),controller[_0x4958('0x16')]);router[_0x4958('0x17')](_0x4958('0x18'),auth['isAuthenticated'](),controller[_0x4958('0x19')]);router[_0x4958('0x1a')](_0x4958('0x18'),auth[_0x4958('0xb')](),controller['destroy']);router[_0x4958('0x1a')](_0x4958('0xf'),auth[_0x4958('0xb')](),controller['removeSections']);router[_0x4958('0x1a')](_0x4958('0x11'),auth[_0x4958('0xb')](),controller[_0x4958('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 4c3a09b..ee9c2af 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 _0xc384=['name','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x310c00,_0x6bb7cb){var _0x21c516=function(_0x3a6e88){while(--_0x3a6e88){_0x310c00['push'](_0x310c00['shift']());}};_0x21c516(++_0x6bb7cb);}(_0xc384,0x165));var _0x4c38=function(_0x222213,_0x2ea4de){_0x222213=_0x222213-0x0;var _0x5abf2f=_0xc384[_0x222213];return _0x5abf2f;};'use strict';var Sequelize=require(_0x4c38('0x0'));module[_0x4c38('0x1')]={'name':{'type':Sequelize[_0x4c38('0x2')],'allowNull':![],'unique':_0x4c38('0x3')},'crudPermissions':{'type':Sequelize[_0x4c38('0x2')],'set':function(_0x4e6fb6){this[_0x4c38('0x4')](_0x4c38('0x5'),_0x4e6fb6?_0x4e6fb6[_0x4c38('0x6')](''):[]);},'get':function(){return this[_0x4c38('0x7')](_0x4c38('0x5'))?this[_0x4c38('0x7')](_0x4c38('0x5'))[_0x4c38('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x4c38('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x4c38('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x4c38('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x4c38('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x4c38('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x4c38('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x4c38('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0x21a4=['sequelize','exports','STRING','name','setDataValue','join','getDataValue','crudPermissions','split','BOOLEAN'];(function(_0x594094,_0x40333b){var _0xb024bb=function(_0xec26ea){while(--_0xec26ea){_0x594094['push'](_0x594094['shift']());}};_0xb024bb(++_0x40333b);}(_0x21a4,0x15e));var _0x421a=function(_0x4090a2,_0x2bc3d1){_0x4090a2=_0x4090a2-0x0;var _0x1a4ad2=_0x21a4[_0x4090a2];return _0x1a4ad2;};'use strict';var Sequelize=require(_0x421a('0x0'));module[_0x421a('0x1')]={'name':{'type':Sequelize[_0x421a('0x2')],'allowNull':![],'unique':_0x421a('0x3')},'crudPermissions':{'type':Sequelize[_0x421a('0x2')],'set':function(_0x1d3156){this[_0x421a('0x4')]('crudPermissions',_0x1d3156?_0x1d3156[_0x421a('0x5')](''):[]);},'get':function(){return this[_0x421a('0x6')](_0x421a('0x7'))?this[_0x421a('0x6')](_0x421a('0x7'))[_0x421a('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x421a('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x421a('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x421a('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x421a('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x421a('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x421a('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 7b8f3d9..6824cbf 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 _0x6803=['section','Missing\x20section\x20parameter','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','status','end','json','offset','undefined','limit','count','apply','save','update','then','destroy','sendStatus','error','stack','name','index','map','UserProfile','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','length','create','body','params','find','get','omit','crudPermissions','createdAt','sequelize','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','updatedAt','Resources','describe','sectionId','userProfileId','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','forEach','resourceId','Plugin','addResources','transaction','bulkCreate','removeResources','getResources'];(function(_0x8720df,_0x3f41ea){var _0x44b435=function(_0x4a5625){while(--_0x4a5625){_0x8720df['push'](_0x8720df['shift']());}};_0x44b435(++_0x3f41ea);}(_0x6803,0x1c2));var _0x3680=function(_0x24ce3e,_0x5aaae6){_0x24ce3e=_0x24ce3e-0x0;var _0x1f9240=_0x6803[_0x24ce3e];return _0x1f9240;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3680('0x0'));var jsonpatch=require(_0x3680('0x1'));var rp=require(_0x3680('0x2'));var moment=require(_0x3680('0x3'));var BPromise=require(_0x3680('0x4'));var Mustache=require(_0x3680('0x5'));var util=require('util');var path=require(_0x3680('0x6'));var sox=require(_0x3680('0x7'));var csv=require(_0x3680('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3680('0x9'));var squel=require(_0x3680('0xa'));var crypto=require(_0x3680('0xb'));var jsforce=require(_0x3680('0xc'));var deskjs=require(_0x3680('0xd'));var toCsv=require(_0x3680('0x8'));var querystring=require(_0x3680('0xe'));var Papa=require(_0x3680('0xf'));var Redis=require(_0x3680('0x10'));var authService=require(_0x3680('0x11'));var qs=require(_0x3680('0x12'));var as=require(_0x3680('0x13'));var hardwareService=require(_0x3680('0x14'));var logger=require(_0x3680('0x15'))(_0x3680('0x16'));var utils=require('../../config/utils');var config=require(_0x3680('0x17'));var licenseUtil=require(_0x3680('0x18'));var db=require(_0x3680('0x19'))['db'];config[_0x3680('0x1a')]=_['defaults'](config[_0x3680('0x1a')],{'host':_0x3680('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3680('0x1a')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x393736,_0x17cd09){_0x17cd09=_0x17cd09||0xcc;return function(_0x24912d){if(_0x24912d){return _0x393736['sendStatus'](_0x17cd09);}return _0x393736[_0x3680('0x1c')](_0x17cd09)[_0x3680('0x1d')]();};}function respondWithResult(_0x19c618,_0x3a475c){_0x3a475c=_0x3a475c||0xc8;return function(_0x4aefc0){if(_0x4aefc0){return _0x19c618['status'](_0x3a475c)[_0x3680('0x1e')](_0x4aefc0);}};}function respondWithFilteredResult(_0x3fed9e,_0x2c24e5){return function(_0x383072){if(_0x383072){var _0x1049c0=typeof _0x2c24e5[_0x3680('0x1f')]===_0x3680('0x20')&&typeof _0x2c24e5[_0x3680('0x21')]===_0x3680('0x20');var _0x1374a7=_0x383072[_0x3680('0x22')];var _0x107723=_0x1049c0?0x0:_0x2c24e5['offset'];var _0x4c79f2=_0x1049c0?_0x383072[_0x3680('0x22')]:_0x2c24e5[_0x3680('0x1f')]+_0x2c24e5[_0x3680('0x21')];var _0x2e599c;if(_0x4c79f2>=_0x1374a7){_0x4c79f2=_0x1374a7;_0x2e599c=0xc8;}else{_0x2e599c=0xce;}_0x3fed9e[_0x3680('0x1c')](_0x2e599c);return _0x3fed9e['set']('Content-Range',_0x107723+'-'+_0x4c79f2+'/'+_0x1374a7)['json'](_0x383072);}return null;};}function patchUpdates(_0x54b300){return function(_0x2897a3){try{jsonpatch[_0x3680('0x23')](_0x2897a3,_0x54b300,!![]);}catch(_0x104462){return BPromise['reject'](_0x104462);}return _0x2897a3[_0x3680('0x24')]();};}function saveUpdates(_0x4ed681,_0x5b622c){return function(_0x136d0c){if(_0x136d0c){return _0x136d0c[_0x3680('0x25')](_0x4ed681)[_0x3680('0x26')](function(_0x4b4085){return _0x4b4085;});}return null;};}function removeEntity(_0x258e54,_0x203f6c){return function(_0x4f8ce4){if(_0x4f8ce4){return _0x4f8ce4[_0x3680('0x27')]()[_0x3680('0x26')](function(){_0x258e54[_0x3680('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f8345,_0x531755){return function(_0x142ef7){if(!_0x142ef7){_0x1f8345[_0x3680('0x28')](0x194);}return _0x142ef7;};}function handleError(_0x2b3da0,_0x1219a4){_0x1219a4=_0x1219a4||0x1f4;return function(_0x41f71a){logger[_0x3680('0x29')](_0x41f71a[_0x3680('0x2a')]);if(_0x41f71a[_0x3680('0x2b')]){delete _0x41f71a['name'];}_0x2b3da0[_0x3680('0x1c')](_0x1219a4)['send'](_0x41f71a);};}exports[_0x3680('0x2c')]=function(_0x1628f7,_0xffff3a){var _0x5dc974={},_0x5bcb34={},_0x4f265c={'count':0x0,'rows':[]};var _0x2b5067=_[_0x3680('0x2d')](db[_0x3680('0x2e')][_0x3680('0x2f')],function(_0xcda317){return{'name':_0xcda317['fieldName'],'type':_0xcda317[_0x3680('0x30')][_0x3680('0x31')]};});_0x5bcb34[_0x3680('0x32')]=_[_0x3680('0x2d')](_0x2b5067,'name');_0x5bcb34[_0x3680('0x33')]=_[_0x3680('0x34')](_0x1628f7[_0x3680('0x33')]);_0x5bcb34[_0x3680('0x35')]=_[_0x3680('0x36')](_0x5bcb34[_0x3680('0x32')],_0x5bcb34[_0x3680('0x33')]);_0x5dc974[_0x3680('0x37')]=_[_0x3680('0x36')](_0x5bcb34['model'],qs[_0x3680('0x38')](_0x1628f7[_0x3680('0x33')]['fields']));_0x5dc974['attributes']=_0x5dc974[_0x3680('0x37')]['length']?_0x5dc974['attributes']:_0x5bcb34[_0x3680('0x32')];if(!_0x1628f7[_0x3680('0x33')][_0x3680('0x39')](_0x3680('0x3a'))){_0x5dc974['limit']=qs[_0x3680('0x21')](_0x1628f7['query'][_0x3680('0x21')]);_0x5dc974[_0x3680('0x1f')]=qs[_0x3680('0x1f')](_0x1628f7[_0x3680('0x33')][_0x3680('0x1f')]);}_0x5dc974['order']=qs[_0x3680('0x3b')](_0x1628f7[_0x3680('0x33')][_0x3680('0x3b')]);_0x5dc974[_0x3680('0x3c')]=qs[_0x3680('0x35')](_[_0x3680('0x3d')](_0x1628f7[_0x3680('0x33')],_0x5bcb34[_0x3680('0x35')]),_0x2b5067);if(_0x1628f7[_0x3680('0x33')]['filter']){_0x5dc974[_0x3680('0x3c')]=_[_0x3680('0x3e')](_0x5dc974[_0x3680('0x3c')],{'$or':_['map'](_0x2b5067,function(_0x154977){if(_0x154977[_0x3680('0x30')]!==_0x3680('0x3f')){var _0x45989c={};_0x45989c[_0x154977[_0x3680('0x2b')]]={'$like':'%'+_0x1628f7[_0x3680('0x33')][_0x3680('0x40')]+'%'};return _0x45989c;}})});}_0x5dc974=_[_0x3680('0x3e')]({},_0x5dc974,_0x1628f7[_0x3680('0x41')]);var _0x5d8fef={'where':_0x5dc974['where']};return db[_0x3680('0x2e')][_0x3680('0x22')](_0x5d8fef)[_0x3680('0x26')](function(_0x1cdcc9){_0x4f265c[_0x3680('0x22')]=_0x1cdcc9;if(_0x1628f7[_0x3680('0x33')][_0x3680('0x42')]){_0x5dc974[_0x3680('0x43')]=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x5dc974);})[_0x3680('0x26')](function(_0x39aa6e){_0x4f265c[_0x3680('0x44')]=_0x39aa6e;return _0x4f265c;})[_0x3680('0x26')](respondWithFilteredResult(_0xffff3a,_0x5dc974))[_0x3680('0x45')](handleError(_0xffff3a,null));};exports[_0x3680('0x46')]=function(_0x276713,_0x1278d1){var _0x5845bf={'raw':![],'where':{'id':_0x276713['params']['id']}},_0x3cf7c7={};_0x3cf7c7[_0x3680('0x32')]=_[_0x3680('0x34')](db[_0x3680('0x2e')][_0x3680('0x2f')]);_0x3cf7c7[_0x3680('0x33')]=_[_0x3680('0x34')](_0x276713[_0x3680('0x33')]);_0x3cf7c7[_0x3680('0x35')]=_[_0x3680('0x36')](_0x3cf7c7[_0x3680('0x32')],_0x3cf7c7[_0x3680('0x33')]);_0x5845bf['attributes']=_[_0x3680('0x36')](_0x3cf7c7[_0x3680('0x32')],qs[_0x3680('0x38')](_0x276713[_0x3680('0x33')]['fields']));_0x5845bf[_0x3680('0x37')]=_0x5845bf[_0x3680('0x37')][_0x3680('0x47')]?_0x5845bf[_0x3680('0x37')]:_0x3cf7c7[_0x3680('0x32')];if(_0x276713[_0x3680('0x33')]['includeAll']){_0x5845bf[_0x3680('0x43')]=[{'all':!![]}];}_0x5845bf=_[_0x3680('0x3e')]({},_0x5845bf,_0x276713[_0x3680('0x41')]);return db[_0x3680('0x2e')]['find'](_0x5845bf)[_0x3680('0x26')](handleEntityNotFound(_0x1278d1,null))[_0x3680('0x26')](respondWithResult(_0x1278d1,null))[_0x3680('0x45')](handleError(_0x1278d1,null));};exports[_0x3680('0x48')]=function(_0x2880b7,_0x199ffb){return db['UserProfile'][_0x3680('0x48')](_0x2880b7[_0x3680('0x49')],{})[_0x3680('0x26')](respondWithResult(_0x199ffb,0xc9))[_0x3680('0x45')](handleError(_0x199ffb,null));};exports['clone']=function(_0x2534cd,_0x5e8324){var _0x3ba23b={'where':{'id':_0x2534cd[_0x3680('0x4a')]['id']}},_0x587805={};_0x587805['model']=_[_0x3680('0x34')](db['UserProfile'][_0x3680('0x2f')]);_0x3ba23b[_0x3680('0x37')]=_[_0x3680('0x36')](_0x587805[_0x3680('0x32')],qs[_0x3680('0x38')](_0x2534cd[_0x3680('0x33')][_0x3680('0x38')]));_0x3ba23b[_0x3680('0x37')]=_0x3ba23b[_0x3680('0x37')][_0x3680('0x47')]?_0x3ba23b[_0x3680('0x37')]:_0x587805['model'];if(_0x2534cd[_0x3680('0x33')][_0x3680('0x42')]){_0x3ba23b[_0x3680('0x43')]=[{'all':!![]}];}_0x3ba23b=_[_0x3680('0x3e')]({},_0x3ba23b,_0x2534cd['options']);return db[_0x3680('0x2e')][_0x3680('0x4b')](_0x3ba23b)[_0x3680('0x26')](handleEntityNotFound(_0x5e8324,null))[_0x3680('0x26')](function(_0x56cb93){if(_0x56cb93){var _0x352bec=_0x56cb93[_0x3680('0x4c')]({'plain':!![]});_0x352bec=qs[_0x3680('0x4d')](_0x352bec,['id','createdAt','updatedAt',_0x3680('0x4e')]);_0x2534cd[_0x3680('0x49')]=_[_0x3680('0x4d')](_0x2534cd[_0x3680('0x49')],['id',_0x3680('0x4f'),'updatedAt']);return db[_0x3680('0x50')]['transaction'](function(_0x15f492){return db[_0x3680('0x2e')][_0x3680('0x48')](_['merge'](_0x352bec,_0x2534cd[_0x3680('0x49')]),{'include':_0x2534cd['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x15f492})[_0x3680('0x26')](function(_0x20b267){var _0x537e03=_0x20b267[_0x3680('0x4c')]({'plain':!![]});return db[_0x3680('0x51')][_0x3680('0x52')]({'where':{'userProfileId':_0x2534cd[_0x3680('0x4a')]['id']},'raw':!![]})[_0x3680('0x26')](function(_0x1f64b7){if(_0x1f64b7){return BPromise[_0x3680('0x53')](_0x1f64b7,function(_0x1255c9){return new BPromise(function(_0x3183ab,_0x5859e4){if(_0x1255c9[_0x3680('0x54')]===null||_0x1255c9['autoAssociation']===0x1)_0x3183ab(null);return db[_0x3680('0x55')][_0x3680('0x52')]({'where':{'sectionId':_0x1255c9['id']},'raw':!![]})[_0x3680('0x26')](function(_0x155bc7){var _0x2b4d90=_['map'](_0x155bc7,function(_0x339643){return qs['omit'](_0x339643,['id',_0x3680('0x4f'),_0x3680('0x56'),'sectionId']);});_0x3183ab(_0x2b4d90);})[_0x3680('0x45')](function(_0x57bdf5){_0x5859e4(_0x57bdf5);});})[_0x3680('0x26')](function(_0x52c61b){var _0x4cfd1c=qs['omit'](_0x1255c9,['id',_0x3680('0x4f'),_0x3680('0x56')]);_0x4cfd1c['userProfileId']=_0x537e03['id'];if(_0x52c61b)_0x4cfd1c['Resources']=_0x52c61b;return _0x4cfd1c;})['then'](function(_0x57fb50){return db[_0x3680('0x51')][_0x3680('0x48')](_0x57fb50,{'include':[{'model':db[_0x3680('0x55')],'as':_0x3680('0x57')}],'raw':!![],'transaction':_0x15f492});});})[_0x3680('0x26')](function(){return _0x537e03;});}});});});}})[_0x3680('0x26')](respondWithResult(_0x5e8324,0xc9))[_0x3680('0x45')](handleError(_0x5e8324,null));};exports[_0x3680('0x25')]=function(_0x32654e,_0x4814e4){if(_0x32654e['body']['id']){delete _0x32654e[_0x3680('0x49')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x32654e[_0x3680('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4814e4,null))[_0x3680('0x26')](saveUpdates(_0x32654e[_0x3680('0x49')],null))['then'](respondWithResult(_0x4814e4,null))[_0x3680('0x45')](handleError(_0x4814e4,null));};exports[_0x3680('0x27')]=function(_0x1b16fb,_0x261798){return db[_0x3680('0x2e')][_0x3680('0x4b')]({'where':{'id':_0x1b16fb[_0x3680('0x4a')]['id']}})[_0x3680('0x26')](handleEntityNotFound(_0x261798,null))['then'](removeEntity(_0x261798,null))[_0x3680('0x45')](handleError(_0x261798,null));};exports[_0x3680('0x58')]=function(_0x55abf3,_0x2be451){return db[_0x3680('0x2e')][_0x3680('0x58')]()[_0x3680('0x26')](respondWithResult(_0x2be451,null))[_0x3680('0x45')](handleError(_0x2be451,null));};exports['addSections']=function(_0x12858e,_0x24a647){var _0x4322ef=_0x12858e[_0x3680('0x49')];return db['UserProfile'][_0x3680('0x4b')]({'where':{'id':_0x12858e[_0x3680('0x4a')]['id']}})[_0x3680('0x26')](handleEntityNotFound(_0x24a647,null))[_0x3680('0x26')](function(_0x46d4a3){if(_0x46d4a3){return db[_0x3680('0x50')]['transaction'](function(_0x59a7fb){return db['UserProfileSection'][_0x3680('0x27')]({'where':{'userProfileId':_0x12858e['params']['id'],'sectionId':_[_0x3680('0x2d')](_0x4322ef,function(_0x51d6c4){return _0x51d6c4[_0x3680('0x59')];})},'transaction':_0x59a7fb})[_0x3680('0x26')](function(){var _0x3fd951=_[_0x3680('0x2d')](_0x4322ef,function(_0x30067a){_0x30067a[_0x3680('0x5a')]=_0x12858e['params']['id'];return _0x30067a;});var _0x106040=[];return BPromise[_0x3680('0x53')](_0x3fd951,function(_0xc1c03b){return db[_0x3680('0x51')][_0x3680('0x48')](_0xc1c03b,{'include':[{'model':db[_0x3680('0x55')],'as':'Resources'}],'raw':!![],'transaction':_0x59a7fb})[_0x3680('0x26')](function(_0x28306b){_0x106040[_0x3680('0x5b')](_0x28306b[_0x3680('0x4c')]({'plain':!![]}));});})[_0x3680('0x26')](function(){return _0x106040;});});});}})['then'](function(_0xeee9bb){return _0xeee9bb;})[_0x3680('0x26')](respondWithResult(_0x24a647,null))[_0x3680('0x45')](handleError(_0x24a647,null));};exports[_0x3680('0x5c')]=function(_0x488b84,_0x126e8){var _0x2ccf36;return db[_0x3680('0x2e')][_0x3680('0x4b')]({'where':{'id':_0x488b84[_0x3680('0x4a')]['id']},'attributes':['id',_0x3680('0x2b')]})[_0x3680('0x26')](handleEntityNotFound(_0x126e8,null))[_0x3680('0x26')](function(_0x435871){if(_0x435871){_0x2ccf36=_0x435871;return db[_0x3680('0x51')][_0x3680('0x27')]({'where':{'userProfileId':_0x488b84[_0x3680('0x4a')]['id'],'sectionId':_0x488b84[_0x3680('0x33')][_0x3680('0x5d')]}});}})[_0x3680('0x26')](function(){return _0x2ccf36;})[_0x3680('0x26')](respondWithStatusCode(_0x126e8,null))['catch'](handleError(_0x126e8,null));};exports[_0x3680('0x5e')]=function(_0x2741e5,_0x160167){var _0x2b4fc4=[];var _0x9eaaf5=[];return db[_0x3680('0x51')]['findAll']({'where':{'userProfileId':_0x2741e5['params']['id']},'raw':!![]})[_0x3680('0x26')](function(_0x3b75fe){_0x2b4fc4=_[_0x3680('0x40')](_0x3b75fe,function(_0x3c0dd4){return _0x3c0dd4[_0x3680('0x5f')]===0x1||_[_0x3680('0x60')]([0x3eb,0x709],_0x3c0dd4[_0x3680('0x59')]);});if(!_[_0x3680('0x61')](_0x2b4fc4)){return _[_0x3680('0x2d')](_0x2b4fc4,function(_0x53d637){return _0x53d637[_0x3680('0x59')];});}else{return;}})[_0x3680('0x26')](function(_0x299c11){if(_0x299c11)_0x9eaaf5=_0x299c11;if(_['includes'](_0x9eaaf5,0x64)){var _0x473652=_[_0x3680('0x4b')](_0x2b4fc4,{'sectionId':0x64});return hasDefaultDashboard(_0x473652)[_0x3680('0x26')](function(_0x96d95c){return _['map'](_0x2b4fc4,function(_0x164087){if(_0x164087[_0x3680('0x59')]===0x64){_0x164087['subsections']=_0x96d95c;}return _0x164087;});});}else{return;}})[_0x3680('0x26')](function(_0x320e32){if(_0x320e32)_0x2b4fc4=_0x320e32;if(_[_0x3680('0x60')](_0x9eaaf5,0x3eb)){var _0x1f1d65=_[_0x3680('0x4b')](_0x2b4fc4,{'sectionId':0x3eb});return getCustomDashboards(_0x1f1d65)[_0x3680('0x26')](function(_0x552a2d){return _[_0x3680('0x2d')](_0x2b4fc4,function(_0x390ddf){if(_0x1f1d65[_0x3680('0x5f')]){if(_0x390ddf[_0x3680('0x59')]===0x3eb){_0x390ddf[_0x3680('0x62')]=_0x552a2d;}}else{if(_0x390ddf[_0x3680('0x59')]===0x64){if(!_0x390ddf[_0x3680('0x62')]){_0x390ddf[_0x3680('0x62')]=[];}_0x390ddf['subsections']=_0x390ddf[_0x3680('0x62')][_0x3680('0x63')](_0x552a2d);}}return _0x390ddf;});});}else{return;}})['then'](function(_0x5994ef){if(_0x5994ef)_0x2b4fc4=_0x5994ef;if(_[_0x3680('0x60')](_0x9eaaf5,0x709)){var _0x4f143b=_[_0x3680('0x4b')](_0x2b4fc4,{'sectionId':0x709});return getPlugins(_0x4f143b)['then'](function(_0x3a43dc){if(_0x4f143b[_0x3680('0x5f')]){return _[_0x3680('0x2d')](_0x2b4fc4,function(_0x524d99){if(_0x524d99[_0x3680('0x59')]===0x709){_0x524d99['subsections']=_0x3a43dc;}return _0x524d99;});}else{var _0x5bb6c8={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3a43dc};var _0x495b60=_[_0x3680('0x2d')](_0x2b4fc4);_0x495b60[_0x3680('0x5b')](_0x5bb6c8);return _0x495b60;}});}else{return;}})[_0x3680('0x26')](function(_0x4059d8){if(_0x4059d8)_0x2b4fc4=_0x4059d8;return _[_0x3680('0x40')](_0x2b4fc4,[_0x3680('0x5f'),0x1]);})[_0x3680('0x26')](respondWithResult(_0x160167,null))['catch'](handleError(_0x160167,null));};function hasDefaultDashboard(_0x4a8004){var _0x3d1b30=[0x65];return new BPromise(function(_0x241bf3,_0xf724f8){try{if(_0x4a8004['autoAssociation']){_0x241bf3(_0x3d1b30);}else{return db[_0x3680('0x55')][_0x3680('0x64')]({'where':{'sectionId':_0x4a8004['id']},'raw':!![]})[_0x3680('0x26')](function(_0x2ff411){_0x2ff411?_0x241bf3(_0x3d1b30):_0x241bf3();});}}catch(_0x172195){_0xf724f8(_0x172195);}});}function getCustomDashboards(_0x5498ab){var _0x2eb07a=[];return new BPromise(function(_0xea05d9,_0x3aec67){try{if(_0x5498ab['autoAssociation']){return db[_0x3680('0x65')][_0x3680('0x52')]({'raw':!![]})[_0x3680('0x26')](function(_0x128d21){_0x128d21[_0x3680('0x66')](function(_0x55b8d6){_0x2eb07a['push'](_0x55b8d6['id']+0x1869f);});_0xea05d9(_0x2eb07a);});}else{return db[_0x3680('0x55')][_0x3680('0x52')]({'where':{'sectionId':_0x5498ab['id']},'raw':!![]})['then'](function(_0x6c75aa){_0x6c75aa['forEach'](function(_0x1558d0){_0x2eb07a[_0x3680('0x5b')](_0x1558d0[_0x3680('0x67')]+0x1869f);});_0xea05d9(_0x2eb07a);});}}catch(_0x1f829d){_0x3aec67(_0x1f829d);}});}function getPlugins(_0x3eca3a){var _0x12d0c6=[];return new BPromise(function(_0x1974a0,_0x5c6c88){try{if(_0x3eca3a[_0x3680('0x54')]){return db[_0x3680('0x68')][_0x3680('0x52')]({'raw':!![]})[_0x3680('0x26')](function(_0x5809d9){_0x5809d9[_0x3680('0x66')](function(_0x227565){_0x12d0c6['push'](_0x227565['id']+0x15b38);});_0x1974a0(_0x12d0c6);});}else{return db[_0x3680('0x55')][_0x3680('0x52')]({'where':{'sectionId':_0x3eca3a['id']},'raw':!![]})[_0x3680('0x26')](function(_0x4b5319){_0x4b5319[_0x3680('0x66')](function(_0x10ad5d){_0x12d0c6['push'](_0x10ad5d[_0x3680('0x67')]+0x15b38);});_0x1974a0(_0x12d0c6);});}}catch(_0x49294a){_0x5c6c88(_0x49294a);}});}exports[_0x3680('0x69')]=function(_0x3f766e,_0x1d0b36){return db['UserProfile'][_0x3680('0x4b')]({'where':{'id':_0x3f766e[_0x3680('0x4a')]['id']}})[_0x3680('0x26')](handleEntityNotFound(_0x1d0b36,null))[_0x3680('0x26')](function(_0x9cadfe){if(_0x9cadfe){return db[_0x3680('0x50')][_0x3680('0x6a')](function(_0x702c77){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x3f766e[_0x3680('0x4a')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x4c0c62){if(_0x4c0c62){return db[_0x3680('0x51')]['destroy']({'where':{'userProfileId':_0x3f766e[_0x3680('0x4a')]['id'],'id':_[_0x3680('0x2d')](_0x4c0c62,function(_0x49c5b3){return _0x49c5b3['id'];})},'transaction':_0x702c77});}})['then'](function(_0x253234){var _0x3ed623=_[_0x3680('0x2d')](_0x3f766e['body'],function(_0x5e7853){_0x5e7853['userProfileId']=_0x3f766e[_0x3680('0x4a')]['id'];return _0x5e7853;});return db[_0x3680('0x51')][_0x3680('0x6b')](_0x3ed623,{'raw':!![],'transaction':_0x702c77});})[_0x3680('0x26')](function(_0x1a8b67){var _0x63fdd5=_[_0x3680('0x40')](_[_0x3680('0x2d')](_0x1a8b67,function(_0x4eb2eb){return _0x4eb2eb[_0x3680('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x63fdd5){return db[_0x3680('0x51')][_0x3680('0x52')]({'where':{'userProfileId':_0x3f766e[_0x3680('0x4a')]['id'],'sectionId':_[_0x3680('0x2d')](_0x63fdd5,function(_0x2f31e6){return _0x2f31e6['sectionId'];})},'attributes':['id',_0x3680('0x59')],'raw':!![]})[_0x3680('0x26')](function(_0x2dd610){var _0x58a814=_[_0x3680('0x2d')](_0x3f766e[_0x3680('0x49')],function(_0xec5eb){_0xec5eb['userProfileId']=_0x3f766e[_0x3680('0x4a')]['id'];return _0xec5eb;});return db['UserProfileResource'][_0x3680('0x6b')](_0x58a814,{'raw':!![],'transaction':_0x702c77});});}})[_0x3680('0x45')](handleError(_0x1d0b36,null));});}})[_0x3680('0x26')](function(_0x3d95fc){var _0x94d0be=_[_0x3680('0x2d')](_0x3d95fc,function(_0x1140ba){return _0x1140ba[_0x3680('0x4c')]({'plain':!![]});});})[_0x3680('0x26')](respondWithResult(_0x1d0b36,null))[_0x3680('0x45')](handleError(_0x1d0b36,null));};exports[_0x3680('0x6c')]=function(_0x1602ad,_0x5a0b62,_0x613193){return db[_0x3680('0x2e')][_0x3680('0x4b')]({'where':{'id':_0x1602ad['params']['id']}})[_0x3680('0x26')](handleEntityNotFound(_0x5a0b62,null))[_0x3680('0x26')](function(_0x28b5b7){if(_0x28b5b7){return _0x28b5b7['removeResources'](_0x1602ad['query'][_0x3680('0x5d')]);}})['then'](respondWithStatusCode(_0x5a0b62,null))[_0x3680('0x45')](handleError(_0x5a0b62,null));};exports[_0x3680('0x6d')]=function(_0x16cbde,_0x3262fe){var _0x412d28={};if(!_0x16cbde['query'][_0x3680('0x6e')])throw new Error(_0x3680('0x6f'));if(!_0x16cbde[_0x3680('0x33')][_0x3680('0x39')](_0x3680('0x3a'))){_0x412d28[_0x3680('0x21')]=qs[_0x3680('0x21')](_0x16cbde[_0x3680('0x33')]['limit']);_0x412d28[_0x3680('0x1f')]=qs[_0x3680('0x1f')](_0x16cbde[_0x3680('0x33')][_0x3680('0x1f')]);}return db['UserProfile'][_0x3680('0x4b')]({'where':{'id':_0x16cbde[_0x3680('0x4a')]['id']}})[_0x3680('0x26')](function(_0x4d6dfe){if(!_0x4d6dfe)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x16cbde[_0x3680('0x4a')]['id']);return db[_0x3680('0x2e')]['getResources'](_0x16cbde);})[_0x3680('0x26')](respondWithFilteredResult(_0x3262fe,_0x412d28))[_0x3680('0x45')](handleError(_0x3262fe,null));}; \ No newline at end of file +var _0x0ada=['type','key','query','keys','filters','model','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL','options','UserProfile','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','clone','get','omit','createdAt','updatedAt','sequelize','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','describe','addSections','UserProfileSection','push','ids','getSections','enabled','includes','subsections','concat','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','name','send','map','rawAttributes','fieldName'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0x0ada,0x18e));var _0xa0ad=function(_0x25d67d,_0x37e92f){_0x25d67d=_0x25d67d-0x0;var _0x4f5fd6=_0x0ada[_0x25d67d];return _0x4f5fd6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa0ad('0x0'));var zipdir=require(_0xa0ad('0x1'));var jsonpatch=require(_0xa0ad('0x2'));var rp=require(_0xa0ad('0x3'));var moment=require(_0xa0ad('0x4'));var BPromise=require(_0xa0ad('0x5'));var Mustache=require(_0xa0ad('0x6'));var util=require(_0xa0ad('0x7'));var path=require(_0xa0ad('0x8'));var sox=require(_0xa0ad('0x9'));var csv=require(_0xa0ad('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa0ad('0xb'));var squel=require(_0xa0ad('0xc'));var crypto=require(_0xa0ad('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa0ad('0xe'));var toCsv=require(_0xa0ad('0xa'));var querystring=require(_0xa0ad('0xf'));var Papa=require(_0xa0ad('0x10'));var Redis=require(_0xa0ad('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa0ad('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0ad('0x13'))('api');var utils=require(_0xa0ad('0x14'));var config=require(_0xa0ad('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa0ad('0x16'))['db'];config[_0xa0ad('0x17')]=_['defaults'](config[_0xa0ad('0x17')],{'host':_0xa0ad('0x18'),'port':0x18eb});var socket=require(_0xa0ad('0x19'))(new Redis(config['redis']));require(_0xa0ad('0x1a'))['register'](socket);function respondWithStatusCode(_0x1666d7,_0x40050c){_0x40050c=_0x40050c||0xcc;return function(_0x4103ea){if(_0x4103ea){return _0x1666d7[_0xa0ad('0x1b')](_0x40050c);}return _0x1666d7[_0xa0ad('0x1c')](_0x40050c)['end']();};}function respondWithResult(_0x136d43,_0x3ece82){_0x3ece82=_0x3ece82||0xc8;return function(_0x5b1cb0){if(_0x5b1cb0){return _0x136d43[_0xa0ad('0x1c')](_0x3ece82)['json'](_0x5b1cb0);}};}function respondWithFilteredResult(_0x55f610,_0x2259cd){return function(_0x1a6fad){if(_0x1a6fad){var _0x1d8c4e=typeof _0x2259cd[_0xa0ad('0x1d')]==='undefined'&&typeof _0x2259cd[_0xa0ad('0x1e')]===_0xa0ad('0x1f');var _0x2066af=_0x1a6fad[_0xa0ad('0x20')];var _0xf2ec8=_0x1d8c4e?0x0:_0x2259cd['offset'];var _0x3d85e9=_0x1d8c4e?_0x1a6fad[_0xa0ad('0x20')]:_0x2259cd[_0xa0ad('0x1d')]+_0x2259cd['limit'];var _0x546e07;if(_0x3d85e9>=_0x2066af){_0x3d85e9=_0x2066af;_0x546e07=0xc8;}else{_0x546e07=0xce;}_0x55f610[_0xa0ad('0x1c')](_0x546e07);return _0x55f610[_0xa0ad('0x21')](_0xa0ad('0x22'),_0xf2ec8+'-'+_0x3d85e9+'/'+_0x2066af)[_0xa0ad('0x23')](_0x1a6fad);}return null;};}function patchUpdates(_0x4e81fa){return function(_0x5c8149){try{jsonpatch[_0xa0ad('0x24')](_0x5c8149,_0x4e81fa,!![]);}catch(_0x40679b){return BPromise[_0xa0ad('0x25')](_0x40679b);}return _0x5c8149[_0xa0ad('0x26')]();};}function saveUpdates(_0x2b62db,_0x4411ec){return function(_0x333798){if(_0x333798){return _0x333798['update'](_0x2b62db)[_0xa0ad('0x27')](function(_0x11544c){return _0x11544c;});}return null;};}function removeEntity(_0x3ec7de,_0x35d332){return function(_0x56b0f6){if(_0x56b0f6){return _0x56b0f6[_0xa0ad('0x28')]()[_0xa0ad('0x27')](function(){_0x3ec7de['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12caa3,_0x23be99){return function(_0x4afdb0){if(!_0x4afdb0){_0x12caa3[_0xa0ad('0x1b')](0x194);}return _0x4afdb0;};}function handleError(_0x429711,_0x4d28e9){_0x4d28e9=_0x4d28e9||0x1f4;return function(_0x32a3e5){logger['error'](_0x32a3e5['stack']);if(_0x32a3e5[_0xa0ad('0x29')]){delete _0x32a3e5['name'];}_0x429711[_0xa0ad('0x1c')](_0x4d28e9)[_0xa0ad('0x2a')](_0x32a3e5);};}exports['index']=function(_0x1888d0,_0x2d8663){var _0x281b9c={},_0x1ad5fa={},_0x7204ff={'count':0x0,'rows':[]};var _0x53a96d=_[_0xa0ad('0x2b')](db['UserProfile'][_0xa0ad('0x2c')],function(_0x2ec8e0){return{'name':_0x2ec8e0[_0xa0ad('0x2d')],'type':_0x2ec8e0[_0xa0ad('0x2e')][_0xa0ad('0x2f')]};});_0x1ad5fa['model']=_['map'](_0x53a96d,_0xa0ad('0x29'));_0x1ad5fa[_0xa0ad('0x30')]=_[_0xa0ad('0x31')](_0x1888d0['query']);_0x1ad5fa[_0xa0ad('0x32')]=_['intersection'](_0x1ad5fa['model'],_0x1ad5fa['query']);_0x281b9c['attributes']=_['intersection'](_0x1ad5fa[_0xa0ad('0x33')],qs[_0xa0ad('0x34')](_0x1888d0[_0xa0ad('0x30')][_0xa0ad('0x34')]));_0x281b9c[_0xa0ad('0x35')]=_0x281b9c['attributes'][_0xa0ad('0x36')]?_0x281b9c[_0xa0ad('0x35')]:_0x1ad5fa[_0xa0ad('0x33')];if(!_0x1888d0[_0xa0ad('0x30')]['hasOwnProperty'](_0xa0ad('0x37'))){_0x281b9c[_0xa0ad('0x1e')]=qs[_0xa0ad('0x1e')](_0x1888d0['query'][_0xa0ad('0x1e')]);_0x281b9c[_0xa0ad('0x1d')]=qs[_0xa0ad('0x1d')](_0x1888d0[_0xa0ad('0x30')][_0xa0ad('0x1d')]);}_0x281b9c[_0xa0ad('0x38')]=qs['sort'](_0x1888d0[_0xa0ad('0x30')]['sort']);_0x281b9c[_0xa0ad('0x39')]=qs['filters'](_[_0xa0ad('0x3a')](_0x1888d0[_0xa0ad('0x30')],_0x1ad5fa[_0xa0ad('0x32')]),_0x53a96d);if(_0x1888d0[_0xa0ad('0x30')][_0xa0ad('0x3b')]){_0x281b9c['where']=_[_0xa0ad('0x3c')](_0x281b9c[_0xa0ad('0x39')],{'$or':_[_0xa0ad('0x2b')](_0x53a96d,function(_0x1d9242){if(_0x1d9242[_0xa0ad('0x2e')]!==_0xa0ad('0x3d')){var _0x3f82b7={};_0x3f82b7[_0x1d9242['name']]={'$like':'%'+_0x1888d0[_0xa0ad('0x30')][_0xa0ad('0x3b')]+'%'};return _0x3f82b7;}})});}_0x281b9c=_['merge']({},_0x281b9c,_0x1888d0[_0xa0ad('0x3e')]);var _0x16a6dc={'where':_0x281b9c[_0xa0ad('0x39')]};return db[_0xa0ad('0x3f')]['count'](_0x16a6dc)['then'](function(_0x372100){_0x7204ff[_0xa0ad('0x20')]=_0x372100;if(_0x1888d0[_0xa0ad('0x30')][_0xa0ad('0x40')]){_0x281b9c[_0xa0ad('0x41')]=[{'all':!![]}];}return db[_0xa0ad('0x3f')][_0xa0ad('0x42')](_0x281b9c);})['then'](function(_0x1c1aa2){_0x7204ff[_0xa0ad('0x43')]=_0x1c1aa2;return _0x7204ff;})[_0xa0ad('0x27')](respondWithFilteredResult(_0x2d8663,_0x281b9c))[_0xa0ad('0x44')](handleError(_0x2d8663,null));};exports[_0xa0ad('0x45')]=function(_0x1c8a6a,_0x1f5637){var _0x1ecbc5={'raw':![],'where':{'id':_0x1c8a6a[_0xa0ad('0x46')]['id']}},_0x333f48={};_0x333f48['model']=_['keys'](db[_0xa0ad('0x3f')]['rawAttributes']);_0x333f48[_0xa0ad('0x30')]=_[_0xa0ad('0x31')](_0x1c8a6a[_0xa0ad('0x30')]);_0x333f48[_0xa0ad('0x32')]=_[_0xa0ad('0x47')](_0x333f48['model'],_0x333f48['query']);_0x1ecbc5[_0xa0ad('0x35')]=_[_0xa0ad('0x47')](_0x333f48[_0xa0ad('0x33')],qs[_0xa0ad('0x34')](_0x1c8a6a[_0xa0ad('0x30')]['fields']));_0x1ecbc5[_0xa0ad('0x35')]=_0x1ecbc5['attributes'][_0xa0ad('0x36')]?_0x1ecbc5['attributes']:_0x333f48[_0xa0ad('0x33')];if(_0x1c8a6a['query']['includeAll']){_0x1ecbc5[_0xa0ad('0x41')]=[{'all':!![]}];}_0x1ecbc5=_['merge']({},_0x1ecbc5,_0x1c8a6a[_0xa0ad('0x3e')]);return db[_0xa0ad('0x3f')][_0xa0ad('0x48')](_0x1ecbc5)[_0xa0ad('0x27')](handleEntityNotFound(_0x1f5637,null))[_0xa0ad('0x27')](respondWithResult(_0x1f5637,null))[_0xa0ad('0x44')](handleError(_0x1f5637,null));};exports[_0xa0ad('0x49')]=function(_0x3f95ee,_0x5dfc29){return db[_0xa0ad('0x3f')][_0xa0ad('0x49')](_0x3f95ee[_0xa0ad('0x4a')],{})[_0xa0ad('0x27')](respondWithResult(_0x5dfc29,0xc9))[_0xa0ad('0x44')](handleError(_0x5dfc29,null));};exports[_0xa0ad('0x4b')]=function(_0x417db8,_0x516adb){var _0x4cc28c={'where':{'id':_0x417db8[_0xa0ad('0x46')]['id']}},_0x2bf39c={};_0x2bf39c[_0xa0ad('0x33')]=_['keys'](db[_0xa0ad('0x3f')]['rawAttributes']);_0x4cc28c[_0xa0ad('0x35')]=_['intersection'](_0x2bf39c['model'],qs[_0xa0ad('0x34')](_0x417db8['query'][_0xa0ad('0x34')]));_0x4cc28c['attributes']=_0x4cc28c[_0xa0ad('0x35')][_0xa0ad('0x36')]?_0x4cc28c[_0xa0ad('0x35')]:_0x2bf39c[_0xa0ad('0x33')];if(_0x417db8['query'][_0xa0ad('0x40')]){_0x4cc28c[_0xa0ad('0x41')]=[{'all':!![]}];}_0x4cc28c=_['merge']({},_0x4cc28c,_0x417db8[_0xa0ad('0x3e')]);return db[_0xa0ad('0x3f')][_0xa0ad('0x48')](_0x4cc28c)[_0xa0ad('0x27')](handleEntityNotFound(_0x516adb,null))[_0xa0ad('0x27')](function(_0x3b8593){if(_0x3b8593){var _0x4258c4=_0x3b8593[_0xa0ad('0x4c')]({'plain':!![]});_0x4258c4=qs[_0xa0ad('0x4d')](_0x4258c4,['id','createdAt','updatedAt','crudPermissions']);_0x417db8[_0xa0ad('0x4a')]=_[_0xa0ad('0x4d')](_0x417db8[_0xa0ad('0x4a')],['id',_0xa0ad('0x4e'),_0xa0ad('0x4f')]);return db[_0xa0ad('0x50')][_0xa0ad('0x51')](function(_0x289af9){return db[_0xa0ad('0x3f')][_0xa0ad('0x49')](_[_0xa0ad('0x3c')](_0x4258c4,_0x417db8[_0xa0ad('0x4a')]),{'include':_0x417db8['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x289af9})[_0xa0ad('0x27')](function(_0x20eaf2){var _0x5504f8=_0x20eaf2['get']({'plain':!![]});return db['UserProfileSection'][_0xa0ad('0x42')]({'where':{'userProfileId':_0x417db8[_0xa0ad('0x46')]['id']},'raw':!![]})[_0xa0ad('0x27')](function(_0x2ae110){if(_0x2ae110){return BPromise[_0xa0ad('0x52')](_0x2ae110,function(_0x142b5c){return new BPromise(function(_0x468e72,_0x158dd8){if(_0x142b5c['autoAssociation']===null||_0x142b5c[_0xa0ad('0x53')]===0x1)_0x468e72(null);return db[_0xa0ad('0x54')][_0xa0ad('0x42')]({'where':{'sectionId':_0x142b5c['id']},'raw':!![]})[_0xa0ad('0x27')](function(_0x3174f3){var _0x36c01f=_[_0xa0ad('0x2b')](_0x3174f3,function(_0x22d8e4){return qs[_0xa0ad('0x4d')](_0x22d8e4,['id',_0xa0ad('0x4e'),_0xa0ad('0x4f'),_0xa0ad('0x55')]);});_0x468e72(_0x36c01f);})[_0xa0ad('0x44')](function(_0x316433){_0x158dd8(_0x316433);});})[_0xa0ad('0x27')](function(_0x291c9b){var _0x5e2145=qs[_0xa0ad('0x4d')](_0x142b5c,['id','createdAt',_0xa0ad('0x4f')]);_0x5e2145[_0xa0ad('0x56')]=_0x5504f8['id'];if(_0x291c9b)_0x5e2145[_0xa0ad('0x57')]=_0x291c9b;return _0x5e2145;})['then'](function(_0xe48a88){return db['UserProfileSection'][_0xa0ad('0x49')](_0xe48a88,{'include':[{'model':db['UserProfileResource'],'as':_0xa0ad('0x57')}],'raw':!![],'transaction':_0x289af9});});})[_0xa0ad('0x27')](function(){return _0x5504f8;});}});});});}})['then'](respondWithResult(_0x516adb,0xc9))[_0xa0ad('0x44')](handleError(_0x516adb,null));};exports[_0xa0ad('0x58')]=function(_0xab0c9e,_0x1da1d3){if(_0xab0c9e[_0xa0ad('0x4a')]['id']){delete _0xab0c9e['body']['id'];}return db[_0xa0ad('0x3f')][_0xa0ad('0x48')]({'where':{'id':_0xab0c9e[_0xa0ad('0x46')]['id']}})[_0xa0ad('0x27')](handleEntityNotFound(_0x1da1d3,null))[_0xa0ad('0x27')](saveUpdates(_0xab0c9e['body'],null))[_0xa0ad('0x27')](respondWithResult(_0x1da1d3,null))[_0xa0ad('0x44')](handleError(_0x1da1d3,null));};exports['destroy']=function(_0x47f088,_0xa2e459){return db[_0xa0ad('0x3f')][_0xa0ad('0x48')]({'where':{'id':_0x47f088['params']['id']}})[_0xa0ad('0x27')](handleEntityNotFound(_0xa2e459,null))[_0xa0ad('0x27')](removeEntity(_0xa2e459,null))[_0xa0ad('0x44')](handleError(_0xa2e459,null));};exports['describe']=function(_0x2d4c9e,_0x51bfd6){return db[_0xa0ad('0x3f')][_0xa0ad('0x59')]()['then'](respondWithResult(_0x51bfd6,null))[_0xa0ad('0x44')](handleError(_0x51bfd6,null));};exports[_0xa0ad('0x5a')]=function(_0x1ca87b,_0xd131a3){var _0x4560f3=_0x1ca87b[_0xa0ad('0x4a')];return db['UserProfile'][_0xa0ad('0x48')]({'where':{'id':_0x1ca87b[_0xa0ad('0x46')]['id']}})[_0xa0ad('0x27')](handleEntityNotFound(_0xd131a3,null))[_0xa0ad('0x27')](function(_0x31e64f){if(_0x31e64f){return db['sequelize'][_0xa0ad('0x51')](function(_0x526e54){return db[_0xa0ad('0x5b')]['destroy']({'where':{'userProfileId':_0x1ca87b[_0xa0ad('0x46')]['id'],'sectionId':_[_0xa0ad('0x2b')](_0x4560f3,function(_0x29d332){return _0x29d332['sectionId'];})},'transaction':_0x526e54})[_0xa0ad('0x27')](function(){var _0x488233=_[_0xa0ad('0x2b')](_0x4560f3,function(_0x4f45bf){_0x4f45bf[_0xa0ad('0x56')]=_0x1ca87b[_0xa0ad('0x46')]['id'];return _0x4f45bf;});var _0x7e32cc=[];return BPromise[_0xa0ad('0x52')](_0x488233,function(_0x23bf43){return db[_0xa0ad('0x5b')][_0xa0ad('0x49')](_0x23bf43,{'include':[{'model':db['UserProfileResource'],'as':_0xa0ad('0x57')}],'raw':!![],'transaction':_0x526e54})[_0xa0ad('0x27')](function(_0x597a87){_0x7e32cc[_0xa0ad('0x5c')](_0x597a87[_0xa0ad('0x4c')]({'plain':!![]}));});})['then'](function(){return _0x7e32cc;});});});}})[_0xa0ad('0x27')](function(_0x50ccc6){return _0x50ccc6;})[_0xa0ad('0x27')](respondWithResult(_0xd131a3,null))[_0xa0ad('0x44')](handleError(_0xd131a3,null));};exports['removeSections']=function(_0x26281a,_0x5e2580){var _0x5ce7d4;return db[_0xa0ad('0x3f')][_0xa0ad('0x48')]({'where':{'id':_0x26281a[_0xa0ad('0x46')]['id']},'attributes':['id','name']})[_0xa0ad('0x27')](handleEntityNotFound(_0x5e2580,null))['then'](function(_0x52fe51){if(_0x52fe51){_0x5ce7d4=_0x52fe51;return db[_0xa0ad('0x5b')][_0xa0ad('0x28')]({'where':{'userProfileId':_0x26281a[_0xa0ad('0x46')]['id'],'sectionId':_0x26281a['query'][_0xa0ad('0x5d')]}});}})[_0xa0ad('0x27')](function(){return _0x5ce7d4;})[_0xa0ad('0x27')](respondWithStatusCode(_0x5e2580,null))[_0xa0ad('0x44')](handleError(_0x5e2580,null));};exports[_0xa0ad('0x5e')]=function(_0x4bd33b,_0x406d2a){var _0x27b143=[];var _0x4a739a=[];return db[_0xa0ad('0x5b')][_0xa0ad('0x42')]({'where':{'userProfileId':_0x4bd33b['params']['id']},'raw':!![]})['then'](function(_0x3a78c4){_0x27b143=_[_0xa0ad('0x3b')](_0x3a78c4,function(_0x683db0){return _0x683db0[_0xa0ad('0x5f')]===0x1||_[_0xa0ad('0x60')]([0x3eb,0x709],_0x683db0[_0xa0ad('0x55')]);});if(!_['isEmpty'](_0x27b143)){return _['map'](_0x27b143,function(_0x12df89){return _0x12df89[_0xa0ad('0x55')];});}else{return;}})[_0xa0ad('0x27')](function(_0x3f2253){if(_0x3f2253)_0x4a739a=_0x3f2253;if(_[_0xa0ad('0x60')](_0x4a739a,0x64)){var _0x14d09a=_[_0xa0ad('0x48')](_0x27b143,{'sectionId':0x64});return hasDefaultDashboard(_0x14d09a)[_0xa0ad('0x27')](function(_0x4bcfd4){return _[_0xa0ad('0x2b')](_0x27b143,function(_0x49b2f8){if(_0x49b2f8['sectionId']===0x64){_0x49b2f8['subsections']=_0x4bcfd4;}return _0x49b2f8;});});}else{return;}})['then'](function(_0x2c06fd){if(_0x2c06fd)_0x27b143=_0x2c06fd;if(_[_0xa0ad('0x60')](_0x4a739a,0x3eb)){var _0x27d2b3=_['find'](_0x27b143,{'sectionId':0x3eb});return getCustomDashboards(_0x27d2b3)[_0xa0ad('0x27')](function(_0x38b768){return _[_0xa0ad('0x2b')](_0x27b143,function(_0x30712f){if(_0x27d2b3[_0xa0ad('0x5f')]){if(_0x30712f[_0xa0ad('0x55')]===0x3eb){_0x30712f['subsections']=_0x38b768;}}else{if(_0x30712f[_0xa0ad('0x55')]===0x64){if(!_0x30712f['subsections']){_0x30712f['subsections']=[];}_0x30712f[_0xa0ad('0x61')]=_0x30712f['subsections'][_0xa0ad('0x62')](_0x38b768);}}return _0x30712f;});});}else{return;}})['then'](function(_0x43f744){if(_0x43f744)_0x27b143=_0x43f744;if(_['includes'](_0x4a739a,0x709)){var _0x497c91=_[_0xa0ad('0x48')](_0x27b143,{'sectionId':0x709});return getPlugins(_0x497c91)['then'](function(_0x402c94){if(_0x497c91[_0xa0ad('0x5f')]){return _['map'](_0x27b143,function(_0x5a7c32){if(_0x5a7c32[_0xa0ad('0x55')]===0x709){_0x5a7c32[_0xa0ad('0x61')]=_0x402c94;}return _0x5a7c32;});}else{var _0x33de1f={'sectionId':0x76c,'enabled':0x1,'subsections':_0x402c94};var _0x425b0f=_[_0xa0ad('0x2b')](_0x27b143);_0x425b0f[_0xa0ad('0x5c')](_0x33de1f);return _0x425b0f;}});}else{return;}})['then'](function(_0xe8fcb9){if(_0xe8fcb9)_0x27b143=_0xe8fcb9;return _[_0xa0ad('0x3b')](_0x27b143,['enabled',0x1]);})['then'](respondWithResult(_0x406d2a,null))[_0xa0ad('0x44')](handleError(_0x406d2a,null));};function hasDefaultDashboard(_0x2ceb46){var _0x43c64d=[0x65];return new BPromise(function(_0xc48b46,_0x3a40eb){try{if(_0x2ceb46[_0xa0ad('0x53')]){_0xc48b46(_0x43c64d);}else{return db['UserProfileResource'][_0xa0ad('0x63')]({'where':{'sectionId':_0x2ceb46['id']},'raw':!![]})[_0xa0ad('0x27')](function(_0x27b5a9){_0x27b5a9?_0xc48b46(_0x43c64d):_0xc48b46();});}}catch(_0x3e53dc){_0x3a40eb(_0x3e53dc);}});}function getCustomDashboards(_0x4fc84e){var _0x1e16e8=[];return new BPromise(function(_0x22254d,_0x21349a){try{if(_0x4fc84e[_0xa0ad('0x53')]){return db[_0xa0ad('0x64')][_0xa0ad('0x42')]({'raw':!![]})['then'](function(_0x479624){_0x479624[_0xa0ad('0x65')](function(_0x5699d6){_0x1e16e8[_0xa0ad('0x5c')](_0x5699d6['id']+0x1869f);});_0x22254d(_0x1e16e8);});}else{return db[_0xa0ad('0x54')][_0xa0ad('0x42')]({'where':{'sectionId':_0x4fc84e['id']},'raw':!![]})[_0xa0ad('0x27')](function(_0x2abec9){_0x2abec9[_0xa0ad('0x65')](function(_0x26dba3){_0x1e16e8[_0xa0ad('0x5c')](_0x26dba3[_0xa0ad('0x66')]+0x1869f);});_0x22254d(_0x1e16e8);});}}catch(_0xc29604){_0x21349a(_0xc29604);}});}function getPlugins(_0xd2c113){var _0x410331=[];return new BPromise(function(_0x37c0e2,_0x3a7f98){try{if(_0xd2c113[_0xa0ad('0x53')]){return db[_0xa0ad('0x67')][_0xa0ad('0x42')]({'raw':!![]})[_0xa0ad('0x27')](function(_0x3f7b79){_0x3f7b79[_0xa0ad('0x65')](function(_0x4a7a02){_0x410331['push'](_0x4a7a02['id']+0x15b38);});_0x37c0e2(_0x410331);});}else{return db[_0xa0ad('0x54')][_0xa0ad('0x42')]({'where':{'sectionId':_0xd2c113['id']},'raw':!![]})[_0xa0ad('0x27')](function(_0x2fe910){_0x2fe910[_0xa0ad('0x65')](function(_0x3d60d9){_0x410331[_0xa0ad('0x5c')](_0x3d60d9['resourceId']+0x15b38);});_0x37c0e2(_0x410331);});}}catch(_0x35869c){_0x3a7f98(_0x35869c);}});}exports[_0xa0ad('0x68')]=function(_0x5ee33f,_0x76192d){return db[_0xa0ad('0x3f')]['find']({'where':{'id':_0x5ee33f['params']['id']}})['then'](handleEntityNotFound(_0x76192d,null))[_0xa0ad('0x27')](function(_0x2cb45b){if(_0x2cb45b){return db[_0xa0ad('0x50')][_0xa0ad('0x51')](function(_0x409936){return db[_0xa0ad('0x5b')][_0xa0ad('0x42')]({'where':{'userProfileId':_0x5ee33f[_0xa0ad('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0xa0ad('0x27')](function(_0xa082d7){if(_0xa082d7){return db[_0xa0ad('0x5b')][_0xa0ad('0x28')]({'where':{'userProfileId':_0x5ee33f[_0xa0ad('0x46')]['id'],'id':_[_0xa0ad('0x2b')](_0xa082d7,function(_0x6e6651){return _0x6e6651['id'];})},'transaction':_0x409936});}})['then'](function(_0x463def){var _0x3ad4f9=_[_0xa0ad('0x2b')](_0x5ee33f[_0xa0ad('0x4a')],function(_0x2c360b){_0x2c360b[_0xa0ad('0x56')]=_0x5ee33f['params']['id'];return _0x2c360b;});return db[_0xa0ad('0x5b')][_0xa0ad('0x69')](_0x3ad4f9,{'raw':!![],'transaction':_0x409936});})['then'](function(_0x46d213){var _0x166aa3=_['filter'](_[_0xa0ad('0x2b')](_0x46d213,function(_0x192297){return _0x192297[_0xa0ad('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x166aa3){return db[_0xa0ad('0x5b')]['findAll']({'where':{'userProfileId':_0x5ee33f[_0xa0ad('0x46')]['id'],'sectionId':_[_0xa0ad('0x2b')](_0x166aa3,function(_0x14f82e){return _0x14f82e[_0xa0ad('0x55')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xa0ad('0x27')](function(_0x4447f4){var _0x590ad5=_[_0xa0ad('0x2b')](_0x5ee33f[_0xa0ad('0x4a')],function(_0x42f098){_0x42f098['userProfileId']=_0x5ee33f[_0xa0ad('0x46')]['id'];return _0x42f098;});return db[_0xa0ad('0x54')][_0xa0ad('0x69')](_0x590ad5,{'raw':!![],'transaction':_0x409936});});}})[_0xa0ad('0x44')](handleError(_0x76192d,null));});}})[_0xa0ad('0x27')](function(_0x1b8d23){var _0x45a6c7=_[_0xa0ad('0x2b')](_0x1b8d23,function(_0x1b0f24){return _0x1b0f24[_0xa0ad('0x4c')]({'plain':!![]});});})[_0xa0ad('0x27')](respondWithResult(_0x76192d,null))['catch'](handleError(_0x76192d,null));};exports['removeResources']=function(_0xbbbd66,_0x40e9e9,_0x543d46){return db[_0xa0ad('0x3f')][_0xa0ad('0x48')]({'where':{'id':_0xbbbd66['params']['id']}})['then'](handleEntityNotFound(_0x40e9e9,null))[_0xa0ad('0x27')](function(_0x21aa41){if(_0x21aa41){return _0x21aa41[_0xa0ad('0x6a')](_0xbbbd66[_0xa0ad('0x30')][_0xa0ad('0x5d')]);}})[_0xa0ad('0x27')](respondWithStatusCode(_0x40e9e9,null))['catch'](handleError(_0x40e9e9,null));};exports[_0xa0ad('0x6b')]=function(_0x51814f,_0x5a3df3){var _0x10f8aa={};if(!_0x51814f['query'][_0xa0ad('0x6c')])throw new Error(_0xa0ad('0x6d'));if(!_0x51814f[_0xa0ad('0x30')]['hasOwnProperty'](_0xa0ad('0x37'))){_0x10f8aa[_0xa0ad('0x1e')]=qs['limit'](_0x51814f[_0xa0ad('0x30')]['limit']);_0x10f8aa[_0xa0ad('0x1d')]=qs['offset'](_0x51814f[_0xa0ad('0x30')][_0xa0ad('0x1d')]);}return db[_0xa0ad('0x3f')][_0xa0ad('0x48')]({'where':{'id':_0x51814f[_0xa0ad('0x46')]['id']}})[_0xa0ad('0x27')](function(_0x135546){if(!_0x135546)throw new Error(_0xa0ad('0x6e')+_0x51814f[_0xa0ad('0x46')]['id']);return db[_0xa0ad('0x3f')]['getResources'](_0x51814f);})['then'](respondWithFilteredResult(_0x5a3df3,_0x10f8aa))[_0xa0ad('0x44')](handleError(_0x5a3df3,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index d3cc1f4..a100d36 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 _0x3d3d=['emit','hasOwnProperty','exports','../../mysqldb','UserProfile','save','update','remove'];(function(_0x15afa2,_0x474af8){var _0x53242e=function(_0x31a2b4){while(--_0x31a2b4){_0x15afa2['push'](_0x15afa2['shift']());}};_0x53242e(++_0x474af8);}(_0x3d3d,0xab));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xd3d3('0x0'))['db'][_0xd3d3('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd3d3('0x2'),'afterUpdate':_0xd3d3('0x3'),'afterDestroy':_0xd3d3('0x4')};function emitEvent(_0x427bd5){return function(_0x1f03e9,_0x46aa0c,_0x3b43f2){UserProfileEvents[_0xd3d3('0x5')](_0x427bd5+':'+_0x1f03e9['id'],_0x1f03e9);UserProfileEvents[_0xd3d3('0x5')](_0x427bd5,_0x1f03e9);_0x3b43f2(null);};}for(var e in events){if(events[_0xd3d3('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xd3d3('0x7')]=UserProfileEvents; \ No newline at end of file +var _0xbc48=['events','../../mysqldb','UserProfile','setMaxListeners','update','remove','hook'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbc48,0x111));var _0x8bc4=function(_0x6e3157,_0x3c5117){_0x6e3157=_0x6e3157-0x0;var _0x2729eb=_0xbc48[_0x6e3157];return _0x2729eb;};'use strict';var EventEmitter=require(_0x8bc4('0x0'));var UserProfile=require(_0x8bc4('0x1'))['db'][_0x8bc4('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x8bc4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8bc4('0x4'),'afterDestroy':_0x8bc4('0x5')};function emitEvent(_0x3efe3a){return function(_0x5971fb,_0x5468ea,_0x2f83e9){UserProfileEvents['emit'](_0x3efe3a+':'+_0x5971fb['id'],_0x5971fb);UserProfileEvents['emit'](_0x3efe3a,_0x5971fb);_0x2f83e9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x8bc4('0x6')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index bb48da9..ab3078a 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 _0xf417=['tags','Tag','templates','Template','trunks','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','UserProfile','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','UserProfileSection','find','params','all','ignore','length','autoAssociation','push','rawAttributes','keys','filters','attributes','intersection','fields','nolimit','limit','offset','sort','pick','merge','key','VIRTUAL','AnalyticExtractedReport','foreignKey','forEach','includeAll','include','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','order','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','models','filter','findAll','then','associatedResources','map','catch','value','model','name','resolve','UserProfileResource','field','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','JscriptyProject','contacts','CmContact','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceContext','VoiceMail','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','queue','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','Team','voicequeues','queuecampaigns','QueueCampaigns','users','agents','Users','admin','user','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound'];(function(_0x4dae23,_0x1d2011){var _0x44bd79=function(_0x450c29){while(--_0x450c29){_0x4dae23['push'](_0x4dae23['shift']());}};_0x44bd79(++_0x1d2011);}(_0xf417,0x1d9));var _0x7f41=function(_0x2ea857,_0x466b31){_0x2ea857=_0x2ea857-0x0;var _0x20429a=_0xf417[_0x2ea857];return _0x20429a;};'use strict';var _=require(_0x7f41('0x0'));var attributes=require(_0x7f41('0x1'));var squel=require(_0x7f41('0x2'));module['exports']=function(_0x164855){var _0x329a6a=_0x164855[_0x7f41('0x3')];function _0xda29dd(_0x49a6ee,_0x549570){return new Promise(function(_0x467f61,_0x4a7a33){if(!_0x549570)return _0x467f61(null);var _0x3065a9=_0x549570['filter']?{[_0x549570[_0x7f41('0x4')]['field']]:_0x549570[_0x7f41('0x4')]['value']}:undefined;return _0x329a6a[_0x49a6ee][_0x7f41('0x5')]({'where':_0x3065a9,'raw':!![]})[_0x7f41('0x6')](function(_0x2eae9c){_0x549570[_0x7f41('0x7')]=_[_0x7f41('0x8')](_0x2eae9c,'id');_0x467f61(_0x549570);})[_0x7f41('0x9')](function(_0x5a39c4){_0x4a7a33(_0x5a39c4);});});}function _0x46fff9(_0x20486a,_0x998dc8){return new Promise(function(_0x1173ff,_0x183f8d){var _0x35d5b7=_0x20486a[_0x7f41('0x4')]?{[_0x20486a[_0x7f41('0x4')]['field']]:_0x20486a[_0x7f41('0x4')][_0x7f41('0xa')]}:undefined;return _0x329a6a[_0x20486a[_0x7f41('0xb')]][_0x7f41('0x5')]({'where':_0x35d5b7,'raw':!![]})[_0x7f41('0x6')](function(_0x22fb9c){_0x998dc8[_0x7f41('0x7')]=_['map'](_0x22fb9c,function(_0x21b4fc){return _0x21b4fc[_0x7f41('0xc')];});_0x1173ff(_0x998dc8);})[_0x7f41('0x9')](function(_0x20d9e3){_0x183f8d(_0x20d9e3);});});}function _0x4cd962(_0x3b0638,_0xbd8f1f,_0x1d68d){if(!_0xbd8f1f)return Promise[_0x7f41('0xd')](null);return new Promise(function(_0x42cee5,_0x43ee42){return _0x329a6a[_0x7f41('0xe')]['findAll']({'where':{'sectionId':_0xbd8f1f['id']},'raw':!![]})['then'](function(_0x26dec4){if(_0x3b0638[_0x7f41('0xf')]&&_0x3b0638['field']!=='id'){_0xbd8f1f[_0x7f41('0x7')]=_[_0x7f41('0x8')](_0x26dec4,function(_0x23f225){return _0x23f225[_0x3b0638[_0x7f41('0xf')]];});}else{if(_0x1d68d==='AnalyticExtractedReport'){_0xbd8f1f[_0x7f41('0x7')]=_[_0x7f41('0x8')](_0x26dec4,function(_0x12f200){return{'id':_0x12f200[_0x7f41('0x10')],'type':_0x12f200[_0x7f41('0x11')]};});}else{_0xbd8f1f[_0x7f41('0x7')]=_[_0x7f41('0x8')](_0x26dec4,function(_0x448525){return _0x448525[_0x7f41('0x10')];});}}_0x42cee5(_0xbd8f1f);})['catch'](function(_0x2db40d){_0x43ee42(_0x2db40d);});});}function _0x482878(_0x386ae6,_0x4e2c96){var _0x340f1a={'parentSections':[]};switch(_0x386ae6[_0x7f41('0x12')]()){case _0x7f41('0x13'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x15');break;case _0x7f41('0x16'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x17');break;case _0x7f41('0x18'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x19');_0x340f1a[_0x7f41('0x1a')]=[{'name':_0x7f41('0x1b'),'field':_0x7f41('0xc'),'foreignKey':_0x7f41('0x1c')}];break;case'projects':_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x1d');break;case _0x7f41('0x1e'):_0x340f1a['childModel']=_0x7f41('0x1f');_0x340f1a[_0x7f41('0x1a')]=[{'name':_0x7f41('0x20'),'field':'id','foreignKey':'ListId'}];break;case _0x7f41('0x21'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x22');break;case _0x7f41('0x23'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x24');break;case _0x7f41('0x25'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x26');break;case _0x7f41('0x27'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x28');break;case _0x7f41('0x29'):_0x340f1a[_0x7f41('0x14')]='ChatWebsite';break;case _0x7f41('0x2a'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x2b');break;case _0x7f41('0x2c'):_0x340f1a[_0x7f41('0x14')]='FaxAccount';break;case _0x7f41('0x2d'):case _0x7f41('0x2e'):case _0x7f41('0x2f'):_0x340f1a[_0x7f41('0x14')]='VoiceExtension';break;case'contexts':_0x340f1a['childModel']=_0x7f41('0x30');break;case'voicemails':_0x340f1a['childModel']=_0x7f41('0x31');break;case'voicerecordings':_0x340f1a['childModel']=_0x7f41('0x32');_0x340f1a[_0x7f41('0x1a')]=[{'name':_0x7f41('0x33'),'field':_0x7f41('0xc'),'foreignKey':_0x7f41('0x34'),'model':_0x7f41('0x35'),'filter':{'field':_0x7f41('0x36'),'value':[_0x7f41('0x37')]}},{'name':_0x7f41('0x38'),'field':_0x7f41('0xc'),'foreignKey':_0x7f41('0x34'),'model':'User','filter':{'field':_0x7f41('0x36'),'value':[_0x7f41('0x39')]}},{'name':'VoiceQueues','field':_0x7f41('0xc'),'foreignKey':_0x7f41('0x3a'),'model':'VoiceQueue','filter':{'field':_0x7f41('0x11'),'value':[_0x7f41('0x3b')]}},{'name':'QueueCampaigns','field':'name','foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x7f41('0x11'),'value':[_0x7f41('0x3c')]}}];break;case _0x7f41('0x3d'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x3e');break;case _0x7f41('0x3f'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x40');break;case'voiceprefixes':_0x340f1a[_0x7f41('0x14')]='VoicePrefix';break;case'ivrcampaigns':_0x340f1a['childModel']=_0x7f41('0x41');break;case _0x7f41('0x42'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x43');break;case _0x7f41('0x44'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x45');break;case _0x7f41('0x46'):_0x340f1a[_0x7f41('0x14')]='MailSubstatus';break;case'openchannelqueues':_0x340f1a[_0x7f41('0x14')]='OpenchannelQueue';break;case'openchannelaccounts':_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x47');break;case _0x7f41('0x48'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x49');break;case _0x7f41('0x4a'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x4b');break;case _0x7f41('0x4c'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x4d');break;case _0x7f41('0x4e'):_0x340f1a[_0x7f41('0x14')]='WhatsappAccount';break;case'teams':_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x4f');break;case _0x7f41('0x50'):case _0x7f41('0x51'):_0x340f1a[_0x7f41('0x14')]='VoiceQueue';if(_0x4e2c96){_0x340f1a[_0x7f41('0x1a')]=[{'name':'VoiceQueues'},{'name':_0x7f41('0x52')}];}break;case _0x7f41('0x53'):case _0x7f41('0x54'):case'telephones':_0x340f1a['childModel']=_0x7f41('0x35');if(_0x4e2c96){_0x340f1a[_0x7f41('0x1a')]=[{'name':_0x7f41('0x55'),'filter':{'field':_0x7f41('0x36'),'value':[_0x7f41('0x56'),_0x7f41('0x57')]},'ignore':!![]},{'name':_0x7f41('0x33')},{'name':_0x7f41('0x38')}];}break;case'zendeskaccounts':_0x340f1a[_0x7f41('0x14')]='ZendeskAccount';break;case'salesforceaccounts':_0x340f1a['childModel']=_0x7f41('0x58');break;case _0x7f41('0x59'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x5a');break;case _0x7f41('0x5b'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x5c');break;case _0x7f41('0x5d'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x5e');break;case _0x7f41('0x5f'):_0x340f1a['childModel']=_0x7f41('0x60');break;case _0x7f41('0x61'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x35');break;case _0x7f41('0x62'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x63');break;case _0x7f41('0x64'):_0x340f1a['childModel']=_0x7f41('0x65');break;case'customdashboards':_0x340f1a[_0x7f41('0x14')]='Dashboard';break;case'intervals':_0x340f1a['childModel']=_0x7f41('0x66');break;case _0x7f41('0x67'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x68');break;case _0x7f41('0x69'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x6a');break;case _0x7f41('0x6b'):_0x340f1a['childModel']=_0x7f41('0x6c');break;case _0x7f41('0x6d'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x6e');break;case _0x7f41('0x6f'):_0x340f1a['childModel']=_0x7f41('0x70');break;case'triggers':_0x340f1a[_0x7f41('0x14')]='Trigger';break;case _0x7f41('0x71'):_0x340f1a[_0x7f41('0x14')]='Trunk';break;case _0x7f41('0x72'):_0x340f1a['childModel']=_0x7f41('0x73');break;case _0x7f41('0x74'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x75');break;case _0x7f41('0x76'):_0x340f1a['childModel']='AnalyticExtractedReport';_0x340f1a[_0x7f41('0x1a')]=[{'name':_0x7f41('0x77'),'field':'id','foreignKey':_0x7f41('0x78')}];break;case'metrics':_0x340f1a['childModel']=_0x7f41('0x79');break;}return _0x340f1a;}function _0xa27d59(_0x3e844a,_0xa51b1c){var _0x4d3fa8=_0x3e844a['charAt'](0x0)[_0x7f41('0x7a')]()+_0x3e844a[_0x7f41('0x7b')](0x1);var _0x17622b={'type':_0x329a6a[_0x7f41('0x7c')][_0x7f41('0x7d')][_0x7f41('0x7e')],'raw':!![]};return new Promise(function(_0x561ffa,_0x326815){var _0xf8f09a=squel[_0x7f41('0x7f')]()[_0x7f41('0xf')](_0x7f41('0x80')+_0x4d3fa8+_0x7f41('0x81'),'id')['field'](_0x7f41('0x82'))[_0x7f41('0x83')](_0x7f41('0x84')+_0x3e844a+'_interactions','ui')[_0x7f41('0x85')](_0x7f41('0x86'),_0xa51b1c['id']);return _0x329a6a[_0x7f41('0x87')][_0x7f41('0x88')](_0xf8f09a['toString'](),_0x17622b)[_0x7f41('0x6')](function(_0x4f64b1){_0xa51b1c[_0x4d3fa8+_0x7f41('0x89')]=_0x4f64b1;_0x561ffa(_0x4f64b1);})[_0x7f41('0x9')](function(_0x5cf308){_0x326815(_0x5cf308);});});}return _0x164855['define'](_0x7f41('0x8a'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3d7a77){var _0x1957bb=require(_0x7f41('0x8b'));var _0x41fae6={'raw':_0x3d7a77[_0x7f41('0x88')][_0x7f41('0x8c')],'where':{}};var _0x3eb2af={};var _0x15f4e5={'count':0x0,'rows':[]};var _0x5a8c9e=_0x3d7a77[_0x7f41('0x88')][_0x7f41('0x8d')];var _0x269b07=_0x3d7a77[_0x7f41('0x88')][_0x7f41('0x8e')]||![];var _0x35edf7=_0x482878(_0x5a8c9e,_0x269b07);if(!_0x35edf7[_0x7f41('0x14')])throw new Error(_0x7f41('0x8f')+_0x5a8c9e+'\x27');var _0x36cd10=[{'name':_0x5a8c9e}];if(!_[_0x7f41('0x90')](_0x35edf7['parentSections']))_0x36cd10=_0x35edf7['parentSections'];var _0x39bf40=[];for(var _0x16cc0d=0x0;_0x16cc0d<_0x36cd10['length'];_0x16cc0d++){_0x39bf40['push'](_0x329a6a[_0x7f41('0x91')][_0x7f41('0x92')]({'where':{'userProfileId':_0x3d7a77[_0x7f41('0x93')]['id'],'name':_0x36cd10[_0x16cc0d]['name']},'raw':!![]}));}return Promise[_0x7f41('0x94')](_0x39bf40)[_0x7f41('0x6')](function(_0x435289){var _0x3c7169=_[_0x7f41('0x4')](_0x435289,function(_0x582350){return _0x582350?_0x582350:undefined;});var _0x48b8e8=_[_0x7f41('0x4')](_0x36cd10,[_0x7f41('0x95'),!![]]);var _0x29d6d5=_[_0x7f41('0x90')](_0x3c7169)&&_[_0x7f41('0x90')](_0x48b8e8)?null:_['union'](_0x48b8e8,_0x3c7169);if(!_0x29d6d5)return null;var _0x70d4e9=[];for(var _0x89d198=0x0;_0x89d198<_0x29d6d5[_0x7f41('0x96')];_0x89d198++){var _0x681e0=_[_0x7f41('0x92')](_0x36cd10,function(_0x1b0375){return _0x29d6d5[_0x89d198]?_0x1b0375[_0x7f41('0xc')]===_0x29d6d5[_0x89d198][_0x7f41('0xc')]:null;});if(_0x681e0){if(_0x29d6d5[_0x89d198][_0x7f41('0x95')]){_0x70d4e9['push'](_0xda29dd(_0x35edf7['childModel'],_0x29d6d5[_0x89d198]));}else{if(!_0x29d6d5[_0x89d198][_0x7f41('0x97')]){_0x70d4e9[_0x7f41('0x98')](_0x4cd962(_0x681e0,_0x29d6d5[_0x89d198],_0x35edf7[_0x7f41('0x14')]));}else{if(_0x681e0[_0x7f41('0xb')]){_0x70d4e9[_0x7f41('0x98')](_0x46fff9(_0x681e0,_0x29d6d5[_0x89d198]));}}}}}return Promise['all'](_0x70d4e9);})[_0x7f41('0x6')](function(_0x3b4be9){var _0x784d7f=_0x3b4be9;var _0x105d0a=null;if(_0x784d7f){_0x105d0a=_0x784d7f['length']===0x1?_0x784d7f[0x0]:null;}if(!_0x105d0a&&!_0x784d7f)return _0x15f4e5;var _0x89b75b=_0x329a6a[_0x35edf7[_0x7f41('0x14')]][_0x7f41('0x99')];_0x3eb2af[_0x7f41('0xb')]=_[_0x7f41('0x9a')](_0x89b75b);_0x3eb2af[_0x7f41('0x88')]=_[_0x7f41('0x9a')](_0x3d7a77[_0x7f41('0x88')]);_0x3eb2af[_0x7f41('0x9b')]=_['intersection'](_0x3eb2af[_0x7f41('0xb')],_0x3eb2af['query']);_0x41fae6[_0x7f41('0x9c')]=_[_0x7f41('0x9d')](_0x3eb2af['model'],_0x1957bb['fields'](_0x3d7a77[_0x7f41('0x88')][_0x7f41('0x9e')]));_0x41fae6[_0x7f41('0x9c')]=_0x41fae6['attributes'][_0x7f41('0x96')]?_0x41fae6['attributes']:_0x3eb2af[_0x7f41('0xb')];if(!_0x3d7a77[_0x7f41('0x88')]['hasOwnProperty'](_0x7f41('0x9f'))){_0x41fae6[_0x7f41('0xa0')]=_0x1957bb['limit'](_0x3d7a77[_0x7f41('0x88')]['limit']);_0x41fae6[_0x7f41('0xa1')]=_0x1957bb['offset'](_0x3d7a77[_0x7f41('0x88')][_0x7f41('0xa1')]);}_0x41fae6['order']=_0x1957bb[_0x7f41('0xa2')](_0x3d7a77[_0x7f41('0x88')]['sort']);_0x41fae6['where']=_0x1957bb[_0x7f41('0x9b')](_[_0x7f41('0xa3')](_0x3d7a77[_0x7f41('0x88')],_0x3eb2af['filters']));if(_0x3d7a77[_0x7f41('0x88')][_0x7f41('0x4')]){_0x41fae6[_0x7f41('0x85')]=_[_0x7f41('0xa4')](_0x41fae6[_0x7f41('0x85')],{'$or':_[_0x7f41('0x8')](_0x89b75b,function(_0x157730){if(_0x157730[_0x7f41('0x11')][_0x7f41('0xa5')]!==_0x7f41('0xa6')){var _0x410f84={};_0x410f84[_0x157730[_0x7f41('0xf')]]={'$like':'%'+_0x3d7a77['query'][_0x7f41('0x4')]+'%'};return _0x410f84;}})});}var _0x840a0b=[];var _0x1e8c7c=null;var _0x32f4cb={};if(_0x105d0a){_0x1e8c7c=_[_0x7f41('0x92')](_0x36cd10,['name',_0x105d0a[_0x7f41('0xc')]]);if(_0x1e8c7c['field']){_0x32f4cb={};if(_0x35edf7['childModel']===_0x7f41('0xa7')){_0x32f4cb[_0x1e8c7c['foreignKey']]=_[_0x7f41('0x8')](_0x105d0a['associatedResources'],'id');}else{_0x32f4cb[_0x1e8c7c[_0x7f41('0xa8')]]=_0x105d0a[_0x7f41('0x7')];}_0x840a0b['push'](_0x32f4cb);}else{_0x41fae6['where']['id']=_0x105d0a[_0x7f41('0x7')];}}else{for(var _0x3ec4cb=0x0;_0x3ec4cb<_0x784d7f['length'];_0x3ec4cb++){_0x1e8c7c=_['find'](_0x36cd10,['name',_0x784d7f[_0x3ec4cb][_0x7f41('0xc')]]);if(_0x1e8c7c[_0x7f41('0xf')]){_0x32f4cb={};_0x32f4cb[_0x1e8c7c[_0x7f41('0xa8')]]=_0x784d7f[_0x3ec4cb][_0x7f41('0x7')];_0x840a0b[_0x7f41('0x98')](_0x32f4cb);}else{if(!_0x41fae6[_0x7f41('0x85')]['id'])_0x41fae6[_0x7f41('0x85')]['id']=[];_0x784d7f[_0x3ec4cb][_0x7f41('0x7')][_0x7f41('0xa9')](function(_0x58854d){_0x41fae6[_0x7f41('0x85')]['id'][_0x7f41('0x98')](_0x58854d);});}}}if(!_[_0x7f41('0x90')](_0x840a0b)){_0x41fae6[_0x7f41('0x85')]=_[_0x7f41('0xa4')](_0x41fae6[_0x7f41('0x85')],{'$and':{'$or':_0x840a0b}});}_0x41fae6=_['merge']({},_0x41fae6,_0x3d7a77['options']);if(_0x105d0a&&!_0x105d0a[_0x7f41('0x97')]&&_0x35edf7[_0x7f41('0x14')]===_0x7f41('0xa7')){if(_0x3d7a77[_0x7f41('0x88')][_0x7f41('0xaa')]){_0x41fae6[_0x7f41('0xab')]=[{'all':!![]}];}return _0x329a6a[_0x35edf7['childModel']]['findAll'](_0x41fae6)[_0x7f41('0x6')](function(_0x2ad62c){var _0x3f80d7=[];_0x2ad62c[_0x7f41('0xa9')](function(_0x3e850a){var _0x1a24cc;switch(_0x3e850a['reportType']){case _0x7f41('0xac'):_0x1a24cc=_[_0x7f41('0x92')](_0x105d0a['associatedResources'],function(_0x20fa73){return _0x20fa73['id']===_0x3e850a[_0x7f41('0x78')]&&_0x20fa73[_0x7f41('0x11')]===_0x7f41('0xad');});break;case _0x7f41('0xae'):_0x1a24cc=_[_0x7f41('0x92')](_0x105d0a[_0x7f41('0x7')],function(_0x938aad){return _0x938aad['id']===_0x3e850a[_0x7f41('0x78')]&&_0x938aad[_0x7f41('0x11')]===_0x7f41('0xaf');});break;}if(_0x1a24cc)_0x3f80d7[_0x7f41('0x98')](_0x3e850a);});_0x15f4e5[_0x7f41('0xb0')]=_0x3f80d7[_0x7f41('0x96')];_0x15f4e5[_0x7f41('0xb1')]=_0x3f80d7;return _0x15f4e5;});}else{if(!_[_0x7f41('0x90')](_0x3d7a77[_0x7f41('0x88')][_0x7f41('0xb2')])){_0x41fae6[_0x7f41('0x85')]['id']=_0x41fae6[_0x7f41('0x85')]['id']?_[_0x7f41('0x9d')](_0x41fae6[_0x7f41('0x85')]['id'],_0x3d7a77[_0x7f41('0x88')][_0x7f41('0xb2')]):_0x3d7a77[_0x7f41('0x88')][_0x7f41('0xb2')];if(_0x3d7a77[_0x7f41('0x88')][_0x7f41('0xb3')]){_0x41fae6[_0x7f41('0xb4')]=_0x3d7a77[_0x7f41('0x88')]['customSorting'];}}if(_0x3d7a77['query']['extraQueryConditions']){_0x41fae6[_0x7f41('0x85')]=_['merge'](_0x41fae6[_0x7f41('0x85')],{'$and':_0x3d7a77[_0x7f41('0x88')]['extraQueryConditions']});}return _0x329a6a[_0x35edf7[_0x7f41('0x14')]][_0x7f41('0xb0')]({'where':_0x41fae6['where']})[_0x7f41('0x6')](function(_0x4750a8){_0x15f4e5[_0x7f41('0xb0')]=_0x4750a8;if(_0x3d7a77[_0x7f41('0x88')][_0x7f41('0xaa')]){if(_0x35edf7[_0x7f41('0x14')]===_0x7f41('0x1f')){_0x41fae6[_0x7f41('0xab')]=[{'model':_0x329a6a[_0x7f41('0x6e')],'as':_0x7f41('0xb5'),'attributes':['id',_0x7f41('0xc'),_0x7f41('0xb6')],'required':_0x3d7a77[_0x7f41('0x88')][_0x7f41('0xb7')]?!![]:![]},{'model':_0x329a6a[_0x7f41('0x6e')],'as':_0x7f41('0xb8'),'attributes':['id',_0x7f41('0xc'),_0x7f41('0xb6')],'through':_0x3d7a77[_0x7f41('0x88')][_0x7f41('0xb7')]?{'attributes':[],'where':{'TagId':_0x3d7a77['query'][_0x7f41('0xb7')]||undefined}}:{},'required':_0x3d7a77[_0x7f41('0x88')][_0x7f41('0xb7')]?!![]:![]}];}else{_0x41fae6[_0x7f41('0xab')]=[{'all':!![]}];}}return _0x329a6a[_0x35edf7[_0x7f41('0x14')]][_0x7f41('0x5')](_0x41fae6);})['then'](function(_0x512c67){_0x15f4e5[_0x7f41('0xb1')]=_0x512c67;if(_0x5a8c9e===_0x7f41('0x33')&&_0x3d7a77[_0x7f41('0x88')][_0x7f41('0xb9')]===_0x7f41('0xba')){var _0x4e3b3b=[];for(var _0x4033e5=0x0;_0x4033e5<_0x15f4e5[_0x7f41('0xb1')][_0x7f41('0x96')];_0x4033e5++){_0x4e3b3b[_0x7f41('0x98')](_0xa27d59(_0x7f41('0xbb'),_0x15f4e5[_0x7f41('0xb1')][_0x4033e5][_0x7f41('0xbc')]));_0x4e3b3b[_0x7f41('0x98')](_0xa27d59(_0x7f41('0xbd'),_0x15f4e5[_0x7f41('0xb1')][_0x4033e5]['dataValues']));_0x4e3b3b[_0x7f41('0x98')](_0xa27d59(_0x7f41('0xbe'),_0x15f4e5['rows'][_0x4033e5][_0x7f41('0xbc')]));_0x4e3b3b[_0x7f41('0x98')](_0xa27d59(_0x7f41('0xbf'),_0x15f4e5[_0x7f41('0xb1')][_0x4033e5][_0x7f41('0xbc')]));_0x4e3b3b[_0x7f41('0x98')](_0xa27d59(_0x7f41('0xc0'),_0x15f4e5[_0x7f41('0xb1')][_0x4033e5][_0x7f41('0xbc')]));_0x4e3b3b['push'](_0xa27d59(_0x7f41('0xc1'),_0x15f4e5[_0x7f41('0xb1')][_0x4033e5][_0x7f41('0xbc')]));}return Promise[_0x7f41('0x94')](_0x4e3b3b)[_0x7f41('0x6')](function(){return _0x15f4e5;});}return _0x15f4e5;});}});}}});}; \ No newline at end of file +var _0x9169=['voicequeues','users','telephones','Users','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','select','ui.','InteractionId','from','user_has_','_interactions','ui.UserId\x20=\x20?','query','toString','OpenTabs','UserProfile','user_profiles','../../components/parsers/qs','raw','section','Invalid\x20section\x20\x27','length','push','UserProfileSection','find','params','all','isEmpty','union','ignore','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','sort','pick','where','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','CustomReports','rows','ids','customSorting','order','extraQueryConditions','Tags','color','tag','ThroughTags','true','dataValues','sms','mail','openchannel','whatsapp','./userProfile.attributes','filter','value','findAll','map','catch','field','model','name','resolve','UserProfileResource','then','associatedResources','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','parentSections','SquareProjects','projects','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxAccount','inboundroutes','internalroutes','contexts','VoiceContext','voicemails','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams'];(function(_0x18ca32,_0x136bd4){var _0x23761a=function(_0x409e09){while(--_0x409e09){_0x18ca32['push'](_0x18ca32['shift']());}};_0x23761a(++_0x136bd4);}(_0x9169,0x12d));var _0x9916=function(_0x4550e3,_0x1148a5){_0x4550e3=_0x4550e3-0x0;var _0x1809f0=_0x9169[_0x4550e3];return _0x1809f0;};'use strict';var _=require('lodash');var attributes=require(_0x9916('0x0'));var squel=require('squel');module['exports']=function(_0x555625){var _0x3a0c0d=_0x555625['models'];function _0x220552(_0x3a9975,_0x3ab0ab){return new Promise(function(_0x15033c,_0x1b679f){if(!_0x3ab0ab)return _0x15033c(null);var _0x48f937=_0x3ab0ab[_0x9916('0x1')]?{[_0x3ab0ab[_0x9916('0x1')]['field']]:_0x3ab0ab[_0x9916('0x1')][_0x9916('0x2')]}:undefined;return _0x3a0c0d[_0x3a9975][_0x9916('0x3')]({'where':_0x48f937,'raw':!![]})['then'](function(_0x489879){_0x3ab0ab['associatedResources']=_[_0x9916('0x4')](_0x489879,'id');_0x15033c(_0x3ab0ab);})[_0x9916('0x5')](function(_0x4d76bc){_0x1b679f(_0x4d76bc);});});}function _0x24916c(_0x2416fa,_0x30e2e8){return new Promise(function(_0x3de9e4,_0x46f423){var _0x16d5fb=_0x2416fa[_0x9916('0x1')]?{[_0x2416fa[_0x9916('0x1')][_0x9916('0x6')]]:_0x2416fa[_0x9916('0x1')][_0x9916('0x2')]}:undefined;return _0x3a0c0d[_0x2416fa[_0x9916('0x7')]][_0x9916('0x3')]({'where':_0x16d5fb,'raw':!![]})['then'](function(_0x5c112f){_0x30e2e8['associatedResources']=_[_0x9916('0x4')](_0x5c112f,function(_0x420353){return _0x420353[_0x9916('0x8')];});_0x3de9e4(_0x30e2e8);})['catch'](function(_0x531468){_0x46f423(_0x531468);});});}function _0xaf4527(_0xe21fb0,_0x1e38bb,_0x2d2938){if(!_0x1e38bb)return Promise[_0x9916('0x9')](null);return new Promise(function(_0x1745a9,_0x1fdf53){return _0x3a0c0d[_0x9916('0xa')][_0x9916('0x3')]({'where':{'sectionId':_0x1e38bb['id']},'raw':!![]})[_0x9916('0xb')](function(_0xec1e0a){if(_0xe21fb0[_0x9916('0x6')]&&_0xe21fb0[_0x9916('0x6')]!=='id'){_0x1e38bb[_0x9916('0xc')]=_[_0x9916('0x4')](_0xec1e0a,function(_0x1e4ded){return _0x1e4ded[_0xe21fb0[_0x9916('0x6')]];});}else{if(_0x2d2938===_0x9916('0xd')){_0x1e38bb['associatedResources']=_[_0x9916('0x4')](_0xec1e0a,function(_0x4aa99c){return{'id':_0x4aa99c[_0x9916('0xe')],'type':_0x4aa99c[_0x9916('0xf')]};});}else{_0x1e38bb['associatedResources']=_[_0x9916('0x4')](_0xec1e0a,function(_0x8b251e){return _0x8b251e[_0x9916('0xe')];});}}_0x1745a9(_0x1e38bb);})[_0x9916('0x5')](function(_0x16bf3f){_0x1fdf53(_0x16bf3f);});});}function _0x3511ce(_0x3da638,_0x52bec6){var _0x2598bf={'parentSections':[]};switch(_0x3da638[_0x9916('0x10')]()){case _0x9916('0x11'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x13');break;case _0x9916('0x14'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x15');break;case _0x9916('0x16'):_0x2598bf['childModel']='SquareRecording';_0x2598bf[_0x9916('0x17')]=[{'name':_0x9916('0x18'),'field':_0x9916('0x8'),'foreignKey':'projectName'}];break;case _0x9916('0x19'):_0x2598bf[_0x9916('0x12')]='JscriptyProject';break;case _0x9916('0x1a'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x1b');_0x2598bf['parentSections']=[{'name':_0x9916('0x1c'),'field':'id','foreignKey':_0x9916('0x1d')}];break;case _0x9916('0x1e'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x1f');break;case _0x9916('0x20'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x21');break;case _0x9916('0x22'):_0x2598bf[_0x9916('0x12')]='CmCustomField';break;case _0x9916('0x23'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x24');break;case _0x9916('0x25'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x26');break;case _0x9916('0x27'):_0x2598bf[_0x9916('0x12')]='FaxQueue';break;case'faxaccounts':_0x2598bf[_0x9916('0x12')]=_0x9916('0x28');break;case _0x9916('0x29'):case _0x9916('0x2a'):case'outboundroutes':_0x2598bf[_0x9916('0x12')]='VoiceExtension';break;case _0x9916('0x2b'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x2c');break;case _0x9916('0x2d'):_0x2598bf[_0x9916('0x12')]='VoiceMail';break;case'voicerecordings':_0x2598bf[_0x9916('0x12')]=_0x9916('0x2e');_0x2598bf[_0x9916('0x17')]=[{'name':_0x9916('0x2f'),'field':_0x9916('0x8'),'foreignKey':_0x9916('0x30'),'model':_0x9916('0x31'),'filter':{'field':_0x9916('0x32'),'value':[_0x9916('0x33')]}},{'name':_0x9916('0x34'),'field':_0x9916('0x8'),'foreignKey':_0x9916('0x30'),'model':_0x9916('0x31'),'filter':{'field':'role','value':[_0x9916('0x35')]}},{'name':_0x9916('0x36'),'field':'name','foreignKey':_0x9916('0x37'),'model':_0x9916('0x38'),'filter':{'field':_0x9916('0xf'),'value':[_0x9916('0x39')]}},{'name':_0x9916('0x3a'),'field':_0x9916('0x8'),'foreignKey':_0x9916('0x37'),'model':'VoiceQueue','filter':{'field':'type','value':[_0x9916('0x3b')]}}];break;case _0x9916('0x3c'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x3d');break;case _0x9916('0x3e'):_0x2598bf['childModel']=_0x9916('0x3f');break;case _0x9916('0x40'):_0x2598bf[_0x9916('0x12')]='VoicePrefix';break;case _0x9916('0x41'):_0x2598bf[_0x9916('0x12')]='Campaign';break;case _0x9916('0x42'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x43');break;case _0x9916('0x44'):_0x2598bf['childModel']=_0x9916('0x45');break;case'mailsubstatuses':_0x2598bf[_0x9916('0x12')]=_0x9916('0x46');break;case _0x9916('0x47'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x48');break;case _0x9916('0x49'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x4a');break;case _0x9916('0x4b'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x4c');break;case _0x9916('0x4d'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x4e');break;case _0x9916('0x4f'):_0x2598bf['childModel']='WhatsappQueue';break;case _0x9916('0x50'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x51');break;case _0x9916('0x52'):_0x2598bf[_0x9916('0x12')]='Team';break;case _0x9916('0x53'):case'queuecampaigns':_0x2598bf[_0x9916('0x12')]=_0x9916('0x38');if(_0x52bec6){_0x2598bf['parentSections']=[{'name':_0x9916('0x36')},{'name':_0x9916('0x3a')}];}break;case _0x9916('0x54'):case'agents':case _0x9916('0x55'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x31');if(_0x52bec6){_0x2598bf['parentSections']=[{'name':_0x9916('0x56'),'filter':{'field':_0x9916('0x32'),'value':['admin','user']},'ignore':!![]},{'name':_0x9916('0x2f')},{'name':'Telephones'}];}break;case _0x9916('0x57'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x58');break;case _0x9916('0x59'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x5a');break;case'freshdeskaccounts':_0x2598bf['childModel']=_0x9916('0x5b');break;case _0x9916('0x5c'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x5d');break;case'deskaccounts':_0x2598bf[_0x9916('0x12')]=_0x9916('0x5e');break;case _0x9916('0x5f'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x60');break;case'vtigeraccounts':_0x2598bf[_0x9916('0x12')]='User';break;case'cannedanswers':_0x2598bf[_0x9916('0x12')]=_0x9916('0x61');break;case'dispositions':_0x2598bf[_0x9916('0x12')]=_0x9916('0x62');break;case _0x9916('0x63'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x64');break;case _0x9916('0x65'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x66');break;case _0x9916('0x67'):_0x2598bf[_0x9916('0x12')]='Pause';break;case'scheduler':_0x2598bf[_0x9916('0x12')]='Schedule';break;case'sounds':_0x2598bf['childModel']=_0x9916('0x68');break;case _0x9916('0x69'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x6a');break;case _0x9916('0x6b'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x6c');break;case _0x9916('0x6d'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x6e');break;case _0x9916('0x6f'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x70');break;case _0x9916('0x71'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x72');break;case'plugins':_0x2598bf[_0x9916('0x12')]=_0x9916('0x73');break;case _0x9916('0x74'):_0x2598bf[_0x9916('0x12')]=_0x9916('0xd');_0x2598bf['parentSections']=[{'name':_0x9916('0x75'),'field':'id','foreignKey':_0x9916('0x76')}];break;case _0x9916('0x77'):_0x2598bf[_0x9916('0x12')]=_0x9916('0x78');break;}return _0x2598bf;}function _0x5adf6f(_0x46766a,_0x356183){var _0x586cb0=_0x46766a[_0x9916('0x79')](0x0)[_0x9916('0x7a')]()+_0x46766a[_0x9916('0x7b')](0x1);var _0x195854={'type':_0x3a0c0d[_0x9916('0x7c')][_0x9916('0x7d')]['SELECT'],'raw':!![]};return new Promise(function(_0x3e658a,_0x4d045c){var _0x1963cf=squel[_0x9916('0x7e')]()[_0x9916('0x6')](_0x9916('0x7f')+_0x586cb0+_0x9916('0x80'),'id')[_0x9916('0x6')]('ui.createdAt')[_0x9916('0x81')](_0x9916('0x82')+_0x46766a+_0x9916('0x83'),'ui')['where'](_0x9916('0x84'),_0x356183['id']);return _0x3a0c0d['sequelize'][_0x9916('0x85')](_0x1963cf[_0x9916('0x86')](),_0x195854)[_0x9916('0xb')](function(_0x1a4414){_0x356183[_0x586cb0+_0x9916('0x87')]=_0x1a4414;_0x3e658a(_0x1a4414);})[_0x9916('0x5')](function(_0x49af21){_0x4d045c(_0x49af21);});});}return _0x555625['define'](_0x9916('0x88'),attributes,{'tableName':_0x9916('0x89'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xe46f9d){var _0x4a02ee=require(_0x9916('0x8a'));var _0x2f9c94={'raw':_0xe46f9d[_0x9916('0x85')][_0x9916('0x8b')],'where':{}};var _0x56091f={};var _0x28436f={'count':0x0,'rows':[]};var _0x46f015=_0xe46f9d['query'][_0x9916('0x8c')];var _0x45e8c9=_0xe46f9d[_0x9916('0x85')]['mergeResources']||![];var _0x5d5034=_0x3511ce(_0x46f015,_0x45e8c9);if(!_0x5d5034[_0x9916('0x12')])throw new Error(_0x9916('0x8d')+_0x46f015+'\x27');var _0x472ced=[{'name':_0x46f015}];if(!_['isEmpty'](_0x5d5034['parentSections']))_0x472ced=_0x5d5034[_0x9916('0x17')];var _0x2cf9c5=[];for(var _0x11597a=0x0;_0x11597a<_0x472ced[_0x9916('0x8e')];_0x11597a++){_0x2cf9c5[_0x9916('0x8f')](_0x3a0c0d[_0x9916('0x90')][_0x9916('0x91')]({'where':{'userProfileId':_0xe46f9d[_0x9916('0x92')]['id'],'name':_0x472ced[_0x11597a][_0x9916('0x8')]},'raw':!![]}));}return Promise[_0x9916('0x93')](_0x2cf9c5)[_0x9916('0xb')](function(_0x34bd42){var _0xee146d=_[_0x9916('0x1')](_0x34bd42,function(_0x473940){return _0x473940?_0x473940:undefined;});var _0x59a507=_[_0x9916('0x1')](_0x472ced,['ignore',!![]]);var _0x46e03e=_['isEmpty'](_0xee146d)&&_[_0x9916('0x94')](_0x59a507)?null:_[_0x9916('0x95')](_0x59a507,_0xee146d);if(!_0x46e03e)return null;var _0xc9dba7=[];for(var _0x2310d9=0x0;_0x2310d9<_0x46e03e[_0x9916('0x8e')];_0x2310d9++){var _0x169d81=_['find'](_0x472ced,function(_0x1d5644){return _0x46e03e[_0x2310d9]?_0x1d5644[_0x9916('0x8')]===_0x46e03e[_0x2310d9][_0x9916('0x8')]:null;});if(_0x169d81){if(_0x46e03e[_0x2310d9][_0x9916('0x96')]){_0xc9dba7['push'](_0x220552(_0x5d5034[_0x9916('0x12')],_0x46e03e[_0x2310d9]));}else{if(!_0x46e03e[_0x2310d9][_0x9916('0x97')]){_0xc9dba7[_0x9916('0x8f')](_0xaf4527(_0x169d81,_0x46e03e[_0x2310d9],_0x5d5034[_0x9916('0x12')]));}else{if(_0x169d81[_0x9916('0x7')]){_0xc9dba7[_0x9916('0x8f')](_0x24916c(_0x169d81,_0x46e03e[_0x2310d9]));}}}}}return Promise['all'](_0xc9dba7);})[_0x9916('0xb')](function(_0x1920b1){var _0x4eef57=_0x1920b1;var _0x47a513=null;if(_0x4eef57){_0x47a513=_0x4eef57[_0x9916('0x8e')]===0x1?_0x4eef57[0x0]:null;}if(!_0x47a513&&!_0x4eef57)return _0x28436f;var _0xc81f58=_0x3a0c0d[_0x5d5034['childModel']][_0x9916('0x98')];_0x56091f[_0x9916('0x7')]=_[_0x9916('0x99')](_0xc81f58);_0x56091f['query']=_[_0x9916('0x99')](_0xe46f9d[_0x9916('0x85')]);_0x56091f[_0x9916('0x9a')]=_[_0x9916('0x9b')](_0x56091f['model'],_0x56091f[_0x9916('0x85')]);_0x2f9c94[_0x9916('0x9c')]=_[_0x9916('0x9b')](_0x56091f[_0x9916('0x7')],_0x4a02ee[_0x9916('0x9d')](_0xe46f9d[_0x9916('0x85')]['fields']));_0x2f9c94[_0x9916('0x9c')]=_0x2f9c94['attributes'][_0x9916('0x8e')]?_0x2f9c94[_0x9916('0x9c')]:_0x56091f['model'];if(!_0xe46f9d[_0x9916('0x85')][_0x9916('0x9e')](_0x9916('0x9f'))){_0x2f9c94[_0x9916('0xa0')]=_0x4a02ee[_0x9916('0xa0')](_0xe46f9d[_0x9916('0x85')][_0x9916('0xa0')]);_0x2f9c94['offset']=_0x4a02ee[_0x9916('0xa1')](_0xe46f9d[_0x9916('0x85')][_0x9916('0xa1')]);}_0x2f9c94['order']=_0x4a02ee[_0x9916('0xa2')](_0xe46f9d[_0x9916('0x85')][_0x9916('0xa2')]);_0x2f9c94['where']=_0x4a02ee[_0x9916('0x9a')](_[_0x9916('0xa3')](_0xe46f9d[_0x9916('0x85')],_0x56091f[_0x9916('0x9a')]));if(_0xe46f9d[_0x9916('0x85')][_0x9916('0x1')]){_0x2f9c94[_0x9916('0xa4')]=_[_0x9916('0xa5')](_0x2f9c94[_0x9916('0xa4')],{'$or':_[_0x9916('0x4')](_0xc81f58,function(_0x514415){if(_0x514415[_0x9916('0xf')][_0x9916('0xa6')]!==_0x9916('0xa7')){var _0x499a61={};_0x499a61[_0x514415[_0x9916('0x6')]]={'$like':'%'+_0xe46f9d[_0x9916('0x85')]['filter']+'%'};return _0x499a61;}})});}var _0x4298f6=[];var _0x5e7d52=null;var _0x45f171={};if(_0x47a513){_0x5e7d52=_[_0x9916('0x91')](_0x472ced,[_0x9916('0x8'),_0x47a513[_0x9916('0x8')]]);if(_0x5e7d52[_0x9916('0x6')]){_0x45f171={};if(_0x5d5034[_0x9916('0x12')]===_0x9916('0xd')){_0x45f171[_0x5e7d52['foreignKey']]=_[_0x9916('0x4')](_0x47a513['associatedResources'],'id');}else{_0x45f171[_0x5e7d52[_0x9916('0xa8')]]=_0x47a513[_0x9916('0xc')];}_0x4298f6[_0x9916('0x8f')](_0x45f171);}else{_0x2f9c94[_0x9916('0xa4')]['id']=_0x47a513[_0x9916('0xc')];}}else{for(var _0x184de4=0x0;_0x184de4<_0x4eef57['length'];_0x184de4++){_0x5e7d52=_[_0x9916('0x91')](_0x472ced,['name',_0x4eef57[_0x184de4][_0x9916('0x8')]]);if(_0x5e7d52[_0x9916('0x6')]){_0x45f171={};_0x45f171[_0x5e7d52[_0x9916('0xa8')]]=_0x4eef57[_0x184de4][_0x9916('0xc')];_0x4298f6[_0x9916('0x8f')](_0x45f171);}else{if(!_0x2f9c94['where']['id'])_0x2f9c94[_0x9916('0xa4')]['id']=[];_0x4eef57[_0x184de4][_0x9916('0xc')][_0x9916('0xa9')](function(_0x46732a){_0x2f9c94[_0x9916('0xa4')]['id'][_0x9916('0x8f')](_0x46732a);});}}}if(!_['isEmpty'](_0x4298f6)){_0x2f9c94[_0x9916('0xa4')]=_[_0x9916('0xa5')](_0x2f9c94[_0x9916('0xa4')],{'$and':{'$or':_0x4298f6}});}_0x2f9c94=_[_0x9916('0xa5')]({},_0x2f9c94,_0xe46f9d[_0x9916('0xaa')]);if(_0x47a513&&!_0x47a513[_0x9916('0x97')]&&_0x5d5034[_0x9916('0x12')]==='AnalyticExtractedReport'){if(_0xe46f9d[_0x9916('0x85')][_0x9916('0xab')]){_0x2f9c94[_0x9916('0xac')]=[{'all':!![]}];}return _0x3a0c0d[_0x5d5034[_0x9916('0x12')]][_0x9916('0x3')](_0x2f9c94)[_0x9916('0xb')](function(_0x43a9c2){var _0x4ad73e=[];_0x43a9c2[_0x9916('0xa9')](function(_0x482653){var _0x42958f;switch(_0x482653[_0x9916('0xad')]){case _0x9916('0xae'):_0x42958f=_['find'](_0x47a513[_0x9916('0xc')],function(_0x2c6487){return _0x2c6487['id']===_0x482653[_0x9916('0x76')]&&_0x2c6487[_0x9916('0xf')]===_0x9916('0xaf');});break;case'custom':_0x42958f=_['find'](_0x47a513['associatedResources'],function(_0x5417cc){return _0x5417cc['id']===_0x482653[_0x9916('0x76')]&&_0x5417cc[_0x9916('0xf')]===_0x9916('0xb0');});break;}if(_0x42958f)_0x4ad73e[_0x9916('0x8f')](_0x482653);});_0x28436f['count']=_0x4ad73e[_0x9916('0x8e')];_0x28436f[_0x9916('0xb1')]=_0x4ad73e;return _0x28436f;});}else{if(!_[_0x9916('0x94')](_0xe46f9d['query'][_0x9916('0xb2')])){_0x2f9c94[_0x9916('0xa4')]['id']=_0x2f9c94[_0x9916('0xa4')]['id']?_['intersection'](_0x2f9c94[_0x9916('0xa4')]['id'],_0xe46f9d[_0x9916('0x85')][_0x9916('0xb2')]):_0xe46f9d['query']['ids'];if(_0xe46f9d[_0x9916('0x85')][_0x9916('0xb3')]){_0x2f9c94[_0x9916('0xb4')]=_0xe46f9d[_0x9916('0x85')][_0x9916('0xb3')];}}if(_0xe46f9d['query'][_0x9916('0xb5')]){_0x2f9c94[_0x9916('0xa4')]=_[_0x9916('0xa5')](_0x2f9c94['where'],{'$and':_0xe46f9d['query']['extraQueryConditions']});}return _0x3a0c0d[_0x5d5034['childModel']]['count']({'where':_0x2f9c94[_0x9916('0xa4')]})['then'](function(_0x28eb77){_0x28436f['count']=_0x28eb77;if(_0xe46f9d[_0x9916('0x85')][_0x9916('0xab')]){if(_0x5d5034['childModel']===_0x9916('0x1b')){_0x2f9c94[_0x9916('0xac')]=[{'model':_0x3a0c0d['Tag'],'as':_0x9916('0xb6'),'attributes':['id',_0x9916('0x8'),_0x9916('0xb7')],'required':_0xe46f9d[_0x9916('0x85')][_0x9916('0xb8')]?!![]:![]},{'model':_0x3a0c0d[_0x9916('0x6a')],'as':_0x9916('0xb9'),'attributes':['id','name',_0x9916('0xb7')],'through':_0xe46f9d[_0x9916('0x85')][_0x9916('0xb8')]?{'attributes':[],'where':{'TagId':_0xe46f9d[_0x9916('0x85')][_0x9916('0xb8')]||undefined}}:{},'required':_0xe46f9d['query'][_0x9916('0xb8')]?!![]:![]}];}else{_0x2f9c94[_0x9916('0xac')]=[{'all':!![]}];}}return _0x3a0c0d[_0x5d5034['childModel']][_0x9916('0x3')](_0x2f9c94);})[_0x9916('0xb')](function(_0x17ce51){_0x28436f[_0x9916('0xb1')]=_0x17ce51;if(_0x46f015===_0x9916('0x2f')&&_0xe46f9d[_0x9916('0x85')]['openTabs']===_0x9916('0xba')){var _0x3d8180=[];for(var _0x5f2dc0=0x0;_0x5f2dc0<_0x28436f[_0x9916('0xb1')]['length'];_0x5f2dc0++){_0x3d8180[_0x9916('0x8f')](_0x5adf6f('chat',_0x28436f[_0x9916('0xb1')][_0x5f2dc0][_0x9916('0xbb')]));_0x3d8180['push'](_0x5adf6f(_0x9916('0xbc'),_0x28436f[_0x9916('0xb1')][_0x5f2dc0]['dataValues']));_0x3d8180['push'](_0x5adf6f('fax',_0x28436f[_0x9916('0xb1')][_0x5f2dc0][_0x9916('0xbb')]));_0x3d8180[_0x9916('0x8f')](_0x5adf6f(_0x9916('0xbd'),_0x28436f[_0x9916('0xb1')][_0x5f2dc0][_0x9916('0xbb')]));_0x3d8180[_0x9916('0x8f')](_0x5adf6f(_0x9916('0xbe'),_0x28436f[_0x9916('0xb1')][_0x5f2dc0][_0x9916('0xbb')]));_0x3d8180['push'](_0x5adf6f(_0x9916('0xbf'),_0x28436f['rows'][_0x5f2dc0][_0x9916('0xbb')]));}return Promise[_0x9916('0x93')](_0x3d8180)[_0x9916('0xb')](function(){return _0x28436f;});}return _0x28436f;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 5d9987f..63c04ea 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 _0xf0f4=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','randomstring','ioredis','../../config/utils'];(function(_0x908d2e,_0x1e52b7){var _0x2be763=function(_0x59d4a3){while(--_0x59d4a3){_0x908d2e['push'](_0x908d2e['shift']());}};_0x2be763(++_0x1e52b7);}(_0xf0f4,0x182));var _0x4f0f=function(_0x4acbed,_0x2c0822){_0x4acbed=_0x4acbed-0x0;var _0x398861=_0xf0f4[_0x4acbed];return _0x398861;};'use strict';var _=require('lodash');var util=require(_0x4f0f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4f0f('0x1'));var fs=require('fs');var Redis=require(_0x4f0f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f0f('0x3'));var logger=require(_0x4f0f('0x4'))(_0x4f0f('0x5'));var config=require(_0x4f0f('0x6'));var jayson=require(_0x4f0f('0x7'));var client=jayson[_0x4f0f('0x8')][_0x4f0f('0x9')]({'port':0x232a});config['redis']=_[_0x4f0f('0xa')](config[_0x4f0f('0xb')],{'host':_0x4f0f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f0f('0xb')]));require(_0x4f0f('0xd'))[_0x4f0f('0xe')](socket);function respondWithRpcPromise(_0x3754fc,_0x343c30,_0xb41508){return new BPromise(function(_0x9533a3,_0x2b2e49){return client['request'](_0x3754fc,_0xb41508)[_0x4f0f('0xf')](function(_0x315d01){logger[_0x4f0f('0x10')](_0x4f0f('0x11'),_0x343c30,_0x4f0f('0x12'));logger[_0x4f0f('0x13')](_0x4f0f('0x14'),_0x343c30,_0x4f0f('0x12'),JSON[_0x4f0f('0x15')](_0x315d01));if(_0x315d01[_0x4f0f('0x16')]){if(_0x315d01[_0x4f0f('0x16')]['code']===0x1f4){logger[_0x4f0f('0x16')](_0x4f0f('0x11'),_0x343c30,_0x315d01[_0x4f0f('0x16')][_0x4f0f('0x17')]);return _0x2b2e49(_0x315d01['error'][_0x4f0f('0x17')]);}logger[_0x4f0f('0x16')](_0x4f0f('0x11'),_0x343c30,_0x315d01[_0x4f0f('0x16')][_0x4f0f('0x17')]);return _0x9533a3(_0x315d01['error'][_0x4f0f('0x17')]);}else{logger[_0x4f0f('0x10')](_0x4f0f('0x11'),_0x343c30,'request\x20sent');_0x9533a3(_0x315d01[_0x4f0f('0x18')][_0x4f0f('0x17')]);}})[_0x4f0f('0x19')](function(_0x5f5363){logger[_0x4f0f('0x16')](_0x4f0f('0x11'),_0x343c30,_0x5f5363);_0x2b2e49(_0x5f5363);});});} \ No newline at end of file +var _0x7ebb=['error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4f66ef,_0x3d47ef){var _0x34c6ec=function(_0x449aaf){while(--_0x449aaf){_0x4f66ef['push'](_0x4f66ef['shift']());}};_0x34c6ec(++_0x3d47ef);}(_0x7ebb,0x161));var _0xb7eb=function(_0x5df061,_0x400a05){_0x5df061=_0x5df061-0x0;var _0x5a4ef6=_0x7ebb[_0x5df061];return _0x5a4ef6;};'use strict';var _=require(_0xb7eb('0x0'));var util=require(_0xb7eb('0x1'));var moment=require(_0xb7eb('0x2'));var BPromise=require(_0xb7eb('0x3'));var rs=require(_0xb7eb('0x4'));var fs=require('fs');var Redis=require(_0xb7eb('0x5'));var db=require(_0xb7eb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb7eb('0x7'))(_0xb7eb('0x8'));var config=require(_0xb7eb('0x9'));var jayson=require(_0xb7eb('0xa'));var client=jayson[_0xb7eb('0xb')][_0xb7eb('0xc')]({'port':0x232a});config[_0xb7eb('0xd')]=_[_0xb7eb('0xe')](config[_0xb7eb('0xd')],{'host':_0xb7eb('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb7eb('0x10'))[_0xb7eb('0x11')](socket);function respondWithRpcPromise(_0x24b00f,_0xa9e44,_0x47d0d4){return new BPromise(function(_0x2b0e89,_0x34d935){return client['request'](_0x24b00f,_0x47d0d4)[_0xb7eb('0x12')](function(_0x76ab82){logger[_0xb7eb('0x13')](_0xb7eb('0x14'),_0xa9e44,_0xb7eb('0x15'));logger[_0xb7eb('0x16')](_0xb7eb('0x17'),_0xa9e44,'request\x20sent',JSON[_0xb7eb('0x18')](_0x76ab82));if(_0x76ab82[_0xb7eb('0x19')]){if(_0x76ab82[_0xb7eb('0x19')]['code']===0x1f4){logger[_0xb7eb('0x19')](_0xb7eb('0x14'),_0xa9e44,_0x76ab82[_0xb7eb('0x19')][_0xb7eb('0x1a')]);return _0x34d935(_0x76ab82['error'][_0xb7eb('0x1a')]);}logger['error'](_0xb7eb('0x14'),_0xa9e44,_0x76ab82[_0xb7eb('0x19')][_0xb7eb('0x1a')]);return _0x2b0e89(_0x76ab82['error'][_0xb7eb('0x1a')]);}else{logger[_0xb7eb('0x13')](_0xb7eb('0x14'),_0xa9e44,_0xb7eb('0x15'));_0x2b0e89(_0x76ab82['result'][_0xb7eb('0x1a')]);}})['catch'](function(_0x22dc77){logger[_0xb7eb('0x19')]('UserProfile,\x20%s,\x20%s',_0xa9e44,_0x22dc77);_0x34d935(_0x22dc77);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index cbc16dd..4e9ef76 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 _0xf15f=['register','length','./userProfile.events','save','remove','update','emit'];(function(_0x571c1d,_0x3b0586){var _0x33c609=function(_0x226499){while(--_0x226499){_0x571c1d['push'](_0x571c1d['shift']());}};_0x33c609(++_0x3b0586);}(_0xf15f,0x18a));var _0xff15=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xf15f[_0x45d3f0];return _0x314b79;};'use strict';var UserProfileEvents=require(_0xff15('0x0'));var events=[_0xff15('0x1'),_0xff15('0x2'),_0xff15('0x3')];function createListener(_0x595eac,_0x19e62b){return function(_0x537278){_0x19e62b[_0xff15('0x4')](_0x595eac,_0x537278);};}function removeListener(_0x594063,_0xe2678f){return function(){UserProfileEvents['removeListener'](_0x594063,_0xe2678f);};}exports[_0xff15('0x5')]=function(_0x3ecaa6){for(var _0x5e6b91=0x0,_0x2ec6b1=events[_0xff15('0x6')];_0x5e6b91<_0x2ec6b1;_0x5e6b91++){var _0x533d2a=events[_0x5e6b91];var _0x321348=createListener('userProfile:'+_0x533d2a,_0x3ecaa6);UserProfileEvents['on'](_0x533d2a,_0x321348);}}; \ No newline at end of file +var _0x5ca6=['save','remove','update','removeListener','length','userProfile:'];(function(_0x27a3ca,_0x19fad1){var _0xa88821=function(_0x5df8b5){while(--_0x5df8b5){_0x27a3ca['push'](_0x27a3ca['shift']());}};_0xa88821(++_0x19fad1);}(_0x5ca6,0x84));var _0x65ca=function(_0x41382c,_0xc3ffd1){_0x41382c=_0x41382c-0x0;var _0x4da35b=_0x5ca6[_0x41382c];return _0x4da35b;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x65ca('0x0'),_0x65ca('0x1'),_0x65ca('0x2')];function createListener(_0x72e413,_0xdfd3ad){return function(_0x4c2ee3){_0xdfd3ad['emit'](_0x72e413,_0x4c2ee3);};}function removeListener(_0x5dc243,_0x471c3a){return function(){UserProfileEvents[_0x65ca('0x3')](_0x5dc243,_0x471c3a);};}exports['register']=function(_0x361168){for(var _0x4e6ae1=0x0,_0x49c061=events[_0x65ca('0x4')];_0x4e6ae1<_0x49c061;_0x4e6ae1++){var _0x5738a2=events[_0x4e6ae1];var _0x56a06a=createListener(_0x65ca('0x5')+_0x5738a2,_0x361168);UserProfileEvents['on'](_0x5738a2,_0x56a06a);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index fd826fb..9d9e041 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 _0xbe27=['../../components/auth/service','../../components/interaction/service','get','index','/describe','describe','isAuthenticated','show','post','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x127155,_0x25c0be){var _0x1aac6a=function(_0x352c31){while(--_0x352c31){_0x127155['push'](_0x127155['shift']());}};_0x1aac6a(++_0x25c0be);}(_0xbe27,0xa2));var _0x7be2=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbe27[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7be2('0x0'));var util=require(_0x7be2('0x1'));var path=require('path');var timeout=require(_0x7be2('0x2'));var express=require(_0x7be2('0x3'));var router=express[_0x7be2('0x4')]();var fs_extra=require(_0x7be2('0x5'));var auth=require(_0x7be2('0x6'));var interaction=require(_0x7be2('0x7'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0x7be2('0x8')]('/',auth['isAuthenticated'](),controller[_0x7be2('0x9')]);router[_0x7be2('0x8')](_0x7be2('0xa'),auth['isAuthenticated'](),controller[_0x7be2('0xb')]);router[_0x7be2('0x8')]('/:id',auth[_0x7be2('0xc')](),controller[_0x7be2('0xd')]);router[_0x7be2('0xe')]('/',auth['isAuthenticated'](),controller[_0x7be2('0xf')]);router[_0x7be2('0x10')](_0x7be2('0x11'),auth['isAuthenticated'](),controller[_0x7be2('0x12')]);router[_0x7be2('0x13')](_0x7be2('0x11'),auth[_0x7be2('0xc')](),controller['destroy']);module[_0x7be2('0x14')]=router; \ No newline at end of file +var _0xfc32=['/describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x1f5143,_0x5e31e6){var _0x383a38=function(_0x2c123c){while(--_0x2c123c){_0x1f5143['push'](_0x1f5143['shift']());}};_0x383a38(++_0x5e31e6);}(_0xfc32,0x1ec));var _0x2fc3=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xfc32[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x2fc3('0x0'));var util=require(_0x2fc3('0x1'));var path=require(_0x2fc3('0x2'));var timeout=require(_0x2fc3('0x3'));var express=require(_0x2fc3('0x4'));var router=express[_0x2fc3('0x5')]();var fs_extra=require(_0x2fc3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2fc3('0x7'));var config=require(_0x2fc3('0x8'));var controller=require('./userProfileResource.controller');router[_0x2fc3('0x9')]('/',auth[_0x2fc3('0xa')](),controller[_0x2fc3('0xb')]);router[_0x2fc3('0x9')](_0x2fc3('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x2fc3('0x9')](_0x2fc3('0xd'),auth[_0x2fc3('0xa')](),controller[_0x2fc3('0xe')]);router[_0x2fc3('0xf')]('/',auth[_0x2fc3('0xa')](),controller[_0x2fc3('0x10')]);router[_0x2fc3('0x11')](_0x2fc3('0xd'),auth[_0x2fc3('0xa')](),controller[_0x2fc3('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2fc3('0x13')]);module[_0x2fc3('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index ff7f8ab..573fc45 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 _0x7d32=['INTEGER','STRING'];(function(_0x331e10,_0x67934){var _0x5b770d=function(_0x1baad1){while(--_0x1baad1){_0x331e10['push'](_0x331e10['shift']());}};_0x5b770d(++_0x67934);}(_0x7d32,0x155));var _0x27d3=function(_0x39fb92,_0x239c1d){_0x39fb92=_0x39fb92-0x0;var _0x5157c7=_0x7d32[_0x39fb92];return _0x5157c7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x27d3('0x0')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x27d3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x27d3('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0xeb51=['sequelize','STRING','INTEGER'];(function(_0x43e4b3,_0x1444de){var _0x10c655=function(_0x56c01d){while(--_0x56c01d){_0x43e4b3['push'](_0x43e4b3['shift']());}};_0x10c655(++_0x1444de);}(_0xeb51,0x1c8));var _0x1eb5=function(_0x1f94fe,_0x3f9d24){_0x1f94fe=_0x1f94fe-0x0;var _0x5b5870=_0xeb51[_0x1f94fe];return _0x5b5870;};'use strict';var Sequelize=require(_0x1eb5('0x0'));module['exports']={'name':{'type':Sequelize[_0x1eb5('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x1eb5('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1eb5('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 694963d..6424d8a 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 _0xc1c6=['filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','UserProfileResource','rawAttributes','type','key','model','query'];(function(_0x41da6d,_0x341211){var _0x4e81c7=function(_0x422549){while(--_0x422549){_0x41da6d['push'](_0x41da6d['shift']());}};_0x4e81c7(++_0x341211);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x2adaf2,_0x511aad){_0x2adaf2=_0x2adaf2-0x0;var _0x4f5ff9=_0xc1c6[_0x2adaf2];return _0x4f5ff9;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['UserProfileResource']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['UserProfileResource'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['UserProfileResource'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['create']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')](_0x1fe6e8[_0x6c1c('0x48')],{})[_0x6c1c('0x25')](respondWithResult(_0x58d075,0xc9))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x52c14d,_0xa9889a){if(_0x52c14d[_0x6c1c('0x48')]['id']){delete _0x52c14d['body']['id'];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'id':_0x52c14d[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0xa9889a,null))['then'](saveUpdates(_0x52c14d[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0xa9889a,null))[_0x6c1c('0x41')](handleError(_0xa9889a,null));};exports['destroy']=function(_0x5b8d69,_0x56b367){return db['UserProfileResource']['find']({'where':{'id':_0x5b8d69[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x56b367,null))['then'](removeEntity(_0x56b367,null))[_0x6c1c('0x41')](handleError(_0x56b367,null));};exports[_0x6c1c('0x49')]=function(_0x2450ab,_0x5489ac){return db['UserProfileResource'][_0x6c1c('0x49')]()[_0x6c1c('0x25')](respondWithResult(_0x5489ac,null))['catch'](handleError(_0x5489ac,null));}; \ No newline at end of file +var _0x2542=['json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x316882,_0x369a8d){var _0x3343c0=function(_0x3bcfd1){while(--_0x3bcfd1){_0x316882['push'](_0x316882['shift']());}};_0x3343c0(++_0x369a8d);}(_0x2542,0x169));var _0x2254=function(_0x59ca2f,_0x185801){_0x59ca2f=_0x59ca2f-0x0;var _0x22c6c1=_0x2542[_0x59ca2f];return _0x22c6c1;};'use strict';var emlformat=require(_0x2254('0x0'));var rimraf=require(_0x2254('0x1'));var zipdir=require(_0x2254('0x2'));var jsonpatch=require(_0x2254('0x3'));var rp=require('request-promise');var moment=require(_0x2254('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2254('0x5'));var util=require(_0x2254('0x6'));var path=require(_0x2254('0x7'));var sox=require(_0x2254('0x8'));var csv=require(_0x2254('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2254('0xa'));var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x9'));var querystring=require(_0x2254('0x10'));var Papa=require(_0x2254('0x11'));var Redis=require(_0x2254('0x12'));var authService=require(_0x2254('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x14'));var hardwareService=require(_0x2254('0x15'));var logger=require(_0x2254('0x16'))(_0x2254('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x18'));var db=require(_0x2254('0x19'))['db'];function respondWithStatusCode(_0x116b70,_0xdcb670){_0xdcb670=_0xdcb670||0xcc;return function(_0x3c326b){if(_0x3c326b){return _0x116b70[_0x2254('0x1a')](_0xdcb670);}return _0x116b70['status'](_0xdcb670)[_0x2254('0x1b')]();};}function respondWithResult(_0x7c7ab0,_0x504749){_0x504749=_0x504749||0xc8;return function(_0x2f4de){if(_0x2f4de){return _0x7c7ab0[_0x2254('0x1c')](_0x504749)[_0x2254('0x1d')](_0x2f4de);}};}function respondWithFilteredResult(_0x145272,_0x26285a){return function(_0xbc5548){if(_0xbc5548){var _0x50f137=typeof _0x26285a[_0x2254('0x1e')]==='undefined'&&typeof _0x26285a[_0x2254('0x1f')]===_0x2254('0x20');var _0x170ffa=_0xbc5548[_0x2254('0x21')];var _0x1ae11e=_0x50f137?0x0:_0x26285a[_0x2254('0x1e')];var _0x497724=_0x50f137?_0xbc5548['count']:_0x26285a['offset']+_0x26285a[_0x2254('0x1f')];var _0x3a79f8;if(_0x497724>=_0x170ffa){_0x497724=_0x170ffa;_0x3a79f8=0xc8;}else{_0x3a79f8=0xce;}_0x145272[_0x2254('0x1c')](_0x3a79f8);return _0x145272[_0x2254('0x22')](_0x2254('0x23'),_0x1ae11e+'-'+_0x497724+'/'+_0x170ffa)[_0x2254('0x1d')](_0xbc5548);}return null;};}function patchUpdates(_0x487f72){return function(_0x28381e){try{jsonpatch[_0x2254('0x24')](_0x28381e,_0x487f72,!![]);}catch(_0x906cde){return BPromise['reject'](_0x906cde);}return _0x28381e['save']();};}function saveUpdates(_0x5bd982,_0x1e8a98){return function(_0x559af4){if(_0x559af4){return _0x559af4[_0x2254('0x25')](_0x5bd982)['then'](function(_0x5713e4){return _0x5713e4;});}return null;};}function removeEntity(_0x4d8faf,_0x540020){return function(_0x5e5edb){if(_0x5e5edb){return _0x5e5edb['destroy']()[_0x2254('0x26')](function(){_0x4d8faf[_0x2254('0x1c')](0xcc)[_0x2254('0x1b')]();});}};}function handleEntityNotFound(_0x265467,_0x13522d){return function(_0x1349c9){if(!_0x1349c9){_0x265467['sendStatus'](0x194);}return _0x1349c9;};}function handleError(_0x4a8274,_0x1ada42){_0x1ada42=_0x1ada42||0x1f4;return function(_0x4f6877){logger[_0x2254('0x27')](_0x4f6877[_0x2254('0x28')]);if(_0x4f6877[_0x2254('0x29')]){delete _0x4f6877[_0x2254('0x29')];}_0x4a8274[_0x2254('0x1c')](_0x1ada42)['send'](_0x4f6877);};}exports[_0x2254('0x2a')]=function(_0x2a789b,_0x21285d){var _0x37af8b={},_0x13366a={},_0x377c41={'count':0x0,'rows':[]};var _0x3214a7=_[_0x2254('0x2b')](db[_0x2254('0x2c')][_0x2254('0x2d')],function(_0x21c641){return{'name':_0x21c641[_0x2254('0x2e')],'type':_0x21c641[_0x2254('0x2f')][_0x2254('0x30')]};});_0x13366a[_0x2254('0x31')]=_[_0x2254('0x2b')](_0x3214a7,_0x2254('0x29'));_0x13366a[_0x2254('0x32')]=_[_0x2254('0x33')](_0x2a789b['query']);_0x13366a[_0x2254('0x34')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],_0x13366a[_0x2254('0x32')]);_0x37af8b[_0x2254('0x36')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],qs[_0x2254('0x37')](_0x2a789b[_0x2254('0x32')]['fields']));_0x37af8b[_0x2254('0x36')]=_0x37af8b[_0x2254('0x36')]['length']?_0x37af8b[_0x2254('0x36')]:_0x13366a[_0x2254('0x31')];if(!_0x2a789b[_0x2254('0x32')][_0x2254('0x38')]('nolimit')){_0x37af8b['limit']=qs[_0x2254('0x1f')](_0x2a789b['query'][_0x2254('0x1f')]);_0x37af8b[_0x2254('0x1e')]=qs[_0x2254('0x1e')](_0x2a789b[_0x2254('0x32')][_0x2254('0x1e')]);}_0x37af8b[_0x2254('0x39')]=qs[_0x2254('0x3a')](_0x2a789b['query'][_0x2254('0x3a')]);_0x37af8b[_0x2254('0x3b')]=qs[_0x2254('0x34')](_[_0x2254('0x3c')](_0x2a789b[_0x2254('0x32')],_0x13366a[_0x2254('0x34')]),_0x3214a7);if(_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]){_0x37af8b[_0x2254('0x3b')]=_[_0x2254('0x3e')](_0x37af8b['where'],{'$or':_[_0x2254('0x2b')](_0x3214a7,function(_0xde3e4a){if(_0xde3e4a[_0x2254('0x2f')]!==_0x2254('0x3f')){var _0x4c7cc3={};_0x4c7cc3[_0xde3e4a[_0x2254('0x29')]]={'$like':'%'+_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]+'%'};return _0x4c7cc3;}})});}_0x37af8b=_[_0x2254('0x3e')]({},_0x37af8b,_0x2a789b[_0x2254('0x40')]);var _0x2602db={'where':_0x37af8b[_0x2254('0x3b')]};return db[_0x2254('0x2c')]['count'](_0x2602db)[_0x2254('0x26')](function(_0x5c15d7){_0x377c41[_0x2254('0x21')]=_0x5c15d7;if(_0x2a789b[_0x2254('0x32')][_0x2254('0x41')]){_0x37af8b[_0x2254('0x42')]=[{'all':!![]}];}return db[_0x2254('0x2c')][_0x2254('0x43')](_0x37af8b);})[_0x2254('0x26')](function(_0x568ec9){_0x377c41[_0x2254('0x44')]=_0x568ec9;return _0x377c41;})[_0x2254('0x26')](respondWithFilteredResult(_0x21285d,_0x37af8b))[_0x2254('0x45')](handleError(_0x21285d,null));};exports[_0x2254('0x46')]=function(_0x40d4da,_0x57cda2){var _0x22bb98={'raw':![],'where':{'id':_0x40d4da[_0x2254('0x47')]['id']}},_0x1dec43={};_0x1dec43[_0x2254('0x31')]=_[_0x2254('0x33')](db['UserProfileResource'][_0x2254('0x2d')]);_0x1dec43['query']=_[_0x2254('0x33')](_0x40d4da[_0x2254('0x32')]);_0x1dec43[_0x2254('0x34')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],_0x1dec43[_0x2254('0x32')]);_0x22bb98[_0x2254('0x36')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],qs[_0x2254('0x37')](_0x40d4da[_0x2254('0x32')][_0x2254('0x37')]));_0x22bb98[_0x2254('0x36')]=_0x22bb98['attributes'][_0x2254('0x48')]?_0x22bb98[_0x2254('0x36')]:_0x1dec43[_0x2254('0x31')];if(_0x40d4da['query'][_0x2254('0x41')]){_0x22bb98[_0x2254('0x42')]=[{'all':!![]}];}_0x22bb98=_[_0x2254('0x3e')]({},_0x22bb98,_0x40d4da[_0x2254('0x40')]);return db[_0x2254('0x2c')][_0x2254('0x49')](_0x22bb98)[_0x2254('0x26')](handleEntityNotFound(_0x57cda2,null))[_0x2254('0x26')](respondWithResult(_0x57cda2,null))[_0x2254('0x45')](handleError(_0x57cda2,null));};exports['create']=function(_0x239ba0,_0x405eb2){return db[_0x2254('0x2c')][_0x2254('0x4a')](_0x239ba0[_0x2254('0x4b')],{})[_0x2254('0x26')](respondWithResult(_0x405eb2,0xc9))[_0x2254('0x45')](handleError(_0x405eb2,null));};exports[_0x2254('0x25')]=function(_0x3ac691,_0xa103ea){if(_0x3ac691['body']['id']){delete _0x3ac691[_0x2254('0x4b')]['id'];}return db[_0x2254('0x2c')]['find']({'where':{'id':_0x3ac691[_0x2254('0x47')]['id']}})[_0x2254('0x26')](handleEntityNotFound(_0xa103ea,null))[_0x2254('0x26')](saveUpdates(_0x3ac691[_0x2254('0x4b')],null))['then'](respondWithResult(_0xa103ea,null))[_0x2254('0x45')](handleError(_0xa103ea,null));};exports[_0x2254('0x4c')]=function(_0x4d2c96,_0x26d01a){return db[_0x2254('0x2c')][_0x2254('0x49')]({'where':{'id':_0x4d2c96[_0x2254('0x47')]['id']}})['then'](handleEntityNotFound(_0x26d01a,null))[_0x2254('0x26')](removeEntity(_0x26d01a,null))[_0x2254('0x45')](handleError(_0x26d01a,null));};exports[_0x2254('0x4d')]=function(_0x4ba6ef,_0x4cc18a){return db[_0x2254('0x2c')][_0x2254('0x4d')]()['then'](respondWithResult(_0x4cc18a,null))[_0x2254('0x45')](handleError(_0x4cc18a,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index afc73d2..b135ac2 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 _0xa7e3=['exports','define','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes'];(function(_0x47e455,_0x4fe7ce){var _0x1996a5=function(_0x56c5be){while(--_0x56c5be){_0x47e455['push'](_0x47e455['shift']());}};_0x1996a5(++_0x4fe7ce);}(_0xa7e3,0x129));var _0x3a7e=function(_0x2d47d7,_0x5ab8db){_0x2d47d7=_0x2d47d7-0x0;var _0x32ac35=_0xa7e3[_0x2d47d7];return _0x32ac35;};'use strict';var _=require(_0x3a7e('0x0'));var util=require(_0x3a7e('0x1'));var logger=require(_0x3a7e('0x2'))(_0x3a7e('0x3'));var moment=require(_0x3a7e('0x4'));var BPromise=require(_0x3a7e('0x5'));var rp=require(_0x3a7e('0x6'));var fs=require('fs');var path=require(_0x3a7e('0x7'));var rimraf=require(_0x3a7e('0x8'));var config=require(_0x3a7e('0x9'));var attributes=require(_0x3a7e('0xa'));module[_0x3a7e('0xb')]=function(_0x3bed89,_0x1441f3){return _0x3bed89[_0x3a7e('0xc')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0x3a7e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd9b7=['bluebird','request-promise','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','util','../../config/logger','api','moment'];(function(_0x1f76cf,_0x2f78c2){var _0x3f01bc=function(_0x56f545){while(--_0x56f545){_0x1f76cf['push'](_0x1f76cf['shift']());}};_0x3f01bc(++_0x2f78c2);}(_0xd9b7,0x1e6));var _0x7d9b=function(_0x7b6984,_0x1dc97a){_0x7b6984=_0x7b6984-0x0;var _0x3e004a=_0xd9b7[_0x7b6984];return _0x3e004a;};'use strict';var _=require('lodash');var util=require(_0x7d9b('0x0'));var logger=require(_0x7d9b('0x1'))(_0x7d9b('0x2'));var moment=require(_0x7d9b('0x3'));var BPromise=require(_0x7d9b('0x4'));var rp=require(_0x7d9b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7d9b('0x6'));var attributes=require(_0x7d9b('0x7'));module[_0x7d9b('0x8')]=function(_0x2f5c78,_0x3d98fd){return _0x2f5c78[_0x7d9b('0x9')](_0x7d9b('0xa'),attributes,{'tableName':_0x7d9b('0xb'),'paranoid':![],'indexes':[{'name':_0x7d9b('0xc'),'fields':['resourceId',_0x7d9b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 43073df..ce6760d 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 _0xc33f=['moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','UserProfileResource,\x20%s,\x20%s','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xc33f,0x143));var _0xfc33=function(_0x1fd6b0,_0x5a40a0){_0x1fd6b0=_0x1fd6b0-0x0;var _0x202a08=_0xc33f[_0x1fd6b0];return _0x202a08;};'use strict';var _=require('lodash');var util=require(_0xfc33('0x0'));var moment=require(_0xfc33('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc33('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfc33('0x3'))(_0xfc33('0x4'));var config=require(_0xfc33('0x5'));var jayson=require(_0xfc33('0x6'));var client=jayson['client'][_0xfc33('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x59aa17,_0x6fd69b,_0x4e2c33){return new BPromise(function(_0x50dccc,_0x361dcf){return client[_0xfc33('0x8')](_0x59aa17,_0x4e2c33)['then'](function(_0x3baf53){logger[_0xfc33('0x9')](_0xfc33('0xa'),_0x6fd69b,'request\x20sent');logger['debug'](_0xfc33('0xb'),_0x6fd69b,_0xfc33('0xc'),JSON[_0xfc33('0xd')](_0x3baf53));if(_0x3baf53[_0xfc33('0xe')]){if(_0x3baf53['error'][_0xfc33('0xf')]===0x1f4){logger[_0xfc33('0xe')](_0xfc33('0xa'),_0x6fd69b,_0x3baf53[_0xfc33('0xe')][_0xfc33('0x10')]);return _0x361dcf(_0x3baf53['error'][_0xfc33('0x10')]);}logger[_0xfc33('0xe')](_0xfc33('0xa'),_0x6fd69b,_0x3baf53[_0xfc33('0xe')][_0xfc33('0x10')]);return _0x50dccc(_0x3baf53[_0xfc33('0xe')]['message']);}else{logger[_0xfc33('0x9')](_0xfc33('0xa'),_0x6fd69b,_0xfc33('0xc'));_0x50dccc(_0x3baf53['result'][_0xfc33('0x10')]);}})[_0xfc33('0x11')](function(_0x23d61e){logger[_0xfc33('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x6fd69b,_0x23d61e);_0x361dcf(_0x23d61e);});});} \ No newline at end of file +var _0x6bd2=['http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2b8f25,_0x494682){var _0xdb4d96=function(_0x1ea982){while(--_0x1ea982){_0x2b8f25['push'](_0x2b8f25['shift']());}};_0xdb4d96(++_0x494682);}(_0x6bd2,0xe6));var _0x26bd=function(_0x7d90be,_0x4eac40){_0x7d90be=_0x7d90be-0x0;var _0x50ef39=_0x6bd2[_0x7d90be];return _0x50ef39;};'use strict';var _=require(_0x26bd('0x0'));var util=require('util');var moment=require(_0x26bd('0x1'));var BPromise=require('bluebird');var rs=require(_0x26bd('0x2'));var fs=require('fs');var Redis=require(_0x26bd('0x3'));var db=require(_0x26bd('0x4'))['db'];var utils=require(_0x26bd('0x5'));var logger=require(_0x26bd('0x6'))(_0x26bd('0x7'));var config=require(_0x26bd('0x8'));var jayson=require(_0x26bd('0x9'));var client=jayson['client'][_0x26bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3952f8,_0x4a712c,_0x4f938f){return new BPromise(function(_0x54eb12,_0x2d333c){return client[_0x26bd('0xb')](_0x3952f8,_0x4f938f)[_0x26bd('0xc')](function(_0xcbe294){logger[_0x26bd('0xd')](_0x26bd('0xe'),_0x4a712c,_0x26bd('0xf'));logger[_0x26bd('0x10')](_0x26bd('0x11'),_0x4a712c,_0x26bd('0xf'),JSON[_0x26bd('0x12')](_0xcbe294));if(_0xcbe294[_0x26bd('0x13')]){if(_0xcbe294['error'][_0x26bd('0x14')]===0x1f4){logger[_0x26bd('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x4a712c,_0xcbe294[_0x26bd('0x13')][_0x26bd('0x15')]);return _0x2d333c(_0xcbe294[_0x26bd('0x13')][_0x26bd('0x15')]);}logger[_0x26bd('0x13')](_0x26bd('0xe'),_0x4a712c,_0xcbe294[_0x26bd('0x13')][_0x26bd('0x15')]);return _0x54eb12(_0xcbe294[_0x26bd('0x13')][_0x26bd('0x15')]);}else{logger[_0x26bd('0xd')](_0x26bd('0xe'),_0x4a712c,'request\x20sent');_0x54eb12(_0xcbe294[_0x26bd('0x16')]['message']);}})[_0x26bd('0x17')](function(_0x5d98d4){logger[_0x26bd('0x13')](_0x26bd('0xe'),_0x4a712c,_0x5d98d4);_0x2d333c(_0x5d98d4);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 9a41df6..02f0fd9 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 _0xdc95=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer'];(function(_0x21b244,_0x45285c){var _0x28267e=function(_0x17a6e6){while(--_0x17a6e6){_0x21b244['push'](_0x21b244['shift']());}};_0x28267e(++_0x45285c);}(_0xdc95,0x18f));var _0x5dc9=function(_0xea3b9d,_0x5114d7){_0xea3b9d=_0xea3b9d-0x0;var _0x4ef41a=_0xdc95[_0xea3b9d];return _0x4ef41a;};'use strict';var multer=require(_0x5dc9('0x0'));var util=require(_0x5dc9('0x1'));var path=require(_0x5dc9('0x2'));var timeout=require(_0x5dc9('0x3'));var express=require(_0x5dc9('0x4'));var router=express[_0x5dc9('0x5')]();var fs_extra=require(_0x5dc9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5dc9('0x7'));var config=require('../../config/environment');var controller=require(_0x5dc9('0x8'));router[_0x5dc9('0x9')]('/',auth[_0x5dc9('0xa')](),controller['index']);router['get'](_0x5dc9('0xb'),auth[_0x5dc9('0xa')](),controller[_0x5dc9('0xc')]);router['get'](_0x5dc9('0xd'),auth['isAuthenticated'](),controller[_0x5dc9('0xe')]);router[_0x5dc9('0xf')]('/',auth[_0x5dc9('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x5dc9('0x10')]);router[_0x5dc9('0x11')](_0x5dc9('0xd'),auth[_0x5dc9('0xa')](),controller[_0x5dc9('0x12')]);module[_0x5dc9('0x13')]=router; \ No newline at end of file +var _0xfd7e=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','/describe','isAuthenticated','describe','/:id','put','update','delete'];(function(_0x3dda0f,_0x5b9902){var _0x1b0488=function(_0x267031){while(--_0x267031){_0x3dda0f['push'](_0x3dda0f['shift']());}};_0x1b0488(++_0x5b9902);}(_0xfd7e,0x91));var _0xefd7=function(_0x350b71,_0x3a3cdd){_0x350b71=_0x350b71-0x0;var _0x9263c5=_0xfd7e[_0x350b71];return _0x9263c5;};'use strict';var multer=require(_0xefd7('0x0'));var util=require(_0xefd7('0x1'));var path=require(_0xefd7('0x2'));var timeout=require(_0xefd7('0x3'));var express=require(_0xefd7('0x4'));var router=express['Router']();var fs_extra=require(_0xefd7('0x5'));var auth=require(_0xefd7('0x6'));var interaction=require(_0xefd7('0x7'));var config=require('../../config/environment');var controller=require(_0xefd7('0x8'));router[_0xefd7('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xefd7('0xa'),auth[_0xefd7('0xb')](),controller[_0xefd7('0xc')]);router[_0xefd7('0x9')](_0xefd7('0xd'),auth[_0xefd7('0xb')](),controller['show']);router['post']('/',auth[_0xefd7('0xb')](),controller['create']);router[_0xefd7('0xe')]('/:id',auth[_0xefd7('0xb')](),controller[_0xefd7('0xf')]);router[_0xefd7('0x10')](_0xefd7('0xd'),auth[_0xefd7('0xb')](),controller['destroy']);module[_0xefd7('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 3d88c20..6827356 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 _0x57f8=['join','getDataValue','split','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions'];(function(_0x1627ae,_0x2aaa24){var _0x34b38f=function(_0x5c4332){while(--_0x5c4332){_0x1627ae['push'](_0x1627ae['shift']());}};_0x34b38f(++_0x2aaa24);}(_0x57f8,0x198));var _0x857f=function(_0x25e214,_0x42a13e){_0x25e214=_0x25e214-0x0;var _0x48ca06=_0x57f8[_0x25e214];return _0x48ca06;};'use strict';var Sequelize=require('sequelize');module[_0x857f('0x0')]={'name':{'type':Sequelize[_0x857f('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x857f('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x857f('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x857f('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x857f('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x857f('0x1')],'set':function(_0x6f054b){this[_0x857f('0x4')](_0x857f('0x5'),_0x6f054b?_0x6f054b[_0x857f('0x6')](''):[]);},'get':function(){return this[_0x857f('0x7')]('crudPermissions')?this[_0x857f('0x7')](_0x857f('0x5'))[_0x857f('0x8')](''):[];}}}; \ No newline at end of file +var _0xb62e=['STRING','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb62e,0x1de));var _0xeb62=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xb62e[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0xeb62('0x0'));module[_0xeb62('0x1')]={'name':{'type':Sequelize[_0xeb62('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xeb62('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xeb62('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xeb62('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xeb62('0x2')],'set':function(_0x929329){this[_0xeb62('0x4')](_0xeb62('0x5'),_0x929329?_0x929329['join'](''):[]);},'get':function(){return this[_0xeb62('0x6')](_0xeb62('0x5'))?this[_0xeb62('0x6')]('crudPermissions')[_0xeb62('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 27c971a..910ac15 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 _0x52cd=['UserProfileSection','rawAttributes','fieldName','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','offset','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','set','apply','reject','then','destroy','error','stack','name','send','index','map'];(function(_0x64d7cf,_0xfb45dc){var _0x173631=function(_0x38cb07){while(--_0x38cb07){_0x64d7cf['push'](_0x64d7cf['shift']());}};_0x173631(++_0xfb45dc);}(_0x52cd,0xb3));var _0xd52c=function(_0x262d7a,_0xf35286){_0x262d7a=_0x262d7a-0x0;var _0x27beb5=_0x52cd[_0x262d7a];return _0x27beb5;};'use strict';var emlformat=require(_0xd52c('0x0'));var rimraf=require(_0xd52c('0x1'));var zipdir=require(_0xd52c('0x2'));var jsonpatch=require(_0xd52c('0x3'));var rp=require(_0xd52c('0x4'));var moment=require(_0xd52c('0x5'));var BPromise=require(_0xd52c('0x6'));var Mustache=require(_0xd52c('0x7'));var util=require(_0xd52c('0x8'));var path=require('path');var sox=require(_0xd52c('0x9'));var csv=require(_0xd52c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd52c('0xb'));var _=require(_0xd52c('0xc'));var squel=require(_0xd52c('0xd'));var crypto=require(_0xd52c('0xe'));var jsforce=require(_0xd52c('0xf'));var deskjs=require(_0xd52c('0x10'));var toCsv=require(_0xd52c('0xa'));var querystring=require(_0xd52c('0x11'));var Papa=require(_0xd52c('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd52c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd52c('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd52c('0x15'));var db=require(_0xd52c('0x16'))['db'];function respondWithStatusCode(_0x3560ed,_0x235649){_0x235649=_0x235649||0xcc;return function(_0x5509de){if(_0x5509de){return _0x3560ed[_0xd52c('0x17')](_0x235649);}return _0x3560ed['status'](_0x235649)[_0xd52c('0x18')]();};}function respondWithResult(_0x3ef6fb,_0xfa9de0){_0xfa9de0=_0xfa9de0||0xc8;return function(_0x29c3e8){if(_0x29c3e8){return _0x3ef6fb[_0xd52c('0x19')](_0xfa9de0)['json'](_0x29c3e8);}};}function respondWithFilteredResult(_0x286f5e,_0x221d0d){return function(_0xbc0455){if(_0xbc0455){var _0x3bac0f=typeof _0x221d0d['offset']===_0xd52c('0x1a')&&typeof _0x221d0d[_0xd52c('0x1b')]===_0xd52c('0x1a');var _0x53404b=_0xbc0455[_0xd52c('0x1c')];var _0x489b31=_0x3bac0f?0x0:_0x221d0d['offset'];var _0x348073=_0x3bac0f?_0xbc0455['count']:_0x221d0d['offset']+_0x221d0d[_0xd52c('0x1b')];var _0x51d43f;if(_0x348073>=_0x53404b){_0x348073=_0x53404b;_0x51d43f=0xc8;}else{_0x51d43f=0xce;}_0x286f5e['status'](_0x51d43f);return _0x286f5e[_0xd52c('0x1d')]('Content-Range',_0x489b31+'-'+_0x348073+'/'+_0x53404b)['json'](_0xbc0455);}return null;};}function patchUpdates(_0x3d370d){return function(_0x8c621a){try{jsonpatch[_0xd52c('0x1e')](_0x8c621a,_0x3d370d,!![]);}catch(_0x1e8233){return BPromise[_0xd52c('0x1f')](_0x1e8233);}return _0x8c621a['save']();};}function saveUpdates(_0xaedef7,_0x3658fb){return function(_0x195608){if(_0x195608){return _0x195608['update'](_0xaedef7)[_0xd52c('0x20')](function(_0x2aab66){return _0x2aab66;});}return null;};}function removeEntity(_0x35fa9d,_0x48a73f){return function(_0x3b3a00){if(_0x3b3a00){return _0x3b3a00[_0xd52c('0x21')]()[_0xd52c('0x20')](function(){_0x35fa9d['status'](0xcc)[_0xd52c('0x18')]();});}};}function handleEntityNotFound(_0x518bc6,_0x18f1e7){return function(_0x51af1e){if(!_0x51af1e){_0x518bc6[_0xd52c('0x17')](0x194);}return _0x51af1e;};}function handleError(_0xf98fde,_0x4813eb){_0x4813eb=_0x4813eb||0x1f4;return function(_0x1999c9){logger[_0xd52c('0x22')](_0x1999c9[_0xd52c('0x23')]);if(_0x1999c9[_0xd52c('0x24')]){delete _0x1999c9[_0xd52c('0x24')];}_0xf98fde['status'](_0x4813eb)[_0xd52c('0x25')](_0x1999c9);};}exports[_0xd52c('0x26')]=function(_0x128ef9,_0x98e742){var _0x3fac65={},_0x35eab9={},_0x21222c={'count':0x0,'rows':[]};var _0x5c4635=_[_0xd52c('0x27')](db[_0xd52c('0x28')][_0xd52c('0x29')],function(_0x31b51a){return{'name':_0x31b51a[_0xd52c('0x2a')],'type':_0x31b51a['type'][_0xd52c('0x2b')]};});_0x35eab9[_0xd52c('0x2c')]=_[_0xd52c('0x27')](_0x5c4635,_0xd52c('0x24'));_0x35eab9['query']=_[_0xd52c('0x2d')](_0x128ef9['query']);_0x35eab9[_0xd52c('0x2e')]=_[_0xd52c('0x2f')](_0x35eab9['model'],_0x35eab9['query']);_0x3fac65[_0xd52c('0x30')]=_[_0xd52c('0x2f')](_0x35eab9[_0xd52c('0x2c')],qs[_0xd52c('0x31')](_0x128ef9[_0xd52c('0x32')][_0xd52c('0x31')]));_0x3fac65[_0xd52c('0x30')]=_0x3fac65[_0xd52c('0x30')][_0xd52c('0x33')]?_0x3fac65[_0xd52c('0x30')]:_0x35eab9[_0xd52c('0x2c')];if(!_0x128ef9[_0xd52c('0x32')][_0xd52c('0x34')](_0xd52c('0x35'))){_0x3fac65[_0xd52c('0x1b')]=qs[_0xd52c('0x1b')](_0x128ef9[_0xd52c('0x32')][_0xd52c('0x1b')]);_0x3fac65[_0xd52c('0x36')]=qs[_0xd52c('0x36')](_0x128ef9[_0xd52c('0x32')]['offset']);}_0x3fac65['order']=qs['sort'](_0x128ef9['query']['sort']);_0x3fac65[_0xd52c('0x37')]=qs[_0xd52c('0x2e')](_[_0xd52c('0x38')](_0x128ef9[_0xd52c('0x32')],_0x35eab9[_0xd52c('0x2e')]),_0x5c4635);if(_0x128ef9[_0xd52c('0x32')][_0xd52c('0x39')]){_0x3fac65[_0xd52c('0x37')]=_['merge'](_0x3fac65[_0xd52c('0x37')],{'$or':_[_0xd52c('0x27')](_0x5c4635,function(_0x4e4ca0){if(_0x4e4ca0['type']!==_0xd52c('0x3a')){var _0x27b916={};_0x27b916[_0x4e4ca0[_0xd52c('0x24')]]={'$like':'%'+_0x128ef9['query'][_0xd52c('0x39')]+'%'};return _0x27b916;}})});}_0x3fac65=_[_0xd52c('0x3b')]({},_0x3fac65,_0x128ef9[_0xd52c('0x3c')]);var _0x55258c={'where':_0x3fac65[_0xd52c('0x37')]};return db[_0xd52c('0x28')][_0xd52c('0x1c')](_0x55258c)[_0xd52c('0x20')](function(_0x354391){_0x21222c[_0xd52c('0x1c')]=_0x354391;if(_0x128ef9['query'][_0xd52c('0x3d')]){_0x3fac65[_0xd52c('0x3e')]=[{'all':!![]}];}return db[_0xd52c('0x28')][_0xd52c('0x3f')](_0x3fac65);})[_0xd52c('0x20')](function(_0x1b6fd5){_0x21222c[_0xd52c('0x40')]=_0x1b6fd5;return _0x21222c;})[_0xd52c('0x20')](respondWithFilteredResult(_0x98e742,_0x3fac65))[_0xd52c('0x41')](handleError(_0x98e742,null));};exports[_0xd52c('0x42')]=function(_0x45bf3a,_0x256b16){var _0x1bec46={'raw':![],'where':{'id':_0x45bf3a[_0xd52c('0x43')]['id']}},_0x507fc1={};_0x507fc1[_0xd52c('0x2c')]=_[_0xd52c('0x2d')](db[_0xd52c('0x28')]['rawAttributes']);_0x507fc1['query']=_[_0xd52c('0x2d')](_0x45bf3a[_0xd52c('0x32')]);_0x507fc1['filters']=_[_0xd52c('0x2f')](_0x507fc1['model'],_0x507fc1[_0xd52c('0x32')]);_0x1bec46[_0xd52c('0x30')]=_[_0xd52c('0x2f')](_0x507fc1[_0xd52c('0x2c')],qs[_0xd52c('0x31')](_0x45bf3a[_0xd52c('0x32')][_0xd52c('0x31')]));_0x1bec46[_0xd52c('0x30')]=_0x1bec46[_0xd52c('0x30')][_0xd52c('0x33')]?_0x1bec46[_0xd52c('0x30')]:_0x507fc1[_0xd52c('0x2c')];if(_0x45bf3a['query'][_0xd52c('0x3d')]){_0x1bec46[_0xd52c('0x3e')]=[{'all':!![]}];}_0x1bec46=_[_0xd52c('0x3b')]({},_0x1bec46,_0x45bf3a[_0xd52c('0x3c')]);return db['UserProfileSection'][_0xd52c('0x44')](_0x1bec46)[_0xd52c('0x20')](handleEntityNotFound(_0x256b16,null))[_0xd52c('0x20')](respondWithResult(_0x256b16,null))['catch'](handleError(_0x256b16,null));};exports[_0xd52c('0x45')]=function(_0x250612,_0x45769d){return db[_0xd52c('0x28')][_0xd52c('0x45')](_0x250612[_0xd52c('0x46')],{})[_0xd52c('0x20')](respondWithResult(_0x45769d,0xc9))[_0xd52c('0x41')](handleError(_0x45769d,null));};exports[_0xd52c('0x47')]=function(_0x1c4dba,_0x27120a){if(_0x1c4dba[_0xd52c('0x46')]['id']){delete _0x1c4dba['body']['id'];}return db[_0xd52c('0x28')][_0xd52c('0x44')]({'where':{'id':_0x1c4dba[_0xd52c('0x43')]['id']}})[_0xd52c('0x20')](handleEntityNotFound(_0x27120a,null))[_0xd52c('0x20')](saveUpdates(_0x1c4dba['body'],null))[_0xd52c('0x20')](respondWithResult(_0x27120a,null))['catch'](handleError(_0x27120a,null));};exports[_0xd52c('0x21')]=function(_0x164be4,_0x4f47a5){return db[_0xd52c('0x28')][_0xd52c('0x44')]({'where':{'id':_0x164be4[_0xd52c('0x43')]['id']}})[_0xd52c('0x20')](handleEntityNotFound(_0x4f47a5,null))['then'](removeEntity(_0x4f47a5,null))['catch'](handleError(_0x4f47a5,null));};exports[_0xd52c('0x48')]=function(_0x544620,_0x1a0681){return db[_0xd52c('0x28')][_0xd52c('0x48')]()[_0xd52c('0x20')](respondWithResult(_0x1a0681,null))[_0xd52c('0x41')](handleError(_0x1a0681,null));}; \ No newline at end of file +var _0x2d1e=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','send','map','rawAttributes','key','model','name','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','type','VIRTUAL','options','UserProfileSection','includeAll','include','rows','show','params','keys','find','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv'];(function(_0x1f56b4,_0x333072){var _0x43a029=function(_0x1aa481){while(--_0x1aa481){_0x1f56b4['push'](_0x1f56b4['shift']());}};_0x43a029(++_0x333072);}(_0x2d1e,0x1a6));var _0xe2d1=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x2d1e[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe2d1('0x0'));var zipdir=require(_0xe2d1('0x1'));var jsonpatch=require(_0xe2d1('0x2'));var rp=require(_0xe2d1('0x3'));var moment=require(_0xe2d1('0x4'));var BPromise=require(_0xe2d1('0x5'));var Mustache=require('mustache');var util=require(_0xe2d1('0x6'));var path=require(_0xe2d1('0x7'));var sox=require(_0xe2d1('0x8'));var csv=require('to-csv');var ejs=require(_0xe2d1('0x9'));var fs=require('fs');var fs_extra=require(_0xe2d1('0xa'));var _=require(_0xe2d1('0xb'));var squel=require(_0xe2d1('0xc'));var crypto=require(_0xe2d1('0xd'));var jsforce=require(_0xe2d1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe2d1('0xf'));var querystring=require('querystring');var Papa=require(_0xe2d1('0x10'));var Redis=require(_0xe2d1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe2d1('0x12'));var as=require(_0xe2d1('0x13'));var hardwareService=require(_0xe2d1('0x14'));var logger=require(_0xe2d1('0x15'))('api');var utils=require(_0xe2d1('0x16'));var config=require(_0xe2d1('0x17'));var licenseUtil=require(_0xe2d1('0x18'));var db=require(_0xe2d1('0x19'))['db'];function respondWithStatusCode(_0xc0ac2d,_0x45d59d){_0x45d59d=_0x45d59d||0xcc;return function(_0x32b10d){if(_0x32b10d){return _0xc0ac2d[_0xe2d1('0x1a')](_0x45d59d);}return _0xc0ac2d['status'](_0x45d59d)['end']();};}function respondWithResult(_0x2c15b7,_0x3cf339){_0x3cf339=_0x3cf339||0xc8;return function(_0x1a84d9){if(_0x1a84d9){return _0x2c15b7[_0xe2d1('0x1b')](_0x3cf339)[_0xe2d1('0x1c')](_0x1a84d9);}};}function respondWithFilteredResult(_0x802460,_0x72f670){return function(_0x5982a7){if(_0x5982a7){var _0x1e60bb=typeof _0x72f670[_0xe2d1('0x1d')]==='undefined'&&typeof _0x72f670[_0xe2d1('0x1e')]==='undefined';var _0x72cb0a=_0x5982a7[_0xe2d1('0x1f')];var _0x4fc925=_0x1e60bb?0x0:_0x72f670['offset'];var _0x37d326=_0x1e60bb?_0x5982a7[_0xe2d1('0x1f')]:_0x72f670['offset']+_0x72f670[_0xe2d1('0x1e')];var _0x8df15d;if(_0x37d326>=_0x72cb0a){_0x37d326=_0x72cb0a;_0x8df15d=0xc8;}else{_0x8df15d=0xce;}_0x802460['status'](_0x8df15d);return _0x802460[_0xe2d1('0x20')](_0xe2d1('0x21'),_0x4fc925+'-'+_0x37d326+'/'+_0x72cb0a)['json'](_0x5982a7);}return null;};}function patchUpdates(_0x11b112){return function(_0x8b656){try{jsonpatch[_0xe2d1('0x22')](_0x8b656,_0x11b112,!![]);}catch(_0x163bc3){return BPromise[_0xe2d1('0x23')](_0x163bc3);}return _0x8b656['save']();};}function saveUpdates(_0x542454,_0x3caffa){return function(_0x218bd8){if(_0x218bd8){return _0x218bd8[_0xe2d1('0x24')](_0x542454)[_0xe2d1('0x25')](function(_0x274ebb){return _0x274ebb;});}return null;};}function removeEntity(_0xab53e0,_0x1e94bf){return function(_0x1ea1d4){if(_0x1ea1d4){return _0x1ea1d4[_0xe2d1('0x26')]()[_0xe2d1('0x25')](function(){_0xab53e0[_0xe2d1('0x1b')](0xcc)[_0xe2d1('0x27')]();});}};}function handleEntityNotFound(_0x4f8680,_0x1f85c2){return function(_0x486904){if(!_0x486904){_0x4f8680['sendStatus'](0x194);}return _0x486904;};}function handleError(_0x4a547c,_0x3221e4){_0x3221e4=_0x3221e4||0x1f4;return function(_0x12013b){logger[_0xe2d1('0x28')](_0x12013b['stack']);if(_0x12013b['name']){delete _0x12013b['name'];}_0x4a547c['status'](_0x3221e4)[_0xe2d1('0x29')](_0x12013b);};}exports['index']=function(_0x5394d5,_0x4c2439){var _0x2e2b20={},_0x31c38f={},_0xa98551={'count':0x0,'rows':[]};var _0x3e6314=_[_0xe2d1('0x2a')](db['UserProfileSection'][_0xe2d1('0x2b')],function(_0x478cf8){return{'name':_0x478cf8['fieldName'],'type':_0x478cf8['type'][_0xe2d1('0x2c')]};});_0x31c38f[_0xe2d1('0x2d')]=_[_0xe2d1('0x2a')](_0x3e6314,_0xe2d1('0x2e'));_0x31c38f[_0xe2d1('0x2f')]=_['keys'](_0x5394d5[_0xe2d1('0x2f')]);_0x31c38f[_0xe2d1('0x30')]=_[_0xe2d1('0x31')](_0x31c38f[_0xe2d1('0x2d')],_0x31c38f[_0xe2d1('0x2f')]);_0x2e2b20[_0xe2d1('0x32')]=_[_0xe2d1('0x31')](_0x31c38f[_0xe2d1('0x2d')],qs[_0xe2d1('0x33')](_0x5394d5[_0xe2d1('0x2f')][_0xe2d1('0x33')]));_0x2e2b20['attributes']=_0x2e2b20[_0xe2d1('0x32')][_0xe2d1('0x34')]?_0x2e2b20['attributes']:_0x31c38f[_0xe2d1('0x2d')];if(!_0x5394d5['query']['hasOwnProperty'](_0xe2d1('0x35'))){_0x2e2b20['limit']=qs[_0xe2d1('0x1e')](_0x5394d5[_0xe2d1('0x2f')][_0xe2d1('0x1e')]);_0x2e2b20['offset']=qs[_0xe2d1('0x1d')](_0x5394d5[_0xe2d1('0x2f')][_0xe2d1('0x1d')]);}_0x2e2b20['order']=qs[_0xe2d1('0x36')](_0x5394d5[_0xe2d1('0x2f')][_0xe2d1('0x36')]);_0x2e2b20[_0xe2d1('0x37')]=qs[_0xe2d1('0x30')](_['pick'](_0x5394d5[_0xe2d1('0x2f')],_0x31c38f[_0xe2d1('0x30')]),_0x3e6314);if(_0x5394d5['query'][_0xe2d1('0x38')]){_0x2e2b20[_0xe2d1('0x37')]=_[_0xe2d1('0x39')](_0x2e2b20[_0xe2d1('0x37')],{'$or':_[_0xe2d1('0x2a')](_0x3e6314,function(_0x5c45e9){if(_0x5c45e9[_0xe2d1('0x3a')]!==_0xe2d1('0x3b')){var _0x4aba1a={};_0x4aba1a[_0x5c45e9[_0xe2d1('0x2e')]]={'$like':'%'+_0x5394d5[_0xe2d1('0x2f')][_0xe2d1('0x38')]+'%'};return _0x4aba1a;}})});}_0x2e2b20=_[_0xe2d1('0x39')]({},_0x2e2b20,_0x5394d5[_0xe2d1('0x3c')]);var _0x50049d={'where':_0x2e2b20[_0xe2d1('0x37')]};return db[_0xe2d1('0x3d')][_0xe2d1('0x1f')](_0x50049d)[_0xe2d1('0x25')](function(_0x2e331d){_0xa98551[_0xe2d1('0x1f')]=_0x2e331d;if(_0x5394d5[_0xe2d1('0x2f')][_0xe2d1('0x3e')]){_0x2e2b20[_0xe2d1('0x3f')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x2e2b20);})[_0xe2d1('0x25')](function(_0x2a55df){_0xa98551[_0xe2d1('0x40')]=_0x2a55df;return _0xa98551;})['then'](respondWithFilteredResult(_0x4c2439,_0x2e2b20))['catch'](handleError(_0x4c2439,null));};exports[_0xe2d1('0x41')]=function(_0xae7cf6,_0x3af097){var _0x3a03ff={'raw':![],'where':{'id':_0xae7cf6[_0xe2d1('0x42')]['id']}},_0x3c5ffe={};_0x3c5ffe[_0xe2d1('0x2d')]=_[_0xe2d1('0x43')](db['UserProfileSection']['rawAttributes']);_0x3c5ffe[_0xe2d1('0x2f')]=_[_0xe2d1('0x43')](_0xae7cf6[_0xe2d1('0x2f')]);_0x3c5ffe['filters']=_['intersection'](_0x3c5ffe[_0xe2d1('0x2d')],_0x3c5ffe[_0xe2d1('0x2f')]);_0x3a03ff[_0xe2d1('0x32')]=_['intersection'](_0x3c5ffe[_0xe2d1('0x2d')],qs[_0xe2d1('0x33')](_0xae7cf6['query'][_0xe2d1('0x33')]));_0x3a03ff[_0xe2d1('0x32')]=_0x3a03ff[_0xe2d1('0x32')][_0xe2d1('0x34')]?_0x3a03ff[_0xe2d1('0x32')]:_0x3c5ffe['model'];if(_0xae7cf6[_0xe2d1('0x2f')][_0xe2d1('0x3e')]){_0x3a03ff[_0xe2d1('0x3f')]=[{'all':!![]}];}_0x3a03ff=_[_0xe2d1('0x39')]({},_0x3a03ff,_0xae7cf6['options']);return db[_0xe2d1('0x3d')][_0xe2d1('0x44')](_0x3a03ff)[_0xe2d1('0x25')](handleEntityNotFound(_0x3af097,null))['then'](respondWithResult(_0x3af097,null))['catch'](handleError(_0x3af097,null));};exports[_0xe2d1('0x45')]=function(_0x1f93ae,_0x420401){return db[_0xe2d1('0x3d')][_0xe2d1('0x45')](_0x1f93ae[_0xe2d1('0x46')],{})[_0xe2d1('0x25')](respondWithResult(_0x420401,0xc9))['catch'](handleError(_0x420401,null));};exports['update']=function(_0xc2118e,_0x47c53b){if(_0xc2118e[_0xe2d1('0x46')]['id']){delete _0xc2118e[_0xe2d1('0x46')]['id'];}return db['UserProfileSection'][_0xe2d1('0x44')]({'where':{'id':_0xc2118e[_0xe2d1('0x42')]['id']}})[_0xe2d1('0x25')](handleEntityNotFound(_0x47c53b,null))[_0xe2d1('0x25')](saveUpdates(_0xc2118e[_0xe2d1('0x46')],null))['then'](respondWithResult(_0x47c53b,null))[_0xe2d1('0x47')](handleError(_0x47c53b,null));};exports[_0xe2d1('0x26')]=function(_0x555f36,_0x1c1cbd){return db[_0xe2d1('0x3d')]['find']({'where':{'id':_0x555f36['params']['id']}})[_0xe2d1('0x25')](handleEntityNotFound(_0x1c1cbd,null))[_0xe2d1('0x25')](removeEntity(_0x1c1cbd,null))[_0xe2d1('0x47')](handleError(_0x1c1cbd,null));};exports[_0xe2d1('0x48')]=function(_0x62700f,_0x48f55f){return db[_0xe2d1('0x3d')][_0xe2d1('0x48')]()[_0xe2d1('0x25')](respondWithResult(_0x48f55f,null))[_0xe2d1('0x47')](handleError(_0x48f55f,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 926f670..aaf0f4e 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 _0x4be6=['exports','UserProfileSection','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileSection.attributes'];(function(_0xc3b5ef,_0x300f79){var _0x3d13bc=function(_0xcd7632){while(--_0xcd7632){_0xc3b5ef['push'](_0xc3b5ef['shift']());}};_0x3d13bc(++_0x300f79);}(_0x4be6,0x74));var _0x64be=function(_0xdd31c,_0x484018){_0xdd31c=_0xdd31c-0x0;var _0x11b6ce=_0x4be6[_0xdd31c];return _0x11b6ce;};'use strict';var _=require(_0x64be('0x0'));var util=require(_0x64be('0x1'));var logger=require(_0x64be('0x2'))(_0x64be('0x3'));var moment=require(_0x64be('0x4'));var BPromise=require(_0x64be('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x64be('0x6'));var rimraf=require(_0x64be('0x7'));var config=require(_0x64be('0x8'));var attributes=require(_0x64be('0x9'));module[_0x64be('0xa')]=function(_0x935e8b,_0x4d4acc){return _0x935e8b['define'](_0x64be('0xb'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x64be('0xc'),_0x64be('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc5f8=['api','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger'];(function(_0x744106,_0x355dec){var _0x2ded67=function(_0x211043){while(--_0x211043){_0x744106['push'](_0x744106['shift']());}};_0x2ded67(++_0x355dec);}(_0xc5f8,0x19d));var _0x8c5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc5f8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8c5f('0x0'));var util=require(_0x8c5f('0x1'));var logger=require(_0x8c5f('0x2'))(_0x8c5f('0x3'));var moment=require('moment');var BPromise=require(_0x8c5f('0x4'));var rp=require(_0x8c5f('0x5'));var fs=require('fs');var path=require(_0x8c5f('0x6'));var rimraf=require(_0x8c5f('0x7'));var config=require(_0x8c5f('0x8'));var attributes=require(_0x8c5f('0x9'));module['exports']=function(_0x54f9f4,_0x1f8075){return _0x54f9f4[_0x8c5f('0xa')](_0x8c5f('0xb'),attributes,{'tableName':_0x8c5f('0xc'),'paranoid':![],'indexes':[{'name':_0x8c5f('0xd'),'fields':[_0x8c5f('0xe'),_0x8c5f('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index c55a333..c05512b 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 _0x7e70=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis'];(function(_0xbc346f,_0x3db5c0){var _0x9f9260=function(_0x37e6b9){while(--_0x37e6b9){_0xbc346f['push'](_0xbc346f['shift']());}};_0x9f9260(++_0x3db5c0);}(_0x7e70,0x7b));var _0x07e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e70[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x07e7('0x0'));var rs=require(_0x07e7('0x1'));var fs=require('fs');var Redis=require(_0x07e7('0x2'));var db=require(_0x07e7('0x3'))['db'];var utils=require(_0x07e7('0x4'));var logger=require(_0x07e7('0x5'))(_0x07e7('0x6'));var config=require(_0x07e7('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x07e7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4cf91a,_0x418576,_0x20ab68){return new BPromise(function(_0x525a66,_0x213332){return client[_0x07e7('0x9')](_0x4cf91a,_0x20ab68)['then'](function(_0x248663){logger[_0x07e7('0xa')](_0x07e7('0xb'),_0x418576,'request\x20sent');logger[_0x07e7('0xc')](_0x07e7('0xd'),_0x418576,_0x07e7('0xe'),JSON[_0x07e7('0xf')](_0x248663));if(_0x248663[_0x07e7('0x10')]){if(_0x248663[_0x07e7('0x10')][_0x07e7('0x11')]===0x1f4){logger[_0x07e7('0x10')](_0x07e7('0xb'),_0x418576,_0x248663['error'][_0x07e7('0x12')]);return _0x213332(_0x248663[_0x07e7('0x10')][_0x07e7('0x12')]);}logger[_0x07e7('0x10')](_0x07e7('0xb'),_0x418576,_0x248663[_0x07e7('0x10')][_0x07e7('0x12')]);return _0x525a66(_0x248663[_0x07e7('0x10')][_0x07e7('0x12')]);}else{logger[_0x07e7('0xa')](_0x07e7('0xb'),_0x418576,_0x07e7('0xe'));_0x525a66(_0x248663[_0x07e7('0x13')][_0x07e7('0x12')]);}})[_0x07e7('0x14')](function(_0x46ffdb){logger['error'](_0x07e7('0xb'),_0x418576,_0x46ffdb);_0x213332(_0x46ffdb);});});} \ No newline at end of file +var _0x1375=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1375,0x170));var _0x5137=function(_0x1d8c5c,_0x437a63){_0x1d8c5c=_0x1d8c5c-0x0;var _0x234264=_0x1375[_0x1d8c5c];return _0x234264;};'use strict';var _=require(_0x5137('0x0'));var util=require(_0x5137('0x1'));var moment=require(_0x5137('0x2'));var BPromise=require('bluebird');var rs=require(_0x5137('0x3'));var fs=require('fs');var Redis=require(_0x5137('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5137('0x5'));var logger=require(_0x5137('0x6'))(_0x5137('0x7'));var config=require(_0x5137('0x8'));var jayson=require(_0x5137('0x9'));var client=jayson[_0x5137('0xa')][_0x5137('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2da232,_0x242481,_0x3f3143){return new BPromise(function(_0x435957,_0xfa622e){return client[_0x5137('0xc')](_0x2da232,_0x3f3143)[_0x5137('0xd')](function(_0x44f5cd){logger[_0x5137('0xe')](_0x5137('0xf'),_0x242481,_0x5137('0x10'));logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x242481,_0x5137('0x10'),JSON[_0x5137('0x11')](_0x44f5cd));if(_0x44f5cd[_0x5137('0x12')]){if(_0x44f5cd['error'][_0x5137('0x13')]===0x1f4){logger['error'](_0x5137('0xf'),_0x242481,_0x44f5cd[_0x5137('0x12')]['message']);return _0xfa622e(_0x44f5cd['error'][_0x5137('0x14')]);}logger[_0x5137('0x12')](_0x5137('0xf'),_0x242481,_0x44f5cd[_0x5137('0x12')][_0x5137('0x14')]);return _0x435957(_0x44f5cd[_0x5137('0x12')][_0x5137('0x14')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x242481,_0x5137('0x10'));_0x435957(_0x44f5cd['result'][_0x5137('0x14')]);}})[_0x5137('0x15')](function(_0x13ca57){logger['error'](_0x5137('0xf'),_0x242481,_0x13ca57);_0xfa622e(_0x13ca57);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index acf2a2e..b211d0d 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1922d7,_0xba1505){var _0x2c8b86=function(_0x1ea1f9){while(--_0x1ea1f9){_0x1922d7['push'](_0x1922d7['shift']());}};_0x2c8b86(++_0xba1505);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2b26d5,_0x1fce0e){var _0x280955=function(_0x3307f6){while(--_0x3307f6){_0x2b26d5['push'](_0x2b26d5['shift']());}};_0x280955(++_0x1fce0e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0xcb91[_0x164af1];return _0x5d81a2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index d1a2a7b..011ead6 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 _0x7132=['INTEGER','exports'];(function(_0x199313,_0x3356ca){var _0x5ac914=function(_0x5bf982){while(--_0x5bf982){_0x199313['push'](_0x199313['shift']());}};_0x5ac914(++_0x3356ca);}(_0x7132,0x1cf));var _0x2713=function(_0x531e48,_0x4bb96b){_0x531e48=_0x531e48-0x0;var _0x202971=_0x7132[_0x531e48];return _0x202971;};'use strict';var Sequelize=require('sequelize');module[_0x2713('0x0')]={'penalty':{'type':Sequelize[_0x2713('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0dee=['exports','sequelize'];(function(_0x854260,_0x2d478c){var _0x30d816=function(_0x41f21d){while(--_0x41f21d){_0x854260['push'](_0x854260['shift']());}};_0x30d816(++_0x2d478c);}(_0x0dee,0xf7));var _0xe0de=function(_0x340d15,_0x35e7f8){_0x340d15=_0x340d15-0x0;var _0x5da865=_0x0dee[_0x340d15];return _0x5da865;};'use strict';var Sequelize=require(_0xe0de('0x0'));module[_0xe0de('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 2d48f0e..79bb0bf 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 _0x50e5=['user_has_sms_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define'];(function(_0xc93bfa,_0x11a2f4){var _0x31127e=function(_0x3f4c2f){while(--_0x3f4c2f){_0xc93bfa['push'](_0xc93bfa['shift']());}};_0x31127e(++_0x11a2f4);}(_0x50e5,0xb7));var _0x550e=function(_0x54585b,_0x39c943){_0x54585b=_0x54585b-0x0;var _0x247564=_0x50e5[_0x54585b];return _0x247564;};'use strict';var _=require(_0x550e('0x0'));var util=require(_0x550e('0x1'));var logger=require('../../config/logger')(_0x550e('0x2'));var moment=require(_0x550e('0x3'));var BPromise=require(_0x550e('0x4'));var rp=require(_0x550e('0x5'));var fs=require('fs');var path=require(_0x550e('0x6'));var rimraf=require(_0x550e('0x7'));var config=require(_0x550e('0x8'));var attributes=require(_0x550e('0x9'));module[_0x550e('0xa')]=function(_0x3d8c9b,_0x863e3b){return _0x3d8c9b[_0x550e('0xb')]('UserSmsQueue',attributes,{'tableName':_0x550e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9eb=['rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3b2d98,_0xaa0b26){var _0x256bf1=function(_0x1fe933){while(--_0x1fe933){_0x3b2d98['push'](_0x3b2d98['shift']());}};_0x256bf1(++_0xaa0b26);}(_0xd9eb,0xca));var _0xbd9e=function(_0x3d3d7b,_0x5c0937){_0x3d3d7b=_0x3d3d7b-0x0;var _0x33e7c8=_0xd9eb[_0x3d3d7b];return _0x33e7c8;};'use strict';var _=require(_0xbd9e('0x0'));var util=require(_0xbd9e('0x1'));var logger=require(_0xbd9e('0x2'))(_0xbd9e('0x3'));var moment=require(_0xbd9e('0x4'));var BPromise=require(_0xbd9e('0x5'));var rp=require(_0xbd9e('0x6'));var fs=require('fs');var path=require(_0xbd9e('0x7'));var rimraf=require(_0xbd9e('0x8'));var config=require(_0xbd9e('0x9'));var attributes=require(_0xbd9e('0xa'));module[_0xbd9e('0xb')]=function(_0x20c36a,_0x4ade3f){return _0x20c36a[_0xbd9e('0xc')](_0xbd9e('0xd'),attributes,{'tableName':_0xbd9e('0xe'),'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 cbaf789..326ccd4 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 _0x5552=['../../config/logger','rpc','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x38c9f2,_0x5935d1){var _0x5957fc=function(_0x266100){while(--_0x266100){_0x38c9f2['push'](_0x38c9f2['shift']());}};_0x5957fc(++_0x5935d1);}(_0x5552,0x14b));var _0x2555=function(_0x8b3205,_0x1dfbab){_0x8b3205=_0x8b3205-0x0;var _0x1a6c00=_0x5552[_0x8b3205];return _0x1a6c00;};'use strict';var _=require(_0x2555('0x0'));var util=require('util');var moment=require(_0x2555('0x1'));var BPromise=require(_0x2555('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2555('0x3'))['db'];var utils=require(_0x2555('0x4'));var logger=require(_0x2555('0x5'))(_0x2555('0x6'));var config=require('../../config/environment');var jayson=require(_0x2555('0x7'));var client=jayson['client'][_0x2555('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xed28f,_0x44f636,_0x16c16c){return new BPromise(function(_0x5e0bb1,_0x35e6d6){return client[_0x2555('0x9')](_0xed28f,_0x16c16c)[_0x2555('0xa')](function(_0x10b4d6){logger[_0x2555('0xb')](_0x2555('0xc'),_0x44f636,_0x2555('0xd'));logger['debug'](_0x2555('0xe'),_0x44f636,_0x2555('0xd'),JSON[_0x2555('0xf')](_0x10b4d6));if(_0x10b4d6[_0x2555('0x10')]){if(_0x10b4d6[_0x2555('0x10')][_0x2555('0x11')]===0x1f4){logger['error'](_0x2555('0xc'),_0x44f636,_0x10b4d6[_0x2555('0x10')][_0x2555('0x12')]);return _0x35e6d6(_0x10b4d6[_0x2555('0x10')][_0x2555('0x12')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x44f636,_0x10b4d6[_0x2555('0x10')]['message']);return _0x5e0bb1(_0x10b4d6[_0x2555('0x10')][_0x2555('0x12')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x44f636,_0x2555('0xd'));_0x5e0bb1(_0x10b4d6[_0x2555('0x13')][_0x2555('0x12')]);}})[_0x2555('0x14')](function(_0x32602e){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x44f636,_0x32602e);_0x35e6d6(_0x32602e);});});} \ No newline at end of file +var _0x7769=['request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','UserSmsQueue,\x20%s,\x20%s'];(function(_0xc28dd5,_0x12ddc3){var _0x58ab18=function(_0x4f49b6){while(--_0x4f49b6){_0xc28dd5['push'](_0xc28dd5['shift']());}};_0x58ab18(++_0x12ddc3);}(_0x7769,0x1be));var _0x9776=function(_0x4cff13,_0xc82ddb){_0x4cff13=_0x4cff13-0x0;var _0x508b86=_0x7769[_0x4cff13];return _0x508b86;};'use strict';var _=require(_0x9776('0x0'));var util=require(_0x9776('0x1'));var moment=require(_0x9776('0x2'));var BPromise=require(_0x9776('0x3'));var rs=require(_0x9776('0x4'));var fs=require('fs');var Redis=require(_0x9776('0x5'));var db=require(_0x9776('0x6'))['db'];var utils=require(_0x9776('0x7'));var logger=require(_0x9776('0x8'))('rpc');var config=require(_0x9776('0x9'));var jayson=require(_0x9776('0xa'));var client=jayson[_0x9776('0xb')][_0x9776('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3141bf,_0x3d41a2,_0x5971e6){return new BPromise(function(_0x1bd4a9,_0x3e9177){return client[_0x9776('0xd')](_0x3141bf,_0x5971e6)[_0x9776('0xe')](function(_0x235219){logger['info'](_0x9776('0xf'),_0x3d41a2,_0x9776('0x10'));logger[_0x9776('0x11')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x3d41a2,_0x9776('0x10'),JSON['stringify'](_0x235219));if(_0x235219['error']){if(_0x235219[_0x9776('0x12')][_0x9776('0x13')]===0x1f4){logger['error'](_0x9776('0xf'),_0x3d41a2,_0x235219[_0x9776('0x12')]['message']);return _0x3e9177(_0x235219[_0x9776('0x12')][_0x9776('0x14')]);}logger[_0x9776('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x3d41a2,_0x235219[_0x9776('0x12')][_0x9776('0x14')]);return _0x1bd4a9(_0x235219['error'][_0x9776('0x14')]);}else{logger['info'](_0x9776('0xf'),_0x3d41a2,_0x9776('0x10'));_0x1bd4a9(_0x235219['result'][_0x9776('0x14')]);}})[_0x9776('0x15')](function(_0x266ef0){logger[_0x9776('0x12')](_0x9776('0xf'),_0x3d41a2,_0x266ef0);_0x3e9177(_0x266ef0);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 5c7d8df..3927efc 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 _0x5c38=['sequelize','INTEGER'];(function(_0x3dee92,_0x55e1eb){var _0x44d36e=function(_0x34de1a){while(--_0x34de1a){_0x3dee92['push'](_0x3dee92['shift']());}};_0x44d36e(++_0x55e1eb);}(_0x5c38,0xd0));var _0x85c3=function(_0x3b2ab9,_0x418523){_0x3b2ab9=_0x3b2ab9-0x0;var _0x1241ff=_0x5c38[_0x3b2ab9];return _0x1241ff;};'use strict';var Sequelize=require(_0x85c3('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x85c3('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x85c3('0x1')]}}; \ No newline at end of file +var _0x599f=['exports','INTEGER','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x599f,0x7a));var _0xf599=function(_0x30b045,_0x7f962c){_0x30b045=_0x30b045-0x0;var _0x889586=_0x599f[_0x30b045];return _0x889586;};'use strict';var Sequelize=require(_0xf599('0x0'));module[_0xf599('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xf599('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index f3a9997..10f91dc 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(_0x23e64d,_0x107c2c){var _0x146d02=function(_0x531b6e){while(--_0x531b6e){_0x23e64d['push'](_0x23e64d['shift']());}};_0x146d02(++_0x107c2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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(_0x126926,_0x29487f){var _0x50ffb6=function(_0x18d4dd){while(--_0x18d4dd){_0x126926['push'](_0x126926['shift']());}};_0x50ffb6(++_0x29487f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 d2bdf4f..59609fd 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x12fada,_0x43f44b){var _0xa90599=function(_0x5b4580){while(--_0x5b4580){_0x12fada['push'](_0x12fada['shift']());}};_0xa90599(++_0x43f44b);}(_0x70e0,0x17b));var _0x070e=function(_0xc60a67,_0x44fe9b){_0xc60a67=_0xc60a67-0x0;var _0x3f9ba0=_0x70e0[_0xc60a67];return _0x3f9ba0;};'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(_0x9213a5,_0x5aeddb){var _0x31353c=function(_0x50eaa6){while(--_0x50eaa6){_0x9213a5['push'](_0x9213a5['shift']());}};_0x31353c(++_0x5aeddb);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index bcf13ea..bd93604 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 _0xe351=['sequelize','exports','INTEGER'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xe351,0x10b));var _0x1e35=function(_0x364716,_0x5ea802){_0x364716=_0x364716-0x0;var _0x177803=_0xe351[_0x364716];return _0x177803;};'use strict';var Sequelize=require(_0x1e35('0x0'));module[_0x1e35('0x1')]={'penalty':{'type':Sequelize[_0x1e35('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x62c7=['exports'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x62c7,0x107));var _0x762c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x62c7[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x762c('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'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 03f1f7c..430bf7a 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 _0x4cd0=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues'];(function(_0x42dc9c,_0x223c11){var _0x3054d3=function(_0x250a6a){while(--_0x250a6a){_0x42dc9c['push'](_0x42dc9c['shift']());}};_0x3054d3(++_0x223c11);}(_0x4cd0,0x193));var _0x04cd=function(_0x534a20,_0x56c9d8){_0x534a20=_0x534a20-0x0;var _0x6d5320=_0x4cd0[_0x534a20];return _0x6d5320;};'use strict';var _=require(_0x04cd('0x0'));var util=require('util');var logger=require(_0x04cd('0x1'))(_0x04cd('0x2'));var moment=require(_0x04cd('0x3'));var BPromise=require(_0x04cd('0x4'));var rp=require(_0x04cd('0x5'));var fs=require('fs');var path=require(_0x04cd('0x6'));var rimraf=require('rimraf');var config=require(_0x04cd('0x7'));var attributes=require(_0x04cd('0x8'));module[_0x04cd('0x9')]=function(_0x530649,_0x598b7b){return _0x530649[_0x04cd('0xa')](_0x04cd('0xb'),attributes,{'tableName':_0x04cd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d74=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','lodash'];(function(_0x5cfcdc,_0x2119e9){var _0x55fb0e=function(_0x5ba9be){while(--_0x5ba9be){_0x5cfcdc['push'](_0x5cfcdc['shift']());}};_0x55fb0e(++_0x2119e9);}(_0x4d74,0x1ac));var _0x44d7=function(_0x4ce315,_0x388074){_0x4ce315=_0x4ce315-0x0;var _0x1a6160=_0x4d74[_0x4ce315];return _0x1a6160;};'use strict';var _=require(_0x44d7('0x0'));var util=require(_0x44d7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44d7('0x2'));var BPromise=require(_0x44d7('0x3'));var rp=require(_0x44d7('0x4'));var fs=require('fs');var path=require(_0x44d7('0x5'));var rimraf=require(_0x44d7('0x6'));var config=require(_0x44d7('0x7'));var attributes=require(_0x44d7('0x8'));module[_0x44d7('0x9')]=function(_0x2b20dc,_0x5a16f4){return _0x2b20dc['define'](_0x44d7('0xa'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index e89d181..6597556 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 _0x724f=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x15533f,_0x330c5c){var _0x2c2d07=function(_0x117c1){while(--_0x117c1){_0x15533f['push'](_0x15533f['shift']());}};_0x2c2d07(++_0x330c5c);}(_0x724f,0xf3));var _0xf724=function(_0x74cb4e,_0x1af2d4){_0x74cb4e=_0x74cb4e-0x0;var _0x315af9=_0x724f[_0x74cb4e];return _0x315af9;};'use strict';var _=require(_0xf724('0x0'));var util=require(_0xf724('0x1'));var moment=require(_0xf724('0x2'));var BPromise=require(_0xf724('0x3'));var rs=require(_0xf724('0x4'));var fs=require('fs');var Redis=require(_0xf724('0x5'));var db=require(_0xf724('0x6'))['db'];var utils=require(_0xf724('0x7'));var logger=require(_0xf724('0x8'))(_0xf724('0x9'));var config=require(_0xf724('0xa'));var jayson=require(_0xf724('0xb'));var client=jayson[_0xf724('0xc')][_0xf724('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x54f065,_0x155bb9,_0x4718ee){return new BPromise(function(_0x2c4c95,_0x2cf6a7){return client[_0xf724('0xe')](_0x54f065,_0x4718ee)[_0xf724('0xf')](function(_0x4a333c){logger[_0xf724('0x10')](_0xf724('0x11'),_0x155bb9,_0xf724('0x12'));logger[_0xf724('0x13')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x155bb9,'request\x20sent',JSON['stringify'](_0x4a333c));if(_0x4a333c[_0xf724('0x14')]){if(_0x4a333c[_0xf724('0x14')][_0xf724('0x15')]===0x1f4){logger['error'](_0xf724('0x11'),_0x155bb9,_0x4a333c[_0xf724('0x14')][_0xf724('0x16')]);return _0x2cf6a7(_0x4a333c['error'][_0xf724('0x16')]);}logger['error'](_0xf724('0x11'),_0x155bb9,_0x4a333c[_0xf724('0x14')]['message']);return _0x2c4c95(_0x4a333c[_0xf724('0x14')][_0xf724('0x16')]);}else{logger['info'](_0xf724('0x11'),_0x155bb9,_0xf724('0x12'));_0x2c4c95(_0x4a333c['result']['message']);}})[_0xf724('0x17')](function(_0x25937b){logger[_0xf724('0x14')](_0xf724('0x11'),_0x155bb9,_0x25937b);_0x2cf6a7(_0x25937b);});});} \ No newline at end of file +var _0x6702=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x27e36e,_0x5a9c97){var _0x9d4ca6=function(_0x2e5878){while(--_0x2e5878){_0x27e36e['push'](_0x27e36e['shift']());}};_0x9d4ca6(++_0x5a9c97);}(_0x6702,0x119));var _0x2670=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x6702[_0x1a7846];return _0x48049;};'use strict';var _=require('lodash');var util=require(_0x2670('0x0'));var moment=require(_0x2670('0x1'));var BPromise=require(_0x2670('0x2'));var rs=require(_0x2670('0x3'));var fs=require('fs');var Redis=require(_0x2670('0x4'));var db=require(_0x2670('0x5'))['db'];var utils=require(_0x2670('0x6'));var logger=require(_0x2670('0x7'))(_0x2670('0x8'));var config=require(_0x2670('0x9'));var jayson=require(_0x2670('0xa'));var client=jayson['client'][_0x2670('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bf1e8,_0x5d043,_0x88be57){return new BPromise(function(_0x5814c5,_0x25b206){return client['request'](_0x3bf1e8,_0x88be57)['then'](function(_0x5c8002){logger[_0x2670('0xc')](_0x2670('0xd'),_0x5d043,_0x2670('0xe'));logger[_0x2670('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5d043,_0x2670('0xe'),JSON[_0x2670('0x10')](_0x5c8002));if(_0x5c8002['error']){if(_0x5c8002[_0x2670('0x11')]['code']===0x1f4){logger[_0x2670('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x5d043,_0x5c8002[_0x2670('0x11')]['message']);return _0x25b206(_0x5c8002[_0x2670('0x11')][_0x2670('0x12')]);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x5d043,_0x5c8002[_0x2670('0x11')][_0x2670('0x12')]);return _0x5814c5(_0x5c8002['error'][_0x2670('0x12')]);}else{logger['info'](_0x2670('0xd'),_0x5d043,'request\x20sent');_0x5814c5(_0x5c8002['result']['message']);}})[_0x2670('0x13')](function(_0x5a4beb){logger[_0x2670('0x11')](_0x2670('0xd'),_0x5d043,_0x5a4beb);_0x25b206(_0x5a4beb);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 8a595dc..65895ad 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x13fb6c,_0x228db4){var _0x3fb4f0=function(_0x6ea79c){while(--_0x6ea79c){_0x13fb6c['push'](_0x13fb6c['shift']());}};_0x3fb4f0(++_0x228db4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0xcb91[_0x425716];return _0x2d39af;};'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(_0x1e32d6,_0x503da9){var _0x4eb0a8=function(_0x4567fa){while(--_0x4567fa){_0x1e32d6['push'](_0x1e32d6['shift']());}};_0x4eb0a8(++_0x503da9);}(_0x70e0,0x17b));var _0x070e=function(_0x234dc1,_0x299b30){_0x234dc1=_0x234dc1-0x0;var _0x5b1109=_0x70e0[_0x234dc1];return _0x5b1109;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index ebd98a8..c58ee76 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 _0x8a87=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x5bf1df,_0x562032){var _0x33e922=function(_0x3b7869){while(--_0x3b7869){_0x5bf1df['push'](_0x5bf1df['shift']());}};_0x33e922(++_0x562032);}(_0x8a87,0x1b9));var _0x78a8=function(_0x5ae1a2,_0x3601ba){_0x5ae1a2=_0x5ae1a2-0x0;var _0x9ac42f=_0x8a87[_0x5ae1a2];return _0x9ac42f;};'use strict';var Sequelize=require(_0x78a8('0x0'));module[_0x78a8('0x1')]={'uniqueid':{'type':Sequelize[_0x78a8('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x78a8('0x3')},'membername':{'type':Sequelize[_0x78a8('0x4')],'allowNull':![],'comment':_0x78a8('0x3')},'UserId':{'type':Sequelize[_0x78a8('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x78a8('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x78a8('0x3')},'VoiceQueueId':{'type':Sequelize[_0x78a8('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x78a8('0x4')],'allowNull':![],'unique':_0x78a8('0x5'),'comment':_0x78a8('0x3')},'penalty':{'type':Sequelize[_0x78a8('0x2')](0xb),'defaultValue':0x0,'comment':_0x78a8('0x3')},'paused':{'type':Sequelize[_0x78a8('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x8113=['queue_interface','INTEGER','STRING','Required\x20by\x20Asterisk'];(function(_0x48bbef,_0x4537e5){var _0x1906d0=function(_0x4ebaa6){while(--_0x4ebaa6){_0x48bbef['push'](_0x48bbef['shift']());}};_0x1906d0(++_0x4537e5);}(_0x8113,0x1d5));var _0x3811=function(_0x2bcdc1,_0xd86a4d){_0x2bcdc1=_0x2bcdc1-0x0;var _0x1424f0=_0x8113[_0x2bcdc1];return _0x1424f0;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x3811('0x0')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x3811('0x1')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x3811('0x0')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x3811('0x1')],'allowNull':![],'unique':'queue_interface','comment':_0x3811('0x2')},'VoiceQueueId':{'type':Sequelize[_0x3811('0x0')],'allowNull':![]},'interface':{'type':Sequelize[_0x3811('0x1')],'allowNull':![],'unique':_0x3811('0x3'),'comment':_0x3811('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x3811('0x2')},'paused':{'type':Sequelize[_0x3811('0x0')](0xb),'defaultValue':0x0,'comment':_0x3811('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 5341b79..603047b 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 _0x932d=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','UserVoiceQueueRt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x932d,0x98));var _0xd932=function(_0x53e379,_0x5a8e85){_0x53e379=_0x53e379-0x0;var _0x41df75=_0x932d[_0x53e379];return _0x41df75;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xd932('0x0'))['db'][_0xd932('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd932('0x2'),'afterDestroy':_0xd932('0x3')};function emitEvent(_0x18f21a){return function(_0x3c83a0,_0x370afa,_0x31082d){UserVoiceQueueRtEvents[_0xd932('0x4')](_0x18f21a+':'+_0x3c83a0['id'],_0x3c83a0);UserVoiceQueueRtEvents[_0xd932('0x4')](_0x18f21a,_0x3c83a0);_0x31082d(null);};}for(var e in events){if(events[_0xd932('0x5')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xd932('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x3b5d=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x4ef734,_0x5826d){var _0x33a7cb=function(_0x127a2b){while(--_0x127a2b){_0x4ef734['push'](_0x4ef734['shift']());}};_0x33a7cb(++_0x5826d);}(_0x3b5d,0x1b3));var _0xd3b5=function(_0x403fe9,_0x4853f0){_0x403fe9=_0x403fe9-0x0;var _0x9b5e77=_0x3b5d[_0x403fe9];return _0x9b5e77;};'use strict';var EventEmitter=require(_0xd3b5('0x0'));var UserVoiceQueueRt=require(_0xd3b5('0x1'))['db'][_0xd3b5('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xd3b5('0x3')](0x0);var events={'afterCreate':_0xd3b5('0x4'),'afterUpdate':_0xd3b5('0x5'),'afterDestroy':_0xd3b5('0x6')};function emitEvent(_0x457414){return function(_0x18a47c,_0x2fc098,_0x31f3f3){UserVoiceQueueRtEvents[_0xd3b5('0x7')](_0x457414+':'+_0x18a47c['id'],_0x18a47c);UserVoiceQueueRtEvents[_0xd3b5('0x7')](_0x457414,_0x18a47c);_0x31f3f3(null);};}for(var e in events){if(events[_0xd3b5('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0xd3b5('0x9')](e,emitEvent(event));}}module[_0xd3b5('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index ac5531f..c191ca6 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 _0x229a=['api','moment','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x5d23ab,_0xecae24){var _0x2553ad=function(_0x5c8efe){while(--_0x5c8efe){_0x5d23ab['push'](_0x5d23ab['shift']());}};_0x2553ad(++_0xecae24);}(_0x229a,0xdc));var _0xa229=function(_0x3626ad,_0xae31a9){_0x3626ad=_0x3626ad-0x0;var _0x2d9b1c=_0x229a[_0x3626ad];return _0x2d9b1c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa229('0x0'));var moment=require(_0xa229('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa229('0x2'));var rimraf=require(_0xa229('0x3'));var config=require(_0xa229('0x4'));var attributes=require(_0xa229('0x5'));module[_0xa229('0x6')]=function(_0x2639e1,_0x17ff2f){return _0x2639e1[_0xa229('0x7')](_0xa229('0x8'),attributes,{'tableName':_0xa229('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcceb=['bluebird','request-promise','path','../../config/environment','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment'];(function(_0x447347,_0x29548b){var _0x29a403=function(_0x26683a){while(--_0x26683a){_0x447347['push'](_0x447347['shift']());}};_0x29a403(++_0x29548b);}(_0xcceb,0x174));var _0xbcce=function(_0x327f66,_0x188d77){_0x327f66=_0x327f66-0x0;var _0x31f70a=_0xcceb[_0x327f66];return _0x31f70a;};'use strict';var _=require(_0xbcce('0x0'));var util=require(_0xbcce('0x1'));var logger=require(_0xbcce('0x2'))(_0xbcce('0x3'));var moment=require(_0xbcce('0x4'));var BPromise=require(_0xbcce('0x5'));var rp=require(_0xbcce('0x6'));var fs=require('fs');var path=require(_0xbcce('0x7'));var rimraf=require('rimraf');var config=require(_0xbcce('0x8'));var attributes=require('./userVoiceQueueRt.attributes');module[_0xbcce('0x9')]=function(_0x3c6e96,_0x5b49d7){return _0x3c6e96[_0xbcce('0xa')](_0xbcce('0xb'),attributes,{'tableName':_0xbcce('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 1214ff5..50a9e3d 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 _0x7014=['debug','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceQueueRtPauses','findAll','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','redis','defaults','./userVoiceQueueRt.socket','request','then','UserVoiceQueueRt,\x20%s,\x20%s'];(function(_0x230977,_0x297427){var _0x2692f8=function(_0x2a912c){while(--_0x2a912c){_0x230977['push'](_0x230977['shift']());}};_0x2692f8(++_0x297427);}(_0x7014,0xcc));var _0x4701=function(_0x4215f6,_0x292474){_0x4215f6=_0x4215f6-0x0;var _0x2fc4ef=_0x7014[_0x4215f6];return _0x2fc4ef;};'use strict';var _=require('lodash');var util=require(_0x4701('0x0'));var moment=require('moment');var BPromise=require(_0x4701('0x1'));var rs=require(_0x4701('0x2'));var fs=require('fs');var Redis=require(_0x4701('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4701('0x4'));var logger=require('../../config/logger')(_0x4701('0x5'));var config=require('../../config/environment');var jayson=require(_0x4701('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x4701('0x7')]=_[_0x4701('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4701('0x9'))['register'](socket);function respondWithRpcPromise(_0x545600,_0x35c4bb,_0x1d9c80){return new BPromise(function(_0x372e22,_0xce7cdc){return client[_0x4701('0xa')](_0x545600,_0x1d9c80)[_0x4701('0xb')](function(_0xd7c5fb){logger['info'](_0x4701('0xc'),_0x35c4bb,'request\x20sent');logger[_0x4701('0xd')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x35c4bb,_0x4701('0xe'),JSON[_0x4701('0xf')](_0xd7c5fb));if(_0xd7c5fb[_0x4701('0x10')]){if(_0xd7c5fb[_0x4701('0x10')][_0x4701('0x11')]===0x1f4){logger[_0x4701('0x10')](_0x4701('0xc'),_0x35c4bb,_0xd7c5fb[_0x4701('0x10')][_0x4701('0x12')]);return _0xce7cdc(_0xd7c5fb[_0x4701('0x10')]['message']);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x35c4bb,_0xd7c5fb[_0x4701('0x10')][_0x4701('0x12')]);return _0x372e22(_0xd7c5fb[_0x4701('0x10')]['message']);}else{logger[_0x4701('0x13')](_0x4701('0xc'),_0x35c4bb,_0x4701('0xe'));_0x372e22(_0xd7c5fb[_0x4701('0x14')][_0x4701('0x12')]);}})[_0x4701('0x15')](function(_0x141e4f){logger[_0x4701('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x35c4bb,_0x141e4f);_0xce7cdc(_0x141e4f);});});}exports[_0x4701('0x16')]=function(_0x2ffc08){var _0x4f563c=this;return new Promise(function(_0x37b958,_0xd531f3){return db['UserVoiceQueueRt'][_0x4701('0x17')]({'raw':_0x2ffc08[_0x4701('0x18')]?_0x2ffc08['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ffc08['options']?_0x2ffc08[_0x4701('0x18')][_0x4701('0x19')]||null:null,'attributes':[[db[_0x4701('0x1a')]['fn'](_0x4701('0x1b'),db['sequelize']['fn']('IF',db[_0x4701('0x1a')][_0x4701('0x1c')](_0x4701('0x1d')))),_0x4701('0x1e')]]})[_0x4701('0xb')](function(_0x1cd196){logger[_0x4701('0x13')](_0x4701('0x16'),_0x2ffc08);logger[_0x4701('0xd')](_0x4701('0x16'),_0x2ffc08,JSON[_0x4701('0xf')](_0x1cd196));_0x37b958(_0x1cd196);})[_0x4701('0x15')](function(_0x59093b){logger[_0x4701('0x10')](_0x4701('0x16'),_0x59093b['message'],_0x2ffc08);_0xd531f3(_0x4f563c[_0x4701('0x10')](0x1f4,_0x59093b['message']));});});}; \ No newline at end of file +var _0x1fe3=['result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','stringify','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x1fe3,0x1bb));var _0x31fe=function(_0x536999,_0x75813f){_0x536999=_0x536999-0x0;var _0x3aaa8e=_0x1fe3[_0x536999];return _0x3aaa8e;};'use strict';var _=require('lodash');var util=require(_0x31fe('0x0'));var moment=require(_0x31fe('0x1'));var BPromise=require(_0x31fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x31fe('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x31fe('0x4'));var logger=require(_0x31fe('0x5'))('rpc');var config=require(_0x31fe('0x6'));var jayson=require(_0x31fe('0x7'));var client=jayson[_0x31fe('0x8')][_0x31fe('0x9')]({'port':0x232a});config['redis']=_[_0x31fe('0xa')](config[_0x31fe('0xb')],{'host':_0x31fe('0xc'),'port':0x18eb});var socket=require(_0x31fe('0xd'))(new Redis(config[_0x31fe('0xb')]));require(_0x31fe('0xe'))[_0x31fe('0xf')](socket);function respondWithRpcPromise(_0x2d3e94,_0x4a4995,_0x65ccca){return new BPromise(function(_0x2810c1,_0x2edd45){return client['request'](_0x2d3e94,_0x65ccca)[_0x31fe('0x10')](function(_0x2f3ea7){logger[_0x31fe('0x11')](_0x31fe('0x12'),_0x4a4995,'request\x20sent');logger[_0x31fe('0x13')](_0x31fe('0x14'),_0x4a4995,_0x31fe('0x15'),JSON['stringify'](_0x2f3ea7));if(_0x2f3ea7[_0x31fe('0x16')]){if(_0x2f3ea7[_0x31fe('0x16')][_0x31fe('0x17')]===0x1f4){logger[_0x31fe('0x16')](_0x31fe('0x12'),_0x4a4995,_0x2f3ea7[_0x31fe('0x16')][_0x31fe('0x18')]);return _0x2edd45(_0x2f3ea7[_0x31fe('0x16')][_0x31fe('0x18')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x4a4995,_0x2f3ea7[_0x31fe('0x16')][_0x31fe('0x18')]);return _0x2810c1(_0x2f3ea7[_0x31fe('0x16')][_0x31fe('0x18')]);}else{logger[_0x31fe('0x11')](_0x31fe('0x12'),_0x4a4995,_0x31fe('0x15'));_0x2810c1(_0x2f3ea7[_0x31fe('0x19')][_0x31fe('0x18')]);}})['catch'](function(_0x3fa675){logger[_0x31fe('0x16')](_0x31fe('0x12'),_0x4a4995,_0x3fa675);_0x2edd45(_0x3fa675);});});}exports[_0x31fe('0x1a')]=function(_0x51bc94){var _0x108f0d=this;return new Promise(function(_0x56d534,_0x12f38b){return db[_0x31fe('0x1b')][_0x31fe('0x1c')]({'raw':_0x51bc94['options']?_0x51bc94[_0x31fe('0x1d')][_0x31fe('0x1e')]===undefined?!![]:![]:!![],'where':_0x51bc94['options']?_0x51bc94['options']['where']||null:null,'attributes':[[db[_0x31fe('0x1f')]['fn'](_0x31fe('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x31fe('0x21')](_0x31fe('0x22')))),'outboundQueuePauses']]})[_0x31fe('0x10')](function(_0x5ce028){logger[_0x31fe('0x11')](_0x31fe('0x1a'),_0x51bc94);logger[_0x31fe('0x13')](_0x31fe('0x1a'),_0x51bc94,JSON[_0x31fe('0x23')](_0x5ce028));_0x56d534(_0x5ce028);})['catch'](function(_0x5f29bd){logger[_0x31fe('0x16')]('GetVoiceQueueRtPauses',_0x5f29bd['message'],_0x51bc94);_0x12f38b(_0x108f0d[_0x31fe('0x16')](0x1f4,_0x5f29bd[_0x31fe('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 56aaa97..42fce0a 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 _0xcd59=['remove','update','emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x4e9299,_0x3cd8fd){var _0x36a175=function(_0x5d5c0a){while(--_0x5d5c0a){_0x4e9299['push'](_0x4e9299['shift']());}};_0x36a175(++_0x3cd8fd);}(_0xcd59,0x14b));var _0x9cd5=function(_0x54b5bd,_0x133fe1){_0x54b5bd=_0x54b5bd-0x0;var _0xcba844=_0xcd59[_0x54b5bd];return _0xcba844;};'use strict';var UserVoiceQueueRtEvents=require(_0x9cd5('0x0'));var events=[_0x9cd5('0x1'),_0x9cd5('0x2'),_0x9cd5('0x3')];function createListener(_0x271070,_0x302b21){return function(_0x4b93b9){_0x302b21[_0x9cd5('0x4')](_0x271070,_0x4b93b9);};}function removeListener(_0x191236,_0xf96efa){return function(){UserVoiceQueueRtEvents[_0x9cd5('0x5')](_0x191236,_0xf96efa);};}exports[_0x9cd5('0x6')]=function(_0x2db192){for(var _0x46277c=0x0,_0x2cd19a=events[_0x9cd5('0x7')];_0x46277c<_0x2cd19a;_0x46277c++){var _0x3f888f=events[_0x46277c];var _0x545407=createListener(_0x9cd5('0x8')+_0x3f888f,_0x2db192);UserVoiceQueueRtEvents['on'](_0x3f888f,_0x545407);}}; \ No newline at end of file +var _0x0763=['remove','update','emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x2e3bdd,_0x4ef4e1){var _0x3f750f=function(_0x2e66c2){while(--_0x2e66c2){_0x2e3bdd['push'](_0x2e3bdd['shift']());}};_0x3f750f(++_0x4ef4e1);}(_0x0763,0x87));var _0x3076=function(_0x155839,_0x3f679d){_0x155839=_0x155839-0x0;var _0x51d322=_0x0763[_0x155839];return _0x51d322;};'use strict';var UserVoiceQueueRtEvents=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(){UserVoiceQueueRtEvents[_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);UserVoiceQueueRtEvents['on'](_0x2776c8,_0xf1ee41);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 6d9fd22..55ddde0 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(_0x199394,_0x3d0297){var _0x61e770=function(_0x4615ba){while(--_0x4615ba){_0x199394['push'](_0x199394['shift']());}};_0x61e770(++_0x3d0297);}(_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 +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x291ec3,_0x2f19a7){var _0x423b99=function(_0x345ddd){while(--_0x345ddd){_0x291ec3['push'](_0x291ec3['shift']());}};_0x423b99(++_0x2f19a7);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index db651f5..4a0bdc6 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 _0x612d=['exports','INTEGER','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x612d,0x158));var _0xd612=function(_0x1922d2,_0x224ada){_0x1922d2=_0x1922d2-0x0;var _0x268072=_0x612d[_0x1922d2];return _0x268072;};'use strict';var Sequelize=require(_0xd612('0x0'));module[_0xd612('0x1')]={'penalty':{'type':Sequelize[_0xd612('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8da9=['exports','INTEGER'];(function(_0x2be02f,_0x1d7527){var _0x2e11ba=function(_0x170b9f){while(--_0x170b9f){_0x2be02f['push'](_0x2be02f['shift']());}};_0x2e11ba(++_0x1d7527);}(_0x8da9,0x1be));var _0x98da=function(_0x3e6b4e,_0x31ee41){_0x3e6b4e=_0x3e6b4e-0x0;var _0x5296af=_0x8da9[_0x3e6b4e];return _0x5296af;};'use strict';var Sequelize=require('sequelize');module[_0x98da('0x0')]={'penalty':{'type':Sequelize[_0x98da('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 35126d8..cdce686 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 _0xd1a5=['util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash'];(function(_0x39a9ce,_0x3b1e38){var _0x2645e1=function(_0xf6e152){while(--_0xf6e152){_0x39a9ce['push'](_0x39a9ce['shift']());}};_0x2645e1(++_0x3b1e38);}(_0xd1a5,0xef));var _0x5d1a=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xd1a5[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x5d1a('0x0'));var util=require(_0x5d1a('0x1'));var logger=require(_0x5d1a('0x2'))(_0x5d1a('0x3'));var moment=require(_0x5d1a('0x4'));var BPromise=require(_0x5d1a('0x5'));var rp=require(_0x5d1a('0x6'));var fs=require('fs');var path=require(_0x5d1a('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0x5d1a('0x8')]=function(_0x80e7b2,_0x57e949){return _0x80e7b2[_0x5d1a('0x9')](_0x5d1a('0xa'),attributes,{'tableName':_0x5d1a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8fe=['request-promise','path','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x503254,_0x29e551){var _0x383dcc=function(_0x3c27fb){while(--_0x3c27fb){_0x503254['push'](_0x503254['shift']());}};_0x383dcc(++_0x29e551);}(_0xd8fe,0x192));var _0xed8f=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0xd8fe[_0x30cd7e];return _0x462a02;};'use strict';var _=require(_0xed8f('0x0'));var util=require(_0xed8f('0x1'));var logger=require(_0xed8f('0x2'))(_0xed8f('0x3'));var moment=require(_0xed8f('0x4'));var BPromise=require(_0xed8f('0x5'));var rp=require(_0xed8f('0x6'));var fs=require('fs');var path=require(_0xed8f('0x7'));var rimraf=require(_0xed8f('0x8'));var config=require(_0xed8f('0x9'));var attributes=require('./userWhatsappQueue.attributes');module[_0xed8f('0xa')]=function(_0x423344,_0x1b721d){return _0x423344[_0xed8f('0xb')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','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 75ad625..778798a 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 _0x0a1a=['UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x5575cd,_0x73ab7a){var _0x4979a0=function(_0x1ac744){while(--_0x1ac744){_0x5575cd['push'](_0x5575cd['shift']());}};_0x4979a0(++_0x73ab7a);}(_0x0a1a,0x183));var _0xa0a1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0a1a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa0a1('0x0'));var util=require(_0xa0a1('0x1'));var moment=require(_0xa0a1('0x2'));var BPromise=require('bluebird');var rs=require(_0xa0a1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa0a1('0x4'));var logger=require(_0xa0a1('0x5'))('rpc');var config=require(_0xa0a1('0x6'));var jayson=require(_0xa0a1('0x7'));var client=jayson[_0xa0a1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20c2c4,_0x33eeab,_0x2346a2){return new BPromise(function(_0x17f3b9,_0x49b6b8){return client[_0xa0a1('0x9')](_0x20c2c4,_0x2346a2)[_0xa0a1('0xa')](function(_0x13ddd2){logger[_0xa0a1('0xb')](_0xa0a1('0xc'),_0x33eeab,_0xa0a1('0xd'));logger[_0xa0a1('0xe')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x33eeab,'request\x20sent',JSON['stringify'](_0x13ddd2));if(_0x13ddd2[_0xa0a1('0xf')]){if(_0x13ddd2[_0xa0a1('0xf')][_0xa0a1('0x10')]===0x1f4){logger['error'](_0xa0a1('0xc'),_0x33eeab,_0x13ddd2[_0xa0a1('0xf')][_0xa0a1('0x11')]);return _0x49b6b8(_0x13ddd2[_0xa0a1('0xf')][_0xa0a1('0x11')]);}logger[_0xa0a1('0xf')](_0xa0a1('0xc'),_0x33eeab,_0x13ddd2[_0xa0a1('0xf')][_0xa0a1('0x11')]);return _0x17f3b9(_0x13ddd2[_0xa0a1('0xf')]['message']);}else{logger[_0xa0a1('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0x33eeab,'request\x20sent');_0x17f3b9(_0x13ddd2['result'][_0xa0a1('0x11')]);}})[_0xa0a1('0x12')](function(_0x197141){logger['error'](_0xa0a1('0xc'),_0x33eeab,_0x197141);_0x49b6b8(_0x197141);});});} \ No newline at end of file +var _0x0882=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x3a1ad9,_0x55935e){var _0x50e2d2=function(_0x1f20f6){while(--_0x1f20f6){_0x3a1ad9['push'](_0x3a1ad9['shift']());}};_0x50e2d2(++_0x55935e);}(_0x0882,0x111));var _0x2088=function(_0x47623f,_0x148f3a){_0x47623f=_0x47623f-0x0;var _0x282ce8=_0x0882[_0x47623f];return _0x282ce8;};'use strict';var _=require('lodash');var util=require(_0x2088('0x0'));var moment=require(_0x2088('0x1'));var BPromise=require(_0x2088('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2088('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2088('0x4'));var logger=require(_0x2088('0x5'))(_0x2088('0x6'));var config=require(_0x2088('0x7'));var jayson=require(_0x2088('0x8'));var client=jayson['client'][_0x2088('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14a325,_0x1cda5a,_0x1ff533){return new BPromise(function(_0x583611,_0x35a6e9){return client['request'](_0x14a325,_0x1ff533)[_0x2088('0xa')](function(_0x549f24){logger[_0x2088('0xb')](_0x2088('0xc'),_0x1cda5a,'request\x20sent');logger[_0x2088('0xd')](_0x2088('0xe'),_0x1cda5a,_0x2088('0xf'),JSON['stringify'](_0x549f24));if(_0x549f24['error']){if(_0x549f24[_0x2088('0x10')][_0x2088('0x11')]===0x1f4){logger[_0x2088('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1cda5a,_0x549f24[_0x2088('0x10')][_0x2088('0x12')]);return _0x35a6e9(_0x549f24[_0x2088('0x10')][_0x2088('0x12')]);}logger['error'](_0x2088('0xc'),_0x1cda5a,_0x549f24['error'][_0x2088('0x12')]);return _0x583611(_0x549f24[_0x2088('0x10')][_0x2088('0x12')]);}else{logger[_0x2088('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1cda5a,_0x2088('0xf'));_0x583611(_0x549f24[_0x2088('0x13')][_0x2088('0x12')]);}})[_0x2088('0x14')](function(_0x1a6c34){logger[_0x2088('0x10')](_0x2088('0xc'),_0x1cda5a,_0x1a6c34);_0x35a6e9(_0x1a6c34);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 9f9afbe..ca521c7 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 _0x1e19=['show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id'];(function(_0x5627db,_0x541471){var _0x4af1b1=function(_0x11f6f6){while(--_0x11f6f6){_0x5627db['push'](_0x5627db['shift']());}};_0x4af1b1(++_0x541471);}(_0x1e19,0x1c9));var _0x91e1=function(_0x43b487,_0x21893a){_0x43b487=_0x43b487-0x0;var _0x2f707a=_0x1e19[_0x43b487];return _0x2f707a;};'use strict';var multer=require(_0x91e1('0x0'));var util=require(_0x91e1('0x1'));var path=require(_0x91e1('0x2'));var timeout=require(_0x91e1('0x3'));var express=require(_0x91e1('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x91e1('0x5'));var controller=require(_0x91e1('0x6'));router[_0x91e1('0x7')]('/',auth[_0x91e1('0x8')](),controller[_0x91e1('0x9')]);router['get'](_0x91e1('0xa'),auth['isAuthenticated'](),controller[_0x91e1('0xb')]);router[_0x91e1('0xc')]('/',auth[_0x91e1('0x8')](),controller[_0x91e1('0xd')]);router[_0x91e1('0xe')]('/:id',auth[_0x91e1('0x8')](),controller[_0x91e1('0xf')]);router['delete'](_0x91e1('0xa'),auth[_0x91e1('0x8')](),controller[_0x91e1('0x10')]);module[_0x91e1('0x11')]=router; \ No newline at end of file +var _0x9c44=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./variable.controller','isAuthenticated','index','get','/:id','post','create','put','update'];(function(_0x4d7a8b,_0x3afdcd){var _0x9b5113=function(_0x1a529f){while(--_0x1a529f){_0x4d7a8b['push'](_0x4d7a8b['shift']());}};_0x9b5113(++_0x3afdcd);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'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('0xb')]('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router[_0x49c4('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0xe')]);router[_0x49c4('0xf')]('/:id',auth[_0x49c4('0x7')](),controller[_0x49c4('0x10')]);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 73ce567..bd8c7cd 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 _0xf774=['sequelize','STRING','name'];(function(_0x2fbbb2,_0x2fc143){var _0x513adc=function(_0x1e340b){while(--_0x1e340b){_0x2fbbb2['push'](_0x2fbbb2['shift']());}};_0x513adc(++_0x2fc143);}(_0xf774,0xae));var _0x4f77=function(_0x4fa163,_0x48e95b){_0x4fa163=_0x4fa163-0x0;var _0x74ab05=_0xf774[_0x4fa163];return _0x74ab05;};'use strict';var Sequelize=require(_0x4f77('0x0'));module['exports']={'name':{'type':Sequelize[_0x4f77('0x1')],'unique':_0x4f77('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4f77('0x1')]}}; \ No newline at end of file +var _0x4e8b=['name','sequelize','exports','STRING'];(function(_0x109f59,_0x26443b){var _0xf84297=function(_0x47e4a9){while(--_0x47e4a9){_0x109f59['push'](_0x109f59['shift']());}};_0xf84297(++_0x26443b);}(_0x4e8b,0x159));var _0xb4e8=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x4e8b[_0x34325b];return _0x3da348;};'use strict';var Sequelize=require(_0xb4e8('0x0'));module[_0xb4e8('0x1')]={'name':{'type':Sequelize[_0xb4e8('0x2')],'unique':_0xb4e8('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb4e8('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 2fe3167..df485f5 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 _0xd2cc=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','get','Variables','UserProfileResource','end','error','stack','name','send','index','fieldName','type','key','model','query','keys','attributes','fields','length','nolimit','order','where','filters','filter','merge','map','VIRTUAL','options','includeAll','include','Variable','findAll','catch','show','intersection','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x8e7b1f,_0x417ff5){var _0x322663=function(_0x1c2933){while(--_0x1c2933){_0x8e7b1f['push'](_0x8e7b1f['shift']());}};_0x322663(++_0x417ff5);}(_0xd2cc,0x1c5));var _0xcd2c=function(_0x526408,_0x585982){_0x526408=_0x526408-0x0;var _0x3f66e3=_0xd2cc[_0x526408];return _0x3f66e3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd2c('0x0'));var zipdir=require(_0xcd2c('0x1'));var jsonpatch=require(_0xcd2c('0x2'));var rp=require('request-promise');var moment=require(_0xcd2c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcd2c('0x4'));var util=require('util');var path=require('path');var sox=require(_0xcd2c('0x5'));var csv=require(_0xcd2c('0x6'));var ejs=require(_0xcd2c('0x7'));var fs=require('fs');var fs_extra=require(_0xcd2c('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcd2c('0x6'));var querystring=require('querystring');var Papa=require(_0xcd2c('0x9'));var Redis=require(_0xcd2c('0xa'));var authService=require(_0xcd2c('0xb'));var qs=require(_0xcd2c('0xc'));var as=require(_0xcd2c('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd2c('0xe'))(_0xcd2c('0xf'));var utils=require(_0xcd2c('0x10'));var config=require(_0xcd2c('0x11'));var licenseUtil=require(_0xcd2c('0x12'));var db=require(_0xcd2c('0x13'))['db'];function respondWithStatusCode(_0x33fb16,_0x2f815f){_0x2f815f=_0x2f815f||0xcc;return function(_0x2f749f){if(_0x2f749f){return _0x33fb16[_0xcd2c('0x14')](_0x2f815f);}return _0x33fb16['status'](_0x2f815f)['end']();};}function respondWithResult(_0x214f08,_0x4e413c){_0x4e413c=_0x4e413c||0xc8;return function(_0x524c61){if(_0x524c61){return _0x214f08[_0xcd2c('0x15')](_0x4e413c)[_0xcd2c('0x16')](_0x524c61);}};}function respondWithFilteredResult(_0x5f2f54,_0x18efdd){return function(_0xe664fc){if(_0xe664fc){var _0xa43aaa=typeof _0x18efdd[_0xcd2c('0x17')]===_0xcd2c('0x18')&&typeof _0x18efdd[_0xcd2c('0x19')]==='undefined';var _0x3599b0=_0xe664fc[_0xcd2c('0x1a')];var _0x13a8c4=_0xa43aaa?0x0:_0x18efdd[_0xcd2c('0x17')];var _0x539d9a=_0xa43aaa?_0xe664fc[_0xcd2c('0x1a')]:_0x18efdd[_0xcd2c('0x17')]+_0x18efdd[_0xcd2c('0x19')];var _0x13cbf9;if(_0x539d9a>=_0x3599b0){_0x539d9a=_0x3599b0;_0x13cbf9=0xc8;}else{_0x13cbf9=0xce;}_0x5f2f54[_0xcd2c('0x15')](_0x13cbf9);return _0x5f2f54['set'](_0xcd2c('0x1b'),_0x13a8c4+'-'+_0x539d9a+'/'+_0x3599b0)[_0xcd2c('0x16')](_0xe664fc);}return null;};}function patchUpdates(_0x6b5226){return function(_0x3de6ae){try{jsonpatch[_0xcd2c('0x1c')](_0x3de6ae,_0x6b5226,!![]);}catch(_0x1c546b){return BPromise[_0xcd2c('0x1d')](_0x1c546b);}return _0x3de6ae[_0xcd2c('0x1e')]();};}function saveUpdates(_0x68d417,_0x30e39b){return function(_0x2a4916){if(_0x2a4916){return _0x2a4916[_0xcd2c('0x1f')](_0x68d417)['then'](function(_0x85c4d9){return _0x85c4d9;});}return null;};}function removeEntity(_0xaef2cf,_0xf07775){return function(_0x119446){if(_0x119446){return _0x119446[_0xcd2c('0x20')]()[_0xcd2c('0x21')](function(){var _0x3f3b3d=_0x119446[_0xcd2c('0x22')]({'plain':!![]});var _0x43b64e=_0xcd2c('0x23');return db[_0xcd2c('0x24')][_0xcd2c('0x20')]({'where':{'type':_0x43b64e,'resourceId':_0x3f3b3d['id']}})['then'](function(){return _0x119446;});})[_0xcd2c('0x21')](function(){_0xaef2cf[_0xcd2c('0x15')](0xcc)[_0xcd2c('0x25')]();});}};}function handleEntityNotFound(_0x1db509,_0x3f25e2){return function(_0x558f1e){if(!_0x558f1e){_0x1db509[_0xcd2c('0x14')](0x194);}return _0x558f1e;};}function handleError(_0x171b0a,_0x36453f){_0x36453f=_0x36453f||0x1f4;return function(_0x44a46b){logger[_0xcd2c('0x26')](_0x44a46b[_0xcd2c('0x27')]);if(_0x44a46b['name']){delete _0x44a46b[_0xcd2c('0x28')];}_0x171b0a[_0xcd2c('0x15')](_0x36453f)[_0xcd2c('0x29')](_0x44a46b);};}exports[_0xcd2c('0x2a')]=function(_0x3f903e,_0x26c2c1){var _0x3dff0b={},_0x4c028e={},_0x284711={'count':0x0,'rows':[]};var _0x25edaf=_['map'](db['Variable']['rawAttributes'],function(_0x4994bd){return{'name':_0x4994bd[_0xcd2c('0x2b')],'type':_0x4994bd[_0xcd2c('0x2c')][_0xcd2c('0x2d')]};});_0x4c028e[_0xcd2c('0x2e')]=_['map'](_0x25edaf,_0xcd2c('0x28'));_0x4c028e[_0xcd2c('0x2f')]=_[_0xcd2c('0x30')](_0x3f903e['query']);_0x4c028e['filters']=_['intersection'](_0x4c028e[_0xcd2c('0x2e')],_0x4c028e[_0xcd2c('0x2f')]);_0x3dff0b[_0xcd2c('0x31')]=_['intersection'](_0x4c028e[_0xcd2c('0x2e')],qs[_0xcd2c('0x32')](_0x3f903e[_0xcd2c('0x2f')]['fields']));_0x3dff0b['attributes']=_0x3dff0b[_0xcd2c('0x31')][_0xcd2c('0x33')]?_0x3dff0b[_0xcd2c('0x31')]:_0x4c028e[_0xcd2c('0x2e')];if(!_0x3f903e[_0xcd2c('0x2f')]['hasOwnProperty'](_0xcd2c('0x34'))){_0x3dff0b[_0xcd2c('0x19')]=qs['limit'](_0x3f903e['query']['limit']);_0x3dff0b[_0xcd2c('0x17')]=qs['offset'](_0x3f903e['query'][_0xcd2c('0x17')]);}_0x3dff0b[_0xcd2c('0x35')]=qs['sort'](_0x3f903e[_0xcd2c('0x2f')]['sort']);_0x3dff0b[_0xcd2c('0x36')]=qs['filters'](_['pick'](_0x3f903e[_0xcd2c('0x2f')],_0x4c028e[_0xcd2c('0x37')]),_0x25edaf);if(_0x3f903e[_0xcd2c('0x2f')][_0xcd2c('0x38')]){_0x3dff0b[_0xcd2c('0x36')]=_[_0xcd2c('0x39')](_0x3dff0b[_0xcd2c('0x36')],{'$or':_[_0xcd2c('0x3a')](_0x25edaf,function(_0x4f8329){if(_0x4f8329['type']!==_0xcd2c('0x3b')){var _0x5fde9b={};_0x5fde9b[_0x4f8329['name']]={'$like':'%'+_0x3f903e[_0xcd2c('0x2f')][_0xcd2c('0x38')]+'%'};return _0x5fde9b;}})});}_0x3dff0b=_[_0xcd2c('0x39')]({},_0x3dff0b,_0x3f903e[_0xcd2c('0x3c')]);var _0x314bd9={'where':_0x3dff0b[_0xcd2c('0x36')]};return db['Variable'][_0xcd2c('0x1a')](_0x314bd9)[_0xcd2c('0x21')](function(_0x383d40){_0x284711[_0xcd2c('0x1a')]=_0x383d40;if(_0x3f903e[_0xcd2c('0x2f')][_0xcd2c('0x3d')]){_0x3dff0b[_0xcd2c('0x3e')]=[{'all':!![]}];}return db[_0xcd2c('0x3f')][_0xcd2c('0x40')](_0x3dff0b);})[_0xcd2c('0x21')](function(_0x3222cf){_0x284711['rows']=_0x3222cf;return _0x284711;})[_0xcd2c('0x21')](respondWithFilteredResult(_0x26c2c1,_0x3dff0b))[_0xcd2c('0x41')](handleError(_0x26c2c1,null));};exports[_0xcd2c('0x42')]=function(_0x299e36,_0x4899a9){var _0x44aea9={'raw':!![],'where':{'id':_0x299e36['params']['id']}},_0x3a6bd6={};_0x3a6bd6[_0xcd2c('0x2e')]=_[_0xcd2c('0x30')](db[_0xcd2c('0x3f')]['rawAttributes']);_0x3a6bd6[_0xcd2c('0x2f')]=_['keys'](_0x299e36[_0xcd2c('0x2f')]);_0x3a6bd6[_0xcd2c('0x37')]=_[_0xcd2c('0x43')](_0x3a6bd6[_0xcd2c('0x2e')],_0x3a6bd6['query']);_0x44aea9[_0xcd2c('0x31')]=_['intersection'](_0x3a6bd6[_0xcd2c('0x2e')],qs[_0xcd2c('0x32')](_0x299e36[_0xcd2c('0x2f')]['fields']));_0x44aea9['attributes']=_0x44aea9[_0xcd2c('0x31')][_0xcd2c('0x33')]?_0x44aea9['attributes']:_0x3a6bd6['model'];if(_0x299e36[_0xcd2c('0x2f')]['includeAll']){_0x44aea9['include']=[{'all':!![]}];}_0x44aea9=_[_0xcd2c('0x39')]({},_0x44aea9,_0x299e36[_0xcd2c('0x3c')]);return db['Variable']['find'](_0x44aea9)[_0xcd2c('0x21')](handleEntityNotFound(_0x4899a9,null))[_0xcd2c('0x21')](respondWithResult(_0x4899a9,null))[_0xcd2c('0x41')](handleError(_0x4899a9,null));};exports[_0xcd2c('0x44')]=function(_0x31c1a5,_0x419e09){return db[_0xcd2c('0x3f')][_0xcd2c('0x44')](_0x31c1a5[_0xcd2c('0x45')],{})[_0xcd2c('0x21')](function(_0xf554f8){var _0x533be4=_0x31c1a5[_0xcd2c('0x46')]['get']({'plain':!![]});if(!_0x533be4)throw new Error(_0xcd2c('0x47'));if(_0x533be4[_0xcd2c('0x48')]===_0xcd2c('0x46')){var _0x46d60d=_0xf554f8[_0xcd2c('0x22')]({'plain':!![]});var _0x1dd4d3='Variables';return db['UserProfileSection'][_0xcd2c('0x49')]({'where':{'name':_0x1dd4d3,'userProfileId':_0x533be4[_0xcd2c('0x4a')]},'raw':!![]})[_0xcd2c('0x21')](function(_0x49c771){if(_0x49c771&&_0x49c771[_0xcd2c('0x4b')]===0x0){return db['UserProfileResource'][_0xcd2c('0x44')]({'name':_0x46d60d[_0xcd2c('0x28')],'resourceId':_0x46d60d['id'],'type':_0x49c771['name'],'sectionId':_0x49c771['id']},{})['then'](function(){return _0xf554f8;});}else{return _0xf554f8;}})['catch'](function(_0x1679ac){logger['error'](_0xcd2c('0x4c'),_0x1679ac);throw _0x1679ac;});}return _0xf554f8;})[_0xcd2c('0x21')](respondWithResult(_0x419e09,0xc9))[_0xcd2c('0x41')](handleError(_0x419e09,null));};exports['update']=function(_0x3576e8,_0x3bc37b){if(_0x3576e8['body']['id']){delete _0x3576e8[_0xcd2c('0x45')]['id'];}return db[_0xcd2c('0x3f')][_0xcd2c('0x49')]({'where':{'id':_0x3576e8[_0xcd2c('0x4d')]['id']}})[_0xcd2c('0x21')](handleEntityNotFound(_0x3bc37b,null))[_0xcd2c('0x21')](saveUpdates(_0x3576e8[_0xcd2c('0x45')],null))['then'](respondWithResult(_0x3bc37b,null))['catch'](handleError(_0x3bc37b,null));};exports[_0xcd2c('0x20')]=function(_0x39186b,_0x2fab41){return db[_0xcd2c('0x3f')]['find']({'where':{'id':_0x39186b[_0xcd2c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2fab41,null))[_0xcd2c('0x21')](removeEntity(_0x2fab41,null))[_0xcd2c('0x41')](handleError(_0x2fab41,null));}; \ No newline at end of file +var _0x67ac=['UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','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','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','Variables','UserProfileResource','sendStatus','stack','name','send','index','Variable','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','create','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x5333d1,_0x5258ec){var _0x38cb79=function(_0x5cfc76){while(--_0x5cfc76){_0x5333d1['push'](_0x5333d1['shift']());}};_0x38cb79(++_0x5258ec);}(_0x67ac,0x106));var _0xc67a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x67ac[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc67a('0x0'));var rimraf=require(_0xc67a('0x1'));var zipdir=require(_0xc67a('0x2'));var jsonpatch=require(_0xc67a('0x3'));var rp=require(_0xc67a('0x4'));var moment=require(_0xc67a('0x5'));var BPromise=require(_0xc67a('0x6'));var Mustache=require(_0xc67a('0x7'));var util=require('util');var path=require('path');var sox=require(_0xc67a('0x8'));var csv=require(_0xc67a('0x9'));var ejs=require(_0xc67a('0xa'));var fs=require('fs');var fs_extra=require(_0xc67a('0xb'));var _=require(_0xc67a('0xc'));var squel=require(_0xc67a('0xd'));var crypto=require(_0xc67a('0xe'));var jsforce=require(_0xc67a('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc67a('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc67a('0x11'));var qs=require(_0xc67a('0x12'));var as=require(_0xc67a('0x13'));var hardwareService=require(_0xc67a('0x14'));var logger=require(_0xc67a('0x15'))(_0xc67a('0x16'));var utils=require(_0xc67a('0x17'));var config=require(_0xc67a('0x18'));var licenseUtil=require(_0xc67a('0x19'));var db=require(_0xc67a('0x1a'))['db'];function respondWithStatusCode(_0x4d4861,_0x228006){_0x228006=_0x228006||0xcc;return function(_0x340818){if(_0x340818){return _0x4d4861['sendStatus'](_0x228006);}return _0x4d4861[_0xc67a('0x1b')](_0x228006)[_0xc67a('0x1c')]();};}function respondWithResult(_0x1bd667,_0x3a5aee){_0x3a5aee=_0x3a5aee||0xc8;return function(_0x460d2c){if(_0x460d2c){return _0x1bd667['status'](_0x3a5aee)[_0xc67a('0x1d')](_0x460d2c);}};}function respondWithFilteredResult(_0xec82f,_0x191688){return function(_0x4aea83){if(_0x4aea83){var _0x5aa815=typeof _0x191688[_0xc67a('0x1e')]===_0xc67a('0x1f')&&typeof _0x191688[_0xc67a('0x20')]===_0xc67a('0x1f');var _0x25a655=_0x4aea83[_0xc67a('0x21')];var _0x1e67f1=_0x5aa815?0x0:_0x191688[_0xc67a('0x1e')];var _0x5445b9=_0x5aa815?_0x4aea83['count']:_0x191688[_0xc67a('0x1e')]+_0x191688[_0xc67a('0x20')];var _0x4c91f8;if(_0x5445b9>=_0x25a655){_0x5445b9=_0x25a655;_0x4c91f8=0xc8;}else{_0x4c91f8=0xce;}_0xec82f[_0xc67a('0x1b')](_0x4c91f8);return _0xec82f[_0xc67a('0x22')](_0xc67a('0x23'),_0x1e67f1+'-'+_0x5445b9+'/'+_0x25a655)[_0xc67a('0x1d')](_0x4aea83);}return null;};}function patchUpdates(_0x3982a2){return function(_0x48963c){try{jsonpatch['apply'](_0x48963c,_0x3982a2,!![]);}catch(_0x1d4477){return BPromise[_0xc67a('0x24')](_0x1d4477);}return _0x48963c['save']();};}function saveUpdates(_0x2cf538,_0x23f12d){return function(_0x2d0fc4){if(_0x2d0fc4){return _0x2d0fc4[_0xc67a('0x25')](_0x2cf538)[_0xc67a('0x26')](function(_0x3dc62c){return _0x3dc62c;});}return null;};}function removeEntity(_0x14a278,_0x35d530){return function(_0x5262cd){if(_0x5262cd){return _0x5262cd[_0xc67a('0x27')]()[_0xc67a('0x26')](function(){var _0x46bb47=_0x5262cd[_0xc67a('0x28')]({'plain':!![]});var _0x4d692a=_0xc67a('0x29');return db[_0xc67a('0x2a')][_0xc67a('0x27')]({'where':{'type':_0x4d692a,'resourceId':_0x46bb47['id']}})[_0xc67a('0x26')](function(){return _0x5262cd;});})[_0xc67a('0x26')](function(){_0x14a278[_0xc67a('0x1b')](0xcc)[_0xc67a('0x1c')]();});}};}function handleEntityNotFound(_0x28f5df,_0x177fe7){return function(_0x233e98){if(!_0x233e98){_0x28f5df[_0xc67a('0x2b')](0x194);}return _0x233e98;};}function handleError(_0x230f8c,_0x5cbd92){_0x5cbd92=_0x5cbd92||0x1f4;return function(_0x3465fe){logger['error'](_0x3465fe[_0xc67a('0x2c')]);if(_0x3465fe[_0xc67a('0x2d')]){delete _0x3465fe[_0xc67a('0x2d')];}_0x230f8c[_0xc67a('0x1b')](_0x5cbd92)[_0xc67a('0x2e')](_0x3465fe);};}exports[_0xc67a('0x2f')]=function(_0xa0aacd,_0x16b36e){var _0x170cd0={},_0x5d47df={},_0x52ebcd={'count':0x0,'rows':[]};var _0x505421=_['map'](db[_0xc67a('0x30')][_0xc67a('0x31')],function(_0x318a49){return{'name':_0x318a49[_0xc67a('0x32')],'type':_0x318a49[_0xc67a('0x33')][_0xc67a('0x34')]};});_0x5d47df[_0xc67a('0x35')]=_[_0xc67a('0x36')](_0x505421,_0xc67a('0x2d'));_0x5d47df[_0xc67a('0x37')]=_[_0xc67a('0x38')](_0xa0aacd[_0xc67a('0x37')]);_0x5d47df[_0xc67a('0x39')]=_[_0xc67a('0x3a')](_0x5d47df[_0xc67a('0x35')],_0x5d47df[_0xc67a('0x37')]);_0x170cd0[_0xc67a('0x3b')]=_[_0xc67a('0x3a')](_0x5d47df[_0xc67a('0x35')],qs[_0xc67a('0x3c')](_0xa0aacd[_0xc67a('0x37')]['fields']));_0x170cd0[_0xc67a('0x3b')]=_0x170cd0[_0xc67a('0x3b')][_0xc67a('0x3d')]?_0x170cd0[_0xc67a('0x3b')]:_0x5d47df[_0xc67a('0x35')];if(!_0xa0aacd[_0xc67a('0x37')][_0xc67a('0x3e')]('nolimit')){_0x170cd0[_0xc67a('0x20')]=qs[_0xc67a('0x20')](_0xa0aacd['query']['limit']);_0x170cd0[_0xc67a('0x1e')]=qs['offset'](_0xa0aacd[_0xc67a('0x37')][_0xc67a('0x1e')]);}_0x170cd0[_0xc67a('0x3f')]=qs[_0xc67a('0x40')](_0xa0aacd[_0xc67a('0x37')][_0xc67a('0x40')]);_0x170cd0[_0xc67a('0x41')]=qs[_0xc67a('0x39')](_[_0xc67a('0x42')](_0xa0aacd['query'],_0x5d47df[_0xc67a('0x39')]),_0x505421);if(_0xa0aacd[_0xc67a('0x37')][_0xc67a('0x43')]){_0x170cd0['where']=_[_0xc67a('0x44')](_0x170cd0[_0xc67a('0x41')],{'$or':_[_0xc67a('0x36')](_0x505421,function(_0x2ce384){if(_0x2ce384[_0xc67a('0x33')]!==_0xc67a('0x45')){var _0x37c2f8={};_0x37c2f8[_0x2ce384[_0xc67a('0x2d')]]={'$like':'%'+_0xa0aacd[_0xc67a('0x37')][_0xc67a('0x43')]+'%'};return _0x37c2f8;}})});}_0x170cd0=_[_0xc67a('0x44')]({},_0x170cd0,_0xa0aacd[_0xc67a('0x46')]);var _0x5346aa={'where':_0x170cd0['where']};return db['Variable'][_0xc67a('0x21')](_0x5346aa)[_0xc67a('0x26')](function(_0x2bdd70){_0x52ebcd[_0xc67a('0x21')]=_0x2bdd70;if(_0xa0aacd['query'][_0xc67a('0x47')]){_0x170cd0[_0xc67a('0x48')]=[{'all':!![]}];}return db[_0xc67a('0x30')][_0xc67a('0x49')](_0x170cd0);})[_0xc67a('0x26')](function(_0x1452b8){_0x52ebcd['rows']=_0x1452b8;return _0x52ebcd;})['then'](respondWithFilteredResult(_0x16b36e,_0x170cd0))[_0xc67a('0x4a')](handleError(_0x16b36e,null));};exports['show']=function(_0x1adb40,_0x4af7d1){var _0x223d14={'raw':!![],'where':{'id':_0x1adb40[_0xc67a('0x4b')]['id']}},_0x2b451b={};_0x2b451b['model']=_['keys'](db[_0xc67a('0x30')][_0xc67a('0x31')]);_0x2b451b[_0xc67a('0x37')]=_[_0xc67a('0x38')](_0x1adb40['query']);_0x2b451b[_0xc67a('0x39')]=_[_0xc67a('0x3a')](_0x2b451b[_0xc67a('0x35')],_0x2b451b[_0xc67a('0x37')]);_0x223d14[_0xc67a('0x3b')]=_['intersection'](_0x2b451b[_0xc67a('0x35')],qs[_0xc67a('0x3c')](_0x1adb40[_0xc67a('0x37')][_0xc67a('0x3c')]));_0x223d14[_0xc67a('0x3b')]=_0x223d14['attributes'][_0xc67a('0x3d')]?_0x223d14[_0xc67a('0x3b')]:_0x2b451b[_0xc67a('0x35')];if(_0x1adb40['query']['includeAll']){_0x223d14['include']=[{'all':!![]}];}_0x223d14=_[_0xc67a('0x44')]({},_0x223d14,_0x1adb40[_0xc67a('0x46')]);return db[_0xc67a('0x30')]['find'](_0x223d14)[_0xc67a('0x26')](handleEntityNotFound(_0x4af7d1,null))[_0xc67a('0x26')](respondWithResult(_0x4af7d1,null))[_0xc67a('0x4a')](handleError(_0x4af7d1,null));};exports[_0xc67a('0x4c')]=function(_0x2320b5,_0x162be7){return db[_0xc67a('0x30')][_0xc67a('0x4c')](_0x2320b5['body'],{})[_0xc67a('0x26')](function(_0xc25fd3){var _0x8b0fe8=_0x2320b5['user'][_0xc67a('0x28')]({'plain':!![]});if(!_0x8b0fe8)throw new Error(_0xc67a('0x4d'));if(_0x8b0fe8['role']==='user'){var _0x3ff26e=_0xc25fd3[_0xc67a('0x28')]({'plain':!![]});var _0x4d3b88=_0xc67a('0x29');return db[_0xc67a('0x4e')][_0xc67a('0x4f')]({'where':{'name':_0x4d3b88,'userProfileId':_0x8b0fe8[_0xc67a('0x50')]},'raw':!![]})[_0xc67a('0x26')](function(_0x1191b2){if(_0x1191b2&&_0x1191b2[_0xc67a('0x51')]===0x0){return db[_0xc67a('0x2a')][_0xc67a('0x4c')]({'name':_0x3ff26e[_0xc67a('0x2d')],'resourceId':_0x3ff26e['id'],'type':_0x1191b2[_0xc67a('0x2d')],'sectionId':_0x1191b2['id']},{})[_0xc67a('0x26')](function(){return _0xc25fd3;});}else{return _0xc25fd3;}})[_0xc67a('0x4a')](function(_0x362ac4){logger[_0xc67a('0x52')](_0xc67a('0x53'),_0x362ac4);throw _0x362ac4;});}return _0xc25fd3;})[_0xc67a('0x26')](respondWithResult(_0x162be7,0xc9))[_0xc67a('0x4a')](handleError(_0x162be7,null));};exports[_0xc67a('0x25')]=function(_0x9b751f,_0x1c5cdf){if(_0x9b751f['body']['id']){delete _0x9b751f[_0xc67a('0x54')]['id'];}return db[_0xc67a('0x30')][_0xc67a('0x4f')]({'where':{'id':_0x9b751f[_0xc67a('0x4b')]['id']}})[_0xc67a('0x26')](handleEntityNotFound(_0x1c5cdf,null))[_0xc67a('0x26')](saveUpdates(_0x9b751f[_0xc67a('0x54')],null))[_0xc67a('0x26')](respondWithResult(_0x1c5cdf,null))[_0xc67a('0x4a')](handleError(_0x1c5cdf,null));};exports[_0xc67a('0x27')]=function(_0x410b9e,_0x4237ab){return db[_0xc67a('0x30')][_0xc67a('0x4f')]({'where':{'id':_0x410b9e[_0xc67a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4237ab,null))[_0xc67a('0x26')](removeEntity(_0x4237ab,null))[_0xc67a('0x4a')](handleError(_0x4237ab,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 92b327d..ce60691 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 _0x22af=['./variable.attributes','exports','define','Variable','lodash','util','../../config/logger','api','request-promise','../../config/environment'];(function(_0x4f34d8,_0x40f022){var _0xc97536=function(_0xef9dfc){while(--_0xef9dfc){_0x4f34d8['push'](_0x4f34d8['shift']());}};_0xc97536(++_0x40f022);}(_0x22af,0x19e));var _0xf22a=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0x22af[_0x585133];return _0x18254a;};'use strict';var _=require(_0xf22a('0x0'));var util=require(_0xf22a('0x1'));var logger=require(_0xf22a('0x2'))(_0xf22a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf22a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf22a('0x5'));var attributes=require(_0xf22a('0x6'));module[_0xf22a('0x7')]=function(_0x618c97,_0x2261ce){return _0x618c97[_0xf22a('0x8')](_0xf22a('0x9'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e30=['api','moment','request-promise','rimraf','../../config/environment','./variable.attributes','define','tools_variables','lodash','util','../../config/logger'];(function(_0x4073ec,_0x577509){var _0x146af3=function(_0x3c627a){while(--_0x3c627a){_0x4073ec['push'](_0x4073ec['shift']());}};_0x146af3(++_0x577509);}(_0x7e30,0x147));var _0x07e3=function(_0x2618c9,_0x3da65d){_0x2618c9=_0x2618c9-0x0;var _0x49d369=_0x7e30[_0x2618c9];return _0x49d369;};'use strict';var _=require(_0x07e3('0x0'));var util=require(_0x07e3('0x1'));var logger=require(_0x07e3('0x2'))(_0x07e3('0x3'));var moment=require(_0x07e3('0x4'));var BPromise=require('bluebird');var rp=require(_0x07e3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x07e3('0x6'));var config=require(_0x07e3('0x7'));var attributes=require(_0x07e3('0x8'));module['exports']=function(_0x2c09a7,_0x117838){return _0x2c09a7[_0x07e3('0x9')]('Variable',attributes,{'tableName':_0x07e3('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 7ce5048..66a0fad 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 _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x4f3e5a,_0x1ee150){var _0x452880=function(_0xadcb87){while(--_0xadcb87){_0x4f3e5a['push'](_0x4f3e5a['shift']());}};_0x452880(++_0x1ee150);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1719c2,_0x4b9565){_0x1719c2=_0x1719c2-0x0;var _0xc6f6f6=_0x1cb9[_0x1719c2];return _0xc6f6f6;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file +var _0xa41a=['debug','Variable,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowVariable','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xa41a,0x6b));var _0xaa41=function(_0x296ed1,_0x40305b){_0x296ed1=_0x296ed1-0x0;var _0x1bdd7f=_0xa41a[_0x296ed1];return _0x1bdd7f;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});}exports[_0xaa41('0x17')]=function(_0xd20ddf){var _0x29efe5=this;return new Promise(function(_0x46e6d3,_0x150ddf){return db['Variable']['find']({'raw':_0xd20ddf[_0xaa41('0x18')]?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x19')]===undefined?!![]:![]:!![],'where':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1a')]||null:null,'attributes':_0xd20ddf['options']?_0xd20ddf['options'][_0xaa41('0x1b')]||null:null,'include':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')],function(_0x4eb01f){return{'model':db[_0x4eb01f[_0xaa41('0x1e')]],'as':_0x4eb01f['as'],'attributes':_0x4eb01f[_0xaa41('0x1b')],'include':_0x4eb01f[_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0x4eb01f[_0xaa41('0x1c')],function(_0xa1f024){return{'model':db[_0xa1f024['model']],'as':_0xa1f024['as'],'attributes':_0xa1f024['attributes'],'include':_0xa1f024[_0xaa41('0x1c')]?_['map'](_0xa1f024['include'],function(_0x12e362){return{'model':db[_0x12e362['model']],'as':_0x12e362['as'],'attributes':_0x12e362['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa41('0xd')](function(_0x9c8c21){logger[_0xaa41('0xe')](_0xaa41('0x17'),_0xd20ddf);logger[_0xaa41('0x11')](_0xaa41('0x17'),_0xd20ddf,JSON['stringify'](_0x9c8c21));_0x46e6d3(_0x9c8c21);})[_0xaa41('0x16')](function(_0x1f0275){logger[_0xaa41('0x13')](_0xaa41('0x17'),_0x1f0275[_0xaa41('0x14')],_0xd20ddf);_0x150ddf(_0x29efe5[_0xaa41('0x13')](0x1f4,_0x1f0275[_0xaa41('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 4b8da61..92c40b4 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 _0x217c=['isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','restart','/migrations','migrations','express','Router','../../components/auth/service','./version.controller','get','index','/fetch'];(function(_0x3207f2,_0x27c2ae){var _0x4e0ed1=function(_0x363529){while(--_0x363529){_0x3207f2['push'](_0x3207f2['shift']());}};_0x4e0ed1(++_0x27c2ae);}(_0x217c,0x81));var _0xc217=function(_0x238943,_0x414e40){_0x238943=_0x238943-0x0;var _0x177fff=_0x217c[_0x238943];return _0x177fff;};'use strict';var express=require(_0xc217('0x0'));var router=express[_0xc217('0x1')]();var auth=require(_0xc217('0x2'));var controller=require(_0xc217('0x3'));router[_0xc217('0x4')]('/',controller[_0xc217('0x5')]);router[_0xc217('0x4')](_0xc217('0x6'),auth[_0xc217('0x7')](),auth[_0xc217('0x8')](),controller[_0xc217('0x9')]);router[_0xc217('0x4')](_0xc217('0xa'),auth[_0xc217('0x7')](),auth[_0xc217('0x8')](),controller[_0xc217('0xb')]);router['get'](_0xc217('0xc'),auth[_0xc217('0x7')](),auth['canUpdate'](),controller[_0xc217('0xd')]);router['get']('/restart',auth[_0xc217('0x7')](),controller[_0xc217('0xe')]);router['get'](_0xc217('0xf'),controller[_0xc217('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb71b=['/reset','isAuthenticated','/pull','/restart','restart','exports','express','Router','get','index','/fetch','canUpdate','fetch'];(function(_0x5ab102,_0x40f163){var _0x30d193=function(_0x2200d3){while(--_0x2200d3){_0x5ab102['push'](_0x5ab102['shift']());}};_0x30d193(++_0x40f163);}(_0xb71b,0xfd));var _0xbb71=function(_0x30c53e,_0x4a7671){_0x30c53e=_0x30c53e-0x0;var _0x1295b=_0xb71b[_0x30c53e];return _0x1295b;};'use strict';var express=require(_0xbb71('0x0'));var router=express[_0xbb71('0x1')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0xbb71('0x2')]('/',controller[_0xbb71('0x3')]);router[_0xbb71('0x2')](_0xbb71('0x4'),auth['isAuthenticated'](),auth[_0xbb71('0x5')](),controller[_0xbb71('0x6')]);router[_0xbb71('0x2')](_0xbb71('0x7'),auth[_0xbb71('0x8')](),auth[_0xbb71('0x5')](),controller['reset']);router[_0xbb71('0x2')](_0xbb71('0x9'),auth[_0xbb71('0x8')](),auth[_0xbb71('0x5')](),controller['pull']);router['get'](_0xbb71('0xa'),auth['isAuthenticated'](),controller[_0xbb71('0xb')]);router[_0xbb71('0x2')]('/migrations',controller['migrations']);module[_0xbb71('0xc')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 562a55e..92a6796 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 _0x00bd=['tags','latest','exports','2.0.0','status','json','origin','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','npm\x20install\x20--production','info','restart','motion2','then','catch','readdirSync','server','migrations','length','push','sequelize','Migration','getQueryInterface','constructor','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','join','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','simple-git','root','index','version','query','fetch'];(function(_0x3fc758,_0x21bc3d){var _0x4c692e=function(_0xc3628c){while(--_0xc3628c){_0x3fc758['push'](_0x3fc758['shift']());}};_0x4c692e(++_0x21bc3d);}(_0x00bd,0x155));var _0xd00b=function(_0x13363f,_0x48a989){_0x13363f=_0x13363f-0x0;var _0x277a54=_0x00bd[_0x13363f];return _0x277a54;};'use strict';var Umzug=require(_0xd00b('0x0'));var path=require(_0xd00b('0x1'));var fs=require('fs');var _=require(_0xd00b('0x2'));var pkginfo=require(_0xd00b('0x3'))(module,'version');var compareVersions=require(_0xd00b('0x4'));var exec=require(_0xd00b('0x5'))[_0xd00b('0x6')];var db=require(_0xd00b('0x7'))['db'];var config=require(_0xd00b('0x8'));var pm2=require('../../config/pm2');var logger=require(_0xd00b('0x9'))('update');var git=require(_0xd00b('0xa'))(config[_0xd00b('0xb')]);exports[_0xd00b('0xc')]=function(_0x22b73a,_0x5022dd){var _0xfab13f={'current':module['exports'][_0xd00b('0xd')],'phonebar':0x2};if(_0x22b73a[_0xd00b('0xe')]&&_0x22b73a[_0xd00b('0xe')]['latest']){return git[_0xd00b('0xf')]()[_0xd00b('0x10')](function(_0x38b860,_0xffa97c){_0xfab13f[_0xd00b('0x11')]=(_0x38b860?module[_0xd00b('0x12')][_0xd00b('0xd')]:_0xffa97c[_0xd00b('0x11')])||_0xd00b('0x13');return _0x5022dd[_0xd00b('0x14')](0xc8)[_0xd00b('0x15')](_0xfab13f);});}else{return _0x5022dd[_0xd00b('0x14')](0xc8)[_0xd00b('0x15')](_0xfab13f);}};exports['fetch']=function(_0x35f701,_0x13b111){return git[_0xd00b('0xf')]([_0xd00b('0x16'),'master'],function(_0x48b443){if(_0x48b443){logger[_0xd00b('0x17')](_0x48b443);return _0x13b111[_0xd00b('0x14')](0x1f4)[_0xd00b('0x15')](_0x48b443);}logger['info'](_0xd00b('0x18'));return _0x13b111['status'](0xc8)[_0xd00b('0x15')]({'output':_0xd00b('0x19')});});};exports['reset']=function(_0x3cfc46,_0x2fbb7d){return git[_0xd00b('0x1a')]([_0xd00b('0x1b'),'FETCH_HEAD'],function(_0x35c021){if(_0x35c021){logger[_0xd00b('0x17')](_0x35c021);return _0x2fbb7d['status'](0x1f4)[_0xd00b('0x15')](_0x35c021);}logger['info'](_0xd00b('0x1c'));return _0x2fbb7d[_0xd00b('0x14')](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x1bf0d1,_0x1d160c){exec(_0xd00b('0x1d'),function(_0x107c3a,_0x5070af,_0x1763b1){logger[_0xd00b('0x1e')](_0x5070af);logger[_0xd00b('0x1e')](_0x1763b1);if(_0x107c3a){logger[_0xd00b('0x17')](_0x107c3a);return _0x1d160c[_0xd00b('0x14')](0x1f4)['json'](_0x107c3a);}return _0x1d160c[_0xd00b('0x14')](0xc8)[_0xd00b('0x15')]({'output':_0x5070af});});};exports[_0xd00b('0x1f')]=function(_0x58bbf4,_0x5e3ecd){return pm2['restart'](_0xd00b('0x20'))[_0xd00b('0x21')](function(_0x3ce4c2){logger[_0xd00b('0x1e')]('pm2\x20restart\x20motion\x20%s',_0x3ce4c2);return _0x5e3ecd[_0xd00b('0x14')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xd00b('0x22')](function(_0x23a60f){logger[_0xd00b('0x17')](_0x23a60f);return _0x5e3ecd[_0xd00b('0x14')](0x1f4)[_0xd00b('0x15')](_0x23a60f);});};exports['migrations']=function(_0x18479f,_0x215123){var _0x747cc2=fs[_0xd00b('0x23')](path['join'](config[_0xd00b('0xb')],_0xd00b('0x24'),_0xd00b('0x25')));var _0x28ad43=[];for(var _0x7b865c=0x0;_0x7b865c<_0x747cc2[_0xd00b('0x26')];_0x7b865c++){var _0x2a004e=_0x747cc2[_0x7b865c]['replace']('.js','');if(compareVersions(module[_0xd00b('0x12')][_0xd00b('0xd')],_0x2a004e)===-0x1){_0x28ad43[_0xd00b('0x27')](_0x2a004e);}}if(_0x28ad43[_0xd00b('0x26')]){var _0x444c8e=_0x28ad43['sort'](compareVersions);var _0x97cb54=new Umzug({'storage':_0xd00b('0x28'),'storageOptions':{'model':db['Migration'],'modelName':_0xd00b('0x29'),'columnName':_0xd00b('0xd')},'migrations':{'params':[db['sequelize'][_0xd00b('0x2a')](),db[_0xd00b('0x28')][_0xd00b('0x2b')],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['join'](config[_0xd00b('0xb')],_0xd00b('0x24'),_0xd00b('0x25')),'pattern':/\.js$/}});_0x97cb54['up']({'migrations':_[_0xd00b('0x2c')](_0x444c8e,function(_0x33dd46){return _0x33dd46+_0xd00b('0x2d');})})[_0xd00b('0x21')](function(){return _0x215123['status'](0xc8)[_0xd00b('0x15')]({'output':_0xd00b('0x2e')+module[_0xd00b('0x12')]['version']+_0xd00b('0x2f')+_[_0xd00b('0x30')](_0x444c8e),'migrations':_[_0xd00b('0x31')](_0x444c8e)});})['catch'](function(_0x4bdfa2){if(_0x4bdfa2 instanceof db[_0xd00b('0x28')]['UniqueConstraintError']){return _0x215123[_0xd00b('0x14')](0xc8)[_0xd00b('0x15')]({'output':_0xd00b('0x32')});}else{return _0x215123[_0xd00b('0x14')](0x1f4)[_0xd00b('0x15')](_0x4bdfa2);}});}else{return _0x215123[_0xd00b('0x14')](0xc8)[_0xd00b('0x15')]({'output':_0xd00b('0x32')});}}; \ No newline at end of file +var _0x21e9=['info','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','migrations','readdirSync','join','length','replace','.js','version','push','sort','sequelize','Migration','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','UniqueConstraintError','path','lodash','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','query','fetch','exports','2.0.0','status','json','origin','master','error'];(function(_0x21dea2,_0x12388e){var _0x30800b=function(_0x4cbb1d){while(--_0x4cbb1d){_0x21dea2['push'](_0x21dea2['shift']());}};_0x30800b(++_0x12388e);}(_0x21e9,0xfb));var _0x921e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x21e9[_0x14add3];return _0x4a174f;};'use strict';var Umzug=require('umzug');var path=require(_0x921e('0x0'));var fs=require('fs');var _=require(_0x921e('0x1'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require('compare-versions');var exec=require('child_process')['exec'];var db=require(_0x921e('0x2'))['db'];var config=require(_0x921e('0x3'));var pm2=require(_0x921e('0x4'));var logger=require(_0x921e('0x5'))(_0x921e('0x6'));var git=require(_0x921e('0x7'))(config[_0x921e('0x8')]);exports[_0x921e('0x9')]=function(_0x45ecb5,_0x76e67){var _0x10e698={'current':module['exports']['version'],'phonebar':0x2};if(_0x45ecb5[_0x921e('0xa')]&&_0x45ecb5[_0x921e('0xa')]['latest']){return git[_0x921e('0xb')]()['tags'](function(_0x3a9dee,_0xefc2){_0x10e698['latest']=(_0x3a9dee?module[_0x921e('0xc')]['version']:_0xefc2['latest'])||_0x921e('0xd');return _0x76e67[_0x921e('0xe')](0xc8)[_0x921e('0xf')](_0x10e698);});}else{return _0x76e67[_0x921e('0xe')](0xc8)[_0x921e('0xf')](_0x10e698);}};exports['fetch']=function(_0x5a9434,_0x3eb7ca){return git[_0x921e('0xb')]([_0x921e('0x10'),_0x921e('0x11')],function(_0x4402cf){if(_0x4402cf){logger[_0x921e('0x12')](_0x4402cf);return _0x3eb7ca[_0x921e('0xe')](0x1f4)['json'](_0x4402cf);}logger[_0x921e('0x13')]('git\x20fetch');return _0x3eb7ca['status'](0xc8)[_0x921e('0xf')]({'output':_0x921e('0x14')});});};exports[_0x921e('0x15')]=function(_0x57bf87,_0x244589){return git[_0x921e('0x15')]([_0x921e('0x16'),'FETCH_HEAD'],function(_0x1bd954){if(_0x1bd954){logger[_0x921e('0x12')](_0x1bd954);return _0x244589['status'](0x1f4)[_0x921e('0xf')](_0x1bd954);}logger[_0x921e('0x13')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x244589[_0x921e('0xe')](0xc8)[_0x921e('0xf')]({'output':_0x921e('0x17')});});};exports[_0x921e('0x18')]=function(_0x47d63f,_0x475c7e){exec(_0x921e('0x19'),function(_0x3b7c9d,_0x1fd099,_0x5b2b3b){logger[_0x921e('0x13')](_0x1fd099);logger['info'](_0x5b2b3b);if(_0x3b7c9d){logger['error'](_0x3b7c9d);return _0x475c7e[_0x921e('0xe')](0x1f4)[_0x921e('0xf')](_0x3b7c9d);}return _0x475c7e[_0x921e('0xe')](0xc8)[_0x921e('0xf')]({'output':_0x1fd099});});};exports['restart']=function(_0x1940e1,_0x5aeece){return pm2[_0x921e('0x1a')](_0x921e('0x1b'))[_0x921e('0x1c')](function(_0x803aa3){logger[_0x921e('0x13')]('pm2\x20restart\x20motion\x20%s',_0x803aa3);return _0x5aeece[_0x921e('0xe')](0xc8)[_0x921e('0xf')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x33bab6){logger[_0x921e('0x12')](_0x33bab6);return _0x5aeece[_0x921e('0xe')](0x1f4)[_0x921e('0xf')](_0x33bab6);});};exports[_0x921e('0x1d')]=function(_0x28c8cf,_0x40b7af){var _0x581038=fs[_0x921e('0x1e')](path[_0x921e('0x1f')](config[_0x921e('0x8')],'server','migrations'));var _0xea5740=[];for(var _0x57ebba=0x0;_0x57ebba<_0x581038[_0x921e('0x20')];_0x57ebba++){var _0x3b6803=_0x581038[_0x57ebba][_0x921e('0x21')](_0x921e('0x22'),'');if(compareVersions(module[_0x921e('0xc')][_0x921e('0x23')],_0x3b6803)===-0x1){_0xea5740[_0x921e('0x24')](_0x3b6803);}}if(_0xea5740[_0x921e('0x20')]){var _0x11169c=_0xea5740[_0x921e('0x25')](compareVersions);var _0x315981=new Umzug({'storage':_0x921e('0x26'),'storageOptions':{'model':db[_0x921e('0x27')],'modelName':_0x921e('0x27'),'columnName':_0x921e('0x23')},'migrations':{'params':[db[_0x921e('0x26')]['getQueryInterface'](),db['sequelize']['constructor'],function(){throw new Error(_0x921e('0x28'));}],'path':path[_0x921e('0x1f')](config['root'],_0x921e('0x29'),_0x921e('0x1d')),'pattern':/\.js$/}});_0x315981['up']({'migrations':_[_0x921e('0x2a')](_0x11169c,function(_0x4dad02){return _0x4dad02+'.js';})})[_0x921e('0x1c')](function(){return _0x40b7af[_0x921e('0xe')](0xc8)['json']({'output':_0x921e('0x2b')+module['exports'][_0x921e('0x23')]+'\x20to\x20'+_['last'](_0x11169c),'migrations':_[_0x921e('0x1f')](_0x11169c)});})['catch'](function(_0x4b9fa3){if(_0x4b9fa3 instanceof db[_0x921e('0x26')][_0x921e('0x2c')]){return _0x40b7af['status'](0xc8)[_0x921e('0xf')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x40b7af[_0x921e('0xe')](0x1f4)[_0x921e('0xf')](_0x4b9fa3);}});}else{return _0x40b7af[_0x921e('0xe')](0xc8)[_0x921e('0xf')]({'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 f5f9c00..6dae765 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 _0x8191=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','show','create','put','/:id','update'];(function(_0x3b00c1,_0x3d5759){var _0x1cbfbe=function(_0x479446){while(--_0x479446){_0x3b00c1['push'](_0x3b00c1['shift']());}};_0x1cbfbe(++_0x3d5759);}(_0x8191,0x131));var _0x1819=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0x8191[_0x152136];return _0x20df44;};'use strict';var multer=require(_0x1819('0x0'));var util=require(_0x1819('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1819('0x2'));var router=express[_0x1819('0x3')]();var fs_extra=require(_0x1819('0x4'));var auth=require(_0x1819('0x5'));var interaction=require(_0x1819('0x6'));var config=require(_0x1819('0x7'));var controller=require(_0x1819('0x8'));router[_0x1819('0x9')]('/',auth[_0x1819('0xa')](),controller['index']);router[_0x1819('0x9')](_0x1819('0xb'),auth[_0x1819('0xa')](),controller[_0x1819('0xc')]);router[_0x1819('0x9')]('/:id',auth[_0x1819('0xa')](),controller[_0x1819('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1819('0xe')]);router[_0x1819('0xf')](_0x1819('0x10'),auth[_0x1819('0xa')](),controller[_0x1819('0x11')]);router['delete'](_0x1819('0x10'),auth[_0x1819('0xa')](),controller['destroy']);module[_0x1819('0x12')]=router; \ No newline at end of file +var _0xb720=['delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','put'];(function(_0x2220a5,_0x44cc35){var _0x106698=function(_0x396de8){while(--_0x396de8){_0x2220a5['push'](_0x2220a5['shift']());}};_0x106698(++_0x44cc35);}(_0xb720,0x191));var _0x0b72=function(_0x2f90d0,_0x1d9ec1){_0x2f90d0=_0x2f90d0-0x0;var _0x25ed4b=_0xb720[_0x2f90d0];return _0x25ed4b;};'use strict';var multer=require(_0x0b72('0x0'));var util=require('util');var path=require(_0x0b72('0x1'));var timeout=require(_0x0b72('0x2'));var express=require(_0x0b72('0x3'));var router=express[_0x0b72('0x4')]();var fs_extra=require(_0x0b72('0x5'));var auth=require(_0x0b72('0x6'));var interaction=require(_0x0b72('0x7'));var config=require(_0x0b72('0x8'));var controller=require(_0x0b72('0x9'));router['get']('/',auth[_0x0b72('0xa')](),controller['index']);router[_0x0b72('0xb')](_0x0b72('0xc'),auth[_0x0b72('0xa')](),controller[_0x0b72('0xd')]);router[_0x0b72('0xb')](_0x0b72('0xe'),auth[_0x0b72('0xa')](),controller[_0x0b72('0xf')]);router[_0x0b72('0x10')]('/',auth['isAuthenticated'](),controller[_0x0b72('0x11')]);router[_0x0b72('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0b72('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x0b72('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 602735c..e46662b 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 _0xaa64=['BOOLEAN','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xaa64,0xf7));var _0x4aa6=function(_0x4d3826,_0x1335b1){_0x4d3826=_0x4d3826-0x0;var _0x33eafd=_0xaa64[_0x4d3826];return _0x33eafd;};'use strict';var Sequelize=require(_0x4aa6('0x0'));module[_0x4aa6('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4aa6('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4aa6('0x2')]},'queue':{'type':Sequelize[_0x4aa6('0x2')]},'interface':{'type':Sequelize[_0x4aa6('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x4aa6('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4aa6('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x4aa6('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x4aa6('0x3')]},'agentdumpAt':{'type':Sequelize[_0x4aa6('0x3')]},'holdtime':{'type':Sequelize[_0x4aa6('0x4')]},'agentcomplete':{'type':Sequelize[_0x4aa6('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4aa6('0x4')]},'agentacw':{'type':Sequelize[_0x4aa6('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x4aa6('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4aa6('0x2')]},'channelstate':{'type':Sequelize[_0x4aa6('0x4')]},'channelstatedesc':{'type':Sequelize[_0x4aa6('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4aa6('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4aa6('0x2')]},'accountcode':{'type':Sequelize[_0x4aa6('0x2')]},'context':{'type':Sequelize[_0x4aa6('0x2')]},'exten':{'type':Sequelize[_0x4aa6('0x2')]},'priority':{'type':Sequelize[_0x4aa6('0x2')]},'destchannel':{'type':Sequelize[_0x4aa6('0x2')]},'destchannelstate':{'type':Sequelize[_0x4aa6('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x4aa6('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4aa6('0x2')]},'destcalleridname':{'type':Sequelize[_0x4aa6('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x4aa6('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x4aa6('0x2')]},'destexten':{'type':Sequelize[_0x4aa6('0x2')]},'destpriority':{'type':Sequelize[_0x4aa6('0x2')]},'destuniqueid':{'type':Sequelize[_0x4aa6('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4aa6('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x4aa6('0x2')]},'transfer':{'type':Sequelize[_0x4aa6('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4aa6('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x4aa6('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x4aa6('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x79d7=['BOOLEAN','sequelize','STRING','DATE','INTEGER'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x79d7,0x9c));var _0x779d=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x79d7[_0x1694f5];return _0x5b4321;};'use strict';var Sequelize=require(_0x779d('0x0'));module['exports']={'type':{'type':Sequelize[_0x779d('0x1')]},'uniqueid':{'type':Sequelize[_0x779d('0x1')]},'calleridnum':{'type':Sequelize[_0x779d('0x1')]},'calleridname':{'type':Sequelize[_0x779d('0x1')]},'queue':{'type':Sequelize[_0x779d('0x1')]},'interface':{'type':Sequelize[_0x779d('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x779d('0x2')]},'agentconnectAt':{'type':Sequelize[_0x779d('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x779d('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x779d('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x779d('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x779d('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x779d('0x1')]},'channel':{'type':Sequelize[_0x779d('0x1')]},'channelstate':{'type':Sequelize[_0x779d('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x779d('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x779d('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x779d('0x1')]},'exten':{'type':Sequelize[_0x779d('0x1')]},'priority':{'type':Sequelize[_0x779d('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x779d('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x779d('0x1')]},'destcalleridnum':{'type':Sequelize[_0x779d('0x1')]},'destcalleridname':{'type':Sequelize[_0x779d('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x779d('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x779d('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x779d('0x1')]},'destcontext':{'type':Sequelize[_0x779d('0x1')]},'destexten':{'type':Sequelize[_0x779d('0x1')]},'destpriority':{'type':Sequelize[_0x779d('0x1')]},'destuniqueid':{'type':Sequelize[_0x779d('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x779d('0x1')]},'transfer':{'type':Sequelize[_0x779d('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x779d('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x779d('0x1')]},'transferuniqueid':{'type':Sequelize[_0x779d('0x1')]},'agententerreason':{'type':Sequelize[_0x779d('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 aa073ef..ca75c02 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(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 db6d77d..cb3ddad 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 _0x9491=['uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_agent'];(function(_0x4220fa,_0x359450){var _0x26e4a0=function(_0x3246d0){while(--_0x3246d0){_0x4220fa['push'](_0x4220fa['shift']());}};_0x26e4a0(++_0x359450);}(_0x9491,0xb6));var _0x1949=function(_0x4ee94b,_0x29d887){_0x4ee94b=_0x4ee94b-0x0;var _0x492c2a=_0x9491[_0x4ee94b];return _0x492c2a;};'use strict';var _=require(_0x1949('0x0'));var util=require(_0x1949('0x1'));var logger=require(_0x1949('0x2'))(_0x1949('0x3'));var moment=require(_0x1949('0x4'));var BPromise=require(_0x1949('0x5'));var rp=require(_0x1949('0x6'));var fs=require('fs');var path=require(_0x1949('0x7'));var rimraf=require(_0x1949('0x8'));var config=require(_0x1949('0x9'));var attributes=require('./voiceAgentReport.attributes');module[_0x1949('0xa')]=function(_0x5b01b9,_0x14c30e){return _0x5b01b9[_0x1949('0xb')]('VoiceAgentReport',attributes,{'tableName':_0x1949('0xc'),'paranoid':![],'indexes':[{'fields':[_0x1949('0xd'),_0x1949('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdad2=['uniqueid','destuniqueid','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xdad2,0x14c));var _0x2dad=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xdad2[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var util=require(_0x2dad('0x0'));var logger=require(_0x2dad('0x1'))('api');var moment=require(_0x2dad('0x2'));var BPromise=require(_0x2dad('0x3'));var rp=require(_0x2dad('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2dad('0x5'));var config=require(_0x2dad('0x6'));var attributes=require('./voiceAgentReport.attributes');module[_0x2dad('0x7')]=function(_0x36a054,_0x27ca04){return _0x36a054[_0x2dad('0x8')]('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x2dad('0x9'),_0x2dad('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index ec6505d..8335c14 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 _0xfc00=['raw','then','stringify','update','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','VoiceAgentReport,\x20%s,\x20%s','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options'];(function(_0x5f51c4,_0x204c1a){var _0x5c0a8d=function(_0x2c3207){while(--_0x2c3207){_0x5f51c4['push'](_0x5f51c4['shift']());}};_0x5c0a8d(++_0x204c1a);}(_0xfc00,0x167));var _0x0fc0=function(_0x3c59fc,_0x10dbd2){_0x3c59fc=_0x3c59fc-0x0;var _0x2b78d4=_0xfc00[_0x3c59fc];return _0x2b78d4;};'use strict';var _=require(_0x0fc0('0x0'));var util=require(_0x0fc0('0x1'));var moment=require(_0x0fc0('0x2'));var BPromise=require('bluebird');var rs=require(_0x0fc0('0x3'));var fs=require('fs');var Redis=require(_0x0fc0('0x4'));var db=require(_0x0fc0('0x5'))['db'];var utils=require(_0x0fc0('0x6'));var logger=require(_0x0fc0('0x7'))(_0x0fc0('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0fc0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2692de,_0x455638,_0x1fd412){return new BPromise(function(_0x3fd068,_0x4a3285){return client[_0x0fc0('0xa')](_0x2692de,_0x1fd412)['then'](function(_0x1e33a7){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x455638,_0x0fc0('0xb'));logger[_0x0fc0('0xc')](_0x0fc0('0xd'),_0x455638,_0x0fc0('0xb'),JSON['stringify'](_0x1e33a7));if(_0x1e33a7[_0x0fc0('0xe')]){if(_0x1e33a7[_0x0fc0('0xe')][_0x0fc0('0xf')]===0x1f4){logger[_0x0fc0('0xe')](_0x0fc0('0x10'),_0x455638,_0x1e33a7[_0x0fc0('0xe')]['message']);return _0x4a3285(_0x1e33a7[_0x0fc0('0xe')][_0x0fc0('0x11')]);}logger[_0x0fc0('0xe')](_0x0fc0('0x10'),_0x455638,_0x1e33a7[_0x0fc0('0xe')][_0x0fc0('0x11')]);return _0x3fd068(_0x1e33a7[_0x0fc0('0xe')]['message']);}else{logger[_0x0fc0('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x455638,'request\x20sent');_0x3fd068(_0x1e33a7[_0x0fc0('0x13')][_0x0fc0('0x11')]);}})[_0x0fc0('0x14')](function(_0x4cf92f){logger[_0x0fc0('0xe')](_0x0fc0('0x10'),_0x455638,_0x4cf92f);_0x4a3285(_0x4cf92f);});});}exports[_0x0fc0('0x15')]=function(_0x5e29f9){var _0x301ce5=this;return new Promise(function(_0x4f70aa,_0x4e1fcf){return db[_0x0fc0('0x16')][_0x0fc0('0x17')](_0x5e29f9['body'],{'raw':_0x5e29f9[_0x0fc0('0x18')]?_0x5e29f9[_0x0fc0('0x18')][_0x0fc0('0x19')]===undefined?!![]:![]:!![]})[_0x0fc0('0x1a')](function(_0x202ab0){logger[_0x0fc0('0x12')](_0x0fc0('0x15'),_0x5e29f9);logger[_0x0fc0('0xc')](_0x0fc0('0x15'),_0x5e29f9,JSON[_0x0fc0('0x1b')](_0x202ab0));_0x4f70aa(_0x202ab0);})[_0x0fc0('0x14')](function(_0x8e8556){logger['error'](_0x0fc0('0x15'),_0x8e8556[_0x0fc0('0x11')],_0x5e29f9);_0x4e1fcf(_0x301ce5[_0x0fc0('0xe')](0x1f4,_0x8e8556['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x5d0de6){var _0x39f918=this;return new Promise(function(_0x1acace,_0x12e23e){return db['VoiceAgentReport'][_0x0fc0('0x1c')](_0x5d0de6['body'],{'raw':_0x5d0de6[_0x0fc0('0x18')]?_0x5d0de6[_0x0fc0('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d0de6[_0x0fc0('0x18')]?_0x5d0de6[_0x0fc0('0x18')]['where']||null:null,'attributes':_0x5d0de6[_0x0fc0('0x18')]?_0x5d0de6['options'][_0x0fc0('0x1d')]||null:null,'limit':_0x5d0de6[_0x0fc0('0x18')]?_0x5d0de6['options'][_0x0fc0('0x1e')]||null:null})[_0x0fc0('0x1a')](function(_0x435f77){logger[_0x0fc0('0x12')](_0x0fc0('0x1f'),_0x5d0de6);logger[_0x0fc0('0xc')](_0x0fc0('0x1f'),_0x5d0de6,JSON[_0x0fc0('0x1b')](_0x435f77));_0x1acace(_0x435f77);})['catch'](function(_0x55fcfc){logger[_0x0fc0('0xe')](_0x0fc0('0x1f'),_0x55fcfc['message'],_0x5d0de6);_0x12e23e(_0x39f918[_0x0fc0('0xe')](0x1f4,_0x55fcfc[_0x0fc0('0x11')]));});});}; \ No newline at end of file +var _0xf735=['limit','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','VoiceAgentReport','create','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','body','where'];(function(_0x12c43c,_0x31f123){var _0x1ba32c=function(_0x3097c7){while(--_0x3097c7){_0x12c43c['push'](_0x12c43c['shift']());}};_0x1ba32c(++_0x31f123);}(_0xf735,0x18d));var _0x5f73=function(_0x463550,_0x35854f){_0x463550=_0x463550-0x0;var _0x3af82f=_0xf735[_0x463550];return _0x3af82f;};'use strict';var _=require(_0x5f73('0x0'));var util=require('util');var moment=require(_0x5f73('0x1'));var BPromise=require(_0x5f73('0x2'));var rs=require(_0x5f73('0x3'));var fs=require('fs');var Redis=require(_0x5f73('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f73('0x5'));var logger=require(_0x5f73('0x6'))('rpc');var config=require(_0x5f73('0x7'));var jayson=require(_0x5f73('0x8'));var client=jayson[_0x5f73('0x9')][_0x5f73('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x181d37,_0x53e4f8,_0x1ee267){return new BPromise(function(_0x5d1c14,_0x443210){return client[_0x5f73('0xb')](_0x181d37,_0x1ee267)[_0x5f73('0xc')](function(_0x143e32){logger['info'](_0x5f73('0xd'),_0x53e4f8,_0x5f73('0xe'));logger[_0x5f73('0xf')](_0x5f73('0x10'),_0x53e4f8,_0x5f73('0xe'),JSON[_0x5f73('0x11')](_0x143e32));if(_0x143e32['error']){if(_0x143e32[_0x5f73('0x12')][_0x5f73('0x13')]===0x1f4){logger[_0x5f73('0x12')](_0x5f73('0xd'),_0x53e4f8,_0x143e32['error'][_0x5f73('0x14')]);return _0x443210(_0x143e32[_0x5f73('0x12')][_0x5f73('0x14')]);}logger[_0x5f73('0x12')](_0x5f73('0xd'),_0x53e4f8,_0x143e32[_0x5f73('0x12')][_0x5f73('0x14')]);return _0x5d1c14(_0x143e32[_0x5f73('0x12')][_0x5f73('0x14')]);}else{logger[_0x5f73('0x15')](_0x5f73('0xd'),_0x53e4f8,_0x5f73('0xe'));_0x5d1c14(_0x143e32['result'][_0x5f73('0x14')]);}})[_0x5f73('0x16')](function(_0xcefa62){logger['error'](_0x5f73('0xd'),_0x53e4f8,_0xcefa62);_0x443210(_0xcefa62);});});}exports['CreateVoiceAgentReport']=function(_0x32dd22){var _0x2d5a37=this;return new Promise(function(_0x117d5f,_0x4026a9){return db[_0x5f73('0x17')][_0x5f73('0x18')](_0x32dd22['body'],{'raw':_0x32dd22[_0x5f73('0x19')]?_0x32dd22['options'][_0x5f73('0x1a')]===undefined?!![]:![]:!![]})[_0x5f73('0xc')](function(_0x3f20c6){logger['info'](_0x5f73('0x1b'),_0x32dd22);logger[_0x5f73('0xf')](_0x5f73('0x1b'),_0x32dd22,JSON[_0x5f73('0x11')](_0x3f20c6));_0x117d5f(_0x3f20c6);})['catch'](function(_0x1de67d){logger[_0x5f73('0x12')](_0x5f73('0x1b'),_0x1de67d[_0x5f73('0x14')],_0x32dd22);_0x4026a9(_0x2d5a37[_0x5f73('0x12')](0x1f4,_0x1de67d['message']));});});};exports[_0x5f73('0x1c')]=function(_0x4a62b4){var _0xdce194=this;return new Promise(function(_0x282562,_0x4bc7d6){return db[_0x5f73('0x17')][_0x5f73('0x1d')](_0x4a62b4[_0x5f73('0x1e')],{'raw':_0x4a62b4[_0x5f73('0x19')]?_0x4a62b4[_0x5f73('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a62b4['options']?_0x4a62b4[_0x5f73('0x19')][_0x5f73('0x1f')]||null:null,'attributes':_0x4a62b4[_0x5f73('0x19')]?_0x4a62b4[_0x5f73('0x19')]['attributes']||null:null,'limit':_0x4a62b4[_0x5f73('0x19')]?_0x4a62b4[_0x5f73('0x19')][_0x5f73('0x20')]||null:null})[_0x5f73('0xc')](function(_0x34147e){logger[_0x5f73('0x15')]('UpdateVoiceAgentReport',_0x4a62b4);logger[_0x5f73('0xf')](_0x5f73('0x1c'),_0x4a62b4,JSON['stringify'](_0x34147e));_0x282562(_0x34147e);})['catch'](function(_0x2e4001){logger['error'](_0x5f73('0x1c'),_0x2e4001[_0x5f73('0x14')],_0x4a62b4);_0x4bc7d6(_0xdce194['error'](0x1f4,_0x2e4001['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 79eedba..7e270ef 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 _0xc272=['index','describe','/:id','show','post','create','put','update','/with-retry/:id','updateWithRetry','delete','destroy','exports','express','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated'];(function(_0x47f767,_0x2e92f3){var _0x21c9a0=function(_0x203c34){while(--_0x203c34){_0x47f767['push'](_0x47f767['shift']());}};_0x21c9a0(++_0x2e92f3);}(_0xc272,0x19c));var _0x2c27=function(_0x3f25b2,_0x412bd4){_0x3f25b2=_0x3f25b2-0x0;var _0xd8caeb=_0xc272[_0x3f25b2];return _0xd8caeb;};'use strict';var express=require(_0x2c27('0x0'));var router=express[_0x2c27('0x1')]();var auth=require(_0x2c27('0x2'));var controller=require(_0x2c27('0x3'));router[_0x2c27('0x4')]('/',auth[_0x2c27('0x5')](),controller[_0x2c27('0x6')]);router['get']('/describe',auth[_0x2c27('0x5')](),controller[_0x2c27('0x7')]);router[_0x2c27('0x4')](_0x2c27('0x8'),auth[_0x2c27('0x5')](),controller[_0x2c27('0x9')]);router[_0x2c27('0xa')]('/',auth['isAuthenticated'](),controller[_0x2c27('0xb')]);router[_0x2c27('0xc')](_0x2c27('0x8'),auth[_0x2c27('0x5')](),controller[_0x2c27('0xd')]);router['put'](_0x2c27('0xe'),auth[_0x2c27('0x5')](),controller[_0x2c27('0xf')]);router[_0x2c27('0x10')](_0x2c27('0x8'),auth['isAuthenticated'](),controller[_0x2c27('0x11')]);module[_0x2c27('0x12')]=router; \ No newline at end of file +var _0x38e8=['isAuthenticated','index','/describe','describe','/:id','put','updateWithRetry','destroy','exports','express','Router','./voiceCallReport.controller','get'];(function(_0x4aba15,_0x4e90aa){var _0x1c8122=function(_0x568dba){while(--_0x568dba){_0x4aba15['push'](_0x4aba15['shift']());}};_0x1c8122(++_0x4e90aa);}(_0x38e8,0x15b));var _0x838e=function(_0x483c52,_0x330afb){_0x483c52=_0x483c52-0x0;var _0x5ec92a=_0x38e8[_0x483c52];return _0x5ec92a;};'use strict';var express=require(_0x838e('0x0'));var router=express[_0x838e('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x838e('0x2'));router[_0x838e('0x3')]('/',auth[_0x838e('0x4')](),controller[_0x838e('0x5')]);router[_0x838e('0x3')](_0x838e('0x6'),auth['isAuthenticated'](),controller[_0x838e('0x7')]);router[_0x838e('0x3')](_0x838e('0x8'),auth[_0x838e('0x4')](),controller['show']);router['post']('/',auth[_0x838e('0x4')](),controller['create']);router[_0x838e('0x9')](_0x838e('0x8'),auth[_0x838e('0x4')](),controller['update']);router[_0x838e('0x9')]('/with-retry/:id',auth[_0x838e('0x4')](),controller[_0x838e('0xa')]);router['delete'](_0x838e('0x8'),auth[_0x838e('0x4')](),controller[_0x838e('0xb')]);module[_0x838e('0xc')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index f49b6c5..e5da3f0 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 _0x8d75=['exports','STRING','ENUM','inbound','internal','outbound-fax','dialer','DATE','INTEGER','sequelize'];(function(_0x3a6f75,_0x2c532f){var _0x413b52=function(_0x495d25){while(--_0x495d25){_0x3a6f75['push'](_0x3a6f75['shift']());}};_0x413b52(++_0x2c532f);}(_0x8d75,0x6d));var _0x58d7=function(_0xc8fc4d,_0x4ebbbc){_0xc8fc4d=_0xc8fc4d-0x0;var _0x58a7ca=_0x8d75[_0xc8fc4d];return _0x58a7ca;};'use strict';var Sequelize=require(_0x58d7('0x0'));module[_0x58d7('0x1')]={'uniqueid':{'type':Sequelize[_0x58d7('0x2')]},'type':{'type':Sequelize[_0x58d7('0x3')](_0x58d7('0x4'),_0x58d7('0x5'),'outbound','inbound-fax',_0x58d7('0x6'),_0x58d7('0x7'))},'tag':{'type':Sequelize[_0x58d7('0x2')]},'accountcode':{'type':Sequelize[_0x58d7('0x2')]},'source':{'type':Sequelize[_0x58d7('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x58d7('0x2')]},'channel':{'type':Sequelize[_0x58d7('0x2')]},'destinationchannel':{'type':Sequelize[_0x58d7('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x58d7('0x8')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x58d7('0x8')]},'endtime':{'type':Sequelize[_0x58d7('0x8')]},'duration':{'type':Sequelize[_0x58d7('0x9')]},'billableseconds':{'type':Sequelize[_0x58d7('0x9')]},'mohtime':{'type':Sequelize[_0x58d7('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x58d7('0x2')]},'amaflags':{'type':Sequelize[_0x58d7('0x2')]},'userfield':{'type':Sequelize[_0x58d7('0x2')]},'userDisposition':{'type':Sequelize[_0x58d7('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x58d7('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x58d7('0x2')]},'note':{'type':Sequelize[_0x58d7('0x2')]},'prefix':{'type':Sequelize[_0x58d7('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x58d7('0x2')]}}; \ No newline at end of file +var _0x0268=['internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','STRING','ENUM'];(function(_0x31b350,_0x5be290){var _0x1870dc=function(_0xbae48d){while(--_0xbae48d){_0x31b350['push'](_0x31b350['shift']());}};_0x1870dc(++_0x5be290);}(_0x0268,0x17e));var _0x8026=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x0268[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x8026('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x8026('0x1')]},'type':{'type':Sequelize[_0x8026('0x2')]('inbound',_0x8026('0x3'),_0x8026('0x4'),_0x8026('0x5'),_0x8026('0x6'),_0x8026('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8026('0x1')]},'source':{'type':Sequelize[_0x8026('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x8026('0x1')]},'callerid':{'type':Sequelize[_0x8026('0x1')]},'channel':{'type':Sequelize[_0x8026('0x1')]},'destinationchannel':{'type':Sequelize[_0x8026('0x1')]},'lastapplication':{'type':Sequelize[_0x8026('0x1')]},'lastdata':{'type':Sequelize[_0x8026('0x8')]},'starttime':{'type':Sequelize[_0x8026('0x9')]},'systemanswertime':{'type':Sequelize[_0x8026('0x9')]},'answertime':{'type':Sequelize[_0x8026('0x9')]},'endtime':{'type':Sequelize[_0x8026('0x9')]},'duration':{'type':Sequelize[_0x8026('0xa')]},'billableseconds':{'type':Sequelize[_0x8026('0xa')]},'mohtime':{'type':Sequelize[_0x8026('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x8026('0x1')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x8026('0x1')]},'note':{'type':Sequelize[_0x8026('0x1')]},'prefix':{'type':Sequelize[_0x8026('0x1')]},'routeid':{'type':Sequelize[_0x8026('0xa')]},'sipcallid':{'type':Sequelize[_0x8026('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index feb5791..95f4df7 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 _0x229c=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','VoiceCallReport','count','includeAll','include','fullname','alias','User','findAll','rows','show','model','catch','create','body','find','params','describe','user','uniqueid','updateWithRetry','No\x20such\x20report','../../components/parsers/qs','../../mysqldb','status','json','offset','undefined','limit','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','map','query','keys','filters','intersection','attributes','fields','length'];(function(_0x3a52ef,_0xcc66be){var _0x31ab62=function(_0x2e6213){while(--_0x2e6213){_0x3a52ef['push'](_0x3a52ef['shift']());}};_0x31ab62(++_0xcc66be);}(_0x229c,0xcf));var _0xc229=function(_0x36ad00,_0x81e5b7){_0x36ad00=_0x36ad00-0x0;var _0x508505=_0x229c[_0x36ad00];return _0x508505;};'use strict';var _=require('lodash');var qs=require(_0xc229('0x0'));var logger=require('../../config/logger')('api');var db=require(_0xc229('0x1'))['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x4c3ab9,_0x3b5330){_0x3b5330=_0x3b5330||0xc8;return function(_0x5c1093){if(_0x5c1093){return _0x4c3ab9[_0xc229('0x2')](_0x3b5330)[_0xc229('0x3')](_0x5c1093);}};}function respondWithFilteredResult(_0x1a246a,_0x5a0d2c){return function(_0x44aba3){if(_0x44aba3){var _0x52978a=typeof _0x5a0d2c[_0xc229('0x4')]===_0xc229('0x5')&&typeof _0x5a0d2c['limit']===_0xc229('0x5');var _0x9f6c95=_0x44aba3['count'];var _0x529822=_0x52978a?0x0:_0x5a0d2c[_0xc229('0x4')];var _0x5a5d9b=_0x52978a?_0x44aba3['count']:_0x5a0d2c[_0xc229('0x4')]+_0x5a0d2c[_0xc229('0x6')];var _0x11e925;if(_0x5a5d9b>=_0x9f6c95){_0x5a5d9b=_0x9f6c95;_0x11e925=0xc8;}else{_0x11e925=0xce;}_0x1a246a[_0xc229('0x2')](_0x11e925);return _0x1a246a[_0xc229('0x7')](_0xc229('0x8'),_0x529822+'-'+_0x5a5d9b+'/'+_0x9f6c95)[_0xc229('0x3')](_0x44aba3);}return null;};}function saveUpdates(_0xd10711){return function(_0xf7cd15){if(_0xf7cd15){return _0xf7cd15[_0xc229('0x9')](_0xd10711)[_0xc229('0xa')](function(_0x3f4ebf){return _0x3f4ebf;});}return null;};}function removeEntity(_0x36af45){return function(_0x58aaa4){if(_0x58aaa4){return _0x58aaa4[_0xc229('0xb')]()['then'](function(){_0x36af45[_0xc229('0x2')](0xcc)[_0xc229('0xc')]();});}};}function handleEntityNotFound(_0x231086){return function(_0x1cc8ed){if(!_0x1cc8ed){_0x231086[_0xc229('0xd')](0x194);}return _0x1cc8ed;};}function handleError(_0x7b71c3,_0x292f30){_0x292f30=_0x292f30||0x1f4;return function(_0x2bc9ea){logger[_0xc229('0xe')](_0x2bc9ea[_0xc229('0xf')]);if(_0x2bc9ea[_0xc229('0x10')]){delete _0x2bc9ea[_0xc229('0x10')];}_0x7b71c3[_0xc229('0x2')](_0x292f30)['send'](_0x2bc9ea);};}exports[_0xc229('0x11')]=function(_0x10339a,_0x393e8c){var _0x193c75={},_0x3b5c2b={},_0x14ef5e={'count':0x0,'rows':[]};var _0x119e07=_['map'](db['VoiceCallReport'][_0xc229('0x12')],function(_0x53dbba){return{'name':_0x53dbba[_0xc229('0x13')],'type':_0x53dbba[_0xc229('0x14')]['key']};});_0x3b5c2b['model']=_[_0xc229('0x15')](_0x119e07,_0xc229('0x10'));_0x3b5c2b[_0xc229('0x16')]=_[_0xc229('0x17')](_0x10339a[_0xc229('0x16')]);_0x3b5c2b[_0xc229('0x18')]=_[_0xc229('0x19')](_0x3b5c2b['model'],_0x3b5c2b['query']);_0x193c75[_0xc229('0x1a')]=_[_0xc229('0x19')](_0x3b5c2b['model'],qs['fields'](_0x10339a[_0xc229('0x16')][_0xc229('0x1b')]));_0x193c75[_0xc229('0x1a')]=_0x193c75[_0xc229('0x1a')][_0xc229('0x1c')]?_0x193c75[_0xc229('0x1a')]:_0x3b5c2b['model'];if(!_0x10339a[_0xc229('0x16')][_0xc229('0x1d')](_0xc229('0x1e'))){_0x193c75['limit']=qs['limit'](_0x10339a[_0xc229('0x16')]['limit']);_0x193c75[_0xc229('0x4')]=qs[_0xc229('0x4')](_0x10339a[_0xc229('0x16')][_0xc229('0x4')]);}_0x193c75[_0xc229('0x1f')]=qs[_0xc229('0x20')](_0x10339a[_0xc229('0x16')][_0xc229('0x20')]);_0x193c75[_0xc229('0x21')]=qs[_0xc229('0x18')](_[_0xc229('0x22')](_0x10339a[_0xc229('0x16')],_0x3b5c2b[_0xc229('0x18')]),_0x119e07);if(_0x10339a[_0xc229('0x16')][_0xc229('0x23')]){_0x193c75[_0xc229('0x21')]=_[_0xc229('0x24')](_0x193c75[_0xc229('0x21')],{'$or':_[_0xc229('0x15')](_0x119e07,function(_0x39d335){if(_0x39d335[_0xc229('0x14')]!=='VIRTUAL'){var _0x294709={};_0x294709[_0x39d335['name']]={'$like':'%'+_0x10339a[_0xc229('0x16')][_0xc229('0x23')]+'%'};return _0x294709;}})});}_0x193c75=_['merge']({},_0x193c75,_0x10339a[_0xc229('0x25')]);var _0x46d475={'where':_0x193c75[_0xc229('0x21')]};return db[_0xc229('0x26')][_0xc229('0x27')](_0x46d475)[_0xc229('0xa')](function(_0x4aabf5){_0x14ef5e[_0xc229('0x27')]=_0x4aabf5;if(_0x10339a[_0xc229('0x16')][_0xc229('0x28')]){_0x193c75[_0xc229('0x29')]=[{'attributes':['id',_0xc229('0x10'),_0xc229('0x2a'),_0xc229('0x2b')],'model':db[_0xc229('0x2c')],'as':_0xc229('0x2c')}];}return db[_0xc229('0x26')][_0xc229('0x2d')](_0x193c75);})['then'](function(_0x424ca3){_0x14ef5e[_0xc229('0x2e')]=_0x424ca3;return _0x14ef5e;})[_0xc229('0xa')](respondWithFilteredResult(_0x393e8c,_0x193c75))['catch'](handleError(_0x393e8c,null));};exports[_0xc229('0x2f')]=function(_0x302f61,_0x5270e5){var _0x48c156={'raw':!![],'where':{'id':_0x302f61['params']['id']}},_0x6a8c0c={};_0x6a8c0c['model']=_['keys'](db[_0xc229('0x26')]['rawAttributes']);_0x6a8c0c['query']=_[_0xc229('0x17')](_0x302f61['query']);_0x6a8c0c[_0xc229('0x18')]=_[_0xc229('0x19')](_0x6a8c0c[_0xc229('0x30')],_0x6a8c0c[_0xc229('0x16')]);_0x48c156[_0xc229('0x1a')]=_['intersection'](_0x6a8c0c[_0xc229('0x30')],qs['fields'](_0x302f61[_0xc229('0x16')][_0xc229('0x1b')]));_0x48c156[_0xc229('0x1a')]=_0x48c156[_0xc229('0x1a')][_0xc229('0x1c')]?_0x48c156[_0xc229('0x1a')]:_0x6a8c0c['model'];if(_0x302f61[_0xc229('0x16')][_0xc229('0x28')]){_0x48c156[_0xc229('0x29')]=[{'all':!![]}];}_0x48c156=_[_0xc229('0x24')]({},_0x48c156,_0x302f61[_0xc229('0x25')]);return db['VoiceCallReport']['find'](_0x48c156)[_0xc229('0xa')](handleEntityNotFound(_0x5270e5,null))[_0xc229('0xa')](respondWithResult(_0x5270e5,null))[_0xc229('0x31')](handleError(_0x5270e5,null));};exports[_0xc229('0x32')]=function(_0x553386,_0x109b37){return db[_0xc229('0x26')][_0xc229('0x32')](_0x553386[_0xc229('0x33')],{})[_0xc229('0xa')](respondWithResult(_0x109b37,0xc9))[_0xc229('0x31')](handleError(_0x109b37,null));};exports[_0xc229('0xb')]=function(_0x5a8a7d,_0x55c4d2){return db[_0xc229('0x26')][_0xc229('0x34')]({'where':{'id':_0x5a8a7d[_0xc229('0x35')]['id']}})[_0xc229('0xa')](handleEntityNotFound(_0x55c4d2,null))[_0xc229('0xa')](removeEntity(_0x55c4d2,null))[_0xc229('0x31')](handleError(_0x55c4d2,null));};exports[_0xc229('0x36')]=function(_0x2521db,_0x199ae0){return db[_0xc229('0x26')]['describe']()[_0xc229('0xa')](respondWithResult(_0x199ae0,null))['catch'](handleError(_0x199ae0,null));};function findForUpdate(_0x3817f2){return db[_0xc229('0x26')][_0xc229('0x34')]({'where':{'uniqueid':_0x3817f2['params']['id'],'UserId':{'$or':[null,_0x3817f2[_0xc229('0x37')]['id']]}}});}exports['update']=function(_0x2b5b08,_0x2d3889){if(_0x2b5b08[_0xc229('0x33')]['uniqueid']){delete _0x2b5b08[_0xc229('0x33')][_0xc229('0x38')];}return findForUpdate(_0x2b5b08)[_0xc229('0xa')](handleEntityNotFound(_0x2d3889,null))[_0xc229('0xa')](saveUpdates(_0x2b5b08[_0xc229('0x33')],null))[_0xc229('0xa')](respondWithResult(_0x2d3889,null))[_0xc229('0x31')](handleError(_0x2d3889,null));};exports[_0xc229('0x39')]=function(_0x11c24a,_0xbf8328,_0x37cfe4){if(_0x11c24a[_0xc229('0x33')][_0xc229('0x38')]){delete _0x11c24a[_0xc229('0x33')][_0xc229('0x38')];}promiseRetry(function(_0x1c6527){return findForUpdate(_0x11c24a)[_0xc229('0xa')](function(_0x1098b5){if(_0x1098b5!==null){return _0x1098b5;}else{_0x1c6527(new Error(_0xc229('0x3a')));}});},{'retries':0x4,'minTimeout':0xfa})[_0xc229('0xa')](function(_0x49aeba){if(!_0x49aeba){return new Promise(function(_0x5a8dcc){_0x5a8dcc(handleEntityNotFound(_0xbf8328)());});}else{return _0x49aeba[_0xc229('0x9')](_0x11c24a[_0xc229('0x33')])[_0xc229('0xa')](function(_0x442dbe){return respondWithResult(_0xbf8328)(_0x442dbe);});}},function(){handleEntityNotFound(_0xbf8328)();});}; \ No newline at end of file +var _0xa809=['undefined','count','limit','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','index','map','VoiceCallReport','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','includeAll','include','fullname','alias','User','rows','catch','show','keys','find','create','body','params','describe','user','uniqueid','updateWithRetry','No\x20such\x20report','../../components/parsers/qs','../../mysqldb','status','json','offset'];(function(_0x352c13,_0x1a91cb){var _0x5b48e8=function(_0x1afcc2){while(--_0x1afcc2){_0x352c13['push'](_0x352c13['shift']());}};_0x5b48e8(++_0x1a91cb);}(_0xa809,0x1f3));var _0x9a80=function(_0x446f51,_0x2e735a){_0x446f51=_0x446f51-0x0;var _0x4f9001=_0xa809[_0x446f51];return _0x4f9001;};'use strict';var _=require('lodash');var qs=require(_0x9a80('0x0'));var logger=require('../../config/logger')('api');var db=require(_0x9a80('0x1'))['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x57603b,_0x5e516a){_0x5e516a=_0x5e516a||0xc8;return function(_0x2b07d5){if(_0x2b07d5){return _0x57603b[_0x9a80('0x2')](_0x5e516a)[_0x9a80('0x3')](_0x2b07d5);}};}function respondWithFilteredResult(_0x1c8262,_0x4c748d){return function(_0x295910){if(_0x295910){var _0x504ba8=typeof _0x4c748d[_0x9a80('0x4')]===_0x9a80('0x5')&&typeof _0x4c748d['limit']===_0x9a80('0x5');var _0x20b033=_0x295910[_0x9a80('0x6')];var _0x269ee2=_0x504ba8?0x0:_0x4c748d['offset'];var _0x3d5aba=_0x504ba8?_0x295910[_0x9a80('0x6')]:_0x4c748d[_0x9a80('0x4')]+_0x4c748d[_0x9a80('0x7')];var _0xea85c5;if(_0x3d5aba>=_0x20b033){_0x3d5aba=_0x20b033;_0xea85c5=0xc8;}else{_0xea85c5=0xce;}_0x1c8262[_0x9a80('0x2')](_0xea85c5);return _0x1c8262[_0x9a80('0x8')](_0x9a80('0x9'),_0x269ee2+'-'+_0x3d5aba+'/'+_0x20b033)['json'](_0x295910);}return null;};}function saveUpdates(_0x3a7436){return function(_0x4dc0a5){if(_0x4dc0a5){return _0x4dc0a5[_0x9a80('0xa')](_0x3a7436)[_0x9a80('0xb')](function(_0x3c28a0){return _0x3c28a0;});}return null;};}function removeEntity(_0x32bb69){return function(_0x25f667){if(_0x25f667){return _0x25f667[_0x9a80('0xc')]()['then'](function(){_0x32bb69[_0x9a80('0x2')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384be7){return function(_0x109066){if(!_0x109066){_0x384be7[_0x9a80('0xd')](0x194);}return _0x109066;};}function handleError(_0x5181b5,_0x3f393c){_0x3f393c=_0x3f393c||0x1f4;return function(_0x10445f){logger[_0x9a80('0xe')](_0x10445f[_0x9a80('0xf')]);if(_0x10445f[_0x9a80('0x10')]){delete _0x10445f['name'];}_0x5181b5[_0x9a80('0x2')](_0x3f393c)['send'](_0x10445f);};}exports[_0x9a80('0x11')]=function(_0x281ca5,_0x450cac){var _0x3c2ae0={},_0x5292d0={},_0x47cfe4={'count':0x0,'rows':[]};var _0x314e2c=_[_0x9a80('0x12')](db[_0x9a80('0x13')][_0x9a80('0x14')],function(_0x42e054){return{'name':_0x42e054['fieldName'],'type':_0x42e054[_0x9a80('0x15')][_0x9a80('0x16')]};});_0x5292d0[_0x9a80('0x17')]=_['map'](_0x314e2c,'name');_0x5292d0[_0x9a80('0x18')]=_['keys'](_0x281ca5[_0x9a80('0x18')]);_0x5292d0['filters']=_[_0x9a80('0x19')](_0x5292d0['model'],_0x5292d0[_0x9a80('0x18')]);_0x3c2ae0[_0x9a80('0x1a')]=_[_0x9a80('0x19')](_0x5292d0[_0x9a80('0x17')],qs[_0x9a80('0x1b')](_0x281ca5[_0x9a80('0x18')][_0x9a80('0x1b')]));_0x3c2ae0[_0x9a80('0x1a')]=_0x3c2ae0['attributes'][_0x9a80('0x1c')]?_0x3c2ae0[_0x9a80('0x1a')]:_0x5292d0['model'];if(!_0x281ca5[_0x9a80('0x18')][_0x9a80('0x1d')]('nolimit')){_0x3c2ae0[_0x9a80('0x7')]=qs[_0x9a80('0x7')](_0x281ca5[_0x9a80('0x18')][_0x9a80('0x7')]);_0x3c2ae0[_0x9a80('0x4')]=qs[_0x9a80('0x4')](_0x281ca5['query'][_0x9a80('0x4')]);}_0x3c2ae0[_0x9a80('0x1e')]=qs[_0x9a80('0x1f')](_0x281ca5[_0x9a80('0x18')][_0x9a80('0x1f')]);_0x3c2ae0['where']=qs[_0x9a80('0x20')](_[_0x9a80('0x21')](_0x281ca5[_0x9a80('0x18')],_0x5292d0[_0x9a80('0x20')]),_0x314e2c);if(_0x281ca5['query'][_0x9a80('0x22')]){_0x3c2ae0[_0x9a80('0x23')]=_[_0x9a80('0x24')](_0x3c2ae0[_0x9a80('0x23')],{'$or':_['map'](_0x314e2c,function(_0x416b04){if(_0x416b04[_0x9a80('0x15')]!=='VIRTUAL'){var _0x196f06={};_0x196f06[_0x416b04[_0x9a80('0x10')]]={'$like':'%'+_0x281ca5[_0x9a80('0x18')][_0x9a80('0x22')]+'%'};return _0x196f06;}})});}_0x3c2ae0=_['merge']({},_0x3c2ae0,_0x281ca5[_0x9a80('0x25')]);var _0x6ec7a1={'where':_0x3c2ae0[_0x9a80('0x23')]};return db[_0x9a80('0x13')][_0x9a80('0x6')](_0x6ec7a1)[_0x9a80('0xb')](function(_0x302edd){_0x47cfe4[_0x9a80('0x6')]=_0x302edd;if(_0x281ca5[_0x9a80('0x18')][_0x9a80('0x26')]){_0x3c2ae0[_0x9a80('0x27')]=[{'attributes':['id',_0x9a80('0x10'),_0x9a80('0x28'),_0x9a80('0x29')],'model':db[_0x9a80('0x2a')],'as':'User'}];}return db['VoiceCallReport']['findAll'](_0x3c2ae0);})[_0x9a80('0xb')](function(_0xf7d39f){_0x47cfe4[_0x9a80('0x2b')]=_0xf7d39f;return _0x47cfe4;})['then'](respondWithFilteredResult(_0x450cac,_0x3c2ae0))[_0x9a80('0x2c')](handleError(_0x450cac,null));};exports[_0x9a80('0x2d')]=function(_0x3c2882,_0x2879f7){var _0x4dee01={'raw':!![],'where':{'id':_0x3c2882['params']['id']}},_0x5ae480={};_0x5ae480['model']=_[_0x9a80('0x2e')](db[_0x9a80('0x13')][_0x9a80('0x14')]);_0x5ae480['query']=_[_0x9a80('0x2e')](_0x3c2882['query']);_0x5ae480[_0x9a80('0x20')]=_[_0x9a80('0x19')](_0x5ae480[_0x9a80('0x17')],_0x5ae480[_0x9a80('0x18')]);_0x4dee01['attributes']=_[_0x9a80('0x19')](_0x5ae480['model'],qs[_0x9a80('0x1b')](_0x3c2882[_0x9a80('0x18')]['fields']));_0x4dee01['attributes']=_0x4dee01['attributes'][_0x9a80('0x1c')]?_0x4dee01['attributes']:_0x5ae480[_0x9a80('0x17')];if(_0x3c2882[_0x9a80('0x18')][_0x9a80('0x26')]){_0x4dee01[_0x9a80('0x27')]=[{'all':!![]}];}_0x4dee01=_[_0x9a80('0x24')]({},_0x4dee01,_0x3c2882[_0x9a80('0x25')]);return db[_0x9a80('0x13')][_0x9a80('0x2f')](_0x4dee01)['then'](handleEntityNotFound(_0x2879f7,null))[_0x9a80('0xb')](respondWithResult(_0x2879f7,null))[_0x9a80('0x2c')](handleError(_0x2879f7,null));};exports[_0x9a80('0x30')]=function(_0x554073,_0x39cb75){return db['VoiceCallReport']['create'](_0x554073[_0x9a80('0x31')],{})[_0x9a80('0xb')](respondWithResult(_0x39cb75,0xc9))[_0x9a80('0x2c')](handleError(_0x39cb75,null));};exports[_0x9a80('0xc')]=function(_0xcbb250,_0xbc5a5e){return db[_0x9a80('0x13')][_0x9a80('0x2f')]({'where':{'id':_0xcbb250[_0x9a80('0x32')]['id']}})[_0x9a80('0xb')](handleEntityNotFound(_0xbc5a5e,null))['then'](removeEntity(_0xbc5a5e,null))[_0x9a80('0x2c')](handleError(_0xbc5a5e,null));};exports['describe']=function(_0x46821a,_0x418807){return db['VoiceCallReport'][_0x9a80('0x33')]()[_0x9a80('0xb')](respondWithResult(_0x418807,null))['catch'](handleError(_0x418807,null));};function findForUpdate(_0x537e24){return db[_0x9a80('0x13')][_0x9a80('0x2f')]({'where':{'uniqueid':_0x537e24[_0x9a80('0x32')]['id'],'UserId':{'$or':[null,_0x537e24[_0x9a80('0x34')]['id']]}}});}exports['update']=function(_0x4d7b76,_0xd027ed){if(_0x4d7b76[_0x9a80('0x31')][_0x9a80('0x35')]){delete _0x4d7b76['body'][_0x9a80('0x35')];}return findForUpdate(_0x4d7b76)['then'](handleEntityNotFound(_0xd027ed,null))[_0x9a80('0xb')](saveUpdates(_0x4d7b76[_0x9a80('0x31')],null))['then'](respondWithResult(_0xd027ed,null))[_0x9a80('0x2c')](handleError(_0xd027ed,null));};exports[_0x9a80('0x36')]=function(_0x42c1bd,_0x41c5e9,_0x39e36b){if(_0x42c1bd['body']['uniqueid']){delete _0x42c1bd['body']['uniqueid'];}promiseRetry(function(_0xfee655){return findForUpdate(_0x42c1bd)[_0x9a80('0xb')](function(_0x248783){if(_0x248783!==null){return _0x248783;}else{_0xfee655(new Error(_0x9a80('0x37')));}});},{'retries':0x4,'minTimeout':0xfa})[_0x9a80('0xb')](function(_0x5f57ad){if(!_0x5f57ad){return new Promise(function(_0x346186){_0x346186(handleEntityNotFound(_0x41c5e9)());});}else{return _0x5f57ad[_0x9a80('0xa')](_0x42c1bd[_0x9a80('0x31')])[_0x9a80('0xb')](function(_0x124e31){return respondWithResult(_0x41c5e9)(_0x124e31);});}},function(){handleEntityNotFound(_0x41c5e9)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 7e3aebc..800f4aa 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 _0x59a0=['define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2ce1f1,_0x572c25){var _0x25edcc=function(_0xbb73d0){while(--_0xbb73d0){_0x2ce1f1['push'](_0x2ce1f1['shift']());}};_0x25edcc(++_0x572c25);}(_0x59a0,0x184));var _0x059a=function(_0x283c2d,_0x4631d7){_0x283c2d=_0x283c2d-0x0;var _0x459ce9=_0x59a0[_0x283c2d];return _0x459ce9;};'use strict';var _=require(_0x059a('0x0'));var util=require(_0x059a('0x1'));var logger=require(_0x059a('0x2'))('api');var moment=require(_0x059a('0x3'));var BPromise=require(_0x059a('0x4'));var rp=require(_0x059a('0x5'));var fs=require('fs');var path=require(_0x059a('0x6'));var rimraf=require('rimraf');var config=require(_0x059a('0x7'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x1a267c,_0x5c5b25){return _0x1a267c[_0x059a('0x8')](_0x059a('0x9'),attributes,{'tableName':_0x059a('0xa'),'paranoid':![],'indexes':[{'fields':[_0x059a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7e14=['api','moment','bluebird','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','VoiceCallReport','lodash','util','../../config/logger'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x7e14,0x99));var _0x47e1=function(_0x3b9a89,_0x2a962f){_0x3b9a89=_0x3b9a89-0x0;var _0x3e7ebc=_0x7e14[_0x3b9a89];return _0x3e7ebc;};'use strict';var _=require(_0x47e1('0x0'));var util=require(_0x47e1('0x1'));var logger=require(_0x47e1('0x2'))(_0x47e1('0x3'));var moment=require(_0x47e1('0x4'));var BPromise=require(_0x47e1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47e1('0x6'));var rimraf=require(_0x47e1('0x7'));var config=require(_0x47e1('0x8'));var attributes=require(_0x47e1('0x9'));module[_0x47e1('0xa')]=function(_0xeb39da,_0x81cadf){return _0xeb39da['define'](_0x47e1('0xb'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 56414bd..e3680f3 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 _0xc614=['error','code','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','include','map','model','attributes','then','info','debug','catch','CreateVoiceCallReport','create','body','update','UpdateVoiceCallReport','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x54904e,_0x5647ff){var _0x179c42=function(_0x318885){while(--_0x318885){_0x54904e['push'](_0x54904e['shift']());}};_0x179c42(++_0x5647ff);}(_0xc614,0xcb));var _0x4c61=function(_0x1095dc,_0x575b30){_0x1095dc=_0x1095dc-0x0;var _0x3ea68c=_0xc614[_0x1095dc];return _0x3ea68c;};'use strict';var _=require(_0x4c61('0x0'));var util=require(_0x4c61('0x1'));var moment=require('moment');var BPromise=require(_0x4c61('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c61('0x3'));var db=require(_0x4c61('0x4'))['db'];var utils=require(_0x4c61('0x5'));var logger=require('../../config/logger')(_0x4c61('0x6'));var config=require('../../config/environment');var jayson=require(_0x4c61('0x7'));var client=jayson[_0x4c61('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59c02f,_0x4f7946,_0xdbd022){return new BPromise(function(_0x75993b,_0xc15d4b){return client['request'](_0x59c02f,_0xdbd022)['then'](function(_0xcf6d97){logger['info'](_0x4c61('0x9'),_0x4f7946,_0x4c61('0xa'));logger['debug'](_0x4c61('0xb'),_0x4f7946,_0x4c61('0xa'),JSON[_0x4c61('0xc')](_0xcf6d97));if(_0xcf6d97[_0x4c61('0xd')]){if(_0xcf6d97[_0x4c61('0xd')][_0x4c61('0xe')]===0x1f4){logger[_0x4c61('0xd')](_0x4c61('0x9'),_0x4f7946,_0xcf6d97[_0x4c61('0xd')][_0x4c61('0xf')]);return _0xc15d4b(_0xcf6d97['error'][_0x4c61('0xf')]);}logger[_0x4c61('0xd')](_0x4c61('0x9'),_0x4f7946,_0xcf6d97[_0x4c61('0xd')][_0x4c61('0xf')]);return _0x75993b(_0xcf6d97[_0x4c61('0xd')][_0x4c61('0xf')]);}else{logger['info'](_0x4c61('0x9'),_0x4f7946,'request\x20sent');_0x75993b(_0xcf6d97[_0x4c61('0x10')][_0x4c61('0xf')]);}})['catch'](function(_0x489ef7){logger['error'](_0x4c61('0x9'),_0x4f7946,_0x489ef7);_0xc15d4b(_0x489ef7);});});}exports[_0x4c61('0x11')]=function(_0x49a66f){var _0x17cf13=this;return new Promise(function(_0x3b0a3b,_0x3241ec){return db[_0x4c61('0x12')][_0x4c61('0x13')]({'raw':_0x49a66f[_0x4c61('0x14')]?_0x49a66f[_0x4c61('0x14')][_0x4c61('0x15')]===undefined?!![]:![]:!![],'where':_0x49a66f[_0x4c61('0x14')]?_0x49a66f['options'][_0x4c61('0x16')]||null:null,'attributes':_0x49a66f['options']?_0x49a66f[_0x4c61('0x14')]['attributes']||null:null,'limit':_0x49a66f[_0x4c61('0x14')]?_0x49a66f[_0x4c61('0x14')]['limit']||null:null,'include':_0x49a66f[_0x4c61('0x14')]?_0x49a66f[_0x4c61('0x14')][_0x4c61('0x17')]?_[_0x4c61('0x18')](_0x49a66f['options'][_0x4c61('0x17')],function(_0x245fe1){return{'model':db[_0x245fe1[_0x4c61('0x19')]],'as':_0x245fe1['as'],'attributes':_0x245fe1[_0x4c61('0x1a')],'include':_0x245fe1['include']?_[_0x4c61('0x18')](_0x245fe1[_0x4c61('0x17')],function(_0x58c6bf){return{'model':db[_0x58c6bf[_0x4c61('0x19')]],'as':_0x58c6bf['as'],'attributes':_0x58c6bf['attributes'],'include':_0x58c6bf[_0x4c61('0x17')]?_['map'](_0x58c6bf[_0x4c61('0x17')],function(_0x2881df){return{'model':db[_0x2881df['model']],'as':_0x2881df['as'],'attributes':_0x2881df[_0x4c61('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4c61('0x1b')](function(_0x556341){logger[_0x4c61('0x1c')](_0x4c61('0x11'),_0x49a66f);logger[_0x4c61('0x1d')](_0x4c61('0x11'),_0x49a66f,JSON[_0x4c61('0xc')](_0x556341));_0x3b0a3b(_0x556341);})[_0x4c61('0x1e')](function(_0x257432){logger[_0x4c61('0xd')](_0x4c61('0x11'),_0x257432[_0x4c61('0xf')],_0x49a66f);_0x3241ec(_0x17cf13['error'](0x1f4,_0x257432[_0x4c61('0xf')]));});});};exports[_0x4c61('0x1f')]=function(_0x50d521){var _0x4641fd=this;return new Promise(function(_0x137b50,_0x1d378e){return db[_0x4c61('0x12')][_0x4c61('0x20')](_0x50d521[_0x4c61('0x21')],{'raw':_0x50d521[_0x4c61('0x14')]?_0x50d521[_0x4c61('0x14')][_0x4c61('0x15')]===undefined?!![]:![]:!![]})[_0x4c61('0x1b')](function(_0x4e40a6){logger[_0x4c61('0x1c')](_0x4c61('0x1f'),_0x50d521);logger[_0x4c61('0x1d')](_0x4c61('0x1f'),_0x50d521,JSON[_0x4c61('0xc')](_0x4e40a6));_0x137b50(_0x4e40a6);})[_0x4c61('0x1e')](function(_0x4a77c0){logger[_0x4c61('0xd')]('CreateVoiceCallReport',_0x4a77c0[_0x4c61('0xf')],_0x50d521);_0x1d378e(_0x4641fd['error'](0x1f4,_0x4a77c0[_0x4c61('0xf')]));});});};exports['UpdateVoiceCallReport']=function(_0x1b524b){var _0x3e17a9=this;return new Promise(function(_0x46285a,_0x20372c){return db['VoiceCallReport'][_0x4c61('0x22')](_0x1b524b[_0x4c61('0x21')],{'raw':_0x1b524b[_0x4c61('0x14')]?_0x1b524b[_0x4c61('0x14')][_0x4c61('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b524b[_0x4c61('0x14')]?_0x1b524b['options'][_0x4c61('0x16')]||null:null,'attributes':_0x1b524b[_0x4c61('0x14')]?_0x1b524b[_0x4c61('0x14')]['attributes']||null:null,'limit':_0x1b524b[_0x4c61('0x14')]?_0x1b524b[_0x4c61('0x14')]['limit']||null:null})['then'](function(_0x4bdbc1){logger[_0x4c61('0x1c')](_0x4c61('0x23'),_0x1b524b);logger[_0x4c61('0x1d')](_0x4c61('0x23'),_0x1b524b,JSON[_0x4c61('0xc')](_0x4bdbc1));_0x46285a(_0x4bdbc1);})[_0x4c61('0x1e')](function(_0x2f6ca7){logger[_0x4c61('0xd')](_0x4c61('0x23'),_0x2f6ca7[_0x4c61('0xf')],_0x1b524b);_0x20372c(_0x3e17a9[_0x4c61('0xd')](0x1f4,_0x2f6ca7[_0x4c61('0xf')]));});});}; \ No newline at end of file +var _0xb2fe=['info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','map','model','include','CreateVoiceCallReport','body','update','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VoiceCallReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message'];(function(_0x2cfb2b,_0x30c0f1){var _0x403a5c=function(_0x23f384){while(--_0x23f384){_0x2cfb2b['push'](_0x2cfb2b['shift']());}};_0x403a5c(++_0x30c0f1);}(_0xb2fe,0xfc));var _0xeb2f=function(_0x96f74c,_0xfc30a4){_0x96f74c=_0x96f74c-0x0;var _0x379222=_0xb2fe[_0x96f74c];return _0x379222;};'use strict';var _=require(_0xeb2f('0x0'));var util=require(_0xeb2f('0x1'));var moment=require(_0xeb2f('0x2'));var BPromise=require(_0xeb2f('0x3'));var rs=require(_0xeb2f('0x4'));var fs=require('fs');var Redis=require(_0xeb2f('0x5'));var db=require(_0xeb2f('0x6'))['db'];var utils=require(_0xeb2f('0x7'));var logger=require(_0xeb2f('0x8'))(_0xeb2f('0x9'));var config=require(_0xeb2f('0xa'));var jayson=require(_0xeb2f('0xb'));var client=jayson[_0xeb2f('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x567ce3,_0x5ecb9a,_0x368ae4){return new BPromise(function(_0x5a73e4,_0x11e61a){return client[_0xeb2f('0xd')](_0x567ce3,_0x368ae4)[_0xeb2f('0xe')](function(_0x4fde4e){logger['info'](_0xeb2f('0xf'),_0x5ecb9a,'request\x20sent');logger[_0xeb2f('0x10')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x5ecb9a,_0xeb2f('0x11'),JSON[_0xeb2f('0x12')](_0x4fde4e));if(_0x4fde4e['error']){if(_0x4fde4e[_0xeb2f('0x13')]['code']===0x1f4){logger[_0xeb2f('0x13')](_0xeb2f('0xf'),_0x5ecb9a,_0x4fde4e['error']['message']);return _0x11e61a(_0x4fde4e[_0xeb2f('0x13')][_0xeb2f('0x14')]);}logger[_0xeb2f('0x13')](_0xeb2f('0xf'),_0x5ecb9a,_0x4fde4e[_0xeb2f('0x13')]['message']);return _0x5a73e4(_0x4fde4e[_0xeb2f('0x13')][_0xeb2f('0x14')]);}else{logger[_0xeb2f('0x15')](_0xeb2f('0xf'),_0x5ecb9a,'request\x20sent');_0x5a73e4(_0x4fde4e[_0xeb2f('0x16')][_0xeb2f('0x14')]);}})[_0xeb2f('0x17')](function(_0x47a2cf){logger[_0xeb2f('0x13')](_0xeb2f('0xf'),_0x5ecb9a,_0x47a2cf);_0x11e61a(_0x47a2cf);});});}exports[_0xeb2f('0x18')]=function(_0x235bc8){var _0x12bd6e=this;return new Promise(function(_0x4e3708,_0x260b06){return db[_0xeb2f('0x19')][_0xeb2f('0x1a')]({'raw':_0x235bc8['options']?_0x235bc8[_0xeb2f('0x1b')][_0xeb2f('0x1c')]===undefined?!![]:![]:!![],'where':_0x235bc8[_0xeb2f('0x1b')]?_0x235bc8[_0xeb2f('0x1b')][_0xeb2f('0x1d')]||null:null,'attributes':_0x235bc8[_0xeb2f('0x1b')]?_0x235bc8[_0xeb2f('0x1b')][_0xeb2f('0x1e')]||null:null,'limit':_0x235bc8['options']?_0x235bc8[_0xeb2f('0x1b')][_0xeb2f('0x1f')]||null:null,'include':_0x235bc8[_0xeb2f('0x1b')]?_0x235bc8[_0xeb2f('0x1b')]['include']?_[_0xeb2f('0x20')](_0x235bc8['options']['include'],function(_0x551eea){return{'model':db[_0x551eea[_0xeb2f('0x21')]],'as':_0x551eea['as'],'attributes':_0x551eea[_0xeb2f('0x1e')],'include':_0x551eea[_0xeb2f('0x22')]?_[_0xeb2f('0x20')](_0x551eea[_0xeb2f('0x22')],function(_0x336452){return{'model':db[_0x336452[_0xeb2f('0x21')]],'as':_0x336452['as'],'attributes':_0x336452[_0xeb2f('0x1e')],'include':_0x336452[_0xeb2f('0x22')]?_['map'](_0x336452[_0xeb2f('0x22')],function(_0x457010){return{'model':db[_0x457010['model']],'as':_0x457010['as'],'attributes':_0x457010[_0xeb2f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xeb2f('0xe')](function(_0x2d344a){logger[_0xeb2f('0x15')](_0xeb2f('0x18'),_0x235bc8);logger[_0xeb2f('0x10')](_0xeb2f('0x18'),_0x235bc8,JSON[_0xeb2f('0x12')](_0x2d344a));_0x4e3708(_0x2d344a);})['catch'](function(_0x223fac){logger['error']('GetVoiceCallReport',_0x223fac[_0xeb2f('0x14')],_0x235bc8);_0x260b06(_0x12bd6e['error'](0x1f4,_0x223fac[_0xeb2f('0x14')]));});});};exports[_0xeb2f('0x23')]=function(_0x296fbd){var _0x35e722=this;return new Promise(function(_0x17e965,_0x574208){return db['VoiceCallReport']['create'](_0x296fbd[_0xeb2f('0x24')],{'raw':_0x296fbd['options']?_0x296fbd[_0xeb2f('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xeb2f('0xe')](function(_0x2d903f){logger[_0xeb2f('0x15')](_0xeb2f('0x23'),_0x296fbd);logger[_0xeb2f('0x10')]('CreateVoiceCallReport',_0x296fbd,JSON['stringify'](_0x2d903f));_0x17e965(_0x2d903f);})['catch'](function(_0x5be498){logger[_0xeb2f('0x13')](_0xeb2f('0x23'),_0x5be498[_0xeb2f('0x14')],_0x296fbd);_0x574208(_0x35e722[_0xeb2f('0x13')](0x1f4,_0x5be498['message']));});});};exports['UpdateVoiceCallReport']=function(_0x58d76d){var _0x2c347e=this;return new Promise(function(_0x4867da,_0x47cca6){return db[_0xeb2f('0x19')][_0xeb2f('0x25')](_0x58d76d[_0xeb2f('0x24')],{'raw':_0x58d76d[_0xeb2f('0x1b')]?_0x58d76d[_0xeb2f('0x1b')][_0xeb2f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58d76d[_0xeb2f('0x1b')]?_0x58d76d[_0xeb2f('0x1b')][_0xeb2f('0x1d')]||null:null,'attributes':_0x58d76d[_0xeb2f('0x1b')]?_0x58d76d[_0xeb2f('0x1b')][_0xeb2f('0x1e')]||null:null,'limit':_0x58d76d[_0xeb2f('0x1b')]?_0x58d76d[_0xeb2f('0x1b')][_0xeb2f('0x1f')]||null:null})[_0xeb2f('0xe')](function(_0x3703d1){logger[_0xeb2f('0x15')](_0xeb2f('0x26'),_0x58d76d);logger[_0xeb2f('0x10')]('UpdateVoiceCallReport',_0x58d76d,JSON[_0xeb2f('0x12')](_0x3703d1));_0x4867da(_0x3703d1);})[_0xeb2f('0x17')](function(_0x2a962c){logger[_0xeb2f('0x13')]('UpdateVoiceCallReport',_0x2a962c[_0xeb2f('0x14')],_0x58d76d);_0x47cca6(_0x2c347e[_0xeb2f('0x13')](0x1f4,_0x2a962c['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 9195687..56d3eb9 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 _0xa70d=['Router','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','create','put','destroy','exports','multer','util','path','express'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xa70d,0xec));var _0xda70=function(_0x3b65bd,_0x413692){_0x3b65bd=_0x3b65bd-0x0;var _0x8bf991=_0xa70d[_0x3b65bd];return _0x8bf991;};'use strict';var multer=require(_0xda70('0x0'));var util=require(_0xda70('0x1'));var path=require(_0xda70('0x2'));var timeout=require('connect-timeout');var express=require(_0xda70('0x3'));var router=express[_0xda70('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xda70('0x5'));var controller=require(_0xda70('0x6'));router[_0xda70('0x7')]('/',auth[_0xda70('0x8')](),controller[_0xda70('0x9')]);router[_0xda70('0x7')](_0xda70('0xa'),auth['isAuthenticated'](),controller[_0xda70('0xb')]);router['post']('/',auth[_0xda70('0x8')](),controller[_0xda70('0xc')]);router[_0xda70('0xd')](_0xda70('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xda70('0xa'),auth[_0xda70('0x8')](),controller[_0xda70('0xe')]);module[_0xda70('0xf')]=router; \ No newline at end of file +var _0x55f9=['put','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','show','post','create'];(function(_0x49a70a,_0x28a5ac){var _0x2f2328=function(_0x2e029b){while(--_0x2e029b){_0x49a70a['push'](_0x49a70a['shift']());}};_0x2f2328(++_0x28a5ac);}(_0x55f9,0x16b));var _0x955f=function(_0x130d92,_0x34283b){_0x130d92=_0x130d92-0x0;var _0x89bedd=_0x55f9[_0x130d92];return _0x89bedd;};'use strict';var multer=require(_0x955f('0x0'));var util=require(_0x955f('0x1'));var path=require(_0x955f('0x2'));var timeout=require(_0x955f('0x3'));var express=require(_0x955f('0x4'));var router=express[_0x955f('0x5')]();var fs_extra=require(_0x955f('0x6'));var auth=require(_0x955f('0x7'));var interaction=require(_0x955f('0x8'));var config=require(_0x955f('0x9'));var controller=require(_0x955f('0xa'));router[_0x955f('0xb')]('/',auth[_0x955f('0xc')](),controller[_0x955f('0xd')]);router[_0x955f('0xb')]('/:id',auth[_0x955f('0xc')](),controller[_0x955f('0xe')]);router[_0x955f('0xf')]('/',auth[_0x955f('0xc')](),controller[_0x955f('0x10')]);router[_0x955f('0x11')](_0x955f('0x12'),auth[_0x955f('0xc')](),controller['update']);router['delete'](_0x955f('0x12'),auth[_0x955f('0xc')](),controller['destroy']);module[_0x955f('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 329c7e7..feea4f5 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 _0xd066=['sequelize','exports','STRING','name','options','join','getDataValue','split','BOOLEAN'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xd066,0x1b0));var _0x6d06=function(_0x6d362,_0x1540dc){_0x6d362=_0x6d362-0x0;var _0x983188=_0xd066[_0x6d362];return _0x983188;};'use strict';var Sequelize=require(_0x6d06('0x0'));module[_0x6d06('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x6d06('0x2')],'unique':_0x6d06('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x6d06('0x2')],'set':function(_0x42fc28){this['setDataValue'](_0x6d06('0x4'),_0x42fc28?_0x42fc28[_0x6d06('0x5')](''):[]);},'get':function(){return this[_0x6d06('0x6')](_0x6d06('0x4'))?this[_0x6d06('0x6')](_0x6d06('0x4'))[_0x6d06('0x7')](''):[];}},'auth':{'type':Sequelize[_0x6d06('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x6d06('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x6d06('0x2')]},'description':{'type':Sequelize[_0x6d06('0x2')]}}; \ No newline at end of file +var _0x2479=['STRING','name','join','getDataValue','options','split','BOOLEAN','sequelize'];(function(_0x88d838,_0x1a28ee){var _0x19af60=function(_0x5d90bb){while(--_0x5d90bb){_0x88d838['push'](_0x88d838['shift']());}};_0x19af60(++_0x1a28ee);}(_0x2479,0x11f));var _0x9247=function(_0x5208a6,_0x23c62d){_0x5208a6=_0x5208a6-0x0;var _0x2f3be5=_0x2479[_0x5208a6];return _0x2f3be5;};'use strict';var Sequelize=require(_0x9247('0x0'));module['exports']={'name':{'type':Sequelize[_0x9247('0x1')]},'prefix':{'type':Sequelize[_0x9247('0x1')],'unique':_0x9247('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x9247('0x1')],'set':function(_0x436a9b){this['setDataValue']('options',_0x436a9b?_0x436a9b[_0x9247('0x3')](''):[]);},'get':function(){return this[_0x9247('0x4')](_0x9247('0x5'))?this[_0x9247('0x4')](_0x9247('0x5'))[_0x9247('0x6')](''):[];}},'auth':{'type':Sequelize[_0x9247('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x9247('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x9247('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 4f732f9..80699cd 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 _0x98b8=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','index','map','VoiceChanSpy','fieldName','key','keys','intersection','model','query','attributes','fields','length','nolimit','sort','filters','pick','filter','where','type','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3d5e4d,_0x420a6e){var _0x487b2e=function(_0x493269){while(--_0x493269){_0x3d5e4d['push'](_0x3d5e4d['shift']());}};_0x487b2e(++_0x420a6e);}(_0x98b8,0x93));var _0x898b=function(_0xb6d75b,_0x212433){_0xb6d75b=_0xb6d75b-0x0;var _0x24ed6f=_0x98b8[_0xb6d75b];return _0x24ed6f;};'use strict';var emlformat=require(_0x898b('0x0'));var rimraf=require(_0x898b('0x1'));var zipdir=require(_0x898b('0x2'));var jsonpatch=require(_0x898b('0x3'));var rp=require(_0x898b('0x4'));var moment=require(_0x898b('0x5'));var BPromise=require(_0x898b('0x6'));var Mustache=require(_0x898b('0x7'));var util=require(_0x898b('0x8'));var path=require(_0x898b('0x9'));var sox=require(_0x898b('0xa'));var csv=require(_0x898b('0xb'));var ejs=require(_0x898b('0xc'));var fs=require('fs');var fs_extra=require(_0x898b('0xd'));var _=require(_0x898b('0xe'));var squel=require('squel');var crypto=require(_0x898b('0xf'));var jsforce=require(_0x898b('0x10'));var deskjs=require(_0x898b('0x11'));var toCsv=require(_0x898b('0xb'));var querystring=require(_0x898b('0x12'));var Papa=require(_0x898b('0x13'));var Redis=require(_0x898b('0x14'));var authService=require(_0x898b('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x898b('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x898b('0x17'));var utils=require(_0x898b('0x18'));var config=require(_0x898b('0x19'));var licenseUtil=require(_0x898b('0x1a'));var db=require(_0x898b('0x1b'))['db'];function respondWithStatusCode(_0xdee6a3,_0x241756){_0x241756=_0x241756||0xcc;return function(_0x219de0){if(_0x219de0){return _0xdee6a3[_0x898b('0x1c')](_0x241756);}return _0xdee6a3[_0x898b('0x1d')](_0x241756)[_0x898b('0x1e')]();};}function respondWithResult(_0x1fb398,_0x51b5a0){_0x51b5a0=_0x51b5a0||0xc8;return function(_0x435cba){if(_0x435cba){return _0x1fb398[_0x898b('0x1d')](_0x51b5a0)[_0x898b('0x1f')](_0x435cba);}};}function respondWithFilteredResult(_0x4c50b0,_0x4baf7b){return function(_0x427cc4){if(_0x427cc4){var _0x239c41=typeof _0x4baf7b[_0x898b('0x20')]===_0x898b('0x21')&&typeof _0x4baf7b['limit']===_0x898b('0x21');var _0x4d95a1=_0x427cc4['count'];var _0x3ad191=_0x239c41?0x0:_0x4baf7b[_0x898b('0x20')];var _0x3f001a=_0x239c41?_0x427cc4['count']:_0x4baf7b[_0x898b('0x20')]+_0x4baf7b[_0x898b('0x22')];var _0x2db8cd;if(_0x3f001a>=_0x4d95a1){_0x3f001a=_0x4d95a1;_0x2db8cd=0xc8;}else{_0x2db8cd=0xce;}_0x4c50b0[_0x898b('0x1d')](_0x2db8cd);return _0x4c50b0[_0x898b('0x23')](_0x898b('0x24'),_0x3ad191+'-'+_0x3f001a+'/'+_0x4d95a1)[_0x898b('0x1f')](_0x427cc4);}return null;};}function patchUpdates(_0x1a976a){return function(_0x2eef40){try{jsonpatch[_0x898b('0x25')](_0x2eef40,_0x1a976a,!![]);}catch(_0x4d5d41){return BPromise['reject'](_0x4d5d41);}return _0x2eef40[_0x898b('0x26')]();};}function saveUpdates(_0x8def29,_0x503390){return function(_0x321ec9){if(_0x321ec9){return _0x321ec9[_0x898b('0x27')](_0x8def29)[_0x898b('0x28')](function(_0x5bcb95){return _0x5bcb95;});}return null;};}function removeEntity(_0x4fa723,_0x66101f){return function(_0x2bd250){if(_0x2bd250){return _0x2bd250[_0x898b('0x29')]()[_0x898b('0x28')](function(){var _0xb39f4c=_0x2bd250[_0x898b('0x2a')]({'plain':!![]});var _0x11c558=_0x898b('0x2b');return db[_0x898b('0x2c')][_0x898b('0x29')]({'where':{'type':_0x11c558,'resourceId':_0xb39f4c['id']}})[_0x898b('0x28')](function(){return _0x2bd250;});})[_0x898b('0x28')](function(){_0x4fa723[_0x898b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5177c9,_0x12c7e6){return function(_0xb5c11){if(!_0xb5c11){_0x5177c9[_0x898b('0x1c')](0x194);}return _0xb5c11;};}function handleError(_0x72c8d3,_0x3327c){_0x3327c=_0x3327c||0x1f4;return function(_0xad29){logger[_0x898b('0x2d')](_0xad29[_0x898b('0x2e')]);if(_0xad29[_0x898b('0x2f')]){delete _0xad29[_0x898b('0x2f')];}_0x72c8d3['status'](_0x3327c)['send'](_0xad29);};}exports[_0x898b('0x30')]=function(_0x282d78,_0x561125){var _0x63b5df={},_0x6f1887={},_0x3b2114={'count':0x0,'rows':[]};var _0x2ede2d=_[_0x898b('0x31')](db[_0x898b('0x32')]['rawAttributes'],function(_0x19dedc){return{'name':_0x19dedc[_0x898b('0x33')],'type':_0x19dedc['type'][_0x898b('0x34')]};});_0x6f1887['model']=_[_0x898b('0x31')](_0x2ede2d,_0x898b('0x2f'));_0x6f1887['query']=_[_0x898b('0x35')](_0x282d78['query']);_0x6f1887['filters']=_[_0x898b('0x36')](_0x6f1887[_0x898b('0x37')],_0x6f1887[_0x898b('0x38')]);_0x63b5df[_0x898b('0x39')]=_[_0x898b('0x36')](_0x6f1887[_0x898b('0x37')],qs[_0x898b('0x3a')](_0x282d78[_0x898b('0x38')][_0x898b('0x3a')]));_0x63b5df[_0x898b('0x39')]=_0x63b5df[_0x898b('0x39')][_0x898b('0x3b')]?_0x63b5df['attributes']:_0x6f1887['model'];if(!_0x282d78['query']['hasOwnProperty'](_0x898b('0x3c'))){_0x63b5df[_0x898b('0x22')]=qs[_0x898b('0x22')](_0x282d78['query'][_0x898b('0x22')]);_0x63b5df[_0x898b('0x20')]=qs[_0x898b('0x20')](_0x282d78[_0x898b('0x38')][_0x898b('0x20')]);}_0x63b5df['order']=qs[_0x898b('0x3d')](_0x282d78[_0x898b('0x38')][_0x898b('0x3d')]);_0x63b5df['where']=qs[_0x898b('0x3e')](_[_0x898b('0x3f')](_0x282d78['query'],_0x6f1887[_0x898b('0x3e')]),_0x2ede2d);if(_0x282d78[_0x898b('0x38')][_0x898b('0x40')]){_0x63b5df[_0x898b('0x41')]=_['merge'](_0x63b5df[_0x898b('0x41')],{'$or':_[_0x898b('0x31')](_0x2ede2d,function(_0x37e4){if(_0x37e4[_0x898b('0x42')]!==_0x898b('0x43')){var _0x2bddbe={};_0x2bddbe[_0x37e4[_0x898b('0x2f')]]={'$like':'%'+_0x282d78[_0x898b('0x38')][_0x898b('0x40')]+'%'};return _0x2bddbe;}})});}_0x63b5df=_[_0x898b('0x44')]({},_0x63b5df,_0x282d78['options']);var _0x5d86cb={'where':_0x63b5df[_0x898b('0x41')]};return db[_0x898b('0x32')][_0x898b('0x45')](_0x5d86cb)[_0x898b('0x28')](function(_0x5bc878){_0x3b2114[_0x898b('0x45')]=_0x5bc878;if(_0x282d78[_0x898b('0x38')][_0x898b('0x46')]){_0x63b5df[_0x898b('0x47')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x898b('0x48')](_0x63b5df);})[_0x898b('0x28')](function(_0x4e77be){_0x3b2114[_0x898b('0x49')]=_0x4e77be;return _0x3b2114;})[_0x898b('0x28')](respondWithFilteredResult(_0x561125,_0x63b5df))['catch'](handleError(_0x561125,null));};exports[_0x898b('0x4a')]=function(_0x5b1584,_0x37e3ae){var _0x4a8112={'raw':![],'where':{'id':_0x5b1584[_0x898b('0x4b')]['id']}},_0x144c99={};_0x144c99[_0x898b('0x37')]=_[_0x898b('0x35')](db[_0x898b('0x32')]['rawAttributes']);_0x144c99[_0x898b('0x38')]=_[_0x898b('0x35')](_0x5b1584[_0x898b('0x38')]);_0x144c99['filters']=_[_0x898b('0x36')](_0x144c99[_0x898b('0x37')],_0x144c99['query']);_0x4a8112[_0x898b('0x39')]=_[_0x898b('0x36')](_0x144c99[_0x898b('0x37')],qs[_0x898b('0x3a')](_0x5b1584[_0x898b('0x38')][_0x898b('0x3a')]));_0x4a8112['attributes']=_0x4a8112['attributes'][_0x898b('0x3b')]?_0x4a8112[_0x898b('0x39')]:_0x144c99['model'];if(_0x5b1584[_0x898b('0x38')][_0x898b('0x46')]){_0x4a8112[_0x898b('0x47')]=[{'all':!![]}];}_0x4a8112=_[_0x898b('0x44')]({},_0x4a8112,_0x5b1584[_0x898b('0x4c')]);return db[_0x898b('0x32')]['find'](_0x4a8112)['then'](handleEntityNotFound(_0x37e3ae,null))['then'](respondWithResult(_0x37e3ae,null))[_0x898b('0x4d')](handleError(_0x37e3ae,null));};exports[_0x898b('0x4e')]=function(_0x4d583f,_0x280a53){return db[_0x898b('0x32')][_0x898b('0x4e')](_0x4d583f[_0x898b('0x4f')],{})['then'](function(_0x1beb92){var _0x596eb4=_0x4d583f[_0x898b('0x50')]['get']({'plain':!![]});if(!_0x596eb4)throw new Error(_0x898b('0x51'));if(_0x596eb4[_0x898b('0x52')]===_0x898b('0x50')){var _0x5562ca=_0x1beb92[_0x898b('0x2a')]({'plain':!![]});var _0x7960a8=_0x898b('0x2b');return db[_0x898b('0x53')][_0x898b('0x54')]({'where':{'name':_0x7960a8,'userProfileId':_0x596eb4['userProfileId']},'raw':!![]})['then'](function(_0x18377f){if(_0x18377f&&_0x18377f[_0x898b('0x55')]===0x0){return db[_0x898b('0x2c')]['create']({'name':_0x5562ca[_0x898b('0x2f')],'resourceId':_0x5562ca['id'],'type':_0x18377f['name'],'sectionId':_0x18377f['id']},{})[_0x898b('0x28')](function(){return _0x1beb92;});}else{return _0x1beb92;}})[_0x898b('0x4d')](function(_0x59eeaf){logger['error'](_0x898b('0x56'),_0x59eeaf);throw _0x59eeaf;});}return _0x1beb92;})[_0x898b('0x28')](respondWithResult(_0x280a53,0xc9))[_0x898b('0x4d')](handleError(_0x280a53,null));};exports['update']=function(_0x4ab67b,_0x4ed728){if(_0x4ab67b[_0x898b('0x4f')]['id']){delete _0x4ab67b[_0x898b('0x4f')]['id'];}return db[_0x898b('0x32')][_0x898b('0x54')]({'where':{'id':_0x4ab67b[_0x898b('0x4b')]['id']}})[_0x898b('0x28')](handleEntityNotFound(_0x4ed728,null))['then'](saveUpdates(_0x4ab67b[_0x898b('0x4f')],null))[_0x898b('0x28')](respondWithResult(_0x4ed728,null))[_0x898b('0x4d')](handleError(_0x4ed728,null));};exports[_0x898b('0x29')]=function(_0x2865ac,_0xe5b812){return db['VoiceChanSpy']['find']({'where':{'id':_0x2865ac[_0x898b('0x4b')]['id']}})[_0x898b('0x28')](handleEntityNotFound(_0xe5b812,null))[_0x898b('0x28')](removeEntity(_0xe5b812,null))[_0x898b('0x4d')](handleError(_0xe5b812,null));}; \ No newline at end of file +var _0xb903=['Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','count','limit','set','json','apply','reject','save','then','destroy','get','ChanSpies','UserProfileResource','sendStatus','error','name','send','index','map','VoiceChanSpy','rawAttributes','type','key','model','query','filters','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','length','find','create','body','user'];(function(_0x737a1f,_0x235fef){var _0x16eba1=function(_0x292aa8){while(--_0x292aa8){_0x737a1f['push'](_0x737a1f['shift']());}};_0x16eba1(++_0x235fef);}(_0xb903,0x185));var _0x3b90=function(_0x4f77fb,_0xa2496e){_0x4f77fb=_0x4f77fb-0x0;var _0x52ec90=_0xb903[_0x4f77fb];return _0x52ec90;};'use strict';var emlformat=require(_0x3b90('0x0'));var rimraf=require(_0x3b90('0x1'));var zipdir=require(_0x3b90('0x2'));var jsonpatch=require(_0x3b90('0x3'));var rp=require('request-promise');var moment=require(_0x3b90('0x4'));var BPromise=require(_0x3b90('0x5'));var Mustache=require(_0x3b90('0x6'));var util=require(_0x3b90('0x7'));var path=require(_0x3b90('0x8'));var sox=require(_0x3b90('0x9'));var csv=require(_0x3b90('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3b90('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3b90('0xc'));var jsforce=require(_0x3b90('0xd'));var deskjs=require(_0x3b90('0xe'));var toCsv=require(_0x3b90('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b90('0xf'));var logger=require(_0x3b90('0x10'))('api');var utils=require(_0x3b90('0x11'));var config=require(_0x3b90('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b90('0x13'))['db'];function respondWithStatusCode(_0x174c0d,_0x43c08c){_0x43c08c=_0x43c08c||0xcc;return function(_0x4badcb){if(_0x4badcb){return _0x174c0d['sendStatus'](_0x43c08c);}return _0x174c0d[_0x3b90('0x14')](_0x43c08c)['end']();};}function respondWithResult(_0x492d39,_0x3a0a55){_0x3a0a55=_0x3a0a55||0xc8;return function(_0x2c72fb){if(_0x2c72fb){return _0x492d39['status'](_0x3a0a55)['json'](_0x2c72fb);}};}function respondWithFilteredResult(_0x3725b9,_0x1b6349){return function(_0x381a9e){if(_0x381a9e){var _0x1af265=typeof _0x1b6349[_0x3b90('0x15')]==='undefined'&&typeof _0x1b6349['limit']===_0x3b90('0x16');var _0x5420dc=_0x381a9e['count'];var _0x269488=_0x1af265?0x0:_0x1b6349[_0x3b90('0x15')];var _0x11ad7d=_0x1af265?_0x381a9e[_0x3b90('0x17')]:_0x1b6349['offset']+_0x1b6349[_0x3b90('0x18')];var _0x5d140f;if(_0x11ad7d>=_0x5420dc){_0x11ad7d=_0x5420dc;_0x5d140f=0xc8;}else{_0x5d140f=0xce;}_0x3725b9[_0x3b90('0x14')](_0x5d140f);return _0x3725b9[_0x3b90('0x19')]('Content-Range',_0x269488+'-'+_0x11ad7d+'/'+_0x5420dc)[_0x3b90('0x1a')](_0x381a9e);}return null;};}function patchUpdates(_0x12e1cf){return function(_0x3642c0){try{jsonpatch[_0x3b90('0x1b')](_0x3642c0,_0x12e1cf,!![]);}catch(_0xc74d57){return BPromise[_0x3b90('0x1c')](_0xc74d57);}return _0x3642c0[_0x3b90('0x1d')]();};}function saveUpdates(_0x2f4270,_0xa98414){return function(_0x3e5bb8){if(_0x3e5bb8){return _0x3e5bb8['update'](_0x2f4270)[_0x3b90('0x1e')](function(_0x36b93e){return _0x36b93e;});}return null;};}function removeEntity(_0x175b42,_0x7faee){return function(_0x1227ed){if(_0x1227ed){return _0x1227ed[_0x3b90('0x1f')]()['then'](function(){var _0x4b308c=_0x1227ed[_0x3b90('0x20')]({'plain':!![]});var _0x29d472=_0x3b90('0x21');return db[_0x3b90('0x22')]['destroy']({'where':{'type':_0x29d472,'resourceId':_0x4b308c['id']}})[_0x3b90('0x1e')](function(){return _0x1227ed;});})[_0x3b90('0x1e')](function(){_0x175b42[_0x3b90('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14752c,_0x138d79){return function(_0x17ec7f){if(!_0x17ec7f){_0x14752c[_0x3b90('0x23')](0x194);}return _0x17ec7f;};}function handleError(_0x153d7c,_0x7adf75){_0x7adf75=_0x7adf75||0x1f4;return function(_0x4b4d33){logger[_0x3b90('0x24')](_0x4b4d33['stack']);if(_0x4b4d33[_0x3b90('0x25')]){delete _0x4b4d33[_0x3b90('0x25')];}_0x153d7c[_0x3b90('0x14')](_0x7adf75)[_0x3b90('0x26')](_0x4b4d33);};}exports[_0x3b90('0x27')]=function(_0x6704f,_0x290283){var _0x2430ec={},_0x500ceb={},_0x4d1f31={'count':0x0,'rows':[]};var _0x43bd4f=_[_0x3b90('0x28')](db[_0x3b90('0x29')][_0x3b90('0x2a')],function(_0x522ede){return{'name':_0x522ede['fieldName'],'type':_0x522ede[_0x3b90('0x2b')][_0x3b90('0x2c')]};});_0x500ceb[_0x3b90('0x2d')]=_['map'](_0x43bd4f,_0x3b90('0x25'));_0x500ceb['query']=_['keys'](_0x6704f[_0x3b90('0x2e')]);_0x500ceb[_0x3b90('0x2f')]=_['intersection'](_0x500ceb[_0x3b90('0x2d')],_0x500ceb[_0x3b90('0x2e')]);_0x2430ec[_0x3b90('0x30')]=_['intersection'](_0x500ceb['model'],qs[_0x3b90('0x31')](_0x6704f[_0x3b90('0x2e')][_0x3b90('0x31')]));_0x2430ec[_0x3b90('0x30')]=_0x2430ec['attributes']['length']?_0x2430ec[_0x3b90('0x30')]:_0x500ceb[_0x3b90('0x2d')];if(!_0x6704f['query']['hasOwnProperty'](_0x3b90('0x32'))){_0x2430ec[_0x3b90('0x18')]=qs[_0x3b90('0x18')](_0x6704f[_0x3b90('0x2e')]['limit']);_0x2430ec[_0x3b90('0x15')]=qs['offset'](_0x6704f[_0x3b90('0x2e')][_0x3b90('0x15')]);}_0x2430ec[_0x3b90('0x33')]=qs[_0x3b90('0x34')](_0x6704f[_0x3b90('0x2e')][_0x3b90('0x34')]);_0x2430ec[_0x3b90('0x35')]=qs['filters'](_[_0x3b90('0x36')](_0x6704f[_0x3b90('0x2e')],_0x500ceb[_0x3b90('0x2f')]),_0x43bd4f);if(_0x6704f[_0x3b90('0x2e')][_0x3b90('0x37')]){_0x2430ec[_0x3b90('0x35')]=_[_0x3b90('0x38')](_0x2430ec[_0x3b90('0x35')],{'$or':_[_0x3b90('0x28')](_0x43bd4f,function(_0x5063b9){if(_0x5063b9[_0x3b90('0x2b')]!==_0x3b90('0x39')){var _0x40ce3a={};_0x40ce3a[_0x5063b9[_0x3b90('0x25')]]={'$like':'%'+_0x6704f[_0x3b90('0x2e')][_0x3b90('0x37')]+'%'};return _0x40ce3a;}})});}_0x2430ec=_[_0x3b90('0x38')]({},_0x2430ec,_0x6704f[_0x3b90('0x3a')]);var _0x30ff62={'where':_0x2430ec[_0x3b90('0x35')]};return db[_0x3b90('0x29')][_0x3b90('0x17')](_0x30ff62)[_0x3b90('0x1e')](function(_0x11285e){_0x4d1f31[_0x3b90('0x17')]=_0x11285e;if(_0x6704f[_0x3b90('0x2e')][_0x3b90('0x3b')]){_0x2430ec[_0x3b90('0x3c')]=[{'all':!![]}];}return db[_0x3b90('0x29')][_0x3b90('0x3d')](_0x2430ec);})[_0x3b90('0x1e')](function(_0x4d1157){_0x4d1f31[_0x3b90('0x3e')]=_0x4d1157;return _0x4d1f31;})[_0x3b90('0x1e')](respondWithFilteredResult(_0x290283,_0x2430ec))[_0x3b90('0x3f')](handleError(_0x290283,null));};exports[_0x3b90('0x40')]=function(_0x5a48a9,_0x36bc29){var _0x47e450={'raw':![],'where':{'id':_0x5a48a9[_0x3b90('0x41')]['id']}},_0x564907={};_0x564907[_0x3b90('0x2d')]=_['keys'](db[_0x3b90('0x29')][_0x3b90('0x2a')]);_0x564907[_0x3b90('0x2e')]=_[_0x3b90('0x42')](_0x5a48a9[_0x3b90('0x2e')]);_0x564907[_0x3b90('0x2f')]=_[_0x3b90('0x43')](_0x564907[_0x3b90('0x2d')],_0x564907[_0x3b90('0x2e')]);_0x47e450['attributes']=_[_0x3b90('0x43')](_0x564907[_0x3b90('0x2d')],qs['fields'](_0x5a48a9[_0x3b90('0x2e')][_0x3b90('0x31')]));_0x47e450[_0x3b90('0x30')]=_0x47e450[_0x3b90('0x30')][_0x3b90('0x44')]?_0x47e450['attributes']:_0x564907['model'];if(_0x5a48a9[_0x3b90('0x2e')]['includeAll']){_0x47e450[_0x3b90('0x3c')]=[{'all':!![]}];}_0x47e450=_[_0x3b90('0x38')]({},_0x47e450,_0x5a48a9[_0x3b90('0x3a')]);return db[_0x3b90('0x29')][_0x3b90('0x45')](_0x47e450)['then'](handleEntityNotFound(_0x36bc29,null))['then'](respondWithResult(_0x36bc29,null))[_0x3b90('0x3f')](handleError(_0x36bc29,null));};exports[_0x3b90('0x46')]=function(_0x9e2ee5,_0x5d7333){return db[_0x3b90('0x29')][_0x3b90('0x46')](_0x9e2ee5[_0x3b90('0x47')],{})[_0x3b90('0x1e')](function(_0x41e951){var _0x226354=_0x9e2ee5[_0x3b90('0x48')][_0x3b90('0x20')]({'plain':!![]});if(!_0x226354)throw new Error(_0x3b90('0x49'));if(_0x226354['role']===_0x3b90('0x48')){var _0x407784=_0x41e951[_0x3b90('0x20')]({'plain':!![]});var _0x4b90ab=_0x3b90('0x21');return db['UserProfileSection'][_0x3b90('0x45')]({'where':{'name':_0x4b90ab,'userProfileId':_0x226354[_0x3b90('0x4a')]},'raw':!![]})[_0x3b90('0x1e')](function(_0x56f95d){if(_0x56f95d&&_0x56f95d[_0x3b90('0x4b')]===0x0){return db[_0x3b90('0x22')]['create']({'name':_0x407784['name'],'resourceId':_0x407784['id'],'type':_0x56f95d[_0x3b90('0x25')],'sectionId':_0x56f95d['id']},{})[_0x3b90('0x1e')](function(){return _0x41e951;});}else{return _0x41e951;}})[_0x3b90('0x3f')](function(_0x3f46cf){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f46cf);throw _0x3f46cf;});}return _0x41e951;})[_0x3b90('0x1e')](respondWithResult(_0x5d7333,0xc9))[_0x3b90('0x3f')](handleError(_0x5d7333,null));};exports[_0x3b90('0x4c')]=function(_0x92f420,_0x15fe10){if(_0x92f420[_0x3b90('0x47')]['id']){delete _0x92f420[_0x3b90('0x47')]['id'];}return db[_0x3b90('0x29')][_0x3b90('0x45')]({'where':{'id':_0x92f420['params']['id']}})[_0x3b90('0x1e')](handleEntityNotFound(_0x15fe10,null))[_0x3b90('0x1e')](saveUpdates(_0x92f420['body'],null))[_0x3b90('0x1e')](respondWithResult(_0x15fe10,null))[_0x3b90('0x3f')](handleError(_0x15fe10,null));};exports['destroy']=function(_0x3677d1,_0x16c30f){return db[_0x3b90('0x29')][_0x3b90('0x45')]({'where':{'id':_0x3677d1[_0x3b90('0x41')]['id']}})[_0x3b90('0x1e')](handleEntityNotFound(_0x16c30f,null))[_0x3b90('0x1e')](removeEntity(_0x16c30f,null))['catch'](handleError(_0x16c30f,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index e6fb291..131d489 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 _0x1b60=['password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','catch','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','prefix','system','push','merge','Set','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x1b60,0x126));var _0x01b6=function(_0x39275f,_0x2490ac){_0x39275f=_0x39275f-0x0;var _0x53e917=_0x1b60[_0x39275f];return _0x53e917;};'use strict';var _=require(_0x01b6('0x0'));var util=require(_0x01b6('0x1'));var BPromise=require(_0x01b6('0x2'));var attributes=require(_0x01b6('0x3'));var getUserApplications=function(_0x1954ab,_0x321f75,_0x3366db){var _0x305371=0x1;var _0x432703=[];var _0x27092c={'context':_0x321f75['context']||_0x01b6('0x4'),'exten':util['format']('%s%s',_0x1954ab[_0x01b6('0x5')],_0x3366db),'type':_0x01b6('0x6'),'isApp':![],'ChanSpyId':_0x1954ab['id'],'UserId':_0x321f75['id']};_0x432703[_0x01b6('0x7')](_[_0x01b6('0x8')]({'app':_0x01b6('0x9'),'appdata':util[_0x01b6('0xa')](_0x01b6('0xb'),_0x01b6('0xc')),'priority':_0x305371++},_0x27092c));if(_0x1954ab[_0x01b6('0xd')]){_0x432703[_0x01b6('0x7')](_[_0x01b6('0x8')]({'app':_0x01b6('0xe'),'appdata':util[_0x01b6('0xa')](_0x01b6('0xf'),_0x1954ab[_0x01b6('0x10')]),'priority':_0x305371++},_0x27092c));}if(_0x1954ab['auth']){_0x432703['push'](_['merge']({'app':_0x01b6('0x11'),'appdata':_0x1954ab[_0x01b6('0x12')],'priority':_0x305371++},_0x27092c));}_0x432703[_0x01b6('0x7')](_['merge']({'app':_0x01b6('0x13'),'appdata':util[_0x01b6('0xa')](_0x01b6('0x14'),_0x321f75[_0x01b6('0x15')],_0x1954ab[_0x01b6('0x16')]?_0x1954ab[_0x01b6('0x16')][_0x01b6('0x17')](''):''),'priority':_0x305371++},_0x27092c));if(_0x1954ab[_0x01b6('0xd')]){_0x432703[_0x01b6('0x7')](_[_0x01b6('0x8')]({'app':_0x01b6('0x18'),'priority':_0x305371++},_0x27092c));}return _0x432703;};var getChanSpyApplications=function(_0x34ca67,_0x2124ab){var _0x2f4d89=[];for(var _0x2b0983=0x0,_0x3b0d46=0x1;_0x2b0983<_0x2124ab[_0x01b6('0x19')];_0x2b0983++,_0x3b0d46=0x1){_0x2f4d89=_0x2f4d89[_0x01b6('0x1a')](getUserApplications(_0x34ca67,_0x2124ab[_0x2b0983],_0x2124ab[_0x2b0983][_0x01b6('0x1b')]));if(_0x2124ab[_0x2b0983]['internal']!=_0x2124ab[_0x2b0983][_0x01b6('0x15')]){_0x2f4d89=_0x2f4d89[_0x01b6('0x1a')](getUserApplications(_0x34ca67,_0x2124ab[_0x2b0983],_0x2124ab[_0x2b0983]['name']));}}return _0x2f4d89;};var getChanSpyPromise=function(_0x5b027d,_0x5c4955){return new BPromise(function(_0x438d7b,_0x15a7ba){return _0x5b027d[_0x01b6('0x1c')][_0x01b6('0x1d')]({'attributes':['id',_0x01b6('0x15'),_0x01b6('0x1b')],'where':{'role':_0x01b6('0x1e'),'chanspy':!![]},'raw':!![]})['then'](function(_0x31de82){if(_0x31de82){return _0x438d7b(getChanSpyApplications(_0x5c4955,_0x31de82));}return _0x438d7b([]);})[_0x01b6('0x1f')](function(_0xf2ff13){_0x15a7ba(_0xf2ff13);});});};module['exports']=function(_0x3d7f85,_0x57486f){var _0x53c761=_0x3d7f85['models'];return _0x3d7f85[_0x01b6('0x20')](_0x01b6('0x21'),attributes,{'tableName':_0x01b6('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x16d25a,_0xad8fb8,_0xb321d9){return getChanSpyPromise(_0x53c761,_0x16d25a)[_0x01b6('0x23')](function(_0x26694a){if(_0x26694a&&_0x26694a[_0x01b6('0x19')]){return _0x53c761['VoiceExtension']['bulkCreate'](_0x26694a);}})['then'](function(){_0xb321d9();})['catch'](function(_0x54dce9){_0xb321d9(_0x54dce9);});},'afterUpdate':function(_0xe2b3d2,_0x597b81,_0x5c5a32){return _0x53c761['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0xe2b3d2['id']}})['then'](function(){return getChanSpyPromise(_0x53c761,_0xe2b3d2);})[_0x01b6('0x23')](function(_0x194f73){if(_0x194f73&&_0x194f73[_0x01b6('0x19')]){return _0x53c761[_0x01b6('0x24')][_0x01b6('0x25')](_0x194f73);}})[_0x01b6('0x23')](function(){_0x5c5a32();})[_0x01b6('0x1f')](function(_0x5dfa88){_0x5c5a32(_0x5dfa88);});},'afterDestroy':function(_0x2c239b,_0x5c9865,_0x2f9f22){return _0x53c761[_0x01b6('0x24')][_0x01b6('0x26')]({'where':{'ChanSpyId':_0x2c239b['id']}})[_0x01b6('0x23')](function(){_0x2f9f22();})['catch'](function(_0x273b84){_0x2f9f22(_0x273b84);});}}});}; \ No newline at end of file +var _0x6165=['ChanSpy','SIP/%s,%s','name','options','join','concat','internal','User','findAll','catch','models','define','VoiceChanSpy','voice_chanspy','then','length','VoiceExtension','bulkCreate','destroy','lodash','util','./voiceChanSpy.attributes','context','format','%s%s','prefix','system','push','Set','CDR(type)=%s','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password'];(function(_0x2f50b6,_0xd09fe3){var _0x54b027=function(_0x680941){while(--_0x680941){_0x2f50b6['push'](_0x2f50b6['shift']());}};_0x54b027(++_0xd09fe3);}(_0x6165,0x1db));var _0x5616=function(_0x531624,_0x3060d0){_0x531624=_0x531624-0x0;var _0x14c202=_0x6165[_0x531624];return _0x14c202;};'use strict';var _=require(_0x5616('0x0'));var util=require(_0x5616('0x1'));var BPromise=require('bluebird');var attributes=require(_0x5616('0x2'));var getUserApplications=function(_0x1be68c,_0x4e9e7b,_0x29d3a4){var _0x3c2fd1=0x1;var _0x12e1d1=[];var _0x300c1f={'context':_0x4e9e7b[_0x5616('0x3')]||'from-sip','exten':util[_0x5616('0x4')](_0x5616('0x5'),_0x1be68c[_0x5616('0x6')],_0x29d3a4),'type':_0x5616('0x7'),'isApp':![],'ChanSpyId':_0x1be68c['id'],'UserId':_0x4e9e7b['id']};_0x12e1d1[_0x5616('0x8')](_['merge']({'app':_0x5616('0x9'),'appdata':util[_0x5616('0x4')](_0x5616('0xa'),'chanspy'),'priority':_0x3c2fd1++},_0x300c1f));if(_0x1be68c[_0x5616('0xb')]){_0x12e1d1[_0x5616('0x8')](_[_0x5616('0xc')]({'app':_0x5616('0xd'),'appdata':util[_0x5616('0x4')](_0x5616('0xe'),_0x1be68c[_0x5616('0xf')]),'priority':_0x3c2fd1++},_0x300c1f));}if(_0x1be68c[_0x5616('0x10')]){_0x12e1d1[_0x5616('0x8')](_['merge']({'app':_0x5616('0x11'),'appdata':_0x1be68c[_0x5616('0x12')],'priority':_0x3c2fd1++},_0x300c1f));}_0x12e1d1[_0x5616('0x8')](_['merge']({'app':_0x5616('0x13'),'appdata':util['format'](_0x5616('0x14'),_0x4e9e7b[_0x5616('0x15')],_0x1be68c[_0x5616('0x16')]?_0x1be68c[_0x5616('0x16')][_0x5616('0x17')](''):''),'priority':_0x3c2fd1++},_0x300c1f));if(_0x1be68c['record']){_0x12e1d1[_0x5616('0x8')](_['merge']({'app':'StopMixMonitor','priority':_0x3c2fd1++},_0x300c1f));}return _0x12e1d1;};var getChanSpyApplications=function(_0x4f9c44,_0x5d3f04){var _0x332cd1=[];for(var _0x35b57c=0x0,_0x41602e=0x1;_0x35b57c<_0x5d3f04['length'];_0x35b57c++,_0x41602e=0x1){_0x332cd1=_0x332cd1[_0x5616('0x18')](getUserApplications(_0x4f9c44,_0x5d3f04[_0x35b57c],_0x5d3f04[_0x35b57c][_0x5616('0x19')]));if(_0x5d3f04[_0x35b57c][_0x5616('0x19')]!=_0x5d3f04[_0x35b57c][_0x5616('0x15')]){_0x332cd1=_0x332cd1['concat'](getUserApplications(_0x4f9c44,_0x5d3f04[_0x35b57c],_0x5d3f04[_0x35b57c][_0x5616('0x15')]));}}return _0x332cd1;};var getChanSpyPromise=function(_0x99f3ed,_0x9609cb){return new BPromise(function(_0x346160,_0x585d3f){return _0x99f3ed[_0x5616('0x1a')][_0x5616('0x1b')]({'attributes':['id','name','internal'],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0xa49ac3){if(_0xa49ac3){return _0x346160(getChanSpyApplications(_0x9609cb,_0xa49ac3));}return _0x346160([]);})[_0x5616('0x1c')](function(_0x225f08){_0x585d3f(_0x225f08);});});};module['exports']=function(_0x1bb4b0,_0x3cff0c){var _0xb45208=_0x1bb4b0[_0x5616('0x1d')];return _0x1bb4b0[_0x5616('0x1e')](_0x5616('0x1f'),attributes,{'tableName':_0x5616('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x30d7e9,_0x205e97,_0x2e544a){return getChanSpyPromise(_0xb45208,_0x30d7e9)[_0x5616('0x21')](function(_0x5e374d){if(_0x5e374d&&_0x5e374d[_0x5616('0x22')]){return _0xb45208[_0x5616('0x23')][_0x5616('0x24')](_0x5e374d);}})['then'](function(){_0x2e544a();})[_0x5616('0x1c')](function(_0x595d53){_0x2e544a(_0x595d53);});},'afterUpdate':function(_0x167b25,_0x3a3c53,_0x411e54){return _0xb45208[_0x5616('0x23')][_0x5616('0x25')]({'where':{'ChanSpyId':_0x167b25['id']}})['then'](function(){return getChanSpyPromise(_0xb45208,_0x167b25);})[_0x5616('0x21')](function(_0x334720){if(_0x334720&&_0x334720['length']){return _0xb45208['VoiceExtension'][_0x5616('0x24')](_0x334720);}})[_0x5616('0x21')](function(){_0x411e54();})[_0x5616('0x1c')](function(_0xc8f154){_0x411e54(_0xc8f154);});},'afterDestroy':function(_0xce05fd,_0x96f22f,_0xee32ae){return _0xb45208[_0x5616('0x23')]['destroy']({'where':{'ChanSpyId':_0xce05fd['id']}})[_0x5616('0x21')](function(){_0xee32ae();})[_0x5616('0x1c')](function(_0x414ef5){_0xee32ae(_0x414ef5);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 9e270d6..952826b 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 _0x9348=['error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2c8802,_0x4ad8e4){var _0x29fefc=function(_0x92772b){while(--_0x92772b){_0x2c8802['push'](_0x2c8802['shift']());}};_0x29fefc(++_0x4ad8e4);}(_0x9348,0x10d));var _0x8934=function(_0x4609a5,_0x4930b7){_0x4609a5=_0x4609a5-0x0;var _0x3eb74f=_0x9348[_0x4609a5];return _0x3eb74f;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var moment=require(_0x8934('0x2'));var BPromise=require(_0x8934('0x3'));var rs=require(_0x8934('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8934('0x5'))['db'];var utils=require(_0x8934('0x6'));var logger=require('../../config/logger')(_0x8934('0x7'));var config=require(_0x8934('0x8'));var jayson=require(_0x8934('0x9'));var client=jayson[_0x8934('0xa')][_0x8934('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ee9b9,_0x512f30,_0x284a62){return new BPromise(function(_0x3734c5,_0x1c7f03){return client['request'](_0x3ee9b9,_0x284a62)['then'](function(_0x5ec16d){logger['info'](_0x8934('0xc'),_0x512f30,'request\x20sent');logger[_0x8934('0xd')](_0x8934('0xe'),_0x512f30,_0x8934('0xf'),JSON[_0x8934('0x10')](_0x5ec16d));if(_0x5ec16d[_0x8934('0x11')]){if(_0x5ec16d[_0x8934('0x11')][_0x8934('0x12')]===0x1f4){logger[_0x8934('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x512f30,_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);return _0x1c7f03(_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);}logger[_0x8934('0x11')](_0x8934('0xc'),_0x512f30,_0x5ec16d['error'][_0x8934('0x13')]);return _0x3734c5(_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);}else{logger[_0x8934('0x14')](_0x8934('0xc'),_0x512f30,_0x8934('0xf'));_0x3734c5(_0x5ec16d[_0x8934('0x15')][_0x8934('0x13')]);}})['catch'](function(_0xb86bc9){logger[_0x8934('0x11')](_0x8934('0xc'),_0x512f30,_0xb86bc9);_0x1c7f03(_0xb86bc9);});});} \ No newline at end of file +var _0xda55=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x2b1f79,_0x8cfab1){var _0x40079e=function(_0x94ddef){while(--_0x94ddef){_0x2b1f79['push'](_0x2b1f79['shift']());}};_0x40079e(++_0x8cfab1);}(_0xda55,0x6d));var _0x5da5=function(_0x49e0a4,_0x1a55e4){_0x49e0a4=_0x49e0a4-0x0;var _0x41ef3d=_0xda55[_0x49e0a4];return _0x41ef3d;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5da5('0x2'));var fs=require('fs');var Redis=require(_0x5da5('0x3'));var db=require(_0x5da5('0x4'))['db'];var utils=require(_0x5da5('0x5'));var logger=require(_0x5da5('0x6'))('rpc');var config=require(_0x5da5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5da5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fd877,_0x267469,_0x71b187){return new BPromise(function(_0x46290d,_0x3debdf){return client[_0x5da5('0x9')](_0x2fd877,_0x71b187)[_0x5da5('0xa')](function(_0x302795){logger['info'](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));logger[_0x5da5('0xd')](_0x5da5('0xe'),_0x267469,_0x5da5('0xc'),JSON[_0x5da5('0xf')](_0x302795));if(_0x302795[_0x5da5('0x10')]){if(_0x302795['error'][_0x5da5('0x11')]===0x1f4){logger[_0x5da5('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x267469,_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);return _0x3debdf(_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);}logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x302795['error']['message']);return _0x46290d(_0x302795['error'][_0x5da5('0x12')]);}else{logger[_0x5da5('0x13')](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));_0x46290d(_0x302795[_0x5da5('0x14')][_0x5da5('0x12')]);}})[_0x5da5('0x15')](function(_0x4a952a){logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x4a952a);_0x3debdf(_0x4a952a);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index c11c5e8..03feb14 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 _0x1092=['connect-timeout','Router','./voiceContext.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x1ff575,_0xdba21f){var _0x48fc9e=function(_0x51cf97){while(--_0x51cf97){_0x1ff575['push'](_0x1ff575['shift']());}};_0x48fc9e(++_0xdba21f);}(_0x1092,0x11e));var _0x2109=function(_0x2a7701,_0x11daa6){_0x2a7701=_0x2a7701-0x0;var _0x8d9d99=_0x1092[_0x2a7701];return _0x8d9d99;};'use strict';var multer=require(_0x2109('0x0'));var util=require('util');var path=require(_0x2109('0x1'));var timeout=require(_0x2109('0x2'));var express=require('express');var router=express[_0x2109('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(_0x2109('0x4'));router[_0x2109('0x5')]('/',auth[_0x2109('0x6')](),controller['index']);router['get'](_0x2109('0x7'),auth['isAuthenticated'](),controller[_0x2109('0x8')]);router[_0x2109('0x9')]('/',auth[_0x2109('0x6')](),controller[_0x2109('0xa')]);router[_0x2109('0xb')]('/:id',auth[_0x2109('0x6')](),controller[_0x2109('0xc')]);router[_0x2109('0xd')](_0x2109('0x7'),auth[_0x2109('0x6')](),controller[_0x2109('0xe')]);module[_0x2109('0xf')]=router; \ No newline at end of file +var _0x253c=['../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','show','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x278874,_0x3d99e6){var _0x293a93=function(_0x1ab2dd){while(--_0x1ab2dd){_0x278874['push'](_0x278874['shift']());}};_0x293a93(++_0x3d99e6);}(_0x253c,0x10a));var _0xc253=function(_0x4b0008,_0x41218b){_0x4b0008=_0x4b0008-0x0;var _0x401c96=_0x253c[_0x4b0008];return _0x401c96;};'use strict';var multer=require(_0xc253('0x0'));var util=require('util');var path=require(_0xc253('0x1'));var timeout=require(_0xc253('0x2'));var express=require(_0xc253('0x3'));var router=express[_0xc253('0x4')]();var fs_extra=require(_0xc253('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc253('0x6'));var controller=require(_0xc253('0x7'));router[_0xc253('0x8')]('/',auth[_0xc253('0x9')](),controller['index']);router[_0xc253('0x8')](_0xc253('0xa'),auth[_0xc253('0x9')](),controller[_0xc253('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xc253('0xc')]('/:id',auth[_0xc253('0x9')](),controller[_0xc253('0xd')]);router['delete'](_0xc253('0xa'),auth['isAuthenticated'](),controller[_0xc253('0xe')]);module[_0xc253('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 4404e5c..bbcfebc 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 _0x9737=['name','STRING','BOOLEAN','sequelize','exports'];(function(_0x3dd430,_0x49c2fd){var _0x3dea3e=function(_0x20084d){while(--_0x20084d){_0x3dd430['push'](_0x3dd430['shift']());}};_0x3dea3e(++_0x49c2fd);}(_0x9737,0x67));var _0x7973=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9737[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7973('0x0'));module[_0x7973('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7973('0x2')},'description':{'type':Sequelize[_0x7973('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7973('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7122=['name','BOOLEAN','exports','STRING'];(function(_0x253d93,_0x180c4d){var _0x35be3b=function(_0x4cf912){while(--_0x4cf912){_0x253d93['push'](_0x253d93['shift']());}};_0x35be3b(++_0x180c4d);}(_0x7122,0x13e));var _0x2712=function(_0x320de2,_0x4d4a43){_0x320de2=_0x320de2-0x0;var _0x36dfe7=_0x7122[_0x320de2];return _0x36dfe7;};'use strict';var Sequelize=require('sequelize');module[_0x2712('0x0')]={'name':{'type':Sequelize[_0x2712('0x1')],'unique':_0x2712('0x2')},'description':{'type':Sequelize[_0x2712('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x2712('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index b6b5796..844baf3 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 _0x403a=['error','code','message','info','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','get','destroy','name','map','VoiceContext','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','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','UserProfileSection','find','Contexts','userProfileId','autoAssociation','UserProfileResource','body','rimraf','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x403a,0xa1));var _0xa403=function(_0x25efdf,_0x521462){_0x25efdf=_0x25efdf-0x0;var _0x22c495=_0x403a[_0x25efdf];return _0x22c495;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa403('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(_0xa403('0x1'));var util=require(_0xa403('0x2'));var path=require(_0xa403('0x3'));var sox=require(_0xa403('0x4'));var csv=require(_0xa403('0x5'));var ejs=require(_0xa403('0x6'));var fs=require('fs');var fs_extra=require(_0xa403('0x7'));var _=require(_0xa403('0x8'));var squel=require(_0xa403('0x9'));var crypto=require(_0xa403('0xa'));var jsforce=require(_0xa403('0xb'));var deskjs=require(_0xa403('0xc'));var toCsv=require(_0xa403('0x5'));var querystring=require(_0xa403('0xd'));var Papa=require(_0xa403('0xe'));var Redis=require('ioredis');var authService=require(_0xa403('0xf'));var qs=require(_0xa403('0x10'));var as=require(_0xa403('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa403('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa403('0x13'));var db=require(_0xa403('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xa403('0x15')][_0xa403('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x42ea65,_0x2af5e9,_0x4f5b77,_0xb61e63){return new BPromise(function(_0x5cc6c8,_0x3790b4){var _0x2d6470=_0xb61e63||client;return _0x2d6470[_0xa403('0x17')](_0x42ea65,_0x4f5b77)[_0xa403('0x18')](function(_0x1475a6){logger['info'](_0xa403('0x19'),_0x2af5e9,_0xa403('0x1a'));logger['debug'](_0xa403('0x1b'),_0x2af5e9,'request\x20sent',JSON[_0xa403('0x1c')](_0x1475a6));if(_0x1475a6[_0xa403('0x1d')]){if(_0x1475a6[_0xa403('0x1d')][_0xa403('0x1e')]===0x1f4){logger['error'](_0xa403('0x19'),_0x2af5e9,_0x1475a6[_0xa403('0x1d')][_0xa403('0x1f')]);return _0x3790b4(_0x1475a6[_0xa403('0x1d')][_0xa403('0x1f')]);}logger[_0xa403('0x1d')](_0xa403('0x19'),_0x2af5e9,_0x1475a6[_0xa403('0x1d')]['message']);return _0x5cc6c8(_0x1475a6[_0xa403('0x1d')][_0xa403('0x1f')]);}else{logger[_0xa403('0x20')](_0xa403('0x19'),_0x2af5e9,'request\x20sent');_0x5cc6c8(_0x1475a6['result'][_0xa403('0x1f')]);}})['catch'](function(_0x4ceacc){logger[_0xa403('0x1d')](_0xa403('0x19'),_0x2af5e9,_0x4ceacc);_0x3790b4(_0x4ceacc);});});}function respondWithStatusCode(_0x38ecb1,_0xf8ad41){_0xf8ad41=_0xf8ad41||0xcc;return function(_0x296831){if(_0x296831){return _0x38ecb1[_0xa403('0x21')](_0xf8ad41);}return _0x38ecb1['status'](_0xf8ad41)[_0xa403('0x22')]();};}function respondWithResult(_0x4c4828,_0x1a438b){_0x1a438b=_0x1a438b||0xc8;return function(_0x21c5ca){if(_0x21c5ca){return _0x4c4828['status'](_0x1a438b)[_0xa403('0x23')](_0x21c5ca);}};}function respondWithFilteredResult(_0x403b28,_0x42fe3d){return function(_0x57bf86){if(_0x57bf86){var _0x12b3d1=typeof _0x42fe3d[_0xa403('0x24')]===_0xa403('0x25')&&typeof _0x42fe3d[_0xa403('0x26')]===_0xa403('0x25');var _0xb837b0=_0x57bf86[_0xa403('0x27')];var _0x282aed=_0x12b3d1?0x0:_0x42fe3d[_0xa403('0x24')];var _0x132e11=_0x12b3d1?_0x57bf86['count']:_0x42fe3d['offset']+_0x42fe3d[_0xa403('0x26')];var _0x1ddf55;if(_0x132e11>=_0xb837b0){_0x132e11=_0xb837b0;_0x1ddf55=0xc8;}else{_0x1ddf55=0xce;}_0x403b28[_0xa403('0x28')](_0x1ddf55);return _0x403b28[_0xa403('0x29')](_0xa403('0x2a'),_0x282aed+'-'+_0x132e11+'/'+_0xb837b0)[_0xa403('0x23')](_0x57bf86);}return null;};}function patchUpdates(_0x235a92){return function(_0xaa2b39){try{jsonpatch[_0xa403('0x2b')](_0xaa2b39,_0x235a92,!![]);}catch(_0x4dbf5b){return BPromise['reject'](_0x4dbf5b);}return _0xaa2b39[_0xa403('0x2c')]();};}function saveUpdates(_0x2304e4,_0x5dad7e){return function(_0x1dcbfe){if(_0x1dcbfe){return _0x1dcbfe[_0xa403('0x2d')](_0x2304e4)[_0xa403('0x18')](function(_0x420ab7){return _0x420ab7;});}return null;};}function removeEntity(_0x20de4c,_0x2e52d1){return function(_0x4c121b){if(_0x4c121b){return _0x4c121b['destroy']()[_0xa403('0x18')](function(){var _0x35563a=_0x4c121b[_0xa403('0x2e')]({'plain':!![]});var _0x3bc51c='Contexts';return db['UserProfileResource'][_0xa403('0x2f')]({'where':{'type':_0x3bc51c,'resourceId':_0x35563a['id']}})[_0xa403('0x18')](function(){return _0x4c121b;});})[_0xa403('0x18')](function(){_0x20de4c['status'](0xcc)[_0xa403('0x22')]();});}};}function handleEntityNotFound(_0x31ff97,_0x274b79){return function(_0x58f85c){if(!_0x58f85c){_0x31ff97[_0xa403('0x21')](0x194);}return _0x58f85c;};}function handleError(_0x16be1a,_0x393074){_0x393074=_0x393074||0x1f4;return function(_0x5ccf4a){logger[_0xa403('0x1d')](_0x5ccf4a['stack']);if(_0x5ccf4a[_0xa403('0x30')]){delete _0x5ccf4a[_0xa403('0x30')];}_0x16be1a[_0xa403('0x28')](_0x393074)['send'](_0x5ccf4a);};}exports['index']=function(_0xeaff68,_0x2aeaa1){var _0x23be6b={},_0x5e5f8f={},_0x24156e={'count':0x0,'rows':[]};var _0x4c5a74=_[_0xa403('0x31')](db[_0xa403('0x32')][_0xa403('0x33')],function(_0x43b676){return{'name':_0x43b676[_0xa403('0x34')],'type':_0x43b676['type']['key']};});_0x5e5f8f[_0xa403('0x35')]=_['map'](_0x4c5a74,_0xa403('0x30'));_0x5e5f8f[_0xa403('0x36')]=_[_0xa403('0x37')](_0xeaff68['query']);_0x5e5f8f[_0xa403('0x38')]=_[_0xa403('0x39')](_0x5e5f8f[_0xa403('0x35')],_0x5e5f8f['query']);_0x23be6b[_0xa403('0x3a')]=_[_0xa403('0x39')](_0x5e5f8f[_0xa403('0x35')],qs[_0xa403('0x3b')](_0xeaff68['query'][_0xa403('0x3b')]));_0x23be6b['attributes']=_0x23be6b[_0xa403('0x3a')]['length']?_0x23be6b[_0xa403('0x3a')]:_0x5e5f8f['model'];if(!_0xeaff68[_0xa403('0x36')]['hasOwnProperty']('nolimit')){_0x23be6b[_0xa403('0x26')]=qs[_0xa403('0x26')](_0xeaff68['query']['limit']);_0x23be6b['offset']=qs['offset'](_0xeaff68[_0xa403('0x36')]['offset']);}_0x23be6b[_0xa403('0x3c')]=qs[_0xa403('0x3d')](_0xeaff68[_0xa403('0x36')]['sort']);_0x23be6b[_0xa403('0x3e')]=qs['filters'](_[_0xa403('0x3f')](_0xeaff68[_0xa403('0x36')],_0x5e5f8f['filters']),_0x4c5a74);if(_0xeaff68[_0xa403('0x36')][_0xa403('0x40')]){_0x23be6b['where']=_[_0xa403('0x41')](_0x23be6b[_0xa403('0x3e')],{'$or':_['map'](_0x4c5a74,function(_0x3cb5f2){if(_0x3cb5f2[_0xa403('0x42')]!==_0xa403('0x43')){var _0x5818c8={};_0x5818c8[_0x3cb5f2[_0xa403('0x30')]]={'$like':'%'+_0xeaff68[_0xa403('0x36')][_0xa403('0x40')]+'%'};return _0x5818c8;}})});}_0x23be6b=_[_0xa403('0x41')]({},_0x23be6b,_0xeaff68['options']);var _0x53dc66={'where':_0x23be6b['where']};return db[_0xa403('0x32')][_0xa403('0x27')](_0x53dc66)[_0xa403('0x18')](function(_0xa1443c){_0x24156e[_0xa403('0x27')]=_0xa1443c;if(_0xeaff68[_0xa403('0x36')][_0xa403('0x44')]){_0x23be6b[_0xa403('0x45')]=[{'all':!![]}];}return db[_0xa403('0x32')][_0xa403('0x46')](_0x23be6b);})[_0xa403('0x18')](function(_0x5a71ff){_0x24156e[_0xa403('0x47')]=_0x5a71ff;return _0x24156e;})[_0xa403('0x18')](respondWithFilteredResult(_0x2aeaa1,_0x23be6b))[_0xa403('0x48')](handleError(_0x2aeaa1,null));};exports[_0xa403('0x49')]=function(_0x54b18c,_0x34201c){var _0x57ac15={'raw':![],'where':{'id':_0x54b18c[_0xa403('0x4a')]['id']}},_0x3c95b2={};_0x3c95b2[_0xa403('0x35')]=_[_0xa403('0x37')](db['VoiceContext']['rawAttributes']);_0x3c95b2['query']=_['keys'](_0x54b18c[_0xa403('0x36')]);_0x3c95b2[_0xa403('0x38')]=_[_0xa403('0x39')](_0x3c95b2[_0xa403('0x35')],_0x3c95b2[_0xa403('0x36')]);_0x57ac15[_0xa403('0x3a')]=_[_0xa403('0x39')](_0x3c95b2[_0xa403('0x35')],qs[_0xa403('0x3b')](_0x54b18c['query']['fields']));_0x57ac15[_0xa403('0x3a')]=_0x57ac15[_0xa403('0x3a')]['length']?_0x57ac15[_0xa403('0x3a')]:_0x3c95b2[_0xa403('0x35')];if(_0x54b18c['query'][_0xa403('0x44')]){_0x57ac15[_0xa403('0x45')]=[{'all':!![]}];}_0x57ac15=_[_0xa403('0x41')]({},_0x57ac15,_0x54b18c['options']);return db[_0xa403('0x32')]['find'](_0x57ac15)['then'](handleEntityNotFound(_0x34201c,null))['then'](respondWithResult(_0x34201c,null))[_0xa403('0x48')](handleError(_0x34201c,null));};exports[_0xa403('0x4b')]=function(_0xb5048c,_0x4f6783,_0x5b53e3){var _0x39e591;return db[_0xa403('0x32')]['create'](_0xb5048c['body'],{'raw':!![]})['then'](function(_0x21b0c3){_0x39e591=_0x21b0c3;return db[_0xa403('0x32')]['findAll']({'raw':!![]});})[_0xa403('0x18')](function(_0x1f9536){var _0x500968=fs[_0xa403('0x4c')](path[_0xa403('0x4d')](config[_0xa403('0x4e')],_0xa403('0x4f')),_0xa403('0x50'));var _0x13e2dd=ejs[_0xa403('0x51')](_0x500968,{'contexts':_0x1f9536||[]});fs[_0xa403('0x52')](_0xa403('0x53'),_0x13e2dd);})[_0xa403('0x18')](function(){return respondWithRpcPromise(_0xa403('0x54'),_0xa403('0x4b'),{'module':_0xa403('0x55')});})['then'](function(){var _0xe74320=_0xb5048c[_0xa403('0x56')]['get']({'plain':!![]});if(!_0xe74320)throw new Error(_0xa403('0x57'));if(_0xe74320['role']===_0xa403('0x56')){var _0x6d4c07=_0x39e591[_0xa403('0x2e')]({'plain':!![]});return db[_0xa403('0x58')][_0xa403('0x59')]({'where':{'name':_0xa403('0x5a'),'userProfileId':_0xe74320[_0xa403('0x5b')]},'raw':!![]})[_0xa403('0x18')](function(_0x24165c){if(_0x24165c&&_0x24165c[_0xa403('0x5c')]===0x0){return db[_0xa403('0x5d')][_0xa403('0x4b')]({'name':_0x6d4c07[_0xa403('0x30')],'resourceId':_0x6d4c07['id'],'type':_0x24165c[_0xa403('0x30')],'sectionId':_0x24165c['id']},{})[_0xa403('0x18')](function(){return _0x39e591;});}else{return _0x39e591;}})['catch'](function(_0x334cc8){logger[_0xa403('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x334cc8);throw _0x334cc8;});}return _0x39e591;})[_0xa403('0x18')](respondWithResult(_0x4f6783,0xc9))[_0xa403('0x48')](handleError(_0x4f6783,null));};exports[_0xa403('0x2d')]=function(_0x121864,_0x356484,_0x43a132){var _0x3d17ab;return db[_0xa403('0x32')]['find']({'where':{'id':_0x121864[_0xa403('0x4a')]['id']}})[_0xa403('0x18')](handleEntityNotFound(_0x356484,null))[_0xa403('0x18')](saveUpdates(_0x121864[_0xa403('0x5e')],null))['then'](function(_0x471e47){if(_0x471e47){_0x3d17ab=_0x471e47;return db[_0xa403('0x32')][_0xa403('0x46')]({'raw':!![]});}})['then'](function(_0x227715){var _0x1f68cb=fs[_0xa403('0x4c')](path[_0xa403('0x4d')](config[_0xa403('0x4e')],_0xa403('0x4f')),_0xa403('0x50'));var _0x4e4525=ejs[_0xa403('0x51')](_0x1f68cb,{'contexts':_0x227715||[]});fs[_0xa403('0x52')](_0xa403('0x53'),_0x4e4525);})[_0xa403('0x18')](function(){return respondWithRpcPromise('Reload','update',{'module':_0xa403('0x55')});})[_0xa403('0x18')](function(){return _0x3d17ab;})['then'](respondWithResult(_0x356484,null))[_0xa403('0x48')](handleError(_0x356484,null));};exports[_0xa403('0x2f')]=function(_0x42314e,_0x43379e,_0x265802){var _0x2d255a;return db[_0xa403('0x32')][_0xa403('0x59')]({'where':{'id':_0x42314e[_0xa403('0x4a')]['id']}})[_0xa403('0x18')](handleEntityNotFound(_0x43379e,null))[_0xa403('0x18')](removeEntity(_0x43379e,null))['then'](function(){return db[_0xa403('0x32')][_0xa403('0x46')]({'raw':!![]});})[_0xa403('0x18')](function(_0x65443c){var _0x1ad9a6=fs['readFileSync'](path[_0xa403('0x4d')](config['root'],_0xa403('0x4f')),_0xa403('0x50'));var _0x277038=ejs['render'](_0x1ad9a6,{'contexts':_0x65443c});fs[_0xa403('0x52')](_0xa403('0x53'),_0x277038);return respondWithRpcPromise('Reload',_0xa403('0x2f'),{'module':'chan_sip.so'});})[_0xa403('0x48')](handleError(_0x43379e,null));}; \ No newline at end of file +var _0x8ae7=['VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','get','Contexts','UserProfileResource','destroy','end','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','show','params','keys','filters','options','find','create','body','readFileSync','join','server/files/templates/context.ejs','render','writeFileSync','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','utf8','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','jayson/promise','client','http','then'];(function(_0x5c9f19,_0x407ab3){var _0x45617f=function(_0x101f37){while(--_0x101f37){_0x5c9f19['push'](_0x5c9f19['shift']());}};_0x45617f(++_0x407ab3);}(_0x8ae7,0x11a));var _0x78ae=function(_0x10152a,_0xd9e2bd){_0x10152a=_0x10152a-0x0;var _0x105047=_0x8ae7[_0x10152a];return _0x105047;};'use strict';var emlformat=require(_0x78ae('0x0'));var rimraf=require(_0x78ae('0x1'));var zipdir=require(_0x78ae('0x2'));var jsonpatch=require(_0x78ae('0x3'));var rp=require(_0x78ae('0x4'));var moment=require('moment');var BPromise=require(_0x78ae('0x5'));var Mustache=require(_0x78ae('0x6'));var util=require('util');var path=require(_0x78ae('0x7'));var sox=require('sox');var csv=require(_0x78ae('0x8'));var ejs=require(_0x78ae('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x78ae('0xa'));var squel=require('squel');var crypto=require(_0x78ae('0xb'));var jsforce=require(_0x78ae('0xc'));var deskjs=require(_0x78ae('0xd'));var toCsv=require(_0x78ae('0x8'));var querystring=require(_0x78ae('0xe'));var Papa=require(_0x78ae('0xf'));var Redis=require('ioredis');var authService=require(_0x78ae('0x10'));var qs=require(_0x78ae('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x78ae('0x12'));var logger=require(_0x78ae('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x78ae('0x14'));var client=jayson[_0x78ae('0x15')][_0x78ae('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x569f65,_0x209ec9,_0x3ff000,_0x18ee92){return new BPromise(function(_0x2968a1,_0x204626){var _0x31779e=_0x18ee92||client;return _0x31779e['request'](_0x569f65,_0x3ff000)[_0x78ae('0x17')](function(_0xa6deb2){logger['info'](_0x78ae('0x18'),_0x209ec9,_0x78ae('0x19'));logger[_0x78ae('0x1a')](_0x78ae('0x1b'),_0x209ec9,_0x78ae('0x19'),JSON[_0x78ae('0x1c')](_0xa6deb2));if(_0xa6deb2[_0x78ae('0x1d')]){if(_0xa6deb2[_0x78ae('0x1d')]['code']===0x1f4){logger['error'](_0x78ae('0x18'),_0x209ec9,_0xa6deb2[_0x78ae('0x1d')][_0x78ae('0x1e')]);return _0x204626(_0xa6deb2[_0x78ae('0x1d')][_0x78ae('0x1e')]);}logger['error'](_0x78ae('0x18'),_0x209ec9,_0xa6deb2[_0x78ae('0x1d')][_0x78ae('0x1e')]);return _0x2968a1(_0xa6deb2[_0x78ae('0x1d')][_0x78ae('0x1e')]);}else{logger[_0x78ae('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x209ec9,'request\x20sent');_0x2968a1(_0xa6deb2[_0x78ae('0x20')]['message']);}})[_0x78ae('0x21')](function(_0x1ad44b){logger[_0x78ae('0x1d')](_0x78ae('0x18'),_0x209ec9,_0x1ad44b);_0x204626(_0x1ad44b);});});}function respondWithStatusCode(_0x1b20d8,_0x5e2ccb){_0x5e2ccb=_0x5e2ccb||0xcc;return function(_0x222f93){if(_0x222f93){return _0x1b20d8[_0x78ae('0x22')](_0x5e2ccb);}return _0x1b20d8[_0x78ae('0x23')](_0x5e2ccb)['end']();};}function respondWithResult(_0x21c2c4,_0x1ed03f){_0x1ed03f=_0x1ed03f||0xc8;return function(_0x29599f){if(_0x29599f){return _0x21c2c4[_0x78ae('0x23')](_0x1ed03f)['json'](_0x29599f);}};}function respondWithFilteredResult(_0x34e158,_0x59dc53){return function(_0x30b930){if(_0x30b930){var _0x3d8f2d=typeof _0x59dc53[_0x78ae('0x24')]===_0x78ae('0x25')&&typeof _0x59dc53[_0x78ae('0x26')]===_0x78ae('0x25');var _0x21db16=_0x30b930[_0x78ae('0x27')];var _0xad3975=_0x3d8f2d?0x0:_0x59dc53['offset'];var _0x1d5699=_0x3d8f2d?_0x30b930[_0x78ae('0x27')]:_0x59dc53[_0x78ae('0x24')]+_0x59dc53['limit'];var _0x1d4830;if(_0x1d5699>=_0x21db16){_0x1d5699=_0x21db16;_0x1d4830=0xc8;}else{_0x1d4830=0xce;}_0x34e158[_0x78ae('0x23')](_0x1d4830);return _0x34e158[_0x78ae('0x28')](_0x78ae('0x29'),_0xad3975+'-'+_0x1d5699+'/'+_0x21db16)[_0x78ae('0x2a')](_0x30b930);}return null;};}function patchUpdates(_0x5d5a82){return function(_0x4c37d2){try{jsonpatch[_0x78ae('0x2b')](_0x4c37d2,_0x5d5a82,!![]);}catch(_0x41df9e){return BPromise['reject'](_0x41df9e);}return _0x4c37d2[_0x78ae('0x2c')]();};}function saveUpdates(_0x2623b4,_0x252848){return function(_0x16fe0d){if(_0x16fe0d){return _0x16fe0d[_0x78ae('0x2d')](_0x2623b4)['then'](function(_0x581b36){return _0x581b36;});}return null;};}function removeEntity(_0x58fbc0,_0x2c1318){return function(_0xbbf3a8){if(_0xbbf3a8){return _0xbbf3a8['destroy']()['then'](function(){var _0x5d7fd7=_0xbbf3a8[_0x78ae('0x2e')]({'plain':!![]});var _0x283920=_0x78ae('0x2f');return db[_0x78ae('0x30')][_0x78ae('0x31')]({'where':{'type':_0x283920,'resourceId':_0x5d7fd7['id']}})['then'](function(){return _0xbbf3a8;});})[_0x78ae('0x17')](function(){_0x58fbc0[_0x78ae('0x23')](0xcc)[_0x78ae('0x32')]();});}};}function handleEntityNotFound(_0x3364ea,_0x15ac03){return function(_0x430c55){if(!_0x430c55){_0x3364ea[_0x78ae('0x22')](0x194);}return _0x430c55;};}function handleError(_0xcbf438,_0x157988){_0x157988=_0x157988||0x1f4;return function(_0x3cf3e7){logger['error'](_0x3cf3e7[_0x78ae('0x33')]);if(_0x3cf3e7[_0x78ae('0x34')]){delete _0x3cf3e7[_0x78ae('0x34')];}_0xcbf438['status'](_0x157988)[_0x78ae('0x35')](_0x3cf3e7);};}exports[_0x78ae('0x36')]=function(_0x190bff,_0x25e7b8){var _0x526b2b={},_0x3d3dbc={},_0xed2225={'count':0x0,'rows':[]};var _0x490aa6=_[_0x78ae('0x37')](db[_0x78ae('0x38')][_0x78ae('0x39')],function(_0x318066){return{'name':_0x318066[_0x78ae('0x3a')],'type':_0x318066[_0x78ae('0x3b')][_0x78ae('0x3c')]};});_0x3d3dbc[_0x78ae('0x3d')]=_[_0x78ae('0x37')](_0x490aa6,'name');_0x3d3dbc[_0x78ae('0x3e')]=_['keys'](_0x190bff['query']);_0x3d3dbc['filters']=_[_0x78ae('0x3f')](_0x3d3dbc[_0x78ae('0x3d')],_0x3d3dbc[_0x78ae('0x3e')]);_0x526b2b[_0x78ae('0x40')]=_[_0x78ae('0x3f')](_0x3d3dbc[_0x78ae('0x3d')],qs[_0x78ae('0x41')](_0x190bff[_0x78ae('0x3e')][_0x78ae('0x41')]));_0x526b2b['attributes']=_0x526b2b['attributes'][_0x78ae('0x42')]?_0x526b2b[_0x78ae('0x40')]:_0x3d3dbc[_0x78ae('0x3d')];if(!_0x190bff[_0x78ae('0x3e')]['hasOwnProperty'](_0x78ae('0x43'))){_0x526b2b[_0x78ae('0x26')]=qs[_0x78ae('0x26')](_0x190bff[_0x78ae('0x3e')][_0x78ae('0x26')]);_0x526b2b[_0x78ae('0x24')]=qs[_0x78ae('0x24')](_0x190bff[_0x78ae('0x3e')][_0x78ae('0x24')]);}_0x526b2b[_0x78ae('0x44')]=qs[_0x78ae('0x45')](_0x190bff[_0x78ae('0x3e')][_0x78ae('0x45')]);_0x526b2b[_0x78ae('0x46')]=qs['filters'](_[_0x78ae('0x47')](_0x190bff[_0x78ae('0x3e')],_0x3d3dbc['filters']),_0x490aa6);if(_0x190bff[_0x78ae('0x3e')]['filter']){_0x526b2b['where']=_[_0x78ae('0x48')](_0x526b2b[_0x78ae('0x46')],{'$or':_['map'](_0x490aa6,function(_0x4e9b53){if(_0x4e9b53[_0x78ae('0x3b')]!=='VIRTUAL'){var _0x28d7e8={};_0x28d7e8[_0x4e9b53[_0x78ae('0x34')]]={'$like':'%'+_0x190bff['query'][_0x78ae('0x49')]+'%'};return _0x28d7e8;}})});}_0x526b2b=_[_0x78ae('0x48')]({},_0x526b2b,_0x190bff['options']);var _0x229501={'where':_0x526b2b[_0x78ae('0x46')]};return db[_0x78ae('0x38')][_0x78ae('0x27')](_0x229501)[_0x78ae('0x17')](function(_0x4029bc){_0xed2225[_0x78ae('0x27')]=_0x4029bc;if(_0x190bff[_0x78ae('0x3e')][_0x78ae('0x4a')]){_0x526b2b[_0x78ae('0x4b')]=[{'all':!![]}];}return db[_0x78ae('0x38')][_0x78ae('0x4c')](_0x526b2b);})[_0x78ae('0x17')](function(_0x31c781){_0xed2225['rows']=_0x31c781;return _0xed2225;})[_0x78ae('0x17')](respondWithFilteredResult(_0x25e7b8,_0x526b2b))['catch'](handleError(_0x25e7b8,null));};exports[_0x78ae('0x4d')]=function(_0x1850ab,_0x4b2248){var _0x3893e8={'raw':![],'where':{'id':_0x1850ab[_0x78ae('0x4e')]['id']}},_0x517705={};_0x517705['model']=_[_0x78ae('0x4f')](db[_0x78ae('0x38')][_0x78ae('0x39')]);_0x517705[_0x78ae('0x3e')]=_[_0x78ae('0x4f')](_0x1850ab[_0x78ae('0x3e')]);_0x517705[_0x78ae('0x50')]=_['intersection'](_0x517705['model'],_0x517705['query']);_0x3893e8[_0x78ae('0x40')]=_[_0x78ae('0x3f')](_0x517705[_0x78ae('0x3d')],qs[_0x78ae('0x41')](_0x1850ab[_0x78ae('0x3e')]['fields']));_0x3893e8[_0x78ae('0x40')]=_0x3893e8[_0x78ae('0x40')][_0x78ae('0x42')]?_0x3893e8['attributes']:_0x517705['model'];if(_0x1850ab[_0x78ae('0x3e')][_0x78ae('0x4a')]){_0x3893e8['include']=[{'all':!![]}];}_0x3893e8=_['merge']({},_0x3893e8,_0x1850ab[_0x78ae('0x51')]);return db[_0x78ae('0x38')][_0x78ae('0x52')](_0x3893e8)[_0x78ae('0x17')](handleEntityNotFound(_0x4b2248,null))[_0x78ae('0x17')](respondWithResult(_0x4b2248,null))[_0x78ae('0x21')](handleError(_0x4b2248,null));};exports[_0x78ae('0x53')]=function(_0x11235c,_0x29c0c8,_0x260d10){var _0x539390;return db[_0x78ae('0x38')][_0x78ae('0x53')](_0x11235c[_0x78ae('0x54')],{'raw':!![]})[_0x78ae('0x17')](function(_0x58549b){_0x539390=_0x58549b;return db[_0x78ae('0x38')]['findAll']({'raw':!![]});})[_0x78ae('0x17')](function(_0x28b892){var _0x5461b7=fs[_0x78ae('0x55')](path[_0x78ae('0x56')](config['root'],_0x78ae('0x57')),'utf8');var _0x5d7ad2=ejs[_0x78ae('0x58')](_0x5461b7,{'contexts':_0x28b892||[]});fs[_0x78ae('0x59')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x5d7ad2);})[_0x78ae('0x17')](function(){return respondWithRpcPromise(_0x78ae('0x5a'),'create',{'module':'chan_sip.so'});})[_0x78ae('0x17')](function(){var _0x5ceb3d=_0x11235c[_0x78ae('0x5b')][_0x78ae('0x2e')]({'plain':!![]});if(!_0x5ceb3d)throw new Error(_0x78ae('0x5c'));if(_0x5ceb3d[_0x78ae('0x5d')]===_0x78ae('0x5b')){var _0x398763=_0x539390[_0x78ae('0x2e')]({'plain':!![]});return db[_0x78ae('0x5e')][_0x78ae('0x52')]({'where':{'name':_0x78ae('0x2f'),'userProfileId':_0x5ceb3d[_0x78ae('0x5f')]},'raw':!![]})[_0x78ae('0x17')](function(_0x40ef7c){if(_0x40ef7c&&_0x40ef7c[_0x78ae('0x60')]===0x0){return db['UserProfileResource'][_0x78ae('0x53')]({'name':_0x398763[_0x78ae('0x34')],'resourceId':_0x398763['id'],'type':_0x40ef7c[_0x78ae('0x34')],'sectionId':_0x40ef7c['id']},{})[_0x78ae('0x17')](function(){return _0x539390;});}else{return _0x539390;}})[_0x78ae('0x21')](function(_0x2be65e){logger[_0x78ae('0x1d')](_0x78ae('0x61'),_0x2be65e);throw _0x2be65e;});}return _0x539390;})[_0x78ae('0x17')](respondWithResult(_0x29c0c8,0xc9))[_0x78ae('0x21')](handleError(_0x29c0c8,null));};exports['update']=function(_0xff0d6d,_0x469fc8,_0x9d86ff){var _0x2a880e;return db[_0x78ae('0x38')]['find']({'where':{'id':_0xff0d6d[_0x78ae('0x4e')]['id']}})[_0x78ae('0x17')](handleEntityNotFound(_0x469fc8,null))[_0x78ae('0x17')](saveUpdates(_0xff0d6d[_0x78ae('0x54')],null))[_0x78ae('0x17')](function(_0x97218f){if(_0x97218f){_0x2a880e=_0x97218f;return db[_0x78ae('0x38')]['findAll']({'raw':!![]});}})[_0x78ae('0x17')](function(_0x398abb){var _0x33257a=fs[_0x78ae('0x55')](path['join'](config[_0x78ae('0x62')],_0x78ae('0x57')),_0x78ae('0x63'));var _0x4d1bff=ejs['render'](_0x33257a,{'contexts':_0x398abb||[]});fs[_0x78ae('0x59')](_0x78ae('0x64'),_0x4d1bff);})[_0x78ae('0x17')](function(){return respondWithRpcPromise('Reload','update',{'module':_0x78ae('0x65')});})[_0x78ae('0x17')](function(){return _0x2a880e;})[_0x78ae('0x17')](respondWithResult(_0x469fc8,null))[_0x78ae('0x21')](handleError(_0x469fc8,null));};exports[_0x78ae('0x31')]=function(_0x552201,_0x396529,_0x32f48b){var _0x28d0cf;return db[_0x78ae('0x38')][_0x78ae('0x52')]({'where':{'id':_0x552201[_0x78ae('0x4e')]['id']}})['then'](handleEntityNotFound(_0x396529,null))[_0x78ae('0x17')](removeEntity(_0x396529,null))['then'](function(){return db[_0x78ae('0x38')][_0x78ae('0x4c')]({'raw':!![]});})['then'](function(_0x51d3e6){var _0x149c40=fs[_0x78ae('0x55')](path[_0x78ae('0x56')](config[_0x78ae('0x62')],_0x78ae('0x57')),_0x78ae('0x63'));var _0xa20c42=ejs['render'](_0x149c40,{'contexts':_0x51d3e6});fs[_0x78ae('0x59')]('/etc/asterisk/extensions_xcally_contexts.conf',_0xa20c42);return respondWithRpcPromise(_0x78ae('0x5a'),'destroy',{'module':'chan_sip.so'});})[_0x78ae('0x21')](handleError(_0x396529,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index f290976..e569278 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 _0x0a6b=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','VoiceContext'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x0a6b,0x120));var _0xb0a6=function(_0x53a6c0,_0x53df9a){_0x53a6c0=_0x53a6c0-0x0;var _0x30c452=_0x0a6b[_0x53a6c0];return _0x30c452;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var logger=require(_0xb0a6('0x1'))(_0xb0a6('0x2'));var moment=require(_0xb0a6('0x3'));var BPromise=require(_0xb0a6('0x4'));var rp=require(_0xb0a6('0x5'));var fs=require('fs');var path=require(_0xb0a6('0x6'));var rimraf=require(_0xb0a6('0x7'));var config=require(_0xb0a6('0x8'));var attributes=require(_0xb0a6('0x9'));module[_0xb0a6('0xa')]=function(_0x4b47bc,_0x30b3b7){return _0x4b47bc['define'](_0xb0a6('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e63=['moment','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','VoiceContext','voice_contexts','lodash','../../config/logger','api'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x5e63,0x19f));var _0x35e6=function(_0x124fea,_0x3e889d){_0x124fea=_0x124fea-0x0;var _0x4dc909=_0x5e63[_0x124fea];return _0x4dc909;};'use strict';var _=require(_0x35e6('0x0'));var util=require('util');var logger=require(_0x35e6('0x1'))(_0x35e6('0x2'));var moment=require(_0x35e6('0x3'));var BPromise=require('bluebird');var rp=require(_0x35e6('0x4'));var fs=require('fs');var path=require(_0x35e6('0x5'));var rimraf=require(_0x35e6('0x6'));var config=require(_0x35e6('0x7'));var attributes=require(_0x35e6('0x8'));module['exports']=function(_0x341cc6,_0x394566){return _0x341cc6['define'](_0x35e6('0x9'),attributes,{'tableName':_0x35e6('0xa'),'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 7fa8063..95f18f1 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 _0x28f2=['debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceContext,\x20%s,\x20%s'];(function(_0x362f6a,_0x3bd6b4){var _0x366640=function(_0x253c78){while(--_0x253c78){_0x362f6a['push'](_0x362f6a['shift']());}};_0x366640(++_0x3bd6b4);}(_0x28f2,0x193));var _0x228f=function(_0x9e3d59,_0x5b3961){_0x9e3d59=_0x9e3d59-0x0;var _0x684082=_0x28f2[_0x9e3d59];return _0x684082;};'use strict';var _=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var moment=require(_0x228f('0x2'));var BPromise=require(_0x228f('0x3'));var rs=require(_0x228f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x228f('0x5'))['db'];var utils=require(_0x228f('0x6'));var logger=require(_0x228f('0x7'))(_0x228f('0x8'));var config=require(_0x228f('0x9'));var jayson=require(_0x228f('0xa'));var client=jayson[_0x228f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10da58,_0x4a4a44,_0x3ca074){return new BPromise(function(_0x455eb6,_0xf4b011){return client['request'](_0x10da58,_0x3ca074)[_0x228f('0xc')](function(_0x4d0038){logger[_0x228f('0xd')](_0x228f('0xe'),_0x4a4a44,'request\x20sent');logger[_0x228f('0xf')](_0x228f('0x10'),_0x4a4a44,_0x228f('0x11'),JSON[_0x228f('0x12')](_0x4d0038));if(_0x4d0038[_0x228f('0x13')]){if(_0x4d0038['error'][_0x228f('0x14')]===0x1f4){logger[_0x228f('0x13')](_0x228f('0xe'),_0x4a4a44,_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);return _0xf4b011(_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);}logger[_0x228f('0x13')]('VoiceContext,\x20%s,\x20%s',_0x4a4a44,_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);return _0x455eb6(_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);}else{logger[_0x228f('0xd')](_0x228f('0xe'),_0x4a4a44,_0x228f('0x11'));_0x455eb6(_0x4d0038['result'][_0x228f('0x15')]);}})['catch'](function(_0x20e687){logger[_0x228f('0x13')](_0x228f('0xe'),_0x4a4a44,_0x20e687);_0xf4b011(_0x20e687);});});} \ No newline at end of file +var _0x4295=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2d4abf,_0x5f0d14){var _0x31ffdc=function(_0xa160b0){while(--_0xa160b0){_0x2d4abf['push'](_0x2d4abf['shift']());}};_0x31ffdc(++_0x5f0d14);}(_0x4295,0xc3));var _0x5429=function(_0x50a51e,_0x56e813){_0x50a51e=_0x50a51e-0x0;var _0x8a736e=_0x4295[_0x50a51e];return _0x8a736e;};'use strict';var _=require(_0x5429('0x0'));var util=require('util');var moment=require(_0x5429('0x1'));var BPromise=require(_0x5429('0x2'));var rs=require(_0x5429('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5429('0x4'))['db'];var utils=require(_0x5429('0x5'));var logger=require('../../config/logger')(_0x5429('0x6'));var config=require(_0x5429('0x7'));var jayson=require(_0x5429('0x8'));var client=jayson['client'][_0x5429('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d9893,_0x126193,_0x7315eb){return new BPromise(function(_0x58f37e,_0x2d814d){return client[_0x5429('0xa')](_0x5d9893,_0x7315eb)['then'](function(_0x43d54c){logger['info'](_0x5429('0xb'),_0x126193,'request\x20sent');logger[_0x5429('0xc')](_0x5429('0xd'),_0x126193,_0x5429('0xe'),JSON[_0x5429('0xf')](_0x43d54c));if(_0x43d54c[_0x5429('0x10')]){if(_0x43d54c[_0x5429('0x10')]['code']===0x1f4){logger[_0x5429('0x10')](_0x5429('0xb'),_0x126193,_0x43d54c[_0x5429('0x10')]['message']);return _0x2d814d(_0x43d54c[_0x5429('0x10')]['message']);}logger[_0x5429('0x10')]('VoiceContext,\x20%s,\x20%s',_0x126193,_0x43d54c['error'][_0x5429('0x11')]);return _0x58f37e(_0x43d54c[_0x5429('0x10')][_0x5429('0x11')]);}else{logger[_0x5429('0x12')](_0x5429('0xb'),_0x126193,_0x5429('0xe'));_0x58f37e(_0x43d54c[_0x5429('0x13')]['message']);}})['catch'](function(_0x4326a5){logger[_0x5429('0x10')](_0x5429('0xb'),_0x126193,_0x4326a5);_0x2d814d(_0x4326a5);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 8160c76..9a5bfde 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 _0x2b55=['index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get'];(function(_0x4126c4,_0x229bca){var _0x58a833=function(_0x1aabed){while(--_0x1aabed){_0x4126c4['push'](_0x4126c4['shift']());}};_0x58a833(++_0x229bca);}(_0x2b55,0x1f0));var _0x52b5=function(_0x2ea97c,_0x1455fe){_0x2ea97c=_0x2ea97c-0x0;var _0x35dcd6=_0x2b55[_0x2ea97c];return _0x35dcd6;};'use strict';var multer=require(_0x52b5('0x0'));var util=require(_0x52b5('0x1'));var path=require(_0x52b5('0x2'));var timeout=require('connect-timeout');var express=require(_0x52b5('0x3'));var router=express[_0x52b5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x52b5('0x5'));var interaction=require(_0x52b5('0x6'));var config=require(_0x52b5('0x7'));var controller=require(_0x52b5('0x8'));router[_0x52b5('0x9')]('/',auth['isAuthenticated'](),controller[_0x52b5('0xa')]);router[_0x52b5('0x9')](_0x52b5('0xb'),auth[_0x52b5('0xc')](),controller[_0x52b5('0xd')]);router[_0x52b5('0x9')](_0x52b5('0xe'),auth[_0x52b5('0xc')](),controller[_0x52b5('0xf')]);router[_0x52b5('0x10')]('/',auth[_0x52b5('0xc')](),controller[_0x52b5('0x11')]);router[_0x52b5('0x12')](_0x52b5('0xe'),auth[_0x52b5('0xc')](),controller['update']);router[_0x52b5('0x13')](_0x52b5('0xe'),auth['isAuthenticated'](),controller[_0x52b5('0x14')]);module[_0x52b5('0x15')]=router; \ No newline at end of file +var _0x6a93=['fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','path','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a93,0x188));var _0x36a9=function(_0x2175c6,_0x425527){_0x2175c6=_0x2175c6-0x0;var _0x5bbf34=_0x6a93[_0x2175c6];return _0x5bbf34;};'use strict';var multer=require(_0x36a9('0x0'));var util=require('util');var path=require(_0x36a9('0x1'));var timeout=require('connect-timeout');var express=require(_0x36a9('0x2'));var router=express[_0x36a9('0x3')]();var fs_extra=require(_0x36a9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x36a9('0x5'));var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router[_0x36a9('0x6')]('/',auth[_0x36a9('0x7')](),controller[_0x36a9('0x8')]);router[_0x36a9('0x6')](_0x36a9('0x9'),auth[_0x36a9('0x7')](),controller[_0x36a9('0xa')]);router[_0x36a9('0x6')](_0x36a9('0xb'),auth[_0x36a9('0x7')](),controller[_0x36a9('0xc')]);router['post']('/',auth[_0x36a9('0x7')](),controller[_0x36a9('0xd')]);router[_0x36a9('0xe')](_0x36a9('0xb'),auth[_0x36a9('0x7')](),controller[_0x36a9('0xf')]);router['delete'](_0x36a9('0xb'),auth[_0x36a9('0x7')](),controller[_0x36a9('0x10')]);module[_0x36a9('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index e70d281..4c2e581 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(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x3e74,0x175));var _0x43e7=function(_0x1a8854,_0x367f85){_0x1a8854=_0x1a8854-0x0;var _0x341fef=_0x3e74[_0x1a8854];return _0x341fef;};'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 _0xe5b3=['STRING','INTEGER','DATE','exports'];(function(_0x193305,_0x57146d){var _0x53da79=function(_0x54b2f6){while(--_0x54b2f6){_0x193305['push'](_0x193305['shift']());}};_0x53da79(++_0x57146d);}(_0xe5b3,0x133));var _0x3e5b=function(_0x429d09,_0x1a2228){_0x429d09=_0x429d09-0x0;var _0x113516=_0xe5b3[_0x429d09];return _0x113516;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'privilege':{'type':Sequelize[_0x3e5b('0x1')]},'channel':{'type':Sequelize[_0x3e5b('0x1')]},'channelstate':{'type':Sequelize[_0x3e5b('0x2')]},'channelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'calleridnum':{'type':Sequelize[_0x3e5b('0x1')]},'calleridname':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'language':{'type':Sequelize[_0x3e5b('0x1')]},'accountcode':{'type':Sequelize[_0x3e5b('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3e5b('0x1')]},'priority':{'type':Sequelize[_0x3e5b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x3e5b('0x1')]},'destchannel':{'type':Sequelize[_0x3e5b('0x1')]},'destchannelstate':{'type':Sequelize[_0x3e5b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'destlanguage':{'type':Sequelize[_0x3e5b('0x1')]},'destaccountcode':{'type':Sequelize[_0x3e5b('0x1')]},'destcontext':{'type':Sequelize[_0x3e5b('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x3e5b('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x3e5b('0x1')]},'dialstring':{'type':Sequelize[_0x3e5b('0x1')]},'dialstatus':{'type':Sequelize[_0x3e5b('0x1')]},'starttime':{'type':Sequelize[_0x3e5b('0x3')]},'answertime':{'type':Sequelize[_0x3e5b('0x3')]},'endtime':{'type':Sequelize[_0x3e5b('0x3')]},'lastevent':{'type':Sequelize[_0x3e5b('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x3e5b('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'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 edcc7a2..19a7e74 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 _0x42c3=['status','json','offset','undefined','limit','Content-Range','reject','save','update','destroy','then','error','stack','name','VoiceDialReport','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus'];(function(_0x389f40,_0x13c234){var _0x41a331=function(_0x1edece){while(--_0x1edece){_0x389f40['push'](_0x389f40['shift']());}};_0x41a331(++_0x13c234);}(_0x42c3,0x188));var _0x342c=function(_0x205400,_0x2609d1){_0x205400=_0x205400-0x0;var _0x36c821=_0x42c3[_0x205400];return _0x36c821;};'use strict';var emlformat=require(_0x342c('0x0'));var rimraf=require(_0x342c('0x1'));var zipdir=require(_0x342c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x342c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x342c('0x4'));var util=require('util');var path=require(_0x342c('0x5'));var sox=require(_0x342c('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x342c('0x7'));var squel=require(_0x342c('0x8'));var crypto=require(_0x342c('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x342c('0xa'));var querystring=require(_0x342c('0xb'));var Papa=require(_0x342c('0xc'));var Redis=require(_0x342c('0xd'));var authService=require(_0x342c('0xe'));var qs=require(_0x342c('0xf'));var as=require(_0x342c('0x10'));var hardwareService=require(_0x342c('0x11'));var logger=require('../../config/logger')(_0x342c('0x12'));var utils=require(_0x342c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x342c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2610d0,_0x48cef0){_0x48cef0=_0x48cef0||0xcc;return function(_0x2df3c6){if(_0x2df3c6){return _0x2610d0[_0x342c('0x15')](_0x48cef0);}return _0x2610d0['status'](_0x48cef0)['end']();};}function respondWithResult(_0x583ae0,_0x268fc9){_0x268fc9=_0x268fc9||0xc8;return function(_0x290cfe){if(_0x290cfe){return _0x583ae0[_0x342c('0x16')](_0x268fc9)[_0x342c('0x17')](_0x290cfe);}};}function respondWithFilteredResult(_0x2a09e7,_0x2e1b4c){return function(_0x5cadaa){if(_0x5cadaa){var _0x1f6c00=typeof _0x2e1b4c[_0x342c('0x18')]===_0x342c('0x19')&&typeof _0x2e1b4c[_0x342c('0x1a')]===_0x342c('0x19');var _0xd4c25a=_0x5cadaa['count'];var _0x3e85a7=_0x1f6c00?0x0:_0x2e1b4c[_0x342c('0x18')];var _0x28c1ec=_0x1f6c00?_0x5cadaa['count']:_0x2e1b4c[_0x342c('0x18')]+_0x2e1b4c[_0x342c('0x1a')];var _0x2924bf;if(_0x28c1ec>=_0xd4c25a){_0x28c1ec=_0xd4c25a;_0x2924bf=0xc8;}else{_0x2924bf=0xce;}_0x2a09e7[_0x342c('0x16')](_0x2924bf);return _0x2a09e7['set'](_0x342c('0x1b'),_0x3e85a7+'-'+_0x28c1ec+'/'+_0xd4c25a)[_0x342c('0x17')](_0x5cadaa);}return null;};}function patchUpdates(_0x5eb02a){return function(_0x48978f){try{jsonpatch['apply'](_0x48978f,_0x5eb02a,!![]);}catch(_0x4931c0){return BPromise[_0x342c('0x1c')](_0x4931c0);}return _0x48978f[_0x342c('0x1d')]();};}function saveUpdates(_0x248a79,_0x277544){return function(_0x53ff1d){if(_0x53ff1d){return _0x53ff1d[_0x342c('0x1e')](_0x248a79)['then'](function(_0x26620c){return _0x26620c;});}return null;};}function removeEntity(_0x23613b,_0x5a02f8){return function(_0x1190ee){if(_0x1190ee){return _0x1190ee[_0x342c('0x1f')]()[_0x342c('0x20')](function(){_0x23613b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3577ec,_0x48bf35){return function(_0x5cac7d){if(!_0x5cac7d){_0x3577ec['sendStatus'](0x194);}return _0x5cac7d;};}function handleError(_0x3f7a5c,_0x172d0e){_0x172d0e=_0x172d0e||0x1f4;return function(_0xb5a41b){logger[_0x342c('0x21')](_0xb5a41b[_0x342c('0x22')]);if(_0xb5a41b[_0x342c('0x23')]){delete _0xb5a41b['name'];}_0x3f7a5c[_0x342c('0x16')](_0x172d0e)['send'](_0xb5a41b);};}exports['index']=function(_0x2dab17,_0x1fdae2){var _0x2ea295={},_0x43198f={},_0x35ec67={'count':0x0,'rows':[]};var _0x4ae82d=_['map'](db[_0x342c('0x24')]['rawAttributes'],function(_0x534449){return{'name':_0x534449['fieldName'],'type':_0x534449[_0x342c('0x25')][_0x342c('0x26')]};});_0x43198f[_0x342c('0x27')]=_[_0x342c('0x28')](_0x4ae82d,_0x342c('0x23'));_0x43198f[_0x342c('0x29')]=_['keys'](_0x2dab17['query']);_0x43198f['filters']=_[_0x342c('0x2a')](_0x43198f[_0x342c('0x27')],_0x43198f[_0x342c('0x29')]);_0x2ea295[_0x342c('0x2b')]=_['intersection'](_0x43198f[_0x342c('0x27')],qs[_0x342c('0x2c')](_0x2dab17['query'][_0x342c('0x2c')]));_0x2ea295[_0x342c('0x2b')]=_0x2ea295[_0x342c('0x2b')][_0x342c('0x2d')]?_0x2ea295[_0x342c('0x2b')]:_0x43198f[_0x342c('0x27')];if(!_0x2dab17['query'][_0x342c('0x2e')]('nolimit')){_0x2ea295[_0x342c('0x1a')]=qs[_0x342c('0x1a')](_0x2dab17[_0x342c('0x29')][_0x342c('0x1a')]);_0x2ea295[_0x342c('0x18')]=qs[_0x342c('0x18')](_0x2dab17[_0x342c('0x29')]['offset']);}_0x2ea295[_0x342c('0x2f')]=qs[_0x342c('0x30')](_0x2dab17[_0x342c('0x29')][_0x342c('0x30')]);_0x2ea295['where']=qs[_0x342c('0x31')](_[_0x342c('0x32')](_0x2dab17[_0x342c('0x29')],_0x43198f[_0x342c('0x31')]),_0x4ae82d);if(_0x2dab17[_0x342c('0x29')][_0x342c('0x33')]){_0x2ea295['where']=_['merge'](_0x2ea295[_0x342c('0x34')],{'$or':_[_0x342c('0x28')](_0x4ae82d,function(_0x367466){if(_0x367466[_0x342c('0x25')]!==_0x342c('0x35')){var _0x365692={};_0x365692[_0x367466[_0x342c('0x23')]]={'$like':'%'+_0x2dab17[_0x342c('0x29')]['filter']+'%'};return _0x365692;}})});}_0x2ea295=_[_0x342c('0x36')]({},_0x2ea295,_0x2dab17[_0x342c('0x37')]);var _0x30898e={'where':_0x2ea295[_0x342c('0x34')]};return db['VoiceDialReport']['count'](_0x30898e)['then'](function(_0x225fa1){_0x35ec67[_0x342c('0x38')]=_0x225fa1;if(_0x2dab17[_0x342c('0x29')][_0x342c('0x39')]){_0x2ea295[_0x342c('0x3a')]=[{'all':!![]}];}return db[_0x342c('0x24')]['findAll'](_0x2ea295);})['then'](function(_0x216661){_0x35ec67[_0x342c('0x3b')]=_0x216661;return _0x35ec67;})['then'](respondWithFilteredResult(_0x1fdae2,_0x2ea295))[_0x342c('0x3c')](handleError(_0x1fdae2,null));};exports[_0x342c('0x3d')]=function(_0x30d49c,_0x2a96ee){var _0x35973c={'raw':!![],'where':{'id':_0x30d49c[_0x342c('0x3e')]['id']}},_0x407f6f={};_0x407f6f[_0x342c('0x27')]=_[_0x342c('0x3f')](db[_0x342c('0x24')][_0x342c('0x40')]);_0x407f6f[_0x342c('0x29')]=_[_0x342c('0x3f')](_0x30d49c[_0x342c('0x29')]);_0x407f6f['filters']=_['intersection'](_0x407f6f[_0x342c('0x27')],_0x407f6f[_0x342c('0x29')]);_0x35973c['attributes']=_[_0x342c('0x2a')](_0x407f6f[_0x342c('0x27')],qs[_0x342c('0x2c')](_0x30d49c['query']['fields']));_0x35973c['attributes']=_0x35973c['attributes'][_0x342c('0x2d')]?_0x35973c[_0x342c('0x2b')]:_0x407f6f['model'];if(_0x30d49c[_0x342c('0x29')][_0x342c('0x39')]){_0x35973c['include']=[{'all':!![]}];}_0x35973c=_['merge']({},_0x35973c,_0x30d49c[_0x342c('0x37')]);return db[_0x342c('0x24')][_0x342c('0x41')](_0x35973c)[_0x342c('0x20')](handleEntityNotFound(_0x2a96ee,null))[_0x342c('0x20')](respondWithResult(_0x2a96ee,null))['catch'](handleError(_0x2a96ee,null));};exports[_0x342c('0x42')]=function(_0x41d1ba,_0x26c445){return db['VoiceDialReport'][_0x342c('0x42')](_0x41d1ba[_0x342c('0x43')],{})[_0x342c('0x20')](respondWithResult(_0x26c445,0xc9))[_0x342c('0x3c')](handleError(_0x26c445,null));};exports['update']=function(_0x41c6d1,_0x18a418){if(_0x41c6d1[_0x342c('0x43')]['id']){delete _0x41c6d1['body']['id'];}return db[_0x342c('0x24')][_0x342c('0x41')]({'where':{'id':_0x41c6d1[_0x342c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x18a418,null))[_0x342c('0x20')](saveUpdates(_0x41c6d1[_0x342c('0x43')],null))[_0x342c('0x20')](respondWithResult(_0x18a418,null))[_0x342c('0x3c')](handleError(_0x18a418,null));};exports[_0x342c('0x1f')]=function(_0x4f4167,_0x47bc1a){return db[_0x342c('0x24')][_0x342c('0x41')]({'where':{'id':_0x4f4167[_0x342c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x47bc1a,null))[_0x342c('0x20')](removeEntity(_0x47bc1a,null))[_0x342c('0x3c')](handleError(_0x47bc1a,null));};exports['describe']=function(_0x37934b,_0x3904ed){return db[_0x342c('0x24')][_0x342c('0x44')]()[_0x342c('0x20')](respondWithResult(_0x3904ed,null))[_0x342c('0x3c')](handleError(_0x3904ed,null));}; \ No newline at end of file +var _0x3372=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','status','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VoiceDialReport','includeAll','include','rows','catch','keys','options','find','create','body','params'];(function(_0x3569e1,_0x3ad80a){var _0x4951dc=function(_0x26b031){while(--_0x26b031){_0x3569e1['push'](_0x3569e1['shift']());}};_0x4951dc(++_0x3ad80a);}(_0x3372,0xe8));var _0x2337=function(_0x95a91a,_0x3599a7){_0x95a91a=_0x95a91a-0x0;var _0x5b0453=_0x3372[_0x95a91a];return _0x5b0453;};'use strict';var emlformat=require(_0x2337('0x0'));var rimraf=require(_0x2337('0x1'));var zipdir=require(_0x2337('0x2'));var jsonpatch=require(_0x2337('0x3'));var rp=require(_0x2337('0x4'));var moment=require(_0x2337('0x5'));var BPromise=require(_0x2337('0x6'));var Mustache=require(_0x2337('0x7'));var util=require('util');var path=require(_0x2337('0x8'));var sox=require(_0x2337('0x9'));var csv=require(_0x2337('0xa'));var ejs=require(_0x2337('0xb'));var fs=require('fs');var fs_extra=require(_0x2337('0xc'));var _=require(_0x2337('0xd'));var squel=require(_0x2337('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2337('0xf'));var toCsv=require(_0x2337('0xa'));var querystring=require(_0x2337('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2337('0x11'));var qs=require(_0x2337('0x12'));var as=require(_0x2337('0x13'));var hardwareService=require(_0x2337('0x14'));var logger=require(_0x2337('0x15'))(_0x2337('0x16'));var utils=require(_0x2337('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2337('0x18'));var db=require(_0x2337('0x19'))['db'];function respondWithStatusCode(_0xcafce3,_0x40ac2f){_0x40ac2f=_0x40ac2f||0xcc;return function(_0x5d7602){if(_0x5d7602){return _0xcafce3[_0x2337('0x1a')](_0x40ac2f);}return _0xcafce3['status'](_0x40ac2f)['end']();};}function respondWithResult(_0x305fa2,_0x528873){_0x528873=_0x528873||0xc8;return function(_0xf053a1){if(_0xf053a1){return _0x305fa2['status'](_0x528873)['json'](_0xf053a1);}};}function respondWithFilteredResult(_0x3e3ad6,_0x187efb){return function(_0x1bf56d){if(_0x1bf56d){var _0x456e7a=typeof _0x187efb[_0x2337('0x1b')]===_0x2337('0x1c')&&typeof _0x187efb['limit']===_0x2337('0x1c');var _0x480395=_0x1bf56d[_0x2337('0x1d')];var _0xe4b372=_0x456e7a?0x0:_0x187efb[_0x2337('0x1b')];var _0x49ab45=_0x456e7a?_0x1bf56d[_0x2337('0x1d')]:_0x187efb['offset']+_0x187efb['limit'];var _0x1fbca0;if(_0x49ab45>=_0x480395){_0x49ab45=_0x480395;_0x1fbca0=0xc8;}else{_0x1fbca0=0xce;}_0x3e3ad6['status'](_0x1fbca0);return _0x3e3ad6['set'](_0x2337('0x1e'),_0xe4b372+'-'+_0x49ab45+'/'+_0x480395)[_0x2337('0x1f')](_0x1bf56d);}return null;};}function patchUpdates(_0xd3a9ab){return function(_0x1434cc){try{jsonpatch[_0x2337('0x20')](_0x1434cc,_0xd3a9ab,!![]);}catch(_0x4f0ed8){return BPromise[_0x2337('0x21')](_0x4f0ed8);}return _0x1434cc[_0x2337('0x22')]();};}function saveUpdates(_0x5b6b43,_0x16cab1){return function(_0x4ded6e){if(_0x4ded6e){return _0x4ded6e[_0x2337('0x23')](_0x5b6b43)[_0x2337('0x24')](function(_0x5d9fcc){return _0x5d9fcc;});}return null;};}function removeEntity(_0x22a470,_0x2ff9dd){return function(_0x3eab5c){if(_0x3eab5c){return _0x3eab5c[_0x2337('0x25')]()[_0x2337('0x24')](function(){_0x22a470[_0x2337('0x26')](0xcc)[_0x2337('0x27')]();});}};}function handleEntityNotFound(_0x1cd87a,_0x277e7b){return function(_0x234661){if(!_0x234661){_0x1cd87a['sendStatus'](0x194);}return _0x234661;};}function handleError(_0x28c077,_0x2efa8d){_0x2efa8d=_0x2efa8d||0x1f4;return function(_0x3e62ed){logger[_0x2337('0x28')](_0x3e62ed[_0x2337('0x29')]);if(_0x3e62ed[_0x2337('0x2a')]){delete _0x3e62ed[_0x2337('0x2a')];}_0x28c077['status'](_0x2efa8d)[_0x2337('0x2b')](_0x3e62ed);};}exports['index']=function(_0x31602b,_0x5b1194){var _0x435690={},_0x7c931e={},_0x3e5d4b={'count':0x0,'rows':[]};var _0x40de60=_[_0x2337('0x2c')](db['VoiceDialReport'][_0x2337('0x2d')],function(_0x204855){return{'name':_0x204855[_0x2337('0x2e')],'type':_0x204855[_0x2337('0x2f')][_0x2337('0x30')]};});_0x7c931e[_0x2337('0x31')]=_[_0x2337('0x2c')](_0x40de60,_0x2337('0x2a'));_0x7c931e[_0x2337('0x32')]=_['keys'](_0x31602b[_0x2337('0x32')]);_0x7c931e[_0x2337('0x33')]=_[_0x2337('0x34')](_0x7c931e[_0x2337('0x31')],_0x7c931e['query']);_0x435690['attributes']=_['intersection'](_0x7c931e[_0x2337('0x31')],qs[_0x2337('0x35')](_0x31602b['query']['fields']));_0x435690[_0x2337('0x36')]=_0x435690[_0x2337('0x36')][_0x2337('0x37')]?_0x435690['attributes']:_0x7c931e[_0x2337('0x31')];if(!_0x31602b['query'][_0x2337('0x38')](_0x2337('0x39'))){_0x435690[_0x2337('0x3a')]=qs[_0x2337('0x3a')](_0x31602b[_0x2337('0x32')][_0x2337('0x3a')]);_0x435690[_0x2337('0x1b')]=qs[_0x2337('0x1b')](_0x31602b[_0x2337('0x32')][_0x2337('0x1b')]);}_0x435690[_0x2337('0x3b')]=qs['sort'](_0x31602b[_0x2337('0x32')][_0x2337('0x3c')]);_0x435690[_0x2337('0x3d')]=qs[_0x2337('0x33')](_[_0x2337('0x3e')](_0x31602b[_0x2337('0x32')],_0x7c931e['filters']),_0x40de60);if(_0x31602b[_0x2337('0x32')][_0x2337('0x3f')]){_0x435690[_0x2337('0x3d')]=_[_0x2337('0x40')](_0x435690[_0x2337('0x3d')],{'$or':_['map'](_0x40de60,function(_0x2ce1ca){if(_0x2ce1ca[_0x2337('0x2f')]!=='VIRTUAL'){var _0x39e0e7={};_0x39e0e7[_0x2ce1ca['name']]={'$like':'%'+_0x31602b[_0x2337('0x32')]['filter']+'%'};return _0x39e0e7;}})});}_0x435690=_['merge']({},_0x435690,_0x31602b['options']);var _0x47426b={'where':_0x435690['where']};return db[_0x2337('0x41')][_0x2337('0x1d')](_0x47426b)[_0x2337('0x24')](function(_0x48ea83){_0x3e5d4b[_0x2337('0x1d')]=_0x48ea83;if(_0x31602b[_0x2337('0x32')][_0x2337('0x42')]){_0x435690[_0x2337('0x43')]=[{'all':!![]}];}return db[_0x2337('0x41')]['findAll'](_0x435690);})['then'](function(_0x34397d){_0x3e5d4b[_0x2337('0x44')]=_0x34397d;return _0x3e5d4b;})['then'](respondWithFilteredResult(_0x5b1194,_0x435690))[_0x2337('0x45')](handleError(_0x5b1194,null));};exports['show']=function(_0x27c649,_0x6a7700){var _0x304bec={'raw':!![],'where':{'id':_0x27c649['params']['id']}},_0xaad6b2={};_0xaad6b2[_0x2337('0x31')]=_[_0x2337('0x46')](db[_0x2337('0x41')]['rawAttributes']);_0xaad6b2[_0x2337('0x32')]=_['keys'](_0x27c649[_0x2337('0x32')]);_0xaad6b2[_0x2337('0x33')]=_[_0x2337('0x34')](_0xaad6b2[_0x2337('0x31')],_0xaad6b2[_0x2337('0x32')]);_0x304bec[_0x2337('0x36')]=_[_0x2337('0x34')](_0xaad6b2[_0x2337('0x31')],qs[_0x2337('0x35')](_0x27c649[_0x2337('0x32')]['fields']));_0x304bec[_0x2337('0x36')]=_0x304bec[_0x2337('0x36')][_0x2337('0x37')]?_0x304bec['attributes']:_0xaad6b2[_0x2337('0x31')];if(_0x27c649[_0x2337('0x32')][_0x2337('0x42')]){_0x304bec['include']=[{'all':!![]}];}_0x304bec=_[_0x2337('0x40')]({},_0x304bec,_0x27c649[_0x2337('0x47')]);return db['VoiceDialReport'][_0x2337('0x48')](_0x304bec)[_0x2337('0x24')](handleEntityNotFound(_0x6a7700,null))[_0x2337('0x24')](respondWithResult(_0x6a7700,null))[_0x2337('0x45')](handleError(_0x6a7700,null));};exports[_0x2337('0x49')]=function(_0x3c929c,_0x18cf6e){return db[_0x2337('0x41')][_0x2337('0x49')](_0x3c929c['body'],{})['then'](respondWithResult(_0x18cf6e,0xc9))[_0x2337('0x45')](handleError(_0x18cf6e,null));};exports[_0x2337('0x23')]=function(_0x239294,_0x529cdb){if(_0x239294['body']['id']){delete _0x239294[_0x2337('0x4a')]['id'];}return db['VoiceDialReport'][_0x2337('0x48')]({'where':{'id':_0x239294[_0x2337('0x4b')]['id']}})[_0x2337('0x24')](handleEntityNotFound(_0x529cdb,null))[_0x2337('0x24')](saveUpdates(_0x239294[_0x2337('0x4a')],null))[_0x2337('0x24')](respondWithResult(_0x529cdb,null))[_0x2337('0x45')](handleError(_0x529cdb,null));};exports[_0x2337('0x25')]=function(_0x291a29,_0x51bfd8){return db[_0x2337('0x41')][_0x2337('0x48')]({'where':{'id':_0x291a29[_0x2337('0x4b')]['id']}})[_0x2337('0x24')](handleEntityNotFound(_0x51bfd8,null))[_0x2337('0x24')](removeEntity(_0x51bfd8,null))['catch'](handleError(_0x51bfd8,null));};exports[_0x2337('0x4c')]=function(_0x5817fb,_0x3e1fc2){return db[_0x2337('0x41')]['describe']()[_0x2337('0x24')](respondWithResult(_0x3e1fc2,null))[_0x2337('0x45')](handleError(_0x3e1fc2,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index f6ef7e9..b301722 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 _0x661c=['./voiceDialReport.attributes','exports','define','report_dial','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3825a1,_0x3bd010){var _0x4790d8=function(_0x38c6c7){while(--_0x38c6c7){_0x3825a1['push'](_0x3825a1['shift']());}};_0x4790d8(++_0x3bd010);}(_0x661c,0x122));var _0xc661=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x661c[_0x4e7d25];return _0x526fe6;};'use strict';var _=require(_0xc661('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc661('0x1'));var moment=require('moment');var BPromise=require(_0xc661('0x2'));var rp=require(_0xc661('0x3'));var fs=require('fs');var path=require(_0xc661('0x4'));var rimraf=require(_0xc661('0x5'));var config=require(_0xc661('0x6'));var attributes=require(_0xc661('0x7'));module[_0xc661('0x8')]=function(_0x502716,_0x4de875){return _0x502716[_0xc661('0x9')]('VoiceDialReport',attributes,{'tableName':_0xc661('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5a05=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport','report_dial','uniqueid','lodash','util'];(function(_0x563c45,_0x3da7da){var _0x83d8ab=function(_0x4c4034){while(--_0x4c4034){_0x563c45['push'](_0x563c45['shift']());}};_0x83d8ab(++_0x3da7da);}(_0x5a05,0xce));var _0x55a0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5a05[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x55a0('0x0'));var util=require(_0x55a0('0x1'));var logger=require(_0x55a0('0x2'))(_0x55a0('0x3'));var moment=require(_0x55a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x55a0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x55a0('0x6'));var config=require(_0x55a0('0x7'));var attributes=require(_0x55a0('0x8'));module[_0x55a0('0x9')]=function(_0x29ae73,_0x40fd8d){return _0x29ae73['define'](_0x55a0('0xa'),attributes,{'tableName':_0x55a0('0xb'),'paranoid':![],'indexes':[{'fields':[_0x55a0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 3c31784..c54ab18 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 _0xa594=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','stringify','UpdateVoiceDialReport','update','body','where','attributes','limit','lodash','util','randomstring','ioredis'];(function(_0x20622d,_0x3efc23){var _0x148ca5=function(_0x1d19ac){while(--_0x1d19ac){_0x20622d['push'](_0x20622d['shift']());}};_0x148ca5(++_0x3efc23);}(_0xa594,0x164));var _0x4a59=function(_0x390a19,_0x5dd137){_0x390a19=_0x390a19-0x0;var _0x5d8230=_0xa594[_0x390a19];return _0x5d8230;};'use strict';var _=require(_0x4a59('0x0'));var util=require(_0x4a59('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4a59('0x2'));var fs=require('fs');var Redis=require(_0x4a59('0x3'));var db=require(_0x4a59('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a59('0x5'))('rpc');var config=require(_0x4a59('0x6'));var jayson=require(_0x4a59('0x7'));var client=jayson['client'][_0x4a59('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x366233,_0x1919c8,_0x30957b){return new BPromise(function(_0xf2afe2,_0x1d9341){return client['request'](_0x366233,_0x30957b)[_0x4a59('0x9')](function(_0x2e1a2f){logger[_0x4a59('0xa')](_0x4a59('0xb'),_0x1919c8,'request\x20sent');logger[_0x4a59('0xc')](_0x4a59('0xd'),_0x1919c8,_0x4a59('0xe'),JSON['stringify'](_0x2e1a2f));if(_0x2e1a2f[_0x4a59('0xf')]){if(_0x2e1a2f[_0x4a59('0xf')]['code']===0x1f4){logger[_0x4a59('0xf')](_0x4a59('0xb'),_0x1919c8,_0x2e1a2f[_0x4a59('0xf')][_0x4a59('0x10')]);return _0x1d9341(_0x2e1a2f['error'][_0x4a59('0x10')]);}logger['error'](_0x4a59('0xb'),_0x1919c8,_0x2e1a2f['error'][_0x4a59('0x10')]);return _0xf2afe2(_0x2e1a2f[_0x4a59('0xf')][_0x4a59('0x10')]);}else{logger[_0x4a59('0xa')](_0x4a59('0xb'),_0x1919c8,_0x4a59('0xe'));_0xf2afe2(_0x2e1a2f['result'][_0x4a59('0x10')]);}})[_0x4a59('0x11')](function(_0x407fc9){logger[_0x4a59('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x1919c8,_0x407fc9);_0x1d9341(_0x407fc9);});});}exports[_0x4a59('0x12')]=function(_0x4d587c){var _0x523a3f=this;return new Promise(function(_0x11f593,_0x16d85a){return db[_0x4a59('0x13')][_0x4a59('0x14')](_0x4d587c['body'],{'raw':_0x4d587c[_0x4a59('0x15')]?_0x4d587c[_0x4a59('0x15')][_0x4a59('0x16')]===undefined?!![]:![]:!![]})[_0x4a59('0x9')](function(_0x450a5a){logger[_0x4a59('0xa')](_0x4a59('0x12'),_0x4d587c);logger[_0x4a59('0xc')]('CreateVoiceDialReport',_0x4d587c,JSON[_0x4a59('0x17')](_0x450a5a));_0x11f593(_0x450a5a);})[_0x4a59('0x11')](function(_0x24caf8){logger[_0x4a59('0xf')](_0x4a59('0x12'),_0x24caf8[_0x4a59('0x10')],_0x4d587c);_0x16d85a(_0x523a3f[_0x4a59('0xf')](0x1f4,_0x24caf8[_0x4a59('0x10')]));});});};exports[_0x4a59('0x18')]=function(_0xe1d463){var _0x4d1703=this;return new Promise(function(_0x5dfda8,_0x44bf0e){return db[_0x4a59('0x13')][_0x4a59('0x19')](_0xe1d463[_0x4a59('0x1a')],{'raw':_0xe1d463[_0x4a59('0x15')]?_0xe1d463[_0x4a59('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe1d463['options']?_0xe1d463[_0x4a59('0x15')][_0x4a59('0x1b')]||null:null,'attributes':_0xe1d463[_0x4a59('0x15')]?_0xe1d463[_0x4a59('0x15')][_0x4a59('0x1c')]||null:null,'limit':_0xe1d463[_0x4a59('0x15')]?_0xe1d463[_0x4a59('0x15')][_0x4a59('0x1d')]||null:null})[_0x4a59('0x9')](function(_0x2832fa){logger[_0x4a59('0xa')]('UpdateVoiceDialReport',_0xe1d463);logger[_0x4a59('0xc')](_0x4a59('0x18'),_0xe1d463,JSON['stringify'](_0x2832fa));_0x5dfda8(_0x2832fa);})[_0x4a59('0x11')](function(_0x5e4fcf){logger[_0x4a59('0xf')]('UpdateVoiceDialReport',_0x5e4fcf['message'],_0xe1d463);_0x44bf0e(_0x4d1703[_0x4a59('0xf')](0x1f4,_0x5e4fcf['message']));});});}; \ No newline at end of file +var _0x0907=['catch','CreateVoiceDialReport','create','body','options','raw','VoiceDialReport','update','where','limit','UpdateVoiceDialReport','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','VoiceDialReport,\x20%s,\x20%s','result'];(function(_0x593c9e,_0x2c3d48){var _0x53ff00=function(_0x1ef62e){while(--_0x1ef62e){_0x593c9e['push'](_0x593c9e['shift']());}};_0x53ff00(++_0x2c3d48);}(_0x0907,0x141));var _0x7090=function(_0x27cd9f,_0x473e9c){_0x27cd9f=_0x27cd9f-0x0;var _0x17857e=_0x0907[_0x27cd9f];return _0x17857e;};'use strict';var _=require(_0x7090('0x0'));var util=require(_0x7090('0x1'));var moment=require(_0x7090('0x2'));var BPromise=require('bluebird');var rs=require(_0x7090('0x3'));var fs=require('fs');var Redis=require(_0x7090('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7090('0x5'))(_0x7090('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7090('0x7')][_0x7090('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b9705,_0x185d03,_0x56de8c){return new BPromise(function(_0x4ef699,_0x33a3ac){return client[_0x7090('0x9')](_0x2b9705,_0x56de8c)[_0x7090('0xa')](function(_0x4c1c1c){logger[_0x7090('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x185d03,_0x7090('0xc'));logger[_0x7090('0xd')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x185d03,'request\x20sent',JSON[_0x7090('0xe')](_0x4c1c1c));if(_0x4c1c1c[_0x7090('0xf')]){if(_0x4c1c1c[_0x7090('0xf')][_0x7090('0x10')]===0x1f4){logger[_0x7090('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x185d03,_0x4c1c1c['error'][_0x7090('0x11')]);return _0x33a3ac(_0x4c1c1c[_0x7090('0xf')][_0x7090('0x11')]);}logger[_0x7090('0xf')](_0x7090('0x12'),_0x185d03,_0x4c1c1c[_0x7090('0xf')][_0x7090('0x11')]);return _0x4ef699(_0x4c1c1c[_0x7090('0xf')][_0x7090('0x11')]);}else{logger[_0x7090('0xb')](_0x7090('0x12'),_0x185d03,_0x7090('0xc'));_0x4ef699(_0x4c1c1c[_0x7090('0x13')][_0x7090('0x11')]);}})[_0x7090('0x14')](function(_0x2182c6){logger[_0x7090('0xf')](_0x7090('0x12'),_0x185d03,_0x2182c6);_0x33a3ac(_0x2182c6);});});}exports[_0x7090('0x15')]=function(_0x86950d){var _0x240ba8=this;return new Promise(function(_0x51c348,_0x52d026){return db['VoiceDialReport'][_0x7090('0x16')](_0x86950d[_0x7090('0x17')],{'raw':_0x86950d['options']?_0x86950d[_0x7090('0x18')][_0x7090('0x19')]===undefined?!![]:![]:!![]})[_0x7090('0xa')](function(_0x489903){logger['info'](_0x7090('0x15'),_0x86950d);logger[_0x7090('0xd')]('CreateVoiceDialReport',_0x86950d,JSON[_0x7090('0xe')](_0x489903));_0x51c348(_0x489903);})[_0x7090('0x14')](function(_0x27eade){logger['error']('CreateVoiceDialReport',_0x27eade['message'],_0x86950d);_0x52d026(_0x240ba8['error'](0x1f4,_0x27eade[_0x7090('0x11')]));});});};exports['UpdateVoiceDialReport']=function(_0x1bd995){var _0x359805=this;return new Promise(function(_0x294f3e,_0x2126a9){return db[_0x7090('0x1a')][_0x7090('0x1b')](_0x1bd995[_0x7090('0x17')],{'raw':_0x1bd995[_0x7090('0x18')]?_0x1bd995[_0x7090('0x18')][_0x7090('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bd995[_0x7090('0x18')]?_0x1bd995['options'][_0x7090('0x1c')]||null:null,'attributes':_0x1bd995['options']?_0x1bd995[_0x7090('0x18')]['attributes']||null:null,'limit':_0x1bd995['options']?_0x1bd995[_0x7090('0x18')][_0x7090('0x1d')]||null:null})[_0x7090('0xa')](function(_0x52e37d){logger[_0x7090('0xb')](_0x7090('0x1e'),_0x1bd995);logger['debug']('UpdateVoiceDialReport',_0x1bd995,JSON[_0x7090('0xe')](_0x52e37d));_0x294f3e(_0x52e37d);})[_0x7090('0x14')](function(_0x1b418e){logger[_0x7090('0xf')](_0x7090('0x1e'),_0x1b418e[_0x7090('0x11')],_0x1bd995);_0x2126a9(_0x359805['error'](0x1f4,_0x1b418e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 656b4fe..6e563c2 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 _0xbba3=['get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller'];(function(_0xa62163,_0x4a26fb){var _0x46b4fb=function(_0x3a1382){while(--_0x3a1382){_0xa62163['push'](_0xa62163['shift']());}};_0x46b4fb(++_0x4a26fb);}(_0xbba3,0x1ad));var _0x3bba=function(_0x2db7ae,_0x45f4d7){_0x2db7ae=_0x2db7ae-0x0;var _0x237b4a=_0xbba3[_0x2db7ae];return _0x237b4a;};'use strict';var multer=require(_0x3bba('0x0'));var util=require(_0x3bba('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3bba('0x2'));var router=express[_0x3bba('0x3')]();var fs_extra=require(_0x3bba('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3bba('0x5'));var config=require(_0x3bba('0x6'));var controller=require(_0x3bba('0x7'));router[_0x3bba('0x8')]('/',auth[_0x3bba('0x9')](),controller[_0x3bba('0xa')]);router[_0x3bba('0x8')]('/:id',auth[_0x3bba('0x9')](),controller[_0x3bba('0xb')]);router[_0x3bba('0xc')]('/',auth[_0x3bba('0x9')](),controller[_0x3bba('0xd')]);router[_0x3bba('0xc')]('/:id/applications',auth[_0x3bba('0x9')](),controller['addApplications']);router[_0x3bba('0xe')](_0x3bba('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x3bba('0x10')](_0x3bba('0xf'),auth[_0x3bba('0x9')](),controller[_0x3bba('0x11')]);module[_0x3bba('0x12')]=router; \ No newline at end of file +var _0x0fdf=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','put','update','delete'];(function(_0x518fd9,_0x1edc83){var _0x1027a3=function(_0x313205){while(--_0x313205){_0x518fd9['push'](_0x518fd9['shift']());}};_0x1027a3(++_0x1edc83);}(_0x0fdf,0xa3));var _0xf0fd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0fdf[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xf0fd('0x0'));var util=require(_0xf0fd('0x1'));var path=require(_0xf0fd('0x2'));var timeout=require(_0xf0fd('0x3'));var express=require(_0xf0fd('0x4'));var router=express[_0xf0fd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf0fd('0x6'));var interaction=require(_0xf0fd('0x7'));var config=require(_0xf0fd('0x8'));var controller=require(_0xf0fd('0x9'));router[_0xf0fd('0xa')]('/',auth[_0xf0fd('0xb')](),controller[_0xf0fd('0xc')]);router['get'](_0xf0fd('0xd'),auth[_0xf0fd('0xb')](),controller[_0xf0fd('0xe')]);router[_0xf0fd('0xf')]('/',auth[_0xf0fd('0xb')](),controller[_0xf0fd('0x10')]);router[_0xf0fd('0xf')](_0xf0fd('0x11'),auth[_0xf0fd('0xb')](),controller['addApplications']);router[_0xf0fd('0x12')](_0xf0fd('0xd'),auth[_0xf0fd('0xb')](),controller[_0xf0fd('0x13')]);router[_0xf0fd('0x14')](_0xf0fd('0xd'),auth[_0xf0fd('0xb')](),controller[_0xf0fd('0x15')]);module[_0xf0fd('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 72c95ab..3642410 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 _0xbaf0=['outbound','internal','inbound-fax','system','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue','exten','exports','STRING','compositeIndex','NoOp','ENUM','inbound'];(function(_0x1122ad,_0x2cb1db){var _0x4e7e9d=function(_0x1156c0){while(--_0x1156c0){_0x1122ad['push'](_0x1122ad['shift']());}};_0x4e7e9d(++_0x2cb1db);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'context':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'priority':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':_0x0baf('0x3')},'appdata':{'type':Sequelize[_0x0baf('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0baf('0x4')](_0x0baf('0x5'),_0x0baf('0x6'),_0x0baf('0x7'),_0x0baf('0x8'),'outbound-fax',_0x0baf('0x9'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x0baf('0x1')]},'interval':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':_0x0baf('0xa')},'IntervalId':{'type':Sequelize[_0x0baf('0xb')]},'isApp':{'type':Sequelize[_0x0baf('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0baf('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x0baf('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0baf('0xb')]},'recordingFormat':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0baf('0xe')](_0x0baf('0xf'));}}}; \ No newline at end of file +var _0xcb91=['outbound','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','STRING','compositeIndex','NoOp','inbound'];(function(_0x526d7b,_0x41dd8){var _0x4c8f40=function(_0xfcfd73){while(--_0xfcfd73){_0x526d7b['push'](_0x526d7b['shift']());}};_0x4c8f40(++_0x41dd8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xa28b1a,_0x384f4b){_0xa28b1a=_0xa28b1a-0x0;var _0x4c9b78=_0xcb91[_0xa28b1a];return _0x4c9b78;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':![],'unique':_0x1cb9('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':![],'unique':_0x1cb9('0x1')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x1cb9('0x1')},'tag':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1cb9('0x2')},'appdata':{'type':Sequelize[_0x1cb9('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x1cb9('0x3'),_0x1cb9('0x4'),'internal',_0x1cb9('0x5'),_0x1cb9('0x6'),'system',_0x1cb9('0x7')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1cb9('0x8')},'IntervalId':{'type':Sequelize[_0x1cb9('0x9')]},'isApp':{'type':Sequelize[_0x1cb9('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x1cb9('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x1cb9('0x9')]},'recordingFormat':{'type':Sequelize[_0x1cb9('0x0')],'defaultValue':_0x1cb9('0xb')},'answer':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0x1cb9('0xc')],'get':function(){return this['getDataValue']('exten');}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 65735e1..7343017 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 _0xdf4d=['body','startsWith','exten','concat','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','isApp','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','find','type','name','error','stack','send','index','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','options','VoiceExtension','includeAll','findAll','rows','show','params','rawAttributes','include','catch'];(function(_0xb417ec,_0x3f44bf){var _0x4c9f05=function(_0x55191c){while(--_0x55191c){_0xb417ec['push'](_0xb417ec['shift']());}};_0x4c9f05(++_0x3f44bf);}(_0xdf4d,0x196));var _0xddf4=function(_0x2570d5,_0x245234){_0x2570d5=_0x2570d5-0x0;var _0x1f5863=_0xdf4d[_0x2570d5];return _0x1f5863;};'use strict';var _=require(_0xddf4('0x0'));var Redis=require(_0xddf4('0x1'));var qs=require(_0xddf4('0x2'));var logger=require(_0xddf4('0x3'))('api');var config=require('../../config/environment');var db=require(_0xddf4('0x4'))['db'];config[_0xddf4('0x5')]=_['defaults'](config[_0xddf4('0x5')],{'host':_0xddf4('0x6'),'port':0x18eb});var socket=require(_0xddf4('0x7'))(new Redis(config[_0xddf4('0x5')]));require(_0xddf4('0x8'))[_0xddf4('0x9')](socket);function respondWithStatusCode(_0x524f56,_0x324564){_0x324564=_0x324564||0xcc;return function(_0x17d8bd){if(_0x17d8bd){return _0x524f56[_0xddf4('0xa')](_0x324564);}return _0x524f56['status'](_0x324564)[_0xddf4('0xb')]();};}function respondWithResult(_0x5e7417,_0x43c334){_0x43c334=_0x43c334||0xc8;return function(_0x1990fc){if(_0x1990fc){return _0x5e7417[_0xddf4('0xc')](_0x43c334)[_0xddf4('0xd')](_0x1990fc);}};}function respondWithFilteredResult(_0x168483,_0x6e4f64){return function(_0x1e263d){if(_0x1e263d){var _0x423cad=typeof _0x6e4f64['offset']===_0xddf4('0xe')&&typeof _0x6e4f64[_0xddf4('0xf')]===_0xddf4('0xe');var _0x4d63e5=_0x1e263d[_0xddf4('0x10')];var _0x38dd0d=_0x423cad?0x0:_0x6e4f64['offset'];var _0x300063=_0x423cad?_0x1e263d[_0xddf4('0x10')]:_0x6e4f64[_0xddf4('0x11')]+_0x6e4f64['limit'];var _0x5f31b5;if(_0x300063>=_0x4d63e5){_0x300063=_0x4d63e5;_0x5f31b5=0xc8;}else{_0x5f31b5=0xce;}_0x168483[_0xddf4('0xc')](_0x5f31b5);return _0x168483['set']('Content-Range',_0x38dd0d+'-'+_0x300063+'/'+_0x4d63e5)[_0xddf4('0xd')](_0x1e263d);}return null;};}function removeEntity(_0x41fe15){return function(_0x3709d6){if(_0x3709d6){return _0x3709d6[_0xddf4('0x12')]()[_0xddf4('0x13')](function(){var _0x22ec49=_0x3709d6[_0xddf4('0x14')]({'plain':!![]});var _0x1b1ab2=[{'name':_0xddf4('0x15'),'value':_0xddf4('0x16'),'ignore':![]},{'name':_0xddf4('0x17'),'value':_0xddf4('0x18'),'ignore':![]},{'name':_0xddf4('0x19'),'value':_0xddf4('0x1a'),'ignore':![]}];var _0x5b6142=_(_0x1b1ab2)[_0xddf4('0x1b')](_0xddf4('0x1c'))[_0xddf4('0x1d')]('value')[_0xddf4('0x1e')]();if(_['includes'](_0x5b6142,_0x22ec49['type'])){return;}var _0x352bd9=_[_0xddf4('0x1f')](_0x1b1ab2,['value',_0x22ec49[_0xddf4('0x20')]])[_0xddf4('0x21')];return db['UserProfileResource'][_0xddf4('0x12')]({'where':{'type':_0x352bd9,'resourceId':_0x22ec49['id']}})[_0xddf4('0x13')](function(){return _0x3709d6;});})[_0xddf4('0x13')](function(){_0x41fe15[_0xddf4('0xc')](0xcc)[_0xddf4('0xb')]();});}};}function handleEntityNotFound(_0x27bea7){return function(_0x5b879d){if(!_0x5b879d){_0x27bea7[_0xddf4('0xa')](0x194);}return _0x5b879d;};}function handleError(_0x1f2614,_0x244bb5){_0x244bb5=_0x244bb5||0x1f4;return function(_0x2fc631){logger[_0xddf4('0x22')](_0x2fc631[_0xddf4('0x23')]);if(_0x2fc631[_0xddf4('0x21')]){delete _0x2fc631[_0xddf4('0x21')];}_0x1f2614[_0xddf4('0xc')](_0x244bb5)[_0xddf4('0x24')](_0x2fc631);};}exports[_0xddf4('0x25')]=function(_0x14ab0f,_0x2c6f36){var _0x24f1d0={},_0x5405b9={},_0xb63fec={'count':0x0,'rows':[]};var _0x41888f=_[_0xddf4('0x1d')](db['VoiceExtension']['rawAttributes'],function(_0x54e5b8){return{'name':_0x54e5b8[_0xddf4('0x26')],'type':_0x54e5b8[_0xddf4('0x20')][_0xddf4('0x27')]};});_0x5405b9[_0xddf4('0x28')]=_[_0xddf4('0x1d')](_0x41888f,'name');_0x5405b9[_0xddf4('0x29')]=_[_0xddf4('0x2a')](_0x14ab0f[_0xddf4('0x29')]);_0x5405b9[_0xddf4('0x2b')]=_[_0xddf4('0x2c')](_0x5405b9[_0xddf4('0x28')],_0x5405b9[_0xddf4('0x29')]);_0x24f1d0[_0xddf4('0x2d')]=_[_0xddf4('0x2c')](_0x5405b9['model'],qs[_0xddf4('0x2e')](_0x14ab0f[_0xddf4('0x29')][_0xddf4('0x2e')]));_0x24f1d0[_0xddf4('0x2d')]=_0x24f1d0[_0xddf4('0x2d')][_0xddf4('0x2f')]?_0x24f1d0[_0xddf4('0x2d')]:_0x5405b9[_0xddf4('0x28')];if(!_0x14ab0f[_0xddf4('0x29')]['hasOwnProperty'](_0xddf4('0x30'))){_0x24f1d0['limit']=qs[_0xddf4('0xf')](_0x14ab0f[_0xddf4('0x29')][_0xddf4('0xf')]);_0x24f1d0['offset']=qs[_0xddf4('0x11')](_0x14ab0f[_0xddf4('0x29')][_0xddf4('0x11')]);}_0x24f1d0[_0xddf4('0x31')]=qs[_0xddf4('0x32')](_0x14ab0f[_0xddf4('0x29')][_0xddf4('0x32')]);_0x24f1d0[_0xddf4('0x33')]=qs[_0xddf4('0x2b')](_['pick'](_0x14ab0f[_0xddf4('0x29')],_0x5405b9['filters']),_0x41888f);if(_0x14ab0f['query']['filter']){_0x24f1d0[_0xddf4('0x33')]=_[_0xddf4('0x34')](_0x24f1d0[_0xddf4('0x33')],{'$or':_['map'](_0x41888f,function(_0x1e68c9){if(_0x1e68c9[_0xddf4('0x20')]!==_0xddf4('0x35')){var _0x143d04={};_0x143d04[_0x1e68c9['name']]={'$like':'%'+_0x14ab0f[_0xddf4('0x29')][_0xddf4('0x1b')]+'%'};return _0x143d04;}})});}_0x24f1d0=_['merge']({},_0x24f1d0,_0x14ab0f[_0xddf4('0x36')]);var _0x4d05ba={'where':_0x24f1d0[_0xddf4('0x33')]};return db[_0xddf4('0x37')][_0xddf4('0x10')](_0x4d05ba)[_0xddf4('0x13')](function(_0x24bedf){_0xb63fec[_0xddf4('0x10')]=_0x24bedf;if(_0x14ab0f[_0xddf4('0x29')][_0xddf4('0x38')]){_0x24f1d0['include']=[{'all':!![]}];}return db[_0xddf4('0x37')][_0xddf4('0x39')](_0x24f1d0);})['then'](function(_0x683d6d){_0xb63fec[_0xddf4('0x3a')]=_0x683d6d;return _0xb63fec;})[_0xddf4('0x13')](respondWithFilteredResult(_0x2c6f36,_0x24f1d0))['catch'](handleError(_0x2c6f36,null));};exports[_0xddf4('0x3b')]=function(_0x31556b,_0x1fdb9d){var _0x724e0c={'raw':![],'where':{'id':_0x31556b[_0xddf4('0x3c')]['id']}},_0xac7323={};_0xac7323[_0xddf4('0x28')]=_['keys'](db[_0xddf4('0x37')][_0xddf4('0x3d')]);_0xac7323['query']=_[_0xddf4('0x2a')](_0x31556b[_0xddf4('0x29')]);_0xac7323[_0xddf4('0x2b')]=_[_0xddf4('0x2c')](_0xac7323[_0xddf4('0x28')],_0xac7323[_0xddf4('0x29')]);_0x724e0c[_0xddf4('0x2d')]=_[_0xddf4('0x2c')](_0xac7323[_0xddf4('0x28')],qs[_0xddf4('0x2e')](_0x31556b['query'][_0xddf4('0x2e')]));_0x724e0c[_0xddf4('0x2d')]=_0x724e0c[_0xddf4('0x2d')][_0xddf4('0x2f')]?_0x724e0c[_0xddf4('0x2d')]:_0xac7323[_0xddf4('0x28')];if(_0x31556b[_0xddf4('0x29')][_0xddf4('0x38')]){_0x724e0c[_0xddf4('0x3e')]=[{'all':!![]}];}_0x724e0c=_['merge']({},_0x724e0c,_0x31556b[_0xddf4('0x36')]);return db[_0xddf4('0x37')][_0xddf4('0x1f')](_0x724e0c)['then'](handleEntityNotFound(_0x1fdb9d,null))[_0xddf4('0x13')](respondWithResult(_0x1fdb9d,null))[_0xddf4('0x3f')](handleError(_0x1fdb9d,null));};exports[_0xddf4('0x12')]=function(_0x22846c,_0x19b371){return db[_0xddf4('0x37')]['find']({'where':{'id':_0x22846c[_0xddf4('0x3c')]['id']}})[_0xddf4('0x13')](handleEntityNotFound(_0x19b371,null))['then'](removeEntity(_0x19b371,null))['catch'](handleError(_0x19b371,null));};exports['create']=function(_0x39d757,_0x325082){if(_0x39d757[_0xddf4('0x40')][_0xddf4('0x20')]===_0xddf4('0x18')&&!_[_0xddf4('0x41')](_0x39d757[_0xddf4('0x40')][_0xddf4('0x42')],'_')){_0x39d757[_0xddf4('0x40')][_0xddf4('0x42')]='_'[_0xddf4('0x43')](_0x39d757[_0xddf4('0x40')]['exten']);}return db['VoiceExtension'][_0xddf4('0x44')](_0x39d757[_0xddf4('0x40')],{'raw':![]})['then'](function(_0x5121d9){var _0x3e8ad7=_0x39d757[_0xddf4('0x45')][_0xddf4('0x14')]({'plain':!![]});if(!_0x3e8ad7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e8ad7[_0xddf4('0x46')]===_0xddf4('0x45')){var _0x41e1e2=_0x5121d9[_0xddf4('0x14')]({'plain':!![]});var _0x28d855=[{'name':_0xddf4('0x15'),'value':_0xddf4('0x16')},{'name':_0xddf4('0x17'),'value':_0xddf4('0x18')},{'name':_0xddf4('0x19'),'value':_0xddf4('0x1a')}];var _0x586b0c=_[_0xddf4('0x1f')](_0x28d855,[_0xddf4('0x1e'),_0x41e1e2[_0xddf4('0x20')]])[_0xddf4('0x21')];return db[_0xddf4('0x47')]['find']({'where':{'name':_0x586b0c,'userProfileId':_0x3e8ad7[_0xddf4('0x48')]},'raw':!![]})[_0xddf4('0x13')](function(_0x5e6304){if(_0x5e6304&&_0x5e6304[_0xddf4('0x49')]===0x0){return db[_0xddf4('0x4a')][_0xddf4('0x44')]({'name':_0x41e1e2[_0xddf4('0x21')],'resourceId':_0x41e1e2['id'],'type':_0x5e6304[_0xddf4('0x21')],'sectionId':_0x5e6304['id']},{})['then'](function(){return _0x5121d9;});}else{return _0x5121d9;}})[_0xddf4('0x3f')](function(_0xf7c010){logger[_0xddf4('0x22')](_0xddf4('0x4b'),_0xf7c010);throw _0xf7c010;});}return _0x5121d9;})[_0xddf4('0x13')](respondWithResult(_0x325082,0xc9))['catch'](handleError(_0x325082,null));};exports[_0xddf4('0x4c')]=function(_0x18101b,_0x59780d){if(_0x18101b['body']['id']){delete _0x18101b[_0xddf4('0x40')]['id'];}return db['VoiceExtension'][_0xddf4('0x1f')]({'where':{'id':_0x18101b[_0xddf4('0x3c')]['id']}})[_0xddf4('0x13')](handleEntityNotFound(_0x59780d,null))[_0xddf4('0x13')](function(_0x4a6c32){if(_0x4a6c32){return db[_0xddf4('0x37')][_0xddf4('0x4c')](_[_0xddf4('0x4d')](_0x18101b[_0xddf4('0x40')],[_0xddf4('0x42'),_0xddf4('0x4e'),_0xddf4('0x4f'),_0xddf4('0x50'),_0xddf4('0x51'),_0xddf4('0x52'),_0xddf4('0x53')]),{'where':{'context':_0x4a6c32[_0xddf4('0x4e')],'exten':_0x4a6c32[_0xddf4('0x42')]},'individualHooks':!![]})[_0xddf4('0x13')](function(_0x14c721){return _0x14c721;});}return null;})['then'](respondWithStatusCode(_0x59780d,null))[_0xddf4('0x3f')](handleError(_0x59780d,null));};exports['addApplications']=function(_0x34b3f7,_0x31e0a0){var _0x7d3b88=_0x34b3f7['params']['id'];var _0x2d0243=_0x34b3f7[_0xddf4('0x40')];var _0x1a7f4e=0xc8;var _0x10b400=null;return db[_0xddf4('0x54')]['transaction']({'isolationLevel':db['sequelize'][_0xddf4('0x55')][_0xddf4('0x56')][_0xddf4('0x57')]},function(_0x4a80f1){return db['VoiceExtension'][_0xddf4('0x58')]({'where':{'id':_0x7d3b88},'transaction':_0x4a80f1})['then'](function(_0x12ebc0){if(_0x12ebc0){return db['VoiceExtension'][_0xddf4('0x12')]({'where':{'VoiceExtensionId':_0x7d3b88},'transaction':_0x4a80f1})['then'](function(){var _0x2fb3ed=_['map'](_0x2d0243,function(_0x578bd6){_0x578bd6['VoiceExtensionId']=_0x7d3b88;_0x578bd6[_0xddf4('0x59')]=!![];return _0x578bd6;});return _0x12ebc0[_0xddf4('0x5a')](_0x2fb3ed);})[_0xddf4('0x13')](function(_0x2206cb){return db[_0xddf4('0x37')][_0xddf4('0x5b')](_0x2206cb,{'transaction':_0x4a80f1});});}else{_0x1a7f4e=0x194;_0x10b400=[];}});})['then'](function(){if(_0x1a7f4e!==0x194){return db[_0xddf4('0x37')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x7d3b88},'order':_0xddf4('0x5c')})[_0xddf4('0x13')](function(_0x51b33a){_0x10b400=_0x51b33a;});}})[_0xddf4('0x3f')](function(_0xc88dfb){_0x1a7f4e=0x1f4;logger[_0xddf4('0x22')](_0xc88dfb[_0xddf4('0x23')]);if(_0xc88dfb[_0xddf4('0x21')]){delete _0xc88dfb[_0xddf4('0x21')];}_0x10b400=_0xc88dfb;})[_0xddf4('0x5d')](function(){if(_0x10b400===null){_0x31e0a0[_0xddf4('0xa')](_0x1a7f4e);}else{if(_0x1a7f4e===0x1f4){_0x31e0a0[_0xddf4('0xc')](_0x1a7f4e)[_0xddf4('0x24')](_0x10b400);}else{_0x31e0a0[_0xddf4('0xc')](_0x1a7f4e)[_0xddf4('0xd')](_0x10b400);}}});}; \ No newline at end of file +var _0xef4c=['then','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','find','type','name','UserProfileResource','end','error','stack','send','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','VoiceExtension','include','findAll','rows','params','includeAll','options','create','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','context','description','recordingFormat','cutdigits','addApplications','transaction','sequelize','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','api','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','sendStatus','status','json','offset','limit','undefined','count','Content-Range','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef4c,0x1b2));var _0xcef4=function(_0xb29a4e,_0x3bc5dd){_0xb29a4e=_0xb29a4e-0x0;var _0x5eeb86=_0xef4c[_0xb29a4e];return _0x5eeb86;};'use strict';var _=require(_0xcef4('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xcef4('0x1'));var config=require('../../config/environment');var db=require(_0xcef4('0x2'))['db'];config[_0xcef4('0x3')]=_[_0xcef4('0x4')](config[_0xcef4('0x3')],{'host':'localhost','port':0x18eb});var socket=require(_0xcef4('0x5'))(new Redis(config[_0xcef4('0x3')]));require(_0xcef4('0x6'))['register'](socket);function respondWithStatusCode(_0x30a77d,_0x55161d){_0x55161d=_0x55161d||0xcc;return function(_0x3fed06){if(_0x3fed06){return _0x30a77d[_0xcef4('0x7')](_0x55161d);}return _0x30a77d[_0xcef4('0x8')](_0x55161d)['end']();};}function respondWithResult(_0xbc6c80,_0x556a9d){_0x556a9d=_0x556a9d||0xc8;return function(_0xf06f74){if(_0xf06f74){return _0xbc6c80['status'](_0x556a9d)[_0xcef4('0x9')](_0xf06f74);}};}function respondWithFilteredResult(_0x59dab9,_0x24aef6){return function(_0x472d59){if(_0x472d59){var _0x250c80=typeof _0x24aef6[_0xcef4('0xa')]==='undefined'&&typeof _0x24aef6[_0xcef4('0xb')]===_0xcef4('0xc');var _0x44a2dc=_0x472d59[_0xcef4('0xd')];var _0x735106=_0x250c80?0x0:_0x24aef6[_0xcef4('0xa')];var _0x56a3e6=_0x250c80?_0x472d59[_0xcef4('0xd')]:_0x24aef6[_0xcef4('0xa')]+_0x24aef6[_0xcef4('0xb')];var _0x479e59;if(_0x56a3e6>=_0x44a2dc){_0x56a3e6=_0x44a2dc;_0x479e59=0xc8;}else{_0x479e59=0xce;}_0x59dab9[_0xcef4('0x8')](_0x479e59);return _0x59dab9['set'](_0xcef4('0xe'),_0x735106+'-'+_0x56a3e6+'/'+_0x44a2dc)[_0xcef4('0x9')](_0x472d59);}return null;};}function removeEntity(_0x3a6494){return function(_0x2602e7){if(_0x2602e7){return _0x2602e7[_0xcef4('0xf')]()[_0xcef4('0x10')](function(){var _0x5ae255=_0x2602e7[_0xcef4('0x11')]({'plain':!![]});var _0x1d3c58=[{'name':'InboundRoutes','value':_0xcef4('0x12'),'ignore':![]},{'name':_0xcef4('0x13'),'value':_0xcef4('0x14'),'ignore':![]},{'name':_0xcef4('0x15'),'value':_0xcef4('0x16'),'ignore':![]}];var _0xdbf805=_(_0x1d3c58)['filter'](_0xcef4('0x17'))[_0xcef4('0x18')](_0xcef4('0x19'))['value']();if(_[_0xcef4('0x1a')](_0xdbf805,_0x5ae255['type'])){return;}var _0x2f45da=_[_0xcef4('0x1b')](_0x1d3c58,['value',_0x5ae255[_0xcef4('0x1c')]])[_0xcef4('0x1d')];return db[_0xcef4('0x1e')][_0xcef4('0xf')]({'where':{'type':_0x2f45da,'resourceId':_0x5ae255['id']}})[_0xcef4('0x10')](function(){return _0x2602e7;});})[_0xcef4('0x10')](function(){_0x3a6494[_0xcef4('0x8')](0xcc)[_0xcef4('0x1f')]();});}};}function handleEntityNotFound(_0x1fb82b){return function(_0x3730e9){if(!_0x3730e9){_0x1fb82b[_0xcef4('0x7')](0x194);}return _0x3730e9;};}function handleError(_0x5cd254,_0x56c1f2){_0x56c1f2=_0x56c1f2||0x1f4;return function(_0x247cf1){logger[_0xcef4('0x20')](_0x247cf1[_0xcef4('0x21')]);if(_0x247cf1[_0xcef4('0x1d')]){delete _0x247cf1[_0xcef4('0x1d')];}_0x5cd254['status'](_0x56c1f2)[_0xcef4('0x22')](_0x247cf1);};}exports['index']=function(_0x14bbcd,_0x2601dc){var _0x2697e4={},_0x43728c={},_0x1c7f2a={'count':0x0,'rows':[]};var _0x373bc2=_[_0xcef4('0x18')](db['VoiceExtension'][_0xcef4('0x23')],function(_0x36d8a6){return{'name':_0x36d8a6[_0xcef4('0x24')],'type':_0x36d8a6[_0xcef4('0x1c')][_0xcef4('0x25')]};});_0x43728c[_0xcef4('0x26')]=_[_0xcef4('0x18')](_0x373bc2,'name');_0x43728c[_0xcef4('0x27')]=_[_0xcef4('0x28')](_0x14bbcd[_0xcef4('0x27')]);_0x43728c[_0xcef4('0x29')]=_[_0xcef4('0x2a')](_0x43728c['model'],_0x43728c[_0xcef4('0x27')]);_0x2697e4[_0xcef4('0x2b')]=_[_0xcef4('0x2a')](_0x43728c[_0xcef4('0x26')],qs[_0xcef4('0x2c')](_0x14bbcd['query'][_0xcef4('0x2c')]));_0x2697e4[_0xcef4('0x2b')]=_0x2697e4[_0xcef4('0x2b')][_0xcef4('0x2d')]?_0x2697e4[_0xcef4('0x2b')]:_0x43728c[_0xcef4('0x26')];if(!_0x14bbcd[_0xcef4('0x27')]['hasOwnProperty'](_0xcef4('0x2e'))){_0x2697e4[_0xcef4('0xb')]=qs[_0xcef4('0xb')](_0x14bbcd[_0xcef4('0x27')][_0xcef4('0xb')]);_0x2697e4['offset']=qs[_0xcef4('0xa')](_0x14bbcd[_0xcef4('0x27')]['offset']);}_0x2697e4[_0xcef4('0x2f')]=qs[_0xcef4('0x30')](_0x14bbcd['query'][_0xcef4('0x30')]);_0x2697e4[_0xcef4('0x31')]=qs[_0xcef4('0x29')](_[_0xcef4('0x32')](_0x14bbcd['query'],_0x43728c[_0xcef4('0x29')]),_0x373bc2);if(_0x14bbcd[_0xcef4('0x27')]['filter']){_0x2697e4[_0xcef4('0x31')]=_[_0xcef4('0x33')](_0x2697e4[_0xcef4('0x31')],{'$or':_[_0xcef4('0x18')](_0x373bc2,function(_0x5f401e){if(_0x5f401e[_0xcef4('0x1c')]!==_0xcef4('0x34')){var _0x432eb3={};_0x432eb3[_0x5f401e[_0xcef4('0x1d')]]={'$like':'%'+_0x14bbcd[_0xcef4('0x27')][_0xcef4('0x35')]+'%'};return _0x432eb3;}})});}_0x2697e4=_['merge']({},_0x2697e4,_0x14bbcd['options']);var _0x22797c={'where':_0x2697e4[_0xcef4('0x31')]};return db[_0xcef4('0x36')][_0xcef4('0xd')](_0x22797c)[_0xcef4('0x10')](function(_0x465a5c){_0x1c7f2a['count']=_0x465a5c;if(_0x14bbcd[_0xcef4('0x27')]['includeAll']){_0x2697e4[_0xcef4('0x37')]=[{'all':!![]}];}return db[_0xcef4('0x36')][_0xcef4('0x38')](_0x2697e4);})[_0xcef4('0x10')](function(_0x1aee25){_0x1c7f2a[_0xcef4('0x39')]=_0x1aee25;return _0x1c7f2a;})['then'](respondWithFilteredResult(_0x2601dc,_0x2697e4))['catch'](handleError(_0x2601dc,null));};exports['show']=function(_0x2c3757,_0xd9f06c){var _0x163a5a={'raw':![],'where':{'id':_0x2c3757[_0xcef4('0x3a')]['id']}},_0x5700b7={};_0x5700b7[_0xcef4('0x26')]=_[_0xcef4('0x28')](db['VoiceExtension']['rawAttributes']);_0x5700b7['query']=_[_0xcef4('0x28')](_0x2c3757[_0xcef4('0x27')]);_0x5700b7[_0xcef4('0x29')]=_['intersection'](_0x5700b7[_0xcef4('0x26')],_0x5700b7[_0xcef4('0x27')]);_0x163a5a[_0xcef4('0x2b')]=_[_0xcef4('0x2a')](_0x5700b7[_0xcef4('0x26')],qs['fields'](_0x2c3757[_0xcef4('0x27')][_0xcef4('0x2c')]));_0x163a5a[_0xcef4('0x2b')]=_0x163a5a[_0xcef4('0x2b')]['length']?_0x163a5a['attributes']:_0x5700b7[_0xcef4('0x26')];if(_0x2c3757[_0xcef4('0x27')][_0xcef4('0x3b')]){_0x163a5a[_0xcef4('0x37')]=[{'all':!![]}];}_0x163a5a=_[_0xcef4('0x33')]({},_0x163a5a,_0x2c3757[_0xcef4('0x3c')]);return db['VoiceExtension'][_0xcef4('0x1b')](_0x163a5a)['then'](handleEntityNotFound(_0xd9f06c,null))[_0xcef4('0x10')](respondWithResult(_0xd9f06c,null))['catch'](handleError(_0xd9f06c,null));};exports[_0xcef4('0xf')]=function(_0x36fdbb,_0x2dd81b){return db['VoiceExtension'][_0xcef4('0x1b')]({'where':{'id':_0x36fdbb[_0xcef4('0x3a')]['id']}})[_0xcef4('0x10')](handleEntityNotFound(_0x2dd81b,null))[_0xcef4('0x10')](removeEntity(_0x2dd81b,null))['catch'](handleError(_0x2dd81b,null));};exports[_0xcef4('0x3d')]=function(_0x43c61f,_0x3396b4){if(_0x43c61f['body']['type']===_0xcef4('0x14')&&!_[_0xcef4('0x3e')](_0x43c61f[_0xcef4('0x3f')][_0xcef4('0x40')],'_')){_0x43c61f[_0xcef4('0x3f')][_0xcef4('0x40')]='_'[_0xcef4('0x41')](_0x43c61f['body']['exten']);}return db[_0xcef4('0x36')][_0xcef4('0x3d')](_0x43c61f[_0xcef4('0x3f')],{'raw':![]})['then'](function(_0x3df593){var _0x34d11e=_0x43c61f[_0xcef4('0x42')][_0xcef4('0x11')]({'plain':!![]});if(!_0x34d11e)throw new Error(_0xcef4('0x43'));if(_0x34d11e[_0xcef4('0x44')]===_0xcef4('0x42')){var _0x511768=_0x3df593[_0xcef4('0x11')]({'plain':!![]});var _0x5be13f=[{'name':_0xcef4('0x45'),'value':_0xcef4('0x12')},{'name':_0xcef4('0x13'),'value':_0xcef4('0x14')},{'name':'InternalRoutes','value':_0xcef4('0x16')}];var _0x49b714=_[_0xcef4('0x1b')](_0x5be13f,[_0xcef4('0x19'),_0x511768[_0xcef4('0x1c')]])[_0xcef4('0x1d')];return db['UserProfileSection'][_0xcef4('0x1b')]({'where':{'name':_0x49b714,'userProfileId':_0x34d11e[_0xcef4('0x46')]},'raw':!![]})[_0xcef4('0x10')](function(_0x4b4bc1){if(_0x4b4bc1&&_0x4b4bc1[_0xcef4('0x47')]===0x0){return db[_0xcef4('0x1e')][_0xcef4('0x3d')]({'name':_0x511768[_0xcef4('0x1d')],'resourceId':_0x511768['id'],'type':_0x4b4bc1[_0xcef4('0x1d')],'sectionId':_0x4b4bc1['id']},{})[_0xcef4('0x10')](function(){return _0x3df593;});}else{return _0x3df593;}})['catch'](function(_0x249109){logger[_0xcef4('0x20')](_0xcef4('0x48'),_0x249109);throw _0x249109;});}return _0x3df593;})['then'](respondWithResult(_0x3396b4,0xc9))[_0xcef4('0x49')](handleError(_0x3396b4,null));};exports[_0xcef4('0x4a')]=function(_0x203872,_0x48b77f){if(_0x203872[_0xcef4('0x3f')]['id']){delete _0x203872['body']['id'];}return db[_0xcef4('0x36')][_0xcef4('0x1b')]({'where':{'id':_0x203872[_0xcef4('0x3a')]['id']}})[_0xcef4('0x10')](handleEntityNotFound(_0x48b77f,null))['then'](function(_0x17fbc8){if(_0x17fbc8){return db[_0xcef4('0x36')][_0xcef4('0x4a')](_['pick'](_0x203872[_0xcef4('0x3f')],[_0xcef4('0x40'),_0xcef4('0x4b'),_0xcef4('0x4c'),_0xcef4('0x4d'),_0xcef4('0x4e'),'mandatoryDisposition','alias']),{'where':{'context':_0x17fbc8[_0xcef4('0x4b')],'exten':_0x17fbc8[_0xcef4('0x40')]},'individualHooks':!![]})[_0xcef4('0x10')](function(_0x108178){return _0x108178;});}return null;})[_0xcef4('0x10')](respondWithStatusCode(_0x48b77f,null))[_0xcef4('0x49')](handleError(_0x48b77f,null));};exports[_0xcef4('0x4f')]=function(_0x2a350e,_0x2614ca){var _0x261f81=_0x2a350e[_0xcef4('0x3a')]['id'];var _0x202f44=_0x2a350e[_0xcef4('0x3f')];var _0xeaf0a2=0xc8;var _0x1a0590=null;return db['sequelize'][_0xcef4('0x50')]({'isolationLevel':db[_0xcef4('0x51')]['Transaction'][_0xcef4('0x52')]['READ_COMMITTED']},function(_0x4eeae5){return db[_0xcef4('0x36')][_0xcef4('0x53')]({'where':{'id':_0x261f81},'transaction':_0x4eeae5})[_0xcef4('0x10')](function(_0x14a553){if(_0x14a553){return db['VoiceExtension'][_0xcef4('0xf')]({'where':{'VoiceExtensionId':_0x261f81},'transaction':_0x4eeae5})['then'](function(){var _0x2d179e=_[_0xcef4('0x18')](_0x202f44,function(_0x20589b){_0x20589b[_0xcef4('0x54')]=_0x261f81;_0x20589b[_0xcef4('0x55')]=!![];return _0x20589b;});return _0x14a553['createRouting'](_0x2d179e);})['then'](function(_0x2f0eda){return db[_0xcef4('0x36')][_0xcef4('0x56')](_0x2f0eda,{'transaction':_0x4eeae5});});}else{_0xeaf0a2=0x194;_0x1a0590=[];}});})[_0xcef4('0x10')](function(){if(_0xeaf0a2!==0x194){return db['VoiceExtension'][_0xcef4('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x261f81},'order':_0xcef4('0x58')})[_0xcef4('0x10')](function(_0x306f51){_0x1a0590=_0x306f51;});}})['catch'](function(_0x3bcd4a){_0xeaf0a2=0x1f4;logger[_0xcef4('0x20')](_0x3bcd4a[_0xcef4('0x21')]);if(_0x3bcd4a[_0xcef4('0x1d')]){delete _0x3bcd4a['name'];}_0x1a0590=_0x3bcd4a;})[_0xcef4('0x59')](function(){if(_0x1a0590===null){_0x2614ca[_0xcef4('0x7')](_0xeaf0a2);}else{if(_0xeaf0a2===0x1f4){_0x2614ca[_0xcef4('0x8')](_0xeaf0a2)[_0xcef4('0x22')](_0x1a0590);}else{_0x2614ca[_0xcef4('0x8')](_0xeaf0a2)[_0xcef4('0x9')](_0x1a0590);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index ebe15dc..a711487 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 _0xb688=['exports','events','../../mysqldb','setMaxListeners','remove','emit','hook'];(function(_0x3f66c7,_0x1a6a5a){var _0x21ae58=function(_0x10105d){while(--_0x10105d){_0x3f66c7['push'](_0x3f66c7['shift']());}};_0x21ae58(++_0x1a6a5a);}(_0xb688,0x16d));var _0x8b68=function(_0x3c4a56,_0x31210b){_0x3c4a56=_0x3c4a56-0x0;var _0x718dbb=_0xb688[_0x3c4a56];return _0x718dbb;};'use strict';var EventEmitter=require(_0x8b68('0x0'));var VoiceExtension=require(_0x8b68('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x8b68('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8b68('0x3')};function emitEvent(_0x4746f6){return function(_0x2b16bd,_0x169238,_0x479c71){VoiceExtensionEvents[_0x8b68('0x4')](_0x4746f6+':'+_0x2b16bd['id'],_0x2b16bd);VoiceExtensionEvents[_0x8b68('0x4')](_0x4746f6,_0x2b16bd);_0x479c71(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x8b68('0x5')](e,emitEvent(event));}}module[_0x8b68('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0x6b64=['../../mysqldb','VoiceExtension','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x20d54d,_0x1adc8e){var _0x516e8b=function(_0x2754e1){while(--_0x2754e1){_0x20d54d['push'](_0x20d54d['shift']());}};_0x516e8b(++_0x1adc8e);}(_0x6b64,0x103));var _0x46b6=function(_0x97c6ea,_0x4cffce){_0x97c6ea=_0x97c6ea-0x0;var _0x2d7f50=_0x6b64[_0x97c6ea];return _0x2d7f50;};'use strict';var EventEmitter=require(_0x46b6('0x0'));var VoiceExtension=require(_0x46b6('0x1'))['db'][_0x46b6('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x46b6('0x3')](0x0);var events={'afterCreate':_0x46b6('0x4'),'afterUpdate':_0x46b6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3f9cab){return function(_0x62f7ca,_0x1f1236,_0x80eb4c){VoiceExtensionEvents[_0x46b6('0x6')](_0x3f9cab+':'+_0x62f7ca['id'],_0x62f7ca);VoiceExtensionEvents[_0x46b6('0x6')](_0x3f9cab,_0x62f7ca);_0x80eb4c(null);};}for(var e in events){if(events[_0x46b6('0x7')](e)){var event=events[e];VoiceExtension[_0x46b6('0x8')](e,emitEvent(event));}}module[_0x46b6('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 494053d..4032ae4 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 _0xd204=[',${EXTEN},','appdata','appType','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','priority','define','voice_extensions','get','concat','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','url','length','name','trunk','phone','param','split','prefix','options','indexOf','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','toLowerCase','hasOwnProperty','tag','CDR(tag)=','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime'];(function(_0x47be08,_0x1cc993){var _0x20fff7=function(_0x556d5b){while(--_0x556d5b){_0x47be08['push'](_0x47be08['shift']());}};_0x20fff7(++_0x1cc993);}(_0xd204,0x158));var _0x4d20=function(_0x701251,_0x39637e){_0x701251=_0x701251-0x0;var _0x4000b4=_0xd204[_0x701251];return _0x4000b4;};'use strict';var _=require(_0x4d20('0x0'));var attributes=require(_0x4d20('0x1'));module[_0x4d20('0x2')]=function(_0x4e1496){var _0x4dbac6=_0x4e1496[_0x4d20('0x3')];function _0x55fc79(_0x4728a6){var _0x14f8d2=0x2;var _0x6639b0=[{'type':_0x4728a6[_0x4d20('0x4')],'app':_0x4d20('0x5'),'appdata':_0x4d20('0x6')+_0x4728a6[_0x4d20('0x4')],'context':_0x4728a6[_0x4d20('0x7')],'exten':_0x4728a6[_0x4d20('0x8')],'priority':_0x14f8d2++,'VoiceExtensionId':_0x4728a6['id']}];if(_0x4728a6['type']===_0x4d20('0x9')){_0x6639b0[_0x4d20('0xa')]({'type':_0x4d20('0x9'),'app':_0x4d20('0x5'),'appdata':_0x4d20('0xb')+_0x4728a6['id'],'context':_0x4728a6[_0x4d20('0x7')],'exten':_0x4728a6[_0x4d20('0x8')],'priority':_0x14f8d2++,'VoiceExtensionId':_0x4728a6['id']});}_0x6639b0[_0x4d20('0xa')]({'type':_0x4728a6[_0x4d20('0x4')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4728a6[_0x4d20('0x7')],'exten':_0x4728a6[_0x4d20('0x8')],'priority':_0x14f8d2++,'VoiceExtensionId':_0x4728a6['id']},{'type':_0x4728a6['type'],'app':'Set','appdata':_0x4d20('0xc'),'context':_0x4728a6[_0x4d20('0x7')],'exten':_0x4728a6[_0x4d20('0x8')],'priority':_0x14f8d2++,'VoiceExtensionId':_0x4728a6['id']},{'type':_0x4728a6[_0x4d20('0x4')],'app':'Set','appdata':_0x4d20('0xd'),'context':_0x4728a6[_0x4d20('0x7')],'exten':_0x4728a6['exten'],'priority':_0x14f8d2++,'VoiceExtensionId':_0x4728a6['id']});return _0x6639b0;}function _0xcddd36(_0x5f60c5){var _0x2d27be=0x2;var _0x4f54e4=[{'type':'outbound','app':_0x4d20('0x5'),'appdata':_0x4d20('0xe'),'context':_0x5f60c5[_0x4d20('0x7')],'exten':_0x5f60c5['exten'],'priority':_0x2d27be++,'VoiceExtensionId':_0x5f60c5['id']},{'type':_0x4d20('0xf'),'app':_0x4d20('0x5'),'appdata':_0x4d20('0x10')+(_0x5f60c5['cutdigits']?_0x4d20('0x11')+_0x5f60c5[_0x4d20('0x12')]+'}':_0x4d20('0x13')),'context':_0x5f60c5['context'],'exten':_0x5f60c5['exten'],'priority':_0x2d27be++,'VoiceExtensionId':_0x5f60c5['id']},{'type':_0x4d20('0xf'),'app':_0x4d20('0x5'),'appdata':'CDR(routeid)='+_0x5f60c5['id'],'context':_0x5f60c5['context'],'exten':_0x5f60c5[_0x4d20('0x8')],'priority':_0x2d27be++,'VoiceExtensionId':_0x5f60c5['id']},{'type':'outbound','app':_0x4d20('0x14'),'appdata':_0x4d20('0x15')+(_0x2d27be+0x2)+'):Goto('+(_0x2d27be+0x1)+')','context':_0x5f60c5[_0x4d20('0x7')],'exten':_0x5f60c5[_0x4d20('0x8')],'priority':_0x2d27be++,'VoiceExtensionId':_0x5f60c5['id']},{'type':_0x4d20('0xf'),'app':_0x4d20('0x5'),'appdata':_0x5f60c5[_0x4d20('0x12')]?_0x4d20('0x16')+_0x5f60c5[_0x4d20('0x12')]+'}':_0x4d20('0x17'),'context':_0x5f60c5['context'],'exten':_0x5f60c5['exten'],'priority':_0x2d27be++,'VoiceExtensionId':_0x5f60c5['id']},{'type':_0x4d20('0xf'),'app':_0x4d20('0x5'),'appdata':_0x4d20('0x18'),'context':_0x5f60c5['context'],'exten':_0x5f60c5['exten'],'priority':_0x2d27be++,'VoiceExtensionId':_0x5f60c5['id']},{'type':_0x4d20('0xf'),'app':'Set','appdata':_0x4d20('0xc'),'context':_0x5f60c5[_0x4d20('0x7')],'exten':_0x5f60c5[_0x4d20('0x8')],'priority':_0x2d27be++,'VoiceExtensionId':_0x5f60c5['id']},{'type':_0x4d20('0xf'),'app':'Set','appdata':_0x4d20('0xd'),'context':_0x5f60c5[_0x4d20('0x7')],'exten':_0x5f60c5['exten'],'priority':_0x2d27be++,'VoiceExtensionId':_0x5f60c5['id']},{'type':_0x4d20('0xf'),'app':'Set','appdata':'outboundrouteid='+_0x5f60c5['id'],'context':_0x5f60c5[_0x4d20('0x7')],'exten':_0x5f60c5[_0x4d20('0x8')],'priority':_0x2d27be++,'VoiceExtensionId':_0x5f60c5['id']}];if(_0x5f60c5['hasOwnProperty'](_0x4d20('0x19'))&&_0x5f60c5[_0x4d20('0x19')]!==_0x4d20('0x1a')){_0x4f54e4[_0x4d20('0xa')]({'type':'outbound','app':_0x4d20('0x5'),'appdata':_0x4d20('0x1b'),'context':_0x5f60c5[_0x4d20('0x7')],'exten':_0x5f60c5[_0x4d20('0x8')],'priority':_0x2d27be++,'VoiceExtensionId':_0x5f60c5['id']},{'type':_0x4d20('0xf'),'app':_0x4d20('0x5'),'appdata':_0x4d20('0x1c')+_0x5f60c5[_0x4d20('0x19')]||_0x4d20('0x1d'),'context':_0x5f60c5['context'],'exten':_0x5f60c5[_0x4d20('0x8')],'priority':_0x2d27be++,'VoiceExtensionId':_0x5f60c5['id']});}return _0x4f54e4;}function _0x3510df(_0x102384,_0x59c452){var _0x113c51=[{'name':'trunk','param':0x0},{'name':'timeout','param':0x1},{'name':'options','param':0x2},{'name':_0x4d20('0x1e'),'param':0x3}];var _0x1f5e51={};var _0x2692dc=_0x59c452['split'](',');var _0x575da2=[];for(var _0x1fb732=0x0;_0x1fb732<_0x113c51[_0x4d20('0x1f')];_0x1fb732++){switch(_0x113c51[_0x1fb732][_0x4d20('0x20')]){case _0x4d20('0x21'):_0x1f5e51['trunk']=_0x2692dc[_0x113c51[_0x1fb732]['param']]['split']('/')[0x1];_0x1f5e51[_0x4d20('0x22')]=_0x2692dc[_0x113c51[_0x1fb732][_0x4d20('0x23')]][_0x4d20('0x24')]('/')[0x2];_0x1f5e51['prefix']=_0x1f5e51[_0x4d20('0x22')]?_0x1f5e51['phone'][_0x4d20('0x24')]('$')[0x0]:undefined;_0x1f5e51[_0x4d20('0x22')]=_0x102384['cutdigits']?(_0x1f5e51[_0x4d20('0x25')]||'')+'${EXTEN:'+_0x102384[_0x4d20('0x12')]+'}':(_0x1f5e51[_0x4d20('0x25')]||'')+_0x4d20('0x13');_0x575da2[_0x113c51[_0x1fb732][_0x4d20('0x23')]]=['SIP',_0x1f5e51['trunk'],_0x1f5e51[_0x4d20('0x22')]]['join']('/');break;case _0x4d20('0x26'):_0x1f5e51[_0x4d20('0x26')]=_0x2692dc[_0x113c51[_0x1fb732][_0x4d20('0x23')]];if(_0x102384[_0x4d20('0x19')]!==_0x4d20('0x1a')){if(_0x1f5e51['options'][_0x4d20('0x27')]('U(xcally-mixmonitor-context)')<0x0){_0x1f5e51[_0x4d20('0x26')]+=_0x4d20('0x28');}}else{_0x1f5e51[_0x4d20('0x26')]=_0x1f5e51[_0x4d20('0x26')][_0x4d20('0x29')](_0x4d20('0x28'),'');}_0x575da2[_0x113c51[_0x1fb732][_0x4d20('0x23')]]=_0x1f5e51[_0x4d20('0x26')];break;default:_0x575da2[_0x113c51[_0x1fb732][_0x4d20('0x23')]]=_0x2692dc[_0x113c51[_0x1fb732][_0x4d20('0x23')]];}}return _0x575da2[_0x4d20('0x2a')](',');}function _0x3e96b8(_0x3d0d4d,_0xdd8f04,_0xca60e4){return new Promise(function(_0x4c261a,_0x4353ba){var _0x1845d7=[];if(_[_0x4d20('0x2b')](_0xdd8f04))return _0x4c261a(_0x1845d7);_0x4dbac6[_0x4d20('0x2c')][_0x4d20('0x2d')]({'attributes':['id',_0x4d20('0x2e'),_0x4d20('0x2f')],'raw':!![]})[_0x4d20('0x30')](function(_0x26da93){for(var _0x425b2b=0x0,_0x403726=0x0;_0x425b2b<_0xdd8f04[_0x4d20('0x1f')];_0x425b2b++,_0x403726=0x0){var _0x28bb96=_0xdd8f04[_0x425b2b];var _0x34c8b1=[];var _0x31336e=[];delete _0x28bb96['id'];if(_0x28bb96[_0x4d20('0x2e')]!==_0x4d20('0x31')){_0x28bb96[_0x4d20('0x32')]=[_0x28bb96[_0x4d20('0x2e')]];}else{_0x28bb96['intervals']=_0x28bb96[_0x4d20('0x2f')]?_[_0x4d20('0x33')](_['filter'](_0x26da93,{'IntervalId':_0x28bb96[_0x4d20('0x2f')]}),_0x4d20('0x2e')):[];}_0x28bb96[_0x4d20('0x7')]=_0x3d0d4d[_0x4d20('0x7')];_0x28bb96[_0x4d20('0x8')]=_0x3d0d4d[_0x4d20('0x8')];if(_0x28bb96[_0x4d20('0x4')])_0x28bb96[_0x4d20('0x4')]=_0x28bb96[_0x4d20('0x4')][_0x4d20('0x34')]();if(_0x3d0d4d[_0x4d20('0x4')]==='outbound'){if(_0x28bb96[_0x4d20('0x35')]('tag')&&_0x28bb96[_0x4d20('0x36')]&&_0x28bb96[_0x4d20('0x36')]!=='--'){_0x34c8b1['push']({'type':_0x28bb96[_0x4d20('0x4')][_0x4d20('0x34')](),'app':_0x4d20('0x5'),'appdata':_0x4d20('0x37')+_0x28bb96[_0x4d20('0x36')],'context':_0x3d0d4d[_0x4d20('0x7')],'exten':_0x3d0d4d[_0x4d20('0x8')],'priority':_0x28bb96['intervals'][_0x4d20('0x1f')]+_0xca60e4+_0x403726++,'VoiceExtensionId':_0x3d0d4d['id']});}_0x34c8b1[_0x4d20('0xa')]({'type':_0x28bb96['type'][_0x4d20('0x34')](),'app':_0x4d20('0x14'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x28bb96[_0x4d20('0x38')]?_0x4d20('0x39')+_0x28bb96[_0x4d20('0x38')]+')':_0x4d20('0x3a')),'context':_0x3d0d4d[_0x4d20('0x7')],'exten':_0x3d0d4d[_0x4d20('0x8')],'priority':_0x28bb96['intervals'][_0x4d20('0x1f')]+_0xca60e4+_0x403726++,'VoiceExtensionId':_0x3d0d4d['id']});}else{if(_0x28bb96[_0x4d20('0x35')](_0x4d20('0x3b'))){if([_0x4d20('0x3c'),_0x4d20('0x3d')][_0x4d20('0x3e')](_0x28bb96[_0x4d20('0x3f')][_0x4d20('0x34')]())&&_0x28bb96['appType']!==_0x4d20('0x40')){if(_0x28bb96['answer']){_0x34c8b1['push']({'type':_0x28bb96[_0x4d20('0x4')][_0x4d20('0x34')](),'app':_0x4d20('0x14'),'appdata':_0x4d20('0x41'),'context':_0x3d0d4d[_0x4d20('0x7')],'exten':_0x3d0d4d[_0x4d20('0x8')],'priority':_0x28bb96[_0x4d20('0x32')]['length']+_0xca60e4+_0x403726++,'VoiceExtensionId':_0x3d0d4d['id']});_0x34c8b1[_0x4d20('0xa')]({'type':_0x28bb96['type']['toLowerCase'](),'app':'Set','appdata':_0x4d20('0x42'),'context':_0x3d0d4d[_0x4d20('0x7')],'exten':_0x3d0d4d['exten'],'priority':_0x28bb96[_0x4d20('0x32')][_0x4d20('0x1f')]+_0xca60e4+_0x403726++,'VoiceExtensionId':_0x3d0d4d['id']});}else{_0x34c8b1['push']({'type':_0x28bb96[_0x4d20('0x4')]['toLowerCase'](),'app':_0x4d20('0x14'),'appdata':_0x4d20('0x43'),'context':_0x3d0d4d[_0x4d20('0x7')],'exten':_0x3d0d4d[_0x4d20('0x8')],'priority':_0x28bb96[_0x4d20('0x32')]['length']+_0xca60e4+_0x403726++,'VoiceExtensionId':_0x3d0d4d['id']});_0x34c8b1[_0x4d20('0xa')]({'type':_0x28bb96[_0x4d20('0x4')]['toLowerCase'](),'app':_0x4d20('0x5'),'appdata':_0x4d20('0x44'),'context':_0x3d0d4d[_0x4d20('0x7')],'exten':_0x3d0d4d['exten'],'priority':_0x28bb96[_0x4d20('0x32')][_0x4d20('0x1f')]+_0xca60e4+_0x403726++,'VoiceExtensionId':_0x3d0d4d['id']});}}}}for(var _0x55dee1=0x0;_0x55dee1<_0x28bb96[_0x4d20('0x32')][_0x4d20('0x1f')];_0x55dee1++){var _0x5c27f8=_0xca60e4+_0x28bb96[_0x4d20('0x32')]['length'];var _0x5b3878=_0x55dee1===_0x28bb96[_0x4d20('0x32')][_0x4d20('0x1f')]-0x1?_0xca60e4+_0x34c8b1[_0x4d20('0x1f')]+_0x31336e[_0x4d20('0x1f')]+0x2:_0xca60e4+_0x55dee1+0x1;_0x34c8b1[_0x4d20('0x45')](_0x55dee1,0x0,{'type':_0x3d0d4d[_0x4d20('0x4')],'app':_0x4d20('0x46'),'appdata':_0x28bb96[_0x4d20('0x32')][_0x55dee1]+'?'+_0x3d0d4d['context']+_0x4d20('0x47')+_0x5c27f8+':'+_0x3d0d4d['context']+_0x4d20('0x47')+_0x5b3878,'exten':_0x3d0d4d[_0x4d20('0x8')],'context':_0x3d0d4d[_0x4d20('0x7')],'priority':_0xca60e4+_0x55dee1,'VoiceExtensionId':_0x3d0d4d['id']});}if(_0x28bb96['appType']==='outboundDial'){_0x28bb96[_0x4d20('0x48')]=_0x3510df(_0x3d0d4d,_0x28bb96['appdata']);}if(_0x28bb96[_0x4d20('0x49')]===_0x4d20('0x4a')){_0x34c8b1[_0x4d20('0xa')]({'type':_0x28bb96[_0x4d20('0x4')][_0x4d20('0x34')](),'app':_0x4d20('0x5'),'appdata':_0x4d20('0x4b'),'context':_0x3d0d4d[_0x4d20('0x7')],'exten':_0x3d0d4d[_0x4d20('0x8')],'priority':_0x28bb96[_0x4d20('0x32')][_0x4d20('0x1f')]+_0xca60e4+_0x403726++,'VoiceExtensionId':_0x3d0d4d['id']});}_0x28bb96['priority']=_0x34c8b1[_0x4d20('0x1f')]?_[_0x4d20('0x4c')](_0x34c8b1)[_0x4d20('0x4d')]+0x1:_0xca60e4;_0x1845d7=_['concat'](_0x1845d7,_0x34c8b1,[_0x28bb96],_0x31336e);_0xca60e4=_[_0x4d20('0x4c')](_0x1845d7)[_0x4d20('0x4d')]+0x1;}return _0x4c261a(_0x1845d7);})['catch'](function(_0x2bd67d){_0x4353ba(_0x2bd67d);});});}return _0x4e1496[_0x4d20('0x4e')]('VoiceExtension',attributes,{'tableName':_0x4d20('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xe6b2e){var _0x3f2eeb=this[_0x4d20('0x50')]({'plain':!![]});var _0x3235cd=_0x3f2eeb[_0x4d20('0x4')]===_0x4d20('0xf')?_0xcddd36(_0x3f2eeb):_0x55fc79(_0x3f2eeb);return _0x3e96b8(_0x3f2eeb,_0xe6b2e,_[_0x4d20('0x4c')](_0x3235cd)['priority']+0x1)[_0x4d20('0x30')](function(_0x300b6c){var _0x218e41=_[_0x4d20('0x51')](_0x3235cd,_0x300b6c);_0x218e41[_0x4d20('0xa')]({'type':_0x3f2eeb[_0x4d20('0x4')],'app':_0x4d20('0x52'),'exten':_0x3f2eeb['exten'],'context':_0x3f2eeb[_0x4d20('0x7')],'priority':_[_0x4d20('0x4c')](_0x218e41)[_0x4d20('0x4d')]+0x1,'VoiceExtensionId':_0x3f2eeb['id']});return _0x218e41;});}}});}; \ No newline at end of file +var _0x5f12=['answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','appdata','agi','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','inbound','push','CDR(routeid)=','exten','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','url','split','length','name','param','phone','prefix','join','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','IntervalId','then','*,*,*,*','intervals','map','filter','interval','toLowerCase','hasOwnProperty','tag','CDR(tag)=','callerID'];(function(_0x34e1fd,_0x2eb3b5){var _0xe98c5f=function(_0x1fd70e){while(--_0x1fd70e){_0x34e1fd['push'](_0x34e1fd['shift']());}};_0xe98c5f(++_0x2eb3b5);}(_0x5f12,0x68));var _0x25f1=function(_0x4b2e8a,_0x8b4ee3){_0x4b2e8a=_0x4b2e8a-0x0;var _0x55e876=_0x5f12[_0x4b2e8a];return _0x55e876;};'use strict';var _=require(_0x25f1('0x0'));var attributes=require(_0x25f1('0x1'));module[_0x25f1('0x2')]=function(_0x2c0079){var _0x5d7891=_0x2c0079[_0x25f1('0x3')];function _0x3ad544(_0x2f6a8a){var _0x114df6=0x2;var _0x28d9e1=[{'type':_0x2f6a8a[_0x25f1('0x4')],'app':_0x25f1('0x5'),'appdata':_0x25f1('0x6')+_0x2f6a8a['type'],'context':_0x2f6a8a[_0x25f1('0x7')],'exten':_0x2f6a8a['exten'],'priority':_0x114df6++,'VoiceExtensionId':_0x2f6a8a['id']}];if(_0x2f6a8a[_0x25f1('0x4')]===_0x25f1('0x8')){_0x28d9e1[_0x25f1('0x9')]({'type':_0x25f1('0x8'),'app':_0x25f1('0x5'),'appdata':_0x25f1('0xa')+_0x2f6a8a['id'],'context':_0x2f6a8a['context'],'exten':_0x2f6a8a[_0x25f1('0xb')],'priority':_0x114df6++,'VoiceExtensionId':_0x2f6a8a['id']});}_0x28d9e1[_0x25f1('0x9')]({'type':_0x2f6a8a['type'],'app':_0x25f1('0x5'),'appdata':_0x25f1('0xc'),'context':_0x2f6a8a[_0x25f1('0x7')],'exten':_0x2f6a8a[_0x25f1('0xb')],'priority':_0x114df6++,'VoiceExtensionId':_0x2f6a8a['id']},{'type':_0x2f6a8a[_0x25f1('0x4')],'app':_0x25f1('0x5'),'appdata':_0x25f1('0xd'),'context':_0x2f6a8a['context'],'exten':_0x2f6a8a[_0x25f1('0xb')],'priority':_0x114df6++,'VoiceExtensionId':_0x2f6a8a['id']},{'type':_0x2f6a8a[_0x25f1('0x4')],'app':'Set','appdata':_0x25f1('0xe'),'context':_0x2f6a8a['context'],'exten':_0x2f6a8a['exten'],'priority':_0x114df6++,'VoiceExtensionId':_0x2f6a8a['id']});return _0x28d9e1;}function _0x5bdfe3(_0x1e8e4a){var _0x24704c=0x2;var _0x225dad=[{'type':_0x25f1('0xf'),'app':_0x25f1('0x5'),'appdata':'CDR(type)=outbound','context':_0x1e8e4a['context'],'exten':_0x1e8e4a['exten'],'priority':_0x24704c++,'VoiceExtensionId':_0x1e8e4a['id']},{'type':_0x25f1('0xf'),'app':'Set','appdata':_0x25f1('0x10')+(_0x1e8e4a[_0x25f1('0x11')]?_0x25f1('0x12')+_0x1e8e4a['cutdigits']+'}':_0x25f1('0x13')),'context':_0x1e8e4a['context'],'exten':_0x1e8e4a[_0x25f1('0xb')],'priority':_0x24704c++,'VoiceExtensionId':_0x1e8e4a['id']},{'type':'outbound','app':_0x25f1('0x5'),'appdata':_0x25f1('0xa')+_0x1e8e4a['id'],'context':_0x1e8e4a['context'],'exten':_0x1e8e4a[_0x25f1('0xb')],'priority':_0x24704c++,'VoiceExtensionId':_0x1e8e4a['id']},{'type':_0x25f1('0xf'),'app':_0x25f1('0x14'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x24704c+0x2)+_0x25f1('0x15')+(_0x24704c+0x1)+')','context':_0x1e8e4a[_0x25f1('0x7')],'exten':_0x1e8e4a[_0x25f1('0xb')],'priority':_0x24704c++,'VoiceExtensionId':_0x1e8e4a['id']},{'type':_0x25f1('0xf'),'app':_0x25f1('0x5'),'appdata':_0x1e8e4a[_0x25f1('0x11')]?_0x25f1('0x16')+_0x1e8e4a[_0x25f1('0x11')]+'}':_0x25f1('0x17'),'context':_0x1e8e4a[_0x25f1('0x7')],'exten':_0x1e8e4a[_0x25f1('0xb')],'priority':_0x24704c++,'VoiceExtensionId':_0x1e8e4a['id']},{'type':_0x25f1('0xf'),'app':_0x25f1('0x5'),'appdata':_0x25f1('0xc'),'context':_0x1e8e4a[_0x25f1('0x7')],'exten':_0x1e8e4a['exten'],'priority':_0x24704c++,'VoiceExtensionId':_0x1e8e4a['id']},{'type':_0x25f1('0xf'),'app':'Set','appdata':_0x25f1('0xd'),'context':_0x1e8e4a[_0x25f1('0x7')],'exten':_0x1e8e4a[_0x25f1('0xb')],'priority':_0x24704c++,'VoiceExtensionId':_0x1e8e4a['id']},{'type':_0x25f1('0xf'),'app':_0x25f1('0x5'),'appdata':_0x25f1('0xe'),'context':_0x1e8e4a['context'],'exten':_0x1e8e4a[_0x25f1('0xb')],'priority':_0x24704c++,'VoiceExtensionId':_0x1e8e4a['id']},{'type':'outbound','app':_0x25f1('0x5'),'appdata':_0x25f1('0x18')+_0x1e8e4a['id'],'context':_0x1e8e4a[_0x25f1('0x7')],'exten':_0x1e8e4a['exten'],'priority':_0x24704c++,'VoiceExtensionId':_0x1e8e4a['id']}];if(_0x1e8e4a['hasOwnProperty'](_0x25f1('0x19'))&&_0x1e8e4a['recordingFormat']!==_0x25f1('0x1a')){_0x225dad[_0x25f1('0x9')]({'type':'outbound','app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x1e8e4a[_0x25f1('0x7')],'exten':_0x1e8e4a[_0x25f1('0xb')],'priority':_0x24704c++,'VoiceExtensionId':_0x1e8e4a['id']},{'type':_0x25f1('0xf'),'app':_0x25f1('0x5'),'appdata':_0x25f1('0x1b')+_0x1e8e4a[_0x25f1('0x19')]||'wav','context':_0x1e8e4a['context'],'exten':_0x1e8e4a['exten'],'priority':_0x24704c++,'VoiceExtensionId':_0x1e8e4a['id']});}return _0x225dad;}function _0x1defc4(_0x57e24b,_0x44c72c){var _0x24f26e=[{'name':_0x25f1('0x1c'),'param':0x0},{'name':_0x25f1('0x1d'),'param':0x1},{'name':_0x25f1('0x1e'),'param':0x2},{'name':_0x25f1('0x1f'),'param':0x3}];var _0x40ba44={};var _0x146a8b=_0x44c72c[_0x25f1('0x20')](',');var _0x314120=[];for(var _0x4775f5=0x0;_0x4775f5<_0x24f26e[_0x25f1('0x21')];_0x4775f5++){switch(_0x24f26e[_0x4775f5][_0x25f1('0x22')]){case _0x25f1('0x1c'):_0x40ba44[_0x25f1('0x1c')]=_0x146a8b[_0x24f26e[_0x4775f5][_0x25f1('0x23')]][_0x25f1('0x20')]('/')[0x1];_0x40ba44[_0x25f1('0x24')]=_0x146a8b[_0x24f26e[_0x4775f5][_0x25f1('0x23')]][_0x25f1('0x20')]('/')[0x2];_0x40ba44[_0x25f1('0x25')]=_0x40ba44[_0x25f1('0x24')]?_0x40ba44['phone'][_0x25f1('0x20')]('$')[0x0]:undefined;_0x40ba44[_0x25f1('0x24')]=_0x57e24b[_0x25f1('0x11')]?(_0x40ba44[_0x25f1('0x25')]||'')+'${EXTEN:'+_0x57e24b['cutdigits']+'}':(_0x40ba44[_0x25f1('0x25')]||'')+_0x25f1('0x13');_0x314120[_0x24f26e[_0x4775f5]['param']]=['SIP',_0x40ba44['trunk'],_0x40ba44[_0x25f1('0x24')]][_0x25f1('0x26')]('/');break;case _0x25f1('0x1e'):_0x40ba44[_0x25f1('0x1e')]=_0x146a8b[_0x24f26e[_0x4775f5]['param']];if(_0x57e24b[_0x25f1('0x19')]!==_0x25f1('0x1a')){if(_0x40ba44['options'][_0x25f1('0x27')](_0x25f1('0x28'))<0x0){_0x40ba44['options']+=_0x25f1('0x28');}}else{_0x40ba44[_0x25f1('0x1e')]=_0x40ba44[_0x25f1('0x1e')]['replace'](_0x25f1('0x28'),'');}_0x314120[_0x24f26e[_0x4775f5]['param']]=_0x40ba44['options'];break;default:_0x314120[_0x24f26e[_0x4775f5][_0x25f1('0x23')]]=_0x146a8b[_0x24f26e[_0x4775f5]['param']];}}return _0x314120[_0x25f1('0x26')](',');}function _0x2fedc7(_0x5aacc5,_0x503afd,_0x405fcf){return new Promise(function(_0x2a3655,_0x499f7f){var _0x38da73=[];if(_[_0x25f1('0x29')](_0x503afd))return _0x2a3655(_0x38da73);_0x5d7891[_0x25f1('0x2a')][_0x25f1('0x2b')]({'attributes':['id','interval',_0x25f1('0x2c')],'raw':!![]})[_0x25f1('0x2d')](function(_0x21262f){for(var _0x17d8bd=0x0,_0x6be1c7=0x0;_0x17d8bd<_0x503afd[_0x25f1('0x21')];_0x17d8bd++,_0x6be1c7=0x0){var _0x234568=_0x503afd[_0x17d8bd];var _0x2a5486=[];var _0x4d92ec=[];delete _0x234568['id'];if(_0x234568['interval']!==_0x25f1('0x2e')){_0x234568[_0x25f1('0x2f')]=[_0x234568['interval']];}else{_0x234568[_0x25f1('0x2f')]=_0x234568['IntervalId']?_[_0x25f1('0x30')](_[_0x25f1('0x31')](_0x21262f,{'IntervalId':_0x234568[_0x25f1('0x2c')]}),_0x25f1('0x32')):[];}_0x234568[_0x25f1('0x7')]=_0x5aacc5['context'];_0x234568['exten']=_0x5aacc5[_0x25f1('0xb')];if(_0x234568[_0x25f1('0x4')])_0x234568['type']=_0x234568[_0x25f1('0x4')][_0x25f1('0x33')]();if(_0x5aacc5[_0x25f1('0x4')]===_0x25f1('0xf')){if(_0x234568[_0x25f1('0x34')](_0x25f1('0x35'))&&_0x234568[_0x25f1('0x35')]&&_0x234568[_0x25f1('0x35')]!=='--'){_0x2a5486[_0x25f1('0x9')]({'type':_0x234568[_0x25f1('0x4')][_0x25f1('0x33')](),'app':_0x25f1('0x5'),'appdata':_0x25f1('0x36')+_0x234568[_0x25f1('0x35')],'context':_0x5aacc5[_0x25f1('0x7')],'exten':_0x5aacc5[_0x25f1('0xb')],'priority':_0x234568['intervals'][_0x25f1('0x21')]+_0x405fcf+_0x6be1c7++,'VoiceExtensionId':_0x5aacc5['id']});}_0x2a5486['push']({'type':_0x234568[_0x25f1('0x4')][_0x25f1('0x33')](),'app':_0x25f1('0x14'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x234568[_0x25f1('0x37')]?'Set(CALLERID(all)='+_0x234568['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x5aacc5['context'],'exten':_0x5aacc5[_0x25f1('0xb')],'priority':_0x234568[_0x25f1('0x2f')]['length']+_0x405fcf+_0x6be1c7++,'VoiceExtensionId':_0x5aacc5['id']});}else{if(_0x234568['hasOwnProperty'](_0x25f1('0x38'))){if([_0x25f1('0x39'),_0x25f1('0x3a')][_0x25f1('0x3b')](_0x234568[_0x25f1('0x3c')][_0x25f1('0x33')]())&&_0x234568[_0x25f1('0x3d')]!==_0x25f1('0x3e')){if(_0x234568[_0x25f1('0x38')]){_0x2a5486[_0x25f1('0x9')]({'type':_0x234568[_0x25f1('0x4')][_0x25f1('0x33')](),'app':_0x25f1('0x14'),'appdata':_0x25f1('0x3f'),'context':_0x5aacc5[_0x25f1('0x7')],'exten':_0x5aacc5[_0x25f1('0xb')],'priority':_0x234568['intervals'][_0x25f1('0x21')]+_0x405fcf+_0x6be1c7++,'VoiceExtensionId':_0x5aacc5['id']});_0x2a5486[_0x25f1('0x9')]({'type':_0x234568[_0x25f1('0x4')][_0x25f1('0x33')](),'app':_0x25f1('0x5'),'appdata':_0x25f1('0x40'),'context':_0x5aacc5['context'],'exten':_0x5aacc5[_0x25f1('0xb')],'priority':_0x234568[_0x25f1('0x2f')][_0x25f1('0x21')]+_0x405fcf+_0x6be1c7++,'VoiceExtensionId':_0x5aacc5['id']});}else{_0x2a5486[_0x25f1('0x9')]({'type':_0x234568[_0x25f1('0x4')]['toLowerCase'](),'app':_0x25f1('0x14'),'appdata':_0x25f1('0x41'),'context':_0x5aacc5['context'],'exten':_0x5aacc5[_0x25f1('0xb')],'priority':_0x234568[_0x25f1('0x2f')][_0x25f1('0x21')]+_0x405fcf+_0x6be1c7++,'VoiceExtensionId':_0x5aacc5['id']});_0x2a5486[_0x25f1('0x9')]({'type':_0x234568[_0x25f1('0x4')][_0x25f1('0x33')](),'app':_0x25f1('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x5aacc5[_0x25f1('0x7')],'exten':_0x5aacc5[_0x25f1('0xb')],'priority':_0x234568[_0x25f1('0x2f')]['length']+_0x405fcf+_0x6be1c7++,'VoiceExtensionId':_0x5aacc5['id']});}}}}for(var _0x25faa0=0x0;_0x25faa0<_0x234568['intervals'][_0x25f1('0x21')];_0x25faa0++){var _0x5c5e42=_0x405fcf+_0x234568[_0x25f1('0x2f')][_0x25f1('0x21')];var _0x1cfae3=_0x25faa0===_0x234568[_0x25f1('0x2f')][_0x25f1('0x21')]-0x1?_0x405fcf+_0x2a5486['length']+_0x4d92ec[_0x25f1('0x21')]+0x2:_0x405fcf+_0x25faa0+0x1;_0x2a5486[_0x25f1('0x42')](_0x25faa0,0x0,{'type':_0x5aacc5[_0x25f1('0x4')],'app':_0x25f1('0x43'),'appdata':_0x234568[_0x25f1('0x2f')][_0x25faa0]+'?'+_0x5aacc5['context']+_0x25f1('0x44')+_0x5c5e42+':'+_0x5aacc5[_0x25f1('0x7')]+',${EXTEN},'+_0x1cfae3,'exten':_0x5aacc5['exten'],'context':_0x5aacc5[_0x25f1('0x7')],'priority':_0x405fcf+_0x25faa0,'VoiceExtensionId':_0x5aacc5['id']});}if(_0x234568['appType']==='outboundDial'){_0x234568[_0x25f1('0x45')]=_0x1defc4(_0x5aacc5,_0x234568[_0x25f1('0x45')]);}if(_0x234568[_0x25f1('0x3d')]===_0x25f1('0x46')){_0x2a5486[_0x25f1('0x9')]({'type':_0x234568[_0x25f1('0x4')][_0x25f1('0x33')](),'app':_0x25f1('0x5'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x5aacc5[_0x25f1('0x7')],'exten':_0x5aacc5['exten'],'priority':_0x234568[_0x25f1('0x2f')][_0x25f1('0x21')]+_0x405fcf+_0x6be1c7++,'VoiceExtensionId':_0x5aacc5['id']});}_0x234568[_0x25f1('0x47')]=_0x2a5486[_0x25f1('0x21')]?_[_0x25f1('0x48')](_0x2a5486)[_0x25f1('0x47')]+0x1:_0x405fcf;_0x38da73=_[_0x25f1('0x49')](_0x38da73,_0x2a5486,[_0x234568],_0x4d92ec);_0x405fcf=_[_0x25f1('0x48')](_0x38da73)['priority']+0x1;}return _0x2a3655(_0x38da73);})[_0x25f1('0x4a')](function(_0x282c9b){_0x499f7f(_0x282c9b);});});}return _0x2c0079[_0x25f1('0x4b')](_0x25f1('0x4c'),attributes,{'tableName':_0x25f1('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x281c8a){var _0x3f2e81=this[_0x25f1('0x4e')]({'plain':!![]});var _0x38f158=_0x3f2e81[_0x25f1('0x4')]===_0x25f1('0xf')?_0x5bdfe3(_0x3f2e81):_0x3ad544(_0x3f2e81);return _0x2fedc7(_0x3f2e81,_0x281c8a,_['last'](_0x38f158)[_0x25f1('0x47')]+0x1)['then'](function(_0x40f141){var _0x220fcb=_[_0x25f1('0x49')](_0x38f158,_0x40f141);_0x220fcb[_0x25f1('0x9')]({'type':_0x3f2e81[_0x25f1('0x4')],'app':_0x25f1('0x4f'),'exten':_0x3f2e81[_0x25f1('0xb')],'context':_0x3f2e81['context'],'priority':_[_0x25f1('0x48')](_0x220fcb)[_0x25f1('0x47')]+0x1,'VoiceExtensionId':_0x3f2e81['id']});return _0x220fcb;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index cdb6a86..8bf992e 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 _0xa63f=['options','raw','where','limit','include','map','model','attributes','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceExtension','VoiceExtension','findAll'];(function(_0x871074,_0x4bbb29){var _0x16e8ce=function(_0x1a6fe1){while(--_0x1a6fe1){_0x871074['push'](_0x871074['shift']());}};_0x16e8ce(++_0x4bbb29);}(_0xa63f,0x1b6));var _0xfa63=function(_0x3c414c,_0x399dbb){_0x3c414c=_0x3c414c-0x0;var _0x4f3062=_0xa63f[_0x3c414c];return _0x4f3062;};'use strict';var _=require(_0xfa63('0x0'));var util=require(_0xfa63('0x1'));var moment=require(_0xfa63('0x2'));var BPromise=require(_0xfa63('0x3'));var rs=require(_0xfa63('0x4'));var fs=require('fs');var Redis=require(_0xfa63('0x5'));var db=require(_0xfa63('0x6'))['db'];var utils=require(_0xfa63('0x7'));var logger=require(_0xfa63('0x8'))(_0xfa63('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfa63('0xa')][_0xfa63('0xb')]({'port':0x232a});config[_0xfa63('0xc')]=_[_0xfa63('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa63('0xc')]));require(_0xfa63('0xe'))[_0xfa63('0xf')](socket);function respondWithRpcPromise(_0x47d90d,_0x181fec,_0x57faed){return new BPromise(function(_0xfcb3d1,_0x4b1959){return client[_0xfa63('0x10')](_0x47d90d,_0x57faed)[_0xfa63('0x11')](function(_0x3e5bfc){logger[_0xfa63('0x12')](_0xfa63('0x13'),_0x181fec,_0xfa63('0x14'));logger[_0xfa63('0x15')](_0xfa63('0x16'),_0x181fec,'request\x20sent',JSON['stringify'](_0x3e5bfc));if(_0x3e5bfc[_0xfa63('0x17')]){if(_0x3e5bfc[_0xfa63('0x17')][_0xfa63('0x18')]===0x1f4){logger['error'](_0xfa63('0x13'),_0x181fec,_0x3e5bfc['error'][_0xfa63('0x19')]);return _0x4b1959(_0x3e5bfc[_0xfa63('0x17')]['message']);}logger[_0xfa63('0x17')](_0xfa63('0x13'),_0x181fec,_0x3e5bfc[_0xfa63('0x17')][_0xfa63('0x19')]);return _0xfcb3d1(_0x3e5bfc[_0xfa63('0x17')][_0xfa63('0x19')]);}else{logger['info'](_0xfa63('0x13'),_0x181fec,_0xfa63('0x14'));_0xfcb3d1(_0x3e5bfc[_0xfa63('0x1a')][_0xfa63('0x19')]);}})['catch'](function(_0x58211b){logger[_0xfa63('0x17')](_0xfa63('0x13'),_0x181fec,_0x58211b);_0x4b1959(_0x58211b);});});}exports[_0xfa63('0x1b')]=function(_0x3cc2b5){var _0x54b438=this;return new Promise(function(_0x591c35,_0x17e929){return db[_0xfa63('0x1c')][_0xfa63('0x1d')]({'raw':_0x3cc2b5[_0xfa63('0x1e')]?_0x3cc2b5[_0xfa63('0x1e')][_0xfa63('0x1f')]===undefined?!![]:![]:!![],'where':_0x3cc2b5['options']?_0x3cc2b5[_0xfa63('0x1e')][_0xfa63('0x20')]||null:null,'attributes':_0x3cc2b5[_0xfa63('0x1e')]?_0x3cc2b5[_0xfa63('0x1e')]['attributes']||null:null,'limit':_0x3cc2b5[_0xfa63('0x1e')]?_0x3cc2b5['options'][_0xfa63('0x21')]||null:null,'include':_0x3cc2b5['options']?_0x3cc2b5['options'][_0xfa63('0x22')]?_[_0xfa63('0x23')](_0x3cc2b5[_0xfa63('0x1e')][_0xfa63('0x22')],function(_0x4799fb){return{'model':db[_0x4799fb[_0xfa63('0x24')]],'as':_0x4799fb['as'],'attributes':_0x4799fb[_0xfa63('0x25')],'include':_0x4799fb[_0xfa63('0x22')]?_[_0xfa63('0x23')](_0x4799fb['include'],function(_0x3602cb){return{'model':db[_0x3602cb[_0xfa63('0x24')]],'as':_0x3602cb['as'],'attributes':_0x3602cb[_0xfa63('0x25')],'include':_0x3602cb[_0xfa63('0x22')]?_['map'](_0x3602cb[_0xfa63('0x22')],function(_0x7b0c2e){return{'model':db[_0x7b0c2e[_0xfa63('0x24')]],'as':_0x7b0c2e['as'],'attributes':_0x7b0c2e[_0xfa63('0x25')]};}):[]};}):[]};}):[]:[]})[_0xfa63('0x11')](function(_0x2f499a){logger[_0xfa63('0x12')](_0xfa63('0x1b'),_0x3cc2b5);logger[_0xfa63('0x15')](_0xfa63('0x1b'),_0x3cc2b5,JSON['stringify'](_0x2f499a));_0x591c35(_0x2f499a);})[_0xfa63('0x26')](function(_0x36964e){logger[_0xfa63('0x17')](_0xfa63('0x1b'),_0x36964e['message'],_0x3cc2b5);_0x17e929(_0x54b438[_0xfa63('0x17')](0x1f4,_0x36964e['message']));});});}; \ No newline at end of file +var _0x2bd8=['attributes','limit','map','include','model','then','debug','GetVoiceExtension','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','info','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','VoiceExtension','findAll','options','raw','where'];(function(_0x1da206,_0x3e6db7){var _0x3f92d6=function(_0x140ed5){while(--_0x140ed5){_0x1da206['push'](_0x1da206['shift']());}};_0x3f92d6(++_0x3e6db7);}(_0x2bd8,0x130));var _0x82bd=function(_0x590e55,_0x1b28b7){_0x590e55=_0x590e55-0x0;var _0x275e40=_0x2bd8[_0x590e55];return _0x275e40;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var moment=require(_0x82bd('0x1'));var BPromise=require(_0x82bd('0x2'));var rs=require(_0x82bd('0x3'));var fs=require('fs');var Redis=require(_0x82bd('0x4'));var db=require(_0x82bd('0x5'))['db'];var utils=require(_0x82bd('0x6'));var logger=require(_0x82bd('0x7'))('rpc');var config=require(_0x82bd('0x8'));var jayson=require(_0x82bd('0x9'));var client=jayson[_0x82bd('0xa')]['http']({'port':0x232a});config[_0x82bd('0xb')]=_[_0x82bd('0xc')](config[_0x82bd('0xb')],{'host':_0x82bd('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x82bd('0xb')]));require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x51c6ea,_0x5bb22c,_0x5f0434){return new BPromise(function(_0x4c9430,_0x36abe3){return client['request'](_0x51c6ea,_0x5f0434)['then'](function(_0x32821a){logger[_0x82bd('0xe')]('VoiceExtension,\x20%s,\x20%s',_0x5bb22c,_0x82bd('0xf'));logger['debug'](_0x82bd('0x10'),_0x5bb22c,'request\x20sent',JSON[_0x82bd('0x11')](_0x32821a));if(_0x32821a[_0x82bd('0x12')]){if(_0x32821a[_0x82bd('0x12')][_0x82bd('0x13')]===0x1f4){logger['error'](_0x82bd('0x14'),_0x5bb22c,_0x32821a[_0x82bd('0x12')]['message']);return _0x36abe3(_0x32821a[_0x82bd('0x12')]['message']);}logger[_0x82bd('0x12')](_0x82bd('0x14'),_0x5bb22c,_0x32821a[_0x82bd('0x12')][_0x82bd('0x15')]);return _0x4c9430(_0x32821a[_0x82bd('0x12')][_0x82bd('0x15')]);}else{logger[_0x82bd('0xe')](_0x82bd('0x14'),_0x5bb22c,_0x82bd('0xf'));_0x4c9430(_0x32821a[_0x82bd('0x16')][_0x82bd('0x15')]);}})[_0x82bd('0x17')](function(_0x1c3779){logger[_0x82bd('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x5bb22c,_0x1c3779);_0x36abe3(_0x1c3779);});});}exports['GetVoiceExtension']=function(_0x283ce7){var _0x3eb844=this;return new Promise(function(_0x2ee27c,_0xc9fcdf){return db[_0x82bd('0x18')][_0x82bd('0x19')]({'raw':_0x283ce7[_0x82bd('0x1a')]?_0x283ce7[_0x82bd('0x1a')][_0x82bd('0x1b')]===undefined?!![]:![]:!![],'where':_0x283ce7[_0x82bd('0x1a')]?_0x283ce7[_0x82bd('0x1a')][_0x82bd('0x1c')]||null:null,'attributes':_0x283ce7[_0x82bd('0x1a')]?_0x283ce7[_0x82bd('0x1a')][_0x82bd('0x1d')]||null:null,'limit':_0x283ce7[_0x82bd('0x1a')]?_0x283ce7[_0x82bd('0x1a')][_0x82bd('0x1e')]||null:null,'include':_0x283ce7[_0x82bd('0x1a')]?_0x283ce7['options']['include']?_[_0x82bd('0x1f')](_0x283ce7[_0x82bd('0x1a')][_0x82bd('0x20')],function(_0x3eb6a5){return{'model':db[_0x3eb6a5[_0x82bd('0x21')]],'as':_0x3eb6a5['as'],'attributes':_0x3eb6a5[_0x82bd('0x1d')],'include':_0x3eb6a5[_0x82bd('0x20')]?_[_0x82bd('0x1f')](_0x3eb6a5[_0x82bd('0x20')],function(_0x2add80){return{'model':db[_0x2add80['model']],'as':_0x2add80['as'],'attributes':_0x2add80['attributes'],'include':_0x2add80['include']?_['map'](_0x2add80[_0x82bd('0x20')],function(_0x52bcd8){return{'model':db[_0x52bcd8[_0x82bd('0x21')]],'as':_0x52bcd8['as'],'attributes':_0x52bcd8[_0x82bd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x82bd('0x22')](function(_0x50585e){logger['info']('GetVoiceExtension',_0x283ce7);logger[_0x82bd('0x23')](_0x82bd('0x24'),_0x283ce7,JSON[_0x82bd('0x11')](_0x50585e));_0x2ee27c(_0x50585e);})['catch'](function(_0x166c46){logger['error'](_0x82bd('0x24'),_0x166c46[_0x82bd('0x15')],_0x283ce7);_0xc9fcdf(_0x3eb844[_0x82bd('0x12')](0x1f4,_0x166c46[_0x82bd('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 9d862b6..9fe460f 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 _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x4ce734,_0x13b00d){var _0x17cd46=function(_0x388b29){while(--_0x388b29){_0x4ce734['push'](_0x4ce734['shift']());}};_0x17cd46(++_0x13b00d);}(_0x1261,0x144));var _0x1126=function(_0x49aa7d,_0x5d46d8){_0x49aa7d=_0x49aa7d-0x0;var _0xdd0d26=_0x1261[_0x49aa7d];return _0xdd0d26;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file +var _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x5ea1eb,_0xb356e9){var _0x366d60=function(_0x18a30b){while(--_0x18a30b){_0x5ea1eb['push'](_0x5ea1eb['shift']());}};_0x366d60(++_0xb356e9);}(_0xe14b,0x93));var _0xbe14=function(_0x157c7b,_0x199a92){_0x157c7b=_0x157c7b-0x0;var _0x37b43e=_0xe14b[_0x157c7b];return _0x37b43e;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index d1b21d4..6529d1b 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 _0xf2e3=['/:id','show','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','get'];(function(_0x21c88b,_0x24017d){var _0x3add90=function(_0x3c27b4){while(--_0x3c27b4){_0x21c88b['push'](_0x21c88b['shift']());}};_0x3add90(++_0x24017d);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xf2e3[_0x17406a];return _0x1501ff;};'use strict';var multer=require(_0x3f2e('0x0'));var util=require('util');var path=require(_0x3f2e('0x1'));var timeout=require(_0x3f2e('0x2'));var express=require(_0x3f2e('0x3'));var router=express[_0x3f2e('0x4')]();var fs_extra=require(_0x3f2e('0x5'));var auth=require(_0x3f2e('0x6'));var interaction=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var controller=require(_0x3f2e('0x9'));router['get']('/',auth[_0x3f2e('0xa')](),controller[_0x3f2e('0xb')]);router[_0x3f2e('0xc')](_0x3f2e('0xd'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0xe')]);router[_0x3f2e('0xc')](_0x3f2e('0xf'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x10')]);router[_0x3f2e('0x11')]('/',auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x12')]);router[_0x3f2e('0x13')](_0x3f2e('0xd'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x14')]);router[_0x3f2e('0x15')](_0x3f2e('0xd'),auth['isAuthenticated'](),controller[_0x3f2e('0x16')]);module[_0x3f2e('0x17')]=router; \ No newline at end of file +var _0xf072=['exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','update','delete','destroy'];(function(_0x528b76,_0x284875){var _0x2d7f70=function(_0x1a756b){while(--_0x1a756b){_0x528b76['push'](_0x528b76['shift']());}};_0x2d7f70(++_0x284875);}(_0xf072,0x1cf));var _0x2f07=function(_0x3c71e2,_0x247aeb){_0x3c71e2=_0x3c71e2-0x0;var _0x1a6cc0=_0xf072[_0x3c71e2];return _0x1a6cc0;};'use strict';var multer=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var path=require(_0x2f07('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f07('0x3'));var router=express['Router']();var fs_extra=require(_0x2f07('0x4'));var auth=require(_0x2f07('0x5'));var interaction=require(_0x2f07('0x6'));var config=require('../../config/environment');var controller=require(_0x2f07('0x7'));router[_0x2f07('0x8')]('/',auth[_0x2f07('0x9')](),controller[_0x2f07('0xa')]);router[_0x2f07('0x8')](_0x2f07('0xb'),auth[_0x2f07('0x9')](),controller[_0x2f07('0xc')]);router[_0x2f07('0x8')](_0x2f07('0xd'),auth[_0x2f07('0x9')](),controller[_0x2f07('0xe')]);router[_0x2f07('0xf')]('/',auth[_0x2f07('0x9')](),controller[_0x2f07('0x10')]);router['put'](_0x2f07('0xb'),auth[_0x2f07('0x9')](),controller[_0x2f07('0x11')]);router[_0x2f07('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x2f07('0x13')]);module[_0x2f07('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index b9ecf79..88d16c4 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 _0x58cc=['contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','VIRTUAL','\x20-\x20','getDataValue','sequelize','exports','STRING'];(function(_0x5acb94,_0x389dbc){var _0x11800a=function(_0xd36856){while(--_0xd36856){_0x5acb94['push'](_0x5acb94['shift']());}};_0x11800a(++_0x389dbc);}(_0x58cc,0x1bf));var _0xc58c=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0x58cc[_0x1e2321];return _0x1d346d;};'use strict';var Sequelize=require(_0xc58c('0x0'));module[_0xc58c('0x1')]={'customer_id':{'type':Sequelize[_0xc58c('0x2')]},'context':{'type':Sequelize[_0xc58c('0x2')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xc58c('0x2')],'defaultValue':'','allowNull':![],'unique':_0xc58c('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xc58c('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x16043b){this[_0xc58c('0x4')](_0xc58c('0x5'),typeof _0x16043b===_0xc58c('0x6')&&_0x16043b[_0xc58c('0x7')]()?_0x16043b[_0xc58c('0x7')]():null);}},'pager':{'type':Sequelize[_0xc58c('0x2')]},'tz':{'type':Sequelize[_0xc58c('0x2')],'defaultValue':_0xc58c('0x8')},'attach':{'type':Sequelize[_0xc58c('0x9')](_0xc58c('0xa'),'no'),'defaultValue':_0xc58c('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0xc58c('0x9')](_0xc58c('0xa'),'no'),'defaultValue':_0xc58c('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xc58c('0x2')]},'callback':{'type':Sequelize[_0xc58c('0x2')]},'review':{'type':Sequelize[_0xc58c('0x9')](_0xc58c('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xc58c('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xc58c('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xc58c('0x9')](_0xc58c('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xc58c('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xc58c('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xc58c('0x9')](_0xc58c('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xc58c('0x9')]('yes','no'),'defaultValue':_0xc58c('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xc58c('0x9')](_0xc58c('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xc58c('0x9')](_0xc58c('0xa'),'no'),'defaultValue':_0xc58c('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xc58c('0x2')]},'emailbody':{'type':Sequelize[_0xc58c('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xc58c('0xc')],'get':function(){return this['getDataValue']('fullname')+_0xc58c('0xd')+this[_0xc58c('0xe')]('mailbox');}}}; \ No newline at end of file +var _0x99dc=['sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','mailbox'];(function(_0x5b25af,_0x121dd7){var _0x181a07=function(_0x2462e1){while(--_0x2462e1){_0x5b25af['push'](_0x5b25af['shift']());}};_0x181a07(++_0x121dd7);}(_0x99dc,0x1cb));var _0xc99d=function(_0x61b3ab,_0x1fc298){_0x61b3ab=_0x61b3ab-0x0;var _0x57097f=_0x99dc[_0x61b3ab];return _0x57097f;};'use strict';var Sequelize=require(_0xc99d('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xc99d('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xc99d('0x2'),'unique':_0xc99d('0x3')},'mailbox':{'type':Sequelize[_0xc99d('0x1')],'defaultValue':'','allowNull':![],'unique':_0xc99d('0x3')},'password':{'type':Sequelize[_0xc99d('0x1')]},'fullname':{'type':Sequelize[_0xc99d('0x1')]},'email':{'type':Sequelize[_0xc99d('0x1')],'validate':{'isEmail':!![]},'set':function(_0x1ac778){this[_0xc99d('0x4')](_0xc99d('0x5'),typeof _0x1ac778===_0xc99d('0x6')&&_0x1ac778[_0xc99d('0x7')]()?_0x1ac778[_0xc99d('0x7')]():null);}},'pager':{'type':Sequelize[_0xc99d('0x1')]},'tz':{'type':Sequelize[_0xc99d('0x1')],'defaultValue':_0xc99d('0x8')},'attach':{'type':Sequelize[_0xc99d('0x9')]('yes','no'),'defaultValue':_0xc99d('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0xc99d('0x9')]('yes','no'),'defaultValue':_0xc99d('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xc99d('0x1')]},'callback':{'type':Sequelize[_0xc99d('0x1')]},'review':{'type':Sequelize['ENUM'](_0xc99d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xc99d('0x9')](_0xc99d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xc99d('0x9')](_0xc99d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xc99d('0x9')](_0xc99d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xc99d('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xc99d('0x9')](_0xc99d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xc99d('0x9')](_0xc99d('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xc99d('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xc99d('0x9')](_0xc99d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xc99d('0xa'),'no'),'defaultValue':_0xc99d('0xa'),'allowNull':![]},'stamp':{'type':_0xc99d('0xc')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xc99d('0x1')]},'maxsecs':{'type':Sequelize[_0xc99d('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xc99d('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xc99d('0xe')],'get':function(){return this[_0xc99d('0xf')]('fullname')+'\x20-\x20'+this[_0xc99d('0xf')](_0xc99d('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 70ff737..0ea134b 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 _0xeb74=['VoiceMail','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','findOne','VoiceMailMessage','nolimit','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','end','sendStatus','error','stack','name','send','map'];(function(_0x223913,_0x153889){var _0xaa257b=function(_0x3f141d){while(--_0x3f141d){_0x223913['push'](_0x223913['shift']());}};_0xaa257b(++_0x153889);}(_0xeb74,0xe3));var _0x4eb7=function(_0x2d6311,_0x5eee86){_0x2d6311=_0x2d6311-0x0;var _0xb38b61=_0xeb74[_0x2d6311];return _0xb38b61;};'use strict';var emlformat=require(_0x4eb7('0x0'));var rimraf=require(_0x4eb7('0x1'));var zipdir=require(_0x4eb7('0x2'));var jsonpatch=require(_0x4eb7('0x3'));var rp=require(_0x4eb7('0x4'));var moment=require(_0x4eb7('0x5'));var BPromise=require(_0x4eb7('0x6'));var Mustache=require('mustache');var util=require(_0x4eb7('0x7'));var path=require(_0x4eb7('0x8'));var sox=require(_0x4eb7('0x9'));var csv=require(_0x4eb7('0xa'));var ejs=require(_0x4eb7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4eb7('0xc'));var squel=require('squel');var crypto=require(_0x4eb7('0xd'));var jsforce=require(_0x4eb7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4eb7('0xf'));var Papa=require(_0x4eb7('0x10'));var Redis=require('ioredis');var authService=require(_0x4eb7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4eb7('0x12'));var hardwareService=require(_0x4eb7('0x13'));var logger=require(_0x4eb7('0x14'))('api');var utils=require(_0x4eb7('0x15'));var config=require(_0x4eb7('0x16'));var licenseUtil=require(_0x4eb7('0x17'));var db=require(_0x4eb7('0x18'))['db'];function respondWithStatusCode(_0x35fa89,_0x4194e1){_0x4194e1=_0x4194e1||0xcc;return function(_0x3c9f45){if(_0x3c9f45){return _0x35fa89['sendStatus'](_0x4194e1);}return _0x35fa89['status'](_0x4194e1)['end']();};}function respondWithResult(_0x17fb81,_0x51f09d){_0x51f09d=_0x51f09d||0xc8;return function(_0x84c68b){if(_0x84c68b){return _0x17fb81[_0x4eb7('0x19')](_0x51f09d)[_0x4eb7('0x1a')](_0x84c68b);}};}function respondWithFilteredResult(_0x1c4a97,_0x5d6d5){return function(_0x21433d){if(_0x21433d){var _0x11674f=typeof _0x5d6d5[_0x4eb7('0x1b')]===_0x4eb7('0x1c')&&typeof _0x5d6d5[_0x4eb7('0x1d')]==='undefined';var _0xb86bc9=_0x21433d[_0x4eb7('0x1e')];var _0x3b6d41=_0x11674f?0x0:_0x5d6d5[_0x4eb7('0x1b')];var _0x302e16=_0x11674f?_0x21433d[_0x4eb7('0x1e')]:_0x5d6d5[_0x4eb7('0x1b')]+_0x5d6d5[_0x4eb7('0x1d')];var _0x5f4780;if(_0x302e16>=_0xb86bc9){_0x302e16=_0xb86bc9;_0x5f4780=0xc8;}else{_0x5f4780=0xce;}_0x1c4a97[_0x4eb7('0x19')](_0x5f4780);return _0x1c4a97[_0x4eb7('0x1f')](_0x4eb7('0x20'),_0x3b6d41+'-'+_0x302e16+'/'+_0xb86bc9)[_0x4eb7('0x1a')](_0x21433d);}return null;};}function patchUpdates(_0x32f0f5){return function(_0x2efd67){try{jsonpatch[_0x4eb7('0x21')](_0x2efd67,_0x32f0f5,!![]);}catch(_0x4ddbe4){return BPromise[_0x4eb7('0x22')](_0x4ddbe4);}return _0x2efd67[_0x4eb7('0x23')]();};}function saveUpdates(_0x4783b1,_0x164515){return function(_0x14a7be){if(_0x14a7be){return _0x14a7be[_0x4eb7('0x24')](_0x4783b1)[_0x4eb7('0x25')](function(_0x2df1b1){return _0x2df1b1;});}return null;};}function removeEntity(_0x1a2b8b,_0x13e871){return function(_0x4de2d9){if(_0x4de2d9){return _0x4de2d9[_0x4eb7('0x26')]()[_0x4eb7('0x25')](function(){var _0x2e8de8=_0x4de2d9[_0x4eb7('0x27')]({'plain':!![]});var _0x3e0da2=_0x4eb7('0x28');return db[_0x4eb7('0x29')][_0x4eb7('0x26')]({'where':{'type':_0x3e0da2,'resourceId':_0x2e8de8['id']}})[_0x4eb7('0x25')](function(){return _0x4de2d9;});})[_0x4eb7('0x25')](function(){_0x1a2b8b[_0x4eb7('0x19')](0xcc)[_0x4eb7('0x2a')]();});}};}function handleEntityNotFound(_0x2d1773,_0x1b56a8){return function(_0x433794){if(!_0x433794){_0x2d1773[_0x4eb7('0x2b')](0x194);}return _0x433794;};}function handleError(_0x2be00c,_0x41e515){_0x41e515=_0x41e515||0x1f4;return function(_0x33a2c1){logger[_0x4eb7('0x2c')](_0x33a2c1[_0x4eb7('0x2d')]);if(_0x33a2c1[_0x4eb7('0x2e')]){delete _0x33a2c1[_0x4eb7('0x2e')];}_0x2be00c['status'](_0x41e515)[_0x4eb7('0x2f')](_0x33a2c1);};}exports['index']=function(_0x446872,_0x13f71a){var _0xc5aa21={},_0x1fe298={},_0x468195={'count':0x0,'rows':[]};var _0x1cec8e=_[_0x4eb7('0x30')](db[_0x4eb7('0x31')][_0x4eb7('0x32')],function(_0x4f8879){return{'name':_0x4f8879[_0x4eb7('0x33')],'type':_0x4f8879['type'][_0x4eb7('0x34')]};});_0x1fe298[_0x4eb7('0x35')]=_['map'](_0x1cec8e,'name');_0x1fe298[_0x4eb7('0x36')]=_[_0x4eb7('0x37')](_0x446872[_0x4eb7('0x36')]);_0x1fe298[_0x4eb7('0x38')]=_['intersection'](_0x1fe298[_0x4eb7('0x35')],_0x1fe298[_0x4eb7('0x36')]);_0xc5aa21[_0x4eb7('0x39')]=_[_0x4eb7('0x3a')](_0x1fe298[_0x4eb7('0x35')],qs['fields'](_0x446872[_0x4eb7('0x36')][_0x4eb7('0x3b')]));_0xc5aa21[_0x4eb7('0x39')]=_0xc5aa21['attributes'][_0x4eb7('0x3c')]?_0xc5aa21[_0x4eb7('0x39')]:_0x1fe298[_0x4eb7('0x35')];if(!_0x446872['query'][_0x4eb7('0x3d')]('nolimit')){_0xc5aa21[_0x4eb7('0x1d')]=qs[_0x4eb7('0x1d')](_0x446872[_0x4eb7('0x36')][_0x4eb7('0x1d')]);_0xc5aa21['offset']=qs[_0x4eb7('0x1b')](_0x446872[_0x4eb7('0x36')][_0x4eb7('0x1b')]);}_0xc5aa21[_0x4eb7('0x3e')]=qs['sort'](_0x446872['query']['sort']);_0xc5aa21[_0x4eb7('0x3f')]=qs[_0x4eb7('0x38')](_[_0x4eb7('0x40')](_0x446872[_0x4eb7('0x36')],_0x1fe298[_0x4eb7('0x38')]),_0x1cec8e);if(_0x446872[_0x4eb7('0x36')][_0x4eb7('0x41')]){_0xc5aa21[_0x4eb7('0x3f')]=_[_0x4eb7('0x42')](_0xc5aa21[_0x4eb7('0x3f')],{'$or':_['map'](_0x1cec8e,function(_0x5d0e51){if(_0x5d0e51[_0x4eb7('0x43')]!==_0x4eb7('0x44')){var _0x4597c8={};_0x4597c8[_0x5d0e51[_0x4eb7('0x2e')]]={'$like':'%'+_0x446872[_0x4eb7('0x36')][_0x4eb7('0x41')]+'%'};return _0x4597c8;}})});}_0xc5aa21=_[_0x4eb7('0x42')]({},_0xc5aa21,_0x446872[_0x4eb7('0x45')]);var _0x3a31ce={'where':_0xc5aa21[_0x4eb7('0x3f')]};return db[_0x4eb7('0x31')][_0x4eb7('0x1e')](_0x3a31ce)[_0x4eb7('0x25')](function(_0x38af1f){_0x468195[_0x4eb7('0x1e')]=_0x38af1f;if(_0x446872[_0x4eb7('0x36')][_0x4eb7('0x46')]){_0xc5aa21[_0x4eb7('0x47')]=[{'all':!![]}];}return db[_0x4eb7('0x31')]['findAll'](_0xc5aa21);})[_0x4eb7('0x25')](function(_0x2df542){_0x468195[_0x4eb7('0x48')]=_0x2df542;return _0x468195;})[_0x4eb7('0x25')](respondWithFilteredResult(_0x13f71a,_0xc5aa21))[_0x4eb7('0x49')](handleError(_0x13f71a,null));};exports[_0x4eb7('0x4a')]=function(_0x3cd9e5,_0x10fac2){var _0x3d6b0b={'raw':!![],'where':{'id':_0x3cd9e5[_0x4eb7('0x4b')]['id']}},_0x4969eb={};_0x4969eb['model']=_[_0x4eb7('0x37')](db[_0x4eb7('0x31')][_0x4eb7('0x32')]);_0x4969eb['query']=_[_0x4eb7('0x37')](_0x3cd9e5[_0x4eb7('0x36')]);_0x4969eb[_0x4eb7('0x38')]=_[_0x4eb7('0x3a')](_0x4969eb['model'],_0x4969eb[_0x4eb7('0x36')]);_0x3d6b0b['attributes']=_[_0x4eb7('0x3a')](_0x4969eb[_0x4eb7('0x35')],qs[_0x4eb7('0x3b')](_0x3cd9e5[_0x4eb7('0x36')][_0x4eb7('0x3b')]));_0x3d6b0b['attributes']=_0x3d6b0b['attributes'][_0x4eb7('0x3c')]?_0x3d6b0b[_0x4eb7('0x39')]:_0x4969eb[_0x4eb7('0x35')];if(_0x3cd9e5[_0x4eb7('0x36')][_0x4eb7('0x46')]){_0x3d6b0b['include']=[{'all':!![]}];}_0x3d6b0b=_[_0x4eb7('0x42')]({},_0x3d6b0b,_0x3cd9e5[_0x4eb7('0x45')]);return db['VoiceMail'][_0x4eb7('0x4c')](_0x3d6b0b)[_0x4eb7('0x25')](handleEntityNotFound(_0x10fac2,null))['then'](respondWithResult(_0x10fac2,null))[_0x4eb7('0x49')](handleError(_0x10fac2,null));};exports[_0x4eb7('0x4d')]=function(_0x3c8049,_0x5774d5){return db[_0x4eb7('0x31')]['create'](_0x3c8049['body'],{})[_0x4eb7('0x25')](function(_0x312e9b){var _0x32d7d6=_0x3c8049[_0x4eb7('0x4e')][_0x4eb7('0x27')]({'plain':!![]});if(!_0x32d7d6)throw new Error(_0x4eb7('0x4f'));if(_0x32d7d6[_0x4eb7('0x50')]===_0x4eb7('0x4e')){var _0x2913c5=_0x312e9b[_0x4eb7('0x27')]({'plain':!![]});var _0x42a1d9=_0x4eb7('0x28');return db[_0x4eb7('0x51')][_0x4eb7('0x4c')]({'where':{'name':_0x42a1d9,'userProfileId':_0x32d7d6[_0x4eb7('0x52')]},'raw':!![]})[_0x4eb7('0x25')](function(_0x327f1e){if(_0x327f1e&&_0x327f1e[_0x4eb7('0x53')]===0x0){return db[_0x4eb7('0x29')][_0x4eb7('0x4d')]({'name':_0x2913c5['name'],'resourceId':_0x2913c5['id'],'type':_0x327f1e[_0x4eb7('0x2e')],'sectionId':_0x327f1e['id']},{})['then'](function(){return _0x312e9b;});}else{return _0x312e9b;}})['catch'](function(_0x3f3a5f){logger[_0x4eb7('0x2c')](_0x4eb7('0x54'),_0x3f3a5f);throw _0x3f3a5f;});}return _0x312e9b;})[_0x4eb7('0x25')](respondWithResult(_0x5774d5,0xc9))[_0x4eb7('0x49')](handleError(_0x5774d5,null));};exports['update']=function(_0x4e3163,_0x2e5d28){if(_0x4e3163['body']['id']){delete _0x4e3163[_0x4eb7('0x55')]['id'];}return db[_0x4eb7('0x31')][_0x4eb7('0x4c')]({'where':{'id':_0x4e3163[_0x4eb7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2e5d28,null))[_0x4eb7('0x25')](saveUpdates(_0x4e3163[_0x4eb7('0x55')],null))[_0x4eb7('0x25')](respondWithResult(_0x2e5d28,null))[_0x4eb7('0x49')](handleError(_0x2e5d28,null));};exports['destroy']=function(_0x961de5,_0x340ffb){return db['VoiceMail'][_0x4eb7('0x4c')]({'where':{'id':_0x961de5[_0x4eb7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x340ffb,null))[_0x4eb7('0x25')](removeEntity(_0x340ffb,null))['catch'](handleError(_0x340ffb,null));};exports[_0x4eb7('0x56')]=function(_0x5be4ad,_0x13847e,_0x456fe7){return db[_0x4eb7('0x31')][_0x4eb7('0x57')]({'where':{'id':_0x5be4ad[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x13847e,null))['then'](function(_0x4a4fc5){var _0x1b8514;var _0x1b4afe={},_0x24d33d={};_0x24d33d[_0x4eb7('0x35')]=_['keys'](db[_0x4eb7('0x58')][_0x4eb7('0x32')]);_0x24d33d['query']=_[_0x4eb7('0x37')](_0x5be4ad[_0x4eb7('0x36')]);_0x24d33d[_0x4eb7('0x38')]=_[_0x4eb7('0x3a')](_0x24d33d[_0x4eb7('0x35')],_0x24d33d[_0x4eb7('0x36')]);_0x1b4afe[_0x4eb7('0x39')]=_['intersection'](_0x24d33d['model'],qs[_0x4eb7('0x3b')](_0x5be4ad['query'][_0x4eb7('0x3b')]));_0x1b4afe['attributes']=_0x1b4afe[_0x4eb7('0x39')]['length']?_0x1b4afe['attributes']:_0x24d33d[_0x4eb7('0x35')];if(!_0x5be4ad[_0x4eb7('0x36')]['hasOwnProperty'](_0x4eb7('0x59'))){_0x1b4afe['limit']=qs[_0x4eb7('0x1d')](_0x5be4ad[_0x4eb7('0x36')]['limit']);_0x1b4afe[_0x4eb7('0x1b')]=qs[_0x4eb7('0x1b')](_0x5be4ad['query']['offset']);}_0x1b4afe['order']=qs['sort'](_0x5be4ad[_0x4eb7('0x36')]['sort']);_0x1b4afe[_0x4eb7('0x3f')]=qs[_0x4eb7('0x38')](_['pick'](_0x5be4ad[_0x4eb7('0x36')],_0x24d33d[_0x4eb7('0x38')]));if(_0x5be4ad[_0x4eb7('0x36')][_0x4eb7('0x41')]){_0x1b4afe[_0x4eb7('0x3f')]=_[_0x4eb7('0x42')](_0x1b4afe['where'],{'$or':_['map'](_0x1b4afe['attributes'],function(_0x58d2c1){var _0x1775c4={};_0x1775c4[_0x58d2c1]={'$like':'%'+_0x5be4ad[_0x4eb7('0x36')][_0x4eb7('0x41')]+'%'};return _0x1775c4;})});}_0x1b4afe[_0x4eb7('0x3f')]=_['merge'](_0x1b4afe['where'],{'mailboxuser':_0x4a4fc5[_0x4eb7('0x5a')]});_0x1b4afe=_[_0x4eb7('0x42')]({},_0x1b4afe,_0x5be4ad[_0x4eb7('0x45')]);return db[_0x4eb7('0x58')][_0x4eb7('0x5b')](_0x1b4afe)['then'](respondWithFilteredResult(_0x13847e,_0x1b4afe));})[_0x4eb7('0x49')](handleError(_0x13847e,null));}; \ No newline at end of file +var _0x44a3=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','index','map','VoiceMail','fieldName','type','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','getMessages','findOne','params','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','desk.js','querystring'];(function(_0x50e4cb,_0x298882){var _0x5f2bcb=function(_0x6899bc){while(--_0x6899bc){_0x50e4cb['push'](_0x50e4cb['shift']());}};_0x5f2bcb(++_0x298882);}(_0x44a3,0x1a9));var _0x344a=function(_0x215dc8,_0x52c245){_0x215dc8=_0x215dc8-0x0;var _0x583ea3=_0x44a3[_0x215dc8];return _0x583ea3;};'use strict';var emlformat=require(_0x344a('0x0'));var rimraf=require(_0x344a('0x1'));var zipdir=require(_0x344a('0x2'));var jsonpatch=require(_0x344a('0x3'));var rp=require(_0x344a('0x4'));var moment=require(_0x344a('0x5'));var BPromise=require(_0x344a('0x6'));var Mustache=require(_0x344a('0x7'));var util=require('util');var path=require(_0x344a('0x8'));var sox=require(_0x344a('0x9'));var csv=require(_0x344a('0xa'));var ejs=require(_0x344a('0xb'));var fs=require('fs');var fs_extra=require(_0x344a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x344a('0xd'));var toCsv=require(_0x344a('0xa'));var querystring=require(_0x344a('0xe'));var Papa=require(_0x344a('0xf'));var Redis=require(_0x344a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x344a('0x11'));var as=require(_0x344a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x344a('0x13'))('api');var utils=require(_0x344a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x344a('0x15'));var db=require(_0x344a('0x16'))['db'];function respondWithStatusCode(_0x57e42e,_0x4a69ea){_0x4a69ea=_0x4a69ea||0xcc;return function(_0x304b70){if(_0x304b70){return _0x57e42e[_0x344a('0x17')](_0x4a69ea);}return _0x57e42e[_0x344a('0x18')](_0x4a69ea)[_0x344a('0x19')]();};}function respondWithResult(_0x5a0df6,_0x133ad4){_0x133ad4=_0x133ad4||0xc8;return function(_0x4ee562){if(_0x4ee562){return _0x5a0df6[_0x344a('0x18')](_0x133ad4)[_0x344a('0x1a')](_0x4ee562);}};}function respondWithFilteredResult(_0xce0f65,_0x6e1639){return function(_0x58c8cd){if(_0x58c8cd){var _0x54a643=typeof _0x6e1639[_0x344a('0x1b')]===_0x344a('0x1c')&&typeof _0x6e1639[_0x344a('0x1d')]===_0x344a('0x1c');var _0x48b3ab=_0x58c8cd[_0x344a('0x1e')];var _0x277c06=_0x54a643?0x0:_0x6e1639['offset'];var _0x9fe854=_0x54a643?_0x58c8cd[_0x344a('0x1e')]:_0x6e1639[_0x344a('0x1b')]+_0x6e1639[_0x344a('0x1d')];var _0x13b382;if(_0x9fe854>=_0x48b3ab){_0x9fe854=_0x48b3ab;_0x13b382=0xc8;}else{_0x13b382=0xce;}_0xce0f65[_0x344a('0x18')](_0x13b382);return _0xce0f65[_0x344a('0x1f')](_0x344a('0x20'),_0x277c06+'-'+_0x9fe854+'/'+_0x48b3ab)[_0x344a('0x1a')](_0x58c8cd);}return null;};}function patchUpdates(_0x450922){return function(_0x4b3552){try{jsonpatch[_0x344a('0x21')](_0x4b3552,_0x450922,!![]);}catch(_0x4232eb){return BPromise[_0x344a('0x22')](_0x4232eb);}return _0x4b3552[_0x344a('0x23')]();};}function saveUpdates(_0x240be3,_0x80ae12){return function(_0x185303){if(_0x185303){return _0x185303[_0x344a('0x24')](_0x240be3)[_0x344a('0x25')](function(_0x27f527){return _0x27f527;});}return null;};}function removeEntity(_0x90070c,_0x3b2ab9){return function(_0x5ce9da){if(_0x5ce9da){return _0x5ce9da[_0x344a('0x26')]()['then'](function(){var _0x6ccfba=_0x5ce9da['get']({'plain':!![]});var _0x2a5e49='Voicemails';return db[_0x344a('0x27')][_0x344a('0x26')]({'where':{'type':_0x2a5e49,'resourceId':_0x6ccfba['id']}})[_0x344a('0x25')](function(){return _0x5ce9da;});})[_0x344a('0x25')](function(){_0x90070c[_0x344a('0x18')](0xcc)[_0x344a('0x19')]();});}};}function handleEntityNotFound(_0x229ccd,_0x114637){return function(_0x4f2499){if(!_0x4f2499){_0x229ccd[_0x344a('0x17')](0x194);}return _0x4f2499;};}function handleError(_0x18be46,_0x26cf51){_0x26cf51=_0x26cf51||0x1f4;return function(_0xc02d6){logger[_0x344a('0x28')](_0xc02d6[_0x344a('0x29')]);if(_0xc02d6['name']){delete _0xc02d6[_0x344a('0x2a')];}_0x18be46['status'](_0x26cf51)['send'](_0xc02d6);};}exports[_0x344a('0x2b')]=function(_0x14fa86,_0x5a36bb){var _0x4803db={},_0x5cd9c6={},_0x5cafd2={'count':0x0,'rows':[]};var _0x16f490=_[_0x344a('0x2c')](db[_0x344a('0x2d')]['rawAttributes'],function(_0x25b28d){return{'name':_0x25b28d[_0x344a('0x2e')],'type':_0x25b28d[_0x344a('0x2f')][_0x344a('0x30')]};});_0x5cd9c6[_0x344a('0x31')]=_[_0x344a('0x2c')](_0x16f490,_0x344a('0x2a'));_0x5cd9c6['query']=_[_0x344a('0x32')](_0x14fa86['query']);_0x5cd9c6['filters']=_['intersection'](_0x5cd9c6[_0x344a('0x31')],_0x5cd9c6[_0x344a('0x33')]);_0x4803db[_0x344a('0x34')]=_[_0x344a('0x35')](_0x5cd9c6[_0x344a('0x31')],qs[_0x344a('0x36')](_0x14fa86['query'][_0x344a('0x36')]));_0x4803db[_0x344a('0x34')]=_0x4803db[_0x344a('0x34')]['length']?_0x4803db[_0x344a('0x34')]:_0x5cd9c6[_0x344a('0x31')];if(!_0x14fa86[_0x344a('0x33')][_0x344a('0x37')](_0x344a('0x38'))){_0x4803db['limit']=qs[_0x344a('0x1d')](_0x14fa86[_0x344a('0x33')][_0x344a('0x1d')]);_0x4803db[_0x344a('0x1b')]=qs[_0x344a('0x1b')](_0x14fa86['query'][_0x344a('0x1b')]);}_0x4803db[_0x344a('0x39')]=qs[_0x344a('0x3a')](_0x14fa86[_0x344a('0x33')][_0x344a('0x3a')]);_0x4803db['where']=qs[_0x344a('0x3b')](_[_0x344a('0x3c')](_0x14fa86[_0x344a('0x33')],_0x5cd9c6[_0x344a('0x3b')]),_0x16f490);if(_0x14fa86[_0x344a('0x33')][_0x344a('0x3d')]){_0x4803db[_0x344a('0x3e')]=_[_0x344a('0x3f')](_0x4803db['where'],{'$or':_[_0x344a('0x2c')](_0x16f490,function(_0x371c68){if(_0x371c68[_0x344a('0x2f')]!==_0x344a('0x40')){var _0x2fc05f={};_0x2fc05f[_0x371c68['name']]={'$like':'%'+_0x14fa86[_0x344a('0x33')][_0x344a('0x3d')]+'%'};return _0x2fc05f;}})});}_0x4803db=_[_0x344a('0x3f')]({},_0x4803db,_0x14fa86[_0x344a('0x41')]);var _0x2f5132={'where':_0x4803db[_0x344a('0x3e')]};return db[_0x344a('0x2d')][_0x344a('0x1e')](_0x2f5132)[_0x344a('0x25')](function(_0x4b1bac){_0x5cafd2[_0x344a('0x1e')]=_0x4b1bac;if(_0x14fa86[_0x344a('0x33')][_0x344a('0x42')]){_0x4803db[_0x344a('0x43')]=[{'all':!![]}];}return db['VoiceMail'][_0x344a('0x44')](_0x4803db);})[_0x344a('0x25')](function(_0x2b0ee9){_0x5cafd2[_0x344a('0x45')]=_0x2b0ee9;return _0x5cafd2;})[_0x344a('0x25')](respondWithFilteredResult(_0x5a36bb,_0x4803db))[_0x344a('0x46')](handleError(_0x5a36bb,null));};exports[_0x344a('0x47')]=function(_0x372e7d,_0x483c39){var _0x4509be={'raw':!![],'where':{'id':_0x372e7d['params']['id']}},_0x2de5aa={};_0x2de5aa[_0x344a('0x31')]=_[_0x344a('0x32')](db['VoiceMail'][_0x344a('0x48')]);_0x2de5aa[_0x344a('0x33')]=_['keys'](_0x372e7d[_0x344a('0x33')]);_0x2de5aa[_0x344a('0x3b')]=_['intersection'](_0x2de5aa[_0x344a('0x31')],_0x2de5aa[_0x344a('0x33')]);_0x4509be[_0x344a('0x34')]=_['intersection'](_0x2de5aa[_0x344a('0x31')],qs['fields'](_0x372e7d[_0x344a('0x33')][_0x344a('0x36')]));_0x4509be[_0x344a('0x34')]=_0x4509be[_0x344a('0x34')]['length']?_0x4509be['attributes']:_0x2de5aa[_0x344a('0x31')];if(_0x372e7d[_0x344a('0x33')][_0x344a('0x42')]){_0x4509be[_0x344a('0x43')]=[{'all':!![]}];}_0x4509be=_[_0x344a('0x3f')]({},_0x4509be,_0x372e7d[_0x344a('0x41')]);return db[_0x344a('0x2d')][_0x344a('0x49')](_0x4509be)[_0x344a('0x25')](handleEntityNotFound(_0x483c39,null))[_0x344a('0x25')](respondWithResult(_0x483c39,null))['catch'](handleError(_0x483c39,null));};exports[_0x344a('0x4a')]=function(_0x2d9858,_0x6fad37){return db[_0x344a('0x2d')]['create'](_0x2d9858[_0x344a('0x4b')],{})['then'](function(_0x590f77){var _0xa6b6b5=_0x2d9858[_0x344a('0x4c')]['get']({'plain':!![]});if(!_0xa6b6b5)throw new Error(_0x344a('0x4d'));if(_0xa6b6b5[_0x344a('0x4e')]===_0x344a('0x4c')){var _0x226f41=_0x590f77['get']({'plain':!![]});var _0x225fce=_0x344a('0x4f');return db[_0x344a('0x50')][_0x344a('0x49')]({'where':{'name':_0x225fce,'userProfileId':_0xa6b6b5[_0x344a('0x51')]},'raw':!![]})[_0x344a('0x25')](function(_0x45232c){if(_0x45232c&&_0x45232c[_0x344a('0x52')]===0x0){return db[_0x344a('0x27')][_0x344a('0x4a')]({'name':_0x226f41['name'],'resourceId':_0x226f41['id'],'type':_0x45232c[_0x344a('0x2a')],'sectionId':_0x45232c['id']},{})['then'](function(){return _0x590f77;});}else{return _0x590f77;}})[_0x344a('0x46')](function(_0xb744c6){logger[_0x344a('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb744c6);throw _0xb744c6;});}return _0x590f77;})[_0x344a('0x25')](respondWithResult(_0x6fad37,0xc9))[_0x344a('0x46')](handleError(_0x6fad37,null));};exports[_0x344a('0x24')]=function(_0x14921e,_0x346cf3){if(_0x14921e[_0x344a('0x4b')]['id']){delete _0x14921e[_0x344a('0x4b')]['id'];}return db[_0x344a('0x2d')][_0x344a('0x49')]({'where':{'id':_0x14921e['params']['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x346cf3,null))[_0x344a('0x25')](saveUpdates(_0x14921e[_0x344a('0x4b')],null))[_0x344a('0x25')](respondWithResult(_0x346cf3,null))[_0x344a('0x46')](handleError(_0x346cf3,null));};exports['destroy']=function(_0x33077f,_0x163047){return db[_0x344a('0x2d')][_0x344a('0x49')]({'where':{'id':_0x33077f['params']['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x163047,null))[_0x344a('0x25')](removeEntity(_0x163047,null))['catch'](handleError(_0x163047,null));};exports[_0x344a('0x53')]=function(_0x11d301,_0x16482c,_0x2ea2ad){return db[_0x344a('0x2d')][_0x344a('0x54')]({'where':{'id':_0x11d301[_0x344a('0x55')]['id']}})['then'](handleEntityNotFound(_0x16482c,null))['then'](function(_0x4d707b){var _0x41dc89;var _0x450a64={},_0x2acfc0={};_0x2acfc0[_0x344a('0x31')]=_['keys'](db[_0x344a('0x56')]['rawAttributes']);_0x2acfc0['query']=_['keys'](_0x11d301['query']);_0x2acfc0[_0x344a('0x3b')]=_[_0x344a('0x35')](_0x2acfc0[_0x344a('0x31')],_0x2acfc0[_0x344a('0x33')]);_0x450a64['attributes']=_['intersection'](_0x2acfc0['model'],qs[_0x344a('0x36')](_0x11d301[_0x344a('0x33')][_0x344a('0x36')]));_0x450a64[_0x344a('0x34')]=_0x450a64[_0x344a('0x34')]['length']?_0x450a64[_0x344a('0x34')]:_0x2acfc0[_0x344a('0x31')];if(!_0x11d301[_0x344a('0x33')]['hasOwnProperty'](_0x344a('0x38'))){_0x450a64['limit']=qs['limit'](_0x11d301[_0x344a('0x33')]['limit']);_0x450a64['offset']=qs[_0x344a('0x1b')](_0x11d301[_0x344a('0x33')]['offset']);}_0x450a64[_0x344a('0x39')]=qs['sort'](_0x11d301[_0x344a('0x33')][_0x344a('0x3a')]);_0x450a64[_0x344a('0x3e')]=qs['filters'](_['pick'](_0x11d301[_0x344a('0x33')],_0x2acfc0[_0x344a('0x3b')]));if(_0x11d301[_0x344a('0x33')][_0x344a('0x3d')]){_0x450a64['where']=_['merge'](_0x450a64[_0x344a('0x3e')],{'$or':_[_0x344a('0x2c')](_0x450a64[_0x344a('0x34')],function(_0x4f5119){var _0x827f2e={};_0x827f2e[_0x4f5119]={'$like':'%'+_0x11d301[_0x344a('0x33')]['filter']+'%'};return _0x827f2e;})});}_0x450a64[_0x344a('0x3e')]=_['merge'](_0x450a64[_0x344a('0x3e')],{'mailboxuser':_0x4d707b['mailbox']});_0x450a64=_['merge']({},_0x450a64,_0x11d301['options']);return db[_0x344a('0x56')][_0x344a('0x57')](_0x450a64)[_0x344a('0x25')](respondWithFilteredResult(_0x16482c,_0x450a64));})[_0x344a('0x46')](handleError(_0x16482c,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 09df371..ae02a5e 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 _0x2ee1=['./voiceMail.attributes','define','voice_voicemail','mailbox_context','context','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x190089,_0x1ec572){var _0x180315=function(_0x374e1f){while(--_0x374e1f){_0x190089['push'](_0x190089['shift']());}};_0x180315(++_0x1ec572);}(_0x2ee1,0xad));var _0x12ee=function(_0x1ac247,_0x2af2b5){_0x1ac247=_0x1ac247-0x0;var _0xb4dee8=_0x2ee1[_0x1ac247];return _0xb4dee8;};'use strict';var _=require(_0x12ee('0x0'));var util=require(_0x12ee('0x1'));var logger=require(_0x12ee('0x2'))('api');var moment=require(_0x12ee('0x3'));var BPromise=require(_0x12ee('0x4'));var rp=require(_0x12ee('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x12ee('0x6'));var config=require('../../config/environment');var attributes=require(_0x12ee('0x7'));module['exports']=function(_0x2f2110,_0x3c3070){return _0x2f2110[_0x12ee('0x8')]('VoiceMail',attributes,{'tableName':_0x12ee('0x9'),'paranoid':![],'indexes':[{'name':_0x12ee('0xa'),'fields':['mailbox',_0x12ee('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x65f4=['voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','define','VoiceMail'];(function(_0x3acfdc,_0x1c9def){var _0x1eb97a=function(_0x1bc276){while(--_0x1bc276){_0x3acfdc['push'](_0x3acfdc['shift']());}};_0x1eb97a(++_0x1c9def);}(_0x65f4,0x104));var _0x465f=function(_0x278d80,_0x22be81){_0x278d80=_0x278d80-0x0;var _0x3be1cb=_0x65f4[_0x278d80];return _0x3be1cb;};'use strict';var _=require(_0x465f('0x0'));var util=require(_0x465f('0x1'));var logger=require(_0x465f('0x2'))(_0x465f('0x3'));var moment=require(_0x465f('0x4'));var BPromise=require('bluebird');var rp=require(_0x465f('0x5'));var fs=require('fs');var path=require(_0x465f('0x6'));var rimraf=require(_0x465f('0x7'));var config=require(_0x465f('0x8'));var attributes=require(_0x465f('0x9'));module['exports']=function(_0x4be6d5,_0x361914){return _0x4be6d5[_0x465f('0xa')](_0x465f('0xb'),attributes,{'tableName':_0x465f('0xc'),'paranoid':![],'indexes':[{'name':_0x465f('0xd'),'fields':[_0x465f('0xe'),_0x465f('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 8c22fd5..10f5ac9 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 _0xa9a2=['then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x3ee5df,_0x583073){var _0x446d24=function(_0x12e54e){while(--_0x12e54e){_0x3ee5df['push'](_0x3ee5df['shift']());}};_0x446d24(++_0x583073);}(_0xa9a2,0xe6));var _0x2a9a=function(_0x4608ac,_0x340cd9){_0x4608ac=_0x4608ac-0x0;var _0x318daa=_0xa9a2[_0x4608ac];return _0x318daa;};'use strict';var _=require(_0x2a9a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2a9a('0x1'));var rs=require(_0x2a9a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a9a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2a9a('0x4'))(_0x2a9a('0x5'));var config=require(_0x2a9a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2a9a('0x7')][_0x2a9a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22d6cb,_0x2eedcf,_0x227080){return new BPromise(function(_0x1de09a,_0x23f655){return client[_0x2a9a('0x9')](_0x22d6cb,_0x227080)[_0x2a9a('0xa')](function(_0x4bcf0b){logger[_0x2a9a('0xb')](_0x2a9a('0xc'),_0x2eedcf,_0x2a9a('0xd'));logger[_0x2a9a('0xe')](_0x2a9a('0xf'),_0x2eedcf,_0x2a9a('0xd'),JSON[_0x2a9a('0x10')](_0x4bcf0b));if(_0x4bcf0b['error']){if(_0x4bcf0b[_0x2a9a('0x11')][_0x2a9a('0x12')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x2eedcf,_0x4bcf0b[_0x2a9a('0x11')][_0x2a9a('0x13')]);return _0x23f655(_0x4bcf0b[_0x2a9a('0x11')][_0x2a9a('0x13')]);}logger[_0x2a9a('0x11')](_0x2a9a('0xc'),_0x2eedcf,_0x4bcf0b[_0x2a9a('0x11')]['message']);return _0x1de09a(_0x4bcf0b['error']['message']);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x2eedcf,_0x2a9a('0xd'));_0x1de09a(_0x4bcf0b['result'][_0x2a9a('0x13')]);}})['catch'](function(_0x1cd4cb){logger[_0x2a9a('0x11')](_0x2a9a('0xc'),_0x2eedcf,_0x1cd4cb);_0x23f655(_0x1cd4cb);});});} \ No newline at end of file +var _0xbadd=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbadd,0x14c));var _0xdbad=function(_0x3388d8,_0x256024){_0x3388d8=_0x3388d8-0x0;var _0x2bbe73=_0xbadd[_0x3388d8];return _0x2bbe73;};'use strict';var _=require(_0xdbad('0x0'));var util=require(_0xdbad('0x1'));var moment=require('moment');var BPromise=require(_0xdbad('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdbad('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdbad('0x4'));var logger=require(_0xdbad('0x5'))(_0xdbad('0x6'));var config=require(_0xdbad('0x7'));var jayson=require(_0xdbad('0x8'));var client=jayson[_0xdbad('0x9')][_0xdbad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fece4,_0x31e6f8,_0x5c3a4f){return new BPromise(function(_0x49db9a,_0x5d865e){return client[_0xdbad('0xb')](_0x3fece4,_0x5c3a4f)[_0xdbad('0xc')](function(_0x3e18ac){logger[_0xdbad('0xd')]('VoiceMail,\x20%s,\x20%s',_0x31e6f8,'request\x20sent');logger[_0xdbad('0xe')](_0xdbad('0xf'),_0x31e6f8,_0xdbad('0x10'),JSON[_0xdbad('0x11')](_0x3e18ac));if(_0x3e18ac[_0xdbad('0x12')]){if(_0x3e18ac[_0xdbad('0x12')][_0xdbad('0x13')]===0x1f4){logger[_0xdbad('0x12')](_0xdbad('0x14'),_0x31e6f8,_0x3e18ac['error'][_0xdbad('0x15')]);return _0x5d865e(_0x3e18ac[_0xdbad('0x12')]['message']);}logger[_0xdbad('0x12')]('VoiceMail,\x20%s,\x20%s',_0x31e6f8,_0x3e18ac[_0xdbad('0x12')][_0xdbad('0x15')]);return _0x49db9a(_0x3e18ac[_0xdbad('0x12')]['message']);}else{logger[_0xdbad('0xd')](_0xdbad('0x14'),_0x31e6f8,_0xdbad('0x10'));_0x49db9a(_0x3e18ac[_0xdbad('0x16')][_0xdbad('0x15')]);}})[_0xdbad('0x17')](function(_0x47be00){logger[_0xdbad('0x12')](_0xdbad('0x14'),_0x31e6f8,_0x47be00);_0x5d865e(_0x47be00);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 33e23fe..806f5e8 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 _0xc182=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','isAuthenticated','index','get','show','/:id/download','download','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x2ce210,_0x23471d){var _0x1f320e=function(_0x16544d){while(--_0x16544d){_0x2ce210['push'](_0x2ce210['shift']());}};_0x1f320e(++_0x23471d);}(_0xc182,0x8a));var _0x2c18=function(_0x520088,_0x2f419c){_0x520088=_0x520088-0x0;var _0xe9314a=_0xc182[_0x520088];return _0xe9314a;};'use strict';var multer=require(_0x2c18('0x0'));var util=require('util');var path=require(_0x2c18('0x1'));var timeout=require(_0x2c18('0x2'));var express=require(_0x2c18('0x3'));var router=express[_0x2c18('0x4')]();var fs_extra=require(_0x2c18('0x5'));var auth=require(_0x2c18('0x6'));var interaction=require(_0x2c18('0x7'));var config=require('../../config/environment');var controller=require(_0x2c18('0x8'));router['get']('/',auth[_0x2c18('0x9')](),controller[_0x2c18('0xa')]);router[_0x2c18('0xb')]('/:id',auth[_0x2c18('0x9')](),controller[_0x2c18('0xc')]);router['get'](_0x2c18('0xd'),auth['isAuthenticated'](),controller[_0x2c18('0xe')]);router[_0x2c18('0xf')]('/',auth[_0x2c18('0x9')](),controller[_0x2c18('0x10')]);router[_0x2c18('0x11')](_0x2c18('0x12'),auth[_0x2c18('0x9')](),controller[_0x2c18('0x13')]);router[_0x2c18('0x14')](_0x2c18('0x12'),auth['isAuthenticated'](),controller[_0x2c18('0x15')]);module[_0x2c18('0x16')]=router; \ No newline at end of file +var _0x9fc9=['get','index','/:id','isAuthenticated','show','/:id/download','create','put','update','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller'];(function(_0x150c2a,_0x2818b7){var _0x2afe08=function(_0x3b2fc5){while(--_0x3b2fc5){_0x150c2a['push'](_0x150c2a['shift']());}};_0x2afe08(++_0x2818b7);}(_0x9fc9,0x173));var _0x99fc=function(_0x3710fe,_0x1d3a9c){_0x3710fe=_0x3710fe-0x0;var _0xc7b1fe=_0x9fc9[_0x3710fe];return _0xc7b1fe;};'use strict';var multer=require('multer');var util=require(_0x99fc('0x0'));var path=require(_0x99fc('0x1'));var timeout=require('connect-timeout');var express=require(_0x99fc('0x2'));var router=express[_0x99fc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x99fc('0x4'));var interaction=require(_0x99fc('0x5'));var config=require('../../config/environment');var controller=require(_0x99fc('0x6'));router[_0x99fc('0x7')]('/',auth['isAuthenticated'](),controller[_0x99fc('0x8')]);router[_0x99fc('0x7')](_0x99fc('0x9'),auth[_0x99fc('0xa')](),controller[_0x99fc('0xb')]);router['get'](_0x99fc('0xc'),auth[_0x99fc('0xa')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x99fc('0xd')]);router[_0x99fc('0xe')](_0x99fc('0x9'),auth[_0x99fc('0xa')](),controller[_0x99fc('0xf')]);router[_0x99fc('0x10')]('/:id',auth[_0x99fc('0xa')](),controller['destroy']);module[_0x99fc('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 4e41d48..3e81961 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 _0xc985=['INTEGER','STRING','BLOB','long','TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x4f5586,_0x5e5860){var _0x27c5a1=function(_0x2294db){while(--_0x2294db){_0x4f5586['push'](_0x4f5586['shift']());}};_0x27c5a1(++_0x5e5860);}(_0xc985,0x12e));var _0x5c98=function(_0x42b5e2,_0x1f6c9d){_0x42b5e2=_0x42b5e2-0x0;var _0x335026=_0xc985[_0x42b5e2];return _0x335026;};'use strict';var Sequelize=require(_0x5c98('0x0'));module[_0x5c98('0x1')]={'name':{'type':Sequelize[_0x5c98('0x2')],'get':function(_0x4b14e7){return this[_0x5c98('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x5c98('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x5c98('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x5c98('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x5c98('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x5c98('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x5c98('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x5c98('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x5c98('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x5c98('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x5c98('0x6')](_0x5c98('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x5c98('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x5c98('0x8'),'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x1ffb=['literal','exports','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0x416b3a,_0x3ffeda){var _0x49ffcc=function(_0x201350){while(--_0x201350){_0x416b3a['push'](_0x416b3a['shift']());}};_0x49ffcc(++_0x3ffeda);}(_0x1ffb,0x1ed));var _0xb1ff=function(_0x5918e7,_0xe7ea50){_0x5918e7=_0x5918e7-0x0;var _0x167b79=_0x1ffb[_0x5918e7];return _0x167b79;};'use strict';var Sequelize=require('sequelize');module[_0xb1ff('0x0')]={'name':{'type':Sequelize[_0xb1ff('0x1')],'get':function(_0x19810b){return this[_0xb1ff('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xb1ff('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xb1ff('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xb1ff('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xb1ff('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xb1ff('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xb1ff('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xb1ff('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xb1ff('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xb1ff('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index e2e3bf5..291c04c 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 _0x0226=['attachment;\x20filename=\x22','.wav\x22','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../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','error','name','map','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','VoiceMailMessage','includeAll','include','findAll','show','options','find','catch','create','body','params','download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition'];(function(_0x5e6380,_0x41bd40){var _0x48494=function(_0x5d706b){while(--_0x5d706b){_0x5e6380['push'](_0x5e6380['shift']());}};_0x48494(++_0x41bd40);}(_0x0226,0x1a2));var _0x6022=function(_0x1bc42d,_0x1b8a92){_0x1bc42d=_0x1bc42d-0x0;var _0x2a4351=_0x0226[_0x1bc42d];return _0x2a4351;};'use strict';var emlformat=require(_0x6022('0x0'));var rimraf=require(_0x6022('0x1'));var zipdir=require(_0x6022('0x2'));var jsonpatch=require(_0x6022('0x3'));var rp=require(_0x6022('0x4'));var moment=require('moment');var BPromise=require(_0x6022('0x5'));var Mustache=require(_0x6022('0x6'));var util=require(_0x6022('0x7'));var path=require(_0x6022('0x8'));var sox=require(_0x6022('0x9'));var csv=require('to-csv');var ejs=require(_0x6022('0xa'));var fs=require('fs');var fs_extra=require(_0x6022('0xb'));var _=require('lodash');var squel=require(_0x6022('0xc'));var crypto=require(_0x6022('0xd'));var jsforce=require(_0x6022('0xe'));var deskjs=require(_0x6022('0xf'));var toCsv=require(_0x6022('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6022('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6022('0x12'));var as=require(_0x6022('0x13'));var hardwareService=require(_0x6022('0x14'));var logger=require(_0x6022('0x15'))(_0x6022('0x16'));var utils=require(_0x6022('0x17'));var config=require(_0x6022('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3af57f,_0x25fcbe){_0x25fcbe=_0x25fcbe||0xcc;return function(_0x310bcc){if(_0x310bcc){return _0x3af57f[_0x6022('0x19')](_0x25fcbe);}return _0x3af57f[_0x6022('0x1a')](_0x25fcbe)[_0x6022('0x1b')]();};}function respondWithResult(_0x5c4281,_0x1be826){_0x1be826=_0x1be826||0xc8;return function(_0x441faa){if(_0x441faa){return _0x5c4281[_0x6022('0x1a')](_0x1be826)[_0x6022('0x1c')](_0x441faa);}};}function respondWithFilteredResult(_0x2bd0cb,_0x5ed210){return function(_0x37dbfc){if(_0x37dbfc){var _0x38f333=typeof _0x5ed210[_0x6022('0x1d')]==='undefined'&&typeof _0x5ed210['limit']===_0x6022('0x1e');var _0x45bad6=_0x37dbfc['count'];var _0x13e759=_0x38f333?0x0:_0x5ed210[_0x6022('0x1d')];var _0x4c3484=_0x38f333?_0x37dbfc[_0x6022('0x1f')]:_0x5ed210['offset']+_0x5ed210[_0x6022('0x20')];var _0x583737;if(_0x4c3484>=_0x45bad6){_0x4c3484=_0x45bad6;_0x583737=0xc8;}else{_0x583737=0xce;}_0x2bd0cb[_0x6022('0x1a')](_0x583737);return _0x2bd0cb[_0x6022('0x21')](_0x6022('0x22'),_0x13e759+'-'+_0x4c3484+'/'+_0x45bad6)[_0x6022('0x1c')](_0x37dbfc);}return null;};}function patchUpdates(_0x221ae3){return function(_0x33ec22){try{jsonpatch[_0x6022('0x23')](_0x33ec22,_0x221ae3,!![]);}catch(_0x5269c5){return BPromise[_0x6022('0x24')](_0x5269c5);}return _0x33ec22[_0x6022('0x25')]();};}function saveUpdates(_0x5bff47,_0x3798cf){return function(_0x963b0){if(_0x963b0){return _0x963b0[_0x6022('0x26')](_0x5bff47)[_0x6022('0x27')](function(_0x3f6940){return _0x3f6940;});}return null;};}function removeEntity(_0x412fd4,_0x1cb415){return function(_0x31ca95){if(_0x31ca95){return _0x31ca95[_0x6022('0x28')]()['then'](function(){_0x412fd4[_0x6022('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13df03,_0x348da9){return function(_0x1df1db){if(!_0x1df1db){_0x13df03[_0x6022('0x19')](0x194);}return _0x1df1db;};}function handleError(_0x2e3ec4,_0x3fd3da){_0x3fd3da=_0x3fd3da||0x1f4;return function(_0x18ae66){logger[_0x6022('0x29')](_0x18ae66['stack']);if(_0x18ae66[_0x6022('0x2a')]){delete _0x18ae66['name'];}_0x2e3ec4['status'](_0x3fd3da)['send'](_0x18ae66);};}exports['index']=function(_0x1241be,_0x656103){var _0x5f574f={},_0x50a5b1={},_0x3ef208={'count':0x0,'rows':[]};var _0x4a8217=_[_0x6022('0x2b')](db['VoiceMailMessage'][_0x6022('0x2c')],function(_0x1758d2){return{'name':_0x1758d2[_0x6022('0x2d')],'type':_0x1758d2['type'][_0x6022('0x2e')]};});_0x50a5b1[_0x6022('0x2f')]=_[_0x6022('0x30')](_[_0x6022('0x2b')](_0x4a8217,_0x6022('0x2a')),['name']);_0x50a5b1[_0x6022('0x31')]=_[_0x6022('0x32')](_0x1241be['query']);_0x50a5b1[_0x6022('0x33')]=_[_0x6022('0x34')](_0x50a5b1[_0x6022('0x2f')],_0x50a5b1['query']);_0x5f574f[_0x6022('0x35')]=_[_0x6022('0x34')](_0x50a5b1[_0x6022('0x2f')],qs['fields'](_0x1241be[_0x6022('0x31')]['fields']));_0x5f574f['attributes']=_0x5f574f[_0x6022('0x35')][_0x6022('0x36')]?_0x5f574f[_0x6022('0x35')]:_0x50a5b1['model'];if(!_0x1241be['query'][_0x6022('0x37')]('nolimit')){_0x5f574f[_0x6022('0x20')]=qs[_0x6022('0x20')](_0x1241be['query']['limit']);_0x5f574f[_0x6022('0x1d')]=qs[_0x6022('0x1d')](_0x1241be[_0x6022('0x31')][_0x6022('0x1d')]);}_0x5f574f['order']=qs[_0x6022('0x38')](_0x1241be[_0x6022('0x31')][_0x6022('0x38')]);_0x5f574f[_0x6022('0x39')]=qs[_0x6022('0x33')](_[_0x6022('0x3a')](_0x1241be[_0x6022('0x31')],_0x50a5b1[_0x6022('0x33')]),_0x4a8217);if(_0x1241be['query'][_0x6022('0x3b')]){_0x5f574f[_0x6022('0x39')]=_[_0x6022('0x3c')](_0x5f574f[_0x6022('0x39')],{'$or':_[_0x6022('0x2b')](_0x4a8217,function(_0x24bf96){if(_0x24bf96['type']!==_0x6022('0x3d')){var _0x579be4={};_0x579be4[_0x24bf96['name']]={'$like':'%'+_0x1241be['query'][_0x6022('0x3b')]+'%'};return _0x579be4;}})});}_0x5f574f=_['merge']({},_0x5f574f,_0x1241be['options']);var _0x461975={'where':_0x5f574f[_0x6022('0x39')]};return db[_0x6022('0x3e')][_0x6022('0x1f')](_0x461975)[_0x6022('0x27')](function(_0x541201){_0x3ef208[_0x6022('0x1f')]=_0x541201;if(_0x1241be['query'][_0x6022('0x3f')]){_0x5f574f[_0x6022('0x40')]=[{'all':!![]}];}return db[_0x6022('0x3e')][_0x6022('0x41')](_0x5f574f);})[_0x6022('0x27')](function(_0x3f6f19){_0x3ef208['rows']=_0x3f6f19;return _0x3ef208;})[_0x6022('0x27')](respondWithFilteredResult(_0x656103,_0x5f574f))['catch'](handleError(_0x656103,null));};exports[_0x6022('0x42')]=function(_0x583ad2,_0x36fd53){var _0x336135={'raw':!![],'where':{'id':_0x583ad2['params']['id']}},_0x701ba4={};_0x701ba4[_0x6022('0x2f')]=_[_0x6022('0x32')](db[_0x6022('0x3e')]['rawAttributes']);_0x701ba4[_0x6022('0x31')]=_[_0x6022('0x32')](_0x583ad2[_0x6022('0x31')]);_0x701ba4[_0x6022('0x33')]=_[_0x6022('0x34')](_0x701ba4[_0x6022('0x2f')],_0x701ba4[_0x6022('0x31')]);_0x336135['attributes']=_[_0x6022('0x34')](_0x701ba4[_0x6022('0x2f')],qs['fields'](_0x583ad2[_0x6022('0x31')]['fields']));_0x336135[_0x6022('0x35')]=_0x336135[_0x6022('0x35')][_0x6022('0x36')]?_0x336135['attributes']:_0x701ba4[_0x6022('0x2f')];if(_0x583ad2[_0x6022('0x31')][_0x6022('0x3f')]){_0x336135[_0x6022('0x40')]=[{'all':!![]}];}_0x336135=_[_0x6022('0x3c')]({},_0x336135,_0x583ad2[_0x6022('0x43')]);return db[_0x6022('0x3e')][_0x6022('0x44')](_0x336135)[_0x6022('0x27')](handleEntityNotFound(_0x36fd53,null))[_0x6022('0x27')](respondWithResult(_0x36fd53,null))[_0x6022('0x45')](handleError(_0x36fd53,null));};exports['create']=function(_0x38983a,_0x696b8a){return db[_0x6022('0x3e')][_0x6022('0x46')](_0x38983a[_0x6022('0x47')],{})[_0x6022('0x27')](respondWithResult(_0x696b8a,0xc9))[_0x6022('0x45')](handleError(_0x696b8a,null));};exports['update']=function(_0x4fe99d,_0x2b48f8){if(_0x4fe99d['body']['id']){delete _0x4fe99d[_0x6022('0x47')]['id'];}return db[_0x6022('0x3e')][_0x6022('0x44')]({'where':{'id':_0x4fe99d['params']['id']}})[_0x6022('0x27')](handleEntityNotFound(_0x2b48f8,null))[_0x6022('0x27')](saveUpdates(_0x4fe99d[_0x6022('0x47')],null))['then'](respondWithResult(_0x2b48f8,null))[_0x6022('0x45')](handleError(_0x2b48f8,null));};exports[_0x6022('0x28')]=function(_0x5d565c,_0x2ab25d){return db[_0x6022('0x3e')][_0x6022('0x44')]({'where':{'id':_0x5d565c[_0x6022('0x48')]['id']}})[_0x6022('0x27')](handleEntityNotFound(_0x2ab25d,null))[_0x6022('0x27')](removeEntity(_0x2ab25d,null))['catch'](handleError(_0x2ab25d,null));};exports[_0x6022('0x49')]=function(_0x69d9b2,_0x2d4b67,_0x255f72){return db[_0x6022('0x3e')][_0x6022('0x44')]({'where':{'id':_0x69d9b2[_0x6022('0x48')]['id']},'attributes':['id',_0x6022('0x4a'),_0x6022('0x4b')]})['then'](handleEntityNotFound(_0x2d4b67,null))[_0x6022('0x27')](function(_0x402132){if(_0x402132){if(!_0x402132[_0x6022('0x4a')]){throw new db['Sequelize'][(_0x6022('0x4c'))](_0x6022('0x4d'));}var _0x326156={'Content-Type':_0x6022('0x4e'),'Content-Disposition':'attachment'};if(_0x402132['msg_id']){_0x326156[_0x6022('0x4f')]=_0x6022('0x50')+_0x402132['msg_id']+_0x6022('0x51');}_0x2d4b67['set'](_0x326156);return _0x2d4b67[_0x6022('0x52')](new Buffer(_0x402132[_0x6022('0x4a')]));}})['catch'](handleError(_0x2d4b67,null));}; \ No newline at end of file +var _0xc3e4=['length','includeAll','include','options','find','create','body','update','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','attachment;\x20filename=\x22','.wav\x22','send','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','squel','jsforce','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceMailMessage','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','findAll','rows','catch','show','params'];(function(_0x2ae457,_0x3f00b2){var _0xb9a3ae=function(_0x110623){while(--_0x110623){_0x2ae457['push'](_0x2ae457['shift']());}};_0xb9a3ae(++_0x3f00b2);}(_0xc3e4,0x1bb));var _0x4c3e=function(_0x1241b0,_0x518291){_0x1241b0=_0x1241b0-0x0;var _0x2c40a7=_0xc3e4[_0x1241b0];return _0x2c40a7;};'use strict';var emlformat=require(_0x4c3e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4c3e('0x1'));var jsonpatch=require(_0x4c3e('0x2'));var rp=require(_0x4c3e('0x3'));var moment=require(_0x4c3e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4c3e('0x5'));var util=require(_0x4c3e('0x6'));var path=require('path');var sox=require(_0x4c3e('0x7'));var csv=require('to-csv');var ejs=require(_0x4c3e('0x8'));var fs=require('fs');var fs_extra=require(_0x4c3e('0x9'));var _=require('lodash');var squel=require(_0x4c3e('0xa'));var crypto=require('crypto');var jsforce=require(_0x4c3e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4c3e('0xc'));var querystring=require('querystring');var Papa=require(_0x4c3e('0xd'));var Redis=require(_0x4c3e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4c3e('0xf'));var hardwareService=require(_0x4c3e('0x10'));var logger=require(_0x4c3e('0x11'))(_0x4c3e('0x12'));var utils=require(_0x4c3e('0x13'));var config=require(_0x4c3e('0x14'));var licenseUtil=require(_0x4c3e('0x15'));var db=require(_0x4c3e('0x16'))['db'];function respondWithStatusCode(_0x342bb6,_0xeb7c1f){_0xeb7c1f=_0xeb7c1f||0xcc;return function(_0x449315){if(_0x449315){return _0x342bb6[_0x4c3e('0x17')](_0xeb7c1f);}return _0x342bb6[_0x4c3e('0x18')](_0xeb7c1f)['end']();};}function respondWithResult(_0x37b655,_0x5f37c7){_0x5f37c7=_0x5f37c7||0xc8;return function(_0x3bc950){if(_0x3bc950){return _0x37b655[_0x4c3e('0x18')](_0x5f37c7)[_0x4c3e('0x19')](_0x3bc950);}};}function respondWithFilteredResult(_0x266d20,_0x282231){return function(_0x1e6c87){if(_0x1e6c87){var _0x5873e2=typeof _0x282231[_0x4c3e('0x1a')]==='undefined'&&typeof _0x282231[_0x4c3e('0x1b')]===_0x4c3e('0x1c');var _0x59dc5a=_0x1e6c87[_0x4c3e('0x1d')];var _0x58513e=_0x5873e2?0x0:_0x282231[_0x4c3e('0x1a')];var _0x4ccc67=_0x5873e2?_0x1e6c87['count']:_0x282231['offset']+_0x282231[_0x4c3e('0x1b')];var _0xf1a1c3;if(_0x4ccc67>=_0x59dc5a){_0x4ccc67=_0x59dc5a;_0xf1a1c3=0xc8;}else{_0xf1a1c3=0xce;}_0x266d20[_0x4c3e('0x18')](_0xf1a1c3);return _0x266d20[_0x4c3e('0x1e')](_0x4c3e('0x1f'),_0x58513e+'-'+_0x4ccc67+'/'+_0x59dc5a)[_0x4c3e('0x19')](_0x1e6c87);}return null;};}function patchUpdates(_0x4b790e){return function(_0x50866d){try{jsonpatch[_0x4c3e('0x20')](_0x50866d,_0x4b790e,!![]);}catch(_0x2ffc03){return BPromise[_0x4c3e('0x21')](_0x2ffc03);}return _0x50866d[_0x4c3e('0x22')]();};}function saveUpdates(_0x389974,_0x2bc879){return function(_0x12529f){if(_0x12529f){return _0x12529f['update'](_0x389974)[_0x4c3e('0x23')](function(_0x47f7cb){return _0x47f7cb;});}return null;};}function removeEntity(_0x10cb58,_0x18904a){return function(_0x104068){if(_0x104068){return _0x104068[_0x4c3e('0x24')]()[_0x4c3e('0x23')](function(){_0x10cb58[_0x4c3e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x531597,_0x4343bf){return function(_0x4c38aa){if(!_0x4c38aa){_0x531597['sendStatus'](0x194);}return _0x4c38aa;};}function handleError(_0x46b57c,_0xfd4a8){_0xfd4a8=_0xfd4a8||0x1f4;return function(_0xe15b26){logger[_0x4c3e('0x25')](_0xe15b26[_0x4c3e('0x26')]);if(_0xe15b26['name']){delete _0xe15b26[_0x4c3e('0x27')];}_0x46b57c[_0x4c3e('0x18')](_0xfd4a8)['send'](_0xe15b26);};}exports[_0x4c3e('0x28')]=function(_0x36c990,_0xe63a45){var _0x3cff17={},_0x4493df={},_0x8cd054={'count':0x0,'rows':[]};var _0x247570=_[_0x4c3e('0x29')](db[_0x4c3e('0x2a')][_0x4c3e('0x2b')],function(_0x1ab3d1){return{'name':_0x1ab3d1[_0x4c3e('0x2c')],'type':_0x1ab3d1[_0x4c3e('0x2d')]['key']};});_0x4493df['model']=_['differenceBy'](_[_0x4c3e('0x29')](_0x247570,_0x4c3e('0x27')),[_0x4c3e('0x27')]);_0x4493df[_0x4c3e('0x2e')]=_[_0x4c3e('0x2f')](_0x36c990[_0x4c3e('0x2e')]);_0x4493df[_0x4c3e('0x30')]=_[_0x4c3e('0x31')](_0x4493df[_0x4c3e('0x32')],_0x4493df[_0x4c3e('0x2e')]);_0x3cff17[_0x4c3e('0x33')]=_[_0x4c3e('0x31')](_0x4493df['model'],qs['fields'](_0x36c990[_0x4c3e('0x2e')][_0x4c3e('0x34')]));_0x3cff17[_0x4c3e('0x33')]=_0x3cff17[_0x4c3e('0x33')]['length']?_0x3cff17['attributes']:_0x4493df[_0x4c3e('0x32')];if(!_0x36c990[_0x4c3e('0x2e')][_0x4c3e('0x35')](_0x4c3e('0x36'))){_0x3cff17[_0x4c3e('0x1b')]=qs[_0x4c3e('0x1b')](_0x36c990[_0x4c3e('0x2e')][_0x4c3e('0x1b')]);_0x3cff17[_0x4c3e('0x1a')]=qs[_0x4c3e('0x1a')](_0x36c990['query'][_0x4c3e('0x1a')]);}_0x3cff17[_0x4c3e('0x37')]=qs[_0x4c3e('0x38')](_0x36c990[_0x4c3e('0x2e')][_0x4c3e('0x38')]);_0x3cff17['where']=qs[_0x4c3e('0x30')](_[_0x4c3e('0x39')](_0x36c990[_0x4c3e('0x2e')],_0x4493df[_0x4c3e('0x30')]),_0x247570);if(_0x36c990[_0x4c3e('0x2e')]['filter']){_0x3cff17[_0x4c3e('0x3a')]=_[_0x4c3e('0x3b')](_0x3cff17[_0x4c3e('0x3a')],{'$or':_[_0x4c3e('0x29')](_0x247570,function(_0x2dfe94){if(_0x2dfe94[_0x4c3e('0x2d')]!==_0x4c3e('0x3c')){var _0x2360dc={};_0x2360dc[_0x2dfe94[_0x4c3e('0x27')]]={'$like':'%'+_0x36c990[_0x4c3e('0x2e')][_0x4c3e('0x3d')]+'%'};return _0x2360dc;}})});}_0x3cff17=_[_0x4c3e('0x3b')]({},_0x3cff17,_0x36c990['options']);var _0x13ce88={'where':_0x3cff17[_0x4c3e('0x3a')]};return db[_0x4c3e('0x2a')]['count'](_0x13ce88)[_0x4c3e('0x23')](function(_0x6550f){_0x8cd054[_0x4c3e('0x1d')]=_0x6550f;if(_0x36c990['query']['includeAll']){_0x3cff17['include']=[{'all':!![]}];}return db[_0x4c3e('0x2a')][_0x4c3e('0x3e')](_0x3cff17);})['then'](function(_0x1c51cd){_0x8cd054[_0x4c3e('0x3f')]=_0x1c51cd;return _0x8cd054;})[_0x4c3e('0x23')](respondWithFilteredResult(_0xe63a45,_0x3cff17))[_0x4c3e('0x40')](handleError(_0xe63a45,null));};exports[_0x4c3e('0x41')]=function(_0x4f594e,_0x355b5a){var _0x368a3d={'raw':!![],'where':{'id':_0x4f594e[_0x4c3e('0x42')]['id']}},_0x14e973={};_0x14e973[_0x4c3e('0x32')]=_[_0x4c3e('0x2f')](db['VoiceMailMessage'][_0x4c3e('0x2b')]);_0x14e973[_0x4c3e('0x2e')]=_['keys'](_0x4f594e[_0x4c3e('0x2e')]);_0x14e973[_0x4c3e('0x30')]=_[_0x4c3e('0x31')](_0x14e973[_0x4c3e('0x32')],_0x14e973[_0x4c3e('0x2e')]);_0x368a3d[_0x4c3e('0x33')]=_[_0x4c3e('0x31')](_0x14e973[_0x4c3e('0x32')],qs[_0x4c3e('0x34')](_0x4f594e[_0x4c3e('0x2e')][_0x4c3e('0x34')]));_0x368a3d['attributes']=_0x368a3d[_0x4c3e('0x33')][_0x4c3e('0x43')]?_0x368a3d[_0x4c3e('0x33')]:_0x14e973['model'];if(_0x4f594e[_0x4c3e('0x2e')][_0x4c3e('0x44')]){_0x368a3d[_0x4c3e('0x45')]=[{'all':!![]}];}_0x368a3d=_[_0x4c3e('0x3b')]({},_0x368a3d,_0x4f594e[_0x4c3e('0x46')]);return db[_0x4c3e('0x2a')][_0x4c3e('0x47')](_0x368a3d)[_0x4c3e('0x23')](handleEntityNotFound(_0x355b5a,null))['then'](respondWithResult(_0x355b5a,null))[_0x4c3e('0x40')](handleError(_0x355b5a,null));};exports[_0x4c3e('0x48')]=function(_0x42d585,_0xd84b2b){return db[_0x4c3e('0x2a')][_0x4c3e('0x48')](_0x42d585[_0x4c3e('0x49')],{})[_0x4c3e('0x23')](respondWithResult(_0xd84b2b,0xc9))[_0x4c3e('0x40')](handleError(_0xd84b2b,null));};exports[_0x4c3e('0x4a')]=function(_0xfd42f8,_0x459730){if(_0xfd42f8[_0x4c3e('0x49')]['id']){delete _0xfd42f8[_0x4c3e('0x49')]['id'];}return db[_0x4c3e('0x2a')][_0x4c3e('0x47')]({'where':{'id':_0xfd42f8[_0x4c3e('0x42')]['id']}})['then'](handleEntityNotFound(_0x459730,null))[_0x4c3e('0x23')](saveUpdates(_0xfd42f8[_0x4c3e('0x49')],null))[_0x4c3e('0x23')](respondWithResult(_0x459730,null))[_0x4c3e('0x40')](handleError(_0x459730,null));};exports[_0x4c3e('0x24')]=function(_0x48e02c,_0x4aad49){return db[_0x4c3e('0x2a')]['find']({'where':{'id':_0x48e02c[_0x4c3e('0x42')]['id']}})[_0x4c3e('0x23')](handleEntityNotFound(_0x4aad49,null))[_0x4c3e('0x23')](removeEntity(_0x4aad49,null))[_0x4c3e('0x40')](handleError(_0x4aad49,null));};exports[_0x4c3e('0x4b')]=function(_0x43cbc4,_0x421407,_0x3fd42d){return db[_0x4c3e('0x2a')][_0x4c3e('0x47')]({'where':{'id':_0x43cbc4[_0x4c3e('0x42')]['id']},'attributes':['id',_0x4c3e('0x4c'),_0x4c3e('0x4d')]})[_0x4c3e('0x23')](handleEntityNotFound(_0x421407,null))[_0x4c3e('0x23')](function(_0x3a4662){if(_0x3a4662){if(!_0x3a4662[_0x4c3e('0x4c')]){throw new db[(_0x4c3e('0x4e'))][(_0x4c3e('0x4f'))](_0x4c3e('0x50'));}var _0x4c5b36={'Content-Type':'audio/wav','Content-Disposition':_0x4c3e('0x51')};if(_0x3a4662[_0x4c3e('0x4d')]){_0x4c5b36['Content-Disposition']=_0x4c3e('0x52')+_0x3a4662[_0x4c3e('0x4d')]+_0x4c3e('0x53');}_0x421407[_0x4c3e('0x1e')](_0x4c5b36);return _0x421407[_0x4c3e('0x54')](new Buffer(_0x3a4662[_0x4c3e('0x4c')]));}})[_0x4c3e('0x40')](handleError(_0x421407,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 1177dc3..768c423 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 _0x7ee6=['moment','bluebird','path','rimraf','../../config/environment','./voiceMailMessage.attributes','define','voice_voicemail_messages','dir','util','../../config/logger'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7ee6,0x17f));var _0x67ee=function(_0x3ed61e,_0x5eb2e6){_0x3ed61e=_0x3ed61e-0x0;var _0x74cfbe=_0x7ee6[_0x3ed61e];return _0x74cfbe;};'use strict';var _=require('lodash');var util=require(_0x67ee('0x0'));var logger=require(_0x67ee('0x1'))('api');var moment=require(_0x67ee('0x2'));var BPromise=require(_0x67ee('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x67ee('0x4'));var rimraf=require(_0x67ee('0x5'));var config=require(_0x67ee('0x6'));var attributes=require(_0x67ee('0x7'));module['exports']=function(_0x4528b6,_0x27cd79){return _0x4528b6[_0x67ee('0x8')]('VoiceMailMessage',attributes,{'tableName':_0x67ee('0x9'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x67ee('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x008c=['request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','lodash','util','../../config/logger','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x008c,0x10d));var _0xc008=function(_0x3e45a6,_0x576195){_0x3e45a6=_0x3e45a6-0x0;var _0x4751f7=_0x008c[_0x3e45a6];return _0x4751f7;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))('api');var moment=require(_0xc008('0x3'));var BPromise=require('bluebird');var rp=require(_0xc008('0x4'));var fs=require('fs');var path=require(_0xc008('0x5'));var rimraf=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var attributes=require(_0xc008('0x8'));module[_0xc008('0x9')]=function(_0x267c20,_0xa4a97d){return _0x267c20[_0xc008('0xa')]('VoiceMailMessage',attributes,{'tableName':_0xc008('0xb'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0xc008('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 7ba104f..e798fae 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 _0xb544=['ioredis','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMailMessage,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x242efe,_0x27b709){var _0x464ee6=function(_0xac111a){while(--_0xac111a){_0x242efe['push'](_0x242efe['shift']());}};_0x464ee6(++_0x27b709);}(_0xb544,0x1de));var _0x4b54=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xb544[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0x4b54('0x0'));var util=require(_0x4b54('0x1'));var moment=require(_0x4b54('0x2'));var BPromise=require(_0x4b54('0x3'));var rs=require(_0x4b54('0x4'));var fs=require('fs');var Redis=require(_0x4b54('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4b54('0x6'));var config=require(_0x4b54('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4b54('0x8')][_0x4b54('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x80b5c,_0x3b5167,_0xf72241){return new BPromise(function(_0x1e8514,_0x360807){return client[_0x4b54('0xa')](_0x80b5c,_0xf72241)[_0x4b54('0xb')](function(_0x5755e4){logger[_0x4b54('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x3b5167,_0x4b54('0xd'));logger[_0x4b54('0xe')](_0x4b54('0xf'),_0x3b5167,'request\x20sent',JSON[_0x4b54('0x10')](_0x5755e4));if(_0x5755e4['error']){if(_0x5755e4[_0x4b54('0x11')]['code']===0x1f4){logger[_0x4b54('0x11')](_0x4b54('0x12'),_0x3b5167,_0x5755e4[_0x4b54('0x11')][_0x4b54('0x13')]);return _0x360807(_0x5755e4[_0x4b54('0x11')][_0x4b54('0x13')]);}logger[_0x4b54('0x11')](_0x4b54('0x12'),_0x3b5167,_0x5755e4[_0x4b54('0x11')][_0x4b54('0x13')]);return _0x1e8514(_0x5755e4[_0x4b54('0x11')][_0x4b54('0x13')]);}else{logger[_0x4b54('0xc')](_0x4b54('0x12'),_0x3b5167,_0x4b54('0xd'));_0x1e8514(_0x5755e4[_0x4b54('0x14')][_0x4b54('0x13')]);}})['catch'](function(_0x4ccd63){logger[_0x4b54('0x11')](_0x4b54('0x12'),_0x3b5167,_0x4ccd63);_0x360807(_0x4ccd63);});});} \ No newline at end of file +var _0x86fc=['result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x5ed013,_0x59583c){var _0x2d1e23=function(_0x5b014f){while(--_0x5b014f){_0x5ed013['push'](_0x5ed013['shift']());}};_0x2d1e23(++_0x59583c);}(_0x86fc,0x1e5));var _0xc86f=function(_0x457127,_0x289310){_0x457127=_0x457127-0x0;var _0x4972eb=_0x86fc[_0x457127];return _0x4972eb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc86f('0x0'));var BPromise=require(_0xc86f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc86f('0x2'));var db=require(_0xc86f('0x3'))['db'];var utils=require(_0xc86f('0x4'));var logger=require(_0xc86f('0x5'))('rpc');var config=require(_0xc86f('0x6'));var jayson=require(_0xc86f('0x7'));var client=jayson['client'][_0xc86f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45ce9d,_0x5ba8c8,_0x273d52){return new BPromise(function(_0x4bd670,_0x201168){return client[_0xc86f('0x9')](_0x45ce9d,_0x273d52)[_0xc86f('0xa')](function(_0x237955){logger[_0xc86f('0xb')](_0xc86f('0xc'),_0x5ba8c8,_0xc86f('0xd'));logger[_0xc86f('0xe')](_0xc86f('0xf'),_0x5ba8c8,_0xc86f('0xd'),JSON[_0xc86f('0x10')](_0x237955));if(_0x237955[_0xc86f('0x11')]){if(_0x237955[_0xc86f('0x11')]['code']===0x1f4){logger[_0xc86f('0x11')](_0xc86f('0xc'),_0x5ba8c8,_0x237955[_0xc86f('0x11')][_0xc86f('0x12')]);return _0x201168(_0x237955[_0xc86f('0x11')][_0xc86f('0x12')]);}logger[_0xc86f('0x11')](_0xc86f('0xc'),_0x5ba8c8,_0x237955['error'][_0xc86f('0x12')]);return _0x4bd670(_0x237955['error'][_0xc86f('0x12')]);}else{logger[_0xc86f('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x5ba8c8,_0xc86f('0xd'));_0x4bd670(_0x237955[_0xc86f('0x13')][_0xc86f('0x12')]);}})[_0xc86f('0x14')](function(_0x43ff4c){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x5ba8c8,_0x43ff4c);_0x201168(_0x43ff4c);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index a65e63b..7dfe7cf 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 _0x5a41=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id/sounds','getSounds','post','create','addSound','put','/:id','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer'];(function(_0x37db5e,_0xd9c83d){var _0x1352dc=function(_0x5d3501){while(--_0x5d3501){_0x37db5e['push'](_0x37db5e['shift']());}};_0x1352dc(++_0xd9c83d);}(_0x5a41,0x1da));var _0x15a4=function(_0xa7efd7,_0x45c885){_0xa7efd7=_0xa7efd7-0x0;var _0x572019=_0x5a41[_0xa7efd7];return _0x572019;};'use strict';var multer=require(_0x15a4('0x0'));var util=require(_0x15a4('0x1'));var path=require(_0x15a4('0x2'));var timeout=require(_0x15a4('0x3'));var express=require(_0x15a4('0x4'));var router=express[_0x15a4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x15a4('0x6'));var config=require(_0x15a4('0x7'));var controller=require(_0x15a4('0x8'));router[_0x15a4('0x9')]('/',auth[_0x15a4('0xa')](),controller[_0x15a4('0xb')]);router[_0x15a4('0x9')]('/:id',auth[_0x15a4('0xa')](),controller['show']);router[_0x15a4('0x9')](_0x15a4('0xc'),auth[_0x15a4('0xa')](),controller[_0x15a4('0xd')]);router[_0x15a4('0xe')]('/',auth[_0x15a4('0xa')](),controller[_0x15a4('0xf')]);router['post'](_0x15a4('0xc'),auth[_0x15a4('0xa')](),controller[_0x15a4('0x10')]);router[_0x15a4('0x11')](_0x15a4('0x12'),auth[_0x15a4('0xa')](),controller[_0x15a4('0x13')]);router[_0x15a4('0x14')](_0x15a4('0x12'),auth[_0x15a4('0xa')](),controller[_0x15a4('0x15')]);router[_0x15a4('0x14')](_0x15a4('0x16'),auth[_0x15a4('0xa')](),controller[_0x15a4('0x17')]);module[_0x15a4('0x18')]=router; \ No newline at end of file +var _0xd720=['./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','/:id/sounds','getSounds','post','addSound','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xb00082,_0x4d60e5){var _0x19af20=function(_0x16d4a5){while(--_0x16d4a5){_0xb00082['push'](_0xb00082['shift']());}};_0x19af20(++_0x4d60e5);}(_0xd720,0x195));var _0x0d72=function(_0x3f7053,_0x3dca9d){_0x3f7053=_0x3f7053-0x0;var _0x404aa5=_0xd720[_0x3f7053];return _0x404aa5;};'use strict';var multer=require(_0x0d72('0x0'));var util=require(_0x0d72('0x1'));var path=require(_0x0d72('0x2'));var timeout=require('connect-timeout');var express=require(_0x0d72('0x3'));var router=express[_0x0d72('0x4')]();var fs_extra=require(_0x0d72('0x5'));var auth=require(_0x0d72('0x6'));var interaction=require(_0x0d72('0x7'));var config=require(_0x0d72('0x8'));var controller=require(_0x0d72('0x9'));router[_0x0d72('0xa')]('/',auth[_0x0d72('0xb')](),controller['index']);router[_0x0d72('0xa')](_0x0d72('0xc'),auth['isAuthenticated'](),controller[_0x0d72('0xd')]);router['get'](_0x0d72('0xe'),auth['isAuthenticated'](),controller[_0x0d72('0xf')]);router[_0x0d72('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x0d72('0xe'),auth[_0x0d72('0xb')](),controller[_0x0d72('0x11')]);router[_0x0d72('0x12')](_0x0d72('0xc'),auth[_0x0d72('0xb')](),controller[_0x0d72('0x13')]);router[_0x0d72('0x14')](_0x0d72('0xc'),auth['isAuthenticated'](),controller[_0x0d72('0x15')]);router[_0x0d72('0x14')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller['removeSound']);module[_0x0d72('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 8d6b415..5942aa8 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 _0x71bb=['TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','mp3nb','quietmp3nb','mp3','files','alpha'];(function(_0x48ee3a,_0x3f0d31){var _0x4cbcbf=function(_0x34b5c6){while(--_0x34b5c6){_0x48ee3a['push'](_0x48ee3a['shift']());}};_0x4cbcbf(++_0x3f0d31);}(_0x71bb,0xce));var _0xb71b=function(_0x2e2d1b,_0x37e448){_0x2e2d1b=_0x2e2d1b-0x0;var _0x5ba25e=_0x71bb[_0x2e2d1b];return _0x5ba25e;};'use strict';var Sequelize=require(_0xb71b('0x0'));module[_0xb71b('0x1')]={'name':{'type':Sequelize[_0xb71b('0x2')],'allowNull':![],'unique':_0xb71b('0x3')},'mode':{'type':Sequelize[_0xb71b('0x4')]('custom','files',_0xb71b('0x5'),_0xb71b('0x6'),'quietmp3',_0xb71b('0x7')),'allowNull':!![],'defaultValue':_0xb71b('0x8')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xb71b('0x9')},'format':{'type':Sequelize[_0xb71b('0x2')],'allowNull':!![]},'stamp':{'type':_0xb71b('0xa')},'defaultEntry':{'type':Sequelize[_0xb71b('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x021f=['BOOLEAN','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP'];(function(_0x52dc75,_0x11dfd5){var _0x53e560=function(_0x3dfef9){while(--_0x3dfef9){_0x52dc75['push'](_0x52dc75['shift']());}};_0x53e560(++_0x11dfd5);}(_0x021f,0x17a));var _0xf021=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x021f[_0x344a3f];return _0x264712;};'use strict';var Sequelize=require('sequelize');module[_0xf021('0x0')]={'name':{'type':Sequelize[_0xf021('0x1')],'allowNull':![],'unique':_0xf021('0x2')},'mode':{'type':Sequelize[_0xf021('0x3')](_0xf021('0x4'),_0xf021('0x5'),_0xf021('0x6'),_0xf021('0x7'),_0xf021('0x8'),_0xf021('0x9')),'allowNull':!![],'defaultValue':_0xf021('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xf021('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xf021('0x1')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xf021('0xa')},'format':{'type':Sequelize[_0xf021('0x1')],'allowNull':!![]},'stamp':{'type':_0xf021('0xb')},'defaultEntry':{'type':Sequelize[_0xf021('0xc')],'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 99c857d..1613e80 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 _0xa2c7=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','error','name','send','index','map','VoiceMusicOnHold','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','include','rows','catch','show','keys','includeAll','find','update','body','params','create','transaction','files','join','mode','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','directory','readdirSync','forEach','rmdirSync','Sequelize','message','sequelize','addSound','Sound','findOne','save_name','converted_format','root','server/files/sounds/converted','format','%s.%s','basename','extname','server/files/moh','symlinkSync','ValidationError','removeSound','id2','unlinkSync','rawAttributes','getSounds','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x156705,_0x46616a){var _0x5a4bee=function(_0x3cd74b){while(--_0x3cd74b){_0x156705['push'](_0x156705['shift']());}};_0x5a4bee(++_0x46616a);}(_0xa2c7,0xd7));var _0x7a2c=function(_0x23884b,_0x50c307){_0x23884b=_0x23884b-0x0;var _0x28113b=_0xa2c7[_0x23884b];return _0x28113b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a2c('0x0'));var zipdir=require(_0x7a2c('0x1'));var jsonpatch=require(_0x7a2c('0x2'));var rp=require('request-promise');var moment=require(_0x7a2c('0x3'));var BPromise=require(_0x7a2c('0x4'));var Mustache=require('mustache');var util=require(_0x7a2c('0x5'));var path=require(_0x7a2c('0x6'));var sox=require(_0x7a2c('0x7'));var csv=require(_0x7a2c('0x8'));var ejs=require(_0x7a2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7a2c('0xa'));var _=require(_0x7a2c('0xb'));var squel=require(_0x7a2c('0xc'));var crypto=require(_0x7a2c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7a2c('0xe'));var toCsv=require(_0x7a2c('0x8'));var querystring=require(_0x7a2c('0xf'));var Papa=require(_0x7a2c('0x10'));var Redis=require(_0x7a2c('0x11'));var authService=require(_0x7a2c('0x12'));var qs=require(_0x7a2c('0x13'));var as=require(_0x7a2c('0x14'));var hardwareService=require(_0x7a2c('0x15'));var logger=require(_0x7a2c('0x16'))('api');var utils=require(_0x7a2c('0x17'));var config=require(_0x7a2c('0x18'));var licenseUtil=require(_0x7a2c('0x19'));var db=require(_0x7a2c('0x1a'))['db'];function respondWithStatusCode(_0x10ff50,_0x2ab55e){_0x2ab55e=_0x2ab55e||0xcc;return function(_0x4e0f19){if(_0x4e0f19){return _0x10ff50[_0x7a2c('0x1b')](_0x2ab55e);}return _0x10ff50[_0x7a2c('0x1c')](_0x2ab55e)[_0x7a2c('0x1d')]();};}function respondWithResult(_0x1c94cb,_0x45047b){_0x45047b=_0x45047b||0xc8;return function(_0x1ded1e){if(_0x1ded1e){return _0x1c94cb[_0x7a2c('0x1c')](_0x45047b)[_0x7a2c('0x1e')](_0x1ded1e);}};}function respondWithFilteredResult(_0x307b05,_0x4ee682){return function(_0x59a9ba){if(_0x59a9ba){var _0x198727=typeof _0x4ee682[_0x7a2c('0x1f')]===_0x7a2c('0x20')&&typeof _0x4ee682['limit']===_0x7a2c('0x20');var _0x56daa0=_0x59a9ba[_0x7a2c('0x21')];var _0x388254=_0x198727?0x0:_0x4ee682[_0x7a2c('0x1f')];var _0x2fec4c=_0x198727?_0x59a9ba[_0x7a2c('0x21')]:_0x4ee682[_0x7a2c('0x1f')]+_0x4ee682[_0x7a2c('0x22')];var _0x2d0391;if(_0x2fec4c>=_0x56daa0){_0x2fec4c=_0x56daa0;_0x2d0391=0xc8;}else{_0x2d0391=0xce;}_0x307b05[_0x7a2c('0x1c')](_0x2d0391);return _0x307b05['set']('Content-Range',_0x388254+'-'+_0x2fec4c+'/'+_0x56daa0)['json'](_0x59a9ba);}return null;};}function patchUpdates(_0x26af2e){return function(_0x4027d2){try{jsonpatch[_0x7a2c('0x23')](_0x4027d2,_0x26af2e,!![]);}catch(_0x55c3cf){return BPromise[_0x7a2c('0x24')](_0x55c3cf);}return _0x4027d2[_0x7a2c('0x25')]();};}function saveUpdates(_0x3f57e7,_0x5eff7a){return function(_0xa44d02){if(_0xa44d02){return _0xa44d02['update'](_0x3f57e7)[_0x7a2c('0x26')](function(_0x50a8b9){return _0x50a8b9;});}return null;};}function removeEntity(_0x10777c,_0x56eeaa){return function(_0x3e1f8f){if(_0x3e1f8f){return _0x3e1f8f[_0x7a2c('0x27')]()[_0x7a2c('0x26')](function(){var _0x423bf5=_0x3e1f8f[_0x7a2c('0x28')]({'plain':!![]});var _0x3c5875=_0x7a2c('0x29');return db[_0x7a2c('0x2a')]['destroy']({'where':{'type':_0x3c5875,'resourceId':_0x423bf5['id']}})['then'](function(){return _0x3e1f8f;});})[_0x7a2c('0x26')](function(){_0x10777c[_0x7a2c('0x1c')](0xcc)[_0x7a2c('0x1d')]();});}};}function handleEntityNotFound(_0x13716a,_0x5bfa97){return function(_0x215022){if(!_0x215022){_0x13716a[_0x7a2c('0x1b')](0x194);}return _0x215022;};}function handleError(_0x2528f3,_0x3cbc76){_0x3cbc76=_0x3cbc76||0x1f4;return function(_0x94ddcf){logger[_0x7a2c('0x2b')](_0x94ddcf['stack']);if(_0x94ddcf[_0x7a2c('0x2c')]){delete _0x94ddcf[_0x7a2c('0x2c')];}_0x2528f3[_0x7a2c('0x1c')](_0x3cbc76)[_0x7a2c('0x2d')](_0x94ddcf);};}exports[_0x7a2c('0x2e')]=function(_0x43280f,_0x23eb55){var _0x36f92d={},_0x446daf={},_0x4ae42c={'count':0x0,'rows':[]};var _0x3b4e43=_[_0x7a2c('0x2f')](db[_0x7a2c('0x30')]['rawAttributes'],function(_0x2e2bf4){return{'name':_0x2e2bf4[_0x7a2c('0x31')],'type':_0x2e2bf4['type']['key']};});_0x446daf[_0x7a2c('0x32')]=_['map'](_0x3b4e43,_0x7a2c('0x2c'));_0x446daf[_0x7a2c('0x33')]=_['keys'](_0x43280f[_0x7a2c('0x33')]);_0x446daf[_0x7a2c('0x34')]=_[_0x7a2c('0x35')](_0x446daf[_0x7a2c('0x32')],_0x446daf[_0x7a2c('0x33')]);_0x36f92d[_0x7a2c('0x36')]=_[_0x7a2c('0x35')](_0x446daf['model'],qs[_0x7a2c('0x37')](_0x43280f['query'][_0x7a2c('0x37')]));_0x36f92d['attributes']=_0x36f92d[_0x7a2c('0x36')][_0x7a2c('0x38')]?_0x36f92d[_0x7a2c('0x36')]:_0x446daf['model'];if(!_0x43280f[_0x7a2c('0x33')][_0x7a2c('0x39')](_0x7a2c('0x3a'))){_0x36f92d[_0x7a2c('0x22')]=qs[_0x7a2c('0x22')](_0x43280f[_0x7a2c('0x33')][_0x7a2c('0x22')]);_0x36f92d[_0x7a2c('0x1f')]=qs[_0x7a2c('0x1f')](_0x43280f['query'][_0x7a2c('0x1f')]);}_0x36f92d[_0x7a2c('0x3b')]=qs[_0x7a2c('0x3c')](_0x43280f['query']['sort']);delete _0x43280f[_0x7a2c('0x33')][_0x7a2c('0x3c')];_0x36f92d[_0x7a2c('0x3d')]=qs[_0x7a2c('0x34')](_[_0x7a2c('0x3e')](_0x43280f[_0x7a2c('0x33')],_0x446daf['filters']),_0x3b4e43);if(_0x43280f[_0x7a2c('0x33')]['filter']){_0x36f92d[_0x7a2c('0x3d')]=_[_0x7a2c('0x3f')](_0x36f92d[_0x7a2c('0x3d')],{'$or':_[_0x7a2c('0x2f')](_0x3b4e43,function(_0x4297f1){if(_0x4297f1['type']!=='VIRTUAL'){var _0x152035={};_0x152035[_0x4297f1[_0x7a2c('0x2c')]]={'$like':'%'+_0x43280f['query'][_0x7a2c('0x40')]+'%'};return _0x152035;}})});}_0x36f92d=_[_0x7a2c('0x3f')]({},_0x36f92d,_0x43280f['options']);var _0x5b4b4f={'where':_0x36f92d[_0x7a2c('0x3d')]};return db[_0x7a2c('0x30')][_0x7a2c('0x21')](_0x5b4b4f)[_0x7a2c('0x26')](function(_0x212eb3){_0x4ae42c[_0x7a2c('0x21')]=_0x212eb3;if(_0x43280f[_0x7a2c('0x33')]['includeAll']){_0x36f92d[_0x7a2c('0x41')]=[{'all':!![]}];}return db[_0x7a2c('0x30')]['findAll'](_0x36f92d);})['then'](function(_0xf0432){_0x4ae42c[_0x7a2c('0x42')]=_0xf0432;return _0x4ae42c;})[_0x7a2c('0x26')](respondWithFilteredResult(_0x23eb55,_0x36f92d))[_0x7a2c('0x43')](handleError(_0x23eb55,null));};exports[_0x7a2c('0x44')]=function(_0x1bc7e0,_0x1a36e0){var _0x143349={'raw':![],'where':{'id':_0x1bc7e0['params']['id']}},_0x260707={};_0x260707[_0x7a2c('0x32')]=_[_0x7a2c('0x45')](db[_0x7a2c('0x30')]['rawAttributes']);_0x260707[_0x7a2c('0x33')]=_[_0x7a2c('0x45')](_0x1bc7e0[_0x7a2c('0x33')]);_0x260707[_0x7a2c('0x34')]=_[_0x7a2c('0x35')](_0x260707[_0x7a2c('0x32')],_0x260707[_0x7a2c('0x33')]);_0x143349['attributes']=_[_0x7a2c('0x35')](_0x260707[_0x7a2c('0x32')],qs[_0x7a2c('0x37')](_0x1bc7e0[_0x7a2c('0x33')][_0x7a2c('0x37')]));_0x143349[_0x7a2c('0x36')]=_0x143349['attributes']['length']?_0x143349['attributes']:_0x260707[_0x7a2c('0x32')];if(_0x1bc7e0['query'][_0x7a2c('0x46')]){_0x143349[_0x7a2c('0x41')]=[{'all':!![]}];}_0x143349=_[_0x7a2c('0x3f')]({},_0x143349,_0x1bc7e0['options']);return db[_0x7a2c('0x30')][_0x7a2c('0x47')](_0x143349)[_0x7a2c('0x26')](handleEntityNotFound(_0x1a36e0,null))['then'](respondWithResult(_0x1a36e0,null))['catch'](handleError(_0x1a36e0,null));};exports[_0x7a2c('0x48')]=function(_0x48fc73,_0x5124fe){if(_0x48fc73[_0x7a2c('0x49')]['id']){delete _0x48fc73['body']['id'];}return db[_0x7a2c('0x30')]['find']({'where':{'id':_0x48fc73[_0x7a2c('0x4a')]['id']}})[_0x7a2c('0x26')](handleEntityNotFound(_0x5124fe,null))[_0x7a2c('0x26')](saveUpdates(_0x48fc73['body'],null))[_0x7a2c('0x26')](respondWithResult(_0x5124fe,null))[_0x7a2c('0x43')](handleError(_0x5124fe,null));};exports[_0x7a2c('0x4b')]=function(_0x11e43c,_0x2bf1bf,_0x7454b6){return db['sequelize'][_0x7a2c('0x4c')](function(_0x1ca2fb){if(_0x11e43c[_0x7a2c('0x49')]['mode']===_0x7a2c('0x4d')){_0x11e43c[_0x7a2c('0x49')]['directory']=path[_0x7a2c('0x4e')](config['root'],'server/files/moh',_0x11e43c[_0x7a2c('0x49')]['name']);}return db[_0x7a2c('0x30')][_0x7a2c('0x4b')](_0x11e43c[_0x7a2c('0x49')],{'transaction':_0x1ca2fb})[_0x7a2c('0x26')](function(_0x24a86d){if(_0x11e43c[_0x7a2c('0x49')][_0x7a2c('0x4f')]==='files'){fs[_0x7a2c('0x50')](_0x24a86d['directory'],parseInt(_0x7a2c('0x51'),0x8));}var _0x420ba4=_0x11e43c[_0x7a2c('0x52')][_0x7a2c('0x28')]({'plain':!![]});if(!_0x420ba4)throw new Error(_0x7a2c('0x53'));if(_0x420ba4[_0x7a2c('0x54')]===_0x7a2c('0x52')){var _0x4e6dce=_0x24a86d[_0x7a2c('0x28')]({'plain':!![]});return db['UserProfileSection'][_0x7a2c('0x47')]({'where':{'name':_0x7a2c('0x29'),'userProfileId':_0x420ba4[_0x7a2c('0x55')]},'raw':!![]})['then'](function(_0x45908e){if(_0x45908e&&_0x45908e[_0x7a2c('0x56')]===0x0){return db[_0x7a2c('0x2a')][_0x7a2c('0x4b')]({'name':_0x4e6dce[_0x7a2c('0x2c')],'resourceId':_0x4e6dce['id'],'type':_0x45908e[_0x7a2c('0x2c')],'sectionId':_0x45908e['id']},{})[_0x7a2c('0x26')](function(){return _0x24a86d;});}else{return _0x24a86d;}})[_0x7a2c('0x43')](function(_0x5dcf81){logger[_0x7a2c('0x2b')](_0x7a2c('0x57'),_0x5dcf81);});}return _0x24a86d;});})[_0x7a2c('0x26')](respondWithResult(_0x2bf1bf,0xc9))[_0x7a2c('0x43')](handleError(_0x2bf1bf,null));};exports[_0x7a2c('0x27')]=function(_0x46c828,_0x47a24d,_0x19c500){var _0x296313;return db['VoiceMusicOnHold'][_0x7a2c('0x47')]({'where':{'id':_0x46c828[_0x7a2c('0x4a')]['id']}})[_0x7a2c('0x26')](function(_0x34133f){if(_0x34133f){return db['sequelize']['transaction'](function(_0x574478){return _0x34133f[_0x7a2c('0x27')]({'transaction':_0x574478,'raw':!![]})[_0x7a2c('0x26')](function(_0x27afc7){if(_0x27afc7[_0x7a2c('0x58')]){fs[_0x7a2c('0x59')](_0x27afc7[_0x7a2c('0x58')])[_0x7a2c('0x5a')](function(_0x2a94fb){fs['unlinkSync'](path['join'](_0x27afc7[_0x7a2c('0x58')],_0x2a94fb));});fs[_0x7a2c('0x5b')](_0x27afc7['directory']);}return _0x27afc7;});})[_0x7a2c('0x43')](function(_0x321e95){throw new db[(_0x7a2c('0x5c'))]['ValidationError'](_0x321e95[_0x7a2c('0x5d')]);});}})[_0x7a2c('0x26')](handleEntityNotFound(_0x47a24d,null))[_0x7a2c('0x26')](removeEntity(_0x47a24d,null))[_0x7a2c('0x43')](handleError(_0x47a24d,null));};exports['addSound']=function(_0x1da908,_0x2505cf,_0xb125d1){return db[_0x7a2c('0x5e')]['transaction'](function(_0x5a07c3){var _0x2ebab2;return db[_0x7a2c('0x30')][_0x7a2c('0x47')]({'where':{'id':_0x1da908['params']['id']}})[_0x7a2c('0x26')](function(_0x20a790){if(_0x20a790){_0x2ebab2=_0x20a790;return _0x20a790[_0x7a2c('0x5f')](_0x1da908[_0x7a2c('0x49')]['id'],{'transaction':_0x5a07c3});}})[_0x7a2c('0x26')](function(_0x4b9b2f){if(_0x4b9b2f){return db[_0x7a2c('0x60')][_0x7a2c('0x61')]({'where':{'id':_0x1da908[_0x7a2c('0x49')]['id']},'attributes':['id',_0x7a2c('0x2c'),_0x7a2c('0x62'),_0x7a2c('0x63'),'createdAt'],'raw':!![]});}})[_0x7a2c('0x26')](function(_0x315601){if(_0x315601){var _0x19c443=path[_0x7a2c('0x4e')](config[_0x7a2c('0x64')],_0x7a2c('0x65'),util[_0x7a2c('0x66')](_0x7a2c('0x67'),path[_0x7a2c('0x68')](_0x315601[_0x7a2c('0x62')],path[_0x7a2c('0x69')](_0x315601[_0x7a2c('0x62')])),_0x315601[_0x7a2c('0x63')]));var _0x30db7f=path['join'](config[_0x7a2c('0x64')],_0x7a2c('0x6a'),_0x2ebab2[_0x7a2c('0x2c')],util[_0x7a2c('0x66')](_0x7a2c('0x67'),_0x315601[_0x7a2c('0x2c')],_0x315601[_0x7a2c('0x63')]));fs[_0x7a2c('0x6b')](_0x19c443,_0x30db7f);return _0x315601;}})[_0x7a2c('0x43')](function(_0x376647){throw new db['Sequelize'][(_0x7a2c('0x6c'))](_0x376647[_0x7a2c('0x5d')]);});})[_0x7a2c('0x26')](handleEntityNotFound(_0x2505cf,null))['then'](respondWithResult(_0x2505cf,0xc9))[_0x7a2c('0x43')](handleError(_0x2505cf,null));};exports[_0x7a2c('0x6d')]=function(_0x220ab7,_0x5cb04a,_0x4cf609){return db[_0x7a2c('0x5e')]['transaction'](function(_0x9c5f6e){var _0x23ae3f;return db[_0x7a2c('0x30')][_0x7a2c('0x61')]({'where':{'id':_0x220ab7[_0x7a2c('0x4a')]['id']}})[_0x7a2c('0x26')](handleEntityNotFound(_0x5cb04a,null))['then'](function(_0x11bd4d){if(_0x11bd4d){_0x23ae3f=_0x11bd4d;return _0x11bd4d[_0x7a2c('0x6d')](_0x220ab7[_0x7a2c('0x4a')][_0x7a2c('0x6e')]);}})[_0x7a2c('0x26')](function(_0x144461){if(_0x144461){return db[_0x7a2c('0x60')][_0x7a2c('0x61')]({'where':{'id':_0x220ab7[_0x7a2c('0x4a')]['id2']},'attributes':['id',_0x7a2c('0x2c'),_0x7a2c('0x62'),_0x7a2c('0x63'),'createdAt'],'raw':!![]});}})[_0x7a2c('0x26')](function(_0x4bc488){if(_0x4bc488){fs[_0x7a2c('0x6f')](path[_0x7a2c('0x4e')](_0x23ae3f['directory'],util[_0x7a2c('0x66')](_0x7a2c('0x67'),_0x4bc488[_0x7a2c('0x2c')],_0x4bc488[_0x7a2c('0x63')])));return _0x4bc488;}})[_0x7a2c('0x43')](function(_0xc907f9){throw new db[(_0x7a2c('0x5c'))][(_0x7a2c('0x6c'))](_0xc907f9[_0x7a2c('0x5d')]);});})[_0x7a2c('0x26')](handleEntityNotFound(_0x5cb04a,null))[_0x7a2c('0x26')](respondWithStatusCode(_0x5cb04a,0xcc))[_0x7a2c('0x43')](handleError(_0x5cb04a,null));};exports['getSounds']=function(_0x3c4c31,_0xe0eb5b,_0x2c4549){var _0x3313d1={};var _0x3b1787={};var _0x248510;var _0x535c9b;return db[_0x7a2c('0x30')]['findOne']({'where':{'id':_0x3c4c31[_0x7a2c('0x4a')]['id']}})['then'](handleEntityNotFound(_0xe0eb5b,null))[_0x7a2c('0x26')](function(_0x201d81){if(_0x201d81){_0x248510=_0x201d81;_0x3b1787[_0x7a2c('0x32')]=_[_0x7a2c('0x45')](db[_0x7a2c('0x60')][_0x7a2c('0x70')]);_0x3b1787[_0x7a2c('0x33')]=_[_0x7a2c('0x45')](_0x3c4c31[_0x7a2c('0x33')]);_0x3b1787[_0x7a2c('0x34')]=_[_0x7a2c('0x35')](_0x3b1787[_0x7a2c('0x32')],_0x3b1787['query']);_0x3313d1[_0x7a2c('0x36')]=_['intersection'](_0x3b1787[_0x7a2c('0x32')],qs[_0x7a2c('0x37')](_0x3c4c31[_0x7a2c('0x33')][_0x7a2c('0x37')]));_0x3313d1[_0x7a2c('0x36')]=_0x3313d1['attributes']['length']?_0x3313d1[_0x7a2c('0x36')]:_0x3b1787[_0x7a2c('0x32')];_0x3313d1[_0x7a2c('0x3b')]=qs['sort'](_0x3c4c31[_0x7a2c('0x33')]['sort']);_0x3313d1[_0x7a2c('0x3d')]=qs[_0x7a2c('0x34')](_[_0x7a2c('0x3e')](_0x3c4c31[_0x7a2c('0x33')],_0x3b1787[_0x7a2c('0x34')]));if(_0x3c4c31[_0x7a2c('0x33')][_0x7a2c('0x40')]){_0x3313d1[_0x7a2c('0x3d')]=_[_0x7a2c('0x3f')](_0x3313d1[_0x7a2c('0x3d')],{'$or':_['map'](_0x3313d1[_0x7a2c('0x36')],function(_0x55ab6c){var _0x22eae1={};_0x22eae1[_0x55ab6c]={'$like':'%'+_0x3c4c31[_0x7a2c('0x33')]['filter']+'%'};return _0x22eae1;})});}_0x3313d1=_[_0x7a2c('0x3f')]({},_0x3313d1,_0x3c4c31['options']);return _0x248510[_0x7a2c('0x71')](_0x3313d1);}})[_0x7a2c('0x26')](function(_0x2beae3){if(_0x2beae3){_0x535c9b=_0x2beae3[_0x7a2c('0x38')];if(!_0x3c4c31[_0x7a2c('0x33')][_0x7a2c('0x39')](_0x7a2c('0x3a'))){_0x3313d1[_0x7a2c('0x22')]=qs[_0x7a2c('0x22')](_0x3c4c31[_0x7a2c('0x33')][_0x7a2c('0x22')]);_0x3313d1[_0x7a2c('0x1f')]=qs[_0x7a2c('0x1f')](_0x3c4c31[_0x7a2c('0x33')][_0x7a2c('0x1f')]);}return _0x248510['getSounds'](_0x3313d1);}})[_0x7a2c('0x26')](function(_0x59bd12){if(_0x59bd12){return _0x59bd12?{'count':_0x535c9b,'rows':_0x59bd12}:null;}})[_0x7a2c('0x26')](respondWithResult(_0xe0eb5b,null))[_0x7a2c('0x43')](handleError(_0xe0eb5b,null));}; \ No newline at end of file +var _0xdad5=['catch','params','include','find','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','save_name','server/files/sounds/converted','%s.%s','basename','extname','format','converted_format','symlinkSync','removeSound','id2','Sound','createdAt','getSounds','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','MusicOnHolds','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','keys','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','findAll','rows'];(function(_0x1587bf,_0x4b2c62){var _0x5d86f6=function(_0x40593e){while(--_0x40593e){_0x1587bf['push'](_0x1587bf['shift']());}};_0x5d86f6(++_0x4b2c62);}(_0xdad5,0xa0));var _0x5dad=function(_0x3d6c7b,_0x1991df){_0x3d6c7b=_0x3d6c7b-0x0;var _0x146064=_0xdad5[_0x3d6c7b];return _0x146064;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dad('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5dad('0x1'));var rp=require(_0x5dad('0x2'));var moment=require(_0x5dad('0x3'));var BPromise=require(_0x5dad('0x4'));var Mustache=require(_0x5dad('0x5'));var util=require(_0x5dad('0x6'));var path=require('path');var sox=require(_0x5dad('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5dad('0x8'));var _=require(_0x5dad('0x9'));var squel=require(_0x5dad('0xa'));var crypto=require(_0x5dad('0xb'));var jsforce=require(_0x5dad('0xc'));var deskjs=require(_0x5dad('0xd'));var toCsv=require(_0x5dad('0xe'));var querystring=require(_0x5dad('0xf'));var Papa=require(_0x5dad('0x10'));var Redis=require('ioredis');var authService=require(_0x5dad('0x11'));var qs=require(_0x5dad('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5dad('0x13'));var logger=require(_0x5dad('0x14'))(_0x5dad('0x15'));var utils=require(_0x5dad('0x16'));var config=require(_0x5dad('0x17'));var licenseUtil=require(_0x5dad('0x18'));var db=require(_0x5dad('0x19'))['db'];function respondWithStatusCode(_0x1862b7,_0x3005a6){_0x3005a6=_0x3005a6||0xcc;return function(_0x2030aa){if(_0x2030aa){return _0x1862b7[_0x5dad('0x1a')](_0x3005a6);}return _0x1862b7[_0x5dad('0x1b')](_0x3005a6)['end']();};}function respondWithResult(_0xf6f1d5,_0x219f14){_0x219f14=_0x219f14||0xc8;return function(_0x3f8b07){if(_0x3f8b07){return _0xf6f1d5[_0x5dad('0x1b')](_0x219f14)['json'](_0x3f8b07);}};}function respondWithFilteredResult(_0x932982,_0x5c62e7){return function(_0x485ebf){if(_0x485ebf){var _0x3210b1=typeof _0x5c62e7[_0x5dad('0x1c')]===_0x5dad('0x1d')&&typeof _0x5c62e7[_0x5dad('0x1e')]===_0x5dad('0x1d');var _0x5c446c=_0x485ebf[_0x5dad('0x1f')];var _0x4c434a=_0x3210b1?0x0:_0x5c62e7[_0x5dad('0x1c')];var _0x49e217=_0x3210b1?_0x485ebf[_0x5dad('0x1f')]:_0x5c62e7[_0x5dad('0x1c')]+_0x5c62e7[_0x5dad('0x1e')];var _0x56caca;if(_0x49e217>=_0x5c446c){_0x49e217=_0x5c446c;_0x56caca=0xc8;}else{_0x56caca=0xce;}_0x932982[_0x5dad('0x1b')](_0x56caca);return _0x932982[_0x5dad('0x20')](_0x5dad('0x21'),_0x4c434a+'-'+_0x49e217+'/'+_0x5c446c)[_0x5dad('0x22')](_0x485ebf);}return null;};}function patchUpdates(_0x337f12){return function(_0x2c1321){try{jsonpatch[_0x5dad('0x23')](_0x2c1321,_0x337f12,!![]);}catch(_0x2369b0){return BPromise[_0x5dad('0x24')](_0x2369b0);}return _0x2c1321[_0x5dad('0x25')]();};}function saveUpdates(_0x2389e0,_0x1eec4b){return function(_0x3901e6){if(_0x3901e6){return _0x3901e6[_0x5dad('0x26')](_0x2389e0)[_0x5dad('0x27')](function(_0x4b7b6e){return _0x4b7b6e;});}return null;};}function removeEntity(_0x94623f,_0xf867b1){return function(_0x1efc5a){if(_0x1efc5a){return _0x1efc5a[_0x5dad('0x28')]()[_0x5dad('0x27')](function(){var _0x1e9524=_0x1efc5a[_0x5dad('0x29')]({'plain':!![]});var _0x17ad22=_0x5dad('0x2a');return db['UserProfileResource'][_0x5dad('0x28')]({'where':{'type':_0x17ad22,'resourceId':_0x1e9524['id']}})['then'](function(){return _0x1efc5a;});})[_0x5dad('0x27')](function(){_0x94623f[_0x5dad('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x329179,_0x296f3c){return function(_0x52f62f){if(!_0x52f62f){_0x329179[_0x5dad('0x1a')](0x194);}return _0x52f62f;};}function handleError(_0x2dd75b,_0x205548){_0x205548=_0x205548||0x1f4;return function(_0x31e6b7){logger['error'](_0x31e6b7['stack']);if(_0x31e6b7['name']){delete _0x31e6b7[_0x5dad('0x2b')];}_0x2dd75b['status'](_0x205548)[_0x5dad('0x2c')](_0x31e6b7);};}exports[_0x5dad('0x2d')]=function(_0x4a756e,_0x29ce1b){var _0x195393={},_0x1efb02={},_0x2825f4={'count':0x0,'rows':[]};var _0x2febd0=_[_0x5dad('0x2e')](db[_0x5dad('0x2f')][_0x5dad('0x30')],function(_0x402b51){return{'name':_0x402b51[_0x5dad('0x31')],'type':_0x402b51[_0x5dad('0x32')][_0x5dad('0x33')]};});_0x1efb02[_0x5dad('0x34')]=_[_0x5dad('0x2e')](_0x2febd0,_0x5dad('0x2b'));_0x1efb02['query']=_[_0x5dad('0x35')](_0x4a756e['query']);_0x1efb02['filters']=_[_0x5dad('0x36')](_0x1efb02[_0x5dad('0x34')],_0x1efb02['query']);_0x195393[_0x5dad('0x37')]=_['intersection'](_0x1efb02[_0x5dad('0x34')],qs[_0x5dad('0x38')](_0x4a756e[_0x5dad('0x39')][_0x5dad('0x38')]));_0x195393[_0x5dad('0x37')]=_0x195393[_0x5dad('0x37')][_0x5dad('0x3a')]?_0x195393['attributes']:_0x1efb02['model'];if(!_0x4a756e[_0x5dad('0x39')][_0x5dad('0x3b')](_0x5dad('0x3c'))){_0x195393['limit']=qs[_0x5dad('0x1e')](_0x4a756e[_0x5dad('0x39')]['limit']);_0x195393[_0x5dad('0x1c')]=qs['offset'](_0x4a756e[_0x5dad('0x39')][_0x5dad('0x1c')]);}_0x195393[_0x5dad('0x3d')]=qs['sort'](_0x4a756e[_0x5dad('0x39')][_0x5dad('0x3e')]);delete _0x4a756e[_0x5dad('0x39')][_0x5dad('0x3e')];_0x195393['where']=qs[_0x5dad('0x3f')](_[_0x5dad('0x40')](_0x4a756e[_0x5dad('0x39')],_0x1efb02[_0x5dad('0x3f')]),_0x2febd0);if(_0x4a756e['query'][_0x5dad('0x41')]){_0x195393[_0x5dad('0x42')]=_[_0x5dad('0x43')](_0x195393['where'],{'$or':_[_0x5dad('0x2e')](_0x2febd0,function(_0x593023){if(_0x593023[_0x5dad('0x32')]!=='VIRTUAL'){var _0x166624={};_0x166624[_0x593023[_0x5dad('0x2b')]]={'$like':'%'+_0x4a756e[_0x5dad('0x39')][_0x5dad('0x41')]+'%'};return _0x166624;}})});}_0x195393=_[_0x5dad('0x43')]({},_0x195393,_0x4a756e[_0x5dad('0x44')]);var _0x34adb1={'where':_0x195393['where']};return db[_0x5dad('0x2f')]['count'](_0x34adb1)[_0x5dad('0x27')](function(_0x4b25fd){_0x2825f4[_0x5dad('0x1f')]=_0x4b25fd;if(_0x4a756e[_0x5dad('0x39')][_0x5dad('0x45')]){_0x195393['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x5dad('0x46')](_0x195393);})[_0x5dad('0x27')](function(_0x42d546){_0x2825f4[_0x5dad('0x47')]=_0x42d546;return _0x2825f4;})[_0x5dad('0x27')](respondWithFilteredResult(_0x29ce1b,_0x195393))[_0x5dad('0x48')](handleError(_0x29ce1b,null));};exports['show']=function(_0xe3c31b,_0x38c406){var _0x4e26a4={'raw':![],'where':{'id':_0xe3c31b[_0x5dad('0x49')]['id']}},_0x1496b1={};_0x1496b1[_0x5dad('0x34')]=_[_0x5dad('0x35')](db[_0x5dad('0x2f')][_0x5dad('0x30')]);_0x1496b1[_0x5dad('0x39')]=_['keys'](_0xe3c31b[_0x5dad('0x39')]);_0x1496b1['filters']=_[_0x5dad('0x36')](_0x1496b1[_0x5dad('0x34')],_0x1496b1[_0x5dad('0x39')]);_0x4e26a4[_0x5dad('0x37')]=_[_0x5dad('0x36')](_0x1496b1[_0x5dad('0x34')],qs['fields'](_0xe3c31b['query'][_0x5dad('0x38')]));_0x4e26a4['attributes']=_0x4e26a4['attributes'][_0x5dad('0x3a')]?_0x4e26a4[_0x5dad('0x37')]:_0x1496b1[_0x5dad('0x34')];if(_0xe3c31b[_0x5dad('0x39')]['includeAll']){_0x4e26a4[_0x5dad('0x4a')]=[{'all':!![]}];}_0x4e26a4=_['merge']({},_0x4e26a4,_0xe3c31b[_0x5dad('0x44')]);return db[_0x5dad('0x2f')][_0x5dad('0x4b')](_0x4e26a4)['then'](handleEntityNotFound(_0x38c406,null))['then'](respondWithResult(_0x38c406,null))[_0x5dad('0x48')](handleError(_0x38c406,null));};exports['update']=function(_0x382b1c,_0x41e880){if(_0x382b1c['body']['id']){delete _0x382b1c['body']['id'];}return db[_0x5dad('0x2f')][_0x5dad('0x4b')]({'where':{'id':_0x382b1c[_0x5dad('0x49')]['id']}})[_0x5dad('0x27')](handleEntityNotFound(_0x41e880,null))[_0x5dad('0x27')](saveUpdates(_0x382b1c[_0x5dad('0x4c')],null))[_0x5dad('0x27')](respondWithResult(_0x41e880,null))[_0x5dad('0x48')](handleError(_0x41e880,null));};exports[_0x5dad('0x4d')]=function(_0x3d2a30,_0x186211,_0x3bfe2b){return db[_0x5dad('0x4e')][_0x5dad('0x4f')](function(_0x362a6b){if(_0x3d2a30[_0x5dad('0x4c')][_0x5dad('0x50')]===_0x5dad('0x51')){_0x3d2a30[_0x5dad('0x4c')][_0x5dad('0x52')]=path[_0x5dad('0x53')](config[_0x5dad('0x54')],_0x5dad('0x55'),_0x3d2a30['body'][_0x5dad('0x2b')]);}return db[_0x5dad('0x2f')][_0x5dad('0x4d')](_0x3d2a30[_0x5dad('0x4c')],{'transaction':_0x362a6b})[_0x5dad('0x27')](function(_0x1393d3){if(_0x3d2a30['body'][_0x5dad('0x50')]===_0x5dad('0x51')){fs[_0x5dad('0x56')](_0x1393d3['directory'],parseInt(_0x5dad('0x57'),0x8));}var _0x107f04=_0x3d2a30['user'][_0x5dad('0x29')]({'plain':!![]});if(!_0x107f04)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x107f04[_0x5dad('0x58')]===_0x5dad('0x59')){var _0x3de68f=_0x1393d3[_0x5dad('0x29')]({'plain':!![]});return db['UserProfileSection'][_0x5dad('0x4b')]({'where':{'name':_0x5dad('0x2a'),'userProfileId':_0x107f04[_0x5dad('0x5a')]},'raw':!![]})[_0x5dad('0x27')](function(_0x132266){if(_0x132266&&_0x132266[_0x5dad('0x5b')]===0x0){return db[_0x5dad('0x5c')][_0x5dad('0x4d')]({'name':_0x3de68f[_0x5dad('0x2b')],'resourceId':_0x3de68f['id'],'type':_0x132266['name'],'sectionId':_0x132266['id']},{})['then'](function(){return _0x1393d3;});}else{return _0x1393d3;}})[_0x5dad('0x48')](function(_0x3369dc){logger['error'](_0x5dad('0x5d'),_0x3369dc);});}return _0x1393d3;});})[_0x5dad('0x27')](respondWithResult(_0x186211,0xc9))[_0x5dad('0x48')](handleError(_0x186211,null));};exports[_0x5dad('0x28')]=function(_0x8df37e,_0x162f54,_0x4a176d){var _0x190738;return db[_0x5dad('0x2f')]['find']({'where':{'id':_0x8df37e['params']['id']}})[_0x5dad('0x27')](function(_0x178fdd){if(_0x178fdd){return db['sequelize']['transaction'](function(_0x78651f){return _0x178fdd[_0x5dad('0x28')]({'transaction':_0x78651f,'raw':!![]})[_0x5dad('0x27')](function(_0x471c5a){if(_0x471c5a[_0x5dad('0x52')]){fs[_0x5dad('0x5e')](_0x471c5a['directory'])[_0x5dad('0x5f')](function(_0x474b73){fs[_0x5dad('0x60')](path[_0x5dad('0x53')](_0x471c5a[_0x5dad('0x52')],_0x474b73));});fs[_0x5dad('0x61')](_0x471c5a[_0x5dad('0x52')]);}return _0x471c5a;});})[_0x5dad('0x48')](function(_0x1ae700){throw new db[(_0x5dad('0x62'))][(_0x5dad('0x63'))](_0x1ae700[_0x5dad('0x64')]);});}})['then'](handleEntityNotFound(_0x162f54,null))['then'](removeEntity(_0x162f54,null))[_0x5dad('0x48')](handleError(_0x162f54,null));};exports[_0x5dad('0x65')]=function(_0x496af4,_0x4a4834,_0x995730){return db[_0x5dad('0x4e')]['transaction'](function(_0x3e5c7b){var _0x53c813;return db[_0x5dad('0x2f')][_0x5dad('0x4b')]({'where':{'id':_0x496af4[_0x5dad('0x49')]['id']}})[_0x5dad('0x27')](function(_0x3ca7dd){if(_0x3ca7dd){_0x53c813=_0x3ca7dd;return _0x3ca7dd['addSound'](_0x496af4[_0x5dad('0x4c')]['id'],{'transaction':_0x3e5c7b});}})['then'](function(_0x10f7c2){if(_0x10f7c2){return db['Sound'][_0x5dad('0x66')]({'where':{'id':_0x496af4['body']['id']},'attributes':['id',_0x5dad('0x2b'),_0x5dad('0x67'),'converted_format','createdAt'],'raw':!![]});}})[_0x5dad('0x27')](function(_0x1faa33){if(_0x1faa33){var _0x5ac555=path[_0x5dad('0x53')](config['root'],_0x5dad('0x68'),util['format'](_0x5dad('0x69'),path[_0x5dad('0x6a')](_0x1faa33['save_name'],path[_0x5dad('0x6b')](_0x1faa33[_0x5dad('0x67')])),_0x1faa33['converted_format']));var _0x2cc4f4=path[_0x5dad('0x53')](config[_0x5dad('0x54')],'server/files/moh',_0x53c813[_0x5dad('0x2b')],util[_0x5dad('0x6c')](_0x5dad('0x69'),_0x1faa33[_0x5dad('0x2b')],_0x1faa33[_0x5dad('0x6d')]));fs[_0x5dad('0x6e')](_0x5ac555,_0x2cc4f4);return _0x1faa33;}})[_0x5dad('0x48')](function(_0x2e53ba){throw new db[(_0x5dad('0x62'))][(_0x5dad('0x63'))](_0x2e53ba['message']);});})[_0x5dad('0x27')](handleEntityNotFound(_0x4a4834,null))[_0x5dad('0x27')](respondWithResult(_0x4a4834,0xc9))[_0x5dad('0x48')](handleError(_0x4a4834,null));};exports['removeSound']=function(_0x17d84a,_0x55e805,_0xb414a6){return db[_0x5dad('0x4e')]['transaction'](function(_0x1d98eb){var _0x3f7d70;return db[_0x5dad('0x2f')][_0x5dad('0x66')]({'where':{'id':_0x17d84a[_0x5dad('0x49')]['id']}})['then'](handleEntityNotFound(_0x55e805,null))['then'](function(_0x255bb3){if(_0x255bb3){_0x3f7d70=_0x255bb3;return _0x255bb3[_0x5dad('0x6f')](_0x17d84a[_0x5dad('0x49')][_0x5dad('0x70')]);}})['then'](function(_0x393347){if(_0x393347){return db[_0x5dad('0x71')][_0x5dad('0x66')]({'where':{'id':_0x17d84a[_0x5dad('0x49')][_0x5dad('0x70')]},'attributes':['id',_0x5dad('0x2b'),'save_name',_0x5dad('0x6d'),_0x5dad('0x72')],'raw':!![]});}})[_0x5dad('0x27')](function(_0x50ed7b){if(_0x50ed7b){fs['unlinkSync'](path[_0x5dad('0x53')](_0x3f7d70['directory'],util[_0x5dad('0x6c')]('%s.%s',_0x50ed7b['name'],_0x50ed7b[_0x5dad('0x6d')])));return _0x50ed7b;}})[_0x5dad('0x48')](function(_0x337d6d){throw new db[(_0x5dad('0x62'))][(_0x5dad('0x63'))](_0x337d6d[_0x5dad('0x64')]);});})[_0x5dad('0x27')](handleEntityNotFound(_0x55e805,null))[_0x5dad('0x27')](respondWithStatusCode(_0x55e805,0xcc))['catch'](handleError(_0x55e805,null));};exports[_0x5dad('0x73')]=function(_0x34ba5a,_0x34425f,_0x444162){var _0x573431={};var _0x47bb5b={};var _0x1b8448;var _0xc12ed8;return db[_0x5dad('0x2f')]['findOne']({'where':{'id':_0x34ba5a[_0x5dad('0x49')]['id']}})[_0x5dad('0x27')](handleEntityNotFound(_0x34425f,null))[_0x5dad('0x27')](function(_0x551d7b){if(_0x551d7b){_0x1b8448=_0x551d7b;_0x47bb5b[_0x5dad('0x34')]=_[_0x5dad('0x35')](db[_0x5dad('0x71')]['rawAttributes']);_0x47bb5b['query']=_[_0x5dad('0x35')](_0x34ba5a['query']);_0x47bb5b[_0x5dad('0x3f')]=_['intersection'](_0x47bb5b[_0x5dad('0x34')],_0x47bb5b[_0x5dad('0x39')]);_0x573431[_0x5dad('0x37')]=_[_0x5dad('0x36')](_0x47bb5b[_0x5dad('0x34')],qs['fields'](_0x34ba5a['query']['fields']));_0x573431['attributes']=_0x573431[_0x5dad('0x37')][_0x5dad('0x3a')]?_0x573431[_0x5dad('0x37')]:_0x47bb5b[_0x5dad('0x34')];_0x573431[_0x5dad('0x3d')]=qs[_0x5dad('0x3e')](_0x34ba5a[_0x5dad('0x39')][_0x5dad('0x3e')]);_0x573431['where']=qs[_0x5dad('0x3f')](_['pick'](_0x34ba5a[_0x5dad('0x39')],_0x47bb5b[_0x5dad('0x3f')]));if(_0x34ba5a['query'][_0x5dad('0x41')]){_0x573431['where']=_[_0x5dad('0x43')](_0x573431[_0x5dad('0x42')],{'$or':_[_0x5dad('0x2e')](_0x573431[_0x5dad('0x37')],function(_0x196fb6){var _0x4a11ab={};_0x4a11ab[_0x196fb6]={'$like':'%'+_0x34ba5a['query'][_0x5dad('0x41')]+'%'};return _0x4a11ab;})});}_0x573431=_[_0x5dad('0x43')]({},_0x573431,_0x34ba5a['options']);return _0x1b8448[_0x5dad('0x73')](_0x573431);}})['then'](function(_0xed6d66){if(_0xed6d66){_0xc12ed8=_0xed6d66[_0x5dad('0x3a')];if(!_0x34ba5a[_0x5dad('0x39')]['hasOwnProperty'](_0x5dad('0x3c'))){_0x573431[_0x5dad('0x1e')]=qs[_0x5dad('0x1e')](_0x34ba5a[_0x5dad('0x39')][_0x5dad('0x1e')]);_0x573431[_0x5dad('0x1c')]=qs[_0x5dad('0x1c')](_0x34ba5a[_0x5dad('0x39')]['offset']);}return _0x1b8448['getSounds'](_0x573431);}})[_0x5dad('0x27')](function(_0xf16e70){if(_0xf16e70){return _0xf16e70?{'count':_0xc12ed8,'rows':_0xf16e70}:null;}})['then'](respondWithResult(_0x34425f,null))['catch'](handleError(_0x34425f,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 1d80cf8..c91da91 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 _0x1c03=['request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','voice_musiconhold','util','../../config/logger','api','moment','bluebird'];(function(_0x687ddc,_0x2092fa){var _0x441991=function(_0x49c6a6){while(--_0x49c6a6){_0x687ddc['push'](_0x687ddc['shift']());}};_0x441991(++_0x2092fa);}(_0x1c03,0x1bd));var _0x31c0=function(_0x149319,_0x4182b5){_0x149319=_0x149319-0x0;var _0x4637c9=_0x1c03[_0x149319];return _0x4637c9;};'use strict';var _=require('lodash');var util=require(_0x31c0('0x0'));var logger=require(_0x31c0('0x1'))(_0x31c0('0x2'));var moment=require(_0x31c0('0x3'));var BPromise=require(_0x31c0('0x4'));var rp=require(_0x31c0('0x5'));var fs=require('fs');var path=require(_0x31c0('0x6'));var rimraf=require('rimraf');var config=require(_0x31c0('0x7'));var attributes=require(_0x31c0('0x8'));module['exports']=function(_0x15716a,_0x9200be){return _0x15716a['define']('VoiceMusicOnHold',attributes,{'tableName':_0x31c0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23f4=['moment','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','define','voice_musiconhold','lodash','util','../../config/logger'];(function(_0x2a3107,_0x29bb0f){var _0x153362=function(_0x253bb9){while(--_0x253bb9){_0x2a3107['push'](_0x2a3107['shift']());}};_0x153362(++_0x29bb0f);}(_0x23f4,0x97));var _0x423f=function(_0x525dde,_0x3fb1ca){_0x525dde=_0x525dde-0x0;var _0x3cc3c7=_0x23f4[_0x525dde];return _0x3cc3c7;};'use strict';var _=require(_0x423f('0x0'));var util=require(_0x423f('0x1'));var logger=require(_0x423f('0x2'))('api');var moment=require(_0x423f('0x3'));var BPromise=require('bluebird');var rp=require(_0x423f('0x4'));var fs=require('fs');var path=require(_0x423f('0x5'));var rimraf=require(_0x423f('0x6'));var config=require(_0x423f('0x7'));var attributes=require(_0x423f('0x8'));module['exports']=function(_0x5e8292,_0x24f1a5){return _0x5e8292[_0x423f('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0x423f('0xa'),'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 88d7640..81447a8 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 _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\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(_0x52e0db,_0x5c09fe){var _0x29b667=function(_0x2fd94f){while(--_0x2fd94f){_0x52e0db['push'](_0x52e0db['shift']());}};_0x29b667(++_0x5c09fe);}(_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')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\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')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\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(_0x18c41c,_0x13fe82){var _0x4c2bbb=function(_0x13274c){while(--_0x13274c){_0x18c41c['push'](_0x18c41c['shift']());}};_0x4c2bbb(++_0x13fe82);}(_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')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\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')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 0a0d709..26ebf22 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 _0x2a8d=['update','destroy','removeAgents','delete','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id/users','/:id/teams','getTeams','post','create','addAgents','addTeams','/:id'];(function(_0x5949c3,_0x177331){var _0x348e58=function(_0x1d87d4){while(--_0x1d87d4){_0x5949c3['push'](_0x5949c3['shift']());}};_0x348e58(++_0x177331);}(_0x2a8d,0x11e));var _0xd2a8=function(_0x31b57a,_0x3dddf3){_0x31b57a=_0x31b57a-0x0;var _0x2df3dd=_0x2a8d[_0x31b57a];return _0x2df3dd;};'use strict';var multer=require(_0xd2a8('0x0'));var util=require(_0xd2a8('0x1'));var path=require(_0xd2a8('0x2'));var timeout=require(_0xd2a8('0x3'));var express=require(_0xd2a8('0x4'));var router=express[_0xd2a8('0x5')]();var fs_extra=require(_0xd2a8('0x6'));var auth=require(_0xd2a8('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd2a8('0x8'));router[_0xd2a8('0x9')]('/',auth[_0xd2a8('0xa')](),controller[_0xd2a8('0xb')]);router[_0xd2a8('0x9')](_0xd2a8('0xc'),auth[_0xd2a8('0xa')](),controller[_0xd2a8('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xd2a8('0x9')](_0xd2a8('0xe'),auth['isAuthenticated'](),controller['getAgents']);router[_0xd2a8('0x9')](_0xd2a8('0xf'),auth['isAuthenticated'](),controller[_0xd2a8('0x10')]);router[_0xd2a8('0x11')]('/',auth[_0xd2a8('0xa')](),controller[_0xd2a8('0x12')]);router[_0xd2a8('0x11')](_0xd2a8('0xe'),auth[_0xd2a8('0xa')](),controller[_0xd2a8('0x13')]);router[_0xd2a8('0x11')]('/:id/teams',auth[_0xd2a8('0xa')](),controller[_0xd2a8('0x14')]);router['put'](_0xd2a8('0x15'),auth[_0xd2a8('0xa')](),controller[_0xd2a8('0x16')]);router['delete'](_0xd2a8('0x15'),auth[_0xd2a8('0xa')](),controller[_0xd2a8('0x17')]);router['delete'](_0xd2a8('0xe'),auth[_0xd2a8('0xa')](),controller[_0xd2a8('0x18')]);router[_0xd2a8('0x19')](_0xd2a8('0xf'),auth[_0xd2a8('0xa')](),controller[_0xd2a8('0x1a')]);module[_0xd2a8('0x1b')]=router; \ No newline at end of file +var _0xac0a=['/describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update','delete','removeAgents','removeTeams','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index'];(function(_0x52d4fa,_0x1b3876){var _0x399623=function(_0x32c0f8){while(--_0x32c0f8){_0x52d4fa['push'](_0x52d4fa['shift']());}};_0x399623(++_0x1b3876);}(_0xac0a,0x11e));var _0xaac0=function(_0x35e8d6,_0x1179f3){_0x35e8d6=_0x35e8d6-0x0;var _0x2036cb=_0xac0a[_0x35e8d6];return _0x2036cb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaac0('0x0'));var timeout=require(_0xaac0('0x1'));var express=require('express');var router=express[_0xaac0('0x2')]();var fs_extra=require(_0xaac0('0x3'));var auth=require(_0xaac0('0x4'));var interaction=require(_0xaac0('0x5'));var config=require(_0xaac0('0x6'));var controller=require(_0xaac0('0x7'));router[_0xaac0('0x8')]('/',auth[_0xaac0('0x9')](),controller[_0xaac0('0xa')]);router[_0xaac0('0x8')](_0xaac0('0xb'),auth[_0xaac0('0x9')](),controller['describe']);router[_0xaac0('0x8')](_0xaac0('0xc'),auth['isAuthenticated'](),controller[_0xaac0('0xd')]);router[_0xaac0('0x8')](_0xaac0('0xe'),auth[_0xaac0('0x9')](),controller[_0xaac0('0xf')]);router[_0xaac0('0x8')](_0xaac0('0x10'),auth[_0xaac0('0x9')](),controller[_0xaac0('0x11')]);router[_0xaac0('0x12')]('/',auth[_0xaac0('0x9')](),controller[_0xaac0('0x13')]);router[_0xaac0('0x12')](_0xaac0('0xe'),auth[_0xaac0('0x9')](),controller[_0xaac0('0x14')]);router[_0xaac0('0x12')](_0xaac0('0x10'),auth[_0xaac0('0x9')](),controller[_0xaac0('0x15')]);router[_0xaac0('0x16')](_0xaac0('0xc'),auth[_0xaac0('0x9')](),controller[_0xaac0('0x17')]);router[_0xaac0('0x18')](_0xaac0('0xc'),auth[_0xaac0('0x9')](),controller['destroy']);router[_0xaac0('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0xaac0('0x19')]);router[_0xaac0('0x18')]('/:id/teams',auth[_0xaac0('0x9')](),controller[_0xaac0('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 a9e0fa3..c0590b5 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 _0x6da2=['VIRTUAL','getDataValue','name','INTEGER','sequelize','exports','STRING'];(function(_0x43cdcc,_0x56c3cc){var _0x116fef=function(_0xb6f5c1){while(--_0xb6f5c1){_0x43cdcc['push'](_0x43cdcc['shift']());}};_0x116fef(++_0x56c3cc);}(_0x6da2,0xc8));var _0x26da=function(_0x5b6cf1,_0x32fdcd){_0x5b6cf1=_0x5b6cf1-0x0;var _0x46278c=_0x6da2[_0x5b6cf1];return _0x46278c;};'use strict';var Sequelize=require(_0x26da('0x0'));module[_0x26da('0x1')]={'name':{'type':Sequelize[_0x26da('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x26da('0x3')],'get':function(_0xc0ac01){return'system-'+this[_0x26da('0x4')](_0x26da('0x5'))+'-';}},'description':{'type':Sequelize[_0x26da('0x2')]},'callerIdAll':{'type':Sequelize[_0x26da('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x26da('0x6')]}}; \ No newline at end of file +var _0xa8d3=['system-','name','INTEGER','sequelize','exports','STRING','VIRTUAL'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa8d3,0x8f));var _0x3a8d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa8d3[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x3a8d('0x0'));module[_0x3a8d('0x1')]={'name':{'type':Sequelize[_0x3a8d('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x3a8d('0x3')],'get':function(_0x39775a){return _0x3a8d('0x4')+this['getDataValue'](_0x3a8d('0x5'))+'-';}},'description':{'type':Sequelize[_0x3a8d('0x2')]},'callerIdAll':{'type':Sequelize[_0x3a8d('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x3a8d('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 30b08a7..9b4bab2 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 _0xa30a=['priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','push','PREFIX-CALLERIDALL=','charAt','body','VoiceExtensionId','findById','addAgents','ids','omit','spread','emit','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','getTeams','Team','order','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','TeamVoicePrefix','upsert','findOrCreate','userVoicePrefix:save','removeTeams','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','forEach','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','index','VoicePrefix','rawAttributes','fieldName','type','map','keys','filters','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','find','params','describe','create','transaction','VoiceExtension','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','description','Voice\x20Prefix\x20Extension'];(function(_0x567317,_0x4163e5){var _0x3c9417=function(_0x997585){while(--_0x997585){_0x567317['push'](_0x567317['shift']());}};_0x3c9417(++_0x4163e5);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xaa30('0x0'));var rimraf=require(_0xaa30('0x1'));var zipdir=require(_0xaa30('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa30('0x3'));var moment=require(_0xaa30('0x4'));var BPromise=require(_0xaa30('0x5'));var Mustache=require(_0xaa30('0x6'));var util=require(_0xaa30('0x7'));var path=require(_0xaa30('0x8'));var sox=require(_0xaa30('0x9'));var csv=require('to-csv');var ejs=require(_0xaa30('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa30('0xb'));var squel=require(_0xaa30('0xc'));var crypto=require(_0xaa30('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaa30('0xe'));var toCsv=require(_0xaa30('0xf'));var querystring=require(_0xaa30('0x10'));var Papa=require(_0xaa30('0x11'));var Redis=require(_0xaa30('0x12'));var authService=require(_0xaa30('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa30('0x14'));var logger=require('../../config/logger')(_0xaa30('0x15'));var utils=require(_0xaa30('0x16'));var config=require(_0xaa30('0x17'));var licenseUtil=require(_0xaa30('0x18'));var db=require('../../mysqldb')['db'];config[_0xaa30('0x19')]=_[_0xaa30('0x1a')](config[_0xaa30('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa30('0x1b'))(new Redis(config[_0xaa30('0x19')]));require(_0xaa30('0x1c'))[_0xaa30('0x1d')](socket);function respondWithStatusCode(_0x41f1d9,_0x31aa0b){_0x31aa0b=_0x31aa0b||0xcc;return function(_0x3240e9){if(_0x3240e9){return _0x41f1d9[_0xaa30('0x1e')](_0x31aa0b);}return _0x41f1d9[_0xaa30('0x1f')](_0x31aa0b)[_0xaa30('0x20')]();};}function respondWithResult(_0x519518,_0x91839d){_0x91839d=_0x91839d||0xc8;return function(_0x591478){if(_0x591478){return _0x519518['status'](_0x91839d)[_0xaa30('0x21')](_0x591478);}};}function respondWithFilteredResult(_0x153939,_0x130606){return function(_0x540e36){if(_0x540e36){var _0x54fa49=typeof _0x130606['offset']===_0xaa30('0x22')&&typeof _0x130606['limit']===_0xaa30('0x22');var _0x332a0a=_0x540e36['count'];var _0x4e29f9=_0x54fa49?0x0:_0x130606['offset'];var _0x3cbf92=_0x54fa49?_0x540e36[_0xaa30('0x23')]:_0x130606[_0xaa30('0x24')]+_0x130606[_0xaa30('0x25')];var _0x43a526;if(_0x3cbf92>=_0x332a0a){_0x3cbf92=_0x332a0a;_0x43a526=0xc8;}else{_0x43a526=0xce;}_0x153939['status'](_0x43a526);return _0x153939[_0xaa30('0x26')](_0xaa30('0x27'),_0x4e29f9+'-'+_0x3cbf92+'/'+_0x332a0a)[_0xaa30('0x21')](_0x540e36);}return null;};}function patchUpdates(_0x2d9e35){return function(_0x1ff442){try{jsonpatch['apply'](_0x1ff442,_0x2d9e35,!![]);}catch(_0x325b42){return BPromise[_0xaa30('0x28')](_0x325b42);}return _0x1ff442[_0xaa30('0x29')]();};}function saveUpdates(_0x326f84,_0x57d1ca){return function(_0x14d7fa){if(_0x14d7fa){return _0x14d7fa[_0xaa30('0x2a')](_0x326f84)[_0xaa30('0x2b')](function(_0x12da2f){return _0x12da2f;});}return null;};}function removeEntity(_0x97b038,_0x2a59ce){return function(_0x55cccb){if(_0x55cccb){return _0x55cccb[_0xaa30('0x2c')]()[_0xaa30('0x2b')](function(){var _0x5d4da8=_0x55cccb[_0xaa30('0x2d')]({'plain':!![]});var _0x5b3efb=_0xaa30('0x2e');return db[_0xaa30('0x2f')][_0xaa30('0x2c')]({'where':{'type':_0x5b3efb,'resourceId':_0x5d4da8['id']}})[_0xaa30('0x2b')](function(){return _0x55cccb;});})[_0xaa30('0x2b')](function(){_0x97b038[_0xaa30('0x1f')](0xcc)[_0xaa30('0x20')]();});}};}function handleEntityNotFound(_0x39f708,_0x1f288c){return function(_0x43fb30){if(!_0x43fb30){_0x39f708[_0xaa30('0x1e')](0x194);}return _0x43fb30;};}function handleError(_0x43003f,_0x2038a6){_0x2038a6=_0x2038a6||0x1f4;return function(_0x46abb9){logger[_0xaa30('0x30')](_0x46abb9[_0xaa30('0x31')]);if(_0x46abb9[_0xaa30('0x32')]){delete _0x46abb9[_0xaa30('0x32')];}_0x43003f['status'](_0x2038a6)[_0xaa30('0x33')](_0x46abb9);};}exports[_0xaa30('0x34')]=function(_0x3bc22f,_0x20916f){var _0x2276e0={},_0x1dce4a={},_0x4dae71={'count':0x0,'rows':[]};var _0x5addbf=_['map'](db[_0xaa30('0x35')][_0xaa30('0x36')],function(_0xb48ef3){return{'name':_0xb48ef3[_0xaa30('0x37')],'type':_0xb48ef3[_0xaa30('0x38')]['key']};});_0x1dce4a['model']=_[_0xaa30('0x39')](_0x5addbf,_0xaa30('0x32'));_0x1dce4a['query']=_[_0xaa30('0x3a')](_0x3bc22f['query']);_0x1dce4a[_0xaa30('0x3b')]=_['intersection'](_0x1dce4a[_0xaa30('0x3c')],_0x1dce4a[_0xaa30('0x3d')]);_0x2276e0['attributes']=_[_0xaa30('0x3e')](_0x1dce4a[_0xaa30('0x3c')],qs[_0xaa30('0x3f')](_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x3f')]));_0x2276e0[_0xaa30('0x40')]=_0x2276e0['attributes'][_0xaa30('0x41')]?_0x2276e0[_0xaa30('0x40')]:_0x1dce4a['model'];if(!_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x42')](_0xaa30('0x43'))){_0x2276e0['limit']=qs['limit'](_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x25')]);_0x2276e0[_0xaa30('0x24')]=qs[_0xaa30('0x24')](_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x24')]);}_0x2276e0['order']=qs['sort'](_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x44')]);_0x2276e0[_0xaa30('0x45')]=qs['filters'](_[_0xaa30('0x46')](_0x3bc22f[_0xaa30('0x3d')],_0x1dce4a[_0xaa30('0x3b')]),_0x5addbf);if(_0x3bc22f[_0xaa30('0x3d')]['filter']){_0x2276e0[_0xaa30('0x45')]=_[_0xaa30('0x47')](_0x2276e0[_0xaa30('0x45')],{'$or':_[_0xaa30('0x39')](_0x5addbf,function(_0x1f6f53){if(_0x1f6f53['type']!==_0xaa30('0x48')){var _0x29cf85={};_0x29cf85[_0x1f6f53[_0xaa30('0x32')]]={'$like':'%'+_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x49')]+'%'};return _0x29cf85;}})});}_0x2276e0=_[_0xaa30('0x47')]({},_0x2276e0,_0x3bc22f[_0xaa30('0x4a')]);var _0x17510b={'where':_0x2276e0['where']};return db['VoicePrefix'][_0xaa30('0x23')](_0x17510b)['then'](function(_0x5208f8){_0x4dae71['count']=_0x5208f8;if(_0x3bc22f[_0xaa30('0x3d')]['includeAll']){_0x2276e0[_0xaa30('0x4b')]=[{'all':!![]}];}return db['VoicePrefix'][_0xaa30('0x4c')](_0x2276e0);})[_0xaa30('0x2b')](function(_0x3f530e){_0x4dae71[_0xaa30('0x4d')]=_0x3f530e;return _0x4dae71;})[_0xaa30('0x2b')](respondWithFilteredResult(_0x20916f,_0x2276e0))[_0xaa30('0x4e')](handleError(_0x20916f,null));};exports[_0xaa30('0x4f')]=function(_0xc1ae21,_0x3302ff){var _0x521462={'raw':![],'where':{'id':_0xc1ae21['params']['id']}},_0x334639={};_0x334639[_0xaa30('0x3c')]=_[_0xaa30('0x3a')](db[_0xaa30('0x35')][_0xaa30('0x36')]);_0x334639[_0xaa30('0x3d')]=_['keys'](_0xc1ae21['query']);_0x334639[_0xaa30('0x3b')]=_['intersection'](_0x334639[_0xaa30('0x3c')],_0x334639[_0xaa30('0x3d')]);_0x521462[_0xaa30('0x40')]=_[_0xaa30('0x3e')](_0x334639[_0xaa30('0x3c')],qs[_0xaa30('0x3f')](_0xc1ae21[_0xaa30('0x3d')]['fields']));_0x521462[_0xaa30('0x40')]=_0x521462[_0xaa30('0x40')][_0xaa30('0x41')]?_0x521462['attributes']:_0x334639[_0xaa30('0x3c')];if(_0xc1ae21[_0xaa30('0x3d')]['includeAll']){_0x521462[_0xaa30('0x4b')]=[{'all':!![]}];}_0x521462=_['merge']({},_0x521462,_0xc1ae21[_0xaa30('0x4a')]);return db['VoicePrefix']['find'](_0x521462)[_0xaa30('0x2b')](handleEntityNotFound(_0x3302ff,null))['then'](respondWithResult(_0x3302ff,null))['catch'](handleError(_0x3302ff,null));};exports[_0xaa30('0x2c')]=function(_0x1083e2,_0x2574f5){return db[_0xaa30('0x35')][_0xaa30('0x50')]({'where':{'id':_0x1083e2[_0xaa30('0x51')]['id']}})['then'](handleEntityNotFound(_0x2574f5,null))[_0xaa30('0x2b')](removeEntity(_0x2574f5,null))[_0xaa30('0x4e')](handleError(_0x2574f5,null));};exports[_0xaa30('0x52')]=function(_0x57a5fa,_0x53bcaa){return db['VoicePrefix']['describe']()[_0xaa30('0x2b')](respondWithResult(_0x53bcaa,null))[_0xaa30('0x4e')](handleError(_0x53bcaa,null));};exports[_0xaa30('0x53')]=function(_0x1d5c15,_0x1cb3f9){var _0x1ed257;return db['sequelize'][_0xaa30('0x54')](function(_0x2db9d5){return db[_0xaa30('0x35')][_0xaa30('0x53')](_0x1d5c15['body'],{'transaction':_0x2db9d5})[_0xaa30('0x2b')](function(_0x2d23f8){_0x1ed257=_0x2d23f8[_0xaa30('0x2d')]({'plain':!![]});return db[_0xaa30('0x55')][_0xaa30('0x50')]({'where':{'id':_0x1ed257['VoiceExtensionId']},'raw':!![]})['then'](function(_0x34ca1c){return createVoicePrefixExtensions(_0x1ed257,_0x34ca1c,_0x2db9d5);});});})[_0xaa30('0x2b')](function(){var _0x3c4f07=_0x1d5c15['user'][_0xaa30('0x2d')]({'plain':!![]});if(!_0x3c4f07)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c4f07[_0xaa30('0x56')]===_0xaa30('0x57')){var _0x483a01=_0x1ed257;return db[_0xaa30('0x58')][_0xaa30('0x50')]({'where':{'name':'VoicePrefixes','userProfileId':_0x3c4f07[_0xaa30('0x59')]},'raw':!![]})['then'](function(_0x5b227d){if(_0x5b227d&&_0x5b227d[_0xaa30('0x5a')]===0x0){return db[_0xaa30('0x2f')][_0xaa30('0x53')]({'name':_0x483a01['name'],'resourceId':_0x483a01['id'],'type':_0x5b227d[_0xaa30('0x32')],'sectionId':_0x5b227d['id']},{})[_0xaa30('0x2b')](function(){return _0x1ed257;});}else{return _0x1ed257;}})[_0xaa30('0x4e')](function(_0x949d84){logger[_0xaa30('0x30')](_0xaa30('0x5b'),_0x949d84);throw _0x949d84;});}return _0x1ed257;})[_0xaa30('0x2b')](respondWithResult(_0x1cb3f9,null))[_0xaa30('0x4e')](handleError(_0x1cb3f9,null));};function Extension(_0x242b5a,_0x426b90,_0xb1afa8,_0x2f84fa){this[_0xaa30('0x5c')]='from-sip';this[_0xaa30('0x5d')]=_0x242b5a;this[_0xaa30('0x5e')]=_0xb1afa8;this[_0xaa30('0x38')]='system';this[_0xaa30('0x5f')]=_0xaa30('0x60');this[_0xaa30('0x61')]=_0x426b90;this[_0xaa30('0x62')]=_0x2f84fa;}function createVoicePrefixExtensions(_0x9ee658,_0x2c5959,_0x4f1d54){return new BPromise(function(_0x366205,_0x4f5222){var _0x36242e=new Extension(formatPrefixName(_0x9ee658[_0xaa30('0x63')]),0x1,_0xaa30('0x64'),_0xaa30('0x65'));_0x36242e['VoicePrefixId']=_0x9ee658['id'];return db[_0xaa30('0x55')][_0xaa30('0x53')](_0x36242e,{'transaction':_0x4f1d54})['then'](function(_0x26f6f9){var _0x62b307=_0x26f6f9[_0xaa30('0x2d')]({'plain':!![]});var _0x16097e=_[_0xaa30('0x39')](addVoicePrefixExtensions(_0x9ee658,_0x2c5959),function(_0x13ee8f){_0x13ee8f['VoiceExtensionId']=_0x62b307['id'];_0x13ee8f[_0xaa30('0x66')]=_0x9ee658['id'];return _0x13ee8f;});return db[_0xaa30('0x55')][_0xaa30('0x67')](_0x16097e,{'transaction':_0x4f1d54})[_0xaa30('0x2b')](function(_0x334ef1){if(!_0x334ef1){return _0x4f5222(_0xaa30('0x68'));}else{return _0x366205(_0x334ef1);}})[_0xaa30('0x4e')](function(_0x42da00){return _0x4f5222(_0x42da00);});});;});};function addVoicePrefixExtensions(_0x4318a2,_0x6c968e){var _0x46bdc4=[];var _0x2f4d77=formatPrefixName(_0x4318a2[_0xaa30('0x63')]);_0x46bdc4['push'](new Extension(_0x2f4d77,0x2,_0xaa30('0x69'),'CDR(prefix)='+_0x4318a2[_0xaa30('0x32')]));if(_0x4318a2['callerIdAll']){_0x46bdc4[_0xaa30('0x6a')](new Extension(_0x2f4d77,0x3,_0xaa30('0x69'),_0xaa30('0x6b')+_0x4318a2['callerIdAll']));}else{_0x46bdc4[_0xaa30('0x6a')](new Extension(_0x2f4d77,0x3,_0xaa30('0x64'),'No\x20callerid\x20available'));}_0x46bdc4[_0xaa30('0x6a')](new Extension(_0x2f4d77,0x4,'goto',_0x6c968e[_0xaa30('0x5c')]+','+'${EXTEN:'+(0x8+_0x4318a2['name'][_0xaa30('0x41')])+'}'+','+0x1));return _0x46bdc4;}function formatPrefixName(_0x99d382){var _0xd3e52e='_';for(var _0x313bfa=0x0;_0x313bfa<_0x99d382[_0xaa30('0x41')];_0x313bfa++){if(_0x99d382[_0xaa30('0x6c')](_0x313bfa)=='-'){_0xd3e52e+=_0x99d382[_0xaa30('0x6c')](_0x313bfa);}else{_0xd3e52e+='['+_0x99d382['charAt'](_0x313bfa)+']';}}_0xd3e52e+='.';return _0xd3e52e;}exports[_0xaa30('0x2a')]=function(_0x3f2683,_0x1386a9,_0x4aeb5d){var _0x1f8a61=_0x3f2683[_0xaa30('0x6d')];_0x1f8a61[_0xaa30('0x63')]='system-'+_0x1f8a61[_0xaa30('0x32')]+'-';return db['sequelize'][_0xaa30('0x54')](function(_0x4d2787){return db['VoicePrefix'][_0xaa30('0x2a')](_0x1f8a61,{'where':{'id':_0x1f8a61['id']},'transaction':_0x4d2787})[_0xaa30('0x2b')](function(){return db['VoiceExtension'][_0xaa30('0x2c')]({'where':{'VoicePrefixId':_0x1f8a61['id']},'transaction':_0x4d2787})[_0xaa30('0x2b')](function(){return db[_0xaa30('0x55')]['find']({'where':{'id':_0x1f8a61[_0xaa30('0x6e')]},'raw':!![]})[_0xaa30('0x2b')](function(_0x23daeb){return createVoicePrefixExtensions(_0x1f8a61,_0x23daeb,_0x4d2787);});});});})[_0xaa30('0x2b')](function(){return db[_0xaa30('0x35')][_0xaa30('0x6f')](_0x1f8a61['id']);})[_0xaa30('0x2b')](respondWithResult(_0x1386a9,null))['catch'](handleError(_0x1386a9,null));};exports[_0xaa30('0x70')]=function(_0x37c3ee,_0x112dc3,_0x25977d){return db['VoicePrefix'][_0xaa30('0x50')]({'where':{'id':_0x37c3ee[_0xaa30('0x51')]['id']}})['then'](handleEntityNotFound(_0x112dc3,null))[_0xaa30('0x2b')](function(_0x2d9dd8){if(_0x2d9dd8){return _0x2d9dd8[_0xaa30('0x70')](_0x37c3ee[_0xaa30('0x6d')][_0xaa30('0x71')],_[_0xaa30('0x72')](_0x37c3ee['body'],[_0xaa30('0x71'),'id'])||{})[_0xaa30('0x73')](function(_0x5948b4){for(var _0x2aa0ce=0x0;_0x2aa0ce<_0x37c3ee[_0xaa30('0x6d')][_0xaa30('0x71')][_0xaa30('0x41')];_0x2aa0ce+=0x1){socket[_0xaa30('0x74')]('userVoicePrefix:save',{'UserId':Number(_0x37c3ee[_0xaa30('0x6d')][_0xaa30('0x71')][_0x2aa0ce]),'VoicePrefixId':Number(_0x37c3ee[_0xaa30('0x51')]['id'])});}return _0x5948b4;});}})[_0xaa30('0x2b')](respondWithResult(_0x112dc3,null))[_0xaa30('0x4e')](handleError(_0x112dc3,null));};exports[_0xaa30('0x75')]=function(_0x5d3d83,_0x1e3a19,_0x467134){return db['VoicePrefix']['find']({'where':{'id':_0x5d3d83[_0xaa30('0x51')]['id']}})[_0xaa30('0x2b')](handleEntityNotFound(_0x1e3a19,null))[_0xaa30('0x2b')](function(_0x100f18){if(_0x100f18){return _0x100f18[_0xaa30('0x75')](_0x5d3d83[_0xaa30('0x3d')][_0xaa30('0x71')])['then'](function(){if(_['isArray'](_0x5d3d83['query'][_0xaa30('0x71')])){for(var _0x25ebba=0x0;_0x25ebba<_0x5d3d83[_0xaa30('0x3d')][_0xaa30('0x71')][_0xaa30('0x41')];_0x25ebba+=0x1){socket['emit'](_0xaa30('0x76'),{'UserId':Number(_0x5d3d83[_0xaa30('0x3d')][_0xaa30('0x71')][_0x25ebba]),'VoicePrefixId':Number(_0x5d3d83[_0xaa30('0x51')]['id'])});}}else{socket[_0xaa30('0x74')](_0xaa30('0x76'),{'UserId':Number(_0x5d3d83[_0xaa30('0x3d')][_0xaa30('0x71')]),'VoicePrefixId':Number(_0x5d3d83['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1e3a19,null))['catch'](handleError(_0x1e3a19,null));};exports[_0xaa30('0x77')]=function(_0x408362,_0x541d3b,_0x775047){var _0xe9e4={};var _0x15e3ae={};var _0x33551c;var _0x404f82;return db['VoicePrefix'][_0xaa30('0x78')]({'where':{'id':_0x408362[_0xaa30('0x51')]['id']}})[_0xaa30('0x2b')](handleEntityNotFound(_0x541d3b,null))['then'](function(_0x21b87b){if(_0x21b87b){_0x33551c=_0x21b87b;_0x15e3ae[_0xaa30('0x3c')]=_[_0xaa30('0x3a')](db[_0xaa30('0x79')][_0xaa30('0x36')]);_0x15e3ae[_0xaa30('0x3d')]=_[_0xaa30('0x3a')](_0x408362['query']);_0x15e3ae[_0xaa30('0x3b')]=_[_0xaa30('0x3e')](_0x15e3ae[_0xaa30('0x3c')],_0x15e3ae[_0xaa30('0x3d')]);_0xe9e4[_0xaa30('0x40')]=_[_0xaa30('0x3e')](_0x15e3ae[_0xaa30('0x3c')],qs[_0xaa30('0x3f')](_0x408362[_0xaa30('0x3d')][_0xaa30('0x3f')]));_0xe9e4[_0xaa30('0x40')]=_0xe9e4[_0xaa30('0x40')][_0xaa30('0x41')]?_0xe9e4['attributes']:_0x15e3ae[_0xaa30('0x3c')];_0xe9e4['order']=qs[_0xaa30('0x44')](_0x408362[_0xaa30('0x3d')][_0xaa30('0x44')]);_0xe9e4[_0xaa30('0x45')]=qs[_0xaa30('0x3b')](_[_0xaa30('0x46')](_0x408362[_0xaa30('0x3d')],_0x15e3ae[_0xaa30('0x3b')]));if(_0x408362[_0xaa30('0x3d')][_0xaa30('0x49')]){_0xe9e4[_0xaa30('0x45')]=_[_0xaa30('0x47')](_0xe9e4[_0xaa30('0x45')],{'$or':_[_0xaa30('0x39')](_0xe9e4[_0xaa30('0x40')],function(_0x3744b3){var _0x35a47f={};_0x35a47f[_0x3744b3]={'$like':'%'+_0x408362[_0xaa30('0x3d')][_0xaa30('0x49')]+'%'};return _0x35a47f;})});}_0xe9e4=_['merge']({},_0xe9e4,_0x408362[_0xaa30('0x4a')]);return _0x33551c[_0xaa30('0x77')](_0xe9e4);}})[_0xaa30('0x2b')](function(_0x3a67b3){if(_0x3a67b3){_0x404f82=_0x3a67b3[_0xaa30('0x41')];if(!_0x408362[_0xaa30('0x3d')][_0xaa30('0x42')]('nolimit')){_0xe9e4[_0xaa30('0x25')]=qs[_0xaa30('0x25')](_0x408362['query'][_0xaa30('0x25')]);_0xe9e4[_0xaa30('0x24')]=qs['offset'](_0x408362[_0xaa30('0x3d')][_0xaa30('0x24')]);}return _0x33551c[_0xaa30('0x77')](_0xe9e4);}})[_0xaa30('0x2b')](function(_0x5eb209){if(_0x5eb209){return _0x5eb209?{'count':_0x404f82,'rows':_0x5eb209}:null;}})[_0xaa30('0x2b')](respondWithResult(_0x541d3b,null))['catch'](handleError(_0x541d3b,null));};exports[_0xaa30('0x7a')]=function(_0x41480f,_0x24f60f,_0x3fb561){var _0x24a3af={};var _0x4412d4={};var _0x45ffba;var _0x2e73e1;return db[_0xaa30('0x35')]['findOne']({'where':{'id':_0x41480f[_0xaa30('0x51')]['id']}})[_0xaa30('0x2b')](handleEntityNotFound(_0x24f60f,null))['then'](function(_0x1f48c1){if(_0x1f48c1){_0x45ffba=_0x1f48c1;_0x4412d4[_0xaa30('0x3c')]=_['keys'](db[_0xaa30('0x7b')][_0xaa30('0x36')]);_0x4412d4['query']=_[_0xaa30('0x3a')](_0x41480f['query']);_0x4412d4['filters']=_[_0xaa30('0x3e')](_0x4412d4[_0xaa30('0x3c')],_0x4412d4['query']);_0x24a3af['attributes']=_[_0xaa30('0x3e')](_0x4412d4[_0xaa30('0x3c')],qs['fields'](_0x41480f[_0xaa30('0x3d')]['fields']));_0x24a3af['attributes']=_0x24a3af[_0xaa30('0x40')]['length']?_0x24a3af[_0xaa30('0x40')]:_0x4412d4['model'];_0x24a3af[_0xaa30('0x7c')]=qs[_0xaa30('0x44')](_0x41480f[_0xaa30('0x3d')][_0xaa30('0x44')]);_0x24a3af[_0xaa30('0x45')]=qs[_0xaa30('0x3b')](_[_0xaa30('0x46')](_0x41480f[_0xaa30('0x3d')],_0x4412d4[_0xaa30('0x3b')]));if(_0x41480f['query']['filter']){_0x24a3af[_0xaa30('0x45')]=_[_0xaa30('0x47')](_0x24a3af[_0xaa30('0x45')],{'$or':_['map'](_0x24a3af['attributes'],function(_0x46df1d){var _0x554b6b={};_0x554b6b[_0x46df1d]={'$like':'%'+_0x41480f[_0xaa30('0x3d')][_0xaa30('0x49')]+'%'};return _0x554b6b;})});}_0x24a3af=_[_0xaa30('0x47')]({},_0x24a3af,_0x41480f[_0xaa30('0x4a')]);return _0x45ffba['getTeams'](_0x24a3af);}})[_0xaa30('0x2b')](function(_0x5d061b){if(_0x5d061b){_0x2e73e1=_0x5d061b[_0xaa30('0x41')];if(!_0x41480f[_0xaa30('0x3d')][_0xaa30('0x42')](_0xaa30('0x43'))){_0x24a3af['limit']=qs[_0xaa30('0x25')](_0x41480f[_0xaa30('0x3d')]['limit']);_0x24a3af[_0xaa30('0x24')]=qs['offset'](_0x41480f[_0xaa30('0x3d')]['offset']);}return _0x45ffba[_0xaa30('0x7a')](_0x24a3af);}})[_0xaa30('0x2b')](function(_0x11dd5e){if(_0x11dd5e){return _0x11dd5e?{'count':_0x2e73e1,'rows':_0x11dd5e}:null;}})[_0xaa30('0x2b')](respondWithResult(_0x24f60f,null))[_0xaa30('0x4e')](handleError(_0x24f60f,null));};exports[_0xaa30('0x7d')]=function(_0x2f90db,_0x3f382a,_0x36f739){var _0x5687ef=_0x2f90db[_0xaa30('0x6d')][_0xaa30('0x71')];var _0x21e8c7;return db['Team'][_0xaa30('0x4c')]({'where':{'id':_0x5687ef},'attributes':['id'],'include':[{'model':db[_0xaa30('0x79')],'as':_0xaa30('0x7e'),'attributes':['id',_0xaa30('0x32'),_0xaa30('0x7f'),_0xaa30('0x80'),_0xaa30('0x81')],'raw':!![]}]})[_0xaa30('0x2b')](function(_0x16e95c){if(_0x16e95c){_0x21e8c7=_0x16e95c;var _0x4dc93c=_[_0xaa30('0x82')](_0x16e95c,function(_0x25dca3){var _0x13521a=_0x25dca3['get']({'plain':!![]});return _0x13521a[_0xaa30('0x7e')];});return db[_0xaa30('0x35')]['find']({'where':{'id':_0x2f90db[_0xaa30('0x51')]['id']}})['then'](function(_0x51a37a){return db[_0xaa30('0x83')][_0xaa30('0x54')](function(_0xcf7c59){return _0x51a37a[_0xaa30('0x7d')](_0x5687ef,{'transaction':_0xcf7c59})['then'](function(){return BPromise['each'](_0x21e8c7,function(_0x4240d0){return db[_0xaa30('0x84')][_0xaa30('0x85')]({'TeamId':_0x4240d0['id'],'VoicePrefixId':_0x2f90db[_0xaa30('0x51')]['id']},{'transaction':_0xcf7c59});});})[_0xaa30('0x2b')](function(){return BPromise['each'](_0x4dc93c,function(_0x7db5d7){return db['UserVoicePrefix'][_0xaa30('0x86')]({'where':{'UserId':_0x7db5d7['id'],'VoicePrefixId':_0x2f90db[_0xaa30('0x51')]['id']},'transaction':_0xcf7c59});});})[_0xaa30('0x2b')](function(){_0x4dc93c['forEach'](function(_0x1c25b1){socket[_0xaa30('0x74')](_0xaa30('0x87'),{'UserId':_0x1c25b1['id'],'VoicePrefixId':_0x51a37a['id']});});});});});}})[_0xaa30('0x2b')](respondWithStatusCode(_0x3f382a,null))[_0xaa30('0x4e')](handleError(_0x3f382a,null));};exports[_0xaa30('0x88')]=function(_0x51fb85,_0x133a0f,_0x1bd3c2){return db['Team']['findAll']({'where':{'id':_0x51fb85[_0xaa30('0x3d')][_0xaa30('0x71')]},'attributes':['id'],'include':[{'model':db[_0xaa30('0x79')],'as':_0xaa30('0x7e'),'attributes':['id'],'raw':!![]}]})[_0xaa30('0x2b')](handleEntityNotFound(_0x133a0f,null))[_0xaa30('0x2b')](function(_0x3dd250){var _0x2ec205=_[_0xaa30('0x39')](_0x3dd250,'id');var _0x211916=[];var _0x4bba25=[];var _0x73c665=squel['select']();_0x73c665['field'](_0xaa30('0x89'))[_0xaa30('0x8a')](_0xaa30('0x8b'),'tq')['join'](_0xaa30('0x8c'),'ut',_0xaa30('0x8d'))['where'](_0xaa30('0x8e'),_0x51fb85[_0xaa30('0x51')]['id']);for(var _0x2ebaa0=0x0;_0x2ebaa0<_0x3dd250[_0xaa30('0x41')];_0x2ebaa0+=0x1){let _0x420276=_0x3dd250[_0x2ebaa0];for(var _0x2c48a2=0x0;_0x2c48a2<_0x420276['Agents'][_0xaa30('0x41')];_0x2c48a2+=0x1){let _0x206fc4=_0x420276[_0xaa30('0x7e')][_0x2c48a2];var _0x24fccc=_0x73c665[_0xaa30('0x8f')]();_0x24fccc[_0xaa30('0x45')](_0xaa30('0x90'),_0x206fc4['id']);_0x4bba25['push'](db['sequelize'][_0xaa30('0x3d')](_0x24fccc[_0xaa30('0x91')](),{'type':db[_0xaa30('0x83')][_0xaa30('0x92')][_0xaa30('0x93')]})[_0xaa30('0x2b')](function(_0x162810){if(_0x162810[_0xaa30('0x41')]===0x1){return _0x206fc4['id'];}else{var _0x2ed461=_[_0xaa30('0x94')](_[_0xaa30('0x39')](_0x162810,'TeamId'),function(_0x5c21e){return _[_0xaa30('0x95')](_0x2ec205,_0x5c21e);});if(_0x2ed461){return _0x206fc4['id'];}}}));}}return BPromise[_0xaa30('0x96')](_0x4bba25)[_0xaa30('0x2b')](function(_0x46c9a5){_0x211916=_(_0x211916)[_0xaa30('0x97')](_0x46c9a5)[_0xaa30('0x98')]()[_0xaa30('0x99')]();return db[_0xaa30('0x35')][_0xaa30('0x50')]({'where':{'id':_0x51fb85[_0xaa30('0x51')]['id']}})[_0xaa30('0x2b')](function(_0x4cc3f0){return db[_0xaa30('0x83')][_0xaa30('0x54')](function(_0x31bdf6){return _0x4cc3f0['removeTeams'](_0x51fb85['query'][_0xaa30('0x71')],{'transaction':_0x31bdf6})['then'](function(){if(!_[_0xaa30('0x9a')](_0x211916)){return _0x4cc3f0['removeAgents'](_0x211916,{'transaction':_0x31bdf6});}})[_0xaa30('0x2b')](function(){_0x211916[_0xaa30('0x9b')](function(_0xb148d9){socket[_0xaa30('0x74')]('userVoicePrefix:remove',{'UserId':_0xb148d9,'VoicePrefixId':_0x4cc3f0['id']});});});});});});})[_0xaa30('0x2b')](respondWithStatusCode(_0x133a0f,null))[_0xaa30('0x4e')](handleError(_0x133a0f,null));}; \ No newline at end of file +var _0x583c=['fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','map','VoicePrefix','fieldName','type','model','query','keys','filters','attributes','fields','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','intersection','length','include','find','describe','create','sequelize','transaction','body','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','exten','app','system','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','context','${EXTEN:','charAt','system-','VoiceExtension','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','filter','Team','hasOwnProperty','getTeams','addTeams','Agents','online','voicePause','flatMap','each','UserVoicePrefix','removeTeams','select','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','all','union','compact','value','isEmpty','forEach','eml-format','rimraf','zip-dir'];(function(_0x591bf9,_0x3f815c){var _0x2bb418=function(_0x2ac2d2){while(--_0x2ac2d2){_0x591bf9['push'](_0x591bf9['shift']());}};_0x2bb418(++_0x3f815c);}(_0x583c,0x12b));var _0xc583=function(_0x33bcdb,_0x11846b){_0x33bcdb=_0x33bcdb-0x0;var _0x18a9bf=_0x583c[_0x33bcdb];return _0x18a9bf;};'use strict';var emlformat=require(_0xc583('0x0'));var rimraf=require(_0xc583('0x1'));var zipdir=require(_0xc583('0x2'));var jsonpatch=require(_0xc583('0x3'));var rp=require('request-promise');var moment=require(_0xc583('0x4'));var BPromise=require(_0xc583('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc583('0x6'));var sox=require(_0xc583('0x7'));var csv=require('to-csv');var ejs=require(_0xc583('0x8'));var fs=require('fs');var fs_extra=require(_0xc583('0x9'));var _=require(_0xc583('0xa'));var squel=require(_0xc583('0xb'));var crypto=require('crypto');var jsforce=require(_0xc583('0xc'));var deskjs=require(_0xc583('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc583('0xe'));var Papa=require(_0xc583('0xf'));var Redis=require(_0xc583('0x10'));var authService=require(_0xc583('0x11'));var qs=require(_0xc583('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc583('0x13'));var logger=require(_0xc583('0x14'))('api');var utils=require(_0xc583('0x15'));var config=require(_0xc583('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc583('0x17'))['db'];config[_0xc583('0x18')]=_[_0xc583('0x19')](config[_0xc583('0x18')],{'host':_0xc583('0x1a'),'port':0x18eb});var socket=require(_0xc583('0x1b'))(new Redis(config[_0xc583('0x18')]));require(_0xc583('0x1c'))[_0xc583('0x1d')](socket);function respondWithStatusCode(_0x5403a3,_0x21cf25){_0x21cf25=_0x21cf25||0xcc;return function(_0x51ecd7){if(_0x51ecd7){return _0x5403a3[_0xc583('0x1e')](_0x21cf25);}return _0x5403a3[_0xc583('0x1f')](_0x21cf25)['end']();};}function respondWithResult(_0x263552,_0x311ad5){_0x311ad5=_0x311ad5||0xc8;return function(_0x5b1871){if(_0x5b1871){return _0x263552[_0xc583('0x1f')](_0x311ad5)[_0xc583('0x20')](_0x5b1871);}};}function respondWithFilteredResult(_0x5127fa,_0x21cf22){return function(_0x8a2d84){if(_0x8a2d84){var _0x12aac2=typeof _0x21cf22[_0xc583('0x21')]==='undefined'&&typeof _0x21cf22[_0xc583('0x22')]==='undefined';var _0x227ec2=_0x8a2d84[_0xc583('0x23')];var _0xfd9a60=_0x12aac2?0x0:_0x21cf22[_0xc583('0x21')];var _0x1052b5=_0x12aac2?_0x8a2d84[_0xc583('0x23')]:_0x21cf22[_0xc583('0x21')]+_0x21cf22[_0xc583('0x22')];var _0x37fcd4;if(_0x1052b5>=_0x227ec2){_0x1052b5=_0x227ec2;_0x37fcd4=0xc8;}else{_0x37fcd4=0xce;}_0x5127fa[_0xc583('0x1f')](_0x37fcd4);return _0x5127fa[_0xc583('0x24')](_0xc583('0x25'),_0xfd9a60+'-'+_0x1052b5+'/'+_0x227ec2)[_0xc583('0x20')](_0x8a2d84);}return null;};}function patchUpdates(_0x478ee1){return function(_0x542256){try{jsonpatch[_0xc583('0x26')](_0x542256,_0x478ee1,!![]);}catch(_0x3e075c){return BPromise[_0xc583('0x27')](_0x3e075c);}return _0x542256['save']();};}function saveUpdates(_0x1521e2,_0x959500){return function(_0x37f156){if(_0x37f156){return _0x37f156[_0xc583('0x28')](_0x1521e2)[_0xc583('0x29')](function(_0x48c95e){return _0x48c95e;});}return null;};}function removeEntity(_0x4cad36,_0x45871c){return function(_0x4f366b){if(_0x4f366b){return _0x4f366b[_0xc583('0x2a')]()[_0xc583('0x29')](function(){var _0xbabf24=_0x4f366b[_0xc583('0x2b')]({'plain':!![]});var _0x24aab5='VoicePrefixes';return db[_0xc583('0x2c')][_0xc583('0x2a')]({'where':{'type':_0x24aab5,'resourceId':_0xbabf24['id']}})['then'](function(){return _0x4f366b;});})[_0xc583('0x29')](function(){_0x4cad36['status'](0xcc)[_0xc583('0x2d')]();});}};}function handleEntityNotFound(_0x8d4ecb,_0x1c80b1){return function(_0x3ed083){if(!_0x3ed083){_0x8d4ecb[_0xc583('0x1e')](0x194);}return _0x3ed083;};}function handleError(_0x19079b,_0x113b39){_0x113b39=_0x113b39||0x1f4;return function(_0x4a87b5){logger[_0xc583('0x2e')](_0x4a87b5[_0xc583('0x2f')]);if(_0x4a87b5[_0xc583('0x30')]){delete _0x4a87b5[_0xc583('0x30')];}_0x19079b[_0xc583('0x1f')](_0x113b39)[_0xc583('0x31')](_0x4a87b5);};}exports['index']=function(_0x2246dd,_0x58d97f){var _0x510931={},_0x299551={},_0x2df18d={'count':0x0,'rows':[]};var _0x20bbce=_[_0xc583('0x32')](db[_0xc583('0x33')]['rawAttributes'],function(_0x3e41c0){return{'name':_0x3e41c0[_0xc583('0x34')],'type':_0x3e41c0[_0xc583('0x35')]['key']};});_0x299551[_0xc583('0x36')]=_['map'](_0x20bbce,_0xc583('0x30'));_0x299551[_0xc583('0x37')]=_[_0xc583('0x38')](_0x2246dd[_0xc583('0x37')]);_0x299551[_0xc583('0x39')]=_['intersection'](_0x299551[_0xc583('0x36')],_0x299551['query']);_0x510931[_0xc583('0x3a')]=_['intersection'](_0x299551[_0xc583('0x36')],qs[_0xc583('0x3b')](_0x2246dd[_0xc583('0x37')][_0xc583('0x3b')]));_0x510931[_0xc583('0x3a')]=_0x510931[_0xc583('0x3a')]['length']?_0x510931['attributes']:_0x299551[_0xc583('0x36')];if(!_0x2246dd[_0xc583('0x37')]['hasOwnProperty'](_0xc583('0x3c'))){_0x510931[_0xc583('0x22')]=qs[_0xc583('0x22')](_0x2246dd[_0xc583('0x37')][_0xc583('0x22')]);_0x510931[_0xc583('0x21')]=qs['offset'](_0x2246dd[_0xc583('0x37')]['offset']);}_0x510931[_0xc583('0x3d')]=qs[_0xc583('0x3e')](_0x2246dd[_0xc583('0x37')]['sort']);_0x510931['where']=qs['filters'](_[_0xc583('0x3f')](_0x2246dd[_0xc583('0x37')],_0x299551[_0xc583('0x39')]),_0x20bbce);if(_0x2246dd[_0xc583('0x37')]['filter']){_0x510931[_0xc583('0x40')]=_[_0xc583('0x41')](_0x510931['where'],{'$or':_['map'](_0x20bbce,function(_0x1ea5da){if(_0x1ea5da['type']!==_0xc583('0x42')){var _0x1ec6f9={};_0x1ec6f9[_0x1ea5da[_0xc583('0x30')]]={'$like':'%'+_0x2246dd[_0xc583('0x37')]['filter']+'%'};return _0x1ec6f9;}})});}_0x510931=_[_0xc583('0x41')]({},_0x510931,_0x2246dd[_0xc583('0x43')]);var _0x39c5ab={'where':_0x510931[_0xc583('0x40')]};return db[_0xc583('0x33')]['count'](_0x39c5ab)[_0xc583('0x29')](function(_0x5f5a97){_0x2df18d['count']=_0x5f5a97;if(_0x2246dd[_0xc583('0x37')][_0xc583('0x44')]){_0x510931['include']=[{'all':!![]}];}return db['VoicePrefix'][_0xc583('0x45')](_0x510931);})[_0xc583('0x29')](function(_0x7d1b29){_0x2df18d[_0xc583('0x46')]=_0x7d1b29;return _0x2df18d;})['then'](respondWithFilteredResult(_0x58d97f,_0x510931))[_0xc583('0x47')](handleError(_0x58d97f,null));};exports['show']=function(_0x8c8209,_0x4edac2){var _0x28ab1a={'raw':![],'where':{'id':_0x8c8209[_0xc583('0x48')]['id']}},_0x14e9ad={};_0x14e9ad[_0xc583('0x36')]=_[_0xc583('0x38')](db['VoicePrefix'][_0xc583('0x49')]);_0x14e9ad[_0xc583('0x37')]=_[_0xc583('0x38')](_0x8c8209['query']);_0x14e9ad['filters']=_['intersection'](_0x14e9ad[_0xc583('0x36')],_0x14e9ad['query']);_0x28ab1a[_0xc583('0x3a')]=_[_0xc583('0x4a')](_0x14e9ad[_0xc583('0x36')],qs[_0xc583('0x3b')](_0x8c8209[_0xc583('0x37')][_0xc583('0x3b')]));_0x28ab1a[_0xc583('0x3a')]=_0x28ab1a[_0xc583('0x3a')][_0xc583('0x4b')]?_0x28ab1a[_0xc583('0x3a')]:_0x14e9ad[_0xc583('0x36')];if(_0x8c8209['query'][_0xc583('0x44')]){_0x28ab1a[_0xc583('0x4c')]=[{'all':!![]}];}_0x28ab1a=_[_0xc583('0x41')]({},_0x28ab1a,_0x8c8209[_0xc583('0x43')]);return db['VoicePrefix'][_0xc583('0x4d')](_0x28ab1a)[_0xc583('0x29')](handleEntityNotFound(_0x4edac2,null))[_0xc583('0x29')](respondWithResult(_0x4edac2,null))[_0xc583('0x47')](handleError(_0x4edac2,null));};exports[_0xc583('0x2a')]=function(_0x22da88,_0x3f60ae){return db[_0xc583('0x33')][_0xc583('0x4d')]({'where':{'id':_0x22da88['params']['id']}})[_0xc583('0x29')](handleEntityNotFound(_0x3f60ae,null))[_0xc583('0x29')](removeEntity(_0x3f60ae,null))[_0xc583('0x47')](handleError(_0x3f60ae,null));};exports[_0xc583('0x4e')]=function(_0x3c442e,_0xc42b2a){return db[_0xc583('0x33')][_0xc583('0x4e')]()[_0xc583('0x29')](respondWithResult(_0xc42b2a,null))[_0xc583('0x47')](handleError(_0xc42b2a,null));};exports[_0xc583('0x4f')]=function(_0x7be0b3,_0x305239){var _0x4c486b;return db[_0xc583('0x50')][_0xc583('0x51')](function(_0x44413e){return db[_0xc583('0x33')][_0xc583('0x4f')](_0x7be0b3[_0xc583('0x52')],{'transaction':_0x44413e})[_0xc583('0x29')](function(_0x1aff76){_0x4c486b=_0x1aff76[_0xc583('0x2b')]({'plain':!![]});return db['VoiceExtension'][_0xc583('0x4d')]({'where':{'id':_0x4c486b[_0xc583('0x53')]},'raw':!![]})[_0xc583('0x29')](function(_0x59ce34){return createVoicePrefixExtensions(_0x4c486b,_0x59ce34,_0x44413e);});});})['then'](function(){var _0x2bb764=_0x7be0b3['user'][_0xc583('0x2b')]({'plain':!![]});if(!_0x2bb764)throw new Error(_0xc583('0x54'));if(_0x2bb764['role']==='user'){var _0x282290=_0x4c486b;return db[_0xc583('0x55')][_0xc583('0x4d')]({'where':{'name':_0xc583('0x56'),'userProfileId':_0x2bb764[_0xc583('0x57')]},'raw':!![]})[_0xc583('0x29')](function(_0x3e2758){if(_0x3e2758&&_0x3e2758[_0xc583('0x58')]===0x0){return db['UserProfileResource'][_0xc583('0x4f')]({'name':_0x282290[_0xc583('0x30')],'resourceId':_0x282290['id'],'type':_0x3e2758[_0xc583('0x30')],'sectionId':_0x3e2758['id']},{})[_0xc583('0x29')](function(){return _0x4c486b;});}else{return _0x4c486b;}})['catch'](function(_0x43fda1){logger[_0xc583('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43fda1);throw _0x43fda1;});}return _0x4c486b;})['then'](respondWithResult(_0x305239,null))[_0xc583('0x47')](handleError(_0x305239,null));};function Extension(_0x5ccfe7,_0x30b1e0,_0x1ba5cc,_0x40e8a6){this['context']='from-sip';this[_0xc583('0x59')]=_0x5ccfe7;this[_0xc583('0x5a')]=_0x1ba5cc;this[_0xc583('0x35')]=_0xc583('0x5b');this['description']=_0xc583('0x5c');this[_0xc583('0x5d')]=_0x30b1e0;this['appdata']=_0x40e8a6;}function createVoicePrefixExtensions(_0x508f4b,_0x28013a,_0x579c62){return new BPromise(function(_0x5df37d,_0x507f18){var _0x415b0f=new Extension(formatPrefixName(_0x508f4b[_0xc583('0x5e')]),0x1,_0xc583('0x5f'),_0xc583('0x60'));_0x415b0f['VoicePrefixId']=_0x508f4b['id'];return db['VoiceExtension'][_0xc583('0x4f')](_0x415b0f,{'transaction':_0x579c62})[_0xc583('0x29')](function(_0x599663){var _0x52cd21=_0x599663[_0xc583('0x2b')]({'plain':!![]});var _0x48f217=_[_0xc583('0x32')](addVoicePrefixExtensions(_0x508f4b,_0x28013a),function(_0x43f208){_0x43f208['VoiceExtensionId']=_0x52cd21['id'];_0x43f208[_0xc583('0x61')]=_0x508f4b['id'];return _0x43f208;});return db['VoiceExtension'][_0xc583('0x62')](_0x48f217,{'transaction':_0x579c62})[_0xc583('0x29')](function(_0x4b3f49){if(!_0x4b3f49){return _0x507f18(_0xc583('0x63'));}else{return _0x5df37d(_0x4b3f49);}})[_0xc583('0x47')](function(_0x20783b){return _0x507f18(_0x20783b);});});;});};function addVoicePrefixExtensions(_0xf4bc67,_0x1b5003){var _0x330a8e=[];var _0x37613c=formatPrefixName(_0xf4bc67[_0xc583('0x5e')]);_0x330a8e['push'](new Extension(_0x37613c,0x2,'Set','CDR(prefix)='+_0xf4bc67[_0xc583('0x30')]));if(_0xf4bc67['callerIdAll']){_0x330a8e[_0xc583('0x64')](new Extension(_0x37613c,0x3,_0xc583('0x65'),_0xc583('0x66')+_0xf4bc67[_0xc583('0x67')]));}else{_0x330a8e[_0xc583('0x64')](new Extension(_0x37613c,0x3,_0xc583('0x5f'),_0xc583('0x68')));}_0x330a8e[_0xc583('0x64')](new Extension(_0x37613c,0x4,'goto',_0x1b5003[_0xc583('0x69')]+','+_0xc583('0x6a')+(0x8+_0xf4bc67[_0xc583('0x30')][_0xc583('0x4b')])+'}'+','+0x1));return _0x330a8e;}function formatPrefixName(_0x41a064){var _0xb243ac='_';for(var _0x548f1c=0x0;_0x548f1c<_0x41a064[_0xc583('0x4b')];_0x548f1c++){if(_0x41a064[_0xc583('0x6b')](_0x548f1c)=='-'){_0xb243ac+=_0x41a064[_0xc583('0x6b')](_0x548f1c);}else{_0xb243ac+='['+_0x41a064[_0xc583('0x6b')](_0x548f1c)+']';}}_0xb243ac+='.';return _0xb243ac;}exports[_0xc583('0x28')]=function(_0x2b719f,_0x547d2f,_0x3e4616){var _0x1b6948=_0x2b719f[_0xc583('0x52')];_0x1b6948['prefix']=_0xc583('0x6c')+_0x1b6948['name']+'-';return db[_0xc583('0x50')][_0xc583('0x51')](function(_0x240174){return db[_0xc583('0x33')][_0xc583('0x28')](_0x1b6948,{'where':{'id':_0x1b6948['id']},'transaction':_0x240174})[_0xc583('0x29')](function(){return db[_0xc583('0x6d')]['destroy']({'where':{'VoicePrefixId':_0x1b6948['id']},'transaction':_0x240174})['then'](function(){return db['VoiceExtension']['find']({'where':{'id':_0x1b6948[_0xc583('0x53')]},'raw':!![]})[_0xc583('0x29')](function(_0x3a2a5c){return createVoicePrefixExtensions(_0x1b6948,_0x3a2a5c,_0x240174);});});});})[_0xc583('0x29')](function(){return db[_0xc583('0x33')][_0xc583('0x6e')](_0x1b6948['id']);})[_0xc583('0x29')](respondWithResult(_0x547d2f,null))[_0xc583('0x47')](handleError(_0x547d2f,null));};exports[_0xc583('0x6f')]=function(_0x1b8304,_0x4c9516,_0x22b75d){return db[_0xc583('0x33')]['find']({'where':{'id':_0x1b8304['params']['id']}})['then'](handleEntityNotFound(_0x4c9516,null))[_0xc583('0x29')](function(_0x10037e){if(_0x10037e){return _0x10037e[_0xc583('0x6f')](_0x1b8304[_0xc583('0x52')][_0xc583('0x70')],_[_0xc583('0x71')](_0x1b8304[_0xc583('0x52')],[_0xc583('0x70'),'id'])||{})[_0xc583('0x72')](function(_0x516fcb){for(var _0x442844=0x0;_0x442844<_0x1b8304[_0xc583('0x52')]['ids'][_0xc583('0x4b')];_0x442844+=0x1){socket[_0xc583('0x73')](_0xc583('0x74'),{'UserId':Number(_0x1b8304[_0xc583('0x52')][_0xc583('0x70')][_0x442844]),'VoicePrefixId':Number(_0x1b8304['params']['id'])});}return _0x516fcb;});}})[_0xc583('0x29')](respondWithResult(_0x4c9516,null))[_0xc583('0x47')](handleError(_0x4c9516,null));};exports[_0xc583('0x75')]=function(_0x2f0aa9,_0x50ef13,_0x4d6582){return db['VoicePrefix'][_0xc583('0x4d')]({'where':{'id':_0x2f0aa9['params']['id']}})['then'](handleEntityNotFound(_0x50ef13,null))['then'](function(_0x1c7323){if(_0x1c7323){return _0x1c7323[_0xc583('0x75')](_0x2f0aa9[_0xc583('0x37')][_0xc583('0x70')])[_0xc583('0x29')](function(){if(_['isArray'](_0x2f0aa9[_0xc583('0x37')][_0xc583('0x70')])){for(var _0x9a09b0=0x0;_0x9a09b0<_0x2f0aa9['query'][_0xc583('0x70')][_0xc583('0x4b')];_0x9a09b0+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x2f0aa9[_0xc583('0x37')][_0xc583('0x70')][_0x9a09b0]),'VoicePrefixId':Number(_0x2f0aa9[_0xc583('0x48')]['id'])});}}else{socket[_0xc583('0x73')](_0xc583('0x76'),{'UserId':Number(_0x2f0aa9[_0xc583('0x37')][_0xc583('0x70')]),'VoicePrefixId':Number(_0x2f0aa9[_0xc583('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x50ef13,null))[_0xc583('0x47')](handleError(_0x50ef13,null));};exports[_0xc583('0x77')]=function(_0x3ea593,_0x3eabb9,_0x674d99){var _0x2b98b7={};var _0x20c4e6={};var _0x149051;var _0x1f0ab4;return db[_0xc583('0x33')][_0xc583('0x78')]({'where':{'id':_0x3ea593[_0xc583('0x48')]['id']}})[_0xc583('0x29')](handleEntityNotFound(_0x3eabb9,null))[_0xc583('0x29')](function(_0x42ff52){if(_0x42ff52){_0x149051=_0x42ff52;_0x20c4e6[_0xc583('0x36')]=_[_0xc583('0x38')](db[_0xc583('0x79')][_0xc583('0x49')]);_0x20c4e6[_0xc583('0x37')]=_[_0xc583('0x38')](_0x3ea593[_0xc583('0x37')]);_0x20c4e6[_0xc583('0x39')]=_[_0xc583('0x4a')](_0x20c4e6['model'],_0x20c4e6['query']);_0x2b98b7[_0xc583('0x3a')]=_[_0xc583('0x4a')](_0x20c4e6['model'],qs['fields'](_0x3ea593[_0xc583('0x37')][_0xc583('0x3b')]));_0x2b98b7['attributes']=_0x2b98b7['attributes'][_0xc583('0x4b')]?_0x2b98b7[_0xc583('0x3a')]:_0x20c4e6[_0xc583('0x36')];_0x2b98b7['order']=qs['sort'](_0x3ea593[_0xc583('0x37')][_0xc583('0x3e')]);_0x2b98b7[_0xc583('0x40')]=qs['filters'](_[_0xc583('0x3f')](_0x3ea593[_0xc583('0x37')],_0x20c4e6['filters']));if(_0x3ea593[_0xc583('0x37')][_0xc583('0x7a')]){_0x2b98b7[_0xc583('0x40')]=_[_0xc583('0x41')](_0x2b98b7[_0xc583('0x40')],{'$or':_[_0xc583('0x32')](_0x2b98b7[_0xc583('0x3a')],function(_0x47e7f8){var _0x4a2671={};_0x4a2671[_0x47e7f8]={'$like':'%'+_0x3ea593['query'][_0xc583('0x7a')]+'%'};return _0x4a2671;})});}_0x2b98b7=_[_0xc583('0x41')]({},_0x2b98b7,_0x3ea593[_0xc583('0x43')]);return _0x149051[_0xc583('0x77')](_0x2b98b7);}})[_0xc583('0x29')](function(_0x3ab1a1){if(_0x3ab1a1){_0x1f0ab4=_0x3ab1a1[_0xc583('0x4b')];if(!_0x3ea593[_0xc583('0x37')]['hasOwnProperty'](_0xc583('0x3c'))){_0x2b98b7[_0xc583('0x22')]=qs[_0xc583('0x22')](_0x3ea593[_0xc583('0x37')]['limit']);_0x2b98b7['offset']=qs['offset'](_0x3ea593[_0xc583('0x37')][_0xc583('0x21')]);}return _0x149051[_0xc583('0x77')](_0x2b98b7);}})[_0xc583('0x29')](function(_0x3a04a6){if(_0x3a04a6){return _0x3a04a6?{'count':_0x1f0ab4,'rows':_0x3a04a6}:null;}})[_0xc583('0x29')](respondWithResult(_0x3eabb9,null))['catch'](handleError(_0x3eabb9,null));};exports['getTeams']=function(_0x1907ff,_0x422848,_0x492e13){var _0xc11b2e={};var _0x1a2a0d={};var _0x2f6ea4;var _0x3e4c37;return db[_0xc583('0x33')][_0xc583('0x78')]({'where':{'id':_0x1907ff['params']['id']}})[_0xc583('0x29')](handleEntityNotFound(_0x422848,null))[_0xc583('0x29')](function(_0x3eb4a8){if(_0x3eb4a8){_0x2f6ea4=_0x3eb4a8;_0x1a2a0d[_0xc583('0x36')]=_[_0xc583('0x38')](db[_0xc583('0x7b')][_0xc583('0x49')]);_0x1a2a0d[_0xc583('0x37')]=_[_0xc583('0x38')](_0x1907ff[_0xc583('0x37')]);_0x1a2a0d['filters']=_[_0xc583('0x4a')](_0x1a2a0d[_0xc583('0x36')],_0x1a2a0d[_0xc583('0x37')]);_0xc11b2e['attributes']=_[_0xc583('0x4a')](_0x1a2a0d['model'],qs[_0xc583('0x3b')](_0x1907ff[_0xc583('0x37')][_0xc583('0x3b')]));_0xc11b2e[_0xc583('0x3a')]=_0xc11b2e[_0xc583('0x3a')][_0xc583('0x4b')]?_0xc11b2e[_0xc583('0x3a')]:_0x1a2a0d['model'];_0xc11b2e[_0xc583('0x3d')]=qs['sort'](_0x1907ff[_0xc583('0x37')]['sort']);_0xc11b2e[_0xc583('0x40')]=qs[_0xc583('0x39')](_[_0xc583('0x3f')](_0x1907ff[_0xc583('0x37')],_0x1a2a0d[_0xc583('0x39')]));if(_0x1907ff[_0xc583('0x37')][_0xc583('0x7a')]){_0xc11b2e[_0xc583('0x40')]=_['merge'](_0xc11b2e[_0xc583('0x40')],{'$or':_[_0xc583('0x32')](_0xc11b2e[_0xc583('0x3a')],function(_0x3ae684){var _0x424cd7={};_0x424cd7[_0x3ae684]={'$like':'%'+_0x1907ff['query'][_0xc583('0x7a')]+'%'};return _0x424cd7;})});}_0xc11b2e=_[_0xc583('0x41')]({},_0xc11b2e,_0x1907ff[_0xc583('0x43')]);return _0x2f6ea4['getTeams'](_0xc11b2e);}})['then'](function(_0xbbdcc4){if(_0xbbdcc4){_0x3e4c37=_0xbbdcc4[_0xc583('0x4b')];if(!_0x1907ff[_0xc583('0x37')][_0xc583('0x7c')](_0xc583('0x3c'))){_0xc11b2e[_0xc583('0x22')]=qs['limit'](_0x1907ff[_0xc583('0x37')][_0xc583('0x22')]);_0xc11b2e[_0xc583('0x21')]=qs[_0xc583('0x21')](_0x1907ff[_0xc583('0x37')]['offset']);}return _0x2f6ea4[_0xc583('0x7d')](_0xc11b2e);}})['then'](function(_0x1371a2){if(_0x1371a2){return _0x1371a2?{'count':_0x3e4c37,'rows':_0x1371a2}:null;}})['then'](respondWithResult(_0x422848,null))[_0xc583('0x47')](handleError(_0x422848,null));};exports[_0xc583('0x7e')]=function(_0x5b9b20,_0x5ebdb6,_0x1f1dfc){var _0x3f8a4e=_0x5b9b20[_0xc583('0x52')][_0xc583('0x70')];var _0x43e533;return db['Team'][_0xc583('0x45')]({'where':{'id':_0x3f8a4e},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc583('0x7f'),'attributes':['id',_0xc583('0x30'),_0xc583('0x80'),_0xc583('0x81'),'interface'],'raw':!![]}]})['then'](function(_0x54f43b){if(_0x54f43b){_0x43e533=_0x54f43b;var _0x1cbdea=_[_0xc583('0x82')](_0x54f43b,function(_0x2afb8c){var _0x5252a8=_0x2afb8c[_0xc583('0x2b')]({'plain':!![]});return _0x5252a8[_0xc583('0x7f')];});return db['VoicePrefix'][_0xc583('0x4d')]({'where':{'id':_0x5b9b20['params']['id']}})[_0xc583('0x29')](function(_0x3d1570){return db[_0xc583('0x50')][_0xc583('0x51')](function(_0x48e574){return _0x3d1570[_0xc583('0x7e')](_0x3f8a4e,{'transaction':_0x48e574})[_0xc583('0x29')](function(){return BPromise[_0xc583('0x83')](_0x43e533,function(_0x499821){return db['TeamVoicePrefix']['upsert']({'TeamId':_0x499821['id'],'VoicePrefixId':_0x5b9b20[_0xc583('0x48')]['id']},{'transaction':_0x48e574});});})[_0xc583('0x29')](function(){return BPromise['each'](_0x1cbdea,function(_0x363a8e){return db[_0xc583('0x84')]['findOrCreate']({'where':{'UserId':_0x363a8e['id'],'VoicePrefixId':_0x5b9b20['params']['id']},'transaction':_0x48e574});});})[_0xc583('0x29')](function(){_0x1cbdea['forEach'](function(_0x790cd1){socket[_0xc583('0x73')](_0xc583('0x74'),{'UserId':_0x790cd1['id'],'VoicePrefixId':_0x3d1570['id']});});});});});}})[_0xc583('0x29')](respondWithStatusCode(_0x5ebdb6,null))[_0xc583('0x47')](handleError(_0x5ebdb6,null));};exports[_0xc583('0x85')]=function(_0x59781d,_0x3bcbce,_0x1628f4){return db[_0xc583('0x7b')][_0xc583('0x45')]({'where':{'id':_0x59781d[_0xc583('0x37')][_0xc583('0x70')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc583('0x7f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3bcbce,null))[_0xc583('0x29')](function(_0x146b9c){var _0x4a6c7c=_['map'](_0x146b9c,'id');var _0x42b5a5=[];var _0x583588=[];var _0x564e57=squel[_0xc583('0x86')]();_0x564e57['field'](_0xc583('0x87'))[_0xc583('0x88')](_0xc583('0x89'),'tq')[_0xc583('0x8a')]('user_has_teams','ut',_0xc583('0x8b'))[_0xc583('0x40')](_0xc583('0x8c'),_0x59781d[_0xc583('0x48')]['id']);for(var _0x162607=0x0;_0x162607<_0x146b9c[_0xc583('0x4b')];_0x162607+=0x1){let _0x39a000=_0x146b9c[_0x162607];for(var _0x63eee8=0x0;_0x63eee8<_0x39a000[_0xc583('0x7f')][_0xc583('0x4b')];_0x63eee8+=0x1){let _0x459caf=_0x39a000[_0xc583('0x7f')][_0x63eee8];var _0x4075bd=_0x564e57['clone']();_0x4075bd[_0xc583('0x40')](_0xc583('0x8d'),_0x459caf['id']);_0x583588[_0xc583('0x64')](db[_0xc583('0x50')][_0xc583('0x37')](_0x4075bd[_0xc583('0x8e')](),{'type':db[_0xc583('0x50')][_0xc583('0x8f')]['SELECT']})[_0xc583('0x29')](function(_0x7ac229){if(_0x7ac229['length']===0x1){return _0x459caf['id'];}else{var _0x56cc96=_[_0xc583('0x90')](_[_0xc583('0x32')](_0x7ac229,'TeamId'),function(_0x25dde6){return _['includes'](_0x4a6c7c,_0x25dde6);});if(_0x56cc96){return _0x459caf['id'];}}}));}}return BPromise[_0xc583('0x91')](_0x583588)[_0xc583('0x29')](function(_0x1de88f){_0x42b5a5=_(_0x42b5a5)[_0xc583('0x92')](_0x1de88f)[_0xc583('0x93')]()[_0xc583('0x94')]();return db[_0xc583('0x33')]['find']({'where':{'id':_0x59781d['params']['id']}})[_0xc583('0x29')](function(_0x592b63){return db[_0xc583('0x50')]['transaction'](function(_0x440079){return _0x592b63[_0xc583('0x85')](_0x59781d['query'][_0xc583('0x70')],{'transaction':_0x440079})[_0xc583('0x29')](function(){if(!_[_0xc583('0x95')](_0x42b5a5)){return _0x592b63[_0xc583('0x75')](_0x42b5a5,{'transaction':_0x440079});}})['then'](function(){_0x42b5a5[_0xc583('0x96')](function(_0x182c40){socket[_0xc583('0x73')]('userVoicePrefix:remove',{'UserId':_0x182c40,'VoicePrefixId':_0x592b63['id']});});});});});});})[_0xc583('0x29')](respondWithStatusCode(_0x3bcbce,null))[_0xc583('0x47')](handleError(_0x3bcbce,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 3f8639c..5fa660d 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 _0x2479=['emit','events','../../mysqldb','VoicePrefix','setMaxListeners','save','update'];(function(_0x105e01,_0x199717){var _0x421f22=function(_0x5b1103){while(--_0x5b1103){_0x105e01['push'](_0x105e01['shift']());}};_0x421f22(++_0x199717);}(_0x2479,0xda));var _0x9247=function(_0x38f884,_0x2afd2c){_0x38f884=_0x38f884-0x0;var _0x38057f=_0x2479[_0x38f884];return _0x38057f;};'use strict';var EventEmitter=require(_0x9247('0x0'));var VoicePrefix=require(_0x9247('0x1'))['db'][_0x9247('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9247('0x3')](0x0);var events={'afterCreate':_0x9247('0x4'),'afterUpdate':_0x9247('0x5'),'afterDestroy':'remove'};function emitEvent(_0x321481){return function(_0x563148,_0x187608,_0xfa3251){VoicePrefixEvents[_0x9247('0x6')](_0x321481+':'+_0x563148['id'],_0x563148);VoicePrefixEvents['emit'](_0x321481,_0x563148);_0xfa3251(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xbe22=['hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove'];(function(_0x5cb441,_0x1dbe7a){var _0x33d36e=function(_0x4a81c3){while(--_0x4a81c3){_0x5cb441['push'](_0x5cb441['shift']());}};_0x33d36e(++_0x1dbe7a);}(_0xbe22,0x1bb));var _0x2be2=function(_0x18b960,_0x21d1f0){_0x18b960=_0x18b960-0x0;var _0x3a1c6f=_0xbe22[_0x18b960];return _0x3a1c6f;};'use strict';var EventEmitter=require(_0x2be2('0x0'));var VoicePrefix=require(_0x2be2('0x1'))['db'][_0x2be2('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x2be2('0x3')](0x0);var events={'afterCreate':_0x2be2('0x4'),'afterUpdate':_0x2be2('0x5'),'afterDestroy':_0x2be2('0x6')};function emitEvent(_0x78d2bf){return function(_0x3faf04,_0x145898,_0x2f3e58){VoicePrefixEvents['emit'](_0x78d2bf+':'+_0x3faf04['id'],_0x3faf04);VoicePrefixEvents['emit'](_0x78d2bf,_0x3faf04);_0x2f3e58(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x2be2('0x7')](e,emitEvent(event));}}module[_0x2be2('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 dc40fa8..0cf9921 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 _0x2f7f=['path','rimraf','../../config/environment','VoicePrefix','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x320b8e,_0x1da3fe){var _0x55a10a=function(_0x148a56){while(--_0x148a56){_0x320b8e['push'](_0x320b8e['shift']());}};_0x55a10a(++_0x1da3fe);}(_0x2f7f,0x1a6));var _0xf2f7=function(_0x35d3a8,_0x44406a){_0x35d3a8=_0x35d3a8-0x0;var _0x182378=_0x2f7f[_0x35d3a8];return _0x182378;};'use strict';var _=require(_0xf2f7('0x0'));var util=require(_0xf2f7('0x1'));var logger=require(_0xf2f7('0x2'))(_0xf2f7('0x3'));var moment=require(_0xf2f7('0x4'));var BPromise=require(_0xf2f7('0x5'));var rp=require(_0xf2f7('0x6'));var fs=require('fs');var path=require(_0xf2f7('0x7'));var rimraf=require(_0xf2f7('0x8'));var config=require(_0xf2f7('0x9'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x3b69e6,_0x45fd21){return _0x3b69e6['define'](_0xf2f7('0xa'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3bcd=['util','../../config/logger','api','bluebird','rimraf','../../config/environment','exports','define','VoicePrefix','voice_prefixes','lodash'];(function(_0x336b34,_0x24fe0e){var _0x55ccdd=function(_0x41b462){while(--_0x41b462){_0x336b34['push'](_0x336b34['shift']());}};_0x55ccdd(++_0x24fe0e);}(_0x3bcd,0x149));var _0xd3bc=function(_0x126af8,_0x56233a){_0x126af8=_0x126af8-0x0;var _0xcc754a=_0x3bcd[_0x126af8];return _0xcc754a;};'use strict';var _=require(_0xd3bc('0x0'));var util=require(_0xd3bc('0x1'));var logger=require(_0xd3bc('0x2'))(_0xd3bc('0x3'));var moment=require('moment');var BPromise=require(_0xd3bc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd3bc('0x5'));var config=require(_0xd3bc('0x6'));var attributes=require('./voicePrefix.attributes');module[_0xd3bc('0x7')]=function(_0x27a10f,_0x19b514){return _0x27a10f[_0xd3bc('0x8')](_0xd3bc('0x9'),attributes,{'tableName':_0xd3bc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index bb3dc86..ffc449d 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 _0x565e=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','lodash','moment','bluebird'];(function(_0x10efc4,_0x51ffc9){var _0x10db7d=function(_0x2b1799){while(--_0x2b1799){_0x10efc4['push'](_0x10efc4['shift']());}};_0x10db7d(++_0x51ffc9);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe565('0x0'));var util=require('util');var moment=require(_0xe565('0x1'));var BPromise=require(_0xe565('0x2'));var rs=require(_0xe565('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe565('0x4'));var logger=require(_0xe565('0x5'))(_0xe565('0x6'));var config=require(_0xe565('0x7'));var jayson=require(_0xe565('0x8'));var client=jayson[_0xe565('0x9')][_0xe565('0xa')]({'port':0x232a});config[_0xe565('0xb')]=_[_0xe565('0xc')](config[_0xe565('0xb')],{'host':_0xe565('0xd'),'port':0x18eb});var socket=require(_0xe565('0xe'))(new Redis(config[_0xe565('0xb')]));require(_0xe565('0xf'))[_0xe565('0x10')](socket);function respondWithRpcPromise(_0x41640f,_0x5b82c1,_0x3dd4dc){return new BPromise(function(_0x36c827,_0x9fd021){return client['request'](_0x41640f,_0x3dd4dc)[_0xe565('0x11')](function(_0x9f674){logger[_0xe565('0x12')](_0xe565('0x13'),_0x5b82c1,'request\x20sent');logger[_0xe565('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x5b82c1,_0xe565('0x15'),JSON['stringify'](_0x9f674));if(_0x9f674[_0xe565('0x16')]){if(_0x9f674[_0xe565('0x16')][_0xe565('0x17')]===0x1f4){logger['error'](_0xe565('0x13'),_0x5b82c1,_0x9f674[_0xe565('0x16')][_0xe565('0x18')]);return _0x9fd021(_0x9f674[_0xe565('0x16')]['message']);}logger[_0xe565('0x16')](_0xe565('0x13'),_0x5b82c1,_0x9f674[_0xe565('0x16')][_0xe565('0x18')]);return _0x36c827(_0x9f674[_0xe565('0x16')][_0xe565('0x18')]);}else{logger['info'](_0xe565('0x13'),_0x5b82c1,_0xe565('0x15'));_0x36c827(_0x9f674[_0xe565('0x19')][_0xe565('0x18')]);}})['catch'](function(_0x403f94){logger[_0xe565('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x5b82c1,_0x403f94);_0x9fd021(_0x403f94);});});} \ No newline at end of file +var _0x82f8=['../../config/environment','jayson/promise','redis','defaults','localhost','register','request','then','info','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x57dc85,_0x3a6d51){var _0x563a2e=function(_0x5713b2){while(--_0x5713b2){_0x57dc85['push'](_0x57dc85['shift']());}};_0x563a2e(++_0x3a6d51);}(_0x82f8,0x157));var _0x882f=function(_0x478504,_0x541fb2){_0x478504=_0x478504-0x0;var _0x3d4ac2=_0x82f8[_0x478504];return _0x3d4ac2;};'use strict';var _=require('lodash');var util=require(_0x882f('0x0'));var moment=require(_0x882f('0x1'));var BPromise=require('bluebird');var rs=require(_0x882f('0x2'));var fs=require('fs');var Redis=require(_0x882f('0x3'));var db=require(_0x882f('0x4'))['db'];var utils=require(_0x882f('0x5'));var logger=require(_0x882f('0x6'))(_0x882f('0x7'));var config=require(_0x882f('0x8'));var jayson=require(_0x882f('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x882f('0xa')]=_[_0x882f('0xb')](config[_0x882f('0xa')],{'host':_0x882f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x882f('0xa')]));require('./voicePrefix.socket')[_0x882f('0xd')](socket);function respondWithRpcPromise(_0x478c18,_0x3ead6e,_0x5e9b49){return new BPromise(function(_0x499654,_0x14d89b){return client[_0x882f('0xe')](_0x478c18,_0x5e9b49)[_0x882f('0xf')](function(_0x2f2e51){logger[_0x882f('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x3ead6e,'request\x20sent');logger[_0x882f('0x11')](_0x882f('0x12'),_0x3ead6e,_0x882f('0x13'),JSON[_0x882f('0x14')](_0x2f2e51));if(_0x2f2e51[_0x882f('0x15')]){if(_0x2f2e51[_0x882f('0x15')][_0x882f('0x16')]===0x1f4){logger['error'](_0x882f('0x17'),_0x3ead6e,_0x2f2e51[_0x882f('0x15')][_0x882f('0x18')]);return _0x14d89b(_0x2f2e51[_0x882f('0x15')]['message']);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x3ead6e,_0x2f2e51[_0x882f('0x15')][_0x882f('0x18')]);return _0x499654(_0x2f2e51[_0x882f('0x15')][_0x882f('0x18')]);}else{logger[_0x882f('0x10')](_0x882f('0x17'),_0x3ead6e,_0x882f('0x13'));_0x499654(_0x2f2e51[_0x882f('0x19')]['message']);}})[_0x882f('0x1a')](function(_0x51e74f){logger['error'](_0x882f('0x17'),_0x3ead6e,_0x51e74f);_0x14d89b(_0x51e74f);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index d850bf8..d28f631 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 _0x6e77=['emit','voicePrefix:','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6e77,0xef));var _0x76e7=function(_0x7671bc,_0x171145){_0x7671bc=_0x7671bc-0x0;var _0x55229f=_0x6e77[_0x7671bc];return _0x55229f;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x76e7('0x0'),'remove','update'];function createListener(_0x389715,_0x2aea10){return function(_0x57a8b3){_0x2aea10[_0x76e7('0x1')](_0x389715,_0x57a8b3);};}function removeListener(_0x305900,_0xcc6627){return function(){VoicePrefixEvents['removeListener'](_0x305900,_0xcc6627);};}exports['register']=function(_0x423b7a){for(var _0xf4d008=0x0,_0xac49d0=events['length'];_0xf4d008<_0xac49d0;_0xf4d008++){var _0x433ae3=events[_0xf4d008];var _0x464a99=createListener(_0x76e7('0x2')+_0x433ae3,_0x423b7a);VoicePrefixEvents['on'](_0x433ae3,_0x464a99);}}; \ No newline at end of file +var _0xc7a7=['remove','emit','removeListener','register','voicePrefix:','./voicePrefix.events','save'];(function(_0x15d18f,_0x126b0e){var _0xd12bf7=function(_0x19e661){while(--_0x19e661){_0x15d18f['push'](_0x15d18f['shift']());}};_0xd12bf7(++_0x126b0e);}(_0xc7a7,0x171));var _0x7c7a=function(_0x4269ef,_0x2c0c0a){_0x4269ef=_0x4269ef-0x0;var _0x1453bc=_0xc7a7[_0x4269ef];return _0x1453bc;};'use strict';var VoicePrefixEvents=require(_0x7c7a('0x0'));var events=[_0x7c7a('0x1'),_0x7c7a('0x2'),'update'];function createListener(_0x2deee8,_0x243925){return function(_0x5c030a){_0x243925[_0x7c7a('0x3')](_0x2deee8,_0x5c030a);};}function removeListener(_0xc65f,_0xbd35ee){return function(){VoicePrefixEvents[_0x7c7a('0x4')](_0xc65f,_0xbd35ee);};}exports[_0x7c7a('0x5')]=function(_0xc84abf){for(var _0x346f96=0x0,_0x19467e=events['length'];_0x346f96<_0x19467e;_0x346f96++){var _0x361567=events[_0x346f96];var _0x43e2af=createListener(_0x7c7a('0x6')+_0x361567,_0xc84abf);VoicePrefixEvents['on'](_0x361567,_0x43e2af);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 3233a86..6d27969 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x20f764,_0x185982){var _0x52ab9d=function(_0x537856){while(--_0x537856){_0x20f764['push'](_0x20f764['shift']());}};_0x52ab9d(++_0x185982);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x1591d4,_0x4ea3bd){var _0x4c46bb=function(_0x13b7e7){while(--_0x13b7e7){_0x1591d4['push'](_0x1591d4['shift']());}};_0x4c46bb(++_0x4ea3bd);}(_0xb10b,0x12a));var _0xbb10=function(_0x75eccc,_0x4c2958){_0x75eccc=_0x75eccc-0x0;var _0x3ac04b=_0xb10b[_0x75eccc];return _0x3ac04b;};'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 8ff525f..d1fdfed 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 _0x422a=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','fewestcalls','random','linear','rrordered','setDataValue','strategy','rrmemory','type','dialMethod','getDataValue','preview','booked','roundrobin','INTEGER','yes','all','once','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','wrapuptime','BOOLEAN','progressive','power','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x2f1541,_0x2e6160){var _0x28002a=function(_0x3faff2){while(--_0x3faff2){_0x2f1541['push'](_0x2f1541['shift']());}};_0x28002a(++_0x2e6160);}(_0x422a,0x1e2));var _0xa422=function(_0x3ccdf3,_0x1254a2){_0x3ccdf3=_0x3ccdf3-0x0;var _0x1fbb9a=_0x422a[_0x3ccdf3];return _0x1fbb9a;};'use strict';var Sequelize=require(_0xa422('0x0'));module[_0xa422('0x1')]={'name':{'type':Sequelize[_0xa422('0x2')],'allowNull':![],'unique':_0xa422('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x5'),_0xa422('0x6')),'allowNull':![],'defaultValue':_0xa422('0x5')},'musiconhold':{'type':Sequelize[_0xa422('0x2')],'defaultValue':_0xa422('0x7')},'announce':{'type':Sequelize[_0xa422('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xa422('0x8'),'leastrecent',_0xa422('0x9'),_0xa422('0xa'),'rrmemory',_0xa422('0xb'),'wrandom',_0xa422('0xc')),'allowNull':![],'defaultValue':_0xa422('0x8'),'set':function(_0x23050b){this[_0xa422('0xd')](_0xa422('0xe'),_0x23050b?_0x23050b:_0xa422('0xf'));},'get':function(){var _0x2fbfb6=this['getDataValue'](_0xa422('0x10'));var _0x178d55=this['getDataValue'](_0xa422('0x11'));var _0x1cb43f=this[_0xa422('0x12')](_0xa422('0xe'));if(_0x2fbfb6===_0xa422('0x6')){if(_0x178d55===_0xa422('0x13')){return null;}if(_0x178d55===_0xa422('0x14')&&![_0xa422('0xf'),_0xa422('0x15')]['includes'](_0x1cb43f)){this[_0xa422('0xd')](_0xa422('0xe'),_0xa422('0xf'));}}return _0x1cb43f;}},'servicelevel':{'type':Sequelize[_0xa422('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xa422('0x16')](0xb)},'timeout':{'type':Sequelize[_0xa422('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xa422('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xa422('0x2')]},'weight':{'type':Sequelize[_0xa422('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xa422('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x17'),'no'),'defaultValue':_0xa422('0x17')},'autopause':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x17'),'no',_0xa422('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xa422('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xa422('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xa422('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xa422('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xa422('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xa422('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xa422('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xa422('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xa422('0x4')]('yes','no'),'defaultValue':_0xa422('0x17')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xa422('0x17'),'no',_0xa422('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xa422('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0xa422('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xa422('0x2')]},'queue_youarenext':{'type':Sequelize[_0xa422('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xa422('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xa422('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xa422('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xa422('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xa422('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xa422('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xa422('0x2')]},'queue_quantity1':{'type':Sequelize[_0xa422('0x2')]},'queue_quantity2':{'type':Sequelize[_0xa422('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xa422('0x2')]},'queue_less_than':{'type':Sequelize[_0xa422('0x2')]},'periodic_announce':{'type':Sequelize[_0xa422('0x1a')],'set':function(_0x138ebe){this[_0xa422('0xd')](_0xa422('0x1b'),_0x138ebe?_0x138ebe['join'](','):[]);},'get':function(){return this[_0xa422('0x12')](_0xa422('0x1b'))?this[_0xa422('0x12')](_0xa422('0x1b'))['split'](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xa422('0x17'),'set':function(_0x241360){this[_0xa422('0xd')]('joinempty',_0x241360?_0x241360[_0xa422('0x1c')](','):undefined);},'get':function(){return this[_0xa422('0x12')](_0xa422('0x1d'))?this[_0xa422('0x12')](_0xa422('0x1d'))[_0xa422('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xa422('0x2')],'defaultValue':'no','set':function(_0x27ebb1){this[_0xa422('0xd')](_0xa422('0x1f'),_0x27ebb1?_0x27ebb1[_0xa422('0x1c')](','):undefined);},'get':function(){return this['getDataValue'](_0xa422('0x1f'))?this[_0xa422('0x12')](_0xa422('0x1f'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xa422('0x4')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xa422('0x2')]},'description':{'type':Sequelize[_0xa422('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x21e16a){this['setDataValue']('acw',_0x21e16a);if(_0x21e16a){if(this[_0xa422('0x12')]('wrapuptime')<0x2){this[_0xa422('0xd')](_0xa422('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xa422('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xa422('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM']('preview',_0xa422('0x22'),_0xa422('0x23'),'predictive',_0xa422('0x14')),'defaultValue':_0xa422('0x22'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xa422('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xa422('0x25')},'dialLimitQueue':{'type':Sequelize[_0xa422('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xa422('0x26')},'dialPowerLevel':{'type':Sequelize[_0xa422('0x27')](0x2)[_0xa422('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xa422('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x29'),_0xa422('0x2a')),'defaultValue':_0xa422('0x2a'),'comment':_0xa422('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xa422('0x27')](0x2)[_0xa422('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xa422('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xa422('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0xa422('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa422('0x2e')},'dialQueueOptions':{'type':Sequelize[_0xa422('0x2')],'defaultValue':_0xa422('0x2f'),'comment':_0xa422('0x30')},'dialQueueTimeout':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa422('0x31')},'dialQueueProject':{'type':Sequelize[_0xa422('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa422('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa422('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xa422('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'defaultValue':0x3,'comment':_0xa422('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xa422('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa422('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa422('0x35')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xa422('0x2')],'defaultValue':_0xa422('0x36')},'dialPrefix':{'type':Sequelize[_0xa422('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x37'),_0xa422('0x38'),_0xa422('0x39')),'defaultValue':_0xa422('0x37')},'dialAMDActive':{'type':Sequelize[_0xa422('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xa422('0x16')](0x9)[_0xa422('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa422('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xa422('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xa422('0x16')](0x9)[_0xa422('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xa422('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xa422('0x16')](0x9)[_0xa422('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xa422('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa422('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa422('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xa422('0x16')](0x9)[_0xa422('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa422('0x16')](0x5)[_0xa422('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa422('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa422('0x16')](0x9)[_0xa422('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa422('0x3e')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xa422('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0xa422('0x21')],'defaultValue':0x0,'comment':_0xa422('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x41'),_0xa422('0x42')),'defaultValue':_0xa422('0x41')},'dialQueueProject2':{'type':Sequelize[_0xa422('0x2')],'comment':_0xa422('0x43')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xa422('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xa422('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa422('0x44')},'dialCutDigit':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa422('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa422('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa422('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xa422('0x16')](0x5)[_0xa422('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa422('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa422('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa422('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0xa422('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa422('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0xa422('0x16')](0x5)[_0xa422('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa422('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa422('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa422('0x16')](0x5)[_0xa422('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa422('0x16')],'allowNull':!![],'comment':_0xa422('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0xa422('0x21')],'defaultValue':![],'comment':_0xa422('0x4d'),'set':function(_0x494098){if(!_0x494098)this[_0xa422('0xd')](_0xa422('0x4e'),null);this[_0xa422('0xd')](_0xa422('0x4f'),_0x494098);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xa422('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xa422('0x21')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xa422('0x21')],'defaultValue':![]}}; \ No newline at end of file +var _0x6c63=['split','joinempty','leavewhenempty','wrapuptime','Active/Disactive\x20Campaign','predictive','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#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)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','inbound','outbound','default','fewestcalls','rrordered','setDataValue','rrmemory','type','getDataValue','dialMethod','strategy','preview','booked','includes','INTEGER','yes','all','once','TEXT','periodic_announce','join'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6c63,0x182));var _0x36c6=function(_0x2e3ccd,_0x226830){_0x2e3ccd=_0x2e3ccd-0x0;var _0x32a221=_0x6c63[_0x2e3ccd];return _0x32a221;};'use strict';var Sequelize=require(_0x36c6('0x0'));module['exports']={'name':{'type':Sequelize[_0x36c6('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x36c6('0x2')](_0x36c6('0x3'),_0x36c6('0x4')),'allowNull':![],'defaultValue':_0x36c6('0x3')},'musiconhold':{'type':Sequelize[_0x36c6('0x1')],'defaultValue':_0x36c6('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall','leastrecent',_0x36c6('0x6'),'random','rrmemory','linear','wrandom',_0x36c6('0x7')),'allowNull':![],'defaultValue':'ringall','set':function(_0x18f526){this[_0x36c6('0x8')]('strategy',_0x18f526?_0x18f526:_0x36c6('0x9'));},'get':function(){var _0x2962b9=this['getDataValue'](_0x36c6('0xa'));var _0x104d42=this[_0x36c6('0xb')](_0x36c6('0xc'));var _0x241f8f=this[_0x36c6('0xb')](_0x36c6('0xd'));if(_0x2962b9===_0x36c6('0x4')){if(_0x104d42===_0x36c6('0xe')){return null;}if(_0x104d42===_0x36c6('0xf')&&![_0x36c6('0x9'),'roundrobin'][_0x36c6('0x10')](_0x241f8f)){this[_0x36c6('0x8')](_0x36c6('0xd'),_0x36c6('0x9'));}}return _0x241f8f;}},'servicelevel':{'type':Sequelize[_0x36c6('0x11')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x36c6('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x36c6('0x11')](0xb)},'timeout':{'type':Sequelize[_0x36c6('0x11')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x36c6('0x1')]},'weight':{'type':Sequelize[_0x36c6('0x11')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x36c6('0x11')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x36c6('0x2')](_0x36c6('0x12'),'no'),'defaultValue':_0x36c6('0x12')},'autopause':{'type':Sequelize['ENUM'](_0x36c6('0x12'),'no',_0x36c6('0x13')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x36c6('0x2')](_0x36c6('0x12'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x36c6('0x2')](_0x36c6('0x12'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x36c6('0x11')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x36c6('0x2')](_0x36c6('0x12'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x36c6('0x2')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x36c6('0x2')](_0x36c6('0x12'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x36c6('0x11')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x36c6('0x11')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x36c6('0x11')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x36c6('0x12'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x36c6('0x12'),'no'),'defaultValue':_0x36c6('0x12')},'announce_holdtime':{'type':Sequelize[_0x36c6('0x2')](_0x36c6('0x12'),'no',_0x36c6('0x14')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x36c6('0x2')](_0x36c6('0x12'),'no')},'announce_position_limit':{'type':Sequelize[_0x36c6('0x11')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x36c6('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x36c6('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x36c6('0x1')]},'queue_youarenext':{'type':Sequelize[_0x36c6('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x36c6('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x36c6('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x36c6('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x36c6('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x36c6('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x36c6('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x36c6('0x1')]},'queue_quantity2':{'type':Sequelize[_0x36c6('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x36c6('0x1')]},'queue_less_than':{'type':Sequelize[_0x36c6('0x1')]},'periodic_announce':{'type':Sequelize[_0x36c6('0x15')],'set':function(_0x1b6a2a){this[_0x36c6('0x8')](_0x36c6('0x16'),_0x1b6a2a?_0x1b6a2a[_0x36c6('0x17')](','):[]);},'get':function(){return this[_0x36c6('0xb')](_0x36c6('0x16'))?this[_0x36c6('0xb')](_0x36c6('0x16'))[_0x36c6('0x18')](','):[];}},'joinempty':{'type':Sequelize[_0x36c6('0x1')],'defaultValue':_0x36c6('0x12'),'set':function(_0x27617a){this[_0x36c6('0x8')](_0x36c6('0x19'),_0x27617a?_0x27617a[_0x36c6('0x17')](','):undefined);},'get':function(){return this[_0x36c6('0xb')](_0x36c6('0x19'))?this[_0x36c6('0xb')](_0x36c6('0x19'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x36c6('0x1')],'defaultValue':'no','set':function(_0x46a04f){this[_0x36c6('0x8')](_0x36c6('0x1a'),_0x46a04f?_0x46a04f[_0x36c6('0x17')](','):undefined);},'get':function(){return this[_0x36c6('0xb')](_0x36c6('0x1a'))?this['getDataValue'](_0x36c6('0x1a'))[_0x36c6('0x18')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x36c6('0x2')](_0x36c6('0x12'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x36c6('0x2')](_0x36c6('0x12'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x36c6('0x11')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x36c6('0x2')](_0x36c6('0x12'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x36c6('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x4e52df){this[_0x36c6('0x8')]('acw',_0x4e52df);if(_0x4e52df){if(this[_0x36c6('0xb')](_0x36c6('0x1b'))<0x2){this['setDataValue'](_0x36c6('0x1b'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x36c6('0x11')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x36c6('0x1c')},'dialMethod':{'type':Sequelize[_0x36c6('0x2')]('preview','progressive','power',_0x36c6('0x1d'),_0x36c6('0xf')),'defaultValue':_0x36c6('0x1e'),'comment':_0x36c6('0x1f')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x36c6('0x20')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x36c6('0x21')},'dialLimitQueue':{'type':Sequelize[_0x36c6('0x11')](0x4)[_0x36c6('0x20')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x36c6('0x22')},'dialPowerLevel':{'type':Sequelize[_0x36c6('0x23')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x36c6('0x2')](_0x36c6('0x24'),_0x36c6('0x25')),'defaultValue':'dropRate','comment':_0x36c6('0x26')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x36c6('0x23')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x36c6('0x27')},'dialPredictiveInterval':{'type':Sequelize[_0x36c6('0x11')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x36c6('0x28')},'dialOriginateCallerIdName':{'type':Sequelize[_0x36c6('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x36c6('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x36c6('0x11')](0x3)[_0x36c6('0x20')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36c6('0x29')},'dialQueueOptions':{'type':Sequelize[_0x36c6('0x1')],'defaultValue':_0x36c6('0x2a'),'comment':_0x36c6('0x2b')},'dialQueueTimeout':{'type':Sequelize[_0x36c6('0x11')](0x3)[_0x36c6('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36c6('0x2c')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x36c6('0x11')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36c6('0x2d')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x36c6('0x11')](0x5)[_0x36c6('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x36c6('0x2e')},'dialBusyMaxRetry':{'type':Sequelize[_0x36c6('0x11')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36c6('0x2f')},'dialBusyRetryFrequency':{'type':Sequelize[_0x36c6('0x11')](0x5)[_0x36c6('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x36c6('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x36c6('0x20')],'defaultValue':0x3,'comment':_0x36c6('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x36c6('0x11')](0x5)[_0x36c6('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x36c6('0x32')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x36c6('0x20')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x36c6('0x33')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x36c6('0x1')],'defaultValue':_0x36c6('0x34')},'dialPrefix':{'type':Sequelize[_0x36c6('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x36c6('0x2')](_0x36c6('0x35'),'never',_0x36c6('0x36')),'defaultValue':_0x36c6('0x35')},'dialAMDActive':{'type':Sequelize[_0x36c6('0x37')],'defaultValue':0x0,'comment':_0x36c6('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0x36c6('0x11')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x36c6('0x39')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x36c6('0x20')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x36c6('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x36c6('0x11')](0x9)[_0x36c6('0x20')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x36c6('0x11')](0x9)[_0x36c6('0x20')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x36c6('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x36c6('0x11')](0x9)[_0x36c6('0x20')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x36c6('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x36c6('0x20')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x36c6('0x20')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x36c6('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x36c6('0x11')](0x5)[_0x36c6('0x20')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x36c6('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x36c6('0x11')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x36c6('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0x36c6('0x11')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x36c6('0x40')},'dialRecallInQueue':{'type':Sequelize[_0x36c6('0x37')],'defaultValue':0x0,'comment':_0x36c6('0x41')},'dialOrderByScheduledAt':{'type':Sequelize[_0x36c6('0x2')](_0x36c6('0x42'),_0x36c6('0x43')),'defaultValue':_0x36c6('0x42')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x36c6('0x44')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x36c6('0x37')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x36c6('0x37')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x36c6('0x11')](0x3)[_0x36c6('0x20')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x36c6('0x45')},'dialCutDigit':{'type':Sequelize[_0x36c6('0x11')](0x3)[_0x36c6('0x20')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x36c6('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x36c6('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36c6('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x36c6('0x11')](0x5)[_0x36c6('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x36c6('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0x36c6('0x11')](0x3)[_0x36c6('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36c6('0x49')},'dialDropRetryFrequency':{'type':Sequelize[_0x36c6('0x11')](0x5)[_0x36c6('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x36c6('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x36c6('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36c6('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x36c6('0x11')](0x5)[_0x36c6('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x36c6('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36c6('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize[_0x36c6('0x11')](0x5)[_0x36c6('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x36c6('0x11')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36c6('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x36c6('0x11')](0x5)[_0x36c6('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x36c6('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x36c6('0x11')],'allowNull':!![],'comment':_0x36c6('0x4f')},'mandatoryDisposition':{'type':Sequelize[_0x36c6('0x37')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x55889e){if(!_0x55889e)this['setDataValue'](_0x36c6('0x50'),null);this['setDataValue'](_0x36c6('0x51'),_0x55889e);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x36c6('0x11')](0x3)[_0x36c6('0x20')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x36c6('0x37')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x36c6('0x11')](0x3)[_0x36c6('0x20')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x36c6('0x37')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index f7eb8c7..22468ab 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(_0x35bd6c,_0x585087){_0x35bd6c=_0x35bd6c-0x0;var _0x2f421d=_0x4b84[_0x35bd6c];return _0x2f421d;};'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 _0xa41a=['createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','CmHopper','filters','nolimit','order','sort','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','hasOwnProperty','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','Agents','online','voicePause','interface','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','ids','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','removeTeams','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./voiceQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','inbound','QueueCampaigns','filter','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','send','index','rawAttributes','key','where','include','VoiceQueue','findAll','rows','catch','params','model','query','keys','attributes','intersection','fields','length','merge','options','create','body','user','role','VoiceQueues','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit'];(function(_0x2abc5a,_0x495dbc){var _0x36384e=function(_0x3125e8){while(--_0x3125e8){_0x2abc5a['push'](_0x2abc5a['shift']());}};_0x36384e(++_0x495dbc);}(_0xa41a,0x6b));var _0xaa41=function(_0x2d9e21,_0x5dda5e){_0x2d9e21=_0x2d9e21-0x0;var _0x34e76a=_0xa41a[_0x2d9e21];return _0x34e76a;};'use strict';var moment=require(_0xaa41('0x0'));var BPromise=require(_0xaa41('0x1'));var util=require('util');var _=require(_0xaa41('0x2'));var squel=require(_0xaa41('0x3'));var Redis=require(_0xaa41('0x4'));var qs=require(_0xaa41('0x5'));var logger=require(_0xaa41('0x6'))(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var db=require(_0xaa41('0x9'))['db'];config['redis']=_[_0xaa41('0xa')](config[_0xaa41('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa41('0xb')]));require(_0xaa41('0xc'))['register'](socket);function respondWithStatusCode(_0x31df43,_0x33f66b){_0x33f66b=_0x33f66b||0xcc;return function(_0x409dab){if(_0x409dab){return _0x31df43[_0xaa41('0xd')](_0x33f66b);}return _0x31df43[_0xaa41('0xe')](_0x33f66b)[_0xaa41('0xf')]();};}function respondWithResult(_0x806f08,_0x423a19){_0x423a19=_0x423a19||0xc8;return function(_0x1c291e){if(_0x1c291e){return _0x806f08['status'](_0x423a19)[_0xaa41('0x10')](_0x1c291e);}};}function respondWithFilteredResult(_0x10cda9,_0x524cab){return function(_0x54827c){if(_0x54827c){var _0x1d0a54=typeof _0x524cab['offset']===_0xaa41('0x11')&&typeof _0x524cab[_0xaa41('0x12')]===_0xaa41('0x11');var _0x889d44=_0x54827c[_0xaa41('0x13')];var _0x4eaf81=_0x1d0a54?0x0:_0x524cab[_0xaa41('0x14')];var _0x178170=_0x1d0a54?_0x54827c[_0xaa41('0x13')]:_0x524cab[_0xaa41('0x14')]+_0x524cab[_0xaa41('0x12')];var _0x2005ae;if(_0x178170>=_0x889d44){_0x178170=_0x889d44;_0x2005ae=0xc8;}else{_0x2005ae=0xce;}_0x10cda9[_0xaa41('0xe')](_0x2005ae);return _0x10cda9['set'](_0xaa41('0x15'),_0x4eaf81+'-'+_0x178170+'/'+_0x889d44)[_0xaa41('0x10')](_0x54827c);}return null;};}function saveUpdates(_0x4210fa){return function(_0x391b01){if(_0x391b01){return _0x391b01[_0xaa41('0x16')](_0x4210fa)[_0xaa41('0x17')](function(_0x29efe5){return _0x29efe5;});}return null;};}function removeEntity(_0x46e6d3){return function(_0x150ddf){if(_0x150ddf){return _0x150ddf['destroy']()['then'](function(){var _0x1f502a=_0x150ddf[_0xaa41('0x18')]({'plain':!![]});var _0x35c753=[{'name':'VoiceQueues','value':_0xaa41('0x19'),'ignore':![]},{'name':_0xaa41('0x1a'),'value':'outbound','ignore':![]}];var _0x513c61=_(_0x35c753)[_0xaa41('0x1b')]('ignore')[_0xaa41('0x1c')](_0xaa41('0x1d'))[_0xaa41('0x1d')]();if(_[_0xaa41('0x1e')](_0x513c61,_0x1f502a[_0xaa41('0x1f')])){return;}var _0x4eb01f=_[_0xaa41('0x20')](_0x35c753,[_0xaa41('0x1d'),_0x1f502a[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db[_0xaa41('0x22')][_0xaa41('0x23')]({'where':{'type':_0x4eb01f,'resourceId':_0x1f502a['id']}})['then'](function(){return _0x150ddf;});})['then'](function(){_0x46e6d3[_0xaa41('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x493a10){return function(_0x12e362){if(!_0x12e362){_0x493a10['sendStatus'](0x194);}return _0x12e362;};}function handleError(_0x536bed,_0x2d0ac0){_0x2d0ac0=_0x2d0ac0||0x1f4;return function(_0x9c8c21){logger[_0xaa41('0x24')](_0x9c8c21[_0xaa41('0x25')]);if(_0x9c8c21[_0xaa41('0x21')]){delete _0x9c8c21[_0xaa41('0x21')];}_0x536bed['status'](_0x2d0ac0)[_0xaa41('0x26')](_0x9c8c21);};}exports[_0xaa41('0x27')]=function(_0x63c18c,_0x9a16e3){var _0x1d8c2b={};var _0x4466a3={'count':0x0,'rows':[]};var _0x30f88e=_[_0xaa41('0x1c')](db['VoiceQueue'][_0xaa41('0x28')],function(_0x48b48b){return{'name':_0x48b48b['fieldName'],'type':_0x48b48b[_0xaa41('0x1f')][_0xaa41('0x29')]};});_0x1d8c2b=qs['getOptions'](_0x30f88e,_0x63c18c);var _0x392b5d={'where':_0x1d8c2b[_0xaa41('0x2a')]};return db['VoiceQueue']['count'](_0x392b5d)['then'](function(_0x1cf3da){_0x4466a3[_0xaa41('0x13')]=_0x1cf3da;_0x1d8c2b[_0xaa41('0x2b')]=qs[_0xaa41('0x2b')](_0x63c18c['query']);return db[_0xaa41('0x2c')][_0xaa41('0x2d')](_0x1d8c2b);})[_0xaa41('0x17')](function(_0x4de770){_0x4466a3[_0xaa41('0x2e')]=_0x4de770;return _0x4466a3;})[_0xaa41('0x17')](respondWithFilteredResult(_0x9a16e3,_0x1d8c2b))[_0xaa41('0x2f')](handleError(_0x9a16e3,null));};exports['show']=function(_0x252c62,_0x374117){var _0x57fe1d={'raw':![],'where':{'id':_0x252c62[_0xaa41('0x30')]['id']}},_0x23eb50={};_0x23eb50[_0xaa41('0x31')]=_['keys'](db[_0xaa41('0x2c')]['rawAttributes']);_0x23eb50[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x252c62[_0xaa41('0x32')]);_0x23eb50['filters']=_['intersection'](_0x23eb50['model'],_0x23eb50[_0xaa41('0x32')]);_0x57fe1d[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x23eb50[_0xaa41('0x31')],qs['fields'](_0x252c62['query'][_0xaa41('0x36')]));_0x57fe1d[_0xaa41('0x34')]=_0x57fe1d[_0xaa41('0x34')][_0xaa41('0x37')]?_0x57fe1d[_0xaa41('0x34')]:_0x23eb50[_0xaa41('0x31')];if(_0x252c62[_0xaa41('0x32')]['includeAll']){_0x57fe1d[_0xaa41('0x2b')]=[{'all':!![]}];}_0x57fe1d=_[_0xaa41('0x38')]({},_0x57fe1d,_0x252c62[_0xaa41('0x39')]);return db[_0xaa41('0x2c')]['find'](_0x57fe1d)['then'](handleEntityNotFound(_0x374117,null))[_0xaa41('0x17')](respondWithResult(_0x374117,null))[_0xaa41('0x2f')](handleError(_0x374117,null));};exports['create']=function(_0x4101ab,_0x563687){return db[_0xaa41('0x2c')][_0xaa41('0x3a')](_0x4101ab[_0xaa41('0x3b')],{})[_0xaa41('0x17')](function(_0x3e6cac){var _0x12ba1a=_0x4101ab[_0xaa41('0x3c')][_0xaa41('0x18')]({'plain':!![]});if(!_0x12ba1a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12ba1a[_0xaa41('0x3d')]===_0xaa41('0x3c')){var _0x35c685=_0x3e6cac[_0xaa41('0x18')]({'plain':!![]});var _0xc84fb8=[{'name':_0xaa41('0x3e'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xaa41('0x3f')}];var _0x4f9086=_[_0xaa41('0x20')](_0xc84fb8,[_0xaa41('0x1d'),_0x35c685[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db[_0xaa41('0x40')][_0xaa41('0x20')]({'where':{'name':_0x4f9086,'userProfileId':_0x12ba1a[_0xaa41('0x41')]},'raw':!![]})['then'](function(_0x124992){if(_0x124992&&_0x124992['autoAssociation']===0x0){return db['UserProfileResource'][_0xaa41('0x3a')]({'name':_0x35c685['name'],'resourceId':_0x35c685['id'],'type':_0x124992['name'],'sectionId':_0x124992['id']},{})['then'](function(){return _0x3e6cac;});}else{return _0x3e6cac;}})[_0xaa41('0x2f')](function(_0x525b09){logger[_0xaa41('0x24')](_0xaa41('0x42'),_0x525b09);throw _0x525b09;});}return _0x3e6cac;})['then'](respondWithResult(_0x563687,0xc9))['catch'](handleError(_0x563687,null));};exports[_0xaa41('0x43')]=function(_0x1b7b97,_0x1bb973){var _0x2af8ba={'where':{'id':_0x1b7b97[_0xaa41('0x30')]['id']}},_0x3fe1a9={};_0x3fe1a9[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x2c')]['rawAttributes']);_0x2af8ba[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x3fe1a9[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x1b7b97[_0xaa41('0x32')][_0xaa41('0x36')]));_0x2af8ba['attributes']=_0x2af8ba[_0xaa41('0x34')][_0xaa41('0x37')]?_0x2af8ba[_0xaa41('0x34')]:_0x3fe1a9[_0xaa41('0x31')];if(_0x1b7b97['query'][_0xaa41('0x44')]){_0x2af8ba['include']=[{'all':!![]}];}_0x2af8ba=_['merge']({},_0x2af8ba,_0x1b7b97[_0xaa41('0x39')]);return db[_0xaa41('0x2c')][_0xaa41('0x20')](_0x2af8ba)['then'](handleEntityNotFound(_0x1bb973,null))[_0xaa41('0x17')](function(_0x3e1a73){if(_0x3e1a73){var _0x853ccb=_0x3e1a73['get']({'plain':!![]});_0x853ccb=qs[_0xaa41('0x45')](_0x853ccb,['id',_0xaa41('0x46'),_0xaa41('0x47')]);_0x1b7b97[_0xaa41('0x3b')]=_[_0xaa41('0x45')](_0x1b7b97[_0xaa41('0x3b')],['id',_0xaa41('0x46'),_0xaa41('0x47')]);return db['VoiceQueue'][_0xaa41('0x3a')](_['merge'](_0x853ccb,_0x1b7b97['body']),{'include':_0x1b7b97[_0xaa41('0x32')][_0xaa41('0x44')]?[{'all':!![]}]:undefined})[_0xaa41('0x17')](function(_0x11f7d9){var _0x14aab0=_0x1b7b97[_0xaa41('0x3c')][_0xaa41('0x18')]({'plain':!![]});if(!_0x14aab0)throw new Error(_0xaa41('0x48'));if(_0x14aab0['role']===_0xaa41('0x3c')){var _0x14b0f0=_0x11f7d9[_0xaa41('0x18')]({'plain':!![]});var _0x4f9e92=[{'name':_0xaa41('0x3e'),'value':_0xaa41('0x19')},{'name':'QueueCampaigns','value':_0xaa41('0x3f')}];var _0xd36d1a=_[_0xaa41('0x20')](_0x4f9e92,['value',_0x14b0f0[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db['UserProfileSection']['find']({'where':{'name':_0xd36d1a,'userProfileId':_0x14aab0[_0xaa41('0x41')]},'raw':!![]})[_0xaa41('0x17')](function(_0x3a29d2){if(_0x3a29d2&&_0x3a29d2['autoAssociation']===0x0){return db[_0xaa41('0x22')][_0xaa41('0x3a')]({'name':_0x14b0f0[_0xaa41('0x21')],'resourceId':_0x14b0f0['id'],'type':_0x3a29d2[_0xaa41('0x21')],'sectionId':_0x3a29d2['id']},{})[_0xaa41('0x17')](function(){return _0x11f7d9;});}else{return _0x11f7d9;}})['catch'](function(_0x2ae70c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ae70c);throw _0x2ae70c;});}return _0x11f7d9;});}})[_0xaa41('0x17')](respondWithResult(_0x1bb973,0xc9))['catch'](handleError(_0x1bb973,null));};exports[_0xaa41('0x16')]=function(_0xbbf261,_0x169ddf){if(_0xbbf261['body']['id']){delete _0xbbf261[_0xaa41('0x3b')]['id'];}return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0xbbf261[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x169ddf,null))[_0xaa41('0x17')](saveUpdates(_0xbbf261[_0xaa41('0x3b')],null))[_0xaa41('0x17')](respondWithResult(_0x169ddf,null))[_0xaa41('0x2f')](handleError(_0x169ddf,null));};exports['destroy']=function(_0x35a09e,_0x40cdfc){return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x35a09e[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x40cdfc,null))[_0xaa41('0x17')](removeEntity(_0x40cdfc,null))[_0xaa41('0x2f')](handleError(_0x40cdfc,null));};exports[_0xaa41('0x49')]=function(_0xfbe748,_0x320ce7){var _0x5ea056={'raw':![],'where':{}};var _0x55a85c={};var _0x5cb34d={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0xfbe748['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x320ce7,null))['then'](function(_0x576e6e){if(_0x576e6e){_0x55a85c[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x4a')][_0xaa41('0x28')]);_0x55a85c['query']=_[_0xaa41('0x33')](_0xfbe748[_0xaa41('0x32')]);_0x55a85c[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x55a85c[_0xaa41('0x31')],_0x55a85c[_0xaa41('0x32')]);_0x5ea056[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x55a85c[_0xaa41('0x31')],qs['fields'](_0xfbe748[_0xaa41('0x32')][_0xaa41('0x36')]));_0x5ea056['attributes']=_0x5ea056['attributes']['length']?_0x5ea056[_0xaa41('0x34')]:_0x55a85c['model'];if(!_0xfbe748[_0xaa41('0x32')]['hasOwnProperty'](_0xaa41('0x4c'))){_0x5ea056[_0xaa41('0x12')]=qs['limit'](_0xfbe748[_0xaa41('0x32')][_0xaa41('0x12')]);_0x5ea056[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0xfbe748['query']['offset']);}_0x5ea056[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xfbe748['query']['sort']);_0x5ea056[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xfbe748[_0xaa41('0x32')],_0x55a85c[_0xaa41('0x4b')]));_0x5ea056['where'][_0xaa41('0x50')]=_0x576e6e['id'];if(_0xfbe748['query']['filter']){_0x5ea056['where']=_[_0xaa41('0x38')](_0x5ea056[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x5ea056['attributes'],function(_0x229297){var _0x2adf93={};_0x2adf93[_0x229297]={'$like':'%'+_0xfbe748[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x2adf93;})});}_0x5ea056=_[_0xaa41('0x38')]({},_0x5ea056,_0xfbe748[_0xaa41('0x39')]);return db[_0xaa41('0x4a')]['count']({'where':_0x5ea056[_0xaa41('0x2a')]})[_0xaa41('0x17')](function(_0x40b47c){_0x5cb34d[_0xaa41('0x13')]=_0x40b47c;if(_0xfbe748['query'][_0xaa41('0x44')]){_0x5ea056['include']=[{'all':!![]}];}return db[_0xaa41('0x4a')][_0xaa41('0x2d')](_0x5ea056);})[_0xaa41('0x17')](function(_0x143ef0){_0x5cb34d['rows']=_0x143ef0;return _0x5cb34d;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x320ce7,_0x5ea056))[_0xaa41('0x2f')](handleError(_0x320ce7,null));};exports[_0xaa41('0x51')]=function(_0x304aad,_0x59052d){var _0x140d78={'raw':!![],'where':{}};var _0x50197b={};var _0x55d380={'count':0x0,'rows':[]};return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0x304aad[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x59052d,null))[_0xaa41('0x17')](function(_0x582d79){if(_0x582d79){_0x50197b[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x52')][_0xaa41('0x28')]);_0x50197b[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x304aad[_0xaa41('0x32')]);_0x50197b['filters']=_[_0xaa41('0x35')](_0x50197b[_0xaa41('0x31')],_0x50197b[_0xaa41('0x32')]);_0x140d78['attributes']=_['intersection'](_0x50197b[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x304aad['query'][_0xaa41('0x36')]));_0x140d78[_0xaa41('0x34')]=_0x140d78['attributes'][_0xaa41('0x37')]?_0x140d78[_0xaa41('0x34')]:_0x50197b[_0xaa41('0x31')];if(!_0x304aad[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x140d78[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x304aad['query']['limit']);_0x140d78[_0xaa41('0x14')]=qs['offset'](_0x304aad[_0xaa41('0x32')][_0xaa41('0x14')]);}_0x140d78[_0xaa41('0x4d')]=qs['sort'](_0x304aad[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x140d78[_0xaa41('0x2a')]=qs['filters'](_[_0xaa41('0x4f')](_0x304aad[_0xaa41('0x32')],_0x50197b['filters']));_0x140d78[_0xaa41('0x2a')]['VoiceQueueId']=_0x582d79['id'];if(_0x304aad['query'][_0xaa41('0x1b')]){_0x140d78[_0xaa41('0x2a')]=_['merge'](_0x140d78['where'],{'$or':_[_0xaa41('0x1c')](_0x140d78[_0xaa41('0x34')],function(_0x3c189d){var _0x447183={};_0x447183[_0x3c189d]={'$like':'%'+_0x304aad['query'][_0xaa41('0x1b')]+'%'};return _0x447183;})});}_0x140d78=_[_0xaa41('0x38')]({},_0x140d78,_0x304aad[_0xaa41('0x39')]);return db['CmHopperHistory'][_0xaa41('0x13')]({'where':_0x140d78[_0xaa41('0x2a')]})[_0xaa41('0x17')](function(_0x5697b6){_0x55d380[_0xaa41('0x13')]=_0x5697b6;if(_0x304aad['query']['includeAll']){_0x140d78[_0xaa41('0x2b')]=[{'all':!![]}];}return db[_0xaa41('0x52')]['findAll'](_0x140d78);})[_0xaa41('0x17')](function(_0x9e8ebb){_0x55d380[_0xaa41('0x2e')]=_0x9e8ebb;return _0x55d380;});}})['then'](respondWithFilteredResult(_0x59052d,_0x140d78))[_0xaa41('0x2f')](handleError(_0x59052d,null));};exports[_0xaa41('0x54')]=function(_0x1a2deb,_0x16dcac){var _0x38f5d0={'raw':!![],'where':{}};var _0x4e087d={};var _0x24eb2e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xaa41('0x55')]({'where':{'id':_0x1a2deb[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x16dcac,null))[_0xaa41('0x17')](function(_0x33ec81){if(_0x33ec81){_0x4e087d[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x56')][_0xaa41('0x28')]);_0x4e087d[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x1a2deb['query']);_0x4e087d[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x4e087d['model'],_0x4e087d[_0xaa41('0x32')]);_0x38f5d0['attributes']=_[_0xaa41('0x35')](_0x4e087d[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x36')]));_0x38f5d0[_0xaa41('0x34')]=_0x38f5d0[_0xaa41('0x34')]['length']?_0x38f5d0[_0xaa41('0x34')]:_0x4e087d[_0xaa41('0x31')];if(!_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x53')]('nolimit')){_0x38f5d0[_0xaa41('0x12')]=qs['limit'](_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x12')]);_0x38f5d0[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x1a2deb[_0xaa41('0x32')]['offset']);}_0x38f5d0[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x1a2deb['query'][_0xaa41('0x4e')]);_0x38f5d0[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x1a2deb[_0xaa41('0x32')],_0x4e087d[_0xaa41('0x4b')]));_0x38f5d0[_0xaa41('0x2a')][_0xaa41('0x50')]=_0x33ec81['id'];if(_0x1a2deb['query'][_0xaa41('0x1b')]){_0x38f5d0[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x38f5d0[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x38f5d0[_0xaa41('0x34')],function(_0x5489be){var _0x56f5ff={};_0x56f5ff[_0x5489be]={'$like':'%'+_0x1a2deb['query'][_0xaa41('0x1b')]+'%'};return _0x56f5ff;})});}_0x38f5d0=_[_0xaa41('0x38')]({},_0x38f5d0,_0x1a2deb['options']);return db[_0xaa41('0x56')][_0xaa41('0x13')]({'where':_0x38f5d0['where']})[_0xaa41('0x17')](function(_0x1da898){_0x24eb2e[_0xaa41('0x13')]=_0x1da898;if(_0x1a2deb[_0xaa41('0x32')]['includeAll']){_0x38f5d0[_0xaa41('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xaa41('0x2d')](_0x38f5d0);})[_0xaa41('0x17')](function(_0x374873){_0x24eb2e[_0xaa41('0x2e')]=_0x374873;return _0x24eb2e;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x16dcac,_0x38f5d0))[_0xaa41('0x2f')](handleError(_0x16dcac,null));};exports[_0xaa41('0x57')]=function(_0x27363e,_0x25cac8){var _0x5381d5={'raw':!![],'where':{}};var _0x276013={};var _0x3135c3={'count':0x0,'rows':[]};return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0x27363e[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x25cac8,null))[_0xaa41('0x17')](function(_0x408d95){if(_0x408d95){_0x276013[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x58')][_0xaa41('0x28')]);_0x276013[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x27363e[_0xaa41('0x32')]);_0x276013['filters']=_[_0xaa41('0x35')](_0x276013[_0xaa41('0x31')],_0x276013[_0xaa41('0x32')]);_0x5381d5[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x276013['model'],qs['fields'](_0x27363e[_0xaa41('0x32')][_0xaa41('0x36')]));_0x5381d5['attributes']=_0x5381d5[_0xaa41('0x34')][_0xaa41('0x37')]?_0x5381d5['attributes']:_0x276013['model'];if(!_0x27363e['query'][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x5381d5[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x27363e[_0xaa41('0x32')][_0xaa41('0x12')]);_0x5381d5[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x27363e[_0xaa41('0x32')][_0xaa41('0x14')]);}_0x5381d5[_0xaa41('0x4d')]=qs['sort'](_0x27363e['query'][_0xaa41('0x4e')]);_0x5381d5[_0xaa41('0x2a')]=qs['filters'](_[_0xaa41('0x4f')](_0x27363e['query'],_0x276013[_0xaa41('0x4b')]));_0x5381d5[_0xaa41('0x2a')][_0xaa41('0x50')]=_0x408d95['id'];if(_0x27363e[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x5381d5[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x5381d5[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x5381d5['attributes'],function(_0x56bd21){var _0x56661a={};_0x56661a[_0x56bd21]={'$like':'%'+_0x27363e[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x56661a;})});}_0x5381d5=_['merge']({},_0x5381d5,_0x27363e['options']);return db[_0xaa41('0x58')][_0xaa41('0x13')]({'where':_0x5381d5['where']})['then'](function(_0xf651b7){_0x3135c3['count']=_0xf651b7;if(_0x27363e[_0xaa41('0x32')][_0xaa41('0x44')]){_0x5381d5[_0xaa41('0x2b')]=[{'all':!![]}];}return db[_0xaa41('0x58')][_0xaa41('0x2d')](_0x5381d5);})[_0xaa41('0x17')](function(_0x211455){_0x3135c3[_0xaa41('0x2e')]=_0x211455;return _0x3135c3;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x25cac8,_0x5381d5))['catch'](handleError(_0x25cac8,null));};exports['getTeams']=function(_0x38884d,_0x25d938){var _0x337655={};var _0x415705={};var _0x3efb43;var _0xae746;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0x38884d[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x25d938,null))[_0xaa41('0x17')](function(_0x17442e){if(_0x17442e){_0x3efb43=_0x17442e;_0x415705[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x59')]['rawAttributes']);_0x415705[_0xaa41('0x32')]=_['keys'](_0x38884d[_0xaa41('0x32')]);_0x415705[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x415705[_0xaa41('0x31')],_0x415705[_0xaa41('0x32')]);_0x337655[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x415705[_0xaa41('0x31')],qs['fields'](_0x38884d[_0xaa41('0x32')][_0xaa41('0x36')]));_0x337655[_0xaa41('0x34')]=_0x337655[_0xaa41('0x34')][_0xaa41('0x37')]?_0x337655[_0xaa41('0x34')]:_0x415705[_0xaa41('0x31')];_0x337655[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x38884d[_0xaa41('0x32')]['sort']);_0x337655['where']=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x38884d[_0xaa41('0x32')],_0x415705[_0xaa41('0x4b')]));if(_0x38884d[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x337655[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x337655[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x337655['attributes'],function(_0x49b468){var _0x17018e={};_0x17018e[_0x49b468]={'$like':'%'+_0x38884d[_0xaa41('0x32')]['filter']+'%'};return _0x17018e;})});}_0x337655=_[_0xaa41('0x38')]({},_0x337655,_0x38884d['options']);return _0x3efb43[_0xaa41('0x5a')](_0x337655);}})[_0xaa41('0x17')](function(_0x50e03d){if(_0x50e03d){_0xae746=_0x50e03d['length'];if(!_0x38884d[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x337655['limit']=qs['limit'](_0x38884d[_0xaa41('0x32')]['limit']);_0x337655[_0xaa41('0x14')]=qs['offset'](_0x38884d[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x3efb43[_0xaa41('0x5a')](_0x337655);}})[_0xaa41('0x17')](function(_0x182b0b){if(_0x182b0b){return _0x182b0b?{'count':_0xae746,'rows':_0x182b0b}:null;}})[_0xaa41('0x17')](respondWithResult(_0x25d938,null))[_0xaa41('0x2f')](handleError(_0x25d938,null));};exports['addTeams']=function(_0x4363b5,_0x1fa1f5){var _0x50883c=_0x4363b5[_0xaa41('0x3b')][_0xaa41('0x5b')];var _0x1c3d7f=_[_0xaa41('0x1c')](_0x50883c,'id');return db['Team'][_0xaa41('0x2d')]({'where':{'id':_0x1c3d7f},'attributes':['id'],'include':[{'model':db[_0xaa41('0x5c')],'as':_0xaa41('0x5d'),'attributes':['id',_0xaa41('0x21'),_0xaa41('0x5e'),_0xaa41('0x5f'),_0xaa41('0x60')],'raw':!![]}]})[_0xaa41('0x17')](function(_0xe2574a){if(_0xe2574a){var _0x4d83ce=_['flatMap'](_0xe2574a,function(_0x214ebe){var _0x2df75c=_0x214ebe[_0xaa41('0x18')]({'plain':!![]});_0x2df75c[_0xaa41('0x5d')][_0xaa41('0x61')](function(_0x401586){_0x401586['penalty']=_[_0xaa41('0x20')](_0x50883c,{'id':_0x2df75c['id']})[_0xaa41('0x62')];});return _0x2df75c[_0xaa41('0x5d')];});return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x4363b5[_0xaa41('0x30')]['id']}})['then'](function(_0xe8076e){return db[_0xaa41('0x63')][_0xaa41('0x64')](function(_0x4cf0c5){return _0xe8076e[_0xaa41('0x65')](_0x1c3d7f,{'transaction':_0x4cf0c5})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_0x50883c,function(_0x255e76){return db[_0xaa41('0x67')][_0xaa41('0x68')]({'TeamId':_0x255e76['id'],'VoiceQueueId':_0x4363b5[_0xaa41('0x30')]['id'],'penalty':_0x255e76[_0xaa41('0x62')]},{'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_0x4d83ce,function(_0x19a42c){return db[_0xaa41('0x69')][_0xaa41('0x6a')]({'where':{'UserId':_0x19a42c['id'],'VoiceQueueId':_0x4363b5['params']['id']},'defaults':{'penalty':_0x19a42c['penalty']},'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_[_0xaa41('0x1b')](_0x4d83ce,{'online':!![]}),function(_0x2c4595){return db[_0xaa41('0x6b')][_0xaa41('0x68')]({'membername':_0x2c4595[_0xaa41('0x21')],'UserId':_0x2c4595['id'],'queue_name':_0xe8076e['name'],'VoiceQueueId':_0xe8076e['id'],'interface':_[_0xaa41('0x6c')](_0x2c4595[_0xaa41('0x60')])?util[_0xaa41('0x6d')](_0xaa41('0x6e'),_0x2c4595[_0xaa41('0x21')]):_0x2c4595[_0xaa41('0x60')],'paused':_0x2c4595[_0xaa41('0x5f')]||![],'penalty':_0x2c4595[_0xaa41('0x62')]},{'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){_0x4d83ce[_0xaa41('0x61')](function(_0x3f2dbb){socket[_0xaa41('0x6f')]('userVoiceQueue:save',{'UserId':_0x3f2dbb['id'],'VoiceQueueId':_0xe8076e['id']});});});});});}})[_0xaa41('0x17')](respondWithStatusCode(_0x1fa1f5,null))[_0xaa41('0x2f')](handleError(_0x1fa1f5,null));};exports['removeTeams']=function(_0x33f008,_0x1489fe){return db[_0xaa41('0x59')][_0xaa41('0x2d')]({'where':{'id':_0x33f008['query'][_0xaa41('0x70')]},'attributes':['id'],'include':[{'model':db[_0xaa41('0x5c')],'as':_0xaa41('0x5d'),'attributes':['id'],'raw':!![]}]})[_0xaa41('0x17')](handleEntityNotFound(_0x1489fe,null))[_0xaa41('0x17')](function(_0x4baae3){var _0xc59a12=_['map'](_0x4baae3,'id');var _0x50a526=[];var _0x3dd3fa=[];var _0x552493=squel['select']();_0x552493[_0xaa41('0x71')](_0xaa41('0x72'))[_0xaa41('0x73')]('team_has_voice_queues','tq')[_0xaa41('0x74')](_0xaa41('0x75'),'ut',_0xaa41('0x76'))[_0xaa41('0x2a')](_0xaa41('0x77'),_0x33f008[_0xaa41('0x30')]['id']);for(var _0x29d34a=0x0;_0x29d34a<_0x4baae3[_0xaa41('0x37')];_0x29d34a+=0x1){let _0x48e2cf=_0x4baae3[_0x29d34a];for(var _0x410d6e=0x0;_0x410d6e<_0x48e2cf[_0xaa41('0x5d')][_0xaa41('0x37')];_0x410d6e+=0x1){let _0x3361f5=_0x48e2cf[_0xaa41('0x5d')][_0x410d6e];var _0x4f1bcb=_0x552493['clone']();_0x4f1bcb[_0xaa41('0x2a')](_0xaa41('0x78'),_0x3361f5['id']);_0x3dd3fa[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x4f1bcb[_0xaa41('0x7a')](),{'type':db['sequelize'][_0xaa41('0x7b')][_0xaa41('0x7c')]})['then'](function(_0x40f4ce){if(_0x40f4ce[_0xaa41('0x37')]===0x1){return _0x3361f5['id'];}else{var _0x95300a=_[_0xaa41('0x7d')](_[_0xaa41('0x1c')](_0x40f4ce,_0xaa41('0x7e')),function(_0x1926bd){return _['includes'](_0xc59a12,_0x1926bd);});if(_0x95300a){return _0x3361f5['id'];}}}));}}return BPromise[_0xaa41('0x7f')](_0x3dd3fa)[_0xaa41('0x17')](function(_0x5404cd){_0x50a526=_(_0x50a526)[_0xaa41('0x80')](_0x5404cd)[_0xaa41('0x81')]()[_0xaa41('0x1d')]();return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x33f008[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(_0x339537){return db[_0xaa41('0x63')][_0xaa41('0x64')](function(_0x4b84bc){return _0x339537[_0xaa41('0x82')](_0x33f008[_0xaa41('0x32')]['ids'],{'transaction':_0x4b84bc})['then'](function(){if(!_[_0xaa41('0x83')](_0x50a526)){return _0x339537[_0xaa41('0x84')](_0x50a526,{'transaction':_0x4b84bc})[_0xaa41('0x17')](function(){return db[_0xaa41('0x6b')][_0xaa41('0x23')]({'where':{'VoiceQueueId':_0x33f008[_0xaa41('0x30')]['id'],'UserId':_0x50a526},'transaction':_0x4b84bc});});}})['then'](function(){_0x50a526['forEach'](function(_0x395323){socket[_0xaa41('0x6f')]('userVoiceQueue:remove',{'UserId':_0x395323,'VoiceQueueId':_0x339537['id']});});});});});});})['then'](respondWithStatusCode(_0x1489fe,null))[_0xaa41('0x2f')](handleError(_0x1489fe,null));};exports[_0xaa41('0x85')]=function(_0x2fe50f,_0x520b50){var _0x50122d,_0x1d609e;return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x2fe50f['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x520b50,null))[_0xaa41('0x17')](function(_0x5a0791){if(_0x5a0791){_0x1d609e=_0x5a0791;return _0x5a0791['addAgents'](_0x2fe50f[_0xaa41('0x3b')]['ids'],_[_0xaa41('0x45')](_0x2fe50f[_0xaa41('0x3b')],[_0xaa41('0x70'),'id'])||{})[_0xaa41('0x86')](function(_0x1d7c2e){for(var _0xdc0493=0x0;_0xdc0493<_0x2fe50f[_0xaa41('0x3b')]['ids'][_0xaa41('0x37')];_0xdc0493+=0x1){socket[_0xaa41('0x6f')]('userVoiceQueue:save',{'UserId':Number(_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x70')][_0xdc0493]),'VoiceQueueId':Number(_0x2fe50f[_0xaa41('0x30')]['id'])});}return _0x1d7c2e;});}})[_0xaa41('0x17')](function(_0x2af16e){_0x50122d=_0x2af16e||[];if(_0x1d609e){return db[_0xaa41('0x5c')]['findAll']({'where':{'id':_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x70')]},'attributes':['id',_0xaa41('0x21'),_0xaa41('0x5e'),_0xaa41('0x5f'),_0xaa41('0x60')],'raw':!![]});}})[_0xaa41('0x17')](function(_0x5083ff){if(!_[_0xaa41('0x83')](_0x5083ff)){var _0x3c4e89=[];for(var _0x415acc=0x0;_0x415acc<_0x5083ff['length'];_0x415acc++){if(_0x5083ff[_0x415acc]['online']){_0x3c4e89['push'](db[_0xaa41('0x6b')][_0xaa41('0x68')]({'membername':_0x5083ff[_0x415acc][_0xaa41('0x21')],'UserId':_0x5083ff[_0x415acc]['id'],'queue_name':_0x1d609e[_0xaa41('0x21')],'VoiceQueueId':_0x1d609e['id'],'interface':_[_0xaa41('0x6c')](_0x5083ff[_0x415acc]['interface'])?util[_0xaa41('0x6d')](_0xaa41('0x6e'),_0x5083ff[_0x415acc][_0xaa41('0x21')]):_0x5083ff[_0x415acc][_0xaa41('0x60')],'paused':_0x5083ff[_0x415acc][_0xaa41('0x5f')]||![],'penalty':_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x62')]||0x0}));}}return BPromise['all'](_0x3c4e89);}})[_0xaa41('0x17')](function(){return _0x50122d;})[_0xaa41('0x17')](respondWithResult(_0x520b50,null))[_0xaa41('0x2f')](handleError(_0x520b50,null));};exports['removeAgents']=function(_0x16a173,_0x53a519){return db['VoiceQueue'][_0xaa41('0x20')]({'where':{'id':_0x16a173['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x53a519,null))[_0xaa41('0x17')](function(_0x366705){if(_0x366705){return _0x366705[_0xaa41('0x84')](_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')])[_0xaa41('0x17')](function(){if(_['isArray'](_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')])){for(var _0x3ee9e3=0x0;_0x3ee9e3<_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')][_0xaa41('0x37')];_0x3ee9e3+=0x1){socket[_0xaa41('0x6f')](_0xaa41('0x87'),{'UserId':Number(_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')][_0x3ee9e3]),'VoiceQueueId':Number(_0x16a173[_0xaa41('0x30')]['id'])});}}else{socket[_0xaa41('0x6f')](_0xaa41('0x87'),{'UserId':Number(_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')]),'VoiceQueueId':Number(_0x16a173[_0xaa41('0x30')]['id'])});}});}})['then'](function(_0x29b27e){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x16a173['params']['id'],'UserId':_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')]}})['then'](function(){return _0x29b27e;});})[_0xaa41('0x17')](respondWithStatusCode(_0x53a519,null))[_0xaa41('0x2f')](handleError(_0x53a519,null));};exports[_0xaa41('0x88')]=function(_0x15bb60,_0x232732){var _0x34d857={};var _0x239f1b={};var _0x445925;var _0x1e8591;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0x15bb60[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x232732,null))[_0xaa41('0x17')](function(_0x7bae82){if(_0x7bae82){_0x445925=_0x7bae82;_0x239f1b[_0xaa41('0x31')]=_[_0xaa41('0x33')](db['User'][_0xaa41('0x28')]);_0x239f1b[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x15bb60[_0xaa41('0x32')]);_0x239f1b['filters']=_[_0xaa41('0x35')](_0x239f1b[_0xaa41('0x31')],_0x239f1b['query']);_0x34d857[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x239f1b[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x15bb60[_0xaa41('0x32')][_0xaa41('0x36')]));_0x34d857[_0xaa41('0x34')]=_0x34d857[_0xaa41('0x34')][_0xaa41('0x37')]?_0x34d857[_0xaa41('0x34')]:_0x239f1b['model'];_0x34d857[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x15bb60[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x34d857[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_['pick'](_0x15bb60[_0xaa41('0x32')],_0x239f1b['filters']));if(_0x15bb60[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x34d857[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x34d857[_0xaa41('0x2a')],{'$or':_['map'](_0x34d857[_0xaa41('0x34')],function(_0x345002){var _0x5f39b4={};_0x5f39b4[_0x345002]={'$like':'%'+_0x15bb60[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x5f39b4;})});}_0x34d857=_[_0xaa41('0x38')]({},_0x34d857,_0x15bb60[_0xaa41('0x39')]);return _0x445925[_0xaa41('0x88')](_0x34d857);}})[_0xaa41('0x17')](function(_0x38b3be){if(_0x38b3be){_0x1e8591=_0x38b3be[_0xaa41('0x37')];if(!_0x15bb60[_0xaa41('0x32')][_0xaa41('0x53')]('nolimit')){_0x34d857[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x15bb60[_0xaa41('0x32')]['limit']);_0x34d857['offset']=qs[_0xaa41('0x14')](_0x15bb60['query']['offset']);}return _0x445925[_0xaa41('0x88')](_0x34d857);}})[_0xaa41('0x17')](function(_0xa4dbd3){if(_0xa4dbd3){return _0xa4dbd3?{'count':_0x1e8591,'rows':_0xa4dbd3}:null;}})[_0xaa41('0x17')](respondWithResult(_0x232732,null))['catch'](handleError(_0x232732,null));};exports['getMembers']=function(_0xa63e60,_0xf4f13f){var _0xef0e44={};var _0x46d37f={};var _0x6a6081;var _0x5e3bb2;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0xa63e60['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0xf4f13f,null))[_0xaa41('0x17')](function(_0x4b4a4a){if(_0x4b4a4a){_0x6a6081=_0x4b4a4a;_0x46d37f[_0xaa41('0x31')]=_[_0xaa41('0x33')](db['UserVoiceQueueRt'][_0xaa41('0x28')]);_0x46d37f[_0xaa41('0x32')]=_['keys'](_0xa63e60[_0xaa41('0x32')]);_0x46d37f['filters']=_['intersection'](_0x46d37f[_0xaa41('0x31')],_0x46d37f[_0xaa41('0x32')]);_0xef0e44[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x46d37f[_0xaa41('0x31')],qs['fields'](_0xa63e60[_0xaa41('0x32')]['fields']));_0xef0e44['attributes']=_0xef0e44[_0xaa41('0x34')][_0xaa41('0x37')]?_0xef0e44[_0xaa41('0x34')]:_0x46d37f[_0xaa41('0x31')];_0xef0e44[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xa63e60[_0xaa41('0x32')]['sort']);_0xef0e44[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xa63e60[_0xaa41('0x32')],_0x46d37f[_0xaa41('0x4b')]));if(_0xa63e60[_0xaa41('0x32')][_0xaa41('0x1b')]){_0xef0e44[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0xef0e44[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0xef0e44[_0xaa41('0x34')],function(_0x5a2ba0){var _0x4fc7d6={};_0x4fc7d6[_0x5a2ba0]={'$like':'%'+_0xa63e60[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x4fc7d6;})});}_0xef0e44=_[_0xaa41('0x38')]({},_0xef0e44,_0xa63e60['options']);return _0x6a6081[_0xaa41('0x89')](_0xef0e44);}})[_0xaa41('0x17')](function(_0x15bc15){if(_0x15bc15){_0x5e3bb2=_0x15bc15[_0xaa41('0x37')];if(!_0xa63e60[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0xef0e44[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0xa63e60[_0xaa41('0x32')][_0xaa41('0x12')]);_0xef0e44[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0xa63e60[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x6a6081['getMembers'](_0xef0e44);}})[_0xaa41('0x17')](function(_0x28c109){return _0x28c109?{'count':_0x5e3bb2,'rows':_0x28c109}:null;})[_0xaa41('0x17')](respondWithResult(_0xf4f13f,null))['catch'](handleError(_0xf4f13f,null));};exports[_0xaa41('0x8a')]=function(_0xfc1e24,_0x35c48f){var _0x2b0bf9={};var _0x21c0c6={};var _0x1138d0;var _0x394987;return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0xfc1e24[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x35c48f,null))[_0xaa41('0x17')](function(_0x2fc4b1){if(_0x2fc4b1){_0x1138d0=_0x2fc4b1;_0x21c0c6[_0xaa41('0x31')]=_['keys'](db[_0xaa41('0x8b')]['rawAttributes']);_0x21c0c6[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0xfc1e24[_0xaa41('0x32')]);_0x21c0c6[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x21c0c6[_0xaa41('0x31')],_0x21c0c6[_0xaa41('0x32')]);_0x2b0bf9[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x21c0c6[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0xfc1e24[_0xaa41('0x32')]['fields']));_0x2b0bf9['attributes']=_0x2b0bf9[_0xaa41('0x34')][_0xaa41('0x37')]?_0x2b0bf9[_0xaa41('0x34')]:_0x21c0c6[_0xaa41('0x31')];_0x2b0bf9[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xfc1e24['query'][_0xaa41('0x4e')]);_0x2b0bf9['where']=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xfc1e24[_0xaa41('0x32')],_0x21c0c6[_0xaa41('0x4b')]));if(_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x2b0bf9['where']=_['merge'](_0x2b0bf9[_0xaa41('0x2a')],{'$or':_['map'](_0x2b0bf9[_0xaa41('0x34')],function(_0x3f8296){var _0x438fcf={};_0x438fcf[_0x3f8296]={'$like':'%'+_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x438fcf;})});}_0x2b0bf9=_[_0xaa41('0x38')]({},_0x2b0bf9,_0xfc1e24[_0xaa41('0x39')]);return _0x1138d0[_0xaa41('0x8a')](_0x2b0bf9);}})[_0xaa41('0x17')](function(_0x2667bd){if(_0x2667bd){_0x394987=_0x2667bd[_0xaa41('0x37')];if(!_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x2b0bf9['limit']=qs[_0xaa41('0x12')](_0xfc1e24['query'][_0xaa41('0x12')]);_0x2b0bf9['offset']=qs[_0xaa41('0x14')](_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x1138d0[_0xaa41('0x8a')](_0x2b0bf9);}})[_0xaa41('0x17')](function(_0x3dafc6){if(_0x3dafc6){return _0x3dafc6?{'count':_0x394987,'rows':_0x3dafc6}:null;}})[_0xaa41('0x17')](respondWithResult(_0x35c48f,null))['catch'](handleError(_0x35c48f,null));};exports[_0xaa41('0x8c')]=function(_0x533f4b,_0x47ca9d){var _0xd1f9ba=moment()[_0xaa41('0x6d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2c4930,_0x1285ed;return db['VoiceQueue'][_0xaa41('0x20')]({'where':{'id':_0x533f4b[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x47ca9d,null))['then'](function(_0x3ecde6){if(_0x3ecde6){_0x1285ed=_0x3ecde6;return _0x3ecde6['addLists'](_0x533f4b[_0xaa41('0x3b')][_0xaa41('0x70')],_[_0xaa41('0x45')](_0x533f4b[_0xaa41('0x3b')],['ids','id'])||{});}return null;})[_0xaa41('0x86')](function(_0x32a07e){var _0x2b8b73;_0x2c4930=_0x32a07e||[];var _0x49e4a5=[];if(_0x32a07e){for(var _0xda8e73=0x0;_0xda8e73<_0x32a07e[_0xaa41('0x37')];_0xda8e73+=0x1){var _0x25f5ba=_0x32a07e[_0xda8e73][_0xaa41('0x18')]({'plain':!![]});_0x1285ed[_0xaa41('0x8d')]=_0x533f4b[_0xaa41('0x3b')][_0xaa41('0x8d')]?_0x533f4b[_0xaa41('0x3b')]['dialCheckDuplicateType']:_0x1285ed[_0xaa41('0x8d')];switch(_0x1285ed['dialCheckDuplicateType']){case _0xaa41('0x8e'):_0x2b8b73=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')](_0xaa41('0x91'))[_0xaa41('0x92')]([_0xaa41('0x93'),_0xaa41('0x94'),_0xaa41('0x95'),_0xaa41('0x96'),_0xaa41('0x50'),_0xaa41('0x46'),_0xaa41('0x47')],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')](),'ListId')[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))['where']('deletedAt\x20IS\x20NULL')['where'](_0xaa41('0x9a'),_0x25f5ba[_0xaa41('0x98')]['toString']())[_0xaa41('0x2a')](_0xaa41('0x9b'))['where'](_0xaa41('0x9c'),squel['select']()[_0xaa41('0x71')](_0xaa41('0x9d'))[_0xaa41('0x73')](_0xaa41('0x9e'))[_0xaa41('0x2a')]('VoiceQueueId\x20=\x20?',_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')]()))[_0xaa41('0x2a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xaa41('0x71')](_0xaa41('0x9f'))['from'](_0xaa41('0x91'))[_0xaa41('0x2a')](_0xaa41('0x77'),_0x533f4b['params']['id'][_0xaa41('0x7a')]())))[_0xaa41('0x7a')]();break;case _0xaa41('0xa0'):_0x2b8b73=squel['insert']()[_0xaa41('0x90')](_0xaa41('0x91'))['fromQuery'](['phone',_0xaa41('0x94'),_0xaa41('0x95'),_0xaa41('0x96'),_0xaa41('0x50'),'createdAt',_0xaa41('0x47')],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))['field']('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')](),_0xaa41('0x96'))[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27','createdAt')[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))[_0xaa41('0x2a')]('deletedAt\x20IS\x20NULL')[_0xaa41('0x2a')]('ListId\x20=\x20?',_0x25f5ba[_0xaa41('0x98')]['toString']())['where'](_0xaa41('0x9b'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xaa41('0x97')]()[_0xaa41('0x71')](_0xaa41('0x9f'))[_0xaa41('0x73')](_0xaa41('0x91'))[_0xaa41('0x2a')]('VoiceQueueId\x20=\x20?',_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')]())))[_0xaa41('0x7a')]();break;default:_0x2b8b73=squel['insert']()[_0xaa41('0x90')]('cm_hopper')[_0xaa41('0x92')]([_0xaa41('0x93'),_0xaa41('0x94'),_0xaa41('0x95'),'ListId','VoiceQueueId',_0xaa41('0x46'),_0xaa41('0x47')],squel['select']()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')]['toString'](),_0xaa41('0x96'))[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))['field']('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))['field']('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))['from'](_0xaa41('0x99'))[_0xaa41('0x2a')](_0xaa41('0xa1'))['where'](_0xaa41('0x9a'),_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')]())[_0xaa41('0x2a')](_0xaa41('0x9b')))[_0xaa41('0x7a')]();}_0x49e4a5[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x2b8b73));}return BPromise[_0xaa41('0x7f')](_0x49e4a5);}})['then'](function(){var _0x58f009=[];var _0x405eba=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')]('cm_hopper_additional_phones')[_0xaa41('0x92')]([_0xaa41('0xa2'),_0xaa41('0x93'),_0xaa41('0xa3'),_0xaa41('0x46'),_0xaa41('0x47')],squel['select']()[_0xaa41('0x71')](_0xaa41('0xa4'))[_0xaa41('0x71')](_0xaa41('0xa5'))['field'](_0xaa41('0xa6'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))['field']('\x27'+_0xd1f9ba+'\x27','updatedAt')[_0xaa41('0x73')](_0xaa41('0xa7'),'ci')[_0xaa41('0x74')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0xaa41('0x2a')](_0xaa41('0xa8'),_0xd1f9ba)[_0xaa41('0x2a')](_0xaa41('0xa9'),_0xaa41('0xaa')))[_0xaa41('0x7a')]();_0x58f009['push'](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x405eba));return BPromise[_0xaa41('0x7f')](_0x58f009);})[_0xaa41('0x17')](function(){return _0x2c4930;})[_0xaa41('0x17')](respondWithResult(_0x47ca9d,null))[_0xaa41('0x2f')](handleError(_0x47ca9d,null));};exports[_0xaa41('0xab')]=function(_0x718a84,_0x151c5f){return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x718a84['params']['id']}})['then'](handleEntityNotFound(_0x151c5f,null))[_0xaa41('0x17')](function(_0x293a1d){if(_0x293a1d){return _0x293a1d['removeLists'](_0x718a84[_0xaa41('0x32')][_0xaa41('0x70')]);}})['then'](function(_0x490a6c){if(_0x490a6c){return db[_0xaa41('0x4a')][_0xaa41('0x23')]({'where':{'ListId':_0x718a84[_0xaa41('0x32')]['ids'],'VoiceQueueId':_0x718a84[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(){return _0x490a6c;});}})['then'](respondWithStatusCode(_0x151c5f,null))[_0xaa41('0x2f')](handleError(_0x151c5f,null));};exports[_0xaa41('0xac')]=function(_0x536cdb,_0x431b75){var _0x18499f={};var _0x49cbd7={};var _0x515f91;var _0x4b5953;return db['VoiceQueue'][_0xaa41('0x55')]({'where':{'id':_0x536cdb[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x431b75,null))[_0xaa41('0x17')](function(_0x4ca8f7){if(_0x4ca8f7){_0x515f91=_0x4ca8f7;_0x49cbd7['model']=_[_0xaa41('0x33')](db['CmList'][_0xaa41('0x28')]);_0x49cbd7[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x536cdb[_0xaa41('0x32')]);_0x49cbd7['filters']=_[_0xaa41('0x35')](_0x49cbd7[_0xaa41('0x31')],_0x49cbd7[_0xaa41('0x32')]);_0x18499f[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x49cbd7[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x536cdb[_0xaa41('0x32')]['fields']));_0x18499f['attributes']=_0x18499f[_0xaa41('0x34')][_0xaa41('0x37')]?_0x18499f[_0xaa41('0x34')]:_0x49cbd7[_0xaa41('0x31')];_0x18499f[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x536cdb[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x18499f[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x536cdb[_0xaa41('0x32')],_0x49cbd7[_0xaa41('0x4b')]));if(_0x536cdb['query'][_0xaa41('0x1b')]){_0x18499f[_0xaa41('0x2a')]=_['merge'](_0x18499f[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x18499f[_0xaa41('0x34')],function(_0x5cd79d){var _0x558583={};_0x558583[_0x5cd79d]={'$like':'%'+_0x536cdb[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x558583;})});}_0x18499f=_['merge']({},_0x18499f,_0x536cdb['options']);return _0x515f91[_0xaa41('0xac')](_0x18499f);}})[_0xaa41('0x17')](function(_0x117841){if(_0x117841){_0x4b5953=_0x117841[_0xaa41('0x37')];if(!_0x536cdb[_0xaa41('0x32')]['hasOwnProperty'](_0xaa41('0x4c'))){_0x18499f[_0xaa41('0x12')]=qs['limit'](_0x536cdb['query'][_0xaa41('0x12')]);_0x18499f[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x536cdb[_0xaa41('0x32')]['offset']);}return _0x515f91[_0xaa41('0xac')](_0x18499f);}})[_0xaa41('0x17')](function(_0x1be3c1){if(_0x1be3c1){return _0x1be3c1?{'count':_0x4b5953,'rows':_0x1be3c1}:null;}})[_0xaa41('0x17')](respondWithResult(_0x431b75,null))[_0xaa41('0x2f')](handleError(_0x431b75,null));};exports[_0xaa41('0xad')]=function(_0x42ae0c,_0x4fa4ca){var _0x1e41b5;return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x42ae0c[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x4fa4ca,null))[_0xaa41('0x17')](function(_0x135f31){if(_0x135f31){return _0x135f31[_0xaa41('0xad')](_0x42ae0c[_0xaa41('0x3b')][_0xaa41('0x70')],_[_0xaa41('0x45')](_0x42ae0c['body'],[_0xaa41('0x70'),'id'])||{});}return null;})['spread'](function(_0x5eac30){var _0x3e28b7;_0x1e41b5=_0x5eac30||[];var _0x1ac854=[];if(_0x5eac30){for(var _0x187bf9=0x0;_0x187bf9<_0x5eac30['length'];_0x187bf9+=0x1){var _0x50fa22=_0x5eac30[_0x187bf9][_0xaa41('0x18')]({'plain':!![]});_0x3e28b7=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')](_0xaa41('0xae'))['fromQuery']([_0xaa41('0x93'),'ContactId',_0xaa41('0x96'),_0xaa41('0x50'),_0xaa41('0x46'),'updatedAt'],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x50fa22['CmListId'][_0xaa41('0x7a')](),'ListId')['field'](_0x42ae0c['params']['id'][_0xaa41('0x7a')](),'VoiceQueueId')[_0xaa41('0x71')]('NOW()','createdAt')[_0xaa41('0x71')](_0xaa41('0xaf'),_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))[_0xaa41('0x2a')](_0xaa41('0xa1'))[_0xaa41('0x2a')](_0xaa41('0x9a'),_0x50fa22['CmListId'][_0xaa41('0x7a')]())[_0xaa41('0x2a')](_0xaa41('0x9b')))['toString']();_0x1ac854[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x3e28b7));}return BPromise['all'](_0x1ac854);}})[_0xaa41('0x17')](function(){return _0x1e41b5;})[_0xaa41('0x17')](respondWithResult(_0x4fa4ca,null))['catch'](handleError(_0x4fa4ca,null));};exports[_0xaa41('0xb0')]=function(_0x2edb93,_0x4e34c2){return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x2edb93[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x4e34c2,null))[_0xaa41('0x17')](function(_0x17b359){if(_0x17b359){return _0x17b359['removeBlackLists'](_0x2edb93['query']['ids']);}})['then'](function(_0x5b820b){if(_0x5b820b){return db[_0xaa41('0x58')][_0xaa41('0x23')]({'where':{'ListId':_0x2edb93[_0xaa41('0x32')][_0xaa41('0x70')],'VoiceQueueId':_0x2edb93[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(){return _0x5b820b;});}})[_0xaa41('0x17')](respondWithStatusCode(_0x4e34c2,null))[_0xaa41('0x2f')](handleError(_0x4e34c2,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 67cac8c..14cb2d8 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 _0xd2ef=['remove','exports','events','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xd2ef,0x1dc));var _0xfd2e=function(_0x16259b,_0x2e0bd8){_0x16259b=_0x16259b-0x0;var _0xfd3bd7=_0xd2ef[_0x16259b];return _0xfd3bd7;};'use strict';var EventEmitter=require(_0xfd2e('0x0'));var VoiceQueue=require(_0xfd2e('0x1'))['db'][_0xfd2e('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xfd2e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfd2e('0x4')};function emitEvent(_0xc5a30e){return function(_0x4f9ef7,_0x5bae59,_0x373efa){VoiceQueueEvents['emit'](_0xc5a30e+':'+_0x4f9ef7['id'],_0x4f9ef7);VoiceQueueEvents['emit'](_0xc5a30e,_0x4f9ef7);_0x373efa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xfd2e('0x5')]=VoiceQueueEvents; \ No newline at end of file +var _0x63d4=['VoiceQueue','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x566718,_0x1c5001){var _0x5e6f4a=function(_0x4bb980){while(--_0x4bb980){_0x566718['push'](_0x566718['shift']());}};_0x5e6f4a(++_0x1c5001);}(_0x63d4,0x1ae));var _0x463d=function(_0xca914e,_0x191268){_0xca914e=_0xca914e-0x0;var _0x3b8451=_0x63d4[_0xca914e];return _0x3b8451;};'use strict';var EventEmitter=require(_0x463d('0x0'));var VoiceQueue=require(_0x463d('0x1'))['db'][_0x463d('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x463d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x463d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x119228){return function(_0x33ee1d,_0x2a4973,_0x328646){VoiceQueueEvents[_0x463d('0x5')](_0x119228+':'+_0x33ee1d['id'],_0x33ee1d);VoiceQueueEvents[_0x463d('0x5')](_0x119228,_0x33ee1d);_0x328646(null);};}for(var e in events){if(events[_0x463d('0x6')](e)){var event=events[e];VoiceQueue[_0x463d('0x7')](e,emitEvent(event));}}module[_0x463d('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 0de22cb..526b723 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x5bd6b0,_0x52b637){var _0x13612b=function(_0x168040){while(--_0x168040){_0x5bd6b0['push'](_0x5bd6b0['shift']());}};_0x13612b(++_0x52b637);}(_0x34e8,0x12c));var _0x834e=function(_0x2b94d4,_0x13cc06){_0x2b94d4=_0x2b94d4-0x0;var _0x11ffbd=_0x34e8[_0x2b94d4];return _0x11ffbd;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0x3e74,0x175));var _0x43e7=function(_0x420912,_0x1a51b6){_0x420912=_0x420912-0x0;var _0x4e23e5=_0x3e74[_0x420912];return _0x4e23e5;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 52396f3..a511912 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 _0x0c4d=['lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','limit','include','map','model','attributes','debug','find','where','ShowVoiceQueue'];(function(_0x3137e9,_0x4a3265){var _0x16c571=function(_0x39bfec){while(--_0x39bfec){_0x3137e9['push'](_0x3137e9['shift']());}};_0x16c571(++_0x4a3265);}(_0x0c4d,0x1c8));var _0xd0c4=function(_0x174ad9,_0x57134b){_0x174ad9=_0x174ad9-0x0;var _0x3243e7=_0x0c4d[_0x174ad9];return _0x3243e7;};'use strict';var _=require(_0xd0c4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd0c4('0x1'));var rs=require(_0xd0c4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd0c4('0x3'))['db'];var utils=require(_0xd0c4('0x4'));var logger=require('../../config/logger')(_0xd0c4('0x5'));var config=require(_0xd0c4('0x6'));var jayson=require(_0xd0c4('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xd0c4('0x8')]=_[_0xd0c4('0x9')](config['redis'],{'host':_0xd0c4('0xa'),'port':0x18eb});var socket=require(_0xd0c4('0xb'))(new Redis(config[_0xd0c4('0x8')]));require(_0xd0c4('0xc'))['register'](socket);function respondWithRpcPromise(_0x4fdde4,_0x16910b,_0x1fbf49){return new BPromise(function(_0x4b6527,_0x2d591a){return client[_0xd0c4('0xd')](_0x4fdde4,_0x1fbf49)[_0xd0c4('0xe')](function(_0x369c25){logger[_0xd0c4('0xf')](_0xd0c4('0x10'),_0x16910b,'request\x20sent');logger['debug'](_0xd0c4('0x11'),_0x16910b,_0xd0c4('0x12'),JSON[_0xd0c4('0x13')](_0x369c25));if(_0x369c25['error']){if(_0x369c25[_0xd0c4('0x14')]['code']===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x16910b,_0x369c25['error'][_0xd0c4('0x15')]);return _0x2d591a(_0x369c25[_0xd0c4('0x14')][_0xd0c4('0x15')]);}logger['error'](_0xd0c4('0x10'),_0x16910b,_0x369c25[_0xd0c4('0x14')][_0xd0c4('0x15')]);return _0x4b6527(_0x369c25['error'][_0xd0c4('0x15')]);}else{logger['info'](_0xd0c4('0x10'),_0x16910b,_0xd0c4('0x12'));_0x4b6527(_0x369c25[_0xd0c4('0x16')][_0xd0c4('0x15')]);}})[_0xd0c4('0x17')](function(_0x5d111c){logger[_0xd0c4('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x16910b,_0x5d111c);_0x2d591a(_0x5d111c);});});}exports[_0xd0c4('0x18')]=function(_0x372d4c){var _0x4e2517=this;return new Promise(function(_0x2c5a0d,_0x4d4896){return db[_0xd0c4('0x19')][_0xd0c4('0x1a')]({'raw':_0x372d4c[_0xd0c4('0x1b')]?_0x372d4c['options'][_0xd0c4('0x1c')]===undefined?!![]:![]:!![],'where':_0x372d4c['options']?_0x372d4c['options']['where']||null:null,'attributes':_0x372d4c[_0xd0c4('0x1b')]?_0x372d4c[_0xd0c4('0x1b')]['attributes']||null:null,'limit':_0x372d4c[_0xd0c4('0x1b')]?_0x372d4c[_0xd0c4('0x1b')][_0xd0c4('0x1d')]||null:null,'include':_0x372d4c[_0xd0c4('0x1b')]?_0x372d4c[_0xd0c4('0x1b')][_0xd0c4('0x1e')]?_[_0xd0c4('0x1f')](_0x372d4c['options'][_0xd0c4('0x1e')],function(_0x5a9914){return{'model':db[_0x5a9914[_0xd0c4('0x20')]],'as':_0x5a9914['as'],'attributes':_0x5a9914[_0xd0c4('0x21')],'include':_0x5a9914['include']?_[_0xd0c4('0x1f')](_0x5a9914[_0xd0c4('0x1e')],function(_0x27fbfa){return{'model':db[_0x27fbfa['model']],'as':_0x27fbfa['as'],'attributes':_0x27fbfa[_0xd0c4('0x21')],'include':_0x27fbfa[_0xd0c4('0x1e')]?_[_0xd0c4('0x1f')](_0x27fbfa[_0xd0c4('0x1e')],function(_0x1828b3){return{'model':db[_0x1828b3[_0xd0c4('0x20')]],'as':_0x1828b3['as'],'attributes':_0x1828b3[_0xd0c4('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd0c4('0xe')](function(_0x20ac3b){logger[_0xd0c4('0xf')](_0xd0c4('0x18'),_0x372d4c);logger[_0xd0c4('0x22')](_0xd0c4('0x18'),_0x372d4c,JSON[_0xd0c4('0x13')](_0x20ac3b));_0x2c5a0d(_0x20ac3b);})[_0xd0c4('0x17')](function(_0x577fd8){logger[_0xd0c4('0x14')](_0xd0c4('0x18'),_0x577fd8['message'],_0x372d4c);_0x4d4896(_0x4e2517[_0xd0c4('0x14')](0x1f4,_0x577fd8[_0xd0c4('0x15')]));});});};exports['ShowVoiceQueue']=function(_0x5203ef){var _0x383057=this;return new Promise(function(_0x301f16,_0x18fd47){return db[_0xd0c4('0x19')][_0xd0c4('0x23')]({'raw':_0x5203ef['options']?_0x5203ef[_0xd0c4('0x1b')][_0xd0c4('0x1c')]===undefined?!![]:![]:!![],'where':_0x5203ef[_0xd0c4('0x1b')]?_0x5203ef[_0xd0c4('0x1b')][_0xd0c4('0x24')]||null:null,'attributes':_0x5203ef[_0xd0c4('0x1b')]?_0x5203ef[_0xd0c4('0x1b')][_0xd0c4('0x21')]||null:null,'include':_0x5203ef['options']?_0x5203ef[_0xd0c4('0x1b')][_0xd0c4('0x1e')]?_['map'](_0x5203ef[_0xd0c4('0x1b')][_0xd0c4('0x1e')],function(_0x2a7651){return{'model':db[_0x2a7651[_0xd0c4('0x20')]],'as':_0x2a7651['as'],'attributes':_0x2a7651[_0xd0c4('0x21')],'include':_0x2a7651[_0xd0c4('0x1e')]?_[_0xd0c4('0x1f')](_0x2a7651[_0xd0c4('0x1e')],function(_0x55f7b4){return{'model':db[_0x55f7b4[_0xd0c4('0x20')]],'as':_0x55f7b4['as'],'attributes':_0x55f7b4[_0xd0c4('0x21')],'include':_0x55f7b4[_0xd0c4('0x1e')]?_[_0xd0c4('0x1f')](_0x55f7b4[_0xd0c4('0x1e')],function(_0x92671a){return{'model':db[_0x92671a[_0xd0c4('0x20')]],'as':_0x92671a['as'],'attributes':_0x92671a[_0xd0c4('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dfde3){logger[_0xd0c4('0xf')](_0xd0c4('0x25'),_0x5203ef);logger['debug']('ShowVoiceQueue',_0x5203ef,JSON[_0xd0c4('0x13')](_0x3dfde3));_0x301f16(_0x3dfde3);})['catch'](function(_0x516c6a){logger['error'](_0xd0c4('0x25'),_0x516c6a[_0xd0c4('0x15')],_0x5203ef);_0x18fd47(_0x383057[_0xd0c4('0x14')](0x1f4,_0x516c6a[_0xd0c4('0x15')]));});});}; \ No newline at end of file +var _0x430f=['catch','GetVoiceQueue','VoiceQueue','options','raw','attributes','limit','map','include','model','ShowVoiceQueue','find','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x10b79b,_0x5be18d){var _0x2dd7ef=function(_0x339c3e){while(--_0x339c3e){_0x10b79b['push'](_0x10b79b['shift']());}};_0x2dd7ef(++_0x5be18d);}(_0x430f,0xa9));var _0xf430=function(_0x24a335,_0x3acdf1){_0x24a335=_0x24a335-0x0;var _0x52c004=_0x430f[_0x24a335];return _0x52c004;};'use strict';var _=require(_0xf430('0x0'));var util=require(_0xf430('0x1'));var moment=require('moment');var BPromise=require(_0xf430('0x2'));var rs=require(_0xf430('0x3'));var fs=require('fs');var Redis=require(_0xf430('0x4'));var db=require(_0xf430('0x5'))['db'];var utils=require(_0xf430('0x6'));var logger=require('../../config/logger')(_0xf430('0x7'));var config=require(_0xf430('0x8'));var jayson=require(_0xf430('0x9'));var client=jayson['client'][_0xf430('0xa')]({'port':0x232a});config[_0xf430('0xb')]=_[_0xf430('0xc')](config[_0xf430('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf430('0xd'))(new Redis(config[_0xf430('0xb')]));require(_0xf430('0xe'))[_0xf430('0xf')](socket);function respondWithRpcPromise(_0x348786,_0x231c40,_0x50e528){return new BPromise(function(_0x22d467,_0x5473a4){return client[_0xf430('0x10')](_0x348786,_0x50e528)['then'](function(_0x473245){logger[_0xf430('0x11')](_0xf430('0x12'),_0x231c40,_0xf430('0x13'));logger[_0xf430('0x14')](_0xf430('0x15'),_0x231c40,_0xf430('0x13'),JSON[_0xf430('0x16')](_0x473245));if(_0x473245[_0xf430('0x17')]){if(_0x473245[_0xf430('0x17')]['code']===0x1f4){logger[_0xf430('0x17')](_0xf430('0x12'),_0x231c40,_0x473245['error'][_0xf430('0x18')]);return _0x5473a4(_0x473245[_0xf430('0x17')][_0xf430('0x18')]);}logger['error'](_0xf430('0x12'),_0x231c40,_0x473245[_0xf430('0x17')][_0xf430('0x18')]);return _0x22d467(_0x473245['error'][_0xf430('0x18')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x231c40,_0xf430('0x13'));_0x22d467(_0x473245[_0xf430('0x19')]['message']);}})[_0xf430('0x1a')](function(_0x47f9da){logger['error'](_0xf430('0x12'),_0x231c40,_0x47f9da);_0x5473a4(_0x47f9da);});});}exports[_0xf430('0x1b')]=function(_0x18c01e){var _0x944cb9=this;return new Promise(function(_0x2d5131,_0xe0d339){return db[_0xf430('0x1c')]['findAll']({'raw':_0x18c01e[_0xf430('0x1d')]?_0x18c01e[_0xf430('0x1d')][_0xf430('0x1e')]===undefined?!![]:![]:!![],'where':_0x18c01e[_0xf430('0x1d')]?_0x18c01e[_0xf430('0x1d')]['where']||null:null,'attributes':_0x18c01e['options']?_0x18c01e[_0xf430('0x1d')][_0xf430('0x1f')]||null:null,'limit':_0x18c01e['options']?_0x18c01e[_0xf430('0x1d')][_0xf430('0x20')]||null:null,'include':_0x18c01e[_0xf430('0x1d')]?_0x18c01e[_0xf430('0x1d')]['include']?_[_0xf430('0x21')](_0x18c01e['options'][_0xf430('0x22')],function(_0x56c3f9){return{'model':db[_0x56c3f9[_0xf430('0x23')]],'as':_0x56c3f9['as'],'attributes':_0x56c3f9['attributes'],'include':_0x56c3f9[_0xf430('0x22')]?_[_0xf430('0x21')](_0x56c3f9[_0xf430('0x22')],function(_0x2cb2ad){return{'model':db[_0x2cb2ad[_0xf430('0x23')]],'as':_0x2cb2ad['as'],'attributes':_0x2cb2ad[_0xf430('0x1f')],'include':_0x2cb2ad['include']?_[_0xf430('0x21')](_0x2cb2ad['include'],function(_0x24ca50){return{'model':db[_0x24ca50[_0xf430('0x23')]],'as':_0x24ca50['as'],'attributes':_0x24ca50[_0xf430('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d5522){logger['info'](_0xf430('0x1b'),_0x18c01e);logger[_0xf430('0x14')](_0xf430('0x1b'),_0x18c01e,JSON[_0xf430('0x16')](_0x3d5522));_0x2d5131(_0x3d5522);})[_0xf430('0x1a')](function(_0x11a3d1){logger[_0xf430('0x17')](_0xf430('0x1b'),_0x11a3d1['message'],_0x18c01e);_0xe0d339(_0x944cb9[_0xf430('0x17')](0x1f4,_0x11a3d1[_0xf430('0x18')]));});});};exports[_0xf430('0x24')]=function(_0x35446f){var _0x186e1c=this;return new Promise(function(_0x16b8f6,_0x12fdc2){return db[_0xf430('0x1c')][_0xf430('0x25')]({'raw':_0x35446f[_0xf430('0x1d')]?_0x35446f['options'][_0xf430('0x1e')]===undefined?!![]:![]:!![],'where':_0x35446f[_0xf430('0x1d')]?_0x35446f[_0xf430('0x1d')][_0xf430('0x26')]||null:null,'attributes':_0x35446f[_0xf430('0x1d')]?_0x35446f['options'][_0xf430('0x1f')]||null:null,'include':_0x35446f['options']?_0x35446f[_0xf430('0x1d')]['include']?_['map'](_0x35446f['options'][_0xf430('0x22')],function(_0x1f213f){return{'model':db[_0x1f213f[_0xf430('0x23')]],'as':_0x1f213f['as'],'attributes':_0x1f213f[_0xf430('0x1f')],'include':_0x1f213f[_0xf430('0x22')]?_[_0xf430('0x21')](_0x1f213f[_0xf430('0x22')],function(_0xdba61e){return{'model':db[_0xdba61e[_0xf430('0x23')]],'as':_0xdba61e['as'],'attributes':_0xdba61e[_0xf430('0x1f')],'include':_0xdba61e[_0xf430('0x22')]?_[_0xf430('0x21')](_0xdba61e[_0xf430('0x22')],function(_0x179b86){return{'model':db[_0x179b86[_0xf430('0x23')]],'as':_0x179b86['as'],'attributes':_0x179b86['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x107986){logger[_0xf430('0x11')](_0xf430('0x24'),_0x35446f);logger[_0xf430('0x14')]('ShowVoiceQueue',_0x35446f,JSON[_0xf430('0x16')](_0x107986));_0x16b8f6(_0x107986);})[_0xf430('0x1a')](function(_0x3ea05f){logger[_0xf430('0x17')]('ShowVoiceQueue',_0x3ea05f['message'],_0x35446f);_0x12fdc2(_0x186e1c[_0xf430('0x17')](0x1f4,_0x3ea05f[_0xf430('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 8e59533..a51d205 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 _0xde84=['length','voiceQueue:','./voiceQueue.events','save','update','emit','register'];(function(_0x1c33dc,_0x177c7e){var _0x405580=function(_0x556105){while(--_0x556105){_0x1c33dc['push'](_0x1c33dc['shift']());}};_0x405580(++_0x177c7e);}(_0xde84,0x121));var _0x4de8=function(_0x54fa04,_0x497107){_0x54fa04=_0x54fa04-0x0;var _0x1b2949=_0xde84[_0x54fa04];return _0x1b2949;};'use strict';var VoiceQueueEvents=require(_0x4de8('0x0'));var events=[_0x4de8('0x1'),'remove',_0x4de8('0x2')];function createListener(_0xafa6a4,_0x4781b1){return function(_0x49f2fd){_0x4781b1[_0x4de8('0x3')](_0xafa6a4,_0x49f2fd);};}function removeListener(_0x3fad63,_0x18f0e6){return function(){VoiceQueueEvents['removeListener'](_0x3fad63,_0x18f0e6);};}exports[_0x4de8('0x4')]=function(_0x382fbe){for(var _0x381ca1=0x0,_0x2fada1=events[_0x4de8('0x5')];_0x381ca1<_0x2fada1;_0x381ca1++){var _0x590389=events[_0x381ca1];var _0x5b7a09=createListener(_0x4de8('0x6')+_0x590389,_0x382fbe);VoiceQueueEvents['on'](_0x590389,_0x5b7a09);}}; \ No newline at end of file +var _0xbd6c=['register','length','voiceQueue:','./voiceQueue.events','save','remove','removeListener'];(function(_0x504a24,_0x234357){var _0x4a7215=function(_0x519415){while(--_0x519415){_0x504a24['push'](_0x504a24['shift']());}};_0x4a7215(++_0x234357);}(_0xbd6c,0x11b));var _0xcbd6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbd6c[_0x2dafbe];return _0x58a45a;};'use strict';var VoiceQueueEvents=require(_0xcbd6('0x0'));var events=[_0xcbd6('0x1'),_0xcbd6('0x2'),'update'];function createListener(_0x20b2bc,_0x13140b){return function(_0x183620){_0x13140b['emit'](_0x20b2bc,_0x183620);};}function removeListener(_0x3c25d2,_0x119140){return function(){VoiceQueueEvents[_0xcbd6('0x3')](_0x3c25d2,_0x119140);};}exports[_0xcbd6('0x4')]=function(_0x56e712){for(var _0x379a8d=0x0,_0x3032d0=events[_0xcbd6('0x5')];_0x379a8d<_0x3032d0;_0x379a8d++){var _0x4502cb=events[_0x379a8d];var _0x58da39=createListener(_0xcbd6('0x6')+_0x4502cb,_0x56e712);VoiceQueueEvents['on'](_0x4502cb,_0x58da39);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 603a284..e586851 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 _0x1947=['./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','/index','getVoiceQueuesReport','/:id','show','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x429b97,_0x19e26d){var _0x2f93fc=function(_0x5bfaa7){while(--_0x5bfaa7){_0x429b97['push'](_0x429b97['shift']());}};_0x2f93fc(++_0x19e26d);}(_0x1947,0x71));var _0x7194=function(_0x569b47,_0x43bf7a){_0x569b47=_0x569b47-0x0;var _0xa1bb99=_0x1947[_0x569b47];return _0xa1bb99;};'use strict';var multer=require('multer');var util=require(_0x7194('0x0'));var path=require(_0x7194('0x1'));var timeout=require('connect-timeout');var express=require(_0x7194('0x2'));var router=express[_0x7194('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7194('0x4'));var interaction=require(_0x7194('0x5'));var config=require(_0x7194('0x6'));var controller=require(_0x7194('0x7'));router[_0x7194('0x8')]('/',auth[_0x7194('0x9')](),controller['index']);router['get'](_0x7194('0xa'),auth[_0x7194('0x9')](),controller[_0x7194('0xb')]);router[_0x7194('0x8')](_0x7194('0xc'),auth[_0x7194('0x9')](),controller[_0x7194('0xd')]);router[_0x7194('0x8')](_0x7194('0xe'),auth['isAuthenticated'](),controller[_0x7194('0xf')]);router['post']('/',auth[_0x7194('0x9')](),controller['create']);router['put']('/:id',auth[_0x7194('0x9')](),controller[_0x7194('0x10')]);router[_0x7194('0x11')](_0x7194('0xe'),auth[_0x7194('0x9')](),controller[_0x7194('0x12')]);module[_0x7194('0x13')]=router; \ No newline at end of file +var _0xe549=['exports','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','show','create','put','/:id','update','delete'];(function(_0x399341,_0x583847){var _0x4bf489=function(_0x52006c){while(--_0x52006c){_0x399341['push'](_0x399341['shift']());}};_0x4bf489(++_0x583847);}(_0xe549,0x112));var _0x9e54=function(_0x305790,_0x437dbb){_0x305790=_0x305790-0x0;var _0x4e025d=_0xe549[_0x305790];return _0x4e025d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9e54('0x0'));var timeout=require(_0x9e54('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9e54('0x2'));var auth=require(_0x9e54('0x3'));var interaction=require(_0x9e54('0x4'));var config=require(_0x9e54('0x5'));var controller=require(_0x9e54('0x6'));router[_0x9e54('0x7')]('/',auth[_0x9e54('0x8')](),controller[_0x9e54('0x9')]);router[_0x9e54('0x7')](_0x9e54('0xa'),auth[_0x9e54('0x8')](),controller[_0x9e54('0xb')]);router[_0x9e54('0x7')](_0x9e54('0xc'),auth[_0x9e54('0x8')](),controller[_0x9e54('0xd')]);router[_0x9e54('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x9e54('0xe')]);router['post']('/',auth[_0x9e54('0x8')](),controller[_0x9e54('0xf')]);router[_0x9e54('0x10')](_0x9e54('0x11'),auth['isAuthenticated'](),controller[_0x9e54('0x12')]);router[_0x9e54('0x13')](_0x9e54('0x11'),auth[_0x9e54('0x8')](),controller['destroy']);module[_0x9e54('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 0dc20f2..9bd4308 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 _0x0120=['exports','STRING','DATE','getDataValue','format','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','moment'];(function(_0x4443dd,_0x3bc1ff){var _0x3e9a3e=function(_0x2d1a03){while(--_0x2d1a03){_0x4443dd['push'](_0x4443dd['shift']());}};_0x3e9a3e(++_0x3bc1ff);}(_0x0120,0x107));var _0x0012=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x0120[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0012('0x0'));module[_0x0012('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x0012('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0012('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x0012('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x0012('0x3')],'set':function(_0x1cfab1){var _0x369481=moment(_0x1cfab1);var _0x434723=moment(this[_0x0012('0x4')]('queuecallerjoinAt'))[_0x0012('0x5')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2203c6=_0x369481[_0x0012('0x6')](_0x434723,_0x0012('0x7'));this[_0x0012('0x8')]('queuecallerleaveAt',_0x1cfab1);this[_0x0012('0x8')](_0x0012('0x9'),_0x2203c6||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x0012('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x0012('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x0012('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x0012('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x0012('0x3')]},'queuecallerexit':{'type':Sequelize[_0x0012('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0012('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x0012('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x0012('0xa')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x0012('0x2')]},'exten':{'type':Sequelize[_0x0012('0x2')]},'priority':{'type':Sequelize[_0x0012('0x2')]},'holdtime':{'type':Sequelize[_0x0012('0xa')]},'mohtime':{'type':Sequelize[_0x0012('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0012('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0012('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x0012('0x2')]},'transferuniqueid':{'type':Sequelize[_0x0012('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0012('0x2')]},'thirdDisposition':{'type':Sequelize[_0x0012('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x0012('0xa')],'defaultValue':0x0},'note':{'type':Sequelize[_0x0012('0x2')]}}; \ No newline at end of file +var _0x3ea8=['holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','queuecallerjoinAt','format','seconds','setDataValue','queuecallerleaveAt'];(function(_0x4ac59e,_0x52724a){var _0x146e4c=function(_0x11ee8c){while(--_0x11ee8c){_0x4ac59e['push'](_0x4ac59e['shift']());}};_0x146e4c(++_0x52724a);}(_0x3ea8,0xf3));var _0x83ea=function(_0x23fac5,_0x385c26){_0x23fac5=_0x23fac5-0x0;var _0x16923d=_0x3ea8[_0x23fac5];return _0x16923d;};'use strict';var Sequelize=require(_0x83ea('0x0'));var moment=require(_0x83ea('0x1'));module['exports']={'type':{'type':Sequelize[_0x83ea('0x2')]},'uniqueid':{'type':Sequelize[_0x83ea('0x2')]},'calleridnum':{'type':Sequelize[_0x83ea('0x2')]},'calleridname':{'type':Sequelize[_0x83ea('0x2')]},'queue':{'type':Sequelize[_0x83ea('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x83ea('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x83ea('0x3')],'set':function(_0x4ae386){var _0x1a8725=moment(_0x4ae386);var _0xe06d0e=moment(this['getDataValue'](_0x83ea('0x4')))[_0x83ea('0x5')]('YYYY-MM-DD\x20HH:mm:ss');var _0x391f75=_0x1a8725['diff'](_0xe06d0e,_0x83ea('0x6'));this[_0x83ea('0x7')](_0x83ea('0x8'),_0x4ae386);this[_0x83ea('0x7')](_0x83ea('0x9'),_0x391f75||null);}},'position':{'type':Sequelize[_0x83ea('0xa')]},'count':{'type':Sequelize[_0x83ea('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x83ea('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x83ea('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x83ea('0x3')]},'queuecallerexit':{'type':Sequelize[_0x83ea('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x83ea('0x2')],'comment':_0x83ea('0xc')},'originalposition':{'type':Sequelize[_0x83ea('0xa')]},'channel':{'type':Sequelize[_0x83ea('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x83ea('0x2')]},'priority':{'type':Sequelize[_0x83ea('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x83ea('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x83ea('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x83ea('0x2')]},'transfer':{'type':Sequelize[_0x83ea('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x83ea('0x2')],'comment':_0x83ea('0xd')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x83ea('0x2')]},'disposition':{'type':Sequelize[_0x83ea('0x2')]},'secondDisposition':{'type':Sequelize[_0x83ea('0x2')]},'thirdDisposition':{'type':Sequelize[_0x83ea('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x83ea('0xa')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 53739bc..8fa55df 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 _0x90d6=['squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','then','destroy','sendStatus','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','getVoiceQueuesReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x1f28bb,_0x2754bf){var _0xda63c3=function(_0x484cf3){while(--_0x484cf3){_0x1f28bb['push'](_0x1f28bb['shift']());}};_0xda63c3(++_0x2754bf);}(_0x90d6,0x1e4));var _0x690d=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x90d6[_0x22f8ab];return _0x2a70e5;};'use strict';var emlformat=require(_0x690d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x690d('0x1'));var jsonpatch=require(_0x690d('0x2'));var rp=require(_0x690d('0x3'));var moment=require(_0x690d('0x4'));var BPromise=require(_0x690d('0x5'));var Mustache=require(_0x690d('0x6'));var util=require(_0x690d('0x7'));var path=require(_0x690d('0x8'));var sox=require(_0x690d('0x9'));var csv=require(_0x690d('0xa'));var ejs=require(_0x690d('0xb'));var fs=require('fs');var fs_extra=require(_0x690d('0xc'));var _=require(_0x690d('0xd'));var squel=require(_0x690d('0xe'));var crypto=require(_0x690d('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x690d('0x10'));var toCsv=require(_0x690d('0xa'));var querystring=require(_0x690d('0x11'));var Papa=require(_0x690d('0x12'));var Redis=require('ioredis');var authService=require(_0x690d('0x13'));var qs=require(_0x690d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x690d('0x15'));var logger=require('../../config/logger')(_0x690d('0x16'));var utils=require(_0x690d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x690d('0x18')]=_['defaults'](config['redis'],{'host':_0x690d('0x19'),'port':0x18eb});var socket=require(_0x690d('0x1a'))(new Redis(config['redis']));require(_0x690d('0x1b'))[_0x690d('0x1c')](socket);function respondWithStatusCode(_0x55c894,_0x1ffa97){_0x1ffa97=_0x1ffa97||0xcc;return function(_0x1cf967){if(_0x1cf967){return _0x55c894['sendStatus'](_0x1ffa97);}return _0x55c894[_0x690d('0x1d')](_0x1ffa97)[_0x690d('0x1e')]();};}function respondWithResult(_0x4c1e89,_0x4c6491){_0x4c6491=_0x4c6491||0xc8;return function(_0xe729a8){if(_0xe729a8){return _0x4c1e89[_0x690d('0x1d')](_0x4c6491)[_0x690d('0x1f')](_0xe729a8);}};}function respondWithFilteredResult(_0x3a9d2b,_0x51e57e){return function(_0x373e9f){if(_0x373e9f){var _0xe248f8=typeof _0x51e57e['offset']===_0x690d('0x20')&&typeof _0x51e57e['limit']===_0x690d('0x20');var _0xfa6e6d=_0x373e9f[_0x690d('0x21')];var _0x192ee8=_0xe248f8?0x0:_0x51e57e[_0x690d('0x22')];var _0x3a75e8=_0xe248f8?_0x373e9f[_0x690d('0x21')]:_0x51e57e[_0x690d('0x22')]+_0x51e57e[_0x690d('0x23')];var _0x206cd4;if(_0x3a75e8>=_0xfa6e6d){_0x3a75e8=_0xfa6e6d;_0x206cd4=0xc8;}else{_0x206cd4=0xce;}_0x3a9d2b[_0x690d('0x1d')](_0x206cd4);return _0x3a9d2b[_0x690d('0x24')](_0x690d('0x25'),_0x192ee8+'-'+_0x3a75e8+'/'+_0xfa6e6d)[_0x690d('0x1f')](_0x373e9f);}return null;};}function patchUpdates(_0x5d3a27){return function(_0x44a339){try{jsonpatch[_0x690d('0x26')](_0x44a339,_0x5d3a27,!![]);}catch(_0x446cd1){return BPromise['reject'](_0x446cd1);}return _0x44a339['save']();};}function saveUpdates(_0x1c2d14,_0x88c97d){return function(_0x8a244b){if(_0x8a244b){return _0x8a244b[_0x690d('0x27')](_0x1c2d14)[_0x690d('0x28')](function(_0x2d42c3){return _0x2d42c3;});}return null;};}function removeEntity(_0x1f2b11,_0x54a7c5){return function(_0x394a9a){if(_0x394a9a){return _0x394a9a[_0x690d('0x29')]()[_0x690d('0x28')](function(){_0x1f2b11[_0x690d('0x1d')](0xcc)[_0x690d('0x1e')]();});}};}function handleEntityNotFound(_0x146f75,_0x417c8c){return function(_0x465737){if(!_0x465737){_0x146f75[_0x690d('0x2a')](0x194);}return _0x465737;};}function handleError(_0x58e500,_0x918c44){_0x918c44=_0x918c44||0x1f4;return function(_0x5a0cbf){logger['error'](_0x5a0cbf[_0x690d('0x2b')]);if(_0x5a0cbf[_0x690d('0x2c')]){delete _0x5a0cbf[_0x690d('0x2c')];}_0x58e500[_0x690d('0x1d')](_0x918c44)[_0x690d('0x2d')](_0x5a0cbf);};}exports[_0x690d('0x2e')]=function(_0x2278d0,_0x299688){var _0x3dd7d9={},_0x4ca982={},_0x295ab7={'count':0x0,'rows':[]};var _0x48987d=_[_0x690d('0x2f')](db[_0x690d('0x30')][_0x690d('0x31')],function(_0xd636b0){return{'name':_0xd636b0[_0x690d('0x32')],'type':_0xd636b0['type'][_0x690d('0x33')]};});_0x4ca982['model']=_[_0x690d('0x2f')](_0x48987d,_0x690d('0x2c'));_0x4ca982[_0x690d('0x34')]=_[_0x690d('0x35')](_0x2278d0[_0x690d('0x34')]);_0x4ca982[_0x690d('0x36')]=_[_0x690d('0x37')](_0x4ca982[_0x690d('0x38')],_0x4ca982['query']);_0x3dd7d9[_0x690d('0x39')]=_[_0x690d('0x37')](_0x4ca982['model'],qs[_0x690d('0x3a')](_0x2278d0[_0x690d('0x34')][_0x690d('0x3a')]));_0x3dd7d9[_0x690d('0x39')]=_0x3dd7d9[_0x690d('0x39')][_0x690d('0x3b')]?_0x3dd7d9[_0x690d('0x39')]:_0x4ca982['model'];if(!_0x2278d0[_0x690d('0x34')][_0x690d('0x3c')](_0x690d('0x3d'))){_0x3dd7d9['limit']=qs[_0x690d('0x23')](_0x2278d0['query'][_0x690d('0x23')]);_0x3dd7d9[_0x690d('0x22')]=qs[_0x690d('0x22')](_0x2278d0[_0x690d('0x34')][_0x690d('0x22')]);}_0x3dd7d9[_0x690d('0x3e')]=qs['sort'](_0x2278d0[_0x690d('0x34')][_0x690d('0x3f')]);_0x3dd7d9[_0x690d('0x40')]=qs[_0x690d('0x36')](_[_0x690d('0x41')](_0x2278d0['query'],_0x4ca982['filters']),_0x48987d);if(_0x2278d0['query'][_0x690d('0x42')]){_0x3dd7d9[_0x690d('0x40')]=_['merge'](_0x3dd7d9[_0x690d('0x40')],{'$or':_[_0x690d('0x2f')](_0x48987d,function(_0x146091){if(_0x146091[_0x690d('0x43')]!==_0x690d('0x44')){var _0xe9de8e={};_0xe9de8e[_0x146091[_0x690d('0x2c')]]={'$like':'%'+_0x2278d0[_0x690d('0x34')][_0x690d('0x42')]+'%'};return _0xe9de8e;}})});}_0x3dd7d9=_[_0x690d('0x45')]({},_0x3dd7d9,_0x2278d0[_0x690d('0x46')]);var _0x4a1e67={'where':_0x3dd7d9[_0x690d('0x40')]};return db[_0x690d('0x30')][_0x690d('0x21')](_0x4a1e67)[_0x690d('0x28')](function(_0xd290ac){_0x295ab7[_0x690d('0x21')]=_0xd290ac;if(_0x2278d0[_0x690d('0x34')]['includeAll']){_0x3dd7d9[_0x690d('0x47')]=[{'all':!![]}];}return db[_0x690d('0x30')][_0x690d('0x48')](_0x3dd7d9);})['then'](function(_0x110e2b){_0x295ab7[_0x690d('0x49')]=_0x110e2b;return _0x295ab7;})['then'](respondWithFilteredResult(_0x299688,_0x3dd7d9))[_0x690d('0x4a')](handleError(_0x299688,null));};exports[_0x690d('0x4b')]=function(_0x2d1858,_0x4f5421){var _0x2f23ec={'raw':![],'where':{'id':_0x2d1858[_0x690d('0x4c')]['id']}},_0x4bccfc={};_0x4bccfc[_0x690d('0x38')]=_['keys'](db['VoiceQueueReport'][_0x690d('0x31')]);_0x4bccfc[_0x690d('0x34')]=_[_0x690d('0x35')](_0x2d1858[_0x690d('0x34')]);_0x4bccfc[_0x690d('0x36')]=_['intersection'](_0x4bccfc[_0x690d('0x38')],_0x4bccfc[_0x690d('0x34')]);_0x2f23ec[_0x690d('0x39')]=_[_0x690d('0x37')](_0x4bccfc[_0x690d('0x38')],qs[_0x690d('0x3a')](_0x2d1858[_0x690d('0x34')][_0x690d('0x3a')]));_0x2f23ec['attributes']=_0x2f23ec[_0x690d('0x39')][_0x690d('0x3b')]?_0x2f23ec[_0x690d('0x39')]:_0x4bccfc[_0x690d('0x38')];if(_0x2d1858[_0x690d('0x34')][_0x690d('0x4d')]){_0x2f23ec[_0x690d('0x47')]=[{'all':!![]}];}_0x2f23ec=_[_0x690d('0x45')]({},_0x2f23ec,_0x2d1858[_0x690d('0x46')]);return db['VoiceQueueReport'][_0x690d('0x4e')](_0x2f23ec)['then'](handleEntityNotFound(_0x4f5421,null))[_0x690d('0x28')](respondWithResult(_0x4f5421,null))['catch'](handleError(_0x4f5421,null));};exports['create']=function(_0x35633c,_0xb61d7b){return db[_0x690d('0x30')][_0x690d('0x4f')](_0x35633c[_0x690d('0x50')],{})[_0x690d('0x28')](respondWithResult(_0xb61d7b,0xc9))[_0x690d('0x4a')](handleError(_0xb61d7b,null));};exports[_0x690d('0x27')]=function(_0x4ea41e,_0x39c54f){if(_0x4ea41e[_0x690d('0x50')]['id']){delete _0x4ea41e[_0x690d('0x50')]['id'];}return db[_0x690d('0x30')]['find']({'where':{'id':_0x4ea41e[_0x690d('0x4c')]['id']}})[_0x690d('0x28')](handleEntityNotFound(_0x39c54f,null))[_0x690d('0x28')](saveUpdates(_0x4ea41e[_0x690d('0x50')],null))['then'](respondWithResult(_0x39c54f,null))[_0x690d('0x4a')](handleError(_0x39c54f,null));};exports[_0x690d('0x29')]=function(_0x5c0b07,_0x393682){return db['VoiceQueueReport']['find']({'where':{'id':_0x5c0b07[_0x690d('0x4c')]['id']}})[_0x690d('0x28')](handleEntityNotFound(_0x393682,null))[_0x690d('0x28')](removeEntity(_0x393682,null))[_0x690d('0x4a')](handleError(_0x393682,null));};exports[_0x690d('0x51')]=function(_0x4c702b,_0x25b29c){return db[_0x690d('0x30')][_0x690d('0x51')]()[_0x690d('0x28')](respondWithResult(_0x25b29c,null))['catch'](handleError(_0x25b29c,null));};exports[_0x690d('0x52')]=function(_0x4616d1,_0x30d680){var _0xa67dc2={},_0x214b8c={},_0x38288d={'count':0x0,'rows':[]};_0x214b8c[_0x690d('0x38')]=_[_0x690d('0x35')](db[_0x690d('0x30')][_0x690d('0x31')]);_0x214b8c['query']=_[_0x690d('0x35')](_0x4616d1[_0x690d('0x34')]);_0x214b8c[_0x690d('0x36')]=_[_0x690d('0x37')](_0x214b8c[_0x690d('0x38')],_0x214b8c[_0x690d('0x34')]);_0xa67dc2[_0x690d('0x39')]=_[_0x690d('0x37')](_0x214b8c[_0x690d('0x38')],qs[_0x690d('0x3a')](_0x4616d1[_0x690d('0x34')][_0x690d('0x3a')]));_0xa67dc2[_0x690d('0x39')]=_0xa67dc2[_0x690d('0x39')]['length']?_0xa67dc2[_0x690d('0x39')]:_0x214b8c[_0x690d('0x38')];if(!_0x4616d1[_0x690d('0x34')][_0x690d('0x3c')](_0x690d('0x3d'))){_0xa67dc2[_0x690d('0x23')]=qs['limit'](_0x4616d1[_0x690d('0x34')][_0x690d('0x23')]);_0xa67dc2[_0x690d('0x22')]=qs[_0x690d('0x22')](_0x4616d1[_0x690d('0x34')]['offset']);}_0xa67dc2[_0x690d('0x3e')]=qs['sort'](_0x4616d1[_0x690d('0x34')][_0x690d('0x3f')]);_0xa67dc2['where']=qs[_0x690d('0x36')](_[_0x690d('0x41')](_0x4616d1[_0x690d('0x34')],_0x214b8c[_0x690d('0x36')]));if(_0x4616d1['query'][_0x690d('0x42')]){_0xa67dc2[_0x690d('0x40')]=_[_0x690d('0x45')](_0xa67dc2[_0x690d('0x40')],{'$or':_[_0x690d('0x2f')](_0xa67dc2[_0x690d('0x39')],function(_0x20a99f){var _0x4d3bfe={};_0x4d3bfe[_0x20a99f]={'$like':'%'+_0x4616d1[_0x690d('0x34')]['filter']+'%'};return _0x4d3bfe;})});}_0xa67dc2=_[_0x690d('0x45')]({},_0xa67dc2,_0x4616d1['options']);var _0xf94d96={'where':_0xa67dc2[_0x690d('0x40')]};return db[_0x690d('0x30')][_0x690d('0x21')](_0xf94d96)[_0x690d('0x28')](function(_0x4a7f91){_0x38288d[_0x690d('0x21')]=_0x4a7f91;if(_0x4616d1[_0x690d('0x34')][_0x690d('0x4d')]){_0xa67dc2[_0x690d('0x47')]=[{'all':!![]}];}return db[_0x690d('0x30')][_0x690d('0x48')](_0xa67dc2);})[_0x690d('0x28')](function(_0x129426){_0x38288d['rows']=_0x129426;return _0x38288d;})['then'](respondWithFilteredResult(_0x30d680,_0xa67dc2,_0x690d('0x52')))[_0x690d('0x4a')](handleError(_0x30d680,null,_0x690d('0x52')));}; \ No newline at end of file +var _0x610f=['path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./voiceQueueReport.socket','register','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','getVoiceQueuesReport','eml-format','rimraf','request-promise','moment','bluebird','mustache','util'];(function(_0x4d0b5b,_0xf881c4){var _0x521856=function(_0x2e5d01){while(--_0x2e5d01){_0x4d0b5b['push'](_0x4d0b5b['shift']());}};_0x521856(++_0xf881c4);}(_0x610f,0x159));var _0xf610=function(_0x21eef2,_0x1480ea){_0x21eef2=_0x21eef2-0x0;var _0x32f106=_0x610f[_0x21eef2];return _0x32f106;};'use strict';var emlformat=require(_0xf610('0x0'));var rimraf=require(_0xf610('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf610('0x2'));var moment=require(_0xf610('0x3'));var BPromise=require(_0xf610('0x4'));var Mustache=require(_0xf610('0x5'));var util=require(_0xf610('0x6'));var path=require(_0xf610('0x7'));var sox=require(_0xf610('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf610('0x9'));var _=require(_0xf610('0xa'));var squel=require(_0xf610('0xb'));var crypto=require(_0xf610('0xc'));var jsforce=require(_0xf610('0xd'));var deskjs=require(_0xf610('0xe'));var toCsv=require(_0xf610('0xf'));var querystring=require(_0xf610('0x10'));var Papa=require(_0xf610('0x11'));var Redis=require(_0xf610('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf610('0x13'));var as=require(_0xf610('0x14'));var hardwareService=require(_0xf610('0x15'));var logger=require('../../config/logger')(_0xf610('0x16'));var utils=require(_0xf610('0x17'));var config=require(_0xf610('0x18'));var licenseUtil=require(_0xf610('0x19'));var db=require(_0xf610('0x1a'))['db'];config['redis']=_[_0xf610('0x1b')](config['redis'],{'host':_0xf610('0x1c'),'port':0x18eb});var socket=require(_0xf610('0x1d'))(new Redis(config[_0xf610('0x1e')]));require(_0xf610('0x1f'))[_0xf610('0x20')](socket);function respondWithStatusCode(_0x56a177,_0x21ba49){_0x21ba49=_0x21ba49||0xcc;return function(_0x462586){if(_0x462586){return _0x56a177['sendStatus'](_0x21ba49);}return _0x56a177[_0xf610('0x21')](_0x21ba49)['end']();};}function respondWithResult(_0x29ee8c,_0xb01e9c){_0xb01e9c=_0xb01e9c||0xc8;return function(_0xb43b32){if(_0xb43b32){return _0x29ee8c['status'](_0xb01e9c)[_0xf610('0x22')](_0xb43b32);}};}function respondWithFilteredResult(_0x146ce5,_0x1fdeb0){return function(_0x3a3089){if(_0x3a3089){var _0x3ec6af=typeof _0x1fdeb0['offset']===_0xf610('0x23')&&typeof _0x1fdeb0[_0xf610('0x24')]===_0xf610('0x23');var _0x16c180=_0x3a3089[_0xf610('0x25')];var _0x27e427=_0x3ec6af?0x0:_0x1fdeb0[_0xf610('0x26')];var _0x5b48b5=_0x3ec6af?_0x3a3089[_0xf610('0x25')]:_0x1fdeb0['offset']+_0x1fdeb0[_0xf610('0x24')];var _0x2d9a6e;if(_0x5b48b5>=_0x16c180){_0x5b48b5=_0x16c180;_0x2d9a6e=0xc8;}else{_0x2d9a6e=0xce;}_0x146ce5[_0xf610('0x21')](_0x2d9a6e);return _0x146ce5[_0xf610('0x27')](_0xf610('0x28'),_0x27e427+'-'+_0x5b48b5+'/'+_0x16c180)[_0xf610('0x22')](_0x3a3089);}return null;};}function patchUpdates(_0x5d72b4){return function(_0x23552a){try{jsonpatch[_0xf610('0x29')](_0x23552a,_0x5d72b4,!![]);}catch(_0x4cb3eb){return BPromise[_0xf610('0x2a')](_0x4cb3eb);}return _0x23552a[_0xf610('0x2b')]();};}function saveUpdates(_0xa3ebfe,_0x3495cf){return function(_0x499196){if(_0x499196){return _0x499196[_0xf610('0x2c')](_0xa3ebfe)['then'](function(_0x4b18d1){return _0x4b18d1;});}return null;};}function removeEntity(_0x43ad7b,_0x3c1e07){return function(_0x468601){if(_0x468601){return _0x468601['destroy']()[_0xf610('0x2d')](function(){_0x43ad7b[_0xf610('0x21')](0xcc)[_0xf610('0x2e')]();});}};}function handleEntityNotFound(_0x3c2872,_0x14d6b0){return function(_0x455dee){if(!_0x455dee){_0x3c2872[_0xf610('0x2f')](0x194);}return _0x455dee;};}function handleError(_0x185216,_0x592b31){_0x592b31=_0x592b31||0x1f4;return function(_0x3f57cd){logger['error'](_0x3f57cd[_0xf610('0x30')]);if(_0x3f57cd[_0xf610('0x31')]){delete _0x3f57cd['name'];}_0x185216[_0xf610('0x21')](_0x592b31)[_0xf610('0x32')](_0x3f57cd);};}exports[_0xf610('0x33')]=function(_0x1b573b,_0xeab88c){var _0x934d6={},_0x6a2c21={},_0x3c954a={'count':0x0,'rows':[]};var _0x282507=_[_0xf610('0x34')](db['VoiceQueueReport'][_0xf610('0x35')],function(_0x15f903){return{'name':_0x15f903[_0xf610('0x36')],'type':_0x15f903[_0xf610('0x37')][_0xf610('0x38')]};});_0x6a2c21[_0xf610('0x39')]=_[_0xf610('0x34')](_0x282507,_0xf610('0x31'));_0x6a2c21[_0xf610('0x3a')]=_['keys'](_0x1b573b[_0xf610('0x3a')]);_0x6a2c21[_0xf610('0x3b')]=_[_0xf610('0x3c')](_0x6a2c21[_0xf610('0x39')],_0x6a2c21[_0xf610('0x3a')]);_0x934d6[_0xf610('0x3d')]=_[_0xf610('0x3c')](_0x6a2c21[_0xf610('0x39')],qs[_0xf610('0x3e')](_0x1b573b[_0xf610('0x3a')][_0xf610('0x3e')]));_0x934d6[_0xf610('0x3d')]=_0x934d6[_0xf610('0x3d')][_0xf610('0x3f')]?_0x934d6[_0xf610('0x3d')]:_0x6a2c21[_0xf610('0x39')];if(!_0x1b573b[_0xf610('0x3a')][_0xf610('0x40')](_0xf610('0x41'))){_0x934d6['limit']=qs[_0xf610('0x24')](_0x1b573b[_0xf610('0x3a')][_0xf610('0x24')]);_0x934d6['offset']=qs['offset'](_0x1b573b[_0xf610('0x3a')][_0xf610('0x26')]);}_0x934d6[_0xf610('0x42')]=qs[_0xf610('0x43')](_0x1b573b[_0xf610('0x3a')][_0xf610('0x43')]);_0x934d6[_0xf610('0x44')]=qs[_0xf610('0x3b')](_[_0xf610('0x45')](_0x1b573b['query'],_0x6a2c21[_0xf610('0x3b')]),_0x282507);if(_0x1b573b[_0xf610('0x3a')][_0xf610('0x46')]){_0x934d6[_0xf610('0x44')]=_[_0xf610('0x47')](_0x934d6[_0xf610('0x44')],{'$or':_['map'](_0x282507,function(_0x34737e){if(_0x34737e['type']!==_0xf610('0x48')){var _0x4c6b9b={};_0x4c6b9b[_0x34737e[_0xf610('0x31')]]={'$like':'%'+_0x1b573b[_0xf610('0x3a')][_0xf610('0x46')]+'%'};return _0x4c6b9b;}})});}_0x934d6=_[_0xf610('0x47')]({},_0x934d6,_0x1b573b[_0xf610('0x49')]);var _0x47c920={'where':_0x934d6[_0xf610('0x44')]};return db[_0xf610('0x4a')]['count'](_0x47c920)[_0xf610('0x2d')](function(_0x73fd33){_0x3c954a['count']=_0x73fd33;if(_0x1b573b[_0xf610('0x3a')][_0xf610('0x4b')]){_0x934d6[_0xf610('0x4c')]=[{'all':!![]}];}return db[_0xf610('0x4a')][_0xf610('0x4d')](_0x934d6);})['then'](function(_0x27dcb3){_0x3c954a[_0xf610('0x4e')]=_0x27dcb3;return _0x3c954a;})[_0xf610('0x2d')](respondWithFilteredResult(_0xeab88c,_0x934d6))[_0xf610('0x4f')](handleError(_0xeab88c,null));};exports[_0xf610('0x50')]=function(_0x5b3ad9,_0x231be3){var _0x190252={'raw':![],'where':{'id':_0x5b3ad9[_0xf610('0x51')]['id']}},_0x3734f1={};_0x3734f1[_0xf610('0x39')]=_[_0xf610('0x52')](db[_0xf610('0x4a')]['rawAttributes']);_0x3734f1[_0xf610('0x3a')]=_[_0xf610('0x52')](_0x5b3ad9[_0xf610('0x3a')]);_0x3734f1[_0xf610('0x3b')]=_[_0xf610('0x3c')](_0x3734f1[_0xf610('0x39')],_0x3734f1[_0xf610('0x3a')]);_0x190252[_0xf610('0x3d')]=_['intersection'](_0x3734f1['model'],qs[_0xf610('0x3e')](_0x5b3ad9['query']['fields']));_0x190252[_0xf610('0x3d')]=_0x190252['attributes'][_0xf610('0x3f')]?_0x190252[_0xf610('0x3d')]:_0x3734f1['model'];if(_0x5b3ad9[_0xf610('0x3a')][_0xf610('0x4b')]){_0x190252['include']=[{'all':!![]}];}_0x190252=_['merge']({},_0x190252,_0x5b3ad9['options']);return db[_0xf610('0x4a')][_0xf610('0x53')](_0x190252)[_0xf610('0x2d')](handleEntityNotFound(_0x231be3,null))[_0xf610('0x2d')](respondWithResult(_0x231be3,null))[_0xf610('0x4f')](handleError(_0x231be3,null));};exports['create']=function(_0xb9cacb,_0x4e4833){return db[_0xf610('0x4a')][_0xf610('0x54')](_0xb9cacb[_0xf610('0x55')],{})[_0xf610('0x2d')](respondWithResult(_0x4e4833,0xc9))[_0xf610('0x4f')](handleError(_0x4e4833,null));};exports[_0xf610('0x2c')]=function(_0x54e399,_0x518321){if(_0x54e399[_0xf610('0x55')]['id']){delete _0x54e399['body']['id'];}return db['VoiceQueueReport'][_0xf610('0x53')]({'where':{'id':_0x54e399[_0xf610('0x51')]['id']}})[_0xf610('0x2d')](handleEntityNotFound(_0x518321,null))['then'](saveUpdates(_0x54e399[_0xf610('0x55')],null))['then'](respondWithResult(_0x518321,null))[_0xf610('0x4f')](handleError(_0x518321,null));};exports['destroy']=function(_0x34bc79,_0x5f5ca3){return db[_0xf610('0x4a')][_0xf610('0x53')]({'where':{'id':_0x34bc79[_0xf610('0x51')]['id']}})[_0xf610('0x2d')](handleEntityNotFound(_0x5f5ca3,null))[_0xf610('0x2d')](removeEntity(_0x5f5ca3,null))['catch'](handleError(_0x5f5ca3,null));};exports[_0xf610('0x56')]=function(_0x3cbb92,_0x392262){return db[_0xf610('0x4a')]['describe']()[_0xf610('0x2d')](respondWithResult(_0x392262,null))['catch'](handleError(_0x392262,null));};exports['getVoiceQueuesReport']=function(_0x537bd7,_0x2caef2){var _0x493e50={},_0x2e1bbd={},_0x148758={'count':0x0,'rows':[]};_0x2e1bbd[_0xf610('0x39')]=_[_0xf610('0x52')](db[_0xf610('0x4a')][_0xf610('0x35')]);_0x2e1bbd[_0xf610('0x3a')]=_['keys'](_0x537bd7[_0xf610('0x3a')]);_0x2e1bbd[_0xf610('0x3b')]=_['intersection'](_0x2e1bbd['model'],_0x2e1bbd[_0xf610('0x3a')]);_0x493e50[_0xf610('0x3d')]=_[_0xf610('0x3c')](_0x2e1bbd[_0xf610('0x39')],qs[_0xf610('0x3e')](_0x537bd7[_0xf610('0x3a')][_0xf610('0x3e')]));_0x493e50[_0xf610('0x3d')]=_0x493e50['attributes'][_0xf610('0x3f')]?_0x493e50[_0xf610('0x3d')]:_0x2e1bbd['model'];if(!_0x537bd7[_0xf610('0x3a')][_0xf610('0x40')](_0xf610('0x41'))){_0x493e50[_0xf610('0x24')]=qs[_0xf610('0x24')](_0x537bd7[_0xf610('0x3a')][_0xf610('0x24')]);_0x493e50[_0xf610('0x26')]=qs[_0xf610('0x26')](_0x537bd7[_0xf610('0x3a')]['offset']);}_0x493e50['order']=qs[_0xf610('0x43')](_0x537bd7[_0xf610('0x3a')]['sort']);_0x493e50['where']=qs[_0xf610('0x3b')](_[_0xf610('0x45')](_0x537bd7[_0xf610('0x3a')],_0x2e1bbd[_0xf610('0x3b')]));if(_0x537bd7[_0xf610('0x3a')][_0xf610('0x46')]){_0x493e50[_0xf610('0x44')]=_[_0xf610('0x47')](_0x493e50['where'],{'$or':_[_0xf610('0x34')](_0x493e50['attributes'],function(_0x30219c){var _0x13fe64={};_0x13fe64[_0x30219c]={'$like':'%'+_0x537bd7[_0xf610('0x3a')]['filter']+'%'};return _0x13fe64;})});}_0x493e50=_[_0xf610('0x47')]({},_0x493e50,_0x537bd7['options']);var _0x341814={'where':_0x493e50[_0xf610('0x44')]};return db[_0xf610('0x4a')][_0xf610('0x25')](_0x341814)[_0xf610('0x2d')](function(_0x2f6a10){_0x148758[_0xf610('0x25')]=_0x2f6a10;if(_0x537bd7[_0xf610('0x3a')]['includeAll']){_0x493e50[_0xf610('0x4c')]=[{'all':!![]}];}return db[_0xf610('0x4a')][_0xf610('0x4d')](_0x493e50);})['then'](function(_0x2292d6){_0x148758[_0xf610('0x4e')]=_0x2292d6;return _0x148758;})[_0xf610('0x2d')](respondWithFilteredResult(_0x2caef2,_0x493e50,_0xf610('0x57')))[_0xf610('0x4f')](handleError(_0x2caef2,null,_0xf610('0x57')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 5296af3..f99d4a4 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 _0x1963=['save','update','emit','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners'];(function(_0x1aba9c,_0x465976){var _0x414891=function(_0x179f91){while(--_0x179f91){_0x1aba9c['push'](_0x1aba9c['shift']());}};_0x414891(++_0x465976);}(_0x1963,0xa7));var _0x3196=function(_0x53e296,_0x220489){_0x53e296=_0x53e296-0x0;var _0x347dfe=_0x1963[_0x53e296];return _0x347dfe;};'use strict';var EventEmitter=require(_0x3196('0x0'));var VoiceQueueReport=require(_0x3196('0x1'))['db'][_0x3196('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x3196('0x3')](0x0);var events={'afterCreate':_0x3196('0x4'),'afterUpdate':_0x3196('0x5'),'afterDestroy':'remove'};function emitEvent(_0x32b7cd){return function(_0x246945,_0x53b814,_0x5c9270){VoiceQueueReportEvents[_0x3196('0x6')](_0x32b7cd+':'+_0x246945['id'],_0x246945);VoiceQueueReportEvents['emit'](_0x32b7cd,_0x246945);_0x5c9270(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x3196('0x7')](e,emitEvent(event));}}module[_0x3196('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x6635=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x48cb78,_0x3f4290){var _0x5681ec=function(_0x17bb63){while(--_0x17bb63){_0x48cb78['push'](_0x48cb78['shift']());}};_0x5681ec(++_0x3f4290);}(_0x6635,0xb4));var _0x5663=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x6635[_0x9dfc10];return _0x4f938a;};'use strict';var EventEmitter=require(_0x5663('0x0'));var VoiceQueueReport=require(_0x5663('0x1'))['db'][_0x5663('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x5663('0x3')](0x0);var events={'afterCreate':_0x5663('0x4'),'afterUpdate':'update','afterDestroy':_0x5663('0x5')};function emitEvent(_0x289c11){return function(_0x292f13,_0x15ea6f,_0x13e2a8){VoiceQueueReportEvents[_0x5663('0x6')](_0x289c11+':'+_0x292f13['id'],_0x292f13);VoiceQueueReportEvents[_0x5663('0x6')](_0x289c11,_0x292f13);_0x13e2a8(null);};}for(var e in events){if(events[_0x5663('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x5663('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index bff7320..84cafec 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 _0xc8ed=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','calleridnum','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x37be00,_0x45514d){var _0x12b45f=function(_0x400632){while(--_0x400632){_0x37be00['push'](_0x37be00['shift']());}};_0x12b45f(++_0x45514d);}(_0xc8ed,0xab));var _0xdc8e=function(_0x320900,_0x426f3c){_0x320900=_0x320900-0x0;var _0x5631ac=_0xc8ed[_0x320900];return _0x5631ac;};'use strict';var _=require('lodash');var util=require(_0xdc8e('0x0'));var logger=require(_0xdc8e('0x1'))(_0xdc8e('0x2'));var moment=require(_0xdc8e('0x3'));var BPromise=require(_0xdc8e('0x4'));var rp=require(_0xdc8e('0x5'));var fs=require('fs');var path=require(_0xdc8e('0x6'));var rimraf=require(_0xdc8e('0x7'));var config=require(_0xdc8e('0x8'));var attributes=require(_0xdc8e('0x9'));module[_0xdc8e('0xa')]=function(_0x3e2251,_0x1dd148){return _0x3e2251[_0xdc8e('0xb')](_0xdc8e('0xc'),attributes,{'tableName':_0xdc8e('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xdc8e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6952=['bluebird','path','rimraf','../../config/environment','./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','api','moment'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x6952,0x1a0));var _0x2695=function(_0x3164cb,_0x4ea7f8){_0x3164cb=_0x3164cb-0x0;var _0x44302f=_0x6952[_0x3164cb];return _0x44302f;};'use strict';var _=require(_0x2695('0x0'));var util=require(_0x2695('0x1'));var logger=require('../../config/logger')(_0x2695('0x2'));var moment=require(_0x2695('0x3'));var BPromise=require(_0x2695('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2695('0x5'));var rimraf=require(_0x2695('0x6'));var config=require(_0x2695('0x7'));var attributes=require(_0x2695('0x8'));module['exports']=function(_0x1033aa,_0xc97848){return _0x1033aa[_0x2695('0x9')](_0x2695('0xa'),attributes,{'tableName':_0x2695('0xb'),'paranoid':![],'indexes':[{'fields':[_0x2695('0xc')]},{'fields':[_0x2695('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 6a73f4a..23d1ddf 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 _0xb577=['request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','GetVoiceQueueReport','create','body','then','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','where','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','info'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb577,0x9b));var _0x7b57=function(_0x55d946,_0x644bc4){_0x55d946=_0x55d946-0x0;var _0xc53385=_0xb577[_0x55d946];return _0xc53385;};'use strict';var _=require(_0x7b57('0x0'));var util=require('util');var moment=require(_0x7b57('0x1'));var BPromise=require(_0x7b57('0x2'));var rs=require(_0x7b57('0x3'));var fs=require('fs');var Redis=require(_0x7b57('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b57('0x5'));var logger=require(_0x7b57('0x6'))(_0x7b57('0x7'));var config=require(_0x7b57('0x8'));var jayson=require(_0x7b57('0x9'));var client=jayson[_0x7b57('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x7b57('0xb')],{'host':_0x7b57('0xc'),'port':0x18eb});var socket=require(_0x7b57('0xd'))(new Redis(config[_0x7b57('0xb')]));require('./voiceQueueReport.socket')[_0x7b57('0xe')](socket);function respondWithRpcPromise(_0x68fd5c,_0x168bbc,_0x441f77){return new BPromise(function(_0x53fee2,_0x3dfcb0){return client[_0x7b57('0xf')](_0x68fd5c,_0x441f77)['then'](function(_0x443c21){logger[_0x7b57('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x168bbc,_0x7b57('0x11'));logger[_0x7b57('0x12')](_0x7b57('0x13'),_0x168bbc,_0x7b57('0x11'),JSON[_0x7b57('0x14')](_0x443c21));if(_0x443c21[_0x7b57('0x15')]){if(_0x443c21[_0x7b57('0x15')]['code']===0x1f4){logger[_0x7b57('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x168bbc,_0x443c21[_0x7b57('0x15')]['message']);return _0x3dfcb0(_0x443c21['error']['message']);}logger[_0x7b57('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x168bbc,_0x443c21['error'][_0x7b57('0x16')]);return _0x53fee2(_0x443c21[_0x7b57('0x15')]['message']);}else{logger[_0x7b57('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x168bbc,'request\x20sent');_0x53fee2(_0x443c21[_0x7b57('0x17')][_0x7b57('0x16')]);}})[_0x7b57('0x18')](function(_0x18c294){logger['error'](_0x7b57('0x19'),_0x168bbc,_0x18c294);_0x3dfcb0(_0x18c294);});});}exports['GetVoiceQueueReport']=function(_0x183393){var _0x4f855f=this;return new Promise(function(_0x393395,_0x1b58cf){return db[_0x7b57('0x1a')][_0x7b57('0x1b')]({'raw':_0x183393[_0x7b57('0x1c')]?_0x183393[_0x7b57('0x1c')][_0x7b57('0x1d')]===undefined?!![]:![]:!![],'where':_0x183393[_0x7b57('0x1c')]?_0x183393['options']['where']||null:null,'attributes':_0x183393['options']?_0x183393[_0x7b57('0x1c')][_0x7b57('0x1e')]||null:null,'limit':_0x183393[_0x7b57('0x1c')]?_0x183393[_0x7b57('0x1c')][_0x7b57('0x1f')]||null:null,'include':_0x183393[_0x7b57('0x1c')]?_0x183393[_0x7b57('0x1c')][_0x7b57('0x20')]?_[_0x7b57('0x21')](_0x183393[_0x7b57('0x1c')]['include'],function(_0x4d0456){return{'model':db[_0x4d0456[_0x7b57('0x22')]],'as':_0x4d0456['as'],'attributes':_0x4d0456[_0x7b57('0x1e')],'include':_0x4d0456[_0x7b57('0x20')]?_[_0x7b57('0x21')](_0x4d0456[_0x7b57('0x20')],function(_0x414f5f){return{'model':db[_0x414f5f['model']],'as':_0x414f5f['as'],'attributes':_0x414f5f['attributes'],'include':_0x414f5f['include']?_[_0x7b57('0x21')](_0x414f5f[_0x7b57('0x20')],function(_0x40164d){return{'model':db[_0x40164d[_0x7b57('0x22')]],'as':_0x40164d['as'],'attributes':_0x40164d[_0x7b57('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f1602){logger[_0x7b57('0x10')](_0x7b57('0x23'),_0x183393);logger[_0x7b57('0x12')](_0x7b57('0x23'),_0x183393,JSON[_0x7b57('0x14')](_0x1f1602));_0x393395(_0x1f1602);})[_0x7b57('0x18')](function(_0x3f8179){logger['error'](_0x7b57('0x23'),_0x3f8179[_0x7b57('0x16')],_0x183393);_0x1b58cf(_0x4f855f['error'](0x1f4,_0x3f8179[_0x7b57('0x16')]));});});};exports['CreateVoiceQueueReport']=function(_0x525ca4){var _0x34b800=this;return new Promise(function(_0x150db8,_0x44d8c4){return db[_0x7b57('0x1a')][_0x7b57('0x24')](_0x525ca4[_0x7b57('0x25')],{'raw':_0x525ca4['options']?_0x525ca4['options'][_0x7b57('0x1d')]===undefined?!![]:![]:!![]})[_0x7b57('0x26')](function(_0x5879d7){logger[_0x7b57('0x10')]('CreateVoiceQueueReport',_0x525ca4);logger['debug'](_0x7b57('0x27'),_0x525ca4,JSON['stringify'](_0x5879d7));_0x150db8(_0x5879d7);})['catch'](function(_0x35de7f){logger[_0x7b57('0x15')](_0x7b57('0x27'),_0x35de7f[_0x7b57('0x16')],_0x525ca4);_0x44d8c4(_0x34b800[_0x7b57('0x15')](0x1f4,_0x35de7f[_0x7b57('0x16')]));});});};exports[_0x7b57('0x28')]=function(_0x29f56c){var _0x441f52=this;return new Promise(function(_0xc6a321,_0x81aad8){return db['VoiceQueueReport'][_0x7b57('0x29')](_0x29f56c[_0x7b57('0x25')],{'raw':_0x29f56c[_0x7b57('0x1c')]?_0x29f56c[_0x7b57('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29f56c['options']?_0x29f56c['options'][_0x7b57('0x2a')]||null:null,'attributes':_0x29f56c[_0x7b57('0x1c')]?_0x29f56c[_0x7b57('0x1c')][_0x7b57('0x1e')]||null:null,'limit':_0x29f56c[_0x7b57('0x1c')]?_0x29f56c[_0x7b57('0x1c')]['limit']||null:null})['then'](function(_0x5ca376){logger['info']('UpdateVoiceQueueReport',_0x29f56c);logger[_0x7b57('0x12')](_0x7b57('0x28'),_0x29f56c,JSON['stringify'](_0x5ca376));_0xc6a321(_0x5ca376);})[_0x7b57('0x18')](function(_0x20035c){logger[_0x7b57('0x15')](_0x7b57('0x28'),_0x20035c[_0x7b57('0x16')],_0x29f56c);_0x81aad8(_0x441f52[_0x7b57('0x15')](0x1f4,_0x20035c['message']));});});}; \ No newline at end of file +var _0xb237=['update','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','map','include','model','CreateVoiceQueueReport','body','UpdateVoiceQueueReport'];(function(_0x69e9c9,_0x355bde){var _0x423d19=function(_0x43919f){while(--_0x43919f){_0x69e9c9['push'](_0x69e9c9['shift']());}};_0x423d19(++_0x355bde);}(_0xb237,0xa1));var _0x7b23=function(_0x3089b7,_0x2c4d17){_0x3089b7=_0x3089b7-0x0;var _0xbf7467=_0xb237[_0x3089b7];return _0xbf7467;};'use strict';var _=require(_0x7b23('0x0'));var util=require('util');var moment=require(_0x7b23('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b23('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b23('0x3'))['db'];var utils=require(_0x7b23('0x4'));var logger=require('../../config/logger')(_0x7b23('0x5'));var config=require(_0x7b23('0x6'));var jayson=require(_0x7b23('0x7'));var client=jayson[_0x7b23('0x8')][_0x7b23('0x9')]({'port':0x232a});config[_0x7b23('0xa')]=_['defaults'](config[_0x7b23('0xa')],{'host':_0x7b23('0xb'),'port':0x18eb});var socket=require(_0x7b23('0xc'))(new Redis(config[_0x7b23('0xa')]));require('./voiceQueueReport.socket')[_0x7b23('0xd')](socket);function respondWithRpcPromise(_0x3635d2,_0x1bb46f,_0x5b07bf){return new BPromise(function(_0x454949,_0x50eb1f){return client[_0x7b23('0xe')](_0x3635d2,_0x5b07bf)[_0x7b23('0xf')](function(_0x51872f){logger[_0x7b23('0x10')](_0x7b23('0x11'),_0x1bb46f,_0x7b23('0x12'));logger[_0x7b23('0x13')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x1bb46f,'request\x20sent',JSON[_0x7b23('0x14')](_0x51872f));if(_0x51872f[_0x7b23('0x15')]){if(_0x51872f[_0x7b23('0x15')][_0x7b23('0x16')]===0x1f4){logger[_0x7b23('0x15')](_0x7b23('0x11'),_0x1bb46f,_0x51872f[_0x7b23('0x15')][_0x7b23('0x17')]);return _0x50eb1f(_0x51872f['error'][_0x7b23('0x17')]);}logger[_0x7b23('0x15')](_0x7b23('0x11'),_0x1bb46f,_0x51872f[_0x7b23('0x15')][_0x7b23('0x17')]);return _0x454949(_0x51872f[_0x7b23('0x15')]['message']);}else{logger[_0x7b23('0x10')](_0x7b23('0x11'),_0x1bb46f,_0x7b23('0x12'));_0x454949(_0x51872f[_0x7b23('0x18')][_0x7b23('0x17')]);}})[_0x7b23('0x19')](function(_0x4cac70){logger[_0x7b23('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x1bb46f,_0x4cac70);_0x50eb1f(_0x4cac70);});});}exports[_0x7b23('0x1a')]=function(_0x2ba0aa){var _0x593028=this;return new Promise(function(_0x38f19d,_0x4a7d23){return db[_0x7b23('0x1b')][_0x7b23('0x1c')]({'raw':_0x2ba0aa['options']?_0x2ba0aa[_0x7b23('0x1d')][_0x7b23('0x1e')]===undefined?!![]:![]:!![],'where':_0x2ba0aa[_0x7b23('0x1d')]?_0x2ba0aa[_0x7b23('0x1d')][_0x7b23('0x1f')]||null:null,'attributes':_0x2ba0aa[_0x7b23('0x1d')]?_0x2ba0aa[_0x7b23('0x1d')][_0x7b23('0x20')]||null:null,'limit':_0x2ba0aa['options']?_0x2ba0aa['options']['limit']||null:null,'include':_0x2ba0aa[_0x7b23('0x1d')]?_0x2ba0aa[_0x7b23('0x1d')]['include']?_[_0x7b23('0x21')](_0x2ba0aa[_0x7b23('0x1d')][_0x7b23('0x22')],function(_0x3ea606){return{'model':db[_0x3ea606['model']],'as':_0x3ea606['as'],'attributes':_0x3ea606[_0x7b23('0x20')],'include':_0x3ea606[_0x7b23('0x22')]?_['map'](_0x3ea606[_0x7b23('0x22')],function(_0x24dea2){return{'model':db[_0x24dea2[_0x7b23('0x23')]],'as':_0x24dea2['as'],'attributes':_0x24dea2['attributes'],'include':_0x24dea2['include']?_[_0x7b23('0x21')](_0x24dea2[_0x7b23('0x22')],function(_0xc38044){return{'model':db[_0xc38044[_0x7b23('0x23')]],'as':_0xc38044['as'],'attributes':_0xc38044[_0x7b23('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7b23('0xf')](function(_0x1427a3){logger['info']('GetVoiceQueueReport',_0x2ba0aa);logger[_0x7b23('0x13')](_0x7b23('0x1a'),_0x2ba0aa,JSON[_0x7b23('0x14')](_0x1427a3));_0x38f19d(_0x1427a3);})['catch'](function(_0x496489){logger[_0x7b23('0x15')](_0x7b23('0x1a'),_0x496489['message'],_0x2ba0aa);_0x4a7d23(_0x593028[_0x7b23('0x15')](0x1f4,_0x496489[_0x7b23('0x17')]));});});};exports[_0x7b23('0x24')]=function(_0x502083){var _0x310ef0=this;return new Promise(function(_0x83ebd8,_0x42e463){return db[_0x7b23('0x1b')]['create'](_0x502083[_0x7b23('0x25')],{'raw':_0x502083[_0x7b23('0x1d')]?_0x502083[_0x7b23('0x1d')][_0x7b23('0x1e')]===undefined?!![]:![]:!![]})[_0x7b23('0xf')](function(_0x57b436){logger[_0x7b23('0x10')](_0x7b23('0x24'),_0x502083);logger['debug'](_0x7b23('0x24'),_0x502083,JSON[_0x7b23('0x14')](_0x57b436));_0x83ebd8(_0x57b436);})[_0x7b23('0x19')](function(_0x1b6a95){logger[_0x7b23('0x15')]('CreateVoiceQueueReport',_0x1b6a95[_0x7b23('0x17')],_0x502083);_0x42e463(_0x310ef0['error'](0x1f4,_0x1b6a95[_0x7b23('0x17')]));});});};exports[_0x7b23('0x26')]=function(_0x282692){var _0x3cd872=this;return new Promise(function(_0x3a61dd,_0x2578dd){return db[_0x7b23('0x1b')][_0x7b23('0x27')](_0x282692[_0x7b23('0x25')],{'raw':_0x282692[_0x7b23('0x1d')]?_0x282692[_0x7b23('0x1d')][_0x7b23('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x282692[_0x7b23('0x1d')]?_0x282692[_0x7b23('0x1d')][_0x7b23('0x1f')]||null:null,'attributes':_0x282692['options']?_0x282692[_0x7b23('0x1d')]['attributes']||null:null,'limit':_0x282692[_0x7b23('0x1d')]?_0x282692[_0x7b23('0x1d')]['limit']||null:null})['then'](function(_0x1e9d40){logger[_0x7b23('0x10')]('UpdateVoiceQueueReport',_0x282692);logger[_0x7b23('0x13')](_0x7b23('0x26'),_0x282692,JSON['stringify'](_0x1e9d40));_0x3a61dd(_0x1e9d40);})[_0x7b23('0x19')](function(_0x1d6d55){logger[_0x7b23('0x15')](_0x7b23('0x26'),_0x1d6d55[_0x7b23('0x17')],_0x282692);_0x2578dd(_0x3cd872[_0x7b23('0x15')](0x1f4,_0x1d6d55['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 31f62ef..d0a0e3e 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 _0x5292=['length','voiceQueueReport:','./voiceQueueReport.events','save','update','emit','removeListener'];(function(_0x312183,_0x501542){var _0x5a6efd=function(_0x11f613){while(--_0x11f613){_0x312183['push'](_0x312183['shift']());}};_0x5a6efd(++_0x501542);}(_0x5292,0xf7));var _0x2529=function(_0x598152,_0x4230ac){_0x598152=_0x598152-0x0;var _0x71af95=_0x5292[_0x598152];return _0x71af95;};'use strict';var VoiceQueueReportEvents=require(_0x2529('0x0'));var events=[_0x2529('0x1'),'remove',_0x2529('0x2')];function createListener(_0x522ab4,_0x1540a9){return function(_0x2b088){_0x1540a9[_0x2529('0x3')](_0x522ab4,_0x2b088);};}function removeListener(_0x228165,_0x5d25dc){return function(){VoiceQueueReportEvents[_0x2529('0x4')](_0x228165,_0x5d25dc);};}exports['register']=function(_0x4c9b4c){for(var _0x4e7a9e=0x0,_0x407277=events[_0x2529('0x5')];_0x4e7a9e<_0x407277;_0x4e7a9e++){var _0x5bb8a1=events[_0x4e7a9e];var _0x5c3355=createListener(_0x2529('0x6')+_0x5bb8a1,_0x4c9b4c);VoiceQueueReportEvents['on'](_0x5bb8a1,_0x5c3355);}}; \ No newline at end of file +var _0xc57c=['emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events'];(function(_0xe5088b,_0x21f295){var _0x7ff7f5=function(_0x5de49b){while(--_0x5de49b){_0xe5088b['push'](_0xe5088b['shift']());}};_0x7ff7f5(++_0x21f295);}(_0xc57c,0x149));var _0xcc57=function(_0x5b74e6,_0x45fb0c){_0x5b74e6=_0x5b74e6-0x0;var _0x18c866=_0xc57c[_0x5b74e6];return _0x18c866;};'use strict';var VoiceQueueReportEvents=require(_0xcc57('0x0'));var events=['save','remove','update'];function createListener(_0x3befc4,_0x5233e0){return function(_0x4a98ce){_0x5233e0[_0xcc57('0x1')](_0x3befc4,_0x4a98ce);};}function removeListener(_0x589025,_0x163be1){return function(){VoiceQueueReportEvents[_0xcc57('0x2')](_0x589025,_0x163be1);};}exports[_0xcc57('0x3')]=function(_0x2f87ef){for(var _0x4760f4=0x0,_0x2433da=events[_0xcc57('0x4')];_0x4760f4<_0x2433da;_0x4760f4++){var _0x5bd3d8=events[_0x4760f4];var _0x2a81f0=createListener(_0xcc57('0x5')+_0x5bd3d8,_0x2f87ef);VoiceQueueReportEvents['on'](_0x5bd3d8,_0x2a81f0);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index ec670ec..f8d13b3 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 _0x9538=['/:id','delete','destroy','multer','util','path','Router','fs-extra','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get'];(function(_0x3080da,_0x276068){var _0x10313e=function(_0x40051d){while(--_0x40051d){_0x3080da['push'](_0x3080da['shift']());}};_0x10313e(++_0x276068);}(_0x9538,0x1bd));var _0x8953=function(_0x22544b,_0x301001){_0x22544b=_0x22544b-0x0;var _0x245051=_0x9538[_0x22544b];return _0x245051;};'use strict';var multer=require(_0x8953('0x0'));var util=require(_0x8953('0x1'));var path=require(_0x8953('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8953('0x3')]();var fs_extra=require(_0x8953('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8953('0x5'));var controller=require(_0x8953('0x6'));router['get']('/',auth[_0x8953('0x7')](),controller[_0x8953('0x8')]);router[_0x8953('0x9')](_0x8953('0xa'),auth[_0x8953('0x7')](),controller['show']);router['post']('/',auth[_0x8953('0x7')](),controller['create']);router['put']('/:id',auth[_0x8953('0x7')](),controller['update']);router[_0x8953('0xb')](_0x8953('0xa'),auth[_0x8953('0x7')](),controller[_0x8953('0xc')]);module['exports']=router; \ No newline at end of file +var _0x552e=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x552e,0x138));var _0xe552=function(_0x450639,_0x5dab5e){_0x450639=_0x450639-0x0;var _0x3682cf=_0x552e[_0x450639];return _0x3682cf;};'use strict';var multer=require(_0xe552('0x0'));var util=require(_0xe552('0x1'));var path=require(_0xe552('0x2'));var timeout=require(_0xe552('0x3'));var express=require(_0xe552('0x4'));var router=express[_0xe552('0x5')]();var fs_extra=require(_0xe552('0x6'));var auth=require(_0xe552('0x7'));var interaction=require(_0xe552('0x8'));var config=require(_0xe552('0x9'));var controller=require('./voiceQueuesLog.controller');router[_0xe552('0xa')]('/',auth[_0xe552('0xb')](),controller[_0xe552('0xc')]);router[_0xe552('0xa')](_0xe552('0xd'),auth['isAuthenticated'](),controller[_0xe552('0xe')]);router['post']('/',auth[_0xe552('0xb')](),controller[_0xe552('0xf')]);router[_0xe552('0x10')](_0xe552('0xd'),auth[_0xe552('0xb')](),controller[_0xe552('0x11')]);router[_0xe552('0x12')](_0xe552('0xd'),auth[_0xe552('0xb')](),controller[_0xe552('0x13')]);module[_0xe552('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 0c22a0f..b25ae5b 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 _0x8d76=['moment','exports','STRING','DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x2a03d1,_0x44535a){var _0x269e00=function(_0x97f112){while(--_0x97f112){_0x2a03d1['push'](_0x2a03d1['shift']());}};_0x269e00(++_0x44535a);}(_0x8d76,0xc5));var _0x68d7=function(_0x11cd75,_0x3dac98){_0x11cd75=_0x11cd75-0x0;var _0x37fdf1=_0x8d76[_0x11cd75];return _0x37fdf1;};'use strict';var Sequelize=require(_0x68d7('0x0'));var moment=require(_0x68d7('0x1'));module[_0x68d7('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x68d7('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x68d7('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x68d7('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x68d7('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x68d7('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x68d7('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x68d7('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x68d7('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x68d7('0x4')],'allowNull':![],'defaultValue':Sequelize['literal'](_0x68d7('0x5'))}}; \ No newline at end of file +var _0xfa9a=['STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment','exports'];(function(_0x4d657f,_0x57275a){var _0x582bbb=function(_0x1d6d27){while(--_0x1d6d27){_0x4d657f['push'](_0x4d657f['shift']());}};_0x582bbb(++_0x57275a);}(_0xfa9a,0x9e));var _0xafa9=function(_0x11ca3e,_0x40baa2){_0x11ca3e=_0x11ca3e-0x0;var _0x51a78f=_0xfa9a[_0x11ca3e];return _0x51a78f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xafa9('0x0'));module[_0xafa9('0x1')]={'time':{'type':Sequelize[_0xafa9('0x2')]},'callid':{'type':Sequelize[_0xafa9('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xafa9('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xafa9('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xafa9('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xafa9('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xafa9('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xafa9('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xafa9('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xafa9('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xafa9('0x3')](_0xafa9('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 8159527..0abc435 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 _0x1c18=['order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x1c18,0x135));var _0x81c1=function(_0x3f18d9,_0x3b2f8f){_0x3f18d9=_0x3f18d9-0x0;var _0x243ff4=_0x1c18[_0x3f18d9];return _0x243ff4;};'use strict';var emlformat=require(_0x81c1('0x0'));var rimraf=require(_0x81c1('0x1'));var zipdir=require(_0x81c1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x81c1('0x3'));var moment=require(_0x81c1('0x4'));var BPromise=require(_0x81c1('0x5'));var Mustache=require('mustache');var util=require(_0x81c1('0x6'));var path=require(_0x81c1('0x7'));var sox=require('sox');var csv=require(_0x81c1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x81c1('0x9'));var _=require(_0x81c1('0xa'));var squel=require('squel');var crypto=require(_0x81c1('0xb'));var jsforce=require(_0x81c1('0xc'));var deskjs=require(_0x81c1('0xd'));var toCsv=require(_0x81c1('0x8'));var querystring=require('querystring');var Papa=require(_0x81c1('0xe'));var Redis=require('ioredis');var authService=require(_0x81c1('0xf'));var qs=require(_0x81c1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x81c1('0x11'));var logger=require(_0x81c1('0x12'))(_0x81c1('0x13'));var utils=require('../../config/utils');var config=require(_0x81c1('0x14'));var licenseUtil=require(_0x81c1('0x15'));var db=require(_0x81c1('0x16'))['db'];function respondWithStatusCode(_0x1be17c,_0x2857c7){_0x2857c7=_0x2857c7||0xcc;return function(_0x504e06){if(_0x504e06){return _0x1be17c[_0x81c1('0x17')](_0x2857c7);}return _0x1be17c[_0x81c1('0x18')](_0x2857c7)[_0x81c1('0x19')]();};}function respondWithResult(_0x3f999f,_0x219da2){_0x219da2=_0x219da2||0xc8;return function(_0x18c60d){if(_0x18c60d){return _0x3f999f[_0x81c1('0x18')](_0x219da2)[_0x81c1('0x1a')](_0x18c60d);}};}function respondWithFilteredResult(_0x30cf9d,_0x1a81ca){return function(_0x5488a9){if(_0x5488a9){var _0x3fa84a=typeof _0x1a81ca[_0x81c1('0x1b')]===_0x81c1('0x1c')&&typeof _0x1a81ca['limit']===_0x81c1('0x1c');var _0x51cd61=_0x5488a9[_0x81c1('0x1d')];var _0x500337=_0x3fa84a?0x0:_0x1a81ca[_0x81c1('0x1b')];var _0x367cc7=_0x3fa84a?_0x5488a9['count']:_0x1a81ca[_0x81c1('0x1b')]+_0x1a81ca['limit'];var _0x97539c;if(_0x367cc7>=_0x51cd61){_0x367cc7=_0x51cd61;_0x97539c=0xc8;}else{_0x97539c=0xce;}_0x30cf9d[_0x81c1('0x18')](_0x97539c);return _0x30cf9d['set'](_0x81c1('0x1e'),_0x500337+'-'+_0x367cc7+'/'+_0x51cd61)[_0x81c1('0x1a')](_0x5488a9);}return null;};}function patchUpdates(_0x38b508){return function(_0x5ab867){try{jsonpatch[_0x81c1('0x1f')](_0x5ab867,_0x38b508,!![]);}catch(_0x346260){return BPromise[_0x81c1('0x20')](_0x346260);}return _0x5ab867[_0x81c1('0x21')]();};}function saveUpdates(_0x2ca6a3,_0x28faa8){return function(_0x1a1130){if(_0x1a1130){return _0x1a1130[_0x81c1('0x22')](_0x2ca6a3)[_0x81c1('0x23')](function(_0x14d8d1){return _0x14d8d1;});}return null;};}function removeEntity(_0x41bd99,_0x3bb04c){return function(_0xb8121e){if(_0xb8121e){return _0xb8121e[_0x81c1('0x24')]()[_0x81c1('0x23')](function(){_0x41bd99['status'](0xcc)[_0x81c1('0x19')]();});}};}function handleEntityNotFound(_0x354836,_0x1437aa){return function(_0x323723){if(!_0x323723){_0x354836[_0x81c1('0x17')](0x194);}return _0x323723;};}function handleError(_0x51b8b6,_0x5e4c6b){_0x5e4c6b=_0x5e4c6b||0x1f4;return function(_0x5f3c10){logger[_0x81c1('0x25')](_0x5f3c10[_0x81c1('0x26')]);if(_0x5f3c10[_0x81c1('0x27')]){delete _0x5f3c10[_0x81c1('0x27')];}_0x51b8b6['status'](_0x5e4c6b)[_0x81c1('0x28')](_0x5f3c10);};}exports[_0x81c1('0x29')]=function(_0x2c29ff,_0x1dccf3){var _0x5d48bd={},_0x154ff1={},_0xb5ad73={'count':0x0,'rows':[]};var _0x5be000=_[_0x81c1('0x2a')](db[_0x81c1('0x2b')]['rawAttributes'],function(_0x3dfc3a){return{'name':_0x3dfc3a[_0x81c1('0x2c')],'type':_0x3dfc3a[_0x81c1('0x2d')]['key']};});_0x154ff1[_0x81c1('0x2e')]=_[_0x81c1('0x2a')](_0x5be000,_0x81c1('0x27'));_0x154ff1[_0x81c1('0x2f')]=_[_0x81c1('0x30')](_0x2c29ff[_0x81c1('0x2f')]);_0x154ff1[_0x81c1('0x31')]=_[_0x81c1('0x32')](_0x154ff1[_0x81c1('0x2e')],_0x154ff1[_0x81c1('0x2f')]);_0x5d48bd[_0x81c1('0x33')]=_[_0x81c1('0x32')](_0x154ff1[_0x81c1('0x2e')],qs[_0x81c1('0x34')](_0x2c29ff[_0x81c1('0x2f')][_0x81c1('0x34')]));_0x5d48bd[_0x81c1('0x33')]=_0x5d48bd[_0x81c1('0x33')][_0x81c1('0x35')]?_0x5d48bd[_0x81c1('0x33')]:_0x154ff1[_0x81c1('0x2e')];if(!_0x2c29ff['query']['hasOwnProperty'](_0x81c1('0x36'))){_0x5d48bd[_0x81c1('0x37')]=qs['limit'](_0x2c29ff['query']['limit']);_0x5d48bd[_0x81c1('0x1b')]=qs[_0x81c1('0x1b')](_0x2c29ff[_0x81c1('0x2f')][_0x81c1('0x1b')]);}_0x5d48bd[_0x81c1('0x38')]=qs[_0x81c1('0x39')](_0x2c29ff[_0x81c1('0x2f')][_0x81c1('0x39')]);_0x5d48bd[_0x81c1('0x3a')]=qs[_0x81c1('0x31')](_[_0x81c1('0x3b')](_0x2c29ff['query'],_0x154ff1[_0x81c1('0x31')]),_0x5be000);if(_0x2c29ff['query']['filter']){_0x5d48bd[_0x81c1('0x3a')]=_[_0x81c1('0x3c')](_0x5d48bd[_0x81c1('0x3a')],{'$or':_[_0x81c1('0x2a')](_0x5be000,function(_0x584dcb){if(_0x584dcb['type']!==_0x81c1('0x3d')){var _0xddc6b0={};_0xddc6b0[_0x584dcb['name']]={'$like':'%'+_0x2c29ff[_0x81c1('0x2f')]['filter']+'%'};return _0xddc6b0;}})});}_0x5d48bd=_[_0x81c1('0x3c')]({},_0x5d48bd,_0x2c29ff[_0x81c1('0x3e')]);var _0x5814ae={'where':_0x5d48bd[_0x81c1('0x3a')]};return db[_0x81c1('0x2b')][_0x81c1('0x1d')](_0x5814ae)['then'](function(_0x562222){_0xb5ad73[_0x81c1('0x1d')]=_0x562222;if(_0x2c29ff[_0x81c1('0x2f')][_0x81c1('0x3f')]){_0x5d48bd[_0x81c1('0x40')]=[{'all':!![]}];}return db[_0x81c1('0x2b')][_0x81c1('0x41')](_0x5d48bd);})['then'](function(_0x500718){_0xb5ad73[_0x81c1('0x42')]=_0x500718;return _0xb5ad73;})[_0x81c1('0x23')](respondWithFilteredResult(_0x1dccf3,_0x5d48bd))['catch'](handleError(_0x1dccf3,null));};exports[_0x81c1('0x43')]=function(_0x43dd7e,_0x482bdd){var _0x38a335={'raw':!![],'where':{'id':_0x43dd7e['params']['id']}},_0x4afb8d={};_0x4afb8d[_0x81c1('0x2e')]=_[_0x81c1('0x30')](db[_0x81c1('0x2b')]['rawAttributes']);_0x4afb8d['query']=_['keys'](_0x43dd7e['query']);_0x4afb8d['filters']=_[_0x81c1('0x32')](_0x4afb8d[_0x81c1('0x2e')],_0x4afb8d[_0x81c1('0x2f')]);_0x38a335[_0x81c1('0x33')]=_[_0x81c1('0x32')](_0x4afb8d[_0x81c1('0x2e')],qs[_0x81c1('0x34')](_0x43dd7e['query'][_0x81c1('0x34')]));_0x38a335[_0x81c1('0x33')]=_0x38a335[_0x81c1('0x33')][_0x81c1('0x35')]?_0x38a335[_0x81c1('0x33')]:_0x4afb8d['model'];if(_0x43dd7e['query'][_0x81c1('0x3f')]){_0x38a335[_0x81c1('0x40')]=[{'all':!![]}];}_0x38a335=_[_0x81c1('0x3c')]({},_0x38a335,_0x43dd7e[_0x81c1('0x3e')]);return db[_0x81c1('0x2b')][_0x81c1('0x44')](_0x38a335)['then'](handleEntityNotFound(_0x482bdd,null))[_0x81c1('0x23')](respondWithResult(_0x482bdd,null))[_0x81c1('0x45')](handleError(_0x482bdd,null));};exports[_0x81c1('0x46')]=function(_0x4d904c,_0x3b48ac){return db[_0x81c1('0x2b')][_0x81c1('0x46')](_0x4d904c[_0x81c1('0x47')],{})[_0x81c1('0x23')](respondWithResult(_0x3b48ac,0xc9))[_0x81c1('0x45')](handleError(_0x3b48ac,null));};exports['update']=function(_0x425a18,_0x16b171){if(_0x425a18[_0x81c1('0x47')]['id']){delete _0x425a18[_0x81c1('0x47')]['id'];}return db[_0x81c1('0x2b')][_0x81c1('0x44')]({'where':{'id':_0x425a18[_0x81c1('0x48')]['id']}})[_0x81c1('0x23')](handleEntityNotFound(_0x16b171,null))[_0x81c1('0x23')](saveUpdates(_0x425a18[_0x81c1('0x47')],null))['then'](respondWithResult(_0x16b171,null))[_0x81c1('0x45')](handleError(_0x16b171,null));};exports['destroy']=function(_0x2c6f0d,_0x2f03ea){return db[_0x81c1('0x2b')]['find']({'where':{'id':_0x2c6f0d[_0x81c1('0x48')]['id']}})[_0x81c1('0x23')](handleEntityNotFound(_0x2f03ea,null))[_0x81c1('0x23')](removeEntity(_0x2f03ea,null))['catch'](handleError(_0x2f03ea,null));}; \ No newline at end of file +var _0xb810=['body','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','VoiceQueuesLog','type','model','query','keys','intersection','fields','attributes','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xb810,0xd6));var _0x0b81=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xb810[_0x5f309e];return _0x487b5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b81('0x0'));var zipdir=require(_0x0b81('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0b81('0x2'));var moment=require(_0x0b81('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0b81('0x4'));var util=require(_0x0b81('0x5'));var path=require(_0x0b81('0x6'));var sox=require(_0x0b81('0x7'));var csv=require(_0x0b81('0x8'));var ejs=require(_0x0b81('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b81('0xa'));var squel=require(_0x0b81('0xb'));var crypto=require(_0x0b81('0xc'));var jsforce=require(_0x0b81('0xd'));var deskjs=require(_0x0b81('0xe'));var toCsv=require(_0x0b81('0x8'));var querystring=require(_0x0b81('0xf'));var Papa=require(_0x0b81('0x10'));var Redis=require(_0x0b81('0x11'));var authService=require(_0x0b81('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0b81('0x13'));var hardwareService=require(_0x0b81('0x14'));var logger=require(_0x0b81('0x15'))('api');var utils=require(_0x0b81('0x16'));var config=require(_0x0b81('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0b81('0x18'))['db'];function respondWithStatusCode(_0x40c0f,_0x48d3a4){_0x48d3a4=_0x48d3a4||0xcc;return function(_0x54131d){if(_0x54131d){return _0x40c0f[_0x0b81('0x19')](_0x48d3a4);}return _0x40c0f['status'](_0x48d3a4)[_0x0b81('0x1a')]();};}function respondWithResult(_0x5546db,_0x2b0ac0){_0x2b0ac0=_0x2b0ac0||0xc8;return function(_0x3d47ca){if(_0x3d47ca){return _0x5546db[_0x0b81('0x1b')](_0x2b0ac0)[_0x0b81('0x1c')](_0x3d47ca);}};}function respondWithFilteredResult(_0x6627d4,_0x2cbe7f){return function(_0x563444){if(_0x563444){var _0x289230=typeof _0x2cbe7f[_0x0b81('0x1d')]===_0x0b81('0x1e')&&typeof _0x2cbe7f[_0x0b81('0x1f')]===_0x0b81('0x1e');var _0x3f99d8=_0x563444[_0x0b81('0x20')];var _0x448303=_0x289230?0x0:_0x2cbe7f[_0x0b81('0x1d')];var _0xa8d892=_0x289230?_0x563444[_0x0b81('0x20')]:_0x2cbe7f[_0x0b81('0x1d')]+_0x2cbe7f[_0x0b81('0x1f')];var _0x2913b1;if(_0xa8d892>=_0x3f99d8){_0xa8d892=_0x3f99d8;_0x2913b1=0xc8;}else{_0x2913b1=0xce;}_0x6627d4[_0x0b81('0x1b')](_0x2913b1);return _0x6627d4[_0x0b81('0x21')](_0x0b81('0x22'),_0x448303+'-'+_0xa8d892+'/'+_0x3f99d8)[_0x0b81('0x1c')](_0x563444);}return null;};}function patchUpdates(_0x3b3ee6){return function(_0x45df4d){try{jsonpatch['apply'](_0x45df4d,_0x3b3ee6,!![]);}catch(_0x58c8ec){return BPromise['reject'](_0x58c8ec);}return _0x45df4d[_0x0b81('0x23')]();};}function saveUpdates(_0x42c811,_0x58e950){return function(_0x5afb5f){if(_0x5afb5f){return _0x5afb5f[_0x0b81('0x24')](_0x42c811)[_0x0b81('0x25')](function(_0x5db5f2){return _0x5db5f2;});}return null;};}function removeEntity(_0x27f796,_0x5cdb44){return function(_0x4f1582){if(_0x4f1582){return _0x4f1582[_0x0b81('0x26')]()[_0x0b81('0x25')](function(){_0x27f796[_0x0b81('0x1b')](0xcc)[_0x0b81('0x1a')]();});}};}function handleEntityNotFound(_0x8b5504,_0x2d12b2){return function(_0x342bbf){if(!_0x342bbf){_0x8b5504[_0x0b81('0x19')](0x194);}return _0x342bbf;};}function handleError(_0x3a8147,_0x540535){_0x540535=_0x540535||0x1f4;return function(_0x33c17d){logger[_0x0b81('0x27')](_0x33c17d[_0x0b81('0x28')]);if(_0x33c17d[_0x0b81('0x29')]){delete _0x33c17d[_0x0b81('0x29')];}_0x3a8147[_0x0b81('0x1b')](_0x540535)['send'](_0x33c17d);};}exports[_0x0b81('0x2a')]=function(_0x5e2762,_0x24886b){var _0x1d72ab={},_0xb48b93={},_0xedd005={'count':0x0,'rows':[]};var _0x3c9796=_[_0x0b81('0x2b')](db[_0x0b81('0x2c')]['rawAttributes'],function(_0x56acad){return{'name':_0x56acad['fieldName'],'type':_0x56acad[_0x0b81('0x2d')]['key']};});_0xb48b93[_0x0b81('0x2e')]=_[_0x0b81('0x2b')](_0x3c9796,_0x0b81('0x29'));_0xb48b93[_0x0b81('0x2f')]=_[_0x0b81('0x30')](_0x5e2762[_0x0b81('0x2f')]);_0xb48b93['filters']=_[_0x0b81('0x31')](_0xb48b93['model'],_0xb48b93[_0x0b81('0x2f')]);_0x1d72ab['attributes']=_[_0x0b81('0x31')](_0xb48b93[_0x0b81('0x2e')],qs[_0x0b81('0x32')](_0x5e2762[_0x0b81('0x2f')][_0x0b81('0x32')]));_0x1d72ab[_0x0b81('0x33')]=_0x1d72ab['attributes']['length']?_0x1d72ab[_0x0b81('0x33')]:_0xb48b93[_0x0b81('0x2e')];if(!_0x5e2762['query'][_0x0b81('0x34')]('nolimit')){_0x1d72ab['limit']=qs[_0x0b81('0x1f')](_0x5e2762[_0x0b81('0x2f')][_0x0b81('0x1f')]);_0x1d72ab['offset']=qs[_0x0b81('0x1d')](_0x5e2762[_0x0b81('0x2f')][_0x0b81('0x1d')]);}_0x1d72ab['order']=qs[_0x0b81('0x35')](_0x5e2762[_0x0b81('0x2f')][_0x0b81('0x35')]);_0x1d72ab[_0x0b81('0x36')]=qs[_0x0b81('0x37')](_['pick'](_0x5e2762[_0x0b81('0x2f')],_0xb48b93['filters']),_0x3c9796);if(_0x5e2762[_0x0b81('0x2f')][_0x0b81('0x38')]){_0x1d72ab['where']=_[_0x0b81('0x39')](_0x1d72ab[_0x0b81('0x36')],{'$or':_[_0x0b81('0x2b')](_0x3c9796,function(_0x14797e){if(_0x14797e[_0x0b81('0x2d')]!==_0x0b81('0x3a')){var _0x5bbc39={};_0x5bbc39[_0x14797e[_0x0b81('0x29')]]={'$like':'%'+_0x5e2762[_0x0b81('0x2f')][_0x0b81('0x38')]+'%'};return _0x5bbc39;}})});}_0x1d72ab=_[_0x0b81('0x39')]({},_0x1d72ab,_0x5e2762[_0x0b81('0x3b')]);var _0x16addd={'where':_0x1d72ab[_0x0b81('0x36')]};return db[_0x0b81('0x2c')][_0x0b81('0x20')](_0x16addd)[_0x0b81('0x25')](function(_0x435376){_0xedd005[_0x0b81('0x20')]=_0x435376;if(_0x5e2762[_0x0b81('0x2f')][_0x0b81('0x3c')]){_0x1d72ab[_0x0b81('0x3d')]=[{'all':!![]}];}return db[_0x0b81('0x2c')][_0x0b81('0x3e')](_0x1d72ab);})[_0x0b81('0x25')](function(_0x20ede9){_0xedd005[_0x0b81('0x3f')]=_0x20ede9;return _0xedd005;})['then'](respondWithFilteredResult(_0x24886b,_0x1d72ab))[_0x0b81('0x40')](handleError(_0x24886b,null));};exports[_0x0b81('0x41')]=function(_0x398843,_0x96fcee){var _0x313f4e={'raw':!![],'where':{'id':_0x398843[_0x0b81('0x42')]['id']}},_0x599c88={};_0x599c88[_0x0b81('0x2e')]=_[_0x0b81('0x30')](db[_0x0b81('0x2c')]['rawAttributes']);_0x599c88[_0x0b81('0x2f')]=_[_0x0b81('0x30')](_0x398843[_0x0b81('0x2f')]);_0x599c88[_0x0b81('0x37')]=_['intersection'](_0x599c88['model'],_0x599c88[_0x0b81('0x2f')]);_0x313f4e['attributes']=_['intersection'](_0x599c88[_0x0b81('0x2e')],qs[_0x0b81('0x32')](_0x398843[_0x0b81('0x2f')][_0x0b81('0x32')]));_0x313f4e['attributes']=_0x313f4e['attributes'][_0x0b81('0x43')]?_0x313f4e[_0x0b81('0x33')]:_0x599c88[_0x0b81('0x2e')];if(_0x398843['query']['includeAll']){_0x313f4e[_0x0b81('0x3d')]=[{'all':!![]}];}_0x313f4e=_[_0x0b81('0x39')]({},_0x313f4e,_0x398843[_0x0b81('0x3b')]);return db['VoiceQueuesLog'][_0x0b81('0x44')](_0x313f4e)[_0x0b81('0x25')](handleEntityNotFound(_0x96fcee,null))[_0x0b81('0x25')](respondWithResult(_0x96fcee,null))[_0x0b81('0x40')](handleError(_0x96fcee,null));};exports[_0x0b81('0x45')]=function(_0x19bc04,_0x34ffeb){return db[_0x0b81('0x2c')][_0x0b81('0x45')](_0x19bc04[_0x0b81('0x46')],{})[_0x0b81('0x25')](respondWithResult(_0x34ffeb,0xc9))[_0x0b81('0x40')](handleError(_0x34ffeb,null));};exports['update']=function(_0x3c2900,_0x1909bc){if(_0x3c2900['body']['id']){delete _0x3c2900[_0x0b81('0x46')]['id'];}return db[_0x0b81('0x2c')]['find']({'where':{'id':_0x3c2900['params']['id']}})[_0x0b81('0x25')](handleEntityNotFound(_0x1909bc,null))[_0x0b81('0x25')](saveUpdates(_0x3c2900['body'],null))[_0x0b81('0x25')](respondWithResult(_0x1909bc,null))[_0x0b81('0x40')](handleError(_0x1909bc,null));};exports[_0x0b81('0x26')]=function(_0x4ca438,_0x12d60f){return db['VoiceQueuesLog']['find']({'where':{'id':_0x4ca438[_0x0b81('0x42')]['id']}})['then'](handleEntityNotFound(_0x12d60f,null))[_0x0b81('0x25')](removeEntity(_0x12d60f,null))[_0x0b81('0x40')](handleError(_0x12d60f,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 2ce13b6..f9e7c27 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 _0x31ee=['./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','util','../../config/logger','api','request-promise','rimraf'];(function(_0xf66a25,_0x527689){var _0x231422=function(_0x164b05){while(--_0x164b05){_0xf66a25['push'](_0xf66a25['shift']());}};_0x231422(++_0x527689);}(_0x31ee,0x181));var _0xe31e=function(_0x52bcac,_0xb309cb){_0x52bcac=_0x52bcac-0x0;var _0x29e404=_0x31ee[_0x52bcac];return _0x29e404;};'use strict';var _=require('lodash');var util=require(_0xe31e('0x0'));var logger=require(_0xe31e('0x1'))(_0xe31e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe31e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe31e('0x4'));var config=require('../../config/environment');var attributes=require(_0xe31e('0x5'));module[_0xe31e('0x6')]=function(_0x326bc5,_0x5b2d9a){return _0x326bc5[_0xe31e('0x7')](_0xe31e('0x8'),attributes,{'tableName':_0xe31e('0x9'),'paranoid':![],'indexes':[{'name':_0xe31e('0xa'),'fields':[_0xe31e('0xb'),_0xe31e('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1aee=['bluebird','request-promise','rimraf','./voiceQueuesLog.attributes','VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','util','../../config/logger','moment'];(function(_0x4f0f1e,_0x49cc0f){var _0x3f6826=function(_0x55744e){while(--_0x55744e){_0x4f0f1e['push'](_0x4f0f1e['shift']());}};_0x3f6826(++_0x49cc0f);}(_0x1aee,0x1d0));var _0xe1ae=function(_0x19e928,_0x26a0e4){_0x19e928=_0x19e928-0x0;var _0x4e941f=_0x1aee[_0x19e928];return _0x4e941f;};'use strict';var _=require(_0xe1ae('0x0'));var util=require(_0xe1ae('0x1'));var logger=require(_0xe1ae('0x2'))('api');var moment=require(_0xe1ae('0x3'));var BPromise=require(_0xe1ae('0x4'));var rp=require(_0xe1ae('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe1ae('0x6'));var config=require('../../config/environment');var attributes=require(_0xe1ae('0x7'));module['exports']=function(_0x1c1d1e,_0x5351e9){return _0x1c1d1e['define'](_0xe1ae('0x8'),attributes,{'tableName':_0xe1ae('0x9'),'paranoid':![],'indexes':[{'name':_0xe1ae('0xa'),'fields':[_0xe1ae('0xb'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index a379a61..2aba0ac 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 _0x2516=['client','http','request','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2cb50c,_0x300e63){var _0x1d20e1=function(_0x4bcf9f){while(--_0x4bcf9f){_0x2cb50c['push'](_0x2cb50c['shift']());}};_0x1d20e1(++_0x300e63);}(_0x2516,0x9d));var _0x6251=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x2516[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x6251('0x0'));var util=require(_0x6251('0x1'));var moment=require(_0x6251('0x2'));var BPromise=require(_0x6251('0x3'));var rs=require(_0x6251('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6251('0x5'))['db'];var utils=require(_0x6251('0x6'));var logger=require(_0x6251('0x7'))(_0x6251('0x8'));var config=require(_0x6251('0x9'));var jayson=require(_0x6251('0xa'));var client=jayson[_0x6251('0xb')][_0x6251('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x279080,_0x3bb767,_0x144f7e){return new BPromise(function(_0x38e845,_0x1a5b28){return client[_0x6251('0xd')](_0x279080,_0x144f7e)[_0x6251('0xe')](function(_0x241324){logger[_0x6251('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3bb767,_0x6251('0x10'));logger[_0x6251('0x11')](_0x6251('0x12'),_0x3bb767,_0x6251('0x10'),JSON[_0x6251('0x13')](_0x241324));if(_0x241324[_0x6251('0x14')]){if(_0x241324[_0x6251('0x14')]['code']===0x1f4){logger[_0x6251('0x14')](_0x6251('0x15'),_0x3bb767,_0x241324[_0x6251('0x14')][_0x6251('0x16')]);return _0x1a5b28(_0x241324[_0x6251('0x14')][_0x6251('0x16')]);}logger[_0x6251('0x14')](_0x6251('0x15'),_0x3bb767,_0x241324['error'][_0x6251('0x16')]);return _0x38e845(_0x241324[_0x6251('0x14')][_0x6251('0x16')]);}else{logger[_0x6251('0xf')](_0x6251('0x15'),_0x3bb767,'request\x20sent');_0x38e845(_0x241324[_0x6251('0x17')][_0x6251('0x16')]);}})['catch'](function(_0x38f7da){logger[_0x6251('0x14')](_0x6251('0x15'),_0x3bb767,_0x38f7da);_0x1a5b28(_0x38f7da);});});} \ No newline at end of file +var _0xb3cd=['request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http'];(function(_0x3dd158,_0x4421d4){var _0x1f9b8c=function(_0x7c3b94){while(--_0x7c3b94){_0x3dd158['push'](_0x3dd158['shift']());}};_0x1f9b8c(++_0x4421d4);}(_0xb3cd,0xae));var _0xdb3c=function(_0x1757f2,_0x1b09fa){_0x1757f2=_0x1757f2-0x0;var _0x5e7212=_0xb3cd[_0x1757f2];return _0x5e7212;};'use strict';var _=require('lodash');var util=require(_0xdb3c('0x0'));var moment=require(_0xdb3c('0x1'));var BPromise=require(_0xdb3c('0x2'));var rs=require(_0xdb3c('0x3'));var fs=require('fs');var Redis=require(_0xdb3c('0x4'));var db=require(_0xdb3c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb3c('0x6'))(_0xdb3c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdb3c('0x8')][_0xdb3c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b13e3,_0xaf6862,_0x5490aa){return new BPromise(function(_0x17ed6e,_0xeaf1a5){return client[_0xdb3c('0xa')](_0x3b13e3,_0x5490aa)[_0xdb3c('0xb')](function(_0x31e824){logger[_0xdb3c('0xc')](_0xdb3c('0xd'),_0xaf6862,_0xdb3c('0xe'));logger[_0xdb3c('0xf')](_0xdb3c('0x10'),_0xaf6862,_0xdb3c('0xe'),JSON[_0xdb3c('0x11')](_0x31e824));if(_0x31e824[_0xdb3c('0x12')]){if(_0x31e824[_0xdb3c('0x12')][_0xdb3c('0x13')]===0x1f4){logger[_0xdb3c('0x12')](_0xdb3c('0xd'),_0xaf6862,_0x31e824[_0xdb3c('0x12')][_0xdb3c('0x14')]);return _0xeaf1a5(_0x31e824[_0xdb3c('0x12')][_0xdb3c('0x14')]);}logger['error'](_0xdb3c('0xd'),_0xaf6862,_0x31e824[_0xdb3c('0x12')]['message']);return _0x17ed6e(_0x31e824[_0xdb3c('0x12')][_0xdb3c('0x14')]);}else{logger[_0xdb3c('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0xaf6862,_0xdb3c('0xe'));_0x17ed6e(_0x31e824[_0xdb3c('0x15')][_0xdb3c('0x14')]);}})[_0xdb3c('0x16')](function(_0x2c7ee4){logger[_0xdb3c('0x12')](_0xdb3c('0xd'),_0xaf6862,_0x2c7ee4);_0xeaf1a5(_0x2c7ee4);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 85b9f67..b40773a 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 _0xb64b=['/:id/downloads','downloadTranscribe','create','post','runTranscribe','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','/describe','describe','/:id','isAuthenticated','show','/:id/download','download'];(function(_0x2716c6,_0x1a492f){var _0x536cb0=function(_0x5067e3){while(--_0x5067e3){_0x2716c6['push'](_0x2716c6['shift']());}};_0x536cb0(++_0x1a492f);}(_0xb64b,0xe9));var _0xbb64=function(_0x4d82e1,_0x5ac72b){_0x4d82e1=_0x4d82e1-0x0;var _0x5f3bd9=_0xb64b[_0x4d82e1];return _0x5f3bd9;};'use strict';var multer=require(_0xbb64('0x0'));var util=require(_0xbb64('0x1'));var path=require(_0xbb64('0x2'));var timeout=require(_0xbb64('0x3'));var express=require(_0xbb64('0x4'));var router=express[_0xbb64('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbb64('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbb64('0x7'));var controller=require(_0xbb64('0x8'));router[_0xbb64('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbb64('0x9')](_0xbb64('0xa'),auth['isAuthenticated'](),controller[_0xbb64('0xb')]);router[_0xbb64('0x9')](_0xbb64('0xc'),auth[_0xbb64('0xd')](),controller[_0xbb64('0xe')]);router[_0xbb64('0x9')](_0xbb64('0xf'),auth[_0xbb64('0xd')](),controller[_0xbb64('0x10')]);router[_0xbb64('0x9')](_0xbb64('0x11'),controller['downloads']);router[_0xbb64('0x9')]('/:id/transcribe',auth[_0xbb64('0xd')](),controller[_0xbb64('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbb64('0x13')]);router[_0xbb64('0x14')]('/:id/transcribe',auth[_0xbb64('0xd')](),controller[_0xbb64('0x15')]);router[_0xbb64('0x16')](_0xbb64('0xc'),auth['isAuthenticated'](),controller[_0xbb64('0x17')]);router['delete']('/:id',auth[_0xbb64('0xd')](),controller[_0xbb64('0x18')]);module['exports']=router; \ No newline at end of file +var _0x31f3=['post','create','runTranscribe','put','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','downloads','/:id/transcribe'];(function(_0x5f447d,_0x27c228){var _0x38e9ac=function(_0x2ba40e){while(--_0x2ba40e){_0x5f447d['push'](_0x5f447d['shift']());}};_0x38e9ac(++_0x27c228);}(_0x31f3,0x97));var _0x331f=function(_0x3c0e33,_0x4e9903){_0x3c0e33=_0x3c0e33-0x0;var _0x48d10c=_0x31f3[_0x3c0e33];return _0x48d10c;};'use strict';var multer=require('multer');var util=require(_0x331f('0x0'));var path=require(_0x331f('0x1'));var timeout=require(_0x331f('0x2'));var express=require(_0x331f('0x3'));var router=express['Router']();var fs_extra=require(_0x331f('0x4'));var auth=require(_0x331f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x331f('0x6'));var controller=require(_0x331f('0x7'));router[_0x331f('0x8')]('/',auth[_0x331f('0x9')](),controller['index']);router[_0x331f('0x8')](_0x331f('0xa'),auth[_0x331f('0x9')](),controller[_0x331f('0xb')]);router[_0x331f('0x8')](_0x331f('0xc'),auth['isAuthenticated'](),controller[_0x331f('0xd')]);router[_0x331f('0x8')](_0x331f('0xe'),auth['isAuthenticated'](),controller['download']);router[_0x331f('0x8')]('/:id/downloads',controller[_0x331f('0xf')]);router[_0x331f('0x8')](_0x331f('0x10'),auth[_0x331f('0x9')](),controller['downloadTranscribe']);router[_0x331f('0x11')]('/',auth['isAuthenticated'](),controller[_0x331f('0x12')]);router['post'](_0x331f('0x10'),auth[_0x331f('0x9')](),controller[_0x331f('0x13')]);router[_0x331f('0x14')]('/:id',auth[_0x331f('0x9')](),controller[_0x331f('0x15')]);router[_0x331f('0x16')](_0x331f('0xc'),auth[_0x331f('0x9')](),controller['destroy']);module[_0x331f('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 48073b5..acb3f52 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(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 ed23935..6342f5a 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 _0xe4cf=['runSentiment','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','fs-extra','lodash','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','name','send','index','map','VoiceRecording','fieldName','key','model','differenceBy','format','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','rawAttributes','length','include','find','catch','create','body','describe','../../components/encryptor','uniqueid','value','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','extname','download','message','Not\x20found','downloads','sequelize','token','push','$and','%s.cypher','secrets','filename','unlink','isNil','Entity\x20not\x20found','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeRegion','Transcribe\x20not\x20configured'];(function(_0x5d8ef7,_0x39109a){var _0x4b4070=function(_0x464a0a){while(--_0x464a0a){_0x5d8ef7['push'](_0x5d8ef7['shift']());}};_0x4b4070(++_0x39109a);}(_0xe4cf,0x141));var _0xfe4c=function(_0x431b45,_0x40b3c8){_0x431b45=_0x431b45-0x0;var _0x21b559=_0xe4cf[_0x431b45];return _0x21b559;};'use strict';var emlformat=require(_0xfe4c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfe4c('0x1'));var rp=require(_0xfe4c('0x2'));var moment=require(_0xfe4c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfe4c('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xfe4c('0x5'));var ejs=require(_0xfe4c('0x6'));var fs=require('fs');var fs_extra=require(_0xfe4c('0x7'));var _=require(_0xfe4c('0x8'));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(_0xfe4c('0x9'));var AWS=require(_0xfe4c('0xa'));var uuidv4=require(_0xfe4c('0xb'));var Redis=require('ioredis');var authService=require(_0xfe4c('0xc'));var qs=require(_0xfe4c('0xd'));var as=require(_0xfe4c('0xe'));var hardwareService=require(_0xfe4c('0xf'));var logger=require(_0xfe4c('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xfe4c('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe4c('0x12'))['db'];function respondWithStatusCode(_0xeb317e,_0x4b50de){_0x4b50de=_0x4b50de||0xcc;return function(_0x13610f){if(_0x13610f){return _0xeb317e[_0xfe4c('0x13')](_0x4b50de);}return _0xeb317e[_0xfe4c('0x14')](_0x4b50de)[_0xfe4c('0x15')]();};}function respondWithResult(_0x5575da,_0x5953ff){_0x5953ff=_0x5953ff||0xc8;return function(_0x55868e){if(_0x55868e){return _0x5575da[_0xfe4c('0x14')](_0x5953ff)[_0xfe4c('0x16')](_0x55868e);}};}function respondWithFilteredResult(_0x2b844b,_0x1f1d46){return function(_0xbd280a){if(_0xbd280a){var _0xe58903=typeof _0x1f1d46[_0xfe4c('0x17')]===_0xfe4c('0x18')&&typeof _0x1f1d46['limit']===_0xfe4c('0x18');var _0x36a7fe=_0xbd280a['count'];var _0x270021=_0xe58903?0x0:_0x1f1d46[_0xfe4c('0x17')];var _0x4ecb80=_0xe58903?_0xbd280a[_0xfe4c('0x19')]:_0x1f1d46['offset']+_0x1f1d46[_0xfe4c('0x1a')];var _0x311e97;if(_0x4ecb80>=_0x36a7fe){_0x4ecb80=_0x36a7fe;_0x311e97=0xc8;}else{_0x311e97=0xce;}_0x2b844b[_0xfe4c('0x14')](_0x311e97);return _0x2b844b[_0xfe4c('0x1b')](_0xfe4c('0x1c'),_0x270021+'-'+_0x4ecb80+'/'+_0x36a7fe)[_0xfe4c('0x16')](_0xbd280a);}return null;};}function patchUpdates(_0x556330){return function(_0x3b0aae){try{jsonpatch['apply'](_0x3b0aae,_0x556330,!![]);}catch(_0x4a873b){return BPromise[_0xfe4c('0x1d')](_0x4a873b);}return _0x3b0aae[_0xfe4c('0x1e')]();};}function saveUpdates(_0x24a37e,_0x1a2351){return function(_0x1c60e4){if(_0x1c60e4){return _0x1c60e4[_0xfe4c('0x1f')](_0x24a37e)[_0xfe4c('0x20')](function(_0x32cb62){return _0x32cb62;});}return null;};}function removeEntity(_0x11812b,_0x28b8bc){return function(_0x551d3b){if(_0x551d3b){return _0x551d3b[_0xfe4c('0x21')]()[_0xfe4c('0x20')](function(){_0x11812b[_0xfe4c('0x14')](0xcc)[_0xfe4c('0x15')]();});}};}function handleEntityNotFound(_0x500117,_0x41bbca){return function(_0x83f0c){if(!_0x83f0c){_0x500117['sendStatus'](0x194);}return _0x83f0c;};}function handleError(_0x2c28fe,_0x3a1b56){_0x3a1b56=_0x3a1b56||0x1f4;return function(_0xf8ff4e){logger['error'](_0xf8ff4e['stack']);if(_0xf8ff4e[_0xfe4c('0x22')]){delete _0xf8ff4e[_0xfe4c('0x22')];}_0x2c28fe[_0xfe4c('0x14')](_0x3a1b56)[_0xfe4c('0x23')](_0xf8ff4e);};}exports[_0xfe4c('0x24')]=function(_0x5f1d8f,_0x246c5b){var _0x105709={},_0x348907={},_0x3630ac={'count':0x0,'rows':[]};var _0x4c64f1=_[_0xfe4c('0x25')](db[_0xfe4c('0x26')]['rawAttributes'],function(_0x3af016){return{'name':_0x3af016[_0xfe4c('0x27')],'type':_0x3af016['type'][_0xfe4c('0x28')]};});_0x348907[_0xfe4c('0x29')]=_[_0xfe4c('0x2a')](_['map'](_0x4c64f1,'name'),[_0xfe4c('0x2b')]);_0x348907[_0xfe4c('0x2c')]=_[_0xfe4c('0x2d')](_0x5f1d8f[_0xfe4c('0x2c')]);_0x348907[_0xfe4c('0x2e')]=_[_0xfe4c('0x2f')](_0x348907[_0xfe4c('0x29')],_0x348907[_0xfe4c('0x2c')]);_0x105709['attributes']=_['intersection'](_0x348907[_0xfe4c('0x29')],qs[_0xfe4c('0x30')](_0x5f1d8f[_0xfe4c('0x2c')][_0xfe4c('0x30')]));_0x105709[_0xfe4c('0x31')]=_0x105709[_0xfe4c('0x31')]['length']?_0x105709[_0xfe4c('0x31')]:_0x348907[_0xfe4c('0x29')];if(!_0x5f1d8f[_0xfe4c('0x2c')][_0xfe4c('0x32')](_0xfe4c('0x33'))){_0x105709[_0xfe4c('0x1a')]=qs[_0xfe4c('0x1a')](_0x5f1d8f[_0xfe4c('0x2c')][_0xfe4c('0x1a')]);_0x105709[_0xfe4c('0x17')]=qs['offset'](_0x5f1d8f[_0xfe4c('0x2c')][_0xfe4c('0x17')]);}_0x105709[_0xfe4c('0x34')]=qs['sort'](_0x5f1d8f[_0xfe4c('0x2c')][_0xfe4c('0x35')]);_0x105709['where']=qs[_0xfe4c('0x2e')](_[_0xfe4c('0x36')](_0x5f1d8f[_0xfe4c('0x2c')],_0x348907[_0xfe4c('0x2e')]),_0x4c64f1);if(_0x5f1d8f[_0xfe4c('0x2c')][_0xfe4c('0x37')]){_0x105709[_0xfe4c('0x38')]=_['merge'](_0x105709['where'],{'$or':_[_0xfe4c('0x25')](_0x4c64f1,function(_0x369226){if(_0x369226[_0xfe4c('0x39')]!==_0xfe4c('0x3a')){var _0x4a9e8b={};_0x4a9e8b[_0x369226[_0xfe4c('0x22')]]={'$like':'%'+_0x5f1d8f[_0xfe4c('0x2c')][_0xfe4c('0x37')]+'%'};return _0x4a9e8b;}})});}_0x105709=_[_0xfe4c('0x3b')]({},_0x105709,_0x5f1d8f[_0xfe4c('0x3c')]);var _0x362956={'where':_0x105709[_0xfe4c('0x38')]};return db[_0xfe4c('0x26')][_0xfe4c('0x19')](_0x362956)['then'](function(_0x17b52d){_0x3630ac['count']=_0x17b52d;if(_0x5f1d8f[_0xfe4c('0x2c')][_0xfe4c('0x3d')]){_0x105709['include']=[{'all':!![]}];}return db[_0xfe4c('0x26')][_0xfe4c('0x3e')](_0x105709);})[_0xfe4c('0x20')](function(_0x3aa6a8){_0x3630ac[_0xfe4c('0x3f')]=_0x3aa6a8;return _0x3630ac;})['then'](respondWithFilteredResult(_0x246c5b,_0x105709))['catch'](handleError(_0x246c5b,null));};exports[_0xfe4c('0x40')]=function(_0xb382c1,_0x586a2c){var _0x5aeebb={'raw':![],'where':{'id':_0xb382c1[_0xfe4c('0x41')]['id']}},_0x2848e9={};_0x2848e9[_0xfe4c('0x29')]=_[_0xfe4c('0x2d')](db[_0xfe4c('0x26')][_0xfe4c('0x42')]);_0x2848e9[_0xfe4c('0x2c')]=_[_0xfe4c('0x2d')](_0xb382c1[_0xfe4c('0x2c')]);_0x2848e9[_0xfe4c('0x2e')]=_[_0xfe4c('0x2f')](_0x2848e9['model'],_0x2848e9[_0xfe4c('0x2c')]);_0x5aeebb[_0xfe4c('0x31')]=_[_0xfe4c('0x2f')](_0x2848e9[_0xfe4c('0x29')],qs[_0xfe4c('0x30')](_0xb382c1[_0xfe4c('0x2c')][_0xfe4c('0x30')]));_0x5aeebb[_0xfe4c('0x31')]=_0x5aeebb['attributes'][_0xfe4c('0x43')]?_0x5aeebb[_0xfe4c('0x31')]:_0x2848e9[_0xfe4c('0x29')];if(_0xb382c1[_0xfe4c('0x2c')][_0xfe4c('0x3d')]){_0x5aeebb[_0xfe4c('0x44')]=[{'all':!![]}];}_0x5aeebb=_[_0xfe4c('0x3b')]({},_0x5aeebb,_0xb382c1[_0xfe4c('0x3c')]);return db[_0xfe4c('0x26')][_0xfe4c('0x45')](_0x5aeebb)[_0xfe4c('0x20')](handleEntityNotFound(_0x586a2c,null))[_0xfe4c('0x20')](respondWithResult(_0x586a2c,null))[_0xfe4c('0x46')](handleError(_0x586a2c,null));};exports['create']=function(_0x4b77fc,_0xd88a97){return db[_0xfe4c('0x26')][_0xfe4c('0x47')](_0x4b77fc[_0xfe4c('0x48')],{})[_0xfe4c('0x20')](respondWithResult(_0xd88a97,0xc9))['catch'](handleError(_0xd88a97,null));};exports[_0xfe4c('0x1f')]=function(_0x32df7b,_0x1a4b6f){if(_0x32df7b['body']['id']){delete _0x32df7b['body']['id'];}return db[_0xfe4c('0x26')][_0xfe4c('0x45')]({'where':{'id':_0x32df7b[_0xfe4c('0x41')]['id']}})[_0xfe4c('0x20')](handleEntityNotFound(_0x1a4b6f,null))[_0xfe4c('0x20')](saveUpdates(_0x32df7b[_0xfe4c('0x48')],null))[_0xfe4c('0x20')](respondWithResult(_0x1a4b6f,null))[_0xfe4c('0x46')](handleError(_0x1a4b6f,null));};exports['describe']=function(_0x3a1aa3,_0x35a3e7){return db[_0xfe4c('0x26')][_0xfe4c('0x49')]()[_0xfe4c('0x20')](respondWithResult(_0x35a3e7,null))[_0xfe4c('0x46')](handleError(_0x35a3e7,null));};exports['download']=function(_0x7ff6bd,_0x5164ad,_0x2b1774){var _0x45716b=require(_0xfe4c('0x4a'));var _0x50e6fa=![];var _0x4e7615={};if(_0x7ff6bd[_0xfe4c('0x2c')][_0xfe4c('0x39')]&&_0x7ff6bd[_0xfe4c('0x2c')][_0xfe4c('0x39')]===_0xfe4c('0x4b')){_0x4e7615['uniqueid']=_0x7ff6bd[_0xfe4c('0x41')]['id'];}else{_0x4e7615['id']=_0x7ff6bd[_0xfe4c('0x41')]['id'];}return db['VoiceRecording'][_0xfe4c('0x45')]({'where':_0x4e7615,'attributes':['id',_0xfe4c('0x4c')],'raw':!![]})[_0xfe4c('0x20')](handleEntityNotFound(_0x5164ad,null))[_0xfe4c('0x20')](function(_0x341a7f){if(_0x341a7f){var _0x59c0bf=_0x341a7f[_0xfe4c('0x4c')];var _0x2fa11b=util['format']('%s.cypher',_0x59c0bf);if(fs[_0xfe4c('0x4d')](_0x2fa11b)){_0x50e6fa=!![];return _0x45716b[_0xfe4c('0x4e')](_0x2fa11b,_0x59c0bf,config['secrets'][_0xfe4c('0x4f')])[_0xfe4c('0x20')](function(){return _0x341a7f;});}return _0x341a7f;}})[_0xfe4c('0x20')](function(_0x383c82){if(_0x383c82){var _0xdc461b=_0x383c82[_0xfe4c('0x4c')];if(!fs[_0xfe4c('0x4d')](_0xdc461b)){throw new db[(_0xfe4c('0x50'))][(_0xfe4c('0x51'))](_0xfe4c('0x52'));}if(_0x383c82['filename']){return _0x5164ad['download'](_0xdc461b,_0x383c82['filename']+path[_0xfe4c('0x53')](_0xdc461b),function(){if(_0x50e6fa){fs['unlink'](_0xdc461b);}});}else{return _0x5164ad[_0xfe4c('0x54')](_0xdc461b,function(_0x574270){if(_0x50e6fa){fs['unlink'](_0xdc461b);}});}}})[_0xfe4c('0x46')](function(_0x9fd052){if(_0x9fd052[_0xfe4c('0x55')]===_0xfe4c('0x52')){_0x5164ad['status'](0x194)[_0xfe4c('0x23')](_0xfe4c('0x56'));}else{return handleError(_0x5164ad,null);}});};exports[_0xfe4c('0x57')]=function(_0x4903ee,_0x355d06,_0x36e4f8){var _0xd683c3=require('../../components/encryptor');var _0x47dca4=![];var _0x5bed8b={'$and':[db['sequelize']['where'](db[_0xfe4c('0x58')]['fn']('MD5',db['sequelize']['col'](_0xfe4c('0x4b'))),_0x4903ee[_0xfe4c('0x2c')][_0xfe4c('0x59')])]};if(_0x4903ee[_0xfe4c('0x2c')][_0xfe4c('0x39')]&&_0x4903ee[_0xfe4c('0x2c')][_0xfe4c('0x39')]===_0xfe4c('0x4b')){_0x5bed8b['$and'][_0xfe4c('0x5a')]({'uniqueid':_0x4903ee[_0xfe4c('0x41')]['id']});}else{_0x5bed8b[_0xfe4c('0x5b')][_0xfe4c('0x5a')]({'id':_0x4903ee[_0xfe4c('0x41')]['id']});}return db['VoiceRecording']['find']({'where':_0x5bed8b,'attributes':['id',_0xfe4c('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x355d06,null))['then'](function(_0x210cab){if(_0x210cab){var _0xe49a6a=util[_0xfe4c('0x2b')](_0xfe4c('0x5c'),_0x210cab['value']);if(fs[_0xfe4c('0x4d')](_0xe49a6a)){_0x47dca4=!![];return _0xd683c3[_0xfe4c('0x4e')](_0xe49a6a,_0x210cab[_0xfe4c('0x4c')],config[_0xfe4c('0x5d')][_0xfe4c('0x4f')])['then'](function(){return _0x210cab;});}return _0x210cab;}})[_0xfe4c('0x20')](function(_0x2651ae){if(_0x2651ae){if(!fs[_0xfe4c('0x4d')](_0x2651ae[_0xfe4c('0x4c')])){throw new db[(_0xfe4c('0x50'))][(_0xfe4c('0x51'))](_0xfe4c('0x52'));}if(_0x2651ae[_0xfe4c('0x5e')]){return _0x355d06['download'](_0x2651ae[_0xfe4c('0x4c')],_0x2651ae[_0xfe4c('0x5e')]+path[_0xfe4c('0x53')](_0x2651ae['value']),function(){if(_0x47dca4){fs[_0xfe4c('0x5f')](_0x2651ae[_0xfe4c('0x4c')]);}});}else{return _0x355d06[_0xfe4c('0x54')](_0x2651ae[_0xfe4c('0x4c')],function(_0x4d62f2){if(_0x47dca4){fs['unlink'](_0x2651ae[_0xfe4c('0x4c')]);}});}}})[_0xfe4c('0x46')](handleError(_0x355d06,null));};exports[_0xfe4c('0x21')]=function(_0x5df260,_0x412f20){return db[_0xfe4c('0x26')][_0xfe4c('0x45')]({'where':{'id':_0x5df260[_0xfe4c('0x41')]['id']}})[_0xfe4c('0x20')](function(_0x2c9d47){if(_[_0xfe4c('0x60')](_0x2c9d47)){throw new ReferenceError(_0xfe4c('0x61'));}return _0x2c9d47;})[_0xfe4c('0x20')](function(_0x1d73e7){var _0x2043db=_0x1d73e7[_0xfe4c('0x4c')];logger[_0xfe4c('0x62')]('cancellazione\x20fisica\x20documento\x20%s',_0x2043db);if(!_[_0xfe4c('0x60')](_0x1d73e7['value'])&&fs[_0xfe4c('0x4d')](_0x2043db)){logger['info'](_0xfe4c('0x63')+_0x2043db+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xfe4c('0x64')](_0x2043db);}_0x2043db=_0x2043db+_0xfe4c('0x65');if(!_[_0xfe4c('0x60')](_0x1d73e7[_0xfe4c('0x4c')])&&fs[_0xfe4c('0x4d')](_0x2043db)){logger[_0xfe4c('0x62')]('File:\x20\x22'+_0x2043db+_0xfe4c('0x66'));fs[_0xfe4c('0x64')](_0x2043db);}return _0x1d73e7;})[_0xfe4c('0x20')](function(_0x6bed43){if(!_0x6bed43)throw new InternalError();return _0x6bed43['destroy']();})[_0xfe4c('0x20')](function(){_0x412f20[_0xfe4c('0x14')](0xcc)[_0xfe4c('0x15')]();})[_0xfe4c('0x46')](handleError(_0x412f20,null));};function getBucketslist(_0x24e0e7,_0x5de759,_0xee68e4){return new Promise(function(_0x142d53,_0x31ba18){var _0x24ada2=new AWS['S3']({'accessKeyId':_0x5de759,'secretAccessKey':_0x24e0e7,'region':_0xee68e4});_0x24ada2[_0xfe4c('0x67')]({},function(_0x12f62d,_0x4eec1c){if(_0x12f62d){return _0x31ba18(_0x12f62d);}else{return _0x142d53(_0x4eec1c);}});});}function createBucket(_0x1eaad7,_0x10c187,_0x188c1a,_0x2fa0e8){return new Promise(function(_0x2eb111,_0x307add){var _0x5a2fcf=new AWS['S3']({'accessKeyId':_0x10c187,'secretAccessKey':_0x1eaad7,'region':_0x188c1a});_0x5a2fcf['createBucket']({'Bucket':_0x2fa0e8},function(_0x7c80cc,_0xc2b297){if(_0x7c80cc){return _0x307add(_0x7c80cc);}else{return _0x2eb111(_0xc2b297);}});});}function uploadFile(_0x2eefc9,_0x4933da,_0x8eb0e6,_0x5706c9,_0x16cbef,_0xbd0857){return new Promise(function(_0x6b6e57,_0x3d3a18){var _0x325e57=new AWS['S3']({'accessKeyId':_0x4933da,'secretAccessKey':_0x2eefc9,'region':_0x8eb0e6});_0x325e57[_0xfe4c('0x68')]({'Bucket':_0x5706c9,'Key':_0x16cbef,'Body':_0xbd0857},function(_0x32091a,_0x3c5cba){if(_0x32091a){return _0x3d3a18(_0x32091a);}else{return _0x6b6e57(_0x3c5cba);}});});}function startTranscribe(_0x1c04f7,_0x531fc5,_0xa3c37d,_0x4ac76b,_0x2a2076,_0x1071f2){return new Promise(function(_0x3c861b,_0x20455c){var _0x5cb21c=new AWS[(_0xfe4c('0x69'))]({'accessKeyId':_0x531fc5,'secretAccessKey':_0x1c04f7,'region':_0xa3c37d});_0x5cb21c[_0xfe4c('0x6a')]({'TranscriptionJobName':_0x4ac76b,'LanguageCode':_0x2a2076,'Media':{'MediaFileUri':_0x1071f2}},function(_0xb915c7,_0x144b23){if(_0xb915c7){return _0x20455c(_0xb915c7);}else{return _0x3c861b(_0x144b23);}});});}function transcribe(_0x1bdd91,_0x3d0f86,_0x5370cf,_0x22e3e9,_0x973261,_0x2f8c90,_0xb1cf3a){return new Promise(function(_0x3f1516,_0x66bbb2){var _0x65954d={};logger[_0xfe4c('0x62')](util[_0xfe4c('0x2b')](_0xfe4c('0x6b'),_0x1bdd91,_0x973261));return uploadFile(_0x3d0f86,_0x5370cf,_0x22e3e9,_0x973261,path[_0xfe4c('0x6c')](_0x2f8c90),fs[_0xfe4c('0x6d')](_0x2f8c90))[_0xfe4c('0x20')](function(_0x10b49b){logger[_0xfe4c('0x62')](util[_0xfe4c('0x2b')](_0xfe4c('0x6e'),_0x1bdd91,_0x973261,_0x10b49b[_0xfe4c('0x6f')]));_0x65954d[_0xfe4c('0x70')]=_0x10b49b[_0xfe4c('0x71')];_0x65954d[_0xfe4c('0x72')]=_0x10b49b[_0xfe4c('0x6f')];logger[_0xfe4c('0x62')](util[_0xfe4c('0x2b')](_0xfe4c('0x73'),_0x1bdd91));return startTranscribe(_0x3d0f86,_0x5370cf,_0x22e3e9,uuidv4(),_0xb1cf3a,_0x10b49b['Location']);})[_0xfe4c('0x20')](function(_0x209d7f){logger[_0xfe4c('0x62')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x1bdd91,_0x209d7f[_0xfe4c('0x74')][_0xfe4c('0x75')]));_0x65954d[_0xfe4c('0x76')]=_0x209d7f[_0xfe4c('0x74')][_0xfe4c('0x75')];_0x65954d[_0xfe4c('0x77')]=_0x209d7f[_0xfe4c('0x74')][_0xfe4c('0x78')];return _0x3f1516(_0x65954d);})['catch'](function(_0x1e3bfd){return _0x66bbb2(_0x1e3bfd);});});}exports['runTranscribe']=function(_0x4064b9,_0x15fbf2,_0x38c425){var _0x3eef4a;var _0x1c11db;var _0x4d0292;var _0x42a87b=require(_0xfe4c('0x4a'));return db[_0xfe4c('0x26')][_0xfe4c('0x79')]({'where':{'id':_0x4064b9[_0xfe4c('0x41')]['id']}})['then'](function(_0x20d260){if(_0x20d260){var _0x52f023=util[_0xfe4c('0x2b')]('%s.cypher',_0x20d260[_0xfe4c('0x4c')]);if(fs[_0xfe4c('0x4d')](_0x52f023)){cypher=!![];return _0x42a87b[_0xfe4c('0x4e')](_0x52f023,_0x20d260['value'],config['secrets'][_0xfe4c('0x4f')])['then'](function(){return _0x20d260;});}return _0x20d260;}})['then'](function(_0x1332c1){if(!_0x1332c1){throw new db['Sequelize'][(_0xfe4c('0x51'))](_0xfe4c('0x7a'));}_0x1c11db=_0x1332c1;return db[_0xfe4c('0x7b')][_0xfe4c('0x79')]({'where':{'id':0x1}});})[_0xfe4c('0x20')](handleEntityNotFound(_0x15fbf2,null))[_0xfe4c('0x20')](function(_0x2d58e1){if(_0x2d58e1){_0x3eef4a=_0x2d58e1;if(!_0x3eef4a['transcribe']||!_0x3eef4a['transcribeAccountId']||!_0x3eef4a[_0xfe4c('0x7c')]||!_0x3eef4a['language']||!_0x3eef4a[_0xfe4c('0x70')]){throw new db[(_0xfe4c('0x50'))][(_0xfe4c('0x51'))](_0xfe4c('0x7d'));}if(_0x4064b9[_0xfe4c('0x48')][_0xfe4c('0x7e')]&&(!_0x3eef4a[_0xfe4c('0x7f')]||!_0x3eef4a[_0xfe4c('0x80')]||!_0x3eef4a['sentimentRegion']||!_0x3eef4a[_0xfe4c('0x81')]||!_0x3eef4a[_0xfe4c('0x70')])){throw new db[(_0xfe4c('0x50'))]['ValidationError'](_0xfe4c('0x82'));}return db[_0xfe4c('0x83')][_0xfe4c('0x79')]({'where':{'id':_0x3eef4a[_0xfe4c('0x84')]}});}})[_0xfe4c('0x20')](function(_0x1dfaa0){if(!_0x1dfaa0){throw new db[(_0xfe4c('0x50'))][(_0xfe4c('0x51'))](_0xfe4c('0x85'));}if(!_0x1dfaa0[_0xfe4c('0x86')]||!_0x1dfaa0[_0xfe4c('0x87')]){throw new db[(_0xfe4c('0x50'))][(_0xfe4c('0x51'))]('Cloud\x20Provider\x20not\x20configured');}_0x4d0292=_0x1dfaa0;return getBucketslist(_0x4d0292[_0xfe4c('0x86')],_0x4d0292[_0xfe4c('0x87')],_0x3eef4a[_0xfe4c('0x7c')]);})[_0xfe4c('0x20')](function(_0x20eed4){if(_0x20eed4&&_0x20eed4[_0xfe4c('0x88')]){var _0xaa38d4=_[_0xfe4c('0x45')](_0x20eed4[_0xfe4c('0x88')],function(_0x5b0bd8){return _0x5b0bd8['Name']===_0x3eef4a['bucket'];});if(!_0xaa38d4){logger[_0xfe4c('0x62')](util[_0xfe4c('0x2b')](_0xfe4c('0x89'),_0x4064b9['params']['id'],_0x3eef4a[_0xfe4c('0x70')]));return createBucket(_0x4d0292[_0xfe4c('0x86')],_0x4d0292[_0xfe4c('0x87')],_0x3eef4a[_0xfe4c('0x7c')],_0x3eef4a[_0xfe4c('0x70')]);}logger[_0xfe4c('0x62')](util[_0xfe4c('0x2b')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x4064b9[_0xfe4c('0x41')]['id'],_0x3eef4a['bucket']));return;}})['then'](function(_0x3651a4){if(_0x1c11db[_0xfe4c('0x77')]===_0xfe4c('0x8a')){return transcribe(_0x4064b9[_0xfe4c('0x41')]['id'],_0x4d0292[_0xfe4c('0x86')],_0x4d0292['data2'],_0x3eef4a[_0xfe4c('0x7c')],_0x3eef4a[_0xfe4c('0x70')],_0x1c11db[_0xfe4c('0x4c')],_0x3eef4a[_0xfe4c('0x81')]);}else{logger[_0xfe4c('0x62')](util['format'](_0xfe4c('0x8b'),_0x4064b9[_0xfe4c('0x41')]['id']));return{'transcribeStatus':_0xfe4c('0x8c')};}})['then'](function(_0x451233){if(_0x451233){_0x451233[_0xfe4c('0x8d')]=_0x4064b9[_0xfe4c('0x48')][_0xfe4c('0x7e')];return _0x1c11db[_0xfe4c('0x8e')](_0x451233);}})[_0xfe4c('0x20')](respondWithResult(_0x15fbf2,null))['catch'](handleError(_0x15fbf2,null));};function writeFile(_0x23214c,_0xa5ddc1){return new Promise(function(_0x509765,_0x2062c0){fs[_0xfe4c('0x8f')](_0xa5ddc1,_0x23214c,function(_0x2a0660,_0x4e752a){if(_0x2a0660){return _0x2062c0(_0x2a0660);}else{return _0x509765(_0x4e752a);}});});}exports[_0xfe4c('0x90')]=function(_0x45178e,_0x3c0848,_0x1d25df){return db[_0xfe4c('0x26')][_0xfe4c('0x79')]({'where':{'id':_0x45178e['params']['id']}})[_0xfe4c('0x20')](handleEntityNotFound(_0x3c0848))[_0xfe4c('0x20')](function(_0x4260fe){if(_0x4260fe&&_0x4260fe[_0xfe4c('0x91')]){var _0x3b461b=_0x4260fe[_0xfe4c('0x91')];var _0x202336=config[_0xfe4c('0x92')]+_0xfe4c('0x93')+_0x4260fe['id']+'.txt';if(fs[_0xfe4c('0x4d')](_0x202336)){return _0x202336;}return writeFile(_0x3b461b,_0x202336)[_0xfe4c('0x20')](function(){return _0x202336;});}else{throw new db['Sequelize']['ValidationError'](_0xfe4c('0x94'));}})['then'](function(_0x3c1115){return _0x3c0848['download'](_0x3c1115);})[_0xfe4c('0x46')](handleError(_0x3c0848));}; \ No newline at end of file +var _0x503f=['then','sendStatus','name','send','index','VoiceRecording','rawAttributes','fieldName','type','key','differenceBy','map','format','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','merge','options','where','includeAll','include','findAll','rows','catch','params','find','create','body','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','col','token','$and','push','destroy','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','location','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','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','apply','save','update'];(function(_0x2fe193,_0x2b9afc){var _0x1b29f8=function(_0x25274c){while(--_0x25274c){_0x2fe193['push'](_0x2fe193['shift']());}};_0x1b29f8(++_0x2b9afc);}(_0x503f,0x6e));var _0xf503=function(_0x540084,_0x4e50a4){_0x540084=_0x540084-0x0;var _0x2681ea=_0x503f[_0x540084];return _0x2681ea;};'use strict';var emlformat=require(_0xf503('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf503('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf503('0x2'));var moment=require(_0xf503('0x3'));var BPromise=require(_0xf503('0x4'));var Mustache=require(_0xf503('0x5'));var util=require(_0xf503('0x6'));var path=require(_0xf503('0x7'));var sox=require(_0xf503('0x8'));var csv=require('to-csv');var ejs=require(_0xf503('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf503('0xa'));var squel=require(_0xf503('0xb'));var crypto=require(_0xf503('0xc'));var jsforce=require(_0xf503('0xd'));var deskjs=require(_0xf503('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf503('0xf'));var Papa=require(_0xf503('0x10'));var AWS=require(_0xf503('0x11'));var uuidv4=require(_0xf503('0x12'));var Redis=require(_0xf503('0x13'));var authService=require(_0xf503('0x14'));var qs=require(_0xf503('0x15'));var as=require(_0xf503('0x16'));var hardwareService=require(_0xf503('0x17'));var logger=require('../../config/logger')(_0xf503('0x18'));var utils=require(_0xf503('0x19'));var config=require(_0xf503('0x1a'));var licenseUtil=require(_0xf503('0x1b'));var db=require(_0xf503('0x1c'))['db'];function respondWithStatusCode(_0x4ff4b5,_0x58b47b){_0x58b47b=_0x58b47b||0xcc;return function(_0x4486e6){if(_0x4486e6){return _0x4ff4b5['sendStatus'](_0x58b47b);}return _0x4ff4b5[_0xf503('0x1d')](_0x58b47b)[_0xf503('0x1e')]();};}function respondWithResult(_0x1d01fe,_0x387f8c){_0x387f8c=_0x387f8c||0xc8;return function(_0xb6b3dd){if(_0xb6b3dd){return _0x1d01fe[_0xf503('0x1d')](_0x387f8c)[_0xf503('0x1f')](_0xb6b3dd);}};}function respondWithFilteredResult(_0xdff645,_0x216662){return function(_0xc3526d){if(_0xc3526d){var _0x3f02ca=typeof _0x216662[_0xf503('0x20')]===_0xf503('0x21')&&typeof _0x216662[_0xf503('0x22')]===_0xf503('0x21');var _0x14376f=_0xc3526d[_0xf503('0x23')];var _0x3133d7=_0x3f02ca?0x0:_0x216662[_0xf503('0x20')];var _0x3f1cc9=_0x3f02ca?_0xc3526d['count']:_0x216662[_0xf503('0x20')]+_0x216662['limit'];var _0x1de7c7;if(_0x3f1cc9>=_0x14376f){_0x3f1cc9=_0x14376f;_0x1de7c7=0xc8;}else{_0x1de7c7=0xce;}_0xdff645[_0xf503('0x1d')](_0x1de7c7);return _0xdff645[_0xf503('0x24')](_0xf503('0x25'),_0x3133d7+'-'+_0x3f1cc9+'/'+_0x14376f)['json'](_0xc3526d);}return null;};}function patchUpdates(_0x17c3f4){return function(_0x4712eb){try{jsonpatch[_0xf503('0x26')](_0x4712eb,_0x17c3f4,!![]);}catch(_0x4b98cb){return BPromise['reject'](_0x4b98cb);}return _0x4712eb[_0xf503('0x27')]();};}function saveUpdates(_0x10fa50,_0x5143d6){return function(_0x48e99d){if(_0x48e99d){return _0x48e99d[_0xf503('0x28')](_0x10fa50)['then'](function(_0x1615a1){return _0x1615a1;});}return null;};}function removeEntity(_0x23ac3c,_0x55bf8a){return function(_0x533008){if(_0x533008){return _0x533008['destroy']()[_0xf503('0x29')](function(){_0x23ac3c[_0xf503('0x1d')](0xcc)[_0xf503('0x1e')]();});}};}function handleEntityNotFound(_0x20ac06,_0x10713c){return function(_0x32000b){if(!_0x32000b){_0x20ac06[_0xf503('0x2a')](0x194);}return _0x32000b;};}function handleError(_0x1b0c73,_0x18bc7d){_0x18bc7d=_0x18bc7d||0x1f4;return function(_0xaf3147){logger['error'](_0xaf3147['stack']);if(_0xaf3147[_0xf503('0x2b')]){delete _0xaf3147['name'];}_0x1b0c73[_0xf503('0x1d')](_0x18bc7d)[_0xf503('0x2c')](_0xaf3147);};}exports[_0xf503('0x2d')]=function(_0x571c11,_0x1d507a){var _0x2a5c35={},_0x5e6039={},_0x1e43f0={'count':0x0,'rows':[]};var _0x189fe8=_['map'](db[_0xf503('0x2e')][_0xf503('0x2f')],function(_0x623fe1){return{'name':_0x623fe1[_0xf503('0x30')],'type':_0x623fe1[_0xf503('0x31')][_0xf503('0x32')]};});_0x5e6039['model']=_[_0xf503('0x33')](_[_0xf503('0x34')](_0x189fe8,'name'),[_0xf503('0x35')]);_0x5e6039[_0xf503('0x36')]=_[_0xf503('0x37')](_0x571c11[_0xf503('0x36')]);_0x5e6039[_0xf503('0x38')]=_[_0xf503('0x39')](_0x5e6039['model'],_0x5e6039['query']);_0x2a5c35[_0xf503('0x3a')]=_[_0xf503('0x39')](_0x5e6039[_0xf503('0x3b')],qs[_0xf503('0x3c')](_0x571c11[_0xf503('0x36')][_0xf503('0x3c')]));_0x2a5c35[_0xf503('0x3a')]=_0x2a5c35[_0xf503('0x3a')][_0xf503('0x3d')]?_0x2a5c35[_0xf503('0x3a')]:_0x5e6039[_0xf503('0x3b')];if(!_0x571c11[_0xf503('0x36')][_0xf503('0x3e')](_0xf503('0x3f'))){_0x2a5c35['limit']=qs[_0xf503('0x22')](_0x571c11['query'][_0xf503('0x22')]);_0x2a5c35[_0xf503('0x20')]=qs[_0xf503('0x20')](_0x571c11[_0xf503('0x36')][_0xf503('0x20')]);}_0x2a5c35[_0xf503('0x40')]=qs[_0xf503('0x41')](_0x571c11['query'][_0xf503('0x41')]);_0x2a5c35['where']=qs['filters'](_[_0xf503('0x42')](_0x571c11[_0xf503('0x36')],_0x5e6039[_0xf503('0x38')]),_0x189fe8);if(_0x571c11['query'][_0xf503('0x43')]){_0x2a5c35['where']=_['merge'](_0x2a5c35['where'],{'$or':_[_0xf503('0x34')](_0x189fe8,function(_0xebe303){if(_0xebe303[_0xf503('0x31')]!==_0xf503('0x44')){var _0xb23614={};_0xb23614[_0xebe303[_0xf503('0x2b')]]={'$like':'%'+_0x571c11['query'][_0xf503('0x43')]+'%'};return _0xb23614;}})});}_0x2a5c35=_[_0xf503('0x45')]({},_0x2a5c35,_0x571c11[_0xf503('0x46')]);var _0x379263={'where':_0x2a5c35[_0xf503('0x47')]};return db[_0xf503('0x2e')]['count'](_0x379263)[_0xf503('0x29')](function(_0x390c7e){_0x1e43f0[_0xf503('0x23')]=_0x390c7e;if(_0x571c11[_0xf503('0x36')][_0xf503('0x48')]){_0x2a5c35[_0xf503('0x49')]=[{'all':!![]}];}return db[_0xf503('0x2e')][_0xf503('0x4a')](_0x2a5c35);})[_0xf503('0x29')](function(_0x41e17d){_0x1e43f0[_0xf503('0x4b')]=_0x41e17d;return _0x1e43f0;})[_0xf503('0x29')](respondWithFilteredResult(_0x1d507a,_0x2a5c35))[_0xf503('0x4c')](handleError(_0x1d507a,null));};exports['show']=function(_0x534725,_0x299a88){var _0x51ec3e={'raw':![],'where':{'id':_0x534725[_0xf503('0x4d')]['id']}},_0x47b9eb={};_0x47b9eb[_0xf503('0x3b')]=_[_0xf503('0x37')](db['VoiceRecording']['rawAttributes']);_0x47b9eb['query']=_[_0xf503('0x37')](_0x534725[_0xf503('0x36')]);_0x47b9eb['filters']=_[_0xf503('0x39')](_0x47b9eb[_0xf503('0x3b')],_0x47b9eb['query']);_0x51ec3e['attributes']=_[_0xf503('0x39')](_0x47b9eb[_0xf503('0x3b')],qs[_0xf503('0x3c')](_0x534725[_0xf503('0x36')][_0xf503('0x3c')]));_0x51ec3e[_0xf503('0x3a')]=_0x51ec3e['attributes'][_0xf503('0x3d')]?_0x51ec3e[_0xf503('0x3a')]:_0x47b9eb[_0xf503('0x3b')];if(_0x534725[_0xf503('0x36')][_0xf503('0x48')]){_0x51ec3e[_0xf503('0x49')]=[{'all':!![]}];}_0x51ec3e=_[_0xf503('0x45')]({},_0x51ec3e,_0x534725[_0xf503('0x46')]);return db[_0xf503('0x2e')][_0xf503('0x4e')](_0x51ec3e)['then'](handleEntityNotFound(_0x299a88,null))[_0xf503('0x29')](respondWithResult(_0x299a88,null))['catch'](handleError(_0x299a88,null));};exports[_0xf503('0x4f')]=function(_0x1b7355,_0x546e18){return db['VoiceRecording'][_0xf503('0x4f')](_0x1b7355[_0xf503('0x50')],{})[_0xf503('0x29')](respondWithResult(_0x546e18,0xc9))['catch'](handleError(_0x546e18,null));};exports['update']=function(_0x4e1aa1,_0x15f755){if(_0x4e1aa1[_0xf503('0x50')]['id']){delete _0x4e1aa1['body']['id'];}return db[_0xf503('0x2e')][_0xf503('0x4e')]({'where':{'id':_0x4e1aa1[_0xf503('0x4d')]['id']}})[_0xf503('0x29')](handleEntityNotFound(_0x15f755,null))[_0xf503('0x29')](saveUpdates(_0x4e1aa1[_0xf503('0x50')],null))['then'](respondWithResult(_0x15f755,null))[_0xf503('0x4c')](handleError(_0x15f755,null));};exports['describe']=function(_0x412a3a,_0xf096b8){return db[_0xf503('0x2e')]['describe']()['then'](respondWithResult(_0xf096b8,null))[_0xf503('0x4c')](handleError(_0xf096b8,null));};exports[_0xf503('0x51')]=function(_0x25701a,_0x130f64,_0x11d9e2){var _0x28f7a8=require(_0xf503('0x52'));var _0x1ef258=![];var _0x1320a0={};if(_0x25701a[_0xf503('0x36')][_0xf503('0x31')]&&_0x25701a[_0xf503('0x36')][_0xf503('0x31')]===_0xf503('0x53')){_0x1320a0['uniqueid']=_0x25701a['params']['id'];}else{_0x1320a0['id']=_0x25701a['params']['id'];}return db[_0xf503('0x2e')]['find']({'where':_0x1320a0,'attributes':['id','value'],'raw':!![]})[_0xf503('0x29')](handleEntityNotFound(_0x130f64,null))[_0xf503('0x29')](function(_0x431013){if(_0x431013){var _0x5a6d16=_0x431013[_0xf503('0x54')];var _0x2c10dc=util[_0xf503('0x35')](_0xf503('0x55'),_0x5a6d16);if(fs[_0xf503('0x56')](_0x2c10dc)){_0x1ef258=!![];return _0x28f7a8[_0xf503('0x57')](_0x2c10dc,_0x5a6d16,config[_0xf503('0x58')][_0xf503('0x59')])[_0xf503('0x29')](function(){return _0x431013;});}return _0x431013;}})[_0xf503('0x29')](function(_0x18e87b){if(_0x18e87b){var _0x131448=_0x18e87b['value'];if(!fs[_0xf503('0x56')](_0x131448)){throw new db[(_0xf503('0x5a'))][(_0xf503('0x5b'))](_0xf503('0x5c'));}if(_0x18e87b[_0xf503('0x5d')]){return _0x130f64['download'](_0x131448,_0x18e87b['filename']+path['extname'](_0x131448),function(){if(_0x1ef258){fs[_0xf503('0x5e')](_0x131448);}});}else{return _0x130f64[_0xf503('0x51')](_0x131448,function(_0x5947b5){if(_0x1ef258){fs['unlink'](_0x131448);}});}}})['catch'](function(_0x121f28){if(_0x121f28[_0xf503('0x5f')]==='VoiceRecording\x20not\x20found'){_0x130f64[_0xf503('0x1d')](0x194)[_0xf503('0x2c')](_0xf503('0x60'));}else{return handleError(_0x130f64,null);}});};exports[_0xf503('0x61')]=function(_0x5c0019,_0x51a44b,_0x2edb14){var _0x7ec4d5=require(_0xf503('0x52'));var _0x5ac8d=![];var _0x51a453={'$and':[db[_0xf503('0x62')][_0xf503('0x47')](db['sequelize']['fn']('MD5',db[_0xf503('0x62')][_0xf503('0x63')](_0xf503('0x53'))),_0x5c0019[_0xf503('0x36')][_0xf503('0x64')])]};if(_0x5c0019['query']['type']&&_0x5c0019[_0xf503('0x36')][_0xf503('0x31')]===_0xf503('0x53')){_0x51a453[_0xf503('0x65')][_0xf503('0x66')]({'uniqueid':_0x5c0019['params']['id']});}else{_0x51a453[_0xf503('0x65')]['push']({'id':_0x5c0019[_0xf503('0x4d')]['id']});}return db[_0xf503('0x2e')][_0xf503('0x4e')]({'where':_0x51a453,'attributes':['id',_0xf503('0x54')],'raw':!![]})[_0xf503('0x29')](handleEntityNotFound(_0x51a44b,null))[_0xf503('0x29')](function(_0x2b34d6){if(_0x2b34d6){var _0x830c6c=util[_0xf503('0x35')](_0xf503('0x55'),_0x2b34d6[_0xf503('0x54')]);if(fs[_0xf503('0x56')](_0x830c6c)){_0x5ac8d=!![];return _0x7ec4d5[_0xf503('0x57')](_0x830c6c,_0x2b34d6[_0xf503('0x54')],config[_0xf503('0x58')][_0xf503('0x59')])['then'](function(){return _0x2b34d6;});}return _0x2b34d6;}})[_0xf503('0x29')](function(_0x3a5a57){if(_0x3a5a57){if(!fs['existsSync'](_0x3a5a57[_0xf503('0x54')])){throw new db[(_0xf503('0x5a'))][(_0xf503('0x5b'))]('VoiceRecording\x20not\x20found');}if(_0x3a5a57['filename']){return _0x51a44b[_0xf503('0x51')](_0x3a5a57[_0xf503('0x54')],_0x3a5a57[_0xf503('0x5d')]+path['extname'](_0x3a5a57[_0xf503('0x54')]),function(){if(_0x5ac8d){fs[_0xf503('0x5e')](_0x3a5a57[_0xf503('0x54')]);}});}else{return _0x51a44b['download'](_0x3a5a57[_0xf503('0x54')],function(_0x19c20f){if(_0x5ac8d){fs[_0xf503('0x5e')](_0x3a5a57[_0xf503('0x54')]);}});}}})['catch'](handleError(_0x51a44b,null));};exports[_0xf503('0x67')]=function(_0x1f091a,_0x2cd33d){return db[_0xf503('0x2e')]['find']({'where':{'id':_0x1f091a[_0xf503('0x4d')]['id']}})[_0xf503('0x29')](function(_0xdf9d7e){if(_[_0xf503('0x68')](_0xdf9d7e)){throw new ReferenceError(_0xf503('0x69'));}return _0xdf9d7e;})[_0xf503('0x29')](function(_0x5803ab){var _0x3daaf3=_0x5803ab[_0xf503('0x54')];logger[_0xf503('0x6a')]('cancellazione\x20fisica\x20documento\x20%s',_0x3daaf3);if(!_[_0xf503('0x68')](_0x5803ab['value'])&&fs['existsSync'](_0x3daaf3)){logger[_0xf503('0x6a')](_0xf503('0x6b')+_0x3daaf3+_0xf503('0x6c'));fs[_0xf503('0x6d')](_0x3daaf3);}_0x3daaf3=_0x3daaf3+'.cypher';if(!_['isNil'](_0x5803ab[_0xf503('0x54')])&&fs[_0xf503('0x56')](_0x3daaf3)){logger['info'](_0xf503('0x6b')+_0x3daaf3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xf503('0x6d')](_0x3daaf3);}return _0x5803ab;})[_0xf503('0x29')](function(_0x385850){if(!_0x385850)throw new InternalError();return _0x385850[_0xf503('0x67')]();})['then'](function(){_0x2cd33d[_0xf503('0x1d')](0xcc)[_0xf503('0x1e')]();})[_0xf503('0x4c')](handleError(_0x2cd33d,null));};function getBucketslist(_0x1181b0,_0x551de4,_0x2a2fe1){return new Promise(function(_0x383b5c,_0x329edd){var _0x358771=new AWS['S3']({'accessKeyId':_0x551de4,'secretAccessKey':_0x1181b0,'region':_0x2a2fe1});_0x358771['listBuckets']({},function(_0x69e4e6,_0x1609bf){if(_0x69e4e6){return _0x329edd(_0x69e4e6);}else{return _0x383b5c(_0x1609bf);}});});}function createBucket(_0x2bb3c0,_0x15ec0f,_0x11a208,_0x11b7c3){return new Promise(function(_0x5188f3,_0x2c6e2d){var _0x5e4bdd=new AWS['S3']({'accessKeyId':_0x15ec0f,'secretAccessKey':_0x2bb3c0,'region':_0x11a208});_0x5e4bdd[_0xf503('0x6e')]({'Bucket':_0x11b7c3},function(_0x5bcc7c,_0x590606){if(_0x5bcc7c){return _0x2c6e2d(_0x5bcc7c);}else{return _0x5188f3(_0x590606);}});});}function uploadFile(_0x212f73,_0x1bc93c,_0x31a287,_0x4eeae8,_0x2634a3,_0x50f31){return new Promise(function(_0x19104e,_0x59d3e0){var _0x4d9614=new AWS['S3']({'accessKeyId':_0x1bc93c,'secretAccessKey':_0x212f73,'region':_0x31a287});_0x4d9614[_0xf503('0x6f')]({'Bucket':_0x4eeae8,'Key':_0x2634a3,'Body':_0x50f31},function(_0x53c6a5,_0x4244e7){if(_0x53c6a5){return _0x59d3e0(_0x53c6a5);}else{return _0x19104e(_0x4244e7);}});});}function startTranscribe(_0x25140f,_0xaac416,_0x4db8f9,_0x3f3cfa,_0x4a0018,_0x42b5a9){return new Promise(function(_0x3ed252,_0x41835d){var _0x1119d7=new AWS['TranscribeService']({'accessKeyId':_0xaac416,'secretAccessKey':_0x25140f,'region':_0x4db8f9});_0x1119d7[_0xf503('0x70')]({'TranscriptionJobName':_0x3f3cfa,'LanguageCode':_0x4a0018,'Media':{'MediaFileUri':_0x42b5a9}},function(_0x38b389,_0xbda015){if(_0x38b389){return _0x41835d(_0x38b389);}else{return _0x3ed252(_0xbda015);}});});}function transcribe(_0x574ae9,_0x3e890d,_0x131685,_0x1fe2c7,_0xee58e5,_0x9b8fb2,_0x594ed7){return new Promise(function(_0x5445df,_0x5d5eee){var _0x32434e={};logger[_0xf503('0x6a')](util[_0xf503('0x35')](_0xf503('0x71'),_0x574ae9,_0xee58e5));return uploadFile(_0x3e890d,_0x131685,_0x1fe2c7,_0xee58e5,path[_0xf503('0x72')](_0x9b8fb2),fs['readFileSync'](_0x9b8fb2))[_0xf503('0x29')](function(_0x3ee57a){logger[_0xf503('0x6a')](util[_0xf503('0x35')](_0xf503('0x73'),_0x574ae9,_0xee58e5,_0x3ee57a[_0xf503('0x74')]));_0x32434e['bucket']=_0x3ee57a['Bucket'];_0x32434e[_0xf503('0x75')]=_0x3ee57a[_0xf503('0x74')];logger[_0xf503('0x6a')](util[_0xf503('0x35')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x574ae9));return startTranscribe(_0x3e890d,_0x131685,_0x1fe2c7,uuidv4(),_0x594ed7,_0x3ee57a[_0xf503('0x74')]);})[_0xf503('0x29')](function(_0x3ecc4c){logger[_0xf503('0x6a')](util[_0xf503('0x35')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x574ae9,_0x3ecc4c['TranscriptionJob'][_0xf503('0x76')]));_0x32434e[_0xf503('0x77')]=_0x3ecc4c[_0xf503('0x78')][_0xf503('0x76')];_0x32434e[_0xf503('0x79')]=_0x3ecc4c[_0xf503('0x78')][_0xf503('0x7a')];return _0x5445df(_0x32434e);})['catch'](function(_0x45d45d){return _0x5d5eee(_0x45d45d);});});}exports[_0xf503('0x7b')]=function(_0x2a7a7c,_0x180d39,_0x528cae){var _0xc1d3ec;var _0x392178;var _0x493c17;var _0x368def=require(_0xf503('0x52'));return db[_0xf503('0x2e')][_0xf503('0x7c')]({'where':{'id':_0x2a7a7c[_0xf503('0x4d')]['id']}})[_0xf503('0x29')](function(_0x1ff9cd){if(_0x1ff9cd){var _0x4b8a7d=util['format'](_0xf503('0x55'),_0x1ff9cd[_0xf503('0x54')]);if(fs[_0xf503('0x56')](_0x4b8a7d)){cypher=!![];return _0x368def['decryptFile'](_0x4b8a7d,_0x1ff9cd[_0xf503('0x54')],config[_0xf503('0x58')]['recording'])[_0xf503('0x29')](function(){return _0x1ff9cd;});}return _0x1ff9cd;}})[_0xf503('0x29')](function(_0x5e2bd2){if(!_0x5e2bd2){throw new db[(_0xf503('0x5a'))][(_0xf503('0x5b'))](_0xf503('0x7d'));}_0x392178=_0x5e2bd2;return db[_0xf503('0x7e')][_0xf503('0x7c')]({'where':{'id':0x1}});})[_0xf503('0x29')](handleEntityNotFound(_0x180d39,null))[_0xf503('0x29')](function(_0x3b182a){if(_0x3b182a){_0xc1d3ec=_0x3b182a;if(!_0xc1d3ec[_0xf503('0x7f')]||!_0xc1d3ec[_0xf503('0x80')]||!_0xc1d3ec[_0xf503('0x81')]||!_0xc1d3ec[_0xf503('0x82')]||!_0xc1d3ec[_0xf503('0x83')]){throw new db[(_0xf503('0x5a'))]['ValidationError'](_0xf503('0x84'));}if(_0x2a7a7c[_0xf503('0x50')][_0xf503('0x85')]&&(!_0xc1d3ec[_0xf503('0x86')]||!_0xc1d3ec['sentimentAccountId']||!_0xc1d3ec[_0xf503('0x87')]||!_0xc1d3ec['language']||!_0xc1d3ec['bucket'])){throw new db[(_0xf503('0x5a'))][(_0xf503('0x5b'))](_0xf503('0x88'));}return db[_0xf503('0x89')]['findOne']({'where':{'id':_0xc1d3ec['transcribeAccountId']}});}})[_0xf503('0x29')](function(_0x1b660e){if(!_0x1b660e){throw new db[(_0xf503('0x5a'))][(_0xf503('0x5b'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x1b660e[_0xf503('0x8a')]||!_0x1b660e[_0xf503('0x8b')]){throw new db[(_0xf503('0x5a'))][(_0xf503('0x5b'))]('Cloud\x20Provider\x20not\x20configured');}_0x493c17=_0x1b660e;return getBucketslist(_0x493c17['data1'],_0x493c17['data2'],_0xc1d3ec['transcribeRegion']);})[_0xf503('0x29')](function(_0x1a2825){if(_0x1a2825&&_0x1a2825[_0xf503('0x8c')]){var _0x4215b1=_[_0xf503('0x4e')](_0x1a2825['Buckets'],function(_0x29a684){return _0x29a684[_0xf503('0x8d')]===_0xc1d3ec[_0xf503('0x83')];});if(!_0x4215b1){logger['info'](util[_0xf503('0x35')](_0xf503('0x8e'),_0x2a7a7c[_0xf503('0x4d')]['id'],_0xc1d3ec['bucket']));return createBucket(_0x493c17[_0xf503('0x8a')],_0x493c17[_0xf503('0x8b')],_0xc1d3ec['transcribeRegion'],_0xc1d3ec['bucket']);}logger[_0xf503('0x6a')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x2a7a7c['params']['id'],_0xc1d3ec[_0xf503('0x83')]));return;}})[_0xf503('0x29')](function(_0x3d7ac9){if(_0x392178[_0xf503('0x79')]===_0xf503('0x8f')){return transcribe(_0x2a7a7c[_0xf503('0x4d')]['id'],_0x493c17['data1'],_0x493c17[_0xf503('0x8b')],_0xc1d3ec[_0xf503('0x81')],_0xc1d3ec[_0xf503('0x83')],_0x392178[_0xf503('0x54')],_0xc1d3ec[_0xf503('0x82')]);}else{logger[_0xf503('0x6a')](util['format'](_0xf503('0x90'),_0x2a7a7c['params']['id']));return{'transcribeStatus':_0xf503('0x91')};}})['then'](function(_0x2ad110){if(_0x2ad110){_0x2ad110['tempSentiment']=_0x2a7a7c[_0xf503('0x50')][_0xf503('0x85')];return _0x392178[_0xf503('0x92')](_0x2ad110);}})[_0xf503('0x29')](respondWithResult(_0x180d39,null))['catch'](handleError(_0x180d39,null));};function writeFile(_0x3a440b,_0x3825cd){return new Promise(function(_0x4d9ac5,_0x1f2843){fs['writeFile'](_0x3825cd,_0x3a440b,function(_0x479e21,_0x43803b){if(_0x479e21){return _0x1f2843(_0x479e21);}else{return _0x4d9ac5(_0x43803b);}});});}exports['downloadTranscribe']=function(_0x168b94,_0x13c51c,_0x571ad5){return db[_0xf503('0x2e')][_0xf503('0x7c')]({'where':{'id':_0x168b94[_0xf503('0x4d')]['id']}})['then'](handleEntityNotFound(_0x13c51c))[_0xf503('0x29')](function(_0x2edd82){if(_0x2edd82&&_0x2edd82['fileText']){var _0x3231ba=_0x2edd82[_0xf503('0x93')];var _0x496c42=config[_0xf503('0x94')]+_0xf503('0x95')+_0x2edd82['id']+_0xf503('0x96');if(fs[_0xf503('0x56')](_0x496c42)){return _0x496c42;}return writeFile(_0x3231ba,_0x496c42)[_0xf503('0x29')](function(){return _0x496c42;});}else{throw new db['Sequelize'][(_0xf503('0x5b'))]('Transcript\x20not\x20available');}})[_0xf503('0x29')](function(_0x13a41f){return _0x13c51c[_0xf503('0x51')](_0x13a41f);})[_0xf503('0x4c')](handleError(_0x13c51c));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index dabd327..8868447 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 _0x7bae=['VoiceRecording','uniqueid','transcribeStatus'];(function(_0xf17df0,_0x30e6c3){var _0x3c6e42=function(_0x5cf4cc){while(--_0x5cf4cc){_0xf17df0['push'](_0xf17df0['shift']());}};_0x3c6e42(++_0x30e6c3);}(_0x7bae,0x13b));var _0xe7ba=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x7bae[_0x134c2e];return _0x2825db;};'use strict';var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x80f588,_0x1e05c4){return _0x80f588['define'](_0xe7ba('0x0'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xe7ba('0x1'),'fields':[_0xe7ba('0x1')]},{'name':_0xe7ba('0x2'),'fields':[_0xe7ba('0x2')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x861c=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings'];(function(_0x3b9242,_0x1685f1){var _0x28b68b=function(_0x59f0b8){while(--_0x59f0b8){_0x3b9242['push'](_0x3b9242['shift']());}};_0x28b68b(++_0x1685f1);}(_0x861c,0xdb));var _0xc861=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x861c[_0xa464c9];return _0x3d73c4;};'use strict';var attributes=require(_0xc861('0x0'));module[_0xc861('0x1')]=function(_0x1f86f2,_0x363b30){return _0x1f86f2[_0xc861('0x2')](_0xc861('0x3'),attributes,{'tableName':_0xc861('0x4'),'paranoid':![],'indexes':[{'name':_0xc861('0x5'),'fields':[_0xc861('0x5')]},{'name':_0xc861('0x6'),'fields':[_0xc861('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 868f767..2cc98db 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 _0xa30a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceRecording,\x20%s,\x20%s','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','UpdateVoiceRecording','update','body','options','where','limit','debug','../../components/encryptor','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x5333ba,_0x22e1bb){var _0x20f9dc=function(_0x1956af){while(--_0x1956af){_0x5333ba['push'](_0x5333ba['shift']());}};_0x20f9dc(++_0x22e1bb);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa30('0x3'));var fs=require('fs');var Redis=require(_0xaa30('0x4'));var db=require(_0xaa30('0x5'))['db'];var utils=require(_0xaa30('0x6'));var logger=require(_0xaa30('0x7'))(_0xaa30('0x8'));var config=require(_0xaa30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa30('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8af448,_0x14fe09,_0x42dc22){return new BPromise(function(_0x5d076a,_0xedbc45){return client[_0xaa30('0xb')](_0x8af448,_0x42dc22)[_0xaa30('0xc')](function(_0x59d028){logger[_0xaa30('0xd')](_0xaa30('0xe'),_0x14fe09,'request\x20sent');logger['debug'](_0xaa30('0xf'),_0x14fe09,'request\x20sent',JSON[_0xaa30('0x10')](_0x59d028));if(_0x59d028[_0xaa30('0x11')]){if(_0x59d028[_0xaa30('0x11')][_0xaa30('0x12')]===0x1f4){logger['error'](_0xaa30('0xe'),_0x14fe09,_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);return _0xedbc45(_0x59d028['error'][_0xaa30('0x13')]);}logger[_0xaa30('0x11')](_0xaa30('0xe'),_0x14fe09,_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);return _0x5d076a(_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);}else{logger[_0xaa30('0xd')](_0xaa30('0xe'),_0x14fe09,_0xaa30('0x14'));_0x5d076a(_0x59d028['result'][_0xaa30('0x13')]);}})['catch'](function(_0x5eb356){logger[_0xaa30('0x11')](_0xaa30('0xe'),_0x14fe09,_0x5eb356);_0xedbc45(_0x5eb356);});});}exports[_0xaa30('0x15')]=function(_0x540e36){var _0x54fa49=this;return new Promise(function(_0x53f9fd,_0x23ad3b){return db['VoiceRecording'][_0xaa30('0x16')](_0x540e36[_0xaa30('0x17')],{'raw':_0x540e36['options']?_0x540e36['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x540e36[_0xaa30('0x18')]?_0x540e36[_0xaa30('0x18')][_0xaa30('0x19')]||null:null,'attributes':_0x540e36[_0xaa30('0x18')]?_0x540e36[_0xaa30('0x18')]['attributes']||null:null,'limit':_0x540e36[_0xaa30('0x18')]?_0x540e36[_0xaa30('0x18')][_0xaa30('0x1a')]||null:null})[_0xaa30('0xc')](function(_0x1ff442){logger['info'](_0xaa30('0x15'),_0x540e36);logger[_0xaa30('0x1b')](_0xaa30('0x15'),_0x540e36,JSON[_0xaa30('0x10')](_0x1ff442));_0x53f9fd(_0x1ff442);})['catch'](function(_0x14d7fa){logger[_0xaa30('0x11')](_0xaa30('0x15'),_0x14d7fa[_0xaa30('0x13')],_0x540e36);_0x23ad3b(_0x54fa49[_0xaa30('0x11')](0x1f4,_0x14d7fa[_0xaa30('0x13')]));});});};exports['CreateVoiceRecording']=function(_0x467850){var _0x465701=this;return new Promise(function(_0x5d4da8,_0xb043e4){var _0x5b3efb=require(_0xaa30('0x1c'));var _0x33a0c9;return db[_0xaa30('0x1d')][_0xaa30('0x1e')]({'attributes':['id',_0xaa30('0x1f')],'where':{'id':0x1},'raw':!![]})[_0xaa30('0xc')](function(_0x6ff09a){_0x33a0c9=_0x6ff09a;return db[_0xaa30('0x20')][_0xaa30('0x21')](_0x467850[_0xaa30('0x17')]);})[_0xaa30('0xc')](function(_0x43003f){if(_0x33a0c9[_0xaa30('0x1f')]&&fs[_0xaa30('0x22')](_0x43003f[_0xaa30('0x23')])){var _0x1a3f64=util[_0xaa30('0x24')](_0xaa30('0x25'),_0x43003f['value']);return _0x5b3efb[_0xaa30('0x26')](_0x43003f[_0xaa30('0x23')],_0x1a3f64,config[_0xaa30('0x27')][_0xaa30('0x28')])[_0xaa30('0xc')](function(){fs[_0xaa30('0x29')](_0x43003f['value']);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x43003f;});}return _0x43003f;})[_0xaa30('0xc')](function(_0x407090){logger[_0xaa30('0xd')](_0xaa30('0x2a'),_0x467850);logger[_0xaa30('0x1b')]('CreateVoiceRecording',_0x467850,JSON['stringify'](_0x407090));_0x5d4da8(_0x407090);})[_0xaa30('0x2b')](function(_0x2d26fb){logger['error'](_0xaa30('0x2a'),_0x2d26fb['message'],_0x467850);_0xb043e4(_0x465701[_0xaa30('0x11')](0x1f4,_0x2d26fb['message']));});});}; \ No newline at end of file +var _0xa30a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceRecording,\x20%s,\x20%s','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','UpdateVoiceRecording','update','body','options','where','limit','debug','../../components/encryptor','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x245307,_0x12cbb9){var _0x4cf712=function(_0x1ee4af){while(--_0x1ee4af){_0x245307['push'](_0x245307['shift']());}};_0x4cf712(++_0x12cbb9);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa30('0x3'));var fs=require('fs');var Redis=require(_0xaa30('0x4'));var db=require(_0xaa30('0x5'))['db'];var utils=require(_0xaa30('0x6'));var logger=require(_0xaa30('0x7'))(_0xaa30('0x8'));var config=require(_0xaa30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa30('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8af448,_0x14fe09,_0x42dc22){return new BPromise(function(_0x5d076a,_0xedbc45){return client[_0xaa30('0xb')](_0x8af448,_0x42dc22)[_0xaa30('0xc')](function(_0x59d028){logger[_0xaa30('0xd')](_0xaa30('0xe'),_0x14fe09,'request\x20sent');logger['debug'](_0xaa30('0xf'),_0x14fe09,'request\x20sent',JSON[_0xaa30('0x10')](_0x59d028));if(_0x59d028[_0xaa30('0x11')]){if(_0x59d028[_0xaa30('0x11')][_0xaa30('0x12')]===0x1f4){logger['error'](_0xaa30('0xe'),_0x14fe09,_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);return _0xedbc45(_0x59d028['error'][_0xaa30('0x13')]);}logger[_0xaa30('0x11')](_0xaa30('0xe'),_0x14fe09,_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);return _0x5d076a(_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);}else{logger[_0xaa30('0xd')](_0xaa30('0xe'),_0x14fe09,_0xaa30('0x14'));_0x5d076a(_0x59d028['result'][_0xaa30('0x13')]);}})['catch'](function(_0x5eb356){logger[_0xaa30('0x11')](_0xaa30('0xe'),_0x14fe09,_0x5eb356);_0xedbc45(_0x5eb356);});});}exports[_0xaa30('0x15')]=function(_0x540e36){var _0x54fa49=this;return new Promise(function(_0x53f9fd,_0x23ad3b){return db['VoiceRecording'][_0xaa30('0x16')](_0x540e36[_0xaa30('0x17')],{'raw':_0x540e36['options']?_0x540e36['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x540e36[_0xaa30('0x18')]?_0x540e36[_0xaa30('0x18')][_0xaa30('0x19')]||null:null,'attributes':_0x540e36[_0xaa30('0x18')]?_0x540e36[_0xaa30('0x18')]['attributes']||null:null,'limit':_0x540e36[_0xaa30('0x18')]?_0x540e36[_0xaa30('0x18')][_0xaa30('0x1a')]||null:null})[_0xaa30('0xc')](function(_0x1ff442){logger['info'](_0xaa30('0x15'),_0x540e36);logger[_0xaa30('0x1b')](_0xaa30('0x15'),_0x540e36,JSON[_0xaa30('0x10')](_0x1ff442));_0x53f9fd(_0x1ff442);})['catch'](function(_0x14d7fa){logger[_0xaa30('0x11')](_0xaa30('0x15'),_0x14d7fa[_0xaa30('0x13')],_0x540e36);_0x23ad3b(_0x54fa49[_0xaa30('0x11')](0x1f4,_0x14d7fa[_0xaa30('0x13')]));});});};exports['CreateVoiceRecording']=function(_0x467850){var _0x465701=this;return new Promise(function(_0x5d4da8,_0xb043e4){var _0x5b3efb=require(_0xaa30('0x1c'));var _0x33a0c9;return db[_0xaa30('0x1d')][_0xaa30('0x1e')]({'attributes':['id',_0xaa30('0x1f')],'where':{'id':0x1},'raw':!![]})[_0xaa30('0xc')](function(_0x6ff09a){_0x33a0c9=_0x6ff09a;return db[_0xaa30('0x20')][_0xaa30('0x21')](_0x467850[_0xaa30('0x17')]);})[_0xaa30('0xc')](function(_0x43003f){if(_0x33a0c9[_0xaa30('0x1f')]&&fs[_0xaa30('0x22')](_0x43003f[_0xaa30('0x23')])){var _0x1a3f64=util[_0xaa30('0x24')](_0xaa30('0x25'),_0x43003f['value']);return _0x5b3efb[_0xaa30('0x26')](_0x43003f[_0xaa30('0x23')],_0x1a3f64,config[_0xaa30('0x27')][_0xaa30('0x28')])[_0xaa30('0xc')](function(){fs[_0xaa30('0x29')](_0x43003f['value']);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x43003f;});}return _0x43003f;})[_0xaa30('0xc')](function(_0x407090){logger[_0xaa30('0xd')](_0xaa30('0x2a'),_0x467850);logger[_0xaa30('0x1b')]('CreateVoiceRecording',_0x467850,JSON['stringify'](_0x407090));_0x5d4da8(_0x407090);})[_0xaa30('0x2b')](function(_0x2d26fb){logger['error'](_0xaa30('0x2a'),_0x2d26fb['message'],_0x467850);_0xb043e4(_0x465701[_0xaa30('0x11')](0x1f4,_0x2d26fb['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index c91576e..d255c08 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 _0xb4d1=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','isAuthenticated','describe','post','create','put','/:id','update','destroy','multer','util','path'];(function(_0x5d1b7e,_0x4daa0e){var _0x4643ff=function(_0xab5917){while(--_0xab5917){_0x5d1b7e['push'](_0x5d1b7e['shift']());}};_0x4643ff(++_0x4daa0e);}(_0xb4d1,0x179));var _0x1b4d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb4d1[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x1b4d('0x0'));var util=require(_0x1b4d('0x1'));var path=require(_0x1b4d('0x2'));var timeout=require('connect-timeout');var express=require(_0x1b4d('0x3'));var router=express['Router']();var fs_extra=require(_0x1b4d('0x4'));var auth=require(_0x1b4d('0x5'));var interaction=require(_0x1b4d('0x6'));var config=require(_0x1b4d('0x7'));var controller=require(_0x1b4d('0x8'));router[_0x1b4d('0x9')]('/',auth['isAuthenticated'](),controller[_0x1b4d('0xa')]);router[_0x1b4d('0x9')]('/describe',auth[_0x1b4d('0xb')](),controller[_0x1b4d('0xc')]);router[_0x1b4d('0x9')]('/:id',auth[_0x1b4d('0xb')](),controller['show']);router[_0x1b4d('0xd')]('/',auth[_0x1b4d('0xb')](),controller[_0x1b4d('0xe')]);router[_0x1b4d('0xf')](_0x1b4d('0x10'),auth['isAuthenticated'](),controller[_0x1b4d('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1b4d('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4c0d=['put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x37b856,_0x42439b){var _0x6dd01d=function(_0x228237){while(--_0x228237){_0x37b856['push'](_0x37b856['shift']());}};_0x6dd01d(++_0x42439b);}(_0x4c0d,0x16c));var _0xd4c0=function(_0x14efe2,_0x4b91e2){_0x14efe2=_0x14efe2-0x0;var _0x568bea=_0x4c0d[_0x14efe2];return _0x568bea;};'use strict';var multer=require(_0xd4c0('0x0'));var util=require(_0xd4c0('0x1'));var path=require('path');var timeout=require(_0xd4c0('0x2'));var express=require(_0xd4c0('0x3'));var router=express[_0xd4c0('0x4')]();var fs_extra=require(_0xd4c0('0x5'));var auth=require(_0xd4c0('0x6'));var interaction=require(_0xd4c0('0x7'));var config=require('../../config/environment');var controller=require(_0xd4c0('0x8'));router[_0xd4c0('0x9')]('/',auth[_0xd4c0('0xa')](),controller[_0xd4c0('0xb')]);router[_0xd4c0('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xd4c0('0xc')]);router[_0xd4c0('0x9')](_0xd4c0('0xd'),auth[_0xd4c0('0xa')](),controller[_0xd4c0('0xe')]);router[_0xd4c0('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd4c0('0x10')](_0xd4c0('0xd'),auth[_0xd4c0('0xa')](),controller['update']);router[_0xd4c0('0x11')](_0xd4c0('0xd'),auth[_0xd4c0('0xa')](),controller['destroy']);module[_0xd4c0('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 301638c..6b0a0d8 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 _0x05c2=['sequelize','ENUM','STRING','Yes'];(function(_0x30852e,_0x2dfb0d){var _0x1ccca9=function(_0x1b99aa){while(--_0x1b99aa){_0x30852e['push'](_0x30852e['shift']());}};_0x1ccca9(++_0x2dfb0d);}(_0x05c2,0x6c));var _0x205c=function(_0x538625,_0x4a9f80){_0x538625=_0x538625-0x0;var _0x12dea8=_0x05c2[_0x538625];return _0x12dea8;};'use strict';var Sequelize=require(_0x205c('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x205c('0x1')]('blind','attended')},'result':{'type':Sequelize[_0x205c('0x2')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x205c('0x2')]},'transferercalleridname':{'type':Sequelize[_0x205c('0x2')]},'transfererconnectedlinenum':{'type':Sequelize[_0x205c('0x2')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x205c('0x2')]},'transferercontext':{'type':Sequelize[_0x205c('0x2')]},'transfererexten':{'type':Sequelize[_0x205c('0x2')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x205c('0x2')]},'transfereecalleridnum':{'type':Sequelize[_0x205c('0x2')]},'transfereecalleridname':{'type':Sequelize[_0x205c('0x2')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x205c('0x2')]},'transfereeaccountcode':{'type':Sequelize[_0x205c('0x2')]},'transfereecontext':{'type':Sequelize[_0x205c('0x2')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x205c('0x2')]},'isexternal':{'type':Sequelize[_0x205c('0x1')](_0x205c('0x3'),'No')},'context':{'type':Sequelize[_0x205c('0x2')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xebc2=['sequelize','moment','exports','ENUM','blind','attended','STRING'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0xebc2,0x1dc));var _0x2ebc=function(_0x4bbdd6,_0x477641){_0x4bbdd6=_0x4bbdd6-0x0;var _0x55a679=_0xebc2[_0x4bbdd6];return _0x55a679;};'use strict';var Sequelize=require(_0x2ebc('0x0'));var moment=require(_0x2ebc('0x1'));module[_0x2ebc('0x2')]={'type':{'type':Sequelize[_0x2ebc('0x3')](_0x2ebc('0x4'),_0x2ebc('0x5'))},'result':{'type':Sequelize[_0x2ebc('0x6')]},'transfererchannel':{'type':Sequelize[_0x2ebc('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x2ebc('0x6')]},'transferercalleridname':{'type':Sequelize[_0x2ebc('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x2ebc('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x2ebc('0x6')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x2ebc('0x6')]},'transfererexten':{'type':Sequelize[_0x2ebc('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x2ebc('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x2ebc('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x2ebc('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x2ebc('0x6')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x2ebc('0x6')]},'transfereeexten':{'type':Sequelize[_0x2ebc('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x2ebc('0x6')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 856afbf..a1bc5a1 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 _0x9560=['util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','VoiceTransferReport','include','rows','catch','show','merge','options','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x3e8857,_0x51774e){var _0x207945=function(_0x1612d6){while(--_0x1612d6){_0x3e8857['push'](_0x3e8857['shift']());}};_0x207945(++_0x51774e);}(_0x9560,0x126));var _0x0956=function(_0x5ca3d6,_0x5c7599){_0x5ca3d6=_0x5ca3d6-0x0;var _0x3a1032=_0x9560[_0x5ca3d6];return _0x3a1032;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0956('0x0'));var zipdir=require(_0x0956('0x1'));var jsonpatch=require(_0x0956('0x2'));var rp=require(_0x0956('0x3'));var moment=require(_0x0956('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0956('0x5'));var util=require(_0x0956('0x6'));var path=require(_0x0956('0x7'));var sox=require(_0x0956('0x8'));var csv=require(_0x0956('0x9'));var ejs=require(_0x0956('0xa'));var fs=require('fs');var fs_extra=require(_0x0956('0xb'));var _=require('lodash');var squel=require(_0x0956('0xc'));var crypto=require(_0x0956('0xd'));var jsforce=require(_0x0956('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0956('0x9'));var querystring=require(_0x0956('0xf'));var Papa=require('papaparse');var Redis=require(_0x0956('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0956('0x11'));var as=require(_0x0956('0x12'));var hardwareService=require(_0x0956('0x13'));var logger=require(_0x0956('0x14'))(_0x0956('0x15'));var utils=require(_0x0956('0x16'));var config=require(_0x0956('0x17'));var licenseUtil=require(_0x0956('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c1f80,_0x25e0b8){_0x25e0b8=_0x25e0b8||0xcc;return function(_0x55392f){if(_0x55392f){return _0x3c1f80[_0x0956('0x19')](_0x25e0b8);}return _0x3c1f80[_0x0956('0x1a')](_0x25e0b8)[_0x0956('0x1b')]();};}function respondWithResult(_0xa40d33,_0x3ef5c8){_0x3ef5c8=_0x3ef5c8||0xc8;return function(_0x5c4f84){if(_0x5c4f84){return _0xa40d33[_0x0956('0x1a')](_0x3ef5c8)[_0x0956('0x1c')](_0x5c4f84);}};}function respondWithFilteredResult(_0x5370e0,_0x3e804f){return function(_0x3f2a79){if(_0x3f2a79){var _0x24c4fa=typeof _0x3e804f[_0x0956('0x1d')]===_0x0956('0x1e')&&typeof _0x3e804f[_0x0956('0x1f')]==='undefined';var _0x5bedd6=_0x3f2a79[_0x0956('0x20')];var _0x1c784e=_0x24c4fa?0x0:_0x3e804f[_0x0956('0x1d')];var _0x2a6583=_0x24c4fa?_0x3f2a79['count']:_0x3e804f[_0x0956('0x1d')]+_0x3e804f[_0x0956('0x1f')];var _0x36b1c5;if(_0x2a6583>=_0x5bedd6){_0x2a6583=_0x5bedd6;_0x36b1c5=0xc8;}else{_0x36b1c5=0xce;}_0x5370e0[_0x0956('0x1a')](_0x36b1c5);return _0x5370e0[_0x0956('0x21')](_0x0956('0x22'),_0x1c784e+'-'+_0x2a6583+'/'+_0x5bedd6)['json'](_0x3f2a79);}return null;};}function patchUpdates(_0x54d750){return function(_0x57a5ba){try{jsonpatch['apply'](_0x57a5ba,_0x54d750,!![]);}catch(_0x11503a){return BPromise['reject'](_0x11503a);}return _0x57a5ba['save']();};}function saveUpdates(_0x4de28d,_0x140b9d){return function(_0x56a621){if(_0x56a621){return _0x56a621[_0x0956('0x23')](_0x4de28d)['then'](function(_0x550adf){return _0x550adf;});}return null;};}function removeEntity(_0x37950c,_0x2e0679){return function(_0x328e5a){if(_0x328e5a){return _0x328e5a[_0x0956('0x24')]()[_0x0956('0x25')](function(){_0x37950c[_0x0956('0x1a')](0xcc)[_0x0956('0x1b')]();});}};}function handleEntityNotFound(_0x556be9,_0x11a3ef){return function(_0x140500){if(!_0x140500){_0x556be9[_0x0956('0x19')](0x194);}return _0x140500;};}function handleError(_0x5c8fe6,_0x5083e9){_0x5083e9=_0x5083e9||0x1f4;return function(_0x3f01b1){logger[_0x0956('0x26')](_0x3f01b1[_0x0956('0x27')]);if(_0x3f01b1[_0x0956('0x28')]){delete _0x3f01b1[_0x0956('0x28')];}_0x5c8fe6[_0x0956('0x1a')](_0x5083e9)[_0x0956('0x29')](_0x3f01b1);};}exports[_0x0956('0x2a')]=function(_0x5e16ea,_0x5c3b96){var _0x39d3b5={},_0x2ee5c8={},_0x42748f={'count':0x0,'rows':[]};var _0xce59fa=_[_0x0956('0x2b')](db['VoiceTransferReport'][_0x0956('0x2c')],function(_0x116aa4){return{'name':_0x116aa4[_0x0956('0x2d')],'type':_0x116aa4['type']['key']};});_0x2ee5c8[_0x0956('0x2e')]=_[_0x0956('0x2b')](_0xce59fa,_0x0956('0x28'));_0x2ee5c8[_0x0956('0x2f')]=_[_0x0956('0x30')](_0x5e16ea[_0x0956('0x2f')]);_0x2ee5c8[_0x0956('0x31')]=_['intersection'](_0x2ee5c8[_0x0956('0x2e')],_0x2ee5c8[_0x0956('0x2f')]);_0x39d3b5[_0x0956('0x32')]=_[_0x0956('0x33')](_0x2ee5c8[_0x0956('0x2e')],qs[_0x0956('0x34')](_0x5e16ea['query'][_0x0956('0x34')]));_0x39d3b5[_0x0956('0x32')]=_0x39d3b5[_0x0956('0x32')][_0x0956('0x35')]?_0x39d3b5[_0x0956('0x32')]:_0x2ee5c8['model'];if(!_0x5e16ea[_0x0956('0x2f')][_0x0956('0x36')](_0x0956('0x37'))){_0x39d3b5[_0x0956('0x1f')]=qs[_0x0956('0x1f')](_0x5e16ea[_0x0956('0x2f')][_0x0956('0x1f')]);_0x39d3b5[_0x0956('0x1d')]=qs['offset'](_0x5e16ea[_0x0956('0x2f')][_0x0956('0x1d')]);}_0x39d3b5[_0x0956('0x38')]=qs[_0x0956('0x39')](_0x5e16ea[_0x0956('0x2f')][_0x0956('0x39')]);_0x39d3b5[_0x0956('0x3a')]=qs[_0x0956('0x31')](_[_0x0956('0x3b')](_0x5e16ea[_0x0956('0x2f')],_0x2ee5c8['filters']),_0xce59fa);if(_0x5e16ea[_0x0956('0x2f')]['filter']){_0x39d3b5[_0x0956('0x3a')]=_['merge'](_0x39d3b5[_0x0956('0x3a')],{'$or':_['map'](_0xce59fa,function(_0x2ff795){if(_0x2ff795[_0x0956('0x3c')]!==_0x0956('0x3d')){var _0x31058d={};_0x31058d[_0x2ff795[_0x0956('0x28')]]={'$like':'%'+_0x5e16ea[_0x0956('0x2f')][_0x0956('0x3e')]+'%'};return _0x31058d;}})});}_0x39d3b5=_['merge']({},_0x39d3b5,_0x5e16ea['options']);var _0x10e0c8={'where':_0x39d3b5[_0x0956('0x3a')]};return db[_0x0956('0x3f')]['count'](_0x10e0c8)[_0x0956('0x25')](function(_0x4479fc){_0x42748f[_0x0956('0x20')]=_0x4479fc;if(_0x5e16ea[_0x0956('0x2f')]['includeAll']){_0x39d3b5[_0x0956('0x40')]=[{'all':!![]}];}return db[_0x0956('0x3f')]['findAll'](_0x39d3b5);})[_0x0956('0x25')](function(_0x27b488){_0x42748f[_0x0956('0x41')]=_0x27b488;return _0x42748f;})[_0x0956('0x25')](respondWithFilteredResult(_0x5c3b96,_0x39d3b5))[_0x0956('0x42')](handleError(_0x5c3b96,null));};exports[_0x0956('0x43')]=function(_0x434d5d,_0x47063a){var _0x539eef={'raw':!![],'where':{'id':_0x434d5d['params']['id']}},_0x172c46={};_0x172c46[_0x0956('0x2e')]=_[_0x0956('0x30')](db[_0x0956('0x3f')][_0x0956('0x2c')]);_0x172c46[_0x0956('0x2f')]=_[_0x0956('0x30')](_0x434d5d['query']);_0x172c46['filters']=_[_0x0956('0x33')](_0x172c46[_0x0956('0x2e')],_0x172c46[_0x0956('0x2f')]);_0x539eef[_0x0956('0x32')]=_[_0x0956('0x33')](_0x172c46[_0x0956('0x2e')],qs[_0x0956('0x34')](_0x434d5d[_0x0956('0x2f')]['fields']));_0x539eef[_0x0956('0x32')]=_0x539eef[_0x0956('0x32')][_0x0956('0x35')]?_0x539eef[_0x0956('0x32')]:_0x172c46[_0x0956('0x2e')];if(_0x434d5d[_0x0956('0x2f')]['includeAll']){_0x539eef[_0x0956('0x40')]=[{'all':!![]}];}_0x539eef=_[_0x0956('0x44')]({},_0x539eef,_0x434d5d[_0x0956('0x45')]);return db[_0x0956('0x3f')][_0x0956('0x46')](_0x539eef)[_0x0956('0x25')](handleEntityNotFound(_0x47063a,null))['then'](respondWithResult(_0x47063a,null))[_0x0956('0x42')](handleError(_0x47063a,null));};exports[_0x0956('0x47')]=function(_0x441862,_0x57bd75){return db[_0x0956('0x3f')][_0x0956('0x47')](_0x441862[_0x0956('0x48')],{})[_0x0956('0x25')](respondWithResult(_0x57bd75,0xc9))[_0x0956('0x42')](handleError(_0x57bd75,null));};exports[_0x0956('0x23')]=function(_0x13cf8e,_0x19fd34){if(_0x13cf8e['body']['id']){delete _0x13cf8e[_0x0956('0x48')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x13cf8e[_0x0956('0x49')]['id']}})[_0x0956('0x25')](handleEntityNotFound(_0x19fd34,null))[_0x0956('0x25')](saveUpdates(_0x13cf8e[_0x0956('0x48')],null))[_0x0956('0x25')](respondWithResult(_0x19fd34,null))['catch'](handleError(_0x19fd34,null));};exports[_0x0956('0x24')]=function(_0x2f645c,_0x54cf4e){return db['VoiceTransferReport'][_0x0956('0x46')]({'where':{'id':_0x2f645c['params']['id']}})[_0x0956('0x25')](handleEntityNotFound(_0x54cf4e,null))['then'](removeEntity(_0x54cf4e,null))[_0x0956('0x42')](handleError(_0x54cf4e,null));};exports[_0x0956('0x4a')]=function(_0x3b2c96,_0x4e0f5d){return db[_0x0956('0x3f')][_0x0956('0x4a')]()[_0x0956('0x25')](respondWithResult(_0x4e0f5d,null))['catch'](handleError(_0x4e0f5d,null));}; \ No newline at end of file +var _0xcd0d=['end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','name','index','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x3ae2b2,_0x2d936f){var _0x1dbf00=function(_0x4072e9){while(--_0x4072e9){_0x3ae2b2['push'](_0x3ae2b2['shift']());}};_0x1dbf00(++_0x2d936f);}(_0xcd0d,0x10b));var _0xdcd0=function(_0x58dc03,_0x1c0b28){_0x58dc03=_0x58dc03-0x0;var _0x2f14bb=_0xcd0d[_0x58dc03];return _0x2f14bb;};'use strict';var emlformat=require(_0xdcd0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdcd0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdcd0('0x2'));var moment=require(_0xdcd0('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdcd0('0x4'));var path=require(_0xdcd0('0x5'));var sox=require('sox');var csv=require(_0xdcd0('0x6'));var ejs=require(_0xdcd0('0x7'));var fs=require('fs');var fs_extra=require(_0xdcd0('0x8'));var _=require('lodash');var squel=require(_0xdcd0('0x9'));var crypto=require(_0xdcd0('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xdcd0('0xb'));var toCsv=require('to-csv');var querystring=require(_0xdcd0('0xc'));var Papa=require(_0xdcd0('0xd'));var Redis=require(_0xdcd0('0xe'));var authService=require(_0xdcd0('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xdcd0('0x10'));var hardwareService=require(_0xdcd0('0x11'));var logger=require(_0xdcd0('0x12'))(_0xdcd0('0x13'));var utils=require(_0xdcd0('0x14'));var config=require(_0xdcd0('0x15'));var licenseUtil=require(_0xdcd0('0x16'));var db=require(_0xdcd0('0x17'))['db'];function respondWithStatusCode(_0x5488a2,_0x11108a){_0x11108a=_0x11108a||0xcc;return function(_0x2cc667){if(_0x2cc667){return _0x5488a2[_0xdcd0('0x18')](_0x11108a);}return _0x5488a2['status'](_0x11108a)[_0xdcd0('0x19')]();};}function respondWithResult(_0x5456b8,_0x1151bd){_0x1151bd=_0x1151bd||0xc8;return function(_0x1ac4b5){if(_0x1ac4b5){return _0x5456b8[_0xdcd0('0x1a')](_0x1151bd)[_0xdcd0('0x1b')](_0x1ac4b5);}};}function respondWithFilteredResult(_0x3dcae2,_0x293253){return function(_0x4c610c){if(_0x4c610c){var _0xde3418=typeof _0x293253[_0xdcd0('0x1c')]===_0xdcd0('0x1d')&&typeof _0x293253[_0xdcd0('0x1e')]===_0xdcd0('0x1d');var _0x323be4=_0x4c610c['count'];var _0x31e4b4=_0xde3418?0x0:_0x293253[_0xdcd0('0x1c')];var _0x410634=_0xde3418?_0x4c610c[_0xdcd0('0x1f')]:_0x293253['offset']+_0x293253[_0xdcd0('0x1e')];var _0x5d7639;if(_0x410634>=_0x323be4){_0x410634=_0x323be4;_0x5d7639=0xc8;}else{_0x5d7639=0xce;}_0x3dcae2['status'](_0x5d7639);return _0x3dcae2[_0xdcd0('0x20')]('Content-Range',_0x31e4b4+'-'+_0x410634+'/'+_0x323be4)['json'](_0x4c610c);}return null;};}function patchUpdates(_0x333ff6){return function(_0x41b1d3){try{jsonpatch[_0xdcd0('0x21')](_0x41b1d3,_0x333ff6,!![]);}catch(_0x28b385){return BPromise[_0xdcd0('0x22')](_0x28b385);}return _0x41b1d3[_0xdcd0('0x23')]();};}function saveUpdates(_0x329d77,_0x229d1b){return function(_0x27fafd){if(_0x27fafd){return _0x27fafd[_0xdcd0('0x24')](_0x329d77)[_0xdcd0('0x25')](function(_0x168f4c){return _0x168f4c;});}return null;};}function removeEntity(_0x24a682,_0x1a6e29){return function(_0xef290d){if(_0xef290d){return _0xef290d[_0xdcd0('0x26')]()[_0xdcd0('0x25')](function(){_0x24a682[_0xdcd0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ebf8e,_0x271f4f){return function(_0xe141e2){if(!_0xe141e2){_0x5ebf8e[_0xdcd0('0x18')](0x194);}return _0xe141e2;};}function handleError(_0x4e16cb,_0x1fda7d){_0x1fda7d=_0x1fda7d||0x1f4;return function(_0x458b9a){logger['error'](_0x458b9a['stack']);if(_0x458b9a['name']){delete _0x458b9a[_0xdcd0('0x27')];}_0x4e16cb['status'](_0x1fda7d)['send'](_0x458b9a);};}exports[_0xdcd0('0x28')]=function(_0x50b7f2,_0x1571ed){var _0x50bfbb={},_0x3eef2c={},_0x3c0912={'count':0x0,'rows':[]};var _0x155563=_['map'](db[_0xdcd0('0x29')][_0xdcd0('0x2a')],function(_0x1d4048){return{'name':_0x1d4048[_0xdcd0('0x2b')],'type':_0x1d4048[_0xdcd0('0x2c')][_0xdcd0('0x2d')]};});_0x3eef2c[_0xdcd0('0x2e')]=_['map'](_0x155563,_0xdcd0('0x27'));_0x3eef2c[_0xdcd0('0x2f')]=_[_0xdcd0('0x30')](_0x50b7f2[_0xdcd0('0x2f')]);_0x3eef2c['filters']=_[_0xdcd0('0x31')](_0x3eef2c[_0xdcd0('0x2e')],_0x3eef2c['query']);_0x50bfbb[_0xdcd0('0x32')]=_[_0xdcd0('0x31')](_0x3eef2c[_0xdcd0('0x2e')],qs[_0xdcd0('0x33')](_0x50b7f2[_0xdcd0('0x2f')][_0xdcd0('0x33')]));_0x50bfbb[_0xdcd0('0x32')]=_0x50bfbb[_0xdcd0('0x32')][_0xdcd0('0x34')]?_0x50bfbb[_0xdcd0('0x32')]:_0x3eef2c[_0xdcd0('0x2e')];if(!_0x50b7f2['query'][_0xdcd0('0x35')]('nolimit')){_0x50bfbb[_0xdcd0('0x1e')]=qs['limit'](_0x50b7f2[_0xdcd0('0x2f')][_0xdcd0('0x1e')]);_0x50bfbb[_0xdcd0('0x1c')]=qs[_0xdcd0('0x1c')](_0x50b7f2[_0xdcd0('0x2f')][_0xdcd0('0x1c')]);}_0x50bfbb[_0xdcd0('0x36')]=qs[_0xdcd0('0x37')](_0x50b7f2['query'][_0xdcd0('0x37')]);_0x50bfbb[_0xdcd0('0x38')]=qs['filters'](_[_0xdcd0('0x39')](_0x50b7f2[_0xdcd0('0x2f')],_0x3eef2c[_0xdcd0('0x3a')]),_0x155563);if(_0x50b7f2['query'][_0xdcd0('0x3b')]){_0x50bfbb[_0xdcd0('0x38')]=_[_0xdcd0('0x3c')](_0x50bfbb[_0xdcd0('0x38')],{'$or':_['map'](_0x155563,function(_0x16375a){if(_0x16375a[_0xdcd0('0x2c')]!==_0xdcd0('0x3d')){var _0x412e83={};_0x412e83[_0x16375a['name']]={'$like':'%'+_0x50b7f2[_0xdcd0('0x2f')]['filter']+'%'};return _0x412e83;}})});}_0x50bfbb=_[_0xdcd0('0x3c')]({},_0x50bfbb,_0x50b7f2[_0xdcd0('0x3e')]);var _0x16a25c={'where':_0x50bfbb['where']};return db[_0xdcd0('0x29')][_0xdcd0('0x1f')](_0x16a25c)[_0xdcd0('0x25')](function(_0xcc9af2){_0x3c0912[_0xdcd0('0x1f')]=_0xcc9af2;if(_0x50b7f2[_0xdcd0('0x2f')][_0xdcd0('0x3f')]){_0x50bfbb[_0xdcd0('0x40')]=[{'all':!![]}];}return db[_0xdcd0('0x29')][_0xdcd0('0x41')](_0x50bfbb);})[_0xdcd0('0x25')](function(_0x33f99d){_0x3c0912['rows']=_0x33f99d;return _0x3c0912;})['then'](respondWithFilteredResult(_0x1571ed,_0x50bfbb))[_0xdcd0('0x42')](handleError(_0x1571ed,null));};exports[_0xdcd0('0x43')]=function(_0x299a9b,_0x2a9cdd){var _0x341edf={'raw':!![],'where':{'id':_0x299a9b[_0xdcd0('0x44')]['id']}},_0x438c5f={};_0x438c5f['model']=_[_0xdcd0('0x30')](db[_0xdcd0('0x29')]['rawAttributes']);_0x438c5f[_0xdcd0('0x2f')]=_[_0xdcd0('0x30')](_0x299a9b[_0xdcd0('0x2f')]);_0x438c5f['filters']=_[_0xdcd0('0x31')](_0x438c5f[_0xdcd0('0x2e')],_0x438c5f[_0xdcd0('0x2f')]);_0x341edf[_0xdcd0('0x32')]=_[_0xdcd0('0x31')](_0x438c5f[_0xdcd0('0x2e')],qs['fields'](_0x299a9b[_0xdcd0('0x2f')][_0xdcd0('0x33')]));_0x341edf[_0xdcd0('0x32')]=_0x341edf[_0xdcd0('0x32')][_0xdcd0('0x34')]?_0x341edf['attributes']:_0x438c5f['model'];if(_0x299a9b[_0xdcd0('0x2f')]['includeAll']){_0x341edf[_0xdcd0('0x40')]=[{'all':!![]}];}_0x341edf=_[_0xdcd0('0x3c')]({},_0x341edf,_0x299a9b['options']);return db['VoiceTransferReport'][_0xdcd0('0x45')](_0x341edf)['then'](handleEntityNotFound(_0x2a9cdd,null))[_0xdcd0('0x25')](respondWithResult(_0x2a9cdd,null))[_0xdcd0('0x42')](handleError(_0x2a9cdd,null));};exports[_0xdcd0('0x46')]=function(_0x293050,_0x452fe0){return db[_0xdcd0('0x29')][_0xdcd0('0x46')](_0x293050[_0xdcd0('0x47')],{})[_0xdcd0('0x25')](respondWithResult(_0x452fe0,0xc9))[_0xdcd0('0x42')](handleError(_0x452fe0,null));};exports['update']=function(_0x31b74e,_0x763735){if(_0x31b74e[_0xdcd0('0x47')]['id']){delete _0x31b74e['body']['id'];}return db[_0xdcd0('0x29')][_0xdcd0('0x45')]({'where':{'id':_0x31b74e[_0xdcd0('0x44')]['id']}})['then'](handleEntityNotFound(_0x763735,null))[_0xdcd0('0x25')](saveUpdates(_0x31b74e['body'],null))[_0xdcd0('0x25')](respondWithResult(_0x763735,null))[_0xdcd0('0x42')](handleError(_0x763735,null));};exports['destroy']=function(_0x1e0193,_0x5a4314){return db[_0xdcd0('0x29')][_0xdcd0('0x45')]({'where':{'id':_0x1e0193['params']['id']}})[_0xdcd0('0x25')](handleEntityNotFound(_0x5a4314,null))[_0xdcd0('0x25')](removeEntity(_0x5a4314,null))[_0xdcd0('0x42')](handleError(_0x5a4314,null));};exports['describe']=function(_0xa4e838,_0x3ac5e4){return db[_0xdcd0('0x29')][_0xdcd0('0x48')]()[_0xdcd0('0x25')](respondWithResult(_0x3ac5e4,null))[_0xdcd0('0x42')](handleError(_0x3ac5e4,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index c0ed5a9..13bf67b 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 _0x581c=['../../config/environment','define','VoiceTransferReport','report_call_transfer','lodash','api','moment','bluebird','request-promise','rimraf'];(function(_0x2f14db,_0x5b73d1){var _0x452eea=function(_0x432dc9){while(--_0x432dc9){_0x2f14db['push'](_0x2f14db['shift']());}};_0x452eea(++_0x5b73d1);}(_0x581c,0x1a8));var _0xc581=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x581c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc581('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc581('0x1'));var moment=require(_0xc581('0x2'));var BPromise=require(_0xc581('0x3'));var rp=require(_0xc581('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc581('0x5'));var config=require(_0xc581('0x6'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x46eee3,_0x27e785){return _0x46eee3[_0xc581('0x7')](_0xc581('0x8'),attributes,{'tableName':_0xc581('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22fa=['../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x96f3e6,_0x3225e5){var _0x9ddaeb=function(_0x59f6cf){while(--_0x59f6cf){_0x96f3e6['push'](_0x96f3e6['shift']());}};_0x9ddaeb(++_0x3225e5);}(_0x22fa,0xdd));var _0xa22f=function(_0x31a125,_0x139136){_0x31a125=_0x31a125-0x0;var _0x1b1baa=_0x22fa[_0x31a125];return _0x1b1baa;};'use strict';var _=require(_0xa22f('0x0'));var util=require(_0xa22f('0x1'));var logger=require(_0xa22f('0x2'))(_0xa22f('0x3'));var moment=require(_0xa22f('0x4'));var BPromise=require('bluebird');var rp=require(_0xa22f('0x5'));var fs=require('fs');var path=require(_0xa22f('0x6'));var rimraf=require('rimraf');var config=require(_0xa22f('0x7'));var attributes=require(_0xa22f('0x8'));module[_0xa22f('0x9')]=function(_0x4e5171,_0x24f414){return _0x4e5171[_0xa22f('0xa')](_0xa22f('0xb'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index beb62bb..e63c9c2 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 _0x780e=['../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','then','stringify','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x780e,0x1b9));var _0xe780=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x780e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xe780('0x0'));var util=require(_0xe780('0x1'));var moment=require('moment');var BPromise=require(_0xe780('0x2'));var rs=require(_0xe780('0x3'));var fs=require('fs');var Redis=require(_0xe780('0x4'));var db=require(_0xe780('0x5'))['db'];var utils=require(_0xe780('0x6'));var logger=require(_0xe780('0x7'))(_0xe780('0x8'));var config=require(_0xe780('0x9'));var jayson=require(_0xe780('0xa'));var client=jayson[_0xe780('0xb')][_0xe780('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2eb4c1,_0x34c4ac,_0x44a3cc){return new BPromise(function(_0x4ba82b,_0x56daf7){return client[_0xe780('0xd')](_0x2eb4c1,_0x44a3cc)['then'](function(_0x49f82c){logger[_0xe780('0xe')](_0xe780('0xf'),_0x34c4ac,_0xe780('0x10'));logger['debug'](_0xe780('0x11'),_0x34c4ac,'request\x20sent',JSON['stringify'](_0x49f82c));if(_0x49f82c[_0xe780('0x12')]){if(_0x49f82c[_0xe780('0x12')][_0xe780('0x13')]===0x1f4){logger[_0xe780('0x12')](_0xe780('0xf'),_0x34c4ac,_0x49f82c[_0xe780('0x12')]['message']);return _0x56daf7(_0x49f82c['error'][_0xe780('0x14')]);}logger[_0xe780('0x12')](_0xe780('0xf'),_0x34c4ac,_0x49f82c['error'][_0xe780('0x14')]);return _0x4ba82b(_0x49f82c[_0xe780('0x12')][_0xe780('0x14')]);}else{logger[_0xe780('0xe')](_0xe780('0xf'),_0x34c4ac,'request\x20sent');_0x4ba82b(_0x49f82c[_0xe780('0x15')]['message']);}})['catch'](function(_0x3a74fb){logger[_0xe780('0x12')](_0xe780('0xf'),_0x34c4ac,_0x3a74fb);_0x56daf7(_0x3a74fb);});});}exports[_0xe780('0x16')]=function(_0x17fc25){var _0x274b8d=this;return new Promise(function(_0x3d8772,_0xb9da72){return db[_0xe780('0x17')][_0xe780('0x18')](_0x17fc25['body'],{'raw':_0x17fc25[_0xe780('0x19')]?_0x17fc25[_0xe780('0x19')][_0xe780('0x1a')]===undefined?!![]:![]:!![]})[_0xe780('0x1b')](function(_0x5ee0e5){logger[_0xe780('0xe')](_0xe780('0x16'),_0x17fc25);logger['debug'](_0xe780('0x16'),_0x17fc25,JSON[_0xe780('0x1c')](_0x5ee0e5));_0x3d8772(_0x5ee0e5);})[_0xe780('0x1d')](function(_0x3492fa){logger[_0xe780('0x12')]('CreateVoiceTransferReport',_0x3492fa[_0xe780('0x14')],_0x17fc25);_0xb9da72(_0x274b8d[_0xe780('0x12')](0x1f4,_0x3492fa[_0xe780('0x14')]));});});}; \ No newline at end of file +var _0x15cb=['CreateVoiceTransferReport','create','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch'];(function(_0xae75e,_0x248c50){var _0xcfc901=function(_0x704141){while(--_0x704141){_0xae75e['push'](_0xae75e['shift']());}};_0xcfc901(++_0x248c50);}(_0x15cb,0x1cf));var _0xb15c=function(_0x5a1678,_0x2ca3a1){_0x5a1678=_0x5a1678-0x0;var _0x314173=_0x15cb[_0x5a1678];return _0x314173;};'use strict';var _=require(_0xb15c('0x0'));var util=require(_0xb15c('0x1'));var moment=require(_0xb15c('0x2'));var BPromise=require(_0xb15c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb15c('0x4'));var db=require(_0xb15c('0x5'))['db'];var utils=require(_0xb15c('0x6'));var logger=require(_0xb15c('0x7'))(_0xb15c('0x8'));var config=require(_0xb15c('0x9'));var jayson=require(_0xb15c('0xa'));var client=jayson[_0xb15c('0xb')][_0xb15c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x45630b,_0x41eb50,_0x5a9224){return new BPromise(function(_0x1eaae2,_0x14e785){return client[_0xb15c('0xd')](_0x45630b,_0x5a9224)[_0xb15c('0xe')](function(_0x1df8e1){logger[_0xb15c('0xf')](_0xb15c('0x10'),_0x41eb50,_0xb15c('0x11'));logger[_0xb15c('0x12')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x41eb50,_0xb15c('0x11'),JSON[_0xb15c('0x13')](_0x1df8e1));if(_0x1df8e1['error']){if(_0x1df8e1[_0xb15c('0x14')]['code']===0x1f4){logger[_0xb15c('0x14')](_0xb15c('0x10'),_0x41eb50,_0x1df8e1['error'][_0xb15c('0x15')]);return _0x14e785(_0x1df8e1[_0xb15c('0x14')][_0xb15c('0x15')]);}logger[_0xb15c('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x41eb50,_0x1df8e1[_0xb15c('0x14')][_0xb15c('0x15')]);return _0x1eaae2(_0x1df8e1[_0xb15c('0x14')][_0xb15c('0x15')]);}else{logger[_0xb15c('0xf')](_0xb15c('0x10'),_0x41eb50,_0xb15c('0x11'));_0x1eaae2(_0x1df8e1['result'][_0xb15c('0x15')]);}})[_0xb15c('0x16')](function(_0x2152dc){logger[_0xb15c('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x41eb50,_0x2152dc);_0x14e785(_0x2152dc);});});}exports[_0xb15c('0x17')]=function(_0xe986c9){var _0x2ee057=this;return new Promise(function(_0x1b15f5,_0x38c5f9){return db['VoiceTransferReport'][_0xb15c('0x18')](_0xe986c9['body'],{'raw':_0xe986c9[_0xb15c('0x19')]?_0xe986c9[_0xb15c('0x19')][_0xb15c('0x1a')]===undefined?!![]:![]:!![]})[_0xb15c('0xe')](function(_0x2c977f){logger[_0xb15c('0xf')](_0xb15c('0x17'),_0xe986c9);logger[_0xb15c('0x12')](_0xb15c('0x17'),_0xe986c9,JSON[_0xb15c('0x13')](_0x2c977f));_0x1b15f5(_0x2c977f);})[_0xb15c('0x16')](function(_0x2d4fd2){logger[_0xb15c('0x14')](_0xb15c('0x17'),_0x2d4fd2[_0xb15c('0x15')],_0xe986c9);_0x38c5f9(_0x2ee057[_0xb15c('0x14')](0x1f4,_0x2d4fd2[_0xb15c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 4e727ee..43ebe4e 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 _0x0bb5=['unhold','/calls','calls','/transfer','exports','express','Router','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','/answer','/hold','hold','/unhold'];(function(_0x4f7d68,_0x4c6913){var _0x4d9cb2=function(_0x20a740){while(--_0x20a740){_0x4f7d68['push'](_0x4f7d68['shift']());}};_0x4d9cb2(++_0x4c6913);}(_0x0bb5,0x148));var _0x50bb=function(_0x4104bc,_0x5e9274){_0x4104bc=_0x4104bc-0x0;var _0x39c1cf=_0x0bb5[_0x4104bc];return _0x39c1cf;};'use strict';var express=require(_0x50bb('0x0'));var router=express[_0x50bb('0x1')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router[_0x50bb('0x2')](_0x50bb('0x3'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0x6')]);router[_0x50bb('0x2')](_0x50bb('0x7'),auth[_0x50bb('0x4')](),auth['isWebrtcLicence'](),controller['hangup']);router[_0x50bb('0x2')](_0x50bb('0x8'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller['answer']);router['post'](_0x50bb('0x9'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0xa')]);router['post'](_0x50bb('0xb'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0xc')]);router[_0x50bb('0x2')](_0x50bb('0xd'),auth[_0x50bb('0x4')](),auth['isWebrtcLicence'](),controller[_0x50bb('0xe')]);router['post'](_0x50bb('0xf'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller['transfer']);module[_0x50bb('0x10')]=router; \ No newline at end of file +var _0xedd9=['unhold','/calls','calls','/transfer','exports','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','answer','/hold','/unhold'];(function(_0x184a07,_0x21f49c){var _0x39326d=function(_0x825483){while(--_0x825483){_0x184a07['push'](_0x184a07['shift']());}};_0x39326d(++_0x21f49c);}(_0xedd9,0xfc));var _0x9edd=function(_0x56c316,_0x269a52){_0x56c316=_0x56c316-0x0;var _0x4e62e4=_0xedd9[_0x56c316];return _0x4e62e4;};'use strict';var express=require('express');var router=express[_0x9edd('0x0')]();var auth=require(_0x9edd('0x1'));var controller=require(_0x9edd('0x2'));router[_0x9edd('0x3')](_0x9edd('0x4'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x7')]);router['post'](_0x9edd('0x8'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x9')]);router['post'](_0x9edd('0xa'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller[_0x9edd('0xb')]);router[_0x9edd('0x3')](_0x9edd('0xc'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller['hold']);router[_0x9edd('0x3')](_0x9edd('0xd'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller[_0x9edd('0xe')]);router['post'](_0x9edd('0xf'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x10')]);router[_0x9edd('0x3')](_0x9edd('0x11'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller['transfer']);module[_0x9edd('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 9bee4f2..8768143 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 _0x6556=['client','http','../../config/logger','ioredis','redis','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','error','stack','name','status','send','NotFound','request','then','message','catch','findOne','VoiceChannels','all','rows','sessionId','length','originate','originate\x20fired:','body','validate','callNumber','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','userId','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','filter','UserId','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','util','bluebird'];(function(_0x1daa55,_0x5eba07){var _0xae58f4=function(_0x2bc7cf){while(--_0x2bc7cf){_0x1daa55['push'](_0x1daa55['shift']());}};_0xae58f4(++_0x5eba07);}(_0x6556,0x8b));var _0x6655=function(_0x9aa68c,_0x5ce11f){_0x9aa68c=_0x9aa68c-0x0;var _0x583fd5=_0x6556[_0x9aa68c];return _0x583fd5;};'use strict';var path=require(_0x6655('0x0'));var fs=require('fs');var _=require(_0x6655('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x6655('0x2'));var util=require(_0x6655('0x3'));var BPromise=require(_0x6655('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x6655('0x5')][_0x6655('0x6')]({'port':0x232a});var logger=require(_0x6655('0x7'))('webbarapi');var Redis=require(_0x6655('0x8'));config[_0x6655('0x9')]=_['defaults'](config[_0x6655('0x9')],{'host':_0x6655('0xa'),'port':0x18eb});var io=require(_0x6655('0xb'))(new Redis(config[_0x6655('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x6655('0xc'),'required':[!![],_0x6655('0xd')]},'callNumber':{'type':_0x6655('0xe'),'required':[!![],_0x6655('0xf')]},'callerId':{'type':_0x6655('0xe')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x6655('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x6655('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6655('0xd')]},'sessionId':{'type':_0x6655('0xe'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],_0x6655('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x6655('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x6655('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6655('0xd')]},'sessionId':{'type':_0x6655('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x6655('0xc'),'required':[!![],_0x6655('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6655('0xd')]}});function emit(_0x3d758f,_0xa66733,_0x3a8b84){logger[_0x6655('0x11')](_0x3d758f,_0xa66733,JSON[_0x6655('0x12')](_0x3a8b84));io['to'](_0x3d758f)[_0x6655('0x13')](_0xa66733,_0x3a8b84);}function handleError(_0x299c8b){return function(_0x2c6416){console['log'](_0x6655('0x14'),_0x2c6416,_0x2c6416 instanceof RangeError);logger[_0x6655('0x15')](_0x2c6416[_0x6655('0x16')]);if(_0x2c6416 instanceof RangeError){if(_0x2c6416[_0x6655('0x17')]){delete _0x2c6416[_0x6655('0x17')];}_0x299c8b[_0x6655('0x18')](0x194)[_0x6655('0x19')](_0x2c6416);}else{if(_0x2c6416[_0x6655('0x17')]){delete _0x2c6416[_0x6655('0x17')];}_0x299c8b['status'](0x1f4)['send'](_0x2c6416);}};}function checkError(){return function(_0x3cbe11){if(!_0x3cbe11){throw new RangeError(_0x6655('0x1a'));}return _0x3cbe11;};}function respondWithRpcPromise(_0x2642b5,_0x58bd88){return new BPromise(function(_0xf99c5c,_0x5e02d9){var _0x499b64=amiClient;return _0x499b64[_0x6655('0x1b')](_0x2642b5,_0x58bd88)[_0x6655('0x1c')](function(_0x46e142){if(_0x46e142[_0x6655('0x15')]){if(_0x46e142[_0x6655('0x15')]['code']===0x1f4){return _0x5e02d9(_0x46e142[_0x6655('0x15')][_0x6655('0x1d')]);}return _0xf99c5c(_0x46e142[_0x6655('0x15')][_0x6655('0x1d')]);}else{_0xf99c5c(_0x46e142['result']);}})[_0x6655('0x1e')](function(_0x5511d5){_0x5e02d9(_0x5511d5);});});}function getAgent(_0x186c9b){return db['User'][_0x6655('0x1f')]({'where':{'id':_0x186c9b,'role':'agent'}})[_0x6655('0x1c')](checkError());}function getAgentCheckSession(_0x1c1c27,_0x3df0fd){return new BPromise(function(_0xf7e151,_0x30a521){var _0x1b8595=respondWithRpcPromise(_0x6655('0x20'));var _0x591b20=getAgent(_0x1c1c27);Promise[_0x6655('0x21')]([_0x1b8595,_0x591b20])['then'](function(_0x28f7a8){var _0x8e229d=_0x28f7a8[0x0];var _0x1ad0f0=_0x28f7a8[0x1];var _0xbb3d73=_['filter'](_0x8e229d[_0x6655('0x22')],function(_0x1b0eff){return _0x1b0eff['UserId']==_0x1ad0f0['id']&&_0x1b0eff[_0x6655('0x23')]==_0x3df0fd;});if(_0xbb3d73[_0x6655('0x24')]==0x1){_0xf7e151(_0x1ad0f0);}else{_0x30a521(new RangeError('sessionId\x20'+_0x3df0fd+'\x20not\x20found!'));}});});}exports[_0x6655('0x25')]=function(_0x38a3fa,_0x35667f){logger[_0x6655('0x11')](_0x6655('0x26'),_0x38a3fa[_0x6655('0x27')]);var _0x2e319e=originateValidation[_0x6655('0x28')](_0x38a3fa[_0x6655('0x27')]);if(_0x2e319e[_0x6655('0x24')]>0x0){return _0x35667f[_0x6655('0x18')](0x190)['json'](_0x2e319e);}var _0x31ad26=_0x38a3fa[_0x6655('0x27')]['userId'];var _0x24424a=_0x38a3fa[_0x6655('0x27')][_0x6655('0x29')];var _0x6caead=_0x38a3fa[_0x6655('0x27')]['callerId'];var _0x2fde60=_0x38a3fa['body'][_0x6655('0x2a')];return getAgent(_0x31ad26)[_0x6655('0x1c')](function(_0x164dbb){logger[_0x6655('0x11')](_0x6655('0x2b'),_0x164dbb[_0x6655('0x17')]);emit(util[_0x6655('0x2c')](_0x6655('0x2d'),_0x164dbb[_0x6655('0x17')]),_0x6655('0x2e'),{'callNumber':_0x24424a,'callerId':_0x6caead,'callbackUrl':_0x2fde60});return _0x35667f[_0x6655('0x18')](0xc8)[_0x6655('0x2f')]({'error':![],'message':_0x6655('0x30')});})[_0x6655('0x1e')](handleError(_0x35667f));};exports['hangup']=function(_0x58c075,_0x7c5933){logger['info']('hangup\x20fired:',_0x58c075['body']);var _0x11f9ca=hangupValidation[_0x6655('0x28')](_0x58c075[_0x6655('0x27')]);if(_0x11f9ca['length']>0x0){return _0x7c5933['status'](0x190)[_0x6655('0x2f')](_0x11f9ca);}var _0x2565e5=_0x58c075['body'][_0x6655('0x31')];var _0x41b67e=_0x58c075[_0x6655('0x27')][_0x6655('0x23')];return getAgent(_0x2565e5)['then'](function(_0x3c66f1){logger[_0x6655('0x11')]('entityFound:',_0x3c66f1[_0x6655('0x17')]);emit(util[_0x6655('0x2c')](_0x6655('0x2d'),_0x3c66f1[_0x6655('0x17')]),'webbar:hangup',{'sessionId':_0x41b67e});return _0x7c5933['status'](0xc8)[_0x6655('0x2f')]({'error':![],'message':_0x6655('0x32')});})[_0x6655('0x1e')](handleError(_0x7c5933));};exports[_0x6655('0x33')]=function(_0x3dd9cc,_0x24d79a){logger[_0x6655('0x11')](_0x6655('0x34'),_0x3dd9cc[_0x6655('0x27')]);var _0x2bc1d4=answerValidation[_0x6655('0x28')](_0x3dd9cc['body']);if(_0x2bc1d4[_0x6655('0x24')]>0x0){return _0x24d79a[_0x6655('0x18')](0x190)['json'](_0x2bc1d4);}var _0x453d0d=_0x3dd9cc[_0x6655('0x27')][_0x6655('0x31')];var _0x487e14=_0x3dd9cc[_0x6655('0x27')][_0x6655('0x23')];return getAgent(_0x453d0d)['then'](function(_0x5b57e2){logger[_0x6655('0x11')]('entityFound:',_0x5b57e2['name']);emit(util['format']('user:%s',_0x5b57e2[_0x6655('0x17')]),_0x6655('0x35'),{'sessionId':_0x487e14});return _0x24d79a[_0x6655('0x18')](0xc8)['json']({'error':![],'message':_0x6655('0x36')});})['catch'](handleError(_0x24d79a));};exports[_0x6655('0x37')]=function(_0x5ced4b,_0x336328){logger[_0x6655('0x11')](_0x6655('0x38'),_0x5ced4b['body']);var _0x30c0ee=holdValidation[_0x6655('0x28')](_0x5ced4b[_0x6655('0x27')]);if(_0x30c0ee[_0x6655('0x24')]>0x0){return _0x336328[_0x6655('0x18')](0x190)[_0x6655('0x2f')](_0x30c0ee);}var _0x2928c2=_0x5ced4b[_0x6655('0x27')][_0x6655('0x31')];var _0x5e395b=_0x5ced4b[_0x6655('0x27')]['sessionId'];return getAgent(_0x2928c2)[_0x6655('0x1c')](function(_0x316c75){logger['info']('entityFound:',_0x316c75['name']);emit(util['format'](_0x6655('0x2d'),_0x316c75[_0x6655('0x17')]),_0x6655('0x39'),{'sessionId':_0x5e395b});return _0x336328[_0x6655('0x18')](0xc8)[_0x6655('0x2f')]({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x336328));};exports[_0x6655('0x3a')]=function(_0x34470c,_0x470a2c){logger['info'](_0x6655('0x3b'),_0x34470c['body']);var _0xe0ce15=unholdValidation[_0x6655('0x28')](_0x34470c[_0x6655('0x27')]);if(_0xe0ce15[_0x6655('0x24')]>0x0){return _0x470a2c['status'](0x190)['json'](_0xe0ce15);}var _0x4062ca=_0x34470c['body']['userId'];var _0x2f3e29=_0x34470c['body'][_0x6655('0x23')];return getAgent(_0x4062ca)[_0x6655('0x1c')](function(_0x1d428d){logger['info'](_0x6655('0x2b'),_0x1d428d[_0x6655('0x17')]);emit(util[_0x6655('0x2c')](_0x6655('0x2d'),_0x1d428d[_0x6655('0x17')]),_0x6655('0x3c'),{'sessionId':_0x2f3e29});return _0x470a2c[_0x6655('0x18')](0xc8)['json']({'error':![],'message':_0x6655('0x3d')});})[_0x6655('0x1e')](handleError(_0x470a2c));};exports['calls']=function(_0x4e3d5e,_0x137d57){logger['info'](_0x6655('0x3e'),_0x137d57[_0x6655('0x27')]);var _0x4fca1c=callsValidation[_0x6655('0x28')](_0x4e3d5e['body']);if(_0x4fca1c[_0x6655('0x24')]>0x0){return _0x137d57[_0x6655('0x18')](0x190)[_0x6655('0x2f')](_0x4fca1c);}var _0x1fa7e2=_0x4e3d5e[_0x6655('0x27')][_0x6655('0x31')];var _0x19f732=respondWithRpcPromise(_0x6655('0x20'));var _0x9ba02e=getAgent(_0x1fa7e2);return Promise['all']([_0x19f732,_0x9ba02e])[_0x6655('0x1c')](function(_0x1be99e){var _0x5b7cb2=_0x1be99e[0x0];var _0xf19f76=_0x1be99e[0x1];var _0x3719cd=_[_0x6655('0x3f')](_0x5b7cb2[_0x6655('0x22')],function(_0x443860){return _0x443860[_0x6655('0x40')]==_0xf19f76['id'];});return _0x137d57[_0x6655('0x18')](0xc8)[_0x6655('0x2f')]({'count':_0x3719cd[_0x6655('0x24')],'rows':_0x3719cd});})[_0x6655('0x1e')](handleError(_0x137d57));};exports[_0x6655('0x41')]=function(_0x50d5d0,_0x2aeeff){logger['info'](_0x6655('0x42'),_0x50d5d0[_0x6655('0x27')]);var _0x30ccfa=conferenceValidation['validate'](_0x50d5d0[_0x6655('0x27')]);if(_0x30ccfa[_0x6655('0x24')]>0x0){return _0x2aeeff[_0x6655('0x18')](0x190)[_0x6655('0x2f')](_0x30ccfa);}var _0x4d82a6=_0x50d5d0[_0x6655('0x27')]['userId'];return getAgent(_0x4d82a6)[_0x6655('0x1c')](function(_0x2c7d7c){logger[_0x6655('0x11')](_0x6655('0x2b'),_0x2c7d7c[_0x6655('0x17')]);emit(util[_0x6655('0x2c')](_0x6655('0x2d'),_0x2c7d7c['name']),_0x6655('0x43'));return _0x2aeeff[_0x6655('0x18')](0xc8)[_0x6655('0x2f')]({'error':![],'message':_0x6655('0x44')});})[_0x6655('0x1e')](handleError(_0x2aeeff));};exports['transfer']=function(_0x5631d2,_0x41fe78){logger['info']('transfer\x20fired:',_0x5631d2[_0x6655('0x27')]);var _0x5dc19f=transferValidation[_0x6655('0x28')](_0x5631d2[_0x6655('0x27')]);if(_0x5dc19f[_0x6655('0x24')]>0x0){return _0x41fe78[_0x6655('0x18')](0x190)[_0x6655('0x2f')](_0x5dc19f);}var _0x51c8a4=_0x5631d2[_0x6655('0x27')]['userId'];var _0x44d925=_0x5631d2['body']['sessionId'];var _0x245144=_0x5631d2[_0x6655('0x27')][_0x6655('0x45')];return getAgent(_0x51c8a4)[_0x6655('0x1c')](function(_0xaf6b67){logger[_0x6655('0x11')](_0x6655('0x2b'),_0xaf6b67['name']);emit(util[_0x6655('0x2c')](_0x6655('0x2d'),_0xaf6b67[_0x6655('0x17')]),_0x6655('0x46'),{'sessionId':_0x44d925,'transferNumber':_0x245144});return _0x41fe78[_0x6655('0x18')](0xc8)['json']({'error':![],'message':_0x6655('0x47')});})[_0x6655('0x1e')](handleError(_0x41fe78));}; \ No newline at end of file +var _0x3e47=['NotFound','request','then','code','message','catch','User','findOne','agent','VoiceChannels','filter','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','length','json','userId','callerId','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20executed!','answer','answer\x20fired:','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls\x20fired:','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../config/environment','bluebird','jayson/promise','client','http','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','log','handleError:','error','stack','name','status','send'];(function(_0x1beaff,_0x2b9d0e){var _0x1b1734=function(_0x27b541){while(--_0x27b541){_0x1beaff['push'](_0x1beaff['shift']());}};_0x1b1734(++_0x2b9d0e);}(_0x3e47,0x1a7));var _0x73e4=function(_0xec05a,_0xae2200){_0xec05a=_0xec05a-0x0;var _0x5911e2=_0x3e47[_0xec05a];return _0x5911e2;};'use strict';var path=require(_0x73e4('0x0'));var fs=require('fs');var _=require(_0x73e4('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x73e4('0x2'));var util=require('util');var BPromise=require(_0x73e4('0x3'));var jayson=require(_0x73e4('0x4'));var amiClient=jayson[_0x73e4('0x5')][_0x73e4('0x6')]({'port':0x232a});var logger=require('../../config/logger')(_0x73e4('0x7'));var Redis=require(_0x73e4('0x8'));config[_0x73e4('0x9')]=_['defaults'](config[_0x73e4('0x9')],{'host':_0x73e4('0xa'),'port':0x18eb});var io=require(_0x73e4('0xb'))(new Redis(config[_0x73e4('0x9')]));var Schema=require(_0x73e4('0xc'));var originateValidation=new Schema({'userId':{'type':_0x73e4('0xd'),'required':[!![],_0x73e4('0xe')]},'callNumber':{'type':_0x73e4('0xf'),'required':[!![],_0x73e4('0x10')]},'callerId':{'type':_0x73e4('0xf')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x73e4('0xe')]},'sessionId':{'type':_0x73e4('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x73e4('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x73e4('0xd'),'required':[!![],_0x73e4('0xe')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x73e4('0xf'),'required':[!![],_0x73e4('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x73e4('0xd'),'required':[!![],_0x73e4('0xe')]},'sessionId':{'type':_0x73e4('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x73e4('0xd'),'required':[!![],_0x73e4('0xe')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x73e4('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x73e4('0xd'),'required':[!![],_0x73e4('0xe')]}});function emit(_0x3c75fe,_0x1ba3ec,_0xc02123){logger['info'](_0x3c75fe,_0x1ba3ec,JSON[_0x73e4('0x12')](_0xc02123));io['to'](_0x3c75fe)[_0x73e4('0x13')](_0x1ba3ec,_0xc02123);}function handleError(_0x551227){return function(_0x501959){console[_0x73e4('0x14')](_0x73e4('0x15'),_0x501959,_0x501959 instanceof RangeError);logger[_0x73e4('0x16')](_0x501959[_0x73e4('0x17')]);if(_0x501959 instanceof RangeError){if(_0x501959['name']){delete _0x501959[_0x73e4('0x18')];}_0x551227['status'](0x194)['send'](_0x501959);}else{if(_0x501959[_0x73e4('0x18')]){delete _0x501959[_0x73e4('0x18')];}_0x551227[_0x73e4('0x19')](0x1f4)[_0x73e4('0x1a')](_0x501959);}};}function checkError(){return function(_0x2ed336){if(!_0x2ed336){throw new RangeError(_0x73e4('0x1b'));}return _0x2ed336;};}function respondWithRpcPromise(_0x488290,_0x42edc1){return new BPromise(function(_0x4cc68d,_0x6a8a99){var _0x2cf866=amiClient;return _0x2cf866[_0x73e4('0x1c')](_0x488290,_0x42edc1)[_0x73e4('0x1d')](function(_0x56abb8){if(_0x56abb8[_0x73e4('0x16')]){if(_0x56abb8[_0x73e4('0x16')][_0x73e4('0x1e')]===0x1f4){return _0x6a8a99(_0x56abb8['error']['message']);}return _0x4cc68d(_0x56abb8[_0x73e4('0x16')][_0x73e4('0x1f')]);}else{_0x4cc68d(_0x56abb8['result']);}})[_0x73e4('0x20')](function(_0x3a1d91){_0x6a8a99(_0x3a1d91);});});}function getAgent(_0x585880){return db[_0x73e4('0x21')][_0x73e4('0x22')]({'where':{'id':_0x585880,'role':_0x73e4('0x23')}})['then'](checkError());}function getAgentCheckSession(_0x245cfb,_0x58b33e){return new BPromise(function(_0x414d9d,_0xe3e2b5){var _0x4f468e=respondWithRpcPromise(_0x73e4('0x24'));var _0x5c45b5=getAgent(_0x245cfb);Promise['all']([_0x4f468e,_0x5c45b5])[_0x73e4('0x1d')](function(_0x1f4111){var _0x551c0c=_0x1f4111[0x0];var _0x2c0373=_0x1f4111[0x1];var _0x11c174=_[_0x73e4('0x25')](_0x551c0c[_0x73e4('0x26')],function(_0x4096d4){return _0x4096d4[_0x73e4('0x27')]==_0x2c0373['id']&&_0x4096d4[_0x73e4('0x28')]==_0x58b33e;});if(_0x11c174['length']==0x1){_0x414d9d(_0x2c0373);}else{_0xe3e2b5(new RangeError(_0x73e4('0x29')+_0x58b33e+_0x73e4('0x2a')));}});});}exports[_0x73e4('0x2b')]=function(_0x131b29,_0x2f0fff){logger[_0x73e4('0x2c')](_0x73e4('0x2d'),_0x131b29[_0x73e4('0x2e')]);var _0x2b2a35=originateValidation['validate'](_0x131b29[_0x73e4('0x2e')]);if(_0x2b2a35[_0x73e4('0x2f')]>0x0){return _0x2f0fff[_0x73e4('0x19')](0x190)[_0x73e4('0x30')](_0x2b2a35);}var _0x3ea35f=_0x131b29[_0x73e4('0x2e')][_0x73e4('0x31')];var _0x172adb=_0x131b29[_0x73e4('0x2e')]['callNumber'];var _0xb61c83=_0x131b29[_0x73e4('0x2e')][_0x73e4('0x32')];var _0x356f64=_0x131b29['body']['callbackUrl'];return getAgent(_0x3ea35f)[_0x73e4('0x1d')](function(_0x1eb8bc){logger[_0x73e4('0x2c')](_0x73e4('0x33'),_0x1eb8bc[_0x73e4('0x18')]);emit(util[_0x73e4('0x34')](_0x73e4('0x35'),_0x1eb8bc['name']),_0x73e4('0x36'),{'callNumber':_0x172adb,'callerId':_0xb61c83,'callbackUrl':_0x356f64});return _0x2f0fff[_0x73e4('0x19')](0xc8)[_0x73e4('0x30')]({'error':![],'message':_0x73e4('0x37')});})[_0x73e4('0x20')](handleError(_0x2f0fff));};exports[_0x73e4('0x38')]=function(_0x48ecb0,_0x1f9d71){logger[_0x73e4('0x2c')]('hangup\x20fired:',_0x48ecb0[_0x73e4('0x2e')]);var _0x12d3ea=hangupValidation[_0x73e4('0xc')](_0x48ecb0[_0x73e4('0x2e')]);if(_0x12d3ea[_0x73e4('0x2f')]>0x0){return _0x1f9d71[_0x73e4('0x19')](0x190)['json'](_0x12d3ea);}var _0x31266f=_0x48ecb0['body']['userId'];var _0x50ff8c=_0x48ecb0[_0x73e4('0x2e')][_0x73e4('0x28')];return getAgent(_0x31266f)[_0x73e4('0x1d')](function(_0xdc13e1){logger[_0x73e4('0x2c')]('entityFound:',_0xdc13e1[_0x73e4('0x18')]);emit(util[_0x73e4('0x34')](_0x73e4('0x35'),_0xdc13e1[_0x73e4('0x18')]),'webbar:hangup',{'sessionId':_0x50ff8c});return _0x1f9d71[_0x73e4('0x19')](0xc8)[_0x73e4('0x30')]({'error':![],'message':_0x73e4('0x39')});})['catch'](handleError(_0x1f9d71));};exports[_0x73e4('0x3a')]=function(_0x517756,_0x1e3547){logger[_0x73e4('0x2c')](_0x73e4('0x3b'),_0x517756[_0x73e4('0x2e')]);var _0x456ac9=answerValidation[_0x73e4('0xc')](_0x517756[_0x73e4('0x2e')]);if(_0x456ac9[_0x73e4('0x2f')]>0x0){return _0x1e3547[_0x73e4('0x19')](0x190)[_0x73e4('0x30')](_0x456ac9);}var _0x1babc4=_0x517756[_0x73e4('0x2e')][_0x73e4('0x31')];var _0x1cc3c0=_0x517756[_0x73e4('0x2e')][_0x73e4('0x28')];return getAgent(_0x1babc4)[_0x73e4('0x1d')](function(_0x19b9dd){logger['info']('entityFound:',_0x19b9dd[_0x73e4('0x18')]);emit(util[_0x73e4('0x34')](_0x73e4('0x35'),_0x19b9dd[_0x73e4('0x18')]),'webbar:answer',{'sessionId':_0x1cc3c0});return _0x1e3547[_0x73e4('0x19')](0xc8)['json']({'error':![],'message':_0x73e4('0x3c')});})['catch'](handleError(_0x1e3547));};exports['hold']=function(_0x43bbfa,_0x23543a){logger['info'](_0x73e4('0x3d'),_0x43bbfa[_0x73e4('0x2e')]);var _0xb0fb66=holdValidation[_0x73e4('0xc')](_0x43bbfa['body']);if(_0xb0fb66[_0x73e4('0x2f')]>0x0){return _0x23543a['status'](0x190)['json'](_0xb0fb66);}var _0x300959=_0x43bbfa['body'][_0x73e4('0x31')];var _0x48aa33=_0x43bbfa[_0x73e4('0x2e')][_0x73e4('0x28')];return getAgent(_0x300959)[_0x73e4('0x1d')](function(_0x39456c){logger[_0x73e4('0x2c')](_0x73e4('0x33'),_0x39456c[_0x73e4('0x18')]);emit(util['format'](_0x73e4('0x35'),_0x39456c[_0x73e4('0x18')]),_0x73e4('0x3e'),{'sessionId':_0x48aa33});return _0x23543a[_0x73e4('0x19')](0xc8)['json']({'error':![],'message':_0x73e4('0x3f')});})[_0x73e4('0x20')](handleError(_0x23543a));};exports[_0x73e4('0x40')]=function(_0x2597c1,_0x6596a8){logger['info'](_0x73e4('0x41'),_0x2597c1['body']);var _0xa74011=unholdValidation[_0x73e4('0xc')](_0x2597c1[_0x73e4('0x2e')]);if(_0xa74011['length']>0x0){return _0x6596a8[_0x73e4('0x19')](0x190)['json'](_0xa74011);}var _0x54049f=_0x2597c1['body']['userId'];var _0xf8cab9=_0x2597c1[_0x73e4('0x2e')]['sessionId'];return getAgent(_0x54049f)[_0x73e4('0x1d')](function(_0x3015c4){logger['info'](_0x73e4('0x33'),_0x3015c4['name']);emit(util[_0x73e4('0x34')](_0x73e4('0x35'),_0x3015c4['name']),_0x73e4('0x42'),{'sessionId':_0xf8cab9});return _0x6596a8['status'](0xc8)[_0x73e4('0x30')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x6596a8));};exports['calls']=function(_0x537c7b,_0x3bce19){logger[_0x73e4('0x2c')](_0x73e4('0x43'),_0x3bce19[_0x73e4('0x2e')]);var _0x820772=callsValidation['validate'](_0x537c7b['body']);if(_0x820772[_0x73e4('0x2f')]>0x0){return _0x3bce19['status'](0x190)[_0x73e4('0x30')](_0x820772);}var _0x380308=_0x537c7b[_0x73e4('0x2e')][_0x73e4('0x31')];var _0x5c013b=respondWithRpcPromise(_0x73e4('0x24'));var _0xd73936=getAgent(_0x380308);return Promise['all']([_0x5c013b,_0xd73936])['then'](function(_0x8196cd){var _0x3dfabe=_0x8196cd[0x0];var _0x3df763=_0x8196cd[0x1];var _0x5eaa52=_[_0x73e4('0x25')](_0x3dfabe[_0x73e4('0x26')],function(_0x14aad2){return _0x14aad2[_0x73e4('0x27')]==_0x3df763['id'];});return _0x3bce19['status'](0xc8)['json']({'count':_0x5eaa52[_0x73e4('0x2f')],'rows':_0x5eaa52});})[_0x73e4('0x20')](handleError(_0x3bce19));};exports[_0x73e4('0x44')]=function(_0x40ef8b,_0x39abf1){logger[_0x73e4('0x2c')]('conference\x20fired:',_0x40ef8b[_0x73e4('0x2e')]);var _0x1a5a68=conferenceValidation[_0x73e4('0xc')](_0x40ef8b[_0x73e4('0x2e')]);if(_0x1a5a68[_0x73e4('0x2f')]>0x0){return _0x39abf1[_0x73e4('0x19')](0x190)[_0x73e4('0x30')](_0x1a5a68);}var _0x4ae2a9=_0x40ef8b[_0x73e4('0x2e')][_0x73e4('0x31')];return getAgent(_0x4ae2a9)[_0x73e4('0x1d')](function(_0x4fd707){logger[_0x73e4('0x2c')](_0x73e4('0x33'),_0x4fd707[_0x73e4('0x18')]);emit(util[_0x73e4('0x34')](_0x73e4('0x35'),_0x4fd707[_0x73e4('0x18')]),_0x73e4('0x45'));return _0x39abf1[_0x73e4('0x19')](0xc8)[_0x73e4('0x30')]({'error':![],'message':_0x73e4('0x46')});})[_0x73e4('0x20')](handleError(_0x39abf1));};exports[_0x73e4('0x47')]=function(_0x36cd12,_0x2ce8e8){logger['info'](_0x73e4('0x48'),_0x36cd12[_0x73e4('0x2e')]);var _0x2d82b1=transferValidation[_0x73e4('0xc')](_0x36cd12[_0x73e4('0x2e')]);if(_0x2d82b1['length']>0x0){return _0x2ce8e8['status'](0x190)[_0x73e4('0x30')](_0x2d82b1);}var _0x14160b=_0x36cd12['body'][_0x73e4('0x31')];var _0x5bb963=_0x36cd12['body'][_0x73e4('0x28')];var _0x2eceb5=_0x36cd12[_0x73e4('0x2e')][_0x73e4('0x49')];return getAgent(_0x14160b)[_0x73e4('0x1d')](function(_0x131449){logger[_0x73e4('0x2c')](_0x73e4('0x33'),_0x131449[_0x73e4('0x18')]);emit(util['format'](_0x73e4('0x35'),_0x131449[_0x73e4('0x18')]),'webbar:transfer',{'sessionId':_0x5bb963,'transferNumber':_0x2eceb5});return _0x2ce8e8[_0x73e4('0x19')](0xc8)['json']({'error':![],'message':_0x73e4('0x4a')});})[_0x73e4('0x20')](handleError(_0x2ce8e8));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index d7b21c2..455eeca 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 _0x134e=['getAnswers','/:id/users','getAgents','/:id/applications','post','addDisposition','addAnswer','addApplications','/:id/notify','notify','/:id/send','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x406dfa,_0x5b15c6){var _0x39556d=function(_0x2279ce){while(--_0x2279ce){_0x406dfa['push'](_0x406dfa['shift']());}};_0x39556d(++_0x5b15c6);}(_0x134e,0x113));var _0xe134=function(_0x344573,_0x153172){_0x344573=_0x344573-0x0;var _0x4317de=_0x134e[_0x344573];return _0x4317de;};'use strict';var multer=require(_0xe134('0x0'));var util=require(_0xe134('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe134('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe134('0x3'));var interaction=require(_0xe134('0x4'));var config=require(_0xe134('0x5'));var controller=require('./whatsappAccount.controller');router[_0xe134('0x6')]('/',auth[_0xe134('0x7')](),controller[_0xe134('0x8')]);router[_0xe134('0x6')]('/describe',auth[_0xe134('0x7')](),controller['describe']);router[_0xe134('0x6')](_0xe134('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xe134('0x6')](_0xe134('0xa'),auth['isAuthenticated'](),controller[_0xe134('0xb')]);router[_0xe134('0x6')](_0xe134('0xc'),auth['isAuthenticated'](),controller[_0xe134('0xd')]);router[_0xe134('0x6')](_0xe134('0xe'),auth['isAuthenticated'](),controller[_0xe134('0xf')]);router[_0xe134('0x6')](_0xe134('0x10'),auth['isAuthenticated'](),controller['getApplications']);router[_0xe134('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe134('0x11')](_0xe134('0xa'),auth['isAuthenticated'](),controller[_0xe134('0x12')]);router[_0xe134('0x11')](_0xe134('0xc'),auth[_0xe134('0x7')](),controller[_0xe134('0x13')]);router['post'](_0xe134('0xe'),auth['isAuthenticated'](),controller['addAgents']);router[_0xe134('0x11')](_0xe134('0x10'),auth[_0xe134('0x7')](),controller[_0xe134('0x14')]);router[_0xe134('0x11')](_0xe134('0x15'),controller[_0xe134('0x16')]);router[_0xe134('0x11')](_0xe134('0x17'),auth[_0xe134('0x7')](),controller[_0xe134('0x18')]);router[_0xe134('0x19')](_0xe134('0x9'),auth[_0xe134('0x7')](),controller['update']);router[_0xe134('0x1a')]('/:id',auth[_0xe134('0x7')](),controller[_0xe134('0x1b')]);router[_0xe134('0x1a')](_0xe134('0xa'),auth[_0xe134('0x7')](),controller[_0xe134('0x1c')]);router[_0xe134('0x1a')](_0xe134('0xc'),auth['isAuthenticated'](),controller[_0xe134('0x1d')]);router[_0xe134('0x1a')]('/:id/users',auth[_0xe134('0x7')](),controller[_0xe134('0x1e')]);module[_0xe134('0x1f')]=router; \ No newline at end of file +var _0x5bbb=['send','put','destroy','delete','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','create','post','addDisposition','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','/:id/send'];(function(_0x443ca4,_0x78ea7d){var _0x5ea337=function(_0x5a7049){while(--_0x5a7049){_0x443ca4['push'](_0x443ca4['shift']());}};_0x5ea337(++_0x78ea7d);}(_0x5bbb,0xe4));var _0xb5bb=function(_0xf8948d,_0x482590){_0xf8948d=_0xf8948d-0x0;var _0x23a31c=_0x5bbb[_0xf8948d];return _0x23a31c;};'use strict';var multer=require(_0xb5bb('0x0'));var util=require(_0xb5bb('0x1'));var path=require(_0xb5bb('0x2'));var timeout=require(_0xb5bb('0x3'));var express=require(_0xb5bb('0x4'));var router=express[_0xb5bb('0x5')]();var fs_extra=require(_0xb5bb('0x6'));var auth=require(_0xb5bb('0x7'));var interaction=require(_0xb5bb('0x8'));var config=require(_0xb5bb('0x9'));var controller=require(_0xb5bb('0xa'));router[_0xb5bb('0xb')]('/',auth[_0xb5bb('0xc')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xb5bb('0xd')]);router[_0xb5bb('0xb')](_0xb5bb('0xe'),auth[_0xb5bb('0xc')](),controller[_0xb5bb('0xf')]);router[_0xb5bb('0xb')](_0xb5bb('0x10'),auth[_0xb5bb('0xc')](),controller['getDispositions']);router['get'](_0xb5bb('0x11'),auth[_0xb5bb('0xc')](),controller[_0xb5bb('0x12')]);router[_0xb5bb('0xb')]('/:id/users',auth[_0xb5bb('0xc')](),controller[_0xb5bb('0x13')]);router[_0xb5bb('0xb')](_0xb5bb('0x14'),auth[_0xb5bb('0xc')](),controller[_0xb5bb('0x15')]);router['post']('/',auth[_0xb5bb('0xc')](),controller[_0xb5bb('0x16')]);router[_0xb5bb('0x17')](_0xb5bb('0x10'),auth[_0xb5bb('0xc')](),controller[_0xb5bb('0x18')]);router[_0xb5bb('0x17')](_0xb5bb('0x11'),auth['isAuthenticated'](),controller[_0xb5bb('0x19')]);router['post'](_0xb5bb('0x1a'),auth[_0xb5bb('0xc')](),controller[_0xb5bb('0x1b')]);router[_0xb5bb('0x17')](_0xb5bb('0x14'),auth[_0xb5bb('0xc')](),controller[_0xb5bb('0x1c')]);router['post'](_0xb5bb('0x1d'),controller['notify']);router['post'](_0xb5bb('0x1e'),auth[_0xb5bb('0xc')](),controller[_0xb5bb('0x1f')]);router[_0xb5bb('0x20')](_0xb5bb('0xe'),auth[_0xb5bb('0xc')](),controller['update']);router['delete'](_0xb5bb('0xe'),auth[_0xb5bb('0xc')](),controller[_0xb5bb('0x21')]);router[_0xb5bb('0x22')]('/:id/dispositions',auth[_0xb5bb('0xc')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0xb5bb('0xc')](),controller[_0xb5bb('0x23')]);router[_0xb5bb('0x22')](_0xb5bb('0x1a'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xb5bb('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 5123dbd..1089db0 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 _0x0899=['mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x2c415d,_0x55e832){var _0x4a671a=function(_0xed6996){while(--_0xed6996){_0x2c415d['push'](_0x2c415d['shift']());}};_0x4a671a(++_0x55e832);}(_0x0899,0x183));var _0x9089=function(_0x1b5792,_0x16b34b){_0x1b5792=_0x1b5792-0x0;var _0xc25239=_0x0899[_0x1b5792];return _0xc25239;};'use strict';var Sequelize=require(_0x9089('0x0'));var rs=require(_0x9089('0x1'));module[_0x9089('0x2')]={'name':{'type':Sequelize[_0x9089('0x3')],'unique':_0x9089('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x9089('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x9089('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x9089('0x5')]();}},'phone':{'type':Sequelize[_0x9089('0x3')]},'type':{'type':Sequelize[_0x9089('0x6')](_0x9089('0x7'),'sinch')},'accountSid':{'type':Sequelize[_0x9089('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9089('0x8');}},'notificationSound':{'type':Sequelize[_0x9089('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x9089('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9089('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9089('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9089('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9089('0xa')],'comment':_0x9089('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x9089('0x9')],'defaultValue':![],'comment':_0x9089('0xc'),'set':function(_0x451fc2){if(!_0x451fc2){this['setDataValue'](_0x9089('0xd'),null);}this[_0x9089('0xe')](_0x9089('0xf'),_0x451fc2);}},'description':{'type':Sequelize[_0x9089('0x3')]}}; \ No newline at end of file +var _0x016d=['sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','name','STRING','generate','twilio'];(function(_0x558697,_0x41e242){var _0x4812d6=function(_0xafaa77){while(--_0xafaa77){_0x558697['push'](_0x558697['shift']());}};_0x4812d6(++_0x41e242);}(_0x016d,0x171));var _0xd016=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x016d[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xd016('0x0'));var rs=require(_0xd016('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xd016('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xd016('0x3')],'defaultValue':function(){return rs[_0xd016('0x4')]();}},'phone':{'type':Sequelize[_0xd016('0x3')]},'type':{'type':Sequelize['ENUM'](_0xd016('0x5'),_0xd016('0x6'))},'accountSid':{'type':Sequelize[_0xd016('0x3')]},'baseUrl':{'type':Sequelize[_0xd016('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xd016('0x7')],'defaultValue':function(){return _0xd016('0x8');}},'notificationSound':{'type':Sequelize[_0xd016('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xd016('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd016('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd016('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd016('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd016('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd016('0xa')],'comment':_0xd016('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x7cb6d9){if(!_0x7cb6d9){this[_0xd016('0xc')](_0xd016('0xd'),null);}this[_0xd016('0xc')](_0xd016('0xe'),_0x7cb6d9);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 57ac9e0..382a226 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 _0x9616=['userWhatsappAccount:remove','getAgents','User','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','finally','getApplications','whatsapp','Applications','account','sinch','statuses','state','read','message_id','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','replace','MessageSid','notifications','from','messageId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','Contacts','DESC','list','contact','WhatsappInteraction','spread','interaction','autoclose','push','close','*,*,*,*','created','WhatsappMessage','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','show','params','WhatsappAccount','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Pause','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','omit','emit','userWhatsappAccount:save','removeAgents','isArray'];(function(_0x583338,_0xa95782){var _0x311f22=function(_0x5ec00c){while(--_0x5ec00c){_0x583338['push'](_0x583338['shift']());}};_0x311f22(++_0xa95782);}(_0x9616,0x112));var _0x6961=function(_0x1a51db,_0x2eecdc){_0x1a51db=_0x1a51db-0x0;var _0xea0473=_0x9616[_0x1a51db];return _0xea0473;};'use strict';var emlformat=require(_0x6961('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6961('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6961('0x2'));var Mustache=require(_0x6961('0x3'));var util=require(_0x6961('0x4'));var path=require(_0x6961('0x5'));var sox=require(_0x6961('0x6'));var csv=require(_0x6961('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6961('0x8'));var squel=require(_0x6961('0x9'));var crypto=require('crypto');var jsforce=require(_0x6961('0xa'));var deskjs=require(_0x6961('0xb'));var toCsv=require(_0x6961('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6961('0xc'));var qs=require(_0x6961('0xd'));var as=require(_0x6961('0xe'));var hardwareService=require(_0x6961('0xf'));var logger=require(_0x6961('0x10'))(_0x6961('0x11'));var utils=require('../../config/utils');var config=require(_0x6961('0x12'));var licenseUtil=require(_0x6961('0x13'));var db=require(_0x6961('0x14'))['db'];config[_0x6961('0x15')]=_[_0x6961('0x16')](config[_0x6961('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x6961('0x17'))(new Redis(config[_0x6961('0x15')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x6961('0x18'));var client=jayson[_0x6961('0x19')][_0x6961('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x198d07,_0x254937,_0x6d8d6c,_0x362f34){return new BPromise(function(_0x4da5da,_0x3daad0){var _0x2a334f=_0x362f34||client;return _0x2a334f[_0x6961('0x1b')](_0x198d07,_0x6d8d6c)[_0x6961('0x1c')](function(_0x5d414d){logger[_0x6961('0x1d')](_0x6961('0x1e'),_0x254937,_0x6961('0x1f'));logger[_0x6961('0x20')](_0x6961('0x21'),_0x254937,_0x6961('0x1f'),JSON[_0x6961('0x22')](_0x5d414d));if(_0x5d414d[_0x6961('0x23')]){if(_0x5d414d[_0x6961('0x23')][_0x6961('0x24')]===0x1f4){logger[_0x6961('0x23')](_0x6961('0x1e'),_0x254937,_0x5d414d['error'][_0x6961('0x25')]);return _0x3daad0(_0x5d414d[_0x6961('0x23')][_0x6961('0x25')]);}logger[_0x6961('0x23')](_0x6961('0x1e'),_0x254937,_0x5d414d[_0x6961('0x23')][_0x6961('0x25')]);return _0x4da5da(_0x5d414d[_0x6961('0x23')][_0x6961('0x25')]);}else{logger[_0x6961('0x1d')]('WhatsappAccount,\x20%s,\x20%s',_0x254937,'request\x20sent');_0x4da5da(_0x5d414d[_0x6961('0x26')][_0x6961('0x25')]);}})[_0x6961('0x27')](function(_0x53431b){logger[_0x6961('0x23')](_0x6961('0x1e'),_0x254937,_0x53431b);_0x3daad0(_0x53431b);});});}function respondWithStatusCode(_0x501d8e,_0x4826e9){_0x4826e9=_0x4826e9||0xcc;return function(_0x53c090){if(_0x53c090){return _0x501d8e[_0x6961('0x28')](_0x4826e9);}return _0x501d8e[_0x6961('0x29')](_0x4826e9)[_0x6961('0x2a')]();};}function respondWithResult(_0x2cdb42,_0x48368d){_0x48368d=_0x48368d||0xc8;return function(_0x2061a6){if(_0x2061a6){return _0x2cdb42[_0x6961('0x29')](_0x48368d)[_0x6961('0x2b')](_0x2061a6);}};}function respondWithFilteredResult(_0x1bd951,_0x57eff6){return function(_0x2fcc44){if(_0x2fcc44){var _0x3b313b=typeof _0x57eff6[_0x6961('0x2c')]==='undefined'&&typeof _0x57eff6[_0x6961('0x2d')]===_0x6961('0x2e');var _0x4581cb=_0x2fcc44[_0x6961('0x2f')];var _0x13c0ae=_0x3b313b?0x0:_0x57eff6[_0x6961('0x2c')];var _0x2c1803=_0x3b313b?_0x2fcc44[_0x6961('0x2f')]:_0x57eff6['offset']+_0x57eff6['limit'];var _0x360be6;if(_0x2c1803>=_0x4581cb){_0x2c1803=_0x4581cb;_0x360be6=0xc8;}else{_0x360be6=0xce;}_0x1bd951['status'](_0x360be6);return _0x1bd951[_0x6961('0x30')](_0x6961('0x31'),_0x13c0ae+'-'+_0x2c1803+'/'+_0x4581cb)[_0x6961('0x2b')](_0x2fcc44);}return null;};}function patchUpdates(_0x2ad992){return function(_0x38e3e5){try{jsonpatch[_0x6961('0x32')](_0x38e3e5,_0x2ad992,!![]);}catch(_0x225642){return BPromise[_0x6961('0x33')](_0x225642);}return _0x38e3e5[_0x6961('0x34')]();};}function saveUpdates(_0x2bca76,_0x535b8e){return function(_0x58e867){if(_0x58e867){return _0x58e867[_0x6961('0x35')](_0x2bca76)['then'](function(_0x248c8c){return _0x248c8c;});}return null;};}function removeEntity(_0x49c771,_0x5801fc){return function(_0x15bd05){if(_0x15bd05){return _0x15bd05[_0x6961('0x36')]()[_0x6961('0x1c')](function(){var _0x2478ce=_0x15bd05[_0x6961('0x37')]({'plain':!![]});var _0x33ca57=_0x6961('0x38');return db[_0x6961('0x39')][_0x6961('0x36')]({'where':{'type':_0x33ca57,'resourceId':_0x2478ce['id']}})[_0x6961('0x1c')](function(){return _0x15bd05;});})['then'](function(){_0x49c771[_0x6961('0x29')](0xcc)[_0x6961('0x2a')]();});}};}function handleEntityNotFound(_0x24e3fc,_0x34a81e){return function(_0x421929){if(!_0x421929){_0x24e3fc[_0x6961('0x28')](0x194);}return _0x421929;};}function handleError(_0x30b780,_0xda1a73){_0xda1a73=_0xda1a73||0x1f4;return function(_0x509e3c){logger[_0x6961('0x23')](_0x509e3c[_0x6961('0x3a')]);if(_0x509e3c[_0x6961('0x3b')]){delete _0x509e3c['name'];}_0x30b780[_0x6961('0x29')](_0xda1a73)[_0x6961('0x3c')](_0x509e3c);};}exports[_0x6961('0x3d')]=function(_0x3d24e6,_0x3cc5b3){var _0x528213={'include':[{'model':db['Pause'],'as':_0x6961('0x3e')}]},_0x4d1ae0={},_0x4f5d0c={'count':0x0,'rows':[]};var _0x4f0c71=_[_0x6961('0x3f')](db['WhatsappAccount'][_0x6961('0x40')],function(_0x170912){return{'name':_0x170912[_0x6961('0x41')],'type':_0x170912['type'][_0x6961('0x42')]};});_0x4d1ae0[_0x6961('0x43')]=_[_0x6961('0x3f')](_0x4f0c71,'name');_0x4d1ae0[_0x6961('0x44')]=_['keys'](_0x3d24e6[_0x6961('0x44')]);_0x4d1ae0[_0x6961('0x45')]=_[_0x6961('0x46')](_0x4d1ae0[_0x6961('0x43')],_0x4d1ae0[_0x6961('0x44')]);_0x528213[_0x6961('0x47')]=_[_0x6961('0x46')](_0x4d1ae0[_0x6961('0x43')],qs['fields'](_0x3d24e6[_0x6961('0x44')][_0x6961('0x48')]));_0x528213[_0x6961('0x47')]=_0x528213['attributes'][_0x6961('0x49')]?_0x528213[_0x6961('0x47')]:_0x4d1ae0['model'];if(!_0x3d24e6[_0x6961('0x44')][_0x6961('0x4a')](_0x6961('0x4b'))){_0x528213['limit']=qs['limit'](_0x3d24e6[_0x6961('0x44')][_0x6961('0x2d')]);_0x528213[_0x6961('0x2c')]=qs[_0x6961('0x2c')](_0x3d24e6[_0x6961('0x44')]['offset']);}_0x528213[_0x6961('0x4c')]=qs[_0x6961('0x4d')](_0x3d24e6['query'][_0x6961('0x4d')]);_0x528213[_0x6961('0x4e')]=qs[_0x6961('0x45')](_[_0x6961('0x4f')](_0x3d24e6['query'],_0x4d1ae0['filters']),_0x4f0c71);if(_0x3d24e6[_0x6961('0x44')][_0x6961('0x50')]){_0x528213['where']=_['merge'](_0x528213['where'],{'$or':_[_0x6961('0x3f')](_0x4f0c71,function(_0x5d2299){if(_0x5d2299[_0x6961('0x51')]!==_0x6961('0x52')){var _0x1529ff={};_0x1529ff[_0x5d2299['name']]={'$like':'%'+_0x3d24e6[_0x6961('0x44')][_0x6961('0x50')]+'%'};return _0x1529ff;}})});}_0x528213=_[_0x6961('0x53')]({},_0x528213,_0x3d24e6[_0x6961('0x54')]);var _0x61dc62={'where':_0x528213[_0x6961('0x4e')]};return db['WhatsappAccount'][_0x6961('0x2f')](_0x61dc62)[_0x6961('0x1c')](function(_0x2128bb){_0x4f5d0c['count']=_0x2128bb;if(_0x3d24e6[_0x6961('0x44')][_0x6961('0x55')]){_0x528213[_0x6961('0x56')]=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x528213);})[_0x6961('0x1c')](function(_0x231eda){_0x4f5d0c['rows']=_0x231eda;return _0x4f5d0c;})[_0x6961('0x1c')](respondWithFilteredResult(_0x3cc5b3,_0x528213))[_0x6961('0x27')](handleError(_0x3cc5b3,null));};exports[_0x6961('0x57')]=function(_0x4e548b,_0x297e93){var _0x2e022b={'raw':![],'where':{'id':_0x4e548b[_0x6961('0x58')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1506ee={};_0x1506ee[_0x6961('0x43')]=_['keys'](db[_0x6961('0x59')]['rawAttributes']);_0x1506ee[_0x6961('0x44')]=_[_0x6961('0x5a')](_0x4e548b[_0x6961('0x44')]);_0x1506ee['filters']=_[_0x6961('0x46')](_0x1506ee['model'],_0x1506ee[_0x6961('0x44')]);_0x2e022b[_0x6961('0x47')]=_[_0x6961('0x46')](_0x1506ee[_0x6961('0x43')],qs[_0x6961('0x48')](_0x4e548b[_0x6961('0x44')][_0x6961('0x48')]));_0x2e022b['attributes']=_0x2e022b[_0x6961('0x47')][_0x6961('0x49')]?_0x2e022b[_0x6961('0x47')]:_0x1506ee[_0x6961('0x43')];if(_0x4e548b[_0x6961('0x44')][_0x6961('0x55')]){_0x2e022b[_0x6961('0x56')]=[{'all':!![]}];}_0x2e022b=_[_0x6961('0x53')]({},_0x2e022b,_0x4e548b['options']);return db[_0x6961('0x59')]['find'](_0x2e022b)[_0x6961('0x1c')](handleEntityNotFound(_0x297e93,null))[_0x6961('0x1c')](respondWithResult(_0x297e93,null))['catch'](handleError(_0x297e93,null));};exports['create']=function(_0x30f9a8,_0x1c0b90){return db[_0x6961('0x59')][_0x6961('0x5b')](_0x30f9a8[_0x6961('0x5c')],{})[_0x6961('0x1c')](function(_0x405a95){var _0x40d215=_0x30f9a8[_0x6961('0x5d')][_0x6961('0x37')]({'plain':!![]});if(!_0x40d215)throw new Error(_0x6961('0x5e'));if(_0x40d215[_0x6961('0x5f')]===_0x6961('0x5d')){var _0x4718e4=_0x405a95['get']({'plain':!![]});var _0x121c00=_0x6961('0x38');return db['UserProfileSection'][_0x6961('0x60')]({'where':{'name':_0x121c00,'userProfileId':_0x40d215['userProfileId']},'raw':!![]})[_0x6961('0x1c')](function(_0xb33fc3){if(_0xb33fc3&&_0xb33fc3[_0x6961('0x61')]===0x0){return db['UserProfileResource'][_0x6961('0x5b')]({'name':_0x4718e4[_0x6961('0x3b')],'resourceId':_0x4718e4['id'],'type':_0xb33fc3[_0x6961('0x3b')],'sectionId':_0xb33fc3['id']},{})[_0x6961('0x1c')](function(){return _0x405a95;});}else{return _0x405a95;}})['catch'](function(_0x36c5da){logger[_0x6961('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36c5da);throw _0x36c5da;});}return _0x405a95;})[_0x6961('0x1c')](respondWithResult(_0x1c0b90,0xc9))[_0x6961('0x27')](handleError(_0x1c0b90,null));};exports[_0x6961('0x35')]=function(_0x1d37d4,_0x4c67d6){if(_0x1d37d4['body']['id']){delete _0x1d37d4[_0x6961('0x5c')]['id'];}return db[_0x6961('0x59')][_0x6961('0x60')]({'where':{'id':_0x1d37d4[_0x6961('0x58')]['id']},'include':[{'model':db[_0x6961('0x62')],'as':_0x6961('0x3e')}]})['then'](handleEntityNotFound(_0x4c67d6,null))['then'](saveUpdates(_0x1d37d4[_0x6961('0x5c')],null))['then'](respondWithResult(_0x4c67d6,null))[_0x6961('0x27')](handleError(_0x4c67d6,null));};exports[_0x6961('0x36')]=function(_0x38fcaa,_0x3a64dd){return db[_0x6961('0x59')][_0x6961('0x60')]({'where':{'id':_0x38fcaa['params']['id']}})[_0x6961('0x1c')](handleEntityNotFound(_0x3a64dd,null))[_0x6961('0x1c')](removeEntity(_0x3a64dd,null))[_0x6961('0x27')](handleError(_0x3a64dd,null));};exports[_0x6961('0x63')]=function(_0x56adc4,_0x28d160){return db[_0x6961('0x59')][_0x6961('0x63')]()[_0x6961('0x1c')](respondWithResult(_0x28d160,null))[_0x6961('0x27')](handleError(_0x28d160,null));};exports[_0x6961('0x64')]=function(_0x13cf36,_0x47e90a,_0x2bf102){if(_0x13cf36[_0x6961('0x5c')]['id']){delete _0x13cf36[_0x6961('0x5c')]['id'];}return db[_0x6961('0x59')][_0x6961('0x60')]({'where':{'id':_0x13cf36[_0x6961('0x58')]['id']}})[_0x6961('0x1c')](handleEntityNotFound(_0x47e90a,null))[_0x6961('0x1c')](function(_0x3c440d){if(_0x3c440d){_0x13cf36[_0x6961('0x5c')][_0x6961('0x65')]=_0x3c440d['id'];return db[_0x6961('0x66')]['create'](_0x13cf36[_0x6961('0x5c')]);}})[_0x6961('0x1c')](respondWithResult(_0x47e90a,null))[_0x6961('0x27')](handleError(_0x47e90a,null));};exports[_0x6961('0x67')]=function(_0x5aadfa,_0x27006f,_0x2dc217){var _0x467bd0={'raw':![],'where':{}};var _0x330bb3={};var _0x169a52={'count':0x0,'rows':[]};return db[_0x6961('0x59')][_0x6961('0x68')]({'where':{'id':_0x5aadfa[_0x6961('0x58')]['id']}})[_0x6961('0x1c')](handleEntityNotFound(_0x27006f,null))[_0x6961('0x1c')](function(_0x53d616){if(_0x53d616){_0x330bb3[_0x6961('0x43')]=_[_0x6961('0x5a')](db[_0x6961('0x66')][_0x6961('0x40')]);_0x330bb3['query']=_[_0x6961('0x5a')](_0x5aadfa[_0x6961('0x44')]);_0x330bb3[_0x6961('0x45')]=_[_0x6961('0x46')](_0x330bb3[_0x6961('0x43')],_0x330bb3['query']);_0x467bd0[_0x6961('0x47')]=_[_0x6961('0x46')](_0x330bb3[_0x6961('0x43')],qs[_0x6961('0x48')](_0x5aadfa[_0x6961('0x44')][_0x6961('0x48')]));_0x467bd0['attributes']=_0x467bd0[_0x6961('0x47')][_0x6961('0x49')]?_0x467bd0[_0x6961('0x47')]:_0x330bb3['model'];if(!_0x5aadfa[_0x6961('0x44')][_0x6961('0x4a')](_0x6961('0x4b'))){_0x467bd0[_0x6961('0x2d')]=qs[_0x6961('0x2d')](_0x5aadfa['query'][_0x6961('0x2d')]);_0x467bd0[_0x6961('0x2c')]=qs['offset'](_0x5aadfa['query'][_0x6961('0x2c')]);}_0x467bd0[_0x6961('0x4c')]=qs[_0x6961('0x4d')](_0x5aadfa[_0x6961('0x44')]['sort']);_0x467bd0[_0x6961('0x4e')]=qs['filters'](_['pick'](_0x5aadfa['query'],_0x330bb3['filters']));_0x467bd0[_0x6961('0x4e')][_0x6961('0x65')]=_0x53d616['id'];if(_0x5aadfa['query']['filter']){_0x467bd0[_0x6961('0x4e')]=_[_0x6961('0x53')](_0x467bd0[_0x6961('0x4e')],{'$or':_[_0x6961('0x3f')](_0x467bd0[_0x6961('0x47')],function(_0x42637f){var _0x475ed3={};_0x475ed3[_0x42637f]={'$like':'%'+_0x5aadfa[_0x6961('0x44')][_0x6961('0x50')]+'%'};return _0x475ed3;})});}_0x467bd0=_[_0x6961('0x53')]({},_0x467bd0,_0x5aadfa[_0x6961('0x54')]);return db['Disposition'][_0x6961('0x2f')]({'where':_0x467bd0['where']})['then'](function(_0x322493){_0x169a52[_0x6961('0x2f')]=_0x322493;if(_0x5aadfa[_0x6961('0x44')][_0x6961('0x55')]){_0x467bd0[_0x6961('0x56')]=[{'all':!![]}];}return db['Disposition'][_0x6961('0x69')](_0x467bd0);})[_0x6961('0x1c')](function(_0x47f508){_0x169a52['rows']=_0x47f508;return _0x169a52;});}})[_0x6961('0x1c')](respondWithFilteredResult(_0x27006f,_0x467bd0))[_0x6961('0x27')](handleError(_0x27006f,null));};exports[_0x6961('0x6a')]=function(_0x11a6a6,_0x2ddecf,_0x24b4ea){return db[_0x6961('0x59')][_0x6961('0x60')]({'where':{'id':_0x11a6a6[_0x6961('0x58')]['id']}})[_0x6961('0x1c')](handleEntityNotFound(_0x2ddecf,null))[_0x6961('0x1c')](function(_0x2f2b02){if(_0x2f2b02){return _0x2f2b02['removeDispositions'](_0x11a6a6[_0x6961('0x44')][_0x6961('0x6b')]);}})['then'](respondWithStatusCode(_0x2ddecf,null))['catch'](handleError(_0x2ddecf,null));};exports[_0x6961('0x6c')]=function(_0x27b5b1,_0x4876c4,_0x501dd1){if(_0x27b5b1[_0x6961('0x5c')]['id']){delete _0x27b5b1[_0x6961('0x5c')]['id'];}return db[_0x6961('0x59')][_0x6961('0x60')]({'where':{'id':_0x27b5b1[_0x6961('0x58')]['id']}})['then'](handleEntityNotFound(_0x4876c4,null))[_0x6961('0x1c')](function(_0xce2bfa){if(_0xce2bfa){_0x27b5b1[_0x6961('0x5c')][_0x6961('0x65')]=_0xce2bfa['id'];return db[_0x6961('0x6d')]['create'](_0x27b5b1[_0x6961('0x5c')]);}})[_0x6961('0x1c')](respondWithResult(_0x4876c4,null))[_0x6961('0x27')](handleError(_0x4876c4,null));};exports[_0x6961('0x6e')]=function(_0x3d2d94,_0x1cc2cf,_0x5185d0){var _0x32394f={'raw':![],'where':{}};var _0xa1c531={};var _0x38f441={'count':0x0,'rows':[]};return db[_0x6961('0x59')][_0x6961('0x68')]({'where':{'id':_0x3d2d94[_0x6961('0x58')]['id']}})[_0x6961('0x1c')](handleEntityNotFound(_0x1cc2cf,null))[_0x6961('0x1c')](function(_0x195ebf){if(_0x195ebf){_0xa1c531[_0x6961('0x43')]=_[_0x6961('0x5a')](db[_0x6961('0x6d')][_0x6961('0x40')]);_0xa1c531[_0x6961('0x44')]=_[_0x6961('0x5a')](_0x3d2d94[_0x6961('0x44')]);_0xa1c531[_0x6961('0x45')]=_['intersection'](_0xa1c531['model'],_0xa1c531['query']);_0x32394f[_0x6961('0x47')]=_[_0x6961('0x46')](_0xa1c531[_0x6961('0x43')],qs['fields'](_0x3d2d94[_0x6961('0x44')][_0x6961('0x48')]));_0x32394f[_0x6961('0x47')]=_0x32394f['attributes'][_0x6961('0x49')]?_0x32394f['attributes']:_0xa1c531[_0x6961('0x43')];if(!_0x3d2d94[_0x6961('0x44')][_0x6961('0x4a')]('nolimit')){_0x32394f[_0x6961('0x2d')]=qs['limit'](_0x3d2d94[_0x6961('0x44')]['limit']);_0x32394f['offset']=qs[_0x6961('0x2c')](_0x3d2d94[_0x6961('0x44')][_0x6961('0x2c')]);}_0x32394f['order']=qs[_0x6961('0x4d')](_0x3d2d94['query'][_0x6961('0x4d')]);_0x32394f[_0x6961('0x4e')]=qs['filters'](_[_0x6961('0x4f')](_0x3d2d94['query'],_0xa1c531[_0x6961('0x45')]));_0x32394f[_0x6961('0x4e')][_0x6961('0x65')]=_0x195ebf['id'];if(_0x3d2d94[_0x6961('0x44')][_0x6961('0x50')]){_0x32394f[_0x6961('0x4e')]=_['merge'](_0x32394f['where'],{'$or':_[_0x6961('0x3f')](_0x32394f[_0x6961('0x47')],function(_0x4d9098){var _0x5c8b85={};_0x5c8b85[_0x4d9098]={'$like':'%'+_0x3d2d94[_0x6961('0x44')][_0x6961('0x50')]+'%'};return _0x5c8b85;})});}_0x32394f=_['merge']({},_0x32394f,_0x3d2d94[_0x6961('0x54')]);return db[_0x6961('0x6d')][_0x6961('0x2f')]({'where':_0x32394f[_0x6961('0x4e')]})['then'](function(_0x4347b4){_0x38f441[_0x6961('0x2f')]=_0x4347b4;if(_0x3d2d94[_0x6961('0x44')][_0x6961('0x55')]){_0x32394f['include']=[{'all':!![]}];}return db[_0x6961('0x6d')]['findAll'](_0x32394f);})[_0x6961('0x1c')](function(_0xac0406){_0x38f441[_0x6961('0x6f')]=_0xac0406;return _0x38f441;});}})['then'](respondWithFilteredResult(_0x1cc2cf,_0x32394f))['catch'](handleError(_0x1cc2cf,null));};exports[_0x6961('0x70')]=function(_0x294041,_0x48e6f0,_0x3f2b07){return db[_0x6961('0x59')][_0x6961('0x60')]({'where':{'id':_0x294041['params']['id']}})[_0x6961('0x1c')](handleEntityNotFound(_0x48e6f0,null))[_0x6961('0x1c')](function(_0x31d3bd){if(_0x31d3bd){return _0x31d3bd['removeAnswers'](_0x294041[_0x6961('0x44')][_0x6961('0x6b')]);}})[_0x6961('0x1c')](respondWithStatusCode(_0x48e6f0,null))[_0x6961('0x27')](handleError(_0x48e6f0,null));};exports['addAgents']=function(_0x7ae740,_0x3c83fa,_0xd983fb){return db[_0x6961('0x59')]['find']({'where':{'id':_0x7ae740[_0x6961('0x58')]['id']}})[_0x6961('0x1c')](handleEntityNotFound(_0x3c83fa,null))[_0x6961('0x1c')](function(_0xbb7e9a){if(_0xbb7e9a){return _0xbb7e9a['addAgents'](_0x7ae740[_0x6961('0x5c')][_0x6961('0x6b')],_[_0x6961('0x71')](_0x7ae740['body'],[_0x6961('0x6b'),'id'])||{})['spread'](function(_0x2bbe23){for(var _0x8b1fd9=0x0;_0x8b1fd9<_0x7ae740[_0x6961('0x5c')][_0x6961('0x6b')][_0x6961('0x49')];_0x8b1fd9+=0x1){socket[_0x6961('0x72')](_0x6961('0x73'),{'UserId':Number(_0x7ae740[_0x6961('0x5c')][_0x6961('0x6b')][_0x8b1fd9]),'WhatsappAccountId':Number(_0x7ae740[_0x6961('0x58')]['id'])});}return _0x2bbe23;});}})[_0x6961('0x1c')](respondWithResult(_0x3c83fa,null))[_0x6961('0x27')](handleError(_0x3c83fa,null));};exports[_0x6961('0x74')]=function(_0xa84ad5,_0x4a276e,_0x5ca111){return db[_0x6961('0x59')][_0x6961('0x60')]({'where':{'id':_0xa84ad5[_0x6961('0x58')]['id']}})[_0x6961('0x1c')](handleEntityNotFound(_0x4a276e,null))['then'](function(_0x3eaa62){if(_0x3eaa62){return _0x3eaa62['removeAgents'](_0xa84ad5['query'][_0x6961('0x6b')])[_0x6961('0x1c')](function(){if(_[_0x6961('0x75')](_0xa84ad5['query']['ids'])){for(var _0x24bd60=0x0;_0x24bd60<_0xa84ad5['query'][_0x6961('0x6b')][_0x6961('0x49')];_0x24bd60+=0x1){socket['emit'](_0x6961('0x76'),{'UserId':Number(_0xa84ad5[_0x6961('0x44')][_0x6961('0x6b')][_0x24bd60]),'WhatsappAccountId':Number(_0xa84ad5[_0x6961('0x58')]['id'])});}}else{socket[_0x6961('0x72')]('userWhatsappAccount:remove',{'UserId':Number(_0xa84ad5[_0x6961('0x44')]['ids']),'WhatsappAccountId':Number(_0xa84ad5['params']['id'])});}});}})[_0x6961('0x1c')](respondWithStatusCode(_0x4a276e,null))[_0x6961('0x27')](handleError(_0x4a276e,null));};exports[_0x6961('0x77')]=function(_0x56c335,_0x1cd08f,_0xa2763b){var _0x704083={};var _0x36cca0={};var _0x14d481;var _0x1214f3;return db[_0x6961('0x59')][_0x6961('0x68')]({'where':{'id':_0x56c335[_0x6961('0x58')]['id']}})[_0x6961('0x1c')](handleEntityNotFound(_0x1cd08f,null))[_0x6961('0x1c')](function(_0x1cf5d7){if(_0x1cf5d7){_0x14d481=_0x1cf5d7;_0x36cca0[_0x6961('0x43')]=_[_0x6961('0x5a')](db[_0x6961('0x78')][_0x6961('0x40')]);_0x36cca0[_0x6961('0x44')]=_['keys'](_0x56c335[_0x6961('0x44')]);_0x36cca0[_0x6961('0x45')]=_[_0x6961('0x46')](_0x36cca0['model'],_0x36cca0[_0x6961('0x44')]);_0x704083[_0x6961('0x47')]=_[_0x6961('0x46')](_0x36cca0['model'],qs['fields'](_0x56c335[_0x6961('0x44')][_0x6961('0x48')]));_0x704083[_0x6961('0x47')]=_0x704083[_0x6961('0x47')]['length']?_0x704083[_0x6961('0x47')]:_0x36cca0[_0x6961('0x43')];_0x704083[_0x6961('0x4c')]=qs[_0x6961('0x4d')](_0x56c335[_0x6961('0x44')][_0x6961('0x4d')]);_0x704083[_0x6961('0x4e')]=qs[_0x6961('0x45')](_[_0x6961('0x4f')](_0x56c335['query'],_0x36cca0[_0x6961('0x45')]));if(_0x56c335[_0x6961('0x44')][_0x6961('0x50')]){_0x704083[_0x6961('0x4e')]=_[_0x6961('0x53')](_0x704083[_0x6961('0x4e')],{'$or':_[_0x6961('0x3f')](_0x704083[_0x6961('0x47')],function(_0x72b13b){var _0x467b9a={};_0x467b9a[_0x72b13b]={'$like':'%'+_0x56c335[_0x6961('0x44')][_0x6961('0x50')]+'%'};return _0x467b9a;})});}_0x704083=_['merge']({},_0x704083,_0x56c335['options']);return _0x14d481[_0x6961('0x77')](_0x704083);}})[_0x6961('0x1c')](function(_0x4e006e){if(_0x4e006e){_0x1214f3=_0x4e006e['length'];if(!_0x56c335['query'][_0x6961('0x4a')](_0x6961('0x4b'))){_0x704083[_0x6961('0x2d')]=qs[_0x6961('0x2d')](_0x56c335[_0x6961('0x44')][_0x6961('0x2d')]);_0x704083['offset']=qs[_0x6961('0x2c')](_0x56c335[_0x6961('0x44')][_0x6961('0x2c')]);}return _0x14d481[_0x6961('0x77')](_0x704083);}})[_0x6961('0x1c')](function(_0x17df71){if(_0x17df71){return _0x17df71?{'count':_0x1214f3,'rows':_0x17df71}:null;}})[_0x6961('0x1c')](respondWithResult(_0x1cd08f,null))[_0x6961('0x27')](handleError(_0x1cd08f,null));};exports['addApplications']=function(_0x435b4c,_0x7409ea){var _0x35f012=_0x435b4c[_0x6961('0x58')]['id'];var _0x386fec=_0x435b4c['body'];var _0x179af9=0xc8;var _0x42f4da=null;return db[_0x6961('0x79')][_0x6961('0x7a')]({'isolationLevel':db[_0x6961('0x79')][_0x6961('0x7b')][_0x6961('0x7c')][_0x6961('0x7d')]},function(_0x203334){return db[_0x6961('0x59')][_0x6961('0x68')]({'where':{'id':_0x35f012},'transaction':_0x203334})[_0x6961('0x1c')](function(_0xd594b7){if(_0xd594b7){return db[_0x6961('0x7e')][_0x6961('0x36')]({'where':{'WhatsappAccountId':_0x35f012},'transaction':_0x203334})[_0x6961('0x1c')](function(){var _0x323688=_[_0x6961('0x3f')](_0x386fec,function(_0x41d249){_0x41d249[_0x6961('0x65')]=_0x35f012;return _0x41d249;});return db[_0x6961('0x7e')][_0x6961('0x7f')](_0x323688,{'transaction':_0x203334});});}else{_0x179af9=0x194;_0x42f4da=[];}});})['then'](function(){if(_0x179af9!==0x194){return db[_0x6961('0x7e')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x35f012},'order':'priority'})[_0x6961('0x1c')](function(_0x3e1407){_0x42f4da=_0x3e1407;});}})[_0x6961('0x27')](function(_0x1052c4){_0x179af9=0x1f4;logger['error'](_0x1052c4['stack']);if(_0x1052c4[_0x6961('0x3b')]){delete _0x1052c4[_0x6961('0x3b')];}_0x42f4da=_0x1052c4;})[_0x6961('0x80')](function(){if(_0x42f4da===null){_0x7409ea[_0x6961('0x28')](_0x179af9);}else{if(_0x179af9===0x1f4){_0x7409ea['status'](_0x179af9)['send'](_0x42f4da);}else{_0x7409ea[_0x6961('0x29')](_0x179af9)[_0x6961('0x2b')](_0x42f4da);}}});};exports[_0x6961('0x81')]=function(_0x3af45b,_0x2edeed,_0x5c571d){var _0x3cf247={};var _0x4c5eec={};var _0x37536c;var _0x4bb695;return db['WhatsappAccount'][_0x6961('0x68')]({'where':{'id':_0x3af45b['params']['id']}})[_0x6961('0x1c')](handleEntityNotFound(_0x2edeed,null))[_0x6961('0x1c')](function(_0x511087){if(_0x511087){_0x37536c=_0x511087;_0x4c5eec[_0x6961('0x43')]=_['keys'](db[_0x6961('0x7e')]['rawAttributes']);_0x4c5eec[_0x6961('0x44')]=_['keys'](_0x3af45b[_0x6961('0x44')]);_0x4c5eec[_0x6961('0x45')]=_['intersection'](_0x4c5eec[_0x6961('0x43')],_0x4c5eec['query']);_0x3cf247[_0x6961('0x47')]=_[_0x6961('0x46')](_0x4c5eec[_0x6961('0x43')],qs['fields'](_0x3af45b[_0x6961('0x44')][_0x6961('0x48')]));_0x3cf247[_0x6961('0x47')]=_0x3cf247[_0x6961('0x47')]['length']?_0x3cf247['attributes']:_0x4c5eec[_0x6961('0x43')];_0x3cf247[_0x6961('0x4c')]=qs['sort'](_0x3af45b[_0x6961('0x44')][_0x6961('0x4d')]);_0x3cf247[_0x6961('0x4e')]=qs['filters'](_[_0x6961('0x4f')](_0x3af45b['query'],_0x4c5eec[_0x6961('0x45')]));if(_0x3af45b[_0x6961('0x44')][_0x6961('0x50')]){_0x3cf247[_0x6961('0x4e')]=_[_0x6961('0x53')](_0x3cf247[_0x6961('0x4e')],{'$or':_[_0x6961('0x3f')](_0x3cf247[_0x6961('0x47')],function(_0x3dd71b){var _0x43ce50={};_0x43ce50[_0x3dd71b]={'$like':'%'+_0x3af45b['query']['filter']+'%'};return _0x43ce50;})});}_0x3cf247=_[_0x6961('0x53')]({},_0x3cf247,_0x3af45b[_0x6961('0x54')]);return _0x37536c[_0x6961('0x81')](_0x3cf247);}})[_0x6961('0x1c')](function(_0x18ccc7){if(_0x18ccc7){_0x4bb695=_0x18ccc7[_0x6961('0x49')];if(!_0x3af45b[_0x6961('0x44')][_0x6961('0x4a')]('nolimit')){_0x3cf247[_0x6961('0x2d')]=qs[_0x6961('0x2d')](_0x3af45b[_0x6961('0x44')][_0x6961('0x2d')]);_0x3cf247['offset']=qs[_0x6961('0x2c')](_0x3af45b['query'][_0x6961('0x2c')]);}return _0x37536c[_0x6961('0x81')](_0x3cf247);}})[_0x6961('0x1c')](function(_0xb205f6){if(_0xb205f6){return _0xb205f6?{'count':_0x4bb695,'rows':_0xb205f6}:null;}})['then'](respondWithResult(_0x2edeed,null))[_0x6961('0x27')](handleError(_0x2edeed,null));};exports['notify']=function(_0x5a2985,_0x52a3f0,_0x25f85c){var _0x399d90={'channel':_0x6961('0x82')};var _0x373be7=[];var _0x4ab7e7=[];var _0x3f0533={};return db[_0x6961('0x59')][_0x6961('0x60')]({'where':{'id':_0x5a2985[_0x6961('0x58')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x6961('0x83')}]})['then'](handleEntityNotFound(_0x52a3f0,null))[_0x6961('0x1c')](function(_0x42c4dc){_0x399d90[_0x6961('0x84')]=_0x42c4dc;if(_0x399d90['account']&&_0x399d90['account']['type']===_0x6961('0x85')&&_0x5a2985[_0x6961('0x5c')][_0x6961('0x86')]){if(_0x5a2985['body'][_0x6961('0x86')][_0x6961('0x49')]===0x0)return;if(_0x5a2985[_0x6961('0x5c')][_0x6961('0x86')][0x0][_0x6961('0x87')]!==_0x6961('0x88'))return;return db['WhatsappMessage'][_0x6961('0x35')]({'read':!![],'readAt':_0x5a2985['body'][_0x6961('0x86')][0x0]['timestamp']},{'where':{'messageId':_0x5a2985[_0x6961('0x5c')][_0x6961('0x86')][0x0][_0x6961('0x89')]},'individualHooks':!![]})['then'](function(_0x532a42){return _0x52a3f0['status'](0xc8)[_0x6961('0x2b')](_0x532a42);});}_0x399d90[_0x6961('0x8a')]=_[_0x6961('0x8b')](_0x42c4dc['Applications'],[_0x6961('0x8c')],[_0x6961('0x8d')]);if(_0x399d90[_0x6961('0x84')][_0x6961('0x83')]){delete _0x399d90[_0x6961('0x84')][_0x6961('0x83')];}return db[_0x6961('0x8e')][_0x6961('0x63')]()[_0x6961('0x1c')](function(_0x576a9c){if(!_0x576a9c){throw new db[(_0x6961('0x8f'))][(_0x6961('0x90'))]('no\x20available\x20attributes');}_0x373be7=_[_0x6961('0x91')](_[_0x6961('0x5a')](_0x576a9c),[_0x6961('0x92'),_0x6961('0x93')]);_0x4ab7e7=_[_0x6961('0x91')](_['keys'](_0x576a9c),['createdAt',_0x6961('0x93'),_0x6961('0x94'),_0x6961('0x95')]);_0x399d90[_0x6961('0x5c')]={'mapKey':_0x6961('0x96')};if(_0x399d90[_0x6961('0x84')]&&_0x399d90[_0x6961('0x84')][_0x6961('0x51')]===_0x6961('0x97')){_0x399d90['body']['from']=_0x5a2985['body'][_0x6961('0x98')][_0x6961('0x99')]('whatsapp:','');_0x399d90[_0x6961('0x5c')][_0x6961('0x5c')]=_0x5a2985[_0x6961('0x5c')]['Body'];_0x399d90[_0x6961('0x5c')]['messageId']=_0x5a2985[_0x6961('0x5c')][_0x6961('0x9a')];}if(_0x399d90[_0x6961('0x84')]&&_0x399d90[_0x6961('0x84')][_0x6961('0x51')]==='sinch'){_0x399d90['body']['from']=_0x5a2985[_0x6961('0x5c')][_0x6961('0x9b')][0x0][_0x6961('0x9c')];_0x399d90['body'][_0x6961('0x5c')]=_0x5a2985[_0x6961('0x5c')][_0x6961('0x9b')][0x0][_0x6961('0x25')][_0x6961('0x5c')];_0x399d90[_0x6961('0x5c')][_0x6961('0x9d')]=_0x5a2985[_0x6961('0x5c')][_0x6961('0x9b')][0x0][_0x6961('0x89')];}if(_0x399d90[_0x6961('0x5c')]['id']){delete _0x399d90['body']['id'];}if(_[_0x6961('0x9e')](_0x399d90['body'][_0x6961('0x9c')])){throw new db['Sequelize'][(_0x6961('0x90'))]('from\x20is\x20mandatory');}if(_[_0x6961('0x9e')](_0x399d90[_0x6961('0x5c')]['body'])||_0x399d90['body'][_0x6961('0x5c')]===''){throw new db[(_0x6961('0x8f'))][(_0x6961('0x90'))](_0x6961('0x9f'));}if(_['isNil'](_0x399d90[_0x6961('0x5c')][_0x6961('0xa0')])){throw new db['Sequelize'][(_0x6961('0x90'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4ab7e7);}if(!_[_0x6961('0xa1')](_0x4ab7e7,_0x399d90[_0x6961('0x5c')]['mapKey'])){throw new db['Sequelize'][(_0x6961('0x90'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4ab7e7);}_0x3f0533[_0x399d90[_0x6961('0x5c')][_0x6961('0xa0')]]=_0x399d90['body'][_0x6961('0x9c')];return db[_0x6961('0xa2')][_0x6961('0x60')]({'where':{'id':_0x399d90[_0x6961('0x84')][_0x6961('0x95')]},'include':[{'model':db[_0x6961('0x8e')],'as':_0x6961('0xa3'),'where':_0x3f0533,'limit':0x1,'order':[[_0x6961('0x93'),_0x6961('0xa4')]]}]});})[_0x6961('0x1c')](handleEntityNotFound(_0x52a3f0,null))['then'](function(_0x3c3742){if(_0x3c3742){_0x399d90[_0x6961('0xa5')]=_[_0x6961('0x71')](_0x3c3742,['Contacts']);if(_0x3c3742[_0x6961('0xa3')][_0x6961('0x49')]){return _0x3c3742[_0x6961('0xa3')][0x0];}var _0x10c57c=_[_0x6961('0x16')](_0x399d90['body'],{'firstName':_0x399d90[_0x6961('0x5c')][_0x6961('0x9c')],'ListId':_0x3c3742['id']});_0x10c57c[_0x399d90[_0x6961('0x5c')][_0x6961('0xa0')]]=_0x399d90[_0x6961('0x5c')][_0x6961('0x9c')];return db[_0x6961('0x8e')]['create'](_0x10c57c,{'fields':_0x373be7,'raw':!![]});}})[_0x6961('0x1c')](handleEntityNotFound(_0x52a3f0,null))[_0x6961('0x1c')](function(_0x18eef9){if(_0x18eef9){_0x399d90[_0x6961('0xa6')]=_0x18eef9;var _0x4b546b={'ContactId':_0x18eef9['id'],'phone':_0x399d90[_0x6961('0x5c')][_0x6961('0x9c')],'WhatsappAccountId':_0x5a2985[_0x6961('0x58')]['id']};var _0x5d6069={'ContactId':_0x18eef9['id'],'WhatsappAccountId':_0x5a2985[_0x6961('0x58')]['id'],'closed':![]};return db[_0x6961('0xa7')]['find']({'where':_0x5d6069})[_0x6961('0x1c')](function(_0x1db970){if(_0x1db970){return[_0x1db970,![]];}return db['WhatsappInteraction'][_0x6961('0x5b')](_0x4b546b)[_0x6961('0x1c')](function(_0x222fbf){return[_0x222fbf,!![]];});});}})[_0x6961('0xa8')](function(_0x4121b3,_0x4cc2fd){_0x399d90[_0x6961('0xa9')]=_0x4121b3[_0x6961('0x37')]({'plain':!![]});_0x399d90[_0x6961('0xa9')]['created']=![];if(_0x4cc2fd){if(_0x399d90[_0x6961('0x84')][_0x6961('0xaa')]){_0x399d90['applications'][_0x6961('0xab')]({'id':0x0,'priority':_0x399d90[_0x6961('0x8a')][_0x6961('0x49')]+0x1,'app':_0x6961('0xac'),'appdata':'unmanaged','interval':_0x6961('0xad')});}_0x399d90['interaction'][_0x6961('0xae')]=!![];}return db[_0x6961('0xaf')][_0x6961('0x5b')]({'phone':_0x399d90['body'][_0x6961('0x9c')],'messageId':_0x399d90[_0x6961('0x5c')][_0x6961('0x9d')],'body':_0x399d90[_0x6961('0x5c')]['body'],'WhatsappAccountId':_0x5a2985[_0x6961('0x58')]['id'],'WhatsappInteractionId':_0x4121b3['id'],'direction':'in','ContactId':_0x4121b3[_0x6961('0xb0')],'AttachmentId':_0x399d90[_0x6961('0x5c')]['AttachmentId']});})['then'](function(_0x57f729){_0x399d90[_0x6961('0x25')]=_0x57f729;if(!_0x399d90[_0x6961('0xa9')]['UserId'])return;return db[_0x6961('0x78')]['find']({'attributes':['id',_0x6961('0x3b')],'where':{'id':_0x399d90[_0x6961('0xa9')][_0x6961('0xb1')]}});})[_0x6961('0x1c')](function(_0x2eddd7){if(_0x2eddd7){_0x399d90[_0x6961('0x8a')][_0x6961('0xb2')]({'id':0x0,'priority':0x0,'app':_0x6961('0xb3'),'appdata':_0x2eddd7[_0x6961('0x3b')]+','+(_0x399d90[_0x6961('0x84')][_0x6961('0xb4')]||0xa),'interval':_0x6961('0xad')});}if(!_0x399d90[_0x6961('0xa9')][_0x6961('0xb5')])return;return db[_0x6961('0xb6')][_0x6961('0x60')]({'attributes':['id',_0x6961('0x3b')],'where':{'id':_0x399d90[_0x6961('0xa9')][_0x6961('0xb5')]}});})[_0x6961('0x1c')](function(_0x2bc68d){if(_0x2bc68d){_0x399d90['applications'][_0x6961('0xb2')]({'id':0x0,'priority':0x1,'app':_0x6961('0xb7'),'appdata':_0x2bc68d['name']+','+(_0x399d90[_0x6961('0x84')][_0x6961('0xb8')]||0x12c),'interval':_0x6961('0xad')});}return respondWithRpcPromise(_0x6961('0xb9'),_0x6961('0xba'),_0x399d90);})[_0x6961('0x1c')](function(_0x1c5591){if(_0x1c5591){var _0x4fd2ef=0xc8;var _0x27a633=_0x6961('0xbb');logger[_0x6961('0x1d')](_0x6961('0x21'),_0x27a633,_0x4fd2ef,_0x6961('0xbc'));logger['debug'](_0x6961('0xbd'),_0x27a633,_0x4fd2ef,_0x6961('0xbc'),JSON['stringify'](_0x1c5591));if(_0x399d90['account'][_0x6961('0x51')]===_0x6961('0x97')){return _0x52a3f0[_0x6961('0x29')](_0x4fd2ef)['set']('Content-Type','text/xml')['send'](_0x6961('0xbe'));}else{return _0x52a3f0[_0x6961('0x29')](_0x4fd2ef)['json'](_0x1c5591);}}});})[_0x6961('0x27')](handleError(_0x52a3f0,null));};exports[_0x6961('0x3c')]=function(_0x39d06a,_0x54f6e7,_0x1bcd57){var _0xacdfa6,_0x2681b1,_0x39ef2d;if(_[_0x6961('0x9e')](_0x39d06a[_0x6961('0x5c')][_0x6961('0x5c')])||_0x39d06a['body'][_0x6961('0x5c')]===''){throw new db[(_0x6961('0x8f'))][(_0x6961('0x90'))](_0x6961('0x9f'));}if(_['isNil'](_0x39d06a[_0x6961('0x5c')]['to'])){throw new db['Sequelize'][(_0x6961('0x90'))](_0x6961('0xbf'));}_0xacdfa6=_0x39d06a['body']['to'];return db['WhatsappAccount'][_0x6961('0x60')]({'where':{'id':_0x39d06a[_0x6961('0x58')]['id']},'include':[{'model':db[_0x6961('0xa2')],'as':_0x6961('0xc0'),'include':[{'model':db[_0x6961('0x8e')],'as':_0x6961('0xa3'),'where':{'mobile':_0xacdfa6},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})['then'](handleEntityNotFound(_0x54f6e7,null))[_0x6961('0x1c')](function(_0x5c601f){if(_0x5c601f&&_0x5c601f[_0x6961('0xc0')]){_0x2681b1=_0x5c601f['get']({'plain':!![]});if(_0x2681b1[_0x6961('0xc0')]&&_0x2681b1[_0x6961('0xc0')][_0x6961('0xa3')][_0x6961('0x49')]){return _0x2681b1['List'][_0x6961('0xa3')][0x0];}return db['CmContact']['create'](_[_0x6961('0x16')](_0x39d06a[_0x6961('0x5c')],{'firstName':_0xacdfa6,'mobile':_0xacdfa6,'phone':_0xacdfa6,'ListId':_0x2681b1[_0x6961('0x95')]}));}})['then'](handleEntityNotFound(_0x54f6e7,null))[_0x6961('0x1c')](function(_0x4d5225){if(_0x4d5225){_0x39ef2d=_0x4d5225;return db[_0x6961('0xa7')][_0x6961('0x60')]({'where':{'ContactId':_0x39ef2d['id'],'closed':![],'WhatsappAccountId':_0x2681b1['id']}})[_0x6961('0x1c')](function(_0x3bbaa8){if(_0x3bbaa8){return[_0x3bbaa8,![]];}return db[_0x6961('0xa7')]['create']({'UserId':_0x39d06a['user']['id'],'ContactId':_0x39ef2d['id'],'WhatsappAccountId':_0x2681b1['id'],'phone':_0xacdfa6,'firstMsgDirection':_0x6961('0xc1'),'Messages':[_[_0x6961('0x53')](_0x39d06a[_0x6961('0x5c')],{'read':![],'body':_0x39d06a[_0x6961('0x5c')][_0x6961('0x5c')],'phone':_0xacdfa6,'WhatsappAccountId':_0x2681b1['id'],'UserId':_0x39d06a[_0x6961('0x5d')]['id'],'ContactId':_0x39ef2d['id']})]},{'include':[{'model':db[_0x6961('0xaf')],'as':_0x6961('0xc2')}]})[_0x6961('0x1c')](function(_0x30b91f){return[_0x30b91f,!![]];});});}})[_0x6961('0xa8')](function(_0x48602e,_0x3c5706){if(_0x3c5706){return _0x48602e;}return db[_0x6961('0xaf')]['create'](_['merge'](_0x39d06a[_0x6961('0x5c')],{'read':![],'body':_0x39d06a[_0x6961('0x5c')][_0x6961('0x5c')],'phone':_0xacdfa6,'WhatsappAccountId':_0x2681b1['id'],'WhatsappInteractionId':_0x48602e['id'],'UserId':_0x39d06a[_0x6961('0x5d')]['id'],'ContactId':_0x39ef2d['id']}))[_0x6961('0x1c')](function(_0x156a55){_0x48602e['dataValues'][_0x6961('0xc2')]=[];_0x48602e[_0x6961('0xc3')][_0x6961('0xc2')][_0x6961('0xab')](_0x156a55[_0x6961('0xc3')]);return _0x48602e;});})[_0x6961('0x1c')](respondWithResult(_0x54f6e7,null))[_0x6961('0x27')](handleError(_0x54f6e7,null));}; \ No newline at end of file +var _0x1aab=['getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','account','sinch','state','read','WhatsappMessage','statuses','message_id','orderBy','Applications','Sequelize','ValidationError','difference','createdAt','ListId','mobile','twilio','from','whatsapp:','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmContact','DESC','list','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','applications','push','close','*,*,*,*','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','WhatsappQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','CmList','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','undefined','limit','count','set','Content-Range','json','apply','update','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','filters','includeAll','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','WhatsappAccountId','Disposition'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x1aab,0x122));var _0xb1aa=function(_0x94bfac,_0x44adc5){_0x94bfac=_0x94bfac-0x0;var _0x1f2ad3=_0x1aab[_0x94bfac];return _0x1f2ad3;};'use strict';var emlformat=require(_0xb1aa('0x0'));var rimraf=require(_0xb1aa('0x1'));var zipdir=require(_0xb1aa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb1aa('0x3'));var moment=require('moment');var BPromise=require(_0xb1aa('0x4'));var Mustache=require(_0xb1aa('0x5'));var util=require(_0xb1aa('0x6'));var path=require(_0xb1aa('0x7'));var sox=require(_0xb1aa('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb1aa('0x9'));var _=require(_0xb1aa('0xa'));var squel=require(_0xb1aa('0xb'));var crypto=require(_0xb1aa('0xc'));var jsforce=require(_0xb1aa('0xd'));var deskjs=require(_0xb1aa('0xe'));var toCsv=require(_0xb1aa('0xf'));var querystring=require('querystring');var Papa=require(_0xb1aa('0x10'));var Redis=require(_0xb1aa('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb1aa('0x12'));var as=require(_0xb1aa('0x13'));var hardwareService=require(_0xb1aa('0x14'));var logger=require(_0xb1aa('0x15'))(_0xb1aa('0x16'));var utils=require(_0xb1aa('0x17'));var config=require(_0xb1aa('0x18'));var licenseUtil=require(_0xb1aa('0x19'));var db=require(_0xb1aa('0x1a'))['db'];config[_0xb1aa('0x1b')]=_[_0xb1aa('0x1c')](config[_0xb1aa('0x1b')],{'host':_0xb1aa('0x1d'),'port':0x18eb});var socket=require(_0xb1aa('0x1e'))(new Redis(config[_0xb1aa('0x1b')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0xb1aa('0x1f'));var client=jayson['client'][_0xb1aa('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x47bdde,_0x7a3b6a,_0x49bf6b,_0x24b12d){return new BPromise(function(_0x489fb6,_0x235b7b){var _0x408bf8=_0x24b12d||client;return _0x408bf8['request'](_0x47bdde,_0x49bf6b)[_0xb1aa('0x21')](function(_0x3624aa){logger[_0xb1aa('0x22')](_0xb1aa('0x23'),_0x7a3b6a,_0xb1aa('0x24'));logger[_0xb1aa('0x25')](_0xb1aa('0x26'),_0x7a3b6a,_0xb1aa('0x24'),JSON[_0xb1aa('0x27')](_0x3624aa));if(_0x3624aa[_0xb1aa('0x28')]){if(_0x3624aa[_0xb1aa('0x28')][_0xb1aa('0x29')]===0x1f4){logger[_0xb1aa('0x28')](_0xb1aa('0x23'),_0x7a3b6a,_0x3624aa['error'][_0xb1aa('0x2a')]);return _0x235b7b(_0x3624aa[_0xb1aa('0x28')][_0xb1aa('0x2a')]);}logger[_0xb1aa('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x7a3b6a,_0x3624aa[_0xb1aa('0x28')][_0xb1aa('0x2a')]);return _0x489fb6(_0x3624aa['error'][_0xb1aa('0x2a')]);}else{logger[_0xb1aa('0x22')](_0xb1aa('0x23'),_0x7a3b6a,'request\x20sent');_0x489fb6(_0x3624aa['result'][_0xb1aa('0x2a')]);}})[_0xb1aa('0x2b')](function(_0x6b36ff){logger[_0xb1aa('0x28')](_0xb1aa('0x23'),_0x7a3b6a,_0x6b36ff);_0x235b7b(_0x6b36ff);});});}function respondWithStatusCode(_0x2f1db9,_0x26ec21){_0x26ec21=_0x26ec21||0xcc;return function(_0x42fc91){if(_0x42fc91){return _0x2f1db9[_0xb1aa('0x2c')](_0x26ec21);}return _0x2f1db9[_0xb1aa('0x2d')](_0x26ec21)[_0xb1aa('0x2e')]();};}function respondWithResult(_0x3b7b95,_0x34b5e8){_0x34b5e8=_0x34b5e8||0xc8;return function(_0x4315e8){if(_0x4315e8){return _0x3b7b95[_0xb1aa('0x2d')](_0x34b5e8)['json'](_0x4315e8);}};}function respondWithFilteredResult(_0xd20062,_0x370669){return function(_0x3c1b92){if(_0x3c1b92){var _0x13f92d=typeof _0x370669['offset']===_0xb1aa('0x2f')&&typeof _0x370669[_0xb1aa('0x30')]==='undefined';var _0x469ff1=_0x3c1b92[_0xb1aa('0x31')];var _0x14d46f=_0x13f92d?0x0:_0x370669['offset'];var _0x25df88=_0x13f92d?_0x3c1b92[_0xb1aa('0x31')]:_0x370669['offset']+_0x370669['limit'];var _0x370f5b;if(_0x25df88>=_0x469ff1){_0x25df88=_0x469ff1;_0x370f5b=0xc8;}else{_0x370f5b=0xce;}_0xd20062[_0xb1aa('0x2d')](_0x370f5b);return _0xd20062[_0xb1aa('0x32')](_0xb1aa('0x33'),_0x14d46f+'-'+_0x25df88+'/'+_0x469ff1)[_0xb1aa('0x34')](_0x3c1b92);}return null;};}function patchUpdates(_0x1d0f05){return function(_0x51000f){try{jsonpatch[_0xb1aa('0x35')](_0x51000f,_0x1d0f05,!![]);}catch(_0x5b5302){return BPromise['reject'](_0x5b5302);}return _0x51000f['save']();};}function saveUpdates(_0x3326d5,_0x1f053a){return function(_0x27b95d){if(_0x27b95d){return _0x27b95d[_0xb1aa('0x36')](_0x3326d5)[_0xb1aa('0x21')](function(_0x4aab00){return _0x4aab00;});}return null;};}function removeEntity(_0x27a466,_0x1f900c){return function(_0x30079c){if(_0x30079c){return _0x30079c['destroy']()['then'](function(){var _0x59b88e=_0x30079c[_0xb1aa('0x37')]({'plain':!![]});var _0x240904=_0xb1aa('0x38');return db[_0xb1aa('0x39')]['destroy']({'where':{'type':_0x240904,'resourceId':_0x59b88e['id']}})[_0xb1aa('0x21')](function(){return _0x30079c;});})[_0xb1aa('0x21')](function(){_0x27a466[_0xb1aa('0x2d')](0xcc)[_0xb1aa('0x2e')]();});}};}function handleEntityNotFound(_0x5713c9,_0x18989e){return function(_0xf7502){if(!_0xf7502){_0x5713c9[_0xb1aa('0x2c')](0x194);}return _0xf7502;};}function handleError(_0x525df6,_0xf2ed78){_0xf2ed78=_0xf2ed78||0x1f4;return function(_0x29cfbf){logger[_0xb1aa('0x28')](_0x29cfbf[_0xb1aa('0x3a')]);if(_0x29cfbf[_0xb1aa('0x3b')]){delete _0x29cfbf[_0xb1aa('0x3b')];}_0x525df6[_0xb1aa('0x2d')](_0xf2ed78)[_0xb1aa('0x3c')](_0x29cfbf);};}exports[_0xb1aa('0x3d')]=function(_0x5069c6,_0x3bf833){var _0x4a6ce0={'include':[{'model':db[_0xb1aa('0x3e')],'as':_0xb1aa('0x3f')}]},_0xa79749={},_0x1fb721={'count':0x0,'rows':[]};var _0x572ae0=_[_0xb1aa('0x40')](db[_0xb1aa('0x41')][_0xb1aa('0x42')],function(_0x582bfb){return{'name':_0x582bfb[_0xb1aa('0x43')],'type':_0x582bfb[_0xb1aa('0x44')]['key']};});_0xa79749['model']=_['map'](_0x572ae0,_0xb1aa('0x3b'));_0xa79749[_0xb1aa('0x45')]=_[_0xb1aa('0x46')](_0x5069c6[_0xb1aa('0x45')]);_0xa79749['filters']=_[_0xb1aa('0x47')](_0xa79749[_0xb1aa('0x48')],_0xa79749[_0xb1aa('0x45')]);_0x4a6ce0[_0xb1aa('0x49')]=_[_0xb1aa('0x47')](_0xa79749['model'],qs[_0xb1aa('0x4a')](_0x5069c6[_0xb1aa('0x45')][_0xb1aa('0x4a')]));_0x4a6ce0[_0xb1aa('0x49')]=_0x4a6ce0[_0xb1aa('0x49')][_0xb1aa('0x4b')]?_0x4a6ce0[_0xb1aa('0x49')]:_0xa79749[_0xb1aa('0x48')];if(!_0x5069c6['query'][_0xb1aa('0x4c')](_0xb1aa('0x4d'))){_0x4a6ce0['limit']=qs[_0xb1aa('0x30')](_0x5069c6[_0xb1aa('0x45')][_0xb1aa('0x30')]);_0x4a6ce0[_0xb1aa('0x4e')]=qs['offset'](_0x5069c6['query'][_0xb1aa('0x4e')]);}_0x4a6ce0[_0xb1aa('0x4f')]=qs['sort'](_0x5069c6[_0xb1aa('0x45')][_0xb1aa('0x50')]);_0x4a6ce0[_0xb1aa('0x51')]=qs['filters'](_[_0xb1aa('0x52')](_0x5069c6[_0xb1aa('0x45')],_0xa79749['filters']),_0x572ae0);if(_0x5069c6['query'][_0xb1aa('0x53')]){_0x4a6ce0[_0xb1aa('0x51')]=_[_0xb1aa('0x54')](_0x4a6ce0['where'],{'$or':_[_0xb1aa('0x40')](_0x572ae0,function(_0x1d0b97){if(_0x1d0b97[_0xb1aa('0x44')]!==_0xb1aa('0x55')){var _0x12baec={};_0x12baec[_0x1d0b97['name']]={'$like':'%'+_0x5069c6[_0xb1aa('0x45')][_0xb1aa('0x53')]+'%'};return _0x12baec;}})});}_0x4a6ce0=_[_0xb1aa('0x54')]({},_0x4a6ce0,_0x5069c6[_0xb1aa('0x56')]);var _0x58438e={'where':_0x4a6ce0['where']};return db[_0xb1aa('0x41')][_0xb1aa('0x31')](_0x58438e)['then'](function(_0x29c63f){_0x1fb721[_0xb1aa('0x31')]=_0x29c63f;if(_0x5069c6[_0xb1aa('0x45')]['includeAll']){_0x4a6ce0[_0xb1aa('0x57')]=[{'all':!![]}];}return db[_0xb1aa('0x41')][_0xb1aa('0x58')](_0x4a6ce0);})[_0xb1aa('0x21')](function(_0x30377e){_0x1fb721[_0xb1aa('0x59')]=_0x30377e;return _0x1fb721;})[_0xb1aa('0x21')](respondWithFilteredResult(_0x3bf833,_0x4a6ce0))[_0xb1aa('0x2b')](handleError(_0x3bf833,null));};exports[_0xb1aa('0x5a')]=function(_0x5e62bf,_0x58e2ed){var _0x2a71cb={'raw':![],'where':{'id':_0x5e62bf[_0xb1aa('0x5b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3edbcc={};_0x3edbcc['model']=_['keys'](db['WhatsappAccount']['rawAttributes']);_0x3edbcc[_0xb1aa('0x45')]=_[_0xb1aa('0x46')](_0x5e62bf[_0xb1aa('0x45')]);_0x3edbcc[_0xb1aa('0x5c')]=_[_0xb1aa('0x47')](_0x3edbcc[_0xb1aa('0x48')],_0x3edbcc[_0xb1aa('0x45')]);_0x2a71cb[_0xb1aa('0x49')]=_[_0xb1aa('0x47')](_0x3edbcc[_0xb1aa('0x48')],qs[_0xb1aa('0x4a')](_0x5e62bf['query'][_0xb1aa('0x4a')]));_0x2a71cb['attributes']=_0x2a71cb[_0xb1aa('0x49')]['length']?_0x2a71cb[_0xb1aa('0x49')]:_0x3edbcc[_0xb1aa('0x48')];if(_0x5e62bf['query'][_0xb1aa('0x5d')]){_0x2a71cb['include']=[{'all':!![]}];}_0x2a71cb=_[_0xb1aa('0x54')]({},_0x2a71cb,_0x5e62bf['options']);return db[_0xb1aa('0x41')][_0xb1aa('0x5e')](_0x2a71cb)[_0xb1aa('0x21')](handleEntityNotFound(_0x58e2ed,null))['then'](respondWithResult(_0x58e2ed,null))[_0xb1aa('0x2b')](handleError(_0x58e2ed,null));};exports['create']=function(_0x5a54cb,_0x2b683b){return db[_0xb1aa('0x41')]['create'](_0x5a54cb[_0xb1aa('0x5f')],{})[_0xb1aa('0x21')](function(_0x304478){var _0x5270be=_0x5a54cb[_0xb1aa('0x60')][_0xb1aa('0x37')]({'plain':!![]});if(!_0x5270be)throw new Error(_0xb1aa('0x61'));if(_0x5270be[_0xb1aa('0x62')]==='user'){var _0x4e7c05=_0x304478[_0xb1aa('0x37')]({'plain':!![]});var _0x3b063f=_0xb1aa('0x38');return db[_0xb1aa('0x63')]['find']({'where':{'name':_0x3b063f,'userProfileId':_0x5270be['userProfileId']},'raw':!![]})[_0xb1aa('0x21')](function(_0x300354){if(_0x300354&&_0x300354[_0xb1aa('0x64')]===0x0){return db[_0xb1aa('0x39')][_0xb1aa('0x65')]({'name':_0x4e7c05['name'],'resourceId':_0x4e7c05['id'],'type':_0x300354['name'],'sectionId':_0x300354['id']},{})[_0xb1aa('0x21')](function(){return _0x304478;});}else{return _0x304478;}})[_0xb1aa('0x2b')](function(_0x2bec8d){logger['error'](_0xb1aa('0x66'),_0x2bec8d);throw _0x2bec8d;});}return _0x304478;})[_0xb1aa('0x21')](respondWithResult(_0x2b683b,0xc9))['catch'](handleError(_0x2b683b,null));};exports['update']=function(_0x91209c,_0x39fff7){if(_0x91209c[_0xb1aa('0x5f')]['id']){delete _0x91209c['body']['id'];}return db[_0xb1aa('0x41')][_0xb1aa('0x5e')]({'where':{'id':_0x91209c[_0xb1aa('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0xb1aa('0x3f')}]})[_0xb1aa('0x21')](handleEntityNotFound(_0x39fff7,null))[_0xb1aa('0x21')](saveUpdates(_0x91209c['body'],null))['then'](respondWithResult(_0x39fff7,null))[_0xb1aa('0x2b')](handleError(_0x39fff7,null));};exports[_0xb1aa('0x67')]=function(_0x199796,_0x4baaf5){return db[_0xb1aa('0x41')]['find']({'where':{'id':_0x199796[_0xb1aa('0x5b')]['id']}})[_0xb1aa('0x21')](handleEntityNotFound(_0x4baaf5,null))[_0xb1aa('0x21')](removeEntity(_0x4baaf5,null))[_0xb1aa('0x2b')](handleError(_0x4baaf5,null));};exports[_0xb1aa('0x68')]=function(_0x1b0681,_0x1512fb){return db[_0xb1aa('0x41')][_0xb1aa('0x68')]()[_0xb1aa('0x21')](respondWithResult(_0x1512fb,null))[_0xb1aa('0x2b')](handleError(_0x1512fb,null));};exports[_0xb1aa('0x69')]=function(_0x864987,_0x456dac,_0x1466be){if(_0x864987['body']['id']){delete _0x864987[_0xb1aa('0x5f')]['id'];}return db[_0xb1aa('0x41')][_0xb1aa('0x5e')]({'where':{'id':_0x864987['params']['id']}})[_0xb1aa('0x21')](handleEntityNotFound(_0x456dac,null))[_0xb1aa('0x21')](function(_0x37c016){if(_0x37c016){_0x864987[_0xb1aa('0x5f')][_0xb1aa('0x6a')]=_0x37c016['id'];return db[_0xb1aa('0x6b')]['create'](_0x864987[_0xb1aa('0x5f')]);}})['then'](respondWithResult(_0x456dac,null))[_0xb1aa('0x2b')](handleError(_0x456dac,null));};exports[_0xb1aa('0x6c')]=function(_0x297e7c,_0x2c4130,_0x32cee7){var _0x36a311={'raw':![],'where':{}};var _0x59f5ef={};var _0x49dc1b={'count':0x0,'rows':[]};return db[_0xb1aa('0x41')][_0xb1aa('0x6d')]({'where':{'id':_0x297e7c[_0xb1aa('0x5b')]['id']}})[_0xb1aa('0x21')](handleEntityNotFound(_0x2c4130,null))['then'](function(_0x5015bd){if(_0x5015bd){_0x59f5ef[_0xb1aa('0x48')]=_[_0xb1aa('0x46')](db['Disposition'][_0xb1aa('0x42')]);_0x59f5ef[_0xb1aa('0x45')]=_[_0xb1aa('0x46')](_0x297e7c['query']);_0x59f5ef['filters']=_['intersection'](_0x59f5ef[_0xb1aa('0x48')],_0x59f5ef[_0xb1aa('0x45')]);_0x36a311[_0xb1aa('0x49')]=_['intersection'](_0x59f5ef[_0xb1aa('0x48')],qs['fields'](_0x297e7c[_0xb1aa('0x45')]['fields']));_0x36a311[_0xb1aa('0x49')]=_0x36a311[_0xb1aa('0x49')]['length']?_0x36a311[_0xb1aa('0x49')]:_0x59f5ef[_0xb1aa('0x48')];if(!_0x297e7c[_0xb1aa('0x45')]['hasOwnProperty'](_0xb1aa('0x4d'))){_0x36a311[_0xb1aa('0x30')]=qs[_0xb1aa('0x30')](_0x297e7c['query'][_0xb1aa('0x30')]);_0x36a311[_0xb1aa('0x4e')]=qs['offset'](_0x297e7c[_0xb1aa('0x45')][_0xb1aa('0x4e')]);}_0x36a311[_0xb1aa('0x4f')]=qs[_0xb1aa('0x50')](_0x297e7c[_0xb1aa('0x45')][_0xb1aa('0x50')]);_0x36a311[_0xb1aa('0x51')]=qs[_0xb1aa('0x5c')](_['pick'](_0x297e7c[_0xb1aa('0x45')],_0x59f5ef[_0xb1aa('0x5c')]));_0x36a311[_0xb1aa('0x51')][_0xb1aa('0x6a')]=_0x5015bd['id'];if(_0x297e7c['query'][_0xb1aa('0x53')]){_0x36a311[_0xb1aa('0x51')]=_[_0xb1aa('0x54')](_0x36a311[_0xb1aa('0x51')],{'$or':_[_0xb1aa('0x40')](_0x36a311[_0xb1aa('0x49')],function(_0x5e02d6){var _0x43533c={};_0x43533c[_0x5e02d6]={'$like':'%'+_0x297e7c[_0xb1aa('0x45')][_0xb1aa('0x53')]+'%'};return _0x43533c;})});}_0x36a311=_['merge']({},_0x36a311,_0x297e7c[_0xb1aa('0x56')]);return db[_0xb1aa('0x6b')][_0xb1aa('0x31')]({'where':_0x36a311[_0xb1aa('0x51')]})[_0xb1aa('0x21')](function(_0x4d6371){_0x49dc1b['count']=_0x4d6371;if(_0x297e7c[_0xb1aa('0x45')][_0xb1aa('0x5d')]){_0x36a311[_0xb1aa('0x57')]=[{'all':!![]}];}return db[_0xb1aa('0x6b')][_0xb1aa('0x58')](_0x36a311);})[_0xb1aa('0x21')](function(_0x1e0b5b){_0x49dc1b[_0xb1aa('0x59')]=_0x1e0b5b;return _0x49dc1b;});}})[_0xb1aa('0x21')](respondWithFilteredResult(_0x2c4130,_0x36a311))['catch'](handleError(_0x2c4130,null));};exports[_0xb1aa('0x6e')]=function(_0x5afc76,_0x117699,_0xb49db3){return db[_0xb1aa('0x41')]['find']({'where':{'id':_0x5afc76[_0xb1aa('0x5b')]['id']}})[_0xb1aa('0x21')](handleEntityNotFound(_0x117699,null))['then'](function(_0x2850ef){if(_0x2850ef){return _0x2850ef['removeDispositions'](_0x5afc76[_0xb1aa('0x45')][_0xb1aa('0x6f')]);}})[_0xb1aa('0x21')](respondWithStatusCode(_0x117699,null))[_0xb1aa('0x2b')](handleError(_0x117699,null));};exports[_0xb1aa('0x70')]=function(_0x3fcdf4,_0x3b75d2,_0x1ed11b){if(_0x3fcdf4[_0xb1aa('0x5f')]['id']){delete _0x3fcdf4[_0xb1aa('0x5f')]['id'];}return db[_0xb1aa('0x41')][_0xb1aa('0x5e')]({'where':{'id':_0x3fcdf4[_0xb1aa('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3b75d2,null))[_0xb1aa('0x21')](function(_0x52d23e){if(_0x52d23e){_0x3fcdf4[_0xb1aa('0x5f')]['WhatsappAccountId']=_0x52d23e['id'];return db[_0xb1aa('0x71')][_0xb1aa('0x65')](_0x3fcdf4[_0xb1aa('0x5f')]);}})[_0xb1aa('0x21')](respondWithResult(_0x3b75d2,null))[_0xb1aa('0x2b')](handleError(_0x3b75d2,null));};exports[_0xb1aa('0x72')]=function(_0x1e5ac3,_0x1c9bf6,_0x39974f){var _0x4983c2={'raw':![],'where':{}};var _0x59ecba={};var _0x2780c5={'count':0x0,'rows':[]};return db[_0xb1aa('0x41')]['findOne']({'where':{'id':_0x1e5ac3[_0xb1aa('0x5b')]['id']}})[_0xb1aa('0x21')](handleEntityNotFound(_0x1c9bf6,null))[_0xb1aa('0x21')](function(_0x1147b1){if(_0x1147b1){_0x59ecba[_0xb1aa('0x48')]=_['keys'](db[_0xb1aa('0x71')]['rawAttributes']);_0x59ecba['query']=_[_0xb1aa('0x46')](_0x1e5ac3[_0xb1aa('0x45')]);_0x59ecba[_0xb1aa('0x5c')]=_[_0xb1aa('0x47')](_0x59ecba[_0xb1aa('0x48')],_0x59ecba['query']);_0x4983c2[_0xb1aa('0x49')]=_[_0xb1aa('0x47')](_0x59ecba['model'],qs[_0xb1aa('0x4a')](_0x1e5ac3['query']['fields']));_0x4983c2[_0xb1aa('0x49')]=_0x4983c2['attributes'][_0xb1aa('0x4b')]?_0x4983c2['attributes']:_0x59ecba[_0xb1aa('0x48')];if(!_0x1e5ac3['query'][_0xb1aa('0x4c')](_0xb1aa('0x4d'))){_0x4983c2[_0xb1aa('0x30')]=qs[_0xb1aa('0x30')](_0x1e5ac3[_0xb1aa('0x45')]['limit']);_0x4983c2[_0xb1aa('0x4e')]=qs[_0xb1aa('0x4e')](_0x1e5ac3[_0xb1aa('0x45')][_0xb1aa('0x4e')]);}_0x4983c2[_0xb1aa('0x4f')]=qs['sort'](_0x1e5ac3[_0xb1aa('0x45')][_0xb1aa('0x50')]);_0x4983c2[_0xb1aa('0x51')]=qs['filters'](_[_0xb1aa('0x52')](_0x1e5ac3[_0xb1aa('0x45')],_0x59ecba['filters']));_0x4983c2['where'][_0xb1aa('0x6a')]=_0x1147b1['id'];if(_0x1e5ac3[_0xb1aa('0x45')][_0xb1aa('0x53')]){_0x4983c2['where']=_[_0xb1aa('0x54')](_0x4983c2[_0xb1aa('0x51')],{'$or':_['map'](_0x4983c2['attributes'],function(_0x3f9a83){var _0x3b0f64={};_0x3b0f64[_0x3f9a83]={'$like':'%'+_0x1e5ac3[_0xb1aa('0x45')]['filter']+'%'};return _0x3b0f64;})});}_0x4983c2=_[_0xb1aa('0x54')]({},_0x4983c2,_0x1e5ac3[_0xb1aa('0x56')]);return db[_0xb1aa('0x71')][_0xb1aa('0x31')]({'where':_0x4983c2[_0xb1aa('0x51')]})[_0xb1aa('0x21')](function(_0x42988c){_0x2780c5[_0xb1aa('0x31')]=_0x42988c;if(_0x1e5ac3[_0xb1aa('0x45')]['includeAll']){_0x4983c2['include']=[{'all':!![]}];}return db[_0xb1aa('0x71')]['findAll'](_0x4983c2);})[_0xb1aa('0x21')](function(_0x3a389e){_0x2780c5[_0xb1aa('0x59')]=_0x3a389e;return _0x2780c5;});}})[_0xb1aa('0x21')](respondWithFilteredResult(_0x1c9bf6,_0x4983c2))[_0xb1aa('0x2b')](handleError(_0x1c9bf6,null));};exports[_0xb1aa('0x73')]=function(_0xdab105,_0x5ed4dd,_0x1c7456){return db[_0xb1aa('0x41')][_0xb1aa('0x5e')]({'where':{'id':_0xdab105[_0xb1aa('0x5b')]['id']}})[_0xb1aa('0x21')](handleEntityNotFound(_0x5ed4dd,null))[_0xb1aa('0x21')](function(_0x419705){if(_0x419705){return _0x419705['removeAnswers'](_0xdab105[_0xb1aa('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x5ed4dd,null))[_0xb1aa('0x2b')](handleError(_0x5ed4dd,null));};exports[_0xb1aa('0x74')]=function(_0x1217e2,_0x3ab67e,_0x4f3312){return db['WhatsappAccount'][_0xb1aa('0x5e')]({'where':{'id':_0x1217e2[_0xb1aa('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3ab67e,null))[_0xb1aa('0x21')](function(_0x515241){if(_0x515241){return _0x515241['addAgents'](_0x1217e2[_0xb1aa('0x5f')][_0xb1aa('0x6f')],_[_0xb1aa('0x75')](_0x1217e2['body'],[_0xb1aa('0x6f'),'id'])||{})[_0xb1aa('0x76')](function(_0x3ecbad){for(var _0x273daf=0x0;_0x273daf<_0x1217e2[_0xb1aa('0x5f')][_0xb1aa('0x6f')][_0xb1aa('0x4b')];_0x273daf+=0x1){socket[_0xb1aa('0x77')](_0xb1aa('0x78'),{'UserId':Number(_0x1217e2[_0xb1aa('0x5f')][_0xb1aa('0x6f')][_0x273daf]),'WhatsappAccountId':Number(_0x1217e2[_0xb1aa('0x5b')]['id'])});}return _0x3ecbad;});}})['then'](respondWithResult(_0x3ab67e,null))[_0xb1aa('0x2b')](handleError(_0x3ab67e,null));};exports['removeAgents']=function(_0x2b358f,_0x179491,_0x14da7f){return db[_0xb1aa('0x41')][_0xb1aa('0x5e')]({'where':{'id':_0x2b358f[_0xb1aa('0x5b')]['id']}})['then'](handleEntityNotFound(_0x179491,null))['then'](function(_0x25ab22){if(_0x25ab22){return _0x25ab22[_0xb1aa('0x79')](_0x2b358f[_0xb1aa('0x45')][_0xb1aa('0x6f')])[_0xb1aa('0x21')](function(){if(_[_0xb1aa('0x7a')](_0x2b358f['query']['ids'])){for(var _0x79797a=0x0;_0x79797a<_0x2b358f[_0xb1aa('0x45')][_0xb1aa('0x6f')][_0xb1aa('0x4b')];_0x79797a+=0x1){socket[_0xb1aa('0x77')]('userWhatsappAccount:remove',{'UserId':Number(_0x2b358f[_0xb1aa('0x45')][_0xb1aa('0x6f')][_0x79797a]),'WhatsappAccountId':Number(_0x2b358f['params']['id'])});}}else{socket[_0xb1aa('0x77')](_0xb1aa('0x7b'),{'UserId':Number(_0x2b358f[_0xb1aa('0x45')][_0xb1aa('0x6f')]),'WhatsappAccountId':Number(_0x2b358f[_0xb1aa('0x5b')]['id'])});}});}})[_0xb1aa('0x21')](respondWithStatusCode(_0x179491,null))[_0xb1aa('0x2b')](handleError(_0x179491,null));};exports['getAgents']=function(_0x30c5d9,_0x5370d8,_0xefc3cd){var _0x908a8f={};var _0x4f50de={};var _0x4106ac;var _0x4a66dd;return db[_0xb1aa('0x41')][_0xb1aa('0x6d')]({'where':{'id':_0x30c5d9[_0xb1aa('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5370d8,null))[_0xb1aa('0x21')](function(_0x52fb46){if(_0x52fb46){_0x4106ac=_0x52fb46;_0x4f50de[_0xb1aa('0x48')]=_[_0xb1aa('0x46')](db[_0xb1aa('0x7c')][_0xb1aa('0x42')]);_0x4f50de[_0xb1aa('0x45')]=_['keys'](_0x30c5d9[_0xb1aa('0x45')]);_0x4f50de[_0xb1aa('0x5c')]=_[_0xb1aa('0x47')](_0x4f50de[_0xb1aa('0x48')],_0x4f50de['query']);_0x908a8f[_0xb1aa('0x49')]=_[_0xb1aa('0x47')](_0x4f50de[_0xb1aa('0x48')],qs[_0xb1aa('0x4a')](_0x30c5d9['query'][_0xb1aa('0x4a')]));_0x908a8f['attributes']=_0x908a8f['attributes'][_0xb1aa('0x4b')]?_0x908a8f[_0xb1aa('0x49')]:_0x4f50de[_0xb1aa('0x48')];_0x908a8f[_0xb1aa('0x4f')]=qs['sort'](_0x30c5d9[_0xb1aa('0x45')][_0xb1aa('0x50')]);_0x908a8f['where']=qs[_0xb1aa('0x5c')](_['pick'](_0x30c5d9[_0xb1aa('0x45')],_0x4f50de['filters']));if(_0x30c5d9[_0xb1aa('0x45')]['filter']){_0x908a8f[_0xb1aa('0x51')]=_[_0xb1aa('0x54')](_0x908a8f['where'],{'$or':_[_0xb1aa('0x40')](_0x908a8f['attributes'],function(_0x57a74b){var _0x13ac93={};_0x13ac93[_0x57a74b]={'$like':'%'+_0x30c5d9[_0xb1aa('0x45')][_0xb1aa('0x53')]+'%'};return _0x13ac93;})});}_0x908a8f=_[_0xb1aa('0x54')]({},_0x908a8f,_0x30c5d9[_0xb1aa('0x56')]);return _0x4106ac['getAgents'](_0x908a8f);}})[_0xb1aa('0x21')](function(_0x4def68){if(_0x4def68){_0x4a66dd=_0x4def68['length'];if(!_0x30c5d9[_0xb1aa('0x45')][_0xb1aa('0x4c')](_0xb1aa('0x4d'))){_0x908a8f[_0xb1aa('0x30')]=qs[_0xb1aa('0x30')](_0x30c5d9['query'][_0xb1aa('0x30')]);_0x908a8f[_0xb1aa('0x4e')]=qs[_0xb1aa('0x4e')](_0x30c5d9[_0xb1aa('0x45')][_0xb1aa('0x4e')]);}return _0x4106ac[_0xb1aa('0x7d')](_0x908a8f);}})[_0xb1aa('0x21')](function(_0x34028e){if(_0x34028e){return _0x34028e?{'count':_0x4a66dd,'rows':_0x34028e}:null;}})['then'](respondWithResult(_0x5370d8,null))[_0xb1aa('0x2b')](handleError(_0x5370d8,null));};exports['addApplications']=function(_0x1d754e,_0x5344eb){var _0x22589b=_0x1d754e[_0xb1aa('0x5b')]['id'];var _0x51082a=_0x1d754e[_0xb1aa('0x5f')];var _0x49e822=0xc8;var _0x1aa7e6=null;return db[_0xb1aa('0x7e')][_0xb1aa('0x7f')]({'isolationLevel':db['sequelize'][_0xb1aa('0x80')][_0xb1aa('0x81')][_0xb1aa('0x82')]},function(_0x2d715b){return db['WhatsappAccount'][_0xb1aa('0x6d')]({'where':{'id':_0x22589b},'transaction':_0x2d715b})[_0xb1aa('0x21')](function(_0x3a234e){if(_0x3a234e){return db[_0xb1aa('0x83')][_0xb1aa('0x67')]({'where':{'WhatsappAccountId':_0x22589b},'transaction':_0x2d715b})[_0xb1aa('0x21')](function(){var _0xe09a8c=_[_0xb1aa('0x40')](_0x51082a,function(_0xd1faf0){_0xd1faf0['WhatsappAccountId']=_0x22589b;return _0xd1faf0;});return db[_0xb1aa('0x83')][_0xb1aa('0x84')](_0xe09a8c,{'transaction':_0x2d715b});});}else{_0x49e822=0x194;_0x1aa7e6=[];}});})[_0xb1aa('0x21')](function(){if(_0x49e822!==0x194){return db[_0xb1aa('0x83')][_0xb1aa('0x85')]({'where':{'WhatsappAccountId':_0x22589b},'order':_0xb1aa('0x86')})['then'](function(_0x53962c){_0x1aa7e6=_0x53962c;});}})['catch'](function(_0x48c6cd){_0x49e822=0x1f4;logger[_0xb1aa('0x28')](_0x48c6cd[_0xb1aa('0x3a')]);if(_0x48c6cd[_0xb1aa('0x3b')]){delete _0x48c6cd[_0xb1aa('0x3b')];}_0x1aa7e6=_0x48c6cd;})['finally'](function(){if(_0x1aa7e6===null){_0x5344eb[_0xb1aa('0x2c')](_0x49e822);}else{if(_0x49e822===0x1f4){_0x5344eb['status'](_0x49e822)[_0xb1aa('0x3c')](_0x1aa7e6);}else{_0x5344eb[_0xb1aa('0x2d')](_0x49e822)[_0xb1aa('0x34')](_0x1aa7e6);}}});};exports[_0xb1aa('0x87')]=function(_0x5dd318,_0x80e31b,_0x20f82d){var _0x2171ce={};var _0x5c5f40={};var _0x5d14f8;var _0x44d9f2;return db[_0xb1aa('0x41')]['findOne']({'where':{'id':_0x5dd318[_0xb1aa('0x5b')]['id']}})[_0xb1aa('0x21')](handleEntityNotFound(_0x80e31b,null))['then'](function(_0x339d10){if(_0x339d10){_0x5d14f8=_0x339d10;_0x5c5f40[_0xb1aa('0x48')]=_['keys'](db['WhatsappApplication']['rawAttributes']);_0x5c5f40['query']=_[_0xb1aa('0x46')](_0x5dd318[_0xb1aa('0x45')]);_0x5c5f40[_0xb1aa('0x5c')]=_[_0xb1aa('0x47')](_0x5c5f40['model'],_0x5c5f40[_0xb1aa('0x45')]);_0x2171ce[_0xb1aa('0x49')]=_[_0xb1aa('0x47')](_0x5c5f40['model'],qs[_0xb1aa('0x4a')](_0x5dd318[_0xb1aa('0x45')]['fields']));_0x2171ce['attributes']=_0x2171ce['attributes'][_0xb1aa('0x4b')]?_0x2171ce[_0xb1aa('0x49')]:_0x5c5f40[_0xb1aa('0x48')];_0x2171ce[_0xb1aa('0x4f')]=qs['sort'](_0x5dd318[_0xb1aa('0x45')][_0xb1aa('0x50')]);_0x2171ce[_0xb1aa('0x51')]=qs[_0xb1aa('0x5c')](_[_0xb1aa('0x52')](_0x5dd318[_0xb1aa('0x45')],_0x5c5f40[_0xb1aa('0x5c')]));if(_0x5dd318[_0xb1aa('0x45')][_0xb1aa('0x53')]){_0x2171ce[_0xb1aa('0x51')]=_[_0xb1aa('0x54')](_0x2171ce[_0xb1aa('0x51')],{'$or':_[_0xb1aa('0x40')](_0x2171ce[_0xb1aa('0x49')],function(_0x458c80){var _0x47b5d1={};_0x47b5d1[_0x458c80]={'$like':'%'+_0x5dd318[_0xb1aa('0x45')][_0xb1aa('0x53')]+'%'};return _0x47b5d1;})});}_0x2171ce=_[_0xb1aa('0x54')]({},_0x2171ce,_0x5dd318[_0xb1aa('0x56')]);return _0x5d14f8['getApplications'](_0x2171ce);}})[_0xb1aa('0x21')](function(_0xe6b249){if(_0xe6b249){_0x44d9f2=_0xe6b249[_0xb1aa('0x4b')];if(!_0x5dd318['query'][_0xb1aa('0x4c')]('nolimit')){_0x2171ce['limit']=qs[_0xb1aa('0x30')](_0x5dd318['query'][_0xb1aa('0x30')]);_0x2171ce[_0xb1aa('0x4e')]=qs[_0xb1aa('0x4e')](_0x5dd318[_0xb1aa('0x45')][_0xb1aa('0x4e')]);}return _0x5d14f8['getApplications'](_0x2171ce);}})[_0xb1aa('0x21')](function(_0x9ef3c5){if(_0x9ef3c5){return _0x9ef3c5?{'count':_0x44d9f2,'rows':_0x9ef3c5}:null;}})[_0xb1aa('0x21')](respondWithResult(_0x80e31b,null))[_0xb1aa('0x2b')](handleError(_0x80e31b,null));};exports[_0xb1aa('0x88')]=function(_0x3623ce,_0x21863f,_0x229e04){var _0x41e168={'channel':_0xb1aa('0x89')};var _0x47f19c=[];var _0x1fe562=[];var _0x4b0ddb={};return db[_0xb1aa('0x41')][_0xb1aa('0x5e')]({'where':{'id':_0x3623ce[_0xb1aa('0x5b')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0xb1aa('0x21')](handleEntityNotFound(_0x21863f,null))[_0xb1aa('0x21')](function(_0x5db05d){_0x41e168[_0xb1aa('0x8a')]=_0x5db05d;if(_0x41e168[_0xb1aa('0x8a')]&&_0x41e168[_0xb1aa('0x8a')]['type']===_0xb1aa('0x8b')&&_0x3623ce['body']['statuses']){if(_0x3623ce[_0xb1aa('0x5f')]['statuses'][_0xb1aa('0x4b')]===0x0)return;if(_0x3623ce['body']['statuses'][0x0][_0xb1aa('0x8c')]!==_0xb1aa('0x8d'))return;return db[_0xb1aa('0x8e')][_0xb1aa('0x36')]({'read':!![],'readAt':_0x3623ce['body'][_0xb1aa('0x8f')][0x0]['timestamp']},{'where':{'messageId':_0x3623ce['body'][_0xb1aa('0x8f')][0x0][_0xb1aa('0x90')]},'individualHooks':!![]})[_0xb1aa('0x21')](function(_0x5872c6){return _0x21863f['status'](0xc8)[_0xb1aa('0x34')](_0x5872c6);});}_0x41e168['applications']=_[_0xb1aa('0x91')](_0x5db05d[_0xb1aa('0x92')],[_0xb1aa('0x86')],['asc']);if(_0x41e168[_0xb1aa('0x8a')]['Applications']){delete _0x41e168['account']['Applications'];}return db['CmContact']['describe']()[_0xb1aa('0x21')](function(_0x29afcd){if(!_0x29afcd){throw new db[(_0xb1aa('0x93'))][(_0xb1aa('0x94'))]('no\x20available\x20attributes');}_0x47f19c=_[_0xb1aa('0x95')](_['keys'](_0x29afcd),[_0xb1aa('0x96'),'updatedAt']);_0x1fe562=_[_0xb1aa('0x95')](_[_0xb1aa('0x46')](_0x29afcd),[_0xb1aa('0x96'),'updatedAt','CompanyId',_0xb1aa('0x97')]);_0x41e168[_0xb1aa('0x5f')]={'mapKey':_0xb1aa('0x98')};if(_0x41e168[_0xb1aa('0x8a')]&&_0x41e168[_0xb1aa('0x8a')][_0xb1aa('0x44')]===_0xb1aa('0x99')){_0x41e168[_0xb1aa('0x5f')][_0xb1aa('0x9a')]=_0x3623ce[_0xb1aa('0x5f')]['From']['replace'](_0xb1aa('0x9b'),'');_0x41e168[_0xb1aa('0x5f')]['body']=_0x3623ce[_0xb1aa('0x5f')]['Body'];_0x41e168['body'][_0xb1aa('0x9c')]=_0x3623ce[_0xb1aa('0x5f')][_0xb1aa('0x9d')];}if(_0x41e168['account']&&_0x41e168[_0xb1aa('0x8a')][_0xb1aa('0x44')]===_0xb1aa('0x8b')){_0x41e168[_0xb1aa('0x5f')][_0xb1aa('0x9a')]=_0x3623ce[_0xb1aa('0x5f')][_0xb1aa('0x9e')][0x0][_0xb1aa('0x9a')];_0x41e168[_0xb1aa('0x5f')][_0xb1aa('0x5f')]=_0x3623ce['body']['notifications'][0x0]['message'][_0xb1aa('0x5f')];_0x41e168[_0xb1aa('0x5f')][_0xb1aa('0x9c')]=_0x3623ce[_0xb1aa('0x5f')][_0xb1aa('0x9e')][0x0][_0xb1aa('0x90')];}if(_0x41e168[_0xb1aa('0x5f')]['id']){delete _0x41e168[_0xb1aa('0x5f')]['id'];}if(_[_0xb1aa('0x9f')](_0x41e168[_0xb1aa('0x5f')][_0xb1aa('0x9a')])){throw new db[(_0xb1aa('0x93'))]['ValidationError'](_0xb1aa('0xa0'));}if(_[_0xb1aa('0x9f')](_0x41e168[_0xb1aa('0x5f')][_0xb1aa('0x5f')])||_0x41e168[_0xb1aa('0x5f')][_0xb1aa('0x5f')]===''){throw new db[(_0xb1aa('0x93'))][(_0xb1aa('0x94'))](_0xb1aa('0xa1'));}if(_[_0xb1aa('0x9f')](_0x41e168[_0xb1aa('0x5f')]['mapKey'])){throw new db['Sequelize'][(_0xb1aa('0x94'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1fe562);}if(!_['includes'](_0x1fe562,_0x41e168[_0xb1aa('0x5f')][_0xb1aa('0xa2')])){throw new db[(_0xb1aa('0x93'))][(_0xb1aa('0x94'))](_0xb1aa('0xa3')+_0x1fe562);}_0x4b0ddb[_0x41e168[_0xb1aa('0x5f')][_0xb1aa('0xa2')]]=_0x41e168[_0xb1aa('0x5f')][_0xb1aa('0x9a')];return db['CmList']['find']({'where':{'id':_0x41e168[_0xb1aa('0x8a')][_0xb1aa('0x97')]},'include':[{'model':db[_0xb1aa('0xa4')],'as':'Contacts','where':_0x4b0ddb,'limit':0x1,'order':[['updatedAt',_0xb1aa('0xa5')]]}]});})[_0xb1aa('0x21')](handleEntityNotFound(_0x21863f,null))['then'](function(_0x217663){if(_0x217663){_0x41e168[_0xb1aa('0xa6')]=_[_0xb1aa('0x75')](_0x217663,[_0xb1aa('0xa7')]);if(_0x217663[_0xb1aa('0xa7')][_0xb1aa('0x4b')]){return _0x217663[_0xb1aa('0xa7')][0x0];}var _0x55dcc1=_[_0xb1aa('0x1c')](_0x41e168[_0xb1aa('0x5f')],{'firstName':_0x41e168[_0xb1aa('0x5f')][_0xb1aa('0x9a')],'ListId':_0x217663['id']});_0x55dcc1[_0x41e168['body'][_0xb1aa('0xa2')]]=_0x41e168[_0xb1aa('0x5f')][_0xb1aa('0x9a')];return db[_0xb1aa('0xa4')]['create'](_0x55dcc1,{'fields':_0x47f19c,'raw':!![]});}})[_0xb1aa('0x21')](handleEntityNotFound(_0x21863f,null))[_0xb1aa('0x21')](function(_0x58bf85){if(_0x58bf85){_0x41e168[_0xb1aa('0xa8')]=_0x58bf85;var _0x14177a={'ContactId':_0x58bf85['id'],'phone':_0x41e168['body'][_0xb1aa('0x9a')],'WhatsappAccountId':_0x3623ce['params']['id']};var _0x5331b5={'ContactId':_0x58bf85['id'],'WhatsappAccountId':_0x3623ce['params']['id'],'closed':![]};return db[_0xb1aa('0xa9')]['find']({'where':_0x5331b5})['then'](function(_0xbf9058){if(_0xbf9058){return[_0xbf9058,![]];}return db['WhatsappInteraction'][_0xb1aa('0x65')](_0x14177a)[_0xb1aa('0x21')](function(_0x373704){return[_0x373704,!![]];});});}})[_0xb1aa('0x76')](function(_0xf8cdcd,_0x10af2a){_0x41e168[_0xb1aa('0xaa')]=_0xf8cdcd[_0xb1aa('0x37')]({'plain':!![]});_0x41e168['interaction'][_0xb1aa('0xab')]=![];if(_0x10af2a){if(_0x41e168['account'][_0xb1aa('0xac')]){_0x41e168[_0xb1aa('0xad')][_0xb1aa('0xae')]({'id':0x0,'priority':_0x41e168[_0xb1aa('0xad')]['length']+0x1,'app':_0xb1aa('0xaf'),'appdata':'unmanaged','interval':_0xb1aa('0xb0')});}_0x41e168[_0xb1aa('0xaa')][_0xb1aa('0xab')]=!![];}return db['WhatsappMessage'][_0xb1aa('0x65')]({'phone':_0x41e168[_0xb1aa('0x5f')][_0xb1aa('0x9a')],'messageId':_0x41e168[_0xb1aa('0x5f')]['messageId'],'body':_0x41e168[_0xb1aa('0x5f')]['body'],'WhatsappAccountId':_0x3623ce[_0xb1aa('0x5b')]['id'],'WhatsappInteractionId':_0xf8cdcd['id'],'direction':'in','ContactId':_0xf8cdcd[_0xb1aa('0xb1')],'AttachmentId':_0x41e168['body']['AttachmentId']});})[_0xb1aa('0x21')](function(_0x171cce){_0x41e168[_0xb1aa('0x2a')]=_0x171cce;if(!_0x41e168['interaction'][_0xb1aa('0xb2')])return;return db[_0xb1aa('0x7c')][_0xb1aa('0x5e')]({'attributes':['id','name'],'where':{'id':_0x41e168[_0xb1aa('0xaa')][_0xb1aa('0xb2')]}});})[_0xb1aa('0x21')](function(_0x48e5bf){if(_0x48e5bf){_0x41e168[_0xb1aa('0xad')][_0xb1aa('0xb3')]({'id':0x0,'priority':0x0,'app':_0xb1aa('0xb4'),'appdata':_0x48e5bf[_0xb1aa('0x3b')]+','+(_0x41e168['account'][_0xb1aa('0xb5')]||0xa),'interval':_0xb1aa('0xb0')});}if(!_0x41e168['interaction']['queueId'])return;return db[_0xb1aa('0xb6')]['find']({'attributes':['id','name'],'where':{'id':_0x41e168[_0xb1aa('0xaa')][_0xb1aa('0xb7')]}});})[_0xb1aa('0x21')](function(_0x34d641){if(_0x34d641){_0x41e168[_0xb1aa('0xad')][_0xb1aa('0xb3')]({'id':0x0,'priority':0x1,'app':_0xb1aa('0xb8'),'appdata':_0x34d641['name']+','+(_0x41e168[_0xb1aa('0x8a')][_0xb1aa('0xb9')]||0x12c),'interval':_0xb1aa('0xb0')});}return respondWithRpcPromise(_0xb1aa('0xba'),_0xb1aa('0xbb'),_0x41e168);})[_0xb1aa('0x21')](function(_0x217c11){if(_0x217c11){var _0x770de=0xc8;var _0x4a90b2=_0xb1aa('0xbc');logger[_0xb1aa('0x22')](_0xb1aa('0x26'),_0x4a90b2,_0x770de,'entity\x20found');logger['debug'](_0xb1aa('0xbd'),_0x4a90b2,_0x770de,_0xb1aa('0xbe'),JSON['stringify'](_0x217c11));if(_0x41e168['account']['type']===_0xb1aa('0x99')){return _0x21863f[_0xb1aa('0x2d')](_0x770de)[_0xb1aa('0x32')](_0xb1aa('0xbf'),_0xb1aa('0xc0'))[_0xb1aa('0x3c')](_0xb1aa('0xc1'));}else{return _0x21863f['status'](_0x770de)[_0xb1aa('0x34')](_0x217c11);}}});})[_0xb1aa('0x2b')](handleError(_0x21863f,null));};exports[_0xb1aa('0x3c')]=function(_0x19ca7c,_0x4baf96,_0x386032){var _0xb5a9fd,_0x2a3892,_0x3e99a2;if(_['isNil'](_0x19ca7c[_0xb1aa('0x5f')][_0xb1aa('0x5f')])||_0x19ca7c['body'][_0xb1aa('0x5f')]===''){throw new db[(_0xb1aa('0x93'))][(_0xb1aa('0x94'))](_0xb1aa('0xa1'));}if(_[_0xb1aa('0x9f')](_0x19ca7c[_0xb1aa('0x5f')]['to'])){throw new db[(_0xb1aa('0x93'))]['ValidationError']('to\x20is\x20mandatory');}_0xb5a9fd=_0x19ca7c[_0xb1aa('0x5f')]['to'];return db[_0xb1aa('0x41')][_0xb1aa('0x5e')]({'where':{'id':_0x19ca7c[_0xb1aa('0x5b')]['id']},'include':[{'model':db[_0xb1aa('0xc2')],'as':'List','include':[{'model':db[_0xb1aa('0xa4')],'as':_0xb1aa('0xa7'),'where':{'mobile':_0xb5a9fd},'limit':0x1,'order':[['updatedAt',_0xb1aa('0xa5')]]}]}]})[_0xb1aa('0x21')](handleEntityNotFound(_0x4baf96,null))['then'](function(_0x23768c){if(_0x23768c&&_0x23768c['List']){_0x2a3892=_0x23768c[_0xb1aa('0x37')]({'plain':!![]});if(_0x2a3892[_0xb1aa('0xc3')]&&_0x2a3892[_0xb1aa('0xc3')][_0xb1aa('0xa7')]['length']){return _0x2a3892[_0xb1aa('0xc3')][_0xb1aa('0xa7')][0x0];}return db[_0xb1aa('0xa4')][_0xb1aa('0x65')](_[_0xb1aa('0x1c')](_0x19ca7c['body'],{'firstName':_0xb5a9fd,'mobile':_0xb5a9fd,'phone':_0xb5a9fd,'ListId':_0x2a3892['ListId']}));}})[_0xb1aa('0x21')](handleEntityNotFound(_0x4baf96,null))[_0xb1aa('0x21')](function(_0x2af709){if(_0x2af709){_0x3e99a2=_0x2af709;return db[_0xb1aa('0xa9')][_0xb1aa('0x5e')]({'where':{'ContactId':_0x3e99a2['id'],'closed':![],'WhatsappAccountId':_0x2a3892['id']}})[_0xb1aa('0x21')](function(_0x5952a3){if(_0x5952a3){return[_0x5952a3,![]];}return db[_0xb1aa('0xa9')]['create']({'UserId':_0x19ca7c[_0xb1aa('0x60')]['id'],'ContactId':_0x3e99a2['id'],'WhatsappAccountId':_0x2a3892['id'],'phone':_0xb5a9fd,'firstMsgDirection':_0xb1aa('0xc4'),'Messages':[_[_0xb1aa('0x54')](_0x19ca7c[_0xb1aa('0x5f')],{'read':![],'body':_0x19ca7c[_0xb1aa('0x5f')][_0xb1aa('0x5f')],'phone':_0xb5a9fd,'WhatsappAccountId':_0x2a3892['id'],'UserId':_0x19ca7c[_0xb1aa('0x60')]['id'],'ContactId':_0x3e99a2['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xb1aa('0xc5')}]})[_0xb1aa('0x21')](function(_0x5415bd){return[_0x5415bd,!![]];});});}})['spread'](function(_0x43efee,_0x4d91d4){if(_0x4d91d4){return _0x43efee;}return db[_0xb1aa('0x8e')][_0xb1aa('0x65')](_[_0xb1aa('0x54')](_0x19ca7c[_0xb1aa('0x5f')],{'read':![],'body':_0x19ca7c[_0xb1aa('0x5f')][_0xb1aa('0x5f')],'phone':_0xb5a9fd,'WhatsappAccountId':_0x2a3892['id'],'WhatsappInteractionId':_0x43efee['id'],'UserId':_0x19ca7c['user']['id'],'ContactId':_0x3e99a2['id']}))[_0xb1aa('0x21')](function(_0x59aeb4){_0x43efee['dataValues'][_0xb1aa('0xc5')]=[];_0x43efee[_0xb1aa('0xc6')][_0xb1aa('0xc5')][_0xb1aa('0xae')](_0x59aeb4[_0xb1aa('0xc6')]);return _0x43efee;});})[_0xb1aa('0x21')](respondWithResult(_0x4baf96,null))[_0xb1aa('0x2b')](handleError(_0x4baf96,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 43773ee..21b2fe2 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 _0xb342=['exports','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4296b3,_0x58c241){var _0x146ad8=function(_0x2e5079){while(--_0x2e5079){_0x4296b3['push'](_0x4296b3['shift']());}};_0x146ad8(++_0x58c241);}(_0xb342,0x149));var _0x2b34=function(_0x3b6652,_0x32486d){_0x3b6652=_0x3b6652-0x0;var _0x14d39f=_0xb342[_0x3b6652];return _0x14d39f;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0x2b34('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x2b34('0x1')](0x0);var events={'afterCreate':_0x2b34('0x2'),'afterUpdate':_0x2b34('0x3'),'afterDestroy':_0x2b34('0x4')};function emitEvent(_0x74efcc){return function(_0x43e2be,_0x572ff2,_0x55a537){WhatsappAccountEvents['emit'](_0x74efcc+':'+_0x43e2be['id'],_0x43e2be);WhatsappAccountEvents[_0x2b34('0x5')](_0x74efcc,_0x43e2be);_0x55a537(null);};}for(var e in events){if(events[_0x2b34('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x2b34('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0xee10=['WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x2f030e,_0x17bbfc){var _0x191463=function(_0x21ad65){while(--_0x21ad65){_0x2f030e['push'](_0x2f030e['shift']());}};_0x191463(++_0x17bbfc);}(_0xee10,0xf9));var _0x0ee1=function(_0x56ee69,_0x5f5611){_0x56ee69=_0x56ee69-0x0;var _0x177437=_0xee10[_0x56ee69];return _0x177437;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x0ee1('0x0'))['db'][_0x0ee1('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x0ee1('0x2')](0x0);var events={'afterCreate':_0x0ee1('0x3'),'afterUpdate':_0x0ee1('0x4'),'afterDestroy':_0x0ee1('0x5')};function emitEvent(_0x1692f2){return function(_0x28f1dc,_0xb32d3b,_0x370b80){WhatsappAccountEvents['emit'](_0x1692f2+':'+_0x28f1dc['id'],_0x28f1dc);WhatsappAccountEvents[_0x0ee1('0x6')](_0x1692f2,_0x28f1dc);_0x370b80(null);};}for(var e in events){if(events[_0x0ee1('0x7')](e)){var event=events[e];WhatsappAccount[_0x0ee1('0x8')](e,emitEvent(event));}}module[_0x0ee1('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 1e9e51f..986150a 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 _0xda28=['exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xda28,0xa0));var _0x8da2=function(_0x2d9878,_0x5ae702){_0x2d9878=_0x2d9878-0x0;var _0x28e150=_0xda28[_0x2d9878];return _0x28e150;};'use strict';var _=require(_0x8da2('0x0'));var util=require(_0x8da2('0x1'));var logger=require('../../config/logger')(_0x8da2('0x2'));var moment=require(_0x8da2('0x3'));var BPromise=require('bluebird');var rp=require(_0x8da2('0x4'));var fs=require('fs');var path=require(_0x8da2('0x5'));var rimraf=require(_0x8da2('0x6'));var config=require(_0x8da2('0x7'));var attributes=require(_0x8da2('0x8'));module[_0x8da2('0x9')]=function(_0x559e67,_0x52d368){return _0x559e67[_0x8da2('0xa')](_0x8da2('0xb'),attributes,{'tableName':_0x8da2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['exports','define','WhatsappAccount','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3a166a,_0x2018be){var _0x1b0279=function(_0x5b98dd){while(--_0x5b98dd){_0x3a166a['push'](_0x3a166a['shift']());}};_0x1b0279(++_0x2018be);}(_0x7fbe,0xcb));var _0xe7fb=function(_0x256e32,_0x4013bc){_0x256e32=_0x256e32-0x0;var _0x464070=_0x7fbe[_0x256e32];return _0x464070;};'use strict';var _=require(_0xe7fb('0x0'));var util=require(_0xe7fb('0x1'));var logger=require(_0xe7fb('0x2'))('api');var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('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('./whatsappAccount.attributes');module[_0xe7fb('0x5')]=function(_0x203e9c,_0x481ce4){return _0x203e9c[_0xe7fb('0x6')](_0xe7fb('0x7'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 90305ce..b8976b8 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 _0x0f58=['socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes','map','include','model','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x533561,_0x23acc8){var _0x5258ed=function(_0x413bcd){while(--_0x413bcd){_0x533561['push'](_0x533561['shift']());}};_0x5258ed(++_0x23acc8);}(_0x0f58,0x164));var _0x80f5=function(_0x331015,_0x22ef37){_0x331015=_0x331015-0x0;var _0x40f12e=_0x0f58[_0x331015];return _0x40f12e;};'use strict';var _=require(_0x80f5('0x0'));var util=require(_0x80f5('0x1'));var moment=require(_0x80f5('0x2'));var BPromise=require(_0x80f5('0x3'));var rs=require(_0x80f5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80f5('0x5'))['db'];var utils=require(_0x80f5('0x6'));var logger=require(_0x80f5('0x7'))(_0x80f5('0x8'));var config=require(_0x80f5('0x9'));var jayson=require(_0x80f5('0xa'));var client=jayson[_0x80f5('0xb')][_0x80f5('0xc')]({'port':0x232a});config[_0x80f5('0xd')]=_['defaults'](config[_0x80f5('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x80f5('0xe'))(new Redis(config['redis']));require(_0x80f5('0xf'))[_0x80f5('0x10')](socket);function respondWithRpcPromise(_0x2ce6c4,_0x3da407,_0x1b4521){return new BPromise(function(_0x5e9501,_0x2de5cb){return client['request'](_0x2ce6c4,_0x1b4521)[_0x80f5('0x11')](function(_0x1d5376){logger[_0x80f5('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x3da407,'request\x20sent');logger['debug'](_0x80f5('0x13'),_0x3da407,_0x80f5('0x14'),JSON[_0x80f5('0x15')](_0x1d5376));if(_0x1d5376['error']){if(_0x1d5376[_0x80f5('0x16')]['code']===0x1f4){logger[_0x80f5('0x16')](_0x80f5('0x17'),_0x3da407,_0x1d5376[_0x80f5('0x16')][_0x80f5('0x18')]);return _0x2de5cb(_0x1d5376[_0x80f5('0x16')][_0x80f5('0x18')]);}logger[_0x80f5('0x16')](_0x80f5('0x17'),_0x3da407,_0x1d5376[_0x80f5('0x16')][_0x80f5('0x18')]);return _0x5e9501(_0x1d5376[_0x80f5('0x16')][_0x80f5('0x18')]);}else{logger[_0x80f5('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x3da407,'request\x20sent');_0x5e9501(_0x1d5376[_0x80f5('0x19')][_0x80f5('0x18')]);}})[_0x80f5('0x1a')](function(_0x4c4822){logger[_0x80f5('0x16')](_0x80f5('0x17'),_0x3da407,_0x4c4822);_0x2de5cb(_0x4c4822);});});}exports[_0x80f5('0x1b')]=function(_0x38ecf0){var _0x176bd0=this;return new Promise(function(_0x1b325b,_0x3df93d){return db[_0x80f5('0x1c')][_0x80f5('0x1d')]({'raw':_0x38ecf0[_0x80f5('0x1e')]?_0x38ecf0[_0x80f5('0x1e')][_0x80f5('0x1f')]===undefined?!![]:![]:!![],'where':_0x38ecf0['options']?_0x38ecf0[_0x80f5('0x1e')]['where']||null:null,'attributes':_0x38ecf0['options']?_0x38ecf0[_0x80f5('0x1e')][_0x80f5('0x20')]||null:null,'include':_0x38ecf0[_0x80f5('0x1e')]?_0x38ecf0[_0x80f5('0x1e')]['include']?_[_0x80f5('0x21')](_0x38ecf0[_0x80f5('0x1e')][_0x80f5('0x22')],function(_0xdfb7ad){return{'model':db[_0xdfb7ad[_0x80f5('0x23')]],'as':_0xdfb7ad['as'],'attributes':_0xdfb7ad[_0x80f5('0x20')],'include':_0xdfb7ad[_0x80f5('0x22')]?_[_0x80f5('0x21')](_0xdfb7ad['include'],function(_0x463184){return{'model':db[_0x463184[_0x80f5('0x23')]],'as':_0x463184['as'],'attributes':_0x463184[_0x80f5('0x20')],'include':_0x463184[_0x80f5('0x22')]?_[_0x80f5('0x21')](_0x463184[_0x80f5('0x22')],function(_0x4207f9){return{'model':db[_0x4207f9[_0x80f5('0x23')]],'as':_0x4207f9['as'],'attributes':_0x4207f9['attributes']};}):[]};}):[]};}):[]:[]})[_0x80f5('0x11')](function(_0x2e9ca6){logger['info']('ShowWhatsappAccount',_0x38ecf0);logger[_0x80f5('0x24')](_0x80f5('0x1b'),_0x38ecf0,JSON[_0x80f5('0x15')](_0x2e9ca6));_0x1b325b(_0x2e9ca6);})[_0x80f5('0x1a')](function(_0x5edac4){logger[_0x80f5('0x16')](_0x80f5('0x1b'),_0x5edac4[_0x80f5('0x18')],_0x38ecf0);_0x3df93d(_0x176bd0[_0x80f5('0x16')](0x1f4,_0x5edac4[_0x80f5('0x18')]));});});}; \ No newline at end of file +var _0x087b=['ShowWhatsappAccount','find','options','raw','where','attributes','include','model','map','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch'];(function(_0x2e8ab8,_0x9a2268){var _0x24e10a=function(_0x34c5af){while(--_0x34c5af){_0x2e8ab8['push'](_0x2e8ab8['shift']());}};_0x24e10a(++_0x9a2268);}(_0x087b,0x11a));var _0xb087=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x087b[_0x4c445a];return _0x2f611c;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb087('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb087('0x3'))['db'];var utils=require(_0xb087('0x4'));var logger=require(_0xb087('0x5'))(_0xb087('0x6'));var config=require(_0xb087('0x7'));var jayson=require(_0xb087('0x8'));var client=jayson[_0xb087('0x9')][_0xb087('0xa')]({'port':0x232a});config[_0xb087('0xb')]=_[_0xb087('0xc')](config[_0xb087('0xb')],{'host':_0xb087('0xd'),'port':0x18eb});var socket=require(_0xb087('0xe'))(new Redis(config[_0xb087('0xb')]));require(_0xb087('0xf'))[_0xb087('0x10')](socket);function respondWithRpcPromise(_0x379041,_0x583d25,_0x244abc){return new BPromise(function(_0x108451,_0x903a16){return client[_0xb087('0x11')](_0x379041,_0x244abc)[_0xb087('0x12')](function(_0x2f43e9){logger[_0xb087('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x583d25,_0xb087('0x14'));logger[_0xb087('0x15')](_0xb087('0x16'),_0x583d25,'request\x20sent',JSON[_0xb087('0x17')](_0x2f43e9));if(_0x2f43e9[_0xb087('0x18')]){if(_0x2f43e9[_0xb087('0x18')][_0xb087('0x19')]===0x1f4){logger[_0xb087('0x18')](_0xb087('0x1a'),_0x583d25,_0x2f43e9[_0xb087('0x18')][_0xb087('0x1b')]);return _0x903a16(_0x2f43e9[_0xb087('0x18')][_0xb087('0x1b')]);}logger['error'](_0xb087('0x1a'),_0x583d25,_0x2f43e9[_0xb087('0x18')]['message']);return _0x108451(_0x2f43e9[_0xb087('0x18')][_0xb087('0x1b')]);}else{logger[_0xb087('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x583d25,_0xb087('0x14'));_0x108451(_0x2f43e9[_0xb087('0x1c')][_0xb087('0x1b')]);}})[_0xb087('0x1d')](function(_0x4e333b){logger[_0xb087('0x18')](_0xb087('0x1a'),_0x583d25,_0x4e333b);_0x903a16(_0x4e333b);});});}exports[_0xb087('0x1e')]=function(_0x23c1b6){var _0x5b4ef0=this;return new Promise(function(_0x5aeab1,_0x5ea3dc){return db['WhatsappAccount'][_0xb087('0x1f')]({'raw':_0x23c1b6[_0xb087('0x20')]?_0x23c1b6[_0xb087('0x20')][_0xb087('0x21')]===undefined?!![]:![]:!![],'where':_0x23c1b6[_0xb087('0x20')]?_0x23c1b6[_0xb087('0x20')][_0xb087('0x22')]||null:null,'attributes':_0x23c1b6['options']?_0x23c1b6[_0xb087('0x20')][_0xb087('0x23')]||null:null,'include':_0x23c1b6[_0xb087('0x20')]?_0x23c1b6[_0xb087('0x20')][_0xb087('0x24')]?_['map'](_0x23c1b6[_0xb087('0x20')][_0xb087('0x24')],function(_0x502438){return{'model':db[_0x502438['model']],'as':_0x502438['as'],'attributes':_0x502438['attributes'],'include':_0x502438['include']?_['map'](_0x502438[_0xb087('0x24')],function(_0x45685d){return{'model':db[_0x45685d[_0xb087('0x25')]],'as':_0x45685d['as'],'attributes':_0x45685d[_0xb087('0x23')],'include':_0x45685d[_0xb087('0x24')]?_[_0xb087('0x26')](_0x45685d[_0xb087('0x24')],function(_0x35a52c){return{'model':db[_0x35a52c[_0xb087('0x25')]],'as':_0x35a52c['as'],'attributes':_0x35a52c[_0xb087('0x23')]};}):[]};}):[]};}):[]:[]})[_0xb087('0x12')](function(_0x31e3e6){logger[_0xb087('0x13')](_0xb087('0x1e'),_0x23c1b6);logger['debug'](_0xb087('0x1e'),_0x23c1b6,JSON[_0xb087('0x17')](_0x31e3e6));_0x5aeab1(_0x31e3e6);})[_0xb087('0x1d')](function(_0x15c9ac){logger[_0xb087('0x18')](_0xb087('0x1e'),_0x15c9ac[_0xb087('0x1b')],_0x23c1b6);_0x5ea3dc(_0x5b4ef0[_0xb087('0x18')](0x1f4,_0x15c9ac['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 98eeddb..7782bc4 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 _0x1ec1=['update','emit','removeListener','length','whatsappAccount:','save','remove'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1ec1,0x1ef));var _0x11ec=function(_0x2fdf7e,_0x11cf9a){_0x2fdf7e=_0x2fdf7e-0x0;var _0x5d8363=_0x1ec1[_0x2fdf7e];return _0x5d8363;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x11ec('0x0'),_0x11ec('0x1'),_0x11ec('0x2')];function createListener(_0x540762,_0x10cb5d){return function(_0x584eb3){_0x10cb5d[_0x11ec('0x3')](_0x540762,_0x584eb3);};}function removeListener(_0x50df98,_0xa430e5){return function(){WhatsappAccountEvents[_0x11ec('0x4')](_0x50df98,_0xa430e5);};}exports['register']=function(_0x200091){for(var _0x2473db=0x0,_0x411623=events[_0x11ec('0x5')];_0x2473db<_0x411623;_0x2473db++){var _0x1b4de6=events[_0x2473db];var _0x213fd3=createListener(_0x11ec('0x6')+_0x1b4de6,_0x200091);WhatsappAccountEvents['on'](_0x1b4de6,_0x213fd3);}}; \ No newline at end of file +var _0x61d7=['update','emit','save','remove'];(function(_0x14b191,_0x46f747){var _0x561639=function(_0x1b9eab){while(--_0x1b9eab){_0x14b191['push'](_0x14b191['shift']());}};_0x561639(++_0x46f747);}(_0x61d7,0x82));var _0x761d=function(_0x33fc2c,_0x4bf19a){_0x33fc2c=_0x33fc2c-0x0;var _0x253529=_0x61d7[_0x33fc2c];return _0x253529;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x761d('0x0'),_0x761d('0x1'),_0x761d('0x2')];function createListener(_0x3dc8b0,_0x2eeb37){return function(_0x54a687){_0x2eeb37[_0x761d('0x3')](_0x3dc8b0,_0x54a687);};}function removeListener(_0x35a51f,_0x54ce43){return function(){WhatsappAccountEvents['removeListener'](_0x35a51f,_0x54ce43);};}exports['register']=function(_0x4e5b31){for(var _0x3b4a26=0x0,_0x114b3a=events['length'];_0x3b4a26<_0x114b3a;_0x3b4a26++){var _0x3c35cf=events[_0x3b4a26];var _0x3e41f1=createListener('whatsappAccount:'+_0x3c35cf,_0x4e5b31);WhatsappAccountEvents['on'](_0x3c35cf,_0x3e41f1);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 737f688..3e34a1a 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 _0xf017=['../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','express','Router','fs-extra','../../components/auth/service'];(function(_0x3dbd00,_0x17cb39){var _0x2b9852=function(_0x2c540a){while(--_0x2c540a){_0x3dbd00['push'](_0x3dbd00['shift']());}};_0x2b9852(++_0x17cb39);}(_0xf017,0x119));var _0x7f01=function(_0x3031dc,_0x3c2dab){_0x3031dc=_0x3031dc-0x0;var _0x5e5b07=_0xf017[_0x3031dc];return _0x5e5b07;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7f01('0x0'));var router=express[_0x7f01('0x1')]();var fs_extra=require(_0x7f01('0x2'));var auth=require(_0x7f01('0x3'));var interaction=require(_0x7f01('0x4'));var config=require(_0x7f01('0x5'));var controller=require(_0x7f01('0x6'));router[_0x7f01('0x7')]('/',auth[_0x7f01('0x8')](),controller[_0x7f01('0x9')]);router[_0x7f01('0x7')](_0x7f01('0xa'),auth[_0x7f01('0x8')](),controller[_0x7f01('0xb')]);router[_0x7f01('0xc')]('/',auth[_0x7f01('0x8')](),controller[_0x7f01('0xd')]);router[_0x7f01('0xe')](_0x7f01('0xa'),auth[_0x7f01('0x8')](),controller[_0x7f01('0xf')]);router[_0x7f01('0x10')](_0x7f01('0xa'),auth[_0x7f01('0x8')](),controller[_0x7f01('0x11')]);module[_0x7f01('0x12')]=router; \ No newline at end of file +var _0x44db=['get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x44db,0xdc));var _0xb44d=function(_0x19d24c,_0x62bc50){_0x19d24c=_0x19d24c-0x0;var _0x2fae8d=_0x44db[_0x19d24c];return _0x2fae8d;};'use strict';var multer=require(_0xb44d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb44d('0x1'));var express=require(_0xb44d('0x2'));var router=express[_0xb44d('0x3')]();var fs_extra=require(_0xb44d('0x4'));var auth=require(_0xb44d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb44d('0x6'));var controller=require(_0xb44d('0x7'));router[_0xb44d('0x8')]('/',auth[_0xb44d('0x9')](),controller[_0xb44d('0xa')]);router[_0xb44d('0x8')](_0xb44d('0xb'),auth[_0xb44d('0x9')](),controller['show']);router[_0xb44d('0xc')]('/',auth[_0xb44d('0x9')](),controller[_0xb44d('0xd')]);router[_0xb44d('0xe')]('/:id',auth[_0xb44d('0x9')](),controller[_0xb44d('0xf')]);router[_0xb44d('0x10')](_0xb44d('0xb'),auth['isAuthenticated'](),controller[_0xb44d('0x11')]);module[_0xb44d('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index b0e79c8..d79ec70 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 _0x4e41=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0xa3c06b,_0x490f99){var _0x33aa1d=function(_0x23a88e){while(--_0x23a88e){_0xa3c06b['push'](_0xa3c06b['shift']());}};_0x33aa1d(++_0x490f99);}(_0x4e41,0xa4));var _0x14e4=function(_0x22d71a,_0x14c948){_0x22d71a=_0x22d71a-0x0;var _0x3ddcea=_0x4e41[_0x22d71a];return _0x3ddcea;};'use strict';var Sequelize=require(_0x14e4('0x0'));module[_0x14e4('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x14e4('0x2')],'allowNull':![],'defaultValue':_0x14e4('0x3')},'appdata':{'type':Sequelize[_0x14e4('0x4')]()},'description':{'type':Sequelize[_0x14e4('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x14e4('0x5')}}; \ No newline at end of file +var _0x55af=['noop','TEXT','sequelize','exports','STRING'];(function(_0x1504e8,_0x3a5fc6){var _0x71473=function(_0x20210d){while(--_0x20210d){_0x1504e8['push'](_0x1504e8['shift']());}};_0x71473(++_0x3a5fc6);}(_0x55af,0xed));var _0xf55a=function(_0x1c6871,_0xa1d8c6){_0x1c6871=_0x1c6871-0x0;var _0x3fd3e9=_0x55af[_0x1c6871];return _0x3fd3e9;};'use strict';var Sequelize=require(_0xf55a('0x0'));module[_0xf55a('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf55a('0x2')],'allowNull':![],'defaultValue':_0xf55a('0x3')},'appdata':{'type':Sequelize[_0xf55a('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 01cf699..c0d9d24 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 _0x6d11=['lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','apply','reject','then','destroy','stack','name','send','index','map','WhatsappApplication','rawAttributes','key','model','query','keys','filters','intersection','attributes','length','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','show','params','fields','catch','create','body','find','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra'];(function(_0x110305,_0x9907dc){var _0x27d8b4=function(_0x4bf26a){while(--_0x4bf26a){_0x110305['push'](_0x110305['shift']());}};_0x27d8b4(++_0x9907dc);}(_0x6d11,0xbf));var _0x16d1=function(_0x80e6b6,_0x480dc8){_0x80e6b6=_0x80e6b6-0x0;var _0x402f71=_0x6d11[_0x80e6b6];return _0x402f71;};'use strict';var emlformat=require(_0x16d1('0x0'));var rimraf=require(_0x16d1('0x1'));var zipdir=require(_0x16d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x16d1('0x3'));var moment=require('moment');var BPromise=require(_0x16d1('0x4'));var Mustache=require(_0x16d1('0x5'));var util=require('util');var path=require('path');var sox=require(_0x16d1('0x6'));var csv=require(_0x16d1('0x7'));var ejs=require(_0x16d1('0x8'));var fs=require('fs');var fs_extra=require(_0x16d1('0x9'));var _=require(_0x16d1('0xa'));var squel=require(_0x16d1('0xb'));var crypto=require(_0x16d1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x16d1('0xd'));var Papa=require(_0x16d1('0xe'));var Redis=require(_0x16d1('0xf'));var authService=require(_0x16d1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x16d1('0x11'));var hardwareService=require(_0x16d1('0x12'));var logger=require(_0x16d1('0x13'))(_0x16d1('0x14'));var utils=require(_0x16d1('0x15'));var config=require(_0x16d1('0x16'));var licenseUtil=require(_0x16d1('0x17'));var db=require(_0x16d1('0x18'))['db'];function respondWithStatusCode(_0x4de260,_0x32fa68){_0x32fa68=_0x32fa68||0xcc;return function(_0x2e71fa){if(_0x2e71fa){return _0x4de260[_0x16d1('0x19')](_0x32fa68);}return _0x4de260[_0x16d1('0x1a')](_0x32fa68)[_0x16d1('0x1b')]();};}function respondWithResult(_0x5a1429,_0xc034b7){_0xc034b7=_0xc034b7||0xc8;return function(_0x1b71d3){if(_0x1b71d3){return _0x5a1429[_0x16d1('0x1a')](_0xc034b7)[_0x16d1('0x1c')](_0x1b71d3);}};}function respondWithFilteredResult(_0x29ebba,_0x173e16){return function(_0x2d7e8a){if(_0x2d7e8a){var _0x4ee46c=typeof _0x173e16[_0x16d1('0x1d')]===_0x16d1('0x1e')&&typeof _0x173e16['limit']==='undefined';var _0x1a9ec8=_0x2d7e8a['count'];var _0x46a25e=_0x4ee46c?0x0:_0x173e16['offset'];var _0x1da1b8=_0x4ee46c?_0x2d7e8a['count']:_0x173e16[_0x16d1('0x1d')]+_0x173e16[_0x16d1('0x1f')];var _0x48cd70;if(_0x1da1b8>=_0x1a9ec8){_0x1da1b8=_0x1a9ec8;_0x48cd70=0xc8;}else{_0x48cd70=0xce;}_0x29ebba['status'](_0x48cd70);return _0x29ebba['set']('Content-Range',_0x46a25e+'-'+_0x1da1b8+'/'+_0x1a9ec8)[_0x16d1('0x1c')](_0x2d7e8a);}return null;};}function patchUpdates(_0x55a0e0){return function(_0x34b88f){try{jsonpatch[_0x16d1('0x20')](_0x34b88f,_0x55a0e0,!![]);}catch(_0x1f6add){return BPromise[_0x16d1('0x21')](_0x1f6add);}return _0x34b88f['save']();};}function saveUpdates(_0x2c7825,_0x58a03b){return function(_0x2a897d){if(_0x2a897d){return _0x2a897d['update'](_0x2c7825)[_0x16d1('0x22')](function(_0x8c7266){return _0x8c7266;});}return null;};}function removeEntity(_0x17e038,_0x47cad4){return function(_0x215c23){if(_0x215c23){return _0x215c23[_0x16d1('0x23')]()[_0x16d1('0x22')](function(){_0x17e038[_0x16d1('0x1a')](0xcc)[_0x16d1('0x1b')]();});}};}function handleEntityNotFound(_0x335c24,_0x4b2b5c){return function(_0x15203b){if(!_0x15203b){_0x335c24[_0x16d1('0x19')](0x194);}return _0x15203b;};}function handleError(_0x262f89,_0x346b69){_0x346b69=_0x346b69||0x1f4;return function(_0x2b8403){logger['error'](_0x2b8403[_0x16d1('0x24')]);if(_0x2b8403[_0x16d1('0x25')]){delete _0x2b8403[_0x16d1('0x25')];}_0x262f89['status'](_0x346b69)[_0x16d1('0x26')](_0x2b8403);};}exports[_0x16d1('0x27')]=function(_0x364bf7,_0x22e5b3){var _0x6396fc={},_0x462e5b={},_0x1dd574={'count':0x0,'rows':[]};var _0x562908=_[_0x16d1('0x28')](db[_0x16d1('0x29')][_0x16d1('0x2a')],function(_0x30cd8f){return{'name':_0x30cd8f['fieldName'],'type':_0x30cd8f['type'][_0x16d1('0x2b')]};});_0x462e5b[_0x16d1('0x2c')]=_[_0x16d1('0x28')](_0x562908,_0x16d1('0x25'));_0x462e5b[_0x16d1('0x2d')]=_[_0x16d1('0x2e')](_0x364bf7[_0x16d1('0x2d')]);_0x462e5b[_0x16d1('0x2f')]=_[_0x16d1('0x30')](_0x462e5b[_0x16d1('0x2c')],_0x462e5b[_0x16d1('0x2d')]);_0x6396fc[_0x16d1('0x31')]=_[_0x16d1('0x30')](_0x462e5b[_0x16d1('0x2c')],qs['fields'](_0x364bf7[_0x16d1('0x2d')]['fields']));_0x6396fc[_0x16d1('0x31')]=_0x6396fc[_0x16d1('0x31')][_0x16d1('0x32')]?_0x6396fc[_0x16d1('0x31')]:_0x462e5b[_0x16d1('0x2c')];if(!_0x364bf7[_0x16d1('0x2d')]['hasOwnProperty']('nolimit')){_0x6396fc['limit']=qs[_0x16d1('0x1f')](_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x1f')]);_0x6396fc[_0x16d1('0x1d')]=qs['offset'](_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x1d')]);}_0x6396fc['order']=qs['sort'](_0x364bf7['query'][_0x16d1('0x33')]);_0x6396fc[_0x16d1('0x34')]=qs[_0x16d1('0x2f')](_['pick'](_0x364bf7[_0x16d1('0x2d')],_0x462e5b[_0x16d1('0x2f')]),_0x562908);if(_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x35')]){_0x6396fc[_0x16d1('0x34')]=_[_0x16d1('0x36')](_0x6396fc[_0x16d1('0x34')],{'$or':_['map'](_0x562908,function(_0x50267b){if(_0x50267b['type']!==_0x16d1('0x37')){var _0x2306d3={};_0x2306d3[_0x50267b[_0x16d1('0x25')]]={'$like':'%'+_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x35')]+'%'};return _0x2306d3;}})});}_0x6396fc=_[_0x16d1('0x36')]({},_0x6396fc,_0x364bf7[_0x16d1('0x38')]);var _0x369b1c={'where':_0x6396fc['where']};return db[_0x16d1('0x29')]['count'](_0x369b1c)['then'](function(_0x352c5b){_0x1dd574[_0x16d1('0x39')]=_0x352c5b;if(_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x3a')]){_0x6396fc[_0x16d1('0x3b')]=[{'all':!![]}];}return db[_0x16d1('0x29')]['findAll'](_0x6396fc);})[_0x16d1('0x22')](function(_0x525212){_0x1dd574['rows']=_0x525212;return _0x1dd574;})['then'](respondWithFilteredResult(_0x22e5b3,_0x6396fc))['catch'](handleError(_0x22e5b3,null));};exports[_0x16d1('0x3c')]=function(_0x168e14,_0x24038b){var _0x1eb761={'raw':!![],'where':{'id':_0x168e14[_0x16d1('0x3d')]['id']}},_0x53de06={};_0x53de06['model']=_[_0x16d1('0x2e')](db[_0x16d1('0x29')][_0x16d1('0x2a')]);_0x53de06[_0x16d1('0x2d')]=_[_0x16d1('0x2e')](_0x168e14[_0x16d1('0x2d')]);_0x53de06[_0x16d1('0x2f')]=_[_0x16d1('0x30')](_0x53de06[_0x16d1('0x2c')],_0x53de06[_0x16d1('0x2d')]);_0x1eb761[_0x16d1('0x31')]=_[_0x16d1('0x30')](_0x53de06[_0x16d1('0x2c')],qs[_0x16d1('0x3e')](_0x168e14[_0x16d1('0x2d')]['fields']));_0x1eb761['attributes']=_0x1eb761[_0x16d1('0x31')][_0x16d1('0x32')]?_0x1eb761[_0x16d1('0x31')]:_0x53de06[_0x16d1('0x2c')];if(_0x168e14[_0x16d1('0x2d')][_0x16d1('0x3a')]){_0x1eb761['include']=[{'all':!![]}];}_0x1eb761=_[_0x16d1('0x36')]({},_0x1eb761,_0x168e14[_0x16d1('0x38')]);return db[_0x16d1('0x29')]['find'](_0x1eb761)['then'](handleEntityNotFound(_0x24038b,null))[_0x16d1('0x22')](respondWithResult(_0x24038b,null))[_0x16d1('0x3f')](handleError(_0x24038b,null));};exports['create']=function(_0x1cc137,_0x583151){return db[_0x16d1('0x29')][_0x16d1('0x40')](_0x1cc137[_0x16d1('0x41')],{})[_0x16d1('0x22')](respondWithResult(_0x583151,0xc9))['catch'](handleError(_0x583151,null));};exports['update']=function(_0x1d92cd,_0x8bb0c1){if(_0x1d92cd['body']['id']){delete _0x1d92cd[_0x16d1('0x41')]['id'];}return db[_0x16d1('0x29')][_0x16d1('0x42')]({'where':{'id':_0x1d92cd[_0x16d1('0x3d')]['id']}})[_0x16d1('0x22')](handleEntityNotFound(_0x8bb0c1,null))['then'](saveUpdates(_0x1d92cd[_0x16d1('0x41')],null))['then'](respondWithResult(_0x8bb0c1,null))[_0x16d1('0x3f')](handleError(_0x8bb0c1,null));};exports[_0x16d1('0x23')]=function(_0x5d384c,_0x413acd){return db[_0x16d1('0x29')][_0x16d1('0x42')]({'where':{'id':_0x5d384c[_0x16d1('0x3d')]['id']}})['then'](handleEntityNotFound(_0x413acd,null))['then'](removeEntity(_0x413acd,null))['catch'](handleError(_0x413acd,null));}; \ No newline at end of file +var _0x8f1a=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','send','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x378fba,_0x32f731){var _0x6720c5=function(_0x48823e){while(--_0x48823e){_0x378fba['push'](_0x378fba['shift']());}};_0x6720c5(++_0x32f731);}(_0x8f1a,0xcd));var _0xa8f1=function(_0x44360b,_0x1cf437){_0x44360b=_0x44360b-0x0;var _0x51374a=_0x8f1a[_0x44360b];return _0x51374a;};'use strict';var emlformat=require(_0xa8f1('0x0'));var rimraf=require(_0xa8f1('0x1'));var zipdir=require(_0xa8f1('0x2'));var jsonpatch=require(_0xa8f1('0x3'));var rp=require(_0xa8f1('0x4'));var moment=require(_0xa8f1('0x5'));var BPromise=require(_0xa8f1('0x6'));var Mustache=require(_0xa8f1('0x7'));var util=require('util');var path=require('path');var sox=require(_0xa8f1('0x8'));var csv=require('to-csv');var ejs=require(_0xa8f1('0x9'));var fs=require('fs');var fs_extra=require(_0xa8f1('0xa'));var _=require('lodash');var squel=require(_0xa8f1('0xb'));var crypto=require(_0xa8f1('0xc'));var jsforce=require(_0xa8f1('0xd'));var deskjs=require(_0xa8f1('0xe'));var toCsv=require(_0xa8f1('0xf'));var querystring=require(_0xa8f1('0x10'));var Papa=require(_0xa8f1('0x11'));var Redis=require(_0xa8f1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa8f1('0x13'));var as=require(_0xa8f1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa8f1('0x15'))('api');var utils=require(_0xa8f1('0x16'));var config=require(_0xa8f1('0x17'));var licenseUtil=require(_0xa8f1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33e666,_0x52f479){_0x52f479=_0x52f479||0xcc;return function(_0x464b7a){if(_0x464b7a){return _0x33e666[_0xa8f1('0x19')](_0x52f479);}return _0x33e666[_0xa8f1('0x1a')](_0x52f479)['end']();};}function respondWithResult(_0xd59dab,_0x55f245){_0x55f245=_0x55f245||0xc8;return function(_0x20c6af){if(_0x20c6af){return _0xd59dab[_0xa8f1('0x1a')](_0x55f245)['json'](_0x20c6af);}};}function respondWithFilteredResult(_0x4b83de,_0x150de1){return function(_0x375af3){if(_0x375af3){var _0x2a496d=typeof _0x150de1[_0xa8f1('0x1b')]===_0xa8f1('0x1c')&&typeof _0x150de1[_0xa8f1('0x1d')]===_0xa8f1('0x1c');var _0x1a840a=_0x375af3[_0xa8f1('0x1e')];var _0x124917=_0x2a496d?0x0:_0x150de1[_0xa8f1('0x1b')];var _0x2ea505=_0x2a496d?_0x375af3[_0xa8f1('0x1e')]:_0x150de1[_0xa8f1('0x1b')]+_0x150de1['limit'];var _0x57b963;if(_0x2ea505>=_0x1a840a){_0x2ea505=_0x1a840a;_0x57b963=0xc8;}else{_0x57b963=0xce;}_0x4b83de[_0xa8f1('0x1a')](_0x57b963);return _0x4b83de[_0xa8f1('0x1f')](_0xa8f1('0x20'),_0x124917+'-'+_0x2ea505+'/'+_0x1a840a)['json'](_0x375af3);}return null;};}function patchUpdates(_0x3abcab){return function(_0x38b687){try{jsonpatch[_0xa8f1('0x21')](_0x38b687,_0x3abcab,!![]);}catch(_0x31eba8){return BPromise[_0xa8f1('0x22')](_0x31eba8);}return _0x38b687['save']();};}function saveUpdates(_0x200f7c,_0x2a3c10){return function(_0x4d905c){if(_0x4d905c){return _0x4d905c[_0xa8f1('0x23')](_0x200f7c)[_0xa8f1('0x24')](function(_0xa960e4){return _0xa960e4;});}return null;};}function removeEntity(_0x12cb8f,_0x2306ec){return function(_0x2f764d){if(_0x2f764d){return _0x2f764d[_0xa8f1('0x25')]()[_0xa8f1('0x24')](function(){_0x12cb8f[_0xa8f1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3966b6,_0x11f825){return function(_0xb6019a){if(!_0xb6019a){_0x3966b6[_0xa8f1('0x19')](0x194);}return _0xb6019a;};}function handleError(_0x1ecc3e,_0x59a75f){_0x59a75f=_0x59a75f||0x1f4;return function(_0x3eda99){logger[_0xa8f1('0x26')](_0x3eda99['stack']);if(_0x3eda99['name']){delete _0x3eda99['name'];}_0x1ecc3e[_0xa8f1('0x1a')](_0x59a75f)[_0xa8f1('0x27')](_0x3eda99);};}exports['index']=function(_0x584151,_0x559f3b){var _0x274277={},_0x50b089={},_0x3a1923={'count':0x0,'rows':[]};var _0x12eafe=_[_0xa8f1('0x28')](db[_0xa8f1('0x29')][_0xa8f1('0x2a')],function(_0x2bb524){return{'name':_0x2bb524[_0xa8f1('0x2b')],'type':_0x2bb524[_0xa8f1('0x2c')][_0xa8f1('0x2d')]};});_0x50b089[_0xa8f1('0x2e')]=_['map'](_0x12eafe,'name');_0x50b089[_0xa8f1('0x2f')]=_[_0xa8f1('0x30')](_0x584151[_0xa8f1('0x2f')]);_0x50b089[_0xa8f1('0x31')]=_[_0xa8f1('0x32')](_0x50b089[_0xa8f1('0x2e')],_0x50b089[_0xa8f1('0x2f')]);_0x274277[_0xa8f1('0x33')]=_[_0xa8f1('0x32')](_0x50b089['model'],qs['fields'](_0x584151['query'][_0xa8f1('0x34')]));_0x274277[_0xa8f1('0x33')]=_0x274277[_0xa8f1('0x33')][_0xa8f1('0x35')]?_0x274277[_0xa8f1('0x33')]:_0x50b089['model'];if(!_0x584151['query'][_0xa8f1('0x36')](_0xa8f1('0x37'))){_0x274277[_0xa8f1('0x1d')]=qs[_0xa8f1('0x1d')](_0x584151[_0xa8f1('0x2f')]['limit']);_0x274277[_0xa8f1('0x1b')]=qs[_0xa8f1('0x1b')](_0x584151[_0xa8f1('0x2f')][_0xa8f1('0x1b')]);}_0x274277[_0xa8f1('0x38')]=qs['sort'](_0x584151[_0xa8f1('0x2f')][_0xa8f1('0x39')]);_0x274277[_0xa8f1('0x3a')]=qs[_0xa8f1('0x31')](_[_0xa8f1('0x3b')](_0x584151[_0xa8f1('0x2f')],_0x50b089['filters']),_0x12eafe);if(_0x584151[_0xa8f1('0x2f')][_0xa8f1('0x3c')]){_0x274277['where']=_[_0xa8f1('0x3d')](_0x274277['where'],{'$or':_[_0xa8f1('0x28')](_0x12eafe,function(_0x286a02){if(_0x286a02[_0xa8f1('0x2c')]!==_0xa8f1('0x3e')){var _0xbf7724={};_0xbf7724[_0x286a02['name']]={'$like':'%'+_0x584151[_0xa8f1('0x2f')][_0xa8f1('0x3c')]+'%'};return _0xbf7724;}})});}_0x274277=_[_0xa8f1('0x3d')]({},_0x274277,_0x584151['options']);var _0x4fdd95={'where':_0x274277[_0xa8f1('0x3a')]};return db[_0xa8f1('0x29')]['count'](_0x4fdd95)['then'](function(_0x2a94c7){_0x3a1923['count']=_0x2a94c7;if(_0x584151[_0xa8f1('0x2f')][_0xa8f1('0x3f')]){_0x274277[_0xa8f1('0x40')]=[{'all':!![]}];}return db[_0xa8f1('0x29')][_0xa8f1('0x41')](_0x274277);})[_0xa8f1('0x24')](function(_0x50da6e){_0x3a1923[_0xa8f1('0x42')]=_0x50da6e;return _0x3a1923;})[_0xa8f1('0x24')](respondWithFilteredResult(_0x559f3b,_0x274277))[_0xa8f1('0x43')](handleError(_0x559f3b,null));};exports[_0xa8f1('0x44')]=function(_0x441873,_0x3b9912){var _0x3c56d4={'raw':!![],'where':{'id':_0x441873[_0xa8f1('0x45')]['id']}},_0x2c9784={};_0x2c9784[_0xa8f1('0x2e')]=_[_0xa8f1('0x30')](db['WhatsappApplication'][_0xa8f1('0x2a')]);_0x2c9784[_0xa8f1('0x2f')]=_[_0xa8f1('0x30')](_0x441873['query']);_0x2c9784[_0xa8f1('0x31')]=_[_0xa8f1('0x32')](_0x2c9784[_0xa8f1('0x2e')],_0x2c9784['query']);_0x3c56d4[_0xa8f1('0x33')]=_[_0xa8f1('0x32')](_0x2c9784[_0xa8f1('0x2e')],qs[_0xa8f1('0x34')](_0x441873[_0xa8f1('0x2f')][_0xa8f1('0x34')]));_0x3c56d4['attributes']=_0x3c56d4['attributes'][_0xa8f1('0x35')]?_0x3c56d4['attributes']:_0x2c9784['model'];if(_0x441873[_0xa8f1('0x2f')][_0xa8f1('0x3f')]){_0x3c56d4[_0xa8f1('0x40')]=[{'all':!![]}];}_0x3c56d4=_[_0xa8f1('0x3d')]({},_0x3c56d4,_0x441873['options']);return db[_0xa8f1('0x29')][_0xa8f1('0x46')](_0x3c56d4)[_0xa8f1('0x24')](handleEntityNotFound(_0x3b9912,null))[_0xa8f1('0x24')](respondWithResult(_0x3b9912,null))[_0xa8f1('0x43')](handleError(_0x3b9912,null));};exports[_0xa8f1('0x47')]=function(_0x556177,_0x540f1b){return db[_0xa8f1('0x29')][_0xa8f1('0x47')](_0x556177[_0xa8f1('0x48')],{})['then'](respondWithResult(_0x540f1b,0xc9))[_0xa8f1('0x43')](handleError(_0x540f1b,null));};exports[_0xa8f1('0x23')]=function(_0x296adf,_0x5365e4){if(_0x296adf[_0xa8f1('0x48')]['id']){delete _0x296adf[_0xa8f1('0x48')]['id'];}return db[_0xa8f1('0x29')][_0xa8f1('0x46')]({'where':{'id':_0x296adf['params']['id']}})[_0xa8f1('0x24')](handleEntityNotFound(_0x5365e4,null))[_0xa8f1('0x24')](saveUpdates(_0x296adf[_0xa8f1('0x48')],null))[_0xa8f1('0x24')](respondWithResult(_0x5365e4,null))[_0xa8f1('0x43')](handleError(_0x5365e4,null));};exports['destroy']=function(_0x228a00,_0xa60f32){return db[_0xa8f1('0x29')][_0xa8f1('0x46')]({'where':{'id':_0x228a00['params']['id']}})[_0xa8f1('0x24')](handleEntityNotFound(_0xa60f32,null))[_0xa8f1('0x24')](removeEntity(_0xa60f32,null))[_0xa8f1('0x43')](handleError(_0xa60f32,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 127f3a3..354431d 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 _0x8b7c=['path','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x8b7c,0x119));var _0xc8b7=function(_0x24b852,_0x2bad67){_0x24b852=_0x24b852-0x0;var _0x180ad2=_0x8b7c[_0x24b852];return _0x180ad2;};'use strict';var _=require(_0xc8b7('0x0'));var util=require(_0xc8b7('0x1'));var logger=require(_0xc8b7('0x2'))(_0xc8b7('0x3'));var moment=require(_0xc8b7('0x4'));var BPromise=require(_0xc8b7('0x5'));var rp=require(_0xc8b7('0x6'));var fs=require('fs');var path=require(_0xc8b7('0x7'));var rimraf=require('rimraf');var config=require(_0xc8b7('0x8'));var attributes=require(_0xc8b7('0x9'));module[_0xc8b7('0xa')]=function(_0x4a8b93,_0x256c78){return _0x4a8b93[_0xc8b7('0xb')](_0xc8b7('0xc'),attributes,{'tableName':_0xc8b7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc8b7('0xe'),'collate':_0xc8b7('0xf')});}; \ No newline at end of file +var _0xa566=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','define','whatsapp_applications','utf8mb4_unicode_ci','lodash','util'];(function(_0x517ad8,_0x5a5fae){var _0x1a5852=function(_0x2ca953){while(--_0x2ca953){_0x517ad8['push'](_0x517ad8['shift']());}};_0x1a5852(++_0x5a5fae);}(_0xa566,0x1c1));var _0x6a56=function(_0x55dd08,_0x59d2ea){_0x55dd08=_0x55dd08-0x0;var _0x1c740f=_0xa566[_0x55dd08];return _0x1c740f;};'use strict';var _=require(_0x6a56('0x0'));var util=require(_0x6a56('0x1'));var logger=require(_0x6a56('0x2'))('api');var moment=require(_0x6a56('0x3'));var BPromise=require(_0x6a56('0x4'));var rp=require(_0x6a56('0x5'));var fs=require('fs');var path=require(_0x6a56('0x6'));var rimraf=require('rimraf');var config=require(_0x6a56('0x7'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x4c58b0,_0x47ecb8){return _0x4c58b0[_0x6a56('0x8')]('WhatsappApplication',attributes,{'tableName':_0x6a56('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6a56('0xa')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 7a85c64..f5bee93 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 _0x84ab=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x554707,_0x9623b4){var _0x9960af=function(_0x41b914){while(--_0x41b914){_0x554707['push'](_0x554707['shift']());}};_0x9960af(++_0x9623b4);}(_0x84ab,0x12f));var _0xb84a=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0x84ab[_0x246148];return _0x453d94;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc496,_0xd445b5,_0x4fac4d){return new BPromise(function(_0x3e9086,_0x8d9dbe){return client['request'](_0x4dc496,_0x4fac4d)[_0xb84a('0xa')](function(_0x525cb7){logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,_0xb84a('0xd'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0xd445b5,'request\x20sent',JSON[_0xb84a('0xe')](_0x525cb7));if(_0x525cb7[_0xb84a('0xf')]){if(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x10')]===0x1f4){logger[_0xb84a('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x8d9dbe(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x3e9086(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}else{logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,'request\x20sent');_0x3e9086(_0x525cb7[_0xb84a('0x12')][_0xb84a('0x11')]);}})[_0xb84a('0x13')](function(_0x3c0b54){logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x3c0b54);_0x8d9dbe(_0x3c0b54);});});} \ No newline at end of file +var _0x55e0=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x55e0,0xdc));var _0x055e=function(_0x780b79,_0x5792ae){_0x780b79=_0x780b79-0x0;var _0x106331=_0x55e0[_0x780b79];return _0x106331;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4384ff,_0x4a442e,_0x8e7824){return new BPromise(function(_0x3c4cf,_0x376618){return client[_0x055e('0xa')](_0x4384ff,_0x8e7824)[_0x055e('0xb')](function(_0x49540c){logger[_0x055e('0xc')](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));logger[_0x055e('0xf')](_0x055e('0x10'),_0x4a442e,'request\x20sent',JSON['stringify'](_0x49540c));if(_0x49540c[_0x055e('0x11')]){if(_0x49540c['error'][_0x055e('0x12')]===0x1f4){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x376618(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}logger['error'](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x3c4cf(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}else{logger['info'](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));_0x3c4cf(_0x49540c[_0x055e('0x14')]['message']);}})[_0x055e('0x15')](function(_0x2c377c){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x2c377c);_0x376618(_0x2c377c);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 784ba36..c80b6d0 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 _0xc1c6=['/describe','isAuthenticated','describe','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x590b4e,_0x242398){var _0x19d71f=function(_0x3681c6){while(--_0x3681c6){_0x590b4e['push'](_0x590b4e['shift']());}};_0x19d71f(++_0x242398);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x29906b,_0x4451d4){_0x29906b=_0x29906b-0x0;var _0x100f01=_0xc1c6[_0x29906b];return _0x100f01;};'use strict';var multer=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var path=require(_0x6c1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c1c('0x3'));var router=express['Router']();var fs_extra=require(_0x6c1c('0x4'));var auth=require(_0x6c1c('0x5'));var interaction=require(_0x6c1c('0x6'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x6c1c('0x7')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0x8')]);router['get'](_0x6c1c('0x9'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xb')]);router[_0x6c1c('0x7')]('/:id',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xc')]);router['get'](_0x6c1c('0xd'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xe')]);router[_0x6c1c('0x7')]('/:id/download',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xf')]);router[_0x6c1c('0x10')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0x11')]);router[_0x6c1c('0x10')](_0x6c1c('0xd'),auth['isAuthenticated'](),controller[_0x6c1c('0x12')]);router['post'](_0x6c1c('0x13'),auth[_0x6c1c('0xa')](),interaction[_0x6c1c('0x14')](_0x6c1c('0x15'),_0x6c1c('0x16')),controller[_0x6c1c('0x17')]);router[_0x6c1c('0x18')](_0x6c1c('0x19'),auth[_0x6c1c('0xa')](),interaction['tracked'](_0x6c1c('0x15'),_0x6c1c('0x1a')),controller['update']);router[_0x6c1c('0x1b')](_0x6c1c('0x19'),auth['isAuthenticated'](),interaction[_0x6c1c('0x14')]('whatsapp',_0x6c1c('0x1c')),controller[_0x6c1c('0x1d')]);router['delete'](_0x6c1c('0x13'),auth['isAuthenticated'](),controller[_0x6c1c('0x1e')]);module[_0x6c1c('0x1f')]=router; \ No newline at end of file +var _0x1261=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','index','get','isAuthenticated','describe','/:id','/:id/messages','download','create','post','addMessage','/:id/tags','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1b361a,_0x3567b0){var _0x41ca68=function(_0x5890bc){while(--_0x5890bc){_0x1b361a['push'](_0x1b361a['shift']());}};_0x41ca68(++_0x3567b0);}(_0x1261,0x144));var _0x1126=function(_0x51c39f,_0x5bfb0b){_0x51c39f=_0x51c39f-0x0;var _0x274221=_0x1261[_0x51c39f];return _0x274221;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/describe',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['show']);router[_0x1126('0xb')](_0x1126('0xf'),auth[_0x1126('0xc')](),controller['getMessages']);router[_0x1126('0xb')]('/:id/download',auth['isAuthenticated'](),controller[_0x1126('0x10')]);router['post']('/',auth[_0x1126('0xc')](),controller[_0x1126('0x11')]);router[_0x1126('0x12')](_0x1126('0xf'),auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);router[_0x1126('0x12')](_0x1126('0x14'),auth[_0x1126('0xc')](),interaction['tracked']('whatsapp',_0x1126('0x15')),controller[_0x1126('0x16')]);router[_0x1126('0x17')]('/:id',auth[_0x1126('0xc')](),interaction['tracked'](_0x1126('0x18'),_0x1126('0x19')),controller[_0x1126('0x1a')]);router['delete'](_0x1126('0xe'),auth[_0x1126('0xc')](),interaction['tracked']('whatsapp',_0x1126('0x1b')),controller[_0x1126('0x1c')]);router['delete']('/:id/tags',auth[_0x1126('0xc')](),controller['removeTags']);module[_0x1126('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 41a1aa9..c32b096 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 _0x07a2=['STRING','ENUM','out','INTEGER','sequelize','moment','BOOLEAN','DATE'];(function(_0x349047,_0xbba641){var _0x45e336=function(_0x6e783a){while(--_0x6e783a){_0x349047['push'](_0x349047['shift']());}};_0x45e336(++_0xbba641);}(_0x07a2,0x12c));var _0x207a=function(_0x586c70,_0x4a8cb3){_0x586c70=_0x586c70-0x0;var _0x26db79=_0x07a2[_0x586c70];return _0x26db79;};'use strict';var Sequelize=require(_0x207a('0x0'));var moment=require(_0x207a('0x1'));module['exports']={'closed':{'type':Sequelize[_0x207a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x207a('0x3')]},'disposition':{'type':Sequelize[_0x207a('0x4')]},'secondDisposition':{'type':Sequelize[_0x207a('0x4')]},'thirdDisposition':{'type':Sequelize[_0x207a('0x4')]},'note':{'type':Sequelize[_0x207a('0x4')]},'phone':{'type':Sequelize[_0x207a('0x4')]},'read1stAt':{'type':Sequelize[_0x207a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x207a('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x207a('0x5')]('in',_0x207a('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x207a('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x207a('0x7')]}}; \ No newline at end of file +var _0xf08c=['DATE','STRING','ENUM','out','BOOLEAN','sequelize','moment','exports'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xf08c,0xb5));var _0xcf08=function(_0x1a224b,_0x3db1d8){_0x1a224b=_0x1a224b-0x0;var _0x355c37=_0xf08c[_0x1a224b];return _0x355c37;};'use strict';var Sequelize=require(_0xcf08('0x0'));var moment=require(_0xcf08('0x1'));module[_0xcf08('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcf08('0x3')]},'disposition':{'type':Sequelize[_0xcf08('0x4')]},'secondDisposition':{'type':Sequelize[_0xcf08('0x4')]},'thirdDisposition':{'type':Sequelize[_0xcf08('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xcf08('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xcf08('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xcf08('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xcf08('0x5')]('in',_0xcf08('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xcf08('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 44940e2..00432bd 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 _0x68fd=['localhost','socket.io-emitter','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','destroy','then','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','findAll','whatsapp','user','show','model','query','keys','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','create','body','update','params','describe','addMessage','WhatsappMessage','omit','ids','findOne','filters','hasOwnProperty','nolimit','order','sort','pick','where','WhatsappInteractionId','filter','$gte','split','format','rows','addTags','spread','color','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','attachments','Attachment','direction','read','WhatsappAccount','Owner','fullname','get','Whatsapp','Account','createdAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','secret','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','rimraf','moment','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults'];(function(_0x596adf,_0x41bcde){var _0x5b2036=function(_0xbfa23){while(--_0xbfa23){_0x596adf['push'](_0x596adf['shift']());}};_0x5b2036(++_0x41bcde);}(_0x68fd,0x1e9));var _0xd68f=function(_0x3624c3,_0x4f182f){_0x3624c3=_0x3624c3-0x0;var _0x2da881=_0x68fd[_0x3624c3];return _0x2da881;};'use strict';var rimraf=require(_0xd68f('0x0'));var zipdir=require('zip-dir');var moment=require(_0xd68f('0x1'));var BPromise=require(_0xd68f('0x2'));var util=require('util');var path=require(_0xd68f('0x3'));var ejs=require(_0xd68f('0x4'));var fs=require('fs');var _=require(_0xd68f('0x5'));var Redis=require(_0xd68f('0x6'));var interaction=require(_0xd68f('0x7'));var qs=require(_0xd68f('0x8'));var pdf=require(_0xd68f('0x9'));var logger=require(_0xd68f('0xa'))(_0xd68f('0xb'));var config=require('../../config/environment');var db=require(_0xd68f('0xc'))['db'];config[_0xd68f('0xd')]=_[_0xd68f('0xe')](config[_0xd68f('0xd')],{'host':_0xd68f('0xf'),'port':0x18eb});var socket=require(_0xd68f('0x10'))(new Redis(config[_0xd68f('0xd')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x1c397a,_0x59ac71){_0x59ac71=_0x59ac71||0xcc;return function(_0x114bda){if(_0x114bda){return _0x1c397a[_0xd68f('0x11')](_0x59ac71);}return _0x1c397a[_0xd68f('0x12')](_0x59ac71)[_0xd68f('0x13')]();};}function respondWithResult(_0x2e45b8,_0x3099e7){_0x3099e7=_0x3099e7||0xc8;return function(_0x1943e8){if(_0x1943e8){return _0x2e45b8['status'](_0x3099e7)['json'](_0x1943e8);}};}function respondWithFilteredResult(_0x4b0be6,_0x5199bd){return function(_0xe53f3a){if(_0xe53f3a){var _0x305c19=typeof _0x5199bd['offset']===_0xd68f('0x14')&&typeof _0x5199bd[_0xd68f('0x15')]===_0xd68f('0x14');var _0x36441f=_0xe53f3a[_0xd68f('0x16')];var _0x9a7fc6=_0x305c19?0x0:_0x5199bd[_0xd68f('0x17')];var _0x53aed0=_0x305c19?_0xe53f3a[_0xd68f('0x16')]:_0x5199bd['offset']+_0x5199bd['limit'];var _0x8078d4;if(_0x53aed0>=_0x36441f){_0x53aed0=_0x36441f;_0x8078d4=0xc8;}else{_0x8078d4=0xce;}_0x4b0be6[_0xd68f('0x12')](_0x8078d4);return _0x4b0be6[_0xd68f('0x18')](_0xd68f('0x19'),_0x9a7fc6+'-'+_0x53aed0+'/'+_0x36441f)[_0xd68f('0x1a')](_0xe53f3a);}return null;};}function saveUpdates(_0xb01ed){return function(_0xa09f23){if(_0xa09f23){return _0xa09f23['update'](_0xb01ed)['then'](function(_0x14435f){return _0x14435f;});}return null;};}function removeEntity(_0x22be19){return function(_0x3722da){if(_0x3722da){return _0x3722da[_0xd68f('0x1b')]()[_0xd68f('0x1c')](function(){_0x22be19['status'](0xcc)[_0xd68f('0x13')]();});}};}function handleEntityNotFound(_0x32c45d){return function(_0x3fbc0b){if(!_0x3fbc0b){_0x32c45d['sendStatus'](0x194);}return _0x3fbc0b;};}function handleError(_0x464238,_0x1379e2){_0x1379e2=_0x1379e2||0x1f4;return function(_0xeba444){logger['error'](_0xeba444['stack']);if(_0xeba444[_0xd68f('0x1d')]){delete _0xeba444['name'];}_0x464238['status'](_0x1379e2)[_0xd68f('0x1e')](_0xeba444);};}exports[_0xd68f('0x1f')]=function(_0xde6c97,_0x3f11f9){var _0x4595bf={};var _0x434fde=_[_0xd68f('0x20')](db[_0xd68f('0x21')][_0xd68f('0x22')],function(_0x2d2df4){return{'name':_0x2d2df4[_0xd68f('0x23')],'type':_0x2d2df4[_0xd68f('0x24')][_0xd68f('0x25')]};});_0x4595bf=qs['getOptions'](_0x434fde,_0xde6c97);return interaction[_0xd68f('0x26')](_0xd68f('0x27'),_0xde6c97['query'],_0xde6c97[_0xd68f('0x28')],_0x4595bf,_0x434fde)['then'](respondWithFilteredResult(_0x3f11f9,_0x4595bf))['catch'](handleError(_0x3f11f9,null));};exports[_0xd68f('0x29')]=function(_0x42f8d2,_0x1eaebc){var _0x52a2dc={'raw':![],'where':{'id':_0x42f8d2['params']['id']}},_0xfee91c={};_0xfee91c[_0xd68f('0x2a')]=_['keys'](db[_0xd68f('0x21')][_0xd68f('0x22')]);_0xfee91c[_0xd68f('0x2b')]=_[_0xd68f('0x2c')](_0x42f8d2[_0xd68f('0x2b')]);_0xfee91c['filters']=_[_0xd68f('0x2d')](_0xfee91c['model'],_0xfee91c[_0xd68f('0x2b')]);_0x52a2dc['attributes']=_[_0xd68f('0x2d')](_0xfee91c[_0xd68f('0x2a')],qs[_0xd68f('0x2e')](_0x42f8d2[_0xd68f('0x2b')]['fields']));_0x52a2dc[_0xd68f('0x2f')]=_0x52a2dc[_0xd68f('0x2f')][_0xd68f('0x30')]?_0x52a2dc[_0xd68f('0x2f')]:_0xfee91c['model'];if(_0x42f8d2[_0xd68f('0x2b')][_0xd68f('0x31')]){_0x52a2dc[_0xd68f('0x32')]=[{'all':!![]}];}_0x52a2dc=_[_0xd68f('0x33')]({},_0x52a2dc,_0x42f8d2[_0xd68f('0x34')]);return db[_0xd68f('0x21')][_0xd68f('0x35')](_0x52a2dc)[_0xd68f('0x1c')](handleEntityNotFound(_0x1eaebc,null))['then'](respondWithResult(_0x1eaebc,null))[_0xd68f('0x36')](handleError(_0x1eaebc,null));};exports[_0xd68f('0x37')]=function(_0x43e7e4,_0x1cf3ef){return db[_0xd68f('0x21')][_0xd68f('0x37')](_0x43e7e4[_0xd68f('0x38')],{})[_0xd68f('0x1c')](respondWithResult(_0x1cf3ef,0xc9))['catch'](handleError(_0x1cf3ef,null));};exports[_0xd68f('0x39')]=function(_0x1474a0,_0x13f773){if(_0x1474a0[_0xd68f('0x38')]['id']){delete _0x1474a0[_0xd68f('0x38')]['id'];}return db['WhatsappInteraction'][_0xd68f('0x35')]({'where':{'id':_0x1474a0[_0xd68f('0x3a')]['id']}})[_0xd68f('0x1c')](handleEntityNotFound(_0x13f773,null))[_0xd68f('0x1c')](saveUpdates(_0x1474a0[_0xd68f('0x38')],null))[_0xd68f('0x1c')](respondWithResult(_0x13f773,null))[_0xd68f('0x36')](handleError(_0x13f773,null));};exports[_0xd68f('0x1b')]=function(_0x582b38,_0x32ea04){return db[_0xd68f('0x21')][_0xd68f('0x35')]({'where':{'id':_0x582b38[_0xd68f('0x3a')]['id']}})[_0xd68f('0x1c')](handleEntityNotFound(_0x32ea04,null))[_0xd68f('0x1c')](removeEntity(_0x32ea04,null))['catch'](handleError(_0x32ea04,null));};exports[_0xd68f('0x3b')]=function(_0xb89fd3,_0x1e7cac){return db[_0xd68f('0x21')][_0xd68f('0x3b')]()[_0xd68f('0x1c')](respondWithResult(_0x1e7cac,null))['catch'](handleError(_0x1e7cac,null));};exports[_0xd68f('0x3c')]=function(_0x6495c1,_0x5cd711){return db[_0xd68f('0x3d')]['find']({'where':{'id':_0x6495c1['params']['id']}})[_0xd68f('0x1c')](handleEntityNotFound(_0x5cd711,null))[_0xd68f('0x1c')](function(_0x586046){if(_0x586046){return _0x586046[_0xd68f('0x3c')](_0x6495c1[_0xd68f('0x38')]['ids'],_[_0xd68f('0x3e')](_0x6495c1[_0xd68f('0x38')],[_0xd68f('0x3f'),'id'])||{});}})[_0xd68f('0x1c')](respondWithResult(_0x5cd711,null))['catch'](handleError(_0x5cd711,null));};exports['getMessages']=function(_0x5ab3aa,_0x25bfee){var _0x1a975e={'raw':![],'where':{}};var _0x7c2a84={};var _0x61e58d={'count':0x0,'rows':[]};return db[_0xd68f('0x21')][_0xd68f('0x40')]({'where':{'id':_0x5ab3aa[_0xd68f('0x3a')]['id']}})[_0xd68f('0x1c')](handleEntityNotFound(_0x25bfee,null))[_0xd68f('0x1c')](function(_0x39779){if(_0x39779){_0x7c2a84[_0xd68f('0x2a')]=_['keys'](db['WhatsappMessage'][_0xd68f('0x22')]);_0x7c2a84[_0xd68f('0x2b')]=_[_0xd68f('0x2c')](_0x5ab3aa[_0xd68f('0x2b')]);_0x7c2a84[_0xd68f('0x41')]=_[_0xd68f('0x2d')](_0x7c2a84['model'],_0x7c2a84[_0xd68f('0x2b')]);_0x1a975e[_0xd68f('0x2f')]=_[_0xd68f('0x2d')](_0x7c2a84[_0xd68f('0x2a')],qs[_0xd68f('0x2e')](_0x5ab3aa[_0xd68f('0x2b')]['fields']));_0x1a975e[_0xd68f('0x2f')]=_0x1a975e[_0xd68f('0x2f')][_0xd68f('0x30')]?_0x1a975e[_0xd68f('0x2f')]:_0x7c2a84[_0xd68f('0x2a')];if(!_0x5ab3aa[_0xd68f('0x2b')][_0xd68f('0x42')](_0xd68f('0x43'))){_0x1a975e[_0xd68f('0x15')]=qs['limit'](_0x5ab3aa[_0xd68f('0x2b')][_0xd68f('0x15')]);_0x1a975e[_0xd68f('0x17')]=qs['offset'](_0x5ab3aa[_0xd68f('0x2b')][_0xd68f('0x17')]);}_0x1a975e[_0xd68f('0x44')]=qs[_0xd68f('0x45')](_0x5ab3aa[_0xd68f('0x2b')]['sort']);_0x1a975e['where']=qs['filters'](_[_0xd68f('0x46')](_0x5ab3aa[_0xd68f('0x2b')],_0x7c2a84['filters']));_0x1a975e[_0xd68f('0x47')][_0xd68f('0x48')]=_0x39779['id'];if(_0x5ab3aa[_0xd68f('0x2b')][_0xd68f('0x49')]){_0x1a975e[_0xd68f('0x47')]=_[_0xd68f('0x33')](_0x1a975e[_0xd68f('0x47')],{'$or':_[_0xd68f('0x20')](_0x1a975e[_0xd68f('0x2f')],function(_0x51b954){var _0x28fb40={};_0x28fb40[_0x51b954]={'$like':'%'+_0x5ab3aa[_0xd68f('0x2b')][_0xd68f('0x49')]+'%'};return _0x28fb40;})});}if(_0x5ab3aa[_0xd68f('0x2b')][_0xd68f('0x4a')]){var _0x141e97=_0x5ab3aa[_0xd68f('0x2b')][_0xd68f('0x4a')][_0xd68f('0x4b')](',');var _0x2950b0={};_0x2950b0[_0x141e97[0x0]]={'$gte':moment(_0x141e97[0x1])[_0xd68f('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1a975e['where']=_[_0xd68f('0x33')](_0x1a975e[_0xd68f('0x47')],_0x2950b0);}_0x1a975e=_[_0xd68f('0x33')]({},_0x1a975e,_0x5ab3aa['options']);return db[_0xd68f('0x3d')]['count']({'where':_0x1a975e[_0xd68f('0x47')]})[_0xd68f('0x1c')](function(_0x1e1652){_0x61e58d[_0xd68f('0x16')]=_0x1e1652;if(_0x5ab3aa[_0xd68f('0x2b')][_0xd68f('0x31')]){_0x1a975e[_0xd68f('0x32')]=[{'all':!![]}];}return db[_0xd68f('0x3d')]['findAll'](_0x1a975e);})[_0xd68f('0x1c')](function(_0x1d4566){_0x61e58d[_0xd68f('0x4d')]=_0x1d4566;return _0x61e58d;});}})[_0xd68f('0x1c')](respondWithFilteredResult(_0x25bfee,_0x1a975e))[_0xd68f('0x36')](handleError(_0x25bfee,null));};exports[_0xd68f('0x4e')]=function(_0x358522,_0x4426f4){return db[_0xd68f('0x21')][_0xd68f('0x35')]({'where':{'id':_0x358522[_0xd68f('0x3a')]['id']}})[_0xd68f('0x1c')](handleEntityNotFound(_0x4426f4,null))['then'](function(_0x5a113d){if(_0x5a113d){return _0x5a113d['setTags'](_0x358522[_0xd68f('0x38')]['ids'],_[_0xd68f('0x3e')](_0x358522[_0xd68f('0x38')],['ids','id'])||{})[_0xd68f('0x4f')](function(){return db['Tag'][_0xd68f('0x26')]({'attributes':['id',_0xd68f('0x1d'),_0xd68f('0x50')],'where':{'id':_0x358522['body'][_0xd68f('0x3f')]}});})[_0xd68f('0x1c')](function(_0x54e085){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x358522[_0xd68f('0x3a')]['id']),'tags':_0x54e085||[]});return{'id':Number(_0x358522['params']['id']),'tags':_0x54e085||[]};});}})['then'](respondWithResult(_0x4426f4,null))[_0xd68f('0x36')](handleError(_0x4426f4,null));};exports[_0xd68f('0x51')]=function(_0x10365c,_0xa0c662){return db[_0xd68f('0x21')][_0xd68f('0x35')]({'where':{'id':_0x10365c[_0xd68f('0x3a')]['id']}})[_0xd68f('0x1c')](handleEntityNotFound(_0xa0c662,null))[_0xd68f('0x1c')](function(_0x5cdf4d){if(_0x5cdf4d){return _0x5cdf4d[_0xd68f('0x51')](_0x10365c[_0xd68f('0x2b')][_0xd68f('0x3f')]);}})[_0xd68f('0x1c')](respondWithStatusCode(_0xa0c662,null))[_0xd68f('0x36')](handleError(_0xa0c662,null));};exports[_0xd68f('0x52')]=function(_0x20572d,_0x53c613){var _0x260f46=moment()[_0xd68f('0x53')]()[_0xd68f('0x54')]();var _0x594cff=path[_0xd68f('0x55')](config[_0xd68f('0x56')],_0xd68f('0x57'),_0xd68f('0x58'),_0xd68f('0x59'));var _0x41d2c2=path[_0xd68f('0x55')](config['root'],_0xd68f('0x57'),_0xd68f('0x58'),'attachments');var _0x3e34b8=path[_0xd68f('0x55')](_0x594cff,_0x260f46);var _0xf2b42=util[_0xd68f('0x4c')](_0xd68f('0x5a'),_0x20572d[_0xd68f('0x3a')]['id'],_0x260f46);var _0x4983ef=path[_0xd68f('0x55')](_0x594cff,_0xf2b42);var _0x27718c=[];_0x27718c[_0xd68f('0x5b')]({'model':db[_0xd68f('0x5c')],'as':_0xd68f('0x5c'),'attributes':['id','fullname'],'raw':!![]});_0x27718c['push']({'model':db[_0xd68f('0x5d')],'as':_0xd68f('0x5e'),'attributes':['id',_0xd68f('0x5f'),_0xd68f('0x60')],'raw':!![]});if(_0x20572d[_0xd68f('0x2b')][_0xd68f('0x61')]){_0x27718c[_0xd68f('0x5b')]({'model':db[_0xd68f('0x62')],'as':'Attachment','raw':!![]});}var _0x253203=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0xd68f('0x38'),'createdAt',_0xd68f('0x63'),'secret',_0xd68f('0x64')],'include':_0x27718c}];_0x253203[_0xd68f('0x5b')]({'model':db[_0xd68f('0x65')],'as':'Account','attributes':['id','name']});_0x253203[_0xd68f('0x5b')]({'model':db[_0xd68f('0x5c')],'as':_0xd68f('0x66'),'attributes':['id',_0xd68f('0x67')]});return db['WhatsappInteraction'][_0xd68f('0x35')]({'where':{'id':_0x20572d['params']['id']},'include':_0x253203})['then'](handleEntityNotFound(_0x53c613,null))['then'](function(_0x445b2d){if(_0x445b2d){var _0x352a18=_0x445b2d[_0xd68f('0x68')]({'plain':!![]});fs['mkdirSync'](_0x3e34b8);var _0x25c91e={'channel':_0xd68f('0x69'),'account':_0x352a18[_0xd68f('0x6a')][_0xd68f('0x1d')],'agent':_0x352a18[_0xd68f('0x66')]?_0x352a18['Owner']['fullname']:'N.A.','createdAt':moment(_0x352a18[_0xd68f('0x6b')])[_0xd68f('0x4c')](_0xd68f('0x6c'))[_0xd68f('0x54')](),'closedAt':_0x352a18[_0xd68f('0x6d')]?moment(_0x352a18[_0xd68f('0x6e')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xd68f('0x54')]():'','disposition':_0x352a18['disposition'],'messages':_(_0x352a18['Messages'])[_0xd68f('0x49')]({'secret':![]})[_0xd68f('0x20')](function(_0x126155){if(_0x126155[_0xd68f('0x62')]){var _0x17b7b9=path['join'](_0x41d2c2,_0x126155[_0xd68f('0x62')][_0xd68f('0x6f')]);if(fs[_0xd68f('0x70')](_0x17b7b9)){fs[_0xd68f('0x71')](_0x17b7b9)[_0xd68f('0x72')](fs[_0xd68f('0x73')](path[_0xd68f('0x55')](_0x3e34b8,_0x126155[_0xd68f('0x62')][_0xd68f('0x6f')])));}}return{'date':moment(_0x126155[_0xd68f('0x6b')])[_0xd68f('0x4c')](_0xd68f('0x6c'))[_0xd68f('0x54')](),'sender':_0x126155[_0xd68f('0x63')]===_0xd68f('0x74')?_0x126155[_0xd68f('0x5c')]?_0x126155[_0xd68f('0x5c')][_0xd68f('0x67')]:_0xd68f('0x75'):_0x126155[_0xd68f('0x5e')]['firstName']+(_0x126155['Contact'][_0xd68f('0x60')]?'\x20'+_0x126155[_0xd68f('0x5e')][_0xd68f('0x60')]:''),'body':_0x126155['Attachment']?_0x126155[_0xd68f('0x62')]['basename']:_0x126155['body'],'direction':_0x126155[_0xd68f('0x63')]===_0xd68f('0x74')?'A':'C','secret':_0x126155[_0xd68f('0x76')],'read':_0x126155[_0xd68f('0x64')],'attachment':_0x126155[_0xd68f('0x62')]};})['value']()};return ejs[_0xd68f('0x77')](path['join'](config[_0xd68f('0x56')],_0xd68f('0x57'),_0xd68f('0x78'),_0xd68f('0x79')),{'interaction':_0x25c91e})['then'](function(_0x5606d9){var _0x45657e=path[_0xd68f('0x55')](_0x3e34b8,_0xd68f('0x7a')+_0x352a18['id']+'-'+_0x260f46+_0xd68f('0x7b'));var _0x395a21={'path':_0x45657e,'channel':_0xd68f('0x69'),'interactionId':_0x352a18['id']};return pdf[_0xd68f('0x7c')](_0x5606d9,_0x395a21);})[_0xd68f('0x1c')](function(){return new BPromise(function(_0x1a4607,_0x352029){zipdir(_0x3e34b8,{'saveTo':_0x4983ef},function(_0x420fa4,_0x4e8f4e){if(_0x420fa4)return _0x352029(_0x420fa4);return _0x1a4607(_0x4e8f4e);});})[_0xd68f('0x1c')](function(){return new BPromise(function(_0x128b66,_0x5c411e){rimraf(_0x3e34b8,function(_0x10950d){if(_0x10950d)_0x5c411e(_0x10950d);return _0x128b66();});});})['then'](function(){return _0x53c613[_0xd68f('0x52')](_0x4983ef,_0xf2b42,function(_0x1d5cf4){if(_0x1d5cf4){console['log']('err',_0x1d5cf4);}else{fs[_0xd68f('0x7d')](_0x4983ef);}});});});}else{return _0x53c613[_0xd68f('0x11')](0xc8);}})['catch'](handleError(_0x53c613,null));}; \ No newline at end of file +var _0xa458=['N.A.','closed','closedAt','disposition','existsSync','createReadStream','pipe','basename','out','secret','value','renderFile','views','downloadInteraction.ejs','.pdf','log','err','unlinkSync','rimraf','moment','bluebird','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','offset','limit','count','set','json','update','then','destroy','end','error','stack','name','send','index','map','WhatsappInteraction','type','key','getOptions','findAll','whatsapp','query','user','catch','show','params','rawAttributes','keys','filters','intersection','model','fields','attributes','includeAll','merge','create','body','find','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','length','hasOwnProperty','nolimit','order','sort','where','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','setTags','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','files','tmp','root','server','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','read','WhatsappAccount','Account','fullname','Whatsapp','Owner'];(function(_0x5ec28a,_0x5ebdad){var _0x3c0771=function(_0x8ba3cb){while(--_0x8ba3cb){_0x5ec28a['push'](_0x5ec28a['shift']());}};_0x3c0771(++_0x5ebdad);}(_0xa458,0x114));var _0x8a45=function(_0x131924,_0xb27fac){_0x131924=_0x131924-0x0;var _0x51a92e=_0xa458[_0x131924];return _0x51a92e;};'use strict';var rimraf=require(_0x8a45('0x0'));var zipdir=require('zip-dir');var moment=require(_0x8a45('0x1'));var BPromise=require(_0x8a45('0x2'));var util=require('util');var path=require(_0x8a45('0x3'));var ejs=require(_0x8a45('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x8a45('0x5'));var interaction=require(_0x8a45('0x6'));var qs=require(_0x8a45('0x7'));var pdf=require(_0x8a45('0x8'));var logger=require(_0x8a45('0x9'))(_0x8a45('0xa'));var config=require(_0x8a45('0xb'));var db=require(_0x8a45('0xc'))['db'];config[_0x8a45('0xd')]=_[_0x8a45('0xe')](config[_0x8a45('0xd')],{'host':_0x8a45('0xf'),'port':0x18eb});var socket=require(_0x8a45('0x10'))(new Redis(config[_0x8a45('0xd')]));require('./whatsappInteraction.socket')[_0x8a45('0x11')](socket);function respondWithStatusCode(_0x22a623,_0x30a825){_0x30a825=_0x30a825||0xcc;return function(_0x5a1086){if(_0x5a1086){return _0x22a623[_0x8a45('0x12')](_0x30a825);}return _0x22a623['status'](_0x30a825)['end']();};}function respondWithResult(_0x323b8b,_0x1e0237){_0x1e0237=_0x1e0237||0xc8;return function(_0x4f28a1){if(_0x4f28a1){return _0x323b8b[_0x8a45('0x13')](_0x1e0237)['json'](_0x4f28a1);}};}function respondWithFilteredResult(_0x470443,_0x27b78e){return function(_0x9e4bc9){if(_0x9e4bc9){var _0x240e11=typeof _0x27b78e[_0x8a45('0x14')]==='undefined'&&typeof _0x27b78e[_0x8a45('0x15')]==='undefined';var _0x21fed0=_0x9e4bc9[_0x8a45('0x16')];var _0x4fba28=_0x240e11?0x0:_0x27b78e[_0x8a45('0x14')];var _0x31f228=_0x240e11?_0x9e4bc9['count']:_0x27b78e[_0x8a45('0x14')]+_0x27b78e[_0x8a45('0x15')];var _0x2202c7;if(_0x31f228>=_0x21fed0){_0x31f228=_0x21fed0;_0x2202c7=0xc8;}else{_0x2202c7=0xce;}_0x470443[_0x8a45('0x13')](_0x2202c7);return _0x470443[_0x8a45('0x17')]('Content-Range',_0x4fba28+'-'+_0x31f228+'/'+_0x21fed0)[_0x8a45('0x18')](_0x9e4bc9);}return null;};}function saveUpdates(_0x579d20){return function(_0x1f549b){if(_0x1f549b){return _0x1f549b[_0x8a45('0x19')](_0x579d20)[_0x8a45('0x1a')](function(_0xe72478){return _0xe72478;});}return null;};}function removeEntity(_0x5dc85c){return function(_0x3ad6c0){if(_0x3ad6c0){return _0x3ad6c0[_0x8a45('0x1b')]()[_0x8a45('0x1a')](function(){_0x5dc85c['status'](0xcc)[_0x8a45('0x1c')]();});}};}function handleEntityNotFound(_0x1fe27b){return function(_0x141331){if(!_0x141331){_0x1fe27b[_0x8a45('0x12')](0x194);}return _0x141331;};}function handleError(_0x58c342,_0x396b3e){_0x396b3e=_0x396b3e||0x1f4;return function(_0x11d6b9){logger[_0x8a45('0x1d')](_0x11d6b9[_0x8a45('0x1e')]);if(_0x11d6b9[_0x8a45('0x1f')]){delete _0x11d6b9[_0x8a45('0x1f')];}_0x58c342[_0x8a45('0x13')](_0x396b3e)[_0x8a45('0x20')](_0x11d6b9);};}exports[_0x8a45('0x21')]=function(_0x4e6a66,_0x319dd7){var _0x53f7e0={};var _0xf55255=_[_0x8a45('0x22')](db[_0x8a45('0x23')]['rawAttributes'],function(_0x3e7df2){return{'name':_0x3e7df2['fieldName'],'type':_0x3e7df2[_0x8a45('0x24')][_0x8a45('0x25')]};});_0x53f7e0=qs[_0x8a45('0x26')](_0xf55255,_0x4e6a66);return interaction[_0x8a45('0x27')](_0x8a45('0x28'),_0x4e6a66[_0x8a45('0x29')],_0x4e6a66[_0x8a45('0x2a')],_0x53f7e0,_0xf55255)['then'](respondWithFilteredResult(_0x319dd7,_0x53f7e0))[_0x8a45('0x2b')](handleError(_0x319dd7,null));};exports[_0x8a45('0x2c')]=function(_0x443ab6,_0x5d5c71){var _0x5a311f={'raw':![],'where':{'id':_0x443ab6[_0x8a45('0x2d')]['id']}},_0x1f70e9={};_0x1f70e9['model']=_['keys'](db[_0x8a45('0x23')][_0x8a45('0x2e')]);_0x1f70e9[_0x8a45('0x29')]=_[_0x8a45('0x2f')](_0x443ab6[_0x8a45('0x29')]);_0x1f70e9[_0x8a45('0x30')]=_[_0x8a45('0x31')](_0x1f70e9[_0x8a45('0x32')],_0x1f70e9['query']);_0x5a311f['attributes']=_[_0x8a45('0x31')](_0x1f70e9[_0x8a45('0x32')],qs[_0x8a45('0x33')](_0x443ab6[_0x8a45('0x29')][_0x8a45('0x33')]));_0x5a311f[_0x8a45('0x34')]=_0x5a311f['attributes']['length']?_0x5a311f['attributes']:_0x1f70e9[_0x8a45('0x32')];if(_0x443ab6[_0x8a45('0x29')][_0x8a45('0x35')]){_0x5a311f['include']=[{'all':!![]}];}_0x5a311f=_[_0x8a45('0x36')]({},_0x5a311f,_0x443ab6['options']);return db['WhatsappInteraction']['find'](_0x5a311f)[_0x8a45('0x1a')](handleEntityNotFound(_0x5d5c71,null))['then'](respondWithResult(_0x5d5c71,null))[_0x8a45('0x2b')](handleError(_0x5d5c71,null));};exports[_0x8a45('0x37')]=function(_0x214779,_0x5ab08b){return db[_0x8a45('0x23')][_0x8a45('0x37')](_0x214779[_0x8a45('0x38')],{})[_0x8a45('0x1a')](respondWithResult(_0x5ab08b,0xc9))['catch'](handleError(_0x5ab08b,null));};exports['update']=function(_0x5a780a,_0x27a55b){if(_0x5a780a[_0x8a45('0x38')]['id']){delete _0x5a780a[_0x8a45('0x38')]['id'];}return db[_0x8a45('0x23')][_0x8a45('0x39')]({'where':{'id':_0x5a780a[_0x8a45('0x2d')]['id']}})[_0x8a45('0x1a')](handleEntityNotFound(_0x27a55b,null))['then'](saveUpdates(_0x5a780a['body'],null))[_0x8a45('0x1a')](respondWithResult(_0x27a55b,null))[_0x8a45('0x2b')](handleError(_0x27a55b,null));};exports['destroy']=function(_0x19c946,_0x33ea9c){return db[_0x8a45('0x23')][_0x8a45('0x39')]({'where':{'id':_0x19c946[_0x8a45('0x2d')]['id']}})[_0x8a45('0x1a')](handleEntityNotFound(_0x33ea9c,null))[_0x8a45('0x1a')](removeEntity(_0x33ea9c,null))[_0x8a45('0x2b')](handleError(_0x33ea9c,null));};exports[_0x8a45('0x3a')]=function(_0x4d6b77,_0x439305){return db[_0x8a45('0x23')][_0x8a45('0x3a')]()[_0x8a45('0x1a')](respondWithResult(_0x439305,null))[_0x8a45('0x2b')](handleError(_0x439305,null));};exports[_0x8a45('0x3b')]=function(_0x46f5dd,_0x27d130){return db[_0x8a45('0x3c')]['find']({'where':{'id':_0x46f5dd['params']['id']}})[_0x8a45('0x1a')](handleEntityNotFound(_0x27d130,null))[_0x8a45('0x1a')](function(_0x23bef2){if(_0x23bef2){return _0x23bef2['addMessage'](_0x46f5dd[_0x8a45('0x38')][_0x8a45('0x3d')],_[_0x8a45('0x3e')](_0x46f5dd[_0x8a45('0x38')],[_0x8a45('0x3d'),'id'])||{});}})[_0x8a45('0x1a')](respondWithResult(_0x27d130,null))[_0x8a45('0x2b')](handleError(_0x27d130,null));};exports[_0x8a45('0x3f')]=function(_0x2c390e,_0x3038cd){var _0x31398a={'raw':![],'where':{}};var _0x42d55c={};var _0x4770dd={'count':0x0,'rows':[]};return db[_0x8a45('0x23')][_0x8a45('0x40')]({'where':{'id':_0x2c390e[_0x8a45('0x2d')]['id']}})[_0x8a45('0x1a')](handleEntityNotFound(_0x3038cd,null))['then'](function(_0x2eff5d){if(_0x2eff5d){_0x42d55c['model']=_['keys'](db[_0x8a45('0x3c')][_0x8a45('0x2e')]);_0x42d55c[_0x8a45('0x29')]=_[_0x8a45('0x2f')](_0x2c390e[_0x8a45('0x29')]);_0x42d55c[_0x8a45('0x30')]=_[_0x8a45('0x31')](_0x42d55c[_0x8a45('0x32')],_0x42d55c[_0x8a45('0x29')]);_0x31398a['attributes']=_['intersection'](_0x42d55c[_0x8a45('0x32')],qs['fields'](_0x2c390e[_0x8a45('0x29')][_0x8a45('0x33')]));_0x31398a[_0x8a45('0x34')]=_0x31398a[_0x8a45('0x34')][_0x8a45('0x41')]?_0x31398a[_0x8a45('0x34')]:_0x42d55c['model'];if(!_0x2c390e[_0x8a45('0x29')][_0x8a45('0x42')](_0x8a45('0x43'))){_0x31398a[_0x8a45('0x15')]=qs['limit'](_0x2c390e[_0x8a45('0x29')][_0x8a45('0x15')]);_0x31398a['offset']=qs[_0x8a45('0x14')](_0x2c390e[_0x8a45('0x29')][_0x8a45('0x14')]);}_0x31398a[_0x8a45('0x44')]=qs[_0x8a45('0x45')](_0x2c390e[_0x8a45('0x29')][_0x8a45('0x45')]);_0x31398a['where']=qs[_0x8a45('0x30')](_['pick'](_0x2c390e[_0x8a45('0x29')],_0x42d55c[_0x8a45('0x30')]));_0x31398a[_0x8a45('0x46')][_0x8a45('0x47')]=_0x2eff5d['id'];if(_0x2c390e['query']['filter']){_0x31398a[_0x8a45('0x46')]=_[_0x8a45('0x36')](_0x31398a[_0x8a45('0x46')],{'$or':_[_0x8a45('0x22')](_0x31398a[_0x8a45('0x34')],function(_0xc559b1){var _0x43c460={};_0x43c460[_0xc559b1]={'$like':'%'+_0x2c390e[_0x8a45('0x29')][_0x8a45('0x48')]+'%'};return _0x43c460;})});}if(_0x2c390e[_0x8a45('0x29')][_0x8a45('0x49')]){var _0x5b8b95=_0x2c390e[_0x8a45('0x29')]['$gte'][_0x8a45('0x4a')](',');var _0x4ce3f9={};_0x4ce3f9[_0x5b8b95[0x0]]={'$gte':moment(_0x5b8b95[0x1])[_0x8a45('0x4b')](_0x8a45('0x4c'))};_0x31398a[_0x8a45('0x46')]=_[_0x8a45('0x36')](_0x31398a[_0x8a45('0x46')],_0x4ce3f9);}_0x31398a=_[_0x8a45('0x36')]({},_0x31398a,_0x2c390e['options']);return db[_0x8a45('0x3c')][_0x8a45('0x16')]({'where':_0x31398a[_0x8a45('0x46')]})[_0x8a45('0x1a')](function(_0x55bfaa){_0x4770dd[_0x8a45('0x16')]=_0x55bfaa;if(_0x2c390e[_0x8a45('0x29')]['includeAll']){_0x31398a[_0x8a45('0x4d')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x8a45('0x27')](_0x31398a);})['then'](function(_0x4dac57){_0x4770dd[_0x8a45('0x4e')]=_0x4dac57;return _0x4770dd;});}})[_0x8a45('0x1a')](respondWithFilteredResult(_0x3038cd,_0x31398a))[_0x8a45('0x2b')](handleError(_0x3038cd,null));};exports[_0x8a45('0x4f')]=function(_0x19376c,_0x7ab548){return db[_0x8a45('0x23')][_0x8a45('0x39')]({'where':{'id':_0x19376c[_0x8a45('0x2d')]['id']}})[_0x8a45('0x1a')](handleEntityNotFound(_0x7ab548,null))[_0x8a45('0x1a')](function(_0x187527){if(_0x187527){return _0x187527[_0x8a45('0x50')](_0x19376c['body'][_0x8a45('0x3d')],_[_0x8a45('0x3e')](_0x19376c['body'],[_0x8a45('0x3d'),'id'])||{})['spread'](function(){return db['Tag'][_0x8a45('0x27')]({'attributes':['id','name',_0x8a45('0x51')],'where':{'id':_0x19376c[_0x8a45('0x38')][_0x8a45('0x3d')]}});})[_0x8a45('0x1a')](function(_0x50c615){socket[_0x8a45('0x52')](_0x8a45('0x53'),{'id':Number(_0x19376c['params']['id']),'tags':_0x50c615||[]});return{'id':Number(_0x19376c[_0x8a45('0x2d')]['id']),'tags':_0x50c615||[]};});}})[_0x8a45('0x1a')](respondWithResult(_0x7ab548,null))[_0x8a45('0x2b')](handleError(_0x7ab548,null));};exports[_0x8a45('0x54')]=function(_0x5905c2,_0x2e15ec){return db[_0x8a45('0x23')][_0x8a45('0x39')]({'where':{'id':_0x5905c2[_0x8a45('0x2d')]['id']}})[_0x8a45('0x1a')](handleEntityNotFound(_0x2e15ec,null))[_0x8a45('0x1a')](function(_0x1198c9){if(_0x1198c9){return _0x1198c9[_0x8a45('0x54')](_0x5905c2[_0x8a45('0x29')][_0x8a45('0x3d')]);}})['then'](respondWithStatusCode(_0x2e15ec,null))[_0x8a45('0x2b')](handleError(_0x2e15ec,null));};exports[_0x8a45('0x55')]=function(_0x2c9015,_0x457212){var _0x3fdfca=moment()[_0x8a45('0x56')]()[_0x8a45('0x57')]();var _0x242349=path[_0x8a45('0x58')](config['root'],'server',_0x8a45('0x59'),_0x8a45('0x5a'));var _0xa3f5ce=path[_0x8a45('0x58')](config[_0x8a45('0x5b')],_0x8a45('0x5c'),'files',_0x8a45('0x5d'));var _0x51a2ee=path[_0x8a45('0x58')](_0x242349,_0x3fdfca);var _0x25854a=util['format'](_0x8a45('0x5e'),_0x2c9015['params']['id'],_0x3fdfca);var _0x20d2e1=path[_0x8a45('0x58')](_0x242349,_0x25854a);var _0x5c3ff2=[];_0x5c3ff2[_0x8a45('0x5f')]({'model':db[_0x8a45('0x60')],'as':_0x8a45('0x60'),'attributes':['id','fullname'],'raw':!![]});_0x5c3ff2[_0x8a45('0x5f')]({'model':db[_0x8a45('0x61')],'as':_0x8a45('0x62'),'attributes':['id',_0x8a45('0x63'),_0x8a45('0x64')],'raw':!![]});if(_0x2c9015[_0x8a45('0x29')]['attachments']){_0x5c3ff2['push']({'model':db[_0x8a45('0x65')],'as':_0x8a45('0x65'),'raw':!![]});}var _0x435513=[{'model':db[_0x8a45('0x3c')],'as':_0x8a45('0x66'),'attributes':['id',_0x8a45('0x38'),_0x8a45('0x67'),_0x8a45('0x68'),'secret',_0x8a45('0x69')],'include':_0x5c3ff2}];_0x435513[_0x8a45('0x5f')]({'model':db[_0x8a45('0x6a')],'as':_0x8a45('0x6b'),'attributes':['id',_0x8a45('0x1f')]});_0x435513[_0x8a45('0x5f')]({'model':db[_0x8a45('0x60')],'as':'Owner','attributes':['id',_0x8a45('0x6c')]});return db[_0x8a45('0x23')][_0x8a45('0x39')]({'where':{'id':_0x2c9015['params']['id']},'include':_0x435513})[_0x8a45('0x1a')](handleEntityNotFound(_0x457212,null))[_0x8a45('0x1a')](function(_0x33e66f){if(_0x33e66f){var _0x412fce=_0x33e66f['get']({'plain':!![]});fs['mkdirSync'](_0x51a2ee);var _0x55a714={'channel':_0x8a45('0x6d'),'account':_0x412fce[_0x8a45('0x6b')][_0x8a45('0x1f')],'agent':_0x412fce[_0x8a45('0x6e')]?_0x412fce[_0x8a45('0x6e')][_0x8a45('0x6c')]:_0x8a45('0x6f'),'createdAt':moment(_0x412fce[_0x8a45('0x67')])[_0x8a45('0x4b')](_0x8a45('0x4c'))[_0x8a45('0x57')](),'closedAt':_0x412fce[_0x8a45('0x70')]?moment(_0x412fce[_0x8a45('0x71')])[_0x8a45('0x4b')](_0x8a45('0x4c'))[_0x8a45('0x57')]():'','disposition':_0x412fce[_0x8a45('0x72')],'messages':_(_0x412fce[_0x8a45('0x66')])['filter']({'secret':![]})[_0x8a45('0x22')](function(_0x3524aa){if(_0x3524aa['Attachment']){var _0x4277fe=path[_0x8a45('0x58')](_0xa3f5ce,_0x3524aa['Attachment']['basename']);if(fs[_0x8a45('0x73')](_0x4277fe)){fs[_0x8a45('0x74')](_0x4277fe)[_0x8a45('0x75')](fs['createWriteStream'](path[_0x8a45('0x58')](_0x51a2ee,_0x3524aa[_0x8a45('0x65')][_0x8a45('0x76')])));}}return{'date':moment(_0x3524aa[_0x8a45('0x67')])[_0x8a45('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8a45('0x57')](),'sender':_0x3524aa['direction']===_0x8a45('0x77')?_0x3524aa[_0x8a45('0x60')]?_0x3524aa[_0x8a45('0x60')]['fullname']:'System':_0x3524aa['Contact'][_0x8a45('0x63')]+(_0x3524aa['Contact']['lastName']?'\x20'+_0x3524aa[_0x8a45('0x62')][_0x8a45('0x64')]:''),'body':_0x3524aa[_0x8a45('0x65')]?_0x3524aa[_0x8a45('0x65')]['basename']:_0x3524aa['body'],'direction':_0x3524aa[_0x8a45('0x68')]===_0x8a45('0x77')?'A':'C','secret':_0x3524aa[_0x8a45('0x78')],'read':_0x3524aa['read'],'attachment':_0x3524aa[_0x8a45('0x65')]};})[_0x8a45('0x79')]()};return ejs[_0x8a45('0x7a')](path[_0x8a45('0x58')](config[_0x8a45('0x5b')],_0x8a45('0x5c'),_0x8a45('0x7b'),_0x8a45('0x7c')),{'interaction':_0x55a714})[_0x8a45('0x1a')](function(_0x355717){var _0x3dac42=path[_0x8a45('0x58')](_0x51a2ee,'transcript-'+_0x412fce['id']+'-'+_0x3fdfca+_0x8a45('0x7d'));var _0x2cd108={'path':_0x3dac42,'channel':_0x8a45('0x6d'),'interactionId':_0x412fce['id']};return pdf['createPdfFromHTML'](_0x355717,_0x2cd108);})['then'](function(){return new BPromise(function(_0x5d94c9,_0x18b7c7){zipdir(_0x51a2ee,{'saveTo':_0x20d2e1},function(_0x5c307e,_0x5b60d4){if(_0x5c307e)return _0x18b7c7(_0x5c307e);return _0x5d94c9(_0x5b60d4);});})[_0x8a45('0x1a')](function(){return new BPromise(function(_0x3d7b60,_0x200ac5){rimraf(_0x51a2ee,function(_0x2d8c4c){if(_0x2d8c4c)_0x200ac5(_0x2d8c4c);return _0x3d7b60();});});})[_0x8a45('0x1a')](function(){return _0x457212[_0x8a45('0x55')](_0x20d2e1,_0x25854a,function(_0x3d4134){if(_0x3d4134){console[_0x8a45('0x7e')](_0x8a45('0x7f'),_0x3d4134);}else{fs[_0x8a45('0x80')](_0x20d2e1);}});});});}else{return _0x457212['sendStatus'](0xc8);}})[_0x8a45('0x2b')](handleError(_0x457212,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 847f38d..32e4f64 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 _0xe3d4=['then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','../../mysqldb','WhatsappInteraction','setMaxListeners','save','remove','getUsers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x40cdfa,_0x1cf634){_0x40cdfa=_0x40cdfa-0x0;var _0x2c5e4d=_0xe3d4[_0x40cdfa];return _0x2c5e4d;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x4e3d('0x0'))['db'][_0x4e3d('0x1')];var WhatsappMessage=require(_0x4e3d('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x4e3d('0x2')](0x0);var events={'afterCreate':_0x4e3d('0x3'),'afterUpdate':'update','afterDestroy':_0x4e3d('0x4')};function emitEvent(_0x4ece82){return function(_0x438b9a,_0x46b757,_0x4fd5ff){_0x438b9a[_0x4e3d('0x5')]({'attributes':['id'],'raw':!![]})[_0x4e3d('0x6')](function(_0x5b544d){_0x438b9a[_0x4e3d('0x7')](_0x4e3d('0x8'),_0x5b544d[_0x4e3d('0x9')](function(_0x352616){return{'id':_0x352616['id']};}));return WhatsappMessage[_0x4e3d('0xa')]({'where':{'WhatsappInteractionId':_0x438b9a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4e3d('0x6')](function(_0x500f5c){_0x438b9a['setDataValue'](_0x4e3d('0xb'),_0x500f5c[_0x4e3d('0xc')]);WhatsappInteractionEvents[_0x4e3d('0xd')](_0x4ece82+':'+_0x438b9a['id'],_0x438b9a);WhatsappInteractionEvents[_0x4e3d('0xd')](_0x4ece82,_0x438b9a);_0x4fd5ff(null);})[_0x4e3d('0xe')](_0x4fd5ff(null));};}for(var e in events){if(events[_0x4e3d('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x4e3d('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x6e77=['emit','catch','hasOwnProperty','hook','exports','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x36fa31,_0x33ddeb){var _0x191e7d=function(_0x1e2098){while(--_0x1e2098){_0x36fa31['push'](_0x36fa31['shift']());}};_0x191e7d(++_0x33ddeb);}(_0x6e77,0xef));var _0x76e7=function(_0x397127,_0x31429d){_0x397127=_0x397127-0x0;var _0x1d5516=_0x6e77[_0x397127];return _0x1d5516;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x76e7('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db'][_0x76e7('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x76e7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x76e7('0x3'),'afterDestroy':_0x76e7('0x4')};function emitEvent(_0xcc6627){return function(_0x5eb27e,_0x498ec3,_0x423b7a){_0x5eb27e[_0x76e7('0x5')]({'attributes':['id'],'raw':!![]})[_0x76e7('0x6')](function(_0x5a5e94){_0x5eb27e[_0x76e7('0x7')](_0x76e7('0x8'),_0x5a5e94[_0x76e7('0x9')](function(_0x5dbea3){return{'id':_0x5dbea3['id']};}));return WhatsappMessage[_0x76e7('0xa')]({'where':{'WhatsappInteractionId':_0x5eb27e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x76e7('0x6')](function(_0x57b048){_0x5eb27e[_0x76e7('0x7')](_0x76e7('0xb'),_0x57b048[_0x76e7('0xc')]);WhatsappInteractionEvents[_0x76e7('0xd')](_0xcc6627+':'+_0x5eb27e['id'],_0x5eb27e);WhatsappInteractionEvents['emit'](_0xcc6627,_0x5eb27e);_0x423b7a(null);})[_0x76e7('0xe')](_0x423b7a(null));};}for(var e in events){if(events[_0x76e7('0xf')](e)){var event=events[e];WhatsappInteraction[_0x76e7('0x10')](e,emitEvent(event));}}module[_0x76e7('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 9964411..cd22eae 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 _0xdb84=['whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction'];(function(_0x45f868,_0xfd9973){var _0x315150=function(_0x474ec5){while(--_0x474ec5){_0x45f868['push'](_0x45f868['shift']());}};_0x315150(++_0xfd9973);}(_0xdb84,0xa8));var _0x4db8=function(_0x3e54a1,_0xdcff39){_0x3e54a1=_0x3e54a1-0x0;var _0x469760=_0xdb84[_0x3e54a1];return _0x469760;};'use strict';var _=require('lodash');var util=require(_0x4db8('0x0'));var logger=require(_0x4db8('0x1'))('api');var moment=require(_0x4db8('0x2'));var BPromise=require(_0x4db8('0x3'));var rp=require(_0x4db8('0x4'));var fs=require('fs');var path=require(_0x4db8('0x5'));var rimraf=require(_0x4db8('0x6'));var config=require(_0x4db8('0x7'));var attributes=require(_0x4db8('0x8'));module[_0x4db8('0x9')]=function(_0x2eb34e,_0x2962d0){return _0x2eb34e[_0x4db8('0xa')](_0x4db8('0xb'),attributes,{'tableName':_0x4db8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16c103,_0x31741d,_0x5acec2){if(_0x16c103[_0x4db8('0xd')](_0x4db8('0xe'))){_0x16c103[_0x4db8('0xf')]=moment()[_0x4db8('0x10')](_0x4db8('0x11'));}_0x5acec2(null,_0x16c103);}}});}; \ No newline at end of file +var _0x1893=['bluebird','request-promise','path','rimraf','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','moment'];(function(_0x267f6e,_0x5bef87){var _0x572665=function(_0x407d80){while(--_0x407d80){_0x267f6e['push'](_0x267f6e['shift']());}};_0x572665(++_0x5bef87);}(_0x1893,0xa2));var _0x3189=function(_0x59f2fe,_0x372cfb){_0x59f2fe=_0x59f2fe-0x0;var _0x121432=_0x1893[_0x59f2fe];return _0x121432;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3189('0x0'))(_0x3189('0x1'));var moment=require(_0x3189('0x2'));var BPromise=require(_0x3189('0x3'));var rp=require(_0x3189('0x4'));var fs=require('fs');var path=require(_0x3189('0x5'));var rimraf=require(_0x3189('0x6'));var config=require('../../config/environment');var attributes=require(_0x3189('0x7'));module[_0x3189('0x8')]=function(_0x2333e6,_0x4080a9){return _0x2333e6[_0x3189('0x9')](_0x3189('0xa'),attributes,{'tableName':_0x3189('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1f6764,_0x5312a3,_0x1d5f6a){if(_0x1f6764['changed'](_0x3189('0xc'))){_0x1f6764['closedAt']=moment()[_0x3189('0xd')](_0x3189('0xe'));}_0x1d5f6a(null,_0x1f6764);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index b8d7965..9e9d46b 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 _0x86e0=['body','options','raw','attributes','AddTagsToWhatsappInteraction','WhatsappInteraction','find','where','addTags','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./whatsappInteraction.socket','register','request','then','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateWhatsappInteraction','update'];(function(_0x3f71e3,_0x3991ec){var _0x5eb12c=function(_0x3a04c8){while(--_0x3a04c8){_0x3f71e3['push'](_0x3f71e3['shift']());}};_0x5eb12c(++_0x3991ec);}(_0x86e0,0xe8));var _0x086e=function(_0x3f6633,_0xf1bb7b){_0x3f6633=_0x3f6633-0x0;var _0xbfee29=_0x86e0[_0x3f6633];return _0xbfee29;};'use strict';var _=require(_0x086e('0x0'));var util=require(_0x086e('0x1'));var moment=require(_0x086e('0x2'));var BPromise=require('bluebird');var rs=require(_0x086e('0x3'));var fs=require('fs');var Redis=require(_0x086e('0x4'));var db=require(_0x086e('0x5'))['db'];var utils=require(_0x086e('0x6'));var logger=require(_0x086e('0x7'))(_0x086e('0x8'));var config=require(_0x086e('0x9'));var jayson=require(_0x086e('0xa'));var client=jayson[_0x086e('0xb')][_0x086e('0xc')]({'port':0x232a});config[_0x086e('0xd')]=_['defaults'](config[_0x086e('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x086e('0xe'))(new Redis(config[_0x086e('0xd')]));require(_0x086e('0xf'))[_0x086e('0x10')](socket);function respondWithRpcPromise(_0x5bde76,_0x375d5d,_0x29b905){return new BPromise(function(_0x5698a7,_0xcd607){return client[_0x086e('0x11')](_0x5bde76,_0x29b905)[_0x086e('0x12')](function(_0x27b0af){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x375d5d,'request\x20sent');logger[_0x086e('0x13')](_0x086e('0x14'),_0x375d5d,_0x086e('0x15'),JSON[_0x086e('0x16')](_0x27b0af));if(_0x27b0af['error']){if(_0x27b0af[_0x086e('0x17')][_0x086e('0x18')]===0x1f4){logger['error'](_0x086e('0x19'),_0x375d5d,_0x27b0af[_0x086e('0x17')][_0x086e('0x1a')]);return _0xcd607(_0x27b0af[_0x086e('0x17')]['message']);}logger[_0x086e('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x375d5d,_0x27b0af[_0x086e('0x17')][_0x086e('0x1a')]);return _0x5698a7(_0x27b0af[_0x086e('0x17')][_0x086e('0x1a')]);}else{logger[_0x086e('0x1b')]('WhatsappInteraction,\x20%s,\x20%s',_0x375d5d,'request\x20sent');_0x5698a7(_0x27b0af[_0x086e('0x1c')][_0x086e('0x1a')]);}})[_0x086e('0x1d')](function(_0x485440){logger[_0x086e('0x17')](_0x086e('0x19'),_0x375d5d,_0x485440);_0xcd607(_0x485440);});});}exports[_0x086e('0x1e')]=function(_0x3478be){var _0x12c176=this;return new Promise(function(_0x2c44d0,_0x1f831c){return db['WhatsappInteraction'][_0x086e('0x1f')](_0x3478be[_0x086e('0x20')],{'raw':_0x3478be['options']?_0x3478be[_0x086e('0x21')][_0x086e('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3478be[_0x086e('0x21')]?_0x3478be['options']['where']||null:null,'attributes':_0x3478be[_0x086e('0x21')]?_0x3478be[_0x086e('0x21')][_0x086e('0x23')]||null:null,'limit':_0x3478be['options']?_0x3478be[_0x086e('0x21')]['limit']||null:null})[_0x086e('0x12')](function(_0x4d2fd9){logger[_0x086e('0x1b')](_0x086e('0x1e'),_0x3478be);logger[_0x086e('0x13')](_0x086e('0x1e'),_0x3478be,JSON['stringify'](_0x4d2fd9));_0x2c44d0(_0x4d2fd9);})[_0x086e('0x1d')](function(_0x3d1711){logger['error'](_0x086e('0x1e'),_0x3d1711['message'],_0x3478be);_0x1f831c(_0x12c176[_0x086e('0x17')](0x1f4,_0x3d1711[_0x086e('0x1a')]));});});};exports[_0x086e('0x24')]=function(_0xdf516){return new Promise(function(_0x3d23dd,_0x5841c8){return db[_0x086e('0x25')][_0x086e('0x26')]({'where':_0xdf516['options']?_0xdf516['options'][_0x086e('0x27')]||null:null})[_0x086e('0x12')](function(_0x96c639){if(_0x96c639){return _0x96c639[_0x086e('0x28')](_0xdf516['body']['ids'],_['omit'](_0xdf516[_0x086e('0x20')],[_0x086e('0x29'),'id'])||{});}})[_0x086e('0x2a')](function(_0x2f3ad5){logger['info']('AddTags',_0xdf516);logger[_0x086e('0x13')]('AddTags',_0xdf516,JSON[_0x086e('0x16')](_0x2f3ad5));_0x3d23dd(_0x2f3ad5);})[_0x086e('0x1d')](function(_0x24a15a){logger['error'](_0x086e('0x2b'),_0x24a15a[_0x086e('0x1a')],_0xdf516);_0x5841c8(_this[_0x086e('0x17')](0x1f4,_0x24a15a['message']));});});}; \ No newline at end of file +var _0xee29=['redis','localhost','socket.io-emitter','./whatsappInteraction.socket','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','where','attributes','limit','debug','AddTagsToWhatsappInteraction','find','addTags','omit','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults'];(function(_0x385037,_0x4c39c1){var _0x168ef6=function(_0x4fb5cf){while(--_0x4fb5cf){_0x385037['push'](_0x385037['shift']());}};_0x168ef6(++_0x4c39c1);}(_0xee29,0x18e));var _0x9ee2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee29[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9ee2('0x0'));var util=require(_0x9ee2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9ee2('0x2'));var fs=require('fs');var Redis=require(_0x9ee2('0x3'));var db=require(_0x9ee2('0x4'))['db'];var utils=require(_0x9ee2('0x5'));var logger=require(_0x9ee2('0x6'))(_0x9ee2('0x7'));var config=require(_0x9ee2('0x8'));var jayson=require(_0x9ee2('0x9'));var client=jayson['client'][_0x9ee2('0xa')]({'port':0x232a});config['redis']=_[_0x9ee2('0xb')](config[_0x9ee2('0xc')],{'host':_0x9ee2('0xd'),'port':0x18eb});var socket=require(_0x9ee2('0xe'))(new Redis(config[_0x9ee2('0xc')]));require(_0x9ee2('0xf'))['register'](socket);function respondWithRpcPromise(_0x43bbfd,_0x26cb05,_0x4bad7d){return new BPromise(function(_0x435fcc,_0x1dd500){return client['request'](_0x43bbfd,_0x4bad7d)[_0x9ee2('0x10')](function(_0x23ca89){logger[_0x9ee2('0x11')](_0x9ee2('0x12'),_0x26cb05,_0x9ee2('0x13'));logger['debug'](_0x9ee2('0x14'),_0x26cb05,_0x9ee2('0x13'),JSON[_0x9ee2('0x15')](_0x23ca89));if(_0x23ca89['error']){if(_0x23ca89[_0x9ee2('0x16')][_0x9ee2('0x17')]===0x1f4){logger[_0x9ee2('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x26cb05,_0x23ca89['error']['message']);return _0x1dd500(_0x23ca89['error'][_0x9ee2('0x18')]);}logger[_0x9ee2('0x16')](_0x9ee2('0x12'),_0x26cb05,_0x23ca89[_0x9ee2('0x16')][_0x9ee2('0x18')]);return _0x435fcc(_0x23ca89[_0x9ee2('0x16')][_0x9ee2('0x18')]);}else{logger[_0x9ee2('0x11')](_0x9ee2('0x12'),_0x26cb05,_0x9ee2('0x13'));_0x435fcc(_0x23ca89[_0x9ee2('0x19')][_0x9ee2('0x18')]);}})[_0x9ee2('0x1a')](function(_0x18dc63){logger[_0x9ee2('0x16')](_0x9ee2('0x12'),_0x26cb05,_0x18dc63);_0x1dd500(_0x18dc63);});});}exports[_0x9ee2('0x1b')]=function(_0x44eb02){var _0xa7c0b0=this;return new Promise(function(_0x383720,_0x5b2fd8){return db[_0x9ee2('0x1c')]['update'](_0x44eb02[_0x9ee2('0x1d')],{'raw':_0x44eb02[_0x9ee2('0x1e')]?_0x44eb02[_0x9ee2('0x1e')][_0x9ee2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44eb02[_0x9ee2('0x1e')]?_0x44eb02[_0x9ee2('0x1e')][_0x9ee2('0x20')]||null:null,'attributes':_0x44eb02[_0x9ee2('0x1e')]?_0x44eb02[_0x9ee2('0x1e')][_0x9ee2('0x21')]||null:null,'limit':_0x44eb02[_0x9ee2('0x1e')]?_0x44eb02[_0x9ee2('0x1e')][_0x9ee2('0x22')]||null:null})[_0x9ee2('0x10')](function(_0x1d9d66){logger[_0x9ee2('0x11')](_0x9ee2('0x1b'),_0x44eb02);logger[_0x9ee2('0x23')]('UpdateWhatsappInteraction',_0x44eb02,JSON[_0x9ee2('0x15')](_0x1d9d66));_0x383720(_0x1d9d66);})[_0x9ee2('0x1a')](function(_0x26055f){logger['error'](_0x9ee2('0x1b'),_0x26055f[_0x9ee2('0x18')],_0x44eb02);_0x5b2fd8(_0xa7c0b0[_0x9ee2('0x16')](0x1f4,_0x26055f[_0x9ee2('0x18')]));});});};exports[_0x9ee2('0x24')]=function(_0x239f85){return new Promise(function(_0x5a035a,_0x3a4cff){return db[_0x9ee2('0x1c')][_0x9ee2('0x25')]({'where':_0x239f85[_0x9ee2('0x1e')]?_0x239f85[_0x9ee2('0x1e')][_0x9ee2('0x20')]||null:null})[_0x9ee2('0x10')](function(_0x2768b1){if(_0x2768b1){return _0x2768b1[_0x9ee2('0x26')](_0x239f85[_0x9ee2('0x1d')]['ids'],_[_0x9ee2('0x27')](_0x239f85[_0x9ee2('0x1d')],['ids','id'])||{});}})['spread'](function(_0x32303e){logger[_0x9ee2('0x11')]('AddTags',_0x239f85);logger['debug'](_0x9ee2('0x28'),_0x239f85,JSON['stringify'](_0x32303e));_0x5a035a(_0x32303e);})[_0x9ee2('0x1a')](function(_0x199eb7){logger['error'](_0x9ee2('0x28'),_0x199eb7[_0x9ee2('0x18')],_0x239f85);_0x3a4cff(_this['error'](0x1f4,_0x199eb7[_0x9ee2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index de2e2d8..177e4bb 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 _0xff5e=['emit','removeListener','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x4618d7,_0x11f97c){var _0x38561e=function(_0x3a7b9b){while(--_0x3a7b9b){_0x4618d7['push'](_0x4618d7['shift']());}};_0x38561e(++_0x11f97c);}(_0xff5e,0x136));var _0xeff5=function(_0x58766,_0x1f6dfb){_0x58766=_0x58766-0x0;var _0x4b82ec=_0xff5e[_0x58766];return _0x4b82ec;};'use strict';var WhatsappInteractionEvents=require(_0xeff5('0x0'));var events=[_0xeff5('0x1'),'remove','update'];function createListener(_0x463c84,_0xbfe7ad){return function(_0x3afda5){_0xbfe7ad[_0xeff5('0x2')](_0x463c84,_0x3afda5);};}function removeListener(_0x3b39c8,_0x46c02c){return function(){WhatsappInteractionEvents[_0xeff5('0x3')](_0x3b39c8,_0x46c02c);};}exports['register']=function(_0x3a677f){for(var _0x303d70=0x0,_0x7f6ed1=events[_0xeff5('0x4')];_0x303d70<_0x7f6ed1;_0x303d70++){var _0x1318f1=events[_0x303d70];var _0x33143b=createListener(_0xeff5('0x5')+_0x1318f1,_0x3a677f);WhatsappInteractionEvents['on'](_0x1318f1,_0x33143b);}}; \ No newline at end of file +var _0xc8eb=['update','emit','removeListener','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc8eb,0xfa));var _0xbc8e=function(_0x541260,_0x4c7f2e){_0x541260=_0x541260-0x0;var _0x1dd2b5=_0xc8eb[_0x541260];return _0x1dd2b5;};'use strict';var WhatsappInteractionEvents=require(_0xbc8e('0x0'));var events=[_0xbc8e('0x1'),'remove',_0xbc8e('0x2')];function createListener(_0x13fb2a,_0x77d05){return function(_0x21b118){_0x77d05[_0xbc8e('0x3')](_0x13fb2a,_0x21b118);};}function removeListener(_0x496842,_0x1a16f3){return function(){WhatsappInteractionEvents[_0xbc8e('0x4')](_0x496842,_0x1a16f3);};}exports['register']=function(_0x77425d){for(var _0x1adfae=0x0,_0x2c4af0=events[_0xbc8e('0x5')];_0x1adfae<_0x2c4af0;_0x1adfae++){var _0x39ad28=events[_0x1adfae];var _0x174b4c=createListener(_0xbc8e('0x6')+_0x39ad28,_0x77425d);WhatsappInteractionEvents['on'](_0x39ad28,_0x174b4c);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 3fc3af9..d5cf959 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 _0x3df1=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x5c552b,_0x2f2773){var _0x3e4c76=function(_0x541037){while(--_0x541037){_0x5c552b['push'](_0x5c552b['shift']());}};_0x3e4c76(++_0x2f2773);}(_0x3df1,0xa5));var _0x13df=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3df1[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x13df('0x0'));var util=require(_0x13df('0x1'));var path=require(_0x13df('0x2'));var timeout=require(_0x13df('0x3'));var express=require(_0x13df('0x4'));var router=express[_0x13df('0x5')]();var fs_extra=require(_0x13df('0x6'));var auth=require(_0x13df('0x7'));var interaction=require(_0x13df('0x8'));var config=require(_0x13df('0x9'));var controller=require(_0x13df('0xa'));router[_0x13df('0xb')]('/',auth[_0x13df('0xc')](),controller[_0x13df('0xd')]);router['get'](_0x13df('0xe'),auth[_0x13df('0xc')](),controller[_0x13df('0xf')]);router[_0x13df('0xb')](_0x13df('0x10'),auth[_0x13df('0xc')](),controller[_0x13df('0x11')]);router[_0x13df('0x12')]('/',auth[_0x13df('0xc')](),interaction[_0x13df('0x13')](_0x13df('0x14'),_0x13df('0x15')),controller[_0x13df('0x16')]);router[_0x13df('0x12')](_0x13df('0x17'),controller[_0x13df('0x18')]);router[_0x13df('0x19')](_0x13df('0x10'),auth[_0x13df('0xc')](),controller[_0x13df('0x1a')]);router[_0x13df('0x19')](_0x13df('0x1b'),auth[_0x13df('0xc')](),controller['accept']);router[_0x13df('0x19')](_0x13df('0x1c'),auth[_0x13df('0xc')](),controller[_0x13df('0x1d')]);router[_0x13df('0x1e')](_0x13df('0x10'),auth[_0x13df('0xc')](),controller[_0x13df('0x1f')]);module[_0x13df('0x20')]=router; \ No newline at end of file +var _0x576e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x576e,0x1b0));var _0xe576=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x576e[_0x9c2427];return _0x51984f;};'use strict';var multer=require(_0xe576('0x0'));var util=require(_0xe576('0x1'));var path=require(_0xe576('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe576('0x3')]();var fs_extra=require(_0xe576('0x4'));var auth=require(_0xe576('0x5'));var interaction=require(_0xe576('0x6'));var config=require(_0xe576('0x7'));var controller=require('./whatsappMessage.controller');router[_0xe576('0x8')]('/',auth[_0xe576('0x9')](),controller['index']);router[_0xe576('0x8')](_0xe576('0xa'),auth[_0xe576('0x9')](),controller[_0xe576('0xb')]);router[_0xe576('0x8')](_0xe576('0xc'),auth['isAuthenticated'](),controller[_0xe576('0xd')]);router[_0xe576('0xe')]('/',auth['isAuthenticated'](),interaction[_0xe576('0xf')](_0xe576('0x10'),_0xe576('0x11')),controller[_0xe576('0x12')]);router[_0xe576('0xe')](_0xe576('0x13'),controller[_0xe576('0x14')]);router[_0xe576('0x15')](_0xe576('0xc'),auth[_0xe576('0x9')](),controller[_0xe576('0x16')]);router[_0xe576('0x15')]('/:id/accept',auth['isAuthenticated'](),controller[_0xe576('0x17')]);router[_0xe576('0x15')](_0xe576('0x18'),auth[_0xe576('0x9')](),controller[_0xe576('0x19')]);router[_0xe576('0x1a')]('/:id',auth[_0xe576('0x9')](),controller[_0xe576('0x1b')]);module[_0xe576('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index f1b9dec..8df5266 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 _0x2401=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x2401,0x1af));var _0x1240=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2401[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1240('0x0'));module['exports']={'body':{'type':Sequelize[_0x1240('0x1')](_0x1240('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1240('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1240('0x4')]('in',_0x1240('0x5')),'defaultValue':_0x1240('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1240('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x1240('0x7')]},'secret':{'type':Sequelize[_0x1240('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1240('0x6')]},'providerResponse':{'type':Sequelize[_0x1240('0x1')]}}; \ No newline at end of file +var _0x85d8=['TEXT','medium','BOOLEAN','out','STRING','sequelize','exports'];(function(_0x2c1d90,_0x579d66){var _0xaa8a14=function(_0x3ba32b){while(--_0x3ba32b){_0x2c1d90['push'](_0x2c1d90['shift']());}};_0xaa8a14(++_0x579d66);}(_0x85d8,0x1b0));var _0x885d=function(_0x17e482,_0x8c2cbb){_0x17e482=_0x17e482-0x0;var _0xeb059d=_0x85d8[_0x17e482];return _0xeb059d;};'use strict';var Sequelize=require(_0x885d('0x0'));module[_0x885d('0x1')]={'body':{'type':Sequelize[_0x885d('0x2')](_0x885d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x885d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x885d('0x5')),'defaultValue':_0x885d('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x885d('0x6')](0xbe)},'phone':{'type':Sequelize[_0x885d('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x885d('0x6')]},'providerResponse':{'type':Sequelize[_0x885d('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 9e27319..8b7ec19 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 _0xfa93=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','name','map','WhatsappMessage','fieldName','type','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','includeAll','findAll','rows','show','params','keys','rawAttributes','length','options','find','create','body','destroy','describe','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteractionId','isNil','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','SELECT','contact','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4ab00b,_0x501d64){var _0x41957f=function(_0x463aed){while(--_0x463aed){_0x4ab00b['push'](_0x4ab00b['shift']());}};_0x41957f(++_0x501d64);}(_0xfa93,0x109));var _0x3fa9=function(_0x4953c0,_0x2a9d5f){_0x4953c0=_0x4953c0-0x0;var _0x597032=_0xfa93[_0x4953c0];return _0x597032;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3fa9('0x0'));var zipdir=require(_0x3fa9('0x1'));var jsonpatch=require(_0x3fa9('0x2'));var rp=require(_0x3fa9('0x3'));var moment=require(_0x3fa9('0x4'));var BPromise=require(_0x3fa9('0x5'));var Mustache=require('mustache');var util=require(_0x3fa9('0x6'));var path=require(_0x3fa9('0x7'));var sox=require(_0x3fa9('0x8'));var csv=require(_0x3fa9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3fa9('0xa'));var _=require(_0x3fa9('0xb'));var squel=require(_0x3fa9('0xc'));var crypto=require(_0x3fa9('0xd'));var jsforce=require(_0x3fa9('0xe'));var deskjs=require(_0x3fa9('0xf'));var toCsv=require(_0x3fa9('0x9'));var querystring=require(_0x3fa9('0x10'));var Papa=require(_0x3fa9('0x11'));var Redis=require(_0x3fa9('0x12'));var authService=require(_0x3fa9('0x13'));var qs=require(_0x3fa9('0x14'));var as=require(_0x3fa9('0x15'));var hardwareService=require(_0x3fa9('0x16'));var logger=require('../../config/logger')(_0x3fa9('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3fa9('0x18'))['db'];config[_0x3fa9('0x19')]=_['defaults'](config['redis'],{'host':_0x3fa9('0x1a'),'port':0x18eb});var socket=require(_0x3fa9('0x1b'))(new Redis(config[_0x3fa9('0x19')]));require(_0x3fa9('0x1c'))[_0x3fa9('0x1d')](socket);var jayson=require(_0x3fa9('0x1e'));var client=jayson[_0x3fa9('0x1f')][_0x3fa9('0x20')]({'port':0x232c});var client9002=jayson[_0x3fa9('0x1f')][_0x3fa9('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x21cec6,_0x1a25ca,_0xb62d54,_0x175f6d){return new BPromise(function(_0x8a8a43,_0x1cb8fc){var _0x3d58f4=_0x175f6d||client;return _0x3d58f4[_0x3fa9('0x21')](_0x21cec6,_0xb62d54)[_0x3fa9('0x22')](function(_0x4d2b64){logger[_0x3fa9('0x23')](_0x3fa9('0x24'),_0x1a25ca,_0x3fa9('0x25'));logger['debug'](_0x3fa9('0x26'),_0x1a25ca,'request\x20sent',JSON['stringify'](_0x4d2b64));if(_0x4d2b64[_0x3fa9('0x27')]){if(_0x4d2b64[_0x3fa9('0x27')][_0x3fa9('0x28')]===0x1f4){logger[_0x3fa9('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x1a25ca,_0x4d2b64[_0x3fa9('0x27')]['message']);return _0x1cb8fc(_0x4d2b64[_0x3fa9('0x27')][_0x3fa9('0x29')]);}logger[_0x3fa9('0x27')](_0x3fa9('0x24'),_0x1a25ca,_0x4d2b64[_0x3fa9('0x27')]['message']);return _0x8a8a43(_0x4d2b64[_0x3fa9('0x27')][_0x3fa9('0x29')]);}else{logger[_0x3fa9('0x23')](_0x3fa9('0x24'),_0x1a25ca,_0x3fa9('0x25'));_0x8a8a43(_0x4d2b64[_0x3fa9('0x2a')][_0x3fa9('0x29')]);}})[_0x3fa9('0x2b')](function(_0x2fffe3){logger['error'](_0x3fa9('0x24'),_0x1a25ca,_0x2fffe3);_0x1cb8fc(_0x2fffe3);});});}function respondWithStatusCode(_0x3c950a,_0x1738c5){_0x1738c5=_0x1738c5||0xcc;return function(_0x351bab){if(_0x351bab){return _0x3c950a[_0x3fa9('0x2c')](_0x1738c5);}return _0x3c950a[_0x3fa9('0x2d')](_0x1738c5)[_0x3fa9('0x2e')]();};}function respondWithResult(_0x412195,_0x31d628){_0x31d628=_0x31d628||0xc8;return function(_0x4cc57e){if(_0x4cc57e){return _0x412195[_0x3fa9('0x2d')](_0x31d628)[_0x3fa9('0x2f')](_0x4cc57e);}};}function respondWithFilteredResult(_0x4f0ac3,_0x351360){return function(_0x5baae3){if(_0x5baae3){var _0x588965=typeof _0x351360['offset']===_0x3fa9('0x30')&&typeof _0x351360[_0x3fa9('0x31')]===_0x3fa9('0x30');var _0x275525=_0x5baae3[_0x3fa9('0x32')];var _0x288ab3=_0x588965?0x0:_0x351360[_0x3fa9('0x33')];var _0x573d64=_0x588965?_0x5baae3[_0x3fa9('0x32')]:_0x351360['offset']+_0x351360[_0x3fa9('0x31')];var _0x4d54a1;if(_0x573d64>=_0x275525){_0x573d64=_0x275525;_0x4d54a1=0xc8;}else{_0x4d54a1=0xce;}_0x4f0ac3[_0x3fa9('0x2d')](_0x4d54a1);return _0x4f0ac3[_0x3fa9('0x34')](_0x3fa9('0x35'),_0x288ab3+'-'+_0x573d64+'/'+_0x275525)[_0x3fa9('0x2f')](_0x5baae3);}return null;};}function patchUpdates(_0xe90b7f){return function(_0x265887){try{jsonpatch[_0x3fa9('0x36')](_0x265887,_0xe90b7f,!![]);}catch(_0x4fc1d1){return BPromise[_0x3fa9('0x37')](_0x4fc1d1);}return _0x265887[_0x3fa9('0x38')]();};}function saveUpdates(_0x3f0d2b,_0x2f4d06){return function(_0x4a9cf6){if(_0x4a9cf6){return _0x4a9cf6[_0x3fa9('0x39')](_0x3f0d2b)[_0x3fa9('0x22')](function(_0x3e36a5){return _0x3e36a5;});}return null;};}function removeEntity(_0x3f58cb,_0x7911d8){return function(_0x43626d){if(_0x43626d){return _0x43626d['destroy']()[_0x3fa9('0x22')](function(){_0x3f58cb[_0x3fa9('0x2d')](0xcc)[_0x3fa9('0x2e')]();});}};}function handleEntityNotFound(_0x3b1cd5,_0x66194c){return function(_0xed6bcb){if(!_0xed6bcb){_0x3b1cd5[_0x3fa9('0x2c')](0x194);}return _0xed6bcb;};}function handleError(_0x2c0145,_0x12ecfa){_0x12ecfa=_0x12ecfa||0x1f4;return function(_0x23035a){logger[_0x3fa9('0x27')](_0x23035a['stack']);if(_0x23035a[_0x3fa9('0x3a')]){delete _0x23035a[_0x3fa9('0x3a')];}_0x2c0145[_0x3fa9('0x2d')](_0x12ecfa)['send'](_0x23035a);};}exports['index']=function(_0x42d6de,_0x3abe64){var _0x40cd9c={},_0x88f17b={},_0x1b6a37={'count':0x0,'rows':[]};var _0x342b81=_[_0x3fa9('0x3b')](db[_0x3fa9('0x3c')]['rawAttributes'],function(_0x1aa2e9){return{'name':_0x1aa2e9[_0x3fa9('0x3d')],'type':_0x1aa2e9[_0x3fa9('0x3e')][_0x3fa9('0x3f')]};});_0x88f17b[_0x3fa9('0x40')]=_[_0x3fa9('0x3b')](_0x342b81,_0x3fa9('0x3a'));_0x88f17b[_0x3fa9('0x41')]=_['keys'](_0x42d6de[_0x3fa9('0x41')]);_0x88f17b['filters']=_['intersection'](_0x88f17b[_0x3fa9('0x40')],_0x88f17b[_0x3fa9('0x41')]);_0x40cd9c[_0x3fa9('0x42')]=_[_0x3fa9('0x43')](_0x88f17b[_0x3fa9('0x40')],qs['fields'](_0x42d6de['query'][_0x3fa9('0x44')]));_0x40cd9c[_0x3fa9('0x42')]=_0x40cd9c[_0x3fa9('0x42')]['length']?_0x40cd9c[_0x3fa9('0x42')]:_0x88f17b[_0x3fa9('0x40')];if(!_0x42d6de[_0x3fa9('0x41')][_0x3fa9('0x45')](_0x3fa9('0x46'))){_0x40cd9c['limit']=qs['limit'](_0x42d6de[_0x3fa9('0x41')]['limit']);_0x40cd9c[_0x3fa9('0x33')]=qs[_0x3fa9('0x33')](_0x42d6de['query']['offset']);}_0x40cd9c[_0x3fa9('0x47')]=qs[_0x3fa9('0x48')](_0x42d6de['query'][_0x3fa9('0x48')]);_0x40cd9c[_0x3fa9('0x49')]=qs[_0x3fa9('0x4a')](_[_0x3fa9('0x4b')](_0x42d6de['query'],_0x88f17b['filters']),_0x342b81);if(_0x42d6de[_0x3fa9('0x41')]['filter']){_0x40cd9c['where']=_[_0x3fa9('0x4c')](_0x40cd9c[_0x3fa9('0x49')],{'$or':_[_0x3fa9('0x3b')](_0x342b81,function(_0x5612bf){if(_0x5612bf[_0x3fa9('0x3e')]!=='VIRTUAL'){var _0xfa6185={};_0xfa6185[_0x5612bf[_0x3fa9('0x3a')]]={'$like':'%'+_0x42d6de[_0x3fa9('0x41')]['filter']+'%'};return _0xfa6185;}})});}_0x40cd9c=_[_0x3fa9('0x4c')]({},_0x40cd9c,_0x42d6de['options']);var _0x371cdc={'where':_0x40cd9c[_0x3fa9('0x49')]};return db[_0x3fa9('0x3c')][_0x3fa9('0x32')](_0x371cdc)[_0x3fa9('0x22')](function(_0x586b89){_0x1b6a37[_0x3fa9('0x32')]=_0x586b89;if(_0x42d6de[_0x3fa9('0x41')][_0x3fa9('0x4d')]){_0x40cd9c['include']=[{'all':!![]}];}return db[_0x3fa9('0x3c')][_0x3fa9('0x4e')](_0x40cd9c);})[_0x3fa9('0x22')](function(_0x52f71a){_0x1b6a37[_0x3fa9('0x4f')]=_0x52f71a;return _0x1b6a37;})[_0x3fa9('0x22')](respondWithFilteredResult(_0x3abe64,_0x40cd9c))[_0x3fa9('0x2b')](handleError(_0x3abe64,null));};exports[_0x3fa9('0x50')]=function(_0x432bc6,_0x48759d){var _0x92178d={'raw':!![],'where':{'id':_0x432bc6[_0x3fa9('0x51')]['id']}},_0x43baa0={};_0x43baa0['model']=_[_0x3fa9('0x52')](db[_0x3fa9('0x3c')][_0x3fa9('0x53')]);_0x43baa0[_0x3fa9('0x41')]=_[_0x3fa9('0x52')](_0x432bc6[_0x3fa9('0x41')]);_0x43baa0[_0x3fa9('0x4a')]=_[_0x3fa9('0x43')](_0x43baa0['model'],_0x43baa0['query']);_0x92178d[_0x3fa9('0x42')]=_[_0x3fa9('0x43')](_0x43baa0[_0x3fa9('0x40')],qs['fields'](_0x432bc6[_0x3fa9('0x41')][_0x3fa9('0x44')]));_0x92178d[_0x3fa9('0x42')]=_0x92178d['attributes'][_0x3fa9('0x54')]?_0x92178d[_0x3fa9('0x42')]:_0x43baa0[_0x3fa9('0x40')];if(_0x432bc6['query'][_0x3fa9('0x4d')]){_0x92178d['include']=[{'all':!![]}];}_0x92178d=_['merge']({},_0x92178d,_0x432bc6[_0x3fa9('0x55')]);return db[_0x3fa9('0x3c')][_0x3fa9('0x56')](_0x92178d)['then'](handleEntityNotFound(_0x48759d,null))[_0x3fa9('0x22')](respondWithResult(_0x48759d,null))[_0x3fa9('0x2b')](handleError(_0x48759d,null));};exports['create']=function(_0x3994f7,_0xb95c87){return db[_0x3fa9('0x3c')][_0x3fa9('0x57')](_0x3994f7[_0x3fa9('0x58')],{})['then'](respondWithResult(_0xb95c87,0xc9))[_0x3fa9('0x2b')](handleError(_0xb95c87,null));};exports['update']=function(_0x107a76,_0x2637f1){if(_0x107a76[_0x3fa9('0x58')]['id']){delete _0x107a76[_0x3fa9('0x58')]['id'];}return db['WhatsappMessage'][_0x3fa9('0x56')]({'where':{'id':_0x107a76['params']['id']}})[_0x3fa9('0x22')](handleEntityNotFound(_0x2637f1,null))[_0x3fa9('0x22')](saveUpdates(_0x107a76[_0x3fa9('0x58')],null))[_0x3fa9('0x22')](respondWithResult(_0x2637f1,null))[_0x3fa9('0x2b')](handleError(_0x2637f1,null));};exports[_0x3fa9('0x59')]=function(_0xb21cac,_0x95fb89){return db[_0x3fa9('0x3c')][_0x3fa9('0x56')]({'where':{'id':_0xb21cac[_0x3fa9('0x51')]['id']}})['then'](handleEntityNotFound(_0x95fb89,null))[_0x3fa9('0x22')](removeEntity(_0x95fb89,null))['catch'](handleError(_0x95fb89,null));};exports[_0x3fa9('0x5a')]=function(_0x2064c2,_0x18c145){return db['WhatsappMessage']['describe']()['then'](respondWithResult(_0x18c145,null))[_0x3fa9('0x2b')](handleError(_0x18c145,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x3fa9('0x5b')]=function(_0x523a93,_0x3660c8,_0x475805){var _0x3c3b8e={'agent':{},'channel':_0x3fa9('0x5c')};if(_0x523a93[_0x3fa9('0x58')]['id']){delete _0x523a93[_0x3fa9('0x58')]['id'];}_0x523a93[_0x3fa9('0x58')][_0x3fa9('0x5d')]=!![];_0x523a93[_0x3fa9('0x58')][_0x3fa9('0x5e')]=moment()[_0x3fa9('0x5f')](_0x3fa9('0x60'));_0x523a93['body'][_0x3fa9('0x61')]=_0x523a93[_0x3fa9('0x58')][_0x3fa9('0x61')]||_0x523a93[_0x3fa9('0x62')]['id'];_0x3c3b8e[_0x3fa9('0x63')]['id']=_0x523a93['body'][_0x3fa9('0x61')];return db[_0x3fa9('0x3c')][_0x3fa9('0x56')]({'where':{'id':_0x523a93[_0x3fa9('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3660c8,null))[_0x3fa9('0x22')](saveUpdates(_0x523a93[_0x3fa9('0x58')],null))['then'](function(_0x270aa7){if(_0x270aa7){_0x3c3b8e[_0x3fa9('0x29')]=_0x270aa7['get']({'plain':!![]});return db['WhatsappInteraction'][_0x3fa9('0x56')]({'where':{'id':_0x270aa7[_0x3fa9('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x3660c8,null))[_0x3fa9('0x22')](function(_0x51819c){if(_0x51819c){return _0x51819c[_0x3fa9('0x39')]({'UserId':_0x523a93[_0x3fa9('0x58')]['UserId'],'read1stAt':_[_0x3fa9('0x65')](_0x51819c['read1stAt'])?moment()['format'](_0x3fa9('0x60')):undefined});}return null;})[_0x3fa9('0x22')](function(_0x1a4a74){if(_0x1a4a74){_0x3c3b8e[_0x3fa9('0x66')]=_0x1a4a74[_0x3fa9('0x67')]({'plain':!![]});interaction_log[_0x3fa9('0x23')](_0x3fa9('0x68'),_0x523a93[_0x3fa9('0x62')]['id'],_0x523a93[_0x3fa9('0x62')]['name'],_0x523a93['user']['role'],_0x3c3b8e[_0x3fa9('0x66')]['id'],_0x523a93['body']?JSON[_0x3fa9('0x69')](_0x523a93[_0x3fa9('0x58')]):'null');return respondWithRpcPromise('AcceptMessage',_0x3fa9('0x6a'),_0x3c3b8e);}return null;})[_0x3fa9('0x22')](function(_0x2b03b1){var _0x1ba9ae=_0x3fa9('0x6b')+_0x2b03b1[_0x3fa9('0x29')][_0x3fa9('0x6c')];return db[_0x3fa9('0x6d')]['query'](_0x1ba9ae,{'type':db[_0x3fa9('0x6e')][_0x3fa9('0x6f')]['SELECT'],'raw':!![]})[_0x3fa9('0x22')](function(_0x38b0ac){return _0x38b0ac;});})[_0x3fa9('0x22')](function(_0x15fa25){if(_0x15fa25){_0x3c3b8e['message']['contact']=_0x15fa25[0x0];if(!_0x523a93[_0x3fa9('0x58')][_0x3fa9('0x61')])return;return db[_0x3fa9('0x70')][_0x3fa9('0x56')]({'where':{'id':_0x523a93['body'][_0x3fa9('0x61')],'role':_0x3fa9('0x63')},'attributes':['id',_0x3fa9('0x3a'),_0x3fa9('0x71'),_0x3fa9('0x72'),_0x3fa9('0x73')],'raw':!![]});}return null;})[_0x3fa9('0x22')](function(_0x496cbd){if(!_0x496cbd)return null;_0x3c3b8e[_0x3fa9('0x29')][_0x3fa9('0x63')]=_0x496cbd;return _0x3c3b8e;})[_0x3fa9('0x22')](function(_0x44be35){if(_0x44be35){if(_0x523a93[_0x3fa9('0x58')][_0x3fa9('0x74')]){_0x3c3b8e['message'][_0x3fa9('0x75')]=util[_0x3fa9('0x5f')](_0x3fa9('0x76'),_0x523a93[_0x3fa9('0x62')][_0x3fa9('0x3a')]);_0x3c3b8e['message'][_0x3fa9('0x77')]=_0x3c3b8e['channel'];_0x3c3b8e['message'][_0x3fa9('0x78')]=_0x3c3b8e['channel'];_0x3c3b8e[_0x3fa9('0x29')][_0x3fa9('0x79')]=_0x3fa9('0x5b');return respondWithRpcPromise(_0x3fa9('0x7a'),_0x3fa9('0x7a'),{'event':_0x3fa9('0x7b'),'message':_0x3c3b8e[_0x3fa9('0x29')]},client9002)['then'](function(){return _0x3c3b8e;});}return _0x3c3b8e;}return null;})[_0x3fa9('0x22')](respondWithResult(_0x3660c8,null))[_0x3fa9('0x2b')](handleError(_0x3660c8,null));};var interaction_log=require('../../config/logger')(_0x3fa9('0x7c'));exports[_0x3fa9('0x37')]=function(_0x1efbd1,_0x510990,_0x138515){var _0x259cab={'agent':{},'channel':_0x3fa9('0x5c')};if(_0x1efbd1[_0x3fa9('0x58')]['id']){delete _0x1efbd1['body']['id'];}_0x1efbd1['body'][_0x3fa9('0x61')]=_0x1efbd1[_0x3fa9('0x58')]['UserId']||_0x1efbd1[_0x3fa9('0x62')]['id'];_0x259cab['agent']['id']=_0x1efbd1[_0x3fa9('0x58')][_0x3fa9('0x61')];return db[_0x3fa9('0x3c')]['find']({'where':{'id':_0x1efbd1[_0x3fa9('0x51')]['id'],'UserId':null}})[_0x3fa9('0x22')](handleEntityNotFound(_0x510990,null))[_0x3fa9('0x22')](function(_0x7808c5){if(_0x7808c5){_0x259cab[_0x3fa9('0x29')]=_0x7808c5[_0x3fa9('0x67')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x7808c5[_0x3fa9('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x510990,null))[_0x3fa9('0x22')](function(_0x532cec){if(_0x532cec){_0x259cab[_0x3fa9('0x66')]=_0x532cec[_0x3fa9('0x67')]({'plain':!![]});interaction_log[_0x3fa9('0x23')](_0x3fa9('0x7d'),_0x1efbd1[_0x3fa9('0x62')]['id'],_0x1efbd1['user'][_0x3fa9('0x3a')],_0x1efbd1[_0x3fa9('0x62')][_0x3fa9('0x7e')],_0x259cab[_0x3fa9('0x66')]['id'],_0x1efbd1[_0x3fa9('0x58')]?JSON[_0x3fa9('0x69')](_0x1efbd1['body']):_0x3fa9('0x7f'));return respondWithRpcPromise('RejectMessage',_0x3fa9('0x80'),_0x259cab);}return null;})[_0x3fa9('0x22')](function(_0x9eda4a){var _0x3d5228=_0x3fa9('0x6b')+_0x9eda4a[_0x3fa9('0x29')][_0x3fa9('0x6c')];return db[_0x3fa9('0x6d')][_0x3fa9('0x41')](_0x3d5228,{'type':db['Sequelize'][_0x3fa9('0x6f')][_0x3fa9('0x81')],'raw':!![]})[_0x3fa9('0x22')](function(_0x11f34d){return _0x11f34d;});})[_0x3fa9('0x22')](function(_0x3ce512){if(_0x3ce512){_0x259cab[_0x3fa9('0x29')][_0x3fa9('0x82')]=_0x3ce512[0x0];if(!_0x1efbd1[_0x3fa9('0x58')]['UserId'])return;return db[_0x3fa9('0x70')][_0x3fa9('0x56')]({'where':{'id':_0x1efbd1[_0x3fa9('0x58')]['UserId'],'role':_0x3fa9('0x63')},'attributes':['id',_0x3fa9('0x3a'),_0x3fa9('0x71'),_0x3fa9('0x72'),_0x3fa9('0x73')],'raw':!![]});}return null;})[_0x3fa9('0x22')](function(_0x5298bb){if(!_0x5298bb)return null;_0x259cab[_0x3fa9('0x29')][_0x3fa9('0x63')]=_0x5298bb;return _0x259cab;})[_0x3fa9('0x22')](function(_0x1946d9){if(_0x1946d9){_0x1946d9[_0x3fa9('0x29')][_0x3fa9('0x75')]=util[_0x3fa9('0x5f')](_0x3fa9('0x76'),_0x1efbd1[_0x3fa9('0x62')][_0x3fa9('0x3a')]);_0x1946d9[_0x3fa9('0x29')][_0x3fa9('0x77')]=_0x259cab[_0x3fa9('0x77')];_0x1946d9[_0x3fa9('0x29')][_0x3fa9('0x78')]=_0x259cab['channel'];_0x1946d9[_0x3fa9('0x29')][_0x3fa9('0x79')]=_0x3fa9('0x37');respondWithRpcPromise(_0x3fa9('0x7a'),'EventManager',{'event':_0x3fa9('0x83'),'message':_0x1946d9[_0x3fa9('0x29')]},client9002);return _0x259cab;}return null;})[_0x3fa9('0x22')](respondWithResult(_0x510990,null))[_0x3fa9('0x2b')](handleError(_0x510990,null));};exports[_0x3fa9('0x2d')]=function(_0x574d80,_0x2689ec,_0x50f424){if(_0x574d80[_0x3fa9('0x58')]['id']){delete _0x574d80[_0x3fa9('0x58')]['id'];}var _0x390fa8;return db['WhatsappMessage'][_0x3fa9('0x56')]({'where':{'id':_0x574d80[_0x3fa9('0x51')]['id']}})[_0x3fa9('0x22')](handleEntityNotFound(_0x2689ec,null))[_0x3fa9('0x22')](function(_0x6c0d29){if(_0x6c0d29){_0x390fa8=_0x6c0d29;return db[_0x3fa9('0x84')][_0x3fa9('0x56')]({'where':{'id':_0x6c0d29[_0x3fa9('0x85')]}});}})['then'](handleEntityNotFound(_0x2689ec,null))[_0x3fa9('0x22')](function(_0xb7489f){if(_0xb7489f){logger[_0x3fa9('0x86')](_0x3fa9('0x87'),'status',_0x3fa9('0x88'),_0xb7489f[_0x3fa9('0x3e')],util['inspect'](_0x574d80[_0x3fa9('0x58')],{'showHidden':![],'depth':null}));switch(_0xb7489f[_0x3fa9('0x3e')]){case _0x3fa9('0x89'):if(_0x574d80[_0x3fa9('0x58')][_0x3fa9('0x8a')]&&_0x574d80['body'][_0x3fa9('0x8a')]===_0x390fa8[_0x3fa9('0x8b')]&&_0x574d80[_0x3fa9('0x58')][_0x3fa9('0x8c')]&&_0x574d80[_0x3fa9('0x58')][_0x3fa9('0x8c')]==='read'){return _0x390fa8[_0x3fa9('0x39')]({'read':!![]});}else{logger[_0x3fa9('0x27')](_0x3fa9('0x8d'),_0x3fa9('0x2d'),_0x3fa9('0x89'),util[_0x3fa9('0x8e')](_0x574d80['body'],{'showHidden':![],'depth':null}));}break;}return _0x390fa8;}})['then'](respondWithResult(_0x2689ec,null))['catch'](handleError(_0x2689ec,null));}; \ No newline at end of file +var _0x2247=['interface','format','channel','motionChannel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','SIP/%s','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','sendStatus','stack','name','send','index','WhatsappMessage','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','sort','where','pick','filter','merge','map','options','includeAll','findAll','show','params','rawAttributes','include','find','create','body','destroy','describe','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual'];(function(_0xa3634d,_0x35f07a){var _0x21066b=function(_0x18eafe){while(--_0x18eafe){_0xa3634d['push'](_0xa3634d['shift']());}};_0x21066b(++_0x35f07a);}(_0x2247,0x9f));var _0x7224=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x2247[_0x342baa];return _0x1208f3;};'use strict';var emlformat=require(_0x7224('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7224('0x1'));var jsonpatch=require(_0x7224('0x2'));var rp=require('request-promise');var moment=require(_0x7224('0x3'));var BPromise=require(_0x7224('0x4'));var Mustache=require(_0x7224('0x5'));var util=require('util');var path=require(_0x7224('0x6'));var sox=require(_0x7224('0x7'));var csv=require(_0x7224('0x8'));var ejs=require(_0x7224('0x9'));var fs=require('fs');var fs_extra=require(_0x7224('0xa'));var _=require(_0x7224('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7224('0xc'));var deskjs=require(_0x7224('0xd'));var toCsv=require(_0x7224('0x8'));var querystring=require(_0x7224('0xe'));var Papa=require(_0x7224('0xf'));var Redis=require('ioredis');var authService=require(_0x7224('0x10'));var qs=require(_0x7224('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7224('0x12'))(_0x7224('0x13'));var utils=require(_0x7224('0x14'));var config=require(_0x7224('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7224('0x16'))['db'];config[_0x7224('0x17')]=_[_0x7224('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7224('0x19'))(new Redis(config['redis']));require(_0x7224('0x1a'))[_0x7224('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7224('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x7224('0x1c')][_0x7224('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4afc15,_0x4816d6,_0x466d11,_0x1629d7){return new BPromise(function(_0x39ce03,_0x20008b){var _0x1d652c=_0x1629d7||client;return _0x1d652c[_0x7224('0x1e')](_0x4afc15,_0x466d11)[_0x7224('0x1f')](function(_0x9415e9){logger[_0x7224('0x20')](_0x7224('0x21'),_0x4816d6,_0x7224('0x22'));logger[_0x7224('0x23')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4816d6,_0x7224('0x22'),JSON[_0x7224('0x24')](_0x9415e9));if(_0x9415e9[_0x7224('0x25')]){if(_0x9415e9[_0x7224('0x25')][_0x7224('0x26')]===0x1f4){logger[_0x7224('0x25')](_0x7224('0x21'),_0x4816d6,_0x9415e9['error'][_0x7224('0x27')]);return _0x20008b(_0x9415e9[_0x7224('0x25')][_0x7224('0x27')]);}logger[_0x7224('0x25')](_0x7224('0x21'),_0x4816d6,_0x9415e9[_0x7224('0x25')][_0x7224('0x27')]);return _0x39ce03(_0x9415e9[_0x7224('0x25')]['message']);}else{logger[_0x7224('0x20')](_0x7224('0x21'),_0x4816d6,_0x7224('0x22'));_0x39ce03(_0x9415e9[_0x7224('0x28')]['message']);}})[_0x7224('0x29')](function(_0x28c8cc){logger[_0x7224('0x25')](_0x7224('0x21'),_0x4816d6,_0x28c8cc);_0x20008b(_0x28c8cc);});});}function respondWithStatusCode(_0x11e92e,_0x491242){_0x491242=_0x491242||0xcc;return function(_0x39f9a8){if(_0x39f9a8){return _0x11e92e['sendStatus'](_0x491242);}return _0x11e92e[_0x7224('0x2a')](_0x491242)[_0x7224('0x2b')]();};}function respondWithResult(_0x3e67b5,_0xddb7a){_0xddb7a=_0xddb7a||0xc8;return function(_0x28445e){if(_0x28445e){return _0x3e67b5[_0x7224('0x2a')](_0xddb7a)[_0x7224('0x2c')](_0x28445e);}};}function respondWithFilteredResult(_0x596150,_0x5f4278){return function(_0x5bcd70){if(_0x5bcd70){var _0x370727=typeof _0x5f4278[_0x7224('0x2d')]===_0x7224('0x2e')&&typeof _0x5f4278['limit']===_0x7224('0x2e');var _0x88903d=_0x5bcd70[_0x7224('0x2f')];var _0x365bd4=_0x370727?0x0:_0x5f4278['offset'];var _0x30a300=_0x370727?_0x5bcd70[_0x7224('0x2f')]:_0x5f4278[_0x7224('0x2d')]+_0x5f4278[_0x7224('0x30')];var _0x476af4;if(_0x30a300>=_0x88903d){_0x30a300=_0x88903d;_0x476af4=0xc8;}else{_0x476af4=0xce;}_0x596150[_0x7224('0x2a')](_0x476af4);return _0x596150[_0x7224('0x31')](_0x7224('0x32'),_0x365bd4+'-'+_0x30a300+'/'+_0x88903d)[_0x7224('0x2c')](_0x5bcd70);}return null;};}function patchUpdates(_0x109d45){return function(_0x52aa15){try{jsonpatch['apply'](_0x52aa15,_0x109d45,!![]);}catch(_0x2aa8d8){return BPromise[_0x7224('0x33')](_0x2aa8d8);}return _0x52aa15[_0x7224('0x34')]();};}function saveUpdates(_0x1413d2,_0x416e56){return function(_0x5341d8){if(_0x5341d8){return _0x5341d8[_0x7224('0x35')](_0x1413d2)['then'](function(_0x520f23){return _0x520f23;});}return null;};}function removeEntity(_0x166469,_0x2edb5d){return function(_0x2bfcfe){if(_0x2bfcfe){return _0x2bfcfe['destroy']()['then'](function(){_0x166469['status'](0xcc)[_0x7224('0x2b')]();});}};}function handleEntityNotFound(_0x2f7b59,_0x33166e){return function(_0x1b6bfc){if(!_0x1b6bfc){_0x2f7b59[_0x7224('0x36')](0x194);}return _0x1b6bfc;};}function handleError(_0x40093b,_0x395d25){_0x395d25=_0x395d25||0x1f4;return function(_0x43a5fc){logger['error'](_0x43a5fc[_0x7224('0x37')]);if(_0x43a5fc[_0x7224('0x38')]){delete _0x43a5fc['name'];}_0x40093b['status'](_0x395d25)[_0x7224('0x39')](_0x43a5fc);};}exports[_0x7224('0x3a')]=function(_0x3f870e,_0x21096a){var _0x40ab75={},_0x4ff019={},_0x4bd672={'count':0x0,'rows':[]};var _0xd12494=_['map'](db[_0x7224('0x3b')]['rawAttributes'],function(_0x3a1d21){return{'name':_0x3a1d21['fieldName'],'type':_0x3a1d21[_0x7224('0x3c')][_0x7224('0x3d')]};});_0x4ff019[_0x7224('0x3e')]=_['map'](_0xd12494,_0x7224('0x38'));_0x4ff019[_0x7224('0x3f')]=_[_0x7224('0x40')](_0x3f870e[_0x7224('0x3f')]);_0x4ff019[_0x7224('0x41')]=_['intersection'](_0x4ff019[_0x7224('0x3e')],_0x4ff019[_0x7224('0x3f')]);_0x40ab75[_0x7224('0x42')]=_[_0x7224('0x43')](_0x4ff019['model'],qs[_0x7224('0x44')](_0x3f870e[_0x7224('0x3f')][_0x7224('0x44')]));_0x40ab75[_0x7224('0x42')]=_0x40ab75[_0x7224('0x42')]['length']?_0x40ab75[_0x7224('0x42')]:_0x4ff019[_0x7224('0x3e')];if(!_0x3f870e['query']['hasOwnProperty'](_0x7224('0x45'))){_0x40ab75[_0x7224('0x30')]=qs['limit'](_0x3f870e['query']['limit']);_0x40ab75[_0x7224('0x2d')]=qs[_0x7224('0x2d')](_0x3f870e[_0x7224('0x3f')]['offset']);}_0x40ab75['order']=qs[_0x7224('0x46')](_0x3f870e['query'][_0x7224('0x46')]);_0x40ab75[_0x7224('0x47')]=qs[_0x7224('0x41')](_[_0x7224('0x48')](_0x3f870e[_0x7224('0x3f')],_0x4ff019['filters']),_0xd12494);if(_0x3f870e[_0x7224('0x3f')][_0x7224('0x49')]){_0x40ab75[_0x7224('0x47')]=_[_0x7224('0x4a')](_0x40ab75['where'],{'$or':_[_0x7224('0x4b')](_0xd12494,function(_0x1ceccd){if(_0x1ceccd[_0x7224('0x3c')]!=='VIRTUAL'){var _0x2d0c9d={};_0x2d0c9d[_0x1ceccd[_0x7224('0x38')]]={'$like':'%'+_0x3f870e[_0x7224('0x3f')][_0x7224('0x49')]+'%'};return _0x2d0c9d;}})});}_0x40ab75=_[_0x7224('0x4a')]({},_0x40ab75,_0x3f870e[_0x7224('0x4c')]);var _0x1eccaf={'where':_0x40ab75['where']};return db['WhatsappMessage'][_0x7224('0x2f')](_0x1eccaf)['then'](function(_0x7978a1){_0x4bd672['count']=_0x7978a1;if(_0x3f870e[_0x7224('0x3f')][_0x7224('0x4d')]){_0x40ab75['include']=[{'all':!![]}];}return db[_0x7224('0x3b')][_0x7224('0x4e')](_0x40ab75);})['then'](function(_0x50a66b){_0x4bd672['rows']=_0x50a66b;return _0x4bd672;})[_0x7224('0x1f')](respondWithFilteredResult(_0x21096a,_0x40ab75))[_0x7224('0x29')](handleError(_0x21096a,null));};exports[_0x7224('0x4f')]=function(_0x31dc29,_0x1cfca3){var _0x254137={'raw':!![],'where':{'id':_0x31dc29[_0x7224('0x50')]['id']}},_0x120d6f={};_0x120d6f['model']=_[_0x7224('0x40')](db[_0x7224('0x3b')][_0x7224('0x51')]);_0x120d6f['query']=_[_0x7224('0x40')](_0x31dc29[_0x7224('0x3f')]);_0x120d6f[_0x7224('0x41')]=_[_0x7224('0x43')](_0x120d6f[_0x7224('0x3e')],_0x120d6f['query']);_0x254137['attributes']=_['intersection'](_0x120d6f[_0x7224('0x3e')],qs[_0x7224('0x44')](_0x31dc29[_0x7224('0x3f')][_0x7224('0x44')]));_0x254137[_0x7224('0x42')]=_0x254137['attributes']['length']?_0x254137[_0x7224('0x42')]:_0x120d6f[_0x7224('0x3e')];if(_0x31dc29[_0x7224('0x3f')][_0x7224('0x4d')]){_0x254137[_0x7224('0x52')]=[{'all':!![]}];}_0x254137=_[_0x7224('0x4a')]({},_0x254137,_0x31dc29['options']);return db[_0x7224('0x3b')][_0x7224('0x53')](_0x254137)['then'](handleEntityNotFound(_0x1cfca3,null))[_0x7224('0x1f')](respondWithResult(_0x1cfca3,null))[_0x7224('0x29')](handleError(_0x1cfca3,null));};exports[_0x7224('0x54')]=function(_0x5a4ea0,_0x2df631){return db[_0x7224('0x3b')][_0x7224('0x54')](_0x5a4ea0[_0x7224('0x55')],{})[_0x7224('0x1f')](respondWithResult(_0x2df631,0xc9))[_0x7224('0x29')](handleError(_0x2df631,null));};exports[_0x7224('0x35')]=function(_0x232fe2,_0x330c19){if(_0x232fe2['body']['id']){delete _0x232fe2[_0x7224('0x55')]['id'];}return db['WhatsappMessage'][_0x7224('0x53')]({'where':{'id':_0x232fe2[_0x7224('0x50')]['id']}})['then'](handleEntityNotFound(_0x330c19,null))[_0x7224('0x1f')](saveUpdates(_0x232fe2['body'],null))['then'](respondWithResult(_0x330c19,null))[_0x7224('0x29')](handleError(_0x330c19,null));};exports[_0x7224('0x56')]=function(_0x1520bd,_0x2bb9ab){return db[_0x7224('0x3b')][_0x7224('0x53')]({'where':{'id':_0x1520bd[_0x7224('0x50')]['id']}})[_0x7224('0x1f')](handleEntityNotFound(_0x2bb9ab,null))[_0x7224('0x1f')](removeEntity(_0x2bb9ab,null))['catch'](handleError(_0x2bb9ab,null));};exports[_0x7224('0x57')]=function(_0x5e5e8a,_0x4ae0fc){return db['WhatsappMessage'][_0x7224('0x57')]()[_0x7224('0x1f')](respondWithResult(_0x4ae0fc,null))['catch'](handleError(_0x4ae0fc,null));};var interaction_log=require(_0x7224('0x12'))(_0x7224('0x58'));exports[_0x7224('0x59')]=function(_0x5641ef,_0x2c231a,_0x11bbe3){var _0x41f268={'agent':{},'channel':_0x7224('0x5a')};if(_0x5641ef[_0x7224('0x55')]['id']){delete _0x5641ef[_0x7224('0x55')]['id'];}_0x5641ef['body'][_0x7224('0x5b')]=!![];_0x5641ef[_0x7224('0x55')][_0x7224('0x5c')]=moment()['format'](_0x7224('0x5d'));_0x5641ef[_0x7224('0x55')][_0x7224('0x5e')]=_0x5641ef[_0x7224('0x55')][_0x7224('0x5e')]||_0x5641ef[_0x7224('0x5f')]['id'];_0x41f268[_0x7224('0x60')]['id']=_0x5641ef[_0x7224('0x55')][_0x7224('0x5e')];return db['WhatsappMessage'][_0x7224('0x53')]({'where':{'id':_0x5641ef[_0x7224('0x50')]['id'],'UserId':null}})[_0x7224('0x1f')](handleEntityNotFound(_0x2c231a,null))['then'](saveUpdates(_0x5641ef[_0x7224('0x55')],null))[_0x7224('0x1f')](function(_0x3f2e18){if(_0x3f2e18){_0x41f268[_0x7224('0x27')]=_0x3f2e18[_0x7224('0x61')]({'plain':!![]});return db[_0x7224('0x62')]['find']({'where':{'id':_0x3f2e18['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2c231a,null))[_0x7224('0x1f')](function(_0x2f4e7d){if(_0x2f4e7d){return _0x2f4e7d[_0x7224('0x35')]({'UserId':_0x5641ef['body'][_0x7224('0x5e')],'read1stAt':_['isNil'](_0x2f4e7d[_0x7224('0x63')])?moment()['format'](_0x7224('0x5d')):undefined});}return null;})['then'](function(_0x3d1367){if(_0x3d1367){_0x41f268[_0x7224('0x64')]=_0x3d1367[_0x7224('0x61')]({'plain':!![]});interaction_log[_0x7224('0x20')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5641ef['user']['id'],_0x5641ef[_0x7224('0x5f')]['name'],_0x5641ef[_0x7224('0x5f')][_0x7224('0x65')],_0x41f268[_0x7224('0x64')]['id'],_0x5641ef[_0x7224('0x55')]?JSON[_0x7224('0x24')](_0x5641ef[_0x7224('0x55')]):_0x7224('0x66'));return respondWithRpcPromise(_0x7224('0x67'),_0x7224('0x68'),_0x41f268);}return null;})[_0x7224('0x1f')](function(_0x2f3aae){var _0x41decf='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2f3aae[_0x7224('0x27')][_0x7224('0x69')];return db[_0x7224('0x6a')][_0x7224('0x3f')](_0x41decf,{'type':db[_0x7224('0x6b')][_0x7224('0x6c')]['SELECT'],'raw':!![]})[_0x7224('0x1f')](function(_0x51db87){return _0x51db87;});})['then'](function(_0x10bc5f){if(_0x10bc5f){_0x41f268[_0x7224('0x27')][_0x7224('0x6d')]=_0x10bc5f[0x0];if(!_0x5641ef[_0x7224('0x55')][_0x7224('0x5e')])return;return db[_0x7224('0x6e')][_0x7224('0x53')]({'where':{'id':_0x5641ef[_0x7224('0x55')][_0x7224('0x5e')],'role':_0x7224('0x60')},'attributes':['id',_0x7224('0x38'),_0x7224('0x6f'),_0x7224('0x70'),_0x7224('0x71')],'raw':!![]});}return null;})['then'](function(_0x3ea546){if(!_0x3ea546)return null;_0x41f268['message'][_0x7224('0x60')]=_0x3ea546;return _0x41f268;})[_0x7224('0x1f')](function(_0x531ece){if(_0x531ece){if(_0x5641ef['body'][_0x7224('0x72')]){_0x41f268[_0x7224('0x27')][_0x7224('0x73')]=util[_0x7224('0x74')]('SIP/%s',_0x5641ef[_0x7224('0x5f')][_0x7224('0x38')]);_0x41f268[_0x7224('0x27')][_0x7224('0x75')]=_0x41f268[_0x7224('0x75')];_0x41f268[_0x7224('0x27')][_0x7224('0x76')]=_0x41f268[_0x7224('0x75')];_0x41f268[_0x7224('0x27')][_0x7224('0x77')]=_0x7224('0x59');return respondWithRpcPromise(_0x7224('0x78'),_0x7224('0x78'),{'event':_0x7224('0x79'),'message':_0x41f268[_0x7224('0x27')]},client9002)[_0x7224('0x1f')](function(){return _0x41f268;});}return _0x41f268;}return null;})['then'](respondWithResult(_0x2c231a,null))[_0x7224('0x29')](handleError(_0x2c231a,null));};var interaction_log=require(_0x7224('0x12'))(_0x7224('0x58'));exports[_0x7224('0x33')]=function(_0x25ef41,_0x1594b4,_0x1f40c6){var _0x349bde={'agent':{},'channel':_0x7224('0x5a')};if(_0x25ef41['body']['id']){delete _0x25ef41[_0x7224('0x55')]['id'];}_0x25ef41['body'][_0x7224('0x5e')]=_0x25ef41['body']['UserId']||_0x25ef41[_0x7224('0x5f')]['id'];_0x349bde[_0x7224('0x60')]['id']=_0x25ef41[_0x7224('0x55')][_0x7224('0x5e')];return db[_0x7224('0x3b')]['find']({'where':{'id':_0x25ef41['params']['id'],'UserId':null}})[_0x7224('0x1f')](handleEntityNotFound(_0x1594b4,null))[_0x7224('0x1f')](function(_0x1b0da9){if(_0x1b0da9){_0x349bde[_0x7224('0x27')]=_0x1b0da9['get']({'plain':!![]});return db[_0x7224('0x62')]['find']({'where':{'id':_0x1b0da9['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1594b4,null))[_0x7224('0x1f')](function(_0x1bcd6b){if(_0x1bcd6b){_0x349bde[_0x7224('0x64')]=_0x1bcd6b['get']({'plain':!![]});interaction_log[_0x7224('0x20')](_0x7224('0x7a'),_0x25ef41[_0x7224('0x5f')]['id'],_0x25ef41[_0x7224('0x5f')]['name'],_0x25ef41[_0x7224('0x5f')]['role'],_0x349bde['interaction']['id'],_0x25ef41[_0x7224('0x55')]?JSON['stringify'](_0x25ef41[_0x7224('0x55')]):'null');return respondWithRpcPromise(_0x7224('0x7b'),'rejectMessage',_0x349bde);}return null;})[_0x7224('0x1f')](function(_0x4cde67){var _0x37a64f=_0x7224('0x7c')+_0x4cde67[_0x7224('0x27')][_0x7224('0x69')];return db['sequelize'][_0x7224('0x3f')](_0x37a64f,{'type':db['Sequelize']['QueryTypes'][_0x7224('0x7d')],'raw':!![]})[_0x7224('0x1f')](function(_0x256b56){return _0x256b56;});})[_0x7224('0x1f')](function(_0x12e2a6){if(_0x12e2a6){_0x349bde['message']['contact']=_0x12e2a6[0x0];if(!_0x25ef41[_0x7224('0x55')]['UserId'])return;return db[_0x7224('0x6e')][_0x7224('0x53')]({'where':{'id':_0x25ef41['body'][_0x7224('0x5e')],'role':_0x7224('0x60')},'attributes':['id',_0x7224('0x38'),_0x7224('0x6f'),_0x7224('0x70'),_0x7224('0x71')],'raw':!![]});}return null;})[_0x7224('0x1f')](function(_0x5240fd){if(!_0x5240fd)return null;_0x349bde[_0x7224('0x27')][_0x7224('0x60')]=_0x5240fd;return _0x349bde;})[_0x7224('0x1f')](function(_0x531619){if(_0x531619){_0x531619[_0x7224('0x27')]['interface']=util[_0x7224('0x74')](_0x7224('0x7e'),_0x25ef41[_0x7224('0x5f')]['name']);_0x531619['message'][_0x7224('0x75')]=_0x349bde['channel'];_0x531619[_0x7224('0x27')][_0x7224('0x76')]=_0x349bde[_0x7224('0x75')];_0x531619[_0x7224('0x27')][_0x7224('0x77')]=_0x7224('0x33');respondWithRpcPromise(_0x7224('0x78'),_0x7224('0x78'),{'event':_0x7224('0x7f'),'message':_0x531619[_0x7224('0x27')]},client9002);return _0x349bde;}return null;})[_0x7224('0x1f')](respondWithResult(_0x1594b4,null))[_0x7224('0x29')](handleError(_0x1594b4,null));};exports[_0x7224('0x2a')]=function(_0x34d8ec,_0x2ec06b,_0x4ac325){if(_0x34d8ec[_0x7224('0x55')]['id']){delete _0x34d8ec[_0x7224('0x55')]['id'];}var _0x4aab3f;return db['WhatsappMessage'][_0x7224('0x53')]({'where':{'id':_0x34d8ec[_0x7224('0x50')]['id']}})[_0x7224('0x1f')](handleEntityNotFound(_0x2ec06b,null))[_0x7224('0x1f')](function(_0x50ad9d){if(_0x50ad9d){_0x4aab3f=_0x50ad9d;return db[_0x7224('0x80')][_0x7224('0x53')]({'where':{'id':_0x50ad9d[_0x7224('0x81')]}});}})['then'](handleEntityNotFound(_0x2ec06b,null))[_0x7224('0x1f')](function(_0x31fcc1){if(_0x31fcc1){logger[_0x7224('0x23')](_0x7224('0x82'),_0x7224('0x2a'),'received\x20delivery\x20report\x20from',_0x31fcc1['type'],util[_0x7224('0x83')](_0x34d8ec[_0x7224('0x55')],{'showHidden':![],'depth':null}));switch(_0x31fcc1[_0x7224('0x3c')]){case _0x7224('0x84'):if(_0x34d8ec['body']['MessageSid']&&_0x34d8ec[_0x7224('0x55')][_0x7224('0x85')]===_0x4aab3f[_0x7224('0x86')]&&_0x34d8ec[_0x7224('0x55')][_0x7224('0x87')]&&_0x34d8ec[_0x7224('0x55')][_0x7224('0x87')]===_0x7224('0x5b')){return _0x4aab3f[_0x7224('0x35')]({'read':!![]});}else{logger[_0x7224('0x25')](_0x7224('0x88'),_0x7224('0x2a'),_0x7224('0x84'),util['inspect'](_0x34d8ec[_0x7224('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x4aab3f;}})['then'](respondWithResult(_0x2ec06b,null))[_0x7224('0x29')](handleError(_0x2ec06b,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index df78f2e..bfba23b 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 _0xa699=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x4ad364,_0x34d600){var _0x1ace8f=function(_0x4f4503){while(--_0x4f4503){_0x4ad364['push'](_0x4ad364['shift']());}};_0x1ace8f(++_0x34d600);}(_0xa699,0x6b));var _0x9a69=function(_0x10bcc4,_0x4400e2){_0x10bcc4=_0x10bcc4-0x0;var _0x2da988=_0xa699[_0x10bcc4];return _0x2da988;};'use strict';var EventEmitter=require(_0x9a69('0x0'));var WhatsappMessage=require(_0x9a69('0x1'))['db'][_0x9a69('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x9a69('0x3')](0x0);var events={'afterCreate':_0x9a69('0x4'),'afterUpdate':_0x9a69('0x5'),'afterDestroy':_0x9a69('0x6')};function emitEvent(_0x2d3e1f){return function(_0xadacc9,_0x3edccc,_0x143c4f){WhatsappMessageEvents[_0x9a69('0x7')](_0x2d3e1f+':'+_0xadacc9['id'],_0xadacc9);WhatsappMessageEvents[_0x9a69('0x7')](_0x2d3e1f,_0xadacc9);_0x143c4f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x9a69('0x8')](e,emitEvent(event));}}module[_0x9a69('0x9')]=WhatsappMessageEvents; \ No newline at end of file +var _0x236c=['WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x11ad65,_0x352d3c){var _0x35590c=function(_0x2c3845){while(--_0x2c3845){_0x11ad65['push'](_0x11ad65['shift']());}};_0x35590c(++_0x352d3c);}(_0x236c,0x155));var _0xc236=function(_0x2bbd6f,_0x5c40fa){_0x2bbd6f=_0x2bbd6f-0x0;var _0x1cdfb0=_0x236c[_0x2bbd6f];return _0x1cdfb0;};'use strict';var EventEmitter=require(_0xc236('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xc236('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xc236('0x2')](0x0);var events={'afterCreate':_0xc236('0x3'),'afterUpdate':_0xc236('0x4'),'afterDestroy':_0xc236('0x5')};function emitEvent(_0x518d6a){return function(_0x3adce9,_0x36e87d,_0x33bc57){WhatsappMessageEvents[_0xc236('0x6')](_0x518d6a+':'+_0x3adce9['id'],_0x3adce9);WhatsappMessageEvents[_0xc236('0x6')](_0x518d6a,_0x3adce9);_0x33bc57(null);};}for(var e in events){if(events[_0xc236('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xc236('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 22bc772..adc9f21 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 _0x4a3c=['FULLTEXT','models','get','direction','toLowerCase','out','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','error','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','message_id','statuses','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','../../config/logger','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','fti_whatsapp_messages','body'];(function(_0x1574ec,_0x2201fc){var _0x47f1ba=function(_0x31eeac){while(--_0x31eeac){_0x1574ec['push'](_0x1574ec['shift']());}};_0x47f1ba(++_0x2201fc);}(_0x4a3c,0x198));var _0xc4a3=function(_0x5a483d,_0x19a25e){_0x5a483d=_0x5a483d-0x0;var _0x26a1df=_0x4a3c[_0x5a483d];return _0x26a1df;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc4a3('0x0'))('api');var moment=require('moment');var BPromise=require(_0xc4a3('0x1'));var rp=require(_0xc4a3('0x2'));var fetch=require(_0xc4a3('0x3'));var fs=require('fs');var path=require(_0xc4a3('0x4'));var rimraf=require(_0xc4a3('0x5'));var config=require(_0xc4a3('0x6'));var attributes=require(_0xc4a3('0x7'));module[_0xc4a3('0x8')]=function(_0x2623a4,_0x372062){return _0x2623a4['define'](_0xc4a3('0x9'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0xc4a3('0xa'),'fields':[_0xc4a3('0xb')],'type':_0xc4a3('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x519141,_0x5aa5ac,_0x123d29){var _0x1a9f88=_0x2623a4[_0xc4a3('0xd')];var _0x2daf2c=_0x519141[_0xc4a3('0xe')]({'plain':!![]});if(_0x2daf2c[_0xc4a3('0xf')]['toLowerCase']()==='in'||_0x2daf2c[_0xc4a3('0xf')][_0xc4a3('0x10')]()===_0xc4a3('0x11')&&!_0x2daf2c['secret']&&!_[_0xc4a3('0x12')](_0x2daf2c['UserId'])){_0x1a9f88[_0xc4a3('0x13')][_0xc4a3('0x14')]({'where':{'id':_0x2daf2c[_0xc4a3('0x15')]}})[_0xc4a3('0x16')](function(_0x590a15){if(_0x590a15){_0x590a15[_0xc4a3('0x17')]({'lastMsgAt':_0x2daf2c[_0xc4a3('0x18')],'lastMsgDirection':_0x2daf2c[_0xc4a3('0xf')]['toLowerCase']()});}})['catch'](function(_0x177397){console[_0xc4a3('0x19')](_0x177397);});}if(_0x2daf2c[_0xc4a3('0xf')]===_0xc4a3('0x11')&&!_0x2daf2c[_0xc4a3('0x1a')]){var _0xfb1814;_0x1a9f88[_0xc4a3('0x1b')][_0xc4a3('0x1c')]({'where':{'id':_0x2daf2c[_0xc4a3('0x1d')]},'raw':!![]})[_0xc4a3('0x16')](function(_0x4e8cc8){_0xfb1814=_0x4e8cc8;if(_0xfb1814&&_0xfb1814[_0xc4a3('0x1e')]){switch(_0xfb1814['type']){case'twilio':var _0x3ac8fd=require(_0xc4a3('0x1f'));if(_0xfb1814[_0xc4a3('0x20')]&&_0xfb1814[_0xc4a3('0x21')]&&_0xfb1814[_0xc4a3('0x22')]){var _0x57b528=new _0x3ac8fd(_0xfb1814[_0xc4a3('0x20')],_0xfb1814[_0xc4a3('0x21')]);_0x57b528['messages'][_0xc4a3('0x23')]({'body':_0x2daf2c[_0xc4a3('0xb')],'to':_0xc4a3('0x24')+_0x2daf2c[_0xc4a3('0x22')],'from':_0xc4a3('0x24')+_0xfb1814[_0xc4a3('0x22')],'statusCallback':_0xfb1814[_0xc4a3('0x25')]+_0xc4a3('0x26')+_0x2daf2c['id']+_0xc4a3('0x27')+_0xfb1814[_0xc4a3('0x28')]})[_0xc4a3('0x16')](function(_0x1a0300){if(_0x1a0300[_0xc4a3('0x29')]){return _0x519141[_0xc4a3('0x17')]({'messageId':_0x1a0300[_0xc4a3('0x29')]});}})[_0xc4a3('0x2a')](function(_0x42e8c4){logger[_0xc4a3('0x19')](_0xc4a3('0x2b'),'afterCreate',_0xc4a3('0x1f'),util[_0xc4a3('0x2c')](_0x42e8c4,{'showHidden':![],'depth':null}));});}else{logger[_0xc4a3('0x19')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xc4a3('0x2d'),_0xc4a3('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xc4a3('0x2e'):var _0x32fd1b=_0xfb1814[_0xc4a3('0x20')];var _0x4bd5f4=_0xfb1814[_0xc4a3('0x21')];var _0xbc505a=_0xfb1814[_0xc4a3('0x2f')]+_0xc4a3('0x30')+_0x32fd1b+_0xc4a3('0x31');var _0x262dc3={'to':[_0x2daf2c[_0xc4a3('0x22')]],'message':{'type':_0xc4a3('0x32'),'text':_0x2daf2c['body']}};var _0xf6b5={'method':_0xc4a3('0x33'),'uri':_0xbc505a,'headers':{'Authorization':_0xc4a3('0x34')+_0x4bd5f4,'Content-Type':_0xc4a3('0x35')},'body':_0x262dc3,'json':!![]};rp(_0xf6b5)[_0xc4a3('0x16')](function(_0x14576c){if(_0x14576c['statuses'][0x0][_0xc4a3('0x36')]){return _0x519141[_0xc4a3('0x17')]({'messageId':_0x14576c[_0xc4a3('0x37')][0x0][_0xc4a3('0x36')]});}})[_0xc4a3('0x2a')](function(_0x403691){logger[_0xc4a3('0x38')](_0xc4a3('0x39'),_0x403691);});break;}}})[_0xc4a3('0x3a')](function(){_0x123d29();});}else{_0x123d29();}}},'charset':'utf8mb4','collate':_0xc4a3('0x3b')});}; \ No newline at end of file +var _0xc0de=['../../config/logger','bluebird','node-fetch','path','rimraf','../../config/environment','exports','WhatsappMessage','messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','findOne','then','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','update','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4','lodash','util'];(function(_0x590b63,_0x14debb){var _0x3c9380=function(_0x58fc67){while(--_0x58fc67){_0x590b63['push'](_0x590b63['shift']());}};_0x3c9380(++_0x14debb);}(_0xc0de,0xac));var _0xec0d=function(_0x359c73,_0x5b4f6a){_0x359c73=_0x359c73-0x0;var _0x5aed82=_0xc0de[_0x359c73];return _0x5aed82;};'use strict';var _=require(_0xec0d('0x0'));var util=require(_0xec0d('0x1'));var logger=require(_0xec0d('0x2'))('api');var moment=require('moment');var BPromise=require(_0xec0d('0x3'));var rp=require('request-promise');var fetch=require(_0xec0d('0x4'));var fs=require('fs');var path=require(_0xec0d('0x5'));var rimraf=require(_0xec0d('0x6'));var config=require(_0xec0d('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0xec0d('0x8')]=function(_0x511162,_0x1e92c8){return _0x511162['define'](_0xec0d('0x9'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xec0d('0xa'),'fields':[_0xec0d('0xa')]},{'name':_0xec0d('0xb'),'fields':[_0xec0d('0xc')],'type':_0xec0d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x135496,_0x175274,_0x3514f0){var _0x41828f=_0x511162['models'];var _0x228ed3=_0x135496[_0xec0d('0xe')]({'plain':!![]});if(_0x228ed3[_0xec0d('0xf')][_0xec0d('0x10')]()==='in'||_0x228ed3[_0xec0d('0xf')][_0xec0d('0x10')]()===_0xec0d('0x11')&&!_0x228ed3[_0xec0d('0x12')]&&!_[_0xec0d('0x13')](_0x228ed3['UserId'])){_0x41828f[_0xec0d('0x14')][_0xec0d('0x15')]({'where':{'id':_0x228ed3['WhatsappInteractionId']}})[_0xec0d('0x16')](function(_0x1e0a5d){if(_0x1e0a5d){_0x1e0a5d['update']({'lastMsgAt':_0x228ed3['createdAt'],'lastMsgDirection':_0x228ed3[_0xec0d('0xf')][_0xec0d('0x10')]()});}})[_0xec0d('0x17')](function(_0x5724f2){console[_0xec0d('0x18')](_0x5724f2);});}if(_0x228ed3['direction']==='out'&&!_0x228ed3[_0xec0d('0x12')]){var _0x5a0cba;_0x41828f[_0xec0d('0x19')][_0xec0d('0x1a')]({'where':{'id':_0x228ed3[_0xec0d('0x1b')]},'raw':!![]})['then'](function(_0x2d650f){_0x5a0cba=_0x2d650f;if(_0x5a0cba&&_0x5a0cba[_0xec0d('0x1c')]){switch(_0x5a0cba[_0xec0d('0x1c')]){case _0xec0d('0x1d'):var _0x1de275=require(_0xec0d('0x1d'));if(_0x5a0cba[_0xec0d('0x1e')]&&_0x5a0cba['authToken']&&_0x5a0cba[_0xec0d('0x1f')]){var _0x45465f=new _0x1de275(_0x5a0cba[_0xec0d('0x1e')],_0x5a0cba[_0xec0d('0x20')]);_0x45465f[_0xec0d('0x21')][_0xec0d('0x22')]({'body':_0x228ed3[_0xec0d('0xc')],'to':_0xec0d('0x23')+_0x228ed3[_0xec0d('0x1f')],'from':_0xec0d('0x23')+_0x5a0cba[_0xec0d('0x1f')],'statusCallback':_0x5a0cba['remote']+_0xec0d('0x24')+_0x228ed3['id']+_0xec0d('0x25')+_0x5a0cba[_0xec0d('0x26')]})[_0xec0d('0x16')](function(_0x585f44){if(_0x585f44[_0xec0d('0x27')]){return _0x135496[_0xec0d('0x28')]({'messageId':_0x585f44[_0xec0d('0x27')]});}})[_0xec0d('0x17')](function(_0x53a565){logger[_0xec0d('0x18')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',util[_0xec0d('0x29')](_0x53a565,{'showHidden':![],'depth':null}));});}else{logger[_0xec0d('0x18')](_0xec0d('0x2a'),_0xec0d('0x2b'),'twilio',_0xec0d('0x2c'));}break;case _0xec0d('0x2d'):var _0x129dae=_0x5a0cba[_0xec0d('0x1e')];var _0x33cb09=_0x5a0cba[_0xec0d('0x20')];var _0x419b44=_0x5a0cba[_0xec0d('0x2e')]+_0xec0d('0x2f')+_0x129dae+_0xec0d('0x30');var _0xf43676={'to':[_0x228ed3[_0xec0d('0x1f')]],'message':{'type':_0xec0d('0x31'),'text':_0x228ed3[_0xec0d('0xc')]}};var _0x34553b={'method':_0xec0d('0x32'),'uri':_0x419b44,'headers':{'Authorization':_0xec0d('0x33')+_0x33cb09,'Content-Type':_0xec0d('0x34')},'body':_0xf43676,'json':!![]};rp(_0x34553b)[_0xec0d('0x16')](function(_0x48a9a2){if(_0x48a9a2[_0xec0d('0x35')][0x0][_0xec0d('0x36')]){return _0x135496['update']({'messageId':_0x48a9a2[_0xec0d('0x35')][0x0][_0xec0d('0x36')]});}})['catch'](function(_0x142c5b){logger[_0xec0d('0x37')](_0xec0d('0x38'),_0x142c5b);});break;}}})['finally'](function(){_0x3514f0();});}else{_0x3514f0();}}},'charset':_0xec0d('0x39'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 9ba0b83..164b939 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 _0xde2c=['../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./whatsappMessage.socket','register','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateWhatsappMessage','body','options','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x4e9861,_0x25fe5f){var _0x49802f=function(_0x76932){while(--_0x76932){_0x4e9861['push'](_0x4e9861['shift']());}};_0x49802f(++_0x25fe5f);}(_0xde2c,0x154));var _0xcde2=function(_0x5f519b,_0x5b606f){_0x5f519b=_0x5f519b-0x0;var _0x2461e2=_0xde2c[_0x5f519b];return _0x2461e2;};'use strict';var _=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var moment=require(_0xcde2('0x2'));var BPromise=require('bluebird');var rs=require(_0xcde2('0x3'));var fs=require('fs');var Redis=require(_0xcde2('0x4'));var db=require(_0xcde2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcde2('0x6'))(_0xcde2('0x7'));var config=require(_0xcde2('0x8'));var jayson=require(_0xcde2('0x9'));var client=jayson[_0xcde2('0xa')]['http']({'port':0x232a});config['redis']=_[_0xcde2('0xb')](config['redis'],{'host':_0xcde2('0xc'),'port':0x18eb});var socket=require(_0xcde2('0xd'))(new Redis(config[_0xcde2('0xe')]));require(_0xcde2('0xf'))[_0xcde2('0x10')](socket);function respondWithRpcPromise(_0x4b891d,_0x2ede97,_0x27d2b9){return new BPromise(function(_0x52829b,_0x4d9323){return client['request'](_0x4b891d,_0x27d2b9)[_0xcde2('0x11')](function(_0x4ee98d){logger[_0xcde2('0x12')](_0xcde2('0x13'),_0x2ede97,'request\x20sent');logger[_0xcde2('0x14')](_0xcde2('0x15'),_0x2ede97,'request\x20sent',JSON['stringify'](_0x4ee98d));if(_0x4ee98d['error']){if(_0x4ee98d[_0xcde2('0x16')]['code']===0x1f4){logger[_0xcde2('0x16')](_0xcde2('0x13'),_0x2ede97,_0x4ee98d[_0xcde2('0x16')][_0xcde2('0x17')]);return _0x4d9323(_0x4ee98d[_0xcde2('0x16')][_0xcde2('0x17')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x2ede97,_0x4ee98d['error'][_0xcde2('0x17')]);return _0x52829b(_0x4ee98d['error'][_0xcde2('0x17')]);}else{logger['info'](_0xcde2('0x13'),_0x2ede97,'request\x20sent');_0x52829b(_0x4ee98d[_0xcde2('0x18')][_0xcde2('0x17')]);}})[_0xcde2('0x19')](function(_0x44018a){logger[_0xcde2('0x16')](_0xcde2('0x13'),_0x2ede97,_0x44018a);_0x4d9323(_0x44018a);});});}exports[_0xcde2('0x1a')]=function(_0x208125){var _0x1f94a5=this;return new Promise(function(_0xf0b459,_0xe78610){return db['WhatsappMessage']['create'](_0x208125[_0xcde2('0x1b')],{'raw':_0x208125[_0xcde2('0x1c')]?_0x208125['options']['raw']===undefined?!![]:![]:!![]})[_0xcde2('0x11')](function(_0x26abe5){logger[_0xcde2('0x12')](_0xcde2('0x1a'),_0x208125);logger[_0xcde2('0x14')]('CreateWhatsappMessage',_0x208125,JSON['stringify'](_0x26abe5));_0xf0b459(_0x26abe5);})['catch'](function(_0xe5443c){logger[_0xcde2('0x16')](_0xcde2('0x1a'),_0xe5443c[_0xcde2('0x17')],_0x208125);_0xe78610(_0x1f94a5['error'](0x1f4,_0xe5443c[_0xcde2('0x17')]));});});}; \ No newline at end of file +var _0x9d78=['result','catch','create','options','CreateWhatsappMessage','bluebird','randomstring','ioredis','../../config/utils','rpc','redis','defaults','socket.io-emitter','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9d78,0x1cd));var _0x89d7=function(_0x25ca44,_0x111633){_0x25ca44=_0x25ca44-0x0;var _0x4897c1=_0x9d78[_0x25ca44];return _0x4897c1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x89d7('0x0'));var rs=require(_0x89d7('0x1'));var fs=require('fs');var Redis=require(_0x89d7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x89d7('0x3'));var logger=require('../../config/logger')(_0x89d7('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x89d7('0x5')]=_[_0x89d7('0x6')](config[_0x89d7('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x89d7('0x7'))(new Redis(config[_0x89d7('0x5')]));require('./whatsappMessage.socket')[_0x89d7('0x8')](socket);function respondWithRpcPromise(_0x1ff693,_0x2c6c8b,_0xb2e36b){return new BPromise(function(_0x2c234f,_0x189a60){return client[_0x89d7('0x9')](_0x1ff693,_0xb2e36b)[_0x89d7('0xa')](function(_0x5b9abc){logger[_0x89d7('0xb')](_0x89d7('0xc'),_0x2c6c8b,'request\x20sent');logger[_0x89d7('0xd')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x2c6c8b,'request\x20sent',JSON[_0x89d7('0xe')](_0x5b9abc));if(_0x5b9abc[_0x89d7('0xf')]){if(_0x5b9abc[_0x89d7('0xf')][_0x89d7('0x10')]===0x1f4){logger[_0x89d7('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0x2c6c8b,_0x5b9abc[_0x89d7('0xf')][_0x89d7('0x11')]);return _0x189a60(_0x5b9abc[_0x89d7('0xf')][_0x89d7('0x11')]);}logger[_0x89d7('0xf')](_0x89d7('0xc'),_0x2c6c8b,_0x5b9abc[_0x89d7('0xf')]['message']);return _0x2c234f(_0x5b9abc['error'][_0x89d7('0x11')]);}else{logger[_0x89d7('0xb')]('WhatsappMessage,\x20%s,\x20%s',_0x2c6c8b,_0x89d7('0x12'));_0x2c234f(_0x5b9abc[_0x89d7('0x13')]['message']);}})[_0x89d7('0x14')](function(_0x402927){logger[_0x89d7('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0x2c6c8b,_0x402927);_0x189a60(_0x402927);});});}exports['CreateWhatsappMessage']=function(_0xf72139){var _0x2eb622=this;return new Promise(function(_0x39d23e,_0x34fb92){return db['WhatsappMessage'][_0x89d7('0x15')](_0xf72139['body'],{'raw':_0xf72139[_0x89d7('0x16')]?_0xf72139[_0x89d7('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1c5ad8){logger[_0x89d7('0xb')]('CreateWhatsappMessage',_0xf72139);logger[_0x89d7('0xd')](_0x89d7('0x17'),_0xf72139,JSON[_0x89d7('0xe')](_0x1c5ad8));_0x39d23e(_0x1c5ad8);})[_0x89d7('0x14')](function(_0x53be46){logger[_0x89d7('0xf')](_0x89d7('0x17'),_0x53be46['message'],_0xf72139);_0x34fb92(_0x2eb622[_0x89d7('0xf')](0x1f4,_0x53be46[_0x89d7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 3a31316..dfed9b2 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 _0x267a=['emit','removeListener','length','whatsappMessage:','./whatsappMessage.events','save','remove','update'];(function(_0x33df33,_0x1477b6){var _0x521172=function(_0x419491){while(--_0x419491){_0x33df33['push'](_0x33df33['shift']());}};_0x521172(++_0x1477b6);}(_0x267a,0xcc));var _0xa267=function(_0x422ac3,_0x48bbd4){_0x422ac3=_0x422ac3-0x0;var _0x53c0d4=_0x267a[_0x422ac3];return _0x53c0d4;};'use strict';var WhatsappMessageEvents=require(_0xa267('0x0'));var events=[_0xa267('0x1'),_0xa267('0x2'),_0xa267('0x3')];function createListener(_0x5b702e,_0x49efd0){return function(_0x1fb481){_0x49efd0[_0xa267('0x4')](_0x5b702e,_0x1fb481);};}function removeListener(_0x230175,_0x17f57f){return function(){WhatsappMessageEvents[_0xa267('0x5')](_0x230175,_0x17f57f);};}exports['register']=function(_0x30c2de){for(var _0x36055c=0x0,_0x32b882=events[_0xa267('0x6')];_0x36055c<_0x32b882;_0x36055c++){var _0x598412=events[_0x36055c];var _0x4bb4d1=createListener(_0xa267('0x7')+_0x598412,_0x30c2de);WhatsappMessageEvents['on'](_0x598412,_0x4bb4d1);}}; \ No newline at end of file +var _0x9002=['remove','removeListener','register','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x51d4b2,_0x36df9f){var _0x1e36c8=function(_0x1056b7){while(--_0x1056b7){_0x51d4b2['push'](_0x51d4b2['shift']());}};_0x1e36c8(++_0x36df9f);}(_0x9002,0x106));var _0x2900=function(_0x7785a6,_0x437884){_0x7785a6=_0x7785a6-0x0;var _0x59c7ee=_0x9002[_0x7785a6];return _0x59c7ee;};'use strict';var WhatsappMessageEvents=require(_0x2900('0x0'));var events=[_0x2900('0x1'),_0x2900('0x2'),'update'];function createListener(_0x5c569d,_0xa082d0){return function(_0x403b27){_0xa082d0['emit'](_0x5c569d,_0x403b27);};}function removeListener(_0xc9850b,_0x19d68a){return function(){WhatsappMessageEvents[_0x2900('0x3')](_0xc9850b,_0x19d68a);};}exports[_0x2900('0x4')]=function(_0x100798){for(var _0x50d09e=0x0,_0x1e70e3=events['length'];_0x50d09e<_0x1e70e3;_0x50d09e++){var _0x5cd64c=events[_0x50d09e];var _0x265639=createListener(_0x2900('0x5')+_0x5cd64c,_0x100798);WhatsappMessageEvents['on'](_0x5cd64c,_0x265639);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index ca6bdd0..86d9074 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 _0xa524=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getAgents','create','post','addTeams','/:id/users','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xa524,0x178));var _0x4a52=function(_0x308c00,_0x3cbd67){_0x308c00=_0x308c00-0x0;var _0x2b21b2=_0xa524[_0x308c00];return _0x2b21b2;};'use strict';var multer=require('multer');var util=require(_0x4a52('0x0'));var path=require(_0x4a52('0x1'));var timeout=require(_0x4a52('0x2'));var express=require(_0x4a52('0x3'));var router=express['Router']();var fs_extra=require(_0x4a52('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4a52('0x5'));var config=require(_0x4a52('0x6'));var controller=require(_0x4a52('0x7'));router[_0x4a52('0x8')]('/',auth[_0x4a52('0x9')](),controller[_0x4a52('0xa')]);router[_0x4a52('0x8')](_0x4a52('0xb'),auth[_0x4a52('0x9')](),controller[_0x4a52('0xc')]);router[_0x4a52('0x8')](_0x4a52('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x4a52('0x8')](_0x4a52('0xe'),auth[_0x4a52('0x9')](),controller[_0x4a52('0xf')]);router[_0x4a52('0x8')](_0x4a52('0x10'),auth[_0x4a52('0x9')](),controller['getTeams']);router['get']('/:id/users',auth[_0x4a52('0x9')](),controller[_0x4a52('0x11')]);router['post']('/',auth[_0x4a52('0x9')](),controller[_0x4a52('0x12')]);router[_0x4a52('0x13')]('/:id/teams',auth[_0x4a52('0x9')](),controller[_0x4a52('0x14')]);router[_0x4a52('0x13')](_0x4a52('0x15'),auth[_0x4a52('0x9')](),controller[_0x4a52('0x16')]);router[_0x4a52('0x17')](_0x4a52('0xd'),auth[_0x4a52('0x9')](),controller['update']);router[_0x4a52('0x18')]('/:id',auth[_0x4a52('0x9')](),controller[_0x4a52('0x19')]);router[_0x4a52('0x18')]('/:id/teams',auth[_0x4a52('0x9')](),controller[_0x4a52('0x1a')]);router['delete']('/:id/users',auth[_0x4a52('0x9')](),controller[_0x4a52('0x1b')]);module[_0x4a52('0x1c')]=router; \ No newline at end of file +var _0x2ab9=['removeAgents','exports','multer','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy'];(function(_0x38c8a3,_0x4c270c){var _0x2c4380=function(_0x3ed961){while(--_0x3ed961){_0x38c8a3['push'](_0x38c8a3['shift']());}};_0x2c4380(++_0x4c270c);}(_0x2ab9,0x17c));var _0x92ab=function(_0x52ec54,_0x4ddab7){_0x52ec54=_0x52ec54-0x0;var _0x4ecea1=_0x2ab9[_0x52ec54];return _0x4ecea1;};'use strict';var multer=require(_0x92ab('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(_0x92ab('0x1'));var auth=require(_0x92ab('0x2'));var interaction=require(_0x92ab('0x3'));var config=require('../../config/environment');var controller=require(_0x92ab('0x4'));router[_0x92ab('0x5')]('/',auth['isAuthenticated'](),controller[_0x92ab('0x6')]);router[_0x92ab('0x5')](_0x92ab('0x7'),auth['isAuthenticated'](),controller[_0x92ab('0x8')]);router[_0x92ab('0x5')](_0x92ab('0x9'),auth[_0x92ab('0xa')](),controller[_0x92ab('0xb')]);router[_0x92ab('0x5')](_0x92ab('0xc'),auth['isAuthenticated'](),controller[_0x92ab('0xd')]);router[_0x92ab('0x5')](_0x92ab('0xe'),auth['isAuthenticated'](),controller[_0x92ab('0xf')]);router[_0x92ab('0x5')](_0x92ab('0x10'),auth[_0x92ab('0xa')](),controller[_0x92ab('0x11')]);router[_0x92ab('0x12')]('/',auth[_0x92ab('0xa')](),controller[_0x92ab('0x13')]);router[_0x92ab('0x12')]('/:id/teams',auth[_0x92ab('0xa')](),controller['addTeams']);router[_0x92ab('0x12')](_0x92ab('0x10'),auth[_0x92ab('0xa')](),controller[_0x92ab('0x14')]);router[_0x92ab('0x15')](_0x92ab('0x9'),auth[_0x92ab('0xa')](),controller[_0x92ab('0x16')]);router[_0x92ab('0x17')](_0x92ab('0x9'),auth[_0x92ab('0xa')](),controller[_0x92ab('0x18')]);router[_0x92ab('0x17')](_0x92ab('0xe'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x92ab('0x17')](_0x92ab('0x10'),auth['isAuthenticated'](),controller[_0x92ab('0x19')]);module[_0x92ab('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index e920ea8..68632ed 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 _0x2bb0=['STRING','INTEGER','beepall','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2bb0,0xf3));var _0x02bb=function(_0x133b4c,_0x3d4c16){_0x133b4c=_0x133b4c-0x0;var _0x377328=_0x2bb0[_0x133b4c];return _0x377328;};'use strict';var Sequelize=require(_0x02bb('0x0'));module[_0x02bb('0x1')]={'name':{'type':Sequelize[_0x02bb('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x02bb('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x02bb('0x4'),'roundrobin')},'description':{'type':Sequelize[_0x02bb('0x2')]}}; \ No newline at end of file +var _0xec56=['ENUM','rrmemory','beepall','roundrobin','STRING','sequelize','name','INTEGER'];(function(_0x1a0b7a,_0xbe5b06){var _0x5e4f39=function(_0x7b29c4){while(--_0x7b29c4){_0x1a0b7a['push'](_0x1a0b7a['shift']());}};_0x5e4f39(++_0xbe5b06);}(_0xec56,0x1bd));var _0x6ec5=function(_0x1afa1a,_0x1918c5){_0x1afa1a=_0x1afa1a-0x0;var _0xe885b0=_0xec56[_0x1afa1a];return _0xe885b0;};'use strict';var Sequelize=require(_0x6ec5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x6ec5('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x6ec5('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6ec5('0x3')](_0x6ec5('0x4'),_0x6ec5('0x5'),_0x6ec5('0x6'))},'description':{'type':Sequelize[_0x6ec5('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 98764fb..92a1304 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 _0x1485=['Agents','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','WhatsappQueues','error','stack','name','send','map','WhatsappQueue','rawAttributes','type','key','where','include','findAll','rows','catch','show','params','keys','query','filters','model','attributes','intersection','fields','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserWhatsappQueue','length','nolimit','sort','pick','WhatsappQueueId','filter','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','whatsappPause','Team','order','merge','hasOwnProperty','getTeams','addTeams','ids'];(function(_0x7bf1e2,_0x58bbb0){var _0x35aabc=function(_0x2a014e){while(--_0x2a014e){_0x7bf1e2['push'](_0x7bf1e2['shift']());}};_0x35aabc(++_0x58bbb0);}(_0x1485,0x9d));var _0x5148=function(_0x176213,_0x5add34){_0x176213=_0x176213-0x0;var _0x4aa9dd=_0x1485[_0x176213];return _0x4aa9dd;};'use strict';var BPromise=require(_0x5148('0x0'));var util=require(_0x5148('0x1'));var _=require(_0x5148('0x2'));var squel=require(_0x5148('0x3'));var Redis=require('ioredis');var qs=require(_0x5148('0x4'));var logger=require(_0x5148('0x5'))('api');var config=require(_0x5148('0x6'));var db=require('../../mysqldb')['db'];config[_0x5148('0x7')]=_[_0x5148('0x8')](config[_0x5148('0x7')],{'host':_0x5148('0x9'),'port':0x18eb});var socket=require(_0x5148('0xa'))(new Redis(config[_0x5148('0x7')]));require(_0x5148('0xb'))[_0x5148('0xc')](socket);function respondWithStatusCode(_0x35f3e3,_0x46e3b3){_0x46e3b3=_0x46e3b3||0xcc;return function(_0x3f70a8){if(_0x3f70a8){return _0x35f3e3[_0x5148('0xd')](_0x46e3b3);}return _0x35f3e3[_0x5148('0xe')](_0x46e3b3)[_0x5148('0xf')]();};}function respondWithResult(_0x5236fb,_0x1da687){_0x1da687=_0x1da687||0xc8;return function(_0x2ce45f){if(_0x2ce45f){return _0x5236fb[_0x5148('0xe')](_0x1da687)[_0x5148('0x10')](_0x2ce45f);}};}function respondWithFilteredResult(_0x25edce,_0x16e38c){return function(_0x4ca59c){if(_0x4ca59c){var _0x91d798=typeof _0x16e38c[_0x5148('0x11')]===_0x5148('0x12')&&typeof _0x16e38c[_0x5148('0x13')]===_0x5148('0x12');var _0x342b19=_0x4ca59c[_0x5148('0x14')];var _0x1b27e1=_0x91d798?0x0:_0x16e38c[_0x5148('0x11')];var _0xe36d44=_0x91d798?_0x4ca59c[_0x5148('0x14')]:_0x16e38c[_0x5148('0x11')]+_0x16e38c['limit'];var _0x5d2917;if(_0xe36d44>=_0x342b19){_0xe36d44=_0x342b19;_0x5d2917=0xc8;}else{_0x5d2917=0xce;}_0x25edce['status'](_0x5d2917);return _0x25edce[_0x5148('0x15')](_0x5148('0x16'),_0x1b27e1+'-'+_0xe36d44+'/'+_0x342b19)[_0x5148('0x10')](_0x4ca59c);}return null;};}function saveUpdates(_0x55885f){return function(_0x2cb3e8){if(_0x2cb3e8){return _0x2cb3e8['update'](_0x55885f)[_0x5148('0x17')](function(_0x2d9355){return _0x2d9355;});}return null;};}function removeEntity(_0x36b542){return function(_0xc28dcb){if(_0xc28dcb){return _0xc28dcb[_0x5148('0x18')]()[_0x5148('0x17')](function(){var _0xe64bed=_0xc28dcb[_0x5148('0x19')]({'plain':!![]});var _0x5b2497=_0x5148('0x1a');return db['UserProfileResource']['destroy']({'where':{'type':_0x5b2497,'resourceId':_0xe64bed['id']}})[_0x5148('0x17')](function(){return _0xc28dcb;});})['then'](function(){_0x36b542[_0x5148('0xe')](0xcc)[_0x5148('0xf')]();});}};}function handleEntityNotFound(_0x268ff4){return function(_0x6a2190){if(!_0x6a2190){_0x268ff4[_0x5148('0xd')](0x194);}return _0x6a2190;};}function handleError(_0x4563f6,_0x2d40a5){_0x2d40a5=_0x2d40a5||0x1f4;return function(_0x521b87){logger[_0x5148('0x1b')](_0x521b87[_0x5148('0x1c')]);if(_0x521b87[_0x5148('0x1d')]){delete _0x521b87['name'];}_0x4563f6[_0x5148('0xe')](_0x2d40a5)[_0x5148('0x1e')](_0x521b87);};}exports['index']=function(_0x40ef8b,_0x369368){var _0x291c71={};var _0x3521a3={'count':0x0,'rows':[]};var _0x3c05ec=_[_0x5148('0x1f')](db[_0x5148('0x20')][_0x5148('0x21')],function(_0x1d39bb){return{'name':_0x1d39bb['fieldName'],'type':_0x1d39bb[_0x5148('0x22')][_0x5148('0x23')]};});_0x291c71=qs['getOptions'](_0x3c05ec,_0x40ef8b);var _0x384063={'where':_0x291c71[_0x5148('0x24')]};return db[_0x5148('0x20')][_0x5148('0x14')](_0x384063)[_0x5148('0x17')](function(_0x516a22){_0x3521a3[_0x5148('0x14')]=_0x516a22;_0x291c71[_0x5148('0x25')]=qs[_0x5148('0x25')](_0x40ef8b['query']);return db['WhatsappQueue'][_0x5148('0x26')](_0x291c71);})['then'](function(_0x1fd99f){_0x3521a3[_0x5148('0x27')]=_0x1fd99f;return _0x3521a3;})['then'](respondWithFilteredResult(_0x369368,_0x291c71))[_0x5148('0x28')](handleError(_0x369368,null));};exports[_0x5148('0x29')]=function(_0x587c25,_0x1854be){var _0x49db9b={'raw':!![],'where':{'id':_0x587c25[_0x5148('0x2a')]['id']}},_0x10c48a={};_0x10c48a['model']=_[_0x5148('0x2b')](db[_0x5148('0x20')][_0x5148('0x21')]);_0x10c48a['query']=_['keys'](_0x587c25[_0x5148('0x2c')]);_0x10c48a[_0x5148('0x2d')]=_['intersection'](_0x10c48a[_0x5148('0x2e')],_0x10c48a[_0x5148('0x2c')]);_0x49db9b[_0x5148('0x2f')]=_[_0x5148('0x30')](_0x10c48a['model'],qs[_0x5148('0x31')](_0x587c25[_0x5148('0x2c')][_0x5148('0x31')]));_0x49db9b['attributes']=_0x49db9b['attributes']['length']?_0x49db9b[_0x5148('0x2f')]:_0x10c48a[_0x5148('0x2e')];if(_0x587c25[_0x5148('0x2c')][_0x5148('0x32')]){_0x49db9b[_0x5148('0x25')]=[{'all':!![]}];}_0x49db9b=_['merge']({},_0x49db9b,_0x587c25[_0x5148('0x33')]);return db[_0x5148('0x20')]['find'](_0x49db9b)[_0x5148('0x17')](handleEntityNotFound(_0x1854be,null))[_0x5148('0x17')](respondWithResult(_0x1854be,null))['catch'](handleError(_0x1854be,null));};exports[_0x5148('0x34')]=function(_0x4dbf60,_0x1f97a6){return db[_0x5148('0x20')][_0x5148('0x34')](_0x4dbf60[_0x5148('0x35')],{})[_0x5148('0x17')](function(_0x66e986){var _0x57e60f=_0x4dbf60[_0x5148('0x36')]['get']({'plain':!![]});if(!_0x57e60f)throw new Error(_0x5148('0x37'));if(_0x57e60f['role']===_0x5148('0x36')){var _0x567750=_0x66e986[_0x5148('0x19')]({'plain':!![]});var _0x5be4c6='WhatsappQueues';return db[_0x5148('0x38')][_0x5148('0x39')]({'where':{'name':_0x5be4c6,'userProfileId':_0x57e60f['userProfileId']},'raw':!![]})['then'](function(_0x2b0aab){if(_0x2b0aab&&_0x2b0aab[_0x5148('0x3a')]===0x0){return db[_0x5148('0x3b')][_0x5148('0x34')]({'name':_0x567750[_0x5148('0x1d')],'resourceId':_0x567750['id'],'type':_0x2b0aab[_0x5148('0x1d')],'sectionId':_0x2b0aab['id']},{})[_0x5148('0x17')](function(){return _0x66e986;});}else{return _0x66e986;}})[_0x5148('0x28')](function(_0x639208){logger[_0x5148('0x1b')](_0x5148('0x3c'),_0x639208);throw _0x639208;});}return _0x66e986;})[_0x5148('0x17')](respondWithResult(_0x1f97a6,0xc9))[_0x5148('0x28')](handleError(_0x1f97a6,null));};exports['update']=function(_0xa362a1,_0x345537){if(_0xa362a1[_0x5148('0x35')]['id']){delete _0xa362a1['body']['id'];}return db[_0x5148('0x20')][_0x5148('0x39')]({'where':{'id':_0xa362a1['params']['id']}})[_0x5148('0x17')](handleEntityNotFound(_0x345537,null))['then'](saveUpdates(_0xa362a1[_0x5148('0x35')],null))[_0x5148('0x17')](respondWithResult(_0x345537,null))[_0x5148('0x28')](handleError(_0x345537,null));};exports[_0x5148('0x18')]=function(_0x47718f,_0x365f12){return db[_0x5148('0x20')]['find']({'where':{'id':_0x47718f[_0x5148('0x2a')]['id']}})[_0x5148('0x17')](handleEntityNotFound(_0x365f12,null))[_0x5148('0x17')](removeEntity(_0x365f12,null))[_0x5148('0x28')](handleError(_0x365f12,null));};exports[_0x5148('0x3d')]=function(_0x4ca594,_0x3248d1){return db[_0x5148('0x20')][_0x5148('0x3d')]()[_0x5148('0x17')](respondWithResult(_0x3248d1,null))[_0x5148('0x28')](handleError(_0x3248d1,null));};exports['getMembers']=function(_0x1347a8,_0x285af9){var _0xde26={'raw':!![],'where':{}},_0x46607d={},_0x3db9e4;return db[_0x5148('0x20')][_0x5148('0x3e')]({'where':{'id':_0x1347a8['params']['id']}})[_0x5148('0x17')](handleEntityNotFound(_0x285af9,null))[_0x5148('0x17')](function(_0x6843b0){if(_0x6843b0){_0x3db9e4=_0x6843b0[_0x5148('0x19')]({'plain':!![]});_0x46607d[_0x5148('0x2e')]=_[_0x5148('0x2b')](db[_0x5148('0x3f')][_0x5148('0x21')]);_0x46607d[_0x5148('0x2c')]=_[_0x5148('0x2b')](_0x1347a8[_0x5148('0x2c')]);_0x46607d['filters']=_[_0x5148('0x30')](_0x46607d['model'],_0x46607d[_0x5148('0x2c')]);_0xde26[_0x5148('0x2f')]=_[_0x5148('0x30')](_0x46607d['model'],qs[_0x5148('0x31')](_0x1347a8[_0x5148('0x2c')][_0x5148('0x31')]));_0xde26[_0x5148('0x2f')]=_0xde26[_0x5148('0x2f')][_0x5148('0x40')]?_0xde26[_0x5148('0x2f')]:_0x46607d['model'];if(!_0x1347a8['query']['hasOwnProperty'](_0x5148('0x41'))){_0xde26[_0x5148('0x13')]=qs[_0x5148('0x13')](_0x1347a8[_0x5148('0x2c')][_0x5148('0x13')]);_0xde26[_0x5148('0x11')]=qs[_0x5148('0x11')](_0x1347a8[_0x5148('0x2c')][_0x5148('0x11')]);}_0xde26['order']=qs[_0x5148('0x42')](_0x1347a8['query']['sort']);_0xde26[_0x5148('0x24')]=qs['filters'](_[_0x5148('0x43')](_0x1347a8[_0x5148('0x2c')],_0x46607d[_0x5148('0x2d')]));_0xde26[_0x5148('0x24')][_0x5148('0x44')]=_0x6843b0['id'];if(_0x1347a8[_0x5148('0x2c')][_0x5148('0x45')]){_0xde26[_0x5148('0x24')]=_['merge'](_0xde26['where'],{'$or':_[_0x5148('0x1f')](_0xde26[_0x5148('0x2f')],function(_0x37849d){var _0x170dc2={};_0x170dc2[_0x37849d]={'$like':'%'+_0x1347a8[_0x5148('0x2c')][_0x5148('0x45')]+'%'};return _0x170dc2;})});}_0xde26=_['merge']({},_0xde26,_0x1347a8['options']);return db[_0x5148('0x3f')][_0x5148('0x26')](_0xde26);}})['then'](function(_0x43f991){if(_0x43f991){return db[_0x5148('0x46')][_0x5148('0x47')]({'where':{'id':_[_0x5148('0x1f')](_0x43f991,_0x5148('0x48')),'role':'agent'},'attributes':['id','name','whatsappPause',_0x5148('0x49'),_0x5148('0x4a')]});}})[_0x5148('0x17')](function(_0x318310){if(_0x318310){return{'count':_0x318310[_0x5148('0x14')],'rows':_['map'](_0x318310[_0x5148('0x27')],function(_0x76611f){return{'membername':_0x76611f['name'],'UserId':_0x76611f['id'],'queue_name':_0x3db9e4[_0x5148('0x1d')],'WhatsappQueueId':_0x3db9e4['id'],'interface':util[_0x5148('0x4b')](_0x5148('0x4c'),'SIP',_0x76611f[_0x5148('0x1d')]),'penalty':0x0,'paused':_0x76611f[_0x5148('0x4d')],'createdAt':_0x76611f[_0x5148('0x4a')],'updatedAt':_0x76611f[_0x5148('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5148('0x17')](respondWithFilteredResult(_0x285af9,_0xde26))['catch'](handleError(_0x285af9,null));};exports['getTeams']=function(_0x15ac04,_0x1a1da0){var _0x30467b={};var _0x311fb0={};var _0xc7dae2;var _0x56da3c;return db[_0x5148('0x20')]['findOne']({'where':{'id':_0x15ac04[_0x5148('0x2a')]['id']}})[_0x5148('0x17')](handleEntityNotFound(_0x1a1da0,null))[_0x5148('0x17')](function(_0x2d10f1){if(_0x2d10f1){_0xc7dae2=_0x2d10f1;_0x311fb0[_0x5148('0x2e')]=_[_0x5148('0x2b')](db[_0x5148('0x4e')]['rawAttributes']);_0x311fb0['query']=_['keys'](_0x15ac04[_0x5148('0x2c')]);_0x311fb0[_0x5148('0x2d')]=_[_0x5148('0x30')](_0x311fb0[_0x5148('0x2e')],_0x311fb0[_0x5148('0x2c')]);_0x30467b[_0x5148('0x2f')]=_['intersection'](_0x311fb0[_0x5148('0x2e')],qs[_0x5148('0x31')](_0x15ac04[_0x5148('0x2c')][_0x5148('0x31')]));_0x30467b[_0x5148('0x2f')]=_0x30467b[_0x5148('0x2f')][_0x5148('0x40')]?_0x30467b[_0x5148('0x2f')]:_0x311fb0[_0x5148('0x2e')];_0x30467b[_0x5148('0x4f')]=qs[_0x5148('0x42')](_0x15ac04[_0x5148('0x2c')][_0x5148('0x42')]);_0x30467b[_0x5148('0x24')]=qs[_0x5148('0x2d')](_['pick'](_0x15ac04[_0x5148('0x2c')],_0x311fb0['filters']));if(_0x15ac04[_0x5148('0x2c')][_0x5148('0x45')]){_0x30467b[_0x5148('0x24')]=_[_0x5148('0x50')](_0x30467b[_0x5148('0x24')],{'$or':_[_0x5148('0x1f')](_0x30467b[_0x5148('0x2f')],function(_0xa09e9a){var _0x3ab6a5={};_0x3ab6a5[_0xa09e9a]={'$like':'%'+_0x15ac04[_0x5148('0x2c')]['filter']+'%'};return _0x3ab6a5;})});}_0x30467b=_[_0x5148('0x50')]({},_0x30467b,_0x15ac04[_0x5148('0x33')]);return _0xc7dae2['getTeams'](_0x30467b);}})[_0x5148('0x17')](function(_0x2b2edd){if(_0x2b2edd){_0x56da3c=_0x2b2edd[_0x5148('0x40')];if(!_0x15ac04[_0x5148('0x2c')][_0x5148('0x51')](_0x5148('0x41'))){_0x30467b['limit']=qs[_0x5148('0x13')](_0x15ac04[_0x5148('0x2c')][_0x5148('0x13')]);_0x30467b[_0x5148('0x11')]=qs['offset'](_0x15ac04['query'][_0x5148('0x11')]);}return _0xc7dae2[_0x5148('0x52')](_0x30467b);}})[_0x5148('0x17')](function(_0x4ef5cd){if(_0x4ef5cd){return _0x4ef5cd?{'count':_0x56da3c,'rows':_0x4ef5cd}:null;}})['then'](respondWithResult(_0x1a1da0,null))[_0x5148('0x28')](handleError(_0x1a1da0,null));};exports[_0x5148('0x53')]=function(_0x1ed9d8,_0x24900f){var _0x3cf315=_0x1ed9d8[_0x5148('0x35')][_0x5148('0x54')];return db[_0x5148('0x4e')]['findAll']({'where':{'id':_0x3cf315},'attributes':['id'],'include':[{'model':db[_0x5148('0x46')],'as':_0x5148('0x55'),'attributes':['id',_0x5148('0x1d'),'online',_0x5148('0x56'),'interface'],'raw':!![]}]})[_0x5148('0x17')](function(_0x1c5a22){if(_0x1c5a22){var _0x38b973=_[_0x5148('0x57')](_0x1c5a22,function(_0x2e351f){var _0x456a63=_0x2e351f[_0x5148('0x19')]({'plain':!![]});return _0x456a63[_0x5148('0x55')];});return db[_0x5148('0x20')][_0x5148('0x39')]({'where':{'id':_0x1ed9d8[_0x5148('0x2a')]['id']}})[_0x5148('0x17')](function(_0x34242d){return db[_0x5148('0x58')][_0x5148('0x59')](function(_0x4cad44){return _0x34242d[_0x5148('0x53')](_0x3cf315,{'transaction':_0x4cad44})[_0x5148('0x17')](function(){return BPromise[_0x5148('0x5a')](_0x38b973,function(_0x225ff4){return db['UserWhatsappQueue'][_0x5148('0x5b')]({'where':{'UserId':_0x225ff4['id'],'WhatsappQueueId':_0x1ed9d8[_0x5148('0x2a')]['id']},'transaction':_0x4cad44});});})[_0x5148('0x17')](function(){_0x38b973[_0x5148('0x5c')](function(_0x2f0a9b){socket[_0x5148('0x5d')](_0x5148('0x5e'),{'UserId':_0x2f0a9b['id'],'WhatsappQueueId':_0x34242d['id']});});});});});}})[_0x5148('0x17')](respondWithStatusCode(_0x24900f,null))['catch'](handleError(_0x24900f,null));};exports[_0x5148('0x5f')]=function(_0x223207,_0x5cd8f4){return db[_0x5148('0x4e')][_0x5148('0x26')]({'where':{'id':_0x223207['query'][_0x5148('0x54')]},'attributes':['id'],'include':[{'model':db[_0x5148('0x46')],'as':_0x5148('0x55'),'attributes':['id'],'raw':!![]}]})[_0x5148('0x17')](handleEntityNotFound(_0x5cd8f4,null))[_0x5148('0x17')](function(_0x270157){var _0x444560=_[_0x5148('0x1f')](_0x270157,'id');var _0x2e9087=[];var _0x3a8c34=[];var _0x4dc569=squel[_0x5148('0x60')]();_0x4dc569[_0x5148('0x61')](_0x5148('0x62'))[_0x5148('0x63')](_0x5148('0x64'),'tq')[_0x5148('0x65')](_0x5148('0x66'),'ut',_0x5148('0x67'))['where']('WhatsappQueueId\x20=\x20?',_0x223207['params']['id']);for(var _0x5efd36=0x0;_0x5efd36<_0x270157[_0x5148('0x40')];_0x5efd36+=0x1){let _0x4e43f4=_0x270157[_0x5efd36];for(var _0x903b0d=0x0;_0x903b0d<_0x4e43f4[_0x5148('0x55')][_0x5148('0x40')];_0x903b0d+=0x1){let _0x507f4f=_0x4e43f4[_0x5148('0x55')][_0x903b0d];var _0x188ec7=_0x4dc569[_0x5148('0x68')]();_0x188ec7[_0x5148('0x24')](_0x5148('0x69'),_0x507f4f['id']);_0x3a8c34['push'](db[_0x5148('0x58')][_0x5148('0x2c')](_0x188ec7[_0x5148('0x6a')](),{'type':db['sequelize'][_0x5148('0x6b')][_0x5148('0x6c')]})['then'](function(_0x5c99cf){if(_0x5c99cf[_0x5148('0x40')]===0x1){return _0x507f4f['id'];}else{var _0x1db1a3=_[_0x5148('0x6d')](_[_0x5148('0x1f')](_0x5c99cf,_0x5148('0x6e')),function(_0x5a9d55){return _['includes'](_0x444560,_0x5a9d55);});if(_0x1db1a3){return _0x507f4f['id'];}}}));}}return BPromise[_0x5148('0x6f')](_0x3a8c34)[_0x5148('0x17')](function(_0x1cd0ce){_0x2e9087=_(_0x2e9087)['union'](_0x1cd0ce)[_0x5148('0x70')]()[_0x5148('0x71')]();return db['WhatsappQueue'][_0x5148('0x39')]({'where':{'id':_0x223207[_0x5148('0x2a')]['id']}})['then'](function(_0x45e122){return db[_0x5148('0x58')][_0x5148('0x59')](function(_0x158063){return _0x45e122[_0x5148('0x5f')](_0x223207[_0x5148('0x2c')]['ids'],{'transaction':_0x158063})[_0x5148('0x17')](function(){if(!_[_0x5148('0x72')](_0x2e9087)){return _0x45e122[_0x5148('0x73')](_0x2e9087,{'transaction':_0x158063});}})['then'](function(){_0x2e9087[_0x5148('0x5c')](function(_0x350369){socket[_0x5148('0x5d')](_0x5148('0x74'),{'UserId':_0x350369,'WhatsappQueueId':_0x45e122['id']});});});});});});})[_0x5148('0x17')](respondWithStatusCode(_0x5cd8f4,null))['catch'](handleError(_0x5cd8f4,null));};exports[_0x5148('0x75')]=function(_0x1cbfd4,_0x39f4df){return db[_0x5148('0x20')][_0x5148('0x39')]({'where':{'id':_0x1cbfd4[_0x5148('0x2a')]['id']}})[_0x5148('0x17')](handleEntityNotFound(_0x39f4df,null))[_0x5148('0x17')](function(_0x11422c){if(_0x11422c){return _0x11422c[_0x5148('0x75')](_0x1cbfd4[_0x5148('0x35')]['ids'],_[_0x5148('0x76')](_0x1cbfd4[_0x5148('0x35')],[_0x5148('0x54'),'id'])||{})['spread'](function(_0x2a3893){for(var _0x585255=0x0;_0x585255<_0x1cbfd4[_0x5148('0x35')][_0x5148('0x54')][_0x5148('0x40')];_0x585255+=0x1){socket[_0x5148('0x5d')](_0x5148('0x5e'),{'UserId':Number(_0x1cbfd4['body']['ids'][_0x585255]),'WhatsappQueueId':Number(_0x1cbfd4[_0x5148('0x2a')]['id'])});}return _0x2a3893;});}})[_0x5148('0x17')](respondWithResult(_0x39f4df,null))[_0x5148('0x28')](handleError(_0x39f4df,null));};exports[_0x5148('0x73')]=function(_0x7b3b69,_0x4cbaee){return db[_0x5148('0x20')]['find']({'where':{'id':_0x7b3b69[_0x5148('0x2a')]['id']}})['then'](handleEntityNotFound(_0x4cbaee,null))[_0x5148('0x17')](function(_0xf6a926){if(_0xf6a926){return _0xf6a926['removeAgents'](_0x7b3b69[_0x5148('0x2c')][_0x5148('0x54')])[_0x5148('0x17')](function(){if(_[_0x5148('0x77')](_0x7b3b69[_0x5148('0x2c')][_0x5148('0x54')])){for(var _0x311d3a=0x0;_0x311d3a<_0x7b3b69[_0x5148('0x2c')]['ids']['length'];_0x311d3a+=0x1){socket['emit'](_0x5148('0x74'),{'UserId':Number(_0x7b3b69[_0x5148('0x2c')][_0x5148('0x54')][_0x311d3a]),'WhatsappQueueId':Number(_0x7b3b69['params']['id'])});}}else{socket['emit'](_0x5148('0x74'),{'UserId':Number(_0x7b3b69[_0x5148('0x2c')][_0x5148('0x54')]),'WhatsappQueueId':Number(_0x7b3b69[_0x5148('0x2a')]['id'])});}});}})[_0x5148('0x17')](respondWithStatusCode(_0x4cbaee,null))[_0x5148('0x28')](handleError(_0x4cbaee,null));};exports[_0x5148('0x78')]=function(_0x2a3a56,_0x655819){var _0x221f60={};var _0x1f3c71={};var _0x2f2685;var _0x47a663;return db[_0x5148('0x20')][_0x5148('0x3e')]({'where':{'id':_0x2a3a56[_0x5148('0x2a')]['id']}})[_0x5148('0x17')](handleEntityNotFound(_0x655819,null))['then'](function(_0x2edeeb){if(_0x2edeeb){_0x2f2685=_0x2edeeb;_0x1f3c71[_0x5148('0x2e')]=_['keys'](db[_0x5148('0x46')][_0x5148('0x21')]);_0x1f3c71[_0x5148('0x2c')]=_['keys'](_0x2a3a56[_0x5148('0x2c')]);_0x1f3c71[_0x5148('0x2d')]=_['intersection'](_0x1f3c71[_0x5148('0x2e')],_0x1f3c71[_0x5148('0x2c')]);_0x221f60[_0x5148('0x2f')]=_[_0x5148('0x30')](_0x1f3c71[_0x5148('0x2e')],qs[_0x5148('0x31')](_0x2a3a56[_0x5148('0x2c')][_0x5148('0x31')]));_0x221f60[_0x5148('0x2f')]=_0x221f60[_0x5148('0x2f')][_0x5148('0x40')]?_0x221f60[_0x5148('0x2f')]:_0x1f3c71['model'];_0x221f60[_0x5148('0x4f')]=qs[_0x5148('0x42')](_0x2a3a56[_0x5148('0x2c')]['sort']);_0x221f60[_0x5148('0x24')]=qs[_0x5148('0x2d')](_[_0x5148('0x43')](_0x2a3a56[_0x5148('0x2c')],_0x1f3c71[_0x5148('0x2d')]));if(_0x2a3a56[_0x5148('0x2c')]['filter']){_0x221f60[_0x5148('0x24')]=_['merge'](_0x221f60[_0x5148('0x24')],{'$or':_['map'](_0x221f60[_0x5148('0x2f')],function(_0x11fe8d){var _0x45c63c={};_0x45c63c[_0x11fe8d]={'$like':'%'+_0x2a3a56[_0x5148('0x2c')][_0x5148('0x45')]+'%'};return _0x45c63c;})});}_0x221f60=_[_0x5148('0x50')]({},_0x221f60,_0x2a3a56['options']);return _0x2f2685[_0x5148('0x78')](_0x221f60);}})[_0x5148('0x17')](function(_0x3d5068){if(_0x3d5068){_0x47a663=_0x3d5068[_0x5148('0x40')];if(!_0x2a3a56[_0x5148('0x2c')][_0x5148('0x51')](_0x5148('0x41'))){_0x221f60[_0x5148('0x13')]=qs[_0x5148('0x13')](_0x2a3a56[_0x5148('0x2c')]['limit']);_0x221f60['offset']=qs[_0x5148('0x11')](_0x2a3a56[_0x5148('0x2c')]['offset']);}return _0x2f2685['getAgents'](_0x221f60);}})[_0x5148('0x17')](function(_0x7cb0c0){if(_0x7cb0c0){return _0x7cb0c0?{'count':_0x47a663,'rows':_0x7cb0c0}:null;}})['then'](respondWithResult(_0x655819,null))[_0x5148('0x28')](handleError(_0x655819,null));}; \ No newline at end of file +var _0x1143=['SIP','getTeams','hasOwnProperty','ids','Team','online','voicePause','interface','flatMap','Agents','sequelize','transaction','addTeams','each','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','User','bluebird','util','lodash','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','end','offset','undefined','limit','count','set','json','update','destroy','then','get','WhatsappQueues','UserProfileResource','error','stack','name','send','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','rows','catch','model','keys','query','intersection','attributes','fields','includeAll','include','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserWhatsappQueue','filters','length','nolimit','order','sort','pick','WhatsappQueueId','filter','options','findAll','agent','whatsappPause','updatedAt','createdAt','format'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x1143,0xa4));var _0x3114=function(_0x5cf3c0,_0x4363c1){_0x5cf3c0=_0x5cf3c0-0x0;var _0x39a680=_0x1143[_0x5cf3c0];return _0x39a680;};'use strict';var BPromise=require(_0x3114('0x0'));var util=require(_0x3114('0x1'));var _=require(_0x3114('0x2'));var squel=require('squel');var Redis=require(_0x3114('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x3114('0x4'))(_0x3114('0x5'));var config=require(_0x3114('0x6'));var db=require('../../mysqldb')['db'];config[_0x3114('0x7')]=_[_0x3114('0x8')](config[_0x3114('0x7')],{'host':_0x3114('0x9'),'port':0x18eb});var socket=require(_0x3114('0xa'))(new Redis(config['redis']));require(_0x3114('0xb'))[_0x3114('0xc')](socket);function respondWithStatusCode(_0x5226e2,_0x56d0cd){_0x56d0cd=_0x56d0cd||0xcc;return function(_0x2dbbe4){if(_0x2dbbe4){return _0x5226e2['sendStatus'](_0x56d0cd);}return _0x5226e2[_0x3114('0xd')](_0x56d0cd)[_0x3114('0xe')]();};}function respondWithResult(_0x1b7ee4,_0x34c142){_0x34c142=_0x34c142||0xc8;return function(_0x420307){if(_0x420307){return _0x1b7ee4[_0x3114('0xd')](_0x34c142)['json'](_0x420307);}};}function respondWithFilteredResult(_0x56f443,_0x18e56c){return function(_0x16ec85){if(_0x16ec85){var _0x18f3b2=typeof _0x18e56c[_0x3114('0xf')]===_0x3114('0x10')&&typeof _0x18e56c[_0x3114('0x11')]===_0x3114('0x10');var _0x422273=_0x16ec85[_0x3114('0x12')];var _0x6cf7ce=_0x18f3b2?0x0:_0x18e56c[_0x3114('0xf')];var _0x917b61=_0x18f3b2?_0x16ec85[_0x3114('0x12')]:_0x18e56c['offset']+_0x18e56c[_0x3114('0x11')];var _0x149197;if(_0x917b61>=_0x422273){_0x917b61=_0x422273;_0x149197=0xc8;}else{_0x149197=0xce;}_0x56f443[_0x3114('0xd')](_0x149197);return _0x56f443[_0x3114('0x13')]('Content-Range',_0x6cf7ce+'-'+_0x917b61+'/'+_0x422273)[_0x3114('0x14')](_0x16ec85);}return null;};}function saveUpdates(_0x92310b){return function(_0x5b2d0b){if(_0x5b2d0b){return _0x5b2d0b[_0x3114('0x15')](_0x92310b)['then'](function(_0x3ef0f9){return _0x3ef0f9;});}return null;};}function removeEntity(_0x15dc95){return function(_0xd0a5d1){if(_0xd0a5d1){return _0xd0a5d1[_0x3114('0x16')]()[_0x3114('0x17')](function(){var _0x4ce935=_0xd0a5d1[_0x3114('0x18')]({'plain':!![]});var _0x3c75c7=_0x3114('0x19');return db[_0x3114('0x1a')][_0x3114('0x16')]({'where':{'type':_0x3c75c7,'resourceId':_0x4ce935['id']}})[_0x3114('0x17')](function(){return _0xd0a5d1;});})[_0x3114('0x17')](function(){_0x15dc95['status'](0xcc)[_0x3114('0xe')]();});}};}function handleEntityNotFound(_0x1f8990){return function(_0xf8af58){if(!_0xf8af58){_0x1f8990['sendStatus'](0x194);}return _0xf8af58;};}function handleError(_0x5f4fe9,_0x3404f8){_0x3404f8=_0x3404f8||0x1f4;return function(_0x79babf){logger[_0x3114('0x1b')](_0x79babf[_0x3114('0x1c')]);if(_0x79babf[_0x3114('0x1d')]){delete _0x79babf[_0x3114('0x1d')];}_0x5f4fe9[_0x3114('0xd')](_0x3404f8)[_0x3114('0x1e')](_0x79babf);};}exports['index']=function(_0x2c4ce2,_0xee8112){var _0x52263d={};var _0x144634={'count':0x0,'rows':[]};var _0x115515=_[_0x3114('0x1f')](db[_0x3114('0x20')][_0x3114('0x21')],function(_0x12c5ff){return{'name':_0x12c5ff[_0x3114('0x22')],'type':_0x12c5ff[_0x3114('0x23')][_0x3114('0x24')]};});_0x52263d=qs[_0x3114('0x25')](_0x115515,_0x2c4ce2);var _0x2d8c4c={'where':_0x52263d[_0x3114('0x26')]};return db['WhatsappQueue'][_0x3114('0x12')](_0x2d8c4c)['then'](function(_0x1c7724){_0x144634[_0x3114('0x12')]=_0x1c7724;_0x52263d['include']=qs['include'](_0x2c4ce2['query']);return db[_0x3114('0x20')]['findAll'](_0x52263d);})[_0x3114('0x17')](function(_0x139956){_0x144634[_0x3114('0x27')]=_0x139956;return _0x144634;})[_0x3114('0x17')](respondWithFilteredResult(_0xee8112,_0x52263d))[_0x3114('0x28')](handleError(_0xee8112,null));};exports['show']=function(_0x18ca45,_0x48816a){var _0x31a8e3={'raw':!![],'where':{'id':_0x18ca45['params']['id']}},_0x41bf11={};_0x41bf11[_0x3114('0x29')]=_[_0x3114('0x2a')](db['WhatsappQueue'][_0x3114('0x21')]);_0x41bf11[_0x3114('0x2b')]=_[_0x3114('0x2a')](_0x18ca45[_0x3114('0x2b')]);_0x41bf11['filters']=_[_0x3114('0x2c')](_0x41bf11[_0x3114('0x29')],_0x41bf11[_0x3114('0x2b')]);_0x31a8e3[_0x3114('0x2d')]=_[_0x3114('0x2c')](_0x41bf11['model'],qs[_0x3114('0x2e')](_0x18ca45[_0x3114('0x2b')][_0x3114('0x2e')]));_0x31a8e3[_0x3114('0x2d')]=_0x31a8e3[_0x3114('0x2d')]['length']?_0x31a8e3[_0x3114('0x2d')]:_0x41bf11[_0x3114('0x29')];if(_0x18ca45[_0x3114('0x2b')][_0x3114('0x2f')]){_0x31a8e3[_0x3114('0x30')]=[{'all':!![]}];}_0x31a8e3=_[_0x3114('0x31')]({},_0x31a8e3,_0x18ca45['options']);return db[_0x3114('0x20')][_0x3114('0x32')](_0x31a8e3)[_0x3114('0x17')](handleEntityNotFound(_0x48816a,null))[_0x3114('0x17')](respondWithResult(_0x48816a,null))['catch'](handleError(_0x48816a,null));};exports[_0x3114('0x33')]=function(_0x565b75,_0x409cad){return db['WhatsappQueue'][_0x3114('0x33')](_0x565b75[_0x3114('0x34')],{})['then'](function(_0x2f225c){var _0x469255=_0x565b75[_0x3114('0x35')][_0x3114('0x18')]({'plain':!![]});if(!_0x469255)throw new Error(_0x3114('0x36'));if(_0x469255[_0x3114('0x37')]===_0x3114('0x35')){var _0x27b443=_0x2f225c['get']({'plain':!![]});var _0x525588=_0x3114('0x19');return db[_0x3114('0x38')]['find']({'where':{'name':_0x525588,'userProfileId':_0x469255['userProfileId']},'raw':!![]})['then'](function(_0x2d056e){if(_0x2d056e&&_0x2d056e[_0x3114('0x39')]===0x0){return db['UserProfileResource'][_0x3114('0x33')]({'name':_0x27b443[_0x3114('0x1d')],'resourceId':_0x27b443['id'],'type':_0x2d056e[_0x3114('0x1d')],'sectionId':_0x2d056e['id']},{})['then'](function(){return _0x2f225c;});}else{return _0x2f225c;}})[_0x3114('0x28')](function(_0x563cbd){logger[_0x3114('0x1b')](_0x3114('0x3a'),_0x563cbd);throw _0x563cbd;});}return _0x2f225c;})[_0x3114('0x17')](respondWithResult(_0x409cad,0xc9))[_0x3114('0x28')](handleError(_0x409cad,null));};exports[_0x3114('0x15')]=function(_0x2871d0,_0x3156ca){if(_0x2871d0['body']['id']){delete _0x2871d0[_0x3114('0x34')]['id'];}return db[_0x3114('0x20')]['find']({'where':{'id':_0x2871d0['params']['id']}})[_0x3114('0x17')](handleEntityNotFound(_0x3156ca,null))[_0x3114('0x17')](saveUpdates(_0x2871d0[_0x3114('0x34')],null))[_0x3114('0x17')](respondWithResult(_0x3156ca,null))['catch'](handleError(_0x3156ca,null));};exports['destroy']=function(_0x4fc892,_0xc3c172){return db[_0x3114('0x20')][_0x3114('0x32')]({'where':{'id':_0x4fc892[_0x3114('0x3b')]['id']}})['then'](handleEntityNotFound(_0xc3c172,null))[_0x3114('0x17')](removeEntity(_0xc3c172,null))[_0x3114('0x28')](handleError(_0xc3c172,null));};exports[_0x3114('0x3c')]=function(_0x49ee55,_0x22eb7d){return db[_0x3114('0x20')][_0x3114('0x3c')]()[_0x3114('0x17')](respondWithResult(_0x22eb7d,null))[_0x3114('0x28')](handleError(_0x22eb7d,null));};exports['getMembers']=function(_0x2da6ac,_0x3e56c7){var _0x32de95={'raw':!![],'where':{}},_0x327317={},_0x38d6ee;return db[_0x3114('0x20')][_0x3114('0x3d')]({'where':{'id':_0x2da6ac[_0x3114('0x3b')]['id']}})[_0x3114('0x17')](handleEntityNotFound(_0x3e56c7,null))[_0x3114('0x17')](function(_0x54be78){if(_0x54be78){_0x38d6ee=_0x54be78[_0x3114('0x18')]({'plain':!![]});_0x327317['model']=_['keys'](db[_0x3114('0x3e')]['rawAttributes']);_0x327317[_0x3114('0x2b')]=_[_0x3114('0x2a')](_0x2da6ac['query']);_0x327317[_0x3114('0x3f')]=_[_0x3114('0x2c')](_0x327317[_0x3114('0x29')],_0x327317[_0x3114('0x2b')]);_0x32de95['attributes']=_[_0x3114('0x2c')](_0x327317[_0x3114('0x29')],qs['fields'](_0x2da6ac['query'][_0x3114('0x2e')]));_0x32de95['attributes']=_0x32de95[_0x3114('0x2d')][_0x3114('0x40')]?_0x32de95[_0x3114('0x2d')]:_0x327317['model'];if(!_0x2da6ac[_0x3114('0x2b')]['hasOwnProperty'](_0x3114('0x41'))){_0x32de95[_0x3114('0x11')]=qs[_0x3114('0x11')](_0x2da6ac['query'][_0x3114('0x11')]);_0x32de95[_0x3114('0xf')]=qs['offset'](_0x2da6ac[_0x3114('0x2b')][_0x3114('0xf')]);}_0x32de95[_0x3114('0x42')]=qs['sort'](_0x2da6ac[_0x3114('0x2b')][_0x3114('0x43')]);_0x32de95[_0x3114('0x26')]=qs[_0x3114('0x3f')](_[_0x3114('0x44')](_0x2da6ac[_0x3114('0x2b')],_0x327317['filters']));_0x32de95[_0x3114('0x26')][_0x3114('0x45')]=_0x54be78['id'];if(_0x2da6ac['query'][_0x3114('0x46')]){_0x32de95[_0x3114('0x26')]=_[_0x3114('0x31')](_0x32de95[_0x3114('0x26')],{'$or':_[_0x3114('0x1f')](_0x32de95[_0x3114('0x2d')],function(_0x3e3000){var _0x3b84fa={};_0x3b84fa[_0x3e3000]={'$like':'%'+_0x2da6ac[_0x3114('0x2b')]['filter']+'%'};return _0x3b84fa;})});}_0x32de95=_[_0x3114('0x31')]({},_0x32de95,_0x2da6ac[_0x3114('0x47')]);return db[_0x3114('0x3e')][_0x3114('0x48')](_0x32de95);}})['then'](function(_0x587f2c){if(_0x587f2c){return db['User']['findAndCountAll']({'where':{'id':_[_0x3114('0x1f')](_0x587f2c,'UserId'),'role':_0x3114('0x49')},'attributes':['id',_0x3114('0x1d'),_0x3114('0x4a'),_0x3114('0x4b'),_0x3114('0x4c')]});}})[_0x3114('0x17')](function(_0x4393b3){if(_0x4393b3){return{'count':_0x4393b3[_0x3114('0x12')],'rows':_[_0x3114('0x1f')](_0x4393b3[_0x3114('0x27')],function(_0x1b3754){return{'membername':_0x1b3754[_0x3114('0x1d')],'UserId':_0x1b3754['id'],'queue_name':_0x38d6ee[_0x3114('0x1d')],'WhatsappQueueId':_0x38d6ee['id'],'interface':util[_0x3114('0x4d')]('%s/%s',_0x3114('0x4e'),_0x1b3754[_0x3114('0x1d')]),'penalty':0x0,'paused':_0x1b3754['whatsappPause'],'createdAt':_0x1b3754[_0x3114('0x4c')],'updatedAt':_0x1b3754['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3114('0x17')](respondWithFilteredResult(_0x3e56c7,_0x32de95))['catch'](handleError(_0x3e56c7,null));};exports[_0x3114('0x4f')]=function(_0x266ed2,_0x102ea0){var _0x2f9793={};var _0x5c2891={};var _0x70c2bf;var _0x2eebf6;return db['WhatsappQueue'][_0x3114('0x3d')]({'where':{'id':_0x266ed2[_0x3114('0x3b')]['id']}})[_0x3114('0x17')](handleEntityNotFound(_0x102ea0,null))[_0x3114('0x17')](function(_0x4a4a28){if(_0x4a4a28){_0x70c2bf=_0x4a4a28;_0x5c2891['model']=_[_0x3114('0x2a')](db['Team'][_0x3114('0x21')]);_0x5c2891[_0x3114('0x2b')]=_[_0x3114('0x2a')](_0x266ed2[_0x3114('0x2b')]);_0x5c2891[_0x3114('0x3f')]=_[_0x3114('0x2c')](_0x5c2891[_0x3114('0x29')],_0x5c2891[_0x3114('0x2b')]);_0x2f9793[_0x3114('0x2d')]=_[_0x3114('0x2c')](_0x5c2891[_0x3114('0x29')],qs[_0x3114('0x2e')](_0x266ed2[_0x3114('0x2b')][_0x3114('0x2e')]));_0x2f9793[_0x3114('0x2d')]=_0x2f9793[_0x3114('0x2d')][_0x3114('0x40')]?_0x2f9793['attributes']:_0x5c2891[_0x3114('0x29')];_0x2f9793['order']=qs[_0x3114('0x43')](_0x266ed2[_0x3114('0x2b')][_0x3114('0x43')]);_0x2f9793[_0x3114('0x26')]=qs['filters'](_[_0x3114('0x44')](_0x266ed2[_0x3114('0x2b')],_0x5c2891[_0x3114('0x3f')]));if(_0x266ed2[_0x3114('0x2b')][_0x3114('0x46')]){_0x2f9793['where']=_['merge'](_0x2f9793[_0x3114('0x26')],{'$or':_[_0x3114('0x1f')](_0x2f9793[_0x3114('0x2d')],function(_0x5d15c0){var _0x191ef2={};_0x191ef2[_0x5d15c0]={'$like':'%'+_0x266ed2[_0x3114('0x2b')][_0x3114('0x46')]+'%'};return _0x191ef2;})});}_0x2f9793=_[_0x3114('0x31')]({},_0x2f9793,_0x266ed2[_0x3114('0x47')]);return _0x70c2bf[_0x3114('0x4f')](_0x2f9793);}})[_0x3114('0x17')](function(_0x5346d3){if(_0x5346d3){_0x2eebf6=_0x5346d3[_0x3114('0x40')];if(!_0x266ed2[_0x3114('0x2b')][_0x3114('0x50')](_0x3114('0x41'))){_0x2f9793[_0x3114('0x11')]=qs[_0x3114('0x11')](_0x266ed2[_0x3114('0x2b')][_0x3114('0x11')]);_0x2f9793[_0x3114('0xf')]=qs[_0x3114('0xf')](_0x266ed2[_0x3114('0x2b')][_0x3114('0xf')]);}return _0x70c2bf[_0x3114('0x4f')](_0x2f9793);}})[_0x3114('0x17')](function(_0x515d32){if(_0x515d32){return _0x515d32?{'count':_0x2eebf6,'rows':_0x515d32}:null;}})['then'](respondWithResult(_0x102ea0,null))['catch'](handleError(_0x102ea0,null));};exports['addTeams']=function(_0x1e950e,_0x488bc5){var _0x3a064e=_0x1e950e[_0x3114('0x34')][_0x3114('0x51')];return db[_0x3114('0x52')]['findAll']({'where':{'id':_0x3a064e},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x3114('0x53'),_0x3114('0x54'),_0x3114('0x55')],'raw':!![]}]})[_0x3114('0x17')](function(_0x1d29fd){if(_0x1d29fd){var _0x1953e2=_[_0x3114('0x56')](_0x1d29fd,function(_0x250579){var _0x39c406=_0x250579[_0x3114('0x18')]({'plain':!![]});return _0x39c406[_0x3114('0x57')];});return db[_0x3114('0x20')][_0x3114('0x32')]({'where':{'id':_0x1e950e[_0x3114('0x3b')]['id']}})['then'](function(_0x139a5d){return db[_0x3114('0x58')][_0x3114('0x59')](function(_0xa79954){return _0x139a5d[_0x3114('0x5a')](_0x3a064e,{'transaction':_0xa79954})[_0x3114('0x17')](function(){return BPromise[_0x3114('0x5b')](_0x1953e2,function(_0x5b15e5){return db[_0x3114('0x3e')]['findOrCreate']({'where':{'UserId':_0x5b15e5['id'],'WhatsappQueueId':_0x1e950e[_0x3114('0x3b')]['id']},'transaction':_0xa79954});});})['then'](function(){_0x1953e2[_0x3114('0x5c')](function(_0x4e0321){socket[_0x3114('0x5d')](_0x3114('0x5e'),{'UserId':_0x4e0321['id'],'WhatsappQueueId':_0x139a5d['id']});});});});});}})[_0x3114('0x17')](respondWithStatusCode(_0x488bc5,null))[_0x3114('0x28')](handleError(_0x488bc5,null));};exports[_0x3114('0x5f')]=function(_0x4d3110,_0x1cd1f6){return db[_0x3114('0x52')][_0x3114('0x48')]({'where':{'id':_0x4d3110['query'][_0x3114('0x51')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x3114('0x17')](handleEntityNotFound(_0x1cd1f6,null))[_0x3114('0x17')](function(_0x4591a8){var _0x3b7af1=_[_0x3114('0x1f')](_0x4591a8,'id');var _0x2f4bc4=[];var _0x93426f=[];var _0x5bfa31=squel[_0x3114('0x60')]();_0x5bfa31[_0x3114('0x61')]('tq.TeamId')['from'](_0x3114('0x62'),'tq')[_0x3114('0x63')]('user_has_teams','ut',_0x3114('0x64'))[_0x3114('0x26')]('WhatsappQueueId\x20=\x20?',_0x4d3110[_0x3114('0x3b')]['id']);for(var _0xf407fb=0x0;_0xf407fb<_0x4591a8['length'];_0xf407fb+=0x1){let _0x49df1c=_0x4591a8[_0xf407fb];for(var _0x5c5a0c=0x0;_0x5c5a0c<_0x49df1c[_0x3114('0x57')]['length'];_0x5c5a0c+=0x1){let _0x1f45f9=_0x49df1c[_0x3114('0x57')][_0x5c5a0c];var _0x44d272=_0x5bfa31[_0x3114('0x65')]();_0x44d272[_0x3114('0x26')](_0x3114('0x66'),_0x1f45f9['id']);_0x93426f['push'](db[_0x3114('0x58')][_0x3114('0x2b')](_0x44d272[_0x3114('0x67')](),{'type':db[_0x3114('0x58')][_0x3114('0x68')][_0x3114('0x69')]})['then'](function(_0x438c03){if(_0x438c03[_0x3114('0x40')]===0x1){return _0x1f45f9['id'];}else{var _0x589904=_['every'](_[_0x3114('0x1f')](_0x438c03,_0x3114('0x6a')),function(_0x96b028){return _[_0x3114('0x6b')](_0x3b7af1,_0x96b028);});if(_0x589904){return _0x1f45f9['id'];}}}));}}return BPromise[_0x3114('0x6c')](_0x93426f)[_0x3114('0x17')](function(_0x4901e6){_0x2f4bc4=_(_0x2f4bc4)[_0x3114('0x6d')](_0x4901e6)[_0x3114('0x6e')]()[_0x3114('0x6f')]();return db[_0x3114('0x20')][_0x3114('0x32')]({'where':{'id':_0x4d3110['params']['id']}})[_0x3114('0x17')](function(_0x33fa03){return db[_0x3114('0x58')][_0x3114('0x59')](function(_0x2e9a5d){return _0x33fa03[_0x3114('0x5f')](_0x4d3110[_0x3114('0x2b')][_0x3114('0x51')],{'transaction':_0x2e9a5d})[_0x3114('0x17')](function(){if(!_[_0x3114('0x70')](_0x2f4bc4)){return _0x33fa03[_0x3114('0x71')](_0x2f4bc4,{'transaction':_0x2e9a5d});}})[_0x3114('0x17')](function(){_0x2f4bc4[_0x3114('0x5c')](function(_0x15b2f2){socket[_0x3114('0x5d')](_0x3114('0x72'),{'UserId':_0x15b2f2,'WhatsappQueueId':_0x33fa03['id']});});});});});});})['then'](respondWithStatusCode(_0x1cd1f6,null))[_0x3114('0x28')](handleError(_0x1cd1f6,null));};exports[_0x3114('0x73')]=function(_0x3c8d09,_0xbe74b0){return db[_0x3114('0x20')][_0x3114('0x32')]({'where':{'id':_0x3c8d09[_0x3114('0x3b')]['id']}})[_0x3114('0x17')](handleEntityNotFound(_0xbe74b0,null))[_0x3114('0x17')](function(_0x30d1a2){if(_0x30d1a2){return _0x30d1a2[_0x3114('0x73')](_0x3c8d09['body'][_0x3114('0x51')],_[_0x3114('0x74')](_0x3c8d09['body'],[_0x3114('0x51'),'id'])||{})[_0x3114('0x75')](function(_0x3045a3){for(var _0x495e74=0x0;_0x495e74<_0x3c8d09[_0x3114('0x34')][_0x3114('0x51')][_0x3114('0x40')];_0x495e74+=0x1){socket['emit'](_0x3114('0x5e'),{'UserId':Number(_0x3c8d09[_0x3114('0x34')][_0x3114('0x51')][_0x495e74]),'WhatsappQueueId':Number(_0x3c8d09[_0x3114('0x3b')]['id'])});}return _0x3045a3;});}})[_0x3114('0x17')](respondWithResult(_0xbe74b0,null))[_0x3114('0x28')](handleError(_0xbe74b0,null));};exports[_0x3114('0x71')]=function(_0x9c39cd,_0x1c5bcc){return db[_0x3114('0x20')][_0x3114('0x32')]({'where':{'id':_0x9c39cd[_0x3114('0x3b')]['id']}})[_0x3114('0x17')](handleEntityNotFound(_0x1c5bcc,null))[_0x3114('0x17')](function(_0x21b18f){if(_0x21b18f){return _0x21b18f['removeAgents'](_0x9c39cd['query'][_0x3114('0x51')])[_0x3114('0x17')](function(){if(_[_0x3114('0x76')](_0x9c39cd[_0x3114('0x2b')][_0x3114('0x51')])){for(var _0x234aa9=0x0;_0x234aa9<_0x9c39cd[_0x3114('0x2b')][_0x3114('0x51')][_0x3114('0x40')];_0x234aa9+=0x1){socket['emit'](_0x3114('0x72'),{'UserId':Number(_0x9c39cd[_0x3114('0x2b')][_0x3114('0x51')][_0x234aa9]),'WhatsappQueueId':Number(_0x9c39cd[_0x3114('0x3b')]['id'])});}}else{socket[_0x3114('0x5d')](_0x3114('0x72'),{'UserId':Number(_0x9c39cd[_0x3114('0x2b')][_0x3114('0x51')]),'WhatsappQueueId':Number(_0x9c39cd[_0x3114('0x3b')]['id'])});}});}})[_0x3114('0x17')](respondWithStatusCode(_0x1c5bcc,null))[_0x3114('0x28')](handleError(_0x1c5bcc,null));};exports[_0x3114('0x77')]=function(_0x2f52e4,_0x5e133c){var _0x3c16e8={};var _0x44af3f={};var _0x1dd0e5;var _0xcfe6e9;return db['WhatsappQueue'][_0x3114('0x3d')]({'where':{'id':_0x2f52e4[_0x3114('0x3b')]['id']}})['then'](handleEntityNotFound(_0x5e133c,null))['then'](function(_0x4c2978){if(_0x4c2978){_0x1dd0e5=_0x4c2978;_0x44af3f['model']=_[_0x3114('0x2a')](db[_0x3114('0x78')][_0x3114('0x21')]);_0x44af3f[_0x3114('0x2b')]=_[_0x3114('0x2a')](_0x2f52e4['query']);_0x44af3f[_0x3114('0x3f')]=_[_0x3114('0x2c')](_0x44af3f[_0x3114('0x29')],_0x44af3f['query']);_0x3c16e8['attributes']=_[_0x3114('0x2c')](_0x44af3f[_0x3114('0x29')],qs[_0x3114('0x2e')](_0x2f52e4[_0x3114('0x2b')][_0x3114('0x2e')]));_0x3c16e8[_0x3114('0x2d')]=_0x3c16e8['attributes'][_0x3114('0x40')]?_0x3c16e8[_0x3114('0x2d')]:_0x44af3f[_0x3114('0x29')];_0x3c16e8['order']=qs[_0x3114('0x43')](_0x2f52e4[_0x3114('0x2b')]['sort']);_0x3c16e8[_0x3114('0x26')]=qs[_0x3114('0x3f')](_[_0x3114('0x44')](_0x2f52e4[_0x3114('0x2b')],_0x44af3f[_0x3114('0x3f')]));if(_0x2f52e4['query'][_0x3114('0x46')]){_0x3c16e8[_0x3114('0x26')]=_[_0x3114('0x31')](_0x3c16e8['where'],{'$or':_[_0x3114('0x1f')](_0x3c16e8['attributes'],function(_0xa4b1e5){var _0x2d924={};_0x2d924[_0xa4b1e5]={'$like':'%'+_0x2f52e4['query']['filter']+'%'};return _0x2d924;})});}_0x3c16e8=_[_0x3114('0x31')]({},_0x3c16e8,_0x2f52e4['options']);return _0x1dd0e5[_0x3114('0x77')](_0x3c16e8);}})[_0x3114('0x17')](function(_0x56a8a4){if(_0x56a8a4){_0xcfe6e9=_0x56a8a4[_0x3114('0x40')];if(!_0x2f52e4[_0x3114('0x2b')][_0x3114('0x50')](_0x3114('0x41'))){_0x3c16e8[_0x3114('0x11')]=qs[_0x3114('0x11')](_0x2f52e4['query'][_0x3114('0x11')]);_0x3c16e8[_0x3114('0xf')]=qs[_0x3114('0xf')](_0x2f52e4[_0x3114('0x2b')][_0x3114('0xf')]);}return _0x1dd0e5[_0x3114('0x77')](_0x3c16e8);}})[_0x3114('0x17')](function(_0x23cce9){if(_0x23cce9){return _0x23cce9?{'count':_0xcfe6e9,'rows':_0x23cce9}:null;}})[_0x3114('0x17')](respondWithResult(_0x5e133c,null))[_0x3114('0x28')](handleError(_0x5e133c,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 81d018b..3033a98 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 _0x9e43=['exports','../../mysqldb','WhatsappQueue','setMaxListeners','update','emit','hook'];(function(_0x2cbc89,_0x31d471){var _0x2c2c88=function(_0x568c36){while(--_0x568c36){_0x2cbc89['push'](_0x2cbc89['shift']());}};_0x2c2c88(++_0x31d471);}(_0x9e43,0x1a5));var _0x39e4=function(_0x3158d2,_0x277d23){_0x3158d2=_0x3158d2-0x0;var _0x57c15a=_0x9e43[_0x3158d2];return _0x57c15a;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x39e4('0x0'))['db'][_0x39e4('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x39e4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x39e4('0x3'),'afterDestroy':'remove'};function emitEvent(_0x55f4e5){return function(_0x1460cf,_0x47756d,_0x4811fa){WhatsappQueueEvents[_0x39e4('0x4')](_0x55f4e5+':'+_0x1460cf['id'],_0x1460cf);WhatsappQueueEvents[_0x39e4('0x4')](_0x55f4e5,_0x1460cf);_0x4811fa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x39e4('0x5')](e,emitEvent(event));}}module[_0x39e4('0x6')]=WhatsappQueueEvents; \ No newline at end of file +var _0xd2f4=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd2f4,0x15b));var _0x4d2f=function(_0x2ce733,_0x1a2ea2){_0x2ce733=_0x2ce733-0x0;var _0x31dc08=_0xd2f4[_0x2ce733];return _0x31dc08;};'use strict';var EventEmitter=require(_0x4d2f('0x0'));var WhatsappQueue=require(_0x4d2f('0x1'))['db'][_0x4d2f('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x4d2f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4d2f('0x4'),'afterDestroy':_0x4d2f('0x5')};function emitEvent(_0x5dddba){return function(_0x34e31c,_0x3bdfa4,_0x30a18e){WhatsappQueueEvents[_0x4d2f('0x6')](_0x5dddba+':'+_0x34e31c['id'],_0x34e31c);WhatsappQueueEvents[_0x4d2f('0x6')](_0x5dddba,_0x34e31c);_0x30a18e(null);};}for(var e in events){if(events[_0x4d2f('0x7')](e)){var event=events[e];WhatsappQueue[_0x4d2f('0x8')](e,emitEvent(event));}}module[_0x4d2f('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index fc3636e..1d0fd2b 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 _0xd2d0=['./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x36232e,_0x1b399e){var _0x86eb83=function(_0x375331){while(--_0x375331){_0x36232e['push'](_0x36232e['shift']());}};_0x86eb83(++_0x1b399e);}(_0xd2d0,0x148));var _0x0d2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2d0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0d2d('0x0'));var util=require(_0x0d2d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0d2d('0x2'));var BPromise=require(_0x0d2d('0x3'));var rp=require(_0x0d2d('0x4'));var fs=require('fs');var path=require(_0x0d2d('0x5'));var rimraf=require(_0x0d2d('0x6'));var config=require(_0x0d2d('0x7'));var attributes=require(_0x0d2d('0x8'));module['exports']=function(_0x2220f5,_0x4145b0){return _0x2220f5[_0x0d2d('0x9')](_0x0d2d('0xa'),attributes,{'tableName':_0x0d2d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefd5=['WhatsappQueue','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define'];(function(_0x5d33c0,_0x1596fc){var _0x7ad47d=function(_0x25658b){while(--_0x25658b){_0x5d33c0['push'](_0x5d33c0['shift']());}};_0x7ad47d(++_0x1596fc);}(_0xefd5,0x187));var _0x5efd=function(_0x27d067,_0x265adf){_0x27d067=_0x27d067-0x0;var _0x5d2b35=_0xefd5[_0x27d067];return _0x5d2b35;};'use strict';var _=require(_0x5efd('0x0'));var util=require(_0x5efd('0x1'));var logger=require(_0x5efd('0x2'))(_0x5efd('0x3'));var moment=require(_0x5efd('0x4'));var BPromise=require('bluebird');var rp=require(_0x5efd('0x5'));var fs=require('fs');var path=require(_0x5efd('0x6'));var rimraf=require(_0x5efd('0x7'));var config=require(_0x5efd('0x8'));var attributes=require(_0x5efd('0x9'));module[_0x5efd('0xa')]=function(_0x75a4c2,_0x310205){return _0x75a4c2[_0x5efd('0xb')](_0x5efd('0xc'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 82ef096..a09bd43 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 _0xf1c3=['message','WhatsappQueue','findAll','options','where','attributes','limit','map','include','model','then','GetWhatsappQueue','catch','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','socket.io-emitter','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x563436,_0xd66092){var _0x5b4315=function(_0x5cede3){while(--_0x5cede3){_0x563436['push'](_0x563436['shift']());}};_0x5b4315(++_0xd66092);}(_0xf1c3,0x190));var _0x3f1c=function(_0x52ea08,_0x15d935){_0x52ea08=_0x52ea08-0x0;var _0x28d546=_0xf1c3[_0x52ea08];return _0x28d546;};'use strict';var _=require(_0x3f1c('0x0'));var util=require(_0x3f1c('0x1'));var moment=require(_0x3f1c('0x2'));var BPromise=require(_0x3f1c('0x3'));var rs=require(_0x3f1c('0x4'));var fs=require('fs');var Redis=require(_0x3f1c('0x5'));var db=require(_0x3f1c('0x6'))['db'];var utils=require(_0x3f1c('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x3f1c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3f1c('0x9')][_0x3f1c('0xa')]({'port':0x232a});config[_0x3f1c('0xb')]=_[_0x3f1c('0xc')](config[_0x3f1c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3f1c('0xd'))(new Redis(config[_0x3f1c('0xb')]));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x458337,_0x4a6d91,_0x555e9f){return new BPromise(function(_0x4ca4b3,_0x4f3eaa){return client['request'](_0x458337,_0x555e9f)['then'](function(_0x3f62cf){logger[_0x3f1c('0xe')](_0x3f1c('0xf'),_0x4a6d91,_0x3f1c('0x10'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x4a6d91,'request\x20sent',JSON[_0x3f1c('0x11')](_0x3f62cf));if(_0x3f62cf[_0x3f1c('0x12')]){if(_0x3f62cf[_0x3f1c('0x12')][_0x3f1c('0x13')]===0x1f4){logger[_0x3f1c('0x12')](_0x3f1c('0xf'),_0x4a6d91,_0x3f62cf['error']['message']);return _0x4f3eaa(_0x3f62cf['error']['message']);}logger[_0x3f1c('0x12')](_0x3f1c('0xf'),_0x4a6d91,_0x3f62cf[_0x3f1c('0x12')]['message']);return _0x4ca4b3(_0x3f62cf[_0x3f1c('0x12')][_0x3f1c('0x14')]);}else{logger['info'](_0x3f1c('0xf'),_0x4a6d91,_0x3f1c('0x10'));_0x4ca4b3(_0x3f62cf['result'][_0x3f1c('0x14')]);}})['catch'](function(_0xb74277){logger['error'](_0x3f1c('0xf'),_0x4a6d91,_0xb74277);_0x4f3eaa(_0xb74277);});});}exports['GetWhatsappQueue']=function(_0x31ceb1){var _0x3bbad0=this;return new Promise(function(_0x4d273f,_0x41e47d){return db[_0x3f1c('0x15')][_0x3f1c('0x16')]({'raw':_0x31ceb1[_0x3f1c('0x17')]?_0x31ceb1[_0x3f1c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x31ceb1['options']?_0x31ceb1['options'][_0x3f1c('0x18')]||null:null,'attributes':_0x31ceb1['options']?_0x31ceb1[_0x3f1c('0x17')][_0x3f1c('0x19')]||null:null,'limit':_0x31ceb1[_0x3f1c('0x17')]?_0x31ceb1[_0x3f1c('0x17')][_0x3f1c('0x1a')]||null:null,'include':_0x31ceb1['options']?_0x31ceb1['options']['include']?_[_0x3f1c('0x1b')](_0x31ceb1['options'][_0x3f1c('0x1c')],function(_0x89dcb4){return{'model':db[_0x89dcb4[_0x3f1c('0x1d')]],'as':_0x89dcb4['as'],'attributes':_0x89dcb4[_0x3f1c('0x19')],'include':_0x89dcb4['include']?_['map'](_0x89dcb4['include'],function(_0x4eba6c){return{'model':db[_0x4eba6c[_0x3f1c('0x1d')]],'as':_0x4eba6c['as'],'attributes':_0x4eba6c[_0x3f1c('0x19')],'include':_0x4eba6c['include']?_[_0x3f1c('0x1b')](_0x4eba6c[_0x3f1c('0x1c')],function(_0xfd295a){return{'model':db[_0xfd295a[_0x3f1c('0x1d')]],'as':_0xfd295a['as'],'attributes':_0xfd295a[_0x3f1c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3f1c('0x1e')](function(_0x4d7cdb){logger[_0x3f1c('0xe')](_0x3f1c('0x1f'),_0x31ceb1);logger['debug'](_0x3f1c('0x1f'),_0x31ceb1,JSON[_0x3f1c('0x11')](_0x4d7cdb));_0x4d273f(_0x4d7cdb);})[_0x3f1c('0x20')](function(_0x59305b){logger[_0x3f1c('0x12')](_0x3f1c('0x1f'),_0x59305b[_0x3f1c('0x14')],_0x31ceb1);_0x41e47d(_0x3bbad0[_0x3f1c('0x12')](0x1f4,_0x59305b['message']));});});};exports[_0x3f1c('0x21')]=function(_0x30ba69){var _0x12f43c=this;return new Promise(function(_0x37a00c,_0xd7e38d){return db[_0x3f1c('0x15')][_0x3f1c('0x22')]({'raw':_0x30ba69[_0x3f1c('0x17')]?_0x30ba69[_0x3f1c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x30ba69[_0x3f1c('0x17')]?_0x30ba69['options']['where']||null:null,'attributes':_0x30ba69['options']?_0x30ba69['options'][_0x3f1c('0x19')]||null:null,'include':_0x30ba69[_0x3f1c('0x17')]?_0x30ba69[_0x3f1c('0x17')][_0x3f1c('0x1c')]?_[_0x3f1c('0x1b')](_0x30ba69['options'][_0x3f1c('0x1c')],function(_0x53e642){return{'model':db[_0x53e642[_0x3f1c('0x1d')]],'as':_0x53e642['as'],'attributes':_0x53e642[_0x3f1c('0x19')],'include':_0x53e642[_0x3f1c('0x1c')]?_['map'](_0x53e642[_0x3f1c('0x1c')],function(_0x27eb66){return{'model':db[_0x27eb66['model']],'as':_0x27eb66['as'],'attributes':_0x27eb66['attributes'],'include':_0x27eb66['include']?_[_0x3f1c('0x1b')](_0x27eb66[_0x3f1c('0x1c')],function(_0x429efa){return{'model':db[_0x429efa[_0x3f1c('0x1d')]],'as':_0x429efa['as'],'attributes':_0x429efa[_0x3f1c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x197235){logger[_0x3f1c('0xe')](_0x3f1c('0x21'),_0x30ba69);logger['debug'](_0x3f1c('0x21'),_0x30ba69,JSON['stringify'](_0x197235));_0x37a00c(_0x197235);})['catch'](function(_0x42a0fb){logger[_0x3f1c('0x12')](_0x3f1c('0x21'),_0x42a0fb[_0x3f1c('0x14')],_0x30ba69);_0xd7e38d(_0x12f43c[_0x3f1c('0x12')](0x1f4,_0x42a0fb[_0x3f1c('0x14')]));});});}; \ No newline at end of file +var _0x9c89=['ShowWhatsappQueue','find','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','./whatsappQueue.socket','register','request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','WhatsappQueue','options','raw','where','limit','include','map','model','attributes','GetWhatsappQueue'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x9c89,0x96));var _0x99c8=function(_0x300bb0,_0x536c41){_0x300bb0=_0x300bb0-0x0;var _0x57a3e4=_0x9c89[_0x300bb0];return _0x57a3e4;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x99c8('0x0'));var rs=require(_0x99c8('0x1'));var fs=require('fs');var Redis=require(_0x99c8('0x2'));var db=require(_0x99c8('0x3'))['db'];var utils=require(_0x99c8('0x4'));var logger=require(_0x99c8('0x5'))('rpc');var config=require(_0x99c8('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x99c8('0x7')]({'port':0x232a});config[_0x99c8('0x8')]=_[_0x99c8('0x9')](config[_0x99c8('0x8')],{'host':_0x99c8('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x99c8('0x8')]));require(_0x99c8('0xb'))[_0x99c8('0xc')](socket);function respondWithRpcPromise(_0x10c5ce,_0x300167,_0xceb48){return new BPromise(function(_0x2f393d,_0x504dff){return client[_0x99c8('0xd')](_0x10c5ce,_0xceb48)[_0x99c8('0xe')](function(_0x1928f2){logger[_0x99c8('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x300167,_0x99c8('0x10'));logger[_0x99c8('0x11')](_0x99c8('0x12'),_0x300167,_0x99c8('0x10'),JSON[_0x99c8('0x13')](_0x1928f2));if(_0x1928f2['error']){if(_0x1928f2[_0x99c8('0x14')][_0x99c8('0x15')]===0x1f4){logger[_0x99c8('0x14')](_0x99c8('0x16'),_0x300167,_0x1928f2['error']['message']);return _0x504dff(_0x1928f2[_0x99c8('0x14')]['message']);}logger[_0x99c8('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x300167,_0x1928f2[_0x99c8('0x14')][_0x99c8('0x17')]);return _0x2f393d(_0x1928f2['error'][_0x99c8('0x17')]);}else{logger[_0x99c8('0xf')](_0x99c8('0x16'),_0x300167,_0x99c8('0x10'));_0x2f393d(_0x1928f2[_0x99c8('0x18')][_0x99c8('0x17')]);}})['catch'](function(_0x39beb2){logger[_0x99c8('0x14')](_0x99c8('0x16'),_0x300167,_0x39beb2);_0x504dff(_0x39beb2);});});}exports['GetWhatsappQueue']=function(_0x2315e1){var _0x3b6f51=this;return new Promise(function(_0x25b149,_0x31629f){return db[_0x99c8('0x19')]['findAll']({'raw':_0x2315e1[_0x99c8('0x1a')]?_0x2315e1[_0x99c8('0x1a')][_0x99c8('0x1b')]===undefined?!![]:![]:!![],'where':_0x2315e1[_0x99c8('0x1a')]?_0x2315e1[_0x99c8('0x1a')][_0x99c8('0x1c')]||null:null,'attributes':_0x2315e1[_0x99c8('0x1a')]?_0x2315e1[_0x99c8('0x1a')]['attributes']||null:null,'limit':_0x2315e1['options']?_0x2315e1['options'][_0x99c8('0x1d')]||null:null,'include':_0x2315e1[_0x99c8('0x1a')]?_0x2315e1[_0x99c8('0x1a')][_0x99c8('0x1e')]?_[_0x99c8('0x1f')](_0x2315e1[_0x99c8('0x1a')][_0x99c8('0x1e')],function(_0x498b79){return{'model':db[_0x498b79['model']],'as':_0x498b79['as'],'attributes':_0x498b79['attributes'],'include':_0x498b79[_0x99c8('0x1e')]?_['map'](_0x498b79[_0x99c8('0x1e')],function(_0x1aef97){return{'model':db[_0x1aef97[_0x99c8('0x20')]],'as':_0x1aef97['as'],'attributes':_0x1aef97[_0x99c8('0x21')],'include':_0x1aef97['include']?_[_0x99c8('0x1f')](_0x1aef97[_0x99c8('0x1e')],function(_0x417fff){return{'model':db[_0x417fff[_0x99c8('0x20')]],'as':_0x417fff['as'],'attributes':_0x417fff[_0x99c8('0x21')]};}):[]};}):[]};}):[]:[]})[_0x99c8('0xe')](function(_0x49f041){logger['info'](_0x99c8('0x22'),_0x2315e1);logger[_0x99c8('0x11')]('GetWhatsappQueue',_0x2315e1,JSON['stringify'](_0x49f041));_0x25b149(_0x49f041);})['catch'](function(_0x9e2b7){logger['error'](_0x99c8('0x22'),_0x9e2b7['message'],_0x2315e1);_0x31629f(_0x3b6f51[_0x99c8('0x14')](0x1f4,_0x9e2b7['message']));});});};exports[_0x99c8('0x23')]=function(_0x309ba7){var _0x315daa=this;return new Promise(function(_0x55d2b0,_0x5b13de){return db[_0x99c8('0x19')][_0x99c8('0x24')]({'raw':_0x309ba7[_0x99c8('0x1a')]?_0x309ba7[_0x99c8('0x1a')][_0x99c8('0x1b')]===undefined?!![]:![]:!![],'where':_0x309ba7[_0x99c8('0x1a')]?_0x309ba7[_0x99c8('0x1a')][_0x99c8('0x1c')]||null:null,'attributes':_0x309ba7['options']?_0x309ba7[_0x99c8('0x1a')]['attributes']||null:null,'include':_0x309ba7['options']?_0x309ba7['options'][_0x99c8('0x1e')]?_[_0x99c8('0x1f')](_0x309ba7[_0x99c8('0x1a')][_0x99c8('0x1e')],function(_0x2fb5cc){return{'model':db[_0x2fb5cc['model']],'as':_0x2fb5cc['as'],'attributes':_0x2fb5cc[_0x99c8('0x21')],'include':_0x2fb5cc[_0x99c8('0x1e')]?_['map'](_0x2fb5cc[_0x99c8('0x1e')],function(_0x2d7e5c){return{'model':db[_0x2d7e5c[_0x99c8('0x20')]],'as':_0x2d7e5c['as'],'attributes':_0x2d7e5c['attributes'],'include':_0x2d7e5c[_0x99c8('0x1e')]?_[_0x99c8('0x1f')](_0x2d7e5c[_0x99c8('0x1e')],function(_0x2b6476){return{'model':db[_0x2b6476[_0x99c8('0x20')]],'as':_0x2b6476['as'],'attributes':_0x2b6476[_0x99c8('0x21')]};}):[]};}):[]};}):[]:[]})[_0x99c8('0xe')](function(_0x4a9e14){logger[_0x99c8('0xf')](_0x99c8('0x23'),_0x309ba7);logger[_0x99c8('0x11')](_0x99c8('0x23'),_0x309ba7,JSON[_0x99c8('0x13')](_0x4a9e14));_0x55d2b0(_0x4a9e14);})['catch'](function(_0x2cfd92){logger['error'](_0x99c8('0x23'),_0x2cfd92[_0x99c8('0x17')],_0x309ba7);_0x5b13de(_0x315daa[_0x99c8('0x14')](0x1f4,_0x2cfd92[_0x99c8('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 46e2663..0e33316 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 _0xaeb2=['length','whatsappQueue:','./whatsappQueue.events','save','remove','update','removeListener'];(function(_0x31b95d,_0x4a1602){var _0x114ab0=function(_0x577afb){while(--_0x577afb){_0x31b95d['push'](_0x31b95d['shift']());}};_0x114ab0(++_0x4a1602);}(_0xaeb2,0xf7));var _0x2aeb=function(_0x29b07b,_0x3aefa0){_0x29b07b=_0x29b07b-0x0;var _0x584869=_0xaeb2[_0x29b07b];return _0x584869;};'use strict';var WhatsappQueueEvents=require(_0x2aeb('0x0'));var events=[_0x2aeb('0x1'),_0x2aeb('0x2'),_0x2aeb('0x3')];function createListener(_0x469b6d,_0x432fa6){return function(_0x124f8d){_0x432fa6['emit'](_0x469b6d,_0x124f8d);};}function removeListener(_0x176cd9,_0x1d8ce5){return function(){WhatsappQueueEvents[_0x2aeb('0x4')](_0x176cd9,_0x1d8ce5);};}exports['register']=function(_0x4a1a67){for(var _0x18384d=0x0,_0x27764b=events[_0x2aeb('0x5')];_0x18384d<_0x27764b;_0x18384d++){var _0x3938f1=events[_0x18384d];var _0x5c919f=createListener(_0x2aeb('0x6')+_0x3938f1,_0x4a1a67);WhatsappQueueEvents['on'](_0x3938f1,_0x5c919f);}}; \ No newline at end of file +var _0x1d31=['removeListener','length','whatsappQueue:','save','update','emit'];(function(_0x3989a4,_0x10ae52){var _0x2c3d9f=function(_0x90f31f){while(--_0x90f31f){_0x3989a4['push'](_0x3989a4['shift']());}};_0x2c3d9f(++_0x10ae52);}(_0x1d31,0x1c5));var _0x11d3=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x1d31[_0x29db36];return _0x234e87;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x11d3('0x0'),'remove',_0x11d3('0x1')];function createListener(_0x2c5523,_0x1ad537){return function(_0x419c2d){_0x1ad537[_0x11d3('0x2')](_0x2c5523,_0x419c2d);};}function removeListener(_0x323de4,_0x12ed32){return function(){WhatsappQueueEvents[_0x11d3('0x3')](_0x323de4,_0x12ed32);};}exports['register']=function(_0x4734ad){for(var _0x5c8d33=0x0,_0x278aec=events[_0x11d3('0x4')];_0x5c8d33<_0x278aec;_0x5c8d33++){var _0x4098d4=events[_0x5c8d33];var _0x33e292=createListener(_0x11d3('0x5')+_0x4098d4,_0x4734ad);WhatsappQueueEvents['on'](_0x4098d4,_0x33e292);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index d8870f6..2cfcc58 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 _0x7191=['create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post'];(function(_0x106214,_0x454b8d){var _0x5f5cea=function(_0x247841){while(--_0x247841){_0x106214['push'](_0x106214['shift']());}};_0x5f5cea(++_0x454b8d);}(_0x7191,0x1e9));var _0x1719=function(_0x32c5ec,_0x413832){_0x32c5ec=_0x32c5ec-0x0;var _0x3a16bf=_0x7191[_0x32c5ec];return _0x3a16bf;};'use strict';var multer=require(_0x1719('0x0'));var util=require('util');var path=require(_0x1719('0x1'));var timeout=require('connect-timeout');var express=require(_0x1719('0x2'));var router=express[_0x1719('0x3')]();var fs_extra=require(_0x1719('0x4'));var auth=require(_0x1719('0x5'));var interaction=require(_0x1719('0x6'));var config=require(_0x1719('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0x1719('0x8')]('/',auth[_0x1719('0x9')](),controller['index']);router[_0x1719('0x8')](_0x1719('0xa'),auth['isAuthenticated'](),controller[_0x1719('0xb')]);router[_0x1719('0x8')](_0x1719('0xc'),auth[_0x1719('0x9')](),controller[_0x1719('0xd')]);router[_0x1719('0xe')]('/',auth['isAuthenticated'](),controller[_0x1719('0xf')]);router[_0x1719('0x10')]('/:id',auth[_0x1719('0x9')](),controller[_0x1719('0x11')]);router[_0x1719('0x12')](_0x1719('0xc'),auth[_0x1719('0x9')](),controller[_0x1719('0x13')]);module[_0x1719('0x14')]=router; \ No newline at end of file +var _0x71e1=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x4e1a49,_0x4da738){var _0x136aae=function(_0x3ffd93){while(--_0x3ffd93){_0x4e1a49['push'](_0x4e1a49['shift']());}};_0x136aae(++_0x4da738);}(_0x71e1,0x104));var _0x171e=function(_0x56ffb1,_0xe3e8ce){_0x56ffb1=_0x56ffb1-0x0;var _0x3234a3=_0x71e1[_0x56ffb1];return _0x3234a3;};'use strict';var multer=require(_0x171e('0x0'));var util=require(_0x171e('0x1'));var path=require('path');var timeout=require(_0x171e('0x2'));var express=require(_0x171e('0x3'));var router=express['Router']();var fs_extra=require(_0x171e('0x4'));var auth=require(_0x171e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x171e('0x6'));router[_0x171e('0x7')]('/',auth[_0x171e('0x8')](),controller['index']);router[_0x171e('0x7')](_0x171e('0x9'),auth[_0x171e('0x8')](),controller[_0x171e('0xa')]);router[_0x171e('0x7')]('/:id',auth[_0x171e('0x8')](),controller[_0x171e('0xb')]);router[_0x171e('0xc')]('/',auth[_0x171e('0x8')](),controller[_0x171e('0xd')]);router[_0x171e('0xe')](_0x171e('0xf'),auth['isAuthenticated'](),controller[_0x171e('0x10')]);router[_0x171e('0x11')](_0x171e('0xf'),auth['isAuthenticated'](),controller[_0x171e('0x12')]);module[_0x171e('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 793ffda..7eeb507 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(_0x3e5535,_0x1e7c13){var _0x191d41=function(_0x4b015d){while(--_0x4b015d){_0x3e5535['push'](_0x3e5535['shift']());}};_0x191d41(++_0x1e7c13);}(_0x7a54,0x106));var _0x47a5=function(_0x54a066,_0x2ed1d7){_0x54a066=_0x54a066-0x0;var _0x565398=_0x7a54[_0x54a066];return _0x565398;};'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(_0x140161,_0x477d7f){var _0x4ef211=function(_0x2bac56){while(--_0x2bac56){_0x140161['push'](_0x140161['shift']());}};_0x4ef211(++_0x477d7f);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 08975f1..ac273b8 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 _0xfff0=['length','include','body','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','WhatsappQueueReport','includeAll','findAll','catch','params'];(function(_0x24304c,_0x5c5332){var _0x457533=function(_0x340cdf){while(--_0x340cdf){_0x24304c['push'](_0x24304c['shift']());}};_0x457533(++_0x5c5332);}(_0xfff0,0x139));var _0x0fff=function(_0x3f82ec,_0x295746){_0x3f82ec=_0x3f82ec-0x0;var _0x5be8c2=_0xfff0[_0x3f82ec];return _0x5be8c2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fff('0x0'));var zipdir=require(_0x0fff('0x1'));var jsonpatch=require(_0x0fff('0x2'));var rp=require('request-promise');var moment=require(_0x0fff('0x3'));var BPromise=require(_0x0fff('0x4'));var Mustache=require(_0x0fff('0x5'));var util=require('util');var path=require(_0x0fff('0x6'));var sox=require(_0x0fff('0x7'));var csv=require('to-csv');var ejs=require(_0x0fff('0x8'));var fs=require('fs');var fs_extra=require(_0x0fff('0x9'));var _=require(_0x0fff('0xa'));var squel=require('squel');var crypto=require(_0x0fff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fff('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0fff('0xd'));var Papa=require(_0x0fff('0xe'));var Redis=require('ioredis');var authService=require(_0x0fff('0xf'));var qs=require(_0x0fff('0x10'));var as=require(_0x0fff('0x11'));var hardwareService=require(_0x0fff('0x12'));var logger=require(_0x0fff('0x13'))(_0x0fff('0x14'));var utils=require(_0x0fff('0x15'));var config=require(_0x0fff('0x16'));var licenseUtil=require(_0x0fff('0x17'));var db=require(_0x0fff('0x18'))['db'];function respondWithStatusCode(_0x13f768,_0x5abecd){_0x5abecd=_0x5abecd||0xcc;return function(_0x1fb243){if(_0x1fb243){return _0x13f768['sendStatus'](_0x5abecd);}return _0x13f768[_0x0fff('0x19')](_0x5abecd)[_0x0fff('0x1a')]();};}function respondWithResult(_0x38fc82,_0x2c0322){_0x2c0322=_0x2c0322||0xc8;return function(_0x55e5fa){if(_0x55e5fa){return _0x38fc82['status'](_0x2c0322)[_0x0fff('0x1b')](_0x55e5fa);}};}function respondWithFilteredResult(_0x50a9e4,_0x5636fd){return function(_0x51ceea){if(_0x51ceea){var _0x1fb430=typeof _0x5636fd[_0x0fff('0x1c')]==='undefined'&&typeof _0x5636fd[_0x0fff('0x1d')]===_0x0fff('0x1e');var _0x540a67=_0x51ceea['count'];var _0x48f36d=_0x1fb430?0x0:_0x5636fd[_0x0fff('0x1c')];var _0x606792=_0x1fb430?_0x51ceea[_0x0fff('0x1f')]:_0x5636fd[_0x0fff('0x1c')]+_0x5636fd[_0x0fff('0x1d')];var _0xe89b4a;if(_0x606792>=_0x540a67){_0x606792=_0x540a67;_0xe89b4a=0xc8;}else{_0xe89b4a=0xce;}_0x50a9e4['status'](_0xe89b4a);return _0x50a9e4[_0x0fff('0x20')](_0x0fff('0x21'),_0x48f36d+'-'+_0x606792+'/'+_0x540a67)[_0x0fff('0x1b')](_0x51ceea);}return null;};}function patchUpdates(_0x49d211){return function(_0x5e27df){try{jsonpatch[_0x0fff('0x22')](_0x5e27df,_0x49d211,!![]);}catch(_0x330e29){return BPromise[_0x0fff('0x23')](_0x330e29);}return _0x5e27df[_0x0fff('0x24')]();};}function saveUpdates(_0x502393,_0x155132){return function(_0x2f8665){if(_0x2f8665){return _0x2f8665[_0x0fff('0x25')](_0x502393)[_0x0fff('0x26')](function(_0x16e7f4){return _0x16e7f4;});}return null;};}function removeEntity(_0x17fba6,_0x580b8e){return function(_0x6a116c){if(_0x6a116c){return _0x6a116c[_0x0fff('0x27')]()[_0x0fff('0x26')](function(){_0x17fba6[_0x0fff('0x19')](0xcc)[_0x0fff('0x1a')]();});}};}function handleEntityNotFound(_0x23d9f8,_0x482e1e){return function(_0x2c9725){if(!_0x2c9725){_0x23d9f8[_0x0fff('0x28')](0x194);}return _0x2c9725;};}function handleError(_0x2d1610,_0x440f56){_0x440f56=_0x440f56||0x1f4;return function(_0x36d268){logger[_0x0fff('0x29')](_0x36d268[_0x0fff('0x2a')]);if(_0x36d268[_0x0fff('0x2b')]){delete _0x36d268[_0x0fff('0x2b')];}_0x2d1610[_0x0fff('0x19')](_0x440f56)[_0x0fff('0x2c')](_0x36d268);};}exports[_0x0fff('0x2d')]=function(_0x495734,_0x7046a3){var _0x2d1800={},_0x17ab6f={},_0x42441e={'count':0x0,'rows':[]};var _0x1f643d=_[_0x0fff('0x2e')](db['WhatsappQueueReport'][_0x0fff('0x2f')],function(_0xa16c29){return{'name':_0xa16c29[_0x0fff('0x30')],'type':_0xa16c29['type'][_0x0fff('0x31')]};});_0x17ab6f[_0x0fff('0x32')]=_['map'](_0x1f643d,_0x0fff('0x2b'));_0x17ab6f[_0x0fff('0x33')]=_[_0x0fff('0x34')](_0x495734[_0x0fff('0x33')]);_0x17ab6f[_0x0fff('0x35')]=_[_0x0fff('0x36')](_0x17ab6f[_0x0fff('0x32')],_0x17ab6f[_0x0fff('0x33')]);_0x2d1800[_0x0fff('0x37')]=_[_0x0fff('0x36')](_0x17ab6f['model'],qs[_0x0fff('0x38')](_0x495734[_0x0fff('0x33')][_0x0fff('0x38')]));_0x2d1800[_0x0fff('0x37')]=_0x2d1800[_0x0fff('0x37')]['length']?_0x2d1800['attributes']:_0x17ab6f[_0x0fff('0x32')];if(!_0x495734[_0x0fff('0x33')][_0x0fff('0x39')](_0x0fff('0x3a'))){_0x2d1800['limit']=qs[_0x0fff('0x1d')](_0x495734[_0x0fff('0x33')][_0x0fff('0x1d')]);_0x2d1800[_0x0fff('0x1c')]=qs['offset'](_0x495734[_0x0fff('0x33')][_0x0fff('0x1c')]);}_0x2d1800[_0x0fff('0x3b')]=qs[_0x0fff('0x3c')](_0x495734[_0x0fff('0x33')][_0x0fff('0x3c')]);_0x2d1800[_0x0fff('0x3d')]=qs[_0x0fff('0x35')](_[_0x0fff('0x3e')](_0x495734[_0x0fff('0x33')],_0x17ab6f[_0x0fff('0x35')]),_0x1f643d);if(_0x495734[_0x0fff('0x33')]['filter']){_0x2d1800[_0x0fff('0x3d')]=_[_0x0fff('0x3f')](_0x2d1800[_0x0fff('0x3d')],{'$or':_[_0x0fff('0x2e')](_0x1f643d,function(_0xd65638){if(_0xd65638[_0x0fff('0x40')]!=='VIRTUAL'){var _0x10ff9d={};_0x10ff9d[_0xd65638[_0x0fff('0x2b')]]={'$like':'%'+_0x495734[_0x0fff('0x33')][_0x0fff('0x41')]+'%'};return _0x10ff9d;}})});}_0x2d1800=_[_0x0fff('0x3f')]({},_0x2d1800,_0x495734[_0x0fff('0x42')]);var _0x3dc0b8={'where':_0x2d1800[_0x0fff('0x3d')]};return db[_0x0fff('0x43')]['count'](_0x3dc0b8)[_0x0fff('0x26')](function(_0x4d89c0){_0x42441e[_0x0fff('0x1f')]=_0x4d89c0;if(_0x495734[_0x0fff('0x33')][_0x0fff('0x44')]){_0x2d1800['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x0fff('0x45')](_0x2d1800);})[_0x0fff('0x26')](function(_0x311348){_0x42441e['rows']=_0x311348;return _0x42441e;})['then'](respondWithFilteredResult(_0x7046a3,_0x2d1800))[_0x0fff('0x46')](handleError(_0x7046a3,null));};exports['show']=function(_0xd6ebeb,_0x957265){var _0x8352c1={'raw':!![],'where':{'id':_0xd6ebeb[_0x0fff('0x47')]['id']}},_0x309d75={};_0x309d75[_0x0fff('0x32')]=_['keys'](db[_0x0fff('0x43')][_0x0fff('0x2f')]);_0x309d75[_0x0fff('0x33')]=_[_0x0fff('0x34')](_0xd6ebeb[_0x0fff('0x33')]);_0x309d75[_0x0fff('0x35')]=_[_0x0fff('0x36')](_0x309d75['model'],_0x309d75[_0x0fff('0x33')]);_0x8352c1[_0x0fff('0x37')]=_[_0x0fff('0x36')](_0x309d75['model'],qs[_0x0fff('0x38')](_0xd6ebeb[_0x0fff('0x33')][_0x0fff('0x38')]));_0x8352c1[_0x0fff('0x37')]=_0x8352c1[_0x0fff('0x37')][_0x0fff('0x48')]?_0x8352c1[_0x0fff('0x37')]:_0x309d75[_0x0fff('0x32')];if(_0xd6ebeb[_0x0fff('0x33')][_0x0fff('0x44')]){_0x8352c1[_0x0fff('0x49')]=[{'all':!![]}];}_0x8352c1=_['merge']({},_0x8352c1,_0xd6ebeb[_0x0fff('0x42')]);return db[_0x0fff('0x43')]['find'](_0x8352c1)[_0x0fff('0x26')](handleEntityNotFound(_0x957265,null))[_0x0fff('0x26')](respondWithResult(_0x957265,null))[_0x0fff('0x46')](handleError(_0x957265,null));};exports['create']=function(_0x502037,_0x2a0b10){return db['WhatsappQueueReport']['create'](_0x502037[_0x0fff('0x4a')],{})[_0x0fff('0x26')](respondWithResult(_0x2a0b10,0xc9))[_0x0fff('0x46')](handleError(_0x2a0b10,null));};exports[_0x0fff('0x25')]=function(_0x3b4b8e,_0x1a7677){if(_0x3b4b8e['body']['id']){delete _0x3b4b8e[_0x0fff('0x4a')]['id'];}return db[_0x0fff('0x43')][_0x0fff('0x4b')]({'where':{'id':_0x3b4b8e[_0x0fff('0x47')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x1a7677,null))[_0x0fff('0x26')](saveUpdates(_0x3b4b8e['body'],null))[_0x0fff('0x26')](respondWithResult(_0x1a7677,null))[_0x0fff('0x46')](handleError(_0x1a7677,null));};exports['destroy']=function(_0x1fc872,_0x4bae35){return db['WhatsappQueueReport']['find']({'where':{'id':_0x1fc872[_0x0fff('0x47')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x4bae35,null))[_0x0fff('0x26')](removeEntity(_0x4bae35,null))[_0x0fff('0x46')](handleError(_0x4bae35,null));};exports[_0x0fff('0x4c')]=function(_0x4bf98d,_0x2524ad){return db[_0x0fff('0x43')][_0x0fff('0x4c')]()[_0x0fff('0x26')](respondWithResult(_0x2524ad,null))[_0x0fff('0x46')](handleError(_0x2524ad,null));}; \ No newline at end of file +var _0xd87e=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','WhatsappQueueReport','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs'];(function(_0x5a7bcb,_0x5679f7){var _0x3a2381=function(_0x17d4f3){while(--_0x17d4f3){_0x5a7bcb['push'](_0x5a7bcb['shift']());}};_0x3a2381(++_0x5679f7);}(_0xd87e,0x1bf));var _0xed87=function(_0x1a0dcb,_0x36a473){_0x1a0dcb=_0x1a0dcb-0x0;var _0x1f8cec=_0xd87e[_0x1a0dcb];return _0x1f8cec;};'use strict';var emlformat=require(_0xed87('0x0'));var rimraf=require(_0xed87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed87('0x2'));var rp=require(_0xed87('0x3'));var moment=require(_0xed87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed87('0x5'));var util=require('util');var path=require(_0xed87('0x6'));var sox=require(_0xed87('0x7'));var csv=require('to-csv');var ejs=require(_0xed87('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xed87('0x9'));var crypto=require(_0xed87('0xa'));var jsforce=require(_0xed87('0xb'));var deskjs=require(_0xed87('0xc'));var toCsv=require('to-csv');var querystring=require(_0xed87('0xd'));var Papa=require(_0xed87('0xe'));var Redis=require(_0xed87('0xf'));var authService=require(_0xed87('0x10'));var qs=require(_0xed87('0x11'));var as=require(_0xed87('0x12'));var hardwareService=require(_0xed87('0x13'));var logger=require('../../config/logger')(_0xed87('0x14'));var utils=require(_0xed87('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xed87('0x16'));var db=require(_0xed87('0x17'))['db'];function respondWithStatusCode(_0x5e912e,_0x4ffc2d){_0x4ffc2d=_0x4ffc2d||0xcc;return function(_0x466f35){if(_0x466f35){return _0x5e912e[_0xed87('0x18')](_0x4ffc2d);}return _0x5e912e[_0xed87('0x19')](_0x4ffc2d)[_0xed87('0x1a')]();};}function respondWithResult(_0x16bfd6,_0x3865c5){_0x3865c5=_0x3865c5||0xc8;return function(_0x52dfe8){if(_0x52dfe8){return _0x16bfd6[_0xed87('0x19')](_0x3865c5)[_0xed87('0x1b')](_0x52dfe8);}};}function respondWithFilteredResult(_0x1722a6,_0x1e9a3d){return function(_0x2f2fd3){if(_0x2f2fd3){var _0xd34e0e=typeof _0x1e9a3d[_0xed87('0x1c')]===_0xed87('0x1d')&&typeof _0x1e9a3d[_0xed87('0x1e')]==='undefined';var _0x3db5ea=_0x2f2fd3[_0xed87('0x1f')];var _0x2c386a=_0xd34e0e?0x0:_0x1e9a3d[_0xed87('0x1c')];var _0x5f4076=_0xd34e0e?_0x2f2fd3[_0xed87('0x1f')]:_0x1e9a3d[_0xed87('0x1c')]+_0x1e9a3d[_0xed87('0x1e')];var _0x3f9e08;if(_0x5f4076>=_0x3db5ea){_0x5f4076=_0x3db5ea;_0x3f9e08=0xc8;}else{_0x3f9e08=0xce;}_0x1722a6[_0xed87('0x19')](_0x3f9e08);return _0x1722a6[_0xed87('0x20')](_0xed87('0x21'),_0x2c386a+'-'+_0x5f4076+'/'+_0x3db5ea)[_0xed87('0x1b')](_0x2f2fd3);}return null;};}function patchUpdates(_0x3b7981){return function(_0x52e81c){try{jsonpatch['apply'](_0x52e81c,_0x3b7981,!![]);}catch(_0x5db546){return BPromise['reject'](_0x5db546);}return _0x52e81c[_0xed87('0x22')]();};}function saveUpdates(_0x5d3ec8,_0x4191a7){return function(_0x2b0b98){if(_0x2b0b98){return _0x2b0b98['update'](_0x5d3ec8)[_0xed87('0x23')](function(_0x505733){return _0x505733;});}return null;};}function removeEntity(_0x3d1641,_0x24962e){return function(_0x27799a){if(_0x27799a){return _0x27799a[_0xed87('0x24')]()[_0xed87('0x23')](function(){_0x3d1641['status'](0xcc)[_0xed87('0x1a')]();});}};}function handleEntityNotFound(_0x3c22b7,_0x41e0d4){return function(_0x320bcc){if(!_0x320bcc){_0x3c22b7[_0xed87('0x18')](0x194);}return _0x320bcc;};}function handleError(_0x289e38,_0x25a6f7){_0x25a6f7=_0x25a6f7||0x1f4;return function(_0x4735b3){logger[_0xed87('0x25')](_0x4735b3[_0xed87('0x26')]);if(_0x4735b3[_0xed87('0x27')]){delete _0x4735b3[_0xed87('0x27')];}_0x289e38[_0xed87('0x19')](_0x25a6f7)[_0xed87('0x28')](_0x4735b3);};}exports['index']=function(_0xb32b1c,_0x1c4a65){var _0x4eaa44={},_0x3dff74={},_0x33c367={'count':0x0,'rows':[]};var _0x21c93b=_['map'](db['WhatsappQueueReport'][_0xed87('0x29')],function(_0x428b75){return{'name':_0x428b75[_0xed87('0x2a')],'type':_0x428b75['type'][_0xed87('0x2b')]};});_0x3dff74[_0xed87('0x2c')]=_[_0xed87('0x2d')](_0x21c93b,_0xed87('0x27'));_0x3dff74[_0xed87('0x2e')]=_[_0xed87('0x2f')](_0xb32b1c[_0xed87('0x2e')]);_0x3dff74[_0xed87('0x30')]=_[_0xed87('0x31')](_0x3dff74['model'],_0x3dff74[_0xed87('0x2e')]);_0x4eaa44[_0xed87('0x32')]=_['intersection'](_0x3dff74[_0xed87('0x2c')],qs['fields'](_0xb32b1c[_0xed87('0x2e')][_0xed87('0x33')]));_0x4eaa44[_0xed87('0x32')]=_0x4eaa44[_0xed87('0x32')][_0xed87('0x34')]?_0x4eaa44[_0xed87('0x32')]:_0x3dff74[_0xed87('0x2c')];if(!_0xb32b1c[_0xed87('0x2e')][_0xed87('0x35')](_0xed87('0x36'))){_0x4eaa44[_0xed87('0x1e')]=qs['limit'](_0xb32b1c[_0xed87('0x2e')][_0xed87('0x1e')]);_0x4eaa44['offset']=qs[_0xed87('0x1c')](_0xb32b1c['query'][_0xed87('0x1c')]);}_0x4eaa44[_0xed87('0x37')]=qs['sort'](_0xb32b1c[_0xed87('0x2e')][_0xed87('0x38')]);_0x4eaa44[_0xed87('0x39')]=qs[_0xed87('0x30')](_[_0xed87('0x3a')](_0xb32b1c['query'],_0x3dff74[_0xed87('0x30')]),_0x21c93b);if(_0xb32b1c['query'][_0xed87('0x3b')]){_0x4eaa44['where']=_[_0xed87('0x3c')](_0x4eaa44[_0xed87('0x39')],{'$or':_[_0xed87('0x2d')](_0x21c93b,function(_0x217435){if(_0x217435[_0xed87('0x3d')]!==_0xed87('0x3e')){var _0x9e3356={};_0x9e3356[_0x217435[_0xed87('0x27')]]={'$like':'%'+_0xb32b1c[_0xed87('0x2e')]['filter']+'%'};return _0x9e3356;}})});}_0x4eaa44=_['merge']({},_0x4eaa44,_0xb32b1c[_0xed87('0x3f')]);var _0x206544={'where':_0x4eaa44[_0xed87('0x39')]};return db[_0xed87('0x40')][_0xed87('0x1f')](_0x206544)[_0xed87('0x23')](function(_0x5d1bd0){_0x33c367[_0xed87('0x1f')]=_0x5d1bd0;if(_0xb32b1c[_0xed87('0x2e')][_0xed87('0x41')]){_0x4eaa44['include']=[{'all':!![]}];}return db[_0xed87('0x40')][_0xed87('0x42')](_0x4eaa44);})[_0xed87('0x23')](function(_0x1b0092){_0x33c367[_0xed87('0x43')]=_0x1b0092;return _0x33c367;})[_0xed87('0x23')](respondWithFilteredResult(_0x1c4a65,_0x4eaa44))[_0xed87('0x44')](handleError(_0x1c4a65,null));};exports[_0xed87('0x45')]=function(_0x35bd1c,_0x406b73){var _0x5c6925={'raw':!![],'where':{'id':_0x35bd1c[_0xed87('0x46')]['id']}},_0x7e6cbb={};_0x7e6cbb[_0xed87('0x2c')]=_['keys'](db['WhatsappQueueReport'][_0xed87('0x29')]);_0x7e6cbb[_0xed87('0x2e')]=_[_0xed87('0x2f')](_0x35bd1c[_0xed87('0x2e')]);_0x7e6cbb['filters']=_[_0xed87('0x31')](_0x7e6cbb[_0xed87('0x2c')],_0x7e6cbb['query']);_0x5c6925[_0xed87('0x32')]=_[_0xed87('0x31')](_0x7e6cbb[_0xed87('0x2c')],qs[_0xed87('0x33')](_0x35bd1c[_0xed87('0x2e')][_0xed87('0x33')]));_0x5c6925[_0xed87('0x32')]=_0x5c6925[_0xed87('0x32')][_0xed87('0x34')]?_0x5c6925[_0xed87('0x32')]:_0x7e6cbb[_0xed87('0x2c')];if(_0x35bd1c['query'][_0xed87('0x41')]){_0x5c6925[_0xed87('0x47')]=[{'all':!![]}];}_0x5c6925=_[_0xed87('0x3c')]({},_0x5c6925,_0x35bd1c[_0xed87('0x3f')]);return db[_0xed87('0x40')][_0xed87('0x48')](_0x5c6925)[_0xed87('0x23')](handleEntityNotFound(_0x406b73,null))[_0xed87('0x23')](respondWithResult(_0x406b73,null))[_0xed87('0x44')](handleError(_0x406b73,null));};exports[_0xed87('0x49')]=function(_0x8aa499,_0x26c8f4){return db[_0xed87('0x40')][_0xed87('0x49')](_0x8aa499[_0xed87('0x4a')],{})[_0xed87('0x23')](respondWithResult(_0x26c8f4,0xc9))[_0xed87('0x44')](handleError(_0x26c8f4,null));};exports['update']=function(_0x2c7bef,_0x1a68a7){if(_0x2c7bef[_0xed87('0x4a')]['id']){delete _0x2c7bef['body']['id'];}return db[_0xed87('0x40')][_0xed87('0x48')]({'where':{'id':_0x2c7bef['params']['id']}})[_0xed87('0x23')](handleEntityNotFound(_0x1a68a7,null))[_0xed87('0x23')](saveUpdates(_0x2c7bef[_0xed87('0x4a')],null))[_0xed87('0x23')](respondWithResult(_0x1a68a7,null))['catch'](handleError(_0x1a68a7,null));};exports[_0xed87('0x24')]=function(_0x436e15,_0x3ca34c){return db[_0xed87('0x40')][_0xed87('0x48')]({'where':{'id':_0x436e15[_0xed87('0x46')]['id']}})[_0xed87('0x23')](handleEntityNotFound(_0x3ca34c,null))[_0xed87('0x23')](removeEntity(_0x3ca34c,null))[_0xed87('0x44')](handleError(_0x3ca34c,null));};exports[_0xed87('0x4b')]=function(_0x25a514,_0x18846f){return db[_0xed87('0x40')]['describe']()[_0xed87('0x23')](respondWithResult(_0x18846f,null))['catch'](handleError(_0x18846f,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index c43e0b0..3b12d94 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 _0x2e68=['bluebird','../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x322179,_0x50440d){var _0x6e8514=function(_0x33c49d){while(--_0x33c49d){_0x322179['push'](_0x322179['shift']());}};_0x6e8514(++_0x50440d);}(_0x2e68,0x13f));var _0x82e6=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x2e68[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0x82e6('0x0'));var util=require(_0x82e6('0x1'));var logger=require(_0x82e6('0x2'))(_0x82e6('0x3'));var moment=require(_0x82e6('0x4'));var BPromise=require(_0x82e6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x82e6('0x6'));var attributes=require(_0x82e6('0x7'));module[_0x82e6('0x8')]=function(_0x375b63,_0x4f5f07){return _0x375b63['define'](_0x82e6('0x9'),attributes,{'tableName':_0x82e6('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x82e6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf403=['request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1b7d9c,_0x2a534e){var _0x2ccc1a=function(_0x2e34b6){while(--_0x2e34b6){_0x1b7d9c['push'](_0x1b7d9c['shift']());}};_0x2ccc1a(++_0x2a534e);}(_0xf403,0xae));var _0x3f40=function(_0x5e76bf,_0x4f0dbf){_0x5e76bf=_0x5e76bf-0x0;var _0x783ad5=_0xf403[_0x5e76bf];return _0x783ad5;};'use strict';var _=require(_0x3f40('0x0'));var util=require(_0x3f40('0x1'));var logger=require(_0x3f40('0x2'))(_0x3f40('0x3'));var moment=require(_0x3f40('0x4'));var BPromise=require(_0x3f40('0x5'));var rp=require(_0x3f40('0x6'));var fs=require('fs');var path=require(_0x3f40('0x7'));var rimraf=require(_0x3f40('0x8'));var config=require(_0x3f40('0x9'));var attributes=require(_0x3f40('0xa'));module[_0x3f40('0xb')]=function(_0x1692de,_0x20d5ed){return _0x1692de['define'](_0x3f40('0xc'),attributes,{'tableName':_0x3f40('0xd'),'paranoid':![],'indexes':[{'name':_0x3f40('0xe'),'fields':[_0x3f40('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 3e7c45d..e0a6b7a 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 _0xd40e=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','limit','util','moment','randomstring','ioredis'];(function(_0x3a964d,_0x305ccf){var _0x536907=function(_0x493e27){while(--_0x493e27){_0x3a964d['push'](_0x3a964d['shift']());}};_0x536907(++_0x305ccf);}(_0xd40e,0x150));var _0xed40=function(_0x1df41a,_0x5729e6){_0x1df41a=_0x1df41a-0x0;var _0xe21af5=_0xd40e[_0x1df41a];return _0xe21af5;};'use strict';var _=require('lodash');var util=require(_0xed40('0x0'));var moment=require(_0xed40('0x1'));var BPromise=require('bluebird');var rs=require(_0xed40('0x2'));var fs=require('fs');var Redis=require(_0xed40('0x3'));var db=require(_0xed40('0x4'))['db'];var utils=require(_0xed40('0x5'));var logger=require('../../config/logger')(_0xed40('0x6'));var config=require(_0xed40('0x7'));var jayson=require(_0xed40('0x8'));var client=jayson[_0xed40('0x9')][_0xed40('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a89af,_0x493747,_0x4bceb1){return new BPromise(function(_0x3cb3f3,_0x1db7c9){return client['request'](_0x1a89af,_0x4bceb1)[_0xed40('0xb')](function(_0x1b4473){logger[_0xed40('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x493747,_0xed40('0xd'));logger[_0xed40('0xe')](_0xed40('0xf'),_0x493747,'request\x20sent',JSON[_0xed40('0x10')](_0x1b4473));if(_0x1b4473[_0xed40('0x11')]){if(_0x1b4473['error'][_0xed40('0x12')]===0x1f4){logger[_0xed40('0x11')](_0xed40('0x13'),_0x493747,_0x1b4473[_0xed40('0x11')][_0xed40('0x14')]);return _0x1db7c9(_0x1b4473['error'][_0xed40('0x14')]);}logger['error'](_0xed40('0x13'),_0x493747,_0x1b4473[_0xed40('0x11')][_0xed40('0x14')]);return _0x3cb3f3(_0x1b4473[_0xed40('0x11')][_0xed40('0x14')]);}else{logger[_0xed40('0xc')](_0xed40('0x13'),_0x493747,'request\x20sent');_0x3cb3f3(_0x1b4473[_0xed40('0x15')][_0xed40('0x14')]);}})[_0xed40('0x16')](function(_0x37646b){logger[_0xed40('0x11')](_0xed40('0x13'),_0x493747,_0x37646b);_0x1db7c9(_0x37646b);});});}exports[_0xed40('0x17')]=function(_0x55d1f6){var _0x3c6113=this;return new Promise(function(_0x1cee70,_0x236649){return db[_0xed40('0x18')][_0xed40('0x19')](_0x55d1f6[_0xed40('0x1a')],{'raw':_0x55d1f6[_0xed40('0x1b')]?_0x55d1f6[_0xed40('0x1b')][_0xed40('0x1c')]===undefined?!![]:![]:!![]})[_0xed40('0xb')](function(_0x22fd57){logger[_0xed40('0xc')](_0xed40('0x17'),_0x55d1f6);logger[_0xed40('0xe')](_0xed40('0x17'),_0x55d1f6,JSON[_0xed40('0x10')](_0x22fd57));_0x1cee70(_0x22fd57);})[_0xed40('0x16')](function(_0x23e87a){logger[_0xed40('0x11')](_0xed40('0x17'),_0x23e87a[_0xed40('0x14')],_0x55d1f6);_0x236649(_0x3c6113[_0xed40('0x11')](0x1f4,_0x23e87a['message']));});});};exports[_0xed40('0x1d')]=function(_0x3a9ca1){var _0x41d180=this;return new Promise(function(_0x45143b,_0x150a7e){return db[_0xed40('0x18')][_0xed40('0x1e')](_0x3a9ca1[_0xed40('0x1a')],{'raw':_0x3a9ca1['options']?_0x3a9ca1[_0xed40('0x1b')][_0xed40('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a9ca1[_0xed40('0x1b')]?_0x3a9ca1[_0xed40('0x1b')][_0xed40('0x1f')]||null:null,'attributes':_0x3a9ca1[_0xed40('0x1b')]?_0x3a9ca1[_0xed40('0x1b')][_0xed40('0x20')]||null:null,'limit':_0x3a9ca1[_0xed40('0x1b')]?_0x3a9ca1[_0xed40('0x1b')][_0xed40('0x21')]||null:null})[_0xed40('0xb')](function(_0x367ab){logger['info'](_0xed40('0x1d'),_0x3a9ca1);logger[_0xed40('0xe')](_0xed40('0x1d'),_0x3a9ca1,JSON[_0xed40('0x10')](_0x367ab));_0x45143b(_0x367ab);})[_0xed40('0x16')](function(_0x366be7){logger[_0xed40('0x11')](_0xed40('0x1d'),_0x366be7[_0xed40('0x14')],_0x3a9ca1);_0x150a7e(_0x41d180[_0xed40('0x11')](0x1f4,_0x366be7['message']));});});}; \ No newline at end of file +var _0x8ca9=['limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','stringify','UpdateWhatsappQueueReport','update','where'];(function(_0x37a1a5,_0x1a8785){var _0x519fb8=function(_0x221482){while(--_0x221482){_0x37a1a5['push'](_0x37a1a5['shift']());}};_0x519fb8(++_0x1a8785);}(_0x8ca9,0x1a1));var _0x98ca=function(_0x3ded30,_0x2e7228){_0x3ded30=_0x3ded30-0x0;var _0x11f797=_0x8ca9[_0x3ded30];return _0x11f797;};'use strict';var _=require('lodash');var util=require(_0x98ca('0x0'));var moment=require(_0x98ca('0x1'));var BPromise=require(_0x98ca('0x2'));var rs=require(_0x98ca('0x3'));var fs=require('fs');var Redis=require(_0x98ca('0x4'));var db=require(_0x98ca('0x5'))['db'];var utils=require(_0x98ca('0x6'));var logger=require('../../config/logger')(_0x98ca('0x7'));var config=require('../../config/environment');var jayson=require(_0x98ca('0x8'));var client=jayson[_0x98ca('0x9')][_0x98ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55aa2e,_0x5f57b3,_0x58aa49){return new BPromise(function(_0x29f20d,_0x7166c6){return client['request'](_0x55aa2e,_0x58aa49)[_0x98ca('0xb')](function(_0xfd452b){logger[_0x98ca('0xc')](_0x98ca('0xd'),_0x5f57b3,_0x98ca('0xe'));logger[_0x98ca('0xf')](_0x98ca('0x10'),_0x5f57b3,_0x98ca('0xe'),JSON['stringify'](_0xfd452b));if(_0xfd452b[_0x98ca('0x11')]){if(_0xfd452b[_0x98ca('0x11')][_0x98ca('0x12')]===0x1f4){logger[_0x98ca('0x11')](_0x98ca('0xd'),_0x5f57b3,_0xfd452b[_0x98ca('0x11')][_0x98ca('0x13')]);return _0x7166c6(_0xfd452b[_0x98ca('0x11')][_0x98ca('0x13')]);}logger[_0x98ca('0x11')](_0x98ca('0xd'),_0x5f57b3,_0xfd452b[_0x98ca('0x11')][_0x98ca('0x13')]);return _0x29f20d(_0xfd452b['error'][_0x98ca('0x13')]);}else{logger[_0x98ca('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5f57b3,'request\x20sent');_0x29f20d(_0xfd452b['result']['message']);}})[_0x98ca('0x14')](function(_0x4f176b){logger['error'](_0x98ca('0xd'),_0x5f57b3,_0x4f176b);_0x7166c6(_0x4f176b);});});}exports[_0x98ca('0x15')]=function(_0x4f9e01){var _0x41e703=this;return new Promise(function(_0x487e57,_0x58c941){return db[_0x98ca('0x16')][_0x98ca('0x17')](_0x4f9e01[_0x98ca('0x18')],{'raw':_0x4f9e01[_0x98ca('0x19')]?_0x4f9e01[_0x98ca('0x19')][_0x98ca('0x1a')]===undefined?!![]:![]:!![]})[_0x98ca('0xb')](function(_0x23f918){logger['info'](_0x98ca('0x15'),_0x4f9e01);logger['debug']('CreateWhatsappQueueReport',_0x4f9e01,JSON[_0x98ca('0x1b')](_0x23f918));_0x487e57(_0x23f918);})[_0x98ca('0x14')](function(_0x3deb9e){logger['error']('CreateWhatsappQueueReport',_0x3deb9e[_0x98ca('0x13')],_0x4f9e01);_0x58c941(_0x41e703[_0x98ca('0x11')](0x1f4,_0x3deb9e['message']));});});};exports[_0x98ca('0x1c')]=function(_0x2feb12){var _0x5e917a=this;return new Promise(function(_0x1d4ea8,_0x2a3d6f){return db[_0x98ca('0x16')][_0x98ca('0x1d')](_0x2feb12[_0x98ca('0x18')],{'raw':_0x2feb12['options']?_0x2feb12[_0x98ca('0x19')][_0x98ca('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2feb12[_0x98ca('0x19')]?_0x2feb12[_0x98ca('0x19')][_0x98ca('0x1e')]||null:null,'attributes':_0x2feb12[_0x98ca('0x19')]?_0x2feb12[_0x98ca('0x19')]['attributes']||null:null,'limit':_0x2feb12[_0x98ca('0x19')]?_0x2feb12['options'][_0x98ca('0x1f')]||null:null})[_0x98ca('0xb')](function(_0x37d452){logger[_0x98ca('0xc')]('UpdateWhatsappQueueReport',_0x2feb12);logger[_0x98ca('0xf')]('UpdateWhatsappQueueReport',_0x2feb12,JSON['stringify'](_0x37d452));_0x1d4ea8(_0x37d452);})[_0x98ca('0x14')](function(_0x442ec3){logger['error']('UpdateWhatsappQueueReport',_0x442ec3[_0x98ca('0x13')],_0x2feb12);_0x2a3d6f(_0x5e917a[_0x98ca('0x11')](0x1f4,_0x442ec3[_0x98ca('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index bc6c6f3..5d331ef 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 _0x3363=['../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x3363,0xf5));var _0x3336=function(_0x2e2fe6,_0x3cca01){_0x2e2fe6=_0x2e2fe6-0x0;var _0x3eb2c5=_0x3363[_0x2e2fe6];return _0x3eb2c5;};'use strict';var multer=require(_0x3336('0x0'));var util=require(_0x3336('0x1'));var path=require(_0x3336('0x2'));var timeout=require(_0x3336('0x3'));var express=require(_0x3336('0x4'));var router=express[_0x3336('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3336('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3336('0x7'));var controller=require(_0x3336('0x8'));router[_0x3336('0x9')]('/',auth[_0x3336('0xa')](),controller[_0x3336('0xb')]);router[_0x3336('0x9')]('/describe',auth[_0x3336('0xa')](),controller[_0x3336('0xc')]);router[_0x3336('0x9')](_0x3336('0xd'),auth['isAuthenticated'](),controller[_0x3336('0xe')]);router[_0x3336('0xf')]('/',auth['isAuthenticated'](),controller[_0x3336('0x10')]);router['put'](_0x3336('0xd'),auth[_0x3336('0xa')](),controller[_0x3336('0x11')]);router[_0x3336('0x12')](_0x3336('0xd'),auth['isAuthenticated'](),controller[_0x3336('0x13')]);module[_0x3336('0x14')]=router; \ No newline at end of file +var _0x6217=['multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x20151b,_0x553d0d){var _0xb85a78=function(_0x3a2fcc){while(--_0x3a2fcc){_0x20151b['push'](_0x20151b['shift']());}};_0xb85a78(++_0x553d0d);}(_0x6217,0x150));var _0x7621=function(_0x151381,_0x97b314){_0x151381=_0x151381-0x0;var _0x2afab6=_0x6217[_0x151381];return _0x2afab6;};'use strict';var multer=require(_0x7621('0x0'));var util=require(_0x7621('0x1'));var path=require(_0x7621('0x2'));var timeout=require('connect-timeout');var express=require(_0x7621('0x3'));var router=express[_0x7621('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7621('0x5'));var config=require(_0x7621('0x6'));var controller=require(_0x7621('0x7'));router[_0x7621('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7621('0x8')](_0x7621('0x9'),auth[_0x7621('0xa')](),controller[_0x7621('0xb')]);router[_0x7621('0x8')](_0x7621('0xc'),auth[_0x7621('0xa')](),controller[_0x7621('0xd')]);router[_0x7621('0xe')]('/',auth[_0x7621('0xa')](),controller[_0x7621('0xf')]);router[_0x7621('0x10')](_0x7621('0xc'),auth[_0x7621('0xa')](),controller[_0x7621('0x11')]);router[_0x7621('0x12')](_0x7621('0xc'),auth[_0x7621('0xa')](),controller[_0x7621('0x13')]);module[_0x7621('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 aa90898..805058b 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 _0xbd9f=['agent','DATE','ENUM'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xbd9f,0x98));var _0xfbd9=function(_0x2aaed8,_0x4c313d){_0x2aaed8=_0x2aaed8-0x0;var _0x512398=_0xbd9f[_0x2aaed8];return _0x512398;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xfbd9('0x0')]('account',_0xfbd9('0x1'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xfbd9('0x2')]}}; \ No newline at end of file +var _0xffc0=['queue','DATE','exports','ENUM','account','agent'];(function(_0x2bcd9e,_0x1bef3a){var _0xc3ccf4=function(_0x3d6eb7){while(--_0x3d6eb7){_0x2bcd9e['push'](_0x2bcd9e['shift']());}};_0xc3ccf4(++_0x1bef3a);}(_0xffc0,0x1a0));var _0x0ffc=function(_0x4998ea,_0x46163e){_0x4998ea=_0x4998ea-0x0;var _0xca3f78=_0xffc0[_0x4998ea];return _0xca3f78;};'use strict';var Sequelize=require('sequelize');module[_0x0ffc('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0ffc('0x1')](_0x0ffc('0x2'),_0x0ffc('0x3'),_0x0ffc('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x0ffc('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index b2c02c4..b24cd3a 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 _0x6888=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','rawAttributes','find','create','catch','update','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x6888,0xd2));var _0x8688=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x6888[_0x255d5b];return _0x3e141a;};'use strict';var emlformat=require(_0x8688('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8688('0x1'));var jsonpatch=require(_0x8688('0x2'));var rp=require(_0x8688('0x3'));var moment=require(_0x8688('0x4'));var BPromise=require(_0x8688('0x5'));var Mustache=require(_0x8688('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8688('0x7'));var csv=require(_0x8688('0x8'));var ejs=require(_0x8688('0x9'));var fs=require('fs');var fs_extra=require(_0x8688('0xa'));var _=require(_0x8688('0xb'));var squel=require(_0x8688('0xc'));var crypto=require('crypto');var jsforce=require(_0x8688('0xd'));var deskjs=require(_0x8688('0xe'));var toCsv=require(_0x8688('0x8'));var querystring=require(_0x8688('0xf'));var Papa=require(_0x8688('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8688('0x11'));var as=require(_0x8688('0x12'));var hardwareService=require(_0x8688('0x13'));var logger=require(_0x8688('0x14'))(_0x8688('0x15'));var utils=require(_0x8688('0x16'));var config=require(_0x8688('0x17'));var licenseUtil=require(_0x8688('0x18'));var db=require(_0x8688('0x19'))['db'];function respondWithStatusCode(_0x560dae,_0x961f9){_0x961f9=_0x961f9||0xcc;return function(_0x1e10e3){if(_0x1e10e3){return _0x560dae[_0x8688('0x1a')](_0x961f9);}return _0x560dae[_0x8688('0x1b')](_0x961f9)[_0x8688('0x1c')]();};}function respondWithResult(_0x4628fa,_0x1ec45a){_0x1ec45a=_0x1ec45a||0xc8;return function(_0x1c4e32){if(_0x1c4e32){return _0x4628fa[_0x8688('0x1b')](_0x1ec45a)[_0x8688('0x1d')](_0x1c4e32);}};}function respondWithFilteredResult(_0x1fb7df,_0x798984){return function(_0x5790cc){if(_0x5790cc){var _0x3a1c41=typeof _0x798984[_0x8688('0x1e')]===_0x8688('0x1f')&&typeof _0x798984[_0x8688('0x20')]===_0x8688('0x1f');var _0x13ee31=_0x5790cc[_0x8688('0x21')];var _0x48eab9=_0x3a1c41?0x0:_0x798984['offset'];var _0x3c3021=_0x3a1c41?_0x5790cc[_0x8688('0x21')]:_0x798984['offset']+_0x798984['limit'];var _0x1951ec;if(_0x3c3021>=_0x13ee31){_0x3c3021=_0x13ee31;_0x1951ec=0xc8;}else{_0x1951ec=0xce;}_0x1fb7df[_0x8688('0x1b')](_0x1951ec);return _0x1fb7df[_0x8688('0x22')](_0x8688('0x23'),_0x48eab9+'-'+_0x3c3021+'/'+_0x13ee31)[_0x8688('0x1d')](_0x5790cc);}return null;};}function patchUpdates(_0x135727){return function(_0x32073e){try{jsonpatch[_0x8688('0x24')](_0x32073e,_0x135727,!![]);}catch(_0x1555ce){return BPromise['reject'](_0x1555ce);}return _0x32073e[_0x8688('0x25')]();};}function saveUpdates(_0x5b57a6,_0x32d195){return function(_0x409cc7){if(_0x409cc7){return _0x409cc7['update'](_0x5b57a6)[_0x8688('0x26')](function(_0x4d80ca){return _0x4d80ca;});}return null;};}function removeEntity(_0x3ca828,_0x3e92cd){return function(_0x44ca43){if(_0x44ca43){return _0x44ca43[_0x8688('0x27')]()[_0x8688('0x26')](function(){_0x3ca828[_0x8688('0x1b')](0xcc)[_0x8688('0x1c')]();});}};}function handleEntityNotFound(_0x1e6aca,_0x4f5bfe){return function(_0x2a8d9e){if(!_0x2a8d9e){_0x1e6aca[_0x8688('0x1a')](0x194);}return _0x2a8d9e;};}function handleError(_0x196d50,_0x2f2707){_0x2f2707=_0x2f2707||0x1f4;return function(_0x4d4b9c){logger[_0x8688('0x28')](_0x4d4b9c[_0x8688('0x29')]);if(_0x4d4b9c[_0x8688('0x2a')]){delete _0x4d4b9c['name'];}_0x196d50[_0x8688('0x1b')](_0x2f2707)[_0x8688('0x2b')](_0x4d4b9c);};}exports[_0x8688('0x2c')]=function(_0x5f4f7b,_0xed6020){var _0x5d249b={},_0x4ab1fb={},_0x47b088={'count':0x0,'rows':[]};var _0x21ee40=_[_0x8688('0x2d')](db[_0x8688('0x2e')]['rawAttributes'],function(_0x203814){return{'name':_0x203814[_0x8688('0x2f')],'type':_0x203814[_0x8688('0x30')][_0x8688('0x31')]};});_0x4ab1fb[_0x8688('0x32')]=_[_0x8688('0x2d')](_0x21ee40,_0x8688('0x2a'));_0x4ab1fb[_0x8688('0x33')]=_[_0x8688('0x34')](_0x5f4f7b[_0x8688('0x33')]);_0x4ab1fb[_0x8688('0x35')]=_['intersection'](_0x4ab1fb[_0x8688('0x32')],_0x4ab1fb['query']);_0x5d249b[_0x8688('0x36')]=_[_0x8688('0x37')](_0x4ab1fb['model'],qs[_0x8688('0x38')](_0x5f4f7b[_0x8688('0x33')]['fields']));_0x5d249b['attributes']=_0x5d249b[_0x8688('0x36')][_0x8688('0x39')]?_0x5d249b[_0x8688('0x36')]:_0x4ab1fb['model'];if(!_0x5f4f7b['query'][_0x8688('0x3a')](_0x8688('0x3b'))){_0x5d249b[_0x8688('0x20')]=qs['limit'](_0x5f4f7b['query'][_0x8688('0x20')]);_0x5d249b[_0x8688('0x1e')]=qs[_0x8688('0x1e')](_0x5f4f7b[_0x8688('0x33')][_0x8688('0x1e')]);}_0x5d249b[_0x8688('0x3c')]=qs[_0x8688('0x3d')](_0x5f4f7b['query'][_0x8688('0x3d')]);_0x5d249b[_0x8688('0x3e')]=qs['filters'](_[_0x8688('0x3f')](_0x5f4f7b[_0x8688('0x33')],_0x4ab1fb[_0x8688('0x35')]),_0x21ee40);if(_0x5f4f7b[_0x8688('0x33')][_0x8688('0x40')]){_0x5d249b[_0x8688('0x3e')]=_[_0x8688('0x41')](_0x5d249b[_0x8688('0x3e')],{'$or':_['map'](_0x21ee40,function(_0x297f08){if(_0x297f08['type']!==_0x8688('0x42')){var _0x5ae931={};_0x5ae931[_0x297f08[_0x8688('0x2a')]]={'$like':'%'+_0x5f4f7b[_0x8688('0x33')][_0x8688('0x40')]+'%'};return _0x5ae931;}})});}_0x5d249b=_[_0x8688('0x41')]({},_0x5d249b,_0x5f4f7b['options']);var _0x184317={'where':_0x5d249b[_0x8688('0x3e')]};return db[_0x8688('0x2e')]['count'](_0x184317)[_0x8688('0x26')](function(_0x11e1d2){_0x47b088[_0x8688('0x21')]=_0x11e1d2;if(_0x5f4f7b[_0x8688('0x33')][_0x8688('0x43')]){_0x5d249b[_0x8688('0x44')]=[{'all':!![]}];}return db[_0x8688('0x2e')][_0x8688('0x45')](_0x5d249b);})[_0x8688('0x26')](function(_0x19f7d5){_0x47b088['rows']=_0x19f7d5;return _0x47b088;})['then'](respondWithFilteredResult(_0xed6020,_0x5d249b))['catch'](handleError(_0xed6020,null));};exports[_0x8688('0x46')]=function(_0x32e366,_0x3efd67){var _0x2a9155={'raw':!![],'where':{'id':_0x32e366[_0x8688('0x47')]['id']}},_0x38442e={};_0x38442e[_0x8688('0x32')]=_['keys'](db[_0x8688('0x2e')][_0x8688('0x48')]);_0x38442e[_0x8688('0x33')]=_['keys'](_0x32e366[_0x8688('0x33')]);_0x38442e[_0x8688('0x35')]=_[_0x8688('0x37')](_0x38442e[_0x8688('0x32')],_0x38442e[_0x8688('0x33')]);_0x2a9155[_0x8688('0x36')]=_[_0x8688('0x37')](_0x38442e[_0x8688('0x32')],qs[_0x8688('0x38')](_0x32e366[_0x8688('0x33')][_0x8688('0x38')]));_0x2a9155[_0x8688('0x36')]=_0x2a9155[_0x8688('0x36')][_0x8688('0x39')]?_0x2a9155[_0x8688('0x36')]:_0x38442e[_0x8688('0x32')];if(_0x32e366[_0x8688('0x33')][_0x8688('0x43')]){_0x2a9155['include']=[{'all':!![]}];}_0x2a9155=_['merge']({},_0x2a9155,_0x32e366['options']);return db[_0x8688('0x2e')][_0x8688('0x49')](_0x2a9155)['then'](handleEntityNotFound(_0x3efd67,null))[_0x8688('0x26')](respondWithResult(_0x3efd67,null))['catch'](handleError(_0x3efd67,null));};exports[_0x8688('0x4a')]=function(_0x3cb938,_0x3f53ff){return db[_0x8688('0x2e')][_0x8688('0x4a')](_0x3cb938['body'],{})['then'](respondWithResult(_0x3f53ff,0xc9))[_0x8688('0x4b')](handleError(_0x3f53ff,null));};exports[_0x8688('0x4c')]=function(_0x42a41f,_0x1fbc72){if(_0x42a41f[_0x8688('0x4d')]['id']){delete _0x42a41f[_0x8688('0x4d')]['id'];}return db['WhatsappTransferReport'][_0x8688('0x49')]({'where':{'id':_0x42a41f['params']['id']}})[_0x8688('0x26')](handleEntityNotFound(_0x1fbc72,null))[_0x8688('0x26')](saveUpdates(_0x42a41f['body'],null))['then'](respondWithResult(_0x1fbc72,null))[_0x8688('0x4b')](handleError(_0x1fbc72,null));};exports['destroy']=function(_0x526d5a,_0x3777c0){return db[_0x8688('0x2e')][_0x8688('0x49')]({'where':{'id':_0x526d5a[_0x8688('0x47')]['id']}})[_0x8688('0x26')](handleEntityNotFound(_0x3777c0,null))[_0x8688('0x26')](removeEntity(_0x3777c0,null))[_0x8688('0x4b')](handleError(_0x3777c0,null));};exports[_0x8688('0x4e')]=function(_0x5d139e,_0x2aa02b){return db[_0x8688('0x2e')][_0x8688('0x4e')]()[_0x8688('0x26')](respondWithResult(_0x2aa02b,null))[_0x8688('0x4b')](handleError(_0x2aa02b,null));}; \ No newline at end of file +var _0xab95=['WhatsappTransferReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','body','update','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map'];(function(_0x5ad771,_0x34186f){var _0x5b5dce=function(_0x5ad0fb){while(--_0x5ad0fb){_0x5ad771['push'](_0x5ad771['shift']());}};_0x5b5dce(++_0x34186f);}(_0xab95,0x1d5));var _0x5ab9=function(_0x304810,_0x32cd97){_0x304810=_0x304810-0x0;var _0x4038ea=_0xab95[_0x304810];return _0x4038ea;};'use strict';var emlformat=require(_0x5ab9('0x0'));var rimraf=require(_0x5ab9('0x1'));var zipdir=require(_0x5ab9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5ab9('0x3'));var moment=require(_0x5ab9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5ab9('0x5'));var path=require(_0x5ab9('0x6'));var sox=require('sox');var csv=require(_0x5ab9('0x7'));var ejs=require(_0x5ab9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ab9('0x9'));var squel=require(_0x5ab9('0xa'));var crypto=require('crypto');var jsforce=require(_0x5ab9('0xb'));var deskjs=require(_0x5ab9('0xc'));var toCsv=require(_0x5ab9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5ab9('0xd'));var authService=require(_0x5ab9('0xe'));var qs=require(_0x5ab9('0xf'));var as=require(_0x5ab9('0x10'));var hardwareService=require(_0x5ab9('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x5ab9('0x12'));var config=require(_0x5ab9('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5ab9('0x14'))['db'];function respondWithStatusCode(_0x5f2479,_0x43993a){_0x43993a=_0x43993a||0xcc;return function(_0x235916){if(_0x235916){return _0x5f2479[_0x5ab9('0x15')](_0x43993a);}return _0x5f2479[_0x5ab9('0x16')](_0x43993a)[_0x5ab9('0x17')]();};}function respondWithResult(_0x552b48,_0xec9e3c){_0xec9e3c=_0xec9e3c||0xc8;return function(_0x161c4c){if(_0x161c4c){return _0x552b48[_0x5ab9('0x16')](_0xec9e3c)['json'](_0x161c4c);}};}function respondWithFilteredResult(_0x4150d5,_0x56a4cd){return function(_0x4bcf18){if(_0x4bcf18){var _0x249172=typeof _0x56a4cd[_0x5ab9('0x18')]===_0x5ab9('0x19')&&typeof _0x56a4cd[_0x5ab9('0x1a')]===_0x5ab9('0x19');var _0x23bddf=_0x4bcf18[_0x5ab9('0x1b')];var _0x49970d=_0x249172?0x0:_0x56a4cd[_0x5ab9('0x18')];var _0x274383=_0x249172?_0x4bcf18['count']:_0x56a4cd[_0x5ab9('0x18')]+_0x56a4cd[_0x5ab9('0x1a')];var _0x559618;if(_0x274383>=_0x23bddf){_0x274383=_0x23bddf;_0x559618=0xc8;}else{_0x559618=0xce;}_0x4150d5[_0x5ab9('0x16')](_0x559618);return _0x4150d5[_0x5ab9('0x1c')](_0x5ab9('0x1d'),_0x49970d+'-'+_0x274383+'/'+_0x23bddf)[_0x5ab9('0x1e')](_0x4bcf18);}return null;};}function patchUpdates(_0x132c73){return function(_0x10d90f){try{jsonpatch[_0x5ab9('0x1f')](_0x10d90f,_0x132c73,!![]);}catch(_0x1205a6){return BPromise[_0x5ab9('0x20')](_0x1205a6);}return _0x10d90f[_0x5ab9('0x21')]();};}function saveUpdates(_0x3ee600,_0x1ee365){return function(_0x4c31e6){if(_0x4c31e6){return _0x4c31e6['update'](_0x3ee600)[_0x5ab9('0x22')](function(_0x5cc952){return _0x5cc952;});}return null;};}function removeEntity(_0x451da3,_0xdecd3d){return function(_0x1c45db){if(_0x1c45db){return _0x1c45db[_0x5ab9('0x23')]()[_0x5ab9('0x22')](function(){_0x451da3[_0x5ab9('0x16')](0xcc)[_0x5ab9('0x17')]();});}};}function handleEntityNotFound(_0x170f2d,_0x333f52){return function(_0x15bd3c){if(!_0x15bd3c){_0x170f2d['sendStatus'](0x194);}return _0x15bd3c;};}function handleError(_0x52f7d5,_0x2c65d2){_0x2c65d2=_0x2c65d2||0x1f4;return function(_0x120c92){logger[_0x5ab9('0x24')](_0x120c92[_0x5ab9('0x25')]);if(_0x120c92[_0x5ab9('0x26')]){delete _0x120c92[_0x5ab9('0x26')];}_0x52f7d5['status'](_0x2c65d2)[_0x5ab9('0x27')](_0x120c92);};}exports[_0x5ab9('0x28')]=function(_0x50a386,_0x2e492b){var _0x302a6c={},_0x4fccdf={},_0xe0f687={'count':0x0,'rows':[]};var _0x198b0f=_[_0x5ab9('0x29')](db[_0x5ab9('0x2a')][_0x5ab9('0x2b')],function(_0xf5c162){return{'name':_0xf5c162[_0x5ab9('0x2c')],'type':_0xf5c162['type']['key']};});_0x4fccdf[_0x5ab9('0x2d')]=_[_0x5ab9('0x29')](_0x198b0f,_0x5ab9('0x26'));_0x4fccdf[_0x5ab9('0x2e')]=_[_0x5ab9('0x2f')](_0x50a386[_0x5ab9('0x2e')]);_0x4fccdf[_0x5ab9('0x30')]=_[_0x5ab9('0x31')](_0x4fccdf[_0x5ab9('0x2d')],_0x4fccdf['query']);_0x302a6c[_0x5ab9('0x32')]=_[_0x5ab9('0x31')](_0x4fccdf[_0x5ab9('0x2d')],qs[_0x5ab9('0x33')](_0x50a386[_0x5ab9('0x2e')][_0x5ab9('0x33')]));_0x302a6c[_0x5ab9('0x32')]=_0x302a6c[_0x5ab9('0x32')]['length']?_0x302a6c[_0x5ab9('0x32')]:_0x4fccdf[_0x5ab9('0x2d')];if(!_0x50a386[_0x5ab9('0x2e')][_0x5ab9('0x34')](_0x5ab9('0x35'))){_0x302a6c[_0x5ab9('0x1a')]=qs[_0x5ab9('0x1a')](_0x50a386[_0x5ab9('0x2e')][_0x5ab9('0x1a')]);_0x302a6c[_0x5ab9('0x18')]=qs[_0x5ab9('0x18')](_0x50a386['query'][_0x5ab9('0x18')]);}_0x302a6c[_0x5ab9('0x36')]=qs[_0x5ab9('0x37')](_0x50a386['query'][_0x5ab9('0x37')]);_0x302a6c[_0x5ab9('0x38')]=qs[_0x5ab9('0x30')](_[_0x5ab9('0x39')](_0x50a386[_0x5ab9('0x2e')],_0x4fccdf[_0x5ab9('0x30')]),_0x198b0f);if(_0x50a386[_0x5ab9('0x2e')][_0x5ab9('0x3a')]){_0x302a6c['where']=_[_0x5ab9('0x3b')](_0x302a6c[_0x5ab9('0x38')],{'$or':_[_0x5ab9('0x29')](_0x198b0f,function(_0x3334ea){if(_0x3334ea['type']!==_0x5ab9('0x3c')){var _0x4d90d0={};_0x4d90d0[_0x3334ea['name']]={'$like':'%'+_0x50a386['query'][_0x5ab9('0x3a')]+'%'};return _0x4d90d0;}})});}_0x302a6c=_[_0x5ab9('0x3b')]({},_0x302a6c,_0x50a386[_0x5ab9('0x3d')]);var _0x1b5a5f={'where':_0x302a6c['where']};return db['WhatsappTransferReport'][_0x5ab9('0x1b')](_0x1b5a5f)[_0x5ab9('0x22')](function(_0x13a5a1){_0xe0f687[_0x5ab9('0x1b')]=_0x13a5a1;if(_0x50a386[_0x5ab9('0x2e')][_0x5ab9('0x3e')]){_0x302a6c[_0x5ab9('0x3f')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x5ab9('0x40')](_0x302a6c);})[_0x5ab9('0x22')](function(_0x36ecfb){_0xe0f687[_0x5ab9('0x41')]=_0x36ecfb;return _0xe0f687;})[_0x5ab9('0x22')](respondWithFilteredResult(_0x2e492b,_0x302a6c))['catch'](handleError(_0x2e492b,null));};exports[_0x5ab9('0x42')]=function(_0x6fe2d3,_0x15de13){var _0xf1f964={'raw':!![],'where':{'id':_0x6fe2d3[_0x5ab9('0x43')]['id']}},_0x535478={};_0x535478[_0x5ab9('0x2d')]=_['keys'](db['WhatsappTransferReport'][_0x5ab9('0x2b')]);_0x535478[_0x5ab9('0x2e')]=_['keys'](_0x6fe2d3[_0x5ab9('0x2e')]);_0x535478[_0x5ab9('0x30')]=_['intersection'](_0x535478['model'],_0x535478[_0x5ab9('0x2e')]);_0xf1f964[_0x5ab9('0x32')]=_[_0x5ab9('0x31')](_0x535478[_0x5ab9('0x2d')],qs['fields'](_0x6fe2d3['query']['fields']));_0xf1f964['attributes']=_0xf1f964['attributes']['length']?_0xf1f964[_0x5ab9('0x32')]:_0x535478[_0x5ab9('0x2d')];if(_0x6fe2d3['query']['includeAll']){_0xf1f964[_0x5ab9('0x3f')]=[{'all':!![]}];}_0xf1f964=_[_0x5ab9('0x3b')]({},_0xf1f964,_0x6fe2d3['options']);return db[_0x5ab9('0x2a')][_0x5ab9('0x44')](_0xf1f964)[_0x5ab9('0x22')](handleEntityNotFound(_0x15de13,null))[_0x5ab9('0x22')](respondWithResult(_0x15de13,null))[_0x5ab9('0x45')](handleError(_0x15de13,null));};exports['create']=function(_0x3a8be9,_0x5759e1){return db[_0x5ab9('0x2a')]['create'](_0x3a8be9[_0x5ab9('0x46')],{})['then'](respondWithResult(_0x5759e1,0xc9))[_0x5ab9('0x45')](handleError(_0x5759e1,null));};exports[_0x5ab9('0x47')]=function(_0x144602,_0x13daa8){if(_0x144602[_0x5ab9('0x46')]['id']){delete _0x144602['body']['id'];}return db[_0x5ab9('0x2a')]['find']({'where':{'id':_0x144602[_0x5ab9('0x43')]['id']}})[_0x5ab9('0x22')](handleEntityNotFound(_0x13daa8,null))['then'](saveUpdates(_0x144602[_0x5ab9('0x46')],null))['then'](respondWithResult(_0x13daa8,null))[_0x5ab9('0x45')](handleError(_0x13daa8,null));};exports['destroy']=function(_0x417113,_0x2fbfb8){return db[_0x5ab9('0x2a')][_0x5ab9('0x44')]({'where':{'id':_0x417113['params']['id']}})[_0x5ab9('0x22')](handleEntityNotFound(_0x2fbfb8,null))[_0x5ab9('0x22')](removeEntity(_0x2fbfb8,null))[_0x5ab9('0x45')](handleError(_0x2fbfb8,null));};exports['describe']=function(_0x2c3326,_0x40c95e){return db['WhatsappTransferReport'][_0x5ab9('0x48')]()[_0x5ab9('0x22')](respondWithResult(_0x40c95e,null))[_0x5ab9('0x45')](handleError(_0x40c95e,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index a3a15ec..6fe1cb4 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 _0x263c=['request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','uniqueid','util','../../config/logger','api','moment','bluebird'];(function(_0x26b4e7,_0x20cffe){var _0x2e3484=function(_0x25f3e6){while(--_0x25f3e6){_0x26b4e7['push'](_0x26b4e7['shift']());}};_0x2e3484(++_0x20cffe);}(_0x263c,0x1c2));var _0xc263=function(_0x4ae459,_0x3bf329){_0x4ae459=_0x4ae459-0x0;var _0x51d0c9=_0x263c[_0x4ae459];return _0x51d0c9;};'use strict';var _=require('lodash');var util=require(_0xc263('0x0'));var logger=require(_0xc263('0x1'))(_0xc263('0x2'));var moment=require(_0xc263('0x3'));var BPromise=require(_0xc263('0x4'));var rp=require(_0xc263('0x5'));var fs=require('fs');var path=require(_0xc263('0x6'));var rimraf=require(_0xc263('0x7'));var config=require(_0xc263('0x8'));var attributes=require(_0xc263('0x9'));module['exports']=function(_0xa1cc7d,_0x7554ca){return _0xa1cc7d[_0xc263('0xa')](_0xc263('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xc263('0xc'),'fields':[_0xc263('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf088=['./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xf088,0xad));var _0x8f08=function(_0x27b96e,_0x322c1b){_0x27b96e=_0x27b96e-0x0;var _0x425f38=_0xf088[_0x27b96e];return _0x425f38;};'use strict';var _=require(_0x8f08('0x0'));var util=require(_0x8f08('0x1'));var logger=require(_0x8f08('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8f08('0x3'));var fs=require('fs');var path=require(_0x8f08('0x4'));var rimraf=require(_0x8f08('0x5'));var config=require(_0x8f08('0x6'));var attributes=require(_0x8f08('0x7'));module[_0x8f08('0x8')]=function(_0x3d9816,_0x5e29e3){return _0x3d9816['define'](_0x8f08('0x9'),attributes,{'tableName':_0x8f08('0xa'),'paranoid':![],'indexes':[{'name':_0x8f08('0xb'),'fields':[_0x8f08('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 f885686..23f1ec4 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 _0x0893=['catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x2c6484,_0x4fe72c){var _0x3b9d94=function(_0x3d8bd4){while(--_0x3d8bd4){_0x2c6484['push'](_0x2c6484['shift']());}};_0x3b9d94(++_0x4fe72c);}(_0x0893,0xc7));var _0x3089=function(_0x459db8,_0x2db794){_0x459db8=_0x459db8-0x0;var _0x3f4f8b=_0x0893[_0x459db8];return _0x3f4f8b;};'use strict';var _=require(_0x3089('0x0'));var util=require(_0x3089('0x1'));var moment=require('moment');var BPromise=require(_0x3089('0x2'));var rs=require(_0x3089('0x3'));var fs=require('fs');var Redis=require(_0x3089('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3089('0x5'));var logger=require(_0x3089('0x6'))(_0x3089('0x7'));var config=require('../../config/environment');var jayson=require(_0x3089('0x8'));var client=jayson['client'][_0x3089('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fa2ba,_0x3d92b7,_0x1667ca){return new BPromise(function(_0x58c0bf,_0x4d6dd0){return client[_0x3089('0xa')](_0x4fa2ba,_0x1667ca)['then'](function(_0x332f6a){logger[_0x3089('0xb')](_0x3089('0xc'),_0x3d92b7,'request\x20sent');logger[_0x3089('0xd')](_0x3089('0xe'),_0x3d92b7,_0x3089('0xf'),JSON[_0x3089('0x10')](_0x332f6a));if(_0x332f6a[_0x3089('0x11')]){if(_0x332f6a[_0x3089('0x11')][_0x3089('0x12')]===0x1f4){logger[_0x3089('0x11')](_0x3089('0xc'),_0x3d92b7,_0x332f6a[_0x3089('0x11')][_0x3089('0x13')]);return _0x4d6dd0(_0x332f6a[_0x3089('0x11')]['message']);}logger[_0x3089('0x11')](_0x3089('0xc'),_0x3d92b7,_0x332f6a[_0x3089('0x11')][_0x3089('0x13')]);return _0x58c0bf(_0x332f6a['error'][_0x3089('0x13')]);}else{logger[_0x3089('0xb')](_0x3089('0xc'),_0x3d92b7,_0x3089('0xf'));_0x58c0bf(_0x332f6a[_0x3089('0x14')][_0x3089('0x13')]);}})[_0x3089('0x15')](function(_0x70b11c){logger[_0x3089('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3d92b7,_0x70b11c);_0x4d6dd0(_0x70b11c);});});} \ No newline at end of file +var _0x3695=['request\x20sent','error','code','message','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x6d7060,_0x119c08){var _0x195046=function(_0x3a4923){while(--_0x3a4923){_0x6d7060['push'](_0x6d7060['shift']());}};_0x195046(++_0x119c08);}(_0x3695,0x180));var _0x5369=function(_0x2f1671,_0xfca134){_0x2f1671=_0x2f1671-0x0;var _0x575ef3=_0x3695[_0x2f1671];return _0x575ef3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5369('0x0'));var BPromise=require(_0x5369('0x1'));var rs=require(_0x5369('0x2'));var fs=require('fs');var Redis=require(_0x5369('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5369('0x4'));var logger=require(_0x5369('0x5'))('rpc');var config=require(_0x5369('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5369('0x7')][_0x5369('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d0b8f,_0x483393,_0x192e62){return new BPromise(function(_0x28173e,_0x428fa5){return client[_0x5369('0x9')](_0x3d0b8f,_0x192e62)[_0x5369('0xa')](function(_0x488244){logger[_0x5369('0xb')](_0x5369('0xc'),_0x483393,'request\x20sent');logger[_0x5369('0xd')](_0x5369('0xe'),_0x483393,_0x5369('0xf'),JSON['stringify'](_0x488244));if(_0x488244[_0x5369('0x10')]){if(_0x488244[_0x5369('0x10')][_0x5369('0x11')]===0x1f4){logger[_0x5369('0x10')](_0x5369('0xc'),_0x483393,_0x488244['error'][_0x5369('0x12')]);return _0x428fa5(_0x488244[_0x5369('0x10')][_0x5369('0x12')]);}logger[_0x5369('0x10')](_0x5369('0xc'),_0x483393,_0x488244[_0x5369('0x10')][_0x5369('0x12')]);return _0x28173e(_0x488244[_0x5369('0x10')][_0x5369('0x12')]);}else{logger[_0x5369('0xb')](_0x5369('0xc'),_0x483393,_0x5369('0xf'));_0x28173e(_0x488244['result'][_0x5369('0x12')]);}})['catch'](function(_0x10d816){logger['error'](_0x5369('0xc'),_0x483393,_0x10d816);_0x428fa5(_0x10d816);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index bebf703..20f6556 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e88=['./config/license','./rpc','./config/environment','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','filter','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','lodash','./mysqldb','./config/seedDB'];(function(_0x3df763,_0x3d8435){var _0x6d4ea2=function(_0x35c40f){while(--_0x35c40f){_0x3df763['push'](_0x3df763['shift']());}};_0x6d4ea2(++_0x3d8435);}(_0x2e88,0x95));var _0x82e8=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0x2e88[_0x506d83];return _0x335e8b;};'use strict';var _=require(_0x82e8('0x0'));var db=require(_0x82e8('0x1'))['db'];var seedDb=require(_0x82e8('0x2'));var checkLicense=require(_0x82e8('0x3'));var rpc=require(_0x82e8('0x4'));var config=require(_0x82e8('0x5'));var logger=require('./config/logger')(_0x82e8('0x6'));var pm2=require(_0x82e8('0x7'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x82e8('0x8'));var chat=require(_0x82e8('0x9'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x82e8('0xa'));var provider=require(_0x82e8('0xb'));function main(){return db[_0x82e8('0xc')][_0x82e8('0xd')]()[_0x82e8('0xe')](function(){if(config[_0x82e8('0xf')]){return seedDb[_0x82e8('0x10')]();}})[_0x82e8('0xe')](function(){return checkLicense[_0x82e8('0x10')]();})[_0x82e8('0xe')](function(){return rpc[_0x82e8('0x11')]();})['then'](function(_0x30b9bc){logger[_0x82e8('0x12')](_0x30b9bc);return chat[_0x82e8('0x13')]();})[_0x82e8('0xe')](function(){return whatsapp[_0x82e8('0x13')]();})[_0x82e8('0xe')](function(){return schedule[_0x82e8('0x13')]();})['then'](function(){return transcribe[_0x82e8('0x13')]();})[_0x82e8('0xe')](function(){return provider[_0x82e8('0x13')]();})[_0x82e8('0xe')](function(_0x192914){logger['info'](_0x192914);return pm2[_0x82e8('0x13')](pm2Config);})[_0x82e8('0xe')](function(_0xad6055){var _0x46e01e=_0xad6055['filter'](function(_0x25b60e){return typeof _0x25b60e[_0x82e8('0x14')]===_0x82e8('0x15')&&_0x25b60e[_0x82e8('0x14')]>=0x0;});if(_0x46e01e[_0x82e8('0x16')]>0x0){throw new Error(_0x46e01e['length']+_0x82e8('0x17')+_[_0x82e8('0x18')](_0x46e01e,function(_0x574ba2){return'\x22'+_0x574ba2[_0x82e8('0x19')][_0x82e8('0x1a')]+'\x22';}));}logger[_0x82e8('0x12')](_0x82e8('0x1b'),_[_0x82e8('0x18')](_[_0x82e8('0x1c')](_0xad6055,{'status':_0x82e8('0x1d')}),'name')[_0x82e8('0x1e')]());logger[_0x82e8('0x12')](_0x82e8('0x1f'),_[_0x82e8('0x18')](_[_0x82e8('0x1c')](_0xad6055,function(_0x5db337){return _0x5db337[_0x82e8('0x20')]!=='online';}),_0x82e8('0x1a'))[_0x82e8('0x1e')]()||_0x82e8('0x21'));console[_0x82e8('0x22')](_0x82e8('0x23'));})[_0x82e8('0x24')](function(_0x37d499){console['log'](_0x82e8('0x25'),_0x37d499);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x37d499);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x7923=['log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','seedDB','default','then','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','None','catch'];(function(_0x2b0154,_0x389561){var _0x163ae6=function(_0x10f984){while(--_0x10f984){_0x2b0154['push'](_0x2b0154['shift']());}};_0x163ae6(++_0x389561);}(_0x7923,0x8f));var _0x3792=function(_0x9c8afa,_0x1d2029){_0x9c8afa=_0x9c8afa-0x0;var _0x321ef1=_0x7923[_0x9c8afa];return _0x321ef1;};'use strict';var _=require(_0x3792('0x0'));var db=require(_0x3792('0x1'))['db'];var seedDb=require(_0x3792('0x2'));var checkLicense=require(_0x3792('0x3'));var rpc=require(_0x3792('0x4'));var config=require(_0x3792('0x5'));var logger=require(_0x3792('0x6'))('app');var pm2=require(_0x3792('0x7'));var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0x3792('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x3792('0x9'));var provider=require(_0x3792('0xa'));function main(){return db[_0x3792('0xb')]['sync']()['then'](function(){if(config[_0x3792('0xc')]){return seedDb[_0x3792('0xd')]();}})['then'](function(){return checkLicense[_0x3792('0xd')]();})[_0x3792('0xe')](function(){return rpc['listen']();})[_0x3792('0xe')](function(_0x23e626){logger[_0x3792('0xf')](_0x23e626);return chat['start']();})['then'](function(){return whatsapp[_0x3792('0x10')]();})[_0x3792('0xe')](function(){return schedule[_0x3792('0x10')]();})[_0x3792('0xe')](function(){return transcribe['start']();})['then'](function(){return provider[_0x3792('0x10')]();})[_0x3792('0xe')](function(_0x362845){logger[_0x3792('0xf')](_0x362845);return pm2[_0x3792('0x10')](pm2Config);})[_0x3792('0xe')](function(_0x41139d){var _0x2dc722=_0x41139d[_0x3792('0x11')](function(_0x11910c){return typeof _0x11910c[_0x3792('0x12')]===_0x3792('0x13')&&_0x11910c[_0x3792('0x12')]>=0x0;});if(_0x2dc722[_0x3792('0x14')]>0x0){throw new Error(_0x2dc722[_0x3792('0x14')]+_0x3792('0x15')+_[_0x3792('0x16')](_0x2dc722,function(_0x4a8e1c){return'\x22'+_0x4a8e1c[_0x3792('0x17')][_0x3792('0x18')]+'\x22';}));}logger[_0x3792('0xf')](_0x3792('0x19'),_[_0x3792('0x16')](_['filter'](_0x41139d,{'status':_0x3792('0x1a')}),_0x3792('0x18'))[_0x3792('0x1b')]());logger[_0x3792('0xf')](_0x3792('0x1c'),_['map'](_['filter'](_0x41139d,function(_0x2c1f8a){return _0x2c1f8a[_0x3792('0x1d')]!==_0x3792('0x1a');}),_0x3792('0x18'))[_0x3792('0x1b')]()||_0x3792('0x1e'));console['log']('App\x20Ready!');})[_0x3792('0x1f')](function(_0x19950a){console[_0x3792('0x20')](_0x3792('0x21'),_0x19950a);logger['error'](_0x3792('0x22'),_0x19950a);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 41ebedb..a3ad11c 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 _0xb94a=['HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','lodash','composable-middleware','crypto','bluebird','util','moment','secrets','role','fullname','internal','userpic','permissions','md5secret','chatPause','mailPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','chatAutoanswerDelay','emailAutoanswer','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','isAuthenticated','use','ChatInteraction','findOne','closed','disposition','query','forceDownload','status','unmanaged','Unmanaged.','Forbidden.','catch','authorization','startsWith','headers','User','authenticate','json','user','Unknown\x20authorization\x20format','apikey','getUuid','then','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','add','minutes','find','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','validatePasswordHistory','decryptString','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','length','splice','unshift','encryptString','join','sign','secret','session','options','promisify','hex','floor','toString'];(function(_0x2e5f9c,_0x134a52){var _0x538b44=function(_0x38ef13){while(--_0x38ef13){_0x2e5f9c['push'](_0x2e5f9c['shift']());}};_0x538b44(++_0x134a52);}(_0xb94a,0x84));var _0xab94=function(_0x17f5bf,_0x86d855){_0x17f5bf=_0x17f5bf-0x0;var _0x7db619=_0xb94a[_0x17f5bf];return _0x7db619;};'use strict';var db=require(_0xab94('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0xab94('0x1'));var licenseUtil=require(_0xab94('0x2'));var encryptor=require('../encryptor');var _=require(_0xab94('0x3'));var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require(_0xab94('0x4'));var basicAuth=require('basic-auth');var crypto=require(_0xab94('0x5'));var BPromise=require(_0xab94('0x6'));var util=require(_0xab94('0x7'));var moment=require(_0xab94('0x8'));var validateJwt=expressJwt({'secret':config[_0xab94('0x9')]['session']});var userAttributes=['id',_0xab94('0xa'),_0xab94('0xb'),'name',_0xab94('0xc'),'email',_0xab94('0xd'),_0xab94('0xe'),_0xab94('0xf'),'voicePause',_0xab94('0x10'),_0xab94('0x11'),'faxPause',_0xab94('0x12'),_0xab94('0x13'),_0xab94('0x14'),'showWebBar',_0xab94('0x15'),_0xab94('0x16'),_0xab94('0x17'),_0xab94('0x18'),_0xab94('0x19'),_0xab94('0x1a'),_0xab94('0x1b'),'phoneBarAutoAnswerDelay',_0xab94('0x1c'),_0xab94('0x1d'),_0xab94('0x1e'),_0xab94('0x1f'),_0xab94('0x20'),'phoneBarPrefixRequired',_0xab94('0x21'),_0xab94('0x22'),_0xab94('0x23'),_0xab94('0x24'),'userProfileId',_0xab94('0x25'),'settingsEnabled','wssPort',_0xab94('0x26'),_0xab94('0x27'),'downloadAttachments',_0xab94('0x28'),'selectRecallMeCampaign','chatAutoanswer',_0xab94('0x29'),_0xab94('0x2a'),'emailAutoanswerDelay',_0xab94('0x2b'),_0xab94('0x2c'),_0xab94('0x2d'),_0xab94('0x2e'),_0xab94('0x2f'),'faxAutoanswerDelay',_0xab94('0x30'),_0xab94('0x31'),'messengerSoundNotification'];exports['isChatInteractionAuthorized']=function(){return this[_0xab94('0x32')](!![])[_0xab94('0x33')](function(_0xd8982b,_0x643308,_0x55c2fb){if(_0xd8982b['user']){_0x55c2fb();}else{return db[_0xab94('0x34')][_0xab94('0x35')]({'where':{'id':_0xd8982b['params']['id']},'attributes':['id',_0xab94('0x36'),_0xab94('0x37')],'raw':!![]})['then'](function(_0xcb66db){if(_0xcb66db&&_0xcb66db[_0xab94('0x36')]&&!_0xd8982b[_0xab94('0x38')][_0xab94('0x39')]){return _0x643308[_0xab94('0x3a')](_0xcb66db[_0xab94('0x37')]===_0xab94('0x3b')?0x195:0x193)['json']({'message':_0xcb66db[_0xab94('0x37')]===_0xab94('0x3b')?_0xab94('0x3c'):_0xab94('0x3d')});}else{_0x55c2fb();}})[_0xab94('0x3e')](function(_0x8447b7){_0x55c2fb(_0x8447b7);});}});};exports[_0xab94('0x32')]=function isAuthenticated(_0x587bf5){return compose()[_0xab94('0x33')](function(_0x30f46a,_0x29d444,_0xb51e6c){var _0x212337;if(_0x30f46a['headers'][_0xab94('0x3f')]){if(_[_0xab94('0x40')](_0x30f46a[_0xab94('0x41')][_0xab94('0x3f')],'Basic')){var _0xecc468=basicAuth(_0x30f46a);db[_0xab94('0x42')]['find']({'where':{'name':_0xecc468['name']}})['then'](function(_0x9cadf5){if(!_0x9cadf5||!_0x9cadf5[_0xab94('0x43')](_0xecc468['pass'])){return _0x29d444[_0xab94('0x3a')](0x191)[_0xab94('0x44')]({'message':'Wrong\x20credentials.'});}_0x30f46a[_0xab94('0x45')]={'id':_0x9cadf5['id']};_0xb51e6c();})[_0xab94('0x3e')](function(_0x9b448d){_0xb51e6c(_0x9b448d);});}else if(_[_0xab94('0x40')](_0x30f46a[_0xab94('0x41')][_0xab94('0x3f')],'Bearer')){validateJwt(_0x30f46a,_0x29d444,_0xb51e6c);}else{if(_0x587bf5){_0xb51e6c();}else{return _0x29d444[_0xab94('0x3a')](0x193)[_0xab94('0x44')]({'message':_0xab94('0x46')});}}}else if(_0x30f46a['query'][_0xab94('0x47')]){try{var _0x109787={'audience':hardwareConf[_0xab94('0x48')](),'issuer':hardwareConf[_0xab94('0x48')]()};verifyJwt(_0x30f46a[_0xab94('0x38')][_0xab94('0x47')],_0x109787)[_0xab94('0x49')](function(_0x8e31ac){return db[_0xab94('0x42')]['find']({'where':{'id':_0x8e31ac[_0xab94('0x4a')]}})[_0xab94('0x49')](function(_0x17e992){_0x212337=_0x17e992;return db[_0xab94('0x4b')][_0xab94('0x35')]({'where':{'id':0x1},'attributes':[_0xab94('0x4c'),_0xab94('0x4d')],'raw':!![]});})[_0xab94('0x49')](function(_0x195bde){if(!_0x212337||!_[_0xab94('0x4e')](_0x212337[_0xab94('0x4f')],_0x8e31ac['nonce'])){return _0x29d444[_0xab94('0x3a')](0x191)[_0xab94('0x44')]({'message':_0xab94('0x50')});}if(_0x212337['disabled']){return _0x29d444[_0xab94('0x3a')](0x191)[_0xab94('0x44')]({'message':_0xab94('0x51')});}if(_0x212337[_0xab94('0x52')]){if(_0x195bde['blockDuration']>0x0){if(moment(_0x212337['blockedAt'])[_0xab94('0x53')](_0x195bde[_0xab94('0x4d')],_0xab94('0x54'))>moment()){return _0x29d444[_0xab94('0x3a')](0x191)[_0xab94('0x44')]({'message':_0xab94('0x51')});}}else{return _0x29d444['status'](0x191)['json']({'message':_0xab94('0x51')});}}_0x30f46a[_0xab94('0x45')]={'id':_0x212337['id']};_0xb51e6c();});})['catch'](function(){return _0x29d444[_0xab94('0x3a')](0x191)[_0xab94('0x44')]({'message':_0xab94('0x51')});});}catch(_0x25e4fe){_0xb51e6c(_0x25e4fe);}}else if(_0x587bf5){_0xb51e6c();}else{return _0x29d444[_0xab94('0x3a')](0x193)[_0xab94('0x44')]({'message':'Unknown\x20authorization\x20format'});}})[_0xab94('0x33')](function(_0x6ff918,_0x4bd25e,_0x55800e){if(_0x6ff918[_0xab94('0x45')]){db[_0xab94('0x42')][_0xab94('0x55')]({'where':{'id':_0x6ff918['user']['id']},'attributes':userAttributes})[_0xab94('0x49')](function(_0x2dd14c){if(!_0x2dd14c){return _0x4bd25e[_0xab94('0x3a')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x6ff918['user']=_0x2dd14c;_0x55800e();})['catch'](function(_0x437cf6){_0x55800e(_0x437cf6);});}else if(_0x587bf5){_0x55800e();}else{return _0x4bd25e['status'](0x194)[_0xab94('0x44')]({'message':_0xab94('0x56')});}});};exports[_0xab94('0x57')]=function canUpdate(){return compose()[_0xab94('0x33')](function(_0x2ae1c0,_0x5dd920,_0x10f17c){return licenseUtil[_0xab94('0x58')]()[_0xab94('0x49')](function(_0x530f06){if(_0x530f06[_0xab94('0x59')]){_0x10f17c();}else{return _0x5dd920['status'](0x193)[_0xab94('0x44')]({'message':_0xab94('0x5a')});}})[_0xab94('0x3e')](function(_0x84bec6){_0x10f17c(_0x84bec6);});});};exports[_0xab94('0x5b')]=function isWebrtcLicence(){return compose()[_0xab94('0x33')](function(_0x4ab9f4,_0x4109d4,_0x490711){return licenseUtil[_0xab94('0x58')]()[_0xab94('0x49')](function(_0x1cbe61){if(_0x1cbe61[_0xab94('0x5c')]){_0x490711();}else{return _0x4109d4[_0xab94('0x3a')](0x193)['json']({'message':_0xab94('0x5a')});}})[_0xab94('0x3e')](function(_0x201383){_0x490711(_0x201383);});});};exports[_0xab94('0x5d')]=function(_0x2e1545,_0x22fe52,_0x454ede){_0x2e1545[_0xab94('0x5d')]=!![];return _0x454ede();};exports[_0xab94('0x5e')]=function signToken(_0x4abd7d){return signJwt(_0x4abd7d);};exports[_0xab94('0x5f')]=function(_0x24a31e,_0x10b6ee){if(!_0x24a31e['user']){return _0x10b6ee[_0xab94('0x3a')](0x194)[_0xab94('0x44')]({'message':_0xab94('0x60')});}var _0x9fe09d={'payload':{'id':_0x24a31e[_0xab94('0x45')]['id'],'role':_0x24a31e[_0xab94('0x45')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x9fe09d)[_0xab94('0x49')](function(_0x49b598){_0x10b6ee[_0xab94('0x61')](_0xab94('0x62'),_0x49b598);_0x10b6ee[_0xab94('0x63')](_0xab94('0x64'));})[_0xab94('0x3e')](function(_0x2d5f59){return _0x10b6ee[_0xab94('0x3a')](0x1f4)[_0xab94('0x65')](_0x2d5f59);});};exports[_0xab94('0x66')]=function(_0x5f56b4){if(_[_0xab94('0x67')](_0x5f56b4['apiKeyNonce'])||_[_0xab94('0x67')](_0x5f56b4[_0xab94('0x68')])){return null;}else{return createJwt(_0x5f56b4);}};exports[_0xab94('0x69')]=function(_0x1145c6){_0x1145c6[_0xab94('0x4f')]=generateNonce();_0x1145c6[_0xab94('0x68')]=generateIssuedAt();return createJwt(_0x1145c6);};exports[_0xab94('0x6a')]=function(_0x3a3e73,_0x2c0a86){var _0x40f2ce=_0x3a3e73[_0xab94('0x38')][_0xab94('0x47')];if(_0x40f2ce){var _0xdcabd3={'nonce':_0x2c0a86[_0xab94('0x4f')],'iat':_0x2c0a86['apiKeyIat'],'audience':hardwareConf[_0xab94('0x48')](),'issuer':hardwareConf[_0xab94('0x48')]()};return verifyJwt(_0x40f2ce,_0xdcabd3)[_0xab94('0x49')](function(){return generateApiKey(_0x2c0a86);});}else{throw{'message':_0xab94('0x6b')};}};exports[_0xab94('0x6c')]=function(_0x10330f){var _0x52b156=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x52b156['test'](_0x10330f))throw new db[(_0xab94('0x6d'))]['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[_0xab94('0x6e')]=function(_0x4fec06,_0x38fa63,_0xa96aac){var _0x23873f=encryptor[_0xab94('0x6f')](_0x38fa63)['split'](',');for(var _0x3dadeb=0x0;_0x3dadeb<_0xa96aac;_0x3dadeb++){if(!_0x23873f[_0x3dadeb])break;if(_0x4fec06[_0xab94('0x70')]()===_0x23873f[_0x3dadeb][_0xab94('0x70')]()){var _0x338b82=util['format'](_0xab94('0x71'),_0xa96aac);if(_0xa96aac===0x1){_0x338b82=_0xab94('0x72');}throw new db[(_0xab94('0x6d'))][(_0xab94('0x73'))](_0x338b82);}}return;};exports[_0xab94('0x74')]=function(_0x45d056,_0x4ab4c0){var _0x23513a=_0x4ab4c0?encryptor[_0xab94('0x6f')](_0x4ab4c0)['split'](','):[];if(_0x23513a[_0xab94('0x75')]===0x5){_0x23513a[_0xab94('0x76')](-0x1,0x1);}_0x23513a[_0xab94('0x77')](_0x45d056);return encryptor[_0xab94('0x78')](_0x23513a[_0xab94('0x79')](','));};function signJwt(_0xd2086c){var _0x3a17b5=BPromise['promisify'](jwt[_0xab94('0x7a')],{'context':jwt});var _0x53b887=_0xd2086c[_0xab94('0x7b')]||config[_0xab94('0x9')][_0xab94('0x7c')];return new BPromise(function(_0x51a18b,_0x8b716c){_0x3a17b5(_0xd2086c['payload'],_0x53b887,_0xd2086c[_0xab94('0x7d')])[_0xab94('0x49')](function(_0x1939e9){_0x51a18b(_0x1939e9);})['catch'](function(_0x58f991){_0x8b716c(_0x58f991);});});}function verifyJwt(_0x5d8e1e,_0x399286,_0x4a17ab){var _0xb57911=BPromise[_0xab94('0x7e')](jwt['verify'],{'context':jwt});var _0x2b48de=_0x4a17ab||config[_0xab94('0x9')][_0xab94('0x7c')];return new BPromise(function(_0x291f2c,_0x4389e0){_0xb57911(_0x5d8e1e,_0x2b48de,_0x399286)[_0xab94('0x49')](function(_0x3a0411){_0x291f2c(_0x3a0411);})[_0xab94('0x3e')](function(_0x5004a3){_0x4389e0(_0x5004a3);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0xab94('0x7f'));}function generateIssuedAt(){return Math[_0xab94('0x80')](Date['now']()/0x3e8)[_0xab94('0x81')]();}function createJwt(_0x97cd86){var _0x219b21={'payload':{'iat':_0x97cd86[_0xab94('0x68')],'nonce':_0x97cd86['apiKeyNonce']},'options':{'algorithm':_0xab94('0x82'),'subject':_0x97cd86['id'][_0xab94('0x81')](),'issuer':hardwareConf[_0xab94('0x48')](),'audience':hardwareConf[_0xab94('0x48')]()}};return signJwt(_0x219b21)[_0xab94('0x49')](function(_0x329129){return{'iat':_0x97cd86['apiKeyIat'],'nonce':_0x97cd86[_0xab94('0x4f')],'token':_0x329129};});} \ No newline at end of file +var _0x33cd=['User','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','find','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','Forbidden','webrtc','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','validatePasswordPattern','test','ValidationError','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','decryptString','length','splice','unshift','encryptString','join','promisify','sign','secret','session','payload','options','verify','toString','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','basic-auth','crypto','bluebird','moment','secrets','name','internal','email','userpic','md5secret','voicePause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadAttachments','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','forceDownload','status','json','Unmanaged.','catch','authorization','startsWith','headers','Basic'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x33cd,0x154));var _0xd33c=function(_0x44c30a,_0x52262c){_0x44c30a=_0x44c30a-0x0;var _0x4ceb26=_0x33cd[_0x44c30a];return _0x4ceb26;};'use strict';var db=require(_0xd33c('0x0'))['db'];var config=require(_0xd33c('0x1'));var hardwareConf=require(_0xd33c('0x2'));var licenseUtil=require(_0xd33c('0x3'));var encryptor=require(_0xd33c('0x4'));var _=require(_0xd33c('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xd33c('0x6'));var compose=require('composable-middleware');var basicAuth=require(_0xd33c('0x7'));var crypto=require(_0xd33c('0x8'));var BPromise=require(_0xd33c('0x9'));var util=require('util');var moment=require(_0xd33c('0xa'));var validateJwt=expressJwt({'secret':config[_0xd33c('0xb')]['session']});var userAttributes=['id','role','fullname',_0xd33c('0xc'),_0xd33c('0xd'),_0xd33c('0xe'),_0xd33c('0xf'),'permissions',_0xd33c('0x10'),_0xd33c('0x11'),'chatPause',_0xd33c('0x12'),_0xd33c('0x13'),_0xd33c('0x14'),_0xd33c('0x15'),_0xd33c('0x16'),_0xd33c('0x17'),_0xd33c('0x18'),_0xd33c('0x19'),_0xd33c('0x1a'),_0xd33c('0x1b'),'passwordResetAt','alias',_0xd33c('0x1c'),_0xd33c('0x1d'),_0xd33c('0x1e'),_0xd33c('0x1f'),_0xd33c('0x20'),_0xd33c('0x21'),_0xd33c('0x22'),_0xd33c('0x23'),_0xd33c('0x24'),_0xd33c('0x25'),_0xd33c('0x26'),_0xd33c('0x27'),_0xd33c('0x28'),_0xd33c('0x29'),_0xd33c('0x2a'),'wssPort',_0xd33c('0x2b'),'downloadOmnichannelInteractions',_0xd33c('0x2c'),'ignorePauseForPreviewCalls','selectRecallMeCampaign',_0xd33c('0x2d'),'chatAutoanswerDelay',_0xd33c('0x2e'),_0xd33c('0x2f'),_0xd33c('0x30'),_0xd33c('0x31'),_0xd33c('0x32'),_0xd33c('0x33'),_0xd33c('0x34'),'faxAutoanswerDelay','whatsappAutoanswer',_0xd33c('0x35'),_0xd33c('0x36')];exports[_0xd33c('0x37')]=function(){return this[_0xd33c('0x38')](!![])[_0xd33c('0x39')](function(_0x8cc19c,_0xf317d5,_0x44b5c8){if(_0x8cc19c[_0xd33c('0x3a')]){_0x44b5c8();}else{return db[_0xd33c('0x3b')][_0xd33c('0x3c')]({'where':{'id':_0x8cc19c[_0xd33c('0x3d')]['id']},'attributes':['id',_0xd33c('0x3e'),_0xd33c('0x3f')],'raw':!![]})[_0xd33c('0x40')](function(_0x4d801d){if(_0x4d801d&&_0x4d801d['closed']&&!_0x8cc19c['query'][_0xd33c('0x41')]){return _0xf317d5[_0xd33c('0x42')](_0x4d801d['disposition']==='unmanaged'?0x195:0x193)[_0xd33c('0x43')]({'message':_0x4d801d[_0xd33c('0x3f')]==='unmanaged'?_0xd33c('0x44'):'Forbidden.'});}else{_0x44b5c8();}})[_0xd33c('0x45')](function(_0xe4f6d8){_0x44b5c8(_0xe4f6d8);});}});};exports[_0xd33c('0x38')]=function isAuthenticated(_0x26bc0e){return compose()[_0xd33c('0x39')](function(_0x1550c1,_0x48fdbc,_0x2e1226){var _0x50fda8;if(_0x1550c1['headers'][_0xd33c('0x46')]){if(_[_0xd33c('0x47')](_0x1550c1[_0xd33c('0x48')][_0xd33c('0x46')],_0xd33c('0x49'))){var _0x3f79c4=basicAuth(_0x1550c1);db[_0xd33c('0x4a')]['find']({'where':{'name':_0x3f79c4[_0xd33c('0xc')]}})[_0xd33c('0x40')](function(_0x39e0da){if(!_0x39e0da||!_0x39e0da[_0xd33c('0x4b')](_0x3f79c4[_0xd33c('0x4c')])){return _0x48fdbc[_0xd33c('0x42')](0x191)[_0xd33c('0x43')]({'message':_0xd33c('0x4d')});}_0x1550c1[_0xd33c('0x3a')]={'id':_0x39e0da['id']};_0x2e1226();})[_0xd33c('0x45')](function(_0x348dc4){_0x2e1226(_0x348dc4);});}else if(_[_0xd33c('0x47')](_0x1550c1[_0xd33c('0x48')]['authorization'],_0xd33c('0x4e'))){validateJwt(_0x1550c1,_0x48fdbc,_0x2e1226);}else{if(_0x26bc0e){_0x2e1226();}else{return _0x48fdbc['status'](0x193)[_0xd33c('0x43')]({'message':_0xd33c('0x4f')});}}}else if(_0x1550c1[_0xd33c('0x50')][_0xd33c('0x51')]){try{var _0x36ab35={'audience':hardwareConf[_0xd33c('0x52')](),'issuer':hardwareConf[_0xd33c('0x52')]()};verifyJwt(_0x1550c1['query'][_0xd33c('0x51')],_0x36ab35)[_0xd33c('0x40')](function(_0x4ecd99){return db[_0xd33c('0x4a')][_0xd33c('0x53')]({'where':{'id':_0x4ecd99['sub']}})['then'](function(_0x2fbbac){_0x50fda8=_0x2fbbac;return db[_0xd33c('0x54')][_0xd33c('0x3c')]({'where':{'id':0x1},'attributes':[_0xd33c('0x55'),'blockDuration'],'raw':!![]});})['then'](function(_0x5a16cc){if(!_0x50fda8||!_[_0xd33c('0x56')](_0x50fda8[_0xd33c('0x57')],_0x4ecd99[_0xd33c('0x58')])){return _0x48fdbc[_0xd33c('0x42')](0x191)[_0xd33c('0x43')]({'message':_0xd33c('0x59')});}if(_0x50fda8[_0xd33c('0x5a')]){return _0x48fdbc[_0xd33c('0x42')](0x191)[_0xd33c('0x43')]({'message':_0xd33c('0x5b')});}if(_0x50fda8[_0xd33c('0x5c')]){if(_0x5a16cc[_0xd33c('0x5d')]>0x0){if(moment(_0x50fda8['blockedAt'])['add'](_0x5a16cc[_0xd33c('0x5d')],_0xd33c('0x5e'))>moment()){return _0x48fdbc[_0xd33c('0x42')](0x191)['json']({'message':_0xd33c('0x5b')});}}else{return _0x48fdbc['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}_0x1550c1['user']={'id':_0x50fda8['id']};_0x2e1226();});})[_0xd33c('0x45')](function(){return _0x48fdbc[_0xd33c('0x42')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x3547e6){_0x2e1226(_0x3547e6);}}else if(_0x26bc0e){_0x2e1226();}else{return _0x48fdbc[_0xd33c('0x42')](0x193)[_0xd33c('0x43')]({'message':_0xd33c('0x4f')});}})[_0xd33c('0x39')](function(_0x4a63c0,_0x3dbfd4,_0x474eb7){if(_0x4a63c0[_0xd33c('0x3a')]){db[_0xd33c('0x4a')][_0xd33c('0x53')]({'where':{'id':_0x4a63c0[_0xd33c('0x3a')]['id']},'attributes':userAttributes})[_0xd33c('0x40')](function(_0x474943){if(!_0x474943){return _0x3dbfd4[_0xd33c('0x42')](0x194)['json']({'message':_0xd33c('0x5f')});}_0x4a63c0['user']=_0x474943;_0x474eb7();})[_0xd33c('0x45')](function(_0x44e499){_0x474eb7(_0x44e499);});}else if(_0x26bc0e){_0x474eb7();}else{return _0x3dbfd4[_0xd33c('0x42')](0x194)[_0xd33c('0x43')]({'message':_0xd33c('0x60')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xd33c('0x39')](function(_0x276ea1,_0x1c59be,_0x511a9a){return licenseUtil[_0xd33c('0x61')]()['then'](function(_0x3e72f5){if(_0x3e72f5[_0xd33c('0x62')]){_0x511a9a();}else{return _0x1c59be[_0xd33c('0x42')](0x193)['json']({'message':_0xd33c('0x63')});}})[_0xd33c('0x45')](function(_0x23f24a){_0x511a9a(_0x23f24a);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0xd33c('0x39')](function(_0x4233e1,_0x2501d1,_0x28fa98){return licenseUtil[_0xd33c('0x61')]()['then'](function(_0xdccfb7){if(_0xdccfb7[_0xd33c('0x64')]){_0x28fa98();}else{return _0x2501d1[_0xd33c('0x42')](0x193)[_0xd33c('0x43')]({'message':_0xd33c('0x63')});}})['catch'](function(_0x2c0616){_0x28fa98(_0x2c0616);});});};exports['isMiddleware']=function(_0x36195f,_0x41eb12,_0x2e292b){_0x36195f['isMiddleware']=!![];return _0x2e292b();};exports[_0xd33c('0x65')]=function signToken(_0x1416e2){return signJwt(_0x1416e2);};exports[_0xd33c('0x66')]=function(_0xb9926b,_0x50b631){if(!_0xb9926b[_0xd33c('0x3a')]){return _0x50b631[_0xd33c('0x42')](0x194)['json']({'message':_0xd33c('0x67')});}var _0x377fa4={'payload':{'id':_0xb9926b[_0xd33c('0x3a')]['id'],'role':_0xb9926b[_0xd33c('0x3a')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x377fa4)['then'](function(_0x319b44){_0x50b631[_0xd33c('0x68')](_0xd33c('0x69'),_0x319b44);_0x50b631['redirect']('/dashboards/general');})[_0xd33c('0x45')](function(_0x4eccc2){return _0x50b631[_0xd33c('0x42')](0x1f4)[_0xd33c('0x6a')](_0x4eccc2);});};exports[_0xd33c('0x6b')]=function(_0x309adf){if(_[_0xd33c('0x6c')](_0x309adf[_0xd33c('0x57')])||_[_0xd33c('0x6c')](_0x309adf[_0xd33c('0x6d')])){return null;}else{return createJwt(_0x309adf);}};exports['generateApiKey']=function(_0x25f8ce){_0x25f8ce[_0xd33c('0x57')]=generateNonce();_0x25f8ce[_0xd33c('0x6d')]=generateIssuedAt();return createJwt(_0x25f8ce);};exports[_0xd33c('0x6e')]=function(_0x26bc7b,_0x207661){var _0x47f079=_0x26bc7b[_0xd33c('0x50')][_0xd33c('0x51')];if(_0x47f079){var _0x1beda4={'nonce':_0x207661[_0xd33c('0x57')],'iat':_0x207661['apiKeyIat'],'audience':hardwareConf[_0xd33c('0x52')](),'issuer':hardwareConf[_0xd33c('0x52')]()};return verifyJwt(_0x47f079,_0x1beda4)[_0xd33c('0x40')](function(){return generateApiKey(_0x207661);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xd33c('0x6f')]=function(_0x682b47){var _0x53050b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x53050b[_0xd33c('0x70')](_0x682b47))throw new db['Sequelize'][(_0xd33c('0x71'))]('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[_0xd33c('0x72')]=function(_0x5caa4f,_0x6723a4,_0x55deb8){var _0x41ab43=encryptor['decryptString'](_0x6723a4)[_0xd33c('0x73')](',');for(var _0x2c2b61=0x0;_0x2c2b61<_0x55deb8;_0x2c2b61++){if(!_0x41ab43[_0x2c2b61])break;if(_0x5caa4f[_0xd33c('0x74')]()===_0x41ab43[_0x2c2b61][_0xd33c('0x74')]()){var _0x91bded=util[_0xd33c('0x75')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x55deb8);if(_0x55deb8===0x1){_0x91bded=_0xd33c('0x76');}throw new db[(_0xd33c('0x77'))]['ValidationError'](_0x91bded);}}return;};exports[_0xd33c('0x78')]=function(_0x123892,_0x403a4b){var _0x517c77=_0x403a4b?encryptor[_0xd33c('0x79')](_0x403a4b)[_0xd33c('0x73')](','):[];if(_0x517c77[_0xd33c('0x7a')]===0x5){_0x517c77[_0xd33c('0x7b')](-0x1,0x1);}_0x517c77[_0xd33c('0x7c')](_0x123892);return encryptor[_0xd33c('0x7d')](_0x517c77[_0xd33c('0x7e')](','));};function signJwt(_0x908432){var _0x6e539e=BPromise[_0xd33c('0x7f')](jwt[_0xd33c('0x80')],{'context':jwt});var _0x4aea1e=_0x908432[_0xd33c('0x81')]||config[_0xd33c('0xb')][_0xd33c('0x82')];return new BPromise(function(_0x2d8b26,_0x2f60af){_0x6e539e(_0x908432[_0xd33c('0x83')],_0x4aea1e,_0x908432[_0xd33c('0x84')])[_0xd33c('0x40')](function(_0x421ded){_0x2d8b26(_0x421ded);})['catch'](function(_0x5c5c3d){_0x2f60af(_0x5c5c3d);});});}function verifyJwt(_0x1c0f1e,_0x419ceb,_0x11e454){var _0x26b9b9=BPromise[_0xd33c('0x7f')](jwt[_0xd33c('0x85')],{'context':jwt});var _0x372f75=_0x11e454||config['secrets'][_0xd33c('0x82')];return new BPromise(function(_0x5a7b0f,_0x2a1257){_0x26b9b9(_0x1c0f1e,_0x372f75,_0x419ceb)[_0xd33c('0x40')](function(_0x2ee8ec){_0x5a7b0f(_0x2ee8ec);})[_0xd33c('0x45')](function(_0x2a4870){_0x2a1257(_0x2a4870);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xd33c('0x86')]('hex');}function generateIssuedAt(){return Math[_0xd33c('0x87')](Date[_0xd33c('0x88')]()/0x3e8)['toString']();}function createJwt(_0x23cafc){var _0x365d13={'payload':{'iat':_0x23cafc[_0xd33c('0x6d')],'nonce':_0x23cafc[_0xd33c('0x57')]},'options':{'algorithm':_0xd33c('0x89'),'subject':_0x23cafc['id'][_0xd33c('0x86')](),'issuer':hardwareConf[_0xd33c('0x52')](),'audience':hardwareConf[_0xd33c('0x52')]()}};return signJwt(_0x365d13)[_0xd33c('0x40')](function(_0x2cb8c9){return{'iat':_0x23cafc[_0xd33c('0x6d')],'nonce':_0x23cafc[_0xd33c('0x57')],'token':_0x2cb8c9};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 476cac5..df714c1 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 _0xf45d=['countFilteredContacts','count','buildContactsQuery','fields','getFilteredContacts','rows','catch','describe','CmContact','keys','cf_','map','CmCustomField','findOne','slice','all','fieldType','type','lodash','./sql-utils','findAll','skipContactsQuery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','clause','tags','user','skip','checkListsRestrictions','ids','tag'];(function(_0x3e130f,_0x309c01){var _0xf4d530=function(_0x355a96){while(--_0x355a96){_0x3e130f['push'](_0x3e130f['shift']());}};_0xf4d530(++_0x309c01);}(_0xf45d,0xc1));var _0xdf45=function(_0x36eda4,_0x433f22){_0x36eda4=_0x36eda4-0x0;var _0x54957d=_0xf45d[_0x36eda4];return _0x54957d;};'use strict';var _=require(_0xdf45('0x0'));var sqlUtils=require(_0xdf45('0x1'));var db=require('../../mysqldb')['db'];exports[_0xdf45('0x2')]=function(_0x297ad5,_0x1322bf,_0x115567,_0x10582c){var _0x43e1de={'count':0x0,'rows':[]};var _0x5c8d40=sqlUtils[_0xdf45('0x3')](_0x1322bf,_0x297ad5);if(_0x5c8d40){return Promise['resolve'](_0x43e1de);}var _0x2db96a=sqlUtils['getContactsSubquery']();var _0x109a76={};var _0x5d364c=![];var _0x32ceb5=![];return Promise[_0xdf45('0x4')]()[_0xdf45('0x5')](function(){if(_0x297ad5[_0xdf45('0x6')]){return sqlUtils[_0xdf45('0x7')](_0x297ad5[_0xdf45('0x6')],_0x10582c);}else{return sqlUtils[_0xdf45('0x8')](_0x297ad5,_0x10582c);}})['then'](function(_0x530e13){_0x2db96a[_0xdf45('0x9')](_0x530e13['default']);_0x2db96a['where'](_0x530e13['fields']);_0x2db96a['where'](_0x530e13['filter']);_0x2db96a[_0xdf45('0x9')](_0x530e13['user'][_0xdf45('0xa')]);_0x109a76=_0x530e13[_0xdf45('0xb')];_0x32ceb5=_0x530e13[_0xdf45('0xc')][_0xdf45('0xd')];return sqlUtils[_0xdf45('0xe')](_0x1322bf,_0x297ad5,_0x32ceb5);})[_0xdf45('0x5')](function(_0x34fcb7){_0x2db96a[_0xdf45('0x9')](_0x34fcb7);var _0x2ef9de=_0x297ad5[_0xdf45('0x6')]?_0x109a76[_0xdf45('0xf')]:_0x297ad5[_0xdf45('0x10')];_0x5d364c=_0x2ef9de?!![]:![];return sqlUtils[_0xdf45('0x11')](_0x2db96a,_0x2ef9de);})[_0xdf45('0x5')](function(_0x223721){_0x43e1de[_0xdf45('0x12')]=_0x223721;if(_0x43e1de[_0xdf45('0x12')]===0x0){return;}if(_0x297ad5['User']){_0x32ceb5=!![];}return sqlUtils[_0xdf45('0x13')](_0x2db96a,_0x297ad5[_0xdf45('0x14')],_0x115567,_0x5d364c,_0x109a76['clause'],_0x32ceb5);})['then'](function(_0x23116d){if(!_0x23116d){return[];}return sqlUtils[_0xdf45('0x15')](_0x23116d,_0x297ad5,_0x115567);})[_0xdf45('0x5')](function(_0x1c17a2){_0x43e1de[_0xdf45('0x16')]=_0x1c17a2;return _0x43e1de;})[_0xdf45('0x17')](function(_0x367c6d){throw _0x367c6d;});};exports[_0xdf45('0x18')]=function(){var _0x3ca5b6={};var _0x174466=[];return db[_0xdf45('0x19')]['describe']()[_0xdf45('0x5')](function(_0x3b6237){_0x3ca5b6=_0x3b6237;var _0x102da7=Object[_0xdf45('0x1a')](_0x3ca5b6)['filter'](function(_0x450bae){return _['startsWith'](_0x450bae,_0xdf45('0x1b'))?_0x450bae:undefined;});var _0x14c72d=_0x102da7[_0xdf45('0x1c')](function(_0x35de9f){return db[_0xdf45('0x1d')][_0xdf45('0x1e')]({'where':{'id':_0x35de9f[_0xdf45('0x1f')](0x3)},'raw':!![]});});return Promise[_0xdf45('0x20')](_0x14c72d);})['then'](function(_0x4dddaf){for(var _0x4c4076=0x0;_0x4c4076<_0x4dddaf['length'];_0x4c4076++){if(_0x4dddaf[_0x4c4076]){var _0x528dee=_0xdf45('0x1b')+_0x4dddaf[_0x4c4076]['id'];_0x3ca5b6[_0x528dee][_0xdf45('0x21')]=_0x4dddaf[_0x4c4076]['type'];}}_0x174466=_[_0xdf45('0x1c')](Object['keys'](_0x3ca5b6),function(_0x3cd39f){return{'name':_0x3cd39f,'type':_0x3ca5b6[_0x3cd39f][_0xdf45('0x22')]};});return _0x174466;})[_0xdf45('0x17')](function(_0x4b8fde){throw _0x4b8fde;});}; \ No newline at end of file +var _0xdabe=['parseQueryParameters','default','where','fields','filter','user','clause','tags','checkListsRestrictions','ids','tag','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','catch','describe','CmContact','keys','startsWith','cf_','findOne','length','map','type','./sql-utils','../../mysqldb','findAll','skipContactsQuery','getContactsSubquery','then','search','parseAdvancedSearchFilter'];(function(_0x83af7f,_0x49c6fd){var _0x32d85c=function(_0xf0e8bc){while(--_0xf0e8bc){_0x83af7f['push'](_0x83af7f['shift']());}};_0x32d85c(++_0x49c6fd);}(_0xdabe,0x80));var _0xedab=function(_0x3a07e8,_0x553b0a){_0x3a07e8=_0x3a07e8-0x0;var _0x40b1ac=_0xdabe[_0x3a07e8];return _0x40b1ac;};'use strict';var _=require('lodash');var sqlUtils=require(_0xedab('0x0'));var db=require(_0xedab('0x1'))['db'];exports[_0xedab('0x2')]=function(_0x51c234,_0x145049,_0x4327e7,_0x546fda){var _0x27131e={'count':0x0,'rows':[]};var _0x1337ac=sqlUtils[_0xedab('0x3')](_0x145049,_0x51c234);if(_0x1337ac){return Promise['resolve'](_0x27131e);}var _0x3d199a=sqlUtils[_0xedab('0x4')]();var _0x1fe5fd={};var _0x1f960f=![];var _0x20d768=![];return Promise['resolve']()[_0xedab('0x5')](function(){if(_0x51c234[_0xedab('0x6')]){return sqlUtils[_0xedab('0x7')](_0x51c234[_0xedab('0x6')],_0x546fda);}else{return sqlUtils[_0xedab('0x8')](_0x51c234,_0x546fda);}})[_0xedab('0x5')](function(_0x55ba74){_0x3d199a['where'](_0x55ba74[_0xedab('0x9')]);_0x3d199a[_0xedab('0xa')](_0x55ba74[_0xedab('0xb')]);_0x3d199a[_0xedab('0xa')](_0x55ba74[_0xedab('0xc')]);_0x3d199a['where'](_0x55ba74[_0xedab('0xd')][_0xedab('0xe')]);_0x1fe5fd=_0x55ba74[_0xedab('0xf')];_0x20d768=_0x55ba74[_0xedab('0xd')]['skip'];return sqlUtils[_0xedab('0x10')](_0x145049,_0x51c234,_0x20d768);})[_0xedab('0x5')](function(_0x27c068){_0x3d199a[_0xedab('0xa')](_0x27c068);var _0x3a07bc=_0x51c234[_0xedab('0x6')]?_0x1fe5fd[_0xedab('0x11')]:_0x51c234[_0xedab('0x12')];_0x1f960f=_0x3a07bc?!![]:![];return sqlUtils[_0xedab('0x13')](_0x3d199a,_0x3a07bc);})[_0xedab('0x5')](function(_0x467fc2){_0x27131e['count']=_0x467fc2;if(_0x27131e[_0xedab('0x14')]===0x0){return;}if(_0x51c234[_0xedab('0x15')]){_0x20d768=!![];}return sqlUtils[_0xedab('0x16')](_0x3d199a,_0x51c234['fields'],_0x4327e7,_0x1f960f,_0x1fe5fd[_0xedab('0xe')],_0x20d768);})[_0xedab('0x5')](function(_0x21c92d){if(!_0x21c92d){return[];}return sqlUtils[_0xedab('0x17')](_0x21c92d,_0x51c234,_0x4327e7);})[_0xedab('0x5')](function(_0x4d7ab9){_0x27131e['rows']=_0x4d7ab9;return _0x27131e;})[_0xedab('0x18')](function(_0x2dc0e9){throw _0x2dc0e9;});};exports[_0xedab('0x19')]=function(){var _0xb5b99a={};var _0x28138c=[];return db[_0xedab('0x1a')][_0xedab('0x19')]()[_0xedab('0x5')](function(_0x37578a){_0xb5b99a=_0x37578a;var _0x44df97=Object[_0xedab('0x1b')](_0xb5b99a)['filter'](function(_0x38c629){return _[_0xedab('0x1c')](_0x38c629,_0xedab('0x1d'))?_0x38c629:undefined;});var _0x521e86=_0x44df97['map'](function(_0x5aed0c){return db['CmCustomField'][_0xedab('0x1e')]({'where':{'id':_0x5aed0c['slice'](0x3)},'raw':!![]});});return Promise['all'](_0x521e86);})['then'](function(_0x3c4eb0){for(var _0xc2f7f2=0x0;_0xc2f7f2<_0x3c4eb0[_0xedab('0x1f')];_0xc2f7f2++){if(_0x3c4eb0[_0xc2f7f2]){var _0x1f92d6=_0xedab('0x1d')+_0x3c4eb0[_0xc2f7f2]['id'];_0xb5b99a[_0x1f92d6]['fieldType']=_0x3c4eb0[_0xc2f7f2]['type'];}}_0x28138c=_[_0xedab('0x20')](Object['keys'](_0xb5b99a),function(_0x1c51fd){return{'name':_0x1c51fd,'type':_0xb5b99a[_0x1c51fd][_0xedab('0x21')]};});return _0x28138c;})['catch'](function(_0x53a513){throw _0x53a513;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 7537ce9..7784185 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 _0x2436=['fields','tag','filter','resolve','getLists','c.ListId\x20IS\x20NULL','attributes','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','toString','Tags','clone','COUNT(*)','group','query','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','role','agent','search','autocomplete','select','from','where','subqry','left_join','uc.CmContactId\x20=\x20','.id','tools_tags','firstName','lastName','mobile','fax','email','ListId','createdAt','updatedAt','deletedAt','TagIds','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','default','text','value','start','end','Tag','tags','clause','and','ids','user','uc.UserId\x20=\x20?','skip','keys','map','compact','Contact','push','User','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x2436,0xf8));var _0x6243=function(_0x33e48b,_0x144a21){_0x33e48b=_0x33e48b-0x0;var _0x13d521=_0x2436[_0x33e48b];return _0x13d521;};'use strict';var _=require(_0x6243('0x0'));var squel=require(_0x6243('0x1'));var as=require(_0x6243('0x2'));var qs=require(_0x6243('0x3'));var utils=require('../interaction/utils');var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x594935,_0x306963){var _0x3be2df=![];if(_0x594935[_0x6243('0x4')]===_0x6243('0x5')&&!_0x306963[_0x6243('0x6')]&&!_0x306963['ListId']&&_0x306963[_0x6243('0x7')]!=='true'){_0x3be2df=!![];}return _0x3be2df;}function getContactsSubquery(){return squel[_0x6243('0x8')]()[_0x6243('0x9')]('cm_contacts','c')[_0x6243('0xa')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x33b2b5,_0xacfda4){var _0x2d239d=_0xacfda4?'c':_0x6243('0xb');_0x33b2b5[_0x6243('0xc')]('cm_user_has_contacts','uc',_0x6243('0xd')+_0x2d239d+'.id')[_0x6243('0xc')]('cm_contact_has_tags','ct','ct.CmContactId\x20=\x20'+_0x2d239d+_0x6243('0xe'))[_0x6243('0xc')](_0x6243('0xf'),'t','t.id\x20=\x20ct.TagId');return _0x33b2b5;}function addFieldsToQuery(_0x20ed81,_0x385337,_0x1136c2,_0x1d61dd,_0x16caa0){var _0x5adac9=_0x16caa0?'c':_0x6243('0xb');if(!_0x385337){_0x385337=['id',_0x6243('0x10'),_0x6243('0x11'),'phone',_0x6243('0x12'),_0x6243('0x13'),_0x6243('0x14'),_0x6243('0x15'),'CompanyId',_0x6243('0x16'),_0x6243('0x17'),_0x6243('0x18'),_0x6243('0x19')];}else if(!_0x385337['includes']('id')){_0x385337['push']('id');}var _0x59f4a3=_0x1136c2&&_0x16caa0||!_0x1136c2&&!_0x16caa0;if(_0x1d61dd){_0x59f4a3=_0x1d61dd&&_0x16caa0||!_0x1d61dd&&!_0x16caa0;}_0x385337[_0x6243('0x1a')](function(_0x5a2ff7){if(_0x5a2ff7===_0x6243('0x19')){if(_0x59f4a3){_0x20ed81[_0x6243('0x1b')](_0x6243('0x1c'),_0x5a2ff7);}else if(_0x1136c2||_0x1d61dd){_0x20ed81[_0x6243('0x1b')](_0x5adac9+'.'+_0x5a2ff7);}}else{_0x20ed81[_0x6243('0x1b')](_0x5adac9+'.'+_0x5a2ff7);}});return _0x20ed81;}function getSqlClauses(){var _0x50442a={'default':squel[_0x6243('0x1d')](),'fields':squel[_0x6243('0x1d')](),'filter':squel[_0x6243('0x1d')](),'tags':{'clause':squel[_0x6243('0x1d')](),'ids':null},'user':{'clause':squel[_0x6243('0x1d')](),'skip':![]}};return _0x50442a;}function parseTagParameter(_0xc869e7){var _0x5536ea=squel[_0x6243('0x1d')]();if(_0xc869e7){var _0x1e95a9=utils[_0x6243('0x1e')](_0xc869e7);_0x1e95a9[_0x6243('0x1a')](function(_0x433442){_0x5536ea['or'](_0x6243('0x1f'),'%,'+_0x433442+',%');});}return _0x5536ea;}function parseSearchFilter(_0x5d73f1){var _0x129d9e=squel[_0x6243('0x1d')]();if(_0x5d73f1){var _0x16946c=_0x5d73f1[_0x6243('0x20')]('\x5c','\x5c\x5c')[_0x6243('0x20')](/'/g,'\x27\x27');if(_0x16946c[_0x6243('0x21')]('\x20')[_0x6243('0x22')]>0x1){_0x129d9e['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6243('0x23')](_0x16946c,!![]),null);}else{if(qs[_0x6243('0x24')](_0x16946c)){_0x129d9e['or'](_0x6243('0x25'),_0x16946c+'%');_0x129d9e['or'](_0x6243('0x26'),_0x16946c+'%');_0x129d9e['or'](_0x6243('0x27'),_0x16946c+'%');_0x129d9e['or'](_0x6243('0x28'),_0x16946c+'%');}else if(qs[_0x6243('0x29')](_0x16946c)){_0x129d9e['or'](_0x6243('0x2a'),_0x16946c+'%');}else{_0x129d9e['or'](_0x6243('0x2b'),'%'+_0x16946c+'%');_0x129d9e['or']('c.lastName\x20LIKE\x20?','%'+_0x16946c+'%');_0x129d9e['or'](_0x6243('0x2a'),'%'+_0x16946c+'%');}}}return _0x129d9e;}function parseAdvancedSearchFilter(_0x22ab7e,_0x778f19){var _0x363865=getSqlClauses();var _0x3d8ea5=as[_0x6243('0x2c')](_0x22ab7e);var _0x38e13c=_0x3d8ea5[_0x6243('0x2d')];for(var _0x149783=0x0;_0x149783<_0x3d8ea5[_0x6243('0x2e')]['length'];_0x149783++){var _0x4deabf=_0x3d8ea5[_0x6243('0x2e')][_0x149783];var _0x279d9a='c';var _0x464647=_['find'](_0x778f19,[_0x6243('0x2f'),_0x4deabf[_0x6243('0x1b')]]);if(_0x464647){if(_0x4deabf[_0x6243('0x1b')]===_0x6243('0x30')||_0x464647[_0x6243('0x31')]===_0x6243('0x32')){_0x4deabf[_0x6243('0x33')]=_0x6243('0x34');}var _0x5a46b5=as[_0x6243('0x35')](_0x279d9a,_0x464647[_0x6243('0x36')],_0x4deabf);_0x363865[_0x6243('0x37')][_0x38e13c](_0x5a46b5[_0x6243('0x38')],_0x5a46b5[_0x6243('0x39')][_0x6243('0x3a')],_0x5a46b5[_0x6243('0x39')][_0x6243('0x3b')]);}else{if(_0x4deabf[_0x6243('0x1b')]===_0x6243('0x3c')){var _0x4981cb=_0x4deabf[_0x6243('0x39')][_0x6243('0x21')](',')['map'](function(_0x659959){return Number(_0x659959);});var _0x401645=parseTagParameter(_0x4981cb);_0x363865[_0x6243('0x3d')][_0x6243('0x3e')][_0x6243('0x3f')](_0x401645);_0x363865[_0x6243('0x3d')][_0x6243('0x40')]=_0x4981cb;}else if(_0x4deabf[_0x6243('0x1b')]==='User'){_0x363865[_0x6243('0x41')][_0x6243('0x3e')][_0x6243('0x3f')](_0x6243('0x42'),_0x4deabf[_0x6243('0x39')]);_0x363865[_0x6243('0x41')][_0x6243('0x43')]=!![];}}}return _0x363865;}function parseModelFields(_0x42d290,_0x34b938){var _0x44c23b=squel[_0x6243('0x1d')]();var _0x17d810=_(_0x42d290)[_0x6243('0x44')]()[_0x6243('0x45')](function(_0x4a9ef7){return _['some'](_0x34b938,['name',_0x4a9ef7])?_0x4a9ef7:undefined;})[_0x6243('0x46')]()[_0x6243('0x39')]();if(_0x42d290[_0x6243('0x47')]){_0x17d810[_0x6243('0x48')](_0x6243('0x47'));}if(_0x42d290[_0x6243('0x49')]){_0x17d810[_0x6243('0x48')](_0x6243('0x49'));}if(_0x17d810['length']>0x0){_0x17d810['forEach'](function(_0x206879){if(_0x206879===_0x6243('0x15')){_0x44c23b[_0x6243('0x3f')](_0x6243('0x4a'),[][_0x6243('0x4b')](_0x42d290[_0x206879]));}else if(_0x206879===_0x6243('0x47')){var _0xa1f479='%'+_0x42d290[_0x206879]+'%';_0x44c23b[_0x6243('0x3f')](_0x6243('0x4c'),_0xa1f479);}else if(_0x206879===_0x6243('0x49')){_0x44c23b[_0x6243('0x3f')](_0x6243('0x42'),_0x42d290[_0x206879]);}else{_0x44c23b['and']('c.'+_0x206879+_0x6243('0x4d'),_0x42d290[_0x206879]);}});}return _0x44c23b;}function parseQueryParameters(_0x2da9b1,_0x291c7f){var _0x1fffb5=getSqlClauses();return Promise['resolve']()[_0x6243('0x4e')](function(){return parseModelFields(_0x2da9b1,_0x291c7f);})[_0x6243('0x4e')](function(_0x5a361f){_0x1fffb5[_0x6243('0x4f')][_0x6243('0x3f')](_0x5a361f);return parseTagParameter(_0x2da9b1[_0x6243('0x50')]);})[_0x6243('0x4e')](function(_0x4c3453){_0x1fffb5[_0x6243('0x3d')][_0x6243('0x3e')][_0x6243('0x3f')](_0x4c3453);return parseSearchFilter(_0x2da9b1['filter']);})[_0x6243('0x4e')](function(_0xfba001){_0x1fffb5[_0x6243('0x51')]=_0xfba001;return _0x1fffb5;});}function checkListsRestrictions(_0x5d40dc,_0x433666,_0x540788){var _0xfc5699=squel[_0x6243('0x1d')]();return Promise[_0x6243('0x52')]()[_0x6243('0x4e')](function(){if(_0x433666[_0x6243('0x6')]&&_0x5d40dc[_0x6243('0x4')]===_0x6243('0x5')&&!_0x540788){return _0x5d40dc[_0x6243('0x53')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x605b62){if(_0x605b62){if(_0x605b62[_0x6243('0x22')]===0x0){_0xfc5699[_0x6243('0x3f')](_0x6243('0x54'));}else{_0xfc5699[_0x6243('0x3f')](_0x6243('0x4a'),_['map'](_0x605b62,'id'));}}})['then'](function(){return _0xfc5699;});}function buildContactsQuery(_0x45b33f,_0x263f0f,_0x3a3ca5,_0x18b585,_0x4cf10c,_0x3a1ed5){if(_0x263f0f){_0x263f0f=_0x3a3ca5[_0x6243('0x55')];}_0x45b33f=addFieldsToQuery(_0x45b33f,_0x263f0f,_0x18b585,_0x3a1ed5,!![]);var _0x5db031=squel['select']();_0x5db031=addFieldsToQuery(_0x5db031,_0x263f0f,_0x18b585,_0x3a1ed5,![]);if(_0x18b585||_0x3a1ed5){_0x45b33f=applyJoinClauses(_0x45b33f,!![]);_0x45b33f['group'](_0x6243('0x56'));if(_0x3a3ca5[_0x6243('0x57')]){_0x5db031[_0x6243('0x57')](_0x3a3ca5[_0x6243('0x57')]);}if(_0x3a3ca5[_0x6243('0x58')]){_0x5db031[_0x6243('0x58')](_0x3a3ca5[_0x6243('0x58')]);}}else{_0x5db031=applyJoinClauses(_0x5db031,![]);_0x5db031['group'](_0x6243('0x59'));if(_0x3a3ca5[_0x6243('0x57')]){_0x45b33f[_0x6243('0x57')](_0x3a3ca5['limit']);}if(_0x3a3ca5[_0x6243('0x58')]){_0x45b33f[_0x6243('0x58')](_0x3a3ca5['offset']);}}_0x5db031[_0x6243('0x5a')](_0x4cf10c);if(_0x3a3ca5[_0x6243('0x5b')]){_0x3a3ca5[_0x6243('0x5b')][_0x6243('0x1a')](function(_0x2684b2){_0x45b33f[_0x6243('0x5b')]('c.'+_0x2684b2[0x0],_0x2684b2[0x1]===_0x6243('0x5c')?![]:!![]);_0x5db031[_0x6243('0x5b')](_0x6243('0x5d')+_0x2684b2[0x0],_0x2684b2[0x1]===_0x6243('0x5c')?![]:!![]);});}_0x5db031[_0x6243('0x9')](_0x45b33f,_0x6243('0xb'));return _0x5db031;}function getFilteredContacts(_0x272cfc){var _0x4b8a56=[];return db[_0x6243('0x3c')][_0x6243('0x5e')]({'attributes':['id','name',_0x6243('0x5f')],'raw':!![]})[_0x6243('0x4e')](function(_0x4ea2db){_0x4b8a56=_[_0x6243('0x60')](_0x4ea2db,'id');var _0x47540e={'type':db[_0x6243('0x61')][_0x6243('0x62')][_0x6243('0x63')],'model':db[_0x6243('0x64')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x6243('0x65')]['query'](_0x272cfc[_0x6243('0x66')](),_0x47540e);})[_0x6243('0x4e')](function(_0x5de520){_0x5de520[_0x6243('0x1a')](function(_0x11a78e){if(_0x11a78e[_0x6243('0x19')]){_0x11a78e[_0x6243('0x67')]=[];_0x11a78e['TagIds'][_0x6243('0x21')](',')[_0x6243('0x1a')](function(_0xffc3f6){_0x11a78e[_0x6243('0x67')]['push'](_0x4b8a56[_0xffc3f6]);});}delete _0x11a78e[_0x6243('0x19')];});return _0x5de520;});}function countFilteredContacts(_0x85f4ba,_0x13a169){var _0x7a62d8=_0x85f4ba[_0x6243('0x68')]();_0x7a62d8['field'](_0x6243('0x69'));_0x7a62d8=applyJoinClauses(_0x7a62d8,!![]);_0x85f4ba[_0x6243('0x6a')](_0x6243('0x56'));var _0x472789=utils['getSelectedTags'](_0x13a169);if(!_['isEmpty'](_0x472789)){_0x7a62d8[_0x6243('0xa')]('t.id\x20IN\x20?',_0x472789);}var _0x545d30={'type':db[_0x6243('0x61')][_0x6243('0x62')]['SELECT'],'raw':!![]};return db[_0x6243('0x65')][_0x6243('0x6b')](_0x7a62d8[_0x6243('0x66')](),_0x545d30)[_0x6243('0x4e')](function(_0x578284){return _0x578284[0x0][_0x6243('0x69')];});}module[_0x6243('0x6c')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x97d3=['CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','name','fieldType','datetime','castTo','buildExpression','type','default','text','value','start','Tag','map','tags','clause','ids','User','user','and','uc.UserId\x20=\x20?','skip','keys','some','Contact','push','concat','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','having','order','DESC','subqry.','findAll','color','keyBy','QueryTypes','SELECT','sequelize','query','Tags','clone','COUNT(*)','where','t.id\x20IN\x20?','Sequelize','toString','exports','lodash','../parsers/advancedSearch','../parsers/qs','../interaction/utils','role','agent','search','ListId','autocomplete','select','from','cm_contacts','subqry','left_join','.id','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','email','createdAt','updatedAt','deletedAt','TagIds','forEach','field','expr','getSelectedTags'];(function(_0x3df042,_0x4ce182){var _0xe0ef6d=function(_0x5bbfed){while(--_0x5bbfed){_0x3df042['push'](_0x3df042['shift']());}};_0xe0ef6d(++_0x4ce182);}(_0x97d3,0x115));var _0x397d=function(_0x2cc711,_0x300328){_0x2cc711=_0x2cc711-0x0;var _0x31a52e=_0x97d3[_0x2cc711];return _0x31a52e;};'use strict';var _=require(_0x397d('0x0'));var squel=require('squel');var as=require(_0x397d('0x1'));var qs=require(_0x397d('0x2'));var utils=require(_0x397d('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x17f957,_0x1be2ae){var _0x3880ae=![];if(_0x17f957[_0x397d('0x4')]===_0x397d('0x5')&&!_0x1be2ae[_0x397d('0x6')]&&!_0x1be2ae[_0x397d('0x7')]&&_0x1be2ae[_0x397d('0x8')]!=='true'){_0x3880ae=!![];}return _0x3880ae;}function getContactsSubquery(){return squel[_0x397d('0x9')]()[_0x397d('0xa')](_0x397d('0xb'),'c')['where']('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0xbf8fe4,_0x2a79a4){var _0x387ef1=_0x2a79a4?'c':_0x397d('0xc');_0xbf8fe4[_0x397d('0xd')]('cm_user_has_contacts','uc','uc.CmContactId\x20=\x20'+_0x387ef1+_0x397d('0xe'))[_0x397d('0xd')](_0x397d('0xf'),'ct','ct.CmContactId\x20=\x20'+_0x387ef1+_0x397d('0xe'))['left_join'](_0x397d('0x10'),'t',_0x397d('0x11'));return _0xbf8fe4;}function addFieldsToQuery(_0x317795,_0x8df1fe,_0x21534c,_0x3503f7,_0x2bae7b){var _0x29da42=_0x2bae7b?'c':_0x397d('0xc');if(!_0x8df1fe){_0x8df1fe=['id',_0x397d('0x12'),_0x397d('0x13'),_0x397d('0x14'),_0x397d('0x15'),_0x397d('0x16'),_0x397d('0x17'),_0x397d('0x7'),'CompanyId',_0x397d('0x18'),_0x397d('0x19'),_0x397d('0x1a'),_0x397d('0x1b')];}else if(!_0x8df1fe['includes']('id')){_0x8df1fe['push']('id');}var _0x22853d=_0x21534c&&_0x2bae7b||!_0x21534c&&!_0x2bae7b;if(_0x3503f7){_0x22853d=_0x3503f7&&_0x2bae7b||!_0x3503f7&&!_0x2bae7b;}_0x8df1fe[_0x397d('0x1c')](function(_0x44f08f){if(_0x44f08f===_0x397d('0x1b')){if(_0x22853d){_0x317795['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x44f08f);}else if(_0x21534c||_0x3503f7){_0x317795['field'](_0x29da42+'.'+_0x44f08f);}}else{_0x317795[_0x397d('0x1d')](_0x29da42+'.'+_0x44f08f);}});return _0x317795;}function getSqlClauses(){var _0x40d96e={'default':squel[_0x397d('0x1e')](),'fields':squel['expr'](),'filter':squel[_0x397d('0x1e')](),'tags':{'clause':squel[_0x397d('0x1e')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x40d96e;}function parseTagParameter(_0x274b58){var _0x56e28b=squel[_0x397d('0x1e')]();if(_0x274b58){var _0x3d3593=utils[_0x397d('0x1f')](_0x274b58);_0x3d3593[_0x397d('0x1c')](function(_0x4fc4ef){_0x56e28b['or'](_0x397d('0x20'),'%,'+_0x4fc4ef+',%');});}return _0x56e28b;}function parseSearchFilter(_0x13c0a4){var _0x2c7b34=squel[_0x397d('0x1e')]();if(_0x13c0a4){var _0x133bf2=_0x13c0a4['replace']('\x5c','\x5c\x5c')[_0x397d('0x21')](/'/g,'\x27\x27');if(_0x133bf2[_0x397d('0x22')]('\x20')[_0x397d('0x23')]>0x1){_0x2c7b34['or'](_0x397d('0x24'),qs['getFullTextValue'](_0x133bf2,!![]),null);}else{if(qs[_0x397d('0x25')](_0x133bf2)){_0x2c7b34['or']('c.id\x20LIKE\x20?',_0x133bf2+'%');_0x2c7b34['or']('c.phone\x20LIKE\x20?',_0x133bf2+'%');_0x2c7b34['or'](_0x397d('0x26'),_0x133bf2+'%');_0x2c7b34['or'](_0x397d('0x27'),_0x133bf2+'%');}else if(qs[_0x397d('0x28')](_0x133bf2)){_0x2c7b34['or'](_0x397d('0x29'),_0x133bf2+'%');}else{_0x2c7b34['or']('c.firstName\x20LIKE\x20?','%'+_0x133bf2+'%');_0x2c7b34['or'](_0x397d('0x2a'),'%'+_0x133bf2+'%');_0x2c7b34['or'](_0x397d('0x29'),'%'+_0x133bf2+'%');}}}return _0x2c7b34;}function parseAdvancedSearchFilter(_0x37b42c,_0x11c7b2){var _0x4d9216=getSqlClauses();var _0x1711f2=as[_0x397d('0x2b')](_0x37b42c);var _0x4889e2=_0x1711f2[_0x397d('0x2c')];for(var _0x158299=0x0;_0x158299<_0x1711f2['conditions'][_0x397d('0x23')];_0x158299++){var _0x5524d8=_0x1711f2[_0x397d('0x2d')][_0x158299];var _0x3f87a7='c';var _0x3a3690=_['find'](_0x11c7b2,[_0x397d('0x2e'),_0x5524d8[_0x397d('0x1d')]]);if(_0x3a3690){if(_0x5524d8[_0x397d('0x1d')]==='dateOfBirth'||_0x3a3690[_0x397d('0x2f')]===_0x397d('0x30')){_0x5524d8[_0x397d('0x31')]='DATE';}var _0x1805e4=as[_0x397d('0x32')](_0x3f87a7,_0x3a3690[_0x397d('0x33')],_0x5524d8);_0x4d9216[_0x397d('0x34')][_0x4889e2](_0x1805e4[_0x397d('0x35')],_0x1805e4[_0x397d('0x36')][_0x397d('0x37')],_0x1805e4[_0x397d('0x36')]['end']);}else{if(_0x5524d8[_0x397d('0x1d')]===_0x397d('0x38')){var _0x594acd=_0x5524d8[_0x397d('0x36')][_0x397d('0x22')](',')[_0x397d('0x39')](function(_0x4e5165){return Number(_0x4e5165);});var _0x29b364=parseTagParameter(_0x594acd);_0x4d9216[_0x397d('0x3a')][_0x397d('0x3b')]['and'](_0x29b364);_0x4d9216[_0x397d('0x3a')][_0x397d('0x3c')]=_0x594acd;}else if(_0x5524d8['field']===_0x397d('0x3d')){_0x4d9216[_0x397d('0x3e')][_0x397d('0x3b')][_0x397d('0x3f')](_0x397d('0x40'),_0x5524d8[_0x397d('0x36')]);_0x4d9216[_0x397d('0x3e')][_0x397d('0x41')]=!![];}}}return _0x4d9216;}function parseModelFields(_0xd35dee,_0x491fb6){var _0x48524e=squel[_0x397d('0x1e')]();var _0x37ad56=_(_0xd35dee)[_0x397d('0x42')]()[_0x397d('0x39')](function(_0x523845){return _[_0x397d('0x43')](_0x491fb6,['name',_0x523845])?_0x523845:undefined;})['compact']()[_0x397d('0x36')]();if(_0xd35dee[_0x397d('0x44')]){_0x37ad56[_0x397d('0x45')](_0x397d('0x44'));}if(_0xd35dee['User']){_0x37ad56[_0x397d('0x45')](_0x397d('0x3d'));}if(_0x37ad56[_0x397d('0x23')]>0x0){_0x37ad56[_0x397d('0x1c')](function(_0x3ce43b){if(_0x3ce43b===_0x397d('0x7')){_0x48524e[_0x397d('0x3f')]('c.ListId\x20IN\x20?',[][_0x397d('0x46')](_0xd35dee[_0x3ce43b]));}else if(_0x3ce43b===_0x397d('0x44')){var _0x3c55a5='%'+_0xd35dee[_0x3ce43b]+'%';_0x48524e[_0x397d('0x3f')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x3c55a5);}else if(_0x3ce43b===_0x397d('0x3d')){_0x48524e[_0x397d('0x3f')]('uc.UserId\x20=\x20?',_0xd35dee[_0x3ce43b]);}else{_0x48524e['and']('c.'+_0x3ce43b+_0x397d('0x47'),_0xd35dee[_0x3ce43b]);}});}return _0x48524e;}function parseQueryParameters(_0x4b8c37,_0xfc808){var _0x356fae=getSqlClauses();return Promise[_0x397d('0x48')]()[_0x397d('0x49')](function(){return parseModelFields(_0x4b8c37,_0xfc808);})[_0x397d('0x49')](function(_0x4f6304){_0x356fae[_0x397d('0x4a')][_0x397d('0x3f')](_0x4f6304);return parseTagParameter(_0x4b8c37[_0x397d('0x4b')]);})[_0x397d('0x49')](function(_0x1883d0){_0x356fae[_0x397d('0x3a')][_0x397d('0x3b')][_0x397d('0x3f')](_0x1883d0);return parseSearchFilter(_0x4b8c37['filter']);})[_0x397d('0x49')](function(_0x350728){_0x356fae[_0x397d('0x4c')]=_0x350728;return _0x356fae;});}function checkListsRestrictions(_0x175216,_0x49cd6a,_0x3d127d){var _0x35010c=squel['expr']();return Promise['resolve']()['then'](function(){if(_0x49cd6a['search']&&_0x175216[_0x397d('0x4')]===_0x397d('0x5')&&!_0x3d127d){return _0x175216[_0x397d('0x4d')]({'attributes':['id'],'raw':!![]});}})[_0x397d('0x49')](function(_0x4ba891){if(_0x4ba891){if(_0x4ba891[_0x397d('0x23')]===0x0){_0x35010c[_0x397d('0x3f')](_0x397d('0x4e'));}else{_0x35010c['and']('c.ListId\x20IN\x20?',_[_0x397d('0x39')](_0x4ba891,'id'));}}})['then'](function(){return _0x35010c;});}function buildContactsQuery(_0x479eb4,_0x16b84a,_0x35f032,_0x49ad33,_0x266709,_0x1154d6){if(_0x16b84a){_0x16b84a=_0x35f032[_0x397d('0x4f')];}_0x479eb4=addFieldsToQuery(_0x479eb4,_0x16b84a,_0x49ad33,_0x1154d6,!![]);var _0x5a3cef=squel[_0x397d('0x9')]();_0x5a3cef=addFieldsToQuery(_0x5a3cef,_0x16b84a,_0x49ad33,_0x1154d6,![]);if(_0x49ad33||_0x1154d6){_0x479eb4=applyJoinClauses(_0x479eb4,!![]);_0x479eb4[_0x397d('0x50')](_0x397d('0x51'));if(_0x35f032[_0x397d('0x52')]){_0x5a3cef[_0x397d('0x52')](_0x35f032[_0x397d('0x52')]);}if(_0x35f032[_0x397d('0x53')]){_0x5a3cef[_0x397d('0x53')](_0x35f032['offset']);}}else{_0x5a3cef=applyJoinClauses(_0x5a3cef,![]);_0x5a3cef['group']('subqry.id');if(_0x35f032[_0x397d('0x52')]){_0x479eb4['limit'](_0x35f032[_0x397d('0x52')]);}if(_0x35f032[_0x397d('0x53')]){_0x479eb4[_0x397d('0x53')](_0x35f032[_0x397d('0x53')]);}}_0x5a3cef[_0x397d('0x54')](_0x266709);if(_0x35f032[_0x397d('0x55')]){_0x35f032[_0x397d('0x55')][_0x397d('0x1c')](function(_0x3cac76){_0x479eb4['order']('c.'+_0x3cac76[0x0],_0x3cac76[0x1]===_0x397d('0x56')?![]:!![]);_0x5a3cef[_0x397d('0x55')](_0x397d('0x57')+_0x3cac76[0x0],_0x3cac76[0x1]===_0x397d('0x56')?![]:!![]);});}_0x5a3cef['from'](_0x479eb4,'subqry');return _0x5a3cef;}function getFilteredContacts(_0x22908b){var _0x4157de=[];return db['Tag'][_0x397d('0x58')]({'attributes':['id','name',_0x397d('0x59')],'raw':!![]})[_0x397d('0x49')](function(_0x2118e3){_0x4157de=_[_0x397d('0x5a')](_0x2118e3,'id');var _0x59b423={'type':db['Sequelize'][_0x397d('0x5b')][_0x397d('0x5c')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x397d('0x5d')][_0x397d('0x5e')](_0x22908b['toString'](),_0x59b423);})['then'](function(_0xf15111){_0xf15111[_0x397d('0x1c')](function(_0xd3cb7f){if(_0xd3cb7f[_0x397d('0x1b')]){_0xd3cb7f['Tags']=[];_0xd3cb7f[_0x397d('0x1b')][_0x397d('0x22')](',')[_0x397d('0x1c')](function(_0x24099e){_0xd3cb7f[_0x397d('0x5f')]['push'](_0x4157de[_0x24099e]);});}delete _0xd3cb7f[_0x397d('0x1b')];});return _0xf15111;});}function countFilteredContacts(_0x5a7e55,_0x941663){var _0x54b033=_0x5a7e55[_0x397d('0x60')]();_0x54b033[_0x397d('0x1d')](_0x397d('0x61'));_0x54b033=applyJoinClauses(_0x54b033,!![]);_0x5a7e55[_0x397d('0x50')](_0x397d('0x51'));var _0x34587a=utils['getSelectedTags'](_0x941663);if(!_['isEmpty'](_0x34587a)){_0x54b033[_0x397d('0x62')](_0x397d('0x63'),_0x34587a);}var _0x214da9={'type':db[_0x397d('0x64')][_0x397d('0x5b')][_0x397d('0x5c')],'raw':!![]};return db['sequelize'][_0x397d('0x5e')](_0x54b033[_0x397d('0x65')](),_0x214da9)[_0x397d('0x49')](function(_0x37556f){return _0x37556f[0x0][_0x397d('0x61')];});}module[_0x397d('0x66')]={'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 726416b..11fc418 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 _0x065c=['crypto','bluebird','../../config/environment','app','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createCipher','data','update','end','final','binary','write','close','decryptFile','createReadStream','createWriteStream','createDecipher','unlink','encryptString','secret','utf8','base64','decryptString'];(function(_0x1d1407,_0x1850c8){var _0x3034ff=function(_0x340962){while(--_0x340962){_0x1d1407['push'](_0x1d1407['shift']());}};_0x3034ff(++_0x1850c8);}(_0x065c,0x181));var _0xc065=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x065c[_0x16b9ed];return _0x66b1f8;};'use strict';var crypto=require(_0xc065('0x0'));var fs=require('fs');var BPromise=require(_0xc065('0x1'));var _=require('lodash');var config=require(_0xc065('0x2'));var logger=require('../../config/logger')(_0xc065('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xc065('0x4')],'algorithm':_0xc065('0x5')};const fileOptions={'algorithm':_0xc065('0x6')};if(config[_0xc065('0x7')]&&config[_0xc065('0x7')][_0xc065('0x8')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0xc065('0x8')]);if(isSupported){fileOptions[_0xc065('0x8')]=config[_0xc065('0x7')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xc065('0x9')](',\x20');logger[_0xc065('0xa')](config[_0xc065('0x7')][_0xc065('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x72bd2b){return AES_SUPPORTED_RX[_0xc065('0xb')](_0x72bd2b);}function getSupportedCiphers(){return crypto[_0xc065('0xc')]()[_0xc065('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x24a68e){return getSupportedCiphers()[_0xc065('0xe')](_0x24a68e)>-0x1;}function combineOptions(_0x439943){var _0x4af87f={};for(var _0x4228e2 in fileOptions){if(fileOptions[_0xc065('0xf')](_0x4228e2)){_0x4af87f[_0x4228e2]=fileOptions[_0x4228e2];}}if(_0x439943){for(var _0x13000a in _0x439943){if(_0x439943['hasOwnProperty'](_0x13000a)){_0x4af87f[_0x13000a]=_0x439943[_0x13000a];}}}return _0x4af87f;}exports[_0xc065('0x10')]=function(_0x9a0ad4,_0x691ec7,_0x2e748e,_0x19689f){return new BPromise(function(_0x28a19d,_0x57431b){_0x19689f=combineOptions(_0x19689f);var _0x4faa8d=new Buffer(_0x2e748e);var _0x4322c7=fs['createReadStream'](_0x9a0ad4);var _0x4dae20=fs['createWriteStream'](_0x691ec7);var _0x1dc161=crypto[_0xc065('0x11')](_0x19689f[_0xc065('0x8')],_0x4faa8d);_0x4322c7['on'](_0xc065('0x12'),function(_0x5ede5b){var _0x29445e=new Buffer(_0x1dc161[_0xc065('0x13')](_0x5ede5b),'binary');_0x4dae20['write'](_0x29445e);});_0x4322c7['on'](_0xc065('0x14'),function(){try{var _0x183fcd=new Buffer(_0x1dc161[_0xc065('0x15')](_0xc065('0x16')),_0xc065('0x16'));_0x4dae20[_0xc065('0x17')](_0x183fcd);_0x4dae20[_0xc065('0x14')]();_0x4dae20['on'](_0xc065('0x18'),function(){return _0x28a19d(_0x691ec7);});}catch(_0x4184ea){fs['unlink'](_0x691ec7);return _0x57431b(_0x4184ea);}});});};exports[_0xc065('0x19')]=function(_0xad346d,_0x3f9274,_0x3053d0,_0x313154){return new BPromise(function(_0x5c97da,_0x33d41a){_0x313154=combineOptions(_0x313154);var _0x3dc2e9=new Buffer(_0x3053d0);var _0x599739=fs[_0xc065('0x1a')](_0xad346d);var _0x294f2f=fs[_0xc065('0x1b')](_0x3f9274);var _0x3bc1fc=crypto[_0xc065('0x1c')](_0x313154[_0xc065('0x8')],_0x3dc2e9);_0x599739['on'](_0xc065('0x12'),function(_0x3c9055){var _0x3a0fd3=new Buffer(_0x3bc1fc['update'](_0x3c9055),_0xc065('0x16'));_0x294f2f[_0xc065('0x17')](_0x3a0fd3);});_0x599739['on'](_0xc065('0x14'),function(){try{var _0x5a07f0=new Buffer(_0x3bc1fc[_0xc065('0x15')](_0xc065('0x16')),_0xc065('0x16'));_0x294f2f['write'](_0x5a07f0);_0x294f2f['end']();_0x294f2f['on']('close',function(){return _0x5c97da(_0x3f9274);});}catch(_0x26c64e){fs[_0xc065('0x1d')](_0x3f9274);return _0x33d41a(_0x26c64e);}});});};exports[_0xc065('0x1e')]=function(_0xd1b3d6,_0x2e7d1b,_0x7aa29a){var _0x525f43=_0x7aa29a||stringOptions[_0xc065('0x8')];var _0xea2a=_0x2e7d1b||stringOptions[_0xc065('0x1f')];var _0x457211=crypto['createCipher'](_0x525f43,_0xea2a);var _0x2df6df=_0x457211[_0xc065('0x13')](_0xd1b3d6,_0xc065('0x20'),_0xc065('0x21'));_0x2df6df+=_0x457211['final'](_0xc065('0x21'));return _0x2df6df;};exports[_0xc065('0x22')]=function(_0x1e8963,_0x4c3437,_0x25f7b6){var _0x4933f2=_0x25f7b6||stringOptions['algorithm'];var _0x1feecf=_0x4c3437||stringOptions['secret'];var _0x13c3b9=crypto[_0xc065('0x1c')](_0x4933f2,_0x1feecf);var _0x57f523=_0x13c3b9[_0xc065('0x13')](_0x1e8963,_0xc065('0x21'),_0xc065('0x20'));_0x57f523+=_0x13c3b9[_0xc065('0x15')](_0xc065('0x20'));return _0x57f523;}; \ No newline at end of file +var _0x1911=['final','end','close','decryptFile','unlink','secret','base64','createDecipher','utf8','crypto','bluebird','../../config/environment','../../config/logger','app','session','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write'];(function(_0x1ae439,_0x4280bc){var _0x3a395e=function(_0x17951d){while(--_0x17951d){_0x1ae439['push'](_0x1ae439['shift']());}};_0x3a395e(++_0x4280bc);}(_0x1911,0x109));var _0x1191=function(_0xc83c6f,_0x246dea){_0xc83c6f=_0xc83c6f-0x0;var _0x1cc09c=_0x1911[_0xc83c6f];return _0x1cc09c;};'use strict';var crypto=require(_0x1191('0x0'));var fs=require('fs');var BPromise=require(_0x1191('0x1'));var _=require('lodash');var config=require(_0x1191('0x2'));var logger=require(_0x1191('0x3'))(_0x1191('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x1191('0x5')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x1191('0x6')};if(config[_0x1191('0x7')]&&config[_0x1191('0x7')][_0x1191('0x8')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x1191('0x8')]);if(isSupported){fileOptions['algorithm']=config[_0x1191('0x7')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x1191('0x9')](',\x20');logger[_0x1191('0xa')](config[_0x1191('0x7')]['algorithm'],_0x1191('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x3aaed4){return AES_SUPPORTED_RX[_0x1191('0xc')](_0x3aaed4);}function getSupportedCiphers(){return crypto[_0x1191('0xd')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x2e0e22){return getSupportedCiphers()[_0x1191('0xe')](_0x2e0e22)>-0x1;}function combineOptions(_0x3a4139){var _0x1ae0fc={};for(var _0xa59caf in fileOptions){if(fileOptions['hasOwnProperty'](_0xa59caf)){_0x1ae0fc[_0xa59caf]=fileOptions[_0xa59caf];}}if(_0x3a4139){for(var _0x3a8763 in _0x3a4139){if(_0x3a4139['hasOwnProperty'](_0x3a8763)){_0x1ae0fc[_0x3a8763]=_0x3a4139[_0x3a8763];}}}return _0x1ae0fc;}exports[_0x1191('0xf')]=function(_0x173d88,_0x25ab4e,_0x5463c8,_0x9fbb31){return new BPromise(function(_0x2608fc,_0xf8122f){_0x9fbb31=combineOptions(_0x9fbb31);var _0x3dc6e1=new Buffer(_0x5463c8);var _0x1b5604=fs[_0x1191('0x10')](_0x173d88);var _0x248c1f=fs[_0x1191('0x11')](_0x25ab4e);var _0x30fed7=crypto[_0x1191('0x12')](_0x9fbb31[_0x1191('0x8')],_0x3dc6e1);_0x1b5604['on'](_0x1191('0x13'),function(_0x4b6ae7){var _0x4873e6=new Buffer(_0x30fed7[_0x1191('0x14')](_0x4b6ae7),_0x1191('0x15'));_0x248c1f[_0x1191('0x16')](_0x4873e6);});_0x1b5604['on']('end',function(){try{var _0x2069c7=new Buffer(_0x30fed7[_0x1191('0x17')]('binary'),'binary');_0x248c1f[_0x1191('0x16')](_0x2069c7);_0x248c1f[_0x1191('0x18')]();_0x248c1f['on'](_0x1191('0x19'),function(){return _0x2608fc(_0x25ab4e);});}catch(_0xac8067){fs['unlink'](_0x25ab4e);return _0xf8122f(_0xac8067);}});});};exports[_0x1191('0x1a')]=function(_0x375fc0,_0x46676f,_0x1a6fe2,_0x1d575e){return new BPromise(function(_0x129a44,_0x286b04){_0x1d575e=combineOptions(_0x1d575e);var _0x583d1b=new Buffer(_0x1a6fe2);var _0x5b66b2=fs['createReadStream'](_0x375fc0);var _0x44cc03=fs[_0x1191('0x11')](_0x46676f);var _0x17bc51=crypto['createDecipher'](_0x1d575e['algorithm'],_0x583d1b);_0x5b66b2['on'](_0x1191('0x13'),function(_0x403598){var _0x259e02=new Buffer(_0x17bc51[_0x1191('0x14')](_0x403598),_0x1191('0x15'));_0x44cc03[_0x1191('0x16')](_0x259e02);});_0x5b66b2['on']('end',function(){try{var _0x5e5b8b=new Buffer(_0x17bc51[_0x1191('0x17')]('binary'),_0x1191('0x15'));_0x44cc03[_0x1191('0x16')](_0x5e5b8b);_0x44cc03[_0x1191('0x18')]();_0x44cc03['on']('close',function(){return _0x129a44(_0x46676f);});}catch(_0x2991e5){fs[_0x1191('0x1b')](_0x46676f);return _0x286b04(_0x2991e5);}});});};exports['encryptString']=function(_0x5bda85,_0xe341ff,_0x2e8433){var _0x4f1f71=_0x2e8433||stringOptions['algorithm'];var _0xce5da1=_0xe341ff||stringOptions[_0x1191('0x1c')];var _0x5c88ae=crypto[_0x1191('0x12')](_0x4f1f71,_0xce5da1);var _0x527f28=_0x5c88ae[_0x1191('0x14')](_0x5bda85,'utf8',_0x1191('0x1d'));_0x527f28+=_0x5c88ae[_0x1191('0x17')](_0x1191('0x1d'));return _0x527f28;};exports['decryptString']=function(_0xa2f50,_0x1cce2b,_0x3067f9){var _0x32c8ff=_0x3067f9||stringOptions[_0x1191('0x8')];var _0x390b99=_0x1cce2b||stringOptions[_0x1191('0x1c')];var _0x5cccb8=crypto[_0x1191('0x1e')](_0x32c8ff,_0x390b99);var _0x148a17=_0x5cccb8[_0x1191('0x14')](_0xa2f50,_0x1191('0x1d'),'utf8');_0x148a17+=_0x5cccb8[_0x1191('0x17')](_0x1191('0x1f'));return _0x148a17;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index f481799..4022697 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 _0x5074=['zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','%s.%s','catch','inspect','Failed','exit','util','lodash','to-csv','bluebird','../../mysqldb','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','split','length','range','isInteger','query','QueryTypes','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','writeFileSync'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5074,0xe9));var _0x4507=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x5074[_0x4ab3fb];return _0x34fe1e;};'use strict';var util=require(_0x4507('0x0'));var path=require('path');var _=require(_0x4507('0x1'));var csv=require(_0x4507('0x2'));var fs=require('fs');var BPromise=require(_0x4507('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0x4507('0x4'))['db'];var dbH=require(_0x4507('0x4'))['dbH'];var logger=require('../../config/logger')(_0x4507('0x5'));var EXTRACTED_REPORT_ID=Number(process[_0x4507('0x6')][0x2]);var QUERY=process[_0x4507('0x6')][0x3];var PATH=process[_0x4507('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3be0aa,_0x5ca07f){var _0x22ad22={'status':_0x3be0aa};var _0x475a3b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5ca07f){_0x22ad22['savename']=_0x5ca07f;}return db[_0x4507('0x7')][_0x4507('0x8')](_0x22ad22,_0x475a3b);}function main(){var _0x46998a=0x1388;var _0x34317e;logger[_0x4507('0x9')](util[_0x4507('0xa')](_0x4507('0xb'),EXTRACTED_REPORT_ID,_0x4507('0xc')));return db[_0x4507('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})[_0x4507('0xe')](function(_0x53f770){if(_0x53f770){_0x34317e=_0x53f770;_0x46998a=_0x34317e['splitSizeCsv']||0x1388;}})[_0x4507('0xe')](function(){return dbH[_0x4507('0xf')]['query'](util[_0x4507('0xa')](_0x4507('0x10'),QUERY),{'type':dbH[_0x4507('0xf')]['QueryTypes'][_0x4507('0x11')]});})[_0x4507('0xe')](function(_0x49c470){if(!_0x49c470[0x0][_0x4507('0x12')]){return analyticExtractedReport('Empty');}var _0x4e854b=[];var _0x2d3ca7=0x0;if(_0x34317e[_0x4507('0x13')]){if(_0x49c470&&_0x49c470[_0x4507('0x14')]){var _0x2caeb3=_[_0x4507('0x15')](_0x49c470[0x0][_0x4507('0x12')]/_0x46998a);var _0x5724d5=Number[_0x4507('0x16')](_0x49c470[0x0]['num']/_0x46998a)?_0x49c470[0x0][_0x4507('0x12')]%_0x46998a:0x0;_0x2caeb3['forEach'](function(_0x198e94){if(_0x198e94>0x0){_0x2d3ca7+=_0x46998a;}_0x4e854b['push'](dbH[_0x4507('0xf')][_0x4507('0x17')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x46998a,_0x2d3ca7),{'type':dbH['sequelize'][_0x4507('0x18')][_0x4507('0x11')]}));});if(_0x5724d5>0x0){_0x2d3ca7+=_0x46998a;_0x4e854b[_0x4507('0x19')](dbH[_0x4507('0xf')][_0x4507('0x17')](util[_0x4507('0xa')](_0x4507('0x1a'),QUERY,_0x5724d5,_0x2d3ca7),{'type':dbH[_0x4507('0xf')][_0x4507('0x18')][_0x4507('0x11')]}));}}}else{_0x4e854b[_0x4507('0x19')](dbH[_0x4507('0xf')]['query'](QUERY,{'type':dbH[_0x4507('0xf')][_0x4507('0x18')][_0x4507('0x11')]}));}var _0x2aee10=path[_0x4507('0x1b')](PATH);var _0x5e3f55=path[_0x4507('0x1c')](PATH,_0x4507('0x1d'));var _0x86dfc9=_0x34317e[_0x4507('0x13')]&&_0x4e854b['length']>0x1;var _0x555270=[];if(!fs[_0x4507('0x1e')](path[_0x4507('0x1f')](_0x2aee10,_0x5e3f55))&&_0x86dfc9){fs[_0x4507('0x20')](path[_0x4507('0x1f')](_0x2aee10,_0x5e3f55));}return BPromise[_0x4507('0x21')](_0x4e854b,function(_0x534666){_0x555270[_0x4507('0x19')](_0x534666);})[_0x4507('0xe')](function(){for(var _0x851f4c=0x0;_0x851f4c<_0x555270['length'];_0x851f4c+=0x1){var _0x351e56;var _0x130f5a=_0x555270[_0x851f4c];if(_0x86dfc9){_0x351e56=path[_0x4507('0x1f')](_0x2aee10,_0x5e3f55,util[_0x4507('0xa')](_0x4507('0x22'),_0x5e3f55,_0x851f4c,_0x4507('0x23')));}else{_0x351e56=path[_0x4507('0x1f')](_0x2aee10,util[_0x4507('0xa')]('%s.%s',_0x5e3f55,_0x4507('0x23')));}fs[_0x4507('0x24')](_0x351e56,csv(_0x130f5a));}})[_0x4507('0xe')](function(){if(_0x86dfc9){return new Promise(function(_0x4c4e44){zipdir(path[_0x4507('0x1f')](_0x2aee10,_0x5e3f55),{'saveTo':path[_0x4507('0x1f')](_0x2aee10,util[_0x4507('0xa')]('%s.%s',_0x5e3f55,_0x4507('0x25')))},function(_0x3b518b,_0xbdfe9c){rimraf(path[_0x4507('0x1f')](_0x2aee10,_0x5e3f55),function(){});_0x4c4e44(_0x4507('0x26'));});});}})['then'](function(){logger['info'](util[_0x4507('0xa')](_0x4507('0x27'),EXTRACTED_REPORT_ID,_0x4507('0xc')));return analyticExtractedReport('Completed',_0x86dfc9?util[_0x4507('0xa')](_0x4507('0x28'),_0x5e3f55,_0x86dfc9?_0x4507('0x25'):_0x4507('0x23')):null);});})[_0x4507('0x29')](function(_0x3a8754){logger[_0x4507('0x9')](util[_0x4507('0xa')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4507('0xc')),util[_0x4507('0x2a')](_0x3a8754,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4507('0x2b'));})['finally'](function(){process[_0x4507('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0df5=['zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','QueryTypes','SELECT','num','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','csv'];(function(_0x19dce7,_0x5eca16){var _0x7cdd9a=function(_0x3fba13){while(--_0x3fba13){_0x19dce7['push'](_0x19dce7['shift']());}};_0x7cdd9a(++_0x5eca16);}(_0x0df5,0x6c));var _0x50df=function(_0x3eeb0c,_0x5eb2ca){_0x3eeb0c=_0x3eeb0c-0x0;var _0x647b33=_0x0df5[_0x3eeb0c];return _0x647b33;};'use strict';var util=require(_0x50df('0x0'));var path=require(_0x50df('0x1'));var _=require(_0x50df('0x2'));var csv=require(_0x50df('0x3'));var fs=require('fs');var BPromise=require(_0x50df('0x4'));var zipdir=require(_0x50df('0x5'));var rimraf=require(_0x50df('0x6'));var db=require(_0x50df('0x7'))['db'];var dbH=require(_0x50df('0x7'))[_0x50df('0x8')];var logger=require(_0x50df('0x9'))(_0x50df('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x50df('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x50df('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xe3c37d,_0x152b65){var _0x41d2a2={'status':_0xe3c37d};var _0xa11dbc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x152b65){_0x41d2a2[_0x50df('0xc')]=_0x152b65;}return db['AnalyticExtractedReport'][_0x50df('0xd')](_0x41d2a2,_0xa11dbc);}function main(){var _0x77f9cb=0x1388;var _0x56b95a;logger['info'](util[_0x50df('0xe')](_0x50df('0xf'),EXTRACTED_REPORT_ID,_0x50df('0x10')));return db[_0x50df('0x11')][_0x50df('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x50df('0x13'),_0x50df('0x14')]})[_0x50df('0x15')](function(_0x4205de){if(_0x4205de){_0x56b95a=_0x4205de;_0x77f9cb=_0x56b95a[_0x50df('0x14')]||0x1388;}})[_0x50df('0x15')](function(){return dbH[_0x50df('0x16')][_0x50df('0x17')](util[_0x50df('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x50df('0x16')][_0x50df('0x18')][_0x50df('0x19')]});})['then'](function(_0x7d7743){if(!_0x7d7743[0x0][_0x50df('0x1a')]){return analyticExtractedReport('Empty');}var _0x489b19=[];var _0x5ca7d3=0x0;if(_0x56b95a[_0x50df('0x13')]){if(_0x7d7743&&_0x7d7743[_0x50df('0x1b')]){var _0x209bf8=_[_0x50df('0x1c')](_0x7d7743[0x0]['num']/_0x77f9cb);var _0x9a32e5=Number[_0x50df('0x1d')](_0x7d7743[0x0][_0x50df('0x1a')]/_0x77f9cb)?_0x7d7743[0x0][_0x50df('0x1a')]%_0x77f9cb:0x0;_0x209bf8[_0x50df('0x1e')](function(_0x5c8716){if(_0x5c8716>0x0){_0x5ca7d3+=_0x77f9cb;}_0x489b19[_0x50df('0x1f')](dbH['sequelize']['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x77f9cb,_0x5ca7d3),{'type':dbH[_0x50df('0x16')][_0x50df('0x18')]['SELECT']}));});if(_0x9a32e5>0x0){_0x5ca7d3+=_0x77f9cb;_0x489b19[_0x50df('0x1f')](dbH[_0x50df('0x16')]['query'](util[_0x50df('0xe')](_0x50df('0x20'),QUERY,_0x9a32e5,_0x5ca7d3),{'type':dbH[_0x50df('0x16')][_0x50df('0x18')][_0x50df('0x19')]}));}}}else{_0x489b19[_0x50df('0x1f')](dbH[_0x50df('0x16')][_0x50df('0x17')](QUERY,{'type':dbH[_0x50df('0x16')][_0x50df('0x18')][_0x50df('0x19')]}));}var _0x1d4fb0=path[_0x50df('0x21')](PATH);var _0x28653d=path[_0x50df('0x22')](PATH,'.csv');var _0x4d0fa3=_0x56b95a['split']&&_0x489b19[_0x50df('0x1b')]>0x1;var _0x1ee614=[];if(!fs[_0x50df('0x23')](path[_0x50df('0x24')](_0x1d4fb0,_0x28653d))&&_0x4d0fa3){fs[_0x50df('0x25')](path[_0x50df('0x24')](_0x1d4fb0,_0x28653d));}return BPromise[_0x50df('0x26')](_0x489b19,function(_0x20b967){_0x1ee614[_0x50df('0x1f')](_0x20b967);})['then'](function(){for(var _0x10a720=0x0;_0x10a720<_0x1ee614[_0x50df('0x1b')];_0x10a720+=0x1){var _0x4fdaf7;var _0xa2a4c4=_0x1ee614[_0x10a720];if(_0x4d0fa3){_0x4fdaf7=path[_0x50df('0x24')](_0x1d4fb0,_0x28653d,util[_0x50df('0xe')](_0x50df('0x27'),_0x28653d,_0x10a720,'csv'));}else{_0x4fdaf7=path[_0x50df('0x24')](_0x1d4fb0,util[_0x50df('0xe')](_0x50df('0x28'),_0x28653d,_0x50df('0x29')));}fs['writeFileSync'](_0x4fdaf7,csv(_0xa2a4c4));}})[_0x50df('0x15')](function(){if(_0x4d0fa3){return new Promise(function(_0x2692a6){zipdir(path['join'](_0x1d4fb0,_0x28653d),{'saveTo':path['join'](_0x1d4fb0,util[_0x50df('0xe')]('%s.%s',_0x28653d,_0x50df('0x2a')))},function(_0x15ab98,_0x574274){rimraf(path[_0x50df('0x24')](_0x1d4fb0,_0x28653d),function(){});_0x2692a6('zip\x20finished');});});}})[_0x50df('0x15')](function(){logger[_0x50df('0x2b')](util[_0x50df('0xe')](_0x50df('0x2c'),EXTRACTED_REPORT_ID,_0x50df('0x10')));return analyticExtractedReport('Completed',_0x4d0fa3?util[_0x50df('0xe')]('%s.%s',_0x28653d,_0x4d0fa3?_0x50df('0x2a'):_0x50df('0x29')):null);});})[_0x50df('0x2d')](function(_0x392e97){logger[_0x50df('0x2b')](util[_0x50df('0xe')](_0x50df('0x2e'),EXTRACTED_REPORT_ID,_0x50df('0x10')),util['inspect'](_0x392e97,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x50df('0x2f'));})[_0x50df('0x30')](function(){process[_0x50df('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index b92d855..a3d35f4 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 _0x760c=['%s.%s','all','zip','zip\x20finished','info','PDF','Completed','pdf','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','inspect','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','error','end','createPdfFromHTML','createPdfKitDocument','catch','lodash','util','path','moment','html-to-pdfmake','zip-dir','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','black','Empty','Setting','find','split','splitSizePdf','then','range','num','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','.pdf','existsSync','join','mkdirSync','each','flatten','%s%d.%s'];(function(_0x2add49,_0x602c93){var _0x1402d7=function(_0x140da9){while(--_0x140da9){_0x2add49['push'](_0x2add49['shift']());}};_0x1402d7(++_0x602c93);}(_0x760c,0x82));var _0xc760=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x760c[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xc760('0x0'));var fs=require('fs');var util=require(_0xc760('0x1'));var path=require(_0xc760('0x2'));var moment=require(_0xc760('0x3'));var htmlToPdfmake=require(_0xc760('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xc760('0x5'));var rimraf=require(_0xc760('0x6'));var JSDOM=require(_0xc760('0x7'))[_0xc760('0x8')];var window=new JSDOM('')['window'];var BPromise=require(_0xc760('0x9'));var db=require(_0xc760('0xa'))['db'];var dbH=require(_0xc760('0xa'))[_0xc760('0xb')];var logger=require(_0xc760('0xc'))(_0xc760('0xd'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xc760('0xe')][0x3];var PATH=process[_0xc760('0xe')][0x4];var NAME=process[_0xc760('0xe')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2215dc,_0x12d50f){var _0x1371d4={'status':_0x2215dc};var _0x56046a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x12d50f){_0x1371d4['savename']=_0x12d50f;}return db[_0xc760('0xf')][_0xc760('0x10')](_0x1371d4,_0x56046a);}function getHeaders(_0x24641a){return _[_0xc760('0x11')](_0x24641a,function(_0x103476){return{'text':_0x103476,'style':_0xc760('0x12')};});}function getRows(_0x108763,_0x28f57c){return _[_0xc760('0x11')](_0x28f57c,function(_0xd6a729){return _(_0xd6a729)[_0xc760('0x13')](_0x108763)['map'](function(_0x44b8d2){return _0x44b8d2?_[_0xc760('0x14')](_0x44b8d2):'';})[_0xc760('0x15')]();});}function createTable(_0x4da808,_0x5ae554){var _0x122a06={'widths':_[_0xc760('0x16')](Array(_0x4da808[_0xc760('0x17')]),0x91),'heights':function(_0x54ddca){return _0x54ddca===0x0?_0xc760('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x54f475=getHeaders(_0x4da808);_0x122a06[_0xc760('0x19')][_0xc760('0x1a')](_0x54f475);var _0x17cc12=getRows(_0x4da808,_0x5ae554);_0x122a06[_0xc760('0x19')]=_0x122a06['body'][_0xc760('0x1b')](_0x17cc12);return _0x122a06;}function createTables(_0x119b7b){var _0x5a41b0=[];var _0x332177=_[_0xc760('0x1c')](Object[_0xc760('0x1d')](_0x119b7b[0x0]),0x5);_0x332177[_0xc760('0x1e')](function(_0x601567){_0x5a41b0[_0xc760('0x1a')](createTable(_0x601567,_0x119b7b));});return _0x5a41b0;}function getPDFDocDefinition(_0x2cde37){var _0x391bf5=util[_0xc760('0x1f')](_0xc760('0x20'),NAME,EXTRACTED_REPORT[_0xc760('0x21')],moment(EXTRACTED_REPORT[_0xc760('0x22')])[_0xc760('0x1f')](FORMAT),moment(EXTRACTED_REPORT[_0xc760('0x23')])[_0xc760('0x1f')](FORMAT));var _0x4adcba=[];for(var _0x57729a=0x0;_0x57729a<_0x2cde37[_0xc760('0x17')];_0x57729a++){var _0xd1abc1=[];if(_0x57729a===0x0){_0xd1abc1['push']({'text':_0x391bf5,'style':_0xc760('0x24')});}var _0x5f16be={'table':_0x2cde37[_0x57729a]};if(_0x57729a>0x0){_0x5f16be[_0xc760('0x25')]=_0xc760('0x26');_0x5f16be[_0xc760('0x27')]=[0x0,0x46,0x0,0x0];}_0xd1abc1['push'](_0x5f16be);_0x4adcba['push'](_0xd1abc1);}return{'pageSize':'A4','pageOrientation':_0xc760('0x28'),'content':_0x4adcba,'footer':function(_0x1c609d,_0xbe3733){return{'text':_0x1c609d[_0xc760('0x14')]()+_0xc760('0x29')+_0xbe3733,'style':_0xc760('0x2a')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xc760('0x2b')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3418aa){var _0x4c8260=0x1388;var _0x4ca52a;if(!_0x3418aa[0x0]['num']){return analyticExtractedReport(_0xc760('0x2c'));}return db[_0xc760('0x2d')][_0xc760('0x2e')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc760('0x2f'),_0xc760('0x30')]})[_0xc760('0x31')](function(_0x25fd27){if(_0x25fd27){_0x4ca52a=_0x25fd27;_0x4c8260=_0x4ca52a[_0xc760('0x30')]||0x3e8;}})[_0xc760('0x31')](function(){var _0x4d9b01=[];var _0x5e3616=0x0;if(_0x4ca52a['split']){if(_0x3418aa&&_0x3418aa[_0xc760('0x17')]){var _0x48c5af=_[_0xc760('0x32')](_0x3418aa[0x0][_0xc760('0x33')]/_0x4c8260);var _0x1f4561=Number[_0xc760('0x34')](_0x3418aa[0x0]['num']/_0x4c8260)?_0x3418aa[0x0][_0xc760('0x33')]%_0x4c8260:0x0;_0x48c5af[_0xc760('0x1e')](function(_0x12b299){if(_0x12b299>0x0){_0x5e3616+=_0x4c8260;}_0x4d9b01[_0xc760('0x1a')](dbH[_0xc760('0x35')][_0xc760('0x36')](util[_0xc760('0x1f')](_0xc760('0x37'),QUERY,_0x4c8260,_0x5e3616),{'type':dbH[_0xc760('0x35')][_0xc760('0x38')][_0xc760('0x39')]}));});if(_0x1f4561>0x0){_0x5e3616+=_0x4c8260;_0x4d9b01[_0xc760('0x1a')](dbH[_0xc760('0x35')]['query'](util[_0xc760('0x1f')](_0xc760('0x37'),QUERY,_0x1f4561,_0x5e3616),{'type':dbH[_0xc760('0x35')]['QueryTypes'][_0xc760('0x39')]}));}}}else{_0x4d9b01[_0xc760('0x1a')](dbH[_0xc760('0x35')]['query'](QUERY,{'type':dbH[_0xc760('0x35')][_0xc760('0x38')][_0xc760('0x39')]}));}var _0x2c61b9=path[_0xc760('0x3a')](PATH);var _0x572669=path['basename'](PATH,_0xc760('0x3b'));var _0x26104f=_0x4ca52a[_0xc760('0x2f')]&&_0x4d9b01['length']>0x1;var _0x4777de=[];if(!fs[_0xc760('0x3c')](path[_0xc760('0x3d')](_0x2c61b9,_0x572669))&&_0x26104f){fs[_0xc760('0x3e')](path['join'](_0x2c61b9,_0x572669));}return BPromise[_0xc760('0x3f')](_0x4d9b01,function(_0x414afd){_0x4777de['push'](_0x414afd);})[_0xc760('0x31')](function(){var _0x11737b=[];for(var _0x4aad19=0x0;_0x4aad19<_0x4777de[_0xc760('0x17')];_0x4aad19+=0x1){var _0x19c980=_0x4777de[_0x4aad19];var _0x57f549=createTables(_[_0xc760('0x40')](_0x19c980));var _0x51a89b;var _0x4e82a6=getPDFDocDefinition(_0x57f549);var _0x419a5c=getPDFPrinter();var _0x5cb7b5=_0x419a5c['createPdfKitDocument'](_0x4e82a6);if(_0x26104f){_0x51a89b=path['join'](_0x2c61b9,_0x572669,util['format'](_0xc760('0x41'),_0x572669,_0x4aad19,'pdf'));}else{_0x51a89b=path[_0xc760('0x3d')](_0x2c61b9,util[_0xc760('0x1f')](_0xc760('0x42'),_0x572669,'pdf'));}_0x11737b['push'](writePDFDocument(_0x5cb7b5,_0x51a89b));}return Promise[_0xc760('0x43')](_0x11737b);})[_0xc760('0x31')](function(){if(_0x26104f){return new Promise(function(_0x5e5d07){zipdir(path['join'](_0x2c61b9,_0x572669),{'saveTo':path['join'](_0x2c61b9,util[_0xc760('0x1f')](_0xc760('0x42'),_0x572669,_0xc760('0x44')))},function(){rimraf(path[_0xc760('0x3d')](_0x2c61b9,_0x572669),function(){});_0x5e5d07(_0xc760('0x45'));});});}})['then'](function(){if(!_0x26104f)return;rimraf(path[_0xc760('0x3d')](_0x2c61b9,_0x572669),function(){});})[_0xc760('0x31')](function(){logger[_0xc760('0x46')](util[_0xc760('0x1f')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xc760('0x47')));return analyticExtractedReport(_0xc760('0x48'),_0x26104f?util[_0xc760('0x1f')]('%s.%s',_0x572669,_0x26104f?'zip':_0xc760('0x49')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xc760('0x46')](util['format'](_0xc760('0x4a'),EXTRACTED_REPORT_ID,_0xc760('0x47')));return db['AnalyticExtractedReport'][_0xc760('0x4b')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xc760('0x31')](function(_0x5b01d2){EXTRACTED_REPORT=_0x5b01d2;return dbH[_0xc760('0x35')]['query'](util[_0xc760('0x1f')](_0xc760('0x4c'),QUERY),{'type':dbH['sequelize'][_0xc760('0x38')][_0xc760('0x39')]});})['then'](extractReport)['catch'](function(_0xbcc741){logger[_0xc760('0x46')](util[_0xc760('0x1f')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc760('0x47')),util[_0xc760('0x4d')](_0xbcc741,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc760('0x4e'));})[_0xc760('0x4f')](function(){process[_0xc760('0x50')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1c0cc0=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xc760('0x51'),'italics':__dirname+_0xc760('0x52'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x1c0cc0;}function getPDFDocDefinitionFromHTML(_0x510304,_0x4dc5dd){var _0x13fa3=util['format'](_0xc760('0x53'),_0x4dc5dd[_0xc760('0x54')],_0x4dc5dd[_0xc760('0x55')]);var _0x37c18a=moment()[_0xc760('0x1f')](_0xc760('0x56'))[_0xc760('0x14')]();var _0xdc77e9=htmlToPdfmake(_0x510304,{'window':window,'tableAutoSize':!![]});return{'content':[_0xdc77e9],'defaultStyle':{'font':_0xc760('0x57')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xc760('0x58'),'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':_0xc760('0x58')}},'header':function(){return[{'text':_0xc760('0x59'),'style':_0xc760('0x24')}];},'footer':function(_0x48d8ab,_0x4809a3){return[{'text':util[_0xc760('0x1f')](_0xc760('0x5a'),_0x13fa3,_0x48d8ab,_0x4809a3,_0x37c18a),'style':_0xc760('0x2a')}];}};}function writePDFDocument(_0x9c8e69,_0x2522fb){return new Promise(function(_0x10ff6c,_0xc11586){var _0x409195=_0x9c8e69[_0xc760('0x5b')](fs[_0xc760('0x5c')](_0x2522fb));_0x409195['on']('finish',function(){_0x10ff6c('finish');});_0x409195['on'](_0xc760('0x5d'),function(_0x5ec089){_0xc11586(_0x5ec089);});_0x9c8e69[_0xc760('0x5e')]();});}exports[_0xc760('0x5f')]=function(_0x5d942f,_0x35422e){var _0x530979=getPDFPrinter();var _0x3a2dfe=getPDFDocDefinitionFromHTML(_0x5d942f,_0x35422e);var _0x410609=_0x530979[_0xc760('0x60')](_0x3a2dfe);return writePDFDocument(_0x410609,_0x35422e[_0xc760('0x2')])[_0xc760('0x61')](function(_0x338a35){throw _0x338a35;});}; \ No newline at end of file +var _0xa731=['pipe','finish','error','end','createPdfFromHTML','createPdfKitDocument','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','toString','value','fill','length','auto','push','body','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','header','pageBreak','margin','landscape','\x20/\x20','footer','Arial','black','right','Empty','find','split','splitSizePdf','then','num','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','existsSync','join','each','flatten','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','Interaction\x20Transcript'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xa731,0x18a));var _0x1a73=function(_0x582bf0,_0x2d10f0){_0x582bf0=_0x582bf0-0x0;var _0x2eefe0=_0xa731[_0x582bf0];return _0x2eefe0;};'use strict';var _=require(_0x1a73('0x0'));var fs=require('fs');var util=require(_0x1a73('0x1'));var path=require(_0x1a73('0x2'));var moment=require(_0x1a73('0x3'));var htmlToPdfmake=require(_0x1a73('0x4'));var PdfPrinter=require(_0x1a73('0x5'));var zipdir=require(_0x1a73('0x6'));var rimraf=require(_0x1a73('0x7'));var JSDOM=require(_0x1a73('0x8'))[_0x1a73('0x9')];var window=new JSDOM('')[_0x1a73('0xa')];var BPromise=require(_0x1a73('0xb'));var db=require(_0x1a73('0xc'))['db'];var dbH=require(_0x1a73('0xc'))[_0x1a73('0xd')];var logger=require(_0x1a73('0xe'))(_0x1a73('0xf'));var EXTRACTED_REPORT_ID=Number(process[_0x1a73('0x10')][0x2]);var QUERY=process[_0x1a73('0x10')][0x3];var PATH=process[_0x1a73('0x10')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x1a73('0x11');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x51714b,_0x4e7e44){var _0x5d0287={'status':_0x51714b};var _0x4bf484={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4e7e44){_0x5d0287[_0x1a73('0x12')]=_0x4e7e44;}return db[_0x1a73('0x13')]['update'](_0x5d0287,_0x4bf484);}function getHeaders(_0x53d7b){return _[_0x1a73('0x14')](_0x53d7b,function(_0x4d7482){return{'text':_0x4d7482,'style':_0x1a73('0x15')};});}function getRows(_0x1e0db1,_0x5174d2){return _['map'](_0x5174d2,function(_0x5dbbb1){return _(_0x5dbbb1)['pick'](_0x1e0db1)[_0x1a73('0x14')](function(_0x5cdc4e){return _0x5cdc4e?_[_0x1a73('0x16')](_0x5cdc4e):'';})[_0x1a73('0x17')]();});}function createTable(_0x4aa241,_0xe6e05b){var _0x16ee03={'widths':_[_0x1a73('0x18')](Array(_0x4aa241[_0x1a73('0x19')]),0x91),'heights':function(_0x315274){return _0x315274===0x0?_0x1a73('0x1a'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x42223f=getHeaders(_0x4aa241);_0x16ee03['body'][_0x1a73('0x1b')](_0x42223f);var _0x39eec2=getRows(_0x4aa241,_0xe6e05b);_0x16ee03[_0x1a73('0x1c')]=_0x16ee03[_0x1a73('0x1c')][_0x1a73('0x1d')](_0x39eec2);return _0x16ee03;}function createTables(_0x490014){var _0x39b842=[];var _0x1f1cd9=_[_0x1a73('0x1e')](Object[_0x1a73('0x1f')](_0x490014[0x0]),0x5);_0x1f1cd9[_0x1a73('0x20')](function(_0x2cd9fd){_0x39b842[_0x1a73('0x1b')](createTable(_0x2cd9fd,_0x490014));});return _0x39b842;}function getPDFDocDefinition(_0x1c2247){var _0x330e74=util[_0x1a73('0x21')](_0x1a73('0x22'),NAME,EXTRACTED_REPORT[_0x1a73('0x23')],moment(EXTRACTED_REPORT['startDate'])[_0x1a73('0x21')](FORMAT),moment(EXTRACTED_REPORT[_0x1a73('0x24')])['format'](FORMAT));var _0x121728=[];for(var _0x66fb08=0x0;_0x66fb08<_0x1c2247['length'];_0x66fb08++){var _0x4ab8b3=[];if(_0x66fb08===0x0){_0x4ab8b3['push']({'text':_0x330e74,'style':_0x1a73('0x25')});}var _0x3c4916={'table':_0x1c2247[_0x66fb08]};if(_0x66fb08>0x0){_0x3c4916[_0x1a73('0x26')]='before';_0x3c4916[_0x1a73('0x27')]=[0x0,0x46,0x0,0x0];}_0x4ab8b3[_0x1a73('0x1b')](_0x3c4916);_0x121728[_0x1a73('0x1b')](_0x4ab8b3);}return{'pageSize':'A4','pageOrientation':_0x1a73('0x28'),'content':_0x121728,'footer':function(_0x19f62b,_0x38b438){return{'text':_0x19f62b[_0x1a73('0x16')]()+_0x1a73('0x29')+_0x38b438,'style':_0x1a73('0x2a')};},'defaultStyle':{'font':_0x1a73('0x2b')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x1a73('0x2c')},'footer':{'alignment':_0x1a73('0x2d'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x54c2be){var _0x196888=0x1388;var _0x1c9e1c;if(!_0x54c2be[0x0]['num']){return analyticExtractedReport(_0x1a73('0x2e'));}return db['Setting'][_0x1a73('0x2f')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1a73('0x30'),_0x1a73('0x31')]})[_0x1a73('0x32')](function(_0x543c9f){if(_0x543c9f){_0x1c9e1c=_0x543c9f;_0x196888=_0x1c9e1c['splitSizePdf']||0x3e8;}})[_0x1a73('0x32')](function(){var _0x59e46b=[];var _0x6f7a52=0x0;if(_0x1c9e1c['split']){if(_0x54c2be&&_0x54c2be[_0x1a73('0x19')]){var _0x32944c=_['range'](_0x54c2be[0x0][_0x1a73('0x33')]/_0x196888);var _0x4dd655=Number[_0x1a73('0x34')](_0x54c2be[0x0]['num']/_0x196888)?_0x54c2be[0x0][_0x1a73('0x33')]%_0x196888:0x0;_0x32944c[_0x1a73('0x20')](function(_0x35bb17){if(_0x35bb17>0x0){_0x6f7a52+=_0x196888;}_0x59e46b[_0x1a73('0x1b')](dbH[_0x1a73('0x35')][_0x1a73('0x36')](util['format'](_0x1a73('0x37'),QUERY,_0x196888,_0x6f7a52),{'type':dbH[_0x1a73('0x35')][_0x1a73('0x38')][_0x1a73('0x39')]}));});if(_0x4dd655>0x0){_0x6f7a52+=_0x196888;_0x59e46b['push'](dbH['sequelize']['query'](util['format'](_0x1a73('0x37'),QUERY,_0x4dd655,_0x6f7a52),{'type':dbH[_0x1a73('0x35')]['QueryTypes'][_0x1a73('0x39')]}));}}}else{_0x59e46b['push'](dbH[_0x1a73('0x35')][_0x1a73('0x36')](QUERY,{'type':dbH[_0x1a73('0x35')][_0x1a73('0x38')][_0x1a73('0x39')]}));}var _0x32eaea=path['dirname'](PATH);var _0x558cbd=path[_0x1a73('0x3a')](PATH,'.pdf');var _0xdfc0c1=_0x1c9e1c['split']&&_0x59e46b[_0x1a73('0x19')]>0x1;var _0x5b9e20=[];if(!fs[_0x1a73('0x3b')](path[_0x1a73('0x3c')](_0x32eaea,_0x558cbd))&&_0xdfc0c1){fs['mkdirSync'](path[_0x1a73('0x3c')](_0x32eaea,_0x558cbd));}return BPromise[_0x1a73('0x3d')](_0x59e46b,function(_0x4b9743){_0x5b9e20['push'](_0x4b9743);})['then'](function(){var _0x49592a=[];for(var _0x21dad8=0x0;_0x21dad8<_0x5b9e20[_0x1a73('0x19')];_0x21dad8+=0x1){var _0x251e96=_0x5b9e20[_0x21dad8];var _0x27cf1a=createTables(_[_0x1a73('0x3e')](_0x251e96));var _0x361304;var _0x58f124=getPDFDocDefinition(_0x27cf1a);var _0x56115d=getPDFPrinter();var _0x18ada6=_0x56115d['createPdfKitDocument'](_0x58f124);if(_0xdfc0c1){_0x361304=path[_0x1a73('0x3c')](_0x32eaea,_0x558cbd,util[_0x1a73('0x21')](_0x1a73('0x3f'),_0x558cbd,_0x21dad8,_0x1a73('0x40')));}else{_0x361304=path[_0x1a73('0x3c')](_0x32eaea,util[_0x1a73('0x21')](_0x1a73('0x41'),_0x558cbd,_0x1a73('0x40')));}_0x49592a[_0x1a73('0x1b')](writePDFDocument(_0x18ada6,_0x361304));}return Promise[_0x1a73('0x42')](_0x49592a);})[_0x1a73('0x32')](function(){if(_0xdfc0c1){return new Promise(function(_0x4a0550){zipdir(path[_0x1a73('0x3c')](_0x32eaea,_0x558cbd),{'saveTo':path[_0x1a73('0x3c')](_0x32eaea,util['format'](_0x1a73('0x41'),_0x558cbd,_0x1a73('0x43')))},function(){rimraf(path[_0x1a73('0x3c')](_0x32eaea,_0x558cbd),function(){});_0x4a0550(_0x1a73('0x44'));});});}})[_0x1a73('0x32')](function(){if(!_0xdfc0c1)return;rimraf(path[_0x1a73('0x3c')](_0x32eaea,_0x558cbd),function(){});})[_0x1a73('0x32')](function(){logger['info'](util['format'](_0x1a73('0x45'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x1a73('0x46'),_0xdfc0c1?util[_0x1a73('0x21')](_0x1a73('0x41'),_0x558cbd,_0xdfc0c1?_0x1a73('0x43'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x1a73('0x47')](util['format'](_0x1a73('0x48'),EXTRACTED_REPORT_ID,_0x1a73('0x49')));return db[_0x1a73('0x13')][_0x1a73('0x4a')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x1a73('0x32')](function(_0x2b8440){EXTRACTED_REPORT=_0x2b8440;return dbH[_0x1a73('0x35')]['query'](util['format'](_0x1a73('0x4b'),QUERY),{'type':dbH[_0x1a73('0x35')][_0x1a73('0x38')][_0x1a73('0x39')]});})[_0x1a73('0x32')](extractReport)[_0x1a73('0x4c')](function(_0x394a6d){logger[_0x1a73('0x47')](util['format'](_0x1a73('0x4d'),EXTRACTED_REPORT_ID,_0x1a73('0x49')),util[_0x1a73('0x4e')](_0x394a6d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1a73('0x4f'));})[_0x1a73('0x50')](function(){process[_0x1a73('0x51')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x183ab8=new PdfPrinter({'Arial':{'normal':__dirname+_0x1a73('0x52'),'bold':__dirname+_0x1a73('0x53'),'italics':__dirname+_0x1a73('0x54'),'bolditalics':__dirname+_0x1a73('0x55')}});return _0x183ab8;}function getPDFDocDefinitionFromHTML(_0x60b50a,_0x25a547){var _0x279997=util['format'](_0x1a73('0x56'),_0x25a547[_0x1a73('0x57')],_0x25a547[_0x1a73('0x58')]);var _0x384c80=moment()[_0x1a73('0x21')]('YYYY-MM-DD')[_0x1a73('0x16')]();var _0x4fffea=htmlToPdfmake(_0x60b50a,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4fffea],'defaultStyle':{'font':_0x1a73('0x2b')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x1a73('0x59'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x1a73('0x59'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x1a73('0x5a'),'style':'header'}];},'footer':function(_0x46ea12,_0x55f413){return[{'text':util[_0x1a73('0x21')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x279997,_0x46ea12,_0x55f413,_0x384c80),'style':_0x1a73('0x2a')}];}};}function writePDFDocument(_0x369634,_0x404f38){return new Promise(function(_0x274aba,_0x18f15c){var _0x539c8f=_0x369634[_0x1a73('0x5b')](fs['createWriteStream'](_0x404f38));_0x539c8f['on']('finish',function(){_0x274aba(_0x1a73('0x5c'));});_0x539c8f['on'](_0x1a73('0x5d'),function(_0x1c6e9c){_0x18f15c(_0x1c6e9c);});_0x369634[_0x1a73('0x5e')]();});}exports[_0x1a73('0x5f')]=function(_0x3cf8fa,_0x2dd27d){var _0x54fdf7=getPDFPrinter();var _0x23eb74=getPDFDocDefinitionFromHTML(_0x3cf8fa,_0x2dd27d);var _0x24558d=_0x54fdf7[_0x1a73('0x60')](_0x23eb74);return writePDFDocument(_0x24558d,_0x2dd27d[_0x1a73('0x2')])[_0x1a73('0x4c')](function(_0x593469){throw _0x593469;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 12ff885..43f3345 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 _0x95ef=['QueryTypes','push','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','split','length','range','isInteger','forEach','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x3cb30b,_0x504b3e){var _0x2ca717=function(_0x32a3d9){while(--_0x32a3d9){_0x3cb30b['push'](_0x3cb30b['shift']());}};_0x2ca717(++_0x504b3e);}(_0x95ef,0x119));var _0xf95e=function(_0x4d71dd,_0x4b1be6){_0x4d71dd=_0x4d71dd-0x0;var _0x2499c4=_0x95ef[_0x4d71dd];return _0x2499c4;};'use strict';var util=require(_0xf95e('0x0'));var path=require('path');var _=require(_0xf95e('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xf95e('0x2'));var zipdir=require(_0xf95e('0x3'));var rimraf=require(_0xf95e('0x4'));var db=require(_0xf95e('0x5'))['db'];var dbH=require(_0xf95e('0x5'))[_0xf95e('0x6')];var logger=require('../../config/logger')(_0xf95e('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xf95e('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3d7422,_0x4d0ce7){var _0xe1af0b={'status':_0x3d7422};var _0x129b34={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4d0ce7){_0xe1af0b[_0xf95e('0x9')]=_0x4d0ce7;}return db[_0xf95e('0xa')]['update'](_0xe1af0b,_0x129b34);}function main(){var _0xb38f3=0x1388;var _0x5a4f94;logger[_0xf95e('0xb')](util[_0xf95e('0xc')](_0xf95e('0xd'),EXTRACTED_REPORT_ID,_0xf95e('0xe')));return db[_0xf95e('0xf')][_0xf95e('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xf95e('0x11')]})['then'](function(_0x9b8d22){if(_0x9b8d22){_0x5a4f94=_0x9b8d22;_0xb38f3=_0x5a4f94['splitSizeXlsx']||0x1388;}})[_0xf95e('0x12')](function(){return dbH['sequelize'][_0xf95e('0x13')](util[_0xf95e('0xc')](_0xf95e('0x14'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xf95e('0x15')]});})[_0xf95e('0x12')](function(_0x2715d4){if(!_0x2715d4[0x0][_0xf95e('0x16')]){return analyticExtractedReport(_0xf95e('0x17'));}var _0x1e6122=[];var _0x159beb=0x0;if(_0x5a4f94[_0xf95e('0x18')]){if(_0x2715d4&&_0x2715d4[_0xf95e('0x19')]){var _0x134dd3=_[_0xf95e('0x1a')](_0x2715d4[0x0]['num']/_0xb38f3);var _0x417f38=Number[_0xf95e('0x1b')](_0x2715d4[0x0]['num']/_0xb38f3)?_0x2715d4[0x0][_0xf95e('0x16')]%_0xb38f3:0x0;_0x134dd3[_0xf95e('0x1c')](function(_0xfe8e8a){if(_0xfe8e8a>0x0){_0x159beb+=_0xb38f3;}_0x1e6122['push'](dbH[_0xf95e('0x1d')][_0xf95e('0x13')](util['format'](_0xf95e('0x1e'),QUERY,_0xb38f3,_0x159beb),{'type':dbH[_0xf95e('0x1d')][_0xf95e('0x1f')][_0xf95e('0x15')]}));});if(_0x417f38>0x0){_0x159beb+=_0xb38f3;_0x1e6122['push'](dbH[_0xf95e('0x1d')][_0xf95e('0x13')](util[_0xf95e('0xc')](_0xf95e('0x1e'),QUERY,_0x417f38,_0x159beb),{'type':dbH[_0xf95e('0x1d')]['QueryTypes']['SELECT']}));}}}else{_0x1e6122[_0xf95e('0x20')](dbH['sequelize'][_0xf95e('0x13')](QUERY,{'type':dbH[_0xf95e('0x1d')][_0xf95e('0x1f')][_0xf95e('0x15')]}));}var _0x583135=path[_0xf95e('0x21')](PATH);var _0x49744b=path[_0xf95e('0x22')](PATH,'.xlsx');var _0x460033=_0x5a4f94['split']&&_0x1e6122[_0xf95e('0x19')]>0x1;var _0x422ed6=[];if(!fs[_0xf95e('0x23')](path[_0xf95e('0x24')](_0x583135,_0x49744b))&&_0x460033){fs[_0xf95e('0x25')](path[_0xf95e('0x24')](_0x583135,_0x49744b));}return BPromise[_0xf95e('0x26')](_0x1e6122,function(_0x292b5a){_0x422ed6['push'](_0x292b5a);})[_0xf95e('0x12')](function(){for(var _0x4c4270=0x0;_0x4c4270<_0x422ed6[_0xf95e('0x19')];_0x4c4270+=0x1){var _0x2d1780;var _0x2f75ea=_0x422ed6[_0x4c4270];if(_0x460033){_0x2d1780=path[_0xf95e('0x24')](_0x583135,_0x49744b,util[_0xf95e('0xc')](_0xf95e('0x27'),_0x49744b,_0x4c4270,_0xf95e('0x28')));}else{_0x2d1780=path[_0xf95e('0x24')](_0x583135,util[_0xf95e('0xc')]('%s.%s',_0x49744b,_0xf95e('0x28')));}fs[_0xf95e('0x29')](_0x2d1780,json2xls(_0x2f75ea),_0xf95e('0x2a'));}})[_0xf95e('0x12')](function(){if(_0x460033){return new Promise(function(_0x1fcd85){zipdir(path[_0xf95e('0x24')](_0x583135,_0x49744b),{'saveTo':path[_0xf95e('0x24')](_0x583135,util[_0xf95e('0xc')](_0xf95e('0x2b'),_0x49744b,_0xf95e('0x2c')))},function(_0x172626,_0x474664){rimraf(path[_0xf95e('0x24')](_0x583135,_0x49744b),function(){});_0x1fcd85('zip\x20finished');});});}})[_0xf95e('0x12')](function(){logger['info'](util['format'](_0xf95e('0x2d'),EXTRACTED_REPORT_ID,_0xf95e('0xe')));return analyticExtractedReport(_0xf95e('0x2e'),_0x460033?util[_0xf95e('0xc')](_0xf95e('0x2b'),_0x49744b,_0x460033?_0xf95e('0x2c'):_0xf95e('0x28')):null);});})[_0xf95e('0x2f')](function(_0x3ace2a){logger['info'](util[_0xf95e('0xc')](_0xf95e('0x30'),EXTRACTED_REPORT_ID,_0xf95e('0xe')),util[_0xf95e('0x31')](_0x3ace2a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xf95e('0x32')](function(){process[_0xf95e('0x33')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x78d5=['../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','length','range','isInteger','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH'];(function(_0x655c6a,_0x380597){var _0x41e4f0=function(_0x269338){while(--_0x269338){_0x655c6a['push'](_0x655c6a['shift']());}};_0x41e4f0(++_0x380597);}(_0x78d5,0x1a8));var _0x578d=function(_0x1b988d,_0x56ae65){_0x1b988d=_0x1b988d-0x0;var _0x43452e=_0x78d5[_0x1b988d];return _0x43452e;};'use strict';var util=require(_0x578d('0x0'));var path=require(_0x578d('0x1'));var _=require(_0x578d('0x2'));var fs=require('fs');var json2xls=require(_0x578d('0x3'));var BPromise=require(_0x578d('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x578d('0x5'));var db=require(_0x578d('0x6'))['db'];var dbH=require('../../mysqldb')[_0x578d('0x7')];var logger=require(_0x578d('0x8'))(_0x578d('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x578d('0xa')][0x2]);var QUERY=process[_0x578d('0xa')][0x3];var PATH=process[_0x578d('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x16d152,_0x52ebea){var _0x310256={'status':_0x16d152};var _0x474fd9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x52ebea){_0x310256[_0x578d('0xb')]=_0x52ebea;}return db[_0x578d('0xc')][_0x578d('0xd')](_0x310256,_0x474fd9);}function main(){var _0x2d6bcf=0x1388;var _0x21a456;logger['info'](util[_0x578d('0xe')](_0x578d('0xf'),EXTRACTED_REPORT_ID,_0x578d('0x10')));return db[_0x578d('0x11')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})['then'](function(_0x5db9ac){if(_0x5db9ac){_0x21a456=_0x5db9ac;_0x2d6bcf=_0x21a456[_0x578d('0x12')]||0x1388;}})[_0x578d('0x13')](function(){return dbH[_0x578d('0x14')]['query'](util[_0x578d('0xe')](_0x578d('0x15'),QUERY),{'type':dbH['sequelize'][_0x578d('0x16')][_0x578d('0x17')]});})['then'](function(_0x5bb445){if(!_0x5bb445[0x0][_0x578d('0x18')]){return analyticExtractedReport(_0x578d('0x19'));}var _0x49d146=[];var _0x45f575=0x0;if(_0x21a456[_0x578d('0x1a')]){if(_0x5bb445&&_0x5bb445[_0x578d('0x1b')]){var _0x4bd329=_[_0x578d('0x1c')](_0x5bb445[0x0][_0x578d('0x18')]/_0x2d6bcf);var _0x3c95ed=Number[_0x578d('0x1d')](_0x5bb445[0x0][_0x578d('0x18')]/_0x2d6bcf)?_0x5bb445[0x0][_0x578d('0x18')]%_0x2d6bcf:0x0;_0x4bd329['forEach'](function(_0x249434){if(_0x249434>0x0){_0x45f575+=_0x2d6bcf;}_0x49d146[_0x578d('0x1e')](dbH[_0x578d('0x14')][_0x578d('0x1f')](util[_0x578d('0xe')](_0x578d('0x20'),QUERY,_0x2d6bcf,_0x45f575),{'type':dbH['sequelize'][_0x578d('0x16')][_0x578d('0x17')]}));});if(_0x3c95ed>0x0){_0x45f575+=_0x2d6bcf;_0x49d146[_0x578d('0x1e')](dbH[_0x578d('0x14')][_0x578d('0x1f')](util[_0x578d('0xe')](_0x578d('0x20'),QUERY,_0x3c95ed,_0x45f575),{'type':dbH[_0x578d('0x14')][_0x578d('0x16')][_0x578d('0x17')]}));}}}else{_0x49d146[_0x578d('0x1e')](dbH[_0x578d('0x14')][_0x578d('0x1f')](QUERY,{'type':dbH[_0x578d('0x14')]['QueryTypes'][_0x578d('0x17')]}));}var _0x28b936=path[_0x578d('0x21')](PATH);var _0x396ec7=path[_0x578d('0x22')](PATH,_0x578d('0x23'));var _0x355d3c=_0x21a456[_0x578d('0x1a')]&&_0x49d146[_0x578d('0x1b')]>0x1;var _0x46b926=[];if(!fs[_0x578d('0x24')](path[_0x578d('0x25')](_0x28b936,_0x396ec7))&&_0x355d3c){fs[_0x578d('0x26')](path[_0x578d('0x25')](_0x28b936,_0x396ec7));}return BPromise[_0x578d('0x27')](_0x49d146,function(_0x21168f){_0x46b926[_0x578d('0x1e')](_0x21168f);})['then'](function(){for(var _0x2353bc=0x0;_0x2353bc<_0x46b926[_0x578d('0x1b')];_0x2353bc+=0x1){var _0x5f5c60;var _0x1972d6=_0x46b926[_0x2353bc];if(_0x355d3c){_0x5f5c60=path[_0x578d('0x25')](_0x28b936,_0x396ec7,util[_0x578d('0xe')](_0x578d('0x28'),_0x396ec7,_0x2353bc,'xlsx'));}else{_0x5f5c60=path[_0x578d('0x25')](_0x28b936,util[_0x578d('0xe')](_0x578d('0x29'),_0x396ec7,_0x578d('0x2a')));}fs[_0x578d('0x2b')](_0x5f5c60,json2xls(_0x1972d6),_0x578d('0x2c'));}})[_0x578d('0x13')](function(){if(_0x355d3c){return new Promise(function(_0x2b551b){zipdir(path[_0x578d('0x25')](_0x28b936,_0x396ec7),{'saveTo':path['join'](_0x28b936,util['format'](_0x578d('0x29'),_0x396ec7,_0x578d('0x2d')))},function(_0x5a9dcb,_0x4ee5dd){rimraf(path[_0x578d('0x25')](_0x28b936,_0x396ec7),function(){});_0x2b551b(_0x578d('0x2e'));});});}})[_0x578d('0x13')](function(){logger[_0x578d('0x2f')](util[_0x578d('0xe')](_0x578d('0x30'),EXTRACTED_REPORT_ID,_0x578d('0x10')));return analyticExtractedReport(_0x578d('0x31'),_0x355d3c?util['format']('%s.%s',_0x396ec7,_0x355d3c?_0x578d('0x2d'):_0x578d('0x2a')):null);});})['catch'](function(_0x576505){logger[_0x578d('0x2f')](util[_0x578d('0xe')](_0x578d('0x32'),EXTRACTED_REPORT_ID,_0x578d('0x10')),util[_0x578d('0x33')](_0x576505,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x578d('0x34'));})['finally'](function(){process[_0x578d('0x35')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index e7f8a3b..111a889 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 _0xb45e=['rewrite','lodash','models','findAll','then','IntervalId','filter','exten','queue','playback','hasOwnProperty','priority','extension','find','extensions','push','type','Set','CDR(type)=%s','context','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','VoiceExtensionId','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','map','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','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','Hangup','concat','destroy','VoiceExtension','bulkCreate','catch','error'];(function(_0x47ad08,_0x28fcd1){var _0x302699=function(_0x45a213){while(--_0x45a213){_0x47ad08['push'](_0x47ad08['shift']());}};_0x302699(++_0x28fcd1);}(_0xb45e,0x119));var _0xeb45=function(_0x4d2f19,_0x7911bb){_0x4d2f19=_0x4d2f19-0x0;var _0x402a0c=_0xb45e[_0x4d2f19];return _0x402a0c;};'use strict';var _=require(_0xeb45('0x0'));var util=require('util');function rewrite(_0x3283d3,_0x25a38c){var _0x13e389=this;return _0x3283d3[_0xeb45('0x1')]['Interval'][_0xeb45('0x2')]({'raw':!![]})[_0xeb45('0x3')](function(_0x8c362f){_0x13e389['intervals']=_0x8c362f;return _0x3283d3['models']['VoiceExtension']['findAll']({'where':{'IntervalId':_0x25a38c[_0xeb45('0x4')]},'raw':!![]});})['then'](function(_0x138b32){return _0x3283d3['models']['VoiceExtension'][_0xeb45('0x2')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x138b32,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xeb45('0x3')](function(_0x54e004){var _0x22fac3=_[_0xeb45('0x5')](_0x54e004,{'priority':'1'});var _0x4587be=_[_0xeb45('0x5')](_0x54e004,{'isApp':0x1});var _0x56cf4c=_['groupBy'](_0x4587be,_0xeb45('0x6'));var _0x33d106=[_0xeb45('0x7'),_0xeb45('0x8')];var _0x2fdc59=[];var _0x12b5f5=[];for(var _0x23dcf1 in _0x56cf4c){if(_0x56cf4c[_0xeb45('0x9')](_0x23dcf1)){_0x13e389[_0xeb45('0xa')]=0x2;_0x13e389['extensions']=[];_0x13e389[_0xeb45('0xb')]=_[_0xeb45('0xc')](_0x22fac3,{'exten':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x6')]});_0x13e389[_0xeb45('0xd')][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':_0xeb45('0x10'),'appdata':util['format'](_0xeb45('0x11'),_0x56cf4c[_0x23dcf1][0x0]['type']),'context':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x12')],'exten':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x6')],'priority':_0x13e389[_0xeb45('0xa')]++,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0]['VoiceExtensionId']});if(_0x56cf4c[_0x23dcf1][0x0]['type']===_0xeb45('0x13')){_0x13e389['extensions'][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':'Set','appdata':_0xeb45('0x14')+_0x56cf4c[_0x23dcf1][0x0]['VoiceExtensionId'],'context':_0x56cf4c[_0x23dcf1][0x0]['context'],'exten':_0x56cf4c[_0x23dcf1][0x0]['exten'],'priority':_0x13e389[_0xeb45('0xa')]++,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0]['VoiceExtensionId']});}else if(_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')]===_0xeb45('0x15')){if(_0x13e389[_0xeb45('0xb')]){_0x13e389[_0xeb45('0xd')]['push']({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':_0xeb45('0x10'),'appdata':_0xeb45('0x16')+(_0x13e389[_0xeb45('0xb')][_0xeb45('0x17')]?_0xeb45('0x18')+_0x13e389[_0xeb45('0xb')][_0xeb45('0x17')]+'}':_0xeb45('0x19')),'context':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x12')],'exten':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x6')],'priority':_0x13e389[_0xeb45('0xa')]++,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0]['VoiceExtensionId']});}_0x13e389[_0xeb45('0xd')][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':_0xeb45('0x10'),'appdata':'CDR(routeid)='+_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')],'context':_0x56cf4c[_0x23dcf1][0x0]['context'],'exten':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x6')],'priority':_0x13e389[_0xeb45('0xa')]++,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')]});var _0x271fce=_0x13e389[_0xeb45('0xa')]++;_0x13e389['extensions'][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':_0xeb45('0x1b'),'appdata':_0xeb45('0x1c')+(_0x271fce+0x2)+_0xeb45('0x1d')+(_0x271fce+0x1)+')','context':_0x56cf4c[_0x23dcf1][0x0]['context'],'exten':_0x56cf4c[_0x23dcf1][0x0]['exten'],'priority':_0x271fce,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')]});if(_0x13e389[_0xeb45('0xb')]){_0x13e389[_0xeb45('0xd')][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':_0xeb45('0x10'),'appdata':_0x13e389[_0xeb45('0xb')][_0xeb45('0x17')]?_0xeb45('0x1e')+_0x13e389[_0xeb45('0xb')][_0xeb45('0x17')]+'}':'CDR(prefix)=noprefix','context':_0x56cf4c[_0x23dcf1][0x0]['context'],'exten':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x6')],'priority':_0x13e389['priority']++,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')]});}_0x13e389['extensions'][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':'Set','appdata':_0xeb45('0x1f')+_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')],'context':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x12')],'exten':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x6')],'priority':_0x13e389[_0xeb45('0xa')]++,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')]});if(_0x13e389['extension']&&_0x13e389['extension'][_0xeb45('0x9')](_0xeb45('0x20'))&&_0x13e389[_0xeb45('0xb')][_0xeb45('0x20')]!==_0xeb45('0x21')){_0x13e389[_0xeb45('0xd')][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':_0xeb45('0x10'),'appdata':_0xeb45('0x22'),'context':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x12')],'exten':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x6')],'priority':_0x13e389[_0xeb45('0xa')]++,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')]});_0x13e389[_0xeb45('0xd')][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':_0xeb45('0x10'),'appdata':_0xeb45('0x23')+_0x13e389['extension'][_0xeb45('0x20')]||_0xeb45('0x24'),'context':_0x56cf4c[_0x23dcf1][0x0]['context'],'exten':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x6')],'priority':_0x13e389[_0xeb45('0xa')]++,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')]});}}_0x13e389[_0xeb45('0xd')][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':'Set','appdata':_0xeb45('0x25'),'context':_0x56cf4c[_0x23dcf1][0x0]['context'],'exten':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x6')],'priority':_0x13e389[_0xeb45('0xa')]++,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0]['VoiceExtensionId']});_0x13e389[_0xeb45('0xd')][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':_0xeb45('0x10'),'appdata':_0xeb45('0x26'),'context':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x12')],'exten':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x6')],'priority':_0x13e389[_0xeb45('0xa')]++,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')]});_0x13e389['extensions'][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0]['type'],'app':'Set','appdata':_0xeb45('0x27'),'context':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x12')],'exten':_0x56cf4c[_0x23dcf1][0x0]['exten'],'priority':_0x13e389[_0xeb45('0xa')]++,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')]});for(var _0x3b9ad1=0x0,_0x3b3279=0x0;_0x3b9ad1<_0x56cf4c[_0x23dcf1][_0xeb45('0x28')];_0x3b9ad1+=0x1,_0x3b3279=0x0){var _0x17ffdf=_0x56cf4c[_0x23dcf1][_0x3b9ad1];if(_0x17ffdf[_0xeb45('0xf')]){_0x17ffdf['type']=_0x17ffdf[_0xeb45('0xf')][_0xeb45('0x29')]();}var _0x3b9b75=[];var _0x6a91bf=[];delete _0x17ffdf['id'];delete _0x17ffdf[_0xeb45('0x2a')];delete _0x17ffdf[_0xeb45('0x2b')];var _0x3c9d17=_0x17ffdf[_0xeb45('0x2c')]!==_0xeb45('0x2d')?[_0x17ffdf[_0xeb45('0x2c')]]:_0x17ffdf[_0xeb45('0x4')]?_[_0xeb45('0x2e')](_[_0xeb45('0x5')](_0x13e389['intervals'],{'IntervalId':_0x17ffdf[_0xeb45('0x4')]}),'interval'):[];if(_0x17ffdf[_0xeb45('0x9')](_0xeb45('0x2f'))){if(_0x17ffdf[_0xeb45('0x2f')]&&_0x17ffdf[_0xeb45('0x2f')]!=='--'){_0x3b9b75[_0xeb45('0xe')]({'type':_0x17ffdf[_0xeb45('0xf')],'app':_0xeb45('0x10'),'appdata':_0xeb45('0x30')+_0x17ffdf['tag'],'context':_0x17ffdf[_0xeb45('0x12')],'exten':_0x17ffdf[_0xeb45('0x6')],'priority':_0x3c9d17['length']+_0x13e389['priority']+_0x3b3279++,'VoiceExtensionId':_0x17ffdf[_0xeb45('0x1a')]});}}if(_0x17ffdf[_0xeb45('0xf')]===_0xeb45('0x15')&&_0x17ffdf['hasOwnProperty'](_0xeb45('0x31'))){if(_0x17ffdf['callerID']){_0x3b9b75[_0xeb45('0xe')]({'type':_0x17ffdf[_0xeb45('0xf')],'app':'ExecIf','appdata':_0xeb45('0x32')+_0x17ffdf['callerID']+')','context':_0x17ffdf[_0xeb45('0x12')],'exten':_0x17ffdf[_0xeb45('0x6')],'priority':_0x3c9d17[_0xeb45('0x28')]+_0x13e389[_0xeb45('0xa')]+_0x3b3279++,'VoiceExtensionId':_0x17ffdf[_0xeb45('0x1a')]});}else{_0x3b9b75[_0xeb45('0xe')]({'type':_0x17ffdf[_0xeb45('0xf')],'app':'ExecIf','appdata':_0xeb45('0x33'),'context':_0x17ffdf[_0xeb45('0x12')],'exten':_0x17ffdf[_0xeb45('0x6')],'priority':_0x3c9d17[_0xeb45('0x28')]+_0x13e389[_0xeb45('0xa')]+_0x3b3279++,'VoiceExtensionId':_0x17ffdf[_0xeb45('0x1a')]});}}if(_0x17ffdf['hasOwnProperty'](_0xeb45('0x34'))){if(_0x33d106[_0xeb45('0x35')](_0x17ffdf['app'][_0xeb45('0x29')]())>=0x0&&_0x17ffdf[_0xeb45('0x36')]!=='custom'){if(_0x17ffdf['answer']){_0x3b9b75['push']({'type':_0x17ffdf[_0xeb45('0xf')],'app':_0xeb45('0x1b'),'appdata':_0xeb45('0x37'),'context':_0x17ffdf['context'],'exten':_0x17ffdf[_0xeb45('0x6')],'priority':_0x3c9d17['length']+_0x13e389[_0xeb45('0xa')]+_0x3b3279++,'VoiceExtensionId':_0x17ffdf[_0xeb45('0x1a')]});_0x3b9b75[_0xeb45('0xe')]({'type':_0x17ffdf[_0xeb45('0xf')],'app':_0xeb45('0x10'),'appdata':_0xeb45('0x38'),'context':_0x17ffdf['context'],'exten':_0x17ffdf[_0xeb45('0x6')],'priority':_0x3c9d17[_0xeb45('0x28')]+_0x13e389['priority']+_0x3b3279++,'VoiceExtensionId':_0x17ffdf[_0xeb45('0x1a')]});}else{_0x3b9b75[_0xeb45('0xe')]({'type':_0x17ffdf[_0xeb45('0xf')],'app':'ExecIf','appdata':_0xeb45('0x39'),'context':_0x17ffdf[_0xeb45('0x12')],'exten':_0x17ffdf[_0xeb45('0x6')],'priority':_0x3c9d17[_0xeb45('0x28')]+_0x13e389[_0xeb45('0xa')]+_0x3b3279++,'VoiceExtensionId':_0x17ffdf[_0xeb45('0x1a')]});_0x3b9b75[_0xeb45('0xe')]({'type':_0x17ffdf[_0xeb45('0xf')],'app':_0xeb45('0x10'),'appdata':_0xeb45('0x3a'),'context':_0x17ffdf[_0xeb45('0x12')],'exten':_0x17ffdf[_0xeb45('0x6')],'priority':_0x3c9d17['length']+_0x13e389[_0xeb45('0xa')]+_0x3b3279++,'VoiceExtensionId':_0x17ffdf[_0xeb45('0x1a')]});}}}for(var _0x19613c=0x0;_0x19613c<_0x3c9d17[_0xeb45('0x28')];_0x19613c+=0x1){var _0x5a3394=_0x13e389[_0xeb45('0xa')]+_0x3c9d17[_0xeb45('0x28')];var _0x25db6d=_0x19613c===_0x3c9d17[_0xeb45('0x28')]-0x1?_0x13e389[_0xeb45('0xa')]+_0x3b9b75[_0xeb45('0x28')]+_0x6a91bf[_0xeb45('0x28')]+0x2:_0x13e389['priority']+_0x19613c+0x1;_0x3b9b75[_0xeb45('0x3b')](_0x19613c,0x0,{'type':_0x17ffdf[_0xeb45('0xf')],'app':'GotoIfTime','appdata':_0x3c9d17[_0x19613c]+'?'+_0x17ffdf[_0xeb45('0x12')]+_0xeb45('0x3c')+_0x5a3394+':'+_0x17ffdf[_0xeb45('0x12')]+_0xeb45('0x3c')+_0x25db6d,'exten':_0x17ffdf['exten'],'context':_0x17ffdf[_0xeb45('0x12')],'priority':_0x13e389['priority']+_0x19613c,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')]});}_0x17ffdf['priority']=_0x3b9b75[_0xeb45('0x28')]?_[_0xeb45('0x3d')](_0x3b9b75)[_0xeb45('0xa')]+0x1:_0x13e389[_0xeb45('0xa')];_0x13e389[_0xeb45('0xa')]=(_0x6a91bf[_0xeb45('0x28')]?_[_0xeb45('0x3d')](_0x6a91bf)['priority']:_0x17ffdf[_0xeb45('0xa')])+0x1;_0x13e389[_0xeb45('0xd')]=_['concat'](_0x13e389[_0xeb45('0xd')],_0x3b9b75,[_0x17ffdf],_0x6a91bf);}_0x13e389[_0xeb45('0xd')][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':_0xeb45('0x3e'),'exten':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x6')],'context':_0x56cf4c[_0x23dcf1][0x0]['context'],'priority':_0x13e389['priority'],'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')]});_0x2fdc59[_0xeb45('0xe')](_0x56cf4c[_0x23dcf1][0x0]['VoiceExtensionId']);_0x12b5f5=_[_0xeb45('0x3f')](_0x12b5f5,_0x13e389['extensions']);}}return _0x3283d3['transaction'](function(_0x3db610){return _0x3283d3[_0xeb45('0x1')]['VoiceExtension'][_0xeb45('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x2fdc59}},'transaction':_0x3db610})['then'](function(_0x550fb8){return _0x3283d3[_0xeb45('0x1')][_0xeb45('0x41')][_0xeb45('0x42')](_['sortBy'](_0x12b5f5,_0xeb45('0xa')),{'transaction':_0x3db610});});});})[_0xeb45('0x43')](function(_0x545866){console[_0xeb45('0x44')](_0x545866);});}exports[_0xeb45('0x45')]=rewrite; \ No newline at end of file +var _0x0d0d=['*,*,*,*','intervals','hasOwnProperty','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)','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extension','find','extensions','push','type','format','CDR(type)=%s','context','VoiceExtensionId','inbound','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','Set','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval'];(function(_0x24c412,_0x2f0c2e){var _0x5cb102=function(_0x3c7eb2){while(--_0x3c7eb2){_0x24c412['push'](_0x24c412['shift']());}};_0x5cb102(++_0x2f0c2e);}(_0x0d0d,0x68));var _0xd0d0=function(_0x25f14e,_0x302377){_0x25f14e=_0x25f14e-0x0;var _0x1dac47=_0x0d0d[_0x25f14e];return _0x1dac47;};'use strict';var _=require(_0xd0d0('0x0'));var util=require(_0xd0d0('0x1'));function rewrite(_0xf951d5,_0x1f89db){var _0x451262=this;return _0xf951d5[_0xd0d0('0x2')][_0xd0d0('0x3')][_0xd0d0('0x4')]({'raw':!![]})[_0xd0d0('0x5')](function(_0x3ec5b5){_0x451262['intervals']=_0x3ec5b5;return _0xf951d5[_0xd0d0('0x2')][_0xd0d0('0x6')][_0xd0d0('0x4')]({'where':{'IntervalId':_0x1f89db[_0xd0d0('0x7')]},'raw':!![]});})[_0xd0d0('0x5')](function(_0x311e4d){return _0xf951d5['models'][_0xd0d0('0x6')]['findAll']({'where':{'exten':{'$in':_[_0xd0d0('0x8')](_[_0xd0d0('0x9')](_0x311e4d,_0xd0d0('0xa')))}},'order':[{'raw':_0xd0d0('0xb')}],'raw':!![]});})[_0xd0d0('0x5')](function(_0x484d79){var _0x285e94=_[_0xd0d0('0xc')](_0x484d79,{'priority':'1'});var _0x153b82=_['filter'](_0x484d79,{'isApp':0x1});var _0x2272a8=_[_0xd0d0('0xd')](_0x153b82,_0xd0d0('0xa'));var _0x171985=[_0xd0d0('0xe'),_0xd0d0('0xf')];var _0x50a294=[];var _0x5b2b26=[];for(var _0x2dfc57 in _0x2272a8){if(_0x2272a8['hasOwnProperty'](_0x2dfc57)){_0x451262[_0xd0d0('0x10')]=0x2;_0x451262['extensions']=[];_0x451262[_0xd0d0('0x11')]=_[_0xd0d0('0x12')](_0x285e94,{'exten':_0x2272a8[_0x2dfc57][0x0]['exten']});_0x451262[_0xd0d0('0x13')][_0xd0d0('0x14')]({'type':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x15')],'app':'Set','appdata':util[_0xd0d0('0x16')](_0xd0d0('0x17'),_0x2272a8[_0x2dfc57][0x0]['type']),'context':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x18')],'exten':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0xa')],'priority':_0x451262['priority']++,'VoiceExtensionId':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x19')]});if(_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x15')]===_0xd0d0('0x1a')){_0x451262['extensions']['push']({'type':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x15')],'app':'Set','appdata':'CDR(routeid)='+_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x19')],'context':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x18')],'exten':_0x2272a8[_0x2dfc57][0x0]['exten'],'priority':_0x451262[_0xd0d0('0x10')]++,'VoiceExtensionId':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x19')]});}else if(_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x15')]===_0xd0d0('0x1b')){if(_0x451262[_0xd0d0('0x11')]){_0x451262[_0xd0d0('0x13')][_0xd0d0('0x14')]({'type':_0x2272a8[_0x2dfc57][0x0]['type'],'app':'Set','appdata':_0xd0d0('0x1c')+(_0x451262[_0xd0d0('0x11')][_0xd0d0('0x1d')]?_0xd0d0('0x1e')+_0x451262[_0xd0d0('0x11')]['cutdigits']+'}':_0xd0d0('0x1f')),'context':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x18')],'exten':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0xa')],'priority':_0x451262[_0xd0d0('0x10')]++,'VoiceExtensionId':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x19')]});}_0x451262[_0xd0d0('0x13')]['push']({'type':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x15')],'app':_0xd0d0('0x20'),'appdata':'CDR(routeid)='+_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x19')],'context':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x18')],'exten':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0xa')],'priority':_0x451262['priority']++,'VoiceExtensionId':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x19')]});var _0x4162af=_0x451262[_0xd0d0('0x10')]++;_0x451262['extensions'][_0xd0d0('0x14')]({'type':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x15')],'app':_0xd0d0('0x21'),'appdata':_0xd0d0('0x22')+(_0x4162af+0x2)+_0xd0d0('0x23')+(_0x4162af+0x1)+')','context':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x18')],'exten':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0xa')],'priority':_0x4162af,'VoiceExtensionId':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x19')]});if(_0x451262[_0xd0d0('0x11')]){_0x451262[_0xd0d0('0x13')][_0xd0d0('0x14')]({'type':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x15')],'app':_0xd0d0('0x20'),'appdata':_0x451262[_0xd0d0('0x11')][_0xd0d0('0x1d')]?_0xd0d0('0x24')+_0x451262['extension'][_0xd0d0('0x1d')]+'}':_0xd0d0('0x25'),'context':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x18')],'exten':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0xa')],'priority':_0x451262['priority']++,'VoiceExtensionId':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x19')]});}_0x451262['extensions'][_0xd0d0('0x14')]({'type':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x15')],'app':_0xd0d0('0x20'),'appdata':_0xd0d0('0x26')+_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x19')],'context':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x18')],'exten':_0x2272a8[_0x2dfc57][0x0]['exten'],'priority':_0x451262[_0xd0d0('0x10')]++,'VoiceExtensionId':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x19')]});if(_0x451262[_0xd0d0('0x11')]&&_0x451262['extension']['hasOwnProperty'](_0xd0d0('0x27'))&&_0x451262[_0xd0d0('0x11')][_0xd0d0('0x27')]!==_0xd0d0('0x28')){_0x451262['extensions'][_0xd0d0('0x14')]({'type':_0x2272a8[_0x2dfc57][0x0]['type'],'app':'Set','appdata':_0xd0d0('0x29'),'context':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x18')],'exten':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0xa')],'priority':_0x451262[_0xd0d0('0x10')]++,'VoiceExtensionId':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x19')]});_0x451262[_0xd0d0('0x13')][_0xd0d0('0x14')]({'type':_0x2272a8[_0x2dfc57][0x0]['type'],'app':'Set','appdata':_0xd0d0('0x2a')+_0x451262[_0xd0d0('0x11')][_0xd0d0('0x27')]||_0xd0d0('0x2b'),'context':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x18')],'exten':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0xa')],'priority':_0x451262['priority']++,'VoiceExtensionId':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x19')]});}}_0x451262[_0xd0d0('0x13')][_0xd0d0('0x14')]({'type':_0x2272a8[_0x2dfc57][0x0]['type'],'app':_0xd0d0('0x20'),'appdata':_0xd0d0('0x2c'),'context':_0x2272a8[_0x2dfc57][0x0]['context'],'exten':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0xa')],'priority':_0x451262[_0xd0d0('0x10')]++,'VoiceExtensionId':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x19')]});_0x451262[_0xd0d0('0x13')]['push']({'type':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x15')],'app':_0xd0d0('0x20'),'appdata':_0xd0d0('0x2d'),'context':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x18')],'exten':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0xa')],'priority':_0x451262[_0xd0d0('0x10')]++,'VoiceExtensionId':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x19')]});_0x451262[_0xd0d0('0x13')][_0xd0d0('0x14')]({'type':_0x2272a8[_0x2dfc57][0x0]['type'],'app':_0xd0d0('0x20'),'appdata':_0xd0d0('0x2e'),'context':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x18')],'exten':_0x2272a8[_0x2dfc57][0x0]['exten'],'priority':_0x451262[_0xd0d0('0x10')]++,'VoiceExtensionId':_0x2272a8[_0x2dfc57][0x0]['VoiceExtensionId']});for(var _0x584eb6=0x0,_0x3cccd3=0x0;_0x584eb6<_0x2272a8[_0x2dfc57][_0xd0d0('0x2f')];_0x584eb6+=0x1,_0x3cccd3=0x0){var _0x3535ef=_0x2272a8[_0x2dfc57][_0x584eb6];if(_0x3535ef['type']){_0x3535ef[_0xd0d0('0x15')]=_0x3535ef[_0xd0d0('0x15')][_0xd0d0('0x30')]();}var _0x219ffe=[];var _0x1fb147=[];delete _0x3535ef['id'];delete _0x3535ef[_0xd0d0('0x31')];delete _0x3535ef[_0xd0d0('0x32')];var _0x26a71f=_0x3535ef[_0xd0d0('0x33')]!==_0xd0d0('0x34')?[_0x3535ef['interval']]:_0x3535ef[_0xd0d0('0x7')]?_[_0xd0d0('0x9')](_[_0xd0d0('0xc')](_0x451262[_0xd0d0('0x35')],{'IntervalId':_0x3535ef['IntervalId']}),_0xd0d0('0x33')):[];if(_0x3535ef[_0xd0d0('0x36')](_0xd0d0('0x37'))){if(_0x3535ef[_0xd0d0('0x37')]&&_0x3535ef[_0xd0d0('0x37')]!=='--'){_0x219ffe['push']({'type':_0x3535ef['type'],'app':_0xd0d0('0x20'),'appdata':_0xd0d0('0x38')+_0x3535ef[_0xd0d0('0x37')],'context':_0x3535ef[_0xd0d0('0x18')],'exten':_0x3535ef['exten'],'priority':_0x26a71f[_0xd0d0('0x2f')]+_0x451262['priority']+_0x3cccd3++,'VoiceExtensionId':_0x3535ef[_0xd0d0('0x19')]});}}if(_0x3535ef[_0xd0d0('0x15')]==='outbound'&&_0x3535ef['hasOwnProperty']('callerID')){if(_0x3535ef[_0xd0d0('0x39')]){_0x219ffe['push']({'type':_0x3535ef['type'],'app':_0xd0d0('0x21'),'appdata':_0xd0d0('0x3a')+_0x3535ef[_0xd0d0('0x39')]+')','context':_0x3535ef[_0xd0d0('0x18')],'exten':_0x3535ef['exten'],'priority':_0x26a71f[_0xd0d0('0x2f')]+_0x451262['priority']+_0x3cccd3++,'VoiceExtensionId':_0x3535ef[_0xd0d0('0x19')]});}else{_0x219ffe[_0xd0d0('0x14')]({'type':_0x3535ef[_0xd0d0('0x15')],'app':_0xd0d0('0x21'),'appdata':_0xd0d0('0x3b'),'context':_0x3535ef[_0xd0d0('0x18')],'exten':_0x3535ef[_0xd0d0('0xa')],'priority':_0x26a71f[_0xd0d0('0x2f')]+_0x451262[_0xd0d0('0x10')]+_0x3cccd3++,'VoiceExtensionId':_0x3535ef[_0xd0d0('0x19')]});}}if(_0x3535ef['hasOwnProperty']('answer')){if(_0x171985['indexOf'](_0x3535ef['app'][_0xd0d0('0x30')]())>=0x0&&_0x3535ef[_0xd0d0('0x3c')]!==_0xd0d0('0x3d')){if(_0x3535ef['answer']){_0x219ffe[_0xd0d0('0x14')]({'type':_0x3535ef[_0xd0d0('0x15')],'app':_0xd0d0('0x21'),'appdata':_0xd0d0('0x3e'),'context':_0x3535ef[_0xd0d0('0x18')],'exten':_0x3535ef[_0xd0d0('0xa')],'priority':_0x26a71f['length']+_0x451262[_0xd0d0('0x10')]+_0x3cccd3++,'VoiceExtensionId':_0x3535ef[_0xd0d0('0x19')]});_0x219ffe['push']({'type':_0x3535ef[_0xd0d0('0x15')],'app':_0xd0d0('0x20'),'appdata':_0xd0d0('0x3f'),'context':_0x3535ef[_0xd0d0('0x18')],'exten':_0x3535ef['exten'],'priority':_0x26a71f[_0xd0d0('0x2f')]+_0x451262[_0xd0d0('0x10')]+_0x3cccd3++,'VoiceExtensionId':_0x3535ef[_0xd0d0('0x19')]});}else{_0x219ffe[_0xd0d0('0x14')]({'type':_0x3535ef[_0xd0d0('0x15')],'app':_0xd0d0('0x21'),'appdata':_0xd0d0('0x40'),'context':_0x3535ef[_0xd0d0('0x18')],'exten':_0x3535ef['exten'],'priority':_0x26a71f[_0xd0d0('0x2f')]+_0x451262[_0xd0d0('0x10')]+_0x3cccd3++,'VoiceExtensionId':_0x3535ef[_0xd0d0('0x19')]});_0x219ffe[_0xd0d0('0x14')]({'type':_0x3535ef[_0xd0d0('0x15')],'app':_0xd0d0('0x20'),'appdata':_0xd0d0('0x41'),'context':_0x3535ef[_0xd0d0('0x18')],'exten':_0x3535ef['exten'],'priority':_0x26a71f[_0xd0d0('0x2f')]+_0x451262[_0xd0d0('0x10')]+_0x3cccd3++,'VoiceExtensionId':_0x3535ef['VoiceExtensionId']});}}}for(var _0x4c2e36=0x0;_0x4c2e36<_0x26a71f['length'];_0x4c2e36+=0x1){var _0xe52479=_0x451262[_0xd0d0('0x10')]+_0x26a71f[_0xd0d0('0x2f')];var _0x556303=_0x4c2e36===_0x26a71f[_0xd0d0('0x2f')]-0x1?_0x451262[_0xd0d0('0x10')]+_0x219ffe['length']+_0x1fb147[_0xd0d0('0x2f')]+0x2:_0x451262['priority']+_0x4c2e36+0x1;_0x219ffe[_0xd0d0('0x42')](_0x4c2e36,0x0,{'type':_0x3535ef[_0xd0d0('0x15')],'app':_0xd0d0('0x43'),'appdata':_0x26a71f[_0x4c2e36]+'?'+_0x3535ef[_0xd0d0('0x18')]+',${EXTEN},'+_0xe52479+':'+_0x3535ef[_0xd0d0('0x18')]+_0xd0d0('0x44')+_0x556303,'exten':_0x3535ef[_0xd0d0('0xa')],'context':_0x3535ef[_0xd0d0('0x18')],'priority':_0x451262[_0xd0d0('0x10')]+_0x4c2e36,'VoiceExtensionId':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x19')]});}_0x3535ef['priority']=_0x219ffe[_0xd0d0('0x2f')]?_['last'](_0x219ffe)[_0xd0d0('0x10')]+0x1:_0x451262[_0xd0d0('0x10')];_0x451262[_0xd0d0('0x10')]=(_0x1fb147[_0xd0d0('0x2f')]?_[_0xd0d0('0x45')](_0x1fb147)[_0xd0d0('0x10')]:_0x3535ef[_0xd0d0('0x10')])+0x1;_0x451262[_0xd0d0('0x13')]=_[_0xd0d0('0x46')](_0x451262[_0xd0d0('0x13')],_0x219ffe,[_0x3535ef],_0x1fb147);}_0x451262[_0xd0d0('0x13')][_0xd0d0('0x14')]({'type':_0x2272a8[_0x2dfc57][0x0]['type'],'app':_0xd0d0('0x47'),'exten':_0x2272a8[_0x2dfc57][0x0]['exten'],'context':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x18')],'priority':_0x451262['priority'],'VoiceExtensionId':_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x19')]});_0x50a294[_0xd0d0('0x14')](_0x2272a8[_0x2dfc57][0x0][_0xd0d0('0x19')]);_0x5b2b26=_[_0xd0d0('0x46')](_0x5b2b26,_0x451262[_0xd0d0('0x13')]);}}return _0xf951d5[_0xd0d0('0x48')](function(_0x54ec47){return _0xf951d5['models'][_0xd0d0('0x6')][_0xd0d0('0x49')]({'where':{'VoiceExtensionId':{'$in':_0x50a294}},'transaction':_0x54ec47})[_0xd0d0('0x5')](function(_0x16738a){return _0xf951d5[_0xd0d0('0x2')][_0xd0d0('0x6')][_0xd0d0('0x4a')](_[_0xd0d0('0x4b')](_0x5b2b26,_0xd0d0('0x10')),{'transaction':_0x54ec47});});});})[_0xd0d0('0x4c')](function(_0x3783ac){console['error'](_0x3783ac);});}exports[_0xd0d0('0x4d')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 2ca8aa4..6b6727e 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 _0x51bb=['scheduledAt','ContactId','createdAt','updatedAt','select','NOW()','toString','field','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','cm_contacts','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','insert','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','outbound','BlackLists','get','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','resume','resolve','unlinkSync','exit','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','CSV\x20parsed\x20correctly!','info','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','papaparse','ioredis','../../../config/environment','../../../config/logger','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','hasOwnProperty','data','firstName','firstName\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','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','phone'];(function(_0x180659,_0xa1b1c4){var _0x224761=function(_0xe29201){while(--_0xe29201){_0x180659['push'](_0x180659['shift']());}};_0x224761(++_0xa1b1c4);}(_0x51bb,0x179));var _0xb51b=function(_0x19a328,_0xee41ab){_0x19a328=_0x19a328-0x0;var _0x3cba4d=_0x51bb[_0x19a328];return _0x3cba4d;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xb51b('0x0'));var fs=require('fs');var squel=require('squel');var Papa=require(_0xb51b('0x1'));var Redis=require(_0xb51b('0x2'));var db=require('../../../mysqldb')['db'];var config=require(_0xb51b('0x3'));var logger=require(_0xb51b('0x4'))('api');config['redis']=_[_0xb51b('0x5')](config['redis'],{'host':_0xb51b('0x6'),'port':0x18eb});var socket=require(_0xb51b('0x7'))(new Redis(config['redis']));require(_0xb51b('0x8'))[_0xb51b('0x9')](socket);try{if(!process['argv'][0x2]||process[_0xb51b('0xa')][0x2]===_0xb51b('0xb')||process['argv'][0x2]==='null'){throw new Error(_0xb51b('0xc'));}var FILEPATH=process['argv'][0x2];if(!process[_0xb51b('0xa')][0x3]||process['argv'][0x3]===_0xb51b('0xb')||process[_0xb51b('0xa')][0x3]===_0xb51b('0xd')||!process[_0xb51b('0xa')][0x4]||process[_0xb51b('0xa')][0x4]===_0xb51b('0xb')||process['argv'][0x4]===_0xb51b('0xd')){throw new Error(_0xb51b('0xe'));}var FIELDS=_[_0xb51b('0xf')](process['argv'][0x3][_0xb51b('0x10')](','),process['argv'][0x4][_0xb51b('0x10')](','));if(!process['argv'][0x5]||process[_0xb51b('0xa')][0x5]==='undefined'||process[_0xb51b('0xa')][0x5]==='null'){throw new Error(_0xb51b('0x11'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xb51b('0xa')][0x6]&&process['argv'][0x6]!=='undefined'&&process[_0xb51b('0xa')][0x6]!==_0xb51b('0xd')?process[_0xb51b('0xa')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xb51b('0xa')][0x7]!==_0xb51b('0xb')&&process['argv'][0x7]!==_0xb51b('0xd')?process[_0xb51b('0xa')][0x7]:null;if(!process[_0xb51b('0xa')][0x8]||process[_0xb51b('0xa')][0x8]===_0xb51b('0xb')||process[_0xb51b('0xa')][0x8]===_0xb51b('0xd')){throw new Error(_0xb51b('0x12'));}var SOCKET_TIMESTAMP=process[_0xb51b('0xa')][0x8];}catch(_0xd96ddb){logger[_0xb51b('0x13')](_0xd96ddb);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(_0x267054,_0x1edea9,_0x4aa8e0,_0x3134db){var _0x597ae3={'message':_0x1edea9};_0x597ae3[_0x267054]=!![];if(_0x4aa8e0){_0x597ae3[_0xb51b('0x14')]=_0x4aa8e0;}if(_0x3134db){_0x597ae3['index']=_0x3134db;}return _0x597ae3;}function isEmail(_0xefe8e9){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'](_0xefe8e9);}function checkRow(_0x25174f,_0x5c34d6,_0x9fada3){return new BPromise(function(_0x4b629c,_0x1d2dcd){if(_[_0xb51b('0x15')](_0x25174f)){return _0x1d2dcd(handleCheckRowError('error',_0xb51b('0x16'),null,_0x9fada3));}if(_0x25174f[_0xb51b('0x17')]&&_0x25174f['errors'][_0xb51b('0x18')]){var _0x2fb03b=_['map'](_0x25174f['errors'],_0xb51b('0x19'))['join'](';');return _0x1d2dcd(handleCheckRowError('error',_0x2fb03b,null,_0x9fada3));}var _0x31acfc={};for(var _0x435484 in FIELDS){if(FIELDS[_0xb51b('0x1a')](_0x435484)&&FIELDS[_0x435484]){_0x31acfc[_0x435484]=_0x25174f[_0xb51b('0x1b')][0x0][FIELDS[_0x435484]]||_0x25174f[_0xb51b('0x1b')][0x0]['\ufeff'+FIELDS[_0x435484]];}}if(!_0x31acfc[_0xb51b('0x1c')]){return _0x1d2dcd(handleCheckRowError('error',_0xb51b('0x1d'),null,_0x9fada3));}if(!_0x31acfc['phone']){return _0x1d2dcd(handleCheckRowError(_0xb51b('0x13'),'phone\x20not\x20specified!',null,_0x9fada3));}if(_0x31acfc[_0xb51b('0x1e')]){var _0x30f2ed=moment(_0x31acfc[_0xb51b('0x1e')],_0xb51b('0x1f'));if(!_0x30f2ed[_0xb51b('0x20')]()){return _0x1d2dcd(handleCheckRowError('error',_0xb51b('0x21'),null,_0x9fada3));}}if(_0x31acfc[_0xb51b('0x22')]){if(!isEmail(_0x31acfc[_0xb51b('0x22')])){return _0x1d2dcd(handleCheckRowError('error',_0xb51b('0x23'),null,_0x9fada3));}}_0x31acfc[_0xb51b('0x24')]=LISTID;_0x31acfc[_0xb51b('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x5c34d6){var _0x1981c3={};for(var _0x1dbc6e=0x0,_0x333f03=DUPLICATES['length'];_0x1dbc6e<_0x333f03;_0x1dbc6e+=0x1){_0x1981c3[DUPLICATES[_0x1dbc6e]]=_0x31acfc[DUPLICATES[_0x1dbc6e]];}var _0x3cc458=_[_0xb51b('0x26')](_0x5c34d6,_0x1981c3);if(_0x3cc458){return _0x1d2dcd(handleCheckRowError(_0xb51b('0x27'),'Duplicate\x20Contact',_0x3cc458,_0x9fada3));}}return db['CmContact'][_0xb51b('0x28')](_0x31acfc,{'raw':!![],'hooks':![],'fields':_[_0xb51b('0x29')](_0x31acfc)})[_0xb51b('0x2a')](function(_0x5a1484){if(DUPLICATES&&DUPLICATES[_0xb51b('0x18')]&&_0x5c34d6){_0x5c34d6[_0xb51b('0x2b')](_[_0xb51b('0x2c')](_0x31acfc,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5a1484['id'];return _0x4b629c();})[_0xb51b('0x2d')](function(_0x511102){return _0x1d2dcd(handleCheckRowError(_0xb51b('0x13'),_0xb51b('0x2e')+(_0x511102[_0xb51b('0x19')]||JSON[_0xb51b('0x2f')](_0x511102)),null,_0x9fada3));});});}function checkHopper(){function _0x28575e(){return function(_0x193f94){logger[_0xb51b('0x13')](_0xb51b('0x30'),_0xb51b('0x31'),util[_0xb51b('0x32')](_0x193f94,{'showHidden':![],'depth':null}));};}var _0x458400=function(_0x2cebec,_0x3d8f76){var _0x37b5e2=squel['insert']()[_0xb51b('0x33')](_0xb51b('0x34'))[_0xb51b('0x35')]([_0xb51b('0x36'),_0xb51b('0x37'),_0xb51b('0x38'),_0xb51b('0x24'),_0x3d8f76,_0xb51b('0x39'),_0xb51b('0x3a')],squel[_0xb51b('0x3b')]()['field'](_0xb51b('0x36'),'phone')['field'](_0xb51b('0x3c'),'scheduledAt')['field']('id',_0xb51b('0x38'))['field'](LISTID[_0xb51b('0x3d')](),_0xb51b('0x24'))[_0xb51b('0x3e')](_0x2cebec['id']['toString'](),_0x3d8f76)['field'](_0xb51b('0x3c'),'createdAt')[_0xb51b('0x3e')](_0xb51b('0x3c'),'updatedAt')[_0xb51b('0x3f')]('cm_contacts')[_0xb51b('0x40')](_0xb51b('0x41'))[_0xb51b('0x40')](_0xb51b('0x42'),LISTID[_0xb51b('0x3d')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xb51b('0x40')](_0xb51b('0x43'),squel[_0xb51b('0x3b')]()['field'](_0xb51b('0x36'))['from']('cm_hopper')[_0xb51b('0x40')](_0x3d8f76+_0xb51b('0x44'),_0x2cebec['id'][_0xb51b('0x3d')]())))[_0xb51b('0x3d')]();return _0x37b5e2;};var _0x5f49c5=function(_0x40f26a,_0x533e22){var _0x3fc650=squel['insert']()[_0xb51b('0x33')](_0xb51b('0x34'))[_0xb51b('0x35')]([_0xb51b('0x36'),_0xb51b('0x37'),'ContactId',_0xb51b('0x24'),_0x533e22,_0xb51b('0x39'),_0xb51b('0x3a')],squel[_0xb51b('0x3b')]()[_0xb51b('0x3e')](_0xb51b('0x36'),_0xb51b('0x36'))[_0xb51b('0x3e')]('NOW()',_0xb51b('0x37'))[_0xb51b('0x3e')]('id',_0xb51b('0x38'))[_0xb51b('0x3e')](LISTID[_0xb51b('0x3d')](),'ListId')[_0xb51b('0x3e')](_0x40f26a['id']['toString'](),_0x533e22)[_0xb51b('0x3e')](_0xb51b('0x3c'),_0xb51b('0x39'))[_0xb51b('0x3e')]('NOW()',_0xb51b('0x3a'))[_0xb51b('0x3f')](_0xb51b('0x45'))[_0xb51b('0x40')](_0xb51b('0x41'))[_0xb51b('0x40')](_0xb51b('0x42'),LISTID[_0xb51b('0x3d')]())[_0xb51b('0x40')](_0xb51b('0x46'),squel[_0xb51b('0x47')](hopperContacts))['where'](_0xb51b('0x48'))[_0xb51b('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb51b('0x3b')]()[_0xb51b('0x3e')]('calleridnum')[_0xb51b('0x3f')](_0xb51b('0x49'))[_0xb51b('0x40')](_0x533e22+_0xb51b('0x44'),_0x40f26a['id'][_0xb51b('0x3d')]()))[_0xb51b('0x40')](_0xb51b('0x43'),squel['select']()[_0xb51b('0x3e')](_0xb51b('0x36'))['from']('cm_hopper')['where'](_0x533e22+_0xb51b('0x44'),_0x40f26a['id']['toString']())))['toString']();return _0x3fc650;};function _0x3ea956(_0x3d4ad5,_0x43e7b4){var _0x32e85e=squel[_0xb51b('0x4a')]()[_0xb51b('0x33')](_0xb51b('0x34'))[_0xb51b('0x35')](['phone','scheduledAt',_0xb51b('0x38'),_0xb51b('0x24'),_0x43e7b4,_0xb51b('0x39'),'updatedAt'],squel['select']()[_0xb51b('0x3e')](_0xb51b('0x36'),_0xb51b('0x36'))[_0xb51b('0x3e')](_0xb51b('0x3c'),_0xb51b('0x37'))[_0xb51b('0x3e')]('id',_0xb51b('0x38'))[_0xb51b('0x3e')](LISTID['toString'](),_0xb51b('0x24'))[_0xb51b('0x3e')](_0x3d4ad5['id'][_0xb51b('0x3d')](),_0x43e7b4)['field']('NOW()',_0xb51b('0x39'))[_0xb51b('0x3e')](_0xb51b('0x3c'),'updatedAt')[_0xb51b('0x3f')](_0xb51b('0x45'))[_0xb51b('0x40')]('deletedAt\x20IS\x20NULL')[_0xb51b('0x40')](_0xb51b('0x42'),LISTID['toString']())[_0xb51b('0x40')](_0xb51b('0x46'),squel['str'](hopperContacts))[_0xb51b('0x40')]('phone\x20IS\x20NOT\x20NULL'))[_0xb51b('0x3d')]();return _0x32e85e;}function _0x49daf0(_0x59795b,_0xb0f670){var _0x55ff56=squel[_0xb51b('0x4a')]()[_0xb51b('0x33')](_0xb51b('0x4b'))[_0xb51b('0x35')]([_0xb51b('0x36'),_0xb51b('0x38'),_0xb51b('0x24'),_0xb0f670,_0xb51b('0x39'),_0xb51b('0x3a')],squel[_0xb51b('0x3b')]()['field']('phone','phone')[_0xb51b('0x3e')]('id',_0xb51b('0x38'))[_0xb51b('0x3e')](LISTID['toString'](),_0xb51b('0x24'))['field'](_0x59795b['id'][_0xb51b('0x3d')](),_0xb0f670)[_0xb51b('0x3e')]('NOW()','createdAt')['field'](_0xb51b('0x3c'),_0xb51b('0x3a'))[_0xb51b('0x3f')](_0xb51b('0x45'))['where'](_0xb51b('0x41'))['where'](_0xb51b('0x42'),LISTID[_0xb51b('0x3d')]())['where'](_0xb51b('0x46'),squel[_0xb51b('0x47')](hopperContacts))[_0xb51b('0x40')](_0xb51b('0x48')))[_0xb51b('0x3d')]();return _0x55ff56;}return db[_0xb51b('0x4c')][_0xb51b('0x4d')]({'where':{'type':'outbound'},'attributes':['id',_0xb51b('0x4e')],'include':[{'model':db[_0xb51b('0x4f')],'as':_0xb51b('0x50'),'where':{'id':LISTID}}]})[_0xb51b('0x2a')](function(_0x2d5f1d){var _0x4aa26b=[];if(_0x2d5f1d){var _0x4db48f;for(var _0x53ffe2=0x0,_0x4c6bd6;_0x53ffe2<_0x2d5f1d['length'];_0x53ffe2+=0x1){_0x4c6bd6=_0x2d5f1d[_0x53ffe2]['get']({'plain':!![]});switch(_0x4c6bd6[_0xb51b('0x4e')]){case _0xb51b('0x51'):_0x4aa26b[_0xb51b('0x2b')](db[_0xb51b('0x52')][_0xb51b('0x53')](_0x5f49c5(_0x4c6bd6,_0xb51b('0x54')))['then'](function(){})[_0xb51b('0x2d')](_0x28575e()));break;case _0xb51b('0x55'):_0x4aa26b['push'](db[_0xb51b('0x52')][_0xb51b('0x53')](_0x458400(_0x4c6bd6,_0xb51b('0x54')))[_0xb51b('0x2a')](function(){})[_0xb51b('0x2d')](_0x28575e()));break;default:_0x4aa26b[_0xb51b('0x2b')](db['sequelize'][_0xb51b('0x53')](_0x3ea956(_0x4c6bd6,_0xb51b('0x54')))[_0xb51b('0x2a')](function(){})[_0xb51b('0x2d')](_0x28575e()));}}}return _0x4aa26b;})[_0xb51b('0x56')]()[_0xb51b('0x2a')](function(){return db[_0xb51b('0x4c')][_0xb51b('0x4d')]({'where':{'type':_0xb51b('0x57')},'attributes':['id'],'include':[{'model':db[_0xb51b('0x4f')],'as':_0xb51b('0x58'),'where':{'id':LISTID}}]})[_0xb51b('0x2a')](function(_0xa35853){var _0x87bd05=[];if(_0xa35853){var _0x3ef553;for(var _0x41d380=0x0,_0x512305;_0x41d380<_0xa35853[_0xb51b('0x18')];_0x41d380+=0x1){_0x512305=_0xa35853[_0x41d380][_0xb51b('0x59')]({'plain':!![]});_0x87bd05['push'](db[_0xb51b('0x52')][_0xb51b('0x53')](_0x49daf0(_0x512305,_0xb51b('0x54')))[_0xb51b('0x2a')](function(){})[_0xb51b('0x2d')](_0x28575e()));}}return _0x87bd05;})['all']();})[_0xb51b('0x2a')](function(){return db[_0xb51b('0x5a')][_0xb51b('0x4d')]({'attributes':['id',_0xb51b('0x4e')],'include':[{'model':db[_0xb51b('0x4f')],'as':_0xb51b('0x50'),'where':{'id':LISTID}}]})[_0xb51b('0x2a')](function(_0x208c75){var _0x19ce12=[];if(_0x208c75){for(var _0x2d838f=0x0,_0x465164;_0x2d838f<_0x208c75[_0xb51b('0x18')];_0x2d838f+=0x1){_0x465164=_0x208c75[_0x2d838f][_0xb51b('0x59')]({'plain':!![]});switch(_0x465164[_0xb51b('0x4e')]){case _0xb51b('0x51'):_0x19ce12['push'](db[_0xb51b('0x52')]['query'](_0x5f49c5(_0x465164,_0xb51b('0x5b')))[_0xb51b('0x2a')](function(){})['catch'](_0x28575e()));break;case _0xb51b('0x55'):_0x19ce12[_0xb51b('0x2b')](db[_0xb51b('0x52')]['query'](_0x458400(_0x465164,_0xb51b('0x5b')))[_0xb51b('0x2a')](function(){})['catch'](_0x28575e()));break;default:_0x19ce12[_0xb51b('0x2b')](db[_0xb51b('0x52')]['query'](_0x3ea956(_0x465164,'CampaignId'))[_0xb51b('0x2a')](function(){})['catch'](_0x28575e()));}}}return _0x19ce12;})['all']();})['then'](function(){return db['Campaign'][_0xb51b('0x4d')]({'attributes':['id'],'include':[{'model':db[_0xb51b('0x4f')],'as':_0xb51b('0x58'),'where':{'id':LISTID}}]})[_0xb51b('0x2a')](function(_0x4cdb4d){var _0x13dead=[];if(_0x4cdb4d){for(var _0x480690=0x0,_0x151e75;_0x480690<_0x4cdb4d[_0xb51b('0x18')];_0x480690+=0x1){_0x151e75=_0x4cdb4d[_0x480690][_0xb51b('0x59')]({'plain':!![]});_0x13dead[_0xb51b('0x2b')](db[_0xb51b('0x52')][_0xb51b('0x53')](_0x49daf0(_0x151e75,_0xb51b('0x5b')))['then'](function(){})[_0xb51b('0x2d')](_0x28575e()));}}return _0x13dead;})[_0xb51b('0x56')]();})[_0xb51b('0x2d')](function(_0x47af13){logger['error'](_0xb51b('0x5c'),_0xb51b('0x5d'),_0x47af13[_0xb51b('0x19')]);});}var processPromises=function(_0x5d842d){return BPromise[_0xb51b('0x56')](promises)[_0xb51b('0x2a')](function(_0x36c622){})['catch'](function(_0x1a772c){logger['error'](_0xb51b('0x5e'),JSON[_0xb51b('0x2f')](_0x1a772c));})[_0xb51b('0x5f')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5d842d){return _0x5d842d[_0xb51b('0x60')]();}});};var endCsv=function(){return BPromise[_0xb51b('0x61')]()[_0xb51b('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0xb51b('0x2a')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xb51b('0x62')](FILEPATH);}catch(_0x4d75ae){logger[_0xb51b('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xb51b('0x2f')](_0x4d75ae));}finally{process[_0xb51b('0x63')](0x0);}});};process['on']('SIGINT',function(){logger['info'](_0xb51b('0x64'));endCsv();});function main(){return BPromise[_0xb51b('0x61')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xb51b('0x65')][_0xb51b('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x2a87ee){var _0xa7b83b=fs[_0xb51b('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xb51b('0x67')](_0xa7b83b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1d0233,_0x169f98){total+=0x1;var _0x5485fe=total;promises[_0xb51b('0x2b')](checkRow(_0x1d0233,_0x2a87ee,_0x5485fe)[_0xb51b('0x2a')](function(){success+=0x1;})[_0xb51b('0x2d')](function(_0x1ad91c){if(_0x1ad91c[_0xb51b('0x13')]){errors+=0x1;delete _0x1ad91c['error'];}else if(_0x1ad91c[_0xb51b('0x27')]){duplicates+=0x1;delete _0x1ad91c[_0xb51b('0x27')];}rows[_0xb51b('0x2b')](_0x1ad91c);}));if(total%0xc8===0x0){_0x169f98['pause']();return processPromises(_0x169f98);}},'complete':function(){return processPromises()[_0xb51b('0x2a')](function(){logger['info'](_0xb51b('0x68'));endCsv();});},'error':function(_0x391b97,_0x5c3508){logger[_0xb51b('0x69')](_0xb51b('0x6a'),JSON[_0xb51b('0x2f')](_0x391b97));endCsv();}});})['catch'](function(_0x324a23){logger[_0xb51b('0x13')](_0xb51b('0x6b'),JSON[_0xb51b('0x2f')](_0x324a23));});}main(); \ No newline at end of file +var _0xb7e0=['\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','dialCheckDuplicateType','CmList','Lists','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','VoiceQueue','findAll','outbound','BlackLists','Campaign','get','CampaignId','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','pause','CSV\x20parsed\x20correctly!','bluebird','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','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!','CompanyId','duplicate','CmContact','create','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','into','fromQuery','scheduledAt','ListId','createdAt','updatedAt','select','field','NOW()','ContactId','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper'];(function(_0x10472e,_0x3ec1e6){var _0x1caf84=function(_0x21b02f){while(--_0x21b02f){_0x10472e['push'](_0x10472e['shift']());}};_0x1caf84(++_0x3ec1e6);}(_0xb7e0,0x16f));var _0x0b7e=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb7e0[_0x167cc1];return _0x10bc4b;};'use strict';var BPromise=require(_0x0b7e('0x0'));var util=require('util');var _=require(_0x0b7e('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0b7e('0x2'));var db=require('../../../mysqldb')['db'];var config=require(_0x0b7e('0x3'));var logger=require(_0x0b7e('0x4'))(_0x0b7e('0x5'));config[_0x0b7e('0x6')]=_[_0x0b7e('0x7')](config[_0x0b7e('0x6')],{'host':_0x0b7e('0x8'),'port':0x18eb});var socket=require(_0x0b7e('0x9'))(new Redis(config[_0x0b7e('0x6')]));require(_0x0b7e('0xa'))['register'](socket);try{if(!process[_0x0b7e('0xb')][0x2]||process[_0x0b7e('0xb')][0x2]===_0x0b7e('0xc')||process[_0x0b7e('0xb')][0x2]===_0x0b7e('0xd')){throw new Error(_0x0b7e('0xe'));}var FILEPATH=process[_0x0b7e('0xb')][0x2];if(!process[_0x0b7e('0xb')][0x3]||process['argv'][0x3]===_0x0b7e('0xc')||process[_0x0b7e('0xb')][0x3]==='null'||!process[_0x0b7e('0xb')][0x4]||process[_0x0b7e('0xb')][0x4]===_0x0b7e('0xc')||process['argv'][0x4]===_0x0b7e('0xd')){throw new Error(_0x0b7e('0xf'));}var FIELDS=_[_0x0b7e('0x10')](process[_0x0b7e('0xb')][0x3][_0x0b7e('0x11')](','),process[_0x0b7e('0xb')][0x4][_0x0b7e('0x11')](','));if(!process['argv'][0x5]||process[_0x0b7e('0xb')][0x5]==='undefined'||process[_0x0b7e('0xb')][0x5]===_0x0b7e('0xd')){throw new Error(_0x0b7e('0x12'));}var LISTID=process[_0x0b7e('0xb')][0x5];var COMPANYID=process[_0x0b7e('0xb')][0x6]&&process['argv'][0x6]!=='undefined'&&process[_0x0b7e('0xb')][0x6]!=='null'?process[_0x0b7e('0xb')][0x6]:null;var DUPLICATES=process[_0x0b7e('0xb')][0x7]&&process[_0x0b7e('0xb')][0x7]!==_0x0b7e('0xc')&&process[_0x0b7e('0xb')][0x7]!==_0x0b7e('0xd')?process[_0x0b7e('0xb')][0x7]:null;if(!process[_0x0b7e('0xb')][0x8]||process[_0x0b7e('0xb')][0x8]==='undefined'||process[_0x0b7e('0xb')][0x8]==='null'){throw new Error(_0x0b7e('0x13'));}var SOCKET_TIMESTAMP=process[_0x0b7e('0xb')][0x8];}catch(_0x3731e7){logger['error'](_0x3731e7);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(_0x181b03,_0x1c1c81,_0x134342,_0x47dcb9){var _0x3dddbe={'message':_0x1c1c81};_0x3dddbe[_0x181b03]=!![];if(_0x134342){_0x3dddbe[_0x0b7e('0x14')]=_0x134342;}if(_0x47dcb9){_0x3dddbe[_0x0b7e('0x15')]=_0x47dcb9;}return _0x3dddbe;}function isEmail(_0x3d8009){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))*$/[_0x0b7e('0x16')](_0x3d8009);}function checkRow(_0x20c74b,_0x54552f,_0x17c70b){return new BPromise(function(_0x5e251b,_0x3a4daa){if(_['isNil'](_0x20c74b)){return _0x3a4daa(handleCheckRowError(_0x0b7e('0x17'),_0x0b7e('0x18'),null,_0x17c70b));}if(_0x20c74b['errors']&&_0x20c74b[_0x0b7e('0x19')][_0x0b7e('0x1a')]){var _0x1b5bff=_[_0x0b7e('0x1b')](_0x20c74b['errors'],_0x0b7e('0x1c'))[_0x0b7e('0x1d')](';');return _0x3a4daa(handleCheckRowError(_0x0b7e('0x17'),_0x1b5bff,null,_0x17c70b));}var _0x2a5379={};for(var _0x2314f8 in FIELDS){if(FIELDS[_0x0b7e('0x1e')](_0x2314f8)&&FIELDS[_0x2314f8]){_0x2a5379[_0x2314f8]=_0x20c74b[_0x0b7e('0x1f')][0x0][FIELDS[_0x2314f8]]||_0x20c74b['data'][0x0]['\ufeff'+FIELDS[_0x2314f8]];}}if(!_0x2a5379['firstName']){return _0x3a4daa(handleCheckRowError(_0x0b7e('0x17'),_0x0b7e('0x20'),null,_0x17c70b));}if(!_0x2a5379[_0x0b7e('0x21')]){return _0x3a4daa(handleCheckRowError(_0x0b7e('0x17'),_0x0b7e('0x22'),null,_0x17c70b));}if(_0x2a5379['birthDate']){var _0x84d9b7=moment(_0x2a5379[_0x0b7e('0x23')],_0x0b7e('0x24'));if(!_0x84d9b7[_0x0b7e('0x25')]()){return _0x3a4daa(handleCheckRowError(_0x0b7e('0x17'),_0x0b7e('0x26'),null,_0x17c70b));}}if(_0x2a5379['email']){if(!isEmail(_0x2a5379[_0x0b7e('0x27')])){return _0x3a4daa(handleCheckRowError(_0x0b7e('0x17'),_0x0b7e('0x28'),null,_0x17c70b));}}_0x2a5379['ListId']=LISTID;_0x2a5379[_0x0b7e('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0b7e('0x1a')]&&_0x54552f){var _0x3ca070={};for(var _0x37e5c2=0x0,_0x5f0268=DUPLICATES[_0x0b7e('0x1a')];_0x37e5c2<_0x5f0268;_0x37e5c2+=0x1){_0x3ca070[DUPLICATES[_0x37e5c2]]=_0x2a5379[DUPLICATES[_0x37e5c2]];}var _0x57b461=_['find'](_0x54552f,_0x3ca070);if(_0x57b461){return _0x3a4daa(handleCheckRowError(_0x0b7e('0x2a'),'Duplicate\x20Contact',_0x57b461,_0x17c70b));}}return db[_0x0b7e('0x2b')][_0x0b7e('0x2c')](_0x2a5379,{'raw':!![],'hooks':![],'fields':_['keys'](_0x2a5379)})[_0x0b7e('0x2d')](function(_0x5110ab){if(DUPLICATES&&DUPLICATES['length']&&_0x54552f){_0x54552f[_0x0b7e('0x2e')](_[_0x0b7e('0x2f')](_0x2a5379,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5110ab['id'];return _0x5e251b();})[_0x0b7e('0x30')](function(_0x380a68){return _0x3a4daa(handleCheckRowError(_0x0b7e('0x17'),'Error\x20while\x20creating\x20contact:\x20'+(_0x380a68[_0x0b7e('0x1c')]||JSON[_0x0b7e('0x31')](_0x380a68)),null,_0x17c70b));});});}function checkHopper(){function _0x578ae8(){return function(_0x72c724){logger['error'](_0x0b7e('0x32'),_0x0b7e('0x33'),util[_0x0b7e('0x34')](_0x72c724,{'showHidden':![],'depth':null}));};}var _0x3bd6f7=function(_0x5d41b1,_0x5a401f){var _0x20c9e2=squel[_0x0b7e('0x35')]()[_0x0b7e('0x36')]('cm_hopper')[_0x0b7e('0x37')]([_0x0b7e('0x21'),_0x0b7e('0x38'),'ContactId',_0x0b7e('0x39'),_0x5a401f,_0x0b7e('0x3a'),_0x0b7e('0x3b')],squel[_0x0b7e('0x3c')]()[_0x0b7e('0x3d')](_0x0b7e('0x21'),_0x0b7e('0x21'))[_0x0b7e('0x3d')](_0x0b7e('0x3e'),'scheduledAt')[_0x0b7e('0x3d')]('id',_0x0b7e('0x3f'))[_0x0b7e('0x3d')](LISTID[_0x0b7e('0x40')](),_0x0b7e('0x39'))[_0x0b7e('0x3d')](_0x5d41b1['id']['toString'](),_0x5a401f)[_0x0b7e('0x3d')](_0x0b7e('0x3e'),'createdAt')['field']('NOW()',_0x0b7e('0x3b'))[_0x0b7e('0x41')](_0x0b7e('0x42'))[_0x0b7e('0x43')](_0x0b7e('0x44'))[_0x0b7e('0x43')](_0x0b7e('0x45'),LISTID['toString']())[_0x0b7e('0x43')](_0x0b7e('0x46'))[_0x0b7e('0x43')](_0x0b7e('0x47'),squel[_0x0b7e('0x3c')]()[_0x0b7e('0x3d')](_0x0b7e('0x21'))['from'](_0x0b7e('0x48'))[_0x0b7e('0x43')](_0x5a401f+_0x0b7e('0x49'),_0x5d41b1['id']['toString']())))[_0x0b7e('0x40')]();return _0x20c9e2;};var _0x42c0a8=function(_0xcb50bf,_0x1fac0d){var _0x88bb8a=squel[_0x0b7e('0x35')]()[_0x0b7e('0x36')](_0x0b7e('0x48'))[_0x0b7e('0x37')]([_0x0b7e('0x21'),_0x0b7e('0x38'),_0x0b7e('0x3f'),_0x0b7e('0x39'),_0x1fac0d,_0x0b7e('0x3a'),_0x0b7e('0x3b')],squel[_0x0b7e('0x3c')]()[_0x0b7e('0x3d')](_0x0b7e('0x21'),_0x0b7e('0x21'))[_0x0b7e('0x3d')]('NOW()',_0x0b7e('0x38'))[_0x0b7e('0x3d')]('id','ContactId')['field'](LISTID['toString'](),_0x0b7e('0x39'))[_0x0b7e('0x3d')](_0xcb50bf['id']['toString'](),_0x1fac0d)['field']('NOW()','createdAt')[_0x0b7e('0x3d')](_0x0b7e('0x3e'),_0x0b7e('0x3b'))['from'](_0x0b7e('0x42'))[_0x0b7e('0x43')](_0x0b7e('0x44'))['where'](_0x0b7e('0x45'),LISTID[_0x0b7e('0x40')]())[_0x0b7e('0x43')](_0x0b7e('0x4a'),squel[_0x0b7e('0x4b')](hopperContacts))[_0x0b7e('0x43')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x0b7e('0x47'),squel[_0x0b7e('0x3c')]()[_0x0b7e('0x3d')](_0x0b7e('0x4c'))[_0x0b7e('0x41')](_0x0b7e('0x4d'))['where'](_0x1fac0d+_0x0b7e('0x49'),_0xcb50bf['id'][_0x0b7e('0x40')]()))['where'](_0x0b7e('0x47'),squel[_0x0b7e('0x3c')]()[_0x0b7e('0x3d')]('phone')['from'](_0x0b7e('0x48'))[_0x0b7e('0x43')](_0x1fac0d+_0x0b7e('0x49'),_0xcb50bf['id'][_0x0b7e('0x40')]())))[_0x0b7e('0x40')]();return _0x88bb8a;};function _0x2d610a(_0x4e73b5,_0x104e72){var _0x3aa938=squel[_0x0b7e('0x35')]()[_0x0b7e('0x36')](_0x0b7e('0x48'))[_0x0b7e('0x37')]([_0x0b7e('0x21'),_0x0b7e('0x38'),'ContactId',_0x0b7e('0x39'),_0x104e72,_0x0b7e('0x3a'),_0x0b7e('0x3b')],squel['select']()[_0x0b7e('0x3d')](_0x0b7e('0x21'),_0x0b7e('0x21'))[_0x0b7e('0x3d')](_0x0b7e('0x3e'),_0x0b7e('0x38'))[_0x0b7e('0x3d')]('id',_0x0b7e('0x3f'))['field'](LISTID['toString'](),_0x0b7e('0x39'))[_0x0b7e('0x3d')](_0x4e73b5['id'][_0x0b7e('0x40')](),_0x104e72)[_0x0b7e('0x3d')]('NOW()',_0x0b7e('0x3a'))[_0x0b7e('0x3d')](_0x0b7e('0x3e'),_0x0b7e('0x3b'))[_0x0b7e('0x41')](_0x0b7e('0x42'))[_0x0b7e('0x43')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0x0b7e('0x40')]())[_0x0b7e('0x43')](_0x0b7e('0x4a'),squel[_0x0b7e('0x4b')](hopperContacts))[_0x0b7e('0x43')](_0x0b7e('0x46')))[_0x0b7e('0x40')]();return _0x3aa938;}function _0x5c2e2c(_0x933817,_0x5706f4){var _0x44e121=squel[_0x0b7e('0x35')]()[_0x0b7e('0x36')](_0x0b7e('0x4e'))['fromQuery']([_0x0b7e('0x21'),_0x0b7e('0x3f'),_0x0b7e('0x39'),_0x5706f4,_0x0b7e('0x3a'),'updatedAt'],squel['select']()[_0x0b7e('0x3d')](_0x0b7e('0x21'),'phone')[_0x0b7e('0x3d')]('id','ContactId')[_0x0b7e('0x3d')](LISTID['toString'](),_0x0b7e('0x39'))[_0x0b7e('0x3d')](_0x933817['id'][_0x0b7e('0x40')](),_0x5706f4)[_0x0b7e('0x3d')](_0x0b7e('0x3e'),_0x0b7e('0x3a'))[_0x0b7e('0x3d')](_0x0b7e('0x3e'),_0x0b7e('0x3b'))[_0x0b7e('0x41')](_0x0b7e('0x42'))['where'](_0x0b7e('0x44'))[_0x0b7e('0x43')](_0x0b7e('0x45'),LISTID['toString']())[_0x0b7e('0x43')](_0x0b7e('0x4a'),squel[_0x0b7e('0x4b')](hopperContacts))[_0x0b7e('0x43')](_0x0b7e('0x46')))[_0x0b7e('0x40')]();return _0x44e121;}return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x0b7e('0x4f')],'include':[{'model':db[_0x0b7e('0x50')],'as':_0x0b7e('0x51'),'where':{'id':LISTID}}]})[_0x0b7e('0x2d')](function(_0x3a9f18){var _0x480d24=[];if(_0x3a9f18){var _0xaee55c;for(var _0x815381=0x0,_0x112987;_0x815381<_0x3a9f18[_0x0b7e('0x1a')];_0x815381+=0x1){_0x112987=_0x3a9f18[_0x815381]['get']({'plain':!![]});switch(_0x112987['dialCheckDuplicateType']){case _0x0b7e('0x52'):_0x480d24[_0x0b7e('0x2e')](db[_0x0b7e('0x53')]['query'](_0x42c0a8(_0x112987,_0x0b7e('0x54')))[_0x0b7e('0x2d')](function(){})[_0x0b7e('0x30')](_0x578ae8()));break;case _0x0b7e('0x55'):_0x480d24['push'](db[_0x0b7e('0x53')]['query'](_0x3bd6f7(_0x112987,'VoiceQueueId'))[_0x0b7e('0x2d')](function(){})[_0x0b7e('0x30')](_0x578ae8()));break;default:_0x480d24[_0x0b7e('0x2e')](db['sequelize'][_0x0b7e('0x56')](_0x2d610a(_0x112987,'VoiceQueueId'))['then'](function(){})[_0x0b7e('0x30')](_0x578ae8()));}}}return _0x480d24;})[_0x0b7e('0x57')]()[_0x0b7e('0x2d')](function(){return db[_0x0b7e('0x58')][_0x0b7e('0x59')]({'where':{'type':_0x0b7e('0x5a')},'attributes':['id'],'include':[{'model':db[_0x0b7e('0x50')],'as':_0x0b7e('0x5b'),'where':{'id':LISTID}}]})['then'](function(_0x39358d){var _0x411a5a=[];if(_0x39358d){var _0xfba99d;for(var _0x294c06=0x0,_0x334e63;_0x294c06<_0x39358d['length'];_0x294c06+=0x1){_0x334e63=_0x39358d[_0x294c06]['get']({'plain':!![]});_0x411a5a[_0x0b7e('0x2e')](db[_0x0b7e('0x53')]['query'](_0x5c2e2c(_0x334e63,_0x0b7e('0x54')))[_0x0b7e('0x2d')](function(){})[_0x0b7e('0x30')](_0x578ae8()));}}return _0x411a5a;})[_0x0b7e('0x57')]();})[_0x0b7e('0x2d')](function(){return db[_0x0b7e('0x5c')]['findAll']({'attributes':['id',_0x0b7e('0x4f')],'include':[{'model':db[_0x0b7e('0x50')],'as':_0x0b7e('0x51'),'where':{'id':LISTID}}]})[_0x0b7e('0x2d')](function(_0x41c43f){var _0x4b7573=[];if(_0x41c43f){for(var _0x34c76f=0x0,_0x5a7272;_0x34c76f<_0x41c43f[_0x0b7e('0x1a')];_0x34c76f+=0x1){_0x5a7272=_0x41c43f[_0x34c76f][_0x0b7e('0x5d')]({'plain':!![]});switch(_0x5a7272[_0x0b7e('0x4f')]){case _0x0b7e('0x52'):_0x4b7573[_0x0b7e('0x2e')](db[_0x0b7e('0x53')]['query'](_0x42c0a8(_0x5a7272,_0x0b7e('0x5e')))[_0x0b7e('0x2d')](function(){})[_0x0b7e('0x30')](_0x578ae8()));break;case _0x0b7e('0x55'):_0x4b7573[_0x0b7e('0x2e')](db['sequelize'][_0x0b7e('0x56')](_0x3bd6f7(_0x5a7272,_0x0b7e('0x5e')))[_0x0b7e('0x2d')](function(){})[_0x0b7e('0x30')](_0x578ae8()));break;default:_0x4b7573[_0x0b7e('0x2e')](db['sequelize'][_0x0b7e('0x56')](_0x2d610a(_0x5a7272,'CampaignId'))[_0x0b7e('0x2d')](function(){})[_0x0b7e('0x30')](_0x578ae8()));}}}return _0x4b7573;})[_0x0b7e('0x57')]();})['then'](function(){return db[_0x0b7e('0x5c')][_0x0b7e('0x59')]({'attributes':['id'],'include':[{'model':db[_0x0b7e('0x50')],'as':_0x0b7e('0x5b'),'where':{'id':LISTID}}]})['then'](function(_0xc782c2){var _0x21359e=[];if(_0xc782c2){for(var _0x50a60d=0x0,_0x5e15e7;_0x50a60d<_0xc782c2[_0x0b7e('0x1a')];_0x50a60d+=0x1){_0x5e15e7=_0xc782c2[_0x50a60d][_0x0b7e('0x5d')]({'plain':!![]});_0x21359e['push'](db[_0x0b7e('0x53')]['query'](_0x5c2e2c(_0x5e15e7,_0x0b7e('0x5e')))[_0x0b7e('0x2d')](function(){})[_0x0b7e('0x30')](_0x578ae8()));}}return _0x21359e;})['all']();})[_0x0b7e('0x30')](function(_0x316ca7){logger['error']('cmContact,\x20%s,\x20%s',_0x0b7e('0x5f'),_0x316ca7['message']);});}var processPromises=function(_0x520210){return BPromise['all'](promises)[_0x0b7e('0x2d')](function(_0x231818){})[_0x0b7e('0x30')](function(_0x54d031){logger[_0x0b7e('0x17')](_0x0b7e('0x60'),JSON[_0x0b7e('0x31')](_0x54d031));})[_0x0b7e('0x61')](function(){socket[_0x0b7e('0x62')](_0x0b7e('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x520210){return _0x520210['resume']();}});};var endCsv=function(){return BPromise[_0x0b7e('0x64')]()[_0x0b7e('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0x0b7e('0x2d')](function(){socket[_0x0b7e('0x62')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0b7e('0x65')](FILEPATH);}catch(_0x4f8ac7){logger[_0x0b7e('0x17')](_0x0b7e('0x66'),JSON['stringify'](_0x4f8ac7));}finally{process[_0x0b7e('0x67')](0x0);}});};process['on'](_0x0b7e('0x68'),function(){logger[_0x0b7e('0x69')](_0x0b7e('0x6a'));endCsv();});function main(){return BPromise['resolve']()[_0x0b7e('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0b7e('0x11')](',');return db[_0x0b7e('0x2b')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0b7e('0x2d')](function(_0x3fdfa3){var _0x388de8=fs[_0x0b7e('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x388de8,{'header':!![],'skipEmptyLines':!![],'step':function(_0x404ad1,_0x420639){total+=0x1;var _0xc205af=total;promises[_0x0b7e('0x2e')](checkRow(_0x404ad1,_0x3fdfa3,_0xc205af)['then'](function(){success+=0x1;})[_0x0b7e('0x30')](function(_0x2de8a4){if(_0x2de8a4[_0x0b7e('0x17')]){errors+=0x1;delete _0x2de8a4['error'];}else if(_0x2de8a4[_0x0b7e('0x2a')]){duplicates+=0x1;delete _0x2de8a4['duplicate'];}rows['push'](_0x2de8a4);}));if(total%0xc8===0x0){_0x420639[_0x0b7e('0x6c')]();return processPromises(_0x420639);}},'complete':function(){return processPromises()[_0x0b7e('0x2d')](function(){logger['info'](_0x0b7e('0x6d'));endCsv();});},'error':function(_0x433529,_0x48a824){logger['info']('CSV\x20parse\x20error',JSON['stringify'](_0x433529));endCsv();}});})['catch'](function(_0x3b3d00){logger[_0x0b7e('0x17')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x0b7e('0x31')](_0x3b3d00));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index bb02a15..75c63d9 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 _0x81ea=['moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','findAll','AdditionalPhones','then','length','push','split','all','isNil','filter','CmContactHasItem','findOne','updated','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.updatedAt','cm_hopper_black','phone','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.ListId','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','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?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','message','exit','errors','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','error','timezones','dialTimezone','utcOffset','set','main','stringify','send','start','binding','socket_timestamp','server/files/tmp','.csv','includes','header','ContactItemType','name','_description','writeFileSync','parse','createReadStream','rows','data','find','replace','isValid','isNaN','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','hasOwnProperty','trim','itemTypeId','description','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(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()','contactId','contactTypeId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','campaigns_has_cm_lists','DROP\x20TABLE\x20','affectedRows','unlink','complete','argv','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x81ea,0xb5));var _0xa81e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x81ea[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xa81e('0x0'));var Papa=require('papaparse');var util=require(_0xa81e('0x1'));var BPromise=require('bluebird');var moment=require(_0xa81e('0x2'));var squel=require(_0xa81e('0x3'));var Redis=require(_0xa81e('0x4'));var db=require(_0xa81e('0x5'))['db'];var config=require(_0xa81e('0x6'));var shared=require(_0xa81e('0x7'));var logger=require('../../../config/logger')('import');config[_0xa81e('0x8')]=_[_0xa81e('0x9')](config[_0xa81e('0x8')],{'host':_0xa81e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa81e('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xa81e('0xb')](_0xa81e('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xa81e('0xb')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0xbf7b4a){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))*$/[_0xa81e('0xd')](_0xbf7b4a);}function selectNotIn(_0x4fe8b7,_0x50196f,_0x2813d8,_0x6681f3,_0x4c4cd9){return squel[_0xa81e('0xe')]()[_0xa81e('0xf')]('phone')[_0xa81e('0x10')](_0x6681f3)[_0xa81e('0x11')](_0x50196f,null,_0x50196f+_0xa81e('0x12')+_0x6681f3+'.'+_0x2813d8)[_0xa81e('0x13')](_0x6681f3+'.'+_0x2813d8+_0xa81e('0x14')+_0x4fe8b7+'.'+_0x2813d8)[_0xa81e('0x13')](_0x50196f+'.dialCheckDuplicateType\x20IN\x20('+_0x4c4cd9[_0xa81e('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x552ee1,_0x1f4c20){promisesAdditionalPhones=[];return db['CmContact'][_0xa81e('0x15')]({'raw':!![],'attributes':['id',_0xa81e('0x16')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xa81e('0x17')](function(_0x28b48f){if(_0x28b48f!==null){var _0x44a2ac=[];for(var _0x9510f=0x0;_0x9510f<_0x28b48f[_0xa81e('0x18')];_0x9510f++){var _0x3eb893=_0x28b48f[_0x9510f];_0x44a2ac[_0xa81e('0x19')](insertAdditionalPhones(_0x3eb893));}}Promise['all'](_0x44a2ac)[_0xa81e('0x17')](function(){_0x552ee1({'val':0x1});});});});}function insertAdditionalPhones(_0x54a9ea){return new Promise(function(_0x775425,_0x1f1d6b){var _0x4b57a5=_0x54a9ea[_0xa81e('0x16')];var _0x1db1f0=_0x4b57a5[_0xa81e('0x1a')](';');var _0x1eed1b=[];orderBy=0x0;for(var _0x4ba56d=0x0;_0x4ba56d<_0x1db1f0[_0xa81e('0x18')];_0x4ba56d++){_0x1eed1b['push'](splitAdditionalPhone(_0x54a9ea['id'],_0x1db1f0[_0x4ba56d]));}Promise[_0xa81e('0x1b')](_0x1eed1b)[_0xa81e('0x17')](function(){_0x775425({'val':_0x1db1f0[_0xa81e('0x18')]});});});}function splitAdditionalPhone(_0x16e0af,_0x4bd58e){return new Promise(function(_0x1e1412,_0x44d3e8){var _0x1e04e9=_0x4bd58e['split'](':');var _0x3f7d93=_0x1e04e9[0x0];var _0x283138=_0x1e04e9[0x1];if(!_[_0xa81e('0x1c')](_0x283138)){var _0x591dc1=_0x283138[_0xa81e('0x1a')]('|');var _0x506517=[];for(var _0x3a435c=0x0;_0x3a435c<_0x591dc1['length'];_0x3a435c++){if(_0x591dc1[_0x3a435c]!==''){var _0x147fe0=_[_0xa81e('0x1d')](promisesAdditionalPhones,{'contactId':_0x16e0af,'phone':_0x591dc1[_0x3a435c]});if(_0x147fe0[_0xa81e('0x18')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x16e0af,'contactTypeId':_0x3f7d93,'phone':_0x591dc1[_0x3a435c],'orderBy':orderBy});}}}_0x1e1412({'ok':0x1});}else _0x1e1412({'res':0x0});});}function createAdditionalPhone(_0x1f141c,_0x6dc62b,_0x244da1,_0x3b8eb3){var _0x2ab27d='';var _0x16d3f7='';var _0x1ee3cf=_0x244da1[_0xa81e('0x1a')]('§');_0x2ab27d=_0x1ee3cf[0x0];if(_0x1ee3cf[_0xa81e('0x18')]==0x2)_0x16d3f7=_0x1ee3cf[0x1];return new Promise(function(_0x17a14d,_0x5447ec){return db[_0xa81e('0x1e')][_0xa81e('0x1f')]({'where':{'CmContactId':_0x1f141c,'item':_0x2ab27d}})[_0xa81e('0x17')](function(_0x1b720f){if(_0x1b720f){return db['CmContactHasItem']['update']({'ItemTypeId':_0x6dc62b,'description':_0x16d3f7,'OrderBy':_0x3b8eb3},{'where':{'CmContactId':_0x1f141c,'item':_0x2ab27d}})['then'](function(_0x536e62){_0x17a14d({'res':_0xa81e('0x20')});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x1f141c,'item':_0x2ab27d,'description':_0x16d3f7,'ItemTypeId':_0x6dc62b,'OrderBy':_0x3b8eb3,'ItemClass':_0xa81e('0x21')})[_0xa81e('0x17')](function(_0x2452f8){_0x17a14d({'res':_0xa81e('0x22')});});}});});}function insertCmHopper(_0x34d926,_0x29e134,_0x48b9a7,_0x59fa31,_0x4adc36){var _0x5d2c0b=[_0xa81e('0x23'),_0xa81e('0x24'),_0xa81e('0x25'),'cm_contacts.ListId',_0x29e134+'.'+_0x59fa31,_0xa81e('0x26'),'cm_contacts.updatedAt',_0xa81e('0x27'),_0xa81e('0x28'),'\x22'+_0x4adc36+'\x22'];return squel[_0xa81e('0x29')]()[_0xa81e('0x2a')](_0xa81e('0x2b'))[_0xa81e('0x2c')](['phone',_0xa81e('0x2d'),_0xa81e('0x2e'),_0xa81e('0x2f'),_0x59fa31,_0xa81e('0x30'),_0xa81e('0x31'),_0xa81e('0x32'),_0xa81e('0x33'),_0xa81e('0x34')],squel[_0xa81e('0xe')]()[_0xa81e('0x35')](_0x5d2c0b)[_0xa81e('0x10')](_0x29e134)[_0xa81e('0x11')](_0xa81e('0x36'),null,_0xa81e('0x37')+_0x29e134+_0xa81e('0x38'))[_0xa81e('0x11')](_0x48b9a7,null,_0x48b9a7+_0xa81e('0x12')+_0x29e134+'.'+_0x59fa31)[_0xa81e('0x13')](_0x29e134+_0xa81e('0x39'),_0x34d926)['where'](_0xa81e('0x3a'),NOW)[_0xa81e('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x29e134,_0x48b9a7,_0x59fa31,_0xa81e('0x2b'),[_0xa81e('0x3b'),_0xa81e('0x3c')]))['where'](_0xa81e('0x3d'),selectNotIn(_0x29e134,_0x48b9a7,_0x59fa31,_0xa81e('0x2b'),[_0xa81e('0x3b')])))[_0xa81e('0x3e')]();}function insertCmHopperBlack(_0x33f958,_0x64c879,_0x2d78ba,_0xbeac64){var _0x244f31=[_0xa81e('0x23'),_0xa81e('0x25'),'cm_contacts.ListId',_0x64c879+'.'+_0xbeac64,_0xa81e('0x26'),_0xa81e('0x3f')];return squel[_0xa81e('0x29')]()[_0xa81e('0x2a')](_0xa81e('0x40'))['fromQuery']([_0xa81e('0x41'),_0xa81e('0x2e'),_0xa81e('0x2f'),_0xbeac64,_0xa81e('0x30'),_0xa81e('0x31')],squel[_0xa81e('0xe')]()[_0xa81e('0x35')](_0x244f31)['from'](_0x64c879)[_0xa81e('0x11')]('cm_contacts',null,_0xa81e('0x37')+_0x64c879+_0xa81e('0x38'))[_0xa81e('0x11')](_0x2d78ba,null,_0x2d78ba+'.id\x20=\x20'+_0x64c879+'.'+_0xbeac64)[_0xa81e('0x13')](_0x64c879+_0xa81e('0x39'),_0x33f958)[_0xa81e('0x13')](_0xa81e('0x3a'),NOW)[_0xa81e('0x13')](_0xa81e('0x3d'),squel[_0xa81e('0xe')]()['field']('phone')[_0xa81e('0x10')](_0xa81e('0x40'))[_0xa81e('0x13')]('ListId\x20=\x20?',_0x33f958)[_0xa81e('0x13')](_0xbeac64+_0xa81e('0x14')+_0x64c879+'.'+_0xbeac64)))[_0xa81e('0x3e')]();}function insertTzCmHopper(_0x29e4a8,_0xee96a7,_0x540fb8,_0x214002,_0x2f0d7b,_0x5d0c21){var _0x2a8560=[_0xa81e('0x23'),_0xa81e('0x42')+_0x5d0c21+_0xa81e('0x43'),_0xa81e('0x25'),_0xa81e('0x44'),_0xee96a7+'.'+_0x214002,_0xa81e('0x26'),_0xa81e('0x3f'),'cm_contacts.priority',_0xa81e('0x28'),'\x22'+_0x2f0d7b+'\x22'];var _0x50c9a0=squel['insert']()[_0xa81e('0x2a')](_0xa81e('0x2b'))[_0xa81e('0x2c')]([_0xa81e('0x41'),_0xa81e('0x2d'),'ContactId',_0xa81e('0x2f'),_0x214002,_0xa81e('0x30'),'updatedAt',_0xa81e('0x32'),'UserId','recallme'],squel[_0xa81e('0xe')]()[_0xa81e('0x35')](_0x2a8560)['from'](_0xee96a7)[_0xa81e('0x11')](_0xa81e('0x36'),null,_0xa81e('0x37')+_0xee96a7+_0xa81e('0x38'))['join'](_0x540fb8,null,_0x540fb8+_0xa81e('0x12')+_0xee96a7+'.'+_0x214002)[_0xa81e('0x11')](_0x5d0c21,null,_0x5d0c21+'.id\x20=\x20'+_0xee96a7+'.'+_0x214002)[_0xa81e('0x13')](_0xee96a7+'.CmListId\x20=\x20?',_0x29e4a8)['where'](_0xa81e('0x3a'),NOW)[_0xa81e('0x13')](_0xa81e('0x3d'),selectNotIn(_0xee96a7,_0x540fb8,_0x214002,_0xa81e('0x2b'),[_0xa81e('0x3b'),'\x22onlyIfOpen\x22']))[_0xa81e('0x13')](_0xa81e('0x3d'),selectNotIn(_0xee96a7,_0x540fb8,_0x214002,_0xa81e('0x2b'),[_0xa81e('0x3b')])))[_0xa81e('0x3e')]();return _0x50c9a0;}function insertTzCmHopperBlack(_0x4903ce,_0x1219d8,_0x23b7ab,_0x4ab5e6){var _0x2dbc03=['cm_contacts.phone',_0xa81e('0x25'),_0xa81e('0x44'),_0x1219d8+'.'+_0x4ab5e6,_0xa81e('0x26'),_0xa81e('0x3f')];return squel[_0xa81e('0x29')]()['into'](_0xa81e('0x40'))[_0xa81e('0x2c')]([_0xa81e('0x41'),_0xa81e('0x2e'),_0xa81e('0x2f'),_0x4ab5e6,_0xa81e('0x30'),_0xa81e('0x31')],squel['select']()[_0xa81e('0x35')](_0x2dbc03)['from'](_0x1219d8)[_0xa81e('0x11')]('cm_contacts',null,_0xa81e('0x37')+_0x1219d8+_0xa81e('0x38'))[_0xa81e('0x11')](_0x23b7ab,null,_0x23b7ab+'.id\x20=\x20'+_0x1219d8+'.'+_0x4ab5e6)['where'](_0x1219d8+_0xa81e('0x39'),_0x4903ce)[_0xa81e('0x13')](_0xa81e('0x3a'),NOW)[_0xa81e('0x13')](_0xa81e('0x3d'),squel[_0xa81e('0xe')]()[_0xa81e('0xf')](_0xa81e('0x41'))[_0xa81e('0x10')](_0xa81e('0x40'))['where'](_0xa81e('0x45'),_0x4903ce)['where'](_0x4ab5e6+'\x20=\x20'+_0x1219d8+'.'+_0x4ab5e6)))['toString']();}function insertCmHopperAdditionalPhones(_0x1ee5b9){var _0x518909=[_0xa81e('0x46'),'cm_contact_has_items.item',_0xa81e('0x47'),_0xa81e('0x48'),_0xa81e('0x49')];return squel[_0xa81e('0x29')]()['into'](_0xa81e('0x4a'))[_0xa81e('0x2c')](['CmHopperId',_0xa81e('0x41'),'OrderBy',_0xa81e('0x30'),_0xa81e('0x31')],squel[_0xa81e('0xe')]()['fields'](_0x518909)['from'](_0xa81e('0x2b'))[_0xa81e('0x11')]('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xa81e('0x11')](_0xa81e('0x4b'),null,_0xa81e('0x4c'))[_0xa81e('0x13')](_0xa81e('0x4d'),_0x1ee5b9)[_0xa81e('0x13')](_0xa81e('0x3a'),NOW))[_0xa81e('0x3e')]();}function insertCmContact(_0x447799,_0xc71086,_0x3008db,_0x51775c){var _0x1256b4=_[_0xa81e('0x4e')](_[_0xa81e('0x4f')](_0x51775c),['ListId',_0xa81e('0x50'),_0xa81e('0x30'),_0xa81e('0x31'),_0xa81e('0x51')]);return squel[_0xa81e('0x29')]()[_0xa81e('0x2a')](_0xa81e('0x36'))[_0xa81e('0x2c')](_0x1256b4,squel[_0xa81e('0xe')]()['fields'](_0x1256b4)[_0xa81e('0x10')](_0xc71086)[_0xa81e('0x13')]('('+_0x3008db[_0xa81e('0x11')](',')+_0xa81e('0x52'),squel[_0xa81e('0xe')]()[_0xa81e('0x35')](_0x3008db)[_0xa81e('0x10')](_0xa81e('0x36'))['where']('ListId\x20=\x20?',_0x447799)[_0xa81e('0x13')](_0xa81e('0x53')))[_0xa81e('0x13')](_0xa81e('0x54'),squel[_0xa81e('0xe')]()[_0xa81e('0xf')](_0xa81e('0x55'),_0xa81e('0x56'))[_0xa81e('0x10')](_0xc71086)[_0xa81e('0x57')](_0x3008db[_0xa81e('0x11')](','))))[_0xa81e('0x3e')]();}function handleStop(){logger[_0xa81e('0x58')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x12f1df){logger['error'](_0x12f1df[_0xa81e('0x59')]);process[_0xa81e('0x5a')](0x1);}function handleError(_0x557920,_0x1ce9d9){stats[_0xa81e('0x5b')][_0xa81e('0x19')]({'name':_0x1ce9d9['code'],'message':_0x1ce9d9[_0xa81e('0x59')],'row':_0x557920});}function handleQuery(_0x480111){logger[_0xa81e('0x58')](_0x480111);return db[_0xa81e('0x5c')][_0xa81e('0x5d')](_0x480111)[_0xa81e('0x5e')](function(_0xf8055f){results[_0xa81e('0x19')](_0xf8055f);})[_0xa81e('0x5f')](function(_0x229a99){logger['error'](_0x229a99['message']);});}function updateTzCampaigns(_0x2ee104){return new Promise(function(_0x20d445,_0x1640fe){var _0x4b8dcf=squel[_0xa81e('0xe')]()[_0xa81e('0x35')]([_0xa81e('0x60'),_0xa81e('0x61')])[_0xa81e('0x10')](_0xa81e('0x62'))['join']('campaigns_has_cm_lists',null,_0xa81e('0x63'))[_0xa81e('0x13')](_0xa81e('0x64')+_0x2ee104);db[_0xa81e('0x5c')][_0xa81e('0x5d')](_0x4b8dcf[_0xa81e('0x3e')]())[_0xa81e('0x5e')](function(_0x1cb122){var _0x59db58=[];for(var _0x40ec72=0x0;_0x40ec72<_0x1cb122[_0xa81e('0x18')];_0x40ec72++){_0x59db58['push'](getTimezoneData(_0x1cb122[_0x40ec72],tmp_campaigns));}BPromise[_0xa81e('0x1b')](_0x59db58)[_0xa81e('0x17')](function(){_0x20d445({'val':0x1});});})[_0xa81e('0x5f')](function(_0x2e2075){logger['error'](_0x2e2075[_0xa81e('0x59')]);_0x20d445({'val':0x0});});});}function updateTzVoiceQueues(_0x422d52){return new Promise(function(_0x794238,_0x3c9144){var _0x40e413=squel[_0xa81e('0xe')]()[_0xa81e('0x35')]([_0xa81e('0x65'),_0xa81e('0x66')])[_0xa81e('0x10')](_0xa81e('0x67'))[_0xa81e('0x11')]('voice_queues_has_cm_lists',null,_0xa81e('0x68'))[_0xa81e('0x13')]('voice_queues_has_cm_lists.CmListId='+_0x422d52);db[_0xa81e('0x5c')][_0xa81e('0x5d')](_0x40e413[_0xa81e('0x3e')]())[_0xa81e('0x5e')](function(_0x5bd687){var _0x18041b=[];for(var _0x10f5c8=0x0;_0x10f5c8<_0x5bd687[_0xa81e('0x18')];_0x10f5c8++){_0x18041b[_0xa81e('0x19')](getTimezoneData(_0x5bd687[_0x10f5c8],tmp_voice_queues));}BPromise[_0xa81e('0x1b')](_0x18041b)[_0xa81e('0x17')](function(){_0x794238({'val':0x1});});})[_0xa81e('0x5f')](function(_0x3ee65b){logger[_0xa81e('0x69')](_0x3ee65b[_0xa81e('0x59')]);_0x794238({'val':0x0});});});}function getTimezoneData(_0x6d2c97,_0x1502f7){return new Promise(function(_0x4290c6,_0xae65ed){var _0x944eeb=shared[_0xa81e('0x6a')];var _0x3fda60=_0x944eeb[_0x6d2c97[_0xa81e('0x6b')]];if(_[_0xa81e('0x1c')](_0x3fda60)){_0x4290c6({'ret':0x1});}else{var _0x46e69d=_0x3fda60[_0xa81e('0x6c')];var _0x35431c=squel[_0xa81e('0x29')]()[_0xa81e('0x2a')](_0x1502f7)['set']('id',_0x6d2c97['id'])[_0xa81e('0x6d')]('offset',_0x46e69d)['set'](_0xa81e('0x6b'),_0x6d2c97['dialTimezone'])[_0xa81e('0x3e')]();return db[_0xa81e('0x5c')][_0xa81e('0x5d')](_0x35431c)[_0xa81e('0x5e')](function(_0x147562){_0x4290c6({'ret':0x1});})['catch'](function(_0x7f0532){logger[_0xa81e('0x69')](_0x7f0532[_0xa81e('0x59')]);_0xae65ed({'ret':0x1});});}});}function handleTZQuery(_0xbc76d3){logger[_0xa81e('0x58')](_0xbc76d3);return db[_0xa81e('0x5c')]['query'](_0xbc76d3)[_0xa81e('0x5e')](function(_0x1d6e7f){})[_0xa81e('0x5f')](function(_0x51fc71){logger[_0xa81e('0x69')](_0x51fc71[_0xa81e('0x59')]);});}function main(_0x442bea,_0x90ad6f,_0x563d42,_0x109b46){logger[_0xa81e('0x58')](_0xa81e('0x6e'),_0x442bea,JSON[_0xa81e('0x6f')](_0x90ad6f));process[_0xa81e('0x70')](_0xa81e('0x71'));var _0x4d64a4=_0x90ad6f[_0xa81e('0x72')];var _0x1a6246=_['clone'](_0x4d64a4);var _0x394a61=_0x90ad6f[_0xa81e('0x73')];var _0x5556e3=path[_0xa81e('0x11')](config['root'],_0xa81e('0x74'),_0x394a61+_0xa81e('0x75'));hasTZ=_[_0xa81e('0x4f')](_0x4d64a4)[_0xa81e('0x76')](_0xa81e('0x6b'));var _0xd8a3d9=_[_0xa81e('0x4f')](_0x4d64a4)[_0xa81e('0x11')]();logger['info'](_0xa81e('0x77'),_0xd8a3d9);db[_0xa81e('0x78')][_0xa81e('0x15')]({'raw':!![],'attributes':['id',_0xa81e('0x79')]})[_0xa81e('0x17')](function(_0x394cfa){for(var _0x571761=0x0;_0x571761<_0x394cfa[_0xa81e('0x18')];_0x571761++){if(_0x394cfa[_0x571761][_0xa81e('0x79')]in _0x4d64a4){contactItemTypes[_0xa81e('0x19')](_0x394cfa[_0x571761]);delete _0x1a6246[_0x394cfa[_0x571761]['name']];hasAdditionalPhones=!![];}for(var _0x926ba3 in _0x4d64a4){if(_0x394cfa[_0x571761][_0xa81e('0x79')]+_0xa81e('0x7a')===_0x926ba3){phoneDescriptions[_0xa81e('0x19')]({'itemTypeId':_0x394cfa[_0x571761]['id'],'description':_0x926ba3});delete _0x1a6246[_0x926ba3];}}}if(hasAdditionalPhones)_0x1a6246[_0xa81e('0x16')]='';var _0x14447a=_['keys'](_0x1a6246)['join']();logger['info'](_0xa81e('0x77'),_0x14447a);fs[_0xa81e('0x7b')](_0x5556e3,_0x14447a+'\x0a');Papa[_0xa81e('0x7c')](fs[_0xa81e('0x7d')](_0x442bea),{'header':!![],'skipEmptyLines':!![],'step':function(_0x193f09,_0x1be82b){try{for(var _0x1e2ee5=0x0,_0x88ffe7=[];_0x1e2ee5<_0x193f09['data'][_0xa81e('0x18')];_0x1e2ee5++){stats[_0xa81e('0x7e')]+=0x1;if(_0x193f09[_0xa81e('0x5b')][_0x1e2ee5]){handleError(_0x193f09[_0xa81e('0x7f')][_0x1e2ee5],_0x193f09[_0xa81e('0x5b')][_0x1e2ee5]);}else{var _0x37fef3=[];var _0x5f4d31=[];var _0x566d3d={};for(var _0x465fa8 in _0x4d64a4){let _0x3a959f=contactItemTypes[_0xa81e('0x80')](_0x57f16b=>_0x57f16b[_0xa81e('0x79')]===_0x465fa8);let _0x45e4de=contactItemTypes['find'](_0x1bbad6=>_0x1bbad6[_0xa81e('0x79')]+_0xa81e('0x7a')===_0x465fa8);if(_[_0xa81e('0x1c')](_0x3a959f)&&_[_0xa81e('0x1c')](_0x45e4de)){if(_0x4d64a4['hasOwnProperty'](_0x465fa8)){if(_0x193f09[_0xa81e('0x7f')][_0x1e2ee5][_0x4d64a4[_0x465fa8]]){var _0x3ba70e=_['trim'](_0x193f09['data'][_0x1e2ee5][_0x4d64a4[_0x465fa8]][_0xa81e('0x81')](/"/g,'\x27'));switch(_0x465fa8){case'scheduledat':var _0x2b081d=moment(_0x3ba70e,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x2b081d[_0xa81e('0x82')]()){_0x88ffe7[_0xa81e('0x19')]('\x22'+_0x3ba70e+'\x22');}else{_0x37fef3[_0xa81e('0x19')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x2af149=parseInt(_0x3ba70e);_0x3ba70e=_[_0xa81e('0x83')](_0x2af149)||_0x2af149<0x0||_0x2af149>0x4?_0x109b46?0x3:0x2:_0x2af149;_0x88ffe7[_0xa81e('0x19')]('\x22'+_0x3ba70e+'\x22');break;case'UserId':var _0x554df3=parseInt(_0x3ba70e);if(_['isNumber'](_0x554df3)&&_[_0xa81e('0x76')](_0x563d42,_0x554df3)){_0x88ffe7['push']('\x22'+_0x554df3+'\x22');}else{_0x37fef3[_0xa81e('0x19')](_0xa81e('0x84'));}break;case _0xa81e('0x85'):if(isEmail(_0x3ba70e)){_0x88ffe7[_0xa81e('0x19')]('\x22'+_0x3ba70e+'\x22');}else{_0x37fef3['push']('email\x20wrong\x20format');}break;case _0xa81e('0x86'):var _0x2c0001=moment(_0x3ba70e,_0xa81e('0x87'),!![]);if(_0x2c0001[_0xa81e('0x82')]()){_0x88ffe7[_0xa81e('0x19')]('\x22'+_0x3ba70e+'\x22');}else{_0x37fef3[_0xa81e('0x19')](_0xa81e('0x88'));}break;case _0xa81e('0x6b'):var _0x4d172e=shared[_0xa81e('0x6a')];var _0x216689=_0x4d172e[_0x3ba70e];if(!_[_0xa81e('0x1c')](_0x216689)){var _0x3427b6=_0x216689['utcOffset'];_0x88ffe7[_0xa81e('0x19')]('\x22'+_0x3ba70e+'\x22');_0x88ffe7[_0xa81e('0x19')]('\x22'+_0x3427b6+'\x22');}break;default:_0x88ffe7['push']('\x22'+_0x3ba70e+'\x22');}}else{switch(_0x465fa8){case'firstName':case _0xa81e('0x41'):_0x37fef3[_0xa81e('0x19')](_0x465fa8+'\x20not\x20specified');break;default:_0x88ffe7[_0xa81e('0x19')]('\x22\x22');}}}}else{var _0x14edd5='';if(!_[_0xa81e('0x1c')](_0x3a959f)){if(!_0x566d3d[_0xa81e('0x89')](_0x3a959f['id'])){if(!_[_0xa81e('0x1c')](_0x193f09['data'][_0x1e2ee5][_0x4d64a4[_0x465fa8]])){var _0x3ba70e=_[_0xa81e('0x8a')](_0x193f09[_0xa81e('0x7f')][_0x1e2ee5][_0x4d64a4[_0x465fa8]][_0xa81e('0x81')](/"/g,'\x27'));var _0x4ffb6e=phoneDescriptions[_0xa81e('0x80')](_0x1873c0=>_0x1873c0[_0xa81e('0x8b')]===_0x3a959f['id']);if(!_[_0xa81e('0x1c')](_0x4ffb6e)){var _0x20027c=_[_0xa81e('0x8a')](_0x193f09[_0xa81e('0x7f')][_0x1e2ee5][_0x4d64a4[_0x4ffb6e[_0xa81e('0x8c')]]][_0xa81e('0x81')](/"/g,'\x27'));if(!_[_0xa81e('0x1c')](_0x20027c))_0x3ba70e=_0x3ba70e+'§'+_0x20027c;}if(_0x14edd5=='')_0x14edd5=_0x3ba70e;else _0x14edd5+='|'+_0x3ba70e;}_0x5f4d31[_0xa81e('0x19')](_0x3a959f['id']+':'+_0x14edd5);_0x566d3d[_0x3a959f['id']]=0x1;}}}}if(hasAdditionalPhones){_0x88ffe7[_0xa81e('0x19')]('\x22'+_0x5f4d31[_0xa81e('0x11')](';')+'\x22');}if(_0x37fef3['length']){handleError(_0x193f09[_0xa81e('0x7f')][_0x1e2ee5],{'code':'SystemRow','message':_0x37fef3[_0xa81e('0x11')]()});}else{fs[_0xa81e('0x8d')](_0x5556e3,_0x88ffe7[_0xa81e('0x11')]()+'\x0a');}_0x88ffe7=[];}if(!(stats[_0xa81e('0x7e')]%0xc8)){socket[_0xa81e('0x8e')](_0xa81e('0x8f')+_0x394a61,stats);stats[_0xa81e('0x5b')]=[];}}if(stopped){logger[_0xa81e('0x58')](_0xa81e('0x90'));_0x1be82b[_0xa81e('0x91')]();}}catch(_0x5e3697){handleError(_0x193f09[_0xa81e('0x7f')][_0x1e2ee5],{'code':_0xa81e('0x92'),'message':_0x5e3697['message']});logger['error']('step',_0x5e3697[_0xa81e('0x59')]);}},'complete':function(){try{var _0x7554b3=[];var _0x25838=[];var _0x1d4e30=_0xa81e('0x36');if(_0x90ad6f['duplicates']&&_0x90ad6f[_0xa81e('0x93')]['length']){_0x1d4e30=_0xa81e('0x94')+_0x394a61;_0x7554b3['push'](_0xa81e('0x95')+_0x1d4e30+_0xa81e('0x96'));}tmp_campaigns=_0xa81e('0x97')+_0x394a61;tmp_voice_queues=_0xa81e('0x98')+_0x394a61;_0x25838[_0xa81e('0x19')](_0xa81e('0x95')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x25838[_0xa81e('0x19')](_0xa81e('0x95')+tmp_voice_queues+_0xa81e('0x99'));BPromise[_0xa81e('0x9a')](_0x25838,handleTZQuery)[_0xa81e('0x17')](function(_0x3ba590){updateTzCampaigns(_0x90ad6f[_0xa81e('0x2f')])[_0xa81e('0x17')](function(_0x530433){updateTzVoiceQueues(_0x90ad6f[_0xa81e('0x2f')])[_0xa81e('0x17')](function(_0x1b721e){if(hasTZ)_0x14447a=_0x14447a[_0xa81e('0x81')]('dialTimezone',_0xa81e('0x9b'));var _0x3fd6bf=util[_0xa81e('0xb')](_0xa81e('0x9c'),_0x5556e3,_0x1d4e30,_0x14447a,_0x90ad6f[_0xa81e('0x2f')],_0x90ad6f[_0xa81e('0x50')]||null,NOW,NOW);if(_[_0xa81e('0x1c')](_0x4d64a4['scheduledat'])){_0x3fd6bf+=_0xa81e('0x9d');}_0x7554b3[_0xa81e('0x19')](_0x3fd6bf);if(_0x90ad6f[_0xa81e('0x93')]&&_0x90ad6f['duplicates'][_0xa81e('0x18')]){_0x7554b3[_0xa81e('0x19')](insertCmContact(_0x90ad6f[_0xa81e('0x2f')],_0x1d4e30,_0x90ad6f[_0xa81e('0x93')],_0x4d64a4));_0x7554b3[_0xa81e('0x19')]('DROP\x20TABLE\x20'+_0x1d4e30+';');}BPromise[_0xa81e('0x9a')](_0x7554b3,handleQuery)[_0xa81e('0x17')](function(_0x75d711){BPromise[_0xa81e('0x1b')]([handleAdditionalPhones()])[_0xa81e('0x17')](function(){_0x7554b3=[];for(var _0x263e0c=0x0;_0x263e0c\x20\x20');}var _0xba9fcb=path[_0xa81e('0x11')](config[_0xa81e('0xac')],_0xa81e('0x74'),process['argv'][0x2]);if(!fs[_0xa81e('0xad')](_0xba9fcb)){throw new Error(_0xa81e('0xae'));}var _0x773d1c={};try{_0x773d1c=JSON[_0xa81e('0x7c')](process[_0xa81e('0xab')][0x3]);if(!_0x773d1c['binding']){throw new Error(_0xa81e('0xaf'));}if(!_0x773d1c[_0xa81e('0x72')][_0xa81e('0x41')]){throw new Error(_0xa81e('0xb0'));}if(!_0x773d1c[_0xa81e('0x72')]['firstName']){throw new Error(_0xa81e('0xb1'));}var _0x32638f=0x0;if(_0x773d1c['binding'][_0xa81e('0x33')]){_0x32638f=0x1;}if(!_0x773d1c[_0xa81e('0x2f')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x326ef0){throw new Error(_0xa81e('0xb2'));}var _0x115483=[];try{_0x115483=_[_0xa81e('0xb3')](JSON[_0xa81e('0x7c')](process[_0xa81e('0xab')][0x4]),'id');}catch(_0x3dd3e9){logger[_0xa81e('0x58')](_0xa81e('0xb4'));}main(_0xba9fcb,_0x773d1c,_0x115483,_0x32638f);}validate();process['on'](_0xa81e('0xb5'),handleStop);process['on'](_0xa81e('0xb6'),handleUncaughtException); \ No newline at end of file +var _0xf697=['campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','error','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','main','stringify','start','binding','clone','socket_timestamp','root','keys','includes','header','ContactItemType','name','_description','AdditionalPhones','parse','createReadStream','data','rows','errors','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','\x20not\x20specified','itemTypeId','appendFileSync','emit','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','affectedRows','contact:import:','exit','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','\x20=\x20','join','CmContact','findAll','then','length','push','all','split','isNil','CmContactHasItem','findOne','update','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','fromQuery','ContactId','ListId','createdAt','priority','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','updatedAt','from','.id\x20=\x20','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.UserId','scheduledat','recallme','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_hopper.ListId\x20=\x20?','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','group','info','Received\x20SIGINT','code','message','sequelize','query','spread','catch'];(function(_0x53c2ec,_0x56b6f8){var _0xbd4cd0=function(_0x3640d1){while(--_0x3640d1){_0x53c2ec['push'](_0x53c2ec['shift']());}};_0xbd4cd0(++_0x56b6f8);}(_0xf697,0x1b8));var _0x7f69=function(_0x4e1d3c,_0x4f9988){_0x4e1d3c=_0x4e1d3c-0x0;var _0x5177b2=_0xf697[_0x4e1d3c];return _0x5177b2;};'use strict';var fs=require('fs');var path=require(_0x7f69('0x0'));var _=require(_0x7f69('0x1'));var Papa=require(_0x7f69('0x2'));var util=require(_0x7f69('0x3'));var BPromise=require(_0x7f69('0x4'));var moment=require(_0x7f69('0x5'));var squel=require(_0x7f69('0x6'));var Redis=require(_0x7f69('0x7'));var db=require(_0x7f69('0x8'))['db'];var config=require(_0x7f69('0x9'));var shared=require('../../../config/environment/shared');var logger=require(_0x7f69('0xa'))(_0x7f69('0xb'));config[_0x7f69('0xc')]=_[_0x7f69('0xd')](config[_0x7f69('0xc')],{'host':_0x7f69('0xe'),'port':0x18eb});var socket=require(_0x7f69('0xf'))(new Redis(config[_0x7f69('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x7f69('0x10')](_0x7f69('0x11'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x7f69('0x10')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x44a24c){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))*$/[_0x7f69('0x12')](_0x44a24c);}function selectNotIn(_0x248f63,_0x7ff837,_0x26bbfd,_0x2e48e1,_0x48934b){return squel[_0x7f69('0x13')]()[_0x7f69('0x14')](_0x7f69('0x15'))['from'](_0x2e48e1)['join'](_0x7ff837,null,_0x7ff837+'.id\x20=\x20'+_0x2e48e1+'.'+_0x26bbfd)['where'](_0x2e48e1+'.'+_0x26bbfd+_0x7f69('0x16')+_0x248f63+'.'+_0x26bbfd)['where'](_0x7ff837+'.dialCheckDuplicateType\x20IN\x20('+_0x48934b[_0x7f69('0x17')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x357cef,_0x178c43){promisesAdditionalPhones=[];return db[_0x7f69('0x18')][_0x7f69('0x19')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x7f69('0x1a')](function(_0x54be64){if(_0x54be64!==null){var _0x1b085b=[];for(var _0x2cc345=0x0;_0x2cc345<_0x54be64[_0x7f69('0x1b')];_0x2cc345++){var _0x379b4a=_0x54be64[_0x2cc345];_0x1b085b[_0x7f69('0x1c')](insertAdditionalPhones(_0x379b4a));}}Promise[_0x7f69('0x1d')](_0x1b085b)[_0x7f69('0x1a')](function(){_0x357cef({'val':0x1});});});});}function insertAdditionalPhones(_0x43facd){return new Promise(function(_0x422af7,_0x52053f){var _0x1564cd=_0x43facd['AdditionalPhones'];var _0xa18316=_0x1564cd[_0x7f69('0x1e')](';');var _0x2e7240=[];orderBy=0x0;for(var _0x502250=0x0;_0x502250<_0xa18316[_0x7f69('0x1b')];_0x502250++){_0x2e7240['push'](splitAdditionalPhone(_0x43facd['id'],_0xa18316[_0x502250]));}Promise[_0x7f69('0x1d')](_0x2e7240)['then'](function(){_0x422af7({'val':_0xa18316['length']});});});}function splitAdditionalPhone(_0x1f7fcc,_0x3af452){return new Promise(function(_0x2f9bcd,_0x261734){var _0x55cfce=_0x3af452[_0x7f69('0x1e')](':');var _0x9df832=_0x55cfce[0x0];var _0xf0d63d=_0x55cfce[0x1];if(!_[_0x7f69('0x1f')](_0xf0d63d)){var _0x11e41a=_0xf0d63d[_0x7f69('0x1e')]('|');var _0x32e114=[];for(var _0x179efc=0x0;_0x179efc<_0x11e41a[_0x7f69('0x1b')];_0x179efc++){if(_0x11e41a[_0x179efc]!==''){var _0x90e0b=_['filter'](promisesAdditionalPhones,{'contactId':_0x1f7fcc,'phone':_0x11e41a[_0x179efc]});if(_0x90e0b[_0x7f69('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0x7f69('0x1c')]({'contactId':_0x1f7fcc,'contactTypeId':_0x9df832,'phone':_0x11e41a[_0x179efc],'orderBy':orderBy});}}}_0x2f9bcd({'ok':0x1});}else _0x2f9bcd({'res':0x0});});}function createAdditionalPhone(_0x2ece91,_0x9c193c,_0x5b4227,_0x138b0a){var _0x265e59='';var _0x431198='';var _0x513e0b=_0x5b4227[_0x7f69('0x1e')]('§');_0x265e59=_0x513e0b[0x0];if(_0x513e0b[_0x7f69('0x1b')]==0x2)_0x431198=_0x513e0b[0x1];return new Promise(function(_0x34bf4e,_0x2008fe){return db[_0x7f69('0x20')][_0x7f69('0x21')]({'where':{'CmContactId':_0x2ece91,'item':_0x265e59}})[_0x7f69('0x1a')](function(_0x3e01ac){if(_0x3e01ac){return db[_0x7f69('0x20')][_0x7f69('0x22')]({'ItemTypeId':_0x9c193c,'description':_0x431198,'OrderBy':_0x138b0a},{'where':{'CmContactId':_0x2ece91,'item':_0x265e59}})[_0x7f69('0x1a')](function(_0x5d3b4e){_0x34bf4e({'res':'updated'});});}else{return db['CmContactHasItem'][_0x7f69('0x23')]({'CmContactId':_0x2ece91,'item':_0x265e59,'description':_0x431198,'ItemTypeId':_0x9c193c,'OrderBy':_0x138b0a,'ItemClass':_0x7f69('0x24')})['then'](function(_0x5ae14b){_0x34bf4e({'res':_0x7f69('0x25')});});}});});}function insertCmHopper(_0x18e353,_0x30f4cc,_0x24352d,_0x1f7778,_0x11608e){var _0xd35c9c=[_0x7f69('0x26'),_0x7f69('0x27'),_0x7f69('0x28'),_0x7f69('0x29'),_0x30f4cc+'.'+_0x1f7778,_0x7f69('0x2a'),_0x7f69('0x2b'),_0x7f69('0x2c'),'cm_contacts.UserId','\x22'+_0x11608e+'\x22'];return squel[_0x7f69('0x2d')]()[_0x7f69('0x2e')]('cm_hopper')[_0x7f69('0x2f')]([_0x7f69('0x15'),'scheduledat',_0x7f69('0x30'),_0x7f69('0x31'),_0x1f7778,_0x7f69('0x32'),'updatedAt',_0x7f69('0x33'),_0x7f69('0x34'),'recallme'],squel['select']()[_0x7f69('0x35')](_0xd35c9c)['from'](_0x30f4cc)[_0x7f69('0x17')](_0x7f69('0x36'),null,_0x7f69('0x37')+_0x30f4cc+_0x7f69('0x38'))[_0x7f69('0x17')](_0x24352d,null,_0x24352d+'.id\x20=\x20'+_0x30f4cc+'.'+_0x1f7778)[_0x7f69('0x39')](_0x30f4cc+_0x7f69('0x3a'),_0x18e353)[_0x7f69('0x39')](_0x7f69('0x3b'),NOW)[_0x7f69('0x39')](_0x7f69('0x3c'),selectNotIn(_0x30f4cc,_0x24352d,_0x1f7778,_0x7f69('0x3d'),[_0x7f69('0x3e'),_0x7f69('0x3f')]))[_0x7f69('0x39')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x30f4cc,_0x24352d,_0x1f7778,'cm_hopper',['\x22always\x22'])))[_0x7f69('0x40')]();}function insertCmHopperBlack(_0x193883,_0x48d4e4,_0x4d06bf,_0xf19a54){var _0xc2a98e=['cm_contacts.phone',_0x7f69('0x28'),_0x7f69('0x29'),_0x48d4e4+'.'+_0xf19a54,_0x7f69('0x2a'),_0x7f69('0x2b')];return squel[_0x7f69('0x2d')]()[_0x7f69('0x2e')](_0x7f69('0x41'))[_0x7f69('0x2f')]([_0x7f69('0x15'),_0x7f69('0x30'),_0x7f69('0x31'),_0xf19a54,_0x7f69('0x32'),_0x7f69('0x42')],squel[_0x7f69('0x13')]()['fields'](_0xc2a98e)[_0x7f69('0x43')](_0x48d4e4)[_0x7f69('0x17')](_0x7f69('0x36'),null,_0x7f69('0x37')+_0x48d4e4+_0x7f69('0x38'))[_0x7f69('0x17')](_0x4d06bf,null,_0x4d06bf+_0x7f69('0x44')+_0x48d4e4+'.'+_0xf19a54)[_0x7f69('0x39')](_0x48d4e4+'.CmListId\x20=\x20?',_0x193883)[_0x7f69('0x39')](_0x7f69('0x3b'),NOW)[_0x7f69('0x39')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7f69('0x13')]()[_0x7f69('0x14')](_0x7f69('0x15'))['from']('cm_hopper_black')['where'](_0x7f69('0x45'),_0x193883)[_0x7f69('0x39')](_0xf19a54+'\x20=\x20'+_0x48d4e4+'.'+_0xf19a54)))[_0x7f69('0x40')]();}function insertTzCmHopper(_0x1a632b,_0x1cab71,_0x31f5a3,_0x10ef1f,_0x166f4e,_0xc106ca){var _0x4600f4=[_0x7f69('0x26'),_0x7f69('0x46')+_0xc106ca+_0x7f69('0x47'),_0x7f69('0x28'),_0x7f69('0x29'),_0x1cab71+'.'+_0x10ef1f,'cm_contacts.createdAt',_0x7f69('0x2b'),_0x7f69('0x2c'),_0x7f69('0x48'),'\x22'+_0x166f4e+'\x22'];var _0x313110=squel['insert']()['into']('cm_hopper')[_0x7f69('0x2f')](['phone',_0x7f69('0x49'),_0x7f69('0x30'),_0x7f69('0x31'),_0x10ef1f,'createdAt','updatedAt',_0x7f69('0x33'),_0x7f69('0x34'),_0x7f69('0x4a')],squel[_0x7f69('0x13')]()[_0x7f69('0x35')](_0x4600f4)[_0x7f69('0x43')](_0x1cab71)[_0x7f69('0x17')](_0x7f69('0x36'),null,_0x7f69('0x37')+_0x1cab71+_0x7f69('0x38'))[_0x7f69('0x17')](_0x31f5a3,null,_0x31f5a3+_0x7f69('0x44')+_0x1cab71+'.'+_0x10ef1f)[_0x7f69('0x17')](_0xc106ca,null,_0xc106ca+_0x7f69('0x44')+_0x1cab71+'.'+_0x10ef1f)[_0x7f69('0x39')](_0x1cab71+_0x7f69('0x3a'),_0x1a632b)[_0x7f69('0x39')](_0x7f69('0x3b'),NOW)['where'](_0x7f69('0x3c'),selectNotIn(_0x1cab71,_0x31f5a3,_0x10ef1f,'cm_hopper',[_0x7f69('0x3e'),'\x22onlyIfOpen\x22']))['where'](_0x7f69('0x3c'),selectNotIn(_0x1cab71,_0x31f5a3,_0x10ef1f,'cm_hopper',['\x22always\x22'])))['toString']();return _0x313110;}function insertTzCmHopperBlack(_0x119009,_0xc6786c,_0x5a7860,_0x4fa80b){var _0x4c80f8=[_0x7f69('0x26'),_0x7f69('0x28'),_0x7f69('0x29'),_0xc6786c+'.'+_0x4fa80b,_0x7f69('0x2a'),'cm_contacts.updatedAt'];return squel['insert']()[_0x7f69('0x2e')]('cm_hopper_black')[_0x7f69('0x2f')]([_0x7f69('0x15'),'ContactId',_0x7f69('0x31'),_0x4fa80b,_0x7f69('0x32'),_0x7f69('0x42')],squel[_0x7f69('0x13')]()[_0x7f69('0x35')](_0x4c80f8)['from'](_0xc6786c)[_0x7f69('0x17')](_0x7f69('0x36'),null,_0x7f69('0x37')+_0xc6786c+_0x7f69('0x38'))['join'](_0x5a7860,null,_0x5a7860+'.id\x20=\x20'+_0xc6786c+'.'+_0x4fa80b)[_0x7f69('0x39')](_0xc6786c+_0x7f69('0x3a'),_0x119009)[_0x7f69('0x39')](_0x7f69('0x3b'),NOW)[_0x7f69('0x39')](_0x7f69('0x3c'),squel[_0x7f69('0x13')]()[_0x7f69('0x14')]('phone')[_0x7f69('0x43')](_0x7f69('0x41'))[_0x7f69('0x39')](_0x7f69('0x45'),_0x119009)[_0x7f69('0x39')](_0x4fa80b+_0x7f69('0x16')+_0xc6786c+'.'+_0x4fa80b)))[_0x7f69('0x40')]();}function insertCmHopperAdditionalPhones(_0x11b433){var _0xb0b2de=[_0x7f69('0x4b'),_0x7f69('0x4c'),_0x7f69('0x4d'),_0x7f69('0x4e'),'cm_contact_has_items.updatedAt'];return squel[_0x7f69('0x2d')]()[_0x7f69('0x2e')](_0x7f69('0x4f'))[_0x7f69('0x2f')](['CmHopperId','phone',_0x7f69('0x50'),'createdAt',_0x7f69('0x42')],squel['select']()[_0x7f69('0x35')](_0xb0b2de)['from']('cm_hopper')['join'](_0x7f69('0x36'),null,_0x7f69('0x51'))[_0x7f69('0x17')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x7f69('0x39')](_0x7f69('0x52'),_0x11b433)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x7f69('0x40')]();}function insertCmContact(_0x32b58f,_0x395b82,_0xe14a31,_0x3eb771){var _0x35e9e8=_['concat'](_['keys'](_0x3eb771),[_0x7f69('0x31'),_0x7f69('0x53'),_0x7f69('0x32'),'updatedAt',_0x7f69('0x54')]);return squel[_0x7f69('0x2d')]()[_0x7f69('0x2e')](_0x7f69('0x36'))[_0x7f69('0x2f')](_0x35e9e8,squel['select']()['fields'](_0x35e9e8)[_0x7f69('0x43')](_0x395b82)[_0x7f69('0x39')]('('+_0xe14a31[_0x7f69('0x17')](',')+_0x7f69('0x55'),squel[_0x7f69('0x13')]()[_0x7f69('0x35')](_0xe14a31)[_0x7f69('0x43')](_0x7f69('0x36'))[_0x7f69('0x39')]('ListId\x20=\x20?',_0x32b58f)['where'](_0x7f69('0x56')))[_0x7f69('0x39')]('id\x20IN\x20?',squel[_0x7f69('0x13')]()[_0x7f69('0x14')](_0x7f69('0x57'),'min_id')[_0x7f69('0x43')](_0x395b82)[_0x7f69('0x58')](_0xe14a31[_0x7f69('0x17')](','))))[_0x7f69('0x40')]();}function handleStop(){logger[_0x7f69('0x59')](_0x7f69('0x5a'));stopped=!![];}function handleUncaughtException(_0x2fd85b){logger['error'](_0x2fd85b['message']);process['exit'](0x1);}function handleError(_0x2fd73c,_0x501277){stats['errors']['push']({'name':_0x501277[_0x7f69('0x5b')],'message':_0x501277[_0x7f69('0x5c')],'row':_0x2fd73c});}function handleQuery(_0x58ed65){logger[_0x7f69('0x59')](_0x58ed65);return db[_0x7f69('0x5d')][_0x7f69('0x5e')](_0x58ed65)[_0x7f69('0x5f')](function(_0xb2854){results[_0x7f69('0x1c')](_0xb2854);})[_0x7f69('0x60')](function(_0x986c47){logger['error'](_0x986c47['message']);});}function updateTzCampaigns(_0x4e6bd5){return new Promise(function(_0x415336,_0x4c1f3d){var _0xe3c45c=squel[_0x7f69('0x13')]()[_0x7f69('0x35')](['campaigns.id',_0x7f69('0x61')])[_0x7f69('0x43')](_0x7f69('0x62'))['join'](_0x7f69('0x63'),null,_0x7f69('0x64'))['where'](_0x7f69('0x65')+_0x4e6bd5);db[_0x7f69('0x5d')][_0x7f69('0x5e')](_0xe3c45c[_0x7f69('0x40')]())[_0x7f69('0x5f')](function(_0x3461d2){var _0x517813=[];for(var _0xbd8ab6=0x0;_0xbd8ab6<_0x3461d2[_0x7f69('0x1b')];_0xbd8ab6++){_0x517813['push'](getTimezoneData(_0x3461d2[_0xbd8ab6],tmp_campaigns));}BPromise['all'](_0x517813)[_0x7f69('0x1a')](function(){_0x415336({'val':0x1});});})[_0x7f69('0x60')](function(_0x52a0d5){logger[_0x7f69('0x66')](_0x52a0d5['message']);_0x415336({'val':0x0});});});}function updateTzVoiceQueues(_0x470f03){return new Promise(function(_0x1e80ae,_0x5ccb18){var _0x5bc781=squel[_0x7f69('0x13')]()[_0x7f69('0x35')]([_0x7f69('0x67'),_0x7f69('0x68')])[_0x7f69('0x43')](_0x7f69('0x69'))[_0x7f69('0x17')](_0x7f69('0x6a'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x7f69('0x39')](_0x7f69('0x6b')+_0x470f03);db['sequelize'][_0x7f69('0x5e')](_0x5bc781[_0x7f69('0x40')]())[_0x7f69('0x5f')](function(_0x364ad6){var _0x1b0d7f=[];for(var _0x5281e6=0x0;_0x5281e6<_0x364ad6[_0x7f69('0x1b')];_0x5281e6++){_0x1b0d7f[_0x7f69('0x1c')](getTimezoneData(_0x364ad6[_0x5281e6],tmp_voice_queues));}BPromise[_0x7f69('0x1d')](_0x1b0d7f)[_0x7f69('0x1a')](function(){_0x1e80ae({'val':0x1});});})['catch'](function(_0x1eb653){logger[_0x7f69('0x66')](_0x1eb653[_0x7f69('0x5c')]);_0x1e80ae({'val':0x0});});});}function getTimezoneData(_0x1d52cb,_0x2a6003){return new Promise(function(_0x50db49,_0x13f3ed){var _0x555171=shared[_0x7f69('0x6c')];var _0x1f3b1d=_0x555171[_0x1d52cb[_0x7f69('0x6d')]];if(_[_0x7f69('0x1f')](_0x1f3b1d)){_0x50db49({'ret':0x1});}else{var _0xf0ff58=_0x1f3b1d[_0x7f69('0x6e')];var _0x493939=squel['insert']()[_0x7f69('0x2e')](_0x2a6003)['set']('id',_0x1d52cb['id'])[_0x7f69('0x6f')](_0x7f69('0x70'),_0xf0ff58)[_0x7f69('0x6f')](_0x7f69('0x6d'),_0x1d52cb[_0x7f69('0x6d')])['toString']();return db[_0x7f69('0x5d')][_0x7f69('0x5e')](_0x493939)['spread'](function(_0x4fa827){_0x50db49({'ret':0x1});})[_0x7f69('0x60')](function(_0x182c4b){logger[_0x7f69('0x66')](_0x182c4b['message']);_0x13f3ed({'ret':0x1});});}});}function handleTZQuery(_0xeaf8d1){logger[_0x7f69('0x59')](_0xeaf8d1);return db['sequelize'][_0x7f69('0x5e')](_0xeaf8d1)[_0x7f69('0x5f')](function(_0x4212c1){})[_0x7f69('0x60')](function(_0x563242){logger[_0x7f69('0x66')](_0x563242[_0x7f69('0x5c')]);});}function main(_0x1ec6b1,_0x1e3e9a,_0x335c31,_0x2a4c78){logger[_0x7f69('0x59')](_0x7f69('0x71'),_0x1ec6b1,JSON[_0x7f69('0x72')](_0x1e3e9a));process['send'](_0x7f69('0x73'));var _0x52ac0e=_0x1e3e9a[_0x7f69('0x74')];var _0x3e87b8=_[_0x7f69('0x75')](_0x52ac0e);var _0x579bea=_0x1e3e9a[_0x7f69('0x76')];var _0x51f05e=path['join'](config[_0x7f69('0x77')],'server/files/tmp',_0x579bea+'.csv');hasTZ=_[_0x7f69('0x78')](_0x52ac0e)[_0x7f69('0x79')]('dialTimezone');var _0x5081b8=_[_0x7f69('0x78')](_0x52ac0e)[_0x7f69('0x17')]();logger[_0x7f69('0x59')](_0x7f69('0x7a'),_0x5081b8);db[_0x7f69('0x7b')]['findAll']({'raw':!![],'attributes':['id','name']})[_0x7f69('0x1a')](function(_0x41e390){for(var _0x3c9e61=0x0;_0x3c9e61<_0x41e390['length'];_0x3c9e61++){if(_0x41e390[_0x3c9e61][_0x7f69('0x7c')]in _0x52ac0e){contactItemTypes[_0x7f69('0x1c')](_0x41e390[_0x3c9e61]);delete _0x3e87b8[_0x41e390[_0x3c9e61][_0x7f69('0x7c')]];hasAdditionalPhones=!![];}for(var _0x3bf615 in _0x52ac0e){if(_0x41e390[_0x3c9e61][_0x7f69('0x7c')]+_0x7f69('0x7d')===_0x3bf615){phoneDescriptions[_0x7f69('0x1c')]({'itemTypeId':_0x41e390[_0x3c9e61]['id'],'description':_0x3bf615});delete _0x3e87b8[_0x3bf615];}}}if(hasAdditionalPhones)_0x3e87b8[_0x7f69('0x7e')]='';var _0x5899ed=_[_0x7f69('0x78')](_0x3e87b8)[_0x7f69('0x17')]();logger[_0x7f69('0x59')](_0x7f69('0x7a'),_0x5899ed);fs['writeFileSync'](_0x51f05e,_0x5899ed+'\x0a');Papa[_0x7f69('0x7f')](fs[_0x7f69('0x80')](_0x1ec6b1),{'header':!![],'skipEmptyLines':!![],'step':function(_0x68627e,_0x31a21b){try{for(var _0x5dca8e=0x0,_0x1a9e3a=[];_0x5dca8e<_0x68627e[_0x7f69('0x81')][_0x7f69('0x1b')];_0x5dca8e++){stats[_0x7f69('0x82')]+=0x1;if(_0x68627e['errors'][_0x5dca8e]){handleError(_0x68627e['data'][_0x5dca8e],_0x68627e[_0x7f69('0x83')][_0x5dca8e]);}else{var _0x2760d0=[];var _0x2decae=[];var _0x1418b1={};for(var _0x38f103 in _0x52ac0e){let _0x25950e=contactItemTypes[_0x7f69('0x84')](_0x191f29=>_0x191f29[_0x7f69('0x7c')]===_0x38f103);let _0x3541b5=contactItemTypes[_0x7f69('0x84')](_0x591425=>_0x591425[_0x7f69('0x7c')]+'_description'===_0x38f103);if(_[_0x7f69('0x1f')](_0x25950e)&&_[_0x7f69('0x1f')](_0x3541b5)){if(_0x52ac0e[_0x7f69('0x85')](_0x38f103)){if(_0x68627e[_0x7f69('0x81')][_0x5dca8e][_0x52ac0e[_0x38f103]]){var _0x343cc9=_[_0x7f69('0x86')](_0x68627e[_0x7f69('0x81')][_0x5dca8e][_0x52ac0e[_0x38f103]][_0x7f69('0x87')](/"/g,'\x27'));switch(_0x38f103){case _0x7f69('0x49'):var _0x288dda=moment(_0x343cc9,_0x7f69('0x11'),!![]);if(_0x288dda[_0x7f69('0x88')]()){_0x1a9e3a['push']('\x22'+_0x343cc9+'\x22');}else{_0x2760d0[_0x7f69('0x1c')](_0x7f69('0x89'));}break;case'priority':var _0x5878fe=parseInt(_0x343cc9);_0x343cc9=_['isNaN'](_0x5878fe)||_0x5878fe<0x0||_0x5878fe>0x4?_0x2a4c78?0x3:0x2:_0x5878fe;_0x1a9e3a[_0x7f69('0x1c')]('\x22'+_0x343cc9+'\x22');break;case _0x7f69('0x34'):var _0x3eafe4=parseInt(_0x343cc9);if(_[_0x7f69('0x8a')](_0x3eafe4)&&_[_0x7f69('0x79')](_0x335c31,_0x3eafe4)){_0x1a9e3a[_0x7f69('0x1c')]('\x22'+_0x3eafe4+'\x22');}else{_0x2760d0[_0x7f69('0x1c')]('agent\x20not\x20exists');}break;case _0x7f69('0x8b'):if(isEmail(_0x343cc9)){_0x1a9e3a[_0x7f69('0x1c')]('\x22'+_0x343cc9+'\x22');}else{_0x2760d0[_0x7f69('0x1c')](_0x7f69('0x8c'));}break;case _0x7f69('0x8d'):var _0x1162f0=moment(_0x343cc9,_0x7f69('0x8e'),!![]);if(_0x1162f0['isValid']()){_0x1a9e3a['push']('\x22'+_0x343cc9+'\x22');}else{_0x2760d0[_0x7f69('0x1c')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x7f69('0x6d'):var _0x28cf54=shared[_0x7f69('0x6c')];var _0x8ee39b=_0x28cf54[_0x343cc9];if(!_[_0x7f69('0x1f')](_0x8ee39b)){var _0x33ff4c=_0x8ee39b['utcOffset'];_0x1a9e3a['push']('\x22'+_0x343cc9+'\x22');_0x1a9e3a[_0x7f69('0x1c')]('\x22'+_0x33ff4c+'\x22');}break;default:_0x1a9e3a[_0x7f69('0x1c')]('\x22'+_0x343cc9+'\x22');}}else{switch(_0x38f103){case _0x7f69('0x8f'):case'phone':_0x2760d0['push'](_0x38f103+_0x7f69('0x90'));break;default:_0x1a9e3a[_0x7f69('0x1c')]('\x22\x22');}}}}else{var _0x3b4a51='';if(!_[_0x7f69('0x1f')](_0x25950e)){if(!_0x1418b1[_0x7f69('0x85')](_0x25950e['id'])){if(!_['isNil'](_0x68627e['data'][_0x5dca8e][_0x52ac0e[_0x38f103]])){var _0x343cc9=_[_0x7f69('0x86')](_0x68627e[_0x7f69('0x81')][_0x5dca8e][_0x52ac0e[_0x38f103]][_0x7f69('0x87')](/"/g,'\x27'));var _0x40f55a=phoneDescriptions[_0x7f69('0x84')](_0x5a8b39=>_0x5a8b39[_0x7f69('0x91')]===_0x25950e['id']);if(!_[_0x7f69('0x1f')](_0x40f55a)){var _0x549473=_[_0x7f69('0x86')](_0x68627e[_0x7f69('0x81')][_0x5dca8e][_0x52ac0e[_0x40f55a['description']]]['replace'](/"/g,'\x27'));if(!_[_0x7f69('0x1f')](_0x549473))_0x343cc9=_0x343cc9+'§'+_0x549473;}if(_0x3b4a51=='')_0x3b4a51=_0x343cc9;else _0x3b4a51+='|'+_0x343cc9;}_0x2decae[_0x7f69('0x1c')](_0x25950e['id']+':'+_0x3b4a51);_0x1418b1[_0x25950e['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1a9e3a[_0x7f69('0x1c')]('\x22'+_0x2decae['join'](';')+'\x22');}if(_0x2760d0[_0x7f69('0x1b')]){handleError(_0x68627e['data'][_0x5dca8e],{'code':'SystemRow','message':_0x2760d0[_0x7f69('0x17')]()});}else{fs[_0x7f69('0x92')](_0x51f05e,_0x1a9e3a['join']()+'\x0a');}_0x1a9e3a=[];}if(!(stats[_0x7f69('0x82')]%0xc8)){socket[_0x7f69('0x93')]('contact:import:'+_0x579bea,stats);stats[_0x7f69('0x83')]=[];}}if(stopped){logger[_0x7f69('0x59')]('Abort\x20parser');_0x31a21b[_0x7f69('0x94')]();}}catch(_0x34e8c8){handleError(_0x68627e[_0x7f69('0x81')][_0x5dca8e],{'code':_0x7f69('0x95'),'message':_0x34e8c8[_0x7f69('0x5c')]});logger['error'](_0x7f69('0x96'),_0x34e8c8[_0x7f69('0x5c')]);}},'complete':function(){try{var _0x4ce50a=[];var _0x2db9f7=[];var _0x58e535=_0x7f69('0x36');if(_0x1e3e9a[_0x7f69('0x97')]&&_0x1e3e9a[_0x7f69('0x97')][_0x7f69('0x1b')]){_0x58e535='cm_contacts_'+_0x579bea;_0x4ce50a[_0x7f69('0x1c')](_0x7f69('0x98')+_0x58e535+_0x7f69('0x99'));}tmp_campaigns=_0x7f69('0x9a')+_0x579bea;tmp_voice_queues=_0x7f69('0x9b')+_0x579bea;_0x2db9f7['push']('CREATE\x20TABLE\x20'+tmp_campaigns+_0x7f69('0x9c'));_0x2db9f7[_0x7f69('0x1c')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x7f69('0x9d')](_0x2db9f7,handleTZQuery)[_0x7f69('0x1a')](function(_0x42ad67){updateTzCampaigns(_0x1e3e9a[_0x7f69('0x31')])[_0x7f69('0x1a')](function(_0x4d891e){updateTzVoiceQueues(_0x1e3e9a[_0x7f69('0x31')])[_0x7f69('0x1a')](function(_0x367a3d){if(hasTZ)_0x5899ed=_0x5899ed[_0x7f69('0x87')](_0x7f69('0x6d'),'dialTimezone,utcOffset');var _0x8ac0da=util[_0x7f69('0x10')]('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',_0x51f05e,_0x58e535,_0x5899ed,_0x1e3e9a[_0x7f69('0x31')],_0x1e3e9a[_0x7f69('0x53')]||null,NOW,NOW);if(_[_0x7f69('0x1f')](_0x52ac0e[_0x7f69('0x49')])){_0x8ac0da+=_0x7f69('0x9e');}_0x4ce50a[_0x7f69('0x1c')](_0x8ac0da);if(_0x1e3e9a[_0x7f69('0x97')]&&_0x1e3e9a['duplicates']['length']){_0x4ce50a[_0x7f69('0x1c')](insertCmContact(_0x1e3e9a[_0x7f69('0x31')],_0x58e535,_0x1e3e9a[_0x7f69('0x97')],_0x52ac0e));_0x4ce50a[_0x7f69('0x1c')](_0x7f69('0x9f')+_0x58e535+';');}BPromise[_0x7f69('0x9d')](_0x4ce50a,handleQuery)[_0x7f69('0x1a')](function(_0x383027){BPromise[_0x7f69('0x1d')]([handleAdditionalPhones()])[_0x7f69('0x1a')](function(){_0x4ce50a=[];for(var _0x125700=0x0;_0x125700\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','moment','squel','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','format','YYYYMMDDHHmmss','test','select','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','query','spread','length','phone','isNil'];(function(_0x5ccbf1,_0x4da29b){var _0x520cad=function(_0x30c059){while(--_0x30c059){_0x5ccbf1['push'](_0x5ccbf1['shift']());}};_0x520cad(++_0x4da29b);}(_0xc19a,0x7f));var _0xac19=function(_0xbf2872,_0x5d3471){_0xbf2872=_0xbf2872-0x0;var _0x24f8ca=_0xc19a[_0xbf2872];return _0x24f8ca;};'use strict';var fs=require('fs');var path=require(_0xac19('0x0'));var _=require(_0xac19('0x1'));var Papa=require(_0xac19('0x2'));var util=require(_0xac19('0x3'));var BPromise=require('bluebird');var moment=require(_0xac19('0x4'));var squel=require(_0xac19('0x5'));var Redis=require(_0xac19('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0xac19('0x7'));var logger=require(_0xac19('0x8'))('import');config[_0xac19('0x9')]=_[_0xac19('0xa')](config['redis'],{'host':_0xac19('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0xac19('0xc'));var tempTableName=_0xac19('0xd')+moment()[_0xac19('0xe')](_0xac19('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x109926){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))*$/[_0xac19('0x10')](_0x109926);}function selectNotIn(_0xa5d2e6,_0x8fb9a9,_0x577f02,_0x120ae7,_0x235603){return squel[_0xac19('0x11')]()['field']('phone')['from'](_0x120ae7)['join'](_0x8fb9a9,null,_0x8fb9a9+_0xac19('0x12')+_0x120ae7+'.'+_0x577f02)[_0xac19('0x13')](_0x120ae7+'.'+_0x577f02+'\x20=\x20'+_0xa5d2e6+'.'+_0x577f02)['where'](_0x8fb9a9+_0xac19('0x14')+_0x235603['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x127a6e,_0x3cbe58){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0xac19('0x15')]('select\x20*\x20from\x20'+tempTableName)[_0xac19('0x16')](function(_0x1961fc){if(_0x1961fc!==null){var _0x122746=[];for(var _0x20c302=0x0;_0x20c302<_0x1961fc[_0xac19('0x17')];_0x20c302++){var _0x5eb538=_0x1961fc[_0x20c302];if(!_['isNil'](_0x5eb538[_0xac19('0x18')])){if(!_[_0xac19('0x19')](_0x5eb538[_0xac19('0x1a')]))_0x122746[_0xac19('0x1b')](insertAdditionalPhones(_0x5eb538));promisesContact['push']({'contact':_0x5eb538});}}}Promise['all'](_0x122746)[_0xac19('0x1c')](function(){_0x127a6e({'val':0x1});});})[_0xac19('0x1d')](function(_0x7532b5){logger[_0xac19('0x1e')](_0x7532b5[_0xac19('0x1f')]);});});}function insertAdditionalPhones(_0x416b1f){return new Promise(function(_0x3d63c0,_0x1d150b){var _0x1287e3=_0x416b1f[_0xac19('0x1a')];if(_['isNil'](_0x1287e3))_0x1d150b({'val':0x0});else{var _0x44c92e=_0x1287e3[_0xac19('0x20')](';');var _0x2c457f=[];orderBy=0x0;for(var _0x31dbb7=0x0;_0x31dbb7<_0x44c92e['length'];_0x31dbb7++){_0x2c457f[_0xac19('0x1b')](splitAdditionalPhone(_0x416b1f['id'],_0x44c92e[_0x31dbb7]));}Promise['all'](_0x2c457f)[_0xac19('0x1c')](function(){_0x3d63c0({'val':_0x44c92e['length']});});}});}function splitAdditionalPhone(_0x404842,_0x190b63){return new Promise(function(_0x521e71,_0x339fd1){var _0x1d07e4=_0x190b63[_0xac19('0x20')](':');var _0x5351e4=_0x1d07e4[0x0];var _0x1d1308=_0x1d07e4[0x1];if(_0x1d1308!==''){var _0x1ba7db=_0x1d1308[_0xac19('0x20')]('|');var _0x378566=[];for(var _0x46ce99=0x0;_0x46ce99<_0x1ba7db[_0xac19('0x17')];_0x46ce99++){if(_0x1ba7db[_0x46ce99]!==''){var _0x5bde80=_[_0xac19('0x21')](promisesAdditionalPhones,{'contactId':_0x404842,'phone':_0x1ba7db[_0x46ce99]});if(_0x5bde80[_0xac19('0x17')]==0x0){orderBy++;promisesAdditionalPhones[_0xac19('0x1b')]({'contactId':_0x404842,'contactTypeId':_0x5351e4,'phone':_0x1ba7db[_0x46ce99],'orderBy':orderBy});}}}_0x521e71({'ok':0x1});}else _0x521e71({'res':0x0});});}function createAdditionalPhone(_0x153a6a,_0x4c3c8d,_0x1301cd,_0x212b9f){var _0x2c372b='';var _0x1779fa='';var _0x4db0be=_0x1301cd[_0xac19('0x20')]('§');_0x2c372b=_0x4db0be[0x0];if(_0x4db0be[_0xac19('0x17')]==0x2)_0x1779fa=_0x4db0be[0x1];return new Promise(function(_0x33b3e5,_0x1e7013){return db['CmContactHasItem'][_0xac19('0x22')]({'where':{'CmContactId':_0x153a6a,'item':_0x2c372b}})[_0xac19('0x1c')](function(_0x187f25){if(_0x187f25){return db[_0xac19('0x23')][_0xac19('0x24')]({'ItemTypeId':_0x4c3c8d,'description':_0x1779fa,'OrderBy':_0x212b9f},{'where':{'CmContactId':_0x153a6a,'item':_0x2c372b}})[_0xac19('0x1c')](function(_0x18e6bb){_0x33b3e5({'res':_0xac19('0x25')});});}else{return db[_0xac19('0x23')][_0xac19('0x26')]({'CmContactId':_0x153a6a,'item':_0x2c372b,'ItemTypeId':_0x4c3c8d,'description':_0x1779fa,'OrderBy':_0x212b9f,'ItemClass':'PHONE'})[_0xac19('0x1c')](function(_0x5f54e0){_0x33b3e5({'res':'inserted'});});}});});}function updateContact(_0x54c8d8){return new Promise(function(_0x25d64b,_0x1cab3c){var _0x2ab49f=_0x54c8d8['id'];delete _0x54c8d8['id'];return db[_0xac19('0x27')][_0xac19('0x24')](_0x54c8d8,{'where':{'id':_0x2ab49f}})[_0xac19('0x1c')](function(_0x158b4f){updatedRows+=0x1;return db[_0xac19('0x28')]['update']({'phone':_0x54c8d8['phone']},{'where':{'ContactId':_0x2ab49f}})[_0xac19('0x1c')](function(_0x283264){_0x25d64b({'ret':'OK'});});});});}function insertCmHopper(_0x310b39,_0x259d00,_0x1e6763,_0x51f83a,_0x152964){var _0x4b48a8=[_0xac19('0x29'),'cm_contacts.scheduledat',_0xac19('0x2a'),_0xac19('0x2b'),_0x259d00+'.'+_0x51f83a,_0xac19('0x2c'),_0xac19('0x2d'),_0xac19('0x2e'),_0xac19('0x2f'),'\x22'+_0x152964+'\x22'];return squel[_0xac19('0x30')]()[_0xac19('0x31')](_0xac19('0x32'))[_0xac19('0x33')]([_0xac19('0x18'),'scheduledat',_0xac19('0x34'),'ListId',_0x51f83a,_0xac19('0x35'),'updatedAt',_0xac19('0x36'),_0xac19('0x37'),_0xac19('0x38')],squel[_0xac19('0x11')]()['fields'](_0x4b48a8)['from'](_0x259d00)['join'](_0xac19('0x39'),null,_0xac19('0x3a')+_0x259d00+_0xac19('0x3b'))[_0xac19('0x3c')](_0x1e6763,null,_0x1e6763+_0xac19('0x12')+_0x259d00+'.'+_0x51f83a)[_0xac19('0x13')](_0x259d00+_0xac19('0x3d'),_0x310b39)['where'](_0xac19('0x3e'),NOW)[_0xac19('0x13')](_0xac19('0x3f'),selectNotIn(_0x259d00,_0x1e6763,_0x51f83a,'cm_hopper',[_0xac19('0x40'),'\x22onlyIfOpen\x22']))[_0xac19('0x13')](_0xac19('0x3f'),selectNotIn(_0x259d00,_0x1e6763,_0x51f83a,_0xac19('0x32'),[_0xac19('0x40')])))[_0xac19('0x41')]();}function insertCmHopperBlack(_0x111584,_0x8fd928,_0x1d09f7,_0x2b70ea){var _0x5693e4=[_0xac19('0x29'),_0xac19('0x2a'),'cm_contacts.ListId',_0x8fd928+'.'+_0x2b70ea,_0xac19('0x2c'),_0xac19('0x2d')];return squel['insert']()['into'](_0xac19('0x42'))[_0xac19('0x33')]([_0xac19('0x18'),_0xac19('0x34'),_0xac19('0x43'),_0x2b70ea,_0xac19('0x35'),_0xac19('0x44')],squel[_0xac19('0x11')]()[_0xac19('0x45')](_0x5693e4)[_0xac19('0x46')](_0x8fd928)[_0xac19('0x3c')](_0xac19('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x8fd928+_0xac19('0x3b'))[_0xac19('0x3c')](_0x1d09f7,null,_0x1d09f7+_0xac19('0x12')+_0x8fd928+'.'+_0x2b70ea)[_0xac19('0x13')](_0x8fd928+'.CmListId\x20=\x20?',_0x111584)[_0xac19('0x13')](_0xac19('0x3e'),NOW)[_0xac19('0x13')](_0xac19('0x3f'),squel[_0xac19('0x11')]()[_0xac19('0x47')]('phone')[_0xac19('0x46')](_0xac19('0x42'))[_0xac19('0x13')](_0xac19('0x48'),_0x111584)[_0xac19('0x13')](_0x2b70ea+_0xac19('0x49'),_0x8fd928+'.'+_0x2b70ea)))[_0xac19('0x41')]();}function insertCmHopperAdditionalPhones(_0x2fc773){var _0xa31ed3=[_0xac19('0x4a'),_0xac19('0x4b'),'cm_contact_has_items.OrderBy',_0xac19('0x4c'),'cm_contact_has_items.updatedAt'];return squel[_0xac19('0x30')]()['into'](_0xac19('0x4d'))[_0xac19('0x33')]([_0xac19('0x4e'),_0xac19('0x18'),_0xac19('0x4f'),_0xac19('0x35'),_0xac19('0x44')],squel[_0xac19('0x11')]()[_0xac19('0x45')](_0xa31ed3)[_0xac19('0x46')]('cm_hopper')['join']('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xac19('0x3c')](_0xac19('0x50'),null,_0xac19('0x51'))[_0xac19('0x13')](_0xac19('0x52'),_0x2fc773)[_0xac19('0x13')](_0xac19('0x3e'),NOW))[_0xac19('0x41')]();}function insertCmContact(_0x10e08c,_0x3c8d40,_0x3b8a53,_0x27a381){var _0x571b5f=_[_0xac19('0x53')](_[_0xac19('0x54')](_0x27a381),[_0xac19('0x43'),_0xac19('0x55'),_0xac19('0x35'),_0xac19('0x44')]);return squel[_0xac19('0x30')]()[_0xac19('0x31')]('cm_contacts')[_0xac19('0x33')](_0x571b5f,squel[_0xac19('0x11')]()[_0xac19('0x45')](_0x571b5f)['from'](_0x3c8d40)[_0xac19('0x13')]('('+_0x3b8a53[_0xac19('0x3c')](',')+_0xac19('0x56'),squel[_0xac19('0x11')]()[_0xac19('0x45')](_0x3b8a53)[_0xac19('0x46')](_0xac19('0x39'))[_0xac19('0x13')](_0xac19('0x48'),_0x10e08c))[_0xac19('0x13')]('id\x20IN\x20?',squel[_0xac19('0x11')]()[_0xac19('0x47')](_0xac19('0x57'),'min_id')[_0xac19('0x46')](_0x3c8d40)[_0xac19('0x58')](_0x3b8a53['join'](','))))['toString']();}function handleStop(){logger[_0xac19('0x59')](_0xac19('0x5a'));stopped=!![];}function handleUncaughtException(_0x5ce5bc){logger[_0xac19('0x1e')](_0x5ce5bc[_0xac19('0x1f')]);process[_0xac19('0x5b')](0x1);}function handleError(_0x15cc9e,_0x4cac1b){stats[_0xac19('0x5c')][_0xac19('0x1b')]({'name':_0x4cac1b[_0xac19('0x5d')],'message':_0x4cac1b[_0xac19('0x1f')],'row':_0x15cc9e});}function handleQuery(_0x21be91){logger[_0xac19('0x59')](_0x21be91);return db[_0xac19('0x5e')][_0xac19('0x15')](_0x21be91)[_0xac19('0x16')](function(_0x23156a){results[_0xac19('0x1b')](_0x23156a);})[_0xac19('0x1d')](function(_0x58bc3d){logger[_0xac19('0x1e')](_0x58bc3d[_0xac19('0x1f')]);});}function main(_0xedee68,_0x51bee7,_0x5beee3,_0x38b212){logger['info']('main',_0xedee68,JSON[_0xac19('0x5f')](_0x51bee7));process[_0xac19('0x60')](_0xac19('0x61'));var _0x2b3dc0=_0x51bee7[_0xac19('0x62')];var _0x555613=_[_0xac19('0x63')](_0x2b3dc0);var _0x14b18b=_0x51bee7[_0xac19('0x64')];var _0x451a93=path[_0xac19('0x3c')](config[_0xac19('0x65')],_0xac19('0x66'),_0x14b18b+_0xac19('0x67'));logger[_0xac19('0x59')]('body',_0x51bee7);db['ContactItemType'][_0xac19('0x68')]({'raw':!![],'attributes':['id',_0xac19('0x69')]})['then'](function(_0x29b235){for(var _0x1903fe=0x0;_0x1903fe<_0x29b235['length'];_0x1903fe++){if(_0x29b235[_0x1903fe][_0xac19('0x69')]in _0x2b3dc0){contactItemTypes[_0xac19('0x1b')](_0x29b235[_0x1903fe]);delete _0x555613[_0x29b235[_0x1903fe][_0xac19('0x69')]];hasAdditionalPhones=!![];}for(var _0x534392 in _0x2b3dc0){if(_0x29b235[_0x1903fe][_0xac19('0x69')]+_0xac19('0x6a')===_0x534392){phoneDescriptions[_0xac19('0x1b')]({'itemTypeId':_0x29b235[_0x1903fe]['id'],'description':_0x534392});delete _0x555613[_0x534392];}}}if(hasAdditionalPhones)_0x555613[_0xac19('0x1a')]='';var _0x3512ba=_['keys'](_0x555613)[_0xac19('0x3c')]();logger[_0xac19('0x59')](_0xac19('0x6b'),_0x3512ba);fs[_0xac19('0x6c')](_0x451a93,_0x3512ba+'\x0a');Papa[_0xac19('0x6d')](fs[_0xac19('0x6e')](_0xedee68),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2afb93,_0x41affc){try{for(var _0xbb8088=0x0,_0x5a7f87=[];_0xbb8088<_0x2afb93[_0xac19('0x6f')][_0xac19('0x17')];_0xbb8088++){stats[_0xac19('0x70')]+=0x1;if(_0x2afb93[_0xac19('0x5c')][_0xbb8088]){handleError(_0x2afb93[_0xac19('0x6f')][_0xbb8088],_0x2afb93[_0xac19('0x5c')][_0xbb8088]);}else{var _0x49ba3f=[];var _0x524e2e=[];var _0x5c8dee={};for(var _0xbbf8ec in _0x2b3dc0){let _0x1c1c67=contactItemTypes[_0xac19('0x71')](_0x3dc4c7=>_0x3dc4c7[_0xac19('0x69')]===_0xbbf8ec);let _0x5ca522=contactItemTypes[_0xac19('0x71')](_0x29739a=>_0x29739a[_0xac19('0x69')]+_0xac19('0x6a')===_0xbbf8ec);if(_[_0xac19('0x19')](_0x1c1c67)&&_[_0xac19('0x19')](_0x5ca522)){if(_0x2b3dc0['hasOwnProperty'](_0xbbf8ec)){if(_0x2afb93[_0xac19('0x6f')][_0xbb8088][_0x2b3dc0[_0xbbf8ec]]){var _0x7498c7=_[_0xac19('0x72')](_0x2afb93[_0xac19('0x6f')][_0xbb8088][_0x2b3dc0[_0xbbf8ec]]['replace'](/"/g,'\x27'));switch(_0xbbf8ec){case _0xac19('0x73'):var _0x39e36b=moment(_0x7498c7,_0xac19('0xc'),!![]);if(_0x39e36b['isValid']()){_0x5a7f87['push']('\x22'+_0x7498c7+'\x22');}else{_0x49ba3f['push'](_0xac19('0x74'));}break;case _0xac19('0x36'):var _0x2fedef=parseInt(_0x7498c7);_0x7498c7=_['isNaN'](_0x2fedef)||_0x2fedef<0x0||_0x2fedef>0x4?_0x38b212?0x3:0x2:_0x2fedef;_0x5a7f87[_0xac19('0x1b')]('\x22'+_0x7498c7+'\x22');break;case _0xac19('0x37'):var _0x1f4ecc=parseInt(_0x7498c7);if(_[_0xac19('0x75')](_0x1f4ecc)&&_[_0xac19('0x76')](_0x5beee3,_0x1f4ecc)){_0x5a7f87[_0xac19('0x1b')]('\x22'+_0x1f4ecc+'\x22');}else{_0x49ba3f[_0xac19('0x1b')](_0xac19('0x77'));}break;case _0xac19('0x78'):if(isEmail(_0x7498c7)){_0x5a7f87[_0xac19('0x1b')]('\x22'+_0x7498c7+'\x22');}else{_0x49ba3f[_0xac19('0x1b')](_0xac19('0x79'));}break;case'dateOfBirth':var _0x5f39ed=moment(_0x7498c7,_0xac19('0x7a'),!![]);if(_0x5f39ed[_0xac19('0x7b')]()){_0x5a7f87[_0xac19('0x1b')]('\x22'+_0x7498c7+'\x22');}else{_0x49ba3f[_0xac19('0x1b')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x5a7f87[_0xac19('0x1b')]('\x22'+_0x7498c7+'\x22');}}else{switch(_0xbbf8ec){case'firstName':case _0xac19('0x18'):_0x49ba3f[_0xac19('0x1b')](_0xbbf8ec+_0xac19('0x7c'));break;default:_0x5a7f87[_0xac19('0x1b')]('\x22\x22');}}}}else{var _0x2d1d02='';if(!_['isNil'](_0x1c1c67)){if(!_0x5c8dee[_0xac19('0x7d')](_0x1c1c67['id'])){for(var _0x24fd75=0x0;_0x24fd75<_0x2b3dc0[_0xbbf8ec][_0xac19('0x17')];_0x24fd75++){var _0x7498c7=_[_0xac19('0x72')](_0x2afb93['data'][_0xbb8088][_0x2b3dc0[_0xbbf8ec][_0x24fd75]][_0xac19('0x7e')](/"/g,'\x27'));var _0x8fc110=phoneDescriptions[_0xac19('0x71')](_0x165dba=>_0x165dba['itemTypeId']===_0x1c1c67['id']);if(!_[_0xac19('0x19')](_0x8fc110)){var _0x1ad2ef=_[_0xac19('0x72')](_0x2afb93[_0xac19('0x6f')][_0xbb8088][_0x2b3dc0[_0x8fc110[_0xac19('0x7f')]][0x0]][_0xac19('0x7e')](/"/g,'\x27'));if(!_[_0xac19('0x19')](_0x1ad2ef))_0x7498c7=_0x7498c7+'§'+_0x1ad2ef;}if(_0x2d1d02=='')_0x2d1d02=_0x7498c7;else _0x2d1d02+='|'+_0x7498c7;}_0x524e2e[_0xac19('0x1b')](_0x1c1c67['id']+':'+_0x2d1d02);_0x5c8dee[_0x1c1c67['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5a7f87['push']('\x22'+_0x524e2e[_0xac19('0x3c')](';')+'\x22');}if(_0x49ba3f['length']){handleError(_0x2afb93[_0xac19('0x6f')][_0xbb8088],{'code':_0xac19('0x80'),'message':_0x49ba3f['join']()});}else{fs[_0xac19('0x81')](_0x451a93,_0x5a7f87[_0xac19('0x3c')]()+'\x0a');}_0x5a7f87=[];}if(!(stats['rows']%0xc8)){socket[_0xac19('0x82')](_0xac19('0x83')+_0x14b18b,stats);stats[_0xac19('0x5c')]=[];}}if(stopped){logger[_0xac19('0x59')](_0xac19('0x84'));_0x41affc[_0xac19('0x85')]();}}catch(_0x513cbf){handleError(_0x2afb93[_0xac19('0x6f')][_0xbb8088],{'code':_0xac19('0x86'),'message':_0x513cbf['message']});logger[_0xac19('0x1e')]('step',_0x513cbf[_0xac19('0x1f')]);}},'complete':function(){try{var _0x241f98=[];var _0x5924cb=tempTableName;_0x241f98[_0xac19('0x1b')](_0xac19('0x87')+_0x5924cb+'\x20LIKE\x20cm_contacts;');logger[_0xac19('0x59')]('CIS\x20len',contactItemTypes[_0xac19('0x17')]);var _0x6cc203=util['format'](_0xac19('0x88'),_0x451a93,_0x5924cb,_0x3512ba,_0x51bee7[_0xac19('0x43')],_0x51bee7['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x2b3dc0['scheduledat'])){_0x6cc203+=_0xac19('0x89');}_0x241f98['push'](_0x6cc203);BPromise[_0xac19('0x8a')](_0x241f98,handleQuery)[_0xac19('0x1c')](function(_0x1fce29){BPromise[_0xac19('0x8b')]([handleAdditionalPhones()])[_0xac19('0x1c')](function(){_0x241f98=[];for(var _0x411925=0x0;_0x411925_0x15f15b[_0x1e51('0x69')]===_0x4e69b5);let _0x5b76ae=contactItemTypes[_0x1e51('0x6c')](_0x5ef17b=>_0x5ef17b['name']+_0x1e51('0x6d')===_0x4e69b5);if(_['isNil'](_0x1fc580)&&_[_0x1e51('0x1b')](_0x5b76ae)){if(_0x486ebd['hasOwnProperty'](_0x4e69b5)){if(_0x4464bf[_0x1e51('0x6b')][_0x17a9fd][_0x486ebd[_0x4e69b5]]){var _0x4e3460=_[_0x1e51('0x6e')](_0x4464bf[_0x1e51('0x6b')][_0x17a9fd][_0x486ebd[_0x4e69b5]]['replace'](/"/g,'\x27'));switch(_0x4e69b5){case _0x1e51('0x37'):var _0x51cbce=moment(_0x4e3460,_0x1e51('0x6f'),!![]);if(_0x51cbce[_0x1e51('0x70')]()){_0xe1cfa0[_0x1e51('0x1d')]('\x22'+_0x4e3460+'\x22');}else{_0xa31c12[_0x1e51('0x1d')](_0x1e51('0x71'));}break;case _0x1e51('0x3b'):var _0x5428f4=parseInt(_0x4e3460);_0x4e3460=_[_0x1e51('0x72')](_0x5428f4)||_0x5428f4<0x0||_0x5428f4>0x4?_0x1cf3a3?0x3:0x2:_0x5428f4;_0xe1cfa0['push']('\x22'+_0x4e3460+'\x22');break;case'UserId':var _0x23068f=parseInt(_0x4e3460);if(_[_0x1e51('0x73')](_0x23068f)&&_[_0x1e51('0x74')](_0x3e4073,_0x23068f)){_0xe1cfa0[_0x1e51('0x1d')]('\x22'+_0x23068f+'\x22');}else{_0xa31c12[_0x1e51('0x1d')](_0x1e51('0x75'));}break;case _0x1e51('0x76'):if(isEmail(_0x4e3460)){_0xe1cfa0['push']('\x22'+_0x4e3460+'\x22');}else{_0xa31c12[_0x1e51('0x1d')](_0x1e51('0x77'));}break;case _0x1e51('0x78'):var _0x4c6920=moment(_0x4e3460,'YYYY-MM-DD',!![]);if(_0x4c6920[_0x1e51('0x70')]()){_0xe1cfa0[_0x1e51('0x1d')]('\x22'+_0x4e3460+'\x22');}else{_0xa31c12['push'](_0x1e51('0x79'));}break;default:_0xe1cfa0[_0x1e51('0x1d')]('\x22'+_0x4e3460+'\x22');}}else{switch(_0x4e69b5){case'firstName':case'phone':_0xa31c12[_0x1e51('0x1d')](_0x4e69b5+_0x1e51('0x7a'));break;default:_0xe1cfa0[_0x1e51('0x1d')]('\x22\x22');}}}}else{var _0x1d6a02='';if(!_[_0x1e51('0x1b')](_0x1fc580)){if(!_0x4aa76d[_0x1e51('0x7b')](_0x1fc580['id'])){for(var _0x3718d9=0x0;_0x3718d9<_0x486ebd[_0x4e69b5]['length'];_0x3718d9++){var _0x4e3460=_[_0x1e51('0x6e')](_0x4464bf[_0x1e51('0x6b')][_0x17a9fd][_0x486ebd[_0x4e69b5][_0x3718d9]]['replace'](/"/g,'\x27'));var _0x17e98b=phoneDescriptions[_0x1e51('0x6c')](_0x49ca77=>_0x49ca77[_0x1e51('0x7c')]===_0x1fc580['id']);if(!_['isNil'](_0x17e98b)){var _0x34b98f=_['trim'](_0x4464bf['data'][_0x17a9fd][_0x486ebd[_0x17e98b['description']][0x0]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x34b98f))_0x4e3460=_0x4e3460+'§'+_0x34b98f;}if(_0x1d6a02=='')_0x1d6a02=_0x4e3460;else _0x1d6a02+='|'+_0x4e3460;}_0x34ae65['push'](_0x1fc580['id']+':'+_0x1d6a02);_0x4aa76d[_0x1fc580['id']]=0x1;}}}}if(hasAdditionalPhones){_0xe1cfa0[_0x1e51('0x1d')]('\x22'+_0x34ae65['join'](';')+'\x22');}if(_0xa31c12[_0x1e51('0x1a')]){handleError(_0x4464bf['data'][_0x17a9fd],{'code':_0x1e51('0x7d'),'message':_0xa31c12[_0x1e51('0x16')]()});}else{fs[_0x1e51('0x7e')](_0x224dbc,_0xe1cfa0['join']()+'\x0a');}_0xe1cfa0=[];}if(!(stats[_0x1e51('0x7f')]%0xc8)){socket[_0x1e51('0x80')]('contact:import:'+_0x402bbd,stats);stats[_0x1e51('0x5c')]=[];}}if(stopped){logger['info'](_0x1e51('0x81'));_0x4cd38b['abort']();}}catch(_0x2b4b49){handleError(_0x4464bf[_0x1e51('0x6b')][_0x17a9fd],{'code':_0x1e51('0x82'),'message':_0x2b4b49[_0x1e51('0x21')]});logger[_0x1e51('0x20')](_0x1e51('0x83'),_0x2b4b49['message']);}},'complete':function(){try{var _0x1adca7=[];var _0x50a248=tempTableName;_0x1adca7[_0x1e51('0x1d')](_0x1e51('0x84')+_0x50a248+_0x1e51('0x85'));logger[_0x1e51('0x5e')]('CIS\x20len',contactItemTypes['length']);var _0x4d2b67=util[_0x1e51('0xb')](_0x1e51('0x86'),_0x224dbc,_0x50a248,_0x45e607,_0x4550a8[_0x1e51('0x38')],_0x4550a8[_0x1e51('0x56')]||null,NOW,NOW);if(_['isNil'](_0x486ebd[_0x1e51('0x37')])){_0x4d2b67+=',\x20scheduledAt\x20=\x20NOW()';}_0x1adca7[_0x1e51('0x1d')](_0x4d2b67);BPromise['each'](_0x1adca7,handleQuery)['then'](function(_0xad2923){BPromise[_0x1e51('0x1e')]([handleAdditionalPhones()])['then'](function(){_0x1adca7=[];for(var _0x315f2f=0x0;_0x315f2f\x20\x20');}var _0x4042f4=path[_0x1e51('0x16')](config[_0x1e51('0x8f')],_0x1e51('0x66'),process[_0x1e51('0x8e')][0x2]);if(!fs[_0x1e51('0x90')](_0x4042f4)){throw new Error(_0x1e51('0x91'));}var _0x40db71={};try{_0x40db71=JSON[_0x1e51('0x6a')](process['argv'][0x3]);if(!_0x40db71[_0x1e51('0x63')]){throw new Error(_0x1e51('0x92'));}var _0x458a18=0x0;if(_0x40db71['binding'][_0x1e51('0x3c')]){_0x458a18=0x1;}if(!_0x40db71[_0x1e51('0x38')]){throw new Error(_0x1e51('0x93'));}}catch(_0x4944f5){throw new Error(_0x1e51('0x94'));}var _0x5c1903=[];try{_0x5c1903=_[_0x1e51('0x95')](JSON[_0x1e51('0x6a')](process[_0x1e51('0x8e')][0x4]),'id');}catch(_0x4dbfae){logger['info'](_0x1e51('0x96'));}main(_0x4042f4,_0x40db71,_0x5c1903,_0x458a18);}validate();process['on']('SIGINT',handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 182f312..e0a8805 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3836=['Called\x20Number','Member\x20Name','membername','***\x20Time\x20Info\x20***','answertime','Complete\x20Time','endtime','duration','Billable\x20Time','getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','push','queue','variable','calleridnum','outbound','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','talktime'];(function(_0x3dd0b9,_0x1d6c92){var _0x4c0351=function(_0x2cf6a8){while(--_0x2cf6a8){_0x3dd0b9['push'](_0x3dd0b9['shift']());}};_0x4c0351(++_0x1d6c92);}(_0x3836,0x8d));var _0x6383=function(_0x208aa6,_0x67e085){_0x208aa6=_0x208aa6-0x0;var _0xd7bf3=_0x3836[_0x208aa6];return _0xd7bf3;};'use strict';exports[_0x6383('0x0')]=function(_0x142fcf,_0x2dadea){var _0x503181=[{'type':_0x6383('0x1'),'content':_0x6383('0x2'),'variableName':null}];switch(_0x142fcf['toLowerCase']()){case _0x6383('0x3'):switch(_0x2dadea[_0x6383('0x4')]()){case _0x6383('0x5'):_0x503181[_0x6383('0x6')]({'type':'variable','content':'','variableName':_0x6383('0x7')});_0x503181['push']({'type':_0x6383('0x8'),'content':'','variableName':_0x6383('0x9')});break;case _0x6383('0xa'):_0x503181['push']({'type':_0x6383('0x1'),'content':'Outbound\x20Call','variableName':null});_0x503181[_0x6383('0x6')]({'type':'variable','content':'','variableName':_0x6383('0xb')});break;}}return _0x503181;};exports[_0x6383('0xc')]=function(_0x5ebd57,_0x5c9b32){var _0x4ebbac=[];switch(_0x5ebd57[_0x6383('0x4')]()){case _0x6383('0x3'):switch(_0x5c9b32[_0x6383('0x4')]()){case _0x6383('0x5'):_0x4ebbac=[{'type':'string','content':_0x6383('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0x6383('0xe'),'content':'','key':_0x6383('0xf'),'keyType':'variable','variableName':'calleridnum'},{'type':_0x6383('0xe'),'content':'','key':_0x6383('0x10'),'keyType':_0x6383('0x8'),'variableName':_0x6383('0x11')},{'type':'keyValue','content':'','key':'Call\x20To','keyType':_0x6383('0x8'),'variableName':_0x6383('0x12')},{'type':_0x6383('0xe'),'content':'','key':_0x6383('0x13'),'keyType':_0x6383('0x8'),'variableName':_0x6383('0x7')},{'type':_0x6383('0xe'),'content':'','key':_0x6383('0x14'),'keyType':'variable','variableName':_0x6383('0x15')},{'type':'keyValue','content':'','key':_0x6383('0x16'),'keyType':_0x6383('0x8'),'variableName':_0x6383('0x17')},{'type':_0x6383('0x1'),'content':_0x6383('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x6383('0xe'),'content':'','key':_0x6383('0x19'),'keyType':'variable','variableName':_0x6383('0x1a')},{'type':_0x6383('0xe'),'content':'','key':'Agent\x20Number','keyType':_0x6383('0x8'),'variableName':'destcalleridnum'},{'type':_0x6383('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x6383('0xe'),'content':'','key':_0x6383('0x1b'),'keyType':_0x6383('0x8'),'variableName':_0x6383('0x17')},{'type':_0x6383('0xe'),'content':'','key':_0x6383('0x1c'),'keyType':_0x6383('0x8'),'variableName':_0x6383('0x1d')},{'type':_0x6383('0xe'),'content':'','key':_0x6383('0x1e'),'keyType':_0x6383('0x8'),'variableName':_0x6383('0x1f')},{'type':'keyValue','content':'','key':_0x6383('0x20'),'keyType':_0x6383('0x8'),'variableName':_0x6383('0x21')},{'type':_0x6383('0xe'),'content':'','key':'Talk\x20Time','keyType':_0x6383('0x8'),'variableName':_0x6383('0x22')}];break;case _0x6383('0xa'):_0x4ebbac=[{'type':'string','content':_0x6383('0xd'),'variableName':null},{'type':_0x6383('0xe'),'content':'','key':_0x6383('0x23'),'keyType':_0x6383('0x8'),'keyContent':'','variableName':_0x6383('0xb')},{'type':_0x6383('0xe'),'content':'','key':_0x6383('0x24'),'keyType':_0x6383('0x8'),'keyContent':'','variableName':_0x6383('0x25')},{'type':_0x6383('0xe'),'content':'','key':_0x6383('0x14'),'keyType':_0x6383('0x8'),'keyContent':'','variableName':'uniqueid'},{'type':'keyValue','content':'','key':'Date','keyType':_0x6383('0x8'),'keyContent':'','variableName':'starttime'},{'type':_0x6383('0x1'),'content':_0x6383('0x26')},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':'variable','keyContent':'','variableName':_0x6383('0x27')},{'type':_0x6383('0xe'),'content':'','key':_0x6383('0x28'),'keyType':_0x6383('0x8'),'keyContent':'','variableName':_0x6383('0x29')},{'type':'keyValue','content':'','key':'Duration','keyType':'variable','keyContent':'','variableName':_0x6383('0x2a')},{'type':_0x6383('0xe'),'content':'','key':_0x6383('0x2b'),'keyType':_0x6383('0x8'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x4ebbac;}; \ No newline at end of file +var _0xb441=['***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','queue','UniqueId','uniqueid','***\x20Agent\x20Info\x20***','Agent\x20Name','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Complete','agentcompleteAt','Hold\x20Time','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','Date','Answer\x20Time','answertime','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','string','toLowerCase','voice','push','variable','calleridnum','outbound','destcalleridnum','inbound'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xb441,0x1af));var _0x1b44=function(_0x2b81aa,_0xf823cb){_0x2b81aa=_0x2b81aa-0x0;var _0x273651=_0xb441[_0x2b81aa];return _0x273651;};'use strict';exports['getSubjects']=function(_0x52dca4,_0x188105){var _0x5f080c=[{'type':_0x1b44('0x0'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x52dca4[_0x1b44('0x1')]()){case _0x1b44('0x2'):switch(_0x188105[_0x1b44('0x1')]()){case'inbound':_0x5f080c[_0x1b44('0x3')]({'type':_0x1b44('0x4'),'content':'','variableName':'queue'});_0x5f080c[_0x1b44('0x3')]({'type':_0x1b44('0x4'),'content':'','variableName':_0x1b44('0x5')});break;case _0x1b44('0x6'):_0x5f080c[_0x1b44('0x3')]({'type':'string','content':'Outbound\x20Call','variableName':null});_0x5f080c[_0x1b44('0x3')]({'type':_0x1b44('0x4'),'content':'','variableName':_0x1b44('0x7')});break;}}return _0x5f080c;};exports['getDescriptions']=function(_0x385718,_0x2f85d2){var _0x215056=[];switch(_0x385718[_0x1b44('0x1')]()){case _0x1b44('0x2'):switch(_0x2f85d2['toLowerCase']()){case _0x1b44('0x8'):_0x215056=[{'type':'string','content':_0x1b44('0x9'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x1b44('0xa'),'keyType':'variable','variableName':_0x1b44('0x5')},{'type':_0x1b44('0xb'),'content':'','key':_0x1b44('0xc'),'keyType':_0x1b44('0x4'),'variableName':_0x1b44('0xd')},{'type':'keyValue','content':'','key':_0x1b44('0xe'),'keyType':'variable','variableName':_0x1b44('0xf')},{'type':_0x1b44('0xb'),'content':'','key':_0x1b44('0x10'),'keyType':'variable','variableName':_0x1b44('0x11')},{'type':'keyValue','content':'','key':_0x1b44('0x12'),'keyType':_0x1b44('0x4'),'variableName':_0x1b44('0x13')},{'type':_0x1b44('0xb'),'content':'','key':'Date','keyType':_0x1b44('0x4'),'variableName':'agentcalledAt'},{'type':_0x1b44('0x0'),'content':_0x1b44('0x14'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x1b44('0x15'),'keyType':_0x1b44('0x4'),'variableName':'destcalleridname'},{'type':'keyValue','content':'','key':'Agent\x20Number','keyType':'variable','variableName':_0x1b44('0x7')},{'type':'string','content':_0x1b44('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0x1b44('0xb'),'content':'','key':_0x1b44('0x17'),'keyType':_0x1b44('0x4'),'variableName':'agentcalledAt'},{'type':_0x1b44('0xb'),'content':'','key':'Agent\x20Connect','keyType':_0x1b44('0x4'),'variableName':'agentconnectAt'},{'type':_0x1b44('0xb'),'content':'','key':_0x1b44('0x18'),'keyType':'variable','variableName':_0x1b44('0x19')},{'type':'keyValue','content':'','key':_0x1b44('0x1a'),'keyType':'variable','variableName':'holdtime'},{'type':'keyValue','content':'','key':_0x1b44('0x1b'),'keyType':_0x1b44('0x4'),'variableName':_0x1b44('0x1c')}];break;case _0x1b44('0x6'):_0x215056=[{'type':_0x1b44('0x0'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x1b44('0xb'),'content':'','key':_0x1b44('0x1d'),'keyType':_0x1b44('0x4'),'keyContent':'','variableName':'destcalleridnum'},{'type':'keyValue','content':'','key':_0x1b44('0x1e'),'keyType':_0x1b44('0x4'),'keyContent':'','variableName':_0x1b44('0x1f')},{'type':'keyValue','content':'','key':_0x1b44('0x12'),'keyType':'variable','keyContent':'','variableName':_0x1b44('0x13')},{'type':_0x1b44('0xb'),'content':'','key':_0x1b44('0x20'),'keyType':_0x1b44('0x4'),'keyContent':'','variableName':'starttime'},{'type':_0x1b44('0x0'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x1b44('0xb'),'content':'','key':_0x1b44('0x21'),'keyType':'variable','keyContent':'','variableName':_0x1b44('0x22')},{'type':_0x1b44('0xb'),'content':'','key':_0x1b44('0x23'),'keyType':_0x1b44('0x4'),'keyContent':'','variableName':_0x1b44('0x24')},{'type':_0x1b44('0xb'),'content':'','key':'Duration','keyType':_0x1b44('0x4'),'keyContent':'','variableName':_0x1b44('0x25')},{'type':_0x1b44('0xb'),'content':'','key':_0x1b44('0x26'),'keyType':_0x1b44('0x4'),'keyContent':'','variableName':_0x1b44('0x27')}];break;}}return _0x215056;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 0386b34..f4d8760 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ac6=['default','fields','filter','user','having','read','tags','checkAccountsRestrictions','group','i.id','tag','countFilteredInteractions','length','count','order','forEach','contactName','DESC','closed','getFilteredInteractions','catch','tracked','query','html','phone','fax','mobile','updateUser','lodash','./sql-utils','./utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','then','search','parseAdvancedSearchFilter','where','body','contact'];(function(_0x4a0f16,_0x21ba18){var _0x45d653=function(_0x137e2c){while(--_0x137e2c){_0x4a0f16['push'](_0x4a0f16['shift']());}};_0x45d653(++_0x21ba18);}(_0x1ac6,0x164));var _0x61ac=function(_0x15cc17,_0x5a498d){_0x15cc17=_0x15cc17-0x0;var _0x9607cc=_0x1ac6[_0x15cc17];return _0x9607cc;};'use strict';var _=require(_0x61ac('0x0'));var sqlUtils=require(_0x61ac('0x1'));var utils=require(_0x61ac('0x2'));exports[_0x61ac('0x3')]=function(_0x4a51a2,_0x1bc4f5,_0x52c2be,_0x266f79,_0x392bbb){var _0x10c8a2={'count':0x0,'rows':[]};var _0xa23daa=sqlUtils[_0x61ac('0x4')](_0x4a51a2,_0x52c2be,_0x1bc4f5);if(_0xa23daa){return Promise[_0x61ac('0x5')](_0x10c8a2);}var _0x19aaab=sqlUtils[_0x61ac('0x6')](_0x4a51a2);var _0x3c7d94={};return Promise['resolve']()[_0x61ac('0x7')](function(){if(_0x1bc4f5[_0x61ac('0x8')]){return sqlUtils[_0x61ac('0x9')](_0x1bc4f5[_0x61ac('0x8')],_0x392bbb);}else{return sqlUtils['parseQueryParameters'](_0x4a51a2,_0x1bc4f5,_0x392bbb);}})['then'](function(_0xdce191){_0x19aaab[_0x61ac('0xa')](_0xdce191[_0x61ac('0xb')]);_0x19aaab['where'](_0xdce191[_0x61ac('0xc')]);_0x19aaab['where'](_0xdce191[_0x61ac('0xd')]);_0x19aaab[_0x61ac('0xa')](_0xdce191[_0x61ac('0xe')]);_0x19aaab[_0x61ac('0xa')](_0xdce191[_0x61ac('0xf')]);_0x19aaab['where'](_0xdce191[_0x61ac('0x10')]);_0x19aaab[_0x61ac('0x11')](_0xdce191[_0x61ac('0x12')]);_0x3c7d94=_0xdce191[_0x61ac('0x13')];return sqlUtils[_0x61ac('0x14')](_0x4a51a2,_0x52c2be,_0x1bc4f5);})['then'](function(_0x33dec9){_0x19aaab[_0x61ac('0xa')](_0x33dec9);_0x19aaab[_0x61ac('0x15')](_0x61ac('0x16'));var _0x11439c=_0x1bc4f5['search']?_0x3c7d94['ids']:_0x1bc4f5[_0x61ac('0x17')];return sqlUtils[_0x61ac('0x18')](_0x19aaab,_0x11439c);})[_0x61ac('0x7')](function(_0x4f6567){_0x10c8a2['count']=_0x4f6567[_0x61ac('0x19')];if(_0x10c8a2[_0x61ac('0x1a')]===0x0){return[];}_0x19aaab[_0x61ac('0x11')](_0x3c7d94['clause']);if(_0x266f79[_0x61ac('0x1b')]){_0x266f79[_0x61ac('0x1b')][_0x61ac('0x1c')](function(_0x44f4f0){var _0x294607=_0x44f4f0[0x0]===_0x61ac('0x1d')?_0x44f4f0[0x0]:'i.'+_0x44f4f0[0x0];_0x19aaab[_0x61ac('0x1b')](_0x294607,_0x44f4f0[0x1]===_0x61ac('0x1e')?![]:!![]);if(_0x44f4f0[0x0]===_0x61ac('0x1f')){var _0x85d58e=sqlUtils['getClosedOrderClause'](_0x4a51a2,_0x1bc4f5);_0x19aaab[_0x61ac('0x1b')](_0x85d58e,_0x44f4f0[0x1]===_0x61ac('0x1e')?![]:!![]);}});}return sqlUtils[_0x61ac('0x20')](_0x4a51a2,_0x19aaab,_0x1bc4f5,_0x266f79);})['then'](function(_0x43f4e2){_0x10c8a2['rows']=_0x43f4e2;return _0x10c8a2;})[_0x61ac('0x21')](function(_0x29a339){throw _0x29a339;});};exports[_0x61ac('0x22')]=function(_0x162710,_0x25f18e){return function(_0x4713dd,_0x572579,_0x1efbe7){var _0xd91da6=_0x4713dd['user'];var _0x480755={};var _0x159f33=_0x4713dd[_0x61ac('0x23')];if(_0x480755){_0x480755=_['clone'](_0x4713dd[_0x61ac('0xb')]);_0x480755=_['omit'](_0x480755,[_0x61ac('0xb'),_0x61ac('0x24'),_0x61ac('0x25'),_0x61ac('0x26'),_0x61ac('0x27')]);}utils[_0x61ac('0x28')](_0xd91da6,_0x480755,_0x159f33,_0x162710,_0x25f18e);_0x1efbe7(null);};}; \ No newline at end of file +var _0x979e=['html','fax','mobile','updateUser','./sql-utils','./utils','findAll','resolve','getInteractionsQuery','then','search','parseAdvancedSearchFilter','where','body','contact','default','fields','filter','user','having','read','tags','checkAccountsRestrictions','group','i.id','ids','countFilteredInteractions','length','count','clause','order','forEach','contactName','DESC','closed','getClosedOrderClause','catch','tracked','query','clone'];(function(_0x2acd21,_0x37616e){var _0x855143=function(_0x495636){while(--_0x495636){_0x2acd21['push'](_0x2acd21['shift']());}};_0x855143(++_0x37616e);}(_0x979e,0x11c));var _0xe979=function(_0x27b6c4,_0x5d361f){_0x27b6c4=_0x27b6c4-0x0;var _0x20a004=_0x979e[_0x27b6c4];return _0x20a004;};'use strict';var _=require('lodash');var sqlUtils=require(_0xe979('0x0'));var utils=require(_0xe979('0x1'));exports[_0xe979('0x2')]=function(_0x110c88,_0x47c644,_0x3c12b7,_0x2aaa23,_0x253dd7){var _0x5872e8={'count':0x0,'rows':[]};var _0xcb25d6=sqlUtils['skipInteractionsQuery'](_0x110c88,_0x3c12b7,_0x47c644);if(_0xcb25d6){return Promise[_0xe979('0x3')](_0x5872e8);}var _0x2dff9f=sqlUtils[_0xe979('0x4')](_0x110c88);var _0x2018db={};return Promise[_0xe979('0x3')]()[_0xe979('0x5')](function(){if(_0x47c644[_0xe979('0x6')]){return sqlUtils[_0xe979('0x7')](_0x47c644[_0xe979('0x6')],_0x253dd7);}else{return sqlUtils['parseQueryParameters'](_0x110c88,_0x47c644,_0x253dd7);}})[_0xe979('0x5')](function(_0x5875f9){_0x2dff9f[_0xe979('0x8')](_0x5875f9[_0xe979('0x9')]);_0x2dff9f[_0xe979('0x8')](_0x5875f9[_0xe979('0xa')]);_0x2dff9f[_0xe979('0x8')](_0x5875f9[_0xe979('0xb')]);_0x2dff9f[_0xe979('0x8')](_0x5875f9[_0xe979('0xc')]);_0x2dff9f[_0xe979('0x8')](_0x5875f9[_0xe979('0xd')]);_0x2dff9f[_0xe979('0x8')](_0x5875f9[_0xe979('0xe')]);_0x2dff9f[_0xe979('0xf')](_0x5875f9[_0xe979('0x10')]);_0x2018db=_0x5875f9[_0xe979('0x11')];return sqlUtils[_0xe979('0x12')](_0x110c88,_0x3c12b7,_0x47c644);})[_0xe979('0x5')](function(_0x42aad0){_0x2dff9f['where'](_0x42aad0);_0x2dff9f[_0xe979('0x13')](_0xe979('0x14'));var _0x180eae=_0x47c644['search']?_0x2018db[_0xe979('0x15')]:_0x47c644['tag'];return sqlUtils[_0xe979('0x16')](_0x2dff9f,_0x180eae);})[_0xe979('0x5')](function(_0x36e678){_0x5872e8['count']=_0x36e678[_0xe979('0x17')];if(_0x5872e8[_0xe979('0x18')]===0x0){return[];}_0x2dff9f['having'](_0x2018db[_0xe979('0x19')]);if(_0x2aaa23[_0xe979('0x1a')]){_0x2aaa23[_0xe979('0x1a')][_0xe979('0x1b')](function(_0x1b8366){var _0x59563e=_0x1b8366[0x0]===_0xe979('0x1c')?_0x1b8366[0x0]:'i.'+_0x1b8366[0x0];_0x2dff9f['order'](_0x59563e,_0x1b8366[0x1]===_0xe979('0x1d')?![]:!![]);if(_0x1b8366[0x0]===_0xe979('0x1e')){var _0x4943b7=sqlUtils[_0xe979('0x1f')](_0x110c88,_0x47c644);_0x2dff9f[_0xe979('0x1a')](_0x4943b7,_0x1b8366[0x1]===_0xe979('0x1d')?![]:!![]);}});}return sqlUtils['getFilteredInteractions'](_0x110c88,_0x2dff9f,_0x47c644,_0x2aaa23);})[_0xe979('0x5')](function(_0xcdc71a){_0x5872e8['rows']=_0xcdc71a;return _0x5872e8;})[_0xe979('0x20')](function(_0x2fbbd6){throw _0x2fbbd6;});};exports[_0xe979('0x21')]=function(_0x4ec78d,_0x35c2a6){return function(_0xa7acb7,_0x4785c7,_0x39e911){var _0x451e10=_0xa7acb7[_0xe979('0xe')];var _0x415348={};var _0xd2ae79=_0xa7acb7[_0xe979('0x22')];if(_0x415348){_0x415348=_[_0xe979('0x23')](_0xa7acb7[_0xe979('0x9')]);_0x415348=_['omit'](_0x415348,['body',_0xe979('0x24'),'phone',_0xe979('0x25'),_0xe979('0x26')]);}utils[_0xe979('0x27')](_0x451e10,_0x415348,_0xd2ae79,_0x4ec78d,_0x35c2a6);_0x39e911(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index 807dff5..36841c4 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0622=['from','user_has_','_interactions','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','where','\x20IN\x20?','map','getInteractionsTables','getAccountFK','getInteractionFK','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','accounts','a.id\x20=\x20i.','\x20=\x20i.id','interactionsTags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','sms','whatsapp','i.phone\x20LIKE\x20?','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','fax','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','length','buildExpression','type','default','text','start','value','end','unreadMessages','read','Contact','operator','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','Tag','tags','clause','and','ids','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','user','body','plainBody','some','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','filter','capitalize','chat','Websites','Accounts','search','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','unshift','closed','i.substatus','shift','join','Interaction','QueryTypes','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.to','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','limit','offset','sequelize','groupBy','Setting','findOne','enableEmailPreview','all','COUNT(*)','isEmpty','Sequelize','SELECT','exports','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','role','agent','select','field','name','color'];(function(_0x3aca11,_0x4c516d){var _0x20002b=function(_0x1b69f0){while(--_0x1b69f0){_0x3aca11['push'](_0x3aca11['shift']());}};_0x20002b(++_0x4c516d);}(_0x0622,0x96));var _0x2062=function(_0x4fb6b6,_0x5eb1c7){_0x4fb6b6=_0x4fb6b6-0x0;var _0x3ea470=_0x0622[_0x4fb6b6];return _0x3ea470;};'use strict';var _=require('lodash');var squel=require(_0x2062('0x0'));var as=require(_0x2062('0x1'));var qs=require(_0x2062('0x2'));var updateInteraction=require(_0x2062('0x3'))[_0x2062('0x4')];var utils=require(_0x2062('0x5'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x242c07,_0x1e2fc6,_0x28de7e){var _0x5585a6=![];var _0x745e96=utils['getAccountFK'](_0x242c07);if(_0x1e2fc6[_0x2062('0x6')]===_0x2062('0x7')&&!_0x28de7e['search']&&!_0x28de7e[_0x745e96]){_0x5585a6=!![];}return _0x5585a6;}function getTagsQuery(){return squel[_0x2062('0x8')]()[_0x2062('0x9')]('id')[_0x2062('0x9')](_0x2062('0xa'))['field'](_0x2062('0xb'))[_0x2062('0xc')]('tools_tags');}function getUsersQuery(_0x4a1b9c,_0x51d8b7){var _0x2429c2=utils['getInteractionFK'](_0x4a1b9c);var _0x47dd45=_0x2062('0xd')+_0x4a1b9c+_0x2062('0xe');var _0x3c3358=squel[_0x2062('0x8')]()[_0x2062('0x9')](_0x2062('0xf'))['field'](_0x2062('0x10'))[_0x2062('0x9')](_0x2062('0x11')+_0x2429c2)['from'](_0x47dd45,'ui')[_0x2062('0x12')](_0x2062('0x13'),'u',_0x2062('0x14'));if(_0x51d8b7['length']>0x0){_0x3c3358[_0x2062('0x15')](_0x2062('0x11')+_0x2429c2+_0x2062('0x16'),_[_0x2062('0x17')](_0x51d8b7,'id'));}return _0x3c3358;}function getInteractionsQuery(_0x52c7e1){var _0x45e9a0=utils[_0x2062('0x18')](_0x52c7e1);var _0x654ae6=utils[_0x2062('0x19')](_0x52c7e1);var _0x5eb990=utils[_0x2062('0x1a')](_0x52c7e1);return squel['select']()[_0x2062('0xc')](_0x45e9a0[_0x2062('0x1b')],'i')[_0x2062('0x12')](_0x2062('0x1c'),'c',_0x2062('0x1d'))[_0x2062('0x12')](_0x2062('0x13'),'o','o.id\x20=\x20i.UserId')[_0x2062('0x12')](_0x45e9a0[_0x2062('0x1e')],'a',_0x2062('0x1f')+_0x654ae6)[_0x2062('0x12')](_0x45e9a0['messages'],'me','me.'+_0x5eb990+_0x2062('0x20'))['left_join'](_0x45e9a0[_0x2062('0x21')],'it','it.'+_0x5eb990+'\x20=\x20i.id')[_0x2062('0x12')]('tools_tags','t',_0x2062('0x22'));}function getSqlClauses(){var _0x17276b={'body':squel[_0x2062('0x23')](),'contact':squel[_0x2062('0x23')](),'default':squel[_0x2062('0x23')](),'fields':squel['expr'](),'filter':squel['expr'](),'read':squel['expr'](),'tags':{'clause':squel[_0x2062('0x23')](),'ids':null},'user':squel['expr']()};return _0x17276b;}function parseTagParameter(_0x2bb50a){var _0x37136a=squel[_0x2062('0x23')]();if(_0x2bb50a){var _0x24cbed=utils[_0x2062('0x24')](_0x2bb50a);_0x24cbed[_0x2062('0x25')](function(_0x80322){_0x37136a['or'](_0x2062('0x26'),'%,'+_0x80322+',%');});}return _0x37136a;}function parseReadParameter(_0x4fd5cf){var _0x438d5b='';if(_0x4fd5cf){_0x438d5b='unreadMessages\x20{OPERATOR}\x200';if(_0x4fd5cf==='1'){_0x438d5b=_0x438d5b[_0x2062('0x27')](_0x2062('0x28'),'=');}else{_0x438d5b=_0x438d5b['replace'](_0x2062('0x28'),'>');}}return _0x438d5b;}function parseSearchFilter(_0x3a26e5,_0x51960c){var _0x4ae848=squel[_0x2062('0x23')]();if(_0x51960c){var _0x28170e=_0x51960c[_0x2062('0x27')]('\x5c','\x5c\x5c')[_0x2062('0x27')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x28170e)){_0x4ae848['or']('i.id\x20LIKE\x20?',_0x28170e+'%');switch(_0x3a26e5){case _0x2062('0x29'):case _0x2062('0x2a'):_0x4ae848['or'](_0x2062('0x2b'),_0x28170e+'%');break;case'fax':_0x4ae848['or'](_0x2062('0x2c'),_0x28170e+'%');break;case _0x2062('0x2d'):_0x4ae848['or'](_0x2062('0x2e'),_0x28170e+'%');break;case _0x2062('0x2f'):_0x4ae848['or'](_0x2062('0x30'),qs['getFullTextValue'](_0x28170e,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2062('0x31')](_0x28170e));break;}}else if(_0x3a26e5==='mail'&&qs['isEmail'](_0x28170e)){_0x4ae848['or'](_0x2062('0x32'),_0x28170e+'%');}else{if(_0x3a26e5===_0x2062('0x2f')){_0x4ae848['or'](_0x2062('0x30'),qs[_0x2062('0x31')](_0x28170e,!![]))['or'](_0x2062('0x33'),qs[_0x2062('0x31')](_0x28170e));}else if(_0x3a26e5!==_0x2062('0x34')){_0x4ae848['or'](_0x2062('0x35'),qs[_0x2062('0x31')](_0x28170e));}_0x4ae848['or'](_0x2062('0x36'),qs[_0x2062('0x31')](_0x28170e,!![]),null);}}return _0x4ae848;}function parseAdvancedSearchFilter(_0x4715de,_0x1fe544){var _0x3d2f80=getSqlClauses();var _0x514a05=as[_0x2062('0x37')](_0x4715de);var _0x145197=_0x514a05[_0x2062('0x38')];for(var _0x380732=0x0;_0x380732<_0x514a05[_0x2062('0x39')][_0x2062('0x3a')];_0x380732++){var _0x151225=_0x514a05[_0x2062('0x39')][_0x380732];var _0x1748b4='i';var _0x1a38d1=_['find'](_0x1fe544,[_0x2062('0xa'),_0x151225['field']]);if(_0x1a38d1){var _0x412dfc=as[_0x2062('0x3b')](_0x1748b4,_0x1a38d1[_0x2062('0x3c')],_0x151225);_0x3d2f80[_0x2062('0x3d')][_0x145197](_0x412dfc[_0x2062('0x3e')],_0x412dfc['value'][_0x2062('0x3f')],_0x412dfc[_0x2062('0x40')][_0x2062('0x41')]);}else{switch(_0x151225[_0x2062('0x9')]){case _0x2062('0x42'):var _0x4aa9c0=parseReadParameter(_0x151225['value']);_0x3d2f80[_0x2062('0x43')]['and'](_0x4aa9c0);break;case _0x2062('0x44'):if(_0x151225[_0x2062('0x45')]==='$substring'){if(_0x151225[_0x2062('0x40')][_0x2062('0x46')]('\x20')['length']>0x1){_0x3d2f80[_0x2062('0x47')][_0x145197]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2062('0x31')](_0x151225['value'],!![]),null);}else{var _0x29967c='%'+_0x151225[_0x2062('0x40')]+'%';_0x3d2f80[_0x2062('0x47')][_0x145197](_0x2062('0x48'),_0x29967c,_0x29967c,_0x29967c);}}else{_0x1a38d1=_[_0x2062('0x49')](_0x1fe544,[_0x2062('0xa'),'ContactId']);_0x151225['field']='ContactId';_0x412dfc=as[_0x2062('0x3b')](_0x1748b4,_0x1a38d1[_0x2062('0x3c')],_0x151225);_0x3d2f80['contact'][_0x145197](_0x412dfc[_0x2062('0x3e')],_0x412dfc[_0x2062('0x40')][_0x2062('0x3f')],_0x412dfc['value'][_0x2062('0x41')]);}break;case _0x2062('0x4a'):var _0x5778fd=_0x151225['value'][_0x2062('0x46')](',')[_0x2062('0x17')](function(_0x51f5f4){return Number(_0x51f5f4);});var _0x3e9b8d=parseTagParameter(_0x5778fd);_0x3d2f80[_0x2062('0x4b')][_0x2062('0x4c')][_0x2062('0x4d')](_0x3e9b8d);_0x3d2f80[_0x2062('0x4b')][_0x2062('0x4e')]=_0x5778fd;break;case'User':if(_0x151225[_0x2062('0x45')]==='$substring'){_0x3d2f80['user'][_0x145197](_0x2062('0x4f'),'%'+_0x151225[_0x2062('0x40')]+'%',null);}else{_0x1a38d1=_[_0x2062('0x49')](_0x1fe544,['name',_0x2062('0x50')]);_0x151225[_0x2062('0x9')]=_0x2062('0x50');_0x412dfc=as[_0x2062('0x3b')](_0x1748b4,_0x1a38d1[_0x2062('0x3c')],_0x151225);_0x3d2f80[_0x2062('0x51')][_0x145197](_0x412dfc[_0x2062('0x3e')],_0x412dfc[_0x2062('0x40')][_0x2062('0x3f')],_0x412dfc[_0x2062('0x40')][_0x2062('0x41')]);}break;case _0x2062('0x52'):case _0x2062('0x53'):_0x412dfc=as['buildExpression']('me',null,_0x151225);_0x3d2f80[_0x2062('0x52')][_0x145197](_0x412dfc['text'],_0x412dfc['value'][_0x2062('0x3f')],_0x412dfc[_0x2062('0x40')][_0x2062('0x41')]);break;}}}return _0x3d2f80;}function parseModelFields(_0x3f22b7,_0x45832d,_0x30e6d6){var _0x4c836b=utils[_0x2062('0x19')](_0x3f22b7);var _0xecc8=squel[_0x2062('0x23')]();var _0x374807=_(_0x45832d)['keys']()['map'](function(_0x102240){return _[_0x2062('0x54')](_0x30e6d6,[_0x2062('0xa'),_0x102240])?_0x102240:undefined;})['compact']()[_0x2062('0x40')]();if(_0x374807[_0x2062('0x3a')]>0x0){_0x374807[_0x2062('0x25')](function(_0x95f53c){if(_0x95f53c===_0x4c836b){_0xecc8[_0x2062('0x4d')]('i.'+_0x4c836b+_0x2062('0x16'),[]['concat'](_0x45832d[_0x95f53c]));}else if(_0x95f53c===_0x2062('0x55')){var _0x9478c2=JSON[_0x2062('0x56')](_0x45832d[_0x95f53c])[_0x2062('0x57')];var _0x5963fe=JSON[_0x2062('0x56')](_0x45832d[_0x95f53c])[_0x2062('0x58')];_0xecc8[_0x2062('0x4d')](_0x2062('0x59'),_0x9478c2,_0x5963fe);}else{if(_0x45832d[_0x95f53c]===_0x2062('0x5a')){_0xecc8[_0x2062('0x4d')]('i.'+_0x95f53c+_0x2062('0x5b'));}else{_0xecc8['and']('i.'+_0x95f53c+_0x2062('0x5c'),_0x45832d[_0x95f53c]);}}});}return _0xecc8;}function parseQueryParameters(_0x17ba08,_0x12486e,_0x4b5fba){var _0x6a09aa=getSqlClauses();return Promise[_0x2062('0x5d')]()[_0x2062('0x5e')](function(){return parseModelFields(_0x17ba08,_0x12486e,_0x4b5fba);})[_0x2062('0x5e')](function(_0x4ca13a){_0x6a09aa[_0x2062('0x5f')][_0x2062('0x4d')](_0x4ca13a);return parseReadParameter(_0x12486e[_0x2062('0x43')]);})['then'](function(_0x2ff268){_0x6a09aa[_0x2062('0x43')][_0x2062('0x4d')](_0x2ff268);return parseTagParameter(_0x12486e[_0x2062('0x60')]);})[_0x2062('0x5e')](function(_0x48e293){_0x6a09aa[_0x2062('0x4b')]['clause'][_0x2062('0x4d')](_0x48e293);return parseSearchFilter(_0x17ba08,_0x12486e[_0x2062('0x61')]);})[_0x2062('0x5e')](function(_0x36bf8a){_0x6a09aa[_0x2062('0x61')]=_0x36bf8a;return _0x6a09aa;});}function checkAccountsRestrictions(_0x5adf17,_0x161cb8,_0x48dd00){var _0x2f140c=utils['getAccountFK'](_0x5adf17);var _0x3896f='get'+_[_0x2062('0x62')](_0x5adf17)+(_0x5adf17===_0x2062('0x63')?_0x2062('0x64'):_0x2062('0x65'));var _0x2d1730=squel[_0x2062('0x23')]();return Promise['resolve']()['then'](function(){if(_0x48dd00[_0x2062('0x66')]&&_0x161cb8[_0x2062('0x6')]===_0x2062('0x7')){return _0x161cb8[_0x3896f]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x5ed2d9){if(_0x5ed2d9){if(_0x5ed2d9[_0x2062('0x3a')]===0x0){_0x2d1730['and']('i.'+_0x2f140c+_0x2062('0x5b'));}else{_0x2d1730[_0x2062('0x4d')]('i.'+_0x2f140c+'\x20IN\x20?',_[_0x2062('0x17')](_0x5ed2d9,'id'));}}else if(!_0x48dd00[_0x2f140c]){_0x2d1730[_0x2062('0x4d')]('i.'+_0x2f140c+_0x2062('0x67'));}})[_0x2062('0x5e')](function(){return _0x2d1730;});}function getClosedOrderClause(_0x222a40,_0x4dfab1){var _0xba223d='';var _0x319c3e=[_0x2062('0x68'),'i.secondDisposition',_0x2062('0x69')];if(_0x222a40===_0x2062('0x2f')){_0x319c3e[_0x2062('0x6a')]('i.substatus');}if(_0x4dfab1[_0x2062('0x6b')]==='0'&&_0x222a40===_0x2062('0x2f')){_0xba223d=_0x2062('0x6c');}else{if(_0x4dfab1['closed']==='1'){_0x319c3e[_0x2062('0x6d')]();}_0xba223d='CONCAT_WS(\x27\x27,\x20'+_0x319c3e[_0x2062('0x6e')](',\x20')+')';}return _0xba223d;}function getFilteredInteractions(_0x2e621a,_0x1767e5,_0x4f3472,_0x5d39ac){var _0x308e46=utils[_0x2062('0x1a')](_0x2e621a);var _0x457393=_[_0x2062('0x62')](_0x2e621a)+_0x2062('0x6f');var _0x324e80=[];var _0x53580c=getTagsQuery();var _0x564104={'type':db['Sequelize'][_0x2062('0x70')]['SELECT'],'raw':!![]};var _0x3b1474=[];var _0x295430=[];return db['sequelize'][_0x2062('0x71')](_0x53580c[_0x2062('0x72')](),_0x564104)[_0x2062('0x5e')](function(_0x27c3cf){_0x324e80=_[_0x2062('0x73')](_0x27c3cf,'id');_0x564104=_[_0x2062('0x74')](_0x564104,{'model':db[_0x457393],'mapToModel':!![],'nest':!![]});if(_0x4f3472['fields']){_0x5d39ac[_0x2062('0x75')]['forEach'](function(_0x4692f4){_0x1767e5[_0x2062('0x9')]('i.'+_0x4692f4);});}else{_0x1767e5[_0x2062('0x9')](_0x2062('0x76'),_0x2062('0x42'));_0x1767e5[_0x2062('0x9')](_0x2062('0x77'),_0x2062('0x78'));_0x1767e5['field']('a.mandatoryDisposition',_0x2062('0x79'));if(_0x2e621a===_0x2062('0x2f')){_0x1767e5[_0x2062('0x9')]('a.email',_0x2062('0x7a'));_0x1767e5[_0x2062('0x9')](_0x2062('0x7b'),_0x2062('0x7c'));_0x1767e5[_0x2062('0x9')]('i.id');_0x1767e5[_0x2062('0x9')](_0x2062('0x7d'));_0x1767e5['field'](_0x2062('0x7e'));_0x1767e5[_0x2062('0x9')](_0x2062('0x7f'));_0x1767e5[_0x2062('0x9')](_0x2062('0x80'));_0x1767e5[_0x2062('0x9')](_0x2062('0x81'));_0x1767e5[_0x2062('0x9')](_0x2062('0x82'));_0x1767e5[_0x2062('0x9')](_0x2062('0x83'));_0x1767e5['field']('i.subject');_0x1767e5['field'](_0x2062('0x69'));_0x1767e5[_0x2062('0x9')]('i.secondDisposition');_0x1767e5[_0x2062('0x9')](_0x2062('0x68'));_0x1767e5[_0x2062('0x9')]('i.substatus');_0x1767e5[_0x2062('0x9')](_0x2062('0x84'));_0x1767e5[_0x2062('0x9')]('i.ContactId');_0x1767e5['field'](_0x2062('0x85'));_0x1767e5[_0x2062('0x9')](_0x2062('0x86'));}else if(_0x2e621a===_0x2062('0x2d')){_0x1767e5['field'](_0x2062('0x87'),_0x2062('0x7c'));}else{_0x1767e5[_0x2062('0x9')](_0x2062('0x88'),_0x2062('0x7c'));}if(_0x2e621a!==_0x2062('0x2f')){_0x1767e5[_0x2062('0x9')](_0x2062('0x89'));}_0x1767e5['field'](_0x2062('0x8a'),_0x2062('0x8b'));_0x1767e5[_0x2062('0x9')]('c.lastName',_0x2062('0x8c'));_0x1767e5[_0x2062('0x9')]('c.email',_0x2062('0x8d'));_0x1767e5['field']('c.phone',_0x2062('0x8e'));_0x1767e5[_0x2062('0x9')]('c.mobile',_0x2062('0x8f'));_0x1767e5[_0x2062('0x9')](_0x2062('0x90'),_0x2062('0x91'));_0x1767e5['field']('o.fullname',_0x2062('0x92'));_0x1767e5['field'](_0x2062('0x93'),_0x2062('0x94'));_0x1767e5[_0x2062('0x9')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x5d39ac['limit']){_0x1767e5['limit'](_0x5d39ac[_0x2062('0x95')]);}if(_0x5d39ac[_0x2062('0x96')]){_0x1767e5[_0x2062('0x96')](_0x5d39ac[_0x2062('0x96')]);}return db[_0x2062('0x97')][_0x2062('0x71')](_0x1767e5[_0x2062('0x72')](),_0x564104);})[_0x2062('0x5e')](function(_0x1e5a05){_0x3b1474=_0x1e5a05;var _0x51b17a=getUsersQuery(_0x2e621a,_0x3b1474);return db['sequelize'][_0x2062('0x71')](_0x51b17a['toString'](),_0x564104);})[_0x2062('0x5e')](function(_0x2ac9b6){_0x295430=_[_0x2062('0x98')](_0x2ac9b6,_0x308e46);if(_0x2e621a===_0x2062('0x2f')){return db[_0x2062('0x99')][_0x2062('0x9a')]({'attributes':[_0x2062('0x9b')],'raw':!![]});}})['then'](function(_0x5023e3){var _0x26d133=_0x5023e3?_0x5023e3[_0x2062('0x9b')]:undefined;var _0x511b7c=_0x3b1474['map'](function(_0x458983){return updateInteraction(_0x458983,_0x324e80,_0x295430,_0x26d133);});return Promise[_0x2062('0x9c')](_0x511b7c);});}function countFilteredInteractions(_0x3273ef,_0x331d3e){var _0xc3d53b=_0x3273ef['clone']();_0xc3d53b[_0x2062('0x9')](_0x2062('0x9d'));_0xc3d53b[_0x2062('0x9')](_0x2062('0x76'),_0x2062('0x42'));var _0x14cc90=utils[_0x2062('0x24')](_0x331d3e);if(!_[_0x2062('0x9e')](_0x14cc90)){_0xc3d53b[_0x2062('0x15')]('t.id\x20IN\x20?',_0x14cc90);}var _0x45450d={'type':db[_0x2062('0x9f')]['QueryTypes'][_0x2062('0xa0')],'raw':!![]};return db[_0x2062('0x97')]['query'](_0xc3d53b[_0x2062('0x72')](),_0x45450d);}module[_0x2062('0xa1')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x6ff6=['and','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','Tag','clause','tags','ids','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','find','text','body','keys','compact','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','then','fields','filter','get','capitalize','resolve','search','role','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','Interaction','Sequelize','query','keyBy','attributes','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.id','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','o.internal','limit','offset','sequelize','toString','groupBy','Setting','findOne','all','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','t.id\x20IN\x20?','QueryTypes','SELECT','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','../../mysqldb','agent','field','name','color','from','tools_tags','getInteractionFK','user_has_','select','u.id','u.fullname','ui.','users','length','where','\x20IN\x20?','map','getInteractionsTables','getAccountFK','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','accounts','a.id\x20=\x20i.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','fax','openchannel','i.from\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','conditions','buildExpression','type','default','value','end','unreadMessages','read'];(function(_0x2dae70,_0x321f24){var _0x3fe495=function(_0x456642){while(--_0x456642){_0x2dae70['push'](_0x2dae70['shift']());}};_0x3fe495(++_0x321f24);}(_0x6ff6,0xfa));var _0x66ff=function(_0x3e048d,_0x460b70){_0x3e048d=_0x3e048d-0x0;var _0x175f31=_0x6ff6[_0x3e048d];return _0x175f31;};'use strict';var _=require(_0x66ff('0x0'));var squel=require(_0x66ff('0x1'));var as=require(_0x66ff('0x2'));var qs=require(_0x66ff('0x3'));var updateInteraction=require(_0x66ff('0x4'))['updateInteraction'];var utils=require(_0x66ff('0x5'));var db=require(_0x66ff('0x6'))['db'];function skipInteractionsQuery(_0x373d32,_0x403fb0,_0x3c0fd6){var _0x3da9eb=![];var _0x4ecde7=utils['getAccountFK'](_0x373d32);if(_0x403fb0['role']===_0x66ff('0x7')&&!_0x3c0fd6['search']&&!_0x3c0fd6[_0x4ecde7]){_0x3da9eb=!![];}return _0x3da9eb;}function getTagsQuery(){return squel['select']()[_0x66ff('0x8')]('id')[_0x66ff('0x8')](_0x66ff('0x9'))[_0x66ff('0x8')](_0x66ff('0xa'))[_0x66ff('0xb')](_0x66ff('0xc'));}function getUsersQuery(_0x37b61e,_0x14bc41){var _0x1e1ded=utils[_0x66ff('0xd')](_0x37b61e);var _0x3c42b1=_0x66ff('0xe')+_0x37b61e+'_interactions';var _0x58eea9=squel[_0x66ff('0xf')]()[_0x66ff('0x8')](_0x66ff('0x10'))['field'](_0x66ff('0x11'))[_0x66ff('0x8')](_0x66ff('0x12')+_0x1e1ded)[_0x66ff('0xb')](_0x3c42b1,'ui')['left_join'](_0x66ff('0x13'),'u','u.id\x20=\x20ui.UserId');if(_0x14bc41[_0x66ff('0x14')]>0x0){_0x58eea9[_0x66ff('0x15')]('ui.'+_0x1e1ded+_0x66ff('0x16'),_[_0x66ff('0x17')](_0x14bc41,'id'));}return _0x58eea9;}function getInteractionsQuery(_0x1cca1c){var _0x22349e=utils[_0x66ff('0x18')](_0x1cca1c);var _0x29dffa=utils[_0x66ff('0x19')](_0x1cca1c);var _0x13a147=utils['getInteractionFK'](_0x1cca1c);return squel[_0x66ff('0xf')]()[_0x66ff('0xb')](_0x22349e[_0x66ff('0x1a')],'i')['left_join'](_0x66ff('0x1b'),'c',_0x66ff('0x1c'))[_0x66ff('0x1d')]('users','o','o.id\x20=\x20i.UserId')[_0x66ff('0x1d')](_0x22349e[_0x66ff('0x1e')],'a',_0x66ff('0x1f')+_0x29dffa)['left_join'](_0x22349e['messages'],'me','me.'+_0x13a147+_0x66ff('0x20'))['left_join'](_0x22349e[_0x66ff('0x21')],'it',_0x66ff('0x22')+_0x13a147+'\x20=\x20i.id')[_0x66ff('0x1d')](_0x66ff('0xc'),'t',_0x66ff('0x23'));}function getSqlClauses(){var _0x167fd5={'body':squel[_0x66ff('0x24')](),'contact':squel[_0x66ff('0x24')](),'default':squel[_0x66ff('0x24')](),'fields':squel[_0x66ff('0x24')](),'filter':squel[_0x66ff('0x24')](),'read':squel['expr'](),'tags':{'clause':squel[_0x66ff('0x24')](),'ids':null},'user':squel[_0x66ff('0x24')]()};return _0x167fd5;}function parseTagParameter(_0xedcdd7){var _0x4d0ed9=squel[_0x66ff('0x24')]();if(_0xedcdd7){var _0x171de1=utils[_0x66ff('0x25')](_0xedcdd7);_0x171de1[_0x66ff('0x26')](function(_0x16e4f4){_0x4d0ed9['or'](_0x66ff('0x27'),'%,'+_0x16e4f4+',%');});}return _0x4d0ed9;}function parseReadParameter(_0x37e748){var _0x73964b='';if(_0x37e748){_0x73964b=_0x66ff('0x28');if(_0x37e748==='1'){_0x73964b=_0x73964b[_0x66ff('0x29')](_0x66ff('0x2a'),'=');}else{_0x73964b=_0x73964b[_0x66ff('0x29')](_0x66ff('0x2a'),'>');}}return _0x73964b;}function parseSearchFilter(_0x222977,_0x52b545){var _0x3315a6=squel[_0x66ff('0x24')]();if(_0x52b545){var _0x347853=_0x52b545[_0x66ff('0x29')]('\x5c','\x5c\x5c')[_0x66ff('0x29')](/'/g,'\x27\x27');if(qs[_0x66ff('0x2b')](_0x347853)){_0x3315a6['or'](_0x66ff('0x2c'),_0x347853+'%');switch(_0x222977){case _0x66ff('0x2d'):case _0x66ff('0x2e'):_0x3315a6['or']('i.phone\x20LIKE\x20?',_0x347853+'%');break;case _0x66ff('0x2f'):_0x3315a6['or']('i.fax\x20LIKE\x20?',_0x347853+'%');break;case _0x66ff('0x30'):_0x3315a6['or'](_0x66ff('0x31'),_0x347853+'%');break;case _0x66ff('0x32'):_0x3315a6['or'](_0x66ff('0x33'),qs[_0x66ff('0x34')](_0x347853,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x66ff('0x34')](_0x347853));break;}}else if(_0x222977==='mail'&&qs['isEmail'](_0x347853)){_0x3315a6['or'](_0x66ff('0x35'),_0x347853+'%');}else{if(_0x222977===_0x66ff('0x32')){_0x3315a6['or'](_0x66ff('0x33'),qs[_0x66ff('0x34')](_0x347853,!![]))['or'](_0x66ff('0x36'),qs[_0x66ff('0x34')](_0x347853));}else if(_0x222977!==_0x66ff('0x2f')){_0x3315a6['or'](_0x66ff('0x37'),qs['getFullTextValue'](_0x347853));}_0x3315a6['or'](_0x66ff('0x38'),qs[_0x66ff('0x34')](_0x347853,!![]),null);}}return _0x3315a6;}function parseAdvancedSearchFilter(_0x4d3444,_0x40fa48){var _0x31bffe=getSqlClauses();var _0x148877=as['parseSearch'](_0x4d3444);var _0x73eea8=_0x148877[_0x66ff('0x39')];for(var _0x554c87=0x0;_0x554c87<_0x148877[_0x66ff('0x3a')][_0x66ff('0x14')];_0x554c87++){var _0xcee94f=_0x148877[_0x66ff('0x3a')][_0x554c87];var _0x3d059e='i';var _0x5efa40=_['find'](_0x40fa48,[_0x66ff('0x9'),_0xcee94f[_0x66ff('0x8')]]);if(_0x5efa40){var _0x3a73f9=as[_0x66ff('0x3b')](_0x3d059e,_0x5efa40[_0x66ff('0x3c')],_0xcee94f);_0x31bffe[_0x66ff('0x3d')][_0x73eea8](_0x3a73f9['text'],_0x3a73f9[_0x66ff('0x3e')]['start'],_0x3a73f9['value'][_0x66ff('0x3f')]);}else{switch(_0xcee94f['field']){case _0x66ff('0x40'):var _0x1c8577=parseReadParameter(_0xcee94f['value']);_0x31bffe[_0x66ff('0x41')][_0x66ff('0x42')](_0x1c8577);break;case'Contact':if(_0xcee94f['operator']===_0x66ff('0x43')){if(_0xcee94f[_0x66ff('0x3e')][_0x66ff('0x44')]('\x20')[_0x66ff('0x14')]>0x1){_0x31bffe[_0x66ff('0x45')][_0x73eea8]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xcee94f[_0x66ff('0x3e')],!![]),null);}else{var _0x47e9ad='%'+_0xcee94f[_0x66ff('0x3e')]+'%';_0x31bffe[_0x66ff('0x45')][_0x73eea8](_0x66ff('0x46'),_0x47e9ad,_0x47e9ad,_0x47e9ad);}}else{_0x5efa40=_['find'](_0x40fa48,[_0x66ff('0x9'),_0x66ff('0x47')]);_0xcee94f['field']=_0x66ff('0x47');_0x3a73f9=as[_0x66ff('0x3b')](_0x3d059e,_0x5efa40[_0x66ff('0x3c')],_0xcee94f);_0x31bffe['contact'][_0x73eea8](_0x3a73f9['text'],_0x3a73f9[_0x66ff('0x3e')][_0x66ff('0x48')],_0x3a73f9[_0x66ff('0x3e')][_0x66ff('0x3f')]);}break;case _0x66ff('0x49'):var _0x50d4c6=_0xcee94f['value'][_0x66ff('0x44')](',')[_0x66ff('0x17')](function(_0x2a12ab){return Number(_0x2a12ab);});var _0x1992cb=parseTagParameter(_0x50d4c6);_0x31bffe['tags'][_0x66ff('0x4a')][_0x66ff('0x42')](_0x1992cb);_0x31bffe[_0x66ff('0x4b')][_0x66ff('0x4c')]=_0x50d4c6;break;case'User':if(_0xcee94f['operator']==='$substring'){_0x31bffe[_0x66ff('0x4d')][_0x73eea8](_0x66ff('0x4e'),'%'+_0xcee94f[_0x66ff('0x3e')]+'%',null);}else{_0x5efa40=_[_0x66ff('0x4f')](_0x40fa48,[_0x66ff('0x9'),'UserId']);_0xcee94f[_0x66ff('0x8')]='UserId';_0x3a73f9=as[_0x66ff('0x3b')](_0x3d059e,_0x5efa40[_0x66ff('0x3c')],_0xcee94f);_0x31bffe['user'][_0x73eea8](_0x3a73f9[_0x66ff('0x50')],_0x3a73f9[_0x66ff('0x3e')][_0x66ff('0x48')],_0x3a73f9['value'][_0x66ff('0x3f')]);}break;case _0x66ff('0x51'):case'plainBody':_0x3a73f9=as[_0x66ff('0x3b')]('me',null,_0xcee94f);_0x31bffe[_0x66ff('0x51')][_0x73eea8](_0x3a73f9['text'],_0x3a73f9['value'][_0x66ff('0x48')],_0x3a73f9['value'][_0x66ff('0x3f')]);break;}}}return _0x31bffe;}function parseModelFields(_0x417b80,_0x2470d4,_0x26ec3c){var _0x134e5d=utils[_0x66ff('0x19')](_0x417b80);var _0x953db0=squel[_0x66ff('0x24')]();var _0x1b45b7=_(_0x2470d4)[_0x66ff('0x52')]()['map'](function(_0x4a8f74){return _['some'](_0x26ec3c,[_0x66ff('0x9'),_0x4a8f74])?_0x4a8f74:undefined;})[_0x66ff('0x53')]()[_0x66ff('0x3e')]();if(_0x1b45b7[_0x66ff('0x14')]>0x0){_0x1b45b7['forEach'](function(_0x8a4ce){if(_0x8a4ce===_0x134e5d){_0x953db0['and']('i.'+_0x134e5d+'\x20IN\x20?',[][_0x66ff('0x54')](_0x2470d4[_0x8a4ce]));}else if(_0x8a4ce===_0x66ff('0x55')){var _0x49a5b8=JSON[_0x66ff('0x56')](_0x2470d4[_0x8a4ce])[_0x66ff('0x57')];var _0x336889=JSON[_0x66ff('0x56')](_0x2470d4[_0x8a4ce])[_0x66ff('0x58')];_0x953db0[_0x66ff('0x42')](_0x66ff('0x59'),_0x49a5b8,_0x336889);}else{if(_0x2470d4[_0x8a4ce]===_0x66ff('0x5a')){_0x953db0[_0x66ff('0x42')]('i.'+_0x8a4ce+_0x66ff('0x5b'));}else{_0x953db0[_0x66ff('0x42')]('i.'+_0x8a4ce+_0x66ff('0x5c'),_0x2470d4[_0x8a4ce]);}}});}return _0x953db0;}function parseQueryParameters(_0x48eef7,_0xdb8277,_0x116b8b){var _0xa57d86=getSqlClauses();return Promise['resolve']()[_0x66ff('0x5d')](function(){return parseModelFields(_0x48eef7,_0xdb8277,_0x116b8b);})[_0x66ff('0x5d')](function(_0x1d8eb1){_0xa57d86[_0x66ff('0x5e')][_0x66ff('0x42')](_0x1d8eb1);return parseReadParameter(_0xdb8277[_0x66ff('0x41')]);})[_0x66ff('0x5d')](function(_0x241973){_0xa57d86[_0x66ff('0x41')]['and'](_0x241973);return parseTagParameter(_0xdb8277['tag']);})['then'](function(_0x2aac18){_0xa57d86[_0x66ff('0x4b')][_0x66ff('0x4a')][_0x66ff('0x42')](_0x2aac18);return parseSearchFilter(_0x48eef7,_0xdb8277[_0x66ff('0x5f')]);})[_0x66ff('0x5d')](function(_0x3e2f47){_0xa57d86[_0x66ff('0x5f')]=_0x3e2f47;return _0xa57d86;});}function checkAccountsRestrictions(_0x13d974,_0x365b39,_0x3ab234){var _0x497810=utils[_0x66ff('0x19')](_0x13d974);var _0x3ee748=_0x66ff('0x60')+_[_0x66ff('0x61')](_0x13d974)+(_0x13d974==='chat'?'Websites':'Accounts');var _0x25c6a3=squel[_0x66ff('0x24')]();return Promise[_0x66ff('0x62')]()[_0x66ff('0x5d')](function(){if(_0x3ab234[_0x66ff('0x63')]&&_0x365b39[_0x66ff('0x64')]===_0x66ff('0x7')){return _0x365b39[_0x3ee748]({'attributes':['id'],'raw':!![]});}})[_0x66ff('0x5d')](function(_0x1b8e42){if(_0x1b8e42){if(_0x1b8e42['length']===0x0){_0x25c6a3[_0x66ff('0x42')]('i.'+_0x497810+'\x20IS\x20NULL');}else{_0x25c6a3[_0x66ff('0x42')]('i.'+_0x497810+_0x66ff('0x16'),_[_0x66ff('0x17')](_0x1b8e42,'id'));}}else if(!_0x3ab234[_0x497810]){_0x25c6a3[_0x66ff('0x42')]('i.'+_0x497810+_0x66ff('0x65'));}})[_0x66ff('0x5d')](function(){return _0x25c6a3;});}function getClosedOrderClause(_0x29d6d5,_0x5670f9){var _0x592f24='';var _0x3988dd=[_0x66ff('0x66'),_0x66ff('0x67'),_0x66ff('0x68')];if(_0x29d6d5===_0x66ff('0x32')){_0x3988dd['unshift'](_0x66ff('0x69'));}if(_0x5670f9[_0x66ff('0x6a')]==='0'&&_0x29d6d5===_0x66ff('0x32')){_0x592f24=_0x66ff('0x69');}else{if(_0x5670f9['closed']==='1'){_0x3988dd[_0x66ff('0x6b')]();}_0x592f24=_0x66ff('0x6c')+_0x3988dd['join'](',\x20')+')';}return _0x592f24;}function getFilteredInteractions(_0x4007f4,_0x5b3882,_0x293d46,_0xaa77a4){var _0x5d2ed=utils[_0x66ff('0xd')](_0x4007f4);var _0x765518=_[_0x66ff('0x61')](_0x4007f4)+_0x66ff('0x6d');var _0x34351b=[];var _0x4950b5=getTagsQuery();var _0x3f9fb9={'type':db[_0x66ff('0x6e')]['QueryTypes']['SELECT'],'raw':!![]};var _0x5ca51b=[];var _0x19e20c=[];return db['sequelize'][_0x66ff('0x6f')](_0x4950b5['toString'](),_0x3f9fb9)[_0x66ff('0x5d')](function(_0x2e031c){_0x34351b=_[_0x66ff('0x70')](_0x2e031c,'id');_0x3f9fb9=_['merge'](_0x3f9fb9,{'model':db[_0x765518],'mapToModel':!![],'nest':!![]});if(_0x293d46[_0x66ff('0x5e')]){_0xaa77a4[_0x66ff('0x71')][_0x66ff('0x26')](function(_0x3f8547){_0x5b3882[_0x66ff('0x8')]('i.'+_0x3f8547);});}else{_0x5b3882[_0x66ff('0x8')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x66ff('0x40'));_0x5b3882[_0x66ff('0x8')]('a.key',_0x66ff('0x72'));_0x5b3882[_0x66ff('0x8')](_0x66ff('0x73'),_0x66ff('0x74'));if(_0x4007f4==='mail'){_0x5b3882[_0x66ff('0x8')](_0x66ff('0x75'),_0x66ff('0x76'));_0x5b3882[_0x66ff('0x8')](_0x66ff('0x77'),'contactName');_0x5b3882[_0x66ff('0x8')](_0x66ff('0x78'));_0x5b3882['field'](_0x66ff('0x79'));_0x5b3882[_0x66ff('0x8')]('i.updatedAt');_0x5b3882[_0x66ff('0x8')](_0x66ff('0x7a'));_0x5b3882[_0x66ff('0x8')](_0x66ff('0x7b'));_0x5b3882['field'](_0x66ff('0x7c'));_0x5b3882[_0x66ff('0x8')](_0x66ff('0x7d'));_0x5b3882['field'](_0x66ff('0x7e'));_0x5b3882[_0x66ff('0x8')](_0x66ff('0x7f'));_0x5b3882[_0x66ff('0x8')]('i.disposition');_0x5b3882[_0x66ff('0x8')](_0x66ff('0x67'));_0x5b3882[_0x66ff('0x8')]('i.thirdDisposition');_0x5b3882['field']('i.substatus');_0x5b3882[_0x66ff('0x8')](_0x66ff('0x80'));_0x5b3882[_0x66ff('0x8')]('i.ContactId');_0x5b3882[_0x66ff('0x8')](_0x66ff('0x81'));_0x5b3882[_0x66ff('0x8')](_0x66ff('0x82'));}else if(_0x4007f4===_0x66ff('0x30')){_0x5b3882[_0x66ff('0x8')](_0x66ff('0x83'),'contactName');}else{_0x5b3882[_0x66ff('0x8')](_0x66ff('0x84'),_0x66ff('0x85'));}if(_0x4007f4!=='mail'){_0x5b3882[_0x66ff('0x8')](_0x66ff('0x86'));}_0x5b3882[_0x66ff('0x8')](_0x66ff('0x87'),_0x66ff('0x88'));_0x5b3882[_0x66ff('0x8')]('c.lastName',_0x66ff('0x89'));_0x5b3882['field']('c.email',_0x66ff('0x8a'));_0x5b3882[_0x66ff('0x8')]('c.phone',_0x66ff('0x8b'));_0x5b3882[_0x66ff('0x8')](_0x66ff('0x8c'),_0x66ff('0x8d'));_0x5b3882[_0x66ff('0x8')]('c.fax',_0x66ff('0x8e'));_0x5b3882['field']('o.fullname',_0x66ff('0x8f'));_0x5b3882['field'](_0x66ff('0x90'),'Owner.internal');_0x5b3882[_0x66ff('0x8')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0xaa77a4['limit']){_0x5b3882[_0x66ff('0x91')](_0xaa77a4[_0x66ff('0x91')]);}if(_0xaa77a4[_0x66ff('0x92')]){_0x5b3882['offset'](_0xaa77a4['offset']);}return db[_0x66ff('0x93')]['query'](_0x5b3882[_0x66ff('0x94')](),_0x3f9fb9);})['then'](function(_0x3cc226){_0x5ca51b=_0x3cc226;var _0xee6d8a=getUsersQuery(_0x4007f4,_0x5ca51b);return db['sequelize'][_0x66ff('0x6f')](_0xee6d8a['toString'](),_0x3f9fb9);})['then'](function(_0x17562b){_0x19e20c=_[_0x66ff('0x95')](_0x17562b,_0x5d2ed);if(_0x4007f4==='mail'){return db[_0x66ff('0x96')][_0x66ff('0x97')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x66ff('0x5d')](function(_0x5df2b2){var _0x1e426e=_0x5df2b2?_0x5df2b2['enableEmailPreview']:undefined;var _0x368515=_0x5ca51b[_0x66ff('0x17')](function(_0x32908a){return updateInteraction(_0x32908a,_0x34351b,_0x19e20c,_0x1e426e);});return Promise[_0x66ff('0x98')](_0x368515);});}function countFilteredInteractions(_0xae10d7,_0x167927){var _0x3cdb53=_0xae10d7['clone']();_0x3cdb53[_0x66ff('0x8')]('COUNT(*)');_0x3cdb53[_0x66ff('0x8')](_0x66ff('0x99'),_0x66ff('0x40'));var _0x411e82=utils[_0x66ff('0x25')](_0x167927);if(!_[_0x66ff('0x9a')](_0x411e82)){_0x3cdb53[_0x66ff('0x15')](_0x66ff('0x9b'),_0x411e82);}var _0x140f66={'type':db[_0x66ff('0x6e')][_0x66ff('0x9c')][_0x66ff('0x9d')],'raw':!![]};return db[_0x66ff('0x93')][_0x66ff('0x6f')](_0x3cdb53[_0x66ff('0x94')](),_0x140f66);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 37c7eac..2ada836 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 _0xcfd8=['split','forEach','push','waiting','talking','unmanaged','abandoned','total','disposition','UserId','answered','MailMessage','-id','then','plainBody','trimStart','catch','Users','TagIds','Tags','../../mysqldb','map','fullname'];(function(_0x1a720a,_0x98841d){var _0x31c3e1=function(_0x34a389){while(--_0x34a389){_0x1a720a['push'](_0x1a720a['shift']());}};_0x31c3e1(++_0x98841d);}(_0xcfd8,0x87));var _0x8cfd=function(_0xc4966b,_0x6cd5e0){_0xc4966b=_0xc4966b-0x0;var _0x1802bb=_0xcfd8[_0xc4966b];return _0x1802bb;};'use strict';var _=require('lodash');var db=require(_0x8cfd('0x0'))['db'];function getInteractionUsers(_0x1b1056,_0x3b2a89){return new Promise(function(_0x4a0c78,_0x3645d1){try{var _0x9db1d0=[];if(_0x3b2a89[_0x1b1056]){_0x9db1d0=_0x3b2a89[_0x1b1056][_0x8cfd('0x1')](function(_0x1a4ccc){return{'id':_0x1a4ccc['id'],'fullname':_0x1a4ccc[_0x8cfd('0x2')]};});}return _0x4a0c78(_0x9db1d0);}catch(_0xd4eddb){_0x3645d1(_0xd4eddb);}});}function getInteractionTags(_0x18ab13,_0x377168){var _0x353243=[];if(_0x18ab13){_0x18ab13[_0x8cfd('0x3')](',')[_0x8cfd('0x4')](function(_0x5ea1d7){_0x353243[_0x8cfd('0x5')](_0x377168[_0x5ea1d7]);});}return _0x353243;}function updateWaitingCounter(_0x29d4f9){if(_0x29d4f9[_0x8cfd('0x6')]){_0x29d4f9[_0x8cfd('0x6')]-=0x1;}}function updateInteractionCounters(_0x595dc){_0x595dc['waiting']=0x0;_0x595dc[_0x8cfd('0x7')]=0x0;_0x595dc['answered']=0x0;_0x595dc[_0x8cfd('0x8')]=0x0;_0x595dc[_0x8cfd('0x9')]=0x0;_0x595dc[_0x8cfd('0xa')]=0x0;if(_0x595dc['closed']){if(_0x595dc[_0x8cfd('0xb')]===_0x8cfd('0x9')){_0x595dc[_0x8cfd('0x9')]+=0x1;updateWaitingCounter(_0x595dc);}if(_0x595dc[_0x8cfd('0xc')]){_0x595dc[_0x8cfd('0xd')]+=0x1;if(_0x595dc[_0x8cfd('0x7')]){_0x595dc[_0x8cfd('0x7')]-=0x1;}}else{if(_0x595dc[_0x8cfd('0xb')]){_0x595dc[_0x8cfd('0x8')]+=0x1;updateWaitingCounter(_0x595dc);}}}else{if(!_0x595dc[_0x8cfd('0xc')]){_0x595dc[_0x8cfd('0x6')]+=0x1;}if(_0x595dc[_0x8cfd('0xc')]){_0x595dc[_0x8cfd('0x7')]+=0x1;updateWaitingCounter(_0x595dc);}}_0x595dc[_0x8cfd('0xa')]+=0x1;return _0x595dc;}function getLastMessageText(_0x2b34b4){return db[_0x8cfd('0xe')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x2b34b4['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x8cfd('0xf'),'raw':!![]})[_0x8cfd('0x10')](function(_0x2a7b17){if(_0x2a7b17&&_0x2a7b17[_0x8cfd('0x11')]){_0x2b34b4['lastMsgText']=_[_0x8cfd('0x12')](_0x2a7b17[_0x8cfd('0x11')]);}return _0x2b34b4;})[_0x8cfd('0x13')](function(_0x4af50d){throw _0x4af50d;});}exports['updateInteraction']=function(_0x4a9758,_0x63eff,_0x3c461d,_0x4c815b){return new Promise(function(_0x1f12cf,_0x341ad0){return getInteractionUsers(_0x4a9758['id'],_0x3c461d)[_0x8cfd('0x10')](function(_0x3befde){_0x4a9758[_0x8cfd('0x14')]=_0x3befde;return getInteractionTags(_0x4a9758[_0x8cfd('0x15')],_0x63eff);})[_0x8cfd('0x10')](function(_0x1c8eaf){_0x4a9758[_0x8cfd('0x16')]=_0x1c8eaf;delete _0x4a9758['TagIds'];return updateInteractionCounters(_0x4a9758);})[_0x8cfd('0x10')](function(_0x4140dd){if(_0x4c815b){return getLastMessageText(_0x4140dd);}else{return _0x4140dd;}})['then'](function(_0x49687f){_0x1f12cf(_0x49687f);})[_0x8cfd('0x13')](function(_0x1004fa){_0x341ad0(_0x1004fa);});});}; \ No newline at end of file +var _0x398b=['catch','updateInteraction','TagIds','Tags','../../mysqldb','split','forEach','push','waiting','talking','unmanaged','abandoned','total','closed','disposition','UserId','answered','MailMessage','out','plainBody','-id','then','lastMsgText','trimStart'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x398b,0x7c));var _0xb398=function(_0x2bdd9c,_0x31871a){_0x2bdd9c=_0x2bdd9c-0x0;var _0x2ded3b=_0x398b[_0x2bdd9c];return _0x2ded3b;};'use strict';var _=require('lodash');var db=require(_0xb398('0x0'))['db'];function getInteractionUsers(_0x3c9c1f,_0x2e7bec){return new Promise(function(_0x4ee0b6,_0x519da0){try{var _0x185170=[];if(_0x2e7bec[_0x3c9c1f]){_0x185170=_0x2e7bec[_0x3c9c1f]['map'](function(_0x2fbd16){return{'id':_0x2fbd16['id'],'fullname':_0x2fbd16['fullname']};});}return _0x4ee0b6(_0x185170);}catch(_0x7cf8fe){_0x519da0(_0x7cf8fe);}});}function getInteractionTags(_0x262443,_0x2a8019){var _0xc4efc6=[];if(_0x262443){_0x262443[_0xb398('0x1')](',')[_0xb398('0x2')](function(_0x68d9d6){_0xc4efc6[_0xb398('0x3')](_0x2a8019[_0x68d9d6]);});}return _0xc4efc6;}function updateWaitingCounter(_0x1ba83b){if(_0x1ba83b[_0xb398('0x4')]){_0x1ba83b['waiting']-=0x1;}}function updateInteractionCounters(_0x1932a8){_0x1932a8[_0xb398('0x4')]=0x0;_0x1932a8[_0xb398('0x5')]=0x0;_0x1932a8['answered']=0x0;_0x1932a8[_0xb398('0x6')]=0x0;_0x1932a8[_0xb398('0x7')]=0x0;_0x1932a8[_0xb398('0x8')]=0x0;if(_0x1932a8[_0xb398('0x9')]){if(_0x1932a8[_0xb398('0xa')]===_0xb398('0x7')){_0x1932a8['abandoned']+=0x1;updateWaitingCounter(_0x1932a8);}if(_0x1932a8[_0xb398('0xb')]){_0x1932a8[_0xb398('0xc')]+=0x1;if(_0x1932a8['talking']){_0x1932a8[_0xb398('0x5')]-=0x1;}}else{if(_0x1932a8[_0xb398('0xa')]){_0x1932a8[_0xb398('0x6')]+=0x1;updateWaitingCounter(_0x1932a8);}}}else{if(!_0x1932a8[_0xb398('0xb')]){_0x1932a8[_0xb398('0x4')]+=0x1;}if(_0x1932a8[_0xb398('0xb')]){_0x1932a8[_0xb398('0x5')]+=0x1;updateWaitingCounter(_0x1932a8);}}_0x1932a8['total']+=0x1;return _0x1932a8;}function getLastMessageText(_0x743990){return db[_0xb398('0xd')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x743990['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xb398('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xb398('0xf')],'order':_0xb398('0x10'),'raw':!![]})[_0xb398('0x11')](function(_0xeb13c7){if(_0xeb13c7&&_0xeb13c7[_0xb398('0xf')]){_0x743990[_0xb398('0x12')]=_[_0xb398('0x13')](_0xeb13c7[_0xb398('0xf')]);}return _0x743990;})[_0xb398('0x14')](function(_0x4ebb55){throw _0x4ebb55;});}exports[_0xb398('0x15')]=function(_0x25fecd,_0x3755c7,_0x270542,_0x5b7961){return new Promise(function(_0x4de070,_0x441f03){return getInteractionUsers(_0x25fecd['id'],_0x270542)[_0xb398('0x11')](function(_0x4e4f8d){_0x25fecd['Users']=_0x4e4f8d;return getInteractionTags(_0x25fecd[_0xb398('0x16')],_0x3755c7);})[_0xb398('0x11')](function(_0x34583a){_0x25fecd[_0xb398('0x17')]=_0x34583a;delete _0x25fecd[_0xb398('0x16')];return updateInteractionCounters(_0x25fecd);})['then'](function(_0x2e330e){if(_0x5b7961){return getLastMessageText(_0x2e330e);}else{return _0x2e330e;}})[_0xb398('0x11')](function(_0x2270d1){_0x4de070(_0x2270d1);})[_0xb398('0x14')](function(_0x404b59){_0x441f03(_0x404b59);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 4892d4e..5eb52d6 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 _0x43b6=['chat-interactions','capitalize','chat','Website','Account','upperFirst','InteractionId','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','toLowerCase','toUpperCase','stringify','Interaction','update','info','error','exports','lodash','../../mysqldb','../../config/logger','mail-interactions'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x43b6,0x1be));var _0x643b=function(_0x55c551,_0xf1d9f0){_0x55c551=_0x55c551-0x0;var _0x4cf3a8=_0x43b6[_0x55c551];return _0x4cf3a8;};'use strict';var _=require(_0x643b('0x0'));var db=require(_0x643b('0x1'))['db'];var loggers={'openchannel':require(_0x643b('0x2'))('openchannel-interactions'),'mail':require(_0x643b('0x2'))(_0x643b('0x3')),'fax':require(_0x643b('0x2'))('fax-interactions'),'sms':require(_0x643b('0x2'))('sms-interactions'),'chat':require(_0x643b('0x2'))(_0x643b('0x4')),'whatsapp':require(_0x643b('0x2'))('whatsapp-interactions')};function getAccountFK(_0x41b625){return _[_0x643b('0x5')](_0x41b625)+(_0x41b625===_0x643b('0x6')?_0x643b('0x7'):_0x643b('0x8'))+'Id';}function getInteractionFK(_0x242b27){return _[_0x643b('0x5')](_0x242b27)+'InteractionId';}function getInteractionId(_0x3a7cb9,_0x513d8b,_0x1e7ed8){if(_0x3a7cb9&&_0x3a7cb9[_[_0x643b('0x9')](_0x1e7ed8)+_0x643b('0xa')]){return _0x3a7cb9[_[_0x643b('0x9')](_0x1e7ed8)+_0x643b('0xa')];}else if(_0x3a7cb9&&_0x3a7cb9['id']){return _0x3a7cb9['id'];}else if(_0x513d8b&&_0x513d8b['id']){return _0x513d8b['id'];}else{return'unknown';}}function getInteractionsTables(_0x32eb19){return{'accounts':_0x32eb19+'_'+(_0x32eb19===_0x643b('0x6')?_0x643b('0xb'):_0x643b('0xc')),'interactions':_0x32eb19+_0x643b('0xd'),'interactionsTags':_0x32eb19+_0x643b('0xe'),'messages':_0x32eb19+_0x643b('0xf'),'userInteractions':_0x643b('0x10')+_0x32eb19+'_interactions'};}function getSelectedTags(_0x289ea3){var _0x573725=[];if(_0x289ea3){_0x573725=Array['isArray'](_0x289ea3)?_0x289ea3:[_0x289ea3];}return _0x573725;}function log(_0x54de7c,_0x2af580,_0x2fe5cf,_0x188060,_0x4ca81b,_0x4b38ba){loggers[_0x4ca81b[_0x643b('0x11')]()][_0x54de7c]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4b38ba[_0x643b('0x12')](),_0x2af580?_0x2af580['id']:null,_0x2af580?_0x2af580['name']:null,_0x2af580?_0x2af580['role']:null,getInteractionId(_0x2fe5cf,_0x188060,_0x4ca81b),_0x2fe5cf?JSON[_0x643b('0x13')](_0x2fe5cf):'null');}function updateUser(_0x376c1e,_0x21a0e4,_0x4c32fd,_0x2189bc,_0x2d6dd3){db[_[_0x643b('0x9')](_0x2189bc)+_0x643b('0x14')]['findOne']({'where':{'id':getInteractionId(_0x21a0e4,_0x4c32fd,_0x2189bc)}})['then'](function(_0x13b5e7){if(_0x13b5e7){return _0x13b5e7[_0x643b('0x15')]({'UserId':_0x376c1e?_0x376c1e['id']:null});}})['then'](function(_0x5e6977){if(_0x5e6977){log(_0x643b('0x16'),_0x376c1e,_0x21a0e4,_0x4c32fd,_0x2189bc,_0x2d6dd3);}})['catch'](function(){log(_0x643b('0x17'),_0x376c1e,_0x21a0e4,_0x4c32fd,_0x2189bc,_0x2d6dd3);});}module[_0x643b('0x18')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xc5f2=['websites','accounts','_interactions','_messages','user_has_','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','then','update','info','error','exports','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','Website','Account','InteractionId','upperFirst','unknown','chat'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xc5f2,0x1a4));var _0x2c5f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc5f2[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var db=require(_0x2c5f('0x0'))['db'];var loggers={'openchannel':require(_0x2c5f('0x1'))(_0x2c5f('0x2')),'mail':require(_0x2c5f('0x1'))('mail-interactions'),'fax':require('../../config/logger')(_0x2c5f('0x3')),'sms':require(_0x2c5f('0x1'))(_0x2c5f('0x4')),'chat':require(_0x2c5f('0x1'))(_0x2c5f('0x5')),'whatsapp':require(_0x2c5f('0x1'))(_0x2c5f('0x6'))};function getAccountFK(_0x39506f){return _[_0x2c5f('0x7')](_0x39506f)+(_0x39506f==='chat'?_0x2c5f('0x8'):_0x2c5f('0x9'))+'Id';}function getInteractionFK(_0x4415be){return _['capitalize'](_0x4415be)+_0x2c5f('0xa');}function getInteractionId(_0x954d4,_0x2267c2,_0x4d3d29){if(_0x954d4&&_0x954d4[_[_0x2c5f('0xb')](_0x4d3d29)+'InteractionId']){return _0x954d4[_[_0x2c5f('0xb')](_0x4d3d29)+_0x2c5f('0xa')];}else if(_0x954d4&&_0x954d4['id']){return _0x954d4['id'];}else if(_0x2267c2&&_0x2267c2['id']){return _0x2267c2['id'];}else{return _0x2c5f('0xc');}}function getInteractionsTables(_0x25721e){return{'accounts':_0x25721e+'_'+(_0x25721e===_0x2c5f('0xd')?_0x2c5f('0xe'):_0x2c5f('0xf')),'interactions':_0x25721e+_0x2c5f('0x10'),'interactionsTags':_0x25721e+'_interaction_has_tags','messages':_0x25721e+_0x2c5f('0x11'),'userInteractions':_0x2c5f('0x12')+_0x25721e+_0x2c5f('0x10')};}function getSelectedTags(_0x3ce792){var _0x51d52d=[];if(_0x3ce792){_0x51d52d=Array['isArray'](_0x3ce792)?_0x3ce792:[_0x3ce792];}return _0x51d52d;}function log(_0x175e97,_0x32500f,_0x644612,_0x2d8970,_0x5a5749,_0x4ab186){loggers[_0x5a5749[_0x2c5f('0x13')]()][_0x175e97](_0x2c5f('0x14'),_0x4ab186[_0x2c5f('0x15')](),_0x32500f?_0x32500f['id']:null,_0x32500f?_0x32500f[_0x2c5f('0x16')]:null,_0x32500f?_0x32500f[_0x2c5f('0x17')]:null,getInteractionId(_0x644612,_0x2d8970,_0x5a5749),_0x644612?JSON[_0x2c5f('0x18')](_0x644612):_0x2c5f('0x19'));}function updateUser(_0x578a00,_0x222958,_0x194019,_0x18c0dc,_0x5ba0a3){db[_[_0x2c5f('0xb')](_0x18c0dc)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x222958,_0x194019,_0x18c0dc)}})[_0x2c5f('0x1a')](function(_0x2585a5){if(_0x2585a5){return _0x2585a5[_0x2c5f('0x1b')]({'UserId':_0x578a00?_0x578a00['id']:null});}})[_0x2c5f('0x1a')](function(_0x51df55){if(_0x51df55){log(_0x2c5f('0x1c'),_0x578a00,_0x222958,_0x194019,_0x18c0dc,_0x5ba0a3);}})['catch'](function(){log(_0x2c5f('0x1d'),_0x578a00,_0x222958,_0x194019,_0x18c0dc,_0x5ba0a3);});}module[_0x2c5f('0x1e')]={'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 b9643c0..377b5e6 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 _0x5a0b=['../../mysqldb','../../config/environment','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','hasOwnProperty','License','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','composable-middleware'];(function(_0x2b9448,_0x33e0f2){var _0xfaf5ab=function(_0x4de537){while(--_0x4de537){_0x2b9448['push'](_0x2b9448['shift']());}};_0xfaf5ab(++_0x33e0f2);}(_0x5a0b,0x178));var _0xb5a0=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x5a0b[_0x37c22c];return _0x119d79;};'use strict';var crypto=require(_0xb5a0('0x0'));var util=require('util');var compose=require(_0xb5a0('0x1'));var db=require(_0xb5a0('0x2'))['db'];var config=require(_0xb5a0('0x3'));function getValueFromLicense(_0x372e15,_0x19e681){if(_0x372e15&&_0x19e681){if(_0x19e681['data1']&&_0x19e681['license']){var _0x364d7f=_0x19e681['data1'];var _0x353106=_0x19e681[_0xb5a0('0x4')];var _0x50ccea=_0x364d7f['split']('-')[0x4];var _0x12dc15=_0x364d7f[_0xb5a0('0x5')]('-')[0x0];var _0x2cfb7b=crypto[_0xb5a0('0x6')](_0xb5a0('0x7'),util[_0xb5a0('0x8')](_0xb5a0('0x9'),_0x50ccea,_0x364d7f,_0x12dc15));var _0x352db6=_0x2cfb7b[_0xb5a0('0xa')](_0x353106,_0xb5a0('0xb'),_0xb5a0('0xc'));_0x352db6+=_0x2cfb7b[_0xb5a0('0xd')](_0xb5a0('0xc'));var _0x5adcf5=JSON['parse'](_0x352db6);return _0x5adcf5[_0xb5a0('0xe')](_0x372e15)?_0x5adcf5[_0x372e15]:null;}}return null;}function isLimit(_0xc9ebae,_0xdb3966,_0x5217c1,_0x4b6d06){var _0x54af77=_0xdb3966;return compose()['use'](function(_0x528cfc,_0x153e20,_0x206588){return db[_0xb5a0('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xb5a0('0x10')](function(_0x3cd2bd){var _0x1a43cb=getValueFromLicense(_0xc9ebae,_0x3cd2bd);return _0x1a43cb?_0x1a43cb:_0x54af77;})[_0xb5a0('0x10')](function(_0x49597d){_0x54af77=_0x49597d;return _0x5217c1[_0xb5a0('0x11')](_0x4b6d06);})['then'](function(_0xdc026a){if(_0xdc026a>=_0x54af77){return _0x153e20[_0xb5a0('0x12')](0x193)[_0xb5a0('0x13')]({'message':util[_0xb5a0('0x8')](_0xb5a0('0x14'),_0xc9ebae)});}_0x206588();})[_0xb5a0('0x15')](function(_0x15f783){_0x206588(_0x15f783);});});}function isUserLimit(){return isLimit(_0xb5a0('0x16'),0x1,db[_0xb5a0('0x17')],{'where':{'$or':[{'role':_0xb5a0('0x18')},{'role':_0xb5a0('0x19')}]}});}exports[_0xb5a0('0x1a')]=isUserLimit; \ No newline at end of file +var _0xc56a=['utf8','final','parse','hasOwnProperty','use','License','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','composable-middleware','../../mysqldb','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','format','%s:%s:%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc56a,0x104));var _0xac56=function(_0x3982a8,_0x18d5a9){_0x3982a8=_0x3982a8-0x0;var _0x2dff8d=_0xc56a[_0x3982a8];return _0x2dff8d;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0xac56('0x0'));var db=require(_0xac56('0x1'))['db'];var config=require(_0xac56('0x2'));function getValueFromLicense(_0x1eed7a,_0x2650e2){if(_0x1eed7a&&_0x2650e2){if(_0x2650e2['data1']&&_0x2650e2[_0xac56('0x3')]){var _0x530841=_0x2650e2[_0xac56('0x4')];var _0xc1b01c=_0x2650e2['license'];var _0x3faef0=_0x530841[_0xac56('0x5')]('-')[0x4];var _0x159cf7=_0x530841['split']('-')[0x0];var _0x3246a3=crypto[_0xac56('0x6')](_0xac56('0x7'),util[_0xac56('0x8')](_0xac56('0x9'),_0x3faef0,_0x530841,_0x159cf7));var _0x2cec48=_0x3246a3['update'](_0xc1b01c,'base64',_0xac56('0xa'));_0x2cec48+=_0x3246a3[_0xac56('0xb')](_0xac56('0xa'));var _0x4920ac=JSON[_0xac56('0xc')](_0x2cec48);return _0x4920ac[_0xac56('0xd')](_0x1eed7a)?_0x4920ac[_0x1eed7a]:null;}}return null;}function isLimit(_0x14e5f8,_0x1f624d,_0x26c178,_0x9e0760){var _0x30ac2c=_0x1f624d;return compose()[_0xac56('0xe')](function(_0x5e49fe,_0x5a9638,_0x14572e){return db[_0xac56('0xf')][_0xac56('0x10')]({'where':{'id':0x1},'raw':!![]})[_0xac56('0x11')](function(_0x21ed14){var _0x483fd8=getValueFromLicense(_0x14e5f8,_0x21ed14);return _0x483fd8?_0x483fd8:_0x30ac2c;})[_0xac56('0x11')](function(_0x1e13c2){_0x30ac2c=_0x1e13c2;return _0x26c178['count'](_0x9e0760);})[_0xac56('0x11')](function(_0x14256f){if(_0x14256f>=_0x30ac2c){return _0x5a9638[_0xac56('0x12')](0x193)[_0xac56('0x13')]({'message':util['format'](_0xac56('0x14'),_0x14e5f8)});}_0x14572e();})[_0xac56('0x15')](function(_0x45e0b9){_0x14572e(_0x45e0b9);});});}function isUserLimit(){return isLimit(_0xac56('0x16'),0x1,db[_0xac56('0x17')],{'where':{'$or':[{'role':_0xac56('0x18')},{'role':_0xac56('0x19')}]}});}exports[_0xac56('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 38f93d0..ad6530d 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 _0xaf8c=['$startsWith','$endsWith','LIKE\x20?','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','start','pop','utcOffset','hours','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$between','value','includes','$gt','$lte','add','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','$substring'];(function(_0x59d648,_0x2e87bd){var _0x45b2c2=function(_0x59c5eb){while(--_0x59c5eb){_0x59d648['push'](_0x59d648['shift']());}};_0x45b2c2(++_0x2e87bd);}(_0xaf8c,0x1dd));var _0xcaf8=function(_0x3fa8ff,_0x2e3165){_0x3fa8ff=_0x3fa8ff-0x0;var _0x125641=_0xaf8c[_0x3fa8ff];return _0x125641;};'use strict';var _=require(_0xcaf8('0x0'));var moment=require(_0xcaf8('0x1'));exports[_0xcaf8('0x2')]=function(_0x25121b){var _0x469eff={'conditions':[]};_0x469eff[_0xcaf8('0x3')]=_[_0xcaf8('0x4')](_0x25121b,_0xcaf8('0x5'))?'or':_0xcaf8('0x6');var _0x537437=_0x25121b[_0xcaf8('0x7')](_0xcaf8('0x8'),'')[_0xcaf8('0x7')](_0xcaf8('0x5'),'')[_0xcaf8('0x9')]('||');for(var _0x19568b=0x0;_0x19568b<_0x537437[_0xcaf8('0xa')];_0x19568b++){var _0x38db01=_0x537437[_0x19568b][_0xcaf8('0x9')](':=');var _0x1cb426=_0x38db01[0x0];var _0x2f8c35=_0x38db01[_0xcaf8('0xb')](0x1);_0x2f8c35[_0xcaf8('0xc')](function(_0x190b3a){var _0x117965=_0x190b3a[_0xcaf8('0x9')]('[')[_0xcaf8('0xd')]();var _0x1a4d0a=_0x190b3a[_0xcaf8('0xe')](/\[(.*?)\]/g);_0x1a4d0a[_0xcaf8('0xc')](function(_0x3a11af){var _0x436afd=_0x3a11af[_0xcaf8('0x9')]('[')[_0xcaf8('0xf')](function(_0x5fd98b){return _0x5fd98b[_0xcaf8('0x10')](']')>-0x1;})[_0xcaf8('0x11')](function(_0x308cce){return _0x308cce[_0xcaf8('0x9')](']')[0x0];})[0x0];_0x469eff[_0xcaf8('0x12')][_0xcaf8('0x13')]({'field':_0x1cb426,'operator':_0x117965,'value':_0x436afd});});});}return _0x469eff;};exports[_0xcaf8('0x14')]=function(_0x3f9279,_0xdfc285,_0x2c6d19){var _0x4bb048={};if(_0xdfc285===_0xcaf8('0x15')){if(_0x2c6d19['operator']==='$eq'){_0x2c6d19[_0xcaf8('0x16')]=_0xcaf8('0x17');_0x2c6d19[_0xcaf8('0x18')]+=','+_0x2c6d19[_0xcaf8('0x18')];}else if(_[_0xcaf8('0x19')]([_0xcaf8('0x1a'),_0xcaf8('0x1b')],_0x2c6d19[_0xcaf8('0x16')])){_0x2c6d19[_0xcaf8('0x18')]=moment(_0x2c6d19['value'])[_0xcaf8('0x1c')](0x1,'days')[_0xcaf8('0x1d')](_0xcaf8('0x1e'));}}if(_0x2c6d19['castTo']){_0xdfc285=_0x2c6d19[_0xcaf8('0x1f')];_0x4bb048[_0xcaf8('0x20')]='CAST('+_0x3f9279+'.'+_0x2c6d19[_0xcaf8('0x21')]+_0xcaf8('0x22')+_0x2c6d19[_0xcaf8('0x1f')]+')\x20'+parseOperator(_0x2c6d19[_0xcaf8('0x16')]);}else{_0x4bb048['text']=_0x3f9279+'.'+_0x2c6d19[_0xcaf8('0x21')]+'\x20'+parseOperator(_0x2c6d19[_0xcaf8('0x16')]);}if(_['includes']([_0xcaf8('0x23'),_0xcaf8('0x24')],_0x2c6d19[_0xcaf8('0x16')]))_0x4bb048[_0xcaf8('0x20')]='('+_0x4bb048[_0xcaf8('0x20')]+_0xcaf8('0x25')+_0x3f9279+'.'+_0x2c6d19[_0xcaf8('0x21')]+_0xcaf8('0x26');_0x4bb048[_0xcaf8('0x18')]=parseValue(_0xdfc285,_0x2c6d19[_0xcaf8('0x16')],_0x2c6d19[_0xcaf8('0x18')]);return _0x4bb048;};function parseOperator(_0xf1b649){var _0x34a021;switch(_0xf1b649){case _0xcaf8('0x27'):_0x34a021=_0xcaf8('0x28');break;case _0xcaf8('0x24'):_0x34a021=_0xcaf8('0x29');break;case _0xcaf8('0x2a'):_0x34a021=_0xcaf8('0x2b');break;case _0xcaf8('0x23'):_0x34a021='<>\x20?';break;case _0xcaf8('0x2c'):case _0xcaf8('0x2d'):case _0xcaf8('0x2e'):_0x34a021=_0xcaf8('0x2f');break;case'$lt':_0x34a021=_0xcaf8('0x30');break;case _0xcaf8('0x1a'):_0x34a021=_0xcaf8('0x31');break;case _0xcaf8('0x1b'):_0x34a021=_0xcaf8('0x32');break;case _0xcaf8('0x33'):_0x34a021=_0xcaf8('0x34');break;case _0xcaf8('0x17'):_0x34a021='BETWEEN\x20?\x20AND\x20?';break;}return _0x34a021;}function parseValue(_0x1acd80,_0x426d67,_0x379992){var _0x375787={'start':undefined,'end':undefined};switch(_0x426d67){case _0xcaf8('0x27'):case _0xcaf8('0x24'):_0x375787[_0xcaf8('0x35')]=_0x379992['split'](',');break;case'$substring':_0x375787[_0xcaf8('0x35')]='%'+_0x379992+'%';break;case _0xcaf8('0x2d'):_0x375787[_0xcaf8('0x35')]=_0x379992+'%';break;case _0xcaf8('0x2e'):_0x375787[_0xcaf8('0x35')]='%'+_0x379992;break;case _0xcaf8('0x17'):var _0x4232d4=_0x379992['split'](',');var _0x379992=_0x4232d4[_0xcaf8('0xd')]();var _0xaf9cdd=_0x4232d4[_0xcaf8('0x36')]();if(_0x1acd80===_0xcaf8('0x15')){_0x379992=moment(_0x379992)['utcOffset'](0x0,!![])[_0xcaf8('0x1d')]();_0xaf9cdd=moment(_0xaf9cdd)[_0xcaf8('0x37')](0x0,!![])[_0xcaf8('0x1c')](0x17,_0xcaf8('0x38'))['add'](0x3b,'minutes')['add'](0x3b,_0xcaf8('0x39'))[_0xcaf8('0x1d')]();}_0x375787={'start':_0x379992,'end':_0xaf9cdd};break;default:_0x375787[_0xcaf8('0x35')]=_0x379992;break;}return _0x375787;} \ No newline at end of file +var _0x18a3=['sqlOperator','startsWith','[$or]','and','[$and]','length','split','shift','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','field','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch'];(function(_0x5ee73b,_0x282c4c){var _0x22948a=function(_0x4bb79b){while(--_0x4bb79b){_0x5ee73b['push'](_0x5ee73b['shift']());}};_0x22948a(++_0x282c4c);}(_0x18a3,0x18c));var _0x318a=function(_0x19b938,_0x21bc0f){_0x19b938=_0x19b938-0x0;var _0x530b12=_0x18a3[_0x19b938];return _0x530b12;};'use strict';var _=require(_0x318a('0x0'));var moment=require(_0x318a('0x1'));exports[_0x318a('0x2')]=function(_0x58336a){var _0x2d86af={'conditions':[]};_0x2d86af[_0x318a('0x3')]=_[_0x318a('0x4')](_0x58336a,_0x318a('0x5'))?'or':_0x318a('0x6');var _0x145590=_0x58336a['replace'](_0x318a('0x7'),'')['replace'](_0x318a('0x5'),'')['split']('||');for(var _0x1f1a86=0x0;_0x1f1a86<_0x145590[_0x318a('0x8')];_0x1f1a86++){var _0x220151=_0x145590[_0x1f1a86][_0x318a('0x9')](':=');var _0x51fc9d=_0x220151[0x0];var _0x46e965=_0x220151['slice'](0x1);_0x46e965['forEach'](function(_0xf88ec){var _0x26131b=_0xf88ec[_0x318a('0x9')]('[')[_0x318a('0xa')]();var _0x2d686a=_0xf88ec[_0x318a('0xb')](/\[(.*?)\]/g);_0x2d686a['forEach'](function(_0x26e127){var _0x33125d=_0x26e127[_0x318a('0x9')]('[')[_0x318a('0xc')](function(_0x68e98a){return _0x68e98a[_0x318a('0xd')](']')>-0x1;})[_0x318a('0xe')](function(_0x218548){return _0x218548['split'](']')[0x0];})[0x0];_0x2d86af[_0x318a('0xf')][_0x318a('0x10')]({'field':_0x51fc9d,'operator':_0x26131b,'value':_0x33125d});});});}return _0x2d86af;};exports[_0x318a('0x11')]=function(_0x148a83,_0x250d23,_0x517f64){var _0x16ebda={};if(_0x250d23===_0x318a('0x12')){if(_0x517f64[_0x318a('0x13')]===_0x318a('0x14')){_0x517f64['operator']=_0x318a('0x15');_0x517f64['value']+=','+_0x517f64[_0x318a('0x16')];}else if(_['includes']([_0x318a('0x17'),_0x318a('0x18')],_0x517f64[_0x318a('0x13')])){_0x517f64[_0x318a('0x16')]=moment(_0x517f64[_0x318a('0x16')])[_0x318a('0x19')](0x1,_0x318a('0x1a'))[_0x318a('0x1b')](_0x318a('0x1c'));}}if(_0x517f64[_0x318a('0x1d')]){_0x250d23=_0x517f64[_0x318a('0x1d')];_0x16ebda[_0x318a('0x1e')]='CAST('+_0x148a83+'.'+_0x517f64[_0x318a('0x1f')]+'\x20AS\x20'+_0x517f64[_0x318a('0x1d')]+')\x20'+parseOperator(_0x517f64[_0x318a('0x13')]);}else{_0x16ebda[_0x318a('0x1e')]=_0x148a83+'.'+_0x517f64['field']+'\x20'+parseOperator(_0x517f64[_0x318a('0x13')]);}if(_[_0x318a('0x20')]([_0x318a('0x21'),_0x318a('0x22')],_0x517f64['operator']))_0x16ebda[_0x318a('0x1e')]='('+_0x16ebda['text']+_0x318a('0x23')+_0x148a83+'.'+_0x517f64[_0x318a('0x1f')]+_0x318a('0x24');_0x16ebda[_0x318a('0x16')]=parseValue(_0x250d23,_0x517f64[_0x318a('0x13')],_0x517f64[_0x318a('0x16')]);return _0x16ebda;};function parseOperator(_0x5d9c0b){var _0x3538b9;switch(_0x5d9c0b){case _0x318a('0x25'):_0x3538b9=_0x318a('0x26');break;case'$notIn':_0x3538b9='NOT\x20IN\x20?';break;case _0x318a('0x14'):_0x3538b9=_0x318a('0x27');break;case _0x318a('0x21'):_0x3538b9=_0x318a('0x28');break;case _0x318a('0x29'):case _0x318a('0x2a'):case _0x318a('0x2b'):_0x3538b9=_0x318a('0x2c');break;case _0x318a('0x2d'):_0x3538b9='<\x20?';break;case _0x318a('0x17'):_0x3538b9=_0x318a('0x2e');break;case _0x318a('0x18'):_0x3538b9=_0x318a('0x2f');break;case _0x318a('0x30'):_0x3538b9=_0x318a('0x31');break;case _0x318a('0x15'):_0x3538b9=_0x318a('0x32');break;}return _0x3538b9;}function parseValue(_0x179f41,_0x471cdd,_0x32d461){var _0x1acab7={'start':undefined,'end':undefined};switch(_0x471cdd){case _0x318a('0x25'):case _0x318a('0x22'):_0x1acab7[_0x318a('0x33')]=_0x32d461[_0x318a('0x9')](',');break;case _0x318a('0x29'):_0x1acab7[_0x318a('0x33')]='%'+_0x32d461+'%';break;case'$startsWith':_0x1acab7[_0x318a('0x33')]=_0x32d461+'%';break;case _0x318a('0x2b'):_0x1acab7['start']='%'+_0x32d461;break;case _0x318a('0x15'):var _0x1c0dde=_0x32d461[_0x318a('0x9')](',');var _0x32d461=_0x1c0dde['shift']();var _0x2a4fc9=_0x1c0dde[_0x318a('0x34')]();if(_0x179f41===_0x318a('0x12')){_0x32d461=moment(_0x32d461)[_0x318a('0x35')](0x0,!![])[_0x318a('0x1b')]();_0x2a4fc9=moment(_0x2a4fc9)[_0x318a('0x35')](0x0,!![])[_0x318a('0x19')](0x17,_0x318a('0x36'))['add'](0x3b,_0x318a('0x37'))['add'](0x3b,_0x318a('0x38'))[_0x318a('0x1b')]();}_0x1acab7={'start':_0x32d461,'end':_0x2a4fc9};break;default:_0x1acab7['start']=_0x32d461;break;}return _0x1acab7;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 151eb59..77ac171 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 _0xeecc=['^[+]?[0-9]*$','isEmail','getFullTextValue','{EXPR}','forEach','replace','query','$id','name','filters','intersection','attributes','order','where','pick','filter','object','columns','value','lower','merge','options','include','includeAll','push','lodash','sequelize','moment','../../mysqldb','keys','includes','parse','model','alias','raw','fields','split','isEmpty','forOwn','find','type','DATE','$gte','format','YYYY-MM-DD','utc','$lte','subtract','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match'];(function(_0x259108,_0x11f473){var _0x2f8d92=function(_0x25b13a){while(--_0x25b13a){_0x259108['push'](_0x259108['shift']());}};_0x2f8d92(++_0x11f473);}(_0xeecc,0x12d));var _0xceec=function(_0x5749f9,_0x431484){_0x5749f9=_0x5749f9-0x0;var _0x49f4a2=_0xeecc[_0x5749f9];return _0x49f4a2;};'use strict';var _=require(_0xceec('0x0'));var sequelize=require(_0xceec('0x1'));var moment=require(_0xceec('0x2'));var db=require(_0xceec('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4974bf){var _0x23721e=['ne'];try{var _0x4ce7cd=JSON['parse'](_0x4974bf);var _0x588f01=Object[_0xceec('0x4')](_0x4ce7cd)[0x0];return _0x23721e[_0xceec('0x5')](_0x588f01);}catch(_0x3a2c0a){return![];}}function getOperatorValue(_0x2ae233){var _0x5889fb=JSON[_0xceec('0x6')](_0x2ae233);var _0x4c84cf=Object[_0xceec('0x4')](_0x5889fb)[0x0];var _0x19413a=_0x5889fb[_0x4c84cf];return{['$'+_0x4c84cf]:_0x19413a};}function parseIncludeModel(_0x11733f){var _0x40a7cd=JSON[_0xceec('0x6')](_0x11733f);return{'model':db[_0x40a7cd[_0xceec('0x7')]],'as':_0x40a7cd[_0xceec('0x8')],'attributes':_0x40a7cd['fields'],'raw':_0x40a7cd[_0xceec('0x9')]};}exports[_0xceec('0xa')]=function(_0x257259){var _0x39837f=null;if(_0x257259){_0x39837f=_0x257259[_0xceec('0xb')](',');}return _0x39837f;};exports['filters']=function(_0x1fe218,_0x299583){var _0x37ce83={};if(!_[_0xceec('0xc')](_0x1fe218)){_[_0xceec('0xd')](_0x1fe218,function(_0x4e3df8,_0x2fa641){try{if(_0x299583){var _0x5b8216=_[_0xceec('0xe')](_0x299583,{'name':_0x2fa641})||{};if(hasSequelizeOperator(_0x4e3df8)){_0x37ce83[_0x2fa641]=getOperatorValue(_0x4e3df8);}else if(_0x5b8216[_0xceec('0xf')]===_0xceec('0x10')&&_['isPlainObject'](_0x4e3df8)){var _0x578e51=JSON[_0xceec('0x6')](_0x4e3df8);var _0x51f24d={'$gte':moment(moment(_0x578e51[_0xceec('0x11')])[_0xceec('0x12')](_0xceec('0x13')))[_0xceec('0x14')]()[_0xceec('0x12')](),'$lte':moment(moment(_0x578e51[_0xceec('0x15')])[_0xceec('0x12')](_0xceec('0x13')))[_0xceec('0x14')]()[_0xceec('0x16')](0x1,'s')[_0xceec('0x12')]()};_0x37ce83[_0x2fa641]=_0x51f24d;}else if(_0x5b8216['name']===_0xceec('0x17')){_0x37ce83[_0x2fa641]=_0x4e3df8;}else{_0x37ce83[_0x2fa641]=_[_0xceec('0x18')](_0x4e3df8)?_0x4e3df8:JSON[_0xceec('0x6')](_0x4e3df8);}}else{_0x37ce83[_0x2fa641]=_[_0xceec('0x18')](_0x4e3df8)?_0x4e3df8:JSON[_0xceec('0x6')](_0x4e3df8);}}catch(_0x32ac95){_0x37ce83[_0x2fa641]=_0x4e3df8[_0xceec('0xb')](',');}});}return _0x37ce83;};exports[_0xceec('0x19')]=function(_0x32778b){_0x32778b=parseInt(_0x32778b,0xa);if(!_0x32778b||_0x32778b<0x0){_0x32778b=LIMIT_VALUE;}return _0x32778b;};exports[_0xceec('0x1a')]=function(_0x50dbb9){_0x50dbb9=parseInt(_0x50dbb9,0xa);if(!_0x50dbb9||_0x50dbb9<0x0){_0x50dbb9=0x0;}return _0x50dbb9;};exports[_0xceec('0x1b')]=function(_0x59922b){var _0x2b8fd5,_0x3d628f=null;if(_0x59922b){_0x2b8fd5=_0x59922b['split'](',');_0x3d628f=_[_0xceec('0x1c')](_0x2b8fd5,function(_0x4f9e9b){if(_0x4f9e9b[_0xceec('0x1d')]('-')===0x0){return[_0x4f9e9b===_0xceec('0x1e')?sequelize[_0xceec('0x1f')](sequelize[_0xceec('0x20')](_0xceec('0x1e')),_0xceec('0x21')):_0x4f9e9b[_0xceec('0x22')](0x1),'DESC'];}else{return[_0x4f9e9b===_0xceec('0x1e')?sequelize['cast'](sequelize[_0xceec('0x20')](_0xceec('0x1e')),_0xceec('0x21')):_0x4f9e9b,_0xceec('0x23')];}});}return _0x3d628f;};exports[_0xceec('0x24')]=function(_0x2cb07d,_0x591fe2){if(_[_0xceec('0xc')](_0x2cb07d)){return _0x2cb07d;}if(_['isArray'](_0x2cb07d)){for(var _0x1eddcc=0x0;_0x1eddcc<_0x2cb07d[_0xceec('0x25')];_0x1eddcc+=0x1){_0x2cb07d[_0x1eddcc]=this[_0xceec('0x24')](_0x2cb07d[_0x1eddcc],_0x591fe2);}return _0x2cb07d;}if(!_[_0xceec('0x26')](_0x2cb07d)){return _0x2cb07d;}if(_[_0xceec('0x27')](_0x591fe2)){_0x591fe2=[_0x591fe2];}if(!_[_0xceec('0x18')](_0x591fe2)){return _0x2cb07d;}for(var _0x33bca2=0x0;_0x33bca2<_0x591fe2[_0xceec('0x25')];_0x33bca2+=0x1){_[_0xceec('0x28')](_0x2cb07d,_0x591fe2[_0x33bca2]);}for(var _0x500050 in _0x2cb07d){if(_0x2cb07d[_0xceec('0x29')](_0x500050)){_0x2cb07d[_0x500050]=this[_0xceec('0x24')](_0x2cb07d[_0x500050],_0x591fe2);}}return _0x2cb07d;};exports[_0xceec('0x2a')]=function(_0x3e290f){return _0x3e290f[_0xceec('0x2b')](RegExp(_0xceec('0x2c')))?!![]:![];};exports[_0xceec('0x2d')]=function(_0x17d711){return _0x17d711['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xceec('0x2e')]=function(_0x1eba13,_0x227607){var _0x5ea373=[];var _0x56af6e=/[ `!@#$%^&*()_\-?~]/;var _0x34117b=_0x227607?'\x22{EXPR}\x22':_0xceec('0x2f');_0x1eba13['split'](/[ ,]+/)[_0xceec('0x30')](function(_0x2c93ce){_0x2c93ce=_0x2c93ce[_0xceec('0x31')](/([^:]")"+/g,'$1');_0x2c93ce='+'+_0x2c93ce+'*';var _0xffd079=_0x2c93ce['match'](_0x56af6e);if(_0xffd079){_0x2c93ce='\x22'+_0x2c93ce+'\x22';}_0x5ea373['push'](_0x2c93ce);});_0x34117b=_0x34117b[_0xceec('0x31')](_0xceec('0x2f'),_0x5ea373['join']('\x20'));return _0x34117b;};exports['getOptions']=function(_0x3eddab,_0x1a7045,_0x586768){var _0x5cb275={},_0x2ece23={};if(_0x1a7045['query']['$id']){_0x1a7045[_0xceec('0x32')]['id']=_0x1a7045['query'][_0xceec('0x33')];delete _0x1a7045[_0xceec('0x32')]['$id'];}_0x5cb275[_0xceec('0x7')]=_['map'](_0x3eddab,_0xceec('0x34'));_0x5cb275[_0xceec('0x32')]=_['keys'](_0x1a7045['query']);_0x5cb275[_0xceec('0x35')]=_[_0xceec('0x36')](_0x5cb275[_0xceec('0x7')],_0x5cb275[_0xceec('0x32')]);_0x2ece23['attributes']=_[_0xceec('0x36')](_0x5cb275[_0xceec('0x7')],this[_0xceec('0xa')](_0x1a7045[_0xceec('0x32')][_0xceec('0xa')]));_0x2ece23[_0xceec('0x37')]=_0x2ece23[_0xceec('0x37')][_0xceec('0x25')]?_0x2ece23['attributes']:_0x5cb275[_0xceec('0x7')];if(!_0x1a7045['query']['hasOwnProperty']('nolimit')){_0x2ece23[_0xceec('0x19')]=this[_0xceec('0x19')](_0x1a7045[_0xceec('0x32')][_0xceec('0x19')]);_0x2ece23[_0xceec('0x1a')]=this[_0xceec('0x1a')](_0x1a7045[_0xceec('0x32')]['offset']);}_0x2ece23[_0xceec('0x38')]=this[_0xceec('0x1b')](_0x1a7045[_0xceec('0x32')][_0xceec('0x1b')]);_0x2ece23[_0xceec('0x39')]=this[_0xceec('0x35')](_[_0xceec('0x3a')](_0x1a7045['query'],_0x5cb275[_0xceec('0x35')]),_0x3eddab);if(_0x1a7045[_0xceec('0x32')]['filter']){var _0x191887=_0x3eddab;var _0x1e32b6=_0x1a7045[_0xceec('0x32')][_0xceec('0x3b')];if(typeof _0x1e32b6===_0xceec('0x3c')){_0x191887=_[_0xceec('0x3b')](_0x3eddab,function(_0x9d3111){return _[_0xceec('0x5')](_0x1e32b6[_0xceec('0x3d')],_0x9d3111[_0xceec('0x34')]);});_0x1e32b6=_0x1e32b6[_0xceec('0x3e')];}_0x2ece23[_0xceec('0x39')]=_['merge'](_0x2ece23['where'],{'$or':_[_0xceec('0x1c')](_0x191887,function(_0x5d4c30){if(_0x5d4c30[_0xceec('0xf')]!=='VIRTUAL'){if(_0x586768){return sequelize[_0xceec('0x39')](sequelize['fn'](_0xceec('0x3f'),sequelize[_0xceec('0x20')](_0x5d4c30[_0xceec('0x34')])),{'$like':sequelize['fn']('lower','%'+_0x1a7045[_0xceec('0x32')][_0xceec('0x3b')]+'%')});}else{var _0x16fea8={};_0x16fea8[_0x5d4c30['name']]={'$like':'%'+_0x1a7045[_0xceec('0x32')][_0xceec('0x3b')]+'%'};return _0x16fea8;}}})});}_0x2ece23=_[_0xceec('0x40')]({},_0x2ece23,_0x1a7045[_0xceec('0x41')]);return _0x2ece23;};exports[_0xceec('0x42')]=function(_0x53f9ab){var _0x165322=[];if(_0x53f9ab[_0xceec('0x43')]){_0x165322['push']({'all':!![]});}else if(_0x53f9ab['include']){if(Array[_0xceec('0x18')](_0x53f9ab[_0xceec('0x42')])){_0x165322=Object['keys'](_0x53f9ab[_0xceec('0x42')])['map'](function(_0x3eaa01){return parseIncludeModel(_0x53f9ab[_0xceec('0x42')][_0x3eaa01]);});}else{var _0x3b9206=parseIncludeModel(_0x53f9ab[_0xceec('0x42')]);_0x165322[_0xceec('0x44')](_0x3b9206);}}return _0x165322;}; \ No newline at end of file +var _0xa210=['omit','isString','hasOwnProperty','match','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','join','getOptions','query','$id','intersection','attributes','length','nolimit','offset','order','sort','pick','filter','columns','value','where','merge','VIRTUAL','lower','options','include','lodash','../../mysqldb','parse','keys','includes','model','alias','fields','filters','forOwn','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','name','uniqueid','isArray','split','limit','map','indexOf','priority','cast','col','unsigned','substr','ASC','isEmpty'];(function(_0x586472,_0x3986b5){var _0x15e6d5=function(_0x4ada41){while(--_0x4ada41){_0x586472['push'](_0x586472['shift']());}};_0x15e6d5(++_0x3986b5);}(_0xa210,0x1d8));var _0x0a21=function(_0x2b37f3,_0x32b601){_0x2b37f3=_0x2b37f3-0x0;var _0x5e53b4=_0xa210[_0x2b37f3];return _0x5e53b4;};'use strict';var _=require(_0x0a21('0x0'));var sequelize=require('sequelize');var moment=require('moment');var db=require(_0x0a21('0x1'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x100064){var _0x2ead70=['ne'];try{var _0x51e7cc=JSON[_0x0a21('0x2')](_0x100064);var _0x47618f=Object[_0x0a21('0x3')](_0x51e7cc)[0x0];return _0x2ead70[_0x0a21('0x4')](_0x47618f);}catch(_0x16b4f8){return![];}}function getOperatorValue(_0xe5fd91){var _0x39c1c7=JSON['parse'](_0xe5fd91);var _0x53138f=Object[_0x0a21('0x3')](_0x39c1c7)[0x0];var _0x422223=_0x39c1c7[_0x53138f];return{['$'+_0x53138f]:_0x422223};}function parseIncludeModel(_0x22cfb2){var _0x1b7ec5=JSON[_0x0a21('0x2')](_0x22cfb2);return{'model':db[_0x1b7ec5[_0x0a21('0x5')]],'as':_0x1b7ec5[_0x0a21('0x6')],'attributes':_0x1b7ec5[_0x0a21('0x7')],'raw':_0x1b7ec5['raw']};}exports[_0x0a21('0x7')]=function(_0x27eaeb){var _0x14168c=null;if(_0x27eaeb){_0x14168c=_0x27eaeb['split'](',');}return _0x14168c;};exports[_0x0a21('0x8')]=function(_0x2b1a5d,_0x7fc550){var _0xdd84de={};if(!_['isEmpty'](_0x2b1a5d)){_[_0x0a21('0x9')](_0x2b1a5d,function(_0x1a05a2,_0x347dc5){try{if(_0x7fc550){var _0xbe9a3e=_['find'](_0x7fc550,{'name':_0x347dc5})||{};if(hasSequelizeOperator(_0x1a05a2)){_0xdd84de[_0x347dc5]=getOperatorValue(_0x1a05a2);}else if(_0xbe9a3e[_0x0a21('0xa')]===_0x0a21('0xb')&&_[_0x0a21('0xc')](_0x1a05a2)){var _0x200181=JSON['parse'](_0x1a05a2);var _0x16347f={'$gte':moment(moment(_0x200181[_0x0a21('0xd')])[_0x0a21('0xe')](_0x0a21('0xf')))[_0x0a21('0x10')]()[_0x0a21('0xe')](),'$lte':moment(moment(_0x200181['$lte'])[_0x0a21('0xe')](_0x0a21('0xf')))['utc']()[_0x0a21('0x11')](0x1,'s')[_0x0a21('0xe')]()};_0xdd84de[_0x347dc5]=_0x16347f;}else if(_0xbe9a3e[_0x0a21('0x12')]===_0x0a21('0x13')){_0xdd84de[_0x347dc5]=_0x1a05a2;}else{_0xdd84de[_0x347dc5]=_[_0x0a21('0x14')](_0x1a05a2)?_0x1a05a2:JSON[_0x0a21('0x2')](_0x1a05a2);}}else{_0xdd84de[_0x347dc5]=_['isArray'](_0x1a05a2)?_0x1a05a2:JSON[_0x0a21('0x2')](_0x1a05a2);}}catch(_0x3fab9b){_0xdd84de[_0x347dc5]=_0x1a05a2[_0x0a21('0x15')](',');}});}return _0xdd84de;};exports[_0x0a21('0x16')]=function(_0x4cfd97){_0x4cfd97=parseInt(_0x4cfd97,0xa);if(!_0x4cfd97||_0x4cfd97<0x0){_0x4cfd97=LIMIT_VALUE;}return _0x4cfd97;};exports['offset']=function(_0x34b118){_0x34b118=parseInt(_0x34b118,0xa);if(!_0x34b118||_0x34b118<0x0){_0x34b118=0x0;}return _0x34b118;};exports['sort']=function(_0x2a393f){var _0x176cb6,_0x34a8f4=null;if(_0x2a393f){_0x176cb6=_0x2a393f['split'](',');_0x34a8f4=_[_0x0a21('0x17')](_0x176cb6,function(_0x5bd5cd){if(_0x5bd5cd[_0x0a21('0x18')]('-')===0x0){return[_0x5bd5cd===_0x0a21('0x19')?sequelize[_0x0a21('0x1a')](sequelize[_0x0a21('0x1b')]('priority'),_0x0a21('0x1c')):_0x5bd5cd[_0x0a21('0x1d')](0x1),'DESC'];}else{return[_0x5bd5cd===_0x0a21('0x19')?sequelize[_0x0a21('0x1a')](sequelize['col'](_0x0a21('0x19')),'unsigned'):_0x5bd5cd,_0x0a21('0x1e')];}});}return _0x34a8f4;};exports['omit']=function(_0x466cc7,_0x4a13c6){if(_[_0x0a21('0x1f')](_0x466cc7)){return _0x466cc7;}if(_[_0x0a21('0x14')](_0x466cc7)){for(var _0x3e101f=0x0;_0x3e101f<_0x466cc7['length'];_0x3e101f+=0x1){_0x466cc7[_0x3e101f]=this[_0x0a21('0x20')](_0x466cc7[_0x3e101f],_0x4a13c6);}return _0x466cc7;}if(!_['isObject'](_0x466cc7)){return _0x466cc7;}if(_[_0x0a21('0x21')](_0x4a13c6)){_0x4a13c6=[_0x4a13c6];}if(!_['isArray'](_0x4a13c6)){return _0x466cc7;}for(var _0x954120=0x0;_0x954120<_0x4a13c6['length'];_0x954120+=0x1){_['unset'](_0x466cc7,_0x4a13c6[_0x954120]);}for(var _0x32aa2a in _0x466cc7){if(_0x466cc7[_0x0a21('0x22')](_0x32aa2a)){_0x466cc7[_0x32aa2a]=this[_0x0a21('0x20')](_0x466cc7[_0x32aa2a],_0x4a13c6);}}return _0x466cc7;};exports['isNumeric']=function(_0x457f2a){return _0x457f2a[_0x0a21('0x23')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x240b15){return _0x240b15['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x0a21('0x24')]=function(_0x30b220,_0x2e1f53){var _0x21668f=[];var _0x2c1030=/[ `!@#$%^&*()_\-?~]/;var _0x311afd=_0x2e1f53?_0x0a21('0x25'):_0x0a21('0x26');_0x30b220[_0x0a21('0x15')](/[ ,]+/)[_0x0a21('0x27')](function(_0x251f91){_0x251f91=_0x251f91[_0x0a21('0x28')](/([^:]")"+/g,'$1');_0x251f91='+'+_0x251f91+'*';var _0x3e36c0=_0x251f91[_0x0a21('0x23')](_0x2c1030);if(_0x3e36c0){_0x251f91='\x22'+_0x251f91+'\x22';}_0x21668f[_0x0a21('0x29')](_0x251f91);});_0x311afd=_0x311afd[_0x0a21('0x28')](_0x0a21('0x26'),_0x21668f[_0x0a21('0x2a')]('\x20'));return _0x311afd;};exports[_0x0a21('0x2b')]=function(_0x1e0916,_0x131877,_0x2c8c60){var _0x533302={},_0x52140c={};if(_0x131877[_0x0a21('0x2c')][_0x0a21('0x2d')]){_0x131877[_0x0a21('0x2c')]['id']=_0x131877['query'][_0x0a21('0x2d')];delete _0x131877[_0x0a21('0x2c')][_0x0a21('0x2d')];}_0x533302[_0x0a21('0x5')]=_[_0x0a21('0x17')](_0x1e0916,_0x0a21('0x12'));_0x533302[_0x0a21('0x2c')]=_[_0x0a21('0x3')](_0x131877['query']);_0x533302[_0x0a21('0x8')]=_[_0x0a21('0x2e')](_0x533302[_0x0a21('0x5')],_0x533302['query']);_0x52140c[_0x0a21('0x2f')]=_['intersection'](_0x533302['model'],this[_0x0a21('0x7')](_0x131877['query'][_0x0a21('0x7')]));_0x52140c['attributes']=_0x52140c[_0x0a21('0x2f')][_0x0a21('0x30')]?_0x52140c[_0x0a21('0x2f')]:_0x533302['model'];if(!_0x131877['query'][_0x0a21('0x22')](_0x0a21('0x31'))){_0x52140c[_0x0a21('0x16')]=this['limit'](_0x131877[_0x0a21('0x2c')][_0x0a21('0x16')]);_0x52140c[_0x0a21('0x32')]=this[_0x0a21('0x32')](_0x131877[_0x0a21('0x2c')]['offset']);}_0x52140c[_0x0a21('0x33')]=this[_0x0a21('0x34')](_0x131877[_0x0a21('0x2c')][_0x0a21('0x34')]);_0x52140c['where']=this[_0x0a21('0x8')](_[_0x0a21('0x35')](_0x131877['query'],_0x533302[_0x0a21('0x8')]),_0x1e0916);if(_0x131877['query'][_0x0a21('0x36')]){var _0x23f6ec=_0x1e0916;var _0x4ac85b=_0x131877[_0x0a21('0x2c')][_0x0a21('0x36')];if(typeof _0x4ac85b==='object'){_0x23f6ec=_[_0x0a21('0x36')](_0x1e0916,function(_0x37e14c){return _[_0x0a21('0x4')](_0x4ac85b[_0x0a21('0x37')],_0x37e14c['name']);});_0x4ac85b=_0x4ac85b[_0x0a21('0x38')];}_0x52140c[_0x0a21('0x39')]=_[_0x0a21('0x3a')](_0x52140c[_0x0a21('0x39')],{'$or':_['map'](_0x23f6ec,function(_0x533884){if(_0x533884['type']!==_0x0a21('0x3b')){if(_0x2c8c60){return sequelize['where'](sequelize['fn'](_0x0a21('0x3c'),sequelize[_0x0a21('0x1b')](_0x533884[_0x0a21('0x12')])),{'$like':sequelize['fn'](_0x0a21('0x3c'),'%'+_0x131877[_0x0a21('0x2c')][_0x0a21('0x36')]+'%')});}else{var _0x396b5f={};_0x396b5f[_0x533884['name']]={'$like':'%'+_0x131877[_0x0a21('0x2c')][_0x0a21('0x36')]+'%'};return _0x396b5f;}}})});}_0x52140c=_[_0x0a21('0x3a')]({},_0x52140c,_0x131877[_0x0a21('0x3d')]);return _0x52140c;};exports[_0x0a21('0x3e')]=function(_0x119583){var _0x543dd1=[];if(_0x119583['includeAll']){_0x543dd1[_0x0a21('0x29')]({'all':!![]});}else if(_0x119583[_0x0a21('0x3e')]){if(Array[_0x0a21('0x14')](_0x119583['include'])){_0x543dd1=Object['keys'](_0x119583['include'])[_0x0a21('0x17')](function(_0x5182c3){return parseIncludeModel(_0x119583[_0x0a21('0x3e')][_0x5182c3]);});}else{var _0x44849f=parseIncludeModel(_0x119583[_0x0a21('0x3e')]);_0x543dd1['push'](_0x44849f);}}return _0x543dd1;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index f98020a..b30dd68 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 _0xf08c=['Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','getRealtimeAgents','busy','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','name','fullname','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','indexOf','internal','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','mailPause','chatCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatus','mailStatus','faxStatus','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','omit','pick','filterAgentAttributes','whatsappStatus','mailCapacity','openchannelCapacity','smsCurrentCapacity','phoneBarEnableAutomaticScreenRecording','destconnectedlinenum','lodash','jayson/promise','../../mysqldb','http','client','chatPause','faxPause','openchannelPause','smsPause','voicePause','whatsappPause','filter','length','idle','unavailable','ringing','isNil','voiceStatus','pause','every','chatStatus','smsStatus','request'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0xf08c,0xb5));var _0xcf08=function(_0x15a359,_0x3d0d98){_0x15a359=_0x15a359-0x0;var _0xfbe81a=_0xf08c[_0x15a359];return _0xfbe81a;};'use strict';var _=require(_0xcf08('0x0'));var jayson=require(_0xcf08('0x1'));var db=require(_0xcf08('0x2'))['db'];var amiClient=jayson['client'][_0xcf08('0x3')]({'port':0x232a});var routingClient=jayson[_0xcf08('0x4')][_0xcf08('0x3')]({'port':0x232c});function isAgentPaused(_0x367392,_0x4f851a){var _0x5c54ac=[_0x367392[_0xcf08('0x5')],_0x367392[_0xcf08('0x6')],_0x367392['mailPause'],_0x367392[_0xcf08('0x7')],_0x367392[_0xcf08('0x8')],_0x367392[_0xcf08('0x9')],_0x367392[_0xcf08('0xa')]];if(!_0x4f851a)return _['every'](_0x5c54ac);var _0x5044bb=_[_0xcf08('0xb')](_0x5c54ac);return _0x5044bb['length']>0x0&&_0x5044bb[_0xcf08('0xc')]<_0x5c54ac[_0xcf08('0xc')]?!![]:![];}function isIdle(_0x537e06){return _0x537e06===_0xcf08('0xd')||_0x537e06==='unknown'||_0x537e06===_0xcf08('0xe')||_0x537e06===_0xcf08('0xf')||_[_0xcf08('0x10')](_0x537e06);}function isAgentIdle(_0x3ed7a0){if(_0x3ed7a0[_0xcf08('0x11')]!==_0xcf08('0xd')&&_0x3ed7a0[_0xcf08('0x9')]){_0x3ed7a0[_0xcf08('0x11')]=_0xcf08('0x12');return![];}return _[_0xcf08('0x13')]([_0x3ed7a0[_0xcf08('0x14')],_0x3ed7a0['faxStatus'],_0x3ed7a0['mailStatus'],_0x3ed7a0['openchannelStatus'],_0x3ed7a0[_0xcf08('0x15')],_0x3ed7a0[_0xcf08('0x11')],_0x3ed7a0['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0xcf08('0x16')](_0xcf08('0x17'),{})[_0xcf08('0x18')](function(_0x2b0135){if(_0x2b0135[_0xcf08('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0xa838ef=_0x2b0135['result'];return routingClient['request'](_0xcf08('0x17'),{})[_0xcf08('0x18')](function(_0x4c4970){if(_0x4c4970[_0xcf08('0x19')]){throw new Error(_0xcf08('0x1a'));}var _0x2947e5=_0x4c4970[_0xcf08('0x1b')];return _[_0xcf08('0x1c')]({},_0xa838ef,_0x2947e5);});})[_0xcf08('0x1d')](function(_0x5f03e1){throw _0x5f03e1;});}exports[_0xcf08('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x2f9899){var _0x43174e='unknown';if(isAgentPaused(_0x2f9899))_0x43174e=_0xcf08('0x12');else if(isAgentPaused(_0x2f9899,!![]))_0x43174e='*pause';else if(isAgentIdle(_0x2f9899))_0x43174e=_0xcf08('0xd');else _0x43174e=_0xcf08('0x1f');return _0x43174e;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x1ee0b4,_0x279847){var _0x209d5d=_[_0xcf08('0x20')](_0x1ee0b4)?_0x1ee0b4:[_0x1ee0b4];var _0x4dd1f0=_[_0xcf08('0x21')](_0x279847)+_0xcf08('0x22');var _0x52968a=_[_0xcf08('0x23')](_0x209d5d,function(_0x50c926){return db[_0x4dd1f0][_0xcf08('0x24')]({'where':{'id':_0x50c926}})[_0xcf08('0x18')](function(_0x5b7e94){if(!_0x5b7e94)return[];return _0x5b7e94[_0xcf08('0x25')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xcf08('0x26')](_0x52968a)[_0xcf08('0x18')](function(_0x213511){var _0x3faf5a=_(_0x213511)[_0xcf08('0x27')]()[_0xcf08('0x23')]('id')[_0xcf08('0x28')]()[_0xcf08('0x29')]();return _0x3faf5a;});}exports[_0xcf08('0x2a')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x4bfaad,_0x4b74f8,_0x371741){try{if(_0x4b74f8[_0xcf08('0xc')]>0x0){_0x4bfaad=_0x4bfaad['filter'](function(_0x684f45){return _0x4b74f8[_0xcf08('0x2b')](_0x684f45['id']);});}var _0x347835=_0x4bfaad[_0xcf08('0xb')](function(_0xcd6a74){var _0x1709ca=_0xcf08('0x1f');if(isAgentIdle(_0xcd6a74)){_0x1709ca=_0xcf08('0xd');}return _0x1709ca===_0x371741;});return _[_0xcf08('0x23')](_0x347835,'id');}catch(_0x315b96){throw _0x315b96;}}exports[_0xcf08('0x2c')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x242edd,_0x2e6543,_0x2808de){return Promise[_0xcf08('0x2d')]()['then'](function(){if(_0x2e6543[_0xcf08('0xc')]>0x0){_0x242edd=_0x242edd['filter'](function(_0x580acc){return _0x2e6543[_0xcf08('0x2b')](_0x580acc['id']);});}return _0x242edd;})['then'](function(){return db['User']['findAll']({'attributes':['id',_0xcf08('0x2e'),_0xcf08('0x2f'),_0xcf08('0x5'),'faxPause','mailPause',_0xcf08('0x7'),_0xcf08('0x8'),_0xcf08('0x9'),_0xcf08('0xa'),_0xcf08('0x30')],'where':{'id':{'$in':_[_0xcf08('0x23')](_0x242edd,'id')}},'raw':!![]});})[_0xcf08('0x18')](function(_0x56da2f){return _0x56da2f[_0xcf08('0x23')](function(_0x597629){var _0x121bd2=_[_0xcf08('0x31')](_0x242edd,['id',_0x597629['id']]);var _0x497d6c=filterAgentAttributes(_0x121bd2);_[_0xcf08('0x1c')](_0x597629,_0x497d6c);_0x597629[_0xcf08('0x32')]=getAgentStatus(_0x597629);return _0x597629;});})[_0xcf08('0x18')](function(_0x5853b3){var _0x53f457=sortAgentsByStatus(_0x5853b3,_0x2808de);return _[_0xcf08('0x23')](_0x53f457,'id');})[_0xcf08('0x1d')](function(_0x2bb185){throw _0x2bb185;});}exports[_0xcf08('0x33')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x44da74){var _0xd73d53={'fields':[],'order':null};var _0x3fa7ca=_0x44da74[_0xcf08('0x34')](',');_0xd73d53[_0xcf08('0x35')]=_[_0xcf08('0xb')](_0x3fa7ca,function(_0x48ecc7){if(!_0x48ecc7['includes'](_0xcf08('0x32'))){return!![];}_0xd73d53[_0xcf08('0x36')]=_[_0xcf08('0x37')](_0x48ecc7,'-')?_0xcf08('0x38'):_0xcf08('0x39');return![];});return _0xd73d53;}exports[_0xcf08('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x54720){if(!_0x54720){_0x54720=_0xcf08('0x3b');}if(_0x54720['includes'](_0xcf08('0x2f'))&&!_0x54720[_0xcf08('0x2b')]('internal')){var _0x2795fc=_0x54720['substring'](0x0,_0x54720[_0xcf08('0x3c')](_0xcf08('0x2f')));_0x54720+=','+_0x2795fc+_0xcf08('0x3d');}return _0x54720;}exports[_0xcf08('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x1b6047,_0x41d9eb){var _0x16f9f9=_0x1b6047[_0xcf08('0x3f')](function(_0x4c2ad7,_0x2f7495){if(_0x4c2ad7[_0xcf08('0x32')]===_0x2f7495[_0xcf08('0x32')]){if(_0x4c2ad7['globalStatus']==='pause'){if(_0x41d9eb===_0xcf08('0x38')){return(_0x4c2ad7[_0xcf08('0x30')]||'')<(_0x2f7495[_0xcf08('0x30')]||'')||_0x4c2ad7[_0xcf08('0x2f')]['toLowerCase']()>_0x2f7495[_0xcf08('0x2f')]['toLowerCase']()?0x1:-0x1;}else{return(_0x4c2ad7[_0xcf08('0x30')]||'')<(_0x2f7495[_0xcf08('0x30')]||'')||_0x4c2ad7[_0xcf08('0x2f')]['toLowerCase']()>_0x2f7495[_0xcf08('0x2f')][_0xcf08('0x40')]()?-0x1:0x1;}}else{if(_0x41d9eb===_0xcf08('0x38')){return _0x4c2ad7[_0xcf08('0x2f')][_0xcf08('0x40')]()<_0x2f7495[_0xcf08('0x2f')][_0xcf08('0x40')]()?0x1:-0x1;}else{return _0x4c2ad7[_0xcf08('0x2f')][_0xcf08('0x40')]()<_0x2f7495['fullname'][_0xcf08('0x40')]()?-0x1:0x1;}}}else{if(_0x41d9eb===_0xcf08('0x38')){return _0x4c2ad7[_0xcf08('0x32')]<_0x2f7495[_0xcf08('0x32')]?0x1:-0x1;}else{return _0x4c2ad7[_0xcf08('0x32')]<_0x2f7495['globalStatus']?-0x1:0x1;}}});return _0x16f9f9;}exports[_0xcf08('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x47740f){var _0x1c147a=[_0xcf08('0x42'),_0xcf08('0x43'),_0xcf08('0x44'),_0xcf08('0x45'),_0xcf08('0x30'),_0xcf08('0x45'),_0xcf08('0x3d'),_0xcf08('0x46'),_0xcf08('0x5'),_0xcf08('0x7'),_0xcf08('0x47'),_0xcf08('0x8'),_0xcf08('0xa'),_0xcf08('0x6'),_0xcf08('0x9'),_0xcf08('0x48'),'openchannelCapacity','mailCapacity',_0xcf08('0x49'),_0xcf08('0x4a'),_0xcf08('0x4b'),_0xcf08('0x4c'),_0xcf08('0x4d'),_0xcf08('0x4e'),'smsCurrentCapacity',_0xcf08('0x4f'),_0xcf08('0x50'),_0xcf08('0x14'),_0xcf08('0x51'),_0xcf08('0x52'),_0xcf08('0x15'),'whatsappStatus',_0xcf08('0x53'),_0xcf08('0x11'),_0xcf08('0x54'),'openchannelStatusTime',_0xcf08('0x55'),_0xcf08('0x56'),_0xcf08('0x57'),_0xcf08('0x58'),_0xcf08('0x59'),_0xcf08('0x5a'),'destconnectedlinenum',_0xcf08('0x5b'),_0xcf08('0x5c'),'phoneBarEnableAutomaticScreenRecording'];var _0x200a97=[_0xcf08('0x5'),_0xcf08('0x7'),'mailPause','smsPause',_0xcf08('0xa'),_0xcf08('0x6'),_0xcf08('0x9'),_0xcf08('0x43')];var _0xca83a=_(_0x47740f)[_0xcf08('0x5d')](_0x200a97)[_0xcf08('0x5e')](_0x1c147a)[_0xcf08('0x29')]();return _0xca83a;}exports[_0xcf08('0x5f')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xcf08('0x2e'),'fullname','role',_0xcf08('0x3d'),'online',_0xcf08('0x32'),_0xcf08('0x42'),'lastLoginAt',_0xcf08('0x30'),_0xcf08('0x45'),'faxPause',_0xcf08('0x5'),'mailPause',_0xcf08('0x7'),'smsPause','voicePause',_0xcf08('0xa'),'chatStatus',_0xcf08('0x53'),_0xcf08('0x52'),_0xcf08('0x51'),_0xcf08('0x15'),'voiceStatus',_0xcf08('0x60'),'chatStatusTime',_0xcf08('0x58'),'mailStatusTime','openchannelStatusTime','smsStatusTime','voiceStatusTime',_0xcf08('0x57'),'chatCapacity',_0xcf08('0x4b'),_0xcf08('0x61'),_0xcf08('0x62'),_0xcf08('0x49'),_0xcf08('0x4a'),_0xcf08('0x4c'),_0xcf08('0x50'),_0xcf08('0x4e'),_0xcf08('0x4d'),_0xcf08('0x63'),_0xcf08('0x4f'),_0xcf08('0x5c'),_0xcf08('0x64'),_0xcf08('0x65'),'onhold',_0xcf08('0x5a'),_0xcf08('0x5b')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x05e3=['userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','faxStatus','chatStatusTime','openchannelStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','omit','pick','role','smsStatus','voiceStatusTime','faxCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','phoneBarEnableScreenRecordingByAgent','screenrecording','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','length','unknown','unavailable','ringing','isNil','voiceStatus','idle','pause','chatStatus','mailStatus','openchannelStatus','whatsappStatus','request','Agents','then','error','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','*pause','busy','isArray','startCase','Queue','map','findOne','getAgents','flatten','uniq','filter','getAgentIdsByStatus','resolve','User','findAll','name','chatPause','pauseType','find','merge','catch','getSortedAgentsIdsByStatus','split','includes','globalStatus','order','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','fullname','sort','toLowerCase','sortAgentsByStatus'];(function(_0x4c0f3f,_0x4a1ce4){var _0x3cd593=function(_0x59d6d5){while(--_0x59d6d5){_0x4c0f3f['push'](_0x4c0f3f['shift']());}};_0x3cd593(++_0x4a1ce4);}(_0x05e3,0x86));var _0x305e=function(_0x5068d5,_0x353c3d){_0x5068d5=_0x5068d5-0x0;var _0x22123e=_0x05e3[_0x5068d5];return _0x22123e;};'use strict';var _=require(_0x305e('0x0'));var jayson=require(_0x305e('0x1'));var db=require(_0x305e('0x2'))['db'];var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0x305e('0x3')][_0x305e('0x4')]({'port':0x232c});function isAgentPaused(_0x569643,_0x409b14){var _0x112f54=[_0x569643['chatPause'],_0x569643[_0x305e('0x5')],_0x569643[_0x305e('0x6')],_0x569643[_0x305e('0x7')],_0x569643[_0x305e('0x8')],_0x569643[_0x305e('0x9')],_0x569643[_0x305e('0xa')]];if(!_0x409b14)return _[_0x305e('0xb')](_0x112f54);var _0x952a5e=_['filter'](_0x112f54);return _0x952a5e[_0x305e('0xc')]>0x0&&_0x952a5e['length']<_0x112f54[_0x305e('0xc')]?!![]:![];}function isIdle(_0x768a4a){return _0x768a4a==='idle'||_0x768a4a===_0x305e('0xd')||_0x768a4a===_0x305e('0xe')||_0x768a4a===_0x305e('0xf')||_[_0x305e('0x10')](_0x768a4a);}function isAgentIdle(_0x3bba0e){if(_0x3bba0e[_0x305e('0x11')]!==_0x305e('0x12')&&_0x3bba0e[_0x305e('0x9')]){_0x3bba0e[_0x305e('0x11')]=_0x305e('0x13');return![];}return _[_0x305e('0xb')]([_0x3bba0e[_0x305e('0x14')],_0x3bba0e['faxStatus'],_0x3bba0e[_0x305e('0x15')],_0x3bba0e[_0x305e('0x16')],_0x3bba0e['smsStatus'],_0x3bba0e[_0x305e('0x11')],_0x3bba0e[_0x305e('0x17')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x305e('0x18')](_0x305e('0x19'),{})[_0x305e('0x1a')](function(_0xc5b3dc){if(_0xc5b3dc[_0x305e('0x1b')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x1637e6=_0xc5b3dc[_0x305e('0x1c')];return routingClient['request'](_0x305e('0x19'),{})[_0x305e('0x1a')](function(_0x265bf3){if(_0x265bf3[_0x305e('0x1b')]){throw new Error(_0x305e('0x1d'));}var _0x577b0e=_0x265bf3['result'];return _['merge']({},_0x1637e6,_0x577b0e);});})['catch'](function(_0x488b7b){throw _0x488b7b;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x498c44){var _0x5dd25f=_0x305e('0xd');if(isAgentPaused(_0x498c44))_0x5dd25f=_0x305e('0x13');else if(isAgentPaused(_0x498c44,!![]))_0x5dd25f=_0x305e('0x1e');else if(isAgentIdle(_0x498c44))_0x5dd25f=_0x305e('0x12');else _0x5dd25f=_0x305e('0x1f');return _0x5dd25f;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x472d2b,_0x573f2d){var _0x309b47=_[_0x305e('0x20')](_0x472d2b)?_0x472d2b:[_0x472d2b];var _0x56427e=_[_0x305e('0x21')](_0x573f2d)+_0x305e('0x22');var _0x2061d1=_[_0x305e('0x23')](_0x309b47,function(_0x151361){return db[_0x56427e][_0x305e('0x24')]({'where':{'id':_0x151361}})[_0x305e('0x1a')](function(_0x1a255d){if(!_0x1a255d)return[];return _0x1a255d[_0x305e('0x25')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x2061d1)['then'](function(_0x1bda0f){var _0x1335aa=_(_0x1bda0f)[_0x305e('0x26')]()[_0x305e('0x23')]('id')[_0x305e('0x27')]()['value']();return _0x1335aa;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1e21e6,_0x24d521,_0x10b398){try{if(_0x24d521[_0x305e('0xc')]>0x0){_0x1e21e6=_0x1e21e6[_0x305e('0x28')](function(_0x5dacb1){return _0x24d521['includes'](_0x5dacb1['id']);});}var _0xb845fb=_0x1e21e6[_0x305e('0x28')](function(_0x15e558){var _0x3de37c='busy';if(isAgentIdle(_0x15e558)){_0x3de37c=_0x305e('0x12');}return _0x3de37c===_0x10b398;});return _[_0x305e('0x23')](_0xb845fb,'id');}catch(_0x5a7ecd){throw _0x5a7ecd;}}exports[_0x305e('0x29')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1ad123,_0x4132b2,_0x1f7298){return Promise[_0x305e('0x2a')]()['then'](function(){if(_0x4132b2['length']>0x0){_0x1ad123=_0x1ad123[_0x305e('0x28')](function(_0x35b649){return _0x4132b2['includes'](_0x35b649['id']);});}return _0x1ad123;})['then'](function(){return db[_0x305e('0x2b')][_0x305e('0x2c')]({'attributes':['id',_0x305e('0x2d'),'fullname',_0x305e('0x2e'),'faxPause',_0x305e('0x6'),_0x305e('0x7'),_0x305e('0x8'),_0x305e('0x9'),_0x305e('0xa'),_0x305e('0x2f')],'where':{'id':{'$in':_[_0x305e('0x23')](_0x1ad123,'id')}},'raw':!![]});})['then'](function(_0xd1ca92){return _0xd1ca92[_0x305e('0x23')](function(_0x8fdb93){var _0x11d87e=_[_0x305e('0x30')](_0x1ad123,['id',_0x8fdb93['id']]);var _0x4a79e3=filterAgentAttributes(_0x11d87e);_[_0x305e('0x31')](_0x8fdb93,_0x4a79e3);_0x8fdb93['globalStatus']=getAgentStatus(_0x8fdb93);return _0x8fdb93;});})[_0x305e('0x1a')](function(_0x35a8c0){var _0x1d8694=sortAgentsByStatus(_0x35a8c0,_0x1f7298);return _[_0x305e('0x23')](_0x1d8694,'id');})[_0x305e('0x32')](function(_0x378250){throw _0x378250;});}exports[_0x305e('0x33')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x13b0fd){var _0xfbbb5={'fields':[],'order':null};var _0x27b8ec=_0x13b0fd[_0x305e('0x34')](',');_0xfbbb5['fields']=_[_0x305e('0x28')](_0x27b8ec,function(_0x41897c){if(!_0x41897c[_0x305e('0x35')](_0x305e('0x36'))){return!![];}_0xfbbb5[_0x305e('0x37')]=_[_0x305e('0x38')](_0x41897c,'-')?_0x305e('0x39'):_0x305e('0x3a');return![];});return _0xfbbb5;}exports[_0x305e('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0x7cc088){if(!_0x7cc088){_0x7cc088=_0x305e('0x3c');}if(_0x7cc088[_0x305e('0x35')]('fullname')&&!_0x7cc088['includes'](_0x305e('0x3d'))){var _0x5b4818=_0x7cc088[_0x305e('0x3e')](0x0,_0x7cc088[_0x305e('0x3f')](_0x305e('0x40')));_0x7cc088+=','+_0x5b4818+_0x305e('0x3d');}return _0x7cc088;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0xc93a9b,_0x34de07){var _0x40dd4f=_0xc93a9b[_0x305e('0x41')](function(_0x280d31,_0x4e4ccd){if(_0x280d31[_0x305e('0x36')]===_0x4e4ccd[_0x305e('0x36')]){if(_0x280d31['globalStatus']==='pause'){if(_0x34de07===_0x305e('0x39')){return(_0x280d31['pauseType']||'')<(_0x4e4ccd['pauseType']||'')||_0x280d31[_0x305e('0x40')][_0x305e('0x42')]()>_0x4e4ccd['fullname'][_0x305e('0x42')]()?0x1:-0x1;}else{return(_0x280d31[_0x305e('0x2f')]||'')<(_0x4e4ccd[_0x305e('0x2f')]||'')||_0x280d31[_0x305e('0x40')][_0x305e('0x42')]()>_0x4e4ccd[_0x305e('0x40')][_0x305e('0x42')]()?-0x1:0x1;}}else{if(_0x34de07===_0x305e('0x39')){return _0x280d31[_0x305e('0x40')][_0x305e('0x42')]()<_0x4e4ccd[_0x305e('0x40')][_0x305e('0x42')]()?0x1:-0x1;}else{return _0x280d31[_0x305e('0x40')][_0x305e('0x42')]()<_0x4e4ccd[_0x305e('0x40')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x34de07===_0x305e('0x39')){return _0x280d31['globalStatus']<_0x4e4ccd[_0x305e('0x36')]?0x1:-0x1;}else{return _0x280d31[_0x305e('0x36')]<_0x4e4ccd[_0x305e('0x36')]?-0x1:0x1;}}});return _0x40dd4f;}exports[_0x305e('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x3cce7f){var _0x2c24ae=[_0x305e('0x44'),_0x305e('0x45'),_0x305e('0x46'),_0x305e('0x47'),_0x305e('0x2f'),_0x305e('0x47'),_0x305e('0x3d'),_0x305e('0x48'),_0x305e('0x2e'),'openchannelPause',_0x305e('0x6'),_0x305e('0x8'),'whatsappPause',_0x305e('0x5'),_0x305e('0x9'),_0x305e('0x49'),_0x305e('0x4a'),_0x305e('0x4b'),_0x305e('0x4c'),_0x305e('0x4d'),_0x305e('0x4e'),_0x305e('0x4f'),_0x305e('0x50'),'mailCurrentCapacity',_0x305e('0x51'),'whatsappCurrentCapacity','faxCurrentCapacity',_0x305e('0x14'),'openchannelStatus','mailStatus','smsStatus','whatsappStatus',_0x305e('0x52'),_0x305e('0x11'),_0x305e('0x53'),_0x305e('0x54'),'mailStatusTime',_0x305e('0x55'),_0x305e('0x56'),_0x305e('0x57'),'voiceStatusTime',_0x305e('0x58'),_0x305e('0x59'),'screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording'];var _0x27c341=[_0x305e('0x2e'),_0x305e('0x7'),'mailPause',_0x305e('0x8'),_0x305e('0xa'),_0x305e('0x5'),_0x305e('0x9'),_0x305e('0x45')];var _0x4e69b2=_(_0x3cce7f)[_0x305e('0x5a')](_0x27c341)[_0x305e('0x5b')](_0x2c24ae)['value']();return _0x4e69b2;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x305e('0x2d'),_0x305e('0x40'),_0x305e('0x5c'),_0x305e('0x3d'),'online','globalStatus',_0x305e('0x44'),'lastLoginAt','pauseType',_0x305e('0x47'),_0x305e('0x5'),'chatPause','mailPause',_0x305e('0x7'),_0x305e('0x8'),_0x305e('0x9'),_0x305e('0xa'),_0x305e('0x14'),'faxStatus',_0x305e('0x15'),'openchannelStatus',_0x305e('0x5d'),_0x305e('0x11'),_0x305e('0x17'),_0x305e('0x53'),_0x305e('0x57'),'mailStatusTime',_0x305e('0x54'),'smsStatusTime',_0x305e('0x5e'),_0x305e('0x56'),_0x305e('0x49'),'faxCapacity','mailCapacity',_0x305e('0x4a'),_0x305e('0x4c'),_0x305e('0x4d'),_0x305e('0x4f'),_0x305e('0x5f'),_0x305e('0x60'),'openchannelCurrentCapacity',_0x305e('0x51'),_0x305e('0x61'),_0x305e('0x62'),'phoneBarEnableAutomaticScreenRecording',_0x305e('0x59'),'onhold',_0x305e('0x58'),_0x305e('0x63')];}exports[_0x305e('0x64')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index ebf741a..2cb45b4 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 _0xf164=['available','loggedIn','busy','inUse','loggedInDb','onHold','ringInUse','message','statusMessage','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','getRealtimeQueues','map','paused','outbound','pTalking','originated','merge','pick','jayson/promise','util','client','http'];(function(_0x4672b4,_0x2e24b9){var _0x1c6ce5=function(_0x43fc9a){while(--_0x43fc9a){_0x4672b4['push'](_0x4672b4['shift']());}};_0x1c6ce5(++_0x2e24b9);}(_0xf164,0xac));var _0x4f16=function(_0x43c3db,_0x36ea7b){_0x43c3db=_0x43c3db-0x0;var _0x45e6b0=_0xf164[_0x43c3db];return _0x45e6b0;};'use strict';var _=require('lodash');var jayson=require(_0x4f16('0x0'));var util=require(_0x4f16('0x1'));var amiClient=jayson[_0x4f16('0x2')][_0x4f16('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x4f16('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x4f16('0x4'),_0x4f16('0x5'),'paused','waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x4f16('0x6'),_0x4f16('0x7'),'invalid',_0x4f16('0x8'),'notInUse',_0x4f16('0x9'),'ringing',_0x4f16('0xa'),'talking','unavailable','unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking','originated',_0x4f16('0xb'),_0x4f16('0xc'),_0x4f16('0xd'),_0x4f16('0xe'),_0x4f16('0xf'),_0x4f16('0x10'),'startProgressive',_0x4f16('0x11'),_0x4f16('0x12'),_0x4f16('0x13'),_0x4f16('0x14'),_0x4f16('0x15'),_0x4f16('0x16'),'dialPredictiveIntervalMinThreshold',_0x4f16('0x17'),_0x4f16('0x18'),_0x4f16('0x19'),_0x4f16('0x1a'),_0x4f16('0x1b'),_0x4f16('0x1c'),_0x4f16('0x1d')];function getRealtimeQueues(_0x5be58a,_0x4b9b57){var _0x54dfc9=_0x4b9b57===_0x4f16('0x1e')?amiClient:routingClient;return _0x54dfc9[_0x4f16('0x1f')](_['startCase'](_0x4b9b57)+'Queues',_0x5be58a)[_0x4f16('0x20')](function(_0xb6d317){if(_0xb6d317[_0x4f16('0x21')])throw new Error(util[_0x4f16('0x22')](_0x4f16('0x23'),_0x4b9b57));return _0xb6d317['result'];})['catch'](function(_0x368a71){throw _0x368a71;});}exports[_0x4f16('0x24')]=getRealtimeQueues;function initializeQueues(_0x26f65e,_0x4596e0,_0x1371fd,_0x35a6e2){var _0x3c3f07=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1371fd===_0x4f16('0x1e')){if(_0x35a6e2==='inbound'){_0x3c3f07=_0x3c3f07['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x35a6e2==='outbound'){_0x3c3f07=_0x3c3f07['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x26f65e[_0x4f16('0x25')](function(_0x4f4f61){var _0xfea6cf=_0x4f4f61['get']({'plain':!![]});_0xfea6cf[_0x4f16('0x26')]=0x0;_0xfea6cf['loggedInDb']=0x0;_0xfea6cf[_0x4f16('0x5')]=0x0;_0xfea6cf[_0x4f16('0x4')]=0x0;_0xfea6cf['waiting']=0x0;if(_0x1371fd===_0x4f16('0x1e')){_0xfea6cf['talking']=0x0;_0xfea6cf[_0x4f16('0x6')]=0x0;if(_0x35a6e2===_0x4f16('0x27')){_0xfea6cf[_0x4f16('0x28')]=0x0;_0xfea6cf[_0x4f16('0x29')]=0x0;}}var _0x32f650=_['find'](_0x4596e0,['id',_0xfea6cf['id']]);if(_0x32f650){_[_0x4f16('0x2a')](_0xfea6cf,_[_0x4f16('0x2b')](_0x32f650,_0x3c3f07));}return _0xfea6cf;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0x0dd9=['format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','concat','get','paused','outbound','pTalking','originated','find','merge','pick','initializeQueues','lodash','jayson/promise','util','http','available','loggedIn','waiting','busy','inUse','invalid','loggedInDb','onHold','ringing','ringInUse','talking','unavailable','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error'];(function(_0x3b393c,_0x53abe6){var _0xa814f3=function(_0x298dc1){while(--_0x298dc1){_0x3b393c['push'](_0x3b393c['shift']());}};_0xa814f3(++_0x53abe6);}(_0x0dd9,0x78));var _0x90dd=function(_0x3226a2,_0x1623b3){_0x3226a2=_0x3226a2-0x0;var _0x138290=_0x0dd9[_0x3226a2];return _0x138290;};'use strict';var _=require(_0x90dd('0x0'));var jayson=require(_0x90dd('0x1'));var util=require(_0x90dd('0x2'));var amiClient=jayson['client'][_0x90dd('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x90dd('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x90dd('0x4'),_0x90dd('0x5'),'paused',_0x90dd('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0x90dd('0x7'),_0x90dd('0x8'),_0x90dd('0x9'),_0x90dd('0xa'),'notInUse',_0x90dd('0xb'),_0x90dd('0xc'),_0x90dd('0xd'),_0x90dd('0xe'),_0x90dd('0xf'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking','originated',_0x90dd('0x10'),'statusMessage',_0x90dd('0x11'),_0x90dd('0x12'),_0x90dd('0x13'),_0x90dd('0x14'),_0x90dd('0x15'),_0x90dd('0x16'),_0x90dd('0x17'),_0x90dd('0x18'),'erlangBusyFactor','dialPredictiveInterval',_0x90dd('0x19'),'dialPredictiveIntervalMinThreshold',_0x90dd('0x1a'),_0x90dd('0x1b'),_0x90dd('0x1c'),_0x90dd('0x1d'),_0x90dd('0x1e'),_0x90dd('0x1f'),_0x90dd('0x20')];function getRealtimeQueues(_0x445810,_0x4dacf6){var _0x3b3876=_0x4dacf6===_0x90dd('0x21')?amiClient:routingClient;return _0x3b3876[_0x90dd('0x22')](_[_0x90dd('0x23')](_0x4dacf6)+_0x90dd('0x24'),_0x445810)[_0x90dd('0x25')](function(_0x360e7f){if(_0x360e7f[_0x90dd('0x26')])throw new Error(util[_0x90dd('0x27')](_0x90dd('0x28'),_0x4dacf6));return _0x360e7f[_0x90dd('0x29')];})['catch'](function(_0x32d74c){throw _0x32d74c;});}exports[_0x90dd('0x2a')]=getRealtimeQueues;function initializeQueues(_0x3f1af2,_0x2ee8e2,_0x5864ac,_0x449e84){var _0x344fbd=DEFAULT_QUEUE_ATTRIBUTES;if(_0x5864ac===_0x90dd('0x21')){if(_0x449e84==='inbound'){_0x344fbd=_0x344fbd['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x449e84==='outbound'){_0x344fbd=_0x344fbd[_0x90dd('0x2b')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x3f1af2['map'](function(_0x47deb0){var _0x2df857=_0x47deb0[_0x90dd('0x2c')]({'plain':!![]});_0x2df857[_0x90dd('0x2d')]=0x0;_0x2df857[_0x90dd('0xa')]=0x0;_0x2df857[_0x90dd('0x5')]=0x0;_0x2df857[_0x90dd('0x4')]=0x0;_0x2df857['waiting']=0x0;if(_0x5864ac===_0x90dd('0x21')){_0x2df857[_0x90dd('0xe')]=0x0;_0x2df857[_0x90dd('0x7')]=0x0;if(_0x449e84===_0x90dd('0x2e')){_0x2df857[_0x90dd('0x2f')]=0x0;_0x2df857[_0x90dd('0x30')]=0x0;}}var _0x6a2331=_[_0x90dd('0x31')](_0x2ee8e2,['id',_0x2df857['id']]);if(_0x6a2331){_[_0x90dd('0x32')](_0x2df857,_[_0x90dd('0x33')](_0x6a2331,_0x344fbd));}return _0x2df857;});}exports[_0x90dd('0x34')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 17c9afc..1d078cb 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x40d10c,_0x276401){var _0x52b763=function(_0x31cb81){while(--_0x31cb81){_0x40d10c['push'](_0x40d10c['shift']());}};_0x52b763(++_0x276401);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x297b2b,_0x11eb85){var _0x14754b=function(_0x377d2f){while(--_0x377d2f){_0x297b2b['push'](_0x297b2b['shift']());}};_0x14754b(++_0x11eb85);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 09ece99..c667495 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 _0x6984=['getFirstInterface','join','md5','update','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','keys','filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x6984,0xb6));var _0x4698=function(_0x59eaa1,_0x1f4bc0){_0x59eaa1=_0x59eaa1-0x0;var _0x420046=_0x6984[_0x59eaa1];return _0x420046;};'use strict';var _=require(_0x4698('0x0'));var os=require('os');var crypto=require(_0x4698('0x1'));var machine=require(_0x4698('0x2'));var exec=require(_0x4698('0x3'))[_0x4698('0x4')];var config=require(_0x4698('0x5'));function getInterfaces(){var _0x1cffb2=[];var _0x300b3f=os['networkInterfaces']();var _0x3b78e4=_['orderBy'](_[_0x4698('0x6')](_0x300b3f));for(var _0x42cd7b=0x0;_0x42cd7b<_0x3b78e4['length'];_0x42cd7b++){var _0x2fc1ed=_0x300b3f[_0x3b78e4[_0x42cd7b]][_0x4698('0x7')](function(_0x410646){return _0x410646['family']===_0x4698('0x8')&&_0x410646[_0x4698('0x9')]===![];});_0x1cffb2=_0x1cffb2[_0x4698('0xa')](_0x2fc1ed);}return _0x1cffb2;}function getFirstInterface(){var _0x144e2e=_[_0x4698('0xb')](getInterfaces());return{'macAddress':_0x144e2e&&_0x144e2e[_0x4698('0xc')]?_0x144e2e[_0x4698('0xc')]:_0x4698('0xd'),'ipAddress':_0x144e2e&&_0x144e2e[_0x4698('0xe')]?_0x144e2e[_0x4698('0xe')]:_0x4698('0xf')};}exports[_0x4698('0x10')]=getFirstInterface;function getCPUhash(){var _0x1ceb31=_['orderBy'](os['cpus']()['map'](function(_0x14d8c6){return _0x14d8c6['model'];}))[_0x4698('0x11')](':');return crypto['createHash'](_0x4698('0x12'))[_0x4698('0x13')](_0x1ceb31)['digest']('hex');}exports['getUuid']=function(){var _0x5b2b3e=os[_0x4698('0x14')]();var _0x2b5b7c=/[0-9a-f-]{36}/;if(config[_0x4698('0x15')]&&_0x2b5b7c[_0x4698('0x16')](config['licenseToken'])){return config[_0x4698('0x15')];}else if(_0x5b2b3e===_0x4698('0x17')){return exec(_0x4698('0x18'),{'encoding':_0x4698('0x19')})[_0x4698('0x1a')]('\x0d\x0a','');}else{var _0x1aa2b7=getFirstInterface();var _0x181d4e=getCPUhash();var _0x2e4e29=_0x181d4e+'|'+os[_0x4698('0x1b')]()+'|'+_0x1aa2b7[_0x4698('0x1c')]+'|'+_0x1aa2b7[_0x4698('0x1d')];var _0x3da8d3=crypto[_0x4698('0x1e')](_0x4698('0x12'))['update'](_0x2e4e29)['digest'](_0x4698('0x1f'));return _0x3da8d3[_0x4698('0x20')](0x0,0x8)+'-'+_0x3da8d3['substring'](0x8,0xc)+'-'+_0x3da8d3['substring'](0xc,0x10)+'-'+_0x3da8d3[_0x4698('0x20')](0x10,0x14)+'-'+_0x3da8d3['substring'](0x14);}}; \ No newline at end of file +var _0x7ab7=['00:00:00:00:00:00','address','127.0.0.1','orderBy','cpus','map','model','md5','update','digest','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','createHash','hex','substring','crypto','child_process','execSync','../environment','networkInterfaces','length','filter','family','IPv4','internal','concat','head','mac'];(function(_0x160bbd,_0x5adce6){var _0x18cb69=function(_0x206e4b){while(--_0x206e4b){_0x160bbd['push'](_0x160bbd['shift']());}};_0x18cb69(++_0x5adce6);}(_0x7ab7,0x103));var _0x77ab=function(_0xc56cde,_0x58e81f){_0xc56cde=_0xc56cde-0x0;var _0x3adcb5=_0x7ab7[_0xc56cde];return _0x3adcb5;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x77ab('0x0'));var machine=require('bimedia-machine-uuid');var exec=require(_0x77ab('0x1'))[_0x77ab('0x2')];var config=require(_0x77ab('0x3'));function getInterfaces(){var _0x29e7d4=[];var _0x54ceb0=os[_0x77ab('0x4')]();var _0x5cbd63=_['orderBy'](_['keys'](_0x54ceb0));for(var _0x3e681d=0x0;_0x3e681d<_0x5cbd63[_0x77ab('0x5')];_0x3e681d++){var _0x293fac=_0x54ceb0[_0x5cbd63[_0x3e681d]][_0x77ab('0x6')](function(_0x2172e8){return _0x2172e8[_0x77ab('0x7')]===_0x77ab('0x8')&&_0x2172e8[_0x77ab('0x9')]===![];});_0x29e7d4=_0x29e7d4[_0x77ab('0xa')](_0x293fac);}return _0x29e7d4;}function getFirstInterface(){var _0x40e5bf=_[_0x77ab('0xb')](getInterfaces());return{'macAddress':_0x40e5bf&&_0x40e5bf[_0x77ab('0xc')]?_0x40e5bf[_0x77ab('0xc')]:_0x77ab('0xd'),'ipAddress':_0x40e5bf&&_0x40e5bf[_0x77ab('0xe')]?_0x40e5bf['address']:_0x77ab('0xf')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x5d3408=_[_0x77ab('0x10')](os[_0x77ab('0x11')]()[_0x77ab('0x12')](function(_0x4c86b0){return _0x4c86b0[_0x77ab('0x13')];}))['join'](':');return crypto['createHash'](_0x77ab('0x14'))[_0x77ab('0x15')](_0x5d3408)[_0x77ab('0x16')]('hex');}exports[_0x77ab('0x17')]=function(){var _0x4f7cf7=os[_0x77ab('0x18')]();var _0x214b9d=/[0-9a-f-]{36}/;if(config[_0x77ab('0x19')]&&_0x214b9d[_0x77ab('0x1a')](config['licenseToken'])){return config[_0x77ab('0x19')];}else if(_0x4f7cf7===_0x77ab('0x1b')){return exec(_0x77ab('0x1c'),{'encoding':'utf8'})[_0x77ab('0x1d')]('\x0d\x0a','');}else{var _0xf3b54c=getFirstInterface();var _0x26d80e=getCPUhash();var _0x1b0d88=_0x26d80e+'|'+os[_0x77ab('0x1e')]()+'|'+_0xf3b54c['macAddress']+'|'+_0xf3b54c['ipAddress'];var _0x28c276=crypto[_0x77ab('0x1f')](_0x77ab('0x14'))['update'](_0x1b0d88)[_0x77ab('0x16')](_0x77ab('0x20'));return _0x28c276['substring'](0x0,0x8)+'-'+_0x28c276[_0x77ab('0x21')](0x8,0xc)+'-'+_0x28c276[_0x77ab('0x21')](0xc,0x10)+'-'+_0x28c276['substring'](0x10,0x14)+'-'+_0x28c276[_0x77ab('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index a809dee..f4e8061 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 _0xa12e=['update','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','format','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','moment','request-promise','bluebird','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','version','catch','data1','then','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa12e,0x12f));var _0xea12=function(_0x66ca61,_0x49453d){_0x66ca61=_0x66ca61-0x0;var _0xa80806=_0xa12e[_0x66ca61];return _0xa80806;};'use strict';var util=require('util');var moment=require(_0xea12('0x0'));var rp=require(_0xea12('0x1'));var BPromise=require(_0xea12('0x2'));var pkginfo=require('pkginfo')(module,'version');var db=require(_0xea12('0x3'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xea12('0x4'));var logger=require(_0xea12('0x5'))(_0xea12('0x6'));var HOST=_0xea12('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x32b78e){return new BPromise(function(_0x472ea9,_0x323ee7){var _0x4046bd=util['format'](_0xea12('0x8'),HOST,_0x32b78e,module[_0xea12('0x9')]['version']);if(oldToken){_0x4046bd=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x32b78e,module[_0xea12('0x9')][_0xea12('0xa')],oldToken);}var _0x1af24b={'uri':_0x4046bd,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x1af24b)['then'](function(_0x5ab74d){_0x472ea9(_0x5ab74d);})[_0xea12('0xb')](function(_0xeef581){_0x323ee7(_0xeef581);});});}function manageLicense(_0x198e7e,_0x373029){var _0xd9822a=_0x373029['get']({'plain':!![]});if(!isOldTokenSent&&_0xd9822a[_0xea12('0xc')]!==_0x198e7e&&!_0xd9822a['data2']){oldToken=_0xd9822a[_0xea12('0xc')];}httpRequest(_0x198e7e)[_0xea12('0xd')](function(_0x7dfbf9){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x7dfbf9[_0xea12('0xe')]){isOldTokenSent=![];if(!_0xd9822a[_0xea12('0x6')]&&_0xd9822a[_0xea12('0x6')]!=_0x7dfbf9[_0xea12('0x6')]||_0xd9822a[_0xea12('0x6')]&&_0xd9822a[_0xea12('0xf')]){logger[_0xea12('0x10')](_0xea12('0x11'));}if(_0xd9822a[_0xea12('0x6')]&&!_0xd9822a[_0xea12('0xf')]&&_0xd9822a[_0xea12('0x6')]!=_0x7dfbf9[_0xea12('0x6')]){logger[_0xea12('0x10')](_0xea12('0x12'));}if(_0xd9822a[_0xea12('0x6')]&&!_0xd9822a['data2']&&_0xd9822a[_0xea12('0x6')]==_0x7dfbf9[_0xea12('0x6')]){return _0x373029;}return _0x373029['update']({'data1':_0x198e7e,'data2':null,'license':_0x7dfbf9['license']});}else{if(_0x7dfbf9[_0xea12('0x6')]||_0xd9822a[_0xea12('0x6')]){if(!_0xd9822a['data2']){if(_0xd9822a[_0xea12('0xc')]==_0x198e7e){GRAY_PERIOD_REASON=_0xea12('0x13');logger[_0xea12('0x10')](_0xea12('0x14'));}else{GRAY_PERIOD_REASON=_0xea12('0x15');logger[_0xea12('0x10')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xd9822a[_0xea12('0xc')],_0x198e7e);}logger[_0xea12('0x10')](_0xea12('0x16'),GRAY_PERIOD_REASON[_0xea12('0x17')](),moment()['format'](_0xea12('0x18')));return _0x373029[_0xea12('0x19')]({'data2':encryptor[_0xea12('0x1a')](moment()['format'](_0xea12('0x18')))});}else{if(moment()[_0xea12('0x1b')](encryptor[_0xea12('0x1c')](_0xd9822a[_0xea12('0xf')]),_0xea12('0x1d'))>DAYS){logger['info'](_0xea12('0x1e'),moment()[_0xea12('0x1f')](_0xea12('0x18')));isOldTokenSent=![];return _0x373029[_0xea12('0x19')]({'data1':_0x198e7e,'data2':null,'license':null});}}}else{if(_0xd9822a[_0xea12('0xc')]!=_0x198e7e){logger[_0xea12('0x10')](_0xea12('0x20'),_0xd9822a[_0xea12('0xc')],_0x198e7e);return _0x373029[_0xea12('0x19')]({'data1':_0x198e7e,'data2':null,'license':null});}}}return _0x373029;})[_0xea12('0xd')](function(_0x4c6753){_0x373029=_0x4c6753;})[_0xea12('0xb')](function(_0x3618bb){logger['error'](_0x3618bb[_0xea12('0x21')]);})[_0xea12('0x22')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x373029);},TIME);});}function defaultLicense(){var _0x59dc97=hardware[_0xea12('0x23')]();if(_0x59dc97){return db[_0xea12('0x24')][_0xea12('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x59dc97}})['spread'](function(_0x1de006,_0x2323db){logger[_0xea12('0x10')](_0xea12('0x26'),_0x59dc97);manageLicense(_0x59dc97,_0x1de006);})[_0xea12('0xb')](function(_0x54b49d){logger[_0xea12('0x27')](_0x54b49d[_0xea12('0x21')]);});}}exports[_0xea12('0x28')]=defaultLicense; \ No newline at end of file +var _0x4f67=['../../mysqldb','../../components/encryptor','../logger','license','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data1','data2','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','format','diff','decryptString','DEMO\x20START\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','error','message','finally','getUuid','findOrCreate','spread','default','moment','request-promise','bluebird','version'];(function(_0x467375,_0x328c2f){var _0x584af5=function(_0x6c098c){while(--_0x6c098c){_0x467375['push'](_0x467375['shift']());}};_0x584af5(++_0x328c2f);}(_0x4f67,0xb5));var _0x74f6=function(_0x33f1f1,_0x3f2a10){_0x33f1f1=_0x33f1f1-0x0;var _0x3052d4=_0x4f67[_0x33f1f1];return _0x3052d4;};'use strict';var util=require('util');var moment=require(_0x74f6('0x0'));var rp=require(_0x74f6('0x1'));var BPromise=require(_0x74f6('0x2'));var pkginfo=require('pkginfo')(module,_0x74f6('0x3'));var db=require(_0x74f6('0x4'))['db'];var encryptor=require(_0x74f6('0x5'));var hardware=require('./hardware');var logger=require(_0x74f6('0x6'))(_0x74f6('0x7'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2bec91){return new BPromise(function(_0x69c482,_0x28fb84){var _0x1908da=util['format'](_0x74f6('0x8'),HOST,_0x2bec91,module[_0x74f6('0x9')][_0x74f6('0x3')]);if(oldToken){_0x1908da=util['format'](_0x74f6('0xa'),HOST,_0x2bec91,module['exports']['version'],oldToken);}var _0x32c025={'uri':_0x1908da,'method':_0x74f6('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x32c025)['then'](function(_0x5af6cb){_0x69c482(_0x5af6cb);})[_0x74f6('0xc')](function(_0x4f28b6){_0x28fb84(_0x4f28b6);});});}function manageLicense(_0x39cc66,_0x3db1ae){var _0x41f8c1=_0x3db1ae[_0x74f6('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x41f8c1[_0x74f6('0xe')]!==_0x39cc66&&!_0x41f8c1[_0x74f6('0xf')]){oldToken=_0x41f8c1['data1'];}httpRequest(_0x39cc66)[_0x74f6('0x10')](function(_0x4a6089){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4a6089[_0x74f6('0x11')]){isOldTokenSent=![];if(!_0x41f8c1['license']&&_0x41f8c1[_0x74f6('0x7')]!=_0x4a6089['license']||_0x41f8c1[_0x74f6('0x7')]&&_0x41f8c1['data2']){logger[_0x74f6('0x12')](_0x74f6('0x13'));}if(_0x41f8c1['license']&&!_0x41f8c1[_0x74f6('0xf')]&&_0x41f8c1[_0x74f6('0x7')]!=_0x4a6089['license']){logger[_0x74f6('0x12')](_0x74f6('0x14'));}if(_0x41f8c1[_0x74f6('0x7')]&&!_0x41f8c1['data2']&&_0x41f8c1['license']==_0x4a6089[_0x74f6('0x7')]){return _0x3db1ae;}return _0x3db1ae[_0x74f6('0x15')]({'data1':_0x39cc66,'data2':null,'license':_0x4a6089[_0x74f6('0x7')]});}else{if(_0x4a6089[_0x74f6('0x7')]||_0x41f8c1[_0x74f6('0x7')]){if(!_0x41f8c1[_0x74f6('0xf')]){if(_0x41f8c1[_0x74f6('0xe')]==_0x39cc66){GRAY_PERIOD_REASON='Disabled';logger['info'](_0x74f6('0x16'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x74f6('0x12')](_0x74f6('0x17'),_0x41f8c1[_0x74f6('0xe')],_0x39cc66);}logger[_0x74f6('0x12')](_0x74f6('0x18'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x74f6('0x19')]('YYYY-MM-DD\x20HH:mm'));return _0x3db1ae[_0x74f6('0x15')]({'data2':encryptor['encryptString'](moment()[_0x74f6('0x19')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x74f6('0x1a')](encryptor[_0x74f6('0x1b')](_0x41f8c1['data2']),'days')>DAYS){logger[_0x74f6('0x12')](_0x74f6('0x1c'),moment()['format'](_0x74f6('0x1d')));isOldTokenSent=![];return _0x3db1ae[_0x74f6('0x15')]({'data1':_0x39cc66,'data2':null,'license':null});}}}else{if(_0x41f8c1['data1']!=_0x39cc66){logger[_0x74f6('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x41f8c1[_0x74f6('0xe')],_0x39cc66);return _0x3db1ae[_0x74f6('0x15')]({'data1':_0x39cc66,'data2':null,'license':null});}}}return _0x3db1ae;})[_0x74f6('0x10')](function(_0x47f15c){_0x3db1ae=_0x47f15c;})['catch'](function(_0x21c7d0){logger[_0x74f6('0x1e')](_0x21c7d0[_0x74f6('0x1f')]);})[_0x74f6('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0x74f6('0x21')](),_0x3db1ae);},TIME);});}function defaultLicense(){var _0x3f131e=hardware[_0x74f6('0x21')]();if(_0x3f131e){return db['License'][_0x74f6('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x3f131e}})[_0x74f6('0x23')](function(_0x498bbd,_0xaa2fbe){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x3f131e);manageLicense(_0x3f131e,_0x498bbd);})[_0x74f6('0xc')](function(_0xdce9f7){logger[_0x74f6('0x1e')](_0xdce9f7['message']);});}}exports[_0x74f6('0x24')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index d879631..74187cc 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 _0xaa89=['format','%s:%s:%s','parse','demo','uuid','machineUuid','decryptString','gray','deadline','add','days','grayReason','disabled','message','User','findAll','role','sequelize','COUNT','admin','telephone','users','telephones','forEach','user','count','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','bluebird','./hardware','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','defaults','then','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split'];(function(_0x549b29,_0x2e2b00){var _0x2b813f=function(_0x43234f){while(--_0x43234f){_0x549b29['push'](_0x549b29['shift']());}};_0x2b813f(++_0x2e2b00);}(_0xaa89,0x176));var _0x9aa8=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xaa89[_0x1762b4];return _0x29beda;};'use strict';var util=require(_0x9aa8('0x0'));var _=require(_0x9aa8('0x1'));var moment=require('moment');var BPromise=require(_0x9aa8('0x2'));var hardware=require(_0x9aa8('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0x9aa8('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x9aa8('0x5'),'machineUuid':hardware[_0x9aa8('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9aa8('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x9aa8('0x8'),'machineUuid':hardware[_0x9aa8('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x166adc){return new BPromise(function(_0xe6635a,_0x2b2fb8){return db[_0x9aa8('0x9')][_0x9aa8('0xa')](_[_0x9aa8('0xb')](_0x166adc,{'raw':!![],'where':{'id':0x1}}))[_0x9aa8('0xc')](function(_0xb6a563){return checkLicense(_0xb6a563,null);})[_0x9aa8('0xc')](function(_0x47a88a){_0xe6635a(_0x47a88a);return;})['catch'](function(_0x3f70ea){_0x2b2fb8(_0x3f70ea);});});}function checkLicense(_0x3739e7,_0x440235){if(!_0x3739e7){demoLicense['uuid']=_0x3739e7[_0x9aa8('0xd')];return demoLicense;}try{var _0x4a5dad=_0x440235||_0x3739e7[_0x9aa8('0xe')];if(_[_0x9aa8('0xf')](_0x4a5dad)){throw new Error(_0x9aa8('0x10'));}var _0x284033=_0x3739e7['data1'];var _0x4d6488=_0x3739e7['data2'];var _0x363c5a=_0x284033[_0x9aa8('0x11')]('-')[0x4];var _0x5f3472=_0x284033[_0x9aa8('0x11')]('-')[0x0];var _0x40610c=encryptor['decryptString'](_0x4a5dad,util[_0x9aa8('0x12')](_0x9aa8('0x13'),_0x363c5a,_0x284033,_0x5f3472));var _0x2db7ff=JSON[_0x9aa8('0x14')](_0x40610c);_0x2db7ff[_0x9aa8('0x15')]=![];_0x2db7ff[_0x9aa8('0x16')]=_0x284033;_0x2db7ff[_0x9aa8('0x17')]=hardware[_0x9aa8('0x6')]();if(_0x4d6488){var _0x832371=encryptor[_0x9aa8('0x18')](_0x4d6488);_0x2db7ff[_0x9aa8('0x19')]=_0x832371;_0x2db7ff[_0x9aa8('0x1a')]=moment(_0x832371)[_0x9aa8('0x1b')](0x7,_0x9aa8('0x1c'))[_0x9aa8('0x12')]();_0x2db7ff[_0x9aa8('0x1d')]=_0x2db7ff[_0x9aa8('0x16')]!=_0x2db7ff['machineUuid']?'changed':_0x9aa8('0x1e');}return _0x2db7ff;}catch(_0x38ed61){breakingLicense[_0x9aa8('0x16')]=_0x3739e7[_0x9aa8('0xd')];breakingLicense[_0x9aa8('0x1f')]=_0x38ed61[_0x9aa8('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x72a9ac,_0x463711){getLicense()['then'](function(_0x252aa4){return db[_0x9aa8('0x20')][_0x9aa8('0x21')]({'attributes':[_0x9aa8('0x22'),[db[_0x9aa8('0x23')]['fn'](_0x9aa8('0x24'),db['sequelize']['col'](_0x9aa8('0x22'))),'count']],'group':_0x9aa8('0x22'),'where':{'role':{'$or':[_0x9aa8('0x25'),'user',_0x9aa8('0x26')]}},'raw':!![]})['then'](function(_0x51c631){var _0x1ca8b8={'user':_0x252aa4[_0x9aa8('0x27')]||0x0,'telephone':_0x252aa4[_0x9aa8('0x28')]||0x0};_0x51c631[_0x9aa8('0x29')](function(_0x18de3b){var _0x534cd7=_0x18de3b[_0x9aa8('0x22')]==='admin'?_0x9aa8('0x2a'):_0x18de3b[_0x9aa8('0x22')];_0x1ca8b8[_0x534cd7]-=_0x18de3b[_0x9aa8('0x2b')];if(_0x1ca8b8[_0x534cd7]<0x0)_0x1ca8b8[_0x534cd7]=0x0;});_0x72a9ac(_0x1ca8b8);return;});})[_0x9aa8('0x2c')](function(_0x3d943c){_0x463711(_0x3d943c);});});}function checkUserLimits(_0x3c048a){return new BPromise(function(_0x2e8a2d,_0x50755a){getLimits()['then'](function(_0x453ebc){var _0x3debca=_[_0x9aa8('0x2d')](_[_0x9aa8('0x2e')](_0x3c048a,_0x9aa8('0x22')),['admin',_0x9aa8('0x2a'),_0x9aa8('0x26')]);var _0x1def59=(_0x3debca[_0x9aa8('0x25')]||0x0)+(_0x3debca[_0x9aa8('0x2a')]||0x0);var _0x4c90ca=_0x3debca[_0x9aa8('0x26')]||0x0;if(_0x1def59>_0x453ebc['user'])return _0x50755a(_0x9aa8('0x2f'));if(_0x4c90ca>_0x453ebc[_0x9aa8('0x26')])return _0x50755a('License\x20limit\x20reached\x20for\x20telephones');return _0x2e8a2d();})[_0x9aa8('0x2c')](function(_0x10e8f9){_0x50755a(_0x10e8f9);});});}module[_0x9aa8('0x30')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x2646=['util','lodash','bluebird','./hardware','../../components/encryptor','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','License\x20key\x20value\x20not\x20found','split','decryptString','format','parse','demo','machineUuid','gray','add','days','changed','disabled','message','User','findAll','role','col','count','admin','user','telephone','telephones','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2646,0x1ec));var _0x6264=function(_0x4e7ae5,_0x407167){_0x4e7ae5=_0x4e7ae5-0x0;var _0x14d181=_0x2646[_0x4e7ae5];return _0x14d181;};'use strict';var util=require(_0x6264('0x0'));var _=require(_0x6264('0x1'));var moment=require('moment');var BPromise=require(_0x6264('0x2'));var hardware=require(_0x6264('0x3'));var encryptor=require(_0x6264('0x4'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x6264('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6264('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6264('0x7'),'machineUuid':hardware[_0x6264('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xbf3af7){return new BPromise(function(_0x3c26f5,_0x3606c5){return db[_0x6264('0x8')][_0x6264('0x9')](_[_0x6264('0xa')](_0xbf3af7,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x3778d7){return checkLicense(_0x3778d7,null);})[_0x6264('0xb')](function(_0x44f40a){_0x3c26f5(_0x44f40a);return;})[_0x6264('0xc')](function(_0xf7321a){_0x3606c5(_0xf7321a);});});}function checkLicense(_0x46e471,_0x5ad6e9){if(!_0x46e471){demoLicense[_0x6264('0xd')]=_0x46e471[_0x6264('0xe')];return demoLicense;}try{var _0x5acb47=_0x5ad6e9||_0x46e471[_0x6264('0xf')];if(_['isEmpty'](_0x5acb47)){throw new Error(_0x6264('0x10'));}var _0x53a617=_0x46e471[_0x6264('0xe')];var _0xb4c13e=_0x46e471['data2'];var _0x576f66=_0x53a617[_0x6264('0x11')]('-')[0x4];var _0x3a8df1=_0x53a617[_0x6264('0x11')]('-')[0x0];var _0x10d3be=encryptor[_0x6264('0x12')](_0x5acb47,util[_0x6264('0x13')]('%s:%s:%s',_0x576f66,_0x53a617,_0x3a8df1));var _0x1c45da=JSON[_0x6264('0x14')](_0x10d3be);_0x1c45da[_0x6264('0x15')]=![];_0x1c45da['uuid']=_0x53a617;_0x1c45da[_0x6264('0x16')]=hardware['getUuid']();if(_0xb4c13e){var _0x5dd0e1=encryptor[_0x6264('0x12')](_0xb4c13e);_0x1c45da[_0x6264('0x17')]=_0x5dd0e1;_0x1c45da['deadline']=moment(_0x5dd0e1)[_0x6264('0x18')](0x7,_0x6264('0x19'))[_0x6264('0x13')]();_0x1c45da['grayReason']=_0x1c45da[_0x6264('0xd')]!=_0x1c45da['machineUuid']?_0x6264('0x1a'):_0x6264('0x1b');}return _0x1c45da;}catch(_0x13ef1a){breakingLicense[_0x6264('0xd')]=_0x46e471[_0x6264('0xe')];breakingLicense[_0x6264('0x1c')]=_0x13ef1a[_0x6264('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xed1d13,_0x43745d){getLicense()[_0x6264('0xb')](function(_0x19604d){return db[_0x6264('0x1d')][_0x6264('0x1e')]({'attributes':[_0x6264('0x1f'),[db['sequelize']['fn']('COUNT',db['sequelize'][_0x6264('0x20')](_0x6264('0x1f'))),_0x6264('0x21')]],'group':_0x6264('0x1f'),'where':{'role':{'$or':[_0x6264('0x22'),_0x6264('0x23'),_0x6264('0x24')]}},'raw':!![]})[_0x6264('0xb')](function(_0x2ec4c5){var _0x5aab22={'user':_0x19604d['users']||0x0,'telephone':_0x19604d[_0x6264('0x25')]||0x0};_0x2ec4c5['forEach'](function(_0x4d7578){var _0x15f905=_0x4d7578[_0x6264('0x1f')]===_0x6264('0x22')?_0x6264('0x23'):_0x4d7578['role'];_0x5aab22[_0x15f905]-=_0x4d7578['count'];if(_0x5aab22[_0x15f905]<0x0)_0x5aab22[_0x15f905]=0x0;});_0xed1d13(_0x5aab22);return;});})[_0x6264('0xc')](function(_0x429e92){_0x43745d(_0x429e92);});});}function checkUserLimits(_0x3a2a5f){return new BPromise(function(_0x38723d,_0x5a34cd){getLimits()[_0x6264('0xb')](function(_0x2e26f2){var _0x4964a0=_['pick'](_[_0x6264('0x26')](_0x3a2a5f,_0x6264('0x1f')),[_0x6264('0x22'),_0x6264('0x23'),_0x6264('0x24')]);var _0x24539f=(_0x4964a0['admin']||0x0)+(_0x4964a0[_0x6264('0x23')]||0x0);var _0x2fa57b=_0x4964a0[_0x6264('0x24')]||0x0;if(_0x24539f>_0x2e26f2[_0x6264('0x23')])return _0x5a34cd(_0x6264('0x27'));if(_0x2fa57b>_0x2e26f2[_0x6264('0x24')])return _0x5a34cd(_0x6264('0x28'));return _0x38723d();})[_0x6264('0xc')](function(_0x465324){_0x5a34cd(_0x465324);});});}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 b22bb52..ae8bbb3 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 _0xd4f4=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x25c283,_0x25d720){var _0x4705e0=function(_0x5cf2b3){while(--_0x5cf2b3){_0x25c283['push'](_0x25c283['shift']());}};_0x4705e0(++_0x25d720);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x3834a8,_0x50d28c){_0x3834a8=_0x3834a8-0x0;var _0x3d4df3=_0xd4f4[_0x3834a8];return _0x3d4df3;};'use strict';module[_0x4d4f('0x0')]={'DOMAIN':_0x4d4f('0x1'),'SESSION_SECRET':_0x4d4f('0x2'),'GOOGLE_ID':_0x4d4f('0x3'),'GOOGLE_SECRET':_0x4d4f('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x1775=['myappanuglar-secret','app-id','secret','http://localhost:9000'];(function(_0x4e4e69,_0x2e743a){var _0x48df47=function(_0x1579de){while(--_0x1579de){_0x4e4e69['push'](_0x4e4e69['shift']());}};_0x48df47(++_0x2e743a);}(_0x1775,0x1db));var _0x5177=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1775[_0x17d9e3];return _0x14192d;};'use strict';module['exports']={'DOMAIN':_0x5177('0x0'),'SESSION_SECRET':_0x5177('0x1'),'GOOGLE_ID':_0x5177('0x2'),'GOOGLE_SECRET':_0x5177('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index ba85d48..6485d8e 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb6e2=['../utils/loggers','exports'];(function(_0x3d6aeb,_0xa62b5b){var _0x5b2452=function(_0x364ccc){while(--_0x364ccc){_0x3d6aeb['push'](_0x3d6aeb['shift']());}};_0x5b2452(++_0xa62b5b);}(_0xb6e2,0x19e));var _0x2b6e=function(_0x47795c,_0x5ca930){_0x47795c=_0x47795c-0x0;var _0x35b2a0=_0xb6e2[_0x47795c];return _0x35b2a0;};'use strict';var fileLogger=require(_0x2b6e('0x0'))['fileLogger'];module[_0x2b6e('0x1')]=fileLogger; \ No newline at end of file +var _0x32f1=['fileLogger','exports'];(function(_0xd8710d,_0x5eedba){var _0x1fe34c=function(_0x14d154){while(--_0x14d154){_0xd8710d['push'](_0xd8710d['shift']());}};_0x1fe34c(++_0x5eedba);}(_0x32f1,0x118));var _0x132f=function(_0x11cb7a,_0x558a73){_0x11cb7a=_0x11cb7a-0x0;var _0x1b47b8=_0x32f1[_0x11cb7a];return _0x1b47b8;};'use strict';var fileLogger=require('../utils/loggers')[_0x132f('0x0')];module[_0x132f('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 567dcc3..c5d3b36 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 _0x3419=['../../config/environment','resolve','join','root','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','exports','path'];(function(_0x54909d,_0x174828){var _0x62f26b=function(_0x2412c4){while(--_0x2412c4){_0x54909d['push'](_0x54909d['shift']());}};_0x62f26b(++_0x174828);}(_0x3419,0x87));var _0x9341=function(_0xa3e0f7,_0x1b06db){_0xa3e0f7=_0xa3e0f7-0x0;var _0x4ce604=_0x3419[_0xa3e0f7];return _0x4ce604;};'use strict';var path=require(_0x9341('0x0'));var cfg=require(_0x9341('0x1'));var env={'NODE_PATH':path[_0x9341('0x2')](path[_0x9341('0x3')](cfg[_0x9341('0x4')],'legacy-libs'))};var pm2config={'apps':[{'name':_0x9341('0x5'),'script':path[_0x9341('0x3')](__dirname,_0x9341('0x6')),'env':env},{'name':_0x9341('0x7'),'script':path[_0x9341('0x3')](__dirname,_0x9341('0x8')),'env':env},{'name':_0x9341('0x9'),'script':path[_0x9341('0x3')](__dirname,_0x9341('0xa')),'env':env},{'name':_0x9341('0xb'),'script':path[_0x9341('0x3')](__dirname,_0x9341('0xc')),'env':env},{'name':_0x9341('0xd'),'script':path[_0x9341('0x3')](__dirname,_0x9341('0xe')),'env':env},{'name':'xdr','script':path[_0x9341('0x3')](__dirname,_0x9341('0xf')),'env':env}]};module[_0x9341('0x10')]=pm2config; \ No newline at end of file +var _0xa4bd=['xdr','exports','path','../../config/environment','resolve','join','root','legacy-libs','ami','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js'];(function(_0x3c3d15,_0x2489a6){var _0x36da79=function(_0x45e828){while(--_0x45e828){_0x3c3d15['push'](_0x3c3d15['shift']());}};_0x36da79(++_0x2489a6);}(_0xa4bd,0x1af));var _0xda4b=function(_0x2585a6,_0x3cafa2){_0x2585a6=_0x2585a6-0x0;var _0x44d03e=_0xa4bd[_0x2585a6];return _0x44d03e;};'use strict';var path=require(_0xda4b('0x0'));var cfg=require(_0xda4b('0x1'));var env={'NODE_PATH':path[_0xda4b('0x2')](path[_0xda4b('0x3')](cfg[_0xda4b('0x4')],_0xda4b('0x5')))};var pm2config={'apps':[{'name':'express','script':path[_0xda4b('0x3')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0xda4b('0x6'),'script':path[_0xda4b('0x3')](__dirname,'../../services/ami/index.js'),'env':env},{'name':'agi','script':path[_0xda4b('0x3')](__dirname,_0xda4b('0x7')),'env':env},{'name':'email','script':path['join'](__dirname,_0xda4b('0x8')),'env':env},{'name':_0xda4b('0x9'),'script':path[_0xda4b('0x3')](__dirname,_0xda4b('0xa')),'env':env},{'name':_0xda4b('0xb'),'script':path[_0xda4b('0x3')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0xda4b('0xc')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index f5c2224..96953f8 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 _0x47bb=['./config','connect','connected','start','disconnect','stop','then','restart','list','describe','delete','dump','pm2','bluebird'];(function(_0x3667c4,_0x4b64bd){var _0x12a5a2=function(_0x1fb407){while(--_0x1fb407){_0x3667c4['push'](_0x3667c4['shift']());}};_0x12a5a2(++_0x4b64bd);}(_0x47bb,0xec));var _0xb47b=function(_0x5b3950,_0x4e5556){_0x5b3950=_0x5b3950-0x0;var _0x41e436=_0x47bb[_0x5b3950];return _0x41e436;};'use strict';var pm2=require(_0xb47b('0x0'));var BPromise=require(_0xb47b('0x1'));var config=require(_0xb47b('0x2'));function connect(){return new BPromise(function(_0x2b434f,_0x38976f){return pm2[_0xb47b('0x3')](function(_0x3e6897){if(_0x3e6897){return _0x38976f(_0x3e6897);}return _0x2b434f(_0xb47b('0x4'));});});};exports[_0xb47b('0x5')]=function(_0x53032b){return connect()['then'](function(){return new BPromise(function(_0x3cb73d,_0x3ddfe3){return pm2[_0xb47b('0x5')](_0x53032b,function(_0x3928a2,_0x4cb974){if(_0x3928a2){return _0x3ddfe3(_0x3928a2);}pm2[_0xb47b('0x6')]();return _0x3cb73d(_0x4cb974);});});});};exports[_0xb47b('0x7')]=function(_0x401fa3){return connect()[_0xb47b('0x8')](function(){return new BPromise(function(_0x4b31c1,_0x1fcb12){return pm2[_0xb47b('0x7')](_0x401fa3,function(_0x3484f8,_0x166d5a){if(_0x3484f8){return _0x1fcb12(_0x3484f8);}pm2[_0xb47b('0x6')]();return _0x4b31c1(_0x166d5a);});});});};exports[_0xb47b('0x9')]=function(_0xdf2d2e){return connect()['then'](function(){return new BPromise(function(_0x20d6cc,_0xc66583){return pm2[_0xb47b('0x9')](_0xdf2d2e,function(_0xb6b75,_0x4ce8e7){if(_0xb6b75){return _0xc66583(_0xb6b75);}pm2[_0xb47b('0x6')]();return _0x20d6cc(_0x4ce8e7);});});});};exports[_0xb47b('0xa')]=function(){return connect()[_0xb47b('0x8')](function(){return new BPromise(function(_0x2fe50d,_0x285b99){return pm2[_0xb47b('0xa')](function(_0x258b94,_0x392ffc){if(_0x258b94){return _0x285b99(_0x258b94);}pm2[_0xb47b('0x6')]();return _0x2fe50d(_0x392ffc);});});});};exports[_0xb47b('0xb')]=function(_0x298125){return connect()[_0xb47b('0x8')](function(){return new BPromise(function(_0x466be3,_0x12e7c1){return pm2[_0xb47b('0xb')](_0x298125,function(_0x1298b2,_0x24cb9f){if(_0x1298b2){return _0x12e7c1(_0x1298b2);}pm2[_0xb47b('0x6')]();return _0x466be3(_0x24cb9f);});});});};exports['delete']=function(_0x5e5987){return connect()[_0xb47b('0x8')](function(){return new BPromise(function(_0x1aab27,_0x5c5baf){return pm2[_0xb47b('0xc')](_0x5e5987,function(_0x1a92f6,_0x351361){if(_0x1a92f6){return _0x5c5baf(_0x1a92f6);}pm2[_0xb47b('0x6')]();return _0x1aab27(_0x351361);});});});};exports[_0xb47b('0xd')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3828b8,_0x5f0829){return pm2[_0xb47b('0xd')](function(_0x215e6e){if(_0x215e6e){return _0x5f0829(_0x215e6e);}return _0x3828b8('saved');});});});}; \ No newline at end of file +var _0x5897=['restart','describe','delete','dump','saved','pm2','bluebird','./config','connected','then','disconnect','stop'];(function(_0x591f2f,_0x1015d9){var _0x1ea2dd=function(_0x1e20a6){while(--_0x1e20a6){_0x591f2f['push'](_0x591f2f['shift']());}};_0x1ea2dd(++_0x1015d9);}(_0x5897,0x1d9));var _0x7589=function(_0x1d2bbb,_0x202267){_0x1d2bbb=_0x1d2bbb-0x0;var _0x38082b=_0x5897[_0x1d2bbb];return _0x38082b;};'use strict';var pm2=require(_0x7589('0x0'));var BPromise=require(_0x7589('0x1'));var config=require(_0x7589('0x2'));function connect(){return new BPromise(function(_0x5fe917,_0x57775c){return pm2['connect'](function(_0x512561){if(_0x512561){return _0x57775c(_0x512561);}return _0x5fe917(_0x7589('0x3'));});});};exports['start']=function(_0xb70805){return connect()[_0x7589('0x4')](function(){return new BPromise(function(_0x430e80,_0x1ce0fe){return pm2['start'](_0xb70805,function(_0x3a74ba,_0x2abd8d){if(_0x3a74ba){return _0x1ce0fe(_0x3a74ba);}pm2[_0x7589('0x5')]();return _0x430e80(_0x2abd8d);});});});};exports[_0x7589('0x6')]=function(_0x296f42){return connect()[_0x7589('0x4')](function(){return new BPromise(function(_0x1058bb,_0x1d5e37){return pm2[_0x7589('0x6')](_0x296f42,function(_0x4d1160,_0x24954f){if(_0x4d1160){return _0x1d5e37(_0x4d1160);}pm2[_0x7589('0x5')]();return _0x1058bb(_0x24954f);});});});};exports[_0x7589('0x7')]=function(_0x129cde){return connect()['then'](function(){return new BPromise(function(_0x32c351,_0x2b36dc){return pm2[_0x7589('0x7')](_0x129cde,function(_0x3bad2a,_0x5a5d33){if(_0x3bad2a){return _0x2b36dc(_0x3bad2a);}pm2[_0x7589('0x5')]();return _0x32c351(_0x5a5d33);});});});};exports['list']=function(){return connect()[_0x7589('0x4')](function(){return new BPromise(function(_0x172291,_0xd21084){return pm2['list'](function(_0x119871,_0x318db6){if(_0x119871){return _0xd21084(_0x119871);}pm2[_0x7589('0x5')]();return _0x172291(_0x318db6);});});});};exports[_0x7589('0x8')]=function(_0x36dc1a){return connect()['then'](function(){return new BPromise(function(_0x420494,_0x2faecb){return pm2[_0x7589('0x8')](_0x36dc1a,function(_0x35b554,_0x4e553a){if(_0x35b554){return _0x2faecb(_0x35b554);}pm2[_0x7589('0x5')]();return _0x420494(_0x4e553a);});});});};exports[_0x7589('0x9')]=function(_0x280d7b){return connect()[_0x7589('0x4')](function(){return new BPromise(function(_0x5af3d9,_0x3179cd){return pm2[_0x7589('0x9')](_0x280d7b,function(_0x197bd4,_0x37875b){if(_0x197bd4){return _0x3179cd(_0x197bd4);}pm2[_0x7589('0x5')]();return _0x5af3d9(_0x37875b);});});});};exports['dump']=function(){return connect()[_0x7589('0x4')](function(){return new BPromise(function(_0x32b569,_0x22d163){return pm2[_0x7589('0xa')](function(_0x2413e9){if(_0x2413e9){return _0x22d163(_0x2413e9);}return _0x32b569(_0x7589('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 260972e..5e06baa 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 _0x8198=['inspect','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','[CHAT]\x20Error\x20closing\x20interactions'];(function(_0x3537e1,_0x337645){var _0x343700=function(_0x560aaa){while(--_0x560aaa){_0x3537e1['push'](_0x3537e1['shift']());}};_0x343700(++_0x337645);}(_0x8198,0x12d));var _0x8819=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x8198[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require('lodash');var moment=require(_0x8819('0x0'));var Redis=require(_0x8819('0x1'));var util=require(_0x8819('0x2'));var config=require(_0x8819('0x3'));var db=require(_0x8819('0x4'))['db'];var logger=require('../logger')(_0x8819('0x5'));config[_0x8819('0x6')]=_[_0x8819('0x7')](config[_0x8819('0x6')],{'host':_0x8819('0x8'),'port':0x18eb});var io=require(_0x8819('0x9'))(new Redis(config[_0x8819('0x6')]));function closeInteractions(){var _0x1dc971=0x0;var _0x1f73e3=[];return db[_0x8819('0xa')][_0x8819('0xb')]({'raw':!![],'attributes':['id',_0x8819('0xc')],'where':{'id':0x1}})[_0x8819('0xd')](function(_0x5bf2e2){_0x1dc971=_0x5bf2e2[_0x8819('0xc')];if(_0x1dc971){return db[_0x8819('0xe')][_0x8819('0xf')]({'raw':!![],'attributes':['id',_0x8819('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x8819('0x11')](_0x5bf2e2['chatTimeout'],_0x8819('0x12'))}}});}else{return[];}})[_0x8819('0xd')](function(_0x903c67){if(_0x903c67&&_0x903c67[_0x8819('0x13')]){_0x1f73e3=_['map'](_0x903c67||[],'id');logger['info'](_0x8819('0x14'),_0x1f73e3[_0x8819('0x15')]());return db[_0x8819('0xe')][_0x8819('0x16')]({'closeReason':_0x8819('0x17'),'disposition':_0x8819('0x18'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x1f73e3}});}})['then'](function(){if(_0x1f73e3&&_0x1f73e3[_0x8819('0x13')]){logger['info'](_0x8819('0x19'),_0x1f73e3['join']());for(var _0x10cdd9=0x0;_0x10cdd9<_0x1f73e3[_0x8819('0x13')];_0x10cdd9++){io[_0x8819('0x1a')]('chatInteraction:update',{'id':_0x1f73e3[_0x10cdd9],'closed':!![]});}}})[_0x8819('0x1b')](function(_0x52ca0c){logger['error'](_0x8819('0x1c'),_0x52ca0c?util[_0x8819('0x1d')](_0x52ca0c,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x0ce7=['map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','redis','defaults','Setting','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ce7,0x196));var _0x70ce=function(_0x20ef61,_0x4218b8){_0x20ef61=_0x20ef61-0x0;var _0x15214f=_0x0ce7[_0x20ef61];return _0x15214f;};'use strict';var _=require(_0x70ce('0x0'));var moment=require(_0x70ce('0x1'));var Redis=require(_0x70ce('0x2'));var util=require(_0x70ce('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require('../logger')('schedule');config[_0x70ce('0x4')]=_[_0x70ce('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x277f29=0x0;var _0x2372ba=[];return db[_0x70ce('0x6')]['find']({'raw':!![],'attributes':['id',_0x70ce('0x7')],'where':{'id':0x1}})[_0x70ce('0x8')](function(_0x52c5c3){_0x277f29=_0x52c5c3[_0x70ce('0x7')];if(_0x277f29){return db[_0x70ce('0x9')][_0x70ce('0xa')]({'raw':!![],'attributes':['id',_0x70ce('0xb')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x70ce('0xc')](_0x52c5c3[_0x70ce('0x7')],'minutes')}}});}else{return[];}})[_0x70ce('0x8')](function(_0x190d15){if(_0x190d15&&_0x190d15[_0x70ce('0xd')]){_0x2372ba=_[_0x70ce('0xe')](_0x190d15||[],'id');logger[_0x70ce('0xf')](_0x70ce('0x10'),_0x2372ba[_0x70ce('0x11')]());return db[_0x70ce('0x9')][_0x70ce('0x12')]({'closeReason':_0x70ce('0x13'),'disposition':_0x70ce('0x14'),'closed':!![],'closedAt':moment()[_0x70ce('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x2372ba}});}})['then'](function(){if(_0x2372ba&&_0x2372ba[_0x70ce('0xd')]){logger['info'](_0x70ce('0x16'),_0x2372ba['join']());for(var _0x433403=0x0;_0x433403<_0x2372ba[_0x70ce('0xd')];_0x433403++){io[_0x70ce('0x17')](_0x70ce('0x18'),{'id':_0x2372ba[_0x433403],'closed':!![]});}}})[_0x70ce('0x19')](function(_0x30153e){logger[_0x70ce('0x1a')](_0x70ce('0x1b'),_0x30153e?util[_0x70ce('0x1c')](_0x30153e,{'showHidden':![],'depth':null}):'');});}exports[_0x70ce('0x1d')]=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 ee6c685..93d54a1 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 _0x6c4f=['startAllRefreshIntervals','exports'];(function(_0x520193,_0x3d8fdc){var _0x4d9d39=function(_0x233049){while(--_0x233049){_0x520193['push'](_0x520193['shift']());}};_0x4d9d39(++_0x3d8fdc);}(_0x6c4f,0x144));var _0xf6c4=function(_0x4ca88a,_0x399c51){_0x4ca88a=_0x4ca88a-0x0;var _0x489f3a=_0x6c4f[_0x4ca88a];return _0x489f3a;};'use strict';function start(){var _0x16df1a=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x16df1a[_0xf6c4('0x0')]();}module[_0xf6c4('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x7dfc=['startAllRefreshIntervals','exports'];(function(_0x4e6cbb,_0x3450f0){var _0x15ced4=function(_0x248dd2){while(--_0x248dd2){_0x4e6cbb['push'](_0x4e6cbb['shift']());}};_0x15ced4(++_0x3450f0);}(_0x7dfc,0x1dc));var _0xc7df=function(_0x2ce3d7,_0x201fd1){_0x2ce3d7=_0x2ce3d7-0x0;var _0x1cd258=_0x7dfc[_0x2ce3d7];return _0x1cd258;};'use strict';function start(){var _0x28c20b=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x28c20b[_0xc7df('0x0')]();}module[_0xc7df('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 98d21bd..bfa766c 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 _0xa938=['intersection','length','exists','deleteJob','delete\x20cron','resolve','cron','active','isBetween','startAt','endAt','add','add\x20cron','stop\x20cron','update\x20cron','start','path','moment','cron-job-manager','jayson/promise','../logger','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','number','AnalyticExtractedReport','findOne','then','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','name','email','bcc','subtractNumber','subtractUnit','join','../../files/reports','format','%s.%s','savename','extname','zip','status','Sent','message','text','stringify','existsSync','attachments','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','error','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','error\x20mail','email\x20sent','catch','currentAttempt','retryOptions','retries','operation','stop','still\x20loading','job','data','case\x20failed','Unrecognized\x20status:','attempt','dataValues','sendMail','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','Schedule','findAll','CloudProvider','keys','keyBy','toString','difference'];(function(_0x170125,_0x48efd0){var _0x418002=function(_0x29f624){while(--_0x29f624){_0x170125['push'](_0x170125['shift']());}};_0x418002(++_0x48efd0);}(_0xa938,0xe0));var _0x8a93=function(_0x232bdc,_0x2169b3){_0x232bdc=_0x232bdc-0x0;var _0x1437e5=_0xa938[_0x232bdc];return _0x1437e5;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x8a93('0x0'));var _=require('lodash');var moment=require(_0x8a93('0x1'));var CronJobManager=require(_0x8a93('0x2'));var jayson=require(_0x8a93('0x3'));var BPromise=require('bluebird');var logger=require(_0x8a93('0x4'))('schedule');var db=require(_0x8a93('0x5'))['db'];const retry=require(_0x8a93('0x6'));var analyticCustomReportController=require(_0x8a93('0x7'));var analyticDefaultReportController=require(_0x8a93('0x8'));var client=jayson[_0x8a93('0x9')][_0x8a93('0xa')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x2d1868){const _0x34265c={};if(typeof _0x2d1868===_0x8a93('0xb')){_0x34265c['id']=_0x2d1868;}return db[_0x8a93('0xc')][_0x8a93('0xd')]({'where':_0x34265c})[_0x8a93('0xe')](function(_0x19ba0f){return _0x19ba0f;})['catch'](function(_0x3b40b0){logger['error'](_0x3b40b0);});}function handleSendEmail(_0x2c4cfd,_0x3da158){logger[_0x8a93('0xf')](_0x8a93('0x10'),_0x2c4cfd['email']);var _0x247039=!![];var _0x125ad7=_0x2c4cfd[_0x8a93('0x11')][_0x8a93('0x12')]();var _0x5e1b22={'account':_0x125ad7,'message':{'from':util['format'](_0x8a93('0x13'),_0x2c4cfd['MailAccount'][_0x8a93('0x14')],_0x2c4cfd['MailAccount'][_0x8a93('0x15')]||_0x2c4cfd[_0x8a93('0x11')]['Smtp']['user']),'to':_0x2c4cfd[_0x8a93('0x15')],'cc':_0x2c4cfd['cc'],'bcc':_0x2c4cfd[_0x8a93('0x16')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x3da158['name'],_0x2c4cfd[_0x8a93('0x17')],_0x2c4cfd[_0x8a93('0x18')])}};var _0x271d3b=path[_0x8a93('0x19')](__dirname,_0x8a93('0x1a'));var _0x3f86e3=_0x3da158['savename'];var _0x1cb1c7=util[_0x8a93('0x1b')](_0x8a93('0x1c'),path['basename'](_0x3da158[_0x8a93('0x1d')],path[_0x8a93('0x1e')](_0x3da158['savename'])),_0x8a93('0x1f'));var _0x5ec8e2=path[_0x8a93('0x19')](_0x271d3b,_0x3f86e3);var _0x34721a=path['join'](_0x271d3b,_0x1cb1c7);if(fs['existsSync'](_0x5ec8e2)){_0x3da158[_0x8a93('0x20')]=_0x8a93('0x21');_0x5e1b22[_0x8a93('0x22')]['attachments']=[{'filename':_0x3f86e3,'path':_0x5ec8e2}];_0x5e1b22['message'][_0x8a93('0x23')]=util[_0x8a93('0x1b')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x8a93('0x24')](_0x3da158,null,0x2));}else if(fs[_0x8a93('0x25')](_0x34721a)){_0x3da158['status']=_0x8a93('0x21');_0x5e1b22['message'][_0x8a93('0x26')]=[{'filename':_0x1cb1c7,'path':_0x34721a}];}else{if(_0x3da158[_0x8a93('0x20')]===_0x8a93('0x27')){_0x5e1b22[_0x8a93('0x22')][_0x8a93('0x23')]=_0x8a93('0x28');if(!_0x2c4cfd[_0x8a93('0x29')]){_0x247039=![];logger[_0x8a93('0xf')](_0x8a93('0x2a'));}}else if(_0x3da158[_0x8a93('0x20')]===_0x8a93('0x2b')){_0x5e1b22[_0x8a93('0x22')][_0x8a93('0x23')]=_0x8a93('0x2c');}else if(_0x3da158['status']===_0x8a93('0x2d')){_0x5e1b22[_0x8a93('0x22')]['text']=_0x8a93('0x2e');}else if(_0x3da158[_0x8a93('0x20')]===_0x8a93('0x2f')){_0x5e1b22[_0x8a93('0x22')][_0x8a93('0x23')]=_0x8a93('0x30');}else{logger[_0x8a93('0x31')](_0x8a93('0x32'),_0x3da158[_0x8a93('0x20')]);}}if(_0x247039){return client[_0x8a93('0x33')](_0x8a93('0x34'),_0x5e1b22)['then'](function(_0x5eaad7){if(_0x5eaad7[_0x8a93('0x31')]){return logger[_0x8a93('0x31')](_0x8a93('0x35'),JSON[_0x8a93('0x24')](_0x5eaad7));}return logger[_0x8a93('0xf')](_0x8a93('0x36'));})[_0x8a93('0x37')](function(_0x1e6bda){return logger[_0x8a93('0x31')]('error\x20mail',JSON[_0x8a93('0x24')](_0x1e6bda));});}}function handleError(){return function(_0x255526){return logger[_0x8a93('0x31')](JSON['stringify'](_0x255526));};}function loading(_0x7ecff7){logger['info']('case\x20loading');if(_0x7ecff7[_0x8a93('0x38')]===_0x7ecff7[_0x8a93('0x39')][_0x8a93('0x3a')]){handleSendEmail(_0x7ecff7['job'],_0x7ecff7['data']);_0x7ecff7[_0x8a93('0x3b')][_0x8a93('0x3c')]();}else{_0x7ecff7[_0x8a93('0x3b')][_0x8a93('0x6')](_0x8a93('0x3d'));}}function completed(_0x3f76c2){logger[_0x8a93('0xf')]('case\x20completed');handleSendEmail(_0x3f76c2[_0x8a93('0x3e')],_0x3f76c2['data']);_0x3f76c2[_0x8a93('0x3b')][_0x8a93('0x3c')]();}function empty(_0xf75fbf){logger[_0x8a93('0xf')]('case\x20empty');handleSendEmail(_0xf75fbf[_0x8a93('0x3e')],_0xf75fbf[_0x8a93('0x3f')]);_0xf75fbf[_0x8a93('0x3b')][_0x8a93('0x3c')]();}function failed(_0x30a7d8){logger[_0x8a93('0xf')](_0x8a93('0x40'));handleSendEmail(_0x30a7d8[_0x8a93('0x3e')],_0x30a7d8['data']);_0x30a7d8[_0x8a93('0x3b')][_0x8a93('0x3c')]();}function urecognized(_0x107943){logger['error'](_0x8a93('0x41'),_0x107943['entity']['dataValues'][_0x8a93('0x20')]);_0x107943['operation'][_0x8a93('0x3c')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x412d78,_0x37204b){const _0x1bf51b={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x1146ee=retry['operation'](_0x1bf51b);_0x1146ee[_0x8a93('0x42')](_0x2c06ea=>{logger[_0x8a93('0xf')]('Job\x20ID\x20'+_0x412d78['id']+'\x20Attempt\x20#:'+_0x2c06ea);try{getReportData(_0x37204b['id'])['then'](function(_0x2e59aa){_0x37204b=_0x2e59aa;logger[_0x8a93('0xf')]('report\x20status:',_0x2e59aa[_0x8a93('0x43')][_0x8a93('0x20')]);if(!reportStatusStrategies[_0x2e59aa[_0x8a93('0x43')][_0x8a93('0x20')]]){logger[_0x8a93('0x31')]('report\x20status:',_0x2e59aa[_0x8a93('0x43')]['status']);_0x1146ee[_0x8a93('0x6')]();}reportStatusStrategies[_0x2e59aa[_0x8a93('0x43')]['status']]({'operation':_0x1146ee,'currentAttempt':_0x2c06ea,'retryOptions':_0x1bf51b,'job':_0x412d78,'data':_0x37204b,'entity':_0x2e59aa});});}catch(_0x3144d9){_0x1146ee[_0x8a93('0x6')](_0x3144d9);}});}function handleResult(_0x1eb7fc){return function(_0x2db3ea){if(_0x1eb7fc[_0x8a93('0x44')]&&_0x1eb7fc[_0x8a93('0x11')]&&_0x1eb7fc[_0x8a93('0x11')][_0x8a93('0x45')]&&!_[_0x8a93('0x46')](_0x1eb7fc[_0x8a93('0x15')])){retryer(_0x1eb7fc,_0x2db3ea);}};}function handleJob(_0x47c81e){return function(){try{if(_[_0x8a93('0x46')](_0x47c81e[_0x8a93('0x17')])){return logger[_0x8a93('0xf')](_0x8a93('0x47'));}if(_['isNil'](_0x47c81e[_0x8a93('0x18')])){return logger[_0x8a93('0xf')](_0x8a93('0x48'));}var _0x2f8b24={'startDate':moment()[_0x8a93('0x49')](_0x47c81e[_0x8a93('0x17')],_0x47c81e[_0x8a93('0x18')])[_0x8a93('0x1b')](_0x8a93('0x4a')),'endDate':moment()['format'](_0x8a93('0x4a')),'type':_0x8a93('0x4b'),'output':_0x47c81e[_0x8a93('0x4c')],'name':_0x47c81e[_0x8a93('0x14')]};if(!_[_0x8a93('0x46')](_0x47c81e['DefaultReportId'])){logger['info'](_0x8a93('0x4d'),_0x47c81e[_0x8a93('0x4e')]);return analyticDefaultReportController[_0x8a93('0x4f')]({'id':_0x47c81e[_0x8a93('0x4e')]},_0x2f8b24)['then'](handleResult(_0x47c81e))['catch'](handleError());}if(!_[_0x8a93('0x46')](_0x47c81e[_0x8a93('0x50')])){logger[_0x8a93('0xf')]('exec\x20custom\x20report\x20id:%s',_0x47c81e[_0x8a93('0x50')]);return analyticCustomReportController[_0x8a93('0x4f')]({'id':_0x47c81e[_0x8a93('0x50')]},_0x2f8b24)[_0x8a93('0xe')](handleResult(_0x47c81e))[_0x8a93('0x37')](handleError());}}catch(_0x1e0cf6){logger[_0x8a93('0x31')](JSON[_0x8a93('0x24')](_0x1e0cf6));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x54d0ec){var _0x5ab170={};if(_0x54d0ec){_0x5ab170['id']=_0x54d0ec;}return db[_0x8a93('0x51')][_0x8a93('0x52')]({'where':_0x5ab170,'include':[{'model':db[_0x8a93('0x11')],'attributes':['id','name','email'],'include':[{'model':db['MailServerOut'],'as':_0x8a93('0x45'),'include':[{'model':db[_0x8a93('0x53')],'as':_0x8a93('0x53')}]}]}]})[_0x8a93('0xe')](function(_0x424520){var _0x3bd9f9=_[_0x8a93('0x54')](manager['jobs']);var _0xd8617b=_['map'](_0x424520,function(_0x513619){return _0x513619['id']['toString']();});var _0x421994=_[_0x8a93('0x55')](_0x424520,function(_0x7cecad){return _0x7cecad['id'][_0x8a93('0x56')]();});var _0x2057e3=_0x54d0ec?_0xd8617b:_[_0x8a93('0x57')](_0xd8617b,_0x3bd9f9);var _0x2f2bf2=_[_0x8a93('0x58')](_0xd8617b,_0x3bd9f9);var _0x5d043d=_[_0x8a93('0x57')](_0x3bd9f9,_0xd8617b);var _0x4bd89d;var _0x18a5e7;for(_0x4bd89d=0x0;_0x4bd89d<_0x5d043d[_0x8a93('0x59')]&&!_0x54d0ec;_0x4bd89d+=0x1){_0x18a5e7=_0x5d043d[_0x4bd89d]['toString']();if(manager[_0x8a93('0x5a')](_0x18a5e7)){manager['stop'](_0x18a5e7);manager[_0x8a93('0x5b')](_0x18a5e7);logger[_0x8a93('0xf')](_0x8a93('0x5c'),_0x18a5e7);}}logger[_0x8a93('0xf')]('toRun',JSON[_0x8a93('0x24')](_0x2057e3));for(_0x4bd89d=0x0;_0x4bd89d<_0x2057e3['length'];_0x4bd89d+=0x1){_0x18a5e7=_0x2057e3[_0x4bd89d][_0x8a93('0x56')]();if(_0x54d0ec){logger[_0x8a93('0xf')](JSON['stringify'](_0x421994[_0x18a5e7]));BPromise[_0x8a93('0x5d')]()[_0x8a93('0xe')](handleJob(_0x421994[_0x18a5e7]));logger['info']('run\x20job',_0x421994[_0x18a5e7][_0x8a93('0x14')],_0x421994[_0x18a5e7][_0x8a93('0x5e')]);}else if(_0x421994[_0x18a5e7][_0x8a93('0x5e')]&&_0x421994[_0x18a5e7][_0x8a93('0x5f')]&&moment()[_0x8a93('0x60')](_0x421994[_0x18a5e7][_0x8a93('0x61')],_0x421994[_0x18a5e7][_0x8a93('0x62')])){manager[_0x8a93('0x63')](_0x18a5e7,_0x421994[_0x18a5e7][_0x8a93('0x5e')],handleJob(_0x421994[_0x18a5e7]));manager['start'](_0x18a5e7);logger[_0x8a93('0xf')](_0x8a93('0x64'),_0x421994[_0x18a5e7][_0x8a93('0x14')],_0x421994[_0x18a5e7][_0x8a93('0x5e')]);}else if(manager['exists'](_0x18a5e7)){manager['stop'](_0x18a5e7);manager[_0x8a93('0x5b')](_0x18a5e7);logger[_0x8a93('0xf')](_0x8a93('0x65'),_0x421994[_0x18a5e7][_0x8a93('0x14')],_0x421994[_0x18a5e7][_0x8a93('0x5e')]);}}for(_0x4bd89d=0x0,_0x18a5e7;_0x4bd89d<_0x2f2bf2['length']&&!_0x54d0ec;_0x4bd89d+=0x1){_0x18a5e7=_0x2f2bf2[_0x4bd89d][_0x8a93('0x56')]();if(manager['exists'](_0x18a5e7)){if(_0x421994[_0x18a5e7][_0x8a93('0x5e')]&&_0x421994[_0x18a5e7][_0x8a93('0x5f')]&&moment()[_0x8a93('0x60')](_0x421994[_0x18a5e7][_0x8a93('0x61')],_0x421994[_0x18a5e7]['endAt'])){manager['update'](_0x18a5e7,_0x421994[_0x18a5e7]['cron'],handleJob(_0x421994[_0x18a5e7]));logger[_0x8a93('0xf')](_0x8a93('0x66'),_0x421994[_0x18a5e7][_0x8a93('0x14')],_0x421994[_0x18a5e7]['cron']);}else{manager[_0x8a93('0x3c')](_0x18a5e7);manager[_0x8a93('0x5b')](_0x18a5e7);logger[_0x8a93('0xf')](_0x8a93('0x65'),_0x421994[_0x18a5e7][_0x8a93('0x14')],_0x421994[_0x18a5e7]['cron']);}}}})['catch'](function(_0x4da067){logger[_0x8a93('0x31')](JSON['stringify'](_0x4da067));});}exports['run']=function(_0x4adfcf){return getJobs(_0x4adfcf);};exports[_0x8a93('0x67')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x0579=['dataValues','attempt','\x20Attempt\x20#:','report\x20status:','sendMail','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','resolve','run\x20job','cron','isBetween','startAt','endAt','add','start','add\x20cron','update','stop\x20cron','run','util','path','moment','cron-job-manager','jayson/promise','../logger','retry','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','AnalyticExtractedReport','findOne','then','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','savename','format','%s.%s','basename','join','existsSync','Sent','attachments','stringify','status','message','Empty','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','SendMail','error\x20mail','email\x20sent','currentAttempt','retryOptions','retries','job','data','operation','stop','still\x20loading','case\x20completed','case\x20empty','case\x20failed','Unrecognized\x20status:','entity'];(function(_0x343bed,_0x5d3953){var _0x3c8277=function(_0x4cb081){while(--_0x4cb081){_0x343bed['push'](_0x343bed['shift']());}};_0x3c8277(++_0x5d3953);}(_0x0579,0x16f));var _0x9057=function(_0xe5347,_0x40c131){_0xe5347=_0xe5347-0x0;var _0xa41f59=_0x0579[_0xe5347];return _0xa41f59;};'use strict';var fs=require('fs');var util=require(_0x9057('0x0'));var path=require(_0x9057('0x1'));var _=require('lodash');var moment=require(_0x9057('0x2'));var CronJobManager=require(_0x9057('0x3'));var jayson=require(_0x9057('0x4'));var BPromise=require('bluebird');var logger=require(_0x9057('0x5'))('schedule');var db=require('../../mysqldb')['db'];const retry=require(_0x9057('0x6'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x9057('0x7'));var client=jayson[_0x9057('0x8')][_0x9057('0x9')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x29cbfd){const _0x8cb4ab={};if(typeof _0x29cbfd==='number'){_0x8cb4ab['id']=_0x29cbfd;}return db[_0x9057('0xa')][_0x9057('0xb')]({'where':_0x8cb4ab})[_0x9057('0xc')](function(_0x447442){return _0x447442;})[_0x9057('0xd')](function(_0x282abf){logger[_0x9057('0xe')](_0x282abf);});}function handleSendEmail(_0x1bc6ad,_0x19a50c){logger[_0x9057('0xf')](_0x9057('0x10'),_0x1bc6ad[_0x9057('0x11')]);var _0x52175b=!![];var _0x38b131=_0x1bc6ad[_0x9057('0x12')][_0x9057('0x13')]();var _0x147405={'account':_0x38b131,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x1bc6ad[_0x9057('0x12')][_0x9057('0x14')],_0x1bc6ad[_0x9057('0x12')]['email']||_0x1bc6ad[_0x9057('0x12')]['Smtp']['user']),'to':_0x1bc6ad[_0x9057('0x11')],'cc':_0x1bc6ad['cc'],'bcc':_0x1bc6ad[_0x9057('0x15')],'subject':util['format'](_0x9057('0x16'),_0x19a50c['name'],_0x1bc6ad[_0x9057('0x17')],_0x1bc6ad['subtractUnit'])}};var _0x26a165=path['join'](__dirname,'../../files/reports');var _0xdbb64a=_0x19a50c[_0x9057('0x18')];var _0x4dd5e2=util[_0x9057('0x19')](_0x9057('0x1a'),path[_0x9057('0x1b')](_0x19a50c[_0x9057('0x18')],path['extname'](_0x19a50c[_0x9057('0x18')])),'zip');var _0x2c1c20=path[_0x9057('0x1c')](_0x26a165,_0xdbb64a);var _0x4e33d4=path[_0x9057('0x1c')](_0x26a165,_0x4dd5e2);if(fs[_0x9057('0x1d')](_0x2c1c20)){_0x19a50c['status']=_0x9057('0x1e');_0x147405['message'][_0x9057('0x1f')]=[{'filename':_0xdbb64a,'path':_0x2c1c20}];_0x147405['message']['text']=util[_0x9057('0x19')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x9057('0x20')](_0x19a50c,null,0x2));}else if(fs[_0x9057('0x1d')](_0x4e33d4)){_0x19a50c[_0x9057('0x21')]=_0x9057('0x1e');_0x147405[_0x9057('0x22')][_0x9057('0x1f')]=[{'filename':_0x4dd5e2,'path':_0x4e33d4}];}else{if(_0x19a50c[_0x9057('0x21')]===_0x9057('0x23')){_0x147405[_0x9057('0x22')][_0x9057('0x24')]=_0x9057('0x25');if(!_0x1bc6ad[_0x9057('0x26')]){_0x52175b=![];logger[_0x9057('0xf')](_0x9057('0x27'));}}else if(_0x19a50c[_0x9057('0x21')]==='Loading'){_0x147405['message'][_0x9057('0x24')]=_0x9057('0x28');}else if(_0x19a50c[_0x9057('0x21')]===_0x9057('0x29')){_0x147405[_0x9057('0x22')][_0x9057('0x24')]=_0x9057('0x2a');}else if(_0x19a50c[_0x9057('0x21')]===_0x9057('0x2b')){_0x147405[_0x9057('0x22')][_0x9057('0x24')]=_0x9057('0x2c');}else{logger['error']('[handleSendEmail]\x20Unrecognized\x20status:',_0x19a50c[_0x9057('0x21')]);}}if(_0x52175b){return client['request'](_0x9057('0x2d'),_0x147405)[_0x9057('0xc')](function(_0x5316f5){if(_0x5316f5[_0x9057('0xe')]){return logger['error'](_0x9057('0x2e'),JSON['stringify'](_0x5316f5));}return logger['info'](_0x9057('0x2f'));})[_0x9057('0xd')](function(_0x1efbec){return logger[_0x9057('0xe')]('error\x20mail',JSON[_0x9057('0x20')](_0x1efbec));});}}function handleError(){return function(_0xbaeb81){return logger[_0x9057('0xe')](JSON['stringify'](_0xbaeb81));};}function loading(_0x2336b4){logger[_0x9057('0xf')]('case\x20loading');if(_0x2336b4[_0x9057('0x30')]===_0x2336b4[_0x9057('0x31')][_0x9057('0x32')]){handleSendEmail(_0x2336b4[_0x9057('0x33')],_0x2336b4[_0x9057('0x34')]);_0x2336b4[_0x9057('0x35')][_0x9057('0x36')]();}else{_0x2336b4['operation'][_0x9057('0x6')](_0x9057('0x37'));}}function completed(_0x584b08){logger['info'](_0x9057('0x38'));handleSendEmail(_0x584b08[_0x9057('0x33')],_0x584b08[_0x9057('0x34')]);_0x584b08['operation'][_0x9057('0x36')]();}function empty(_0x3f19c7){logger[_0x9057('0xf')](_0x9057('0x39'));handleSendEmail(_0x3f19c7[_0x9057('0x33')],_0x3f19c7[_0x9057('0x34')]);_0x3f19c7[_0x9057('0x35')][_0x9057('0x36')]();}function failed(_0x31e9c6){logger['info'](_0x9057('0x3a'));handleSendEmail(_0x31e9c6[_0x9057('0x33')],_0x31e9c6[_0x9057('0x34')]);_0x31e9c6[_0x9057('0x35')]['stop']();}function urecognized(_0x1950eb){logger[_0x9057('0xe')](_0x9057('0x3b'),_0x1950eb[_0x9057('0x3c')][_0x9057('0x3d')][_0x9057('0x21')]);_0x1950eb['operation'][_0x9057('0x36')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x1defc0,_0x4eeef5){const _0x409e51={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x1542c4=retry[_0x9057('0x35')](_0x409e51);_0x1542c4[_0x9057('0x3e')](_0x3356ce=>{logger[_0x9057('0xf')]('Job\x20ID\x20'+_0x1defc0['id']+_0x9057('0x3f')+_0x3356ce);try{getReportData(_0x4eeef5['id'])['then'](function(_0x36e0f0){_0x4eeef5=_0x36e0f0;logger[_0x9057('0xf')](_0x9057('0x40'),_0x36e0f0[_0x9057('0x3d')]['status']);if(!reportStatusStrategies[_0x36e0f0[_0x9057('0x3d')]['status']]){logger[_0x9057('0xe')]('report\x20status:',_0x36e0f0[_0x9057('0x3d')][_0x9057('0x21')]);_0x1542c4[_0x9057('0x6')]();}reportStatusStrategies[_0x36e0f0[_0x9057('0x3d')][_0x9057('0x21')]]({'operation':_0x1542c4,'currentAttempt':_0x3356ce,'retryOptions':_0x409e51,'job':_0x1defc0,'data':_0x4eeef5,'entity':_0x36e0f0});});}catch(_0x3b6234){_0x1542c4['retry'](_0x3b6234);}});}function handleResult(_0x2d8fac){return function(_0x3aa0b8){if(_0x2d8fac[_0x9057('0x41')]&&_0x2d8fac[_0x9057('0x12')]&&_0x2d8fac[_0x9057('0x12')][_0x9057('0x42')]&&!_[_0x9057('0x43')](_0x2d8fac[_0x9057('0x11')])){retryer(_0x2d8fac,_0x3aa0b8);}};}function handleJob(_0xe16e63){return function(){try{if(_[_0x9057('0x43')](_0xe16e63['subtractNumber'])){return logger[_0x9057('0xf')](_0x9057('0x44'));}if(_[_0x9057('0x43')](_0xe16e63[_0x9057('0x45')])){return logger[_0x9057('0xf')](_0x9057('0x46'));}var _0xce23dd={'startDate':moment()[_0x9057('0x47')](_0xe16e63['subtractNumber'],_0xe16e63[_0x9057('0x45')])[_0x9057('0x19')](_0x9057('0x48')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0xe16e63[_0x9057('0x49')],'name':_0xe16e63[_0x9057('0x14')]};if(!_[_0x9057('0x43')](_0xe16e63['DefaultReportId'])){logger[_0x9057('0xf')](_0x9057('0x4a'),_0xe16e63[_0x9057('0x4b')]);return analyticDefaultReportController[_0x9057('0x4c')]({'id':_0xe16e63['DefaultReportId']},_0xce23dd)[_0x9057('0xc')](handleResult(_0xe16e63))[_0x9057('0xd')](handleError());}if(!_['isNil'](_0xe16e63['CustomReportId'])){logger[_0x9057('0xf')](_0x9057('0x4d'),_0xe16e63[_0x9057('0x4e')]);return analyticCustomReportController['runReport']({'id':_0xe16e63['CustomReportId']},_0xce23dd)['then'](handleResult(_0xe16e63))[_0x9057('0xd')](handleError());}}catch(_0x43ef3b){logger[_0x9057('0xe')](JSON[_0x9057('0x20')](_0x43ef3b));}return logger[_0x9057('0xf')](_0x9057('0x4f'));};}function getJobs(_0x50de59){var _0x46b3db={};if(_0x50de59){_0x46b3db['id']=_0x50de59;}return db[_0x9057('0x50')]['findAll']({'where':_0x46b3db,'include':[{'model':db[_0x9057('0x12')],'attributes':['id',_0x9057('0x14'),'email'],'include':[{'model':db[_0x9057('0x51')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0x9057('0x52')}]}]}]})[_0x9057('0xc')](function(_0x1e622e){var _0x479380=_[_0x9057('0x53')](manager[_0x9057('0x54')]);var _0x3bfe1a=_[_0x9057('0x55')](_0x1e622e,function(_0x42d166){return _0x42d166['id'][_0x9057('0x56')]();});var _0x290316=_[_0x9057('0x57')](_0x1e622e,function(_0x425d2d){return _0x425d2d['id'][_0x9057('0x56')]();});var _0x57df37=_0x50de59?_0x3bfe1a:_[_0x9057('0x58')](_0x3bfe1a,_0x479380);var _0x4e21af=_[_0x9057('0x59')](_0x3bfe1a,_0x479380);var _0xe9e855=_[_0x9057('0x58')](_0x479380,_0x3bfe1a);var _0x56e8d8;var _0x208ae4;for(_0x56e8d8=0x0;_0x56e8d8<_0xe9e855[_0x9057('0x5a')]&&!_0x50de59;_0x56e8d8+=0x1){_0x208ae4=_0xe9e855[_0x56e8d8][_0x9057('0x56')]();if(manager[_0x9057('0x5b')](_0x208ae4)){manager['stop'](_0x208ae4);manager[_0x9057('0x5c')](_0x208ae4);logger[_0x9057('0xf')](_0x9057('0x5d'),_0x208ae4);}}logger['info'](_0x9057('0x5e'),JSON[_0x9057('0x20')](_0x57df37));for(_0x56e8d8=0x0;_0x56e8d8<_0x57df37[_0x9057('0x5a')];_0x56e8d8+=0x1){_0x208ae4=_0x57df37[_0x56e8d8][_0x9057('0x56')]();if(_0x50de59){logger[_0x9057('0xf')](JSON[_0x9057('0x20')](_0x290316[_0x208ae4]));BPromise[_0x9057('0x5f')]()[_0x9057('0xc')](handleJob(_0x290316[_0x208ae4]));logger[_0x9057('0xf')](_0x9057('0x60'),_0x290316[_0x208ae4][_0x9057('0x14')],_0x290316[_0x208ae4][_0x9057('0x61')]);}else if(_0x290316[_0x208ae4][_0x9057('0x61')]&&_0x290316[_0x208ae4]['active']&&moment()[_0x9057('0x62')](_0x290316[_0x208ae4][_0x9057('0x63')],_0x290316[_0x208ae4][_0x9057('0x64')])){manager[_0x9057('0x65')](_0x208ae4,_0x290316[_0x208ae4]['cron'],handleJob(_0x290316[_0x208ae4]));manager[_0x9057('0x66')](_0x208ae4);logger[_0x9057('0xf')](_0x9057('0x67'),_0x290316[_0x208ae4][_0x9057('0x14')],_0x290316[_0x208ae4]['cron']);}else if(manager[_0x9057('0x5b')](_0x208ae4)){manager[_0x9057('0x36')](_0x208ae4);manager['deleteJob'](_0x208ae4);logger[_0x9057('0xf')]('stop\x20cron',_0x290316[_0x208ae4][_0x9057('0x14')],_0x290316[_0x208ae4][_0x9057('0x61')]);}}for(_0x56e8d8=0x0,_0x208ae4;_0x56e8d8<_0x4e21af[_0x9057('0x5a')]&&!_0x50de59;_0x56e8d8+=0x1){_0x208ae4=_0x4e21af[_0x56e8d8][_0x9057('0x56')]();if(manager[_0x9057('0x5b')](_0x208ae4)){if(_0x290316[_0x208ae4][_0x9057('0x61')]&&_0x290316[_0x208ae4]['active']&&moment()['isBetween'](_0x290316[_0x208ae4][_0x9057('0x63')],_0x290316[_0x208ae4]['endAt'])){manager[_0x9057('0x68')](_0x208ae4,_0x290316[_0x208ae4][_0x9057('0x61')],handleJob(_0x290316[_0x208ae4]));logger[_0x9057('0xf')]('update\x20cron',_0x290316[_0x208ae4][_0x9057('0x14')],_0x290316[_0x208ae4][_0x9057('0x61')]);}else{manager[_0x9057('0x36')](_0x208ae4);manager[_0x9057('0x5c')](_0x208ae4);logger['info'](_0x9057('0x69'),_0x290316[_0x208ae4][_0x9057('0x14')],_0x290316[_0x208ae4][_0x9057('0x61')]);}}}})[_0x9057('0xd')](function(_0x692282){logger[_0x9057('0xe')](JSON[_0x9057('0x20')](_0x692282));});}exports[_0x9057('0x6a')]=function(_0x4889c5){return getJobs(_0x4889c5);};exports[_0x9057('0x66')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 0f77c8e..5f06263 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 _0xab26=['lodash','aws-sdk','request-promise','bluebird','../../mysqldb','TranscribeService','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','transcript','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','findOne','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','tempSentiment','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Neutral','name','error','VoiceRecording','IN_PROGRESS','length','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','transcribeRegion','forEach','push','all','catch','SequelizeValidationError','inspect'];(function(_0x4e6558,_0x417981){var _0x595c71=function(_0x46b1c6){while(--_0x46b1c6){_0x4e6558['push'](_0x4e6558['shift']());}};_0x595c71(++_0x417981);}(_0xab26,0xd2));var _0x6ab2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xab26[_0x20a584];return _0x4b41a8;};var _=require(_0x6ab2('0x0'));var AWS=require(_0x6ab2('0x1'));var rp=require(_0x6ab2('0x2'));var util=require('util');var BPromise=require(_0x6ab2('0x3'));var db=require(_0x6ab2('0x4'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x4c8cf,_0x51bdcd,_0x332458,_0xb15094){return new Promise(function(_0x31c9f1,_0x56dc80){var _0x41643a=new AWS[(_0x6ab2('0x5'))]({'accessKeyId':_0x51bdcd,'secretAccessKey':_0x4c8cf,'region':_0x332458});_0x41643a['getTranscriptionJob']({'TranscriptionJobName':_0xb15094},function(_0x140cc1,_0x3157f1){if(_0x140cc1){return _0x56dc80(_0x140cc1);}else{return _0x31c9f1(_0x3157f1);}});});}function sentiment(_0x442ae2,_0xf9b141,_0x3bb68b,_0x3964fd,_0x217b42){return new Promise(function(_0x448216,_0x459538){var _0x2e765a=new AWS[(_0x6ab2('0x6'))]({'accessKeyId':_0xf9b141,'secretAccessKey':_0x442ae2,'region':_0x3bb68b});_0x2e765a['detectSentiment']({'Text':_0x3964fd,'LanguageCode':_0x217b42[_0x6ab2('0x7')](0x0,0x2)},function(_0x2db481,_0x3c4612){if(_0x2db481){return _0x459538(_0x2db481);}else{return _0x448216(_0x3c4612);}});});}function checkTranscribeJob(_0x5b7e6d,_0x5b6f7c,_0x10c3b1){var _0x2bb464;return new BPromise(function(_0x431d63,_0x8d1dc8){logger[_0x6ab2('0x8')](util[_0x6ab2('0x9')](_0x6ab2('0xa'),_0x5b7e6d['id'],_0x5b7e6d[_0x6ab2('0xb')]));return getTranscriptionJob(_0x10c3b1['data1'],_0x10c3b1[_0x6ab2('0xc')],_0x5b6f7c['transcribeRegion'],_0x5b7e6d[_0x6ab2('0xb')])[_0x6ab2('0xd')](function(_0x5ced24){logger['info'](util['format'](_0x6ab2('0xe'),_0x5b7e6d['id'],_0x5b7e6d[_0x6ab2('0xb')],_0x5ced24[_0x6ab2('0xf')][_0x6ab2('0x10')]));if(!_0x5b7e6d[_0x6ab2('0x11')]){switch(_0x5ced24[_0x6ab2('0xf')]['TranscriptionJobStatus']){case _0x6ab2('0x12'):var _0x2aac55={'transcribeStatus':_0x5ced24['TranscriptionJob'][_0x6ab2('0x10')],'fileUri':_0x5ced24['TranscriptionJob']['Transcript'][_0x6ab2('0x13')]};logger[_0x6ab2('0x8')](util[_0x6ab2('0x9')](_0x6ab2('0x14'),_0x5b7e6d['id']));return rp({'uri':_0x5ced24[_0x6ab2('0xf')]['Transcript'][_0x6ab2('0x13')],'json':!![]})[_0x6ab2('0xd')](function(_0x3b7a1a){logger[_0x6ab2('0x8')](util[_0x6ab2('0x9')](_0x6ab2('0x15'),_0x5b7e6d['id']));if(_0x3b7a1a&&_0x3b7a1a[_0x6ab2('0x16')]&&_0x3b7a1a[_0x6ab2('0x16')][_0x6ab2('0x17')]&&_0x3b7a1a[_0x6ab2('0x16')]['transcripts']['length']){_0x2aac55['fileText']='';for(var _0x11e287=0x0;_0x11e287<_0x3b7a1a[_0x6ab2('0x16')][_0x6ab2('0x17')]['length'];_0x11e287++){_0x2aac55[_0x6ab2('0x11')]+=_0x3b7a1a[_0x6ab2('0x16')][_0x6ab2('0x17')][_0x11e287][_0x6ab2('0x18')]+'';}}return _0x5b7e6d['update'](_0x2aac55);})['then'](function(){logger['info'](util[_0x6ab2('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5b7e6d['id']));if(!_0x5b7e6d['tempSentiment']){throw new db[(_0x6ab2('0x19'))][(_0x6ab2('0x1a'))](_0x6ab2('0x1b'));}if(!_0x5b6f7c[_0x6ab2('0x1c')]||!_0x5b6f7c[_0x6ab2('0x1d')]||!_0x5b6f7c[_0x6ab2('0x1e')]||!_0x5b6f7c[_0x6ab2('0x1f')]||!_0x5b6f7c[_0x6ab2('0x20')]){throw new db[(_0x6ab2('0x19'))]['ValidationError'](_0x6ab2('0x21'));}if(!_0x2aac55[_0x6ab2('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x5b6f7c[_0x6ab2('0x1d')]===_0x10c3b1['id']){return _0x10c3b1;}else{return db['CloudProvider'][_0x6ab2('0x22')]({'where':{'id':_settings[_0x6ab2('0x1d')]}});}})[_0x6ab2('0xd')](function(_0x151367){if(!_0x151367){throw new db[(_0x6ab2('0x19'))][(_0x6ab2('0x1a'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x151367[_0x6ab2('0x23')]||!_0x151367[_0x6ab2('0xc')]){throw new db[(_0x6ab2('0x19'))][(_0x6ab2('0x1a'))](_0x6ab2('0x24'));}_0x2bb464=_0x151367;logger[_0x6ab2('0x8')](util[_0x6ab2('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5b7e6d['id']));return sentiment(_0x2bb464[_0x6ab2('0x23')],_0x2bb464[_0x6ab2('0xc')],_0x5b6f7c['sentimentRegion'],_0x2aac55['fileText'],_0x5b6f7c[_0x6ab2('0x1f')]);})[_0x6ab2('0xd')](function(_0x309165){logger[_0x6ab2('0x8')](util[_0x6ab2('0x9')](_0x6ab2('0x25'),_0x5b7e6d['id']));return _0x5b7e6d[_0x6ab2('0x26')]({'sentiment':_0x309165[_0x6ab2('0x27')],'sPositive':_0x309165['SentimentScore']['Positive'],'sNegative':_0x309165[_0x6ab2('0x28')][_0x6ab2('0x29')],'sMixed':_0x309165[_0x6ab2('0x28')][_0x6ab2('0x2a')],'sNeutral':_0x309165[_0x6ab2('0x28')]['Neutral']});})[_0x6ab2('0xd')](function(){logger[_0x6ab2('0x8')](util[_0x6ab2('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5b7e6d['id']));_0x431d63();});case _0x6ab2('0x2b'):return _0x5b7e6d[_0x6ab2('0x26')]({'transcribeStatus':'FAILED','failureReason':_0x5ced24[_0x6ab2('0xf')][_0x6ab2('0x2c')]})[_0x6ab2('0xd')](function(){logger[_0x6ab2('0x8')](util[_0x6ab2('0x9')](_0x6ab2('0x2d'),_0x5b7e6d['id']));_0x431d63();});default:logger[_0x6ab2('0x8')](util['format'](_0x6ab2('0x2e'),_0x5b7e6d['id']));break;}}else{return BPromise['resolve']()[_0x6ab2('0xd')](function(){if(!_0x5b7e6d[_0x6ab2('0x2f')]){throw new db[(_0x6ab2('0x19'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5b6f7c[_0x6ab2('0x1c')]||!_0x5b6f7c['sentimentAccountId']||!_0x5b6f7c['sentimentRegion']||!_0x5b6f7c[_0x6ab2('0x1f')]||!_0x5b6f7c[_0x6ab2('0x20')]){throw new db[(_0x6ab2('0x19'))][(_0x6ab2('0x1a'))](_0x6ab2('0x21'));}if(!_0x5b7e6d['fileText']){throw new Error(_0x6ab2('0x30'));}if(_0x5b6f7c['sentimentAccountId']===_0x10c3b1['id']){return _0x10c3b1;}else{return db[_0x6ab2('0x31')][_0x6ab2('0x22')]({'where':{'id':_settings[_0x6ab2('0x1d')]}});}})[_0x6ab2('0xd')](function(_0x507fdc){if(!_0x507fdc){throw new db[(_0x6ab2('0x19'))][(_0x6ab2('0x1a'))](_0x6ab2('0x32'));}if(!_0x507fdc[_0x6ab2('0x23')]||!_0x507fdc[_0x6ab2('0xc')]){throw new db[(_0x6ab2('0x19'))][(_0x6ab2('0x1a'))](_0x6ab2('0x24'));}_0x2bb464=_0x507fdc;logger[_0x6ab2('0x8')](util[_0x6ab2('0x9')](_0x6ab2('0x33'),_0x5b7e6d['id']));return sentiment(_0x2bb464[_0x6ab2('0x23')],_0x2bb464['data2'],_0x5b6f7c[_0x6ab2('0x1e')],_0x5b7e6d[_0x6ab2('0x11')],_0x5b6f7c[_0x6ab2('0x1f')]);})[_0x6ab2('0xd')](function(_0x1b38ae){logger[_0x6ab2('0x8')](util['format'](_0x6ab2('0x25'),_0x5b7e6d['id']));return _0x5b7e6d[_0x6ab2('0x26')]({'sentiment':_0x1b38ae[_0x6ab2('0x27')],'sPositive':_0x1b38ae[_0x6ab2('0x28')]['Positive'],'sNegative':_0x1b38ae['SentimentScore'][_0x6ab2('0x29')],'sMixed':_0x1b38ae[_0x6ab2('0x28')][_0x6ab2('0x2a')],'sNeutral':_0x1b38ae[_0x6ab2('0x28')][_0x6ab2('0x34')],'transcribeStatus':'COMPLETED'});})[_0x6ab2('0xd')](function(){logger[_0x6ab2('0x8')](util[_0x6ab2('0x9')](_0x6ab2('0x2d'),_0x5b7e6d['id']));_0x431d63();});}})['catch'](function(_0x538532){if(_0x538532){if(!_0x538532[_0x6ab2('0x35')]||_0x538532[_0x6ab2('0x35')]!=='SequelizeValidationError'){logger[_0x6ab2('0x36')](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x5b7e6d['id']),util['inspect'](_0x538532,{'showHidden':![],'depth':null}));}}_0x431d63();});});}function checkTranscribe(){var _0x1a7e42;var _0x2bee34;var _0x4fffb4;return db[_0x6ab2('0x37')]['findAll']({'where':{'transcribeStatus':_0x6ab2('0x38')}})[_0x6ab2('0xd')](function(_0xe385cf){if(!_0xe385cf||!_0xe385cf[_0x6ab2('0x39')]){throw new db['Sequelize'][(_0x6ab2('0x1a'))](_0x6ab2('0x3a'));}_0x1a7e42=_0xe385cf;return db[_0x6ab2('0x3b')][_0x6ab2('0x22')]({'where':{'id':0x1}});})[_0x6ab2('0xd')](function(_0x301270){if(!_0x301270){throw new db[(_0x6ab2('0x19'))]['ValidationError'](_0x6ab2('0x3c'));}_0x2bee34=_0x301270;if(!_0x2bee34[_0x6ab2('0x3d')]||!_0x2bee34[_0x6ab2('0x3e')]||!_0x2bee34[_0x6ab2('0x3f')]||!_0x2bee34[_0x6ab2('0x1f')]||!_0x2bee34[_0x6ab2('0x20')]){throw new db['Sequelize'][(_0x6ab2('0x1a'))]('Transcribe\x20not\x20configured');}return db[_0x6ab2('0x31')][_0x6ab2('0x22')]({'where':{'id':_0x2bee34[_0x6ab2('0x3e')]}});})[_0x6ab2('0xd')](function(_0x145428){if(!_0x145428){throw new db[(_0x6ab2('0x19'))][(_0x6ab2('0x1a'))](_0x6ab2('0x32'));}if(!_0x145428[_0x6ab2('0x23')]||!_0x145428['data2']){throw new db[(_0x6ab2('0x19'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x4fffb4=_0x145428;var _0x3dde6b=[];_0x1a7e42[_0x6ab2('0x40')](function(_0x12eab2){_0x3dde6b[_0x6ab2('0x41')](checkTranscribeJob(_0x12eab2,_0x2bee34,_0x4fffb4));});return BPromise[_0x6ab2('0x42')](_0x3dde6b);})[_0x6ab2('0x43')](function(_0x7f1000){if(_0x7f1000){if(!_0x7f1000[_0x6ab2('0x35')]||_0x7f1000[_0x6ab2('0x35')]!==_0x6ab2('0x44')){logger[_0x6ab2('0x36')](util[_0x6ab2('0x45')](_0x7f1000,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x10b8=['info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','TranscriptFileUri','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','length','fileText','transcripts','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','sentiment','sentimentAccountId','sentimentRegion','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','update','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','findOne','language','Neutral','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','transcribeAccountId','forEach','push','all','catch','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring'];(function(_0x16bebe,_0x5a8e72){var _0xad76c5=function(_0x19c5bb){while(--_0x19c5bb){_0x16bebe['push'](_0x16bebe['shift']());}};_0xad76c5(++_0x5a8e72);}(_0x10b8,0x166));var _0x810b=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x10b8[_0x172747];return _0x509692;};var _=require(_0x810b('0x0'));var AWS=require(_0x810b('0x1'));var rp=require(_0x810b('0x2'));var util=require(_0x810b('0x3'));var BPromise=require(_0x810b('0x4'));var db=require(_0x810b('0x5'))['db'];var logger=require('../../config/logger')(_0x810b('0x6'));function getTranscriptionJob(_0x30dac0,_0x2cef3f,_0x55b8cf,_0x1fde02){return new Promise(function(_0x3166f9,_0x3d3a15){var _0x33b73f=new AWS[(_0x810b('0x7'))]({'accessKeyId':_0x2cef3f,'secretAccessKey':_0x30dac0,'region':_0x55b8cf});_0x33b73f[_0x810b('0x8')]({'TranscriptionJobName':_0x1fde02},function(_0x43e6ed,_0x567a99){if(_0x43e6ed){return _0x3d3a15(_0x43e6ed);}else{return _0x3166f9(_0x567a99);}});});}function sentiment(_0x27e616,_0x5143bb,_0x2afe3e,_0x3cf5cc,_0x2882aa){return new Promise(function(_0x6260ea,_0x28be6f){var _0x48101e=new AWS[(_0x810b('0x9'))]({'accessKeyId':_0x5143bb,'secretAccessKey':_0x27e616,'region':_0x2afe3e});_0x48101e[_0x810b('0xa')]({'Text':_0x3cf5cc,'LanguageCode':_0x2882aa[_0x810b('0xb')](0x0,0x2)},function(_0x322a38,_0x498607){if(_0x322a38){return _0x28be6f(_0x322a38);}else{return _0x6260ea(_0x498607);}});});}function checkTranscribeJob(_0x37d408,_0x1cc57d,_0x24bb1d){var _0x2069a9;return new BPromise(function(_0x16f727,_0x35a166){logger[_0x810b('0xc')](util[_0x810b('0xd')](_0x810b('0xe'),_0x37d408['id'],_0x37d408[_0x810b('0xf')]));return getTranscriptionJob(_0x24bb1d['data1'],_0x24bb1d['data2'],_0x1cc57d[_0x810b('0x10')],_0x37d408[_0x810b('0xf')])[_0x810b('0x11')](function(_0xea1d2a){logger[_0x810b('0xc')](util[_0x810b('0xd')](_0x810b('0x12'),_0x37d408['id'],_0x37d408[_0x810b('0xf')],_0xea1d2a[_0x810b('0x13')][_0x810b('0x14')]));if(!_0x37d408['fileText']){switch(_0xea1d2a[_0x810b('0x13')]['TranscriptionJobStatus']){case _0x810b('0x15'):var _0x22e695={'transcribeStatus':_0xea1d2a[_0x810b('0x13')]['TranscriptionJobStatus'],'fileUri':_0xea1d2a[_0x810b('0x13')]['Transcript'][_0x810b('0x16')]};logger['info'](util[_0x810b('0xd')]('[RECORDING:%d]\x20Get\x20transcript',_0x37d408['id']));return rp({'uri':_0xea1d2a[_0x810b('0x13')][_0x810b('0x17')][_0x810b('0x16')],'json':!![]})['then'](function(_0x1e3642){logger['info'](util[_0x810b('0xd')](_0x810b('0x18'),_0x37d408['id']));if(_0x1e3642&&_0x1e3642[_0x810b('0x19')]&&_0x1e3642[_0x810b('0x19')]['transcripts']&&_0x1e3642[_0x810b('0x19')]['transcripts'][_0x810b('0x1a')]){_0x22e695[_0x810b('0x1b')]='';for(var _0x37bed2=0x0;_0x37bed2<_0x1e3642[_0x810b('0x19')]['transcripts'][_0x810b('0x1a')];_0x37bed2++){_0x22e695['fileText']+=_0x1e3642[_0x810b('0x19')][_0x810b('0x1c')][_0x37bed2][_0x810b('0x1d')]+'';}}return _0x37d408['update'](_0x22e695);})[_0x810b('0x11')](function(){logger[_0x810b('0xc')](util[_0x810b('0xd')](_0x810b('0x1e'),_0x37d408['id']));if(!_0x37d408[_0x810b('0x1f')]){throw new db[(_0x810b('0x20'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1cc57d[_0x810b('0x21')]||!_0x1cc57d[_0x810b('0x22')]||!_0x1cc57d[_0x810b('0x23')]||!_0x1cc57d['language']||!_0x1cc57d[_0x810b('0x24')]){throw new db['Sequelize'][(_0x810b('0x25'))](_0x810b('0x26'));}if(!_0x22e695[_0x810b('0x1b')]){throw new Error(_0x810b('0x27'));}if(_0x1cc57d[_0x810b('0x22')]===_0x24bb1d['id']){return _0x24bb1d;}else{return db[_0x810b('0x28')]['findOne']({'where':{'id':_settings[_0x810b('0x22')]}});}})['then'](function(_0xd00df){if(!_0xd00df){throw new db[(_0x810b('0x20'))][(_0x810b('0x25'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xd00df[_0x810b('0x29')]||!_0xd00df[_0x810b('0x2a')]){throw new db['Sequelize'][(_0x810b('0x25'))](_0x810b('0x2b'));}_0x2069a9=_0xd00df;logger[_0x810b('0xc')](util['format'](_0x810b('0x2c'),_0x37d408['id']));return sentiment(_0x2069a9[_0x810b('0x29')],_0x2069a9[_0x810b('0x2a')],_0x1cc57d['sentimentRegion'],_0x22e695[_0x810b('0x1b')],_0x1cc57d['language']);})[_0x810b('0x11')](function(_0x5c30cd){logger[_0x810b('0xc')](util[_0x810b('0xd')](_0x810b('0x2d'),_0x37d408['id']));return _0x37d408['update']({'sentiment':_0x5c30cd[_0x810b('0x2e')],'sPositive':_0x5c30cd[_0x810b('0x2f')][_0x810b('0x30')],'sNegative':_0x5c30cd[_0x810b('0x2f')][_0x810b('0x31')],'sMixed':_0x5c30cd[_0x810b('0x2f')][_0x810b('0x32')],'sNeutral':_0x5c30cd[_0x810b('0x2f')]['Neutral']});})[_0x810b('0x11')](function(){logger[_0x810b('0xc')](util[_0x810b('0xd')](_0x810b('0x1e'),_0x37d408['id']));_0x16f727();});case'FAILED':return _0x37d408[_0x810b('0x33')]({'transcribeStatus':_0x810b('0x34'),'failureReason':_0xea1d2a[_0x810b('0x13')][_0x810b('0x35')]})[_0x810b('0x11')](function(){logger[_0x810b('0xc')](util['format'](_0x810b('0x1e'),_0x37d408['id']));_0x16f727();});default:logger[_0x810b('0xc')](util[_0x810b('0xd')](_0x810b('0x36'),_0x37d408['id']));break;}}else{return BPromise[_0x810b('0x37')]()['then'](function(){if(!_0x37d408['tempSentiment']){throw new db[(_0x810b('0x20'))]['ValidationError'](_0x810b('0x38'));}if(!_0x1cc57d[_0x810b('0x21')]||!_0x1cc57d[_0x810b('0x22')]||!_0x1cc57d[_0x810b('0x23')]||!_0x1cc57d['language']||!_0x1cc57d[_0x810b('0x24')]){throw new db['Sequelize'][(_0x810b('0x25'))](_0x810b('0x26'));}if(!_0x37d408[_0x810b('0x1b')]){throw new Error(_0x810b('0x27'));}if(_0x1cc57d[_0x810b('0x22')]===_0x24bb1d['id']){return _0x24bb1d;}else{return db[_0x810b('0x28')][_0x810b('0x39')]({'where':{'id':_settings[_0x810b('0x22')]}});}})['then'](function(_0x4c6e4d){if(!_0x4c6e4d){throw new db[(_0x810b('0x20'))][(_0x810b('0x25'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4c6e4d[_0x810b('0x29')]||!_0x4c6e4d[_0x810b('0x2a')]){throw new db['Sequelize'][(_0x810b('0x25'))]('Cloud\x20Provider\x20not\x20configured');}_0x2069a9=_0x4c6e4d;logger[_0x810b('0xc')](util[_0x810b('0xd')](_0x810b('0x2c'),_0x37d408['id']));return sentiment(_0x2069a9[_0x810b('0x29')],_0x2069a9[_0x810b('0x2a')],_0x1cc57d[_0x810b('0x23')],_0x37d408[_0x810b('0x1b')],_0x1cc57d[_0x810b('0x3a')]);})[_0x810b('0x11')](function(_0x204841){logger[_0x810b('0xc')](util[_0x810b('0xd')](_0x810b('0x2d'),_0x37d408['id']));return _0x37d408['update']({'sentiment':_0x204841[_0x810b('0x2e')],'sPositive':_0x204841['SentimentScore'][_0x810b('0x30')],'sNegative':_0x204841[_0x810b('0x2f')]['Negative'],'sMixed':_0x204841[_0x810b('0x2f')][_0x810b('0x32')],'sNeutral':_0x204841[_0x810b('0x2f')][_0x810b('0x3b')],'transcribeStatus':_0x810b('0x15')});})[_0x810b('0x11')](function(){logger[_0x810b('0xc')](util[_0x810b('0xd')](_0x810b('0x1e'),_0x37d408['id']));_0x16f727();});}})['catch'](function(_0x39c9b3){if(_0x39c9b3){if(!_0x39c9b3[_0x810b('0x3c')]||_0x39c9b3['name']!==_0x810b('0x3d')){logger[_0x810b('0x3e')](util[_0x810b('0xd')](_0x810b('0x3f'),_0x37d408['id']),util[_0x810b('0x40')](_0x39c9b3,{'showHidden':![],'depth':null}));}}_0x16f727();});});}function checkTranscribe(){var _0x2b9590;var _0x2ed181;var _0x427d91;return db[_0x810b('0x41')][_0x810b('0x42')]({'where':{'transcribeStatus':_0x810b('0x43')}})['then'](function(_0x533a6e){if(!_0x533a6e||!_0x533a6e[_0x810b('0x1a')]){throw new db['Sequelize']['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x2b9590=_0x533a6e;return db[_0x810b('0x44')][_0x810b('0x39')]({'where':{'id':0x1}});})[_0x810b('0x11')](function(_0xae2e2a){if(!_0xae2e2a){throw new db[(_0x810b('0x20'))][(_0x810b('0x25'))]('Settings\x20not\x20available');}_0x2ed181=_0xae2e2a;if(!_0x2ed181[_0x810b('0x6')]||!_0x2ed181[_0x810b('0x45')]||!_0x2ed181[_0x810b('0x10')]||!_0x2ed181[_0x810b('0x3a')]||!_0x2ed181[_0x810b('0x24')]){throw new db[(_0x810b('0x20'))][(_0x810b('0x25'))]('Transcribe\x20not\x20configured');}return db[_0x810b('0x28')][_0x810b('0x39')]({'where':{'id':_0x2ed181[_0x810b('0x45')]}});})[_0x810b('0x11')](function(_0x4903ac){if(!_0x4903ac){throw new db['Sequelize'][(_0x810b('0x25'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4903ac[_0x810b('0x29')]||!_0x4903ac[_0x810b('0x2a')]){throw new db[(_0x810b('0x20'))][(_0x810b('0x25'))](_0x810b('0x2b'));}_0x427d91=_0x4903ac;var _0x160d33=[];_0x2b9590[_0x810b('0x46')](function(_0x2d5b01){_0x160d33[_0x810b('0x47')](checkTranscribeJob(_0x2d5b01,_0x2ed181,_0x427d91));});return BPromise[_0x810b('0x48')](_0x160d33);})[_0x810b('0x49')](function(_0x41f244){if(_0x41f244){if(!_0x41f244[_0x810b('0x3c')]||_0x41f244[_0x810b('0x3c')]!==_0x810b('0x3d')){logger[_0x810b('0x3e')](util[_0x810b('0x40')](_0x41f244,{'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 bdc686b..41626b7 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 _0xa5a9=['schedule','defaults','localhost','socket.io-emitter','redis','findAll','lastMsgAt','subtract','hours','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','WhatsappInteraction','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','moment','ioredis','util','../../config/environment'];(function(_0x20baea,_0x3f61f8){var _0x1f131c=function(_0x39a54f){while(--_0x39a54f){_0x20baea['push'](_0x20baea['shift']());}};_0x1f131c(++_0x3f61f8);}(_0xa5a9,0xdc));var _0x9a5a=function(_0x294b6,_0x2907ae){_0x294b6=_0x294b6-0x0;var _0x38bb97=_0xa5a9[_0x294b6];return _0x38bb97;};'use strict';var _=require('lodash');var moment=require(_0x9a5a('0x0'));var Redis=require(_0x9a5a('0x1'));var util=require(_0x9a5a('0x2'));var config=require(_0x9a5a('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x9a5a('0x4'));config['redis']=_[_0x9a5a('0x5')](config['redis'],{'host':_0x9a5a('0x6'),'port':0x18eb});var io=require(_0x9a5a('0x7'))(new Redis(config[_0x9a5a('0x8')]));function closeInteractions(){var _0x4f4e51=[];return db['WhatsappInteraction'][_0x9a5a('0x9')]({'raw':!![],'attributes':['id',_0x9a5a('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x9a5a('0xb')](0x18,_0x9a5a('0xc'))}}})['then'](function(_0x2f5544){if(_0x2f5544&&_0x2f5544['length']){_0x4f4e51=_[_0x9a5a('0xd')](_0x2f5544||[],'id');logger[_0x9a5a('0xe')](_0x9a5a('0xf'),_0x4f4e51['join']());return db[_0x9a5a('0x10')]['update']({'closeReason':'system','disposition':_0x9a5a('0x11'),'closed':!![],'closedAt':moment()[_0x9a5a('0x12')](_0x9a5a('0x13'))},{'where':{'id':_0x4f4e51}});}})[_0x9a5a('0x14')](function(){if(_0x4f4e51&&_0x4f4e51[_0x9a5a('0x15')]){logger[_0x9a5a('0xe')](_0x9a5a('0x16'),_0x4f4e51['join']());for(var _0x2d1959=0x0;_0x2d1959<_0x4f4e51[_0x9a5a('0x15')];_0x2d1959++){io[_0x9a5a('0x17')](_0x9a5a('0x18'),{'id':_0x4f4e51[_0x2d1959],'closed':!![]});}}})['catch'](function(_0xff6d4c){logger[_0x9a5a('0x19')](_0x9a5a('0x1a'),_0xff6d4c?util['inspect'](_0xff6d4c,{'showHidden':![],'depth':null}):'');});}exports[_0x9a5a('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb730=['../../config/environment','../../mysqldb','redis','defaults','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','join','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis'];(function(_0x17b488,_0x14e5d5){var _0x53c3b3=function(_0x23e29b){while(--_0x23e29b){_0x17b488['push'](_0x17b488['shift']());}};_0x53c3b3(++_0x14e5d5);}(_0xb730,0xac));var _0x0b73=function(_0x44a9fd,_0x214f32){_0x44a9fd=_0x44a9fd-0x0;var _0x434519=_0xb730[_0x44a9fd];return _0x434519;};'use strict';var _=require('lodash');var moment=require(_0x0b73('0x0'));var Redis=require(_0x0b73('0x1'));var util=require('util');var config=require(_0x0b73('0x2'));var db=require(_0x0b73('0x3'))['db'];var logger=require('../logger')('schedule');config[_0x0b73('0x4')]=_[_0x0b73('0x5')](config['redis'],{'host':_0x0b73('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x54e514=[];return db[_0x0b73('0x7')][_0x0b73('0x8')]({'raw':!![],'attributes':['id',_0x0b73('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x0b73('0xa')](0x18,_0x0b73('0xb'))}}})[_0x0b73('0xc')](function(_0x590783){if(_0x590783&&_0x590783[_0x0b73('0xd')]){_0x54e514=_[_0x0b73('0xe')](_0x590783||[],'id');logger['info'](_0x0b73('0xf'),_0x54e514['join']());return db['WhatsappInteraction']['update']({'closeReason':_0x0b73('0x10'),'disposition':_0x0b73('0x11'),'closed':!![],'closedAt':moment()[_0x0b73('0x12')](_0x0b73('0x13'))},{'where':{'id':_0x54e514}});}})[_0x0b73('0xc')](function(){if(_0x54e514&&_0x54e514[_0x0b73('0xd')]){logger[_0x0b73('0x14')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x54e514[_0x0b73('0x15')]());for(var _0x16827b=0x0;_0x16827b<_0x54e514['length'];_0x16827b++){io[_0x0b73('0x16')](_0x0b73('0x17'),{'id':_0x54e514[_0x16827b],'closed':!![]});}}})[_0x0b73('0x18')](function(_0xcdadfb){logger[_0x0b73('0x19')](_0x0b73('0x1a'),_0xcdadfb?util[_0x0b73('0x1b')](_0xcdadfb,{'showHidden':![],'depth':null}):'');});}exports[_0x0b73('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 7c60267..816ae41 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9b6=['Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','then','bulkCreate','CmHopper','log','hopper1','finished\x20populating','contacts2','hopper2','util','push'];(function(_0x31fba5,_0x401a77){var _0x49ef92=function(_0x31ecab){while(--_0x31ecab){_0x31fba5['push'](_0x31fba5['shift']());}};_0x49ef92(++_0x401a77);}(_0xa9b6,0x8e));var _0x6a9b=function(_0x1248d4,_0x34b741){_0x1248d4=_0x1248d4-0x0;var _0x5d33ff=_0xa9b6[_0x1248d4];return _0x5d33ff;};'use strict';var util=require(_0x6a9b('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x6a9b('0x1')]({'id':i,'firstName':_0x6a9b('0x2')+i,'lastName':_0x6a9b('0x3')+i,'phone':0xf879fb460+i,'email':_0x6a9b('0x4')+i+_0x6a9b('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x6a9b('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x6a9b('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6a9b('0x6')](),'updatedAt':Date[_0x6a9b('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x6a9b('0x1')]({'id':i,'firstName':_0x6a9b('0x2')+i,'lastName':_0x6a9b('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x6a9b('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x6a9b('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6a9b('0x6')](),'updatedAt':Date[_0x6a9b('0x6')]()});}db[_0x6a9b('0x7')]['destroy']({'where':{}})[_0x6a9b('0x8')](function(){return db[_0x6a9b('0x7')][_0x6a9b('0x9')](contacts);})[_0x6a9b('0x8')](function(){console['log']('finished\x20populating','contacts1');return db[_0x6a9b('0xa')]['destroy']({'where':{}});})['then'](function(){return db[_0x6a9b('0xa')][_0x6a9b('0x9')](hopper);})[_0x6a9b('0x8')](function(){console[_0x6a9b('0xb')]('finished\x20populating',_0x6a9b('0xc'));return db['CmContact']['bulkCreate'](contacts2);})[_0x6a9b('0x8')](function(){console[_0x6a9b('0xb')](_0x6a9b('0xd'),_0x6a9b('0xe'));return db[_0x6a9b('0xa')][_0x6a9b('0x9')](hopper2);})[_0x6a9b('0x8')](function(){console[_0x6a9b('0xb')](_0x6a9b('0xd'),_0x6a9b('0xf'));})['catch'](function(_0x2eaa4f){console[_0x6a9b('0xb')](_0x2eaa4f);}); \ No newline at end of file +var _0x30ac=['then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper1','hopper2','util','push','@xcally.com','now','Biondo','innocenzo.biondo','CmContact','destroy'];(function(_0x19297c,_0x266518){var _0x1c055e=function(_0x5f5746){while(--_0x5f5746){_0x19297c['push'](_0x19297c['shift']());}};_0x1c055e(++_0x266518);}(_0x30ac,0xd8));var _0xc30a=function(_0x172d2c,_0x9bb44a){_0x172d2c=_0x172d2c-0x0;var _0x41c113=_0x30ac[_0x172d2c];return _0x41c113;};'use strict';var util=require(_0xc30a('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xc30a('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xc30a('0x2')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xc30a('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xc30a('0x3')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xc30a('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xc30a('0x4')+i,'phone':0xf879fb460+i,'email':_0xc30a('0x5')+i+_0xc30a('0x2')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xc30a('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc30a('0x3')](),'updatedAt':Date[_0xc30a('0x3')]()});}db[_0xc30a('0x6')][_0xc30a('0x7')]({'where':{}})['then'](function(){return db[_0xc30a('0x6')]['bulkCreate'](contacts);})[_0xc30a('0x8')](function(){console[_0xc30a('0x9')](_0xc30a('0xa'),_0xc30a('0xb'));return db[_0xc30a('0xc')]['destroy']({'where':{}});})[_0xc30a('0x8')](function(){return db[_0xc30a('0xc')][_0xc30a('0xd')](hopper);})['then'](function(){console[_0xc30a('0x9')](_0xc30a('0xa'),_0xc30a('0xe'));return db[_0xc30a('0x6')][_0xc30a('0xd')](contacts2);})['then'](function(){console[_0xc30a('0x9')](_0xc30a('0xa'),'contacts2');return db[_0xc30a('0xc')][_0xc30a('0xd')](hopper2);})[_0xc30a('0x8')](function(){console[_0xc30a('0x9')](_0xc30a('0xa'),_0xc30a('0xf'));})['catch'](function(_0x23e167){console['log'](_0x23e167);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 27244b5..d01f45a 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9a2=['push','format','%s%s','agent','udp','wss','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb'];(function(_0x9d9797,_0xe3ebe8){var _0x3c16ca=function(_0x3d8735){while(--_0x3d8735){_0x9d9797['push'](_0x9d9797['shift']());}};_0x3c16ca(++_0xe3ebe8);}(_0xd9a2,0xb2));var _0x2d9a=function(_0x481529,_0x2ad20a){_0x481529=_0x481529-0x0;var _0x20015b=_0xd9a2[_0x481529];return _0x20015b;};'use strict';var util=require(_0x2d9a('0x0'));var db=require(_0x2d9a('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x2d9a('0x2')]({'name':util[_0x2d9a('0x3')](_0x2d9a('0x4'),_0x2d9a('0x5'),i),'fullname':util[_0x2d9a('0x3')](_0x2d9a('0x4'),_0x2d9a('0x5'),i),'email':util[_0x2d9a('0x3')]('%s%s@xcally.com',_0x2d9a('0x5'),i),'role':'agent','password':'password','internal':0xfa0+i,'type':'friend','transport':[_0x2d9a('0x6'),'ws',_0x2d9a('0x7')],'disallow':['all'],'allow':['ulaw'],'defaultuser':util['format'](_0x2d9a('0x4'),_0x2d9a('0x5'),i),'encryption':'yes','avpf':'yes','force_avp':_0x2d9a('0x8'),'icesupport':_0x2d9a('0x8'),'dtlsenable':_0x2d9a('0x8'),'dtlsverify':'no','dtlscertfile':_0x2d9a('0x9'),'dtlsprivatekey':_0x2d9a('0xa'),'dtlssetup':_0x2d9a('0xb'),'callerid':util[_0x2d9a('0x3')]('\x22%s\x22\x20<%s>',util[_0x2d9a('0x3')](_0x2d9a('0x4'),'agent',i),0xfa0+i)});}db[_0x2d9a('0xc')][_0x2d9a('0xd')](users)[_0x2d9a('0xe')](function(){console[_0x2d9a('0xf')](_0x2d9a('0x10'));})[_0x2d9a('0x11')](function(_0x243c6b){console[_0x2d9a('0xf')](_0x243c6b);}); \ No newline at end of file +var _0x70a7=['add\x20user','catch','push','%s%s','agent','format','password','friend','udp','wss','all','ulaw','yes','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','log'];(function(_0x345466,_0x1160ee){var _0x103702=function(_0x5b5efa){while(--_0x5b5efa){_0x345466['push'](_0x345466['shift']());}};_0x103702(++_0x1160ee);}(_0x70a7,0x17c));var _0x770a=function(_0x217c2e,_0x358f06){_0x217c2e=_0x217c2e-0x0;var _0x22b7d8=_0x70a7[_0x217c2e];return _0x22b7d8;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x770a('0x0')]({'name':util['format'](_0x770a('0x1'),_0x770a('0x2'),i),'fullname':util['format'](_0x770a('0x1'),_0x770a('0x2'),i),'email':util[_0x770a('0x3')]('%s%s@xcally.com',_0x770a('0x2'),i),'role':_0x770a('0x2'),'password':_0x770a('0x4'),'internal':0xfa0+i,'type':_0x770a('0x5'),'transport':[_0x770a('0x6'),'ws',_0x770a('0x7')],'disallow':[_0x770a('0x8')],'allow':[_0x770a('0x9')],'defaultuser':util[_0x770a('0x3')](_0x770a('0x1'),_0x770a('0x2'),i),'encryption':_0x770a('0xa'),'avpf':_0x770a('0xa'),'force_avp':_0x770a('0xa'),'icesupport':_0x770a('0xa'),'dtlsenable':_0x770a('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x770a('0xb'),'callerid':util['format'](_0x770a('0xc'),util['format'](_0x770a('0x1'),_0x770a('0x2'),i),0xfa0+i)});}db[_0x770a('0xd')][_0x770a('0xe')](users)['then'](function(){console[_0x770a('0xf')](_0x770a('0x10'));})[_0x770a('0x11')](function(_0x5bb8a8){console[_0x770a('0xf')](_0x5bb8a8);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index d28ecd8..1633735 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x87d5=['removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','address','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','./environment','name','Agents','User','role','agent','type','ivr','UserProfileSection','then','VoiceQueues','ChatQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','where','telephone','Campaign','%s:queue:%s','length','format','query','find','userProfileId','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','ChatQueue','FaxQueues','SmsQueues','SmsQueue','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','fax','mail','openchannel','whatsapp','telephone:%s','user:%s','leave','map','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_fax_interactions:remove','SmsInteractions','user_has_sms_interactions:remove'];(function(_0x269645,_0x13e9f2){var _0x4460d3=function(_0x413fbb){while(--_0x413fbb){_0x269645['push'](_0x269645['shift']());}};_0x4460d3(++_0x13e9f2);}(_0x87d5,0x6b));var _0x587d=function(_0xce0b84,_0x2b7229){_0xce0b84=_0xce0b84-0x0;var _0x2267ef=_0x87d5[_0xce0b84];return _0x2267ef;};'use strict';var _=require(_0x587d('0x0'));var util=require('util');var BPromise=require(_0x587d('0x1'));var db=require('../mysqldb')['db'];var config=require(_0x587d('0x2'));var queryQueues={'attributes':['id',_0x587d('0x3')],'include':[{'as':_0x587d('0x4'),'model':db[_0x587d('0x5')],'attributes':['id','name',_0x587d('0x6')],'raw':!![],'where':{'role':_0x587d('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x587d('0x3')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x587d('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x587d('0x3')],'where':{'role':_0x587d('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x587d('0x8')],'where':{'type':_0x587d('0x9')}};function getAssociatedResources(_0x1bd7f1,_0x197713,_0x2c8d20){return db[_0x587d('0xa')]['findOne']({'where':{'name':_0x1bd7f1,'userProfileId':_0x197713},'raw':!![]})[_0x587d('0xb')](function(_0x26230e){if(_0x26230e){if(_0x26230e['autoAssociation']){switch(_0x1bd7f1){case _0x587d('0xc'):case _0x587d('0xd'):case'FaxQueues':case'SmsQueues':case _0x587d('0xe'):case _0x587d('0xf'):case _0x587d('0x10'):return db[_0x2c8d20]['findAll'](queryQueues);case _0x587d('0x11'):return db[_0x2c8d20][_0x587d('0x12')](queryTelephones);case _0x587d('0x13'):return db[_0x2c8d20][_0x587d('0x12')](queryTrunks);case _0x587d('0x14'):return db[_0x2c8d20][_0x587d('0x12')](queryCampaigns);}}else{return db[_0x587d('0x15')][_0x587d('0x12')]({'attributes':['resourceId'],'where':{'sectionId':_0x26230e['id']},'raw':!![]})[_0x587d('0xb')](function(_0x4b2b77){if(_0x4b2b77){var _0x272e09={'where':{'id':_['map'](_0x4b2b77,'resourceId')},'raw':!![]};switch(_0x2c8d20){case'User':_0x272e09[_0x587d('0x16')][_0x587d('0x6')]=_0x587d('0x17');break;case _0x587d('0x18'):_0x272e09[_0x587d('0x16')][_0x587d('0x8')]='ivr';break;}return db[_0x2c8d20][_0x587d('0x12')](_0x272e09);}else{return[];}});}}else{return[];}})[_0x587d('0xb')](function(_0x4c66db){return _0x4c66db;});}function joinOrLeaveQueues(_0x4a66da,_0x5721eb,_0x2653c8,_0x3a4f66){_0x4a66da[_0x5721eb](util['format'](_0x587d('0x19'),_0x2653c8,_0x3a4f66['name']));if(_0x3a4f66[_0x587d('0x4')]){for(var _0x2f7717=0x0;_0x2f7717<_0x3a4f66['Agents'][_0x587d('0x1a')];_0x2f7717+=0x1){_0x4a66da[_0x5721eb](util[_0x587d('0x1b')]('user:%s',_0x3a4f66['Agents'][_0x2f7717][_0x587d('0x3')]));}}}function joinOrLeave(_0x45af9e,_0x443c5c,_0x3830a0){var _0x2e8278;if(_0x45af9e['handshake'][_0x587d('0x1c')]['id']){db[_0x587d('0x5')][_0x587d('0x1d')]({'attributes':['id',_0x587d('0x3'),_0x587d('0x6'),_0x587d('0x1e')],'where':{'id':_0x45af9e['handshake'][_0x587d('0x1c')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x587d('0x1f'),'attributes':['id'],'raw':!![]},{'model':db[_0x587d('0x20')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x587d('0x21')],'as':_0x587d('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x587d('0x23')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x587d('0x24')],'as':_0x587d('0x25'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x587d('0x26'),'attributes':['id'],'raw':!![]}]})[_0x587d('0xb')](function(_0x5d3136){if(_0x5d3136){_0x2e8278=_0x5d3136;_0x45af9e[_0x443c5c](util[_0x587d('0x1b')]('user:%s',_0x5d3136[_0x587d('0x3')]));var _0xa2b2a6=[];switch(_0x5d3136['role']){case'admin':_0x45af9e[_0x443c5c](_0x587d('0x27'));_0x45af9e[_0x443c5c](_0x587d('0x28'));if(queryQueues[_0x587d('0x29')](_0x587d('0x2a'))){delete queryQueues[_0x587d('0x2a')];}_0xa2b2a6[_0x587d('0x2b')](db['VoiceQueue']['findAll'](queryQueues));_0xa2b2a6[_0x587d('0x2b')](db['ChatQueue'][_0x587d('0x12')](queryQueues));_0xa2b2a6[_0x587d('0x2b')](db[_0x587d('0x2c')][_0x587d('0x12')](queryQueues));_0xa2b2a6[_0x587d('0x2b')](db['SmsQueue']['findAll'](queryQueues));_0xa2b2a6[_0x587d('0x2b')](db[_0x587d('0x2d')]['findAll'](queryQueues));_0xa2b2a6[_0x587d('0x2b')](db[_0x587d('0x2e')][_0x587d('0x12')](queryQueues));_0xa2b2a6[_0x587d('0x2b')](db[_0x587d('0x2f')]['findAll'](queryQueues));_0xa2b2a6[_0x587d('0x2b')](db['User'][_0x587d('0x12')](queryTelephones));_0xa2b2a6[_0x587d('0x2b')](db['Trunk'][_0x587d('0x12')](queryTrunks));_0xa2b2a6[_0x587d('0x2b')](db['Campaign'][_0x587d('0x12')](queryCampaigns));_0xa2b2a6[_0x587d('0x2b')](db[_0x587d('0x5')][_0x587d('0x12')](queryAgents));break;case'user':_0x45af9e[_0x443c5c]('voice:inbound');_0x45af9e[_0x443c5c](_0x587d('0x28'));_0xa2b2a6['push'](getAssociatedResources(_0x587d('0xc'),_0x5d3136['userProfileId'],'VoiceQueue'));_0xa2b2a6[_0x587d('0x2b')](getAssociatedResources(_0x587d('0xd'),_0x5d3136[_0x587d('0x1e')],_0x587d('0x30')));_0xa2b2a6[_0x587d('0x2b')](getAssociatedResources(_0x587d('0x31'),_0x5d3136[_0x587d('0x1e')],_0x587d('0x2c')));_0xa2b2a6[_0x587d('0x2b')](getAssociatedResources(_0x587d('0x32'),_0x5d3136['userProfileId'],_0x587d('0x33')));_0xa2b2a6[_0x587d('0x2b')](getAssociatedResources(_0x587d('0xe'),_0x5d3136['userProfileId'],_0x587d('0x2d')));_0xa2b2a6[_0x587d('0x2b')](getAssociatedResources(_0x587d('0xf'),_0x5d3136['userProfileId'],_0x587d('0x2e')));_0xa2b2a6[_0x587d('0x2b')](getAssociatedResources(_0x587d('0x10'),_0x5d3136[_0x587d('0x1e')],'WhatsappQueue'));_0xa2b2a6['push'](getAssociatedResources('Telephones',_0x5d3136[_0x587d('0x1e')],_0x587d('0x5')));_0xa2b2a6[_0x587d('0x2b')](getAssociatedResources(_0x587d('0x13'),_0x5d3136['userProfileId'],_0x587d('0x34')));_0xa2b2a6[_0x587d('0x2b')](getAssociatedResources('IvrCampaigns',_0x5d3136[_0x587d('0x1e')],_0x587d('0x18')));_0xa2b2a6[_0x587d('0x2b')](db[_0x587d('0x5')][_0x587d('0x12')](queryAgents));break;case _0x587d('0x7'):_0x45af9e[_0x443c5c](_0x587d('0x27'));_0x45af9e[_0x443c5c]('voice:outbound');_0xa2b2a6[_0x587d('0x2b')](_0x5d3136[_0x587d('0x35')]({'attributes':['id','name']}));_0xa2b2a6['push'](_0x5d3136[_0x587d('0x36')]({'attributes':['id',_0x587d('0x3')]}));_0xa2b2a6[_0x587d('0x2b')](_0x5d3136[_0x587d('0x37')]({'attributes':['id',_0x587d('0x3')]}));_0xa2b2a6[_0x587d('0x2b')](_0x5d3136[_0x587d('0x38')]({'attributes':['id',_0x587d('0x3')]}));_0xa2b2a6[_0x587d('0x2b')](_0x5d3136[_0x587d('0x39')]({'attributes':['id','name']}));_0xa2b2a6[_0x587d('0x2b')](_0x5d3136[_0x587d('0x3a')]({'attributes':['id','name']}));_0xa2b2a6['push'](_0x5d3136[_0x587d('0x3b')]({'attributes':['id',_0x587d('0x3')]}));break;}return BPromise['all'](_0xa2b2a6);}})['then'](function(_0x40b6ed){if(_0x40b6ed&&_0x40b6ed['length']){for(var _0x26deda=0x0;_0x26deda<_0x40b6ed[_0x587d('0x1a')];_0x26deda+=0x1){for(var _0x440bd5=0x0;_0x440bd5<_0x40b6ed[_0x26deda][_0x587d('0x1a')];_0x440bd5+=0x1){switch(_0x26deda){case 0x0:joinOrLeaveQueues(_0x45af9e,_0x443c5c,_0x587d('0x3c'),_0x40b6ed[_0x26deda][_0x440bd5]);break;case 0x1:joinOrLeaveQueues(_0x45af9e,_0x443c5c,'chat',_0x40b6ed[_0x26deda][_0x440bd5]);break;case 0x2:joinOrLeaveQueues(_0x45af9e,_0x443c5c,_0x587d('0x3d'),_0x40b6ed[_0x26deda][_0x440bd5]);break;case 0x3:joinOrLeaveQueues(_0x45af9e,_0x443c5c,'sms',_0x40b6ed[_0x26deda][_0x440bd5]);break;case 0x4:joinOrLeaveQueues(_0x45af9e,_0x443c5c,_0x587d('0x3e'),_0x40b6ed[_0x26deda][_0x440bd5]);break;case 0x5:joinOrLeaveQueues(_0x45af9e,_0x443c5c,_0x587d('0x3f'),_0x40b6ed[_0x26deda][_0x440bd5]);break;case 0x6:joinOrLeaveQueues(_0x45af9e,_0x443c5c,_0x587d('0x40'),_0x40b6ed[_0x26deda][_0x440bd5]);break;case 0x7:if(_0x2e8278[_0x587d('0x6')]!==_0x587d('0x7'))_0x45af9e[_0x443c5c](util[_0x587d('0x1b')](_0x587d('0x41'),_0x40b6ed[_0x26deda][_0x440bd5][_0x587d('0x3')]));break;case 0x8:if(_0x2e8278[_0x587d('0x6')]!==_0x587d('0x7'))_0x45af9e[_0x443c5c](util[_0x587d('0x1b')]('trunk:%s',_0x40b6ed[_0x26deda][_0x440bd5][_0x587d('0x3')]));break;case 0x9:if(_0x2e8278[_0x587d('0x6')]!=='agent')_0x45af9e[_0x443c5c](util[_0x587d('0x1b')]('campaign:%s:%s',_0x40b6ed[_0x26deda][_0x440bd5][_0x587d('0x8')],_0x40b6ed[_0x26deda][_0x440bd5][_0x587d('0x3')]));break;case 0xa:_0x45af9e[_0x443c5c](util['format'](_0x587d('0x42'),_0x40b6ed[_0x26deda][_0x440bd5][_0x587d('0x3')]));break;}}}}})[_0x587d('0xb')](function(){if(_0x443c5c===_0x587d('0x43')){var _0x561860=_[_0x587d('0x44')](_0x2e8278[_0x587d('0x1f')],'id');return _0x2e8278[_0x587d('0x45')](_0x561860)[_0x587d('0xb')](function(){for(var _0x4c57c9=0x0;_0x4c57c9<_0x561860[_0x587d('0x1a')];_0x4c57c9+=0x1){_0x3830a0[_0x587d('0x46')](_0x587d('0x47'),{'ChatInteractionId':Number(_0x561860[_0x4c57c9]),'UserId':Number(_0x2e8278['id'])});}});}})[_0x587d('0xb')](function(){if(_0x443c5c===_0x587d('0x43')){var _0x18e6f7=_[_0x587d('0x44')](_0x2e8278['MailInteractions'],'id');return _0x2e8278['removeMailInteractions'](_0x18e6f7)[_0x587d('0xb')](function(){for(var _0x8a671=0x0;_0x8a671<_0x18e6f7[_0x587d('0x1a')];_0x8a671+=0x1){_0x3830a0[_0x587d('0x46')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x18e6f7[_0x8a671]),'UserId':Number(_0x2e8278['id'])});}});}})['then'](function(){if(_0x443c5c==='leave'){var _0x39a4c0=_[_0x587d('0x44')](_0x2e8278[_0x587d('0x22')],'id');return _0x2e8278['removeFaxInteractions'](_0x39a4c0)[_0x587d('0xb')](function(){for(var _0x3053c3=0x0;_0x3053c3<_0x39a4c0[_0x587d('0x1a')];_0x3053c3+=0x1){_0x3830a0[_0x587d('0x46')](_0x587d('0x48'),{'FaxInteractionId':Number(_0x39a4c0[_0x3053c3]),'UserId':Number(_0x2e8278['id'])});}});}})[_0x587d('0xb')](function(){if(_0x443c5c===_0x587d('0x43')){var _0xb1b44b=_['map'](_0x2e8278[_0x587d('0x49')],'id');return _0x2e8278['removeSmsInteractions'](_0xb1b44b)[_0x587d('0xb')](function(){for(var _0x39b781=0x0;_0x39b781<_0xb1b44b[_0x587d('0x1a')];_0x39b781+=0x1){_0x3830a0[_0x587d('0x46')](_0x587d('0x4a'),{'SmsInteractionId':Number(_0xb1b44b[_0x39b781]),'UserId':Number(_0x2e8278['id'])});}});}})['then'](function(){if(_0x443c5c===_0x587d('0x43')){var _0x2ec4b9=_[_0x587d('0x44')](_0x2e8278[_0x587d('0x25')],'id');return _0x2e8278[_0x587d('0x4b')](_0x2ec4b9)[_0x587d('0xb')](function(){for(var _0x35be4c=0x0;_0x35be4c<_0x2ec4b9['length'];_0x35be4c+=0x1){_0x3830a0['emit'](_0x587d('0x4c'),{'OpenchannelInteractionId':Number(_0x2ec4b9[_0x35be4c]),'UserId':Number(_0x2e8278['id'])});}});}})[_0x587d('0xb')](function(){if(_0x443c5c===_0x587d('0x43')){var _0x2be479=_['map'](_0x2e8278[_0x587d('0x26')],'id');return _0x2e8278['removeWhatsappInteractions'](_0x2be479)[_0x587d('0xb')](function(){for(var _0x4b70a5=0x0;_0x4b70a5<_0x2be479['length'];_0x4b70a5+=0x1){_0x3830a0[_0x587d('0x46')](_0x587d('0x4d'),{'WhatsappInteractionId':Number(_0x2be479[_0x4b70a5]),'UserId':Number(_0x2e8278['id'])});}});}})['catch'](function(_0x401f69){_0x45af9e[_0x587d('0x4e')](_0x401f69);});}}function onDisconnect(_0x52a00e,_0x4d0a7a){joinOrLeave(_0x52a00e,'leave',_0x4d0a7a);}function onConnect(_0xf93849){joinOrLeave(_0xf93849,_0x587d('0x4f'));}exports[_0x587d('0x50')]=function(_0x4e71d4){_0x4e71d4['on'](_0x587d('0x51'),function(_0x300608){_0x300608[_0x587d('0x52')](0x0);_0x300608[_0x587d('0x53')]=_0x300608['request'][_0x587d('0x51')]['remoteAddress']+':'+_0x300608['request'][_0x587d('0x51')][_0x587d('0x54')];_0x300608[_0x587d('0x55')]=new Date();_0x300608[_0x587d('0x4e')]=function(_0x4744e3){console[_0x587d('0x4e')](_0x587d('0x56')+_0x300608[_0x587d('0x57')][_0x587d('0x3')]+'['+_0x300608[_0x587d('0x53')]+']',_0x4744e3);};_0x300608['on'](_0x587d('0x58'),function(){onDisconnect(_0x300608,_0x4e71d4);_0x300608['log'](_0x587d('0x59'));});onConnect(_0x300608);_0x300608['log'](_0x587d('0x5a'));});}; \ No newline at end of file +var _0xc7bd=['trunk:%s','campaign:%s:%s','map','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','log','nsp','disconnect','DISCONNECTED','CONNECTED','util','bluebird','./environment','Agents','name','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','UserProfileResource','resourceId','User','where','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','include','push','ChatQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','user','voice:outbound','VoiceQueues','FaxQueue','Trunks','Trunk','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s'];(function(_0xf967e,_0x17f590){var _0x5347f6=function(_0x19fad4){while(--_0x19fad4){_0xf967e['push'](_0xf967e['shift']());}};_0x5347f6(++_0x17f590);}(_0xc7bd,0x86));var _0xdc7b=function(_0x14599f,_0x493e80){_0x14599f=_0x14599f-0x0;var _0x34249a=_0xc7bd[_0x14599f];return _0x34249a;};'use strict';var _=require('lodash');var util=require(_0xdc7b('0x0'));var BPromise=require(_0xdc7b('0x1'));var db=require('../mysqldb')['db'];var config=require(_0xdc7b('0x2'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xdc7b('0x3'),'model':db['User'],'attributes':['id',_0xdc7b('0x4'),_0xdc7b('0x5')],'raw':!![],'where':{'role':_0xdc7b('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xdc7b('0x4')],'where':{'role':_0xdc7b('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xdc7b('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xdc7b('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xdc7b('0x4'),_0xdc7b('0x8')],'where':{'type':_0xdc7b('0x9')}};function getAssociatedResources(_0x587be8,_0x5cff75,_0x2272b6){return db[_0xdc7b('0xa')][_0xdc7b('0xb')]({'where':{'name':_0x587be8,'userProfileId':_0x5cff75},'raw':!![]})[_0xdc7b('0xc')](function(_0xec8041){if(_0xec8041){if(_0xec8041[_0xdc7b('0xd')]){switch(_0x587be8){case'VoiceQueues':case _0xdc7b('0xe'):case _0xdc7b('0xf'):case _0xdc7b('0x10'):case _0xdc7b('0x11'):case _0xdc7b('0x12'):case _0xdc7b('0x13'):return db[_0x2272b6]['findAll'](queryQueues);case _0xdc7b('0x14'):return db[_0x2272b6][_0xdc7b('0x15')](queryTelephones);case'Trunks':return db[_0x2272b6][_0xdc7b('0x15')](queryTrunks);case'IvrCampaigns':return db[_0x2272b6][_0xdc7b('0x15')](queryCampaigns);}}else{return db[_0xdc7b('0x16')][_0xdc7b('0x15')]({'attributes':[_0xdc7b('0x17')],'where':{'sectionId':_0xec8041['id']},'raw':!![]})['then'](function(_0x152ec8){if(_0x152ec8){var _0x2088f1={'where':{'id':_['map'](_0x152ec8,_0xdc7b('0x17'))},'raw':!![]};switch(_0x2272b6){case _0xdc7b('0x18'):_0x2088f1[_0xdc7b('0x19')][_0xdc7b('0x5')]=_0xdc7b('0x7');break;case _0xdc7b('0x1a'):_0x2088f1[_0xdc7b('0x19')][_0xdc7b('0x8')]='ivr';break;}return db[_0x2272b6][_0xdc7b('0x15')](_0x2088f1);}else{return[];}});}}else{return[];}})['then'](function(_0x15bd61){return _0x15bd61;});}function joinOrLeaveQueues(_0x5bcc30,_0x46e187,_0x435c3a,_0x3e8420){_0x5bcc30[_0x46e187](util[_0xdc7b('0x1b')](_0xdc7b('0x1c'),_0x435c3a,_0x3e8420['name']));if(_0x3e8420['Agents']){for(var _0x500458=0x0;_0x500458<_0x3e8420[_0xdc7b('0x3')][_0xdc7b('0x1d')];_0x500458+=0x1){_0x5bcc30[_0x46e187](util['format'](_0xdc7b('0x1e'),_0x3e8420[_0xdc7b('0x3')][_0x500458][_0xdc7b('0x4')]));}}}function joinOrLeave(_0x5b1de5,_0x3c1783,_0x4c6d14){var _0x3b3d3d;if(_0x5b1de5[_0xdc7b('0x1f')][_0xdc7b('0x20')]['id']){db[_0xdc7b('0x18')][_0xdc7b('0x21')]({'attributes':['id',_0xdc7b('0x4'),_0xdc7b('0x5'),_0xdc7b('0x22')],'where':{'id':_0x5b1de5[_0xdc7b('0x1f')]['query']['id']},'include':[{'model':db[_0xdc7b('0x23')],'as':_0xdc7b('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xdc7b('0x25')],'as':_0xdc7b('0x26'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xdc7b('0x27'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xdc7b('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xdc7b('0x29')],'as':_0xdc7b('0x2a'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xdc7b('0x2b'),'attributes':['id'],'raw':!![]}]})[_0xdc7b('0xc')](function(_0x2cfd85){if(_0x2cfd85){_0x3b3d3d=_0x2cfd85;_0x5b1de5[_0x3c1783](util[_0xdc7b('0x1b')](_0xdc7b('0x1e'),_0x2cfd85['name']));var _0x3d3751=[];switch(_0x2cfd85[_0xdc7b('0x5')]){case _0xdc7b('0x2c'):_0x5b1de5[_0x3c1783](_0xdc7b('0x2d'));_0x5b1de5[_0x3c1783]('voice:outbound');if(queryQueues[_0xdc7b('0x2e')](_0xdc7b('0x2f'))){delete queryQueues[_0xdc7b('0x2f')];}_0x3d3751[_0xdc7b('0x30')](db['VoiceQueue'][_0xdc7b('0x15')](queryQueues));_0x3d3751[_0xdc7b('0x30')](db[_0xdc7b('0x31')][_0xdc7b('0x15')](queryQueues));_0x3d3751[_0xdc7b('0x30')](db['FaxQueue'][_0xdc7b('0x15')](queryQueues));_0x3d3751['push'](db[_0xdc7b('0x32')][_0xdc7b('0x15')](queryQueues));_0x3d3751[_0xdc7b('0x30')](db['MailQueue'][_0xdc7b('0x15')](queryQueues));_0x3d3751[_0xdc7b('0x30')](db[_0xdc7b('0x33')]['findAll'](queryQueues));_0x3d3751[_0xdc7b('0x30')](db[_0xdc7b('0x34')]['findAll'](queryQueues));_0x3d3751[_0xdc7b('0x30')](db['User'][_0xdc7b('0x15')](queryTelephones));_0x3d3751[_0xdc7b('0x30')](db['Trunk'][_0xdc7b('0x15')](queryTrunks));_0x3d3751[_0xdc7b('0x30')](db[_0xdc7b('0x1a')][_0xdc7b('0x15')](queryCampaigns));_0x3d3751[_0xdc7b('0x30')](db[_0xdc7b('0x18')][_0xdc7b('0x15')](queryAgents));break;case _0xdc7b('0x35'):_0x5b1de5[_0x3c1783]('voice:inbound');_0x5b1de5[_0x3c1783](_0xdc7b('0x36'));_0x3d3751[_0xdc7b('0x30')](getAssociatedResources(_0xdc7b('0x37'),_0x2cfd85['userProfileId'],'VoiceQueue'));_0x3d3751['push'](getAssociatedResources(_0xdc7b('0xe'),_0x2cfd85[_0xdc7b('0x22')],_0xdc7b('0x31')));_0x3d3751[_0xdc7b('0x30')](getAssociatedResources(_0xdc7b('0xf'),_0x2cfd85[_0xdc7b('0x22')],_0xdc7b('0x38')));_0x3d3751[_0xdc7b('0x30')](getAssociatedResources(_0xdc7b('0x10'),_0x2cfd85[_0xdc7b('0x22')],'SmsQueue'));_0x3d3751[_0xdc7b('0x30')](getAssociatedResources(_0xdc7b('0x11'),_0x2cfd85['userProfileId'],'MailQueue'));_0x3d3751[_0xdc7b('0x30')](getAssociatedResources(_0xdc7b('0x12'),_0x2cfd85[_0xdc7b('0x22')],_0xdc7b('0x33')));_0x3d3751[_0xdc7b('0x30')](getAssociatedResources(_0xdc7b('0x13'),_0x2cfd85[_0xdc7b('0x22')],_0xdc7b('0x34')));_0x3d3751[_0xdc7b('0x30')](getAssociatedResources(_0xdc7b('0x14'),_0x2cfd85['userProfileId'],_0xdc7b('0x18')));_0x3d3751[_0xdc7b('0x30')](getAssociatedResources(_0xdc7b('0x39'),_0x2cfd85['userProfileId'],_0xdc7b('0x3a')));_0x3d3751[_0xdc7b('0x30')](getAssociatedResources(_0xdc7b('0x3b'),_0x2cfd85[_0xdc7b('0x22')],_0xdc7b('0x1a')));_0x3d3751[_0xdc7b('0x30')](db[_0xdc7b('0x18')][_0xdc7b('0x15')](queryAgents));break;case _0xdc7b('0x6'):_0x5b1de5[_0x3c1783](_0xdc7b('0x2d'));_0x5b1de5[_0x3c1783]('voice:outbound');_0x3d3751[_0xdc7b('0x30')](_0x2cfd85[_0xdc7b('0x3c')]({'attributes':['id',_0xdc7b('0x4')]}));_0x3d3751[_0xdc7b('0x30')](_0x2cfd85[_0xdc7b('0x3d')]({'attributes':['id','name']}));_0x3d3751[_0xdc7b('0x30')](_0x2cfd85[_0xdc7b('0x3e')]({'attributes':['id',_0xdc7b('0x4')]}));_0x3d3751['push'](_0x2cfd85[_0xdc7b('0x3f')]({'attributes':['id',_0xdc7b('0x4')]}));_0x3d3751[_0xdc7b('0x30')](_0x2cfd85[_0xdc7b('0x40')]({'attributes':['id','name']}));_0x3d3751['push'](_0x2cfd85[_0xdc7b('0x41')]({'attributes':['id','name']}));_0x3d3751['push'](_0x2cfd85[_0xdc7b('0x42')]({'attributes':['id',_0xdc7b('0x4')]}));break;}return BPromise[_0xdc7b('0x43')](_0x3d3751);}})[_0xdc7b('0xc')](function(_0x3338f2){if(_0x3338f2&&_0x3338f2[_0xdc7b('0x1d')]){for(var _0x503aa4=0x0;_0x503aa4<_0x3338f2['length'];_0x503aa4+=0x1){for(var _0x1f3063=0x0;_0x1f3063<_0x3338f2[_0x503aa4][_0xdc7b('0x1d')];_0x1f3063+=0x1){switch(_0x503aa4){case 0x0:joinOrLeaveQueues(_0x5b1de5,_0x3c1783,_0xdc7b('0x44'),_0x3338f2[_0x503aa4][_0x1f3063]);break;case 0x1:joinOrLeaveQueues(_0x5b1de5,_0x3c1783,_0xdc7b('0x45'),_0x3338f2[_0x503aa4][_0x1f3063]);break;case 0x2:joinOrLeaveQueues(_0x5b1de5,_0x3c1783,_0xdc7b('0x46'),_0x3338f2[_0x503aa4][_0x1f3063]);break;case 0x3:joinOrLeaveQueues(_0x5b1de5,_0x3c1783,_0xdc7b('0x47'),_0x3338f2[_0x503aa4][_0x1f3063]);break;case 0x4:joinOrLeaveQueues(_0x5b1de5,_0x3c1783,_0xdc7b('0x48'),_0x3338f2[_0x503aa4][_0x1f3063]);break;case 0x5:joinOrLeaveQueues(_0x5b1de5,_0x3c1783,_0xdc7b('0x49'),_0x3338f2[_0x503aa4][_0x1f3063]);break;case 0x6:joinOrLeaveQueues(_0x5b1de5,_0x3c1783,_0xdc7b('0x4a'),_0x3338f2[_0x503aa4][_0x1f3063]);break;case 0x7:if(_0x3b3d3d[_0xdc7b('0x5')]!==_0xdc7b('0x6'))_0x5b1de5[_0x3c1783](util['format'](_0xdc7b('0x4b'),_0x3338f2[_0x503aa4][_0x1f3063][_0xdc7b('0x4')]));break;case 0x8:if(_0x3b3d3d['role']!=='agent')_0x5b1de5[_0x3c1783](util[_0xdc7b('0x1b')](_0xdc7b('0x4c'),_0x3338f2[_0x503aa4][_0x1f3063][_0xdc7b('0x4')]));break;case 0x9:if(_0x3b3d3d[_0xdc7b('0x5')]!==_0xdc7b('0x6'))_0x5b1de5[_0x3c1783](util[_0xdc7b('0x1b')](_0xdc7b('0x4d'),_0x3338f2[_0x503aa4][_0x1f3063][_0xdc7b('0x8')],_0x3338f2[_0x503aa4][_0x1f3063]['name']));break;case 0xa:_0x5b1de5[_0x3c1783](util['format'](_0xdc7b('0x1e'),_0x3338f2[_0x503aa4][_0x1f3063][_0xdc7b('0x4')]));break;}}}}})[_0xdc7b('0xc')](function(){if(_0x3c1783==='leave'){var _0x5e8331=_[_0xdc7b('0x4e')](_0x3b3d3d[_0xdc7b('0x24')],'id');return _0x3b3d3d['removeChatInteractions'](_0x5e8331)[_0xdc7b('0xc')](function(){for(var _0x1c7749=0x0;_0x1c7749<_0x5e8331['length'];_0x1c7749+=0x1){_0x4c6d14[_0xdc7b('0x4f')](_0xdc7b('0x50'),{'ChatInteractionId':Number(_0x5e8331[_0x1c7749]),'UserId':Number(_0x3b3d3d['id'])});}});}})[_0xdc7b('0xc')](function(){if(_0x3c1783===_0xdc7b('0x51')){var _0x4956a1=_[_0xdc7b('0x4e')](_0x3b3d3d[_0xdc7b('0x26')],'id');return _0x3b3d3d[_0xdc7b('0x52')](_0x4956a1)[_0xdc7b('0xc')](function(){for(var _0x5bd3af=0x0;_0x5bd3af<_0x4956a1[_0xdc7b('0x1d')];_0x5bd3af+=0x1){_0x4c6d14[_0xdc7b('0x4f')](_0xdc7b('0x53'),{'MailInteractionId':Number(_0x4956a1[_0x5bd3af]),'UserId':Number(_0x3b3d3d['id'])});}});}})['then'](function(){if(_0x3c1783===_0xdc7b('0x51')){var _0x3bfc4c=_[_0xdc7b('0x4e')](_0x3b3d3d[_0xdc7b('0x27')],'id');return _0x3b3d3d[_0xdc7b('0x54')](_0x3bfc4c)['then'](function(){for(var _0xfdb787=0x0;_0xfdb787<_0x3bfc4c[_0xdc7b('0x1d')];_0xfdb787+=0x1){_0x4c6d14[_0xdc7b('0x4f')](_0xdc7b('0x55'),{'FaxInteractionId':Number(_0x3bfc4c[_0xfdb787]),'UserId':Number(_0x3b3d3d['id'])});}});}})[_0xdc7b('0xc')](function(){if(_0x3c1783===_0xdc7b('0x51')){var _0x12937e=_[_0xdc7b('0x4e')](_0x3b3d3d['SmsInteractions'],'id');return _0x3b3d3d[_0xdc7b('0x56')](_0x12937e)[_0xdc7b('0xc')](function(){for(var _0x3a0e46=0x0;_0x3a0e46<_0x12937e[_0xdc7b('0x1d')];_0x3a0e46+=0x1){_0x4c6d14[_0xdc7b('0x4f')](_0xdc7b('0x57'),{'SmsInteractionId':Number(_0x12937e[_0x3a0e46]),'UserId':Number(_0x3b3d3d['id'])});}});}})[_0xdc7b('0xc')](function(){if(_0x3c1783===_0xdc7b('0x51')){var _0xfeeda4=_[_0xdc7b('0x4e')](_0x3b3d3d[_0xdc7b('0x2a')],'id');return _0x3b3d3d[_0xdc7b('0x58')](_0xfeeda4)['then'](function(){for(var _0xd37083=0x0;_0xd37083<_0xfeeda4['length'];_0xd37083+=0x1){_0x4c6d14[_0xdc7b('0x4f')](_0xdc7b('0x59'),{'OpenchannelInteractionId':Number(_0xfeeda4[_0xd37083]),'UserId':Number(_0x3b3d3d['id'])});}});}})['then'](function(){if(_0x3c1783===_0xdc7b('0x51')){var _0xd13ed5=_[_0xdc7b('0x4e')](_0x3b3d3d[_0xdc7b('0x2b')],'id');return _0x3b3d3d[_0xdc7b('0x5a')](_0xd13ed5)[_0xdc7b('0xc')](function(){for(var _0x2c2021=0x0;_0x2c2021<_0xd13ed5[_0xdc7b('0x1d')];_0x2c2021+=0x1){_0x4c6d14[_0xdc7b('0x4f')](_0xdc7b('0x5b'),{'WhatsappInteractionId':Number(_0xd13ed5[_0x2c2021]),'UserId':Number(_0x3b3d3d['id'])});}});}})[_0xdc7b('0x5c')](function(_0x1d6dad){_0x5b1de5['log'](_0x1d6dad);});}}function onDisconnect(_0x59a484,_0x2c5197){joinOrLeave(_0x59a484,_0xdc7b('0x51'),_0x2c5197);}function onConnect(_0x488a36){joinOrLeave(_0x488a36,'join');}exports['default']=function(_0x3e7293){_0x3e7293['on'](_0xdc7b('0x5d'),function(_0x5867da){_0x5867da[_0xdc7b('0x5e')](0x0);_0x5867da[_0xdc7b('0x5f')]=_0x5867da[_0xdc7b('0x60')][_0xdc7b('0x5d')][_0xdc7b('0x61')]+':'+_0x5867da[_0xdc7b('0x60')][_0xdc7b('0x5d')][_0xdc7b('0x62')];_0x5867da[_0xdc7b('0x63')]=new Date();_0x5867da[_0xdc7b('0x64')]=function(_0x41ab18){console['log']('SocketIO\x20'+_0x5867da[_0xdc7b('0x65')]['name']+'['+_0x5867da[_0xdc7b('0x5f')]+']',_0x41ab18);};_0x5867da['on'](_0xdc7b('0x66'),function(){onDisconnect(_0x5867da,_0x3e7293);_0x5867da['log'](_0xdc7b('0x67'));});onConnect(_0x5867da);_0x5867da['log'](_0xdc7b('0x68'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index db46d5f..cd719e9 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 _0x2548=['error','code','Trigger,\x20%s','catch','channel','motionChannel','event','direction','resolve','then','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','contact','UserId','interface','format','name','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','get','sequelize','query','SIP/%s','agent','AfterCreate','closed','changed','substatus','SELECT','User','find','fullname','email','internal','length','hasOwnProperty','model','hook','callback','condition','../../mysqldb','jayson/promise','client','Chat','afterCreate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','newinteraction','afterUpdate','SmsMessage','WhatsappInteraction','Whatsapp','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','info','EventManager'];(function(_0x392266,_0x33dee2){var _0x1f91fe=function(_0x176b04){while(--_0x176b04){_0x392266['push'](_0x392266['shift']());}};_0x1f91fe(++_0x33dee2);}(_0x2548,0x1d1));var _0x8254=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2548[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var db=require(_0x8254('0x0'))['db'];var jayson=require(_0x8254('0x1'));var logger=require('../logger')('triggers');var client=jayson[_0x8254('0x2')]['http']({'port':0x232a});var triggers=[{'channel':_0x8254('0x3'),'model':'ChatInteraction','event':_0x8254('0x4'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x8254('0x3'),'model':'ChatInteraction','event':'afterUpdate','condition':_0x8254('0x5'),'callback':afterUpdate},{'channel':_0x8254('0x3'),'model':_0x8254('0x6'),'event':_0x8254('0x4'),'condition':_0x8254('0x7'),'callback':afterCreateMessage},{'channel':_0x8254('0x3'),'model':'ChatOfflineMessage','event':_0x8254('0x4'),'condition':_0x8254('0x7'),'callback':afterCreateOfflineMessage},{'channel':_0x8254('0x8'),'model':_0x8254('0x9'),'event':'afterCreate','condition':_0x8254('0xa'),'callback':afterCreate},{'channel':_0x8254('0x8'),'model':_0x8254('0x9'),'event':_0x8254('0xb'),'condition':_0x8254('0x5'),'callback':afterUpdate},{'channel':_0x8254('0x8'),'model':_0x8254('0xc'),'event':_0x8254('0x4'),'condition':_0x8254('0x7'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x8254('0xd'),'event':_0x8254('0x4'),'condition':_0x8254('0xa'),'callback':afterCreate},{'channel':_0x8254('0xe'),'model':'WhatsappInteraction','event':_0x8254('0xb'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Whatsapp','model':'WhatsappMessage','event':_0x8254('0x4'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x8254('0xf'),'model':_0x8254('0x10'),'event':_0x8254('0x4'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x8254('0xf'),'model':_0x8254('0x10'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x8254('0xf'),'model':_0x8254('0x11'),'event':_0x8254('0x4'),'condition':_0x8254('0x7'),'callback':afterCreateMessage},{'channel':_0x8254('0x12'),'model':_0x8254('0x13'),'event':_0x8254('0x4'),'condition':_0x8254('0xa'),'callback':afterCreate},{'channel':_0x8254('0x12'),'model':'MailInteraction','event':_0x8254('0xb'),'condition':_0x8254('0x5'),'callback':afterUpdate},{'channel':'Mail','model':_0x8254('0x14'),'event':_0x8254('0x4'),'condition':_0x8254('0x7'),'callback':afterCreateMessage},{'channel':_0x8254('0x15'),'model':_0x8254('0x16'),'event':_0x8254('0x4'),'condition':_0x8254('0xa'),'callback':afterCreate},{'channel':_0x8254('0x15'),'model':_0x8254('0x16'),'event':'afterUpdate','condition':_0x8254('0x5'),'callback':afterUpdate},{'channel':_0x8254('0x15'),'model':'OpenchannelMessage','event':_0x8254('0x4'),'condition':_0x8254('0x7'),'callback':afterCreateMessage}];function request(_0x4341a4){return client['request']('EventManager',_0x4341a4)['then'](function(_0x4fbb32){logger[_0x8254('0x17')]('Trigger,\x20%s',_0x8254('0x18'),_0x4fbb32);if(_0x4fbb32[_0x8254('0x19')]){if(_0x4fbb32['error'][_0x8254('0x1a')]===0x1f4){logger['error'](_0x8254('0x1b'),'EventManager',_0x4fbb32['error']);}}})[_0x8254('0x1c')](function(_0x3f56fd){logger[_0x8254('0x19')](_0x8254('0x1b'),_0x8254('0x18'),_0x3f56fd);});}function afterCreateMessage(_0x4dc5e1){return function(_0x4c97c9){_0x4c97c9=_0x4c97c9['get']({'plain':!![]});_0x4c97c9[_0x8254('0x1d')]=_0x4dc5e1;_0x4c97c9[_0x8254('0x1e')]=_0x4dc5e1;_0x4c97c9[_0x8254('0x1f')]=_0x4c97c9[_0x8254('0x20')];Promise[_0x8254('0x21')]()[_0x8254('0x22')](function(){if(typeof _0x4c97c9[_0x8254('0x23')]===_0x8254('0x24'))return null;var _0x1f1475=_0x8254('0x25')+_0x4c97c9[_0x8254('0x23')];return db['sequelize']['query'](_0x1f1475,{'type':db[_0x8254('0x26')][_0x8254('0x27')]['SELECT'],'raw':!![]});})['then'](function(_0x38f227){if(_0x38f227){_0x4c97c9[_0x8254('0x28')]=_0x38f227[0x0];}if(typeof _0x4c97c9[_0x8254('0x29')]==='undefined')return;return getAgent(_0x4c97c9[_0x8254('0x29')]);})[_0x8254('0x22')](function(_0x5c3a86){if(_0x5c3a86){_0x4c97c9[_0x8254('0x2a')]=util[_0x8254('0x2b')]('SIP/%s',_0x5c3a86[_0x8254('0x2c')]);_0x4c97c9['agent']=_0x5c3a86;_0x4c97c9[_0x8254('0x1d')]=_0x4dc5e1;return request({'event':_0x8254('0x2d'),'message':_0x4c97c9});}else{return request({'event':_0x8254('0x2e'),'message':_0x4c97c9});}})['catch'](function(_0x1f14e8){logger[_0x8254('0x19')](_0x8254('0x1b'),_0x8254('0x2f'),_0x1f14e8);});};}function afterCreateOfflineMessage(_0x5d5f15){return function(_0x1f0e7e){_0x1f0e7e=_0x1f0e7e['get']({'plain':!![]});_0x1f0e7e[_0x8254('0x1d')]=_0x5d5f15;_0x1f0e7e[_0x8254('0x1e')]=_0x5d5f15;_0x1f0e7e['event']=_0x8254('0x30');return request({'event':_0x1f0e7e[_0x8254('0x1f')],'message':_0x1f0e7e});};}function afterCreate(_0x7c5f00,_0x41dd3d){return function(_0x4e9d80){_0x4e9d80=_0x4e9d80[_0x8254('0x31')]({'plain':!![]});_0x4e9d80[_0x8254('0x1d')]=_0x7c5f00;_0x4e9d80[_0x8254('0x1e')]=_0x7c5f00;_0x4e9d80['event']='opened';Promise[_0x8254('0x21')]()[_0x8254('0x22')](function(){var _0x1afedd='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e9d80[_0x8254('0x23')];return db[_0x8254('0x32')][_0x8254('0x33')](_0x1afedd,{'type':db[_0x8254('0x26')]['QueryTypes']['SELECT'],'raw':!![]});})['then'](function(_0x4acd87){if(_0x4acd87){_0x4e9d80[_0x8254('0x28')]=_0x4acd87[0x0];}if(typeof _0x4e9d80[_0x8254('0x29')]===_0x8254('0x24'))return;return getAgent(_0x4e9d80[_0x8254('0x29')]);})[_0x8254('0x22')](function(_0x22c2df){if(_0x22c2df){_0x4e9d80[_0x8254('0x2a')]=util[_0x8254('0x2b')](_0x8254('0x34'),_0x22c2df[_0x8254('0x2c')]);_0x4e9d80[_0x8254('0x35')]=_0x22c2df;}return request({'event':_0x41dd3d,'message':_0x4e9d80});})[_0x8254('0x1c')](function(_0x2644a4){logger[_0x8254('0x19')]('Trigger,\x20%s',_0x8254('0x36'),_0x2644a4);});};}function afterUpdate(_0x472dab){return function(_0x13635c){var _0x13ea3a=_0x13635c['changed']('closed')&&_0x13635c[_0x8254('0x37')];var _0x319ce3=_0x13635c[_0x8254('0x38')](_0x8254('0x39'));if(_0x13ea3a||_0x319ce3){var _0x39d0d1=_0x13ea3a?_0x8254('0x5'):'substatus';var _0x547e1e=_0x13635c[_0x8254('0x31')]({'plain':!![]});_0x547e1e['channel']=_0x472dab;_0x547e1e[_0x8254('0x1e')]=_0x472dab;_0x547e1e[_0x8254('0x1f')]=_0x13ea3a?_0x8254('0x37'):_0x8254('0x39');var _0x5a3102=_0x8254('0x25')+_0x547e1e[_0x8254('0x23')];return db['sequelize'][_0x8254('0x33')](_0x5a3102,{'type':db['Sequelize'][_0x8254('0x27')][_0x8254('0x3a')],'raw':!![]})[_0x8254('0x22')](function(_0x2f46e5){if(_0x2f46e5){_0x547e1e[_0x8254('0x28')]=_0x2f46e5[0x0];}if(typeof _0x547e1e[_0x8254('0x29')]==='undefined')return;return getAgent(_0x547e1e[_0x8254('0x29')]);})[_0x8254('0x22')](function(_0x704b8a){if(_0x704b8a){_0x547e1e[_0x8254('0x2a')]=util[_0x8254('0x2b')](_0x8254('0x34'),_0x704b8a[_0x8254('0x2c')]);_0x547e1e[_0x8254('0x35')]=_0x704b8a;}return request({'event':_0x39d0d1,'message':_0x547e1e});})[_0x8254('0x1c')](function(_0x449247){logger['error'](_0x8254('0x1b'),'AfterUpdate',_0x449247);});}};}function getAgent(_0x5b357e){return db[_0x8254('0x3b')][_0x8254('0x3c')]({'where':{'id':_0x5b357e},'attributes':['id',_0x8254('0x2c'),_0x8254('0x3d'),_0x8254('0x3e'),_0x8254('0x3f')],'raw':!![]})[_0x8254('0x22')](function(_0x3aaaaa){return _0x3aaaaa;});}exports['default']=function(){for(var _0x2f4d97=0x0;_0x2f4d97=_0x5ae5bd[_0x9ea1('0x12')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x18dbe2(_0x5d1639);})[_0x9ea1('0x13')](function(_0xf865bf){_0x448bcb(_0xf865bf);});});}; \ No newline at end of file +var _0x8d9d=['sms','whatsapp','openchannel','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','updateAttributes','getLicense','role','agent','User','count','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','../mysqldb','./license/util','voice','chat','fax'];(function(_0x5173b3,_0x26273d){var _0x16d4d7=function(_0x205197){while(--_0x205197){_0x5173b3['push'](_0x5173b3['shift']());}};_0x16d4d7(++_0x26273d);}(_0x8d9d,0xf6));var _0xd8d9=function(_0x45417d,_0x497ddf){_0x45417d=_0x45417d-0x0;var _0x47a6af=_0x8d9d[_0x45417d];return _0x47a6af;};'use strict';var _=require(_0xd8d9('0x0'));var BPromise=require(_0xd8d9('0x1'));var db=require(_0xd8d9('0x2'))['db'];var util=require(_0xd8d9('0x3'));var channels=[_0xd8d9('0x4'),'mail',_0xd8d9('0x5'),_0xd8d9('0x6'),_0xd8d9('0x7'),_0xd8d9('0x8'),_0xd8d9('0x9')];exports['getChannels']=function(){return channels;};exports[_0xd8d9('0xa')]=function(_0xdf9ea){_0xdf9ea=_0xdf9ea[_0xd8d9('0xb')]();return _[_0xd8d9('0xc')](channels,_0xdf9ea);};exports[_0xd8d9('0xd')]=function(_0x14168b,_0x49a468,_0x4a8240,_0x33adb7){var _0x3bd596={'loginAttempts':_0x49a468,'blocked':_0x4a8240};if(!_[_0xd8d9('0xe')](_0x33adb7)){_0x3bd596['blockedAt']=_0x33adb7;}return _0x14168b[_0xd8d9('0xf')](_0x3bd596);};exports[_0xd8d9('0x10')]=function(_0x33d24a){return new BPromise(function(_0x3613a9,_0x128601){var _0x5753ee=0x0;if(_0x33d24a[_0xd8d9('0x11')]!==_0xd8d9('0x12')){_0x3613a9(_0x33d24a);}db[_0xd8d9('0x13')][_0xd8d9('0x14')]({'where':{'role':_0xd8d9('0x12'),'online':!![],'id':{'$ne':_0x33d24a['id']}}})['then'](function(_0x480111){_0x5753ee=_0x480111;return util[_0xd8d9('0x10')]();})['then'](function(_0x4ddb85){if(_0x4ddb85&&_0x4ddb85[_0xd8d9('0x15')]&&_0x5753ee>=_0x4ddb85[_0xd8d9('0x15')]){throw Error(_0xd8d9('0x16'));}_0x3613a9(_0x33d24a);})['catch'](function(_0x439da3){_0x128601(_0x439da3);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index f891656..d4974ca 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf351=['Bad\x20Request','Forbidden','Entity\x20not\x20found','OutOfInterval','Resource\x20Conflict','Out\x20Of\x20Interval','Not\x20Found','Conflict','send','exports','util','api','message','Internal\x20Server\x20Error','name','Error','inherits'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0xf351,0x1a2));var _0x1f35=function(_0x1fc84d,_0x3f469d){_0x1fc84d=_0x1fc84d-0x0;var _0x2658fa=_0xf351[_0x1fc84d];return _0x2658fa;};'use strict';var util=require(_0x1f35('0x0'));var logger=require('../config/logger')(_0x1f35('0x1'));var APIError=function(_0x5530cd,_0x4eb9a7){this[_0x1f35('0x2')]=_0x5530cd||_0x1f35('0x3');this[_0x1f35('0x4')]=_0x4eb9a7||_0x1f35('0x5');util[_0x1f35('0x6')](APIError,Error);};var APIBadRequestError=function(_0x139b85){this[_0x1f35('0x2')]=_0x139b85||_0x1f35('0x7');this['name']=_0x1f35('0x7');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x28b33b){this['message']=_0x28b33b||_0x1f35('0x8');this[_0x1f35('0x4')]=_0x1f35('0x8');util[_0x1f35('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x13261d){this[_0x1f35('0x2')]=_0x13261d||_0x1f35('0x9');this[_0x1f35('0x4')]='Not\x20Found';util[_0x1f35('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x25d8fd){this['message']=_0x25d8fd||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0x1f35('0x4')]='Out\x20Of\x20Interval';this['code']=0x193;this['details']={'type':_0x1f35('0xa')};util[_0x1f35('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x122204){this['message']=_0x122204||_0x1f35('0xb');this[_0x1f35('0x4')]='Conflict';util[_0x1f35('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x46835a){switch(_0x46835a){case _0x1f35('0x7'):return 0x190;case _0x1f35('0x8'),_0x1f35('0xc'):return 0x193;case _0x1f35('0xd'):return 0x194;case _0x1f35('0xe'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x56a43f){if(_0x56a43f===_0x1f35('0xc'))return _0x56a43f;return null;}function handleError(_0x5e087f){return function(_0x325ea5){logger['error'](_0x325ea5['stack']);var _0x1eab9f=getStatusCode(_0x325ea5[_0x1f35('0x4')]);var _0x396373=getCustomStatusMessage(_0x325ea5[_0x1f35('0x4')]);if(_0x325ea5[_0x1f35('0x4')]){delete _0x325ea5[_0x1f35('0x4')];}if(_0x396373){_0x5e087f['statusMessage']=_0x396373;}return _0x5e087f['status'](_0x1eab9f)[_0x1f35('0xf')](_0x325ea5);};}module[_0x1f35('0x10')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x2dfe=['Error','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','code','details','OutOfInterval','Conflict','Out\x20Of\x20Interval','error','stack','statusMessage','status','send','exports','../config/logger','message','Internal\x20Server\x20Error','name'];(function(_0x336d54,_0x4cb876){var _0x571a8d=function(_0x3746f6){while(--_0x3746f6){_0x336d54['push'](_0x336d54['shift']());}};_0x571a8d(++_0x4cb876);}(_0x2dfe,0x15c));var _0xe2df=function(_0x144ae9,_0x4f551f){_0x144ae9=_0x144ae9-0x0;var _0x2bae3d=_0x2dfe[_0x144ae9];return _0x2bae3d;};'use strict';var util=require('util');var logger=require(_0xe2df('0x0'))('api');var APIError=function(_0x5180de,_0xb57227){this[_0xe2df('0x1')]=_0x5180de||_0xe2df('0x2');this[_0xe2df('0x3')]=_0xb57227||_0xe2df('0x4');util[_0xe2df('0x5')](APIError,Error);};var APIBadRequestError=function(_0x3ec5b3){this[_0xe2df('0x1')]=_0x3ec5b3||_0xe2df('0x6');this[_0xe2df('0x3')]='Bad\x20Request';util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x453d8d){this[_0xe2df('0x1')]=_0x453d8d||'Forbidden';this[_0xe2df('0x3')]=_0xe2df('0x7');util[_0xe2df('0x5')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x41a903){this[_0xe2df('0x1')]=_0x41a903||_0xe2df('0x8');this[_0xe2df('0x3')]=_0xe2df('0x9');util[_0xe2df('0x5')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x5c2e7b){this[_0xe2df('0x1')]=_0x5c2e7b||_0xe2df('0xa');this[_0xe2df('0x3')]='Out\x20Of\x20Interval';this[_0xe2df('0xb')]=0x193;this[_0xe2df('0xc')]={'type':_0xe2df('0xd')};util[_0xe2df('0x5')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x47c0f2){this['message']=_0x47c0f2||'Resource\x20Conflict';this['name']=_0xe2df('0xe');util[_0xe2df('0x5')](APIBadRequestError,APIError);};function getStatusCode(_0x30d542){switch(_0x30d542){case _0xe2df('0x6'):return 0x190;case _0xe2df('0x7'),_0xe2df('0xf'):return 0x193;case _0xe2df('0x9'):return 0x194;case _0xe2df('0xe'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x229347){if(_0x229347===_0xe2df('0xf'))return _0x229347;return null;}function handleError(_0x140de1){return function(_0x2c3af2){logger[_0xe2df('0x10')](_0x2c3af2[_0xe2df('0x11')]);var _0x777a93=getStatusCode(_0x2c3af2['name']);var _0x471a32=getCustomStatusMessage(_0x2c3af2[_0xe2df('0x3')]);if(_0x2c3af2[_0xe2df('0x3')]){delete _0x2c3af2[_0xe2df('0x3')];}if(_0x471a32){_0x140de1[_0xe2df('0x12')]=_0x471a32;}return _0x140de1[_0xe2df('0x13')](_0x777a93)[_0xe2df('0x14')](_0x2c3af2);};}module[_0xe2df('0x15')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index f164eb1..b0d7087 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f5f=['json','exports','404','status','render'];(function(_0x2dad3b,_0x15d88a){var _0x314df5=function(_0x5f4fc5){while(--_0x5f4fc5){_0x2dad3b['push'](_0x2dad3b['shift']());}};_0x314df5(++_0x15d88a);}(_0x5f5f,0x178));var _0xf5f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f5f[_0x3dd15e];return _0x231fd0;};'use strict';module[_0xf5f5('0x0')][0x194]=function pageNotFound(_0x5921d5,_0x4343b0){var _0xf0c0f0=_0xf5f5('0x1');var _0x5821d2=0x194;var _0x1f30f6={'status':_0x5821d2};_0x4343b0[_0xf5f5('0x2')](_0x1f30f6[_0xf5f5('0x2')]);_0x4343b0[_0xf5f5('0x3')](_0xf0c0f0,{},function(_0x350061,_0x1774bf){if(_0x350061){return _0x4343b0[_0xf5f5('0x2')](_0x1f30f6[_0xf5f5('0x2')])[_0xf5f5('0x4')](_0x1f30f6);}_0x4343b0['send'](_0x1774bf);});}; \ No newline at end of file +var _0x89c0=['send','exports','status'];(function(_0xe391aa,_0x255528){var _0x793c4d=function(_0x20556d){while(--_0x20556d){_0xe391aa['push'](_0xe391aa['shift']());}};_0x793c4d(++_0x255528);}(_0x89c0,0x130));var _0x089c=function(_0x4e20cc,_0x19e670){_0x4e20cc=_0x4e20cc-0x0;var _0x1c2206=_0x89c0[_0x4e20cc];return _0x1c2206;};'use strict';module[_0x089c('0x0')][0x194]=function pageNotFound(_0x3b6766,_0x135b53){var _0x53aac1='404';var _0x32b5a4=0x194;var _0x13ec5f={'status':_0x32b5a4};_0x135b53[_0x089c('0x1')](_0x13ec5f['status']);_0x135b53['render'](_0x53aac1,{},function(_0x3a5db1,_0x4b34f8){if(_0x3a5db1){return _0x135b53[_0x089c('0x1')](_0x13ec5f['status'])['json'](_0x13ec5f);}_0x135b53[_0x089c('0x2')](_0x4b34f8);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 29a563c..5a28df1 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc32d=['CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','Action','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','ContactItemType','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Trigger','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','Attachment','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','User','cascade','UserId','hasOne','UserSetting','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','Hoppers','SET\x20NULL','belongsTo','UserProfile','belongsToMany','chat_group_has_users','CmContact','cm_user_has_contacts','user_has_teams','user_has_mail_interactions','ChatInteraction','user_has_chat_interactions','user_has_fax_interactions','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','WhatsappAccounts','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopperFinal','HopperHistories','JscriptySessions','TrunkId','TrunkBackupId','Interval','mandatoryDispositionPause','Lists','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Dispositions','Answers','List','ListId','Template','mandatoryDispositionPauseId','Team','MailInteractionId','Contact','Tags','mail_interaction_has_tags','Interaction','Account','ChatWebsiteId','ChatOfflineMessageId','IntervalId','ContactId','Dashboard','Items','FaxAccountId','FaxAccount','Interactions','Exntensions','user_has_fax_accounts','TagId','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','SmsAccountId','SmsInteractionId','Owner','sms_interaction_has_tags','ThroughTags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Contacts','CompanyId','Phones','CmContactId','cm_contact_has_tags','CampaignId','Automation','OneAll','AutomationAllId','OneAny','AutomationAnyId','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','CmHopperId','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','AnalyticDefaultReport','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','int_desk_configuration_has_tags','VariableId','int_zendesk_configuration_has_tags','FreshdeskAccount','VtigerField','ServicenowConfiguration','ChatQueueReport','ToId','SessionId','ProjectId','VoiceQueues','team_has_mail_queues','team_has_fax_queues','WhatsappQueue','team_has_whatsapp_queues','HopperBlacks','TrunkBackup','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAccount','FromUserId','ToUserId','ToChatWebsiteId','FromFaxAccountId','ToAgent','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CmCustomField','Queues','cm_user_has_lists','userProfileId','UserProfileSections','Resources','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','user_has_whatsapp_interactions','ToWhatsappAccountId','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','determine','defaultsDeep','xcall','127.0.0.1','mysql','utf8mb4','utf8','sequelizeHistory','name','utf8_general_ci','database','password','options','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.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','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','OpenchannelAccount','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model'];(function(_0x256263,_0x502cfc){var _0x557cea=function(_0x2fb53e){while(--_0x2fb53e){_0x256263['push'](_0x256263['shift']());}};_0x557cea(++_0x502cfc);}(_0xc32d,0x188));var _0xdc32=function(_0x37f773,_0x45e82f){_0x37f773=_0x37f773-0x0;var _0x1a6b8d=_0xc32d[_0x37f773];return _0x1a6b8d;};'use strict';var config=require(_0xdc32('0x0'));var Sequelize=require(_0xdc32('0x1'));var _=require(_0xdc32('0x2'));var jstz=require('jstz');var timezone=jstz[_0xdc32('0x3')]();config[_0xdc32('0x1')]=_[_0xdc32('0x4')](config[_0xdc32('0x1')],{'database':'motion2','username':_0xdc32('0x5'),'password':'xC@LL1234','options':{'host':_0xdc32('0x6'),'port':0xcea,'dialect':_0xdc32('0x7'),'dialectOptions':{'charset':_0xdc32('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xdc32('0x9'),'collate':'utf8_general_ci'}}});config[_0xdc32('0xa')]=_[_0xdc32('0x4')](config[_0xdc32('0xa')],{'database':'motion2','username':_0xdc32('0x5'),'password':'xC@LL1234','options':{'host':_0xdc32('0x6'),'port':0xcea,'dialect':_0xdc32('0x7'),'dialectOptions':{'charset':_0xdc32('0x8')},'logging':![],'timezone':timezone[_0xdc32('0xb')](),'define':{'charset':_0xdc32('0x9'),'collate':_0xdc32('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xdc32('0x1')][_0xdc32('0xd')],config[_0xdc32('0x1')]['username'],config[_0xdc32('0x1')][_0xdc32('0xe')],config[_0xdc32('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xdc32('0xd')],config[_0xdc32('0xa')]['username'],config['sequelizeHistory'][_0xdc32('0xe')],config['sequelizeHistory'][_0xdc32('0xf')])};db['User']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x11'));db[_0xdc32('0x12')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x13'));db[_0xdc32('0x14')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x15'));db[_0xdc32('0x16')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x17'));db[_0xdc32('0x18')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x19'));db[_0xdc32('0x1a')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x1b'));db[_0xdc32('0x1c')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x1d'));db[_0xdc32('0x1e')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x1f'));db[_0xdc32('0x20')]=db[_0xdc32('0x1')]['import']('../api/voiceMail/voiceMail.model');db[_0xdc32('0x21')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xdc32('0x22')]=db[_0xdc32('0x1')]['import'](_0xdc32('0x23'));db['VoiceDialReport']=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x24'));db['VoiceQueueReport']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x25'));db['MemberReport']=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/memberReport/memberReport.model');db[_0xdc32('0x26')]=db['sequelize'][_0xdc32('0x10')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x27'));db[_0xdc32('0x28')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x29'));db[_0xdc32('0x2a')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xdc32('0x2b')]=db['sequelize']['import'](_0xdc32('0x2c'));db[_0xdc32('0x2d')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x2e'));db[_0xdc32('0x2f')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x30'));db[_0xdc32('0x31')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x32'));db[_0xdc32('0x33')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x34'));db[_0xdc32('0x35')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x36'));db[_0xdc32('0x37')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x38'));db['MailServerOut']=db['sequelize']['import'](_0xdc32('0x39'));db[_0xdc32('0x3a')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/mailAccount/mailAccount.model');db[_0xdc32('0x3b')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x3c'));db[_0xdc32('0x3d')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x3e'));db[_0xdc32('0x3f')]=db['sequelize']['import'](_0xdc32('0x40'));db[_0xdc32('0x41')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x42'));db[_0xdc32('0x43')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x44'));db[_0xdc32('0x45')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x46'));db['Dashboard']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x47'));db[_0xdc32('0x48')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x49'));db['FaxAccount']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x4a'));db[_0xdc32('0x4b')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x4c'));db[_0xdc32('0x4d')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x4e'));db[_0xdc32('0x4f')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x50'));db[_0xdc32('0x51')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x52'));db[_0xdc32('0x53')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x54'));db[_0xdc32('0x55')]=db[_0xdc32('0x1')]['import']('../api/smsAccount/smsAccount.model');db[_0xdc32('0x56')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x57'));db['SmsInteraction']=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x58'));db[_0xdc32('0x59')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x5a'));db['SmsQueue']=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/smsQueue/smsQueue.model');db[_0xdc32('0x5b')]=db['sequelize'][_0xdc32('0x10')]('../api/openchannelAccount/openchannelAccount.model');db['OpenchannelApplication']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x5c'));db[_0xdc32('0x5d')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x5e'));db[_0xdc32('0x5f')]=db[_0xdc32('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db[_0xdc32('0x60')]=db[_0xdc32('0x1')]['import'](_0xdc32('0x61'));db['ChatWebsite']=db[_0xdc32('0x1')]['import'](_0xdc32('0x62'));db[_0xdc32('0x63')]=db[_0xdc32('0x1')]['import'](_0xdc32('0x64'));db[_0xdc32('0x65')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x66'));db['ChatInteraction']=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x67'));db[_0xdc32('0x68')]=db['sequelize']['import'](_0xdc32('0x69'));db[_0xdc32('0x6a')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x6b'));db[_0xdc32('0x6c')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x6d'));db[_0xdc32('0x6e')]=db[_0xdc32('0x1')]['import'](_0xdc32('0x6f'));db['ChatProactiveAction']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x70'));db[_0xdc32('0x71')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x72'));db['CmContact']=db['sequelize']['import'](_0xdc32('0x73'));db[_0xdc32('0x74')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x75'));db[_0xdc32('0x76')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x77'));db['CmHopperFinal']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x78'));db[_0xdc32('0x79')]=db[_0xdc32('0x1')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0xdc32('0x7a')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x7b'));db['CmCustomField']=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/cmCustomField/cmCustomField.model');db[_0xdc32('0x7c')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/action/action.model');db['Automation']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x7d'));db[_0xdc32('0x7e')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x7f'));db[_0xdc32('0x80')]=db[_0xdc32('0x1')]['import']('../api/disposition/disposition.model');db[_0xdc32('0x81')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x82'));db['Interval']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x83'));db[_0xdc32('0x84')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x85'));db[_0xdc32('0x86')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x87'));db[_0xdc32('0x88')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x89'));db[_0xdc32('0x8a')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x8b'));db[_0xdc32('0x8c')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x8d'));db[_0xdc32('0x8e')]=db[_0xdc32('0x1')]['import']('../api/tag/tag.model');db[_0xdc32('0x8f')]=db['sequelize']['import']('../api/contactItemType/contactItemType.model');db[_0xdc32('0x90')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x91'));db[_0xdc32('0x92')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x93'));db['Template']=db[_0xdc32('0x1')]['import']('../api/template/template.model');db[_0xdc32('0x94')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/trigger/trigger.model');db[_0xdc32('0x95')]=db['sequelize'][_0xdc32('0x10')]('../api/variable/variable.model');db[_0xdc32('0x96')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x97'));db[_0xdc32('0x98')]=db[_0xdc32('0x1')]['import'](_0xdc32('0x99'));db['AnalyticCustomReport']=db[_0xdc32('0x1')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x9a'));db[_0xdc32('0x9b')]=db['sequelize']['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xdc32('0x9c')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x9d'));db[_0xdc32('0x9e')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x9f'));db[_0xdc32('0xa0')]=db['sequelize']['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0xdc32('0xa1')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xa2'));db['SalesforceConfiguration']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xa3'));db[_0xdc32('0xa4')]=db[_0xdc32('0x1')]['import']('../api/intSalesforceField/intSalesforceField.model');db[_0xdc32('0xa5')]=db['sequelize'][_0xdc32('0x10')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xdc32('0xa6')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xa7'));db[_0xdc32('0xa8')]=db[_0xdc32('0x1')]['import'](_0xdc32('0xa9'));db['DeskAccount']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xaa'));db[_0xdc32('0xab')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0xac'));db[_0xdc32('0xad')]=db[_0xdc32('0x1')]['import']('../api/intDeskField/intDeskField.model');db[_0xdc32('0xae')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xaf'));db[_0xdc32('0xb0')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xb1'));db[_0xdc32('0xb2')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/intZohoField/intZohoField.model');db[_0xdc32('0xb3')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0xb4'));db[_0xdc32('0xb5')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0xb6'));db[_0xdc32('0xb7')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0xb8'));db['FreshdeskAccount']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xb9'));db[_0xdc32('0xba')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xbb'));db[_0xdc32('0xbc')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xbd'));db[_0xdc32('0xbe')]=db[_0xdc32('0x1')]['import'](_0xdc32('0xbf'));db[_0xdc32('0xc0')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xc1'));db['VtigerField']=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/intVtigerField/intVtigerField.model');db[_0xdc32('0xc2')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xc3'));db['ServicenowConfiguration']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xc4'));db[_0xdc32('0xc5')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xc6'));db[_0xdc32('0xc7')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xc8'));db[_0xdc32('0xc9')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xdc32('0xca')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xcb'));db[_0xdc32('0xcc')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xdc32('0xcd')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xce'));db[_0xdc32('0xcf')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0xd0'));db[_0xdc32('0x96')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/integration/integration.model');db['Network']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xd1'));db['ChatQueueReport']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xd2'));db[_0xdc32('0xd3')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xd4'));db[_0xdc32('0xd5')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0xd6'));db[_0xdc32('0xd7')]=db[_0xdc32('0x1')]['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xdc32('0xd8')]=db['sequelize']['import'](_0xdc32('0xd9'));db[_0xdc32('0xda')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xdb'));db[_0xdc32('0xdc')]=db[_0xdc32('0x1')]['import']('../api/squareReport/squareReport.model');db[_0xdc32('0xdd')]=db['sequelize']['import'](_0xdc32('0xde'));db[_0xdc32('0xdf')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0xe0'));db[_0xdc32('0xe1')]=db['sequelize'][_0xdc32('0x10')]('../api/setting/setting.model');db[_0xdc32('0xe2')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xe3'));db[_0xdc32('0xe4')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xe5'));db[_0xdc32('0xe6')]=db[_0xdc32('0x1')]['import'](_0xdc32('0xe7'));db['SquareMessage']=db[_0xdc32('0x1')]['import']('../api/squareMessage/squareMessage.model');db['Team']=db[_0xdc32('0x1')]['import'](_0xdc32('0xe8'));db[_0xdc32('0xe9')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/license/license.model');db[_0xdc32('0xea')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0xeb'));db[_0xdc32('0xec')]=db['sequelize'][_0xdc32('0x10')]('../api/migration/migration.model');db[_0xdc32('0xed')]=db[_0xdc32('0x1')]['import']('../api/attachment/attachment.model');db[_0xdc32('0xee')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/plugin/plugin.model');db[_0xdc32('0xef')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xf0'));db[_0xdc32('0xf1')]=db[_0xdc32('0x1')]['import'](_0xdc32('0xf2'));db[_0xdc32('0xf3')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0xf4'));db[_0xdc32('0xf5')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0xf6'));db[_0xdc32('0xf7')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/smsTransferReport/smsTransferReport.model');db[_0xdc32('0xf8')]=db[_0xdc32('0x1')]['import']('../api/cmList/cmList.model');db[_0xdc32('0xf9')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xfa'));db['UserProfile']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xfb'));db[_0xdc32('0xfc')]=db[_0xdc32('0x1')]['import'](_0xdc32('0xfd'));db[_0xdc32('0xfe')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xff'));db[_0xdc32('0x100')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x101'));db[_0xdc32('0x102')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x103'));db[_0xdc32('0x104')]=db[_0xdc32('0x1')]['import'](_0xdc32('0x105'));db['WhatsappInteraction']=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0xdc32('0x106')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x107'));db[_0xdc32('0x108')]=db[_0xdc32('0x1')]['import'](_0xdc32('0x109'));db[_0xdc32('0x10a')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x10b'));db['WhatsappQueue']=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/whatsappQueue/whatsappQueue.model');db[_0xdc32('0x10c')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x10d'));db[_0xdc32('0x10e')]=db[_0xdc32('0x1')]['import'](_0xdc32('0x10f'));db[_0xdc32('0x110')]=db[_0xdc32('0x1')]['import'](_0xdc32('0x111'));db[_0xdc32('0x112')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x113'));db['UserSetting']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x114'));db[_0xdc32('0x115')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x116'));db[_0xdc32('0x117')]['hasOne'](db[_0xdc32('0x20')],{'as':'VoiceMail','onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x119')});db['User'][_0xdc32('0x11a')](db[_0xdc32('0x11b')],{'as':'userSetting','onDelete':'cascade','foreignKey':_0xdc32('0x119')});db[_0xdc32('0x117')][_0xdc32('0x11c')](db['VoiceRecording'],{'as':_0xdc32('0x11d'),'foreignKey':_0xdc32('0x119')});db[_0xdc32('0x117')][_0xdc32('0x11c')](db['UserVoiceQueueRt'],{'as':_0xdc32('0x11e'),'foreignKey':_0xdc32('0x119')});db[_0xdc32('0x117')][_0xdc32('0x11c')](db[_0xdc32('0x16')],{'as':_0xdc32('0x11f'),'onDelete':_0xdc32('0x118'),'hooks':!![]});db['User']['hasMany'](db['CmHopperFinal'],{'as':_0xdc32('0x120'),'foreignKey':_0xdc32('0x119')});db['User'][_0xdc32('0x11c')](db[_0xdc32('0x79')],{'as':_0xdc32('0x121'),'foreignKey':'UserId'});db[_0xdc32('0x117')][_0xdc32('0x11c')](db[_0xdc32('0x7a')],{'as':_0xdc32('0x7a'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0xdc32('0x5d')],{'as':_0xdc32('0x122'),'foreignKey':_0xdc32('0x119')});db[_0xdc32('0x117')][_0xdc32('0x11c')](db['ChatInteraction'],{'as':_0xdc32('0x123'),'foreignKey':'UserId'});db[_0xdc32('0x117')]['hasMany'](db[_0xdc32('0x124')],{'as':_0xdc32('0x125'),'foreignKey':_0xdc32('0x119')});db[_0xdc32('0x117')]['hasMany'](db['FaxInteraction'],{'as':_0xdc32('0x126'),'foreignKey':'UserId'});db['User'][_0xdc32('0x11c')](db[_0xdc32('0x3f')],{'as':_0xdc32('0x127'),'foreignKey':_0xdc32('0x119')});db['User'][_0xdc32('0x11c')](db[_0xdc32('0x128')],{'as':_0xdc32('0x129'),'foreignKey':_0xdc32('0x119')});db[_0xdc32('0x117')][_0xdc32('0x11c')](db[_0xdc32('0x100')],{'as':_0xdc32('0x12a'),'foreignKey':'SenderId'});db['User']['hasMany'](db[_0xdc32('0x74')],{'as':_0xdc32('0x12b'),'foreignKey':_0xdc32('0x119'),'onDelete':_0xdc32('0x12c')});db[_0xdc32('0x117')][_0xdc32('0x12d')](db['UserProfile'],{'as':_0xdc32('0x12e'),'foreignKey':'userProfileId'});db[_0xdc32('0x117')][_0xdc32('0x12f')](db[_0xdc32('0x6e')],{'as':'Groups','through':_0xdc32('0x130')});db[_0xdc32('0x117')]['belongsToMany'](db[_0xdc32('0x131')],{'as':'Contacts','through':_0xdc32('0x132')});db[_0xdc32('0x117')][_0xdc32('0x12f')](db[_0xdc32('0xf8')],{'as':'Lists','through':'cm_user_has_lists'});db[_0xdc32('0x117')]['belongsToMany'](db['Team'],{'through':_0xdc32('0x133')});db[_0xdc32('0x117')][_0xdc32('0x12f')](db[_0xdc32('0x3f')],{'as':_0xdc32('0x127'),'through':_0xdc32('0x134')});db[_0xdc32('0x117')][_0xdc32('0x12f')](db[_0xdc32('0x135')],{'as':_0xdc32('0x123'),'through':_0xdc32('0x136')});db[_0xdc32('0x117')]['belongsToMany'](db[_0xdc32('0x4d')],{'as':_0xdc32('0x126'),'through':_0xdc32('0x137')});db['User'][_0xdc32('0x12f')](db[_0xdc32('0x124')],{'as':_0xdc32('0x125'),'through':'user_has_sms_interactions'});db[_0xdc32('0x117')]['belongsToMany'](db[_0xdc32('0x5d')],{'as':_0xdc32('0x122'),'through':'user_has_openchannel_interactions'});db[_0xdc32('0x117')][_0xdc32('0x12f')](db['WhatsappInteraction'],{'as':_0xdc32('0x129'),'through':'user_has_whatsapp_interactions'});db[_0xdc32('0x117')][_0xdc32('0x12f')](db[_0xdc32('0x1a')],{'as':'VoiceQueues','through':_0xdc32('0x2a'),'required':![]});db[_0xdc32('0x117')][_0xdc32('0x12f')](db['VoicePrefix'],{'as':_0xdc32('0x138'),'through':_0xdc32('0x112'),'required':![]});db[_0xdc32('0x117')]['belongsToMany'](db[_0xdc32('0x3b')],{'as':_0xdc32('0x139'),'through':_0xdc32('0x2d'),'required':![]});db[_0xdc32('0x117')][_0xdc32('0x12f')](db['ChatQueue'],{'as':_0xdc32('0x13a'),'through':_0xdc32('0x2b'),'required':![],'hooks':!![]});db[_0xdc32('0x117')][_0xdc32('0x12f')](db[_0xdc32('0x51')],{'as':_0xdc32('0x13b'),'through':_0xdc32('0x2f'),'required':![]});db['User'][_0xdc32('0x12f')](db[_0xdc32('0x13c')],{'as':_0xdc32('0x13d'),'through':'UserSmsQueue','required':![]});db[_0xdc32('0x117')][_0xdc32('0x12f')](db[_0xdc32('0x60')],{'as':_0xdc32('0x13e'),'through':'UserOpenchannelQueue','required':![]});db[_0xdc32('0x117')]['belongsToMany'](db['WhatsappQueue'],{'as':_0xdc32('0x13f'),'through':_0xdc32('0x35'),'required':![]});db[_0xdc32('0x117')][_0xdc32('0x12f')](db[_0xdc32('0xf8')],{'through':'cm_user_has_lists'});db[_0xdc32('0x117')][_0xdc32('0x12f')](db[_0xdc32('0x140')],{'as':_0xdc32('0x141'),'through':_0xdc32('0x142')});db[_0xdc32('0x117')][_0xdc32('0x12f')](db['FaxAccount'],{'as':_0xdc32('0x143'),'through':'user_has_fax_accounts'});db['User'][_0xdc32('0x12f')](db['MailAccount'],{'as':_0xdc32('0x144'),'through':_0xdc32('0x145')});db[_0xdc32('0x117')][_0xdc32('0x12f')](db[_0xdc32('0x5b')],{'as':_0xdc32('0x146'),'through':'user_has_openchannel_accounts'});db[_0xdc32('0x117')]['belongsToMany'](db[_0xdc32('0x55')],{'as':_0xdc32('0x147'),'through':'user_has_sms_accounts'});db['User']['belongsToMany'](db['WhatsappAccount'],{'as':_0xdc32('0x148'),'through':'user_has_whatsapp_accounts'});db[_0xdc32('0x12')][_0xdc32('0x11c')](db['VoiceExtension'],{'as':_0xdc32('0x149'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x14a')});db['VoiceContext'][_0xdc32('0x11c')](db[_0xdc32('0x16')],{'onDelete':'cascade'});db[_0xdc32('0x16')]['hasMany'](db[_0xdc32('0x16')],{'as':_0xdc32('0x14b'),'onDelete':'cascade'});db[_0xdc32('0x18')]['belongsToMany'](db[_0xdc32('0x8c')],{'as':_0xdc32('0x14c'),'through':_0xdc32('0x14d')});db[_0xdc32('0x1a')][_0xdc32('0x11c')](db[_0xdc32('0x28')],{'as':_0xdc32('0x14e'),'foreignKey':_0xdc32('0x14f')});db[_0xdc32('0x1a')][_0xdc32('0x11c')](db[_0xdc32('0x74')],{'as':_0xdc32('0x12b'),'foreignKey':_0xdc32('0x14f')});db[_0xdc32('0x1a')][_0xdc32('0x11c')](db[_0xdc32('0x150')],{'as':'HopperFinals','foreignKey':_0xdc32('0x14f')});db[_0xdc32('0x1a')]['hasMany'](db[_0xdc32('0x79')],{'as':_0xdc32('0x151'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0xdc32('0x7a')],{'as':_0xdc32('0x7a'),'foreignKey':_0xdc32('0x14f')});db['VoiceQueue'][_0xdc32('0x11c')](db[_0xdc32('0x76')],{'as':'HopperBlacks','foreignKey':_0xdc32('0x14f')});db['VoiceQueue']['hasMany'](db['JscriptySessionReport'],{'as':_0xdc32('0x152'),'foreignKey':_0xdc32('0x14f')});db[_0xdc32('0x1a')][_0xdc32('0x12d')](db[_0xdc32('0x26')],{'as':'Trunk','foreignKey':_0xdc32('0x153')});db[_0xdc32('0x1a')][_0xdc32('0x12d')](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0xdc32('0x154')});db['VoiceQueue'][_0xdc32('0x12d')](db[_0xdc32('0x155')],{'as':_0xdc32('0x155'),'foreignKey':'IntervalId'});db[_0xdc32('0x1a')][_0xdc32('0x12d')](db[_0xdc32('0x84')],{'as':_0xdc32('0x156'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xdc32('0x1a')]['belongsToMany'](db[_0xdc32('0xf8')],{'as':_0xdc32('0x157'),'through':_0xdc32('0x158')});db['VoiceQueue'][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':_0xdc32('0x159'),'through':_0xdc32('0x2a')});db[_0xdc32('0x1a')]['belongsToMany'](db['Team'],{'as':_0xdc32('0x15a'),'through':_0xdc32('0x10e')});db[_0xdc32('0x1a')]['belongsToMany'](db[_0xdc32('0xf8')],{'as':_0xdc32('0x15b'),'through':_0xdc32('0x15c')});db[_0xdc32('0x1c')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'as':_0xdc32('0x117'),'foreignKey':_0xdc32('0x119')});db[_0xdc32('0x1e')]['belongsTo'](db[_0xdc32('0x117')],{'as':_0xdc32('0x117'),'foreignKey':_0xdc32('0x119')});db[_0xdc32('0x20')]['hasMany'](db[_0xdc32('0x21')],{'as':_0xdc32('0x15d'),'onDelete':'cascade','foreignKey':_0xdc32('0x15e'),'sourceKey':'mailbox'});db[_0xdc32('0x21')][_0xdc32('0x12d')](db[_0xdc32('0x20')],{'foreignKey':'mailboxuser','targetKey':_0xdc32('0x15f')});db[_0xdc32('0x22')][_0xdc32('0x11c')](db[_0xdc32('0x160')],{'as':_0xdc32('0x161'),'foreignKey':_0xdc32('0x162'),'constraints':![]});db[_0xdc32('0x22')][_0xdc32('0x11c')](db[_0xdc32('0x163')],{'as':_0xdc32('0x164'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'as':'User','foreignKey':_0xdc32('0x119')});db[_0xdc32('0x22')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xdc32('0x37')][_0xdc32('0x12d')](db['MailAccount'],{'as':_0xdc32('0x3a'),'foreignKey':_0xdc32('0x165')});db['MailServerIn'][_0xdc32('0x12d')](db['CloudProvider'],{'as':_0xdc32('0x10c'),'foreignKey':_0xdc32('0x166'),'onDelete':'restrict'});db[_0xdc32('0x167')][_0xdc32('0x12d')](db[_0xdc32('0x3a')],{'as':_0xdc32('0x3a'),'foreignKey':_0xdc32('0x165')});db[_0xdc32('0x167')]['belongsTo'](db[_0xdc32('0x10c')],{'as':_0xdc32('0x10c'),'foreignKey':_0xdc32('0x166'),'onDelete':_0xdc32('0x168')});db['MailAccount'][_0xdc32('0x11a')](db[_0xdc32('0x37')],{'as':_0xdc32('0x169'),'onDelete':'cascade'});db[_0xdc32('0x3a')][_0xdc32('0x11a')](db[_0xdc32('0x167')],{'as':_0xdc32('0x16a'),'onDelete':'cascade'});db[_0xdc32('0x3a')][_0xdc32('0x11c')](db[_0xdc32('0x80')],{'as':_0xdc32('0x16b'),'foreignKey':_0xdc32('0x165'),'onDelete':_0xdc32('0x118')});db['MailAccount'][_0xdc32('0x11c')](db[_0xdc32('0x7e')],{'as':_0xdc32('0x16c'),'foreignKey':'MailAccountId'});db['MailAccount'][_0xdc32('0x11c')](db[_0xdc32('0x41')],{'as':'Messages','foreignKey':_0xdc32('0x165')});db['MailAccount']['hasMany'](db[_0xdc32('0x3f')],{'as':'Interactions'});db[_0xdc32('0x3a')][_0xdc32('0x11c')](db[_0xdc32('0x43')],{'as':'Applications','foreignKey':_0xdc32('0x165'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x3a')]['belongsTo'](db['CmList'],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e')});db['MailAccount']['belongsTo'](db[_0xdc32('0x16f')],{'as':'Template','foreignKey':'TemplateId'});db['MailAccount'][_0xdc32('0x12d')](db[_0xdc32('0x84')],{'as':_0xdc32('0x156'),'foreignKey':_0xdc32('0x170')});db[_0xdc32('0x3a')][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':_0xdc32('0x159'),'through':'user_has_mail_accounts'});db['MailQueue']['belongsToMany'](db[_0xdc32('0x117')],{'as':_0xdc32('0x159'),'through':_0xdc32('0x2d')});db[_0xdc32('0x3b')][_0xdc32('0x12f')](db[_0xdc32('0x171')],{'through':'team_has_mail_queues','as':_0xdc32('0x15a')});db[_0xdc32('0x3f')][_0xdc32('0x11c')](db[_0xdc32('0x41')],{'as':_0xdc32('0x15d'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x172')});db[_0xdc32('0x3f')]['belongsTo'](db['MailAccount'],{'as':'Account','foreignKey':'MailAccountId'});db[_0xdc32('0x3f')]['belongsTo'](db[_0xdc32('0x131')],{'as':_0xdc32('0x173'),'foreignKey':'ContactId'});db[_0xdc32('0x3f')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0xdc32('0x3f')][_0xdc32('0x12f')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0xdc32('0x174')});db['MailInteraction'][_0xdc32('0x12f')](db[_0xdc32('0x8e')],{'through':_0xdc32('0x175'),'as':'ThroughTags'});db[_0xdc32('0x3f')][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':'Users','through':_0xdc32('0x134'),'foreignKey':_0xdc32('0x172')});db[_0xdc32('0x41')][_0xdc32('0x11c')](db['Attachment'],{'as':'Attachments','onDelete':_0xdc32('0x118')});db[_0xdc32('0x41')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'as':'User'});db[_0xdc32('0x41')][_0xdc32('0x12d')](db[_0xdc32('0x131')],{'onDelete':_0xdc32('0x118'),'as':_0xdc32('0x173')});db[_0xdc32('0x41')][_0xdc32('0x12d')](db[_0xdc32('0x3f')],{'as':_0xdc32('0x176'),'foreignKey':_0xdc32('0x172')});db[_0xdc32('0x41')]['belongsTo'](db['MailAccount'],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x165')});db[_0xdc32('0x41')][_0xdc32('0x12d')](db[_0xdc32('0x140')],{'as':_0xdc32('0x140'),'foreignKey':_0xdc32('0x178')});db[_0xdc32('0x41')][_0xdc32('0x12d')](db['ChatOfflineMessage'],{'as':_0xdc32('0x6a'),'foreignKey':_0xdc32('0x179')});db['MailApplication']['belongsTo'](db[_0xdc32('0x117')],{'onDelete':_0xdc32('0x168')});db['MailApplication'][_0xdc32('0x12d')](db[_0xdc32('0x3b')],{'onDelete':'restrict'});db[_0xdc32('0x43')][_0xdc32('0x12d')](db[_0xdc32('0x3a')],{'onDelete':_0xdc32('0x168')});db['MailApplication'][_0xdc32('0x12d')](db[_0xdc32('0x155')],{'onDelete':_0xdc32('0x168'),'foreignKey':_0xdc32('0x17a')});db[_0xdc32('0x43')][_0xdc32('0x12d')](db[_0xdc32('0x8e')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xdc32('0x45')][_0xdc32('0x12d')](db[_0xdc32('0x3a')],{});db[_0xdc32('0x45')]['belongsTo'](db[_0xdc32('0xf8')],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e')});db[_0xdc32('0x45')]['belongsTo'](db['CmContact'],{'as':_0xdc32('0x173'),'foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x45')][_0xdc32('0x12d')](db['MailInteraction'],{});db[_0xdc32('0x45')]['belongsTo'](db['MailMessage'],{});db[_0xdc32('0x45')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{});db[_0xdc32('0x45')][_0xdc32('0x12d')](db[_0xdc32('0x3b')],{});db[_0xdc32('0x17c')][_0xdc32('0x11c')](db[_0xdc32('0x48')],{'as':_0xdc32('0x17d'),'onDelete':'cascade'});db['FaxAccount']['hasMany'](db[_0xdc32('0x80')],{'as':_0xdc32('0x16b'),'foreignKey':_0xdc32('0x17e'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x17f')][_0xdc32('0x11c')](db['CannedAnswer'],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0xdc32('0x17f')][_0xdc32('0x11c')](db[_0xdc32('0x4d')],{'as':_0xdc32('0x180')});db[_0xdc32('0x17f')]['hasMany'](db[_0xdc32('0x4b')],{'as':_0xdc32('0x14b'),'foreignKey':_0xdc32('0x17e'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x17f')][_0xdc32('0x11c')](db[_0xdc32('0x16')],{'as':_0xdc32('0x181'),'onDelete':_0xdc32('0x118')});db['FaxAccount'][_0xdc32('0x11c')](db[_0xdc32('0x4f')],{'as':_0xdc32('0x15d')});db[_0xdc32('0x17f')][_0xdc32('0x12d')](db[_0xdc32('0x26')],{'as':_0xdc32('0x26')});db[_0xdc32('0x17f')][_0xdc32('0x12d')](db['CmList'],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e')});db[_0xdc32('0x17f')]['belongsTo'](db[_0xdc32('0x84')],{'as':_0xdc32('0x156'),'foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount'][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':_0xdc32('0x159'),'through':_0xdc32('0x182')});db['FaxApplication'][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'onDelete':_0xdc32('0x168')});db[_0xdc32('0x4b')][_0xdc32('0x12d')](db[_0xdc32('0x51')],{'onDelete':_0xdc32('0x168')});db[_0xdc32('0x4b')][_0xdc32('0x12d')](db[_0xdc32('0x17f')],{'onDelete':_0xdc32('0x168')});db['FaxApplication'][_0xdc32('0x12d')](db['Tag'],{'onDelete':_0xdc32('0x168'),'foreignKey':_0xdc32('0x183')});db[_0xdc32('0x4d')][_0xdc32('0x11c')](db[_0xdc32('0x4f')],{'as':'Messages','onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x184')});db['FaxInteraction'][_0xdc32('0x12d')](db[_0xdc32('0x17f')],{'as':_0xdc32('0x177'),'foreignKey':'FaxAccountId'});db[_0xdc32('0x4d')][_0xdc32('0x12d')](db[_0xdc32('0x131')],{'as':_0xdc32('0x173'),'foreignKey':'ContactId'});db[_0xdc32('0x4d')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'as':'Owner','foreignKey':_0xdc32('0x119')});db[_0xdc32('0x4d')]['belongsToMany'](db[_0xdc32('0x8e')],{'through':_0xdc32('0x185'),'as':_0xdc32('0x174')});db[_0xdc32('0x4d')][_0xdc32('0x12f')](db[_0xdc32('0x8e')],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db['FaxInteraction']['belongsToMany'](db[_0xdc32('0x117')],{'as':_0xdc32('0x186'),'through':_0xdc32('0x137'),'foreignKey':_0xdc32('0x184')});db[_0xdc32('0x4f')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'onDelete':'cascade','as':_0xdc32('0x117')});db['FaxMessage'][_0xdc32('0x12d')](db['FaxInteraction'],{'as':_0xdc32('0x176'),'foreignKey':_0xdc32('0x184')});db[_0xdc32('0x4f')]['belongsTo'](db[_0xdc32('0x131')],{'onDelete':'cascade','as':'Contact'});db[_0xdc32('0x4f')][_0xdc32('0x12d')](db['Attachment'],{'as':_0xdc32('0xed'),'foreignKey':_0xdc32('0x187')});db[_0xdc32('0x4f')]['belongsTo'](db[_0xdc32('0x17f')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x17e')});db['FaxQueue'][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':_0xdc32('0x159'),'through':_0xdc32('0x2f')});db[_0xdc32('0x51')][_0xdc32('0x12f')](db['Team'],{'through':'team_has_fax_queues','as':_0xdc32('0x15a')});db[_0xdc32('0x53')][_0xdc32('0x12d')](db[_0xdc32('0x17f')],{});db[_0xdc32('0x53')]['belongsTo'](db[_0xdc32('0xf8')],{'as':'List','foreignKey':_0xdc32('0x16e')});db[_0xdc32('0x53')][_0xdc32('0x12d')](db['CmContact'],{'as':_0xdc32('0x173'),'foreignKey':'ContactId'});db[_0xdc32('0x53')][_0xdc32('0x12d')](db[_0xdc32('0x4d')],{});db['FaxQueueReport'][_0xdc32('0x12d')](db[_0xdc32('0x4f')],{});db[_0xdc32('0x53')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{});db[_0xdc32('0x53')]['belongsTo'](db[_0xdc32('0x51')],{});db[_0xdc32('0x55')][_0xdc32('0x11c')](db[_0xdc32('0x80')],{'as':_0xdc32('0x16b'),'foreignKey':_0xdc32('0x188'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x55')][_0xdc32('0x11c')](db[_0xdc32('0x7e')],{'as':_0xdc32('0x16c'),'foreignKey':'SmsAccountId'});db[_0xdc32('0x55')][_0xdc32('0x11c')](db['SmsMessage'],{'as':_0xdc32('0x15d'),'foreignKey':'SmsAccountId'});db[_0xdc32('0x55')][_0xdc32('0x11c')](db[_0xdc32('0x124')],{'as':_0xdc32('0x180')});db[_0xdc32('0x55')][_0xdc32('0x11c')](db['SmsApplication'],{'as':_0xdc32('0x14b'),'foreignKey':_0xdc32('0x188'),'onDelete':'cascade'});db[_0xdc32('0x55')][_0xdc32('0x12d')](db[_0xdc32('0xf8')],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e')});db['SmsAccount'][_0xdc32('0x12d')](db[_0xdc32('0x84')],{'as':_0xdc32('0x156'),'foreignKey':_0xdc32('0x170')});db[_0xdc32('0x55')]['belongsToMany'](db[_0xdc32('0x117')],{'as':_0xdc32('0x159'),'through':'user_has_sms_accounts'});db[_0xdc32('0x56')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'onDelete':_0xdc32('0x168')});db[_0xdc32('0x56')]['belongsTo'](db['SmsQueue'],{'onDelete':_0xdc32('0x168')});db[_0xdc32('0x56')][_0xdc32('0x12d')](db[_0xdc32('0x55')],{'onDelete':_0xdc32('0x168')});db[_0xdc32('0x56')][_0xdc32('0x12d')](db[_0xdc32('0x155')],{'onDelete':'restrict','foreignKey':_0xdc32('0x17a')});db['SmsApplication'][_0xdc32('0x12d')](db[_0xdc32('0x8e')],{'onDelete':_0xdc32('0x168'),'foreignKey':_0xdc32('0x183')});db['SmsInteraction'][_0xdc32('0x11c')](db[_0xdc32('0x59')],{'as':'Messages','onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x189')});db[_0xdc32('0x124')][_0xdc32('0x12d')](db[_0xdc32('0x55')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x188')});db[_0xdc32('0x124')]['belongsTo'](db[_0xdc32('0x131')],{'as':_0xdc32('0x173'),'foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x124')]['belongsTo'](db['User'],{'as':_0xdc32('0x18a'),'foreignKey':_0xdc32('0x119')});db[_0xdc32('0x124')][_0xdc32('0x12f')](db['Tag'],{'through':_0xdc32('0x18b'),'as':_0xdc32('0x174')});db['SmsInteraction']['belongsToMany'](db[_0xdc32('0x8e')],{'through':_0xdc32('0x18b'),'as':_0xdc32('0x18c')});db[_0xdc32('0x124')][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':'Users','through':_0xdc32('0x18d'),'foreignKey':_0xdc32('0x189')});db['SmsMessage'][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'as':'User'});db['SmsMessage'][_0xdc32('0x12d')](db['CmContact'],{'onDelete':_0xdc32('0x118'),'as':_0xdc32('0x173')});db['SmsMessage']['belongsTo'](db['SmsInteraction'],{'onDelete':'cascade','as':_0xdc32('0x176'),'foreignKey':_0xdc32('0x189')});db[_0xdc32('0x59')][_0xdc32('0x12d')](db[_0xdc32('0x55')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0xdc32('0x13c')][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':_0xdc32('0x159'),'through':_0xdc32('0x31'),'foreignKey':_0xdc32('0x18e')});db[_0xdc32('0x13c')][_0xdc32('0x12f')](db['Team'],{'through':_0xdc32('0x18f'),'as':'Teams'});db[_0xdc32('0x5b')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0xdc32('0x190'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x5b')]['hasMany'](db[_0xdc32('0x7e')],{'as':'Answers','foreignKey':_0xdc32('0x190')});db['OpenchannelAccount'][_0xdc32('0x11c')](db[_0xdc32('0x5d')],{'as':_0xdc32('0x180'),'foreignKey':'OpenchannelAccountId'});db[_0xdc32('0x5b')][_0xdc32('0x11c')](db[_0xdc32('0x5f')],{'as':_0xdc32('0x15d'),'foreignKey':_0xdc32('0x190')});db['OpenchannelAccount'][_0xdc32('0x11c')](db[_0xdc32('0x191')],{'as':_0xdc32('0x14b'),'foreignKey':_0xdc32('0x190'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x5b')]['belongsTo'](db[_0xdc32('0xf8')],{'as':'List','foreignKey':_0xdc32('0x16e')});db[_0xdc32('0x5b')][_0xdc32('0x12d')](db[_0xdc32('0x84')],{'as':_0xdc32('0x156'),'foreignKey':_0xdc32('0x170')});db['OpenchannelAccount']['belongsToMany'](db[_0xdc32('0x117')],{'as':_0xdc32('0x159'),'through':_0xdc32('0x192')});db['OpenchannelApplication']['belongsTo'](db[_0xdc32('0x117')],{'onDelete':_0xdc32('0x168')});db[_0xdc32('0x191')]['belongsTo'](db[_0xdc32('0x60')],{'onDelete':'restrict','foreignKey':_0xdc32('0x193')});db['OpenchannelApplication'][_0xdc32('0x12d')](db[_0xdc32('0x5b')],{'onDelete':_0xdc32('0x168'),'foreignKey':_0xdc32('0x190')});db[_0xdc32('0x191')]['belongsTo'](db[_0xdc32('0x155')],{'onDelete':'restrict','foreignKey':_0xdc32('0x17a')});db[_0xdc32('0x191')]['belongsTo'](db[_0xdc32('0x8e')],{'onDelete':_0xdc32('0x168'),'foreignKey':_0xdc32('0x183')});db[_0xdc32('0x5d')][_0xdc32('0x11c')](db[_0xdc32('0x5f')],{'as':_0xdc32('0x15d'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x194')});db[_0xdc32('0x5d')][_0xdc32('0x12d')](db[_0xdc32('0x5b')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x190')});db[_0xdc32('0x5d')][_0xdc32('0x12d')](db[_0xdc32('0x131')],{'as':'Contact','foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x5d')]['belongsTo'](db[_0xdc32('0x117')],{'as':_0xdc32('0x18a'),'foreignKey':_0xdc32('0x119')});db['OpenchannelInteraction'][_0xdc32('0x12f')](db[_0xdc32('0x8e')],{'through':_0xdc32('0x195'),'as':_0xdc32('0x174')});db[_0xdc32('0x5d')][_0xdc32('0x12f')](db[_0xdc32('0x8e')],{'through':_0xdc32('0x195'),'as':_0xdc32('0x18c')});db[_0xdc32('0x5d')][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':_0xdc32('0x186'),'through':'user_has_openchannel_interactions','foreignKey':_0xdc32('0x194')});db[_0xdc32('0x5f')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'onDelete':_0xdc32('0x118'),'as':'User'});db[_0xdc32('0x5f')][_0xdc32('0x12d')](db[_0xdc32('0x131')],{'onDelete':_0xdc32('0x118'),'as':_0xdc32('0x173')});db[_0xdc32('0x5f')]['belongsTo'](db[_0xdc32('0x5d')],{'onDelete':_0xdc32('0x118'),'as':_0xdc32('0x176'),'foreignKey':_0xdc32('0x194')});db['OpenchannelMessage'][_0xdc32('0x12d')](db['Attachment'],{'as':_0xdc32('0xed'),'foreignKey':_0xdc32('0x187')});db['OpenchannelMessage'][_0xdc32('0x12d')](db[_0xdc32('0x5b')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x190')});db[_0xdc32('0x60')][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':_0xdc32('0x159'),'through':_0xdc32('0x33'),'foreignKey':_0xdc32('0x193')});db[_0xdc32('0x60')][_0xdc32('0x12f')](db[_0xdc32('0x171')],{'through':_0xdc32('0x196'),'as':_0xdc32('0x15a')});db[_0xdc32('0x140')][_0xdc32('0x11c')](db[_0xdc32('0x80')],{'as':_0xdc32('0x16b'),'foreignKey':'ChatWebsiteId','onDelete':_0xdc32('0x118')});db[_0xdc32('0x140')]['hasMany'](db[_0xdc32('0x7e')],{'as':_0xdc32('0x16c'),'foreignKey':_0xdc32('0x178')});db[_0xdc32('0x140')]['hasMany'](db[_0xdc32('0x197')],{'as':_0xdc32('0x198')});db['ChatWebsite'][_0xdc32('0x11c')](db[_0xdc32('0x135')],{'as':_0xdc32('0x180')});db[_0xdc32('0x140')][_0xdc32('0x11c')](db[_0xdc32('0x65')],{'as':_0xdc32('0x14b'),'foreignKey':_0xdc32('0x178'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x140')][_0xdc32('0x11c')](db[_0xdc32('0x68')],{'as':_0xdc32('0x15d')});db[_0xdc32('0x140')][_0xdc32('0x12d')](db[_0xdc32('0xf8')],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e')});db[_0xdc32('0x140')][_0xdc32('0x12d')](db[_0xdc32('0x155')],{'as':'Interval','foreignKey':'IntervalId'});db[_0xdc32('0x140')][_0xdc32('0x12d')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xdc32('0x165')});db[_0xdc32('0x140')][_0xdc32('0x12d')](db[_0xdc32('0x84')],{'as':_0xdc32('0x156'),'foreignKey':_0xdc32('0x170')});db[_0xdc32('0x140')][_0xdc32('0x12f')](db['User'],{'as':_0xdc32('0x159'),'through':'user_has_chat_websites'});db[_0xdc32('0x63')][_0xdc32('0x12d')](db[_0xdc32('0x5b')],{});db['OpenchannelQueueReport'][_0xdc32('0x12d')](db[_0xdc32('0xf8')],{'as':'List','foreignKey':_0xdc32('0x16e')});db[_0xdc32('0x63')][_0xdc32('0x12d')](db[_0xdc32('0x131')],{'as':_0xdc32('0x173'),'foreignKey':'ContactId'});db['OpenchannelQueueReport'][_0xdc32('0x12d')](db['OpenchannelInteraction'],{});db[_0xdc32('0x63')]['belongsTo'](db[_0xdc32('0x5f')],{});db[_0xdc32('0x63')][_0xdc32('0x12d')](db['User'],{});db[_0xdc32('0x63')][_0xdc32('0x12d')](db[_0xdc32('0x60')],{});db[_0xdc32('0x65')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'as':'Agent','foreignKey':_0xdc32('0x119'),'onDelete':_0xdc32('0x168')});db[_0xdc32('0x65')][_0xdc32('0x12d')](db[_0xdc32('0x6c')],{'as':_0xdc32('0x199'),'foreignKey':_0xdc32('0x19a'),'onDelete':_0xdc32('0x168')});db[_0xdc32('0x65')][_0xdc32('0x12d')](db['ChatWebsite'],{'as':_0xdc32('0x19b'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db['ChatApplication'][_0xdc32('0x12d')](db[_0xdc32('0x8e')],{'onDelete':'restrict','foreignKey':_0xdc32('0x183')});db[_0xdc32('0x135')][_0xdc32('0x11c')](db[_0xdc32('0x68')],{'as':_0xdc32('0x15d'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x19c')});db[_0xdc32('0x135')][_0xdc32('0x12d')](db[_0xdc32('0x140')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x178')});db[_0xdc32('0x135')]['belongsTo'](db['CmContact'],{'as':_0xdc32('0x173'),'foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x135')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'as':'Owner','foreignKey':_0xdc32('0x119')});db[_0xdc32('0x135')][_0xdc32('0x12f')](db[_0xdc32('0x8e')],{'through':_0xdc32('0x19d'),'as':_0xdc32('0x174')});db[_0xdc32('0x135')]['belongsToMany'](db[_0xdc32('0x8e')],{'through':'chat_interaction_has_tags','as':_0xdc32('0x18c')});db[_0xdc32('0x135')]['belongsToMany'](db[_0xdc32('0x117')],{'as':_0xdc32('0x186'),'through':_0xdc32('0x136'),'foreignKey':'ChatInteractionId'});db[_0xdc32('0x68')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'onDelete':_0xdc32('0x118'),'as':_0xdc32('0x117')});db['ChatMessage'][_0xdc32('0x12d')](db['CmContact'],{'onDelete':'cascade','as':'Contact','foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x68')][_0xdc32('0x12d')](db[_0xdc32('0x135')],{'onDelete':_0xdc32('0x118'),'as':_0xdc32('0x176'),'foreignKey':_0xdc32('0x19c')});db['ChatMessage'][_0xdc32('0x12d')](db['Attachment'],{'as':_0xdc32('0xed'),'foreignKey':_0xdc32('0x187')});db[_0xdc32('0x68')][_0xdc32('0x12d')](db[_0xdc32('0x140')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x178')});db[_0xdc32('0x6a')][_0xdc32('0x11c')](db[_0xdc32('0xed')],{'as':'Attachments','foreignKey':_0xdc32('0x179'),'onDelete':_0xdc32('0x118'),'hooks':!![]});db[_0xdc32('0x6a')][_0xdc32('0x12d')](db[_0xdc32('0x131')],{'onDelete':_0xdc32('0x118'),'as':'Contact','foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x6a')]['belongsTo'](db[_0xdc32('0x140')],{'as':_0xdc32('0x177'),'foreignKey':'ChatWebsiteId'});db[_0xdc32('0x6c')]['belongsToMany'](db[_0xdc32('0x117')],{'as':'Agents','through':_0xdc32('0x2b'),'hooks':!![]});db[_0xdc32('0x6c')][_0xdc32('0x12f')](db['Team'],{'through':_0xdc32('0x19e'),'as':_0xdc32('0x15a')});db[_0xdc32('0x6e')]['hasMany'](db['ChatInternalMessage'],{'as':_0xdc32('0x15d'),'foreignKey':_0xdc32('0x19f'),'onDelete':_0xdc32('0x118')});db['ChatGroup'][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':_0xdc32('0x14e'),'through':_0xdc32('0x130')});db[_0xdc32('0x197')][_0xdc32('0x12d')](db[_0xdc32('0x140')],{'as':_0xdc32('0x19b'),'foreignKey':_0xdc32('0x178')});db[_0xdc32('0x71')][_0xdc32('0x11c')](db[_0xdc32('0x131')],{'as':_0xdc32('0x1a0'),'foreignKey':_0xdc32('0x1a1')});db[_0xdc32('0x131')][_0xdc32('0x11c')](db[_0xdc32('0x90')],{'as':_0xdc32('0x1a2'),'foreignKey':_0xdc32('0x1a3')});db[_0xdc32('0x131')][_0xdc32('0x11c')](db[_0xdc32('0x74')],{'as':_0xdc32('0x12b'),'foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x131')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x131')][_0xdc32('0x11c')](db['CmHopperHistory'],{'as':_0xdc32('0x151'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0xdc32('0x7a')],{'as':_0xdc32('0x7a'),'foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x131')][_0xdc32('0x11c')](db[_0xdc32('0xd8')],{'as':'JscriptySessions','foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x131')][_0xdc32('0x11c')](db[_0xdc32('0x5d')],{'as':_0xdc32('0x122'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0xdc32('0x11c')](db[_0xdc32('0x135')],{'as':'ChatInteractions','foreignKey':_0xdc32('0x17b'),'onDelete':_0xdc32('0x168')});db[_0xdc32('0x131')]['hasMany'](db['SmsInteraction'],{'as':_0xdc32('0x125'),'foreignKey':_0xdc32('0x17b'),'onDelete':_0xdc32('0x168')});db[_0xdc32('0x131')]['hasMany'](db[_0xdc32('0x4d')],{'as':_0xdc32('0x126'),'foreignKey':_0xdc32('0x17b'),'onDelete':'restrict'});db[_0xdc32('0x131')][_0xdc32('0x11c')](db['MailInteraction'],{'as':_0xdc32('0x127'),'foreignKey':_0xdc32('0x17b'),'onDelete':_0xdc32('0x168')});db['CmContact'][_0xdc32('0x12d')](db[_0xdc32('0x71')],{'as':'Company','foreignKey':'CompanyId'});db['CmContact'][_0xdc32('0x12d')](db['CmList'],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e'),'onDelete':'cascade'});db['CmContact']['belongsToMany'](db['User'],{'as':_0xdc32('0x186'),'through':_0xdc32('0x132')});db['CmContact']['belongsToMany'](db[_0xdc32('0x8e')],{'as':_0xdc32('0x174'),'through':_0xdc32('0x1a4')});db[_0xdc32('0x131')][_0xdc32('0x12f')](db[_0xdc32('0x8e')],{'through':'cm_contact_has_tags','as':_0xdc32('0x18c')});db['CmHopper'][_0xdc32('0x11c')](db[_0xdc32('0x92')],{'as':'AdditionalPhones','foreignKey':'CmHopperId'});db['CmHopper'][_0xdc32('0x12d')](db[_0xdc32('0x131')],{'as':_0xdc32('0x173'),'foreignKey':'ContactId','onDelete':_0xdc32('0x118')});db['CmHopper'][_0xdc32('0x12d')](db[_0xdc32('0xf8')],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e'),'onDelete':'cascade'});db['CmHopper'][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'as':'Agent','foreignKey':_0xdc32('0x119')});db[_0xdc32('0x74')][_0xdc32('0x12d')](db[_0xdc32('0x1a')],{'as':'Queue','foreignKey':_0xdc32('0x14f'),'onDelete':_0xdc32('0x118')});db['CmHopper'][_0xdc32('0x12d')](db[_0xdc32('0xea')],{'as':_0xdc32('0xea'),'foreignKey':_0xdc32('0x1a5'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x74')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'as':'Owner','foreignKey':'OwnerId'});db[_0xdc32('0x76')][_0xdc32('0x12d')](db[_0xdc32('0x131')],{'as':'Contact','foreignKey':_0xdc32('0x17b'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x76')]['belongsTo'](db['CmList'],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x76')][_0xdc32('0x12d')](db[_0xdc32('0x1a')],{'as':_0xdc32('0x199'),'foreignKey':_0xdc32('0x14f'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x76')][_0xdc32('0x12d')](db[_0xdc32('0xea')],{'as':_0xdc32('0xea'),'foreignKey':_0xdc32('0x1a5'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x1a6')][_0xdc32('0x11c')](db['Condition'],{'as':{'plural':'All','singular':_0xdc32('0x1a7')},'foreignKey':_0xdc32('0x1a8'),'onDelete':_0xdc32('0x118'),'hooks':!![]});db['Automation'][_0xdc32('0x11c')](db['Condition'],{'as':{'plural':'Any','singular':_0xdc32('0x1a9')},'foreignKey':_0xdc32('0x1aa'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xdc32('0x11c')](db['Action'],{'as':'Actions','foreignKey':_0xdc32('0x1ab'),'onDelete':_0xdc32('0x118'),'hooks':!![]});db[_0xdc32('0x80')][_0xdc32('0x11c')](db[_0xdc32('0x80')],{'as':_0xdc32('0x16b'),'foreignKey':_0xdc32('0x1ac'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x155')]['hasMany'](db[_0xdc32('0x155')],{'as':_0xdc32('0x1ad'),'foreignKey':_0xdc32('0x17a'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xdc32('0x155')][_0xdc32('0x11c')](db['VoiceExtension'],{'as':_0xdc32('0x11f'),'foreignKey':'IntervalId','onDelete':_0xdc32('0x168')});db[_0xdc32('0x155')][_0xdc32('0x11c')](db[_0xdc32('0x43')],{'as':_0xdc32('0x1ae'),'foreignKey':_0xdc32('0x17a')});db[_0xdc32('0x155')]['hasMany'](db[_0xdc32('0x65')],{'as':_0xdc32('0x1af'),'foreignKey':'IntervalId'});db[_0xdc32('0x155')]['hasMany'](db[_0xdc32('0x4b')],{'as':_0xdc32('0x1b0'),'foreignKey':_0xdc32('0x17a')});db[_0xdc32('0x155')][_0xdc32('0x11c')](db['SmsApplication'],{'as':_0xdc32('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0xdc32('0x12d')](db[_0xdc32('0x3a')],{});db[_0xdc32('0x8a')]['belongsTo'](db['AnalyticDefaultReport'],{'foreignKey':_0xdc32('0x1b2')});db[_0xdc32('0x8a')][_0xdc32('0x12d')](db['AnalyticCustomReport'],{'foreignKey':_0xdc32('0x1b3')});db['Sound']['belongsToMany'](db[_0xdc32('0x18')],{'as':_0xdc32('0x1b4'),'through':_0xdc32('0x14d'),'onDelete':_0xdc32('0x168')});db[_0xdc32('0x8e')][_0xdc32('0x12f')](db[_0xdc32('0x131')],{'through':'cm_contact_has_tags'});db[_0xdc32('0x8e')][_0xdc32('0x12f')](db['ChatInteraction'],{'through':_0xdc32('0x19d')});db[_0xdc32('0x8e')][_0xdc32('0x12f')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db['Tag'][_0xdc32('0x12f')](db[_0xdc32('0x124')],{'through':_0xdc32('0x18b')});db[_0xdc32('0x8e')][_0xdc32('0x12f')](db[_0xdc32('0x4d')],{'through':'fax_interaction_has_tags'});db['Tag']['belongsToMany'](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0xdc32('0x8e')][_0xdc32('0x12f')](db[_0xdc32('0x128')],{'through':_0xdc32('0x1b5')});db[_0xdc32('0x90')][_0xdc32('0x12d')](db['ContactItemType'],{'as':_0xdc32('0x1b6'),'foreignKey':_0xdc32('0x1b7')});db[_0xdc32('0x92')][_0xdc32('0x12d')](db[_0xdc32('0x74')],{'as':'Hopper','foreignKey':_0xdc32('0x1b8')});db[_0xdc32('0x90')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xdc32('0x1a3')});db['Trigger'][_0xdc32('0x11c')](db[_0xdc32('0x81')],{'as':{'plural':_0xdc32('0x1b9'),'singular':_0xdc32('0x1ba')},'foreignKey':_0xdc32('0x1bb'),'onDelete':_0xdc32('0x118'),'hooks':!![]});db['Trigger'][_0xdc32('0x11c')](db[_0xdc32('0x81')],{'as':{'plural':'AnyConditions','singular':_0xdc32('0x1bc')},'foreignKey':_0xdc32('0x1bd'),'onDelete':_0xdc32('0x118'),'hooks':!![]});db['Trigger'][_0xdc32('0x11c')](db[_0xdc32('0x7c')],{'as':'Actions','foreignKey':'TriggerId','onDelete':_0xdc32('0x118'),'hooks':!![]});db[_0xdc32('0x1be')][_0xdc32('0x11c')](db[_0xdc32('0x9e')],{'as':_0xdc32('0x1bf'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1b3'),'hooks':!![]});db[_0xdc32('0x1c0')][_0xdc32('0x11c')](db[_0xdc32('0x9e')],{'as':_0xdc32('0x1bf'),'onDelete':_0xdc32('0x118'),'foreignKey':'DefaultReportId'});db['AnalyticMetric'][_0xdc32('0x11c')](db[_0xdc32('0x9e')],{'as':_0xdc32('0x1bf'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c1')});db[_0xdc32('0x9e')][_0xdc32('0x12d')](db[_0xdc32('0x9c')],{'foreignKey':_0xdc32('0x1c1')});db['SalesforceAccount']['hasMany'](db[_0xdc32('0x1c2')],{'as':_0xdc32('0x1c3'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c4')});db[_0xdc32('0x1c2')][_0xdc32('0x11c')](db[_0xdc32('0xa4')],{'as':_0xdc32('0x1c5'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c6')});db['SalesforceConfiguration'][_0xdc32('0x11c')](db[_0xdc32('0xa4')],{'as':_0xdc32('0x1c7'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c8')});db[_0xdc32('0x1c2')]['hasMany'](db[_0xdc32('0xa4')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xdc32('0x1c9')});db[_0xdc32('0x1c2')][_0xdc32('0x12d')](db[_0xdc32('0xa1')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x1c4')});db[_0xdc32('0xa4')][_0xdc32('0x11c')](db['SalesforceField'],{'as':_0xdc32('0x1ca'),'foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xa4')][_0xdc32('0x11c')](db[_0xdc32('0xa4')],{'as':'Description','foreignKey':_0xdc32('0x1c8')});db[_0xdc32('0xa4')][_0xdc32('0x11c')](db[_0xdc32('0xa4')],{'as':'Field','foreignKey':_0xdc32('0x1c9')});db[_0xdc32('0xa4')][_0xdc32('0x12d')](db[_0xdc32('0x95')],{'as':_0xdc32('0x95'),'foreignKey':'VariableId'});db[_0xdc32('0xa5')][_0xdc32('0x11c')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c4')});db[_0xdc32('0xa6')][_0xdc32('0x11c')](db['SugarcrmField'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xa6')][_0xdc32('0x11c')](db[_0xdc32('0xa8')],{'as':'Descriptions','onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c8')});db[_0xdc32('0xa6')][_0xdc32('0x11c')](db[_0xdc32('0xa8')],{'as':_0xdc32('0x1bf'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c9')});db[_0xdc32('0xa6')][_0xdc32('0x12d')](db['SugarcrmAccount'],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x1c4')});db[_0xdc32('0xa8')][_0xdc32('0x11c')](db[_0xdc32('0xa8')],{'as':'Subject','foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xa8')][_0xdc32('0x11c')](db['SugarcrmField'],{'as':_0xdc32('0x1cb'),'foreignKey':_0xdc32('0x1c8')});db[_0xdc32('0xa8')][_0xdc32('0x11c')](db['SugarcrmField'],{'as':_0xdc32('0x1cc'),'foreignKey':_0xdc32('0x1c9')});db[_0xdc32('0xa8')][_0xdc32('0x12d')](db['Variable'],{'as':_0xdc32('0x95'),'foreignKey':'VariableId'});db['DeskAccount']['hasMany'](db[_0xdc32('0xab')],{'as':_0xdc32('0x1c3'),'onDelete':_0xdc32('0x118'),'foreignKey':'AccountId'});db[_0xdc32('0xab')][_0xdc32('0x11c')](db['DeskField'],{'as':_0xdc32('0x1c5'),'onDelete':'cascade','foreignKey':'SubjectId'});db['DeskConfiguration']['hasMany'](db[_0xdc32('0xad')],{'as':_0xdc32('0x1c7'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xdc32('0xab')][_0xdc32('0x11c')](db[_0xdc32('0xad')],{'as':_0xdc32('0x1bf'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c9')});db['DeskConfiguration']['belongsTo'](db['DeskAccount'],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x1c4')});db[_0xdc32('0xab')][_0xdc32('0x12f')](db['Tag'],{'through':_0xdc32('0x1cd')});db[_0xdc32('0xad')][_0xdc32('0x11c')](db[_0xdc32('0xad')],{'as':_0xdc32('0x1ca'),'foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xad')][_0xdc32('0x11c')](db['DeskField'],{'as':_0xdc32('0x1cb'),'foreignKey':_0xdc32('0x1c8')});db[_0xdc32('0xad')][_0xdc32('0x11c')](db[_0xdc32('0xad')],{'as':_0xdc32('0x1cc'),'foreignKey':'FieldId'});db[_0xdc32('0xad')]['belongsTo'](db[_0xdc32('0x95')],{'as':_0xdc32('0x95'),'foreignKey':_0xdc32('0x1ce')});db[_0xdc32('0xae')][_0xdc32('0x11c')](db[_0xdc32('0xb0')],{'as':_0xdc32('0x1c3'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c4')});db[_0xdc32('0xb0')][_0xdc32('0x11c')](db['ZohoField'],{'as':_0xdc32('0x1c5'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xb0')][_0xdc32('0x11c')](db[_0xdc32('0xb2')],{'as':'Descriptions','onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c8')});db['ZohoConfiguration'][_0xdc32('0x11c')](db[_0xdc32('0xb2')],{'as':_0xdc32('0x1bf'),'onDelete':_0xdc32('0x118'),'foreignKey':'FieldId'});db['ZohoConfiguration']['belongsTo'](db[_0xdc32('0xae')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x1c4')});db['ZohoField']['hasMany'](db[_0xdc32('0xb2')],{'as':'Subject','foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xb2')][_0xdc32('0x11c')](db['ZohoField'],{'as':_0xdc32('0x1cb'),'foreignKey':'DescriptionId'});db['ZohoField'][_0xdc32('0x11c')](db[_0xdc32('0xb2')],{'as':_0xdc32('0x1cc'),'foreignKey':_0xdc32('0x1c9')});db['ZohoField']['belongsTo'](db[_0xdc32('0x95')],{'as':_0xdc32('0x95'),'foreignKey':_0xdc32('0x1ce')});db[_0xdc32('0xb3')][_0xdc32('0x11c')](db[_0xdc32('0xb5')],{'as':'Configurations','onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c4')});db[_0xdc32('0xb5')][_0xdc32('0x11c')](db['ZendeskField'],{'as':_0xdc32('0x1c5'),'foreignKey':'SubjectId'});db['ZendeskConfiguration']['hasMany'](db[_0xdc32('0xb7')],{'as':_0xdc32('0x1c7'),'foreignKey':_0xdc32('0x1c8')});db[_0xdc32('0xb5')][_0xdc32('0x11c')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db['ZendeskConfiguration'][_0xdc32('0x12d')](db[_0xdc32('0xb3')],{'as':_0xdc32('0x177'),'foreignKey':'AccountId'});db[_0xdc32('0xb5')][_0xdc32('0x12f')](db['Tag'],{'through':_0xdc32('0x1cf')});db[_0xdc32('0xb7')][_0xdc32('0x11c')](db[_0xdc32('0xb7')],{'as':_0xdc32('0x1ca'),'foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xb7')]['hasMany'](db[_0xdc32('0xb7')],{'as':_0xdc32('0x1cb'),'foreignKey':_0xdc32('0x1c8')});db[_0xdc32('0xb7')][_0xdc32('0x11c')](db['ZendeskField'],{'as':_0xdc32('0x1cc'),'foreignKey':_0xdc32('0x1c9')});db[_0xdc32('0xb7')][_0xdc32('0x12d')](db[_0xdc32('0x95')],{'as':'Variable','foreignKey':_0xdc32('0x1ce')});db[_0xdc32('0x1d0')]['hasMany'](db[_0xdc32('0xba')],{'as':_0xdc32('0x1c3'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c4')});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':'Subjects','onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xba')]['hasMany'](db[_0xdc32('0xbc')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xdc32('0x1c8')});db[_0xdc32('0xba')][_0xdc32('0x11c')](db[_0xdc32('0xbc')],{'as':_0xdc32('0x1bf'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c9')});db[_0xdc32('0xba')]['belongsTo'](db[_0xdc32('0x1d0')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x1c4')});db[_0xdc32('0xba')][_0xdc32('0x12f')](db[_0xdc32('0x8e')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xdc32('0xbc')][_0xdc32('0x11c')](db['FreshdeskField'],{'as':_0xdc32('0x1ca'),'foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xbc')]['hasMany'](db[_0xdc32('0xbc')],{'as':'Description','foreignKey':_0xdc32('0x1c8')});db[_0xdc32('0xbc')][_0xdc32('0x11c')](db[_0xdc32('0xbc')],{'as':_0xdc32('0x1cc'),'foreignKey':_0xdc32('0x1c9')});db['FreshdeskField'][_0xdc32('0x12d')](db[_0xdc32('0x95')],{'as':'Variable','foreignKey':_0xdc32('0x1ce')});db[_0xdc32('0xbe')][_0xdc32('0x11c')](db[_0xdc32('0xc0')],{'as':'Configurations','onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c4')});db['VtigerConfiguration']['hasMany'](db[_0xdc32('0x1d1')],{'as':'Subjects','foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xc0')][_0xdc32('0x11c')](db['VtigerField'],{'as':_0xdc32('0x1c7'),'foreignKey':_0xdc32('0x1c8')});db[_0xdc32('0xc0')][_0xdc32('0x11c')](db[_0xdc32('0x1d1')],{'as':_0xdc32('0x1bf'),'foreignKey':_0xdc32('0x1c9')});db[_0xdc32('0xc0')]['belongsTo'](db[_0xdc32('0xbe')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x1c4')});db['VtigerField'][_0xdc32('0x11c')](db['VtigerField'],{'as':_0xdc32('0x1ca'),'foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0x1d1')][_0xdc32('0x11c')](db[_0xdc32('0x1d1')],{'as':'Description','foreignKey':'DescriptionId'});db['VtigerField'][_0xdc32('0x11c')](db[_0xdc32('0x1d1')],{'as':_0xdc32('0x1cc'),'foreignKey':_0xdc32('0x1c9')});db[_0xdc32('0x1d1')][_0xdc32('0x12d')](db[_0xdc32('0x95')],{'as':_0xdc32('0x95'),'foreignKey':_0xdc32('0x1ce')});db['ServicenowAccount'][_0xdc32('0x11c')](db[_0xdc32('0x1d2')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db['ServicenowConfiguration'][_0xdc32('0x11c')](db[_0xdc32('0xc5')],{'as':_0xdc32('0x1c5'),'foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0x1d2')][_0xdc32('0x11c')](db[_0xdc32('0xc5')],{'as':_0xdc32('0x1c7'),'foreignKey':'DescriptionId'});db[_0xdc32('0x1d2')][_0xdc32('0x11c')](db[_0xdc32('0xc5')],{'as':_0xdc32('0x1bf'),'foreignKey':'FieldId'});db[_0xdc32('0x1d2')][_0xdc32('0x12d')](db[_0xdc32('0xc2')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x1c4')});db[_0xdc32('0xc5')][_0xdc32('0x11c')](db[_0xdc32('0xc5')],{'as':'Subject','foreignKey':_0xdc32('0x1c6')});db['ServicenowField'][_0xdc32('0x11c')](db[_0xdc32('0xc5')],{'as':'Description','foreignKey':_0xdc32('0x1c8')});db['ServicenowField'][_0xdc32('0x11c')](db[_0xdc32('0xc5')],{'as':_0xdc32('0x1cc'),'foreignKey':_0xdc32('0x1c9')});db['ServicenowField']['belongsTo'](db[_0xdc32('0x95')],{'as':_0xdc32('0x95'),'foreignKey':_0xdc32('0x1ce')});db[_0xdc32('0xc7')][_0xdc32('0x11c')](db[_0xdc32('0xc9')],{'as':'Configurations','onDelete':_0xdc32('0x118'),'foreignKey':'AccountId'});db[_0xdc32('0xc7')][_0xdc32('0x12d')](db[_0xdc32('0x10c')],{'as':_0xdc32('0x10c'),'foreignKey':_0xdc32('0x166')});db[_0xdc32('0xc9')][_0xdc32('0x11c')](db[_0xdc32('0xca')],{'as':_0xdc32('0x1c5'),'onDelete':'cascade','foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xc9')][_0xdc32('0x11c')](db[_0xdc32('0xca')],{'as':_0xdc32('0x1c7'),'onDelete':_0xdc32('0x118'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration']['hasMany'](db['Dynamics365Field'],{'as':_0xdc32('0x1bf'),'onDelete':_0xdc32('0x118'),'foreignKey':'FieldId'});db[_0xdc32('0xc9')]['belongsTo'](db['Dynamics365Account'],{'as':_0xdc32('0x177'),'foreignKey':'AccountId'});db[_0xdc32('0xca')][_0xdc32('0x11c')](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xca')][_0xdc32('0x11c')](db['Dynamics365Field'],{'as':_0xdc32('0x1cb'),'foreignKey':'DescriptionId'});db[_0xdc32('0xca')][_0xdc32('0x11c')](db[_0xdc32('0xca')],{'as':_0xdc32('0x1cc'),'foreignKey':_0xdc32('0x1c9')});db[_0xdc32('0xca')][_0xdc32('0x12d')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xdc32('0xcc')]['hasMany'](db['FreshsalesConfiguration'],{'as':_0xdc32('0x1c3'),'onDelete':_0xdc32('0x118'),'foreignKey':'AccountId'});db[_0xdc32('0xcd')]['hasMany'](db[_0xdc32('0xcf')],{'as':_0xdc32('0x1c5'),'foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xcd')][_0xdc32('0x11c')](db[_0xdc32('0xcf')],{'as':_0xdc32('0x1c7'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':_0xdc32('0x1bf'),'foreignKey':_0xdc32('0x1c9')});db[_0xdc32('0xcd')][_0xdc32('0x12d')](db[_0xdc32('0xcc')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x1c4')});db[_0xdc32('0xcf')][_0xdc32('0x11c')](db[_0xdc32('0xcf')],{'as':'Subject','foreignKey':_0xdc32('0x1c6')});db['FreshsalesField'][_0xdc32('0x11c')](db[_0xdc32('0xcf')],{'as':'Description','foreignKey':_0xdc32('0x1c8')});db[_0xdc32('0xcf')]['hasMany'](db[_0xdc32('0xcf')],{'as':_0xdc32('0x1cc'),'foreignKey':_0xdc32('0x1c9')});db[_0xdc32('0xcf')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xdc32('0x1ce')});db['ChatQueueReport'][_0xdc32('0x12d')](db[_0xdc32('0x140')],{});db['ChatQueueReport'][_0xdc32('0x12d')](db[_0xdc32('0xf8')],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e')});db[_0xdc32('0x1d3')][_0xdc32('0x12d')](db['CmContact'],{'as':_0xdc32('0x173'),'foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x1d3')]['belongsTo'](db[_0xdc32('0x135')],{});db['ChatQueueReport']['belongsTo'](db[_0xdc32('0x68')],{});db[_0xdc32('0x1d3')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{});db[_0xdc32('0x1d3')][_0xdc32('0x12d')](db['ChatQueue'],{});db[_0xdc32('0xd3')]['belongsTo'](db[_0xdc32('0x117')],{'onDelete':_0xdc32('0x118'),'foreignKey':'FromId'});db['ChatInternalMessage']['belongsTo'](db[_0xdc32('0x117')],{'onDelete':'cascade','foreignKey':_0xdc32('0x1d4')});db[_0xdc32('0xd8')][_0xdc32('0x11c')](db[_0xdc32('0xd7')],{'foreignKey':_0xdc32('0x1d5'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0xd8')][_0xdc32('0x11c')](db[_0xdc32('0xd5')],{'foreignKey':_0xdc32('0x1d5'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0xda')][_0xdc32('0x12d')](db[_0xdc32('0x55')],{});db[_0xdc32('0xda')][_0xdc32('0x12d')](db['CmList'],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e')});db[_0xdc32('0xda')][_0xdc32('0x12d')](db['CmContact'],{'as':_0xdc32('0x173'),'foreignKey':'ContactId'});db[_0xdc32('0xda')][_0xdc32('0x12d')](db[_0xdc32('0x124')],{});db[_0xdc32('0xda')][_0xdc32('0x12d')](db[_0xdc32('0x59')],{});db['SmsQueueReport'][_0xdc32('0x12d')](db[_0xdc32('0x117')],{});db[_0xdc32('0xda')][_0xdc32('0x12d')](db[_0xdc32('0x13c')],{});db[_0xdc32('0xdf')][_0xdc32('0x11c')](db[_0xdc32('0xd8')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0xdc32('0x11c')](db[_0xdc32('0xd7')],{'foreignKey':_0xdc32('0x1d6')});db[_0xdc32('0xdf')][_0xdc32('0x11c')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db['Team'][_0xdc32('0x12f')](db['User'],{'as':_0xdc32('0x159'),'through':_0xdc32('0x133')});db[_0xdc32('0x171')][_0xdc32('0x12f')](db[_0xdc32('0x1a')],{'through':'TeamVoiceQueue','as':_0xdc32('0x1d7')});db['Team'][_0xdc32('0x12f')](db[_0xdc32('0x3b')],{'through':_0xdc32('0x1d8'),'as':_0xdc32('0x139')});db[_0xdc32('0x171')][_0xdc32('0x12f')](db[_0xdc32('0x6c')],{'through':_0xdc32('0x19e'),'as':_0xdc32('0x13a')});db[_0xdc32('0x171')][_0xdc32('0x12f')](db['FaxQueue'],{'through':_0xdc32('0x1d9'),'as':'FaxQueues'});db[_0xdc32('0x171')][_0xdc32('0x12f')](db[_0xdc32('0x13c')],{'through':_0xdc32('0x18f'),'as':_0xdc32('0x13d')});db['Team'][_0xdc32('0x12f')](db[_0xdc32('0x60')],{'through':'team_has_openchannel_queues','as':_0xdc32('0x13e')});db[_0xdc32('0x171')]['belongsToMany'](db[_0xdc32('0x1da')],{'through':_0xdc32('0x1db'),'as':'WhatsappQueues'});db['Team'][_0xdc32('0x12f')](db['VoicePrefix'],{'through':_0xdc32('0x110'),'as':_0xdc32('0x138')});db[_0xdc32('0xea')][_0xdc32('0x11c')](db[_0xdc32('0x74')],{'as':_0xdc32('0x12b'),'foreignKey':'CampaignId'});db['Campaign'][_0xdc32('0x11c')](db[_0xdc32('0x150')],{'as':'HopperFinals','foreignKey':_0xdc32('0x1a5')});db['Campaign'][_0xdc32('0x11c')](db[_0xdc32('0x79')],{'as':_0xdc32('0x151'),'foreignKey':'CampaignId'});db[_0xdc32('0xea')]['hasMany'](db[_0xdc32('0x76')],{'as':_0xdc32('0x1dc'),'foreignKey':_0xdc32('0x1a5')});db[_0xdc32('0xea')]['belongsTo'](db[_0xdc32('0x26')],{'as':_0xdc32('0x26'),'foreignKey':_0xdc32('0x153')});db[_0xdc32('0xea')][_0xdc32('0x12d')](db[_0xdc32('0x26')],{'as':_0xdc32('0x1dd'),'foreignKey':_0xdc32('0x154')});db[_0xdc32('0xea')][_0xdc32('0x12d')](db[_0xdc32('0x155')],{'as':_0xdc32('0x155'),'foreignKey':_0xdc32('0x17a')});db[_0xdc32('0xea')][_0xdc32('0x12d')](db[_0xdc32('0xe4')],{'as':_0xdc32('0xe4'),'foreignKey':'SquareProjectId'});db[_0xdc32('0xea')][_0xdc32('0x12f')](db[_0xdc32('0xf8')],{'as':_0xdc32('0x157'),'through':_0xdc32('0x1de')});db[_0xdc32('0xea')][_0xdc32('0x12f')](db[_0xdc32('0xf8')],{'as':_0xdc32('0x15b'),'through':_0xdc32('0x1df')});db[_0xdc32('0xed')][_0xdc32('0x12d')](db[_0xdc32('0x6a')],{'as':_0xdc32('0x6a'),'foreignKey':_0xdc32('0x179')});db[_0xdc32('0xef')][_0xdc32('0x12d')](db['MailMessage'],{});db[_0xdc32('0xef')][_0xdc32('0x12d')](db[_0xdc32('0x3f')],{});db[_0xdc32('0xef')][_0xdc32('0x12d')](db['MailAccount'],{'foreignKey':_0xdc32('0x1e0'),'as':'FromAccount'});db[_0xdc32('0xef')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'foreignKey':'FromUserId','as':_0xdc32('0x1e1')});db[_0xdc32('0xef')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xdc32('0xef')][_0xdc32('0x12d')](db[_0xdc32('0x3b')],{'foreignKey':_0xdc32('0x1e2'),'as':_0xdc32('0x1e3')});db[_0xdc32('0xef')]['belongsTo'](db[_0xdc32('0x3a')],{'foreignKey':_0xdc32('0x1e4'),'as':_0xdc32('0x1e5')});db[_0xdc32('0xf1')][_0xdc32('0x12d')](db[_0xdc32('0x68')],{});db[_0xdc32('0xf1')]['belongsTo'](db[_0xdc32('0x135')],{});db[_0xdc32('0xf1')]['belongsTo'](db[_0xdc32('0x140')],{'foreignKey':_0xdc32('0x1e6'),'as':_0xdc32('0x1e7')});db[_0xdc32('0xf1')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'foreignKey':_0xdc32('0x1e8'),'as':'FromAgent'});db[_0xdc32('0xf1')]['belongsTo'](db[_0xdc32('0x117')],{'foreignKey':_0xdc32('0x1e9'),'as':'ToAgent'});db[_0xdc32('0xf1')][_0xdc32('0x12d')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0xdc32('0xf1')]['belongsTo'](db[_0xdc32('0x140')],{'foreignKey':_0xdc32('0x1ea'),'as':_0xdc32('0x1e5')});db[_0xdc32('0xf3')][_0xdc32('0x12d')](db['FaxMessage'],{});db['FaxTransferReport']['belongsTo'](db[_0xdc32('0x4d')],{});db[_0xdc32('0xf3')]['belongsTo'](db[_0xdc32('0x17f')],{'foreignKey':_0xdc32('0x1eb'),'as':_0xdc32('0x1e7')});db[_0xdc32('0xf3')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'foreignKey':_0xdc32('0x1e8'),'as':_0xdc32('0x1e1')});db['FaxTransferReport'][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'foreignKey':_0xdc32('0x1e9'),'as':_0xdc32('0x1ec')});db[_0xdc32('0xf3')][_0xdc32('0x12d')](db[_0xdc32('0x51')],{'foreignKey':_0xdc32('0x1ed'),'as':'ToQueue'});db[_0xdc32('0xf3')][_0xdc32('0x12d')](db[_0xdc32('0x17f')],{'foreignKey':'ToFaxAccountId','as':_0xdc32('0x1e5')});db[_0xdc32('0xf5')][_0xdc32('0x12d')](db[_0xdc32('0x5f')],{});db[_0xdc32('0xf5')][_0xdc32('0x12d')](db[_0xdc32('0x5d')],{});db[_0xdc32('0xf5')][_0xdc32('0x12d')](db[_0xdc32('0x5b')],{'foreignKey':_0xdc32('0x1ee'),'as':_0xdc32('0x1e7')});db[_0xdc32('0xf5')]['belongsTo'](db[_0xdc32('0x117')],{'foreignKey':_0xdc32('0x1e8'),'as':'FromAgent'});db[_0xdc32('0xf5')]['belongsTo'](db[_0xdc32('0x117')],{'foreignKey':_0xdc32('0x1e9'),'as':_0xdc32('0x1ec')});db[_0xdc32('0xf5')][_0xdc32('0x12d')](db[_0xdc32('0x60')],{'foreignKey':_0xdc32('0x1ef'),'as':'ToQueue'});db[_0xdc32('0xf5')][_0xdc32('0x12d')](db[_0xdc32('0x5b')],{'foreignKey':_0xdc32('0x1f0'),'as':_0xdc32('0x1e5')});db[_0xdc32('0xf7')][_0xdc32('0x12d')](db[_0xdc32('0x59')],{});db[_0xdc32('0xf7')]['belongsTo'](db['SmsInteraction'],{});db[_0xdc32('0xf7')][_0xdc32('0x12d')](db['SmsAccount'],{'foreignKey':_0xdc32('0x1f1'),'as':'FromAccount'});db[_0xdc32('0xf7')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'foreignKey':_0xdc32('0x1e8'),'as':_0xdc32('0x1e1')});db[_0xdc32('0xf7')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'foreignKey':_0xdc32('0x1e9'),'as':_0xdc32('0x1ec')});db['SmsTransferReport'][_0xdc32('0x12d')](db[_0xdc32('0x13c')],{'foreignKey':_0xdc32('0x1f2'),'as':_0xdc32('0x1e3')});db[_0xdc32('0xf7')]['belongsTo'](db[_0xdc32('0x55')],{'foreignKey':'ToSmsAccountId','as':_0xdc32('0x1e5')});db['CmList'][_0xdc32('0x11c')](db[_0xdc32('0x80')],{'as':'Dispositions','foreignKey':_0xdc32('0x16e'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0xf8')][_0xdc32('0x11c')](db[_0xdc32('0x1f3')],{'as':'CustomFields','foreignKey':_0xdc32('0x16e')});db[_0xdc32('0xf8')]['hasMany'](db['CmContact'],{'as':'Contacts','onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x16e')});db[_0xdc32('0xf8')]['hasMany'](db['CmHopperFinal'],{'as':_0xdc32('0x120'),'foreignKey':_0xdc32('0x16e')});db[_0xdc32('0xf8')]['hasMany'](db['CmHopperHistory'],{'as':_0xdc32('0x121'),'foreignKey':_0xdc32('0x16e')});db[_0xdc32('0xf8')][_0xdc32('0x11c')](db['ReportAgentPreview'],{'as':_0xdc32('0x7a'),'foreignKey':'ListId'});db[_0xdc32('0xf8')][_0xdc32('0x12f')](db[_0xdc32('0x1a')],{'as':_0xdc32('0x1f4'),'through':_0xdc32('0x158')});db[_0xdc32('0xf8')]['belongsToMany'](db[_0xdc32('0x117')],{'as':'Agents','through':_0xdc32('0x1f5')});db[_0xdc32('0xf9')]['hasMany'](db['VoiceExtension'],{'as':_0xdc32('0x11f'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0xf9')][_0xdc32('0x12f')](db['User'],{'as':'Agents','through':'UserVoicePrefix'});db[_0xdc32('0xf9')]['belongsToMany'](db[_0xdc32('0x171')],{'through':_0xdc32('0x110'),'as':'Teams'});db['UserProfile'][_0xdc32('0x11c')](db[_0xdc32('0x117')],{'as':_0xdc32('0x186'),'foreignKey':_0xdc32('0x1f6')});db[_0xdc32('0x12e')]['hasMany'](db['UserProfileSection'],{'as':_0xdc32('0x1f7'),'foreignKey':'userProfileId','onDelete':'cascade'});db['UserProfileSection'][_0xdc32('0x11c')](db[_0xdc32('0xfe')],{'as':_0xdc32('0x1f8'),'foreignKey':'sectionId','onDelete':_0xdc32('0x118')});db['WhatsappAccount'][_0xdc32('0x11c')](db['Disposition'],{'as':_0xdc32('0x16b'),'foreignKey':'WhatsappAccountId','onDelete':_0xdc32('0x118')});db[_0xdc32('0x102')][_0xdc32('0x11c')](db['CannedAnswer'],{'as':'Answers','foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0xdc32('0x11c')](db['WhatsappMessage'],{'as':_0xdc32('0x15d'),'foreignKey':_0xdc32('0x1f9')});db[_0xdc32('0x102')][_0xdc32('0x11c')](db[_0xdc32('0x128')],{'as':_0xdc32('0x180')});db[_0xdc32('0x102')][_0xdc32('0x11c')](db[_0xdc32('0x104')],{'as':_0xdc32('0x14b'),'foreignKey':_0xdc32('0x1f9'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x102')][_0xdc32('0x12d')](db[_0xdc32('0xf8')],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e')});db[_0xdc32('0x102')][_0xdc32('0x12d')](db[_0xdc32('0x84')],{'as':_0xdc32('0x156'),'foreignKey':_0xdc32('0x170')});db[_0xdc32('0x102')][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':_0xdc32('0x159'),'through':_0xdc32('0x1fa')});db[_0xdc32('0x104')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'onDelete':_0xdc32('0x168')});db[_0xdc32('0x104')][_0xdc32('0x12d')](db[_0xdc32('0x1da')],{'onDelete':_0xdc32('0x168')});db['WhatsappApplication']['belongsTo'](db[_0xdc32('0x102')],{'onDelete':_0xdc32('0x168')});db[_0xdc32('0x104')]['belongsTo'](db[_0xdc32('0x155')],{'onDelete':_0xdc32('0x168'),'foreignKey':_0xdc32('0x17a')});db[_0xdc32('0x104')][_0xdc32('0x12d')](db[_0xdc32('0x8e')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xdc32('0x128')]['hasMany'](db[_0xdc32('0x106')],{'as':'Messages','onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1fb')});db[_0xdc32('0x128')][_0xdc32('0x12d')](db[_0xdc32('0x102')],{'as':'Account','foreignKey':_0xdc32('0x1f9')});db[_0xdc32('0x128')][_0xdc32('0x12d')](db[_0xdc32('0x131')],{'as':_0xdc32('0x173'),'foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x128')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'as':_0xdc32('0x18a'),'foreignKey':'UserId'});db[_0xdc32('0x128')][_0xdc32('0x12f')](db['Tag'],{'through':_0xdc32('0x1b5'),'as':_0xdc32('0x174')});db['WhatsappInteraction']['belongsToMany'](db[_0xdc32('0x8e')],{'through':_0xdc32('0x1b5'),'as':'ThroughTags'});db[_0xdc32('0x128')][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':'Users','through':_0xdc32('0x1fc'),'foreignKey':_0xdc32('0x1fb')});db[_0xdc32('0x106')]['belongsTo'](db[_0xdc32('0x117')],{'as':_0xdc32('0x117')});db[_0xdc32('0x106')][_0xdc32('0x12d')](db[_0xdc32('0x131')],{'onDelete':_0xdc32('0x118'),'as':_0xdc32('0x173')});db[_0xdc32('0x106')][_0xdc32('0x12d')](db[_0xdc32('0x128')],{'onDelete':_0xdc32('0x118'),'as':'Interaction','foreignKey':_0xdc32('0x1fb')});db[_0xdc32('0x106')][_0xdc32('0x12d')](db[_0xdc32('0x102')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x1f9')});db['WhatsappQueueReport'][_0xdc32('0x12d')](db[_0xdc32('0x102')],{});db[_0xdc32('0x108')][_0xdc32('0x12d')](db[_0xdc32('0xf8')],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e')});db[_0xdc32('0x108')][_0xdc32('0x12d')](db[_0xdc32('0x131')],{'as':'Contact','foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x108')][_0xdc32('0x12d')](db[_0xdc32('0x128')],{});db[_0xdc32('0x108')][_0xdc32('0x12d')](db['WhatsappQueue'],{});db[_0xdc32('0x108')]['belongsTo'](db[_0xdc32('0x106')],{});db[_0xdc32('0x108')][_0xdc32('0x12d')](db['User'],{});db['WhatsappTransferReport'][_0xdc32('0x12d')](db[_0xdc32('0x106')],{});db[_0xdc32('0x10a')][_0xdc32('0x12d')](db['WhatsappInteraction'],{});db[_0xdc32('0x10a')][_0xdc32('0x12d')](db[_0xdc32('0x102')],{'foreignKey':'FromWhatsappAccountId','as':_0xdc32('0x1e7')});db[_0xdc32('0x10a')][_0xdc32('0x12d')](db['WhatsappAccount'],{'foreignKey':_0xdc32('0x1fd'),'as':_0xdc32('0x1e5')});db[_0xdc32('0x10a')][_0xdc32('0x12d')](db[_0xdc32('0x1da')],{'foreignKey':'ToQueueId','as':'ToQueue'});db[_0xdc32('0x10a')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'foreignKey':_0xdc32('0x1e8'),'as':_0xdc32('0x1e1')});db['WhatsappTransferReport'][_0xdc32('0x12d')](db['User'],{'foreignKey':'ToUserId','as':_0xdc32('0x1ec')});db[_0xdc32('0x1da')][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':_0xdc32('0x159'),'through':_0xdc32('0x35'),'foreignKey':_0xdc32('0x1fe')});db[_0xdc32('0x1da')]['belongsToMany'](db['Team'],{'through':_0xdc32('0x1db'),'as':_0xdc32('0x15a')});db[_0xdc32('0x11b')]['belongsTo'](db['User'],{'as':_0xdc32('0x1ff'),'foreignKey':_0xdc32('0x119'),'onDelete':'cascade','hooks':!![]});db[_0xdc32('0x10c')][_0xdc32('0x11a')](db[_0xdc32('0xc7')],{'as':_0xdc32('0xc7'),'onDelete':_0xdc32('0x168')});db[_0xdc32('0x10c')][_0xdc32('0x11a')](db[_0xdc32('0x37')],{'as':_0xdc32('0x169'),'onDelete':'restrict'});db[_0xdc32('0x10c')][_0xdc32('0x11a')](db[_0xdc32('0x167')],{'as':_0xdc32('0x16a'),'onDelete':_0xdc32('0x168')});module[_0xdc32('0x200')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x3e74=['../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userMailQueue/userMailQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../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','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/tag/tag.model','ContactItemType','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','../api/trigger/trigger.model','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','hasOne','cascade','UserId','userSetting','VoiceRecording','Recordings','hasMany','VoiceQueuesRt','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','Hoppers','SET\x20NULL','belongsTo','UserProfile','userProfileId','belongsToMany','Groups','chat_group_has_users','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','VoiceQueues','VoicePrefixes','MailQueue','UserMailQueue','ChatQueues','UserChatQueue','UserFaxQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','VoiceChanSpy','SpiedAgents','VoiceContext','VoiceExtension','Applications','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopper','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceCallReport','uniqueid','VoiceAgentReport','AgentReports','ContactId','MailServerIn','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Interactions','List','Template','TemplateId','team_has_mail_queues','Teams','MailInteractionId','Account','Contact','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Attachments','Interaction','ChatOfflineMessageId','MailQueueReport','ListId','Items','FaxAccountId','user_has_fax_accounts','TagId','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','Users','SmsQueueId','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatMessage','ChatInteractionId','ChatGroupId','CompanyId','CmContactHasItem','Phones','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CampaignId','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','Mohs','chat_interaction_has_tags','ItemType','CmContactId','Trigger','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','CustomReportId','Fields','MetricId','SalesforceAccount','SalesforceConfiguration','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Variable','Field','VariableId','DeskAccount','ZohoConfiguration','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowAccount','Dynamics365Account','Dynamics365Field','Dynamics365Configuration','SessionId','ProjectId','MailQueues','team_has_chat_queues','team_has_whatsapp_queues','VoicePrefix','TrunkBackup','SquareProject','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CmCustomField','Contacts','Queues','Extensions','UserProfileSection','UserProfileSections','sectionId','WhatsappAccountId','WhatsappMessage','user_has_whatsapp_accounts','WhatsappInteractionId','whatsapp_interaction_has_tags','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','user','exports','lodash','jstz','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','sequelizeHistory','name','utf8_general_ci','database','username','password','options','User','import','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport'];(function(_0xe64cd,_0x4f5d71){var _0x551930=function(_0x46c8be){while(--_0x46c8be){_0xe64cd['push'](_0xe64cd['shift']());}};_0x551930(++_0x4f5d71);}(_0x3e74,0x1e4));var _0x43e7=function(_0xf20ac5,_0x467994){_0xf20ac5=_0xf20ac5-0x0;var _0x1f143b=_0x3e74[_0xf20ac5];return _0x1f143b;};'use strict';var config=require('../config/environment');var Sequelize=require('sequelize');var _=require(_0x43e7('0x0'));var jstz=require(_0x43e7('0x1'));var timezone=jstz['determine']();config[_0x43e7('0x2')]=_[_0x43e7('0x3')](config[_0x43e7('0x2')],{'database':_0x43e7('0x4'),'username':_0x43e7('0x5'),'password':_0x43e7('0x6'),'options':{'host':_0x43e7('0x7'),'port':0xcea,'dialect':_0x43e7('0x8'),'dialectOptions':{'charset':_0x43e7('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0x43e7('0xa')]=_['defaultsDeep'](config[_0x43e7('0xa')],{'database':'motion2','username':_0x43e7('0x5'),'password':_0x43e7('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x43e7('0xb')](),'define':{'charset':'utf8','collate':_0x43e7('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x43e7('0xd')],config[_0x43e7('0x2')][_0x43e7('0xe')],config[_0x43e7('0x2')][_0x43e7('0xf')],config['sequelize'][_0x43e7('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x43e7('0xa')][_0x43e7('0xd')],config[_0x43e7('0xa')][_0x43e7('0xe')],config[_0x43e7('0xa')]['password'],config[_0x43e7('0xa')][_0x43e7('0x10')])};db[_0x43e7('0x11')]=db['sequelize'][_0x43e7('0x12')]('../api/user/user.model');db['VoiceChanSpy']=db[_0x43e7('0x2')]['import'](_0x43e7('0x13'));db['VoiceContext']=db[_0x43e7('0x2')]['import'](_0x43e7('0x14'));db['VoiceExtension']=db['sequelize'][_0x43e7('0x12')]('../api/voiceExtension/voiceExtension.model');db[_0x43e7('0x15')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x16'));db[_0x43e7('0x17')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x18'));db['VoiceRecording']=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x19'));db[_0x43e7('0x1a')]=db['sequelize'][_0x43e7('0x12')]('../api/screenRecording/screenRecording.model');db[_0x43e7('0x1b')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x1c'));db[_0x43e7('0x1d')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x1e'));db['VoiceCallReport']=db['sequelize'][_0x43e7('0x12')](_0x43e7('0x1f'));db['VoiceDialReport']=db[_0x43e7('0x2')]['import'](_0x43e7('0x20'));db['VoiceAgentReport']=db['sequelize']['import'](_0x43e7('0x21'));db[_0x43e7('0x22')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x23'));db['MemberReport']=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x24'));db[_0x43e7('0x25')]=db[_0x43e7('0x2')]['import'](_0x43e7('0x26'));db[_0x43e7('0x27')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x28'));db[_0x43e7('0x29')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x2a'));db[_0x43e7('0x2b')]=db['sequelize'][_0x43e7('0x12')](_0x43e7('0x2c'));db['UserChatQueue']=db['sequelize'][_0x43e7('0x12')]('../api/userChatQueue/userChatQueue.model');db['UserMailQueue']=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x2d'));db['UserFaxQueue']=db[_0x43e7('0x2')][_0x43e7('0x12')]('../api/userFaxQueue/userFaxQueue.model');db[_0x43e7('0x2e')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x2f'));db[_0x43e7('0x30')]=db[_0x43e7('0x2')]['import'](_0x43e7('0x31'));db[_0x43e7('0x32')]=db[_0x43e7('0x2')]['import']('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db[_0x43e7('0x2')]['import'](_0x43e7('0x33'));db[_0x43e7('0x34')]=db[_0x43e7('0x2')]['import'](_0x43e7('0x35'));db[_0x43e7('0x36')]=db[_0x43e7('0x2')][_0x43e7('0x12')]('../api/mailAccount/mailAccount.model');db['MailQueue']=db[_0x43e7('0x2')]['import'](_0x43e7('0x37'));db[_0x43e7('0x38')]=db['sequelize'][_0x43e7('0x12')]('../api/mailSubstatus/mailSubstatus.model');db[_0x43e7('0x39')]=db['sequelize'][_0x43e7('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x43e7('0x3a')]=db['sequelize']['import'](_0x43e7('0x3b'));db[_0x43e7('0x3c')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x3d'));db['MailQueueReport']=db[_0x43e7('0x2')]['import'](_0x43e7('0x3e'));db[_0x43e7('0x3f')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x40'));db[_0x43e7('0x41')]=db[_0x43e7('0x2')][_0x43e7('0x12')]('../api/dashboardItem/dashboardItem.model');db[_0x43e7('0x42')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x43'));db[_0x43e7('0x44')]=db['sequelize'][_0x43e7('0x12')](_0x43e7('0x45'));db[_0x43e7('0x46')]=db['sequelize']['import']('../api/faxInteraction/faxInteraction.model');db[_0x43e7('0x47')]=db[_0x43e7('0x2')]['import'](_0x43e7('0x48'));db[_0x43e7('0x49')]=db[_0x43e7('0x2')]['import'](_0x43e7('0x4a'));db[_0x43e7('0x4b')]=db['sequelize'][_0x43e7('0x12')](_0x43e7('0x4c'));db[_0x43e7('0x4d')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x4e'));db['SmsApplication']=db['sequelize']['import'](_0x43e7('0x4f'));db[_0x43e7('0x50')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x51'));db[_0x43e7('0x52')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x53'));db[_0x43e7('0x54')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x55'));db['OpenchannelAccount']=db[_0x43e7('0x2')]['import']('../api/openchannelAccount/openchannelAccount.model');db['OpenchannelApplication']=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x56'));db[_0x43e7('0x57')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x58'));db[_0x43e7('0x59')]=db['sequelize'][_0x43e7('0x12')](_0x43e7('0x5a'));db[_0x43e7('0x5b')]=db[_0x43e7('0x2')]['import']('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x5c'));db[_0x43e7('0x5d')]=db[_0x43e7('0x2')][_0x43e7('0x12')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x43e7('0x5e')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x5f'));db['ChatInteraction']=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x60'));db['ChatMessage']=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x61'));db[_0x43e7('0x62')]=db['sequelize'][_0x43e7('0x12')](_0x43e7('0x63'));db[_0x43e7('0x64')]=db[_0x43e7('0x2')][_0x43e7('0x12')]('../api/chatQueue/chatQueue.model');db[_0x43e7('0x65')]=db[_0x43e7('0x2')]['import'](_0x43e7('0x66'));db[_0x43e7('0x67')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x68'));db[_0x43e7('0x69')]=db['sequelize'][_0x43e7('0x12')](_0x43e7('0x6a'));db[_0x43e7('0x6b')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x6c'));db['CmHopper']=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x6d'));db[_0x43e7('0x6e')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x6f'));db[_0x43e7('0x70')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x71'));db[_0x43e7('0x72')]=db['sequelize'][_0x43e7('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x43e7('0x73')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x74'));db['CmCustomField']=db['sequelize'][_0x43e7('0x12')](_0x43e7('0x75'));db[_0x43e7('0x76')]=db[_0x43e7('0x2')][_0x43e7('0x12')]('../api/action/action.model');db[_0x43e7('0x77')]=db['sequelize'][_0x43e7('0x12')]('../api/automation/automation.model');db[_0x43e7('0x78')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x79'));db[_0x43e7('0x7a')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x7b'));db[_0x43e7('0x7c')]=db['sequelize'][_0x43e7('0x12')](_0x43e7('0x7d'));db[_0x43e7('0x7e')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x7f'));db[_0x43e7('0x80')]=db[_0x43e7('0x2')]['import']('../api/pause/pause.model');db['Cdr']=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x81'));db[_0x43e7('0x82')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x83'));db[_0x43e7('0x84')]=db['sequelize']['import'](_0x43e7('0x85'));db['Sound']=db[_0x43e7('0x2')][_0x43e7('0x12')]('../api/sound/sound.model');db['Tag']=db['sequelize'][_0x43e7('0x12')](_0x43e7('0x86'));db[_0x43e7('0x87')]=db['sequelize'][_0x43e7('0x12')]('../api/contactItemType/contactItemType.model');db['CmContactHasItem']=db['sequelize'][_0x43e7('0x12')](_0x43e7('0x88'));db['CmHopperAdditionalPhone']=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x89'));db['Template']=db['sequelize'][_0x43e7('0x12')](_0x43e7('0x8a'));db['Trigger']=db['sequelize']['import'](_0x43e7('0x8b'));db['Variable']=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x8c'));db[_0x43e7('0x8d')]=db[_0x43e7('0x2')][_0x43e7('0x12')]('../api/integration/integration.model');db[_0x43e7('0x8e')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x8f'));db[_0x43e7('0x90')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x91'));db[_0x43e7('0x92')]=db[_0x43e7('0x2')]['import'](_0x43e7('0x93'));db[_0x43e7('0x94')]=db[_0x43e7('0x2')]['import'](_0x43e7('0x95'));db[_0x43e7('0x96')]=db['sequelize'][_0x43e7('0x12')](_0x43e7('0x97'));db[_0x43e7('0x98')]=db[_0x43e7('0x2')]['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0x43e7('0x99')]=db['sequelize']['import'](_0x43e7('0x9a'));db['SalesforceAccount']=db[_0x43e7('0x2')]['import']('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db['sequelize'][_0x43e7('0x12')](_0x43e7('0x9b'));db[_0x43e7('0x9c')]=db[_0x43e7('0x2')][_0x43e7('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x43e7('0x9d')]=db[_0x43e7('0x2')]['import'](_0x43e7('0x9e'));db[_0x43e7('0x9f')]=db[_0x43e7('0x2')]['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x43e7('0xa0')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xa1'));db['DeskAccount']=db[_0x43e7('0x2')][_0x43e7('0x12')]('../api/intDeskAccount/intDeskAccount.model');db[_0x43e7('0xa2')]=db[_0x43e7('0x2')][_0x43e7('0x12')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x43e7('0xa3')]=db['sequelize'][_0x43e7('0x12')](_0x43e7('0xa4'));db[_0x43e7('0xa5')]=db[_0x43e7('0x2')][_0x43e7('0x12')]('../api/intZohoAccount/intZohoAccount.model');db['ZohoConfiguration']=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xa6'));db[_0x43e7('0xa7')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xa8'));db[_0x43e7('0xa9')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xaa'));db['ZendeskConfiguration']=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xab'));db[_0x43e7('0xac')]=db['sequelize'][_0x43e7('0x12')]('../api/intZendeskField/intZendeskField.model');db[_0x43e7('0xad')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xae'));db[_0x43e7('0xaf')]=db['sequelize'][_0x43e7('0x12')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db['FreshdeskField']=db[_0x43e7('0x2')][_0x43e7('0x12')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db['sequelize'][_0x43e7('0x12')](_0x43e7('0xb0'));db[_0x43e7('0xb1')]=db[_0x43e7('0x2')]['import'](_0x43e7('0xb2'));db[_0x43e7('0xb3')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xb4'));db['ServicenowAccount']=db[_0x43e7('0x2')]['import'](_0x43e7('0xb5'));db[_0x43e7('0xb6')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xb7'));db[_0x43e7('0xb8')]=db['sequelize']['import'](_0x43e7('0xb9'));db['Dynamics365Account']=db[_0x43e7('0x2')]['import'](_0x43e7('0xba'));db['Dynamics365Configuration']=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xbb'));db['Dynamics365Field']=db['sequelize'][_0x43e7('0x12')](_0x43e7('0xbc'));db[_0x43e7('0xbd')]=db[_0x43e7('0x2')]['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x43e7('0xbe')]=db[_0x43e7('0x2')]['import'](_0x43e7('0xbf'));db[_0x43e7('0xc0')]=db['sequelize'][_0x43e7('0x12')](_0x43e7('0xc1'));db[_0x43e7('0x8d')]=db['sequelize']['import'](_0x43e7('0xc2'));db[_0x43e7('0xc3')]=db['sequelize']['import'](_0x43e7('0xc4'));db[_0x43e7('0xc5')]=db['sequelize']['import'](_0x43e7('0xc6'));db[_0x43e7('0xc7')]=db['sequelize'][_0x43e7('0x12')](_0x43e7('0xc8'));db[_0x43e7('0xc9')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xca'));db[_0x43e7('0xcb')]=db['sequelize']['import'](_0x43e7('0xcc'));db[_0x43e7('0xcd')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xce'));db[_0x43e7('0xcf')]=db[_0x43e7('0x2')]['import'](_0x43e7('0xd0'));db[_0x43e7('0xd1')]=db['sequelize'][_0x43e7('0x12')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db['sequelize']['import'](_0x43e7('0xd2'));db[_0x43e7('0xd3')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xd4'));db[_0x43e7('0xd5')]=db['sequelize'][_0x43e7('0x12')]('../api/setting/setting.model');db[_0x43e7('0xd6')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xd7'));db['SquareProject']=db[_0x43e7('0x2')]['import'](_0x43e7('0xd8'));db[_0x43e7('0xd9')]=db['sequelize']['import'](_0x43e7('0xda'));db['SquareMessage']=db[_0x43e7('0x2')]['import'](_0x43e7('0xdb'));db[_0x43e7('0xdc')]=db[_0x43e7('0x2')]['import'](_0x43e7('0xdd'));db['License']=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xde'));db[_0x43e7('0xdf')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xe0'));db['Migration']=db[_0x43e7('0x2')][_0x43e7('0x12')]('../api/migration/migration.model');db[_0x43e7('0xe1')]=db['sequelize'][_0x43e7('0x12')](_0x43e7('0xe2'));db[_0x43e7('0xe3')]=db['sequelize'][_0x43e7('0x12')](_0x43e7('0xe4'));db[_0x43e7('0xe5')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xe6'));db['ChatTransferReport']=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xe7'));db[_0x43e7('0xe8')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xe9'));db['OpenchannelTransferReport']=db[_0x43e7('0x2')]['import'](_0x43e7('0xea'));db[_0x43e7('0xeb')]=db[_0x43e7('0x2')]['import']('../api/smsTransferReport/smsTransferReport.model');db[_0x43e7('0xec')]=db[_0x43e7('0x2')][_0x43e7('0x12')]('../api/cmList/cmList.model');db['VoicePrefix']=db['sequelize'][_0x43e7('0x12')]('../api/voicePrefix/voicePrefix.model');db['UserProfile']=db['sequelize'][_0x43e7('0x12')](_0x43e7('0xed'));db['UserProfileSection']=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xee'));db[_0x43e7('0xef')]=db[_0x43e7('0x2')]['import']('../api/userProfileResource/userProfileResource.model');db[_0x43e7('0xf0')]=db[_0x43e7('0x2')]['import'](_0x43e7('0xf1'));db[_0x43e7('0xf2')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xf3'));db[_0x43e7('0xf4')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xf5'));db[_0x43e7('0xf6')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xf7'));db['WhatsappMessage']=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xf8'));db[_0x43e7('0xf9')]=db[_0x43e7('0x2')][_0x43e7('0x12')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x43e7('0xfa')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xfb'));db[_0x43e7('0xfc')]=db['sequelize'][_0x43e7('0x12')](_0x43e7('0xfd'));db[_0x43e7('0xfe')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0xff'));db[_0x43e7('0x100')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x101'));db[_0x43e7('0x102')]=db[_0x43e7('0x2')][_0x43e7('0x12')](_0x43e7('0x103'));db[_0x43e7('0x104')]=db[_0x43e7('0x2')]['import'](_0x43e7('0x105'));db[_0x43e7('0x106')]=db['sequelize']['import'](_0x43e7('0x107'));db[_0x43e7('0x108')]=db['sequelize']['import']('../api/mailInteractionHasTag/mailInteractionHasTag.model');db['User'][_0x43e7('0x109')](db[_0x43e7('0x1b')],{'as':_0x43e7('0x1b'),'onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x10b')});db['User'][_0x43e7('0x109')](db[_0x43e7('0x106')],{'as':_0x43e7('0x10c'),'onDelete':'cascade','foreignKey':_0x43e7('0x10b')});db['User']['hasMany'](db[_0x43e7('0x10d')],{'as':_0x43e7('0x10e'),'foreignKey':_0x43e7('0x10b')});db[_0x43e7('0x11')][_0x43e7('0x10f')](db[_0x43e7('0x29')],{'as':_0x43e7('0x110'),'foreignKey':'UserId'});db[_0x43e7('0x11')][_0x43e7('0x10f')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0x43e7('0x10a'),'hooks':!![]});db[_0x43e7('0x11')]['hasMany'](db[_0x43e7('0x70')],{'as':_0x43e7('0x111'),'foreignKey':_0x43e7('0x10b')});db[_0x43e7('0x11')][_0x43e7('0x10f')](db[_0x43e7('0x72')],{'as':_0x43e7('0x112'),'foreignKey':_0x43e7('0x10b')});db[_0x43e7('0x11')]['hasMany'](db[_0x43e7('0x73')],{'as':'ReportAgentPreview','foreignKey':_0x43e7('0x10b')});db[_0x43e7('0x11')][_0x43e7('0x10f')](db['OpenchannelInteraction'],{'as':_0x43e7('0x113'),'foreignKey':_0x43e7('0x10b')});db[_0x43e7('0x11')]['hasMany'](db[_0x43e7('0x114')],{'as':_0x43e7('0x115'),'foreignKey':_0x43e7('0x10b')});db[_0x43e7('0x11')][_0x43e7('0x10f')](db[_0x43e7('0x50')],{'as':_0x43e7('0x116'),'foreignKey':_0x43e7('0x10b')});db['User']['hasMany'](db[_0x43e7('0x46')],{'as':_0x43e7('0x117'),'foreignKey':_0x43e7('0x10b')});db['User'][_0x43e7('0x10f')](db[_0x43e7('0x39')],{'as':_0x43e7('0x118'),'foreignKey':'UserId'});db[_0x43e7('0x11')][_0x43e7('0x10f')](db['WhatsappInteraction'],{'as':_0x43e7('0x119'),'foreignKey':'UserId'});db[_0x43e7('0x11')][_0x43e7('0x10f')](db[_0x43e7('0xf0')],{'as':_0x43e7('0x11a'),'foreignKey':'SenderId'});db[_0x43e7('0x11')]['hasMany'](db['CmHopper'],{'as':_0x43e7('0x11b'),'foreignKey':_0x43e7('0x10b'),'onDelete':_0x43e7('0x11c')});db['User'][_0x43e7('0x11d')](db[_0x43e7('0x11e')],{'as':_0x43e7('0x11e'),'foreignKey':_0x43e7('0x11f')});db[_0x43e7('0x11')][_0x43e7('0x120')](db[_0x43e7('0x65')],{'as':_0x43e7('0x121'),'through':_0x43e7('0x122')});db[_0x43e7('0x11')][_0x43e7('0x120')](db[_0x43e7('0x6b')],{'as':'Contacts','through':_0x43e7('0x123')});db['User'][_0x43e7('0x120')](db[_0x43e7('0xec')],{'as':_0x43e7('0x124'),'through':_0x43e7('0x125')});db[_0x43e7('0x11')]['belongsToMany'](db[_0x43e7('0xdc')],{'through':_0x43e7('0x126')});db[_0x43e7('0x11')][_0x43e7('0x120')](db[_0x43e7('0x39')],{'as':_0x43e7('0x118'),'through':_0x43e7('0x127')});db['User'][_0x43e7('0x120')](db['ChatInteraction'],{'as':_0x43e7('0x115'),'through':_0x43e7('0x128')});db[_0x43e7('0x11')]['belongsToMany'](db[_0x43e7('0x46')],{'as':_0x43e7('0x117'),'through':_0x43e7('0x129')});db[_0x43e7('0x11')][_0x43e7('0x120')](db[_0x43e7('0x50')],{'as':'SmsInteractions','through':_0x43e7('0x12a')});db[_0x43e7('0x11')][_0x43e7('0x120')](db['OpenchannelInteraction'],{'as':_0x43e7('0x113'),'through':'user_has_openchannel_interactions'});db[_0x43e7('0x11')][_0x43e7('0x120')](db[_0x43e7('0xf6')],{'as':_0x43e7('0x119'),'through':'user_has_whatsapp_interactions'});db[_0x43e7('0x11')][_0x43e7('0x120')](db[_0x43e7('0x17')],{'as':_0x43e7('0x12b'),'through':_0x43e7('0x2b'),'required':![]});db[_0x43e7('0x11')][_0x43e7('0x120')](db['VoicePrefix'],{'as':_0x43e7('0x12c'),'through':_0x43e7('0x104'),'required':![]});db['User']['belongsToMany'](db[_0x43e7('0x12d')],{'as':'MailQueues','through':_0x43e7('0x12e'),'required':![]});db[_0x43e7('0x11')][_0x43e7('0x120')](db[_0x43e7('0x64')],{'as':_0x43e7('0x12f'),'through':_0x43e7('0x130'),'required':![],'hooks':!![]});db['User'][_0x43e7('0x120')](db[_0x43e7('0x49')],{'as':'FaxQueues','through':_0x43e7('0x131'),'required':![]});db['User'][_0x43e7('0x120')](db[_0x43e7('0x54')],{'as':_0x43e7('0x132'),'through':_0x43e7('0x2e'),'required':![]});db[_0x43e7('0x11')]['belongsToMany'](db[_0x43e7('0x5b')],{'as':_0x43e7('0x133'),'through':_0x43e7('0x30'),'required':![]});db['User'][_0x43e7('0x120')](db[_0x43e7('0xfc')],{'as':_0x43e7('0x134'),'through':_0x43e7('0x32'),'required':![]});db[_0x43e7('0x11')][_0x43e7('0x120')](db['CmList'],{'through':_0x43e7('0x125')});db[_0x43e7('0x11')]['belongsToMany'](db[_0x43e7('0x135')],{'as':_0x43e7('0x136'),'through':_0x43e7('0x137')});db[_0x43e7('0x11')][_0x43e7('0x120')](db[_0x43e7('0x42')],{'as':_0x43e7('0x138'),'through':'user_has_fax_accounts'});db[_0x43e7('0x11')]['belongsToMany'](db[_0x43e7('0x36')],{'as':_0x43e7('0x139'),'through':_0x43e7('0x13a')});db[_0x43e7('0x11')][_0x43e7('0x120')](db[_0x43e7('0x13b')],{'as':'OpenchannelAccounts','through':_0x43e7('0x13c')});db[_0x43e7('0x11')]['belongsToMany'](db['SmsAccount'],{'as':_0x43e7('0x13d'),'through':_0x43e7('0x13e')});db['User'][_0x43e7('0x120')](db[_0x43e7('0xf2')],{'as':_0x43e7('0x13f'),'through':'user_has_whatsapp_accounts'});db[_0x43e7('0x140')][_0x43e7('0x10f')](db['VoiceExtension'],{'as':_0x43e7('0x141'),'onDelete':_0x43e7('0x10a'),'foreignKey':'ChanSpyId'});db[_0x43e7('0x142')][_0x43e7('0x10f')](db[_0x43e7('0x143')],{'onDelete':'cascade'});db[_0x43e7('0x143')][_0x43e7('0x10f')](db[_0x43e7('0x143')],{'as':_0x43e7('0x144'),'onDelete':'cascade'});db['VoiceMusicOnHold'][_0x43e7('0x120')](db[_0x43e7('0x145')],{'as':_0x43e7('0x146'),'through':_0x43e7('0x147')});db[_0x43e7('0x17')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0x43e7('0x148'),'foreignKey':_0x43e7('0x149')});db[_0x43e7('0x17')]['hasMany'](db[_0x43e7('0x14a')],{'as':_0x43e7('0x11b'),'foreignKey':_0x43e7('0x149')});db[_0x43e7('0x17')]['hasMany'](db[_0x43e7('0x70')],{'as':_0x43e7('0x111'),'foreignKey':_0x43e7('0x149')});db[_0x43e7('0x17')][_0x43e7('0x10f')](db['CmHopperHistory'],{'as':_0x43e7('0x14b'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x43e7('0x10f')](db[_0x43e7('0x73')],{'as':_0x43e7('0x73'),'foreignKey':_0x43e7('0x149')});db[_0x43e7('0x17')][_0x43e7('0x10f')](db[_0x43e7('0x6e')],{'as':_0x43e7('0x14c'),'foreignKey':_0x43e7('0x149')});db['VoiceQueue'][_0x43e7('0x10f')](db[_0x43e7('0xcd')],{'as':_0x43e7('0x14d'),'foreignKey':_0x43e7('0x149')});db['VoiceQueue']['belongsTo'](db[_0x43e7('0x25')],{'as':_0x43e7('0x25'),'foreignKey':_0x43e7('0x14e')});db[_0x43e7('0x17')]['belongsTo'](db[_0x43e7('0x25')],{'as':'TrunkBackup','foreignKey':_0x43e7('0x14f')});db[_0x43e7('0x17')][_0x43e7('0x11d')](db['Interval'],{'as':_0x43e7('0x7e'),'foreignKey':_0x43e7('0x150')});db['VoiceQueue'][_0x43e7('0x11d')](db['Pause'],{'as':_0x43e7('0x151'),'foreignKey':_0x43e7('0x152')});db[_0x43e7('0x17')][_0x43e7('0x120')](db[_0x43e7('0xec')],{'as':_0x43e7('0x124'),'through':_0x43e7('0x153')});db[_0x43e7('0x17')][_0x43e7('0x120')](db[_0x43e7('0x11')],{'as':_0x43e7('0x154'),'through':_0x43e7('0x2b')});db[_0x43e7('0x17')][_0x43e7('0x120')](db[_0x43e7('0xdc')],{'as':'Teams','through':'TeamVoiceQueue'});db['VoiceQueue'][_0x43e7('0x120')](db[_0x43e7('0xec')],{'as':_0x43e7('0x155'),'through':_0x43e7('0x156')});db['VoiceRecording'][_0x43e7('0x11d')](db['User'],{'as':_0x43e7('0x11'),'foreignKey':_0x43e7('0x10b')});db['ScreenRecording']['belongsTo'](db[_0x43e7('0x11')],{'as':_0x43e7('0x11'),'foreignKey':_0x43e7('0x10b')});db[_0x43e7('0x1b')][_0x43e7('0x10f')](db[_0x43e7('0x1d')],{'as':_0x43e7('0x157'),'onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x158'),'sourceKey':'mailbox'});db[_0x43e7('0x1d')][_0x43e7('0x11d')](db[_0x43e7('0x1b')],{'foreignKey':_0x43e7('0x158'),'targetKey':_0x43e7('0x159')});db[_0x43e7('0x15a')]['hasMany'](db[_0x43e7('0x22')],{'as':'QueueCalls','foreignKey':_0x43e7('0x15b'),'constraints':![]});db[_0x43e7('0x15a')]['hasMany'](db[_0x43e7('0x15c')],{'as':_0x43e7('0x15d'),'foreignKey':_0x43e7('0x15b'),'constraints':![]});db['VoiceCallReport'][_0x43e7('0x11d')](db[_0x43e7('0x11')],{'as':'User','foreignKey':_0x43e7('0x10b')});db['VoiceCallReport'][_0x43e7('0x11d')](db['CmContact'],{'as':'Contact','foreignKey':_0x43e7('0x15e')});db[_0x43e7('0x15f')][_0x43e7('0x11d')](db[_0x43e7('0x36')],{'as':'MailAccount','foreignKey':_0x43e7('0x160')});db[_0x43e7('0x15f')][_0x43e7('0x11d')](db[_0x43e7('0xfe')],{'as':_0x43e7('0xfe'),'foreignKey':_0x43e7('0x161'),'onDelete':_0x43e7('0x162')});db['MailServerOut']['belongsTo'](db[_0x43e7('0x36')],{'as':_0x43e7('0x36'),'foreignKey':_0x43e7('0x160')});db[_0x43e7('0x34')]['belongsTo'](db[_0x43e7('0xfe')],{'as':'CloudProvider','foreignKey':_0x43e7('0x161'),'onDelete':'restrict'});db['MailAccount']['hasOne'](db['MailServerIn'],{'as':_0x43e7('0x163'),'onDelete':_0x43e7('0x10a')});db['MailAccount'][_0x43e7('0x109')](db[_0x43e7('0x34')],{'as':_0x43e7('0x164'),'onDelete':_0x43e7('0x10a')});db[_0x43e7('0x36')][_0x43e7('0x10f')](db[_0x43e7('0x7a')],{'as':_0x43e7('0x165'),'foreignKey':_0x43e7('0x160'),'onDelete':_0x43e7('0x10a')});db[_0x43e7('0x36')][_0x43e7('0x10f')](db[_0x43e7('0x78')],{'as':_0x43e7('0x166'),'foreignKey':_0x43e7('0x160')});db[_0x43e7('0x36')]['hasMany'](db[_0x43e7('0x3a')],{'as':_0x43e7('0x157'),'foreignKey':_0x43e7('0x160')});db[_0x43e7('0x36')][_0x43e7('0x10f')](db[_0x43e7('0x39')],{'as':_0x43e7('0x167')});db[_0x43e7('0x36')][_0x43e7('0x10f')](db[_0x43e7('0x3c')],{'as':'Applications','foreignKey':'MailAccountId','onDelete':_0x43e7('0x10a')});db['MailAccount'][_0x43e7('0x11d')](db[_0x43e7('0xec')],{'as':_0x43e7('0x168'),'foreignKey':'ListId'});db['MailAccount'][_0x43e7('0x11d')](db[_0x43e7('0x169')],{'as':_0x43e7('0x169'),'foreignKey':_0x43e7('0x16a')});db[_0x43e7('0x36')][_0x43e7('0x11d')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x43e7('0x152')});db[_0x43e7('0x36')][_0x43e7('0x120')](db[_0x43e7('0x11')],{'as':_0x43e7('0x154'),'through':_0x43e7('0x13a')});db[_0x43e7('0x12d')][_0x43e7('0x120')](db[_0x43e7('0x11')],{'as':_0x43e7('0x154'),'through':'UserMailQueue'});db[_0x43e7('0x12d')][_0x43e7('0x120')](db['Team'],{'through':_0x43e7('0x16b'),'as':_0x43e7('0x16c')});db[_0x43e7('0x39')][_0x43e7('0x10f')](db[_0x43e7('0x3a')],{'as':_0x43e7('0x157'),'onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x16d')});db['MailInteraction'][_0x43e7('0x11d')](db[_0x43e7('0x36')],{'as':_0x43e7('0x16e'),'foreignKey':_0x43e7('0x160')});db[_0x43e7('0x39')][_0x43e7('0x11d')](db[_0x43e7('0x6b')],{'as':_0x43e7('0x16f'),'foreignKey':'ContactId'});db[_0x43e7('0x39')][_0x43e7('0x11d')](db[_0x43e7('0x11')],{'as':_0x43e7('0x170'),'foreignKey':'UserId'});db[_0x43e7('0x39')]['belongsToMany'](db[_0x43e7('0x171')],{'through':_0x43e7('0x172'),'as':_0x43e7('0x173')});db['MailInteraction']['belongsToMany'](db['Tag'],{'through':_0x43e7('0x172'),'as':_0x43e7('0x174')});db[_0x43e7('0x39')][_0x43e7('0x120')](db[_0x43e7('0x11')],{'as':'Users','through':_0x43e7('0x127'),'foreignKey':_0x43e7('0x16d')});db[_0x43e7('0x3a')]['hasMany'](db[_0x43e7('0xe1')],{'as':_0x43e7('0x175'),'onDelete':_0x43e7('0x10a')});db['MailMessage']['belongsTo'](db['User'],{'as':_0x43e7('0x11')});db[_0x43e7('0x3a')][_0x43e7('0x11d')](db[_0x43e7('0x6b')],{'onDelete':_0x43e7('0x10a'),'as':_0x43e7('0x16f')});db[_0x43e7('0x3a')][_0x43e7('0x11d')](db[_0x43e7('0x39')],{'as':_0x43e7('0x176'),'foreignKey':_0x43e7('0x16d')});db[_0x43e7('0x3a')][_0x43e7('0x11d')](db['MailAccount'],{'as':_0x43e7('0x16e'),'foreignKey':_0x43e7('0x160')});db[_0x43e7('0x3a')]['belongsTo'](db[_0x43e7('0x135')],{'as':_0x43e7('0x135'),'foreignKey':'ChatWebsiteId'});db[_0x43e7('0x3a')][_0x43e7('0x11d')](db['ChatOfflineMessage'],{'as':_0x43e7('0x62'),'foreignKey':_0x43e7('0x177')});db[_0x43e7('0x3c')][_0x43e7('0x11d')](db[_0x43e7('0x11')],{'onDelete':_0x43e7('0x162')});db[_0x43e7('0x3c')][_0x43e7('0x11d')](db[_0x43e7('0x12d')],{'onDelete':_0x43e7('0x162')});db[_0x43e7('0x3c')][_0x43e7('0x11d')](db[_0x43e7('0x36')],{'onDelete':_0x43e7('0x162')});db[_0x43e7('0x3c')]['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x43e7('0x3c')][_0x43e7('0x11d')](db['Tag'],{'onDelete':_0x43e7('0x162'),'foreignKey':'TagId'});db[_0x43e7('0x178')][_0x43e7('0x11d')](db[_0x43e7('0x36')],{});db[_0x43e7('0x178')][_0x43e7('0x11d')](db[_0x43e7('0xec')],{'as':_0x43e7('0x168'),'foreignKey':_0x43e7('0x179')});db[_0x43e7('0x178')][_0x43e7('0x11d')](db[_0x43e7('0x6b')],{'as':_0x43e7('0x16f'),'foreignKey':_0x43e7('0x15e')});db[_0x43e7('0x178')]['belongsTo'](db[_0x43e7('0x39')],{});db['MailQueueReport'][_0x43e7('0x11d')](db['MailMessage'],{});db[_0x43e7('0x178')][_0x43e7('0x11d')](db[_0x43e7('0x11')],{});db[_0x43e7('0x178')][_0x43e7('0x11d')](db[_0x43e7('0x12d')],{});db['Dashboard'][_0x43e7('0x10f')](db[_0x43e7('0x41')],{'as':_0x43e7('0x17a'),'onDelete':_0x43e7('0x10a')});db['FaxAccount'][_0x43e7('0x10f')](db[_0x43e7('0x7a')],{'as':'Dispositions','foreignKey':'FaxAccountId','onDelete':'cascade'});db[_0x43e7('0x42')][_0x43e7('0x10f')](db[_0x43e7('0x78')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0x43e7('0x42')][_0x43e7('0x10f')](db[_0x43e7('0x46')],{'as':_0x43e7('0x167')});db[_0x43e7('0x42')][_0x43e7('0x10f')](db[_0x43e7('0x44')],{'as':'Applications','foreignKey':_0x43e7('0x17b'),'onDelete':'cascade'});db[_0x43e7('0x42')][_0x43e7('0x10f')](db[_0x43e7('0x143')],{'as':'Exntensions','onDelete':_0x43e7('0x10a')});db['FaxAccount'][_0x43e7('0x10f')](db[_0x43e7('0x47')],{'as':_0x43e7('0x157')});db[_0x43e7('0x42')][_0x43e7('0x11d')](db[_0x43e7('0x25')],{'as':_0x43e7('0x25')});db[_0x43e7('0x42')][_0x43e7('0x11d')](db['CmList'],{'as':_0x43e7('0x168'),'foreignKey':'ListId'});db[_0x43e7('0x42')]['belongsTo'](db[_0x43e7('0x80')],{'as':_0x43e7('0x151'),'foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount'][_0x43e7('0x120')](db[_0x43e7('0x11')],{'as':'Agents','through':_0x43e7('0x17c')});db[_0x43e7('0x44')][_0x43e7('0x11d')](db[_0x43e7('0x11')],{'onDelete':_0x43e7('0x162')});db[_0x43e7('0x44')][_0x43e7('0x11d')](db['FaxQueue'],{'onDelete':_0x43e7('0x162')});db['FaxApplication'][_0x43e7('0x11d')](db[_0x43e7('0x42')],{'onDelete':'restrict'});db[_0x43e7('0x44')][_0x43e7('0x11d')](db[_0x43e7('0x171')],{'onDelete':_0x43e7('0x162'),'foreignKey':_0x43e7('0x17d')});db[_0x43e7('0x46')][_0x43e7('0x10f')](db[_0x43e7('0x47')],{'as':'Messages','onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x17e')});db[_0x43e7('0x46')][_0x43e7('0x11d')](db[_0x43e7('0x42')],{'as':_0x43e7('0x16e'),'foreignKey':_0x43e7('0x17b')});db[_0x43e7('0x46')][_0x43e7('0x11d')](db[_0x43e7('0x6b')],{'as':_0x43e7('0x16f'),'foreignKey':_0x43e7('0x15e')});db[_0x43e7('0x46')][_0x43e7('0x11d')](db[_0x43e7('0x11')],{'as':_0x43e7('0x170'),'foreignKey':_0x43e7('0x10b')});db[_0x43e7('0x46')][_0x43e7('0x120')](db[_0x43e7('0x171')],{'through':_0x43e7('0x17f'),'as':_0x43e7('0x173')});db[_0x43e7('0x46')][_0x43e7('0x120')](db[_0x43e7('0x171')],{'through':_0x43e7('0x17f'),'as':_0x43e7('0x174')});db[_0x43e7('0x46')][_0x43e7('0x120')](db[_0x43e7('0x11')],{'as':'Users','through':_0x43e7('0x129'),'foreignKey':_0x43e7('0x17e')});db[_0x43e7('0x47')][_0x43e7('0x11d')](db['User'],{'onDelete':_0x43e7('0x10a'),'as':_0x43e7('0x11')});db['FaxMessage'][_0x43e7('0x11d')](db[_0x43e7('0x46')],{'as':_0x43e7('0x176'),'foreignKey':_0x43e7('0x17e')});db[_0x43e7('0x47')][_0x43e7('0x11d')](db['CmContact'],{'onDelete':_0x43e7('0x10a'),'as':_0x43e7('0x16f')});db['FaxMessage'][_0x43e7('0x11d')](db[_0x43e7('0xe1')],{'as':'Attachment','foreignKey':_0x43e7('0x180')});db[_0x43e7('0x47')]['belongsTo'](db[_0x43e7('0x42')],{'as':_0x43e7('0x16e'),'foreignKey':_0x43e7('0x17b')});db[_0x43e7('0x49')]['belongsToMany'](db[_0x43e7('0x11')],{'as':_0x43e7('0x154'),'through':_0x43e7('0x131')});db[_0x43e7('0x49')][_0x43e7('0x120')](db[_0x43e7('0xdc')],{'through':_0x43e7('0x181'),'as':_0x43e7('0x16c')});db[_0x43e7('0x4b')][_0x43e7('0x11d')](db[_0x43e7('0x42')],{});db[_0x43e7('0x4b')][_0x43e7('0x11d')](db[_0x43e7('0xec')],{'as':_0x43e7('0x168'),'foreignKey':'ListId'});db['FaxQueueReport'][_0x43e7('0x11d')](db[_0x43e7('0x6b')],{'as':_0x43e7('0x16f'),'foreignKey':'ContactId'});db[_0x43e7('0x4b')]['belongsTo'](db['FaxInteraction'],{});db[_0x43e7('0x4b')][_0x43e7('0x11d')](db[_0x43e7('0x47')],{});db[_0x43e7('0x4b')][_0x43e7('0x11d')](db[_0x43e7('0x11')],{});db[_0x43e7('0x4b')][_0x43e7('0x11d')](db[_0x43e7('0x49')],{});db[_0x43e7('0x4d')][_0x43e7('0x10f')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x43e7('0x182'),'onDelete':_0x43e7('0x10a')});db[_0x43e7('0x4d')]['hasMany'](db[_0x43e7('0x78')],{'as':_0x43e7('0x166'),'foreignKey':_0x43e7('0x182')});db[_0x43e7('0x4d')]['hasMany'](db['SmsMessage'],{'as':_0x43e7('0x157'),'foreignKey':_0x43e7('0x182')});db['SmsAccount'][_0x43e7('0x10f')](db[_0x43e7('0x50')],{'as':_0x43e7('0x167')});db[_0x43e7('0x4d')][_0x43e7('0x10f')](db['SmsApplication'],{'as':_0x43e7('0x144'),'foreignKey':_0x43e7('0x182'),'onDelete':_0x43e7('0x10a')});db['SmsAccount']['belongsTo'](db[_0x43e7('0xec')],{'as':'List','foreignKey':_0x43e7('0x179')});db[_0x43e7('0x4d')][_0x43e7('0x11d')](db[_0x43e7('0x80')],{'as':_0x43e7('0x151'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x43e7('0x4d')]['belongsToMany'](db[_0x43e7('0x11')],{'as':_0x43e7('0x154'),'through':_0x43e7('0x13e')});db[_0x43e7('0x183')]['belongsTo'](db['User'],{'onDelete':_0x43e7('0x162')});db[_0x43e7('0x183')][_0x43e7('0x11d')](db[_0x43e7('0x54')],{'onDelete':'restrict'});db['SmsApplication']['belongsTo'](db[_0x43e7('0x4d')],{'onDelete':_0x43e7('0x162')});db[_0x43e7('0x183')]['belongsTo'](db[_0x43e7('0x7e')],{'onDelete':_0x43e7('0x162'),'foreignKey':_0x43e7('0x150')});db[_0x43e7('0x183')][_0x43e7('0x11d')](db[_0x43e7('0x171')],{'onDelete':_0x43e7('0x162'),'foreignKey':_0x43e7('0x17d')});db[_0x43e7('0x50')]['hasMany'](db['SmsMessage'],{'as':_0x43e7('0x157'),'onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x184')});db[_0x43e7('0x50')][_0x43e7('0x11d')](db[_0x43e7('0x4d')],{'as':_0x43e7('0x16e'),'foreignKey':_0x43e7('0x182')});db['SmsInteraction'][_0x43e7('0x11d')](db[_0x43e7('0x6b')],{'as':_0x43e7('0x16f'),'foreignKey':_0x43e7('0x15e')});db[_0x43e7('0x50')]['belongsTo'](db[_0x43e7('0x11')],{'as':'Owner','foreignKey':_0x43e7('0x10b')});db[_0x43e7('0x50')][_0x43e7('0x120')](db[_0x43e7('0x171')],{'through':_0x43e7('0x185'),'as':_0x43e7('0x173')});db[_0x43e7('0x50')][_0x43e7('0x120')](db[_0x43e7('0x171')],{'through':_0x43e7('0x185'),'as':_0x43e7('0x174')});db[_0x43e7('0x50')][_0x43e7('0x120')](db[_0x43e7('0x11')],{'as':_0x43e7('0x186'),'through':_0x43e7('0x12a'),'foreignKey':_0x43e7('0x184')});db[_0x43e7('0x52')][_0x43e7('0x11d')](db['User'],{'as':_0x43e7('0x11')});db[_0x43e7('0x52')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db[_0x43e7('0x52')][_0x43e7('0x11d')](db[_0x43e7('0x50')],{'onDelete':_0x43e7('0x10a'),'as':_0x43e7('0x176'),'foreignKey':_0x43e7('0x184')});db['SmsMessage'][_0x43e7('0x11d')](db[_0x43e7('0x4d')],{'as':_0x43e7('0x16e'),'foreignKey':_0x43e7('0x182')});db['SmsQueue']['belongsToMany'](db['User'],{'as':_0x43e7('0x154'),'through':_0x43e7('0x2e'),'foreignKey':_0x43e7('0x187')});db[_0x43e7('0x54')]['belongsToMany'](db[_0x43e7('0xdc')],{'through':'team_has_sms_queues','as':_0x43e7('0x16c')});db[_0x43e7('0x13b')][_0x43e7('0x10f')](db[_0x43e7('0x7a')],{'as':_0x43e7('0x165'),'foreignKey':_0x43e7('0x188'),'onDelete':'cascade'});db[_0x43e7('0x13b')][_0x43e7('0x10f')](db[_0x43e7('0x78')],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db[_0x43e7('0x13b')][_0x43e7('0x10f')](db['OpenchannelInteraction'],{'as':_0x43e7('0x167'),'foreignKey':_0x43e7('0x188')});db[_0x43e7('0x13b')][_0x43e7('0x10f')](db[_0x43e7('0x59')],{'as':_0x43e7('0x157'),'foreignKey':_0x43e7('0x188')});db[_0x43e7('0x13b')][_0x43e7('0x10f')](db[_0x43e7('0x189')],{'as':'Applications','foreignKey':_0x43e7('0x188'),'onDelete':_0x43e7('0x10a')});db[_0x43e7('0x13b')]['belongsTo'](db[_0x43e7('0xec')],{'as':_0x43e7('0x168'),'foreignKey':'ListId'});db[_0x43e7('0x13b')][_0x43e7('0x11d')](db[_0x43e7('0x80')],{'as':_0x43e7('0x151'),'foreignKey':_0x43e7('0x152')});db['OpenchannelAccount'][_0x43e7('0x120')](db[_0x43e7('0x11')],{'as':'Agents','through':_0x43e7('0x13c')});db[_0x43e7('0x189')][_0x43e7('0x11d')](db['User'],{'onDelete':'restrict'});db[_0x43e7('0x189')][_0x43e7('0x11d')](db[_0x43e7('0x5b')],{'onDelete':_0x43e7('0x162'),'foreignKey':_0x43e7('0x18a')});db[_0x43e7('0x189')]['belongsTo'](db[_0x43e7('0x13b')],{'onDelete':_0x43e7('0x162'),'foreignKey':_0x43e7('0x188')});db[_0x43e7('0x189')][_0x43e7('0x11d')](db['Interval'],{'onDelete':_0x43e7('0x162'),'foreignKey':_0x43e7('0x150')});db[_0x43e7('0x189')]['belongsTo'](db[_0x43e7('0x171')],{'onDelete':'restrict','foreignKey':_0x43e7('0x17d')});db[_0x43e7('0x57')][_0x43e7('0x10f')](db[_0x43e7('0x59')],{'as':'Messages','onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x18b')});db[_0x43e7('0x57')][_0x43e7('0x11d')](db[_0x43e7('0x13b')],{'as':_0x43e7('0x16e'),'foreignKey':_0x43e7('0x188')});db[_0x43e7('0x57')]['belongsTo'](db[_0x43e7('0x6b')],{'as':'Contact','foreignKey':_0x43e7('0x15e')});db[_0x43e7('0x57')][_0x43e7('0x11d')](db[_0x43e7('0x11')],{'as':_0x43e7('0x170'),'foreignKey':_0x43e7('0x10b')});db[_0x43e7('0x57')]['belongsToMany'](db[_0x43e7('0x171')],{'through':'openchannel_interaction_has_tags','as':'Tags'});db[_0x43e7('0x57')]['belongsToMany'](db['Tag'],{'through':_0x43e7('0x18c'),'as':_0x43e7('0x174')});db[_0x43e7('0x57')]['belongsToMany'](db[_0x43e7('0x11')],{'as':_0x43e7('0x186'),'through':_0x43e7('0x18d'),'foreignKey':_0x43e7('0x18b')});db['OpenchannelMessage']['belongsTo'](db[_0x43e7('0x11')],{'onDelete':'cascade','as':_0x43e7('0x11')});db[_0x43e7('0x59')][_0x43e7('0x11d')](db[_0x43e7('0x6b')],{'onDelete':_0x43e7('0x10a'),'as':'Contact'});db['OpenchannelMessage']['belongsTo'](db[_0x43e7('0x57')],{'onDelete':_0x43e7('0x10a'),'as':'Interaction','foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0x43e7('0x11d')](db['Attachment'],{'as':_0x43e7('0xe1'),'foreignKey':_0x43e7('0x180')});db[_0x43e7('0x59')][_0x43e7('0x11d')](db[_0x43e7('0x13b')],{'as':_0x43e7('0x16e'),'foreignKey':_0x43e7('0x188')});db[_0x43e7('0x5b')][_0x43e7('0x120')](db[_0x43e7('0x11')],{'as':_0x43e7('0x154'),'through':_0x43e7('0x30'),'foreignKey':_0x43e7('0x18a')});db[_0x43e7('0x5b')][_0x43e7('0x120')](db[_0x43e7('0xdc')],{'through':_0x43e7('0x18e'),'as':_0x43e7('0x16c')});db[_0x43e7('0x135')][_0x43e7('0x10f')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x43e7('0x18f'),'onDelete':_0x43e7('0x10a')});db[_0x43e7('0x135')]['hasMany'](db['CannedAnswer'],{'as':_0x43e7('0x166'),'foreignKey':_0x43e7('0x18f')});db[_0x43e7('0x135')][_0x43e7('0x10f')](db[_0x43e7('0x67')],{'as':_0x43e7('0x190')});db['ChatWebsite'][_0x43e7('0x10f')](db[_0x43e7('0x114')],{'as':_0x43e7('0x167')});db[_0x43e7('0x135')][_0x43e7('0x10f')](db[_0x43e7('0x5e')],{'as':_0x43e7('0x144'),'foreignKey':_0x43e7('0x18f'),'onDelete':_0x43e7('0x10a')});db[_0x43e7('0x135')][_0x43e7('0x10f')](db['ChatMessage'],{'as':_0x43e7('0x157')});db[_0x43e7('0x135')]['belongsTo'](db[_0x43e7('0xec')],{'as':_0x43e7('0x168'),'foreignKey':_0x43e7('0x179')});db[_0x43e7('0x135')][_0x43e7('0x11d')](db[_0x43e7('0x7e')],{'as':_0x43e7('0x7e'),'foreignKey':'IntervalId'});db[_0x43e7('0x135')]['belongsTo'](db[_0x43e7('0x36')],{'as':_0x43e7('0x36'),'foreignKey':_0x43e7('0x160')});db[_0x43e7('0x135')][_0x43e7('0x11d')](db[_0x43e7('0x80')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x43e7('0x135')][_0x43e7('0x120')](db[_0x43e7('0x11')],{'as':_0x43e7('0x154'),'through':_0x43e7('0x137')});db['OpenchannelQueueReport'][_0x43e7('0x11d')](db['OpenchannelAccount'],{});db[_0x43e7('0x5d')][_0x43e7('0x11d')](db[_0x43e7('0xec')],{'as':_0x43e7('0x168'),'foreignKey':_0x43e7('0x179')});db[_0x43e7('0x5d')][_0x43e7('0x11d')](db[_0x43e7('0x6b')],{'as':_0x43e7('0x16f'),'foreignKey':_0x43e7('0x15e')});db[_0x43e7('0x5d')][_0x43e7('0x11d')](db['OpenchannelInteraction'],{});db[_0x43e7('0x5d')]['belongsTo'](db[_0x43e7('0x59')],{});db[_0x43e7('0x5d')]['belongsTo'](db[_0x43e7('0x11')],{});db[_0x43e7('0x5d')][_0x43e7('0x11d')](db[_0x43e7('0x5b')],{});db[_0x43e7('0x5e')][_0x43e7('0x11d')](db['User'],{'as':_0x43e7('0x191'),'foreignKey':_0x43e7('0x10b'),'onDelete':_0x43e7('0x162')});db[_0x43e7('0x5e')][_0x43e7('0x11d')](db['ChatQueue'],{'as':_0x43e7('0x192'),'foreignKey':_0x43e7('0x193'),'onDelete':_0x43e7('0x162')});db[_0x43e7('0x5e')]['belongsTo'](db['ChatWebsite'],{'as':_0x43e7('0x194'),'foreignKey':_0x43e7('0x18f'),'onDelete':_0x43e7('0x162')});db['ChatApplication']['belongsTo'](db[_0x43e7('0x171')],{'onDelete':_0x43e7('0x162'),'foreignKey':_0x43e7('0x17d')});db[_0x43e7('0x114')][_0x43e7('0x10f')](db[_0x43e7('0x195')],{'as':_0x43e7('0x157'),'onDelete':_0x43e7('0x10a'),'foreignKey':'ChatInteractionId'});db[_0x43e7('0x114')][_0x43e7('0x11d')](db[_0x43e7('0x135')],{'as':_0x43e7('0x16e'),'foreignKey':_0x43e7('0x18f')});db[_0x43e7('0x114')]['belongsTo'](db[_0x43e7('0x6b')],{'as':'Contact','foreignKey':_0x43e7('0x15e')});db[_0x43e7('0x114')][_0x43e7('0x11d')](db['User'],{'as':'Owner','foreignKey':_0x43e7('0x10b')});db['ChatInteraction']['belongsToMany'](db[_0x43e7('0x171')],{'through':'chat_interaction_has_tags','as':_0x43e7('0x173')});db['ChatInteraction'][_0x43e7('0x120')](db[_0x43e7('0x171')],{'through':'chat_interaction_has_tags','as':_0x43e7('0x174')});db[_0x43e7('0x114')][_0x43e7('0x120')](db[_0x43e7('0x11')],{'as':_0x43e7('0x186'),'through':'user_has_chat_interactions','foreignKey':'ChatInteractionId'});db[_0x43e7('0x195')][_0x43e7('0x11d')](db[_0x43e7('0x11')],{'onDelete':'cascade','as':'User'});db[_0x43e7('0x195')][_0x43e7('0x11d')](db[_0x43e7('0x6b')],{'onDelete':_0x43e7('0x10a'),'as':_0x43e7('0x16f'),'foreignKey':_0x43e7('0x15e')});db[_0x43e7('0x195')]['belongsTo'](db[_0x43e7('0x114')],{'onDelete':_0x43e7('0x10a'),'as':'Interaction','foreignKey':_0x43e7('0x196')});db[_0x43e7('0x195')][_0x43e7('0x11d')](db[_0x43e7('0xe1')],{'as':'Attachment','foreignKey':_0x43e7('0x180')});db[_0x43e7('0x195')]['belongsTo'](db[_0x43e7('0x135')],{'as':_0x43e7('0x16e'),'foreignKey':_0x43e7('0x18f')});db[_0x43e7('0x62')][_0x43e7('0x10f')](db[_0x43e7('0xe1')],{'as':_0x43e7('0x175'),'foreignKey':_0x43e7('0x177'),'onDelete':_0x43e7('0x10a'),'hooks':!![]});db[_0x43e7('0x62')][_0x43e7('0x11d')](db[_0x43e7('0x6b')],{'onDelete':'cascade','as':_0x43e7('0x16f'),'foreignKey':_0x43e7('0x15e')});db[_0x43e7('0x62')]['belongsTo'](db[_0x43e7('0x135')],{'as':_0x43e7('0x16e'),'foreignKey':_0x43e7('0x18f')});db[_0x43e7('0x64')][_0x43e7('0x120')](db[_0x43e7('0x11')],{'as':_0x43e7('0x154'),'through':'UserChatQueue','hooks':!![]});db[_0x43e7('0x64')][_0x43e7('0x120')](db['Team'],{'through':'team_has_chat_queues','as':'Teams'});db[_0x43e7('0x65')][_0x43e7('0x10f')](db[_0x43e7('0xc7')],{'as':'Messages','foreignKey':_0x43e7('0x197'),'onDelete':_0x43e7('0x10a')});db[_0x43e7('0x65')][_0x43e7('0x120')](db[_0x43e7('0x11')],{'as':'Members','through':'chat_group_has_users'});db[_0x43e7('0x67')]['belongsTo'](db[_0x43e7('0x135')],{'as':_0x43e7('0x194'),'foreignKey':_0x43e7('0x18f')});db[_0x43e7('0x69')][_0x43e7('0x10f')](db[_0x43e7('0x6b')],{'as':'Contacts','foreignKey':_0x43e7('0x198')});db['CmContact']['hasMany'](db[_0x43e7('0x199')],{'as':_0x43e7('0x19a'),'foreignKey':'CmContactId'});db['CmContact'][_0x43e7('0x10f')](db[_0x43e7('0x14a')],{'as':_0x43e7('0x11b'),'foreignKey':_0x43e7('0x15e')});db['CmContact'][_0x43e7('0x10f')](db['CmHopperFinal'],{'as':_0x43e7('0x111'),'foreignKey':_0x43e7('0x15e')});db[_0x43e7('0x6b')][_0x43e7('0x10f')](db[_0x43e7('0x72')],{'as':_0x43e7('0x14b'),'foreignKey':_0x43e7('0x15e')});db[_0x43e7('0x6b')]['hasMany'](db[_0x43e7('0x73')],{'as':_0x43e7('0x73'),'foreignKey':_0x43e7('0x15e')});db['CmContact'][_0x43e7('0x10f')](db[_0x43e7('0xcd')],{'as':_0x43e7('0x14d'),'foreignKey':_0x43e7('0x15e')});db['CmContact'][_0x43e7('0x10f')](db[_0x43e7('0x57')],{'as':'OpenchannelInteractions','foreignKey':_0x43e7('0x15e'),'onDelete':_0x43e7('0x162')});db[_0x43e7('0x6b')][_0x43e7('0x10f')](db[_0x43e7('0x114')],{'as':'ChatInteractions','foreignKey':_0x43e7('0x15e'),'onDelete':'restrict'});db['CmContact'][_0x43e7('0x10f')](db[_0x43e7('0x50')],{'as':_0x43e7('0x116'),'foreignKey':'ContactId','onDelete':_0x43e7('0x162')});db[_0x43e7('0x6b')][_0x43e7('0x10f')](db[_0x43e7('0x46')],{'as':_0x43e7('0x117'),'foreignKey':_0x43e7('0x15e'),'onDelete':_0x43e7('0x162')});db[_0x43e7('0x6b')][_0x43e7('0x10f')](db[_0x43e7('0x39')],{'as':_0x43e7('0x118'),'foreignKey':_0x43e7('0x15e'),'onDelete':'restrict'});db['CmContact'][_0x43e7('0x11d')](db[_0x43e7('0x69')],{'as':_0x43e7('0x19b'),'foreignKey':_0x43e7('0x198')});db['CmContact'][_0x43e7('0x11d')](db[_0x43e7('0xec')],{'as':_0x43e7('0x168'),'foreignKey':_0x43e7('0x179'),'onDelete':_0x43e7('0x10a')});db[_0x43e7('0x6b')][_0x43e7('0x120')](db[_0x43e7('0x11')],{'as':_0x43e7('0x186'),'through':'cm_user_has_contacts'});db[_0x43e7('0x6b')]['belongsToMany'](db[_0x43e7('0x171')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0x43e7('0x6b')][_0x43e7('0x120')](db['Tag'],{'through':_0x43e7('0x19c'),'as':_0x43e7('0x174')});db[_0x43e7('0x14a')][_0x43e7('0x10f')](db[_0x43e7('0x19d')],{'as':_0x43e7('0x19e'),'foreignKey':'CmHopperId'});db['CmHopper'][_0x43e7('0x11d')](db[_0x43e7('0x6b')],{'as':'Contact','foreignKey':_0x43e7('0x15e'),'onDelete':_0x43e7('0x10a')});db[_0x43e7('0x14a')][_0x43e7('0x11d')](db[_0x43e7('0xec')],{'as':_0x43e7('0x168'),'foreignKey':_0x43e7('0x179'),'onDelete':_0x43e7('0x10a')});db[_0x43e7('0x14a')][_0x43e7('0x11d')](db['User'],{'as':_0x43e7('0x191'),'foreignKey':_0x43e7('0x10b')});db[_0x43e7('0x14a')]['belongsTo'](db['VoiceQueue'],{'as':_0x43e7('0x192'),'foreignKey':_0x43e7('0x149'),'onDelete':_0x43e7('0x10a')});db[_0x43e7('0x14a')][_0x43e7('0x11d')](db['Campaign'],{'as':_0x43e7('0xdf'),'foreignKey':_0x43e7('0x19f'),'onDelete':_0x43e7('0x10a')});db[_0x43e7('0x14a')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':'OwnerId'});db[_0x43e7('0x6e')]['belongsTo'](db[_0x43e7('0x6b')],{'as':_0x43e7('0x16f'),'foreignKey':_0x43e7('0x15e'),'onDelete':_0x43e7('0x10a')});db['CmHopperBlack'][_0x43e7('0x11d')](db[_0x43e7('0xec')],{'as':_0x43e7('0x168'),'foreignKey':'ListId','onDelete':_0x43e7('0x10a')});db['CmHopperBlack']['belongsTo'](db['VoiceQueue'],{'as':_0x43e7('0x192'),'foreignKey':_0x43e7('0x149'),'onDelete':_0x43e7('0x10a')});db[_0x43e7('0x6e')][_0x43e7('0x11d')](db['Campaign'],{'as':_0x43e7('0xdf'),'foreignKey':_0x43e7('0x19f'),'onDelete':_0x43e7('0x10a')});db[_0x43e7('0x77')][_0x43e7('0x10f')](db['Condition'],{'as':{'plural':'All','singular':_0x43e7('0x1a0')},'foreignKey':_0x43e7('0x1a1'),'onDelete':'cascade','hooks':!![]});db[_0x43e7('0x77')][_0x43e7('0x10f')](db[_0x43e7('0x7c')],{'as':{'plural':_0x43e7('0x1a2'),'singular':_0x43e7('0x1a3')},'foreignKey':_0x43e7('0x1a4'),'onDelete':_0x43e7('0x10a'),'hooks':!![]});db[_0x43e7('0x77')][_0x43e7('0x10f')](db['Action'],{'as':_0x43e7('0x1a5'),'foreignKey':_0x43e7('0x1a6'),'onDelete':_0x43e7('0x10a'),'hooks':!![]});db['Disposition'][_0x43e7('0x10f')](db[_0x43e7('0x7a')],{'as':_0x43e7('0x165'),'foreignKey':_0x43e7('0x1a7'),'onDelete':'cascade'});db['Interval']['hasMany'](db['Interval'],{'as':_0x43e7('0x1a8'),'foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db[_0x43e7('0x7e')][_0x43e7('0x10f')](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0x43e7('0x150'),'onDelete':_0x43e7('0x162')});db[_0x43e7('0x7e')][_0x43e7('0x10f')](db[_0x43e7('0x3c')],{'as':_0x43e7('0x1a9'),'foreignKey':_0x43e7('0x150')});db[_0x43e7('0x7e')]['hasMany'](db[_0x43e7('0x5e')],{'as':_0x43e7('0x1aa'),'foreignKey':_0x43e7('0x150')});db[_0x43e7('0x7e')][_0x43e7('0x10f')](db[_0x43e7('0x44')],{'as':_0x43e7('0x1ab'),'foreignKey':'IntervalId'});db[_0x43e7('0x7e')]['hasMany'](db['SmsApplication'],{'as':_0x43e7('0x1ac'),'foreignKey':_0x43e7('0x150')});db[_0x43e7('0x84')][_0x43e7('0x11d')](db[_0x43e7('0x36')],{});db[_0x43e7('0x84')][_0x43e7('0x11d')](db['AnalyticDefaultReport'],{'foreignKey':_0x43e7('0x1ad')});db[_0x43e7('0x84')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db[_0x43e7('0x145')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':_0x43e7('0x1ae'),'through':'moh_has_sounds','onDelete':_0x43e7('0x162')});db[_0x43e7('0x171')][_0x43e7('0x120')](db['CmContact'],{'through':_0x43e7('0x19c')});db[_0x43e7('0x171')]['belongsToMany'](db[_0x43e7('0x114')],{'through':_0x43e7('0x1af')});db[_0x43e7('0x171')][_0x43e7('0x120')](db['MailInteraction'],{'through':_0x43e7('0x172')});db[_0x43e7('0x171')][_0x43e7('0x120')](db['SmsInteraction'],{'through':_0x43e7('0x185')});db['Tag'][_0x43e7('0x120')](db[_0x43e7('0x46')],{'through':_0x43e7('0x17f')});db['Tag'][_0x43e7('0x120')](db[_0x43e7('0x57')],{'through':'openchannel_interaction_has_tags'});db[_0x43e7('0x171')][_0x43e7('0x120')](db[_0x43e7('0xf6')],{'through':'whatsapp_interaction_has_tags'});db[_0x43e7('0x199')][_0x43e7('0x11d')](db[_0x43e7('0x87')],{'as':_0x43e7('0x1b0'),'foreignKey':'ItemTypeId'});db[_0x43e7('0x19d')][_0x43e7('0x11d')](db[_0x43e7('0x14a')],{'as':'Hopper','foreignKey':'CmHopperId'});db[_0x43e7('0x199')][_0x43e7('0x11d')](db['CmContact'],{'as':_0x43e7('0x16f'),'foreignKey':_0x43e7('0x1b1')});db[_0x43e7('0x1b2')][_0x43e7('0x10f')](db[_0x43e7('0x7c')],{'as':{'plural':_0x43e7('0x1b3'),'singular':'AllCondition'},'foreignKey':_0x43e7('0x1b4'),'onDelete':_0x43e7('0x10a'),'hooks':!![]});db['Trigger'][_0x43e7('0x10f')](db[_0x43e7('0x7c')],{'as':{'plural':_0x43e7('0x1b5'),'singular':_0x43e7('0x1b6')},'foreignKey':_0x43e7('0x1b7'),'onDelete':'cascade','hooks':!![]});db[_0x43e7('0x1b2')][_0x43e7('0x10f')](db[_0x43e7('0x76')],{'as':_0x43e7('0x1a5'),'foreignKey':'TriggerId','onDelete':_0x43e7('0x10a'),'hooks':!![]});db['AnalyticCustomReport'][_0x43e7('0x10f')](db[_0x43e7('0x98')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x43e7('0x1b8'),'hooks':!![]});db['AnalyticDefaultReport'][_0x43e7('0x10f')](db[_0x43e7('0x98')],{'as':'Fields','onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x1ad')});db[_0x43e7('0x96')][_0x43e7('0x10f')](db[_0x43e7('0x98')],{'as':_0x43e7('0x1b9'),'onDelete':'cascade','foreignKey':_0x43e7('0x1ba')});db['AnalyticFieldReport']['belongsTo'](db[_0x43e7('0x96')],{'foreignKey':_0x43e7('0x1ba')});db[_0x43e7('0x1bb')]['hasMany'](db[_0x43e7('0x1bc')],{'as':_0x43e7('0x1bd'),'onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x1be')});db[_0x43e7('0x1bc')]['hasMany'](db[_0x43e7('0x9c')],{'as':_0x43e7('0x1bf'),'onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x1c0')});db[_0x43e7('0x1bc')][_0x43e7('0x10f')](db[_0x43e7('0x9c')],{'as':_0x43e7('0x1c1'),'onDelete':'cascade','foreignKey':_0x43e7('0x1c2')});db['SalesforceConfiguration'][_0x43e7('0x10f')](db[_0x43e7('0x9c')],{'as':_0x43e7('0x1b9'),'onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x1c3')});db['SalesforceConfiguration'][_0x43e7('0x11d')](db['SalesforceAccount'],{'as':_0x43e7('0x16e'),'foreignKey':_0x43e7('0x1be')});db[_0x43e7('0x9c')][_0x43e7('0x10f')](db[_0x43e7('0x9c')],{'as':_0x43e7('0x1c4'),'foreignKey':_0x43e7('0x1c0')});db[_0x43e7('0x9c')][_0x43e7('0x10f')](db['SalesforceField'],{'as':_0x43e7('0x1c5'),'foreignKey':_0x43e7('0x1c2')});db['SalesforceField'][_0x43e7('0x10f')](db[_0x43e7('0x9c')],{'as':'Field','foreignKey':_0x43e7('0x1c3')});db[_0x43e7('0x9c')]['belongsTo'](db['Variable'],{'as':_0x43e7('0x1c6'),'foreignKey':'VariableId'});db[_0x43e7('0x9d')][_0x43e7('0x10f')](db[_0x43e7('0x9f')],{'as':_0x43e7('0x1bd'),'onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x1be')});db['SugarcrmConfiguration'][_0x43e7('0x10f')](db[_0x43e7('0xa0')],{'as':_0x43e7('0x1bf'),'onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x1c0')});db[_0x43e7('0x9f')]['hasMany'](db[_0x43e7('0xa0')],{'as':_0x43e7('0x1c1'),'onDelete':'cascade','foreignKey':_0x43e7('0x1c2')});db['SugarcrmConfiguration'][_0x43e7('0x10f')](db[_0x43e7('0xa0')],{'as':_0x43e7('0x1b9'),'onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x1c3')});db[_0x43e7('0x9f')]['belongsTo'](db[_0x43e7('0x9d')],{'as':_0x43e7('0x16e'),'foreignKey':_0x43e7('0x1be')});db[_0x43e7('0xa0')][_0x43e7('0x10f')](db['SugarcrmField'],{'as':'Subject','foreignKey':_0x43e7('0x1c0')});db[_0x43e7('0xa0')]['hasMany'](db[_0x43e7('0xa0')],{'as':_0x43e7('0x1c5'),'foreignKey':_0x43e7('0x1c2')});db[_0x43e7('0xa0')][_0x43e7('0x10f')](db['SugarcrmField'],{'as':_0x43e7('0x1c7'),'foreignKey':'FieldId'});db['SugarcrmField']['belongsTo'](db[_0x43e7('0x1c6')],{'as':_0x43e7('0x1c6'),'foreignKey':_0x43e7('0x1c8')});db['DeskAccount']['hasMany'](db[_0x43e7('0xa2')],{'as':_0x43e7('0x1bd'),'onDelete':_0x43e7('0x10a'),'foreignKey':'AccountId'});db[_0x43e7('0xa2')][_0x43e7('0x10f')](db[_0x43e7('0xa3')],{'as':_0x43e7('0x1bf'),'onDelete':_0x43e7('0x10a'),'foreignKey':'SubjectId'});db['DeskConfiguration'][_0x43e7('0x10f')](db[_0x43e7('0xa3')],{'as':_0x43e7('0x1c1'),'onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x1c2')});db[_0x43e7('0xa2')][_0x43e7('0x10f')](db[_0x43e7('0xa3')],{'as':_0x43e7('0x1b9'),'onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x1c3')});db['DeskConfiguration'][_0x43e7('0x11d')](db[_0x43e7('0x1c9')],{'as':_0x43e7('0x16e'),'foreignKey':'AccountId'});db[_0x43e7('0xa2')][_0x43e7('0x120')](db[_0x43e7('0x171')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x43e7('0x10f')](db['DeskField'],{'as':_0x43e7('0x1c4'),'foreignKey':_0x43e7('0x1c0')});db[_0x43e7('0xa3')][_0x43e7('0x10f')](db['DeskField'],{'as':_0x43e7('0x1c5'),'foreignKey':_0x43e7('0x1c2')});db[_0x43e7('0xa3')][_0x43e7('0x10f')](db['DeskField'],{'as':_0x43e7('0x1c7'),'foreignKey':_0x43e7('0x1c3')});db[_0x43e7('0xa3')][_0x43e7('0x11d')](db['Variable'],{'as':_0x43e7('0x1c6'),'foreignKey':_0x43e7('0x1c8')});db[_0x43e7('0xa5')]['hasMany'](db[_0x43e7('0x1ca')],{'as':_0x43e7('0x1bd'),'onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x1be')});db[_0x43e7('0x1ca')][_0x43e7('0x10f')](db[_0x43e7('0xa7')],{'as':_0x43e7('0x1bf'),'onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x1c0')});db[_0x43e7('0x1ca')][_0x43e7('0x10f')](db['ZohoField'],{'as':_0x43e7('0x1c1'),'onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x1c2')});db[_0x43e7('0x1ca')][_0x43e7('0x10f')](db[_0x43e7('0xa7')],{'as':'Fields','onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x1c3')});db[_0x43e7('0x1ca')][_0x43e7('0x11d')](db[_0x43e7('0xa5')],{'as':_0x43e7('0x16e'),'foreignKey':_0x43e7('0x1be')});db['ZohoField'][_0x43e7('0x10f')](db[_0x43e7('0xa7')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x43e7('0xa7')][_0x43e7('0x10f')](db[_0x43e7('0xa7')],{'as':'Description','foreignKey':_0x43e7('0x1c2')});db[_0x43e7('0xa7')]['hasMany'](db[_0x43e7('0xa7')],{'as':_0x43e7('0x1c7'),'foreignKey':_0x43e7('0x1c3')});db[_0x43e7('0xa7')][_0x43e7('0x11d')](db['Variable'],{'as':_0x43e7('0x1c6'),'foreignKey':'VariableId'});db[_0x43e7('0xa9')][_0x43e7('0x10f')](db[_0x43e7('0x1cb')],{'as':_0x43e7('0x1bd'),'onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x1be')});db[_0x43e7('0x1cb')][_0x43e7('0x10f')](db[_0x43e7('0xac')],{'as':_0x43e7('0x1bf'),'foreignKey':_0x43e7('0x1c0')});db[_0x43e7('0x1cb')]['hasMany'](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0x43e7('0x1c2')});db[_0x43e7('0x1cb')][_0x43e7('0x10f')](db['ZendeskField'],{'as':_0x43e7('0x1b9'),'foreignKey':_0x43e7('0x1c3')});db['ZendeskConfiguration'][_0x43e7('0x11d')](db[_0x43e7('0xa9')],{'as':_0x43e7('0x16e'),'foreignKey':'AccountId'});db[_0x43e7('0x1cb')]['belongsToMany'](db['Tag'],{'through':_0x43e7('0x1cc')});db[_0x43e7('0xac')]['hasMany'](db[_0x43e7('0xac')],{'as':'Subject','foreignKey':_0x43e7('0x1c0')});db['ZendeskField'][_0x43e7('0x10f')](db[_0x43e7('0xac')],{'as':_0x43e7('0x1c5'),'foreignKey':'DescriptionId'});db[_0x43e7('0xac')]['hasMany'](db['ZendeskField'],{'as':'Field','foreignKey':_0x43e7('0x1c3')});db[_0x43e7('0xac')][_0x43e7('0x11d')](db[_0x43e7('0x1c6')],{'as':'Variable','foreignKey':_0x43e7('0x1c8')});db[_0x43e7('0xad')][_0x43e7('0x10f')](db['FreshdeskConfiguration'],{'as':_0x43e7('0x1bd'),'onDelete':'cascade','foreignKey':_0x43e7('0x1be')});db[_0x43e7('0xaf')]['hasMany'](db[_0x43e7('0x1cd')],{'as':_0x43e7('0x1bf'),'onDelete':_0x43e7('0x10a'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration'][_0x43e7('0x10f')](db[_0x43e7('0x1cd')],{'as':_0x43e7('0x1c1'),'onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x1c2')});db[_0x43e7('0xaf')][_0x43e7('0x10f')](db[_0x43e7('0x1cd')],{'as':_0x43e7('0x1b9'),'onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x1c3')});db[_0x43e7('0xaf')]['belongsTo'](db[_0x43e7('0xad')],{'as':_0x43e7('0x16e'),'foreignKey':_0x43e7('0x1be')});db['FreshdeskConfiguration'][_0x43e7('0x120')](db[_0x43e7('0x171')],{'through':_0x43e7('0x1ce')});db[_0x43e7('0x1cd')]['hasMany'](db['FreshdeskField'],{'as':_0x43e7('0x1c4'),'foreignKey':_0x43e7('0x1c0')});db[_0x43e7('0x1cd')]['hasMany'](db[_0x43e7('0x1cd')],{'as':_0x43e7('0x1c5'),'foreignKey':'DescriptionId'});db[_0x43e7('0x1cd')]['hasMany'](db['FreshdeskField'],{'as':'Field','foreignKey':_0x43e7('0x1c3')});db[_0x43e7('0x1cd')][_0x43e7('0x11d')](db[_0x43e7('0x1c6')],{'as':_0x43e7('0x1c6'),'foreignKey':'VariableId'});db[_0x43e7('0x1cf')]['hasMany'](db[_0x43e7('0xb1')],{'as':_0x43e7('0x1bd'),'onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x1be')});db[_0x43e7('0xb1')][_0x43e7('0x10f')](db[_0x43e7('0xb3')],{'as':_0x43e7('0x1bf'),'foreignKey':'SubjectId'});db['VtigerConfiguration'][_0x43e7('0x10f')](db['VtigerField'],{'as':_0x43e7('0x1c1'),'foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0x43e7('0x10f')](db[_0x43e7('0xb3')],{'as':_0x43e7('0x1b9'),'foreignKey':_0x43e7('0x1c3')});db[_0x43e7('0xb1')][_0x43e7('0x11d')](db[_0x43e7('0x1cf')],{'as':_0x43e7('0x16e'),'foreignKey':'AccountId'});db[_0x43e7('0xb3')][_0x43e7('0x10f')](db[_0x43e7('0xb3')],{'as':_0x43e7('0x1c4'),'foreignKey':_0x43e7('0x1c0')});db[_0x43e7('0xb3')][_0x43e7('0x10f')](db[_0x43e7('0xb3')],{'as':_0x43e7('0x1c5'),'foreignKey':_0x43e7('0x1c2')});db[_0x43e7('0xb3')][_0x43e7('0x10f')](db[_0x43e7('0xb3')],{'as':'Field','foreignKey':'FieldId'});db['VtigerField'][_0x43e7('0x11d')](db[_0x43e7('0x1c6')],{'as':_0x43e7('0x1c6'),'foreignKey':'VariableId'});db[_0x43e7('0x1d0')][_0x43e7('0x10f')](db[_0x43e7('0xb6')],{'as':_0x43e7('0x1bd'),'onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x1be')});db['ServicenowConfiguration'][_0x43e7('0x10f')](db[_0x43e7('0xb8')],{'as':_0x43e7('0x1bf'),'foreignKey':_0x43e7('0x1c0')});db[_0x43e7('0xb6')][_0x43e7('0x10f')](db['ServicenowField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ServicenowConfiguration']['hasMany'](db[_0x43e7('0xb8')],{'as':_0x43e7('0x1b9'),'foreignKey':_0x43e7('0x1c3')});db[_0x43e7('0xb6')]['belongsTo'](db[_0x43e7('0x1d0')],{'as':_0x43e7('0x16e'),'foreignKey':_0x43e7('0x1be')});db['ServicenowField'][_0x43e7('0x10f')](db[_0x43e7('0xb8')],{'as':'Subject','foreignKey':_0x43e7('0x1c0')});db['ServicenowField']['hasMany'](db['ServicenowField'],{'as':_0x43e7('0x1c5'),'foreignKey':_0x43e7('0x1c2')});db[_0x43e7('0xb8')][_0x43e7('0x10f')](db[_0x43e7('0xb8')],{'as':_0x43e7('0x1c7'),'foreignKey':_0x43e7('0x1c3')});db['ServicenowField'][_0x43e7('0x11d')](db['Variable'],{'as':_0x43e7('0x1c6'),'foreignKey':'VariableId'});db[_0x43e7('0x1d1')][_0x43e7('0x10f')](db['Dynamics365Configuration'],{'as':'Configurations','onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x1be')});db[_0x43e7('0x1d1')][_0x43e7('0x11d')](db[_0x43e7('0xfe')],{'as':'CloudProvider','foreignKey':_0x43e7('0x161')});db['Dynamics365Configuration'][_0x43e7('0x10f')](db[_0x43e7('0x1d2')],{'as':_0x43e7('0x1bf'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x43e7('0x1d3')]['hasMany'](db[_0x43e7('0x1d2')],{'as':_0x43e7('0x1c1'),'onDelete':'cascade','foreignKey':_0x43e7('0x1c2')});db[_0x43e7('0x1d3')][_0x43e7('0x10f')](db['Dynamics365Field'],{'as':_0x43e7('0x1b9'),'onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x1c3')});db['Dynamics365Configuration']['belongsTo'](db['Dynamics365Account'],{'as':_0x43e7('0x16e'),'foreignKey':_0x43e7('0x1be')});db[_0x43e7('0x1d2')][_0x43e7('0x10f')](db['Dynamics365Field'],{'as':'Subject','foreignKey':'SubjectId'});db['Dynamics365Field'][_0x43e7('0x10f')](db[_0x43e7('0x1d2')],{'as':_0x43e7('0x1c5'),'foreignKey':_0x43e7('0x1c2')});db['Dynamics365Field'][_0x43e7('0x10f')](db[_0x43e7('0x1d2')],{'as':_0x43e7('0x1c7'),'foreignKey':_0x43e7('0x1c3')});db[_0x43e7('0x1d2')][_0x43e7('0x11d')](db['Variable'],{'as':_0x43e7('0x1c6'),'foreignKey':_0x43e7('0x1c8')});db[_0x43e7('0xbd')][_0x43e7('0x10f')](db['FreshsalesConfiguration'],{'as':_0x43e7('0x1bd'),'onDelete':_0x43e7('0x10a'),'foreignKey':'AccountId'});db[_0x43e7('0xbe')][_0x43e7('0x10f')](db[_0x43e7('0xc0')],{'as':_0x43e7('0x1bf'),'foreignKey':_0x43e7('0x1c0')});db[_0x43e7('0xbe')][_0x43e7('0x10f')](db[_0x43e7('0xc0')],{'as':_0x43e7('0x1c1'),'foreignKey':_0x43e7('0x1c2')});db[_0x43e7('0xbe')][_0x43e7('0x10f')](db['FreshsalesField'],{'as':_0x43e7('0x1b9'),'foreignKey':_0x43e7('0x1c3')});db[_0x43e7('0xbe')][_0x43e7('0x11d')](db['FreshsalesAccount'],{'as':'Account','foreignKey':_0x43e7('0x1be')});db[_0x43e7('0xc0')][_0x43e7('0x10f')](db[_0x43e7('0xc0')],{'as':_0x43e7('0x1c4'),'foreignKey':_0x43e7('0x1c0')});db[_0x43e7('0xc0')][_0x43e7('0x10f')](db[_0x43e7('0xc0')],{'as':_0x43e7('0x1c5'),'foreignKey':'DescriptionId'});db['FreshsalesField']['hasMany'](db[_0x43e7('0xc0')],{'as':'Field','foreignKey':_0x43e7('0x1c3')});db[_0x43e7('0xc0')]['belongsTo'](db[_0x43e7('0x1c6')],{'as':_0x43e7('0x1c6'),'foreignKey':_0x43e7('0x1c8')});db[_0x43e7('0xc5')][_0x43e7('0x11d')](db[_0x43e7('0x135')],{});db[_0x43e7('0xc5')]['belongsTo'](db[_0x43e7('0xec')],{'as':_0x43e7('0x168'),'foreignKey':_0x43e7('0x179')});db[_0x43e7('0xc5')][_0x43e7('0x11d')](db[_0x43e7('0x6b')],{'as':_0x43e7('0x16f'),'foreignKey':_0x43e7('0x15e')});db['ChatQueueReport'][_0x43e7('0x11d')](db['ChatInteraction'],{});db[_0x43e7('0xc5')][_0x43e7('0x11d')](db[_0x43e7('0x195')],{});db[_0x43e7('0xc5')][_0x43e7('0x11d')](db[_0x43e7('0x11')],{});db[_0x43e7('0xc5')][_0x43e7('0x11d')](db[_0x43e7('0x64')],{});db[_0x43e7('0xc7')]['belongsTo'](db[_0x43e7('0x11')],{'onDelete':_0x43e7('0x10a'),'foreignKey':'FromId'});db[_0x43e7('0xc7')][_0x43e7('0x11d')](db[_0x43e7('0x11')],{'onDelete':_0x43e7('0x10a'),'foreignKey':'ToId'});db[_0x43e7('0xcd')][_0x43e7('0x10f')](db['JscriptyQuestionReport'],{'foreignKey':_0x43e7('0x1d4'),'onDelete':'cascade'});db['JscriptySessionReport'][_0x43e7('0x10f')](db[_0x43e7('0xc9')],{'foreignKey':_0x43e7('0x1d4'),'onDelete':'cascade'});db[_0x43e7('0xcf')][_0x43e7('0x11d')](db[_0x43e7('0x4d')],{});db[_0x43e7('0xcf')][_0x43e7('0x11d')](db[_0x43e7('0xec')],{'as':_0x43e7('0x168'),'foreignKey':_0x43e7('0x179')});db[_0x43e7('0xcf')]['belongsTo'](db[_0x43e7('0x6b')],{'as':_0x43e7('0x16f'),'foreignKey':'ContactId'});db[_0x43e7('0xcf')]['belongsTo'](db[_0x43e7('0x50')],{});db['SmsQueueReport']['belongsTo'](db['SmsMessage'],{});db[_0x43e7('0xcf')]['belongsTo'](db['User'],{});db[_0x43e7('0xcf')][_0x43e7('0x11d')](db['SmsQueue'],{});db[_0x43e7('0xd3')][_0x43e7('0x10f')](db[_0x43e7('0xcd')],{'foreignKey':_0x43e7('0x1d5')});db['JscriptyProject'][_0x43e7('0x10f')](db[_0x43e7('0xcb')],{'foreignKey':_0x43e7('0x1d5')});db[_0x43e7('0xd3')][_0x43e7('0x10f')](db['JscriptyAnswerReport'],{'foreignKey':_0x43e7('0x1d5')});db['Team'][_0x43e7('0x120')](db[_0x43e7('0x11')],{'as':'Agents','through':_0x43e7('0x126')});db[_0x43e7('0xdc')]['belongsToMany'](db['VoiceQueue'],{'through':_0x43e7('0x100'),'as':_0x43e7('0x12b')});db[_0x43e7('0xdc')][_0x43e7('0x120')](db[_0x43e7('0x12d')],{'through':_0x43e7('0x16b'),'as':_0x43e7('0x1d6')});db['Team']['belongsToMany'](db[_0x43e7('0x64')],{'through':_0x43e7('0x1d7'),'as':_0x43e7('0x12f')});db[_0x43e7('0xdc')][_0x43e7('0x120')](db['FaxQueue'],{'through':_0x43e7('0x181'),'as':'FaxQueues'});db['Team']['belongsToMany'](db['SmsQueue'],{'through':'team_has_sms_queues','as':'SmsQueues'});db[_0x43e7('0xdc')][_0x43e7('0x120')](db[_0x43e7('0x5b')],{'through':_0x43e7('0x18e'),'as':'OpenchannelQueues'});db[_0x43e7('0xdc')][_0x43e7('0x120')](db[_0x43e7('0xfc')],{'through':_0x43e7('0x1d8'),'as':'WhatsappQueues'});db[_0x43e7('0xdc')]['belongsToMany'](db[_0x43e7('0x1d9')],{'through':_0x43e7('0x102'),'as':'VoicePrefixes'});db['Campaign'][_0x43e7('0x10f')](db[_0x43e7('0x14a')],{'as':_0x43e7('0x11b'),'foreignKey':_0x43e7('0x19f')});db[_0x43e7('0xdf')]['hasMany'](db[_0x43e7('0x70')],{'as':_0x43e7('0x111'),'foreignKey':_0x43e7('0x19f')});db[_0x43e7('0xdf')][_0x43e7('0x10f')](db['CmHopperHistory'],{'as':_0x43e7('0x14b'),'foreignKey':_0x43e7('0x19f')});db[_0x43e7('0xdf')][_0x43e7('0x10f')](db[_0x43e7('0x6e')],{'as':_0x43e7('0x14c'),'foreignKey':'CampaignId'});db['Campaign'][_0x43e7('0x11d')](db[_0x43e7('0x25')],{'as':'Trunk','foreignKey':_0x43e7('0x14e')});db[_0x43e7('0xdf')]['belongsTo'](db['Trunk'],{'as':_0x43e7('0x1da'),'foreignKey':_0x43e7('0x14f')});db['Campaign'][_0x43e7('0x11d')](db[_0x43e7('0x7e')],{'as':_0x43e7('0x7e'),'foreignKey':_0x43e7('0x150')});db[_0x43e7('0xdf')][_0x43e7('0x11d')](db[_0x43e7('0x1db')],{'as':_0x43e7('0x1db'),'foreignKey':_0x43e7('0x1dc')});db[_0x43e7('0xdf')][_0x43e7('0x120')](db[_0x43e7('0xec')],{'as':'Lists','through':_0x43e7('0x1dd')});db['Campaign']['belongsToMany'](db['CmList'],{'as':'BlackLists','through':_0x43e7('0x1de')});db[_0x43e7('0xe1')][_0x43e7('0x11d')](db[_0x43e7('0x62')],{'as':_0x43e7('0x62'),'foreignKey':_0x43e7('0x177')});db[_0x43e7('0xe5')]['belongsTo'](db[_0x43e7('0x3a')],{});db[_0x43e7('0xe5')]['belongsTo'](db[_0x43e7('0x39')],{});db[_0x43e7('0xe5')][_0x43e7('0x11d')](db['MailAccount'],{'foreignKey':_0x43e7('0x1df'),'as':_0x43e7('0x1e0')});db[_0x43e7('0xe5')][_0x43e7('0x11d')](db['User'],{'foreignKey':_0x43e7('0x1e1'),'as':_0x43e7('0x1e2')});db[_0x43e7('0xe5')][_0x43e7('0x11d')](db['User'],{'foreignKey':_0x43e7('0x1e3'),'as':_0x43e7('0x1e4')});db[_0x43e7('0xe5')][_0x43e7('0x11d')](db[_0x43e7('0x12d')],{'foreignKey':_0x43e7('0x1e5'),'as':_0x43e7('0x1e6')});db[_0x43e7('0xe5')][_0x43e7('0x11d')](db[_0x43e7('0x36')],{'foreignKey':_0x43e7('0x1e7'),'as':_0x43e7('0x1e8')});db[_0x43e7('0x1e9')][_0x43e7('0x11d')](db[_0x43e7('0x195')],{});db['ChatTransferReport'][_0x43e7('0x11d')](db[_0x43e7('0x114')],{});db[_0x43e7('0x1e9')][_0x43e7('0x11d')](db[_0x43e7('0x135')],{'foreignKey':_0x43e7('0x1ea'),'as':_0x43e7('0x1e0')});db[_0x43e7('0x1e9')][_0x43e7('0x11d')](db[_0x43e7('0x11')],{'foreignKey':'FromUserId','as':_0x43e7('0x1e2')});db[_0x43e7('0x1e9')]['belongsTo'](db[_0x43e7('0x11')],{'foreignKey':_0x43e7('0x1e3'),'as':_0x43e7('0x1e4')});db['ChatTransferReport']['belongsTo'](db[_0x43e7('0x64')],{'foreignKey':_0x43e7('0x1eb'),'as':_0x43e7('0x1e6')});db[_0x43e7('0x1e9')][_0x43e7('0x11d')](db[_0x43e7('0x135')],{'foreignKey':_0x43e7('0x1ec'),'as':_0x43e7('0x1e8')});db[_0x43e7('0xe8')]['belongsTo'](db[_0x43e7('0x47')],{});db['FaxTransferReport'][_0x43e7('0x11d')](db[_0x43e7('0x46')],{});db['FaxTransferReport'][_0x43e7('0x11d')](db[_0x43e7('0x42')],{'foreignKey':_0x43e7('0x1ed'),'as':_0x43e7('0x1e0')});db[_0x43e7('0xe8')][_0x43e7('0x11d')](db['User'],{'foreignKey':_0x43e7('0x1e1'),'as':_0x43e7('0x1e2')});db[_0x43e7('0xe8')]['belongsTo'](db[_0x43e7('0x11')],{'foreignKey':_0x43e7('0x1e3'),'as':_0x43e7('0x1e4')});db['FaxTransferReport']['belongsTo'](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':_0x43e7('0x1e6')});db[_0x43e7('0xe8')][_0x43e7('0x11d')](db[_0x43e7('0x42')],{'foreignKey':_0x43e7('0x1ee'),'as':'ToAccount'});db[_0x43e7('0x1ef')][_0x43e7('0x11d')](db[_0x43e7('0x59')],{});db[_0x43e7('0x1ef')][_0x43e7('0x11d')](db[_0x43e7('0x57')],{});db[_0x43e7('0x1ef')][_0x43e7('0x11d')](db['OpenchannelAccount'],{'foreignKey':_0x43e7('0x1f0'),'as':_0x43e7('0x1e0')});db[_0x43e7('0x1ef')][_0x43e7('0x11d')](db[_0x43e7('0x11')],{'foreignKey':_0x43e7('0x1e1'),'as':_0x43e7('0x1e2')});db['OpenchannelTransferReport'][_0x43e7('0x11d')](db['User'],{'foreignKey':_0x43e7('0x1e3'),'as':_0x43e7('0x1e4')});db['OpenchannelTransferReport'][_0x43e7('0x11d')](db[_0x43e7('0x5b')],{'foreignKey':_0x43e7('0x1f1'),'as':_0x43e7('0x1e6')});db[_0x43e7('0x1ef')][_0x43e7('0x11d')](db[_0x43e7('0x13b')],{'foreignKey':_0x43e7('0x1f2'),'as':'ToAccount'});db[_0x43e7('0xeb')][_0x43e7('0x11d')](db[_0x43e7('0x52')],{});db[_0x43e7('0xeb')][_0x43e7('0x11d')](db['SmsInteraction'],{});db[_0x43e7('0xeb')][_0x43e7('0x11d')](db[_0x43e7('0x4d')],{'foreignKey':_0x43e7('0x1f3'),'as':_0x43e7('0x1e0')});db['SmsTransferReport'][_0x43e7('0x11d')](db[_0x43e7('0x11')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x43e7('0xeb')][_0x43e7('0x11d')](db[_0x43e7('0x11')],{'foreignKey':_0x43e7('0x1e3'),'as':_0x43e7('0x1e4')});db[_0x43e7('0xeb')][_0x43e7('0x11d')](db[_0x43e7('0x54')],{'foreignKey':_0x43e7('0x1f4'),'as':_0x43e7('0x1e6')});db['SmsTransferReport'][_0x43e7('0x11d')](db[_0x43e7('0x4d')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList'][_0x43e7('0x10f')](db['Disposition'],{'as':_0x43e7('0x165'),'foreignKey':_0x43e7('0x179'),'onDelete':_0x43e7('0x10a')});db[_0x43e7('0xec')][_0x43e7('0x10f')](db[_0x43e7('0x1f5')],{'as':'CustomFields','foreignKey':_0x43e7('0x179')});db['CmList']['hasMany'](db[_0x43e7('0x6b')],{'as':_0x43e7('0x1f6'),'onDelete':_0x43e7('0x10a'),'foreignKey':_0x43e7('0x179')});db[_0x43e7('0xec')]['hasMany'](db[_0x43e7('0x70')],{'as':_0x43e7('0x111'),'foreignKey':'ListId'});db[_0x43e7('0xec')][_0x43e7('0x10f')](db[_0x43e7('0x72')],{'as':_0x43e7('0x112'),'foreignKey':_0x43e7('0x179')});db['CmList'][_0x43e7('0x10f')](db[_0x43e7('0x73')],{'as':_0x43e7('0x73'),'foreignKey':'ListId'});db['CmList']['belongsToMany'](db[_0x43e7('0x17')],{'as':_0x43e7('0x1f7'),'through':_0x43e7('0x153')});db['CmList'][_0x43e7('0x120')](db[_0x43e7('0x11')],{'as':_0x43e7('0x154'),'through':_0x43e7('0x125')});db[_0x43e7('0x1d9')]['hasMany'](db[_0x43e7('0x143')],{'as':_0x43e7('0x1f8'),'onDelete':'cascade'});db[_0x43e7('0x1d9')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x43e7('0x104')});db['VoicePrefix'][_0x43e7('0x120')](db[_0x43e7('0xdc')],{'through':_0x43e7('0x102'),'as':_0x43e7('0x16c')});db[_0x43e7('0x11e')][_0x43e7('0x10f')](db['User'],{'as':_0x43e7('0x186'),'foreignKey':_0x43e7('0x11f')});db[_0x43e7('0x11e')][_0x43e7('0x10f')](db[_0x43e7('0x1f9')],{'as':_0x43e7('0x1fa'),'foreignKey':_0x43e7('0x11f'),'onDelete':'cascade'});db[_0x43e7('0x1f9')][_0x43e7('0x10f')](db['UserProfileResource'],{'as':'Resources','foreignKey':_0x43e7('0x1fb'),'onDelete':_0x43e7('0x10a')});db[_0x43e7('0xf2')]['hasMany'](db[_0x43e7('0x7a')],{'as':'Dispositions','foreignKey':'WhatsappAccountId','onDelete':_0x43e7('0x10a')});db['WhatsappAccount']['hasMany'](db[_0x43e7('0x78')],{'as':'Answers','foreignKey':_0x43e7('0x1fc')});db[_0x43e7('0xf2')]['hasMany'](db[_0x43e7('0x1fd')],{'as':'Messages','foreignKey':_0x43e7('0x1fc')});db[_0x43e7('0xf2')]['hasMany'](db[_0x43e7('0xf6')],{'as':_0x43e7('0x167')});db[_0x43e7('0xf2')][_0x43e7('0x10f')](db[_0x43e7('0xf4')],{'as':_0x43e7('0x144'),'foreignKey':_0x43e7('0x1fc'),'onDelete':_0x43e7('0x10a')});db[_0x43e7('0xf2')]['belongsTo'](db[_0x43e7('0xec')],{'as':'List','foreignKey':_0x43e7('0x179')});db[_0x43e7('0xf2')][_0x43e7('0x11d')](db['Pause'],{'as':_0x43e7('0x151'),'foreignKey':_0x43e7('0x152')});db[_0x43e7('0xf2')][_0x43e7('0x120')](db[_0x43e7('0x11')],{'as':_0x43e7('0x154'),'through':_0x43e7('0x1fe')});db[_0x43e7('0xf4')][_0x43e7('0x11d')](db[_0x43e7('0x11')],{'onDelete':_0x43e7('0x162')});db[_0x43e7('0xf4')][_0x43e7('0x11d')](db['WhatsappQueue'],{'onDelete':'restrict'});db['WhatsappApplication']['belongsTo'](db[_0x43e7('0xf2')],{'onDelete':_0x43e7('0x162')});db['WhatsappApplication'][_0x43e7('0x11d')](db[_0x43e7('0x7e')],{'onDelete':_0x43e7('0x162'),'foreignKey':_0x43e7('0x150')});db[_0x43e7('0xf4')][_0x43e7('0x11d')](db[_0x43e7('0x171')],{'onDelete':_0x43e7('0x162'),'foreignKey':_0x43e7('0x17d')});db[_0x43e7('0xf6')][_0x43e7('0x10f')](db[_0x43e7('0x1fd')],{'as':_0x43e7('0x157'),'onDelete':'cascade','foreignKey':_0x43e7('0x1ff')});db[_0x43e7('0xf6')]['belongsTo'](db[_0x43e7('0xf2')],{'as':_0x43e7('0x16e'),'foreignKey':'WhatsappAccountId'});db[_0x43e7('0xf6')][_0x43e7('0x11d')](db[_0x43e7('0x6b')],{'as':_0x43e7('0x16f'),'foreignKey':_0x43e7('0x15e')});db[_0x43e7('0xf6')][_0x43e7('0x11d')](db[_0x43e7('0x11')],{'as':_0x43e7('0x170'),'foreignKey':_0x43e7('0x10b')});db[_0x43e7('0xf6')]['belongsToMany'](db[_0x43e7('0x171')],{'through':_0x43e7('0x200'),'as':_0x43e7('0x173')});db[_0x43e7('0xf6')][_0x43e7('0x120')](db[_0x43e7('0x171')],{'through':_0x43e7('0x200'),'as':_0x43e7('0x174')});db[_0x43e7('0xf6')][_0x43e7('0x120')](db[_0x43e7('0x11')],{'as':_0x43e7('0x186'),'through':_0x43e7('0x201'),'foreignKey':_0x43e7('0x1ff')});db[_0x43e7('0x1fd')]['belongsTo'](db['User'],{'as':'User'});db[_0x43e7('0x1fd')]['belongsTo'](db[_0x43e7('0x6b')],{'onDelete':'cascade','as':'Contact'});db['WhatsappMessage']['belongsTo'](db[_0x43e7('0xf6')],{'onDelete':_0x43e7('0x10a'),'as':_0x43e7('0x176'),'foreignKey':_0x43e7('0x1ff')});db[_0x43e7('0x1fd')][_0x43e7('0x11d')](db[_0x43e7('0xf2')],{'as':_0x43e7('0x16e'),'foreignKey':_0x43e7('0x1fc')});db[_0x43e7('0xf9')][_0x43e7('0x11d')](db[_0x43e7('0xf2')],{});db[_0x43e7('0xf9')]['belongsTo'](db[_0x43e7('0xec')],{'as':_0x43e7('0x168'),'foreignKey':'ListId'});db[_0x43e7('0xf9')][_0x43e7('0x11d')](db['CmContact'],{'as':_0x43e7('0x16f'),'foreignKey':_0x43e7('0x15e')});db[_0x43e7('0xf9')][_0x43e7('0x11d')](db[_0x43e7('0xf6')],{});db[_0x43e7('0xf9')][_0x43e7('0x11d')](db[_0x43e7('0xfc')],{});db[_0x43e7('0xf9')][_0x43e7('0x11d')](db['WhatsappMessage'],{});db[_0x43e7('0xf9')]['belongsTo'](db[_0x43e7('0x11')],{});db[_0x43e7('0xfa')]['belongsTo'](db[_0x43e7('0x1fd')],{});db['WhatsappTransferReport']['belongsTo'](db['WhatsappInteraction'],{});db[_0x43e7('0xfa')][_0x43e7('0x11d')](db[_0x43e7('0xf2')],{'foreignKey':_0x43e7('0x202'),'as':'FromAccount'});db[_0x43e7('0xfa')][_0x43e7('0x11d')](db[_0x43e7('0xf2')],{'foreignKey':_0x43e7('0x203'),'as':_0x43e7('0x1e8')});db['WhatsappTransferReport'][_0x43e7('0x11d')](db[_0x43e7('0xfc')],{'foreignKey':'ToQueueId','as':_0x43e7('0x1e6')});db[_0x43e7('0xfa')][_0x43e7('0x11d')](db[_0x43e7('0x11')],{'foreignKey':_0x43e7('0x1e1'),'as':'FromAgent'});db[_0x43e7('0xfa')][_0x43e7('0x11d')](db['User'],{'foreignKey':'ToUserId','as':_0x43e7('0x1e4')});db[_0x43e7('0xfc')]['belongsToMany'](db['User'],{'as':_0x43e7('0x154'),'through':'UserWhatsappQueue','foreignKey':_0x43e7('0x204')});db[_0x43e7('0xfc')][_0x43e7('0x120')](db['Team'],{'through':_0x43e7('0x1d8'),'as':_0x43e7('0x16c')});db[_0x43e7('0x106')][_0x43e7('0x11d')](db[_0x43e7('0x11')],{'as':_0x43e7('0x205'),'foreignKey':'UserId','onDelete':'cascade','hooks':!![]});db[_0x43e7('0xfe')][_0x43e7('0x109')](db[_0x43e7('0x1d1')],{'as':_0x43e7('0x1d1'),'onDelete':_0x43e7('0x162')});db['CloudProvider'][_0x43e7('0x109')](db[_0x43e7('0x15f')],{'as':'Imap','onDelete':_0x43e7('0x162')});db['CloudProvider']['hasOne'](db[_0x43e7('0x34')],{'as':_0x43e7('0x164'),'onDelete':'restrict'});module[_0x43e7('0x206')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 87c698b..9bb3c70 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xecb2=['./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','/api/templates','/api/triggers','./api/trigger','./api/variable','./api/integration','/api/integrations/reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/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/jscriptySessionReport','./api/smsQueueReport','./api/squareReport','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','3.10.1','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','path','./config/environment','./api/client-side-logs','default','then','use','/api/users','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports'];(function(_0x22fb7e,_0x22fc79){var _0x344506=function(_0x10112a){while(--_0x10112a){_0x22fb7e['push'](_0x22fb7e['shift']());}};_0x344506(++_0x22fc79);}(_0xecb2,0xf6));var _0x2ecb=function(_0x49b8ac,_0x2a5bdf){_0x49b8ac=_0x49b8ac-0x0;var _0x202968=_0xecb2[_0x49b8ac];return _0x202968;};'use strict';var path=require(_0x2ecb('0x0'));var express=require('express');var errors=require('./errors');var config=require(_0x2ecb('0x1'));var setupLoggers=require('./utils/client-side-logger')['setupLoggers'];var clientSideLogs=require(_0x2ecb('0x2'));exports[_0x2ecb('0x3')]=function(_0x393e7c){return setupLoggers(_0x393e7c)[_0x2ecb('0x4')](function(){_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x6'),require('./api/user'));_0x393e7c['use']('/api/voice/chanspy',require(_0x2ecb('0x7')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x8'),require(_0x2ecb('0x9')));_0x393e7c[_0x2ecb('0x5')]('/api/voice/extensions',require(_0x2ecb('0xa')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xb'),require('./api/voiceMusicOnHold'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xc'),require(_0x2ecb('0xd')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xe'),require('./api/voiceRecording'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xf'),require(_0x2ecb('0x10')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x11'),require(_0x2ecb('0x12')));_0x393e7c[_0x2ecb('0x5')]('/api/voice/mails/messages',require(_0x2ecb('0x13')));_0x393e7c[_0x2ecb('0x5')]('/api/voice/calls/reports',require(_0x2ecb('0x14')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x15'),require(_0x2ecb('0x16')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x17'),require(_0x2ecb('0x18')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x19'),require('./api/voiceQueueReport'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x1a'),require('./api/memberReport'));_0x393e7c[_0x2ecb('0x5')]('/api/trunks',require(_0x2ecb('0x1b')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x1c'),require(_0x2ecb('0x1d')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x1e'),require(_0x2ecb('0x1f')));_0x393e7c['use'](_0x2ecb('0x20'),require(_0x2ecb('0x21')));_0x393e7c[_0x2ecb('0x5')]('/api/mail/queues',require(_0x2ecb('0x22')));_0x393e7c[_0x2ecb('0x5')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x393e7c[_0x2ecb('0x5')]('/api/mail/interactions',require(_0x2ecb('0x23')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x24'),require(_0x2ecb('0x25')));_0x393e7c[_0x2ecb('0x5')]('/api/mail/applications',require('./api/mailApplication'));_0x393e7c[_0x2ecb('0x5')]('/api/mail/reports/queue',require(_0x2ecb('0x26')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x27'),require(_0x2ecb('0x28')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x29'),require(_0x2ecb('0x2a')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x2b'),require(_0x2ecb('0x2c')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x2d'),require(_0x2ecb('0x2e')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x2f'),require(_0x2ecb('0x30')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x31'),require(_0x2ecb('0x32')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x33'),require(_0x2ecb('0x34')));_0x393e7c['use']('/api/fax/reports/queue',require(_0x2ecb('0x35')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x36'),require(_0x2ecb('0x37')));_0x393e7c['use'](_0x2ecb('0x38'),require(_0x2ecb('0x39')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x3a'),require(_0x2ecb('0x3b')));_0x393e7c[_0x2ecb('0x5')]('/api/sms/messages',require(_0x2ecb('0x3c')));_0x393e7c['use'](_0x2ecb('0x3d'),require(_0x2ecb('0x3e')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x3f'),require(_0x2ecb('0x40')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x41'),require(_0x2ecb('0x42')));_0x393e7c[_0x2ecb('0x5')]('/api/openchannel/interactions',require(_0x2ecb('0x43')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x44'),require('./api/openchannelMessage'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x45'),require(_0x2ecb('0x46')));_0x393e7c['use'](_0x2ecb('0x47'),require(_0x2ecb('0x48')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x49'),require(_0x2ecb('0x4a')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x4b'),require(_0x2ecb('0x4c')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x4d'),require('./api/chatInteraction'));_0x393e7c[_0x2ecb('0x5')]('/api/chat/messages',require(_0x2ecb('0x4e')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x4f'),require(_0x2ecb('0x50')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x51'),require('./api/chatQueue'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x52'),require(_0x2ecb('0x53')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x54'),require(_0x2ecb('0x55')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x56'),require(_0x2ecb('0x57')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x58'),require(_0x2ecb('0x59')));_0x393e7c[_0x2ecb('0x5')]('/api/cm/hopper',require(_0x2ecb('0x5a')));_0x393e7c['use']('/api/cm/hopper_black',require(_0x2ecb('0x5b')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x5c'),require(_0x2ecb('0x5d')));_0x393e7c['use']('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x393e7c[_0x2ecb('0x5')]('/api/cm/custom_fields',require(_0x2ecb('0x5e')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x5f'),require(_0x2ecb('0x60')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x61'),require(_0x2ecb('0x62')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x63'),require(_0x2ecb('0x64')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x65'),require('./api/disposition'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x66'),require('./api/condition'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x67'),require(_0x2ecb('0x68')));_0x393e7c['use']('/api/pauses',require(_0x2ecb('0x69')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x6a'),require(_0x2ecb('0x6b')));_0x393e7c['use'](_0x2ecb('0x6c'),require(_0x2ecb('0x6d')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x6e'),require(_0x2ecb('0x6f')));_0x393e7c['use'](_0x2ecb('0x70'),require(_0x2ecb('0x71')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x72'),require('./api/tag'));_0x393e7c[_0x2ecb('0x5')]('/api/contact_item_types',require(_0x2ecb('0x73')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x74'),require('./api/cmContactHasItem'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x75'),require('./api/cmHopperAdditionalPhone'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x76'),require('./api/template'));_0x393e7c['use'](_0x2ecb('0x77'),require(_0x2ecb('0x78')));_0x393e7c[_0x2ecb('0x5')]('/api/variables',require(_0x2ecb('0x79')));_0x393e7c['use']('/api/integrations',require(_0x2ecb('0x7a')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x7b'),require('./api/integrationReport'));_0x393e7c[_0x2ecb('0x5')]('/api/analytics/custom_reports',require(_0x2ecb('0x7c')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x7d'),require(_0x2ecb('0x7e')));_0x393e7c[_0x2ecb('0x5')]('/api/analytics/extracted_reports',require(_0x2ecb('0x7f')));_0x393e7c['use']('/api/analytics/metrics',require(_0x2ecb('0x80')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x81'),require(_0x2ecb('0x82')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x83'),require(_0x2ecb('0x84')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x85'),require(_0x2ecb('0x86')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x87'),require('./api/intSalesforceConfiguration'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x88'),require(_0x2ecb('0x89')));_0x393e7c[_0x2ecb('0x5')]('/api/integrations/sugarcrm/accounts',require(_0x2ecb('0x8a')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x8b'),require('./api/intSugarcrmConfiguration'));_0x393e7c['use']('/api/integrations/sugarcrm/fields',require(_0x2ecb('0x8c')));_0x393e7c[_0x2ecb('0x5')]('/api/integrations/desk/accounts',require(_0x2ecb('0x8d')));_0x393e7c[_0x2ecb('0x5')]('/api/integrations/desk/configurations',require(_0x2ecb('0x8e')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x8f'),require(_0x2ecb('0x90')));_0x393e7c['use'](_0x2ecb('0x91'),require(_0x2ecb('0x92')));_0x393e7c['use'](_0x2ecb('0x93'),require(_0x2ecb('0x94')));_0x393e7c['use'](_0x2ecb('0x95'),require(_0x2ecb('0x96')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x97'),require('./api/intZendeskAccount'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x98'),require(_0x2ecb('0x99')));_0x393e7c[_0x2ecb('0x5')]('/api/integrations/zendesk/fields',require(_0x2ecb('0x9a')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x9b'),require(_0x2ecb('0x9c')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x9d'),require('./api/intFreshdeskConfiguration'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x9e'),require(_0x2ecb('0x9f')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xa0'),require(_0x2ecb('0xa1')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xa2'),require(_0x2ecb('0xa3')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xa4'),require(_0x2ecb('0xa5')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xa6'),require(_0x2ecb('0xa7')));_0x393e7c['use'](_0x2ecb('0xa8'),require(_0x2ecb('0xa9')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xaa'),require('./api/intServicenowField'));_0x393e7c[_0x2ecb('0x5')]('/api/integrations/dynamics365/accounts',require(_0x2ecb('0xab')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xac'),require('./api/intDynamics365Configuration'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xad'),require(_0x2ecb('0xae')));_0x393e7c['use'](_0x2ecb('0xaf'),require('./api/intFreshsalesAccount'));_0x393e7c[_0x2ecb('0x5')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x393e7c['use'](_0x2ecb('0xb0'),require(_0x2ecb('0xb1')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xb2'),require(_0x2ecb('0xb3')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xb4'),require(_0x2ecb('0xb5')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xb6'),require(_0x2ecb('0xb7')));_0x393e7c['use'](_0x2ecb('0xb8'),require('./api/jscriptyAnswerReport'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xb9'),require(_0x2ecb('0xba')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xbb'),require(_0x2ecb('0xbc')));_0x393e7c[_0x2ecb('0x5')]('/api/sms/reports/queue',require(_0x2ecb('0xbd')));_0x393e7c[_0x2ecb('0x5')]('/api/square/reports',require(_0x2ecb('0xbe')));_0x393e7c[_0x2ecb('0x5')]('/api/square/details/reports',require(_0x2ecb('0xbf')));_0x393e7c[_0x2ecb('0x5')]('/api/jscripty/projects',require(_0x2ecb('0xc0')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xc1'),require(_0x2ecb('0xc2')));_0x393e7c[_0x2ecb('0x5')]('/api/square/odbc',require('./api/squareOdbc'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xc3'),require(_0x2ecb('0xc4')));_0x393e7c[_0x2ecb('0x5')]('/api/square/recordings',require(_0x2ecb('0xc5')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xc6'),require(_0x2ecb('0xc7')));_0x393e7c[_0x2ecb('0x5')]('/api/teams',require('./api/team'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xc8'),require(_0x2ecb('0xc9')));_0x393e7c[_0x2ecb('0x5')]('/api/campaigns',require(_0x2ecb('0xca')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xcb'),require(_0x2ecb('0xcc')));_0x393e7c[_0x2ecb('0x5')]('/api/attachments',require(_0x2ecb('0xcd')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xce'),require(_0x2ecb('0xcf')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xd0'),require(_0x2ecb('0xd1')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xd2'),require(_0x2ecb('0xd3')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xd4'),require(_0x2ecb('0xd5')));_0x393e7c['use']('/api/openchannel/reports/transfer',require(_0x2ecb('0xd6')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xd7'),require(_0x2ecb('0xd8')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xd9'),require(_0x2ecb('0xda')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xdb'),require(_0x2ecb('0xdc')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xdd'),require(_0x2ecb('0xde')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xdf'),require(_0x2ecb('0xe0')));_0x393e7c['use'](_0x2ecb('0xe1'),require('./api/userProfileResource'));_0x393e7c['use']('/api/userNotifications',require('./api/userNotification'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xe2'),require(_0x2ecb('0xe3')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xe4'),require(_0x2ecb('0xe5')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xe6'),require('./api/whatsappInteraction'));_0x393e7c[_0x2ecb('0x5')]('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x393e7c[_0x2ecb('0x5')]('/api/whatsapp/reports/queue',require(_0x2ecb('0xe7')));_0x393e7c['use'](_0x2ecb('0xe8'),require(_0x2ecb('0xe9')));_0x393e7c['use'](_0x2ecb('0xea'),require('./api/whatsappQueue'));_0x393e7c['use']('/api/cloudProviders',require(_0x2ecb('0xeb')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xec'),require(_0x2ecb('0xed')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xee'),require(_0x2ecb('0xef')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xf0'),require(_0x2ecb('0xf1')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xf2'),require(_0x2ecb('0xf3')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xf4'),require(_0x2ecb('0xf5')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xf6'),require(_0x2ecb('0xf7')));_0x393e7c['use']('/api/jira',require(_0x2ecb('0xf8')));_0x393e7c[_0x2ecb('0x5')]('/api/rpc',require(_0x2ecb('0xf9')));_0x393e7c['use']('/api/version',require(_0x2ecb('0xfa')));_0x393e7c['use'](_0x2ecb('0xfb'),require(_0x2ecb('0xfc')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xfd'),require('./api/pm2'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xfe'),require(_0x2ecb('0xff')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x100'),clientSideLogs);_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x101'),express[_0x2ecb('0x102')](path[_0x2ecb('0x103')](config[_0x2ecb('0x104')],_0x2ecb('0x101'))));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x105'),express[_0x2ecb('0x102')](path[_0x2ecb('0x103')](config['root'],_0x2ecb('0x105'))));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x106'),express[_0x2ecb('0x102')](path[_0x2ecb('0x103')](config['root'],'/demo')));_0x393e7c[_0x2ecb('0x5')]('/snippet',express[_0x2ecb('0x102')](path['join'](config[_0x2ecb('0x104')],'snippet',_0x2ecb('0x107'))));_0x393e7c[_0x2ecb('0x5')]('/plugins',express[_0x2ecb('0x102')](path['join'](config[_0x2ecb('0x104')],'/server/files/plugins')));_0x393e7c[_0x2ecb('0x108')](_0x2ecb('0x109'))[_0x2ecb('0x10a')](errors[0x194]);_0x393e7c[_0x2ecb('0x108')]('/*')['get'](function(_0x542f56,_0x3486f1){_0x3486f1[_0x2ecb('0x10b')](path[_0x2ecb('0x10c')](_0x393e7c[_0x2ecb('0x10a')](_0x2ecb('0x10d'))+'/index.html'));});return _0x393e7c;});}; \ No newline at end of file +var _0xcd05=['./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./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/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','/api/logs','static','/apidoc','/www','join','root','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','/index.html','path','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/calls/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/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/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmHopperAdditionalPhone','/api/templates','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','/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/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports'];(function(_0x45a328,_0x26b366){var _0x55e524=function(_0xc5b56b){while(--_0xc5b56b){_0x45a328['push'](_0x45a328['shift']());}};_0x55e524(++_0x26b366);}(_0xcd05,0x163));var _0x5cd0=function(_0x1399d6,_0x2c1661){_0x1399d6=_0x1399d6-0x0;var _0x4a9db4=_0xcd05[_0x1399d6];return _0x4a9db4;};'use strict';var path=require(_0x5cd0('0x0'));var express=require('express');var errors=require('./errors');var config=require('./config/environment');var setupLoggers=require(_0x5cd0('0x1'))[_0x5cd0('0x2')];var clientSideLogs=require(_0x5cd0('0x3'));exports[_0x5cd0('0x4')]=function(_0x48e5ac){return setupLoggers(_0x48e5ac)[_0x5cd0('0x5')](function(){_0x48e5ac[_0x5cd0('0x6')]('/api/users',require('./api/user'));_0x48e5ac['use'](_0x5cd0('0x7'),require(_0x5cd0('0x8')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x9'),require(_0x5cd0('0xa')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xb'),require('./api/voiceExtension'));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xc'),require(_0x5cd0('0xd')));_0x48e5ac[_0x5cd0('0x6')]('/api/voice/queues',require(_0x5cd0('0xe')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xf'),require(_0x5cd0('0x10')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x11'),require(_0x5cd0('0x12')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x13'),require(_0x5cd0('0x14')));_0x48e5ac['use']('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x15'),require('./api/voiceCallReport'));_0x48e5ac[_0x5cd0('0x6')]('/api/voice/dials/reports',require(_0x5cd0('0x16')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x17'),require('./api/voiceAgentReport'));_0x48e5ac['use'](_0x5cd0('0x18'),require(_0x5cd0('0x19')));_0x48e5ac[_0x5cd0('0x6')]('/api/members/reports',require('./api/memberReport'));_0x48e5ac['use'](_0x5cd0('0x1a'),require(_0x5cd0('0x1b')));_0x48e5ac['use'](_0x5cd0('0x1c'),require(_0x5cd0('0x1d')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x1e'),require(_0x5cd0('0x1f')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x20'),require(_0x5cd0('0x21')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x22'),require(_0x5cd0('0x23')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x24'),require(_0x5cd0('0x25')));_0x48e5ac['use']('/api/mail/interactions',require(_0x5cd0('0x26')));_0x48e5ac['use'](_0x5cd0('0x27'),require(_0x5cd0('0x28')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x29'),require(_0x5cd0('0x2a')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x2b'),require('./api/mailQueueReport'));_0x48e5ac['use'](_0x5cd0('0x2c'),require(_0x5cd0('0x2d')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x2e'),require('./api/dashboardItem'));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x2f'),require(_0x5cd0('0x30')));_0x48e5ac['use']('/api/fax/applications',require(_0x5cd0('0x31')));_0x48e5ac[_0x5cd0('0x6')]('/api/fax/interactions',require(_0x5cd0('0x32')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x33'),require(_0x5cd0('0x34')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x35'),require(_0x5cd0('0x36')));_0x48e5ac['use'](_0x5cd0('0x37'),require(_0x5cd0('0x38')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x39'),require(_0x5cd0('0x3a')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x3b'),require(_0x5cd0('0x3c')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x3d'),require('./api/smsInteraction'));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x3e'),require('./api/smsMessage'));_0x48e5ac[_0x5cd0('0x6')]('/api/sms/queues',require(_0x5cd0('0x3f')));_0x48e5ac[_0x5cd0('0x6')]('/api/openchannel/accounts',require(_0x5cd0('0x40')));_0x48e5ac['use'](_0x5cd0('0x41'),require(_0x5cd0('0x42')));_0x48e5ac[_0x5cd0('0x6')]('/api/openchannel/interactions',require(_0x5cd0('0x43')));_0x48e5ac['use'](_0x5cd0('0x44'),require(_0x5cd0('0x45')));_0x48e5ac['use'](_0x5cd0('0x46'),require(_0x5cd0('0x47')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x48'),require(_0x5cd0('0x49')));_0x48e5ac['use']('/api/openchannel/reports/queue',require(_0x5cd0('0x4a')));_0x48e5ac[_0x5cd0('0x6')]('/api/chat/applications',require(_0x5cd0('0x4b')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x4c'),require(_0x5cd0('0x4d')));_0x48e5ac[_0x5cd0('0x6')]('/api/chat/messages',require(_0x5cd0('0x4e')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x4f'),require(_0x5cd0('0x50')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x51'),require(_0x5cd0('0x52')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x53'),require(_0x5cd0('0x54')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x55'),require(_0x5cd0('0x56')));_0x48e5ac[_0x5cd0('0x6')]('/api/cm/companies',require('./api/cmCompany'));_0x48e5ac[_0x5cd0('0x6')]('/api/cm/contacts',require(_0x5cd0('0x57')));_0x48e5ac['use'](_0x5cd0('0x58'),require(_0x5cd0('0x59')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x5a'),require(_0x5cd0('0x5b')));_0x48e5ac['use'](_0x5cd0('0x5c'),require('./api/cmHopperFinal'));_0x48e5ac['use'](_0x5cd0('0x5d'),require(_0x5cd0('0x5e')));_0x48e5ac[_0x5cd0('0x6')]('/api/cm/custom_fields',require(_0x5cd0('0x5f')));_0x48e5ac['use'](_0x5cd0('0x60'),require('./api/action'));_0x48e5ac['use'](_0x5cd0('0x61'),require(_0x5cd0('0x62')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x63'),require(_0x5cd0('0x64')));_0x48e5ac['use'](_0x5cd0('0x65'),require(_0x5cd0('0x66')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x67'),require('./api/condition'));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x68'),require(_0x5cd0('0x69')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x6a'),require('./api/pause'));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x6b'),require(_0x5cd0('0x6c')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x6d'),require('./api/voiceQueuesLog'));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x6e'),require('./api/schedule'));_0x48e5ac['use'](_0x5cd0('0x6f'),require(_0x5cd0('0x70')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x71'),require(_0x5cd0('0x72')));_0x48e5ac['use']('/api/contact_item_types',require(_0x5cd0('0x73')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x74'),require('./api/cmContactHasItem'));_0x48e5ac[_0x5cd0('0x6')]('/api/cm_hopper_additional_phones',require(_0x5cd0('0x75')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x76'),require('./api/template'));_0x48e5ac[_0x5cd0('0x6')]('/api/triggers',require(_0x5cd0('0x77')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x78'),require(_0x5cd0('0x79')));_0x48e5ac['use'](_0x5cd0('0x7a'),require('./api/integration'));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x7b'),require(_0x5cd0('0x7c')));_0x48e5ac[_0x5cd0('0x6')]('/api/analytics/custom_reports',require(_0x5cd0('0x7d')));_0x48e5ac[_0x5cd0('0x6')]('/api/analytics/default_reports',require('./api/analyticDefaultReport'));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x7e'),require(_0x5cd0('0x7f')));_0x48e5ac[_0x5cd0('0x6')]('/api/analytics/metrics',require(_0x5cd0('0x80')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x81'),require(_0x5cd0('0x82')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x83'),require(_0x5cd0('0x84')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x85'),require(_0x5cd0('0x86')));_0x48e5ac['use'](_0x5cd0('0x87'),require('./api/intSalesforceConfiguration'));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x88'),require(_0x5cd0('0x89')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x8a'),require('./api/intSugarcrmAccount'));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x8b'),require('./api/intSugarcrmConfiguration'));_0x48e5ac[_0x5cd0('0x6')]('/api/integrations/sugarcrm/fields',require(_0x5cd0('0x8c')));_0x48e5ac['use'](_0x5cd0('0x8d'),require('./api/intDeskAccount'));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x8e'),require(_0x5cd0('0x8f')));_0x48e5ac[_0x5cd0('0x6')]('/api/integrations/desk/fields',require(_0x5cd0('0x90')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x91'),require(_0x5cd0('0x92')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x93'),require(_0x5cd0('0x94')));_0x48e5ac['use'](_0x5cd0('0x95'),require(_0x5cd0('0x96')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x97'),require(_0x5cd0('0x98')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x99'),require('./api/intZendeskConfiguration'));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x9a'),require(_0x5cd0('0x9b')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x9c'),require(_0x5cd0('0x9d')));_0x48e5ac['use']('/api/integrations/freshdesk/configurations',require(_0x5cd0('0x9e')));_0x48e5ac['use'](_0x5cd0('0x9f'),require('./api/intFreshdeskField'));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xa0'),require('./api/intVtigerAccount'));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xa1'),require(_0x5cd0('0xa2')));_0x48e5ac['use'](_0x5cd0('0xa3'),require(_0x5cd0('0xa4')));_0x48e5ac['use'](_0x5cd0('0xa5'),require(_0x5cd0('0xa6')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xa7'),require(_0x5cd0('0xa8')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xa9'),require(_0x5cd0('0xaa')));_0x48e5ac['use'](_0x5cd0('0xab'),require(_0x5cd0('0xac')));_0x48e5ac['use']('/api/integrations/dynamics365/configurations',require(_0x5cd0('0xad')));_0x48e5ac[_0x5cd0('0x6')]('/api/integrations/dynamics365/fields',require(_0x5cd0('0xae')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xaf'),require(_0x5cd0('0xb0')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xb1'),require(_0x5cd0('0xb2')));_0x48e5ac['use'](_0x5cd0('0xb3'),require(_0x5cd0('0xb4')));_0x48e5ac[_0x5cd0('0x6')]('/api/networks',require(_0x5cd0('0xb5')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xb6'),require(_0x5cd0('0xb7')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xb8'),require(_0x5cd0('0xb9')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xba'),require(_0x5cd0('0xbb')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xbc'),require(_0x5cd0('0xbd')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xbe'),require(_0x5cd0('0xbf')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xc0'),require(_0x5cd0('0xc1')));_0x48e5ac['use'](_0x5cd0('0xc2'),require('./api/squareReport'));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xc3'),require(_0x5cd0('0xc4')));_0x48e5ac[_0x5cd0('0x6')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x48e5ac['use'](_0x5cd0('0xc5'),require(_0x5cd0('0xc6')));_0x48e5ac['use']('/api/square/odbc',require(_0x5cd0('0xc7')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xc8'),require(_0x5cd0('0xc9')));_0x48e5ac['use'](_0x5cd0('0xca'),require(_0x5cd0('0xcb')));_0x48e5ac[_0x5cd0('0x6')]('/api/square/messages',require(_0x5cd0('0xcc')));_0x48e5ac['use']('/api/teams',require(_0x5cd0('0xcd')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xce'),require('./api/license'));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xcf'),require(_0x5cd0('0xd0')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xd1'),require(_0x5cd0('0xd2')));_0x48e5ac['use'](_0x5cd0('0xd3'),require(_0x5cd0('0xd4')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xd5'),require(_0x5cd0('0xd6')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xd7'),require('./api/mailTransferReport'));_0x48e5ac[_0x5cd0('0x6')]('/api/chat/reports/transfer',require(_0x5cd0('0xd8')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xd9'),require(_0x5cd0('0xda')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xdb'),require(_0x5cd0('0xdc')));_0x48e5ac[_0x5cd0('0x6')]('/api/sms/reports/transfer',require(_0x5cd0('0xdd')));_0x48e5ac[_0x5cd0('0x6')]('/api/cm/lists',require('./api/cmList'));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xde'),require(_0x5cd0('0xdf')));_0x48e5ac['use']('/api/userProfiles',require(_0x5cd0('0xe0')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xe1'),require('./api/userProfileSection'));_0x48e5ac[_0x5cd0('0x6')]('/api/userProfile/resources',require(_0x5cd0('0xe2')));_0x48e5ac['use'](_0x5cd0('0xe3'),require(_0x5cd0('0xe4')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xe5'),require(_0x5cd0('0xe6')));_0x48e5ac['use'](_0x5cd0('0xe7'),require(_0x5cd0('0xe8')));_0x48e5ac[_0x5cd0('0x6')]('/api/whatsapp/interactions',require(_0x5cd0('0xe9')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xea'),require(_0x5cd0('0xeb')));_0x48e5ac[_0x5cd0('0x6')]('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x48e5ac['use'](_0x5cd0('0xec'),require(_0x5cd0('0xed')));_0x48e5ac[_0x5cd0('0x6')]('/api/whatsapp/queues',require(_0x5cd0('0xee')));_0x48e5ac[_0x5cd0('0x6')]('/api/cloudProviders',require('./api/cloudProvider'));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xef'),require('./api/realtime'));_0x48e5ac['use'](_0x5cd0('0xf0'),require(_0x5cd0('0xf1')));_0x48e5ac['use'](_0x5cd0('0xf2'),require(_0x5cd0('0xf3')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xf4'),require('./api/authLocal'));_0x48e5ac[_0x5cd0('0x6')]('/api/auth/google',require(_0x5cd0('0xf5')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xf6'),require(_0x5cd0('0xf7')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xf8'),require(_0x5cd0('0xf9')));_0x48e5ac[_0x5cd0('0x6')]('/api/rpc',require(_0x5cd0('0xfa')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xfb'),require('./api/version'));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xfc'),require(_0x5cd0('0xfd')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xfe'),require('./api/pm2'));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0xff'),require(_0x5cd0('0x100')));_0x48e5ac['use'](_0x5cd0('0x101'),clientSideLogs);_0x48e5ac[_0x5cd0('0x6')]('/apidoc',express[_0x5cd0('0x102')](path['join'](config['root'],_0x5cd0('0x103'))));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x104'),express['static'](path[_0x5cd0('0x105')](config[_0x5cd0('0x106')],'/www')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x107'),express[_0x5cd0('0x102')](path[_0x5cd0('0x105')](config['root'],_0x5cd0('0x107'))));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x108'),express[_0x5cd0('0x102')](path['join'](config[_0x5cd0('0x106')],_0x5cd0('0x109'),'3.10.1')));_0x48e5ac[_0x5cd0('0x6')](_0x5cd0('0x10a'),express[_0x5cd0('0x102')](path[_0x5cd0('0x105')](config['root'],_0x5cd0('0x10b'))));_0x48e5ac[_0x5cd0('0x10c')](_0x5cd0('0x10d'))[_0x5cd0('0x10e')](errors[0x194]);_0x48e5ac[_0x5cd0('0x10c')]('/*')[_0x5cd0('0x10e')](function(_0x5306c3,_0x4096af){_0x4096af['sendFile'](path['resolve'](_0x48e5ac[_0x5cd0('0x10e')]('appPath')+_0x5cd0('0x10f')));});return _0x48e5ac;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 254ae7c..ca5f1ff 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x792a=['rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','RPC\x20listening\x20on\x20','../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/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/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/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueue/whatsappQueue.rpc'];(function(_0x42af0a,_0x2ebfdd){var _0xddbeb9=function(_0x47d803){while(--_0x47d803){_0x42af0a['push'](_0x42af0a['shift']());}};_0xddbeb9(++_0x2ebfdd);}(_0x792a,0xe8));var _0xa792=function(_0x2ce9d7,_0x257107){_0x2ce9d7=_0x2ce9d7-0x0;var _0x5c0923=_0x792a[_0x2ce9d7];return _0x5c0923;};'use strict';var jayson=require('jayson/promise');var _=require('lodash');var config=require(_0xa792('0x0'));exports[_0xa792('0x1')]=function(){return new Promise(function(_0x302ce0,_0x5a83e6){var _0xdba045={};_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x3')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x4')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x5')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x6')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require('../api/voiceCallReport/voiceCallReport.rpc'));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x7')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x8')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x9')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0xa')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0xb')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0xc')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require('../api/mailServerIn/mailServerIn.rpc'));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0xd')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0xe')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0xf')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x10')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x11')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x12')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x13')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x14')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require('../api/faxInteraction/faxInteraction.rpc'));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x15')));_0xdba045=_['merge'](_0xdba045,require('../api/faxQueue/faxQueue.rpc'));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x16')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x17')));_0xdba045=_['merge'](_0xdba045,require('../api/smsInteraction/smsInteraction.rpc'));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x18')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x19')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x1a')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x1b')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x1c')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x1d')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x1e')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x1f')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x20')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require('../api/cmContact/cmContact.rpc'));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x21')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x22')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x23')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x24')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x25')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x26')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x27')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x28')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x29')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x2a')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x2b')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x2c')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x2d')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x2e')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x2f')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x30')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x31')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x32')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x33')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x34')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x35')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x36')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x37')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x38')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x39')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x3a')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x3b')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require('../api/squareOdbc/squareOdbc.rpc'));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x3c')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require('../api/squareRecording/squareRecording.rpc'));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x3d')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x3e')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x3f')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x40')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x41')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x42')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require('../api/whatsappMessage/whatsappMessage.rpc'));_0xdba045=_['merge'](_0xdba045,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x43')));var _0x503e1d=jayson['server'](_0xdba045)['http']();var _0xc843d8=config[_0xa792('0x44')]['port']||config[_0xa792('0x45')]+0x1;var _0xb7c049=config[_0xa792('0x44')]['ip']||_0xa792('0x46');_0x503e1d['on'](_0xa792('0x47'),function(_0x203b01){return _0x5a83e6(_0x203b01);});_0x503e1d[_0xa792('0x1')](_0xc843d8,_0xb7c049,function(){console[_0xa792('0x48')](_0xa792('0x49'),_0xb7c049,_0xc843d8);require('../config/triggers')['default']();return _0x302ce0(_0xa792('0x4a')+_0xb7c049+':'+_0xc843d8);});});}; \ No newline at end of file +var _0xd1a3=['../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc'];(function(_0x436593,_0x3d105e){var _0x4830ea=function(_0x5355ca){while(--_0x5355ca){_0x436593['push'](_0x436593['shift']());}};_0x4830ea(++_0x3d105e);}(_0xd1a3,0xc3));var _0x3d1a=function(_0x36312e,_0x3c9120){_0x36312e=_0x36312e-0x0;var _0x71d4ef=_0xd1a3[_0x36312e];return _0x71d4ef;};'use strict';var jayson=require('jayson/promise');var _=require(_0x3d1a('0x0'));var config=require(_0x3d1a('0x1'));exports[_0x3d1a('0x2')]=function(){return new Promise(function(_0x3ef3c1,_0x1e1b2d){var _0x5b16da={};_0x5b16da=_['merge'](_0x5b16da,require(_0x3d1a('0x3')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x5')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x6')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x7')));_0x5b16da=_['merge'](_0x5b16da,require(_0x3d1a('0x8')));_0x5b16da=_['merge'](_0x5b16da,require(_0x3d1a('0x9')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0xa')));_0x5b16da=_['merge'](_0x5b16da,require(_0x3d1a('0xb')));_0x5b16da=_['merge'](_0x5b16da,require(_0x3d1a('0xc')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0xd')));_0x5b16da=_['merge'](_0x5b16da,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0xe')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0xf')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x10')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x11')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x12')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x13')));_0x5b16da=_['merge'](_0x5b16da,require(_0x3d1a('0x14')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x15')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x16')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x17')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x18')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x19')));_0x5b16da=_['merge'](_0x5b16da,require(_0x3d1a('0x1a')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x1b')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x1c')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x1d')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require('../api/smsQueue/smsQueue.rpc'));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x1e')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x1f')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x20')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x5b16da=_['merge'](_0x5b16da,require('../api/chatInteraction/chatInteraction.rpc'));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x21')));_0x5b16da=_['merge'](_0x5b16da,require('../api/chatQueue/chatQueue.rpc'));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x22')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require('../api/cmHopper/cmHopper.rpc'));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x23')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x24')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require('../api/interval/interval.rpc'));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require('../api/pause/pause.rpc'));_0x5b16da=_['merge'](_0x5b16da,require(_0x3d1a('0x25')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x26')));_0x5b16da=_['merge'](_0x5b16da,require(_0x3d1a('0x27')));_0x5b16da=_['merge'](_0x5b16da,require(_0x3d1a('0x28')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x29')));_0x5b16da=_['merge'](_0x5b16da,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x2a')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x2b')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x5b16da=_['merge'](_0x5b16da,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x2c')));_0x5b16da=_['merge'](_0x5b16da,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x2d')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x5b16da=_['merge'](_0x5b16da,require(_0x3d1a('0x2e')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x2f')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x30')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x31')));_0x5b16da=_['merge'](_0x5b16da,require(_0x3d1a('0x32')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x33')));_0x5b16da=_['merge'](_0x5b16da,require(_0x3d1a('0x34')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require('../api/squareProject/squareProject.rpc'));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require('../api/squareRecording/squareRecording.rpc'));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x35')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x36')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require('../api/attachment/attachment.rpc'));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x37')));_0x5b16da=_['merge'](_0x5b16da,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x38')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x39')));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x5b16da=_[_0x3d1a('0x4')](_0x5b16da,require(_0x3d1a('0x3a')));var _0x5d2954=jayson[_0x3d1a('0x3b')](_0x5b16da)[_0x3d1a('0x3c')]();var _0x538bd7=config[_0x3d1a('0x3d')][_0x3d1a('0x3e')]||config[_0x3d1a('0x3e')]+0x1;var _0x581c0e=config[_0x3d1a('0x3d')]['ip']||'localhost';_0x5d2954['on']('error',function(_0x8c955f){return _0x1e1b2d(_0x8c955f);});_0x5d2954['listen'](_0x538bd7,_0x581c0e,function(){console[_0x3d1a('0x3f')](_0x3d1a('0x40'),_0x581c0e,_0x538bd7);require(_0x3d1a('0x41'))[_0x3d1a('0x42')]();return _0x3ef3c1(_0x3d1a('0x43')+_0x581c0e+':'+_0x538bd7);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index d6f8064..4dc01c7 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 _0x9a6e=['EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','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','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','EventEmitter','./reply','./error','call','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','startsWith','split','length','match','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','write','close','inherits','prototype','sendRequest','sync','answer','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray'];(function(_0x445d36,_0x569125){var _0x2d2b5a=function(_0x337662){while(--_0x337662){_0x445d36['push'](_0x445d36['shift']());}};_0x2d2b5a(++_0x569125);}(_0x9a6e,0xc1));var _0xe9a6=function(_0x5ce7e2,_0x8dd5de){_0x5ce7e2=_0x5ce7e2-0x0;var _0x5224d1=_0x9a6e[_0x5ce7e2];return _0x5224d1;};'use strict';var util=require(_0xe9a6('0x0'));var _=require(_0xe9a6('0x1'));var EventEmitter=require('events')[_0xe9a6('0x2')];var AGIReply=require(_0xe9a6('0x3'));var AGIError=require(_0xe9a6('0x4'));function AGIChannel(_0x219397){var _0xc06690=this,_0x9febd8=new AGIReply(),_0x5292c9=![],_0x3e860c={};EventEmitter[_0xe9a6('0x5')](_0xc06690);_0x219397['setEncoding']('utf8');_0x219397['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x9febd8['setEncoding'](_0xe9a6('0x6'));_0x9febd8['on'](_0xe9a6('0x7'),function(_0xc6145f){for(var _0x1a0b47 in _0xc6145f){_0xc06690[_0x1a0b47]=_0xc6145f[_0x1a0b47];}_0xc06690[_0xe9a6('0x8')](_0xe9a6('0x9'));});_0x9febd8['on'](_0xe9a6('0xa'),function(_0x357108){if(_0x357108[_0xe9a6('0xb')]()==_0xe9a6('0xc')){_0xc06690['emit']('hangup');return;}if(_0x357108[_0xe9a6('0xd')](0x0,0xb)==_0xe9a6('0xe')){_0x5292c9=!![];}if(_0x5292c9){_0x3e860c['rx']+=_0x357108+'\x0a';if(_0x357108[_0xe9a6('0xf')](_0xe9a6('0x10'))!=-0x1){_0x5292c9=![];}}else{_0x3e860c['rx']=_0x357108;}if(_0x5292c9){return;}if(typeof _0x3e860c['cb']==_0xe9a6('0x11')){var _0x19e272=_0x3e860c['rx']['substring'](0x0,0x3),_0x2ac6ad=null,_0x57fb36=null;_0x19e272=parseInt(_0x19e272);if(isNaN(_0x19e272)){_0x3e860c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xe9a6('0x12')});return;}if(_0x19e272!=0xc8){_0x3e860c['cb'](null,{'code':_0x19e272,'result':-0x1,'extra':'KO'});return;}_0x2ac6ad=_0x3e860c['rx'][_0xe9a6('0xd')](0x4)[_0xe9a6('0x13')]('result=','');if(_0x2ac6ad[_0xe9a6('0x14')]('\x20')!=-0x1){_0x2ac6ad=_0x2ac6ad['substr'](0x0,_0x2ac6ad[_0xe9a6('0x14')]('\x20'));}if(_[_0xe9a6('0x15')](_0x2ac6ad,'-1')){_0x2ac6ad=parseInt(_0x2ac6ad);}_0x57fb36=_0x3e860c['rx'][_0xe9a6('0x16')]('\x20');if(_0x57fb36['length']==0x3){_0x57fb36=_0x57fb36[0x2]['substring'](0x1,_0x57fb36[0x2]['length']-0x1);}else if(_0x57fb36[_0xe9a6('0x17')]>0x3){var _0x368276=/\((.+)\)/;var _0x1a11a3=_0x3e860c['rx'][_0xe9a6('0x18')](_0x368276);if(_0x1a11a3){_0x57fb36=_0x1a11a3[0x1];}else{_0x57fb36=null;}}else{_0x57fb36=null;}_0x3e860c['cb'](null,{'code':_0x19e272,'result':_0x2ac6ad,'extra':_0x57fb36});}});_0x219397['on']('error',function(_0x324f8f){_0xc06690[_0xe9a6('0x8')]('error',new AGIError(_0xe9a6('0x19'),_0x324f8f[_0xe9a6('0x1a')]));});_0x219397['on']('close',function(){_0xc06690[_0xe9a6('0x8')]('close',new AGIError(_0xe9a6('0x1b')));});_0x219397['on'](_0xe9a6('0x1c'),function(){_0xc06690[_0xe9a6('0x8')](_0xe9a6('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x219397[_0xe9a6('0x1d')]();});_0x219397[_0xe9a6('0x1e')](_0x9febd8);this[_0xe9a6('0x1f')]=function(_0x54c068,_0x3f0ebf){var _0x54c068=_0x54c068||'',_0x3f0ebf=typeof _0x3f0ebf==_0xe9a6('0x11')?_0x3f0ebf:new Function();_0x3e860c={'tx':_0x54c068,'rx':'','cb':_0x3f0ebf};_0x219397[_0xe9a6('0x20')](_0x54c068+'\x0a');},this[_0xe9a6('0x21')]=function(){_0x219397[_0xe9a6('0x1d')]();};}util[_0xe9a6('0x22')](AGIChannel,EventEmitter);AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x24')]=function(_0x36713f){return this['command'][_0xe9a6('0x25')](this,_0x36713f);};AGIChannel['prototype'][_0xe9a6('0x26')]=function(){return this[_0xe9a6('0x24')](_0xe9a6('0x27'));};AGIChannel[_0xe9a6('0x23')]['getData']=function(_0x54abab,_0x1e1030,_0x2b4515){_0x54abab=_0x54abab===undefined?_0xe9a6('0x28'):_0x54abab;_0x1e1030=_0x1e1030===undefined?'5':_0x1e1030;_0x2b4515=_0x2b4515===undefined?'1':_0x2b4515;return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x2a'),_0x54abab,_0x1e1030*0x3e8,_0x2b4515));};AGIChannel['prototype'][_0xe9a6('0x2b')]=function(_0x3da878){_0x3da878=_0x3da878||'NO\x20MESSAGE';return this['sendRequest'](util[_0xe9a6('0x29')](_0xe9a6('0x2c'),_0x3da878));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x2d')]=function(_0x73e555,_0x348e7b){if(_[_0xe9a6('0x2e')](_0x348e7b)){return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x2f'),_0x73e555,_0x348e7b[_0xe9a6('0x30')](',')));}return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x2f'),_0x73e555,_0x348e7b));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x31')]=function(_0x283a0b){return this[_0xe9a6('0x24')](util['format'](_0xe9a6('0x32'),_0x283a0b));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x33')]=function(_0x1c2236){return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x34'),_0x1c2236));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x35')]=function(_0x51ce17){return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x36'),_0x51ce17));};AGIChannel['prototype'][_0xe9a6('0xc')]=function(){return this[_0xe9a6('0x24')]('HANGUP');};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x37')]=function(_0x5f58e4,_0x338a7a){var _0xb1389d=_[_0xe9a6('0x38')](_0x338a7a)||_[_0xe9a6('0x39')](_0x338a7a)?_0x338a7a[_0xe9a6('0x3a')]():_0x338a7a;return this[_0xe9a6('0x24')](util['format'](_0xe9a6('0x3b'),_0x5f58e4,_0xb1389d?_0xb1389d[_0xe9a6('0x3a')]()[_0xe9a6('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x3c')]=function(_0x1b3aad,_0x42455f){return this[_0xe9a6('0x24')](util['format']('SAY\x20NUMBER\x20%s\x20%s',_0x1b3aad,_0x42455f));};AGIChannel['prototype'][_0xe9a6('0x3d')]=function(_0x22659e,_0xc7013c){return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x3e'),_0x22659e,_0xc7013c));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x3f')]=function(_0x4aee7d,_0xf503a9){return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x40'),_0x4aee7d,_0xf503a9));};AGIChannel['prototype'][_0xe9a6('0x41')]=function(_0x36fe7e,_0x71adeb,_0x484cec){_0x71adeb=_0x71adeb||this['extension'];_0x484cec=_0x484cec||0x1;this[_0xe9a6('0x31')](_0x36fe7e);this['setExtension'](_0x71adeb);this[_0xe9a6('0x35')](_0x484cec);return this[_0xe9a6('0x2b')](util[_0xe9a6('0x29')]('GOTO\x20%s\x20%s\x20%s',_0x36fe7e,_0x71adeb,_0x484cec));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x42')]=function(_0x2ce4a3){return this[_0xe9a6('0x24')](util['format'](_0xe9a6('0x43'),_0x2ce4a3));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x44')]=function(_0x49a63c,_0x1a00cb,_0x3d91de,_0x30a55b,_0x3f9d73,_0x32b0bf){_0x1a00cb=_0x1a00cb||_0xe9a6('0x45');_0x3d91de=_0x3d91de||'';_0x30a55b=_0x30a55b===undefined?-0x1:_0x30a55b==='-1'?-0x1:_0x30a55b*0x3e8;_0x3f9d73=_0x3f9d73===undefined?'':'s='+_0x3f9d73;_0x32b0bf=_0x32b0bf?_0xe9a6('0x46'):'';return this[_0xe9a6('0x24')](util['format'](_0xe9a6('0x47'),_0x49a63c,_0x1a00cb,_0x3d91de,_0x30a55b,_0x32b0bf,_0x3f9d73));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x48')]=function(_0x44aca4,_0x258cf5){_0x258cf5=_0x258cf5||'';return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x49'),_0x44aca4,_0x258cf5));};AGIChannel['prototype']['agi']=function(_0x3e2748){return this['exec'](_0xe9a6('0x4a'),_0x3e2748);};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x4b')]=function(_0x1b34fd){return this['exec'](_0xe9a6('0x4c'),_0x1b34fd);};AGIChannel['prototype']['error']=function(_0x1677f5,_0x93eca4){this[_0xe9a6('0x2b')](util['format'](_0xe9a6('0x4d'),_0x1677f5['id'],_0x1677f5[_0xe9a6('0x4e')],_0x93eca4));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xe9a6('0x4f')]=AGIChannel; \ No newline at end of file +var _0x6f7a=['E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','function','write','inherits','prototype','sendRequest','answer','beep','format','noop','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','replace','result=','indexOf','split','length','error'];(function(_0x388afe,_0x4c11e7){var _0x12436f=function(_0x4a3c2a){while(--_0x4a3c2a){_0x388afe['push'](_0x388afe['shift']());}};_0x12436f(++_0x4c11e7);}(_0x6f7a,0x117));var _0xa6f7=function(_0x59a47f,_0x3ff20){_0x59a47f=_0x59a47f-0x0;var _0x5beef6=_0x6f7a[_0x59a47f];return _0x5beef6;};'use strict';var util=require('util');var _=require(_0xa6f7('0x0'));var EventEmitter=require(_0xa6f7('0x1'))[_0xa6f7('0x2')];var AGIReply=require(_0xa6f7('0x3'));var AGIError=require(_0xa6f7('0x4'));function AGIChannel(_0x4e5055){var _0x25e57c=this,_0x295521=new AGIReply(),_0x40cf77=![],_0xcb71f2={};EventEmitter[_0xa6f7('0x5')](_0x25e57c);_0x4e5055[_0xa6f7('0x6')](_0xa6f7('0x7'));_0x4e5055[_0xa6f7('0x8')](0x8*0x3c*0x3c*0x3e8);_0x295521[_0xa6f7('0x6')](_0xa6f7('0x7'));_0x295521['on'](_0xa6f7('0x9'),function(_0x1cfda6){for(var _0x51f788 in _0x1cfda6){_0x25e57c[_0x51f788]=_0x1cfda6[_0x51f788];}_0x25e57c[_0xa6f7('0xa')](_0xa6f7('0xb'));});_0x295521['on']('line',function(_0x1fa009){if(_0x1fa009[_0xa6f7('0xc')]()==_0xa6f7('0xd')){_0x25e57c[_0xa6f7('0xa')](_0xa6f7('0xd'));return;}if(_0x1fa009[_0xa6f7('0xe')](0x0,0xb)==_0xa6f7('0xf')){_0x40cf77=!![];}if(_0x40cf77){_0xcb71f2['rx']+=_0x1fa009+'\x0a';if(_0x1fa009[_0xa6f7('0x10')](_0xa6f7('0x11'))!=-0x1){_0x40cf77=![];}}else{_0xcb71f2['rx']=_0x1fa009;}if(_0x40cf77){return;}if(typeof _0xcb71f2['cb']=='function'){var _0x5f51e4=_0xcb71f2['rx'][_0xa6f7('0xe')](0x0,0x3),_0x4af485=null,_0x55e79a=null;_0x5f51e4=parseInt(_0x5f51e4);if(isNaN(_0x5f51e4)){_0xcb71f2['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xa6f7('0x12')});return;}if(_0x5f51e4!=0xc8){_0xcb71f2['cb'](null,{'code':_0x5f51e4,'result':-0x1,'extra':'KO'});return;}_0x4af485=_0xcb71f2['rx'][_0xa6f7('0xe')](0x4)[_0xa6f7('0x13')](_0xa6f7('0x14'),'');if(_0x4af485[_0xa6f7('0x15')]('\x20')!=-0x1){_0x4af485=_0x4af485['substr'](0x0,_0x4af485['indexOf']('\x20'));}if(_['startsWith'](_0x4af485,'-1')){_0x4af485=parseInt(_0x4af485);}_0x55e79a=_0xcb71f2['rx'][_0xa6f7('0x16')]('\x20');if(_0x55e79a[_0xa6f7('0x17')]==0x3){_0x55e79a=_0x55e79a[0x2][_0xa6f7('0xe')](0x1,_0x55e79a[0x2][_0xa6f7('0x17')]-0x1);}else if(_0x55e79a['length']>0x3){var _0x43d2ab=/\((.+)\)/;var _0x1775f4=_0xcb71f2['rx']['match'](_0x43d2ab);if(_0x1775f4){_0x55e79a=_0x1775f4[0x1];}else{_0x55e79a=null;}}else{_0x55e79a=null;}_0xcb71f2['cb'](null,{'code':_0x5f51e4,'result':_0x4af485,'extra':_0x55e79a});}});_0x4e5055['on'](_0xa6f7('0x18'),function(_0x314126){_0x25e57c['emit'](_0xa6f7('0x18'),new AGIError(_0xa6f7('0x19'),_0x314126[_0xa6f7('0x1a')]));});_0x4e5055['on'](_0xa6f7('0x1b'),function(){_0x25e57c['emit'](_0xa6f7('0x1b'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x4e5055['on']('timeout',function(){_0x25e57c[_0xa6f7('0xa')](_0xa6f7('0x1c'),new AGIError(_0xa6f7('0x1d')));_0x4e5055[_0xa6f7('0x1e')]();});_0x4e5055['pipe'](_0x295521);this[_0xa6f7('0x1f')]=function(_0x486d5d,_0x3fd6a0){var _0x486d5d=_0x486d5d||'',_0x3fd6a0=typeof _0x3fd6a0==_0xa6f7('0x20')?_0x3fd6a0:new Function();_0xcb71f2={'tx':_0x486d5d,'rx':'','cb':_0x3fd6a0};_0x4e5055[_0xa6f7('0x21')](_0x486d5d+'\x0a');},this['close']=function(){_0x4e5055['destroy']();};}util[_0xa6f7('0x22')](AGIChannel,EventEmitter);AGIChannel[_0xa6f7('0x23')][_0xa6f7('0x24')]=function(_0x14bd2b){return this[_0xa6f7('0x1f')]['sync'](this,_0x14bd2b);};AGIChannel[_0xa6f7('0x23')][_0xa6f7('0x25')]=function(){return this[_0xa6f7('0x24')]('ANSWER');};AGIChannel[_0xa6f7('0x23')]['getData']=function(_0x4a4ffe,_0x2e70fc,_0x49a4f4){_0x4a4ffe=_0x4a4ffe===undefined?_0xa6f7('0x26'):_0x4a4ffe;_0x2e70fc=_0x2e70fc===undefined?'5':_0x2e70fc;_0x49a4f4=_0x49a4f4===undefined?'1':_0x49a4f4;return this[_0xa6f7('0x24')](util[_0xa6f7('0x27')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x4a4ffe,_0x2e70fc*0x3e8,_0x49a4f4));};AGIChannel[_0xa6f7('0x23')][_0xa6f7('0x28')]=function(_0x54ad5a){_0x54ad5a=_0x54ad5a||'NO\x20MESSAGE';return this[_0xa6f7('0x24')](util[_0xa6f7('0x27')]('VERBOSE\x20\x22%s\x22',_0x54ad5a));};AGIChannel['prototype'][_0xa6f7('0x29')]=function(_0x5408c4,_0x9c65a2){if(_[_0xa6f7('0x2a')](_0x9c65a2)){return this['sendRequest'](util[_0xa6f7('0x27')](_0xa6f7('0x2b'),_0x5408c4,_0x9c65a2['join'](',')));}return this[_0xa6f7('0x24')](util[_0xa6f7('0x27')](_0xa6f7('0x2b'),_0x5408c4,_0x9c65a2));};AGIChannel[_0xa6f7('0x23')][_0xa6f7('0x2c')]=function(_0xed869b){return this[_0xa6f7('0x24')](util[_0xa6f7('0x27')](_0xa6f7('0x2d'),_0xed869b));};AGIChannel[_0xa6f7('0x23')][_0xa6f7('0x2e')]=function(_0x332276){return this[_0xa6f7('0x24')](util[_0xa6f7('0x27')](_0xa6f7('0x2f'),_0x332276));};AGIChannel[_0xa6f7('0x23')][_0xa6f7('0x30')]=function(_0x4e9ad3){return this[_0xa6f7('0x24')](util[_0xa6f7('0x27')](_0xa6f7('0x31'),_0x4e9ad3));};AGIChannel[_0xa6f7('0x23')][_0xa6f7('0xd')]=function(){return this['sendRequest'](_0xa6f7('0x32'));};AGIChannel[_0xa6f7('0x23')][_0xa6f7('0x33')]=function(_0x5614eb,_0x165813){var _0x1f4e56=_['isBoolean'](_0x165813)||_[_0xa6f7('0x34')](_0x165813)?_0x165813['toString']():_0x165813;return this['sendRequest'](util[_0xa6f7('0x27')](_0xa6f7('0x35'),_0x5614eb,_0x1f4e56?_0x1f4e56[_0xa6f7('0x36')]()[_0xa6f7('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xa6f7('0x37')]=function(_0x1af86f,_0x37c21b){return this[_0xa6f7('0x24')](util[_0xa6f7('0x27')](_0xa6f7('0x38'),_0x1af86f,_0x37c21b));};AGIChannel['prototype'][_0xa6f7('0x39')]=function(_0x512e12,_0x4ee6b9){return this[_0xa6f7('0x24')](util['format'](_0xa6f7('0x3a'),_0x512e12,_0x4ee6b9));};AGIChannel[_0xa6f7('0x23')][_0xa6f7('0x3b')]=function(_0xa30720,_0xafd247){return this[_0xa6f7('0x24')](util[_0xa6f7('0x27')](_0xa6f7('0x3c'),_0xa30720,_0xafd247));};AGIChannel[_0xa6f7('0x23')]['continueAt']=function(_0x474f21,_0x4b4bc8,_0x10cd66){_0x4b4bc8=_0x4b4bc8||this[_0xa6f7('0x3d')];_0x10cd66=_0x10cd66||0x1;this[_0xa6f7('0x2c')](_0x474f21);this[_0xa6f7('0x2e')](_0x4b4bc8);this[_0xa6f7('0x30')](_0x10cd66);return this[_0xa6f7('0x28')](util[_0xa6f7('0x27')]('GOTO\x20%s\x20%s\x20%s',_0x474f21,_0x4b4bc8,_0x10cd66));};AGIChannel[_0xa6f7('0x23')][_0xa6f7('0x3e')]=function(_0x25db0b){return this['sendRequest'](util[_0xa6f7('0x27')](_0xa6f7('0x3f'),_0x25db0b));};AGIChannel[_0xa6f7('0x23')][_0xa6f7('0x40')]=function(_0xe0f60a,_0x158d27,_0x3e5d3b,_0x386367,_0x58f067,_0x2342d3){_0x158d27=_0x158d27||_0xa6f7('0x41');_0x3e5d3b=_0x3e5d3b||'';_0x386367=_0x386367===undefined?-0x1:_0x386367==='-1'?-0x1:_0x386367*0x3e8;_0x58f067=_0x58f067===undefined?'':'s='+_0x58f067;_0x2342d3=_0x2342d3?_0xa6f7('0x42'):'';return this[_0xa6f7('0x24')](util['format'](_0xa6f7('0x43'),_0xe0f60a,_0x158d27,_0x3e5d3b,_0x386367,_0x2342d3,_0x58f067));};AGIChannel['prototype'][_0xa6f7('0x44')]=function(_0x131c54,_0x1a556f){_0x1a556f=_0x1a556f||'';return this[_0xa6f7('0x24')](util[_0xa6f7('0x27')](_0xa6f7('0x45'),_0x131c54,_0x1a556f));};AGIChannel[_0xa6f7('0x23')][_0xa6f7('0x46')]=function(_0x1aba6d){return this[_0xa6f7('0x29')](_0xa6f7('0x47'),_0x1aba6d);};AGIChannel[_0xa6f7('0x23')][_0xa6f7('0x48')]=function(_0x2d0395){return this['exec'](_0xa6f7('0x49'),_0x2d0395);};AGIChannel[_0xa6f7('0x23')][_0xa6f7('0x18')]=function(_0x5a14fe,_0x460879){this[_0xa6f7('0x28')](util['format'](_0xa6f7('0x4a'),_0x5a14fe['id'],_0x5a14fe[_0xa6f7('0x4b')],_0x460879));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 0287530..df86f99 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 _0x2276=['push','format','apply','name','exports','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.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED'];(function(_0x5f1fe5,_0x48e260){var _0x4169be=function(_0x38e261){while(--_0x38e261){_0x5f1fe5['push'](_0x5f1fe5['shift']());}};_0x4169be(++_0x48e260);}(_0x2276,0x1a3));var _0x6227=function(_0x2a0350,_0x249319){_0x2a0350=_0x2a0350-0x0;var _0x425220=_0x2276[_0x2a0350];return _0x425220;};'use strict';var util=require(_0x6227('0x0'));var error={'E_AGI_UNDEFINED':_0x6227('0x1'),'E_AGI_ARGUMENT_PORT':_0x6227('0x2'),'E_AGI_SERVER_ERROR':_0x6227('0x3'),'E_AGI_SERVER_CLOSE':_0x6227('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x6227('0x5'),'E_AGI_SOCKET_ERROR':_0x6227('0x6'),'E_AGI_SOCKET_CLOSE':_0x6227('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x6227('0x8'),'E_AGI_COMMAND_EMPTY':_0x6227('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x6227('0xa'),'E_AGI_IVR_ENTRY':_0x6227('0xb')};function AGIError(_0x3433a4){var _0x3433a4=_0x3433a4||null,_0xc62784=_0xc62784||[],_0x3b8fd1=0x1,_0x5811a6='';if(!error[_0x3433a4]){_0x3433a4=_0x6227('0xc');}_0xc62784[_0x6227('0xd')](error[_0x3433a4]);while(arguments[_0x3b8fd1]){_0xc62784[_0x6227('0xd')](arguments[_0x3b8fd1]);_0x3b8fd1++;}_0x5811a6=util[_0x6227('0xe')][_0x6227('0xf')](util,_0xc62784);this['message']=_0x5811a6;this[_0x6227('0x10')]=_0x3433a4;}module[_0x6227('0x11')]=AGIError; \ No newline at end of file +var _0x4595=['Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','name','util'];(function(_0x2d1376,_0x3de77e){var _0x313029=function(_0x383d29){while(--_0x383d29){_0x2d1376['push'](_0x2d1376['shift']());}};_0x313029(++_0x3de77e);}(_0x4595,0xc2));var _0x5459=function(_0x2c4a8e,_0x1af743){_0x2c4a8e=_0x2c4a8e-0x0;var _0x3db1c9=_0x4595[_0x2c4a8e];return _0x3db1c9;};'use strict';var util=require(_0x5459('0x0'));var error={'E_AGI_UNDEFINED':_0x5459('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x5459('0x2'),'E_AGI_SERVER_CLOSE':_0x5459('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x5459('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x5459('0x5'),'E_AGI_SOCKET_ERROR':_0x5459('0x6'),'E_AGI_SOCKET_CLOSE':_0x5459('0x7'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x5459('0x8'),'E_AGI_IVR_ENTRY':_0x5459('0x9')};function AGIError(_0x297592){var _0x297592=_0x297592||null,_0x5da040=_0x5da040||[],_0xc1338d=0x1,_0x342c71='';if(!error[_0x297592]){_0x297592=_0x5459('0xa');}_0x5da040[_0x5459('0xb')](error[_0x297592]);while(arguments[_0xc1338d]){_0x5da040[_0x5459('0xb')](arguments[_0xc1338d]);_0xc1338d++;}_0x342c71=util[_0x5459('0xc')]['apply'](util,_0x5da040);this[_0x5459('0xd')]=_0x342c71;this[_0x5459('0xe')]=_0x297592;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 91b07bd..36fac55 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 _0xa7f7=['exports','lodash','events','EventEmitter','./error','../../config/environment','redis','defaults','subscribe','agi','emit','E_AGI_SERVER_ERROR','message','parse','error'];(function(_0x567589,_0x540b31){var _0x3a547f=function(_0x502ce3){while(--_0x502ce3){_0x567589['push'](_0x567589['shift']());}};_0x3a547f(++_0x540b31);}(_0xa7f7,0x1e1));var _0x7a7f=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0xa7f7[_0xd816e2];return _0x1f5924;};'use strict';var _=require(_0x7a7f('0x0'));var EventEmitter=require(_0x7a7f('0x1'))[_0x7a7f('0x2')];var Redis=require('ioredis');var AGIError=require(_0x7a7f('0x3'));var config=require(_0x7a7f('0x4'));config[_0x7a7f('0x5')]=_[_0x7a7f('0x6')](config[_0x7a7f('0x5')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x7a7f('0x7')](_0x7a7f('0x8'),function(_0xe8a365){if(_0xe8a365)return eventEmitter[_0x7a7f('0x9')]('error',new AGIError(_0x7a7f('0xa'),_0xe8a365));});sub['on'](_0x7a7f('0xb'),function(_0x2f02e6,_0x266d2c){if(_0x2f02e6!==_0x7a7f('0x8'))return;try{var _0xaedc37=JSON[_0x7a7f('0xc')](_0x266d2c);eventEmitter[_0x7a7f('0x9')]('projectUpdate',_0xaedc37);}catch(_0x1b2c9d){eventEmitter[_0x7a7f('0x9')](_0x7a7f('0xd'),new AGIError('E_AGI_SERVER_ERROR',_0x1b2c9d));}});module[_0x7a7f('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x3d18=['agi','emit','E_AGI_SERVER_ERROR','parse','projectUpdate','error','exports','lodash','events','EventEmitter','./error','../../config/environment','redis','localhost','subscribe'];(function(_0x48d060,_0x419f83){var _0x452464=function(_0x154353){while(--_0x154353){_0x48d060['push'](_0x48d060['shift']());}};_0x452464(++_0x419f83);}(_0x3d18,0x142));var _0x83d1=function(_0x5142f5,_0x382614){_0x5142f5=_0x5142f5-0x0;var _0x460bf2=_0x3d18[_0x5142f5];return _0x460bf2;};'use strict';var _=require(_0x83d1('0x0'));var EventEmitter=require(_0x83d1('0x1'))[_0x83d1('0x2')];var Redis=require('ioredis');var AGIError=require(_0x83d1('0x3'));var config=require(_0x83d1('0x4'));config[_0x83d1('0x5')]=_['defaults'](config['redis'],{'host':_0x83d1('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x83d1('0x5')]);sub[_0x83d1('0x7')](_0x83d1('0x8'),function(_0x2bd5ce){if(_0x2bd5ce)return eventEmitter[_0x83d1('0x9')]('error',new AGIError(_0x83d1('0xa'),_0x2bd5ce));});sub['on']('message',function(_0x19851b,_0x4c233f){if(_0x19851b!==_0x83d1('0x8'))return;try{var _0x1147ee=JSON[_0x83d1('0xb')](_0x4c233f);eventEmitter[_0x83d1('0x9')](_0x83d1('0xc'),_0x1147ee);}catch(_0x859ee1){eventEmitter[_0x83d1('0x9')](_0x83d1('0xd'),new AGIError(_0x83d1('0xa'),_0x859ee1));}});module[_0x83d1('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index dcd6bf9..a09e800 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 _0xb6d0=['exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','edges','numberOfEdges','prototype','addVertex','vertices','addEdge','push','relations','getVertex','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','condition\x20not\x20found'];(function(_0x18e727,_0x409cc5){var _0x38a04d=function(_0x49e967){while(--_0x49e967){_0x18e727['push'](_0x18e727['shift']());}};_0x38a04d(++_0x409cc5);}(_0xb6d0,0xf1));var _0x0b6d=function(_0x123824,_0x52a5c7){_0x123824=_0x123824-0x0;var _0x1421eb=_0xb6d0[_0x123824];return _0x1421eb;};'use strict';var _=require(_0x0b6d('0x0'));var logger=require(_0x0b6d('0x1'))(_0x0b6d('0x2'));var verticesWithRetry=[_0x0b6d('0x3'),_0x0b6d('0x4'),_0x0b6d('0x5')];var Graph=function(){this['vertices']={};this[_0x0b6d('0x6')]={};this[_0x0b6d('0x7')]=0x0;};Graph[_0x0b6d('0x8')][_0x0b6d('0x9')]=function(_0x39d597){this[_0x0b6d('0xa')][_0x39d597['id']]=_0x39d597;this['edges'][_0x39d597['id']]=[];};Graph[_0x0b6d('0x8')][_0x0b6d('0xb')]=function(_0x5ac924,_0x1fd53b,_0x222ec1){this['edges'][_0x5ac924][_0x0b6d('0xc')]({'target':_0x1fd53b,'condition':_0x222ec1});this[_0x0b6d('0x7')]+=0x1;};Graph['prototype']['size']=function(){return _['size'](this['vertices']);};Graph[_0x0b6d('0x8')][_0x0b6d('0xd')]=function(){return this[_0x0b6d('0x7')];};Graph[_0x0b6d('0x8')][_0x0b6d('0xe')]=function(_0x2941f1){return this[_0x0b6d('0xa')][_0x2941f1];};Graph[_0x0b6d('0x8')]['traverseBFS']=function(_0x1827e0,_0x2f1eae){if(!this[_0x0b6d('0xa')][_0x1827e0]){return logger[_0x0b6d('0xf')](_0x0b6d('0x10'));}var _0x6efb59=_0x2f1eae(this[_0x0b6d('0xa')][_0x1827e0]);if(!_0x6efb59){return logger['info'](_0x0b6d('0x11'));}if(this[_0x0b6d('0x6')][_0x1827e0][_0x0b6d('0x12')]===0x0){return logger[_0x0b6d('0xf')](_0x0b6d('0x13'));}for(var _0x2e6658=0x0,_0x3b922b=[],_0x57e7c2=![];_0x2e6658\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','hangup','find','handleNotFound','production','handleUnpublished'];(function(_0x173de3,_0x50f32f){var _0x552ea2=function(_0x362384){while(--_0x362384){_0x173de3['push'](_0x173de3['shift']());}};_0x552ea2(++_0x50f32f);}(_0x74f9,0x166));var _0x974f=function(_0x3cea2a,_0x5d90b4){_0x3cea2a=_0x3cea2a-0x0;var _0x4f8b91=_0x74f9[_0x3cea2a];return _0x4f8b91;};'use strict';var _=require(_0x974f('0x0'));var syncho=require(_0x974f('0x1'));var util=require(_0x974f('0x2'));var config=require(_0x974f('0x3'));var logger=require(_0x974f('0x4'))('agi');var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var Project=require(_0x974f('0x5'));var AGIEmitter=require(_0x974f('0x6'))[_0x974f('0x7')];var projects=[];config['agi']=_[_0x974f('0x8')](config['agi'],{'ip':_0x974f('0x9'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x2d8167){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x2d8167);agiHandler(_0x2d8167);}catch(_0x2c9a4d){logger['error'](_0x2c9a4d[_0x974f('0xa')]);}});});}function projectUpdateHandler(_0x22d02b){try{var _0x66beea=_[_0x974f('0xb')](projects,['id',_0x22d02b['id']]);if(_0x66beea>-0x1){if(_0x22d02b[_0x974f('0xc')]===!![]){projects[_0x974f('0xd')](_0x66beea,0x1);}else{projects[_0x66beea]=_0x22d02b;}}else{projects[_0x974f('0xe')](_0x22d02b);}}catch(_0x230da8){logger[_0x974f('0xf')](_0x230da8[_0x974f('0xa')]);}}function listeningHandler(){console[_0x974f('0x10')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x974f('0x11')][_0x974f('0x12')]);logger[_0x974f('0x13')](util[_0x974f('0x14')](_0x974f('0x15'),config[_0x974f('0x11')]['ip'],config[_0x974f('0x11')][_0x974f('0x12')]));}function errorHandler(_0x545950){if(_0x545950&&_0x545950[_0x974f('0x16')]&&_0x545950[_0x974f('0x17')]){logger[_0x974f('0xf')](util[_0x974f('0x14')](_0x974f('0x18'),_0x545950[_0x974f('0x16')],_0x545950[_0x974f('0x17')]));}else{logger[_0x974f('0xf')](util[_0x974f('0x14')]('[ERROR]\x20%s',_0x545950['stack']));}}function closeHandler(){logger[_0x974f('0x13')](util[_0x974f('0x14')](_0x974f('0x19'),this[_0x974f('0x1a')],this[_0x974f('0x1b')],this[_0x974f('0x1c')],this[_0x974f('0x1d')],this['uniqueid']));try{createSquareReport(this);}catch(_0x2eb4ce){logger[_0x974f('0xf')](_0x2eb4ce[_0x974f('0xa')]);}}function timeoutHandler(){logger['info'](util['format'](_0x974f('0x1e'),this['arg_1'],this[_0x974f('0x1b')],this[_0x974f('0x1c')],this[_0x974f('0x1d')],this['uniqueid']));}function hangupHandler(){logger[_0x974f('0x13')](util[_0x974f('0x14')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x974f('0x1a')],this['calleridname'],this[_0x974f('0x1c')],this['dnid'],this['uniqueid']));this[_0x974f('0x1f')]=!![];}function createSquareReport(_0x25e386,_0x248b2e){rpc[_0x974f('0x20')](_0x25e386)[_0x974f('0x21')](function(_0x4ea894){if(_0x248b2e){_0x248b2e(null,_0x4ea894);}})[_0x974f('0x22')](function(_0x4b1200){if(_0x248b2e){_0x248b2e(null,_0x4b1200);}});}function setChannelVariables(_0x5df123){for(var _0x41006a in _0x5df123){if(_0x5df123[_0x974f('0x23')](_0x41006a)){if(_0x41006a['indexOf'](_0x974f('0x24'))===0x0){_0x5df123[_0x41006a[_0x974f('0x25')](0x4)]=_0x5df123[_0x41006a];delete _0x5df123[_0x41006a];}}}}function agiHandler(_0xc617eb){logger[_0x974f('0x26')](_0x974f('0x27'),JSON[_0x974f('0x28')](_0xc617eb,null,0x2));logger[_0x974f('0x13')](util[_0x974f('0x14')](_0x974f('0x29'),_0xc617eb[_0x974f('0x1a')],_0xc617eb[_0x974f('0x1b')],_0xc617eb[_0x974f('0x1c')],_0xc617eb[_0x974f('0x1d')],_0xc617eb[_0x974f('0x2a')]));_0xc617eb['on'](_0x974f('0xf'),errorHandler);_0xc617eb['on']('close',closeHandler);_0xc617eb['on']('timeout',timeoutHandler);_0xc617eb[_0x974f('0x1f')]=![];_0xc617eb['on'](_0x974f('0x2b'),hangupHandler);var _0x366828=_[_0x974f('0x2c')](projects,[_0x974f('0x16'),_0xc617eb[_0x974f('0x1a')]]);if(!_0x366828)return Project[_0x974f('0x2d')](_0xc617eb);if(!_0x366828[_0x974f('0x2e')])return Project[_0x974f('0x2f')](_0xc617eb);return Project['initialize'](_0x366828,_0xc617eb);}function main(){var _0x36a7ea;return utilLicense['getLicense']()[_0x974f('0x21')](function(_0x1b6e67){if(!_0x1b6e67)return;if(_0x1b6e67[_0x974f('0x30')]){if(_0x1b6e67['callysquare']&&_0x1b6e67[_0x974f('0x31')]>0x0){logger[_0x974f('0x13')](util[_0x974f('0x14')](_0x974f('0x32'),_0x1b6e67[_0x974f('0x31')]));_0x36a7ea=_0x1b6e67[_0x974f('0x31')];}else{logger['info'](_0x974f('0x33'));}}else{logger['info'](_0x974f('0x34'));_0x36a7ea=-0x1;}})[_0x974f('0x21')](function(){return Project[_0x974f('0x35')]();})['then'](function(_0xfb3075){projects=_0xfb3075;return;})[_0x974f('0x22')](function(_0x58ea47){logger[_0x974f('0xf')]('[LICENSE]',_0x58ea47['stack']);})[_0x974f('0x36')](function(){var _0xe41a4=require(_0x974f('0x37'))(config[_0x974f('0x11')][_0x974f('0x12')],config['agi']['ip'],_0x36a7ea);_0xe41a4['on']('error',errorHandler);_0xe41a4['on'](_0x974f('0x38'),listeningHandler);_0xe41a4['on'](_0x974f('0x39'),connectionHandler);_0xe41a4['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0xc2de=['format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','hasOwnProperty','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','handleNotFound','then','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','catch','finally','./server','listening','connection','syncho','util','../../config/logger','agi','../../config/license/util','./rpc','./events','EventEmitter','defaults','127.0.0.1','nextTick','error','stack','findIndex','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info'];(function(_0x47c183,_0x4b5398){var _0x43f9ed=function(_0x3deba9){while(--_0x3deba9){_0x47c183['push'](_0x47c183['shift']());}};_0x43f9ed(++_0x4b5398);}(_0xc2de,0xf6));var _0xec2d=function(_0x50f9b9,_0x1aaecc){_0x50f9b9=_0x50f9b9-0x0;var _0x1a6954=_0xc2de[_0x50f9b9];return _0x1a6954;};'use strict';var _=require('lodash');var syncho=require(_0xec2d('0x0'));var util=require(_0xec2d('0x1'));var config=require('../../config/environment');var logger=require(_0xec2d('0x2'))(_0xec2d('0x3'));var utilLicense=require(_0xec2d('0x4'));var rpc=require(_0xec2d('0x5'));var Project=require('./project');var AGIEmitter=require(_0xec2d('0x6'))[_0xec2d('0x7')];var projects=[];config[_0xec2d('0x3')]=_[_0xec2d('0x8')](config[_0xec2d('0x3')],{'ip':_0xec2d('0x9'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x4e3d47){process[_0xec2d('0xa')](function(){syncho(function(){try{setChannelVariables(_0x4e3d47);agiHandler(_0x4e3d47);}catch(_0xc9e27e){logger[_0xec2d('0xb')](_0xc9e27e[_0xec2d('0xc')]);}});});}function projectUpdateHandler(_0x1772b2){try{var _0x403714=_[_0xec2d('0xd')](projects,['id',_0x1772b2['id']]);if(_0x403714>-0x1){if(_0x1772b2['deleted']===!![]){projects[_0xec2d('0xe')](_0x403714,0x1);}else{projects[_0x403714]=_0x1772b2;}}else{projects[_0xec2d('0xf')](_0x1772b2);}}catch(_0x4f3a5d){logger['error'](_0x4f3a5d[_0xec2d('0xc')]);}}function listeningHandler(){console[_0xec2d('0x10')](_0xec2d('0x11'),config[_0xec2d('0x3')]['port']);logger[_0xec2d('0x12')](util[_0xec2d('0x13')](_0xec2d('0x14'),config['agi']['ip'],config[_0xec2d('0x3')][_0xec2d('0x15')]));}function errorHandler(_0xf30bff){if(_0xf30bff&&_0xf30bff[_0xec2d('0x16')]&&_0xf30bff['message']){logger[_0xec2d('0xb')](util['format'](_0xec2d('0x17'),_0xf30bff[_0xec2d('0x16')],_0xf30bff['message']));}else{logger['error'](util[_0xec2d('0x13')](_0xec2d('0x18'),_0xf30bff[_0xec2d('0xc')]));}}function closeHandler(){logger[_0xec2d('0x12')](util[_0xec2d('0x13')](_0xec2d('0x19'),this[_0xec2d('0x1a')],this[_0xec2d('0x1b')],this[_0xec2d('0x1c')],this['dnid'],this[_0xec2d('0x1d')]));try{createSquareReport(this);}catch(_0x3b2634){logger[_0xec2d('0xb')](_0x3b2634[_0xec2d('0xc')]);}}function timeoutHandler(){logger[_0xec2d('0x12')](util[_0xec2d('0x13')](_0xec2d('0x1e'),this[_0xec2d('0x1a')],this[_0xec2d('0x1b')],this[_0xec2d('0x1c')],this[_0xec2d('0x1f')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0xec2d('0x13')](_0xec2d('0x20'),this[_0xec2d('0x1a')],this[_0xec2d('0x1b')],this[_0xec2d('0x1c')],this[_0xec2d('0x1f')],this[_0xec2d('0x1d')]));this[_0xec2d('0x21')]=!![];}function createSquareReport(_0x38ee30,_0x331acc){rpc[_0xec2d('0x22')](_0x38ee30)['then'](function(_0x244ba2){if(_0x331acc){_0x331acc(null,_0x244ba2);}})['catch'](function(_0x4eea5f){if(_0x331acc){_0x331acc(null,_0x4eea5f);}});}function setChannelVariables(_0x55a1ca){for(var _0x3629a1 in _0x55a1ca){if(_0x55a1ca[_0xec2d('0x23')](_0x3629a1)){if(_0x3629a1['indexOf']('agi_')===0x0){_0x55a1ca[_0x3629a1['substring'](0x4)]=_0x55a1ca[_0x3629a1];delete _0x55a1ca[_0x3629a1];}}}}function agiHandler(_0x44075c){logger[_0xec2d('0x24')](_0xec2d('0x25'),JSON[_0xec2d('0x26')](_0x44075c,null,0x2));logger[_0xec2d('0x12')](util[_0xec2d('0x13')](_0xec2d('0x27'),_0x44075c['arg_1'],_0x44075c['calleridname'],_0x44075c['callerid'],_0x44075c[_0xec2d('0x1f')],_0x44075c['uniqueid']));_0x44075c['on']('error',errorHandler);_0x44075c['on'](_0xec2d('0x28'),closeHandler);_0x44075c['on']('timeout',timeoutHandler);_0x44075c[_0xec2d('0x21')]=![];_0x44075c['on'](_0xec2d('0x29'),hangupHandler);var _0x508b2c=_['find'](projects,[_0xec2d('0x16'),_0x44075c[_0xec2d('0x1a')]]);if(!_0x508b2c)return Project[_0xec2d('0x2a')](_0x44075c);if(!_0x508b2c['production'])return Project['handleUnpublished'](_0x44075c);return Project['initialize'](_0x508b2c,_0x44075c);}function main(){var _0x4a9cd6;return utilLicense['getLicense']()[_0xec2d('0x2b')](function(_0x32fc2c){if(!_0x32fc2c)return;if(_0x32fc2c['voice']){if(_0x32fc2c[_0xec2d('0x2c')]&&_0x32fc2c['callysquare']>0x0){logger[_0xec2d('0x12')](util[_0xec2d('0x13')](_0xec2d('0x2d'),_0x32fc2c[_0xec2d('0x2c')]));_0x4a9cd6=_0x32fc2c[_0xec2d('0x2c')];}else{logger['info'](_0xec2d('0x2e'));}}else{logger['info'](_0xec2d('0x2f'));_0x4a9cd6=-0x1;}})[_0xec2d('0x2b')](function(){return Project['getAll']();})[_0xec2d('0x2b')](function(_0xe772bb){projects=_0xe772bb;return;})[_0xec2d('0x30')](function(_0x3c40a2){logger[_0xec2d('0xb')]('[LICENSE]',_0x3c40a2[_0xec2d('0xc')]);})[_0xec2d('0x31')](function(){var _0x2b191b=require(_0xec2d('0x32'))(config[_0xec2d('0x3')]['port'],config[_0xec2d('0x3')]['ip'],_0x4a9cd6);_0x2b191b['on']('error',errorHandler);_0x2b191b['on'](_0xec2d('0x33'),listeningHandler);_0x2b191b['on'](_0xec2d('0x34'),connectionHandler);_0x2b191b['on'](_0xec2d('0x28'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 1da19b5..a07fda7 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 _0x07f6=['error','result','sendMailMessage','SendMail','client','http','request','then'];(function(_0x52a1be,_0x49f576){var _0x598cff=function(_0x12fa8e){while(--_0x12fa8e){_0x52a1be['push'](_0x52a1be['shift']());}};_0x598cff(++_0x49f576);}(_0x07f6,0x16c));var _0x607f=function(_0x265003,_0xf0f023){_0x265003=_0x265003-0x0;var _0x33c743=_0x07f6[_0x265003];return _0x33c743;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0x607f('0x0')][_0x607f('0x1')]({'port':0x232b});function request(_0x2305c2,_0x31aa26){return new BPromise(function(_0x41d0a5,_0x461961){return client[_0x607f('0x2')](_0x2305c2,_0x31aa26)[_0x607f('0x3')](function(_0x304d7d){if(_0x304d7d[_0x607f('0x4')]){return _0x461961(_0x304d7d[_0x607f('0x4')]['message']);}else{return _0x41d0a5(_0x304d7d[_0x607f('0x5')]);}})['catch'](function(_0x19c3d1){return _0x461961(_0x19c3d1);});});}exports[_0x607f('0x6')]=function(_0x142afe,_0x289536){return request(_0x607f('0x7'),{'account':_0x142afe,'message':_0x289536});}; \ No newline at end of file +var _0x54b9=['bluebird','client','request','then','error','message','catch','sendMailMessage'];(function(_0x3774eb,_0x3f90d1){var _0x21d722=function(_0xd0fc1d){while(--_0xd0fc1d){_0x3774eb['push'](_0x3774eb['shift']());}};_0x21d722(++_0x3f90d1);}(_0x54b9,0xa8));var _0x954b=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x54b9[_0xa1e3e3];return _0xc980e9;};'use strict';var BPromise=require(_0x954b('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x954b('0x1')]['http']({'port':0x232b});function request(_0x548072,_0x362059){return new BPromise(function(_0x304688,_0x26bafa){return client[_0x954b('0x2')](_0x548072,_0x362059)[_0x954b('0x3')](function(_0x30e32d){if(_0x30e32d[_0x954b('0x4')]){return _0x26bafa(_0x30e32d[_0x954b('0x4')][_0x954b('0x5')]);}else{return _0x304688(_0x30e32d['result']);}})[_0x954b('0x6')](function(_0x137041){return _0x26bafa(_0x137041);});});}exports[_0x954b('0x7')]=function(_0x4a37db,_0x1d3418){return request('SendMail',{'account':_0x4a37db,'message':_0x1d3418});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 5b5d303..ec32d6e 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 _0x849c=['isUndefined','result','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','clear','dnid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','exports','xml2json','util','../../config/logger','agi','./mailRpc','./graph','./vertices','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','omit','isArray','length','target','source','value','toJson','mxGraphModel','root','production','debug','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','traverseBFS','vertex','stringify','gotoc','info','context','extension','priority','response','evtHangup'];(function(_0x420f57,_0x2e75b0){var _0x5b525c=function(_0x4424f0){while(--_0x4424f0){_0x420f57['push'](_0x420f57['shift']());}};_0x5b525c(++_0x2e75b0);}(_0x849c,0x7a));var _0xc849=function(_0x5aba3d,_0x272a72){_0x5aba3d=_0x5aba3d-0x0;var _0x1a0c3c=_0x849c[_0x5aba3d];return _0x1a0c3c;};'use strict';var _=require('lodash');var moment=require('moment');var parser=require(_0xc849('0x0'));var util=require(_0xc849('0x1'));var logger=require(_0xc849('0x2'))(_0xc849('0x3'));var rpc=require('./rpc');var mailRpc=require(_0xc849('0x4'));var Graph=require(_0xc849('0x5'));var Vertices=require(_0xc849('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xc849('0x7')]()['catch'](function(_0xe2488d){logger[_0xc849('0x8')](_0xc849('0x9'),_0xe2488d[_0xc849('0xa')]);return[];});}function addVertex(_0x4eb838,_0x1da64a,_0x154e86){_0x1da64a[_0xc849('0xb')]=_0x154e86;if(_0x1da64a[_0xc849('0xc')]('retry')){_0x1da64a['maxRetry']=parseInt(_0x1da64a[_0xc849('0xd')],0xa);}_0x4eb838['addVertex'](_[_0xc849('0xe')](_0x1da64a,'mxCell'));}function initGraph(_0x1d885e,_0x453679){var _0x5dd6bb=new Graph();for(var _0x1a661a in _0x1d885e){if(_0x1d885e[_0xc849('0xc')](_0x1a661a)){if(_[_0xc849('0xf')](_0x1d885e[_0x1a661a])){for(var _0x49bf65=0x0;_0x49bf65<_0x1d885e[_0x1a661a][_0xc849('0x10')];_0x49bf65+=0x1){addVertex(_0x5dd6bb,_0x1d885e[_0x1a661a][_0x49bf65],_0x1a661a);}}else{addVertex(_0x5dd6bb,_0x1d885e[_0x1a661a],_0x1a661a);}}}for(var _0x81fb71=0x0;_0x81fb71<_0x453679[_0xc849('0x10')];_0x81fb71+=0x1){if(_0x453679[_0x81fb71]['source']&&_0x453679[_0x81fb71][_0xc849('0x11')]){_0x5dd6bb['addEdge'](_0x453679[_0x81fb71][_0xc849('0x12')],_0x453679[_0x81fb71][_0xc849('0x11')],_0x453679[_0x81fb71][_0xc849('0x13')]);}}return _0x5dd6bb;}function getRoot(_0x357e01){return parser[_0xc849('0x14')](_0x357e01,{'object':!![]})[_0xc849('0x15')][_0xc849('0x16')];}function inspect(_0x101529){return util['inspect'](_0x101529,{'showHidden':![],'depth':null});}function initialize(_0x1c2f4a,_0x3adf1){var _0x1ecefa=getRoot(_0x1c2f4a[_0xc849('0x17')]);if(!_0x1ecefa||!_0x1ecefa['start'])return;var _0x5577c4,_0x55209e,_0xff1b66;logger[_0xc849('0x18')](_0xc849('0x16'),JSON['stringify'](_0x1ecefa,null,0x2));_0x3adf1['joinAt']=moment()[_0xc849('0x19')](_0xc849('0x1a'));_0x5577c4=initGraph(_[_0xc849('0xe')](_0x1ecefa,_0xc849('0x1b')),_0x1ecefa['mxCell']);_0x55209e=new Vertices(_0x3adf1,rpc,mailRpc);logger['info'](util[_0xc849('0x19')](_0xc849('0x1c'),_0x3adf1[_0xc849('0x1d')],_0x3adf1[_0xc849('0x1e')],_0x3adf1[_0xc849('0x1f')],_0x3adf1['dnid'],_0x3adf1[_0xc849('0x20')]));_0x5577c4[_0xc849('0x21')](_0x1ecefa['start']['id'],function(_0x58caa9){try{_0x58caa9=_0x55209e['clear'](_0x58caa9);logger[_0xc849('0x18')](_0xc849('0x22'),JSON[_0xc849('0x23')](_0x58caa9,null,0x2));if(_0x58caa9[_0xc849('0xb')]===_0xc849('0x24')){logger[_0xc849('0x25')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x3adf1[_0xc849('0x26')]=_0x58caa9[_0xc849('0x26')]||_0x3adf1[_0xc849('0x26')];_0x3adf1[_0xc849('0x27')]=_0x58caa9[_0xc849('0x27')];_0x3adf1['priority']=_0x58caa9[_0xc849('0x28')]?_0x58caa9[_0xc849('0x28')]-0x1:0x1;return null;}else if(_0x58caa9&&_0x55209e[_0x58caa9[_0xc849('0xb')]]){_0xff1b66=_0x55209e[_0x58caa9[_0xc849('0xb')]](_0x58caa9);logger[_0xc849('0x25')](_0xc849('0x29'),JSON[_0xc849('0x23')](_0xff1b66,null,0x2));if(_0xff1b66&&_0xff1b66['code']===AGI_CODE_SUCCESS&&_0xff1b66['result']!==AGI_RESULT_ERROR&&!_0x3adf1[_0xc849('0x2a')]){logger[_0xc849('0x18')]('response',inspect(_0xff1b66));return _[_0xc849('0x2b')](_0xff1b66[_0xc849('0x2c')])?null:_0xff1b66[_0xc849('0x2c')][_0xc849('0x2d')]();}else{logger['error']('response',inspect(_0xff1b66));return null;}}else{logger[_0xc849('0x8')](_0xc849('0x2e'));return null;}}catch(_0x32f9dd){logger['error'](_0x32f9dd[_0xc849('0xa')]);return null;}});if(_0x1ecefa['finally']){logger[_0xc849('0x25')](util[_0xc849('0x19')](_0xc849('0x2f'),_0x3adf1['arg_1'],_0x3adf1[_0xc849('0x1e')],_0x3adf1[_0xc849('0x1f')],_0x3adf1['dnid'],_0x3adf1[_0xc849('0x20')]));_0x5577c4['traverseBFS'](_0x1ecefa[_0xc849('0x30')]['id'],function(_0x264caa){try{_0x264caa=_0x55209e[_0xc849('0x31')](_0x264caa);logger[_0xc849('0x18')]('vertex',JSON[_0xc849('0x23')](_0x264caa,null,0x2));if(_0x264caa&&_0x55209e[_0x264caa[_0xc849('0xb')]]){_0xff1b66=_0x55209e[_0x264caa[_0xc849('0xb')]](_0x264caa);if(_0xff1b66){logger[_0xc849('0x18')](_0xc849('0x29'),inspect(_0xff1b66));return _[_0xc849('0x2b')](_0xff1b66[_0xc849('0x2c')])?null:_0xff1b66[_0xc849('0x2c')][_0xc849('0x2d')]();}else{logger[_0xc849('0x8')](_0xc849('0x29'),inspect(_0xff1b66));return null;}}else{logger[_0xc849('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x1835a5){logger[_0xc849('0x8')](_0x1835a5['stack']);return null;}});}logger['info'](util[_0xc849('0x19')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3adf1[_0xc849('0x1d')],_0x3adf1[_0xc849('0x1e')],_0x3adf1[_0xc849('0x1f')],_0x3adf1[_0xc849('0x32')],_0x3adf1[_0xc849('0x20')]));logger[_0xc849('0x25')](util['format'](_0xc849('0x33'),_0x3adf1[_0xc849('0x26')],_0x3adf1['extension'],parseInt(_0x3adf1[_0xc849('0x28')],0xa)+0x1));_0x3adf1[_0xc849('0x34')](_0x3adf1['context'],_0x3adf1['extension'],parseInt(_0x3adf1[_0xc849('0x28')],0xa)+0x1);_0x3adf1[_0xc849('0x35')]();}function handleNotFound(_0x151a2e){logger[_0xc849('0x8')](util['format']('Project\x20%s\x20not\x20found',_0x151a2e[_0xc849('0x1d')]));_0x151a2e[_0xc849('0x34')](_0x151a2e[_0xc849('0x26')],_0x151a2e['extension'],parseInt(_0x151a2e[_0xc849('0x28')],0xa)+0x1);_0x151a2e[_0xc849('0x35')]();}function handleUnpublished(_0x4f4d56){logger['error'](util['format']('Project\x20%s\x20not\x20published',_0x4f4d56[_0xc849('0x1d')]));_0x4f4d56[_0xc849('0x34')](_0x4f4d56['context'],_0x4f4d56[_0xc849('0x27')],parseInt(_0x4f4d56[_0xc849('0x28')],0xa)+0x1);_0x4f4d56[_0xc849('0x35')]();}module[_0xc849('0x36')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xe425=['vertex','toString','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','continueAt','exports','lodash','moment','util','../../config/logger','agi','./rpc','./graph','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','addVertex','omit','isArray','length','source','target','addEdge','value','toJson','root','inspect','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','clear','info','context','extension','priority','code','result','evtHangup','response','isUndefined','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS'];(function(_0x7eb3ad,_0x571c4e){var _0x19816b=function(_0x4201d5){while(--_0x4201d5){_0x7eb3ad['push'](_0x7eb3ad['shift']());}};_0x19816b(++_0x571c4e);}(_0xe425,0x1a6));var _0x5e42=function(_0x43bd66,_0x27e9b3){_0x43bd66=_0x43bd66-0x0;var _0x5195cb=_0xe425[_0x43bd66];return _0x5195cb;};'use strict';var _=require(_0x5e42('0x0'));var moment=require(_0x5e42('0x1'));var parser=require('xml2json');var util=require(_0x5e42('0x2'));var logger=require(_0x5e42('0x3'))(_0x5e42('0x4'));var rpc=require(_0x5e42('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0x5e42('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x5e42('0x7')]()[_0x5e42('0x8')](function(_0x4f04dd){logger[_0x5e42('0x9')](_0x5e42('0xa'),_0x4f04dd[_0x5e42('0xb')]);return[];});}function addVertex(_0x1b2fac,_0x490a5e,_0x50dd9e){_0x490a5e[_0x5e42('0xc')]=_0x50dd9e;if(_0x490a5e['hasOwnProperty'](_0x5e42('0xd'))){_0x490a5e['maxRetry']=parseInt(_0x490a5e[_0x5e42('0xd')],0xa);}_0x1b2fac[_0x5e42('0xe')](_[_0x5e42('0xf')](_0x490a5e,'mxCell'));}function initGraph(_0x157d19,_0xc429f9){var _0x27ff82=new Graph();for(var _0x311f90 in _0x157d19){if(_0x157d19['hasOwnProperty'](_0x311f90)){if(_[_0x5e42('0x10')](_0x157d19[_0x311f90])){for(var _0x3ac9e9=0x0;_0x3ac9e9<_0x157d19[_0x311f90][_0x5e42('0x11')];_0x3ac9e9+=0x1){addVertex(_0x27ff82,_0x157d19[_0x311f90][_0x3ac9e9],_0x311f90);}}else{addVertex(_0x27ff82,_0x157d19[_0x311f90],_0x311f90);}}}for(var _0x49f039=0x0;_0x49f039<_0xc429f9[_0x5e42('0x11')];_0x49f039+=0x1){if(_0xc429f9[_0x49f039][_0x5e42('0x12')]&&_0xc429f9[_0x49f039][_0x5e42('0x13')]){_0x27ff82[_0x5e42('0x14')](_0xc429f9[_0x49f039][_0x5e42('0x12')],_0xc429f9[_0x49f039][_0x5e42('0x13')],_0xc429f9[_0x49f039][_0x5e42('0x15')]);}}return _0x27ff82;}function getRoot(_0x535a5a){return parser[_0x5e42('0x16')](_0x535a5a,{'object':!![]})['mxGraphModel'][_0x5e42('0x17')];}function inspect(_0x47279d){return util[_0x5e42('0x18')](_0x47279d,{'showHidden':![],'depth':null});}function initialize(_0x826127,_0x20d3b3){var _0x4247d2=getRoot(_0x826127['production']);if(!_0x4247d2||!_0x4247d2[_0x5e42('0x19')])return;var _0xfd3753,_0x5844e9,_0x9b3545;logger[_0x5e42('0x1a')](_0x5e42('0x17'),JSON[_0x5e42('0x1b')](_0x4247d2,null,0x2));_0x20d3b3[_0x5e42('0x1c')]=moment()[_0x5e42('0x1d')](_0x5e42('0x1e'));_0xfd3753=initGraph(_[_0x5e42('0xf')](_0x4247d2,_0x5e42('0x1f')),_0x4247d2['mxCell']);_0x5844e9=new Vertices(_0x20d3b3,rpc,mailRpc);logger['info'](util[_0x5e42('0x1d')](_0x5e42('0x20'),_0x20d3b3['arg_1'],_0x20d3b3[_0x5e42('0x21')],_0x20d3b3[_0x5e42('0x22')],_0x20d3b3[_0x5e42('0x23')],_0x20d3b3[_0x5e42('0x24')]));_0xfd3753['traverseBFS'](_0x4247d2[_0x5e42('0x19')]['id'],function(_0x534267){try{_0x534267=_0x5844e9[_0x5e42('0x25')](_0x534267);logger['debug']('vertex',JSON[_0x5e42('0x1b')](_0x534267,null,0x2));if(_0x534267[_0x5e42('0xc')]==='gotoc'){logger[_0x5e42('0x26')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x20d3b3['context']=_0x534267[_0x5e42('0x27')]||_0x20d3b3[_0x5e42('0x27')];_0x20d3b3[_0x5e42('0x28')]=_0x534267[_0x5e42('0x28')];_0x20d3b3[_0x5e42('0x29')]=_0x534267[_0x5e42('0x29')]?_0x534267[_0x5e42('0x29')]-0x1:0x1;return null;}else if(_0x534267&&_0x5844e9[_0x534267[_0x5e42('0xc')]]){_0x9b3545=_0x5844e9[_0x534267[_0x5e42('0xc')]](_0x534267);logger[_0x5e42('0x26')]('response',JSON[_0x5e42('0x1b')](_0x9b3545,null,0x2));if(_0x9b3545&&_0x9b3545[_0x5e42('0x2a')]===AGI_CODE_SUCCESS&&_0x9b3545[_0x5e42('0x2b')]!==AGI_RESULT_ERROR&&!_0x20d3b3[_0x5e42('0x2c')]){logger[_0x5e42('0x1a')](_0x5e42('0x2d'),inspect(_0x9b3545));return _[_0x5e42('0x2e')](_0x9b3545['result'])?null:_0x9b3545[_0x5e42('0x2b')]['toString']();}else{logger[_0x5e42('0x9')](_0x5e42('0x2d'),inspect(_0x9b3545));return null;}}else{logger[_0x5e42('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x5e9636){logger[_0x5e42('0x9')](_0x5e9636[_0x5e42('0xb')]);return null;}});if(_0x4247d2[_0x5e42('0x2f')]){logger[_0x5e42('0x26')](util[_0x5e42('0x1d')](_0x5e42('0x30'),_0x20d3b3['arg_1'],_0x20d3b3[_0x5e42('0x21')],_0x20d3b3[_0x5e42('0x22')],_0x20d3b3[_0x5e42('0x23')],_0x20d3b3[_0x5e42('0x24')]));_0xfd3753[_0x5e42('0x31')](_0x4247d2[_0x5e42('0x2f')]['id'],function(_0x3a87d8){try{_0x3a87d8=_0x5844e9[_0x5e42('0x25')](_0x3a87d8);logger[_0x5e42('0x1a')](_0x5e42('0x32'),JSON[_0x5e42('0x1b')](_0x3a87d8,null,0x2));if(_0x3a87d8&&_0x5844e9[_0x3a87d8[_0x5e42('0xc')]]){_0x9b3545=_0x5844e9[_0x3a87d8['agicommand']](_0x3a87d8);if(_0x9b3545){logger['debug'](_0x5e42('0x2d'),inspect(_0x9b3545));return _[_0x5e42('0x2e')](_0x9b3545['result'])?null:_0x9b3545[_0x5e42('0x2b')][_0x5e42('0x33')]();}else{logger['error'](_0x5e42('0x2d'),inspect(_0x9b3545));return null;}}else{logger[_0x5e42('0x9')](_0x5e42('0x34'));return null;}}catch(_0x150790){logger['error'](_0x150790[_0x5e42('0xb')]);return null;}});}logger['info'](util[_0x5e42('0x1d')](_0x5e42('0x35'),_0x20d3b3[_0x5e42('0x36')],_0x20d3b3[_0x5e42('0x21')],_0x20d3b3[_0x5e42('0x22')],_0x20d3b3[_0x5e42('0x23')],_0x20d3b3[_0x5e42('0x24')]));logger['info'](util['format'](_0x5e42('0x37'),_0x20d3b3[_0x5e42('0x27')],_0x20d3b3[_0x5e42('0x28')],parseInt(_0x20d3b3[_0x5e42('0x29')],0xa)+0x1));_0x20d3b3['continueAt'](_0x20d3b3[_0x5e42('0x27')],_0x20d3b3['extension'],parseInt(_0x20d3b3[_0x5e42('0x29')],0xa)+0x1);_0x20d3b3[_0x5e42('0x38')]();}function handleNotFound(_0x187553){logger[_0x5e42('0x9')](util[_0x5e42('0x1d')]('Project\x20%s\x20not\x20found',_0x187553[_0x5e42('0x36')]));_0x187553[_0x5e42('0x39')](_0x187553[_0x5e42('0x27')],_0x187553[_0x5e42('0x28')],parseInt(_0x187553[_0x5e42('0x29')],0xa)+0x1);_0x187553['close']();}function handleUnpublished(_0x25e8ff){logger['error'](util[_0x5e42('0x1d')]('Project\x20%s\x20not\x20published',_0x25e8ff[_0x5e42('0x36')]));_0x25e8ff[_0x5e42('0x39')](_0x25e8ff[_0x5e42('0x27')],_0x25e8ff[_0x5e42('0x28')],parseInt(_0x25e8ff[_0x5e42('0x29')],0xa)+0x1);_0x25e8ff[_0x5e42('0x38')]();}module[_0x5e42('0x3a')]={'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 8fcf7f6..ee29618 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 _0x66ce=['_localBuffer','_inBody','indexOf','substring','split','slice','length','emit','headers','line','exports','util','Transform','call','inherits','prototype','\x0d\x0a\x0d\x0a'];(function(_0x5175ff,_0x30440f){var _0x1f9360=function(_0x5f5818){while(--_0x5f5818){_0x5175ff['push'](_0x5175ff['shift']());}};_0x1f9360(++_0x30440f);}(_0x66ce,0x181));var _0xe66c=function(_0x221fbe,_0x16bc47){_0x221fbe=_0x221fbe-0x0;var _0x51c3eb=_0x66ce[_0x221fbe];return _0x51c3eb;};'use strict';var util=require(_0xe66c('0x0'));var Transform=require('stream')[_0xe66c('0x1')];function AGIReply(_0x10cbc6){Transform[_0xe66c('0x2')](this,_0x10cbc6);this['_localBuffer']='';this['_inBody']=![];}util[_0xe66c('0x3')](AGIReply,Transform);AGIReply[_0xe66c('0x4')]['_transform']=function(_0x46a727,_0x3e66cf,_0x18e581){var _0x3959e8='\x0a',_0x251a89=['\x0a\x0a',_0xe66c('0x5')],_0x37d226=-0x1,_0x135bc8=-0x1,_0x2cbb97='',_0x583443=0x0,_0x26aa80='',_0x449155='';this['_localBuffer']+=_0x46a727['toString']();_0x26aa80=this[_0xe66c('0x6')];if(!this[_0xe66c('0x7')]){_0x583443=0x0;while(_0x251a89[_0x583443]){while((_0x135bc8=_0x26aa80[_0xe66c('0x8')](_0x251a89[_0x583443]))!=-0x1){_0x2cbb97=_0x251a89[_0x583443];_0x449155=_0x26aa80[_0xe66c('0x9')](0x0,_0x135bc8);_0x26aa80=_0x26aa80[_0xe66c('0x9')](_0x135bc8+_0x2cbb97['length']);var _0x2ab101=_0x449155[_0xe66c('0xa')](_0x3959e8),_0x27571a=0x0,_0x321f59={},_0x1c4a1a='',_0x446a9d='',_0x7d2c12=-0x1;while(_0x2ab101[_0x27571a]){_0x7d2c12=_0x2ab101[_0x27571a][_0xe66c('0x8')](':');if(_0x7d2c12!=-0x1){_0x1c4a1a=_0x2ab101[_0x27571a][_0xe66c('0xb')](0x0,_0x7d2c12)['trim']();_0x446a9d=_0x2ab101[_0x27571a][_0xe66c('0xb')](_0x7d2c12+0x1)['trim']();if(_0x1c4a1a[_0xe66c('0xc')]>0x0){_0x321f59[_0x1c4a1a]=_0x446a9d;}}else{}_0x27571a++;}this[_0xe66c('0xd')](_0xe66c('0xe'),_0x321f59);this[_0xe66c('0x7')]=!![];}_0x583443++;}this[_0xe66c('0x6')]=_0x26aa80;}else{while((_0x37d226=_0x26aa80[_0xe66c('0x8')](_0x3959e8))!=-0x1){_0x449155=_0x26aa80[_0xe66c('0x9')](0x0,_0x37d226);this['emit'](_0xe66c('0xf'),_0x449155);_0x26aa80=_0x26aa80[_0xe66c('0x9')](_0x37d226+_0x3959e8[_0xe66c('0xc')]);}this[_0xe66c('0x6')]=_0x26aa80;}_0x18e581();};module[_0xe66c('0x10')]=AGIReply; \ No newline at end of file +var _0x2dc3=['stream','call','_localBuffer','_inBody','inherits','prototype','_transform','toString','indexOf','substring','slice','trim','length','emit','headers','exports'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x2dc3,0x150));var _0x32dc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2dc3[_0x14add3];return _0x4a174f;};'use strict';var util=require('util');var Transform=require(_0x32dc('0x0'))['Transform'];function AGIReply(_0x354676){Transform[_0x32dc('0x1')](this,_0x354676);this[_0x32dc('0x2')]='';this[_0x32dc('0x3')]=![];}util[_0x32dc('0x4')](AGIReply,Transform);AGIReply[_0x32dc('0x5')][_0x32dc('0x6')]=function(_0x1d4409,_0x3d295c,_0x2919a2){var _0x4ed102='\x0a',_0x2187bd=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x248c9f=-0x1,_0x5e0943=-0x1,_0x19941d='',_0x538521=0x0,_0x16c09a='',_0x53aa13='';this[_0x32dc('0x2')]+=_0x1d4409[_0x32dc('0x7')]();_0x16c09a=this[_0x32dc('0x2')];if(!this[_0x32dc('0x3')]){_0x538521=0x0;while(_0x2187bd[_0x538521]){while((_0x5e0943=_0x16c09a[_0x32dc('0x8')](_0x2187bd[_0x538521]))!=-0x1){_0x19941d=_0x2187bd[_0x538521];_0x53aa13=_0x16c09a[_0x32dc('0x9')](0x0,_0x5e0943);_0x16c09a=_0x16c09a[_0x32dc('0x9')](_0x5e0943+_0x19941d['length']);var _0x33db51=_0x53aa13['split'](_0x4ed102),_0x1b79aa=0x0,_0x4287f6={},_0x4f94af='',_0x3fb8fd='',_0x300ad3=-0x1;while(_0x33db51[_0x1b79aa]){_0x300ad3=_0x33db51[_0x1b79aa][_0x32dc('0x8')](':');if(_0x300ad3!=-0x1){_0x4f94af=_0x33db51[_0x1b79aa][_0x32dc('0xa')](0x0,_0x300ad3)[_0x32dc('0xb')]();_0x3fb8fd=_0x33db51[_0x1b79aa][_0x32dc('0xa')](_0x300ad3+0x1)['trim']();if(_0x4f94af[_0x32dc('0xc')]>0x0){_0x4287f6[_0x4f94af]=_0x3fb8fd;}}else{}_0x1b79aa++;}this[_0x32dc('0xd')](_0x32dc('0xe'),_0x4287f6);this[_0x32dc('0x3')]=!![];}_0x538521++;}this[_0x32dc('0x2')]=_0x16c09a;}else{while((_0x248c9f=_0x16c09a[_0x32dc('0x8')](_0x4ed102))!=-0x1){_0x53aa13=_0x16c09a[_0x32dc('0x9')](0x0,_0x248c9f);this[_0x32dc('0xd')]('line',_0x53aa13);_0x16c09a=_0x16c09a[_0x32dc('0x9')](_0x248c9f+_0x4ed102[_0x32dc('0xc')]);}this[_0x32dc('0x2')]=_0x16c09a;}_0x2919a2();};module[_0x32dc('0xf')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 79160cc..a2c9564 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 _0xf9bb=['getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','Interval','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','ShowCmHopper','phone','ListId','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','http','request','then','error','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0xf9bb,0x14d));var _0xbf9b=function(_0x40bdb3,_0x5a81f2){_0x40bdb3=_0x40bdb3-0x0;var _0xeac086=_0xf9bb[_0x40bdb3];return _0xeac086;};'use strict';var _=require(_0xbf9b('0x0'));var moment=require(_0xbf9b('0x1'));var jayson=require(_0xbf9b('0x2'));var client=jayson['client'][_0xbf9b('0x3')]({'port':0x2329});function request(_0x303ac3,_0x592295){return new Promise(function(_0x4e5db7,_0x190028){return client[_0xbf9b('0x4')](_0x303ac3,_0x592295)[_0xbf9b('0x5')](function(_0x20b0c5){if(_0x20b0c5[_0xbf9b('0x6')]){return _0x190028(_0x20b0c5[_0xbf9b('0x6')]['message']);}else{return _0x4e5db7(_0x20b0c5['result']);}})[_0xbf9b('0x7')](function(_0x493147){return _0x190028(_0x493147);});});}exports[_0xbf9b('0x8')]=function(){return request(_0xbf9b('0x9'),{'options':{'raw':![],'attributes':['id',_0xbf9b('0xa'),_0xbf9b('0xb')]}});};exports[_0xbf9b('0xc')]=function(_0x1437cd){return request(_0xbf9b('0xd'),{'options':{'raw':![],'where':{'name':_0x1437cd},'attributes':['production']}});};exports[_0xbf9b('0xe')]=function(_0x1cde49){return request(_0xbf9b('0xf'),{'options':{'raw':![],'where':{'id':_0x1cde49},'include':[{'model':_0xbf9b('0x10'),'as':_0xbf9b('0x11'),'include':[{'model':_0xbf9b('0x12'),'as':'CloudProvider'}]}],'attributes':['id',_0xbf9b('0xa'),_0xbf9b('0x13')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x201e31){return request(_0xbf9b('0xd'),{'options':{'where':{'id':_0x201e31},'attributes':[_0xbf9b('0xa')]}});};exports[_0xbf9b('0x14')]=function(_0x5d842d){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x5d842d},'attributes':[_0xbf9b('0xa')]}});};exports[_0xbf9b('0x15')]=function(_0x182b05){return request(_0xbf9b('0x16'),{'options':{'where':{'id':_0x182b05},'attributes':[_0xbf9b('0xa')]}});};exports[_0xbf9b('0x17')]=function(_0x1ec0e){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x1ec0e},'attributes':[_0xbf9b('0x18')]}});};exports[_0xbf9b('0x19')]=function(_0x4f99da){return request(_0xbf9b('0x1a'),{'options':{'where':{'id':_0x4f99da},'attributes':[_0xbf9b('0xa')]}});};exports[_0xbf9b('0x1b')]=function(_0x1dac71){return request(_0xbf9b('0x1c'),{'options':{'where':{'phone':_0x1dac71['phone']},'attributes':['id']}});};exports[_0xbf9b('0x1d')]=function(_0x29b1e5){return request(_0xbf9b('0x1e'),{'options':{'where':{'id':_0x29b1e5},'attributes':[_0xbf9b('0xa')]}});};exports[_0xbf9b('0x1f')]=function(_0x19fbee){return request(_0xbf9b('0x20'),{'options':{'where':{'id':_0x19fbee},'attributes':[_0xbf9b('0x21')]}});};exports[_0xbf9b('0x22')]=function(_0x136268){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x136268},'include':[{'model':_0xbf9b('0x23'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x38439b){return request(_0xbf9b('0x24'),{'options':{'where':{'id':_0x38439b},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x483ca1){return request(_0xbf9b('0x25'),{'body':_0x483ca1});};exports['createSquareDetailsReport']=function(_0x24336c){return request(_0xbf9b('0x26'),{'body':_0x24336c});};exports[_0xbf9b('0x27')]=function(_0x524597){return request(_0xbf9b('0x28'),{'body':_[_0xbf9b('0x29')](_0x524597,{'project_name':_0x524597[_0xbf9b('0x2a')],'prev_project_name':_0x524597[_0xbf9b('0x2b')]||'','is_subproject':_0x524597[_0xbf9b('0x2b')]?!![]:![],'leaveAt':moment()[_0xbf9b('0x2c')](_0xbf9b('0x2d'))})});};exports[_0xbf9b('0x2e')]=function(_0x3444f1){return request('CreateSquareRecording',{'body':_0x3444f1});};exports[_0xbf9b('0x2f')]=function(_0x41b5f3){return request('CreateSquareMessage',{'body':_0x41b5f3});};exports['createCmContact']=function(_0x1614fe){return request(_0xbf9b('0x30'),{'options':{'raw':![],'where':{'phone':_0x1614fe[_0xbf9b('0x31')],'ListId':_0x1614fe[_0xbf9b('0x32')]}}})[_0xbf9b('0x5')](function(_0xb60470){if(_0xb60470){return _0xb60470;}return request('CreateCmContact',{'body':_0x1614fe});});};exports['getPauseById']=function(_0x49d77f){return request(_0xbf9b('0x33'),{'options':{'where':{'id':_0x49d77f},'attributes':[_0xbf9b('0xa')]}});};exports[_0xbf9b('0x34')]=function(_0x41d29d,_0xa21698){return request(_0xbf9b('0x35'),{'body':{'interface':_0xa21698},'options':{'where':_0x41d29d}});};exports[_0xbf9b('0x36')]=function(_0x14eff8,_0x2ad702,_0x3f8f1b){return request(_0xbf9b('0x37'),{'body':{'type':_0x2ad702,'uniqueid':_0x3f8f1b},'options':{'where':_0x14eff8}});};exports[_0xbf9b('0x38')]=function(_0x4baded){return request(_0xbf9b('0x39'),{'body':{},'options':{'where':_0x4baded}});};exports[_0xbf9b('0x3a')]=function(_0x17a2e4){return request(_0xbf9b('0x3b'),{'body':{},'options':{'where':_0x17a2e4}});}; \ No newline at end of file +var _0x0d6a=['getPauseById','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','client','http','request','then','error','message','result','catch','getSquareProjects','name','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone','phone','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x0d6a,0xc9));var _0xa0d6=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x0d6a[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0xa0d6('0x0'));var moment=require(_0xa0d6('0x1'));var jayson=require('jayson/promise');var client=jayson[_0xa0d6('0x2')][_0xa0d6('0x3')]({'port':0x2329});function request(_0x37e078,_0xa452b8){return new Promise(function(_0x71d654,_0x236047){return client[_0xa0d6('0x4')](_0x37e078,_0xa452b8)[_0xa0d6('0x5')](function(_0x3ed624){if(_0x3ed624[_0xa0d6('0x6')]){return _0x236047(_0x3ed624['error'][_0xa0d6('0x7')]);}else{return _0x71d654(_0x3ed624[_0xa0d6('0x8')]);}})[_0xa0d6('0x9')](function(_0x11f5f9){return _0x236047(_0x11f5f9);});});}exports[_0xa0d6('0xa')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0xa0d6('0xb'),'production']}});};exports[_0xa0d6('0xc')]=function(_0x49ede5){return request(_0xa0d6('0xd'),{'options':{'raw':![],'where':{'name':_0x49ede5},'attributes':['production']}});};exports[_0xa0d6('0xe')]=function(_0x831250){return request(_0xa0d6('0xf'),{'options':{'raw':![],'where':{'id':_0x831250},'include':[{'model':_0xa0d6('0x10'),'as':_0xa0d6('0x11'),'include':[{'model':_0xa0d6('0x12'),'as':'CloudProvider'}]}],'attributes':['id',_0xa0d6('0xb'),_0xa0d6('0x13')],'smtp':!![]}});};exports[_0xa0d6('0x14')]=function(_0x5db766){return request(_0xa0d6('0xd'),{'options':{'where':{'id':_0x5db766},'attributes':[_0xa0d6('0xb')]}});};exports[_0xa0d6('0x15')]=function(_0x31b97b){return request(_0xa0d6('0x16'),{'options':{'where':{'id':_0x31b97b},'attributes':[_0xa0d6('0xb')]}});};exports[_0xa0d6('0x17')]=function(_0x4a0f3a){return request('ShowVariable',{'options':{'where':{'id':_0x4a0f3a},'attributes':[_0xa0d6('0xb')]}});};exports[_0xa0d6('0x18')]=function(_0xb21e34){return request(_0xa0d6('0x19'),{'options':{'where':{'id':_0xb21e34},'attributes':[_0xa0d6('0x1a')]}});};exports[_0xa0d6('0x1b')]=function(_0x82e7b6){return request('ShowUser',{'options':{'where':{'id':_0x82e7b6},'attributes':[_0xa0d6('0xb')]}});};exports[_0xa0d6('0x1c')]=function(_0x20c387){return request('GetContactByPhone',{'options':{'where':{'phone':_0x20c387[_0xa0d6('0x1d')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x1dc618){return request('ShowTrunk',{'options':{'where':{'id':_0x1dc618},'attributes':[_0xa0d6('0xb')]}});};exports[_0xa0d6('0x1e')]=function(_0x205cff){return request(_0xa0d6('0x1f'),{'options':{'where':{'id':_0x205cff},'attributes':[_0xa0d6('0x20')]}});};exports[_0xa0d6('0x21')]=function(_0x5a78ec){return request(_0xa0d6('0x22'),{'options':{'raw':![],'where':{'id':_0x5a78ec},'include':[{'model':_0xa0d6('0x23'),'as':'Intervals'}]}});};exports[_0xa0d6('0x24')]=function(_0x51c67e){return request('ShowSmsAccount',{'options':{'where':{'id':_0x51c67e},'attributes':['id',_0xa0d6('0xb')]}});};exports[_0xa0d6('0x25')]=function(_0x181606){return request(_0xa0d6('0x26'),{'body':_0x181606});};exports[_0xa0d6('0x27')]=function(_0x233faa){return request(_0xa0d6('0x28'),{'body':_0x233faa});};exports[_0xa0d6('0x29')]=function(_0x3f15d0){return request(_0xa0d6('0x2a'),{'body':_['merge'](_0x3f15d0,{'project_name':_0x3f15d0[_0xa0d6('0x2b')],'prev_project_name':_0x3f15d0[_0xa0d6('0x2c')]||'','is_subproject':_0x3f15d0[_0xa0d6('0x2c')]?!![]:![],'leaveAt':moment()[_0xa0d6('0x2d')](_0xa0d6('0x2e'))})});};exports[_0xa0d6('0x2f')]=function(_0x3ebb88){return request(_0xa0d6('0x30'),{'body':_0x3ebb88});};exports[_0xa0d6('0x31')]=function(_0x28abb2){return request(_0xa0d6('0x32'),{'body':_0x28abb2});};exports[_0xa0d6('0x33')]=function(_0x414b84){return request(_0xa0d6('0x34'),{'options':{'raw':![],'where':{'phone':_0x414b84[_0xa0d6('0x1d')],'ListId':_0x414b84[_0xa0d6('0x35')]}}})[_0xa0d6('0x5')](function(_0x3dfa5a){if(_0x3dfa5a){return _0x3dfa5a;}return request(_0xa0d6('0x36'),{'body':_0x414b84});});};exports[_0xa0d6('0x37')]=function(_0x184a5a){return request(_0xa0d6('0x38'),{'options':{'where':{'id':_0x184a5a},'attributes':[_0xa0d6('0xb')]}});};exports[_0xa0d6('0x39')]=function(_0x4a30e1,_0x1a811f){return request('LoginUser',{'body':{'interface':_0x1a811f},'options':{'where':_0x4a30e1}});};exports[_0xa0d6('0x3a')]=function(_0x266675,_0x369196,_0x525c40){return request(_0xa0d6('0x3b'),{'body':{'type':_0x369196,'uniqueid':_0x525c40},'options':{'where':_0x266675}});};exports[_0xa0d6('0x3c')]=function(_0x5e7084){return request(_0xa0d6('0x3d'),{'body':{},'options':{'where':_0x5e7084}});};exports[_0xa0d6('0x3e')]=function(_0x556746){return request(_0xa0d6('0x3f'),{'body':{},'options':{'where':_0x556746}});}; \ 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 29efbfd..81359ce 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 _0xf569=['./lex','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf569,0xd0));var _0x9f56=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xf569[_0x565ed7];return _0x183ad7;};var polly=require('./polly');var lex=require(_0x9f56('0x0'));module[_0x9f56('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x7a3e=['exports','./polly','./lex'];(function(_0x53f4e3,_0x62f760){var _0x25c1ef=function(_0x4e4e95){while(--_0x4e4e95){_0x53f4e3['push'](_0x53f4e3['shift']());}};_0x25c1ef(++_0x62f760);}(_0x7a3e,0x18a));var _0xe7a3=function(_0x2d0298,_0xee7b5e){_0x2d0298=_0x2d0298-0x0;var _0x5705c7=_0x7a3e[_0x2d0298];return _0x5705c7;};var polly=require(_0xe7a3('0x0'));var lex=require(_0xe7a3('0x1'));module[_0xe7a3('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 e8ae763..8fd76e9 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 _0xe5b5=['exports','./lib/api'];(function(_0x26ae11,_0xc2f3f0){var _0x4b4d0a=function(_0x3bd478){while(--_0x3bd478){_0x26ae11['push'](_0x26ae11['shift']());}};_0x4b4d0a(++_0xc2f3f0);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x17e771,_0x55fd17){_0x17e771=_0x17e771-0x0;var _0x1f3a6d=_0xe5b5[_0x17e771];return _0x1f3a6d;};'use strict';var lex=require(_0x5e5b('0x0'));module[_0x5e5b('0x1')]=function(_0x418c87,_0x3b3efd,_0x208070,_0x4263e,_0x33e813,_0x3dc763){return lex(_0x418c87,_0x3b3efd,_0x208070,_0x4263e,_0x33e813,_0x3dc763);}; \ No newline at end of file +var _0xb58b=['exports'];(function(_0x59dbdc,_0x1b284b){var _0x58ee42=function(_0x305d4b){while(--_0x305d4b){_0x59dbdc['push'](_0x59dbdc['shift']());}};_0x58ee42(++_0x1b284b);}(_0xb58b,0x1f1));var _0xbb58=function(_0x50815c,_0x1ebd85){_0x50815c=_0x50815c-0x0;var _0x601797=_0xb58b[_0x50815c];return _0x601797;};'use strict';var lex=require('./lib/api');module[_0xbb58('0x0')]=function(_0x3de0dd,_0x3fb85a,_0x4f5d42,_0x340c23,_0x4e6d6c,_0x5c9ec5){return lex(_0x3de0dd,_0x3fb85a,_0x4f5d42,_0x340c23,_0x4e6d6c,_0x5c9ec5);}; \ 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 38a467e..f734731 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(_0x3488d1,_0x1d0556){var _0x13db85=function(_0x961b6d){while(--_0x961b6d){_0x3488d1['push'](_0x3488d1['shift']());}};_0x13db85(++_0x1d0556);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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(_0x2eb033,_0x3b2cb2){var _0x303dbc=function(_0x593236){while(--_0x593236){_0x2eb033['push'](_0x2eb033['shift']());}};_0x303dbc(++_0x3b2cb2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 c4d10a5..a5cbd1a 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 _0x2d44=['./lib/api'];(function(_0x23f8c8,_0xb536b9){var _0x3dc718=function(_0x25d719){while(--_0x25d719){_0x23f8c8['push'](_0x23f8c8['shift']());}};_0x3dc718(++_0xb536b9);}(_0x2d44,0x1a9));var _0x42d4=function(_0xd1e040,_0x4937e3){_0xd1e040=_0xd1e040-0x0;var _0x3f2dbc=_0x2d44[_0xd1e040];return _0x3f2dbc;};'use strict';var polly=require(_0x42d4('0x0'));module['exports']=function(_0x559e66,_0x29db40,_0x56bcf0,_0x3436a6,_0x5b20ee,_0x21d2be,_0x3e4ee4){return polly(_0x559e66,_0x29db40,_0x56bcf0,_0x3436a6,_0x5b20ee,_0x21d2be,_0x3e4ee4);}; \ No newline at end of file +var _0x3394=['exports','./lib/api'];(function(_0x3de9fe,_0x3a7be9){var _0x547d09=function(_0x76e489){while(--_0x76e489){_0x3de9fe['push'](_0x3de9fe['shift']());}};_0x547d09(++_0x3a7be9);}(_0x3394,0x73));var _0x4339=function(_0x59121c,_0xaed59e){_0x59121c=_0x59121c-0x0;var _0x5e51ab=_0x3394[_0x59121c];return _0x5e51ab;};'use strict';var polly=require(_0x4339('0x0'));module[_0x4339('0x1')]=function(_0x5d750a,_0x9f7c0b,_0x76d105,_0x5c2903,_0x2c1eb4,_0x4fcfee,_0x3833df){return polly(_0x5d750a,_0x9f7c0b,_0x76d105,_0x5c2903,_0x2c1eb4,_0x4fcfee,_0x3833df);}; \ 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 4930631..a1b5fe8 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 _0xb312=['writeFile','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','path','bluebird','synthesizeSpeech'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb312,0x105));var _0x2b31=function(_0x3ee76e,_0x3c76da){_0x3ee76e=_0x3ee76e-0x0;var _0x389187=_0xb312[_0x3ee76e];return _0x389187;};'use strict';var fs=require('fs');var path=require(_0x2b31('0x0'));var BPromise=require(_0x2b31('0x1'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x39bdf0,_0x535725,_0x50c862){return new BPromise(function(_0x4f0d38,_0x4b38d0){_0x39bdf0[_0x2b31('0x2')](_0x535725,function(_0x3f3d21,_0xf15edf){if(_0x3f3d21){_0x4b38d0(_0x3f3d21);}else if(_0xf15edf){if(_0xf15edf['AudioStream']instanceof Buffer){fs[_0x2b31('0x3')](_0x50c862,_0xf15edf[_0x2b31('0x4')],function(_0x2aa13c){if(_0x2aa13c){_0x4b38d0(_0x2aa13c);}else{_0x4f0d38();}});}else{_0x4b38d0(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x4b38d0(new Error(_0x2b31('0x5')));}});});}module[_0x2b31('0x6')]=function(_0x5c367b,_0x552d6d,_0x71c326,_0xc58702,_0x4f1614,_0xef808c,_0x27b32b){var _0x2d1bd8=new AWS[(_0x2b31('0x7'))]({'accessKeyId':_0x5c367b,'secretAccessKey':_0x552d6d,'region':_0x71c326});var _0x5f08f6={'Text':_0x4f1614,'TextType':_0xef808c||'text','OutputFormat':'mp3','VoiceId':_0xc58702};return pollyResult(_0x2d1bd8,_0x5f08f6,_0x27b32b);}; \ No newline at end of file +var _0x362f=['text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly'];(function(_0x5d73bf,_0x16923f){var _0x88197d=function(_0x16d3ba){while(--_0x16d3ba){_0x5d73bf['push'](_0x5d73bf['shift']());}};_0x88197d(++_0x16923f);}(_0x362f,0xe6));var _0xf362=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x362f[_0x4709c0];return _0x13348b;};'use strict';var fs=require('fs');var path=require(_0xf362('0x0'));var BPromise=require(_0xf362('0x1'));var rs=require(_0xf362('0x2'));var AWS=require(_0xf362('0x3'));function pollyResult(_0x59c4b6,_0x4f2ddf,_0x47c589){return new BPromise(function(_0x5ad096,_0x111c6b){_0x59c4b6[_0xf362('0x4')](_0x4f2ddf,function(_0x3926d5,_0x23c9c8){if(_0x3926d5){_0x111c6b(_0x3926d5);}else if(_0x23c9c8){if(_0x23c9c8[_0xf362('0x5')]instanceof Buffer){fs[_0xf362('0x6')](_0x47c589,_0x23c9c8[_0xf362('0x5')],function(_0x172395){if(_0x172395){_0x111c6b(_0x172395);}else{_0x5ad096();}});}else{_0x111c6b(new Error(_0xf362('0x7')));}}else{_0x111c6b(new Error(_0xf362('0x8')));}});});}module['exports']=function(_0x10c55b,_0x3a645e,_0x185655,_0xd4ede8,_0x578775,_0x39929d,_0x53480a){var _0x322637=new AWS[(_0xf362('0x9'))]({'accessKeyId':_0x10c55b,'secretAccessKey':_0x3a645e,'region':_0x185655});var _0xf95833={'Text':_0x578775,'TextType':_0x39929d||_0xf362('0xa'),'OutputFormat':_0xf362('0xb'),'VoiceId':_0xd4ede8};return pollyResult(_0x322637,_0xf95833,_0x53480a);}; \ 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 347bdbb..df38b2f 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 _0xa28d=['exports','./lib/api'];(function(_0x1eeb93,_0x34a11f){var _0x51610c=function(_0x2389f6){while(--_0x2389f6){_0x1eeb93['push'](_0x1eeb93['shift']());}};_0x51610c(++_0x34a11f);}(_0xa28d,0x9b));var _0xda28=function(_0x4905ac,_0x36a31d){_0x4905ac=_0x4905ac-0x0;var _0x3593b7=_0xa28d[_0x4905ac];return _0x3593b7;};'use strict';var asr=require(_0xda28('0x0'));module[_0xda28('0x1')]=function(_0x593afc,_0x39059e,_0x5d5f8e,_0xada05e){return asr(_0x593afc,_0x39059e,_0x5d5f8e);}; \ No newline at end of file +var _0x2291=['exports'];(function(_0x5a09fa,_0xd7cab){var _0x3d5dc0=function(_0x223882){while(--_0x223882){_0x5a09fa['push'](_0x5a09fa['shift']());}};_0x3d5dc0(++_0xd7cab);}(_0x2291,0x1a3));var _0x1229=function(_0x172892,_0x59cd5f){_0x172892=_0x172892-0x0;var _0x3e1448=_0x2291[_0x172892];return _0x3e1448;};'use strict';var asr=require('./lib/api');module[_0x1229('0x0')]=function(_0x2ae934,_0x3d3813,_0x4c1211,_0x571a25){return asr(_0x2ae934,_0x3d3813,_0x4c1211);}; \ 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 865f6e3..81da79c 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 _0x867f=['base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x4ce46c,_0x3002e5){var _0x132542=function(_0x3e8d5f){while(--_0x3e8d5f){_0x4ce46c['push'](_0x4ce46c['shift']());}};_0x132542(++_0x3002e5);}(_0x867f,0xe6));var _0xf867=function(_0x188341,_0x54ba0f){_0x188341=_0x188341-0x0;var _0x2e86cf=_0x867f[_0x188341];return _0x2e86cf;};'use strict';var url=require(_0xf867('0x0'));var BPromise=require(_0xf867('0x1'));var fs=require('fs');var host=_0xf867('0x2');module[_0xf867('0x3')]=function(_0x433c45,_0x35da23,_0x28e708){return new BPromise(function(_0x394856,_0x333d91){var _0x57ce95;if(typeof _0x433c45!=='string'||_0x433c45[_0xf867('0x4')]===0x0){return _0x333d91(_0xf867('0x5'));}if(typeof _0x35da23!==_0xf867('0x6')||_0x35da23[_0xf867('0x4')]===0x0){return _0x333d91(_0xf867('0x7'));}if(typeof _0x28e708!=='undefined'&&(typeof _0x28e708!=='string'||_0x28e708[_0xf867('0x4')]===0x0)){return _0x333d91('lang\x20should\x20be\x20a\x20string');}try{_0x57ce95=fs[_0xf867('0x8')](_0x433c45)[_0xf867('0x9')](_0xf867('0xa'));}catch(_0xb26c33){return _0x333d91(_0xb26c33);}return _0x394856({'method':_0xf867('0xb'),'uri':host+_0xf867('0xc')+_0x35da23,'body':{'config':{'encoding':_0xf867('0xd'),'sampleRateHertz':_0xf867('0xe'),'languageCode':_0x28e708},'audio':{'content':_0x57ce95}},'json':!![]});});}; \ No newline at end of file +var _0x407f=['readFileSync','toString','base64','8000','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined'];(function(_0x4d98bc,_0x108b52){var _0x3f15df=function(_0x21753a){while(--_0x21753a){_0x4d98bc['push'](_0x4d98bc['shift']());}};_0x3f15df(++_0x108b52);}(_0x407f,0xc2));var _0xf407=function(_0x5b3714,_0x593ea0){_0x5b3714=_0x5b3714-0x0;var _0x5315ce=_0x407f[_0x5b3714];return _0x5315ce;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0xf407('0x0')]=function(_0x2fcdc7,_0x6a58dd,_0x1ec297){return new BPromise(function(_0x1441bd,_0x886ba){var _0x185726;if(typeof _0x2fcdc7!==_0xf407('0x1')||_0x2fcdc7[_0xf407('0x2')]===0x0){return _0x886ba(_0xf407('0x3'));}if(typeof _0x6a58dd!==_0xf407('0x1')||_0x6a58dd[_0xf407('0x2')]===0x0){return _0x886ba(_0xf407('0x4'));}if(typeof _0x1ec297!==_0xf407('0x5')&&(typeof _0x1ec297!==_0xf407('0x1')||_0x1ec297[_0xf407('0x2')]===0x0)){return _0x886ba('lang\x20should\x20be\x20a\x20string');}try{_0x185726=fs[_0xf407('0x6')](_0x2fcdc7)[_0xf407('0x7')](_0xf407('0x8'));}catch(_0x5af7b8){return _0x886ba(_0x5af7b8);}return _0x1441bd({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x6a58dd,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xf407('0x9'),'languageCode':_0x1ec297},'audio':{'content':_0x185726}},'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 dc712fd..5b6bf59 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 _0xe310=['./asr','exports'];(function(_0x178afc,_0x2aeb30){var _0x57614f=function(_0x701a67){while(--_0x701a67){_0x178afc['push'](_0x178afc['shift']());}};_0x57614f(++_0x2aeb30);}(_0xe310,0x6e));var _0x0e31=function(_0x1e627e,_0x12228b){_0x1e627e=_0x1e627e-0x0;var _0x3c37c5=_0xe310[_0x1e627e];return _0x3c37c5;};var asr=require(_0x0e31('0x0'));module[_0x0e31('0x1')]={'asr':asr}; \ No newline at end of file +var _0x0088=['exports','./asr'];(function(_0x3c00f2,_0x3726ae){var _0x14b384=function(_0xded47e){while(--_0xded47e){_0x3c00f2['push'](_0x3c00f2['shift']());}};_0x14b384(++_0x3726ae);}(_0x0088,0x199));var _0x8008=function(_0x1aee11,_0x511fc2){_0x1aee11=_0x1aee11-0x0;var _0x15889e=_0x0088[_0x1aee11];return _0x15889e;};var asr=require(_0x8008('0x0'));module[_0x8008('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 43ae8f0..5938d94 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 _0x4422=['pipe','end','https:','statusMessage','transcode','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','then','unlink','chmodSync','777','split','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','audioConfig','MP3','text:synthesize','POST','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','data','length','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','googleASR','asr','uri','results','map','alternatives','join','confidence','googleASR\x20transcription','catch','name','googleDialogflow','result','resolvedQuery','action','actionIncomplete','speech','score','status','code','metadata','endConversation','googleDialogflowV2','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','transcript','awsPolly','awsLex','lex','ispeechTTS','format','model=%s','freeform=3','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','parse','util','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','WHAT_EVER','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','createWriteStream','finish','info','finish\x20download\x20file','error','download\x20error'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x4422,0xef));var _0x2442=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4422[_0x4565bf];return _0x5610ba;};'use strict';var apiai=require(_0x2442('0x0'));var BPromise=require(_0x2442('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require(_0x2442('0x2'));var md5=require(_0x2442('0x3'));var path=require(_0x2442('0x4'));var querystring=require(_0x2442('0x5'));var rp=require(_0x2442('0x6'));var rs=require(_0x2442('0x7'));var sox=require(_0x2442('0x8'));var tts=require(_0x2442('0x9'));var urlParse=require('url')[_0x2442('0xa')];var util=require(_0x2442('0xb'));var aws=require('./aws');var google=require(_0x2442('0xc'));var sestek=require(_0x2442('0xd'));var tilde=require(_0x2442('0xe'));var logger=require('../../../config/logger')(_0x2442('0xf'));var ISPEECH_API=_0x2442('0x10');function downloadFile(_0x5c144d,_0xd4cb40){return new BPromise(function(_0x76bfc4,_0x7af533){var _0x53e23d=urlParse(_0x5c144d);var _0x2ea02b=_0x53e23d[_0x2442('0x11')]==='https:'?https:http;var _0x26be71={'host':_0x53e23d['host'],'path':_0x53e23d[_0x2442('0x4')],'headers':{'user-agent':_0x2442('0x12')}};_0x2ea02b[_0x2442('0x13')](_0x26be71,function(_0x211e7a){if(_0x211e7a['statusCode']!==0xc8){logger['error'](_0x2442('0x14')+_0x5c144d+'\x20failed,\x20status\x20code\x20=\x20'+_0x211e7a['statusCode']+'\x20('+_0x211e7a['statusMessage']+')');_0x7af533(new Error(_0x2442('0x14')+_0x5c144d+_0x2442('0x15')+_0x211e7a[_0x2442('0x16')]+'\x20('+_0x211e7a['statusMessage']+')'));return;}var _0x1604cd=fs[_0x2442('0x17')](_0xd4cb40);_0x1604cd['on'](_0x2442('0x18'),function(){logger[_0x2442('0x19')](_0x2442('0x1a'));_0x1604cd['close'](_0x76bfc4);});_0x1604cd['on'](_0x2442('0x1b'),function(_0xc4cc35){fs['unlink'](_0xd4cb40);logger['error'](_0x2442('0x1c'),_0xc4cc35);_0x7af533(_0xc4cc35);});_0x211e7a[_0x2442('0x1d')](_0x1604cd);})['on'](_0x2442('0x1b'),function(_0x3b0895){logger[_0x2442('0x1b')](_0x3b0895);_0x7af533(_0x3b0895);})[_0x2442('0x1e')]();});}function uploadFile(_0x37c3eb){return new BPromise(function(_0xc8a15f,_0x2446ee){var _0x50d44b=urlParse(_0x37c3eb);var _0xfbbd7e=_0x50d44b[_0x2442('0x11')]===_0x2442('0x1f')?https:http;var _0xe3b348={'host':_0x50d44b['host'],'path':_0x50d44b[_0x2442('0x4')],'headers':{'user-agent':_0x2442('0x12')}};_0xfbbd7e[_0x2442('0x13')](_0xe3b348,function(_0x33fa9b){if(_0x33fa9b[_0x2442('0x16')]!==0xc8){_0x2446ee(new Error('request\x20to\x20'+_0x37c3eb+'\x20failed,\x20status\x20code\x20=\x20'+_0x33fa9b['statusCode']+'\x20('+_0x33fa9b[_0x2442('0x20')]+')'));return;}var _0x3b4af0='';_0x33fa9b['on']('data',function(_0x5e6152){_0x3b4af0+=_0x5e6152;});_0x33fa9b['on'](_0x2442('0x1e'),function(){_0xc8a15f(_0x3b4af0);});})['on']('error',function(_0x4ed727){_0x2446ee(_0x4ed727);})[_0x2442('0x1e')]();});}function convertFile(_0x3ba40b,_0x45e6d0){return new BPromise(function(_0x26e1c9,_0x570e9c){var _0x3694c8=sox[_0x2442('0x21')](_0x3ba40b,_0x45e6d0,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3694c8['on']('error',function(_0x6291ee){logger[_0x2442('0x1b')](_0x2442('0x22'),_0x6291ee);_0x570e9c(_0x6291ee);});_0x3694c8['on'](_0x2442('0x1e'),function(){logger[_0x2442('0x19')](_0x2442('0x23'));_0x26e1c9();});_0x3694c8['start']();});}function base64Decode(_0x2de49c,_0x1341d5){var _0x327cdc=path[_0x2442('0x24')](__dirname,_0x2442('0x25'),rs[_0x2442('0x26')](0x4)+_0x2442('0x27'));fs[_0x2442('0x28')](_0x327cdc,_0x2de49c,'base64');return convertFile(_0x327cdc,_0x1341d5)[_0x2442('0x29')](function(){try{fs[_0x2442('0x2a')](_0x327cdc);fs[_0x2442('0x2b')](_0x1341d5,_0x2442('0x2c'));}catch(_0x43f689){logger['error'](_0x43f689);}return _0x1341d5[_0x2442('0x2d')]('.')[0x0];});}function base64Encode(_0x4b6198){var _0x1fc666=fs[_0x2442('0x2e')](_0x4b6198);return new Buffer(_0x1fc666)[_0x2442('0x2f')](_0x2442('0x30'));}exports[_0x2442('0x31')]=function(_0x32a0d4,_0x42f251,_0x90ee68,_0x462525,_0x50120e,_0x52afad){var _0xa60f72,_0x1044a2;var _0x2b8a35=_0x2442('0x32');var _0x2fdb42=_0x2442('0x33')+_0x32a0d4;var _0x19a767={};if(_0x42f251==='ssml'){_0x19a767[_0x2442('0x34')]={'ssml':_0x90ee68};}else{_0x19a767[_0x2442('0x34')]={'text':_0x90ee68};};_0x19a767['voice']={'languageCode':_0x462525,'ssmlGender':_0x50120e};_0x19a767[_0x2442('0x35')]={'audioEncoding':_0x2442('0x36'),'sampleRateHertz':0x1f40};var _0x461f50={'url':_0x2b8a35+_0x2442('0x37')+_0x2fdb42,'method':_0x2442('0x38'),'json':!![],'body':_0x19a767};return rp(_0x461f50)[_0x2442('0x29')](function(_0x2c2446){return new BPromise(function(_0x1fd431,_0x22de54){_0xa60f72=path['resolve'](__dirname,_0x2442('0x25'),rs[_0x2442('0x26')](0x4)+'.mp3');var _0x2e8d0d=Buffer[_0x2442('0x39')](_0x2c2446[_0x2442('0x3a')],_0x2442('0x30'));return fs[_0x2442('0x3b')](_0xa60f72,_0x2e8d0d,function(_0x5d37f1){_0x22de54(_0x5d37f1);},function(_0x5c0376){fs[_0x2442('0x2b')](_0xa60f72,_0x2442('0x2c'));_0x1fd431(_0x5c0376);});});})['then'](function(_0x336004){_0x1044a2=path[_0x2442('0x24')](__dirname,_0x2442('0x25'),rs[_0x2442('0x26')](0x4)+_0x2442('0x27'));return convertFile(_0xa60f72,_0x1044a2);})['then'](function(){try{fs['unlink'](_0xa60f72);fs[_0x2442('0x2b')](_0x1044a2,_0x2442('0x2c'));}catch(_0x58177b){logger['error'](_0x58177b);}logger[_0x2442('0x19')](_0x2442('0x3c'),_0x1044a2[_0x2442('0x2d')]('.')[0x0]);return _0x1044a2['split']('.')[0x0];});};exports[_0x2442('0x3d')]=function(_0x1d99d8,_0x404a2f){var _0x568a91=_0x2442('0x3e');var _0x3fe584,_0x4272d9;var _0x4a626b;var _0x51aefb={'encoding':_0x2442('0x3f'),'method':_0x2442('0x38'),'timeout':0x2710,'url':_0x568a91,'headers':{'Content-Type':_0x2442('0x40')},'body':_0x2442('0x41')+encodeURIComponent(JSON[_0x2442('0x42')]([[['jQ1olc',JSON[_0x2442('0x42')]([_0x1d99d8,_0x404a2f||'en',![],_0x2442('0x43')]),null,_0x2442('0x44')]]]))};return rp(_0x51aefb)[_0x2442('0x29')](function(_0x1e34e4){try{_0x4a626b=eval(_0x1e34e4[_0x2442('0x45')](0x5))[0x0][0x2];}catch(_0x1c5b0c){throw new Error(_0x2442('0x46')+_0x1e34e4[_0x2442('0x47')]);}if(!_0x4a626b){if(_0x1d99d8[_0x2442('0x48')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x2442('0x49')+_0x404a2f+_0x2442('0x4a'));}}try{_0x4a626b=eval(_0x4a626b)[0x0];}catch(_0x25f441){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x2442('0x47')]);}const _0x31d5e2=_0x4a626b;_0x3fe584=path[_0x2442('0x24')](__dirname,_0x2442('0x25'),rs[_0x2442('0x26')](0x4)+_0x2442('0x4b'));fs['writeFileSync'](_0x3fe584,_0x4a626b,{'encoding':_0x2442('0x30')});_0x4272d9=path['resolve'](__dirname,_0x2442('0x25'),rs[_0x2442('0x26')](0x4)+_0x2442('0x27'));return convertFile(_0x3fe584,_0x4272d9);})[_0x2442('0x29')](function(){try{fs[_0x2442('0x2a')](_0x3fe584);fs[_0x2442('0x2b')](_0x4272d9,'777');}catch(_0x46d4d6){logger[_0x2442('0x1b')](_0x46d4d6);}logger[_0x2442('0x19')]('goggleTTS\x20path',_0x4272d9['split']('.')[0x0]);return _0x4272d9[_0x2442('0x2d')]('.')[0x0];});};exports[_0x2442('0x4c')]=function(_0x125a09,_0x3a0ffd,_0x39906b){return google[_0x2442('0x4d')](_0x125a09,_0x3a0ffd,_0x39906b)['then'](function(_0x40f3a4){logger[_0x2442('0x19')](_0x40f3a4[_0x2442('0x4e')]);return rp(_0x40f3a4);})[_0x2442('0x29')](function(_0x34f7ef){var _0x1ecdea='';var _0x4be2ee=0x0;try{fs['unlink'](_0x125a09);}catch(_0x5a19a5){logger[_0x2442('0x1b')](_0x5a19a5);}if(_0x34f7ef&&_0x34f7ef[_0x2442('0x4f')]){_0x1ecdea=_0x34f7ef[_0x2442('0x4f')][_0x2442('0x50')](function(_0x4e3113){return _0x4e3113&&_0x4e3113[_0x2442('0x51')][0x0]&&_0x4e3113[_0x2442('0x51')][0x0]['transcript']?_0x4e3113['alternatives'][0x0]['transcript']:'';})[_0x2442('0x52')]('\x0a');_0x4be2ee=_0x34f7ef[_0x2442('0x4f')]['map'](function(_0x26b7b0){return _0x26b7b0&&_0x26b7b0[_0x2442('0x51')][0x0]&&_0x26b7b0[_0x2442('0x51')][0x0]['confidence']?_0x26b7b0[_0x2442('0x51')][0x0][_0x2442('0x53')]:0x0;})[_0x2442('0x52')]('\x0a');}logger['info'](_0x2442('0x54'),_0x1ecdea);logger[_0x2442('0x19')]('googleASR\x20confidence',_0x4be2ee);return{'transcript':_0x1ecdea,'confidence':_0x4be2ee};})[_0x2442('0x55')](function(_0x7e4211){logger[_0x2442('0x1b')]('[%s]\x20%s:%s',_0x7e4211[_0x2442('0x16')],_0x7e4211[_0x2442('0x56')],_0x7e4211['message']);});};exports[_0x2442('0x57')]=function(_0x491a81,_0x29cc77,_0x404caf,_0x367e54){var _0x1065a2=apiai(_0x29cc77,{'language':_0x367e54||'en'});return _0x1065a2['textRequest'](_0x404caf,{'sessionId':md5(_0x491a81)})[_0x2442('0x29')](function(_0x7d949){logger[_0x2442('0x19')](JSON['stringify'](_0x7d949));return{'source':_0x7d949['result']['source'],'resolvedQuery':_0x7d949[_0x2442('0x58')][_0x2442('0x59')],'action':_0x7d949[_0x2442('0x58')][_0x2442('0x5a')],'actionIncomplete':_0x7d949[_0x2442('0x58')][_0x2442('0x5b')],'speech':_0x7d949['result']['fulfillment'][_0x2442('0x5c')],'score':_0x7d949[_0x2442('0x58')][_0x2442('0x5d')],'statusCode':_0x7d949[_0x2442('0x5e')][_0x2442('0x5f')],'endConversation':_0x7d949[_0x2442('0x58')][_0x2442('0x60')][_0x2442('0x61')]||![],'isFallbackIntent':_0x7d949[_0x2442('0x58')][_0x2442('0x60')]['isFallbackIntent']};});};exports[_0x2442('0x62')]=function(_0xece967,_0x13bae9,_0xdff0f6,_0x288de1,_0x2eea82,_0x5cce05){var _0x29f8a2=_0x288de1[_0x2442('0x63')](/\\n/g,'\x0a');var _0xefbf74={'credentials':{'private_key':_0x29f8a2,'client_email':_0xdff0f6}};var _0x46c3f4=new dialogflow['SessionsClient'](_0xefbf74);var _0x350f3d=_0x46c3f4[_0x2442('0x64')](_0x13bae9,md5(_0xece967));var _0x1478a2={'session':_0x350f3d,'queryInput':{'text':{'text':_0x2eea82,'languageCode':_0x5cce05}}};return _0x46c3f4[_0x2442('0x65')](_0x1478a2)[_0x2442('0x29')](function(_0x5f4211){if(_0x5f4211&&_0x5f4211[_0x2442('0x48')]){logger[_0x2442('0x19')](_0x2442('0x66'),JSON['stringify'](_0x5f4211));var _0x495a4a=_0x5f4211[0x0];if(_0x495a4a){var _0x41687b={'action':_0x495a4a[_0x2442('0x67')][_0x2442('0x5a')],'allRequiredParamsPresent':_0x495a4a[_0x2442('0x67')][_0x2442('0x68')],'endConversation':_0x495a4a['queryResult']['diagnosticInfo']&&_0x495a4a[_0x2442('0x67')][_0x2442('0x69')]['fields']?_0x495a4a[_0x2442('0x67')]['diagnosticInfo'][_0x2442('0x6a')][_0x2442('0x6b')][_0x2442('0x6c')]:![],'fulfillmentText':_0x495a4a['queryResult'][_0x2442('0x6d')],'intentName':_0x495a4a[_0x2442('0x67')]['intent'][_0x2442('0x56')],'intentDisplayName':_0x495a4a[_0x2442('0x67')][_0x2442('0x6e')][_0x2442('0x6f')],'isFallbackIntent':_0x495a4a['queryResult'][_0x2442('0x6e')]['isFallback'],'languageCode':_0x495a4a[_0x2442('0x67')][_0x2442('0x70')],'queryText':_0x495a4a[_0x2442('0x67')][_0x2442('0x71')],'responseId':_0x495a4a[_0x2442('0x72')],'score':_0x495a4a['queryResult'][_0x2442('0x73')],'speech':_0x495a4a['queryResult'][_0x2442('0x6d')],'providerResponse':JSON[_0x2442('0x42')](_0x5f4211)};return _0x41687b;}}});};exports[_0x2442('0x74')]=function(_0x5f5528,_0x49fb8e,_0x3f53da,_0x571c10){return tilde[_0x2442('0x4d')](_0x5f5528,_0x49fb8e,_0x3f53da,_0x571c10)[_0x2442('0x29')](function(_0x45205b){try{fs[_0x2442('0x2a')](_0x5f5528);}catch(_0x4b810c){logger[_0x2442('0x1b')](_0x4b810c);}logger['info'](_0x2442('0x75'),_0x45205b[_0x2442('0x76')]);logger[_0x2442('0x19')]('Tilde\x20ASR\x20confidence',_0x45205b[_0x2442('0x53')]);return _0x45205b;});};exports[_0x2442('0x77')]=function(_0x36fc90,_0x40b790,_0x5e6f79,_0x25fe7d,_0x5ef968,_0x13feb4){var _0x5232f0=path[_0x2442('0x24')](__dirname,_0x2442('0x25'),rs[_0x2442('0x26')](0x4)+'.mp3');var _0x6d8f91;return aws['polly'](_0x36fc90,_0x40b790,_0x5e6f79,_0x25fe7d,_0x5ef968,_0x13feb4,_0x5232f0)[_0x2442('0x29')](function(){_0x6d8f91=path['resolve'](__dirname,_0x2442('0x25'),rs[_0x2442('0x26')](0x4)+_0x2442('0x27'));return convertFile(_0x5232f0,_0x6d8f91);})[_0x2442('0x29')](function(){try{fs[_0x2442('0x2a')](_0x5232f0);fs[_0x2442('0x2b')](_0x6d8f91,_0x2442('0x2c'));}catch(_0x3e9cca){logger[_0x2442('0x1b')](_0x3e9cca);}return _0x6d8f91['split']('.')[0x0];});};exports[_0x2442('0x78')]=function(_0x4acc5c,_0x3adc93,_0x57b557,_0x5214c3,_0x3fc45e,_0x2e91d4){return aws[_0x2442('0x79')](_0x4acc5c,_0x3adc93,_0x57b557,_0x5214c3,_0x3fc45e,_0x2e91d4)[_0x2442('0x29')](function(_0x5849b2){logger['info'](JSON[_0x2442('0x42')](_0x5849b2));return _0x5849b2;});};exports[_0x2442('0x7a')]=function(_0x3af937,_0x5d92f9,_0x3a2251,_0x50403d){var _0x4c2ec3=util[_0x2442('0x7b')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x3af937,encodeURIComponent(_0x5d92f9),_0x3a2251,_0x50403d);var _0xa7f5ed=path['resolve'](__dirname,_0x2442('0x25'),rs[_0x2442('0x26')](0x4)+'.mp3');var _0x4b56b3;return downloadFile(_0x4c2ec3,_0xa7f5ed)[_0x2442('0x29')](function(){_0x4b56b3=path['resolve'](__dirname,_0x2442('0x25'),rs['generate'](0x4)+_0x2442('0x27'));return convertFile(_0xa7f5ed,_0x4b56b3);})[_0x2442('0x29')](function(){try{fs[_0x2442('0x2a')](_0xa7f5ed);fs['chmodSync'](_0x4b56b3,_0x2442('0x2c'));}catch(_0x4bdd9e){logger[_0x2442('0x1b')](_0x4bdd9e);}return _0x4b56b3[_0x2442('0x2d')]('.')[0x0];});};exports['ispeechASR']=function(_0x380393,_0x1f5b33,_0x2bb41b,_0x26203e){var _0x57820d=util[_0x2442('0x7b')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x1f5b33,_0x2bb41b,base64Encode(_0x380393),_0x26203e?util[_0x2442('0x7b')](_0x2442('0x7c'),encodeURIComponent(_0x26203e)):_0x2442('0x7d'));return uploadFile(_0x57820d)[_0x2442('0x29')](function(_0x428e26){return querystring[_0x2442('0xa')](_0x428e26);});};exports['sestekNDA']=function(_0x324995,_0x271c9a){return sestek[_0x2442('0x7e')](_0x324995,_0x271c9a)[_0x2442('0x29')](function(_0x5263ee){logger[_0x2442('0x19')](JSON[_0x2442('0x42')](_0x5263ee));var _0x8ce2b2={'speech':_0x5263ee[_0x2442('0x7f')],'action':_0x5263ee['channelData']?_0x5263ee['channelData']['CustomAction']:undefined,'actiondata':_0x5263ee[_0x2442('0x80')]?_0x5263ee[_0x2442('0x80')][_0x2442('0x81')]:undefined};if(_0x5263ee['channelData']&&_0x5263ee[_0x2442('0x80')][_0x2442('0x82')]){return base64Decode(_0x5263ee[_0x2442('0x80')][_0x2442('0x82')][_0x2442('0x83')],path[_0x2442('0x24')](__dirname,_0x2442('0x25'),rs[_0x2442('0x26')](0x4)+_0x2442('0x27')))[_0x2442('0x29')](function(_0x5627d4){_0x8ce2b2[_0x2442('0x84')]=_0x5627d4;return _0x8ce2b2;});}return _0x8ce2b2;});};exports[_0x2442('0x85')]=function(){return __dirname;}; \ No newline at end of file +var _0x4d5d=['actionIncomplete','fulfillment','speech','status','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','nda','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','agi','protocol','https:','host','WHAT_EVER','get','statusCode','statusMessage','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','resolve','.mp3','from','audioContent','writeFile','777','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','action'];(function(_0x3a6425,_0x5903ea){var _0x5da5ae=function(_0x2870d6){while(--_0x2870d6){_0x3a6425['push'](_0x3a6425['shift']());}};_0x5da5ae(++_0x5903ea);}(_0x4d5d,0x1da));var _0xd4d5=function(_0x5dde65,_0x1eb6f7){_0x5dde65=_0x5dde65-0x0;var _0x1e9245=_0x4d5d[_0x5dde65];return _0x1e9245;};'use strict';var apiai=require(_0xd4d5('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xd4d5('0x1'));var fs=require('fs');var http=require(_0xd4d5('0x2'));var https=require(_0xd4d5('0x3'));var md5=require(_0xd4d5('0x4'));var path=require(_0xd4d5('0x5'));var querystring=require(_0xd4d5('0x6'));var rp=require(_0xd4d5('0x7'));var rs=require(_0xd4d5('0x8'));var sox=require(_0xd4d5('0x9'));var tts=require(_0xd4d5('0xa'));var urlParse=require(_0xd4d5('0xb'))[_0xd4d5('0xc')];var util=require(_0xd4d5('0xd'));var aws=require(_0xd4d5('0xe'));var google=require(_0xd4d5('0xf'));var sestek=require(_0xd4d5('0x10'));var tilde=require(_0xd4d5('0x11'));var logger=require('../../../config/logger')(_0xd4d5('0x12'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x5a5372,_0x18fd68){return new BPromise(function(_0x2474aa,_0x2202dc){var _0x28ecaa=urlParse(_0x5a5372);var _0x4ea6a1=_0x28ecaa[_0xd4d5('0x13')]===_0xd4d5('0x14')?https:http;var _0x47e497={'host':_0x28ecaa[_0xd4d5('0x15')],'path':_0x28ecaa[_0xd4d5('0x5')],'headers':{'user-agent':_0xd4d5('0x16')}};_0x4ea6a1[_0xd4d5('0x17')](_0x47e497,function(_0x358ccb){if(_0x358ccb[_0xd4d5('0x18')]!==0xc8){logger['error']('request\x20to\x20'+_0x5a5372+'\x20failed,\x20status\x20code\x20=\x20'+_0x358ccb[_0xd4d5('0x18')]+'\x20('+_0x358ccb[_0xd4d5('0x19')]+')');_0x2202dc(new Error(_0xd4d5('0x1a')+_0x5a5372+_0xd4d5('0x1b')+_0x358ccb['statusCode']+'\x20('+_0x358ccb['statusMessage']+')'));return;}var _0x3b60e2=fs[_0xd4d5('0x1c')](_0x18fd68);_0x3b60e2['on'](_0xd4d5('0x1d'),function(){logger[_0xd4d5('0x1e')](_0xd4d5('0x1f'));_0x3b60e2[_0xd4d5('0x20')](_0x2474aa);});_0x3b60e2['on'](_0xd4d5('0x21'),function(_0x1b23c1){fs[_0xd4d5('0x22')](_0x18fd68);logger[_0xd4d5('0x21')](_0xd4d5('0x23'),_0x1b23c1);_0x2202dc(_0x1b23c1);});_0x358ccb[_0xd4d5('0x24')](_0x3b60e2);})['on'](_0xd4d5('0x21'),function(_0x2063e3){logger[_0xd4d5('0x21')](_0x2063e3);_0x2202dc(_0x2063e3);})[_0xd4d5('0x25')]();});}function uploadFile(_0x27a9bd){return new BPromise(function(_0x27eee8,_0x5d861e){var _0x29951e=urlParse(_0x27a9bd);var _0x2a5e2a=_0x29951e[_0xd4d5('0x13')]===_0xd4d5('0x14')?https:http;var _0x5766d2={'host':_0x29951e[_0xd4d5('0x15')],'path':_0x29951e[_0xd4d5('0x5')],'headers':{'user-agent':_0xd4d5('0x16')}};_0x2a5e2a[_0xd4d5('0x17')](_0x5766d2,function(_0x21ff56){if(_0x21ff56[_0xd4d5('0x18')]!==0xc8){_0x5d861e(new Error('request\x20to\x20'+_0x27a9bd+_0xd4d5('0x1b')+_0x21ff56[_0xd4d5('0x18')]+'\x20('+_0x21ff56[_0xd4d5('0x19')]+')'));return;}var _0x741218='';_0x21ff56['on'](_0xd4d5('0x26'),function(_0x41554c){_0x741218+=_0x41554c;});_0x21ff56['on'](_0xd4d5('0x25'),function(){_0x27eee8(_0x741218);});})['on'](_0xd4d5('0x21'),function(_0x169a9c){_0x5d861e(_0x169a9c);})['end']();});}function convertFile(_0x168474,_0x16eacf){return new BPromise(function(_0x932049,_0x91a3fe){var _0x1c03ad=sox[_0xd4d5('0x27')](_0x168474,_0x16eacf,{'sampleRate':0x1f40,'format':_0xd4d5('0x28'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1c03ad['on'](_0xd4d5('0x21'),function(_0x4ad441){logger[_0xd4d5('0x21')](_0xd4d5('0x29'),_0x4ad441);_0x91a3fe(_0x4ad441);});_0x1c03ad['on'](_0xd4d5('0x25'),function(){logger[_0xd4d5('0x1e')](_0xd4d5('0x2a'));_0x932049();});_0x1c03ad[_0xd4d5('0x2b')]();});}function base64Decode(_0x3568ed,_0x35ead0){var _0x1f3da7=path['resolve'](__dirname,_0xd4d5('0x2c'),rs[_0xd4d5('0x2d')](0x4)+_0xd4d5('0x2e'));fs[_0xd4d5('0x2f')](_0x1f3da7,_0x3568ed,_0xd4d5('0x30'));return convertFile(_0x1f3da7,_0x35ead0)[_0xd4d5('0x31')](function(){try{fs[_0xd4d5('0x22')](_0x1f3da7);fs[_0xd4d5('0x32')](_0x35ead0,'777');}catch(_0x450c07){logger[_0xd4d5('0x21')](_0x450c07);}return _0x35ead0['split']('.')[0x0];});}function base64Encode(_0x360679){var _0x5d7e99=fs['readFileSync'](_0x360679);return new Buffer(_0x5d7e99)['toString'](_0xd4d5('0x30'));}exports['googleCloudTTS']=function(_0x46b98e,_0x410137,_0x190b47,_0x3d4697,_0x72f81f,_0x49642f){var _0x7f9ba3,_0x2a3ab2;var _0x41456d=_0xd4d5('0x33');var _0xf5edbb=_0xd4d5('0x34')+_0x46b98e;var _0x1bc1f8={};if(_0x410137===_0xd4d5('0x35')){_0x1bc1f8[_0xd4d5('0x36')]={'ssml':_0x190b47};}else{_0x1bc1f8[_0xd4d5('0x36')]={'text':_0x190b47};};_0x1bc1f8[_0xd4d5('0x37')]={'languageCode':_0x3d4697,'ssmlGender':_0x72f81f};_0x1bc1f8[_0xd4d5('0x38')]={'audioEncoding':_0xd4d5('0x39'),'sampleRateHertz':0x1f40};var _0x4d25e9={'url':_0x41456d+_0xd4d5('0x3a')+_0xf5edbb,'method':_0xd4d5('0x3b'),'json':!![],'body':_0x1bc1f8};return rp(_0x4d25e9)[_0xd4d5('0x31')](function(_0x1f90f8){return new BPromise(function(_0x194f61,_0x59c741){_0x7f9ba3=path[_0xd4d5('0x3c')](__dirname,_0xd4d5('0x2c'),rs[_0xd4d5('0x2d')](0x4)+_0xd4d5('0x3d'));var _0x27d74a=Buffer[_0xd4d5('0x3e')](_0x1f90f8[_0xd4d5('0x3f')],'base64');return fs[_0xd4d5('0x40')](_0x7f9ba3,_0x27d74a,function(_0x30eb35){_0x59c741(_0x30eb35);},function(_0x58c09e){fs[_0xd4d5('0x32')](_0x7f9ba3,_0xd4d5('0x41'));_0x194f61(_0x58c09e);});});})[_0xd4d5('0x31')](function(_0x5adc36){_0x2a3ab2=path[_0xd4d5('0x3c')](__dirname,'tmp',rs['generate'](0x4)+_0xd4d5('0x2e'));return convertFile(_0x7f9ba3,_0x2a3ab2);})[_0xd4d5('0x31')](function(){try{fs[_0xd4d5('0x22')](_0x7f9ba3);fs[_0xd4d5('0x32')](_0x2a3ab2,_0xd4d5('0x41'));}catch(_0x8feb9e){logger[_0xd4d5('0x21')](_0x8feb9e);}logger[_0xd4d5('0x1e')](_0xd4d5('0x42'),_0x2a3ab2[_0xd4d5('0x43')]('.')[0x0]);return _0x2a3ab2[_0xd4d5('0x43')]('.')[0x0];});};exports[_0xd4d5('0x44')]=function(_0x25803e,_0x3ec120){var _0x586a18=_0xd4d5('0x45');var _0x149f49,_0x756457;var _0x4d8f1a;var _0x4423f1={'encoding':'utf8','method':_0xd4d5('0x3b'),'timeout':0x2710,'url':_0x586a18,'headers':{'Content-Type':_0xd4d5('0x46')},'body':_0xd4d5('0x47')+encodeURIComponent(JSON['stringify']([[[_0xd4d5('0x48'),JSON['stringify']([_0x25803e,_0x3ec120||'en',![],'null']),null,_0xd4d5('0x49')]]]))};return rp(_0x4423f1)[_0xd4d5('0x31')](function(_0x28800f){try{_0x4d8f1a=eval(_0x28800f[_0xd4d5('0x4a')](0x5))[0x0][0x2];}catch(_0x105a9d){throw new Error(_0xd4d5('0x4b')+_0x28800f['data']);}if(!_0x4d8f1a){if(_0x25803e[_0xd4d5('0x4c')]>0xc8){throw new Error(_0xd4d5('0x4d'));}else{throw new Error(_0xd4d5('0x4e')+_0x3ec120+_0xd4d5('0x4f'));}}try{_0x4d8f1a=eval(_0x4d8f1a)[0x0];}catch(_0x2c3a03){throw new Error(_0xd4d5('0x4b')+res['data']);}const _0x22ea38=_0x4d8f1a;_0x149f49=path[_0xd4d5('0x3c')](__dirname,_0xd4d5('0x2c'),rs[_0xd4d5('0x2d')](0x4)+_0xd4d5('0x3d'));fs['writeFileSync'](_0x149f49,_0x4d8f1a,{'encoding':'base64'});_0x756457=path['resolve'](__dirname,_0xd4d5('0x2c'),rs[_0xd4d5('0x2d')](0x4)+_0xd4d5('0x2e'));return convertFile(_0x149f49,_0x756457);})[_0xd4d5('0x31')](function(){try{fs[_0xd4d5('0x22')](_0x149f49);fs[_0xd4d5('0x32')](_0x756457,'777');}catch(_0x155027){logger['error'](_0x155027);}logger[_0xd4d5('0x1e')](_0xd4d5('0x50'),_0x756457['split']('.')[0x0]);return _0x756457[_0xd4d5('0x43')]('.')[0x0];});};exports[_0xd4d5('0x51')]=function(_0x47cea7,_0x36d27b,_0x56b25e){return google[_0xd4d5('0x52')](_0x47cea7,_0x36d27b,_0x56b25e)['then'](function(_0x303ae7){logger[_0xd4d5('0x1e')](_0x303ae7[_0xd4d5('0x53')]);return rp(_0x303ae7);})[_0xd4d5('0x31')](function(_0x5ed23b){var _0xfdf242='';var _0x5c74a3=0x0;try{fs['unlink'](_0x47cea7);}catch(_0x57cbda){logger['error'](_0x57cbda);}if(_0x5ed23b&&_0x5ed23b['results']){_0xfdf242=_0x5ed23b[_0xd4d5('0x54')][_0xd4d5('0x55')](function(_0x34fdfd){return _0x34fdfd&&_0x34fdfd[_0xd4d5('0x56')][0x0]&&_0x34fdfd[_0xd4d5('0x56')][0x0]['transcript']?_0x34fdfd[_0xd4d5('0x56')][0x0][_0xd4d5('0x57')]:'';})[_0xd4d5('0x58')]('\x0a');_0x5c74a3=_0x5ed23b[_0xd4d5('0x54')]['map'](function(_0x23707b){return _0x23707b&&_0x23707b[_0xd4d5('0x56')][0x0]&&_0x23707b[_0xd4d5('0x56')][0x0]['confidence']?_0x23707b[_0xd4d5('0x56')][0x0][_0xd4d5('0x59')]:0x0;})['join']('\x0a');}logger['info'](_0xd4d5('0x5a'),_0xfdf242);logger[_0xd4d5('0x1e')](_0xd4d5('0x5b'),_0x5c74a3);return{'transcript':_0xfdf242,'confidence':_0x5c74a3};})[_0xd4d5('0x5c')](function(_0x4b9d80){logger[_0xd4d5('0x21')](_0xd4d5('0x5d'),_0x4b9d80['statusCode'],_0x4b9d80[_0xd4d5('0x5e')],_0x4b9d80['message']);});};exports[_0xd4d5('0x5f')]=function(_0x51e0da,_0x329aac,_0xbef93d,_0x33494c){var _0x3aa23b=apiai(_0x329aac,{'language':_0x33494c||'en'});return _0x3aa23b[_0xd4d5('0x60')](_0xbef93d,{'sessionId':md5(_0x51e0da)})['then'](function(_0x3143c3){logger[_0xd4d5('0x1e')](JSON[_0xd4d5('0x61')](_0x3143c3));return{'source':_0x3143c3[_0xd4d5('0x62')][_0xd4d5('0x63')],'resolvedQuery':_0x3143c3[_0xd4d5('0x62')][_0xd4d5('0x64')],'action':_0x3143c3['result'][_0xd4d5('0x65')],'actionIncomplete':_0x3143c3[_0xd4d5('0x62')][_0xd4d5('0x66')],'speech':_0x3143c3[_0xd4d5('0x62')][_0xd4d5('0x67')][_0xd4d5('0x68')],'score':_0x3143c3['result']['score'],'statusCode':_0x3143c3[_0xd4d5('0x69')]['code'],'endConversation':_0x3143c3[_0xd4d5('0x62')][_0xd4d5('0x6a')][_0xd4d5('0x6b')]||![],'isFallbackIntent':_0x3143c3[_0xd4d5('0x62')][_0xd4d5('0x6a')]['isFallbackIntent']};});};exports[_0xd4d5('0x6c')]=function(_0x4b64b0,_0x16c992,_0x38affc,_0x204d3d,_0x39926a,_0x1390e0){var _0x4df994=_0x204d3d[_0xd4d5('0x6d')](/\\n/g,'\x0a');var _0x4b04bf={'credentials':{'private_key':_0x4df994,'client_email':_0x38affc}};var _0x268802=new dialogflow[(_0xd4d5('0x6e'))](_0x4b04bf);var _0x23602c=_0x268802[_0xd4d5('0x6f')](_0x16c992,md5(_0x4b64b0));var _0x3e5266={'session':_0x23602c,'queryInput':{'text':{'text':_0x39926a,'languageCode':_0x1390e0}}};return _0x268802['detectIntent'](_0x3e5266)[_0xd4d5('0x31')](function(_0x2f1ecc){if(_0x2f1ecc&&_0x2f1ecc['length']){logger[_0xd4d5('0x1e')]('Dialogflow\x20V2\x20response:',JSON[_0xd4d5('0x61')](_0x2f1ecc));var _0x390802=_0x2f1ecc[0x0];if(_0x390802){var _0x1c6c92={'action':_0x390802[_0xd4d5('0x70')][_0xd4d5('0x65')],'allRequiredParamsPresent':_0x390802[_0xd4d5('0x70')][_0xd4d5('0x71')],'endConversation':_0x390802[_0xd4d5('0x70')][_0xd4d5('0x72')]&&_0x390802[_0xd4d5('0x70')]['diagnosticInfo'][_0xd4d5('0x73')]?_0x390802['queryResult'][_0xd4d5('0x72')][_0xd4d5('0x73')][_0xd4d5('0x74')][_0xd4d5('0x75')]:![],'fulfillmentText':_0x390802[_0xd4d5('0x70')]['fulfillmentText'],'intentName':_0x390802[_0xd4d5('0x70')]['intent'][_0xd4d5('0x5e')],'intentDisplayName':_0x390802[_0xd4d5('0x70')][_0xd4d5('0x76')][_0xd4d5('0x77')],'isFallbackIntent':_0x390802[_0xd4d5('0x70')]['intent'][_0xd4d5('0x78')],'languageCode':_0x390802['queryResult'][_0xd4d5('0x79')],'queryText':_0x390802[_0xd4d5('0x70')][_0xd4d5('0x7a')],'responseId':_0x390802[_0xd4d5('0x7b')],'score':_0x390802['queryResult'][_0xd4d5('0x7c')],'speech':_0x390802[_0xd4d5('0x70')][_0xd4d5('0x7d')],'providerResponse':JSON[_0xd4d5('0x61')](_0x2f1ecc)};return _0x1c6c92;}}});};exports[_0xd4d5('0x7e')]=function(_0x4aa10b,_0x13f35b,_0x84e993,_0x42f7ee){return tilde[_0xd4d5('0x52')](_0x4aa10b,_0x13f35b,_0x84e993,_0x42f7ee)[_0xd4d5('0x31')](function(_0x189b5b){try{fs[_0xd4d5('0x22')](_0x4aa10b);}catch(_0x2cca54){logger['error'](_0x2cca54);}logger[_0xd4d5('0x1e')](_0xd4d5('0x7f'),_0x189b5b[_0xd4d5('0x57')]);logger['info']('Tilde\x20ASR\x20confidence',_0x189b5b[_0xd4d5('0x59')]);return _0x189b5b;});};exports['awsPolly']=function(_0x13e101,_0x906116,_0x154a7b,_0xb29cbe,_0x411307,_0x23df7b){var _0xf161ed=path[_0xd4d5('0x3c')](__dirname,_0xd4d5('0x2c'),rs[_0xd4d5('0x2d')](0x4)+_0xd4d5('0x3d'));var _0x432281;return aws[_0xd4d5('0x80')](_0x13e101,_0x906116,_0x154a7b,_0xb29cbe,_0x411307,_0x23df7b,_0xf161ed)[_0xd4d5('0x31')](function(){_0x432281=path[_0xd4d5('0x3c')](__dirname,_0xd4d5('0x2c'),rs[_0xd4d5('0x2d')](0x4)+'.wav');return convertFile(_0xf161ed,_0x432281);})[_0xd4d5('0x31')](function(){try{fs[_0xd4d5('0x22')](_0xf161ed);fs['chmodSync'](_0x432281,'777');}catch(_0x1a9d97){logger[_0xd4d5('0x21')](_0x1a9d97);}return _0x432281[_0xd4d5('0x43')]('.')[0x0];});};exports[_0xd4d5('0x81')]=function(_0x52b92b,_0x577cb8,_0x17372f,_0x139cfa,_0x2925da,_0x3cf10b){return aws[_0xd4d5('0x82')](_0x52b92b,_0x577cb8,_0x17372f,_0x139cfa,_0x2925da,_0x3cf10b)[_0xd4d5('0x31')](function(_0x484f9a){logger['info'](JSON['stringify'](_0x484f9a));return _0x484f9a;});};exports[_0xd4d5('0x83')]=function(_0xd9684a,_0x4771c9,_0x4c2a6e,_0x1d6a0c){var _0x57ebc4=util[_0xd4d5('0x84')](_0xd4d5('0x85'),ISPEECH_API,_0xd9684a,encodeURIComponent(_0x4771c9),_0x4c2a6e,_0x1d6a0c);var _0xb11d5c=path[_0xd4d5('0x3c')](__dirname,_0xd4d5('0x2c'),rs[_0xd4d5('0x2d')](0x4)+_0xd4d5('0x3d'));var _0x363685;return downloadFile(_0x57ebc4,_0xb11d5c)['then'](function(){_0x363685=path[_0xd4d5('0x3c')](__dirname,_0xd4d5('0x2c'),rs[_0xd4d5('0x2d')](0x4)+_0xd4d5('0x2e'));return convertFile(_0xb11d5c,_0x363685);})[_0xd4d5('0x31')](function(){try{fs['unlink'](_0xb11d5c);fs['chmodSync'](_0x363685,_0xd4d5('0x41'));}catch(_0x24a235){logger[_0xd4d5('0x21')](_0x24a235);}return _0x363685['split']('.')[0x0];});};exports['ispeechASR']=function(_0x4804f1,_0x4d58f9,_0x2df6d8,_0x562cee){var _0x2186f8=util['format'](_0xd4d5('0x86'),ISPEECH_API,_0x4d58f9,_0x2df6d8,base64Encode(_0x4804f1),_0x562cee?util[_0xd4d5('0x84')](_0xd4d5('0x87'),encodeURIComponent(_0x562cee)):_0xd4d5('0x88'));return uploadFile(_0x2186f8)[_0xd4d5('0x31')](function(_0xc5dfa5){return querystring[_0xd4d5('0xc')](_0xc5dfa5);});};exports['sestekNDA']=function(_0x2c76b6,_0x500885){return sestek[_0xd4d5('0x89')](_0x2c76b6,_0x500885)['then'](function(_0x7b86f1){logger[_0xd4d5('0x1e')](JSON[_0xd4d5('0x61')](_0x7b86f1));var _0x46d005={'speech':_0x7b86f1['text'],'action':_0x7b86f1[_0xd4d5('0x8a')]?_0x7b86f1[_0xd4d5('0x8a')][_0xd4d5('0x8b')]:undefined,'actiondata':_0x7b86f1[_0xd4d5('0x8a')]?_0x7b86f1[_0xd4d5('0x8a')][_0xd4d5('0x8c')]:undefined};if(_0x7b86f1[_0xd4d5('0x8a')]&&_0x7b86f1[_0xd4d5('0x8a')][_0xd4d5('0x8d')]){return base64Decode(_0x7b86f1[_0xd4d5('0x8a')]['AudioFromTts']['Data'],path[_0xd4d5('0x3c')](__dirname,_0xd4d5('0x2c'),rs['generate'](0x4)+_0xd4d5('0x2e')))['then'](function(_0x270b78){_0x46d005[_0xd4d5('0x8e')]=_0x270b78;return _0x46d005;});}return _0x46d005;});};exports[_0xd4d5('0x8f')]=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 878b279..b3d22a8 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 _0x2225=['./nda','exports'];(function(_0x22377a,_0x3397cb){var _0x36f105=function(_0x2174cc){while(--_0x2174cc){_0x22377a['push'](_0x22377a['shift']());}};_0x36f105(++_0x3397cb);}(_0x2225,0x124));var _0x5222=function(_0x33fc32,_0x32eed0){_0x33fc32=_0x33fc32-0x0;var _0x45841f=_0x2225[_0x33fc32];return _0x45841f;};var nda=require(_0x5222('0x0'));module[_0x5222('0x1')]={'nda':nda}; \ No newline at end of file +var _0x68fd=['exports'];(function(_0x474a7,_0x539c6e){var _0x3ab13b=function(_0x1f55cf){while(--_0x1f55cf){_0x474a7['push'](_0x474a7['shift']());}};_0x3ab13b(++_0x539c6e);}(_0x68fd,0x123));var _0xd68f=function(_0x4d87df,_0x2a6ba8){_0x4d87df=_0x4d87df-0x0;var _0x2919b8=_0x68fd[_0x4d87df];return _0x2919b8;};var nda=require('./nda');module[_0xd68f('0x0')]={'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 9e93c5a..f3b2239 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 _0xc9c3=['then','POST','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','calleridname','dnid','extension','text','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','body','CustomAction','custom_action_data','stringify','url','../../../../../config/logger','agi','resolve','ndauth_url','/token','password','username'];(function(_0x4992ad,_0x46a52e){var _0x14d181=function(_0x405e40){while(--_0x405e40){_0x4992ad['push'](_0x4992ad['shift']());}};_0x14d181(++_0x46a52e);}(_0xc9c3,0xd0));var _0x3c9c=function(_0x3119d8,_0x883ee1){_0x3119d8=_0x3119d8-0x0;var _0x336267=_0xc9c3[_0x3119d8];return _0x336267;};'use strict';var rp=require('request-promise');var url=require(_0x3c9c('0x0'));var logger=require(_0x3c9c('0x1'))(_0x3c9c('0x2'));module['exports']=function(_0x4a1db1,_0x2ca714){var _0x11d161={'method':'POST','uri':url[_0x3c9c('0x3')](_0x2ca714[_0x3c9c('0x4')],_0x3c9c('0x5')),'form':{'grant_type':_0x3c9c('0x6'),'username':_0x2ca714[_0x3c9c('0x7')],'password':_0x2ca714[_0x3c9c('0x6')]},'json':!![]};return rp(_0x11d161)[_0x3c9c('0x8')](function(_0x4eaaf4){var _0x5a15f7={'method':_0x3c9c('0x9'),'uri':url[_0x3c9c('0x3')](_0x2ca714['ndassistant_url'],_0x3c9c('0xa')),'body':{'type':_0x2ca714[_0x3c9c('0xb')]||_0x3c9c('0xc'),'channelId':_0x3c9c('0xd'),'conversation':{'id':_0x4a1db1['uniqueid']},'from':{'id':_0x4a1db1['callerid'],'name':_0x4a1db1[_0x3c9c('0xe')]},'recipient':{'id':_0x4a1db1[_0x3c9c('0xf')],'name':_0x4a1db1[_0x3c9c('0x10')]},'text':_0x2ca714[_0x3c9c('0x11')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x4eaaf4['access_token']},'json':!![]};if(_0x2ca714['project']){_0x5a15f7['body'][_0x3c9c('0x12')][_0x3c9c('0x13')]=_0x2ca714['project'];}if(_0x2ca714[_0x3c9c('0x14')]=='1'){_0x5a15f7['body'][_0x3c9c('0x12')][_0x3c9c('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x3c9c('0x16')};}if(_0x2ca714['custom_action']){_0x5a15f7[_0x3c9c('0x17')]['channelData'][_0x3c9c('0x18')]=_0x2ca714['custom_action'];if(_0x2ca714[_0x3c9c('0x19')]){_0x5a15f7[_0x3c9c('0x17')][_0x3c9c('0x12')]['CustomActionData']=_0x2ca714[_0x3c9c('0x19')];}}logger['info'](JSON[_0x3c9c('0x1a')](_0x5a15f7));return rp(_0x5a15f7);});}; \ No newline at end of file +var _0x65b3=['text','project','body','channelData','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','/token','password','username','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','extension'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x65b3,0xc6));var _0x365b=function(_0x586fa2,_0x1a45bc){_0x586fa2=_0x586fa2-0x0;var _0x515be9=_0x65b3[_0x586fa2];return _0x515be9;};'use strict';var rp=require(_0x365b('0x0'));var url=require(_0x365b('0x1'));var logger=require(_0x365b('0x2'))(_0x365b('0x3'));module[_0x365b('0x4')]=function(_0x86c875,_0x4b0b05){var _0x46fcf2={'method':_0x365b('0x5'),'uri':url[_0x365b('0x6')](_0x4b0b05['ndauth_url'],_0x365b('0x7')),'form':{'grant_type':_0x365b('0x8'),'username':_0x4b0b05[_0x365b('0x9')],'password':_0x4b0b05['password']},'json':!![]};return rp(_0x46fcf2)[_0x365b('0xa')](function(_0xe6670a){var _0x2ed50a={'method':_0x365b('0x5'),'uri':url[_0x365b('0x6')](_0x4b0b05['ndassistant_url'],_0x365b('0xb')),'body':{'type':_0x4b0b05[_0x365b('0xc')]||_0x365b('0xd'),'channelId':_0x365b('0xe'),'conversation':{'id':_0x86c875[_0x365b('0xf')]},'from':{'id':_0x86c875['callerid'],'name':_0x86c875[_0x365b('0x10')]},'recipient':{'id':_0x86c875[_0x365b('0x11')],'name':_0x86c875[_0x365b('0x12')]},'text':_0x4b0b05[_0x365b('0x13')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0xe6670a['access_token']},'json':!![]};if(_0x4b0b05[_0x365b('0x14')]){_0x2ed50a[_0x365b('0x15')][_0x365b('0x16')]['ProjectName']=_0x4b0b05[_0x365b('0x14')];}if(_0x4b0b05['ndagenerate_audio']=='1'){_0x2ed50a[_0x365b('0x15')][_0x365b('0x16')][_0x365b('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x365b('0x18')};}if(_0x4b0b05[_0x365b('0x19')]){_0x2ed50a[_0x365b('0x15')][_0x365b('0x16')][_0x365b('0x1a')]=_0x4b0b05[_0x365b('0x19')];if(_0x4b0b05[_0x365b('0x1b')]){_0x2ed50a[_0x365b('0x15')][_0x365b('0x16')][_0x365b('0x1c')]=_0x4b0b05[_0x365b('0x1b')];}}logger[_0x365b('0x1d')](JSON[_0x365b('0x1e')](_0x2ed50a));return rp(_0x2ed50a);});}; \ 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 d06ed0c..e6aa693 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 _0x18bd=['exports'];(function(_0x45dc60,_0x5b6ac7){var _0x3765ba=function(_0x2e9586){while(--_0x2e9586){_0x45dc60['push'](_0x45dc60['shift']());}};_0x3765ba(++_0x5b6ac7);}(_0x18bd,0x130));var _0xd18b=function(_0xe598d2,_0x2c30a2){_0xe598d2=_0xe598d2-0x0;var _0x2c3846=_0x18bd[_0xe598d2];return _0x2c3846;};'use strict';var asr=require('./lib/api');module[_0xd18b('0x0')]=function(_0x276032,_0x159023,_0x4392cb,_0x5564c9){return asr(_0x276032,_0x159023,_0x4392cb,_0x5564c9);}; \ No newline at end of file +var _0x0e79=['./lib/api','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0e79,0xac));var _0x90e7=function(_0x3f6c29,_0x370d86){_0x3f6c29=_0x3f6c29-0x0;var _0x4af959=_0x0e79[_0x3f6c29];return _0x4af959;};'use strict';var asr=require(_0x90e7('0x0'));module[_0x90e7('0x1')]=function(_0x3ee8e2,_0x46e62d,_0x1406be,_0x5326fa){return asr(_0x3ee8e2,_0x46e62d,_0x1406be,_0x5326fa);}; \ 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 9845802..0ec085f 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 _0x53c7=['isObject','open','message','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','hex','unix','send','stringify','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','terminate','Close\x20Tilde\x20ASR\x20socket'];(function(_0x51fd1a,_0x2b0437){var _0x23fe52=function(_0x1f93cb){while(--_0x1f93cb){_0x51fd1a['push'](_0x51fd1a['shift']());}};_0x23fe52(++_0x2b0437);}(_0x53c7,0x19b));var _0x753c=function(_0x4c485b,_0x38262f){_0x4c485b=_0x4c485b-0x0;var _0x447d6c=_0x53c7[_0x4c485b];return _0x447d6c;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x753c('0x0'));var crypto=require(_0x753c('0x1'));var logger=require(_0x753c('0x2'))(_0x753c('0x3'));module[_0x753c('0x4')]=function(_0x323f71,_0x34d766,_0x2378f7,_0x123e75){return new BPromise(function(_0x3585cd,_0x5dc66f){logger[_0x753c('0x5')](_0x753c('0x6'),_0x123e75||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x4cf1cc=new WebSocket(_0x123e75||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x273064='';var _0xa0b03d='0';var _0x2651ca='1';var _0x1018fa=_0x753c('0x7');function _0x1c0950(_0x12145f){var _0x64e0a4=crypto['createHash'](_0x753c('0x8'));_0x64e0a4['update'](_0x12145f);return _0x64e0a4['digest'](_0x753c('0x9'));}function _0x5e164a(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x130c02=moment()[_0x753c('0xa')]();var _0x5b9415=_0x1c0950(_0x130c02+_0x34d766+_0x2378f7);_0x4cf1cc[_0x753c('0xb')](JSON[_0x753c('0xc')]({'appID':_0x34d766,'timestamp':_0x130c02,'appKey':_0x5b9415}));var _0x2851a8=fs[_0x753c('0xd')](_0x323f71);_0x2851a8['on']('data',function(_0x19d2bb){_0x4cf1cc[_0x753c('0xb')](_0x19d2bb);});_0x2851a8['on'](_0x753c('0xe'),function(){_0x4cf1cc['send'](_0x753c('0xf'));});}catch(_0x330dc4){logger[_0x753c('0x10')](_0x753c('0x11'),JSON['stringify'](_0x330dc4));_0x4cf1cc['terminate']();}}function _0x52407c(_0x2c1a3e){try{if(_0x2c1a3e){var _0x2158a1=JSON[_0x753c('0x12')](_0x2c1a3e);switch(_0x2158a1['status']){case 0x0:if(_0x2158a1[_0x753c('0x13')]){if(_0x2158a1[_0x753c('0x13')][_0x753c('0x14')]){logger[_0x753c('0x5')](_0x753c('0x15'),JSON[_0x753c('0xc')](_0x2158a1[_0x753c('0x13')][_0x753c('0x16')]));_0x273064=_0x2158a1['result'][_0x753c('0x16')][0x0]['transcript'];_0xa0b03d=_0x2158a1[_0x753c('0x13')]['hypotheses'][0x0][_0x753c('0x17')];_0x2651ca='0';_0x1018fa=_0x753c('0x18');_0x4cf1cc['terminate']();}}break;case 0x1:logger[_0x753c('0x5')](_0x753c('0x7'));_0x2651ca='1';_0x1018fa=_0x753c('0x7');break;case 0x2:logger[_0x753c('0x5')](_0x753c('0x19'));_0x2651ca='2';_0x1018fa=_0x753c('0x19');break;case 0x9:logger[_0x753c('0x5')](_0x753c('0x1a'));_0x2651ca='9';_0x1018fa=_0x753c('0x1a');break;case 0xa:logger['info'](_0x753c('0x1b'));_0x2651ca='10';_0x1018fa=_0x753c('0x1b');break;case 0xb:logger['info'](_0x753c('0x1c'));_0x2651ca='11';_0x1018fa=_0x753c('0x1c');}}}catch(_0x2f2c94){logger[_0x753c('0x10')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x753c('0xc')](_0x2f2c94));_0x4cf1cc[_0x753c('0x1d')]();}}function _0x530925(){logger[_0x753c('0x5')](_0x753c('0x1e'));_0x3585cd({'transcript':_0x273064,'confidence':_0xa0b03d,'status':_0x2651ca,'status_message':_0x1018fa});}function _0x1251a1(_0x41794a){logger[_0x753c('0x10')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x41794a)){logger[_0x753c('0x10')](_[_0x753c('0x1f')](_0x41794a)?JSON[_0x753c('0xc')](_0x41794a):_0x41794a);}}_0x4cf1cc['on'](_0x753c('0x20'),_0x5e164a);_0x4cf1cc['on'](_0x753c('0x21'),_0x52407c);_0x4cf1cc['on'](_0x753c('0xe'),_0x530925);_0x4cf1cc['on'](_0x753c('0x10'),_0x1251a1);});}; \ No newline at end of file +var _0xa3c4=['message','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','hex','unix','send','stringify','EOS','Tilde\x20ASR\x20send\x20error','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','error','Error\x20Tilde\x20ASR\x20socket','isObject','open'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0xa3c4,0x9a));var _0x4a3c=function(_0x409d7a,_0x316ff6){_0x409d7a=_0x409d7a-0x0;var _0x4c8ad5=_0xa3c4[_0x409d7a];return _0x4c8ad5;};'use strict';var BPromise=require(_0x4a3c('0x0'));var _=require(_0x4a3c('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x4a3c('0x2'));var crypto=require(_0x4a3c('0x3'));var logger=require(_0x4a3c('0x4'))('agi');module[_0x4a3c('0x5')]=function(_0x139886,_0x44aa47,_0x8e0c28,_0x317c0d){return new BPromise(function(_0x32e973,_0x59357f){logger[_0x4a3c('0x6')](_0x4a3c('0x7'),_0x317c0d||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x14421f=new WebSocket(_0x317c0d||_0x4a3c('0x8'),{'perMessageDeflate':![]});var _0x5253ea='';var _0x25ad64='0';var _0x4773a4='1';var _0x15bc9d='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x1bb21a(_0x5103b5){var _0x56f519=crypto[_0x4a3c('0x9')](_0x4a3c('0xa'));_0x56f519[_0x4a3c('0xb')](_0x5103b5);return _0x56f519[_0x4a3c('0xc')](_0x4a3c('0xd'));}function _0x21ca0f(){try{logger[_0x4a3c('0x6')]('Open\x20Tilde\x20ASR\x20socket');var _0x409692=moment()[_0x4a3c('0xe')]();var _0x53a2e3=_0x1bb21a(_0x409692+_0x44aa47+_0x8e0c28);_0x14421f[_0x4a3c('0xf')](JSON[_0x4a3c('0x10')]({'appID':_0x44aa47,'timestamp':_0x409692,'appKey':_0x53a2e3}));var _0xfb7f4=fs['createReadStream'](_0x139886);_0xfb7f4['on']('data',function(_0x3141a2){_0x14421f[_0x4a3c('0xf')](_0x3141a2);});_0xfb7f4['on']('close',function(){_0x14421f[_0x4a3c('0xf')](_0x4a3c('0x11'));});}catch(_0x39f703){logger['error'](_0x4a3c('0x12'),JSON[_0x4a3c('0x10')](_0x39f703));_0x14421f['terminate']();}}function _0x30c4de(_0x521280){try{if(_0x521280){var _0x47bd8c=JSON[_0x4a3c('0x13')](_0x521280);switch(_0x47bd8c[_0x4a3c('0x14')]){case 0x0:if(_0x47bd8c[_0x4a3c('0x15')]){if(_0x47bd8c['result']['final']){logger[_0x4a3c('0x6')](_0x4a3c('0x16'),JSON[_0x4a3c('0x10')](_0x47bd8c['result'][_0x4a3c('0x17')]));_0x5253ea=_0x47bd8c[_0x4a3c('0x15')][_0x4a3c('0x17')][0x0]['transcript'];_0x25ad64=_0x47bd8c[_0x4a3c('0x15')]['hypotheses'][0x0][_0x4a3c('0x18')];_0x4773a4='0';_0x15bc9d=_0x4a3c('0x19');_0x14421f[_0x4a3c('0x1a')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x4773a4='1';_0x15bc9d='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger['info'](_0x4a3c('0x1b'));_0x4773a4='2';_0x15bc9d=_0x4a3c('0x1b');break;case 0x9:logger[_0x4a3c('0x6')](_0x4a3c('0x1c'));_0x4773a4='9';_0x15bc9d=_0x4a3c('0x1c');break;case 0xa:logger[_0x4a3c('0x6')](_0x4a3c('0x1d'));_0x4773a4='10';_0x15bc9d=_0x4a3c('0x1d');break;case 0xb:logger[_0x4a3c('0x6')](_0x4a3c('0x1e'));_0x4773a4='11';_0x15bc9d=_0x4a3c('0x1e');}}}catch(_0xe3fd26){logger['error'](_0x4a3c('0x1f'),JSON[_0x4a3c('0x10')](_0xe3fd26));_0x14421f[_0x4a3c('0x1a')]();}}function _0x46ee72(){logger[_0x4a3c('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x32e973({'transcript':_0x5253ea,'confidence':_0x25ad64,'status':_0x4773a4,'status_message':_0x15bc9d});}function _0x29f08c(_0xda8c9f){logger[_0x4a3c('0x20')](_0x4a3c('0x21'));if(!_['isNil'](_0xda8c9f)){logger['error'](_[_0x4a3c('0x22')](_0xda8c9f)?JSON['stringify'](_0xda8c9f):_0xda8c9f);}}_0x14421f['on'](_0x4a3c('0x23'),_0x21ca0f);_0x14421f['on'](_0x4a3c('0x24'),_0x30c4de);_0x14421f['on'](_0x4a3c('0x25'),_0x46ee72);_0x14421f['on']('error',_0x29f08c);});}; \ 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 b349cc2..df3219b 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 _0xbced=['./asr','exports'];(function(_0x5cfaf2,_0x4e4ee0){var _0xcf7130=function(_0x58db51){while(--_0x58db51){_0x5cfaf2['push'](_0x5cfaf2['shift']());}};_0xcf7130(++_0x4e4ee0);}(_0xbced,0x168));var _0xdbce=function(_0xe2b6bf,_0x56a176){_0xe2b6bf=_0xe2b6bf-0x0;var _0x341139=_0xbced[_0xe2b6bf];return _0x341139;};var asr=require(_0xdbce('0x0'));module[_0xdbce('0x1')]={'asr':asr}; \ No newline at end of file +var _0x951c=['./asr','exports'];(function(_0x4df6f9,_0x44bd65){var _0x4b1a73=function(_0xf5adb7){while(--_0xf5adb7){_0x4df6f9['push'](_0x4df6f9['shift']());}};_0x4b1a73(++_0x44bd65);}(_0x951c,0x11e));var _0xc951=function(_0x24ac68,_0x2fc255){_0x24ac68=_0x24ac68-0x0;var _0x1fae4a=_0x951c[_0x24ac68];return _0x1fae4a;};var asr=require(_0xc951('0x0'));module[_0xc951('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index f5797ba..8989f26 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0xe706,0xa3));var _0x6e70=function(_0x453327,_0x3ebe4a){_0x453327=_0x453327-0x0;var _0x1d5a70=_0xe706[_0x453327];return _0x1d5a70;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file +var _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x27e627,_0x31c44c){var _0x2a1c87=function(_0x483601){while(--_0x483601){_0x27e627['push'](_0x27e627['shift']());}};_0x2a1c87(++_0x31c44c);}(_0x34e8,0x12c));var _0x834e=function(_0x41ed07,_0x3a15ca){_0x41ed07=_0x41ed07-0x0;var _0x294873=_0x34e8[_0x41ed07];return _0x294873;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index fc46257..c9f6e43 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 _0x0c02=['TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','gotoif','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','isArray','%s[%s]','variable\x20%s[key]\x20set','response','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','agentPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20selected','getVoiceQueue','indexOf','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','user','bcc','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','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','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Trying\x20Google\x20TTS\x20%s','googleTTS','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','lodash','shelljs','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','channel','rpc','mailRpc','getVariableById','then','name','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','prototype','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','interval','map','Intervals','%s/sounds/converted/%s','error','info','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','context','extension','accountcode','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','callback','scheduledAt','toString','callback_priority','getPause','agent','agentUnpause','agentLogout','internal','format','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getVariable','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','result','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','exec','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','getdigits','retry','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav'];(function(_0x1199b0,_0x18b4b8){var _0x1bbd4e=function(_0x58610e){while(--_0x58610e){_0x1199b0['push'](_0x1199b0['shift']());}};_0x1bbd4e(++_0x18b4b8);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x20c0('0x0'));var sh=require(_0x20c0('0x1'));var odbc=require('odbc')();var rs=require(_0x20c0('0x2'));var moment=require(_0x20c0('0x3'));var Mustache=require(_0x20c0('0x4'));var rp=require(_0x20c0('0x5'));var logger=require(_0x20c0('0x6'))(_0x20c0('0x7'));var config=require(_0x20c0('0x8'));var scripts=require(_0x20c0('0x9'));var FILES_PATH=_0x20c0('0xa');var recursiveMapAttributes=[_0x20c0('0xb'),'rawBody'];var verticesWithRetry=['menu','getdigits','getsecretdigits'];var AGIVertices=function(_0x1e35e2,_0x276e9b,_0xcdc174){this[_0x20c0('0xc')]=_0x1e35e2;this[_0x20c0('0xd')]=_0x276e9b;this[_0x20c0('0xe')]=_0xcdc174;};AGIVertices['prototype']['getVariable']=function(_0x52eb0d,_0x578592){this['rpc'][_0x20c0('0xf')](_0x52eb0d)[_0x20c0('0x10')](function(_0x2ecab9){_0x578592(null,_0x2ecab9?_0x2ecab9[_0x20c0('0x11')]:![]);})['catch'](function(_0x56fa09){_0x578592(_0x56fa09);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x34a930,_0xfc2d9c){this[_0x20c0('0xd')][_0x20c0('0x12')](_0x34a930)[_0x20c0('0x10')](function(_0x1e6662){_0xfc2d9c(null,_0x1e6662?_0x1e6662[_0x20c0('0x11')]:![]);})[_0x20c0('0x13')](function(_0x280aff){_0xfc2d9c(_0x280aff);});};AGIVertices['prototype'][_0x20c0('0x14')]=function(_0xc78626,_0x1a708e){this[_0x20c0('0xd')][_0x20c0('0x15')](_0xc78626)[_0x20c0('0x10')](function(_0x5d6d18){_0x1a708e(null,_0x5d6d18?_0x5d6d18['name']:![]);})['catch'](function(_0x10a921){_0x1a708e(_0x10a921);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x17')]=function(_0x43a885,_0x5b3725){this[_0x20c0('0xd')][_0x20c0('0x18')](_0x43a885)[_0x20c0('0x10')](function(_0x5851eb){_0x5b3725(null,_0x5851eb?_0x5851eb['dsn']:![]);})[_0x20c0('0x13')](function(_0x108973){_0x5b3725(_0x108973);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x19')]=function(_0x36ed49,_0x53d8e8){this[_0x20c0('0xd')][_0x20c0('0x1a')](_0x36ed49)[_0x20c0('0x10')](function(_0x8a887a){_0x53d8e8(null,_0x8a887a?_0x8a887a['name']:![]);})[_0x20c0('0x13')](function(_0x3e545c){_0x53d8e8(_0x3e545c);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x1b')]=function(_0x44642a,_0x41ab51){this[_0x20c0('0xd')]['getTrunkById'](_0x44642a)[_0x20c0('0x10')](function(_0x595d94){_0x41ab51(null,_0x595d94?_0x595d94[_0x20c0('0x11')]:![]);})[_0x20c0('0x13')](function(_0x11da5a){_0x41ab51(_0x11da5a);});};AGIVertices[_0x20c0('0x16')]['getSound']=function(_0x4e0cbb,_0x3012d5){var _0x198bdd=this;this[_0x20c0('0xd')]['getSoundById'](_0x4e0cbb)[_0x20c0('0x10')](function(_0x25592b){_0x3012d5(null,_0x25592b?_0x198bdd[_0x20c0('0x1c')](_0x25592b[_0x20c0('0x1d')]):![]);})['catch'](function(_0x49b738){_0x3012d5(_0x49b738);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x1e')]=function(_0x3edc22,_0xe961ad){this[_0x20c0('0xd')][_0x20c0('0x1f')](_0x3edc22)[_0x20c0('0x10')](function(_0x40c0a7){_0xe961ad(null,_0x40c0a7?_0x40c0a7:![]);})[_0x20c0('0x13')](function(_0x191ad8){_0xe961ad(_0x191ad8);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x20')]=function(_0x1fef93,_0x45fa64,_0x55ede5){this[_0x20c0('0xe')][_0x20c0('0x20')](_0x1fef93,_0x45fa64)[_0x20c0('0x10')](function(){_0x55ede5(null);})[_0x20c0('0x13')](function(_0x59406e){_0x55ede5(_0x59406e);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x21')]=function(_0x355db9,_0x1ba29e){this[_0x20c0('0xd')]['getIntervalById'](_0x355db9)[_0x20c0('0x10')](function(_0x538595){if(_0x538595){if(_0x538595['IntervalId']){_0x1ba29e(null,[_0x538595[_0x20c0('0x22')]]);}else{_0x1ba29e(null,_[_0x20c0('0x23')](_0x538595[_0x20c0('0x24')],_0x20c0('0x22')));}}else{_0x1ba29e(null,![]);}})[_0x20c0('0x13')](function(_0x39fd84){_0x1ba29e(_0x39fd84);});};AGIVertices[_0x20c0('0x16')]['getSoundPath']=function(_0x5f4cc9){return util['format'](_0x20c0('0x25'),FILES_PATH,_0x5f4cc9);};AGIVertices[_0x20c0('0x16')]['getQueryOdbc']=function(_0x346a04,_0x20d6f3,_0x550d2c){odbc['open'](_0x346a04,function(_0x700675){if(_0x700675){logger[_0x20c0('0x26')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x700675);_0x550d2c(_0x700675);}else{logger[_0x20c0('0x27')]('ODBC\x20connection\x20successfully');odbc[_0x20c0('0x28')](_0x20d6f3,function(_0x31bf03,_0xcaa484){if(_0x31bf03){logger[_0x20c0('0x27')]('Error\x20executing\x20query\x20%s',_0x20d6f3);_0x550d2c(_0x31bf03);}else{logger[_0x20c0('0x27')](_0x20c0('0x29'),_0x20d6f3);odbc[_0x20c0('0x2a')](function(_0x415b41){if(_0x415b41){logger[_0x20c0('0x26')](_0x20c0('0x2b'),_0x415b41);}_0x550d2c(null,_0xcaa484);});}});}});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x2c')]=function(_0x57bb71,_0x52664c){this['rpc'][_0x20c0('0x2d')](_0x57bb71)['then'](function(_0x438a22){_0x52664c(null,_0x438a22?_0x438a22:![]);})[_0x20c0('0x13')](function(_0x88863){_0x52664c(_0x88863);});};AGIVertices[_0x20c0('0x16')]['createSmsMessage']=function(_0x178d92,_0x5bf7b8){this['rpc'][_0x20c0('0x2e')](_0x178d92)[_0x20c0('0x10')](function(_0x456d28){_0x5bf7b8(null,_0x456d28);})[_0x20c0('0x13')](function(_0x5c06c4){_0x5bf7b8(_0x5c06c4);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x2f')]=function(_0x39852a,_0x1ef892,_0x4df560){this[_0x20c0('0xd')][_0x20c0('0x2f')]({'uniqueid':this['channel'][_0x20c0('0x30')],'node':_0x39852a[_0x20c0('0x31')],'application':_0x39852a[_0x20c0('0x32')],'data':_0x1ef892||null,'project_name':this['channel'][_0x20c0('0x33')],'callerid':this['channel']['callerid']})['then'](function(_0x36ccf2){if(_0x4df560){_0x4df560(null,_0x36ccf2);}})['catch'](function(_0x12945c){if(_0x4df560){_0x4df560(_0x12945c);}});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x34')]=function(_0x3e5c62,_0x15f299,_0x2c95a4,_0x267f97){this['rpc'][_0x20c0('0x34')]({'uniqueid':this[_0x20c0('0xc')][_0x20c0('0x30')],'callerid':this[_0x20c0('0xc')][_0x20c0('0x35')],'calleridname':this[_0x20c0('0xc')]['calleridname'],'context':this['channel'][_0x20c0('0x36')],'extension':this[_0x20c0('0xc')][_0x20c0('0x37')],'priority':this['channel']['priority'],'accountcode':this[_0x20c0('0xc')][_0x20c0('0x38')],'dnid':this[_0x20c0('0xc')]['dnid'],'projectName':this[_0x20c0('0xc')][_0x20c0('0x33')],'saveName':_0x15f299,'filename':_0x3e5c62['file']||_0x15f299,'savePath':_0x2c95a4})['then'](function(_0x3fb4f1){_0x267f97(null,_0x3fb4f1);})['catch'](function(_0xdd2a3b){_0x267f97(_0xdd2a3b);});};AGIVertices['prototype'][_0x20c0('0x39')]=function(_0x425953,_0x5dd76d,_0x555e5a,_0x18810f,_0x149376){this[_0x20c0('0xd')][_0x20c0('0x39')]({'uniqueid':this[_0x20c0('0xc')][_0x20c0('0x30')],'body':_0x425953,'direction':_0x5dd76d,'providerName':_0x555e5a,'providerResponse':_0x18810f})[_0x20c0('0x10')](function(_0x20faa2){if(_0x149376){_0x149376(null,_0x20faa2);}})['catch'](function(_0x24b5f5){if(_0x149376){_0x149376(_0x24b5f5);}});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x3a')]=function(_0xe50137,_0x2c3404){this['rpc']['createCmContact']({'firstName':_[_0x20c0('0x3b')](_0xe50137[_0x20c0('0x11')])||_[_0x20c0('0x3c')](_0xe50137[_0x20c0('0x11')])?_0x20c0('0x3d')+Math[_0x20c0('0x3e')]():_0xe50137[_0x20c0('0x11')],'lastName':_['isEmpty'](_0xe50137['lastName'])||_[_0x20c0('0x3c')](_0xe50137[_0x20c0('0x3f')])?null:_0xe50137[_0x20c0('0x3f')],'phone':_0xe50137['phone'],'ListId':_0xe50137[_0x20c0('0x40')],'scheduledat':_0xe50137['scheduledAt'],'callbackUniqueid':this[_0x20c0('0xc')][_0x20c0('0x30')],'tags':_0x20c0('0x41'),'description':'Callback\x20scheduled\x20at\x20'+_0xe50137[_0x20c0('0x42')][_0x20c0('0x43')](),'priority':_0xe50137[_0x20c0('0x44')]})[_0x20c0('0x10')](function(_0x1e62e3){_0x2c3404(null,_0x1e62e3);})['catch'](function(_0xe7a292){_0x2c3404(_0xe7a292);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x45')]=function(_0x1aafc3,_0x57f482){this[_0x20c0('0xd')]['getPauseById'](_0x1aafc3)[_0x20c0('0x10')](function(_0x5d40c9){_0x57f482(null,_0x5d40c9?_0x5d40c9[_0x20c0('0x11')]:![]);})[_0x20c0('0x13')](function(_0x2cf512){_0x57f482(_0x2cf512);});};AGIVertices[_0x20c0('0x16')]['agentPause']=function(_0x371cbb,_0xcd87e8,_0x1e1c4b){var _0x12f2d2={'role':_0x20c0('0x46')};_0x12f2d2[_0x371cbb]=this[_0x20c0('0xc')][_0x20c0('0x35')];this[_0x20c0('0xd')]['agentPause'](_0x12f2d2,_0xcd87e8,this[_0x20c0('0xc')][_0x20c0('0x30')])[_0x20c0('0x10')](function(_0x56e1f6){_0x1e1c4b(null,_[_0x20c0('0x3c')](_0x56e1f6)?![]:!![]);})[_0x20c0('0x13')](function(_0x57ca28){logger[_0x20c0('0x26')](_0x57ca28);_0x1e1c4b(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x5ee9cf,_0x558d5c){var _0x13093a={'role':_0x20c0('0x46')};_0x13093a[_0x5ee9cf]=this[_0x20c0('0xc')][_0x20c0('0x35')];this[_0x20c0('0xd')][_0x20c0('0x47')](_0x13093a)[_0x20c0('0x10')](function(_0x247dee){_0x558d5c(null,_[_0x20c0('0x3c')](_0x247dee)?![]:!![]);})['catch'](function(_0x32d445){logger[_0x20c0('0x26')](_0x32d445);_0x558d5c(null,![]);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x48')]=function(_0x2fd893,_0x189c6b){var _0x788e01={'role':_0x20c0('0x46')};_0x788e01[_0x2fd893]=this[_0x20c0('0xc')][_0x20c0('0x35')];this['rpc'][_0x20c0('0x48')](_0x788e01)[_0x20c0('0x10')](function(_0x1ae801){_0x189c6b(null,_[_0x20c0('0x3c')](_0x1ae801)?![]:!![]);})['catch'](function(_0x488e79){logger[_0x20c0('0x26')](_0x488e79);_0x189c6b(null,![]);});};AGIVertices[_0x20c0('0x16')]['agentLogin']=function(_0x2222eb,_0x4bc360){var _0x12080a={'role':_0x20c0('0x46')};_0x12080a[_0x2222eb]=this[_0x20c0('0xc')]['callerid'];var _0x59c854=_0x2222eb!=_0x20c0('0x49')?util[_0x20c0('0x4a')](_0x20c0('0x4b'),_0x20c0('0x4c'),this['channel']['callerid']):undefined;this['rpc'][_0x20c0('0x4d')](_0x12080a,_0x59c854)[_0x20c0('0x10')](function(_0x3c0b96){_0x4bc360(null,_['isNil'](_0x3c0b96)?![]:!![]);})['catch'](function(_0x21dbbf){logger[_0x20c0('0x26')](_0x21dbbf);_0x4bc360(null,![]);});};AGIVertices['prototype'][_0x20c0('0x4e')]=function(_0x57d80e,_0x4b2199){sh['exec'](_[_0x20c0('0x4f')](_0x57d80e),function(_0x4bb071,_0x2d7c27){var _0x4f2868=_0x2d7c27[_0x20c0('0x50')](/(\r\n|\n|\r)/gm,'');_0x4b2199(null,_0x4f2868);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x51')]=function(_0x47efdb,_0x589b56){scripts[_0x20c0('0x51')](_0x47efdb[_0x20c0('0x52')],_0x47efdb[_0x20c0('0x53')]||_0x20c0('0x54'),_0x47efdb['text'],_0x47efdb['languageCode']||_0x20c0('0x55'),_0x47efdb[_0x20c0('0x56')]||_0x20c0('0x57'),_0x47efdb[_0x20c0('0x58')]||'MP3')[_0x20c0('0x10')](function(_0x15a774){_0x589b56(null,_0x15a774);})[_0x20c0('0x13')](function(_0x4c83c0){_0x589b56(_0x4c83c0);});};AGIVertices['prototype']['googleTTS']=function(_0x39a28e,_0xe3c380){scripts['googleTTS'](_0x39a28e['text'],_0x39a28e[_0x20c0('0x59')]||'en',0x1)['then'](function(_0x5c0d59){_0xe3c380(null,_0x5c0d59);})[_0x20c0('0x13')](function(_0x45ca41){_0xe3c380(_0x45ca41);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x5a')]=function(_0x261212,_0x45f1ad){var _0x15c42e={'uri':_0x261212[_0x20c0('0x5b')],'method':_0x261212[_0x20c0('0x5c')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x261212[_0x20c0('0x5d')])===_0x20c0('0x5e')&&parseInt(_0x261212['timeout'])>=0x1?parseInt(_0x261212[_0x20c0('0x5d')])*0x3e8:0x5*0x3e8};if(_[_0x20c0('0x5f')]([_0x20c0('0x60'),_0x20c0('0x61')],_0x15c42e['method'][_0x20c0('0x62')]())){try{_0x15c42e[_0x20c0('0x63')]=_0x261212[_0x20c0('0x64')]?JSON[_0x20c0('0x65')](_0x261212[_0x20c0('0x64')]):{};}catch(_0x1566ce){logger[_0x20c0('0x26')](_0x20c0('0x66'),_0x1566ce);}}try{_0x15c42e[_0x20c0('0x67')]=_0x261212[_0x20c0('0xb')]?JSON[_0x20c0('0x65')](_0x261212[_0x20c0('0xb')]):{};}catch(_0x1d4e3d){logger[_0x20c0('0x26')](_0x20c0('0x68'),_0x1d4e3d);}if(_0x261212[_0x20c0('0x69')]){try{var _0x39bb39=require(_0x261212[_0x20c0('0x69')])[_0x20c0('0x6a')](this,_0x15c42e);_0x15c42e[_0x20c0('0x6b')]=Mustache[_0x20c0('0x6c')](_0x261212['url'],_0x39bb39,{},['$$','$$']);if(_0x15c42e['headers']){_0x15c42e[_0x20c0('0x67')]=JSON[_0x20c0('0x65')](Mustache[_0x20c0('0x6c')](JSON[_0x20c0('0x6d')](_0x15c42e['headers']),_0x39bb39,{},['$$','$$']));}if(_0x15c42e[_0x20c0('0x63')]){_0x15c42e[_0x20c0('0x63')]=JSON[_0x20c0('0x65')](Mustache['render'](JSON['stringify'](_0x15c42e[_0x20c0('0x63')]),_0x39bb39,{},['$$','$$']));}}catch(_0x38cef7){logger[_0x20c0('0x26')](_0x20c0('0x6e'),_0x38cef7);}}rp(_0x15c42e)['then'](function(_0x525a83){var _0xe08378={'statusCode':_0x525a83[_0x20c0('0x6f')]||0xc8,'statusMessage':_0x525a83[_0x20c0('0x70')]||'OK','headers':_0x525a83[_0x20c0('0x67')]||{},'body':_0x525a83[_0x20c0('0x63')]||{}};_0x45f1ad(null,_0xe08378);})[_0x20c0('0x13')](function(_0x563134){var _0x3c8744={'statusCode':_0x563134[_0x20c0('0x6f')]||0x1f4,'statusMessage':_0x563134['message']||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x563134[_0x20c0('0x71')]['headers']||{},'body':_0x563134[_0x20c0('0x71')][_0x20c0('0x63')]||{}};_0x45f1ad(null,_0x3c8744);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x72')]=function(_0x1f2408,_0x415137){scripts[_0x20c0('0x72')](this[_0x20c0('0xc')]['uniqueid'],_0x1f2408[_0x20c0('0x73')],_0x1f2408[_0x20c0('0x54')],_0x1f2408[_0x20c0('0x74')]||'en')[_0x20c0('0x10')](function(_0x540174){_0x415137(null,_0x540174);})['catch'](function(_0x5c28ad){_0x415137(_0x5c28ad);});};AGIVertices['prototype'][_0x20c0('0x75')]=function(_0x13c005,_0x4bb5df){scripts['googleDialogflowV2'](this[_0x20c0('0xc')]['uniqueid'],_0x13c005['dialogflowV2_project_id'],_0x13c005[_0x20c0('0x76')],_0x13c005[_0x20c0('0x77')],_0x13c005[_0x20c0('0x54')],_0x13c005[_0x20c0('0x78')]||'en')[_0x20c0('0x10')](function(_0x5d9308){_0x4bb5df(null,_0x5d9308);})[_0x20c0('0x13')](function(_0x3f5330){_0x4bb5df(_0x3f5330);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x79')]=function(_0xc7b414,_0x219940){scripts['sestekNDA'](this[_0x20c0('0xc')],_0xc7b414)[_0x20c0('0x10')](function(_0x57fc4b){_0x219940(null,_0x57fc4b);})[_0x20c0('0x13')](function(_0x159309){_0x219940(_0x159309);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x7a')]=function(_0x221018,_0x3ca6fc){scripts[_0x20c0('0x7a')](_0x221018[_0x20c0('0x73')],_0x221018[_0x20c0('0x54')],_0x221018[_0x20c0('0x7b')]||'en-US',_0x221018[_0x20c0('0x7c')])[_0x20c0('0x10')](function(_0x33e6c9){_0x3ca6fc(null,_0x33e6c9);})[_0x20c0('0x13')](function(_0x152f19){_0x3ca6fc(_0x152f19);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x7d')]=function(_0x23b6e8,_0x582ec4,_0x8c369f){scripts[_0x20c0('0x7d')](_0x582ec4,_0x23b6e8[_0x20c0('0x73')],_0x23b6e8[_0x20c0('0x7e')]||_0x20c0('0x55'),this[_0x20c0('0x7f')](_0x23b6e8[_0x20c0('0x80')])?_0x23b6e8[_0x20c0('0x80')]:undefined)['then'](function(_0x4c670c){_0x8c369f(null,_0x4c670c);})[_0x20c0('0x13')](function(_0x1d9116){_0x8c369f(_0x1d9116);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x81')]=function(_0x44add1,_0x59b9ee){scripts[_0x20c0('0x81')](_0x44add1[_0x20c0('0x82')],_0x44add1['aws_secret_access_key'],_0x44add1[_0x20c0('0x83')],_0x44add1[_0x20c0('0x84')]||_0x20c0('0x85'),_0x44add1[_0x20c0('0x54')],_0x44add1[_0x20c0('0x86')]||_0x20c0('0x54'))[_0x20c0('0x10')](function(_0x20b90a){_0x59b9ee(null,_0x20b90a);})['catch'](function(_0x2833f3){_0x59b9ee(_0x2833f3);});};AGIVertices['prototype'][_0x20c0('0x87')]=function(_0x3ec63a,_0x3747b1){scripts[_0x20c0('0x87')](this[_0x20c0('0xc')][_0x20c0('0x30')],_0x3ec63a['aws_access_key_id'],_0x3ec63a[_0x20c0('0x88')],_0x3ec63a[_0x20c0('0x89')],_0x3ec63a['text'],_0x3ec63a[_0x20c0('0x8a')])[_0x20c0('0x10')](function(_0x28c5ea){_0x3747b1(null,_0x28c5ea);})['catch'](function(_0x5e9d54){_0x3747b1(_0x5e9d54);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x8b')]=function(_0x16f70e,_0x223ede,_0x597b32){scripts[_0x20c0('0x8b')](_0x223ede,_0x16f70e[_0x20c0('0x73')],_0x16f70e[_0x20c0('0x8c')]||'en-US')[_0x20c0('0x10')](function(_0x1deed5){_0x597b32(null,_0x1deed5);})['catch'](function(_0x46423a){_0x597b32(_0x46423a);});};AGIVertices['prototype'][_0x20c0('0x8d')]=function(_0x193489,_0x280ce0,_0x485db3){scripts['tildeASR'](_0x280ce0,_0x193489[_0x20c0('0x8e')],_0x193489[_0x20c0('0x8f')],_0x193489[_0x20c0('0x6b')])[_0x20c0('0x10')](function(_0x2321a7){_0x485db3(null,_0x2321a7);})[_0x20c0('0x13')](function(_0x16341d){_0x485db3(_0x16341d);});};AGIVertices[_0x20c0('0x16')]['clear']=function(_0x5860ca){var _0x15b0c6=_[_0x20c0('0x5f')](verticesWithRetry,_0x5860ca[_0x20c0('0x32')])?_0x5860ca:_[_0x20c0('0x90')](_0x5860ca);for(var _0x16a426 in _0x15b0c6){if(_0x15b0c6[_0x20c0('0x91')](_0x16a426)){if(_0x15b0c6[_0x16a426]&&_[_0x20c0('0x92')](_0x15b0c6[_0x16a426])){if(_[_0x20c0('0x5f')](recursiveMapAttributes,_0x16a426)){_0x15b0c6[_0x16a426]=this[_0x20c0('0x93')](_0x15b0c6[_0x16a426]);}else{_0x15b0c6[_0x16a426]=this[_0x20c0('0x94')](_0x15b0c6[_0x16a426]);}}}}return _0x15b0c6;};AGIVertices[_0x20c0('0x16')]['recursiveNodeIndex']=function(_0x4c243e){for(var _0x4d1d09 in _0x4c243e){if(_0x4c243e[_0x20c0('0x91')](_0x4d1d09)){if(_[_0x20c0('0x95')](_0x4c243e[_0x4d1d09])){this[_0x20c0('0x96')](_0x4c243e[_0x4d1d09]);}else if(_['isArray'](_0x4c243e[_0x4d1d09])){for(var _0x177a33=0x0;_0x177a33<_0x4c243e[_0x4d1d09][_0x20c0('0x97')];_0x177a33++){this[_0x20c0('0x96')](_0x4c243e[_0x4d1d09][_0x177a33]);}}else if(_['isString'](_0x4c243e[_0x4d1d09])){_0x4c243e[_0x4d1d09]=this[_0x20c0('0x94')](_0x4c243e[_0x4d1d09]);}}}};AGIVertices[_0x20c0('0x16')][_0x20c0('0x98')]=function(_0x32cab3,_0x485997){for(var _0x12463d in _0x32cab3){if(_0x32cab3[_0x20c0('0x91')](_0x12463d)){if(_[_0x20c0('0x95')](_0x32cab3[_0x12463d])){if(!_[_0x20c0('0x3b')](_0x32cab3[_0x12463d])){this[_0x20c0('0x98')](_0x32cab3[_0x12463d],util[_0x20c0('0x4a')](_0x20c0('0x99'),_0x485997,_0x12463d));}}else if(_['isArray'](_0x32cab3[_0x12463d])){for(var _0x35ee82=0x0;_0x35ee82<_0x32cab3[_0x12463d][_0x20c0('0x97')];_0x35ee82++){this[_0x20c0('0x98')](_0x32cab3[_0x12463d][_0x35ee82],util[_0x20c0('0x4a')](_0x20c0('0x99'),_0x485997,_0x12463d+'['+_0x35ee82+']'));}}else{if(!_['isNil'](_0x32cab3[_0x12463d])){this[_0x20c0('0xc')][_0x20c0('0x9a')](util[_0x20c0('0x4a')](_0x20c0('0x99'),_0x485997,_0x12463d),_0x32cab3[_0x12463d]);}}}}};AGIVertices[_0x20c0('0x16')][_0x20c0('0x93')]=function(_0x43a157){try{var _0x1c1023=JSON[_0x20c0('0x65')](_0x43a157);this[_0x20c0('0x96')](_0x1c1023);return JSON[_0x20c0('0x6d')](_0x1c1023);}catch(_0x554f70){return this['replaceAllVariables'](_0x43a157);}};AGIVertices[_0x20c0('0x16')][_0x20c0('0x94')]=function(_0x49373f){var _0x41eadc=_0x49373f[_0x20c0('0x9b')]('{');for(var _0x518983=0x1;_0x518983<_0x41eadc[_0x20c0('0x97')];_0x518983+=0x1){var _0x5ef019=_0x41eadc[_0x518983][_0x20c0('0x9b')]('}');if(_0x5ef019[_0x20c0('0x97')]>0x1){_0x49373f=_0x49373f[_0x20c0('0x9c')]('{'+_0x5ef019[0x0]+'}',this[_0x20c0('0xc')][_0x20c0('0x9d')](_0x5ef019[0x0])[_0x20c0('0x9e')]||_0x5ef019[0x0]);}}if(_0x41eadc[_0x20c0('0x97')]===0x1){return _0x49373f['toString']();}return this[_0x20c0('0x94')](_0x49373f);};AGIVertices[_0x20c0('0x16')][_0x20c0('0x9f')]=function(_0x297a3e,_0x4d7b8f){var _0xaf0fe0=this[_0x20c0('0xc')][_0x20c0('0x9d')](_0x297a3e);if(_0xaf0fe0['result']===-0x1){return _0xaf0fe0;}logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0xa0'),_0x4d7b8f,_0xaf0fe0[_0x20c0('0x9e')]));return this['channel'][_0x20c0('0x9a')](_0x4d7b8f,_0xaf0fe0[_0x20c0('0x9e')]);};AGIVertices[_0x20c0('0x16')][_0x20c0('0x7f')]=function(_0x21a582){return _0x21a582&&_0x21a582!=='0'&&_0x21a582!=='-1'&&_0x21a582!=='';};AGIVertices[_0x20c0('0x16')][_0x20c0('0xa1')]=function(_0x306a52){this['createSquareDetailsReport'][_0x20c0('0x6a')](this,_0x306a52,'-');_0x306a52['retry']=_0x306a52[_0x20c0('0xa1')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x20c0('0x16')][_0x20c0('0xa2')]=function(_0x258898){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0xa3'),_0x258898['label']));if(!this[_0x20c0('0x7f')](_0x258898[_0x20c0('0x54')])){return this[_0x20c0('0xc')]['noop'](_0x20c0('0xa4'));}var _0x25e11c='\x22'+_0x258898[_0x20c0('0x54')]+'\x22';if(this[_0x20c0('0x7f')](_0x258898['options'])){_0x25e11c+=','+_0x258898['options'];}var _0x5c6483=this[_0x20c0('0xc')]['exec'](_0x20c0('0xa5'),_0x25e11c);if(_0x5c6483[_0x20c0('0xa6')]===-0x1){return _0x5c6483;}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xa8'),_0x25e11c));};AGIVertices[_0x20c0('0x16')][_0x20c0('0xa9')]=function(_0x5a7afb){logger['info'](util[_0x20c0('0x4a')](_0x20c0('0xaa'),_0x5a7afb[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x5a7afb[_0x20c0('0xab')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xac'));}var _0x534840=_0x5a7afb[_0x20c0('0xab')];if(this[_0x20c0('0x7f')](_0x5a7afb[_0x20c0('0x71')])){_0x534840+=','+_0x5a7afb[_0x20c0('0x71')];}var _0x4f9060=this[_0x20c0('0xc')][_0x20c0('0xad')](_0x20c0('0xae'),_0x534840);if(_0x4f9060[_0x20c0('0xa6')]===-0x1){return _0x4f9060;}var _0x385673=this[_0x20c0('0x9f')](_0x20c0('0xaf'),_0x20c0('0xb0'));if(_0x385673[_0x20c0('0xa6')]===-0x1){return _0x385673;}var _0x52e18b=this[_0x20c0('0x9f')](_0x20c0('0xb1'),'MRCP_RECOG_TRANSCRIPT');if(_0x52e18b[_0x20c0('0xa6')]===-0x1){return _0x52e18b;}var _0x518162=this['getAndSetVariable'](_0x20c0('0xb2'),_0x20c0('0xb3'));if(_0x518162[_0x20c0('0xa6')]===-0x1){return _0x518162;}return this['channel'][_0x20c0('0xa7')](util[_0x20c0('0x4a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x534840));};AGIVertices[_0x20c0('0x16')][_0x20c0('0x7')]=function(_0x4a7aaa){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0xb4'),_0x4a7aaa[_0x20c0('0x31')]));return this[_0x20c0('0xc')][_0x20c0('0x7')]([_0x4a7aaa[_0x20c0('0xb5')],_0x4a7aaa[_0x20c0('0xb6')]]);};AGIVertices[_0x20c0('0x16')][_0x20c0('0xb7')]=function(_0xe175a5){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0xb8'),_0xe175a5[_0x20c0('0x31')]));if(this[_0x20c0('0x7f')](_0xe175a5[_0x20c0('0x5d')])){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0xb9'),_0xe175a5[_0x20c0('0x5d')]));var _0x613d7=this[_0x20c0('0xc')][_0x20c0('0xba')](_0xe175a5[_0x20c0('0x5d')]);if(_0x613d7[_0x20c0('0xa6')]===-0x1){return _0x613d7;}}return this['channel'][_0x20c0('0xb7')]();};AGIVertices['prototype'][_0x20c0('0x41')]=function(_0x328a3a){logger['info'](util[_0x20c0('0x4a')](_0x20c0('0xbb'),_0x328a3a[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x328a3a[_0x20c0('0x40')])){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x328a3a,_0x20c0('0xbc'));}_0x328a3a[_0x20c0('0x42')]=moment();if(this[_0x20c0('0x7f')](_0x328a3a[_0x20c0('0xbd')])){_0x328a3a['scheduledAt']=moment()[_0x20c0('0xbe')](_0x328a3a[_0x20c0('0xbd')],_0x20c0('0xbf'));}if(!this[_0x20c0('0x7f')](_0x328a3a[_0x20c0('0x44')])){_0x328a3a[_0x20c0('0x44')]=0x2;}this['createCmContact']['sync'](this,_0x328a3a);return this[_0x20c0('0xc')][_0x20c0('0xa7')](util['format'](_0x20c0('0xc0'),_0x328a3a[_0x20c0('0xc1')],_0x328a3a[_0x20c0('0x40')],_0x328a3a[_0x20c0('0x42')]));};AGIVertices[_0x20c0('0x16')][_0x20c0('0xc2')]=function(_0x1c5cd0){logger['info'](util[_0x20c0('0x4a')](_0x20c0('0xc3'),_0x1c5cd0[_0x20c0('0x31')]));var _0x11acd2=this[_0x20c0('0xc')]['exec'](_0x1c5cd0[_0x20c0('0xc4')],_0x1c5cd0[_0x20c0('0x71')]);if(_0x11acd2['result']===-0x1){return _0x11acd2;}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xc5'),_0x1c5cd0['application'],_0x1c5cd0[_0x20c0('0x71')]));};AGIVertices[_0x20c0('0x16')]['lumenvoxtts']=function(_0x58ca8e){logger['info'](util[_0x20c0('0x4a')](_0x20c0('0xc6'),_0x58ca8e[_0x20c0('0x31')]));if(!this['isConfigured'](_0x58ca8e[_0x20c0('0x54')])){return this['channel']['noop'](_0x20c0('0xa4'));}var _0x5879e1='\x22'+_0x58ca8e['text']+'\x22';if(this['isConfigured'](_0x58ca8e[_0x20c0('0x71')])){_0x5879e1+=','+_0x58ca8e[_0x20c0('0x71')];}var _0x429542=this[_0x20c0('0xc')][_0x20c0('0xad')](_0x20c0('0xa5'),_0x5879e1);if(_0x429542[_0x20c0('0xa6')]===-0x1){return _0x429542;}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x5879e1));};AGIVertices[_0x20c0('0x16')][_0x20c0('0xc7')]=function(_0x209be0){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0xc8'),_0x209be0['label']));if(!this[_0x20c0('0x7f')](_0x209be0[_0x20c0('0x54')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')]('no\x20text\x20configured');}var _0x52549c='\x22'+_0x209be0[_0x20c0('0x54')]+'\x22';if(this[_0x20c0('0x7f')](_0x209be0[_0x20c0('0x71')])){_0x52549c+=','+_0x209be0[_0x20c0('0x71')];}var _0x2704d=this['channel'][_0x20c0('0xad')](_0x20c0('0xa5'),_0x52549c);if(_0x2704d[_0x20c0('0xa6')]===-0x1){return _0x2704d;}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xa8'),_0x52549c));};AGIVertices[_0x20c0('0x16')]['lumenvoxasr']=function(_0x425457){logger[_0x20c0('0x27')](util['format'](_0x20c0('0xc9'),_0x425457[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x425457[_0x20c0('0xab')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xac'));}var _0x2fa4e2=_0x425457[_0x20c0('0xab')];if(this[_0x20c0('0x7f')](_0x425457[_0x20c0('0x71')])){_0x2fa4e2+=','+_0x425457[_0x20c0('0x71')];}var _0x20e787=this[_0x20c0('0xc')][_0x20c0('0xad')](_0x20c0('0xae'),_0x2fa4e2);if(_0x20e787[_0x20c0('0xa6')]===-0x1){return _0x20e787;}var _0x59c0e5=this[_0x20c0('0x9f')](_0x20c0('0xaf'),_0x20c0('0xca'));if(_0x59c0e5[_0x20c0('0xa6')]===-0x1){return _0x59c0e5;}var _0x5f55be=this[_0x20c0('0x9f')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x5f55be['result']===-0x1){return _0x5f55be;}var _0x4fdd6f=this[_0x20c0('0x9f')]('RECOG_INSTANCE()',_0x20c0('0xcb'));if(_0x4fdd6f['result']===-0x1){return _0x4fdd6f;}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xcc'),_0x2fa4e2));};AGIVertices[_0x20c0('0x16')][_0x20c0('0xcd')]=function(_0x21737b){logger[_0x20c0('0x27')](util['format'](_0x20c0('0xce'),_0x21737b['label']));if(!this[_0x20c0('0x7f')](_0x21737b[_0x20c0('0xab')])){return this['channel'][_0x20c0('0xa7')](_0x20c0('0xac'));}var _0x2a27b7=_0x21737b['grammar'];if(this[_0x20c0('0x7f')](_0x21737b[_0x20c0('0x71')])){_0x2a27b7+=','+_0x21737b['options'];}var _0x49f305=this['channel'][_0x20c0('0xad')](_0x20c0('0xae'),_0x2a27b7);if(_0x49f305['result']===-0x1){return _0x49f305;}var _0x313c2f=this[_0x20c0('0x9f')](_0x20c0('0xaf'),_0x20c0('0xcf'));if(_0x313c2f[_0x20c0('0xa6')]===-0x1){return _0x313c2f;}var _0x18710d=this[_0x20c0('0x9f')](_0x20c0('0xb1'),_0x20c0('0xd0'));if(_0x18710d[_0x20c0('0xa6')]===-0x1){return _0x18710d;}var _0x345cfa=this['getAndSetVariable'](_0x20c0('0xb2'),_0x20c0('0xd1'));if(_0x345cfa[_0x20c0('0xa6')]===-0x1){return _0x345cfa;}return this['channel'][_0x20c0('0xa7')](util['format'](_0x20c0('0xcc'),_0x2a27b7));};AGIVertices[_0x20c0('0x16')][_0x20c0('0xd2')]=function(_0xefb28d){logger[_0x20c0('0x27')](util['format'](_0x20c0('0xd3'),_0xefb28d[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0xefb28d[_0x20c0('0xd4')])){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0xefb28d,'no\x20database\x20selected');}var _0xef71a7=this[_0x20c0('0x17')][_0x20c0('0x6a')](this,_0xefb28d['odbc_id']);if(!_0xef71a7){return this[_0x20c0('0xc')]['error'](_0xefb28d,_0x20c0('0xd5'));}if(!this['isConfigured'](_0xefb28d['query'])){return this['channel'][_0x20c0('0x26')](_0xefb28d,_0x20c0('0xd6'));}var _0x55d6d6=_0xefb28d[_0x20c0('0x28')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x20c0('0xc')]['noop'](util[_0x20c0('0x4a')]('query:\x20%s',_0x55d6d6));var _0x32e47c=this['getQueryOdbc'][_0x20c0('0x6a')](this,_0xef71a7,_0x55d6d6);this[_0x20c0('0x2f')][_0x20c0('0x6a')](this,_0xefb28d,_0x55d6d6);if(!this['isConfigured'](_0xefb28d[_0x20c0('0xd7')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xd8'));}var _0x33ff42=this[_0x20c0('0x9d')]['sync'](this,_0xefb28d['variable_id']);if(!_0x33ff42){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0xefb28d,_0x20c0('0xd9'));}var _0x3efe75=this;_0x32e47c[_0x20c0('0xda')](function(_0x59d4ff,_0x50dfcf){Object[_0x20c0('0xdb')](_0x59d4ff)[_0x20c0('0xda')](function(_0x34f819){_0x3efe75[_0x20c0('0xc')]['setVariable'](util['format'](_0x20c0('0xdc'),_0x33ff42,_0x50dfcf,_0x34f819),_0x59d4ff[_0x34f819]);});});this['channel'][_0x20c0('0x9a')](util['format'](_0x20c0('0xdd'),_0x33ff42),_0x32e47c[_0x20c0('0x97')]);return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xde'),_0x33ff42));};AGIVertices[_0x20c0('0x16')][_0x20c0('0xdf')]=function(_0x12be6e){logger[_0x20c0('0xe0')](util[_0x20c0('0x4a')](_0x20c0('0xe1'),_0x12be6e[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x12be6e[_0x20c0('0xe2')])){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x12be6e,'no\x20user\x20selected');}var _0x29ef07=this[_0x20c0('0x19')]['sync'](this,_0x12be6e[_0x20c0('0xe2')]);if(!_0x29ef07){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x12be6e,_0x20c0('0xe3'));}var _0x294b9e=this['channel'][_0x20c0('0xad')](_0x20c0('0xe4'),[util[_0x20c0('0x4a')]('SIP/%s',_0x29ef07),_0x12be6e[_0x20c0('0x5d')],_0x12be6e[_0x20c0('0xe5')],_0x12be6e[_0x20c0('0x5b')]]);if(_0x294b9e[_0x20c0('0xa6')]===-0x1){return _0x294b9e;}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xe6'),'DIAL'));};AGIVertices[_0x20c0('0x16')][_0x20c0('0xe7')]=function(_0x37f3f8){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0xe8'),_0x37f3f8[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x37f3f8[_0x20c0('0x73')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x37f3f8[_0x20c0('0x54')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')]('no\x20text\x20configured');}this[_0x20c0('0xc')][_0x20c0('0xe9')]=!![];this[_0x20c0('0x2f')](_0x37f3f8);this[_0x20c0('0x39')](_0x37f3f8[_0x20c0('0x54')],'in','','');this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xea'),_0x37f3f8['text']));var _0x5a0381=this[_0x20c0('0x72')][_0x20c0('0x6a')](this,_0x37f3f8);if(_0x5a0381){for(var _0x2ecd26 in _0x5a0381){if(_0x5a0381['hasOwnProperty'](_0x2ecd26)){this[_0x20c0('0xc')][_0x20c0('0x9a')](util[_0x20c0('0x4a')](_0x20c0('0xeb'),_0x2ecd26['toUpperCase']()),_0x5a0381[_0x2ecd26]);}}this[_0x20c0('0x39')](_0x5a0381[_0x20c0('0xec')],_0x20c0('0xed'),_0x20c0('0xe7'),'');return this[_0x20c0('0xc')][_0x20c0('0xa7')](util['format']('Dialogflow\x20Result\x20%s',_0x5a0381['speech']));}return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x37f3f8,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x20c0('0x16')]['dialogflowV2']=function(_0x12491f){logger['info'](util[_0x20c0('0x4a')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x12491f['label']));if(!this[_0x20c0('0x7f')](_0x12491f[_0x20c0('0xee')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xef'));}if(!this['isConfigured'](_0x12491f['client_email'])){return this['channel'][_0x20c0('0xa7')](_0x20c0('0xf0'));}if(!this[_0x20c0('0x7f')](_0x12491f[_0x20c0('0x77')])){return this['channel'][_0x20c0('0xa7')](_0x20c0('0xf1'));}if(!this['isConfigured'](_0x12491f[_0x20c0('0x78')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xf2'));}if(!this[_0x20c0('0x7f')](_0x12491f[_0x20c0('0x54')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xa4'));}this[_0x20c0('0xc')][_0x20c0('0xe9')]=!![];this[_0x20c0('0x2f')](_0x12491f);this[_0x20c0('0x39')](_0x12491f[_0x20c0('0x54')],'in','','');this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xf3'),_0x12491f[_0x20c0('0x54')]));var _0x2302e2=this['googleDialogflowV2'][_0x20c0('0x6a')](this,_0x12491f);if(_0x2302e2){for(var _0x3d6a26 in _0x2302e2){if(_0x2302e2[_0x20c0('0x91')](_0x3d6a26)){if(_0x3d6a26!==_0x20c0('0xf4')){this['channel'][_0x20c0('0x9a')](util[_0x20c0('0x4a')](_0x20c0('0xeb'),_0x3d6a26[_0x20c0('0x62')]()),_0x2302e2[_0x3d6a26]);}}}this['createSquareMessage'](_0x2302e2[_0x20c0('0xec')],'out',_0x20c0('0xf5'),_0x2302e2[_0x20c0('0xf4')]);return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')]('DialogflowV2\x20Result\x20%s',_0x2302e2[_0x20c0('0xec')]));}return this['channel'][_0x20c0('0x26')](_0x12491f,_0x20c0('0xf6'));};AGIVertices['prototype'][_0x20c0('0xf7')]=function(_0x3477ad){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0xf8'),_0x3477ad['label']));if(!this[_0x20c0('0x7f')](_0x3477ad[_0x20c0('0xf9')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xfa'));}if(!this[_0x20c0('0x7f')](_0x3477ad['username'])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xfb'));}if(!this[_0x20c0('0x7f')](_0x3477ad[_0x20c0('0xfc')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xfd'));}if(!this[_0x20c0('0x7f')](_0x3477ad[_0x20c0('0xfe')])){return this[_0x20c0('0xc')]['noop']('no\x20text\x20configured');}this[_0x20c0('0xc')]['bot']=!![];this[_0x20c0('0x2f')](_0x3477ad);this[_0x20c0('0x39')](_0x3477ad[_0x20c0('0x54')],'in','','');this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xff'),_0x3477ad[_0x20c0('0x54')]));var _0x36df58=this[_0x20c0('0x79')][_0x20c0('0x6a')](this,_0x3477ad);if(_0x36df58){for(var _0x4b916d in _0x36df58){if(_0x36df58[_0x20c0('0x91')](_0x4b916d)){this[_0x20c0('0xc')]['setVariable'](util['format']('SESTEK_NDA_%s',_0x4b916d[_0x20c0('0x62')]()),_0x36df58[_0x4b916d]);}}this[_0x20c0('0x39')](_0x36df58[_0x20c0('0xec')],_0x20c0('0xed'),_0x20c0('0xf7'),'');if(_0x36df58[_0x20c0('0x100')]){this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x101'),_0x36df58['audiofile']));var _0x255879=this[_0x20c0('0xc')][_0x20c0('0x102')](_0x36df58[_0x20c0('0x100')]);try{fs['unlink'](_0x36df58[_0x20c0('0x100')]+_0x20c0('0x103'));}catch(_0x480dc3){logger['error'](_0x480dc3);}return _0x255879;}else{return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')]('SestekNDA\x20Result\x20%s',_0x36df58[_0x20c0('0xec')]));}}return this['channel'][_0x20c0('0x26')](_0x3477ad,_0x20c0('0x104'));};AGIVertices[_0x20c0('0x16')]['end']=function(_0x363c68){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x105'),_0x363c68[_0x20c0('0x31')]));return this['channel'][_0x20c0('0xa7')](_0x20c0('0x106'));};AGIVertices['prototype'][_0x20c0('0x107')]=function(_0x19d920){logger['info'](util[_0x20c0('0x4a')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x19d920[_0x20c0('0x31')]));var _0x5071b1='';if(_0x19d920[_0x20c0('0x108')]){if(!this[_0x20c0('0x7f')](_0x19d920['trunk_id'])){return this['channel']['error'](_0x19d920,_0x20c0('0x109'));}else{var _0x3ddec0=parseInt(_0x19d920['trunk_id'],0xa);if(isNaN(_0x3ddec0)){_0x5071b1=_0x19d920['trunk_id'];}else{_0x5071b1=this[_0x20c0('0x1b')][_0x20c0('0x6a')](this,_0x19d920[_0x20c0('0x108')]);if(!_0x5071b1){return this[_0x20c0('0xc')]['error'](_0x19d920,_0x20c0('0x10a'));}}}}else if(_0x19d920[_0x20c0('0x10b')]){_0x5071b1=_0x19d920['trunk_name'];}else{return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x19d920,_0x20c0('0x109'));}var _0x48f9b7=this[_0x20c0('0xc')][_0x20c0('0xad')](_0x20c0('0xe4'),[util[_0x20c0('0x4a')](_0x20c0('0x10c'),_0x5071b1,_0x19d920[_0x20c0('0xc1')]),_0x19d920['timeout'],_0x19d920['opts'],_0x19d920[_0x20c0('0x5b')]]);if(_0x48f9b7[_0x20c0('0xa6')]===-0x1){return _0x48f9b7;}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xe6'),_0x20c0('0xe4')));};AGIVertices[_0x20c0('0x16')][_0x20c0('0x10d')]=function(_0x191987){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x191987['label']));return this['channel'][_0x20c0('0xa7')]('finally');};AGIVertices[_0x20c0('0x16')][_0x20c0('0x10e')]=function(_0x14ee0d){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x14ee0d[_0x20c0('0x31')]));if(_0x14ee0d[_0x20c0('0x10f')]===0x0){return this['maxRetry'](_0x14ee0d);}_0x14ee0d['retry']-=0x1;if(!this[_0x20c0('0x7f')](_0x14ee0d[_0x20c0('0x110')])){return this['channel'][_0x20c0('0x26')](_0x14ee0d,_0x20c0('0x111'));}var _0x10812b=this[_0x20c0('0x112')][_0x20c0('0x6a')](this,_0x14ee0d[_0x20c0('0x110')]);if(!_0x10812b){return this['channel'][_0x20c0('0x26')](_0x14ee0d,_0x20c0('0x113'));}if(!this[_0x20c0('0x7f')](_0x14ee0d[_0x20c0('0xd7')])){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x20c0('0xd8'));}var _0x413740=this['channel'][_0x20c0('0x114')](_0x10812b,_0x14ee0d['response'],_0x14ee0d['maxdigit']);var _0x5d2eb1=_0x413740[_0x20c0('0xa6')]?_0x413740['result'][_0x20c0('0x43')]():'';logger[_0x20c0('0x27')](_0x20c0('0x115'),JSON['stringify'](_0x413740));if(_0x413740['result']===-0x1){this[_0x20c0('0x2f')]['sync'](this,_0x14ee0d,_0x5d2eb1);return _0x413740;}else if(_0x413740[_0x20c0('0x9e')]===_0x20c0('0x5d')){_0x413740[_0x20c0('0xa6')]=_0x5d2eb1['length']>=parseInt(_0x14ee0d[_0x20c0('0x116')])?'x':'i';}else{_0x413740[_0x20c0('0xa6')]=_0x5d2eb1[_0x20c0('0x97')]>=parseInt(_0x14ee0d[_0x20c0('0x116')])&&_0x5d2eb1[_0x20c0('0x97')]<=parseInt(_0x14ee0d[_0x20c0('0x117')])?'x':'i';}var _0x18657e=this['getVariable']['sync'](this,_0x14ee0d[_0x20c0('0xd7')]);if(!_0x18657e){return this['channel']['error'](_0x14ee0d,_0x20c0('0xd9'));}this[_0x20c0('0xc')][_0x20c0('0x9a')](_0x18657e,_0x5d2eb1);if(this[_0x20c0('0x7f')](_0x14ee0d['hiddendigitsnum'])){var _0x438284=parseInt(_0x14ee0d[_0x20c0('0x118')],0xa);var _0x594a02=rs[_0x20c0('0x119')]({'charset':'*','length':_0x438284});var _0x18c9a4=_0x5d2eb1[_0x20c0('0x97')];if(_0x18c9a4>0x0){if(_0x18c9a4>_0x438284){this[_0x20c0('0x2f')]['sync'](this,_0x14ee0d,_0x14ee0d[_0x20c0('0x11a')]===_0x20c0('0x11b')?_0x594a02+_0x5d2eb1[_0x20c0('0x11c')](_0x438284):_0x5d2eb1[_0x20c0('0x11c')](0x0,_0x18c9a4-_0x438284)+_0x594a02);}else{this[_0x20c0('0x2f')][_0x20c0('0x6a')](this,_0x14ee0d,rs[_0x20c0('0x119')]({'charset':'*','length':_0x18c9a4}));}}else{this[_0x20c0('0x2f')][_0x20c0('0x6a')](this,_0x14ee0d,'');}}else{this[_0x20c0('0x2f')][_0x20c0('0x6a')](this,_0x14ee0d,_0x5d2eb1);}return _0x413740;};AGIVertices[_0x20c0('0x16')][_0x20c0('0x11d')]=function(_0x152a3f){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x11e'),_0x152a3f['label']));return this[_0x20c0('0x10e')](_0x152a3f);};AGIVertices[_0x20c0('0x16')][_0x20c0('0x11f')]=function(_0x228cb5){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x120'),_0x228cb5[_0x20c0('0x31')]));this[_0x20c0('0x2f')][_0x20c0('0x6a')](this,_0x228cb5,_0x228cb5[_0x20c0('0x121')]);return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x122'),_0x228cb5[_0x20c0('0x121')]));};AGIVertices[_0x20c0('0x16')][_0x20c0('0x123')]=function(_0x3f75ec){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x124'),_0x3f75ec[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x3f75ec[_0x20c0('0x82')])||!this[_0x20c0('0x7f')](_0x3f75ec[_0x20c0('0x88')])){return this['channel']['noop'](_0x20c0('0x125'));}if(!this['isConfigured'](_0x3f75ec[_0x20c0('0x54')])){return this['channel']['noop'](_0x20c0('0xa4'));}this['channel'][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x126'),_0x3f75ec['text']));var _0x409ba4=this['awsPolly'][_0x20c0('0x6a')](this,_0x3f75ec);if(_0x409ba4){this[_0x20c0('0xc')][_0x20c0('0xa7')](util['format'](_0x20c0('0x127'),_0x409ba4));var _0x2cce60=this[_0x20c0('0xc')][_0x20c0('0x102')](_0x409ba4);try{fs[_0x20c0('0x128')](_0x409ba4+_0x20c0('0x103'));}catch(_0x4933ed){logger[_0x20c0('0x26')](_0x4933ed);}return _0x2cce60;}return this[_0x20c0('0xc')]['error'](_0x3f75ec,_0x20c0('0x129'));};AGIVertices['prototype'][_0x20c0('0x12a')]=function(_0x5a0086){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x12b'),_0x5a0086[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x5a0086['aws_access_key_id'])||!this[_0x20c0('0x7f')](_0x5a0086[_0x20c0('0x88')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x20c0('0x7f')](_0x5a0086[_0x20c0('0x8a')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0x12c'));}if(!this[_0x20c0('0x7f')](_0x5a0086[_0x20c0('0x54')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xa4'));}this[_0x20c0('0xc')][_0x20c0('0xe9')]=!![];this[_0x20c0('0x2f')](_0x5a0086);this[_0x20c0('0x39')](_0x5a0086[_0x20c0('0x54')],'in','','');this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x12d'),_0x5a0086['text']));var _0x39d59a=this[_0x20c0('0x87')][_0x20c0('0x6a')](this,_0x5a0086);if(_0x39d59a){for(var _0x416b29 in _0x39d59a){if(_0x39d59a[_0x20c0('0x91')](_0x416b29)&&_[_0x20c0('0x92')](_0x39d59a[_0x416b29])){this[_0x20c0('0xc')][_0x20c0('0x9a')](util['format'](_0x20c0('0x12e'),_0x416b29[_0x20c0('0x62')]()),_0x39d59a[_0x416b29]);}}if(_[_0x20c0('0x3c')](_0x39d59a[_0x20c0('0x12f')])){return this['channel'][_0x20c0('0xa7')](_0x20c0('0x130'));}else{this['createSquareMessage'](_0x39d59a[_0x20c0('0x12f')],_0x20c0('0xed'),'amazonlex','');return this['channel'][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x131'),_0x39d59a[_0x20c0('0x12f')]));}}return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x5a0086,_0x20c0('0x132'));};AGIVertices[_0x20c0('0x16')][_0x20c0('0x133')]=function(_0x35d0f5){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x134'),_0x35d0f5['label'],_0x35d0f5[_0x20c0('0x5d')]));if(!this['isConfigured'](_0x35d0f5[_0x20c0('0x73')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0x135'));}var _0x2dd5f8='wav';var _0x19d5ad=util['format'](_0x20c0('0x136'),FILES_PATH,rs[_0x20c0('0x119')](0x4));var _0x1309e2=util[_0x20c0('0x4a')]('%s.%s',_0x19d5ad,_0x2dd5f8);var _0x42e95d=!![];if(_0x35d0f5[_0x20c0('0x137')]===_0x20c0('0x138')){_0x42e95d=![];}var _0x44c23d=this[_0x20c0('0xc')][_0x20c0('0x139')](_0x19d5ad,_0x2dd5f8,_0x35d0f5[_0x20c0('0x13a')],_0x35d0f5[_0x20c0('0x5d')],undefined,_0x42e95d);if(_0x44c23d[_0x20c0('0xa6')]!==-0x1){this['channel'][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x13b'),_0x1309e2));var _0x343341=this[_0x20c0('0x8b')][_0x20c0('0x6a')](this,_0x35d0f5,_0x1309e2);if(_0x343341){for(var _0x3753a0 in _0x343341){if(_0x343341[_0x20c0('0x91')](_0x3753a0)){this[_0x20c0('0xc')][_0x20c0('0x9a')](util['format']('GOOGLE_ASR_%s',_0x3753a0[_0x20c0('0x62')]()),_0x343341[_0x3753a0]);}}return this['channel'][_0x20c0('0xa7')](util['format'](_0x20c0('0x13c'),JSON[_0x20c0('0x6d')](_0x343341)));}}return _0x44c23d;};AGIVertices[_0x20c0('0x16')][_0x20c0('0x13d')]=function(_0x1229ce){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x13e'),_0x1229ce[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x1229ce[_0x20c0('0x8e')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0x13f'));}if(!this[_0x20c0('0x7f')](_0x1229ce[_0x20c0('0x8f')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0x140'));}var _0x5896f4=_0x20c0('0x141');var _0x369c08=util[_0x20c0('0x4a')]('%s/recordings/%s',FILES_PATH,rs[_0x20c0('0x119')](0x4));var _0x2b5038=util['format'](_0x20c0('0x99'),_0x369c08,_0x5896f4);var _0x5d1e4c=!![];if(_0x1229ce[_0x20c0('0x137')]===_0x20c0('0x138')){_0x5d1e4c=![];}var _0x45c7d3=this[_0x20c0('0xc')]['recordFile'](_0x369c08,_0x5896f4,_0x1229ce[_0x20c0('0x13a')],_0x1229ce[_0x20c0('0x5d')],undefined,_0x5d1e4c);if(_0x45c7d3[_0x20c0('0xa6')]!==-0x1){this['channel']['noop'](util['format']('tilde\x20%s\x20file\x20created',_0x2b5038));var _0x260f37=this[_0x20c0('0x8d')][_0x20c0('0x6a')](this,_0x1229ce,_0x2b5038);if(_0x260f37){for(var _0x52ee9e in _0x260f37){if(_0x260f37['hasOwnProperty'](_0x52ee9e)){this[_0x20c0('0xc')][_0x20c0('0x9a')](util[_0x20c0('0x4a')](_0x20c0('0x142'),_0x52ee9e[_0x20c0('0x62')]()),_0x260f37[_0x52ee9e]);}}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x143'),JSON['stringify'](_0x260f37)));}}return _0x45c7d3;};AGIVertices[_0x20c0('0x16')][_0x20c0('0x144')]=function(_0x22d20d){logger['info'](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x22d20d[_0x20c0('0x31')]));return this[_0x20c0('0xc')][_0x20c0('0x145')](_0x22d20d['context'],_0x22d20d[_0x20c0('0x37')],_0x22d20d['priority']);};AGIVertices['prototype'][_0x20c0('0x146')]=function(_0x3aa080){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x3aa080['label']));if(!this['isConfigured'](_0x3aa080[_0x20c0('0x147')])){return this[_0x20c0('0xc')]['error'](_0x3aa080,_0x20c0('0x148'));}try{var _0x1c73bb=eval(_0x3aa080[_0x20c0('0x147')])?_0x20c0('0x149'):_0x20c0('0x14a');this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x14b'),_0x3aa080['condition'],_0x1c73bb));return{'code':0xc8,'result':_0x1c73bb};}catch(_0x5aa61e){return{'code':0xc8,'result':_0x20c0('0x14a')};}};AGIVertices[_0x20c0('0x16')]['gotoiftime']=function(_0x170250){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x14c'),_0x170250[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x170250[_0x20c0('0x14d')])){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x170250,_0x20c0('0x14e'));}var _0x5e6287=this['getIntervals']['sync'](this,_0x170250[_0x20c0('0x14d')]);if(!_0x5e6287){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x170250,_0x20c0('0x14f'));}for(var _0x2bc733=0x0;_0x2bc733<_0x5e6287[_0x20c0('0x97')];_0x2bc733+=0x1){var _0x100164=this['channel'][_0x20c0('0x9d')](util[_0x20c0('0x4a')](_0x20c0('0x150'),_0x5e6287[_0x2bc733]));if(_0x100164['result']===-0x1){return _0x100164;}logger['info'](util['format'](_0x20c0('0x151'),_0x5e6287[_0x2bc733],_0x100164[_0x20c0('0x9e')]));if(_0x100164[_0x20c0('0x9e')]===_0x20c0('0x149')){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x151'),_0x5e6287[_0x2bc733],'true'));this['channel'][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x151'),_0x5e6287[_0x2bc733],_0x20c0('0x149')));return{'code':0xc8,'result':_0x20c0('0x149')};}else{logger[_0x20c0('0x27')](util[_0x20c0('0x4a')]('IFTIME\x20%s\x20%s',_0x5e6287[_0x2bc733],_0x20c0('0x14a')));this['channel'][_0x20c0('0xa7')](util[_0x20c0('0x4a')]('IFTIME\x20%s\x20%s',_0x5e6287[_0x2bc733],_0x20c0('0x14a')));}}return{'code':0xc8,'result':_0x20c0('0x14a')};};AGIVertices[_0x20c0('0x16')][_0x20c0('0x152')]=function(_0x319c82){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x319c82[_0x20c0('0x31')]));return this[_0x20c0('0xc')]['hangup']();};AGIVertices['prototype']['ispeechasr']=function(_0x4ed9a8){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x153'),_0x4ed9a8['label']));if(!this[_0x20c0('0x7f')](_0x4ed9a8[_0x20c0('0x73')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')]('no\x20key\x20configured');}var _0xf684f2=_0x20c0('0x141');var _0x379477=util[_0x20c0('0x4a')](_0x20c0('0x136'),FILES_PATH,rs['generate'](0x4));var _0x316f0a=util[_0x20c0('0x4a')](_0x20c0('0x99'),_0x379477,_0xf684f2);var _0x110797=!![];if(_0x4ed9a8['beep']==='NOBEEP'){_0x110797=![];}var _0x27ebd2=this[_0x20c0('0xc')]['recordFile'](_0x379477,_0xf684f2,_0x4ed9a8['intKey'],_0x4ed9a8[_0x20c0('0x5d')],undefined,_0x110797);if(_0x27ebd2[_0x20c0('0xa6')]!==-0x1){this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x154'),_0x316f0a));var _0xb995e5=this['ispeechASR']['sync'](this,_0x4ed9a8,_0x316f0a);if(_0xb995e5){for(var _0x250e4d in _0xb995e5){if(_0xb995e5['hasOwnProperty'](_0x250e4d)){this['channel'][_0x20c0('0x9a')](util[_0x20c0('0x4a')](_0x20c0('0x155'),_0x250e4d[_0x20c0('0x62')]()),_0xb995e5[_0x250e4d]);}}return this[_0x20c0('0xc')]['noop'](util[_0x20c0('0x4a')](_0x20c0('0x156'),JSON[_0x20c0('0x6d')](_0xb995e5)));}}return _0x27ebd2;};AGIVertices['prototype']['ispeechtts']=function(_0x15c6c3){logger['info'](util[_0x20c0('0x4a')](_0x20c0('0x157'),_0x15c6c3[_0x20c0('0x31')]));if(!this['isConfigured'](_0x15c6c3[_0x20c0('0x73')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0x135'));}if(!this[_0x20c0('0x7f')](_0x15c6c3[_0x20c0('0x54')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xa4'));}this[_0x20c0('0xc')]['noop'](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x15c6c3[_0x20c0('0x54')]));var _0x4de334=this[_0x20c0('0x7a')][_0x20c0('0x6a')](this,_0x15c6c3);if(_0x4de334){this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x154'),_0x4de334));var _0x2403e2=this[_0x20c0('0xc')]['streamFile'](_0x4de334,_0x15c6c3[_0x20c0('0x13a')]);try{fs['unlink'](_0x4de334+'.wav');}catch(_0x131cdf){logger['error'](_0x131cdf);}return _0x2403e2;}return this['channel'][_0x20c0('0x26')](_0x15c6c3,_0x20c0('0x158'));};AGIVertices['prototype'][_0x20c0('0x159')]=function(_0x1c995b){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x15a'),_0x1c995b[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x1c995b[_0x20c0('0x15b')])){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x1c995b,_0x20c0('0x15c'));}logger[_0x20c0('0x27')](util[_0x20c0('0x4a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x20c0('0xc')][_0x20c0('0x35')],_0x1c995b['findBy']));var _0x2c773c=this[_0x20c0('0x4d')][_0x20c0('0x6a')](this,_0x1c995b[_0x20c0('0x15b')]);if(_0x2c773c){logger['info'](util[_0x20c0('0x4a')](_0x20c0('0x15d'),this[_0x20c0('0xc')][_0x20c0('0x35')],_0x1c995b[_0x20c0('0x15b')]));this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x20c0('0x35')],_0x1c995b['findBy']));return{'code':0xc8,'result':_0x20c0('0x15e')};}else{logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x15f'),this['channel'][_0x20c0('0x35')],_0x1c995b[_0x20c0('0x15b')]));this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x20c0('0xc')][_0x20c0('0x35')],_0x1c995b[_0x20c0('0x15b')]));return{'code':0xc8,'result':_0x20c0('0x160')};}};AGIVertices['prototype']['logout']=function(_0x3c9a79){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x161'),_0x3c9a79[_0x20c0('0x31')]));if(!this['isConfigured'](_0x3c9a79[_0x20c0('0x15b')])){return this['channel'][_0x20c0('0x26')](_0x3c9a79,'no\x20find\x20by\x20configured');}logger['info'](util[_0x20c0('0x4a')](_0x20c0('0x162'),this[_0x20c0('0xc')][_0x20c0('0x35')],_0x3c9a79['findBy']));var _0x46cb2f=this[_0x20c0('0x48')][_0x20c0('0x6a')](this,_0x3c9a79[_0x20c0('0x15b')]);if(_0x46cb2f){logger[_0x20c0('0x27')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x20c0('0x35')],_0x3c9a79[_0x20c0('0x15b')]));this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x15d'),this['channel']['callerid'],_0x3c9a79['findBy']));return{'code':0xc8,'result':_0x20c0('0x15e')};}else{logger['info'](util['format'](_0x20c0('0x15f'),this[_0x20c0('0xc')][_0x20c0('0x35')],_0x3c9a79[_0x20c0('0x15b')]));this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x15f'),this[_0x20c0('0xc')][_0x20c0('0x35')],_0x3c9a79[_0x20c0('0x15b')]));return{'code':0xc8,'result':_0x20c0('0x160')};}};AGIVertices[_0x20c0('0x16')][_0x20c0('0x163')]=function(_0x3acde3){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x164'),_0x3acde3[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x3acde3[_0x20c0('0x165')])){return this['channel'][_0x20c0('0x26')](_0x3acde3,'no\x20operation\x20configured');}this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x166'),_0x3acde3[_0x20c0('0x165')]));var _0x34ba7a=eval(_0x3acde3[_0x20c0('0x165')]);if(!this[_0x20c0('0x7f')](_0x3acde3['variable_id'])){return this[_0x20c0('0xc')]['noop'](_0x20c0('0xd8'));}var _0x5b27f7=this[_0x20c0('0x9d')][_0x20c0('0x6a')](this,_0x3acde3['variable_id']);if(!_0x5b27f7){return this['channel'][_0x20c0('0x26')](_0x3acde3,_0x20c0('0xd9'));}if(_[_0x20c0('0x167')](_0x34ba7a)){var _0x3eabfd=this;_0x34ba7a['forEach'](function(_0x2ad78a,_0x519258){_0x3eabfd[_0x20c0('0xc')][_0x20c0('0x9a')](util[_0x20c0('0x4a')](_0x20c0('0x168'),_0x5b27f7,_0x519258),_0x2ad78a);});return this[_0x20c0('0xc')]['noop'](util[_0x20c0('0x4a')](_0x20c0('0x169'),_0x5b27f7));}else{return this['channel'][_0x20c0('0x9a')](_0x5b27f7,_0x34ba7a);}};AGIVertices['prototype']['menu']=function(_0x1d75af){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x1d75af[_0x20c0('0x31')]));if(_0x1d75af['retry']===0x0){return this['maxRetry'](_0x1d75af);}_0x1d75af[_0x20c0('0x10f')]-=0x1;if(!this[_0x20c0('0x7f')](_0x1d75af[_0x20c0('0x110')])){return this['channel'][_0x20c0('0x26')](_0x1d75af,_0x20c0('0x111'));}var _0x4dc355=this[_0x20c0('0x112')]['sync'](this,_0x1d75af[_0x20c0('0x110')]);if(!_0x4dc355){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x1d75af,_0x20c0('0x113'));}var _0x1ff8a5=this['channel'][_0x20c0('0x114')](_0x4dc355,_0x1d75af[_0x20c0('0x16a')],_0x1d75af['digit']);var _0x474bcc=_0x1ff8a5['result'];if(_0x1ff8a5[_0x20c0('0xa6')]===-0x1){this[_0x20c0('0x2f')][_0x20c0('0x6a')](this,_0x1d75af,'-1');return _0x1ff8a5;}else if(_0x1ff8a5[_0x20c0('0x9e')]===_0x20c0('0x5d')){_0x1ff8a5['result']=_0x1ff8a5[_0x20c0('0xa6')][_0x20c0('0x97')]>0x0?_0x1ff8a5['result']:'t';}else if(_[_0x20c0('0x3b')](_0x1ff8a5[_0x20c0('0xa6')])){_0x1ff8a5[_0x20c0('0xa6')]='#';_0x474bcc='#';}if(!this['isConfigured'](_0x1d75af[_0x20c0('0xd7')])){this[_0x20c0('0xc')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x237d52=this[_0x20c0('0x9d')][_0x20c0('0x6a')](this,_0x1d75af['variable_id']);if(!_0x237d52){return this[_0x20c0('0xc')]['error'](_0x1d75af,_0x20c0('0xd9'));}this[_0x20c0('0xc')][_0x20c0('0x9a')](_0x237d52,_0x474bcc);}this['createSquareDetailsReport'][_0x20c0('0x6a')](this,_0x1d75af,_0x474bcc);return _0x1ff8a5;};AGIVertices[_0x20c0('0x16')][_0x20c0('0xa7')]=function(_0x432f7a){logger[_0x20c0('0x27')](util['format'](_0x20c0('0x16b'),_0x432f7a[_0x20c0('0x31')]));return this[_0x20c0('0xc')]['noop'](_0x432f7a['output']||_0x432f7a['label']);};AGIVertices[_0x20c0('0x16')][_0x20c0('0x16c')]=function(_0x15014c){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x16d'),_0x15014c['label']));if(!this[_0x20c0('0x7f')](_0x15014c[_0x20c0('0x15b')])){return this[_0x20c0('0xc')]['error'](_0x15014c,_0x20c0('0x15c'));}logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x162'),this[_0x20c0('0xc')][_0x20c0('0x35')],_0x15014c['findBy']));var _0x22eb47=this[_0x20c0('0x45')]['sync'](this,_0x15014c[_0x20c0('0x16e')]);var _0xc91f48=this[_0x20c0('0x16f')][_0x20c0('0x6a')](this,_0x15014c[_0x20c0('0x15b')],_0x22eb47);if(_0xc91f48){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x15d'),this[_0x20c0('0xc')][_0x20c0('0x35')],_0x15014c[_0x20c0('0x15b')]));this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x15d'),this[_0x20c0('0xc')][_0x20c0('0x35')],_0x15014c[_0x20c0('0x15b')]));return{'code':0xc8,'result':_0x20c0('0x15e')};}else{logger[_0x20c0('0x27')](util['format'](_0x20c0('0x15f'),this[_0x20c0('0xc')][_0x20c0('0x35')],_0x15014c[_0x20c0('0x15b')]));this[_0x20c0('0xc')]['noop'](util[_0x20c0('0x4a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x20c0('0xc')]['callerid'],_0x15014c['findBy']));return{'code':0xc8,'result':_0x20c0('0x160')};}};AGIVertices[_0x20c0('0x16')][_0x20c0('0x170')]=function(_0x53cf76){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x171'),_0x53cf76['label']));if(!this[_0x20c0('0x7f')](_0x53cf76[_0x20c0('0x110')])){return this['channel']['error'](_0x53cf76,_0x20c0('0x111'));}var _0x59bb6a=this[_0x20c0('0x112')]['sync'](this,_0x53cf76[_0x20c0('0x110')]);if(!_0x59bb6a){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x53cf76,_0x20c0('0x113'));}var _0x16414d=this[_0x20c0('0xc')]['exec'](_0x20c0('0x172'),[_0x59bb6a,_0x53cf76[_0x20c0('0xe5')]]);if(_0x16414d['result']===-0x1){return _0x16414d;}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xc5'),_0x20c0('0x172'),_0x59bb6a));};AGIVertices[_0x20c0('0x16')][_0x20c0('0x173')]=function(_0x5e0ad6){logger['info'](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x5e0ad6[_0x20c0('0x31')]));if(!this['isConfigured'](_0x5e0ad6[_0x20c0('0x174')])){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x5e0ad6,_0x20c0('0x175'));}var _0x49d65a='';var _0xe21f5d=parseInt(_0x5e0ad6['queue_id'],0xa);if(isNaN(_0xe21f5d)){_0x49d65a=_0x5e0ad6[_0x20c0('0x174')];}else{_0x49d65a=this[_0x20c0('0x176')][_0x20c0('0x6a')](this,_0x5e0ad6['queue_id']);if(!_0x49d65a){return this['channel']['error'](_0x5e0ad6,'no\x20queue\x20found');}}var _0x28ecfa='';if(this[_0x20c0('0x7f')](_0x5e0ad6[_0x20c0('0x110')])){var _0x20a651=this[_0x20c0('0x112')][_0x20c0('0x6a')](this,_0x5e0ad6[_0x20c0('0x110')]);if(_0x20a651){_0x28ecfa=_0x20a651;}}this['createSquareDetailsReport'][_0x20c0('0x6a')](this,_0x5e0ad6,_0x49d65a);if(_0x5e0ad6[_0x20c0('0xe5')]['indexOf']('x')<0x0){_0x5e0ad6[_0x20c0('0xe5')]+='x';}if(_0x5e0ad6[_0x20c0('0xe5')][_0x20c0('0x177')]('X')<0x0){_0x5e0ad6[_0x20c0('0xe5')]+='X';}this[_0x20c0('0xc')][_0x20c0('0x9a')]('XMCS-QUEUE',_0x49d65a?_0x49d65a['toLowerCase']():'');var _0x236c45=this[_0x20c0('0xc')]['exec']('QUEUE',[_0x49d65a,_0x5e0ad6[_0x20c0('0xe5')],_0x5e0ad6[_0x20c0('0x5b')],_0x28ecfa,_0x5e0ad6[_0x20c0('0x5d')],_0x5e0ad6['agi'],_0x5e0ad6[_0x20c0('0x178')],_0x5e0ad6['gosub'],'',_0x5e0ad6[_0x20c0('0x179')]]);if(_0x236c45[_0x20c0('0xa6')]===-0x1){return _0x236c45;}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x49d65a));};AGIVertices[_0x20c0('0x16')][_0x20c0('0x17a')]=function(_0x4867f9){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x17b'),_0x4867f9[_0x20c0('0x31')]));var _0x12d38a=_0x4867f9[_0x20c0('0x17c')]||_0x20c0('0x141');var _0x1794da=util['format'](_0x20c0('0x17d'),this['channel'][_0x20c0('0x30')],rs[_0x20c0('0x119')](0x5));var _0x41900a=util[_0x20c0('0x4a')](_0x20c0('0x17e'),FILES_PATH,_0x1794da,_0x12d38a);var _0x2805c3=util['format'](_0x20c0('0x136'),FILES_PATH,_0x1794da);this[_0x20c0('0x34')][_0x20c0('0x6a')](this,_0x4867f9,_0x1794da,_0x41900a);this['channel'][_0x20c0('0x9a')](_0x20c0('0x17f'),_0x1794da);logger[_0x20c0('0x27')](_0x20c0('0x180'),_0x2805c3,_0x12d38a,_0x4867f9[_0x20c0('0x181')],_0x4867f9[_0x20c0('0x5d')]);return this[_0x20c0('0xc')][_0x20c0('0x139')](_0x2805c3,_0x12d38a,_0x4867f9[_0x20c0('0x181')],_0x4867f9['timeout'],undefined,!![]);};AGIVertices[_0x20c0('0x16')]['restapi']=function(_0x344e17){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x344e17['label']));if(!this[_0x20c0('0x7f')](_0x344e17[_0x20c0('0x5b')])){return this['channel'][_0x20c0('0xa7')](_0x20c0('0x182'));}var _0x4a8813=this[_0x20c0('0x5a')]['sync'](this,_0x344e17);logger['info'](util[_0x20c0('0x4a')](_0x20c0('0x183'),util[_0x20c0('0x184')](_0x4a8813,{'showHidden':![],'depth':null})));if(!this[_0x20c0('0x7f')](_0x344e17[_0x20c0('0xd7')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0x185'));}var _0x2ddfdf=this[_0x20c0('0x9d')][_0x20c0('0x6a')](this,_0x344e17['variable_id']);if(!_0x2ddfdf){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x344e17,_0x20c0('0xd9'));}this[_0x20c0('0xc')][_0x20c0('0x9a')](util[_0x20c0('0x4a')](_0x20c0('0x186'),_0x2ddfdf),_0x4a8813[_0x20c0('0x6f')]?_0x4a8813[_0x20c0('0x6f')]:'200');this['channel']['setVariable'](util[_0x20c0('0x4a')](_0x20c0('0x187'),_0x2ddfdf),_0x4a8813[_0x20c0('0x70')]?_0x4a8813[_0x20c0('0x70')]:'OK');if(_0x4a8813[_0x20c0('0x63')]){try{this[_0x20c0('0x98')](_0x4a8813[_0x20c0('0x63')],_0x2ddfdf);}catch(_0x253934){logger['error'](util[_0x20c0('0x4a')](_0x20c0('0x188'),_0x2ddfdf));}}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xde'),_0x2ddfdf));};AGIVertices[_0x20c0('0x16')]['saydigits']=function(_0x305bcf){logger['info'](util[_0x20c0('0x4a')](_0x20c0('0x189'),_0x305bcf['label']));return this[_0x20c0('0xc')][_0x20c0('0x18a')](_0x305bcf['digits']['replace'](/\s+/g,''),_0x305bcf[_0x20c0('0x181')]);};AGIVertices[_0x20c0('0x16')][_0x20c0('0x18b')]=function(_0x36f272){logger[_0x20c0('0x27')](util['format'](_0x20c0('0x18c'),_0x36f272['label']));return this[_0x20c0('0xc')][_0x20c0('0x18d')](_0x36f272[_0x20c0('0x5e')][_0x20c0('0x50')](/\s+/g,''),_0x36f272[_0x20c0('0x181')]);};AGIVertices[_0x20c0('0x16')][_0x20c0('0x18e')]=function(_0x3586f8){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x18f'),_0x3586f8[_0x20c0('0x31')]));return this[_0x20c0('0xc')]['sayPhonetic'](_0x3586f8[_0x20c0('0x54')],_0x3586f8['escape_digits']);};AGIVertices['prototype']['sendMail']=function(_0x579554){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x579554[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x579554[_0x20c0('0x190')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0x191'));}var _0x5776a5=this[_0x20c0('0x1e')][_0x20c0('0x6a')](this,_0x579554[_0x20c0('0x190')]);if(!_0x5776a5||!_0x5776a5[_0x20c0('0x192')]){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x579554,_0x20c0('0x193'));}var _0x300925={'from':util[_0x20c0('0x4a')]('\x22%s\x22\x20<%s>',_0x5776a5[_0x20c0('0x11')],_0x5776a5[_0x20c0('0x194')]||_0x5776a5[_0x20c0('0x192')][_0x20c0('0x195')]),'to':_0x579554['to']||'','cc':_0x579554['cc']||'','bcc':_0x579554[_0x20c0('0x196')]||'','subject':_0x579554['subject'],'html':_0x579554['text'],'text':_0x579554[_0x20c0('0x54')]};if(this[_0x20c0('0x7f')](_0x579554[_0x20c0('0x197')])){}logger['debug'](_0x20c0('0x198'),JSON[_0x20c0('0x6d')](_0x300925));this[_0x20c0('0x2f')][_0x20c0('0x6a')](this,_0x579554,_0x579554[_0x20c0('0x190')]);this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x199'),_0x5776a5[_0x20c0('0x11')]));this[_0x20c0('0x20')]['sync'](this,_0x5776a5['smtpOptions'],_0x300925);return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0x19a'));};AGIVertices[_0x20c0('0x16')][_0x20c0('0x19b')]=function(_0x283200){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x19c'),_0x283200[_0x20c0('0x31')]));return this['channel'][_0x20c0('0xa7')](_0x20c0('0x19d'));};AGIVertices['prototype'][_0x20c0('0x19e')]=function(_0xd519c3){logger['info'](util[_0x20c0('0x4a')](_0x20c0('0x19f'),_0xd519c3[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0xd519c3['sms_account_id'])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0x1a0'));}var _0x57b6c7=this[_0x20c0('0x2c')][_0x20c0('0x6a')](this,_0xd519c3[_0x20c0('0x1a1')]);if(!_0x57b6c7){return this[_0x20c0('0xc')]['error'](_0xd519c3,_0x20c0('0x1a2'));}var _0x117ae7={'body':_0xd519c3[_0x20c0('0x1a3')],'phone':_0xd519c3['to']||'','SmsAccountId':_0x57b6c7['id']};logger[_0x20c0('0xe0')](_0x20c0('0x1a4'),JSON[_0x20c0('0x6d')](_0x117ae7));this[_0x20c0('0x2f')][_0x20c0('0x6a')](this,_0xd519c3,_0xd519c3[_0x20c0('0x1a1')]);this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x57b6c7[_0x20c0('0x11')]));this[_0x20c0('0x2e')][_0x20c0('0x6a')](this,_0x117ae7);return this[_0x20c0('0xc')][_0x20c0('0xa7')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x20c0('0x16')]['set']=function(_0x5f10e7){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x1a5'),_0x5f10e7[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x5f10e7[_0x20c0('0xd7')])){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x5f10e7,_0x20c0('0x1a6'));}var _0x44fdf8=this[_0x20c0('0x9d')][_0x20c0('0x6a')](this,_0x5f10e7[_0x20c0('0xd7')]);if(!_0x44fdf8){return this[_0x20c0('0xc')]['error'](_0x5f10e7,_0x20c0('0xd9'));}return this[_0x20c0('0xc')][_0x20c0('0x9a')](_0x44fdf8,_0x5f10e7[_0x20c0('0x1a7')]);};AGIVertices[_0x20c0('0x16')]['start']=function(_0x3acf09){logger['info'](util[_0x20c0('0x4a')]('Enter\x20in\x20START\x20(%s)\x20block',_0x3acf09[_0x20c0('0x31')]));this['channel'][_0x20c0('0xa7')](_0x20c0('0x1a8'));var _0x32e8ea=this[_0x20c0('0xc')]['getVariable'](_0x20c0('0x1a9'));if(!_[_0x20c0('0x3b')](_0x32e8ea[_0x20c0('0x9e')])){this[_0x20c0('0xc')][_0x20c0('0x30')]=_0x32e8ea[_0x20c0('0x9e')];}if(_0x3acf09[_0x20c0('0xb7')]===_0x20c0('0x1aa')){this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0x1ab'));return this[_0x20c0('0xc')][_0x20c0('0xb7')]();}return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0x1ac'));};AGIVertices[_0x20c0('0x16')][_0x20c0('0x1ad')]=function(_0x125957){logger[_0x20c0('0x27')](util['format'](_0x20c0('0x1ae'),_0x125957[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x125957['project_id'])){return this['channel'][_0x20c0('0x26')](_0x125957,_0x20c0('0x1af'));}var _0x19b0c8=this[_0x20c0('0x14')]['sync'](this,_0x125957['project_id']);if(!this['isConfigured'](_0x19b0c8)){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x125957,util['format'](_0x20c0('0x1b0'),_0x125957['project_id']));}if(_0x19b0c8===this[_0x20c0('0xc')][_0x20c0('0x33')]){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x125957,_0x20c0('0x1b1'));}this[_0x20c0('0x2f')][_0x20c0('0x6a')](this,_0x125957,_0x19b0c8);var _0x5492cc=this[_0x20c0('0xc')][_0x20c0('0xad')](_0x20c0('0x1b2'),util['format'](_0x20c0('0x1b3'),config[_0x20c0('0x7')]['host']||'127.0.0.1',_0x19b0c8,this[_0x20c0('0xc')][_0x20c0('0x33')]));if(_0x5492cc[_0x20c0('0xa6')]===-0x1){return _0x5492cc;}return this[_0x20c0('0xc')]['noop'](util[_0x20c0('0x4a')]('Executed\x20command\x20%s\x20%s','AGI',_0x19b0c8));};AGIVertices['prototype'][_0x20c0('0x1b4')]=function(_0x46ce47){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x46ce47['label']));var _0x1c6307=this['shellCommand'][_0x20c0('0x6a')](this,_0x46ce47[_0x20c0('0xb5')]);this[_0x20c0('0x2f')][_0x20c0('0x6a')](this,_0x46ce47,_0x46ce47[_0x20c0('0xb5')]);if(this[_0x20c0('0x7f')](_0x46ce47[_0x20c0('0xd7')])){var _0x41fc5e=this[_0x20c0('0x9d')]['sync'](this,_0x46ce47[_0x20c0('0xd7')]);if(_0x41fc5e){this[_0x20c0('0xc')]['setVariable'](_0x41fc5e,_0x1c6307);return this[_0x20c0('0xc')][_0x20c0('0xa7')](util['format'](_0x20c0('0x1b5'),_0x46ce47['command'],_0x41fc5e));}}return this['channel'][_0x20c0('0xa7')](util[_0x20c0('0x4a')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x46ce47[_0x20c0('0xb5')]));};AGIVertices[_0x20c0('0x16')][_0x20c0('0x1b6')]=function(_0x461470){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x1b7'),_0x461470[_0x20c0('0x31')]));_0x461470[_0x20c0('0x54')]=_0x461470[_0x20c0('0x54')][_0x20c0('0x50')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x20c0('0x7f')](_0x461470[_0x20c0('0x52')])){return this[_0x20c0('0xc')]['noop']('no\x20apiKey\x20configured');}if(!this[_0x20c0('0x7f')](_0x461470[_0x20c0('0x54')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xa4'));}this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x461470['text']));var _0x24e6d9=this[_0x20c0('0x51')]['sync'](this,_0x461470);if(_0x24e6d9){this[_0x20c0('0xc')]['noop'](util['format'](_0x20c0('0x1b8'),_0x24e6d9));var _0x1ce779=this[_0x20c0('0xc')]['streamFile'](_0x24e6d9);try{fs[_0x20c0('0x128')](_0x24e6d9+_0x20c0('0x103'));}catch(_0x24451f){logger[_0x20c0('0x26')](_0x24451f);}return _0x1ce779;}return this[_0x20c0('0xc')]['error'](_0x461470,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x20c0('0x16')][_0x20c0('0x1b9')]=function(_0x502e88){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x502e88['label']));_0x502e88[_0x20c0('0x54')]=_0x502e88[_0x20c0('0x54')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x20c0('0x7f')](_0x502e88[_0x20c0('0x54')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')]('no\x20text\x20configured');}this[_0x20c0('0xc')]['noop'](util[_0x20c0('0x4a')](_0x20c0('0x1ba'),_0x502e88[_0x20c0('0x54')]));var _0x1bd7f3=this[_0x20c0('0x1bb')][_0x20c0('0x6a')](this,_0x502e88);if(_0x1bd7f3){this[_0x20c0('0xc')][_0x20c0('0xa7')](util['format'](_0x20c0('0x1bc'),_0x1bd7f3));var _0x22c00d=this[_0x20c0('0xc')][_0x20c0('0x102')](_0x1bd7f3);try{fs[_0x20c0('0x128')](_0x1bd7f3+_0x20c0('0x103'));}catch(_0x4f619b){logger[_0x20c0('0x26')](_0x4f619b);}return _0x22c00d;}return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x502e88,_0x20c0('0x1bd'));};AGIVertices['prototype'][_0x20c0('0x1be')]=function(_0xa4a9e6){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x1bf'),_0xa4a9e6[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0xa4a9e6[_0x20c0('0x15b')])){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0xa4a9e6,_0x20c0('0x15c'));}logger['info'](util[_0x20c0('0x4a')](_0x20c0('0x162'),this['channel'][_0x20c0('0x35')],_0xa4a9e6[_0x20c0('0x15b')]));var _0x4a7787=this['agentUnpause'][_0x20c0('0x6a')](this,_0xa4a9e6[_0x20c0('0x15b')]);if(_0x4a7787){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x15d'),this[_0x20c0('0xc')][_0x20c0('0x35')],_0xa4a9e6[_0x20c0('0x15b')]));this[_0x20c0('0xc')]['noop'](util['format'](_0x20c0('0x15d'),this['channel']['callerid'],_0xa4a9e6[_0x20c0('0x15b')]));return{'code':0xc8,'result':_0x20c0('0x15e')};}else{logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x15f'),this[_0x20c0('0xc')]['callerid'],_0xa4a9e6[_0x20c0('0x15b')]));this[_0x20c0('0xc')][_0x20c0('0xa7')](util['format'](_0x20c0('0x15f'),this[_0x20c0('0xc')][_0x20c0('0x35')],_0xa4a9e6[_0x20c0('0x15b')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x20c0('0x16')]['voicemail']=function(_0x4cfd34){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x1c0'),_0x4cfd34[_0x20c0('0x31')]));var _0x536c6e=this[_0x20c0('0xc')][_0x20c0('0xad')]('VOICEMAIL',[_0x4cfd34[_0x20c0('0x1c1')],_0x4cfd34[_0x20c0('0x71')]]);if(_0x536c6e[_0x20c0('0xa6')]===-0x1){return _0x536c6e;}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xc5'),_0x20c0('0x1c2'),_0x4cfd34['mailbox']));};AGIVertices[_0x20c0('0x16')][_0x20c0('0x1c3')]=function(_0x219600){logger[_0x20c0('0x27')](util['format'](_0x20c0('0x1c4'),_0x219600[_0x20c0('0x31')]));if(!this['isConfigured'](_0x219600[_0x20c0('0xd7')])){return this['channel'][_0x20c0('0x26')](_0x219600,_0x20c0('0x1a6'));}var _0x326bc5=this[_0x20c0('0x9d')][_0x20c0('0x6a')](this,_0x219600[_0x20c0('0xd7')]);if(!_0x326bc5){return this[_0x20c0('0xc')]['error'](_0x219600,'no\x20variable\x20found');}var _0x3fcf4c=this['channel'][_0x20c0('0x9d')](_0x326bc5);return{'code':0xc8,'result':_0x3fcf4c['extra']?_0x3fcf4c[_0x20c0('0x9e')]:'-'};};String['prototype'][_0x20c0('0x9c')]=function(_0x754cd3,_0x2552e5){return this[_0x20c0('0x9b')](_0x754cd3)['join'](_0x2552e5);};module[_0x20c0('0x1c5')]=AGIVertices; \ No newline at end of file +var _0x5ad3=['project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','mailRpc','prototype','then','catch','rpc','getSquareProject','getSquareProjectById','name','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','map','Intervals','interval','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','LOCAL','shellCommand','trim','replace','googleCloudTTS','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','restAPI','url','number','timeout','includes','POST','PUT','method','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','stringify','render','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_polly_region','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_bot_name','googleASR','google_asr_language','appid','clear','agicommand','clone','replaceObjectAllVariables','replaceAllVariables','hasOwnProperty','isPlainObject','recursiveNodeIndex','isArray','length','isString','saveRestApiResult','%s.%s','split','replaceAll','getVariable','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','isConfigured','maxRetry','sync','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','options','exec','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','getQueryOdbc','variable_id','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','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','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','.wav','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','NOBEEP','GOOGLE_ASR_%s','tildeasr','appsecret','no\x20appsecret\x20configured','wav','beep','recordFile','intKey','tilde\x20%s\x20file\x20created','tildeASR','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','no\x20find\x20by\x20configured','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','operation','no\x20variable\x20selected\x20for\x20the\x20result','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','pause_id','success','failure','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','%s/recordings/%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','statusCode','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','email','Smtp','subject','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d'];(function(_0x5576af,_0x47c7c0){var _0x2ee7b1=function(_0x360001){while(--_0x360001){_0x5576af['push'](_0x5576af['shift']());}};_0x2ee7b1(++_0x47c7c0);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x5ad3[_0x934425];return _0x31d596;};'use strict';var fs=require('fs');var util=require(_0x35ad('0x0'));var _=require(_0x35ad('0x1'));var sh=require(_0x35ad('0x2'));var odbc=require(_0x35ad('0x3'))();var rs=require('randomstring');var moment=require(_0x35ad('0x4'));var Mustache=require(_0x35ad('0x5'));var rp=require(_0x35ad('0x6'));var logger=require(_0x35ad('0x7'))(_0x35ad('0x8'));var config=require(_0x35ad('0x9'));var scripts=require(_0x35ad('0xa'));var FILES_PATH=_0x35ad('0xb');var recursiveMapAttributes=[_0x35ad('0xc'),_0x35ad('0xd')];var verticesWithRetry=['menu',_0x35ad('0xe'),_0x35ad('0xf')];var AGIVertices=function(_0x3f1f55,_0x5400f3,_0x2498c1){this['channel']=_0x3f1f55;this['rpc']=_0x5400f3;this[_0x35ad('0x10')]=_0x2498c1;};AGIVertices[_0x35ad('0x11')]['getVariable']=function(_0x34c2cb,_0x3a70a9){this['rpc']['getVariableById'](_0x34c2cb)[_0x35ad('0x12')](function(_0x412ab6){_0x3a70a9(null,_0x412ab6?_0x412ab6['name']:![]);})[_0x35ad('0x13')](function(_0x33e2ec){_0x3a70a9(_0x33e2ec);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x5ba1aa,_0x2e81c8){this[_0x35ad('0x14')]['getVoiceQueueById'](_0x5ba1aa)[_0x35ad('0x12')](function(_0x2ebceb){_0x2e81c8(null,_0x2ebceb?_0x2ebceb['name']:![]);})[_0x35ad('0x13')](function(_0x4d5185){_0x2e81c8(_0x4d5185);});};AGIVertices['prototype'][_0x35ad('0x15')]=function(_0x3ff2f0,_0x27efeb){this['rpc'][_0x35ad('0x16')](_0x3ff2f0)[_0x35ad('0x12')](function(_0x233394){_0x27efeb(null,_0x233394?_0x233394[_0x35ad('0x17')]:![]);})[_0x35ad('0x13')](function(_0x418416){_0x27efeb(_0x418416);});};AGIVertices['prototype'][_0x35ad('0x18')]=function(_0x2876ad,_0x574557){this['rpc'][_0x35ad('0x19')](_0x2876ad)[_0x35ad('0x12')](function(_0x578b1b){_0x574557(null,_0x578b1b?_0x578b1b[_0x35ad('0x1a')]:![]);})[_0x35ad('0x13')](function(_0x496620){_0x574557(_0x496620);});};AGIVertices[_0x35ad('0x11')][_0x35ad('0x1b')]=function(_0x504cbc,_0x30542c){this[_0x35ad('0x14')][_0x35ad('0x1c')](_0x504cbc)[_0x35ad('0x12')](function(_0x1e0527){_0x30542c(null,_0x1e0527?_0x1e0527[_0x35ad('0x17')]:![]);})[_0x35ad('0x13')](function(_0x4c5740){_0x30542c(_0x4c5740);});};AGIVertices[_0x35ad('0x11')][_0x35ad('0x1d')]=function(_0x47e818,_0x43059e){this[_0x35ad('0x14')][_0x35ad('0x1e')](_0x47e818)[_0x35ad('0x12')](function(_0x368468){_0x43059e(null,_0x368468?_0x368468['name']:![]);})[_0x35ad('0x13')](function(_0x226167){_0x43059e(_0x226167);});};AGIVertices[_0x35ad('0x11')][_0x35ad('0x1f')]=function(_0x2ddb59,_0x20a682){var _0x2e601a=this;this[_0x35ad('0x14')]['getSoundById'](_0x2ddb59)[_0x35ad('0x12')](function(_0x11da54){_0x20a682(null,_0x11da54?_0x2e601a[_0x35ad('0x20')](_0x11da54[_0x35ad('0x21')]):![]);})[_0x35ad('0x13')](function(_0x481803){_0x20a682(_0x481803);});};AGIVertices['prototype'][_0x35ad('0x22')]=function(_0x4a2366,_0x235e5e){this['rpc']['getMailAccountById'](_0x4a2366)['then'](function(_0x5380e5){_0x235e5e(null,_0x5380e5?_0x5380e5:![]);})[_0x35ad('0x13')](function(_0x5a60e1){_0x235e5e(_0x5a60e1);});};AGIVertices['prototype'][_0x35ad('0x23')]=function(_0x5900d3,_0x3d5670,_0x51cf37){this[_0x35ad('0x10')]['sendMailMessage'](_0x5900d3,_0x3d5670)[_0x35ad('0x12')](function(){_0x51cf37(null);})['catch'](function(_0x13f8f4){_0x51cf37(_0x13f8f4);});};AGIVertices[_0x35ad('0x11')][_0x35ad('0x24')]=function(_0x4b6ec2,_0x2852e2){this[_0x35ad('0x14')][_0x35ad('0x25')](_0x4b6ec2)[_0x35ad('0x12')](function(_0x3cb239){if(_0x3cb239){if(_0x3cb239['IntervalId']){_0x2852e2(null,[_0x3cb239['interval']]);}else{_0x2852e2(null,_[_0x35ad('0x26')](_0x3cb239[_0x35ad('0x27')],_0x35ad('0x28')));}}else{_0x2852e2(null,![]);}})[_0x35ad('0x13')](function(_0x55e676){_0x2852e2(_0x55e676);});};AGIVertices[_0x35ad('0x11')][_0x35ad('0x20')]=function(_0x30a247){return util[_0x35ad('0x29')](_0x35ad('0x2a'),FILES_PATH,_0x30a247);};AGIVertices[_0x35ad('0x11')]['getQueryOdbc']=function(_0x58250d,_0x658444,_0x2800e7){odbc[_0x35ad('0x2b')](_0x58250d,function(_0x448abf){if(_0x448abf){logger[_0x35ad('0x2c')](_0x35ad('0x2d'),_0x448abf);_0x2800e7(_0x448abf);}else{logger[_0x35ad('0x2e')](_0x35ad('0x2f'));odbc[_0x35ad('0x30')](_0x658444,function(_0x549231,_0x459d2f){if(_0x549231){logger['info'](_0x35ad('0x31'),_0x658444);_0x2800e7(_0x549231);}else{logger[_0x35ad('0x2e')](_0x35ad('0x32'),_0x658444);odbc[_0x35ad('0x33')](function(_0x1ad7e6){if(_0x1ad7e6){logger[_0x35ad('0x2c')](_0x35ad('0x34'),_0x1ad7e6);}_0x2800e7(null,_0x459d2f);});}});}});};AGIVertices[_0x35ad('0x11')][_0x35ad('0x35')]=function(_0x5dd327,_0x200e4d){this[_0x35ad('0x14')][_0x35ad('0x36')](_0x5dd327)['then'](function(_0x19d82d){_0x200e4d(null,_0x19d82d?_0x19d82d:![]);})[_0x35ad('0x13')](function(_0x9ffec4){_0x200e4d(_0x9ffec4);});};AGIVertices[_0x35ad('0x11')][_0x35ad('0x37')]=function(_0x2d0f86,_0x36784f){this[_0x35ad('0x14')][_0x35ad('0x37')](_0x2d0f86)[_0x35ad('0x12')](function(_0x21d730){_0x36784f(null,_0x21d730);})['catch'](function(_0x118138){_0x36784f(_0x118138);});};AGIVertices['prototype'][_0x35ad('0x38')]=function(_0x3b80c0,_0x3df623,_0x2dfee9){this[_0x35ad('0x14')][_0x35ad('0x38')]({'uniqueid':this[_0x35ad('0x39')][_0x35ad('0x3a')],'node':_0x3b80c0[_0x35ad('0x3b')],'application':_0x3b80c0['agicommand'],'data':_0x3df623||null,'project_name':this[_0x35ad('0x39')][_0x35ad('0x3c')],'callerid':this[_0x35ad('0x39')][_0x35ad('0x3d')]})[_0x35ad('0x12')](function(_0x5a5509){if(_0x2dfee9){_0x2dfee9(null,_0x5a5509);}})[_0x35ad('0x13')](function(_0x2ac7f4){if(_0x2dfee9){_0x2dfee9(_0x2ac7f4);}});};AGIVertices['prototype']['createSquareRecording']=function(_0x143a88,_0x228498,_0x965100,_0x3e4093){this['rpc'][_0x35ad('0x3e')]({'uniqueid':this[_0x35ad('0x39')][_0x35ad('0x3a')],'callerid':this[_0x35ad('0x39')][_0x35ad('0x3d')],'calleridname':this[_0x35ad('0x39')][_0x35ad('0x3f')],'context':this['channel'][_0x35ad('0x40')],'extension':this[_0x35ad('0x39')][_0x35ad('0x41')],'priority':this['channel']['priority'],'accountcode':this['channel'][_0x35ad('0x42')],'dnid':this[_0x35ad('0x39')][_0x35ad('0x43')],'projectName':this[_0x35ad('0x39')]['arg_1'],'saveName':_0x228498,'filename':_0x143a88[_0x35ad('0x44')]||_0x228498,'savePath':_0x965100})[_0x35ad('0x12')](function(_0x3583ca){_0x3e4093(null,_0x3583ca);})[_0x35ad('0x13')](function(_0x43d1ab){_0x3e4093(_0x43d1ab);});};AGIVertices[_0x35ad('0x11')]['createSquareMessage']=function(_0x4f432a,_0x34a9a3,_0x3e5d31,_0x5acc34,_0x4fbf0c){this[_0x35ad('0x14')][_0x35ad('0x45')]({'uniqueid':this[_0x35ad('0x39')]['uniqueid'],'body':_0x4f432a,'direction':_0x34a9a3,'providerName':_0x3e5d31,'providerResponse':_0x5acc34})['then'](function(_0xa35ee4){if(_0x4fbf0c){_0x4fbf0c(null,_0xa35ee4);}})[_0x35ad('0x13')](function(_0x18e4f9){if(_0x4fbf0c){_0x4fbf0c(_0x18e4f9);}});};AGIVertices['prototype'][_0x35ad('0x46')]=function(_0xfed799,_0x34061c){this[_0x35ad('0x14')][_0x35ad('0x46')]({'firstName':_[_0x35ad('0x47')](_0xfed799['name'])||_[_0x35ad('0x48')](_0xfed799[_0x35ad('0x17')])?_0x35ad('0x49')+Math['random']():_0xfed799[_0x35ad('0x17')],'lastName':_[_0x35ad('0x47')](_0xfed799[_0x35ad('0x4a')])||_[_0x35ad('0x48')](_0xfed799['lastName'])?null:_0xfed799['lastName'],'phone':_0xfed799[_0x35ad('0x4b')],'ListId':_0xfed799[_0x35ad('0x4c')],'scheduledat':_0xfed799[_0x35ad('0x4d')],'callbackUniqueid':this[_0x35ad('0x39')][_0x35ad('0x3a')],'tags':'callback','description':_0x35ad('0x4e')+_0xfed799[_0x35ad('0x4d')][_0x35ad('0x4f')](),'priority':_0xfed799[_0x35ad('0x50')]})[_0x35ad('0x12')](function(_0x119fef){_0x34061c(null,_0x119fef);})['catch'](function(_0x579090){_0x34061c(_0x579090);});};AGIVertices[_0x35ad('0x11')][_0x35ad('0x51')]=function(_0x2034c1,_0x30ebff){this[_0x35ad('0x14')][_0x35ad('0x52')](_0x2034c1)[_0x35ad('0x12')](function(_0x5cef35){_0x30ebff(null,_0x5cef35?_0x5cef35[_0x35ad('0x17')]:![]);})[_0x35ad('0x13')](function(_0xa8f927){_0x30ebff(_0xa8f927);});};AGIVertices[_0x35ad('0x11')]['agentPause']=function(_0x12735e,_0x8dad01,_0x4baa80){var _0x1d66c6={'role':_0x35ad('0x53')};_0x1d66c6[_0x12735e]=this[_0x35ad('0x39')][_0x35ad('0x3d')];this[_0x35ad('0x14')][_0x35ad('0x54')](_0x1d66c6,_0x8dad01,this[_0x35ad('0x39')][_0x35ad('0x3a')])['then'](function(_0x41f5fc){_0x4baa80(null,_[_0x35ad('0x48')](_0x41f5fc)?![]:!![]);})[_0x35ad('0x13')](function(_0x551b90){logger[_0x35ad('0x2c')](_0x551b90);_0x4baa80(null,![]);});};AGIVertices['prototype'][_0x35ad('0x55')]=function(_0x3536b3,_0x218e57){var _0x38a22e={'role':'agent'};_0x38a22e[_0x3536b3]=this[_0x35ad('0x39')][_0x35ad('0x3d')];this[_0x35ad('0x14')][_0x35ad('0x55')](_0x38a22e)[_0x35ad('0x12')](function(_0x4d0090){_0x218e57(null,_[_0x35ad('0x48')](_0x4d0090)?![]:!![]);})['catch'](function(_0xd4766f){logger[_0x35ad('0x2c')](_0xd4766f);_0x218e57(null,![]);});};AGIVertices['prototype'][_0x35ad('0x56')]=function(_0x5ab841,_0x80e87f){var _0x3f1d05={'role':'agent'};_0x3f1d05[_0x5ab841]=this[_0x35ad('0x39')][_0x35ad('0x3d')];this[_0x35ad('0x14')][_0x35ad('0x56')](_0x3f1d05)[_0x35ad('0x12')](function(_0xa6d541){_0x80e87f(null,_[_0x35ad('0x48')](_0xa6d541)?![]:!![]);})['catch'](function(_0x25a347){logger[_0x35ad('0x2c')](_0x25a347);_0x80e87f(null,![]);});};AGIVertices[_0x35ad('0x11')][_0x35ad('0x57')]=function(_0x2801f,_0xfa041c){var _0x1f86a9={'role':'agent'};_0x1f86a9[_0x2801f]=this[_0x35ad('0x39')][_0x35ad('0x3d')];var _0x279f98=_0x2801f!=_0x35ad('0x58')?util[_0x35ad('0x29')]('%s/%s@from-sip/n',_0x35ad('0x59'),this[_0x35ad('0x39')]['callerid']):undefined;this[_0x35ad('0x14')][_0x35ad('0x57')](_0x1f86a9,_0x279f98)[_0x35ad('0x12')](function(_0x286543){_0xfa041c(null,_['isNil'](_0x286543)?![]:!![]);})[_0x35ad('0x13')](function(_0x59fb4e){logger[_0x35ad('0x2c')](_0x59fb4e);_0xfa041c(null,![]);});};AGIVertices[_0x35ad('0x11')][_0x35ad('0x5a')]=function(_0x540abb,_0x395370){sh['exec'](_[_0x35ad('0x5b')](_0x540abb),function(_0x554ca4,_0x5ad236){var _0x12bf10=_0x5ad236[_0x35ad('0x5c')](/(\r\n|\n|\r)/gm,'');_0x395370(null,_0x12bf10);});};AGIVertices['prototype'][_0x35ad('0x5d')]=function(_0x12d274,_0x1f4e7e){scripts['googleCloudTTS'](_0x12d274['apiKey'],_0x12d274['google_cloud_tts_text_type']||'text',_0x12d274[_0x35ad('0x5e')],_0x12d274[_0x35ad('0x5f')]||_0x35ad('0x60'),_0x12d274[_0x35ad('0x61')]||_0x35ad('0x62'),_0x12d274[_0x35ad('0x63')]||'MP3')[_0x35ad('0x12')](function(_0xda823){_0x1f4e7e(null,_0xda823);})['catch'](function(_0x17e1d5){_0x1f4e7e(_0x17e1d5);});};AGIVertices[_0x35ad('0x11')]['googleTTS']=function(_0x18436d,_0x31f8bb){scripts[_0x35ad('0x64')](_0x18436d[_0x35ad('0x5e')],_0x18436d['google_tts_language']||'en',0x1)[_0x35ad('0x12')](function(_0x11af74){_0x31f8bb(null,_0x11af74);})[_0x35ad('0x13')](function(_0x4a86a){_0x31f8bb(_0x4a86a);});};AGIVertices[_0x35ad('0x11')][_0x35ad('0x65')]=function(_0x40fbd3,_0x3dc5e5){var _0xd021df={'uri':_0x40fbd3[_0x35ad('0x66')],'method':_0x40fbd3['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x40fbd3['timeout'])===_0x35ad('0x67')&&parseInt(_0x40fbd3[_0x35ad('0x68')])>=0x1?parseInt(_0x40fbd3['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x35ad('0x69')]([_0x35ad('0x6a'),_0x35ad('0x6b')],_0xd021df[_0x35ad('0x6c')][_0x35ad('0x6d')]())){try{_0xd021df[_0x35ad('0x6e')]=_0x40fbd3['rawBody']?JSON[_0x35ad('0x6f')](_0x40fbd3[_0x35ad('0xd')]):{};}catch(_0x3e881b){logger[_0x35ad('0x2c')](_0x35ad('0x70'),_0x3e881b);}}try{_0xd021df[_0x35ad('0x71')]=_0x40fbd3[_0x35ad('0xc')]?JSON[_0x35ad('0x6f')](_0x40fbd3['rawHeaders']):{};}catch(_0x3b2636){logger[_0x35ad('0x2c')](_0x35ad('0x72'),_0x3b2636);}if(_0x40fbd3[_0x35ad('0x73')]){try{var _0x4c89e3=require(_0x40fbd3[_0x35ad('0x73')])['sync'](this,_0xd021df);_0xd021df[_0x35ad('0x74')]=Mustache['render'](_0x40fbd3['url'],_0x4c89e3,{},['$$','$$']);if(_0xd021df[_0x35ad('0x71')]){_0xd021df[_0x35ad('0x71')]=JSON[_0x35ad('0x6f')](Mustache['render'](JSON[_0x35ad('0x75')](_0xd021df['headers']),_0x4c89e3,{},['$$','$$']));}if(_0xd021df[_0x35ad('0x6e')]){_0xd021df[_0x35ad('0x6e')]=JSON[_0x35ad('0x6f')](Mustache[_0x35ad('0x76')](JSON['stringify'](_0xd021df[_0x35ad('0x6e')]),_0x4c89e3,{},['$$','$$']));}}catch(_0x5a919f){logger[_0x35ad('0x2c')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5a919f);}}rp(_0xd021df)[_0x35ad('0x12')](function(_0x48d050){var _0x4dcf9f={'statusCode':_0x48d050['statusCode']||0xc8,'statusMessage':_0x48d050['statusMessage']||'OK','headers':_0x48d050[_0x35ad('0x71')]||{},'body':_0x48d050[_0x35ad('0x6e')]||{}};_0x3dc5e5(null,_0x4dcf9f);})[_0x35ad('0x13')](function(_0x45cfc4){var _0x227dc5={'statusCode':_0x45cfc4['statusCode']||0x1f4,'statusMessage':_0x45cfc4['message']||_0x35ad('0x77'),'headers':_0x45cfc4['options'][_0x35ad('0x71')]||{},'body':_0x45cfc4['options'][_0x35ad('0x6e')]||{}};_0x3dc5e5(null,_0x227dc5);});};AGIVertices[_0x35ad('0x11')][_0x35ad('0x78')]=function(_0x6d8f0c,_0x5b2b32){scripts[_0x35ad('0x78')](this[_0x35ad('0x39')][_0x35ad('0x3a')],_0x6d8f0c[_0x35ad('0x79')],_0x6d8f0c[_0x35ad('0x5e')],_0x6d8f0c[_0x35ad('0x7a')]||'en')[_0x35ad('0x12')](function(_0x2a2699){_0x5b2b32(null,_0x2a2699);})['catch'](function(_0x2f352b){_0x5b2b32(_0x2f352b);});};AGIVertices[_0x35ad('0x11')]['googleDialogflowV2']=function(_0x496e31,_0x5b2b80){scripts[_0x35ad('0x7b')](this[_0x35ad('0x39')][_0x35ad('0x3a')],_0x496e31[_0x35ad('0x7c')],_0x496e31['client_email'],_0x496e31[_0x35ad('0x7d')],_0x496e31[_0x35ad('0x5e')],_0x496e31[_0x35ad('0x7e')]||'en')[_0x35ad('0x12')](function(_0xeaf49a){_0x5b2b80(null,_0xeaf49a);})[_0x35ad('0x13')](function(_0x9e55cc){_0x5b2b80(_0x9e55cc);});};AGIVertices[_0x35ad('0x11')][_0x35ad('0x7f')]=function(_0x1d90ce,_0x356888){scripts['sestekNDA'](this[_0x35ad('0x39')],_0x1d90ce)[_0x35ad('0x12')](function(_0x3b6a25){_0x356888(null,_0x3b6a25);})[_0x35ad('0x13')](function(_0xbff7b7){_0x356888(_0xbff7b7);});};AGIVertices['prototype']['ispeechTTS']=function(_0x3b0004,_0x328123){scripts[_0x35ad('0x80')](_0x3b0004[_0x35ad('0x79')],_0x3b0004[_0x35ad('0x5e')],_0x3b0004[_0x35ad('0x81')]||_0x35ad('0x60'),_0x3b0004[_0x35ad('0x82')])[_0x35ad('0x12')](function(_0x7ebe81){_0x328123(null,_0x7ebe81);})['catch'](function(_0x27ec92){_0x328123(_0x27ec92);});};AGIVertices[_0x35ad('0x11')][_0x35ad('0x83')]=function(_0x2bdaf3,_0x32e675,_0x48cedd){scripts[_0x35ad('0x83')](_0x32e675,_0x2bdaf3[_0x35ad('0x79')],_0x2bdaf3[_0x35ad('0x84')]||_0x35ad('0x60'),this['isConfigured'](_0x2bdaf3[_0x35ad('0x85')])?_0x2bdaf3[_0x35ad('0x85')]:undefined)['then'](function(_0x5d04d8){_0x48cedd(null,_0x5d04d8);})[_0x35ad('0x13')](function(_0x46e17e){_0x48cedd(_0x46e17e);});};AGIVertices['prototype'][_0x35ad('0x86')]=function(_0x1b8a89,_0x42f2d8){scripts['awsPolly'](_0x1b8a89[_0x35ad('0x87')],_0x1b8a89['aws_secret_access_key'],_0x1b8a89[_0x35ad('0x88')],_0x1b8a89['aws_polly_voice']||_0x35ad('0x89'),_0x1b8a89[_0x35ad('0x5e')],_0x1b8a89[_0x35ad('0x8a')]||_0x35ad('0x5e'))[_0x35ad('0x12')](function(_0x5df07d){_0x42f2d8(null,_0x5df07d);})[_0x35ad('0x13')](function(_0x2f3116){_0x42f2d8(_0x2f3116);});};AGIVertices[_0x35ad('0x11')][_0x35ad('0x8b')]=function(_0x5daf78,_0x4f1e2d){scripts[_0x35ad('0x8b')](this['channel'][_0x35ad('0x3a')],_0x5daf78['aws_access_key_id'],_0x5daf78[_0x35ad('0x8c')],_0x5daf78['aws_lex_region'],_0x5daf78['text'],_0x5daf78[_0x35ad('0x8d')])['then'](function(_0x232eb3){_0x4f1e2d(null,_0x232eb3);})[_0x35ad('0x13')](function(_0xde7d62){_0x4f1e2d(_0xde7d62);});};AGIVertices[_0x35ad('0x11')][_0x35ad('0x8e')]=function(_0x16b229,_0x3be1fd,_0x3680f2){scripts['googleASR'](_0x3be1fd,_0x16b229[_0x35ad('0x79')],_0x16b229[_0x35ad('0x8f')]||_0x35ad('0x60'))[_0x35ad('0x12')](function(_0x5e1293){_0x3680f2(null,_0x5e1293);})[_0x35ad('0x13')](function(_0x76c406){_0x3680f2(_0x76c406);});};AGIVertices['prototype']['tildeASR']=function(_0xc240a4,_0x216c17,_0x231f75){scripts['tildeASR'](_0x216c17,_0xc240a4[_0x35ad('0x90')],_0xc240a4['appsecret'],_0xc240a4[_0x35ad('0x74')])[_0x35ad('0x12')](function(_0x4312e6){_0x231f75(null,_0x4312e6);})[_0x35ad('0x13')](function(_0x9ec9e6){_0x231f75(_0x9ec9e6);});};AGIVertices[_0x35ad('0x11')][_0x35ad('0x91')]=function(_0xce3f){var _0x2c8d04=_['includes'](verticesWithRetry,_0xce3f[_0x35ad('0x92')])?_0xce3f:_[_0x35ad('0x93')](_0xce3f);for(var _0x393a53 in _0x2c8d04){if(_0x2c8d04['hasOwnProperty'](_0x393a53)){if(_0x2c8d04[_0x393a53]&&_['isString'](_0x2c8d04[_0x393a53])){if(_[_0x35ad('0x69')](recursiveMapAttributes,_0x393a53)){_0x2c8d04[_0x393a53]=this[_0x35ad('0x94')](_0x2c8d04[_0x393a53]);}else{_0x2c8d04[_0x393a53]=this[_0x35ad('0x95')](_0x2c8d04[_0x393a53]);}}}}return _0x2c8d04;};AGIVertices[_0x35ad('0x11')]['recursiveNodeIndex']=function(_0x421622){for(var _0x290af7 in _0x421622){if(_0x421622[_0x35ad('0x96')](_0x290af7)){if(_[_0x35ad('0x97')](_0x421622[_0x290af7])){this[_0x35ad('0x98')](_0x421622[_0x290af7]);}else if(_[_0x35ad('0x99')](_0x421622[_0x290af7])){for(var _0x1997d0=0x0;_0x1997d0<_0x421622[_0x290af7][_0x35ad('0x9a')];_0x1997d0++){this[_0x35ad('0x98')](_0x421622[_0x290af7][_0x1997d0]);}}else if(_[_0x35ad('0x9b')](_0x421622[_0x290af7])){_0x421622[_0x290af7]=this['replaceAllVariables'](_0x421622[_0x290af7]);}}}};AGIVertices['prototype'][_0x35ad('0x9c')]=function(_0x32c93b,_0x408092){for(var _0x12e640 in _0x32c93b){if(_0x32c93b[_0x35ad('0x96')](_0x12e640)){if(_[_0x35ad('0x97')](_0x32c93b[_0x12e640])){if(!_[_0x35ad('0x47')](_0x32c93b[_0x12e640])){this['saveRestApiResult'](_0x32c93b[_0x12e640],util['format'](_0x35ad('0x9d'),_0x408092,_0x12e640));}}else if(_[_0x35ad('0x99')](_0x32c93b[_0x12e640])){for(var _0x4ae178=0x0;_0x4ae178<_0x32c93b[_0x12e640]['length'];_0x4ae178++){this[_0x35ad('0x9c')](_0x32c93b[_0x12e640][_0x4ae178],util['format'](_0x35ad('0x9d'),_0x408092,_0x12e640+'['+_0x4ae178+']'));}}else{if(!_[_0x35ad('0x48')](_0x32c93b[_0x12e640])){this[_0x35ad('0x39')]['setVariable'](util['format']('%s.%s',_0x408092,_0x12e640),_0x32c93b[_0x12e640]);}}}}};AGIVertices[_0x35ad('0x11')][_0x35ad('0x94')]=function(_0x430651){try{var _0x17e002=JSON[_0x35ad('0x6f')](_0x430651);this[_0x35ad('0x98')](_0x17e002);return JSON[_0x35ad('0x75')](_0x17e002);}catch(_0x8ed8f){return this['replaceAllVariables'](_0x430651);}};AGIVertices[_0x35ad('0x11')][_0x35ad('0x95')]=function(_0x30c1cb){var _0x3f0c31=_0x30c1cb['split']('{');for(var _0x3e8acb=0x1;_0x3e8acb<_0x3f0c31['length'];_0x3e8acb+=0x1){var _0x42446f=_0x3f0c31[_0x3e8acb][_0x35ad('0x9e')]('}');if(_0x42446f[_0x35ad('0x9a')]>0x1){_0x30c1cb=_0x30c1cb[_0x35ad('0x9f')]('{'+_0x42446f[0x0]+'}',this['channel'][_0x35ad('0xa0')](_0x42446f[0x0])[_0x35ad('0xa1')]||_0x42446f[0x0]);}}if(_0x3f0c31[_0x35ad('0x9a')]===0x1){return _0x30c1cb['toString']();}return this[_0x35ad('0x95')](_0x30c1cb);};AGIVertices[_0x35ad('0x11')][_0x35ad('0xa2')]=function(_0x20f179,_0x2097d9){var _0x7ec89c=this['channel'][_0x35ad('0xa0')](_0x20f179);if(_0x7ec89c[_0x35ad('0xa3')]===-0x1){return _0x7ec89c;}logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0xa4'),_0x2097d9,_0x7ec89c[_0x35ad('0xa1')]));return this[_0x35ad('0x39')][_0x35ad('0xa5')](_0x2097d9,_0x7ec89c[_0x35ad('0xa1')]);};AGIVertices[_0x35ad('0x11')][_0x35ad('0xa6')]=function(_0xd17847){return _0xd17847&&_0xd17847!=='0'&&_0xd17847!=='-1'&&_0xd17847!=='';};AGIVertices[_0x35ad('0x11')][_0x35ad('0xa7')]=function(_0x169a10){this[_0x35ad('0x38')][_0x35ad('0xa8')](this,_0x169a10,'-');_0x169a10['retry']=_0x169a10[_0x35ad('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x35ad('0x11')][_0x35ad('0xa9')]=function(_0x3d4f03){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0xaa'),_0x3d4f03[_0x35ad('0x3b')]));if(!this[_0x35ad('0xa6')](_0x3d4f03[_0x35ad('0x5e')])){return this[_0x35ad('0x39')]['noop'](_0x35ad('0xab'));}var _0x59a0a7='\x22'+_0x3d4f03[_0x35ad('0x5e')]+'\x22';if(this['isConfigured'](_0x3d4f03[_0x35ad('0xac')])){_0x59a0a7+=','+_0x3d4f03['options'];}var _0x1e081f=this[_0x35ad('0x39')][_0x35ad('0xad')](_0x35ad('0xae'),_0x59a0a7);if(_0x1e081f[_0x35ad('0xa3')]===-0x1){return _0x1e081f;}return this['channel'][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0xb0'),_0x59a0a7));};AGIVertices[_0x35ad('0x11')]['mrcprecog']=function(_0x30c05e){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x30c05e['label']));if(!this[_0x35ad('0xa6')](_0x30c05e[_0x35ad('0xb1')])){return this[_0x35ad('0x39')][_0x35ad('0xaf')](_0x35ad('0xb2'));}var _0x39f3c7=_0x30c05e[_0x35ad('0xb1')];if(this[_0x35ad('0xa6')](_0x30c05e['options'])){_0x39f3c7+=','+_0x30c05e[_0x35ad('0xac')];}var _0x5218e5=this[_0x35ad('0x39')][_0x35ad('0xad')]('MRCPRecog',_0x39f3c7);if(_0x5218e5['result']===-0x1){return _0x5218e5;}var _0xa3d4b8=this[_0x35ad('0xa2')](_0x35ad('0xb3'),'MRCP_RECOG_CONFIDENCE');if(_0xa3d4b8[_0x35ad('0xa3')]===-0x1){return _0xa3d4b8;}var _0x594247=this[_0x35ad('0xa2')](_0x35ad('0xb4'),_0x35ad('0xb5'));if(_0x594247['result']===-0x1){return _0x594247;}var _0x4bf270=this[_0x35ad('0xa2')]('RECOG_INSTANCE()',_0x35ad('0xb6'));if(_0x4bf270[_0x35ad('0xa3')]===-0x1){return _0x4bf270;}return this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0xb7'),_0x39f3c7));};AGIVertices[_0x35ad('0x11')][_0x35ad('0x8')]=function(_0x106cbf){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0xb8'),_0x106cbf['label']));return this[_0x35ad('0x39')][_0x35ad('0x8')]([_0x106cbf[_0x35ad('0xb9')],_0x106cbf[_0x35ad('0xba')]]);};AGIVertices[_0x35ad('0x11')][_0x35ad('0xbb')]=function(_0x364fcb){logger[_0x35ad('0x2e')](util['format'](_0x35ad('0xbc'),_0x364fcb[_0x35ad('0x3b')]));if(this[_0x35ad('0xa6')](_0x364fcb[_0x35ad('0x68')])){logger[_0x35ad('0x2e')](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x364fcb[_0x35ad('0x68')]));var _0x4e8ca9=this['channel']['wait'](_0x364fcb[_0x35ad('0x68')]);if(_0x4e8ca9[_0x35ad('0xa3')]===-0x1){return _0x4e8ca9;}}return this[_0x35ad('0x39')][_0x35ad('0xbb')]();};AGIVertices[_0x35ad('0x11')][_0x35ad('0xbd')]=function(_0x225887){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0xbe'),_0x225887[_0x35ad('0x3b')]));if(!this['isConfigured'](_0x225887[_0x35ad('0x4c')])){return this[_0x35ad('0x39')]['error'](_0x225887,'no\x20list\x20selected');}_0x225887[_0x35ad('0x4d')]=moment();if(this[_0x35ad('0xa6')](_0x225887[_0x35ad('0xbf')])){_0x225887[_0x35ad('0x4d')]=moment()[_0x35ad('0xc0')](_0x225887[_0x35ad('0xbf')],_0x35ad('0xc1'));}if(!this[_0x35ad('0xa6')](_0x225887[_0x35ad('0x50')])){_0x225887[_0x35ad('0x50')]=0x2;}this[_0x35ad('0x46')][_0x35ad('0xa8')](this,_0x225887);return this['channel'][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0xc2'),_0x225887[_0x35ad('0x4b')],_0x225887[_0x35ad('0x4c')],_0x225887[_0x35ad('0x4d')]));};AGIVertices[_0x35ad('0x11')][_0x35ad('0xc3')]=function(_0x4b7d3e){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x4b7d3e[_0x35ad('0x3b')]));var _0x452afc=this[_0x35ad('0x39')]['exec'](_0x4b7d3e['application'],_0x4b7d3e[_0x35ad('0xac')]);if(_0x452afc[_0x35ad('0xa3')]===-0x1){return _0x452afc;}return this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')]('Executed\x20command\x20%s\x20%s',_0x4b7d3e[_0x35ad('0xc4')],_0x4b7d3e[_0x35ad('0xac')]));};AGIVertices[_0x35ad('0x11')][_0x35ad('0xc5')]=function(_0x386896){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0xc6'),_0x386896['label']));if(!this['isConfigured'](_0x386896[_0x35ad('0x5e')])){return this[_0x35ad('0x39')]['noop'](_0x35ad('0xab'));}var _0x5c80a9='\x22'+_0x386896[_0x35ad('0x5e')]+'\x22';if(this[_0x35ad('0xa6')](_0x386896[_0x35ad('0xac')])){_0x5c80a9+=','+_0x386896[_0x35ad('0xac')];}var _0x3e2a66=this[_0x35ad('0x39')][_0x35ad('0xad')](_0x35ad('0xae'),_0x5c80a9);if(_0x3e2a66[_0x35ad('0xa3')]===-0x1){return _0x3e2a66;}return this[_0x35ad('0x39')]['noop'](util[_0x35ad('0x29')]('Executed\x20command\x20MRCPSynth\x20%s',_0x5c80a9));};AGIVertices['prototype']['sestektts']=function(_0x4d2057){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0xc7'),_0x4d2057['label']));if(!this[_0x35ad('0xa6')](_0x4d2057[_0x35ad('0x5e')])){return this[_0x35ad('0x39')][_0x35ad('0xaf')](_0x35ad('0xab'));}var _0x5547a7='\x22'+_0x4d2057[_0x35ad('0x5e')]+'\x22';if(this[_0x35ad('0xa6')](_0x4d2057[_0x35ad('0xac')])){_0x5547a7+=','+_0x4d2057[_0x35ad('0xac')];}var _0x1bbb8d=this[_0x35ad('0x39')][_0x35ad('0xad')](_0x35ad('0xae'),_0x5547a7);if(_0x1bbb8d[_0x35ad('0xa3')]===-0x1){return _0x1bbb8d;}return this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0xb0'),_0x5547a7));};AGIVertices['prototype'][_0x35ad('0xc8')]=function(_0x4f7957){logger[_0x35ad('0x2e')](util['format'](_0x35ad('0xc9'),_0x4f7957[_0x35ad('0x3b')]));if(!this[_0x35ad('0xa6')](_0x4f7957['grammar'])){return this['channel']['noop'](_0x35ad('0xb2'));}var _0x5ab4b8=_0x4f7957['grammar'];if(this[_0x35ad('0xa6')](_0x4f7957[_0x35ad('0xac')])){_0x5ab4b8+=','+_0x4f7957[_0x35ad('0xac')];}var _0x25b46b=this[_0x35ad('0x39')]['exec'](_0x35ad('0xca'),_0x5ab4b8);if(_0x25b46b[_0x35ad('0xa3')]===-0x1){return _0x25b46b;}var _0x92b25=this[_0x35ad('0xa2')](_0x35ad('0xb3'),_0x35ad('0xcb'));if(_0x92b25['result']===-0x1){return _0x92b25;}var _0x1a69e3=this[_0x35ad('0xa2')](_0x35ad('0xb4'),_0x35ad('0xcc'));if(_0x1a69e3[_0x35ad('0xa3')]===-0x1){return _0x1a69e3;}var _0xab4400=this['getAndSetVariable'](_0x35ad('0xcd'),_0x35ad('0xce'));if(_0xab4400[_0x35ad('0xa3')]===-0x1){return _0xab4400;}return this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5ab4b8));};AGIVertices['prototype'][_0x35ad('0xcf')]=function(_0x3d30c5){logger[_0x35ad('0x2e')](util['format'](_0x35ad('0xd0'),_0x3d30c5[_0x35ad('0x3b')]));if(!this[_0x35ad('0xa6')](_0x3d30c5[_0x35ad('0xb1')])){return this[_0x35ad('0x39')][_0x35ad('0xaf')](_0x35ad('0xb2'));}var _0x4db575=_0x3d30c5['grammar'];if(this['isConfigured'](_0x3d30c5['options'])){_0x4db575+=','+_0x3d30c5[_0x35ad('0xac')];}var _0x28eaee=this[_0x35ad('0x39')][_0x35ad('0xad')]('MRCPRecog',_0x4db575);if(_0x28eaee[_0x35ad('0xa3')]===-0x1){return _0x28eaee;}var _0x1f8dfb=this[_0x35ad('0xa2')](_0x35ad('0xb3'),_0x35ad('0xd1'));if(_0x1f8dfb['result']===-0x1){return _0x1f8dfb;}var _0x36afc5=this[_0x35ad('0xa2')](_0x35ad('0xb4'),'SESTEK_ASR_TRANSCRIPT');if(_0x36afc5[_0x35ad('0xa3')]===-0x1){return _0x36afc5;}var _0x971239=this[_0x35ad('0xa2')]('RECOG_INSTANCE()',_0x35ad('0xd2'));if(_0x971239['result']===-0x1){return _0x971239;}return this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0xb7'),_0x4db575));};AGIVertices[_0x35ad('0x11')][_0x35ad('0xd3')]=function(_0x4839b4){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0xd4'),_0x4839b4['label']));if(!this['isConfigured'](_0x4839b4[_0x35ad('0xd5')])){return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x4839b4,_0x35ad('0xd6'));}var _0x42c81b=this[_0x35ad('0x18')]['sync'](this,_0x4839b4['odbc_id']);if(!_0x42c81b){return this['channel'][_0x35ad('0x2c')](_0x4839b4,_0x35ad('0xd7'));}if(!this[_0x35ad('0xa6')](_0x4839b4['query'])){return this['channel']['error'](_0x4839b4,_0x35ad('0xd8'));}var _0x299fc4=_0x4839b4['query'][_0x35ad('0x5c')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x35ad('0xaf')](util[_0x35ad('0x29')]('query:\x20%s',_0x299fc4));var _0x29734c=this[_0x35ad('0xd9')][_0x35ad('0xa8')](this,_0x42c81b,_0x299fc4);this[_0x35ad('0x38')][_0x35ad('0xa8')](this,_0x4839b4,_0x299fc4);if(!this[_0x35ad('0xa6')](_0x4839b4[_0x35ad('0xda')])){return this[_0x35ad('0x39')][_0x35ad('0xaf')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3df597=this[_0x35ad('0xa0')][_0x35ad('0xa8')](this,_0x4839b4[_0x35ad('0xda')]);if(!_0x3df597){return this['channel'][_0x35ad('0x2c')](_0x4839b4,'no\x20variable\x20found');}var _0x5cdce7=this;_0x29734c[_0x35ad('0xdb')](function(_0x34b9f4,_0x54abbf){Object['keys'](_0x34b9f4)[_0x35ad('0xdb')](function(_0x69457b){_0x5cdce7['channel'][_0x35ad('0xa5')](util[_0x35ad('0x29')]('%s[%s][%s]',_0x3df597,_0x54abbf,_0x69457b),_0x34b9f4[_0x69457b]);});});this[_0x35ad('0x39')][_0x35ad('0xa5')](util[_0x35ad('0x29')](_0x35ad('0xdc'),_0x3df597),_0x29734c[_0x35ad('0x9a')]);return this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0xdd'),_0x3df597));};AGIVertices['prototype'][_0x35ad('0xde')]=function(_0x7a5b76){logger['debug'](util[_0x35ad('0x29')](_0x35ad('0xdf'),_0x7a5b76[_0x35ad('0x3b')]));if(!this[_0x35ad('0xa6')](_0x7a5b76['sip_id'])){return this['channel']['error'](_0x7a5b76,'no\x20user\x20selected');}var _0x45b0a7=this['getUser'][_0x35ad('0xa8')](this,_0x7a5b76['sip_id']);if(!_0x45b0a7){return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x7a5b76,_0x35ad('0xe0'));}var _0x2c9afb=this['channel'][_0x35ad('0xad')]('DIAL',[util[_0x35ad('0x29')](_0x35ad('0xe1'),_0x45b0a7),_0x7a5b76[_0x35ad('0x68')],_0x7a5b76[_0x35ad('0xe2')],_0x7a5b76[_0x35ad('0x66')]]);if(_0x2c9afb[_0x35ad('0xa3')]===-0x1){return _0x2c9afb;}return this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0xe3'),_0x35ad('0xe4')));};AGIVertices[_0x35ad('0x11')][_0x35ad('0xe5')]=function(_0x4b835b){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0xe6'),_0x4b835b[_0x35ad('0x3b')]));if(!this['isConfigured'](_0x4b835b['key'])){return this[_0x35ad('0x39')][_0x35ad('0xaf')](_0x35ad('0xe7'));}if(!this[_0x35ad('0xa6')](_0x4b835b['text'])){return this[_0x35ad('0x39')][_0x35ad('0xaf')]('no\x20text\x20configured');}this[_0x35ad('0x39')][_0x35ad('0xe8')]=!![];this[_0x35ad('0x38')](_0x4b835b);this[_0x35ad('0x45')](_0x4b835b['text'],'in','','');this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0xe9'),_0x4b835b[_0x35ad('0x5e')]));var _0x1f018b=this['googleDialogflow'][_0x35ad('0xa8')](this,_0x4b835b);if(_0x1f018b){for(var _0x82305c in _0x1f018b){if(_0x1f018b[_0x35ad('0x96')](_0x82305c)){this[_0x35ad('0x39')][_0x35ad('0xa5')](util[_0x35ad('0x29')](_0x35ad('0xea'),_0x82305c['toUpperCase']()),_0x1f018b[_0x82305c]);}}this['createSquareMessage'](_0x1f018b[_0x35ad('0xeb')],_0x35ad('0xec'),_0x35ad('0xe5'),'');return this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')]('Dialogflow\x20Result\x20%s',_0x1f018b[_0x35ad('0xeb')]));}return this[_0x35ad('0x39')]['error'](_0x4b835b,_0x35ad('0xed'));};AGIVertices[_0x35ad('0x11')][_0x35ad('0xee')]=function(_0x494a25){logger['info'](util[_0x35ad('0x29')](_0x35ad('0xef'),_0x494a25['label']));if(!this[_0x35ad('0xa6')](_0x494a25[_0x35ad('0x7c')])){return this[_0x35ad('0x39')][_0x35ad('0xaf')](_0x35ad('0xf0'));}if(!this[_0x35ad('0xa6')](_0x494a25['client_email'])){return this[_0x35ad('0x39')]['noop'](_0x35ad('0xf1'));}if(!this[_0x35ad('0xa6')](_0x494a25['private_key'])){return this[_0x35ad('0x39')][_0x35ad('0xaf')](_0x35ad('0xf2'));}if(!this[_0x35ad('0xa6')](_0x494a25['dialogflowV2_language'])){return this['channel'][_0x35ad('0xaf')](_0x35ad('0xf3'));}if(!this[_0x35ad('0xa6')](_0x494a25[_0x35ad('0x5e')])){return this['channel'][_0x35ad('0xaf')]('no\x20text\x20configured');}this[_0x35ad('0x39')][_0x35ad('0xe8')]=!![];this[_0x35ad('0x38')](_0x494a25);this[_0x35ad('0x45')](_0x494a25['text'],'in','','');this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0xf4'),_0x494a25[_0x35ad('0x5e')]));var _0x3754b6=this[_0x35ad('0x7b')][_0x35ad('0xa8')](this,_0x494a25);if(_0x3754b6){for(var _0xadba16 in _0x3754b6){if(_0x3754b6['hasOwnProperty'](_0xadba16)){if(_0xadba16!==_0x35ad('0xf5')){this[_0x35ad('0x39')]['setVariable'](util[_0x35ad('0x29')]('DIALOGFLOW_%s',_0xadba16['toUpperCase']()),_0x3754b6[_0xadba16]);}}}this[_0x35ad('0x45')](_0x3754b6[_0x35ad('0xeb')],_0x35ad('0xec'),_0x35ad('0xee'),_0x3754b6['providerResponse']);return this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0xf6'),_0x3754b6['speech']));}return this['channel'][_0x35ad('0x2c')](_0x494a25,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x35ad('0x11')][_0x35ad('0xf7')]=function(_0x1b4c34){logger['info'](util[_0x35ad('0x29')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x1b4c34[_0x35ad('0x3b')]));if(!this[_0x35ad('0xa6')](_0x1b4c34['ndauth_url'])){return this[_0x35ad('0x39')][_0x35ad('0xaf')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x35ad('0xa6')](_0x1b4c34[_0x35ad('0xf8')])){return this['channel'][_0x35ad('0xaf')](_0x35ad('0xf9'));}if(!this[_0x35ad('0xa6')](_0x1b4c34['password'])){return this[_0x35ad('0x39')]['noop'](_0x35ad('0xfa'));}if(!this[_0x35ad('0xa6')](_0x1b4c34[_0x35ad('0xfb')])){return this[_0x35ad('0x39')][_0x35ad('0xaf')](_0x35ad('0xab'));}this[_0x35ad('0x39')][_0x35ad('0xe8')]=!![];this[_0x35ad('0x38')](_0x1b4c34);this['createSquareMessage'](_0x1b4c34['text'],'in','','');this[_0x35ad('0x39')][_0x35ad('0xaf')](util['format']('Trying\x20SestekNDA:\x20%s',_0x1b4c34[_0x35ad('0x5e')]));var _0x53e1b9=this[_0x35ad('0x7f')][_0x35ad('0xa8')](this,_0x1b4c34);if(_0x53e1b9){for(var _0x465283 in _0x53e1b9){if(_0x53e1b9[_0x35ad('0x96')](_0x465283)){this[_0x35ad('0x39')][_0x35ad('0xa5')](util[_0x35ad('0x29')](_0x35ad('0xfc'),_0x465283[_0x35ad('0x6d')]()),_0x53e1b9[_0x465283]);}}this[_0x35ad('0x45')](_0x53e1b9[_0x35ad('0xeb')],'out',_0x35ad('0xf7'),'');if(_0x53e1b9[_0x35ad('0xfd')]){this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0xfe'),_0x53e1b9[_0x35ad('0xfd')]));var _0x382b9f=this[_0x35ad('0x39')][_0x35ad('0xff')](_0x53e1b9['audiofile']);try{fs[_0x35ad('0x100')](_0x53e1b9['audiofile']+'.wav');}catch(_0x1b2ab8){logger[_0x35ad('0x2c')](_0x1b2ab8);}return _0x382b9f;}else{return this['channel'][_0x35ad('0xaf')](util[_0x35ad('0x29')]('SestekNDA\x20Result\x20%s',_0x53e1b9[_0x35ad('0xeb')]));}}return this[_0x35ad('0x39')]['error'](_0x1b4c34,_0x35ad('0x101'));};AGIVertices['prototype'][_0x35ad('0x102')]=function(_0x5bfd6d){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x103'),_0x5bfd6d[_0x35ad('0x3b')]));return this[_0x35ad('0x39')]['noop'](_0x35ad('0x102'));};AGIVertices[_0x35ad('0x11')][_0x35ad('0x104')]=function(_0x281720){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x105'),_0x281720[_0x35ad('0x3b')]));var _0x3f2586='';if(_0x281720[_0x35ad('0x106')]){if(!this[_0x35ad('0xa6')](_0x281720['trunk_id'])){return this['channel']['error'](_0x281720,_0x35ad('0x107'));}else{var _0x50dc66=parseInt(_0x281720[_0x35ad('0x106')],0xa);if(isNaN(_0x50dc66)){_0x3f2586=_0x281720['trunk_id'];}else{_0x3f2586=this[_0x35ad('0x1d')][_0x35ad('0xa8')](this,_0x281720['trunk_id']);if(!_0x3f2586){return this[_0x35ad('0x39')]['error'](_0x281720,_0x35ad('0x108'));}}}}else if(_0x281720[_0x35ad('0x109')]){_0x3f2586=_0x281720[_0x35ad('0x109')];}else{return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x281720,_0x35ad('0x107'));}var _0x3ea7a6=this[_0x35ad('0x39')][_0x35ad('0xad')](_0x35ad('0xe4'),[util['format'](_0x35ad('0x10a'),_0x3f2586,_0x281720[_0x35ad('0x4b')]),_0x281720[_0x35ad('0x68')],_0x281720[_0x35ad('0xe2')],_0x281720[_0x35ad('0x66')]]);if(_0x3ea7a6[_0x35ad('0xa3')]===-0x1){return _0x3ea7a6;}return this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0xe3'),'DIAL'));};AGIVertices[_0x35ad('0x11')][_0x35ad('0x10b')]=function(_0x31ea4c){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x10c'),_0x31ea4c[_0x35ad('0x3b')]));return this['channel'][_0x35ad('0xaf')](_0x35ad('0x10b'));};AGIVertices[_0x35ad('0x11')]['getdigits']=function(_0x50cf51){logger['info'](util[_0x35ad('0x29')](_0x35ad('0x10d'),_0x50cf51[_0x35ad('0x3b')]));if(_0x50cf51[_0x35ad('0x10e')]===0x0){return this['maxRetry'](_0x50cf51);}_0x50cf51['retry']-=0x1;if(!this[_0x35ad('0xa6')](_0x50cf51[_0x35ad('0x10f')])){return this['channel'][_0x35ad('0x2c')](_0x50cf51,_0x35ad('0x110'));}var _0x3e5271=this[_0x35ad('0x1f')][_0x35ad('0xa8')](this,_0x50cf51['file_id']);if(!_0x3e5271){return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x50cf51,_0x35ad('0x111'));}if(!this[_0x35ad('0xa6')](_0x50cf51[_0x35ad('0xda')])){return this[_0x35ad('0x39')][_0x35ad('0x2c')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3d0c4d=this['channel'][_0x35ad('0x112')](_0x3e5271,_0x50cf51['response'],_0x50cf51['maxdigit']);var _0x4b4e83=_0x3d0c4d['result']?_0x3d0c4d['result'][_0x35ad('0x4f')]():'';logger[_0x35ad('0x2e')](_0x35ad('0x113'),JSON[_0x35ad('0x75')](_0x3d0c4d));if(_0x3d0c4d[_0x35ad('0xa3')]===-0x1){this[_0x35ad('0x38')]['sync'](this,_0x50cf51,_0x4b4e83);return _0x3d0c4d;}else if(_0x3d0c4d[_0x35ad('0xa1')]===_0x35ad('0x68')){_0x3d0c4d[_0x35ad('0xa3')]=_0x4b4e83[_0x35ad('0x9a')]>=parseInt(_0x50cf51[_0x35ad('0x114')])?'x':'i';}else{_0x3d0c4d[_0x35ad('0xa3')]=_0x4b4e83['length']>=parseInt(_0x50cf51[_0x35ad('0x114')])&&_0x4b4e83['length']<=parseInt(_0x50cf51['maxdigit'])?'x':'i';}var _0x305db5=this[_0x35ad('0xa0')][_0x35ad('0xa8')](this,_0x50cf51[_0x35ad('0xda')]);if(!_0x305db5){return this[_0x35ad('0x39')]['error'](_0x50cf51,_0x35ad('0x115'));}this[_0x35ad('0x39')][_0x35ad('0xa5')](_0x305db5,_0x4b4e83);if(this['isConfigured'](_0x50cf51['hiddendigitsnum'])){var _0x369a62=parseInt(_0x50cf51[_0x35ad('0x116')],0xa);var _0x5e115d=rs[_0x35ad('0x117')]({'charset':'*','length':_0x369a62});var _0x52ccf5=_0x4b4e83['length'];if(_0x52ccf5>0x0){if(_0x52ccf5>_0x369a62){this[_0x35ad('0x38')]['sync'](this,_0x50cf51,_0x50cf51[_0x35ad('0x118')]==='first'?_0x5e115d+_0x4b4e83['substr'](_0x369a62):_0x4b4e83[_0x35ad('0x119')](0x0,_0x52ccf5-_0x369a62)+_0x5e115d);}else{this[_0x35ad('0x38')]['sync'](this,_0x50cf51,rs[_0x35ad('0x117')]({'charset':'*','length':_0x52ccf5}));}}else{this[_0x35ad('0x38')]['sync'](this,_0x50cf51,'');}}else{this['createSquareDetailsReport'][_0x35ad('0xa8')](this,_0x50cf51,_0x4b4e83);}return _0x3d0c4d;};AGIVertices[_0x35ad('0x11')][_0x35ad('0xf')]=function(_0xf53ca3){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x11a'),_0xf53ca3[_0x35ad('0x3b')]));return this[_0x35ad('0xe')](_0xf53ca3);};AGIVertices[_0x35ad('0x11')][_0x35ad('0x11b')]=function(_0x380c76){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x11c'),_0x380c76[_0x35ad('0x3b')]));this[_0x35ad('0x38')][_0x35ad('0xa8')](this,_0x380c76,_0x380c76[_0x35ad('0x11d')]);return this['channel'][_0x35ad('0xaf')](util[_0x35ad('0x29')]('GOAL\x20%s',_0x380c76[_0x35ad('0x11d')]));};AGIVertices['prototype'][_0x35ad('0x11e')]=function(_0x26a97c){logger[_0x35ad('0x2e')](util['format'](_0x35ad('0x11f'),_0x26a97c[_0x35ad('0x3b')]));if(!this['isConfigured'](_0x26a97c[_0x35ad('0x87')])||!this['isConfigured'](_0x26a97c['aws_secret_access_key'])){return this[_0x35ad('0x39')][_0x35ad('0xaf')](_0x35ad('0x120'));}if(!this[_0x35ad('0xa6')](_0x26a97c['text'])){return this[_0x35ad('0x39')][_0x35ad('0xaf')]('no\x20text\x20configured');}this[_0x35ad('0x39')]['noop'](util['format'](_0x35ad('0x121'),_0x26a97c['text']));var _0x4bfbe3=this['awsPolly'][_0x35ad('0xa8')](this,_0x26a97c);if(_0x4bfbe3){this['channel']['noop'](util[_0x35ad('0x29')]('aws\x20Polly\x20%s\x20file\x20created',_0x4bfbe3));var _0x92f21d=this[_0x35ad('0x39')][_0x35ad('0xff')](_0x4bfbe3);try{fs['unlink'](_0x4bfbe3+_0x35ad('0x122'));}catch(_0x5f21e8){logger[_0x35ad('0x2c')](_0x5f21e8);}return _0x92f21d;}return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x26a97c,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x35ad('0x123')]=function(_0x10d7b1){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x124'),_0x10d7b1['label']));if(!this[_0x35ad('0xa6')](_0x10d7b1[_0x35ad('0x87')])||!this[_0x35ad('0xa6')](_0x10d7b1['aws_secret_access_key'])){return this[_0x35ad('0x39')][_0x35ad('0xaf')](_0x35ad('0x120'));}if(!this[_0x35ad('0xa6')](_0x10d7b1[_0x35ad('0x8d')])){return this['channel']['noop'](_0x35ad('0x125'));}if(!this[_0x35ad('0xa6')](_0x10d7b1[_0x35ad('0x5e')])){return this[_0x35ad('0x39')][_0x35ad('0xaf')](_0x35ad('0xab'));}this[_0x35ad('0x39')][_0x35ad('0xe8')]=!![];this['createSquareDetailsReport'](_0x10d7b1);this[_0x35ad('0x45')](_0x10d7b1[_0x35ad('0x5e')],'in','','');this[_0x35ad('0x39')]['noop'](util[_0x35ad('0x29')](_0x35ad('0x126'),_0x10d7b1['text']));var _0x5c4de6=this[_0x35ad('0x8b')][_0x35ad('0xa8')](this,_0x10d7b1);if(_0x5c4de6){for(var _0x1c803b in _0x5c4de6){if(_0x5c4de6[_0x35ad('0x96')](_0x1c803b)&&_['isString'](_0x5c4de6[_0x1c803b])){this['channel'][_0x35ad('0xa5')](util['format'](_0x35ad('0x127'),_0x1c803b['toUpperCase']()),_0x5c4de6[_0x1c803b]);}}if(_[_0x35ad('0x48')](_0x5c4de6[_0x35ad('0x128')])){return this['channel']['noop'](_0x35ad('0x129'));}else{this[_0x35ad('0x45')](_0x5c4de6[_0x35ad('0x128')],'out',_0x35ad('0x12a'),'');return this[_0x35ad('0x39')]['noop'](util[_0x35ad('0x29')](_0x35ad('0x12b'),_0x5c4de6['message']));}}return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x10d7b1,_0x35ad('0x12c'));};AGIVertices[_0x35ad('0x11')][_0x35ad('0x12d')]=function(_0x569361){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x12e'),_0x569361[_0x35ad('0x3b')],_0x569361[_0x35ad('0x68')]));if(!this[_0x35ad('0xa6')](_0x569361[_0x35ad('0x79')])){return this[_0x35ad('0x39')][_0x35ad('0xaf')](_0x35ad('0xe7'));}var _0x26b5c6='wav';var _0x336f22=util[_0x35ad('0x29')]('%s/recordings/%s',FILES_PATH,rs[_0x35ad('0x117')](0x4));var _0x343164=util[_0x35ad('0x29')](_0x35ad('0x9d'),_0x336f22,_0x26b5c6);var _0x511b4b=!![];if(_0x569361['beep']===_0x35ad('0x12f')){_0x511b4b=![];}var _0x279652=this[_0x35ad('0x39')]['recordFile'](_0x336f22,_0x26b5c6,_0x569361['intKey'],_0x569361['timeout'],undefined,_0x511b4b);if(_0x279652['result']!==-0x1){this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')]('google\x20%s\x20file\x20created',_0x343164));var _0x2c96bb=this[_0x35ad('0x8e')][_0x35ad('0xa8')](this,_0x569361,_0x343164);if(_0x2c96bb){for(var _0x37ef30 in _0x2c96bb){if(_0x2c96bb[_0x35ad('0x96')](_0x37ef30)){this[_0x35ad('0x39')][_0x35ad('0xa5')](util[_0x35ad('0x29')](_0x35ad('0x130'),_0x37ef30[_0x35ad('0x6d')]()),_0x2c96bb[_0x37ef30]);}}return this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')]('GoogleASR\x20Result\x20%s',JSON[_0x35ad('0x75')](_0x2c96bb)));}}return _0x279652;};AGIVertices[_0x35ad('0x11')][_0x35ad('0x131')]=function(_0x178ce3){logger['info'](util[_0x35ad('0x29')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x178ce3['label']));if(!this[_0x35ad('0xa6')](_0x178ce3['appid'])){return this[_0x35ad('0x39')][_0x35ad('0xaf')]('no\x20appid\x20configured');}if(!this[_0x35ad('0xa6')](_0x178ce3[_0x35ad('0x132')])){return this[_0x35ad('0x39')][_0x35ad('0xaf')](_0x35ad('0x133'));}var _0x513569=_0x35ad('0x134');var _0x271032=util[_0x35ad('0x29')]('%s/recordings/%s',FILES_PATH,rs[_0x35ad('0x117')](0x4));var _0x2623db=util[_0x35ad('0x29')](_0x35ad('0x9d'),_0x271032,_0x513569);var _0x516462=!![];if(_0x178ce3[_0x35ad('0x135')]===_0x35ad('0x12f')){_0x516462=![];}var _0x1c5beb=this[_0x35ad('0x39')][_0x35ad('0x136')](_0x271032,_0x513569,_0x178ce3[_0x35ad('0x137')],_0x178ce3[_0x35ad('0x68')],undefined,_0x516462);if(_0x1c5beb[_0x35ad('0xa3')]!==-0x1){this[_0x35ad('0x39')][_0x35ad('0xaf')](util['format'](_0x35ad('0x138'),_0x2623db));var _0x506ebe=this[_0x35ad('0x139')][_0x35ad('0xa8')](this,_0x178ce3,_0x2623db);if(_0x506ebe){for(var _0x5132b2 in _0x506ebe){if(_0x506ebe['hasOwnProperty'](_0x5132b2)){this['channel'][_0x35ad('0xa5')](util['format']('TILDE_ASR_%s',_0x5132b2[_0x35ad('0x6d')]()),_0x506ebe[_0x5132b2]);}}return this['channel'][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0x13a'),JSON[_0x35ad('0x75')](_0x506ebe)));}}return _0x1c5beb;};AGIVertices[_0x35ad('0x11')]['gotoc']=function(_0xbb801){logger[_0x35ad('0x2e')](util['format'](_0x35ad('0x13b'),_0xbb801['label']));return this['channel'][_0x35ad('0x13c')](_0xbb801[_0x35ad('0x40')],_0xbb801[_0x35ad('0x41')],_0xbb801[_0x35ad('0x13d')]);};AGIVertices[_0x35ad('0x11')][_0x35ad('0x13e')]=function(_0x2bde74){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x13f'),_0x2bde74[_0x35ad('0x3b')]));if(!this[_0x35ad('0xa6')](_0x2bde74[_0x35ad('0x140')])){return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x2bde74,'no\x20condition\x20configured');}try{var _0x5a132c=eval(_0x2bde74['condition'])?_0x35ad('0x141'):_0x35ad('0x142');this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0x143'),_0x2bde74[_0x35ad('0x140')],_0x5a132c));return{'code':0xc8,'result':_0x5a132c};}catch(_0x531f02){return{'code':0xc8,'result':_0x35ad('0x142')};}};AGIVertices[_0x35ad('0x11')][_0x35ad('0x144')]=function(_0x3d72f6){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x145'),_0x3d72f6[_0x35ad('0x3b')]));if(!this[_0x35ad('0xa6')](_0x3d72f6[_0x35ad('0x146')])){return this['channel']['error'](_0x3d72f6,'no\x20interval\x20configured');}var _0x48bc36=this['getIntervals'][_0x35ad('0xa8')](this,_0x3d72f6[_0x35ad('0x146')]);if(!_0x48bc36){return this['channel'][_0x35ad('0x2c')](_0x3d72f6,'no\x20intervals\x20found');}for(var _0x3cb6e9=0x0;_0x3cb6e9<_0x48bc36[_0x35ad('0x9a')];_0x3cb6e9+=0x1){var _0x52aa5e=this[_0x35ad('0x39')][_0x35ad('0xa0')](util[_0x35ad('0x29')]('IFTIME(%s?true:false)',_0x48bc36[_0x3cb6e9]));if(_0x52aa5e[_0x35ad('0xa3')]===-0x1){return _0x52aa5e;}logger['info'](util[_0x35ad('0x29')]('IFTIME\x20%s\x20%s',_0x48bc36[_0x3cb6e9],_0x52aa5e[_0x35ad('0xa1')]));if(_0x52aa5e[_0x35ad('0xa1')]===_0x35ad('0x141')){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')]('IFTIME\x20%s\x20%s',_0x48bc36[_0x3cb6e9],_0x35ad('0x141')));this['channel'][_0x35ad('0xaf')](util[_0x35ad('0x29')]('IFTIME\x20%s\x20%s',_0x48bc36[_0x3cb6e9],_0x35ad('0x141')));return{'code':0xc8,'result':'true'};}else{logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x147'),_0x48bc36[_0x3cb6e9],_0x35ad('0x142')));this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0x147'),_0x48bc36[_0x3cb6e9],_0x35ad('0x142')));}}return{'code':0xc8,'result':_0x35ad('0x142')};};AGIVertices[_0x35ad('0x11')][_0x35ad('0x148')]=function(_0xba4c3a){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0xba4c3a[_0x35ad('0x3b')]));return this['channel'][_0x35ad('0x148')]();};AGIVertices[_0x35ad('0x11')]['ispeechasr']=function(_0x38c22f){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x149'),_0x38c22f[_0x35ad('0x3b')]));if(!this[_0x35ad('0xa6')](_0x38c22f['key'])){return this[_0x35ad('0x39')][_0x35ad('0xaf')]('no\x20key\x20configured');}var _0x23f4da=_0x35ad('0x134');var _0xd2a8f1=util[_0x35ad('0x29')]('%s/recordings/%s',FILES_PATH,rs[_0x35ad('0x117')](0x4));var _0x4198a1=util[_0x35ad('0x29')](_0x35ad('0x9d'),_0xd2a8f1,_0x23f4da);var _0x378d44=!![];if(_0x38c22f[_0x35ad('0x135')]===_0x35ad('0x12f')){_0x378d44=![];}var _0x439f05=this[_0x35ad('0x39')][_0x35ad('0x136')](_0xd2a8f1,_0x23f4da,_0x38c22f['intKey'],_0x38c22f[_0x35ad('0x68')],undefined,_0x378d44);if(_0x439f05[_0x35ad('0xa3')]!==-0x1){this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0x14a'),_0x4198a1));var _0x3cc39e=this[_0x35ad('0x83')][_0x35ad('0xa8')](this,_0x38c22f,_0x4198a1);if(_0x3cc39e){for(var _0x3eb5ea in _0x3cc39e){if(_0x3cc39e[_0x35ad('0x96')](_0x3eb5ea)){this[_0x35ad('0x39')][_0x35ad('0xa5')](util[_0x35ad('0x29')](_0x35ad('0x14b'),_0x3eb5ea[_0x35ad('0x6d')]()),_0x3cc39e[_0x3eb5ea]);}}return this['channel']['noop'](util[_0x35ad('0x29')](_0x35ad('0x14c'),JSON[_0x35ad('0x75')](_0x3cc39e)));}}return _0x439f05;};AGIVertices[_0x35ad('0x11')][_0x35ad('0x14d')]=function(_0x286eaf){logger['info'](util['format'](_0x35ad('0x14e'),_0x286eaf[_0x35ad('0x3b')]));if(!this[_0x35ad('0xa6')](_0x286eaf[_0x35ad('0x79')])){return this[_0x35ad('0x39')]['noop'](_0x35ad('0xe7'));}if(!this[_0x35ad('0xa6')](_0x286eaf['text'])){return this[_0x35ad('0x39')][_0x35ad('0xaf')](_0x35ad('0xab'));}this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0x14f'),_0x286eaf['text']));var _0x2cebde=this[_0x35ad('0x80')]['sync'](this,_0x286eaf);if(_0x2cebde){this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0x14a'),_0x2cebde));var _0x5f2566=this[_0x35ad('0x39')]['streamFile'](_0x2cebde,_0x286eaf[_0x35ad('0x137')]);try{fs[_0x35ad('0x100')](_0x2cebde+_0x35ad('0x122'));}catch(_0xfdb1ad){logger[_0x35ad('0x2c')](_0xfdb1ad);}return _0x5f2566;}return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x286eaf,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x35ad('0x11')][_0x35ad('0x150')]=function(_0x56a323){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x56a323[_0x35ad('0x3b')]));if(!this[_0x35ad('0xa6')](_0x56a323[_0x35ad('0x151')])){return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x56a323,'no\x20find\x20by\x20configured');}logger[_0x35ad('0x2e')](util[_0x35ad('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x35ad('0x3d')],_0x56a323[_0x35ad('0x151')]));var _0x3fc7b2=this['agentLogin'][_0x35ad('0xa8')](this,_0x56a323[_0x35ad('0x151')]);if(_0x3fc7b2){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x152'),this[_0x35ad('0x39')]['callerid'],_0x56a323[_0x35ad('0x151')]));this['channel'][_0x35ad('0xaf')](util['format'](_0x35ad('0x152'),this['channel'][_0x35ad('0x3d')],_0x56a323[_0x35ad('0x151')]));return{'code':0xc8,'result':'success'};}else{logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x153'),this[_0x35ad('0x39')]['callerid'],_0x56a323[_0x35ad('0x151')]));this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0x153'),this['channel'][_0x35ad('0x3d')],_0x56a323[_0x35ad('0x151')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x35ad('0x154')]=function(_0x8f00c5){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x8f00c5[_0x35ad('0x3b')]));if(!this[_0x35ad('0xa6')](_0x8f00c5[_0x35ad('0x151')])){return this[_0x35ad('0x39')]['error'](_0x8f00c5,_0x35ad('0x155'));}logger['info'](util[_0x35ad('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x35ad('0x39')]['callerid'],_0x8f00c5['findBy']));var _0x4c591e=this[_0x35ad('0x56')][_0x35ad('0xa8')](this,_0x8f00c5['findBy']);if(_0x4c591e){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x35ad('0x39')][_0x35ad('0x3d')],_0x8f00c5[_0x35ad('0x151')]));this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x35ad('0x3d')],_0x8f00c5[_0x35ad('0x151')]));return{'code':0xc8,'result':'success'};}else{logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x153'),this['channel'][_0x35ad('0x3d')],_0x8f00c5[_0x35ad('0x151')]));this[_0x35ad('0x39')]['noop'](util[_0x35ad('0x29')](_0x35ad('0x153'),this[_0x35ad('0x39')][_0x35ad('0x3d')],_0x8f00c5[_0x35ad('0x151')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x35ad('0x11')]['math']=function(_0x2a3105){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x156'),_0x2a3105[_0x35ad('0x3b')]));if(!this[_0x35ad('0xa6')](_0x2a3105['operation'])){return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x2a3105,_0x35ad('0x157'));}this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')]('math\x20%s',_0x2a3105[_0x35ad('0x158')]));var _0x4edb81=eval(_0x2a3105[_0x35ad('0x158')]);if(!this['isConfigured'](_0x2a3105[_0x35ad('0xda')])){return this[_0x35ad('0x39')][_0x35ad('0xaf')](_0x35ad('0x159'));}var _0x58663f=this[_0x35ad('0xa0')][_0x35ad('0xa8')](this,_0x2a3105[_0x35ad('0xda')]);if(!_0x58663f){return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x2a3105,'no\x20variable\x20found');}if(_[_0x35ad('0x99')](_0x4edb81)){var _0x433400=this;_0x4edb81[_0x35ad('0xdb')](function(_0x92dda4,_0x5edf27){_0x433400[_0x35ad('0x39')][_0x35ad('0xa5')](util[_0x35ad('0x29')](_0x35ad('0x15a'),_0x58663f,_0x5edf27),_0x92dda4);});return this[_0x35ad('0x39')][_0x35ad('0xaf')](util['format'](_0x35ad('0x15b'),_0x58663f));}else{return this[_0x35ad('0x39')][_0x35ad('0xa5')](_0x58663f,_0x4edb81);}};AGIVertices[_0x35ad('0x11')]['menu']=function(_0x5c6974){logger[_0x35ad('0x2e')](util['format'](_0x35ad('0x15c'),_0x5c6974[_0x35ad('0x3b')]));if(_0x5c6974['retry']===0x0){return this[_0x35ad('0xa7')](_0x5c6974);}_0x5c6974[_0x35ad('0x10e')]-=0x1;if(!this[_0x35ad('0xa6')](_0x5c6974[_0x35ad('0x10f')])){return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x5c6974,_0x35ad('0x110'));}var _0x22861c=this['getSound'][_0x35ad('0xa8')](this,_0x5c6974[_0x35ad('0x10f')]);if(!_0x22861c){return this[_0x35ad('0x39')]['error'](_0x5c6974,_0x35ad('0x111'));}var _0x296365=this[_0x35ad('0x39')][_0x35ad('0x112')](_0x22861c,_0x5c6974[_0x35ad('0x15d')],_0x5c6974['digit']);var _0x4f4437=_0x296365[_0x35ad('0xa3')];if(_0x296365[_0x35ad('0xa3')]===-0x1){this[_0x35ad('0x38')][_0x35ad('0xa8')](this,_0x5c6974,'-1');return _0x296365;}else if(_0x296365['extra']===_0x35ad('0x68')){_0x296365['result']=_0x296365[_0x35ad('0xa3')][_0x35ad('0x9a')]>0x0?_0x296365[_0x35ad('0xa3')]:'t';}else if(_['isEmpty'](_0x296365['result'])){_0x296365[_0x35ad('0xa3')]='#';_0x4f4437='#';}if(!this[_0x35ad('0xa6')](_0x5c6974[_0x35ad('0xda')])){this['channel'][_0x35ad('0xaf')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x3a55bd=this[_0x35ad('0xa0')]['sync'](this,_0x5c6974[_0x35ad('0xda')]);if(!_0x3a55bd){return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x5c6974,'no\x20variable\x20found');}this[_0x35ad('0x39')][_0x35ad('0xa5')](_0x3a55bd,_0x4f4437);}this['createSquareDetailsReport'][_0x35ad('0xa8')](this,_0x5c6974,_0x4f4437);return _0x296365;};AGIVertices[_0x35ad('0x11')][_0x35ad('0xaf')]=function(_0x122b93){logger['info'](util[_0x35ad('0x29')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x122b93['label']));return this['channel'][_0x35ad('0xaf')](_0x122b93[_0x35ad('0x15e')]||_0x122b93[_0x35ad('0x3b')]);};AGIVertices[_0x35ad('0x11')][_0x35ad('0x15f')]=function(_0x4483b2){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x160'),_0x4483b2[_0x35ad('0x3b')]));if(!this[_0x35ad('0xa6')](_0x4483b2[_0x35ad('0x151')])){return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x4483b2,_0x35ad('0x155'));}logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x161'),this[_0x35ad('0x39')][_0x35ad('0x3d')],_0x4483b2[_0x35ad('0x151')]));var _0xe9fe09=this[_0x35ad('0x51')][_0x35ad('0xa8')](this,_0x4483b2[_0x35ad('0x162')]);var _0x26e88c=this[_0x35ad('0x54')][_0x35ad('0xa8')](this,_0x4483b2[_0x35ad('0x151')],_0xe9fe09);if(_0x26e88c){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x152'),this[_0x35ad('0x39')][_0x35ad('0x3d')],_0x4483b2[_0x35ad('0x151')]));this[_0x35ad('0x39')][_0x35ad('0xaf')](util['format'](_0x35ad('0x152'),this[_0x35ad('0x39')][_0x35ad('0x3d')],_0x4483b2[_0x35ad('0x151')]));return{'code':0xc8,'result':_0x35ad('0x163')};}else{logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x153'),this[_0x35ad('0x39')][_0x35ad('0x3d')],_0x4483b2[_0x35ad('0x151')]));this[_0x35ad('0x39')]['noop'](util[_0x35ad('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x35ad('0x3d')],_0x4483b2[_0x35ad('0x151')]));return{'code':0xc8,'result':_0x35ad('0x164')};}};AGIVertices[_0x35ad('0x11')][_0x35ad('0x165')]=function(_0xffb3cf){logger[_0x35ad('0x2e')](util['format'](_0x35ad('0x166'),_0xffb3cf[_0x35ad('0x3b')]));if(!this[_0x35ad('0xa6')](_0xffb3cf[_0x35ad('0x10f')])){return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0xffb3cf,_0x35ad('0x110'));}var _0xba1f91=this[_0x35ad('0x1f')][_0x35ad('0xa8')](this,_0xffb3cf[_0x35ad('0x10f')]);if(!_0xba1f91){return this[_0x35ad('0x39')]['error'](_0xffb3cf,_0x35ad('0x111'));}var _0x40a690=this['channel'][_0x35ad('0xad')]('PLAYBACK',[_0xba1f91,_0xffb3cf[_0x35ad('0xe2')]]);if(_0x40a690['result']===-0x1){return _0x40a690;}return this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0x167'),'PLAYBACK',_0xba1f91));};AGIVertices['prototype'][_0x35ad('0x168')]=function(_0x529037){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x169'),_0x529037['label']));if(!this[_0x35ad('0xa6')](_0x529037['queue_id'])){return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x529037,_0x35ad('0x16a'));}var _0x31a806='';var _0x239101=parseInt(_0x529037[_0x35ad('0x16b')],0xa);if(isNaN(_0x239101)){_0x31a806=_0x529037['queue_id'];}else{_0x31a806=this[_0x35ad('0x16c')][_0x35ad('0xa8')](this,_0x529037[_0x35ad('0x16b')]);if(!_0x31a806){return this[_0x35ad('0x39')]['error'](_0x529037,_0x35ad('0x16d'));}}var _0x23e485='';if(this['isConfigured'](_0x529037[_0x35ad('0x10f')])){var _0x13fa0f=this[_0x35ad('0x1f')][_0x35ad('0xa8')](this,_0x529037[_0x35ad('0x10f')]);if(_0x13fa0f){_0x23e485=_0x13fa0f;}}this['createSquareDetailsReport'][_0x35ad('0xa8')](this,_0x529037,_0x31a806);if(_0x529037[_0x35ad('0xe2')][_0x35ad('0x16e')]('x')<0x0){_0x529037[_0x35ad('0xe2')]+='x';}if(_0x529037['opts'][_0x35ad('0x16e')]('X')<0x0){_0x529037['opts']+='X';}this[_0x35ad('0x39')]['setVariable']('XMCS-QUEUE',_0x31a806?_0x31a806['toLowerCase']():'');var _0x3e9cde=this[_0x35ad('0x39')][_0x35ad('0xad')](_0x35ad('0x16f'),[_0x31a806,_0x529037[_0x35ad('0xe2')],_0x529037[_0x35ad('0x66')],_0x23e485,_0x529037[_0x35ad('0x68')],_0x529037[_0x35ad('0x8')],_0x529037[_0x35ad('0x170')],_0x529037[_0x35ad('0x171')],'',_0x529037['position']]);if(_0x3e9cde[_0x35ad('0xa3')]===-0x1){return _0x3e9cde;}return this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')]('Executed\x20command\x20%s\x20%s',_0x35ad('0x16f'),_0x31a806));};AGIVertices[_0x35ad('0x11')][_0x35ad('0x172')]=function(_0x1ef9b4){logger['info'](util[_0x35ad('0x29')](_0x35ad('0x173'),_0x1ef9b4['label']));var _0x4e7fd5=_0x1ef9b4['recordingFormat']||'wav';var _0x30c2a2=util['format'](_0x35ad('0x174'),this[_0x35ad('0x39')][_0x35ad('0x3a')],rs['generate'](0x5));var _0x1ff62c=util[_0x35ad('0x29')](_0x35ad('0x175'),FILES_PATH,_0x30c2a2,_0x4e7fd5);var _0x5f2916=util[_0x35ad('0x29')](_0x35ad('0x176'),FILES_PATH,_0x30c2a2);this['createSquareRecording'][_0x35ad('0xa8')](this,_0x1ef9b4,_0x30c2a2,_0x1ff62c);this['channel']['setVariable']('RECORDING_SAVENAME',_0x30c2a2);logger[_0x35ad('0x2e')](_0x35ad('0x177'),_0x5f2916,_0x4e7fd5,_0x1ef9b4[_0x35ad('0x178')],_0x1ef9b4['timeout']);return this[_0x35ad('0x39')][_0x35ad('0x136')](_0x5f2916,_0x4e7fd5,_0x1ef9b4['escape_digits'],_0x1ef9b4[_0x35ad('0x68')],undefined,!![]);};AGIVertices['prototype'][_0x35ad('0x179')]=function(_0x35b5f8){logger['info'](util[_0x35ad('0x29')](_0x35ad('0x17a'),_0x35b5f8[_0x35ad('0x3b')]));if(!this['isConfigured'](_0x35b5f8[_0x35ad('0x66')])){return this[_0x35ad('0x39')][_0x35ad('0xaf')](_0x35ad('0x17b'));}var _0x23d23d=this[_0x35ad('0x65')][_0x35ad('0xa8')](this,_0x35b5f8);logger['info'](util['format']('Response:',util['inspect'](_0x23d23d,{'showHidden':![],'depth':null})));if(!this[_0x35ad('0xa6')](_0x35b5f8[_0x35ad('0xda')])){return this[_0x35ad('0x39')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x396a7f=this['getVariable'][_0x35ad('0xa8')](this,_0x35b5f8['variable_id']);if(!_0x396a7f){return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x35b5f8,_0x35ad('0x115'));}this[_0x35ad('0x39')][_0x35ad('0xa5')](util[_0x35ad('0x29')]('%s_STATUS_CODE',_0x396a7f),_0x23d23d[_0x35ad('0x17c')]?_0x23d23d[_0x35ad('0x17c')]:_0x35ad('0x17d'));this[_0x35ad('0x39')]['setVariable'](util[_0x35ad('0x29')](_0x35ad('0x17e'),_0x396a7f),_0x23d23d[_0x35ad('0x17f')]?_0x23d23d[_0x35ad('0x17f')]:'OK');if(_0x23d23d[_0x35ad('0x6e')]){try{this['saveRestApiResult'](_0x23d23d[_0x35ad('0x6e')],_0x396a7f);}catch(_0x4e0cdd){logger[_0x35ad('0x2c')](util[_0x35ad('0x29')](_0x35ad('0x180'),_0x396a7f));}}return this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0xdd'),_0x396a7f));};AGIVertices[_0x35ad('0x11')][_0x35ad('0x181')]=function(_0x13cb77){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x182'),_0x13cb77[_0x35ad('0x3b')]));return this[_0x35ad('0x39')][_0x35ad('0x183')](_0x13cb77[_0x35ad('0x184')][_0x35ad('0x5c')](/\s+/g,''),_0x13cb77[_0x35ad('0x178')]);};AGIVertices['prototype'][_0x35ad('0x185')]=function(_0x28e212){logger[_0x35ad('0x2e')](util['format'](_0x35ad('0x186'),_0x28e212[_0x35ad('0x3b')]));return this[_0x35ad('0x39')]['sayNumber'](_0x28e212[_0x35ad('0x67')]['replace'](/\s+/g,''),_0x28e212[_0x35ad('0x178')]);};AGIVertices['prototype'][_0x35ad('0x187')]=function(_0x4c10b6){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x188'),_0x4c10b6[_0x35ad('0x3b')]));return this[_0x35ad('0x39')]['sayPhonetic'](_0x4c10b6[_0x35ad('0x5e')],_0x4c10b6[_0x35ad('0x178')]);};AGIVertices['prototype'][_0x35ad('0x189')]=function(_0xc4f4fa){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0xc4f4fa['label']));if(!this[_0x35ad('0xa6')](_0xc4f4fa[_0x35ad('0x18a')])){return this[_0x35ad('0x39')]['noop'](_0x35ad('0x18b'));}var _0x4a5a4e=this[_0x35ad('0x22')][_0x35ad('0xa8')](this,_0xc4f4fa[_0x35ad('0x18a')]);if(!_0x4a5a4e||!_0x4a5a4e['Smtp']){return this[_0x35ad('0x39')]['error'](_0xc4f4fa,_0x35ad('0x18c'));}var _0x1b2099={'from':util[_0x35ad('0x29')]('\x22%s\x22\x20<%s>',_0x4a5a4e[_0x35ad('0x17')],_0x4a5a4e[_0x35ad('0x18d')]||_0x4a5a4e[_0x35ad('0x18e')]['user']),'to':_0xc4f4fa['to']||'','cc':_0xc4f4fa['cc']||'','bcc':_0xc4f4fa['bcc']||'','subject':_0xc4f4fa[_0x35ad('0x18f')],'html':_0xc4f4fa[_0x35ad('0x5e')],'text':_0xc4f4fa['text']};if(this[_0x35ad('0xa6')](_0xc4f4fa[_0x35ad('0x190')])){}logger[_0x35ad('0x191')](_0x35ad('0x192'),JSON[_0x35ad('0x75')](_0x1b2099));this[_0x35ad('0x38')][_0x35ad('0xa8')](this,_0xc4f4fa,_0xc4f4fa['account_id']);this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0x193'),_0x4a5a4e[_0x35ad('0x17')]));this[_0x35ad('0x23')][_0x35ad('0xa8')](this,_0x4a5a4e[_0x35ad('0x194')],_0x1b2099);return this[_0x35ad('0x39')][_0x35ad('0xaf')](_0x35ad('0x195'));};AGIVertices['prototype']['sendFax']=function(_0x354008){logger[_0x35ad('0x2e')](util['format'](_0x35ad('0x196'),_0x354008[_0x35ad('0x3b')]));return this[_0x35ad('0x39')][_0x35ad('0xaf')](_0x35ad('0x197'));};AGIVertices[_0x35ad('0x11')][_0x35ad('0x198')]=function(_0x5c6ac3){logger[_0x35ad('0x2e')](util['format'](_0x35ad('0x199'),_0x5c6ac3[_0x35ad('0x3b')]));if(!this[_0x35ad('0xa6')](_0x5c6ac3['sms_account_id'])){return this['channel']['noop'](_0x35ad('0x19a'));}var _0x9c108b=this[_0x35ad('0x35')][_0x35ad('0xa8')](this,_0x5c6ac3[_0x35ad('0x19b')]);if(!_0x9c108b){return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x5c6ac3,_0x35ad('0x19c'));}var _0xf4fd13={'body':_0x5c6ac3[_0x35ad('0x19d')],'phone':_0x5c6ac3['to']||'','SmsAccountId':_0x9c108b['id']};logger['debug'](_0x35ad('0x19e'),JSON[_0x35ad('0x75')](_0xf4fd13));this[_0x35ad('0x38')]['sync'](this,_0x5c6ac3,_0x5c6ac3[_0x35ad('0x19b')]);this[_0x35ad('0x39')][_0x35ad('0xaf')](util['format'](_0x35ad('0x19f'),_0x9c108b['name']));this[_0x35ad('0x37')][_0x35ad('0xa8')](this,_0xf4fd13);return this['channel']['noop'](_0x35ad('0x1a0'));};AGIVertices[_0x35ad('0x11')][_0x35ad('0x1a1')]=function(_0x25efaa){logger['info'](util[_0x35ad('0x29')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x25efaa[_0x35ad('0x3b')]));if(!this['isConfigured'](_0x25efaa[_0x35ad('0xda')])){return this[_0x35ad('0x39')]['error'](_0x25efaa,'no\x20variable\x20selected');}var _0x4779b9=this[_0x35ad('0xa0')][_0x35ad('0xa8')](this,_0x25efaa[_0x35ad('0xda')]);if(!_0x4779b9){return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x25efaa,_0x35ad('0x115'));}return this[_0x35ad('0x39')][_0x35ad('0xa5')](_0x4779b9,_0x25efaa[_0x35ad('0x1a2')]);};AGIVertices[_0x35ad('0x11')]['start']=function(_0x1a1bcf){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x1a3'),_0x1a1bcf[_0x35ad('0x3b')]));this[_0x35ad('0x39')][_0x35ad('0xaf')](_0x35ad('0x1a4'));var _0x25a40f=this[_0x35ad('0x39')][_0x35ad('0xa0')](_0x35ad('0x1a5'));if(!_[_0x35ad('0x47')](_0x25a40f['extra'])){this[_0x35ad('0x39')][_0x35ad('0x3a')]=_0x25a40f[_0x35ad('0xa1')];}if(_0x1a1bcf[_0x35ad('0xbb')]===_0x35ad('0x1a6')){this[_0x35ad('0x39')][_0x35ad('0xaf')](_0x35ad('0x1a7'));return this[_0x35ad('0x39')][_0x35ad('0xbb')]();}return this[_0x35ad('0x39')][_0x35ad('0xaf')]('Skipped\x20Answer');};AGIVertices[_0x35ad('0x11')]['subproject']=function(_0x255c1d){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x1a8'),_0x255c1d[_0x35ad('0x3b')]));if(!this[_0x35ad('0xa6')](_0x255c1d[_0x35ad('0x1a9')])){return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x255c1d,_0x35ad('0x1aa'));}var _0xb67172=this[_0x35ad('0x15')][_0x35ad('0xa8')](this,_0x255c1d[_0x35ad('0x1a9')]);if(!this['isConfigured'](_0xb67172)){return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x255c1d,util[_0x35ad('0x29')](_0x35ad('0x1ab'),_0x255c1d[_0x35ad('0x1a9')]));}if(_0xb67172===this[_0x35ad('0x39')][_0x35ad('0x3c')]){return this[_0x35ad('0x39')]['error'](_0x255c1d,_0x35ad('0x1ac'));}this['createSquareDetailsReport']['sync'](this,_0x255c1d,_0xb67172);var _0x13a7ce=this['channel']['exec'](_0x35ad('0x1ad'),util[_0x35ad('0x29')](_0x35ad('0x1ae'),config[_0x35ad('0x8')][_0x35ad('0x1af')]||_0x35ad('0x1b0'),_0xb67172,this[_0x35ad('0x39')][_0x35ad('0x3c')]));if(_0x13a7ce[_0x35ad('0xa3')]===-0x1){return _0x13a7ce;}return this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0x167'),_0x35ad('0x1ad'),_0xb67172));};AGIVertices['prototype'][_0x35ad('0x1b1')]=function(_0x4814e7){logger[_0x35ad('0x2e')](util['format'](_0x35ad('0x1b2'),_0x4814e7[_0x35ad('0x3b')]));var _0x4b42d7=this['shellCommand']['sync'](this,_0x4814e7[_0x35ad('0xb9')]);this[_0x35ad('0x38')]['sync'](this,_0x4814e7,_0x4814e7[_0x35ad('0xb9')]);if(this[_0x35ad('0xa6')](_0x4814e7[_0x35ad('0xda')])){var _0x262804=this['getVariable']['sync'](this,_0x4814e7['variable_id']);if(_0x262804){this[_0x35ad('0x39')][_0x35ad('0xa5')](_0x262804,_0x4b42d7);return this[_0x35ad('0x39')]['noop'](util['format'](_0x35ad('0x1b3'),_0x4814e7[_0x35ad('0xb9')],_0x262804));}}return this['channel'][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0x1b4'),_0x4814e7[_0x35ad('0xb9')]));};AGIVertices[_0x35ad('0x11')][_0x35ad('0x1b5')]=function(_0x2e884e){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x1b6'),_0x2e884e['label']));_0x2e884e['text']=_0x2e884e[_0x35ad('0x5e')][_0x35ad('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x35ad('0xa6')](_0x2e884e[_0x35ad('0x1b7')])){return this[_0x35ad('0x39')][_0x35ad('0xaf')]('no\x20apiKey\x20configured');}if(!this[_0x35ad('0xa6')](_0x2e884e[_0x35ad('0x5e')])){return this[_0x35ad('0x39')][_0x35ad('0xaf')](_0x35ad('0xab'));}this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x2e884e[_0x35ad('0x5e')]));var _0x126f4d=this[_0x35ad('0x5d')][_0x35ad('0xa8')](this,_0x2e884e);if(_0x126f4d){this['channel']['noop'](util[_0x35ad('0x29')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x126f4d));var _0x3fc6c8=this[_0x35ad('0x39')]['streamFile'](_0x126f4d);try{fs['unlink'](_0x126f4d+'.wav');}catch(_0x476ab9){logger['error'](_0x476ab9);}return _0x3fc6c8;}return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x2e884e,_0x35ad('0x1b8'));};AGIVertices[_0x35ad('0x11')][_0x35ad('0x1b9')]=function(_0x400ff0){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x1ba'),_0x400ff0[_0x35ad('0x3b')]));_0x400ff0[_0x35ad('0x5e')]=_0x400ff0[_0x35ad('0x5e')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x35ad('0xa6')](_0x400ff0[_0x35ad('0x5e')])){return this[_0x35ad('0x39')][_0x35ad('0xaf')](_0x35ad('0xab'));}this[_0x35ad('0x39')]['noop'](util[_0x35ad('0x29')](_0x35ad('0x1bb'),_0x400ff0[_0x35ad('0x5e')]));var _0x673251=this[_0x35ad('0x64')][_0x35ad('0xa8')](this,_0x400ff0);if(_0x673251){this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0x1bc'),_0x673251));var _0x2328b2=this[_0x35ad('0x39')]['streamFile'](_0x673251);try{fs['unlink'](_0x673251+_0x35ad('0x122'));}catch(_0x15ace1){logger['error'](_0x15ace1);}return _0x2328b2;}return this['channel'][_0x35ad('0x2c')](_0x400ff0,_0x35ad('0x1bd'));};AGIVertices[_0x35ad('0x11')][_0x35ad('0x1be')]=function(_0x52c9d1){logger['info'](util[_0x35ad('0x29')](_0x35ad('0x1bf'),_0x52c9d1[_0x35ad('0x3b')]));if(!this[_0x35ad('0xa6')](_0x52c9d1[_0x35ad('0x151')])){return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x52c9d1,_0x35ad('0x155'));}logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x161'),this[_0x35ad('0x39')][_0x35ad('0x3d')],_0x52c9d1[_0x35ad('0x151')]));var _0x58d920=this[_0x35ad('0x55')][_0x35ad('0xa8')](this,_0x52c9d1['findBy']);if(_0x58d920){logger[_0x35ad('0x2e')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x35ad('0x39')][_0x35ad('0x3d')],_0x52c9d1[_0x35ad('0x151')]));this['channel'][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0x152'),this[_0x35ad('0x39')][_0x35ad('0x3d')],_0x52c9d1['findBy']));return{'code':0xc8,'result':_0x35ad('0x163')};}else{logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x153'),this[_0x35ad('0x39')][_0x35ad('0x3d')],_0x52c9d1['findBy']));this[_0x35ad('0x39')][_0x35ad('0xaf')](util[_0x35ad('0x29')](_0x35ad('0x153'),this[_0x35ad('0x39')][_0x35ad('0x3d')],_0x52c9d1[_0x35ad('0x151')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x35ad('0x11')][_0x35ad('0x1c0')]=function(_0x53c7b8){logger[_0x35ad('0x2e')](util[_0x35ad('0x29')](_0x35ad('0x1c1'),_0x53c7b8[_0x35ad('0x3b')]));var _0x59969e=this['channel']['exec'](_0x35ad('0x1c2'),[_0x53c7b8[_0x35ad('0x1c3')],_0x53c7b8[_0x35ad('0xac')]]);if(_0x59969e['result']===-0x1){return _0x59969e;}return this['channel']['noop'](util[_0x35ad('0x29')](_0x35ad('0x167'),_0x35ad('0x1c2'),_0x53c7b8[_0x35ad('0x1c3')]));};AGIVertices['prototype']['vswitch']=function(_0x3a4cdf){logger['info'](util[_0x35ad('0x29')](_0x35ad('0x1c4'),_0x3a4cdf[_0x35ad('0x3b')]));if(!this[_0x35ad('0xa6')](_0x3a4cdf[_0x35ad('0xda')])){return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x3a4cdf,'no\x20variable\x20selected');}var _0x2b3759=this[_0x35ad('0xa0')]['sync'](this,_0x3a4cdf[_0x35ad('0xda')]);if(!_0x2b3759){return this[_0x35ad('0x39')][_0x35ad('0x2c')](_0x3a4cdf,_0x35ad('0x115'));}var _0x1d9e85=this[_0x35ad('0x39')][_0x35ad('0xa0')](_0x2b3759);return{'code':0xc8,'result':_0x1d9e85['extra']?_0x1d9e85[_0x35ad('0xa1')]:'-'};};String[_0x35ad('0x11')]['replaceAll']=function(_0x462680,_0x3fc13e){return this[_0x35ad('0x9e')](_0x462680)[_0x35ad('0x1c5')](_0x3fc13e);};module[_0x35ad('0x1c6')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 64fc1a5..ec7fc22 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 _0x224d=['../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','startAcw','interface','queue','ACW','mandatoryDispositionPause','name','Action','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','then','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','finally','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','acw','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','linkedid','isUndefined','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','deleteChannelAfterTimeout','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../../../config/logger','../rpc/user'];(function(_0x1cfdf4,_0x3e1beb){var _0x136f17=function(_0x39ab40){while(--_0x39ab40){_0x1cfdf4['push'](_0x1cfdf4['shift']());}};_0x136f17(++_0x3e1beb);}(_0x224d,0x158));var _0xd224=function(_0x374d90,_0x262da6){_0x374d90=_0x374d90-0x0;var _0x539cbb=_0x224d[_0x374d90];return _0x539cbb;};'use strict';var _=require(_0xd224('0x0'));var moment=require(_0xd224('0x1'));var ami=require('../ami');var logger=require(_0xd224('0x2'))('acw');var RpcUser=require(_0xd224('0x3'));var RpcVoiceAgentReport=require(_0xd224('0x4'));function Acw(_0x7267a6){this['voiceQueues']=_0x7267a6[_0xd224('0x5')];this[_0xd224('0x6')]=_0x7267a6[_0xd224('0x6')];this[_0xd224('0x7')]=_0x7267a6[_0xd224('0x7')];this[_0xd224('0x8')]={};ami['on']('agentconnect',this[_0xd224('0x9')]['bind'](this));ami['on']('hanguprequest',this[_0xd224('0xa')][_0xd224('0xb')](this));ami['on'](_0xd224('0xc'),this[_0xd224('0xd')]['bind'](this));ami['on'](_0xd224('0xe'),this[_0xd224('0xf')][_0xd224('0xb')](this));ami['on'](_0xd224('0x10'),this[_0xd224('0x11')][_0xd224('0xb')](this));ami['on'](_0xd224('0x12'),this[_0xd224('0x13')][_0xd224('0xb')](this));ami['on'](_0xd224('0x14'),this[_0xd224('0x15')][_0xd224('0xb')](this));}function getDiff(_0x58e9ee){var _0x395177=moment()[_0xd224('0x16')](0x0);var _0x46e8e7=moment(_0x58e9ee)[_0xd224('0x16')](0x0);return _0x395177[_0xd224('0x17')](_0x46e8e7,_0xd224('0x18'));}Acw[_0xd224('0x19')][_0xd224('0x1a')]=function(_0x20e45f,_0x1b8e70){var _0x4077e5=this;var _0x2c8b4d=getDiff(_0x4077e5[_0xd224('0x7')][_0x20e45f]['lastPauseAt']);clearTimeout(_0x4077e5['timers'][_0x20e45f][_0xd224('0x1b')]);_0x4077e5[_0xd224('0x7')][_0x20e45f][_0xd224('0x1b')]=![];return RpcVoiceAgentReport[_0xd224('0x1c')]({'acwtime':_0x2c8b4d},_0x4077e5[_0xd224('0x7')][_0x20e45f][_0xd224('0x1d')],_0x20e45f)['then'](function(_0x19e2db){logger['info'](_0xd224('0x1e'),_0x1b8e70,_0x2c8b4d,_0x19e2db);})[_0xd224('0x1f')](function(_0x98e717){logger[_0xd224('0x20')](_0xd224('0x21'),_0x1b8e70,_0x98e717);})['finally'](function(){delete _0x4077e5[_0xd224('0x7')][_0x20e45f];});};Acw[_0xd224('0x19')][_0xd224('0x22')]=function(_0x52613b){try{var _0x345a17=this;var _0x595d9c=this[_0xd224('0x8')][_0x52613b][_0xd224('0x23')];var _0xb3ac2f=this[_0xd224('0x8')][_0x52613b][_0xd224('0x24')];var _0x56cde7=this[_0xd224('0x5')][_0xb3ac2f];var _0x2cd660=![];var _0x4f1150=_0xd224('0x25');if(_0x56cde7['mandatoryDisposition']&&_0x56cde7[_0xd224('0x26')][_0xd224('0x27')]){_0x2cd660=!![];_0x4f1150=_0x56cde7[_0xd224('0x26')][_0xd224('0x27')];}return ami[_0xd224('0x28')]({'action':'QueuePause','interface':_0x595d9c,'paused':!![],'reason':_0x4f1150})['then'](function(){if(_0x345a17[_0xd224('0x6')][_0x595d9c]){return RpcUser[_0xd224('0x29')](_0x345a17[_0xd224('0x6')][_0x595d9c]['id'])['then'](function(_0x317ac9){if(!_0x317ac9||_0x317ac9[_0xd224('0x2a')]){logger['info'](_0xd224('0x2b'),_0x52613b,_0x595d9c,_0xb3ac2f);return;}logger[_0xd224('0x2c')](_0xd224('0x2d'),_0x52613b,_0x595d9c,_0xb3ac2f);var _0x290764=_0x345a17[_0xd224('0x8')][_0x52613b][_0xd224('0x2e')]&&_0x345a17[_0xd224('0x8')][_0x52613b][_0xd224('0x2f')]?_0x345a17[_0xd224('0x8')][_0x52613b]['destlinkedid']:_0x52613b;return RpcUser['savePause'](_0x345a17[_0xd224('0x6')][_0x595d9c],_0x4f1150,_0x290764)[_0xd224('0x30')](function(_0x149105){_0x345a17[_0xd224('0x5')][_0xb3ac2f]['available']-=0x1;_0x345a17['voiceQueues'][_0xb3ac2f]['paused']+=0x1;return _0x149105;});})[_0xd224('0x30')](function(_0x5c9d97){if(_0x2cd660||!_0x5c9d97){return;}_0x345a17[_0xd224('0x7')][_0x595d9c]={};logger[_0xd224('0x2c')](_0xd224('0x31'),_0x52613b,_0x345a17[_0xd224('0x5')][_0xb3ac2f][_0xd224('0x32')],_0x595d9c,_0xb3ac2f);_0x345a17[_0xd224('0x7')][_0x595d9c][_0xd224('0x1b')]=setTimeout(_0x345a17[_0xd224('0x33')][_0xd224('0xb')](_0x345a17,_0x595d9c),_0x345a17[_0xd224('0x5')][_0xb3ac2f]['acwTimeout']*0x3e8);_0x345a17[_0xd224('0x7')][_0x595d9c][_0xd224('0x34')]=moment()[_0xd224('0x35')](_0xd224('0x36'));_0x345a17[_0xd224('0x7')][_0x595d9c][_0xd224('0x1d')]=_0x52613b;_0x345a17[_0xd224('0x7')][_0x595d9c]['queue']=_0xb3ac2f;_0x345a17[_0xd224('0x7')][_0x595d9c][_0xd224('0x1a')]=_0x345a17[_0xd224('0x1a')][_0xd224('0xb')](_0x345a17,_0x595d9c,_0x52613b);});}})[_0xd224('0x1f')](function(){logger[_0xd224('0x20')](_0xd224('0x31'),_0x52613b,_0x345a17[_0xd224('0x5')][_0xb3ac2f]['acwTimeout'],_0x595d9c,_0xb3ac2f);})[_0xd224('0x37')](function(){delete _0x345a17[_0xd224('0x8')][_0x52613b];});}catch(_0x260e6f){logger[_0xd224('0x20')]('[ACW][START]\x20%s',_0x260e6f['message']);}};Acw[_0xd224('0x19')][_0xd224('0x33')]=function(_0xc8179a){try{var _0x309f6b=this;if(_0x309f6b['timers'][_0xc8179a]){_0x309f6b[_0xd224('0x7')][_0xc8179a][_0xd224('0x1b')]=![];var _0x368fe4=_0x309f6b[_0xd224('0x7')][_0xc8179a][_0xd224('0x1d')];var _0x2ad5d7=_0x309f6b[_0xd224('0x7')][_0xc8179a][_0xd224('0x24')];var _0x138e29=_0x309f6b['voiceQueues'][_0x2ad5d7][_0xd224('0x32')];logger[_0xd224('0x2c')]('[%s][TIMER][STOP][AGENT:%s]',_0x368fe4,_0xc8179a);RpcUser[_0xd224('0x29')](this[_0xd224('0x6')][_0xc8179a]['id'])[_0xd224('0x30')](function(_0x1f578f){if(_0x1f578f['pauseType']==='ACW'){return RpcUser[_0xd224('0x38')](_0x309f6b['agents'][_0xc8179a]);}});RpcVoiceAgentReport[_0xd224('0x1c')]({'acwtime':_0x138e29,'agentacw':!![]},_0x368fe4,_0xc8179a)[_0xd224('0x30')](function(_0x4feba3){logger[_0xd224('0x2c')](_0xd224('0x1e'),_0x368fe4,_0x138e29,_0x4feba3);})['catch'](function(_0x35cc41){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x368fe4,_0x35cc41);});}else{logger[_0xd224('0x20')](_0xd224('0x39'),_0xc8179a);if(_0x309f6b['timers']){logger['info'](_0xd224('0x3a'),JSON[_0xd224('0x3b')](_0x309f6b[_0xd224('0x7')]));}}}catch(_0x1528ce){logger['error'](_0xd224('0x3c'),_0x1528ce[_0xd224('0x3d')]);}};Acw[_0xd224('0x19')]['syncAgentConnect']=function(_0x48e3cd){try{if(this['voiceQueues'][_0x48e3cd['queue']]&&(this[_0xd224('0x5')][_0x48e3cd[_0xd224('0x24')]][_0xd224('0x3e')]||this[_0xd224('0x5')][_0x48e3cd[_0xd224('0x24')]][_0xd224('0x3f')])){if(this[_0xd224('0x6')][_0x48e3cd[_0xd224('0x23')]]){this[_0xd224('0x8')][_0x48e3cd[_0xd224('0x1d')]]={'queue':_0x48e3cd[_0xd224('0x24')],'interface':_0x48e3cd[_0xd224('0x23')],'destlinkedid':_0x48e3cd[_0xd224('0x2f')]};}}}catch(_0x593c69){logger[_0xd224('0x20')](_0xd224('0x40'),_0x593c69[_0xd224('0x3d')]);}};Acw[_0xd224('0x19')][_0xd224('0x15')]=function(_0x91dfac){try{if(this['voiceQueues'][_0x91dfac[_0xd224('0x24')]]&&(this[_0xd224('0x5')][_0x91dfac['queue']][_0xd224('0x3e')]||this['voiceQueues'][_0x91dfac[_0xd224('0x24')]][_0xd224('0x3f')])){if(this['agents'][_0x91dfac[_0xd224('0x23')]]){this[_0xd224('0x8')][_0x91dfac[_0xd224('0x1d')]]={'queue':_0x91dfac[_0xd224('0x24')],'interface':_0x91dfac[_0xd224('0x23')]};}}}catch(_0x57d0b7){logger[_0xd224('0x20')]('[ACW][syncAgentConnectPreview]\x20%s',_0x57d0b7[_0xd224('0x3d')]);}};Acw[_0xd224('0x19')][_0xd224('0xa')]=function(_0x2e4c18){try{if(this['channels'][_0x2e4c18[_0xd224('0x1d')]]&&_['isUndefined'](this[_0xd224('0x8')][_0x2e4c18[_0xd224('0x1d')]][_0xd224('0x2e')])){logger[_0xd224('0x2c')]('[%s][HANGUP:UNIQUEID]',_0x2e4c18[_0xd224('0x1d')]);this[_0xd224('0x22')](_0x2e4c18[_0xd224('0x1d')]);}else if(this[_0xd224('0x8')][_0x2e4c18[_0xd224('0x41')]]&&_[_0xd224('0x42')](this['channels'][_0x2e4c18[_0xd224('0x41')]]['attended'])){logger[_0xd224('0x2c')]('[%s][HANGUP:LINKEDID]',_0x2e4c18[_0xd224('0x41')]);this[_0xd224('0x22')](_0x2e4c18[_0xd224('0x41')]);}}catch(_0xbd1d02){logger[_0xd224('0x20')](_0xd224('0x43'),_0xbd1d02[_0xd224('0x3d')]);}};Acw['prototype']['syncHangup']=function(_0x1f00ab){try{if(this['channels'][_0x1f00ab['uniqueid']]&&this[_0xd224('0x8')][_0x1f00ab['uniqueid']][_0xd224('0x2e')]){logger[_0xd224('0x2c')](_0xd224('0x44'),_0x1f00ab[_0xd224('0x1d')]);this[_0xd224('0x22')](_0x1f00ab['uniqueid']);}else if(this[_0xd224('0x8')][_0x1f00ab[_0xd224('0x41')]]&&this[_0xd224('0x8')][_0x1f00ab[_0xd224('0x41')]]['attended']){logger[_0xd224('0x2c')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x1f00ab['linkedid']);this[_0xd224('0x22')](_0x1f00ab[_0xd224('0x41')]);}}catch(_0x198692){logger[_0xd224('0x20')]('[ACW][syncHangup]\x20%s',_0x198692[_0xd224('0x3d')]);}};Acw[_0xd224('0x19')][_0xd224('0x11')]=function(_0x18200f){try{if(!_[_0xd224('0x45')](this[_0xd224('0x8')][_0x18200f[_0xd224('0x46')]])){this[_0xd224('0x22')](_0x18200f[_0xd224('0x46')]);if(this[_0xd224('0x8')][_0x18200f[_0xd224('0x47')]]){this[_0xd224('0x8')][_0x18200f[_0xd224('0x47')]]['attended']=!![];this[_0xd224('0x8')][_0x18200f[_0xd224('0x48')]]=this[_0xd224('0x8')][_0x18200f['secondtransfereruniqueid']];this['deleteChannelAfterTimeout'](_0x18200f['secondtransfereruniqueid']);}}else if(!_[_0xd224('0x45')](this[_0xd224('0x8')][_0x18200f[_0xd224('0x48')]])){this[_0xd224('0x22')](_0x18200f['transfertargetuniqueid']);if(this[_0xd224('0x8')][_0x18200f[_0xd224('0x49')]]){this[_0xd224('0x8')][_0x18200f[_0xd224('0x49')]][_0xd224('0x2e')]=!![];this[_0xd224('0x8')][_0x18200f[_0xd224('0x46')]]=this[_0xd224('0x8')][_0x18200f[_0xd224('0x49')]];this[_0xd224('0x4a')](_0x18200f[_0xd224('0x49')]);}}}catch(_0x517e01){logger[_0xd224('0x20')](_0xd224('0x4b'),_0x517e01['message']);}};Acw[_0xd224('0x19')][_0xd224('0x13')]=function(_0x52e17d){try{if(this[_0xd224('0x8')][_0x52e17d[_0xd224('0x4c')]]){logger[_0xd224('0x2c')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xd224('0x3b')](_0x52e17d[_0xd224('0x4c')]));this['startAcw'](_0x52e17d[_0xd224('0x4c')]);}else if(this['channels'][_0x52e17d[_0xd224('0x4d')]]){logger[_0xd224('0x2c')](_0xd224('0x4e'),JSON[_0xd224('0x3b')](_0x52e17d[_0xd224('0x4d')]));this[_0xd224('0x22')](_0x52e17d[_0xd224('0x4d')]);}}catch(_0x3cec0a){logger['error'](_0xd224('0x4f'),_0x3cec0a['message']);}};Acw[_0xd224('0x19')][_0xd224('0xf')]=function(_0x1d7a59){try{if(this[_0xd224('0x5')][_0x1d7a59[_0xd224('0x24')]]&&this['voiceQueues'][_0x1d7a59[_0xd224('0x24')]][_0xd224('0x50')]===_0xd224('0x51')){if(this[_0xd224('0x6')][_0x1d7a59[_0xd224('0x23')]]){logger[_0xd224('0x2c')](_0xd224('0x52'),_0x1d7a59[_0xd224('0x1d')],_0x1d7a59[_0xd224('0x23')],_0x1d7a59[_0xd224('0x24')]);return RpcUser[_0xd224('0x53')](this[_0xd224('0x6')][_0x1d7a59[_0xd224('0x23')]],_0xd224('0x54'),_0x1d7a59['uniqueid']);}}}catch(_0x424bb6){logger[_0xd224('0x20')](_0xd224('0x55'),_0x424bb6[_0xd224('0x3d')]);}};Acw[_0xd224('0x19')]['deleteChannelAfterTimeout']=function(_0x3bb83a,_0x56bc78=0x2710){if(this[_0xd224('0x8')][_0x3bb83a]){setTimeout(()=>{delete this[_0xd224('0x8')][_0x3bb83a];},_0x56bc78);}};module[_0xd224('0x56')]=Acw; \ No newline at end of file +var _0x2b59=['../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncAgentConnectPreview','milliseconds','updateAcw','lastPauseAt','timer','update','uniqueid','info','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','finally','prototype','startAcw','channels','interface','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','then','getAgent','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','catch','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','lodash','moment','../ami'];(function(_0xd90a,_0x5197f8){var _0x2300b8=function(_0x23ab62){while(--_0x23ab62){_0xd90a['push'](_0xd90a['shift']());}};_0x2300b8(++_0x5197f8);}(_0x2b59,0xa5));var _0x92b5=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x2b59[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x92b5('0x0'));var moment=require(_0x92b5('0x1'));var ami=require(_0x92b5('0x2'));var logger=require(_0x92b5('0x3'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x92b5('0x4'));function Acw(_0x357663){this[_0x92b5('0x5')]=_0x357663[_0x92b5('0x5')];this[_0x92b5('0x6')]=_0x357663['agents'];this[_0x92b5('0x7')]=_0x357663[_0x92b5('0x7')];this['channels']={};ami['on'](_0x92b5('0x8'),this['syncAgentConnect']['bind'](this));ami['on'](_0x92b5('0x9'),this[_0x92b5('0xa')][_0x92b5('0xb')](this));ami['on'](_0x92b5('0xc'),this[_0x92b5('0xd')]['bind'](this));ami['on']('agentringnoanswer',this[_0x92b5('0xe')]['bind'](this));ami['on'](_0x92b5('0xf'),this[_0x92b5('0x10')][_0x92b5('0xb')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x92b5('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0x92b5('0x11')]['bind'](this));}function getDiff(_0x25fd27){var _0x540fe6=moment()[_0x92b5('0x12')](0x0);var _0x1537e0=moment(_0x25fd27)[_0x92b5('0x12')](0x0);return _0x540fe6['diff'](_0x1537e0,'seconds');}Acw['prototype'][_0x92b5('0x13')]=function(_0xfd652c,_0xf2b788){var _0x4140fa=this;var _0x1fd60c=getDiff(_0x4140fa[_0x92b5('0x7')][_0xfd652c][_0x92b5('0x14')]);clearTimeout(_0x4140fa['timers'][_0xfd652c][_0x92b5('0x15')]);_0x4140fa['timers'][_0xfd652c][_0x92b5('0x15')]=![];return RpcVoiceAgentReport[_0x92b5('0x16')]({'acwtime':_0x1fd60c},_0x4140fa[_0x92b5('0x7')][_0xfd652c][_0x92b5('0x17')],_0xfd652c)['then'](function(_0x3a96f8){logger[_0x92b5('0x18')](_0x92b5('0x19'),_0xf2b788,_0x1fd60c,_0x3a96f8);})['catch'](function(_0x13c572){logger[_0x92b5('0x1a')](_0x92b5('0x1b'),_0xf2b788,_0x13c572);})[_0x92b5('0x1c')](function(){delete _0x4140fa['timers'][_0xfd652c];});};Acw[_0x92b5('0x1d')][_0x92b5('0x1e')]=function(_0x318128){try{var _0x57422f=this;var _0x5d8623=this[_0x92b5('0x1f')][_0x318128][_0x92b5('0x20')];var _0x55d288=this[_0x92b5('0x1f')][_0x318128][_0x92b5('0x21')];var _0x23d141=this[_0x92b5('0x5')][_0x55d288];var _0x305d90=![];var _0x4c6439=_0x92b5('0x22');if(_0x23d141[_0x92b5('0x23')]&&_0x23d141['mandatoryDispositionPause'][_0x92b5('0x24')]){_0x305d90=!![];_0x4c6439=_0x23d141[_0x92b5('0x25')]['name'];}return ami[_0x92b5('0x26')]({'action':_0x92b5('0x27'),'interface':_0x5d8623,'paused':!![],'reason':_0x4c6439})[_0x92b5('0x28')](function(){if(_0x57422f[_0x92b5('0x6')][_0x5d8623]){return RpcUser[_0x92b5('0x29')](_0x57422f[_0x92b5('0x6')][_0x5d8623]['id'])[_0x92b5('0x28')](function(_0x2b0821){if(!_0x2b0821||_0x2b0821['voicePause']){logger[_0x92b5('0x18')](_0x92b5('0x2a'),_0x318128,_0x5d8623,_0x55d288);return;}logger[_0x92b5('0x18')](_0x92b5('0x2b'),_0x318128,_0x5d8623,_0x55d288);var _0x26cdc5=_0x57422f[_0x92b5('0x1f')][_0x318128][_0x92b5('0x2c')]&&_0x57422f[_0x92b5('0x1f')][_0x318128][_0x92b5('0x2d')]?_0x57422f[_0x92b5('0x1f')][_0x318128]['destlinkedid']:_0x318128;return RpcUser[_0x92b5('0x2e')](_0x57422f[_0x92b5('0x6')][_0x5d8623],_0x4c6439,_0x26cdc5)[_0x92b5('0x28')](function(_0x37ce53){_0x57422f['voiceQueues'][_0x55d288][_0x92b5('0x2f')]-=0x1;_0x57422f[_0x92b5('0x5')][_0x55d288]['paused']+=0x1;return _0x37ce53;});})[_0x92b5('0x28')](function(_0x25fa29){if(_0x305d90||!_0x25fa29){return;}_0x57422f[_0x92b5('0x7')][_0x5d8623]={};logger[_0x92b5('0x18')](_0x92b5('0x30'),_0x318128,_0x57422f[_0x92b5('0x5')][_0x55d288][_0x92b5('0x31')],_0x5d8623,_0x55d288);_0x57422f[_0x92b5('0x7')][_0x5d8623]['timer']=setTimeout(_0x57422f['stopAcw']['bind'](_0x57422f,_0x5d8623),_0x57422f['voiceQueues'][_0x55d288]['acwTimeout']*0x3e8);_0x57422f[_0x92b5('0x7')][_0x5d8623][_0x92b5('0x14')]=moment()[_0x92b5('0x32')](_0x92b5('0x33'));_0x57422f[_0x92b5('0x7')][_0x5d8623][_0x92b5('0x17')]=_0x318128;_0x57422f[_0x92b5('0x7')][_0x5d8623][_0x92b5('0x21')]=_0x55d288;_0x57422f[_0x92b5('0x7')][_0x5d8623][_0x92b5('0x13')]=_0x57422f['updateAcw'][_0x92b5('0xb')](_0x57422f,_0x5d8623,_0x318128);});}})[_0x92b5('0x34')](function(){logger[_0x92b5('0x1a')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x318128,_0x57422f[_0x92b5('0x5')][_0x55d288][_0x92b5('0x31')],_0x5d8623,_0x55d288);})[_0x92b5('0x1c')](function(){delete _0x57422f[_0x92b5('0x1f')][_0x318128];});}catch(_0x573d28){logger['error'](_0x92b5('0x35'),_0x573d28[_0x92b5('0x36')]);}};Acw['prototype']['stopAcw']=function(_0x244e71){try{var _0x19a482=this;if(_0x19a482[_0x92b5('0x7')][_0x244e71]){_0x19a482[_0x92b5('0x7')][_0x244e71]['timer']=![];var _0x4037f4=_0x19a482[_0x92b5('0x7')][_0x244e71][_0x92b5('0x17')];var _0x161a6c=_0x19a482[_0x92b5('0x7')][_0x244e71][_0x92b5('0x21')];var _0x199847=_0x19a482['voiceQueues'][_0x161a6c][_0x92b5('0x31')];logger[_0x92b5('0x18')](_0x92b5('0x37'),_0x4037f4,_0x244e71);RpcUser['getAgent'](this['agents'][_0x244e71]['id'])[_0x92b5('0x28')](function(_0x40cd54){if(_0x40cd54[_0x92b5('0x38')]===_0x92b5('0x22')){return RpcUser[_0x92b5('0x39')](_0x19a482['agents'][_0x244e71]);}});RpcVoiceAgentReport['update']({'acwtime':_0x199847,'agentacw':!![]},_0x4037f4,_0x244e71)['then'](function(_0x31cf91){logger[_0x92b5('0x18')](_0x92b5('0x19'),_0x4037f4,_0x199847,_0x31cf91);})[_0x92b5('0x34')](function(_0x522103){logger['error'](_0x92b5('0x1b'),_0x4037f4,_0x522103);});}else{logger[_0x92b5('0x1a')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x244e71);if(_0x19a482[_0x92b5('0x7')]){logger['info'](_0x92b5('0x3a'),JSON[_0x92b5('0x3b')](_0x19a482['timers']));}}}catch(_0x27cd9e){logger[_0x92b5('0x1a')](_0x92b5('0x3c'),_0x27cd9e[_0x92b5('0x36')]);}};Acw[_0x92b5('0x1d')]['syncAgentConnect']=function(_0x50b4c5){try{if(this['voiceQueues'][_0x50b4c5[_0x92b5('0x21')]]&&(this[_0x92b5('0x5')][_0x50b4c5['queue']][_0x92b5('0x3d')]||this[_0x92b5('0x5')][_0x50b4c5[_0x92b5('0x21')]][_0x92b5('0x23')])){if(this[_0x92b5('0x6')][_0x50b4c5[_0x92b5('0x20')]]){this['channels'][_0x50b4c5[_0x92b5('0x17')]]={'queue':_0x50b4c5[_0x92b5('0x21')],'interface':_0x50b4c5['interface'],'destlinkedid':_0x50b4c5[_0x92b5('0x2d')]};}}}catch(_0x2766a6){logger[_0x92b5('0x1a')](_0x92b5('0x3e'),_0x2766a6[_0x92b5('0x36')]);}};Acw[_0x92b5('0x1d')][_0x92b5('0x11')]=function(_0x5a85f6){try{if(this[_0x92b5('0x5')][_0x5a85f6[_0x92b5('0x21')]]&&(this[_0x92b5('0x5')][_0x5a85f6['queue']]['acw']||this[_0x92b5('0x5')][_0x5a85f6[_0x92b5('0x21')]][_0x92b5('0x23')])){if(this[_0x92b5('0x6')][_0x5a85f6[_0x92b5('0x20')]]){this['channels'][_0x5a85f6[_0x92b5('0x17')]]={'queue':_0x5a85f6['queue'],'interface':_0x5a85f6[_0x92b5('0x20')]};}}}catch(_0x3d33b0){logger[_0x92b5('0x1a')]('[ACW][syncAgentConnectPreview]\x20%s',_0x3d33b0[_0x92b5('0x36')]);}};Acw['prototype'][_0x92b5('0xa')]=function(_0x49907d){try{if(this['channels'][_0x49907d[_0x92b5('0x17')]]&&_[_0x92b5('0x3f')](this[_0x92b5('0x1f')][_0x49907d['uniqueid']][_0x92b5('0x2c')])){logger[_0x92b5('0x18')](_0x92b5('0x40'),_0x49907d[_0x92b5('0x17')]);this[_0x92b5('0x1e')](_0x49907d[_0x92b5('0x17')]);}else if(this[_0x92b5('0x1f')][_0x49907d[_0x92b5('0x41')]]&&_[_0x92b5('0x3f')](this[_0x92b5('0x1f')][_0x49907d[_0x92b5('0x41')]]['attended'])){logger[_0x92b5('0x18')]('[%s][HANGUP:LINKEDID]',_0x49907d['linkedid']);this['startAcw'](_0x49907d[_0x92b5('0x41')]);}}catch(_0x39871b){logger[_0x92b5('0x1a')](_0x92b5('0x42'),_0x39871b[_0x92b5('0x36')]);}};Acw[_0x92b5('0x1d')][_0x92b5('0xd')]=function(_0x5b9ed8){try{if(this['channels'][_0x5b9ed8[_0x92b5('0x17')]]&&this[_0x92b5('0x1f')][_0x5b9ed8[_0x92b5('0x17')]][_0x92b5('0x2c')]){logger[_0x92b5('0x18')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5b9ed8[_0x92b5('0x17')]);this[_0x92b5('0x1e')](_0x5b9ed8[_0x92b5('0x17')]);}else if(this['channels'][_0x5b9ed8[_0x92b5('0x41')]]&&this[_0x92b5('0x1f')][_0x5b9ed8[_0x92b5('0x41')]][_0x92b5('0x2c')]){logger[_0x92b5('0x18')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x5b9ed8[_0x92b5('0x41')]);this[_0x92b5('0x1e')](_0x5b9ed8[_0x92b5('0x41')]);}}catch(_0x28a90c){logger[_0x92b5('0x1a')](_0x92b5('0x43'),_0x28a90c[_0x92b5('0x36')]);}};Acw[_0x92b5('0x1d')][_0x92b5('0x10')]=function(_0xead849){try{if(!_['isNil'](this[_0x92b5('0x1f')][_0xead849[_0x92b5('0x44')]])){this[_0x92b5('0x1e')](_0xead849[_0x92b5('0x44')]);if(this[_0x92b5('0x1f')][_0xead849['secondtransfereruniqueid']]){this[_0x92b5('0x1f')][_0xead849[_0x92b5('0x45')]][_0x92b5('0x2c')]=!![];this[_0x92b5('0x1f')][_0xead849[_0x92b5('0x46')]]=this['channels'][_0xead849[_0x92b5('0x45')]];this[_0x92b5('0x47')](_0xead849['secondtransfereruniqueid']);}}else if(!_[_0x92b5('0x48')](this['channels'][_0xead849[_0x92b5('0x46')]])){this[_0x92b5('0x1e')](_0xead849[_0x92b5('0x46')]);if(this['channels'][_0xead849[_0x92b5('0x49')]]){this[_0x92b5('0x1f')][_0xead849[_0x92b5('0x49')]][_0x92b5('0x2c')]=!![];this[_0x92b5('0x1f')][_0xead849[_0x92b5('0x44')]]=this[_0x92b5('0x1f')][_0xead849[_0x92b5('0x49')]];this['deleteChannelAfterTimeout'](_0xead849[_0x92b5('0x49')]);}}}catch(_0x17d998){logger[_0x92b5('0x1a')](_0x92b5('0x4a'),_0x17d998[_0x92b5('0x36')]);}};Acw[_0x92b5('0x1d')][_0x92b5('0x4b')]=function(_0x305c57){try{if(this[_0x92b5('0x1f')][_0x305c57[_0x92b5('0x4c')]]){logger[_0x92b5('0x18')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x305c57[_0x92b5('0x4c')]));this[_0x92b5('0x1e')](_0x305c57[_0x92b5('0x4c')]);}else if(this['channels'][_0x305c57[_0x92b5('0x4d')]]){logger[_0x92b5('0x18')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x305c57['transfererlinkedid']));this[_0x92b5('0x1e')](_0x305c57[_0x92b5('0x4d')]);}}catch(_0x2a91d0){logger[_0x92b5('0x1a')](_0x92b5('0x4e'),_0x2a91d0[_0x92b5('0x36')]);}};Acw[_0x92b5('0x1d')][_0x92b5('0xe')]=function(_0x3c5431){try{if(this[_0x92b5('0x5')][_0x3c5431[_0x92b5('0x21')]]&&this[_0x92b5('0x5')][_0x3c5431[_0x92b5('0x21')]][_0x92b5('0x4f')]===_0x92b5('0x50')){if(this[_0x92b5('0x6')][_0x3c5431[_0x92b5('0x20')]]){logger['info'](_0x92b5('0x51'),_0x3c5431[_0x92b5('0x17')],_0x3c5431[_0x92b5('0x20')],_0x3c5431[_0x92b5('0x21')]);return RpcUser[_0x92b5('0x2e')](this[_0x92b5('0x6')][_0x3c5431[_0x92b5('0x20')]],_0x92b5('0x52'),_0x3c5431[_0x92b5('0x17')]);}}}catch(_0x45371e){logger[_0x92b5('0x1a')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x45371e[_0x92b5('0x36')]);}};Acw[_0x92b5('0x1d')][_0x92b5('0x47')]=function(_0x1c4ab3,_0x20a3d5=0x2710){if(this[_0x92b5('0x1f')][_0x1c4ab3]){setTimeout(()=>{delete this[_0x92b5('0x1f')][_0x1c4ab3];},_0x20a3d5);}};module[_0x92b5('0x53')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 0ba6fef..498f247 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 _0xec43=['error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','[ami.js][fullybooted]','exports','util','../../config/logger','ami','asterisk','username','password','keepConnected','Action','action'];(function(_0x4a2403,_0x5c36ee){var _0x5de6bf=function(_0x5165fa){while(--_0x5165fa){_0x4a2403['push'](_0x4a2403['shift']());}};_0x5de6bf(++_0x5c36ee);}(_0xec43,0xc3));var _0x3ec4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xec43[_0x20a584];return _0x4b41a8;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var util=require(_0x3ec4('0x0'));var logger=require(_0x3ec4('0x1'))(_0x3ec4('0x2'));var config=require('../../config/environment');var ami=new Manager(config[_0x3ec4('0x3')]['port'],config['asterisk']['ip'],config[_0x3ec4('0x3')][_0x3ec4('0x4')],config['asterisk'][_0x3ec4('0x5')],!![]);ami[_0x3ec4('0x6')]();ami[_0x3ec4('0x7')]=BPromise['promisify'](ami[_0x3ec4('0x8')]);function error(_0xfc034e){logger[_0x3ec4('0x9')](util[_0x3ec4('0xa')](_0x3ec4('0xb'),config[_0x3ec4('0x3')]['username'],config[_0x3ec4('0x3')]['ip'],config[_0x3ec4('0x3')][_0x3ec4('0xc')],util[_0x3ec4('0xd')](_0xfc034e,![],null)));}function close(){logger[_0x3ec4('0x9')](util[_0x3ec4('0xa')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x3ec4('0x3')][_0x3ec4('0x4')],config[_0x3ec4('0x3')]['ip'],config['asterisk'][_0x3ec4('0xc')]));}ami[_0x3ec4('0xe')]=function(){return function(){return ami['Action']({'action':_0x3ec4('0xf')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0x3ec4('0x10')});};};ami[_0x3ec4('0x11')]=function(){return function(){return ami[_0x3ec4('0x7')]({'action':_0x3ec4('0x12')});};};ami[_0x3ec4('0x13')]=function(){return function(){return ami[_0x3ec4('0x7')]({'action':'queuesummary'});};};ami[_0x3ec4('0x14')]=function(){return function(){return ami['Action']({'action':_0x3ec4('0x15')});};};function connect(){logger[_0x3ec4('0x16')](util[_0x3ec4('0xa')](_0x3ec4('0x17'),config[_0x3ec4('0x3')][_0x3ec4('0x4')],config['asterisk']['ip'],config['asterisk'][_0x3ec4('0xc')]));ami[_0x3ec4('0x18')](_0x3ec4('0x9'),error);ami[_0x3ec4('0x18')](_0x3ec4('0x19'),close);}ami['on'](_0x3ec4('0x1a'),connect);ami['on'](_0x3ec4('0x1b'),function(_0x5bd4d7){logger[_0x3ec4('0x16')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x3ec4('0x4')],config[_0x3ec4('0x3')]['ip'],config[_0x3ec4('0x3')]['port'],util[_0x3ec4('0xd')](_0x5bd4d7,![],null)));});ami['on']('fullybooted',function(){logger[_0x3ec4('0x16')](util[_0x3ec4('0xa')](_0x3ec4('0x1c'),config['asterisk'][_0x3ec4('0x4')],config['asterisk']['ip'],config[_0x3ec4('0x3')][_0x3ec4('0xc')]));return Promise[_0x3ec4('0x1d')]()['then'](ami[_0x3ec4('0xe')]())[_0x3ec4('0x1e')](ami['actionDeviceStateList']())[_0x3ec4('0x1e')](ami[_0x3ec4('0x11')]())[_0x3ec4('0x1e')](ami[_0x3ec4('0x13')]())['then'](ami['actionCoreShowChannels']())[_0x3ec4('0x1f')](function(_0x1d06e8){logger[_0x3ec4('0x9')](_0x3ec4('0x20'),util[_0x3ec4('0xd')](_0x1d06e8,{'showHidden':![],'depth':null}));});});ami[_0x3ec4('0x18')]('error',error);ami[_0x3ec4('0x18')](_0x3ec4('0x19'),close);module[_0x3ec4('0x21')]=ami; \ No newline at end of file +var _0x7bcc=['inspect','error','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','catch','[ami.js][fullybooted]','close','asterisk-manager','util','../../config/environment','port','asterisk','password','promisify','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username'];(function(_0x227d74,_0x4948e3){var _0x5540c0=function(_0x3541be){while(--_0x3541be){_0x227d74['push'](_0x227d74['shift']());}};_0x5540c0(++_0x4948e3);}(_0x7bcc,0x9b));var _0xc7bc=function(_0x58770d,_0x16248d){_0x58770d=_0x58770d-0x0;var _0x26859a=_0x7bcc[_0x58770d];return _0x26859a;};'use strict';var Manager=require(_0xc7bc('0x0'));var BPromise=require('bluebird');var util=require(_0xc7bc('0x1'));var logger=require('../../config/logger')('ami');var config=require(_0xc7bc('0x2'));var ami=new Manager(config['asterisk'][_0xc7bc('0x3')],config[_0xc7bc('0x4')]['ip'],config[_0xc7bc('0x4')]['username'],config[_0xc7bc('0x4')][_0xc7bc('0x5')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xc7bc('0x6')](ami['action']);function error(_0x59fa3c){logger['error'](util[_0xc7bc('0x7')](_0xc7bc('0x8'),config[_0xc7bc('0x4')][_0xc7bc('0x9')],config[_0xc7bc('0x4')]['ip'],config[_0xc7bc('0x4')][_0xc7bc('0x3')],util[_0xc7bc('0xa')](_0x59fa3c,![],null)));}function close(){logger[_0xc7bc('0xb')](util[_0xc7bc('0x7')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0xc7bc('0x9')],config['asterisk']['ip'],config[_0xc7bc('0x4')][_0xc7bc('0x3')]));}ami[_0xc7bc('0xc')]=function(){return function(){return ami[_0xc7bc('0xd')]({'action':_0xc7bc('0xe')});};};ami[_0xc7bc('0xf')]=function(){return function(){return ami[_0xc7bc('0xd')]({'action':_0xc7bc('0x10')});};};ami[_0xc7bc('0x11')]=function(){return function(){return ami[_0xc7bc('0xd')]({'action':_0xc7bc('0x12')});};};ami[_0xc7bc('0x13')]=function(){return function(){return ami[_0xc7bc('0xd')]({'action':_0xc7bc('0x14')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xc7bc('0xd')]({'action':_0xc7bc('0x15')});};};function connect(){logger[_0xc7bc('0x16')](util[_0xc7bc('0x7')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0xc7bc('0x9')],config['asterisk']['ip'],config[_0xc7bc('0x4')][_0xc7bc('0x3')]));ami['once'](_0xc7bc('0xb'),error);ami[_0xc7bc('0x17')]('close',close);}ami['on']('connect',connect);ami['on'](_0xc7bc('0x18'),function(_0x1360e2){logger[_0xc7bc('0x16')](util[_0xc7bc('0x7')](_0xc7bc('0x19'),config[_0xc7bc('0x4')][_0xc7bc('0x9')],config[_0xc7bc('0x4')]['ip'],config[_0xc7bc('0x4')][_0xc7bc('0x3')],util[_0xc7bc('0xa')](_0x1360e2,![],null)));});ami['on']('fullybooted',function(){logger[_0xc7bc('0x16')](util[_0xc7bc('0x7')](_0xc7bc('0x1a'),config[_0xc7bc('0x4')][_0xc7bc('0x9')],config[_0xc7bc('0x4')]['ip'],config['asterisk'][_0xc7bc('0x3')]));return Promise[_0xc7bc('0x1b')]()[_0xc7bc('0x1c')](ami['actionSipShowRegistry']())[_0xc7bc('0x1c')](ami['actionDeviceStateList']())['then'](ami[_0xc7bc('0x11')]())[_0xc7bc('0x1c')](ami['actionQueueSummary']())[_0xc7bc('0x1c')](ami[_0xc7bc('0x1d')]())[_0xc7bc('0x1e')](function(_0xe30140){logger[_0xc7bc('0xb')](_0xc7bc('0x1f'),util[_0xc7bc('0xa')](_0xe30140,{'showHidden':![],'depth':null}));});});ami[_0xc7bc('0x17')](_0xc7bc('0xb'),error);ami[_0xc7bc('0x17')](_0xc7bc('0x20'),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 27e757c..3f04704 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 _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x20bc10,_0x35bed9){var _0x3bd5ce=function(_0x8d1e4c){while(--_0x8d1e4c){_0x20bc10['push'](_0x20bc10['shift']());}};_0x3bd5ce(++_0x35bed9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0xb7e7[_0x4e6ae6];return _0x23c108;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file +var _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x191676,_0x2863e2){_0x191676=_0x191676-0x0;var _0x440ad6=_0x9bde[_0x191676];return _0x440ad6;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var client=jayson['client'][_0xe9bd('0x2')]({'port':0x2329});client[_0xe9bd('0x3')]=function(_0x131f6a,_0x1c1b34){return new BPromise(function(_0x10822d,_0x1a4d14){return client[_0xe9bd('0x4')](_0x131f6a,_0x1c1b34)['then'](function(_0x4763e9){logger[_0xe9bd('0x5')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x1c1b34,_0x4763e9);if(_0x4763e9[_0xe9bd('0x8')]){logger[_0xe9bd('0x8')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x4763e9[_0xe9bd('0x8')][_0xe9bd('0x9')],_0x1c1b34);return _0x1a4d14(_0x4763e9['error']['message']);}else{return _0x10822d(_0x4763e9[_0xe9bd('0xa')]);}})[_0xe9bd('0xb')](function(_0x2601ac){logger['error'](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x2601ac,_0x1c1b34);return _0x1a4d14(_0x2601ac);});});};module[_0xe9bd('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 b366dcb..8425aa1 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 _0x81a9=['verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','add','minutes','ContactId','ListId','[rescheduleContact][Drop]','Drop','starttime','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','countglobal','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','rescheduleContact','CampaignId','[rescheduleContact][Abandoned]','calleridname','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','channel','syncQueueMember','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','pick','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','VoiceQueueId','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','variable','amdstatus','exten','xcally-motion-dialer','HANGUP','outboundAnswerAgiCallsDay','membername','AMD','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','dialAMDActive','value','MACHINE','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','reason\x2019\x20machine....','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','Normal\x20Clearing','outboundUnknownCallsDay','cause-txt','Unknow','syncQueueSummary','queuesSummary','running','isPreviewCampaign','statusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','object','phone','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','assign','Trunk','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','dialCutDigit','substring','SIP/%s/%s%s','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','dialNoSuchNumberRetryFrequency','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','Global','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','handlePredictive','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','dialPredictiveOptimizationPercentage','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','loggedIn','outboundQueuePauses','predictiveIntervalPauses','busyFactor','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','checkContactEmpty','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','countReScheduled','[countReScheduled]\x20','RUNNING','[getContactDialer2]','tryOriginatePredictive','not_inuse','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','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[busyFactor]','p\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictive','../ami','redis','defaults','../rpc/cmHopper','../rpc/voiceQueueRt','./models/action','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','syncNewExten','varset','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','emit','type','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','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','---------------------------','predictiveIntervalTotalCalls','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','inspect','contactsRescheduled','message','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','CAMPAIGN_STATUS','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','statedesc','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Interval','Intervals','isIVRCampaignActive','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','Error','prototype','active','status','SIP/%s','isTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','ifTime','Failure','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','isArray','length','push','Action','command','then','content','indexOf','true','catch','all','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','checkIsTrunkReachable','checkIfTimeIntervals','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','power','handlePower','dialPowerLevel','Queue','silly','Dialer::ifTime()','intervalIftime','OVERTIME_INTERVAL','Global:\x20','Timezone:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','queue','uniqueid','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','ivr','outboundAnswerCallsDay','reason','agent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','state','dropreason','TIMEOUT','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0x81a9,0x15a));var _0x981a=function(_0x569856,_0x2a65df){_0x569856=_0x569856-0x0;var _0x489a09=_0x81a9[_0x569856];return _0x489a09;};'use strict';var util=require(_0x981a('0x0'));var _=require(_0x981a('0x1'));var uuid=require(_0x981a('0x2'));var moment=require(_0x981a('0x3'));var rr=require('rr');var Redis=require(_0x981a('0x4'));var utils=require('./utils');var hopperUtils=require('./utils/hopper');var ut=require(_0x981a('0x5'));var config=require(_0x981a('0x6'));var logger=require('../../../config/logger')(_0x981a('0x7'));var loggerBooked=require(_0x981a('0x8'))(_0x981a('0x9'));var loggerPredictive=require(_0x981a('0x8'))(_0x981a('0xa'));var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0x981a('0x8'))('syncQueueSummary');var ami=require(_0x981a('0xb'));config[_0x981a('0xc')]=_[_0x981a('0xd')](config[_0x981a('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x981a('0xc')]));var cmHopper=require(_0x981a('0xe'));var voiceQueueRt=require(_0x981a('0xf'));var RpcSetting=require('../rpc/setting');var Interval=require('../rpc/interval');var Action=require(_0x981a('0x10'));var History=require('./models/history');var Final=require('./models/final');var AgentComplete=require(_0x981a('0x11'));var QueueCallerAbandon=require(_0x981a('0x12'));var Hangup=require(_0x981a('0x13'));var ipAgi=process[_0x981a('0x14')][_0x981a('0x15')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x981a('0x16')]=function(_0x4dca5f){this[_0x981a('0x17')]=this[_0x981a('0x17')]?this[_0x981a('0x17')]['finally'](_0x4dca5f):_0x4dca5f();};function Dialer(_0x20ddb0,_0xaf2366){this[_0x981a('0x18')]=new Sequence();this[_0x981a('0x19')]=_0xaf2366;this['voiceQueues']=_0x20ddb0[_0x981a('0x1a')];this[_0x981a('0x1b')]=_0x20ddb0[_0x981a('0x1b')];this[_0x981a('0x1c')]=_0x20ddb0[_0x981a('0x1c')];this[_0x981a('0x1d')]=_0x20ddb0[_0x981a('0x1d')];this[_0x981a('0x1e')]=config['maxNumberOriginate']||0x2;this[_0x981a('0x1f')]={};this[_0x981a('0x20')]={};this[_0x981a('0x21')]={};this[_0x981a('0x22')]={};this[_0x981a('0x23')]={};this[_0x981a('0x24')]={};this[_0x981a('0x25')]={};this[_0x981a('0x26')]={};this[_0x981a('0x27')]={};this['queueBookedRR']={};this['queuesSummary']={};ami['on'](_0x981a('0x28'),this['syncAgentConnect'][_0x981a('0x29')](this));ami['on'](_0x981a('0x2a'),this[_0x981a('0x2b')][_0x981a('0x29')](this));ami['on']('originateresponse',this[_0x981a('0x2c')][_0x981a('0x29')](this));ami['on'](_0x981a('0x2d'),this[_0x981a('0x2e')][_0x981a('0x29')](this));ami['on'](_0x981a('0x2f'),this['syncQueueSummary']['bind'](this));ami['on'](_0x981a('0x30'),this[_0x981a('0x31')][_0x981a('0x29')](this));ami['on']('hangup',this[_0x981a('0x32')][_0x981a('0x29')](this));ami['on'](_0x981a('0x33'),this[_0x981a('0x34')][_0x981a('0x29')](this));ami['on'](_0x981a('0x35'),this['syncVarSet'][_0x981a('0x29')](this));ami['on'](_0x981a('0x36'),this['syncQueueMember'][_0x981a('0x29')](this));ami['on'](_0x981a('0x37'),this[_0x981a('0x38')]['bind'](this));this[_0x981a('0x39')]();this[_0x981a('0x3a')]();RpcSetting[_0x981a('0x3b')]()['then'](function(_0x501b10){previewRecallmeReminderInterval=_0x501b10[_0x981a('0x3c')];});}function isNotNull(_0x885bb0){return _0x885bb0!==null&&!_[_0x981a('0x3d')](_0x885bb0);}function msgResponse(_0x5e6100,_0x25d696,_0x24e940){return{'action':_0x5e6100,'response':_0x25d696,'message':_0x24e940,'stack':_0x24e940};}function emit(_0x3ae47b,_0x1e26b0,_0x402e69){io['to'](_0x3ae47b)[_0x981a('0x3e')](_0x1e26b0,_0x402e69);}function emitOutboundVoiceQueueSummary(_0x8e75df){if(_0x8e75df[_0x981a('0x3f')]==='outbound'){logger[_0x981a('0x40')](_0x981a('0x41'),util['inspect'](_0x8e75df,{'showHidden':![],'depth':null}));emit(util[_0x981a('0x42')](_0x981a('0x43'),_0x8e75df[_0x981a('0x44')]),_0x981a('0x45'),_0x8e75df);}}function checkGetDataPredictive(_0x192f9b){if(isNotNull(_0x192f9b)&&!_[_0x981a('0x46')](_0x192f9b)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x981a('0x47')](_0x981a('0x48'),_0x192f9b['predictiveIntervalTotalCalls']);loggerPredictive[_0x981a('0x47')](_0x981a('0x49'),_0x192f9b[_0x981a('0x4a')]);loggerPredictive['info'](_0x981a('0x4b'),_0x192f9b[_0x981a('0x4c')]);loggerPredictive[_0x981a('0x47')](_0x981a('0x4d'),_0x192f9b[_0x981a('0x4e')]);loggerPredictive[_0x981a('0x47')](_0x981a('0x4f'),_0x192f9b[_0x981a('0x50')]);loggerPredictive[_0x981a('0x47')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x192f9b['predictiveIntervalAvgTalktime']);loggerPredictive[_0x981a('0x47')](_0x981a('0x51'));if(_0x192f9b[_0x981a('0x52')]>0x0){if(!_[_0x981a('0x3d')](_0x192f9b[_0x981a('0x53')])&&_0x192f9b['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x981a('0x47')](_0x981a('0x54'));if(!_[_0x981a('0x3d')](_0x192f9b[_0x981a('0x50')])&&_0x192f9b[_0x981a('0x50')]>0x0){return!![];}loggerPredictive[_0x981a('0x47')](_0x981a('0x55'));}else{loggerPredictive[_0x981a('0x47')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x981a('0x47')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x5480ef){return function(_0x5b5363){loggerPredictive[_0x981a('0x47')]('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x981a('0x56'),_0x5b5363[_0x981a('0x57')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5b5363[_0x981a('0x58')]);loggerPredictive[_0x981a('0x47')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5b5363[_0x981a('0x59')]);loggerPredictive[_0x981a('0x47')](_0x981a('0x5a'),_0x5b5363[_0x981a('0x5b')]);loggerPredictive[_0x981a('0x47')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5b5363[_0x981a('0x59')]);loggerPredictive[_0x981a('0x47')](_0x981a('0x51'));_[_0x981a('0x5c')](_0x5480ef,_0x5b5363);};}function ifInterval(_0x53308e,_0x3931fd){if(_[_0x981a('0x3d')](_0x3931fd)){return![];}return utils[_0x981a('0x5d')](undefined,_0x3931fd)<_0x53308e*0x3c;}function clearPredictiveAttributes(_0x1991e3){if(_0x1991e3['startProgressive']){_0x1991e3[_0x981a('0x25')]=undefined;loggerPredictive[_0x981a('0x40')](_0x1991e3['name'],_0x981a('0x5e'));}if(_0x1991e3['startPredictive']){_0x1991e3[_0x981a('0x24')]=undefined;loggerPredictive[_0x981a('0x40')](_0x1991e3['name'],_0x981a('0x5f'));}if(_0x1991e3['handlePredictive']){clearInterval(_0x1991e3['handlePredictive']);_0x1991e3['handlePredictive']=undefined;loggerPredictive['debug'](_0x1991e3[_0x981a('0x44')],_0x981a('0x60'));}}function loggerCatchPredictive(_0x242bcf,_0x472b13){return function(_0x409427){loggerPredictive[_0x981a('0x61')](_0x472b13[_0x981a('0x44')],_0x242bcf);loggerPredictive['error'](_0x409427[_0x981a('0x62')]);clearPredictiveAttributes(_0x472b13);};}function loggerCatch(_0x22b051){return function(_0x3f0149){logger[_0x981a('0x61')](_0x22b051,util['inspect'](_0x3f0149,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x25954a,_0x5e949d,_0x157846){return function(_0xd5519a){utils[_0x981a('0x63')](_0x5e949d,_0x157846,0x0);_0x5e949d[_0x981a('0x64')]=0x0;logger[_0x981a('0x61')](_0x25954a,util[_0x981a('0x65')](_0xd5519a,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x33098e){return function(_0x310c1a){if(isNotNull(_0x310c1a)&&isNotNull(_0x310c1a[0x0])){if(_0x310c1a[0x0][_0x981a('0x66')]>0x0){_0x33098e[_0x981a('0x67')]=utils['CAMPAIGN_STATUS'][_0x981a('0x68')];logger['info'](_0x981a('0x69')+_0x33098e[_0x981a('0x44')],_0x310c1a[0x0][_0x981a('0x66')],_0x981a('0x6a'));}else{_0x33098e['message']=utils[_0x981a('0x6b')][_0x981a('0x6c')];logger[_0x981a('0x47')](_0x981a('0x6d')+_0x33098e[_0x981a('0x44')]);}}};}function createObjHistory(_0x49816c,_0x49b371,_0xe8a84f,_0x23d0e6,_0xf6da12){_0x49816c[_0x981a('0x67')]=_0xe8a84f;var _0x5bed65=new Action(_0x49816c,_0x49b371);var _0x137d5f=new History(_0x5bed65);_0x137d5f['state']=_0x23d0e6;_0x137d5f[_0x981a('0x6e')]=_0xf6da12;_0x137d5f[_0x981a('0x6f')]=_0x5bed65['starttime'];return _0x137d5f;}function unlockQueueStatus(_0x1ef41d,_0x1ade56){setTimeout(function(){if(_[_0x981a('0x3d')](_0x1ef41d[_0x981a('0x70')])){loggerBooked[_0x981a('0x61')](_0x981a('0x71'),_0x1ade56);}_0x1ef41d[_0x981a('0x70')]=!![];loggerBooked[_0x981a('0x47')](_0x981a('0x72'),_0x1ade56,JSON[_0x981a('0x73')](_['pick'](_0x1ef41d,['name',_0x981a('0x70')])));},0x1f3);}function checkInterval(_0x259404){return function(){if(!isNotNull(_0x259404['Interval'])){_0x259404['message']=utils[_0x981a('0x6b')][_0x981a('0x74')];throw _0x259404[_0x981a('0x44')]+_0x981a('0x75');}if(!isNotNull(_0x259404[_0x981a('0x76')][_0x981a('0x77')])){_0x259404[_0x981a('0x67')]=utils['CAMPAIGN_STATUS'][_0x981a('0x74')];throw _0x259404[_0x981a('0x44')]+_0x981a('0x75');}if(!isNotNull(_[_0x981a('0x46')](_0x259404['Interval'][_0x981a('0x77')]))){_0x259404['message']=utils['CAMPAIGN_STATUS'][_0x981a('0x74')];throw _0x259404[_0x981a('0x44')]+_0x981a('0x75');}};}function checkIsIVRCampaignActive(_0x54ea8b){return function(){if(!utils[_0x981a('0x78')](_0x54ea8b)){_0x54ea8b['message']=utils[_0x981a('0x6b')]['INACTIVE'];throw _0x54ea8b['name']+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0xe43ae8){if(utils[_0x981a('0x79')](_0xe43ae8)){emit(util[_0x981a('0x42')](_0x981a('0x7a'),_0xe43ae8['name']),'campaign:save',_0xe43ae8);}}function loggerCatchQueueSummary(_0xac758a,_0x28c695){return function(_0x1b6d51){clearPredictiveAttributes(_0x28c695);emitCampaignSummary(_0x28c695);loggerSyncQueueSummary[_0x981a('0x40')](_0xac758a,util[_0x981a('0x65')](_0x1b6d51,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x3cc077){if(_0x3cc077[_0x981a('0x7b')]){if(_0x3cc077['originated']===0x0){_0x3cc077[_0x981a('0x7b')]=![];_0x3cc077[_0x981a('0x67')]=utils['CAMPAIGN_STATUS'][_0x981a('0x7c')];loggerSyncQueueSummary[_0x981a('0x40')](_0x981a('0x7d'),_0x3cc077[_0x981a('0x44')],_0x981a('0x7e'));}else{_0x3cc077['message']=utils[_0x981a('0x6b')][_0x981a('0x7f')];loggerSyncQueueSummary[_0x981a('0x40')](_0x981a('0x7d'),_0x3cc077[_0x981a('0x44')],_0x981a('0x80'));}emitCampaignSummary(_0x3cc077);}}function myreject(_0xaccd36){return function(_0x25af77){return _0xaccd36(msgResponse('[ifTime][Action]',_0x981a('0x81'),JSON[_0x981a('0x73')](_0x25af77)));};}Dialer[_0x981a('0x82')]['isTrunkReachable']=function(_0xfa134b){return!_['isUndefined'](_0xfa134b)&&_0xfa134b&&!_[_0x981a('0x3d')](_0xfa134b[_0x981a('0x44')])&&!_[_0x981a('0x3d')](_0xfa134b['active'])&&_0xfa134b[_0x981a('0x83')]&&(this['trunks'][util[_0x981a('0x42')]('SIP/%s',_0xfa134b[_0x981a('0x44')])][_0x981a('0x84')]==='reachable'||this['trunks'][util[_0x981a('0x42')](_0x981a('0x85'),_0xfa134b['name'])][_0x981a('0x84')]==='unmonitored');};Dialer['prototype']['checkIsTrunkReachable']=function(_0x31983d){var _0x572e58=this;return function(){if(!_0x572e58['isTrunkReachable'](_0x31983d['Trunk'])){if(!_0x572e58[_0x981a('0x86')](_0x31983d[_0x981a('0x87')])){_0x31983d[_0x981a('0x67')]=utils['CAMPAIGN_STATUS'][_0x981a('0x88')];throw _0x31983d[_0x981a('0x44')]+_0x981a('0x89');}}};};Dialer[_0x981a('0x82')][_0x981a('0x8a')]=function(_0x55f494,_0x4d8521,_0xa27c8c,_0x13182e){var _0x234077=this;return function(){var _0x3a5a32=!![];return _0x234077['ifTimeIvr'](_0x55f494,_0x4d8521,_0xa27c8c,_0x13182e,_0x3a5a32);};};Dialer['prototype']['checkIfTimeIntervals']=function(_0xf90549,_0x2b2c09,_0x5ebe81,_0x9904c){var _0xc43de0=this;return function(){var _0x38daa5=![];return _0xc43de0[_0x981a('0x8b')](_0xf90549[_0x981a('0x77')],_0x2b2c09,_0x5ebe81,_0x9904c,_0x38daa5);};};Dialer['prototype'][_0x981a('0x8b')]=function(_0x5b70f9,_0x1d9383,_0x2c0a14,_0x38b6b6,_0x48ee2a){var _0xb61f5f=[];return new Promise(function(_0x49fcb5,_0x2a642e){if(!isNotNull(_0x5b70f9)){_0x38b6b6[_0x981a('0x67')]=utils['CAMPAIGN_STATUS'][_0x981a('0x74')];return _0x2a642e(msgResponse(_0x981a('0x8c'),_0x981a('0x8d'),_0x2c0a14+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x981a('0x46')](_0x5b70f9)){_0x38b6b6[_0x981a('0x67')]=utils[_0x981a('0x6b')][_0x981a('0x8e')];return _0x2a642e(msgResponse(_0x981a('0x8c'),_0x981a('0x8d'),_0x2c0a14+_0x981a('0x8f')));}if(_0x1d9383&&_[_0x981a('0x3d')](config[_0x981a('0x90')][_0x1d9383])){_0x38b6b6[_0x981a('0x67')]=utils[_0x981a('0x6b')][_0x981a('0x91')];return _0x2a642e(msgResponse(_0x981a('0x8c'),_0x981a('0x8d'),_0x2c0a14+'\x20Timezone\x20unknow\x20'+_0x1d9383));}if(_[_0x981a('0x92')](_0x5b70f9)){for(var _0x21d647=0x0;_0x21d647<_0x5b70f9[_0x981a('0x93')];_0x21d647+=0x1){_0xb61f5f[_0x981a('0x94')](ami[_0x981a('0x95')]({'action':_0x981a('0x96'),'command':util['format']('iftime\x20%s,%s',_0x5b70f9[_0x21d647]['interval'],!_[_0x981a('0x3d')](config[_0x981a('0x90')][_0x1d9383])?_0x1d9383:'')})[_0x981a('0x97')](function(_0x50a08b){return _0x50a08b[_0x981a('0x98')][_0x981a('0x99')](_0x981a('0x9a'))>=0x0;})[_0x981a('0x9b')](myreject(_0x2a642e)));}}else{_0xb61f5f[_0x981a('0x94')](ami['Action']({'action':_0x981a('0x96'),'command':util[_0x981a('0x42')]('iftime\x20%s,%s',_0x5b70f9,!_['isUndefined'](config[_0x981a('0x90')][_0x1d9383])?_0x1d9383:'')})['then'](function(_0x13f9f4){return _0x13f9f4[_0x981a('0x98')]['indexOf'](_0x981a('0x9a'))>=0x0;})[_0x981a('0x9b')](myreject(_0x2a642e)));}Promise[_0x981a('0x9c')](_0xb61f5f)[_0x981a('0x97')](function(_0x31c22f){var _0x35b679=_[_0x981a('0x9d')](_0x31c22f);if(_0x35b679){return _0x49fcb5(_0x35b679);}else{_0x38b6b6['message']=_0x48ee2a?utils[_0x981a('0x6b')][_0x981a('0x9e')]:utils['CAMPAIGN_STATUS']['OVERTIME_INTERVAL'];return _0x2a642e(msgResponse(_0x981a('0x9f'),_0x981a('0x8d'),'Global:\x20'+_0x48ee2a+'\x20'+_0x2c0a14+_0x981a('0xa0')+util[_0x981a('0x65')](_0x5b70f9,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x1d9383));}})['catch'](function(_0x4892d6){return _0x2a642e(msgResponse(_0x981a('0x8c'),_0x981a('0x8d'),JSON['stringify'](_0x4892d6)));});});};Dialer['prototype'][_0x981a('0x39')]=function(){var _0x37a55b=this;return cmHopper[_0x981a('0xa1')]({'active':![]},{'where':{'active':!![]}})[_0x981a('0x97')](function(){setInterval(function(){_0x37a55b[_0x981a('0xa2')]();},0x3e8);});};Dialer[_0x981a('0x82')][_0x981a('0xa2')]=function(){var _0x3ea08c=this;var _0x596f7c;for(var _0x4c6b28 in this[_0x981a('0x1b')]){if(typeof this[_0x981a('0x1b')][_0x4c6b28]!==_0x981a('0xa3')){_0x596f7c=this[_0x981a('0x1b')][_0x4c6b28];if(utils[_0x981a('0x79')](_0x596f7c)&&utils[_0x981a('0x78')](_0x596f7c)){_0x596f7c[_0x981a('0x7b')]=!![];Promise[_0x981a('0xa4')]()[_0x981a('0x97')](checkIsIVRCampaignActive(_0x596f7c))[_0x981a('0x97')](checkInterval(_0x596f7c))[_0x981a('0x97')](_0x3ea08c[_0x981a('0xa5')](_0x596f7c))[_0x981a('0x97')](_0x3ea08c['checkIfTime'](_0x596f7c['dialGlobalInterval'],_0x596f7c['dialTimezone'],_0x596f7c[_0x981a('0x44')],_0x596f7c))[_0x981a('0x97')](_0x3ea08c[_0x981a('0xa6')](_0x596f7c[_0x981a('0x76')],_0x596f7c[_0x981a('0xa7')],_0x596f7c[_0x981a('0x44')],_0x596f7c))[_0x981a('0x97')](_0x3ea08c[_0x981a('0xa8')](_0x596f7c))[_0x981a('0x9b')](loggerCatchQueueSummary(_0x981a('0xa9'),_0x596f7c));}else{notSendMessagesCampaign(_0x596f7c);}}}};Dialer[_0x981a('0x82')][_0x981a('0xaa')]=function(_0x20da1d){if(_0x20da1d[_0x981a('0xab')]!==_0x981a('0xa')){clearPredictiveAttributes(_0x20da1d);}switch(_0x20da1d[_0x981a('0xab')]){case'progressive':this['handlePower'](_0x20da1d,0x1);break;case _0x981a('0xac'):this[_0x981a('0xad')](_0x20da1d,_0x20da1d[_0x981a('0xae')]);break;case _0x981a('0xa'):this[_0x981a('0xa')](_0x20da1d);break;case _0x981a('0x9'):this[_0x981a('0xad')](_0x20da1d,0x1);break;default:logger[_0x981a('0x61')](_0x981a('0xaf'),_0x20da1d[_0x981a('0x44')],'method\x20not\x20recognized');}};Dialer[_0x981a('0x82')][_0x981a('0x8c')]=function(_0x35e238,_0x33dc4b){var _0x130001=_0x35e238[_0x981a('0xa7')];var _0x7484e3=_0x33dc4b?_0x35e238['dialGlobalInterval']:_0x35e238[_0x981a('0x76')][_0x981a('0x77')];logger[_0x981a('0xb0')](_0x981a('0xb1'),_0x7484e3,_0x130001,_0x35e238['name'],util[_0x981a('0x42')]('Voice\x20Queue\x20%s\x20$s',_0x35e238[_0x981a('0x44')],_0x35e238['id']));var _0x14805c=null;return Interval[_0x981a('0xb2')](_0x7484e3,_0x130001)[_0x981a('0x97')](function(_0x1110c0){if(_0x1110c0===!![]){return _0x1110c0;}else{_0x35e238['message']=_0x33dc4b?utils[_0x981a('0x6b')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x981a('0x6b')][_0x981a('0xb3')];_0x14805c=msgResponse('[ifTime][promiseAll]',_0x981a('0x8d'),_0x981a('0xb4')+_0x33dc4b+'\x20'+_0x35e238['name']+_0x981a('0xa0')+util[_0x981a('0x65')](_0x7484e3,{'showHidden':![],'depth':null})+_0x981a('0xb5')+_0x130001);}if(_0x14805c!==null){logger['silly'](_0x981a('0xb6'),_0x14805c);_0x14805c[_0x981a('0xb7')]=_0x33dc4b;throw _0x14805c;}})[_0x981a('0x9b')](function(_0x578065){logger[_0x981a('0x61')](_0x981a('0xb8'),_0x578065);throw msgResponse(_0x981a('0xb9'),_0x981a('0x81'),util[_0x981a('0x65')](_0x578065,{'showHidden':![],'depth':null}));});};Dialer[_0x981a('0x82')]['syncAgentConnect']=function(_0x3f8596){if(this[_0x981a('0x1a')][_0x3f8596[_0x981a('0xba')]]){if(this[_0x981a('0x22')][_0x3f8596['uniqueid']]&&this[_0x981a('0x22')][_0x3f8596[_0x981a('0xbb')]][_0x981a('0x3f')]!=='ivr'){this[_0x981a('0xbc')](this[_0x981a('0x1a')][_0x3f8596[_0x981a('0xba')]]);this[_0x981a('0x22')][_0x3f8596[_0x981a('0xbb')]][_0x981a('0xbd')]=moment()[_0x981a('0x42')](_0x981a('0xbe'));}}};Dialer[_0x981a('0x82')][_0x981a('0x2e')]=function(_0x19b758){var _0x3ac4a9=this[_0x981a('0x22')][_0x19b758[_0x981a('0xbb')]];if(this[_0x981a('0x1a')][_0x19b758['queue']]){if(_0x3ac4a9&&_0x3ac4a9['type']!==_0x981a('0xbf')){delete this[_0x981a('0x22')][_0x19b758[_0x981a('0xbb')]];this[_0x981a('0x1a')][_0x19b758[_0x981a('0xba')]][_0x981a('0xc0')]+=0x1;var _0x2237e0=new AgentComplete(_0x3ac4a9,_0x19b758);if(_0x19b758[_0x981a('0xc1')]===_0x981a('0xc2')){_0x2237e0['agiafterat']=this['voiceQueues'][_0x19b758[_0x981a('0xba')]]['dialQueueProject2']&&this[_0x981a('0x1a')][_0x19b758['queue']]['dialAgiAfterHangupAgent']?moment()[_0x981a('0x42')](_0x981a('0xbe')):undefined;}hopperUtils[_0x981a('0xc3')](_0x2237e0)[_0x981a('0x9b')](loggerCatch(_0x981a('0xc4')));hopperUtils[_0x981a('0xc5')](_0x2237e0)['catch'](loggerCatch(_0x981a('0xc6')));}}};Dialer['prototype'][_0x981a('0x2b')]=function(_0xe5e08c){var _0x26c2dc=this[_0x981a('0x22')][_0xe5e08c[_0x981a('0xbb')]];var _0xe5b4de=this;var _0x22a5da=![];var _0x17a3ed;var _0x1f7d12;if(this[_0x981a('0x1a')][_0xe5e08c[_0x981a('0xba')]]){if(_0x26c2dc&&_0x26c2dc[_0x981a('0x3f')]!==_0x981a('0xbf')){delete this[_0x981a('0x22')][_0xe5e08c[_0x981a('0xbb')]];this[_0x981a('0xbc')](this[_0x981a('0x1a')][_0xe5e08c['queue']]);_0x26c2dc[_0x981a('0xc7')]=moment()[_0x981a('0x42')](_0x981a('0xbe'));var _0x4f8355=new QueueCallerAbandon(_0x26c2dc,_0xe5e08c);if(utils['getSeconds'](_0x26c2dc[_0x981a('0xc7')],_0x26c2dc[_0x981a('0xc8')])>=_0x26c2dc[_0x981a('0xc9')]){this[_0x981a('0x1a')][_0xe5e08c[_0x981a('0xba')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x981a('0x1a')][_0xe5e08c[_0x981a('0xba')]][_0x981a('0xca')]+=0x1;this[_0x981a('0x1a')][_0xe5e08c[_0x981a('0xba')]][_0x981a('0xcb')]+=0x1;_0x4f8355[_0x981a('0xcc')]=0xa;_0x4f8355[_0x981a('0x6e')]='Drop';_0x4f8355[_0x981a('0xcd')]=_0x981a('0xce');_0x4f8355['agiafterat']=this[_0x981a('0x1a')][_0xe5e08c[_0x981a('0xba')]]['dialQueueProject2']?moment()[_0x981a('0x42')](_0x981a('0xbe')):undefined;_0x4f8355[_0x981a('0xcf')]+=0x1;_0x4f8355['countglobal']+=0x1;_0x17a3ed=this[_0x981a('0x1a')][_0xe5e08c[_0x981a('0xba')]][_0x981a('0xd0')];_0x1f7d12=this[_0x981a('0x1a')][_0xe5e08c[_0x981a('0xba')]][_0x981a('0xd1')];hopperUtils[_0x981a('0xd2')](_0x4f8355,_0x4f8355['state'],_0x26c2dc[_0x981a('0xd3')])['then'](function(_0x5cf1ce){_0x22a5da=_0x5cf1ce[_0x981a('0xd4')]==0x1;if(_0x4f8355[_0x981a('0xcf')]>=_0xe5b4de[_0x981a('0x1a')][_0xe5e08c[_0x981a('0xba')]][_0x981a('0xd5')]){_0xe5b4de[_0x981a('0xd6')](_0x4f8355,_0x5cf1ce[_0x981a('0xd4')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x4f8355[_0x981a('0xcf')],'scheduledat':moment()[_0x981a('0xd7')](_0xe5b4de[_0x981a('0x1a')][_0xe5e08c[_0x981a('0xba')]][_0x981a('0xd0')],_0x981a('0xd8'))[_0x981a('0x42')](_0x981a('0xbe')),'ContactId':_0x26c2dc[_0x981a('0xd9')],'ListId':_0x26c2dc[_0x981a('0xda')],'VoiceQueueId':_0x26c2dc['VoiceQueueId']||undefined,'CampaignId':_0x26c2dc['CampaignId']||undefined})[_0x981a('0x9b')](loggerCatch(_0x981a('0xdb')));var _0x335f06=new History(_0x4f8355);_0x335f06[_0x981a('0xcc')]=0xa;_0x335f06[_0x981a('0x6e')]=_0x981a('0xdc');_0x335f06[_0x981a('0xdd')]=moment()[_0x981a('0x42')]('YYYY-MM-DD\x20HH:mm:ss');_0x335f06[_0x981a('0x6f')]=_0x335f06['starttime'];_0x335f06['calleridname']=_0x4f8355['calleridname'];_0x335f06[_0x981a('0xde')]=_0x4f8355[_0x981a('0xde')];hopperUtils[_0x981a('0xc3')](_0x335f06)[_0x981a('0x9b')](loggerCatch(_0x981a('0xdf')));}})[_0x981a('0x97')](function(){if(_0x22a5da)hopperUtils['swapAdditionalPhones'](_0x4f8355,_0x17a3ed,_0x1f7d12)[_0x981a('0x97')](function(){return 0x1;});});}else{this[_0x981a('0x1a')][_0xe5e08c['queue']][_0x981a('0x4e')]+=0x1;this[_0x981a('0x1a')][_0xe5e08c['queue']][_0x981a('0xe0')]+=0x1;_0x4f8355[_0x981a('0xcc')]=0xb;_0x4f8355[_0x981a('0x6e')]=_0x981a('0xe1');_0x4f8355[_0x981a('0xcd')]=_0x981a('0xe2');_0x4f8355[_0x981a('0xe3')]+=0x1;_0x4f8355[_0x981a('0xe4')]+=0x1;_0x17a3ed=this[_0x981a('0x1a')][_0xe5e08c['queue']][_0x981a('0xe5')];_0x1f7d12=this[_0x981a('0x1a')][_0xe5e08c['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0x981a('0xd2')](_0x4f8355,_0x4f8355[_0x981a('0xcc')],_0x26c2dc[_0x981a('0xd3')])[_0x981a('0x97')](function(_0x419ab7){if(_0x4f8355[_0x981a('0xe3')]>=_0xe5b4de[_0x981a('0x1a')][_0xe5e08c[_0x981a('0xba')]][_0x981a('0xe6')]){_0xe5b4de[_0x981a('0xd6')](_0x4f8355,_0x419ab7[_0x981a('0xd4')]);}else{hopperUtils[_0x981a('0xe7')]({'active':![],'countabandonedretry':_0x4f8355[_0x981a('0xe3')],'scheduledat':moment()[_0x981a('0xd7')](_0xe5b4de[_0x981a('0x1a')][_0xe5e08c['queue']][_0x981a('0xe5')],_0x981a('0xd8'))[_0x981a('0x42')](_0x981a('0xbe')),'ContactId':_0x26c2dc[_0x981a('0xd9')],'ListId':_0x26c2dc[_0x981a('0xda')],'VoiceQueueId':_0x26c2dc['VoiceQueueId']||undefined,'CampaignId':_0x26c2dc[_0x981a('0xe8')]||undefined})['catch'](loggerCatch(_0x981a('0xe9')));var _0x4e6fc5=new History(_0x4f8355);_0x4e6fc5[_0x981a('0xcc')]=0xb;_0x4e6fc5[_0x981a('0x6e')]=_0x981a('0xe1');_0x4e6fc5['starttime']=moment()[_0x981a('0x42')](_0x981a('0xbe'));_0x4e6fc5[_0x981a('0x6f')]=_0x4e6fc5[_0x981a('0xdd')];_0x4e6fc5[_0x981a('0xea')]=_0x4f8355['calleridname'];_0x4e6fc5['calleridnum']=_0x4f8355[_0x981a('0xde')];hopperUtils[_0x981a('0xc3')](_0x4e6fc5)[_0x981a('0x9b')](loggerCatch(_0x981a('0xeb')));}})['then'](function(){if(_0x22a5da)hopperUtils[_0x981a('0xec')](_0x4f8355,_0x17a3ed,_0x1f7d12)['then'](function(){return 0x1;});});}}}};Dialer[_0x981a('0x82')]['syncNewExten']=function(_0x509a10){if(this[_0x981a('0x20')][_0x509a10[_0x981a('0xbb')]]){this[_0x981a('0x20')][_0x509a10[_0x981a('0xbb')]]['channel']=_0x509a10[_0x981a('0xed')];}if(this[_0x981a('0x22')][_0x509a10[_0x981a('0xbb')]]){this['uniqueId'][_0x509a10[_0x981a('0xbb')]]['channel']=_0x509a10[_0x981a('0xed')];}};Dialer[_0x981a('0x82')][_0x981a('0xee')]=function(_0x489cd8){if(!this[_0x981a('0x20')][_0x489cd8[_0x981a('0xef')]]){return;}var _0x252991=this[_0x981a('0x1a')][this[_0x981a('0x20')][_0x489cd8[_0x981a('0xef')]][_0x981a('0xba')]][_0x981a('0xf0')]||_0x981a('0xf1');if(_0x252991===_0x981a('0xf2')){if(this[_0x981a('0x20')][_0x489cd8[_0x981a('0xef')]]&&_[_0x981a('0xf3')](this['actions'][_0x489cd8[_0x981a('0xef')]][_0x981a('0xf4')])&&_0x489cd8[_0x981a('0x84')]==='1'&&_0x489cd8[_0x981a('0xf5')]==='0'){if(this[_0x981a('0x1c')][_0x489cd8[_0x981a('0xf6')]]){if(!this['agents'][_0x489cd8['stateinterface']][_0x981a('0xf4')]){this[_0x981a('0x1c')][_0x489cd8['stateinterface']][_0x981a('0xf4')]=!![];this[_0x981a('0x20')][_0x489cd8[_0x981a('0xef')]][_0x981a('0xf4')]=!![];this[_0x981a('0x20')][_0x489cd8[_0x981a('0xef')]][_0x981a('0xf6')]=_0x489cd8['stateinterface'];}}}}else if(_0x252991===_0x981a('0xf1')){if(this[_0x981a('0x20')][_0x489cd8['actionid']]){if(this[_0x981a('0x1c')][_0x489cd8['stateinterface']]){this[_0x981a('0x20')][_0x489cd8[_0x981a('0xef')]][_0x981a('0xf6')]=_0x489cd8['stateinterface'];if(_[_0x981a('0xf3')](this[_0x981a('0x27')][this[_0x981a('0x20')][_0x489cd8[_0x981a('0xef')]]['queue']])){this[_0x981a('0x27')][this[_0x981a('0x20')][_0x489cd8[_0x981a('0xef')]]['queue']]=[];}this[_0x981a('0x27')][this[_0x981a('0x20')][_0x489cd8[_0x981a('0xef')]][_0x981a('0xba')]]['push'](_[_0x981a('0x5c')](_['pick'](this['actions'][_0x489cd8['actionid']],[_0x981a('0xf7'),_0x981a('0xf6')]),{'status':_0x489cd8[_0x981a('0x84')],'paused':_0x489cd8[_0x981a('0xf5')]}));}}}};Dialer[_0x981a('0x82')][_0x981a('0x38')]=function(_0x1f2212){if(!this['actions'][_0x1f2212[_0x981a('0xef')]]){return;}var _0x5680d2=this;var _0x2ab430=this[_0x981a('0x1a')][this[_0x981a('0x20')][_0x1f2212['actionid']]['queue']];var _0x2c3599=_0x2ab430['strategy']||_0x981a('0xf1');if(_0x2c3599===_0x981a('0xf2')){if(this['actions'][_0x1f2212[_0x981a('0xef')]]&&this[_0x981a('0x20')][_0x1f2212[_0x981a('0xef')]][_0x981a('0xf6')]){this[_0x981a('0x19')][_0x981a('0xf8')](this['actions'][_0x1f2212[_0x981a('0xef')]][_0x981a('0xf7')],this['actions'][_0x1f2212[_0x981a('0xef')]][_0x981a('0xf6')])[_0x981a('0x9b')](function(_0xa60419){logger['error'](_0x981a('0xf9'),util['inspect'](_0xa60419,{'showHidden':![],'depth':null}));})[_0x981a('0xfa')](function(){_0x5680d2[_0x981a('0xbc')](_0x5680d2['voiceQueues'][_0x5680d2[_0x981a('0x20')][_0x1f2212['actionid']][_0x981a('0xba')]]);_0x5680d2[_0x981a('0x1c')][_0x5680d2[_0x981a('0x20')][_0x1f2212['actionid']][_0x981a('0xf6')]][_0x981a('0xf4')]=![];delete _0x5680d2[_0x981a('0x20')][_0x1f2212['actionid']];unlockQueueStatus(_0x2ab430);});}else{this[_0x981a('0xbc')](this[_0x981a('0x1a')][this[_0x981a('0x20')][_0x1f2212['actionid']][_0x981a('0xba')]]);hopperUtils[_0x981a('0xe7')]({'active':![],'ContactId':this['actions'][_0x1f2212['actionid']][_0x981a('0xd9')],'ListId':this['actions'][_0x1f2212[_0x981a('0xef')]][_0x981a('0xda')],'VoiceQueueId':this[_0x981a('0x20')][_0x1f2212[_0x981a('0xef')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x981a('0x20')][_0x1f2212[_0x981a('0xef')]][_0x981a('0xe8')]||undefined})['catch'](loggerCatch(_0x981a('0xfb')));delete this['actions'][_0x1f2212[_0x981a('0xef')]];unlockQueueStatus(_0x2ab430);}}else if(_0x2c3599===_0x981a('0xf1')){var _0x5d59d9;if(this[_0x981a('0x20')][_0x1f2212[_0x981a('0xef')]]&&!_[_0x981a('0x46')](this['queueBooked'][this[_0x981a('0x20')][_0x1f2212['actionid']]['queue']])){if(this['queueBookedRR'][_0x5680d2[_0x981a('0x20')][_0x1f2212[_0x981a('0xef')]][_0x981a('0xba')]]){this['queueBookedRR'][_0x5680d2[_0x981a('0x20')][_0x1f2212['actionid']]['queue']]=this['queueBookedRR'][this[_0x981a('0x20')][_0x1f2212[_0x981a('0xef')]]['queue']]?this[_0x981a('0xfc')][this['actions'][_0x1f2212[_0x981a('0xef')]][_0x981a('0xba')]]:this['queueBooked'][this[_0x981a('0x20')][_0x1f2212['actionid']]['queue']]?this['queueBooked'][this[_0x981a('0x20')][_0x1f2212[_0x981a('0xef')]][_0x981a('0xba')]][_0x981a('0xfd')]||0x0:0x0;}this[_0x981a('0x27')][this['actions'][_0x1f2212[_0x981a('0xef')]]['queue']]['_rr']=this[_0x981a('0xfc')][this[_0x981a('0x20')][_0x1f2212[_0x981a('0xef')]][_0x981a('0xba')]];for(var _0x4526d3=0x0;_0x4526d3=_0x2e1174[_0x981a('0x126')]){_0x350a5f[_0x981a('0x127')](_0x14c71f,_0x130568,_0x1b8656,_0x981a('0x128'));}else{if(_0x14c71f[_0x981a('0x124')]>=_0x2e1174[_0x981a('0x129')]){_0x350a5f[_0x981a('0x12a')](_0x14c71f,_0x130568,_0x1b8656,'reason\x2019\x20machine....');}else{hopperUtils[_0x981a('0xe7')]({'active':![],'countmachineretry':_0x14c71f[_0x981a('0x124')],'scheduledat':moment()[_0x981a('0xd7')](_0x2e1174['dialMachineRetryFrequency'],_0x981a('0xd8'))['format'](_0x981a('0xbe')),'ContactId':_0x14c71f[_0x981a('0xd9')],'ListId':_0x14c71f[_0x981a('0xda')],'VoiceQueueId':_0x14c71f['VoiceQueueId']||undefined,'CampaignId':_0x14c71f[_0x981a('0xe8')]||undefined})[_0x981a('0x9b')](loggerCatch(_0x981a('0x12b')));_0x130568({'reschedule':0x1});}}});}if(_0x49ebea[_0x981a('0x3f')]===_0x981a('0xbf')&&this['campaigns'][_0x49ebea[_0x981a('0xba')]][_0x981a('0x11b')]&&_0x3f4c46[_0x981a('0x11c')]===_0x981a('0x113')){delete this['uniqueId'][_0x3f4c46[_0x981a('0xbb')]];this[_0x981a('0xbc')](this[_0x981a('0x1b')][_0x49ebea[_0x981a('0xba')]]);_0x8d7b17=new Hangup(_0x49ebea,_0x3f4c46);_0x8d7b17[_0x981a('0xcc')]=0x12;_0x8d7b17['statedesc']=_0x981a('0x12c');_0x8d7b17[_0x981a('0x115')]='AMD';ami['emit'](_0x981a('0x11e'),ut[_0x981a('0x117')](_0x8d7b17,'amd'));this[_0x981a('0x119')](_0x8d7b17,_0x981a('0x12d'),_0x981a('0x12e'));}if(_0x49ebea['type']===_0x981a('0xbf')&&this['campaigns'][_0x49ebea[_0x981a('0xba')]][_0x981a('0x11b')]&&_0x3f4c46[_0x981a('0x11c')]==='MACHINE'){return new Promise(function(_0x511dc9,_0x3e14b7){delete _0x350a5f['uniqueId'][_0x3f4c46[_0x981a('0xbb')]];_0x350a5f['updateOriginated'](_0x350a5f[_0x981a('0x1b')][_0x49ebea['queue']]);_0x350a5f[_0x981a('0x1b')][_0x49ebea[_0x981a('0xba')]][_0x981a('0xc0')]+=0x1;_0x350a5f[_0x981a('0x1b')][_0x49ebea[_0x981a('0xba')]][_0x981a('0x114')]+=0x1;var _0x2dfcf4=_0x350a5f['campaigns'][_0x49ebea[_0x981a('0xba')]];var _0xd2c111=new Hangup(_0x49ebea,_0x3f4c46);_0xd2c111[_0x981a('0xcc')]=0x13;_0xd2c111[_0x981a('0x6e')]='Machine';_0xd2c111['membername']='AMD';_0xd2c111[_0x981a('0x124')]+=0x1;_0xd2c111[_0x981a('0xe4')]+=0x1;_0xd2c111['amd']=!![];ami[_0x981a('0x3e')](_0x981a('0x11e'),ut['buildObj'](_0xd2c111,_0x981a('0x118')));hopperUtils[_0x981a('0xc3')](_0xd2c111)[_0x981a('0x9b')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0xd2c111['countbusyretry']+_0xd2c111['countcongestionretry']+_0xd2c111['countnoanswerretry']+_0xd2c111[_0x981a('0x123')]+_0xd2c111[_0x981a('0xcf')]+_0xd2c111[_0x981a('0xe3')]+_0xd2c111[_0x981a('0x124')]+_0xd2c111[_0x981a('0x125')]>=_0x2dfcf4[_0x981a('0x126')]){_0x350a5f['stateGlobal'](_0xd2c111,_0x511dc9,_0x3e14b7,'reason19\x20machine....');}else{if(_0xd2c111['countmachineretry']>=_0x2dfcf4[_0x981a('0x129')]){_0x350a5f[_0x981a('0x12a')](_0xd2c111,_0x511dc9,_0x3e14b7,_0x981a('0x12f'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0xd2c111[_0x981a('0x124')],'scheduledat':moment()[_0x981a('0xd7')](_0x2dfcf4[_0x981a('0x130')],_0x981a('0xd8'))['format'](_0x981a('0xbe')),'ContactId':_0xd2c111[_0x981a('0xd9')],'ListId':_0xd2c111[_0x981a('0xda')],'VoiceQueueId':_0xd2c111[_0x981a('0x104')]||undefined,'CampaignId':_0xd2c111['CampaignId']||undefined})[_0x981a('0x9b')](loggerCatch(_0x981a('0x12b')));_0x511dc9({'reschedule':0x1});}}});}}};Dialer[_0x981a('0x82')][_0x981a('0x32')]=function(_0x25cce3){var _0x2fcb70=this[_0x981a('0x22')][_0x25cce3[_0x981a('0xbb')]];var _0x40b694;if(_0x2fcb70&&_0x2fcb70[_0x981a('0x3f')]===_0x981a('0xbf')){delete this[_0x981a('0x22')][_0x25cce3[_0x981a('0xbb')]];this['updateOriginated'](this[_0x981a('0x1b')][_0x2fcb70[_0x981a('0xba')]]);this['campaigns'][_0x2fcb70[_0x981a('0xba')]][_0x981a('0x131')]+=0x1;_0x40b694=new Hangup(_0x2fcb70,_0x25cce3);hopperUtils[_0x981a('0xc3')](_0x40b694)['catch'](loggerCatch(_0x981a('0x132')));hopperUtils['moveContactManagedDialer'](_0x40b694)[_0x981a('0x9b')](loggerCatch('[syncHangupIvr]'));}if(_0x2fcb70&&_0x2fcb70[_0x981a('0x3f')]!==_0x981a('0xbf')&&isNotNull(this[_0x981a('0x1a')][_0x2fcb70[_0x981a('0xba')]][_0x981a('0x133')])){delete this['uniqueId'][_0x25cce3[_0x981a('0xbb')]];this[_0x981a('0xbc')](this[_0x981a('0x1a')][_0x2fcb70['queue']]);this[_0x981a('0x1a')][_0x2fcb70[_0x981a('0xba')]][_0x981a('0xc0')]+=0x1;this[_0x981a('0x1a')][_0x2fcb70[_0x981a('0xba')]][_0x981a('0x114')]+=0x1;_0x40b694=new Hangup(_0x2fcb70,_0x25cce3);_0x40b694['state']=0x10;_0x40b694['statedesc']=_0x981a('0x134');_0x40b694[_0x981a('0x115')]=_0x981a('0x135');hopperUtils[_0x981a('0xc3')](_0x40b694)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x40b694)[_0x981a('0x9b')](loggerCatch(_0x981a('0x136')));}if(_0x2fcb70&&_0x2fcb70[_0x981a('0x3f')]!==_0x981a('0xbf')&&!isNotNull(this[_0x981a('0x1a')][_0x2fcb70[_0x981a('0xba')]][_0x981a('0x133')])){if(_0x25cce3['cause-txt']===_0x981a('0x137')){delete this[_0x981a('0x22')][_0x25cce3[_0x981a('0xbb')]];this[_0x981a('0x1a')][_0x2fcb70[_0x981a('0xba')]][_0x981a('0xc0')]+=0x1;const _0x9119ad=new AgentComplete(_0x2fcb70,_0x25cce3);_0x9119ad[_0x981a('0xe8')]=this['voiceQueues'][_0x2fcb70['queue']]['id'];hopperUtils[_0x981a('0xc3')](_0x9119ad)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x9119ad)[_0x981a('0x9b')](loggerCatch(_0x981a('0xc6')));}else{delete this[_0x981a('0x22')][_0x25cce3[_0x981a('0xbb')]];this[_0x981a('0xbc')](this[_0x981a('0x1a')][_0x2fcb70[_0x981a('0xba')]]);this[_0x981a('0x1a')][_0x2fcb70[_0x981a('0xba')]][_0x981a('0x138')]+=0x1;_0x40b694=new Hangup(_0x2fcb70,_0x25cce3);_0x40b694['state']=0xc;_0x40b694[_0x981a('0x6e')]=_0x25cce3[_0x981a('0x139')];_0x40b694[_0x981a('0x115')]=_0x981a('0x13a');hopperUtils[_0x981a('0xc3')](_0x40b694)[_0x981a('0x9b')](loggerCatch(_0x981a('0x132')));hopperUtils[_0x981a('0xc5')](_0x40b694)['catch'](loggerCatch(_0x981a('0x136')));}}};Dialer[_0x981a('0x82')][_0x981a('0x13b')]=function(_0x38ae54){var _0xe439af=this;if(!_0xe439af[_0x981a('0x13c')][_0x38ae54[_0x981a('0x44')]]){_0xe439af[_0x981a('0x13c')][_0x38ae54['name']]={'running':![]};}else if(_0xe439af[_0x981a('0x13c')][_0x38ae54['name']][_0x981a('0x13d')]===!![]){return;}else if(_0xe439af[_0x981a('0x13c')][_0x38ae54[_0x981a('0x44')]][_0x981a('0x13d')]===![]){_0xe439af['queuesSummary'][_0x38ae54[_0x981a('0x44')]][_0x981a('0x13d')]=!![];}var _0x70a347=_0xe439af[_0x981a('0x1a')][_0x38ae54[_0x981a('0x44')]];var _0x2572dd=_0x70a347[_0x981a('0x67')]!==utils[_0x981a('0x6b')][_0x981a('0x7c')];var _0x3bb961=utils[_0x981a('0x13e')](_0x70a347);_0x70a347['statusMessage']=utils['getQueueCampaignStatusMessage'](_0x70a347,_0xe439af[_0x981a('0x1d')]);Promise['resolve']()['then'](function(){if(_0x70a347[_0x981a('0x13f')]===utils[_0x981a('0x6b')]['INACTIVE']){if(_0x2572dd){clearPredictiveAttributes(_0x70a347);_0x38ae54[_0x981a('0x24')]=undefined;_0x38ae54[_0x981a('0x25')]=undefined;}if(_0x70a347[_0x981a('0x13f')]===utils[_0x981a('0x6b')][_0x981a('0x7c')]){_0x38ae54[_0x981a('0x140')]=0x0;_0x38ae54[_0x981a('0xf5')]=0x0;_0x38ae54[_0x981a('0x141')]=0x0;_0x38ae54[_0x981a('0x142')]=0x0;_0x38ae54[_0x981a('0x143')]=0x0;}}else if(_0x70a347[_0x981a('0x13f')]===utils[_0x981a('0x6b')][_0x981a('0x144')]&&!_0x3bb961){return _0xe439af[_0x981a('0x8c')](_0x70a347,!![])['then'](function(){return _0xe439af[_0x981a('0x8c')](_0x70a347,![]);})['then'](function(){return _0xe439af[_0x981a('0xaa')](_0x70a347);})['catch'](function(_0xf8a685){loggerSyncQueueSummary['debug'](_0x981a('0x145'),util[_0x981a('0x65')](_0xf8a685,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x70a347);});}else{clearPredictiveAttributes(_0x70a347);}})[_0x981a('0x97')](function(){var _0x59ba4e=_0x38ae54[_0x981a('0x146')](_0x70a347);if(_0x59ba4e||_0x70a347['queueSummaryCountersUpdated']){_0x70a347[_0x981a('0x147')]=![];_0x38ae54[_0x981a('0x148')](_0x70a347);Object['assign'](_0x70a347,_0x38ae54);emitOutboundVoiceQueueSummary(_0x38ae54);}_0xe439af[_0x981a('0x13c')][_0x70a347[_0x981a('0x44')]][_0x981a('0x13d')]=![];})[_0x981a('0x9b')](function(_0xa9ec99){logger[_0x981a('0x61')]('[syncQueueSummary]',util[_0x981a('0x65')](_0xa9ec99,{'showHidden':![],'depth':null}));_0xe439af[_0x981a('0x13c')][_0x70a347[_0x981a('0x44')]][_0x981a('0x13d')]=![];});};Dialer[_0x981a('0x82')][_0x981a('0x31')]=_[_0x981a('0x149')](function(){var _0x3b0cc1=_[_0x981a('0x14a')](this[_0x981a('0x1a')],function(_0x5454e4){return _0x5454e4[_0x981a('0x14b')];});var _0x2ce9e5=_[_0x981a('0x14a')](this['agents'],function(_0x424abb){return _0x424abb[_0x981a('0x14c')]&&_0x424abb[_0x981a('0x84')]==='reachable';});if(_0x3b0cc1['length']>0x0&&_0x2ce9e5[_0x981a('0x93')]>0x0){return Promise['resolve']()[_0x981a('0x97')](cmHopper[_0x981a('0x14d')](_['map'](_0x3b0cc1,'id'),previewRecallmeReminderInterval,_[_0x981a('0x14e')](_0x2ce9e5,'id')))[_0x981a('0x97')](function(_0x1fd4d7){for(var _0xed9a0d=0x0;_0xed9a0d<_0x1fd4d7[_0x981a('0x93')];_0xed9a0d++){var _0x477d35=_0x1fd4d7[_0xed9a0d]['Agent'][_0x981a('0x44')];if(_0x477d35)io['to'](util[_0x981a('0x42')]('user:%s',_0x477d35))[_0x981a('0x3e')](_0x981a('0x14f'),{'hopper':_0x1fd4d7[_0xed9a0d]});}})[_0x981a('0x9b')](function(_0x367f9f){logger[_0x981a('0x61')](_0x981a('0x150'),_0x367f9f);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x981a('0x82')][_0x981a('0x3a')]=function(){var _0x120383=this;setInterval(function(){_0x120383[_0x981a('0x151')](_0x120383[_0x981a('0x22')],_0x981a('0x152'));_0x120383[_0x981a('0x151')](_0x120383[_0x981a('0x20')],_0x981a('0x153'));},0x32c8);};Dialer[_0x981a('0x82')][_0x981a('0x151')]=function(_0x496756,_0x282f5d){var _0x3b309b=this;for(var _0x1b6a90 in _0x496756){if(typeof _0x496756[_0x1b6a90]!=='undefined'){this[_0x981a('0x18')][_0x981a('0x16')](function(){if(!_[_0x981a('0xf3')](_0x496756[_0x1b6a90])){return ami[_0x981a('0x95')]({'action':_0x981a('0x84'),'channel':_0x496756[_0x1b6a90]['channel']})[_0x981a('0x9b')](function(_0x385598){if(_0x385598[_0x981a('0x67')]===_0x981a('0x154')){setTimeout(function(){if(_0x496756[_0x1b6a90]&&_0x496756[_0x1b6a90][_0x981a('0x3f')]!==_0x981a('0xbf')){_0x3b309b['updateOriginated'](_0x3b309b[_0x981a('0x1a')][_0x496756[_0x1b6a90]['queue']]);logger[_0x981a('0x61')](_0x981a('0x155'),_0x282f5d,_0x1b6a90,_0x496756[_0x1b6a90][_0x981a('0xba')]);delete _0x496756[_0x1b6a90];}if(_0x496756[_0x1b6a90]&&_0x496756[_0x1b6a90][_0x981a('0x3f')]===_0x981a('0xbf')){_0x3b309b['updateOriginated'](_0x3b309b['campaigns'][_0x496756[_0x1b6a90][_0x981a('0xba')]]);logger['error'](_0x981a('0x156'),_0x282f5d,_0x1b6a90,_0x496756[_0x1b6a90][_0x981a('0xba')]);delete _0x496756[_0x1b6a90];}},0x2328);}});}});}}};Dialer[_0x981a('0x82')][_0x981a('0x157')]=function(_0x23e9d6){return Promise[_0x981a('0xa4')]()[_0x981a('0x97')](voiceQueueRt['getVoiceQueueRtPauses'](_0x23e9d6))[_0x981a('0x9b')](loggerCatch(_0x981a('0x158')));};Dialer[_0x981a('0x82')][_0x981a('0xbc')]=function(_0x56cc72){if(!_[_0x981a('0x3d')](_0x56cc72)&&_0x56cc72!==null){if(typeof _0x56cc72[_0x981a('0x159')]!=='undefined'){if(_0x56cc72[_0x981a('0x159')]>0x0){_0x56cc72[_0x981a('0x159')]-=0x1;}else{logger[_0x981a('0x61')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x981a('0x61')](_0x981a('0x15a'));}};Dialer[_0x981a('0x82')][_0x981a('0x15b')]=function(_0x343d94,_0x4b3167){var _0x53879c=this;return function(_0xa37e7a){_0x53879c[_0x981a('0xbc')](_0x4b3167);logger[_0x981a('0x61')](_0x343d94,util['inspect'](_0xa37e7a,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x981a('0x15c')]=function(_0x9eec79,_0x50df96,_0x5c8756){var _0xbbf30d={'state':0x19,'statedesc':'notFound'};this[_0x981a('0xbc')](_0x50df96);this['saveInDb'](_[_0x981a('0x5c')](_0xbbf30d,_[_0x981a('0x100')](_0x5c8756,['ContactId',_0x981a('0xda'),_0x981a('0x15d'),_0x981a('0x104'),_0x981a('0xe8')])),_0x981a('0x15e'),_0x981a('0x15f'));logger[_0x981a('0x61')](_0x9eec79);};Dialer[_0x981a('0x82')][_0x981a('0x119')]=function(_0x24f132,_0x19f6e6,_0x80685e){hopperUtils['createHistory'](_0x24f132)[_0x981a('0x9b')](loggerCatch(_0x19f6e6));hopperUtils['moveContactManagedDialer'](_0x24f132)[_0x981a('0x9b')](loggerCatch(_0x80685e));};Dialer['prototype'][_0x981a('0xd6')]=function(_0xc4adfe,_0x5e2353){hopperUtils[_0x981a('0xc3')](_0xc4adfe)[_0x981a('0x9b')](loggerCatch(_0x981a('0xc4')));if(_0x5e2353==0x0){hopperUtils[_0x981a('0xc5')](_0xc4adfe)['catch'](loggerCatch(_0x981a('0x160')));}};Dialer['prototype'][_0x981a('0x150')]=function(_0xed0dff){return Promise['resolve']()[_0x981a('0x97')](cmHopper[_0x981a('0x14d')](_0xed0dff['id'],previewRecallmeReminderInterval))[_0x981a('0x97')](function(_0x3ca89d){for(var _0x26f097=0x0;_0x26f097<_0x3ca89d[_0x981a('0x93')];_0x26f097++){var _0x40c794=_0x3ca89d[_0x26f097]['Agent'][_0x981a('0x44')];if(_0x40c794)io['to'](util[_0x981a('0x42')]('user:%s',_0x40c794))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x3ca89d[_0x26f097]});}})[_0x981a('0x9b')](function(){});};Dialer[_0x981a('0x82')][_0x981a('0xa8')]=function(_0x18a947){var _0x5b711a=this;return function(){_0x5b711a[_0x981a('0x161')](_0x18a947);};};Dialer[_0x981a('0x82')][_0x981a('0x162')]=function(_0x2e4516,_0x33a7dd){var _0x308eda=this;var _0x240b58=uuid['v4']();this[_0x981a('0x20')][_0x240b58]=new Action(_0x2e4516,_0x33a7dd,_0x240b58);return new Promise(function(_0x4d9105,_0x786f99){if(_[_0x981a('0x3d')](_0x2e4516)&&typeof _0x2e4516!==_0x981a('0x163')){return _0x786f99(msgResponse('originate',_0x981a('0x8d'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x33a7dd[_0x981a('0x164')])||_0x33a7dd['phone']===null){return _0x786f99(msgResponse(_0x981a('0x165'),_0x981a('0x8d'),'contact\x20is\x20undefine'));}var _0x48a07c={'XMD-CALLERID':_0x308eda['actions'][_0x240b58][_0x981a('0x166')](),'XMD-AGI':_0x2e4516['dialQueueProject']?util['format'](_0x981a('0x167'),ipAgi,_0x2e4516['dialQueueProject']):_0x981a('0x168'),'XMD-AGIAFTER':_0x2e4516['dialQueueProject2']?util[_0x981a('0x42')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2e4516[_0x981a('0x169')]):_0x981a('0x168'),'XMD-QUEUE':utils['isOutboundQueue'](_0x2e4516)?util[_0x981a('0x42')](_0x981a('0x16a'),_0x2e4516[_0x981a('0x44')],_0x2e4516[_0x981a('0x16b')]||'',_0x2e4516[_0x981a('0x16c')]?'c':'',_0x2e4516[_0x981a('0xc9')]||0x3):_0x981a('0x168'),'XMD-CONTACTID':_0x33a7dd[_0x981a('0xd9')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x308eda[_0x981a('0x20')][_0x240b58]['getCaller'](),'XMD-AMD':_0x2e4516[_0x981a('0x11b')]?_0x981a('0x144'):_0x981a('0x168'),'XMD-DESTINATION':_0x981a('0x112')};if(_0x2e4516[_0x981a('0x11b')]){_0x48a07c[_0x981a('0x16d')]=_0x2e4516[_0x981a('0x16e')]||0x9c4;_0x48a07c['XMD-AMDGREETING']=_0x2e4516[_0x981a('0x16f')]||0x5dc;_0x48a07c[_0x981a('0x170')]=_0x2e4516['dialAMDAfterGreetingSilence']||0x320;_0x48a07c[_0x981a('0x171')]=_0x2e4516[_0x981a('0x172')]||0x1388;_0x48a07c[_0x981a('0x173')]=_0x2e4516[_0x981a('0x174')]||0x64;_0x48a07c[_0x981a('0x175')]=_0x2e4516[_0x981a('0x176')]||0x32;_0x48a07c[_0x981a('0x177')]=_0x2e4516[_0x981a('0x178')]||0x3;_0x48a07c['XMD-AMDSILENCETHRESHOLD']=_0x2e4516['dialAMDSilenceThreshold']||0x100;_0x48a07c[_0x981a('0x179')]=_0x2e4516[_0x981a('0x17a')]||0x1388;}if(utils['isOutboundQueue'](_0x2e4516)){_0x48a07c[_0x981a('0x17b')]=_0x33a7dd[_0x981a('0x104')];}else{_0x48a07c[_0x981a('0x17c')]=_0x33a7dd['CampaignId'];}var _0x2dc3fc=utils[_0x981a('0x17d')](_0x33a7dd[_0x981a('0x17e')]);Object[_0x981a('0x17f')](_0x48a07c,_0x2dc3fc);var _0x3d086d=_0x308eda[_0x981a('0x86')](_0x2e4516[_0x981a('0x180')])?utils[_0x981a('0x181')](_0x2e4516['Trunk'][_0x981a('0x182')],_0x2e4516[_0x981a('0x183')],_0x2e4516[_0x981a('0x184')]>0x0?utils['getCallerIdRandom'](_0x2e4516[_0x981a('0x185')],_0x2e4516[_0x981a('0x184')]):_0x2e4516[_0x981a('0x185')]):utils[_0x981a('0x181')](_[_0x981a('0xf3')](_0x2e4516['TrunkBackup'])?_0x2e4516[_0x981a('0x180')][_0x981a('0x182')]:_0x2e4516[_0x981a('0x87')][_0x981a('0x182')],_0x2e4516[_0x981a('0x183')],_0x2e4516[_0x981a('0x184')]>0x0?utils[_0x981a('0x186')](_0x2e4516[_0x981a('0x185')],_0x2e4516[_0x981a('0x184')]):_0x2e4516[_0x981a('0x185')]);if(_0x3d086d){_0x48a07c[_0x981a('0x187')]=_0x308eda[_0x981a('0x20')][_0x240b58]['originatecalleridname']=utils[_0x981a('0x188')](_0x3d086d);_0x48a07c[_0x981a('0x189')]=_0x33a7dd[_0x981a('0x164')];}_0x2e4516[_0x981a('0x18a')]=_0x48a07c;return ami[_0x981a('0x95')]({'actionid':_0x240b58,'action':_0x981a('0x165'),'channel':_0x308eda[_0x981a('0x86')](_0x2e4516[_0x981a('0x180')])?util[_0x981a('0x42')]('SIP/%s/%s%s',_0x2e4516[_0x981a('0x180')][_0x981a('0x44')],isNotNull(_0x2e4516[_0x981a('0x18b')])?_0x2e4516[_0x981a('0x18b')]['trim']()||'':'',_0x2e4516[_0x981a('0x18c')]>0x0?_0x33a7dd[_0x981a('0x164')][_0x981a('0x18d')](_0x2e4516[_0x981a('0x18c')]):_0x33a7dd[_0x981a('0x164')]):util[_0x981a('0x42')](_0x981a('0x18e'),_[_0x981a('0xf3')](_0x2e4516[_0x981a('0x87')])?_0x2e4516['Trunk'][_0x981a('0x44')]:_0x2e4516[_0x981a('0x87')][_0x981a('0x44')],isNotNull(_0x2e4516[_0x981a('0x18b')])?_0x2e4516[_0x981a('0x18b')]['trim']()||'':'',_0x2e4516['dialCutDigit']>0x0?_0x33a7dd[_0x981a('0x164')]['substring'](_0x2e4516['dialCutDigit']):_0x33a7dd[_0x981a('0x164')]),'callerid':_0x3d086d,'Exten':_0x981a('0x112'),'Context':_0x981a('0x18f'),'Priority':'1','variable':_0x48a07c,'timeout':(_0x2e4516[_0x981a('0x190')]||0x1e)*0x3e8,'async':!![],'channelid':_0x240b58})['then'](function(_0x5e8050){return _0x4d9105(_0x5e8050);})[_0x981a('0x9b')](function(_0xcfc971){_0x2e4516[_0x981a('0x191')]+=0x1;var _0x43ef6c=new History(_0x308eda[_0x981a('0x20')][_0x240b58]);logger[_0x981a('0x61')](util[_0x981a('0x42')](_0x981a('0x192'),JSON['stringify'](_0xcfc971)));_0x43ef6c[_0x981a('0xcc')]=0xe;_0x43ef6c[_0x981a('0x6e')]=_0x981a('0x193');_0x43ef6c[_0x981a('0xdd')]=moment()[_0x981a('0x42')](_0x981a('0xbe'));_0x43ef6c[_0x981a('0x6f')]=_0x43ef6c['starttime'];hopperUtils[_0x981a('0xc3')](_0x43ef6c)[_0x981a('0x9b')](loggerCatch(_0x981a('0x194')));_0x308eda[_0x981a('0xc5')](_0x43ef6c)[_0x981a('0x9b')](loggerCatch(_0x981a('0x194')))[_0x981a('0xfa')](function(){delete _0x308eda[_0x981a('0x20')][_0x240b58];return _0x786f99(msgResponse(_0x981a('0x165'),_0x981a('0x81'),_0x981a('0x195')));});});});};Dialer[_0x981a('0x82')][_0x981a('0x196')]=function(_0x2d8004,_0x2047d5,_0x2dca2e){var _0x2bdfc1=new History(_0x2047d5);if(_0x2bdfc1[_0x981a('0x120')]+_0x2bdfc1[_0x981a('0x121')]+_0x2bdfc1[_0x981a('0x122')]+_0x2bdfc1[_0x981a('0x123')]+_0x2bdfc1['countdropretry']+_0x2bdfc1['countabandonedretry']+_0x2bdfc1[_0x981a('0x124')]+_0x2bdfc1[_0x981a('0x125')]>=_0x2dca2e[_0x981a('0x126')]-0x1){return!![];}switch(_0x2d8004){case 0x3:if(_0x2bdfc1['countnoanswerretry']>=_0x2dca2e[_0x981a('0x197')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x2bdfc1[_0x981a('0x122')]+=0x1,'scheduledat':moment()[_0x981a('0xd7')](_0x2dca2e[_0x981a('0x198')],'minutes')['format'](_0x981a('0xbe')),'ContactId':_0x2bdfc1['ContactId'],'ListId':_0x2bdfc1[_0x981a('0xda')],'VoiceQueueId':_0x2bdfc1['VoiceQueueId']||undefined,'CampaignId':_0x2bdfc1[_0x981a('0xe8')]||undefined})['catch'](loggerCatch(_0x981a('0x199')));break;case 0x5:if(_0x2bdfc1[_0x981a('0x120')]>=_0x2dca2e['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x981a('0xe7')]({'active':![],'countbusyretry':_0x2bdfc1[_0x981a('0x120')]+=0x1,'scheduledat':moment()[_0x981a('0xd7')](_0x2dca2e[_0x981a('0x19a')],_0x981a('0xd8'))[_0x981a('0x42')](_0x981a('0xbe')),'ContactId':_0x2bdfc1[_0x981a('0xd9')],'ListId':_0x2bdfc1[_0x981a('0xda')],'VoiceQueueId':_0x2bdfc1[_0x981a('0x104')]||undefined,'CampaignId':_0x2bdfc1[_0x981a('0xe8')]||undefined})[_0x981a('0x9b')](loggerCatch(_0x981a('0x19b')));break;case 0x8:if(_0x2bdfc1[_0x981a('0x121')]>=_0x2dca2e[_0x981a('0x19c')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x2bdfc1[_0x981a('0x121')]+=0x1,'scheduledat':moment()['add'](_0x2dca2e[_0x981a('0x19d')],_0x981a('0xd8'))[_0x981a('0x42')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2bdfc1[_0x981a('0xd9')],'ListId':_0x2bdfc1[_0x981a('0xda')],'VoiceQueueId':_0x2bdfc1[_0x981a('0x104')]||undefined,'CampaignId':_0x2bdfc1[_0x981a('0xe8')]||undefined})[_0x981a('0x9b')](loggerCatch(_0x981a('0x19e')));break;case 0x0:if(_0x2bdfc1[_0x981a('0x123')]>=_0x2dca2e[_0x981a('0x19f')]-0x1){return!![];}else{hopperUtils[_0x981a('0xe7')]({'active':![],'countnosuchnumberretry':_0x2bdfc1[_0x981a('0x123')]+=0x1,'scheduledat':moment()[_0x981a('0xd7')](_0x2dca2e['dialNoSuchNumberRetryFrequency'],_0x981a('0xd8'))[_0x981a('0x42')](_0x981a('0xbe')),'ContactId':_0x2bdfc1[_0x981a('0xd9')],'ListId':_0x2bdfc1[_0x981a('0xda')],'VoiceQueueId':_0x2bdfc1[_0x981a('0x104')]||undefined,'CampaignId':_0x2bdfc1[_0x981a('0xe8')]||undefined})['catch'](loggerCatch(_0x981a('0x1a0')));}break;case 0xa:if(_0x2bdfc1[_0x981a('0xcf')]>=_0x2dca2e[_0x981a('0xd5')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x2bdfc1[_0x981a('0xcf')]+=0x1,'scheduledat':moment()[_0x981a('0xd7')](_0x2dca2e[_0x981a('0xd0')],_0x981a('0xd8'))[_0x981a('0x42')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2bdfc1[_0x981a('0xd9')],'ListId':_0x2bdfc1[_0x981a('0xda')],'VoiceQueueId':_0x2bdfc1[_0x981a('0x104')]||undefined,'CampaignId':_0x2bdfc1['CampaignId']||undefined})['catch'](loggerCatch(_0x981a('0xdb')));break;case 0xb:if(_0x2bdfc1[_0x981a('0xe3')]>=_0x2dca2e['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0x981a('0xe7')]({'active':![],'countabandonedretry':_0x2bdfc1[_0x981a('0xe3')]+=0x1,'scheduledat':moment()['add'](_0x2dca2e['dialAbandonedRetryFrequency'],_0x981a('0xd8'))['format'](_0x981a('0xbe')),'ContactId':_0x2bdfc1[_0x981a('0xd9')],'ListId':_0x2bdfc1[_0x981a('0xda')],'VoiceQueueId':_0x2bdfc1[_0x981a('0x104')]||undefined,'CampaignId':_0x2bdfc1[_0x981a('0xe8')]||undefined})['catch'](loggerCatch(_0x981a('0xe9')));break;case 0x13:if(_0x2bdfc1['countmachineretry']>=_0x2dca2e[_0x981a('0x129')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x2bdfc1['countmachineretry']+=0x1,'scheduledat':moment()[_0x981a('0xd7')](_0x2dca2e[_0x981a('0x130')],'minutes')[_0x981a('0x42')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2bdfc1[_0x981a('0xd9')],'ListId':_0x2bdfc1[_0x981a('0xda')],'VoiceQueueId':_0x2bdfc1[_0x981a('0x104')]||undefined,'CampaignId':_0x2bdfc1[_0x981a('0xe8')]||undefined})[_0x981a('0x9b')](loggerCatch(_0x981a('0x12b')));break;case 0x14:if(_0x2bdfc1['countagentrejectretry']>=_0x2dca2e['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x981a('0xe7')]({'active':![],'countagentrejectretry':_0x2bdfc1['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x981a('0xd7')](_0x2dca2e[_0x981a('0x1a1')],'minutes')[_0x981a('0x42')](_0x981a('0xbe')),'ContactId':_0x2bdfc1[_0x981a('0xd9')],'ListId':_0x2bdfc1[_0x981a('0xda')],'VoiceQueueId':_0x2bdfc1['VoiceQueueId']||undefined,'CampaignId':_0x2bdfc1[_0x981a('0xe8')]||undefined})[_0x981a('0x9b')](loggerCatch(_0x981a('0x1a2')));break;default:return!![];}};Dialer[_0x981a('0x82')][_0x981a('0x10c')]=function(_0x5b623e,_0x2b80f1,_0x9c017d){var _0x118f44=this;var _0x8d5ea7=new History(_0x5b623e);var _0x3b4b2c=![];var _0x572516;var _0x270169;return new Promise(function(_0x318291,_0x10a82b){if(_[_0x981a('0x3d')](_0x2b80f1)&&typeof _0x2b80f1!==_0x981a('0x163')){return _0x10a82b(msgResponse(_0x981a('0x1a3'),_0x981a('0x8d'),_0x981a('0x1a4')));}if(_[_0x981a('0x3d')](_0x9c017d)&&typeof _0x9c017d!=='object'){return _0x10a82b(msgResponse(_0x981a('0x1a3'),_0x981a('0x8d'),_0x981a('0x1a5')));}hopperUtils[_0x981a('0xd2')](_0x8d5ea7,_0x9c017d['reason'],_0x2b80f1)[_0x981a('0x97')](function(_0x26454e){if(_0x26454e[_0x981a('0xd4')]==0x1)_0x3b4b2c=!![];switch(_0x9c017d[_0x981a('0xc1')]){case'0':_0x2b80f1[_0x981a('0x1a6')]+=0x1;_0x8d5ea7[_0x981a('0xcc')]=0x0;_0x8d5ea7[_0x981a('0x6e')]=_0x981a('0x1a7');_0x8d5ea7[_0x981a('0x123')]+=0x1;_0x8d5ea7[_0x981a('0xe4')]+=0x1;ami[_0x981a('0x3e')](_0x981a('0x1a8'),ut[_0x981a('0x117')](_0x5b623e,'nosuchnumber'));_0x572516=_0x2b80f1[_0x981a('0x1a9')];_0x270169=_0x2b80f1[_0x981a('0xd1')];hopperUtils['createHistory'](_0x8d5ea7)['catch'](loggerCatch(_0x981a('0x11f')));if(_0x118f44['checkRetriveMax'](0x0,_0x5b623e,_0x2b80f1)&&!_0x3b4b2c){if(_0x8d5ea7[_0x981a('0x123')]>=_0x2b80f1[_0x981a('0x19f')]){_0x118f44[_0x981a('0x12a')](_0x8d5ea7,_0x318291,_0x10a82b,_0x981a('0x1aa'));}else{_0x118f44['stateGlobal'](_0x8d5ea7,_0x318291,_0x10a82b,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x2b80f1[_0x981a('0x1ab')]+=0x1;_0x8d5ea7[_0x981a('0xcc')]=0x3;_0x8d5ea7[_0x981a('0x6e')]='NoAnswer';_0x8d5ea7[_0x981a('0x122')]+=0x1;_0x8d5ea7[_0x981a('0xe4')]+=0x1;var _0xf6cdd=ut[_0x981a('0x1ac')](_0x5b623e,_0x2b80f1);ami[_0x981a('0x3e')]('custom:agentnoanswer',_0xf6cdd);_0x572516=_0x2b80f1['dialNoAnswerRetryFrequency'];_0x270169=_0x2b80f1[_0x981a('0xd1')];hopperUtils['createHistory'](_0x8d5ea7)['catch'](loggerCatch(_0x981a('0x1ad')));if(_0x118f44[_0x981a('0x196')](0x3,_0x5b623e,_0x2b80f1)&&!_0x3b4b2c){if(_0x8d5ea7[_0x981a('0x122')]>=_0x2b80f1[_0x981a('0x197')]){_0x118f44[_0x981a('0x12a')](_0x8d5ea7,_0x318291,_0x10a82b,_0x981a('0x1ae'));}else{_0x118f44[_0x981a('0x127')](_0x8d5ea7,_0x318291,_0x10a82b,_0x981a('0x1ae'));}}break;case'5':_0x2b80f1[_0x981a('0x1af')]+=0x1;_0x8d5ea7[_0x981a('0xcc')]=0x5;_0x8d5ea7[_0x981a('0x6e')]='Busy';_0x8d5ea7[_0x981a('0x120')]+=0x1;_0x8d5ea7[_0x981a('0xe4')]+=0x1;ami[_0x981a('0x3e')](_0x981a('0x1b0'),ut[_0x981a('0x117')](_0x5b623e,_0x981a('0x1b1')));_0x572516=_0x2b80f1[_0x981a('0x19a')];_0x270169=_0x2b80f1[_0x981a('0xd1')];hopperUtils[_0x981a('0xc3')](_0x8d5ea7)[_0x981a('0x9b')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x118f44[_0x981a('0x196')](0x5,_0x5b623e,_0x2b80f1)&&!_0x3b4b2c){if(_0x8d5ea7[_0x981a('0x120')]>=_0x2b80f1[_0x981a('0x1b2')]){_0x118f44[_0x981a('0x12a')](_0x8d5ea7,_0x318291,_0x10a82b,_0x981a('0x1b3'));}else{_0x118f44[_0x981a('0x127')](_0x8d5ea7,_0x318291,_0x10a82b,'reason\x205\x20busy');}}break;case'8':_0x2b80f1[_0x981a('0x1b4')]+=0x1;_0x8d5ea7['state']=0x8;_0x8d5ea7['statedesc']=_0x981a('0x1b5');_0x8d5ea7[_0x981a('0x121')]+=0x1;_0x8d5ea7[_0x981a('0xe4')]+=0x1;_0x572516=_0x2b80f1[_0x981a('0x19d')];_0x270169=_0x2b80f1[_0x981a('0xd1')];ami['emit'](_0x981a('0x1b6'),ut[_0x981a('0x117')](_0x5b623e,'congestion'));hopperUtils[_0x981a('0xc3')](_0x8d5ea7)[_0x981a('0x9b')](loggerCatch(_0x981a('0x1b7')));if(_0x118f44[_0x981a('0x196')](0x8,_0x5b623e,_0x2b80f1)&&!_0x3b4b2c){if(_0x8d5ea7[_0x981a('0x121')]>=_0x2b80f1[_0x981a('0x19c')]){_0x118f44[_0x981a('0x12a')](_0x8d5ea7,_0x318291,_0x10a82b,_0x981a('0x1b8'));}else{_0x118f44['stateGlobal'](_0x8d5ea7,_0x318291,_0x10a82b,_0x981a('0x1b8'));}}break;case'11':_0x2b80f1[_0x981a('0x1b9')]+=0x1;_0x8d5ea7[_0x981a('0xcc')]=0xb;_0x8d5ea7[_0x981a('0x6e')]='Abandoned';_0x8d5ea7[_0x981a('0xe3')]+=0x1;_0x8d5ea7[_0x981a('0xe4')]+=0x1;_0x572516=_0x2b80f1[_0x981a('0xe5')];_0x270169=_0x2b80f1['callAdditionalPhoneAfterMin'];hopperUtils[_0x981a('0xc3')](_0x8d5ea7)['catch'](loggerCatch(_0x981a('0xeb')));if(_0x118f44[_0x981a('0x196')](0xb,_0x5b623e,_0x2b80f1)&&!_0x3b4b2c){if(_0x8d5ea7[_0x981a('0xe3')]>=_0x2b80f1['dialAbandonedMaxRetry']){_0x118f44[_0x981a('0x12a')](_0x8d5ea7,_0x318291,_0x10a82b,_0x981a('0x1ba'));}else{_0x118f44[_0x981a('0x127')](_0x8d5ea7,_0x318291,_0x10a82b,'reason\x2011\x20abandoned');}}break;case'20':_0x2b80f1[_0x981a('0x1bb')]+=0x1;_0x8d5ea7['state']=0x14;_0x8d5ea7[_0x981a('0x6e')]=_0x981a('0x1bc');_0x8d5ea7[_0x981a('0x125')]+=0x1;_0x8d5ea7[_0x981a('0xe4')]+=0x1;_0x572516=_0x2b80f1[_0x981a('0x1a1')];_0x270169=_0x2b80f1['callAdditionalPhoneAfterMin'];ami['emit'](_0x981a('0x1bd'),ut['buildObj'](_0x5b623e,_0x981a('0x1be')));hopperUtils[_0x981a('0xc3')](_0x8d5ea7)[_0x981a('0x9b')](loggerCatch(_0x981a('0x1bf')));if(_0x118f44[_0x981a('0x196')](0x14,_0x5b623e,_0x2b80f1)&&!_0x3b4b2c){if(_0x8d5ea7[_0x981a('0x125')]>=_0x2b80f1[_0x981a('0x1c0')]){_0x118f44[_0x981a('0x12a')](_0x8d5ea7,_0x318291,_0x10a82b,_0x981a('0x1c1'));}else{_0x118f44[_0x981a('0x127')](_0x8d5ea7,_0x318291,_0x10a82b,_0x981a('0x1c1'));}}break;default:_0x2b80f1[_0x981a('0x138')]+=0x1;_0x8d5ea7[_0x981a('0xcc')]=0xc;_0x8d5ea7[_0x981a('0x6e')]=_0x9c017d[_0x981a('0xc1')];_0x572516=_0x2b80f1[_0x981a('0x1a1')];_0x270169=_0x2b80f1[_0x981a('0xd1')];hopperUtils[_0x981a('0xc3')](_0x8d5ea7)[_0x981a('0x9b')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x118f44['checkRetriveMax'](_0x9c017d['reason'],_0x5b623e,_0x2b80f1)&&!_0x3b4b2c){if(_0x8d5ea7['countbusyretry']+_0x8d5ea7[_0x981a('0x121')]+_0x8d5ea7[_0x981a('0x122')]+_0x8d5ea7[_0x981a('0x123')]+_0x8d5ea7[_0x981a('0xcf')]+_0x8d5ea7[_0x981a('0xe3')]+_0x8d5ea7[_0x981a('0x124')]+_0x8d5ea7[_0x981a('0x125')]>=_0x2b80f1[_0x981a('0x126')]){_0x118f44[_0x981a('0x127')](_0x8d5ea7,_0x318291,_0x10a82b,_0x9c017d['reason']);}else{_0x118f44[_0x981a('0x12a')](_0x8d5ea7,_0x318291,_0x10a82b,_0x9c017d[_0x981a('0xc1')]);}}}})[_0x981a('0x97')](function(){if(_0x3b4b2c){hopperUtils[_0x981a('0xec')](_0x8d5ea7,_0x572516,_0x270169)[_0x981a('0x97')](function(){return _0x318291(0x1);});}});});};Dialer[_0x981a('0x82')][_0x981a('0x127')]=function(_0x19eefe,_0x4f5fc8,_0x4af717,_0x3a3e28){var _0x30eefd=new Final(_0x19eefe);_0x30eefd['state']=0xf;_0x30eefd['statedesc']=_0x981a('0x1c2');this[_0x981a('0x12a')](_0x30eefd,_0x4f5fc8,_0x4af717,_0x3a3e28);};Dialer[_0x981a('0x82')][_0x981a('0x12a')]=function(_0x4af928,_0x366752,_0xd17313,_0x48a27d){hopperUtils['moveContactManagedDialer'](_0x4af928)[_0x981a('0x97')](function(){return _0x366752(msgResponse('[callProgressDetecting]',_0x981a('0x10b'),_0x48a27d));})['catch'](function(){return _0xd17313(msgResponse('[moveContactManagedDialer][0]','Failure',_0x981a('0x1c3')));});};Dialer[_0x981a('0x82')][_0x981a('0xa')]=function(_0x28387f){var _0x15b750=_0x28387f['dialPredictiveOptimizationPercentage']/0x64;var _0x3fd93d=_0x28387f[_0x981a('0xca')]/(_0x28387f[_0x981a('0xca')]+_0x28387f[_0x981a('0xc0')]);var _0x358f05=Math[_0x981a('0x1c4')](_0x28387f[_0x981a('0x1c5')]*(_0x28387f['predictiveIntervalMaxThreshold']/0x64));var _0x37c43d=Math[_0x981a('0x1c4')](_0x28387f[_0x981a('0x1c5')]*(_0x28387f[_0x981a('0x1c6')]/0x64));var _0x4df7b7=_0x28387f[_0x981a('0x140')]+_0x28387f[_0x981a('0x142')];var _0x53dbac=Math[_0x981a('0x1c7')](_0x28387f[_0x981a('0x57')]*_0x28387f[_0x981a('0x59')]*_0x28387f[_0x981a('0x1c8')]*_0x28387f[_0x981a('0x1c9')]);if(_['isUndefined'](_0x28387f[_0x981a('0x25')])){if(!_['isUndefined'](_0x28387f[_0x981a('0x24')])){_0x28387f[_0x981a('0x24')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x981a('0x1ca'));}if(!_[_0x981a('0x3d')](_0x28387f['handlePredictive'])){loggerPredictive['error'](_0x981a('0x1cb'),_0x981a('0x1cc'));clearInterval(_0x28387f[_0x981a('0x1cd')]);_0x28387f[_0x981a('0x1cd')]=undefined;}_0x28387f['startProgressive']=moment()['format'](_0x981a('0xbe'));loggerPredictive[_0x981a('0x47')](_0x28387f['name'],_0x981a('0x1ce'),_0x28387f['startProgressive']);this[_0x981a('0xad')](_0x28387f,0x1);}else if(ifInterval(_0x28387f[_0x981a('0x1cf')],_0x28387f[_0x981a('0x25')])){this[_0x981a('0xad')](_0x28387f,0x1);loggerPredictiveCalls[_0x981a('0x47')](_0x981a('0x1d0'),_0x28387f[_0x981a('0x25')],_0x28387f[_0x981a('0x44')]);_0x28387f[_0x981a('0x57')]=0x0;_0x28387f[_0x981a('0xcb')]=0x0;}else if(_0x15b750<_0x3fd93d&&_0x28387f[_0x981a('0x1d1')]===_0x981a('0x1d2')){clearPredictiveAttributes(_0x28387f);loggerPredictive['info'](_0x981a('0x1d3'),_0x981a('0x1d4'),_0x3fd93d,_0x981a('0x25'),_0x28387f[_0x981a('0x44')]);}else if(_0x53dbac<_0x28387f[_0x981a('0xcb')]&&_0x28387f[_0x981a('0x1d1')]===_0x981a('0x1d2')){clearPredictiveAttributes(_0x28387f);loggerPredictive[_0x981a('0x47')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x981a('0x1d5'),_0x53dbac,_0x981a('0x1d6'),_0x28387f['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x28387f[_0x981a('0x44')]);}else if(!ifInterval(_0x28387f[_0x981a('0x1cf')],_0x28387f[_0x981a('0x25')])&&_['isUndefined'](_0x28387f[_0x981a('0x24')])&&!_['isUndefined'](_0x28387f[_0x981a('0x25')])){_0x28387f[_0x981a('0x24')]=moment()[_0x981a('0x42')](_0x981a('0xbe'));loggerPredictive['info'](_0x28387f['name'],_0x981a('0x1d7'),_0x28387f[_0x981a('0x24')]);hopperUtils[_0x981a('0x1d8')](_0x28387f['dialPredictiveInterval'])[_0x981a('0x97')](this[_0x981a('0x1d9')](_0x28387f))['then'](mergeDataErlangB(_0x28387f))['then'](this[_0x981a('0x1da')](_0x28387f))[_0x981a('0x9b')](loggerCatchPredictive(_0x981a('0x1db'),_0x28387f));}else if(!ifInterval(_0x28387f[_0x981a('0x1cf')],_0x28387f[_0x981a('0x24')])){_0x28387f[_0x981a('0xcb')]=0x0;_0x28387f[_0x981a('0x24')]=moment()[_0x981a('0x42')](_0x981a('0xbe'));loggerPredictive[_0x981a('0x47')](_0x28387f['name'],_0x981a('0x1dc'),_0x28387f[_0x981a('0x24')]);clearInterval(_0x28387f[_0x981a('0x1cd')]);_0x28387f[_0x981a('0x1cd')]=undefined;hopperUtils['avgHandleTime'](_0x28387f[_0x981a('0x1cf')])[_0x981a('0x97')](this[_0x981a('0x1d9')](_0x28387f))[_0x981a('0x97')](mergeDataErlangB(_0x28387f))[_0x981a('0x97')](this[_0x981a('0x1da')](_0x28387f))[_0x981a('0x9b')](loggerCatchPredictive(_0x981a('0x1dd'),_0x28387f));}else if(_0x28387f[_0x981a('0x1c5')]&&_0x4df7b7<_0x28387f['predictiveIntervalAvailable']-_0x37c43d){clearPredictiveAttributes(_0x28387f);loggerPredictive[_0x981a('0x47')](_0x28387f['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x4df7b7,')\x20are\x20less\x20than\x20threshold\x20(',_0x28387f[_0x981a('0x1c5')],'-',_0x37c43d,'=',_0x28387f[_0x981a('0x1c5')]-_0x37c43d,')');}else if(_0x28387f['predictiveIntervalAvailable']&&_0x4df7b7>_0x28387f[_0x981a('0x1c5')]+_0x358f05){clearPredictiveAttributes(_0x28387f);loggerPredictive[_0x981a('0x47')](_0x28387f['name'],_0x981a('0x1de'),_0x4df7b7,_0x981a('0x1df'),_0x28387f[_0x981a('0x1c5')],'+',_0x358f05,'=',_0x28387f[_0x981a('0x1c5')]+_0x358f05,')');}};Dialer[_0x981a('0x82')][_0x981a('0x1d9')]=function(_0x26f709){var _0x8c769f=this;return function(_0x46f9f9){return new Promise(function(_0x5e6a44,_0x402d78){_[_0x981a('0x5c')](_0x26f709,_0x46f9f9[0x0]);if(checkGetDataPredictive(_0x46f9f9[0x0])){var _0x164fbf=_0x26f709[_0x981a('0x1c5')]=_0x26f709[_0x981a('0x142')]+_0x26f709[_0x981a('0x140')];var _0x3378fe=_0x26f709['dialPredictiveInterval']*0x3c;var _0x3da800=_0x46f9f9[0x0][_0x981a('0x53')]+_0x46f9f9[0x0]['predictiveIntervalAvgHoldtime'];var _0xcc183b=(_0x46f9f9[0x0]['predictiveIntervalAnsweredCalls']+_0x46f9f9[0x0][_0x981a('0x4c')]+_0x46f9f9[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x46f9f9[0x0][_0x981a('0x52')];_0x26f709[_0x981a('0x1c8')]=_0xcc183b>0x0?_0xcc183b:0x1;switch(_0x26f709[_0x981a('0x1d1')]){case _0x981a('0x1d2'):var _0x57d739=_0x26f709['dialPredictiveOptimizationPercentage']/0x64;return _0x8c769f[_0x981a('0x1e0')](_0x164fbf,_0x3378fe,_0x3da800,_0xcc183b,_0x57d739)[_0x981a('0x97')](function(_0x3e9e9b){return _0x5e6a44(_0x3e9e9b);});case _0x981a('0x1e1'):var _0x1fcaf6=_0x26f709[_0x981a('0x1e2')]/0x64;return _0x8c769f['busyFactor'](_0x164fbf,_0x3378fe,_0x3da800,_0xcc183b,_0x1fcaf6)[_0x981a('0x97')](function(_0x46b085){return _0x5e6a44(_0x46b085);});default:return _0x402d78(msgResponse(_0x981a('0x1e3'),_0x981a('0x8d'),_0x981a('0x1e4')));}}else{return _0x402d78(msgResponse(_0x981a('0x1e3'),_0x981a('0x8d'),_0x981a('0x1e5')));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0x4cd201){var _0x4fa6cf=this;return function(_0x153746){return new Promise(function(_0x166e60,_0x4651e7){_['merge'](_0x4cd201,_0x153746[0x0]);if(checkGetDataPredictive(_0x153746[0x0])){loggerPredictive[_0x981a('0x47')](JSON[_0x981a('0x73')](_0x153746[0x0]));if(_0x4cd201[_0x981a('0x1d1')]===_0x981a('0x1d2')){return _0x4fa6cf['getVoiceQueueRtPauses'](_0x4cd201['id'])[_0x981a('0x97')](function(_0x3f3039){var _0x2ab00c=_0x4cd201[_0x981a('0x1e6')]-_0x3f3039[0x0][_0x981a('0x1e7')];var _0x1adc97=_0x4cd201[_0x981a('0x1cf')]*0x3c;var _0x3051e0=_0x153746[0x0][_0x981a('0x53')]+_0x153746[0x0][_0x981a('0x50')];var _0x1965ca=(_0x153746[0x0][_0x981a('0x4a')]+_0x153746[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x153746[0x0][_0x981a('0x4e')])/_0x153746[0x0][_0x981a('0x52')];var _0x593bb2=_0x4cd201['dialPredictiveOptimizationPercentage']/0x64;_0x4cd201[_0x981a('0x1e8')]=_0x3f3039[0x0][_0x981a('0x1e7')]||0x0;_0x4cd201['predictiveIntervalHitRate']=_0x1965ca>0x0?_0x1965ca:0x1;return _0x4fa6cf['abandonmentRate'](_0x2ab00c,_0x1adc97,_0x3051e0,_0x1965ca,_0x593bb2);})[_0x981a('0x97')](function(_0xb78c83){return _0x166e60(_0xb78c83);})[_0x981a('0x9b')](function(_0x524b0e){return _0x4651e7(msgResponse('[CatchErlangB]',_0x981a('0x8d'),JSON['stringify'](_0x524b0e)));});}if(_0x4cd201[_0x981a('0x1d1')]==='agentBusyFactor'){return _0x4fa6cf[_0x981a('0x157')](_0x4cd201['id'])[_0x981a('0x97')](function(_0x3d8fae){var _0x21c9db=_0x4cd201[_0x981a('0x1e6')]-_0x3d8fae[0x0][_0x981a('0x1e7')];var _0x45a1c1=_0x4cd201['dialPredictiveInterval']*0x3c;var _0x1cc28c=_0x153746[0x0][_0x981a('0x53')]+_0x153746[0x0][_0x981a('0x50')];var _0x6091b6=(_0x153746[0x0]['predictiveIntervalAnsweredCalls']+_0x153746[0x0][_0x981a('0x4c')]+_0x153746[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x153746[0x0][_0x981a('0x52')];var _0xad7e77=_0x4cd201[_0x981a('0x1e2')]/0x64;_0x4cd201[_0x981a('0x1e8')]=_0x3d8fae[0x0][_0x981a('0x1e7')]||0x0;_0x4cd201[_0x981a('0x1c8')]=_0x6091b6>0x0?_0x6091b6:0x1;return _0x4fa6cf[_0x981a('0x1e9')](_0x21c9db,_0x45a1c1,_0x1cc28c,_0x6091b6,_0xad7e77);})[_0x981a('0x97')](function(_0x2918f2){return _0x166e60(_0x2918f2);})['catch'](function(_0x129edf){return _0x4651e7(msgResponse(_0x981a('0x1ea'),_0x981a('0x8d'),JSON[_0x981a('0x73')](_0x129edf)));});}}else{return _0x4651e7(msgResponse(_0x981a('0x1e3'),_0x981a('0x8d'),'check\x20failure'));}});};};Dialer[_0x981a('0x82')][_0x981a('0x1da')]=function(_0x4dd352){var _0x79b4f5=this;return function(){var _0x489c95=0x0;var _0x155b2e=Math[_0x981a('0x1c7')](_0x4dd352[_0x981a('0x58')]*0x3e8);if(_0x155b2e>0x0){_0x155b2e=_0x155b2e<0x64?0x64:_0x155b2e;loggerPredictive[_0x981a('0x47')](_0x4dd352[_0x981a('0x44')],_0x981a('0x1eb'),_0x155b2e,'milliseconds');_0x4dd352['handlePredictive']=setInterval(function(){_0x79b4f5[_0x981a('0x1cd')](_0x4dd352);loggerPredictiveCalls[_0x981a('0x47')](_0x981a('0x1ec'),_0x489c95+=0x1);},_0x155b2e);}else{loggerPredictive[_0x981a('0x47')](_0x4dd352['name'],_0x981a('0x1ed'));}};};Dialer[_0x981a('0x82')][_0x981a('0x1ee')]=function(_0x451524,_0x323f69){var _0x2aa2d8=this;return function(_0x3f18e8){if(_['isEmpty'](_0x3f18e8)){if(_[_0x981a('0xf3')](_0x323f69[_0x981a('0x15d')])||!_0x323f69[_0x981a('0x1ef')]){if(_0x451524[_0x981a('0xab')]===_0x981a('0x9')){_0x451524[_0x981a('0x70')]=_[_0x981a('0x3d')](_0x451524[_0x981a('0x70')])?!![]:_0x451524[_0x981a('0x70')];var _0x1b6610=uuid['v4']();_0x2aa2d8[_0x981a('0x20')][_0x1b6610]=new Action(_0x451524,_0x323f69,_0x1b6610);loggerBooked[_0x981a('0x47')](_0x981a('0x1f0'),_0x1b6610,_0x981a('0x1f1'),JSON[_0x981a('0x73')](_0x451524[_0x981a('0x70')]),_0x981a('0x1f2'),_0x451524[_0x981a('0x44')]);if(_0x451524['queueStatusComplete']){_0x451524[_0x981a('0x70')]=![];_0x2aa2d8['queueBooked'][_0x2aa2d8['actions'][_0x1b6610][_0x981a('0xba')]]=[];ami[_0x981a('0x95')]({'actionid':_0x1b6610,'action':_0x981a('0x1f3'),'queue':_0x451524[_0x981a('0x44')]})[_0x981a('0x9b')](function(){_0x2aa2d8['updateOriginated'](_0x451524);hopperUtils[_0x981a('0xe7')]({'active':![],'ContactId':_0x2aa2d8[_0x981a('0x20')][_0x1b6610]['ContactId'],'ListId':_0x2aa2d8[_0x981a('0x20')][_0x1b6610]['ListId'],'VoiceQueueId':_0x2aa2d8[_0x981a('0x20')][_0x1b6610]['VoiceQueueId']||undefined,'CampaignId':_0x2aa2d8[_0x981a('0x20')][_0x1b6610][_0x981a('0xe8')]||undefined})['catch'](loggerCatch(_0x981a('0x1f4')));delete _0x2aa2d8['actions'][_0x1b6610];});}else{loggerBooked[_0x981a('0x47')](_0x981a('0x1f5'),JSON[_0x981a('0x73')](_0x451524[_0x981a('0x70')]),_0x981a('0x1f2'),_0x451524[_0x981a('0x44')]);_0x2aa2d8[_0x981a('0xbc')](_0x451524);hopperUtils[_0x981a('0xe7')]({'active':![],'ContactId':_0x2aa2d8['actions'][_0x1b6610][_0x981a('0xd9')],'ListId':_0x2aa2d8[_0x981a('0x20')][_0x1b6610][_0x981a('0xda')],'VoiceQueueId':_0x2aa2d8['actions'][_0x1b6610][_0x981a('0x104')]||undefined,'CampaignId':_0x2aa2d8[_0x981a('0x20')][_0x1b6610][_0x981a('0xe8')]||undefined})['catch'](loggerCatch(_0x981a('0x1f4')));delete _0x2aa2d8['actions'][_0x1b6610];}}else{return _0x2aa2d8[_0x981a('0x162')](_0x451524,_0x323f69);}}else{if(utils['getSeconds'](undefined,_0x323f69[_0x981a('0x1f6')])<_0x451524[_0x981a('0x1f7')]*0x3c){if(_0x323f69['Agent']&&!_0x323f69[_0x981a('0x1f8')][_0x981a('0x1f9')]){_0x2aa2d8[_0x981a('0x19')][_0x981a('0xf8')](_0x323f69['id'])[_0x981a('0xfa')](function(){_0x2aa2d8['updateOriginated'](_0x451524);});}else{hopperUtils[_0x981a('0x1fa')]({'active':![]},_0x323f69['id'],0x1)[_0x981a('0xfa')](function(){_0x2aa2d8['updateOriginated'](_0x451524);});}}else{_0x451524[_0x981a('0x1fb')]+=0x1;_0x2aa2d8[_0x981a('0xbc')](_0x451524);if(_0x451524[_0x981a('0x1fc')]){hopperUtils[_0x981a('0xe7')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x323f69[_0x981a('0xd9')],'ListId':_0x323f69[_0x981a('0xda')],'VoiceQueueId':_0x323f69[_0x981a('0x104')]||undefined,'CampaignId':_0x323f69[_0x981a('0xe8')]||undefined})[_0x981a('0x9b')](loggerCatch(_0x981a('0x1fd')));hopperUtils[_0x981a('0xc3')](createObjHistory(_0x451524,_0x323f69,utils[_0x981a('0x6b')][_0x981a('0x1fe')],0x17,_0x981a('0x1ff')))['catch'](loggerCatch(_0x981a('0x200')));}else{_0x2aa2d8['saveInDb'](createObjHistory(_0x451524,_0x323f69,utils[_0x981a('0x6b')][_0x981a('0x201')],0x16,_0x981a('0x202')),_0x981a('0x203'),_0x981a('0x204'));}}}}else{_0x451524['outboundBlacklistCallsDay']+=0x1;_0x2aa2d8[_0x981a('0x119')](createObjHistory(_0x451524,_0x323f69,utils[_0x981a('0x6b')][_0x981a('0x205')],0xd,_0x981a('0x206')),_0x981a('0x207'),_0x981a('0x208'));throw _0x981a('0x209');}};};Dialer[_0x981a('0x82')][_0x981a('0x161')]=function(_0x7cb947){var _0x45e351=this;var _0x52e604=_0x7cb947[_0x981a('0x20a')]-_0x7cb947[_0x981a('0x159')];emitCampaignSummary(_0x7cb947);if(_0x52e604>0x0&&_0x7cb947[_0x981a('0x64')]==0x0){if(_0x52e604>this[_0x981a('0x1e')]){_0x52e604=this[_0x981a('0x1e')];}_0x7cb947[_0x981a('0x64')]=0x1;hopperUtils['getContactDialerIvr'](_0x7cb947,_0x52e604)[_0x981a('0x97')](function(_0x4d1456){_0x7cb947[_0x981a('0x64')]=0x0;if(_0x4d1456){if(!utils[_0x981a('0x20b')](_0x4d1456)){_0x7cb947['message']=utils[_0x981a('0x6b')][_0x981a('0x6c')];logger[_0x981a('0x47')](_0x981a('0x20c')+_0x7cb947[_0x981a('0x44')]);}else{_0x7cb947[_0x981a('0x159')]+=_0x4d1456[_0x981a('0x93')];_0x7cb947[_0x981a('0x67')]=utils[_0x981a('0x6b')]['RUNNING'];for(var _0x13137e=0x0;_0x13137e<_0x4d1456[_0x981a('0x93')];_0x13137e+=0x1){_0x7cb947[_0x981a('0x20d')]+=0x1;if(_[_0x981a('0xf3')](_0x4d1456[_0x13137e])||_['isNil'](_0x4d1456[_0x13137e][_0x981a('0x17e')])||_[_0x981a('0xf3')](_0x4d1456[_0x13137e]['phone'])){_0x45e351[_0x981a('0x15c')](_0x981a('0x20e'),_0x7cb947,_0x4d1456[_0x13137e]);}else{hopperUtils[_0x981a('0x20f')](_[_0x981a('0x100')](_0x4d1456[_0x13137e],['CampaignId',_0x981a('0x164')]))[_0x981a('0x97')](_0x45e351[_0x981a('0x1ee')](_0x7cb947,_0x4d1456[_0x13137e]))['catch'](_0x45e351['loggerHandler'](_0x981a('0x210'),_0x7cb947));}}}}})[_0x981a('0x9b')](loggerGetContactDialer(_0x981a('0x211'),_0x7cb947,_0x52e604));}};Dialer[_0x981a('0x82')]['handlePower']=function(_0x3845a5,_0x2d3cda){var _0x3719f9=this;var _0x5525c0=[];if(_0x2d3cda<0x1||_0x3845a5[_0x981a('0xab')]===_0x981a('0x9')){_0x2d3cda=0x1;}var _0x8b7e3c=Math[_0x981a('0x1c7')](_0x3845a5[_0x981a('0x140')]*_0x2d3cda)-_0x3845a5['originated'];if(_0x3845a5[_0x981a('0x212')]>0x0){var _0x34cf9b=_0x3845a5['dialLimitQueue']-_0x3845a5['originated']-_0x3845a5[_0x981a('0x142')]-_0x3845a5[_0x981a('0x143')];if(_0x8b7e3c>_0x34cf9b){_0x8b7e3c=_0x34cf9b;}}if(_0x8b7e3c>0x0&&_0x3845a5[_0x981a('0x64')]==0x0){if(_0x3845a5['dialMethod']===_0x981a('0x9')){_0x8b7e3c=0x1;}if(_0x8b7e3c>this[_0x981a('0x1e')]){_0x8b7e3c=this['maxNumberOriginate'];}for(var _0x40e9dc in this['agents']){if(typeof this['agents'][_0x40e9dc]!==_0x981a('0xa3')){if(this[_0x981a('0x1c')][_0x40e9dc][_0x981a('0xcc')]==='not_inuse'&&this[_0x981a('0x1c')][_0x40e9dc][_0x981a('0x84')]==='reachable'){_0x5525c0[_0x981a('0x94')](this[_0x981a('0x1c')][_0x40e9dc]['id']);}}}_0x3845a5[_0x981a('0x64')]=0x1;hopperUtils['getContactDialer'](_0x3845a5,_0x5525c0,_0x8b7e3c)[_0x981a('0x97')](function(_0x24e2d1){_0x3845a5['temp']=0x0;if(_0x24e2d1){if(!utils[_0x981a('0x20b')](_0x24e2d1)){hopperUtils[_0x981a('0x213')](_0x3845a5)[_0x981a('0x97')](sendMessageReschedule(_0x3845a5))['catch'](loggerCatch(_0x981a('0x214')));}else{_0x3845a5[_0x981a('0x159')]+=_0x24e2d1['length'];_0x3845a5['message']=_0x3845a5['dialMethod']===_0x981a('0x9')?utils[_0x981a('0x6b')][_0x981a('0x144')]:utils[_0x981a('0x6b')][_0x981a('0x215')];for(var _0x2a81e9=0x0;_0x2a81e9<_0x24e2d1[_0x981a('0x93')];_0x2a81e9+=0x1){if(_[_0x981a('0xf3')](_0x24e2d1[_0x2a81e9])||_['isNil'](_0x24e2d1[_0x2a81e9][_0x981a('0x17e')])||_[_0x981a('0xf3')](_0x24e2d1[_0x2a81e9]['phone'])){_0x3719f9[_0x981a('0x15c')](_0x981a('0x20e'),_0x3845a5,_0x24e2d1[_0x2a81e9]);}else{hopperUtils['checkIsBlackList'](_[_0x981a('0x100')](_0x24e2d1[_0x2a81e9],[_0x981a('0x104'),_0x981a('0x164')]))[_0x981a('0x97')](_0x3719f9['checkContactBlack'](_0x3845a5,_0x24e2d1[_0x2a81e9]))[_0x981a('0x9b')](_0x3719f9['loggerHandler']('[actionOriginate]\x20',_0x3845a5));}}}}})[_0x981a('0x9b')](loggerGetContactDialer(_0x981a('0x216'),_0x3845a5,_0x8b7e3c));}};Dialer['prototype'][_0x981a('0x1cd')]=function(_0x4cf546){if(_0x4cf546['dialLimitQueue']>0x0){var _0x4c3f50=_0x4cf546[_0x981a('0x212')]-_0x4cf546[_0x981a('0x159')]-_0x4cf546['talking'];if(_0x4c3f50>0x0&&_0x4cf546[_0x981a('0x64')]==0x0){this['tryOriginatePredictive'](_0x4cf546);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0x981a('0x217')](_0x4cf546);}};Dialer[_0x981a('0x82')][_0x981a('0x217')]=function(_0x8419d9){var _0xb5c9a7=this;var _0x145956=[];_0x8419d9[_0x981a('0x159')]+=0x1;for(var _0x2d4cfb in this[_0x981a('0x1c')]){if(typeof this[_0x981a('0x1c')][_0x2d4cfb]!==_0x981a('0xa3')){if(this['agents'][_0x2d4cfb]['state']===_0x981a('0x218')&&this[_0x981a('0x1c')][_0x2d4cfb][_0x981a('0x84')]==='reachable'){_0x145956[_0x981a('0x94')](this[_0x981a('0x1c')][_0x2d4cfb]['id']);}}}_0x8419d9[_0x981a('0x64')]=0x1;return this[_0x981a('0x219')](_0x8419d9['id'],_0x145956,0x1,_0x8419d9[_0x981a('0x21a')],_0x8419d9)[_0x981a('0x97')](function(_0x59c433){_0x8419d9['temp']=0x1;if(_0x59c433){if(!utils[_0x981a('0x20b')](_0x59c433)){utils[_0x981a('0x63')](_0x8419d9,0x1,0x0);return hopperUtils['countReScheduled'](_0x8419d9)[_0x981a('0x97')](sendMessageReschedule(_0x8419d9))[_0x981a('0x9b')](loggerCatch(_0x981a('0x214')));}else{_0x8419d9[_0x981a('0x67')]=utils[_0x981a('0x6b')][_0x981a('0x215')];if(_[_0x981a('0xf3')](_0x59c433[0x0])||_['isNil'](_0x59c433[0x0][_0x981a('0x17e')])||_[_0x981a('0xf3')](_0x59c433[0x0][_0x981a('0x164')])){_0xb5c9a7['emptyContact'](_0x981a('0x20e'),_0x8419d9,_0x59c433[0x0]);}else{return hopperUtils['checkIsBlackList'](_['pick'](_0x59c433[0x0],['VoiceQueueId',_0x981a('0x164')]))['then'](_0xb5c9a7['checkContactBlack'](_0x8419d9,_0x59c433[0x0]))['catch'](_0xb5c9a7[_0x981a('0x15b')](_0x981a('0x21b'),_0x8419d9));}}}})[_0x981a('0x9b')](loggerGetContactDialer(_0x981a('0x21c'),_0x8419d9,0x1));};Dialer[_0x981a('0x82')][_0x981a('0x1e0')]=function(_0x4a80df,_0x27d203,_0x1ab75c,_0x2d5d5c,_0x44b332,_0x2d0ada){loggerPredictive[_0x981a('0x47')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x981a('0x47')](_0x981a('0x21d'),_0x4a80df);loggerPredictive[_0x981a('0x47')](_0x981a('0x21e'),_0x27d203);loggerPredictive[_0x981a('0x47')](_0x981a('0x21f'),_0x1ab75c);loggerPredictive[_0x981a('0x47')](_0x981a('0x220'),_0x2d5d5c);loggerPredictive[_0x981a('0x47')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x44b332);loggerPredictive[_0x981a('0x47')](_0x981a('0x51'));return new Promise(function(_0x426339,_0x363d6b){if(_0x4a80df<=0x0||isNaN(_0x4a80df)){return _0x363d6b(msgResponse('[abandonmentRate]',_0x981a('0x81'),'m\x20=\x20'+_0x4a80df));}if(_0x1ab75c<=0x0||isNaN(_0x1ab75c)){return _0x363d6b(msgResponse(_0x981a('0x221'),_0x981a('0x81'),_0x981a('0x222')+_0x1ab75c));}if(_0x2d5d5c<=0x0||isNaN(_0x2d5d5c)){return _0x363d6b(msgResponse(_0x981a('0x221'),'Error','p\x20=\x20'+_0x2d5d5c));}if(_0x27d203<=0x0||isNaN(_0x27d203)){return _0x363d6b(msgResponse(_0x981a('0x221'),_0x981a('0x81'),_0x981a('0x223')+_0x27d203));}if(_0x44b332<=0x0||isNaN(_0x44b332)){return _0x363d6b(msgResponse('[abandonmentRate]',_0x981a('0x81'),_0x981a('0x224')+_0x44b332));}_0x2d0ada=_0x2d0ada||0x0;var _0x3de59a=0x1/_0x1ab75c;var _0x31cca6=0x0;var _0x5f030b=0x0;var _0x5282e2=0x0;var _0x496d08=0x0;for(var _0x4ae04a=0x0;_0x5282e2<_0x44b332;_0x4ae04a+=0x1){_0x5f030b=_0x4ae04a/_0x27d203;_0x31cca6=(_0x2d5d5c*_0x5f030b+_0x2d0ada)/_0x3de59a;_0x5282e2=utils[_0x981a('0x225')](_0x31cca6,_0x4a80df);_0x496d08=_0x31cca6/_0x4a80df*(0x1-utils[_0x981a('0x225')](_0x31cca6,_0x4a80df));}return _0x426339({'erlangCalls':_0x4ae04a,'erlangCallToSecond':_0x27d203/_0x4ae04a,'erlangAbandonmentRate':_0x5282e2,'erlangBusyFactor':_0x496d08});});};Dialer[_0x981a('0x82')][_0x981a('0x1e9')]=function(_0x1a38e0,_0x1e22ee,_0x441f60,_0x1d98f6,_0x9fdb58,_0xc17331){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x981a('0x47')](_0x981a('0x21d'),_0x1a38e0);loggerPredictive[_0x981a('0x47')](_0x981a('0x21e'),_0x1e22ee);loggerPredictive[_0x981a('0x47')]('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x441f60);loggerPredictive['info'](_0x981a('0x220'),_0x1d98f6);loggerPredictive[_0x981a('0x47')](_0x981a('0x226'),_0x9fdb58);loggerPredictive[_0x981a('0x47')](_0x981a('0x51'));return new Promise(function(_0x8ef132,_0x3096e9){if(_0x1a38e0<=0x0||isNaN(_0x1a38e0)){return _0x3096e9(msgResponse('[busyFactor]',_0x981a('0x81'),_0x981a('0x227')+_0x1a38e0));}if(_0x441f60<=0x0||isNaN(_0x441f60)){return _0x3096e9(msgResponse('[busyFactor]',_0x981a('0x81'),_0x981a('0x222')+_0x441f60));}if(_0x1d98f6<=0x0||isNaN(_0x1d98f6)){return _0x3096e9(msgResponse(_0x981a('0x228'),'Error',_0x981a('0x229')+_0x1d98f6));}if(_0x1e22ee<=0x0||isNaN(_0x1e22ee)){return _0x3096e9(msgResponse(_0x981a('0x228'),_0x981a('0x81'),_0x981a('0x223')+_0x1e22ee));}if(_0x9fdb58<=0x0||isNaN(_0x9fdb58)){return _0x3096e9(msgResponse(_0x981a('0x228'),_0x981a('0x81'),_0x981a('0x22a')+_0x9fdb58));}_0xc17331=_0xc17331||0x0;var _0x2f9b60=0x1/_0x441f60;var _0x384f9a=0x0;var _0x57e106=0x0;var _0x3f8016=0x0;var _0x3c966b=0x0;for(var _0x50a2b2=0x0;_0x3c966b<_0x9fdb58;_0x50a2b2+=0x1){_0x57e106=_0x50a2b2/_0x1e22ee;_0x384f9a=(_0x1d98f6*_0x57e106+_0xc17331)/_0x2f9b60;_0x3f8016=utils['erlangb'](_0x384f9a,_0x1a38e0);_0x3c966b=_0x384f9a/_0x1a38e0*(0x1-utils['erlangb'](_0x384f9a,_0x1a38e0));}return _0x8ef132({'erlangCalls':_0x50a2b2,'erlangCallToSecond':_0x1e22ee/_0x50a2b2,'erlangAbandonmentRate':_0x3f8016,'erlangBusyFactor':_0x3c966b});});};module[_0x981a('0x22b')]=Dialer; \ No newline at end of file +var _0xb677=['membername','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','emit','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','countmachineretry','dialMachineRetryFrequency','custom:amd','[syncHangupInAMDIvr]','AMD','countbusyretry','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr]','[syncHangupIvr][createHistory]','dialQueueProject','cause-txt','Normal\x20Clearing','[syncAgentComplete]','Unknow','running','statusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','undefined','No\x20such\x20channel','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','launchHandleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-VOICEQUEUEID','setXMDContactVariables','Contact','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','checkRetriveMax','countnosuchnumberretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','predictiveIntervalAvailable','round','predictiveIntervalMinThreshold','erlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','dialPredictiveInterval','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','getDataPredictive','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','getDataPredictiveOld','getVoiceQueueRtPauses','loggedIn','outboundQueuePauses','predictiveIntervalPauses','check\x20failure','floor','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','Queue:\x20','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','booked','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','exports','util','uuid','ioredis','./utils','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','redis','defaults','localhost','../rpc/cmHopper','../rpc/interval','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','env','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','syncNewExten','varset','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','isUndefined','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','handlePredictive','handlePredictive\x20interval\x20cleared','error','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','state','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','\x20INTERVAL_IS_NULL','Intervals','NULL_INTERVAL','INACTIVE','\x20NOT\x20Active','isIVRCampaign','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','isTrunkReachable','SIP/%s','status','reachable','unmonitored','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','length','push','Action','iftime\x20%s,%s','indexOf','catch','content','all','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','isIVRCampaignActive','resolve','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','progressive','power','handlePower','dialPowerLevel','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_GLOBAL_INTERVAL','Global:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','ivr','updateOriginated','queue','uniqueid','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','outboundAnswerCallsDay','reason','agiafterat','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','syncQueueCallerAbandon','droptime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','TIMEOUT','dialQueueProject2','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','minutes','ListId','VoiceQueueId','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','countabandonedretry','countglobal','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','additional','add','ContactId','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','stateinterface','queueBooked','paused','run','idHopper','CampaignId','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','syncVarSet','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD'];(function(_0x1d8a39,_0x49776c){var _0x598461=function(_0x276f1b){while(--_0x276f1b){_0x1d8a39['push'](_0x1d8a39['shift']());}};_0x598461(++_0x49776c);}(_0xb677,0x10d));var _0x7b67=function(_0x9a32a0,_0x26d891){_0x9a32a0=_0x9a32a0-0x0;var _0x353353=_0xb677[_0x9a32a0];return _0x353353;};'use strict';var util=require(_0x7b67('0x0'));var _=require('lodash');var uuid=require(_0x7b67('0x1'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x7b67('0x2'));var utils=require(_0x7b67('0x3'));var hopperUtils=require('./utils/hopper');var ut=require(_0x7b67('0x4'));var config=require(_0x7b67('0x5'));var logger=require('../../../config/logger')(_0x7b67('0x6'));var loggerBooked=require(_0x7b67('0x7'))('booked');var loggerPredictive=require(_0x7b67('0x7'))(_0x7b67('0x8'));var loggerPredictiveCalls=require(_0x7b67('0x7'))(_0x7b67('0x9'));var loggerSyncQueueSummary=require(_0x7b67('0x7'))(_0x7b67('0xa'));var ami=require('../ami');config[_0x7b67('0xb')]=_[_0x7b67('0xc')](config[_0x7b67('0xb')],{'host':_0x7b67('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7b67('0xb')]));var cmHopper=require(_0x7b67('0xe'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require('../rpc/setting');var Interval=require(_0x7b67('0xf'));var Action=require('./models/action');var History=require(_0x7b67('0x10'));var Final=require(_0x7b67('0x11'));var AgentComplete=require(_0x7b67('0x12'));var QueueCallerAbandon=require(_0x7b67('0x13'));var Hangup=require('./models/hangup');var ipAgi=process[_0x7b67('0x14')]['XCALLY_IP_AGI']||_0x7b67('0x15');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x7b67('0x16')][_0x7b67('0x17')]=function(_0x47ab31){this[_0x7b67('0x18')]=this[_0x7b67('0x18')]?this[_0x7b67('0x18')][_0x7b67('0x19')](_0x47ab31):_0x47ab31();};function Dialer(_0x3ddf11,_0x595d71){this[_0x7b67('0x1a')]=new Sequence();this[_0x7b67('0x1b')]=_0x595d71;this[_0x7b67('0x1c')]=_0x3ddf11[_0x7b67('0x1c')];this['campaigns']=_0x3ddf11[_0x7b67('0x1d')];this[_0x7b67('0x1e')]=_0x3ddf11[_0x7b67('0x1e')];this[_0x7b67('0x1f')]=_0x3ddf11[_0x7b67('0x1f')];this[_0x7b67('0x20')]=config[_0x7b67('0x20')]||0x2;this[_0x7b67('0x21')]={};this[_0x7b67('0x22')]={};this['contactsId']={};this[_0x7b67('0x23')]={};this[_0x7b67('0x24')]={};this[_0x7b67('0x25')]={};this[_0x7b67('0x26')]={};this[_0x7b67('0x27')]={};this['queueBooked']={};this[_0x7b67('0x28')]={};this[_0x7b67('0x29')]={};ami['on'](_0x7b67('0x2a'),this[_0x7b67('0x2b')][_0x7b67('0x2c')](this));ami['on'](_0x7b67('0x2d'),this['syncQueueCallerAbandon'][_0x7b67('0x2c')](this));ami['on'](_0x7b67('0x2e'),this[_0x7b67('0x2f')][_0x7b67('0x2c')](this));ami['on'](_0x7b67('0x30'),this['syncAgentComplete'][_0x7b67('0x2c')](this));ami['on']('custom:queuesummary',this[_0x7b67('0xa')][_0x7b67('0x2c')](this));ami['on'](_0x7b67('0x31'),this[_0x7b67('0x32')][_0x7b67('0x2c')](this));ami['on']('hangup',this[_0x7b67('0x33')][_0x7b67('0x2c')](this));ami['on']('newexten',this[_0x7b67('0x34')][_0x7b67('0x2c')](this));ami['on'](_0x7b67('0x35'),this['syncVarSet'][_0x7b67('0x2c')](this));ami['on'](_0x7b67('0x36'),this[_0x7b67('0x37')][_0x7b67('0x2c')](this));ami['on']('queuestatuscomplete',this[_0x7b67('0x38')][_0x7b67('0x2c')](this));this[_0x7b67('0x39')]();this[_0x7b67('0x3a')]();RpcSetting[_0x7b67('0x3b')]()[_0x7b67('0x3c')](function(_0x4bd76e){previewRecallmeReminderInterval=_0x4bd76e[_0x7b67('0x3d')];});}function isNotNull(_0x3d43b4){return _0x3d43b4!==null&&!_['isUndefined'](_0x3d43b4);}function msgResponse(_0x10798a,_0x36fa9b,_0x43babe){return{'action':_0x10798a,'response':_0x36fa9b,'message':_0x43babe,'stack':_0x43babe};}function emit(_0x1850ec,_0x45b8dd,_0x528633){io['to'](_0x1850ec)['emit'](_0x45b8dd,_0x528633);}function emitOutboundVoiceQueueSummary(_0x16d85f){if(_0x16d85f[_0x7b67('0x3e')]===_0x7b67('0x3f')){logger[_0x7b67('0x40')](_0x7b67('0x41'),util[_0x7b67('0x42')](_0x16d85f,{'showHidden':![],'depth':null}));emit(util[_0x7b67('0x43')]('voice:queue:%s',_0x16d85f[_0x7b67('0x44')]),_0x7b67('0x45'),_0x16d85f);}}function checkGetDataPredictive(_0x3a3f73){if(isNotNull(_0x3a3f73)&&!_[_0x7b67('0x46')](_0x3a3f73)){loggerPredictive[_0x7b67('0x47')](_0x7b67('0x48'));loggerPredictive[_0x7b67('0x47')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a3f73[_0x7b67('0x49')]);loggerPredictive['info'](_0x7b67('0x4a'),_0x3a3f73[_0x7b67('0x4b')]);loggerPredictive[_0x7b67('0x47')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a3f73[_0x7b67('0x4c')]);loggerPredictive[_0x7b67('0x47')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a3f73[_0x7b67('0x4d')]);loggerPredictive[_0x7b67('0x47')](_0x7b67('0x4e'),_0x3a3f73[_0x7b67('0x4f')]);loggerPredictive[_0x7b67('0x47')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a3f73[_0x7b67('0x50')]);loggerPredictive[_0x7b67('0x47')](_0x7b67('0x51'));if(_0x3a3f73[_0x7b67('0x49')]>0x0){if(!_['isUndefined'](_0x3a3f73['predictiveIntervalAvgTalktime'])&&_0x3a3f73[_0x7b67('0x50')]>0x0){return!![];}loggerPredictive[_0x7b67('0x47')](_0x7b67('0x52'));if(!_[_0x7b67('0x53')](_0x3a3f73[_0x7b67('0x4f')])&&_0x3a3f73[_0x7b67('0x4f')]>0x0){return!![];}loggerPredictive['info'](_0x7b67('0x54'));}else{loggerPredictive[_0x7b67('0x47')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x7b67('0x47')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x5ab5bf){return function(_0x43e4cd){loggerPredictive[_0x7b67('0x47')](_0x7b67('0x55'));loggerPredictive[_0x7b67('0x47')](_0x7b67('0x56'),_0x43e4cd['erlangCalls']);loggerPredictive[_0x7b67('0x47')](_0x7b67('0x57'),_0x43e4cd[_0x7b67('0x58')]);loggerPredictive[_0x7b67('0x47')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x43e4cd[_0x7b67('0x59')]);loggerPredictive[_0x7b67('0x47')](_0x7b67('0x5a'),_0x43e4cd[_0x7b67('0x5b')]);loggerPredictive[_0x7b67('0x47')](_0x7b67('0x5c'),_0x43e4cd[_0x7b67('0x59')]);loggerPredictive['info']('---------------------------');_[_0x7b67('0x5d')](_0x5ab5bf,_0x43e4cd);};}function ifInterval(_0x447d03,_0x38bd1c){if(_[_0x7b67('0x53')](_0x38bd1c)){return![];}return utils[_0x7b67('0x5e')](undefined,_0x38bd1c)<_0x447d03*0x3c;}function clearPredictiveAttributes(_0x28170b){if(_0x28170b[_0x7b67('0x26')]){_0x28170b['startProgressive']=undefined;loggerPredictive[_0x7b67('0x40')](_0x28170b[_0x7b67('0x44')],'startProgressive\x20value\x20cleared');}if(_0x28170b[_0x7b67('0x25')]){_0x28170b[_0x7b67('0x25')]=undefined;loggerPredictive[_0x7b67('0x40')](_0x28170b[_0x7b67('0x44')],'startPredictive\x20value\x20cleared');}if(_0x28170b[_0x7b67('0x5f')]){clearInterval(_0x28170b[_0x7b67('0x5f')]);_0x28170b[_0x7b67('0x5f')]=undefined;loggerPredictive[_0x7b67('0x40')](_0x28170b[_0x7b67('0x44')],_0x7b67('0x60'));}}function loggerCatchPredictive(_0x579b1b,_0x26445a){return function(_0x113b90){loggerPredictive[_0x7b67('0x61')](_0x26445a[_0x7b67('0x44')],_0x579b1b);loggerPredictive['error'](_0x113b90['stack']);clearPredictiveAttributes(_0x26445a);};}function loggerCatch(_0x4eed11){return function(_0x403092){logger[_0x7b67('0x61')](_0x4eed11,util['inspect'](_0x403092,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x11ea10,_0x2fbb29,_0x5b2791){return function(_0x25347b){utils[_0x7b67('0x62')](_0x2fbb29,_0x5b2791,0x0);_0x2fbb29['temp']=0x0;logger['error'](_0x11ea10,util['inspect'](_0x25347b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1fe007){return function(_0x846d50){if(isNotNull(_0x846d50)&&isNotNull(_0x846d50[0x0])){if(_0x846d50[0x0][_0x7b67('0x63')]>0x0){_0x1fe007[_0x7b67('0x64')]=utils[_0x7b67('0x65')]['CONTACTS_RESCHEDULED'];logger[_0x7b67('0x47')](_0x7b67('0x66')+_0x1fe007[_0x7b67('0x44')],_0x846d50[0x0]['contactsRescheduled'],_0x7b67('0x67'));}else{_0x1fe007[_0x7b67('0x64')]=utils['CAMPAIGN_STATUS'][_0x7b67('0x68')];logger['info']('[getContactDialer2][Empty]'+_0x1fe007[_0x7b67('0x44')]);}}};}function createObjHistory(_0x47f211,_0x413b76,_0x1f6ec4,_0x5346aa,_0x2677ef){_0x47f211[_0x7b67('0x64')]=_0x1f6ec4;var _0x3396c3=new Action(_0x47f211,_0x413b76);var _0x152a73=new History(_0x3396c3);_0x152a73[_0x7b67('0x69')]=_0x5346aa;_0x152a73['statedesc']=_0x2677ef;_0x152a73['endtime']=_0x3396c3[_0x7b67('0x6a')];return _0x152a73;}function unlockQueueStatus(_0x593bd2,_0x39959){setTimeout(function(){if(_[_0x7b67('0x53')](_0x593bd2[_0x7b67('0x6b')])){loggerBooked[_0x7b67('0x61')](_0x7b67('0x6c'),_0x39959);}_0x593bd2[_0x7b67('0x6b')]=!![];loggerBooked[_0x7b67('0x47')](_0x7b67('0x6d'),_0x39959,JSON[_0x7b67('0x6e')](_[_0x7b67('0x6f')](_0x593bd2,[_0x7b67('0x44'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0xc8f814){return function(){if(!isNotNull(_0xc8f814[_0x7b67('0x70')])){_0xc8f814[_0x7b67('0x64')]=utils[_0x7b67('0x65')]['NULL_INTERVAL'];throw _0xc8f814['name']+_0x7b67('0x71');}if(!isNotNull(_0xc8f814['Interval'][_0x7b67('0x72')])){_0xc8f814[_0x7b67('0x64')]=utils[_0x7b67('0x65')][_0x7b67('0x73')];throw _0xc8f814[_0x7b67('0x44')]+_0x7b67('0x71');}if(!isNotNull(_[_0x7b67('0x46')](_0xc8f814['Interval']['Intervals']))){_0xc8f814[_0x7b67('0x64')]=utils[_0x7b67('0x65')][_0x7b67('0x73')];throw _0xc8f814[_0x7b67('0x44')]+_0x7b67('0x71');}};}function checkIsIVRCampaignActive(_0x555833){return function(){if(!utils['isIVRCampaignActive'](_0x555833)){_0x555833[_0x7b67('0x64')]=utils[_0x7b67('0x65')][_0x7b67('0x74')];throw _0x555833[_0x7b67('0x44')]+_0x7b67('0x75');}};}function emitCampaignSummary(_0x4b04b1){if(utils[_0x7b67('0x76')](_0x4b04b1)){emit(util['format']('campaign:ivr:%s',_0x4b04b1[_0x7b67('0x44')]),'campaign:save',_0x4b04b1);}}function loggerCatchQueueSummary(_0x276c5e,_0x433384){return function(_0x438e7a){clearPredictiveAttributes(_0x433384);emitCampaignSummary(_0x433384);loggerSyncQueueSummary['debug'](_0x276c5e,util['inspect'](_0x438e7a,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x51ddb2){if(_0x51ddb2[_0x7b67('0x77')]){if(_0x51ddb2[_0x7b67('0x78')]===0x0){_0x51ddb2['sendMessageOneNotActive']=![];_0x51ddb2['message']=utils[_0x7b67('0x65')][_0x7b67('0x74')];loggerSyncQueueSummary[_0x7b67('0x40')](_0x7b67('0x79'),_0x51ddb2[_0x7b67('0x44')],_0x7b67('0x7a'));}else{_0x51ddb2[_0x7b67('0x64')]=utils[_0x7b67('0x65')][_0x7b67('0x7b')];loggerSyncQueueSummary[_0x7b67('0x40')](_0x7b67('0x79'),_0x51ddb2['name'],_0x7b67('0x7c'));}emitCampaignSummary(_0x51ddb2);}}function myreject(_0x3a43ad){return function(_0x197303){return _0x3a43ad(msgResponse('[ifTime][Action]','Error',JSON['stringify'](_0x197303)));};}Dialer[_0x7b67('0x16')][_0x7b67('0x7d')]=function(_0x240681){return!_[_0x7b67('0x53')](_0x240681)&&_0x240681&&!_[_0x7b67('0x53')](_0x240681[_0x7b67('0x44')])&&!_[_0x7b67('0x53')](_0x240681['active'])&&_0x240681['active']&&(this['trunks'][util[_0x7b67('0x43')](_0x7b67('0x7e'),_0x240681[_0x7b67('0x44')])][_0x7b67('0x7f')]===_0x7b67('0x80')||this[_0x7b67('0x1f')][util[_0x7b67('0x43')]('SIP/%s',_0x240681[_0x7b67('0x44')])][_0x7b67('0x7f')]===_0x7b67('0x81'));};Dialer[_0x7b67('0x16')]['checkIsTrunkReachable']=function(_0x2defcf){var _0x8925db=this;return function(){if(!_0x8925db[_0x7b67('0x7d')](_0x2defcf[_0x7b67('0x82')])){if(!_0x8925db[_0x7b67('0x7d')](_0x2defcf['TrunkBackup'])){_0x2defcf[_0x7b67('0x64')]=utils[_0x7b67('0x65')][_0x7b67('0x83')];throw _0x2defcf[_0x7b67('0x44')]+_0x7b67('0x84');}}};};Dialer[_0x7b67('0x16')]['checkIfTime']=function(_0x41b704,_0x301a09,_0x3749a4,_0x53234){var _0x890a05=this;return function(){var _0x32a7a8=!![];return _0x890a05[_0x7b67('0x85')](_0x41b704,_0x301a09,_0x3749a4,_0x53234,_0x32a7a8);};};Dialer['prototype'][_0x7b67('0x86')]=function(_0x45f988,_0x4a55d3,_0x156100,_0x883f81){var _0x3c1137=this;return function(){var _0x49e4b3=![];return _0x3c1137[_0x7b67('0x85')](_0x45f988[_0x7b67('0x72')],_0x4a55d3,_0x156100,_0x883f81,_0x49e4b3);};};Dialer[_0x7b67('0x16')][_0x7b67('0x85')]=function(_0x13d445,_0x1b28f0,_0x31eb41,_0x548939,_0x48e885){var _0x38a04c=[];return new Promise(function(_0x503773,_0x549983){if(!isNotNull(_0x13d445)){_0x548939[_0x7b67('0x64')]=utils[_0x7b67('0x65')][_0x7b67('0x73')];return _0x549983(msgResponse(_0x7b67('0x87'),_0x7b67('0x88'),_0x31eb41+_0x7b67('0x89')));}if(_[_0x7b67('0x46')](_0x13d445)){_0x548939['message']=utils[_0x7b67('0x65')][_0x7b67('0x8a')];return _0x549983(msgResponse('ifTime',_0x7b67('0x88'),_0x31eb41+_0x7b67('0x8b')));}if(_0x1b28f0&&_[_0x7b67('0x53')](config[_0x7b67('0x8c')][_0x1b28f0])){_0x548939['message']=utils[_0x7b67('0x65')]['UNKNOWN_TIMEZONE'];return _0x549983(msgResponse(_0x7b67('0x87'),_0x7b67('0x88'),_0x31eb41+_0x7b67('0x8d')+_0x1b28f0));}if(_[_0x7b67('0x8e')](_0x13d445)){for(var _0x332067=0x0;_0x332067<_0x13d445[_0x7b67('0x8f')];_0x332067+=0x1){_0x38a04c[_0x7b67('0x90')](ami[_0x7b67('0x91')]({'action':'command','command':util[_0x7b67('0x43')](_0x7b67('0x92'),_0x13d445[_0x332067]['interval'],!_[_0x7b67('0x53')](config[_0x7b67('0x8c')][_0x1b28f0])?_0x1b28f0:'')})[_0x7b67('0x3c')](function(_0x43d834){return _0x43d834['content'][_0x7b67('0x93')]('true')>=0x0;})[_0x7b67('0x94')](myreject(_0x549983)));}}else{_0x38a04c[_0x7b67('0x90')](ami[_0x7b67('0x91')]({'action':'command','command':util[_0x7b67('0x43')](_0x7b67('0x92'),_0x13d445,!_[_0x7b67('0x53')](config['timezones'][_0x1b28f0])?_0x1b28f0:'')})[_0x7b67('0x3c')](function(_0x160e2e){return _0x160e2e[_0x7b67('0x95')][_0x7b67('0x93')]('true')>=0x0;})[_0x7b67('0x94')](myreject(_0x549983)));}Promise[_0x7b67('0x96')](_0x38a04c)['then'](function(_0x16fbfa){var _0x1c52df=_['some'](_0x16fbfa);if(_0x1c52df){return _0x503773(_0x1c52df);}else{_0x548939[_0x7b67('0x64')]=_0x48e885?utils[_0x7b67('0x65')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0x7b67('0x97')];return _0x549983(msgResponse(_0x7b67('0x98'),_0x7b67('0x88'),'Global:\x20'+_0x48e885+'\x20'+_0x31eb41+_0x7b67('0x99')+util[_0x7b67('0x42')](_0x13d445,{'showHidden':![],'depth':null})+_0x7b67('0x9a')+_0x1b28f0));}})[_0x7b67('0x94')](function(_0x4106f7){return _0x549983(msgResponse(_0x7b67('0x87'),'Failure',JSON[_0x7b67('0x6e')](_0x4106f7)));});});};Dialer[_0x7b67('0x16')][_0x7b67('0x39')]=function(){var _0x26bd7b=this;return cmHopper[_0x7b67('0x9b')]({'active':![]},{'where':{'active':!![]}})[_0x7b67('0x3c')](function(){setInterval(function(){_0x26bd7b[_0x7b67('0x9c')]();},0x3e8);});};Dialer['prototype'][_0x7b67('0x9c')]=function(){var _0x455d18=this;var _0x16b751;for(var _0x483e6e in this[_0x7b67('0x1d')]){if(typeof this['campaigns'][_0x483e6e]!=='undefined'){_0x16b751=this[_0x7b67('0x1d')][_0x483e6e];if(utils[_0x7b67('0x76')](_0x16b751)&&utils[_0x7b67('0x9d')](_0x16b751)){_0x16b751['sendMessageOneNotActive']=!![];Promise[_0x7b67('0x9e')]()[_0x7b67('0x3c')](checkIsIVRCampaignActive(_0x16b751))[_0x7b67('0x3c')](checkInterval(_0x16b751))[_0x7b67('0x3c')](_0x455d18[_0x7b67('0x9f')](_0x16b751))[_0x7b67('0x3c')](_0x455d18['checkIfTime'](_0x16b751[_0x7b67('0xa0')],_0x16b751['dialTimezone'],_0x16b751[_0x7b67('0x44')],_0x16b751))[_0x7b67('0x3c')](_0x455d18[_0x7b67('0x86')](_0x16b751[_0x7b67('0x70')],_0x16b751[_0x7b67('0xa1')],_0x16b751[_0x7b67('0x44')],_0x16b751))[_0x7b67('0x3c')](_0x455d18['launchHandleIvr'](_0x16b751))[_0x7b67('0x94')](loggerCatchQueueSummary(_0x7b67('0xa2'),_0x16b751));}else{notSendMessagesCampaign(_0x16b751);}}}};Dialer[_0x7b67('0x16')][_0x7b67('0xa3')]=function(_0x4a8311){if(_0x4a8311[_0x7b67('0xa4')]!==_0x7b67('0x8')){clearPredictiveAttributes(_0x4a8311);}switch(_0x4a8311[_0x7b67('0xa4')]){case _0x7b67('0xa5'):this['handlePower'](_0x4a8311,0x1);break;case _0x7b67('0xa6'):this[_0x7b67('0xa7')](_0x4a8311,_0x4a8311[_0x7b67('0xa8')]);break;case _0x7b67('0x8'):this[_0x7b67('0x8')](_0x4a8311);break;case'booked':this[_0x7b67('0xa7')](_0x4a8311,0x1);break;default:logger[_0x7b67('0x61')]('Queue',_0x4a8311[_0x7b67('0x44')],'method\x20not\x20recognized');}};Dialer['prototype'][_0x7b67('0x87')]=function(_0x2e0d9d,_0x298fcc){var _0x191baf=_0x2e0d9d[_0x7b67('0xa1')];var _0x4ab379=_0x298fcc?_0x2e0d9d[_0x7b67('0xa0')]:_0x2e0d9d[_0x7b67('0x70')]['Intervals'];logger[_0x7b67('0xa9')](_0x7b67('0xaa'),_0x4ab379,_0x191baf,_0x2e0d9d[_0x7b67('0x44')],util[_0x7b67('0x43')](_0x7b67('0xab'),_0x2e0d9d[_0x7b67('0x44')],_0x2e0d9d['id']));var _0x164172=null;return Interval[_0x7b67('0xac')](_0x4ab379,_0x191baf)[_0x7b67('0x3c')](function(_0x43d376){if(_0x43d376===!![]){return _0x43d376;}else{_0x2e0d9d[_0x7b67('0x64')]=_0x298fcc?utils[_0x7b67('0x65')][_0x7b67('0xad')]:utils['CAMPAIGN_STATUS'][_0x7b67('0x97')];_0x164172=msgResponse(_0x7b67('0x98'),_0x7b67('0x88'),_0x7b67('0xae')+_0x298fcc+'\x20'+_0x2e0d9d['name']+_0x7b67('0x99')+util[_0x7b67('0x42')](_0x4ab379,{'showHidden':![],'depth':null})+_0x7b67('0x9a')+_0x191baf);}if(_0x164172!==null){logger[_0x7b67('0xa9')](_0x7b67('0xaf'),_0x164172);_0x164172[_0x7b67('0xb0')]=_0x298fcc;throw _0x164172;}})['catch'](function(_0x30a594){logger[_0x7b67('0x61')](_0x7b67('0xb1'),_0x30a594);throw msgResponse(_0x7b67('0xb2'),'Error',util[_0x7b67('0x42')](_0x30a594,{'showHidden':![],'depth':null}));});};Dialer[_0x7b67('0x16')][_0x7b67('0x2b')]=function(_0x372a28){if(this[_0x7b67('0x1c')][_0x372a28['queue']]){if(this[_0x7b67('0x23')][_0x372a28['uniqueid']]&&this[_0x7b67('0x23')][_0x372a28['uniqueid']][_0x7b67('0x3e')]!==_0x7b67('0xb3')){this[_0x7b67('0xb4')](this['voiceQueues'][_0x372a28[_0x7b67('0xb5')]]);this['uniqueId'][_0x372a28[_0x7b67('0xb6')]]['answertime']=moment()[_0x7b67('0x43')](_0x7b67('0xb7'));}}};Dialer[_0x7b67('0x16')][_0x7b67('0xb8')]=function(_0x58fe5c){var _0x40c9c5=this[_0x7b67('0x23')][_0x58fe5c[_0x7b67('0xb6')]];if(this[_0x7b67('0x1c')][_0x58fe5c[_0x7b67('0xb5')]]){if(_0x40c9c5&&_0x40c9c5[_0x7b67('0x3e')]!==_0x7b67('0xb3')){delete this['uniqueId'][_0x58fe5c[_0x7b67('0xb6')]];this[_0x7b67('0x1c')][_0x58fe5c[_0x7b67('0xb5')]][_0x7b67('0xb9')]+=0x1;var _0x105033=new AgentComplete(_0x40c9c5,_0x58fe5c);if(_0x58fe5c[_0x7b67('0xba')]==='agent'){_0x105033[_0x7b67('0xbb')]=this[_0x7b67('0x1c')][_0x58fe5c[_0x7b67('0xb5')]]['dialQueueProject2']&&this['voiceQueues'][_0x58fe5c['queue']][_0x7b67('0xbc')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x7b67('0xbd')](_0x105033)[_0x7b67('0x94')](loggerCatch(_0x7b67('0xbe')));hopperUtils[_0x7b67('0xbf')](_0x105033)[_0x7b67('0x94')](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0x7b67('0xc0')]=function(_0xb75175){var _0x24f262=this[_0x7b67('0x23')][_0xb75175[_0x7b67('0xb6')]];var _0x2fd59a=this;var _0x1b03f4=![];var _0x5aeab0;var _0x57300a;if(this[_0x7b67('0x1c')][_0xb75175[_0x7b67('0xb5')]]){if(_0x24f262&&_0x24f262[_0x7b67('0x3e')]!==_0x7b67('0xb3')){delete this['uniqueId'][_0xb75175[_0x7b67('0xb6')]];this['updateOriginated'](this[_0x7b67('0x1c')][_0xb75175['queue']]);_0x24f262[_0x7b67('0xc1')]=moment()['format'](_0x7b67('0xb7'));var _0x528d8e=new QueueCallerAbandon(_0x24f262,_0xb75175);if(utils[_0x7b67('0x5e')](_0x24f262[_0x7b67('0xc1')],_0x24f262['responsetime'])>=_0x24f262[_0x7b67('0xc2')]){this[_0x7b67('0x1c')][_0xb75175[_0x7b67('0xb5')]][_0x7b67('0x4c')]+=0x1;this[_0x7b67('0x1c')][_0xb75175['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0x7b67('0x1c')][_0xb75175[_0x7b67('0xb5')]][_0x7b67('0xc3')]+=0x1;_0x528d8e[_0x7b67('0x69')]=0xa;_0x528d8e[_0x7b67('0xc4')]=_0x7b67('0xc5');_0x528d8e['dropreason']=_0x7b67('0xc6');_0x528d8e['agiafterat']=this[_0x7b67('0x1c')][_0xb75175[_0x7b67('0xb5')]][_0x7b67('0xc7')]?moment()[_0x7b67('0x43')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x528d8e[_0x7b67('0xc8')]+=0x1;_0x528d8e['countglobal']+=0x1;_0x5aeab0=this[_0x7b67('0x1c')][_0xb75175[_0x7b67('0xb5')]][_0x7b67('0xc9')];_0x57300a=this['voiceQueues'][_0xb75175[_0x7b67('0xb5')]][_0x7b67('0xca')];hopperUtils[_0x7b67('0xcb')](_0x528d8e,_0x528d8e[_0x7b67('0x69')],_0x24f262[_0x7b67('0xcc')])[_0x7b67('0x3c')](function(_0x210670){_0x1b03f4=_0x210670['additional']==0x1;if(_0x528d8e[_0x7b67('0xc8')]>=_0x2fd59a[_0x7b67('0x1c')][_0xb75175['queue']][_0x7b67('0xcd')]){_0x2fd59a[_0x7b67('0xce')](_0x528d8e,_0x210670['additional']);}else{hopperUtils[_0x7b67('0xcf')]({'active':![],'countdropretry':_0x528d8e[_0x7b67('0xc8')],'scheduledat':moment()['add'](_0x2fd59a[_0x7b67('0x1c')][_0xb75175['queue']][_0x7b67('0xc9')],_0x7b67('0xd0'))['format'](_0x7b67('0xb7')),'ContactId':_0x24f262['ContactId'],'ListId':_0x24f262[_0x7b67('0xd1')],'VoiceQueueId':_0x24f262[_0x7b67('0xd2')]||undefined,'CampaignId':_0x24f262['CampaignId']||undefined})['catch'](loggerCatch(_0x7b67('0xd3')));var _0x21fbab=new History(_0x528d8e);_0x21fbab[_0x7b67('0x69')]=0xa;_0x21fbab['statedesc']=_0x7b67('0xc5');_0x21fbab['starttime']=moment()['format'](_0x7b67('0xb7'));_0x21fbab[_0x7b67('0xd4')]=_0x21fbab[_0x7b67('0x6a')];_0x21fbab[_0x7b67('0xd5')]=_0x528d8e[_0x7b67('0xd5')];_0x21fbab[_0x7b67('0xd6')]=_0x528d8e[_0x7b67('0xd6')];hopperUtils[_0x7b67('0xbd')](_0x21fbab)['catch'](loggerCatch(_0x7b67('0xd7')));}})[_0x7b67('0x3c')](function(){if(_0x1b03f4)hopperUtils[_0x7b67('0xd8')](_0x528d8e,_0x5aeab0,_0x57300a)[_0x7b67('0x3c')](function(){return 0x1;});});}else{this[_0x7b67('0x1c')][_0xb75175['queue']][_0x7b67('0x4d')]+=0x1;this['voiceQueues'][_0xb75175['queue']][_0x7b67('0xd9')]+=0x1;_0x528d8e[_0x7b67('0x69')]=0xb;_0x528d8e['statedesc']=_0x7b67('0xda');_0x528d8e[_0x7b67('0xdb')]=_0x7b67('0xdc');_0x528d8e[_0x7b67('0xdd')]+=0x1;_0x528d8e[_0x7b67('0xde')]+=0x1;_0x5aeab0=this['voiceQueues'][_0xb75175[_0x7b67('0xb5')]][_0x7b67('0xdf')];_0x57300a=this[_0x7b67('0x1c')][_0xb75175[_0x7b67('0xb5')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x7b67('0xcb')](_0x528d8e,_0x528d8e[_0x7b67('0x69')],_0x24f262[_0x7b67('0xcc')])[_0x7b67('0x3c')](function(_0x102e04){if(_0x528d8e[_0x7b67('0xdd')]>=_0x2fd59a[_0x7b67('0x1c')][_0xb75175[_0x7b67('0xb5')]][_0x7b67('0xe0')]){_0x2fd59a[_0x7b67('0xce')](_0x528d8e,_0x102e04[_0x7b67('0xe1')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x528d8e[_0x7b67('0xdd')],'scheduledat':moment()[_0x7b67('0xe2')](_0x2fd59a[_0x7b67('0x1c')][_0xb75175[_0x7b67('0xb5')]][_0x7b67('0xdf')],_0x7b67('0xd0'))[_0x7b67('0x43')](_0x7b67('0xb7')),'ContactId':_0x24f262[_0x7b67('0xe3')],'ListId':_0x24f262[_0x7b67('0xd1')],'VoiceQueueId':_0x24f262[_0x7b67('0xd2')]||undefined,'CampaignId':_0x24f262['CampaignId']||undefined})[_0x7b67('0x94')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x5adcf7=new History(_0x528d8e);_0x5adcf7[_0x7b67('0x69')]=0xb;_0x5adcf7['statedesc']='Abandoned';_0x5adcf7['starttime']=moment()[_0x7b67('0x43')](_0x7b67('0xb7'));_0x5adcf7[_0x7b67('0xd4')]=_0x5adcf7[_0x7b67('0x6a')];_0x5adcf7[_0x7b67('0xd5')]=_0x528d8e[_0x7b67('0xd5')];_0x5adcf7['calleridnum']=_0x528d8e['calleridnum'];hopperUtils[_0x7b67('0xbd')](_0x5adcf7)[_0x7b67('0x94')](loggerCatch(_0x7b67('0xe4')));}})['then'](function(){if(_0x1b03f4)hopperUtils[_0x7b67('0xd8')](_0x528d8e,_0x5aeab0,_0x57300a)[_0x7b67('0x3c')](function(){return 0x1;});});}}}};Dialer[_0x7b67('0x16')]['syncNewExten']=function(_0x58b397){if(this[_0x7b67('0x22')][_0x58b397['uniqueid']]){this[_0x7b67('0x22')][_0x58b397[_0x7b67('0xb6')]]['channel']=_0x58b397[_0x7b67('0xe5')];}if(this[_0x7b67('0x23')][_0x58b397[_0x7b67('0xb6')]]){this[_0x7b67('0x23')][_0x58b397['uniqueid']][_0x7b67('0xe5')]=_0x58b397['channel'];}};Dialer['prototype'][_0x7b67('0x37')]=function(_0x410eae){if(!this['actions'][_0x410eae[_0x7b67('0xe6')]]){return;}var _0x549abb=this[_0x7b67('0x1c')][this[_0x7b67('0x22')][_0x410eae[_0x7b67('0xe6')]][_0x7b67('0xb5')]][_0x7b67('0xe7')]||_0x7b67('0xe8');if(_0x549abb===_0x7b67('0xe9')){if(this[_0x7b67('0x22')][_0x410eae[_0x7b67('0xe6')]]&&_[_0x7b67('0xea')](this[_0x7b67('0x22')][_0x410eae['actionid']][_0x7b67('0xeb')])&&_0x410eae['status']==='1'&&_0x410eae['paused']==='0'){if(this[_0x7b67('0x1e')][_0x410eae[_0x7b67('0xec')]]){if(!this[_0x7b67('0x1e')][_0x410eae['stateinterface']][_0x7b67('0xeb')]){this[_0x7b67('0x1e')][_0x410eae['stateinterface']][_0x7b67('0xeb')]=!![];this[_0x7b67('0x22')][_0x410eae[_0x7b67('0xe6')]][_0x7b67('0xeb')]=!![];this[_0x7b67('0x22')][_0x410eae['actionid']][_0x7b67('0xec')]=_0x410eae[_0x7b67('0xec')];}}}}else if(_0x549abb===_0x7b67('0xe8')){if(this['actions'][_0x410eae[_0x7b67('0xe6')]]){if(this[_0x7b67('0x1e')][_0x410eae['stateinterface']]){this[_0x7b67('0x22')][_0x410eae[_0x7b67('0xe6')]][_0x7b67('0xec')]=_0x410eae[_0x7b67('0xec')];if(_[_0x7b67('0xea')](this[_0x7b67('0xed')][this[_0x7b67('0x22')][_0x410eae['actionid']][_0x7b67('0xb5')]])){this[_0x7b67('0xed')][this[_0x7b67('0x22')][_0x410eae[_0x7b67('0xe6')]][_0x7b67('0xb5')]]=[];}this[_0x7b67('0xed')][this[_0x7b67('0x22')][_0x410eae[_0x7b67('0xe6')]][_0x7b67('0xb5')]][_0x7b67('0x90')](_[_0x7b67('0x5d')](_['pick'](this['actions'][_0x410eae[_0x7b67('0xe6')]],['idHopper',_0x7b67('0xec')]),{'status':_0x410eae[_0x7b67('0x7f')],'paused':_0x410eae[_0x7b67('0xee')]}));}}}};Dialer[_0x7b67('0x16')][_0x7b67('0x38')]=function(_0x56b41c){if(!this['actions'][_0x56b41c['actionid']]){return;}var _0x1701b3=this;var _0xfa60f6=this[_0x7b67('0x1c')][this['actions'][_0x56b41c[_0x7b67('0xe6')]][_0x7b67('0xb5')]];var _0x479497=_0xfa60f6[_0x7b67('0xe7')]||_0x7b67('0xe8');if(_0x479497==='roundrobin'){if(this[_0x7b67('0x22')][_0x56b41c['actionid']]&&this['actions'][_0x56b41c['actionid']][_0x7b67('0xec')]){this[_0x7b67('0x1b')][_0x7b67('0xef')](this[_0x7b67('0x22')][_0x56b41c[_0x7b67('0xe6')]][_0x7b67('0xf0')],this[_0x7b67('0x22')][_0x56b41c['actionid']]['stateinterface'])['catch'](function(_0x36bb7d){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util[_0x7b67('0x42')](_0x36bb7d,{'showHidden':![],'depth':null}));})[_0x7b67('0x19')](function(){_0x1701b3[_0x7b67('0xb4')](_0x1701b3['voiceQueues'][_0x1701b3['actions'][_0x56b41c['actionid']][_0x7b67('0xb5')]]);_0x1701b3[_0x7b67('0x1e')][_0x1701b3['actions'][_0x56b41c['actionid']][_0x7b67('0xec')]]['locked']=![];delete _0x1701b3[_0x7b67('0x22')][_0x56b41c['actionid']];unlockQueueStatus(_0xfa60f6);});}else{this[_0x7b67('0xb4')](this[_0x7b67('0x1c')][this[_0x7b67('0x22')][_0x56b41c[_0x7b67('0xe6')]][_0x7b67('0xb5')]]);hopperUtils[_0x7b67('0xcf')]({'active':![],'ContactId':this[_0x7b67('0x22')][_0x56b41c[_0x7b67('0xe6')]][_0x7b67('0xe3')],'ListId':this['actions'][_0x56b41c[_0x7b67('0xe6')]][_0x7b67('0xd1')],'VoiceQueueId':this['actions'][_0x56b41c[_0x7b67('0xe6')]][_0x7b67('0xd2')]||undefined,'CampaignId':this[_0x7b67('0x22')][_0x56b41c['actionid']][_0x7b67('0xf1')]||undefined})[_0x7b67('0x94')](loggerCatch(_0x7b67('0xf2')));delete this['actions'][_0x56b41c[_0x7b67('0xe6')]];unlockQueueStatus(_0xfa60f6);}}else if(_0x479497===_0x7b67('0xe8')){var _0x1eecb2;if(this['actions'][_0x56b41c[_0x7b67('0xe6')]]&&!_['isEmpty'](this[_0x7b67('0xed')][this[_0x7b67('0x22')][_0x56b41c['actionid']][_0x7b67('0xb5')]])){if(this['queueBookedRR'][_0x1701b3[_0x7b67('0x22')][_0x56b41c['actionid']][_0x7b67('0xb5')]]){this['queueBookedRR'][_0x1701b3['actions'][_0x56b41c['actionid']][_0x7b67('0xb5')]]=this[_0x7b67('0x28')][this[_0x7b67('0x22')][_0x56b41c[_0x7b67('0xe6')]]['queue']]?this[_0x7b67('0x28')][this[_0x7b67('0x22')][_0x56b41c[_0x7b67('0xe6')]][_0x7b67('0xb5')]]:this[_0x7b67('0xed')][this['actions'][_0x56b41c[_0x7b67('0xe6')]][_0x7b67('0xb5')]]?this[_0x7b67('0xed')][this[_0x7b67('0x22')][_0x56b41c[_0x7b67('0xe6')]][_0x7b67('0xb5')]][_0x7b67('0xf3')]||0x0:0x0;}this['queueBooked'][this[_0x7b67('0x22')][_0x56b41c[_0x7b67('0xe6')]][_0x7b67('0xb5')]]['_rr']=this[_0x7b67('0x28')][this['actions'][_0x56b41c[_0x7b67('0xe6')]]['queue']];for(var _0x527dcd=0x0;_0x527dcd=_0x102c3d[_0x7b67('0x115')]){_0x413df7[_0x7b67('0x116')](_0x15b1d9,_0x1c3264,_0x3eb871,_0x7b67('0x117'));}else{if(_0x15b1d9['countmachineretry']>=_0x102c3d[_0x7b67('0x118')]){_0x413df7[_0x7b67('0x119')](_0x15b1d9,_0x1c3264,_0x3eb871,_0x7b67('0x11a'));}else{hopperUtils[_0x7b67('0xcf')]({'active':![],'countmachineretry':_0x15b1d9[_0x7b67('0x11b')],'scheduledat':moment()[_0x7b67('0xe2')](_0x102c3d[_0x7b67('0x11c')],_0x7b67('0xd0'))['format'](_0x7b67('0xb7')),'ContactId':_0x15b1d9['ContactId'],'ListId':_0x15b1d9[_0x7b67('0xd1')],'VoiceQueueId':_0x15b1d9['VoiceQueueId']||undefined,'CampaignId':_0x15b1d9[_0x7b67('0xf1')]||undefined})[_0x7b67('0x94')](loggerCatch('[rescheduleContact][Machine]'));_0x1c3264({'reschedule':0x1});}}});}if(_0x12cd7c[_0x7b67('0x3e')]==='ivr'&&this[_0x7b67('0x1d')][_0x12cd7c['queue']]['dialAMDActive']&&_0x3eaad8[_0x7b67('0x105')]===_0x7b67('0x106')){delete this['uniqueId'][_0x3eaad8['uniqueid']];this[_0x7b67('0xb4')](this[_0x7b67('0x1d')][_0x12cd7c[_0x7b67('0xb5')]]);_0xc2466=new Hangup(_0x12cd7c,_0x3eaad8);_0xc2466[_0x7b67('0x69')]=0x12;_0xc2466[_0x7b67('0xc4')]=_0x7b67('0x108');_0xc2466[_0x7b67('0x109')]='AMD';ami[_0x7b67('0x110')](_0x7b67('0x11d'),ut[_0x7b67('0x10a')](_0xc2466,_0x7b67('0x10b')));this[_0x7b67('0x10c')](_0xc2466,'[syncHangupInAMDIvr][createHistory]',_0x7b67('0x11e'));}if(_0x12cd7c['type']===_0x7b67('0xb3')&&this[_0x7b67('0x1d')][_0x12cd7c[_0x7b67('0xb5')]][_0x7b67('0x104')]&&_0x3eaad8[_0x7b67('0x105')]===_0x7b67('0x10f')){return new Promise(function(_0x4ded38,_0x283017){delete _0x413df7['uniqueId'][_0x3eaad8['uniqueid']];_0x413df7[_0x7b67('0xb4')](_0x413df7[_0x7b67('0x1d')][_0x12cd7c[_0x7b67('0xb5')]]);_0x413df7[_0x7b67('0x1d')][_0x12cd7c[_0x7b67('0xb5')]]['outboundAnswerCallsDay']+=0x1;_0x413df7[_0x7b67('0x1d')][_0x12cd7c[_0x7b67('0xb5')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x4e97df=_0x413df7[_0x7b67('0x1d')][_0x12cd7c[_0x7b67('0xb5')]];var _0x255f2e=new Hangup(_0x12cd7c,_0x3eaad8);_0x255f2e[_0x7b67('0x69')]=0x13;_0x255f2e[_0x7b67('0xc4')]='Machine';_0x255f2e[_0x7b67('0x109')]=_0x7b67('0x11f');_0x255f2e[_0x7b67('0x11b')]+=0x1;_0x255f2e['countglobal']+=0x1;_0x255f2e[_0x7b67('0x10b')]=!![];ami[_0x7b67('0x110')](_0x7b67('0x11d'),ut[_0x7b67('0x10a')](_0x255f2e,_0x7b67('0x10b')));hopperUtils['createHistory'](_0x255f2e)[_0x7b67('0x94')](loggerCatch(_0x7b67('0x111')));if(_0x255f2e[_0x7b67('0x120')]+_0x255f2e[_0x7b67('0x112')]+_0x255f2e[_0x7b67('0x113')]+_0x255f2e['countnosuchnumberretry']+_0x255f2e[_0x7b67('0xc8')]+_0x255f2e[_0x7b67('0xdd')]+_0x255f2e[_0x7b67('0x11b')]+_0x255f2e[_0x7b67('0x114')]>=_0x4e97df['dialGlobalMaxRetry']){_0x413df7[_0x7b67('0x116')](_0x255f2e,_0x4ded38,_0x283017,_0x7b67('0x117'));}else{if(_0x255f2e[_0x7b67('0x11b')]>=_0x4e97df[_0x7b67('0x118')]){_0x413df7[_0x7b67('0x119')](_0x255f2e,_0x4ded38,_0x283017,'reason\x2019\x20machine....');}else{hopperUtils[_0x7b67('0xcf')]({'active':![],'countmachineretry':_0x255f2e[_0x7b67('0x11b')],'scheduledat':moment()[_0x7b67('0xe2')](_0x4e97df[_0x7b67('0x11c')],'minutes')[_0x7b67('0x43')](_0x7b67('0xb7')),'ContactId':_0x255f2e[_0x7b67('0xe3')],'ListId':_0x255f2e['ListId'],'VoiceQueueId':_0x255f2e[_0x7b67('0xd2')]||undefined,'CampaignId':_0x255f2e[_0x7b67('0xf1')]||undefined})[_0x7b67('0x94')](loggerCatch(_0x7b67('0x121')));_0x4ded38({'reschedule':0x1});}}});}}};Dialer[_0x7b67('0x16')][_0x7b67('0x33')]=function(_0x529313){var _0x37612c=this['uniqueId'][_0x529313['uniqueid']];var _0x45a506;if(_0x37612c&&_0x37612c[_0x7b67('0x3e')]===_0x7b67('0xb3')){delete this[_0x7b67('0x23')][_0x529313[_0x7b67('0xb6')]];this['updateOriginated'](this[_0x7b67('0x1d')][_0x37612c[_0x7b67('0xb5')]]);this[_0x7b67('0x1d')][_0x37612c[_0x7b67('0xb5')]][_0x7b67('0x122')]+=0x1;_0x45a506=new Hangup(_0x37612c,_0x529313);hopperUtils[_0x7b67('0xbd')](_0x45a506)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x45a506)['catch'](loggerCatch(_0x7b67('0x123')));}if(_0x37612c&&_0x37612c[_0x7b67('0x3e')]!=='ivr'&&isNotNull(this['voiceQueues'][_0x37612c[_0x7b67('0xb5')]]['dialQueueProject'])){delete this[_0x7b67('0x23')][_0x529313[_0x7b67('0xb6')]];this[_0x7b67('0xb4')](this[_0x7b67('0x1c')][_0x37612c[_0x7b67('0xb5')]]);this[_0x7b67('0x1c')][_0x37612c[_0x7b67('0xb5')]]['outboundAnswerCallsDay']+=0x1;this[_0x7b67('0x1c')][_0x37612c[_0x7b67('0xb5')]]['outboundAnswerAgiCallsDay']+=0x1;_0x45a506=new Hangup(_0x37612c,_0x529313);_0x45a506['state']=0x10;_0x45a506[_0x7b67('0xc4')]='AnswerAGI';_0x45a506[_0x7b67('0x109')]='AGI';hopperUtils[_0x7b67('0xbd')](_0x45a506)[_0x7b67('0x94')](loggerCatch(_0x7b67('0x124')));hopperUtils[_0x7b67('0xbf')](_0x45a506)[_0x7b67('0x94')](loggerCatch(_0x7b67('0x123')));}if(_0x37612c&&_0x37612c[_0x7b67('0x3e')]!==_0x7b67('0xb3')&&!isNotNull(this['voiceQueues'][_0x37612c[_0x7b67('0xb5')]][_0x7b67('0x125')])){if(_0x529313[_0x7b67('0x126')]===_0x7b67('0x127')){delete this[_0x7b67('0x23')][_0x529313[_0x7b67('0xb6')]];this[_0x7b67('0x1c')][_0x37612c[_0x7b67('0xb5')]][_0x7b67('0xb9')]+=0x1;const _0x106a0b=new AgentComplete(_0x37612c,_0x529313);_0x106a0b[_0x7b67('0xf1')]=this['voiceQueues'][_0x37612c[_0x7b67('0xb5')]]['id'];hopperUtils[_0x7b67('0xbd')](_0x106a0b)[_0x7b67('0x94')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x7b67('0xbf')](_0x106a0b)[_0x7b67('0x94')](loggerCatch(_0x7b67('0x128')));}else{delete this[_0x7b67('0x23')][_0x529313[_0x7b67('0xb6')]];this[_0x7b67('0xb4')](this[_0x7b67('0x1c')][_0x37612c[_0x7b67('0xb5')]]);this[_0x7b67('0x1c')][_0x37612c[_0x7b67('0xb5')]]['outboundUnknownCallsDay']+=0x1;_0x45a506=new Hangup(_0x37612c,_0x529313);_0x45a506[_0x7b67('0x69')]=0xc;_0x45a506[_0x7b67('0xc4')]=_0x529313['cause-txt'];_0x45a506['membername']=_0x7b67('0x129');hopperUtils['createHistory'](_0x45a506)['catch'](loggerCatch(_0x7b67('0x124')));hopperUtils[_0x7b67('0xbf')](_0x45a506)[_0x7b67('0x94')](loggerCatch(_0x7b67('0x123')));}}};Dialer['prototype'][_0x7b67('0xa')]=function(_0x4bf5b7){var _0x379f81=this;if(!_0x379f81['queuesSummary'][_0x4bf5b7[_0x7b67('0x44')]]){_0x379f81[_0x7b67('0x29')][_0x4bf5b7[_0x7b67('0x44')]]={'running':![]};}else if(_0x379f81[_0x7b67('0x29')][_0x4bf5b7[_0x7b67('0x44')]][_0x7b67('0x12a')]===!![]){return;}else if(_0x379f81[_0x7b67('0x29')][_0x4bf5b7[_0x7b67('0x44')]][_0x7b67('0x12a')]===![]){_0x379f81['queuesSummary'][_0x4bf5b7[_0x7b67('0x44')]][_0x7b67('0x12a')]=!![];}var _0x3e62ba=_0x379f81['voiceQueues'][_0x4bf5b7[_0x7b67('0x44')]];var _0x4f2ad2=_0x3e62ba[_0x7b67('0x64')]!==utils[_0x7b67('0x65')][_0x7b67('0x74')];var _0x576e92=utils['isPreviewCampaign'](_0x3e62ba);_0x3e62ba[_0x7b67('0x12b')]=utils['getQueueCampaignStatusMessage'](_0x3e62ba,_0x379f81['trunks']);Promise[_0x7b67('0x9e')]()['then'](function(){if(_0x3e62ba[_0x7b67('0x12b')]===utils['CAMPAIGN_STATUS']['INACTIVE']){if(_0x4f2ad2){clearPredictiveAttributes(_0x3e62ba);_0x4bf5b7[_0x7b67('0x25')]=undefined;_0x4bf5b7['startProgressive']=undefined;}if(_0x3e62ba[_0x7b67('0x12b')]===utils[_0x7b67('0x65')][_0x7b67('0x74')]){_0x4bf5b7[_0x7b67('0x12c')]=0x0;_0x4bf5b7[_0x7b67('0xee')]=0x0;_0x4bf5b7[_0x7b67('0x12d')]=0x0;_0x4bf5b7[_0x7b67('0x12e')]=0x0;_0x4bf5b7[_0x7b67('0x12f')]=0x0;}}else if(_0x3e62ba['statusMessage']===utils[_0x7b67('0x65')][_0x7b67('0x130')]&&!_0x576e92){return _0x379f81[_0x7b67('0x87')](_0x3e62ba,!![])[_0x7b67('0x3c')](function(){return _0x379f81['ifTime'](_0x3e62ba,![]);})[_0x7b67('0x3c')](function(){return _0x379f81[_0x7b67('0xa3')](_0x3e62ba);})[_0x7b67('0x94')](function(_0x511ec3){loggerSyncQueueSummary['debug'](_0x7b67('0x131'),util[_0x7b67('0x42')](_0x511ec3,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x3e62ba);});}else{clearPredictiveAttributes(_0x3e62ba);}})[_0x7b67('0x3c')](function(){var _0x51d474=_0x4bf5b7[_0x7b67('0x132')](_0x3e62ba);if(_0x51d474||_0x3e62ba['queueSummaryCountersUpdated']){_0x3e62ba['queueSummaryCountersUpdated']=![];_0x4bf5b7[_0x7b67('0x133')](_0x3e62ba);Object[_0x7b67('0x134')](_0x3e62ba,_0x4bf5b7);emitOutboundVoiceQueueSummary(_0x4bf5b7);}_0x379f81['queuesSummary'][_0x3e62ba[_0x7b67('0x44')]][_0x7b67('0x12a')]=![];})[_0x7b67('0x94')](function(_0x1918c5){logger[_0x7b67('0x61')](_0x7b67('0x131'),util[_0x7b67('0x42')](_0x1918c5,{'showHidden':![],'depth':null}));_0x379f81[_0x7b67('0x29')][_0x3e62ba[_0x7b67('0x44')]][_0x7b67('0x12a')]=![];});};Dialer['prototype'][_0x7b67('0x32')]=_[_0x7b67('0x135')](function(){var _0x5273a9=_[_0x7b67('0x136')](this[_0x7b67('0x1c')],function(_0xd3cf8a){return _0xd3cf8a[_0x7b67('0x137')];});var _0x30e598=_[_0x7b67('0x136')](this['agents'],function(_0x3b33b7){return _0x3b33b7[_0x7b67('0x138')]&&_0x3b33b7[_0x7b67('0x7f')]===_0x7b67('0x80');});if(_0x5273a9[_0x7b67('0x8f')]>0x0&&_0x30e598[_0x7b67('0x8f')]>0x0){return Promise[_0x7b67('0x9e')]()['then'](cmHopper[_0x7b67('0x139')](_[_0x7b67('0x13a')](_0x5273a9,'id'),previewRecallmeReminderInterval,_[_0x7b67('0x13a')](_0x30e598,'id')))[_0x7b67('0x3c')](function(_0x8b8e46){for(var _0x15a0f2=0x0;_0x15a0f2<_0x8b8e46[_0x7b67('0x8f')];_0x15a0f2++){var _0x4dde6e=_0x8b8e46[_0x15a0f2][_0x7b67('0x13b')][_0x7b67('0x44')];if(_0x4dde6e)io['to'](util[_0x7b67('0x43')]('user:%s',_0x4dde6e))[_0x7b67('0x110')](_0x7b67('0x13c'),{'hopper':_0x8b8e46[_0x15a0f2]});}})['catch'](function(_0x2107e3){logger[_0x7b67('0x61')](_0x7b67('0x13d'),_0x2107e3);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x7b67('0x16')][_0x7b67('0x3a')]=function(){var _0x4fea67=this;setInterval(function(){_0x4fea67[_0x7b67('0x13e')](_0x4fea67[_0x7b67('0x23')],_0x7b67('0x13f'));_0x4fea67['clearZombieChannels'](_0x4fea67[_0x7b67('0x22')],_0x7b67('0x140'));},0x32c8);};Dialer[_0x7b67('0x16')][_0x7b67('0x13e')]=function(_0x54c24b,_0x4a7156){var _0xfe81ff=this;for(var _0x2d3bbb in _0x54c24b){if(typeof _0x54c24b[_0x2d3bbb]!==_0x7b67('0x141')){this[_0x7b67('0x1a')][_0x7b67('0x17')](function(){if(!_['isNil'](_0x54c24b[_0x2d3bbb])){return ami[_0x7b67('0x91')]({'action':'status','channel':_0x54c24b[_0x2d3bbb][_0x7b67('0xe5')]})[_0x7b67('0x94')](function(_0x4c4119){if(_0x4c4119[_0x7b67('0x64')]===_0x7b67('0x142')){setTimeout(function(){if(_0x54c24b[_0x2d3bbb]&&_0x54c24b[_0x2d3bbb][_0x7b67('0x3e')]!==_0x7b67('0xb3')){_0xfe81ff[_0x7b67('0xb4')](_0xfe81ff[_0x7b67('0x1c')][_0x54c24b[_0x2d3bbb][_0x7b67('0xb5')]]);logger[_0x7b67('0x61')]('[Dialer][checkChannel]',_0x4a7156,_0x2d3bbb,_0x54c24b[_0x2d3bbb][_0x7b67('0xb5')]);delete _0x54c24b[_0x2d3bbb];}if(_0x54c24b[_0x2d3bbb]&&_0x54c24b[_0x2d3bbb]['type']===_0x7b67('0xb3')){_0xfe81ff[_0x7b67('0xb4')](_0xfe81ff[_0x7b67('0x1d')][_0x54c24b[_0x2d3bbb][_0x7b67('0xb5')]]);logger[_0x7b67('0x61')]('[Dialer][checkChannel][ivr]',_0x4a7156,_0x2d3bbb,_0x54c24b[_0x2d3bbb]['queue']);delete _0x54c24b[_0x2d3bbb];}},0x2328);}});}});}}};Dialer[_0x7b67('0x16')]['getVoiceQueueRtPauses']=function(_0x3fb839){return Promise[_0x7b67('0x9e')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x3fb839))['catch'](loggerCatch(_0x7b67('0x143')));};Dialer['prototype'][_0x7b67('0xb4')]=function(_0x379351){if(!_['isUndefined'](_0x379351)&&_0x379351!==null){if(typeof _0x379351[_0x7b67('0x78')]!==_0x7b67('0x141')){if(_0x379351[_0x7b67('0x78')]>0x0){_0x379351[_0x7b67('0x78')]-=0x1;}else{logger[_0x7b67('0x61')](_0x7b67('0x144'));}}}else{logger[_0x7b67('0x61')](_0x7b67('0x145'));}};Dialer[_0x7b67('0x16')][_0x7b67('0x146')]=function(_0x5c1015,_0x166c89){var _0x20c744=this;return function(_0x2cbb31){_0x20c744['updateOriginated'](_0x166c89);logger[_0x7b67('0x61')](_0x5c1015,util[_0x7b67('0x42')](_0x2cbb31,{'showHidden':![],'depth':null}));};};Dialer[_0x7b67('0x16')][_0x7b67('0x147')]=function(_0x3eea4c,_0x21ab8e,_0x17b4f3){var _0x7507f4={'state':0x19,'statedesc':'notFound'};this[_0x7b67('0xb4')](_0x21ab8e);this[_0x7b67('0x10c')](_[_0x7b67('0x5d')](_0x7507f4,_[_0x7b67('0x6f')](_0x17b4f3,[_0x7b67('0xe3'),_0x7b67('0xd1'),_0x7b67('0x148'),_0x7b67('0xd2'),_0x7b67('0xf1')])),_0x7b67('0x149'),_0x7b67('0x14a'));logger[_0x7b67('0x61')](_0x3eea4c);};Dialer['prototype'][_0x7b67('0x10c')]=function(_0xfcd15d,_0x213881,_0x1f0f7c){hopperUtils['createHistory'](_0xfcd15d)[_0x7b67('0x94')](loggerCatch(_0x213881));hopperUtils[_0x7b67('0xbf')](_0xfcd15d)['catch'](loggerCatch(_0x1f0f7c));};Dialer['prototype'][_0x7b67('0xce')]=function(_0x5845c9,_0xfa95bf){hopperUtils[_0x7b67('0xbd')](_0x5845c9)[_0x7b67('0x94')](loggerCatch(_0x7b67('0xbe')));if(_0xfa95bf==0x0){hopperUtils[_0x7b67('0xbf')](_0x5845c9)[_0x7b67('0x94')](loggerCatch(_0x7b67('0x14b')));}};Dialer[_0x7b67('0x16')][_0x7b67('0x13d')]=function(_0x4fa478){return Promise[_0x7b67('0x9e')]()[_0x7b67('0x3c')](cmHopper[_0x7b67('0x139')](_0x4fa478['id'],previewRecallmeReminderInterval))[_0x7b67('0x3c')](function(_0x2c3afb){for(var _0x487021=0x0;_0x487021<_0x2c3afb['length'];_0x487021++){var _0xf9ac25=_0x2c3afb[_0x487021][_0x7b67('0x13b')]['name'];if(_0xf9ac25)io['to'](util[_0x7b67('0x43')]('user:%s',_0xf9ac25))[_0x7b67('0x110')](_0x7b67('0x13c'),{'hopper':_0x2c3afb[_0x487021]});}})['catch'](function(){});};Dialer[_0x7b67('0x16')][_0x7b67('0x14c')]=function(_0x23b17f){var _0xea70e1=this;return function(){_0xea70e1['handleIvr'](_0x23b17f);};};Dialer['prototype'][_0x7b67('0x14d')]=function(_0x4ef116,_0x49317e){var _0x92a098=this;var _0x1493e0=uuid['v4']();this['actions'][_0x1493e0]=new Action(_0x4ef116,_0x49317e,_0x1493e0);return new Promise(function(_0x3ababc,_0x282a7d){if(_[_0x7b67('0x53')](_0x4ef116)&&typeof _0x4ef116!==_0x7b67('0x14e')){return _0x282a7d(msgResponse(_0x7b67('0x14f'),_0x7b67('0x88'),_0x7b67('0x150')));}if(_[_0x7b67('0x53')](_0x49317e[_0x7b67('0x151')])||_0x49317e['phone']===null){return _0x282a7d(msgResponse(_0x7b67('0x14f'),_0x7b67('0x88'),_0x7b67('0x152')));}var _0x16b35a={'XMD-CALLERID':_0x92a098[_0x7b67('0x22')][_0x1493e0][_0x7b67('0x153')](),'XMD-AGI':_0x4ef116['dialQueueProject']?util[_0x7b67('0x43')](_0x7b67('0x154'),ipAgi,_0x4ef116['dialQueueProject']):_0x7b67('0x155'),'XMD-AGIAFTER':_0x4ef116[_0x7b67('0xc7')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x4ef116[_0x7b67('0xc7')]):'NONE','XMD-QUEUE':utils[_0x7b67('0x156')](_0x4ef116)?util['format'](_0x7b67('0x157'),_0x4ef116[_0x7b67('0x44')],_0x4ef116[_0x7b67('0x158')]||'',_0x4ef116['dialAgiAfterHangupAgent']?'c':'',_0x4ef116[_0x7b67('0xc2')]||0x3):_0x7b67('0x155'),'XMD-CONTACTID':_0x49317e[_0x7b67('0xe3')],'XMD-CDRTYPE':_0x7b67('0x6'),'CALLERID(all)':_0x92a098[_0x7b67('0x22')][_0x1493e0][_0x7b67('0x153')](),'XMD-AMD':_0x4ef116[_0x7b67('0x104')]?'ACTIVE':_0x7b67('0x155'),'XMD-DESTINATION':_0x7b67('0x103')};if(_0x4ef116[_0x7b67('0x104')]){_0x16b35a[_0x7b67('0x159')]=_0x4ef116[_0x7b67('0x15a')]||0x9c4;_0x16b35a[_0x7b67('0x15b')]=_0x4ef116[_0x7b67('0x15c')]||0x5dc;_0x16b35a[_0x7b67('0x15d')]=_0x4ef116[_0x7b67('0x15e')]||0x320;_0x16b35a['XMD-AMDTOTALANALYSISTIME']=_0x4ef116['dialAMDTotalAnalysisTime']||0x1388;_0x16b35a['XMD-AMDMINWORDLENGTH']=_0x4ef116['dialAMDMinWordLength']||0x64;_0x16b35a[_0x7b67('0x15f')]=_0x4ef116[_0x7b67('0x160')]||0x32;_0x16b35a[_0x7b67('0x161')]=_0x4ef116[_0x7b67('0x162')]||0x3;_0x16b35a['XMD-AMDSILENCETHRESHOLD']=_0x4ef116[_0x7b67('0x163')]||0x100;_0x16b35a['XMD-AMDMAXIMUMWORDLENGTH']=_0x4ef116['dialAMDMaximumWordLength']||0x1388;}if(utils['isOutboundQueue'](_0x4ef116)){_0x16b35a[_0x7b67('0x164')]=_0x49317e[_0x7b67('0xd2')];}else{_0x16b35a['XMD-CAMPAIGNID']=_0x49317e[_0x7b67('0xf1')];}var _0x1a8387=utils[_0x7b67('0x165')](_0x49317e[_0x7b67('0x166')]);Object[_0x7b67('0x134')](_0x16b35a,_0x1a8387);var _0x3cf015=_0x92a098['isTrunkReachable'](_0x4ef116['Trunk'])?utils[_0x7b67('0x167')](_0x4ef116[_0x7b67('0x82')][_0x7b67('0x168')],_0x4ef116['dialOriginateCallerIdName'],_0x4ef116['dialRandomLastDigitCallerIdNumber']>0x0?utils['getCallerIdRandom'](_0x4ef116['dialOriginateCallerIdNumber'],_0x4ef116[_0x7b67('0x169')]):_0x4ef116[_0x7b67('0x16a')]):utils[_0x7b67('0x167')](_['isNil'](_0x4ef116[_0x7b67('0x16b')])?_0x4ef116[_0x7b67('0x82')][_0x7b67('0x168')]:_0x4ef116['TrunkBackup'][_0x7b67('0x168')],_0x4ef116[_0x7b67('0x16c')],_0x4ef116[_0x7b67('0x169')]>0x0?utils['getCallerIdRandom'](_0x4ef116[_0x7b67('0x16a')],_0x4ef116['dialRandomLastDigitCallerIdNumber']):_0x4ef116['dialOriginateCallerIdNumber']);if(_0x3cf015){_0x16b35a[_0x7b67('0x16d')]=_0x92a098[_0x7b67('0x22')][_0x1493e0][_0x7b67('0x16e')]=utils['extractCalleridName'](_0x3cf015);_0x16b35a[_0x7b67('0x16f')]=_0x49317e[_0x7b67('0x151')];}_0x4ef116[_0x7b67('0x170')]=_0x16b35a;return ami[_0x7b67('0x91')]({'actionid':_0x1493e0,'action':_0x7b67('0x14f'),'channel':_0x92a098[_0x7b67('0x7d')](_0x4ef116[_0x7b67('0x82')])?util['format'](_0x7b67('0x171'),_0x4ef116['Trunk'][_0x7b67('0x44')],isNotNull(_0x4ef116[_0x7b67('0x172')])?_0x4ef116[_0x7b67('0x172')]['trim']()||'':'',_0x4ef116[_0x7b67('0x173')]>0x0?_0x49317e['phone'][_0x7b67('0x174')](_0x4ef116[_0x7b67('0x173')]):_0x49317e[_0x7b67('0x151')]):util['format'](_0x7b67('0x171'),_['isNil'](_0x4ef116[_0x7b67('0x16b')])?_0x4ef116[_0x7b67('0x82')][_0x7b67('0x44')]:_0x4ef116[_0x7b67('0x16b')]['name'],isNotNull(_0x4ef116[_0x7b67('0x172')])?_0x4ef116[_0x7b67('0x172')][_0x7b67('0x175')]()||'':'',_0x4ef116[_0x7b67('0x173')]>0x0?_0x49317e['phone'][_0x7b67('0x174')](_0x4ef116[_0x7b67('0x173')]):_0x49317e[_0x7b67('0x151')]),'callerid':_0x3cf015,'Exten':'xcally-motion-dialer','Context':_0x7b67('0x176'),'Priority':'1','variable':_0x16b35a,'timeout':(_0x4ef116[_0x7b67('0x177')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1493e0})['then'](function(_0x5f04f6){return _0x3ababc(_0x5f04f6);})['catch'](function(_0x328847){_0x4ef116[_0x7b67('0x178')]+=0x1;var _0x51ee4b=new History(_0x92a098[_0x7b67('0x22')][_0x1493e0]);logger[_0x7b67('0x61')](util[_0x7b67('0x43')](_0x7b67('0x179'),JSON[_0x7b67('0x6e')](_0x328847)));_0x51ee4b[_0x7b67('0x69')]=0xe;_0x51ee4b['statedesc']=_0x7b67('0x17a');_0x51ee4b['starttime']=moment()[_0x7b67('0x43')](_0x7b67('0xb7'));_0x51ee4b[_0x7b67('0xd4')]=_0x51ee4b[_0x7b67('0x6a')];hopperUtils['createHistory'](_0x51ee4b)[_0x7b67('0x94')](loggerCatch('[originate][error]'));_0x92a098['moveContactManagedDialer'](_0x51ee4b)[_0x7b67('0x94')](loggerCatch(_0x7b67('0x17b')))[_0x7b67('0x19')](function(){delete _0x92a098[_0x7b67('0x22')][_0x1493e0];return _0x282a7d(msgResponse(_0x7b67('0x14f'),_0x7b67('0x17c'),_0x7b67('0x17d')));});});});};Dialer['prototype'][_0x7b67('0x17e')]=function(_0x3be230,_0x2ce51e,_0x20856d){var _0x4c615f=new History(_0x2ce51e);if(_0x4c615f[_0x7b67('0x120')]+_0x4c615f['countcongestionretry']+_0x4c615f[_0x7b67('0x113')]+_0x4c615f[_0x7b67('0x17f')]+_0x4c615f['countdropretry']+_0x4c615f['countabandonedretry']+_0x4c615f[_0x7b67('0x11b')]+_0x4c615f[_0x7b67('0x114')]>=_0x20856d['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x3be230){case 0x3:if(_0x4c615f[_0x7b67('0x113')]>=_0x20856d[_0x7b67('0x180')]-0x1){return!![];}hopperUtils[_0x7b67('0xcf')]({'active':![],'countnoanswerretry':_0x4c615f[_0x7b67('0x113')]+=0x1,'scheduledat':moment()[_0x7b67('0xe2')](_0x20856d[_0x7b67('0x181')],'minutes')[_0x7b67('0x43')](_0x7b67('0xb7')),'ContactId':_0x4c615f[_0x7b67('0xe3')],'ListId':_0x4c615f[_0x7b67('0xd1')],'VoiceQueueId':_0x4c615f['VoiceQueueId']||undefined,'CampaignId':_0x4c615f[_0x7b67('0xf1')]||undefined})['catch'](loggerCatch(_0x7b67('0x182')));break;case 0x5:if(_0x4c615f[_0x7b67('0x120')]>=_0x20856d[_0x7b67('0x183')]-0x1){return!![];}hopperUtils[_0x7b67('0xcf')]({'active':![],'countbusyretry':_0x4c615f[_0x7b67('0x120')]+=0x1,'scheduledat':moment()[_0x7b67('0xe2')](_0x20856d['dialBusyRetryFrequency'],_0x7b67('0xd0'))[_0x7b67('0x43')](_0x7b67('0xb7')),'ContactId':_0x4c615f['ContactId'],'ListId':_0x4c615f[_0x7b67('0xd1')],'VoiceQueueId':_0x4c615f['VoiceQueueId']||undefined,'CampaignId':_0x4c615f['CampaignId']||undefined})[_0x7b67('0x94')](loggerCatch(_0x7b67('0x184')));break;case 0x8:if(_0x4c615f[_0x7b67('0x112')]>=_0x20856d[_0x7b67('0x185')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x4c615f[_0x7b67('0x112')]+=0x1,'scheduledat':moment()[_0x7b67('0xe2')](_0x20856d[_0x7b67('0x186')],_0x7b67('0xd0'))[_0x7b67('0x43')](_0x7b67('0xb7')),'ContactId':_0x4c615f[_0x7b67('0xe3')],'ListId':_0x4c615f['ListId'],'VoiceQueueId':_0x4c615f['VoiceQueueId']||undefined,'CampaignId':_0x4c615f[_0x7b67('0xf1')]||undefined})['catch'](loggerCatch(_0x7b67('0x187')));break;case 0x0:if(_0x4c615f['countnosuchnumberretry']>=_0x20856d['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x7b67('0xcf')]({'active':![],'countnosuchnumberretry':_0x4c615f[_0x7b67('0x17f')]+=0x1,'scheduledat':moment()[_0x7b67('0xe2')](_0x20856d[_0x7b67('0x188')],_0x7b67('0xd0'))[_0x7b67('0x43')](_0x7b67('0xb7')),'ContactId':_0x4c615f['ContactId'],'ListId':_0x4c615f[_0x7b67('0xd1')],'VoiceQueueId':_0x4c615f[_0x7b67('0xd2')]||undefined,'CampaignId':_0x4c615f[_0x7b67('0xf1')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x4c615f[_0x7b67('0xc8')]>=_0x20856d[_0x7b67('0xcd')]-0x1){return!![];}hopperUtils[_0x7b67('0xcf')]({'active':![],'countdropretry':_0x4c615f[_0x7b67('0xc8')]+=0x1,'scheduledat':moment()[_0x7b67('0xe2')](_0x20856d[_0x7b67('0xc9')],_0x7b67('0xd0'))[_0x7b67('0x43')](_0x7b67('0xb7')),'ContactId':_0x4c615f['ContactId'],'ListId':_0x4c615f[_0x7b67('0xd1')],'VoiceQueueId':_0x4c615f[_0x7b67('0xd2')]||undefined,'CampaignId':_0x4c615f[_0x7b67('0xf1')]||undefined})[_0x7b67('0x94')](loggerCatch(_0x7b67('0xd3')));break;case 0xb:if(_0x4c615f['countabandonedretry']>=_0x20856d[_0x7b67('0xe0')]-0x1){return!![];}hopperUtils[_0x7b67('0xcf')]({'active':![],'countabandonedretry':_0x4c615f[_0x7b67('0xdd')]+=0x1,'scheduledat':moment()['add'](_0x20856d[_0x7b67('0xdf')],_0x7b67('0xd0'))[_0x7b67('0x43')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c615f[_0x7b67('0xe3')],'ListId':_0x4c615f[_0x7b67('0xd1')],'VoiceQueueId':_0x4c615f[_0x7b67('0xd2')]||undefined,'CampaignId':_0x4c615f[_0x7b67('0xf1')]||undefined})['catch'](loggerCatch(_0x7b67('0x189')));break;case 0x13:if(_0x4c615f['countmachineretry']>=_0x20856d[_0x7b67('0x118')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x4c615f[_0x7b67('0x11b')]+=0x1,'scheduledat':moment()[_0x7b67('0xe2')](_0x20856d[_0x7b67('0x11c')],'minutes')[_0x7b67('0x43')](_0x7b67('0xb7')),'ContactId':_0x4c615f['ContactId'],'ListId':_0x4c615f['ListId'],'VoiceQueueId':_0x4c615f['VoiceQueueId']||undefined,'CampaignId':_0x4c615f[_0x7b67('0xf1')]||undefined})[_0x7b67('0x94')](loggerCatch(_0x7b67('0x121')));break;case 0x14:if(_0x4c615f['countagentrejectretry']>=_0x20856d[_0x7b67('0x18a')]-0x1){return!![];}hopperUtils[_0x7b67('0xcf')]({'active':![],'countagentrejectretry':_0x4c615f['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x20856d[_0x7b67('0x18b')],_0x7b67('0xd0'))[_0x7b67('0x43')](_0x7b67('0xb7')),'ContactId':_0x4c615f[_0x7b67('0xe3')],'ListId':_0x4c615f[_0x7b67('0xd1')],'VoiceQueueId':_0x4c615f['VoiceQueueId']||undefined,'CampaignId':_0x4c615f[_0x7b67('0xf1')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x7b67('0x16')][_0x7b67('0xff')]=function(_0x3bf62d,_0x133ef6,_0x1f643a){var _0x52f3fe=this;var _0x27e9d7=new History(_0x3bf62d);var _0x57a7e5=![];var _0x14c200;var _0x148675;return new Promise(function(_0x3ff3b3,_0x1ee300){if(_[_0x7b67('0x53')](_0x133ef6)&&typeof _0x133ef6!==_0x7b67('0x14e')){return _0x1ee300(msgResponse(_0x7b67('0x18c'),_0x7b67('0x88'),_0x7b67('0x18d')));}if(_[_0x7b67('0x53')](_0x1f643a)&&typeof _0x1f643a!=='object'){return _0x1ee300(msgResponse(_0x7b67('0x18c'),'Failure','evt\x20is\x20undefine'));}hopperUtils[_0x7b67('0xcb')](_0x27e9d7,_0x1f643a[_0x7b67('0xba')],_0x133ef6)[_0x7b67('0x3c')](function(_0x38c621){if(_0x38c621[_0x7b67('0xe1')]==0x1)_0x57a7e5=!![];switch(_0x1f643a[_0x7b67('0xba')]){case'0':_0x133ef6[_0x7b67('0x18e')]+=0x1;_0x27e9d7[_0x7b67('0x69')]=0x0;_0x27e9d7['statedesc']=_0x7b67('0x18f');_0x27e9d7[_0x7b67('0x17f')]+=0x1;_0x27e9d7[_0x7b67('0xde')]+=0x1;ami['emit'](_0x7b67('0x190'),ut[_0x7b67('0x10a')](_0x3bf62d,'nosuchnumber'));_0x14c200=_0x133ef6['dialNoSuchNumberRetryFrequency'];_0x148675=_0x133ef6[_0x7b67('0xca')];hopperUtils[_0x7b67('0xbd')](_0x27e9d7)[_0x7b67('0x94')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x52f3fe[_0x7b67('0x17e')](0x0,_0x3bf62d,_0x133ef6)&&!_0x57a7e5){if(_0x27e9d7[_0x7b67('0x17f')]>=_0x133ef6[_0x7b67('0x191')]){_0x52f3fe[_0x7b67('0x119')](_0x27e9d7,_0x3ff3b3,_0x1ee300,_0x7b67('0x192'));}else{_0x52f3fe[_0x7b67('0x116')](_0x27e9d7,_0x3ff3b3,_0x1ee300,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x133ef6[_0x7b67('0x193')]+=0x1;_0x27e9d7['state']=0x3;_0x27e9d7[_0x7b67('0xc4')]='NoAnswer';_0x27e9d7['countnoanswerretry']+=0x1;_0x27e9d7[_0x7b67('0xde')]+=0x1;var _0x342347=ut[_0x7b67('0x194')](_0x3bf62d,_0x133ef6);ami[_0x7b67('0x110')]('custom:agentnoanswer',_0x342347);_0x14c200=_0x133ef6[_0x7b67('0x181')];_0x148675=_0x133ef6[_0x7b67('0xca')];hopperUtils[_0x7b67('0xbd')](_0x27e9d7)[_0x7b67('0x94')](loggerCatch(_0x7b67('0x195')));if(_0x52f3fe[_0x7b67('0x17e')](0x3,_0x3bf62d,_0x133ef6)&&!_0x57a7e5){if(_0x27e9d7[_0x7b67('0x113')]>=_0x133ef6[_0x7b67('0x180')]){_0x52f3fe[_0x7b67('0x119')](_0x27e9d7,_0x3ff3b3,_0x1ee300,_0x7b67('0x196'));}else{_0x52f3fe[_0x7b67('0x116')](_0x27e9d7,_0x3ff3b3,_0x1ee300,_0x7b67('0x196'));}}break;case'5':_0x133ef6['outboundBusyCallsDay']+=0x1;_0x27e9d7[_0x7b67('0x69')]=0x5;_0x27e9d7[_0x7b67('0xc4')]=_0x7b67('0x197');_0x27e9d7[_0x7b67('0x120')]+=0x1;_0x27e9d7['countglobal']+=0x1;ami[_0x7b67('0x110')]('custom:agentbusy',ut[_0x7b67('0x10a')](_0x3bf62d,_0x7b67('0x198')));_0x14c200=_0x133ef6['dialBusyRetryFrequency'];_0x148675=_0x133ef6['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x27e9d7)[_0x7b67('0x94')](loggerCatch(_0x7b67('0x199')));if(_0x52f3fe[_0x7b67('0x17e')](0x5,_0x3bf62d,_0x133ef6)&&!_0x57a7e5){if(_0x27e9d7[_0x7b67('0x120')]>=_0x133ef6[_0x7b67('0x183')]){_0x52f3fe[_0x7b67('0x119')](_0x27e9d7,_0x3ff3b3,_0x1ee300,_0x7b67('0x19a'));}else{_0x52f3fe[_0x7b67('0x116')](_0x27e9d7,_0x3ff3b3,_0x1ee300,_0x7b67('0x19a'));}}break;case'8':_0x133ef6['outboundCongestionCallsDay']+=0x1;_0x27e9d7['state']=0x8;_0x27e9d7[_0x7b67('0xc4')]=_0x7b67('0x19b');_0x27e9d7[_0x7b67('0x112')]+=0x1;_0x27e9d7[_0x7b67('0xde')]+=0x1;_0x14c200=_0x133ef6[_0x7b67('0x186')];_0x148675=_0x133ef6[_0x7b67('0xca')];ami[_0x7b67('0x110')](_0x7b67('0x19c'),ut[_0x7b67('0x10a')](_0x3bf62d,_0x7b67('0x19d')));hopperUtils['createHistory'](_0x27e9d7)[_0x7b67('0x94')](loggerCatch(_0x7b67('0x19e')));if(_0x52f3fe['checkRetriveMax'](0x8,_0x3bf62d,_0x133ef6)&&!_0x57a7e5){if(_0x27e9d7['countcongestionretry']>=_0x133ef6['dialCongestionMaxRetry']){_0x52f3fe[_0x7b67('0x119')](_0x27e9d7,_0x3ff3b3,_0x1ee300,'reason\x208\x20congestion');}else{_0x52f3fe[_0x7b67('0x116')](_0x27e9d7,_0x3ff3b3,_0x1ee300,_0x7b67('0x19f'));}}break;case'11':_0x133ef6[_0x7b67('0x1a0')]+=0x1;_0x27e9d7['state']=0xb;_0x27e9d7[_0x7b67('0xc4')]=_0x7b67('0xda');_0x27e9d7[_0x7b67('0xdd')]+=0x1;_0x27e9d7[_0x7b67('0xde')]+=0x1;_0x14c200=_0x133ef6['dialAbandonedRetryFrequency'];_0x148675=_0x133ef6[_0x7b67('0xca')];hopperUtils['createHistory'](_0x27e9d7)[_0x7b67('0x94')](loggerCatch(_0x7b67('0xe4')));if(_0x52f3fe[_0x7b67('0x17e')](0xb,_0x3bf62d,_0x133ef6)&&!_0x57a7e5){if(_0x27e9d7['countabandonedretry']>=_0x133ef6['dialAbandonedMaxRetry']){_0x52f3fe[_0x7b67('0x119')](_0x27e9d7,_0x3ff3b3,_0x1ee300,_0x7b67('0x1a1'));}else{_0x52f3fe['stateGlobal'](_0x27e9d7,_0x3ff3b3,_0x1ee300,_0x7b67('0x1a1'));}}break;case'20':_0x133ef6[_0x7b67('0x1a2')]+=0x1;_0x27e9d7[_0x7b67('0x69')]=0x14;_0x27e9d7['statedesc']=_0x7b67('0x1a3');_0x27e9d7[_0x7b67('0x114')]+=0x1;_0x27e9d7[_0x7b67('0xde')]+=0x1;_0x14c200=_0x133ef6[_0x7b67('0x18b')];_0x148675=_0x133ef6[_0x7b67('0xca')];ami[_0x7b67('0x110')](_0x7b67('0x1a4'),ut['buildObj'](_0x3bf62d,_0x7b67('0x1a5')));hopperUtils[_0x7b67('0xbd')](_0x27e9d7)[_0x7b67('0x94')](loggerCatch(_0x7b67('0x1a6')));if(_0x52f3fe[_0x7b67('0x17e')](0x14,_0x3bf62d,_0x133ef6)&&!_0x57a7e5){if(_0x27e9d7['countagentrejectretry']>=_0x133ef6[_0x7b67('0x18a')]){_0x52f3fe[_0x7b67('0x119')](_0x27e9d7,_0x3ff3b3,_0x1ee300,_0x7b67('0x1a7'));}else{_0x52f3fe[_0x7b67('0x116')](_0x27e9d7,_0x3ff3b3,_0x1ee300,_0x7b67('0x1a7'));}}break;default:_0x133ef6[_0x7b67('0x1a8')]+=0x1;_0x27e9d7['state']=0xc;_0x27e9d7[_0x7b67('0xc4')]=_0x1f643a[_0x7b67('0xba')];_0x14c200=_0x133ef6[_0x7b67('0x18b')];_0x148675=_0x133ef6[_0x7b67('0xca')];hopperUtils[_0x7b67('0xbd')](_0x27e9d7)[_0x7b67('0x94')](loggerCatch(_0x7b67('0x1a9')));if(_0x52f3fe[_0x7b67('0x17e')](_0x1f643a[_0x7b67('0xba')],_0x3bf62d,_0x133ef6)&&!_0x57a7e5){if(_0x27e9d7[_0x7b67('0x120')]+_0x27e9d7[_0x7b67('0x112')]+_0x27e9d7[_0x7b67('0x113')]+_0x27e9d7[_0x7b67('0x17f')]+_0x27e9d7[_0x7b67('0xc8')]+_0x27e9d7[_0x7b67('0xdd')]+_0x27e9d7[_0x7b67('0x11b')]+_0x27e9d7['countagentrejectretry']>=_0x133ef6[_0x7b67('0x115')]){_0x52f3fe[_0x7b67('0x116')](_0x27e9d7,_0x3ff3b3,_0x1ee300,_0x1f643a['reason']);}else{_0x52f3fe[_0x7b67('0x119')](_0x27e9d7,_0x3ff3b3,_0x1ee300,_0x1f643a[_0x7b67('0xba')]);}}}})[_0x7b67('0x3c')](function(){if(_0x57a7e5){hopperUtils[_0x7b67('0xd8')](_0x27e9d7,_0x14c200,_0x148675)[_0x7b67('0x3c')](function(){return _0x3ff3b3(0x1);});}});});};Dialer[_0x7b67('0x16')]['stateGlobal']=function(_0x172ca8,_0x4cf1d3,_0x4f986a,_0x1f714e){var _0x249be4=new Final(_0x172ca8);_0x249be4[_0x7b67('0x69')]=0xf;_0x249be4[_0x7b67('0xc4')]=_0x7b67('0x1aa');this['createStateFinal'](_0x249be4,_0x4cf1d3,_0x4f986a,_0x1f714e);};Dialer[_0x7b67('0x16')][_0x7b67('0x119')]=function(_0x38fcd9,_0x3123da,_0x5dd82f,_0x5e990f){hopperUtils[_0x7b67('0xbf')](_0x38fcd9)['then'](function(){return _0x3123da(msgResponse(_0x7b67('0x18c'),'Success',_0x5e990f));})[_0x7b67('0x94')](function(){return _0x5dd82f(msgResponse(_0x7b67('0x1ab'),_0x7b67('0x88'),_0x7b67('0x1ac')));});};Dialer[_0x7b67('0x16')][_0x7b67('0x8')]=function(_0x1c28a7){var _0xc38ecd=_0x1c28a7[_0x7b67('0x1ad')]/0x64;var _0x31edf7=_0x1c28a7['outboundDropCallsDayTimeout']/(_0x1c28a7[_0x7b67('0x1ae')]+_0x1c28a7[_0x7b67('0xb9')]);var _0x181a9e=Math['round'](_0x1c28a7[_0x7b67('0x1af')]*(_0x1c28a7['predictiveIntervalMaxThreshold']/0x64));var _0x490cda=Math[_0x7b67('0x1b0')](_0x1c28a7[_0x7b67('0x1af')]*(_0x1c28a7[_0x7b67('0x1b1')]/0x64));var _0x917ba5=_0x1c28a7['available']+_0x1c28a7[_0x7b67('0x12e')];var _0x1f07dc=Math['floor'](_0x1c28a7[_0x7b67('0x1b2')]*_0x1c28a7[_0x7b67('0x59')]*_0x1c28a7[_0x7b67('0x1b3')]*_0x1c28a7[_0x7b67('0x1b4')]);if(_[_0x7b67('0x53')](_0x1c28a7['startProgressive'])){if(!_[_0x7b67('0x53')](_0x1c28a7[_0x7b67('0x25')])){_0x1c28a7['startPredictive']=undefined;loggerPredictive[_0x7b67('0x61')](_0x7b67('0x1b5'),_0x7b67('0x1b6'));}if(!_[_0x7b67('0x53')](_0x1c28a7[_0x7b67('0x5f')])){loggerPredictive[_0x7b67('0x61')](_0x7b67('0x1b5'),_0x7b67('0x1b7'));clearInterval(_0x1c28a7[_0x7b67('0x5f')]);_0x1c28a7['handlePredictive']=undefined;}_0x1c28a7['startProgressive']=moment()[_0x7b67('0x43')](_0x7b67('0xb7'));loggerPredictive[_0x7b67('0x47')](_0x1c28a7[_0x7b67('0x44')],'collection\x20data\x20in\x20progressive\x20at',_0x1c28a7['startProgressive']);this[_0x7b67('0xa7')](_0x1c28a7,0x1);}else if(ifInterval(_0x1c28a7['dialPredictiveInterval'],_0x1c28a7['startProgressive'])){this[_0x7b67('0xa7')](_0x1c28a7,0x1);loggerPredictiveCalls['info'](_0x7b67('0x1b8'),_0x1c28a7[_0x7b67('0x26')],_0x1c28a7[_0x7b67('0x44')]);_0x1c28a7['erlangCalls']=0x0;_0x1c28a7[_0x7b67('0xc3')]=0x0;}else if(_0xc38ecd<_0x31edf7&&_0x1c28a7[_0x7b67('0x1b9')]===_0x7b67('0x1ba')){clearPredictiveAttributes(_0x1c28a7);loggerPredictive[_0x7b67('0x47')](_0x7b67('0x1bb'),_0x7b67('0x1bc'),_0x31edf7,'startProgressive',_0x1c28a7[_0x7b67('0x44')]);}else if(_0x1f07dc<_0x1c28a7[_0x7b67('0xc3')]&&_0x1c28a7[_0x7b67('0x1b9')]===_0x7b67('0x1ba')){clearPredictiveAttributes(_0x1c28a7);loggerPredictive[_0x7b67('0x47')](_0x7b67('0x1bd'),'Max\x20Drop\x20',_0x1f07dc,_0x7b67('0x1be'),_0x1c28a7['predictiveIntervalErlangCallsDroppedCalls'],_0x7b67('0x26'),_0x1c28a7[_0x7b67('0x44')]);}else if(!ifInterval(_0x1c28a7[_0x7b67('0x1bf')],_0x1c28a7[_0x7b67('0x26')])&&_[_0x7b67('0x53')](_0x1c28a7[_0x7b67('0x25')])&&!_[_0x7b67('0x53')](_0x1c28a7['startProgressive'])){_0x1c28a7['startPredictive']=moment()[_0x7b67('0x43')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x1c28a7[_0x7b67('0x44')],'started\x20in\x20predictive\x20at',_0x1c28a7[_0x7b67('0x25')]);hopperUtils[_0x7b67('0x1c0')](_0x1c28a7[_0x7b67('0x1bf')])[_0x7b67('0x3c')](this['getDataPredictive'](_0x1c28a7))[_0x7b67('0x3c')](mergeDataErlangB(_0x1c28a7))[_0x7b67('0x3c')](this[_0x7b67('0x1c1')](_0x1c28a7))[_0x7b67('0x94')](loggerCatchPredictive(_0x7b67('0x1c2'),_0x1c28a7));}else if(!ifInterval(_0x1c28a7[_0x7b67('0x1bf')],_0x1c28a7['startPredictive'])){_0x1c28a7[_0x7b67('0xc3')]=0x0;_0x1c28a7['startPredictive']=moment()[_0x7b67('0x43')](_0x7b67('0xb7'));loggerPredictive[_0x7b67('0x47')](_0x1c28a7['name'],_0x7b67('0x1c3'),_0x1c28a7[_0x7b67('0x25')]);clearInterval(_0x1c28a7['handlePredictive']);_0x1c28a7[_0x7b67('0x5f')]=undefined;hopperUtils[_0x7b67('0x1c0')](_0x1c28a7[_0x7b67('0x1bf')])[_0x7b67('0x3c')](this['getDataPredictive'](_0x1c28a7))['then'](mergeDataErlangB(_0x1c28a7))[_0x7b67('0x3c')](this[_0x7b67('0x1c1')](_0x1c28a7))['catch'](loggerCatchPredictive(_0x7b67('0x1c4'),_0x1c28a7));}else if(_0x1c28a7[_0x7b67('0x1af')]&&_0x917ba5<_0x1c28a7[_0x7b67('0x1af')]-_0x490cda){clearPredictiveAttributes(_0x1c28a7);loggerPredictive[_0x7b67('0x47')](_0x1c28a7['name'],_0x7b67('0x1c5'),_0x917ba5,_0x7b67('0x1c6'),_0x1c28a7[_0x7b67('0x1af')],'-',_0x490cda,'=',_0x1c28a7['predictiveIntervalAvailable']-_0x490cda,')');}else if(_0x1c28a7[_0x7b67('0x1af')]&&_0x917ba5>_0x1c28a7[_0x7b67('0x1af')]+_0x181a9e){clearPredictiveAttributes(_0x1c28a7);loggerPredictive['info'](_0x1c28a7[_0x7b67('0x44')],_0x7b67('0x1c5'),_0x917ba5,_0x7b67('0x1c7'),_0x1c28a7['predictiveIntervalAvailable'],'+',_0x181a9e,'=',_0x1c28a7[_0x7b67('0x1af')]+_0x181a9e,')');}};Dialer[_0x7b67('0x16')][_0x7b67('0x1c8')]=function(_0x3fd131){var _0x418b6b=this;return function(_0x2239ab){return new Promise(function(_0x5bb777,_0x27b322){_[_0x7b67('0x5d')](_0x3fd131,_0x2239ab[0x0]);if(checkGetDataPredictive(_0x2239ab[0x0])){var _0x56a641=_0x3fd131[_0x7b67('0x1af')]=_0x3fd131[_0x7b67('0x12e')]+_0x3fd131[_0x7b67('0x12c')];var _0x49f2e5=_0x3fd131['dialPredictiveInterval']*0x3c;var _0x9991a=_0x2239ab[0x0]['predictiveIntervalAvgTalktime']+_0x2239ab[0x0][_0x7b67('0x4f')];var _0x194ff0=(_0x2239ab[0x0][_0x7b67('0x4b')]+_0x2239ab[0x0][_0x7b67('0x4c')]+_0x2239ab[0x0][_0x7b67('0x4d')])/_0x2239ab[0x0][_0x7b67('0x49')];_0x3fd131[_0x7b67('0x1b3')]=_0x194ff0>0x0?_0x194ff0:0x1;switch(_0x3fd131[_0x7b67('0x1b9')]){case'dropRate':var _0x3c70f7=_0x3fd131[_0x7b67('0x1ad')]/0x64;return _0x418b6b[_0x7b67('0x1c9')](_0x56a641,_0x49f2e5,_0x9991a,_0x194ff0,_0x3c70f7)[_0x7b67('0x3c')](function(_0x269cbf){return _0x5bb777(_0x269cbf);});case _0x7b67('0x1ca'):var _0x1a4e63=_0x3fd131[_0x7b67('0x1ad')]/0x64;return _0x418b6b[_0x7b67('0x1cb')](_0x56a641,_0x49f2e5,_0x9991a,_0x194ff0,_0x1a4e63)[_0x7b67('0x3c')](function(_0x3c8577){return _0x5bb777(_0x3c8577);});default:return _0x27b322(msgResponse(_0x7b67('0x1cc'),_0x7b67('0x88'),'Unknown\x20Predictive'));}}else{return _0x27b322(msgResponse('[getDataPredictive]',_0x7b67('0x88'),'check\x20failure'));}});};};Dialer['prototype'][_0x7b67('0x1cd')]=function(_0x3d6999){var _0x516e21=this;return function(_0x36193a){return new Promise(function(_0x3682f3,_0x59045d){_['merge'](_0x3d6999,_0x36193a[0x0]);if(checkGetDataPredictive(_0x36193a[0x0])){loggerPredictive['info'](JSON[_0x7b67('0x6e')](_0x36193a[0x0]));if(_0x3d6999[_0x7b67('0x1b9')]===_0x7b67('0x1ba')){return _0x516e21[_0x7b67('0x1ce')](_0x3d6999['id'])[_0x7b67('0x3c')](function(_0x23f5fc){var _0x21e849=_0x3d6999[_0x7b67('0x1cf')]-_0x23f5fc[0x0][_0x7b67('0x1d0')];var _0xff21a=_0x3d6999[_0x7b67('0x1bf')]*0x3c;var _0x5abb7d=_0x36193a[0x0]['predictiveIntervalAvgTalktime']+_0x36193a[0x0][_0x7b67('0x4f')];var _0x2524a7=(_0x36193a[0x0][_0x7b67('0x4b')]+_0x36193a[0x0][_0x7b67('0x4c')]+_0x36193a[0x0][_0x7b67('0x4d')])/_0x36193a[0x0][_0x7b67('0x49')];var _0x4e6685=_0x3d6999[_0x7b67('0x1ad')]/0x64;_0x3d6999[_0x7b67('0x1d1')]=_0x23f5fc[0x0][_0x7b67('0x1d0')]||0x0;_0x3d6999[_0x7b67('0x1b3')]=_0x2524a7>0x0?_0x2524a7:0x1;return _0x516e21['abandonmentRate'](_0x21e849,_0xff21a,_0x5abb7d,_0x2524a7,_0x4e6685);})[_0x7b67('0x3c')](function(_0x1f232a){return _0x3682f3(_0x1f232a);})[_0x7b67('0x94')](function(_0x1e1df2){return _0x59045d(msgResponse('[CatchErlangB]',_0x7b67('0x88'),JSON[_0x7b67('0x6e')](_0x1e1df2)));});}if(_0x3d6999[_0x7b67('0x1b9')]===_0x7b67('0x1ca')){return _0x516e21['getVoiceQueueRtPauses'](_0x3d6999['id'])[_0x7b67('0x3c')](function(_0xc1d593){var _0x4d21cc=_0x3d6999[_0x7b67('0x1cf')]-_0xc1d593[0x0]['outboundQueuePauses'];var _0x42118f=_0x3d6999[_0x7b67('0x1bf')]*0x3c;var _0x517da5=_0x36193a[0x0][_0x7b67('0x50')]+_0x36193a[0x0]['predictiveIntervalAvgHoldtime'];var _0x33ccc2=(_0x36193a[0x0][_0x7b67('0x4b')]+_0x36193a[0x0][_0x7b67('0x4c')]+_0x36193a[0x0][_0x7b67('0x4d')])/_0x36193a[0x0][_0x7b67('0x49')];var _0x342568=_0x3d6999['dialPredictiveOptimizationPercentage']/0x64;_0x3d6999[_0x7b67('0x1d1')]=_0xc1d593[0x0][_0x7b67('0x1d0')]||0x0;_0x3d6999[_0x7b67('0x1b3')]=_0x33ccc2>0x0?_0x33ccc2:0x1;return _0x516e21[_0x7b67('0x1cb')](_0x4d21cc,_0x42118f,_0x517da5,_0x33ccc2,_0x342568);})['then'](function(_0x276094){return _0x3682f3(_0x276094);})[_0x7b67('0x94')](function(_0x2251cb){return _0x59045d(msgResponse('[CatchErlangB]',_0x7b67('0x88'),JSON[_0x7b67('0x6e')](_0x2251cb)));});}}else{return _0x59045d(msgResponse(_0x7b67('0x1cc'),'Failure',_0x7b67('0x1d2')));}});};};Dialer[_0x7b67('0x16')][_0x7b67('0x1c1')]=function(_0x4acd5f){var _0x1383a1=this;return function(){var _0x317b67=0x0;var _0x1cb4b8=Math[_0x7b67('0x1d3')](_0x4acd5f[_0x7b67('0x58')]*0x3e8);if(_0x1cb4b8>0x0){_0x1cb4b8=_0x1cb4b8<0x64?0x64:_0x1cb4b8;loggerPredictive['info'](_0x4acd5f['name'],_0x7b67('0x1d4'),_0x1cb4b8,_0x7b67('0x1d5'));_0x4acd5f[_0x7b67('0x5f')]=setInterval(function(){_0x1383a1[_0x7b67('0x5f')](_0x4acd5f);loggerPredictiveCalls['info'](_0x7b67('0x1d6'),_0x317b67+=0x1);},_0x1cb4b8);}else{loggerPredictive[_0x7b67('0x47')](_0x4acd5f[_0x7b67('0x44')],_0x7b67('0x1d7'));}};};Dialer[_0x7b67('0x16')][_0x7b67('0x1d8')]=function(_0x1e6d4a,_0x2b612a){var _0x2e6a19=this;return function(_0x32da11){if(_[_0x7b67('0x46')](_0x32da11)){if(_[_0x7b67('0xea')](_0x2b612a[_0x7b67('0x148')])||!_0x2b612a[_0x7b67('0x1d9')]){if(_0x1e6d4a[_0x7b67('0xa4')]==='booked'){_0x1e6d4a[_0x7b67('0x6b')]=_[_0x7b67('0x53')](_0x1e6d4a[_0x7b67('0x6b')])?!![]:_0x1e6d4a[_0x7b67('0x6b')];var _0x4621ef=uuid['v4']();_0x2e6a19[_0x7b67('0x22')][_0x4621ef]=new Action(_0x1e6d4a,_0x2b612a,_0x4621ef);loggerBooked[_0x7b67('0x47')]('[booked][checkContactBlack]',_0x4621ef,'queueStatusComplete:\x20',JSON[_0x7b67('0x6e')](_0x1e6d4a[_0x7b67('0x6b')]),_0x7b67('0x1da'),_0x1e6d4a['name']);if(_0x1e6d4a[_0x7b67('0x6b')]){_0x1e6d4a['queueStatusComplete']=![];_0x2e6a19[_0x7b67('0xed')][_0x2e6a19[_0x7b67('0x22')][_0x4621ef][_0x7b67('0xb5')]]=[];ami[_0x7b67('0x91')]({'actionid':_0x4621ef,'action':'queuestatus','queue':_0x1e6d4a[_0x7b67('0x44')]})['catch'](function(){_0x2e6a19[_0x7b67('0xb4')](_0x1e6d4a);hopperUtils[_0x7b67('0xcf')]({'active':![],'ContactId':_0x2e6a19[_0x7b67('0x22')][_0x4621ef][_0x7b67('0xe3')],'ListId':_0x2e6a19[_0x7b67('0x22')][_0x4621ef][_0x7b67('0xd1')],'VoiceQueueId':_0x2e6a19[_0x7b67('0x22')][_0x4621ef][_0x7b67('0xd2')]||undefined,'CampaignId':_0x2e6a19[_0x7b67('0x22')][_0x4621ef][_0x7b67('0xf1')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2e6a19[_0x7b67('0x22')][_0x4621ef];});}else{loggerBooked[_0x7b67('0x47')](_0x7b67('0x1db'),JSON[_0x7b67('0x6e')](_0x1e6d4a[_0x7b67('0x6b')]),'Queue:\x20',_0x1e6d4a['name']);_0x2e6a19[_0x7b67('0xb4')](_0x1e6d4a);hopperUtils[_0x7b67('0xcf')]({'active':![],'ContactId':_0x2e6a19[_0x7b67('0x22')][_0x4621ef][_0x7b67('0xe3')],'ListId':_0x2e6a19[_0x7b67('0x22')][_0x4621ef][_0x7b67('0xd1')],'VoiceQueueId':_0x2e6a19[_0x7b67('0x22')][_0x4621ef][_0x7b67('0xd2')]||undefined,'CampaignId':_0x2e6a19[_0x7b67('0x22')][_0x4621ef][_0x7b67('0xf1')]||undefined})['catch'](loggerCatch(_0x7b67('0x1dc')));delete _0x2e6a19[_0x7b67('0x22')][_0x4621ef];}}else{return _0x2e6a19[_0x7b67('0x14d')](_0x1e6d4a,_0x2b612a);}}else{if(utils['getSeconds'](undefined,_0x2b612a[_0x7b67('0x1dd')])<_0x1e6d4a[_0x7b67('0x1de')]*0x3c){if(_0x2b612a['Agent']&&!_0x2b612a[_0x7b67('0x13b')][_0x7b67('0x1df')]){_0x2e6a19['preview']['run'](_0x2b612a['id'])[_0x7b67('0x19')](function(){_0x2e6a19['updateOriginated'](_0x1e6d4a);});}else{hopperUtils[_0x7b67('0x1e0')]({'active':![]},_0x2b612a['id'],0x1)[_0x7b67('0x19')](function(){_0x2e6a19[_0x7b67('0xb4')](_0x1e6d4a);});}}else{_0x1e6d4a[_0x7b67('0x1e1')]+=0x1;_0x2e6a19[_0x7b67('0xb4')](_0x1e6d4a);if(_0x1e6d4a[_0x7b67('0x1e2')]){hopperUtils[_0x7b67('0xcf')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2b612a[_0x7b67('0xe3')],'ListId':_0x2b612a[_0x7b67('0xd1')],'VoiceQueueId':_0x2b612a[_0x7b67('0xd2')]||undefined,'CampaignId':_0x2b612a[_0x7b67('0xf1')]||undefined})[_0x7b67('0x94')](loggerCatch(_0x7b67('0x1e3')));hopperUtils[_0x7b67('0xbd')](createObjHistory(_0x1e6d4a,_0x2b612a,utils[_0x7b67('0x65')]['QUEUE_RECALL'],0x17,'RecallInQueue'))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x2e6a19[_0x7b67('0x10c')](createObjHistory(_0x1e6d4a,_0x2b612a,utils['CAMPAIGN_STATUS'][_0x7b67('0x1e4')],0x16,'RecallFailedTimeout'),_0x7b67('0x1e5'),_0x7b67('0x1e6'));}}}}else{_0x1e6d4a[_0x7b67('0x1e7')]+=0x1;_0x2e6a19[_0x7b67('0x10c')](createObjHistory(_0x1e6d4a,_0x2b612a,utils['CAMPAIGN_STATUS'][_0x7b67('0x1e8')],0xd,_0x7b67('0x1e9')),_0x7b67('0x1ea'),_0x7b67('0x1eb'));throw _0x7b67('0x1ec');}};};Dialer[_0x7b67('0x16')][_0x7b67('0x1ed')]=function(_0x2b22aa){var _0x591ec8=this;var _0x12b44b=_0x2b22aa['limitCalls']-_0x2b22aa['originated'];emitCampaignSummary(_0x2b22aa);if(_0x12b44b>0x0&&_0x2b22aa['temp']==0x0){if(_0x12b44b>this[_0x7b67('0x20')]){_0x12b44b=this[_0x7b67('0x20')];}_0x2b22aa[_0x7b67('0x1ee')]=0x1;hopperUtils[_0x7b67('0x1ef')](_0x2b22aa,_0x12b44b)[_0x7b67('0x3c')](function(_0x13f8e2){_0x2b22aa['temp']=0x0;if(_0x13f8e2){if(!utils[_0x7b67('0x1f0')](_0x13f8e2)){_0x2b22aa[_0x7b67('0x64')]=utils[_0x7b67('0x65')][_0x7b67('0x68')];logger[_0x7b67('0x47')](_0x7b67('0x1f1')+_0x2b22aa[_0x7b67('0x44')]);}else{_0x2b22aa['originated']+=_0x13f8e2[_0x7b67('0x8f')];_0x2b22aa['message']=utils[_0x7b67('0x65')][_0x7b67('0x1f2')];for(var _0x2f26d1=0x0;_0x2f26d1<_0x13f8e2[_0x7b67('0x8f')];_0x2f26d1+=0x1){_0x2b22aa[_0x7b67('0x1f3')]+=0x1;if(_[_0x7b67('0xea')](_0x13f8e2[_0x2f26d1])||_[_0x7b67('0xea')](_0x13f8e2[_0x2f26d1][_0x7b67('0x166')])||_[_0x7b67('0xea')](_0x13f8e2[_0x2f26d1][_0x7b67('0x151')])){_0x591ec8['emptyContact'](_0x7b67('0x1f4'),_0x2b22aa,_0x13f8e2[_0x2f26d1]);}else{hopperUtils[_0x7b67('0x1f5')](_[_0x7b67('0x6f')](_0x13f8e2[_0x2f26d1],[_0x7b67('0xf1'),_0x7b67('0x151')]))[_0x7b67('0x3c')](_0x591ec8[_0x7b67('0x1d8')](_0x2b22aa,_0x13f8e2[_0x2f26d1]))[_0x7b67('0x94')](_0x591ec8[_0x7b67('0x146')](_0x7b67('0x1f6'),_0x2b22aa));}}}}})[_0x7b67('0x94')](loggerGetContactDialer(_0x7b67('0x1f7'),_0x2b22aa,_0x12b44b));}};Dialer[_0x7b67('0x16')][_0x7b67('0xa7')]=function(_0x2a89aa,_0x397ff6){var _0x197138=this;var _0x419770=[];if(_0x397ff6<0x1||_0x2a89aa[_0x7b67('0xa4')]===_0x7b67('0x1f8')){_0x397ff6=0x1;}var _0x2ea837=Math[_0x7b67('0x1d3')](_0x2a89aa[_0x7b67('0x12c')]*_0x397ff6)-_0x2a89aa[_0x7b67('0x78')];if(_0x2a89aa[_0x7b67('0x1f9')]>0x0){var _0x1c684a=_0x2a89aa[_0x7b67('0x1f9')]-_0x2a89aa[_0x7b67('0x78')]-_0x2a89aa['talking']-_0x2a89aa[_0x7b67('0x12f')];if(_0x2ea837>_0x1c684a){_0x2ea837=_0x1c684a;}}if(_0x2ea837>0x0&&_0x2a89aa[_0x7b67('0x1ee')]==0x0){if(_0x2a89aa[_0x7b67('0xa4')]==='booked'){_0x2ea837=0x1;}if(_0x2ea837>this[_0x7b67('0x20')]){_0x2ea837=this['maxNumberOriginate'];}for(var _0x17357a in this['agents']){if(typeof this[_0x7b67('0x1e')][_0x17357a]!==_0x7b67('0x141')){if(this[_0x7b67('0x1e')][_0x17357a][_0x7b67('0x69')]===_0x7b67('0x1fa')&&this[_0x7b67('0x1e')][_0x17357a]['status']===_0x7b67('0x80')){_0x419770[_0x7b67('0x90')](this['agents'][_0x17357a]['id']);}}}_0x2a89aa[_0x7b67('0x1ee')]=0x1;hopperUtils[_0x7b67('0x1fb')](_0x2a89aa,_0x419770,_0x2ea837)['then'](function(_0x44949c){_0x2a89aa[_0x7b67('0x1ee')]=0x0;if(_0x44949c){if(!utils['checkContactEmpty'](_0x44949c)){hopperUtils[_0x7b67('0x1fc')](_0x2a89aa)[_0x7b67('0x3c')](sendMessageReschedule(_0x2a89aa))[_0x7b67('0x94')](loggerCatch(_0x7b67('0x1fd')));}else{_0x2a89aa[_0x7b67('0x78')]+=_0x44949c['length'];_0x2a89aa[_0x7b67('0x64')]=_0x2a89aa['dialMethod']===_0x7b67('0x1f8')?utils[_0x7b67('0x65')]['ACTIVE']:utils[_0x7b67('0x65')]['RUNNING'];for(var _0x4a971f=0x0;_0x4a971f<_0x44949c[_0x7b67('0x8f')];_0x4a971f+=0x1){if(_[_0x7b67('0xea')](_0x44949c[_0x4a971f])||_[_0x7b67('0xea')](_0x44949c[_0x4a971f]['Contact'])||_[_0x7b67('0xea')](_0x44949c[_0x4a971f]['phone'])){_0x197138[_0x7b67('0x147')](_0x7b67('0x1f4'),_0x2a89aa,_0x44949c[_0x4a971f]);}else{hopperUtils[_0x7b67('0x1fe')](_[_0x7b67('0x6f')](_0x44949c[_0x4a971f],['VoiceQueueId',_0x7b67('0x151')]))[_0x7b67('0x3c')](_0x197138[_0x7b67('0x1d8')](_0x2a89aa,_0x44949c[_0x4a971f]))[_0x7b67('0x94')](_0x197138[_0x7b67('0x146')](_0x7b67('0x1f4'),_0x2a89aa));}}}}})[_0x7b67('0x94')](loggerGetContactDialer(_0x7b67('0x1ff'),_0x2a89aa,_0x2ea837));}};Dialer[_0x7b67('0x16')][_0x7b67('0x5f')]=function(_0x5432a8){if(_0x5432a8[_0x7b67('0x1f9')]>0x0){var _0x4567b6=_0x5432a8[_0x7b67('0x1f9')]-_0x5432a8['originated']-_0x5432a8[_0x7b67('0x12e')];if(_0x4567b6>0x0&&_0x5432a8[_0x7b67('0x1ee')]==0x0){this['tryOriginatePredictive'](_0x5432a8);}else{loggerPredictiveCalls[_0x7b67('0x47')](_0x7b67('0x200'));}}else{this[_0x7b67('0x201')](_0x5432a8);}};Dialer[_0x7b67('0x16')][_0x7b67('0x201')]=function(_0x3fd5ea){var _0x48f68e=this;var _0x459a7e=[];_0x3fd5ea[_0x7b67('0x78')]+=0x1;for(var _0x367c71 in this['agents']){if(typeof this[_0x7b67('0x1e')][_0x367c71]!==_0x7b67('0x141')){if(this[_0x7b67('0x1e')][_0x367c71]['state']===_0x7b67('0x1fa')&&this['agents'][_0x367c71][_0x7b67('0x7f')]==='reachable'){_0x459a7e['push'](this[_0x7b67('0x1e')][_0x367c71]['id']);}}}_0x3fd5ea[_0x7b67('0x1ee')]=0x1;return this['getContactDialer'](_0x3fd5ea['id'],_0x459a7e,0x1,_0x3fd5ea[_0x7b67('0x202')],_0x3fd5ea)[_0x7b67('0x3c')](function(_0x469a28){_0x3fd5ea[_0x7b67('0x1ee')]=0x1;if(_0x469a28){if(!utils[_0x7b67('0x1f0')](_0x469a28)){utils[_0x7b67('0x62')](_0x3fd5ea,0x1,0x0);return hopperUtils[_0x7b67('0x1fc')](_0x3fd5ea)[_0x7b67('0x3c')](sendMessageReschedule(_0x3fd5ea))[_0x7b67('0x94')](loggerCatch('[countReScheduled]\x20'));}else{_0x3fd5ea[_0x7b67('0x64')]=utils[_0x7b67('0x65')][_0x7b67('0x1f2')];if(_[_0x7b67('0xea')](_0x469a28[0x0])||_[_0x7b67('0xea')](_0x469a28[0x0]['Contact'])||_[_0x7b67('0xea')](_0x469a28[0x0][_0x7b67('0x151')])){_0x48f68e['emptyContact'](_0x7b67('0x1f4'),_0x3fd5ea,_0x469a28[0x0]);}else{return hopperUtils[_0x7b67('0x1fe')](_['pick'](_0x469a28[0x0],[_0x7b67('0xd2'),_0x7b67('0x151')]))[_0x7b67('0x3c')](_0x48f68e[_0x7b67('0x1d8')](_0x3fd5ea,_0x469a28[0x0]))['catch'](_0x48f68e[_0x7b67('0x146')](_0x7b67('0x203'),_0x3fd5ea));}}}})['catch'](loggerGetContactDialer(_0x7b67('0x204'),_0x3fd5ea,0x1));};Dialer['prototype'][_0x7b67('0x1c9')]=function(_0x353328,_0x725961,_0x17eaa7,_0x238240,_0x5e4ee2,_0x3294ba){loggerPredictive['info'](_0x7b67('0x205'));loggerPredictive[_0x7b67('0x47')](_0x7b67('0x206'),_0x353328);loggerPredictive[_0x7b67('0x47')](_0x7b67('0x207'),_0x725961);loggerPredictive[_0x7b67('0x47')](_0x7b67('0x208'),_0x17eaa7);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',_0x238240);loggerPredictive['info'](_0x7b67('0x209'),_0x5e4ee2);loggerPredictive[_0x7b67('0x47')](_0x7b67('0x51'));return new Promise(function(_0x470231,_0x3f78d7){if(_0x353328<=0x0||isNaN(_0x353328)){return _0x3f78d7(msgResponse(_0x7b67('0x20a'),'Error',_0x7b67('0x20b')+_0x353328));}if(_0x17eaa7<=0x0||isNaN(_0x17eaa7)){return _0x3f78d7(msgResponse('[abandonmentRate]',_0x7b67('0x17c'),_0x7b67('0x20c')+_0x17eaa7));}if(_0x238240<=0x0||isNaN(_0x238240)){return _0x3f78d7(msgResponse('[abandonmentRate]',_0x7b67('0x17c'),_0x7b67('0x20d')+_0x238240));}if(_0x725961<=0x0||isNaN(_0x725961)){return _0x3f78d7(msgResponse(_0x7b67('0x20a'),_0x7b67('0x17c'),_0x7b67('0x20e')+_0x725961));}if(_0x5e4ee2<=0x0||isNaN(_0x5e4ee2)){return _0x3f78d7(msgResponse(_0x7b67('0x20a'),'Error',_0x7b67('0x20f')+_0x5e4ee2));}_0x3294ba=_0x3294ba||0x0;var _0x336fad=0x1/_0x17eaa7;var _0x176e77=0x0;var _0x5d5edc=0x0;var _0x5cfaa0=0x0;var _0x403ac3=0x0;for(var _0x7ae92c=0x0;_0x5cfaa0<_0x5e4ee2;_0x7ae92c+=0x1){_0x5d5edc=_0x7ae92c/_0x725961;_0x176e77=(_0x238240*_0x5d5edc+_0x3294ba)/_0x336fad;_0x5cfaa0=utils[_0x7b67('0x210')](_0x176e77,_0x353328);_0x403ac3=_0x176e77/_0x353328*(0x1-utils[_0x7b67('0x210')](_0x176e77,_0x353328));}return _0x470231({'erlangCalls':_0x7ae92c,'erlangCallToSecond':_0x725961/_0x7ae92c,'erlangAbandonmentRate':_0x5cfaa0,'erlangBusyFactor':_0x403ac3});});};Dialer[_0x7b67('0x16')]['busyFactor']=function(_0x1fd491,_0x33cee7,_0x12d890,_0x2723f1,_0x5648ad,_0x506b52){loggerPredictive[_0x7b67('0x47')](_0x7b67('0x211'));loggerPredictive[_0x7b67('0x47')](_0x7b67('0x206'),_0x1fd491);loggerPredictive[_0x7b67('0x47')](_0x7b67('0x207'),_0x33cee7);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x12d890);loggerPredictive[_0x7b67('0x47')](_0x7b67('0x212'),_0x2723f1);loggerPredictive['info'](_0x7b67('0x213'),_0x5648ad);loggerPredictive['info']('---------------------------');return new Promise(function(_0x36e845,_0x5aa1d9){if(_0x1fd491<=0x0||isNaN(_0x1fd491)){return _0x5aa1d9(msgResponse(_0x7b67('0x214'),_0x7b67('0x17c'),'m\x20=\x20'+_0x1fd491));}if(_0x12d890<=0x0||isNaN(_0x12d890)){return _0x5aa1d9(msgResponse(_0x7b67('0x214'),_0x7b67('0x17c'),_0x7b67('0x20c')+_0x12d890));}if(_0x2723f1<=0x0||isNaN(_0x2723f1)){return _0x5aa1d9(msgResponse(_0x7b67('0x214'),_0x7b67('0x17c'),_0x7b67('0x20d')+_0x2723f1));}if(_0x33cee7<=0x0||isNaN(_0x33cee7)){return _0x5aa1d9(msgResponse('[busyFactor]',_0x7b67('0x17c'),_0x7b67('0x20e')+_0x33cee7));}if(_0x5648ad<=0x0||isNaN(_0x5648ad)){return _0x5aa1d9(msgResponse(_0x7b67('0x214'),_0x7b67('0x17c'),'Umin\x20=\x20'+_0x5648ad));}_0x506b52=_0x506b52||0x0;var _0x2f8b13=0x1/_0x12d890;var _0x5f9058=0x0;var _0x6ebcac=0x0;var _0x3eac1e=0x0;var _0x4dfc01=0x0;for(var _0x56526a=0x0;_0x4dfc01<_0x5648ad;_0x56526a+=0x1){_0x6ebcac=_0x56526a/_0x33cee7;_0x5f9058=(_0x2723f1*_0x6ebcac+_0x506b52)/_0x2f8b13;_0x3eac1e=utils[_0x7b67('0x210')](_0x5f9058,_0x1fd491);_0x4dfc01=_0x5f9058/_0x1fd491*(0x1-utils['erlangb'](_0x5f9058,_0x1fd491));}return _0x36e845({'erlangCalls':_0x56526a,'erlangCallToSecond':_0x33cee7/_0x56526a,'erlangAbandonmentRate':_0x3eac1e,'erlangBusyFactor':_0x4dfc01});});};module[_0x7b67('0x215')]=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 cbb0d57..1385aff 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 _0x3d9f=['dialCutDigit','substring','prototype','getQueue','exports','lodash','moment','isNil','string','voiceQueue','uniqueid','Contact','phone','firstName','lastName','number','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>'];(function(_0x202b59,_0x460f05){var _0x4712a5=function(_0x5aac58){while(--_0x5aac58){_0x202b59['push'](_0x202b59['shift']());}};_0x4712a5(++_0x460f05);}(_0x3d9f,0x139));var _0xf3d9=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x3d9f[_0x3947c9];return _0x2e7871;};'use strict';var util=require('util');var _=require(_0xf3d9('0x0'));var moment=require(_0xf3d9('0x1'));function checkNameSurname(_0x310974,_0x12756c,_0x56eae7){var _0x4bc61f='';if(!_[_0xf3d9('0x2')](_0x12756c)&&_0xf3d9('0x3')===typeof _0x12756c){_0x4bc61f+=_0x12756c;}if(!_[_0xf3d9('0x2')](_0x56eae7)&&'string'===typeof _0x56eae7){_0x4bc61f+='\x20'+_0x56eae7;}if(_0x4bc61f!==''){return _0x4bc61f;}return _0x310974;}function Action(_0x5c220b,_0x408afe,_0x51a1a7){this[_0xf3d9('0x4')]=_0x5c220b;this[_0xf3d9('0x5')]=_0x51a1a7||undefined;this['name']=checkNameSurname(_0x408afe[_0xf3d9('0x6')][_0xf3d9('0x7')],_0x408afe[_0xf3d9('0x6')][_0xf3d9('0x8')],_0x408afe[_0xf3d9('0x6')][_0xf3d9('0x9')]);this[_0xf3d9('0xa')]=_0x408afe[_0xf3d9('0x7')];this['queue']=_0x5c220b[_0xf3d9('0xb')];this[_0xf3d9('0xc')]=_0x408afe['active']||![];this['type']=_0x5c220b[_0xf3d9('0xd')];this[_0xf3d9('0xe')]=_0x5c220b[_0xf3d9('0xe')]||0x3;this[_0xf3d9('0xf')]=_0x408afe[_0xf3d9('0xf')];this['countbusyretry']=_0x408afe[_0xf3d9('0x10')];this[_0xf3d9('0x11')]=_0x408afe['countcongestionretry'];this['countnoanswerretry']=_0x408afe['countnoanswerretry'];this[_0xf3d9('0x12')]=_0x408afe[_0xf3d9('0x12')];this[_0xf3d9('0x13')]=_0x408afe[_0xf3d9('0x13')];this['countabandonedretry']=_0x408afe['countabandonedretry'];this['countmachineretry']=_0x408afe['countmachineretry'];this[_0xf3d9('0x14')]=_0x408afe['countagentrejectretry'];this[_0xf3d9('0x15')]=_0x408afe['ContactId'];this[_0xf3d9('0x16')]=_0x408afe[_0xf3d9('0x16')];this['UserId']=_0x408afe[_0xf3d9('0x17')];this['VoiceQueueId']=_0x408afe[_0xf3d9('0x18')];this[_0xf3d9('0x19')]=_0x408afe[_0xf3d9('0x19')];this[_0xf3d9('0x1a')]=_0x408afe['id'];this[_0xf3d9('0x1b')]=_0x408afe[_0xf3d9('0x6')]['firstName']||'';this[_0xf3d9('0x1c')]=moment()[_0xf3d9('0x1d')](_0xf3d9('0x1e'));this[_0xf3d9('0x1f')]=_0x408afe['callback'];this[_0xf3d9('0x20')]=_0x408afe[_0xf3d9('0x20')];this[_0xf3d9('0x21')]=_0x408afe[_0xf3d9('0x21')];this[_0xf3d9('0x22')]=_0x408afe[_0xf3d9('0x22')];this[_0xf3d9('0x23')]='';this[_0xf3d9('0x24')]='';}Action['prototype'][_0xf3d9('0x25')]=function(){return util[_0xf3d9('0x1d')](_0xf3d9('0x26'),this[_0xf3d9('0xb')],this[_0xf3d9('0x4')][_0xf3d9('0x27')]>0x0?this['number'][_0xf3d9('0x28')](this['voiceQueue'][_0xf3d9('0x27')]):this[_0xf3d9('0xa')]);};Action[_0xf3d9('0x29')][_0xf3d9('0x2a')]=function(){return this['queue'];};module[_0xf3d9('0x2b')]=Action; \ No newline at end of file +var _0x5bcc=['countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','queue','util','moment','isNil','string','voiceQueue','uniqueid','Contact','phone','number','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x5c12f2,_0x5de043){var _0x5e8344=function(_0x445932){while(--_0x445932){_0x5c12f2['push'](_0x5c12f2['shift']());}};_0x5e8344(++_0x5de043);}(_0x5bcc,0x111));var _0xc5bc=function(_0x1900a8,_0x556e77){_0x1900a8=_0x1900a8-0x0;var _0x48e7fc=_0x5bcc[_0x1900a8];return _0x48e7fc;};'use strict';var util=require(_0xc5bc('0x0'));var _=require('lodash');var moment=require(_0xc5bc('0x1'));function checkNameSurname(_0x48f914,_0x12f0d4,_0x3e7bed){var _0x368c19='';if(!_[_0xc5bc('0x2')](_0x12f0d4)&&_0xc5bc('0x3')===typeof _0x12f0d4){_0x368c19+=_0x12f0d4;}if(!_[_0xc5bc('0x2')](_0x3e7bed)&&_0xc5bc('0x3')===typeof _0x3e7bed){_0x368c19+='\x20'+_0x3e7bed;}if(_0x368c19!==''){return _0x368c19;}return _0x48f914;}function Action(_0x744bdd,_0xef2f2e,_0x4473d5){this[_0xc5bc('0x4')]=_0x744bdd;this[_0xc5bc('0x5')]=_0x4473d5||undefined;this['name']=checkNameSurname(_0xef2f2e[_0xc5bc('0x6')][_0xc5bc('0x7')],_0xef2f2e['Contact']['firstName'],_0xef2f2e[_0xc5bc('0x6')]['lastName']);this[_0xc5bc('0x8')]=_0xef2f2e[_0xc5bc('0x7')];this['queue']=_0x744bdd[_0xc5bc('0x9')];this[_0xc5bc('0xa')]=_0xef2f2e['active']||![];this[_0xc5bc('0xb')]=_0x744bdd[_0xc5bc('0xb')];this[_0xc5bc('0xc')]=_0x744bdd[_0xc5bc('0xc')]||0x3;this[_0xc5bc('0xd')]=_0xef2f2e[_0xc5bc('0xd')];this[_0xc5bc('0xe')]=_0xef2f2e[_0xc5bc('0xe')];this[_0xc5bc('0xf')]=_0xef2f2e['countcongestionretry'];this[_0xc5bc('0x10')]=_0xef2f2e[_0xc5bc('0x10')];this[_0xc5bc('0x11')]=_0xef2f2e[_0xc5bc('0x11')];this[_0xc5bc('0x12')]=_0xef2f2e[_0xc5bc('0x12')];this[_0xc5bc('0x13')]=_0xef2f2e[_0xc5bc('0x13')];this[_0xc5bc('0x14')]=_0xef2f2e[_0xc5bc('0x14')];this[_0xc5bc('0x15')]=_0xef2f2e[_0xc5bc('0x15')];this[_0xc5bc('0x16')]=_0xef2f2e[_0xc5bc('0x16')];this[_0xc5bc('0x17')]=_0xef2f2e[_0xc5bc('0x17')];this[_0xc5bc('0x18')]=_0xef2f2e[_0xc5bc('0x18')];this[_0xc5bc('0x19')]=_0xef2f2e['VoiceQueueId'];this['CampaignId']=_0xef2f2e[_0xc5bc('0x1a')];this[_0xc5bc('0x1b')]=_0xef2f2e['id'];this[_0xc5bc('0x1c')]=_0xef2f2e[_0xc5bc('0x6')][_0xc5bc('0x1d')]||'';this[_0xc5bc('0x1e')]=moment()[_0xc5bc('0x1f')](_0xc5bc('0x20'));this[_0xc5bc('0x21')]=_0xef2f2e['callback'];this[_0xc5bc('0x22')]=_0xef2f2e[_0xc5bc('0x22')];this[_0xc5bc('0x23')]=_0xef2f2e[_0xc5bc('0x23')];this[_0xc5bc('0x24')]=_0xef2f2e[_0xc5bc('0x24')];this['originatecalleridnum']='';this[_0xc5bc('0x25')]='';}Action[_0xc5bc('0x26')][_0xc5bc('0x27')]=function(){return util[_0xc5bc('0x1f')](_0xc5bc('0x28'),this['name'],this[_0xc5bc('0x4')]['dialCutDigit']>0x0?this[_0xc5bc('0x8')]['substring'](this[_0xc5bc('0x4')]['dialCutDigit']):this[_0xc5bc('0x8')]);};Action['prototype']['getQueue']=function(){return this[_0xc5bc('0x29')];};module['exports']=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 863f6c9..13a5344 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 _0x4476=['reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','state','statedesc','Answer','type','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','answertime','YYYY-MM-DD\x20HH:mm:ss','getSeconds','talktime','endtime','membername'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4476,0x14d));var _0x6447=function(_0x49e0d4,_0x1b7d6c){_0x49e0d4=_0x49e0d4-0x0;var _0x4fe3a0=_0x4476[_0x49e0d4];return _0x4fe3a0;};'use strict';var moment=require(_0x6447('0x0'));var utils=require('../utils');function AgentComplete(_0xdc4e89,_0x197b88){this[_0x6447('0x1')]=0x4;this[_0x6447('0x2')]=_0x6447('0x3');this['scheduledat']=_0xdc4e89['scheduledat'];this[_0x6447('0x4')]=_0xdc4e89[_0x6447('0x4')];this['campaigntype']=_0xdc4e89[_0x6447('0x4')]===_0x6447('0x5')?_0x6447('0x6'):_0xdc4e89[_0x6447('0x4')];this[_0x6447('0x7')]=_0xdc4e89[_0x6447('0x7')];this[_0x6447('0x8')]=_0xdc4e89[_0x6447('0x8')];this['countnoanswerretry']=_0xdc4e89['countnoanswerretry'];this[_0x6447('0x9')]=_0xdc4e89[_0x6447('0x7')]+_0xdc4e89[_0x6447('0x8')]+_0xdc4e89[_0x6447('0xa')]+_0xdc4e89[_0x6447('0xb')]+_0xdc4e89[_0x6447('0xc')]+_0xdc4e89[_0x6447('0xd')]+_0xdc4e89[_0x6447('0xe')]+_0xdc4e89['countagentrejectretry'];this[_0x6447('0xb')]=_0xdc4e89[_0x6447('0xb')];this[_0x6447('0xc')]=_0xdc4e89[_0x6447('0xc')];this[_0x6447('0xd')]=_0xdc4e89['countabandonedretry'];this['countmachineretry']=_0xdc4e89[_0x6447('0xe')];this[_0x6447('0xf')]=_0xdc4e89[_0x6447('0xf')];this[_0x6447('0x10')]=_0x197b88[_0x6447('0x10')];this[_0x6447('0x11')]=_0xdc4e89['name'];this['calleridnum']=_0xdc4e89[_0x6447('0x12')];this['starttime']=_0xdc4e89[_0x6447('0x13')];this[_0x6447('0x14')]=_0xdc4e89['responsetime'];this[_0x6447('0x15')]=_0xdc4e89['answertime'];this['endtime']=moment()['format'](_0x6447('0x16'));this['ringtime']=utils['getSeconds'](_0xdc4e89[_0x6447('0x14')],_0xdc4e89[_0x6447('0x13')]);this['holdtime']=utils[_0x6447('0x17')](_0xdc4e89[_0x6447('0x15')],_0xdc4e89[_0x6447('0x14')]);this[_0x6447('0x18')]=utils[_0x6447('0x17')](this[_0x6447('0x19')],_0xdc4e89[_0x6447('0x15')]);this[_0x6447('0x6')]=_0x197b88['queue'];this[_0x6447('0x1a')]=_0x197b88[_0x6447('0x1a')];this[_0x6447('0x1b')]=_0x197b88['reason'];this['callback']=_0xdc4e89[_0x6447('0x1c')];this[_0x6447('0x1d')]=_0xdc4e89[_0x6447('0x1d')];this[_0x6447('0x1e')]=_0xdc4e89[_0x6447('0x1e')];this[_0x6447('0x1f')]=_0xdc4e89[_0x6447('0x1f')];this[_0x6447('0x20')]=_0xdc4e89[_0x6447('0x20')];this['ListId']=_0xdc4e89[_0x6447('0x21')];this[_0x6447('0x22')]=_0xdc4e89[_0x6447('0x22')];this[_0x6447('0x23')]=_0xdc4e89['VoiceQueueId'];this['CampaignId']=_0xdc4e89['CampaignId'];this['originatecalleridnum']=_0xdc4e89[_0x6447('0x24')]||'';this[_0x6447('0x25')]=_0xdc4e89[_0x6447('0x25')]||'';this[_0x6447('0x26')]=_0xdc4e89[_0x6447('0x26')];}module[_0x6447('0x27')]=AgentComplete; \ No newline at end of file +var _0x2a73=['countagentrejectretry','uniqueid','name','calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','state','statedesc','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x4f1da5,_0x4ced17){var _0xe972a8=function(_0x278ba3){while(--_0x278ba3){_0x4f1da5['push'](_0x4f1da5['shift']());}};_0xe972a8(++_0x4ced17);}(_0x2a73,0xcc));var _0x32a7=function(_0x4683e5,_0x6a6fdf){_0x4683e5=_0x4683e5-0x0;var _0x336079=_0x2a73[_0x4683e5];return _0x336079;};'use strict';var moment=require(_0x32a7('0x0'));var utils=require(_0x32a7('0x1'));function AgentComplete(_0x56ddfc,_0x2fc890){this[_0x32a7('0x2')]=0x4;this[_0x32a7('0x3')]='Answer';this[_0x32a7('0x4')]=_0x56ddfc[_0x32a7('0x4')];this[_0x32a7('0x5')]=_0x56ddfc[_0x32a7('0x5')];this['campaigntype']=_0x56ddfc['type']===_0x32a7('0x6')?_0x32a7('0x7'):_0x56ddfc[_0x32a7('0x5')];this['countbusyretry']=_0x56ddfc[_0x32a7('0x8')];this['countcongestionretry']=_0x56ddfc[_0x32a7('0x9')];this[_0x32a7('0xa')]=_0x56ddfc[_0x32a7('0xa')];this[_0x32a7('0xb')]=_0x56ddfc[_0x32a7('0x8')]+_0x56ddfc[_0x32a7('0x9')]+_0x56ddfc[_0x32a7('0xa')]+_0x56ddfc[_0x32a7('0xc')]+_0x56ddfc[_0x32a7('0xd')]+_0x56ddfc[_0x32a7('0xe')]+_0x56ddfc[_0x32a7('0xf')]+_0x56ddfc['countagentrejectretry'];this[_0x32a7('0xc')]=_0x56ddfc['countnosuchnumberretry'];this[_0x32a7('0xd')]=_0x56ddfc[_0x32a7('0xd')];this[_0x32a7('0xe')]=_0x56ddfc[_0x32a7('0xe')];this[_0x32a7('0xf')]=_0x56ddfc[_0x32a7('0xf')];this[_0x32a7('0x10')]=_0x56ddfc[_0x32a7('0x10')];this[_0x32a7('0x11')]=_0x2fc890['uniqueid'];this['calleridname']=_0x56ddfc[_0x32a7('0x12')];this[_0x32a7('0x13')]=_0x56ddfc['number'];this[_0x32a7('0x14')]=_0x56ddfc[_0x32a7('0x14')];this['responsetime']=_0x56ddfc[_0x32a7('0x15')];this[_0x32a7('0x16')]=_0x56ddfc['answertime'];this[_0x32a7('0x17')]=moment()[_0x32a7('0x18')](_0x32a7('0x19'));this[_0x32a7('0x1a')]=utils[_0x32a7('0x1b')](_0x56ddfc['responsetime'],_0x56ddfc[_0x32a7('0x14')]);this[_0x32a7('0x1c')]=utils[_0x32a7('0x1b')](_0x56ddfc[_0x32a7('0x16')],_0x56ddfc[_0x32a7('0x15')]);this[_0x32a7('0x1d')]=utils[_0x32a7('0x1b')](this[_0x32a7('0x17')],_0x56ddfc[_0x32a7('0x16')]);this['queue']=_0x2fc890[_0x32a7('0x7')];this[_0x32a7('0x1e')]=_0x2fc890[_0x32a7('0x1e')];this['reason']=_0x2fc890[_0x32a7('0x1f')];this[_0x32a7('0x20')]=_0x56ddfc['callback'];this[_0x32a7('0x21')]=_0x56ddfc[_0x32a7('0x21')];this['callbackat']=_0x56ddfc[_0x32a7('0x22')];this['recallme']=_0x56ddfc[_0x32a7('0x23')];this[_0x32a7('0x24')]=_0x56ddfc[_0x32a7('0x24')];this['ListId']=_0x56ddfc[_0x32a7('0x25')];this['UserId']=_0x56ddfc[_0x32a7('0x26')];this[_0x32a7('0x27')]=_0x56ddfc[_0x32a7('0x27')];this[_0x32a7('0x28')]=_0x56ddfc[_0x32a7('0x28')];this['originatecalleridnum']=_0x56ddfc[_0x32a7('0x29')]||'';this[_0x32a7('0x2a')]=_0x56ddfc[_0x32a7('0x2a')]||'';this[_0x32a7('0x2b')]=_0x56ddfc[_0x32a7('0x2b')];}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 91fd5bb..8381758 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 _0xd6bb=['calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','queue'];(function(_0x217764,_0x2ceb87){var _0x564d08=function(_0x2b4cc3){while(--_0x2b4cc3){_0x217764['push'](_0x217764['shift']());}};_0x564d08(++_0x2ceb87);}(_0xd6bb,0x82));var _0xbd6b=function(_0x2ddfd9,_0x5877d0){_0x2ddfd9=_0x2ddfd9-0x0;var _0x2668f0=_0xd6bb[_0x2ddfd9];return _0x2668f0;};'use strict';function Final(_0xbdf4c3){this[_0xbd6b('0x0')]=_0xbdf4c3['uniqueid'];this[_0xbd6b('0x1')]=_0xbdf4c3['scheduledat'];this[_0xbd6b('0x2')]=_0xbdf4c3[_0xbd6b('0x2')];this['campaigntype']=_0xbdf4c3[_0xbd6b('0x2')]===_0xbd6b('0x3')?'queue':_0xbdf4c3[_0xbd6b('0x2')];this[_0xbd6b('0x4')]=_0xbdf4c3[_0xbd6b('0x4')];this[_0xbd6b('0x5')]=_0xbdf4c3[_0xbd6b('0x5')];this[_0xbd6b('0x6')]=_0xbdf4c3['countnoanswerretry'];this[_0xbd6b('0x7')]=_0xbdf4c3[_0xbd6b('0x4')]+_0xbdf4c3[_0xbd6b('0x5')]+_0xbdf4c3[_0xbd6b('0x6')]+_0xbdf4c3['countnosuchnumberretry']+_0xbdf4c3[_0xbd6b('0x8')]+_0xbdf4c3[_0xbd6b('0x9')]+_0xbdf4c3['countmachineretry']+_0xbdf4c3[_0xbd6b('0xa')];this[_0xbd6b('0xb')]=_0xbdf4c3[_0xbd6b('0xb')];this[_0xbd6b('0x8')]=_0xbdf4c3[_0xbd6b('0x8')];this[_0xbd6b('0x9')]=_0xbdf4c3[_0xbd6b('0x9')];this['countmachineretry']=_0xbdf4c3[_0xbd6b('0xc')];this[_0xbd6b('0xa')]=_0xbdf4c3[_0xbd6b('0xa')];this[_0xbd6b('0xd')]=_0xbdf4c3[_0xbd6b('0xd')];this[_0xbd6b('0xe')]=_0xbdf4c3[_0xbd6b('0xe')];this[_0xbd6b('0xf')]=_0xbdf4c3['calleridnum'];this[_0xbd6b('0x10')]=_0xbdf4c3[_0xbd6b('0x10')];this['responsetime']=_0xbdf4c3[_0xbd6b('0x11')];this[_0xbd6b('0x12')]=_0xbdf4c3[_0xbd6b('0x11')];this[_0xbd6b('0x13')]=_0xbdf4c3[_0xbd6b('0x13')]||0x0;this[_0xbd6b('0x14')]=_0xbdf4c3[_0xbd6b('0x14')]||0x0;this[_0xbd6b('0x15')]=_0xbdf4c3[_0xbd6b('0x15')]||0x0;this['callback']=_0xbdf4c3[_0xbd6b('0x16')];this['callbackuniqueid']=_0xbdf4c3[_0xbd6b('0x17')];this[_0xbd6b('0x18')]=_0xbdf4c3[_0xbd6b('0x18')];this[_0xbd6b('0x19')]=_0xbdf4c3[_0xbd6b('0x19')];this[_0xbd6b('0x1a')]=_0xbdf4c3['ContactId'];this['ListId']=_0xbdf4c3[_0xbd6b('0x1b')];this[_0xbd6b('0x1c')]=_0xbdf4c3[_0xbd6b('0x1c')];this[_0xbd6b('0x1d')]=_0xbdf4c3[_0xbd6b('0x1d')];this[_0xbd6b('0x1e')]=_0xbdf4c3['CampaignId'];this[_0xbd6b('0x1f')]=_0xbdf4c3[_0xbd6b('0x1f')]||'';this[_0xbd6b('0x20')]=_0xbdf4c3['originatecalleridname']||'';this[_0xbd6b('0x21')]=_0xbdf4c3['state'];this[_0xbd6b('0x22')]=_0xbdf4c3['statedesc'];}module[_0xbd6b('0x23')]=Final; \ No newline at end of file +var _0x6496=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme'];(function(_0x3d4a8a,_0x493d25){var _0x4a6de9=function(_0x2ab7ca){while(--_0x2ab7ca){_0x3d4a8a['push'](_0x3d4a8a['shift']());}};_0x4a6de9(++_0x493d25);}(_0x6496,0x1f3));var _0x6649=function(_0x323d3a,_0x325482){_0x323d3a=_0x323d3a-0x0;var _0x24847a=_0x6496[_0x323d3a];return _0x24847a;};'use strict';function Final(_0x120572){this[_0x6649('0x0')]=_0x120572['uniqueid'];this['scheduledat']=_0x120572[_0x6649('0x1')];this[_0x6649('0x2')]=_0x120572[_0x6649('0x2')];this['campaigntype']=_0x120572['type']===_0x6649('0x3')?_0x6649('0x4'):_0x120572[_0x6649('0x2')];this[_0x6649('0x5')]=_0x120572['countbusyretry'];this[_0x6649('0x6')]=_0x120572[_0x6649('0x6')];this['countnoanswerretry']=_0x120572[_0x6649('0x7')];this[_0x6649('0x8')]=_0x120572[_0x6649('0x5')]+_0x120572[_0x6649('0x6')]+_0x120572['countnoanswerretry']+_0x120572[_0x6649('0x9')]+_0x120572[_0x6649('0xa')]+_0x120572[_0x6649('0xb')]+_0x120572[_0x6649('0xc')]+_0x120572[_0x6649('0xd')];this[_0x6649('0x9')]=_0x120572['countnosuchnumberretry'];this['countdropretry']=_0x120572[_0x6649('0xa')];this[_0x6649('0xb')]=_0x120572[_0x6649('0xb')];this['countmachineretry']=_0x120572[_0x6649('0xc')];this[_0x6649('0xd')]=_0x120572[_0x6649('0xd')];this['queue']=_0x120572[_0x6649('0x4')];this['calleridname']=_0x120572[_0x6649('0xe')];this[_0x6649('0xf')]=_0x120572['calleridnum'];this['starttime']=_0x120572[_0x6649('0x10')];this[_0x6649('0x11')]=_0x120572[_0x6649('0x11')];this[_0x6649('0x12')]=_0x120572['responsetime'];this[_0x6649('0x13')]=_0x120572[_0x6649('0x13')]||0x0;this['holdtime']=_0x120572[_0x6649('0x14')]||0x0;this[_0x6649('0x15')]=_0x120572[_0x6649('0x15')]||0x0;this['callback']=_0x120572[_0x6649('0x16')];this[_0x6649('0x17')]=_0x120572[_0x6649('0x17')];this['callbackat']=_0x120572[_0x6649('0x18')];this[_0x6649('0x19')]=_0x120572['recallme'];this[_0x6649('0x1a')]=_0x120572['ContactId'];this['ListId']=_0x120572[_0x6649('0x1b')];this[_0x6649('0x1c')]=_0x120572[_0x6649('0x1c')];this[_0x6649('0x1d')]=_0x120572[_0x6649('0x1d')];this[_0x6649('0x1e')]=_0x120572[_0x6649('0x1e')];this[_0x6649('0x1f')]=_0x120572[_0x6649('0x1f')]||'';this[_0x6649('0x20')]=_0x120572['originatecalleridname']||'';this['state']=_0x120572[_0x6649('0x21')];this[_0x6649('0x22')]=_0x120572[_0x6649('0x22')];}module['exports']=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 42b0eec..a5a2c6d 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 _0x12ad=['outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','getSeconds','endtime','IVR','cause-txt','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype'];(function(_0x4fca93,_0x3735e4){var _0x57a552=function(_0x1dcc04){while(--_0x1dcc04){_0x4fca93['push'](_0x4fca93['shift']());}};_0x57a552(++_0x3735e4);}(_0x12ad,0x117));var _0xd12a=function(_0xe27035,_0x1f4876){_0xe27035=_0xe27035-0x0;var _0x3745bc=_0x12ad[_0xe27035];return _0x3745bc;};'use strict';var moment=require(_0xd12a('0x0'));var utils=require(_0xd12a('0x1'));function Hangup(_0x2a6654,_0x9fbd90){this[_0xd12a('0x2')]=0x4;this[_0xd12a('0x3')]=_0xd12a('0x4');this['scheduledat']=_0x2a6654[_0xd12a('0x5')];this[_0xd12a('0x6')]=_0x2a6654[_0xd12a('0x6')];this[_0xd12a('0x7')]=_0x2a6654['type']===_0xd12a('0x8')?_0xd12a('0x9'):_0x2a6654['type'];this[_0xd12a('0xa')]=_0x2a6654[_0xd12a('0xa')]||![];this[_0xd12a('0xb')]=_0x2a6654[_0xd12a('0xb')];this[_0xd12a('0xc')]=_0x2a6654[_0xd12a('0xc')];this['countnoanswerretry']=_0x2a6654['countnoanswerretry'];this['countglobal']=_0x2a6654[_0xd12a('0xb')]+_0x2a6654[_0xd12a('0xc')]+_0x2a6654[_0xd12a('0xd')]+_0x2a6654[_0xd12a('0xe')]+_0x2a6654[_0xd12a('0xf')]+_0x2a6654[_0xd12a('0x10')]+_0x2a6654[_0xd12a('0x11')]+_0x2a6654[_0xd12a('0x12')];this[_0xd12a('0xe')]=_0x2a6654['countnosuchnumberretry'];this[_0xd12a('0xf')]=_0x2a6654[_0xd12a('0xf')];this[_0xd12a('0x10')]=_0x2a6654['countabandonedretry'];this[_0xd12a('0x11')]=_0x2a6654[_0xd12a('0x11')];this['countagentrejectretry']=_0x2a6654[_0xd12a('0x12')];this[_0xd12a('0x13')]=_0x9fbd90['uniqueid'];this[_0xd12a('0x14')]=_0x2a6654['name'];this[_0xd12a('0x15')]=_0x2a6654[_0xd12a('0x16')];this['starttime']=_0x2a6654[_0xd12a('0x17')];this['responsetime']=_0x2a6654[_0xd12a('0x18')];this['endtime']=moment()[_0xd12a('0x19')](_0xd12a('0x1a'));this[_0xd12a('0x1b')]=utils['getSeconds'](_0x2a6654[_0xd12a('0x18')],_0x2a6654['starttime']);this['holdtime']=0x0;this[_0xd12a('0x1c')]=utils[_0xd12a('0x1d')](this[_0xd12a('0x1e')],_0x2a6654[_0xd12a('0x18')]);this[_0xd12a('0x9')]=_0x2a6654[_0xd12a('0x9')];this['membername']=_0xd12a('0x1f');this['reason']=_0x9fbd90[_0xd12a('0x20')];this['callback']=_0x2a6654[_0xd12a('0x21')];this[_0xd12a('0x22')]=_0x2a6654[_0xd12a('0x22')];this['callbackat']=_0x2a6654['callbackat'];this[_0xd12a('0x23')]=_0x2a6654[_0xd12a('0x23')];this[_0xd12a('0x24')]=_0x2a6654[_0xd12a('0x24')];this['ListId']=_0x2a6654[_0xd12a('0x25')];this[_0xd12a('0x26')]=_0x2a6654['UserId'];this[_0xd12a('0x27')]=_0x2a6654[_0xd12a('0x27')];this['CampaignId']=_0x2a6654['CampaignId'];}module[_0xd12a('0x28')]=Hangup; \ No newline at end of file +var _0xd63f=['../utils','state','statedesc','Answer','scheduledat','type','campaigntype','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','getSeconds','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment'];(function(_0x173113,_0x316a7c){var _0x3bea89=function(_0xd33ac1){while(--_0xd33ac1){_0x173113['push'](_0x173113['shift']());}};_0x3bea89(++_0x316a7c);}(_0xd63f,0x1e3));var _0xfd63=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd63f[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0xfd63('0x0'));var utils=require(_0xfd63('0x1'));function Hangup(_0x5d4d58,_0x4f442f){this[_0xfd63('0x2')]=0x4;this[_0xfd63('0x3')]=_0xfd63('0x4');this[_0xfd63('0x5')]=_0x5d4d58[_0xfd63('0x5')];this[_0xfd63('0x6')]=_0x5d4d58[_0xfd63('0x6')];this[_0xfd63('0x7')]=_0x5d4d58['type']==='outbound'?_0xfd63('0x8'):_0x5d4d58[_0xfd63('0x6')];this['amd']=_0x5d4d58[_0xfd63('0x9')]||![];this[_0xfd63('0xa')]=_0x5d4d58[_0xfd63('0xa')];this['countcongestionretry']=_0x5d4d58[_0xfd63('0xb')];this[_0xfd63('0xc')]=_0x5d4d58[_0xfd63('0xc')];this[_0xfd63('0xd')]=_0x5d4d58[_0xfd63('0xa')]+_0x5d4d58['countcongestionretry']+_0x5d4d58[_0xfd63('0xc')]+_0x5d4d58[_0xfd63('0xe')]+_0x5d4d58[_0xfd63('0xf')]+_0x5d4d58[_0xfd63('0x10')]+_0x5d4d58[_0xfd63('0x11')]+_0x5d4d58[_0xfd63('0x12')];this['countnosuchnumberretry']=_0x5d4d58[_0xfd63('0xe')];this[_0xfd63('0xf')]=_0x5d4d58['countdropretry'];this[_0xfd63('0x10')]=_0x5d4d58[_0xfd63('0x10')];this['countmachineretry']=_0x5d4d58[_0xfd63('0x11')];this[_0xfd63('0x12')]=_0x5d4d58[_0xfd63('0x12')];this['uniqueid']=_0x4f442f[_0xfd63('0x13')];this[_0xfd63('0x14')]=_0x5d4d58[_0xfd63('0x15')];this['calleridnum']=_0x5d4d58[_0xfd63('0x16')];this[_0xfd63('0x17')]=_0x5d4d58['starttime'];this[_0xfd63('0x18')]=_0x5d4d58[_0xfd63('0x18')];this[_0xfd63('0x19')]=moment()['format'](_0xfd63('0x1a'));this[_0xfd63('0x1b')]=utils['getSeconds'](_0x5d4d58[_0xfd63('0x18')],_0x5d4d58[_0xfd63('0x17')]);this[_0xfd63('0x1c')]=0x0;this[_0xfd63('0x1d')]=utils[_0xfd63('0x1e')](this['endtime'],_0x5d4d58['responsetime']);this[_0xfd63('0x8')]=_0x5d4d58[_0xfd63('0x8')];this[_0xfd63('0x1f')]='IVR';this[_0xfd63('0x20')]=_0x4f442f[_0xfd63('0x21')];this[_0xfd63('0x22')]=_0x5d4d58[_0xfd63('0x22')];this[_0xfd63('0x23')]=_0x5d4d58['callbackuniqueid'];this[_0xfd63('0x24')]=_0x5d4d58[_0xfd63('0x24')];this[_0xfd63('0x25')]=_0x5d4d58[_0xfd63('0x25')];this['ContactId']=_0x5d4d58[_0xfd63('0x26')];this['ListId']=_0x5d4d58[_0xfd63('0x27')];this[_0xfd63('0x28')]=_0x5d4d58[_0xfd63('0x28')];this[_0xfd63('0x29')]=_0x5d4d58[_0xfd63('0x29')];this[_0xfd63('0x2a')]=_0x5d4d58[_0xfd63('0x2a')];}module[_0xfd63('0x2b')]=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 1496d9d..ab7d5e1 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 _0x5453=['endtime','getSeconds','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','name','starttime','responsetime'];(function(_0x3dfeb9,_0x1cc6e4){var _0x412314=function(_0x321253){while(--_0x321253){_0x3dfeb9['push'](_0x3dfeb9['shift']());}};_0x412314(++_0x1cc6e4);}(_0x5453,0x190));var _0x3545=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5453[_0x2c91e9];return _0x13f0ff;};'use strict';var utils=require(_0x3545('0x0'));function History(_0x41ab5b){this[_0x3545('0x1')]=_0x41ab5b[_0x3545('0x1')];this[_0x3545('0x2')]=_0x41ab5b[_0x3545('0x2')]||undefined;this[_0x3545('0x3')]=_0x41ab5b[_0x3545('0x3')];this[_0x3545('0x4')]=_0x41ab5b[_0x3545('0x3')]===_0x3545('0x5')?_0x3545('0x6'):_0x41ab5b[_0x3545('0x3')];this['countbusyretry']=_0x41ab5b[_0x3545('0x7')];this[_0x3545('0x8')]=_0x41ab5b[_0x3545('0x8')];this['countnoanswerretry']=_0x41ab5b[_0x3545('0x9')];this[_0x3545('0xa')]=_0x41ab5b['countbusyretry']+_0x41ab5b['countcongestionretry']+_0x41ab5b[_0x3545('0x9')]+_0x41ab5b[_0x3545('0xb')]+_0x41ab5b['countdropretry']+_0x41ab5b['countabandonedretry']+_0x41ab5b[_0x3545('0xc')]+_0x41ab5b[_0x3545('0xd')];this[_0x3545('0xb')]=_0x41ab5b[_0x3545('0xb')];this['countdropretry']=_0x41ab5b[_0x3545('0xe')];this[_0x3545('0xf')]=_0x41ab5b[_0x3545('0xf')];this[_0x3545('0xc')]=_0x41ab5b[_0x3545('0xc')];this[_0x3545('0xd')]=_0x41ab5b[_0x3545('0xd')];this[_0x3545('0x6')]=_0x41ab5b[_0x3545('0x6')];this[_0x3545('0x10')]=_0x41ab5b[_0x3545('0x11')];this['calleridnum']=_0x41ab5b['number'];this[_0x3545('0x12')]=_0x41ab5b[_0x3545('0x12')];this[_0x3545('0x13')]=_0x41ab5b['responsetime'];this[_0x3545('0x14')]=_0x41ab5b[_0x3545('0x13')];this['ringtime']=utils[_0x3545('0x15')](_0x41ab5b[_0x3545('0x13')],_0x41ab5b[_0x3545('0x12')]);this[_0x3545('0x16')]=0x0;this['talktime']=0x0;this['callback']=_0x41ab5b[_0x3545('0x17')];this[_0x3545('0x18')]=_0x41ab5b['callbackuniqueid'];this['callbackat']=_0x41ab5b[_0x3545('0x19')];this[_0x3545('0x1a')]=_0x41ab5b['recallme'];this[_0x3545('0x1b')]=_0x41ab5b['ContactId'];this[_0x3545('0x1c')]=_0x41ab5b['ListId'];this[_0x3545('0x1d')]=_0x41ab5b[_0x3545('0x1d')];this[_0x3545('0x1e')]=_0x41ab5b[_0x3545('0x1e')];this['CampaignId']=_0x41ab5b[_0x3545('0x1f')];this[_0x3545('0x20')]=_0x41ab5b[_0x3545('0x20')]||'';this[_0x3545('0x21')]=_0x41ab5b['originatecalleridname']||'';this['state']=_0x41ab5b['state'];this[_0x3545('0x22')]=_0x41ab5b[_0x3545('0x22')];}module['exports']=History; \ No newline at end of file +var _0xdfef=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x2af201,_0x41aa52){var _0xbe2b4d=function(_0x128d95){while(--_0x128d95){_0x2af201['push'](_0x2af201['shift']());}};_0xbe2b4d(++_0x41aa52);}(_0xdfef,0x6d));var _0xfdfe=function(_0x1cf686,_0xb5964c){_0x1cf686=_0x1cf686-0x0;var _0x18b341=_0xdfef[_0x1cf686];return _0x18b341;};'use strict';var utils=require(_0xfdfe('0x0'));function History(_0x7a982f){this[_0xfdfe('0x1')]=_0x7a982f[_0xfdfe('0x1')];this[_0xfdfe('0x2')]=_0x7a982f[_0xfdfe('0x2')]||undefined;this[_0xfdfe('0x3')]=_0x7a982f[_0xfdfe('0x3')];this[_0xfdfe('0x4')]=_0x7a982f[_0xfdfe('0x3')]===_0xfdfe('0x5')?_0xfdfe('0x6'):_0x7a982f[_0xfdfe('0x3')];this[_0xfdfe('0x7')]=_0x7a982f[_0xfdfe('0x7')];this[_0xfdfe('0x8')]=_0x7a982f[_0xfdfe('0x8')];this[_0xfdfe('0x9')]=_0x7a982f[_0xfdfe('0x9')];this[_0xfdfe('0xa')]=_0x7a982f[_0xfdfe('0x7')]+_0x7a982f[_0xfdfe('0x8')]+_0x7a982f[_0xfdfe('0x9')]+_0x7a982f[_0xfdfe('0xb')]+_0x7a982f['countdropretry']+_0x7a982f[_0xfdfe('0xc')]+_0x7a982f[_0xfdfe('0xd')]+_0x7a982f[_0xfdfe('0xe')];this['countnosuchnumberretry']=_0x7a982f[_0xfdfe('0xb')];this[_0xfdfe('0xf')]=_0x7a982f['countdropretry'];this[_0xfdfe('0xc')]=_0x7a982f[_0xfdfe('0xc')];this['countmachineretry']=_0x7a982f[_0xfdfe('0xd')];this[_0xfdfe('0xe')]=_0x7a982f[_0xfdfe('0xe')];this[_0xfdfe('0x6')]=_0x7a982f[_0xfdfe('0x6')];this[_0xfdfe('0x10')]=_0x7a982f[_0xfdfe('0x11')];this[_0xfdfe('0x12')]=_0x7a982f[_0xfdfe('0x13')];this[_0xfdfe('0x14')]=_0x7a982f['starttime'];this[_0xfdfe('0x15')]=_0x7a982f[_0xfdfe('0x15')];this[_0xfdfe('0x16')]=_0x7a982f['responsetime'];this['ringtime']=utils['getSeconds'](_0x7a982f[_0xfdfe('0x15')],_0x7a982f[_0xfdfe('0x14')]);this[_0xfdfe('0x17')]=0x0;this[_0xfdfe('0x18')]=0x0;this[_0xfdfe('0x19')]=_0x7a982f[_0xfdfe('0x19')];this[_0xfdfe('0x1a')]=_0x7a982f['callbackuniqueid'];this[_0xfdfe('0x1b')]=_0x7a982f['callbackat'];this['recallme']=_0x7a982f[_0xfdfe('0x1c')];this[_0xfdfe('0x1d')]=_0x7a982f['ContactId'];this[_0xfdfe('0x1e')]=_0x7a982f[_0xfdfe('0x1e')];this[_0xfdfe('0x1f')]=_0x7a982f['UserId'];this[_0xfdfe('0x20')]=_0x7a982f[_0xfdfe('0x20')];this[_0xfdfe('0x21')]=_0x7a982f[_0xfdfe('0x21')];this[_0xfdfe('0x22')]=_0x7a982f[_0xfdfe('0x22')]||'';this['originatecalleridname']=_0x7a982f[_0xfdfe('0x23')]||'';this[_0xfdfe('0x24')]=_0x7a982f[_0xfdfe('0x24')];this['statedesc']=_0x7a982f[_0xfdfe('0x25')];}module[_0xfdfe('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 588176c..07a0058 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 _0x88fe=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils','scheduledat','type','campaigntype','outbound','queue'];(function(_0x5797bb,_0x309200){var _0xd54303=function(_0x4a5686){while(--_0x4a5686){_0x5797bb['push'](_0x5797bb['shift']());}};_0xd54303(++_0x309200);}(_0x88fe,0x14a));var _0xe88f=function(_0x4ac424,_0x554b5d){_0x4ac424=_0x4ac424-0x0;var _0xe1b890=_0x88fe[_0x4ac424];return _0xe1b890;};'use strict';var utils=require(_0xe88f('0x0'));function QueueCallerAbandon(_0x1065ba,_0x1bf7ab){this[_0xe88f('0x1')]=_0x1065ba['scheduledat'];this[_0xe88f('0x2')]=_0x1065ba['type'];this[_0xe88f('0x3')]=_0x1065ba[_0xe88f('0x2')]===_0xe88f('0x4')?_0xe88f('0x5'):_0x1065ba['type'];this[_0xe88f('0x6')]=_0x1065ba[_0xe88f('0x6')];this[_0xe88f('0x7')]=_0x1065ba[_0xe88f('0x7')];this[_0xe88f('0x8')]=_0x1065ba[_0xe88f('0x8')];this[_0xe88f('0x9')]=_0x1065ba['countbusyretry']+_0x1065ba[_0xe88f('0x7')]+_0x1065ba['countnoanswerretry']+_0x1065ba[_0xe88f('0xa')]+_0x1065ba['countdropretry']+_0x1065ba[_0xe88f('0xb')]+_0x1065ba[_0xe88f('0xc')]+_0x1065ba['countagentrejectretry'];this['countnosuchnumberretry']=_0x1065ba[_0xe88f('0xa')];this[_0xe88f('0xd')]=_0x1065ba[_0xe88f('0xd')];this[_0xe88f('0xb')]=_0x1065ba[_0xe88f('0xb')];this[_0xe88f('0xc')]=_0x1065ba[_0xe88f('0xc')];this[_0xe88f('0xe')]=_0x1065ba[_0xe88f('0xe')];this[_0xe88f('0xf')]=_0x1bf7ab[_0xe88f('0xf')];this[_0xe88f('0x10')]=_0x1065ba[_0xe88f('0x11')];this[_0xe88f('0x12')]=_0x1065ba[_0xe88f('0x13')];this[_0xe88f('0x14')]=_0x1065ba['starttime'];this['responsetime']=_0x1065ba[_0xe88f('0x15')];this[_0xe88f('0x16')]=_0x1065ba[_0xe88f('0x16')];this[_0xe88f('0x17')]=_0x1065ba[_0xe88f('0x17')];this['endtime']=this[_0xe88f('0x16')];this['ringtime']=utils[_0xe88f('0x18')](_0x1065ba[_0xe88f('0x15')],_0x1065ba[_0xe88f('0x14')]);this[_0xe88f('0x19')]=utils[_0xe88f('0x18')](this[_0xe88f('0x16')],_0x1065ba[_0xe88f('0x15')]);this[_0xe88f('0x1a')]=0x0;this[_0xe88f('0x5')]=_0x1bf7ab[_0xe88f('0x5')];this[_0xe88f('0x1b')]=_0x1bf7ab['connectedlinename'];this[_0xe88f('0x1c')]=_0x1bf7ab['reason'];this[_0xe88f('0x1d')]=_0x1065ba[_0xe88f('0x1d')];this[_0xe88f('0x1e')]=_0x1065ba[_0xe88f('0x1e')];this[_0xe88f('0x1f')]=_0x1065ba[_0xe88f('0x1f')];this['recallme']=_0x1065ba['recallme'];this[_0xe88f('0x20')]=_0x1065ba['ContactId'];this[_0xe88f('0x21')]=_0x1065ba['ListId'];this[_0xe88f('0x22')]=_0x1065ba['UserId'];this[_0xe88f('0x23')]=_0x1065ba[_0xe88f('0x23')];this[_0xe88f('0x24')]=_0x1065ba[_0xe88f('0x24')];this['originatecalleridnum']=_0x1065ba[_0xe88f('0x25')]||'';this[_0xe88f('0x26')]=_0x1065ba[_0xe88f('0x26')]||'';this[_0xe88f('0x27')]=_0x1065ba[_0xe88f('0x27')];this[_0xe88f('0x28')]=_0x1065ba[_0xe88f('0x28')];this[_0xe88f('0x29')]=_0x1065ba[_0xe88f('0x29')];}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x395f=['dropreason','endtime','ringtime','getSeconds','holdtime','talktime','queue','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime'];(function(_0x1cd23d,_0xec4ea5){var _0x5e8ad5=function(_0x1603d8){while(--_0x1603d8){_0x1cd23d['push'](_0x1cd23d['shift']());}};_0x5e8ad5(++_0xec4ea5);}(_0x395f,0x145));var _0xf395=function(_0x2478df,_0x4f96ed){_0x2478df=_0x2478df-0x0;var _0x396975=_0x395f[_0x2478df];return _0x396975;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x41fd96,_0x54f00f){this[_0xf395('0x0')]=_0x41fd96[_0xf395('0x0')];this[_0xf395('0x1')]=_0x41fd96[_0xf395('0x1')];this[_0xf395('0x2')]=_0x41fd96[_0xf395('0x1')]==='outbound'?'queue':_0x41fd96['type'];this[_0xf395('0x3')]=_0x41fd96[_0xf395('0x3')];this[_0xf395('0x4')]=_0x41fd96['countcongestionretry'];this[_0xf395('0x5')]=_0x41fd96[_0xf395('0x5')];this['countglobal']=_0x41fd96[_0xf395('0x3')]+_0x41fd96[_0xf395('0x4')]+_0x41fd96[_0xf395('0x5')]+_0x41fd96['countnosuchnumberretry']+_0x41fd96['countdropretry']+_0x41fd96[_0xf395('0x6')]+_0x41fd96[_0xf395('0x7')]+_0x41fd96[_0xf395('0x8')];this[_0xf395('0x9')]=_0x41fd96[_0xf395('0x9')];this['countdropretry']=_0x41fd96[_0xf395('0xa')];this['countabandonedretry']=_0x41fd96['countabandonedretry'];this[_0xf395('0x7')]=_0x41fd96['countmachineretry'];this[_0xf395('0x8')]=_0x41fd96['countagentrejectretry'];this[_0xf395('0xb')]=_0x54f00f['uniqueid'];this[_0xf395('0xc')]=_0x41fd96[_0xf395('0xd')];this[_0xf395('0xe')]=_0x41fd96[_0xf395('0xf')];this['starttime']=_0x41fd96[_0xf395('0x10')];this['responsetime']=_0x41fd96[_0xf395('0x11')];this[_0xf395('0x12')]=_0x41fd96['droptime'];this[_0xf395('0x13')]=_0x41fd96[_0xf395('0x13')];this[_0xf395('0x14')]=this[_0xf395('0x12')];this[_0xf395('0x15')]=utils[_0xf395('0x16')](_0x41fd96[_0xf395('0x11')],_0x41fd96[_0xf395('0x10')]);this[_0xf395('0x17')]=utils[_0xf395('0x16')](this['droptime'],_0x41fd96[_0xf395('0x11')]);this[_0xf395('0x18')]=0x0;this[_0xf395('0x19')]=_0x54f00f['queue'];this['membername']=_0x54f00f[_0xf395('0x1a')];this['reason']=_0x54f00f[_0xf395('0x1b')];this[_0xf395('0x1c')]=_0x41fd96[_0xf395('0x1c')];this['callbackuniqueid']=_0x41fd96[_0xf395('0x1d')];this[_0xf395('0x1e')]=_0x41fd96[_0xf395('0x1e')];this[_0xf395('0x1f')]=_0x41fd96[_0xf395('0x1f')];this['ContactId']=_0x41fd96[_0xf395('0x20')];this[_0xf395('0x21')]=_0x41fd96[_0xf395('0x21')];this[_0xf395('0x22')]=_0x41fd96[_0xf395('0x22')];this[_0xf395('0x23')]=_0x41fd96['VoiceQueueId'];this[_0xf395('0x24')]=_0x41fd96['CampaignId'];this[_0xf395('0x25')]=_0x41fd96['originatecalleridnum']||'';this[_0xf395('0x26')]=_0x41fd96['originatecalleridname']||'';this[_0xf395('0x27')]=_0x41fd96[_0xf395('0x27')];this[_0xf395('0x28')]=_0x41fd96[_0xf395('0x28')];this[_0xf395('0x29')]=_0x41fd96[_0xf395('0x29')];}module[_0xf395('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 fa19f65..2d600c9 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 _0x5fdc=['dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','[getContactDialer]','temp','error','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','swapAdditionalPhones','[avgHandleTime]','avgHandleTime','[createHistory]','createHistory','util','../../../../config/logger'];(function(_0x380e87,_0x575674){var _0xe77efe=function(_0x8b4290){while(--_0x8b4290){_0x380e87['push'](_0x380e87['shift']());}};_0xe77efe(++_0x575674);}(_0x5fdc,0x127));var _0xc5fd=function(_0x54b641,_0x39e641){_0x54b641=_0x54b641-0x0;var _0xb071d7=_0x5fdc[_0x54b641];return _0xb071d7;};'use strict';var util=require(_0xc5fd('0x0'));var logger=require(_0xc5fd('0x1'))(_0xc5fd('0x2'));var cmHopper=require(_0xc5fd('0x3'));var cmHopperAdditionalPhone=require(_0xc5fd('0x4'));var cmHopperBlack=require(_0xc5fd('0x5'));var cmHopperHistory=require(_0xc5fd('0x6'));function inspectError(_0x4d015c){return util[_0xc5fd('0x7')](_0x4d015c,{'showHidden':![],'depth':null});}function getContactDialer(_0x1b6205,_0xca27a0,_0xea5748){return cmHopper[_0xc5fd('0x8')](_0x1b6205['id'],_0xca27a0,_0xea5748,_0x1b6205[_0xc5fd('0x9')])[_0xc5fd('0xa')](function(_0x5a2eb4){_0x1b6205['temp']=0x0;logger['error'](_0xc5fd('0xb'),inspectError(_0x5a2eb4));});}exports[_0xc5fd('0x8')]=getContactDialer;function getContactDialerIvr(_0x158e58,_0x45c91f){return cmHopper['getContactDialerIvr'](_0x158e58['id'],_0x45c91f,_0x158e58['dialOrderByScheduledAt'])[_0xc5fd('0xa')](function(_0x1edeec){_0x158e58[_0xc5fd('0xc')]=0x0;logger[_0xc5fd('0xd')](_0xc5fd('0xe'),inspectError(_0x1edeec));});}exports[_0xc5fd('0xf')]=getContactDialerIvr;function countReScheduled(_0x484bbd){return cmHopper[_0xc5fd('0x10')](_0x484bbd)['catch'](function(_0x558939){logger[_0xc5fd('0xd')](_0xc5fd('0x11'),inspectError(_0x558939));});}exports[_0xc5fd('0x10')]=countReScheduled;function rescheduleContact(_0x23ac5d){return cmHopper[_0xc5fd('0x12')](_0x23ac5d)[_0xc5fd('0xa')](function(_0x27447e){logger[_0xc5fd('0xd')]('[rescheduleContact]',inspectError(_0x27447e));});}exports[_0xc5fd('0x12')]=rescheduleContact;function unlockContact(_0x103c3d,_0x2221da,_0x3404e0){return cmHopper['unlockContact'](_0x103c3d,_0x2221da,_0x3404e0)['catch'](function(_0x4efafd){logger['error']('[unlockContact]',inspectError(_0x4efafd));});}exports[_0xc5fd('0x13')]=unlockContact;function moveContactManagedDialer(_0x430e52){return cmHopper[_0xc5fd('0x14')](_0x430e52)[_0xc5fd('0xa')](function(_0x2ee392){logger[_0xc5fd('0xd')](_0xc5fd('0x15'),inspectError(_0x2ee392));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0xb7bab1){return cmHopperBlack[_0xc5fd('0x16')](_0xb7bab1)[_0xc5fd('0xa')](function(_0x9c12e4){logger[_0xc5fd('0xd')]('[checkIsBlackList]',inspectError(_0x9c12e4));});}exports[_0xc5fd('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x24e5e9){return cmHopperBlack[_0xc5fd('0x17')](_0x24e5e9)[_0xc5fd('0xa')](function(_0x5a7bdc){logger['error'](_0xc5fd('0x18'),inspectError(_0x5a7bdc));});}exports[_0xc5fd('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x3d7211,_0x42d7f4,_0x334401){return cmHopperAdditionalPhone[_0xc5fd('0x19')](_0x3d7211,_0x42d7f4,_0x334401)['catch'](function(_0x1a3f21){logger[_0xc5fd('0xd')](_0xc5fd('0x1a'),inspectError(_0x1a3f21));});}exports[_0xc5fd('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x39bb5e,_0x4020af,_0x475b91){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x39bb5e,_0x4020af,_0x475b91)[_0xc5fd('0xa')](function(_0x48cd1d){logger[_0xc5fd('0xd')](_0xc5fd('0x1b'),inspectError(_0x48cd1d));});}exports[_0xc5fd('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x2bee22){return cmHopperHistory['avgHandleTime'](_0x2bee22)[_0xc5fd('0xa')](function(_0x1bbdc4){logger[_0xc5fd('0xd')](_0xc5fd('0x1d'),inspectError(_0x1bbdc4));});}exports[_0xc5fd('0x1e')]=avgHandleTime;function createHistory(_0x209975){return cmHopperHistory['createHistory'](_0x209975)[_0xc5fd('0xa')](function(_0x5d4f70){logger['error'](_0xc5fd('0x1f'),inspectError(_0x5d4f70));});}exports[_0xc5fd('0x20')]=createHistory; \ No newline at end of file +var _0x0a6b=['verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','temp','error','getContactDialerIvr','catch','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x36e030,_0x65682b){_0x36e030=_0x36e030-0x0;var _0xf26989=_0x0a6b[_0x36e030];return _0xf26989;};'use strict';var util=require(_0xb0a6('0x0'));var logger=require('../../../../config/logger')('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0xb0a6('0x1'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0xb0a6('0x2'));function inspectError(_0x13dc41){return util[_0xb0a6('0x3')](_0x13dc41,{'showHidden':![],'depth':null});}function getContactDialer(_0x544a64,_0x102ecd,_0x4cc3ae){return cmHopper[_0xb0a6('0x4')](_0x544a64['id'],_0x102ecd,_0x4cc3ae,_0x544a64[_0xb0a6('0x5')])['catch'](function(_0x11cd5b){_0x544a64[_0xb0a6('0x6')]=0x0;logger[_0xb0a6('0x7')]('[getContactDialer]',inspectError(_0x11cd5b));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x5161af,_0x2ded05){return cmHopper[_0xb0a6('0x8')](_0x5161af['id'],_0x2ded05,_0x5161af[_0xb0a6('0x5')])[_0xb0a6('0x9')](function(_0x5252ed){_0x5161af[_0xb0a6('0x6')]=0x0;logger[_0xb0a6('0x7')]('[getContactDialerIvr]',inspectError(_0x5252ed));});}exports[_0xb0a6('0x8')]=getContactDialerIvr;function countReScheduled(_0x24e4fd){return cmHopper[_0xb0a6('0xa')](_0x24e4fd)[_0xb0a6('0x9')](function(_0x471d0f){logger[_0xb0a6('0x7')](_0xb0a6('0xb'),inspectError(_0x471d0f));});}exports[_0xb0a6('0xa')]=countReScheduled;function rescheduleContact(_0x392f48){return cmHopper[_0xb0a6('0xc')](_0x392f48)['catch'](function(_0x2b801a){logger['error'](_0xb0a6('0xd'),inspectError(_0x2b801a));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x25582f,_0x59730e,_0x1d837f){return cmHopper[_0xb0a6('0xe')](_0x25582f,_0x59730e,_0x1d837f)[_0xb0a6('0x9')](function(_0x5673ad){logger['error'](_0xb0a6('0xf'),inspectError(_0x5673ad));});}exports[_0xb0a6('0xe')]=unlockContact;function moveContactManagedDialer(_0x59bc9c){return cmHopper[_0xb0a6('0x10')](_0x59bc9c)[_0xb0a6('0x9')](function(_0x13a1c8){logger['error'](_0xb0a6('0x11'),inspectError(_0x13a1c8));});}exports[_0xb0a6('0x10')]=moveContactManagedDialer;function checkIsBlackList(_0x372457){return cmHopperBlack[_0xb0a6('0x12')](_0x372457)[_0xb0a6('0x9')](function(_0x30ac04){logger['error'](_0xb0a6('0x13'),inspectError(_0x30ac04));});}exports[_0xb0a6('0x12')]=checkIsBlackList;function checkIsBlackListIvr(_0x2d0fca){return cmHopperBlack[_0xb0a6('0x14')](_0x2d0fca)[_0xb0a6('0x9')](function(_0x10e56b){logger[_0xb0a6('0x7')](_0xb0a6('0x15'),inspectError(_0x10e56b));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x3db6a6,_0x5c6e66,_0x1322ec){return cmHopperAdditionalPhone[_0xb0a6('0x16')](_0x3db6a6,_0x5c6e66,_0x1322ec)['catch'](function(_0x4aa68d){logger[_0xb0a6('0x7')](_0xb0a6('0x17'),inspectError(_0x4aa68d));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x3ea787,_0x24574a,_0x259f47){return cmHopperAdditionalPhone[_0xb0a6('0x18')](_0x3ea787,_0x24574a,_0x259f47)['catch'](function(_0x5e2a7c){logger[_0xb0a6('0x7')](_0xb0a6('0x19'),inspectError(_0x5e2a7c));});}exports[_0xb0a6('0x18')]=swapAdditionalPhones;function avgHandleTime(_0x58d923){return cmHopperHistory[_0xb0a6('0x1a')](_0x58d923)[_0xb0a6('0x9')](function(_0x3edd9a){logger[_0xb0a6('0x7')](_0xb0a6('0x1b'),inspectError(_0x3edd9a));});}exports[_0xb0a6('0x1a')]=avgHandleTime;function createHistory(_0x94d47f){return cmHopperHistory[_0xb0a6('0x1c')](_0x94d47f)[_0xb0a6('0x9')](function(_0x4ced9f){logger[_0xb0a6('0x7')](_0xb0a6('0x1d'),inspectError(_0x4ced9f));});}exports[_0xb0a6('0x1c')]=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 e912569..f2954c3 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 _0x0889=['preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','seconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','SIP/','reachable','unmonitored','status','TrunkBackup','includes','INACTIVE','originated','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','\x22%s\x22\x20<%s>','format','getCallerId','\x5cw{0,','pow','replace','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','undefined','description','toUpperCase','substring','XMD-','lodash','util','dialer','../../../../config/environment/shared','timezones','BLACKLIST','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','RECALLINQUEUE','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod'];(function(_0x25167e,_0x489eca){var _0x3cf117=function(_0x343fe2){while(--_0x343fe2){_0x25167e['push'](_0x25167e['shift']());}};_0x3cf117(++_0x489eca);}(_0x0889,0x1f4));var _0x9088=function(_0x57888a,_0x344b64){_0x57888a=_0x57888a-0x0;var _0x444721=_0x0889[_0x57888a];return _0x444721;};'use strict';var _=require(_0x9088('0x0'));var moment=require('moment');var util=require(_0x9088('0x1'));var logger=require('../../../../config/logger')(_0x9088('0x2'));var timezones=require(_0x9088('0x3'))[_0x9088('0x4')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0x9088('0x5'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x9088('0x6'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0x9088('0x7'),'NO_AGENTS_LOGGED':_0x9088('0x8'),'NO_AVAILABLE_CONTACTS':_0x9088('0x9'),'NULL_INTERVAL':_0x9088('0xa'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x9088('0xb'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x9088('0xc'),'UNKNOWN_TIMEZONE':_0x9088('0xd'),'UNREACHABLE_TRUNK':_0x9088('0xe')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x415db8){return _0x415db8[_0x9088('0xf')]===_0x9088('0x10');}exports[_0x9088('0x11')]=isPreviewCampaign;function isIVRCampaign(_0x1736cb){return _0x1736cb[_0x9088('0x12')]===_0x9088('0x13');}exports[_0x9088('0x14')]=isIVRCampaign;function isOutboundQueue(_0xcc61c3){return _0xcc61c3[_0x9088('0x12')]===_0x9088('0x15');}exports[_0x9088('0x16')]=isOutboundQueue;function isQueueCampaignActive(_0x289733){return _0x289733[_0x9088('0x17')];}exports[_0x9088('0x18')]=isQueueCampaignActive;function isIVRCampaignActive(_0x35aee3){return _0x35aee3[_0x9088('0x19')];}exports[_0x9088('0x1a')]=isIVRCampaignActive;function getSeconds(_0xf2f47a,_0xdb838b){var _0x48b83f=moment(_0xf2f47a)[_0x9088('0x1b')](0x0);var _0x184d85=moment(_0xdb838b)[_0x9088('0x1b')](0x0);return _0x48b83f['diff'](_0x184d85,_0x9088('0x1c'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x4b6093,_0x1fd488){var _0x16e2b0=![];var _0x42eca4=_0x4b6093[_0x9088('0xf')]!==_0x1fd488[_0x9088('0xf')]||_0x4b6093[_0x9088('0x17')]!==_0x1fd488[_0x9088('0x17')]||_0x4b6093[_0x9088('0x1d')]!==_0x1fd488[_0x9088('0x1d')];var _0x4d2a78=_0x4b6093[_0x9088('0x1e')]!==_0x1fd488[_0x9088('0x1e')]||_0x4b6093[_0x9088('0x1f')]!==_0x1fd488[_0x9088('0x1f')]||_0x4b6093[_0x9088('0x20')]!==_0x1fd488['loggedInDb']||_0x4b6093[_0x9088('0x21')]!==_0x1fd488[_0x9088('0x21')]||_0x4b6093[_0x9088('0x22')]!==_0x1fd488[_0x9088('0x22')]||_0x4b6093[_0x9088('0x23')]!==_0x1fd488['pTalking']||_0x4b6093[_0x9088('0x24')]!==_0x1fd488[_0x9088('0x24')]||_0x4b6093[_0x9088('0x25')]!==_0x1fd488[_0x9088('0x25')]||_0x4b6093['originated']!==_0x1fd488['originated'];if(_0x4b6093[_0x9088('0x26')]&&_0x1fd488[_0x9088('0x26')]){_0x16e2b0=_0x4b6093['Trunk'][_0x9088('0x27')]!==_0x1fd488['Trunk'][_0x9088('0x27')]||_0x4b6093[_0x9088('0x26')]['active']!==_0x1fd488[_0x9088('0x26')][_0x9088('0x19')];}return _0x42eca4||_0x4d2a78||_0x16e2b0;}exports[_0x9088('0x28')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x20fb6d){var _0x38d781=null;var _0x13afc5=_0x20fb6d[_0x9088('0x29')];if(_[_0x9088('0x2a')](_0x20fb6d[_0x9088('0x2b')])||_[_0x9088('0x2a')](_0x20fb6d[_0x9088('0x2c')])||_['isNil'](_0x20fb6d[_0x9088('0x2c')][_0x9088('0x2d')])){_0x38d781=CAMPAIGN_STATUS[_0x9088('0x2e')];}else if(_['isEmpty'](_0x20fb6d[_0x9088('0x2b')])||_[_0x9088('0x2f')](_0x20fb6d[_0x9088('0x2c')][_0x9088('0x2d')])){_0x38d781=CAMPAIGN_STATUS[_0x9088('0x30')];}else if(_0x13afc5&&!timezones[_0x13afc5]){_0x38d781=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x38d781;}function checkAnyValidTrunk(_0x263c88,_0x3ddf2e){var _0x4eea78=null;var _0x443260=_0x9088('0x31');var _0x3385dd=[_0x9088('0x32'),_0x9088('0x33')];var _0x1398d3=!![];if(_0x263c88[_0x9088('0x26')]&&_0x263c88[_0x9088('0x26')][_0x9088('0x19')]){_0x443260+=_0x263c88['Trunk'][_0x9088('0x27')];_0x4eea78=_0x3ddf2e[_0x443260];_0x1398d3=_0x3385dd['includes'](_0x4eea78[_0x9088('0x34')]);}else if(_0x263c88[_0x9088('0x35')]&&_0x263c88[_0x9088('0x35')][_0x9088('0x19')]){_0x443260+=_0x263c88[_0x9088('0x35')][_0x9088('0x27')];_0x4eea78=_0x3ddf2e[_0x443260];_0x1398d3=_0x3385dd[_0x9088('0x36')](_0x4eea78['status']);}return _0x1398d3;}function getQueueCampaignStatusMessage(_0x2a24e6,_0xee24c4){var _0x572ae8=CAMPAIGN_STATUS['ACTIVE'];var _0x312f51=isPreviewCampaign(_0x2a24e6);if(!isQueueCampaignActive(_0x2a24e6)){if(_0x312f51){_0x572ae8=CAMPAIGN_STATUS[_0x9088('0x37')];}else{if(_0x2a24e6[_0x9088('0x38')]===0x0&&_0x2a24e6[_0x9088('0x22')]===0x0&&_0x2a24e6[_0x9088('0x24')]===0x0&&(_0x2a24e6[_0x9088('0x23')]||0x0)===0x0){_0x572ae8=CAMPAIGN_STATUS['INACTIVE'];}else{_0x572ae8=CAMPAIGN_STATUS[_0x9088('0x39')];}}}else if(_0x2a24e6[_0x9088('0x1f')]===0x0){_0x572ae8=CAMPAIGN_STATUS[_0x9088('0x3a')];}else if(!checkAnyValidTrunk(_0x2a24e6,_0xee24c4)){_0x572ae8=CAMPAIGN_STATUS[_0x9088('0x3b')];}else if(!isPreviewCampaign(_0x2a24e6)){var _0x4b0c5c=checkAnyValidQueueCampaignInterval(_0x2a24e6);if(_0x4b0c5c){_0x572ae8=_0x4b0c5c;}}return _0x572ae8;}exports[_0x9088('0x3c')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x314cc8){var _0x517fef=CAMPAIGN_STATUS[_0x9088('0x39')];if(_0x314cc8[_0x9088('0x38')]===0x0&&_0x314cc8[_0x9088('0x22')]===0x0&&_0x314cc8[_0x9088('0x24')]===0x0&&(_0x314cc8[_0x9088('0x23')]||0x0)===0x0){_0x517fef=CAMPAIGN_STATUS[_0x9088('0x37')];}return _0x517fef;}exports[_0x9088('0x3d')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2a2104){var _0x1be35a=_0x2a2104['match'](/"(.*?)"/);return _0x1be35a?_0x1be35a[0x1]:_0x2a2104;}exports[_0x9088('0x3e')]=extractCalleridName;function getCallerId(_0x20d9e5,_0x4e9aa9,_0x9ab172){if(!_[_0x9088('0x3f')](_0x9ab172)&&typeof _0x9ab172===_0x9088('0x40')&&!_[_0x9088('0x2f')](_0x9ab172)){if(!_[_0x9088('0x3f')](_0x4e9aa9)&&typeof _0x4e9aa9===_0x9088('0x40')&&!_[_0x9088('0x2f')](_0x4e9aa9)){return util['format'](_0x9088('0x41'),_0x4e9aa9,_0x9ab172);}return util[_0x9088('0x42')]('\x22%s\x22\x20<%s>',_0x9ab172,_0x9ab172);}if(!_[_0x9088('0x3f')](_0x20d9e5)&&typeof _0x20d9e5===_0x9088('0x40')&&!_[_0x9088('0x2f')](_0x20d9e5)){return _0x20d9e5;}return'\x22\x22\x20<>';}exports[_0x9088('0x43')]=getCallerId;function getCallerIdRandom(_0x3df8d5,_0x1df97d){var _0xb5190a;var _0x507f5a;var _0x16b915;if(_0x1df97d<=0x0){_0x1df97d=0x1;}_0xb5190a=new RegExp(_0x9088('0x44')+_0x1df97d+'}$');_0x507f5a=Math[_0x9088('0x45')](0xa,_0x1df97d-0x1);_0x16b915=Math['pow'](0xa,_0x1df97d)-0x1;return util[_0x9088('0x42')]('%s',_[_0x9088('0x46')](_0x3df8d5,_0xb5190a,_['random'](_0x507f5a,_0x16b915)[_0x9088('0x47')]()));}exports[_0x9088('0x48')]=getCallerIdRandom;function decrementOriginate(_0x5e4db2){if(_0x5e4db2[_0x9088('0x38')]&&_0x5e4db2[_0x9088('0x38')]>0x0){_0x5e4db2[_0x9088('0x38')]-=0x1;}else{logger['error'](_0x9088('0x49'));}}exports[_0x9088('0x4a')]=decrementOriginate;function checkContactEmpty(_0x59b4fa){return _0x59b4fa&&_0x59b4fa[_0x9088('0x4b')]>0x0;}exports[_0x9088('0x4c')]=checkContactEmpty;function erlangb(_0x1158a3,_0x5ea820){if(_0x5ea820===0x0){return 0x0;}var _0xb5a47b=0x1;for(var _0x468d2e=0x1;_0x468d2e<=_0x5ea820;_0x468d2e+=0x1){_0xb5a47b=0x1+_0xb5a47b*_0x468d2e/_0x1158a3;}return 0x1/_0xb5a47b;}exports[_0x9088('0x4d')]=erlangb;function checkContactLowerLimitOriginate(_0xa1cc2a,_0x131c21,_0x1fc201){if(_0x131c21>_0x1fc201){for(var _0x5c489a=0x0;_0x5c489a<_0x131c21-_0x1fc201;_0x5c489a+=0x1){decrementOriginate(_0xa1cc2a);}}}exports[_0x9088('0x4e')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x17824d){var _0x492889={};var _0xb9157e=['id',_0x9088('0x4f'),_0x9088('0x50'),'updatedAt'];const _0x2de4c3=0xfa;if(_0x17824d){for(var _0x1c7fc2 in _0x17824d){if(typeof _0x17824d[_0x1c7fc2]!==_0x9088('0x51')){if(!_[_0x9088('0x2a')](_0x17824d[_0x1c7fc2])&&!_0xb9157e[_0x9088('0x36')](_0x1c7fc2)){if(_0x1c7fc2===_0x9088('0x52')&&_0x17824d[_0x1c7fc2]['length']>_0x2de4c3){_0x492889['XMD-'+_0x1c7fc2[_0x9088('0x53')]()]=_0x17824d[_0x1c7fc2][_0x9088('0x47')]()[_0x9088('0x54')](0x0,_0x2de4c3);}else{_0x492889[_0x9088('0x55')+_0x1c7fc2[_0x9088('0x53')]()]=_0x17824d[_0x1c7fc2];}}}}}return _0x492889;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0x4965=['NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','\x22%s\x22\x20<%s>','format','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','undefined','XMD-','substring','toUpperCase','setXMDContactVariables','lodash','moment','util','../../../../config/logger','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','DEACTIVATED','IS_DISACTIVED','AGENTS_NOT_LOGGED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','isQueueCampaignActive','milliseconds','diff','seconds','getSeconds','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','UNKNOWN_TIMEZONE','SIP/','reachable','includes','status','TrunkBackup','INACTIVE','DISACTIVED'];(function(_0xcbadd4,_0x113f1e){var _0x3c5b22=function(_0x2abfd5){while(--_0x2abfd5){_0xcbadd4['push'](_0xcbadd4['shift']());}};_0x3c5b22(++_0x113f1e);}(_0x4965,0xc0));var _0x5496=function(_0x14282b,_0x36d885){_0x14282b=_0x14282b-0x0;var _0x41fe5b=_0x4965[_0x14282b];return _0x41fe5b;};'use strict';var _=require(_0x5496('0x0'));var moment=require(_0x5496('0x1'));var util=require(_0x5496('0x2'));var logger=require(_0x5496('0x3'))('dialer');var timezones=require(_0x5496('0x4'))[_0x5496('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x5496('0x6'),'BLACKLIST':_0x5496('0x7'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0x5496('0x8'),'DISACTIVED':_0x5496('0x9'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x5496('0xa'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0x5496('0xb'),'OVERTIME_GLOBAL_INTERVAL':_0x5496('0xc'),'QUEUE_RECALL':_0x5496('0xd'),'RECALL_TIMEOUT':_0x5496('0xe'),'RUNNING':_0x5496('0xf'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0x5496('0x10')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x10c94b){return _0x10c94b[_0x5496('0x11')]===_0x5496('0x12');}exports[_0x5496('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x4c46ae){return _0x4c46ae[_0x5496('0x14')]===_0x5496('0x15');}exports[_0x5496('0x16')]=isIVRCampaign;function isOutboundQueue(_0x4da3ba){return _0x4da3ba['type']==='outbound';}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x5bdf2d){return _0x5bdf2d['dialActive'];}exports[_0x5496('0x17')]=isQueueCampaignActive;function isIVRCampaignActive(_0x2fc3f7){return _0x2fc3f7['active'];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x43a4cb,_0x5c184f){var _0x524318=moment(_0x43a4cb)[_0x5496('0x18')](0x0);var _0x33b76f=moment(_0x5c184f)[_0x5496('0x18')](0x0);return _0x524318[_0x5496('0x19')](_0x33b76f,_0x5496('0x1a'));}exports[_0x5496('0x1b')]=getSeconds;function hasQueueCampaignDataChanged(_0x7c2b0a,_0x185f6a){var _0x56f88f=![];var _0x252889=_0x7c2b0a[_0x5496('0x11')]!==_0x185f6a[_0x5496('0x11')]||_0x7c2b0a[_0x5496('0x1c')]!==_0x185f6a[_0x5496('0x1c')]||_0x7c2b0a[_0x5496('0x1d')]!==_0x185f6a['message'];var _0x3ab2e7=_0x7c2b0a[_0x5496('0x1e')]!==_0x185f6a[_0x5496('0x1e')]||_0x7c2b0a['loggedIn']!==_0x185f6a[_0x5496('0x1f')]||_0x7c2b0a[_0x5496('0x20')]!==_0x185f6a['loggedInDb']||_0x7c2b0a['paused']!==_0x185f6a[_0x5496('0x21')]||_0x7c2b0a[_0x5496('0x22')]!==_0x185f6a['talking']||_0x7c2b0a[_0x5496('0x23')]!==_0x185f6a[_0x5496('0x23')]||_0x7c2b0a[_0x5496('0x24')]!==_0x185f6a[_0x5496('0x24')]||_0x7c2b0a[_0x5496('0x25')]!==_0x185f6a[_0x5496('0x25')]||_0x7c2b0a[_0x5496('0x26')]!==_0x185f6a[_0x5496('0x26')];if(_0x7c2b0a[_0x5496('0x27')]&&_0x185f6a['Trunk']){_0x56f88f=_0x7c2b0a[_0x5496('0x27')][_0x5496('0x28')]!==_0x185f6a['Trunk']['name']||_0x7c2b0a[_0x5496('0x27')][_0x5496('0x29')]!==_0x185f6a['Trunk'][_0x5496('0x29')];}return _0x252889||_0x3ab2e7||_0x56f88f;}exports[_0x5496('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x375af0){var _0x357940=null;var _0x121a46=_0x375af0['dialTimezone'];if(_[_0x5496('0x2b')](_0x375af0[_0x5496('0x2c')])||_['isNil'](_0x375af0[_0x5496('0x2d')])||_['isNil'](_0x375af0[_0x5496('0x2d')][_0x5496('0x2e')])){_0x357940=CAMPAIGN_STATUS[_0x5496('0x2f')];}else if(_[_0x5496('0x30')](_0x375af0[_0x5496('0x2c')])||_['isEmpty'](_0x375af0[_0x5496('0x2d')][_0x5496('0x2e')])){_0x357940=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x121a46&&!timezones[_0x121a46]){_0x357940=CAMPAIGN_STATUS[_0x5496('0x31')];}return _0x357940;}function checkAnyValidTrunk(_0x4a4dae,_0x418e95){var _0x1403aa=null;var _0x1824ad=_0x5496('0x32');var _0x452be8=[_0x5496('0x33'),'unmonitored'];var _0x208ecc=!![];if(_0x4a4dae[_0x5496('0x27')]&&_0x4a4dae[_0x5496('0x27')][_0x5496('0x29')]){_0x1824ad+=_0x4a4dae[_0x5496('0x27')][_0x5496('0x28')];_0x1403aa=_0x418e95[_0x1824ad];_0x208ecc=_0x452be8[_0x5496('0x34')](_0x1403aa[_0x5496('0x35')]);}else if(_0x4a4dae[_0x5496('0x36')]&&_0x4a4dae[_0x5496('0x36')]['active']){_0x1824ad+=_0x4a4dae[_0x5496('0x36')][_0x5496('0x28')];_0x1403aa=_0x418e95[_0x1824ad];_0x208ecc=_0x452be8[_0x5496('0x34')](_0x1403aa[_0x5496('0x35')]);}return _0x208ecc;}function getQueueCampaignStatusMessage(_0x1608cd,_0x34a0a1){var _0x1c8593=CAMPAIGN_STATUS[_0x5496('0x6')];var _0x485d0b=isPreviewCampaign(_0x1608cd);if(!isQueueCampaignActive(_0x1608cd)){if(_0x485d0b){_0x1c8593=CAMPAIGN_STATUS[_0x5496('0x37')];}else{if(_0x1608cd[_0x5496('0x26')]===0x0&&_0x1608cd['talking']===0x0&&_0x1608cd[_0x5496('0x24')]===0x0&&(_0x1608cd[_0x5496('0x23')]||0x0)===0x0){_0x1c8593=CAMPAIGN_STATUS[_0x5496('0x37')];}else{_0x1c8593=CAMPAIGN_STATUS[_0x5496('0x38')];}}}else if(_0x1608cd[_0x5496('0x1f')]===0x0){_0x1c8593=CAMPAIGN_STATUS[_0x5496('0x39')];}else if(!checkAnyValidTrunk(_0x1608cd,_0x34a0a1)){_0x1c8593=CAMPAIGN_STATUS[_0x5496('0x3a')];}else if(!isPreviewCampaign(_0x1608cd)){var _0x53db37=checkAnyValidQueueCampaignInterval(_0x1608cd);if(_0x53db37){_0x1c8593=_0x53db37;}}return _0x1c8593;}exports[_0x5496('0x3b')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x43358a){var _0x4dc3a4=CAMPAIGN_STATUS[_0x5496('0x38')];if(_0x43358a['originated']===0x0&&_0x43358a['talking']===0x0&&_0x43358a[_0x5496('0x24')]===0x0&&(_0x43358a[_0x5496('0x23')]||0x0)===0x0){_0x4dc3a4=CAMPAIGN_STATUS[_0x5496('0x37')];}return _0x4dc3a4;}exports[_0x5496('0x3c')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x384a88){var _0x43ec7b=_0x384a88[_0x5496('0x3d')](/"(.*?)"/);return _0x43ec7b?_0x43ec7b[0x1]:_0x384a88;}exports[_0x5496('0x3e')]=extractCalleridName;function getCallerId(_0x3ce1dc,_0x1efef8,_0x3686f2){if(!_[_0x5496('0x3f')](_0x3686f2)&&typeof _0x3686f2===_0x5496('0x40')&&!_[_0x5496('0x30')](_0x3686f2)){if(!_[_0x5496('0x3f')](_0x1efef8)&&typeof _0x1efef8===_0x5496('0x40')&&!_[_0x5496('0x30')](_0x1efef8)){return util['format'](_0x5496('0x41'),_0x1efef8,_0x3686f2);}return util[_0x5496('0x42')]('\x22%s\x22\x20<%s>',_0x3686f2,_0x3686f2);}if(!_[_0x5496('0x3f')](_0x3ce1dc)&&typeof _0x3ce1dc==='string'&&!_[_0x5496('0x30')](_0x3ce1dc)){return _0x3ce1dc;}return'\x22\x22\x20<>';}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x396a54,_0x1bfa0c){var _0x4d83d4;var _0x58a8f9;var _0x1e9ac3;if(_0x1bfa0c<=0x0){_0x1bfa0c=0x1;}_0x4d83d4=new RegExp('\x5cw{0,'+_0x1bfa0c+'}$');_0x58a8f9=Math['pow'](0xa,_0x1bfa0c-0x1);_0x1e9ac3=Math['pow'](0xa,_0x1bfa0c)-0x1;return util['format']('%s',_['replace'](_0x396a54,_0x4d83d4,_['random'](_0x58a8f9,_0x1e9ac3)[_0x5496('0x43')]()));}exports[_0x5496('0x44')]=getCallerIdRandom;function decrementOriginate(_0x5e191c){if(_0x5e191c['originated']&&_0x5e191c[_0x5496('0x26')]>0x0){_0x5e191c[_0x5496('0x26')]-=0x1;}else{logger[_0x5496('0x45')](_0x5496('0x46'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x507127){return _0x507127&&_0x507127[_0x5496('0x47')]>0x0;}exports[_0x5496('0x48')]=checkContactEmpty;function erlangb(_0x432a97,_0x35ccff){if(_0x35ccff===0x0){return 0x0;}var _0x191e7f=0x1;for(var _0x439d48=0x1;_0x439d48<=_0x35ccff;_0x439d48+=0x1){_0x191e7f=0x1+_0x191e7f*_0x439d48/_0x432a97;}return 0x1/_0x191e7f;}exports[_0x5496('0x49')]=erlangb;function checkContactLowerLimitOriginate(_0x3e7304,_0x26b0dc,_0x3423bd){if(_0x26b0dc>_0x3423bd){for(var _0x430ae3=0x0;_0x430ae3<_0x26b0dc-_0x3423bd;_0x430ae3+=0x1){decrementOriginate(_0x3e7304);}}}exports[_0x5496('0x4a')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x9ffaa3){var _0x23fcd5={};var _0x2b3f86=['id',_0x5496('0x4b'),_0x5496('0x4c'),_0x5496('0x4d')];const _0x5735d8=0xfa;if(_0x9ffaa3){for(var _0x91a7ef in _0x9ffaa3){if(typeof _0x9ffaa3[_0x91a7ef]!==_0x5496('0x4e')){if(!_[_0x5496('0x2b')](_0x9ffaa3[_0x91a7ef])&&!_0x2b3f86[_0x5496('0x34')](_0x91a7ef)){if(_0x91a7ef==='description'&&_0x9ffaa3[_0x91a7ef][_0x5496('0x47')]>_0x5735d8){_0x23fcd5[_0x5496('0x4f')+_0x91a7ef['toUpperCase']()]=_0x9ffaa3[_0x91a7ef][_0x5496('0x43')]()[_0x5496('0x50')](0x0,_0x5735d8);}else{_0x23fcd5[_0x5496('0x4f')+_0x91a7ef[_0x5496('0x51')]()]=_0x9ffaa3[_0x91a7ef];}}}}}return _0x23fcd5;}exports[_0x5496('0x52')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index b501582..a7b950e 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(_0x42ff68,_0x9e23a3){var _0x535bbe=function(_0x5b0dc0){while(--_0x5b0dc0){_0x42ff68['push'](_0x42ff68['shift']());}};_0x535bbe(++_0x9e23a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0x55f7c5,_0x304848){var _0x49f894=function(_0x4fc9cc){while(--_0x4fc9cc){_0x55f7c5['push'](_0x55f7c5['shift']());}};_0x49f894(++_0x304848);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 a96c62b..93754a3 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 _0xa3fc=['exports','util','bluebird','uuid','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','trunks','newchannel','varset','syncVarSet','bind','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','faxAccounts','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','value','syncNewState','channelstate','channelstatedesc','operation','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','message','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','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','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','status','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid'];(function(_0x14ed44,_0x3f3dd7){var _0x31647b=function(_0x1722bf){while(--_0x1722bf){_0x14ed44['push'](_0x14ed44['shift']());}};_0x31647b(++_0x3f3dd7);}(_0xa3fc,0x1e5));var _0xca3f=function(_0x53807d,_0x4a90a8){_0x53807d=_0x53807d-0x0;var _0x501207=_0xa3fc[_0x53807d];return _0x501207;};'use strict';var util=require(_0xca3f('0x0'));var _=require('lodash');var BPromise=require(_0xca3f('0x1'));var uuid=require(_0xca3f('0x2'));var moment=require('moment');var path=require(_0xca3f('0x3'));var tiff2pdf=require(_0xca3f('0x4'));var gs=require('./util/gs');var logger=require(_0xca3f('0x5'))(_0xca3f('0x6'));var ami=require(_0xca3f('0x7'));var rpcDb=require(_0xca3f('0x8'));var Channel=require(_0xca3f('0x9'));var ut=require(_0xca3f('0xa'));var Action=require(_0xca3f('0xb'));var faxAccount=require(_0xca3f('0xc'));var attachment=require(_0xca3f('0xd'));var faxMessage=require(_0xca3f('0xe'));function Fax(_0x215b50){this['channels']={};this['faxAccounts']=_0x215b50['faxAccounts'];this[_0xca3f('0xf')]=_0x215b50['trunks'];this['actions']={};ami['on'](_0xca3f('0x10'),this['syncNewchannel']['bind'](this));ami['on'](_0xca3f('0x11'),this[_0xca3f('0x12')][_0xca3f('0x13')](this));ami['on'](_0xca3f('0x14'),this['syncNewState'][_0xca3f('0x13')](this));ami['on'](_0xca3f('0x15'),this[_0xca3f('0x16')]['bind'](this));ami['on'](_0xca3f('0x17'),this[_0xca3f('0x18')]['bind'](this));ami['on']('receivefax',this[_0xca3f('0x19')][_0xca3f('0x13')](this));ami['on']('hangup',this[_0xca3f('0x1a')]['bind'](this));ami['on'](_0xca3f('0x1b'),this[_0xca3f('0x1c')][_0xca3f('0x13')](this));}Fax[_0xca3f('0x1d')][_0xca3f('0x1e')]=function(_0x26e2ea){if(_0x26e2ea[_0xca3f('0x1f')]==='from-voip-provider'){for(var _0x4bb4da in this[_0xca3f('0x20')]){if(this[_0xca3f('0x20')][_0xca3f('0x21')](_0x4bb4da)){if(_0x26e2ea[_0xca3f('0x22')]===this[_0xca3f('0x20')][_0x4bb4da][_0xca3f('0x23')]){this[_0xca3f('0x24')][_0x26e2ea[_0xca3f('0x25')]]={};this[_0xca3f('0x24')][_0x26e2ea['uniqueid']][_0xca3f('0x26')]=_0x26e2ea[_0xca3f('0x26')];this[_0xca3f('0x24')][_0x26e2ea[_0xca3f('0x25')]]['id']=this[_0xca3f('0x20')][_0x4bb4da]['id'];this[_0xca3f('0x24')][_0x26e2ea[_0xca3f('0x25')]][_0xca3f('0x27')]=this[_0xca3f('0x20')][_0x4bb4da][_0xca3f('0x27')];logger[_0xca3f('0x28')](_0x26e2ea[_0xca3f('0x25')],_0xca3f('0x29'));}}}}if(this[_0xca3f('0x2a')][_0x26e2ea[_0xca3f('0x25')]]){this[_0xca3f('0x24')][_0x26e2ea[_0xca3f('0x25')]]={};this[_0xca3f('0x24')][_0x26e2ea['uniqueid']][_0xca3f('0x26')]=_0x26e2ea[_0xca3f('0x26')];logger[_0xca3f('0x28')](_0x26e2ea[_0xca3f('0x25')],_0xca3f('0x29'));}};Fax[_0xca3f('0x1d')][_0xca3f('0x12')]=function(_0x162194){if(this['channels'][_0x162194['uniqueid']]){for(var _0x1c997b in _0x162194[_0xca3f('0x2b')]){if(_0x162194['variable']['hasOwnProperty'](_0x1c997b)){this[_0xca3f('0x24')][_0x162194[_0xca3f('0x25')]][_0x1c997b]=_0x162194[_0xca3f('0x2c')];}}}};Fax[_0xca3f('0x1d')][_0xca3f('0x2d')]=function(_0x224490){if(this['channels'][_0x224490[_0xca3f('0x25')]]){this[_0xca3f('0x24')][_0x224490[_0xca3f('0x25')]][_0xca3f('0x2e')]=_0x224490[_0xca3f('0x2e')];this[_0xca3f('0x24')][_0x224490[_0xca3f('0x25')]][_0xca3f('0x2f')]=_0x224490[_0xca3f('0x2f')];}};Fax['prototype'][_0xca3f('0x16')]=function(_0x43e5f3){if(this[_0xca3f('0x24')][_0x43e5f3[_0xca3f('0x25')]]){for(var _0x352b56 in _0x43e5f3[_0xca3f('0x2b')]){if(_0x43e5f3[_0xca3f('0x2b')][_0xca3f('0x21')](_0x352b56)){this['channels'][_0x43e5f3['uniqueid']][_0x352b56]=_0x43e5f3['value'];}}}};Fax[_0xca3f('0x1d')][_0xca3f('0x18')]=function(_0x1122fd){if(this[_0xca3f('0x24')][_0x1122fd['uniqueid']]){this[_0xca3f('0x24')][_0x1122fd[_0xca3f('0x25')]][_0xca3f('0x30')]=_0x1122fd[_0xca3f('0x30')];this[_0xca3f('0x24')][_0x1122fd[_0xca3f('0x25')]]['status']=_0x1122fd['status'];this[_0xca3f('0x24')][_0x1122fd['uniqueid']][_0xca3f('0x23')]=_0x1122fd['localstationid'];this[_0xca3f('0x24')][_0x1122fd['uniqueid']][_0xca3f('0x31')]=_0x1122fd[_0xca3f('0x31')];logger[_0xca3f('0x28')](_0x1122fd[_0xca3f('0x25')],_0xca3f('0x32'));}};Fax[_0xca3f('0x1d')]['syncReceiveFax']=function(_0x5cebab){var _0x5f2f12=this;if(this[_0xca3f('0x24')][_0x5cebab[_0xca3f('0x25')]]){var _0x1c9775=this[_0xca3f('0x24')][_0x5cebab[_0xca3f('0x25')]]['id'];this[_0xca3f('0x24')][_0x5cebab['uniqueid']][_0xca3f('0x33')]=_0x5cebab[_0xca3f('0x33')];this[_0xca3f('0x24')][_0x5cebab['uniqueid']][_0xca3f('0x34')]=_0x5cebab[_0xca3f('0x34')];this[_0xca3f('0x24')][_0x5cebab[_0xca3f('0x25')]][_0xca3f('0x23')]=_0x5cebab[_0xca3f('0x23')];this[_0xca3f('0x24')][_0x5cebab[_0xca3f('0x25')]][_0xca3f('0x35')]=_0x5cebab[_0xca3f('0x35')];this[_0xca3f('0x24')][_0x5cebab[_0xca3f('0x25')]]['transferrate']=_0x5cebab['transferrate'];this[_0xca3f('0x24')][_0x5cebab[_0xca3f('0x25')]][_0xca3f('0x31')]=_0x5cebab[_0xca3f('0x31')];this[_0xca3f('0x24')][_0x5cebab[_0xca3f('0x25')]][_0xca3f('0x36')]=_0x5cebab[_0xca3f('0x36')];if(this['channels'][_0x5cebab[_0xca3f('0x25')]]['pagestransferred']>0x0){tiff2pdf(_0x5cebab[_0xca3f('0x31')],_0xca3f('0x37'),function(_0x548c62){logger[_0xca3f('0x28')](_0x5cebab['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x548c62['message']);attachment[_0xca3f('0x38')]({'name':path[_0xca3f('0x39')](_0x5cebab[_0xca3f('0x31')])['name'],'basename':path[_0xca3f('0x39')](_0x5cebab[_0xca3f('0x31')])[_0xca3f('0x27')]+_0xca3f('0x3a'),'type':_0xca3f('0x3b')})[_0xca3f('0x3c')](function(_0x2bf537){faxAccount[_0xca3f('0x3d')](_0x1c9775,{'from':_0x5cebab[_0xca3f('0x36')],'mapKey':_0xca3f('0x6'),'body':path[_0xca3f('0x39')](_0x5cebab[_0xca3f('0x31')])[_0xca3f('0x27')]+_0xca3f('0x3a'),'AttachmentId':_0x2bf537['id']})[_0xca3f('0x3e')](function(_0x4d8da5){logger[_0xca3f('0x3f')](_0x5cebab[_0xca3f('0x25')],_0xca3f('0x40'),JSON[_0xca3f('0x41')](_0x4d8da5));});})[_0xca3f('0x3e')](function(_0x530be0){logger[_0xca3f('0x3f')](_0x5cebab[_0xca3f('0x25')],_0xca3f('0x42'),JSON[_0xca3f('0x41')](_0x530be0));});});}logger[_0xca3f('0x28')](_0x5cebab[_0xca3f('0x25')],_0xca3f('0x42'));}};Fax['prototype']['syncOriginateResponse']=function(_0x38d08f){if(this[_0xca3f('0x2a')][_0x38d08f[_0xca3f('0x25')]]){_[_0xca3f('0x43')](this[_0xca3f('0x24')][_0x38d08f[_0xca3f('0x25')]],_[_0xca3f('0x44')](_0x38d08f,[_0xca3f('0x45'),_0xca3f('0x46')]));}};function updateStatus(_0x441e54){if(_0x441e54['AttachmentId']){faxMessage[_0xca3f('0x47')](_0x441e54[_0xca3f('0x48')],{'failMessage':_0xca3f('0x49')})[_0xca3f('0x3c')](function(_0x15ebf1){ut[_0xca3f('0x4a')]('[Fax][Message][Error][Updated]',_0x15ebf1);})['catch'](function(_0x1f0803){ut['logger'](_0xca3f('0x4b'),_0x1f0803);});}else{ut[_0xca3f('0x4a')](_0xca3f('0x4c'));}}Fax['prototype'][_0xca3f('0x4d')]=function(_0x129b32,_0x3bcef8,_0x333900){var _0x2d8db1=this;var _0x29dd67={};if(_0x3bcef8){_0x29dd67={'read':_0x3bcef8};}else{_0x29dd67={'failMessage':_0x333900};}if(this[_0xca3f('0x2a')][_0x129b32]['AttachmentId']){faxMessage[_0xca3f('0x47')](this[_0xca3f('0x2a')][_0x129b32]['AttachmentId'],_0x29dd67)[_0xca3f('0x3c')](function(_0x5b01a1){ut[_0xca3f('0x4a')](_0xca3f('0x4e'),_0x5b01a1);})['catch'](function(_0x35b03f){ut[_0xca3f('0x4a')](_0xca3f('0x4f'),_0x35b03f);})['finally'](function(){delete _0x2d8db1[_0xca3f('0x24')][_0x129b32];delete _0x2d8db1[_0xca3f('0x2a')][_0x129b32];});}else{ut[_0xca3f('0x4a')](_0xca3f('0x50'));this[_0xca3f('0x51')](_0x129b32);delete this[_0xca3f('0x2a')][_0x129b32];}};Fax[_0xca3f('0x1d')][_0xca3f('0x1a')]=function(_0x265389){var _0x237b9f=this;if(this[_0xca3f('0x24')][_0x265389['uniqueid']]){if(this[_0xca3f('0x2a')][_0x265389[_0xca3f('0x25')]]){this[_0xca3f('0x24')][_0x265389[_0xca3f('0x25')]]['id']=this['actions'][_0x265389[_0xca3f('0x25')]]['id'];this[_0xca3f('0x24')][_0x265389['uniqueid']]['name']=this[_0xca3f('0x2a')][_0x265389[_0xca3f('0x25')]][_0xca3f('0x27')];}logger['info'](_0x265389[_0xca3f('0x25')],this[_0xca3f('0x2a')][_0x265389['uniqueid']]?'\x20hangup\x20sendFile\x20':_0xca3f('0x52'),JSON[_0xca3f('0x41')](this[_0xca3f('0x24')][_0x265389[_0xca3f('0x25')]]));if(this[_0xca3f('0x2a')][_0x265389[_0xca3f('0x25')]]){if(this['channels'][_0x265389[_0xca3f('0x25')]][_0xca3f('0x53')]>0x0&&this['channels'][_0x265389[_0xca3f('0x25')]][_0xca3f('0x17')]===_0xca3f('0x54')){this[_0xca3f('0x4d')](_0x265389[_0xca3f('0x25')],!![]);}else{this['updateStatus'](_0x265389['uniqueid'],![],this[_0xca3f('0x24')][_0x265389['uniqueid']][_0xca3f('0x55')]?_0xca3f('0x56')+this[_0xca3f('0x24')][_0x265389[_0xca3f('0x25')]][_0xca3f('0x55')]:_0xca3f('0x57'));}}}};Fax['prototype']['send']=function(_0xd907d6){var _0x2fb6ba=this;return new BPromise(function(_0x4d4939,_0x5d7cea){_0x2fb6ba[_0xca3f('0x58')](_0xd907d6,_0x2fb6ba['faxAccounts'][_0xd907d6['FaxAccountId']])[_0xca3f('0x3c')](function(_0x538350){ut[_0xca3f('0x4a')](_0xca3f('0x59'),_0x538350);_0x4d4939(ut['message']('Fax\x20received'));})[_0xca3f('0x3e')](function(_0x3db448){ut[_0xca3f('0x4a')](_0xca3f('0x5a'),_0x3db448);updateStatus(_0xd907d6);_0x5d7cea(ut[_0xca3f('0x5b')](_0xca3f('0x5c')));});});};Fax[_0xca3f('0x1d')][_0xca3f('0x5d')]=function(_0x3215ee){var _0x50d6e0=this;return new BPromise(function(_0x66b8d2,_0x38a4d0){var _0x5f4a49=_0x50d6e0[_0xca3f('0x5e')](_0x50d6e0[_0xca3f('0x20')][_0x3215ee[_0xca3f('0x5f')]][_0xca3f('0x60')],_0x3215ee);if(_0x5f4a49[_0xca3f('0x61')]){_0x66b8d2(ut[_0xca3f('0x5b')](_0xca3f('0x62')));}else{_0x38a4d0(ut[_0xca3f('0x5b')](_0x5f4a49[_0xca3f('0x5b')]));}});};function originate(_0x55ad14,_0x559ddd,_0x46fd82){return new BPromise(function(_0x274269,_0x3ad2eb){if(_0x46fd82){var _0x15e673=util[_0xca3f('0x63')](_0xca3f('0x64'),path[_0xca3f('0x39')](_0x55ad14[_0xca3f('0x3')])[_0xca3f('0x27')],_0x55ad14[_0xca3f('0x3')]);gs['execute'](_0x15e673)['then'](function(){_0x55ad14['path']=util[_0xca3f('0x63')](_0xca3f('0x65'),path['parse'](_0x55ad14[_0xca3f('0x3')])[_0xca3f('0x66')],path[_0xca3f('0x39')](_0x55ad14[_0xca3f('0x3')])[_0xca3f('0x27')]);_0x559ddd[_0xca3f('0x67')]=_0x55ad14[_0xca3f('0x3')];ut[_0xca3f('0x4a')](_0xca3f('0x68'),'');ami[_0xca3f('0x69')](ut[_0xca3f('0x6a')](_0x55ad14,_0x559ddd))[_0xca3f('0x3c')](function(_0x3c1844){_0x274269(_0x3c1844);})[_0xca3f('0x3e')](function(_0x30e343){_0x3ad2eb(_0x30e343);});})[_0xca3f('0x3e')](function(_0x20c8af){_0x3ad2eb(_0x20c8af);});}else{ami[_0xca3f('0x69')](ut[_0xca3f('0x6a')](_0x55ad14,_0x559ddd))[_0xca3f('0x3c')](function(_0x443aa0){_0x274269(_0x443aa0);})[_0xca3f('0x3e')](function(_0x50d500){_0x3ad2eb(_0x50d500);});}});}Fax[_0xca3f('0x1d')][_0xca3f('0x58')]=function(_0xbda19,_0x417955){var _0x26ca68=this;return new BPromise(function(_0x10b46e,_0x16b7c3){var _0x465202=uuid['v4']();var _0x536324=ut[_0xca3f('0x6b')](_0xbda19,_0x417955);_0x26ca68[_0xca3f('0x2a')][_0x465202]=new Action(_0x465202,_0x417955,_0xbda19);var _0x3f9247=_0x26ca68[_0xca3f('0x2a')][_0x465202];if(path[_0xca3f('0x39')](_0xbda19[_0xca3f('0x3')])['ext']===_0xca3f('0x3a')){originate(_0x3f9247,_0x536324,!![])[_0xca3f('0x3c')](function(_0x337822){_0x10b46e(_0x337822);})[_0xca3f('0x3e')](function(_0x4f90b3){_0x16b7c3(_0x4f90b3);});}else{originate(_0x3f9247,_0x536324,![])[_0xca3f('0x3c')](function(_0x5de68e){_0x10b46e(_0x5de68e);})[_0xca3f('0x3e')](function(_0x57abbb){_0x16b7c3(_0x57abbb);});}});};Fax[_0xca3f('0x1d')][_0xca3f('0x6c')]=function(_0x53498b){return!_[_0xca3f('0x6d')](_0x53498b)&&!_[_0xca3f('0x6d')](_0x53498b[_0xca3f('0x27')])&&!_[_0xca3f('0x6d')](_0x53498b[_0xca3f('0x6e')])&&_0x53498b[_0xca3f('0x6e')]&&!_[_0xca3f('0x6d')](this[_0xca3f('0xf')][util[_0xca3f('0x63')](_0xca3f('0x6f'),_0x53498b[_0xca3f('0x27')])])&&!_[_0xca3f('0x6d')](this[_0xca3f('0xf')][util[_0xca3f('0x63')]('SIP/%s',_0x53498b[_0xca3f('0x27')])][_0xca3f('0x70')])&&(this[_0xca3f('0xf')][util[_0xca3f('0x63')](_0xca3f('0x6f'),_0x53498b[_0xca3f('0x27')])][_0xca3f('0x70')]==='reachable'||this[_0xca3f('0xf')][util['format'](_0xca3f('0x6f'),_0x53498b[_0xca3f('0x27')])]['status']==='unmonitored');};Fax[_0xca3f('0x1d')][_0xca3f('0x5e')]=function(_0x21be8d,_0xd0cfa2){if(!this['isTrunkReachable'](_0x21be8d)){ut[_0xca3f('0x4a')](_0xca3f('0x71'),_[_0xca3f('0x6d')](_0x21be8d)?'':_0x21be8d['name']+_0xca3f('0x72'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0xca3f('0x6d')](_0xd0cfa2['fax'])){ut['logger'](_0xca3f('0x73'),JSON['stringify'](_0xd0cfa2));return{'isValid':![],'message':_0xca3f('0x74')};}if(_[_0xca3f('0x6d')](_0xd0cfa2['path'])){ut['logger'](_0xca3f('0x75'),JSON[_0xca3f('0x41')](_0xd0cfa2));return{'isValid':![],'message':_0xca3f('0x76')};}return{'isValid':!![],'message':_0xca3f('0x77')};};Fax[_0xca3f('0x1d')][_0xca3f('0x51')]=function(_0x5c9de4,_0x541255=0x2710){if(this[_0xca3f('0x24')][_0x5c9de4]){setTimeout(()=>{delete this[_0xca3f('0x24')][_0x5c9de4];},_0x541255);}};module[_0xca3f('0x78')]=Fax; \ No newline at end of file +var _0x8afc=['faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','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','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','./rpcDb','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','bind','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','from-voip-provider','hasOwnProperty','localstationid','channels','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','value','channelstate','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20receiveFax\x20','stringify','merge','pick','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20'];(function(_0x137e81,_0x3541c4){var _0x5f14e1=function(_0x23786a){while(--_0x23786a){_0x137e81['push'](_0x137e81['shift']());}};_0x5f14e1(++_0x3541c4);}(_0x8afc,0x115));var _0xc8af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8afc[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xc8af('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0xc8af('0x1'));var path=require(_0xc8af('0x2'));var tiff2pdf=require(_0xc8af('0x3'));var gs=require(_0xc8af('0x4'));var logger=require(_0xc8af('0x5'))(_0xc8af('0x6'));var ami=require('../ami');var rpcDb=require(_0xc8af('0x7'));var Channel=require('./channel');var ut=require('./util/util');var Action=require(_0xc8af('0x8'));var faxAccount=require(_0xc8af('0x9'));var attachment=require(_0xc8af('0xa'));var faxMessage=require(_0xc8af('0xb'));function Fax(_0x17a48d){this['channels']={};this[_0xc8af('0xc')]=_0x17a48d[_0xc8af('0xc')];this[_0xc8af('0xd')]=_0x17a48d[_0xc8af('0xd')];this[_0xc8af('0xe')]={};ami['on'](_0xc8af('0xf'),this[_0xc8af('0x10')]['bind'](this));ami['on'](_0xc8af('0x11'),this[_0xc8af('0x12')]['bind'](this));ami['on'](_0xc8af('0x13'),this[_0xc8af('0x14')]['bind'](this));ami['on'](_0xc8af('0x15'),this[_0xc8af('0x16')][_0xc8af('0x17')](this));ami['on'](_0xc8af('0x18'),this[_0xc8af('0x19')]['bind'](this));ami['on'](_0xc8af('0x1a'),this[_0xc8af('0x1b')][_0xc8af('0x17')](this));ami['on'](_0xc8af('0x1c'),this[_0xc8af('0x1d')]['bind'](this));ami['on'](_0xc8af('0x1e'),this[_0xc8af('0x1f')]['bind'](this));}Fax[_0xc8af('0x20')][_0xc8af('0x10')]=function(_0x23a6a5){if(_0x23a6a5['context']===_0xc8af('0x21')){for(var _0xa6d551 in this['faxAccounts']){if(this[_0xc8af('0xc')][_0xc8af('0x22')](_0xa6d551)){if(_0x23a6a5['exten']===this[_0xc8af('0xc')][_0xa6d551][_0xc8af('0x23')]){this[_0xc8af('0x24')][_0x23a6a5['uniqueid']]={};this[_0xc8af('0x24')][_0x23a6a5[_0xc8af('0x25')]][_0xc8af('0x26')]=_0x23a6a5[_0xc8af('0x26')];this[_0xc8af('0x24')][_0x23a6a5[_0xc8af('0x25')]]['id']=this[_0xc8af('0xc')][_0xa6d551]['id'];this[_0xc8af('0x24')][_0x23a6a5['uniqueid']][_0xc8af('0x27')]=this['faxAccounts'][_0xa6d551][_0xc8af('0x27')];logger['info'](_0x23a6a5[_0xc8af('0x25')],_0xc8af('0x28'));}}}}if(this[_0xc8af('0xe')][_0x23a6a5[_0xc8af('0x25')]]){this['channels'][_0x23a6a5['uniqueid']]={};this[_0xc8af('0x24')][_0x23a6a5[_0xc8af('0x25')]]['channel']=_0x23a6a5[_0xc8af('0x26')];logger[_0xc8af('0x29')](_0x23a6a5['uniqueid'],'\x20syncNewchannel\x20');}};Fax[_0xc8af('0x20')][_0xc8af('0x12')]=function(_0x358b84){if(this['channels'][_0x358b84['uniqueid']]){for(var _0x38cdd7 in _0x358b84['variable']){if(_0x358b84[_0xc8af('0x2a')]['hasOwnProperty'](_0x38cdd7)){this['channels'][_0x358b84[_0xc8af('0x25')]][_0x38cdd7]=_0x358b84[_0xc8af('0x2b')];}}}};Fax['prototype']['syncNewState']=function(_0x42b66d){if(this['channels'][_0x42b66d['uniqueid']]){this[_0xc8af('0x24')][_0x42b66d[_0xc8af('0x25')]][_0xc8af('0x2c')]=_0x42b66d[_0xc8af('0x2c')];this['channels'][_0x42b66d['uniqueid']]['channelstatedesc']=_0x42b66d['channelstatedesc'];}};Fax[_0xc8af('0x20')][_0xc8af('0x16')]=function(_0x3dcf70){if(this[_0xc8af('0x24')][_0x3dcf70['uniqueid']]){for(var _0x34ca10 in _0x3dcf70['variable']){if(_0x3dcf70[_0xc8af('0x2a')][_0xc8af('0x22')](_0x34ca10)){this[_0xc8af('0x24')][_0x3dcf70['uniqueid']][_0x34ca10]=_0x3dcf70[_0xc8af('0x2b')];}}}};Fax[_0xc8af('0x20')][_0xc8af('0x19')]=function(_0x2772dd){if(this[_0xc8af('0x24')][_0x2772dd[_0xc8af('0x25')]]){this[_0xc8af('0x24')][_0x2772dd[_0xc8af('0x25')]][_0xc8af('0x2d')]=_0x2772dd['operation'];this['channels'][_0x2772dd[_0xc8af('0x25')]][_0xc8af('0x2e')]=_0x2772dd[_0xc8af('0x2e')];this[_0xc8af('0x24')][_0x2772dd[_0xc8af('0x25')]][_0xc8af('0x23')]=_0x2772dd[_0xc8af('0x23')];this[_0xc8af('0x24')][_0x2772dd['uniqueid']][_0xc8af('0x2f')]=_0x2772dd[_0xc8af('0x2f')];logger['info'](_0x2772dd[_0xc8af('0x25')],_0xc8af('0x30'));}};Fax[_0xc8af('0x20')]['syncReceiveFax']=function(_0x368853){var _0x205d93=this;if(this[_0xc8af('0x24')][_0x368853['uniqueid']]){var _0x43a47a=this['channels'][_0x368853[_0xc8af('0x25')]]['id'];this['channels'][_0x368853[_0xc8af('0x25')]]['remotestationid']=_0x368853[_0xc8af('0x31')];this[_0xc8af('0x24')][_0x368853[_0xc8af('0x25')]][_0xc8af('0x32')]=_0x368853[_0xc8af('0x32')];this[_0xc8af('0x24')][_0x368853[_0xc8af('0x25')]][_0xc8af('0x23')]=_0x368853[_0xc8af('0x23')];this['channels'][_0x368853[_0xc8af('0x25')]][_0xc8af('0x33')]=_0x368853[_0xc8af('0x33')];this['channels'][_0x368853[_0xc8af('0x25')]][_0xc8af('0x34')]=_0x368853[_0xc8af('0x34')];this[_0xc8af('0x24')][_0x368853[_0xc8af('0x25')]][_0xc8af('0x2f')]=_0x368853[_0xc8af('0x2f')];this[_0xc8af('0x24')][_0x368853['uniqueid']][_0xc8af('0x35')]=_0x368853[_0xc8af('0x35')];if(this[_0xc8af('0x24')][_0x368853['uniqueid']][_0xc8af('0x32')]>0x0){tiff2pdf(_0x368853[_0xc8af('0x2f')],_0xc8af('0x36'),function(_0x177adb){logger[_0xc8af('0x29')](_0x368853['uniqueid'],_0xc8af('0x37'),_0x177adb[_0xc8af('0x38')]);attachment[_0xc8af('0x39')]({'name':path[_0xc8af('0x3a')](_0x368853[_0xc8af('0x2f')])[_0xc8af('0x27')],'basename':path[_0xc8af('0x3a')](_0x368853['filename'])[_0xc8af('0x27')]+_0xc8af('0x3b'),'type':_0xc8af('0x3c')})[_0xc8af('0x3d')](function(_0x4ccb3b){faxAccount[_0xc8af('0x3e')](_0x43a47a,{'from':_0x368853[_0xc8af('0x35')],'mapKey':'fax','body':path[_0xc8af('0x3a')](_0x368853[_0xc8af('0x2f')])[_0xc8af('0x27')]+_0xc8af('0x3b'),'AttachmentId':_0x4ccb3b['id']})[_0xc8af('0x3f')](function(_0x52fc1c){logger[_0xc8af('0x40')](_0x368853['uniqueid'],'\x20notify\x20',JSON['stringify'](_0x52fc1c));});})[_0xc8af('0x3f')](function(_0x3f6fc0){logger[_0xc8af('0x40')](_0x368853[_0xc8af('0x25')],_0xc8af('0x41'),JSON[_0xc8af('0x42')](_0x3f6fc0));});});}logger['info'](_0x368853['uniqueid'],_0xc8af('0x41'));}};Fax[_0xc8af('0x20')][_0xc8af('0x1f')]=function(_0x4bcccd){if(this[_0xc8af('0xe')][_0x4bcccd[_0xc8af('0x25')]]){_[_0xc8af('0x43')](this['channels'][_0x4bcccd['uniqueid']],_[_0xc8af('0x44')](_0x4bcccd,['response',_0xc8af('0x45')]));}};function updateStatus(_0x3d752b){if(_0x3d752b['AttachmentId']){faxMessage[_0xc8af('0x46')](_0x3d752b[_0xc8af('0x47')],{'failMessage':_0xc8af('0x48')})[_0xc8af('0x3d')](function(_0x410492){ut[_0xc8af('0x49')]('[Fax][Message][Error][Updated]',_0x410492);})[_0xc8af('0x3f')](function(_0x297f78){ut[_0xc8af('0x49')](_0xc8af('0x4a'),_0x297f78);});}else{ut[_0xc8af('0x49')](_0xc8af('0x4b'));}}Fax[_0xc8af('0x20')][_0xc8af('0x4c')]=function(_0xaa86db,_0x5c8392,_0x4397ab){var _0xf55bfb=this;var _0x587828={};if(_0x5c8392){_0x587828={'read':_0x5c8392};}else{_0x587828={'failMessage':_0x4397ab};}if(this[_0xc8af('0xe')][_0xaa86db][_0xc8af('0x47')]){faxMessage['update'](this[_0xc8af('0xe')][_0xaa86db]['AttachmentId'],_0x587828)[_0xc8af('0x3d')](function(_0x4dc68e){ut[_0xc8af('0x49')](_0xc8af('0x4d'),_0x4dc68e);})[_0xc8af('0x3f')](function(_0x566707){ut[_0xc8af('0x49')](_0xc8af('0x4e'),_0x566707);})[_0xc8af('0x4f')](function(){delete _0xf55bfb[_0xc8af('0x24')][_0xaa86db];delete _0xf55bfb[_0xc8af('0xe')][_0xaa86db];});}else{ut[_0xc8af('0x49')](_0xc8af('0x50'));this['deleteChannelAfterTimeout'](_0xaa86db);delete this['actions'][_0xaa86db];}};Fax['prototype'][_0xc8af('0x1d')]=function(_0x56cdaf){var _0x3ccd6e=this;if(this[_0xc8af('0x24')][_0x56cdaf[_0xc8af('0x25')]]){if(this[_0xc8af('0xe')][_0x56cdaf[_0xc8af('0x25')]]){this[_0xc8af('0x24')][_0x56cdaf[_0xc8af('0x25')]]['id']=this['actions'][_0x56cdaf[_0xc8af('0x25')]]['id'];this[_0xc8af('0x24')][_0x56cdaf['uniqueid']][_0xc8af('0x27')]=this['actions'][_0x56cdaf[_0xc8af('0x25')]][_0xc8af('0x27')];}logger[_0xc8af('0x29')](_0x56cdaf[_0xc8af('0x25')],this['actions'][_0x56cdaf[_0xc8af('0x25')]]?_0xc8af('0x51'):_0xc8af('0x52'),JSON[_0xc8af('0x42')](this['channels'][_0x56cdaf[_0xc8af('0x25')]]));if(this[_0xc8af('0xe')][_0x56cdaf['uniqueid']]){if(this['channels'][_0x56cdaf['uniqueid']][_0xc8af('0x53')]>0x0&&this['channels'][_0x56cdaf[_0xc8af('0x25')]][_0xc8af('0x18')]===_0xc8af('0x54')){this['updateStatus'](_0x56cdaf[_0xc8af('0x25')],!![]);}else{this[_0xc8af('0x4c')](_0x56cdaf[_0xc8af('0x25')],![],this['channels'][_0x56cdaf[_0xc8af('0x25')]][_0xc8af('0x55')]?_0xc8af('0x56')+this[_0xc8af('0x24')][_0x56cdaf[_0xc8af('0x25')]]['faxstatusstring']:_0xc8af('0x57'));}}}};Fax['prototype'][_0xc8af('0x58')]=function(_0x5afb30){var _0x4f0f4e=this;return new BPromise(function(_0x104f34,_0x109189){_0x4f0f4e[_0xc8af('0x59')](_0x5afb30,_0x4f0f4e[_0xc8af('0xc')][_0x5afb30[_0xc8af('0x5a')]])['then'](function(_0x33e8fb){ut[_0xc8af('0x49')]('[Fax][execOriginate][success]',_0x33e8fb);_0x104f34(ut['message'](_0xc8af('0x5b')));})[_0xc8af('0x3f')](function(_0x52850f){ut[_0xc8af('0x49')](_0xc8af('0x5c'),_0x52850f);updateStatus(_0x5afb30);_0x109189(ut[_0xc8af('0x38')](_0xc8af('0x5d')));});});};Fax[_0xc8af('0x20')][_0xc8af('0x5e')]=function(_0x330dc5){var _0x3e71f2=this;return new BPromise(function(_0x38862e,_0x19224f){var _0x2c62b3=_0x3e71f2['checkTrunk'](_0x3e71f2['faxAccounts'][_0x330dc5[_0xc8af('0x5a')]]['Trunk'],_0x330dc5);if(_0x2c62b3[_0xc8af('0x5f')]){_0x38862e(ut[_0xc8af('0x38')](_0xc8af('0x60')));}else{_0x19224f(ut[_0xc8af('0x38')](_0x2c62b3['message']));}});};function originate(_0x53cf8f,_0x42c9c0,_0x39384d){return new BPromise(function(_0x28c084,_0x414733){if(_0x39384d){var _0x421ee7=util[_0xc8af('0x61')](_0xc8af('0x62'),path[_0xc8af('0x3a')](_0x53cf8f['path'])[_0xc8af('0x27')],_0x53cf8f[_0xc8af('0x2')]);gs[_0xc8af('0x63')](_0x421ee7)['then'](function(){_0x53cf8f[_0xc8af('0x2')]=util[_0xc8af('0x61')](_0xc8af('0x64'),path[_0xc8af('0x3a')](_0x53cf8f[_0xc8af('0x2')])[_0xc8af('0x65')],path[_0xc8af('0x3a')](_0x53cf8f[_0xc8af('0x2')])[_0xc8af('0x27')]);_0x42c9c0[_0xc8af('0x66')]=_0x53cf8f[_0xc8af('0x2')];ut[_0xc8af('0x49')](_0xc8af('0x67'),'');ami[_0xc8af('0x68')](ut[_0xc8af('0x69')](_0x53cf8f,_0x42c9c0))[_0xc8af('0x3d')](function(_0xcd2a87){_0x28c084(_0xcd2a87);})[_0xc8af('0x3f')](function(_0x316e56){_0x414733(_0x316e56);});})[_0xc8af('0x3f')](function(_0xd09d41){_0x414733(_0xd09d41);});}else{ami[_0xc8af('0x68')](ut['variablesAction'](_0x53cf8f,_0x42c9c0))[_0xc8af('0x3d')](function(_0x310ded){_0x28c084(_0x310ded);})[_0xc8af('0x3f')](function(_0x141c4d){_0x414733(_0x141c4d);});}});}Fax['prototype']['execOriginate']=function(_0x22fb44,_0x152fbe){var _0x499f0d=this;return new BPromise(function(_0x42355c,_0x19eced){var _0x4ac679=uuid['v4']();var _0x258969=ut[_0xc8af('0x6a')](_0x22fb44,_0x152fbe);_0x499f0d[_0xc8af('0xe')][_0x4ac679]=new Action(_0x4ac679,_0x152fbe,_0x22fb44);var _0x31333d=_0x499f0d[_0xc8af('0xe')][_0x4ac679];if(path['parse'](_0x22fb44[_0xc8af('0x2')])[_0xc8af('0x6b')]===_0xc8af('0x3b')){originate(_0x31333d,_0x258969,!![])['then'](function(_0x58cb1b){_0x42355c(_0x58cb1b);})[_0xc8af('0x3f')](function(_0x5df9da){_0x19eced(_0x5df9da);});}else{originate(_0x31333d,_0x258969,![])[_0xc8af('0x3d')](function(_0x48cdf4){_0x42355c(_0x48cdf4);})['catch'](function(_0x821cee){_0x19eced(_0x821cee);});}});};Fax[_0xc8af('0x20')]['isTrunkReachable']=function(_0x4d3bcd){return!_[_0xc8af('0x6c')](_0x4d3bcd)&&!_[_0xc8af('0x6c')](_0x4d3bcd['name'])&&!_[_0xc8af('0x6c')](_0x4d3bcd[_0xc8af('0x6d')])&&_0x4d3bcd['active']&&!_['isNil'](this[_0xc8af('0xd')][util[_0xc8af('0x61')](_0xc8af('0x6e'),_0x4d3bcd[_0xc8af('0x27')])])&&!_[_0xc8af('0x6c')](this['trunks'][util[_0xc8af('0x61')](_0xc8af('0x6e'),_0x4d3bcd['name'])]['status'])&&(this['trunks'][util[_0xc8af('0x61')]('SIP/%s',_0x4d3bcd['name'])][_0xc8af('0x2e')]===_0xc8af('0x6f')||this['trunks'][util['format'](_0xc8af('0x6e'),_0x4d3bcd[_0xc8af('0x27')])][_0xc8af('0x2e')]===_0xc8af('0x70'));};Fax[_0xc8af('0x20')]['checkTrunk']=function(_0x15221d,_0x174b2a){if(!this['isTrunkReachable'](_0x15221d)){ut[_0xc8af('0x49')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0xc8af('0x6c')](_0x15221d)?'':_0x15221d[_0xc8af('0x27')]+_0xc8af('0x71'));return{'isValid':![],'message':_0xc8af('0x72')};}if(_[_0xc8af('0x6c')](_0x174b2a[_0xc8af('0x6')])){ut['logger'](_0xc8af('0x73'),JSON[_0xc8af('0x42')](_0x174b2a));return{'isValid':![],'message':_0xc8af('0x74')};}if(_['isNil'](_0x174b2a[_0xc8af('0x2')])){ut[_0xc8af('0x49')](_0xc8af('0x75'),JSON[_0xc8af('0x42')](_0x174b2a));return{'isValid':![],'message':_0xc8af('0x76')};}return{'isValid':!![],'message':'Is\x20Valid'};};Fax[_0xc8af('0x20')]['deleteChannelAfterTimeout']=function(_0x14c5f6,_0x162762=0x2710){if(this['channels'][_0x14c5f6]){setTimeout(()=>{delete this['channels'][_0x14c5f6];},_0x162762);}};module[_0xc8af('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 d1e8f98..db0980f 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 _0x93f0=['lodash','error','inspect','catch','util','bluebird','../../../config/logger','preview'];(function(_0x5db528,_0x4730e9){var _0x1fbf1d=function(_0x5c4867){while(--_0x5c4867){_0x5db528['push'](_0x5db528['shift']());}};_0x1fbf1d(++_0x4730e9);}(_0x93f0,0x6c));var _0x093f=function(_0x33f4da,_0x56f79b){_0x33f4da=_0x33f4da-0x0;var _0x2808b6=_0x93f0[_0x33f4da];return _0x2808b6;};'use strict';var util=require(_0x093f('0x0'));var BPromise=require(_0x093f('0x1'));var logger=require(_0x093f('0x2'))(_0x093f('0x3'));var _=require(_0x093f('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x48b16d){return function(_0x4cc6fb){logger[_0x093f('0x5')](_0x48b16d,util[_0x093f('0x6')](_0x4cc6fb,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x15caf6,_0x3353fe){return BPromise['resolve']()['then'](faxAccount['notify'](_0x15caf6,_0x3353fe))[_0x093f('0x7')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x0422=['../rpc/faxAccount','inspect','notify','util','../../../config/logger','preview','lodash'];(function(_0x3eb630,_0x552586){var _0x1b840d=function(_0x2594a8){while(--_0x2594a8){_0x3eb630['push'](_0x3eb630['shift']());}};_0x1b840d(++_0x552586);}(_0x0422,0x1d8));var _0x2042=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x0422[_0x4b7895];return _0x264180;};'use strict';var util=require(_0x2042('0x0'));var BPromise=require('bluebird');var logger=require(_0x2042('0x1'))(_0x2042('0x2'));var _=require(_0x2042('0x3'));var faxAccount=require(_0x2042('0x4'));function loggerCatch(_0x1b1a9c){return function(_0x19a518){logger['error'](_0x1b1a9c,util[_0x2042('0x5')](_0x19a518,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x1165b1,_0x5ebd18){return BPromise['resolve']()['then'](faxAccount[_0x2042('0x6')](_0x1165b1,_0x5ebd18))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 0269cce..908f4ab 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 _0xfdc4=['Exec\x20gs','\x20Error\x20:','inspect','util','fax','bluebird','exec','info'];(function(_0x20a6bd,_0xaeb074){var _0x318a91=function(_0x2055e4){while(--_0x2055e4){_0x20a6bd['push'](_0x20a6bd['shift']());}};_0x318a91(++_0xaeb074);}(_0xfdc4,0x83));var _0x4fdc=function(_0xe555e1,_0x34286e){_0xe555e1=_0xe555e1-0x0;var _0x178e59=_0xfdc4[_0xe555e1];return _0x178e59;};'use strict';var util=require(_0x4fdc('0x0'));var logger=require('../../../../config/logger')(_0x4fdc('0x1'));var BPromise=require(_0x4fdc('0x2'));var exec=require('child_process')[_0x4fdc('0x3')];exports['execute']=function(_0x52461f){return new BPromise(function(_0x217fa0,_0x3d6a16){exec(_0x52461f,function(_0x584f01,_0x4de6be,_0x274f76){logger[_0x4fdc('0x4')](_0x4fdc('0x5'),_0x4de6be);if(_0x584f01){logger['info'](_0x4fdc('0x5'),_0x4fdc('0x6'),util[_0x4fdc('0x7')](_0x584f01,{'showHidden':![],'depth':null}),_0x4de6be,_0x274f76);_0x3d6a16(_0x584f01);}_0x217fa0(_0x4de6be);});});}; \ No newline at end of file +var _0x934e=['Exec\x20gs','\x20Error\x20:','../../../../config/logger','execute','info'];(function(_0x188359,_0x40f737){var _0x28dd02=function(_0x8aba01){while(--_0x8aba01){_0x188359['push'](_0x188359['shift']());}};_0x28dd02(++_0x40f737);}(_0x934e,0x9d));var _0xe934=function(_0xc22186,_0x3c5e77){_0xc22186=_0xc22186-0x0;var _0x410e16=_0x934e[_0xc22186];return _0x410e16;};'use strict';var util=require('util');var logger=require(_0xe934('0x0'))('fax');var BPromise=require('bluebird');var exec=require('child_process')['exec'];exports[_0xe934('0x1')]=function(_0x387e6c){return new BPromise(function(_0x1287c6,_0xad57a9){exec(_0x387e6c,function(_0x5062d8,_0x1eef51,_0x105cd7){logger['info']('Exec\x20gs',_0x1eef51);if(_0x5062d8){logger[_0xe934('0x2')](_0xe934('0x3'),_0xe934('0x4'),util['inspect'](_0x5062d8,{'showHidden':![],'depth':null}),_0x1eef51,_0x105cd7);_0xad57a9(_0x5062d8);}_0x1287c6(_0x1eef51);});});}; \ 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 7c75693..066356d 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 _0x6896=['modem','gateway','faxdetect','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','localstationid','util','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6896,0x15e));var _0x6689=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6896[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0x6689('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x6689('0x1'))(_0x6689('0x2'));exports[_0x6689('0x3')]=function(_0x33bab2){return{'message':_0x33bab2};};exports[_0x6689('0x4')]=function(_0x219e17,_0x296eba){logger[_0x6689('0x5')](_0x219e17,util[_0x6689('0x6')](_0x296eba,{'showHidden':![],'depth':null}));};exports[_0x6689('0x7')]=function(_0x22cf22,_0x30def4){var _0x49d601={'XMF-ECM':_0x30def4[_0x6689('0x8')],'XMF-HEADERINFO':_0x30def4[_0x6689('0x9')],'XMF-MINRATE':_0x30def4[_0x6689('0xa')],'XMF-MAXRATE':_0x30def4[_0x6689('0xb')],'XMF-MODEM':util[_0x6689('0xc')](_0x6689('0xd'),_0x30def4[_0x6689('0xe')]),'XMF-GATEWAY':_0x30def4[_0x6689('0xf')],'XMF-FAXDETECT':_0x30def4[_0x6689('0x10')],'XMF-T38TIMEOUT':_0x30def4['t38timeout'],'XMF-LOCALSTATIONID':_0x30def4['localstationid'],'XMF-PATH':_0x22cf22[_0x6689('0x11')]};return _0x49d601;};exports[_0x6689('0x12')]=function(_0x19fd15,_0x451f2d){return{'actionid':_0x19fd15[_0x6689('0x13')],'action':_0x6689('0x14'),'channel':_0x19fd15[_0x6689('0x15')],'Exten':_0x6689('0x16'),'Context':_0x6689('0x17'),'Priority':'1','callerid':util[_0x6689('0xc')](_0x6689('0x18'),_0x19fd15[_0x6689('0x9')]?_0x19fd15[_0x6689('0x9')]:'',_0x19fd15[_0x6689('0x19')]),'variable':_0x451f2d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x19fd15[_0x6689('0x13')]};}; \ No newline at end of file +var _0x8f19=['format','\x22%s\x22','modem','gateway','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','uniqueid','lodash','../../../../config/logger','message','logger','info','inspect','headerinfo','minrate','maxrate'];(function(_0x108c5b,_0x52c0fb){var _0x2afb52=function(_0x586416){while(--_0x586416){_0x108c5b['push'](_0x108c5b['shift']());}};_0x2afb52(++_0x52c0fb);}(_0x8f19,0x141));var _0x98f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f19[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0x98f1('0x0'));var moment=require('moment');var logger=require(_0x98f1('0x1'))('fax');exports[_0x98f1('0x2')]=function(_0x2385da){return{'message':_0x2385da};};exports[_0x98f1('0x3')]=function(_0x55aecd,_0x5e5ed7){logger[_0x98f1('0x4')](_0x55aecd,util[_0x98f1('0x5')](_0x5e5ed7,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x272e68,_0x1ac9f2){var _0x1d558d={'XMF-ECM':_0x1ac9f2['ecm'],'XMF-HEADERINFO':_0x1ac9f2[_0x98f1('0x6')],'XMF-MINRATE':_0x1ac9f2[_0x98f1('0x7')],'XMF-MAXRATE':_0x1ac9f2[_0x98f1('0x8')],'XMF-MODEM':util[_0x98f1('0x9')](_0x98f1('0xa'),_0x1ac9f2[_0x98f1('0xb')]),'XMF-GATEWAY':_0x1ac9f2[_0x98f1('0xc')],'XMF-FAXDETECT':_0x1ac9f2['faxdetect'],'XMF-T38TIMEOUT':_0x1ac9f2['t38timeout'],'XMF-LOCALSTATIONID':_0x1ac9f2[_0x98f1('0xd')],'XMF-PATH':_0x272e68[_0x98f1('0xe')]};return _0x1d558d;};exports[_0x98f1('0xf')]=function(_0x4701eb,_0x499425){return{'actionid':_0x4701eb['uniqueid'],'action':_0x98f1('0x10'),'channel':_0x4701eb[_0x98f1('0x11')],'Exten':_0x98f1('0x12'),'Context':_0x98f1('0x13'),'Priority':'1','callerid':util['format'](_0x98f1('0x14'),_0x4701eb['headerinfo']?_0x4701eb[_0x98f1('0x6')]:'',_0x4701eb['localstationid']),'variable':_0x499425,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4701eb[_0x98f1('0x15')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index d1df286..cf7055f 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 _0xae44=['getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','sync','util','./realtime','./report','./acw','./trigger','./fax','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts'];(function(_0x379245,_0x32a201){var _0x4711b5=function(_0x5ab236){while(--_0x5ab236){_0x379245['push'](_0x379245['shift']());}};_0x4711b5(++_0x32a201);}(_0xae44,0x153));var _0x4ae4=function(_0x5eb868,_0x3edfb0){_0x5eb868=_0x5eb868-0x0;var _0x278458=_0xae44[_0x5eb868];return _0x278458;};'use strict';var util=require(_0x4ae4('0x0'));var moment=require('moment');var server=require('./server');var Realtime=require(_0x4ae4('0x1'));var Report=require(_0x4ae4('0x2'));var Acw=require(_0x4ae4('0x3'));var Trigger=require(_0x4ae4('0x4'));var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require(_0x4ae4('0x5'));var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x4ae4('0x6'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x4ae4('0x7'));var trigger=require(_0x4ae4('0x8'));var template=require('./rpc/template');var cmHopperHistory=require(_0x4ae4('0x9'));var campaign=require(_0x4ae4('0xa'));var voiceExtension=require(_0x4ae4('0xb'));var faxAccount=require(_0x4ae4('0xc'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x4ae4('0xd'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x4ae4('0xe'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x4ae4('0xf'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x4ae4('0x10'));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(_0x4ae4('0x11'))(_0x4ae4('0x12'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x4ae4('0x13')](_0x4ae4('0x14'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x4ae4('0x13')](_0x4ae4('0x14'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x4ae4('0x15')]()[_0x4ae4('0x16')](user[_0x4ae4('0x17')]())[_0x4ae4('0x16')](realtime[_0x4ae4('0x18')]())['then'](user[_0x4ae4('0x19')]())[_0x4ae4('0x16')](realtime[_0x4ae4('0x1a')]())[_0x4ae4('0x16')](trunk[_0x4ae4('0x1b')]())[_0x4ae4('0x16')](realtime['initTrunks']())['then'](voiceQueue[_0x4ae4('0x1c')]())[_0x4ae4('0x16')](realtime[_0x4ae4('0x1d')]())[_0x4ae4('0x16')](trigger[_0x4ae4('0x1e')]())['then'](realtime[_0x4ae4('0x1f')]())['then'](template[_0x4ae4('0x20')]())[_0x4ae4('0x16')](realtime[_0x4ae4('0x21')]())[_0x4ae4('0x16')](zendesk[_0x4ae4('0x22')]())['then'](realtime['initZendeskAccounts']())[_0x4ae4('0x16')](salesforce[_0x4ae4('0x23')]())[_0x4ae4('0x16')](realtime['initSalesforceAccounts']())[_0x4ae4('0x16')](sugarcrm[_0x4ae4('0x24')]())[_0x4ae4('0x16')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x4ae4('0x25')]())['then'](realtime[_0x4ae4('0x26')]())[_0x4ae4('0x16')](desk['getDeskAccounts']())[_0x4ae4('0x16')](realtime[_0x4ae4('0x27')]())[_0x4ae4('0x16')](zoho[_0x4ae4('0x28')]())[_0x4ae4('0x16')](realtime[_0x4ae4('0x29')]())[_0x4ae4('0x16')](vtiger[_0x4ae4('0x2a')]())[_0x4ae4('0x16')](realtime[_0x4ae4('0x2b')]())['then'](freshsales[_0x4ae4('0x2c')]())[_0x4ae4('0x16')](realtime['initFreshsalesAccounts']())[_0x4ae4('0x16')](servicenow[_0x4ae4('0x2d')]())[_0x4ae4('0x16')](realtime['initServicenowAccounts']())[_0x4ae4('0x16')](dynamics365[_0x4ae4('0x2e')]())[_0x4ae4('0x16')](realtime[_0x4ae4('0x2f')]())[_0x4ae4('0x16')](campaign[_0x4ae4('0x30')]())[_0x4ae4('0x16')](realtime[_0x4ae4('0x31')]())[_0x4ae4('0x16')](voiceExtension[_0x4ae4('0x32')]())[_0x4ae4('0x16')](realtime[_0x4ae4('0x33')]())[_0x4ae4('0x16')](faxAccount[_0x4ae4('0x34')]())[_0x4ae4('0x16')](realtime[_0x4ae4('0x35')]())[_0x4ae4('0x16')](function(){return realtime;});}function initParams(){return Promise[_0x4ae4('0x15')]()['then'](voiceQueueReport['getVoiceQueueReports']())[_0x4ae4('0x16')](realtime[_0x4ae4('0x36')]())[_0x4ae4('0x16')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x4ae4('0x16')](realtime[_0x4ae4('0x37')]())[_0x4ae4('0x16')](cmHopperHistory[_0x4ae4('0x38')]())['then'](realtime[_0x4ae4('0x39')]())[_0x4ae4('0x16')](voiceCallReport[_0x4ae4('0x3a')]())[_0x4ae4('0x16')](realtime[_0x4ae4('0x3b')]())[_0x4ae4('0x3c')](function(_0x4125cd){logger[_0x4ae4('0x3d')]('[index.js][initParams]',util[_0x4ae4('0x3e')](_0x4125cd,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x4ae4('0x16')](function(){return initParams();})[_0x4ae4('0x16')](function(){report[_0x4ae4('0x3f')]();setInterval(initRealtime,0x1388);})[_0x4ae4('0x3c')](function(_0x50fdd8){logger[_0x4ae4('0x3d')]('[index.js][main]',util[_0x4ae4('0x3e')](_0x50fdd8,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x3944=['initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','inspect','sync','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports'];(function(_0x35f6b4,_0x505966){var _0x10f072=function(_0x20e563){while(--_0x20e563){_0x35f6b4['push'](_0x35f6b4['shift']());}};_0x10f072(++_0x505966);}(_0x3944,0x11e));var _0x4394=function(_0x50b781,_0x59bc5a){_0x50b781=_0x50b781-0x0;var _0x4ab5c0=_0x3944[_0x50b781];return _0x4ab5c0;};'use strict';var util=require(_0x4394('0x0'));var moment=require(_0x4394('0x1'));var server=require(_0x4394('0x2'));var Realtime=require(_0x4394('0x3'));var Report=require(_0x4394('0x4'));var Acw=require(_0x4394('0x5'));var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require(_0x4394('0x6'));var Fax=require(_0x4394('0x7'));var user=require(_0x4394('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x4394('0x9'));var voiceCallReport=require(_0x4394('0xa'));var trunk=require(_0x4394('0xb'));var trigger=require(_0x4394('0xc'));var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x4394('0xd'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x4394('0xe'));var zendesk=require(_0x4394('0xf'));var salesforce=require(_0x4394('0x10'));var sugarcrm=require(_0x4394('0x11'));var freshdesk=require(_0x4394('0x12'));var desk=require(_0x4394('0x13'));var zoho=require(_0x4394('0x14'));var vtiger=require(_0x4394('0x15'));var freshsales=require(_0x4394('0x16'));var servicenow=require(_0x4394('0x17'));var dynamics365=require(_0x4394('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x4394('0x19'))(_0x4394('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x4394('0x1b')](_0x4394('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x4394('0x1b')](_0x4394('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x4394('0x1d')]()[_0x4394('0x1e')](user[_0x4394('0x1f')]())[_0x4394('0x1e')](realtime[_0x4394('0x20')]())[_0x4394('0x1e')](user[_0x4394('0x21')]())['then'](realtime['initTelephones']())[_0x4394('0x1e')](trunk[_0x4394('0x22')]())[_0x4394('0x1e')](realtime[_0x4394('0x23')]())[_0x4394('0x1e')](voiceQueue[_0x4394('0x24')]())[_0x4394('0x1e')](realtime[_0x4394('0x25')]())[_0x4394('0x1e')](trigger[_0x4394('0x26')]())['then'](realtime[_0x4394('0x27')]())[_0x4394('0x1e')](template[_0x4394('0x28')]())[_0x4394('0x1e')](realtime[_0x4394('0x29')]())[_0x4394('0x1e')](zendesk[_0x4394('0x2a')]())['then'](realtime[_0x4394('0x2b')]())[_0x4394('0x1e')](salesforce['getSalesforceAccounts']())[_0x4394('0x1e')](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0x4394('0x2c')]())[_0x4394('0x1e')](realtime[_0x4394('0x2d')]())[_0x4394('0x1e')](freshdesk[_0x4394('0x2e')]())[_0x4394('0x1e')](realtime['initFreshdeskAccounts']())[_0x4394('0x1e')](desk['getDeskAccounts']())[_0x4394('0x1e')](realtime[_0x4394('0x2f')]())[_0x4394('0x1e')](zoho[_0x4394('0x30')]())[_0x4394('0x1e')](realtime[_0x4394('0x31')]())[_0x4394('0x1e')](vtiger[_0x4394('0x32')]())[_0x4394('0x1e')](realtime[_0x4394('0x33')]())['then'](freshsales['getFreshsalesAccounts']())['then'](realtime['initFreshsalesAccounts']())[_0x4394('0x1e')](servicenow['getServicenowAccounts']())[_0x4394('0x1e')](realtime['initServicenowAccounts']())[_0x4394('0x1e')](dynamics365['getDynamics365Accounts']())[_0x4394('0x1e')](realtime[_0x4394('0x34')]())[_0x4394('0x1e')](campaign[_0x4394('0x35')]())[_0x4394('0x1e')](realtime[_0x4394('0x36')]())[_0x4394('0x1e')](voiceExtension['getVoiceExtensions']())[_0x4394('0x1e')](realtime[_0x4394('0x37')]())['then'](faxAccount[_0x4394('0x38')]())[_0x4394('0x1e')](realtime[_0x4394('0x39')]())[_0x4394('0x1e')](function(){return realtime;});}function initParams(){return Promise[_0x4394('0x1d')]()[_0x4394('0x1e')](voiceQueueReport[_0x4394('0x3a')]())[_0x4394('0x1e')](realtime[_0x4394('0x3b')]())[_0x4394('0x1e')](cmHopperHistory[_0x4394('0x3c')]())[_0x4394('0x1e')](realtime[_0x4394('0x3d')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x4394('0x1e')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0x4394('0x3e')]())[_0x4394('0x1e')](realtime[_0x4394('0x3f')]())[_0x4394('0x40')](function(_0x3772e7){logger['error'](_0x4394('0x41'),util[_0x4394('0x42')](_0x3772e7,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x4394('0x1e')](function(){return initRealtime();})[_0x4394('0x1e')](function(){return initParams();})[_0x4394('0x1e')](function(){report[_0x4394('0x43')]();setInterval(initRealtime,0x1388);})[_0x4394('0x40')](function(_0x5bb3f1){logger['error'](_0x4394('0x44'),util[_0x4394('0x42')](_0x5bb3f1,{'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 562b5e7..980b5fe 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 _0xa491=['emit','exports','util','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','stateTime','status','unknown','address','phone','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','talking','voiceStatus','statePause','format','onhold','stringify','user:%s'];(function(_0x3ce1af,_0x5a31d0){var _0x4da89=function(_0x484ca3){while(--_0x484ca3){_0x3ce1af['push'](_0x3ce1af['shift']());}};_0x4da89(++_0x5a31d0);}(_0xa491,0xc0));var _0x1a49=function(_0x5b3ad3,_0x527211){_0x5b3ad3=_0x5b3ad3-0x0;var _0x928e35=_0xa491[_0x5b3ad3];return _0x928e35;};'use strict';var _=require('lodash');var util=require(_0x1a49('0x0'));var moment=require('moment');var md5=require(_0x1a49('0x1'));var Redis=require(_0x1a49('0x2'));var config=require(_0x1a49('0x3'));config[_0x1a49('0x4')]=_[_0x1a49('0x5')](config[_0x1a49('0x4')],{'host':_0x1a49('0x6'),'port':0x18eb});var io=require(_0x1a49('0x7'))(new Redis(config['redis']));function Agent(_0x500043){this['id']=_0x500043['id']||0x0;this['name']=_0x500043[_0x1a49('0x8')]||'';this[_0x1a49('0x9')]=_0x500043[_0x1a49('0x9')]||'';this[_0x1a49('0xa')]=_0x500043[_0x1a49('0xa')]||'';this[_0x1a49('0xb')]=_0x500043[_0x1a49('0xb')]||'';this[_0x1a49('0xc')]='unknown';this[_0x1a49('0xd')]=0x0;this[_0x1a49('0xe')]=_0x1a49('0xf');this[_0x1a49('0x10')]='';this[_0x1a49('0x11')]='';this['mobile']='';this[_0x1a49('0x12')]='';this['online']=_0x500043[_0x1a49('0x13')]||![];this['voiceStatus']=_0x1a49('0xf');this[_0x1a49('0x14')]=0x0;this[_0x1a49('0x15')]='';this[_0x1a49('0x16')]='';this['onhold']=![];this[_0x1a49('0x17')]=![];this[_0x1a49('0x1')]='';}Agent[_0x1a49('0x18')][_0x1a49('0x19')]=function(_0x4cfa7e){var _0x9be843;if(_0x4cfa7e&&_0x4cfa7e['state']){_0x9be843=_0x4cfa7e[_0x1a49('0xc')][_0x1a49('0x1a')]();switch(_0x9be843){case _0x1a49('0x1b'):_0x9be843=_0x1a49('0x1c');break;case'inuse':_0x9be843=_0x1a49('0x1d');break;}}if(_0x9be843&&this[_0x1a49('0x1e')]!==_0x9be843||_0x4cfa7e[_0x1a49('0x1f')]){this['voiceStatusTime']=_['toNumber'](moment()[_0x1a49('0x20')]('x'));}if(_0x9be843){this[_0x1a49('0x1e')]=_0x9be843;}var _0x115cfe={'id':this['id'],'name':this[_0x1a49('0x8')],'email':this[_0x1a49('0x9')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x1a49('0xc')],'stateTime':this['stateTime'],'status':this[_0x1a49('0xe')],'address':this[_0x1a49('0x10')],'online':this[_0x1a49('0x13')],'voiceStatus':this[_0x1a49('0x1e')],'voiceStatusTime':this[_0x1a49('0x14')],'voiceStatusCallerIdNumber':this[_0x1a49('0x15')],'voiceStatusQueue':this[_0x1a49('0x16')],'interface':this[_0x1a49('0x12')],'onhold':this[_0x1a49('0x21')]};var _0x451dc5=md5(JSON[_0x1a49('0x22')](_0x115cfe));if(this[_0x1a49('0x1')]!==_0x451dc5){this[_0x1a49('0x1')]=_0x451dc5;io['to'](util[_0x1a49('0x20')](_0x1a49('0x23'),_0x115cfe[_0x1a49('0x8')]))['emit']('user:ami:update',_['omit'](_0x115cfe,[_0x1a49('0x13')]));io[_0x1a49('0x24')]('user:presence',_0x115cfe);}};module[_0x1a49('0x25')]=Agent; \ No newline at end of file +var _0xa6fa=['accountcode','fullname','unknown','stateTime','status','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','toNumber','format','address','voiceStatusQueue','stringify','user:%s','emit','user:ami:update','user:presence','exports','util','moment','md5','redis','localhost','socket.io-emitter','name','email'];(function(_0x52a14c,_0x16cae1){var _0x5dd2ad=function(_0x54ea0f){while(--_0x54ea0f){_0x52a14c['push'](_0x52a14c['shift']());}};_0x5dd2ad(++_0x16cae1);}(_0xa6fa,0x130));var _0xaa6f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xa6fa[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xaa6f('0x0'));var moment=require(_0xaa6f('0x1'));var md5=require(_0xaa6f('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xaa6f('0x3')]=_['defaults'](config[_0xaa6f('0x3')],{'host':_0xaa6f('0x4'),'port':0x18eb});var io=require(_0xaa6f('0x5'))(new Redis(config['redis']));function Agent(_0x3ca683){this['id']=_0x3ca683['id']||0x0;this['name']=_0x3ca683[_0xaa6f('0x6')]||'';this[_0xaa6f('0x7')]=_0x3ca683[_0xaa6f('0x7')]||'';this[_0xaa6f('0x8')]=_0x3ca683[_0xaa6f('0x8')]||'';this[_0xaa6f('0x9')]=_0x3ca683[_0xaa6f('0x9')]||'';this['state']=_0xaa6f('0xa');this[_0xaa6f('0xb')]=0x0;this[_0xaa6f('0xc')]='unknown';this['address']='';this[_0xaa6f('0xd')]='';this[_0xaa6f('0xe')]='';this[_0xaa6f('0xf')]='';this['online']=_0x3ca683[_0xaa6f('0x10')]||![];this[_0xaa6f('0x11')]='unknown';this[_0xaa6f('0x12')]=0x0;this[_0xaa6f('0x13')]='';this['voiceStatusQueue']='';this[_0xaa6f('0x14')]=![];this[_0xaa6f('0x15')]=![];this[_0xaa6f('0x2')]='';}Agent[_0xaa6f('0x16')][_0xaa6f('0x17')]=function(_0x44600d){var _0x1bd131;if(_0x44600d&&_0x44600d[_0xaa6f('0x18')]){_0x1bd131=_0x44600d['state'][_0xaa6f('0x19')]();switch(_0x1bd131){case _0xaa6f('0x1a'):_0x1bd131=_0xaa6f('0x1b');break;case _0xaa6f('0x1c'):_0x1bd131='talking';break;}}if(_0x1bd131&&this[_0xaa6f('0x11')]!==_0x1bd131||_0x44600d['statePause']){this[_0xaa6f('0x12')]=_[_0xaa6f('0x1d')](moment()[_0xaa6f('0x1e')]('x'));}if(_0x1bd131){this[_0xaa6f('0x11')]=_0x1bd131;}var _0x157cee={'id':this['id'],'name':this[_0xaa6f('0x6')],'email':this[_0xaa6f('0x7')],'accountcode':this[_0xaa6f('0x8')],'fullname':this[_0xaa6f('0x9')],'state':this['state'],'stateTime':this[_0xaa6f('0xb')],'status':this['status'],'address':this[_0xaa6f('0x1f')],'online':this[_0xaa6f('0x10')],'voiceStatus':this[_0xaa6f('0x11')],'voiceStatusTime':this[_0xaa6f('0x12')],'voiceStatusCallerIdNumber':this[_0xaa6f('0x13')],'voiceStatusQueue':this[_0xaa6f('0x20')],'interface':this[_0xaa6f('0xf')],'onhold':this[_0xaa6f('0x14')]};var _0x45855a=md5(JSON[_0xaa6f('0x21')](_0x157cee));if(this[_0xaa6f('0x2')]!==_0x45855a){this[_0xaa6f('0x2')]=_0x45855a;io['to'](util[_0xaa6f('0x1e')](_0xaa6f('0x22'),_0x157cee[_0xaa6f('0x6')]))[_0xaa6f('0x23')](_0xaa6f('0x24'),_['omit'](_0x157cee,[_0xaa6f('0x10')]));io['emit'](_0xaa6f('0x25'),_0x157cee);}};module[_0xaa6f('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 132ce91..61af42b 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 _0x85b1=['dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength'];(function(_0x190148,_0xda6bdd){var _0x5009de=function(_0x19c769){while(--_0x19c769){_0x190148['push'](_0x190148['shift']());}};_0x5009de(++_0xda6bdd);}(_0x85b1,0xcd));var _0x185b=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x85b1[_0x20ef64];return _0x3707d8;};'use strict';function Campaign(_0x40fc84){this['id']=_0x40fc84['id']||0x0;this[_0x185b('0x0')]=_0x40fc84['name']||'';this[_0x185b('0x1')]=_0x40fc84[_0x185b('0x1')]||'campaign';this[_0x185b('0x2')]=0x0;this[_0x185b('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x185b('0x4')]=0x0;this[_0x185b('0x5')]='';this[_0x185b('0x6')]=!![];this[_0x185b('0x7')]=_0x40fc84['active'];this[_0x185b('0x8')]=_0x40fc84['limitCalls'];this[_0x185b('0x9')]=_0x40fc84['dialTimezone']||null;this[_0x185b('0xa')]=_0x40fc84[_0x185b('0xa')]?_0x40fc84[_0x185b('0xa')]:null;this['dialOriginateCallerIdName']=_0x40fc84[_0x185b('0xb')];this[_0x185b('0xc')]=_0x40fc84[_0x185b('0xc')];this[_0x185b('0xd')]=_0x40fc84[_0x185b('0xd')]||0x1e;this[_0x185b('0xe')]=_0x40fc84[_0x185b('0xe')];this[_0x185b('0xf')]=_0x40fc84['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x40fc84[_0x185b('0x10')];this[_0x185b('0x11')]=_0x40fc84[_0x185b('0x11')];this[_0x185b('0x12')]=_0x40fc84[_0x185b('0x12')];this[_0x185b('0x13')]=_0x40fc84['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x40fc84[_0x185b('0x14')];this[_0x185b('0x15')]=_0x40fc84[_0x185b('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x40fc84['dialNoSuchNumberRetryFrequency']||0x96;this[_0x185b('0x16')]=_0x40fc84[_0x185b('0x16')]||0x3;this[_0x185b('0x17')]=_0x40fc84[_0x185b('0x17')]||0x96;this[_0x185b('0x18')]=_0x40fc84['dialAbandonedMaxRetry']||0x3;this[_0x185b('0x19')]=_0x40fc84['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x40fc84['dialMachineMaxRetry']||0x3;this[_0x185b('0x1a')]=_0x40fc84[_0x185b('0x1a')]||0x96;this[_0x185b('0x1b')]=_0x40fc84[_0x185b('0x1b')]||0x3;this[_0x185b('0x1c')]=_0x40fc84['dialAgentRejectRetryFrequency']||0x96;this[_0x185b('0x1d')]=_0x40fc84['dialOrderByScheduledAt']||_0x185b('0x1e');this['dialPrefix']=_0x40fc84[_0x185b('0x1f')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x40fc84[_0x185b('0x20')]||undefined;this[_0x185b('0x21')]=_0x40fc84[_0x185b('0x21')]||undefined;this[_0x185b('0x22')]=_0x40fc84[_0x185b('0x22')]?_0x40fc84['TrunkBackup']:undefined;this[_0x185b('0x23')]=_0x40fc84['Trunk']?_0x40fc84[_0x185b('0x23')]:undefined;this[_0x185b('0x24')]=_0x40fc84[_0x185b('0x24')]?_0x40fc84['Interval']:undefined;this[_0x185b('0x25')]=_0x40fc84[_0x185b('0x25')]?_0x40fc84[_0x185b('0x25')]:undefined;this[_0x185b('0x26')]=_0x40fc84[_0x185b('0x25')]?_0x40fc84[_0x185b('0x25')]['name']:undefined;this[_0x185b('0x27')]=_0x40fc84[_0x185b('0x27')]||![];this[_0x185b('0x28')]=_0x40fc84[_0x185b('0x28')];this[_0x185b('0x29')]=_0x40fc84['dialAMDGreeting'];this[_0x185b('0x2a')]=_0x40fc84[_0x185b('0x2a')];this['dialAMDTotalAnalysisTime']=_0x40fc84[_0x185b('0x2b')];this[_0x185b('0x2c')]=_0x40fc84[_0x185b('0x2c')];this[_0x185b('0x2d')]=_0x40fc84[_0x185b('0x2d')];this[_0x185b('0x2e')]=_0x40fc84[_0x185b('0x2e')];this[_0x185b('0x2f')]=_0x40fc84['dialAMDSilenceThreshold'];this[_0x185b('0x30')]=_0x40fc84[_0x185b('0x30')];}module[_0x185b('0x31')]=Campaign; \ No newline at end of file +var _0x8108=['dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject'];(function(_0x4ee073,_0x28bcf0){var _0x25f9aa=function(_0x51e40c){while(--_0x51e40c){_0x4ee073['push'](_0x4ee073['shift']());}};_0x25f9aa(++_0x28bcf0);}(_0x8108,0x176));var _0x8810=function(_0x1d603a,_0x2b814e){_0x1d603a=_0x1d603a-0x0;var _0x4b76b4=_0x8108[_0x1d603a];return _0x4b76b4;};'use strict';function Campaign(_0x1b68f1){this['id']=_0x1b68f1['id']||0x0;this[_0x8810('0x0')]=_0x1b68f1[_0x8810('0x0')]||'';this[_0x8810('0x1')]=_0x1b68f1[_0x8810('0x1')]||_0x8810('0x2');this[_0x8810('0x3')]=0x0;this[_0x8810('0x4')]=0x0;this[_0x8810('0x5')]=0x0;this[_0x8810('0x6')]=0x0;this[_0x8810('0x7')]='';this[_0x8810('0x8')]=!![];this[_0x8810('0x9')]=_0x1b68f1['active'];this[_0x8810('0xa')]=_0x1b68f1[_0x8810('0xa')];this[_0x8810('0xb')]=_0x1b68f1[_0x8810('0xb')]||null;this[_0x8810('0xc')]=_0x1b68f1[_0x8810('0xc')]?_0x1b68f1['dialGlobalInterval']:null;this[_0x8810('0xd')]=_0x1b68f1[_0x8810('0xd')];this[_0x8810('0xe')]=_0x1b68f1[_0x8810('0xe')];this[_0x8810('0xf')]=_0x1b68f1['dialOriginateTimeout']||0x1e;this[_0x8810('0x10')]=_0x1b68f1[_0x8810('0x10')];this['dialCongestionRetryFrequency']=_0x1b68f1[_0x8810('0x11')];this[_0x8810('0x12')]=_0x1b68f1[_0x8810('0x12')];this[_0x8810('0x13')]=_0x1b68f1[_0x8810('0x13')];this[_0x8810('0x14')]=_0x1b68f1[_0x8810('0x14')];this[_0x8810('0x15')]=_0x1b68f1[_0x8810('0x15')];this['dialGlobalMaxRetry']=_0x1b68f1['dialGlobalMaxRetry'];this[_0x8810('0x16')]=_0x1b68f1[_0x8810('0x16')]||0x3;this[_0x8810('0x17')]=_0x1b68f1['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x1b68f1[_0x8810('0x18')]||0x3;this[_0x8810('0x19')]=_0x1b68f1[_0x8810('0x19')]||0x96;this['dialAbandonedMaxRetry']=_0x1b68f1[_0x8810('0x1a')]||0x3;this[_0x8810('0x1b')]=_0x1b68f1[_0x8810('0x1b')]||0x96;this[_0x8810('0x1c')]=_0x1b68f1[_0x8810('0x1c')]||0x3;this[_0x8810('0x1d')]=_0x1b68f1['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x1b68f1[_0x8810('0x1e')]||0x3;this[_0x8810('0x1f')]=_0x1b68f1[_0x8810('0x1f')]||0x96;this[_0x8810('0x20')]=_0x1b68f1[_0x8810('0x20')]||_0x8810('0x21');this[_0x8810('0x22')]=_0x1b68f1['dialPrefix']||undefined;this[_0x8810('0x23')]=_0x1b68f1[_0x8810('0x23')]||undefined;this[_0x8810('0x24')]=_0x1b68f1[_0x8810('0x24')]||undefined;this[_0x8810('0x25')]=_0x1b68f1[_0x8810('0x25')]?_0x1b68f1[_0x8810('0x25')]:undefined;this[_0x8810('0x26')]=_0x1b68f1[_0x8810('0x26')]?_0x1b68f1['Trunk']:undefined;this[_0x8810('0x27')]=_0x1b68f1[_0x8810('0x27')]?_0x1b68f1[_0x8810('0x27')]:undefined;this[_0x8810('0x28')]=_0x1b68f1['SquareProject']?_0x1b68f1['SquareProject']:undefined;this[_0x8810('0x29')]=_0x1b68f1[_0x8810('0x28')]?_0x1b68f1[_0x8810('0x28')][_0x8810('0x0')]:undefined;this[_0x8810('0x2a')]=_0x1b68f1[_0x8810('0x2a')]||![];this[_0x8810('0x2b')]=_0x1b68f1[_0x8810('0x2b')];this[_0x8810('0x2c')]=_0x1b68f1[_0x8810('0x2c')];this[_0x8810('0x2d')]=_0x1b68f1[_0x8810('0x2d')];this[_0x8810('0x2e')]=_0x1b68f1['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x1b68f1['dialAMDMinWordLength'];this[_0x8810('0x2f')]=_0x1b68f1[_0x8810('0x2f')];this[_0x8810('0x30')]=_0x1b68f1[_0x8810('0x30')];this[_0x8810('0x31')]=_0x1b68f1[_0x8810('0x31')];this[_0x8810('0x32')]=_0x1b68f1[_0x8810('0x32')];}module[_0x8810('0x33')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 8714482..a1d0076 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 _0x87e5=['uniqueid','linkedid','exten','answertime','endtime','unmanaged','abandoned','lastapplication','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','calleridnum','calleridname','connectedlinename','accountcode','context'];(function(_0x5d7f51,_0x366ea7){var _0x3385ae=function(_0x426b14){while(--_0x426b14){_0x5d7f51['push'](_0x5d7f51['shift']());}};_0x3385ae(++_0x366ea7);}(_0x87e5,0xc1));var _0x587e=function(_0x19babd,_0x1d4ef7){_0x19babd=_0x19babd-0x0;var _0x314eaf=_0x87e5[_0x19babd];return _0x314eaf;};'use strict';function Channel(){this[_0x587e('0x0')]=null;this[_0x587e('0x1')]='';this['destinationchannel']='';this[_0x587e('0x2')]=0x0;this[_0x587e('0x3')]='';this['connectedlinenum']=undefined;this[_0x587e('0x4')]=undefined;this[_0x587e('0x5')]=0x0;this[_0x587e('0x6')]='';this[_0x587e('0x7')]=0x0;this[_0x587e('0x8')]=0x0;this[_0x587e('0x9')]=0x0;this['answered']=![];this[_0x587e('0xa')]=null;this[_0x587e('0xb')]=null;this[_0x587e('0xc')]=![];this[_0x587e('0xd')]=![];this[_0x587e('0xe')]='';this['lastdata']='';this['duration']=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this['type']=null;this[_0x587e('0xf')]=null;this[_0x587e('0x10')]=null;this[_0x587e('0x11')]=![];this[_0x587e('0x12')]=null;this[_0x587e('0x13')]=null;this[_0x587e('0x14')]=[];this[_0x587e('0x15')]=undefined;this[_0x587e('0x16')]=undefined;this[_0x587e('0x17')]=undefined;this[_0x587e('0x18')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xfb93=['duration','billableseconds','holdtime','type','tag','disposition','monitor','queue','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','linkedid','exten','answered','answertime','abandoned','lastapplication','lastdata'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xfb93,0x111));var _0x3fb9=function(_0x4dcf99,_0x5a1953){_0x4dcf99=_0x4dcf99-0x0;var _0x1d6aab=_0xfb93[_0x4dcf99];return _0x1d6aab;};'use strict';function Channel(){this[_0x3fb9('0x0')]=null;this[_0x3fb9('0x1')]='';this[_0x3fb9('0x2')]='';this[_0x3fb9('0x3')]=0x0;this['calleridname']='';this[_0x3fb9('0x4')]=undefined;this[_0x3fb9('0x5')]=undefined;this['accountcode']=0x0;this['context']='';this['uniqueid']=0x0;this[_0x3fb9('0x6')]=0x0;this[_0x3fb9('0x7')]=0x0;this[_0x3fb9('0x8')]=![];this[_0x3fb9('0x9')]=null;this['endtime']=null;this['unmanaged']=![];this[_0x3fb9('0xa')]=![];this[_0x3fb9('0xb')]='';this[_0x3fb9('0xc')]='';this[_0x3fb9('0xd')]=0x0;this[_0x3fb9('0xe')]=0x0;this[_0x3fb9('0xf')]=0x0;this[_0x3fb9('0x10')]=null;this[_0x3fb9('0x11')]=null;this[_0x3fb9('0x12')]=null;this[_0x3fb9('0x13')]=![];this['monitorFilename']=null;this[_0x3fb9('0x14')]=null;this[_0x3fb9('0x15')]=[];this['transfercalleridnum']=undefined;this[_0x3fb9('0x16')]=undefined;this[_0x3fb9('0x17')]=undefined;this[_0x3fb9('0x18')]=0x0;}module[_0x3fb9('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index f11632a..6410fe3 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 _0x2993=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x40d25d,_0x2e3f87){var _0xcb2ebe=function(_0xa82ba2){while(--_0xa82ba2){_0x40d25d['push'](_0x40d25d['shift']());}};_0xcb2ebe(++_0x2e3f87);}(_0x2993,0x82));var _0x3299=function(_0x14f0ac,_0x11799e){_0x14f0ac=_0x14f0ac-0x0;var _0x5400a3=_0x2993[_0x14f0ac];return _0x5400a3;};'use strict';function DeskAccount(_0x5301f8){this['id']=_0x5301f8['id']||0x0;this[_0x3299('0x0')]=_0x5301f8['name']||'';this[_0x3299('0x1')]=_0x5301f8[_0x3299('0x1')]||'';this[_0x3299('0x2')]=_0x5301f8[_0x3299('0x2')]||'';this['authType']=_0x5301f8[_0x3299('0x3')]||'';this[_0x3299('0x4')]=_0x5301f8[_0x3299('0x4')]||'';this[_0x3299('0x5')]=_0x5301f8[_0x3299('0x5')]||'';this['consumerSecret']=_0x5301f8[_0x3299('0x6')]||'';this[_0x3299('0x7')]=_0x5301f8[_0x3299('0x7')]||'';this[_0x3299('0x8')]=_0x5301f8['tokenSecret']||'';this[_0x3299('0x9')]=_0x5301f8[_0x3299('0x9')]||'';this[_0x3299('0xa')]=_0x5301f8[_0x3299('0xa')]||'';this[_0x3299('0xb')]=_0x5301f8[_0x3299('0xb')]||{};}module[_0x3299('0xc')]=DeskAccount; \ No newline at end of file +var _0x9e7c=['serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x4233a2,_0x478e28){var _0x1c420e=function(_0x10b59e){while(--_0x10b59e){_0x4233a2['push'](_0x4233a2['shift']());}};_0x1c420e(++_0x478e28);}(_0x9e7c,0x1e4));var _0xc9e7=function(_0x38a5f2,_0x3f2a9a){_0x38a5f2=_0x38a5f2-0x0;var _0x1bb9f3=_0x9e7c[_0x38a5f2];return _0x1bb9f3;};'use strict';function DeskAccount(_0x54f6d7){this['id']=_0x54f6d7['id']||0x0;this[_0xc9e7('0x0')]=_0x54f6d7[_0xc9e7('0x0')]||'';this[_0xc9e7('0x1')]=_0x54f6d7[_0xc9e7('0x1')]||'';this[_0xc9e7('0x2')]=_0x54f6d7[_0xc9e7('0x2')]||'';this['authType']=_0x54f6d7[_0xc9e7('0x3')]||'';this['password']=_0x54f6d7[_0xc9e7('0x4')]||'';this['consumerKey']=_0x54f6d7[_0xc9e7('0x5')]||'';this[_0xc9e7('0x6')]=_0x54f6d7[_0xc9e7('0x6')]||'';this[_0xc9e7('0x7')]=_0x54f6d7['token']||'';this[_0xc9e7('0x8')]=_0x54f6d7['tokenSecret']||'';this[_0xc9e7('0x9')]=_0x54f6d7['type']||'';this[_0xc9e7('0xa')]=_0x54f6d7[_0xc9e7('0xa')]||'';this['Configurations']=_0x54f6d7[_0xc9e7('0xb')]||{};}module[_0xc9e7('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index df94ca7..60562be 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 _0x70f2=['serverUrl','modernAuthentication','Configurations','CloudProvider','name','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x166b7c,_0x5d0f69){var _0x44be9f=function(_0x27c7c6){while(--_0x27c7c6){_0x166b7c['push'](_0x166b7c['shift']());}};_0x44be9f(++_0x5d0f69);}(_0x70f2,0xae));var _0x270f=function(_0xd009b,_0x4c12be){_0xd009b=_0xd009b-0x0;var _0x36e21b=_0x70f2[_0xd009b];return _0x36e21b;};'use strict';function Dynamics365Account(_0x563f76){this['id']=_0x563f76['id']||0x0;this['name']=_0x563f76[_0x270f('0x0')]||'';this['username']=_0x563f76['username']||'';this[_0x270f('0x1')]=_0x563f76[_0x270f('0x1')]||'';this['remoteUri']=_0x563f76[_0x270f('0x2')]||'';this[_0x270f('0x3')]=_0x563f76[_0x270f('0x3')]||'';this[_0x270f('0x4')]=_0x563f76[_0x270f('0x4')]||'';this[_0x270f('0x5')]=_0x563f76[_0x270f('0x5')]||{};this[_0x270f('0x6')]=_0x563f76[_0x270f('0x6')]||'';this['modernAuthentication']=_0x563f76[_0x270f('0x7')]||![];this['Configurations']=_0x563f76[_0x270f('0x8')]||{};this[_0x270f('0x9')]=_0x563f76[_0x270f('0x9')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x0598=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports'];(function(_0x13b2a6,_0x38500b){var _0x5588b3=function(_0xc88c91){while(--_0xc88c91){_0x13b2a6['push'](_0x13b2a6['shift']());}};_0x5588b3(++_0x38500b);}(_0x0598,0x122));var _0x8059=function(_0x333bc4,_0x38594f){_0x333bc4=_0x333bc4-0x0;var _0x16f25c=_0x0598[_0x333bc4];return _0x16f25c;};'use strict';function Dynamics365Account(_0x1e7b03){this['id']=_0x1e7b03['id']||0x0;this[_0x8059('0x0')]=_0x1e7b03[_0x8059('0x0')]||'';this[_0x8059('0x1')]=_0x1e7b03[_0x8059('0x1')]||'';this[_0x8059('0x2')]=_0x1e7b03[_0x8059('0x2')]||'';this[_0x8059('0x3')]=_0x1e7b03['remoteUri']||'';this[_0x8059('0x4')]=_0x1e7b03[_0x8059('0x4')]||'';this['clientId']=_0x1e7b03[_0x8059('0x5')]||'';this['clientSecret']=_0x1e7b03[_0x8059('0x6')]||{};this['serverUrl']=_0x1e7b03[_0x8059('0x7')]||'';this['modernAuthentication']=_0x1e7b03['modernAuthentication']||![];this[_0x8059('0x8')]=_0x1e7b03['Configurations']||{};this['CloudProvider']=_0x1e7b03['CloudProvider']||{};}module[_0x8059('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index bb1a4f0..aecc9a2 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 _0x3986=['exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key'];(function(_0x4cfe90,_0x3da8fb){var _0x13591e=function(_0x3f1281){while(--_0x3f1281){_0x4cfe90['push'](_0x4cfe90['shift']());}};_0x13591e(++_0x3da8fb);}(_0x3986,0x157));var _0x6398=function(_0x50ca3a,_0x3db23e){_0x50ca3a=_0x50ca3a-0x0;var _0x14aed5=_0x3986[_0x50ca3a];return _0x14aed5;};'use strict';function FaxAccount(_0x301deb){this['id']=_0x301deb['id']||0x0;this[_0x6398('0x0')]=_0x301deb['name']||'';this[_0x6398('0x1')]=_0x301deb[_0x6398('0x1')];this[_0x6398('0x2')]=_0x301deb['ecm'];this[_0x6398('0x3')]=_0x301deb[_0x6398('0x3')];this[_0x6398('0x4')]=_0x301deb[_0x6398('0x4')];this[_0x6398('0x5')]=_0x301deb[_0x6398('0x5')]||0x960;this['maxrate']=_0x301deb[_0x6398('0x6')]||0x3840;this[_0x6398('0x7')]=_0x301deb[_0x6398('0x7')]||_0x6398('0x8');this[_0x6398('0x9')]=_0x301deb['gateway']||'no';this[_0x6398('0xa')]=_0x301deb[_0x6398('0xa')]||'no';this[_0x6398('0xb')]=_0x301deb[_0x6398('0xb')]||0x1388;this[_0x6398('0xc')]=_0x301deb[_0x6398('0xc')]||_0x6398('0xd');this[_0x6398('0xe')]=_0x301deb[_0x6398('0xe')]?_0x301deb[_0x6398('0xe')]:undefined;this[_0x6398('0xf')]=_0x301deb[_0x6398('0xf')];this[_0x6398('0x10')]=_0x301deb[_0x6398('0x10')];}module[_0x6398('0x11')]=FaxAccount; \ No newline at end of file +var _0x3969=['exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key'];(function(_0x2ee974,_0x1cceb5){var _0x20c5fb=function(_0xc54e84){while(--_0xc54e84){_0x2ee974['push'](_0x2ee974['shift']());}};_0x20c5fb(++_0x1cceb5);}(_0x3969,0x157));var _0x9396=function(_0x549307,_0x25b1a9){_0x549307=_0x549307-0x0;var _0x5403c9=_0x3969[_0x549307];return _0x5403c9;};'use strict';function FaxAccount(_0xf0fef3){this['id']=_0xf0fef3['id']||0x0;this[_0x9396('0x0')]=_0xf0fef3['name']||'';this[_0x9396('0x1')]=_0xf0fef3[_0x9396('0x1')];this['ecm']=_0xf0fef3[_0x9396('0x2')];this[_0x9396('0x3')]=_0xf0fef3[_0x9396('0x3')];this[_0x9396('0x4')]=_0xf0fef3[_0x9396('0x4')];this[_0x9396('0x5')]=_0xf0fef3[_0x9396('0x5')]||0x960;this[_0x9396('0x6')]=_0xf0fef3[_0x9396('0x6')]||0x3840;this['modem']=_0xf0fef3[_0x9396('0x7')]||_0x9396('0x8');this[_0x9396('0x9')]=_0xf0fef3[_0x9396('0x9')]||'no';this[_0x9396('0xa')]=_0xf0fef3['faxdetect']||'no';this[_0x9396('0xb')]=_0xf0fef3[_0x9396('0xb')]||0x1388;this[_0x9396('0xc')]=_0xf0fef3['tech']||_0x9396('0xd');this[_0x9396('0xe')]=_0xf0fef3['Trunk']?_0xf0fef3[_0x9396('0xe')]:undefined;this[_0x9396('0xf')]=_0xf0fef3[_0x9396('0xf')];this[_0x9396('0x10')]=_0xf0fef3['key'];}module[_0x9396('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 2410523..007dd41 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 _0xbf90=['remoteUri','serverUrl','Configurations','exports','username'];(function(_0x3b81d4,_0x528913){var _0x718d0c=function(_0x226e06){while(--_0x226e06){_0x3b81d4['push'](_0x3b81d4['shift']());}};_0x718d0c(++_0x528913);}(_0xbf90,0x13a));var _0x0bf9=function(_0x36ccc0,_0x33e6e2){_0x36ccc0=_0x36ccc0-0x0;var _0x2e978d=_0xbf90[_0x36ccc0];return _0x2e978d;};'use strict';function FreshdeskAccount(_0x248ca7){this['id']=_0x248ca7['id']||0x0;this['name']=_0x248ca7['name']||'';this['username']=_0x248ca7[_0x0bf9('0x0')]||'';this['apiKey']=_0x248ca7['token']||'';this[_0x0bf9('0x1')]=_0x248ca7[_0x0bf9('0x1')]||'';this[_0x0bf9('0x2')]=_0x248ca7[_0x0bf9('0x2')]||'';this[_0x0bf9('0x3')]=_0x248ca7['Configurations']||{};}module[_0x0bf9('0x4')]=FreshdeskAccount; \ No newline at end of file +var _0xaf01=['name','username','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x33914a,_0x4b6ccd){var _0x37ef1f=function(_0x1d42c2){while(--_0x1d42c2){_0x33914a['push'](_0x33914a['shift']());}};_0x37ef1f(++_0x4b6ccd);}(_0xaf01,0x18f));var _0x1af0=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xaf01[_0x12fc8d];return _0x3f9d04;};'use strict';function FreshdeskAccount(_0x114472){this['id']=_0x114472['id']||0x0;this[_0x1af0('0x0')]=_0x114472[_0x1af0('0x0')]||'';this[_0x1af0('0x1')]=_0x114472[_0x1af0('0x1')]||'';this['apiKey']=_0x114472[_0x1af0('0x2')]||'';this['remoteUri']=_0x114472[_0x1af0('0x3')]||'';this[_0x1af0('0x4')]=_0x114472['serverUrl']||'';this[_0x1af0('0x5')]=_0x114472[_0x1af0('0x5')]||{};}module[_0x1af0('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 25d903d..a618371 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 _0x9957=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x3c92a0,_0x18fde2){var _0x136d77=function(_0x1426cf){while(--_0x1426cf){_0x3c92a0['push'](_0x3c92a0['shift']());}};_0x136d77(++_0x18fde2);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';function FreshsalesAccount(_0x202794){this['id']=_0x202794['id']||0x0;this[_0x7995('0x0')]=_0x202794[_0x7995('0x0')]||'';this[_0x7995('0x1')]=_0x202794['username']||'';this[_0x7995('0x2')]=_0x202794[_0x7995('0x3')]||'';this[_0x7995('0x4')]=_0x202794[_0x7995('0x4')]||'';this['serverUrl']=_0x202794[_0x7995('0x5')]||'';this[_0x7995('0x6')]=_0x202794[_0x7995('0x6')]||{};}module[_0x7995('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x4fb4=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x551e3a,_0x45c8fe){var _0x12eff3=function(_0x2995d4){while(--_0x2995d4){_0x551e3a['push'](_0x551e3a['shift']());}};_0x12eff3(++_0x45c8fe);}(_0x4fb4,0x190));var _0x44fb=function(_0x119d7,_0x2803d0){_0x119d7=_0x119d7-0x0;var _0x195026=_0x4fb4[_0x119d7];return _0x195026;};'use strict';function FreshsalesAccount(_0x2983b0){this['id']=_0x2983b0['id']||0x0;this[_0x44fb('0x0')]=_0x2983b0[_0x44fb('0x0')]||'';this[_0x44fb('0x1')]=_0x2983b0[_0x44fb('0x1')]||'';this[_0x44fb('0x2')]=_0x2983b0[_0x44fb('0x3')]||'';this['remoteUri']=_0x2983b0[_0x44fb('0x4')]||'';this[_0x44fb('0x5')]=_0x2983b0[_0x44fb('0x5')]||'';this[_0x44fb('0x6')]=_0x2983b0[_0x44fb('0x6')]||{};}module[_0x44fb('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index f3f2bf5..5368ab9 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 _0x0321=['accountcode','context','exten','assigned','lastAssignedTo','motionChannel','voice','mohtime','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum'];(function(_0x36f125,_0x54d5f9){var _0x2a7dbf=function(_0xb1ba8d){while(--_0xb1ba8d){_0x36f125['push'](_0x36f125['shift']());}};_0x2a7dbf(++_0x54d5f9);}(_0x0321,0x1d4));var _0x1032=function(_0x5b6b0d,_0x5197a4){_0x5b6b0d=_0x5b6b0d-0x0;var _0x1504bb=_0x0321[_0x5b6b0d];return _0x1504bb;};'use strict';function QueueReport(){this[_0x1032('0x0')]=_0x1032('0x1');this[_0x1032('0x2')]='';this[_0x1032('0x3')]='';this[_0x1032('0x4')]='';this[_0x1032('0x5')]='';this[_0x1032('0x6')]=null;this['queuecallerleaveAt']=null;this[_0x1032('0x7')]=0x1;this[_0x1032('0x8')]=0x1;this[_0x1032('0x9')]=![];this[_0x1032('0xa')]=null;this[_0x1032('0xb')]=![];this[_0x1032('0xc')]=null;this[_0x1032('0xd')]=![];this[_0x1032('0xe')]=null;this[_0x1032('0xf')]=0x1;this[_0x1032('0x10')]='';this[_0x1032('0x11')]='';this['connectedlinename']='';this[_0x1032('0x12')]='';this[_0x1032('0x13')]='';this[_0x1032('0x14')]='';this['priority']='';this['holdtime']=0x0;this[_0x1032('0x15')]=![];this[_0x1032('0x16')]='';this[_0x1032('0x17')]=_0x1032('0x18');this[_0x1032('0x19')]=0x0;this['variables']={};}module[_0x1032('0x1a')]=QueueReport; \ No newline at end of file +var _0x85e9=['channel','connectedlinename','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition'];(function(_0x2b783e,_0x3a7474){var _0x59a658=function(_0x3a111c){while(--_0x3a111c){_0x2b783e['push'](_0x2b783e['shift']());}};_0x59a658(++_0x3a7474);}(_0x85e9,0x16a));var _0x985e=function(_0x29bdb7,_0x873459){_0x29bdb7=_0x29bdb7-0x0;var _0x1d4eb7=_0x85e9[_0x29bdb7];return _0x1d4eb7;};'use strict';function QueueReport(){this[_0x985e('0x0')]=_0x985e('0x1');this[_0x985e('0x2')]='';this[_0x985e('0x3')]='';this[_0x985e('0x4')]='';this[_0x985e('0x5')]='';this[_0x985e('0x6')]=null;this[_0x985e('0x7')]=null;this[_0x985e('0x8')]=0x1;this[_0x985e('0x9')]=0x1;this[_0x985e('0xa')]=![];this[_0x985e('0xb')]=null;this[_0x985e('0xc')]=![];this[_0x985e('0xd')]=null;this[_0x985e('0xe')]=![];this['queuecallerexitAt']=null;this[_0x985e('0xf')]=0x1;this[_0x985e('0x10')]='';this['connectedlinenum']='';this[_0x985e('0x11')]='';this['accountcode']='';this[_0x985e('0x12')]='';this[_0x985e('0x13')]='';this[_0x985e('0x14')]='';this[_0x985e('0x15')]=0x0;this[_0x985e('0x16')]=![];this[_0x985e('0x17')]='';this['motionChannel']='voice';this[_0x985e('0x18')]=0x0;this[_0x985e('0x19')]={};}module[_0x985e('0x1a')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 70e57c5..d5c5b10 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 _0x2922=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x2922,0x107));var _0x2292=function(_0x14271b,_0x303f86){_0x14271b=_0x14271b-0x0;var _0x2d8f24=_0x2922[_0x14271b];return _0x2d8f24;};'use strict';function SalesforceAccount(_0x15f139){this['id']=_0x15f139['id']||0x0;this['name']=_0x15f139[_0x2292('0x0')]||'';this[_0x2292('0x1')]=_0x15f139[_0x2292('0x1')]||'';this['remoteUri']=_0x15f139[_0x2292('0x2')]||'';this[_0x2292('0x3')]=_0x15f139['password']||'';this[_0x2292('0x4')]=_0x15f139[_0x2292('0x4')]||'';this['clientSecret']=_0x15f139[_0x2292('0x5')]||'';this[_0x2292('0x6')]=_0x15f139[_0x2292('0x6')]||'';this[_0x2292('0x7')]=_0x15f139[_0x2292('0x7')]||_0x2292('0x8');this['serverUrl']=_0x15f139[_0x2292('0x9')]||'';this[_0x2292('0xa')]=_0x15f139[_0x2292('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x849a=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x48eb7f,_0x2bae31){var _0x3f91c4=function(_0x20d3a2){while(--_0x20d3a2){_0x48eb7f['push'](_0x48eb7f['shift']());}};_0x3f91c4(++_0x2bae31);}(_0x849a,0x1ba));var _0xa849=function(_0x1a1c8a,_0x55d5e0){_0x1a1c8a=_0x1a1c8a-0x0;var _0x5789ee=_0x849a[_0x1a1c8a];return _0x5789ee;};'use strict';function SalesforceAccount(_0x3ed6d7){this['id']=_0x3ed6d7['id']||0x0;this[_0xa849('0x0')]=_0x3ed6d7[_0xa849('0x0')]||'';this[_0xa849('0x1')]=_0x3ed6d7[_0xa849('0x1')]||'';this['remoteUri']=_0x3ed6d7[_0xa849('0x2')]||'';this[_0xa849('0x3')]=_0x3ed6d7[_0xa849('0x3')]||'';this[_0xa849('0x4')]=_0x3ed6d7[_0xa849('0x4')]||'';this[_0xa849('0x5')]=_0x3ed6d7[_0xa849('0x5')]||'';this[_0xa849('0x6')]=_0x3ed6d7['securityToken']||'';this[_0xa849('0x7')]=_0x3ed6d7['type']||_0xa849('0x8');this[_0xa849('0x9')]=_0x3ed6d7['serverUrl']||'';this[_0xa849('0xa')]=_0x3ed6d7[_0xa849('0xa')]||{};}module[_0xa849('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 262ec27..5f0f0d6 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 _0x99bf=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x1ee0a1,_0x51058e){var _0x1d2d5b=function(_0x35cfb5){while(--_0x35cfb5){_0x1ee0a1['push'](_0x1ee0a1['shift']());}};_0x1d2d5b(++_0x51058e);}(_0x99bf,0xa3));var _0xf99b=function(_0x54e856,_0x313d5c){_0x54e856=_0x54e856-0x0;var _0x124873=_0x99bf[_0x54e856];return _0x124873;};'use strict';function ServicenowAccount(_0x21b144){this['id']=_0x21b144['id']||0x0;this[_0xf99b('0x0')]=_0x21b144['name']||'';this[_0xf99b('0x1')]=_0x21b144[_0xf99b('0x1')]||'';this[_0xf99b('0x2')]=_0x21b144[_0xf99b('0x2')]||'';this['remoteUri']=_0x21b144[_0xf99b('0x3')]||'';this[_0xf99b('0x4')]=_0x21b144[_0xf99b('0x4')]||'';this[_0xf99b('0x5')]=_0x21b144[_0xf99b('0x5')]||{};}module[_0xf99b('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x1981=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x3b3362,_0x202631){var _0x223f5b=function(_0x21a21d){while(--_0x21a21d){_0x3b3362['push'](_0x3b3362['shift']());}};_0x223f5b(++_0x202631);}(_0x1981,0xe9));var _0x1198=function(_0x65cd03,_0x2913ee){_0x65cd03=_0x65cd03-0x0;var _0x21c579=_0x1981[_0x65cd03];return _0x21c579;};'use strict';function ServicenowAccount(_0x1edbf3){this['id']=_0x1edbf3['id']||0x0;this[_0x1198('0x0')]=_0x1edbf3['name']||'';this[_0x1198('0x1')]=_0x1edbf3[_0x1198('0x1')]||'';this[_0x1198('0x2')]=_0x1edbf3[_0x1198('0x2')]||'';this[_0x1198('0x3')]=_0x1edbf3[_0x1198('0x3')]||'';this[_0x1198('0x4')]=_0x1edbf3[_0x1198('0x4')]||'';this[_0x1198('0x5')]=_0x1edbf3[_0x1198('0x5')]||{};}module[_0x1198('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 07c57b9..afd314d 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 _0x397a=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x4c18e5,_0x139810){var _0x32129a=function(_0x3faf9f){while(--_0x3faf9f){_0x4c18e5['push'](_0x4c18e5['shift']());}};_0x32129a(++_0x139810);}(_0x397a,0x9d));var _0xa397=function(_0x20a599,_0x4e5a44){_0x20a599=_0x20a599-0x0;var _0x5dac8f=_0x397a[_0x20a599];return _0x5dac8f;};'use strict';function SugarcrmAccount(_0x279eb1){this['id']=_0x279eb1['id']||0x0;this[_0xa397('0x0')]=_0x279eb1[_0xa397('0x0')]||'';this[_0xa397('0x1')]=_0x279eb1['username']||'';this[_0xa397('0x2')]=_0x279eb1[_0xa397('0x2')]||'';this[_0xa397('0x3')]=_0x279eb1[_0xa397('0x3')]||'';this[_0xa397('0x4')]=_0x279eb1['serverUrl']||'';this[_0xa397('0x5')]=_0x279eb1['Configurations']||{};}module[_0xa397('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x6743=['remoteUri','serverUrl','Configurations','name','username','password'];(function(_0x4d05dd,_0x258cdd){var _0x1c5226=function(_0x1a857c){while(--_0x1a857c){_0x4d05dd['push'](_0x4d05dd['shift']());}};_0x1c5226(++_0x258cdd);}(_0x6743,0x13b));var _0x3674=function(_0xf13ca6,_0x5735ea){_0xf13ca6=_0xf13ca6-0x0;var _0x4a4387=_0x6743[_0xf13ca6];return _0x4a4387;};'use strict';function SugarcrmAccount(_0x1c727c){this['id']=_0x1c727c['id']||0x0;this['name']=_0x1c727c[_0x3674('0x0')]||'';this['username']=_0x1c727c[_0x3674('0x1')]||'';this[_0x3674('0x2')]=_0x1c727c[_0x3674('0x2')]||'';this[_0x3674('0x3')]=_0x1c727c[_0x3674('0x3')]||'';this[_0x3674('0x4')]=_0x1c727c['serverUrl']||'';this[_0x3674('0x5')]=_0x1c727c[_0x3674('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 0f859b3..328e4e3 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 _0x62c0=['unknown','address','exports','name','accountcode','stateTime'];(function(_0x1199f3,_0x32f799){var _0x8932a2=function(_0x290b90){while(--_0x290b90){_0x1199f3['push'](_0x1199f3['shift']());}};_0x8932a2(++_0x32f799);}(_0x62c0,0xdb));var _0x062c=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0x62c0[_0x1bc0ae];return _0x501104;};'use strict';function Telephone(_0x48d51f){this['id']=_0x48d51f['id']||0x0;this[_0x062c('0x0')]=_0x48d51f[_0x062c('0x0')]||'';this[_0x062c('0x1')]=_0x48d51f['accountcode']||'';this['state']='unknown';this[_0x062c('0x2')]=0x0;this['status']=_0x062c('0x3');this[_0x062c('0x4')]='';}module[_0x062c('0x5')]=Telephone; \ No newline at end of file +var _0x3cb4=['exports','name','accountcode','state','unknown','stateTime','status','address'];(function(_0x2c0323,_0x22ade0){var _0x2253ad=function(_0x105d36){while(--_0x105d36){_0x2c0323['push'](_0x2c0323['shift']());}};_0x2253ad(++_0x22ade0);}(_0x3cb4,0x1f1));var _0x43cb=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x3cb4[_0xc6be3a];return _0x56a310;};'use strict';function Telephone(_0xb1a4aa){this['id']=_0xb1a4aa['id']||0x0;this[_0x43cb('0x0')]=_0xb1a4aa[_0x43cb('0x0')]||'';this[_0x43cb('0x1')]=_0xb1a4aa[_0x43cb('0x1')]||'';this[_0x43cb('0x2')]=_0x43cb('0x3');this[_0x43cb('0x4')]=0x0;this[_0x43cb('0x5')]='unknown';this[_0x43cb('0x6')]='';}module[_0x43cb('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index b0263f0..70f2fea 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(_0x577fb8,_0xde0574){var _0x175ac6=function(_0x53c0cd){while(--_0x53c0cd){_0x577fb8['push'](_0x577fb8['shift']());}};_0x175ac6(++_0xde0574);}(_0xb10b,0x12a));var _0xbb10=function(_0x4be3e7,_0x3a7f05){_0x4be3e7=_0x4be3e7-0x0;var _0x4d44a0=_0xb10b[_0x4be3e7];return _0x4d44a0;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x5524f3,_0x480010){var _0x2edc13=function(_0x9c631a){while(--_0x9c631a){_0x5524f3['push'](_0x5524f3['shift']());}};_0x2edc13(++_0x480010);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index a2fe5c0..2c0ef33 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 _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x2c795e,_0xf48253){var _0x1e334b=function(_0x65699b){while(--_0x65699b){_0x2c795e['push'](_0x2c795e['shift']());}};_0x1e334b(++_0xf48253);}(_0xda2d,0x102));var _0xdda2=function(_0x1e2b9f,_0x2ea507){_0x1e2b9f=_0x1e2b9f-0x0;var _0x49b4e6=_0xda2d[_0x1e2b9f];return _0x49b4e6;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file +var _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x161175,_0x45f13f){var _0x295325=function(_0xb73c54){while(--_0xb73c54){_0x161175['push'](_0x161175['shift']());}};_0x295325(++_0x45f13f);}(_0xda2d,0x102));var _0xdda2=function(_0x3de429,_0x532c45){_0x3de429=_0x3de429-0x0;var _0x5d9562=_0xda2d[_0x3de429];return _0x5d9562;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('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 a19d13d..dab4a87 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 _0x0d48=['exports','active','name','state','stateTime','status','registry','split','port','domainport','unknown','address','defaultuser'];(function(_0x211a6a,_0x282ee7){var _0x3cd9c9=function(_0x42c6f3){while(--_0x42c6f3){_0x211a6a['push'](_0x211a6a['shift']());}};_0x3cd9c9(++_0x282ee7);}(_0x0d48,0x1ae));var _0x80d4=function(_0x37d3e0,_0x51d1f4){_0x37d3e0=_0x37d3e0-0x0;var _0x5512a3=_0x0d48[_0x37d3e0];return _0x5512a3;};'use strict';function Trunk(_0x375a7c){this['id']=_0x375a7c['id']||0x0;this[_0x80d4('0x0')]=_0x375a7c[_0x80d4('0x0')]||![];this[_0x80d4('0x1')]=_0x375a7c['name']||'';this[_0x80d4('0x2')]='unknown';this[_0x80d4('0x3')]=0x0;this[_0x80d4('0x4')]='unknown';this[_0x80d4('0x5')]=_0x375a7c['registry']&&_0x375a7c[_0x80d4('0x5')]['indexOf'](':')?_0x375a7c['registry'][_0x80d4('0x6')](':')[0x0]:'';this['host']='';this[_0x80d4('0x7')]='';this['domain']='';this[_0x80d4('0x8')]='';this['refresh']='';this['stateRegistry']=_0x80d4('0x9');this['registrationtime']='';this[_0x80d4('0xa')]='';this['defaultuser']=_0x375a7c[_0x80d4('0xb')]||'';}module[_0x80d4('0xc')]=Trunk; \ No newline at end of file +var _0xb36e=['status','registry','indexOf','split','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','unknown','stateTime'];(function(_0x473ac3,_0xf8066a){var _0x563cfd=function(_0x54b0eb){while(--_0x54b0eb){_0x473ac3['push'](_0x473ac3['shift']());}};_0x563cfd(++_0xf8066a);}(_0xb36e,0xa6));var _0xeb36=function(_0x36cb56,_0x4e0321){_0x36cb56=_0x36cb56-0x0;var _0x5e8935=_0xb36e[_0x36cb56];return _0x5e8935;};'use strict';function Trunk(_0x330b3d){this['id']=_0x330b3d['id']||0x0;this[_0xeb36('0x0')]=_0x330b3d[_0xeb36('0x0')]||![];this[_0xeb36('0x1')]=_0x330b3d[_0xeb36('0x1')]||'';this['state']=_0xeb36('0x2');this[_0xeb36('0x3')]=0x0;this[_0xeb36('0x4')]='unknown';this['registry']=_0x330b3d[_0xeb36('0x5')]&&_0x330b3d[_0xeb36('0x5')][_0xeb36('0x6')](':')?_0x330b3d[_0xeb36('0x5')][_0xeb36('0x7')](':')[0x0]:'';this['host']='';this[_0xeb36('0x8')]='';this[_0xeb36('0x9')]='';this[_0xeb36('0xa')]='';this[_0xeb36('0xb')]='';this[_0xeb36('0xc')]=_0xeb36('0x2');this[_0xeb36('0xd')]='';this[_0xeb36('0xe')]='';this['defaultuser']=_0x330b3d[_0xeb36('0xf')]||'';}module[_0xeb36('0x10')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index f2601bb..a1b7c15 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 _0xa181=['none','mandatoryDisposition','exports','recordingFormat'];(function(_0x4c7e73,_0x142bac){var _0x381d60=function(_0x1b8a0d){while(--_0x1b8a0d){_0x4c7e73['push'](_0x4c7e73['shift']());}};_0x381d60(++_0x142bac);}(_0xa181,0x187));var _0x1a18=function(_0x3b4f8c,_0x252f28){_0x3b4f8c=_0x3b4f8c-0x0;var _0x45af74=_0xa181[_0x3b4f8c];return _0x45af74;};'use strict';function voiceExtension(_0x4eed5c){this['id']=_0x4eed5c['id']||0x0;this['exten']=_0x4eed5c['exten']||'';this[_0x1a18('0x0')]=_0x4eed5c[_0x1a18('0x0')]||_0x1a18('0x1');this[_0x1a18('0x2')]=_0x4eed5c[_0x1a18('0x2')]||![];}module[_0x1a18('0x3')]=voiceExtension; \ No newline at end of file +var _0xef14=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xef14,0xb5));var _0x4ef1=function(_0x2aaf9f,_0x13d89d){_0x2aaf9f=_0x2aaf9f-0x0;var _0x29aebc=_0xef14[_0x2aaf9f];return _0x29aebc;};'use strict';function voiceExtension(_0x54d131){this['id']=_0x54d131['id']||0x0;this['exten']=_0x54d131[_0x4ef1('0x0')]||'';this[_0x4ef1('0x1')]=_0x54d131[_0x4ef1('0x1')]||_0x4ef1('0x2');this[_0x4ef1('0x3')]=_0x54d131[_0x4ef1('0x3')]||![];}module[_0x4ef1('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 43aaf56..47137c6 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 _0xfa9f=['predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','gsm','fewestcalls','leastrecent','linear','ringall','rrmemory','rrordered','monitor_format','type','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','message','statusMessage','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xfa9f,0x93));var _0xffa9=function(_0x4d6bfd,_0x8d79ff){_0x4d6bfd=_0x4d6bfd-0x0;var _0x243a46=_0xfa9f[_0x4d6bfd];return _0x243a46;};'use strict';var monitorFormat={'wav':'wav','wav49':_0xffa9('0x0'),'gsm':_0xffa9('0x1')};var strategy={'fewestcalls':_0xffa9('0x2'),'leastrecent':_0xffa9('0x3'),'linear':_0xffa9('0x4'),'random':'random','ringall':_0xffa9('0x5'),'rr':'roundrobin','rrmemory':_0xffa9('0x6'),'rrordered':_0xffa9('0x7'),'wrandom':'wrandom'};function VoiceQueue(_0xf1a9c6){this['id']=_0xf1a9c6['id']||0x0;this['name']=_0xf1a9c6['name']||'';this[_0xffa9('0x8')]=_0xf1a9c6[_0xffa9('0x8')]||'';this[_0xffa9('0x9')]=_0xf1a9c6[_0xffa9('0x9')]||'inbound';this[_0xffa9('0xa')]=0x0;this[_0xffa9('0xb')]=0x0;this[_0xffa9('0xc')]=0x0;this[_0xffa9('0xd')]=0x0;this[_0xffa9('0xe')]=0x0;this[_0xffa9('0xf')]=0x0;this[_0xffa9('0x10')]=0x0;this[_0xffa9('0x11')]=0x0;this[_0xffa9('0x12')]=0x0;this[_0xffa9('0x13')]=0x0;this[_0xffa9('0x14')]=0x0;this['invalid']=0x0;this[_0xffa9('0x15')]=0x0;this[_0xffa9('0x16')]=0x0;this[_0xffa9('0x17')]=0x0;this[_0xffa9('0x18')]=0x0;this[_0xffa9('0x19')]=0x0;this[_0xffa9('0x1a')]=0x0;this[_0xffa9('0x1b')]=0x0;this[_0xffa9('0x1c')]=0x0;this[_0xffa9('0x1d')]=0x0;this[_0xffa9('0x1e')]=_0xf1a9c6['acw']||![];this[_0xffa9('0x1f')]=_0xf1a9c6['acwTimeout']||0xa;this[_0xffa9('0x20')]=_0xf1a9c6[_0xffa9('0x20')]||'no';this['sendMessageOneNotActive']=!![];this[_0xffa9('0x21')]='';this[_0xffa9('0x22')]='';this[_0xffa9('0x23')]=0x0;this['temp']=0x0;this[_0xffa9('0x24')]=_0xf1a9c6[_0xffa9('0x24')]||null;this[_0xffa9('0x25')]=_0xf1a9c6[_0xffa9('0x25')]?_0xf1a9c6['dialGlobalInterval']:null;this[_0xffa9('0x26')]=_0xf1a9c6['dialActive'];this[_0xffa9('0x27')]=_0xf1a9c6[_0xffa9('0x27')]||_0xffa9('0x28');this[_0xffa9('0x29')]=_0xf1a9c6[_0xffa9('0x29')]||0x0;this[_0xffa9('0x2a')]=_0xf1a9c6['dialLimitQueue']||0x0;this[_0xffa9('0x2b')]=_0xf1a9c6[_0xffa9('0x2b')]||0x1;this[_0xffa9('0x2c')]=_0xf1a9c6[_0xffa9('0x2c')]||_0xffa9('0x2d');this[_0xffa9('0x2e')]=_0xf1a9c6[_0xffa9('0x2e')]||0.03;this[_0xffa9('0x2f')]=_0xf1a9c6[_0xffa9('0x2f')]||0x258;this['dialOriginateCallerIdName']=_0xf1a9c6['dialOriginateCallerIdName']||_0xffa9('0x30');this[_0xffa9('0x31')]=_0xf1a9c6[_0xffa9('0x31')]||'anonymous';this['dialOriginateTimeout']=_0xf1a9c6[_0xffa9('0x32')]||0x1e;this[_0xffa9('0x33')]=_0xf1a9c6[_0xffa9('0x33')]||'tTxX';this['dialQueueTimeout']=_0xf1a9c6[_0xffa9('0x34')]||0x3;this['dialQueueProject']=_0xf1a9c6[_0xffa9('0x35')]||undefined;this[_0xffa9('0x36')]=_0xf1a9c6[_0xffa9('0x36')]||0x3;this[_0xffa9('0x37')]=_0xf1a9c6[_0xffa9('0x37')]||0x96;this[_0xffa9('0x38')]=_0xf1a9c6[_0xffa9('0x38')]||0x3;this['dialBusyRetryFrequency']=_0xf1a9c6[_0xffa9('0x39')]||0x96;this[_0xffa9('0x3a')]=_0xf1a9c6[_0xffa9('0x3a')]||0x3;this[_0xffa9('0x3b')]=_0xf1a9c6[_0xffa9('0x3b')]||0x96;this[_0xffa9('0x3c')]=_0xf1a9c6['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0xf1a9c6[_0xffa9('0x3d')]||0x96;this[_0xffa9('0x3e')]=_0xf1a9c6[_0xffa9('0x3e')]||0x3;this[_0xffa9('0x3f')]=_0xf1a9c6[_0xffa9('0x3f')]||0x96;this[_0xffa9('0x40')]=_0xf1a9c6[_0xffa9('0x40')]||0x3;this[_0xffa9('0x41')]=_0xf1a9c6[_0xffa9('0x41')]||0x96;this['dialMachineMaxRetry']=_0xf1a9c6[_0xffa9('0x42')]||0x3;this[_0xffa9('0x43')]=_0xf1a9c6[_0xffa9('0x43')]||0x96;this['dialAgentRejectMaxRetry']=_0xf1a9c6[_0xffa9('0x44')]||0x3;this[_0xffa9('0x45')]=_0xf1a9c6[_0xffa9('0x45')]||0x96;this['callAdditionalPhoneAfterMin']=_0xf1a9c6[_0xffa9('0x46')]||0x3;this[_0xffa9('0x47')]=_0xf1a9c6[_0xffa9('0x47')]||0x4;this['Trunk']=_0xf1a9c6[_0xffa9('0x48')]?_0xf1a9c6['Trunk']:undefined;this['TrunkBackup']=_0xf1a9c6[_0xffa9('0x49')]?_0xf1a9c6['TrunkBackup']:undefined;this[_0xffa9('0x4a')]=_0xf1a9c6[_0xffa9('0x4a')]||undefined;this[_0xffa9('0x4b')]=_0xf1a9c6[_0xffa9('0x4b')]?_0xf1a9c6[_0xffa9('0x4b')]:undefined;this['dialOrderByScheduledAt']=_0xf1a9c6[_0xffa9('0x4c')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0xf1a9c6[_0xffa9('0x4d')]||undefined;this['dialCutDigit']=_0xf1a9c6[_0xffa9('0x4e')]||undefined;this[_0xffa9('0x4f')]=strategy[_0xf1a9c6['strategy']];this['queueStatusComplete']=!![];this[_0xffa9('0x50')]=_0xf1a9c6['dialAMDActive']||![];this[_0xffa9('0x51')]=_0xf1a9c6[_0xffa9('0x51')];this['dialAMDGreeting']=_0xf1a9c6['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0xf1a9c6['dialAMDAfterGreetingSilence'];this[_0xffa9('0x52')]=_0xf1a9c6[_0xffa9('0x52')];this[_0xffa9('0x53')]=_0xf1a9c6['dialAMDMinWordLength'];this[_0xffa9('0x54')]=_0xf1a9c6[_0xffa9('0x54')];this[_0xffa9('0x55')]=_0xf1a9c6[_0xffa9('0x55')];this[_0xffa9('0x56')]=_0xf1a9c6['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0xf1a9c6[_0xffa9('0x57')];this[_0xffa9('0x58')]=0x0;this[_0xffa9('0x59')]=0x0;this[_0xffa9('0x5a')]=_0xf1a9c6['timeout'];this[_0xffa9('0x5b')]=0x0;this[_0xffa9('0x5c')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xffa9('0x5d')]=0x0;this[_0xffa9('0x5e')]=0x0;this[_0xffa9('0x5f')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xffa9('0x60')]=0x0;this[_0xffa9('0x61')]=0x0;this[_0xffa9('0x62')]=0x0;this[_0xffa9('0x63')]=0x0;this['outboundReCallsDay']=0x0;this[_0xffa9('0x64')]=0x0;this[_0xffa9('0x65')]=undefined;this[_0xffa9('0x66')]=undefined;this[_0xffa9('0x67')]=undefined;this[_0xffa9('0x68')]=1.05;this[_0xffa9('0x69')]=0x0;this[_0xffa9('0x6a')]=0x0;this[_0xffa9('0x6b')]=0x0;this[_0xffa9('0x6c')]=0x0;this[_0xffa9('0x6d')]=0x0;this[_0xffa9('0x6e')]=0x0;this[_0xffa9('0x6f')]=0x0;this[_0xffa9('0x70')]=0x0;this[_0xffa9('0x71')]=_0xf1a9c6[_0xffa9('0x72')]||0x14;this['predictiveIntervalMinThreshold']=_0xf1a9c6['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xffa9('0x73')]=0x0;this[_0xffa9('0x74')]=0x0;this[_0xffa9('0x75')]=0x1;this[_0xffa9('0x76')]=0x0;this[_0xffa9('0x77')]=0x0;this[_0xffa9('0x78')]=0x0;this['erlangBusyFactor']=0x0;this[_0xffa9('0x79')]=_0xf1a9c6[_0xffa9('0x79')]||0x1e;this['dialRecallInQueue']=_0xf1a9c6['dialRecallInQueue']||![];this[_0xffa9('0x7a')]=!!_0xf1a9c6[_0xffa9('0x7a')]||![];this[_0xffa9('0x7b')]=!!_0xf1a9c6['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0xf1a9c6['dialQueueProject2']||undefined;this[_0xffa9('0x7c')]=_0xf1a9c6[_0xffa9('0x7c')]||![];this[_0xffa9('0x7d')]=_0xf1a9c6[_0xffa9('0x7d')]||![];this[_0xffa9('0x8')]=monitorFormat[_0xf1a9c6[_0xffa9('0x8')]]?monitorFormat[_0xf1a9c6[_0xffa9('0x8')]]:undefined;this['mandatoryDisposition']=_0xf1a9c6[_0xffa9('0x7e')]||![];this[_0xffa9('0x7f')]=_0xf1a9c6[_0xffa9('0x7f')]?_0xf1a9c6[_0xffa9('0x7f')]:undefined;this[_0xffa9('0x80')]=![];}module[_0xffa9('0x81')]=VoiceQueue; \ No newline at end of file +var _0x6a9a=['dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','wav','wav49','fewestcalls','leastrecent','random','roundrobin','rrmemory','wrandom','name','monitor_format','type','inbound','waiting','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','sendMessageOneNotActive','message','statusMessage','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval'];(function(_0x41579b,_0x25a427){var _0x2b185a=function(_0x44d16b){while(--_0x44d16b){_0x41579b['push'](_0x41579b['shift']());}};_0x2b185a(++_0x25a427);}(_0x6a9a,0x1bd));var _0xa6a9=function(_0x200aa5,_0x197802){_0x200aa5=_0x200aa5-0x0;var _0x458200=_0x6a9a[_0x200aa5];return _0x458200;};'use strict';var monitorFormat={'wav':_0xa6a9('0x0'),'wav49':_0xa6a9('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0xa6a9('0x2'),'leastrecent':_0xa6a9('0x3'),'linear':'linear','random':_0xa6a9('0x4'),'ringall':'ringall','rr':_0xa6a9('0x5'),'rrmemory':_0xa6a9('0x6'),'rrordered':'rrordered','wrandom':_0xa6a9('0x7')};function VoiceQueue(_0x3d9359){this['id']=_0x3d9359['id']||0x0;this[_0xa6a9('0x8')]=_0x3d9359[_0xa6a9('0x8')]||'';this[_0xa6a9('0x9')]=_0x3d9359[_0xa6a9('0x9')]||'';this[_0xa6a9('0xa')]=_0x3d9359[_0xa6a9('0xa')]||_0xa6a9('0xb');this[_0xa6a9('0xc')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0xa6a9('0xd')]=0x0;this[_0xa6a9('0xe')]=0x0;this[_0xa6a9('0xf')]=0x0;this[_0xa6a9('0x10')]=0x0;this[_0xa6a9('0x11')]=0x0;this[_0xa6a9('0x12')]=0x0;this[_0xa6a9('0x13')]=0x0;this[_0xa6a9('0x14')]=0x0;this[_0xa6a9('0x15')]=0x0;this[_0xa6a9('0x16')]=0x0;this[_0xa6a9('0x17')]=0x0;this[_0xa6a9('0x18')]=0x0;this[_0xa6a9('0x19')]=0x0;this[_0xa6a9('0x1a')]=0x0;this[_0xa6a9('0x1b')]=0x0;this[_0xa6a9('0x1c')]=0x0;this[_0xa6a9('0x1d')]=0x0;this[_0xa6a9('0x1e')]=0x0;this[_0xa6a9('0x1f')]=_0x3d9359[_0xa6a9('0x1f')]||![];this[_0xa6a9('0x20')]=_0x3d9359[_0xa6a9('0x20')]||0xa;this['autopause']=_0x3d9359['autopause']||'no';this[_0xa6a9('0x21')]=!![];this[_0xa6a9('0x22')]='';this[_0xa6a9('0x23')]='';this[_0xa6a9('0x24')]=0x0;this['temp']=0x0;this[_0xa6a9('0x25')]=_0x3d9359['dialTimezone']||null;this['dialGlobalInterval']=_0x3d9359[_0xa6a9('0x26')]?_0x3d9359[_0xa6a9('0x26')]:null;this[_0xa6a9('0x27')]=_0x3d9359[_0xa6a9('0x27')];this[_0xa6a9('0x28')]=_0x3d9359[_0xa6a9('0x28')]||'progressive';this[_0xa6a9('0x29')]=_0x3d9359[_0xa6a9('0x29')]||0x0;this[_0xa6a9('0x2a')]=_0x3d9359['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x3d9359[_0xa6a9('0x2b')]||0x1;this[_0xa6a9('0x2c')]=_0x3d9359['dialPredictiveOptimization']||_0xa6a9('0x2d');this['dialPredictiveOptimizationPercentage']=_0x3d9359['dialPredictiveOptimizationPercentage']||0.03;this[_0xa6a9('0x2e')]=_0x3d9359[_0xa6a9('0x2e')]||0x258;this['dialOriginateCallerIdName']=_0x3d9359[_0xa6a9('0x2f')]||_0xa6a9('0x30');this[_0xa6a9('0x31')]=_0x3d9359[_0xa6a9('0x31')]||_0xa6a9('0x30');this[_0xa6a9('0x32')]=_0x3d9359['dialOriginateTimeout']||0x1e;this[_0xa6a9('0x33')]=_0x3d9359['dialQueueOptions']||'tTxX';this[_0xa6a9('0x34')]=_0x3d9359['dialQueueTimeout']||0x3;this[_0xa6a9('0x35')]=_0x3d9359[_0xa6a9('0x35')]||undefined;this[_0xa6a9('0x36')]=_0x3d9359[_0xa6a9('0x36')]||0x3;this[_0xa6a9('0x37')]=_0x3d9359[_0xa6a9('0x37')]||0x96;this[_0xa6a9('0x38')]=_0x3d9359[_0xa6a9('0x38')]||0x3;this[_0xa6a9('0x39')]=_0x3d9359[_0xa6a9('0x39')]||0x96;this['dialNoAnswerMaxRetry']=_0x3d9359[_0xa6a9('0x3a')]||0x3;this['dialNoAnswerRetryFrequency']=_0x3d9359[_0xa6a9('0x3b')]||0x96;this[_0xa6a9('0x3c')]=_0x3d9359[_0xa6a9('0x3c')]||0x3;this[_0xa6a9('0x3d')]=_0x3d9359['dialNoSuchNumberRetryFrequency']||0x96;this[_0xa6a9('0x3e')]=_0x3d9359[_0xa6a9('0x3e')]||0x3;this[_0xa6a9('0x3f')]=_0x3d9359[_0xa6a9('0x3f')]||0x96;this[_0xa6a9('0x40')]=_0x3d9359['dialAbandonedMaxRetry']||0x3;this[_0xa6a9('0x41')]=_0x3d9359[_0xa6a9('0x41')]||0x96;this['dialMachineMaxRetry']=_0x3d9359['dialMachineMaxRetry']||0x3;this[_0xa6a9('0x42')]=_0x3d9359[_0xa6a9('0x42')]||0x96;this[_0xa6a9('0x43')]=_0x3d9359[_0xa6a9('0x43')]||0x3;this[_0xa6a9('0x44')]=_0x3d9359['dialAgentRejectRetryFrequency']||0x96;this[_0xa6a9('0x45')]=_0x3d9359['callAdditionalPhoneAfterMin']||0x3;this['dialGlobalMaxRetry']=_0x3d9359[_0xa6a9('0x46')]||0x4;this[_0xa6a9('0x47')]=_0x3d9359['Trunk']?_0x3d9359[_0xa6a9('0x47')]:undefined;this['TrunkBackup']=_0x3d9359[_0xa6a9('0x48')]?_0x3d9359[_0xa6a9('0x48')]:undefined;this['dialPrefix']=_0x3d9359[_0xa6a9('0x49')]||undefined;this['Interval']=_0x3d9359[_0xa6a9('0x4a')]?_0x3d9359['Interval']:undefined;this[_0xa6a9('0x4b')]=_0x3d9359[_0xa6a9('0x4b')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x3d9359[_0xa6a9('0x4c')]||undefined;this[_0xa6a9('0x4d')]=_0x3d9359[_0xa6a9('0x4d')]||undefined;this[_0xa6a9('0x4e')]=strategy[_0x3d9359[_0xa6a9('0x4e')]];this[_0xa6a9('0x4f')]=!![];this[_0xa6a9('0x50')]=_0x3d9359[_0xa6a9('0x50')]||![];this[_0xa6a9('0x51')]=_0x3d9359['dialAMDInitialSilence'];this[_0xa6a9('0x52')]=_0x3d9359[_0xa6a9('0x52')];this['dialAMDAfterGreetingSilence']=_0x3d9359[_0xa6a9('0x53')];this[_0xa6a9('0x54')]=_0x3d9359[_0xa6a9('0x54')];this['dialAMDMinWordLength']=_0x3d9359[_0xa6a9('0x55')];this[_0xa6a9('0x56')]=_0x3d9359[_0xa6a9('0x56')];this[_0xa6a9('0x57')]=_0x3d9359[_0xa6a9('0x57')];this[_0xa6a9('0x58')]=_0x3d9359['dialAMDSilenceThreshold'];this[_0xa6a9('0x59')]=_0x3d9359['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0xa6a9('0x5a')]=0x0;this[_0xa6a9('0x5b')]=_0x3d9359[_0xa6a9('0x5b')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this[_0xa6a9('0x5c')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xa6a9('0x5d')]=0x0;this[_0xa6a9('0x5e')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xa6a9('0x5f')]=0x0;this[_0xa6a9('0x60')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xa6a9('0x61')]=0x0;this[_0xa6a9('0x62')]=0x0;this['startProgressive']=undefined;this[_0xa6a9('0x63')]=undefined;this[_0xa6a9('0x64')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xa6a9('0x65')]=0x0;this[_0xa6a9('0x66')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xa6a9('0x67')]=0x0;this[_0xa6a9('0x68')]=0x0;this[_0xa6a9('0x69')]=0x0;this[_0xa6a9('0x6a')]=0x0;this['predictiveIntervalMaxThreshold']=_0x3d9359[_0xa6a9('0x6b')]||0x14;this[_0xa6a9('0x6c')]=_0x3d9359[_0xa6a9('0x6b')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xa6a9('0x6d')]=0x0;this[_0xa6a9('0x6e')]=0x1;this['erlangCalls']=0x0;this[_0xa6a9('0x6f')]=0x0;this[_0xa6a9('0x70')]=0x0;this['erlangBusyFactor']=0x0;this[_0xa6a9('0x71')]=_0x3d9359[_0xa6a9('0x71')]||0x1e;this[_0xa6a9('0x72')]=_0x3d9359[_0xa6a9('0x72')]||![];this[_0xa6a9('0x73')]=!!_0x3d9359[_0xa6a9('0x73')]||![];this[_0xa6a9('0x74')]=!!_0x3d9359['dialPreviewRecallmeReminder']||![];this[_0xa6a9('0x75')]=_0x3d9359[_0xa6a9('0x75')]||undefined;this[_0xa6a9('0x76')]=_0x3d9359[_0xa6a9('0x76')]||![];this[_0xa6a9('0x77')]=_0x3d9359['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x3d9359[_0xa6a9('0x9')]]?monitorFormat[_0x3d9359[_0xa6a9('0x9')]]:undefined;this[_0xa6a9('0x78')]=_0x3d9359[_0xa6a9('0x78')]||![];this[_0xa6a9('0x79')]=_0x3d9359[_0xa6a9('0x79')]?_0x3d9359[_0xa6a9('0x79')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0xa6a9('0x7a')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 2ae03c9..b6cb9ed 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 _0xc01b=['SIP/','incall','status','keys','queue','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','exports','available','loggedIn','loggedInDb','paused','talking','waiting','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','answered','busy','inUse','invalid','onHold','notInUse','ringing','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','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','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length'];(function(_0x423981,_0x15f222){var _0x2e94cd=function(_0x3a78a0){while(--_0x3a78a0){_0x423981['push'](_0x423981['shift']());}};_0x2e94cd(++_0x15f222);}(_0xc01b,0x65));var _0xbc01=function(_0x1cf8a4,_0x16fcfe){_0x1cf8a4=_0x1cf8a4-0x0;var _0x1c8e1e=_0xc01b[_0x1cf8a4];return _0x1c8e1e;};'use strict';var INBOUND_COUNTERS=[_0xbc01('0x0'),_0xbc01('0x1'),_0xbc01('0x2'),_0xbc01('0x3'),'ringing',_0xbc01('0x4'),_0xbc01('0x5')];var OUTBOUND_COUNTERS=['available','answered','inUse',_0xbc01('0x1'),_0xbc01('0x2'),'originated','outboundAbandonedCallsDay',_0xbc01('0x6'),_0xbc01('0x7'),_0xbc01('0x8'),_0xbc01('0x9'),_0xbc01('0xa'),_0xbc01('0xb'),_0xbc01('0xc'),'outboundRejectCallsDay',_0xbc01('0xd'),_0xbc01('0x3'),_0xbc01('0xe'),_0xbc01('0x4'),_0xbc01('0xf'),_0xbc01('0x10'),_0xbc01('0x11'),_0xbc01('0x5')];function VoiceQueueSummary(_0x372325){this['id']=_0x372325['id'];this[_0xbc01('0x12')]=_0x372325[_0xbc01('0x12')];this[_0xbc01('0x13')]=_0x372325[_0xbc01('0x13')];this[_0xbc01('0x14')]=_0x372325['abandoned']||0x0;this[_0xbc01('0x15')]=_0x372325[_0xbc01('0x15')]||0x0;this[_0xbc01('0x0')]=_0x372325['available']||0x0;this[_0xbc01('0x16')]=_0x372325[_0xbc01('0x16')]||0x0;this['inUse']=_0x372325[_0xbc01('0x17')]||0x0;this[_0xbc01('0x18')]=_0x372325[_0xbc01('0x18')]||0x0;this[_0xbc01('0x1')]=_0x372325['loggedIn']||0x0;this['loggedInDb']=_0x372325[_0xbc01('0x2')]||0x0;this[_0xbc01('0x19')]=_0x372325['onHold']||0x0;this[_0xbc01('0x1a')]=_0x372325['notInUse']||0x0;this[_0xbc01('0x3')]=_0x372325[_0xbc01('0x3')]||0x0;this[_0xbc01('0x1b')]=_0x372325[_0xbc01('0x1b')]||0x0;this['ringInUse']=_0x372325[_0xbc01('0x1c')];this[_0xbc01('0xf')]=_0x372325[_0xbc01('0xf')];this['sumDuration']=_0x372325[_0xbc01('0x10')];this[_0xbc01('0x1d')]=_0x372325['sumHoldTime']||0x0;this['talking']=_0x372325['talking']||0x0;this[_0xbc01('0x11')]=_0x372325[_0xbc01('0x11')]||0x0;this[_0xbc01('0x1e')]=_0x372325[_0xbc01('0x1e')];this[_0xbc01('0x1f')]=_0x372325[_0xbc01('0x1f')]||0x0;this['unknown']=_0x372325[_0xbc01('0x20')]||0x0;this['unmanaged']=_0x372325[_0xbc01('0x21')]||0x0;this['waiting']=_0x372325[_0xbc01('0x5')]||0x0;if(_0x372325[_0xbc01('0x1e')]===_0xbc01('0x22')){this['pTalking']=_0x372325[_0xbc01('0xe')]||0x0;this[_0xbc01('0x23')]=_0x372325['dialActive'];this[_0xbc01('0x24')]=_0x372325[_0xbc01('0x24')];this[_0xbc01('0x25')]=_0x372325[_0xbc01('0x25')];this[_0xbc01('0x26')]=_0x372325[_0xbc01('0x26')];this[_0xbc01('0x27')]=_0x372325[_0xbc01('0x27')];this[_0xbc01('0x28')]=_0x372325[_0xbc01('0x28')];this[_0xbc01('0x29')]=_0x372325['temp'];this[_0xbc01('0x2a')]=_0x372325[_0xbc01('0x2a')];this[_0xbc01('0x6')]=_0x372325[_0xbc01('0x6')];this[_0xbc01('0x7')]=_0x372325[_0xbc01('0x7')];this[_0xbc01('0x8')]=_0x372325['outboundBusyCallsDay'];this[_0xbc01('0x9')]=_0x372325['outboundCongestionCallsDay'];this[_0xbc01('0x2b')]=_0x372325[_0xbc01('0x2b')];this['outboundDropCallsDayCallersExit']=_0x372325[_0xbc01('0x2c')];this[_0xbc01('0x2d')]=_0x372325['outboundDropCallsDayTimeout'];this[_0xbc01('0xa')]=_0x372325[_0xbc01('0xa')];this[_0xbc01('0xb')]=_0x372325['outboundNoSuchCallsDay'];this[_0xbc01('0x2e')]=_0x372325[_0xbc01('0x2e')];this[_0xbc01('0xc')]=_0x372325[_0xbc01('0xc')];this[_0xbc01('0x2f')]=_0x372325['outboundRejectCallsDay'];this[_0xbc01('0xd')]=_0x372325[_0xbc01('0xd')];this['predictiveIntervalAnsweredCalls']=_0x372325[_0xbc01('0x30')];this[_0xbc01('0x31')]=_0x372325[_0xbc01('0x31')];this[_0xbc01('0x32')]=_0x372325[_0xbc01('0x32')];this[_0xbc01('0x33')]=_0x372325[_0xbc01('0x33')];this[_0xbc01('0x34')]=_0x372325[_0xbc01('0x34')];this[_0xbc01('0x35')]=_0x372325[_0xbc01('0x35')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x372325[_0xbc01('0x36')];this[_0xbc01('0x37')]=_0x372325['predictiveIntervalHitRate'];this[_0xbc01('0x38')]=_0x372325[_0xbc01('0x38')];this['predictiveIntervalPauses']=_0x372325[_0xbc01('0x39')];this[_0xbc01('0x3a')]=_0x372325[_0xbc01('0x3a')];this[_0xbc01('0x3b')]=_0x372325[_0xbc01('0x3b')];this[_0xbc01('0x3c')]=_0x372325[_0xbc01('0x3c')];this[_0xbc01('0x3d')]=_0x372325[_0xbc01('0x3d')];this[_0xbc01('0x3e')]=_0x372325[_0xbc01('0x3e')];this['erlangAbandonmentRate']=_0x372325[_0xbc01('0x3f')];this['erlangBusyFactor']=_0x372325[_0xbc01('0x40')];this[_0xbc01('0x41')]=_0x372325[_0xbc01('0x41')];this[_0xbc01('0x42')]=_0x372325[_0xbc01('0x42')];this['message']=_0x372325[_0xbc01('0x43')];this[_0xbc01('0x44')]=_0x372325[_0xbc01('0x44')];}if(_0x372325['Trunk']){this[_0xbc01('0x45')]={'id':_0x372325['Trunk']['id'],'name':_0x372325[_0xbc01('0x45')]['name'],'active':_0x372325[_0xbc01('0x45')][_0xbc01('0x46')],'callerid':_0x372325['Trunk'][_0xbc01('0x47')]};}}VoiceQueueSummary[_0xbc01('0x48')][_0xbc01('0x49')]=function(_0x4eaa07,_0x3e9114,_0x2dc114,_0x98aa6b){this['loggedInDb']=0x0;this[_0xbc01('0x4')]=0x0;this['paused']=0x0;this[_0xbc01('0x20')]=0x0;this['notInUse']=0x0;this[_0xbc01('0x17')]=0x0;this[_0xbc01('0x16')]=0x0;this[_0xbc01('0x18')]=0x0;this[_0xbc01('0x1f')]=0x0;this[_0xbc01('0x1b')]=0x0;this[_0xbc01('0x1c')]=0x0;this['onHold']=0x0;if(_0x2dc114){if(_0x2dc114['available']){this[_0xbc01('0x0')]=Number(_0x2dc114[_0xbc01('0x0')]);}if(_0x2dc114[_0xbc01('0x4a')]){this[_0xbc01('0x1')]=Number(_0x2dc114['loggedin']);}if(_0x2dc114['callers']){this[_0xbc01('0x5')]=Number(_0x2dc114[_0xbc01('0x4b')]);}}for(var _0x22589d=0x0;_0x22589d<_0x4eaa07[_0xbc01('0x4c')];_0x22589d++){var _0xd78e9d=_0x3e9114[_0xbc01('0x4d')+_0x4eaa07[_0x22589d][_0xbc01('0x12')]];if(_0xd78e9d&&_0xd78e9d['online']){this['loggedInDb']+=0x1;}if(_0x4eaa07[_0x22589d][_0xbc01('0x4e')]==='1'){this[_0xbc01('0x4')]+=0x1;}if(_0x4eaa07[_0x22589d][_0xbc01('0x3')]==='1'&&!['2','7','8']['includes'](_0x4eaa07[_0x22589d][_0xbc01('0x4f')])){this[_0xbc01('0x3')]+=0x1;}switch(_0x4eaa07[_0x22589d][_0xbc01('0x4f')]){case'0':this[_0xbc01('0x20')]+=0x1;break;case'1':this[_0xbc01('0x1a')]+=0x1;break;case'2':this[_0xbc01('0x17')]+=0x1;break;case'3':this[_0xbc01('0x16')]+=0x1;break;case'4':this[_0xbc01('0x18')]+=0x1;break;case'5':this[_0xbc01('0x1f')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0xbc01('0x1c')]+=0x1;break;case'8':this[_0xbc01('0x19')]+=0x1;break;}}if(this[_0xbc01('0x24')]==='booked'){var _0x30185e=Object[_0xbc01('0x50')](_0x98aa6b);for(var _0x83b750=0x0;_0x83b750<_0x30185e[_0xbc01('0x4c')];_0x83b750++){var _0x57e62f=_0x30185e[_0x83b750];var _0x5e22d7=_0x98aa6b[_0x57e62f];if(_0x5e22d7[_0xbc01('0x51')]===this[_0xbc01('0x12')]&&_0x5e22d7['type']==='dialer'&&_0x5e22d7['exten']==='xcally-motion-preview'){this[_0xbc01('0x4')]+=0x1;}}if(this['talking']>this['inUse']){this[_0xbc01('0x4')]=this[_0xbc01('0x17')];}this[_0xbc01('0xe')]=0x0;}return this;};VoiceQueueSummary[_0xbc01('0x48')][_0xbc01('0x52')]=function(_0x323986){var _0x286b15=![];if(_0x323986){_0x286b15=INBOUND_COUNTERS[_0xbc01('0x53')](function(_0xf03ed3){return this[_0xf03ed3]!==_0x323986[_0xf03ed3];},this);}return _0x286b15;};VoiceQueueSummary['prototype'][_0xbc01('0x54')]=function(_0x49ec33){var _0x4a1a26=![];var _0x4f2dc0=![];var _0x13126f=![];if(_0x49ec33){_0x4a1a26=this[_0xbc01('0x24')]!==_0x49ec33[_0xbc01('0x24')]||this[_0xbc01('0x23')]!==_0x49ec33['dialActive']||this[_0xbc01('0x43')]!==_0x49ec33['message']||this[_0xbc01('0x44')]!==_0x49ec33[_0xbc01('0x44')];_0x4f2dc0=OUTBOUND_COUNTERS[_0xbc01('0x53')](function(_0xba2e1d){return this[_0xba2e1d]!==_0x49ec33[_0xba2e1d];},this);if(this[_0xbc01('0x45')]&&_0x49ec33[_0xbc01('0x45')]){_0x13126f=this['Trunk'][_0xbc01('0x12')]!==_0x49ec33[_0xbc01('0x45')][_0xbc01('0x12')]||this['Trunk'][_0xbc01('0x46')]!==_0x49ec33[_0xbc01('0x45')]['active'];}}return _0x4a1a26||_0x4f2dc0||_0x13126f;};VoiceQueueSummary[_0xbc01('0x48')][_0xbc01('0x55')]=function(_0x2c8aab){this['answered']=_0x2c8aab['answered'];this[_0xbc01('0x43')]=_0x2c8aab[_0xbc01('0x43')];this[_0xbc01('0x44')]=_0x2c8aab['statusMessage'];this[_0xbc01('0x3c')]=_0x2c8aab['originated'];this['outboundAbandonedCallsDay']=_0x2c8aab[_0xbc01('0x56')];this[_0xbc01('0x6')]=_0x2c8aab[_0xbc01('0x6')];this[_0xbc01('0x7')]=_0x2c8aab['outboundBlacklistCallsDay'];this[_0xbc01('0x8')]=_0x2c8aab[_0xbc01('0x8')];this['outboundCongestionCallsDay']=_0x2c8aab[_0xbc01('0x9')];this[_0xbc01('0xa')]=_0x2c8aab['outboundNoAnswerCallsDay'];this[_0xbc01('0xb')]=_0x2c8aab[_0xbc01('0xb')];this['outboundReCallsDay']=_0x2c8aab['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x2c8aab['outboundRejectCallsDay'];this[_0xbc01('0xd')]=_0x2c8aab[_0xbc01('0xd')];this[_0xbc01('0xf')]=_0x2c8aab[_0xbc01('0xf')];this[_0xbc01('0x10')]=_0x2c8aab['sumDuration'];this[_0xbc01('0x11')]=_0x2c8aab['total'];if(this[_0xbc01('0x24')]===_0xbc01('0x57')){this['pTalking']=_0x2c8aab[_0xbc01('0xe')];}};module[_0xbc01('0x58')]=VoiceQueueSummary; \ No newline at end of file +var _0x29b1=['outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','callers','length','SIP/','includes','status','keys','queue','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','exports','loggedInDb','paused','ringing','talking','waiting','available','answered','inUse','loggedIn','originated','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay'];(function(_0x568bd7,_0x23eea6){var _0x203cda=function(_0x26d94f){while(--_0x26d94f){_0x568bd7['push'](_0x568bd7['shift']());}};_0x203cda(++_0x23eea6);}(_0x29b1,0x13b));var _0x129b=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x29b1[_0x42f009];return _0x22a1e0;};'use strict';var INBOUND_COUNTERS=['available','loggedIn',_0x129b('0x0'),_0x129b('0x1'),_0x129b('0x2'),_0x129b('0x3'),_0x129b('0x4')];var OUTBOUND_COUNTERS=[_0x129b('0x5'),_0x129b('0x6'),_0x129b('0x7'),_0x129b('0x8'),_0x129b('0x0'),_0x129b('0x9'),'outboundAbandonedCallsDay',_0x129b('0xa'),'outboundBlacklistCallsDay',_0x129b('0xb'),_0x129b('0xc'),'outboundNoAnswerCallsDay','outboundNoSuchCallsDay',_0x129b('0xd'),'outboundRejectCallsDay',_0x129b('0xe'),_0x129b('0x1'),_0x129b('0xf'),_0x129b('0x3'),_0x129b('0x10'),_0x129b('0x11'),'total',_0x129b('0x4')];function VoiceQueueSummary(_0x16c6fd){this['id']=_0x16c6fd['id'];this['name']=_0x16c6fd[_0x129b('0x12')];this[_0x129b('0x13')]=_0x16c6fd['strategy'];this[_0x129b('0x14')]=_0x16c6fd[_0x129b('0x14')]||0x0;this[_0x129b('0x6')]=_0x16c6fd[_0x129b('0x6')]||0x0;this[_0x129b('0x5')]=_0x16c6fd['available']||0x0;this[_0x129b('0x15')]=_0x16c6fd[_0x129b('0x15')]||0x0;this[_0x129b('0x7')]=_0x16c6fd['inUse']||0x0;this[_0x129b('0x16')]=_0x16c6fd[_0x129b('0x16')]||0x0;this['loggedIn']=_0x16c6fd[_0x129b('0x8')]||0x0;this['loggedInDb']=_0x16c6fd[_0x129b('0x0')]||0x0;this[_0x129b('0x17')]=_0x16c6fd[_0x129b('0x17')]||0x0;this[_0x129b('0x18')]=_0x16c6fd[_0x129b('0x18')]||0x0;this[_0x129b('0x1')]=_0x16c6fd['paused']||0x0;this[_0x129b('0x2')]=_0x16c6fd[_0x129b('0x2')]||0x0;this['ringInUse']=_0x16c6fd[_0x129b('0x19')];this[_0x129b('0x10')]=_0x16c6fd[_0x129b('0x10')];this[_0x129b('0x11')]=_0x16c6fd[_0x129b('0x11')];this[_0x129b('0x1a')]=_0x16c6fd['sumHoldTime']||0x0;this[_0x129b('0x3')]=_0x16c6fd[_0x129b('0x3')]||0x0;this['total']=_0x16c6fd[_0x129b('0x1b')]||0x0;this['type']=_0x16c6fd[_0x129b('0x1c')];this['unavailable']=_0x16c6fd[_0x129b('0x1d')]||0x0;this['unknown']=_0x16c6fd[_0x129b('0x1e')]||0x0;this[_0x129b('0x1f')]=_0x16c6fd[_0x129b('0x1f')]||0x0;this['waiting']=_0x16c6fd[_0x129b('0x4')]||0x0;if(_0x16c6fd[_0x129b('0x1c')]===_0x129b('0x20')){this['pTalking']=_0x16c6fd['pTalking']||0x0;this[_0x129b('0x21')]=_0x16c6fd[_0x129b('0x21')];this['dialMethod']=_0x16c6fd[_0x129b('0x22')];this[_0x129b('0x23')]=_0x16c6fd[_0x129b('0x23')];this[_0x129b('0x24')]=_0x16c6fd[_0x129b('0x24')];this[_0x129b('0x25')]=_0x16c6fd[_0x129b('0x25')];this[_0x129b('0x26')]=_0x16c6fd[_0x129b('0x26')];this[_0x129b('0x27')]=_0x16c6fd[_0x129b('0x27')];this[_0x129b('0x28')]=_0x16c6fd[_0x129b('0x28')];this[_0x129b('0xa')]=_0x16c6fd[_0x129b('0xa')];this[_0x129b('0x29')]=_0x16c6fd['outboundBlacklistCallsDay'];this[_0x129b('0xb')]=_0x16c6fd[_0x129b('0xb')];this['outboundCongestionCallsDay']=_0x16c6fd[_0x129b('0xc')];this[_0x129b('0x2a')]=_0x16c6fd['outboundDropCallsDayACS'];this['outboundDropCallsDayCallersExit']=_0x16c6fd[_0x129b('0x2b')];this['outboundDropCallsDayTimeout']=_0x16c6fd[_0x129b('0x2c')];this[_0x129b('0x2d')]=_0x16c6fd[_0x129b('0x2d')];this[_0x129b('0x2e')]=_0x16c6fd[_0x129b('0x2e')];this[_0x129b('0x2f')]=_0x16c6fd[_0x129b('0x2f')];this[_0x129b('0xd')]=_0x16c6fd[_0x129b('0xd')];this[_0x129b('0x30')]=_0x16c6fd[_0x129b('0x30')];this['outboundUnknownCallsDay']=_0x16c6fd['outboundUnknownCallsDay'];this[_0x129b('0x31')]=_0x16c6fd[_0x129b('0x31')];this['predictiveIntervalAvgHoldtime']=_0x16c6fd[_0x129b('0x32')];this[_0x129b('0x33')]=_0x16c6fd['predictiveIntervalAvgTalktime'];this['predictiveIntervalDroppedCallsCallersExit']=_0x16c6fd['predictiveIntervalDroppedCallsCallersExit'];this[_0x129b('0x34')]=_0x16c6fd[_0x129b('0x34')];this[_0x129b('0x35')]=_0x16c6fd['predictiveIntervalErlangCalls'];this['predictiveIntervalErlangCallsDroppedCalls']=_0x16c6fd[_0x129b('0x36')];this[_0x129b('0x37')]=_0x16c6fd[_0x129b('0x37')];this[_0x129b('0x38')]=_0x16c6fd[_0x129b('0x38')];this[_0x129b('0x39')]=_0x16c6fd[_0x129b('0x39')];this['predictiveIntervalAvailable']=_0x16c6fd[_0x129b('0x3a')];this[_0x129b('0x3b')]=_0x16c6fd[_0x129b('0x3b')];this[_0x129b('0x9')]=_0x16c6fd[_0x129b('0x9')];this[_0x129b('0x3c')]=_0x16c6fd[_0x129b('0x3c')];this[_0x129b('0x3d')]=_0x16c6fd[_0x129b('0x3d')];this[_0x129b('0x3e')]=_0x16c6fd[_0x129b('0x3e')];this[_0x129b('0x3f')]=_0x16c6fd['erlangBusyFactor'];this[_0x129b('0x40')]=_0x16c6fd[_0x129b('0x40')];this[_0x129b('0x41')]=_0x16c6fd[_0x129b('0x41')];this['message']=_0x16c6fd[_0x129b('0x42')];this[_0x129b('0x43')]=_0x16c6fd[_0x129b('0x43')];}if(_0x16c6fd[_0x129b('0x44')]){this[_0x129b('0x44')]={'id':_0x16c6fd[_0x129b('0x44')]['id'],'name':_0x16c6fd[_0x129b('0x44')][_0x129b('0x12')],'active':_0x16c6fd[_0x129b('0x44')][_0x129b('0x45')],'callerid':_0x16c6fd['Trunk'][_0x129b('0x46')]};}}VoiceQueueSummary[_0x129b('0x47')][_0x129b('0x48')]=function(_0x49bdce,_0x3dfe1d,_0xb16c52,_0x36d2e2){this[_0x129b('0x0')]=0x0;this[_0x129b('0x3')]=0x0;this[_0x129b('0x1')]=0x0;this['unknown']=0x0;this['notInUse']=0x0;this[_0x129b('0x7')]=0x0;this[_0x129b('0x15')]=0x0;this['invalid']=0x0;this['unavailable']=0x0;this['ringing']=0x0;this[_0x129b('0x19')]=0x0;this['onHold']=0x0;if(_0xb16c52){if(_0xb16c52['available']){this[_0x129b('0x5')]=Number(_0xb16c52[_0x129b('0x5')]);}if(_0xb16c52['loggedin']){this[_0x129b('0x8')]=Number(_0xb16c52['loggedin']);}if(_0xb16c52[_0x129b('0x49')]){this['waiting']=Number(_0xb16c52['callers']);}}for(var _0x457c70=0x0;_0x457c70<_0x49bdce[_0x129b('0x4a')];_0x457c70++){var _0x2fea05=_0x3dfe1d[_0x129b('0x4b')+_0x49bdce[_0x457c70][_0x129b('0x12')]];if(_0x2fea05&&_0x2fea05['online']){this[_0x129b('0x0')]+=0x1;}if(_0x49bdce[_0x457c70]['incall']==='1'){this[_0x129b('0x3')]+=0x1;}if(_0x49bdce[_0x457c70][_0x129b('0x1')]==='1'&&!['2','7','8'][_0x129b('0x4c')](_0x49bdce[_0x457c70][_0x129b('0x4d')])){this[_0x129b('0x1')]+=0x1;}switch(_0x49bdce[_0x457c70]['status']){case'0':this[_0x129b('0x1e')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x129b('0x7')]+=0x1;break;case'3':this[_0x129b('0x15')]+=0x1;break;case'4':this[_0x129b('0x16')]+=0x1;break;case'5':this[_0x129b('0x1d')]+=0x1;break;case'6':this[_0x129b('0x2')]+=0x1;break;case'7':this[_0x129b('0x19')]+=0x1;break;case'8':this[_0x129b('0x17')]+=0x1;break;}}if(this['dialMethod']==='booked'){var _0x1bb7de=Object[_0x129b('0x4e')](_0x36d2e2);for(var _0x1989f6=0x0;_0x1989f6<_0x1bb7de[_0x129b('0x4a')];_0x1989f6++){var _0xc33582=_0x1bb7de[_0x1989f6];var _0x1cf89e=_0x36d2e2[_0xc33582];if(_0x1cf89e[_0x129b('0x4f')]===this[_0x129b('0x12')]&&_0x1cf89e[_0x129b('0x1c')]==='dialer'&&_0x1cf89e[_0x129b('0x50')]===_0x129b('0x51')){this['talking']+=0x1;}}if(this[_0x129b('0x3')]>this[_0x129b('0x7')]){this[_0x129b('0x3')]=this[_0x129b('0x7')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary['prototype'][_0x129b('0x52')]=function(_0x18ffcf){var _0x4543d9=![];if(_0x18ffcf){_0x4543d9=INBOUND_COUNTERS[_0x129b('0x53')](function(_0x22560b){return this[_0x22560b]!==_0x18ffcf[_0x22560b];},this);}return _0x4543d9;};VoiceQueueSummary[_0x129b('0x47')][_0x129b('0x54')]=function(_0x17c311){var _0x647f99=![];var _0x241a27=![];var _0x357b3a=![];if(_0x17c311){_0x647f99=this[_0x129b('0x22')]!==_0x17c311['dialMethod']||this[_0x129b('0x21')]!==_0x17c311[_0x129b('0x21')]||this['message']!==_0x17c311[_0x129b('0x42')]||this['statusMessage']!==_0x17c311['statusMessage'];_0x241a27=OUTBOUND_COUNTERS['some'](function(_0x1ef884){return this[_0x1ef884]!==_0x17c311[_0x1ef884];},this);if(this[_0x129b('0x44')]&&_0x17c311[_0x129b('0x44')]){_0x357b3a=this[_0x129b('0x44')][_0x129b('0x12')]!==_0x17c311[_0x129b('0x44')][_0x129b('0x12')]||this[_0x129b('0x44')][_0x129b('0x45')]!==_0x17c311[_0x129b('0x44')][_0x129b('0x45')];}}return _0x647f99||_0x241a27||_0x357b3a;};VoiceQueueSummary['prototype'][_0x129b('0x55')]=function(_0xed7396){this['answered']=_0xed7396[_0x129b('0x6')];this['message']=_0xed7396['message'];this['statusMessage']=_0xed7396[_0x129b('0x43')];this['originated']=_0xed7396['originated'];this[_0x129b('0x56')]=_0xed7396['outboundAbandonedCallsDay'];this[_0x129b('0xa')]=_0xed7396[_0x129b('0xa')];this['outboundBlacklistCallsDay']=_0xed7396[_0x129b('0x29')];this['outboundBusyCallsDay']=_0xed7396[_0x129b('0xb')];this[_0x129b('0xc')]=_0xed7396[_0x129b('0xc')];this['outboundNoAnswerCallsDay']=_0xed7396[_0x129b('0x2d')];this[_0x129b('0x2e')]=_0xed7396[_0x129b('0x2e')];this[_0x129b('0xd')]=_0xed7396[_0x129b('0xd')];this['outboundRejectCallsDay']=_0xed7396['outboundRejectCallsDay'];this[_0x129b('0xe')]=_0xed7396[_0x129b('0xe')];this[_0x129b('0x10')]=_0xed7396[_0x129b('0x10')];this['sumDuration']=_0xed7396['sumDuration'];this[_0x129b('0x1b')]=_0xed7396[_0x129b('0x1b')];if(this[_0x129b('0x22')]===_0x129b('0x57')){this[_0x129b('0xf')]=_0xed7396[_0x129b('0xf')];}};module[_0x129b('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 351d59e..3c1bab5 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 _0x204b=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x2a99ea,_0x1bfb13){var _0x5887ae=function(_0x55dfc2){while(--_0x55dfc2){_0x2a99ea['push'](_0x2a99ea['shift']());}};_0x5887ae(++_0x1bfb13);}(_0x204b,0x81));var _0xb204=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x204b[_0x167cc1];return _0x10bc4b;};'use strict';function VtigerAccount(_0x506090){this['id']=_0x506090['id']||0x0;this['name']=_0x506090[_0xb204('0x0')]||'';this[_0xb204('0x1')]=_0x506090[_0xb204('0x1')]||'';this['accessKey']=_0x506090[_0xb204('0x2')]||'';this[_0xb204('0x3')]=_0x506090[_0xb204('0x3')]||'';this['serverUrl']=_0x506090[_0xb204('0x4')]||'';this[_0xb204('0x5')]=_0x506090[_0xb204('0x5')]||{};}module[_0xb204('0x6')]=VtigerAccount; \ No newline at end of file +var _0x7a1a=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3f477c,_0x52b7ff){var _0x4c36b3=function(_0x3b47bb){while(--_0x3b47bb){_0x3f477c['push'](_0x3f477c['shift']());}};_0x4c36b3(++_0x52b7ff);}(_0x7a1a,0x91));var _0xa7a1=function(_0xe73cf8,_0x35aa47){_0xe73cf8=_0xe73cf8-0x0;var _0x3d956f=_0x7a1a[_0xe73cf8];return _0x3d956f;};'use strict';function VtigerAccount(_0x312b37){this['id']=_0x312b37['id']||0x0;this[_0xa7a1('0x0')]=_0x312b37[_0xa7a1('0x0')]||'';this['username']=_0x312b37[_0xa7a1('0x1')]||'';this[_0xa7a1('0x2')]=_0x312b37['accessKey']||'';this[_0xa7a1('0x3')]=_0x312b37[_0xa7a1('0x3')]||'';this['serverUrl']=_0x312b37[_0xa7a1('0x4')]||'';this['Configurations']=_0x312b37[_0xa7a1('0x5')]||{};}module[_0xa7a1('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 13b1b23..614c8c1 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 _0x6e96=['type','serverUrl','Configurations','name','username','token','authType'];(function(_0x49c6cc,_0x308bdb){var _0x22e239=function(_0x48507d){while(--_0x48507d){_0x49c6cc['push'](_0x49c6cc['shift']());}};_0x22e239(++_0x308bdb);}(_0x6e96,0x199));var _0x66e9=function(_0x2b517f,_0x370ca5){_0x2b517f=_0x2b517f-0x0;var _0x292502=_0x6e96[_0x2b517f];return _0x292502;};'use strict';function ZendeskAccount(_0x59dc38){this['id']=_0x59dc38['id']||0x0;this[_0x66e9('0x0')]=_0x59dc38[_0x66e9('0x0')]||'';this[_0x66e9('0x1')]=_0x59dc38[_0x66e9('0x1')]||'';this['password']=_0x59dc38['password']||'';this[_0x66e9('0x2')]=_0x59dc38[_0x66e9('0x2')]||'';this['remoteUri']=_0x59dc38['remoteUri']||'';this['authType']=_0x59dc38[_0x66e9('0x3')]||'';this['type']=_0x59dc38[_0x66e9('0x4')]||'integrationTab';this[_0x66e9('0x5')]=_0x59dc38[_0x66e9('0x5')]||'';this[_0x66e9('0x6')]=_0x59dc38['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x4d7c=['password','token','authType','type','serverUrl','Configurations','exports','name','username'];(function(_0x4b0290,_0x188c34){var _0x4bd9f4=function(_0x357f3f){while(--_0x357f3f){_0x4b0290['push'](_0x4b0290['shift']());}};_0x4bd9f4(++_0x188c34);}(_0x4d7c,0x166));var _0xc4d7=function(_0x2509e8,_0x51edbd){_0x2509e8=_0x2509e8-0x0;var _0x573b76=_0x4d7c[_0x2509e8];return _0x573b76;};'use strict';function ZendeskAccount(_0x4d9574){this['id']=_0x4d9574['id']||0x0;this['name']=_0x4d9574[_0xc4d7('0x0')]||'';this[_0xc4d7('0x1')]=_0x4d9574[_0xc4d7('0x1')]||'';this['password']=_0x4d9574[_0xc4d7('0x2')]||'';this[_0xc4d7('0x3')]=_0x4d9574[_0xc4d7('0x3')]||'';this['remoteUri']=_0x4d9574['remoteUri']||'';this[_0xc4d7('0x4')]=_0x4d9574['authType']||'';this[_0xc4d7('0x5')]=_0x4d9574['type']||'integrationTab';this[_0xc4d7('0x6')]=_0x4d9574['serverUrl']||'';this[_0xc4d7('0x7')]=_0x4d9574[_0xc4d7('0x7')]||{};}module[_0xc4d7('0x8')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index fe3db14..12192c2 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 _0x09ae=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x4bb5c2,_0x4beafd){var _0x3cf57a=function(_0x1d7e63){while(--_0x1d7e63){_0x4bb5c2['push'](_0x4bb5c2['shift']());}};_0x3cf57a(++_0x4beafd);}(_0x09ae,0x10a));var _0xe09a=function(_0xd36a97,_0x41eb68){_0xd36a97=_0xd36a97-0x0;var _0x2a9784=_0x09ae[_0xd36a97];return _0x2a9784;};'use strict';function ZohoAccount(_0x5eaa15){this['id']=_0x5eaa15['id']||0x0;this['name']=_0x5eaa15[_0xe09a('0x0')]||'';this['description']=_0x5eaa15[_0xe09a('0x1')]||'';this[_0xe09a('0x2')]=_0x5eaa15[_0xe09a('0x2')]||'';this[_0xe09a('0x3')]=_0x5eaa15[_0xe09a('0x3')]||'';this[_0xe09a('0x4')]=_0x5eaa15[_0xe09a('0x4')]||'';this[_0xe09a('0x5')]=_0x5eaa15[_0xe09a('0x5')]||'';this[_0xe09a('0x6')]=_0x5eaa15['serverUrl']||'';this[_0xe09a('0x7')]=_0x5eaa15[_0xe09a('0x7')]||'';this[_0xe09a('0x8')]=_0x5eaa15[_0xe09a('0x8')]||'';this[_0xe09a('0x9')]=_0x5eaa15[_0xe09a('0x9')]||{};}module[_0xe09a('0xa')]=ZohoAccount; \ No newline at end of file +var _0xd6f2=['refreshToken','exports','name','description','zone','clientId','clientSecret','serverUrl','code'];(function(_0x4ac60a,_0x503a99){var _0x4b22e8=function(_0x145c47){while(--_0x145c47){_0x4ac60a['push'](_0x4ac60a['shift']());}};_0x4b22e8(++_0x503a99);}(_0xd6f2,0x158));var _0x2d6f=function(_0xf0c8ce,_0x21be52){_0xf0c8ce=_0xf0c8ce-0x0;var _0x3e0415=_0xd6f2[_0xf0c8ce];return _0x3e0415;};'use strict';function ZohoAccount(_0x1c6da5){this['id']=_0x1c6da5['id']||0x0;this[_0x2d6f('0x0')]=_0x1c6da5[_0x2d6f('0x0')]||'';this['description']=_0x1c6da5[_0x2d6f('0x1')]||'';this['host']=_0x1c6da5['host']||'';this[_0x2d6f('0x2')]=_0x1c6da5[_0x2d6f('0x2')]||'';this[_0x2d6f('0x3')]=_0x1c6da5[_0x2d6f('0x3')]||'';this[_0x2d6f('0x4')]=_0x1c6da5[_0x2d6f('0x4')]||'';this[_0x2d6f('0x5')]=_0x1c6da5[_0x2d6f('0x5')]||'';this[_0x2d6f('0x6')]=_0x1c6da5[_0x2d6f('0x6')]||'';this[_0x2d6f('0x7')]=_0x1c6da5['refreshToken']||'';this['Configurations']=_0x1c6da5['Configurations']||{};}module[_0x2d6f('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 25c7005..0176b60 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 _0x32b6=['membername','Agent','channelAgent','format','SIP/%s','calleridname','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','isNil','string','uniqueid','queue','name','type'];(function(_0x5b774f,_0x59d0bd){var _0x32dc18=function(_0x3eadb5){while(--_0x3eadb5){_0x5b774f['push'](_0x5b774f['shift']());}};_0x32dc18(++_0x59d0bd);}(_0x32b6,0x1d1));var _0x632b=function(_0x20a6ec,_0x234271){_0x20a6ec=_0x20a6ec-0x0;var _0x4d0794=_0x32b6[_0x20a6ec];return _0x4d0794;};'use strict';var util=require(_0x632b('0x0'));var _=require(_0x632b('0x1'));var moment=require('moment');function checkNameSurname(_0x1f0635,_0x1d100a,_0x51c210){var _0x5ad871='';if(!_[_0x632b('0x2')](_0x1d100a)&&_0x632b('0x3')===typeof _0x1d100a){_0x5ad871+=_0x1d100a;}if(!_[_0x632b('0x2')](_0x51c210)&&_0x632b('0x3')===typeof _0x51c210){_0x5ad871+='\x20'+_0x51c210;}if(_0x5ad871!==''){return _0x5ad871;}return _0x1f0635;}function Action(_0x1adfe6,_0x122768,_0x24ceab,_0x10458a,_0x3bbf43){this[_0x632b('0x4')]=_0x24ceab||undefined;this['idContact']=_0x1adfe6['id'];this[_0x632b('0x5')]=_0x122768[_0x632b('0x6')];this[_0x632b('0x7')]=_0x122768[_0x632b('0x7')];this['campaigntype']='queue';this['dialAnswer']=![];this[_0x632b('0x8')]=_['isNil'](_0x1adfe6[_0x632b('0x9')])?undefined:_0x1adfe6[_0x632b('0x9')][_0x632b('0x6')];this[_0x632b('0xa')]=this[_0x632b('0x8')]?util[_0x632b('0xb')](_0x632b('0xc'),this[_0x632b('0x8')]):_0x10458a||undefined;this[_0x632b('0xd')]=checkNameSurname(_0x1adfe6['Contact'][_0x632b('0xe')],_0x1adfe6[_0x632b('0xf')][_0x632b('0x10')],_0x1adfe6['Contact'][_0x632b('0x11')]);this[_0x632b('0x12')]=_0x1adfe6[_0x632b('0x12')]||![];this[_0x632b('0x13')]=_0x1adfe6[_0x632b('0xe')];this[_0x632b('0x14')]=_0x1adfe6['scheduledat'];this[_0x632b('0x15')]=_0x1adfe6['countbusyretry']||0x0;this['countcongestionretry']=_0x1adfe6[_0x632b('0x16')]||0x0;this['countnoanswerretry']=_0x1adfe6[_0x632b('0x17')]||0x0;this[_0x632b('0x18')]=(_0x1adfe6[_0x632b('0x15')]||0x0)+(_0x1adfe6['countcongestionretry']||0x0)+(_0x1adfe6[_0x632b('0x17')]||0x0)+(_0x1adfe6[_0x632b('0x19')]||0x0)+(_0x1adfe6[_0x632b('0x1a')]||0x0)+(_0x1adfe6[_0x632b('0x1b')]||0x0)+(_0x1adfe6['countmachineretry']||0x0)+(_0x1adfe6[_0x632b('0x1c')]||0x0);this[_0x632b('0x19')]=_0x1adfe6['countnosuchnumberretry']||0x0;this[_0x632b('0x1a')]=_0x1adfe6['countdropretry']||0x0;this['countabandonedretry']=_0x1adfe6[_0x632b('0x1b')]||0x0;this['countmachineretry']=_0x1adfe6[_0x632b('0x1d')]||0x0;this[_0x632b('0x1c')]=_0x1adfe6[_0x632b('0x1c')]||0x0;this['callback']=_0x1adfe6[_0x632b('0x1e')];this[_0x632b('0x1f')]=_0x1adfe6['callbackuniqueid'];this[_0x632b('0x20')]=_0x1adfe6[_0x632b('0x20')];this[_0x632b('0x21')]=_0x1adfe6[_0x632b('0x21')];this[_0x632b('0x22')]=_0x1adfe6[_0x632b('0x22')];this['ListId']=_0x1adfe6['ListId'];this[_0x632b('0x23')]=_['isNil'](_0x1adfe6[_0x632b('0x9')])?_0x1adfe6[_0x632b('0x23')]:_0x1adfe6['Agent']['id'];this[_0x632b('0x24')]=_0x1adfe6[_0x632b('0x24')];this[_0x632b('0x25')]='';this[_0x632b('0x26')]='';}Action[_0x632b('0x27')][_0x632b('0x28')]=function(){return util[_0x632b('0xb')](_0x632b('0x29'),this[_0x632b('0xd')],this['number']);};module[_0x632b('0x2a')]=Action; \ No newline at end of file +var _0x5430=['ContactId','ListId','UserId','isNil','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','util','lodash','moment','string','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','lastName','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','callback','callbackuniqueid','recallme'];(function(_0x3e29e2,_0x49e053){var _0x4f6922=function(_0x3256e){while(--_0x3256e){_0x3e29e2['push'](_0x3e29e2['shift']());}};_0x4f6922(++_0x49e053);}(_0x5430,0x10c));var _0x0543=function(_0x689526,_0x219e9b){_0x689526=_0x689526-0x0;var _0x2343e6=_0x5430[_0x689526];return _0x2343e6;};'use strict';var util=require(_0x0543('0x0'));var _=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));function checkNameSurname(_0x4078bf,_0x114bf2,_0x3b93d7){var _0x5518f8='';if(!_['isNil'](_0x114bf2)&&_0x0543('0x3')===typeof _0x114bf2){_0x5518f8+=_0x114bf2;}if(!_['isNil'](_0x3b93d7)&&'string'===typeof _0x3b93d7){_0x5518f8+='\x20'+_0x3b93d7;}if(_0x5518f8!==''){return _0x5518f8;}return _0x4078bf;}function Action(_0xce0b65,_0x45b909,_0x9754ba,_0x319568,_0x46bca7){this['uniqueid']=_0x9754ba||undefined;this[_0x0543('0x4')]=_0xce0b65['id'];this[_0x0543('0x5')]=_0x45b909[_0x0543('0x6')];this[_0x0543('0x7')]=_0x45b909[_0x0543('0x7')];this[_0x0543('0x8')]='queue';this[_0x0543('0x9')]=![];this[_0x0543('0xa')]=_['isNil'](_0xce0b65[_0x0543('0xb')])?undefined:_0xce0b65[_0x0543('0xb')][_0x0543('0x6')];this[_0x0543('0xc')]=this[_0x0543('0xa')]?util[_0x0543('0xd')](_0x0543('0xe'),this[_0x0543('0xa')]):_0x319568||undefined;this[_0x0543('0xf')]=checkNameSurname(_0xce0b65[_0x0543('0x10')][_0x0543('0x11')],_0xce0b65[_0x0543('0x10')]['firstName'],_0xce0b65[_0x0543('0x10')][_0x0543('0x12')]);this['active']=_0xce0b65['active']||![];this[_0x0543('0x13')]=_0xce0b65[_0x0543('0x11')];this[_0x0543('0x14')]=_0xce0b65[_0x0543('0x14')];this[_0x0543('0x15')]=_0xce0b65['countbusyretry']||0x0;this[_0x0543('0x16')]=_0xce0b65[_0x0543('0x16')]||0x0;this[_0x0543('0x17')]=_0xce0b65[_0x0543('0x17')]||0x0;this[_0x0543('0x18')]=(_0xce0b65[_0x0543('0x15')]||0x0)+(_0xce0b65[_0x0543('0x16')]||0x0)+(_0xce0b65['countnoanswerretry']||0x0)+(_0xce0b65[_0x0543('0x19')]||0x0)+(_0xce0b65['countdropretry']||0x0)+(_0xce0b65['countabandonedretry']||0x0)+(_0xce0b65[_0x0543('0x1a')]||0x0)+(_0xce0b65[_0x0543('0x1b')]||0x0);this[_0x0543('0x19')]=_0xce0b65['countnosuchnumberretry']||0x0;this[_0x0543('0x1c')]=_0xce0b65['countdropretry']||0x0;this[_0x0543('0x1d')]=_0xce0b65[_0x0543('0x1d')]||0x0;this['countmachineretry']=_0xce0b65[_0x0543('0x1a')]||0x0;this[_0x0543('0x1b')]=_0xce0b65[_0x0543('0x1b')]||0x0;this[_0x0543('0x1e')]=_0xce0b65[_0x0543('0x1e')];this[_0x0543('0x1f')]=_0xce0b65['callbackuniqueid'];this['callbackat']=_0xce0b65['callbackat'];this[_0x0543('0x20')]=_0xce0b65[_0x0543('0x20')];this[_0x0543('0x21')]=_0xce0b65[_0x0543('0x21')];this[_0x0543('0x22')]=_0xce0b65[_0x0543('0x22')];this[_0x0543('0x23')]=_[_0x0543('0x24')](_0xce0b65[_0x0543('0xb')])?_0xce0b65[_0x0543('0x23')]:_0xce0b65[_0x0543('0xb')]['id'];this[_0x0543('0x25')]=_0xce0b65['VoiceQueueId'];this[_0x0543('0x26')]='';this[_0x0543('0x27')]='';}Action[_0x0543('0x28')]['getCaller']=function(){return util[_0x0543('0xd')](_0x0543('0x29'),this[_0x0543('0xf')],this[_0x0543('0x2a')]);};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 626b62c..14a3441 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(_0x5ca779,_0x415a01){var _0xc0891a=function(_0x5abbe8){while(--_0x5abbe8){_0x5ca779['push'](_0x5ca779['shift']());}};_0xc0891a(++_0x415a01);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0x136958,_0x466927){var _0xf80397=function(_0x3fd217){while(--_0x3fd217){_0x136958['push'](_0x136958['shift']());}};_0xf80397(++_0x466927);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var 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 453a9a2..9af0914 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 _0x4b4d=['../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','[createHistory]\x20','resolve','then','catch','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird'];(function(_0x3ba748,_0x4b8fb9){var _0x5b04e2=function(_0x16bb9e){while(--_0x16bb9e){_0x3ba748['push'](_0x3ba748['shift']());}};_0x5b04e2(++_0x4b8fb9);}(_0x4b4d,0x94));var _0xd4b4=function(_0x7f32ad,_0xb2990f){_0x7f32ad=_0x7f32ad-0x0;var _0x51e555=_0x4b4d[_0x7f32ad];return _0x51e555;};'use strict';var util=require(_0xd4b4('0x0'));var BPromise=require(_0xd4b4('0x1'));var logger=require('../../../config/logger')('preview');var cmHopper=require(_0xd4b4('0x2'));var cmHopperHistory=require(_0xd4b4('0x3'));var cmHopperBlack=require(_0xd4b4('0x4'));var agentReportPreview=require(_0xd4b4('0x5'));var voiceQueueReport=require(_0xd4b4('0x6'));function loggerCatch(_0x3d2ea7){return function(_0x447369){logger[_0xd4b4('0x7')](_0x3d2ea7,util[_0xd4b4('0x8')](_0x447369,{'showHidden':![],'depth':null}));};}function create(_0x1f375e){return cmHopperHistory[_0xd4b4('0x9')](_0x1f375e)['catch'](loggerCatch(_0xd4b4('0xa')));}function createAgent(_0x5892fd){return BPromise[_0xd4b4('0xb')]()[_0xd4b4('0xc')](agentReportPreview[_0xd4b4('0x9')](_0x5892fd))[_0xd4b4('0xd')](loggerCatch('[createHistory]\x20'));}function moveContact(_0xa21f28){return cmHopper[_0xd4b4('0xe')](_0xa21f28,!![])[_0xd4b4('0xd')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xd4b4('0xf')]=function(_0x3fef84){return cmHopperBlack[_0xd4b4('0xf')](_0x3fef84)[_0xd4b4('0xd')](loggerCatch(_0xd4b4('0x10')));};exports[_0xd4b4('0x11')]=function(_0x374316){return BPromise[_0xd4b4('0xb')]()[_0xd4b4('0xc')](cmHopper[_0xd4b4('0x11')](_0x374316))[_0xd4b4('0xd')](loggerCatch(_0xd4b4('0x12')));};exports[_0xd4b4('0x9')]=function(_0x4d0333,_0x17117){create(_0x4d0333)[_0xd4b4('0xd')](loggerCatch(_0x17117));moveContact(_0x4d0333)[_0xd4b4('0xd')](loggerCatch(_0x17117));};exports[_0xd4b4('0x13')]=function(_0x2c5f5e,_0x377c7a){createAgent(_0x2c5f5e)['catch'](loggerCatch(_0x377c7a));};exports['createCustomerHistory']=function(_0x550d98,_0x7caca7){create(_0x550d98)['catch'](loggerCatch(_0x7caca7));};exports[_0xd4b4('0x14')]=function(_0x61941b,_0x496e73){moveContact(_0x61941b)[_0xd4b4('0xd')](loggerCatch(_0x496e73));};exports[_0xd4b4('0x15')]=function(_0x9eb0f3,_0x16a0af,_0x2cfac7){if(_0x16a0af){_0x9eb0f3[_0xd4b4('0x16')]=null;}if(_0x2cfac7){_0x9eb0f3[_0xd4b4('0x17')]=![];}return cmHopper[_0xd4b4('0x15')](_0x9eb0f3)[_0xd4b4('0xd')](loggerCatch(_0xd4b4('0x18')));};exports[_0xd4b4('0x19')]=function(_0x3a4ead){return cmHopper['countReScheduled'](_0x3a4ead)[_0xd4b4('0xd')](loggerCatch(_0xd4b4('0x1a')));};exports[_0xd4b4('0x1b')]=function(_0x39f8ac){return cmHopper[_0xd4b4('0x1b')]({'UserId':null},_0x39f8ac,0x1)[_0xd4b4('0xd')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x87745f){return cmHopper['unlockContact']({'active':![]},_0x87745f,0x1)[_0xd4b4('0xd')](loggerCatch(_0xd4b4('0x1c')));};exports[_0xd4b4('0x1d')]=function(_0xbba2d){var _0x1e64ff={};_0x1e64ff[_0xd4b4('0x1e')]=_0xbba2d[_0xd4b4('0x1e')];_0x1e64ff[_0xd4b4('0x1f')]=_0xbba2d['uniqueid'];_0x1e64ff[_0xd4b4('0x20')]=_0xbba2d[_0xd4b4('0x20')];_0x1e64ff[_0xd4b4('0x21')]=_0xbba2d[_0xd4b4('0x21')];_0x1e64ff[_0xd4b4('0x22')]=_0xbba2d[_0xd4b4('0x22')];_0x1e64ff['queuecallerjoinAt']=_0xbba2d[_0xd4b4('0x23')];_0x1e64ff['queuecallerleaveAt']=_0xbba2d[_0xd4b4('0x23')];_0x1e64ff[_0xd4b4('0x24')]=0x1;_0x1e64ff[_0xd4b4('0x25')]=_0xbba2d[_0xd4b4('0x26')];_0x1e64ff[_0xd4b4('0x27')]=_0xbba2d[_0xd4b4('0x28')];_0x1e64ff['context']=_0xd4b4('0x29');_0x1e64ff['exten']=_0xd4b4('0x2a');_0x1e64ff[_0xd4b4('0x2b')]=0x0;_0x1e64ff[_0xd4b4('0x2c')]=0x1;_0x1e64ff[_0xd4b4('0x2d')]=_0xbba2d[_0xd4b4('0x28')];_0x1e64ff[_0xd4b4('0x2e')]='COMPLETED';return BPromise[_0xd4b4('0xb')]()[_0xd4b4('0xc')](voiceQueueReport[_0xd4b4('0x2f')](_0x1e64ff))[_0xd4b4('0xd')](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x2f3d77,_0x3dffd6){return BPromise[_0xd4b4('0xb')]()[_0xd4b4('0xc')](cmHopper['getContactRecallMe'](_0x2f3d77,_0x3dffd6))[_0xd4b4('0xd')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xd4b4('0x30')]=function(_0x424cbd){return cmHopper['rescheduleContact'](_0x424cbd,!![],!![])['catch'](loggerCatch(_0xd4b4('0x31')));}; \ No newline at end of file +var _0xed4e=['../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','../rpc/cmHopper'];(function(_0x3380b9,_0x2d3ec4){var _0x298259=function(_0x3a1100){while(--_0x3a1100){_0x3380b9['push'](_0x3380b9['shift']());}};_0x298259(++_0x2d3ec4);}(_0xed4e,0x1eb));var _0xeed4=function(_0x1fcc83,_0x409046){_0x1fcc83=_0x1fcc83-0x0;var _0x50d407=_0xed4e[_0x1fcc83];return _0x50d407;};'use strict';var util=require('util');var BPromise=require(_0xeed4('0x0'));var logger=require(_0xeed4('0x1'))(_0xeed4('0x2'));var cmHopper=require(_0xeed4('0x3'));var cmHopperHistory=require(_0xeed4('0x4'));var cmHopperBlack=require(_0xeed4('0x5'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xeed4('0x6'));function loggerCatch(_0x3cd5cf){return function(_0x45071c){logger[_0xeed4('0x7')](_0x3cd5cf,util[_0xeed4('0x8')](_0x45071c,{'showHidden':![],'depth':null}));};}function create(_0x130043){return cmHopperHistory[_0xeed4('0x9')](_0x130043)[_0xeed4('0xa')](loggerCatch(_0xeed4('0xb')));}function createAgent(_0x1d7d99){return BPromise[_0xeed4('0xc')]()[_0xeed4('0xd')](agentReportPreview[_0xeed4('0x9')](_0x1d7d99))[_0xeed4('0xa')](loggerCatch(_0xeed4('0xb')));}function moveContact(_0x46439f){return cmHopper[_0xeed4('0xe')](_0x46439f,!![])[_0xeed4('0xa')](loggerCatch(_0xeed4('0xf')));}exports[_0xeed4('0x10')]=function(_0x2464fb){return cmHopperBlack[_0xeed4('0x10')](_0x2464fb)[_0xeed4('0xa')](loggerCatch(_0xeed4('0x11')));};exports['getContactPreview']=function(_0x51777a){return BPromise[_0xeed4('0xc')]()[_0xeed4('0xd')](cmHopper[_0xeed4('0x12')](_0x51777a))[_0xeed4('0xa')](loggerCatch(_0xeed4('0x13')));};exports[_0xeed4('0x9')]=function(_0x2e97d3,_0x261803){create(_0x2e97d3)[_0xeed4('0xa')](loggerCatch(_0x261803));moveContact(_0x2e97d3)[_0xeed4('0xa')](loggerCatch(_0x261803));};exports[_0xeed4('0x14')]=function(_0x2914af,_0x138ab0){createAgent(_0x2914af)[_0xeed4('0xa')](loggerCatch(_0x138ab0));};exports[_0xeed4('0x15')]=function(_0x58200a,_0x26718c){create(_0x58200a)[_0xeed4('0xa')](loggerCatch(_0x26718c));};exports[_0xeed4('0x16')]=function(_0x3a7e1d,_0x2fcb11){moveContact(_0x3a7e1d)[_0xeed4('0xa')](loggerCatch(_0x2fcb11));};exports[_0xeed4('0x17')]=function(_0xcfcb6c,_0x6f6c9a,_0xc0f7d){if(_0x6f6c9a){_0xcfcb6c[_0xeed4('0x18')]=null;}if(_0xc0f7d){_0xcfcb6c['active']=![];}return cmHopper[_0xeed4('0x17')](_0xcfcb6c)[_0xeed4('0xa')](loggerCatch(_0xeed4('0x19')));};exports['countReScheduled']=function(_0x5202eb){return cmHopper['countReScheduled'](_0x5202eb)[_0xeed4('0xa')](loggerCatch(_0xeed4('0x1a')));};exports[_0xeed4('0x1b')]=function(_0xaedb33){return cmHopper['unlockContact']({'UserId':null},_0xaedb33,0x1)[_0xeed4('0xa')](loggerCatch(_0xeed4('0x1c')));};exports[_0xeed4('0x1d')]=function(_0x33fce9){return cmHopper[_0xeed4('0x1b')]({'active':![]},_0x33fce9,0x1)[_0xeed4('0xa')](loggerCatch(_0xeed4('0x1e')));};exports[_0xeed4('0x1f')]=function(_0xac83de){var _0x575ad4={};_0x575ad4['type']=_0xac83de['type'];_0x575ad4[_0xeed4('0x20')]=_0xac83de[_0xeed4('0x20')];_0x575ad4['calleridnum']=_0xac83de[_0xeed4('0x21')];_0x575ad4[_0xeed4('0x22')]=_0xac83de['calleridname'];_0x575ad4['queue']=_0xac83de[_0xeed4('0x23')];_0x575ad4['queuecallerjoinAt']=_0xac83de['answertime'];_0x575ad4[_0xeed4('0x24')]=_0xac83de[_0xeed4('0x25')];_0x575ad4[_0xeed4('0x26')]=0x1;_0x575ad4[_0xeed4('0x27')]=_0xac83de[_0xeed4('0x28')];_0x575ad4[_0xeed4('0x29')]=_0xac83de[_0xeed4('0x2a')];_0x575ad4[_0xeed4('0x2b')]='from-sip';_0x575ad4[_0xeed4('0x2c')]=_0xeed4('0x2d');_0x575ad4[_0xeed4('0x2e')]=0x0;_0x575ad4[_0xeed4('0x2f')]=0x1;_0x575ad4[_0xeed4('0x30')]=_0xac83de[_0xeed4('0x2a')];_0x575ad4[_0xeed4('0x31')]='COMPLETED';return BPromise['resolve']()[_0xeed4('0xd')](voiceQueueReport['create'](_0x575ad4))['catch'](loggerCatch(_0xeed4('0x32')));};exports[_0xeed4('0x33')]=function(_0x3def79,_0x3f2f71){return BPromise[_0xeed4('0xc')]()['then'](cmHopper[_0xeed4('0x33')](_0x3def79,_0x3f2f71))[_0xeed4('0xa')](loggerCatch(_0xeed4('0x34')));};exports[_0xeed4('0x35')]=function(_0x5a246f){return cmHopper[_0xeed4('0x17')](_0x5a246f,!![],!![])[_0xeed4('0xa')](loggerCatch(_0xeed4('0x36')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 5509487..c64a7d4 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 _0xa78b=['channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','scheduledat','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','interface','motionChannel','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','push','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','active','countglobal','callback','callbackuniqueid','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','\x5cw{0,','pow','replace','random','extractCalleridName','match','variables','keys','forEach','buildNoAnswerEventPayload','lodash','moment','env','127.0.0.1','../../dialer/utils','loggerCatch','inspect','loggerError','info','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','addVariables','Queue','name','calleridname','calleridnum','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','updateOriginated','isNil','hasOwnProperty','originated','error','YYYY-MM-DD\x20HH:mm:ss','statedesc','starttime','responsetime','endtime','logAgent','ringtime','getSeconds','logLookAgent','membername','state','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa78b,0x1de));var _0xba78=function(_0xa2db7,_0x1bd5f0){_0xa2db7=_0xa2db7-0x0;var _0x59c5f9=_0xa78b[_0xa2db7];return _0x59c5f9;};'use strict';var util=require('util');var _=require(_0xba78('0x0'));var moment=require(_0xba78('0x1'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0xba78('0x2')]['XCALLY_IP_AGI']||_0xba78('0x3');var utils=require(_0xba78('0x4'));exports[_0xba78('0x5')]=function(_0x5275a7){return function(_0x3f2c29){logger['error'](_0x5275a7,util[_0xba78('0x6')](_0x3f2c29,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x2711f1,_0x19c771){logger['info'](_0x2711f1,util[_0xba78('0x6')](_0x19c771,{'showHidden':![],'depth':null}));};exports[_0xba78('0x7')]=function(_0x156f68,_0x5bb988){logger['error'](_0x156f68,util['inspect'](_0x5bb988,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x2afbf3){return function(_0x265db7){logger[_0xba78('0x8')](_0x2afbf3,util[_0xba78('0x6')](_0x265db7,{'showHidden':![],'depth':null}));};};exports[_0xba78('0x9')]=function(_0x53fce3,_0x41849b,_0x5e42bc){return{'message':_0x53fce3,'unlock':_0x41849b,'active':_0x5e42bc};};exports[_0xba78('0xa')]=function(_0x2d9877,_0x28386e,_0x453105){if(!_[_0xba78('0xb')](_0x453105)&&'string'===typeof _0x453105&&!_['isEmpty'](_0x453105)){if(!_[_0xba78('0xb')](_0x28386e)&&_0xba78('0xc')===typeof _0x28386e&&!_[_0xba78('0xd')](_0x28386e)){return util['format'](_0xba78('0xe'),_0x28386e,_0x453105);}return util[_0xba78('0xf')](_0xba78('0xe'),_0x453105,_0x453105);}if(!_['isUndefined'](_0x2d9877)&&'string'===typeof _0x2d9877&&!_['isEmpty'](_0x2d9877)){return _0x2d9877;}return _0xba78('0x10');};exports['isActive']=function(_0x53b803){if(_['isNil'](_0x53b803)){return![];}return _0x53b803;};exports[_0xba78('0x11')]=function(_0x338a1c,_0x812a7e,_0x3487a6,_0xb2ff76,_0x107b80,_0x4c3e55){var _0x4ba780={'XMD-QUEUE':_0x812a7e[_0xba78('0x12')]?_0x812a7e['Queue'][_0xba78('0x13')]:'','XMD-CALLERID':_0xb2ff76,'XMD-CALLERID-PREVIEW':_0x4c3e55?util['format']('\x22%s\x22\x20<%s>',_0x4c3e55[_0xba78('0x14')],_0x4c3e55[_0xba78('0x15')]):_0xb2ff76,'XMD-DIALID':_0x107b80,'XMD-CONTACTID':_0x812a7e['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0xb2ff76,'XMD-VOICEQUEUEID':_0x812a7e[_0xba78('0x16')],'XMD-DIALCHANNEL':_0x3487a6,'XMD-DIALTIMEOUT':_0x338a1c[_0xba78('0x17')]||0x1e,'XMD-DIALOPTIONS':util[_0xba78('0xf')](_0xba78('0x18'),_0x338a1c['dialQueueProject2']?'g':'',_['isEmpty'](_0x338a1c['monitor_format'])?'':_0xba78('0x19')),'XMD-DIALURL':_0x338a1c[_0xba78('0x1a')]||'','XMD-AGI':_0x338a1c[_0xba78('0x1b')]?util[_0xba78('0xf')](_0xba78('0x1c'),ipAgi,_0x338a1c['dialQueueProject']):_0xba78('0x1d'),'XMD-AGIAFTER':_0x338a1c[_0xba78('0x1e')]?util['format'](_0xba78('0x1c'),ipAgi,_0x338a1c[_0xba78('0x1e')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x4c3e55?_0x4c3e55[_0xba78('0x1f')]:'','XMD-ORIGINATECALLERIDNAME':_0x4c3e55?_0x4c3e55[_0xba78('0x20')]:'','XMD-DESTINATION':_0xba78('0x21'),'SIPADDHEADER':_0xba78('0x22')};if(!_[_0xba78('0xd')](_0x338a1c[_0xba78('0x23')])){_0x4ba780[util[_0xba78('0xf')]('%s',_0xba78('0x24'))]=_0x338a1c[_0xba78('0x23')];_0x4ba780[util[_0xba78('0xf')]('%s',_0xba78('0x25'))]=_0x107b80;}return _0x4ba780;};exports[_0xba78('0x26')]=function(_0x160154){var _0x3e8e46={};for(var _0x31c3f8 in _0x160154){if(_0x160154['hasOwnProperty'](_0x31c3f8)){_0x3e8e46[util[_0xba78('0xf')]('%s',_['toLower'](_0x31c3f8))]=_0x160154[_0x31c3f8];}}return{'variables':_0x3e8e46};};exports[_0xba78('0x27')]=function(_0x58e343,_0x44cb3a){if(!_[_0xba78('0x28')](_0x58e343)){if(_0x58e343[_0xba78('0x29')](_0xba78('0x2a'))){if(_0x58e343[_0xba78('0x2a')]>0x0){_0x58e343[_0xba78('0x2a')]-=0x1;}else{logger[_0xba78('0x2b')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x44cb3a);}}}else{logger[_0xba78('0x2b')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x44cb3a);}};exports['logBlacklist']=function(_0x5c5a51){var _0x282ca6=moment()[_0xba78('0xf')](_0xba78('0x2c'));_0x5c5a51['state']=0xd;_0x5c5a51[_0xba78('0x2d')]='Blacklist';_0x5c5a51[_0xba78('0x2e')]=_0x282ca6;_0x5c5a51[_0xba78('0x2f')]=_0x282ca6;_0x5c5a51[_0xba78('0x30')]=_0x282ca6;};exports[_0xba78('0x31')]=function(_0x10ecbf,_0x79e889,_0x123539){var _0x1ecb32=moment()[_0xba78('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x10ecbf['state']=_0x79e889;_0x10ecbf['statedesc']=_0x123539;_0x10ecbf[_0xba78('0x2f')]=_0x1ecb32;_0x10ecbf[_0xba78('0x32')]=utils[_0xba78('0x33')](_0x10ecbf['responsetime'],_0x10ecbf[_0xba78('0x2e')]);};exports[_0xba78('0x34')]=function(_0x11162b,_0x30b2ed,_0x2de165){_0x11162b[_0xba78('0x35')]=_0x30b2ed;_0x11162b['UserId']=_0x2de165;};exports['logCustomer']=function(_0x17d46a,_0x24b4b0,_0x319c31){var _0x319342=moment()[_0xba78('0xf')](_0xba78('0x2c'));_0x17d46a[_0xba78('0x36')]=_0x24b4b0;_0x17d46a[_0xba78('0x2d')]=_0x319c31;_0x17d46a[_0xba78('0x2f')]=_0x17d46a[_0xba78('0x2f')]?_0x17d46a[_0xba78('0x2f')]:_0x319342;_0x17d46a[_0xba78('0x30')]=_0x17d46a[_0xba78('0x30')]?_0x17d46a[_0xba78('0x30')]:_0x319342;_0x17d46a[_0xba78('0x32')]=utils[_0xba78('0x33')](_0x17d46a[_0xba78('0x2f')]||0x0,_0x17d46a[_0xba78('0x2e')]||0x0);_0x17d46a[_0xba78('0x37')]=_0x17d46a[_0xba78('0x38')]?utils['getSeconds'](_0x17d46a[_0xba78('0x30')],_0x17d46a[_0xba78('0x38')]):0x0;};exports['isFailure']=function(_0x23aafc){return _0x23aafc===_0xba78('0x39');};exports[_0xba78('0x3a')]=function(_0x2c1844,_0x49939a,_0x35251a,_0x965f03,_0x579be3){var _0x1604c9=_0x965f03?_0xba78('0x3b'):_0x2c1844['calleridname'];_0x1604c9=_0x579be3?_0xba78('0x3c'):_0x1604c9;return{'actionid':_0x2c1844[_0xba78('0x3d')],'action':'originate','channel':_0x2c1844[_0xba78('0x3e')],'callerid':util['format'](_0xba78('0xe'),_0x1604c9,_0x2c1844[_0xba78('0x15')]),'Exten':_0xba78('0x21'),'Context':_0xba78('0x3f'),'Priority':'1','variable':_0x35251a,'timeout':(_0x49939a[_0xba78('0x40')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2c1844['uniqueid']};};exports[_0xba78('0x41')]=function(_0x2ff760){return _0x2ff760[_0xba78('0x42')]+_0x2ff760[_0xba78('0x43')]+_0x2ff760[_0xba78('0x44')]+_0x2ff760[_0xba78('0x45')]+_0x2ff760[_0xba78('0x46')];};exports[_0xba78('0x47')]=function(_0x4ffab5){var _0x2fee0f=_[_0xba78('0x48')](_0x4ffab5);_0x2fee0f['state']=0xf;_0x2fee0f[_0xba78('0x2d')]=_0xba78('0x49');return _0x2fee0f;};exports[_0xba78('0x4a')]=function(_0x426699,_0x34940e,_0x4a11a2){var _0x3927a3={};_0x3927a3[_0x34940e]=_0x426699[_0x34940e];_0x3927a3['active']=![];_0x3927a3[_0xba78('0x4b')]=moment()['add'](_0x4a11a2,'minutes')[_0xba78('0xf')](_0xba78('0x2c'));_0x3927a3[_0xba78('0x4c')]=_0x426699[_0xba78('0x4c')];_0x3927a3[_0xba78('0x4d')]=_0x426699[_0xba78('0x4d')];_0x3927a3[_0xba78('0x16')]=_0x426699['VoiceQueueId']||undefined;return _0x3927a3;};exports[_0xba78('0x4e')]=function(_0x3c0c00,_0x39f409){if(!_['isNil'](_0x3c0c00)){if(_0x3c0c00[_0xba78('0x4f')]>0x0){_0x3c0c00[_0xba78('0x4f')]-=0x1;}else{logger[_0xba78('0x2b')](_0x39f409,_0xba78('0x50'));}}else{logger[_0xba78('0x2b')](_0x39f409,_0xba78('0x51'));}};exports['IsNotLoggedIn']=function(_0x47fa09){if(_0x47fa09<=0x0){return!![];}return![];};function buildObj(_0x282b9c,_0x3ef1ff,_0x224c01){_0x282b9c[_0xba78('0x52')]=_0x3ef1ff;_0x282b9c[_0xba78('0x13')]=_0x282b9c['queue'];_0x282b9c[_0xba78('0x53')]=_0x282b9c['channelAgent'];_0x282b9c[_0xba78('0x54')]='voice';if(_0x224c01){_0x282b9c['mandatoryDisposition']=_0x224c01[_0xba78('0x55')];}return _0x282b9c;}exports[_0xba78('0x56')]=buildObj;exports[_0xba78('0x57')]=function(_0x2bcb2a){var _0x448042=[];for(var _0x23b61d in _0x2bcb2a){if(_0x2bcb2a['hasOwnProperty'](_0x23b61d)){if(!_['isNil'](_0x2bcb2a[_0x23b61d])&&_0x2bcb2a[_0x23b61d]['state']===_0xba78('0x58')&&_0x2bcb2a[_0x23b61d][_0xba78('0x59')]===_0xba78('0x5a')){_0x448042[_0xba78('0x5b')](_0x2bcb2a[_0x23b61d]['id']);}}}return _0x448042;};exports['getDiff']=function(_0x370378){var _0x39d3f9=moment()[_0xba78('0x5c')](0x0);var _0x434453=moment(_0x370378)[_0xba78('0x5c')](0x0);return _0x39d3f9[_0xba78('0x5d')](_0x434453,_0xba78('0x5e'));};exports[_0xba78('0x5f')]=function(_0x4fc7b8){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4fc7b8[_0xba78('0x4c')],'ListId':_0x4fc7b8[_0xba78('0x4d')],'VoiceQueueId':_0x4fc7b8[_0xba78('0x16')]||undefined,'CampaignId':_0x4fc7b8[_0xba78('0x60')]||undefined};};exports[_0xba78('0x61')]=function(_0xab1d83){if(_0xab1d83===_0xba78('0x3d')||_0xab1d83===_0xba78('0x62')||_0xab1d83==='queue'||_0xab1d83==='type'||_0xab1d83===_0xba78('0x63')||_0xab1d83===_0xba78('0x64')||_0xab1d83===_0xba78('0x35')||_0xab1d83==='channelAgent'||_0xab1d83===_0xba78('0x14')||_0xab1d83===_0xba78('0x65')||_0xab1d83==='calleridnum'||_0xab1d83===_0xba78('0x4b')||_0xab1d83==='countbusyretry'||_0xab1d83==='countcongestionretry'||_0xab1d83==='countnoanswerretry'||_0xab1d83===_0xba78('0x66')||_0xab1d83===_0xba78('0x67')||_0xab1d83===_0xba78('0x68')||_0xab1d83==='callbackat'||_0xab1d83==='recallme'||_0xab1d83==='ContactId'||_0xab1d83===_0xba78('0x4d')||_0xab1d83==='UserId'||_0xab1d83===_0xba78('0x16')||_0xab1d83===_0xba78('0x69')||_0xab1d83===_0xba78('0x6a')||_0xab1d83===_0xba78('0x6b')||_0xab1d83==='xmd-phone'||_0xab1d83===_0xba78('0x6c')||_0xab1d83===_0xba78('0x6d')||_0xab1d83===_0xba78('0x6e')||_0xab1d83===_0xba78('0x6f')||_0xab1d83===_0xba78('0x70')||_0xab1d83==='xmd-dialchannel'||_0xab1d83===_0xba78('0x71')||_0xab1d83===_0xba78('0x72')||_0xab1d83===_0xba78('0x73')||_0xab1d83==='xmd-agiafter'||_0xab1d83==='xmd-agi'||_0xab1d83===_0xba78('0x74')||_0xab1d83===_0xba78('0x75')||_0xab1d83===_0xba78('0x76')||_0xab1d83===_0xba78('0x77')||_0xab1d83==='rtpaudioqosloss'||_0xab1d83===_0xba78('0x78')||_0xab1d83===_0xba78('0x79')||_0xab1d83===_0xba78('0x7a')||_0xab1d83===_0xba78('0x74')||_0xab1d83===_0xba78('0x75')||_0xab1d83===_0xba78('0x76')||_0xab1d83===_0xba78('0x77')||_0xab1d83===_0xba78('0x7b')||_0xab1d83==='rtpaudioqoslossbridged'||_0xab1d83==='rtpaudioqosrtt'||_0xab1d83===_0xba78('0x7a')||_0xab1d83===_0xba78('0x7c')||_0xab1d83==='bridgepvtcallid'||_0xab1d83==='state'||_0xab1d83==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x844d5e,_0x3d4fbd){var _0x145c3c,_0x34a7e4,_0x38adb4;if(_0x3d4fbd<=0x0){_0x3d4fbd=0x1;}_0x145c3c=new RegExp(_0xba78('0x7d')+_0x3d4fbd+'}$');_0x34a7e4=Math[_0xba78('0x7e')](0xa,_0x3d4fbd-0x1);_0x38adb4=Math['pow'](0xa,_0x3d4fbd)-0x1;return util[_0xba78('0xf')]('%s',_[_0xba78('0x7f')](_0x844d5e,_0x145c3c,_[_0xba78('0x80')](_0x34a7e4,_0x38adb4)));};exports[_0xba78('0x81')]=function(_0x52a732){var _0x57ab88=_0x52a732[_0xba78('0x82')](/"(.*?)"/);return _0x57ab88?_0x57ab88[0x1]:_0x52a732;};exports['extractCalleridNumber']=function(_0x227e6d){var _0x2519df=_0x227e6d[_0xba78('0x82')](/<(.*?)>/);return _0x2519df?_0x2519df[0x1]:_0x227e6d;};function buildNoAnswerEventPayload(_0x23ce88,_0xd026a1){var _0x8c4c26=buildObj(_0x23ce88,'noanswer');if(!_[_0xba78('0xd')](_0xd026a1[_0xba78('0x83')])){Object[_0xba78('0x84')](_0xd026a1[_0xba78('0x83')])[_0xba78('0x85')](function(_0x57f180){_0x8c4c26[_0x57f180['toLowerCase']()]=_0xd026a1[_0xba78('0x83')][_0x57f180];});}return _0x8c4c26;}exports[_0xba78('0x86')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x9e87=['uniqueid','calleridnum','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','push','getDiff','seconds','ContactId','CampaignId','filterKey','idContact','campaigntype','dialAnswer','channelAgent','countcongestionretry','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosrtt','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','buildNoAnswerEventPayload','util','moment','preview','env','127.0.0.1','../../dialer/utils','loggerCatch','error','info','inspect','loggerError','logger2','message','getCallerId','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','getSeconds','logLookAgent','membername','UserId','logCustomer','endtime','ringtime','starttime','isFailure','Failure','RECALL','BOOKED'];(function(_0x15024e,_0x216225){var _0x4c55c1=function(_0x399f5c){while(--_0x399f5c){_0x15024e['push'](_0x15024e['shift']());}};_0x4c55c1(++_0x216225);}(_0x9e87,0x1e1));var _0x79e8=function(_0x151334,_0x1e11ac){_0x151334=_0x151334-0x0;var _0x3d03da=_0x9e87[_0x151334];return _0x3d03da;};'use strict';var util=require(_0x79e8('0x0'));var _=require('lodash');var moment=require(_0x79e8('0x1'));var logger=require('../../../../config/logger')(_0x79e8('0x2'));var ipAgi=process[_0x79e8('0x3')]['XCALLY_IP_AGI']||_0x79e8('0x4');var utils=require(_0x79e8('0x5'));exports[_0x79e8('0x6')]=function(_0x87f1a4){return function(_0x295555){logger[_0x79e8('0x7')](_0x87f1a4,util['inspect'](_0x295555,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x806b85,_0x40fab2){logger[_0x79e8('0x8')](_0x806b85,util[_0x79e8('0x9')](_0x40fab2,{'showHidden':![],'depth':null}));};exports[_0x79e8('0xa')]=function(_0x48546b,_0x5d7f46){logger['error'](_0x48546b,util[_0x79e8('0x9')](_0x5d7f46,{'showHidden':![],'depth':null}));};exports[_0x79e8('0xb')]=function(_0x45a344){return function(_0x2511d3){logger['info'](_0x45a344,util[_0x79e8('0x9')](_0x2511d3,{'showHidden':![],'depth':null}));};};exports[_0x79e8('0xc')]=function(_0x42ab30,_0x37532d,_0x429c91){return{'message':_0x42ab30,'unlock':_0x37532d,'active':_0x429c91};};exports[_0x79e8('0xd')]=function(_0x73cfc6,_0x2ff965,_0x35ce9c){if(!_['isUndefined'](_0x35ce9c)&&_0x79e8('0xe')===typeof _0x35ce9c&&!_[_0x79e8('0xf')](_0x35ce9c)){if(!_['isUndefined'](_0x2ff965)&&'string'===typeof _0x2ff965&&!_['isEmpty'](_0x2ff965)){return util[_0x79e8('0x10')](_0x79e8('0x11'),_0x2ff965,_0x35ce9c);}return util[_0x79e8('0x10')](_0x79e8('0x11'),_0x35ce9c,_0x35ce9c);}if(!_['isUndefined'](_0x73cfc6)&&'string'===typeof _0x73cfc6&&!_[_0x79e8('0xf')](_0x73cfc6)){return _0x73cfc6;}return _0x79e8('0x12');};exports[_0x79e8('0x13')]=function(_0x492482){if(_[_0x79e8('0x14')](_0x492482)){return![];}return _0x492482;};exports[_0x79e8('0x15')]=function(_0x22e14b,_0x356762,_0x15273e,_0x5cba84,_0x470a70,_0x2e19b8){var _0x5bdd76={'XMD-QUEUE':_0x356762[_0x79e8('0x16')]?_0x356762[_0x79e8('0x16')]['name']:'','XMD-CALLERID':_0x5cba84,'XMD-CALLERID-PREVIEW':_0x2e19b8?util['format'](_0x79e8('0x11'),_0x2e19b8[_0x79e8('0x17')],_0x2e19b8['calleridnum']):_0x5cba84,'XMD-DIALID':_0x470a70,'XMD-CONTACTID':_0x356762['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x5cba84,'XMD-VOICEQUEUEID':_0x356762[_0x79e8('0x18')],'XMD-DIALCHANNEL':_0x15273e,'XMD-DIALTIMEOUT':_0x22e14b[_0x79e8('0x19')]||0x1e,'XMD-DIALOPTIONS':util[_0x79e8('0x10')](_0x79e8('0x1a'),_0x22e14b[_0x79e8('0x1b')]?'g':'',_[_0x79e8('0xf')](_0x22e14b[_0x79e8('0x1c')])?'':_0x79e8('0x1d')),'XMD-DIALURL':_0x22e14b[_0x79e8('0x1e')]||'','XMD-AGI':_0x22e14b[_0x79e8('0x1f')]?util[_0x79e8('0x10')](_0x79e8('0x20'),ipAgi,_0x22e14b[_0x79e8('0x1f')]):_0x79e8('0x21'),'XMD-AGIAFTER':_0x22e14b[_0x79e8('0x1b')]?util[_0x79e8('0x10')](_0x79e8('0x20'),ipAgi,_0x22e14b['dialQueueProject2']):_0x79e8('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x2e19b8?_0x2e19b8[_0x79e8('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x2e19b8?_0x2e19b8[_0x79e8('0x23')]:'','XMD-DESTINATION':_0x79e8('0x24'),'SIPADDHEADER':_0x79e8('0x25')};if(!_[_0x79e8('0xf')](_0x22e14b[_0x79e8('0x1c')])){_0x5bdd76[util[_0x79e8('0x10')]('%s',_0x79e8('0x26'))]=_0x22e14b[_0x79e8('0x1c')];_0x5bdd76[util[_0x79e8('0x10')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x470a70;}return _0x5bdd76;};exports[_0x79e8('0x27')]=function(_0x48a39e){var _0x5ea199={};for(var _0x1356ba in _0x48a39e){if(_0x48a39e[_0x79e8('0x28')](_0x1356ba)){_0x5ea199[util['format']('%s',_[_0x79e8('0x29')](_0x1356ba))]=_0x48a39e[_0x1356ba];}}return{'variables':_0x5ea199};};exports[_0x79e8('0x2a')]=function(_0x47ff13,_0x45fa05){if(!_[_0x79e8('0x14')](_0x47ff13)){if(_0x47ff13[_0x79e8('0x28')]('originated')){if(_0x47ff13['originated']>0x0){_0x47ff13[_0x79e8('0x2b')]-=0x1;}else{logger[_0x79e8('0x7')](_0x79e8('0x2c'),_0x45fa05);}}}else{logger['error'](_0x79e8('0x2d'),_0x45fa05);}};exports['logBlacklist']=function(_0x20f669){var _0x556f13=moment()['format'](_0x79e8('0x2e'));_0x20f669[_0x79e8('0x2f')]=0xd;_0x20f669[_0x79e8('0x30')]=_0x79e8('0x31');_0x20f669['starttime']=_0x556f13;_0x20f669[_0x79e8('0x32')]=_0x556f13;_0x20f669['endtime']=_0x556f13;};exports['logAgent']=function(_0x196881,_0x31ba12,_0x1d7add){var _0x4a3001=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x196881[_0x79e8('0x2f')]=_0x31ba12;_0x196881[_0x79e8('0x30')]=_0x1d7add;_0x196881[_0x79e8('0x32')]=_0x4a3001;_0x196881['ringtime']=utils[_0x79e8('0x33')](_0x196881['responsetime'],_0x196881['starttime']);};exports[_0x79e8('0x34')]=function(_0x3030a3,_0x595537,_0x21513c){_0x3030a3[_0x79e8('0x35')]=_0x595537;_0x3030a3[_0x79e8('0x36')]=_0x21513c;};exports[_0x79e8('0x37')]=function(_0x1185bb,_0x15610c,_0x1e0aa1){var _0x3aa3dc=moment()[_0x79e8('0x10')](_0x79e8('0x2e'));_0x1185bb[_0x79e8('0x2f')]=_0x15610c;_0x1185bb[_0x79e8('0x30')]=_0x1e0aa1;_0x1185bb['responsetime']=_0x1185bb['responsetime']?_0x1185bb[_0x79e8('0x32')]:_0x3aa3dc;_0x1185bb[_0x79e8('0x38')]=_0x1185bb[_0x79e8('0x38')]?_0x1185bb[_0x79e8('0x38')]:_0x3aa3dc;_0x1185bb[_0x79e8('0x39')]=utils['getSeconds'](_0x1185bb[_0x79e8('0x32')]||0x0,_0x1185bb[_0x79e8('0x3a')]||0x0);_0x1185bb['talktime']=_0x1185bb['answertime']?utils[_0x79e8('0x33')](_0x1185bb[_0x79e8('0x38')],_0x1185bb['answertime']):0x0;};exports[_0x79e8('0x3b')]=function(_0x512b2a){return _0x512b2a===_0x79e8('0x3c');};exports['variablesAction']=function(_0x33852b,_0x4de962,_0x1f259b,_0x179edc,_0x47af82){var _0x4ca21e=_0x179edc?_0x79e8('0x3d'):_0x33852b[_0x79e8('0x17')];_0x4ca21e=_0x47af82?_0x79e8('0x3e'):_0x4ca21e;return{'actionid':_0x33852b[_0x79e8('0x3f')],'action':'originate','channel':_0x33852b['channelAgent'],'callerid':util[_0x79e8('0x10')](_0x79e8('0x11'),_0x4ca21e,_0x33852b[_0x79e8('0x40')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x1f259b,'timeout':(_0x4de962[_0x79e8('0x41')]||0x1e)*0x3e8,'async':!![],'channelid':_0x33852b['uniqueid']};};exports[_0x79e8('0x42')]=function(_0x5f1038){return _0x5f1038[_0x79e8('0x43')]+_0x5f1038['countcongestionretry']+_0x5f1038[_0x79e8('0x44')]+_0x5f1038[_0x79e8('0x45')]+_0x5f1038[_0x79e8('0x46')];};exports[_0x79e8('0x47')]=function(_0x300e9a){var _0x883f99=_[_0x79e8('0x48')](_0x300e9a);_0x883f99[_0x79e8('0x2f')]=0xf;_0x883f99[_0x79e8('0x30')]=_0x79e8('0x49');return _0x883f99;};exports[_0x79e8('0x4a')]=function(_0x3a89c3,_0x3b3379,_0x45f510){var _0x484577={};_0x484577[_0x3b3379]=_0x3a89c3[_0x3b3379];_0x484577[_0x79e8('0x4b')]=![];_0x484577[_0x79e8('0x4c')]=moment()[_0x79e8('0x4d')](_0x45f510,'minutes')[_0x79e8('0x10')](_0x79e8('0x2e'));_0x484577['ContactId']=_0x3a89c3['ContactId'];_0x484577[_0x79e8('0x4e')]=_0x3a89c3['ListId'];_0x484577[_0x79e8('0x18')]=_0x3a89c3[_0x79e8('0x18')]||undefined;return _0x484577;};exports['decrementTalkink']=function(_0x5bb87c,_0x3abc51){if(!_['isNil'](_0x5bb87c)){if(_0x5bb87c[_0x79e8('0x4f')]>0x0){_0x5bb87c[_0x79e8('0x4f')]-=0x1;}else{logger[_0x79e8('0x7')](_0x3abc51,_0x79e8('0x50'));}}else{logger[_0x79e8('0x7')](_0x3abc51,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x79e8('0x51')]=function(_0x10983f){if(_0x10983f<=0x0){return!![];}return![];};function buildObj(_0x3b7e2a,_0x210578,_0x31dc9b){_0x3b7e2a[_0x79e8('0x52')]=_0x210578;_0x3b7e2a['name']=_0x3b7e2a[_0x79e8('0x53')];_0x3b7e2a[_0x79e8('0x54')]=_0x3b7e2a['channelAgent'];_0x3b7e2a[_0x79e8('0x55')]=_0x79e8('0x56');if(_0x31dc9b){_0x3b7e2a[_0x79e8('0x57')]=_0x31dc9b['mandatoryDisposition'];}return _0x3b7e2a;}exports['buildObj']=buildObj;exports['agentReadyId']=function(_0x24f084){var _0xde689c=[];for(var _0x11f4a4 in _0x24f084){if(_0x24f084[_0x79e8('0x28')](_0x11f4a4)){if(!_['isNil'](_0x24f084[_0x11f4a4])&&_0x24f084[_0x11f4a4]['state']==='not_inuse'&&_0x24f084[_0x11f4a4]['status']==='reachable'){_0xde689c[_0x79e8('0x58')](_0x24f084[_0x11f4a4]['id']);}}}return _0xde689c;};exports[_0x79e8('0x59')]=function(_0x136f71){var _0xf674dc=moment()['milliseconds'](0x0);var _0x36ad22=moment(_0x136f71)['milliseconds'](0x0);return _0xf674dc['diff'](_0x36ad22,_0x79e8('0x5a'));};exports['createBody']=function(_0xa3250f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xa3250f[_0x79e8('0x5b')],'ListId':_0xa3250f[_0x79e8('0x4e')],'VoiceQueueId':_0xa3250f[_0x79e8('0x18')]||undefined,'CampaignId':_0xa3250f[_0x79e8('0x5c')]||undefined};};exports[_0x79e8('0x5d')]=function(_0x1ad4b8){if(_0x1ad4b8===_0x79e8('0x3f')||_0x1ad4b8===_0x79e8('0x5e')||_0x1ad4b8===_0x79e8('0x53')||_0x1ad4b8==='type'||_0x1ad4b8===_0x79e8('0x5f')||_0x1ad4b8===_0x79e8('0x60')||_0x1ad4b8===_0x79e8('0x35')||_0x1ad4b8===_0x79e8('0x61')||_0x1ad4b8===_0x79e8('0x17')||_0x1ad4b8===_0x79e8('0x4b')||_0x1ad4b8===_0x79e8('0x40')||_0x1ad4b8==='scheduledat'||_0x1ad4b8==='countbusyretry'||_0x1ad4b8===_0x79e8('0x62')||_0x1ad4b8===_0x79e8('0x44')||_0x1ad4b8==='countglobal'||_0x1ad4b8===_0x79e8('0x63')||_0x1ad4b8===_0x79e8('0x64')||_0x1ad4b8===_0x79e8('0x65')||_0x1ad4b8===_0x79e8('0x66')||_0x1ad4b8===_0x79e8('0x5b')||_0x1ad4b8===_0x79e8('0x4e')||_0x1ad4b8===_0x79e8('0x36')||_0x1ad4b8==='VoiceQueueId'||_0x1ad4b8===_0x79e8('0x67')||_0x1ad4b8==='xmd-voicequeueid'||_0x1ad4b8===_0x79e8('0x68')||_0x1ad4b8===_0x79e8('0x69')||_0x1ad4b8===_0x79e8('0x6a')||_0x1ad4b8===_0x79e8('0x6b')||_0x1ad4b8===_0x79e8('0x6c')||_0x1ad4b8===_0x79e8('0x6d')||_0x1ad4b8===_0x79e8('0x6e')||_0x1ad4b8===_0x79e8('0x6f')||_0x1ad4b8==='xmd-contactid'||_0x1ad4b8===_0x79e8('0x70')||_0x1ad4b8===_0x79e8('0x71')||_0x1ad4b8==='xmd-agiafter'||_0x1ad4b8===_0x79e8('0x72')||_0x1ad4b8==='rtpaudioqos'||_0x1ad4b8===_0x79e8('0x73')||_0x1ad4b8===_0x79e8('0x74')||_0x1ad4b8==='rtpaudioqosjitterbridged'||_0x1ad4b8==='rtpaudioqosloss'||_0x1ad4b8===_0x79e8('0x75')||_0x1ad4b8==='rtpaudioqosrtt'||_0x1ad4b8===_0x79e8('0x76')||_0x1ad4b8===_0x79e8('0x77')||_0x1ad4b8==='rtpaudioqosbridged'||_0x1ad4b8===_0x79e8('0x74')||_0x1ad4b8===_0x79e8('0x78')||_0x1ad4b8==='rtpaudioqosloss'||_0x1ad4b8===_0x79e8('0x75')||_0x1ad4b8===_0x79e8('0x79')||_0x1ad4b8===_0x79e8('0x76')||_0x1ad4b8==='bridgepeer'||_0x1ad4b8===_0x79e8('0x7a')||_0x1ad4b8===_0x79e8('0x2f')||_0x1ad4b8===_0x79e8('0x30')){return![];}return!![];};exports[_0x79e8('0x7b')]=function(_0x30c99e,_0x353694){var _0xb7e5e4,_0xb03aa,_0x2c83f3;if(_0x353694<=0x0){_0x353694=0x1;}_0xb7e5e4=new RegExp(_0x79e8('0x7c')+_0x353694+'}$');_0xb03aa=Math['pow'](0xa,_0x353694-0x1);_0x2c83f3=Math[_0x79e8('0x7d')](0xa,_0x353694)-0x1;return util[_0x79e8('0x10')]('%s',_[_0x79e8('0x7e')](_0x30c99e,_0xb7e5e4,_[_0x79e8('0x7f')](_0xb03aa,_0x2c83f3)));};exports[_0x79e8('0x80')]=function(_0x309b14){var _0x1fea93=_0x309b14[_0x79e8('0x81')](/"(.*?)"/);return _0x1fea93?_0x1fea93[0x1]:_0x309b14;};exports[_0x79e8('0x82')]=function(_0x452d47){var _0x262e76=_0x452d47['match'](/<(.*?)>/);return _0x262e76?_0x262e76[0x1]:_0x452d47;};function buildNoAnswerEventPayload(_0x4a2547,_0x402866){var _0x5c2440=buildObj(_0x4a2547,_0x79e8('0x83'));if(!_[_0x79e8('0xf')](_0x402866[_0x79e8('0x84')])){Object[_0x79e8('0x85')](_0x402866[_0x79e8('0x84')])[_0x79e8('0x86')](function(_0x15f847){_0x5c2440[_0x15f847['toLowerCase']()]=_0x402866[_0x79e8('0x84')][_0x15f847];});}return _0x5c2440;}exports[_0x79e8('0x87')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index b4815c3..482039f 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 _0xc2ed=['voicechannel','voicequeuechannelredirect','string','number','boolean','queueremove','queuepause','reload'];(function(_0x137bcf,_0x5d9120){var _0x3ffe78=function(_0x420140){while(--_0x420140){_0x137bcf['push'](_0x137bcf['shift']());}};_0x3ffe78(++_0x5d9120);}(_0xc2ed,0xca));var _0xdc2e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xc2ed[_0x3054be];return _0x3df150;};'use strict';exports['queueadd']={'queue':{'type':_0xdc2e('0x0'),'required':!![]},'interface':{'type':_0xdc2e('0x0'),'required':!![]},'membername':{'type':_0xdc2e('0x0'),'required':!![]},'penalty':{'type':_0xdc2e('0x1'),'required':![]},'paused':{'type':_0xdc2e('0x2'),'required':![]}};exports[_0xdc2e('0x3')]={'queue':{'type':_0xdc2e('0x0'),'required':!![]},'interface':{'type':_0xdc2e('0x0'),'required':!![]}};exports[_0xdc2e('0x4')]={'interface':{'type':_0xdc2e('0x0'),'required':!![]},'paused':{'type':_0xdc2e('0x2')},'reason':{'type':_0xdc2e('0x0'),'required':![]}};exports[_0xdc2e('0x5')]={'module':{'type':_0xdc2e('0x0'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xdc2e('0x0'),'required':!![]}};exports[_0xdc2e('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xdc2e('0x0')},'format':{'type':_0xdc2e('0x0')},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xdc2e('0x0'),'required':!![]}};exports[_0xdc2e('0x7')]={'uniqueid':{'type':_0xdc2e('0x0'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0xdc2e('0x0')}}; \ No newline at end of file +var _0x1745=['queuepause','boolean','reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','queueremove'];(function(_0x214d54,_0x133c72){var _0x44ca46=function(_0xe42b02){while(--_0xe42b02){_0x214d54['push'](_0x214d54['shift']());}};_0x44ca46(++_0x133c72);}(_0x1745,0xc4));var _0x5174=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x1745[_0x618414];return _0x21c19a;};'use strict';exports[_0x5174('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x5174('0x1'),'required':!![]},'penalty':{'type':_0x5174('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x5174('0x3')]={'queue':{'type':_0x5174('0x1'),'required':!![]},'interface':{'type':_0x5174('0x1'),'required':!![]}};exports[_0x5174('0x4')]={'interface':{'type':_0x5174('0x1'),'required':!![]},'paused':{'type':_0x5174('0x5')},'reason':{'type':_0x5174('0x1'),'required':![]}};exports[_0x5174('0x6')]={'module':{'type':'string','required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':'string','required':!![]}};exports[_0x5174('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':_0x5174('0x1')}};exports[_0x5174('0x8')]={'uniqueid':{'type':_0x5174('0x1'),'required':!![]}};exports[_0x5174('0x9')]={'uniqueid':{'type':_0x5174('0x1'),'required':!![]},'exten':{'type':_0x5174('0x1'),'required':!![]},'context':{'type':_0x5174('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 57397bd..32f9302 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 _0x2032=['voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','outbound','channels','queueChannels','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','interface','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','length','isNil','isUndefined','agents','initTelephones','initTrunks','mergeFromDatabase','initTriggers','triggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2032,0xd9));var _0x2203=function(_0x18bcff,_0x3dfea9){_0x18bcff=_0x18bcff-0x0;var _0xf604ac=_0x2032[_0x18bcff];return _0xf604ac;};'use strict';var _=require('lodash');var moment=require(_0x2203('0x0'));var util=require(_0x2203('0x1'));var Agent=require(_0x2203('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0x2203('0x3'));var VoiceQueue=require(_0x2203('0x4'));var Trigger=require('../model/trigger');var Template=require(_0x2203('0x5'));var Campaign=require(_0x2203('0x6'));var VoiceExtension=require(_0x2203('0x7'));var ZendeskAccount=require(_0x2203('0x8'));var SalesforceAccount=require(_0x2203('0x9'));var FreshdeskAccount=require(_0x2203('0xa'));var SugarcrmAccount=require(_0x2203('0xb'));var ZohoAccount=require(_0x2203('0xc'));var DeskAccount=require(_0x2203('0xd'));var VtigerAccount=require(_0x2203('0xe'));var ServicenowAccount=require(_0x2203('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x2203('0x10'));function Realtime(){this['agents']={};this[_0x2203('0x11')]={};this[_0x2203('0x12')]={};this[_0x2203('0x13')]={};this['triggers']={};this[_0x2203('0x14')]={};this['templates']={};this[_0x2203('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x2203('0x16')]={};this[_0x2203('0x17')]={};this['outboundChannels']={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x2203('0x18')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0x2203('0x19')]={};this[_0x2203('0x1a')]={};this[_0x2203('0x1b')]={};this[_0x2203('0x1c')]={};this[_0x2203('0x1d')]={};this[_0x2203('0x1e')]={};}function freeIsNotKey(_0x2c36e6,_0x2c085c,_0xdf9d0b){var _0x3053f3=_['mapKeys'](_0x2c36e6,function(_0x280eda){return _0x280eda[_0xdf9d0b];});for(var _0x2ee127 in _0x2c085c){if(_0x2c085c['hasOwnProperty'](_0x2ee127)){if(!_0x3053f3[_0x2ee127]){delete _0x2c085c[_0x2ee127];}}}}function freeIsNotKeySip(_0x3f9ef6,_0x8906e1){var _0x4aeb9f=_[_0x2203('0x1f')](_0x3f9ef6,function(_0x5ee83c){return util[_0x2203('0x20')](_0x2203('0x21'),_0x5ee83c[_0x2203('0x22')]);});for(var _0x3b4034 in _0x8906e1){if(_0x8906e1[_0x2203('0x23')](_0x3b4034)){if(!_0x4aeb9f[_0x3b4034]){delete _0x8906e1[_0x3b4034];}}}}function freeIsNotKeyAgent(_0x449039,_0x538c23){var _0x13d3f7=_['mapKeys'](_0x449039,function(_0x5ac866){var _0x15f543=_['isNil'](_0x5ac866[_0x2203('0x24')])?util[_0x2203('0x20')]('SIP/%s',_0x5ac866[_0x2203('0x22')]):_0x5ac866['interface'];return _0x15f543;});for(var _0x5c8da9 in _0x538c23){if(_0x538c23[_0x2203('0x23')](_0x5c8da9)){if(!_0x13d3f7[_0x5c8da9]){delete _0x538c23[_0x5c8da9];}}}}function clearVoiceCallReports(_0x2718f5){_0x2718f5[_0x2203('0x25')]=0x0;_0x2718f5[_0x2203('0x26')]=0x0;_0x2718f5[_0x2203('0x27')]=0x0;_0x2718f5[_0x2203('0x28')]=0x0;_0x2718f5[_0x2203('0x29')]=0x0;}function clearCampaigns(_0x250349){if(!_['isEmpty'](_0x250349)){for(var _0x143f41 in _0x250349){if(_0x250349[_0x2203('0x23')](_0x143f41)){_0x250349[_0x143f41][_0x2203('0x2a')]=0x0;_0x250349[_0x143f41]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0xb2071b){if(!_[_0x2203('0x2b')](_0xb2071b)){for(var _0x5c5fd3 in _0xb2071b){if(_0xb2071b[_0x2203('0x23')](_0x5c5fd3)){_0xb2071b[_0x5c5fd3][_0x2203('0x25')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x26')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2c')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2d')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x27')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x28')]=0x0;_0xb2071b[_0x5c5fd3]['sumBillable']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2e')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2f')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x30')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x31')]=0x0;_0xb2071b[_0x5c5fd3]['outboundNoSuchCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x32')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x33')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x34')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x35')]=0x0;_0xb2071b[_0x5c5fd3]['outboundOriginateFailureCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x36')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x37')]=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerAgiCallsDay']=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x38')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x125dfc,_0x464c88){for(var _0x191894 in _0x464c88){if(_0x125dfc[_0x2203('0x23')](_0x191894)){_0x125dfc[_0x191894]=_0x464c88[_0x191894];}}};Realtime[_0x2203('0x39')]['initAgents']=function(){var _0xb22e28=this;return function(_0x2324c0){if(_0x2324c0){freeIsNotKeyAgent(_0x2324c0,_0xb22e28['agents']);for(var _0x2a2ee7=0x0,_0x20fbe1={};_0x2a2ee7<_0x2324c0[_0x2203('0x3a')];_0x2a2ee7+=0x1){_0x20fbe1=_0x2324c0[_0x2a2ee7];var _0x4187b4=_[_0x2203('0x3b')](_0x20fbe1[_0x2203('0x24')])?util[_0x2203('0x20')](_0x2203('0x21'),_0x20fbe1[_0x2203('0x22')]):_0x20fbe1['interface'];if(_[_0x2203('0x3c')](_0xb22e28[_0x2203('0x3d')][_0x4187b4])){_0xb22e28['agents'][_0x4187b4]=new Agent(_0x20fbe1);}else{_0xb22e28['mergeFromDatabase'](_0xb22e28[_0x2203('0x3d')][_0x4187b4],_0x20fbe1);}}}return _0xb22e28['agents'];};};Realtime[_0x2203('0x39')][_0x2203('0x3e')]=function(){var _0x127ee3=this;return function(_0x5221f0){if(_0x5221f0){freeIsNotKeySip(_0x5221f0,_0x127ee3['telephones']);for(var _0x34cdeb=0x0,_0x47c93a={};_0x34cdeb<_0x5221f0[_0x2203('0x3a')];_0x34cdeb+=0x1){_0x47c93a=_0x5221f0[_0x34cdeb];if(_['isUndefined'](_0x127ee3[_0x2203('0x11')][util['format'](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])])){_0x127ee3[_0x2203('0x11')][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a['name'])]=new Telephone(_0x47c93a);}else{_0x127ee3['mergeFromDatabase'](_0x127ee3['telephones'][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])],_0x47c93a);}}}return _0x127ee3[_0x2203('0x11')];};};Realtime[_0x2203('0x39')][_0x2203('0x3f')]=function(){var _0x1c7e3d=this;return function(_0x590b4e){if(_0x590b4e){freeIsNotKeySip(_0x590b4e,_0x1c7e3d[_0x2203('0x12')]);for(var _0x1b12c3=0x0,_0x108fde={};_0x1b12c3<_0x590b4e[_0x2203('0x3a')];_0x1b12c3+=0x1){_0x108fde=_0x590b4e[_0x1b12c3];if(_['isUndefined'](_0x1c7e3d['trunks'][util[_0x2203('0x20')]('SIP/%s',_0x108fde[_0x2203('0x22')])])){_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')]('SIP/%s',_0x108fde['name'])]=new Trunk(_0x108fde);}else{_0x1c7e3d[_0x2203('0x40')](_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')](_0x2203('0x21'),_0x108fde[_0x2203('0x22')])],_0x108fde);}}}return _0x1c7e3d[_0x2203('0x12')];};};Realtime['prototype'][_0x2203('0x41')]=function(){var _0x165a3f=this;return function(_0x3a866c){if(_0x3a866c){freeIsNotKey(_0x3a866c,_0x165a3f[_0x2203('0x42')],'id');for(var _0x16b452=0x0,_0x36b99f={};_0x16b452<_0x3a866c[_0x2203('0x3a')];_0x16b452+=0x1){_0x36b99f=_0x3a866c[_0x16b452];if(_[_0x2203('0x3c')](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']])){_0x165a3f[_0x2203('0x42')][_0x36b99f['id']]=new Trigger(_0x36b99f);}else{_0x165a3f['mergeFromDatabase'](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']],_0x36b99f);}}}return _0x165a3f[_0x2203('0x42')];};};Realtime[_0x2203('0x39')][_0x2203('0x43')]=function(){var _0x4c3259=this;return function(_0x58bd5c){if(_0x58bd5c){freeIsNotKey(_0x58bd5c,_0x4c3259[_0x2203('0x44')],'id');for(var _0x48129c=0x0,_0x273e5f={};_0x48129c<_0x58bd5c[_0x2203('0x3a')];_0x48129c+=0x1){_0x273e5f=_0x58bd5c[_0x48129c];if(_[_0x2203('0x3c')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']])){_0x4c3259['templates'][_0x273e5f['id']]=new Template(_0x273e5f);}else{_0x4c3259[_0x2203('0x40')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']],_0x273e5f);}}}return _0x4c3259['templates'];};};Realtime[_0x2203('0x39')][_0x2203('0x45')]=function(){var _0x35b2e9=this;return function(_0x2600a9){if(_0x2600a9){freeIsNotKey(_0x2600a9,_0x35b2e9['zendeskAccounts'],'id');for(var _0x4c1a29=0x0,_0x21b8ab={};_0x4c1a29<_0x2600a9['length'];_0x4c1a29+=0x1){_0x21b8ab=_0x2600a9[_0x4c1a29];if(_['isUndefined'](_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']])){_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']]=new ZendeskAccount(_0x21b8ab);}else{_0x35b2e9[_0x2203('0x40')](_0x35b2e9['zendeskAccounts'][_0x21b8ab['id']],_0x21b8ab);}}}return _0x35b2e9['zendeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x47')]=function(){var _0x12d7fa=this;return function(_0x21d2d7){if(_0x21d2d7){freeIsNotKey(_0x21d2d7,_0x12d7fa[_0x2203('0x48')],'id');for(var _0x21fd78=0x0,_0x4a7f4e={};_0x21fd78<_0x21d2d7[_0x2203('0x3a')];_0x21fd78+=0x1){_0x4a7f4e=_0x21d2d7[_0x21fd78];if(_['isUndefined'](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']])){_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']]=new SalesforceAccount(_0x4a7f4e);}else{_0x12d7fa[_0x2203('0x40')](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']],_0x4a7f4e);}}}return _0x12d7fa['salesforceAccounts'];};};Realtime['prototype'][_0x2203('0x49')]=function(){var _0x1f772d=this;return function(_0x126aad){if(_0x126aad){freeIsNotKey(_0x126aad,_0x1f772d[_0x2203('0x4a')],'id');for(var _0x559370=0x0,_0x4de47a={};_0x559370<_0x126aad['length'];_0x559370+=0x1){_0x4de47a=_0x126aad[_0x559370];if(_[_0x2203('0x3c')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']])){_0x1f772d['freshdeskAccounts'][_0x4de47a['id']]=new FreshdeskAccount(_0x4de47a);}else{_0x1f772d[_0x2203('0x40')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']],_0x4de47a);}}}return _0x1f772d['freshdeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x4b')]=function(){var _0x172c6a=this;return function(_0x6a1877){if(_0x6a1877){freeIsNotKey(_0x6a1877,_0x172c6a['zohoAccounts'],'id');for(var _0x120db1=0x0,_0x5268d6={};_0x120db1<_0x6a1877[_0x2203('0x3a')];_0x120db1+=0x1){_0x5268d6=_0x6a1877[_0x120db1];if(_[_0x2203('0x3c')](_0x172c6a['zohoAccounts'][_0x5268d6['id']])){_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']]=new ZohoAccount(_0x5268d6);}else{_0x172c6a[_0x2203('0x40')](_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']],_0x5268d6);}}}return _0x172c6a[_0x2203('0x4c')];};};Realtime[_0x2203('0x39')][_0x2203('0x4d')]=function(){var _0x569d4a=this;return function(_0x562a3d){if(_0x562a3d){freeIsNotKey(_0x562a3d,_0x569d4a[_0x2203('0x19')],'id');for(var _0x524356=0x0,_0x56e881={};_0x524356<_0x562a3d[_0x2203('0x3a')];_0x524356+=0x1){_0x56e881=_0x562a3d[_0x524356];if(_[_0x2203('0x3c')](_0x569d4a[_0x2203('0x19')][_0x56e881['id']])){_0x569d4a['deskAccounts'][_0x56e881['id']]=new DeskAccount(_0x56e881);}else{_0x569d4a[_0x2203('0x40')](_0x569d4a['deskAccounts'][_0x56e881['id']],_0x56e881);}}}return _0x569d4a['deskAccounts'];};};Realtime[_0x2203('0x39')]['initSugarcrmAccounts']=function(){var _0x54ec71=this;return function(_0x5efc59){if(_0x5efc59){freeIsNotKey(_0x5efc59,_0x54ec71[_0x2203('0x18')],'id');for(var _0x31256b=0x0,_0x367122={};_0x31256b<_0x5efc59[_0x2203('0x3a')];_0x31256b+=0x1){_0x367122=_0x5efc59[_0x31256b];if(_[_0x2203('0x3c')](_0x54ec71[_0x2203('0x18')][_0x367122['id']])){_0x54ec71[_0x2203('0x18')][_0x367122['id']]=new SugarcrmAccount(_0x367122);}else{_0x54ec71[_0x2203('0x40')](_0x54ec71[_0x2203('0x18')][_0x367122['id']],_0x367122);}}}return _0x54ec71[_0x2203('0x18')];};};Realtime[_0x2203('0x39')][_0x2203('0x4e')]=function(){var _0x58ff57=this;return function(_0x585bde){if(_0x585bde){freeIsNotKey(_0x585bde,_0x58ff57[_0x2203('0x1a')],'id');for(var _0x43d8c0=0x0,_0x2511bd={};_0x43d8c0<_0x585bde[_0x2203('0x3a')];_0x43d8c0+=0x1){_0x2511bd=_0x585bde[_0x43d8c0];if(_[_0x2203('0x3c')](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']])){_0x58ff57['vtigerAccounts'][_0x2511bd['id']]=new VtigerAccount(_0x2511bd);}else{_0x58ff57['mergeFromDatabase'](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']],_0x2511bd);}}}return _0x58ff57[_0x2203('0x1a')];};};Realtime[_0x2203('0x39')][_0x2203('0x4f')]=function(){var _0xcab922=this;return function(_0x7b0b9c){if(_0x7b0b9c){freeIsNotKey(_0x7b0b9c,_0xcab922[_0x2203('0x1b')],'id');for(var _0x191b67=0x0,_0x2c6bcc={};_0x191b67<_0x7b0b9c[_0x2203('0x3a')];_0x191b67+=0x1){_0x2c6bcc=_0x7b0b9c[_0x191b67];if(_[_0x2203('0x3c')](_0xcab922['servicenowAccounts'][_0x2c6bcc['id']])){_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']]=new ServicenowAccount(_0x2c6bcc);}else{_0xcab922[_0x2203('0x40')](_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']],_0x2c6bcc);}}}return _0xcab922[_0x2203('0x1b')];};};Realtime[_0x2203('0x39')][_0x2203('0x50')]=function(){var _0x52c159=this;return function(_0x544756){if(_0x544756){freeIsNotKey(_0x544756,_0x52c159[_0x2203('0x1c')],'id');for(var _0x35b7b9=0x0,_0x49e795={};_0x35b7b9<_0x544756[_0x2203('0x3a')];_0x35b7b9+=0x1){_0x49e795=_0x544756[_0x35b7b9];if(_[_0x2203('0x3c')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']])){_0x52c159[_0x2203('0x1c')][_0x49e795['id']]=new Dynamics365Account(_0x49e795);}else{_0x52c159[_0x2203('0x40')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']],_0x49e795);}}}return _0x52c159[_0x2203('0x1c')];};};Realtime[_0x2203('0x39')][_0x2203('0x51')]=function(){var _0x519120=this;return function(_0x468619){if(_0x468619){freeIsNotKey(_0x468619,_0x519120[_0x2203('0x1d')],'id');for(var _0x465898=0x0,_0x4e461e={};_0x465898<_0x468619[_0x2203('0x3a')];_0x465898+=0x1){_0x4e461e=_0x468619[_0x465898];if(_[_0x2203('0x3c')](_0x519120[_0x2203('0x1d')][_0x4e461e['id']])){_0x519120[_0x2203('0x1d')][_0x4e461e['id']]=new FreshsalesAccount(_0x4e461e);}else{_0x519120[_0x2203('0x40')](_0x519120['freshsalesAccounts'][_0x4e461e['id']],_0x4e461e);}}}return _0x519120[_0x2203('0x1d')];};};Realtime[_0x2203('0x39')][_0x2203('0x52')]=function(){var _0x4dde80=this;return function(_0x5507b6){for(var _0x5d9ae2=0x0;_0x5d9ae2<_0x5507b6['length'];_0x5d9ae2+=0x1){_['merge'](_0x4dde80[_0x2203('0x13')][_0x5507b6[_0x5d9ae2][_0x2203('0x22')]],_0x5507b6[_0x5d9ae2]);}return _0x4dde80[_0x2203('0x13')];};};Realtime[_0x2203('0x39')][_0x2203('0x53')]=function(){var _0x169845=this;return function(_0x3f7926){clearVoiceQueues(_0x169845[_0x2203('0x13')]);if(_0x3f7926){_0x3f7926=_['groupBy'](_0x3f7926,'uniqueid');for(var _0xb54e51 in _0x3f7926){if(_0x3f7926[_0x2203('0x23')](_0xb54e51)){for(var _0xafcc82=0x0;_0xafcc82<_0x3f7926[_0xb54e51][_0x2203('0x3a')];_0xafcc82+=0x1){var _0x1bbd2d=_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x54')];if(_0x169845[_0x2203('0x13')][_0x1bbd2d]){if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x55')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2c')]+=0x1;}if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x56')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2d')]+=0x1;}_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x57')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;if(_0xafcc82===_0x3f7926[_0xb54e51]['length']-0x1){_0x169845[_0x2203('0x13')][_0x1bbd2d]['sumDuration']+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')]||_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerabandonAt']||_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5c')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x25')]+=0x1;if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5d')]){_0x169845[_0x2203('0x13')][_0x1bbd2d]['answered']+=0x1;_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x29')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x28')]+=_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]||0x0;}}}}}}return _0x169845[_0x2203('0x13')];};};Realtime['prototype'][_0x2203('0x5e')]=function(){var _0x47a2c7=this;return function(_0x48bd5){clearVoiceCallReports(_0x47a2c7[_0x2203('0x15')]);if(_0x48bd5){for(var _0xe3bee5=0x0;_0xe3bee5<_0x48bd5[_0x2203('0x3a')];_0xe3bee5+=0x1){_0x47a2c7[_0x2203('0x15')]['total']+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x28')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')];if(_0x48bd5[_0xe3bee5]['disposition']===_0x2203('0x60')){_0x47a2c7[_0x2203('0x15')][_0x2203('0x26')]+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x27')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')]-_0x48bd5[_0xe3bee5][_0x2203('0x61')]||0x0;_0x47a2c7[_0x2203('0x15')][_0x2203('0x29')]+=_0x48bd5[_0xe3bee5][_0x2203('0x61')];}}}return _0x47a2c7[_0x2203('0x15')];};};Realtime['prototype'][_0x2203('0x62')]=function(){var _0x7f71b8=this;return function(_0x21b755){if(_0x21b755){freeIsNotKey(_0x21b755,_0x7f71b8[_0x2203('0x14')],_0x2203('0x22'));for(var _0x52c35e=0x0,_0x23f7b1={};_0x52c35e<_0x21b755[_0x2203('0x3a')];_0x52c35e+=0x1){_0x23f7b1=_0x21b755[_0x52c35e];if(_[_0x2203('0x3c')](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]])){_0x7f71b8[_0x2203('0x14')][_0x23f7b1['name']]=new Campaign(_0x23f7b1);}else{_0x7f71b8['mergeFromDatabase'](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]],_0x23f7b1);_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]][_0x2203('0x63')]=_0x23f7b1['SquareProject']?_0x23f7b1[_0x2203('0x64')][_0x2203('0x22')]:undefined;}}}return _0x7f71b8['campaigns'];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x4fc51a=this;return function(_0x5e07d7){if(_0x5e07d7){freeIsNotKey(_0x5e07d7,_0x4fc51a[_0x2203('0x65')],'id');for(var _0x6319a3=0x0,_0x437095={};_0x6319a3<_0x5e07d7['length'];_0x6319a3+=0x1){_0x437095=_0x5e07d7[_0x6319a3];if(_['isUndefined'](_0x4fc51a['voiceExtensions'][_0x437095['id']])){_0x4fc51a[_0x2203('0x65')][_0x437095['id']]=new VoiceExtension(_0x437095);}else{_0x4fc51a[_0x2203('0x40')](_0x4fc51a[_0x2203('0x65')][_0x437095['id']],_0x437095);}}}return _0x4fc51a[_0x2203('0x65')];};};Realtime[_0x2203('0x39')][_0x2203('0x66')]=function(){var _0x3d1797=this;return function(_0x52f25e){clearCampaigns(_0x3d1797[_0x2203('0x14')]);for(var _0x74843=0x0;_0x74843<_0x52f25e[_0x2203('0x3a')];_0x74843+=0x1){_[_0x2203('0x67')](_0x3d1797[_0x2203('0x14')][_0x52f25e[_0x74843][_0x2203('0x22')]],_0x52f25e[_0x74843]);}return _0x3d1797[_0x2203('0x14')];};};Realtime['prototype'][_0x2203('0x68')]=function(){var _0x51a2fe=this;return function(_0x5d0176){if(_0x5d0176){freeIsNotKey(_0x5d0176,_0x51a2fe[_0x2203('0x1e')],'id');for(var _0x5cd030=0x0,_0xb9588e={};_0x5cd030<_0x5d0176[_0x2203('0x3a')];_0x5cd030+=0x1){_0xb9588e=_0x5d0176[_0x5cd030];if(_['isUndefined'](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']])){_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']]=new FaxAccount(_0xb9588e);}else{_0x51a2fe[_0x2203('0x40')](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']],_0xb9588e);}}}return _0x51a2fe[_0x2203('0x1e')];};};Realtime[_0x2203('0x39')]['initVoiceQueues']=function(){var _0x215638=this;return function(_0x3541b3){if(_0x3541b3){freeIsNotKey(_0x3541b3,_0x215638['voiceQueues'],'name');for(var _0x377176=0x0,_0x3fe71b={};_0x377176<_0x3541b3[_0x2203('0x3a')];_0x377176+=0x1){_0x3fe71b=_0x3541b3[_0x377176];if(_[_0x2203('0x3c')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]])){_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]]=new VoiceQueue(_0x3fe71b);}else{_0x215638[_0x2203('0x40')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]],_0x3fe71b);}}}return _0x215638[_0x2203('0x13')];};};module[_0x2203('0x69')]=Realtime; \ No newline at end of file +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(_0x2c1c48,_0x1e8ba4){var _0x2a1554=function(_0x346087){while(--_0x346087){_0x2c1c48['push'](_0x2c1c48['shift']());}};_0x2a1554(++_0x1e8ba4);}(_0xadb5,0xad));var _0x5adb=function(_0x3f16e5,_0x13f46d){_0x3f16e5=_0x3f16e5-0x0;var _0x273dd2=_0xadb5[_0x3f16e5];return _0x273dd2;};'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 diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index a76b665..40f951c 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 _0x9d80=['hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9d80,0x159));var _0x09d8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9d80[_0x14add3];return _0x4a174f;};'use strict';function mergeDBDataToRealtime(_0x16911b,_0xd7bb2c){var _0x5a3348=Object['assign']({},_0x16911b);for(var _0x25e4b3 in _0xd7bb2c){if(_0x5a3348[_0x09d8('0x0')](_0x25e4b3)){_0x5a3348[_0x25e4b3]=_0xd7bb2c[_0x25e4b3];}}return _0x5a3348;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0x671f=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x671f,0x17f));var _0xf671=function(_0x5ad0e1,_0x2466be){_0x5ad0e1=_0x5ad0e1-0x0;var _0x355c7b=_0x671f[_0x5ad0e1];return _0x355c7b;};'use strict';function mergeDBDataToRealtime(_0x248c71,_0x281948){var _0x3ad946=Object[_0xf671('0x0')]({},_0x248c71);for(var _0x3d82f8 in _0x281948){if(_0x3ad946[_0xf671('0x1')](_0x3d82f8)){_0x3ad946[_0x3d82f8]=_0x281948[_0x3d82f8];}}return _0x3ad946;}exports[_0xf671('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 17beae0..80b72dc 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 _0x9447=['substring','indexOf','mobile','phone','lastIndexOf','exports','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','agents','telephones','sync','realtime','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','find','accountcode','name','interface','format','prototype','voiceQueueReport','length','findAgent','connectedlinenum','assigned','lastAssignedTo','isNil','SIP/%s','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','match','getAgentByInternal','keys','getCallType','split','outbound','internal','destination','exten','type','dialer','lastdata','from-voip-provider','callerid','context','from-sip','calleridpreview','destinationchannel','channel','calleridnum','originatecalleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','UserId','membername','create','monitor','monitors','monitorFilename','createdAt','xcally-motion-preview','connectedlinename','xcally-motion-dialer','isArray','startsWith','Local'];(function(_0x11648a,_0x56d67e){var _0x5f467d=function(_0x3e2d3a){while(--_0x3e2d3a){_0x11648a['push'](_0x11648a['shift']());}};_0x5f467d(++_0x56d67e);}(_0x9447,0x1eb));var _0x7944=function(_0x537982,_0x52f379){_0x537982=_0x537982-0x0;var _0x17e8fd=_0x9447[_0x537982];return _0x17e8fd;};'use strict';var _=require('lodash');var moment=require(_0x7944('0x0'));var util=require('util');var config=require(_0x7944('0x1'));var ami=require(_0x7944('0x2'));var RpcVoiceAgentReport=require(_0x7944('0x3'));var RpcVoiceCallReport=require(_0x7944('0x4'));var RpcVoiceDialReport=require(_0x7944('0x5'));var RpcMemberReport=require(_0x7944('0x6'));var RpcVoiceQueueReport=require(_0x7944('0x7'));var RpcVoiceRecording=require(_0x7944('0x8'));var RpcVoiceTransferReport=require(_0x7944('0x9'));var VoiceQueueReport=require(_0x7944('0xa'));var VoiceCallReport=require(_0x7944('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x7944('0xc'));var UserReport=require(_0x7944('0xd'));function Report(_0x17dddb){this['realtime']=_0x17dddb;this['agents']=_0x17dddb[_0x7944('0xe')];this[_0x7944('0xf')]=_0x17dddb[_0x7944('0xf')];}Report['prototype'][_0x7944('0x10')]=function(_0x193c88){var _0x5e337e=new VoiceQueueReport(this[_0x7944('0x11')]);var _0xd467e=new VoiceAgentReport(this[_0x7944('0x11')]);var _0x39d3e3=new VoiceDialReport(this[_0x7944('0x11')]);var _0x490cb4=new VoiceCallReport(this[_0x7944('0x11')]);var _0x508f24=new UserReport(this[_0x7944('0x11')]);if(config[_0x7944('0x12')]&&config[_0x7944('0x12')][_0x7944('0x13')]){ami['on'](_0x7944('0x14'),this['voiceQueueReport'][_0x7944('0x15')](this));ami['on'](_0x7944('0x16'),this[_0x7944('0x17')][_0x7944('0x15')](this));ami['on'](_0x7944('0x18'),this[_0x7944('0x19')][_0x7944('0x15')](this));ami['on'](_0x7944('0x1a'),this[_0x7944('0x1b')]['bind'](this));ami['on'](_0x7944('0x1c'),this['blindTransfer'][_0x7944('0x15')](this));ami['on'](_0x7944('0x1d'),this[_0x7944('0x1e')][_0x7944('0x15')](this));}};Report['prototype']['findAgent']=function(_0x4de83c){var _0x7a1909;_0x7a1909=_[_0x7944('0x1f')](this[_0x7944('0xe')],function(_0x4bd3ba){return _0x4bd3ba[_0x7944('0x20')]==_0x4de83c||_0x4bd3ba[_0x7944('0x21')]==_0x4de83c;});if(_['isNil'](_0x7a1909)){var _0x5ab14c=_[_0x7944('0x1f')](this[_0x7944('0xf')],function(_0x321b50){return _0x321b50[_0x7944('0x20')]==_0x4de83c||_0x321b50[_0x7944('0x21')]==_0x4de83c;});if(_0x5ab14c){_0x7a1909=_['find'](this[_0x7944('0xe')],function(_0x54203d){return _0x54203d[_0x7944('0x22')]==util[_0x7944('0x23')]('SIP/%s',_0x5ab14c[_0x7944('0x21')]);});}}return _0x7a1909;};Report[_0x7944('0x24')][_0x7944('0x25')]=function(_0xdc3d50){for(var _0x5765d9=0x0;_0x5765d9<_0xdc3d50[_0x7944('0x26')];_0x5765d9+=0x1){var _0x14ddde=this[_0x7944('0x27')](_0xdc3d50[_0x5765d9][_0x7944('0x28')]);if(_0x14ddde){_0xdc3d50[_0x5765d9][_0x7944('0x20')]=_0x14ddde['accountcode'];_0xdc3d50[_0x5765d9][_0x7944('0x29')]=!![];_0xdc3d50[_0x5765d9][_0x7944('0x2a')]=_0x14ddde[_0x7944('0x21')];_0xdc3d50[_0x5765d9][_0x7944('0x22')]=_[_0x7944('0x2b')](_0x14ddde[_0x7944('0x22')])?util[_0x7944('0x23')](_0x7944('0x2c'),_0x14ddde[_0x7944('0x21')]):_0x14ddde['interface'];if(_0xdc3d50[_0x5765d9]['queuecallercomplete']){_0xdc3d50[_0x5765d9]['queuecallercompleteAt']=moment()[_0x7944('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0xdc3d50[_0x5765d9][_0x7944('0x2d')]){_0xdc3d50[_0x5765d9][_0x7944('0x2e')]=moment()[_0x7944('0x23')](_0x7944('0x2f'));}RpcMemberReport[_0x7944('0x25')](_0xdc3d50[_0x5765d9]);}RpcVoiceQueueReport['create'](_0xdc3d50[_0x5765d9]);}};function extractCalleridNumber(_0x550c4c){var _0x4228ab=_0x550c4c[_0x7944('0x30')](/<(.*?)>/);return _0x4228ab?_0x4228ab[0x1]:_0x550c4c;}Report[_0x7944('0x24')][_0x7944('0x31')]=function(_0x172bca){for(var _0x51bb34=0x0;_0x51bb34','calleridname','linkedid','transfers','uniqueid','blindTransfer','UserId','membername','monitors','createdAt','xcally-motion-preview','connectedlinename','isArray','forEach'];(function(_0x2cc0b3,_0x120bf1){var _0x1667ef=function(_0x3abcb4){while(--_0x3abcb4){_0x2cc0b3['push'](_0x2cc0b3['shift']());}};_0x1667ef(++_0x120bf1);}(_0x04c9,0x18a));var _0x904c=function(_0xe72df0,_0x50111a){_0xe72df0=_0xe72df0-0x0;var _0x4516ad=_0x04c9[_0xe72df0];return _0x4516ad;};'use strict';var _=require(_0x904c('0x0'));var moment=require(_0x904c('0x1'));var util=require('util');var config=require(_0x904c('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x904c('0x3'));var RpcVoiceCallReport=require(_0x904c('0x4'));var RpcVoiceDialReport=require(_0x904c('0x5'));var RpcMemberReport=require(_0x904c('0x6'));var RpcVoiceQueueReport=require(_0x904c('0x7'));var RpcVoiceRecording=require(_0x904c('0x8'));var RpcVoiceTransferReport=require(_0x904c('0x9'));var VoiceQueueReport=require(_0x904c('0xa'));var VoiceCallReport=require(_0x904c('0xb'));var VoiceAgentReport=require(_0x904c('0xc'));var VoiceDialReport=require(_0x904c('0xd'));var UserReport=require('./userReport');function Report(_0x14bb5b){this[_0x904c('0xe')]=_0x14bb5b;this[_0x904c('0xf')]=_0x14bb5b['agents'];this[_0x904c('0x10')]=_0x14bb5b[_0x904c('0x10')];}Report[_0x904c('0x11')][_0x904c('0x12')]=function(_0x37a1f4){var _0xa158d0=new VoiceQueueReport(this[_0x904c('0xe')]);var _0x38a240=new VoiceAgentReport(this['realtime']);var _0x752fc=new VoiceDialReport(this['realtime']);var _0x1066ca=new VoiceCallReport(this[_0x904c('0xe')]);var _0x4116a8=new UserReport(this['realtime']);if(config['xdr']&&config[_0x904c('0x13')][_0x904c('0x14')]){ami['on'](_0x904c('0x15'),this['voiceQueueReport'][_0x904c('0x16')](this));ami['on'](_0x904c('0x17'),this[_0x904c('0x18')][_0x904c('0x16')](this));ami['on']('custom:voiceAgentReport',this[_0x904c('0x19')][_0x904c('0x16')](this));ami['on'](_0x904c('0x1a'),this['voiceDialReport'][_0x904c('0x16')](this));ami['on'](_0x904c('0x1b'),this['blindTransfer'][_0x904c('0x16')](this));ami['on'](_0x904c('0x1c'),this[_0x904c('0x1d')][_0x904c('0x16')](this));}};Report[_0x904c('0x11')][_0x904c('0x1e')]=function(_0x4a2607){var _0xef987b;_0xef987b=_[_0x904c('0x1f')](this[_0x904c('0xf')],function(_0x5a6e42){return _0x5a6e42[_0x904c('0x20')]==_0x4a2607||_0x5a6e42[_0x904c('0x21')]==_0x4a2607;});if(_[_0x904c('0x22')](_0xef987b)){var _0x2df6f1=_['find'](this['telephones'],function(_0x42a7a9){return _0x42a7a9['accountcode']==_0x4a2607||_0x42a7a9[_0x904c('0x21')]==_0x4a2607;});if(_0x2df6f1){_0xef987b=_[_0x904c('0x1f')](this[_0x904c('0xf')],function(_0x1465d6){return _0x1465d6['interface']==util[_0x904c('0x23')](_0x904c('0x24'),_0x2df6f1[_0x904c('0x21')]);});}}return _0xef987b;};Report['prototype'][_0x904c('0x25')]=function(_0x4db3c9){for(var _0x13ac16=0x0;_0x13ac16<_0x4db3c9[_0x904c('0x26')];_0x13ac16+=0x1){var _0x237130=this['findAgent'](_0x4db3c9[_0x13ac16][_0x904c('0x27')]);if(_0x237130){_0x4db3c9[_0x13ac16]['accountcode']=_0x237130[_0x904c('0x20')];_0x4db3c9[_0x13ac16][_0x904c('0x28')]=!![];_0x4db3c9[_0x13ac16][_0x904c('0x29')]=_0x237130[_0x904c('0x21')];_0x4db3c9[_0x13ac16][_0x904c('0x2a')]=_[_0x904c('0x22')](_0x237130[_0x904c('0x2a')])?util['format'](_0x904c('0x24'),_0x237130[_0x904c('0x21')]):_0x237130['interface'];if(_0x4db3c9[_0x13ac16][_0x904c('0x2b')]){_0x4db3c9[_0x13ac16][_0x904c('0x2c')]=moment()[_0x904c('0x23')](_0x904c('0x2d'));}if(_0x4db3c9[_0x13ac16]['queuecallerexit']){_0x4db3c9[_0x13ac16][_0x904c('0x2e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x904c('0x25')](_0x4db3c9[_0x13ac16]);}RpcVoiceQueueReport[_0x904c('0x2f')](_0x4db3c9[_0x13ac16]);}};function extractCalleridNumber(_0x4d6adc){var _0x2634a3=_0x4d6adc[_0x904c('0x30')](/<(.*?)>/);return _0x2634a3?_0x2634a3[0x1]:_0x4d6adc;}Report['prototype'][_0x904c('0x31')]=function(_0x50b0e0){for(var _0x3c8898=0x0;_0x3c8898{delete this[_0x20a6('0xb')][_0x1a9a8c];},_0x540391);}};module[_0x20a6('0x9e')]=VoiceAgentReport; \ No newline at end of file +var _0x6daf=['syncBlindTransfer','emit','isNotNull','isUndefined','prototype','syncAgentCalled','info','membername','destuniqueid','debug','uniqueid','inspect','mandatoryDisposition','type','voice','omit','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','format','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','merge','interface','pick','queue','destconnectedlinenum','accountcode','exten','custom:agentconnect','answeredelsewheredestinationuniqueid','answeredelsewheremembername','lastevent','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','agentringnoanswerAt','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','name','user:agentringnoanswer','custom:agentringnoanswer','assign','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','addVariable','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','value','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','deleteChannelAfterTimeout','exports','lodash','moment','util','ioredis','../../../config/logger','../ami','defaults','redis','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer'];(function(_0x2d4539,_0x3ac0aa){var _0x23dd59=function(_0x34e7aa){while(--_0x34e7aa){_0x2d4539['push'](_0x2d4539['shift']());}};_0x23dd59(++_0x3ac0aa);}(_0x6daf,0x115));var _0xf6da=function(_0x22fe37,_0x5541f8){_0x22fe37=_0x22fe37-0x0;var _0x5981ac=_0x6daf[_0x22fe37];return _0x5981ac;};'use strict';var _=require(_0xf6da('0x0'));var moment=require(_0xf6da('0x1'));var util=require(_0xf6da('0x2'));var Redis=require(_0xf6da('0x3'));var config=require('../../../config/environment');var logger=require(_0xf6da('0x4'))('ami');var ami=require(_0xf6da('0x5'));config['redis']=_[_0xf6da('0x6')](config[_0xf6da('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xf6da('0x8'))(new Redis(config[_0xf6da('0x7')]));function VoiceAgentReport(_0x2c8836){this[_0xf6da('0x9')]={};this[_0xf6da('0xa')]=_0x2c8836[_0xf6da('0x9')];this[_0xf6da('0xb')]=_0x2c8836[_0xf6da('0xb')];this[_0xf6da('0xc')]=_0x2c8836[_0xf6da('0xc')];this[_0xf6da('0xd')]={};ami['on']('agentcalled',this['syncAgentCalled'][_0xf6da('0xe')](this));ami['on'](_0xf6da('0xf'),this[_0xf6da('0x10')][_0xf6da('0xe')](this));ami['on'](_0xf6da('0x11'),this[_0xf6da('0x12')][_0xf6da('0xe')](this));ami['on'](_0xf6da('0x13'),this[_0xf6da('0x14')]['bind'](this));ami['on'](_0xf6da('0x15'),this[_0xf6da('0x16')][_0xf6da('0xe')](this));ami['on'](_0xf6da('0x17'),this[_0xf6da('0x18')]['bind'](this));ami['on'](_0xf6da('0x19'),this[_0xf6da('0x1a')][_0xf6da('0xe')](this));ami['on'](_0xf6da('0x1b'),this[_0xf6da('0x1c')][_0xf6da('0xe')](this));ami['on'](_0xf6da('0x1d'),this[_0xf6da('0x1e')][_0xf6da('0xe')](this));ami['on'](_0xf6da('0x1f'),this[_0xf6da('0x20')][_0xf6da('0xe')](this));ami['on']('blindtransfer',this[_0xf6da('0x21')][_0xf6da('0xe')](this));}VoiceAgentReport['prototype']['emit']=function(_0x4c639f,_0x3f6e4d,_0x4d9ad9){io['to'](_0x4c639f)[_0xf6da('0x22')](_0x3f6e4d,_0x4d9ad9);};VoiceAgentReport['prototype'][_0xf6da('0x23')]=function(_0x293f07){return _0x293f07!==null&&!_[_0xf6da('0x24')](_0x293f07);};VoiceAgentReport[_0xf6da('0x25')][_0xf6da('0x26')]=function(_0x51e7ae){try{if(this[_0xf6da('0x23')](_0x51e7ae)){logger[_0xf6da('0x27')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x51e7ae['uniqueid'],_0x51e7ae[_0xf6da('0x28')],_0x51e7ae[_0xf6da('0x29')]);logger[_0xf6da('0x2a')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x51e7ae[_0xf6da('0x2b')],util[_0xf6da('0x2c')](_0x51e7ae,{'showHidden':![],'depth':null}));if(_[_0xf6da('0x24')](this[_0xf6da('0x9')][_0x51e7ae['uniqueid']])){this[_0xf6da('0x9')][_0x51e7ae[_0xf6da('0x2b')]]={};}var _0x1e1bb1=this[_0xf6da('0xc')][_0x51e7ae['interface']];var _0x33e47b=this[_0xf6da('0x9')][_0x51e7ae[_0xf6da('0x2b')]][_0x51e7ae[_0xf6da('0x29')]];var _0x5a64cf=this['voiceQueues'][_0x51e7ae['queue']];var _0x179460=this[_0xf6da('0xd')][_0x51e7ae[_0xf6da('0x2b')]];if(_[_0xf6da('0x24')](_0x33e47b)){_0x33e47b={'agentcalledAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','mandatoryDisposition':_0x5a64cf&&_0x5a64cf[_0xf6da('0x2d')]?_0x5a64cf[_0xf6da('0x2d')]:![],'type':_0x5a64cf&&_0x5a64cf[_0xf6da('0x2e')]?_0x5a64cf[_0xf6da('0x2e')]:'inbound','variables':_0x179460,'motionChannel':_0xf6da('0x2f')};}Object['assign'](_0x33e47b,_[_0xf6da('0x30')](_0x51e7ae,['event','privilege']));this['channels'][_0x51e7ae[_0xf6da('0x2b')]][_0x51e7ae[_0xf6da('0x29')]]=_0x33e47b;logger['debug'](_0xf6da('0x31'),_0x51e7ae[_0xf6da('0x2b')],util[_0xf6da('0x2c')](_0x33e47b,{'showHidden':![],'depth':null}));ami[_0xf6da('0x22')](_0xf6da('0x32'),_0x33e47b);var _0x2935b5={'id':_0x1e1bb1['id'],'calleridnum':_0x33e47b[_0xf6da('0x33')],'queue':_0x33e47b['queue'],'variables':_0x33e47b[_0xf6da('0xd')],'uniqueid':_0x51e7ae['uniqueid']};logger[_0xf6da('0x2a')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x51e7ae['uniqueid'],util[_0xf6da('0x2c')](_0x2935b5,{'showHidden':![],'depth':null}));this[_0xf6da('0x22')](util[_0xf6da('0x34')](_0xf6da('0x35'),_0x51e7ae[_0xf6da('0x28')]),_0xf6da('0x36'),_0x2935b5);}}catch(_0xcb6a02){logger[_0xf6da('0x37')](_0xf6da('0x38'),_0x51e7ae[_0xf6da('0x2b')],util[_0xf6da('0x2c')](_0xcb6a02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xf6da('0x25')][_0xf6da('0x10')]=function(_0x3aceeb){try{if(this[_0xf6da('0x23')](_0x3aceeb)){if(this[_0xf6da('0x9')][_0x3aceeb[_0xf6da('0x2b')]]){for(var _0x54d0a7 in this[_0xf6da('0x9')][_0x3aceeb[_0xf6da('0x2b')]]){if(this['channels'][_0x3aceeb[_0xf6da('0x2b')]][_0xf6da('0x39')](_0x54d0a7)){if(_0x3aceeb['destuniqueid']===_0x54d0a7){logger[_0xf6da('0x27')](_0xf6da('0x3a'),_0x3aceeb[_0xf6da('0x2b')],_0x3aceeb[_0xf6da('0x28')],_0x3aceeb[_0xf6da('0x29')]);this[_0xf6da('0x9')][_0x3aceeb[_0xf6da('0x2b')]][_0x54d0a7][_0xf6da('0x3b')]=moment()[_0xf6da('0x34')](_0xf6da('0x3c'));this[_0xf6da('0x9')][_0x3aceeb[_0xf6da('0x2b')]][_0x54d0a7][_0xf6da('0x3d')]=_0x3aceeb[_0xf6da('0x3d')];this['channels'][_0x3aceeb[_0xf6da('0x2b')]][_0x54d0a7][_0xf6da('0x3e')]=_0x3aceeb[_0xf6da('0x3e')];this[_0xf6da('0x9')][_0x3aceeb['uniqueid']][_0x54d0a7][_0xf6da('0x3f')]=_0x3aceeb['destchannelstate'];this[_0xf6da('0x9')][_0x3aceeb[_0xf6da('0x2b')]][_0x54d0a7][_0xf6da('0x40')]=_0x3aceeb['destchannelstatedesc'];this[_0xf6da('0x9')][_0x3aceeb[_0xf6da('0x2b')]][_0x54d0a7][_0xf6da('0x41')]=_0x3aceeb['holdtime'];this[_0xf6da('0x9')][_0x3aceeb[_0xf6da('0x2b')]][_0x54d0a7]['lastevent']=_0xf6da('0x42');_[_0xf6da('0x43')](this[_0xf6da('0xc')][_0x3aceeb[_0xf6da('0x44')]],_[_0xf6da('0x45')](_0x3aceeb,[_0xf6da('0x46'),_0xf6da('0x47')]));var _0x5a57a6=this['agents'][_0x3aceeb[_0xf6da('0x44')]];var _0x5b921e={'id':_0x5a57a6['id'],'name':_0x5a57a6['name'],'agentconnected':!![],'destaccountcode':_0x5a57a6[_0xf6da('0x48')],'destconnectedlinenum':this[_0xf6da('0x9')][_0x3aceeb['uniqueid']][_0x3aceeb[_0xf6da('0x29')]][_0xf6da('0x49')],'queue':this[_0xf6da('0x9')][_0x3aceeb[_0xf6da('0x2b')]][_0x3aceeb[_0xf6da('0x29')]][_0xf6da('0x46')],'uniqueid':this[_0xf6da('0x9')][_0x3aceeb[_0xf6da('0x2b')]][_0x3aceeb[_0xf6da('0x29')]][_0xf6da('0x2b')]};ami['emit'](_0xf6da('0x4a'),this[_0xf6da('0x9')][_0x3aceeb['uniqueid']][_0x3aceeb[_0xf6da('0x29')]]);this[_0xf6da('0x22')](util['format'](_0xf6da('0x35'),_0x3aceeb[_0xf6da('0x28')]),'user:agentconnect',_0x5b921e);}else if(!this[_0xf6da('0x9')][_0x3aceeb[_0xf6da('0x2b')]][_0x54d0a7][_0xf6da('0x11')]&&!this[_0xf6da('0x9')][_0x3aceeb[_0xf6da('0x2b')]][_0x54d0a7]['agentcomplete']){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x3aceeb[_0xf6da('0x2b')],this[_0xf6da('0x9')][_0x3aceeb[_0xf6da('0x2b')]][_0x54d0a7][_0xf6da('0x28')],_0x54d0a7);this[_0xf6da('0x9')][_0x3aceeb[_0xf6da('0x2b')]][_0x54d0a7][_0xf6da('0x11')]=!![];this[_0xf6da('0x9')][_0x3aceeb[_0xf6da('0x2b')]][_0x54d0a7]['agentringnoanswerAt']=moment()['format'](_0xf6da('0x3c'));this['channels'][_0x3aceeb[_0xf6da('0x2b')]][_0x54d0a7][_0xf6da('0x4b')]=_0x3aceeb[_0xf6da('0x29')];this[_0xf6da('0x9')][_0x3aceeb['uniqueid']][_0x54d0a7][_0xf6da('0x4c')]=_0x3aceeb[_0xf6da('0x28')];this[_0xf6da('0x9')][_0x3aceeb['uniqueid']][_0x54d0a7][_0xf6da('0x4d')]=_0xf6da('0x4e');this[_0xf6da('0x9')][_0x3aceeb[_0xf6da('0x2b')]][_0x54d0a7][_0xf6da('0x4f')]=_0xf6da('0x4e');logger[_0xf6da('0x2a')](_0xf6da('0x50'),_0x3aceeb[_0xf6da('0x2b')],util[_0xf6da('0x2c')](this[_0xf6da('0x9')][_0x3aceeb['uniqueid']][_0x54d0a7],{'showHidden':![],'depth':null}));ami['emit'](_0xf6da('0x51'),this[_0xf6da('0x9')][_0x3aceeb[_0xf6da('0x2b')]][_0x54d0a7]);}else{logger[_0xf6da('0x2a')]('[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken',_0x3aceeb[_0xf6da('0x2b')]);}}}}}}catch(_0x3e6bd6){logger[_0xf6da('0x37')](_0xf6da('0x52'),_0x3aceeb['uniqueid'],util[_0xf6da('0x2c')](_0x3e6bd6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xf6da('0x25')]['syncAgentRingNoAnswer']=function(_0x28c688){try{if(this[_0xf6da('0x23')](_0x28c688)){logger['debug'](_0xf6da('0x53'),_0x28c688['uniqueid'],util[_0xf6da('0x2c')](_0x28c688,{'showHidden':![],'depth':null}));if(this[_0xf6da('0x9')][_0x28c688[_0xf6da('0x2b')]]&&this[_0xf6da('0x9')][_0x28c688[_0xf6da('0x2b')]][_0x28c688[_0xf6da('0x29')]]){logger[_0xf6da('0x27')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x28c688[_0xf6da('0x2b')],_0x28c688['membername'],_0x28c688[_0xf6da('0x29')]);var _0x3f9ea3=this[_0xf6da('0xc')][_0x28c688[_0xf6da('0x44')]];var _0x3a7832=this[_0xf6da('0x9')][_0x28c688[_0xf6da('0x2b')]][_0x28c688[_0xf6da('0x29')]];_0x3a7832[_0xf6da('0x11')]=!![];_0x3a7832[_0xf6da('0x54')]=moment()[_0xf6da('0x34')](_0xf6da('0x3c'));_0x3a7832['lastevent']='rejected';_0x3a7832['reason']='rejected';var _0x5dea02={'id':_0x3f9ea3['id'],'name':_0x3f9ea3['name'],'queue':_0x3a7832['queue'],'uniqueid':_0x3a7832[_0xf6da('0x2b')]};logger['debug'](_0xf6da('0x55'),_0x28c688[_0xf6da('0x2b')],util['inspect'](_0x5dea02,{'showHidden':![],'depth':null}));this[_0xf6da('0x22')](util[_0xf6da('0x34')](_0xf6da('0x35'),_0x3f9ea3[_0xf6da('0x56')]),_0xf6da('0x57'),_0x5dea02);ami['emit'](_0xf6da('0x58'),_0x3a7832);this[_0xf6da('0x9')][_0x28c688['uniqueid']][_0x28c688['destuniqueid']]=Object[_0xf6da('0x59')]({},_0x3a7832);}}}catch(_0x3fd529){logger['error'](_0xf6da('0x5a'),_0x28c688[_0xf6da('0x2b')],util[_0xf6da('0x2c')](_0x3fd529,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xf6da('0x25')]['syncQueueCallerAbandon']=function(_0x639293){try{if(this[_0xf6da('0x23')](_0x639293)){logger[_0xf6da('0x2a')](_0xf6da('0x5b'),_0x639293[_0xf6da('0x2b')],util[_0xf6da('0x2c')](_0x639293,{'showHidden':![],'depth':null}));if(this[_0xf6da('0x9')][_0x639293['uniqueid']]){for(var _0x5ef72e in this[_0xf6da('0x9')][_0x639293['uniqueid']]){if(this[_0xf6da('0x9')][_0x639293[_0xf6da('0x2b')]][_0xf6da('0x39')](_0x5ef72e)&&!this[_0xf6da('0x9')][_0x639293[_0xf6da('0x2b')]][_0x5ef72e][_0xf6da('0x11')]&&!this[_0xf6da('0x9')][_0x639293[_0xf6da('0x2b')]][_0x5ef72e][_0xf6da('0x15')]){logger[_0xf6da('0x27')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x639293[_0xf6da('0x2b')],this[_0xf6da('0x9')][_0x639293[_0xf6da('0x2b')]][_0x5ef72e][_0xf6da('0x28')],_0x5ef72e);this[_0xf6da('0x9')][_0x639293[_0xf6da('0x2b')]][_0x5ef72e]['agentringnoanswer']=!![];this[_0xf6da('0x9')][_0x639293['uniqueid']][_0x5ef72e][_0xf6da('0x54')]=moment()[_0xf6da('0x34')](_0xf6da('0x3c'));this[_0xf6da('0x9')][_0x639293[_0xf6da('0x2b')]][_0x5ef72e][_0xf6da('0x4d')]=_0xf6da('0x5c');this[_0xf6da('0x9')][_0x639293[_0xf6da('0x2b')]][_0x5ef72e][_0xf6da('0x4f')]=_0xf6da('0x5c');logger[_0xf6da('0x2a')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x639293[_0xf6da('0x2b')],util[_0xf6da('0x2c')](this[_0xf6da('0x9')][_0x639293['uniqueid']][_0x5ef72e],{'showHidden':![],'depth':null}));ami[_0xf6da('0x22')](_0xf6da('0x5d'),this[_0xf6da('0x9')][_0x639293['uniqueid']][_0x5ef72e]);}}}}}catch(_0x41c9bc){logger[_0xf6da('0x37')]('[%s][voiceAgentReport][queuecallerabandon]',_0x639293['uniqueid'],util['inspect'](_0x41c9bc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xf6da('0x25')][_0xf6da('0x16')]=function(_0x4d7a40){try{if(this[_0xf6da('0x23')](_0x4d7a40)){logger[_0xf6da('0x2a')](_0xf6da('0x5e'),_0x4d7a40['uniqueid'],util[_0xf6da('0x2c')](_0x4d7a40,{'showHidden':![],'depth':null}));if(this['channels'][_0x4d7a40[_0xf6da('0x2b')]]){for(var _0x3248a1 in this[_0xf6da('0x9')][_0x4d7a40[_0xf6da('0x2b')]]){if(this[_0xf6da('0x9')][_0x4d7a40['uniqueid']][_0xf6da('0x39')](_0x3248a1)){if(this[_0xf6da('0x9')][_0x4d7a40[_0xf6da('0x2b')]][_0x3248a1][_0xf6da('0x3b')]&&!this[_0xf6da('0x9')][_0x4d7a40[_0xf6da('0x2b')]][_0x3248a1][_0xf6da('0x15')]){logger[_0xf6da('0x27')](_0xf6da('0x5f'),_0x4d7a40[_0xf6da('0x2b')],this[_0xf6da('0x9')][_0x4d7a40['uniqueid']][_0x3248a1][_0xf6da('0x28')],_0x3248a1);this['channels'][_0x4d7a40[_0xf6da('0x2b')]][_0x3248a1]['agentcomplete']=!![];this[_0xf6da('0x9')][_0x4d7a40[_0xf6da('0x2b')]][_0x3248a1][_0xf6da('0x60')]=moment()[_0xf6da('0x34')](_0xf6da('0x3c'));this[_0xf6da('0x9')][_0x4d7a40[_0xf6da('0x2b')]][_0x3248a1][_0xf6da('0x4d')]=_0xf6da('0x61');this['channels'][_0x4d7a40[_0xf6da('0x2b')]][_0x3248a1][_0xf6da('0x4f')]=_0x4d7a40[_0xf6da('0x4f')]==_0xf6da('0x62')?_0xf6da('0x63'):_0x4d7a40[_0xf6da('0x4f')];this[_0xf6da('0x9')][_0x4d7a40[_0xf6da('0x2b')]][_0x3248a1][_0xf6da('0x64')]=_0x4d7a40[_0xf6da('0x64')];if(this[_0xf6da('0xb')][_0x4d7a40[_0xf6da('0x46')]]&&this['voiceQueues'][_0x4d7a40[_0xf6da('0x46')]]['acw']){this[_0xf6da('0x9')][_0x4d7a40[_0xf6da('0x2b')]][_0x3248a1][_0xf6da('0x65')]=this[_0xf6da('0xb')][_0x4d7a40['queue']][_0xf6da('0x66')];this[_0xf6da('0x9')][_0x4d7a40['uniqueid']][_0x3248a1][_0xf6da('0x67')]=!![];}this[_0xf6da('0xc')][_0x4d7a40[_0xf6da('0x44')]]=_[_0xf6da('0x30')](this[_0xf6da('0xc')][_0x4d7a40[_0xf6da('0x44')]],[_0xf6da('0x46'),_0xf6da('0x47')]);logger[_0xf6da('0x2a')](_0xf6da('0x68'),_0x4d7a40[_0xf6da('0x2b')],util[_0xf6da('0x2c')](this[_0xf6da('0x9')][_0x4d7a40[_0xf6da('0x2b')]][_0x3248a1],{'showHidden':![],'depth':null}));ami['emit'](_0xf6da('0x69'),this[_0xf6da('0x9')][_0x4d7a40[_0xf6da('0x2b')]][_0x3248a1]);logger[_0xf6da('0x2a')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x4d7a40[_0xf6da('0x2b')],util['inspect']({'id':this[_0xf6da('0xc')][_0x4d7a40[_0xf6da('0x44')]]['id'],'destaccountcode':_0x4d7a40['destaccountcode']},{'showHidden':![],'depth':null}));this[_0xf6da('0x22')](util[_0xf6da('0x34')](_0xf6da('0x35'),_0x4d7a40[_0xf6da('0x28')]),_0xf6da('0x6a'),{'id':this[_0xf6da('0xc')][_0x4d7a40[_0xf6da('0x44')]]['id'],'destaccountcode':Number(_0x4d7a40['destaccountcode'])});}}}}}}catch(_0x378114){logger[_0xf6da('0x37')](_0xf6da('0x6b'),_0x4d7a40['uniqueid'],util['inspect'](_0x378114,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xf6da('0x18')]=function(_0x225336){try{if(this['isNotNull'](_0x225336)){logger['debug']('[%s][voiceAgentReport][varset]\x20event:',_0x225336[_0xf6da('0x2b')],util[_0xf6da('0x2c')](_0x225336,{'showHidden':![],'depth':null}));this[_0xf6da('0x6c')](_0x225336[_0xf6da('0x2b')],_['keys'](_0x225336[_0xf6da('0x6d')])[0x0],_0x225336['value']);if(this[_0xf6da('0x9')][_0x225336[_0xf6da('0x2b')]]){for(var _0x1c69b9 in this['channels'][_0x225336[_0xf6da('0x2b')]]){if(this[_0xf6da('0x9')][_0x225336[_0xf6da('0x2b')]][_0xf6da('0x39')](_0x1c69b9)){logger[_0xf6da('0x27')](_0xf6da('0x6e'),_0x225336['uniqueid'],_0x1c69b9,_[_0xf6da('0x6f')](_0x225336[_0xf6da('0x6d')])[0x0],_0x225336[_0xf6da('0x70')]);if(_['isUndefined'](this['channels'][_0x225336[_0xf6da('0x2b')]][_0x1c69b9][_0xf6da('0xd')])){this[_0xf6da('0x9')][_0x225336[_0xf6da('0x2b')]][_0x1c69b9][_0xf6da('0xd')]={};}this[_0xf6da('0x9')][_0x225336['uniqueid']][_0x1c69b9][_0xf6da('0xd')]=this[_0xf6da('0xd')][_0x225336[_0xf6da('0x2b')]];}}}}}catch(_0x546288){logger[_0xf6da('0x37')]('[%s][voiceAgentReport][varset]',_0x225336[_0xf6da('0x2b')],util['inspect'](_0x546288,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xf6da('0x25')][_0xf6da('0x6c')]=function(_0x588eea,_0x2fec4f,_0x1e4804){var _0x43ec08=[_0xf6da('0x71'),_0xf6da('0x72'),_0xf6da('0x73'),_0xf6da('0x74'),'rtpaudioqosloss',_0xf6da('0x75'),_0xf6da('0x76'),'rtpaudioqosrttbridged',_0xf6da('0x77'),_0xf6da('0x78'),_0xf6da('0x79'),_0xf6da('0x7a'),_0xf6da('0x7b'),_0xf6da('0x7c'),_0xf6da('0x7d'),'memberlastcall',_0xf6da('0x28'),_0xf6da('0x7e'),_0xf6da('0x7f')];if(!_['isNil'](_0x2fec4f)&&!_['includes'](_0x43ec08,_0x2fec4f)){if(_[_0xf6da('0x24')](this['variables'][_0x588eea])){this['variables'][_0x588eea]={};}this[_0xf6da('0xd')][_0x588eea][_0x2fec4f]=_0x1e4804;}};VoiceAgentReport['prototype']['syncHangup']=function(_0x1c708d){try{if(this[_0xf6da('0x23')](_0x1c708d)){logger[_0xf6da('0x2a')](_0xf6da('0x80'),_0x1c708d[_0xf6da('0x2b')],util[_0xf6da('0x2c')](_0x1c708d,{'showHidden':![],'depth':null}));if(this[_0xf6da('0x9')][_0x1c708d['uniqueid']]){for(var _0x2bc63d in this['channels'][_0x1c708d[_0xf6da('0x2b')]]){if(this[_0xf6da('0x9')][_0x1c708d['uniqueid']][_0xf6da('0x39')](_0x2bc63d)){if(this[_0xf6da('0x9')][_0x1c708d[_0xf6da('0x2b')]][_0x2bc63d][_0xf6da('0x4f')]==_0xf6da('0x62')&&this[_0xf6da('0x9')][_0x1c708d['uniqueid']][_0x2bc63d][_0xf6da('0x15')]){logger[_0xf6da('0x27')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x1c708d[_0xf6da('0x2b')],_0x2bc63d);this['channels'][_0x1c708d[_0xf6da('0x2b')]][_0x2bc63d][_0xf6da('0x60')]=moment()[_0xf6da('0x34')](_0xf6da('0x3c'));}}}logger[_0xf6da('0x2a')](_0xf6da('0x81'),_0x1c708d[_0xf6da('0x2b')],util[_0xf6da('0x2c')](_[_0xf6da('0x82')](this[_0xf6da('0x9')][_0x1c708d['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0xf6da('0x22')](_0xf6da('0x83'),_[_0xf6da('0x82')](this[_0xf6da('0x9')][_0x1c708d[_0xf6da('0x2b')]]));this['deleteChannelAfterTimeout'](_0x1c708d[_0xf6da('0x2b')]);}if(this[_0xf6da('0xd')][_0x1c708d[_0xf6da('0x2b')]]){delete this[_0xf6da('0xd')][_0x1c708d[_0xf6da('0x2b')]];}}}catch(_0x1ef9f5){logger['error'](_0xf6da('0x84'),_0x1c708d['uniqueid'],util['inspect'](_0x1ef9f5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xf6da('0x25')][_0xf6da('0x20')]=function(_0xf2965b){try{if(this[_0xf6da('0x23')](_0xf2965b)){logger[_0xf6da('0x2a')](_0xf6da('0x85'),_0xf2965b[_0xf6da('0x2b')],util[_0xf6da('0x2c')](_0xf2965b,{'showHidden':![],'depth':null}));if(this[_0xf6da('0x9')][_0xf2965b[_0xf6da('0x86')]]){for(var _0x24ce34 in this[_0xf6da('0x9')][_0xf2965b['transfereeuniqueid']]){if(this[_0xf6da('0x9')][_0xf2965b[_0xf6da('0x86')]][_0xf6da('0x39')](_0x24ce34)){if(_0xf2965b[_0xf6da('0x87')]===_0x24ce34){logger['info'](_0xf6da('0x88'),_0xf2965b[_0xf6da('0x2b')],this[_0xf6da('0x9')][_0xf2965b[_0xf6da('0x86')]][_0x24ce34][_0xf6da('0x28')],_0x24ce34);var _0x42f260=moment();this['channels'][_0xf2965b[_0xf6da('0x86')]][_0x24ce34][_0xf6da('0x15')]=!![];this[_0xf6da('0x9')][_0xf2965b[_0xf6da('0x86')]][_0x24ce34][_0xf6da('0x60')]=moment()[_0xf6da('0x34')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xf6da('0x9')][_0xf2965b[_0xf6da('0x86')]][_0x24ce34][_0xf6da('0x4d')]=_0xf6da('0x61');this[_0xf6da('0x9')][_0xf2965b[_0xf6da('0x86')]][_0x24ce34][_0xf6da('0x4f')]=_0xf6da('0x62');this['channels'][_0xf2965b['transfereeuniqueid']][_0x24ce34]['talktime']=_0x42f260['diff'](this[_0xf6da('0x9')][_0xf2965b[_0xf6da('0x86')]][_0x24ce34]['agentconnectAt'],_0xf6da('0x89'));}}}}if(this[_0xf6da('0x9')][_0xf2965b[_0xf6da('0x8a')]]){var _0xd00fb4=this[_0xf6da('0x9')][_0xf2965b[_0xf6da('0x8a')]];this[_0xf6da('0x9')][_0xf2965b['secondtransfereruniqueid']]=this[_0xf6da('0x9')][_0xf2965b['transfereeuniqueid']];this[_0xf6da('0x9')][_0xf2965b[_0xf6da('0x86')]]=_0xd00fb4;}}}catch(_0x5b9424){logger[_0xf6da('0x37')](_0xf6da('0x8b'),_0xf2965b[_0xf6da('0x2b')],util[_0xf6da('0x2c')](_0x5b9424,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xf6da('0x25')][_0xf6da('0x21')]=function(_0x56a6ea){try{if(this[_0xf6da('0x23')](_0x56a6ea)){logger['debug']('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x56a6ea[_0xf6da('0x2b')],util['inspect'](_0x56a6ea,{'showHidden':![],'depth':null}));if(this[_0xf6da('0x9')][_0x56a6ea[_0xf6da('0x86')]]){for(var _0x183ace in this['channels'][_0x56a6ea[_0xf6da('0x86')]]){if(this[_0xf6da('0x9')][_0x56a6ea[_0xf6da('0x86')]]['hasOwnProperty'](_0x183ace)){if(_0x56a6ea[_0xf6da('0x8c')]===_0x183ace){logger[_0xf6da('0x27')](_0xf6da('0x8d'),_0x56a6ea[_0xf6da('0x2b')],this[_0xf6da('0x9')][_0x56a6ea[_0xf6da('0x86')]][_0x183ace][_0xf6da('0x28')],_0x183ace);var _0x1377b=moment();this[_0xf6da('0x9')][_0x56a6ea[_0xf6da('0x86')]][_0x183ace][_0xf6da('0x15')]=!![];this['channels'][_0x56a6ea[_0xf6da('0x86')]][_0x183ace]['agentcompleteAt']=_0x1377b;this[_0xf6da('0x9')][_0x56a6ea[_0xf6da('0x86')]][_0x183ace][_0xf6da('0x4d')]=_0xf6da('0x61');this[_0xf6da('0x9')][_0x56a6ea['transfereeuniqueid']][_0x183ace][_0xf6da('0x4f')]=_0xf6da('0x62');this['channels'][_0x56a6ea['transfereeuniqueid']][_0x183ace][_0xf6da('0x64')]=_0x1377b[_0xf6da('0x8e')](this[_0xf6da('0x9')][_0x56a6ea[_0xf6da('0x86')]][_0x183ace]['agentconnectAt'],_0xf6da('0x89'));}}}}}}catch(_0x2ac7e2){logger[_0xf6da('0x37')]('[%s][voiceAgentReport][blindtransfer]',_0x56a6ea['uniqueid'],util['inspect'](_0x2ac7e2,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xf6da('0x1c')]=function(_0x3d07cc){var _0x50b3c4='';try{if(this[_0xf6da('0x23')](_0x3d07cc)){logger[_0xf6da('0x2a')](_0xf6da('0x8f'),_0x3d07cc[_0xf6da('0x2b')],util[_0xf6da('0x2c')](_0x3d07cc,{'showHidden':![],'depth':null}));if(_0x3d07cc[_0xf6da('0x90')]){_0x50b3c4=_0x3d07cc[_0xf6da('0x90')][_0xf6da('0x91')](0x0,_0x3d07cc[_0xf6da('0x90')][_0xf6da('0x92')]('-'));if(this[_0xf6da('0xc')][_0x50b3c4]){logger[_0xf6da('0x27')](_0xf6da('0x93'),_0x3d07cc[_0xf6da('0x2b')],_0x50b3c4);this[_0xf6da('0xc')][_0x50b3c4][_0xf6da('0x94')]=!![];}}}}catch(_0x582066){logger[_0xf6da('0x37')](_0xf6da('0x95'),_0x3d07cc[_0xf6da('0x2b')],util[_0xf6da('0x2c')](_0x582066,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xf6da('0x25')][_0xf6da('0x1e')]=function(_0x1584ae){var _0x38149c='';try{if(this[_0xf6da('0x23')](_0x1584ae)){logger[_0xf6da('0x2a')](_0xf6da('0x96'),_0x1584ae[_0xf6da('0x2b')],util[_0xf6da('0x2c')](_0x1584ae,{'showHidden':![],'depth':null}));if(_0x1584ae[_0xf6da('0x90')]){_0x38149c=_0x1584ae[_0xf6da('0x90')]['substring'](0x0,_0x1584ae[_0xf6da('0x90')]['lastIndexOf']('-'));if(this[_0xf6da('0xc')][_0x38149c]){logger[_0xf6da('0x27')](_0xf6da('0x97'),_0x1584ae[_0xf6da('0x2b')],_0x38149c);this['agents'][_0x38149c]['onhold']=![];}}}}catch(_0x2a0bca){logger[_0xf6da('0x37')](_0xf6da('0x98'),_0x1584ae[_0xf6da('0x2b')],util[_0xf6da('0x2c')](_0x2a0bca,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xf6da('0x99')]=function(_0x67ffeb,_0x42e925=0x2710){if(this[_0xf6da('0x9')][_0x67ffeb]){setTimeout(()=>{delete this[_0xf6da('0x9')][_0x67ffeb];},_0x42e925);}};module[_0xf6da('0x9a')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index de530ca..e6e88bd 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea27=['[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','deleteChannelAfterTimeout','endtime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','then','transferToInternal','isEmpty','getSettings','Action','StopMixMonitor','catch','webbar:stopmonitors','event','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','ATTENDED','origtransfererlinkedid','some','outbound','routeid','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]','exports','lodash','util','ioredis','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','set','queue','dial','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','localhost','socket.io-emitter','channels','agents','coreshowchannel','bind','newexten','syncNewExten','newchannel','syncNewChannel','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','info','error','[voiceCallReport][coreshowchannels]','inspect','isNotNull','isUndefined','prototype','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','from-sip','split','exten','destconnectedlinenum','connectedlinenum','user:%s','name','user:agentconnect','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','blindTransfers','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','keys','undefined','accountcode','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','includes','lastapplication','lastdata','cdr(','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','channelstate','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinename','destinationchannel','UserId','membername','toNumber','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','monitorFilename','find','monitors','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-queue','xmd-originatecalleridnum'];(function(_0x11b178,_0x4ebe57){var _0x296414=function(_0x29366e){while(--_0x29366e){_0x11b178['push'](_0x11b178['shift']());}};_0x296414(++_0x4ebe57);}(_0xea27,0x1b2));var _0x7ea2=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xea27[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x7ea2('0x0'));var moment=require('moment');var util=require(_0x7ea2('0x1'));var path=require('path');var Redis=require(_0x7ea2('0x2'));var config=require('../../../config/environment');var logger=require(_0x7ea2('0x3'))(_0x7ea2('0x4'));var ami=require(_0x7ea2('0x5'));var Channel=require(_0x7ea2('0x6'));var RpcSetting=require(_0x7ea2('0x7'));var applications=[_0x7ea2('0x8'),_0x7ea2('0x9'),'agi',_0x7ea2('0xa'),'playback',_0x7ea2('0xb')];var dispositions=[_0x7ea2('0xc'),_0x7ea2('0xd'),_0x7ea2('0xd'),'NO\x20ANSWER',_0x7ea2('0xc'),_0x7ea2('0xc'),'ANSWERED',_0x7ea2('0xe'),_0x7ea2('0xd'),_0x7ea2('0xd'),'FAILED'];config[_0x7ea2('0xf')]=_['defaults'](config[_0x7ea2('0xf')],{'host':_0x7ea2('0x10'),'port':0x18eb});var io=require(_0x7ea2('0x11'))(new Redis(config[_0x7ea2('0xf')]));function VoiceCallReport(_0x4a6dc4){this[_0x7ea2('0x12')]=_0x4a6dc4[_0x7ea2('0x12')];this[_0x7ea2('0x13')]=_0x4a6dc4[_0x7ea2('0x13')];this['blindTransfers']={};ami['on'](_0x7ea2('0x14'),this['syncNewExten'][_0x7ea2('0x15')](this));ami['on'](_0x7ea2('0x16'),this[_0x7ea2('0x17')][_0x7ea2('0x15')](this));ami['on'](_0x7ea2('0x18'),this[_0x7ea2('0x19')]['bind'](this));ami['on']('newstate',this[_0x7ea2('0x1a')][_0x7ea2('0x15')](this));ami['on'](_0x7ea2('0x1b'),this[_0x7ea2('0x1c')]['bind'](this));ami['on'](_0x7ea2('0x1d'),this[_0x7ea2('0x1e')][_0x7ea2('0x15')](this));ami['on'](_0x7ea2('0x1f'),this[_0x7ea2('0x20')][_0x7ea2('0x15')](this));ami['on'](_0x7ea2('0x21'),this[_0x7ea2('0x22')][_0x7ea2('0x15')](this));ami['on'](_0x7ea2('0x23'),this['syncBlindTransfer'][_0x7ea2('0x15')](this));ami['on'](_0x7ea2('0x24'),this[_0x7ea2('0x25')][_0x7ea2('0x15')](this));ami['on']('musiconholdstop',this[_0x7ea2('0x26')][_0x7ea2('0x15')](this));try{logger[_0x7ea2('0x27')]('[voiceCallReport][coreshowchannels]\x20started');ami['actionCoreShowChannels']();}catch(_0x3e94f8){logger[_0x7ea2('0x28')](_0x7ea2('0x29'),util[_0x7ea2('0x2a')](_0x3e94f8,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0x7ea2('0x2b')]=function(_0x181f33){return _0x181f33!==null&&!_[_0x7ea2('0x2c')](_0x181f33);};VoiceCallReport[_0x7ea2('0x2d')][_0x7ea2('0x2e')]=function(_0x479603,_0x397892,_0x5144b5){io['to'](_0x479603)[_0x7ea2('0x2e')](_0x397892,_0x5144b5);};VoiceCallReport[_0x7ea2('0x2d')][_0x7ea2('0x20')]=function(_0x535aaf){try{if(this['isNotNull'](_0x535aaf)){logger['info'](_0x7ea2('0x2f'),_0x535aaf[_0x7ea2('0x30')],_0x535aaf[_0x7ea2('0x31')],_0x535aaf[_0x7ea2('0x32')]);logger[_0x7ea2('0x33')](_0x7ea2('0x34'),_0x535aaf['uniqueid'],util[_0x7ea2('0x2a')](_0x535aaf,{'showHidden':![],'depth':null}));if(_0x535aaf[_0x7ea2('0x30')]===_0x535aaf[_0x7ea2('0x35')]){if(!_['isUndefined'](this[_0x7ea2('0x12')][_0x535aaf[_0x7ea2('0x30')]])){_[_0x7ea2('0x36')](this[_0x7ea2('0x12')][_0x535aaf[_0x7ea2('0x30')]],_[_0x7ea2('0x37')](_0x535aaf,_['keys'](this[_0x7ea2('0x12')][_0x535aaf[_0x7ea2('0x30')]])));}}if(_0x535aaf['context']===_0x7ea2('0x38')){var _0x12aab5=this[_0x7ea2('0x13')][_0x535aaf['channel'][_0x7ea2('0x39')]('-')[0x0]];if(_0x12aab5){if(_0x535aaf[_0x7ea2('0x3a')]=='xcally-motion-preview'){_0x12aab5[_0x7ea2('0x3b')]=_0x535aaf[_0x7ea2('0x3c')];this[_0x7ea2('0x2e')](util['format'](_0x7ea2('0x3d'),_0x12aab5[_0x7ea2('0x3e')]),_0x7ea2('0x3f'),{'id':_0x12aab5['id'],'destaccountcode':_0x12aab5['accountcode'],'destconnectedlinenum':_0x535aaf[_0x7ea2('0x3c')]});}}}}}catch(_0xc11d2b){logger[_0x7ea2('0x28')](_0x7ea2('0x40'),_0x535aaf[_0x7ea2('0x30')],util[_0x7ea2('0x2a')](_0xc11d2b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ea2('0x2d')][_0x7ea2('0x19')]=function(_0x5db10c){try{if(this[_0x7ea2('0x2b')](_0x5db10c)){logger[_0x7ea2('0x33')](_0x7ea2('0x41'),_0x5db10c[_0x7ea2('0x30')],util[_0x7ea2('0x2a')](_0x5db10c,{'showHidden':![],'depth':null}));if(this['channels'][_0x5db10c[_0x7ea2('0x30')]]){return;}if(_0x5db10c[_0x7ea2('0x42')]===_0x7ea2('0x43')){return;}if(_0x5db10c[_0x7ea2('0x30')]!==_0x5db10c[_0x7ea2('0x35')]&&!this[_0x7ea2('0x44')][_0x5db10c[_0x7ea2('0x35')]]){return;}logger[_0x7ea2('0x27')](_0x7ea2('0x45'),_0x5db10c[_0x7ea2('0x30')],_0x5db10c[_0x7ea2('0x46')],_0x5db10c[_0x7ea2('0x3a')]);this[_0x7ea2('0x12')][_0x5db10c[_0x7ea2('0x30')]]=new Channel();this['channels'][_0x5db10c[_0x7ea2('0x30')]][_0x7ea2('0x47')]=moment()[_0x7ea2('0x48')](_0x7ea2('0x49'));this[_0x7ea2('0x12')][_0x5db10c[_0x7ea2('0x30')]][_0x7ea2('0x4a')]=dispositions[_['toNumber'](_0x5db10c['channelstate'])];_[_0x7ea2('0x36')](this[_0x7ea2('0x12')][_0x5db10c['uniqueid']],_[_0x7ea2('0x37')](_0x5db10c,_[_0x7ea2('0x4b')](this[_0x7ea2('0x12')][_0x5db10c[_0x7ea2('0x30')]])));if(_0x5db10c[_0x7ea2('0x46')]===_0x7ea2('0x38')){var _0x12cb5d=this[_0x7ea2('0x13')][_0x5db10c[_0x7ea2('0x42')]['split']('-')[0x0]];if(_0x12cb5d&&typeof _0x12cb5d[_0x7ea2('0x3b')]===_0x7ea2('0x4c')){_0x12cb5d[_0x7ea2('0x3b')]=_0x5db10c[_0x7ea2('0x3a')];logger[_0x7ea2('0x33')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x5db10c[_0x7ea2('0x30')],util[_0x7ea2('0x2a')]({'id':_0x12cb5d['id'],'destaccountcode':_0x12cb5d['accountcode'],'destconnectedlinenum':_0x5db10c[_0x7ea2('0x3a')]},{'showHidden':![],'depth':null}));this[_0x7ea2('0x2e')](util[_0x7ea2('0x48')](_0x7ea2('0x3d'),_0x12cb5d['name']),'user:agentconnect',{'id':_0x12cb5d['id'],'destaccountcode':_0x12cb5d[_0x7ea2('0x4d')],'destconnectedlinenum':_0x5db10c[_0x7ea2('0x3a')]});}}}}catch(_0x5651d3){logger['error'](_0x7ea2('0x4e'),_0x5db10c['uniqueid'],util[_0x7ea2('0x2a')](_0x5651d3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ea2('0x2d')][_0x7ea2('0x17')]=function(_0x2b5e3a){try{if(this[_0x7ea2('0x2b')](_0x2b5e3a)){logger['debug'](_0x7ea2('0x4f'),_0x2b5e3a[_0x7ea2('0x30')],util[_0x7ea2('0x2a')](_0x2b5e3a,{'showHidden':![],'depth':null}));if(_0x2b5e3a[_0x7ea2('0x42')]===_0x7ea2('0x43')||_0x2b5e3a['exten']==='h')return;if(_0x2b5e3a[_0x7ea2('0x30')]===_0x2b5e3a[_0x7ea2('0x35')]||this[_0x7ea2('0x44')][_0x2b5e3a[_0x7ea2('0x35')]]){_0x2b5e3a[_0x7ea2('0x50')]=_0x2b5e3a[_0x7ea2('0x50')]?_0x2b5e3a['application'][_0x7ea2('0x51')]():undefined;_0x2b5e3a['applicationdata']=_0x2b5e3a['appdata']||_0x2b5e3a[_0x7ea2('0x52')];if(_0x2b5e3a[_0x7ea2('0x53')]&&_0x2b5e3a[_0x7ea2('0x50')]!=='queue'){_0x2b5e3a[_0x7ea2('0x52')]=_0x2b5e3a[_0x7ea2('0x52')][_0x7ea2('0x51')]();}logger[_0x7ea2('0x27')](_0x7ea2('0x54'),_0x2b5e3a[_0x7ea2('0x30')],_0x2b5e3a['application'],_0x2b5e3a[_0x7ea2('0x52')]);if(_[_0x7ea2('0x2c')](this['channels'][_0x2b5e3a[_0x7ea2('0x30')]])){this[_0x7ea2('0x12')][_0x2b5e3a[_0x7ea2('0x30')]]=new Channel();this['channels'][_0x2b5e3a[_0x7ea2('0x30')]]['starttime']=_0x2b5e3a[_0x7ea2('0x55')]?moment()['subtract'](moment['duration'](_0x2b5e3a['duration'])['seconds'](),_0x7ea2('0x56'))['format'](_0x7ea2('0x49')):moment()[_0x7ea2('0x48')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7ea2('0x12')][_0x2b5e3a['uniqueid']][_0x7ea2('0x4a')]=_0x7ea2('0xc');}_[_0x7ea2('0x36')](this[_0x7ea2('0x12')][_0x2b5e3a[_0x7ea2('0x30')]],_[_0x7ea2('0x37')](_0x2b5e3a,_[_0x7ea2('0x4b')](this[_0x7ea2('0x12')][_0x2b5e3a['uniqueid']])));if(_[_0x7ea2('0x57')](applications,_0x2b5e3a[_0x7ea2('0x50')])){this[_0x7ea2('0x12')][_0x2b5e3a[_0x7ea2('0x30')]][_0x7ea2('0x58')]=_0x2b5e3a[_0x7ea2('0x50')];this[_0x7ea2('0x12')][_0x2b5e3a[_0x7ea2('0x30')]][_0x7ea2('0x59')]=_0x2b5e3a[_0x7ea2('0x52')];if(_0x2b5e3a[_0x7ea2('0x50')]===_0x7ea2('0x8')&&_['startsWith'](_0x2b5e3a[_0x7ea2('0x52')][_0x7ea2('0x51')](),_0x7ea2('0x5a'))){var _0x46f89d=_0x2b5e3a[_0x7ea2('0x52')][_0x7ea2('0x39')]('=');var _0x23bb7c=_0x46f89d[0x0][_0x7ea2('0x51')]()['match'](/cdr\((.*)\)/);if(_0x23bb7c){if(_0x23bb7c[0x1]===_0x7ea2('0x5b')&&!_[_0x7ea2('0x5c')](this[_0x7ea2('0x12')][_0x2b5e3a[_0x7ea2('0x30')]][_0x23bb7c[0x1]]))return;this[_0x7ea2('0x12')][_0x2b5e3a[_0x7ea2('0x30')]][_0x23bb7c[0x1]]=_0x46f89d[0x1];}}else if(_0x2b5e3a['application']===_0x7ea2('0x9')){this[_0x7ea2('0x12')][_0x2b5e3a[_0x7ea2('0x30')]][_0x7ea2('0x9')]=_0x2b5e3a['applicationdata'][_0x7ea2('0x39')](',')[0x0];}}}}}catch(_0x4d57e8){logger[_0x7ea2('0x28')](_0x7ea2('0x5d'),_0x2b5e3a[_0x7ea2('0x30')],util[_0x7ea2('0x2a')](_0x4d57e8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ea2('0x2d')][_0x7ea2('0x1a')]=function(_0x1f5ade){try{if(this['isNotNull'](_0x1f5ade)){logger[_0x7ea2('0x27')](_0x7ea2('0x5e'),_0x1f5ade[_0x7ea2('0x30')],_0x1f5ade[_0x7ea2('0x35')],_0x1f5ade[_0x7ea2('0x31')],_0x1f5ade[_0x7ea2('0x32')]);logger[_0x7ea2('0x33')]('[%s][voiceCallReport][newstate]\x20event:',_0x1f5ade[_0x7ea2('0x30')],util[_0x7ea2('0x2a')](_0x1f5ade,{'showHidden':![],'depth':null}));if(_0x1f5ade[_0x7ea2('0x5f')]!=='6')return;var _0x5f03c2=this[_0x7ea2('0x13')][_0x1f5ade[_0x7ea2('0x42')][_0x7ea2('0x39')]('-')[0x0]];if(_0x1f5ade['uniqueid']!==_0x1f5ade['linkedid']){var _0x1a5c07=moment();if(this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x35')]]){if(!this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x35')]][_0x7ea2('0x60')]){this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x35')]][_0x7ea2('0x60')]=!![];this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x35')]][_0x7ea2('0x61')]=_0x1a5c07[_0x7ea2('0x48')](_0x7ea2('0x49'));if(this['channels'][_0x1f5ade[_0x7ea2('0x35')]][_0x7ea2('0x47')]){this[_0x7ea2('0x12')][_0x1f5ade['linkedid']][_0x7ea2('0x62')]=_0x1a5c07[_0x7ea2('0x63')](this[_0x7ea2('0x12')][_0x1f5ade['linkedid']][_0x7ea2('0x47')],_0x7ea2('0x56'));}}this['channels'][_0x1f5ade[_0x7ea2('0x35')]][_0x7ea2('0x35')]=_0x1f5ade['uniqueid'];if(_0x1f5ade[_0x7ea2('0x32')]!==_0x7ea2('0x64')){this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x35')]]['connectedlinenum']=_0x1f5ade[_0x7ea2('0x32')];}this[_0x7ea2('0x12')][_0x1f5ade['linkedid']][_0x7ea2('0x65')]=_0x1f5ade[_0x7ea2('0x31')];this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x35')]][_0x7ea2('0x66')]=_0x1f5ade[_0x7ea2('0x42')];this['channels'][_0x1f5ade['linkedid']][_0x7ea2('0x4a')]=dispositions[_['toNumber'](_0x1f5ade[_0x7ea2('0x5f')])];if(_0x5f03c2){this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x35')]][_0x7ea2('0x67')]=_0x5f03c2['id'];this['channels'][_0x1f5ade['linkedid']][_0x7ea2('0x68')]=_0x5f03c2[_0x7ea2('0x3e')];}}if(this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x30')]]){if(!this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x30')]][_0x7ea2('0x60')]){this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x30')]][_0x7ea2('0x60')]=!![];this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x30')]][_0x7ea2('0x61')]=_0x1a5c07[_0x7ea2('0x48')](_0x7ea2('0x49'));if(this[_0x7ea2('0x12')][_0x1f5ade['uniqueid']]['starttime']){this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x30')]][_0x7ea2('0x62')]=_0x1a5c07['diff'](this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x30')]][_0x7ea2('0x47')],'seconds');}}if(_0x1f5ade['calleridnum']!==_0x7ea2('0x64')){this['channels'][_0x1f5ade['uniqueid']]['connectedlinenum']=_0x1f5ade[_0x7ea2('0x32')];}this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x30')]][_0x7ea2('0x65')]=_0x1f5ade[_0x7ea2('0x31')];this['channels'][_0x1f5ade[_0x7ea2('0x30')]]['destinationchannel']=_0x1f5ade['channel'];this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x30')]]['disposition']=dispositions[_[_0x7ea2('0x69')](_0x1f5ade[_0x7ea2('0x5f')])];}}else{if(this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x30')]]){if(_0x5f03c2){this['channels'][_0x1f5ade[_0x7ea2('0x30')]][_0x7ea2('0x67')]=_0x5f03c2['id'];this['channels'][_0x1f5ade[_0x7ea2('0x30')]]['membername']=_0x5f03c2[_0x7ea2('0x3e')];}}}if(_0x1f5ade[_0x7ea2('0x46')]===_0x7ea2('0x38')){if(_0x5f03c2){_0x5f03c2[_0x7ea2('0x3b')]=_0x1f5ade[_0x7ea2('0x3a')];var _0xf37186;if(this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x30')]]){_0xf37186=this[_0x7ea2('0x12')][_0x1f5ade['uniqueid']][_0x7ea2('0x9')];}else if(this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x35')]]){_0xf37186=this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x35')]][_0x7ea2('0x9')];}_0x5f03c2[_0x7ea2('0x9')]=_0xf37186;var _0x1f2adf={'id':_0x5f03c2['id'],'name':_0x5f03c2[_0x7ea2('0x3e')],'agentconnected':!![],'destaccountcode':_0x5f03c2[_0x7ea2('0x4d')],'destconnectedlinenum':_0x1f5ade[_0x7ea2('0x3a')],'queue':_0xf37186||undefined,'uniqueid':_0x1f5ade[_0x7ea2('0x35')]};logger[_0x7ea2('0x33')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x1f5ade[_0x7ea2('0x30')],util['inspect'](_0x1f2adf,{'showHidden':![],'depth':null}));this[_0x7ea2('0x2e')](util[_0x7ea2('0x48')]('user:%s',_0x5f03c2[_0x7ea2('0x3e')]),_0x7ea2('0x3f'),_0x1f2adf);}}}}catch(_0x1f0748){logger[_0x7ea2('0x28')]('[%s][voiceCallReport][newstate]',_0x1f5ade[_0x7ea2('0x30')],util[_0x7ea2('0x2a')](_0x1f0748,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ea2('0x2d')][_0x7ea2('0x6a')]=function(_0x3e7642,_0x24da71){try{if(this[_0x7ea2('0x12')][_0x3e7642]){logger['info'](_0x7ea2('0x6b'),_0x3e7642,_0x24da71);this[_0x7ea2('0x12')][_0x3e7642][_0x7ea2('0x6c')]=!![];if(_[_0x7ea2('0x6d')](_0x24da71,_0x7ea2('0x6e'))){_0x24da71=_0x24da71['replace']('.wav49','.WAV');}this[_0x7ea2('0x12')][_0x3e7642][_0x7ea2('0x6f')]=_0x24da71;var _0x18c315=_[_0x7ea2('0x70')](this[_0x7ea2('0x12')][_0x3e7642][_0x7ea2('0x71')],{'filename':_0x24da71});if(_[_0x7ea2('0x5c')](_0x18c315)){this[_0x7ea2('0x12')][_0x3e7642][_0x7ea2('0x71')]['push']({'filename':_0x24da71,'createdAt':moment()['format'](_0x7ea2('0x49')),'mixmonitorid':'','status':_0x7ea2('0x72')});}}}catch(_0x1a386b){logger[_0x7ea2('0x28')](_0x7ea2('0x73'),_0x3e7642,util['inspect'](_0x1a386b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ea2('0x2d')][_0x7ea2('0x1c')]=function(_0x472f00){try{if(this[_0x7ea2('0x2b')](_0x472f00)){logger[_0x7ea2('0x33')](_0x7ea2('0x74'),_0x472f00[_0x7ea2('0x30')],util[_0x7ea2('0x2a')](_0x472f00,{'showHidden':![],'depth':null}));if(this['channels'][_0x472f00[_0x7ea2('0x30')]]&&_0x472f00[_0x7ea2('0x42')]!='OutgoingSpoolFailed'){if(this[_0x7ea2('0x2b')](_0x472f00[_0x7ea2('0x75')])){if(this[_0x7ea2('0x2b')](_0x472f00[_0x7ea2('0x75')][_0x7ea2('0x76')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x472f00[_0x7ea2('0x30')],_0x472f00[_0x7ea2('0x77')]);this[_0x7ea2('0x6a')](_0x472f00[_0x7ea2('0x30')],_0x472f00['value']);}else if(this[_0x7ea2('0x2b')](_0x472f00[_0x7ea2('0x75')][_0x7ea2('0x78')])){logger[_0x7ea2('0x27')](_0x7ea2('0x79'),_0x472f00[_0x7ea2('0x30')],_0x472f00[_0x7ea2('0x77')]);this[_0x7ea2('0x12')][_0x472f00[_0x7ea2('0x30')]][_0x7ea2('0x32')]=_0x472f00[_0x7ea2('0x77')];}else if(this['isNotNull'](_0x472f00[_0x7ea2('0x75')][_0x7ea2('0x7a')])){logger[_0x7ea2('0x27')](_0x7ea2('0x7b'),_0x472f00[_0x7ea2('0x30')],_0x472f00['value']);this[_0x7ea2('0x12')][_0x472f00[_0x7ea2('0x30')]][_0x7ea2('0x7c')]=_0x472f00['value'];}else if(this[_0x7ea2('0x2b')](_0x472f00[_0x7ea2('0x75')]['xmd-cdrtype'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x472f00[_0x7ea2('0x30')],_0x472f00[_0x7ea2('0x77')]);this[_0x7ea2('0x12')][_0x472f00[_0x7ea2('0x30')]][_0x7ea2('0x5b')]=_0x472f00[_0x7ea2('0x77')];}else if(this[_0x7ea2('0x2b')](_0x472f00[_0x7ea2('0x75')][_0x7ea2('0x7d')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x472f00[_0x7ea2('0x30')],_0x472f00['value'][_0x7ea2('0x39')](',')[0x0]);this[_0x7ea2('0x12')][_0x472f00[_0x7ea2('0x30')]][_0x7ea2('0x9')]=_0x472f00[_0x7ea2('0x77')][_0x7ea2('0x39')](',')[0x0];}else if(this[_0x7ea2('0x2b')](_0x472f00[_0x7ea2('0x75')][_0x7ea2('0x7e')])){logger[_0x7ea2('0x27')](_0x7ea2('0x7f'),_0x472f00[_0x7ea2('0x30')],_0x472f00[_0x7ea2('0x77')]);this[_0x7ea2('0x12')][_0x472f00[_0x7ea2('0x30')]]['originatecalleridnum']=_0x472f00[_0x7ea2('0x77')];}else if(this['isNotNull'](_0x472f00['variable'][_0x7ea2('0x80')])){logger[_0x7ea2('0x27')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x472f00['uniqueid'],_0x472f00[_0x7ea2('0x77')]);this[_0x7ea2('0x12')][_0x472f00[_0x7ea2('0x30')]][_0x7ea2('0x81')]=_0x472f00[_0x7ea2('0x77')];}else if(this[_0x7ea2('0x2b')](_0x472f00['variable'][_0x7ea2('0x82')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x472f00['uniqueid'],_0x472f00[_0x7ea2('0x77')]);this['channels'][_0x472f00[_0x7ea2('0x30')]][_0x7ea2('0x83')]=_0x472f00[_0x7ea2('0x77')];}else if(this['isNotNull'](_0x472f00[_0x7ea2('0x75')][_0x7ea2('0x84')])){logger[_0x7ea2('0x27')](_0x7ea2('0x85'),_0x472f00[_0x7ea2('0x30')],_0x472f00[_0x7ea2('0x77')]);this[_0x7ea2('0x12')][_0x472f00[_0x7ea2('0x30')]]['queue']=_0x472f00['value'];}else if(this[_0x7ea2('0x2b')](_0x472f00['variable'][_0x7ea2('0x86')])){logger[_0x7ea2('0x27')](_0x7ea2('0x87'),_0x472f00[_0x7ea2('0x30')],_0x472f00['value']);this[_0x7ea2('0x12')][_0x472f00[_0x7ea2('0x30')]][_0x7ea2('0x88')]=_0x472f00['value'];}}}else if(this[_0x7ea2('0x2b')](_0x472f00['variable'][_0x7ea2('0x76')])){if(_0x472f00[_0x7ea2('0x77')]){var _0x40391c=path[_0x7ea2('0x89')](_0x472f00[_0x7ea2('0x77')])[_0x7ea2('0x3e')];logger[_0x7ea2('0x27')](_0x7ea2('0x8a'),_0x40391c,_0x472f00[_0x7ea2('0x77')]);this['syncMixMonitorFilename'](_0x40391c,_0x472f00[_0x7ea2('0x77')]);}}else if(this[_0x7ea2('0x12')][_0x472f00[_0x7ea2('0x35')]]){if(this[_0x7ea2('0x2b')](_0x472f00[_0x7ea2('0x75')])){if(this[_0x7ea2('0x2b')](_0x472f00[_0x7ea2('0x75')]['sipcallid'])){logger['info'](_0x7ea2('0x87'),_0x472f00[_0x7ea2('0x35')],_0x472f00[_0x7ea2('0x77')]);this[_0x7ea2('0x12')][_0x472f00[_0x7ea2('0x35')]][_0x7ea2('0x8b')]=_0x472f00['value'];}}}}}catch(_0x297864){logger['error'](_0x7ea2('0x8c'),_0x472f00[_0x7ea2('0x30')],util[_0x7ea2('0x2a')](_0x297864,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ea2('0x2d')][_0x7ea2('0x1e')]=function(_0x4b7e07){try{if(this[_0x7ea2('0x2b')](_0x4b7e07)){logger[_0x7ea2('0x33')]('[%s][voiceCallReport][hangup]\x20event:',_0x4b7e07[_0x7ea2('0x30')],util[_0x7ea2('0x2a')](_0x4b7e07,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x4b7e07[_0x7ea2('0x35')]]){if(this[_0x7ea2('0x12')][this['blindTransfers'][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x35')]]){this['channels'][this[_0x7ea2('0x44')][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x35')]][_0x7ea2('0x30')]=_0x4b7e07[_0x7ea2('0x30')];this[_0x7ea2('0x12')][this[_0x7ea2('0x44')][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x35')]][_0x7ea2('0x60')]=this[_0x7ea2('0x12')][_0x4b7e07[_0x7ea2('0x30')]][_0x7ea2('0x60')];this[_0x7ea2('0x12')][this[_0x7ea2('0x44')][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x35')]][_0x7ea2('0x61')]=this['channels'][_0x4b7e07[_0x7ea2('0x30')]][_0x7ea2('0x61')];this[_0x7ea2('0x12')][this[_0x7ea2('0x44')][_0x4b7e07['linkedid']]['linkedid']]['destinationchannel']=this[_0x7ea2('0x12')][this['blindTransfers'][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x35')]][_0x7ea2('0x42')];this[_0x7ea2('0x12')][this[_0x7ea2('0x44')][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x35')]][_0x7ea2('0x4a')]=this[_0x7ea2('0x12')][_0x4b7e07[_0x7ea2('0x30')]][_0x7ea2('0x4a')];this['channels'][_0x4b7e07['uniqueid']]=this[_0x7ea2('0x12')][this[_0x7ea2('0x44')][_0x4b7e07[_0x7ea2('0x35')]]['linkedid']];this[_0x7ea2('0x8d')](this[_0x7ea2('0x44')][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x35')]);}else if(this['channels'][this['blindTransfers'][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x30')]]){this[_0x7ea2('0x12')][this[_0x7ea2('0x44')][_0x4b7e07['linkedid']][_0x7ea2('0x30')]][_0x7ea2('0x30')]=[this[_0x7ea2('0x12')][this['blindTransfers'][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x30')]]['linkedid'],this[_0x7ea2('0x12')][this[_0x7ea2('0x44')][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x30')]][_0x7ea2('0x35')]=this['channels'][this[_0x7ea2('0x44')][_0x4b7e07[_0x7ea2('0x35')]]['uniqueid']]['uniqueid']][0x0];this[_0x7ea2('0x12')][this['blindTransfers'][_0x4b7e07['linkedid']][_0x7ea2('0x30')]][_0x7ea2('0x60')]=this[_0x7ea2('0x12')][_0x4b7e07[_0x7ea2('0x30')]][_0x7ea2('0x60')];this[_0x7ea2('0x12')][this[_0x7ea2('0x44')][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x30')]]['answertime']=this[_0x7ea2('0x12')][_0x4b7e07[_0x7ea2('0x30')]][_0x7ea2('0x61')];this['channels'][this[_0x7ea2('0x44')][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x30')]]['destinationchannel']=this[_0x7ea2('0x12')][this[_0x7ea2('0x44')][_0x4b7e07['linkedid']][_0x7ea2('0x30')]][_0x7ea2('0x42')];this['channels'][this['blindTransfers'][_0x4b7e07['linkedid']]['uniqueid']][_0x7ea2('0x4a')]=this[_0x7ea2('0x12')][_0x4b7e07[_0x7ea2('0x30')]][_0x7ea2('0x4a')];this[_0x7ea2('0x12')][_0x4b7e07[_0x7ea2('0x30')]]=this[_0x7ea2('0x12')][this['blindTransfers'][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x30')]];this[_0x7ea2('0x8d')](this[_0x7ea2('0x44')][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x30')]);}}if(this[_0x7ea2('0x12')][_0x4b7e07['uniqueid']]){logger[_0x7ea2('0x27')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x4b7e07[_0x7ea2('0x30')],_0x4b7e07['cause-txt']);var _0x8408b5=moment();this[_0x7ea2('0x12')][_0x4b7e07[_0x7ea2('0x30')]][_0x7ea2('0x8e')]=_0x8408b5[_0x7ea2('0x48')](_0x7ea2('0x49'));this[_0x7ea2('0x12')][_0x4b7e07[_0x7ea2('0x30')]][_0x7ea2('0x55')]=_0x8408b5[_0x7ea2('0x63')](this[_0x7ea2('0x12')][_0x4b7e07['uniqueid']]['starttime'],_0x7ea2('0x56'));if(this['channels'][_0x4b7e07[_0x7ea2('0x30')]][_0x7ea2('0x60')]){this[_0x7ea2('0x12')][_0x4b7e07['uniqueid']]['billableseconds']=_0x8408b5[_0x7ea2('0x63')](this['channels'][_0x4b7e07[_0x7ea2('0x30')]][_0x7ea2('0x61')],_0x7ea2('0x56'));this['channels'][_0x4b7e07[_0x7ea2('0x30')]][_0x7ea2('0x62')]=this[_0x7ea2('0x12')][_0x4b7e07['uniqueid']][_0x7ea2('0x55')]-this[_0x7ea2('0x12')][_0x4b7e07['uniqueid']]['billableseconds'];}if(_0x4b7e07[_0x7ea2('0x46')]===_0x7ea2('0x38')){if(this[_0x7ea2('0x13')][_0x4b7e07[_0x7ea2('0x42')][_0x7ea2('0x39')]('-')[0x0]]){this['agents'][_0x4b7e07[_0x7ea2('0x42')]['split']('-')[0x0]]=_[_0x7ea2('0x8f')](this[_0x7ea2('0x13')][_0x4b7e07[_0x7ea2('0x42')]['split']('-')[0x0]],[_0x7ea2('0x3b')]);logger[_0x7ea2('0x33')](_0x7ea2('0x90'),_0x4b7e07[_0x7ea2('0x30')],util['inspect']({'id':this['agents'][_0x4b7e07[_0x7ea2('0x42')][_0x7ea2('0x39')]('-')[0x0]]['id'],'destaccountcode':this[_0x7ea2('0x13')][_0x4b7e07[_0x7ea2('0x42')][_0x7ea2('0x39')]('-')[0x0]][_0x7ea2('0x4d')]},{'showHidden':![],'depth':null}));this[_0x7ea2('0x2e')](util[_0x7ea2('0x48')](_0x7ea2('0x3d'),this['agents'][_0x4b7e07[_0x7ea2('0x42')][_0x7ea2('0x39')]('-')[0x0]][_0x7ea2('0x3e')]),_0x7ea2('0x91'),{'id':this['agents'][_0x4b7e07['channel']['split']('-')[0x0]]['id'],'destaccountcode':this[_0x7ea2('0x13')][_0x4b7e07[_0x7ea2('0x42')][_0x7ea2('0x39')]('-')[0x0]][_0x7ea2('0x4d')]});for(var _0x30c514=0x0;_0x30c514{delete this[_0x7ea2('0x12')][_0x2f8346];},_0x105065);}};module[_0x7ea2('0xba')]=VoiceCallReport; \ No newline at end of file +var _0x49db=['mohstarttime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../rpc/setting','set','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','redis','defaults','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','newexten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','inspect','isNotNull','emit','prototype','uniqueid','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','isUndefined','merge','pick','keys','from-sip','channel','split','exten','xcally-motion-preview','format','user:%s','name','accountcode','connectedlinenum','error','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','toLowerCase','appdata','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','disposition','includes','lastapplication','lastdata','startsWith','cdr(','match','type','isNil','queue','[%s][voiceCallReport][newexten]','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinename','destinationchannel','membername','UserId','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','monitorFilename','monitors','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','syncMixMonitorFilename','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','parse','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','resolve','transferType','undefined','transferToInternal','getSettings','then','Action','catch','StopMixMonitor','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereruniqueid','BLIND','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds'];(function(_0x4625df,_0x544375){var _0x194dbb=function(_0x2e495c){while(--_0x2e495c){_0x4625df['push'](_0x4625df['shift']());}};_0x194dbb(++_0x544375);}(_0x49db,0xcf));var _0xb49d=function(_0x5826fd,_0x130030){_0x5826fd=_0x5826fd-0x0;var _0x2a0fe4=_0x49db[_0x5826fd];return _0x2a0fe4;};'use strict';var _=require('lodash');var moment=require(_0xb49d('0x0'));var util=require(_0xb49d('0x1'));var path=require(_0xb49d('0x2'));var Redis=require(_0xb49d('0x3'));var config=require(_0xb49d('0x4'));var logger=require(_0xb49d('0x5'))(_0xb49d('0x6'));var ami=require(_0xb49d('0x7'));var Channel=require('../model/channel');var RpcSetting=require(_0xb49d('0x8'));var applications=[_0xb49d('0x9'),'queue',_0xb49d('0xa'),_0xb49d('0xb'),_0xb49d('0xc'),_0xb49d('0xd')];var dispositions=[_0xb49d('0xe'),'FAILED',_0xb49d('0xf'),_0xb49d('0xe'),_0xb49d('0xe'),_0xb49d('0xe'),_0xb49d('0x10'),'BUSY',_0xb49d('0xf'),'FAILED',_0xb49d('0xf')];config[_0xb49d('0x11')]=_[_0xb49d('0x12')](config[_0xb49d('0x11')],{'host':'localhost','port':0x18eb});var io=require(_0xb49d('0x13'))(new Redis(config['redis']));function VoiceCallReport(_0x3f2d7c){this[_0xb49d('0x14')]=_0x3f2d7c[_0xb49d('0x14')];this[_0xb49d('0x15')]=_0x3f2d7c['agents'];this[_0xb49d('0x16')]={};ami['on'](_0xb49d('0x17'),this[_0xb49d('0x18')]['bind'](this));ami['on'](_0xb49d('0x19'),this[_0xb49d('0x18')][_0xb49d('0x1a')](this));ami['on'](_0xb49d('0x1b'),this[_0xb49d('0x1c')]['bind'](this));ami['on'](_0xb49d('0x1d'),this[_0xb49d('0x1e')][_0xb49d('0x1a')](this));ami['on'](_0xb49d('0x1f'),this[_0xb49d('0x20')][_0xb49d('0x1a')](this));ami['on'](_0xb49d('0x21'),this[_0xb49d('0x22')][_0xb49d('0x1a')](this));ami['on'](_0xb49d('0x23'),this['syncNewCallerId'][_0xb49d('0x1a')](this));ami['on'](_0xb49d('0x24'),this[_0xb49d('0x25')][_0xb49d('0x1a')](this));ami['on']('blindtransfer',this[_0xb49d('0x26')]['bind'](this));ami['on'](_0xb49d('0x27'),this[_0xb49d('0x28')][_0xb49d('0x1a')](this));ami['on'](_0xb49d('0x29'),this[_0xb49d('0x2a')]['bind'](this));try{logger[_0xb49d('0x2b')](_0xb49d('0x2c'));ami[_0xb49d('0x2d')]();}catch(_0xc16f61){logger['error']('[voiceCallReport][coreshowchannels]',util[_0xb49d('0x2e')](_0xc16f61,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0xb49d('0x2f')]=function(_0x5bd83a){return _0x5bd83a!==null&&!_['isUndefined'](_0x5bd83a);};VoiceCallReport['prototype'][_0xb49d('0x30')]=function(_0x3812b3,_0x35a2fd,_0x51a2a9){io['to'](_0x3812b3)['emit'](_0x35a2fd,_0x51a2a9);};VoiceCallReport[_0xb49d('0x31')]['syncNewCallerId']=function(_0x611f12){try{if(this[_0xb49d('0x2f')](_0x611f12)){logger['info']('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x611f12[_0xb49d('0x32')],_0x611f12[_0xb49d('0x33')],_0x611f12['calleridnum']);logger[_0xb49d('0x34')](_0xb49d('0x35'),_0x611f12[_0xb49d('0x32')],util[_0xb49d('0x2e')](_0x611f12,{'showHidden':![],'depth':null}));if(_0x611f12[_0xb49d('0x32')]===_0x611f12[_0xb49d('0x36')]){if(!_[_0xb49d('0x37')](this[_0xb49d('0x14')][_0x611f12[_0xb49d('0x32')]])){_[_0xb49d('0x38')](this[_0xb49d('0x14')][_0x611f12['uniqueid']],_[_0xb49d('0x39')](_0x611f12,_[_0xb49d('0x3a')](this[_0xb49d('0x14')][_0x611f12['uniqueid']])));}}if(_0x611f12['context']===_0xb49d('0x3b')){var _0x526956=this[_0xb49d('0x15')][_0x611f12[_0xb49d('0x3c')][_0xb49d('0x3d')]('-')[0x0]];if(_0x526956){if(_0x611f12[_0xb49d('0x3e')]==_0xb49d('0x3f')){_0x526956['destconnectedlinenum']=_0x611f12['connectedlinenum'];this[_0xb49d('0x30')](util[_0xb49d('0x40')](_0xb49d('0x41'),_0x526956[_0xb49d('0x42')]),'user:agentconnect',{'id':_0x526956['id'],'destaccountcode':_0x526956[_0xb49d('0x43')],'destconnectedlinenum':_0x611f12[_0xb49d('0x44')]});}}}}}catch(_0x4bdfdd){logger[_0xb49d('0x45')](_0xb49d('0x46'),_0x611f12[_0xb49d('0x32')],util[_0xb49d('0x2e')](_0x4bdfdd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb49d('0x31')][_0xb49d('0x1c')]=function(_0x55d229){try{if(this['isNotNull'](_0x55d229)){logger[_0xb49d('0x34')](_0xb49d('0x47'),_0x55d229[_0xb49d('0x32')],util['inspect'](_0x55d229,{'showHidden':![],'depth':null}));if(this[_0xb49d('0x14')][_0x55d229[_0xb49d('0x32')]]){return;}if(_0x55d229[_0xb49d('0x3c')]==='OutgoingSpoolFailed'){return;}if(_0x55d229[_0xb49d('0x32')]!==_0x55d229[_0xb49d('0x36')]&&!this[_0xb49d('0x16')][_0x55d229[_0xb49d('0x36')]]){return;}logger['info'](_0xb49d('0x48'),_0x55d229[_0xb49d('0x32')],_0x55d229[_0xb49d('0x49')],_0x55d229[_0xb49d('0x3e')]);this['channels'][_0x55d229[_0xb49d('0x32')]]=new Channel();this[_0xb49d('0x14')][_0x55d229[_0xb49d('0x32')]][_0xb49d('0x4a')]=moment()[_0xb49d('0x40')](_0xb49d('0x4b'));this[_0xb49d('0x14')][_0x55d229[_0xb49d('0x32')]]['disposition']=dispositions[_[_0xb49d('0x4c')](_0x55d229[_0xb49d('0x4d')])];_[_0xb49d('0x38')](this[_0xb49d('0x14')][_0x55d229[_0xb49d('0x32')]],_[_0xb49d('0x39')](_0x55d229,_[_0xb49d('0x3a')](this[_0xb49d('0x14')][_0x55d229['uniqueid']])));if(_0x55d229[_0xb49d('0x49')]===_0xb49d('0x3b')){var _0x4416a5=this[_0xb49d('0x15')][_0x55d229[_0xb49d('0x3c')][_0xb49d('0x3d')]('-')[0x0]];if(_0x4416a5&&typeof _0x4416a5['destconnectedlinenum']==='undefined'){_0x4416a5[_0xb49d('0x4e')]=_0x55d229[_0xb49d('0x3e')];logger[_0xb49d('0x34')](_0xb49d('0x4f'),_0x55d229['uniqueid'],util['inspect']({'id':_0x4416a5['id'],'destaccountcode':_0x4416a5[_0xb49d('0x43')],'destconnectedlinenum':_0x55d229[_0xb49d('0x3e')]},{'showHidden':![],'depth':null}));this[_0xb49d('0x30')](util[_0xb49d('0x40')](_0xb49d('0x41'),_0x4416a5[_0xb49d('0x42')]),'user:agentconnect',{'id':_0x4416a5['id'],'destaccountcode':_0x4416a5[_0xb49d('0x43')],'destconnectedlinenum':_0x55d229[_0xb49d('0x3e')]});}}}}catch(_0x1400e0){logger[_0xb49d('0x45')](_0xb49d('0x50'),_0x55d229[_0xb49d('0x32')],util[_0xb49d('0x2e')](_0x1400e0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb49d('0x31')]['syncNewExten']=function(_0x1c32fb){try{if(this['isNotNull'](_0x1c32fb)){logger['debug'](_0xb49d('0x51'),_0x1c32fb[_0xb49d('0x32')],util[_0xb49d('0x2e')](_0x1c32fb,{'showHidden':![],'depth':null}));if(_0x1c32fb[_0xb49d('0x3c')]===_0xb49d('0x52')||_0x1c32fb[_0xb49d('0x3e')]==='h')return;if(_0x1c32fb[_0xb49d('0x32')]===_0x1c32fb['linkedid']||this['blindTransfers'][_0x1c32fb[_0xb49d('0x36')]]){_0x1c32fb[_0xb49d('0x53')]=_0x1c32fb[_0xb49d('0x53')]?_0x1c32fb[_0xb49d('0x53')][_0xb49d('0x54')]():undefined;_0x1c32fb['applicationdata']=_0x1c32fb[_0xb49d('0x55')]||_0x1c32fb[_0xb49d('0x56')];if(_0x1c32fb['appdata']&&_0x1c32fb[_0xb49d('0x53')]!=='queue'){_0x1c32fb[_0xb49d('0x56')]=_0x1c32fb[_0xb49d('0x56')][_0xb49d('0x54')]();}logger[_0xb49d('0x2b')](_0xb49d('0x57'),_0x1c32fb[_0xb49d('0x32')],_0x1c32fb[_0xb49d('0x53')],_0x1c32fb[_0xb49d('0x56')]);if(_[_0xb49d('0x37')](this[_0xb49d('0x14')][_0x1c32fb[_0xb49d('0x32')]])){this[_0xb49d('0x14')][_0x1c32fb['uniqueid']]=new Channel();this['channels'][_0x1c32fb[_0xb49d('0x32')]][_0xb49d('0x4a')]=_0x1c32fb[_0xb49d('0x58')]?moment()[_0xb49d('0x59')](moment[_0xb49d('0x58')](_0x1c32fb[_0xb49d('0x58')])[_0xb49d('0x5a')](),'seconds')['format'](_0xb49d('0x4b')):moment()[_0xb49d('0x40')](_0xb49d('0x4b'));this[_0xb49d('0x14')][_0x1c32fb[_0xb49d('0x32')]][_0xb49d('0x5b')]='NO\x20ANSWER';}_[_0xb49d('0x38')](this[_0xb49d('0x14')][_0x1c32fb[_0xb49d('0x32')]],_[_0xb49d('0x39')](_0x1c32fb,_[_0xb49d('0x3a')](this[_0xb49d('0x14')][_0x1c32fb[_0xb49d('0x32')]])));if(_[_0xb49d('0x5c')](applications,_0x1c32fb[_0xb49d('0x53')])){this[_0xb49d('0x14')][_0x1c32fb[_0xb49d('0x32')]][_0xb49d('0x5d')]=_0x1c32fb[_0xb49d('0x53')];this[_0xb49d('0x14')][_0x1c32fb[_0xb49d('0x32')]][_0xb49d('0x5e')]=_0x1c32fb['applicationdata'];if(_0x1c32fb[_0xb49d('0x53')]===_0xb49d('0x9')&&_[_0xb49d('0x5f')](_0x1c32fb[_0xb49d('0x56')][_0xb49d('0x54')](),_0xb49d('0x60'))){var _0x2a684d=_0x1c32fb[_0xb49d('0x56')][_0xb49d('0x3d')]('=');var _0x131a40=_0x2a684d[0x0][_0xb49d('0x54')]()[_0xb49d('0x61')](/cdr\((.*)\)/);if(_0x131a40){if(_0x131a40[0x1]===_0xb49d('0x62')&&!_[_0xb49d('0x63')](this[_0xb49d('0x14')][_0x1c32fb[_0xb49d('0x32')]][_0x131a40[0x1]]))return;this['channels'][_0x1c32fb[_0xb49d('0x32')]][_0x131a40[0x1]]=_0x2a684d[0x1];}}else if(_0x1c32fb['application']==='queue'){this[_0xb49d('0x14')][_0x1c32fb[_0xb49d('0x32')]][_0xb49d('0x64')]=_0x1c32fb[_0xb49d('0x56')][_0xb49d('0x3d')](',')[0x0];}}}}}catch(_0x593378){logger[_0xb49d('0x45')](_0xb49d('0x65'),_0x1c32fb['uniqueid'],util[_0xb49d('0x2e')](_0x593378,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb49d('0x31')][_0xb49d('0x1e')]=function(_0x5531e3){try{if(this['isNotNull'](_0x5531e3)){logger[_0xb49d('0x2b')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x5531e3[_0xb49d('0x32')],_0x5531e3[_0xb49d('0x36')],_0x5531e3[_0xb49d('0x33')],_0x5531e3[_0xb49d('0x66')]);logger[_0xb49d('0x34')](_0xb49d('0x67'),_0x5531e3[_0xb49d('0x32')],util[_0xb49d('0x2e')](_0x5531e3,{'showHidden':![],'depth':null}));if(_0x5531e3[_0xb49d('0x4d')]!=='6')return;var _0x5882b6=this[_0xb49d('0x15')][_0x5531e3[_0xb49d('0x3c')][_0xb49d('0x3d')]('-')[0x0]];if(_0x5531e3[_0xb49d('0x32')]!==_0x5531e3[_0xb49d('0x36')]){var _0x2d128=moment();if(this[_0xb49d('0x14')][_0x5531e3[_0xb49d('0x36')]]){if(!this[_0xb49d('0x14')][_0x5531e3[_0xb49d('0x36')]]['answered']){this[_0xb49d('0x14')][_0x5531e3[_0xb49d('0x36')]][_0xb49d('0x68')]=!![];this[_0xb49d('0x14')][_0x5531e3[_0xb49d('0x36')]][_0xb49d('0x69')]=_0x2d128['format'](_0xb49d('0x4b'));if(this[_0xb49d('0x14')][_0x5531e3['linkedid']][_0xb49d('0x4a')]){this[_0xb49d('0x14')][_0x5531e3[_0xb49d('0x36')]][_0xb49d('0x6a')]=_0x2d128[_0xb49d('0x6b')](this[_0xb49d('0x14')][_0x5531e3[_0xb49d('0x36')]][_0xb49d('0x4a')],_0xb49d('0x5a'));}}this[_0xb49d('0x14')][_0x5531e3[_0xb49d('0x36')]]['linkedid']=_0x5531e3[_0xb49d('0x32')];if(_0x5531e3[_0xb49d('0x66')]!==_0xb49d('0x3f')){this['channels'][_0x5531e3[_0xb49d('0x36')]][_0xb49d('0x44')]=_0x5531e3[_0xb49d('0x66')];}this['channels'][_0x5531e3[_0xb49d('0x36')]][_0xb49d('0x6c')]=_0x5531e3[_0xb49d('0x33')];this[_0xb49d('0x14')][_0x5531e3[_0xb49d('0x36')]][_0xb49d('0x6d')]=_0x5531e3[_0xb49d('0x3c')];this[_0xb49d('0x14')][_0x5531e3[_0xb49d('0x36')]][_0xb49d('0x5b')]=dispositions[_['toNumber'](_0x5531e3[_0xb49d('0x4d')])];if(_0x5882b6){this['channels'][_0x5531e3[_0xb49d('0x36')]]['UserId']=_0x5882b6['id'];this[_0xb49d('0x14')][_0x5531e3[_0xb49d('0x36')]][_0xb49d('0x6e')]=_0x5882b6[_0xb49d('0x42')];}}if(this[_0xb49d('0x14')][_0x5531e3[_0xb49d('0x32')]]){if(!this[_0xb49d('0x14')][_0x5531e3[_0xb49d('0x32')]]['answered']){this[_0xb49d('0x14')][_0x5531e3['uniqueid']][_0xb49d('0x68')]=!![];this[_0xb49d('0x14')][_0x5531e3['uniqueid']][_0xb49d('0x69')]=_0x2d128['format'](_0xb49d('0x4b'));if(this[_0xb49d('0x14')][_0x5531e3['uniqueid']][_0xb49d('0x4a')]){this[_0xb49d('0x14')][_0x5531e3['uniqueid']]['holdtime']=_0x2d128['diff'](this['channels'][_0x5531e3[_0xb49d('0x32')]][_0xb49d('0x4a')],_0xb49d('0x5a'));}}if(_0x5531e3['calleridnum']!==_0xb49d('0x3f')){this['channels'][_0x5531e3[_0xb49d('0x32')]][_0xb49d('0x44')]=_0x5531e3['calleridnum'];}this['channels'][_0x5531e3['uniqueid']]['connectedlinename']=_0x5531e3[_0xb49d('0x33')];this[_0xb49d('0x14')][_0x5531e3[_0xb49d('0x32')]][_0xb49d('0x6d')]=_0x5531e3[_0xb49d('0x3c')];this['channels'][_0x5531e3['uniqueid']]['disposition']=dispositions[_['toNumber'](_0x5531e3[_0xb49d('0x4d')])];}}else{if(this[_0xb49d('0x14')][_0x5531e3[_0xb49d('0x32')]]){if(_0x5882b6){this[_0xb49d('0x14')][_0x5531e3[_0xb49d('0x32')]][_0xb49d('0x6f')]=_0x5882b6['id'];this[_0xb49d('0x14')][_0x5531e3[_0xb49d('0x32')]]['membername']=_0x5882b6[_0xb49d('0x42')];}}}if(_0x5531e3[_0xb49d('0x49')]===_0xb49d('0x3b')){if(_0x5882b6){_0x5882b6['destconnectedlinenum']=_0x5531e3[_0xb49d('0x3e')];var _0x278fc9;if(this[_0xb49d('0x14')][_0x5531e3['uniqueid']]){_0x278fc9=this[_0xb49d('0x14')][_0x5531e3[_0xb49d('0x32')]][_0xb49d('0x64')];}else if(this[_0xb49d('0x14')][_0x5531e3[_0xb49d('0x36')]]){_0x278fc9=this[_0xb49d('0x14')][_0x5531e3[_0xb49d('0x36')]][_0xb49d('0x64')];}_0x5882b6[_0xb49d('0x64')]=_0x278fc9;var _0x5c6505={'id':_0x5882b6['id'],'name':_0x5882b6[_0xb49d('0x42')],'agentconnected':!![],'destaccountcode':_0x5882b6['accountcode'],'destconnectedlinenum':_0x5531e3['exten'],'queue':_0x278fc9||undefined,'uniqueid':_0x5531e3[_0xb49d('0x36')]};logger[_0xb49d('0x34')](_0xb49d('0x70'),_0x5531e3[_0xb49d('0x32')],util[_0xb49d('0x2e')](_0x5c6505,{'showHidden':![],'depth':null}));this[_0xb49d('0x30')](util[_0xb49d('0x40')](_0xb49d('0x41'),_0x5882b6[_0xb49d('0x42')]),_0xb49d('0x71'),_0x5c6505);}}}}catch(_0x2983d9){logger[_0xb49d('0x45')]('[%s][voiceCallReport][newstate]',_0x5531e3[_0xb49d('0x32')],util[_0xb49d('0x2e')](_0x2983d9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb49d('0x31')]['syncMixMonitorFilename']=function(_0x26d27f,_0x2a6557){try{if(this[_0xb49d('0x14')][_0x26d27f]){logger[_0xb49d('0x2b')](_0xb49d('0x72'),_0x26d27f,_0x2a6557);this[_0xb49d('0x14')][_0x26d27f][_0xb49d('0x73')]=!![];if(_[_0xb49d('0x74')](_0x2a6557,_0xb49d('0x75'))){_0x2a6557=_0x2a6557[_0xb49d('0x76')](_0xb49d('0x75'),'.WAV');}this[_0xb49d('0x14')][_0x26d27f][_0xb49d('0x77')]=_0x2a6557;var _0x3b3b23=_['find'](this[_0xb49d('0x14')][_0x26d27f][_0xb49d('0x78')],{'filename':_0x2a6557});if(_['isNil'](_0x3b3b23)){this['channels'][_0x26d27f][_0xb49d('0x78')][_0xb49d('0x79')]({'filename':_0x2a6557,'createdAt':moment()['format'](_0xb49d('0x4b')),'mixmonitorid':'','status':_0xb49d('0x7a')});}}}catch(_0x32fbc2){logger['error']('[%s][voiceCallReport][mixMonitorFilename]',_0x26d27f,util['inspect'](_0x32fbc2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb49d('0x31')][_0xb49d('0x20')]=function(_0x59e84e){try{if(this[_0xb49d('0x2f')](_0x59e84e)){logger[_0xb49d('0x34')](_0xb49d('0x7b'),_0x59e84e[_0xb49d('0x32')],util[_0xb49d('0x2e')](_0x59e84e,{'showHidden':![],'depth':null}));if(this['channels'][_0x59e84e[_0xb49d('0x32')]]&&_0x59e84e['channel']!='OutgoingSpoolFailed'){if(this[_0xb49d('0x2f')](_0x59e84e[_0xb49d('0x7c')])){if(this[_0xb49d('0x2f')](_0x59e84e[_0xb49d('0x7c')]['mixmonitor_filename'])){logger[_0xb49d('0x2b')](_0xb49d('0x7d'),_0x59e84e[_0xb49d('0x32')],_0x59e84e[_0xb49d('0x7e')]);this[_0xb49d('0x7f')](_0x59e84e[_0xb49d('0x32')],_0x59e84e[_0xb49d('0x7e')]);}else if(this[_0xb49d('0x2f')](_0x59e84e[_0xb49d('0x7c')][_0xb49d('0x80')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x59e84e[_0xb49d('0x32')],_0x59e84e['value']);this[_0xb49d('0x14')][_0x59e84e[_0xb49d('0x32')]]['calleridnum']=_0x59e84e[_0xb49d('0x7e')];}else if(this[_0xb49d('0x2f')](_0x59e84e[_0xb49d('0x7c')]['xmd-callerid'])){logger[_0xb49d('0x2b')](_0xb49d('0x81'),_0x59e84e['uniqueid'],_0x59e84e[_0xb49d('0x7e')]);this[_0xb49d('0x14')][_0x59e84e[_0xb49d('0x32')]][_0xb49d('0x82')]=_0x59e84e['value'];}else if(this[_0xb49d('0x2f')](_0x59e84e[_0xb49d('0x7c')][_0xb49d('0x83')])){logger[_0xb49d('0x2b')](_0xb49d('0x84'),_0x59e84e[_0xb49d('0x32')],_0x59e84e['value']);this[_0xb49d('0x14')][_0x59e84e[_0xb49d('0x32')]][_0xb49d('0x62')]=_0x59e84e['value'];}else if(this[_0xb49d('0x2f')](_0x59e84e['variable'][_0xb49d('0x85')])){logger['info'](_0xb49d('0x86'),_0x59e84e['uniqueid'],_0x59e84e[_0xb49d('0x7e')][_0xb49d('0x3d')](',')[0x0]);this[_0xb49d('0x14')][_0x59e84e['uniqueid']][_0xb49d('0x64')]=_0x59e84e[_0xb49d('0x7e')][_0xb49d('0x3d')](',')[0x0];}else if(this[_0xb49d('0x2f')](_0x59e84e[_0xb49d('0x7c')]['xmd-originatecalleridnum'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x59e84e[_0xb49d('0x32')],_0x59e84e['value']);this[_0xb49d('0x14')][_0x59e84e[_0xb49d('0x32')]][_0xb49d('0x87')]=_0x59e84e[_0xb49d('0x7e')];}else if(this[_0xb49d('0x2f')](_0x59e84e[_0xb49d('0x7c')][_0xb49d('0x88')])){logger[_0xb49d('0x2b')](_0xb49d('0x89'),_0x59e84e['uniqueid'],_0x59e84e['value']);this['channels'][_0x59e84e['uniqueid']][_0xb49d('0x8a')]=_0x59e84e[_0xb49d('0x7e')];}else if(this[_0xb49d('0x2f')](_0x59e84e['variable'][_0xb49d('0x8b')])){logger[_0xb49d('0x2b')](_0xb49d('0x8c'),_0x59e84e[_0xb49d('0x32')],_0x59e84e['value']);this[_0xb49d('0x14')][_0x59e84e[_0xb49d('0x32')]]['calleridpreview']=_0x59e84e[_0xb49d('0x7e')];}else if(this[_0xb49d('0x2f')](_0x59e84e[_0xb49d('0x7c')][_0xb49d('0x8d')])){logger[_0xb49d('0x2b')](_0xb49d('0x8e'),_0x59e84e[_0xb49d('0x32')],_0x59e84e[_0xb49d('0x7e')]);this[_0xb49d('0x14')][_0x59e84e[_0xb49d('0x32')]]['queue']=_0x59e84e[_0xb49d('0x7e')];}else if(this[_0xb49d('0x2f')](_0x59e84e[_0xb49d('0x7c')][_0xb49d('0x8f')])){logger[_0xb49d('0x2b')](_0xb49d('0x90'),_0x59e84e[_0xb49d('0x32')],_0x59e84e[_0xb49d('0x7e')]);this[_0xb49d('0x14')][_0x59e84e[_0xb49d('0x32')]][_0xb49d('0x91')]=_0x59e84e[_0xb49d('0x7e')];}}}else if(this[_0xb49d('0x2f')](_0x59e84e[_0xb49d('0x7c')][_0xb49d('0x92')])){if(_0x59e84e[_0xb49d('0x7e')]){var _0x448e13=path[_0xb49d('0x93')](_0x59e84e['value'])['name'];logger[_0xb49d('0x2b')](_0xb49d('0x7d'),_0x448e13,_0x59e84e[_0xb49d('0x7e')]);this['syncMixMonitorFilename'](_0x448e13,_0x59e84e['value']);}}else if(this['channels'][_0x59e84e[_0xb49d('0x36')]]){if(this[_0xb49d('0x2f')](_0x59e84e['variable'])){if(this['isNotNull'](_0x59e84e[_0xb49d('0x7c')][_0xb49d('0x8f')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x59e84e['linkedid'],_0x59e84e[_0xb49d('0x7e')]);this[_0xb49d('0x14')][_0x59e84e[_0xb49d('0x36')]][_0xb49d('0x94')]=_0x59e84e[_0xb49d('0x7e')];}}}}}catch(_0x25b574){logger[_0xb49d('0x45')]('[%s][voiceCallReport][varset]',_0x59e84e[_0xb49d('0x32')],util[_0xb49d('0x2e')](_0x25b574,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb49d('0x31')][_0xb49d('0x22')]=function(_0xdc06d2){try{if(this['isNotNull'](_0xdc06d2)){logger[_0xb49d('0x34')](_0xb49d('0x95'),_0xdc06d2['uniqueid'],util[_0xb49d('0x2e')](_0xdc06d2,{'showHidden':![],'depth':null}));if(this[_0xb49d('0x16')][_0xdc06d2['linkedid']]){if(this[_0xb49d('0x14')][this[_0xb49d('0x16')][_0xdc06d2['linkedid']][_0xb49d('0x36')]]){this[_0xb49d('0x14')][this[_0xb49d('0x16')][_0xdc06d2[_0xb49d('0x36')]][_0xb49d('0x36')]][_0xb49d('0x32')]=_0xdc06d2[_0xb49d('0x32')];this['channels'][this[_0xb49d('0x16')][_0xdc06d2[_0xb49d('0x36')]]['linkedid']][_0xb49d('0x68')]=this[_0xb49d('0x14')][_0xdc06d2[_0xb49d('0x32')]][_0xb49d('0x68')];this[_0xb49d('0x14')][this[_0xb49d('0x16')][_0xdc06d2['linkedid']][_0xb49d('0x36')]][_0xb49d('0x69')]=this[_0xb49d('0x14')][_0xdc06d2[_0xb49d('0x32')]][_0xb49d('0x69')];this[_0xb49d('0x14')][this[_0xb49d('0x16')][_0xdc06d2[_0xb49d('0x36')]][_0xb49d('0x36')]][_0xb49d('0x6d')]=this[_0xb49d('0x14')][this['blindTransfers'][_0xdc06d2['linkedid']]['linkedid']]['channel'];this[_0xb49d('0x14')][this[_0xb49d('0x16')][_0xdc06d2[_0xb49d('0x36')]]['linkedid']]['disposition']=this['channels'][_0xdc06d2[_0xb49d('0x32')]][_0xb49d('0x5b')];this[_0xb49d('0x14')][_0xdc06d2[_0xb49d('0x32')]]=this[_0xb49d('0x14')][this['blindTransfers'][_0xdc06d2[_0xb49d('0x36')]][_0xb49d('0x36')]];this['deleteChannelAfterTimeout'](this[_0xb49d('0x16')][_0xdc06d2[_0xb49d('0x36')]][_0xb49d('0x36')]);}else if(this['channels'][this[_0xb49d('0x16')][_0xdc06d2[_0xb49d('0x36')]][_0xb49d('0x32')]]){this[_0xb49d('0x14')][this['blindTransfers'][_0xdc06d2[_0xb49d('0x36')]]['uniqueid']][_0xb49d('0x32')]=[this[_0xb49d('0x14')][this[_0xb49d('0x16')][_0xdc06d2[_0xb49d('0x36')]][_0xb49d('0x32')]][_0xb49d('0x36')],this['channels'][this[_0xb49d('0x16')][_0xdc06d2[_0xb49d('0x36')]][_0xb49d('0x32')]][_0xb49d('0x36')]=this['channels'][this['blindTransfers'][_0xdc06d2[_0xb49d('0x36')]]['uniqueid']][_0xb49d('0x32')]][0x0];this[_0xb49d('0x14')][this[_0xb49d('0x16')][_0xdc06d2[_0xb49d('0x36')]][_0xb49d('0x32')]][_0xb49d('0x68')]=this['channels'][_0xdc06d2[_0xb49d('0x32')]][_0xb49d('0x68')];this[_0xb49d('0x14')][this[_0xb49d('0x16')][_0xdc06d2[_0xb49d('0x36')]][_0xb49d('0x32')]][_0xb49d('0x69')]=this[_0xb49d('0x14')][_0xdc06d2[_0xb49d('0x32')]][_0xb49d('0x69')];this['channels'][this['blindTransfers'][_0xdc06d2[_0xb49d('0x36')]]['uniqueid']][_0xb49d('0x6d')]=this[_0xb49d('0x14')][this['blindTransfers'][_0xdc06d2[_0xb49d('0x36')]][_0xb49d('0x32')]][_0xb49d('0x3c')];this['channels'][this['blindTransfers'][_0xdc06d2['linkedid']]['uniqueid']]['disposition']=this[_0xb49d('0x14')][_0xdc06d2['uniqueid']][_0xb49d('0x5b')];this['channels'][_0xdc06d2['uniqueid']]=this[_0xb49d('0x14')][this[_0xb49d('0x16')][_0xdc06d2[_0xb49d('0x36')]][_0xb49d('0x32')]];this[_0xb49d('0x96')](this[_0xb49d('0x16')][_0xdc06d2['linkedid']]['uniqueid']);}}if(this['channels'][_0xdc06d2[_0xb49d('0x32')]]){logger[_0xb49d('0x2b')](_0xb49d('0x97'),_0xdc06d2['uniqueid'],_0xdc06d2[_0xb49d('0x98')]);var _0x3746e4=moment();this[_0xb49d('0x14')][_0xdc06d2['uniqueid']][_0xb49d('0x99')]=_0x3746e4[_0xb49d('0x40')](_0xb49d('0x4b'));this[_0xb49d('0x14')][_0xdc06d2['uniqueid']][_0xb49d('0x58')]=_0x3746e4[_0xb49d('0x6b')](this[_0xb49d('0x14')][_0xdc06d2[_0xb49d('0x32')]][_0xb49d('0x4a')],'seconds');if(this[_0xb49d('0x14')][_0xdc06d2[_0xb49d('0x32')]][_0xb49d('0x68')]){this[_0xb49d('0x14')][_0xdc06d2[_0xb49d('0x32')]]['billableseconds']=_0x3746e4[_0xb49d('0x6b')](this[_0xb49d('0x14')][_0xdc06d2[_0xb49d('0x32')]]['answertime'],_0xb49d('0x5a'));this[_0xb49d('0x14')][_0xdc06d2[_0xb49d('0x32')]][_0xb49d('0x6a')]=this['channels'][_0xdc06d2[_0xb49d('0x32')]][_0xb49d('0x58')]-this[_0xb49d('0x14')][_0xdc06d2[_0xb49d('0x32')]]['billableseconds'];}if(_0xdc06d2[_0xb49d('0x49')]===_0xb49d('0x3b')){if(this[_0xb49d('0x15')][_0xdc06d2[_0xb49d('0x3c')][_0xb49d('0x3d')]('-')[0x0]]){this[_0xb49d('0x15')][_0xdc06d2['channel'][_0xb49d('0x3d')]('-')[0x0]]=_['omit'](this['agents'][_0xdc06d2['channel'][_0xb49d('0x3d')]('-')[0x0]],[_0xb49d('0x4e')]);logger['debug'](_0xb49d('0x9a'),_0xdc06d2[_0xb49d('0x32')],util[_0xb49d('0x2e')]({'id':this['agents'][_0xdc06d2[_0xb49d('0x3c')][_0xb49d('0x3d')]('-')[0x0]]['id'],'destaccountcode':this[_0xb49d('0x15')][_0xdc06d2['channel']['split']('-')[0x0]][_0xb49d('0x43')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xb49d('0x40')](_0xb49d('0x41'),this['agents'][_0xdc06d2['channel'][_0xb49d('0x3d')]('-')[0x0]]['name']),_0xb49d('0x9b'),{'id':this['agents'][_0xdc06d2['channel'][_0xb49d('0x3d')]('-')[0x0]]['id'],'destaccountcode':this[_0xb49d('0x15')][_0xdc06d2[_0xb49d('0x3c')][_0xb49d('0x3d')]('-')[0x0]][_0xb49d('0x43')]});for(var _0x221f6e=0x0;_0x221f6e{delete this[_0xb49d('0x14')][_0x40bea4];},_0xa2547a);}};module[_0xb49d('0xca')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 6316a65..6aca2e8 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf2b=['voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','startsWith','applicationdata','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','ioredis','../../../config/environment','../ami','redis','localhost','socket.io-emitter','channels','outboundChannels','applications','variables','dialbegin','syncDialBegin','bind','dialend','syncVarSet','hangup','syncHangup','isNotNull','isUndefined','emit','prototype','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','lastIndexOf','omit','event','privilege','info','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','substring','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','error','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','value','variable','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','duration','endtime','seconds','total','outbound','holdtime','diff','sumHoldTime','sumBillable','billableseconds','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0xbf2b,0x103));var _0xbbf2=function(_0x61b923,_0x4940a5){_0x61b923=_0x61b923-0x0;var _0x32b4c0=_0xbf2b[_0x61b923];return _0x32b4c0;};'use strict';var _=require(_0xbbf2('0x0'));var moment=require(_0xbbf2('0x1'));var util=require(_0xbbf2('0x2'));var Redis=require(_0xbbf2('0x3'));var config=require(_0xbbf2('0x4'));var logger=require('../../../config/logger')('ami');var ami=require(_0xbbf2('0x5'));config['redis']=_['defaults'](config[_0xbbf2('0x6')],{'host':_0xbbf2('0x7'),'port':0x18eb});var io=require(_0xbbf2('0x8'))(new Redis(config[_0xbbf2('0x6')]));function VoiceDialReport(_0x35a355){this[_0xbbf2('0x9')]=_0x35a355[_0xbbf2('0xa')];this['outbound']=_0x35a355['outbound'];this[_0xbbf2('0xb')]={};this[_0xbbf2('0xc')]={};ami['on'](_0xbbf2('0xd'),this[_0xbbf2('0xe')][_0xbbf2('0xf')](this));ami['on'](_0xbbf2('0x10'),this['syncDialEnd'][_0xbbf2('0xf')](this));ami['on']('varset',this[_0xbbf2('0x11')]['bind'](this));ami['on'](_0xbbf2('0x12'),this[_0xbbf2('0x13')][_0xbbf2('0xf')](this));}VoiceDialReport['prototype'][_0xbbf2('0x14')]=function(_0x2c24b9){return _0x2c24b9!==null&&!_[_0xbbf2('0x15')](_0x2c24b9);};VoiceDialReport['prototype'][_0xbbf2('0x16')]=function(_0x2949fd,_0x8fa510,_0x20706b){io['to'](_0x2949fd)[_0xbbf2('0x16')](_0x8fa510,_0x20706b);};VoiceDialReport[_0xbbf2('0x17')][_0xbbf2('0xe')]=function(_0x1dfb50){try{if(this[_0xbbf2('0x14')](_0x1dfb50)){logger[_0xbbf2('0x18')](_0xbbf2('0x19'),_0x1dfb50[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](_0x1dfb50,{'showHidden':![],'depth':null}));if(this[_0xbbf2('0x9')][_0x1dfb50[_0xbbf2('0x1a')]]){_[_0xbbf2('0x1c')](this[_0xbbf2('0x9')][_0x1dfb50[_0xbbf2('0x1a')]],{'starttime':moment()[_0xbbf2('0x1d')](_0xbbf2('0x1e')),'lastevent':'called','interface':_0x1dfb50[_0xbbf2('0x1f')]['substring'](0x0,_0x1dfb50[_0xbbf2('0x1f')][_0xbbf2('0x20')]('-')),'membername':_0x1dfb50[_0xbbf2('0x1f')]['substring'](_0x1dfb50['channel'][_0xbbf2('0x20')]('/')+0x1,_0x1dfb50[_0xbbf2('0x1f')][_0xbbf2('0x20')]('-'))},_[_0xbbf2('0x21')](_0x1dfb50,[_0xbbf2('0x22'),_0xbbf2('0x23')]));logger[_0xbbf2('0x24')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x1dfb50[_0xbbf2('0x1a')],this['channels'][_0x1dfb50[_0xbbf2('0x1a')]][_0xbbf2('0x25')],this[_0xbbf2('0x9')][_0x1dfb50[_0xbbf2('0x1a')]][_0xbbf2('0x26')]);logger['debug'](_0xbbf2('0x27'),_0x1dfb50[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](this[_0xbbf2('0x9')][_0x1dfb50[_0xbbf2('0x1a')]],{'showHidden':![],'depth':null}));if(this[_0xbbf2('0xb')][_0x1dfb50[_0xbbf2('0x1a')]])_[_0xbbf2('0x1c')](this[_0xbbf2('0x9')][_0x1dfb50['uniqueid']],this[_0xbbf2('0xb')][_0x1dfb50[_0xbbf2('0x1a')]]);this[_0xbbf2('0x16')](_0xbbf2('0x28'),_0xbbf2('0x29'),this['channels'][_0x1dfb50[_0xbbf2('0x1a')]]);logger[_0xbbf2('0x18')](_0xbbf2('0x2a'),_0x1dfb50[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](this[_0xbbf2('0x9')][_0x1dfb50[_0xbbf2('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xbbf2('0x16')]('custom:dialbegin',this[_0xbbf2('0x9')][_0x1dfb50[_0xbbf2('0x1a')]]);}}}catch(_0xda1f3){logger['error'](_0xbbf2('0x2b'),_0x1dfb50['uniqueid'],util[_0xbbf2('0x1b')](_0xda1f3,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xbbf2('0x2c')]=function(_0xc1ad3d){try{if(this[_0xbbf2('0x14')](_0xc1ad3d)){logger['debug'](_0xbbf2('0x2d'),_0xc1ad3d[_0xbbf2('0x1a')],util['inspect'](_0xc1ad3d,{'showHidden':![],'depth':null}));if(this['channels'][_0xc1ad3d[_0xbbf2('0x1a')]]){this['channels'][_0xc1ad3d[_0xbbf2('0x1a')]][_0xbbf2('0x2e')]=_0xc1ad3d['dialstatus'];if(_0xc1ad3d[_0xbbf2('0x2e')]===_0xbbf2('0x2f')){this['channels'][_0xc1ad3d['uniqueid']][_0xbbf2('0x30')]=_0xc1ad3d[_0xbbf2('0x30')];this['channels'][_0xc1ad3d[_0xbbf2('0x1a')]][_0xbbf2('0x31')]=_0xc1ad3d[_0xbbf2('0x31')];this[_0xbbf2('0x9')][_0xc1ad3d[_0xbbf2('0x1a')]][_0xbbf2('0x32')]=moment()[_0xbbf2('0x1d')](_0xbbf2('0x1e'));this[_0xbbf2('0x9')][_0xc1ad3d['uniqueid']][_0xbbf2('0x33')]=_0xbbf2('0x34');logger[_0xbbf2('0x24')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0xc1ad3d[_0xbbf2('0x1a')],_0xc1ad3d[_0xbbf2('0x1f')][_0xbbf2('0x35')](_0xc1ad3d['channel'][_0xbbf2('0x20')]('/')+0x1,_0xc1ad3d[_0xbbf2('0x1f')][_0xbbf2('0x20')]('-')));logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0xc1ad3d[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](this[_0xbbf2('0x9')][_0xc1ad3d['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xbbf2('0x16')]('custom:dialconnect',this['channels'][_0xc1ad3d['uniqueid']]);}logger[_0xbbf2('0x18')](_0xbbf2('0x36'),_0xc1ad3d[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](this[_0xbbf2('0x9')][_0xc1ad3d[_0xbbf2('0x1a')]],{'showHidden':![],'depth':null}));this[_0xbbf2('0x16')](_0xbbf2('0x28'),'voice_outbound_channel:save',this[_0xbbf2('0x9')][_0xc1ad3d[_0xbbf2('0x1a')]]);}}}catch(_0x2ca77b){logger[_0xbbf2('0x37')](_0xbbf2('0x38'),_0xc1ad3d[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](_0x2ca77b,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xbbf2('0x11')]=function(_0x524d4f){try{if(this[_0xbbf2('0x14')](_0x524d4f)){logger[_0xbbf2('0x18')](_0xbbf2('0x39'),_0x524d4f[_0xbbf2('0x1a')],util['inspect'](_0x524d4f,{'showHidden':![],'depth':null}));this['addVariable'](_0x524d4f[_0xbbf2('0x1a')],_['keys'](_0x524d4f['variable'])[0x0],_0x524d4f[_0xbbf2('0x3a')]);if(this['isNotNull'](_0x524d4f[_0xbbf2('0x3b')])&&this['isNotNull'](_0x524d4f[_0xbbf2('0x3b')][_0xbbf2('0x3c')])){if(_[_0xbbf2('0x15')](this[_0xbbf2('0x9')][_0x524d4f[_0xbbf2('0x1a')]])){this[_0xbbf2('0x9')][_0x524d4f[_0xbbf2('0x1a')]]={'routeId':_0x524d4f[_0xbbf2('0x3a')],'variables':this[_0xbbf2('0xc')][_0x524d4f[_0xbbf2('0x1a')]],'motionChannel':_0xbbf2('0x3d')};logger['info'](_0xbbf2('0x3e'),_0x524d4f[_0xbbf2('0x1a')],_0x524d4f[_0xbbf2('0x3b')][_0xbbf2('0x3c')],_[_0xbbf2('0x3f')](_0x524d4f['variable'])[0x0],_0x524d4f['value']);logger[_0xbbf2('0x18')](_0xbbf2('0x40'),_0x524d4f[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](this[_0xbbf2('0x9')][_0x524d4f[_0xbbf2('0x1a')]],{'showHidden':![],'depth':null}));this[_0xbbf2('0x16')](_0xbbf2('0x28'),'voice_outbound_channel:save',this[_0xbbf2('0x9')][_0x524d4f['uniqueid']]);}}}}catch(_0x3db160){logger['error'](_0xbbf2('0x41'),_0x524d4f[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](_0x3db160,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xbbf2('0x17')][_0xbbf2('0x42')]=function(_0x4c6c78,_0x2ef30e,_0x3330fa){var _0x47a0ca=[_0xbbf2('0x43'),_0xbbf2('0x44'),_0xbbf2('0x45'),_0xbbf2('0x46'),_0xbbf2('0x47'),_0xbbf2('0x48'),_0xbbf2('0x49'),'rtpaudioqosrttbridged',_0xbbf2('0x4a'),_0xbbf2('0x4b'),_0xbbf2('0x4c'),_0xbbf2('0x4d'),'membercalls',_0xbbf2('0x4e'),_0xbbf2('0x4f'),_0xbbf2('0x50'),_0xbbf2('0x25'),'memberpenalty',_0xbbf2('0x51')];if(!_[_0xbbf2('0x52')](_0x2ef30e)&&!_['includes'](_0x47a0ca,_0x2ef30e)){if(_[_0xbbf2('0x15')](this[_0xbbf2('0xc')][_0x4c6c78])){this['variables'][_0x4c6c78]={};}this['variables'][_0x4c6c78][_0x2ef30e]=_0x3330fa;}};VoiceDialReport[_0xbbf2('0x17')][_0xbbf2('0x13')]=function(_0x4ab54f){try{if(this[_0xbbf2('0x14')](_0x4ab54f)){logger['debug'](_0xbbf2('0x53'),_0x4ab54f['uniqueid'],util[_0xbbf2('0x1b')](_0x4ab54f,{'showHidden':![],'depth':null}));if(this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]]){logger['info'](_0xbbf2('0x54'),_0x4ab54f[_0xbbf2('0x1a')],_0x4ab54f[_0xbbf2('0x55')]);this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]]['endtime']=moment()[_0xbbf2('0x1d')](_0xbbf2('0x1e'));this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]][_0xbbf2('0x56')]=moment(this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]][_0xbbf2('0x57')])['diff'](this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]]['starttime'],_0xbbf2('0x58'));this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]][_0xbbf2('0x33')]='complete';this['outbound'][_0xbbf2('0x59')]+=0x1;if(this[_0xbbf2('0x9')][_0x4ab54f['uniqueid']]['answertime']){this[_0xbbf2('0x5a')]['answered']+=0x1;this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]][_0xbbf2('0x5b')]=moment(this['channels'][_0x4ab54f[_0xbbf2('0x1a')]][_0xbbf2('0x32')])[_0xbbf2('0x5c')](this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]]['starttime'],'seconds');this['channels'][_0x4ab54f['uniqueid']]['billableseconds']=moment(this['channels'][_0x4ab54f[_0xbbf2('0x1a')]]['endtime'])[_0xbbf2('0x5c')](this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]][_0xbbf2('0x32')],'seconds');this[_0xbbf2('0x5a')][_0xbbf2('0x5d')]+=this['channels'][_0x4ab54f[_0xbbf2('0x1a')]]['holdtime']||0x0;this[_0xbbf2('0x5a')][_0xbbf2('0x5e')]+=this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]][_0xbbf2('0x5f')];}this['outbound']['sumDuration']+=this[_0xbbf2('0x9')][_0x4ab54f['uniqueid']][_0xbbf2('0x56')];logger[_0xbbf2('0x18')](_0xbbf2('0x60'),_0x4ab54f[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xbbf2('0x16')](_0xbbf2('0x61'),this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]]);logger[_0xbbf2('0x18')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x4ab54f[_0xbbf2('0x1a')],util['inspect'](this['channels'][_0x4ab54f[_0xbbf2('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xbbf2('0x16')](_0xbbf2('0x62'),this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]]);logger['debug'](_0xbbf2('0x63'),_0x4ab54f[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]],{'showHidden':![],'depth':null}));this[_0xbbf2('0x16')](_0xbbf2('0x28'),_0xbbf2('0x64'),this[_0xbbf2('0x5a')]);logger['info'](_0xbbf2('0x65'),JSON[_0xbbf2('0x66')](this[_0xbbf2('0x9')][_0x4ab54f['uniqueid']]));logger[_0xbbf2('0x18')](_0xbbf2('0x67'),_0x4ab54f[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](this['channels'][_0x4ab54f[_0xbbf2('0x1a')]],{'showHidden':![],'depth':null}));this[_0xbbf2('0x16')](_0xbbf2('0x28'),_0xbbf2('0x68'),this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]]);this[_0xbbf2('0x69')](_0x4ab54f[_0xbbf2('0x1a')]);}else if(this[_0xbbf2('0x9')][_0x4ab54f['linkedid']]){this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x6a')]][_0xbbf2('0x1a')]=this['channels'][_0x4ab54f[_0xbbf2('0x6a')]][_0xbbf2('0x6b')];}if(this['variables'][_0x4ab54f[_0xbbf2('0x1a')]]){delete this[_0xbbf2('0xc')][_0x4ab54f[_0xbbf2('0x1a')]];}}}catch(_0x2f54e8){logger['error'](_0xbbf2('0x6c'),_0x4ab54f[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](_0x2f54e8,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xbbf2('0x17')][_0xbbf2('0x6d')]=function(_0x46ee72){try{if(this[_0xbbf2('0x14')](_0x46ee72)){logger[_0xbbf2('0x18')](_0xbbf2('0x6e'),_0x46ee72[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](_0x46ee72,{'showHidden':![],'depth':null}));if(_0x46ee72[_0xbbf2('0x6f')][_0xbbf2('0x70')]()===_0xbbf2('0x71')){_0x46ee72['applicationdata']=(_0x46ee72['appdata']||_0x46ee72['applicationdata'])[_0xbbf2('0x70')]();if(_[_0xbbf2('0x72')](_0x46ee72[_0xbbf2('0x73')],_0xbbf2('0x74'))){if(_['isUndefined'](this[_0xbbf2('0xb')][_0x46ee72['uniqueid']]))this[_0xbbf2('0xb')][_0x46ee72[_0xbbf2('0x1a')]]={};logger[_0xbbf2('0x24')](_0xbbf2('0x75'),_0x46ee72['uniqueid'],_0x46ee72[_0xbbf2('0x6f')],_0x46ee72[_0xbbf2('0x73')]);var _0x984960=_0x46ee72[_0xbbf2('0x73')]['split']('=');var _0x2cc98a=_0x984960[0x0][_0xbbf2('0x76')](/cdr\((.*)\)/);if(_0x2cc98a)this[_0xbbf2('0xb')][_0x46ee72[_0xbbf2('0x1a')]][_0x2cc98a[0x1]]=_0x984960[0x1];}}}}catch(_0x15733b){logger[_0xbbf2('0x37')](_0xbbf2('0x77'),_0x46ee72[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](_0x15733b,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xbbf2('0x69')]=function(_0x195e65,_0x17e164=0x2710){if(this[_0xbbf2('0x9')][_0x195e65]){setTimeout(()=>{delete this[_0xbbf2('0x9')][_0x195e65];},_0x17e164);}};module[_0xbbf2('0x78')]=VoiceDialReport; \ No newline at end of file +var _0xe3e4=['voice:outbound','voice_outbound_channel:save','inspect','emit','custom:dialbegin','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]','addVariable','variable','outboundrouteid','value','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','YYYY-MM-DD\x20HH:mm:ss','duration','diff','starttime','seconds','complete','answered','holdtime','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','voice_outbound:save','stringify','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','startsWith','[%s][voiceDialReport][newexten]','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','redis','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','syncHangup','prototype','isUndefined','isNotNull','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','format','called','channel','substring','lastIndexOf','omit','event','privilege','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','merge'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xe3e4,0xc3));var _0x4e3e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe3e4[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4e3e('0x0'));var moment=require(_0x4e3e('0x1'));var util=require(_0x4e3e('0x2'));var Redis=require('ioredis');var config=require(_0x4e3e('0x3'));var logger=require(_0x4e3e('0x4'))(_0x4e3e('0x5'));var ami=require(_0x4e3e('0x6'));config[_0x4e3e('0x7')]=_['defaults'](config[_0x4e3e('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x4e3e('0x8'))(new Redis(config[_0x4e3e('0x7')]));function VoiceDialReport(_0x2f5942){this[_0x4e3e('0x9')]=_0x2f5942[_0x4e3e('0xa')];this[_0x4e3e('0xb')]=_0x2f5942[_0x4e3e('0xb')];this[_0x4e3e('0xc')]={};this[_0x4e3e('0xd')]={};ami['on'](_0x4e3e('0xe'),this[_0x4e3e('0xf')][_0x4e3e('0x10')](this));ami['on'](_0x4e3e('0x11'),this[_0x4e3e('0x12')]['bind'](this));ami['on'](_0x4e3e('0x13'),this[_0x4e3e('0x14')][_0x4e3e('0x10')](this));ami['on']('hangup',this[_0x4e3e('0x15')]['bind'](this));}VoiceDialReport[_0x4e3e('0x16')]['isNotNull']=function(_0x571933){return _0x571933!==null&&!_[_0x4e3e('0x17')](_0x571933);};VoiceDialReport['prototype']['emit']=function(_0x11e9cc,_0x1d628a,_0x1a42ee){io['to'](_0x11e9cc)['emit'](_0x1d628a,_0x1a42ee);};VoiceDialReport['prototype'][_0x4e3e('0xf')]=function(_0x589dc1){try{if(this[_0x4e3e('0x18')](_0x589dc1)){logger['debug'](_0x4e3e('0x19'),_0x589dc1['uniqueid'],util['inspect'](_0x589dc1,{'showHidden':![],'depth':null}));if(this[_0x4e3e('0x9')][_0x589dc1[_0x4e3e('0x1a')]]){_['merge'](this['channels'][_0x589dc1[_0x4e3e('0x1a')]],{'starttime':moment()[_0x4e3e('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x4e3e('0x1c'),'interface':_0x589dc1[_0x4e3e('0x1d')][_0x4e3e('0x1e')](0x0,_0x589dc1[_0x4e3e('0x1d')][_0x4e3e('0x1f')]('-')),'membername':_0x589dc1[_0x4e3e('0x1d')][_0x4e3e('0x1e')](_0x589dc1[_0x4e3e('0x1d')]['lastIndexOf']('/')+0x1,_0x589dc1[_0x4e3e('0x1d')][_0x4e3e('0x1f')]('-'))},_[_0x4e3e('0x20')](_0x589dc1,[_0x4e3e('0x21'),_0x4e3e('0x22')]));logger['info']('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x589dc1[_0x4e3e('0x1a')],this[_0x4e3e('0x9')][_0x589dc1[_0x4e3e('0x1a')]]['membername'],this[_0x4e3e('0x9')][_0x589dc1[_0x4e3e('0x1a')]][_0x4e3e('0x23')]);logger[_0x4e3e('0x24')](_0x4e3e('0x25'),_0x589dc1['uniqueid'],util['inspect'](this[_0x4e3e('0x9')][_0x589dc1[_0x4e3e('0x1a')]],{'showHidden':![],'depth':null}));if(this[_0x4e3e('0xc')][_0x589dc1[_0x4e3e('0x1a')]])_[_0x4e3e('0x26')](this[_0x4e3e('0x9')][_0x589dc1[_0x4e3e('0x1a')]],this[_0x4e3e('0xc')][_0x589dc1['uniqueid']]);this['emit'](_0x4e3e('0x27'),_0x4e3e('0x28'),this[_0x4e3e('0x9')][_0x589dc1[_0x4e3e('0x1a')]]);logger['debug']('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x589dc1['uniqueid'],util[_0x4e3e('0x29')](this['channels'][_0x589dc1['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x4e3e('0x2a')](_0x4e3e('0x2b'),this[_0x4e3e('0x9')][_0x589dc1[_0x4e3e('0x1a')]]);}}}catch(_0x499c96){logger[_0x4e3e('0x2c')]('[%s][voiceDialReport][dialbegin]',_0x589dc1[_0x4e3e('0x1a')],util['inspect'](_0x499c96,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4e3e('0x16')][_0x4e3e('0x12')]=function(_0xaf066a){try{if(this['isNotNull'](_0xaf066a)){logger['debug'](_0x4e3e('0x2d'),_0xaf066a[_0x4e3e('0x1a')],util['inspect'](_0xaf066a,{'showHidden':![],'depth':null}));if(this[_0x4e3e('0x9')][_0xaf066a[_0x4e3e('0x1a')]]){this[_0x4e3e('0x9')][_0xaf066a['uniqueid']][_0x4e3e('0x2e')]=_0xaf066a[_0x4e3e('0x2e')];if(_0xaf066a[_0x4e3e('0x2e')]===_0x4e3e('0x2f')){this['channels'][_0xaf066a[_0x4e3e('0x1a')]][_0x4e3e('0x30')]=_0xaf066a[_0x4e3e('0x30')];this[_0x4e3e('0x9')][_0xaf066a[_0x4e3e('0x1a')]][_0x4e3e('0x31')]=_0xaf066a['connectedlinename'];this[_0x4e3e('0x9')][_0xaf066a[_0x4e3e('0x1a')]][_0x4e3e('0x32')]=moment()[_0x4e3e('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4e3e('0x9')][_0xaf066a[_0x4e3e('0x1a')]][_0x4e3e('0x33')]=_0x4e3e('0x34');logger[_0x4e3e('0x35')](_0x4e3e('0x36'),_0xaf066a[_0x4e3e('0x1a')],_0xaf066a[_0x4e3e('0x1d')][_0x4e3e('0x1e')](_0xaf066a['channel'][_0x4e3e('0x1f')]('/')+0x1,_0xaf066a[_0x4e3e('0x1d')][_0x4e3e('0x1f')]('-')));logger[_0x4e3e('0x24')](_0x4e3e('0x37'),_0xaf066a['uniqueid'],util[_0x4e3e('0x29')](this[_0x4e3e('0x9')][_0xaf066a[_0x4e3e('0x1a')]],{'showHidden':![],'depth':null}));ami['emit'](_0x4e3e('0x38'),this[_0x4e3e('0x9')][_0xaf066a['uniqueid']]);}logger[_0x4e3e('0x24')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0xaf066a['uniqueid'],util[_0x4e3e('0x29')](this[_0x4e3e('0x9')][_0xaf066a[_0x4e3e('0x1a')]],{'showHidden':![],'depth':null}));this[_0x4e3e('0x2a')]('voice:outbound',_0x4e3e('0x28'),this[_0x4e3e('0x9')][_0xaf066a[_0x4e3e('0x1a')]]);}}}catch(_0x399353){logger['error'](_0x4e3e('0x39'),_0xaf066a[_0x4e3e('0x1a')],util['inspect'](_0x399353,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4e3e('0x16')]['syncVarSet']=function(_0x4bd3d1){try{if(this[_0x4e3e('0x18')](_0x4bd3d1)){logger[_0x4e3e('0x24')]('[%s][voiceDialReport][varset]\x20event:',_0x4bd3d1[_0x4e3e('0x1a')],util['inspect'](_0x4bd3d1,{'showHidden':![],'depth':null}));this[_0x4e3e('0x3a')](_0x4bd3d1[_0x4e3e('0x1a')],_['keys'](_0x4bd3d1['variable'])[0x0],_0x4bd3d1['value']);if(this['isNotNull'](_0x4bd3d1['variable'])&&this['isNotNull'](_0x4bd3d1[_0x4e3e('0x3b')][_0x4e3e('0x3c')])){if(_[_0x4e3e('0x17')](this[_0x4e3e('0x9')][_0x4bd3d1[_0x4e3e('0x1a')]])){this[_0x4e3e('0x9')][_0x4bd3d1[_0x4e3e('0x1a')]]={'routeId':_0x4bd3d1[_0x4e3e('0x3d')],'variables':this[_0x4e3e('0xd')][_0x4bd3d1[_0x4e3e('0x1a')]],'motionChannel':_0x4e3e('0x3e')};logger[_0x4e3e('0x35')](_0x4e3e('0x3f'),_0x4bd3d1[_0x4e3e('0x1a')],_0x4bd3d1[_0x4e3e('0x3b')][_0x4e3e('0x3c')],_['keys'](_0x4bd3d1[_0x4e3e('0x3b')])[0x0],_0x4bd3d1[_0x4e3e('0x3d')]);logger[_0x4e3e('0x24')](_0x4e3e('0x40'),_0x4bd3d1[_0x4e3e('0x1a')],util['inspect'](this[_0x4e3e('0x9')][_0x4bd3d1[_0x4e3e('0x1a')]],{'showHidden':![],'depth':null}));this[_0x4e3e('0x2a')]('voice:outbound',_0x4e3e('0x28'),this[_0x4e3e('0x9')][_0x4bd3d1['uniqueid']]);}}}}catch(_0x4b6d4d){logger['error'](_0x4e3e('0x41'),_0x4bd3d1[_0x4e3e('0x1a')],util[_0x4e3e('0x29')](_0x4b6d4d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4e3e('0x16')][_0x4e3e('0x3a')]=function(_0x503b19,_0x1bfaf7,_0x3cb7c7){var _0x320ad9=['rtpaudioqos',_0x4e3e('0x42'),_0x4e3e('0x43'),_0x4e3e('0x44'),_0x4e3e('0x45'),_0x4e3e('0x46'),_0x4e3e('0x47'),_0x4e3e('0x48'),_0x4e3e('0x49'),_0x4e3e('0x4a'),_0x4e3e('0x4b'),'bridgepvtcallid',_0x4e3e('0x4c'),_0x4e3e('0x4d'),_0x4e3e('0x4e'),_0x4e3e('0x4f'),_0x4e3e('0x50'),_0x4e3e('0x51'),_0x4e3e('0x52')];if(!_[_0x4e3e('0x53')](_0x1bfaf7)&&!_[_0x4e3e('0x54')](_0x320ad9,_0x1bfaf7)){if(_[_0x4e3e('0x17')](this['variables'][_0x503b19])){this[_0x4e3e('0xd')][_0x503b19]={};}this[_0x4e3e('0xd')][_0x503b19][_0x1bfaf7]=_0x3cb7c7;}};VoiceDialReport['prototype']['syncHangup']=function(_0x57241a){try{if(this[_0x4e3e('0x18')](_0x57241a)){logger[_0x4e3e('0x24')]('[%s][voiceDialReport][hangup]\x20event:',_0x57241a[_0x4e3e('0x1a')],util[_0x4e3e('0x29')](_0x57241a,{'showHidden':![],'depth':null}));if(this[_0x4e3e('0x9')][_0x57241a[_0x4e3e('0x1a')]]){logger[_0x4e3e('0x35')](_0x4e3e('0x55'),_0x57241a[_0x4e3e('0x1a')],_0x57241a[_0x4e3e('0x56')]);this[_0x4e3e('0x9')][_0x57241a['uniqueid']][_0x4e3e('0x57')]=moment()[_0x4e3e('0x1b')](_0x4e3e('0x58'));this[_0x4e3e('0x9')][_0x57241a[_0x4e3e('0x1a')]][_0x4e3e('0x59')]=moment(this['channels'][_0x57241a[_0x4e3e('0x1a')]]['endtime'])[_0x4e3e('0x5a')](this[_0x4e3e('0x9')][_0x57241a[_0x4e3e('0x1a')]][_0x4e3e('0x5b')],_0x4e3e('0x5c'));this[_0x4e3e('0x9')][_0x57241a['uniqueid']][_0x4e3e('0x33')]=_0x4e3e('0x5d');this[_0x4e3e('0xb')]['total']+=0x1;if(this[_0x4e3e('0x9')][_0x57241a[_0x4e3e('0x1a')]]['answertime']){this[_0x4e3e('0xb')][_0x4e3e('0x5e')]+=0x1;this[_0x4e3e('0x9')][_0x57241a[_0x4e3e('0x1a')]][_0x4e3e('0x5f')]=moment(this[_0x4e3e('0x9')][_0x57241a[_0x4e3e('0x1a')]][_0x4e3e('0x32')])['diff'](this[_0x4e3e('0x9')][_0x57241a[_0x4e3e('0x1a')]][_0x4e3e('0x5b')],_0x4e3e('0x5c'));this[_0x4e3e('0x9')][_0x57241a[_0x4e3e('0x1a')]]['billableseconds']=moment(this[_0x4e3e('0x9')][_0x57241a['uniqueid']][_0x4e3e('0x57')])['diff'](this[_0x4e3e('0x9')][_0x57241a[_0x4e3e('0x1a')]]['answertime'],_0x4e3e('0x5c'));this[_0x4e3e('0xb')][_0x4e3e('0x60')]+=this[_0x4e3e('0x9')][_0x57241a[_0x4e3e('0x1a')]][_0x4e3e('0x5f')]||0x0;this[_0x4e3e('0xb')][_0x4e3e('0x61')]+=this['channels'][_0x57241a[_0x4e3e('0x1a')]]['billableseconds'];}this[_0x4e3e('0xb')][_0x4e3e('0x62')]+=this[_0x4e3e('0x9')][_0x57241a[_0x4e3e('0x1a')]][_0x4e3e('0x59')];logger[_0x4e3e('0x24')](_0x4e3e('0x63'),_0x57241a[_0x4e3e('0x1a')],util['inspect'](this[_0x4e3e('0x9')][_0x57241a[_0x4e3e('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x4e3e('0x2a')](_0x4e3e('0x64'),this[_0x4e3e('0x9')][_0x57241a['uniqueid']]);logger[_0x4e3e('0x24')](_0x4e3e('0x65'),_0x57241a['uniqueid'],util[_0x4e3e('0x29')](this[_0x4e3e('0x9')][_0x57241a[_0x4e3e('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x4e3e('0x2a')](_0x4e3e('0x66'),this[_0x4e3e('0x9')][_0x57241a[_0x4e3e('0x1a')]]);logger[_0x4e3e('0x24')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x57241a['uniqueid'],util[_0x4e3e('0x29')](this[_0x4e3e('0x9')][_0x57241a[_0x4e3e('0x1a')]],{'showHidden':![],'depth':null}));this[_0x4e3e('0x2a')](_0x4e3e('0x27'),_0x4e3e('0x67'),this[_0x4e3e('0xb')]);logger[_0x4e3e('0x35')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x4e3e('0x68')](this[_0x4e3e('0x9')][_0x57241a[_0x4e3e('0x1a')]]));logger[_0x4e3e('0x24')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x57241a[_0x4e3e('0x1a')],util[_0x4e3e('0x29')](this[_0x4e3e('0x9')][_0x57241a[_0x4e3e('0x1a')]],{'showHidden':![],'depth':null}));this[_0x4e3e('0x2a')](_0x4e3e('0x27'),_0x4e3e('0x69'),this[_0x4e3e('0x9')][_0x57241a[_0x4e3e('0x1a')]]);this[_0x4e3e('0x6a')](_0x57241a[_0x4e3e('0x1a')]);}else if(this[_0x4e3e('0x9')][_0x57241a['linkedid']]){this[_0x4e3e('0x9')][_0x57241a[_0x4e3e('0x6b')]][_0x4e3e('0x1a')]=this[_0x4e3e('0x9')][_0x57241a[_0x4e3e('0x6b')]][_0x4e3e('0x6c')];}if(this['variables'][_0x57241a['uniqueid']]){delete this[_0x4e3e('0xd')][_0x57241a[_0x4e3e('0x1a')]];}}}catch(_0x105659){logger[_0x4e3e('0x2c')]('[%s][voiceDialReport][hangup]',_0x57241a[_0x4e3e('0x1a')],util['inspect'](_0x105659,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4e3e('0x16')][_0x4e3e('0x6d')]=function(_0x7f773f){try{if(this['isNotNull'](_0x7f773f)){logger[_0x4e3e('0x24')](_0x4e3e('0x6e'),_0x7f773f[_0x4e3e('0x1a')],util[_0x4e3e('0x29')](_0x7f773f,{'showHidden':![],'depth':null}));if(_0x7f773f[_0x4e3e('0x6f')][_0x4e3e('0x70')]()===_0x4e3e('0x71')){_0x7f773f[_0x4e3e('0x72')]=(_0x7f773f['appdata']||_0x7f773f[_0x4e3e('0x72')])[_0x4e3e('0x70')]();if(_[_0x4e3e('0x73')](_0x7f773f[_0x4e3e('0x72')],'cdr(')){if(_[_0x4e3e('0x17')](this[_0x4e3e('0xc')][_0x7f773f['uniqueid']]))this['applications'][_0x7f773f[_0x4e3e('0x1a')]]={};logger[_0x4e3e('0x35')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x7f773f['uniqueid'],_0x7f773f[_0x4e3e('0x6f')],_0x7f773f[_0x4e3e('0x72')]);var _0x48d661=_0x7f773f['applicationdata']['split']('=');var _0x2fe8a5=_0x48d661[0x0]['match'](/cdr\((.*)\)/);if(_0x2fe8a5)this[_0x4e3e('0xc')][_0x7f773f[_0x4e3e('0x1a')]][_0x2fe8a5[0x1]]=_0x48d661[0x1];}}}}catch(_0x5c201){logger[_0x4e3e('0x2c')](_0x4e3e('0x74'),_0x7f773f[_0x4e3e('0x1a')],util['inspect'](_0x5c201,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4e3e('0x16')][_0x4e3e('0x6a')]=function(_0xf20f81,_0x52bafb=0x2710){if(this[_0x4e3e('0x9')][_0xf20f81]){setTimeout(()=>{delete this[_0x4e3e('0x9')][_0xf20f81];},_0x52bafb);}};module['exports']=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index b46a2b1..cef860b 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf316=['last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','connectedlinenum','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','queuecallerexitAt','add','seconds','FORWARDTRANSFER','transfertype','destexten','transferuniqueid','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','syncVarSet','[%s][voiceQueueReport][varset]','addVariable','value','variable','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','queuecallerleaveAt','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberlastcall','memberpenalty','isNil','handleHangup','length','sumHoldTime','queuecallerjoinAt','sumDuration','milliseconds','total','answered','sumBillable','unmanaged','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','cause-txt','cause','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','[%s][voiceQueueReport][hangup]','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','transferexten','secondtransfereruniqueid','ATTENDED','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','secondtransfererexten','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','applicationdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','[%s][voiceQueueReport][newexten]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','queueReports','agents','queueChannels','voiceQueues','campaigns','summary','variables','queuesummary','syncQueueSummary','bind','syncQueueSummaryComplete','syncQueueMember','queuestatuscomplete','queuecallerjoin','syncQueueCallerJoin','queuecallerleave','syncQueueCallerLeave','syncAgentComplete','agentconnect','syncAgentConnect','varset','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','hasOwnProperty','isEmpty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','queuecallerexit','queuecallerabandon','prototype','channels','sequence','channel','catch','[%s][voiceQueueReport][checkChannel]','inspect','error','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','clearQueueReport','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','queue','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isNotNull','isUndefined','Action','queues','then','actionid','queuestatus','[voiceQueueReport][queuesummary]','createQueueSummaryReport','summaryEvent','realtime','handleInboundQueueSummaryReport','assign','inbound','outbound','custom:queuesummary','completeEvent','statusRequests','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','YYYY-MM-DD\x20HH:mm:ss','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','keys','syncQueueCallerAbandon','[%s][voiceQueueReport][queuecallerabandon]'];(function(_0x366a0a,_0x2acd21){var _0x523049=function(_0x1b46ca){while(--_0x1b46ca){_0x366a0a['push'](_0x366a0a['shift']());}};_0x523049(++_0x2acd21);}(_0xf316,0x162));var _0x6f31=function(_0x3ab324,_0x135e8a){_0x3ab324=_0x3ab324-0x0;var _0x30c172=_0xf316[_0x3ab324];return _0x30c172;};'use strict';var _=require(_0x6f31('0x0'));var moment=require(_0x6f31('0x1'));var util=require(_0x6f31('0x2'));var Redis=require('ioredis');var config=require(_0x6f31('0x3'));var logger=require(_0x6f31('0x4'))(_0x6f31('0x5'));var ami=require(_0x6f31('0x6'));var QueueReport=require(_0x6f31('0x7'));var VoiceQueueSummary=require(_0x6f31('0x8'));config[_0x6f31('0x9')]=_[_0x6f31('0xa')](config[_0x6f31('0x9')],{'host':_0x6f31('0xb'),'port':0x18eb});var io=require(_0x6f31('0xc'))(new Redis(config[_0x6f31('0x9')]));var Sequence=function(){};Sequence['prototype'][_0x6f31('0xd')]=function(_0xe8940a){this[_0x6f31('0xe')]=this[_0x6f31('0xe')]?this['tail'][_0x6f31('0xf')](_0xe8940a):_0xe8940a();};function VoiceQueueReport(_0x48e1b5){this['sequence']=new Sequence();this[_0x6f31('0x10')]={};this['realtime']=_0x48e1b5;this[_0x6f31('0x11')]=_0x48e1b5[_0x6f31('0x11')];this['channels']=_0x48e1b5[_0x6f31('0x12')];this[_0x6f31('0x13')]=_0x48e1b5[_0x6f31('0x13')];this[_0x6f31('0x14')]=_0x48e1b5[_0x6f31('0x14')];this[_0x6f31('0x15')]=initializeSummary();this[_0x6f31('0x16')]={};ami['on'](_0x6f31('0x17'),this[_0x6f31('0x18')][_0x6f31('0x19')](this));ami['on']('queuesummarycomplete',this[_0x6f31('0x1a')][_0x6f31('0x19')](this));ami['on']('queuemember',this[_0x6f31('0x1b')]['bind'](this));ami['on'](_0x6f31('0x1c'),this['syncQueueStatusComplete'][_0x6f31('0x19')](this));ami['on'](_0x6f31('0x1d'),this[_0x6f31('0x1e')][_0x6f31('0x19')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x6f31('0x19')](this));ami['on'](_0x6f31('0x1f'),this[_0x6f31('0x20')][_0x6f31('0x19')](this));ami['on']('agentcomplete',this[_0x6f31('0x21')][_0x6f31('0x19')](this));ami['on'](_0x6f31('0x22'),this[_0x6f31('0x23')]['bind'](this));ami['on'](_0x6f31('0x24'),this['syncVarSet'][_0x6f31('0x19')](this));ami['on'](_0x6f31('0x25'),this[_0x6f31('0x26')][_0x6f31('0x19')](this));ami['on'](_0x6f31('0x27'),this[_0x6f31('0x28')]['bind'](this));ami['on'](_0x6f31('0x29'),this[_0x6f31('0x2a')]['bind'](this));ami['on'](_0x6f31('0x2b'),this[_0x6f31('0x2c')]['bind'](this));ami['on']('attendedtransfer',this[_0x6f31('0x2d')]['bind'](this));ami['on'](_0x6f31('0x2e'),this[_0x6f31('0x2f')]['bind'](this));this[_0x6f31('0x30')]();this[_0x6f31('0x31')]();}function clearChannels(_0x25631f){if(!_['isEmpty'](_0x25631f)){for(var _0x318b05 in _0x25631f){if(_0x25631f['hasOwnProperty'](_0x318b05)){delete _0x25631f[_0x318b05];}}}}function clearCampaigns(_0x201724){if(!_['isEmpty'](_0x201724)){for(var _0x8243ce in _0x201724){if(_0x201724[_0x6f31('0x32')](_0x8243ce)){_0x201724[_0x8243ce]['originated']=0x0;}}}}function clearVoiceQueues(_0x491a19){if(!_[_0x6f31('0x33')](_0x491a19)){for(var _0x4da831 in _0x491a19){if(_0x491a19['hasOwnProperty'](_0x4da831)){_0x491a19[_0x4da831][_0x6f31('0x34')]=0x0;_0x491a19[_0x4da831][_0x6f31('0x35')]=0x0;_0x491a19[_0x4da831][_0x6f31('0x36')]=0x0;_0x491a19[_0x4da831][_0x6f31('0x37')]=0x0;_0x491a19[_0x4da831][_0x6f31('0x38')]=!![];}}}}function clearAgentBooked(_0x314eac){if(!_[_0x6f31('0x33')](_0x314eac)){for(var _0xfdd99e in _0x314eac){if(_0x314eac[_0x6f31('0x32')](_0xfdd99e)){_0x314eac[_0xfdd99e][_0x6f31('0x39')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x241dae){return _0x241dae[_0x6f31('0x3a')]||_0x241dae[_0x6f31('0x3b')]||_0x241dae['queuecallercomplete'];}VoiceQueueReport[_0x6f31('0x3c')]['clearZombieChannels']=function(){var _0x5db6ce=this;for(var _0xfbc041 in this['channels']){if(this[_0x6f31('0x3d')]['hasOwnProperty'](_0xfbc041)&&!this['channels'][_0xfbc041]['switch']){this[_0x6f31('0x3e')]['enqueue'](function(){if(!_['isNil'](_0x5db6ce[_0x6f31('0x3d')][_0xfbc041])){return ami['Action']({'action':'status','channel':_0x5db6ce['channels'][_0xfbc041][_0x6f31('0x3f')]})[_0x6f31('0x40')](function(_0x13d857){if(_0x13d857['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x5db6ce['channels'][_0xfbc041]){delete _0x5db6ce[_0x6f31('0x3d')][_0xfbc041];logger['error'](_0x6f31('0x41'),_0xfbc041,util[_0x6f31('0x42')](_0x13d857,{'showHidden':![],'depth':null}));}if(_0x5db6ce[_0x6f31('0x10')][_0xfbc041]){delete _0x5db6ce['queueReports'][_0xfbc041];logger[_0x6f31('0x43')](_0x6f31('0x44'),_0xfbc041,util[_0x6f31('0x42')](_0x13d857,{'showHidden':![],'depth':null}));}if(_0x5db6ce[_0x6f31('0x16')][_0xfbc041]){delete _0x5db6ce[_0x6f31('0x16')][_0xfbc041];logger[_0x6f31('0x43')](_0x6f31('0x45'),_0xfbc041,util[_0x6f31('0x42')](_0x13d857,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x28')]=function(){logger[_0x6f31('0x43')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0x6f31('0x3d')]);this[_0x6f31('0x46')](this['queueReports']);clearAgentBooked(this[_0x6f31('0x11')]);clearVoiceQueues(this[_0x6f31('0x13')]);clearCampaigns(this['campaigns']);this[_0x6f31('0x15')]=initializeSummary();};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x46')]=function(_0x204c3e){var _0x32fadd=this;if(!_['isEmpty'](_0x204c3e)){for(var _0x53bff2 in _0x204c3e){if(_0x204c3e['hasOwnProperty'](_0x53bff2)){_0x32fadd[_0x6f31('0x47')](_0x204c3e[_0x53bff2],'clearqueuereport');delete _0x204c3e[_0x53bff2];}}}};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x48')]=function(_0x35ad0a,_0x2d4735,_0x4ea370){io['to'](_0x35ad0a)[_0x6f31('0x48')](_0x2d4735,_0x4ea370);};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x49')]=function(_0x4a90a,_0x16715a){logger[_0x6f31('0x4a')](_0x6f31('0x4b')+_0x16715a+_0x6f31('0x4c'),_0x4a90a[_0x6f31('0x4d')],util['inspect'](_0x4a90a,{'showHidden':![],'depth':null}));this[_0x6f31('0x48')](util[_0x6f31('0x4e')](_0x6f31('0x4f'),_0x4a90a[_0x6f31('0x50')]),_0x6f31('0x51'),_0x4a90a);io[_0x6f31('0x48')](_0x6f31('0x52'),_0x4a90a);};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x47')]=function(_0x50ef79,_0x3aec8c){logger[_0x6f31('0x4a')](_0x6f31('0x4b')+_0x3aec8c+_0x6f31('0x53'),_0x50ef79[_0x6f31('0x4d')],util[_0x6f31('0x42')](_0x50ef79,{'showHidden':![],'depth':null}));if(_0x50ef79[_0x6f31('0x54')]===_0x6f31('0x55')){return;}this[_0x6f31('0x48')](util[_0x6f31('0x4e')]('voice:queue:%s',_0x50ef79[_0x6f31('0x50')]),_0x6f31('0x56'),_0x50ef79);io[_0x6f31('0x48')](_0x6f31('0x57'),_0x50ef79);};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x58')]=function(_0x4ee819){if(_0x4ee819[_0x6f31('0x59')]==='inbound'){logger['debug'](_0x6f31('0x5a'),util[_0x6f31('0x42')](_0x4ee819,{'showHidden':![],'depth':null}));this['emit'](util[_0x6f31('0x4e')](_0x6f31('0x4f'),_0x4ee819[_0x6f31('0x5b')]),_0x6f31('0x5c'),_0x4ee819);}};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x5d')]=function(_0x1dc1dd){return _0x1dc1dd!==null&&!_[_0x6f31('0x5e')](_0x1dc1dd);};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x31')]=function(){var _0x30b85c=this;setInterval(function(){_0x30b85c['clearZombieChannels']();ami[_0x6f31('0x5f')]({'action':_0x6f31('0x60')})['catch'](function(_0x144f50){logger[_0x6f31('0x43')]('[voiceQueueReport][queues]',util[_0x6f31('0x42')](_0x144f50,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype'][_0x6f31('0x30')]=function(){var _0x402b05=this;setInterval(function(){if(!_0x402b05[_0x6f31('0x15')]['isRunning']){return ami[_0x6f31('0x5f')]({'action':'queuesummary'})[_0x6f31('0x61')](function(_0x33802b){_0x402b05[_0x6f31('0x15')]['id']=_0x33802b[_0x6f31('0x62')];_0x402b05[_0x6f31('0x15')]['isRunning']=!![];_0x402b05[_0x6f31('0x15')][_0x6f31('0x63')][_0x33802b['actionid']]={};})['catch'](function(_0x22b0cf){logger[_0x6f31('0x43')](_0x6f31('0x64'),util[_0x6f31('0x42')](_0x22b0cf,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x65')]=function(_0x57b74f,_0x444da1){var _0x42fc28;if(this[_0x6f31('0x15')]&&this[_0x6f31('0x15')]['queues']&&this[_0x6f31('0x15')]['queues'][_0x57b74f[_0x6f31('0x5b')]]){_0x42fc28=this['summary'][_0x6f31('0x60')][_0x57b74f[_0x6f31('0x5b')]][_0x6f31('0x66')];}var _0x9022c1=new VoiceQueueSummary(_0x57b74f);return _0x9022c1['createReport'](_0x444da1[_0x6f31('0x11')],this['agents'],_0x42fc28,this[_0x6f31('0x67')]['channels']);};VoiceQueueReport['prototype'][_0x6f31('0x68')]=function(_0x109031,_0x16011f){var _0x300dcc=this['createQueueSummaryReport'](_0x109031,_0x16011f);var _0x37ef5c=![];_0x37ef5c=_0x300dcc['compareToInboundQueue'](_0x109031);if(_0x37ef5c){Object[_0x6f31('0x69')](_0x109031,_0x300dcc);this[_0x6f31('0x67')][_0x6f31('0x13')][_0x109031[_0x6f31('0x5b')]]=_0x109031;this[_0x6f31('0x58')](_0x300dcc);}};VoiceQueueReport[_0x6f31('0x3c')]['syncQueueStatusComplete']=function(_0x113d39){var _0x109c38=null;var _0x3b90bb=this[_0x6f31('0x15')]['id'];if(this[_0x6f31('0x15')][_0x6f31('0x63')][_0x3b90bb]){_0x109c38=this[_0x6f31('0x15')][_0x6f31('0x63')][_0x3b90bb][_0x113d39[_0x6f31('0x62')]];}if(!_0x109c38){this[_0x6f31('0x15')]=initializeSummary();return;}var _0x4c4eb1=this[_0x6f31('0x13')][_0x109c38['queue']];if(_0x4c4eb1[_0x6f31('0x59')]===_0x6f31('0x6a')){this['handleInboundQueueSummaryReport'](_0x4c4eb1,_0x109c38);}else if(_0x4c4eb1[_0x6f31('0x59')]===_0x6f31('0x6b')){var _0x4b7759=this[_0x6f31('0x65')](_0x4c4eb1,_0x109c38);ami['emit'](_0x6f31('0x6c'),_0x4b7759);}this[_0x6f31('0x15')]['statusRequests']-=0x1;var _0x2eb1d1=this['summary']['statusRequests']>0x0?!![]:![];if(!_0x2eb1d1){return this['syncQueueSummaryComplete'](this['summary'][_0x6f31('0x6d')]);}};VoiceQueueReport[_0x6f31('0x3c')]['syncQueueMember']=function(_0x22a2e9){var _0x4097ce=this['summary']['id'];if(this[_0x6f31('0x15')][_0x6f31('0x63')][_0x4097ce]&&this[_0x6f31('0x15')][_0x6f31('0x63')][_0x4097ce][_0x22a2e9['actionid']]){this[_0x6f31('0x15')][_0x6f31('0x63')][_0x4097ce][_0x22a2e9['actionid']][_0x6f31('0x11')]['push'](_0x22a2e9);}};VoiceQueueReport['prototype']['syncQueueSummary']=function(_0x1b7ab0){var _0x1f9d39=this;try{if(this[_0x6f31('0x5d')](_0x1b7ab0)&&this[_0x6f31('0x5d')](_0x1b7ab0[_0x6f31('0x50')])){logger[_0x6f31('0x4a')]('[voiceQueueReport][queuesummary]\x20event:',util['inspect'](_0x1b7ab0,{'showHidden':![],'depth':null}));var _0xb4a712=this[_0x6f31('0x13')][_0x1b7ab0[_0x6f31('0x50')]];if(_0xb4a712){logger['debug']('[voiceQueueReport][queuesummary]\x20name:%s',_0xb4a712[_0x6f31('0x5b')]);this[_0x6f31('0x15')][_0x6f31('0x60')][_0xb4a712['name']]={'summaryEvent':_0x1b7ab0};this[_0x6f31('0x15')][_0x6f31('0x6e')]+=0x1;return ami[_0x6f31('0x5f')]({'action':_0x6f31('0x63'),'queue':_0xb4a712[_0x6f31('0x5b')]})[_0x6f31('0x61')](function(_0x4e7cb4){if(!_0x1f9d39[_0x6f31('0x15')][_0x6f31('0x63')][_0x1b7ab0[_0x6f31('0x62')]]){_0x1f9d39['summary']['queuestatus'][_0x1b7ab0[_0x6f31('0x62')]]={};}_0x1f9d39[_0x6f31('0x15')][_0x6f31('0x63')][_0x1b7ab0[_0x6f31('0x62')]][_0x4e7cb4[_0x6f31('0x62')]]={'queue':_0xb4a712['name'],'agents':[]};})['catch'](function(_0x4918a6){throw _0x4918a6;});}}}catch(_0x18171e){logger['error'](_0x6f31('0x64'),util[_0x6f31('0x42')](_0x18171e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x1a')]=function(_0x3daf63){if(this[_0x6f31('0x15')][_0x6f31('0x6e')]>0x0){this[_0x6f31('0x15')][_0x6f31('0x6d')]=_0x3daf63;return;}logger[_0x6f31('0x4a')](_0x6f31('0x6f'),util[_0x6f31('0x42')](_0x3daf63,{'showHidden':![],'depth':null}));this[_0x6f31('0x15')]=initializeSummary();ami[_0x6f31('0x48')](_0x6f31('0x70'),{});};VoiceQueueReport[_0x6f31('0x3c')]['syncQueueCallerJoin']=function(_0xaaabf3){try{if(this[_0x6f31('0x5d')](_0xaaabf3)){logger[_0x6f31('0x4a')](_0x6f31('0x71'),_0xaaabf3[_0x6f31('0x4d')],util['inspect'](_0xaaabf3,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0xaaabf3[_0x6f31('0x4d')]])){this[_0x6f31('0x10')][_0xaaabf3[_0x6f31('0x4d')]]=[];}if(_['isUndefined'](this[_0x6f31('0x3d')][_0xaaabf3['uniqueid']])){this['channels'][_0xaaabf3[_0x6f31('0x4d')]]={};}var _0x1c5ce8=new QueueReport();_0x1c5ce8[_0x6f31('0x50')]=_0xaaabf3['queue'];_0x1c5ce8[_0x6f31('0x59')]=this[_0x6f31('0x13')][_0x1c5ce8[_0x6f31('0x50')]]&&this[_0x6f31('0x13')][_0x1c5ce8[_0x6f31('0x50')]]['type']?this[_0x6f31('0x13')][_0x1c5ce8[_0x6f31('0x50')]][_0x6f31('0x59')]||_0x6f31('0x6a'):'inbound';_0x1c5ce8['queuecallerjoinAt']=moment()[_0x6f31('0x4e')](_0x6f31('0x72'));_0x1c5ce8[_0x6f31('0x73')]=_0xaaabf3[_0x6f31('0x73')];_0x1c5ce8['count']=_0xaaabf3[_0x6f31('0x74')];_0x1c5ce8[_0x6f31('0x4d')]=_0xaaabf3[_0x6f31('0x4d')];logger[_0x6f31('0x75')](_0x6f31('0x76'),_0x1c5ce8[_0x6f31('0x50')],_0x1c5ce8[_0x6f31('0x59')]);Object[_0x6f31('0x69')](_0x1c5ce8,_['pick'](_0xaaabf3,_[_0x6f31('0x77')](_0x1c5ce8)));this[_0x6f31('0x10')][_0xaaabf3['uniqueid']]['push'](_0x1c5ce8);this['channels'][_0xaaabf3[_0x6f31('0x4d')]]=_0x1c5ce8;this[_0x6f31('0x49')](_0x1c5ce8,_0x6f31('0x1d'));}}catch(_0x5889b3){logger[_0x6f31('0x43')](_0x6f31('0x71'),_0xaaabf3[_0x6f31('0x4d')],util['inspect'](_0x5889b3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x78')]=function(_0x33a47e){try{if(this[_0x6f31('0x5d')](_0x33a47e)){logger[_0x6f31('0x4a')](_0x6f31('0x79'),_0x33a47e[_0x6f31('0x4d')],util[_0x6f31('0x42')](_0x33a47e,{'showHidden':![],'depth':null}));if(this[_0x6f31('0x10')][_0x33a47e[_0x6f31('0x4d')]]){var _0x2457f6=_[_0x6f31('0x7a')](this[_0x6f31('0x10')][_0x33a47e['uniqueid']]);_0x2457f6[_0x6f31('0x7b')]=![];_0x2457f6[_0x6f31('0x7c')]=null;_0x2457f6[_0x6f31('0x7d')]=_0x33a47e[_0x6f31('0x7d')];_0x2457f6[_0x6f31('0x7e')]=_0x33a47e[_0x6f31('0x7e')];_0x2457f6[_0x6f31('0x3b')]=!![];_0x2457f6[_0x6f31('0x7f')]=moment()['format'](_0x6f31('0x72'));_0x2457f6[_0x6f31('0x54')]=_0x6f31('0x80');_0x2457f6[_0x6f31('0x81')]=null;logger[_0x6f31('0x75')](_0x6f31('0x82'),_0x2457f6[_0x6f31('0x50')],_0x2457f6['type']);this['channels'][_0x33a47e[_0x6f31('0x4d')]]=_0x2457f6;this[_0x6f31('0x47')](_0x2457f6,_0x6f31('0x3b'));}}}catch(_0x7821fd){logger[_0x6f31('0x43')](_0x6f31('0x79'),_0x33a47e[_0x6f31('0x4d')],util[_0x6f31('0x42')](_0x7821fd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x20')]=function(_0x3d76c2){try{if(this[_0x6f31('0x5d')](_0x3d76c2)){logger[_0x6f31('0x4a')](_0x6f31('0x83'),_0x3d76c2[_0x6f31('0x4d')],util[_0x6f31('0x42')](_0x3d76c2,{'showHidden':![],'depth':null}));if(this[_0x6f31('0x10')][_0x3d76c2['uniqueid']]){var _0x14ff46=_[_0x6f31('0x7a')](this[_0x6f31('0x10')][_0x3d76c2[_0x6f31('0x4d')]]);_0x14ff46['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x14ff46[_0x6f31('0x84')]=_0x3d76c2['connectedlinenum'];_0x14ff46['connectedlinename']=_0x3d76c2['connectedlinename'];logger[_0x6f31('0x75')](_0x6f31('0x85'),_0x14ff46[_0x6f31('0x50')],_0x14ff46[_0x6f31('0x59')],_0x3d76c2[_0x6f31('0x84')],_0x3d76c2[_0x6f31('0x86')]);this[_0x6f31('0x3d')][_0x3d76c2[_0x6f31('0x4d')]]=_0x14ff46;this[_0x6f31('0x49')](_0x14ff46,'queuecallerleave');}}}catch(_0x333810){logger[_0x6f31('0x43')](_0x6f31('0x83'),_0x3d76c2[_0x6f31('0x4d')],util[_0x6f31('0x42')](_0x333810,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x23')]=function(_0x27c34a){try{if(this[_0x6f31('0x5d')](_0x27c34a)){logger[_0x6f31('0x4a')](_0x6f31('0x87'),_0x27c34a['uniqueid'],util[_0x6f31('0x42')](_0x27c34a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x27c34a[_0x6f31('0x4d')]]){var _0x1ecae6=_['last'](this['queueReports'][_0x27c34a[_0x6f31('0x4d')]]);_0x1ecae6[_0x6f31('0x7b')]=!![];_0x1ecae6['queuecallerexitreason']=_0x6f31('0x88');logger[_0x6f31('0x75')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x1ecae6['queue'],_0x1ecae6[_0x6f31('0x59')]);}}}catch(_0x1b750d){logger[_0x6f31('0x43')]('[%s][voiceQueueReport][agentconnect]',_0x27c34a[_0x6f31('0x4d')],util[_0x6f31('0x42')](_0x1b750d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6f31('0x21')]=function(_0x3d5421){try{if(this['isNotNull'](_0x3d5421)){logger['debug'](_0x6f31('0x89'),_0x3d5421['uniqueid'],util[_0x6f31('0x42')](_0x3d5421,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3d5421[_0x6f31('0x4d')]]){var _0x5f0912=_['last'](this['queueReports'][_0x3d5421['uniqueid']]);_0x5f0912[_0x6f31('0x3b')]=![];_0x5f0912['queuecallerabandonAt']=null;_0x5f0912[_0x6f31('0x8a')]=!![];_0x5f0912[_0x6f31('0x81')]=_0x3d5421[_0x6f31('0x8b')];_0x5f0912[_0x6f31('0x7d')]=_0x3d5421['holdtime'];_0x5f0912['queuecallercomplete']=!![];_0x5f0912[_0x6f31('0x3a')]=![];_0x5f0912['queuecallerexitAt']=null;if(!_0x5f0912[_0x6f31('0x8c')]){if(_0x3d5421[_0x6f31('0x8d')]==_0x6f31('0x8c')){_0x5f0912[_0x6f31('0x54')]=_0x6f31('0x8e');logger[_0x6f31('0x75')](_0x6f31('0x8f'),_0x5f0912['queue'],_0x5f0912[_0x6f31('0x59')]);}else{if(_[_0x6f31('0x90')](_0x3d5421[_0x6f31('0x3f')][_0x6f31('0x91')](),_0x6f31('0x92'))){if(this['queueReports'][_0x3d5421['linkedid']]){var _0x2720b3=_[_0x6f31('0x7a')](this[_0x6f31('0x10')][_0x3d5421[_0x6f31('0x93')]]);_0x2720b3['queuecallercomplete']=![];_0x2720b3[_0x6f31('0x3a')]=!![];_0x2720b3[_0x6f31('0x94')]=moment(_0x5f0912['queuecallerjoinAt'])[_0x6f31('0x95')](_0x3d5421[_0x6f31('0x7d')],_0x6f31('0x96'))[_0x6f31('0x4e')](_0x6f31('0x72'));_0x2720b3['queuecallerexitreason']=_0x6f31('0x97');_0x2720b3['transfer']=!![];_0x2720b3[_0x6f31('0x98')]='FORWARD';_0x2720b3['transferexten']=_0x3d5421[_0x6f31('0x99')];_0x2720b3[_0x6f31('0x9a')]=_0x3d5421[_0x6f31('0x4d')];logger[_0x6f31('0x75')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x2720b3[_0x6f31('0x50')],_0x2720b3[_0x6f31('0x59')]);var _0x28d50e=this[_0x6f31('0x10')][_0x3d5421[_0x6f31('0x93')]];this[_0x6f31('0x10')][_0x3d5421[_0x6f31('0x93')]]=this[_0x6f31('0x10')][_0x3d5421[_0x6f31('0x4d')]];this[_0x6f31('0x10')][_0x3d5421['uniqueid']]=_0x28d50e;}}else{_0x5f0912['queuecallerexitreason']=_0x6f31('0x9b')+_0x3d5421['reason'][_0x6f31('0x9c')]();logger['info'](_0x6f31('0x9d'),_0x5f0912[_0x6f31('0x50')],_0x5f0912[_0x6f31('0x59')],_0x5f0912[_0x6f31('0x54')]);}}}this[_0x6f31('0x3d')][_0x3d5421['uniqueid']]=_0x5f0912;}}}catch(_0x3699f9){logger[_0x6f31('0x43')](_0x6f31('0x89'),_0x3d5421[_0x6f31('0x4d')],util['inspect'](_0x3699f9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x9e')]=function(_0x6b2eab){try{if(this[_0x6f31('0x5d')](_0x6b2eab)){logger[_0x6f31('0x4a')](_0x6f31('0x9f'),_0x6b2eab[_0x6f31('0x4d')],util[_0x6f31('0x42')](_0x6b2eab,{'showHidden':![],'depth':null}));this[_0x6f31('0xa0')](_0x6b2eab['uniqueid'],_[_0x6f31('0x77')](_0x6b2eab['variable'])[0x0],_0x6b2eab[_0x6f31('0xa1')]);if(this[_0x6f31('0x10')][_0x6b2eab['uniqueid']]){var _0x15dbc3=_[_0x6f31('0x7a')](this[_0x6f31('0x10')][_0x6b2eab['uniqueid']]);if(_0x15dbc3){if(this[_0x6f31('0x5d')](_0x6b2eab[_0x6f31('0xa2')])&&this[_0x6f31('0x5d')](_0x6b2eab[_0x6f31('0xa2')][_0x6f31('0x63')])){switch(_0x6b2eab[_0x6f31('0xa1')]){case'CONTINUE':_0x15dbc3[_0x6f31('0x3a')]=![];_0x15dbc3[_0x6f31('0x94')]=null;break;case'TIMEOUT':_0x15dbc3[_0x6f31('0xa3')]=_0x6f31('0xa4');_0x15dbc3[_0x6f31('0x3a')]=!![];_0x15dbc3[_0x6f31('0x94')]=moment()[_0x6f31('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x15dbc3['queuecallerleaveAt']=moment()[_0x6f31('0x4e')](_0x6f31('0x72'));logger['debug'](_0x6f31('0xa5'),_0x6b2eab[_0x6f31('0x4d')],util[_0x6f31('0x42')](_0x15dbc3,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x15dbc3);break;default:_0x15dbc3[_0x6f31('0x3a')]=!![];_0x15dbc3[_0x6f31('0x94')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x15dbc3[_0x6f31('0xa6')]=moment()[_0x6f31('0x4e')](_0x6f31('0x72'));}_0x15dbc3[_0x6f31('0x3b')]=![];_0x15dbc3[_0x6f31('0x7f')]=null;_0x15dbc3[_0x6f31('0x54')]=_0x6b2eab[_0x6f31('0xa1')];this[_0x6f31('0x3d')][_0x6b2eab['uniqueid']]=_0x15dbc3;this[_0x6f31('0x47')](_0x15dbc3,_0x6f31('0x24'));}else if(this[_0x6f31('0x5d')](_0x6b2eab[_0x6f31('0xa2')])&&this[_0x6f31('0x5d')](_0x6b2eab[_0x6f31('0xa2')][_0x6f31('0xa7')])){if(!_0x15dbc3[_0x6f31('0x3b')]){_0x15dbc3[_0x6f31('0x3a')]=!![];_0x15dbc3['queuecallerexitAt']=moment()[_0x6f31('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x15dbc3['queuecallerexitreason']='EXITWITHKEY';_0x15dbc3[_0x6f31('0xa6')]=moment()[_0x6f31('0x4e')](_0x6f31('0x72'));this[_0x6f31('0x3d')][_0x6b2eab[_0x6f31('0x4d')]]=_0x15dbc3;}}logger['info'](_0x6f31('0xa8'),_0x6b2eab['uniqueid'],_0x15dbc3[_0x6f31('0x50')],_0x15dbc3[_0x6f31('0x59')],_['keys'](_0x6b2eab[_0x6f31('0xa2')])[0x0],_0x6b2eab[_0x6f31('0xa1')]);_0x15dbc3[_0x6f31('0x16')]=this[_0x6f31('0x16')][_0x6b2eab['uniqueid']];}}}}catch(_0x174e7b){logger[_0x6f31('0x43')]('[%s][voiceQueueReport][varset]',_0x6b2eab[_0x6f31('0x4d')],util['inspect'](_0x174e7b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0xa0')]=function(_0x1b18ca,_0x233d4d,_0x22d382){var _0x4ae345=[_0x6f31('0xa9'),'rtpaudioqosbridged',_0x6f31('0xaa'),_0x6f31('0xab'),_0x6f31('0xac'),_0x6f31('0xad'),'rtpaudioqosrtt',_0x6f31('0xae'),_0x6f31('0xaf'),_0x6f31('0xb0'),_0x6f31('0xb1'),'bridgepvtcallid',_0x6f31('0xb2'),_0x6f31('0xb3'),'memberinterface',_0x6f31('0xb4'),_0x6f31('0x8b'),_0x6f31('0xb5'),'memberrealtime'];if(!_[_0x6f31('0xb6')](_0x233d4d)&&!_['includes'](_0x4ae345,_0x233d4d)){if(_[_0x6f31('0x5e')](this['variables'][_0x1b18ca])){this[_0x6f31('0x16')][_0x1b18ca]={};}this[_0x6f31('0x16')][_0x1b18ca][_0x233d4d]=_0x22d382;}};VoiceQueueReport['prototype'][_0x6f31('0xb7')]=function(_0x4730f4,_0xccacb2,_0x5a10ba){try{var _0x10fd5a={};if(this[_0x6f31('0x10')][_0x4730f4]){for(var _0x134cc6=0x0;_0x134cc6{delete this['channels'][_0x5c4fac];},_0x551812);}};module[_0x6f31('0xed')]=VoiceQueueReport; \ No newline at end of file +var _0x0180=['completeEvent','push','isNotNull','[voiceQueueReport][queuesummary]\x20name:%s','then','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','inbound','YYYY-MM-DD\x20HH:mm:ss','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','info','[%s][voiceQueueReport][queuecallerleave]','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexitAt','transfer','reason','COMPLETED','startsWith','toLowerCase','local/','linkedid','add','FORWARDTRANSFER','transferexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','timeout','queuecallerleaveAt','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberpenalty','memberrealtime','includes','length','sumHoldTime','diff','queuecallerjoinAt','seconds','ATTENDEDTRANSFER','sumDuration','milliseconds','total','answered','sumBillable','lastevent','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','abandoned','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','[%s][voiceQueueReport][hangup]','handleHangup','cause-txt','transferid','transfereeuniqueid','transfertype','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfereruniqueid','origtransfererexten','secondtransfereruniqueid','secondtransfererexten','[%s][voiceQueueReport][attendedtransfer]','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceQueueReport][musiconholdstop]','[%s][voiceQueueReport][newexten]\x20event:','set','applicationdata','appdata','cdr(','application','split','match','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','redis','localhost','prototype','tail','sequence','queueReports','realtime','agents','channels','queueChannels','voiceQueues','summary','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','syncAgentComplete','syncAgentConnect','varset','syncVarSet','syncHangup','fullybooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','pTalking','waiting','queueStatusComplete','unlockRR','queuecallerexit','switch','enqueue','isNil','channel','message','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','variables','syncFullyBooted','campaigns','clearQueueReport','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','queue','voice_queue_channel:save',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','voice_queue_channel:remove','emitInboundVoiceQueueSummary','type','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','voice:queue:%s','name','voice_queue:save','isUndefined','clearZombieChannels','queues','catch','[voiceQueueReport][queues]','isRunning','Action','actionid','queuestatus','summaryEvent','createReport','handleInboundQueueSummaryReport','createQueueSummaryReport','compareToInboundQueue','assign','statusRequests','syncQueueSummaryComplete'];(function(_0x2bd88d,_0x2d5dc3){var _0x5516d4=function(_0x1272c8){while(--_0x1272c8){_0x2bd88d['push'](_0x2bd88d['shift']());}};_0x5516d4(++_0x2d5dc3);}(_0x0180,0x171));var _0x0018=function(_0x92f383,_0x3ed7db){_0x92f383=_0x92f383-0x0;var _0x5349ff=_0x0180[_0x92f383];return _0x5349ff;};'use strict';var _=require('lodash');var moment=require(_0x0018('0x0'));var util=require(_0x0018('0x1'));var Redis=require(_0x0018('0x2'));var config=require(_0x0018('0x3'));var logger=require(_0x0018('0x4'))(_0x0018('0x5'));var ami=require(_0x0018('0x6'));var QueueReport=require(_0x0018('0x7'));var VoiceQueueSummary=require(_0x0018('0x8'));config[_0x0018('0x9')]=_['defaults'](config[_0x0018('0x9')],{'host':_0x0018('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x0018('0xb')]['enqueue']=function(_0x37318d){this[_0x0018('0xc')]=this[_0x0018('0xc')]?this[_0x0018('0xc')]['finally'](_0x37318d):_0x37318d();};function VoiceQueueReport(_0x19c154){this[_0x0018('0xd')]=new Sequence();this[_0x0018('0xe')]={};this[_0x0018('0xf')]=_0x19c154;this[_0x0018('0x10')]=_0x19c154[_0x0018('0x10')];this[_0x0018('0x11')]=_0x19c154[_0x0018('0x12')];this[_0x0018('0x13')]=_0x19c154['voiceQueues'];this['campaigns']=_0x19c154['campaigns'];this[_0x0018('0x14')]=initializeSummary();this['variables']={};ami['on'](_0x0018('0x15'),this[_0x0018('0x16')][_0x0018('0x17')](this));ami['on'](_0x0018('0x18'),this['syncQueueSummaryComplete']['bind'](this));ami['on']('queuemember',this[_0x0018('0x19')]['bind'](this));ami['on'](_0x0018('0x1a'),this[_0x0018('0x1b')][_0x0018('0x17')](this));ami['on'](_0x0018('0x1c'),this[_0x0018('0x1d')]['bind'](this));ami['on'](_0x0018('0x1e'),this[_0x0018('0x1f')][_0x0018('0x17')](this));ami['on']('queuecallerleave',this[_0x0018('0x20')][_0x0018('0x17')](this));ami['on'](_0x0018('0x21'),this[_0x0018('0x22')][_0x0018('0x17')](this));ami['on']('agentconnect',this[_0x0018('0x23')][_0x0018('0x17')](this));ami['on'](_0x0018('0x24'),this[_0x0018('0x25')]['bind'](this));ami['on']('hangup',this[_0x0018('0x26')][_0x0018('0x17')](this));ami['on'](_0x0018('0x27'),this['syncFullyBooted'][_0x0018('0x17')](this));ami['on'](_0x0018('0x28'),this[_0x0018('0x29')][_0x0018('0x17')](this));ami['on'](_0x0018('0x2a'),this[_0x0018('0x2b')][_0x0018('0x17')](this));ami['on'](_0x0018('0x2c'),this[_0x0018('0x2d')][_0x0018('0x17')](this));ami['on'](_0x0018('0x2e'),this[_0x0018('0x2f')][_0x0018('0x17')](this));this[_0x0018('0x30')]();this[_0x0018('0x31')]();}function clearChannels(_0x288c22){if(!_[_0x0018('0x32')](_0x288c22)){for(var _0x3a3cbb in _0x288c22){if(_0x288c22[_0x0018('0x33')](_0x3a3cbb)){delete _0x288c22[_0x3a3cbb];}}}}function clearCampaigns(_0x75b73d){if(!_[_0x0018('0x32')](_0x75b73d)){for(var _0x317265 in _0x75b73d){if(_0x75b73d['hasOwnProperty'](_0x317265)){_0x75b73d[_0x317265][_0x0018('0x34')]=0x0;}}}}function clearVoiceQueues(_0x1a963c){if(!_[_0x0018('0x32')](_0x1a963c)){for(var _0x503110 in _0x1a963c){if(_0x1a963c['hasOwnProperty'](_0x503110)){_0x1a963c[_0x503110][_0x0018('0x34')]=0x0;_0x1a963c[_0x503110]['talking']=0x0;_0x1a963c[_0x503110][_0x0018('0x35')]=0x0;_0x1a963c[_0x503110][_0x0018('0x36')]=0x0;_0x1a963c[_0x503110][_0x0018('0x37')]=!![];}}}}function clearAgentBooked(_0x291a4b){if(!_[_0x0018('0x32')](_0x291a4b)){for(var _0x2f83f8 in _0x291a4b){if(_0x291a4b[_0x0018('0x33')](_0x2f83f8)){_0x291a4b[_0x2f83f8][_0x0018('0x38')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x54fb45){return _0x54fb45[_0x0018('0x39')]||_0x54fb45['queuecallerabandon']||_0x54fb45['queuecallercomplete'];}VoiceQueueReport[_0x0018('0xb')]['clearZombieChannels']=function(){var _0x4dbd2b=this;for(var _0x2cfeb7 in this[_0x0018('0x11')]){if(this[_0x0018('0x11')]['hasOwnProperty'](_0x2cfeb7)&&!this[_0x0018('0x11')][_0x2cfeb7][_0x0018('0x3a')]){this[_0x0018('0xd')][_0x0018('0x3b')](function(){if(!_[_0x0018('0x3c')](_0x4dbd2b[_0x0018('0x11')][_0x2cfeb7])){return ami['Action']({'action':'status','channel':_0x4dbd2b[_0x0018('0x11')][_0x2cfeb7][_0x0018('0x3d')]})['catch'](function(_0x73f76d){if(_0x73f76d[_0x0018('0x3e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x4dbd2b[_0x0018('0x11')][_0x2cfeb7]){delete _0x4dbd2b['channels'][_0x2cfeb7];logger[_0x0018('0x3f')](_0x0018('0x40'),_0x2cfeb7,util[_0x0018('0x41')](_0x73f76d,{'showHidden':![],'depth':null}));}if(_0x4dbd2b['queueReports'][_0x2cfeb7]){delete _0x4dbd2b[_0x0018('0xe')][_0x2cfeb7];logger[_0x0018('0x3f')](_0x0018('0x42'),_0x2cfeb7,util[_0x0018('0x41')](_0x73f76d,{'showHidden':![],'depth':null}));}if(_0x4dbd2b[_0x0018('0x43')][_0x2cfeb7]){delete _0x4dbd2b[_0x0018('0x43')][_0x2cfeb7];logger[_0x0018('0x3f')]('[%s][voiceQueueReport][checkVariables]',_0x2cfeb7,util[_0x0018('0x41')](_0x73f76d,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x0018('0xb')][_0x0018('0x44')]=function(){logger[_0x0018('0x3f')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this['channels']);this['clearQueueReport'](this[_0x0018('0xe')]);clearAgentBooked(this[_0x0018('0x10')]);clearVoiceQueues(this[_0x0018('0x13')]);clearCampaigns(this[_0x0018('0x45')]);this['summary']=initializeSummary();};VoiceQueueReport[_0x0018('0xb')][_0x0018('0x46')]=function(_0x188edd){var _0x43f81c=this;if(!_[_0x0018('0x32')](_0x188edd)){for(var _0x4f6fd3 in _0x188edd){if(_0x188edd[_0x0018('0x33')](_0x4f6fd3)){_0x43f81c[_0x0018('0x47')](_0x188edd[_0x4f6fd3],'clearqueuereport');delete _0x188edd[_0x4f6fd3];}}}};VoiceQueueReport[_0x0018('0xb')]['emit']=function(_0x3ca14f,_0x1cb6ba,_0x2eb8cc){io['to'](_0x3ca14f)[_0x0018('0x48')](_0x1cb6ba,_0x2eb8cc);};VoiceQueueReport[_0x0018('0xb')][_0x0018('0x49')]=function(_0x301604,_0x185df2){logger[_0x0018('0x4a')](_0x0018('0x4b')+_0x185df2+_0x0018('0x4c'),_0x301604[_0x0018('0x4d')],util['inspect'](_0x301604,{'showHidden':![],'depth':null}));this[_0x0018('0x48')](util[_0x0018('0x4e')]('voice:queue:%s',_0x301604[_0x0018('0x4f')]),_0x0018('0x50'),_0x301604);io[_0x0018('0x48')]('voice_queue_presence:save',_0x301604);};VoiceQueueReport[_0x0018('0xb')][_0x0018('0x47')]=function(_0x1c39e4,_0x4dd513){logger[_0x0018('0x4a')]('[%s][voiceQueueReport]['+_0x4dd513+_0x0018('0x51'),_0x1c39e4['uniqueid'],util[_0x0018('0x41')](_0x1c39e4,{'showHidden':![],'depth':null}));if(_0x1c39e4[_0x0018('0x52')]==='ATTENDEDTRANSFER'){return;}this[_0x0018('0x48')](util[_0x0018('0x4e')]('voice:queue:%s',_0x1c39e4[_0x0018('0x4f')]),_0x0018('0x53'),_0x1c39e4);io[_0x0018('0x48')]('voice_queue_presence:remove',_0x1c39e4);};VoiceQueueReport[_0x0018('0xb')][_0x0018('0x54')]=function(_0x104800){if(_0x104800[_0x0018('0x55')]==='inbound'){logger[_0x0018('0x4a')](_0x0018('0x56'),util[_0x0018('0x41')](_0x104800,{'showHidden':![],'depth':null}));this[_0x0018('0x48')](util[_0x0018('0x4e')](_0x0018('0x57'),_0x104800[_0x0018('0x58')]),_0x0018('0x59'),_0x104800);}};VoiceQueueReport[_0x0018('0xb')]['isNotNull']=function(_0xe0303a){return _0xe0303a!==null&&!_[_0x0018('0x5a')](_0xe0303a);};VoiceQueueReport[_0x0018('0xb')][_0x0018('0x31')]=function(){var _0x5746a2=this;setInterval(function(){_0x5746a2[_0x0018('0x5b')]();ami['Action']({'action':_0x0018('0x5c')})[_0x0018('0x5d')](function(_0x15cde0){logger['error'](_0x0018('0x5e'),util[_0x0018('0x41')](_0x15cde0,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x0018('0xb')][_0x0018('0x30')]=function(){var _0x42cae8=this;setInterval(function(){if(!_0x42cae8[_0x0018('0x14')][_0x0018('0x5f')]){return ami[_0x0018('0x60')]({'action':'queuesummary'})['then'](function(_0x2bb5c1){_0x42cae8['summary']['id']=_0x2bb5c1[_0x0018('0x61')];_0x42cae8[_0x0018('0x14')][_0x0018('0x5f')]=!![];_0x42cae8[_0x0018('0x14')][_0x0018('0x62')][_0x2bb5c1[_0x0018('0x61')]]={};})[_0x0018('0x5d')](function(_0x29f23b){logger[_0x0018('0x3f')]('[voiceQueueReport][queuesummary]',util[_0x0018('0x41')](_0x29f23b,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x0018('0xb')]['createQueueSummaryReport']=function(_0xb43555,_0x386499){var _0x2ec5f1;if(this[_0x0018('0x14')]&&this[_0x0018('0x14')][_0x0018('0x5c')]&&this[_0x0018('0x14')][_0x0018('0x5c')][_0xb43555[_0x0018('0x58')]]){_0x2ec5f1=this[_0x0018('0x14')][_0x0018('0x5c')][_0xb43555['name']][_0x0018('0x63')];}var _0x3a8fc0=new VoiceQueueSummary(_0xb43555);return _0x3a8fc0[_0x0018('0x64')](_0x386499[_0x0018('0x10')],this[_0x0018('0x10')],_0x2ec5f1,this[_0x0018('0xf')][_0x0018('0x11')]);};VoiceQueueReport[_0x0018('0xb')][_0x0018('0x65')]=function(_0xbbb95f,_0x475afe){var _0x353d2a=this[_0x0018('0x66')](_0xbbb95f,_0x475afe);var _0x52ceea=![];_0x52ceea=_0x353d2a[_0x0018('0x67')](_0xbbb95f);if(_0x52ceea){Object[_0x0018('0x68')](_0xbbb95f,_0x353d2a);this[_0x0018('0xf')][_0x0018('0x13')][_0xbbb95f[_0x0018('0x58')]]=_0xbbb95f;this[_0x0018('0x54')](_0x353d2a);}};VoiceQueueReport[_0x0018('0xb')]['syncQueueStatusComplete']=function(_0x20d597){var _0x4c68c1=null;var _0x3a1cf8=this[_0x0018('0x14')]['id'];if(this[_0x0018('0x14')][_0x0018('0x62')][_0x3a1cf8]){_0x4c68c1=this[_0x0018('0x14')][_0x0018('0x62')][_0x3a1cf8][_0x20d597[_0x0018('0x61')]];}if(!_0x4c68c1){this[_0x0018('0x14')]=initializeSummary();return;}var _0x1e40b2=this[_0x0018('0x13')][_0x4c68c1[_0x0018('0x4f')]];if(_0x1e40b2[_0x0018('0x55')]==='inbound'){this['handleInboundQueueSummaryReport'](_0x1e40b2,_0x4c68c1);}else if(_0x1e40b2[_0x0018('0x55')]==='outbound'){var _0x300bc1=this[_0x0018('0x66')](_0x1e40b2,_0x4c68c1);ami[_0x0018('0x48')]('custom:queuesummary',_0x300bc1);}this[_0x0018('0x14')][_0x0018('0x69')]-=0x1;var _0x361d99=this[_0x0018('0x14')][_0x0018('0x69')]>0x0?!![]:![];if(!_0x361d99){return this[_0x0018('0x6a')](this[_0x0018('0x14')][_0x0018('0x6b')]);}};VoiceQueueReport['prototype'][_0x0018('0x19')]=function(_0xade67b){var _0x4db4fe=this[_0x0018('0x14')]['id'];if(this['summary'][_0x0018('0x62')][_0x4db4fe]&&this[_0x0018('0x14')]['queuestatus'][_0x4db4fe][_0xade67b[_0x0018('0x61')]]){this[_0x0018('0x14')][_0x0018('0x62')][_0x4db4fe][_0xade67b['actionid']][_0x0018('0x10')][_0x0018('0x6c')](_0xade67b);}};VoiceQueueReport[_0x0018('0xb')][_0x0018('0x16')]=function(_0x1f772a){var _0x13737b=this;try{if(this[_0x0018('0x6d')](_0x1f772a)&&this[_0x0018('0x6d')](_0x1f772a[_0x0018('0x4f')])){logger[_0x0018('0x4a')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x0018('0x41')](_0x1f772a,{'showHidden':![],'depth':null}));var _0xcce0d9=this['voiceQueues'][_0x1f772a[_0x0018('0x4f')]];if(_0xcce0d9){logger['debug'](_0x0018('0x6e'),_0xcce0d9['name']);this[_0x0018('0x14')]['queues'][_0xcce0d9[_0x0018('0x58')]]={'summaryEvent':_0x1f772a};this['summary'][_0x0018('0x69')]+=0x1;return ami[_0x0018('0x60')]({'action':_0x0018('0x62'),'queue':_0xcce0d9['name']})[_0x0018('0x6f')](function(_0x246df0){if(!_0x13737b[_0x0018('0x14')][_0x0018('0x62')][_0x1f772a['actionid']]){_0x13737b[_0x0018('0x14')][_0x0018('0x62')][_0x1f772a[_0x0018('0x61')]]={};}_0x13737b['summary'][_0x0018('0x62')][_0x1f772a[_0x0018('0x61')]][_0x246df0[_0x0018('0x61')]]={'queue':_0xcce0d9['name'],'agents':[]};})[_0x0018('0x5d')](function(_0x5cc06a){throw _0x5cc06a;});}}}catch(_0xcf63d9){logger[_0x0018('0x3f')]('[voiceQueueReport][queuesummary]',util[_0x0018('0x41')](_0xcf63d9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x375b2c){if(this[_0x0018('0x14')]['statusRequests']>0x0){this[_0x0018('0x14')][_0x0018('0x6b')]=_0x375b2c;return;}logger[_0x0018('0x4a')](_0x0018('0x70'),util['inspect'](_0x375b2c,{'showHidden':![],'depth':null}));this[_0x0018('0x14')]=initializeSummary();ami['emit'](_0x0018('0x71'),{});};VoiceQueueReport['prototype'][_0x0018('0x1d')]=function(_0x573880){try{if(this[_0x0018('0x6d')](_0x573880)){logger['debug'](_0x0018('0x72'),_0x573880[_0x0018('0x4d')],util['inspect'](_0x573880,{'showHidden':![],'depth':null}));if(_[_0x0018('0x5a')](this[_0x0018('0xe')][_0x573880[_0x0018('0x4d')]])){this[_0x0018('0xe')][_0x573880[_0x0018('0x4d')]]=[];}if(_[_0x0018('0x5a')](this[_0x0018('0x11')][_0x573880[_0x0018('0x4d')]])){this['channels'][_0x573880['uniqueid']]={};}var _0x3b441f=new QueueReport();_0x3b441f['queue']=_0x573880[_0x0018('0x4f')];_0x3b441f[_0x0018('0x55')]=this[_0x0018('0x13')][_0x3b441f['queue']]&&this['voiceQueues'][_0x3b441f['queue']][_0x0018('0x55')]?this['voiceQueues'][_0x3b441f[_0x0018('0x4f')]][_0x0018('0x55')]||'inbound':_0x0018('0x73');_0x3b441f['queuecallerjoinAt']=moment()[_0x0018('0x4e')](_0x0018('0x74'));_0x3b441f['position']=_0x573880[_0x0018('0x75')];_0x3b441f['count']=_0x573880[_0x0018('0x76')];_0x3b441f['uniqueid']=_0x573880[_0x0018('0x4d')];logger['info'](_0x0018('0x77'),_0x3b441f[_0x0018('0x4f')],_0x3b441f[_0x0018('0x55')]);Object['assign'](_0x3b441f,_[_0x0018('0x78')](_0x573880,_[_0x0018('0x79')](_0x3b441f)));this[_0x0018('0xe')][_0x573880[_0x0018('0x4d')]][_0x0018('0x6c')](_0x3b441f);this[_0x0018('0x11')][_0x573880[_0x0018('0x4d')]]=_0x3b441f;this['emitVoiceQueueChannelSave'](_0x3b441f,'queuecallerjoin');}}catch(_0x1a269b){logger[_0x0018('0x3f')](_0x0018('0x72'),_0x573880[_0x0018('0x4d')],util[_0x0018('0x41')](_0x1a269b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0018('0x1f')]=function(_0x40abe1){try{if(this[_0x0018('0x6d')](_0x40abe1)){logger[_0x0018('0x4a')](_0x0018('0x7a'),_0x40abe1[_0x0018('0x4d')],util[_0x0018('0x41')](_0x40abe1,{'showHidden':![],'depth':null}));if(this[_0x0018('0xe')][_0x40abe1[_0x0018('0x4d')]]){var _0x2bf562=_[_0x0018('0x7b')](this['queueReports'][_0x40abe1[_0x0018('0x4d')]]);_0x2bf562[_0x0018('0x7c')]=![];_0x2bf562[_0x0018('0x7d')]=null;_0x2bf562[_0x0018('0x7e')]=_0x40abe1[_0x0018('0x7e')];_0x2bf562[_0x0018('0x7f')]=_0x40abe1[_0x0018('0x7f')];_0x2bf562[_0x0018('0x1e')]=!![];_0x2bf562[_0x0018('0x80')]=moment()[_0x0018('0x4e')](_0x0018('0x74'));_0x2bf562[_0x0018('0x52')]=_0x0018('0x81');_0x2bf562[_0x0018('0x82')]=null;logger[_0x0018('0x83')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x2bf562[_0x0018('0x4f')],_0x2bf562[_0x0018('0x55')]);this[_0x0018('0x11')][_0x40abe1[_0x0018('0x4d')]]=_0x2bf562;this['emitVoiceQueueChannelRemove'](_0x2bf562,'queuecallerabandon');}}}catch(_0x56bdbe){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x40abe1['uniqueid'],util[_0x0018('0x41')](_0x56bdbe,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0018('0xb')][_0x0018('0x20')]=function(_0x28840a){try{if(this[_0x0018('0x6d')](_0x28840a)){logger['debug'](_0x0018('0x84'),_0x28840a[_0x0018('0x4d')],util[_0x0018('0x41')](_0x28840a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x28840a['uniqueid']]){var _0x281a80=_[_0x0018('0x7b')](this[_0x0018('0xe')][_0x28840a['uniqueid']]);_0x281a80['queuecallerleaveAt']=moment()[_0x0018('0x4e')](_0x0018('0x74'));_0x281a80['connectedlinenum']=_0x28840a[_0x0018('0x85')];_0x281a80[_0x0018('0x86')]=_0x28840a[_0x0018('0x86')];logger[_0x0018('0x83')](_0x0018('0x87'),_0x281a80[_0x0018('0x4f')],_0x281a80[_0x0018('0x55')],_0x28840a['connectedlinenum'],_0x28840a[_0x0018('0x86')]);this[_0x0018('0x11')][_0x28840a[_0x0018('0x4d')]]=_0x281a80;this[_0x0018('0x49')](_0x281a80,_0x0018('0x88'));}}}catch(_0x15ef38){logger[_0x0018('0x3f')](_0x0018('0x84'),_0x28840a[_0x0018('0x4d')],util[_0x0018('0x41')](_0x15ef38,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0018('0xb')][_0x0018('0x23')]=function(_0x50a8bc){try{if(this[_0x0018('0x6d')](_0x50a8bc)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x50a8bc[_0x0018('0x4d')],util[_0x0018('0x41')](_0x50a8bc,{'showHidden':![],'depth':null}));if(this[_0x0018('0xe')][_0x50a8bc[_0x0018('0x4d')]]){var _0x4484be=_[_0x0018('0x7b')](this[_0x0018('0xe')][_0x50a8bc[_0x0018('0x4d')]]);_0x4484be['queuecallercomplete']=!![];_0x4484be[_0x0018('0x52')]=_0x0018('0x89');logger[_0x0018('0x83')](_0x0018('0x8a'),_0x4484be[_0x0018('0x4f')],_0x4484be[_0x0018('0x55')]);}}}catch(_0x4c4b00){logger[_0x0018('0x3f')](_0x0018('0x8b'),_0x50a8bc[_0x0018('0x4d')],util[_0x0018('0x41')](_0x4c4b00,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x4a37d9){try{if(this['isNotNull'](_0x4a37d9)){logger[_0x0018('0x4a')](_0x0018('0x8c'),_0x4a37d9[_0x0018('0x4d')],util[_0x0018('0x41')](_0x4a37d9,{'showHidden':![],'depth':null}));if(this[_0x0018('0xe')][_0x4a37d9['uniqueid']]){var _0x171347=_[_0x0018('0x7b')](this[_0x0018('0xe')][_0x4a37d9[_0x0018('0x4d')]]);_0x171347[_0x0018('0x1e')]=![];_0x171347[_0x0018('0x80')]=null;_0x171347[_0x0018('0x8d')]=!![];_0x171347[_0x0018('0x82')]=_0x4a37d9[_0x0018('0x8e')];_0x171347[_0x0018('0x7e')]=_0x4a37d9['holdtime'];_0x171347['queuecallercomplete']=!![];_0x171347[_0x0018('0x39')]=![];_0x171347[_0x0018('0x8f')]=null;if(!_0x171347[_0x0018('0x90')]){if(_0x4a37d9[_0x0018('0x91')]==_0x0018('0x90')){_0x171347[_0x0018('0x52')]=_0x0018('0x92');logger[_0x0018('0x83')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x171347['queue'],_0x171347[_0x0018('0x55')]);}else{if(_[_0x0018('0x93')](_0x4a37d9[_0x0018('0x3d')][_0x0018('0x94')](),_0x0018('0x95'))){if(this[_0x0018('0xe')][_0x4a37d9[_0x0018('0x96')]]){var _0x875b8b=_[_0x0018('0x7b')](this['queueReports'][_0x4a37d9[_0x0018('0x96')]]);_0x875b8b[_0x0018('0x7c')]=![];_0x875b8b[_0x0018('0x39')]=!![];_0x875b8b[_0x0018('0x8f')]=moment(_0x171347['queuecallerjoinAt'])[_0x0018('0x97')](_0x4a37d9[_0x0018('0x7e')],'seconds')[_0x0018('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x875b8b['queuecallerexitreason']=_0x0018('0x98');_0x875b8b[_0x0018('0x90')]=!![];_0x875b8b['transfertype']='FORWARD';_0x875b8b[_0x0018('0x99')]=_0x4a37d9['destexten'];_0x875b8b[_0x0018('0x9a')]=_0x4a37d9[_0x0018('0x4d')];logger[_0x0018('0x83')](_0x0018('0x9b'),_0x875b8b[_0x0018('0x4f')],_0x875b8b[_0x0018('0x55')]);var _0x32a14a=this[_0x0018('0xe')][_0x4a37d9[_0x0018('0x96')]];this[_0x0018('0xe')][_0x4a37d9['linkedid']]=this['queueReports'][_0x4a37d9[_0x0018('0x4d')]];this[_0x0018('0xe')][_0x4a37d9['uniqueid']]=_0x32a14a;}}else{_0x171347['queuecallerexitreason']=_0x0018('0x9c')+_0x4a37d9[_0x0018('0x91')][_0x0018('0x9d')]();logger[_0x0018('0x83')](_0x0018('0x9e'),_0x171347[_0x0018('0x4f')],_0x171347[_0x0018('0x55')],_0x171347['queuecallerexitreason']);}}}this[_0x0018('0x11')][_0x4a37d9[_0x0018('0x4d')]]=_0x171347;}}}catch(_0x529439){logger[_0x0018('0x3f')](_0x0018('0x8c'),_0x4a37d9['uniqueid'],util[_0x0018('0x41')](_0x529439,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0018('0xb')][_0x0018('0x25')]=function(_0x41d18a){try{if(this[_0x0018('0x6d')](_0x41d18a)){logger[_0x0018('0x4a')](_0x0018('0x9f'),_0x41d18a[_0x0018('0x4d')],util['inspect'](_0x41d18a,{'showHidden':![],'depth':null}));this[_0x0018('0xa0')](_0x41d18a['uniqueid'],_[_0x0018('0x79')](_0x41d18a[_0x0018('0xa1')])[0x0],_0x41d18a['value']);if(this[_0x0018('0xe')][_0x41d18a[_0x0018('0x4d')]]){var _0x30084b=_[_0x0018('0x7b')](this[_0x0018('0xe')][_0x41d18a[_0x0018('0x4d')]]);if(_0x30084b){if(this[_0x0018('0x6d')](_0x41d18a[_0x0018('0xa1')])&&this[_0x0018('0x6d')](_0x41d18a[_0x0018('0xa1')][_0x0018('0x62')])){switch(_0x41d18a[_0x0018('0xa2')]){case _0x0018('0xa3'):_0x30084b[_0x0018('0x39')]=![];_0x30084b[_0x0018('0x8f')]=null;break;case'TIMEOUT':_0x30084b['lastevent']=_0x0018('0xa4');_0x30084b['queuecallerexit']=!![];_0x30084b[_0x0018('0x8f')]=moment()[_0x0018('0x4e')](_0x0018('0x74'));_0x30084b[_0x0018('0xa5')]=moment()[_0x0018('0x4e')](_0x0018('0x74'));logger[_0x0018('0x4a')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x41d18a['uniqueid'],util[_0x0018('0x41')](_0x30084b,{'showHidden':![],'depth':null}));ami['emit'](_0x0018('0xa6'),_0x30084b);break;default:_0x30084b[_0x0018('0x39')]=!![];_0x30084b[_0x0018('0x8f')]=moment()[_0x0018('0x4e')](_0x0018('0x74'));_0x30084b[_0x0018('0xa5')]=moment()[_0x0018('0x4e')](_0x0018('0x74'));}_0x30084b[_0x0018('0x1e')]=![];_0x30084b['queuecallerabandonAt']=null;_0x30084b[_0x0018('0x52')]=_0x41d18a[_0x0018('0xa2')];this[_0x0018('0x11')][_0x41d18a[_0x0018('0x4d')]]=_0x30084b;this[_0x0018('0x47')](_0x30084b,_0x0018('0x24'));}else if(this[_0x0018('0x6d')](_0x41d18a[_0x0018('0xa1')])&&this['isNotNull'](_0x41d18a['variable'][_0x0018('0xa7')])){if(!_0x30084b[_0x0018('0x1e')]){_0x30084b[_0x0018('0x39')]=!![];_0x30084b[_0x0018('0x8f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x30084b[_0x0018('0x52')]=_0x0018('0xa8');_0x30084b[_0x0018('0xa5')]=moment()[_0x0018('0x4e')](_0x0018('0x74'));this[_0x0018('0x11')][_0x41d18a['uniqueid']]=_0x30084b;}}logger[_0x0018('0x83')](_0x0018('0xa9'),_0x41d18a[_0x0018('0x4d')],_0x30084b[_0x0018('0x4f')],_0x30084b[_0x0018('0x55')],_['keys'](_0x41d18a[_0x0018('0xa1')])[0x0],_0x41d18a[_0x0018('0xa2')]);_0x30084b[_0x0018('0x43')]=this['variables'][_0x41d18a['uniqueid']];}}}}catch(_0x29e589){logger[_0x0018('0x3f')](_0x0018('0x9f'),_0x41d18a['uniqueid'],util[_0x0018('0x41')](_0x29e589,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x21bb93,_0x2a8ff6,_0x335f13){var _0x4c13c4=['rtpaudioqos',_0x0018('0xaa'),_0x0018('0xab'),_0x0018('0xac'),_0x0018('0xad'),'rtpaudioqoslossbridged',_0x0018('0xae'),_0x0018('0xaf'),_0x0018('0xb0'),'sipuri',_0x0018('0xb1'),_0x0018('0xb2'),_0x0018('0xb3'),_0x0018('0xb4'),'memberinterface','memberlastcall','membername',_0x0018('0xb5'),_0x0018('0xb6')];if(!_[_0x0018('0x3c')](_0x2a8ff6)&&!_[_0x0018('0xb7')](_0x4c13c4,_0x2a8ff6)){if(_[_0x0018('0x5a')](this[_0x0018('0x43')][_0x21bb93])){this[_0x0018('0x43')][_0x21bb93]={};}this[_0x0018('0x43')][_0x21bb93][_0x2a8ff6]=_0x335f13;}};VoiceQueueReport[_0x0018('0xb')]['handleHangup']=function(_0x14a180,_0x26baba,_0x126ecd){try{var _0x4500c3={};if(this[_0x0018('0xe')][_0x14a180]){for(var _0x4a1355=0x0;_0x4a1355{delete this[_0x0018('0x11')][_0x4fe3c0];},_0x15f4c1);}};module[_0x0018('0xed')]=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index ba0a1f3..6a0dbbf 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc4b=['Request','CreateReportAgentPreview','../client','createHistory','queue'];(function(_0x5bace9,_0x42fbaf){var _0x19a2de=function(_0x40a0e7){while(--_0x40a0e7){_0x5bace9['push'](_0x5bace9['shift']());}};_0x19a2de(++_0x42fbaf);}(_0xdc4b,0x1b5));var _0xbdc4=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xdc4b[_0x19950b];return _0x3c6b41;};'use strict';var client=require(_0xbdc4('0x0'));exports[_0xbdc4('0x1')]=function(_0x398538){return function(){_0x398538['campaign']=_0x398538[_0xbdc4('0x2')];return client[_0xbdc4('0x3')](_0xbdc4('0x4'),{'body':_0x398538,'log':_0xbdc4('0x4')});};}; \ No newline at end of file +var _0x8117=['campaign','queue','Request','../client'];(function(_0x41cc34,_0x1ff3df){var _0x334b5a=function(_0x486a5e){while(--_0x486a5e){_0x41cc34['push'](_0x41cc34['shift']());}};_0x334b5a(++_0x1ff3df);}(_0x8117,0xbb));var _0x7811=function(_0x55acbb,_0x351454){_0x55acbb=_0x55acbb-0x0;var _0x561384=_0x8117[_0x55acbb];return _0x561384;};'use strict';var client=require(_0x7811('0x0'));exports['createHistory']=function(_0x2c68b0){return function(){_0x2c68b0[_0x7811('0x1')]=_0x2c68b0[_0x7811('0x2')];return client[_0x7811('0x3')]('CreateReportAgentPreview',{'body':_0x2c68b0,'log':'CreateReportAgentPreview'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index 1188955..e2f92ab 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a84=['../client','create','Request','CreateAttachment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x2a84,0x94));var _0x42a8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2a84[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x42a8('0x0'));exports[_0x42a8('0x1')]=function(_0x2797cb){return client[_0x42a8('0x2')](_0x42a8('0x3'),{'body':_0x2797cb,'log':_0x42a8('0x3')});}; \ No newline at end of file +var _0x1d10=['../client','create','Request','CreateAttachment'];(function(_0x19dfc3,_0x3356ea){var _0x296f2c=function(_0x52ccbc){while(--_0x52ccbc){_0x19dfc3['push'](_0x19dfc3['shift']());}};_0x296f2c(++_0x3356ea);}(_0x1d10,0x1dc));var _0x01d1=function(_0x4122bc,_0x286516){_0x4122bc=_0x4122bc-0x0;var _0x246ce9=_0x1d10[_0x4122bc];return _0x246ce9;};'use strict';var client=require(_0x01d1('0x0'));exports[_0x01d1('0x1')]=function(_0x5bd3d6){return client[_0x01d1('0x2')](_0x01d1('0x3'),{'body':_0x5bd3d6,'log':_0x01d1('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index 87f92c1..67d71d4 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['Trunk','active','TrunkBackup','callerid','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x414810,_0x5e924d){var _0x2d4df5=function(_0x390860){while(--_0x390860){_0x414810['push'](_0x414810['shift']());}};_0x2d4df5(++_0x5e924d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xc4aa[_0x17b6e3];return _0x3906f3;};'use strict';var client=require(_0xac4a('0x0'));exports[_0xac4a('0x1')]=function(){return function(){return client[_0xac4a('0x2')](_0xac4a('0x3'),{'options':{'raw':![],'attributes':['id',_0xac4a('0x4'),_0xac4a('0x5'),'active','limitCalls','dialOriginateCallerIdName',_0xac4a('0x6'),_0xac4a('0x7'),_0xac4a('0x8'),_0xac4a('0x9'),_0xac4a('0xa'),_0xac4a('0xb'),_0xac4a('0xc'),_0xac4a('0xd'),'dialGlobalMaxRetry','dialNoSuchNumberMaxRetry',_0xac4a('0xe'),_0xac4a('0xf'),_0xac4a('0x10'),'dialAbandonedMaxRetry',_0xac4a('0x11'),_0xac4a('0x12'),_0xac4a('0x13'),'dialAgentRejectMaxRetry',_0xac4a('0x14'),'dialTimezone',_0xac4a('0x15'),'dialAMDActive',_0xac4a('0x16'),_0xac4a('0x17'),_0xac4a('0x18'),'dialAMDTotalAnalysisTime',_0xac4a('0x19'),_0xac4a('0x1a'),_0xac4a('0x1b'),_0xac4a('0x1c'),_0xac4a('0x1d'),_0xac4a('0x1e'),_0xac4a('0x1f'),_0xac4a('0x20'),_0xac4a('0x21')],'include':[{'model':_0xac4a('0x22'),'as':_0xac4a('0x22'),'attributes':['id',_0xac4a('0x4'),'callerid',_0xac4a('0x23')]},{'model':_0xac4a('0x22'),'as':_0xac4a('0x24'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x25'),_0xac4a('0x23')]},{'model':_0xac4a('0x26'),'as':_0xac4a('0x26'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xac4a('0x27'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x28')]}]},{'model':'SquareProject','as':_0xac4a('0x29'),'attributes':['id',_0xac4a('0x4')]}]},'log':_0xac4a('0x2a')});};}; \ No newline at end of file +var _0x2ef3=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','active','TrunkBackup','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','limitCalls','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0x204ad4,_0x502841){var _0x50675f=function(_0x30ad49){while(--_0x30ad49){_0x204ad4['push'](_0x204ad4['shift']());}};_0x50675f(++_0x502841);}(_0x2ef3,0xba));var _0x32ef=function(_0x1366db,_0x3886b7){_0x1366db=_0x1366db-0x0;var _0x5b5ca3=_0x2ef3[_0x1366db];return _0x5b5ca3;};'use strict';var client=require(_0x32ef('0x0'));exports[_0x32ef('0x1')]=function(){return function(){return client[_0x32ef('0x2')](_0x32ef('0x3'),{'options':{'raw':![],'attributes':['id',_0x32ef('0x4'),_0x32ef('0x5'),'active',_0x32ef('0x6'),_0x32ef('0x7'),'dialOriginateCallerIdNumber',_0x32ef('0x8'),_0x32ef('0x9'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'dialAMDActive',_0x32ef('0x18'),'dialAMDGreeting',_0x32ef('0x19'),'dialAMDTotalAnalysisTime',_0x32ef('0x1a'),_0x32ef('0x1b'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x32ef('0x1c'),'dialOrderByScheduledAt',_0x32ef('0x1d'),_0x32ef('0x1e'),_0x32ef('0x1f')],'include':[{'model':_0x32ef('0x20'),'as':'Trunk','attributes':['id','name','callerid',_0x32ef('0x21')]},{'model':_0x32ef('0x20'),'as':_0x32ef('0x22'),'attributes':['id','name','callerid',_0x32ef('0x21')]},{'model':_0x32ef('0x23'),'as':_0x32ef('0x23'),'attributes':['id','name'],'include':[{'model':_0x32ef('0x23'),'as':_0x32ef('0x24'),'attributes':['id','name',_0x32ef('0x25')]}]},{'model':_0x32ef('0x26'),'as':_0x32ef('0x26'),'attributes':['id',_0x32ef('0x4')]}]},'log':_0x32ef('0x27')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index 0ca1f76..8f5d31c 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc433=['Request','CreateCmContact','getContacts','GetCmContact','../client','createContact'];(function(_0x34ad72,_0x1e43f6){var _0x5c9aa8=function(_0x144388){while(--_0x144388){_0x34ad72['push'](_0x34ad72['shift']());}};_0x5c9aa8(++_0x1e43f6);}(_0xc433,0xee));var _0x3c43=function(_0x28e74e,_0x53fdf1){_0x28e74e=_0x28e74e-0x0;var _0xb45ac1=_0xc433[_0x28e74e];return _0xb45ac1;};'use strict';var client=require(_0x3c43('0x0'));exports[_0x3c43('0x1')]=function(_0x1a18a3){return function(){return client[_0x3c43('0x2')](_0x3c43('0x3'),{'body':_0x1a18a3,'log':_0x3c43('0x3')});};};exports[_0x3c43('0x4')]=function(_0x3911fe){return function(){return client[_0x3c43('0x2')](_0x3c43('0x5'),{'options':_0x3911fe,'log':_0x3c43('0x5')});};}; \ No newline at end of file +var _0xbdd2=['GetCmContact','../client','Request','CreateCmContact','getContacts'];(function(_0x32355a,_0x2a3307){var _0x3e5424=function(_0x4daf69){while(--_0x4daf69){_0x32355a['push'](_0x32355a['shift']());}};_0x3e5424(++_0x2a3307);}(_0xbdd2,0x83));var _0x2bdd=function(_0x1a1b69,_0x37b98d){_0x1a1b69=_0x1a1b69-0x0;var _0x546b2d=_0xbdd2[_0x1a1b69];return _0x546b2d;};'use strict';var client=require(_0x2bdd('0x0'));exports['createContact']=function(_0x4e67e0){return function(){return client[_0x2bdd('0x1')](_0x2bdd('0x2'),{'body':_0x4e67e0,'log':_0x2bdd('0x2')});};};exports[_0x2bdd('0x3')]=function(_0x23284b){return function(){return client['Request'](_0x2bdd('0x4'),{'options':_0x23284b,'log':_0x2bdd('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index 368c8bd..e40acd4 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1939=['format','YYYY-MM-DD\x20HH:mm:ss','ContactId','ListId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority','DESC','scheduledat','ASC','getContactDialerIvr','GetContactDialerIvr','campaign','queue','VoiceQueueId','CampaignId','MoveContactManagedDialer','CountReScheduled','countReScheduled','getContactPreview','GetCmHopperPreview','name','VoiceQueue','Queue','getContactRecallMe','GetContactRecallMe','User','Agent','voicePause','db.CmHopper.UserId','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','getContacts','GetCmHopper','CmContact','Contact','getCmHopper','Request','UpdateCmHopper'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x1939,0x1d1));var _0x9193=function(_0x5287a5,_0x3ff0ad){_0x5287a5=_0x5287a5-0x0;var _0x158a73=_0x1939[_0x5287a5];return _0x158a73;};'use strict';var client=require(_0x9193('0x0'));var moment=require('moment');exports[_0x9193('0x1')]=function(_0x45d779,_0x3628d4){return function(){return client['Request'](_0x9193('0x2'),{'options':{'where':{'VoiceQueueId':_0x45d779},'include':[{'model':_0x9193('0x3'),'as':_0x9193('0x4')}],'limit':_0x3628d4,'raw':![]},'log':_0x9193('0x5')});};};exports['updateContacts']=function(_0x3e17d0,_0x20ab2b,_0x5186dc){return function(){return client[_0x9193('0x6')](_0x9193('0x7'),{'body':_0x3e17d0,'options':{'where':{'VoiceQueueId':_0x20ab2b,'scheduledat':{'$lte':moment()[_0x9193('0x8')](_0x9193('0x9'))}},'limit':_0x5186dc},'log':_0x9193('0x7')});};};exports['rescheduleContact']=function(_0x25411c){return client[_0x9193('0x6')](_0x9193('0x7'),{'body':_0x25411c,'options':{'where':{'ContactId':_0x25411c[_0x9193('0xa')],'ListId':_0x25411c[_0x9193('0xb')],'VoiceQueueId':_0x25411c['VoiceQueueId'],'CampaignId':_0x25411c['CampaignId']}},'log':'rescheduleContact'});};exports[_0x9193('0xc')]=function(_0x4aa6c7,_0x276552,_0x454b7b){return function(){return client['Request'](_0x9193('0xd'),{'options':{'where':{'VoiceQueueId':_0x4aa6c7,'ListId':_0x276552,'ContactId':_0x454b7b}},'log':_0x9193('0xd')});};};exports[_0x9193('0xe')]=function(_0x28caff,_0x107ab5,_0x32f466,_0xf10273){return client[_0x9193('0x6')](_0x9193('0xf'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x28caff,'active':![],'scheduledat':{'$lte':moment()['format'](_0x9193('0x9'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x107ab5}}]},'order':[[_0x9193('0x10'),_0x9193('0x11')],[_0x9193('0x12'),_0xf10273],['id',_0x9193('0x13')]],'raw':!![],'limit':_0x32f466},'log':'GetContactDialer'});};exports[_0x9193('0x14')]=function(_0x1f1d27,_0x29fe95,_0x363323){return client[_0x9193('0x6')](_0x9193('0xf'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x1f1d27,'active':![],'scheduledat':{'$lte':moment()[_0x9193('0x8')]('YYYY-MM-DD\x20HH:mm:ss')}},'include':[{'model':_0x9193('0x3'),'as':_0x9193('0x4')}],'order':[[_0x9193('0x10'),'DESC'],[_0x9193('0x12'),_0x363323],['id',_0x9193('0x13')]],'raw':!![],'limit':_0x29fe95},'log':_0x9193('0x15')});};exports['moveContactManagedDialer']=function(_0x465cd2,_0x471c5a){_0x465cd2[_0x9193('0x16')]=_0x465cd2[_0x9193('0x17')];return client[_0x9193('0x6')]('MoveContactManagedDialer',{'body':_0x465cd2,'options':{'where':{'ContactId':_0x465cd2[_0x9193('0xa')],'ListId':_0x465cd2[_0x9193('0xb')],'VoiceQueueId':_0x465cd2[_0x9193('0x18')],'CampaignId':_0x465cd2[_0x9193('0x19')],'active':_0x471c5a?undefined:!![]}},'log':_0x9193('0x1a')});};exports['countReScheduled']=function(_0x274a42){return client[_0x9193('0x6')](_0x9193('0x1b'),{'options':{'where':{'VoiceQueueId':_0x274a42['id']?_0x274a42['id']||null:null}},'log':_0x9193('0x1c')});};exports[_0x9193('0x1d')]=function(_0x4c1406){return function(){return client[_0x9193('0x6')](_0x9193('0x1e'),{'options':{'where':{'id':_0x4c1406},'include':[{'model':_0x9193('0x3'),'as':_0x9193('0x4')},{'model':'User','as':'Agent','attributes':['id',_0x9193('0x1f')]},{'model':_0x9193('0x20'),'as':_0x9193('0x21'),'attributes':['id',_0x9193('0x1f')]}],'raw':!![]},'log':_0x9193('0x5')});};};exports['unlockContact']=function(_0x1b1efb,_0x368951,_0x404e9c){return client['Request'](_0x9193('0x7'),{'body':_0x1b1efb,'options':{'where':{'id':_0x368951},'limit':_0x404e9c},'log':_0x9193('0x7')});};exports[_0x9193('0x22')]=function(_0x3774cb,_0x8ab2c4){return function(){return client['Request'](_0x9193('0x23'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x3774cb,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x9193('0x8')]('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x8ab2c4}},'order':[[_0x9193('0x10'),_0x9193('0x11')],[_0x9193('0x12'),_0x9193('0x11')],['id',_0x9193('0x13')]],'include':[{'model':_0x9193('0x3'),'as':'Contact'},{'model':_0x9193('0x24'),'as':_0x9193('0x25'),'attributes':['id',_0x9193('0x1f'),_0x9193('0x26')]}],'group':_0x9193('0x27'),'raw':!![]},'log':_0x9193('0xf')});};};exports['resetActiveCalls']=function(_0xb995e5,_0x311b6c){return client[_0x9193('0x6')]('ResetActiveCalls',{'body':_0xb995e5,'options':_0x311b6c||{},'log':_0x9193('0x28')});};exports[_0x9193('0x29')]=function(_0x14d856,_0x5a3ba5,_0x3799d0){return function(){return client[_0x9193('0x6')](_0x9193('0x2a'),{'body':{'where':{'voiceQueueIds':_0x14d856,'interval':_0x5a3ba5,'availableAgentsIds':_0x3799d0}},'log':'handlePreviewRecallNotifications'});};}; \ No newline at end of file +var _0x9c5a=['destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','format','priority','DESC','scheduledat','ASC','getContactDialerIvr','CmContact','GetContactDialerIvr','moveContactManagedDialer','campaign','MoveContactManagedDialer','VoiceQueueId','CampaignId','CountReScheduled','getContactPreview','GetCmHopperPreview','User','VoiceQueue','name','getContactRecallMe','Agent','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','Request','GetCmHopper','Contact','getCmHopper','YYYY-MM-DD\x20HH:mm:ss','UpdateCmHopper','ContactId','ListId','rescheduleContact'];(function(_0x505d60,_0x55d8a6){var _0x18639e=function(_0x4150eb){while(--_0x4150eb){_0x505d60['push'](_0x505d60['shift']());}};_0x18639e(++_0x55d8a6);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x34d1d4,_0x365da7){_0x34d1d4=_0x34d1d4-0x0;var _0x120fb4=_0x9c5a[_0x34d1d4];return _0x120fb4;};'use strict';var client=require(_0xa9c5('0x0'));var moment=require(_0xa9c5('0x1'));exports['getContacts']=function(_0x32ab4d,_0x1cd14d){return function(){return client[_0xa9c5('0x2')](_0xa9c5('0x3'),{'options':{'where':{'VoiceQueueId':_0x32ab4d},'include':[{'model':'CmContact','as':_0xa9c5('0x4')}],'limit':_0x1cd14d,'raw':![]},'log':_0xa9c5('0x5')});};};exports['updateContacts']=function(_0x1e3c83,_0x4d9c7a,_0x394d84){return function(){return client[_0xa9c5('0x2')]('UpdateCmHopper',{'body':_0x1e3c83,'options':{'where':{'VoiceQueueId':_0x4d9c7a,'scheduledat':{'$lte':moment()['format'](_0xa9c5('0x6'))}},'limit':_0x394d84},'log':_0xa9c5('0x7')});};};exports['rescheduleContact']=function(_0x2e2b3e){return client[_0xa9c5('0x2')]('UpdateCmHopper',{'body':_0x2e2b3e,'options':{'where':{'ContactId':_0x2e2b3e[_0xa9c5('0x8')],'ListId':_0x2e2b3e[_0xa9c5('0x9')],'VoiceQueueId':_0x2e2b3e['VoiceQueueId'],'CampaignId':_0x2e2b3e['CampaignId']}},'log':_0xa9c5('0xa')});};exports[_0xa9c5('0xb')]=function(_0x45f8d8,_0x4b72b0,_0x34c948){return function(){return client[_0xa9c5('0x2')](_0xa9c5('0xc'),{'options':{'where':{'VoiceQueueId':_0x45f8d8,'ListId':_0x4b72b0,'ContactId':_0x34c948}},'log':_0xa9c5('0xc')});};};exports[_0xa9c5('0xd')]=function(_0x1ea48,_0x5915ad,_0x390ca2,_0x1276d2){return client[_0xa9c5('0x2')](_0xa9c5('0xe'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x1ea48,'active':![],'scheduledat':{'$lte':moment()[_0xa9c5('0xf')](_0xa9c5('0x6'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x5915ad}}]},'order':[[_0xa9c5('0x10'),_0xa9c5('0x11')],[_0xa9c5('0x12'),_0x1276d2],['id',_0xa9c5('0x13')]],'raw':!![],'limit':_0x390ca2},'log':'GetContactDialer'});};exports[_0xa9c5('0x14')]=function(_0xd85c32,_0x1ee5ac,_0x55cce5){return client[_0xa9c5('0x2')](_0xa9c5('0xe'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0xd85c32,'active':![],'scheduledat':{'$lte':moment()[_0xa9c5('0xf')](_0xa9c5('0x6'))}},'include':[{'model':_0xa9c5('0x15'),'as':_0xa9c5('0x4')}],'order':[[_0xa9c5('0x10'),_0xa9c5('0x11')],[_0xa9c5('0x12'),_0x55cce5],['id',_0xa9c5('0x13')]],'raw':!![],'limit':_0x1ee5ac},'log':_0xa9c5('0x16')});};exports[_0xa9c5('0x17')]=function(_0x54f8b9,_0x1115ad){_0x54f8b9[_0xa9c5('0x18')]=_0x54f8b9['queue'];return client['Request'](_0xa9c5('0x19'),{'body':_0x54f8b9,'options':{'where':{'ContactId':_0x54f8b9[_0xa9c5('0x8')],'ListId':_0x54f8b9[_0xa9c5('0x9')],'VoiceQueueId':_0x54f8b9[_0xa9c5('0x1a')],'CampaignId':_0x54f8b9[_0xa9c5('0x1b')],'active':_0x1115ad?undefined:!![]}},'log':_0xa9c5('0x19')});};exports['countReScheduled']=function(_0x4fa280){return client[_0xa9c5('0x2')](_0xa9c5('0x1c'),{'options':{'where':{'VoiceQueueId':_0x4fa280['id']?_0x4fa280['id']||null:null}},'log':'countReScheduled'});};exports[_0xa9c5('0x1d')]=function(_0x424b4c){return function(){return client[_0xa9c5('0x2')](_0xa9c5('0x1e'),{'options':{'where':{'id':_0x424b4c},'include':[{'model':_0xa9c5('0x15'),'as':_0xa9c5('0x4')},{'model':_0xa9c5('0x1f'),'as':'Agent','attributes':['id','name']},{'model':_0xa9c5('0x20'),'as':'Queue','attributes':['id',_0xa9c5('0x21')]}],'raw':!![]},'log':_0xa9c5('0x5')});};};exports['unlockContact']=function(_0x11a723,_0x320dc0,_0x5f468b){return client[_0xa9c5('0x2')](_0xa9c5('0x7'),{'body':_0x11a723,'options':{'where':{'id':_0x320dc0},'limit':_0x5f468b},'log':_0xa9c5('0x7')});};exports[_0xa9c5('0x22')]=function(_0x325c65,_0x4f6e70){return function(){return client[_0xa9c5('0x2')]('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x325c65,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xa9c5('0xf')](_0xa9c5('0x6'))},'UserId':{'$in':_0x4f6e70}},'order':[[_0xa9c5('0x10'),'DESC'],[_0xa9c5('0x12'),_0xa9c5('0x11')],['id','ASC']],'include':[{'model':_0xa9c5('0x15'),'as':_0xa9c5('0x4')},{'model':_0xa9c5('0x1f'),'as':_0xa9c5('0x23'),'attributes':['id',_0xa9c5('0x21'),_0xa9c5('0x24')]}],'group':_0xa9c5('0x25'),'raw':!![]},'log':'GetContactDialer'});};};exports[_0xa9c5('0x26')]=function(_0x3bdf64,_0xf4a9f3){return client[_0xa9c5('0x2')](_0xa9c5('0x27'),{'body':_0x3bdf64,'options':_0xf4a9f3||{},'log':_0xa9c5('0x27')});};exports[_0xa9c5('0x28')]=function(_0x36b599,_0x57ebb7,_0x4e3f3e){return function(){return client[_0xa9c5('0x2')](_0xa9c5('0x29'),{'body':{'where':{'voiceQueueIds':_0x36b599,'interval':_0x57ebb7,'availableAgentsIds':_0x4e3f3e}},'log':_0xa9c5('0x28')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index 6690d78..5f477dd 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2fd2=['IncrementPreviewCounters','../client','verifyAdditionalPhones','Request','swapAdditionalPhones','SwapAdditionalPhones'];(function(_0x202cd1,_0x116931){var _0x5bcc1d=function(_0x5bde64){while(--_0x5bde64){_0x202cd1['push'](_0x202cd1['shift']());}};_0x5bcc1d(++_0x116931);}(_0x2fd2,0xa3));var _0x22fd=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2fd2[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0x22fd('0x0'));exports[_0x22fd('0x1')]=function(_0x78c390,_0x1f5557,_0x2330e1){return client[_0x22fd('0x2')]('VerifyAdditionalPhones',{'body':_0x78c390,'reason':_0x1f5557,'entity':_0x2330e1,'log':'VerifyAdditionalPhones'});};exports[_0x22fd('0x3')]=function(_0x40999b,_0x53813c,_0x378418){return client[_0x22fd('0x2')](_0x22fd('0x4'),{'body':_0x40999b,'duration':_0x53813c,'waitTime':_0x378418,'log':_0x22fd('0x4')});};exports['incrementPreviewCounters']=function(_0x5cddba){return function(){return client[_0x22fd('0x2')]('IncrementPreviewCounters',{'body':_0x5cddba,'log':_0x22fd('0x5')});};}; \ No newline at end of file +var _0xe795=['VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones','IncrementPreviewCounters','../client','verifyAdditionalPhones','Request'];(function(_0x198ee5,_0x365142){var _0x55cdbd=function(_0x37eb00){while(--_0x37eb00){_0x198ee5['push'](_0x198ee5['shift']());}};_0x55cdbd(++_0x365142);}(_0xe795,0x9e));var _0x5e79=function(_0x4dbc5d,_0x566e64){_0x4dbc5d=_0x4dbc5d-0x0;var _0x383314=_0xe795[_0x4dbc5d];return _0x383314;};'use strict';var client=require(_0x5e79('0x0'));exports[_0x5e79('0x1')]=function(_0x352bb2,_0x238cc8,_0x2cddce){return client[_0x5e79('0x2')](_0x5e79('0x3'),{'body':_0x352bb2,'reason':_0x238cc8,'entity':_0x2cddce,'log':_0x5e79('0x3')});};exports[_0x5e79('0x4')]=function(_0x2cf1dc,_0xd3447,_0x29e2c3){return client[_0x5e79('0x2')](_0x5e79('0x5'),{'body':_0x2cf1dc,'duration':_0xd3447,'waitTime':_0x29e2c3,'log':_0x5e79('0x5')});};exports['incrementPreviewCounters']=function(_0x296d0e){return function(){return client[_0x5e79('0x2')]('IncrementPreviewCounters',{'body':_0x296d0e,'log':_0x5e79('0x6')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index 979e6cc..5fae4f8 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b93=['Request','phone','GetCmHopperBlack','checkIsBlackListIvr','CampaignId','GetCmHopperBlackIvr'];(function(_0x437808,_0x5d54e4){var _0x3752ac=function(_0x366aeb){while(--_0x366aeb){_0x437808['push'](_0x437808['shift']());}};_0x3752ac(++_0x5d54e4);}(_0x2b93,0x8a));var _0x32b9=function(_0x5f3905,_0x43a651){_0x5f3905=_0x5f3905-0x0;var _0x2923b1=_0x2b93[_0x5f3905];return _0x2923b1;};'use strict';var client=require('../client');exports['checkIsBlackList']=function(_0x463e4f){return client[_0x32b9('0x0')]('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x463e4f['VoiceQueueId'],'phone':_0x463e4f[_0x32b9('0x1')]},'raw':![]},'log':_0x32b9('0x2')});};exports[_0x32b9('0x3')]=function(_0xb4215){return client['Request'](_0x32b9('0x2'),{'options':{'where':{'CampaignId':_0xb4215[_0x32b9('0x4')],'phone':_0xb4215['phone']},'raw':![]},'log':_0x32b9('0x5')});}; \ No newline at end of file +var _0xac8c=['VoiceQueueId','checkIsBlackListIvr','CampaignId','phone','GetCmHopperBlackIvr','checkIsBlackList','Request','GetCmHopperBlack'];(function(_0x334aa2,_0x86f74d){var _0x4e63ca=function(_0x5ab919){while(--_0x5ab919){_0x334aa2['push'](_0x334aa2['shift']());}};_0x4e63ca(++_0x86f74d);}(_0xac8c,0x1d5));var _0xcac8=function(_0x1344d6,_0x2181e6){_0x1344d6=_0x1344d6-0x0;var _0xf45b24=_0xac8c[_0x1344d6];return _0xf45b24;};'use strict';var client=require('../client');exports[_0xcac8('0x0')]=function(_0x118325){return client[_0xcac8('0x1')](_0xcac8('0x2'),{'options':{'where':{'VoiceQueueId':_0x118325[_0xcac8('0x3')],'phone':_0x118325['phone']},'raw':![]},'log':'GetCmHopperBlack'});};exports[_0xcac8('0x4')]=function(_0x385188){return client[_0xcac8('0x1')](_0xcac8('0x2'),{'options':{'where':{'CampaignId':_0x385188[_0xcac8('0x5')],'phone':_0x385188[_0xcac8('0x6')]},'raw':![]},'log':_0xcac8('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index 21d7bb8..6a4b95e 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x240c=['../client','createContact','campaign','Request','CreateCmHopperFinal'];(function(_0x48b5f9,_0x585cfb){var _0x55ae7a=function(_0x5b86a4){while(--_0x5b86a4){_0x48b5f9['push'](_0x48b5f9['shift']());}};_0x55ae7a(++_0x585cfb);}(_0x240c,0x177));var _0xc240=function(_0x319e6d,_0xdf9fae){_0x319e6d=_0x319e6d-0x0;var _0x104729=_0x240c[_0x319e6d];return _0x104729;};'use strict';var client=require(_0xc240('0x0'));exports[_0xc240('0x1')]=function(_0x48a60c){return function(){_0x48a60c[_0xc240('0x2')]=_0x48a60c['queue'];return client[_0xc240('0x3')](_0xc240('0x4'),{'body':_0x48a60c,'log':'CreateCmHopperFinal'});};}; \ No newline at end of file +var _0xa86a=['../client','createContact','campaign','queue','CreateCmHopperFinal'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa86a,0x1a9));var _0xaa86=function(_0x39ddd7,_0x5d56a5){_0x39ddd7=_0x39ddd7-0x0;var _0x2b305c=_0xa86a[_0x39ddd7];return _0x2b305c;};'use strict';var client=require(_0xaa86('0x0'));exports[_0xaa86('0x1')]=function(_0x4e85f4){return function(){_0x4e85f4[_0xaa86('0x2')]=_0x4e85f4[_0xaa86('0x3')];return client['Request']('CreateCmHopperFinal',{'body':_0x4e85f4,'log':_0xaa86('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index f85bc0c..a4c1cab 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa4e5=['startOf','ivr','../client','moment','campaign','queue','Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','subtract','minutes','YYYY-MM-DD\x20HH:mm:ss','format','GetCmHopperHistory','GetVoiceQueueHopperHistory','day','endOf','getCampaignHopperHistory','GetCampaignHopperHistory'];(function(_0xc09ba9,_0x9750d2){var _0x10f81a=function(_0x56ba2c){while(--_0x56ba2c){_0xc09ba9['push'](_0xc09ba9['shift']());}};_0x10f81a(++_0x9750d2);}(_0xa4e5,0xf2));var _0x5a4e=function(_0x1f6260,_0x3314ec){_0x1f6260=_0x1f6260-0x0;var _0x502fab=_0xa4e5[_0x1f6260];return _0x502fab;};'use strict';var client=require(_0x5a4e('0x0'));var moment=require(_0x5a4e('0x1'));exports['createHistory']=function(_0x12d0cc){_0x12d0cc[_0x5a4e('0x2')]=_0x12d0cc[_0x5a4e('0x3')];return client[_0x5a4e('0x4')](_0x5a4e('0x5'),{'body':_0x12d0cc,'log':_0x5a4e('0x5')});};exports[_0x5a4e('0x6')]=function(_0x2080de){return client[_0x5a4e('0x4')](_0x5a4e('0x7'),{'options':{'where':{'endtime':{'$between':[moment()[_0x5a4e('0x8')](_0x2080de,_0x5a4e('0x9'))['format'](_0x5a4e('0xa')),moment()[_0x5a4e('0xb')](_0x5a4e('0xa'))]}},'raw':![]},'log':_0x5a4e('0xc')});};exports['getVoiceQueueHopperHistory']=function(){return function(){return client['Request'](_0x5a4e('0xd'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x5a4e('0xe'))[_0x5a4e('0xb')](_0x5a4e('0xa')),moment()[_0x5a4e('0xf')](_0x5a4e('0xe'))['format'](_0x5a4e('0xa'))]},'campaigntype':'queue'},'raw':![]},'log':_0x5a4e('0xd')});};};exports[_0x5a4e('0x10')]=function(){return function(){return client[_0x5a4e('0x4')](_0x5a4e('0x11'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x5a4e('0x12')](_0x5a4e('0xe'))[_0x5a4e('0xb')](_0x5a4e('0xa')),moment()[_0x5a4e('0xf')]('day')[_0x5a4e('0xb')](_0x5a4e('0xa'))]},'campaigntype':_0x5a4e('0x13')},'raw':![]},'log':_0x5a4e('0x11')});};}; \ No newline at end of file +var _0x6ce0=['getCampaignHopperHistory','startOf','ivr','../client','moment','createHistory','campaign','Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','day','endOf'];(function(_0x313dab,_0x53179c){var _0x18ee37=function(_0x5f43a0){while(--_0x5f43a0){_0x313dab['push'](_0x313dab['shift']());}};_0x18ee37(++_0x53179c);}(_0x6ce0,0xfa));var _0x06ce=function(_0x264b61,_0x4a5017){_0x264b61=_0x264b61-0x0;var _0x8fff4f=_0x6ce0[_0x264b61];return _0x8fff4f;};'use strict';var client=require(_0x06ce('0x0'));var moment=require(_0x06ce('0x1'));exports[_0x06ce('0x2')]=function(_0x26d0dc){_0x26d0dc[_0x06ce('0x3')]=_0x26d0dc['queue'];return client[_0x06ce('0x4')](_0x06ce('0x5'),{'body':_0x26d0dc,'log':_0x06ce('0x5')});};exports[_0x06ce('0x6')]=function(_0x19ac94){return client[_0x06ce('0x4')](_0x06ce('0x7'),{'options':{'where':{'endtime':{'$between':[moment()['subtract'](_0x19ac94,_0x06ce('0x8'))[_0x06ce('0x9')](_0x06ce('0xa')),moment()['format'](_0x06ce('0xa'))]}},'raw':![]},'log':_0x06ce('0xb')});};exports[_0x06ce('0xc')]=function(){return function(){return client[_0x06ce('0x4')](_0x06ce('0xd'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x06ce('0xe'))['format'](_0x06ce('0xa')),moment()[_0x06ce('0xf')](_0x06ce('0xe'))[_0x06ce('0x9')](_0x06ce('0xa'))]},'campaigntype':'queue'},'raw':![]},'log':'GetVoiceQueueHopperHistory'});};};exports[_0x06ce('0x10')]=function(){return function(){return client[_0x06ce('0x4')]('GetCampaignHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0x06ce('0x11')](_0x06ce('0xe'))[_0x06ce('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x06ce('0xf')](_0x06ce('0xe'))['format'](_0x06ce('0xa'))]},'campaigntype':_0x06ce('0x12')},'raw':![]},'log':'GetCampaignHopperHistory'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index fedd60e..d9dd88e 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x781d=['localstationid','minrate','maxrate','modem','gateway','faxdetect','tech','TrunkId','ListId','key','Trunk','callerid','active','notify','NotifyFaxAccount','../client','getFaxAccounts','name','description','ecm','headerinfo'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x781d,0x14a));var _0xd781=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x781d[_0xbca1b1];return _0x4e1686;};'use strict';var client=require(_0xd781('0x0'));exports[_0xd781('0x1')]=function(){return function(){return client['Request']('GetFaxAccount',{'options':{'raw':![],'attributes':['id',_0xd781('0x2'),_0xd781('0x3'),_0xd781('0x4'),_0xd781('0x5'),_0xd781('0x6'),_0xd781('0x7'),_0xd781('0x8'),_0xd781('0x9'),_0xd781('0xa'),_0xd781('0xb'),'t38timeout',_0xd781('0xc'),_0xd781('0xd'),_0xd781('0xe'),_0xd781('0xf')],'include':[{'model':'Trunk','as':_0xd781('0x10'),'attributes':['id','name',_0xd781('0x11'),_0xd781('0x12')]}]},'log':'getFaxAccount'});};};exports[_0xd781('0x13')]=function(_0x29c2a7,_0x4bf265){return client['Request'](_0xd781('0x14'),{'account':{'id':_0x29c2a7},'body':_0x4bf265,'log':_0xd781('0x14')});}; \ No newline at end of file +var _0xdacc=['Trunk','callerid','active','getFaxAccount','NotifyFaxAccount','getFaxAccounts','Request','GetFaxAccount','name','description','ecm','headerinfo','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','TrunkId','ListId','key'];(function(_0x361857,_0x1cdb1e){var _0x239b82=function(_0x3ff7fd){while(--_0x3ff7fd){_0x361857['push'](_0x361857['shift']());}};_0x239b82(++_0x1cdb1e);}(_0xdacc,0x14f));var _0xcdac=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdacc[_0x2dafbe];return _0x58a45a;};'use strict';var client=require('../client');exports[_0xcdac('0x0')]=function(){return function(){return client[_0xcdac('0x1')](_0xcdac('0x2'),{'options':{'raw':![],'attributes':['id',_0xcdac('0x3'),_0xcdac('0x4'),_0xcdac('0x5'),_0xcdac('0x6'),'localstationid',_0xcdac('0x7'),_0xcdac('0x8'),_0xcdac('0x9'),_0xcdac('0xa'),_0xcdac('0xb'),_0xcdac('0xc'),_0xcdac('0xd'),_0xcdac('0xe'),_0xcdac('0xf'),_0xcdac('0x10')],'include':[{'model':_0xcdac('0x11'),'as':_0xcdac('0x11'),'attributes':['id',_0xcdac('0x3'),_0xcdac('0x12'),_0xcdac('0x13')]}]},'log':_0xcdac('0x14')});};};exports['notify']=function(_0x3c105b,_0x611799){return client['Request'](_0xcdac('0x15'),{'account':{'id':_0x3c105b},'body':_0x611799,'log':_0xcdac('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index e3bded2..fda0f3e 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea99=['update','Request','UpdateFaxMessage','../client'];(function(_0x72a33d,_0x5691da){var _0x2621d5=function(_0x95b7c6){while(--_0x95b7c6){_0x72a33d['push'](_0x72a33d['shift']());}};_0x2621d5(++_0x5691da);}(_0xea99,0xdf));var _0x9ea9=function(_0x1188de,_0x2359b5){_0x1188de=_0x1188de-0x0;var _0x3dc4ad=_0xea99[_0x1188de];return _0x3dc4ad;};'use strict';var client=require(_0x9ea9('0x0'));exports[_0x9ea9('0x1')]=function(_0x4a413f,_0x597809){return client[_0x9ea9('0x2')]('UpdateFaxMessage',{'body':_0x597809,'options':{'where':{'AttachmentId':_0x4a413f}},'log':_0x9ea9('0x3')});}; \ No newline at end of file +var _0xeaa2=['UpdateFaxMessage','../client','update','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeaa2,0xc5));var _0x2eaa=function(_0x5144ea,_0x247fad){_0x5144ea=_0x5144ea-0x0;var _0x10701f=_0xeaa2[_0x5144ea];return _0x10701f;};'use strict';var client=require(_0x2eaa('0x0'));exports[_0x2eaa('0x1')]=function(_0x58c580,_0x25d6ea){return client[_0x2eaa('0x2')](_0x2eaa('0x3'),{'body':_0x25d6ea,'options':{'where':{'AttachmentId':_0x58c580}},'log':_0x2eaa('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index 7934ef5..2b0a4a4 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c84=['authType','type','serverUrl','Configurations','DeskField','Subjects','content','variableName','Variable','Descriptions','key','keyContent','Fields','idField','nameField','customField','Tag','Tags','GetDeskAccount','../../client','getDeskAccounts','Request','name','description','username','password','remoteUri'];(function(_0x3643b2,_0x3201bc){var _0x16c1b7=function(_0xb75fd5){while(--_0xb75fd5){_0x3643b2['push'](_0x3643b2['shift']());}};_0x16c1b7(++_0x3201bc);}(_0x4c84,0x1c3));var _0x44c8=function(_0x59108f,_0x415d52){_0x59108f=_0x59108f-0x0;var _0x123dad=_0x4c84[_0x59108f];return _0x123dad;};'use strict';var client=require(_0x44c8('0x0'));exports[_0x44c8('0x1')]=function(){return function(_0x41ce52){return client[_0x44c8('0x2')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id',_0x44c8('0x3'),_0x44c8('0x4'),_0x44c8('0x5'),_0x44c8('0x6'),_0x44c8('0x7'),_0x44c8('0x8'),_0x44c8('0x9'),_0x44c8('0xa')],'include':[{'model':'DeskConfiguration','as':_0x44c8('0xb'),'attributes':['id',_0x44c8('0x3')],'include':[{'model':_0x44c8('0xc'),'as':_0x44c8('0xd'),'attributes':['id','type',_0x44c8('0xe'),_0x44c8('0xf')],'include':[{'model':_0x44c8('0x10'),'as':_0x44c8('0x10'),'attributes':['id','name']}]},{'model':_0x44c8('0xc'),'as':_0x44c8('0x11'),'attributes':['id',_0x44c8('0x9'),_0x44c8('0xe'),_0x44c8('0x12'),'keyType',_0x44c8('0x13'),_0x44c8('0xf')],'include':[{'model':'Variable','as':_0x44c8('0x10'),'attributes':['id',_0x44c8('0x3')]}]},{'model':_0x44c8('0xc'),'as':_0x44c8('0x14'),'attributes':['id','type',_0x44c8('0xe'),_0x44c8('0x15'),_0x44c8('0x16'),_0x44c8('0x17'),'variableName'],'include':[{'model':_0x44c8('0x10'),'as':_0x44c8('0x10'),'attributes':['id',_0x44c8('0x3')]}]},{'model':_0x44c8('0x18'),'as':_0x44c8('0x19'),'attributes':['id',_0x44c8('0x3')]}]}]},'log':_0x44c8('0x1a')});};}; \ No newline at end of file +var _0xc1e1=['authType','serverUrl','DeskConfiguration','Configurations','DeskField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','Fields','idField','customField','Tag','Tags','../../client','Request','GetDeskAccount','name','description','password','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc1e1,0xa8));var _0x1c1e=function(_0x173dda,_0x206a00){_0x173dda=_0x173dda-0x0;var _0x4b3134=_0xc1e1[_0x173dda];return _0x4b3134;};'use strict';var client=require(_0x1c1e('0x0'));exports['getDeskAccounts']=function(){return function(_0x316325){return client[_0x1c1e('0x1')](_0x1c1e('0x2'),{'options':{'raw':![],'attributes':['id',_0x1c1e('0x3'),_0x1c1e('0x4'),'username',_0x1c1e('0x5'),_0x1c1e('0x6'),_0x1c1e('0x7'),'type',_0x1c1e('0x8')],'include':[{'model':_0x1c1e('0x9'),'as':_0x1c1e('0xa'),'attributes':['id',_0x1c1e('0x3')],'include':[{'model':_0x1c1e('0xb'),'as':_0x1c1e('0xc'),'attributes':['id',_0x1c1e('0xd'),_0x1c1e('0xe'),_0x1c1e('0xf')],'include':[{'model':'Variable','as':_0x1c1e('0x10'),'attributes':['id',_0x1c1e('0x3')]}]},{'model':_0x1c1e('0xb'),'as':_0x1c1e('0x11'),'attributes':['id',_0x1c1e('0xd'),_0x1c1e('0xe'),_0x1c1e('0x12'),_0x1c1e('0x13'),'keyContent',_0x1c1e('0xf')],'include':[{'model':_0x1c1e('0x10'),'as':'Variable','attributes':['id',_0x1c1e('0x3')]}]},{'model':'DeskField','as':_0x1c1e('0x14'),'attributes':['id',_0x1c1e('0xd'),_0x1c1e('0xe'),_0x1c1e('0x15'),'nameField',_0x1c1e('0x16'),'variableName'],'include':[{'model':_0x1c1e('0x10'),'as':_0x1c1e('0x10'),'attributes':['id','name']}]},{'model':_0x1c1e('0x17'),'as':_0x1c1e('0x18'),'attributes':['id',_0x1c1e('0x3')]}]}]},'log':_0x1c1e('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index 9cf6882..69572cb 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe511=['nameField','customField','CloudProvider','data2','data5','data7','GetDynamics365Account','../../client','getDynamics365Accounts','Request','name','username','remoteUri','tenantId','clientId','clientSecret','description','modernAuthentication','ticketType','openNewTab','Dynamics365Field','Subjects','type','content','variableName','Variable','Descriptions','keyType','keyContent','Fields'];(function(_0x582403,_0x3aa03a){var _0x50a78a=function(_0x25c954){while(--_0x25c954){_0x582403['push'](_0x582403['shift']());}};_0x50a78a(++_0x3aa03a);}(_0xe511,0x16f));var _0x1e51=function(_0x2b495c,_0x596e31){_0x2b495c=_0x2b495c-0x0;var _0x59e6cd=_0xe511[_0x2b495c];return _0x59e6cd;};'use strict';var client=require(_0x1e51('0x0'));exports[_0x1e51('0x1')]=function(){return function(_0x49cbdc){return client[_0x1e51('0x2')]('GetDynamics365Account',{'options':{'raw':![],'attributes':['id',_0x1e51('0x3'),_0x1e51('0x4'),'password',_0x1e51('0x5'),_0x1e51('0x6'),_0x1e51('0x7'),_0x1e51('0x8'),'serverUrl',_0x1e51('0x9'),_0x1e51('0xa')],'include':[{'model':'Dynamics365Configuration','as':'Configurations','attributes':['id',_0x1e51('0x3'),_0x1e51('0xb'),'moduleCreate','additionalSearchContact',_0x1e51('0xc')],'include':[{'model':_0x1e51('0xd'),'as':_0x1e51('0xe'),'attributes':['id',_0x1e51('0xf'),_0x1e51('0x10'),_0x1e51('0x11')],'include':[{'model':'Variable','as':_0x1e51('0x12'),'attributes':['id',_0x1e51('0x3')]}]},{'model':_0x1e51('0xd'),'as':_0x1e51('0x13'),'attributes':['id',_0x1e51('0xf'),_0x1e51('0x10'),'key',_0x1e51('0x14'),_0x1e51('0x15'),_0x1e51('0x11')],'include':[{'model':_0x1e51('0x12'),'as':_0x1e51('0x12'),'attributes':['id',_0x1e51('0x3')]}]},{'model':_0x1e51('0xd'),'as':_0x1e51('0x16'),'attributes':['id',_0x1e51('0xf'),_0x1e51('0x10'),'idField',_0x1e51('0x17'),_0x1e51('0x18'),_0x1e51('0x11')],'include':[{'model':'Variable','as':_0x1e51('0x12'),'attributes':['id','name']}]}]},{'model':'CloudProvider','as':_0x1e51('0x19'),'attributes':['id',_0x1e51('0x1a'),_0x1e51('0x1b'),_0x1e51('0x1c')]}]},'log':_0x1e51('0x1d')});};}; \ No newline at end of file +var _0x07a2=['type','key','keyContent','variableName','Fields','idField','nameField','customField','CloudProvider','data5','../../client','getDynamics365Accounts','Request','GetDynamics365Account','name','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','Dynamics365Configuration','Configurations','ticketType','moduleCreate','Dynamics365Field','content','Variable'];(function(_0x44481e,_0xe6649b){var _0x45de37=function(_0x12a718){while(--_0x12a718){_0x44481e['push'](_0x44481e['shift']());}};_0x45de37(++_0xe6649b);}(_0x07a2,0x12c));var _0x207a=function(_0x343d5d,_0x5b0c5a){_0x343d5d=_0x343d5d-0x0;var _0x40a5eb=_0x07a2[_0x343d5d];return _0x40a5eb;};'use strict';var client=require(_0x207a('0x0'));exports[_0x207a('0x1')]=function(){return function(_0x5d772f){return client[_0x207a('0x2')](_0x207a('0x3'),{'options':{'raw':![],'attributes':['id',_0x207a('0x4'),_0x207a('0x5'),_0x207a('0x6'),_0x207a('0x7'),_0x207a('0x8'),_0x207a('0x9'),_0x207a('0xa'),'serverUrl','description',_0x207a('0xb')],'include':[{'model':_0x207a('0xc'),'as':_0x207a('0xd'),'attributes':['id',_0x207a('0x4'),_0x207a('0xe'),_0x207a('0xf'),'additionalSearchContact','openNewTab'],'include':[{'model':_0x207a('0x10'),'as':'Subjects','attributes':['id','type',_0x207a('0x11'),'variableName'],'include':[{'model':'Variable','as':_0x207a('0x12'),'attributes':['id',_0x207a('0x4')]}]},{'model':_0x207a('0x10'),'as':'Descriptions','attributes':['id',_0x207a('0x13'),_0x207a('0x11'),_0x207a('0x14'),'keyType',_0x207a('0x15'),_0x207a('0x16')],'include':[{'model':_0x207a('0x12'),'as':_0x207a('0x12'),'attributes':['id',_0x207a('0x4')]}]},{'model':'Dynamics365Field','as':_0x207a('0x17'),'attributes':['id','type',_0x207a('0x11'),_0x207a('0x18'),_0x207a('0x19'),_0x207a('0x1a'),_0x207a('0x16')],'include':[{'model':_0x207a('0x12'),'as':_0x207a('0x12'),'attributes':['id',_0x207a('0x4')]}]}]},{'model':_0x207a('0x1b'),'as':_0x207a('0x1b'),'attributes':['id','data2',_0x207a('0x1c'),'data7']}]},'log':_0x207a('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index 76fa159..93b9f1c 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84a0=['name','username','serverUrl','FreshdeskConfiguration','Tag','FreshdeskField','Subjects','content','variableName','Variable','type','key','keyType','keyContent','Fields','idField','nameField','GetFreshdeskAccount','../../client','getFreshdeskAccounts','Request'];(function(_0x28a118,_0x1afe78){var _0x28270e=function(_0x175ce7){while(--_0x175ce7){_0x28a118['push'](_0x28a118['shift']());}};_0x28270e(++_0x1afe78);}(_0x84a0,0x66));var _0x084a=function(_0x465154,_0xa33b26){_0x465154=_0x465154-0x0;var _0x561b8f=_0x84a0[_0x465154];return _0x561b8f;};'use strict';var client=require(_0x084a('0x0'));exports[_0x084a('0x1')]=function(){return function(_0x209635){return client[_0x084a('0x2')]('GetFreshdeskAccount',{'options':{'raw':![],'attributes':['id',_0x084a('0x3'),_0x084a('0x4'),'apiKey','remoteUri',_0x084a('0x5')],'include':[{'model':_0x084a('0x6'),'as':'Configurations','attributes':['id',_0x084a('0x3')],'include':[{'model':_0x084a('0x7'),'attributes':['id',_0x084a('0x3')]},{'model':_0x084a('0x8'),'as':_0x084a('0x9'),'attributes':['id','type',_0x084a('0xa'),_0x084a('0xb')],'include':[{'model':_0x084a('0xc'),'as':_0x084a('0xc'),'attributes':['id',_0x084a('0x3')]}]},{'model':'FreshdeskField','as':'Descriptions','attributes':['id',_0x084a('0xd'),_0x084a('0xa'),_0x084a('0xe'),_0x084a('0xf'),_0x084a('0x10'),'variableName'],'include':[{'model':'Variable','as':_0x084a('0xc'),'attributes':['id',_0x084a('0x3')]}]},{'model':_0x084a('0x8'),'as':_0x084a('0x11'),'attributes':['id',_0x084a('0xd'),_0x084a('0xa'),_0x084a('0x12'),_0x084a('0x13'),'customField',_0x084a('0xb')],'include':[{'model':'Variable','as':_0x084a('0xc'),'attributes':['id',_0x084a('0x3')]}]}]}]},'log':_0x084a('0x14')});};}; \ No newline at end of file +var _0xfa28=['FreshdeskConfiguration','FreshdeskField','Subjects','type','content','Variable','Descriptions','key','keyType','keyContent','variableName','Fields','nameField','../../client','getFreshdeskAccounts','Request','GetFreshdeskAccount','name','username','apiKey','serverUrl'];(function(_0x29f3d3,_0x54f72d){var _0x3144d6=function(_0x4ca6e8){while(--_0x4ca6e8){_0x29f3d3['push'](_0x29f3d3['shift']());}};_0x3144d6(++_0x54f72d);}(_0xfa28,0x1c6));var _0x8fa2=function(_0x26fc81,_0x57fc19){_0x26fc81=_0x26fc81-0x0;var _0x9feece=_0xfa28[_0x26fc81];return _0x9feece;};'use strict';var client=require(_0x8fa2('0x0'));exports[_0x8fa2('0x1')]=function(){return function(_0x43c77b){return client[_0x8fa2('0x2')](_0x8fa2('0x3'),{'options':{'raw':![],'attributes':['id',_0x8fa2('0x4'),_0x8fa2('0x5'),_0x8fa2('0x6'),'remoteUri',_0x8fa2('0x7')],'include':[{'model':_0x8fa2('0x8'),'as':'Configurations','attributes':['id','name'],'include':[{'model':'Tag','attributes':['id','name']},{'model':_0x8fa2('0x9'),'as':_0x8fa2('0xa'),'attributes':['id',_0x8fa2('0xb'),_0x8fa2('0xc'),'variableName'],'include':[{'model':_0x8fa2('0xd'),'as':_0x8fa2('0xd'),'attributes':['id',_0x8fa2('0x4')]}]},{'model':_0x8fa2('0x9'),'as':_0x8fa2('0xe'),'attributes':['id','type','content',_0x8fa2('0xf'),_0x8fa2('0x10'),_0x8fa2('0x11'),_0x8fa2('0x12')],'include':[{'model':_0x8fa2('0xd'),'as':_0x8fa2('0xd'),'attributes':['id','name']}]},{'model':_0x8fa2('0x9'),'as':_0x8fa2('0x13'),'attributes':['id',_0x8fa2('0xb'),_0x8fa2('0xc'),'idField',_0x8fa2('0x14'),'customField',_0x8fa2('0x12')],'include':[{'model':_0x8fa2('0xd'),'as':_0x8fa2('0xd'),'attributes':['id','name']}]}]}]},'log':_0x8fa2('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index 0356a0e..18f36d8 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ec2=['Variable','Descriptions','type','key','keyType','keyContent','../../client','getFreshsalesAccounts','Request','GetFreshsalesAccount','name','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField','content','variableName'];(function(_0x30d356,_0x3e0e5c){var _0x14e269=function(_0x595149){while(--_0x595149){_0x30d356['push'](_0x30d356['shift']());}};_0x14e269(++_0x3e0e5c);}(_0x6ec2,0x78));var _0x26ec=function(_0xd83cba,_0x22f6ee){_0xd83cba=_0xd83cba-0x0;var _0x25081e=_0x6ec2[_0xd83cba];return _0x25081e;};'use strict';var client=require(_0x26ec('0x0'));exports[_0x26ec('0x1')]=function(){return function(_0x3d8b7c){return client[_0x26ec('0x2')](_0x26ec('0x3'),{'options':{'raw':![],'attributes':['id',_0x26ec('0x4'),'username',_0x26ec('0x5'),_0x26ec('0x6'),_0x26ec('0x7')],'include':[{'model':_0x26ec('0x8'),'as':_0x26ec('0x9'),'attributes':['id','name'],'include':[{'model':_0x26ec('0xa'),'as':'Subjects','attributes':['id','type',_0x26ec('0xb'),_0x26ec('0xc')],'include':[{'model':_0x26ec('0xd'),'as':'Variable','attributes':['id',_0x26ec('0x4')]}]},{'model':'FreshsalesField','as':_0x26ec('0xe'),'attributes':['id',_0x26ec('0xf'),_0x26ec('0xb'),_0x26ec('0x10'),_0x26ec('0x11'),_0x26ec('0x12'),_0x26ec('0xc')],'include':[{'model':_0x26ec('0xd'),'as':_0x26ec('0xd'),'attributes':['id',_0x26ec('0x4')]}]}]}]},'log':'GetFreshsalesccount'});};}; \ No newline at end of file +var _0xa6b0=['remoteUri','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','keyContent','GetFreshsalesccount','../../client','getFreshsalesAccounts','GetFreshsalesAccount','name','username'];(function(_0x4abf21,_0x398fe7){var _0x4debd7=function(_0x44d903){while(--_0x44d903){_0x4abf21['push'](_0x4abf21['shift']());}};_0x4debd7(++_0x398fe7);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x1d153d,_0x54c139){_0x1d153d=_0x1d153d-0x0;var _0x2724c6=_0xa6b0[_0x1d153d];return _0x2724c6;};'use strict';var client=require(_0x0a6b('0x0'));exports[_0x0a6b('0x1')]=function(){return function(_0x4950db){return client['Request'](_0x0a6b('0x2'),{'options':{'raw':![],'attributes':['id',_0x0a6b('0x3'),_0x0a6b('0x4'),'apiKey',_0x0a6b('0x5'),_0x0a6b('0x6')],'include':[{'model':_0x0a6b('0x7'),'as':_0x0a6b('0x8'),'attributes':['id',_0x0a6b('0x3')],'include':[{'model':_0x0a6b('0x9'),'as':_0x0a6b('0xa'),'attributes':['id',_0x0a6b('0xb'),_0x0a6b('0xc'),_0x0a6b('0xd')],'include':[{'model':_0x0a6b('0xe'),'as':_0x0a6b('0xe'),'attributes':['id','name']}]},{'model':'FreshsalesField','as':_0x0a6b('0xf'),'attributes':['id',_0x0a6b('0xb'),_0x0a6b('0xc'),_0x0a6b('0x10'),_0x0a6b('0x11'),_0x0a6b('0x12'),_0x0a6b('0xd')],'include':[{'model':_0x0a6b('0xe'),'as':_0x0a6b('0xe'),'attributes':['id',_0x0a6b('0x3')]}]}]}]},'log':_0x0a6b('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index 3a990ab..561aa74 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c07=['getSalesforceAccounts','Request','GetSalesforceAccount','name','username','password','remoteUri','clientId','clientSecret','securityToken','type','moduleSearch','moduleCreate','ticketType','additionalSearchAccount','additionalSearchLead','Subjects','Variable','SalesforceField','../../client'];(function(_0x1f1887,_0x5efa53){var _0x2970df=function(_0x1a65a8){while(--_0x1a65a8){_0x1f1887['push'](_0x1f1887['shift']());}};_0x2970df(++_0x5efa53);}(_0x0c07,0x8b));var _0x70c0=function(_0x20a005,_0x3267c4){_0x20a005=_0x20a005-0x0;var _0x318723=_0x0c07[_0x20a005];return _0x318723;};'use strict';var client=require(_0x70c0('0x0'));exports[_0x70c0('0x1')]=function(){return function(_0x38a546){return client[_0x70c0('0x2')](_0x70c0('0x3'),{'options':{'raw':![],'attributes':['id',_0x70c0('0x4'),_0x70c0('0x5'),_0x70c0('0x6'),_0x70c0('0x7'),_0x70c0('0x8'),_0x70c0('0x9'),_0x70c0('0xa'),'serverUrl',_0x70c0('0xb')],'include':[{'model':'SalesforceConfiguration','as':'Configurations','attributes':['id',_0x70c0('0x4'),_0x70c0('0xc'),_0x70c0('0xd'),_0x70c0('0xe'),'leadId',_0x70c0('0xf'),'additionalSearchContact',_0x70c0('0x10')],'include':[{'model':'SalesforceField','as':_0x70c0('0x11'),'include':[{'model':'Variable','as':_0x70c0('0x12'),'attributes':['id',_0x70c0('0x4')]}]},{'model':'SalesforceField','as':'Descriptions','include':[{'model':'Variable','as':_0x70c0('0x12'),'attributes':['id',_0x70c0('0x4')]}]},{'model':_0x70c0('0x13'),'as':'Fields','include':[{'model':_0x70c0('0x12'),'as':'Variable','attributes':['id',_0x70c0('0x4')]}]}]}]},'log':_0x70c0('0x3')});};}; \ No newline at end of file +var _0xc3b7=['moduleSearch','moduleCreate','ticketType','leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead','SalesforceField','Subjects','Variable','Descriptions','Fields','getSalesforceAccounts','Request','GetSalesforceAccount','name','username','password','remoteUri','clientId','serverUrl','type','SalesforceConfiguration','Configurations'];(function(_0x629dac,_0x264695){var _0x963a7d=function(_0x1ba44d){while(--_0x1ba44d){_0x629dac['push'](_0x629dac['shift']());}};_0x963a7d(++_0x264695);}(_0xc3b7,0xb4));var _0x7c3b=function(_0x5f2536,_0x33ab49){_0x5f2536=_0x5f2536-0x0;var _0x24550a=_0xc3b7[_0x5f2536];return _0x24550a;};'use strict';var client=require('../../client');exports[_0x7c3b('0x0')]=function(){return function(_0x2d6014){return client[_0x7c3b('0x1')](_0x7c3b('0x2'),{'options':{'raw':![],'attributes':['id',_0x7c3b('0x3'),_0x7c3b('0x4'),_0x7c3b('0x5'),_0x7c3b('0x6'),_0x7c3b('0x7'),'clientSecret','securityToken',_0x7c3b('0x8'),_0x7c3b('0x9')],'include':[{'model':_0x7c3b('0xa'),'as':_0x7c3b('0xb'),'attributes':['id','name',_0x7c3b('0xc'),_0x7c3b('0xd'),_0x7c3b('0xe'),_0x7c3b('0xf'),_0x7c3b('0x10'),_0x7c3b('0x11'),_0x7c3b('0x12')],'include':[{'model':_0x7c3b('0x13'),'as':_0x7c3b('0x14'),'include':[{'model':_0x7c3b('0x15'),'as':_0x7c3b('0x15'),'attributes':['id',_0x7c3b('0x3')]}]},{'model':_0x7c3b('0x13'),'as':_0x7c3b('0x16'),'include':[{'model':'Variable','as':_0x7c3b('0x15'),'attributes':['id',_0x7c3b('0x3')]}]},{'model':'SalesforceField','as':_0x7c3b('0x17'),'include':[{'model':_0x7c3b('0x15'),'as':_0x7c3b('0x15'),'attributes':['id','name']}]}]}]},'log':_0x7c3b('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index c1cfd85..f9f2ded 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1967=['description','username','password','email','remoteUri','ServicenowConfiguration','Configurations','ServicenowField','Subjects','type','variableName','Variable','content','key','keyType','keyContent','Fields','idField','nameField','customField','GetServicenowkAccount','getServicenowAccounts','Request','GetServicenowAccount','name'];(function(_0x11325f,_0x4dafc9){var _0x13b110=function(_0x1d325d){while(--_0x1d325d){_0x11325f['push'](_0x11325f['shift']());}};_0x13b110(++_0x4dafc9);}(_0x1967,0x173));var _0x7196=function(_0x479403,_0x4808cb){_0x479403=_0x479403-0x0;var _0x2a75b9=_0x1967[_0x479403];return _0x2a75b9;};'use strict';var client=require('../../client');exports[_0x7196('0x0')]=function(){return function(_0xdb72bb){return client[_0x7196('0x1')](_0x7196('0x2'),{'options':{'raw':![],'attributes':['id',_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7'),_0x7196('0x8'),'serverUrl'],'include':[{'model':_0x7196('0x9'),'as':_0x7196('0xa'),'attributes':['id',_0x7196('0x3')],'include':[{'model':_0x7196('0xb'),'as':_0x7196('0xc'),'attributes':['id',_0x7196('0xd'),'content',_0x7196('0xe')],'include':[{'model':_0x7196('0xf'),'as':_0x7196('0xf'),'attributes':['id',_0x7196('0x3')]}]},{'model':_0x7196('0xb'),'as':'Descriptions','attributes':['id','type',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0x12'),_0x7196('0x13'),_0x7196('0xe')],'include':[{'model':_0x7196('0xf'),'as':_0x7196('0xf'),'attributes':['id',_0x7196('0x3')]}]},{'model':_0x7196('0xb'),'as':_0x7196('0x14'),'attributes':['id',_0x7196('0xd'),'content',_0x7196('0x15'),_0x7196('0x16'),_0x7196('0x17'),_0x7196('0xe')],'include':[{'model':'Variable','as':_0x7196('0xf'),'attributes':['id','name']}]}]}]},'log':_0x7196('0x18')});};}; \ No newline at end of file +var _0x1261=['content','variableName','Variable','ServicenowField','Descriptions','keyContent','Fields','idField','nameField','getServicenowAccounts','Request','GetServicenowAccount','name','description','username','password','email','remoteUri','Configurations','Subjects','type'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1261,0x144));var _0x1126=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0x1261[_0x3a7a9c];return _0x59156e;};'use strict';var client=require('../../client');exports[_0x1126('0x0')]=function(){return function(_0x26c6a0){return client[_0x1126('0x1')](_0x1126('0x2'),{'options':{'raw':![],'attributes':['id',_0x1126('0x3'),_0x1126('0x4'),_0x1126('0x5'),_0x1126('0x6'),_0x1126('0x7'),_0x1126('0x8'),'serverUrl'],'include':[{'model':'ServicenowConfiguration','as':_0x1126('0x9'),'attributes':['id',_0x1126('0x3')],'include':[{'model':'ServicenowField','as':_0x1126('0xa'),'attributes':['id',_0x1126('0xb'),_0x1126('0xc'),_0x1126('0xd')],'include':[{'model':_0x1126('0xe'),'as':'Variable','attributes':['id',_0x1126('0x3')]}]},{'model':_0x1126('0xf'),'as':_0x1126('0x10'),'attributes':['id','type',_0x1126('0xc'),'key','keyType',_0x1126('0x11'),'variableName'],'include':[{'model':_0x1126('0xe'),'as':_0x1126('0xe'),'attributes':['id',_0x1126('0x3')]}]},{'model':_0x1126('0xf'),'as':_0x1126('0x12'),'attributes':['id',_0x1126('0xb'),_0x1126('0xc'),_0x1126('0x13'),_0x1126('0x14'),'customField','variableName'],'include':[{'model':_0x1126('0xe'),'as':_0x1126('0xe'),'attributes':['id',_0x1126('0x3')]}]}]}]},'log':'GetServicenowkAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index e29ee02..f0aeb73 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['nameField','customField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','username','password','serverUrl','Configurations','type','content','variableName','Variable','key','keyType','Fields','idField'];(function(_0x56641e,_0x44a51f){var _0x300c87=function(_0x220481){while(--_0x220481){_0x56641e['push'](_0x56641e['shift']());}};_0x300c87(++_0x44a51f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';var client=require('../../client');exports[_0x65f6('0x0')]=function(){return function(_0x4a3887){return client[_0x65f6('0x1')](_0x65f6('0x2'),{'options':{'raw':![],'attributes':['id',_0x65f6('0x3'),_0x65f6('0x4'),_0x65f6('0x5'),'remoteUri',_0x65f6('0x6')],'include':[{'model':'SugarcrmConfiguration','as':_0x65f6('0x7'),'attributes':['id',_0x65f6('0x3')],'include':[{'model':'SugarcrmField','as':'Subjects','attributes':['id',_0x65f6('0x8'),_0x65f6('0x9'),_0x65f6('0xa')],'include':[{'model':_0x65f6('0xb'),'as':_0x65f6('0xb'),'attributes':['id',_0x65f6('0x3')]}]},{'model':'SugarcrmField','as':'Descriptions','attributes':['id',_0x65f6('0x8'),_0x65f6('0x9'),_0x65f6('0xc'),_0x65f6('0xd'),'keyContent',_0x65f6('0xa')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x65f6('0x3')]}]},{'model':'SugarcrmField','as':_0x65f6('0xe'),'attributes':['id','type',_0x65f6('0x9'),_0x65f6('0xf'),_0x65f6('0x10'),_0x65f6('0x11'),_0x65f6('0xa')],'include':[{'model':_0x65f6('0xb'),'as':_0x65f6('0xb'),'attributes':['id',_0x65f6('0x3')]}]}]}]},'log':_0x65f6('0x2')});};}; \ No newline at end of file +var _0x2ef3=['SugarcrmField','Descriptions','keyType','keyContent','Fields','idField','../../client','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','password','remoteUri','SugarcrmConfiguration','Configurations','Subjects','type','content','variableName','Variable'];(function(_0x56a088,_0x533cd5){var _0x2b4dea=function(_0x3daaff){while(--_0x3daaff){_0x56a088['push'](_0x56a088['shift']());}};_0x2b4dea(++_0x533cd5);}(_0x2ef3,0xba));var _0x32ef=function(_0x40ee9a,_0x222e13){_0x40ee9a=_0x40ee9a-0x0;var _0x1c1891=_0x2ef3[_0x40ee9a];return _0x1c1891;};'use strict';var client=require(_0x32ef('0x0'));exports[_0x32ef('0x1')]=function(){return function(_0x47513a){return client[_0x32ef('0x2')](_0x32ef('0x3'),{'options':{'raw':![],'attributes':['id',_0x32ef('0x4'),'username',_0x32ef('0x5'),_0x32ef('0x6'),'serverUrl'],'include':[{'model':_0x32ef('0x7'),'as':_0x32ef('0x8'),'attributes':['id','name'],'include':[{'model':'SugarcrmField','as':_0x32ef('0x9'),'attributes':['id',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc')],'include':[{'model':_0x32ef('0xd'),'as':_0x32ef('0xd'),'attributes':['id',_0x32ef('0x4')]}]},{'model':_0x32ef('0xe'),'as':_0x32ef('0xf'),'attributes':['id',_0x32ef('0xa'),'content','key',_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0xc')],'include':[{'model':_0x32ef('0xd'),'as':'Variable','attributes':['id',_0x32ef('0x4')]}]},{'model':'SugarcrmField','as':_0x32ef('0x12'),'attributes':['id','type',_0x32ef('0xb'),_0x32ef('0x13'),'nameField','customField',_0x32ef('0xc')],'include':[{'model':'Variable','as':_0x32ef('0xd'),'attributes':['id',_0x32ef('0x4')]}]}]}]},'log':_0x32ef('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index c4087d6..c39098d 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4af1=['type','key','keyType','keyContent','variableName','Fields','idField','nameField','../../client','Request','GetVtigerAccount','name','description','username','accessKey','remoteUri','VtigerConfiguration','Configurations','VtigerField','Subjects','content','Variable','Descriptions'];(function(_0x45aecd,_0x1ead65){var _0x4737ae=function(_0x1fbba7){while(--_0x1fbba7){_0x45aecd['push'](_0x45aecd['shift']());}};_0x4737ae(++_0x1ead65);}(_0x4af1,0x92));var _0x14af=function(_0x177d11,_0x2611df){_0x177d11=_0x177d11-0x0;var _0x36e006=_0x4af1[_0x177d11];return _0x36e006;};'use strict';var client=require(_0x14af('0x0'));exports['getVtigerAccounts']=function(){return function(_0x5a515a){return client[_0x14af('0x1')](_0x14af('0x2'),{'options':{'raw':![],'attributes':['id',_0x14af('0x3'),_0x14af('0x4'),_0x14af('0x5'),_0x14af('0x6'),_0x14af('0x7'),'serverUrl'],'include':[{'model':_0x14af('0x8'),'as':_0x14af('0x9'),'attributes':['id','name'],'include':[{'model':_0x14af('0xa'),'as':_0x14af('0xb'),'attributes':['id','type',_0x14af('0xc'),'variableName'],'include':[{'model':'Variable','as':_0x14af('0xd'),'attributes':['id',_0x14af('0x3')]}]},{'model':_0x14af('0xa'),'as':_0x14af('0xe'),'attributes':['id',_0x14af('0xf'),'content',_0x14af('0x10'),_0x14af('0x11'),_0x14af('0x12'),_0x14af('0x13')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x14af('0x3')]}]},{'model':_0x14af('0xa'),'as':_0x14af('0x14'),'attributes':['id',_0x14af('0xf'),_0x14af('0xc'),_0x14af('0x15'),_0x14af('0x16'),'customField',_0x14af('0x13')],'include':[{'model':_0x14af('0xd'),'as':_0x14af('0xd'),'attributes':['id',_0x14af('0x3')]}]}]}]},'log':'GetVtigerAccount'});};}; \ No newline at end of file +var _0xc308=['customField','../../client','Request','GetVtigerAccount','name','username','accessKey','remoteUri','serverUrl','VtigerConfiguration','Configurations','Subjects','type','content','Variable','VtigerField','Descriptions','key','keyType','variableName','Fields','idField','nameField'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc308,0xe7));var _0x8c30=function(_0x4ab866,_0x40e607){_0x4ab866=_0x4ab866-0x0;var _0x56047a=_0xc308[_0x4ab866];return _0x56047a;};'use strict';var client=require(_0x8c30('0x0'));exports['getVtigerAccounts']=function(){return function(_0x9d43df){return client[_0x8c30('0x1')](_0x8c30('0x2'),{'options':{'raw':![],'attributes':['id',_0x8c30('0x3'),'description',_0x8c30('0x4'),_0x8c30('0x5'),_0x8c30('0x6'),_0x8c30('0x7')],'include':[{'model':_0x8c30('0x8'),'as':_0x8c30('0x9'),'attributes':['id',_0x8c30('0x3')],'include':[{'model':'VtigerField','as':_0x8c30('0xa'),'attributes':['id',_0x8c30('0xb'),_0x8c30('0xc'),'variableName'],'include':[{'model':_0x8c30('0xd'),'as':_0x8c30('0xd'),'attributes':['id',_0x8c30('0x3')]}]},{'model':_0x8c30('0xe'),'as':_0x8c30('0xf'),'attributes':['id','type','content',_0x8c30('0x10'),_0x8c30('0x11'),'keyContent',_0x8c30('0x12')],'include':[{'model':_0x8c30('0xd'),'as':_0x8c30('0xd'),'attributes':['id','name']}]},{'model':'VtigerField','as':_0x8c30('0x13'),'attributes':['id','type','content',_0x8c30('0x14'),_0x8c30('0x15'),_0x8c30('0x16'),_0x8c30('0x12')],'include':[{'model':_0x8c30('0xd'),'as':_0x8c30('0xd'),'attributes':['id',_0x8c30('0x3')]}]}]}]},'log':_0x8c30('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index 3152c68..acfd49f 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefe6=['keyContent','idField','nameField','customField','../../client','getZendeskAccounts','Request','GetZendeskAccount','name','username','password','token','authType','serverUrl','ZendeskConfiguration','Tag','ZendeskField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType'];(function(_0xd1fa42,_0x3cb936){var _0x24c89a=function(_0x55a929){while(--_0x55a929){_0xd1fa42['push'](_0xd1fa42['shift']());}};_0x24c89a(++_0x3cb936);}(_0xefe6,0x9a));var _0x6efe=function(_0x475dce,_0x1754ff){_0x475dce=_0x475dce-0x0;var _0x40687a=_0xefe6[_0x475dce];return _0x40687a;};'use strict';var client=require(_0x6efe('0x0'));exports[_0x6efe('0x1')]=function(){return function(_0x485be8){return client[_0x6efe('0x2')](_0x6efe('0x3'),{'options':{'raw':![],'attributes':['id',_0x6efe('0x4'),_0x6efe('0x5'),_0x6efe('0x6'),_0x6efe('0x7'),'remoteUri',_0x6efe('0x8'),_0x6efe('0x9'),'type'],'include':[{'model':_0x6efe('0xa'),'as':'Configurations','attributes':['id',_0x6efe('0x4')],'include':[{'model':_0x6efe('0xb'),'attributes':['id','name']},{'model':_0x6efe('0xc'),'as':_0x6efe('0xd'),'attributes':['id',_0x6efe('0xe'),_0x6efe('0xf'),_0x6efe('0x10')],'include':[{'model':_0x6efe('0x11'),'as':_0x6efe('0x11'),'attributes':['id',_0x6efe('0x4')]}]},{'model':_0x6efe('0xc'),'as':_0x6efe('0x12'),'attributes':['id',_0x6efe('0xe'),_0x6efe('0xf'),_0x6efe('0x13'),_0x6efe('0x14'),_0x6efe('0x15'),_0x6efe('0x10')],'include':[{'model':_0x6efe('0x11'),'as':_0x6efe('0x11'),'attributes':['id','name']}]},{'model':_0x6efe('0xc'),'as':'Fields','attributes':['id',_0x6efe('0xe'),'content',_0x6efe('0x16'),_0x6efe('0x17'),_0x6efe('0x18'),'variableName'],'include':[{'model':'Variable','as':_0x6efe('0x11'),'attributes':['id',_0x6efe('0x4')]}]}]}]},'log':_0x6efe('0x3')});};}; \ No newline at end of file +var _0x16a4=['customField','../../client','getZendeskAccounts','Request','GetZendeskAccount','name','username','password','token','remoteUri','authType','type','ZendeskConfiguration','Configurations','Tag','ZendeskField','Subjects','content','variableName','Variable','Descriptions','key','keyType','keyContent','idField','nameField'];(function(_0x50784f,_0x1e9de2){var _0x475cf8=function(_0x24ba9a){while(--_0x24ba9a){_0x50784f['push'](_0x50784f['shift']());}};_0x475cf8(++_0x1e9de2);}(_0x16a4,0x16d));var _0x416a=function(_0x4e4d80,_0x141f75){_0x4e4d80=_0x4e4d80-0x0;var _0x54e321=_0x16a4[_0x4e4d80];return _0x54e321;};'use strict';var client=require(_0x416a('0x0'));exports[_0x416a('0x1')]=function(){return function(_0x51ea33){return client[_0x416a('0x2')](_0x416a('0x3'),{'options':{'raw':![],'attributes':['id',_0x416a('0x4'),_0x416a('0x5'),_0x416a('0x6'),_0x416a('0x7'),_0x416a('0x8'),_0x416a('0x9'),'serverUrl',_0x416a('0xa')],'include':[{'model':_0x416a('0xb'),'as':_0x416a('0xc'),'attributes':['id','name'],'include':[{'model':_0x416a('0xd'),'attributes':['id','name']},{'model':_0x416a('0xe'),'as':_0x416a('0xf'),'attributes':['id','type',_0x416a('0x10'),_0x416a('0x11')],'include':[{'model':_0x416a('0x12'),'as':_0x416a('0x12'),'attributes':['id',_0x416a('0x4')]}]},{'model':_0x416a('0xe'),'as':_0x416a('0x13'),'attributes':['id',_0x416a('0xa'),_0x416a('0x10'),_0x416a('0x14'),_0x416a('0x15'),_0x416a('0x16'),_0x416a('0x11')],'include':[{'model':_0x416a('0x12'),'as':_0x416a('0x12'),'attributes':['id',_0x416a('0x4')]}]},{'model':_0x416a('0xe'),'as':'Fields','attributes':['id',_0x416a('0xa'),_0x416a('0x10'),_0x416a('0x17'),_0x416a('0x18'),_0x416a('0x19'),_0x416a('0x11')],'include':[{'model':_0x416a('0x12'),'as':'Variable','attributes':['id',_0x416a('0x4')]}]}]}]},'log':_0x416a('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index d3f1ca9..8494882 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc721=['key','keyType','keyContent','variableName','Fields','type','idField','nameField','customField','GetZohoAccount','../../client','Request','name','description','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','moduleCreate','moduleSearch','ZohoField','Subjects','content','Variable'];(function(_0x2f4c1c,_0x5a3dd4){var _0x25e0f2=function(_0x46ea31){while(--_0x46ea31){_0x2f4c1c['push'](_0x2f4c1c['shift']());}};_0x25e0f2(++_0x5a3dd4);}(_0xc721,0x10e));var _0x1c72=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc721[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x1c72('0x0'));exports['getZohoAccounts']=function(){return function(_0x4dd286){return client[_0x1c72('0x1')]('GetZohoAccount',{'options':{'raw':![],'attributes':['id',_0x1c72('0x2'),_0x1c72('0x3'),'host','zone',_0x1c72('0x4'),_0x1c72('0x5'),_0x1c72('0x6'),_0x1c72('0x7'),_0x1c72('0x8')],'include':[{'model':'ZohoConfiguration','as':_0x1c72('0x9'),'attributes':['id','name',_0x1c72('0xa'),_0x1c72('0xb'),_0x1c72('0x3')],'include':[{'model':_0x1c72('0xc'),'as':_0x1c72('0xd'),'attributes':['id','type',_0x1c72('0xe'),'variableName'],'include':[{'model':_0x1c72('0xf'),'as':_0x1c72('0xf'),'attributes':['id',_0x1c72('0x2')]}]},{'model':_0x1c72('0xc'),'as':'Descriptions','attributes':['id','type',_0x1c72('0xe'),_0x1c72('0x10'),_0x1c72('0x11'),_0x1c72('0x12'),_0x1c72('0x13')],'include':[{'model':_0x1c72('0xf'),'as':_0x1c72('0xf'),'attributes':['id','name']}]},{'model':_0x1c72('0xc'),'as':_0x1c72('0x14'),'attributes':['id',_0x1c72('0x15'),_0x1c72('0xe'),_0x1c72('0x16'),_0x1c72('0x17'),_0x1c72('0x18'),'variableName'],'include':[{'model':_0x1c72('0xf'),'as':'Variable','attributes':['id',_0x1c72('0x2')]}]}]}]},'log':_0x1c72('0x19')});};}; \ No newline at end of file +var _0xca5f=['Descriptions','content','key','keyType','keyContent','name','Fields','idField','nameField','customField','getZohoAccounts','Request','GetZohoAccount','description','host','clientId','clientSecret','serverUrl','code','refreshToken','ZohoConfiguration','moduleCreate','moduleSearch','Subjects','type','variableName','Variable','ZohoField'];(function(_0x26660c,_0xa474ef){var _0x21fb98=function(_0xcedc16){while(--_0xcedc16){_0x26660c['push'](_0x26660c['shift']());}};_0x21fb98(++_0xa474ef);}(_0xca5f,0x96));var _0xfca5=function(_0x1e5879,_0x11cb12){_0x1e5879=_0x1e5879-0x0;var _0x1cc714=_0xca5f[_0x1e5879];return _0x1cc714;};'use strict';var client=require('../../client');exports[_0xfca5('0x0')]=function(){return function(_0x5e8c9b){return client[_0xfca5('0x1')](_0xfca5('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xfca5('0x3'),_0xfca5('0x4'),'zone',_0xfca5('0x5'),_0xfca5('0x6'),_0xfca5('0x7'),_0xfca5('0x8'),_0xfca5('0x9')],'include':[{'model':_0xfca5('0xa'),'as':'Configurations','attributes':['id','name',_0xfca5('0xb'),_0xfca5('0xc'),_0xfca5('0x3')],'include':[{'model':'ZohoField','as':_0xfca5('0xd'),'attributes':['id',_0xfca5('0xe'),'content',_0xfca5('0xf')],'include':[{'model':_0xfca5('0x10'),'as':_0xfca5('0x10'),'attributes':['id','name']}]},{'model':_0xfca5('0x11'),'as':_0xfca5('0x12'),'attributes':['id',_0xfca5('0xe'),_0xfca5('0x13'),_0xfca5('0x14'),_0xfca5('0x15'),_0xfca5('0x16'),_0xfca5('0xf')],'include':[{'model':_0xfca5('0x10'),'as':'Variable','attributes':['id',_0xfca5('0x17')]}]},{'model':_0xfca5('0x11'),'as':_0xfca5('0x18'),'attributes':['id',_0xfca5('0xe'),_0xfca5('0x13'),_0xfca5('0x19'),_0xfca5('0x1a'),_0xfca5('0x1b'),_0xfca5('0xf')],'include':[{'model':_0xfca5('0x10'),'as':_0xfca5('0x10'),'attributes':['id','name']}]}]}]},'log':_0xfca5('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index 559e3b4..03d15e7 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x307a=['../client','stack','replace','silly','length','resolve','every','number','map','interval','concat','Request','IntervalIftime','intervalIftime','../../../config/logger','dialer'];(function(_0x45c032,_0x21df23){var _0x1faa28=function(_0x419573){while(--_0x419573){_0x45c032['push'](_0x45c032['shift']());}};_0x1faa28(++_0x21df23);}(_0x307a,0x1be));var _0xa307=function(_0x4dfd9c,_0x8e23ef){_0x4dfd9c=_0x4dfd9c-0x0;var _0x10e625=_0x307a[_0x4dfd9c];return _0x10e625;};var logger=require(_0xa307('0x0'))(_0xa307('0x1'));var client=require(_0xa307('0x2'));function intervalIftime(_0x483f60,_0x5db16e){const _0x458443=new Error()[_0xa307('0x3')][_0xa307('0x4')](/^Error/,'')['trim']();logger[_0xa307('0x5')]('intervalIftime\x20called\x20with',_0x483f60,_0x5db16e,_0x458443);const _0x3f0c35=Array['isArray'](_0x483f60);if(!_0x483f60||_0x3f0c35&&_0x483f60[_0xa307('0x6')]===0x0){return Promise[_0xa307('0x7')](![]);}else{var _0x58984e=[];var _0x3dd99d=[];var _0x4bf99b=_0x3f0c35?_0x483f60:[_0x483f60];var _0x51756b=_0x4bf99b[_0xa307('0x8')](function(_0x315883){return typeof _0x315883===_0xa307('0x9');});var _0x2d4e35=_0x4bf99b[_0xa307('0x8')](function(_0x4eef9a){return typeof _0x4eef9a==='string';});if(!_0x51756b&&!_0x2d4e35){_0x58984e=_0x4bf99b[_0xa307('0xa')](function(_0x41e814){return _0x41e814['id'];});if(_0x58984e[_0xa307('0x6')]===0x0){_0x3dd99d=_0x4bf99b['map'](function(_0x1547b0){return _0x1547b0[_0xa307('0xb')];});}}else{if(_0x51756b){_0x58984e=_0x58984e[_0xa307('0xc')](_0x4bf99b);}if(_0x2d4e35){_0x3dd99d=_0x3dd99d[_0xa307('0xc')](_0x4bf99b);}}return client[_0xa307('0xd')](_0xa307('0xe'),{'intervalIds':_0x58984e,'intervals':_0x3dd99d,'timezone':_0x5db16e,'log':_0xa307('0xe')});}}exports[_0xa307('0xf')]=intervalIftime; \ No newline at end of file +var _0x039b=['number','string','concat','Request','IntervalIftime','intervalIftime','dialer','stack','replace','trim','silly','intervalIftime\x20called\x20with','isArray','length','resolve','every'];(function(_0x1a79d9,_0x21a16c){var _0x53ffe0=function(_0x38b1d1){while(--_0x38b1d1){_0x1a79d9['push'](_0x1a79d9['shift']());}};_0x53ffe0(++_0x21a16c);}(_0x039b,0x196));var _0xb039=function(_0x555515,_0xb32b90){_0x555515=_0x555515-0x0;var _0x39f430=_0x039b[_0x555515];return _0x39f430;};var logger=require('../../../config/logger')(_0xb039('0x0'));var client=require('../client');function intervalIftime(_0x13c2b9,_0x2a6f30){const _0x572db4=new Error()[_0xb039('0x1')][_0xb039('0x2')](/^Error/,'')[_0xb039('0x3')]();logger[_0xb039('0x4')](_0xb039('0x5'),_0x13c2b9,_0x2a6f30,_0x572db4);const _0x17d62d=Array[_0xb039('0x6')](_0x13c2b9);if(!_0x13c2b9||_0x17d62d&&_0x13c2b9[_0xb039('0x7')]===0x0){return Promise[_0xb039('0x8')](![]);}else{var _0x15d9dc=[];var _0x3b7a4=[];var _0x3351ca=_0x17d62d?_0x13c2b9:[_0x13c2b9];var _0x17e8ce=_0x3351ca[_0xb039('0x9')](function(_0x1e0a71){return typeof _0x1e0a71===_0xb039('0xa');});var _0xd4d2c3=_0x3351ca[_0xb039('0x9')](function(_0x57d968){return typeof _0x57d968===_0xb039('0xb');});if(!_0x17e8ce&&!_0xd4d2c3){_0x15d9dc=_0x3351ca['map'](function(_0x45a476){return _0x45a476['id'];});if(_0x15d9dc[_0xb039('0x7')]===0x0){_0x3b7a4=_0x3351ca['map'](function(_0x5ac363){return _0x5ac363['interval'];});}}else{if(_0x17e8ce){_0x15d9dc=_0x15d9dc[_0xb039('0xc')](_0x3351ca);}if(_0xd4d2c3){_0x3b7a4=_0x3b7a4[_0xb039('0xc')](_0x3351ca);}}return client[_0xb039('0xd')](_0xb039('0xe'),{'intervalIds':_0x15d9dc,'intervals':_0x3b7a4,'timezone':_0x2a6f30,'log':_0xb039('0xe')});}}exports[_0xb039('0xf')]=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index 9123900..dfc7046 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d1c=['util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','accountcode','uniqueid','voiceDialReport','membername','starttime','endtime','dialstring','toNumber','lodash'];(function(_0x488f41,_0x4a5ed0){var _0x3e4e72=function(_0x10068d){while(--_0x10068d){_0x488f41['push'](_0x488f41['shift']());}};_0x3e4e72(++_0x4a5ed0);}(_0x4d1c,0x1bf));var _0xc4d1=function(_0x3fa77c,_0x350b89){_0x3fa77c=_0x3fa77c-0x0;var _0x21a21c=_0x4d1c[_0x3fa77c];return _0x21a21c;};'use strict';var moment=require('moment');var _=require(_0xc4d1('0x0'));var util=require(_0xc4d1('0x1'));var client=require('../client');exports[_0xc4d1('0x2')]=function(_0x527b4a){var _0x44ada9=_0x527b4a[_0xc4d1('0x3')]||_0x527b4a[_0xc4d1('0x4')];return client[_0xc4d1('0x5')](_0xc4d1('0x6'),{'body':{'channel':_0xc4d1('0x7'),'membername':_0x527b4a[_0xc4d1('0x8')],'interface':_[_0xc4d1('0x9')](_0x527b4a[_0xc4d1('0xa')])?util[_0xc4d1('0xb')]('SIP/%s',_0x527b4a[_0xc4d1('0x8')]):_0x527b4a[_0xc4d1('0xa')],'type':_0xc4d1('0xc'),'enterAt':_0x527b4a[_0xc4d1('0xd')],'exitAt':_0x44ada9,'duration':moment(_0x44ada9)[_0xc4d1('0xe')](_0x527b4a['queuecallerleaveAt'],_0xc4d1('0xf')),'data1':_0xc4d1('0x10'),'data2':_0x527b4a[_0xc4d1('0x11')],'data3':_0x527b4a[_0xc4d1('0x12')],'data4':null,'data5':_0x527b4a[_0xc4d1('0x13')],'role':'agent','internal':_0x527b4a[_0xc4d1('0x14')]?_['toNumber'](_0x527b4a['accountcode']):undefined,'uniqueid':_0x527b4a[_0xc4d1('0x15')]},'log':_0xc4d1('0x6')});};exports[_0xc4d1('0x16')]=function(_0x5e26e7){return client[_0xc4d1('0x5')](_0xc4d1('0x6'),{'body':{'channel':_0xc4d1('0x7'),'membername':_0x5e26e7[_0xc4d1('0x17')],'interface':_0x5e26e7[_0xc4d1('0xa')],'type':_0xc4d1('0xc'),'enterAt':_0x5e26e7[_0xc4d1('0x18')],'exitAt':_0x5e26e7['endtime'],'duration':moment(_0x5e26e7['endtime'])[_0xc4d1('0xe')](_0x5e26e7[_0xc4d1('0x18')],_0xc4d1('0xf'))>=0x0?moment(_0x5e26e7[_0xc4d1('0x19')])[_0xc4d1('0xe')](_0x5e26e7[_0xc4d1('0x18')],'seconds'):null,'data1':'outbound','data2':_0x5e26e7[_0xc4d1('0x14')],'data3':_0x5e26e7['exten'],'data4':_0x5e26e7[_0xc4d1('0x1a')]||null,'role':'agent','internal':_0x5e26e7[_0xc4d1('0x14')]?_[_0xc4d1('0x1b')](_0x5e26e7['accountcode']):undefined,'uniqueid':_0x5e26e7['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xef97=['moment','lodash','util','../client','voiceQueueReport','Request','CreateMemberReport','lastAssignedTo','isNil','format','SIP/%s','interface','TALKING','queuecallerleaveAt','seconds','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','voice','starttime','diff','endtime','outbound'];(function(_0x426b63,_0x3b4c07){var _0x1adcc0=function(_0x638c80){while(--_0x638c80){_0x426b63['push'](_0x426b63['shift']());}};_0x1adcc0(++_0x3b4c07);}(_0xef97,0x70));var _0x7ef9=function(_0x5aa373,_0x54c7f4){_0x5aa373=_0x5aa373-0x0;var _0x590e8e=_0xef97[_0x5aa373];return _0x590e8e;};'use strict';var moment=require(_0x7ef9('0x0'));var _=require(_0x7ef9('0x1'));var util=require(_0x7ef9('0x2'));var client=require(_0x7ef9('0x3'));exports[_0x7ef9('0x4')]=function(_0x3c0d29){var _0x227640=_0x3c0d29['queuecallercompleteAt']||_0x3c0d29['queuecallerexitAt'];return client[_0x7ef9('0x5')](_0x7ef9('0x6'),{'body':{'channel':'voice','membername':_0x3c0d29[_0x7ef9('0x7')],'interface':_[_0x7ef9('0x8')](_0x3c0d29['interface'])?util[_0x7ef9('0x9')](_0x7ef9('0xa'),_0x3c0d29[_0x7ef9('0x7')]):_0x3c0d29[_0x7ef9('0xb')],'type':_0x7ef9('0xc'),'enterAt':_0x3c0d29[_0x7ef9('0xd')],'exitAt':_0x227640,'duration':moment(_0x227640)['diff'](_0x3c0d29[_0x7ef9('0xd')],_0x7ef9('0xe')),'data1':_0x7ef9('0xf'),'data2':_0x3c0d29[_0x7ef9('0x10')],'data3':_0x3c0d29[_0x7ef9('0x11')],'data4':null,'data5':_0x3c0d29[_0x7ef9('0x12')],'role':_0x7ef9('0x13'),'internal':_0x3c0d29[_0x7ef9('0x14')]?_[_0x7ef9('0x15')](_0x3c0d29[_0x7ef9('0x14')]):undefined,'uniqueid':_0x3c0d29[_0x7ef9('0x16')]},'log':_0x7ef9('0x6')});};exports['voiceDialReport']=function(_0x2ed589){return client['Request'](_0x7ef9('0x6'),{'body':{'channel':_0x7ef9('0x17'),'membername':_0x2ed589['membername'],'interface':_0x2ed589['interface'],'type':_0x7ef9('0xc'),'enterAt':_0x2ed589[_0x7ef9('0x18')],'exitAt':_0x2ed589['endtime'],'duration':moment(_0x2ed589['endtime'])[_0x7ef9('0x19')](_0x2ed589[_0x7ef9('0x18')],'seconds')>=0x0?moment(_0x2ed589[_0x7ef9('0x1a')])[_0x7ef9('0x19')](_0x2ed589[_0x7ef9('0x18')],'seconds'):null,'data1':_0x7ef9('0x1b'),'data2':_0x2ed589['accountcode'],'data3':_0x2ed589[_0x7ef9('0x11')],'data4':_0x2ed589['dialstring']||null,'role':'agent','internal':_0x2ed589[_0x7ef9('0x14')]?_['toNumber'](_0x2ed589[_0x7ef9('0x14')]):undefined,'uniqueid':_0x2ed589[_0x7ef9('0x16')]},'log':_0x7ef9('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 4010a2c..f08797c 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 _0xa9f0=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','Request','ShowSetting'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xa9f0,0x153));var _0x0a9f=function(_0x523f3c,_0x5abf7d){_0x523f3c=_0x523f3c-0x0;var _0x5a77f9=_0xa9f0[_0x523f3c];return _0x5a77f9;};'use strict';var client=require(_0x0a9f('0x0'));exports['getSettings']=function(){return client[_0x0a9f('0x1')](_0x0a9f('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0a9f('0x3'),_0x0a9f('0x4')]},'log':_0x0a9f('0x5')});}; \ No newline at end of file +var _0xf9ae=['GetSettings','../client','getSettings','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x586b07,_0x2fca4b){var _0x120c68=function(_0x5f3ed1){while(--_0x5f3ed1){_0x586b07['push'](_0x586b07['shift']());}};_0x120c68(++_0x2fca4b);}(_0xf9ae,0x85));var _0xef9a=function(_0x823180,_0x4c656e){_0x823180=_0x823180-0x0;var _0x293588=_0xf9ae[_0x823180];return _0x293588;};'use strict';var client=require(_0xef9a('0x0'));exports[_0xef9a('0x1')]=function(){return client['Request'](_0xef9a('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xef9a('0x3'),_0xef9a('0x4')]},'log':_0xef9a('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index e4b7aed..fb7cf50 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 _0xf089=['html','getTemplates','Request','GetTemplate','name'];(function(_0x567a51,_0x11a7b0){var _0x3ee9f4=function(_0x2c91f1){while(--_0x2c91f1){_0x567a51['push'](_0x567a51['shift']());}};_0x3ee9f4(++_0x11a7b0);}(_0xf089,0xba));var _0x9f08=function(_0x17bfbe,_0x320969){_0x17bfbe=_0x17bfbe-0x0;var _0xecc61f=_0xf089[_0x17bfbe];return _0xecc61f;};'use strict';var client=require('../client');exports[_0x9f08('0x0')]=function(_0x3eda88){return function(_0x5927dd){return client[_0x9f08('0x1')](_0x9f08('0x2'),{'options':{'raw':!![],'attributes':['id',_0x9f08('0x3'),_0x9f08('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x2752=['Request','GetTemplate','name','../client'];(function(_0xc6e89e,_0x5d74e5){var _0x2e87cb=function(_0x16d55a){while(--_0x16d55a){_0xc6e89e['push'](_0xc6e89e['shift']());}};_0x2e87cb(++_0x5d74e5);}(_0x2752,0x12b));var _0x2275=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2752[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x2275('0x0'));exports['getTemplates']=function(_0x37f82e){return function(_0x51435b){return client[_0x2275('0x1')](_0x2275('0x2'),{'options':{'raw':!![],'attributes':['id',_0x2275('0x3'),'html']},'log':_0x2275('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 7783c7a..b16ab54 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 _0xff36=['name','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','data1','data2','data3','data4','data5','data6','data7','../client','Request','GetTrigger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff36,0x18d));var _0x6ff3=function(_0x50b6d0,_0x2ff9fe){_0x50b6d0=_0x50b6d0-0x0;var _0x1e99d1=_0xff36[_0x50b6d0];return _0x1e99d1;};'use strict';var client=require(_0x6ff3('0x0'));exports['getTriggers']=function(_0x106249){return function(_0x328bbc){return client[_0x6ff3('0x1')](_0x6ff3('0x2'),{'options':{'raw':![],'attributes':['id',_0x6ff3('0x3'),_0x6ff3('0x4'),_0x6ff3('0x5')],'include':[{'model':_0x6ff3('0x6'),'as':_0x6ff3('0x7'),'attributes':['id',_0x6ff3('0x8'),_0x6ff3('0x9'),_0x6ff3('0xa')]},{'model':'Condition','as':_0x6ff3('0xb'),'attributes':['id',_0x6ff3('0x8'),'operator',_0x6ff3('0xa')]},{'model':_0x6ff3('0xc'),'as':'Actions','attributes':['id','action',_0x6ff3('0xd'),_0x6ff3('0xe'),_0x6ff3('0xf'),_0x6ff3('0x10'),_0x6ff3('0x11'),_0x6ff3('0x12'),_0x6ff3('0x13')]}]},'log':_0x6ff3('0x2')});};}; \ No newline at end of file +var _0xe025=['Actions','action','data1','data2','data3','data4','data5','data6','GetTrigger','../client','getTriggers','Request','name','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Action'];(function(_0xe81fa7,_0x1c66ce){var _0x98c12=function(_0x158d9b){while(--_0x158d9b){_0xe81fa7['push'](_0xe81fa7['shift']());}};_0x98c12(++_0x1c66ce);}(_0xe025,0x127));var _0x5e02=function(_0x18395a,_0x1c9206){_0x18395a=_0x18395a-0x0;var _0x4b5164=_0xe025[_0x18395a];return _0x4b5164;};'use strict';var client=require(_0x5e02('0x0'));exports[_0x5e02('0x1')]=function(_0x3b950a){return function(_0x3fed41){return client[_0x5e02('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x5e02('0x3'),_0x5e02('0x4'),_0x5e02('0x5')],'include':[{'model':_0x5e02('0x6'),'as':_0x5e02('0x7'),'attributes':['id',_0x5e02('0x8'),_0x5e02('0x9'),_0x5e02('0xa')]},{'model':_0x5e02('0x6'),'as':_0x5e02('0xb'),'attributes':['id',_0x5e02('0x8'),'operator',_0x5e02('0xa')]},{'model':_0x5e02('0xc'),'as':_0x5e02('0xd'),'attributes':['id',_0x5e02('0xe'),_0x5e02('0xf'),_0x5e02('0x10'),_0x5e02('0x11'),_0x5e02('0x12'),_0x5e02('0x13'),_0x5e02('0x14'),'data7']}]},'log':_0x5e02('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index b99b939..2307d72 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 _0x684d=['getTrunks','GetTrunk','registry','defaultuser'];(function(_0x1d7bd8,_0x196799){var _0x2d509c=function(_0x5ef269){while(--_0x5ef269){_0x1d7bd8['push'](_0x1d7bd8['shift']());}};_0x2d509c(++_0x196799);}(_0x684d,0x174));var _0xd684=function(_0x21edfd,_0x346fbe){_0x21edfd=_0x21edfd-0x0;var _0x48a35e=_0x684d[_0x21edfd];return _0x48a35e;};'use strict';var client=require('../client');exports[_0xd684('0x0')]=function(_0x33830c){return function(_0x7a47a2){return client['Request'](_0xd684('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xd684('0x2'),_0xd684('0x3')]},'log':_0xd684('0x1')});};}; \ No newline at end of file +var _0x8756=['name','defaultuser','../client','getTrunks','Request','GetTrunk'];(function(_0x5185cf,_0x18e620){var _0x53a6b5=function(_0x414d58){while(--_0x414d58){_0x5185cf['push'](_0x5185cf['shift']());}};_0x53a6b5(++_0x18e620);}(_0x8756,0xc2));var _0x6875=function(_0x32547f,_0x5b8c0a){_0x32547f=_0x32547f-0x0;var _0x250800=_0x8756[_0x32547f];return _0x250800;};'use strict';var client=require(_0x6875('0x0'));exports[_0x6875('0x1')]=function(_0x3bf481){return function(_0x4ad071){return client[_0x6875('0x2')](_0x6875('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x6875('0x4'),'registry',_0x6875('0x5')]},'log':_0x6875('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 9cbbf8e..69c6d9c 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 _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file +var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x553a37,_0x5585c8){var _0x593888=function(_0x576761){while(--_0x576761){_0x553a37['push'](_0x553a37['shift']());}};_0x593888(++_0x5585c8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4480b9,_0x5c2949){_0x4480b9=_0x4480b9-0x0;var _0x3f0f02=_0xcb91[_0x4480b9];return _0x3f0f02;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index ed7b00f..9951ac9 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 _0xa75e=['update','UpdateVoiceAgentReport','Request','CreateVoiceAgentReport'];(function(_0x35ba71,_0xa2fbbd){var _0x5f04f4=function(_0x30a04f){while(--_0x30a04f){_0x35ba71['push'](_0x35ba71['shift']());}};_0x5f04f4(++_0xa2fbbd);}(_0xa75e,0x96));var _0xea75=function(_0x57ad90,_0x5ed9c0){_0x57ad90=_0x57ad90-0x0;var _0x3221ba=_0xa75e[_0x57ad90];return _0x3221ba;};'use strict';var client=require('../client');exports['create']=function(_0x71a1f1){return client[_0xea75('0x0')](_0xea75('0x1'),{'body':_0x71a1f1,'log':_0xea75('0x1')});};exports[_0xea75('0x2')]=function(_0xb0c6ca,_0x5c86c2,_0xc17b7d){return client[_0xea75('0x0')](_0xea75('0x3'),{'body':_0xb0c6ca,'options':{'where':{'uniqueid':_0x5c86c2,'interface':_0xc17b7d,'agentcomplete':!![]}},'log':_0xea75('0x3')});}; \ No newline at end of file +var _0x5872=['../client','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x20099a,_0x2bf584){var _0x2c3649=function(_0x3c2f4b){while(--_0x3c2f4b){_0x20099a['push'](_0x20099a['shift']());}};_0x2c3649(++_0x2bf584);}(_0x5872,0x18b));var _0x2587=function(_0x2da357,_0x1f9b2f){_0x2da357=_0x2da357-0x0;var _0x138fdd=_0x5872[_0x2da357];return _0x138fdd;};'use strict';var client=require(_0x2587('0x0'));exports['create']=function(_0x16b4b8){return client[_0x2587('0x1')](_0x2587('0x2'),{'body':_0x16b4b8,'log':_0x2587('0x2')});};exports[_0x2587('0x3')]=function(_0x668598,_0x3a4c12,_0x59b576){return client['Request'](_0x2587('0x4'),{'body':_0x668598,'options':{'where':{'uniqueid':_0x3a4c12,'interface':_0x59b576,'agentcomplete':!![]}},'log':_0x2587('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 9f48c7b..01f101c 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 _0x241c=['calleridnum','context','callerid','GetVoiceCallReport','outbound','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport'];(function(_0x2b5ee5,_0x3741bf){var _0x1c480b=function(_0x437a18){while(--_0x437a18){_0x2b5ee5['push'](_0x2b5ee5['shift']());}};_0x1c480b(++_0x3741bf);}(_0x241c,0x1c7));var _0xc241=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x241c[_0xa464c9];return _0x3d73c4;};'use strict';var moment=require(_0xc241('0x0'));var util=require(_0xc241('0x1'));var _=require(_0xc241('0x2'));var client=require(_0xc241('0x3'));exports[_0xc241('0x4')]=function(_0x16c849){return client[_0xc241('0x5')](_0xc241('0x6'),{'body':_['merge'](_0x16c849,{'source':_0x16c849[_0xc241('0x7')],'destinationcontext':_0x16c849[_0xc241('0x8')],'callerid':_0x16c849[_0xc241('0x9')],'amaflags':'DOCUMENTATION'}),'log':_0xc241('0x6')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0xc241('0xa'),{'options':{'where':{'type':[_0xc241('0xb')],'createdAt':{'$between':[moment()['startOf']('day')[_0xc241('0xc')](_0xc241('0xd')),moment()[_0xc241('0xe')](_0xc241('0xf'))['format'](_0xc241('0xd'))]}},'attributes':[_0xc241('0x10'),_0xc241('0x11'),_0xc241('0x12'),_0xc241('0x13')]},'log':_0xc241('0x14')});};}; \ No newline at end of file +var _0x1461=['disposition','GetVoiceCallReports','moment','util','lodash','../client','create','merge','calleridnum','context','callerid','DOCUMENTATION','Request','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type'];(function(_0x135561,_0x3a0be4){var _0x33d1a9=function(_0x1cee57){while(--_0x1cee57){_0x135561['push'](_0x135561['shift']());}};_0x33d1a9(++_0x3a0be4);}(_0x1461,0x1ce));var _0x1146=function(_0x2a8860,_0x2da926){_0x2a8860=_0x2a8860-0x0;var _0x2f47a4=_0x1461[_0x2a8860];return _0x2f47a4;};'use strict';var moment=require(_0x1146('0x0'));var util=require(_0x1146('0x1'));var _=require(_0x1146('0x2'));var client=require(_0x1146('0x3'));exports[_0x1146('0x4')]=function(_0x4b2b3b){return client['Request']('CreateVoiceCallReport',{'body':_[_0x1146('0x5')](_0x4b2b3b,{'source':_0x4b2b3b[_0x1146('0x6')],'destinationcontext':_0x4b2b3b[_0x1146('0x7')],'callerid':_0x4b2b3b[_0x1146('0x8')],'amaflags':_0x1146('0x9')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client[_0x1146('0xa')](_0x1146('0xb'),{'options':{'where':{'type':[_0x1146('0xc')],'createdAt':{'$between':[moment()[_0x1146('0xd')](_0x1146('0xe'))[_0x1146('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x1146('0xe'))['format'](_0x1146('0x10'))]}},'attributes':[_0x1146('0x11'),_0x1146('0x12'),'duration','billableseconds']},'log':_0x1146('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 831ecf0..ca9b29c 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 _0x7a7b=['create','Request','CreateVoiceDialReport','../client'];(function(_0x5180c3,_0x4b35f7){var _0x55c975=function(_0x4746cb){while(--_0x4746cb){_0x5180c3['push'](_0x5180c3['shift']());}};_0x55c975(++_0x4b35f7);}(_0x7a7b,0x1d7));var _0xb7a7=function(_0xee6752,_0x667b44){_0xee6752=_0xee6752-0x0;var _0xb4dcea=_0x7a7b[_0xee6752];return _0xb4dcea;};'use strict';var client=require(_0xb7a7('0x0'));exports[_0xb7a7('0x1')]=function(_0x27fa2b){return client[_0xb7a7('0x2')](_0xb7a7('0x3'),{'body':_0x27fa2b,'log':_0xb7a7('0x3')});}; \ No newline at end of file +var _0x5492=['../client','create','CreateVoiceDialReport'];(function(_0x2f880f,_0x119801){var _0x4cad04=function(_0x53a53b){while(--_0x53a53b){_0x2f880f['push'](_0x2f880f['shift']());}};_0x4cad04(++_0x119801);}(_0x5492,0x183));var _0x2549=function(_0x1a1745,_0x591802){_0x1a1745=_0x1a1745-0x0;var _0x5c4b92=_0x5492[_0x1a1745];return _0x5c4b92;};'use strict';var client=require(_0x2549('0x0'));exports[_0x2549('0x1')]=function(_0x4f8ebc){return client['Request']('CreateVoiceDialReport',{'body':_0x4f8ebc,'log':_0x2549('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 006d33f..c4b567b 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 _0x9990=['recordingFormat','getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x1bff41,_0x386880){var _0x4db66b=function(_0x5aa7b6){while(--_0x5aa7b6){_0x1bff41['push'](_0x1bff41['shift']());}};_0x4db66b(++_0x386880);}(_0x9990,0xf6));var _0x0999=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0x9990[_0x3cb6dc];return _0x47ec89;};'use strict';var client=require('../client');exports[_0x0999('0x0')]=function(){return function(){return client[_0x0999('0x1')](_0x0999('0x2'),{'options':{'raw':!![],'attributes':['id',_0x0999('0x3'),_0x0999('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x0999('0x0')});};}; \ No newline at end of file +var _0xc686=['getVoiceExtensions','Request','exten'];(function(_0x11787b,_0x684a44){var _0x47e1cc=function(_0x534ce1){while(--_0x534ce1){_0x11787b['push'](_0x11787b['shift']());}};_0x47e1cc(++_0x684a44);}(_0xc686,0x148));var _0x6c68=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc686[_0x3b380d];return _0x54502b;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x6c68('0x0')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x6c68('0x1'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x6c68('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 8567cad..311f45d 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 _0x53f9=['dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','name','callerid','Pause','mandatoryDispositionPause','active','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','dialActive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency'];(function(_0x5134ad,_0x3f1e69){var _0x4a86bc=function(_0x309169){while(--_0x309169){_0x5134ad['push'](_0x5134ad['shift']());}};_0x4a86bc(++_0x3f1e69);}(_0x53f9,0xb0));var _0x953f=function(_0x16a223,_0x31b6e8){_0x16a223=_0x16a223-0x0;var _0x5ded66=_0x53f9[_0x16a223];return _0x5ded66;};'use strict';var client=require(_0x953f('0x0'));exports[_0x953f('0x1')]=function(){return function(){return client[_0x953f('0x2')](_0x953f('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x953f('0x4'),_0x953f('0x5'),_0x953f('0x6'),_0x953f('0x7'),'type',_0x953f('0x8'),'dialMethod',_0x953f('0x9'),_0x953f('0xa'),'dialPowerLevel',_0x953f('0xb'),_0x953f('0xc'),_0x953f('0xd'),_0x953f('0xe'),_0x953f('0xf'),_0x953f('0x10'),_0x953f('0x11'),_0x953f('0x12'),_0x953f('0x13'),_0x953f('0x14'),_0x953f('0x15'),_0x953f('0x16'),'dialBusyRetryFrequency',_0x953f('0x17'),_0x953f('0x18'),_0x953f('0x19'),_0x953f('0x1a'),_0x953f('0x1b'),_0x953f('0x1c'),_0x953f('0x1d'),_0x953f('0x1e'),'dialAMDInitialSilence',_0x953f('0x1f'),'dialAMDAfterGreetingSilence',_0x953f('0x20'),_0x953f('0x21'),_0x953f('0x22'),'dialAMDMaximumNumberOfWords',_0x953f('0x23'),_0x953f('0x24'),_0x953f('0x25'),_0x953f('0x26'),'dialRecallInQueue',_0x953f('0x27'),_0x953f('0x28'),'dialAgiAfterHangupClient',_0x953f('0x29'),_0x953f('0x7'),_0x953f('0x2a'),_0x953f('0x2b'),_0x953f('0x2c'),'dialNoSuchNumberMaxRetry',_0x953f('0x2d'),_0x953f('0x2e'),_0x953f('0x2f'),_0x953f('0x30'),_0x953f('0x31'),_0x953f('0x32'),_0x953f('0x33'),_0x953f('0x34'),_0x953f('0x35'),_0x953f('0x36'),_0x953f('0x37'),_0x953f('0x38'),'dialPreviewAutoRecallMe',_0x953f('0x39')],'include':[{'model':_0x953f('0x3a'),'as':_0x953f('0x3a'),'attributes':['id',_0x953f('0x3b'),_0x953f('0x3c'),'active']},{'model':_0x953f('0x3d'),'as':_0x953f('0x3e'),'attributes':['id','name']},{'model':_0x953f('0x3a'),'as':'TrunkBackup','attributes':['id',_0x953f('0x3b'),_0x953f('0x3c'),_0x953f('0x3f')]},{'model':_0x953f('0x40'),'as':'Interval','attributes':['id',_0x953f('0x3b')],'include':[{'model':_0x953f('0x40'),'as':_0x953f('0x41'),'attributes':['id',_0x953f('0x3b'),'interval']}]}]},'log':_0x953f('0x1')});};}; \ No newline at end of file +var _0x1039=['dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry'];(function(_0x1b7ffa,_0x165bff){var _0x46de87=function(_0x1d6c0f){while(--_0x1d6c0f){_0x1b7ffa['push'](_0x1b7ffa['shift']());}};_0x46de87(++_0x165bff);}(_0x1039,0x64));var _0x9103=function(_0x12e114,_0x4aa75e){_0x12e114=_0x12e114-0x0;var _0x503b89=_0x1039[_0x12e114];return _0x503b89;};'use strict';var client=require('../client');exports[_0x9103('0x0')]=function(){return function(){return client[_0x9103('0x1')](_0x9103('0x2'),{'options':{'raw':![],'attributes':['id',_0x9103('0x3'),_0x9103('0x4'),_0x9103('0x5'),'autopause',_0x9103('0x6'),_0x9103('0x7'),_0x9103('0x8'),_0x9103('0x9'),_0x9103('0xa'),_0x9103('0xb'),_0x9103('0xc'),'dialPredictiveOptimization',_0x9103('0xd'),'dialPredictiveInterval',_0x9103('0xe'),_0x9103('0xf'),'dialOriginateTimeout',_0x9103('0x10'),_0x9103('0x11'),_0x9103('0x12'),_0x9103('0x13'),_0x9103('0x14'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0x9103('0x15'),'dialNoAnswerRetryFrequency',_0x9103('0x16'),_0x9103('0x17'),_0x9103('0x18'),'dialPrefix',_0x9103('0x19'),_0x9103('0x1a'),_0x9103('0x1b'),_0x9103('0x1c'),_0x9103('0x1d'),_0x9103('0x1e'),_0x9103('0x1f'),_0x9103('0x20'),_0x9103('0x21'),_0x9103('0x22'),_0x9103('0x23'),_0x9103('0x24'),'dialRecallMeTimeout',_0x9103('0x25'),_0x9103('0x26'),_0x9103('0x27'),'dialAgiAfterHangupClient',_0x9103('0x28'),_0x9103('0x6'),'strategy',_0x9103('0x29'),_0x9103('0x2a'),_0x9103('0x2b'),_0x9103('0x2c'),'dialDropMaxRetry','dialDropRetryFrequency',_0x9103('0x2d'),_0x9103('0x2e'),_0x9103('0x2f'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x9103('0x30'),_0x9103('0x31'),_0x9103('0x32'),_0x9103('0x33'),'dialPreviewAutoRecallMe',_0x9103('0x34')],'include':[{'model':_0x9103('0x35'),'as':_0x9103('0x35'),'attributes':['id',_0x9103('0x3'),_0x9103('0x36'),_0x9103('0x37')]},{'model':_0x9103('0x38'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0x9103('0x35'),'as':_0x9103('0x39'),'attributes':['id',_0x9103('0x3'),_0x9103('0x36'),'active']},{'model':_0x9103('0x3a'),'as':_0x9103('0x3a'),'attributes':['id','name'],'include':[{'model':_0x9103('0x3a'),'as':_0x9103('0x3b'),'attributes':['id',_0x9103('0x3'),'interval']}]}]},'log':_0x9103('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index bd190b2..56b2096 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(_0x436452,_0x10bf26){var _0x50eddc=function(_0x2653c0){while(--_0x2653c0){_0x436452['push'](_0x436452['shift']());}};_0x50eddc(++_0x10bf26);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x301f3f,_0x18152c){var _0x49bdd4=function(_0x24d9f3){while(--_0x24d9f3){_0x301f3f['push'](_0x301f3f['shift']());}};_0x49bdd4(++_0x18152c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 2e241ce..ef22e1d 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 _0x1557=['../client','Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x4403d9,_0x2a155d){var _0x5ee06b=function(_0x36b9da){while(--_0x36b9da){_0x4403d9['push'](_0x4403d9['shift']());}};_0x5ee06b(++_0x2a155d);}(_0x1557,0x1d0));var _0x7155=function(_0x1fcc54,_0x408a98){_0x1fcc54=_0x1fcc54-0x0;var _0x3e9206=_0x1557[_0x1fcc54];return _0x3e9206;};'use strict';var client=require(_0x7155('0x0'));exports['getVoiceQueueRtPauses']=function(_0x20ebe5){return function(){return client[_0x7155('0x1')](_0x7155('0x2'),{'options':{'where':{'VoiceQueueId':_0x20ebe5,'paused':!![]},'raw':!![]},'log':_0x7155('0x3')});};}; \ No newline at end of file +var _0x369e=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x384a2b,_0x2c44ed){var _0x234d16=function(_0x415587){while(--_0x415587){_0x384a2b['push'](_0x384a2b['shift']());}};_0x234d16(++_0x2c44ed);}(_0x369e,0x131));var _0xe369=function(_0x13c53d,_0x110207){_0x13c53d=_0x13c53d-0x0;var _0x49fcf4=_0x369e[_0x13c53d];return _0x49fcf4;};'use strict';var client=require('../client');exports[_0xe369('0x0')]=function(_0x3d6412){return function(){return client[_0xe369('0x1')](_0xe369('0x2'),{'options':{'where':{'VoiceQueueId':_0x3d6412,'paused':!![]},'raw':!![]},'log':_0xe369('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index a6a9557..01c4441 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x34b547,_0x14ee3b){var _0x530f9f=function(_0x556044){while(--_0x556044){_0x34b547['push'](_0x34b547['shift']());}};_0x530f9f(++_0x14ee3b);}(_0x7a54,0x106));var _0x47a5=function(_0xc1b7d7,_0x170a51){_0xc1b7d7=_0xc1b7d7-0x0;var _0x3b26bd=_0x7a54[_0xc1b7d7];return _0x3b26bd;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x27737a,_0x146a0f){var _0x11fdd9=function(_0x30ca09){while(--_0x30ca09){_0x27737a['push'](_0x27737a['shift']());}};_0x11fdd9(++_0x146a0f);}(_0x7a54,0x106));var _0x47a5=function(_0x592edd,_0x58b7a4){_0x592edd=_0x592edd-0x0;var _0x1155d8=_0x7a54[_0x592edd];return _0x1155d8;};'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 bbd9e43..1e1a626 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 _0x23b6=['transfererconnectedlinenum','transferercontext','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','CreateVoiceTransferReport','attendedTransfer','result','origtransferercalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','Request','transfererchannel','transferercalleridnum','transferercalleridname'];(function(_0x355e8e,_0x4313f0){var _0x52cb43=function(_0x2feb45){while(--_0x2feb45){_0x355e8e['push'](_0x355e8e['shift']());}};_0x52cb43(++_0x4313f0);}(_0x23b6,0x112));var _0x623b=function(_0x35f6b4,_0x505966){_0x35f6b4=_0x35f6b4-0x0;var _0x10f072=_0x23b6[_0x35f6b4];return _0x10f072;};'use strict';var client=require('../client');exports[_0x623b('0x0')]={};exports[_0x623b('0x1')]=function(_0x3fe230){return client[_0x623b('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x3fe230['result'],'transfererchannel':_0x3fe230[_0x623b('0x3')],'transferercalleridnum':_0x3fe230[_0x623b('0x4')],'transferercalleridname':_0x3fe230[_0x623b('0x5')],'transfererconnectedlinenum':_0x3fe230[_0x623b('0x6')],'transfererconnectedlinename':_0x3fe230['transfererconnectedlinename'],'transfereraccountcode':_0x3fe230['transfereraccountcode'],'transferercontext':_0x3fe230[_0x623b('0x7')],'transfererexten':_0x3fe230['transfererexten'],'transfererlinkedid':_0x3fe230['transfererlinkedid'],'transfereechannel':_0x3fe230['transfereechannel'],'transfereecalleridnum':_0x3fe230[_0x623b('0x8')],'transfereecalleridname':_0x3fe230[_0x623b('0x9')],'transfereeconnectedlinenum':_0x3fe230[_0x623b('0xa')],'transfereeconnectedlinename':_0x3fe230[_0x623b('0xb')],'transfereeaccountcode':_0x3fe230[_0x623b('0xc')],'transfereecontext':_0x3fe230[_0x623b('0xd')],'transfereeexten':_0x3fe230[_0x623b('0xe')],'transfereelinkedid':_0x3fe230[_0x623b('0xf')],'isexternal':_0x3fe230[_0x623b('0x10')],'context':_0x3fe230['context'],'extension':_0x3fe230[_0x623b('0x11')],'type':'blind'},'log':_0x623b('0x12')});};exports[_0x623b('0x13')]=function(_0x4688eb){return client[_0x623b('0x2')](_0x623b('0x12'),{'body':{'result':_0x4688eb[_0x623b('0x14')],'transfererchannel':_0x4688eb['origtransfererchannel'],'transferercalleridnum':_0x4688eb[_0x623b('0x15')],'transferercalleridname':_0x4688eb['origtransferercalleridname'],'transfererconnectedlinenum':_0x4688eb['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x4688eb[_0x623b('0x16')],'transfereraccountcode':_0x4688eb[_0x623b('0x17')],'transferercontext':_0x4688eb['secondtransferercontext'],'transfererexten':_0x4688eb[_0x623b('0x18')],'transfererlinkedid':_0x4688eb['origtransfererlinkedid'],'transfereechannel':_0x4688eb[_0x623b('0x19')],'transfereecalleridnum':_0x4688eb[_0x623b('0x1a')],'transfereecalleridname':_0x4688eb['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x4688eb[_0x623b('0x1b')],'transfereeconnectedlinename':_0x4688eb[_0x623b('0x1c')],'transfereeaccountcode':_0x4688eb[_0x623b('0x1d')],'transfereecontext':_0x4688eb['transfertargetcontext'],'transfereeexten':_0x4688eb[_0x623b('0x1e')],'transfereelinkedid':_0x4688eb[_0x623b('0x1f')],'isexternal':_0x4688eb[_0x623b('0x10')],'context':_0x4688eb[_0x623b('0x20')],'extension':_0x4688eb[_0x623b('0x21')],'type':_0x623b('0x22')},'log':_0x623b('0x12')});}; \ No newline at end of file +var _0xc705=['transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','CreateVoiceTransferReport','attendedTransfer','result','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','blindTransfer','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname'];(function(_0xa8da9e,_0x15e225){var _0x2ab795=function(_0x47f002){while(--_0x47f002){_0xa8da9e['push'](_0xa8da9e['shift']());}};_0x2ab795(++_0x15e225);}(_0xc705,0x1e1));var _0x5c70=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0xc705[_0x1a89a1];return _0x3d5b46;};'use strict';var client=require(_0x5c70('0x0'));exports['transfers']={};exports[_0x5c70('0x1')]=function(_0x47fe1b){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x47fe1b['result'],'transfererchannel':_0x47fe1b[_0x5c70('0x2')],'transferercalleridnum':_0x47fe1b['transferercalleridnum'],'transferercalleridname':_0x47fe1b[_0x5c70('0x3')],'transfererconnectedlinenum':_0x47fe1b[_0x5c70('0x4')],'transfererconnectedlinename':_0x47fe1b['transfererconnectedlinename'],'transfereraccountcode':_0x47fe1b[_0x5c70('0x5')],'transferercontext':_0x47fe1b[_0x5c70('0x6')],'transfererexten':_0x47fe1b[_0x5c70('0x7')],'transfererlinkedid':_0x47fe1b[_0x5c70('0x8')],'transfereechannel':_0x47fe1b['transfereechannel'],'transfereecalleridnum':_0x47fe1b[_0x5c70('0x9')],'transfereecalleridname':_0x47fe1b[_0x5c70('0xa')],'transfereeconnectedlinenum':_0x47fe1b[_0x5c70('0xb')],'transfereeconnectedlinename':_0x47fe1b[_0x5c70('0xc')],'transfereeaccountcode':_0x47fe1b[_0x5c70('0xd')],'transfereecontext':_0x47fe1b[_0x5c70('0xe')],'transfereeexten':_0x47fe1b[_0x5c70('0xf')],'transfereelinkedid':_0x47fe1b[_0x5c70('0x10')],'isexternal':_0x47fe1b[_0x5c70('0x11')],'context':_0x47fe1b['context'],'extension':_0x47fe1b[_0x5c70('0x12')],'type':_0x5c70('0x13')},'log':_0x5c70('0x14')});};exports[_0x5c70('0x15')]=function(_0x30aa83){return client['Request'](_0x5c70('0x14'),{'body':{'result':_0x30aa83[_0x5c70('0x16')],'transfererchannel':_0x30aa83[_0x5c70('0x17')],'transferercalleridnum':_0x30aa83['origtransferercalleridnum'],'transferercalleridname':_0x30aa83[_0x5c70('0x18')],'transfererconnectedlinenum':_0x30aa83[_0x5c70('0x19')],'transfererconnectedlinename':_0x30aa83[_0x5c70('0x1a')],'transfereraccountcode':_0x30aa83[_0x5c70('0x1b')],'transferercontext':_0x30aa83[_0x5c70('0x1c')],'transfererexten':_0x30aa83[_0x5c70('0x1d')],'transfererlinkedid':_0x30aa83[_0x5c70('0x1e')],'transfereechannel':_0x30aa83[_0x5c70('0x1f')],'transfereecalleridnum':_0x30aa83[_0x5c70('0x20')],'transfereecalleridname':_0x30aa83[_0x5c70('0x21')],'transfereeconnectedlinenum':_0x30aa83[_0x5c70('0x22')],'transfereeconnectedlinename':_0x30aa83[_0x5c70('0x23')],'transfereeaccountcode':_0x30aa83[_0x5c70('0x24')],'transfereecontext':_0x30aa83['transfertargetcontext'],'transfereeexten':_0x30aa83[_0x5c70('0x25')],'transfereelinkedid':_0x30aa83[_0x5c70('0x26')],'isexternal':_0x30aa83['isexternal'],'context':_0x30aa83[_0x5c70('0x27')],'extension':_0x30aa83['origtransfererexten'],'type':_0x5c70('0x28')},'log':_0x5c70('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index e11fd65..8dc21e5 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x1f7ecb,_0x59a15d){var _0x44a849=function(_0x371f96){while(--_0x371f96){_0x1f7ecb['push'](_0x1f7ecb['shift']());}};_0x44a849(++_0x59a15d);}(_0xb10b,0x12a));var _0xbb10=function(_0x3f94f9,_0x42774b){_0x3f94f9=_0x3f94f9-0x0;var _0x46f84f=_0xb10b[_0x3f94f9];return _0x46f84f;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x37ab39,_0x1d1c8d){var _0x336f6f=function(_0x589953){while(--_0x589953){_0x37ab39['push'](_0x37ab39['shift']());}};_0x336f6f(++_0x1d1c8d);}(_0x7a54,0x106));var _0x47a5=function(_0x3f7d2f,_0x41899c){_0x3f7d2f=_0x3f7d2f-0x0;var _0x1ec6ee=_0x7a54[_0x3f7d2f];return _0x1ec6ee;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 5014b74..c2231da 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 _0x463f=['uniqueid','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','trigger:%s','action','merge','length','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','localhost','info','[CM][%s][%s]','stringify','exec','data1','data2','isNil','data5','xmd-contactid','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','mobile','fax','ListId','createdAt','updatedAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x463f,0x164));var _0xf463=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x463f[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xf463('0x0'));var BPromise=require(_0xf463('0x1'));var Redis=require(_0xf463('0x2'));var util=require(_0xf463('0x3'));var config=require(_0xf463('0x4'));var logger=require(_0xf463('0x5'))(_0xf463('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0xf463('0x7')]=_['defaults'](config[_0xf463('0x7')],{'host':_0xf463('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x373558,_0x3b245d,_0x59f98e,_0x4f13d4,_0x3fc6f1){logger[_0xf463('0x9')](_0xf463('0xa'),_0x373558,_0x3b245d['id'],_0x59f98e,_0x4f13d4,JSON[_0xf463('0xb')](_0x3fc6f1));io['to'](_0x59f98e)['emit'](_0x4f13d4,_0x3fc6f1);}exports[_0xf463('0xc')]=function(_0x53dbc1,_0x11673c,_0x5b6b69,_0x18abc9){var _0x184d8a,_0x124ffc;var _0x453219={};var _0x9f6b1a;var _0x21b934=Number(_0x5b6b69[_0xf463('0xd')]);var _0x163987=_0x5b6b69[_0xf463('0xe')]?Boolean(Number(_0x5b6b69['data2'])):![];var _0x30b96f;var _0x41abfb=![];if(!_[_0xf463('0xf')](_0x5b6b69[_0xf463('0x10')])){if(_0x5b6b69[_0xf463('0x10')]=='1')_0x41abfb=!![];}if(!_0x41abfb){if(_0x18abc9[_0xf463('0x11')]){_0x453219['id']=_0x18abc9[_0xf463('0x11')];}}if(!_0x453219['id']){_0x453219['ListId']=_0x21b934;_0x30b96f=_0x5b6b69[_0xf463('0x12')]&&_0x5b6b69['data3']!=='0'?_0x5b6b69[_0xf463('0x12')][_0xf463('0x13')](','):[_0xf463('0x14')];_0x453219[_0xf463('0x15')]=_['map'](_0x30b96f,function(_0x2da790){var _0x2dd64b={};_0x2dd64b[_0x2da790]=_0x18abc9[_0xf463('0x16')]?_0x18abc9[_0xf463('0x17')]:_0x18abc9['calleridnum'];return _0x2dd64b;});_0x9f6b1a=_0x18abc9[_0xf463('0x16')]?_0x18abc9['destcalleridnum']:_0x18abc9[_0xf463('0x18')];}var _0x4e9cb9=['id','firstName','lastName',_0xf463('0x14'),_0xf463('0x19'),_0xf463('0x1a'),_0xf463('0x1b'),_0xf463('0x1c'),'scheduledAt',_0xf463('0x1d')];var _0x38e201=_[_0xf463('0x1e')](_0x4e9cb9,_0x30b96f);BPromise[_0xf463('0x1f')]()[_0xf463('0x20')](cmContactRpc[_0xf463('0x21')]({'attributes':_0x38e201,'where':_0x453219,'phone':_0x9f6b1a}))[_0xf463('0x20')](function(_0x3b0e4d){_0x124ffc=_0x3b0e4d;if(!_[_0xf463('0x22')](_0x124ffc)){if(_0x124ffc['length']===0x1){_0x184d8a=_0x124ffc[0x0];logger[_0xf463('0x9')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x18abc9['uniqueid'],_0x11673c['id'],_0x184d8a['id']);}else{logger[_0xf463('0x9')](_0xf463('0x23'),_0x18abc9[_0xf463('0x24')],_0x11673c['id'],_[_0xf463('0x25')](_0x124ffc,'id')[_0xf463('0x26')](','));}return;}else{logger[_0xf463('0x9')](_0xf463('0x27'),_0x18abc9[_0xf463('0x24')],_0x11673c['id']);var _0x7c0e76={'ListId':_0x21b934};var _0x45ff97=_0x5b6b69[_0xf463('0x28')]&&_0x5b6b69[_0xf463('0x28')]!=='0'?_0x5b6b69[_0xf463('0x28')]:_0xf463('0x14');if(_0x163987){logger['info'](_0xf463('0x29'),_0x18abc9[_0xf463('0x24')],_0x11673c['id']);_0x7c0e76[_0x45ff97]=_[_0xf463('0xf')](_0x18abc9[_0xf463('0x16')])?_0x18abc9[_0xf463('0x18')]:_0x18abc9[_0xf463('0x17')];if(_[_0xf463('0xf')](_0x18abc9[_0xf463('0x16')])){_0x7c0e76[_0xf463('0x2a')]=_0x18abc9[_0xf463('0x2b')]&&_0x18abc9[_0xf463('0x2b')]!==_0xf463('0x2c')?_0x18abc9[_0xf463('0x2b')]:_0xf463('0x2d');}else{_0x7c0e76[_0xf463('0x2a')]=_0x18abc9['destcalleridname']&&_0x18abc9[_0xf463('0x2e')]!==_0xf463('0x2c')?_0x18abc9[_0xf463('0x2e')]:_0xf463('0x2d');}return BPromise[_0xf463('0x1f')]()['then'](cmContactRpc[_0xf463('0x2f')](_0x7c0e76))[_0xf463('0x20')](function(_0x3fdaca){_0x184d8a=_0x3fdaca;_0x124ffc[_0xf463('0x30')](_0x3fdaca);if(_0x184d8a){logger[_0xf463('0x9')](_0xf463('0x31'),_0x18abc9['uniqueid'],_0x11673c['id'],_0x184d8a['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x18abc9[_0xf463('0x24')],_0x11673c['id']);_0x7c0e76[_0x45ff97]=_[_0xf463('0xf')](_0x18abc9[_0xf463('0x16')])?_0x18abc9['calleridnum']:_0x18abc9[_0xf463('0x17')];if(_[_0xf463('0xf')](_0x18abc9['routeId'])){_0x7c0e76['firstName']=_0x18abc9[_0xf463('0x2b')]&&_0x18abc9[_0xf463('0x2b')]!==_0xf463('0x2c')?_0x18abc9['calleridname']:_0xf463('0x2d');}else{_0x7c0e76[_0xf463('0x2a')]=_0x18abc9[_0xf463('0x2e')]&&_0x18abc9[_0xf463('0x2e')]!==_0xf463('0x2c')?_0x18abc9[_0xf463('0x2e')]:_0xf463('0x2d');}_0x184d8a=_0x7c0e76;_0x124ffc['push'](_0x7c0e76);return;}}})[_0xf463('0x20')](function(){if(_0x53dbc1){emit(_0x18abc9[_0xf463('0x24')],_0x11673c,util[_0xf463('0x32')](_0xf463('0x33'),_0x53dbc1['name']),util['format'](_0xf463('0x34'),_0x5b6b69[_0xf463('0x35')]['toLowerCase']()),{'evt':_[_0xf463('0x36')](_0x18abc9,{'autoCreate':_0x163987}),'contact':_0x184d8a===undefined?{}:_0x184d8a,'contacts':_0x124ffc[_0xf463('0x37')]===0x0?undefined:_0x124ffc});}});}; \ No newline at end of file +var _0x068f=['updatedAt','union','resolve','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','Unknown','destcalleridname','then','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','trigger:%s','toLowerCase','merge','lodash','bluebird','ioredis','../../../../config/logger','trigger','../../rpc/cmContact','redis','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data2','isNil','data5','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x068f,0x1a1));var _0xf068=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x068f[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xf068('0x0'));var BPromise=require(_0xf068('0x1'));var Redis=require(_0xf068('0x2'));var util=require('util');var config=require('../../../../config/environment');var logger=require(_0xf068('0x3'))(_0xf068('0x4'));var cmContactRpc=require(_0xf068('0x5'));config[_0xf068('0x6')]=_['defaults'](config[_0xf068('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xf068('0x7'))(new Redis(config[_0xf068('0x6')]));function emit(_0x448304,_0x1f6fd9,_0x30af6e,_0x8432fa,_0x4a092e){logger[_0xf068('0x8')](_0xf068('0x9'),_0x448304,_0x1f6fd9['id'],_0x30af6e,_0x8432fa,JSON[_0xf068('0xa')](_0x4a092e));io['to'](_0x30af6e)[_0xf068('0xb')](_0x8432fa,_0x4a092e);}exports[_0xf068('0xc')]=function(_0x580395,_0x11c1a8,_0x29f402,_0x294be7){var _0x3c4522,_0x22c863;var _0x277a8f={};var _0x355a5b;var _0x2738c4=Number(_0x29f402['data1']);var _0x4be9ea=_0x29f402[_0xf068('0xd')]?Boolean(Number(_0x29f402[_0xf068('0xd')])):![];var _0x2db787;var _0x1ce3ff=![];if(!_[_0xf068('0xe')](_0x29f402[_0xf068('0xf')])){if(_0x29f402[_0xf068('0xf')]=='1')_0x1ce3ff=!![];}if(!_0x1ce3ff){if(_0x294be7['xmd-contactid']){_0x277a8f['id']=_0x294be7['xmd-contactid'];}}if(!_0x277a8f['id']){_0x277a8f[_0xf068('0x10')]=_0x2738c4;_0x2db787=_0x29f402[_0xf068('0x11')]&&_0x29f402[_0xf068('0x11')]!=='0'?_0x29f402[_0xf068('0x11')][_0xf068('0x12')](','):[_0xf068('0x13')];_0x277a8f[_0xf068('0x14')]=_[_0xf068('0x15')](_0x2db787,function(_0x44f303){var _0x2fbc6a={};_0x2fbc6a[_0x44f303]=_0x294be7[_0xf068('0x16')]?_0x294be7[_0xf068('0x17')]:_0x294be7[_0xf068('0x18')];return _0x2fbc6a;});_0x355a5b=_0x294be7['routeId']?_0x294be7[_0xf068('0x17')]:_0x294be7[_0xf068('0x18')];}var _0x1527ea=['id',_0xf068('0x19'),_0xf068('0x1a'),'phone',_0xf068('0x1b'),_0xf068('0x1c'),'ListId',_0xf068('0x1d'),_0xf068('0x1e'),_0xf068('0x1f')];var _0x3a6a51=_[_0xf068('0x20')](_0x1527ea,_0x2db787);BPromise[_0xf068('0x21')]()['then'](cmContactRpc[_0xf068('0x22')]({'attributes':_0x3a6a51,'where':_0x277a8f,'phone':_0x355a5b}))['then'](function(_0x65e71e){_0x22c863=_0x65e71e;if(!_[_0xf068('0x23')](_0x22c863)){if(_0x22c863[_0xf068('0x24')]===0x1){_0x3c4522=_0x22c863[0x0];logger[_0xf068('0x8')](_0xf068('0x25'),_0x294be7[_0xf068('0x26')],_0x11c1a8['id'],_0x3c4522['id']);}else{logger[_0xf068('0x8')](_0xf068('0x27'),_0x294be7[_0xf068('0x26')],_0x11c1a8['id'],_[_0xf068('0x15')](_0x22c863,'id')[_0xf068('0x28')](','));}return;}else{logger[_0xf068('0x8')](_0xf068('0x29'),_0x294be7[_0xf068('0x26')],_0x11c1a8['id']);var _0x97ddc5={'ListId':_0x2738c4};var _0x33c567=_0x29f402[_0xf068('0x2a')]&&_0x29f402[_0xf068('0x2a')]!=='0'?_0x29f402[_0xf068('0x2a')]:'phone';if(_0x4be9ea){logger[_0xf068('0x8')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x294be7[_0xf068('0x26')],_0x11c1a8['id']);_0x97ddc5[_0x33c567]=_[_0xf068('0xe')](_0x294be7[_0xf068('0x16')])?_0x294be7[_0xf068('0x18')]:_0x294be7[_0xf068('0x17')];if(_[_0xf068('0xe')](_0x294be7[_0xf068('0x16')])){_0x97ddc5['firstName']=_0x294be7[_0xf068('0x2b')]&&_0x294be7[_0xf068('0x2b')]!==_0xf068('0x2c')?_0x294be7[_0xf068('0x2b')]:_0xf068('0x2d');}else{_0x97ddc5['firstName']=_0x294be7[_0xf068('0x2e')]&&_0x294be7[_0xf068('0x2e')]!==''?_0x294be7[_0xf068('0x2e')]:'Unknown';}return BPromise['resolve']()[_0xf068('0x2f')](cmContactRpc[_0xf068('0x30')](_0x97ddc5))[_0xf068('0x2f')](function(_0x6da125){_0x3c4522=_0x6da125;_0x22c863[_0xf068('0x31')](_0x6da125);if(_0x3c4522){logger[_0xf068('0x8')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x294be7[_0xf068('0x26')],_0x11c1a8['id'],_0x3c4522['id']);}return;});}else{logger[_0xf068('0x8')](_0xf068('0x32'),_0x294be7[_0xf068('0x26')],_0x11c1a8['id']);_0x97ddc5[_0x33c567]=_['isNil'](_0x294be7[_0xf068('0x16')])?_0x294be7[_0xf068('0x18')]:_0x294be7[_0xf068('0x17')];if(_[_0xf068('0xe')](_0x294be7[_0xf068('0x16')])){_0x97ddc5['firstName']=_0x294be7[_0xf068('0x2b')]&&_0x294be7[_0xf068('0x2b')]!==_0xf068('0x2c')?_0x294be7[_0xf068('0x2b')]:_0xf068('0x2d');}else{_0x97ddc5[_0xf068('0x19')]=_0x294be7[_0xf068('0x2e')]&&_0x294be7[_0xf068('0x2e')]!==_0xf068('0x2c')?_0x294be7[_0xf068('0x2e')]:_0xf068('0x2d');}_0x3c4522=_0x97ddc5;_0x22c863[_0xf068('0x31')](_0x97ddc5);return;}}})[_0xf068('0x2f')](function(){if(_0x580395){emit(_0x294be7[_0xf068('0x26')],_0x11c1a8,util[_0xf068('0x33')](_0xf068('0x34'),_0x580395['name']),util['format'](_0xf068('0x35'),_0x29f402['action'][_0xf068('0x36')]()),{'evt':_[_0xf068('0x37')](_0x294be7,{'autoCreate':_0x4be9ea}),'contact':_0x3c4522===undefined?{}:_0x3c4522,'contacts':_0x22c863[_0xf068('0x24')]===0x0?undefined:_0x22c863});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 4eabe1d..233ef84 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 _0x974c=['custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','stringify','motionChannel','voice','debug','checkTriggers','interface','hasOwnProperty','checkTrigger','merge','variables','Actions','length','action','toLowerCase','motionbar','browser','data1','TemplateId','data2','html','template\x20not\x20found','data3','isNil','data4','location','uriLocation','windowWidth','800','data5','windowHeight','data6','600','winApplication','render','format','trigger:%s:%s','jscripty','user:%s','trigger:%s','contactmanager','exec','integration','routeId','script','parse','query','AllConditions','checkConditions','channel','evt','inspect','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','event','queue','membername','lastevent','mailSubstatus','null','substatus','created','equals','exports','util','lodash','url','mustache','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','trigger','redis','defaults','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentreject','custom:amd','custom:queuecallerabandon'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x974c,0xd4));var _0xc974=function(_0x14b60a,_0x2538cf){_0x14b60a=_0x14b60a-0x0;var _0x3390b4=_0x974c[_0x14b60a];return _0x3390b4;};'use strict';var util=require(_0xc974('0x0'));var _=require(_0xc974('0x1'));var url=require(_0xc974('0x2'));var Mustache=require(_0xc974('0x3'));var Redis=require('ioredis');var urlforward=require(_0xc974('0x4'));var integration=require(_0xc974('0x5'));var cmContact=require(_0xc974('0x6'));var script=require('./script');var config=require(_0xc974('0x7'));var logger=require(_0xc974('0x8'))(_0xc974('0x9'));var ami=require('../ami');config[_0xc974('0xa')]=_[_0xc974('0xb')](config[_0xc974('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xc974('0xc'))(new Redis(config[_0xc974('0xa')]));var operators={'equals':function(_0x283a60,_0x51ab1a){return _0x283a60==_0x51ab1a;},'not_equals':function(_0x4240de,_0x415e16){return _0x4240de!=_0x415e16;}};var barAndWebActions=[_0xc974('0xd'),_0xc974('0x2'),_0xc974('0xe')];function Trigger(_0x21c5dc){this[_0xc974('0xf')]=_0x21c5dc[_0xc974('0xf')];this['agents']=_0x21c5dc[_0xc974('0x10')];this[_0xc974('0x11')]=_0x21c5dc['voiceQueues'];this['templates']=_0x21c5dc[_0xc974('0x12')];this['voiceExtensions']=_0x21c5dc[_0xc974('0x13')];this[_0xc974('0x14')]=_0x21c5dc[_0xc974('0x14')];this[_0xc974('0x15')]=_0x21c5dc['freshdeskAccounts'];this[_0xc974('0x16')]=_0x21c5dc[_0xc974('0x16')];this['sugarcrmAccounts']=_0x21c5dc[_0xc974('0x17')];this[_0xc974('0x18')]=_0x21c5dc[_0xc974('0x18')];this[_0xc974('0x19')]=_0x21c5dc[_0xc974('0x19')];this[_0xc974('0x1a')]=_0x21c5dc[_0xc974('0x1a')];this[_0xc974('0x1b')]=_0x21c5dc[_0xc974('0x1b')];this[_0xc974('0x1c')]=_0x21c5dc[_0xc974('0x1c')];this[_0xc974('0x1d')]=_0x21c5dc['freshsalesAccounts'];this[_0xc974('0x1e')]={'zendesk':this[_0xc974('0x14')],'salesforce':this[_0xc974('0x16')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0xc974('0x17')],'zoho':this[_0xc974('0x18')],'desk':this[_0xc974('0x19')],'vtiger':this[_0xc974('0x1a')],'dynamics365':this[_0xc974('0x1c')],'freshsales':this[_0xc974('0x1d')],'servicenow':this[_0xc974('0x1b')]};ami['on'](_0xc974('0x1f'),this[_0xc974('0x20')][_0xc974('0x21')](this));ami['on'](_0xc974('0x22'),this[_0xc974('0x20')]['bind'](this));ami['on'](_0xc974('0x23'),this[_0xc974('0x20')][_0xc974('0x21')](this));ami['on'](_0xc974('0x24'),this[_0xc974('0x20')][_0xc974('0x21')](this));ami['on'](_0xc974('0x25'),this[_0xc974('0x20')][_0xc974('0x21')](this));ami['on'](_0xc974('0x26'),this[_0xc974('0x20')][_0xc974('0x21')](this));ami['on']('custom:agentbusy',this['syncCustomEvent']['bind'](this));ami['on']('custom:agentcongestion',this[_0xc974('0x20')][_0xc974('0x21')](this));ami['on'](_0xc974('0x27'),this[_0xc974('0x20')]['bind'](this));ami['on'](_0xc974('0x28'),this[_0xc974('0x20')][_0xc974('0x21')](this));ami['on'](_0xc974('0x29'),this[_0xc974('0x20')][_0xc974('0x21')](this));ami['on'](_0xc974('0x2a'),this[_0xc974('0x20')][_0xc974('0x21')](this));ami['on'](_0xc974('0x2b'),this[_0xc974('0x2c')][_0xc974('0x21')](this));ami['on'](_0xc974('0x2d'),this[_0xc974('0x2c')][_0xc974('0x21')](this));ami['on'](_0xc974('0x2e'),this['syncAgentDial']['bind'](this));ami['on'](_0xc974('0x2f'),this[_0xc974('0x20')][_0xc974('0x21')](this));ami['on'](_0xc974('0x30'),this[_0xc974('0x20')]['bind'](this));ami['on'](_0xc974('0x31'),this[_0xc974('0x20')][_0xc974('0x21')](this));ami['on'](_0xc974('0x32'),this['syncCustomEvent'][_0xc974('0x21')](this));ami['on'](_0xc974('0x33'),this['syncCustomEvent'][_0xc974('0x21')](this));ami['on'](_0xc974('0x34'),this[_0xc974('0x20')][_0xc974('0x21')](this));ami['on'](_0xc974('0x35'),this[_0xc974('0x20')][_0xc974('0x21')](this));ami['on'](_0xc974('0x36'),this[_0xc974('0x20')][_0xc974('0x21')](this));}Trigger[_0xc974('0x37')][_0xc974('0x38')]=function(_0x467e6d,_0x29f005,_0x79f1bb){logger[_0xc974('0x39')](_0x467e6d,_0x29f005,JSON[_0xc974('0x3a')](_0x79f1bb));io['to'](_0x467e6d)[_0xc974('0x38')](_0x29f005,_0x79f1bb);};Trigger[_0xc974('0x37')]['syncCustomEvent']=function(_0x20c6e0){var _0x1ab578=_['clone'](_0x20c6e0);if(typeof _0x1ab578[_0xc974('0x3b')]==='undefined'){_0x1ab578[_0xc974('0x3b')]=_0xc974('0x3c');}logger[_0xc974('0x3d')](_0xc974('0x20'),util['inspect'](_0x1ab578,{'showHidden':!![],'depth':null}));this[_0xc974('0x3e')](_0x1ab578);};Trigger[_0xc974('0x37')][_0xc974('0x2c')]=function(_0x2a5ae5){if(this[_0xc974('0x10')][_0x2a5ae5[_0xc974('0x3f')]]){this[_0xc974('0x20')](_0x2a5ae5);}};Trigger['prototype']['checkTriggers']=function(_0x18c5e1){var _0x504e89;for(var _0x9b405e in this[_0xc974('0xf')]){if(this[_0xc974('0xf')][_0xc974('0x40')](_0x9b405e)){if(this[_0xc974('0xf')][_0x9b405e]['status']){_0x504e89=this[_0xc974('0x41')](this[_0xc974('0xf')][_0x9b405e],_0x18c5e1);if(_0x504e89){_[_0xc974('0x42')](_0x18c5e1,_0x18c5e1[_0xc974('0x43')]);for(var _0x377442=0x0,_0xec79ab,_0x23f22e,_0xb14b21;_0x3774420x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file +var _0x326f=['catch','stringify','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','validateEmail','info','Getting\x20agent\x20with\x20email','%s/users','then','total_entries','_embedded','entries','Agent\x20found!','format','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','debug','[HTTP]','GET','authType','basic','password','%s/token:%s','Basic\x20%s','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','work','map','length','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','toString','variable','variableName','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','xCALLY','concat','Descriptions','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','integrationTab','%s/agent/tickets/%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x326f,0xd1));var _0xf326=function(_0x13a30f,_0x42287e){_0x13a30f=_0x13a30f-0x0;var _0x5ccd2d=_0x326f[_0x13a30f];return _0x5ccd2d;};'use strict';var _=require(_0xf326('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xf326('0x1'));var Redis=require(_0xf326('0x2'));var intUtil=require(_0xf326('0x3'));var config=require(_0xf326('0x4'));var logger=require(_0xf326('0x5'))(_0xf326('0x6'));config[_0xf326('0x7')]=_[_0xf326('0x8')](config[_0xf326('0x7')],{'host':_0xf326('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf326('0x7')]));function emit(_0x3851eb,_0x165f95,_0x1e7b8a){io['to'](_0x3851eb)['emit'](_0x165f95,_0x1e7b8a);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x3bacf2,_0x1fc80e){if(intUtil[_0xf326('0xa')](_0x1fc80e)===!![]){logger[_0xf326('0xb')](_0xf326('0xc'),_0x1fc80e);return request({'uri':util['format'](_0xf326('0xd'),_0x3bacf2['remoteUri'])})[_0xf326('0xe')](function(_0x4aaf3a){if(_0x4aaf3a[_0xf326('0xf')]){return _['find'](_0x4aaf3a[_0xf326('0x10')][_0xf326('0x11')],{'email':_0x1fc80e});}})['then'](function(_0x342fe5){if(_0x342fe5){logger[_0xf326('0xb')](_0xf326('0x12'));return _0x342fe5;}else{logger[_0xf326('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf326('0x13')]('%s/users/me',_0x3bacf2['remoteUri'])});}});}else{logger[_0xf326('0xb')](_0xf326('0x14'));return request({'uri':util[_0xf326('0x13')](_0xf326('0x15'),_0x3bacf2[_0xf326('0x16')])});}}function request(_0x287a2a){logger[_0xf326('0x17')](_0xf326('0x18'),JSON['stringify'](_0x287a2a));return rp(_[_0xf326('0x8')](_0x287a2a,{'method':_0xf326('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x18bee3){var _0x31ffb9;if(_0x18bee3[_0xf326('0x1a')]===_0xf326('0x1b')){_0x31ffb9=util['format']('%s:%s',_0x18bee3['username'],_0x18bee3[_0xf326('0x1c')]);}else if(_0x18bee3[_0xf326('0x1a')]==='token'){_0x31ffb9=util['format'](_0xf326('0x1d'),_0x18bee3['username'],_0x18bee3['token']);}return util[_0xf326('0x13')](_0xf326('0x1e'),new Buffer(_0x31ffb9)['toString']('base64'));}function getEndUser(_0x19b8ba,_0xb1efcf,_0x5f21a2){logger[_0xf326('0xb')](_0xf326('0x1f'),_0x5f21a2);return request({'uri':util[_0xf326('0x13')](_0xf326('0x20'),_0x19b8ba[_0xf326('0x16')]),'qs':{'phone':_0x5f21a2}})[_0xf326('0xe')](function(_0x5ce532){if(_0x5ce532['total_entries']){logger['info'](_0xf326('0x21'));return _0x5ce532[_0xf326('0x10')][_0xf326('0x11')][0x0];}else{logger[_0xf326('0xb')](_0xf326('0x22'));return request({'uri':util[_0xf326('0x13')]('%s/customers',_0x19b8ba[_0xf326('0x16')]),'method':_0xf326('0x23'),'body':{'first_name':_0xb1efcf,'title':_0xb1efcf,'phone_numbers':[{'type':_0xf326('0x24'),'value':_0x5f21a2}]}});}});}function getTags(_0x581531,_0x1617d2){var _0x55ad0f=[];if(_0x581531&&_0x581531['length']>0x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ 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 be16d73..81f0708 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 _0x71d7=['md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','data2','data5','POST','clientId','password','clientSecret','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','userId','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','outbound','telephone1','replace','%2b','value','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','includes','string','picklist','customField','idField','indexOf','content','incident','getString','Subjects','Descriptions','Fields','ticketType','phonecall','queue','/contacts(','callDirection','phonecalls','assign','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','data7','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','error','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util'];(function(_0x12a201,_0x30aaba){var _0x52a4d2=function(_0x5ca28d){while(--_0x5ca28d){_0x12a201['push'](_0x12a201['shift']());}};_0x52a4d2(++_0x30aaba);}(_0x71d7,0x1c0));var _0x771d=function(_0x28f75a,_0x477ec3){_0x28f75a=_0x28f75a-0x0;var _0x186ce0=_0x71d7[_0x28f75a];return _0x186ce0;};'use strict';var _=require(_0x771d('0x0'));var rp=require(_0x771d('0x1'));var util=require(_0x771d('0x2'));var intUtil=require(_0x771d('0x3'));var md5=require(_0x771d('0x4'));var Redis=require(_0x771d('0x5'));var logger=require(_0x771d('0x6'))(_0x771d('0x7'));var config=require(_0x771d('0x8'));config[_0x771d('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x771d('0xa'))(new Redis(config[_0x771d('0x9')]));function getAuthToken(_0x3ad783,_0x3675d9,_0x12ae78){if(_0x3ad783[_0x771d('0xb')]){_0x3ad783[_0x771d('0xc')]=_0x3ad783[_0x771d('0xd')]['data7'];_0x3ad783[_0x771d('0xe')]=_0x3ad783[_0x771d('0xd')][_0x771d('0xf')];return Promise['resolve'](_0x3ad783['CloudProvider'][_0x771d('0x10')]);}var _0xecaab5={'method':_0x771d('0x11'),'uri':_0x3675d9,'form':{'client_id':_0x3ad783[_0x771d('0x12')],'resource':_0x3ad783[_0x771d('0xc')],'username':_0x3ad783['username'],'password':_0x3ad783[_0x771d('0x13')],'grant_type':'password','client_secret':_0x3ad783[_0x771d('0x14')]},'json':!![]};return rp(_0xecaab5)[_0x771d('0x15')](function(_0x144919){return _0x144919[_0x771d('0x16')];})[_0x771d('0x17')](function(_0x22747c){logger['error']('['+[_0x12ae78[_0x771d('0x18')]()]+_0x771d('0x19'));return _0x22747c[_0x771d('0x1a')];});}function getUser(_0x5be31,_0x1e55cc,_0x50d8dd,_0x23abef,_0x55f936,_0x2f1b30){return new Promise(function(_0x51d79f,_0x11b641){return getAuthToken(_0x1e55cc,_0x23abef,_0x2f1b30)[_0x771d('0x15')](function(_0x242ebd){var _0x4f8e51={'method':_0x771d('0x1b'),'uri':_0x55f936+_0x771d('0x1c'),'headers':{'Authorization':_0x771d('0x1d')+_0x242ebd,'OData-Version':_0x771d('0x1e')},'json':!![]};return rp(_0x4f8e51);})[_0x771d('0x15')](function(_0x2a68b3){var _0x20d7ce=_0x2a68b3['value'];var _0x49d262=![];var _0x4193a7=null;if(!_[_0x771d('0x1f')](_0x50d8dd)){if(intUtil[_0x771d('0x20')](_0x50d8dd[_0x771d('0x21')])){_0x5be31[_0x771d('0x22')]=_0x50d8dd[_0x771d('0x21')];for(_0x4193a7=0x0;_0x4193a7<_0x20d7ce[_0x771d('0x23')];_0x4193a7++){if(_0x20d7ce[_0x4193a7][_0x771d('0x24')]===_0x50d8dd['email']&&!_0x20d7ce[_0x4193a7][_0x771d('0x25')]){_0x49d262=!![];logger[_0x771d('0x26')]('['+[_0x2f1b30['toUpperCase']()]+_0x771d('0x27')+_0x20d7ce[_0x4193a7][_0x771d('0x28')]+'!');_0x5be31['userId']=_0x20d7ce[_0x4193a7][_0x771d('0x28')];}}}}if(!_0x49d262){logger['info']('['+[_0x2f1b30[_0x771d('0x18')]()]+_0x771d('0x29'));_0x5be31[_0x771d('0x22')]=_0x1e55cc[_0x771d('0x2a')];for(_0x4193a7=0x0;_0x4193a7<_0x20d7ce[_0x771d('0x23')];_0x4193a7++){if(_0x20d7ce[_0x4193a7][_0x771d('0x24')]===_0x1e55cc['username']){_0x5be31[_0x771d('0x2b')]=_0x20d7ce[_0x4193a7]['systemuserid'];}}}_0x51d79f(_0x5be31);})['catch'](function(_0x5bf766){_0x11b641(_0x5bf766[_0x771d('0x1a')]);});});}function createEndUser(_0x550b41,_0x27ba7b,_0x571aee,_0x462362,_0x4ed6f4,_0x3a9491,_0x467930){return new Promise(function(_0x275de5,_0xfbb5eb){return getAuthToken(_0x27ba7b,_0x571aee,_0x3a9491)[_0x771d('0x15')](function(_0x2a6d2b){var _0x2848e8=_0x3a9491[_0x771d('0x2c')]()==='outbound'?_0x4ed6f4[_0x771d('0x2d')]:_0x4ed6f4[_0x771d('0x2e')];var _0x252e39={'method':_0x771d('0x11'),'uri':_0x462362+_0x771d('0x2f'),'body':{'fullname':_0x2848e8,'firstname':_0x2848e8,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x771d('0x30')+_0x550b41[_0x771d('0x2b')]+')'},'headers':{'Authorization':_0x771d('0x1d')+_0x2a6d2b,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x252e39[_0x771d('0x31')][_0x467930]=_0x2848e8;return rp(_0x252e39);})['then'](function(_0x305a09){var _0x325edc=_0x305a09[_0x771d('0x32')][_0x771d('0x33')];var _0x1f9151=_0x325edc[_0x771d('0x34')](_0x325edc[_0x771d('0x35')]('(')+0x1,_0x325edc[_0x771d('0x35')](')'));_0x550b41[_0x771d('0x36')]=_0x1f9151;_0x275de5(_0x550b41);})[_0x771d('0x17')](function(_0x298273){_0xfbb5eb(_0x298273['message']);});});}function getEndUser(_0x33a412,_0x4343e6,_0xc9d259,_0x271b02,_0x7bac76,_0x351782,_0x123dda,_0x591d0e){var _0x265fe9=_0x351782['toLowerCase']()===_0x771d('0x37')?_0x7bac76['destcalleridnum']:_0x7bac76[_0x771d('0x2e')];return getAuthToken(_0x4343e6,_0xc9d259,_0x351782)[_0x771d('0x15')](function(_0x538e7e){_0x591d0e=_0x591d0e?_0x591d0e:_0x771d('0x38');var _0x192a9f={'method':_0x771d('0x1b'),'uri':_0x271b02+'contacts?$select='+_0x591d0e+'&$filter='+_0x591d0e+'\x20eq\x20\x27'+_0x265fe9[_0x771d('0x39')]('+',_0x771d('0x3a'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x538e7e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x192a9f);})['then'](function(_0x4f0b4c){var _0x52d27b=![];if(!_0x4f0b4c)return _0x52d27b;var _0x180361=_0x4f0b4c[_0x771d('0x3b')];for(var _0x1b13a0=0x0;_0x1b13a0<_0x180361[_0x771d('0x23')];_0x1b13a0++){if(_0x180361[_0x1b13a0][_0x591d0e]===_0x265fe9){_0x52d27b=!![];_0x33a412[_0x771d('0x36')]=_0x180361[_0x1b13a0]['contactid'];}}return _0x52d27b;})['then'](function(_0x4ed8c9){if(_0x4ed8c9)return _0x33a412;if(_0x123dda===_0x771d('0x3c')){logger[_0x771d('0x26')]('['+[_0x351782[_0x771d('0x18')]()]+_0x771d('0x3d'));return _0x33a412;}return createEndUser(_0x33a412,_0x4343e6,_0xc9d259,_0x271b02,_0x7bac76,_0x351782,_0x591d0e)[_0x771d('0x15')](function(_0x2d3394){logger[_0x771d('0x26')]('['+[_0x351782[_0x771d('0x18')]()]+']\x20Enduser\x20created!',_0x2d3394[_0x771d('0x36')]);return _0x2d3394;});});}function getCustomFields(_0x5276de,_0x30a1e6,_0x2c77e3){var _0x3dbf95={};if(_0x5276de[_0x771d('0x23')]>0x0){_['forEach'](_0x5276de,function(_0xb134aa){if(_[_0x771d('0x3e')]([_0x771d('0x3f'),_0x771d('0x40')],_0xb134aa['type'])&&_0xb134aa['nameField']&&!_0xb134aa[_0x771d('0x41')]){var _0x392635=_0xb134aa[_0x771d('0x42')][_0x771d('0x2c')]();var _0x192971=_0x392635[_0x771d('0x34')](0x0,_0x392635[_0x771d('0x43')]('_'));var _0x2249ea=_0x392635[_0x771d('0x34')](_0x392635[_0x771d('0x43')]('_')+0x1);if(_0x192971===_0x2c77e3){_0x3dbf95[_0x2249ea]=_0xb134aa[_0x771d('0x44')];}}});}return _0x3dbf95;}function getTicket(_0x310074,_0x54d8ab,_0x42b502,_0x4b8aed,_0xde842d,_0x41421b,_0x596d89){return new Promise(function(_0x1b0d49,_0x3218e2){var _0x1d488a;return getAuthToken(_0x54d8ab,_0x42b502,_0x596d89)[_0x771d('0x15')](function(_0x4ec2d8){if(_0x41421b['ticketType']===_0x771d('0x45')){_0x1d488a={'method':_0x771d('0x11'),'uri':_0x4b8aed+'incidents','body':Object['assign']({},{'title':intUtil[_0x771d('0x46')](_0x41421b[_0x771d('0x47')],_0xde842d,'\x20'),'description':intUtil[_0x771d('0x46')](_0x41421b[_0x771d('0x48')],_0xde842d,'\x0a'),'customerid_contact@odata.bind':_0x310074[_0x771d('0x36')]?'/contacts('+_0x310074[_0x771d('0x36')]+')':undefined,'ownerid@odata.bind':_0x771d('0x30')+_0x310074[_0x771d('0x2b')]+')','caseorigincode':'1'},getCustomFields(_0x41421b[_0x771d('0x49')],_0xde842d,_0x41421b[_0x771d('0x4a')])),'headers':{'Authorization':_0x771d('0x1d')+_0x4ec2d8,'OData-Version':_0x771d('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x41421b[_0x771d('0x4a')]===_0x771d('0x4b')){var _0x25f441=_0x310074[_0x771d('0x36')]?[{'partyid_systemuser@odata.bind':_0x771d('0x30')+_0x310074[_0x771d('0x2b')]+')','participationtypemask':_0x310074['callDirection']===_0x771d('0x4c')?0x2:0x1},{'partyid_contact@odata.bind':_0x771d('0x4d')+_0x310074[_0x771d('0x36')]+')','participationtypemask':_0x310074[_0x771d('0x4e')]===_0x771d('0x4c')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x310074['userId']+')','participationtypemask':_0x310074[_0x771d('0x4e')]==='queue'?0x2:0x1}];_0x1d488a={'method':_0x771d('0x11'),'uri':_0x4b8aed+_0x771d('0x4f'),'body':Object[_0x771d('0x50')]({},{'subject':intUtil[_0x771d('0x46')](_0x41421b[_0x771d('0x47')],_0xde842d,'\x20'),'phonenumber':String(_0xde842d[_0x771d('0x2e')]),'description':intUtil[_0x771d('0x46')](_0x41421b['Descriptions'],_0xde842d,'\x0a'),'regardingobjectid_contact@odata.bind':_0x310074[_0x771d('0x36')]?_0x771d('0x4d')+_0x310074[_0x771d('0x36')]+')':undefined,'ownerid@odata.bind':_0x771d('0x30')+_0x310074[_0x771d('0x2b')]+')','directioncode':_0x310074['callDirection']===_0x771d('0x4c')?![]:!![],'phonecall_activity_parties':_0x25f441},getCustomFields(_0x41421b[_0x771d('0x49')],_0xde842d,_0x41421b[_0x771d('0x4a')])),'headers':{'Authorization':'Bearer\x20'+_0x4ec2d8,'OData-Version':_0x771d('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1d488a);})[_0x771d('0x15')](function(_0x1f0908){var _0x571374=_0x1f0908['headers'][_0x771d('0x33')];var _0x2a7bb3=_0x571374[_0x771d('0x34')](_0x571374['lastIndexOf']('(')+0x1,_0x571374[_0x771d('0x35')](')'));_0x310074[_0x771d('0x51')]=_0x2a7bb3;_0x1b0d49(_0x310074);})['catch'](function(_0x5b3da1){_0x3218e2(_0x5b3da1[_0x771d('0x1a')]);});});}function emit(_0x473b64,_0x1f5893,_0x595555,_0x3153b1){var _0x5d7d13={'uri':util['format'](_0x771d('0x52'),_0x473b64,_0x595555,_0x3153b1)};io['to'](util[_0x771d('0x53')](_0x771d('0x54'),_0x1f5893))[_0x771d('0x55')](_0x771d('0x56'),_0x5d7d13);}exports['cs']=function(_0x3aa9ad,_0x21ed15,_0x3f9981,_0x1513f8,_0x41270c,_0x2f2bbc,_0x1833cd,_0xb050f2){var _0x51af97={};_0x2f2bbc[_0x771d('0xc')]=_0x2f2bbc['modernAuthentication']?intUtil['stripTrailingSlash'](_0x2f2bbc[_0x771d('0xd')][_0x771d('0x57')]):intUtil[_0x771d('0x58')](_0x2f2bbc[_0x771d('0xc')]);_0x2f2bbc[_0x771d('0x59')]=intUtil['stripTrailingSlash'](_0x2f2bbc[_0x771d('0x59')]);_0x51af97[_0x771d('0x4e')]=_0xb050f2===_0x771d('0x4c')||_0xb050f2===_0x771d('0x5a')?_0x771d('0x4c'):_0x771d('0x37');var _0x2e06d3=_0x2f2bbc[_0x771d('0xb')]?util[_0x771d('0x53')]('%s/api/data/v9.0/',_0x2f2bbc[_0x771d('0xd')]['data7']):util[_0x771d('0x53')](_0x771d('0x5b'),_0x2f2bbc[_0x771d('0xc')]);var _0x3ef8df=util[_0x771d('0x53')](_0x771d('0x5c'),_0x2f2bbc['tenantId']);var _0x4fe581=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f2bbc[_0x771d('0x59')],_0x21ed15[_0x771d('0x5d')],md5(_0x21ed15['uniqueid']));if(_0x41270c&&_0x41270c[_0x771d('0x5e')]){logger[_0x771d('0x26')](_0x771d('0x5f'),'Recording\x20is\x20enabled!');_0x21ed15['recordingURL']=_0x4fe581;}else if(_0x1833cd&&_0x1833cd['recordingFormat']&&_0x1833cd[_0x771d('0x60')]!==_0x771d('0x61')){logger[_0x771d('0x26')](_0x771d('0x62'),_0x771d('0x63'));_0x21ed15[_0x771d('0x64')]=_0x4fe581;}else{_0x21ed15[_0x771d('0x64')]='';}return getUser(_0x51af97,_0x2f2bbc,_0x1513f8,_0x3ef8df,_0x2e06d3,_0xb050f2)[_0x771d('0x15')](function(_0x2a0b9c){logger['info']('['+_0xb050f2['toUpperCase']()+_0x771d('0x65'),_0x2a0b9c[_0x771d('0x2b')]);logger[_0x771d('0x26')]('['+_0xb050f2[_0x771d('0x18')]()+_0x771d('0x66'),_0x2a0b9c[_0x771d('0x22')]);return getEndUser(_0x2a0b9c,_0x2f2bbc,_0x3ef8df,_0x2e06d3,_0x21ed15,_0xb050f2,_0x3f9981[_0x771d('0x67')],_0x3f9981[_0x771d('0x68')]);})['then'](function(_0x573dbd){logger[_0x771d('0x26')]('['+_0xb050f2[_0x771d('0x18')]()+_0x771d('0x69'),_0x573dbd[_0x771d('0x36')]);logger['info']('['+_0xb050f2['toUpperCase']()+_0x771d('0x6a'),_0x21ed15[_0x771d('0x2e')]);return getTicket(_0x573dbd,_0x2f2bbc,_0x3ef8df,_0x2e06d3,_0x21ed15,_0x3f9981,_0xb050f2);})[_0x771d('0x15')](function(_0x3c55e6){logger['info'](util[_0x771d('0x53')]('['+_0xb050f2[_0x771d('0x18')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x3f9981[_0x771d('0x4a')],_0x3c55e6['ticketId']));logger[_0x771d('0x26')](util['format']('['+_0xb050f2[_0x771d('0x18')]()+_0x771d('0x6b'),_0xb050f2));if(_0xb050f2!==_0x771d('0x5a')&&_0x3f9981[_0x771d('0x6c')]){logger['info']('['+_0xb050f2['toUpperCase']()+']',_0x771d('0x6d'));emit(_0x2f2bbc[_0x771d('0xc')],_0x1513f8['name'],_0x3f9981[_0x771d('0x4a')],_0x3c55e6[_0x771d('0x51')]);}})[_0x771d('0x17')](function(_0x235084){logger['error']('['+_0xb050f2[_0x771d('0x18')]()+_0x771d('0x6e'),_0x235084[_0x771d('0x1a')]);console[_0x771d('0x6f')](_0x771d('0x70'),_0x235084);});}; \ No newline at end of file +var _0x0112=['recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','data2','resolve','data5','clientId','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','4.0','value','validateEmail','userEmail','email','length','isdisabled','info','systemuserid','userId','internalemailaddress','toLowerCase','destcalleridnum','POST','/systemusers(','Bearer\x20','body','headers','odata-entityid','substring','lastIndexOf','enduserId','outbound','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','%2b','contactid','nothing',']\x20Enduser\x20created!','forEach','includes','type','indexOf','content','incident','incidents','assign','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','queue','callDirection','phonecalls','getString','calleridnum','ticketId','format','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','recordingURL'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x0112,0x159));var _0x2011=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x0112[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x2011('0x0'));var rp=require(_0x2011('0x1'));var util=require(_0x2011('0x2'));var intUtil=require(_0x2011('0x3'));var md5=require(_0x2011('0x4'));var Redis=require(_0x2011('0x5'));var logger=require(_0x2011('0x6'))('dynamics365');var config=require(_0x2011('0x7'));config[_0x2011('0x8')]=_[_0x2011('0x9')](config['redis'],{'host':_0x2011('0xa'),'port':0x18eb});var io=require(_0x2011('0xb'))(new Redis(config[_0x2011('0x8')]));function getAuthToken(_0x30ad7b,_0x1bec19,_0x3c8c82){if(_0x30ad7b[_0x2011('0xc')]){_0x30ad7b[_0x2011('0xd')]=_0x30ad7b[_0x2011('0xe')][_0x2011('0xf')];_0x30ad7b['tenantId']=_0x30ad7b[_0x2011('0xe')][_0x2011('0x10')];return Promise[_0x2011('0x11')](_0x30ad7b[_0x2011('0xe')][_0x2011('0x12')]);}var _0x372d30={'method':'POST','uri':_0x1bec19,'form':{'client_id':_0x30ad7b[_0x2011('0x13')],'resource':_0x30ad7b[_0x2011('0xd')],'username':_0x30ad7b[_0x2011('0x14')],'password':_0x30ad7b[_0x2011('0x15')],'grant_type':_0x2011('0x15'),'client_secret':_0x30ad7b[_0x2011('0x16')]},'json':!![]};return rp(_0x372d30)[_0x2011('0x17')](function(_0xf38676){return _0xf38676[_0x2011('0x18')];})[_0x2011('0x19')](function(_0x1b10c2){logger[_0x2011('0x1a')]('['+[_0x3c8c82[_0x2011('0x1b')]()]+_0x2011('0x1c'));return _0x1b10c2[_0x2011('0x1d')];});}function getUser(_0x3d3039,_0x59834a,_0x2f3acf,_0x5854a0,_0x4a04a9,_0x55555b){return new Promise(function(_0x51cf70,_0x4326a8){return getAuthToken(_0x59834a,_0x5854a0,_0x55555b)[_0x2011('0x17')](function(_0x257df0){var _0x50a219={'method':_0x2011('0x1e'),'uri':_0x4a04a9+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x257df0,'OData-Version':_0x2011('0x1f')},'json':!![]};return rp(_0x50a219);})[_0x2011('0x17')](function(_0x349c89){var _0x48d1b4=_0x349c89[_0x2011('0x20')];var _0x479573=![];var _0x128445=null;if(!_['isNil'](_0x2f3acf)){if(intUtil[_0x2011('0x21')](_0x2f3acf['email'])){_0x3d3039[_0x2011('0x22')]=_0x2f3acf[_0x2011('0x23')];for(_0x128445=0x0;_0x128445<_0x48d1b4[_0x2011('0x24')];_0x128445++){if(_0x48d1b4[_0x128445]['internalemailaddress']===_0x2f3acf[_0x2011('0x23')]&&!_0x48d1b4[_0x128445][_0x2011('0x25')]){_0x479573=!![];logger[_0x2011('0x26')]('['+[_0x55555b['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x48d1b4[_0x128445][_0x2011('0x27')]+'!');_0x3d3039[_0x2011('0x28')]=_0x48d1b4[_0x128445][_0x2011('0x27')];}}}}if(!_0x479573){logger[_0x2011('0x26')]('['+[_0x55555b[_0x2011('0x1b')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x3d3039['userEmail']=_0x59834a[_0x2011('0x14')];for(_0x128445=0x0;_0x128445<_0x48d1b4[_0x2011('0x24')];_0x128445++){if(_0x48d1b4[_0x128445][_0x2011('0x29')]===_0x59834a[_0x2011('0x14')]){_0x3d3039['userId']=_0x48d1b4[_0x128445][_0x2011('0x27')];}}}_0x51cf70(_0x3d3039);})[_0x2011('0x19')](function(_0x5addc6){_0x4326a8(_0x5addc6[_0x2011('0x1d')]);});});}function createEndUser(_0x3db260,_0x2f69b5,_0x6c893,_0xe29dd6,_0x427f5d,_0x1fbd90,_0x4e8987){return new Promise(function(_0x25b62d,_0x553831){return getAuthToken(_0x2f69b5,_0x6c893,_0x1fbd90)[_0x2011('0x17')](function(_0x55055d){var _0x197503=_0x1fbd90[_0x2011('0x2a')]()==='outbound'?_0x427f5d[_0x2011('0x2b')]:_0x427f5d['calleridnum'];var _0x4505c7={'method':_0x2011('0x2c'),'uri':_0xe29dd6+'contacts','body':{'fullname':_0x197503,'firstname':_0x197503,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x2011('0x2d')+_0x3db260[_0x2011('0x28')]+')'},'headers':{'Authorization':_0x2011('0x2e')+_0x55055d,'OData-Version':_0x2011('0x1f')},'json':!![],'resolveWithFullResponse':!![]};_0x4505c7[_0x2011('0x2f')][_0x4e8987]=_0x197503;return rp(_0x4505c7);})['then'](function(_0x305178){var _0x43264c=_0x305178[_0x2011('0x30')][_0x2011('0x31')];var _0x51a281=_0x43264c[_0x2011('0x32')](_0x43264c[_0x2011('0x33')]('(')+0x1,_0x43264c[_0x2011('0x33')](')'));_0x3db260[_0x2011('0x34')]=_0x51a281;_0x25b62d(_0x3db260);})[_0x2011('0x19')](function(_0x51cec4){_0x553831(_0x51cec4['message']);});});}function getEndUser(_0x53a8ff,_0xae69c9,_0x45fc0a,_0x35303b,_0x5ef15d,_0x1a9b83,_0x1df723,_0x48fb23){var _0x49af9e=_0x1a9b83[_0x2011('0x2a')]()===_0x2011('0x35')?_0x5ef15d[_0x2011('0x2b')]:_0x5ef15d['calleridnum'];return getAuthToken(_0xae69c9,_0x45fc0a,_0x1a9b83)[_0x2011('0x17')](function(_0x10b563){_0x48fb23=_0x48fb23?_0x48fb23:_0x2011('0x36');var _0x453383={'method':_0x2011('0x1e'),'uri':_0x35303b+_0x2011('0x37')+_0x48fb23+_0x2011('0x38')+_0x48fb23+_0x2011('0x39')+_0x49af9e['replace']('+',_0x2011('0x3a'))+'\x27','headers':{'Authorization':_0x2011('0x2e')+_0x10b563,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x453383);})[_0x2011('0x17')](function(_0x230704){var _0x19f40f=![];if(!_0x230704)return _0x19f40f;var _0x322a62=_0x230704[_0x2011('0x20')];for(var _0x1bcade=0x0;_0x1bcade<_0x322a62[_0x2011('0x24')];_0x1bcade++){if(_0x322a62[_0x1bcade][_0x48fb23]===_0x49af9e){_0x19f40f=!![];_0x53a8ff[_0x2011('0x34')]=_0x322a62[_0x1bcade][_0x2011('0x3b')];}}return _0x19f40f;})[_0x2011('0x17')](function(_0x2f56c6){if(_0x2f56c6)return _0x53a8ff;if(_0x1df723===_0x2011('0x3c')){logger[_0x2011('0x26')]('['+[_0x1a9b83['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x53a8ff;}return createEndUser(_0x53a8ff,_0xae69c9,_0x45fc0a,_0x35303b,_0x5ef15d,_0x1a9b83,_0x48fb23)['then'](function(_0x2e6a3d){logger[_0x2011('0x26')]('['+[_0x1a9b83['toUpperCase']()]+_0x2011('0x3d'),_0x2e6a3d[_0x2011('0x34')]);return _0x2e6a3d;});});}function getCustomFields(_0x3053a9,_0x1702f3,_0x5dd6f2){var _0x3c556a={};if(_0x3053a9[_0x2011('0x24')]>0x0){_[_0x2011('0x3e')](_0x3053a9,function(_0x1f02cd){if(_[_0x2011('0x3f')](['string','picklist'],_0x1f02cd[_0x2011('0x40')])&&_0x1f02cd['nameField']&&!_0x1f02cd['customField']){var _0x2d01d1=_0x1f02cd['idField'][_0x2011('0x2a')]();var _0x5b30f1=_0x2d01d1['substring'](0x0,_0x2d01d1[_0x2011('0x41')]('_'));var _0x42a79b=_0x2d01d1[_0x2011('0x32')](_0x2d01d1[_0x2011('0x41')]('_')+0x1);if(_0x5b30f1===_0x5dd6f2){_0x3c556a[_0x42a79b]=_0x1f02cd[_0x2011('0x42')];}}});}return _0x3c556a;}function getTicket(_0x4bfeb4,_0x4dd791,_0x4afe40,_0x1d59c0,_0xc425b4,_0x3bf846,_0x23cf64){return new Promise(function(_0x43e4c3,_0x43216d){var _0x1b53f4;return getAuthToken(_0x4dd791,_0x4afe40,_0x23cf64)[_0x2011('0x17')](function(_0x579292){if(_0x3bf846['ticketType']===_0x2011('0x43')){_0x1b53f4={'method':'POST','uri':_0x1d59c0+_0x2011('0x44'),'body':Object[_0x2011('0x45')]({},{'title':intUtil['getString'](_0x3bf846[_0x2011('0x46')],_0xc425b4,'\x20'),'description':intUtil['getString'](_0x3bf846[_0x2011('0x47')],_0xc425b4,'\x0a'),'customerid_contact@odata.bind':_0x4bfeb4[_0x2011('0x34')]?_0x2011('0x48')+_0x4bfeb4[_0x2011('0x34')]+')':undefined,'ownerid@odata.bind':_0x2011('0x2d')+_0x4bfeb4[_0x2011('0x28')]+')','caseorigincode':'1'},getCustomFields(_0x3bf846[_0x2011('0x49')],_0xc425b4,_0x3bf846[_0x2011('0x4a')])),'headers':{'Authorization':_0x2011('0x2e')+_0x579292,'OData-Version':_0x2011('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3bf846[_0x2011('0x4a')]===_0x2011('0x4b')){var _0x199f09=_0x4bfeb4[_0x2011('0x34')]?[{'partyid_systemuser@odata.bind':_0x2011('0x2d')+_0x4bfeb4['userId']+')','participationtypemask':_0x4bfeb4['callDirection']===_0x2011('0x4c')?0x2:0x1},{'partyid_contact@odata.bind':_0x2011('0x48')+_0x4bfeb4['enduserId']+')','participationtypemask':_0x4bfeb4[_0x2011('0x4d')]===_0x2011('0x4c')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x4bfeb4[_0x2011('0x28')]+')','participationtypemask':_0x4bfeb4[_0x2011('0x4d')]==='queue'?0x2:0x1}];_0x1b53f4={'method':'POST','uri':_0x1d59c0+_0x2011('0x4e'),'body':Object[_0x2011('0x45')]({},{'subject':intUtil[_0x2011('0x4f')](_0x3bf846[_0x2011('0x46')],_0xc425b4,'\x20'),'phonenumber':String(_0xc425b4[_0x2011('0x50')]),'description':intUtil[_0x2011('0x4f')](_0x3bf846['Descriptions'],_0xc425b4,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4bfeb4[_0x2011('0x34')]?_0x2011('0x48')+_0x4bfeb4[_0x2011('0x34')]+')':undefined,'ownerid@odata.bind':_0x2011('0x2d')+_0x4bfeb4[_0x2011('0x28')]+')','directioncode':_0x4bfeb4[_0x2011('0x4d')]==='queue'?![]:!![],'phonecall_activity_parties':_0x199f09},getCustomFields(_0x3bf846['Fields'],_0xc425b4,_0x3bf846['ticketType'])),'headers':{'Authorization':_0x2011('0x2e')+_0x579292,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1b53f4);})['then'](function(_0x29e233){var _0x1d2ef4=_0x29e233[_0x2011('0x30')]['odata-entityid'];var _0x2f26c9=_0x1d2ef4[_0x2011('0x32')](_0x1d2ef4[_0x2011('0x33')]('(')+0x1,_0x1d2ef4[_0x2011('0x33')](')'));_0x4bfeb4[_0x2011('0x51')]=_0x2f26c9;_0x43e4c3(_0x4bfeb4);})[_0x2011('0x19')](function(_0x27f8f5){_0x43216d(_0x27f8f5[_0x2011('0x1d')]);});});}function emit(_0x465652,_0x15b1ff,_0x116865,_0x3194e4){var _0x3710d8={'uri':util[_0x2011('0x52')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x465652,_0x116865,_0x3194e4)};io['to'](util[_0x2011('0x52')]('user:%s',_0x15b1ff))[_0x2011('0x53')](_0x2011('0x54'),_0x3710d8);}exports['cs']=function(_0x331be6,_0x3ed0d8,_0x32661f,_0x3fd6ae,_0x519279,_0x3333c1,_0x258c24,_0x503b81){var _0x5db9ee={};_0x3333c1['remoteUri']=_0x3333c1[_0x2011('0xc')]?intUtil[_0x2011('0x55')](_0x3333c1['CloudProvider'][_0x2011('0xf')]):intUtil[_0x2011('0x55')](_0x3333c1[_0x2011('0xd')]);_0x3333c1['serverUrl']=intUtil[_0x2011('0x55')](_0x3333c1[_0x2011('0x56')]);_0x5db9ee[_0x2011('0x4d')]=_0x503b81===_0x2011('0x4c')||_0x503b81===_0x2011('0x57')?_0x2011('0x4c'):'outbound';var _0x23ef98=_0x3333c1[_0x2011('0xc')]?util['format'](_0x2011('0x58'),_0x3333c1[_0x2011('0xe')][_0x2011('0xf')]):util['format'](_0x2011('0x58'),_0x3333c1[_0x2011('0xd')]);var _0x144726=util[_0x2011('0x52')](_0x2011('0x59'),_0x3333c1[_0x2011('0x5a')]);var _0x266c53=util[_0x2011('0x52')](_0x2011('0x5b'),_0x3333c1[_0x2011('0x56')],_0x3ed0d8['uniqueid'],md5(_0x3ed0d8['uniqueid']));if(_0x519279&&_0x519279[_0x2011('0x5c')]){logger[_0x2011('0x26')](_0x2011('0x5d'),'Recording\x20is\x20enabled!');_0x3ed0d8[_0x2011('0x5e')]=_0x266c53;}else if(_0x258c24&&_0x258c24[_0x2011('0x5f')]&&_0x258c24[_0x2011('0x5f')]!==_0x2011('0x60')){logger['info'](_0x2011('0x61'),_0x2011('0x62'));_0x3ed0d8['recordingURL']=_0x266c53;}else{_0x3ed0d8[_0x2011('0x5e')]='';}return getUser(_0x5db9ee,_0x3333c1,_0x3fd6ae,_0x144726,_0x23ef98,_0x503b81)[_0x2011('0x17')](function(_0x5b9655){logger['info']('['+_0x503b81[_0x2011('0x1b')]()+_0x2011('0x63'),_0x5b9655[_0x2011('0x28')]);logger[_0x2011('0x26')]('['+_0x503b81['toUpperCase']()+_0x2011('0x64'),_0x5b9655[_0x2011('0x22')]);return getEndUser(_0x5b9655,_0x3333c1,_0x144726,_0x23ef98,_0x3ed0d8,_0x503b81,_0x32661f[_0x2011('0x65')],_0x32661f[_0x2011('0x66')]);})[_0x2011('0x17')](function(_0x445f49){logger[_0x2011('0x26')]('['+_0x503b81[_0x2011('0x1b')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x445f49[_0x2011('0x34')]);logger[_0x2011('0x26')]('['+_0x503b81['toUpperCase']()+_0x2011('0x67'),_0x3ed0d8[_0x2011('0x50')]);return getTicket(_0x445f49,_0x3333c1,_0x144726,_0x23ef98,_0x3ed0d8,_0x32661f,_0x503b81);})[_0x2011('0x17')](function(_0x5f32a7){logger[_0x2011('0x26')](util[_0x2011('0x52')]('['+_0x503b81[_0x2011('0x1b')]()+_0x2011('0x68'),_0x32661f['ticketType'],_0x5f32a7[_0x2011('0x51')]));logger[_0x2011('0x26')](util[_0x2011('0x52')]('['+_0x503b81[_0x2011('0x1b')]()+_0x2011('0x69'),_0x503b81));if(_0x503b81!==_0x2011('0x57')&&_0x32661f[_0x2011('0x6a')]){logger['info']('['+_0x503b81[_0x2011('0x1b')]()+']',_0x2011('0x6b'));emit(_0x3333c1['remoteUri'],_0x3fd6ae[_0x2011('0x6c')],_0x32661f[_0x2011('0x4a')],_0x5f32a7[_0x2011('0x51')]);}})[_0x2011('0x19')](function(_0xa219f1){logger[_0x2011('0x1a')]('['+_0x503b81['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',_0xa219f1[_0x2011('0x1d')]);console[_0x2011('0x1a')](_0x2011('0x6d'),_0xa219f1);});}; \ 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 f4ec166..8ec8725 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 _0x671f=['customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','unmanaged','lastevent','The\x20Enduser\x20ID\x20is:','toUpperCase','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridnum','getString','Descriptions','
','Tags','name','Fields','custom_fields','keyBy','value','format','remoteUri','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','then','%s/api/v2/agents/me','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','string','picklist','type','nameField','customField','toLowerCase','content','idField','push','variable','variableName'];(function(_0x4de22e,_0x4891db){var _0x51f11e=function(_0x175c6e){while(--_0x175c6e){_0x4de22e['push'](_0x4de22e['shift']());}};_0x51f11e(++_0x4891db);}(_0x671f,0xcf));var _0xf671=function(_0x2e7170,_0x187736){_0x2e7170=_0x2e7170-0x0;var _0x36f675=_0x671f[_0x2e7170];return _0x36f675;};'use strict';var _=require('lodash');var rp=require(_0xf671('0x0'));var md5=require(_0xf671('0x1'));var util=require(_0xf671('0x2'));var Redis=require(_0xf671('0x3'));var intUtil=require(_0xf671('0x4'));var config=require(_0xf671('0x5'));var logger=require(_0xf671('0x6'))(_0xf671('0x7'));config[_0xf671('0x8')]=_[_0xf671('0x9')](config[_0xf671('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf671('0x8')]));var headers={'Content-Type':'application/json','Accept':_0xf671('0xa')};function emit(_0x1721a2,_0x8e981d,_0x49ef68){io['to'](_0x1721a2)[_0xf671('0xb')](_0x8e981d,_0x49ef68);}function getTicket(_0x160c65,_0x306c66,_0xfd0b11,_0x5c7e39,_0x530d77){logger[_0xf671('0xc')](_0xf671('0xd'));var _0x40b2a5=_[_0xf671('0xe')]({'responder_id':_0x306c66['id'],'requester_id':_0xfd0b11['id'],'name':util['format'](_0xf671('0xf'),_0x530d77['calleridname']),'phone':_0x530d77[_0xf671('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xf671('0x11')](_0x5c7e39['Subjects'],_0x530d77,'\x20'),'description':intUtil[_0xf671('0x11')](_0x5c7e39[_0xf671('0x12')],_0x530d77,_0xf671('0x13')),'tags':getTags(_0x5c7e39[_0xf671('0x14')],_0xf671('0x15'))},getCustomFields(_0x5c7e39[_0xf671('0x16')],_0x530d77));_0x40b2a5[_0xf671('0x17')]=_['mapValues'](_[_0xf671('0x18')](_0x40b2a5[_0xf671('0x17')],'id'),_0xf671('0x19'));return request({'uri':util[_0xf671('0x1a')]('%s/api/v2/tickets',_0x160c65[_0xf671('0x1b')]),'method':'POST','body':_0x40b2a5})['then'](function(_0x5a6807){logger[_0xf671('0xc')](_0xf671('0x1c'));return _0x5a6807;});}function getUser(_0x48abbd,_0x435f94){if(intUtil[_0xf671('0x1d')](_0x435f94)){return request({'uri':util['format'](_0xf671('0x1e'),_0x48abbd['remoteUri']),'qs':{'email':_0x435f94}})['then'](function(_0xd1a60f){if(_0xd1a60f[_0xf671('0x1f')]){logger[_0xf671('0xc')](_0xf671('0x20'));return _[_0xf671('0x21')](_0xd1a60f,function(_0x5c1604){return _0x5c1604[_0xf671('0x22')][_0xf671('0x23')]===_0x435f94;});}else{logger[_0xf671('0xc')](_0xf671('0x24'));return request({'uri':util[_0xf671('0x1a')]('%s/api/v2/agents/me',_0x48abbd['remoteUri'])})[_0xf671('0x25')](function(_0x48d7df){logger[_0xf671('0xc')]('Admin\x20account\x20selected.');return _0x48d7df;});}});}else{logger[_0xf671('0xc')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xf671('0x26'),_0x48abbd[_0xf671('0x1b')])})[_0xf671('0x25')](function(_0x30c7d6){logger[_0xf671('0xc')](_0xf671('0x27'));return _0x30c7d6;});}}function getEndUser(_0x7dcaa5,_0x5b3db2,_0x39be40){logger[_0xf671('0xc')]('Searching\x20enduser\x20with\x20phone',_0x39be40);return request({'uri':util['format'](_0xf671('0x28'),_0x7dcaa5['remoteUri']),'qs':{'phone':_0x39be40}})[_0xf671('0x25')](function(_0x2fb32c){if(_0x2fb32c['length']){logger[_0xf671('0xc')](_0xf671('0x29'));return _[_0xf671('0x21')](_0x2fb32c,{'phone':_0x39be40});}else{logger[_0xf671('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0xf671('0x28'),_0x7dcaa5[_0xf671('0x1b')]),'method':'POST','body':{'name':_0x5b3db2,'phone':_0x39be40}})['then'](function(_0x5c4b62){logger[_0xf671('0xc')](_0xf671('0x2a'));return _0x5c4b62;});}});}function getAuth(_0xf5da00){return util[_0xf671('0x1a')](_0xf671('0x2b'),new Buffer(_0xf5da00['apiKey']+':X')[_0xf671('0x2c')](_0xf671('0x2d')));}function request(_0x167a9b){logger[_0xf671('0x2e')](_0xf671('0x2f'),JSON[_0xf671('0x30')](_0x167a9b));return rp(_['defaults'](_0x167a9b,{'method':_0xf671('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x3763ee,_0x4d439f){var _0x5d7ee3=[];if(_0x3763ee&&_0x3763ee[_0xf671('0x1f')]>0x0){_0x5d7ee3=_[_0xf671('0x32')](_0x3763ee,_0x4d439f);}return _0x5d7ee3;}function getCustomFields(_0x1e65b6,_0x203771){var _0x244f21=[];var _0x499a38={'custom_fields':[]};if(_0x1e65b6['length']>0x0){_[_0xf671('0x33')](_0x1e65b6,function(_0x1278eb){if(_['includes']([_0xf671('0x34'),_0xf671('0x35')],_0x1278eb[_0xf671('0x36')])&&_0x1278eb[_0xf671('0x37')]&&!_0x1278eb[_0xf671('0x38')]){_0x499a38[_0x1278eb['nameField'][_0xf671('0x39')]()]=_0x1278eb[_0xf671('0x3a')]['toString']();}else if(_['includes']([_0xf671('0x34'),_0xf671('0x35')],_0x1278eb[_0xf671('0x36')])&&_0x1278eb[_0xf671('0x3b')]&&_0x1278eb[_0xf671('0x38')]){_0x499a38[_0xf671('0x17')][_0xf671('0x3c')]({'id':_0x1278eb[_0xf671('0x3b')],'value':_0x1278eb['content'][_0xf671('0x2c')]()});}else if(_0x1278eb[_0xf671('0x36')]===_0xf671('0x3d')&&_0x1278eb[_0xf671('0x3e')]&&_0x1278eb[_0xf671('0x3b')]&&_0x1278eb[_0xf671('0x38')]){_0x203771[_0x1278eb['variableName']]&&_0x499a38['custom_fields'][_0xf671('0x3c')]({'id':_0x1278eb[_0xf671('0x3b')],'value':_0x203771[_0x1278eb[_0xf671('0x3e')]]['toString']()});}else if(_0x1278eb['type']===_0xf671('0x3f')&&_0x1278eb[_0xf671('0x40')]&&_0x1278eb[_0xf671('0x40')][_0xf671('0x15')]&&_0x1278eb[_0xf671('0x3b')]&&_0x1278eb[_0xf671('0x38')]){_0x203771[_0x1278eb[_0xf671('0x40')]['name'][_0xf671('0x39')]()]&&_0x499a38['custom_fields']['push']({'id':_0x1278eb['idField'],'value':_0x203771[_0x1278eb[_0xf671('0x40')][_0xf671('0x15')][_0xf671('0x39')]()][_0xf671('0x2c')]()});}});}return _0x499a38;}exports[_0xf671('0x41')]=function(_0x132394,_0x2923f7,_0x2da5c2,_0x1c79ea,_0x185c5c,_0xa8dc20){var _0x44e7a2,_0x54b78e;_0xa8dc20[_0xf671('0x1b')]=intUtil[_0xf671('0x42')](_0xa8dc20['remoteUri']);_0xa8dc20['serverUrl']=intUtil[_0xf671('0x42')](_0xa8dc20[_0xf671('0x43')]);if(_0x185c5c&&_0x185c5c[_0xf671('0x44')]){logger[_0xf671('0xc')](_0xf671('0x45'),'Recording\x20is\x20enabled!');_0x2923f7['recordingURL']=util['format'](_0xf671('0x46'),_0xa8dc20['serverUrl'],_0x2923f7[_0xf671('0x47')],md5(_0x2923f7[_0xf671('0x47')]));}else{_0x2923f7[_0xf671('0x48')]='';}headers['Authorization']=getAuth(_0xa8dc20);return getUser(_0xa8dc20,_0x1c79ea[_0xf671('0x23')])[_0xf671('0x25')](function(_0x2c7778){_0x44e7a2=_0x2c7778;logger[_0xf671('0xc')](_0xf671('0x49'),_0x44e7a2['id']);return getEndUser(_0xa8dc20,_0x2923f7[_0xf671('0x4a')],_0x2923f7[_0xf671('0x10')]);})[_0xf671('0x25')](function(_0x16f97c){_0x54b78e=_0x16f97c;logger[_0xf671('0xc')]('The\x20Enduser\x20ID\x20is:',_0x54b78e['id']);return getTicket(_0xa8dc20,_0x44e7a2,_0x54b78e,_0x2da5c2,_0x2923f7);})[_0xf671('0x25')](function(_0x1a0130){if(_0x1a0130&&_0x1a0130['id']){logger['info'](_0xf671('0x1c'));logger[_0xf671('0xc')](_0xf671('0x4b'),_0x1a0130['id']);logger['info'](_0xf671('0x45'),_0xf671('0x4c'));emit(util['format'](_0xf671('0x4d'),_0x1c79ea['name']),_0xf671('0x4e'),{'uri':util[_0xf671('0x1a')](_0xf671('0x4f'),_0xa8dc20[_0xf671('0x1b')],_0x1a0130['id'])});}})[_0xf671('0x50')](function(_0x37d351){logger[_0xf671('0x51')]('[QUEUE]',JSON['stringify'](_0x37d351));});};exports[_0xf671('0x52')]=function(_0x234c3e,_0x251ec5,_0x518a9f,_0x1da416,_0x313eb2,_0x3111a0,_0x3ebcca){var _0x40795a,_0x4fb328;_0x3111a0[_0xf671('0x1b')]=intUtil[_0xf671('0x42')](_0x3111a0[_0xf671('0x1b')]);_0x3111a0[_0xf671('0x43')]=intUtil[_0xf671('0x42')](_0x3111a0[_0xf671('0x43')]);if(_0x3ebcca&&_0x3ebcca[_0xf671('0x53')]&&_0x3ebcca[_0xf671('0x53')]!=='none'){logger[_0xf671('0xc')](_0xf671('0x54'),_0xf671('0x55'));_0x251ec5[_0xf671('0x48')]=util[_0xf671('0x1a')](_0xf671('0x46'),_0x3111a0[_0xf671('0x43')],_0x251ec5[_0xf671('0x47')],md5(_0x251ec5[_0xf671('0x47')]));}headers['Authorization']=getAuth(_0x3111a0);return getUser(_0x3111a0,_0x1da416[_0xf671('0x23')])[_0xf671('0x25')](function(_0x5c0be4){_0x40795a=_0x5c0be4;logger[_0xf671('0xc')]('The\x20User\x20ID\x20is:',_0x40795a['id']);return getEndUser(_0x3111a0,_0x251ec5['destcalleridname'],_0x251ec5['destcalleridnum']);})[_0xf671('0x25')](function(_0x43bc4c){_0x4fb328=_0x43bc4c;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4fb328['id']);return getTicket(_0x3111a0,_0x40795a,_0x4fb328,_0x518a9f,_0x251ec5);})[_0xf671('0x25')](function(_0x31e75f){if(_0x31e75f&&_0x31e75f['id']){logger['info']('Ticket\x20created!');logger[_0xf671('0xc')](_0xf671('0x4b'),_0x31e75f['id']);logger[_0xf671('0xc')](_0xf671('0x54'),_0xf671('0x4c'));emit(util[_0xf671('0x1a')](_0xf671('0x4d'),_0x1da416[_0xf671('0x15')]),_0xf671('0x4e'),{'uri':util['format'](_0xf671('0x4f'),_0x3111a0[_0xf671('0x1b')],_0x31e75f['id'])});}})[_0xf671('0x50')](function(_0x148df6){logger[_0xf671('0x51')]('[OUTBOUND]',JSON[_0xf671('0x30')](_0x148df6));});};exports[_0xf671('0x56')]=function(_0xeecf93,_0x423bc7,_0x46d6a9,_0x153caa,_0x21230e,_0x381372){var _0x2b81a1,_0x45b0c7;_0x381372[_0xf671('0x1b')]=intUtil[_0xf671('0x42')](_0x381372[_0xf671('0x1b')]);_0x381372[_0xf671('0x43')]=intUtil['stripTrailingSlash'](_0x381372['serverUrl']);if(_0x21230e&&_0x21230e[_0xf671('0x44')]){logger[_0xf671('0xc')]('['+_0x423bc7[_0xf671('0x57')]['toUpperCase']()+']',_0xf671('0x55'));_0x423bc7[_0xf671('0x48')]=util[_0xf671('0x1a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x381372[_0xf671('0x43')],_0x423bc7['uniqueid'],md5(_0x423bc7[_0xf671('0x47')]));}else{_0x423bc7['recordingURL']='';}headers['Authorization']=getAuth(_0x381372);return getUser(_0x381372,'')[_0xf671('0x25')](function(_0x31ee88){_0x2b81a1=_0x31ee88;logger[_0xf671('0xc')](_0xf671('0x49'),_0x2b81a1['id']);return getEndUser(_0x381372,_0x423bc7[_0xf671('0x4a')],_0x423bc7['calleridnum']);})[_0xf671('0x25')](function(_0x1f0648){_0x45b0c7=_0x1f0648;logger[_0xf671('0xc')](_0xf671('0x58'),_0x45b0c7['id']);return getTicket(_0x381372,_0x2b81a1,_0x45b0c7,_0x46d6a9,_0x423bc7);})['then'](function(_0x3f9036){if(_0x3f9036){logger[_0xf671('0xc')](_0xf671('0x1c'));logger[_0xf671('0xc')](_0xf671('0x4b'),_0x3f9036['id']);}})[_0xf671('0x50')](function(_0x4ba7cf){logger[_0xf671('0x51')]('['+_0x423bc7[_0xf671('0x57')][_0xf671('0x59')]()+']',JSON[_0xf671('0x30')](_0x4ba7cf));});}; \ No newline at end of file +var _0xf8f3=['util','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Descriptions','
','Tags','Fields','custom_fields','value','remoteUri','info','validateEmail','%s/api/v2/agents','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','then','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','toString','variable','variableName','customVariable','Variable','name','push','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','[QUEUE]','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','toUpperCase','recordingURL','calleridname','lodash','request-promise','md5'];(function(_0x26df48,_0x22aa50){var _0x209047=function(_0x1d068b){while(--_0x1d068b){_0x26df48['push'](_0x26df48['shift']());}};_0x209047(++_0x22aa50);}(_0xf8f3,0xb1));var _0x3f8f=function(_0x4f22c8,_0x5c5252){_0x4f22c8=_0x4f22c8-0x0;var _0x516ef5=_0xf8f3[_0x4f22c8];return _0x516ef5;};'use strict';var _=require(_0x3f8f('0x0'));var rp=require(_0x3f8f('0x1'));var md5=require(_0x3f8f('0x2'));var util=require(_0x3f8f('0x3'));var Redis=require(_0x3f8f('0x4'));var intUtil=require(_0x3f8f('0x5'));var config=require(_0x3f8f('0x6'));var logger=require('../../../../config/logger')(_0x3f8f('0x7'));config[_0x3f8f('0x8')]=_[_0x3f8f('0x9')](config[_0x3f8f('0x8')],{'host':_0x3f8f('0xa'),'port':0x18eb});var io=require(_0x3f8f('0xb'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0x3f8f('0xc')};function emit(_0x4e6225,_0xec1da7,_0x26c036){io['to'](_0x4e6225)[_0x3f8f('0xd')](_0xec1da7,_0x26c036);}function getTicket(_0x277dd0,_0xb964e7,_0x4be6ff,_0x4621c4,_0x168920){logger['info'](_0x3f8f('0xe'));var _0x56d77c=_[_0x3f8f('0xf')]({'responder_id':_0xb964e7['id'],'requester_id':_0x4be6ff['id'],'name':util[_0x3f8f('0x10')](_0x3f8f('0x11'),_0x168920['calleridname']),'phone':_0x168920[_0x3f8f('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x4621c4['Subjects'],_0x168920,'\x20'),'description':intUtil[_0x3f8f('0x13')](_0x4621c4[_0x3f8f('0x14')],_0x168920,_0x3f8f('0x15')),'tags':getTags(_0x4621c4[_0x3f8f('0x16')],'name')},getCustomFields(_0x4621c4[_0x3f8f('0x17')],_0x168920));_0x56d77c[_0x3f8f('0x18')]=_['mapValues'](_['keyBy'](_0x56d77c['custom_fields'],'id'),_0x3f8f('0x19'));return request({'uri':util[_0x3f8f('0x10')]('%s/api/v2/tickets',_0x277dd0[_0x3f8f('0x1a')]),'method':'POST','body':_0x56d77c})['then'](function(_0x22cb18){logger[_0x3f8f('0x1b')]('Ticket\x20created!');return _0x22cb18;});}function getUser(_0x8ee1f6,_0x259515){if(intUtil[_0x3f8f('0x1c')](_0x259515)){return request({'uri':util[_0x3f8f('0x10')](_0x3f8f('0x1d'),_0x8ee1f6['remoteUri']),'qs':{'email':_0x259515}})['then'](function(_0x349e9c){if(_0x349e9c['length']){logger[_0x3f8f('0x1b')](_0x3f8f('0x1e'));return _[_0x3f8f('0x1f')](_0x349e9c,function(_0x35cc15){return _0x35cc15['contact'][_0x3f8f('0x20')]===_0x259515;});}else{logger[_0x3f8f('0x1b')](_0x3f8f('0x21'));return request({'uri':util[_0x3f8f('0x10')](_0x3f8f('0x22'),_0x8ee1f6['remoteUri'])})['then'](function(_0x561a88){logger[_0x3f8f('0x1b')](_0x3f8f('0x23'));return _0x561a88;});}});}else{logger[_0x3f8f('0x1b')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x3f8f('0x22'),_0x8ee1f6[_0x3f8f('0x1a')])})[_0x3f8f('0x24')](function(_0x13c261){logger[_0x3f8f('0x1b')](_0x3f8f('0x23'));return _0x13c261;});}}function getEndUser(_0x569f42,_0x524876,_0x527953){logger['info']('Searching\x20enduser\x20with\x20phone',_0x527953);return request({'uri':util[_0x3f8f('0x10')](_0x3f8f('0x25'),_0x569f42['remoteUri']),'qs':{'phone':_0x527953}})['then'](function(_0x352b32){if(_0x352b32[_0x3f8f('0x26')]){logger[_0x3f8f('0x1b')](_0x3f8f('0x27'));return _['find'](_0x352b32,{'phone':_0x527953});}else{logger['info'](_0x3f8f('0x28'));return request({'uri':util[_0x3f8f('0x10')]('%s/api/v2/contacts',_0x569f42[_0x3f8f('0x1a')]),'method':_0x3f8f('0x29'),'body':{'name':_0x524876,'phone':_0x527953}})[_0x3f8f('0x24')](function(_0x3b7779){logger[_0x3f8f('0x1b')](_0x3f8f('0x2a'));return _0x3b7779;});}});}function getAuth(_0x42f27d){return util['format']('Basic\x20%s',new Buffer(_0x42f27d['apiKey']+':X')['toString'](_0x3f8f('0x2b')));}function request(_0x10f151){logger[_0x3f8f('0x2c')](_0x3f8f('0x2d'),JSON[_0x3f8f('0x2e')](_0x10f151));return rp(_[_0x3f8f('0x9')](_0x10f151,{'method':_0x3f8f('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x27ce0d,_0x1f54f5){var _0x2567ce=[];if(_0x27ce0d&&_0x27ce0d[_0x3f8f('0x26')]>0x0){_0x2567ce=_[_0x3f8f('0x30')](_0x27ce0d,_0x1f54f5);}return _0x2567ce;}function getCustomFields(_0x9ffd73,_0x16f8cc){var _0x1b0d68=[];var _0x2d5da5={'custom_fields':[]};if(_0x9ffd73[_0x3f8f('0x26')]>0x0){_[_0x3f8f('0x31')](_0x9ffd73,function(_0x46ab89){if(_[_0x3f8f('0x32')]([_0x3f8f('0x33'),_0x3f8f('0x34')],_0x46ab89[_0x3f8f('0x35')])&&_0x46ab89[_0x3f8f('0x36')]&&!_0x46ab89[_0x3f8f('0x37')]){_0x2d5da5[_0x46ab89[_0x3f8f('0x36')][_0x3f8f('0x38')]()]=_0x46ab89[_0x3f8f('0x39')]['toString']();}else if(_[_0x3f8f('0x32')]([_0x3f8f('0x33'),_0x3f8f('0x34')],_0x46ab89[_0x3f8f('0x35')])&&_0x46ab89[_0x3f8f('0x3a')]&&_0x46ab89[_0x3f8f('0x37')]){_0x2d5da5['custom_fields']['push']({'id':_0x46ab89[_0x3f8f('0x3a')],'value':_0x46ab89[_0x3f8f('0x39')][_0x3f8f('0x3b')]()});}else if(_0x46ab89[_0x3f8f('0x35')]===_0x3f8f('0x3c')&&_0x46ab89[_0x3f8f('0x3d')]&&_0x46ab89[_0x3f8f('0x3a')]&&_0x46ab89['customField']){_0x16f8cc[_0x46ab89[_0x3f8f('0x3d')]]&&_0x2d5da5[_0x3f8f('0x18')]['push']({'id':_0x46ab89[_0x3f8f('0x3a')],'value':_0x16f8cc[_0x46ab89[_0x3f8f('0x3d')]][_0x3f8f('0x3b')]()});}else if(_0x46ab89[_0x3f8f('0x35')]===_0x3f8f('0x3e')&&_0x46ab89[_0x3f8f('0x3f')]&&_0x46ab89[_0x3f8f('0x3f')][_0x3f8f('0x40')]&&_0x46ab89['idField']&&_0x46ab89['customField']){_0x16f8cc[_0x46ab89[_0x3f8f('0x3f')][_0x3f8f('0x40')][_0x3f8f('0x38')]()]&&_0x2d5da5[_0x3f8f('0x18')][_0x3f8f('0x41')]({'id':_0x46ab89['idField'],'value':_0x16f8cc[_0x46ab89['Variable'][_0x3f8f('0x40')][_0x3f8f('0x38')]()][_0x3f8f('0x3b')]()});}});}return _0x2d5da5;}exports[_0x3f8f('0x42')]=function(_0x25c89f,_0x107518,_0x3eb467,_0x526450,_0x4634b2,_0x2205c7){var _0x27bdb6,_0x178bb5;_0x2205c7[_0x3f8f('0x1a')]=intUtil[_0x3f8f('0x43')](_0x2205c7[_0x3f8f('0x1a')]);_0x2205c7['serverUrl']=intUtil[_0x3f8f('0x43')](_0x2205c7[_0x3f8f('0x44')]);if(_0x4634b2&&_0x4634b2[_0x3f8f('0x45')]){logger[_0x3f8f('0x1b')]('[QUEUE]',_0x3f8f('0x46'));_0x107518['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2205c7[_0x3f8f('0x44')],_0x107518[_0x3f8f('0x47')],md5(_0x107518[_0x3f8f('0x47')]));}else{_0x107518['recordingURL']='';}headers[_0x3f8f('0x48')]=getAuth(_0x2205c7);return getUser(_0x2205c7,_0x526450['email'])[_0x3f8f('0x24')](function(_0xc7ed3a){_0x27bdb6=_0xc7ed3a;logger[_0x3f8f('0x1b')](_0x3f8f('0x49'),_0x27bdb6['id']);return getEndUser(_0x2205c7,_0x107518['calleridname'],_0x107518['calleridnum']);})[_0x3f8f('0x24')](function(_0x260208){_0x178bb5=_0x260208;logger[_0x3f8f('0x1b')](_0x3f8f('0x4a'),_0x178bb5['id']);return getTicket(_0x2205c7,_0x27bdb6,_0x178bb5,_0x3eb467,_0x107518);})[_0x3f8f('0x24')](function(_0x362ef4){if(_0x362ef4&&_0x362ef4['id']){logger[_0x3f8f('0x1b')](_0x3f8f('0x4b'));logger['info'](_0x3f8f('0x4c'),_0x362ef4['id']);logger[_0x3f8f('0x1b')](_0x3f8f('0x4d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x526450[_0x3f8f('0x40')]),'trigger:browser:url',{'uri':util[_0x3f8f('0x10')](_0x3f8f('0x4e'),_0x2205c7[_0x3f8f('0x1a')],_0x362ef4['id'])});}})[_0x3f8f('0x4f')](function(_0x38719b){logger[_0x3f8f('0x50')]('[QUEUE]',JSON[_0x3f8f('0x2e')](_0x38719b));});};exports['outbound']=function(_0xaeecbb,_0x46f5a9,_0x46870b,_0x20dbb8,_0x5d189a,_0x5b4293,_0x4467a9){var _0x1aeaf8,_0x2cbf93;_0x5b4293[_0x3f8f('0x1a')]=intUtil[_0x3f8f('0x43')](_0x5b4293[_0x3f8f('0x1a')]);_0x5b4293['serverUrl']=intUtil[_0x3f8f('0x43')](_0x5b4293[_0x3f8f('0x44')]);if(_0x4467a9&&_0x4467a9['recordingFormat']&&_0x4467a9[_0x3f8f('0x51')]!==_0x3f8f('0x52')){logger[_0x3f8f('0x1b')]('[OUTBOUND]',_0x3f8f('0x46'));_0x46f5a9['recordingURL']=util[_0x3f8f('0x10')](_0x3f8f('0x53'),_0x5b4293[_0x3f8f('0x44')],_0x46f5a9[_0x3f8f('0x47')],md5(_0x46f5a9[_0x3f8f('0x47')]));}headers[_0x3f8f('0x48')]=getAuth(_0x5b4293);return getUser(_0x5b4293,_0x20dbb8[_0x3f8f('0x20')])[_0x3f8f('0x24')](function(_0x460fda){_0x1aeaf8=_0x460fda;logger[_0x3f8f('0x1b')](_0x3f8f('0x49'),_0x1aeaf8['id']);return getEndUser(_0x5b4293,_0x46f5a9['destcalleridname'],_0x46f5a9[_0x3f8f('0x54')]);})[_0x3f8f('0x24')](function(_0x432999){_0x2cbf93=_0x432999;logger[_0x3f8f('0x1b')](_0x3f8f('0x4a'),_0x2cbf93['id']);return getTicket(_0x5b4293,_0x1aeaf8,_0x2cbf93,_0x46870b,_0x46f5a9);})[_0x3f8f('0x24')](function(_0x1eb6f9){if(_0x1eb6f9&&_0x1eb6f9['id']){logger['info'](_0x3f8f('0x4b'));logger['info'](_0x3f8f('0x4c'),_0x1eb6f9['id']);logger[_0x3f8f('0x1b')](_0x3f8f('0x55'),_0x3f8f('0x56'));emit(util[_0x3f8f('0x10')]('user:%s',_0x20dbb8[_0x3f8f('0x40')]),'trigger:browser:url',{'uri':util[_0x3f8f('0x10')](_0x3f8f('0x4e'),_0x5b4293[_0x3f8f('0x1a')],_0x1eb6f9['id'])});}})[_0x3f8f('0x4f')](function(_0x1aff67){logger[_0x3f8f('0x50')](_0x3f8f('0x55'),JSON[_0x3f8f('0x2e')](_0x1aff67));});};exports['unmanaged']=function(_0x5813d2,_0x31b52f,_0x207f22,_0x383dd0,_0x387b58,_0x403898){var _0x354385,_0x233d74;_0x403898[_0x3f8f('0x1a')]=intUtil[_0x3f8f('0x43')](_0x403898['remoteUri']);_0x403898['serverUrl']=intUtil[_0x3f8f('0x43')](_0x403898['serverUrl']);if(_0x387b58&&_0x387b58[_0x3f8f('0x45')]){logger[_0x3f8f('0x1b')]('['+_0x31b52f['lastevent'][_0x3f8f('0x57')]()+']',_0x3f8f('0x46'));_0x31b52f[_0x3f8f('0x58')]=util[_0x3f8f('0x10')](_0x3f8f('0x53'),_0x403898[_0x3f8f('0x44')],_0x31b52f['uniqueid'],md5(_0x31b52f[_0x3f8f('0x47')]));}else{_0x31b52f[_0x3f8f('0x58')]='';}headers[_0x3f8f('0x48')]=getAuth(_0x403898);return getUser(_0x403898,'')[_0x3f8f('0x24')](function(_0x1da657){_0x354385=_0x1da657;logger[_0x3f8f('0x1b')]('The\x20User\x20ID\x20is:',_0x354385['id']);return getEndUser(_0x403898,_0x31b52f[_0x3f8f('0x59')],_0x31b52f[_0x3f8f('0x12')]);})[_0x3f8f('0x24')](function(_0x3ed6a0){_0x233d74=_0x3ed6a0;logger[_0x3f8f('0x1b')](_0x3f8f('0x4a'),_0x233d74['id']);return getTicket(_0x403898,_0x354385,_0x233d74,_0x207f22,_0x31b52f);})[_0x3f8f('0x24')](function(_0x1297c5){if(_0x1297c5){logger[_0x3f8f('0x1b')](_0x3f8f('0x4b'));logger['info'](_0x3f8f('0x4c'),_0x1297c5['id']);}})[_0x3f8f('0x4f')](function(_0x377122){logger[_0x3f8f('0x50')]('['+_0x31b52f['lastevent'][_0x3f8f('0x57')]()+']',JSON[_0x3f8f('0x2e')](_0x377122));});}; \ 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 ed248a5..fb41899 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 _0xb43f=['Descriptions','Contact','ticketId','task','user:%s','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','serverUrl','remoteUri','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','request-promise','md5','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','length','email','adminEmail','info','adminId','error','message','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','userId','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','getString','Subjects'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xb43f,0x6f));var _0xfb43=function(_0x254081,_0x20731a){_0x254081=_0x254081-0x0;var _0x5d1e2a=_0xb43f[_0x254081];return _0x5d1e2a;};'use strict';var _=require('lodash');var rp=require(_0xfb43('0x0'));var md5=require(_0xfb43('0x1'));var util=require(_0xfb43('0x2'));var moment=require(_0xfb43('0x3'));var Promise=require(_0xfb43('0x4'));var Redis=require('ioredis');var intUtil=require(_0xfb43('0x5'));var config=require(_0xfb43('0x6'));var logger=require(_0xfb43('0x7'))('freshsales');config[_0xfb43('0x8')]=_[_0xfb43('0x9')](config[_0xfb43('0x8')],{'host':_0xfb43('0xa'),'port':0x18eb});var io=require(_0xfb43('0xb'))(new Redis(config[_0xfb43('0x8')]));function getAdminId(_0x1838a0,_0x4d37f2,_0x5acb18,_0x559f2b){return new Promise(function(_0x571d91,_0x2b61d7){var _0x266ad7=![];var _0x330e57={'method':_0xfb43('0xc'),'uri':_0x559f2b+_0xfb43('0xd'),'json':!![]};_0x330e57[_0xfb43('0xe')]=_0x5acb18;logger['info'](_0xfb43('0xf'));return rp(_0x330e57)[_0xfb43('0x10')](function(_0x2e0d77){if(_0x2e0d77){var _0x2c6e91=_0x2e0d77[_0xfb43('0x11')];var _0x4f1abf=null;for(_0x4f1abf=0x0;_0x4f1abf<_0x2c6e91[_0xfb43('0x12')];_0x4f1abf++){if(_0x2c6e91[_0x4f1abf][_0xfb43('0x13')]===_0x1838a0[_0xfb43('0x14')]){_0x1838a0['adminId']=_0x2c6e91[_0x4f1abf]['id'];_0x266ad7=!![];}}if(_0x266ad7){logger[_0xfb43('0x15')]('Admin\x20found:',_0x1838a0[_0xfb43('0x16')]);_0x571d91(_0x1838a0);}else{_0x2b61d7({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x2b61d7({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x1e35e8){logger[_0xfb43('0x17')]('['+[_0x4d37f2['toUpperCase']()]+']',_0x1e35e8[_0xfb43('0x18')]);_0x2b61d7(_0x1e35e8);});});}function getUser(_0x208376,_0x387147,_0x5442b3){return function(_0x4fd68a){return new Promise(function(_0x3efcf6,_0x4fb50d){var _0x942c43={'method':'GET','uri':_0x5442b3+'/api/selector/owners','json':!![]};_0x942c43[_0xfb43('0xe')]=_0x387147;logger[_0xfb43('0x15')]('Getting\x20user\x20list');return rp(_0x942c43)['then'](function(_0x200529){if(_0x200529){var _0x2c9a8c=_0x200529[_0xfb43('0x11')];var _0x1e9ebe=![];var _0xf6e4c9=null;if(_0x4fd68a[_0xfb43('0x19')]!==null){logger[_0xfb43('0x15')](_0xfb43('0x1a'),_0x4fd68a['agentEmail']);_0x4fd68a[_0xfb43('0x1b')]=_0x4fd68a[_0xfb43('0x19')];for(_0xf6e4c9=0x0;_0xf6e4c9<_0x2c9a8c[_0xfb43('0x12')];_0xf6e4c9++){if(_0x2c9a8c[_0xf6e4c9][_0xfb43('0x13')]===_0x4fd68a[_0xfb43('0x19')]){_0x1e9ebe=!![];_0x4fd68a['userId']=_0x2c9a8c[_0xf6e4c9]['id'];logger['info'](_0xfb43('0x1c'),_0x4fd68a['userId']);}}}if(!_0x1e9ebe){logger['info']('Admin\x20selected');_0x4fd68a[_0xfb43('0x1b')]=_0x4fd68a[_0xfb43('0x14')];_0x4fd68a[_0xfb43('0x1d')]=_0x4fd68a[_0xfb43('0x16')];_0x1e9ebe=!![];}if(_0x1e9ebe){_0x3efcf6(_0x4fd68a);}else{_0x4fb50d({'statusCode':0x194,'message':_0xfb43('0x1e')});}}else{_0x4fb50d({'statusCode':0x194,'message':_0xfb43('0x1e')});}})[_0xfb43('0x1f')](function(_0x3d7259){logger[_0xfb43('0x17')]('['+[_0x208376[_0xfb43('0x20')]()]+']',_0x3d7259[_0xfb43('0x18')]);_0x4fb50d(_0x3d7259);});});};}function searchContact(_0x536fee,_0x199cdf,_0xae409d,_0x3ae644){return new Promise(function(_0x4a5ded,_0x4273ad){var _0x645f74={'method':_0xfb43('0xc'),'headers':_0x199cdf,'uri':_0x536fee+_0xfb43('0x21')+_0x3ae644+_0xfb43('0x22')+_0xae409d+_0xfb43('0x23'),'json':!![]};rp(_0x645f74)[_0xfb43('0x10')](function(_0x4d4f20){var _0xc26706=_['find'](_0x4d4f20['contacts'][_0xfb43('0x24')],[_0xae409d,_0x3ae644]);_0x4a5ded(_0xc26706);})[_0xfb43('0x1f')](function(_0xbc684b){_0x4273ad(_0xbc684b);});});}function getEndUser(_0xe514e7,_0x12c78c,_0x1acd28){return function(_0x52342c){return new Promise(function(_0x108292,_0x204b8b){logger[_0xfb43('0x15')](util[_0xfb43('0x25')](_0xfb43('0x26'),_0x52342c[_0xfb43('0x27')]));searchContact(_0x1acd28,_0x12c78c,'mobile_number',_0x52342c[_0xfb43('0x27')])[_0xfb43('0x10')](function(_0x2e6b4a){if(_0x2e6b4a){_0x52342c['endUserId']=_0x2e6b4a['id'];logger[_0xfb43('0x15')](_0xfb43('0x28'),_0x52342c[_0xfb43('0x29')]);return _0x108292(_0x52342c);}searchContact(_0x1acd28,_0x12c78c,_0xfb43('0x2a'),_0x52342c[_0xfb43('0x27')])[_0xfb43('0x10')](function(_0x4f9918){if(_0x4f9918){_0x52342c[_0xfb43('0x29')]=_0x4f9918['id'];logger[_0xfb43('0x15')](_0xfb43('0x2b'),_0x52342c[_0xfb43('0x29')]);return _0x108292(_0x52342c);}createEndUser(_0x52342c,_0xe514e7,_0x12c78c,_0x1acd28)[_0xfb43('0x10')](function(_0x590298){logger[_0xfb43('0x15')]('Contact\x20created:',_0x590298[_0xfb43('0x29')]);return _0x108292(_0x590298);});});})[_0xfb43('0x1f')](function(_0x3544f5){_0x204b8b(_0x3544f5);});});};}function createEndUser(_0x253f9a,_0x328253,_0xeddb51,_0x1090ba){return new Promise(function(_0x55c52e,_0x58da93){var _0x16fd18=moment();var _0x4f995e={'method':_0xfb43('0x2c'),'uri':_0x1090ba+_0xfb43('0x2d'),'body':{'contact':{'last_name':_0x253f9a[_0xfb43('0x27')],'work_number':_0x253f9a['contactNumber'],'mobile_number':_0x253f9a['contactNumber'],'owner_id':_0x253f9a['userId'],'created_at':_0x16fd18[_0xfb43('0x25')](_0xfb43('0x2e'))}},'json':!![]};_0x4f995e[_0xfb43('0xe')]=_0xeddb51;logger[_0xfb43('0x15')](_0xfb43('0x2f'));return rp(_0x4f995e)[_0xfb43('0x10')](function(_0x1b1e2f){_0x253f9a['endUserId']=_0x1b1e2f[_0xfb43('0x30')]['id'];_0x55c52e(_0x253f9a);})[_0xfb43('0x1f')](function(_0x4498c7){logger[_0xfb43('0x17')]('['+[_0x328253[_0xfb43('0x20')]()]+']',_0x4498c7[_0xfb43('0x18')]);_0x58da93(_0x4498c7['message']);});});}function getTicket(_0x13cdd8,_0x566e02,_0x40218d,_0x46fb60,_0x2c986a){return function(_0x1f5150){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x5d6fa9,_0x273569){var _0x1253b0=moment();var _0x213df6={'method':_0xfb43('0x2c'),'uri':_0x40218d+'/api/tasks','body':{'title':intUtil[_0xfb43('0x31')](_0x46fb60[_0xfb43('0x32')],_0x2c986a,'\x20'),'description':intUtil[_0xfb43('0x31')](_0x46fb60[_0xfb43('0x33')],_0x2c986a,'\x0a'),'owner_id':_0x1f5150[_0xfb43('0x1d')],'creater_id':_0x1f5150[_0xfb43('0x16')],'targetable_id':_0x1f5150[_0xfb43('0x29')],'targetable_type':_0xfb43('0x34'),'created_at':_0x1253b0[_0xfb43('0x25')](_0xfb43('0x2e')),'due_date':_0x1253b0['add'](0x1e,'m')[_0xfb43('0x25')](_0xfb43('0x2e'))},'json':!![]};_0x213df6[_0xfb43('0xe')]=_0x566e02;return rp(_0x213df6)[_0xfb43('0x10')](function(_0x4a182e){_0x1f5150[_0xfb43('0x35')]=_0x4a182e[_0xfb43('0x36')]['id'];logger[_0xfb43('0x15')]('Task\x20created:',_0x1f5150['ticketId']);_0x5d6fa9(_0x1f5150);})[_0xfb43('0x1f')](function(_0x3ae087){logger[_0xfb43('0x17')]('['+[_0x13cdd8[_0xfb43('0x20')]()]+']',_0x3ae087[_0xfb43('0x18')]);_0x273569(_0x3ae087[_0xfb43('0x18')]);});});};}function emit(_0x22859e,_0x1a63d2,_0x5ca4d5){var _0x30127a={'uri':_0x22859e+'/contacts/'+_0x5ca4d5};io['to'](util['format'](_0xfb43('0x37'),_0x1a63d2))['emit'](_0xfb43('0x38'),_0x30127a);}exports['cs']=function(_0x13cc56,_0x131563,_0x5a461d,_0x596830,_0xaf1cb7,_0x5d6079,_0x48951d,_0x1095d6){var _0xbec9f6={};var _0x4057d7={'Authorization':_0xfb43('0x39')+_0x5d6079[_0xfb43('0x3a')]};_0x5d6079['remoteUri']=intUtil[_0xfb43('0x3b')](_0x5d6079['remoteUri']);_0x5d6079[_0xfb43('0x3c')]=intUtil[_0xfb43('0x3b')](_0x5d6079[_0xfb43('0x3c')]);var _0x249222=_0x5d6079[_0xfb43('0x3d')];_0xbec9f6[_0xfb43('0x14')]=_0x5d6079[_0xfb43('0x3e')];_0xbec9f6['contactNumber']=_0x1095d6[_0xfb43('0x3f')]()===_0xfb43('0x40')?_0x131563[_0xfb43('0x41')]:_0x131563['calleridnum'];_0xbec9f6[_0xfb43('0x42')]=_0x1095d6===_0xfb43('0x43')||_0x1095d6==='unmanaged'?_0xfb43('0x43'):'outbound';if(_0x596830){_0xbec9f6[_0xfb43('0x19')]=_0x596830['email'];}var _0x26acba=util[_0xfb43('0x25')](_0xfb43('0x44'),_0x5d6079[_0xfb43('0x3c')],_0x131563[_0xfb43('0x45')],md5(_0x131563['uniqueid']));if(_0xaf1cb7&&_0xaf1cb7[_0xfb43('0x46')]){logger[_0xfb43('0x15')](_0xfb43('0x47'),_0xfb43('0x48'));_0x131563['recordingURL']=_0x26acba;}else if(_0x48951d&&_0x48951d['recordingFormat']&&_0x48951d[_0xfb43('0x49')]!==_0xfb43('0x4a')){logger[_0xfb43('0x15')]('[OUTBOUND]',_0xfb43('0x48'));_0x131563[_0xfb43('0x4b')]=_0x26acba;}else{_0x131563[_0xfb43('0x4b')]='';}return getAdminId(_0xbec9f6,_0x1095d6,_0x4057d7,_0x249222)['then'](getUser(_0x1095d6,_0x4057d7,_0x249222))[_0xfb43('0x10')](getEndUser(_0x1095d6,_0x4057d7,_0x249222))[_0xfb43('0x10')](getTicket(_0x1095d6,_0x4057d7,_0x249222,_0x5a461d,_0x131563))['then'](function(_0x4e3748){logger[_0xfb43('0x15')](util[_0xfb43('0x25')](_0xfb43('0x4c'),_0x4e3748[_0xfb43('0x35')]));if(_0x1095d6!==_0xfb43('0x4d')){logger[_0xfb43('0x15')]('['+[_0x1095d6[_0xfb43('0x20')]()]+']',_0xfb43('0x4e'));emit(_0x249222,_0x596830[_0xfb43('0x4f')],_0x4e3748[_0xfb43('0x29')]);}})[_0xfb43('0x1f')](function(_0x1db522){logger[_0xfb43('0x17')]('['+[_0x1095d6['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xfb43('0x50')](_0x1db522,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xaf20=['adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','Getting\x20user\x20list','agentEmail','length','userId','User\x20found:','Admin\x20selected','userEmail','adminEmail','/api/lookup?q=','&f=','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20work_number:','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','POST','getString','add','YYYY-MM-DDTHH:mm:ss','task','/contacts/','user:%s','trigger:browser:url','Token\x20token=','remoteUri','serverUrl','stripTrailingSlash','username','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','email','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','ticketId','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','lodash','util','moment','bluebird','ioredis','./util','../../../../config/logger','defaults','redis','localhost','/api/selector/owners','headers','info','then','users'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xaf20,0xd2));var _0x0af2=function(_0x19e716,_0x557cd0){_0x19e716=_0x19e716-0x0;var _0x356129=_0xaf20[_0x19e716];return _0x356129;};'use strict';var _=require(_0x0af2('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x0af2('0x1'));var moment=require(_0x0af2('0x2'));var Promise=require(_0x0af2('0x3'));var Redis=require(_0x0af2('0x4'));var intUtil=require(_0x0af2('0x5'));var config=require('../../../../config/environment');var logger=require(_0x0af2('0x6'))('freshsales');config['redis']=_[_0x0af2('0x7')](config[_0x0af2('0x8')],{'host':_0x0af2('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0af2('0x8')]));function getAdminId(_0x4a4ae2,_0x3787ff,_0x415590,_0x2c00a1){return new Promise(function(_0x5c0cf1,_0x4bc4f8){var _0x2503e1=![];var _0x44cc10={'method':'GET','uri':_0x2c00a1+_0x0af2('0xa'),'json':!![]};_0x44cc10[_0x0af2('0xb')]=_0x415590;logger[_0x0af2('0xc')]('Getting\x20admin\x20information');return rp(_0x44cc10)[_0x0af2('0xd')](function(_0x1f116d){if(_0x1f116d){var _0x5c0ab2=_0x1f116d[_0x0af2('0xe')];var _0x418b80=null;for(_0x418b80=0x0;_0x418b80<_0x5c0ab2['length'];_0x418b80++){if(_0x5c0ab2[_0x418b80]['email']===_0x4a4ae2['adminEmail']){_0x4a4ae2[_0x0af2('0xf')]=_0x5c0ab2[_0x418b80]['id'];_0x2503e1=!![];}}if(_0x2503e1){logger[_0x0af2('0xc')](_0x0af2('0x10'),_0x4a4ae2['adminId']);_0x5c0cf1(_0x4a4ae2);}else{_0x4bc4f8({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4bc4f8({'statusCode':0x194,'message':_0x0af2('0x11')});}})[_0x0af2('0x12')](function(_0x110a55){logger[_0x0af2('0x13')]('['+[_0x3787ff[_0x0af2('0x14')]()]+']',_0x110a55[_0x0af2('0x15')]);_0x4bc4f8(_0x110a55);});});}function getUser(_0x24ff8a,_0x32b153,_0x53a8d7){return function(_0x229194){return new Promise(function(_0x58026f,_0x6e8d11){var _0x467f45={'method':_0x0af2('0x16'),'uri':_0x53a8d7+_0x0af2('0xa'),'json':!![]};_0x467f45['headers']=_0x32b153;logger['info'](_0x0af2('0x17'));return rp(_0x467f45)[_0x0af2('0xd')](function(_0x2ca95f){if(_0x2ca95f){var _0x3cda75=_0x2ca95f[_0x0af2('0xe')];var _0xd6c619=![];var _0x134be6=null;if(_0x229194[_0x0af2('0x18')]!==null){logger[_0x0af2('0xc')]('Getting\x20user\x20with\x20email',_0x229194['agentEmail']);_0x229194['userEmail']=_0x229194['agentEmail'];for(_0x134be6=0x0;_0x134be6<_0x3cda75[_0x0af2('0x19')];_0x134be6++){if(_0x3cda75[_0x134be6]['email']===_0x229194[_0x0af2('0x18')]){_0xd6c619=!![];_0x229194[_0x0af2('0x1a')]=_0x3cda75[_0x134be6]['id'];logger['info'](_0x0af2('0x1b'),_0x229194[_0x0af2('0x1a')]);}}}if(!_0xd6c619){logger[_0x0af2('0xc')](_0x0af2('0x1c'));_0x229194[_0x0af2('0x1d')]=_0x229194[_0x0af2('0x1e')];_0x229194[_0x0af2('0x1a')]=_0x229194[_0x0af2('0xf')];_0xd6c619=!![];}if(_0xd6c619){_0x58026f(_0x229194);}else{_0x6e8d11({'statusCode':0x194,'message':_0x0af2('0x11')});}}else{_0x6e8d11({'statusCode':0x194,'message':_0x0af2('0x11')});}})[_0x0af2('0x12')](function(_0x3b576e){logger[_0x0af2('0x13')]('['+[_0x24ff8a[_0x0af2('0x14')]()]+']',_0x3b576e[_0x0af2('0x15')]);_0x6e8d11(_0x3b576e);});});};}function searchContact(_0xc7dc14,_0x475d1f,_0x4a0eee,_0x1fec02){return new Promise(function(_0x38a94a,_0x3f1d31){var _0x4dedba={'method':_0x0af2('0x16'),'headers':_0x475d1f,'uri':_0xc7dc14+_0x0af2('0x1f')+_0x1fec02+_0x0af2('0x20')+_0x4a0eee+'&entities=contact','json':!![]};rp(_0x4dedba)[_0x0af2('0xd')](function(_0x26f6bc){var _0x403715=_['find'](_0x26f6bc['contacts'][_0x0af2('0x21')],[_0x4a0eee,_0x1fec02]);_0x38a94a(_0x403715);})[_0x0af2('0x12')](function(_0x15e778){_0x3f1d31(_0x15e778);});});}function getEndUser(_0x3eb723,_0x22c75b,_0x4b64af){return function(_0x840b1f){return new Promise(function(_0x547361,_0x63569){logger[_0x0af2('0xc')](util[_0x0af2('0x22')](_0x0af2('0x23'),_0x840b1f[_0x0af2('0x24')]));searchContact(_0x4b64af,_0x22c75b,_0x0af2('0x25'),_0x840b1f[_0x0af2('0x24')])[_0x0af2('0xd')](function(_0x311562){if(_0x311562){_0x840b1f[_0x0af2('0x26')]=_0x311562['id'];logger['info']('Contact\x20found\x20mobile_number:',_0x840b1f[_0x0af2('0x26')]);return _0x547361(_0x840b1f);}searchContact(_0x4b64af,_0x22c75b,'work_number',_0x840b1f['contactNumber'])[_0x0af2('0xd')](function(_0x9a7cdc){if(_0x9a7cdc){_0x840b1f[_0x0af2('0x26')]=_0x9a7cdc['id'];logger[_0x0af2('0xc')](_0x0af2('0x27'),_0x840b1f[_0x0af2('0x26')]);return _0x547361(_0x840b1f);}createEndUser(_0x840b1f,_0x3eb723,_0x22c75b,_0x4b64af)[_0x0af2('0xd')](function(_0x24e9c1){logger[_0x0af2('0xc')]('Contact\x20created:',_0x24e9c1[_0x0af2('0x26')]);return _0x547361(_0x24e9c1);});});})[_0x0af2('0x12')](function(_0x3a65dc){_0x63569(_0x3a65dc);});});};}function createEndUser(_0x21d5e4,_0x3f43fd,_0x2c8f4e,_0x26b223){return new Promise(function(_0x3e5e98,_0x4ccff8){var _0x114f45=moment();var _0x443230={'method':'POST','uri':_0x26b223+_0x0af2('0x28'),'body':{'contact':{'last_name':_0x21d5e4[_0x0af2('0x24')],'work_number':_0x21d5e4[_0x0af2('0x24')],'mobile_number':_0x21d5e4[_0x0af2('0x24')],'owner_id':_0x21d5e4['userId'],'created_at':_0x114f45[_0x0af2('0x22')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x443230[_0x0af2('0xb')]=_0x2c8f4e;logger[_0x0af2('0xc')](_0x0af2('0x29'));return rp(_0x443230)[_0x0af2('0xd')](function(_0x1a8826){_0x21d5e4['endUserId']=_0x1a8826[_0x0af2('0x2a')]['id'];_0x3e5e98(_0x21d5e4);})[_0x0af2('0x12')](function(_0xfbe790){logger[_0x0af2('0x13')]('['+[_0x3f43fd[_0x0af2('0x14')]()]+']',_0xfbe790[_0x0af2('0x15')]);_0x4ccff8(_0xfbe790['message']);});});}function getTicket(_0x16803a,_0x3f5abd,_0x5b84fd,_0xe53ec2,_0x15fae7){return function(_0x4c46c8){logger[_0x0af2('0xc')]('Creating\x20new\x20task');return new Promise(function(_0x5c8b96,_0x1e9661){var _0x37bb08=moment();var _0x2fb600={'method':_0x0af2('0x2b'),'uri':_0x5b84fd+'/api/tasks','body':{'title':intUtil[_0x0af2('0x2c')](_0xe53ec2['Subjects'],_0x15fae7,'\x20'),'description':intUtil[_0x0af2('0x2c')](_0xe53ec2['Descriptions'],_0x15fae7,'\x0a'),'owner_id':_0x4c46c8[_0x0af2('0x1a')],'creater_id':_0x4c46c8[_0x0af2('0xf')],'targetable_id':_0x4c46c8[_0x0af2('0x26')],'targetable_type':'Contact','created_at':_0x37bb08[_0x0af2('0x22')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x37bb08[_0x0af2('0x2d')](0x1e,'m')['format'](_0x0af2('0x2e'))},'json':!![]};_0x2fb600[_0x0af2('0xb')]=_0x3f5abd;return rp(_0x2fb600)[_0x0af2('0xd')](function(_0x1b3e6e){_0x4c46c8['ticketId']=_0x1b3e6e[_0x0af2('0x2f')]['id'];logger[_0x0af2('0xc')]('Task\x20created:',_0x4c46c8['ticketId']);_0x5c8b96(_0x4c46c8);})[_0x0af2('0x12')](function(_0x16a950){logger['error']('['+[_0x16803a[_0x0af2('0x14')]()]+']',_0x16a950[_0x0af2('0x15')]);_0x1e9661(_0x16a950[_0x0af2('0x15')]);});});};}function emit(_0x4f425b,_0x193ceb,_0x1f856c){var _0x1ae466={'uri':_0x4f425b+_0x0af2('0x30')+_0x1f856c};io['to'](util['format'](_0x0af2('0x31'),_0x193ceb))['emit'](_0x0af2('0x32'),_0x1ae466);}exports['cs']=function(_0x420036,_0x48a61f,_0x3d76ce,_0x40fd8e,_0x2e6498,_0x44c796,_0x3a48b4,_0x1f584d){var _0x523fb1={};var _0x500b20={'Authorization':_0x0af2('0x33')+_0x44c796['apiKey']};_0x44c796[_0x0af2('0x34')]=intUtil['stripTrailingSlash'](_0x44c796[_0x0af2('0x34')]);_0x44c796[_0x0af2('0x35')]=intUtil[_0x0af2('0x36')](_0x44c796[_0x0af2('0x35')]);var _0x567d5f=_0x44c796[_0x0af2('0x34')];_0x523fb1[_0x0af2('0x1e')]=_0x44c796[_0x0af2('0x37')];_0x523fb1[_0x0af2('0x24')]=_0x1f584d['toLowerCase']()==='outbound'?_0x48a61f[_0x0af2('0x38')]:_0x48a61f[_0x0af2('0x39')];_0x523fb1[_0x0af2('0x3a')]=_0x1f584d===_0x0af2('0x3b')||_0x1f584d===_0x0af2('0x3c')?_0x0af2('0x3b'):_0x0af2('0x3d');if(_0x40fd8e){_0x523fb1[_0x0af2('0x18')]=_0x40fd8e[_0x0af2('0x3e')];}var _0x18e157=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x44c796[_0x0af2('0x35')],_0x48a61f[_0x0af2('0x3f')],md5(_0x48a61f[_0x0af2('0x3f')]));if(_0x2e6498&&_0x2e6498[_0x0af2('0x40')]){logger['info'](_0x0af2('0x41'),'Recording\x20is\x20enabled!');_0x48a61f[_0x0af2('0x42')]=_0x18e157;}else if(_0x3a48b4&&_0x3a48b4[_0x0af2('0x43')]&&_0x3a48b4[_0x0af2('0x43')]!==_0x0af2('0x44')){logger[_0x0af2('0xc')](_0x0af2('0x45'),_0x0af2('0x46'));_0x48a61f[_0x0af2('0x42')]=_0x18e157;}else{_0x48a61f[_0x0af2('0x42')]='';}return getAdminId(_0x523fb1,_0x1f584d,_0x500b20,_0x567d5f)[_0x0af2('0xd')](getUser(_0x1f584d,_0x500b20,_0x567d5f))[_0x0af2('0xd')](getEndUser(_0x1f584d,_0x500b20,_0x567d5f))['then'](getTicket(_0x1f584d,_0x500b20,_0x567d5f,_0x3d76ce,_0x48a61f))[_0x0af2('0xd')](function(_0x32af67){logger[_0x0af2('0xc')](util['format'](_0x0af2('0x47'),_0x32af67[_0x0af2('0x48')]));if(_0x1f584d!==_0x0af2('0x3c')){logger[_0x0af2('0xc')]('['+[_0x1f584d['toUpperCase']()]+']',_0x0af2('0x49'));emit(_0x567d5f,_0x40fd8e[_0x0af2('0x4a')],_0x32af67[_0x0af2('0x26')]);}})['catch'](function(_0x4f99b7){logger[_0x0af2('0x13')]('['+[_0x1f584d['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x4f99b7,{'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 8dc8fe7..78d316c 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 _0xa793=['data1','toLowerCase','data2','find','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','zendesk','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./sugarcrm','./zoho','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes'];(function(_0x21205e,_0x7eb8e7){var _0x136ebb=function(_0x54aac2){while(--_0x54aac2){_0x21205e['push'](_0x21205e['shift']());}};_0x136ebb(++_0x7eb8e7);}(_0xa793,0x7a));var _0x3a79=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0xa793[_0x1ee351];return _0x245aaf;};'use strict';var _=require(_0x3a79('0x0'));var util=require(_0x3a79('0x1'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0x3a79('0x2'));var freshdesk=require('./freshdesk');var zoho=require(_0x3a79('0x3'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0x3a79('0x4'));var dynamics365=require(_0x3a79('0x5'));var freshsales=require(_0x3a79('0x6'));var integrations=['zendesk',_0x3a79('0x7'),_0x3a79('0x8'),_0x3a79('0x9'),_0x3a79('0xa'),_0x3a79('0xb'),_0x3a79('0xc'),_0x3a79('0xd'),_0x3a79('0xe'),_0x3a79('0xf')];exports[_0x3a79('0x10')]=function(_0x285e23,_0x543d6e,_0x4189e2,_0x2fa216,_0x4e4f2f,_0x91b976){if(_0x4189e2){if(_[_0x3a79('0x11')](integrations,_0x285e23[_0x3a79('0x12')][_0x3a79('0x13')]())){try{var _0x52ad9f=null;var _0x281393='';var _0x20decc=_0x4189e2[_0x285e23[_0x3a79('0x12')]['toLowerCase']()];if(_0x20decc){var _0x3467a7=_0x20decc[_0x285e23[_0x3a79('0x14')]];if(_0x3467a7){var _0x35bcfa=_[_0x3a79('0x15')](_0x3467a7['Configurations'],{'id':parseInt(_0x285e23['data3'],0xa)});if(_0x35bcfa){if(_0x2fa216){if(_0x4e4f2f&&_0x543d6e[_0x3a79('0x16')]){_0x281393=_0x3a79('0x16');}else if(_0x543d6e[_0x3a79('0x17')]){_0x281393=_0x3a79('0x18');}else{console['log'](_0x3a79('0x19'),_0x543d6e);}}else{_0x281393=_0x3a79('0x1a');}switch(_0x285e23[_0x3a79('0x12')][_0x3a79('0x13')]()){case _0x3a79('0x1b'):zendesk[_0x281393](_0x285e23,_0x543d6e,_0x35bcfa,_0x2fa216,_0x4e4f2f,_0x3467a7,_0x91b976);break;case _0x3a79('0x7'):salesforce[_0x281393](_0x285e23,_0x543d6e,_0x35bcfa,_0x2fa216,_0x4e4f2f,_0x3467a7,_0x91b976);break;case'sugarcrm':sugarcrm[_0x281393](_0x285e23,_0x543d6e,_0x35bcfa,_0x2fa216,_0x4e4f2f,_0x3467a7,_0x91b976);break;case _0x3a79('0x9'):freshdesk[_0x281393](_0x285e23,_0x543d6e,_0x35bcfa,_0x2fa216,_0x4e4f2f,_0x3467a7,_0x91b976);break;case _0x3a79('0xa'):zoho[_0x281393](_0x285e23,_0x543d6e,_0x35bcfa,_0x2fa216,_0x4e4f2f,_0x3467a7,_0x91b976);break;case _0x3a79('0xb'):desk[_0x281393](_0x285e23,_0x543d6e,_0x35bcfa,_0x2fa216,_0x4e4f2f,_0x3467a7,_0x91b976);break;case _0x3a79('0xc'):vtiger[_0x281393](_0x285e23,_0x543d6e,_0x35bcfa,_0x2fa216,_0x4e4f2f,_0x3467a7,_0x91b976);break;case'freshsales':freshsales['cs'](_0x285e23,_0x543d6e,_0x35bcfa,_0x2fa216,_0x4e4f2f,_0x3467a7,_0x91b976,_0x281393);break;case _0x3a79('0xf'):servicenow['cs'](_0x285e23,_0x543d6e,_0x35bcfa,_0x2fa216,_0x4e4f2f,_0x3467a7,_0x91b976,_0x281393);break;case _0x3a79('0xd'):dynamics365['cs'](_0x285e23,_0x543d6e,_0x35bcfa,_0x2fa216,_0x4e4f2f,_0x3467a7,_0x91b976,_0x281393);break;default:console['log'](_0x3a79('0x1c'));}}else{_0x52ad9f=require(_0x3a79('0x1d'))(_0x285e23[_0x3a79('0x12')][_0x3a79('0x13')]());_0x52ad9f[_0x3a79('0x1e')]('[EXEC]',util[_0x3a79('0x1f')](_0x3a79('0x20'),_0x285e23[_0x3a79('0x12')][_0x3a79('0x13')](),_0x285e23['data3']));}}else{_0x52ad9f=require(_0x3a79('0x1d'))(_0x285e23[_0x3a79('0x12')][_0x3a79('0x13')]());_0x52ad9f[_0x3a79('0x1e')](_0x3a79('0x21'),util['format'](_0x3a79('0x22'),_0x285e23[_0x3a79('0x12')][_0x3a79('0x13')](),_0x285e23[_0x3a79('0x14')]));}}else{}}catch(_0x1d7777){console[_0x3a79('0x1e')](_0x1d7777);}}}}; \ No newline at end of file +var _0xdf13=['EVENT\x20UNKNOWN','zendesk','zoho','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','salesforce','sugarcrm','freshdesk','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf13,0x11b));var _0x3df1=function(_0x2b0b61,_0x170827){_0x2b0b61=_0x2b0b61-0x0;var _0x2ae144=_0xdf13[_0x2b0b61];return _0x2ae144;};'use strict';var _=require(_0x3df1('0x0'));var util=require(_0x3df1('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x3df1('0x2'));var sugarcrm=require(_0x3df1('0x3'));var freshdesk=require(_0x3df1('0x4'));var zoho=require(_0x3df1('0x5'));var desk=require(_0x3df1('0x6'));var vtiger=require(_0x3df1('0x7'));var servicenow=require('./servicenow');var dynamics365=require(_0x3df1('0x8'));var freshsales=require('./freshsales');var integrations=['zendesk',_0x3df1('0x9'),_0x3df1('0xa'),_0x3df1('0xb'),'zoho',_0x3df1('0xc'),_0x3df1('0xd'),_0x3df1('0xe'),_0x3df1('0xf'),_0x3df1('0x10')];exports[_0x3df1('0x11')]=function(_0x481372,_0x101a1d,_0x2a4f59,_0xbd4890,_0x73eacd,_0x4ec93f){if(_0x2a4f59){if(_[_0x3df1('0x12')](integrations,_0x481372[_0x3df1('0x13')][_0x3df1('0x14')]())){try{var _0x588ea3=null;var _0x2f2ac5='';var _0x2593e7=_0x2a4f59[_0x481372[_0x3df1('0x13')]['toLowerCase']()];if(_0x2593e7){var _0x40ab5b=_0x2593e7[_0x481372[_0x3df1('0x15')]];if(_0x40ab5b){var _0x3bfff7=_[_0x3df1('0x16')](_0x40ab5b[_0x3df1('0x17')],{'id':parseInt(_0x481372[_0x3df1('0x18')],0xa)});if(_0x3bfff7){if(_0xbd4890){if(_0x73eacd&&_0x101a1d[_0x3df1('0x19')]){_0x2f2ac5='queue';}else if(_0x101a1d[_0x3df1('0x1a')]){_0x2f2ac5=_0x3df1('0x1b');}else{console[_0x3df1('0x1c')](_0x3df1('0x1d'),_0x101a1d);}}else{_0x2f2ac5='unmanaged';}switch(_0x481372[_0x3df1('0x13')][_0x3df1('0x14')]()){case _0x3df1('0x1e'):zendesk[_0x2f2ac5](_0x481372,_0x101a1d,_0x3bfff7,_0xbd4890,_0x73eacd,_0x40ab5b,_0x4ec93f);break;case'salesforce':salesforce[_0x2f2ac5](_0x481372,_0x101a1d,_0x3bfff7,_0xbd4890,_0x73eacd,_0x40ab5b,_0x4ec93f);break;case _0x3df1('0xa'):sugarcrm[_0x2f2ac5](_0x481372,_0x101a1d,_0x3bfff7,_0xbd4890,_0x73eacd,_0x40ab5b,_0x4ec93f);break;case'freshdesk':freshdesk[_0x2f2ac5](_0x481372,_0x101a1d,_0x3bfff7,_0xbd4890,_0x73eacd,_0x40ab5b,_0x4ec93f);break;case _0x3df1('0x1f'):zoho[_0x2f2ac5](_0x481372,_0x101a1d,_0x3bfff7,_0xbd4890,_0x73eacd,_0x40ab5b,_0x4ec93f);break;case'desk':desk[_0x2f2ac5](_0x481372,_0x101a1d,_0x3bfff7,_0xbd4890,_0x73eacd,_0x40ab5b,_0x4ec93f);break;case _0x3df1('0xd'):vtiger[_0x2f2ac5](_0x481372,_0x101a1d,_0x3bfff7,_0xbd4890,_0x73eacd,_0x40ab5b,_0x4ec93f);break;case _0x3df1('0xf'):freshsales['cs'](_0x481372,_0x101a1d,_0x3bfff7,_0xbd4890,_0x73eacd,_0x40ab5b,_0x4ec93f,_0x2f2ac5);break;case'servicenow':servicenow['cs'](_0x481372,_0x101a1d,_0x3bfff7,_0xbd4890,_0x73eacd,_0x40ab5b,_0x4ec93f,_0x2f2ac5);break;case'dynamics365':dynamics365['cs'](_0x481372,_0x101a1d,_0x3bfff7,_0xbd4890,_0x73eacd,_0x40ab5b,_0x4ec93f,_0x2f2ac5);break;default:console['log'](_0x3df1('0x20'));}}else{_0x588ea3=require(_0x3df1('0x21'))(_0x481372[_0x3df1('0x13')][_0x3df1('0x14')]());_0x588ea3[_0x3df1('0x22')](_0x3df1('0x23'),util[_0x3df1('0x24')](_0x3df1('0x25'),_0x481372[_0x3df1('0x13')]['toLowerCase'](),_0x481372[_0x3df1('0x18')]));}}else{_0x588ea3=require('../../../../config/logger')(_0x481372[_0x3df1('0x13')][_0x3df1('0x14')]());_0x588ea3[_0x3df1('0x22')](_0x3df1('0x23'),util[_0x3df1('0x24')](_0x3df1('0x26'),_0x481372[_0x3df1('0x13')]['toLowerCase'](),_0x481372['data2']));}}else{}}catch(_0x43b1dd){console['error'](_0x43b1dd);}}}}; \ 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 c76cbe1..d1cc9cd 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 _0xc623=['none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','outbound','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','getString','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','WhoId','account','WhatId','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','find','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','execute','length','$or','Lead','account_contact_lead','additionalSearchAccount','additionalSearchLead','Contact','lead','Account','first','Name','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat'];(function(_0x1edaaa,_0x48e785){var _0x51ae3c=function(_0x1aae98){while(--_0x1aae98){_0x1edaaa['push'](_0x1edaaa['shift']());}};_0x51ae3c(++_0x48e785);}(_0xc623,0x110));var _0x3c62=function(_0x5a2535,_0x1e3af2){_0x5a2535=_0x5a2535-0x0;var _0x40f37a=_0xc623[_0x5a2535];return _0x40f37a;};'use strict';var _=require(_0x3c62('0x0'));var rp=require(_0x3c62('0x1'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x3c62('0x2'));var jsforce=require(_0x3c62('0x3'));var util=require(_0x3c62('0x4'));var Redis=require('ioredis');var intUtil=require(_0x3c62('0x5'));var config=require(_0x3c62('0x6'));var logger=require(_0x3c62('0x7'))(_0x3c62('0x8'));config[_0x3c62('0x9')]=_[_0x3c62('0xa')](config[_0x3c62('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x3c62('0xb'))(new Redis(config[_0x3c62('0x9')]));function emit(_0x19daa5,_0x285ab9,_0x25a845){io['to'](_0x19daa5)['emit'](_0x285ab9,_0x25a845);}function getTicket(_0x36b00a,_0x2860c5,_0x739c34,_0x4e4be7,_0x55c7ad,_0x5c3d0c,_0x25e0df,_0x168de2){var _0x1a6783=Object['assign']({},{'OwnerId':_0x2860c5['id'],'Subject':intUtil[_0x3c62('0xc')](_0x4e4be7['Subjects'],_0x55c7ad,'\x20'),'Description':intUtil[_0x3c62('0xc')](_0x4e4be7[_0x3c62('0xd')],_0x55c7ad,'\x0a')},getCustomFields(_0x5c3d0c,_0x55c7ad));if(_0x739c34){if(_0x4e4be7[_0x3c62('0xe')]===_0x3c62('0xf')){_0x1a6783[_0x3c62('0x10')]=moment['utc']();_0x1a6783[_0x3c62('0x11')]=![];_0x1a6783[_0x3c62('0x12')]=![];if(_0x739c34[_0x3c62('0x13')]===_0x3c62('0x14')||_0x739c34[_0x3c62('0x13')]==='lead'){_0x1a6783[_0x3c62('0x15')]=_0x739c34['id'];}else if(_0x739c34[_0x3c62('0x13')]===_0x3c62('0x16')){_0x1a6783[_0x3c62('0x17')]=_0x739c34['id'];}}else if(_0x4e4be7[_0x3c62('0xe')]==='Case'){if(_0x739c34[_0x3c62('0x13')]==='contact'){_0x1a6783[_0x3c62('0x18')]=_0x739c34['id'];}else if(_0x739c34[_0x3c62('0x13')]===_0x3c62('0x16')){_0x1a6783[_0x3c62('0x19')]=_0x739c34['id'];}else if(_0x739c34['endUserType']==='lead'&&_0x4e4be7[_0x3c62('0x1a')]){_0x1a6783[_0x4e4be7['leadId']]=_0x739c34['id'];}else{logger[_0x3c62('0x1b')](_0x3c62('0x1c'));}}}return _0x25e0df[_0x3c62('0x1d')](_0x4e4be7[_0x3c62('0xe')])[_0x3c62('0x1e')](_0x1a6783);}function getUser(_0x35fd85,_0x3b7a0f,_0x3d66da){if(!_[_0x3c62('0x1f')](_0x3b7a0f)&&intUtil[_0x3c62('0x20')](_0x3b7a0f)){var _0x167f67={'Email':_0x3b7a0f};var _0x12f01e={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3d66da[_0x3c62('0x1d')]('User')[_0x3c62('0x21')](_0x167f67,_0x12f01e)['execute']()['then'](function(_0x4682e0){if(_0x4682e0['length']){var _0x5a40e7=_[_0x3c62('0x21')](_0x4682e0,function(_0x5d4211){return _0x5d4211['Email']===_0x3b7a0f;});if(_0x5a40e7){logger['info'](_0x3c62('0x22'),_0x3b7a0f);return BPromise[_0x3c62('0x23')]({'id':_0x5a40e7['Id'],'name':_0x5a40e7['Name']});}}else{logger[_0x3c62('0x1b')](_0x3c62('0x24'),_0x3b7a0f);return _0x3d66da[_0x3c62('0x25')]()[_0x3c62('0x26')](function(_0x4f98b5){return BPromise[_0x3c62('0x23')]({'id':_0x4f98b5[_0x3c62('0x27')],'name':_0x4f98b5[_0x3c62('0x28')]});});}});}else{logger[_0x3c62('0x1b')](_0x3c62('0x24'),_0x3b7a0f);return _0x3d66da[_0x3c62('0x25')]()[_0x3c62('0x26')](function(_0x347579){return BPromise[_0x3c62('0x23')]({'id':_0x347579[_0x3c62('0x27')],'name':_0x347579[_0x3c62('0x28')]});});}}function getEndUser(_0x4b3d4e,_0x36ad06,_0x358e3d,_0x33b580,_0x17d56){var _0x52c0c7={'$or':{'Phone':_0x33b580}};var _0x34b460={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x3c62('0x23')]()[_0x3c62('0x26')](function(){logger['info'](_0x3c62('0x29'),_0x33b580,_0x36ad06[_0x3c62('0x2a')]);switch(_0x36ad06[_0x3c62('0x2a')]){case _0x3c62('0x2b'):var _0x4828ea=_[_0x3c62('0x2c')](_0x52c0c7);if(_0x36ad06[_0x3c62('0x2d')]){var _0x734754={};_0x734754[_0x36ad06[_0x3c62('0x2d')]]=_0x33b580;_[_0x3c62('0x2e')](_0x4828ea['$or'],_0x734754);}return _0x17d56[_0x3c62('0x1d')]('Contact')[_0x3c62('0x21')](_0x4828ea,_0x34b460)[_0x3c62('0x2f')]()[_0x3c62('0x26')](function(_0x58e984){if(_0x58e984&&_0x58e984[_0x3c62('0x30')]){return _0x58e984;}else{var _0x46d2c6=_['cloneDeep'](_0x52c0c7);if(_0x36ad06['additionalSearchLead']){var _0x3d5406={};_0x3d5406[_0x36ad06['additionalSearchLead']]=_0x33b580;_['merge'](_0x46d2c6[_0x3c62('0x31')],_0x3d5406);}return _0x17d56[_0x3c62('0x1d')](_0x3c62('0x32'))[_0x3c62('0x21')](_0x46d2c6,_0x34b460);}});case _0x3c62('0x33'):var _0x2a8b43=_['cloneDeep'](_0x52c0c7);if(_0x36ad06[_0x3c62('0x34')]){var _0x734754={};_0x734754[_0x36ad06[_0x3c62('0x34')]]=_0x33b580;_[_0x3c62('0x2e')](_0x2a8b43['$or'],_0x734754);}return _0x17d56['sobject']('Account')[_0x3c62('0x21')](_0x2a8b43,_0x34b460)['execute']()['then'](function(_0xeb275f){if(_0xeb275f&&_0xeb275f[_0x3c62('0x30')]){return _0xeb275f;}else{var _0x1bbc57=_['cloneDeep'](_0x52c0c7);if(_0x36ad06[_0x3c62('0x2d')]){var _0x124d06={};_0x124d06[_0x36ad06[_0x3c62('0x2d')]]=_0x33b580;_[_0x3c62('0x2e')](_0x1bbc57[_0x3c62('0x31')],_0x124d06);}return _0x17d56[_0x3c62('0x1d')]('Contact')[_0x3c62('0x21')](_0x1bbc57,_0x34b460)[_0x3c62('0x26')](function(_0x1a980f){if(_0x1a980f&&_0x1a980f[_0x3c62('0x30')]){return _0x1a980f;}else{var _0x5726df=_[_0x3c62('0x2c')](_0x52c0c7);if(_0x36ad06[_0x3c62('0x35')]){var _0x3565b8={};_0x3565b8[_0x36ad06['additionalSearchLead']]=_0x33b580;_[_0x3c62('0x2e')](_0x5726df[_0x3c62('0x31')],_0x3565b8);}return _0x17d56['sobject'](_0x3c62('0x32'))[_0x3c62('0x21')](_0x5726df,_0x34b460);}});}});case _0x3c62('0x14'):var _0x4828ea=_[_0x3c62('0x2c')](_0x52c0c7);if(_0x36ad06['additionalSearchContact']){var _0x734754={};_0x734754[_0x36ad06[_0x3c62('0x2d')]]=_0x33b580;_[_0x3c62('0x2e')](_0x4828ea[_0x3c62('0x31')],_0x734754);}return _0x17d56[_0x3c62('0x1d')](_0x3c62('0x36'))[_0x3c62('0x21')](_0x4828ea,_0x34b460)[_0x3c62('0x2f')]();case _0x3c62('0x37'):var _0x48c65b=_['cloneDeep'](_0x52c0c7);if(_0x36ad06[_0x3c62('0x35')]){var _0x734754={};_0x734754[_0x36ad06[_0x3c62('0x35')]]=_0x33b580;_['merge'](_0x48c65b[_0x3c62('0x31')],_0x734754);}return _0x17d56[_0x3c62('0x1d')](_0x3c62('0x32'))[_0x3c62('0x21')](_0x48c65b,_0x34b460);case _0x3c62('0x16'):var _0x2a8b43=_[_0x3c62('0x2c')](_0x52c0c7);if(_0x36ad06[_0x3c62('0x34')]){var _0x734754={};_0x734754[_0x36ad06[_0x3c62('0x34')]]=_0x33b580;_[_0x3c62('0x2e')](_0x2a8b43['$or'],_0x734754);}return _0x17d56['sobject'](_0x3c62('0x38'))[_0x3c62('0x21')](_0x2a8b43,_0x34b460);default:return null;}})[_0x3c62('0x26')](function(_0x2cce02){if(_0x2cce02&&_0x2cce02[_0x3c62('0x30')]){var _0x211366=_[_0x3c62('0x39')](_0x2cce02);if(_0x211366){return BPromise['resolve']({'id':_0x211366['Id'],'name':_0x211366[_0x3c62('0x3a')],'phone':_0x211366['Phone'],'endUserType':_0x211366[_0x3c62('0x3b')][_0x3c62('0x3c')][_0x3c62('0x3d')]()});}}})[_0x3c62('0x26')](function(_0x2307a2){if(_0x2307a2){logger[_0x3c62('0x1b')](_0x3c62('0x3e'),_0x2307a2[_0x3c62('0x13')],_0x33b580);return BPromise[_0x3c62('0x23')](_0x2307a2);}else{logger[_0x3c62('0x1b')](_0x3c62('0x3f'),_0x33b580);var _0x3f8ebd={'Phone':_0x33b580};if(_0x36ad06[_0x3c62('0x40')]){if(_0x36ad06['moduleCreate']===_0x3c62('0x14')){logger[_0x3c62('0x1b')](_0x3c62('0x41'),_0x33b580,_0x36ad06[_0x3c62('0x40')]);_0x3f8ebd[_0x3c62('0x42')]=_0x358e3d!==_0x3c62('0x43')?_0x358e3d:util[_0x3c62('0x44')](_0x3c62('0x45'),_0x33b580);}else if(_0x36ad06[_0x3c62('0x40')]===_0x3c62('0x37')){logger[_0x3c62('0x1b')](_0x3c62('0x41'),_0x33b580,_0x36ad06['moduleCreate']);_0x3f8ebd[_0x3c62('0x42')]=_0x358e3d!==''?_0x358e3d:util[_0x3c62('0x44')](_0x3c62('0x45'),_0x33b580);_0x3f8ebd[_0x3c62('0x46')]=_0x3c62('0x47');}else if(_0x36ad06[_0x3c62('0x40')]===_0x3c62('0x16')){logger['info'](_0x3c62('0x41'),_0x33b580,_0x36ad06[_0x3c62('0x40')]);_0x3f8ebd[_0x3c62('0x3a')]=_0x358e3d!==_0x3c62('0x43')?_0x358e3d:util[_0x3c62('0x44')](_0x3c62('0x45'),_0x33b580);}else{return null;}}return _0x17d56[_0x3c62('0x1d')](_[_0x3c62('0x48')](_0x36ad06['moduleCreate']))['create'](_0x3f8ebd)[_0x3c62('0x26')](function(_0x35aab9){return BPromise[_0x3c62('0x23')]({'id':_0x35aab9['id'],'endUserType':_0x36ad06[_0x3c62('0x40')]});});}});}function getCustomFields(_0x59c2db,_0x466a95){var _0x3d8661={};if(_0x59c2db[_0x3c62('0x30')]>0x0){_[_0x3c62('0x49')](_0x59c2db,function(_0x384b65){if(_[_0x3c62('0x4a')]([_0x3c62('0x4b'),_0x3c62('0x4c')],_0x384b65[_0x3c62('0x3c')])&&_0x384b65[_0x3c62('0x4d')]){_0x3d8661[_0x384b65[_0x3c62('0x4d')]]=_0x384b65[_0x3c62('0x4e')][_0x3c62('0x4f')]();}else if(_0x384b65['type']===_0x3c62('0x50')&&_0x384b65['variableName']&&_0x384b65[_0x3c62('0x4d')]){_0x466a95[_0x384b65[_0x3c62('0x51')]]&&(_0x3d8661[_0x384b65['idField']]=_0x466a95[_0x384b65[_0x3c62('0x51')]][_0x3c62('0x4f')]());}else if(_0x384b65[_0x3c62('0x3c')]===_0x3c62('0x52')&&_0x384b65[_0x3c62('0x53')]&&_0x384b65['Variable']['name']&&_0x384b65['idField']){_0x466a95[_0x384b65[_0x3c62('0x53')][_0x3c62('0x54')][_0x3c62('0x3d')]()]&&(_0x3d8661[_0x384b65[_0x3c62('0x4d')]]=_0x466a95[_0x384b65[_0x3c62('0x53')][_0x3c62('0x54')][_0x3c62('0x3d')]()][_0x3c62('0x4f')]());}});}return _0x3d8661;}function getConnection(_0x51eac0){var _0x57abb2=_0x51eac0[_0x3c62('0x55')][_0x3c62('0x56')](_0x51eac0['securityToken']);var _0x134ad0=new jsforce[(_0x3c62('0x57'))]({'oauth2':{'loginUrl':_0x51eac0[_0x3c62('0x58')]||_0x3c62('0x59'),'clientId':_0x51eac0[_0x3c62('0x5a')],'clientSecret':_0x51eac0[_0x3c62('0x5b')]}});return _0x134ad0[_0x3c62('0x5c')](_0x51eac0[_0x3c62('0x5d')],_0x57abb2)[_0x3c62('0x26')](function(){logger[_0x3c62('0x1b')](_0x3c62('0x5e'));return _0x134ad0;});}exports[_0x3c62('0x5f')]=function(_0x1c18d8,_0x3b126b,_0x19124a,_0x31dc5d,_0x39bbc4,_0x2873b5){var _0x39184a,_0x518b3c,_0x6790ed,_0x4b9fa6;_0x2873b5[_0x3c62('0x60')]=intUtil[_0x3c62('0x61')](_0x2873b5[_0x3c62('0x60')]);_0x2873b5[_0x3c62('0x58')]=intUtil[_0x3c62('0x61')](_0x2873b5[_0x3c62('0x58')]);if(_0x39bbc4&&_0x39bbc4[_0x3c62('0x62')]){logger['info'](_0x3c62('0x63'),_0x3c62('0x64'));_0x3b126b[_0x3c62('0x65')]=util[_0x3c62('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2873b5[_0x3c62('0x60')],_0x3b126b[_0x3c62('0x66')],md5(_0x3b126b[_0x3c62('0x66')]));}else{_0x3b126b[_0x3c62('0x65')]='';}return getConnection(_0x2873b5)[_0x3c62('0x26')](function(_0x177ff8){_0x4b9fa6=_0x177ff8;return getUser(_0x2873b5,_0x31dc5d[_0x3c62('0x67')],_0x4b9fa6);})[_0x3c62('0x26')](function(_0x2464da){_0x39184a=_0x2464da;return getEndUser(_0x2873b5,_0x19124a,_0x3b126b[_0x3c62('0x68')],_0x3b126b[_0x3c62('0x69')],_0x4b9fa6);})[_0x3c62('0x26')](function(_0x134215){_0x518b3c=_0x134215;return getTicket(_0x2873b5,_0x39184a,_0x518b3c,_0x19124a,_0x3b126b,_0x19124a[_0x3c62('0x6a')],_0x4b9fa6,'queue');})[_0x3c62('0x26')](function(_0x45128f){_0x6790ed=_0x45128f;logger[_0x3c62('0x1b')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x6790ed['id']);logger[_0x3c62('0x1b')](_0x3c62('0x6b'),_0x6790ed['id'],_0x31dc5d['name'],_0x2873b5[_0x3c62('0x3c')]);switch(_0x2873b5[_0x3c62('0x3c')]){case _0x3c62('0x6c'):emit(util[_0x3c62('0x44')]('user:%s',_0x31dc5d[_0x3c62('0x54')]),'trigger:salesforce:display',{'recordId':_0x6790ed['id']});break;case _0x3c62('0x6d'):emit(util['format'](_0x3c62('0x6e'),_0x31dc5d['name']),_0x3c62('0x6f'),{'uri':util[_0x3c62('0x44')](_0x3c62('0x70'),_0x4b9fa6[_0x3c62('0x71')],_0x6790ed['id'])});break;default:logger[_0x3c62('0x72')](_0x3c62('0x73'));}})[_0x3c62('0x74')](function(_0x1cfb44){logger[_0x3c62('0x72')](_0x3c62('0x63'),_0x1cfb44);});};exports['outbound']=function(_0x12445e,_0x231357,_0x4dcc85,_0x3ac409,_0x56e578,_0x518cd3,_0x2bd7be){var _0x1c1623,_0x2e80d3,_0x2c90ea,_0x203820;_0x518cd3['serverUrl']=intUtil['stripTrailingSlash'](_0x518cd3[_0x3c62('0x60')]);_0x518cd3[_0x3c62('0x58')]=intUtil[_0x3c62('0x61')](_0x518cd3[_0x3c62('0x58')]);if(_0x2bd7be&&_0x2bd7be['recordingFormat']&&_0x2bd7be[_0x3c62('0x75')]!==_0x3c62('0x76')){logger[_0x3c62('0x1b')](_0x3c62('0x77'),'Recording\x20is\x20enabled!');_0x231357[_0x3c62('0x65')]=util['format'](_0x3c62('0x78'),_0x518cd3[_0x3c62('0x60')],_0x231357['uniqueid'],md5(_0x231357[_0x3c62('0x66')]));}return getConnection(_0x518cd3)['then'](function(_0x5987f6){_0x203820=_0x5987f6;return getUser(_0x518cd3,_0x3ac409[_0x3c62('0x67')],_0x203820);})[_0x3c62('0x26')](function(_0x5435c4){_0x1c1623=_0x5435c4;return getEndUser(_0x518cd3,_0x4dcc85,_0x231357[_0x3c62('0x79')],_0x231357['destcalleridnum'],_0x203820);})[_0x3c62('0x26')](function(_0x5b9d6d){_0x2e80d3=_0x5b9d6d;return getTicket(_0x518cd3,_0x1c1623,_0x2e80d3,_0x4dcc85,_0x231357,_0x4dcc85[_0x3c62('0x6a')],_0x203820,_0x3c62('0x7a'));})[_0x3c62('0x26')](function(_0x363cd0){_0x2c90ea=_0x363cd0;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x2c90ea['id']);logger[_0x3c62('0x1b')](_0x3c62('0x7b'),_0x2c90ea['id'],_0x3ac409['name'],_0x518cd3[_0x3c62('0x3c')]);switch(_0x518cd3[_0x3c62('0x3c')]){case _0x3c62('0x6c'):emit(util['format'](_0x3c62('0x6e'),_0x3ac409[_0x3c62('0x54')]),_0x3c62('0x7c'),{'recordId':_0x2c90ea['id']});break;case'newTab':emit(util[_0x3c62('0x44')](_0x3c62('0x6e'),_0x3ac409['name']),_0x3c62('0x6f'),{'uri':util['format']('%s/%s/e',_0x203820[_0x3c62('0x71')],_0x2c90ea['id'])});break;default:logger[_0x3c62('0x72')](_0x3c62('0x77'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x3c62('0x74')](function(_0x5d548a){logger['error'](_0x3c62('0x77'),_0x5d548a);});};exports[_0x3c62('0x7d')]=function(_0x232783,_0x49eaea,_0x4084de,_0xbf6c5c,_0x21960e,_0x792014){var _0x35f08f,_0x4eb108,_0x19b36c,_0xbb6d52;_0x792014[_0x3c62('0x60')]=intUtil[_0x3c62('0x61')](_0x792014['serverUrl']);_0x792014[_0x3c62('0x58')]=intUtil[_0x3c62('0x61')](_0x792014[_0x3c62('0x58')]);if(_0x21960e&&_0x21960e[_0x3c62('0x62')]){logger[_0x3c62('0x1b')]('['+_0x49eaea[_0x3c62('0x7e')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x49eaea[_0x3c62('0x65')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x792014[_0x3c62('0x60')],_0x49eaea[_0x3c62('0x66')],md5(_0x49eaea[_0x3c62('0x66')]));}else{_0x49eaea[_0x3c62('0x65')]='';}return getConnection(_0x792014)[_0x3c62('0x26')](function(_0x2ab2f0){_0xbb6d52=_0x2ab2f0;if(!_[_0x3c62('0x1f')](_0xbf6c5c)){return getUser(_0x792014,_0xbf6c5c[_0x3c62('0x54')],_0xbb6d52);}else{return getUser(_0x792014,null,_0xbb6d52);}})['then'](function(_0x304c72){_0x35f08f=_0x304c72;return getEndUser(_0x792014,_0x4084de,_0x49eaea[_0x3c62('0x68')],_0x49eaea['calleridnum'],_0xbb6d52);})['then'](function(_0x7f29fd){_0x4eb108=_0x7f29fd;return getTicket(_0x792014,_0x35f08f,_0x4eb108,_0x4084de,_0x49eaea,_0x4084de['Fields'],_0xbb6d52);})[_0x3c62('0x26')](function(_0x5d9ab7){_0x19b36c=_0x5d9ab7;logger[_0x3c62('0x1b')]('['+_0x49eaea[_0x3c62('0x7e')][_0x3c62('0x7f')]()+_0x3c62('0x80'),_0x19b36c['id']);logger['info']('['+_0x49eaea[_0x3c62('0x7e')]['toUpperCase']()+_0x3c62('0x81'),_0x792014['type']);})[_0x3c62('0x74')](function(_0x3909cd){logger[_0x3c62('0x72')]('['+_0x49eaea[_0x3c62('0x7e')][_0x3c62('0x7f')]()+']',_0x3909cd);});}; \ No newline at end of file +var _0x90d0=['toLowerCase','concat','securityToken','remoteUri','clientId','login','username','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','bluebird','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','getString','Descriptions','Task','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','WhatId','Case','contact','account','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','ticketType','create','isNil','validateEmail','sobject','find','execute','then','length','Email','Agent\x20%s\x20found.','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','merge','$or','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','first','Name','Phone','attributes','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','includes','string','type','idField','content','toString','variable','variableName','customVariable','Variable','name'];(function(_0x3cb872,_0x4b26e2){var _0x288d59=function(_0x30276e){while(--_0x30276e){_0x3cb872['push'](_0x3cb872['shift']());}};_0x288d59(++_0x4b26e2);}(_0x90d0,0x11d));var _0x090d=function(_0x1d8b1d,_0x11d691){_0x1d8b1d=_0x1d8b1d-0x0;var _0x109ed1=_0x90d0[_0x1d8b1d];return _0x109ed1;};'use strict';var _=require(_0x090d('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x090d('0x1'));var md5=require(_0x090d('0x2'));var jsforce=require(_0x090d('0x3'));var util=require('util');var Redis=require(_0x090d('0x4'));var intUtil=require(_0x090d('0x5'));var config=require(_0x090d('0x6'));var logger=require(_0x090d('0x7'))(_0x090d('0x8'));config[_0x090d('0x9')]=_['defaults'](config[_0x090d('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x090d('0x9')]));function emit(_0x35442c,_0xcf45cf,_0x476e9d){io['to'](_0x35442c)['emit'](_0xcf45cf,_0x476e9d);}function getTicket(_0x174c87,_0x46f249,_0x3fa8ba,_0x37c362,_0xc9133f,_0x1c1dc6,_0xc8865a,_0x1dd4da){var _0xc32f23=Object['assign']({},{'OwnerId':_0x46f249['id'],'Subject':intUtil[_0x090d('0xa')](_0x37c362['Subjects'],_0xc9133f,'\x20'),'Description':intUtil[_0x090d('0xa')](_0x37c362[_0x090d('0xb')],_0xc9133f,'\x0a')},getCustomFields(_0x1c1dc6,_0xc9133f));if(_0x3fa8ba){if(_0x37c362['ticketType']===_0x090d('0xc')){_0xc32f23['ActivityDate']=moment['utc']();_0xc32f23[_0x090d('0xd')]=![];_0xc32f23[_0x090d('0xe')]=![];if(_0x3fa8ba['endUserType']==='contact'||_0x3fa8ba[_0x090d('0xf')]===_0x090d('0x10')){_0xc32f23[_0x090d('0x11')]=_0x3fa8ba['id'];}else if(_0x3fa8ba[_0x090d('0xf')]==='account'){_0xc32f23[_0x090d('0x12')]=_0x3fa8ba['id'];}}else if(_0x37c362['ticketType']===_0x090d('0x13')){if(_0x3fa8ba[_0x090d('0xf')]===_0x090d('0x14')){_0xc32f23['ContactId']=_0x3fa8ba['id'];}else if(_0x3fa8ba[_0x090d('0xf')]===_0x090d('0x15')){_0xc32f23['AccountId']=_0x3fa8ba['id'];}else if(_0x3fa8ba[_0x090d('0xf')]===_0x090d('0x10')&&_0x37c362['leadId']){_0xc32f23[_0x37c362['leadId']]=_0x3fa8ba['id'];}else{logger[_0x090d('0x16')](_0x090d('0x17'));}}}return _0xc8865a['sobject'](_0x37c362[_0x090d('0x18')])[_0x090d('0x19')](_0xc32f23);}function getUser(_0x5010e9,_0x446b38,_0x3db440){if(!_[_0x090d('0x1a')](_0x446b38)&&intUtil[_0x090d('0x1b')](_0x446b38)){var _0x1c30f2={'Email':_0x446b38};var _0x2299c8={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3db440[_0x090d('0x1c')]('User')[_0x090d('0x1d')](_0x1c30f2,_0x2299c8)[_0x090d('0x1e')]()[_0x090d('0x1f')](function(_0x452c32){if(_0x452c32[_0x090d('0x20')]){var _0x31ff34=_[_0x090d('0x1d')](_0x452c32,function(_0x14b9ef){return _0x14b9ef[_0x090d('0x21')]===_0x446b38;});if(_0x31ff34){logger[_0x090d('0x16')](_0x090d('0x22'),_0x446b38);return BPromise[_0x090d('0x23')]({'id':_0x31ff34['Id'],'name':_0x31ff34['Name']});}}else{logger[_0x090d('0x16')](_0x090d('0x24'),_0x446b38);return _0x3db440[_0x090d('0x25')]()[_0x090d('0x1f')](function(_0x4e8d6a){return BPromise[_0x090d('0x23')]({'id':_0x4e8d6a[_0x090d('0x26')],'name':_0x4e8d6a[_0x090d('0x27')]});});}});}else{logger[_0x090d('0x16')](_0x090d('0x24'),_0x446b38);return _0x3db440[_0x090d('0x25')]()[_0x090d('0x1f')](function(_0x1f6781){return BPromise[_0x090d('0x23')]({'id':_0x1f6781[_0x090d('0x26')],'name':_0x1f6781['display_name']});});}}function getEndUser(_0x9c7fbd,_0x30ce58,_0x3cb1f0,_0x1cf393,_0x17ab1f){var _0xf9cc48={'$or':{'Phone':_0x1cf393}};var _0x3e1f0f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x090d('0x23')]()[_0x090d('0x1f')](function(){logger[_0x090d('0x16')](_0x090d('0x28'),_0x1cf393,_0x30ce58[_0x090d('0x29')]);switch(_0x30ce58['moduleSearch']){case _0x090d('0x2a'):var _0x2caffd=_[_0x090d('0x2b')](_0xf9cc48);if(_0x30ce58[_0x090d('0x2c')]){var _0x581b36={};_0x581b36[_0x30ce58['additionalSearchContact']]=_0x1cf393;_[_0x090d('0x2d')](_0x2caffd[_0x090d('0x2e')],_0x581b36);}return _0x17ab1f[_0x090d('0x1c')]('Contact')[_0x090d('0x1d')](_0x2caffd,_0x3e1f0f)[_0x090d('0x1e')]()['then'](function(_0x1fa173){if(_0x1fa173&&_0x1fa173[_0x090d('0x20')]){return _0x1fa173;}else{var _0x1d0219=_[_0x090d('0x2b')](_0xf9cc48);if(_0x30ce58[_0x090d('0x2f')]){var _0x380e0d={};_0x380e0d[_0x30ce58[_0x090d('0x2f')]]=_0x1cf393;_[_0x090d('0x2d')](_0x1d0219[_0x090d('0x2e')],_0x380e0d);}return _0x17ab1f[_0x090d('0x1c')](_0x090d('0x30'))['find'](_0x1d0219,_0x3e1f0f);}});case _0x090d('0x31'):var _0x4571c8=_[_0x090d('0x2b')](_0xf9cc48);if(_0x30ce58[_0x090d('0x32')]){var _0x581b36={};_0x581b36[_0x30ce58[_0x090d('0x32')]]=_0x1cf393;_[_0x090d('0x2d')](_0x4571c8['$or'],_0x581b36);}return _0x17ab1f[_0x090d('0x1c')](_0x090d('0x33'))[_0x090d('0x1d')](_0x4571c8,_0x3e1f0f)[_0x090d('0x1e')]()[_0x090d('0x1f')](function(_0x548422){if(_0x548422&&_0x548422[_0x090d('0x20')]){return _0x548422;}else{var _0x4ed7b3=_[_0x090d('0x2b')](_0xf9cc48);if(_0x30ce58[_0x090d('0x2c')]){var _0x5ba7e1={};_0x5ba7e1[_0x30ce58[_0x090d('0x2c')]]=_0x1cf393;_['merge'](_0x4ed7b3[_0x090d('0x2e')],_0x5ba7e1);}return _0x17ab1f[_0x090d('0x1c')](_0x090d('0x34'))[_0x090d('0x1d')](_0x4ed7b3,_0x3e1f0f)[_0x090d('0x1f')](function(_0x4dee7d){if(_0x4dee7d&&_0x4dee7d[_0x090d('0x20')]){return _0x4dee7d;}else{var _0x208d9d=_['cloneDeep'](_0xf9cc48);if(_0x30ce58[_0x090d('0x2f')]){var _0x2aade5={};_0x2aade5[_0x30ce58[_0x090d('0x2f')]]=_0x1cf393;_[_0x090d('0x2d')](_0x208d9d[_0x090d('0x2e')],_0x2aade5);}return _0x17ab1f['sobject'](_0x090d('0x30'))['find'](_0x208d9d,_0x3e1f0f);}});}});case'contact':var _0x2caffd=_[_0x090d('0x2b')](_0xf9cc48);if(_0x30ce58['additionalSearchContact']){var _0x581b36={};_0x581b36[_0x30ce58['additionalSearchContact']]=_0x1cf393;_[_0x090d('0x2d')](_0x2caffd[_0x090d('0x2e')],_0x581b36);}return _0x17ab1f[_0x090d('0x1c')](_0x090d('0x34'))['find'](_0x2caffd,_0x3e1f0f)[_0x090d('0x1e')]();case _0x090d('0x10'):var _0x3046ac=_['cloneDeep'](_0xf9cc48);if(_0x30ce58['additionalSearchLead']){var _0x581b36={};_0x581b36[_0x30ce58[_0x090d('0x2f')]]=_0x1cf393;_['merge'](_0x3046ac['$or'],_0x581b36);}return _0x17ab1f[_0x090d('0x1c')](_0x090d('0x30'))[_0x090d('0x1d')](_0x3046ac,_0x3e1f0f);case _0x090d('0x15'):var _0x4571c8=_[_0x090d('0x2b')](_0xf9cc48);if(_0x30ce58[_0x090d('0x32')]){var _0x581b36={};_0x581b36[_0x30ce58[_0x090d('0x32')]]=_0x1cf393;_['merge'](_0x4571c8[_0x090d('0x2e')],_0x581b36);}return _0x17ab1f[_0x090d('0x1c')](_0x090d('0x33'))[_0x090d('0x1d')](_0x4571c8,_0x3e1f0f);default:return null;}})[_0x090d('0x1f')](function(_0x10ee21){if(_0x10ee21&&_0x10ee21[_0x090d('0x20')]){var _0x5243bc=_[_0x090d('0x35')](_0x10ee21);if(_0x5243bc){return BPromise['resolve']({'id':_0x5243bc['Id'],'name':_0x5243bc[_0x090d('0x36')],'phone':_0x5243bc[_0x090d('0x37')],'endUserType':_0x5243bc[_0x090d('0x38')]['type']['toLowerCase']()});}}})[_0x090d('0x1f')](function(_0x51cc25){if(_0x51cc25){logger['info'](_0x090d('0x39'),_0x51cc25[_0x090d('0xf')],_0x1cf393);return BPromise[_0x090d('0x23')](_0x51cc25);}else{logger[_0x090d('0x16')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x1cf393);var _0x5125d8={'Phone':_0x1cf393};if(_0x30ce58[_0x090d('0x3a')]){if(_0x30ce58['moduleCreate']===_0x090d('0x14')){logger[_0x090d('0x16')](_0x090d('0x3b'),_0x1cf393,_0x30ce58['moduleCreate']);_0x5125d8[_0x090d('0x3c')]=_0x3cb1f0!==_0x090d('0x3d')?_0x3cb1f0:util[_0x090d('0x3e')](_0x090d('0x3f'),_0x1cf393);}else if(_0x30ce58[_0x090d('0x3a')]==='lead'){logger[_0x090d('0x16')](_0x090d('0x3b'),_0x1cf393,_0x30ce58['moduleCreate']);_0x5125d8['LastName']=_0x3cb1f0!==_0x090d('0x3d')?_0x3cb1f0:util[_0x090d('0x3e')]('Caller\x20-\x20%s',_0x1cf393);_0x5125d8[_0x090d('0x40')]=_0x090d('0x41');}else if(_0x30ce58[_0x090d('0x3a')]===_0x090d('0x15')){logger[_0x090d('0x16')](_0x090d('0x3b'),_0x1cf393,_0x30ce58[_0x090d('0x3a')]);_0x5125d8['Name']=_0x3cb1f0!==_0x090d('0x3d')?_0x3cb1f0:util[_0x090d('0x3e')](_0x090d('0x3f'),_0x1cf393);}else{return null;}}return _0x17ab1f[_0x090d('0x1c')](_[_0x090d('0x42')](_0x30ce58[_0x090d('0x3a')]))[_0x090d('0x19')](_0x5125d8)['then'](function(_0x15b411){return BPromise[_0x090d('0x23')]({'id':_0x15b411['id'],'endUserType':_0x30ce58[_0x090d('0x3a')]});});}});}function getCustomFields(_0x489e64,_0x52b635){var _0x2b2584={};if(_0x489e64[_0x090d('0x20')]>0x0){_['forEach'](_0x489e64,function(_0xe9bcff){if(_[_0x090d('0x43')]([_0x090d('0x44'),'picklist'],_0xe9bcff[_0x090d('0x45')])&&_0xe9bcff[_0x090d('0x46')]){_0x2b2584[_0xe9bcff[_0x090d('0x46')]]=_0xe9bcff[_0x090d('0x47')][_0x090d('0x48')]();}else if(_0xe9bcff['type']===_0x090d('0x49')&&_0xe9bcff['variableName']&&_0xe9bcff[_0x090d('0x46')]){_0x52b635[_0xe9bcff[_0x090d('0x4a')]]&&(_0x2b2584[_0xe9bcff[_0x090d('0x46')]]=_0x52b635[_0xe9bcff[_0x090d('0x4a')]][_0x090d('0x48')]());}else if(_0xe9bcff[_0x090d('0x45')]===_0x090d('0x4b')&&_0xe9bcff[_0x090d('0x4c')]&&_0xe9bcff['Variable'][_0x090d('0x4d')]&&_0xe9bcff[_0x090d('0x46')]){_0x52b635[_0xe9bcff['Variable']['name'][_0x090d('0x4e')]()]&&(_0x2b2584[_0xe9bcff[_0x090d('0x46')]]=_0x52b635[_0xe9bcff['Variable']['name'][_0x090d('0x4e')]()][_0x090d('0x48')]());}});}return _0x2b2584;}function getConnection(_0x15277f){var _0x5c3865=_0x15277f['password'][_0x090d('0x4f')](_0x15277f[_0x090d('0x50')]);var _0x1cbf76=new jsforce['Connection']({'oauth2':{'loginUrl':_0x15277f[_0x090d('0x51')]||'https://login.salesforce.com','clientId':_0x15277f[_0x090d('0x52')],'clientSecret':_0x15277f['clientSecret']}});return _0x1cbf76[_0x090d('0x53')](_0x15277f[_0x090d('0x54')],_0x5c3865)['then'](function(){logger[_0x090d('0x16')]('Connection\x20established.');return _0x1cbf76;});}exports[_0x090d('0x55')]=function(_0xc55197,_0x14f48f,_0x112958,_0x2c6054,_0x3a985a,_0x3b4b0c){var _0x4bd9b9,_0x5c6c4a,_0x1b575f,_0x591b45;_0x3b4b0c['serverUrl']=intUtil[_0x090d('0x56')](_0x3b4b0c[_0x090d('0x57')]);_0x3b4b0c[_0x090d('0x51')]=intUtil['stripTrailingSlash'](_0x3b4b0c[_0x090d('0x51')]);if(_0x3a985a&&_0x3a985a[_0x090d('0x58')]){logger[_0x090d('0x16')](_0x090d('0x59'),'Recording\x20is\x20enabled!');_0x14f48f['recordingURL']=util[_0x090d('0x3e')](_0x090d('0x5a'),_0x3b4b0c[_0x090d('0x57')],_0x14f48f[_0x090d('0x5b')],md5(_0x14f48f[_0x090d('0x5b')]));}else{_0x14f48f[_0x090d('0x5c')]='';}return getConnection(_0x3b4b0c)[_0x090d('0x1f')](function(_0x5664d2){_0x591b45=_0x5664d2;return getUser(_0x3b4b0c,_0x2c6054[_0x090d('0x5d')],_0x591b45);})['then'](function(_0x2221e9){_0x4bd9b9=_0x2221e9;return getEndUser(_0x3b4b0c,_0x112958,_0x14f48f[_0x090d('0x5e')],_0x14f48f[_0x090d('0x5f')],_0x591b45);})[_0x090d('0x1f')](function(_0x591ccc){_0x5c6c4a=_0x591ccc;return getTicket(_0x3b4b0c,_0x4bd9b9,_0x5c6c4a,_0x112958,_0x14f48f,_0x112958[_0x090d('0x60')],_0x591b45,_0x090d('0x55'));})['then'](function(_0x56557){_0x1b575f=_0x56557;logger[_0x090d('0x16')](_0x090d('0x61'),_0x1b575f['id']);logger['info']('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x1b575f['id'],_0x2c6054[_0x090d('0x4d')],_0x3b4b0c[_0x090d('0x45')]);switch(_0x3b4b0c[_0x090d('0x45')]){case'integrationTab':emit(util[_0x090d('0x3e')](_0x090d('0x62'),_0x2c6054[_0x090d('0x4d')]),_0x090d('0x63'),{'recordId':_0x1b575f['id']});break;case _0x090d('0x64'):emit(util[_0x090d('0x3e')](_0x090d('0x62'),_0x2c6054[_0x090d('0x4d')]),_0x090d('0x65'),{'uri':util[_0x090d('0x3e')](_0x090d('0x66'),_0x591b45[_0x090d('0x67')],_0x1b575f['id'])});break;default:logger[_0x090d('0x68')](_0x090d('0x69'));}})[_0x090d('0x6a')](function(_0x418075){logger['error'](_0x090d('0x59'),_0x418075);});};exports[_0x090d('0x6b')]=function(_0x3b02b1,_0x1fc0aa,_0x1dc96d,_0x1968e6,_0x1087be,_0x3d29c5,_0x4465ca){var _0x1dfc69,_0x2c2391,_0x55e310,_0x2bf298;_0x3d29c5[_0x090d('0x57')]=intUtil['stripTrailingSlash'](_0x3d29c5[_0x090d('0x57')]);_0x3d29c5['remoteUri']=intUtil[_0x090d('0x56')](_0x3d29c5[_0x090d('0x51')]);if(_0x4465ca&&_0x4465ca[_0x090d('0x6c')]&&_0x4465ca[_0x090d('0x6c')]!=='none'){logger[_0x090d('0x16')](_0x090d('0x6d'),_0x090d('0x6e'));_0x1fc0aa[_0x090d('0x5c')]=util['format'](_0x090d('0x5a'),_0x3d29c5['serverUrl'],_0x1fc0aa['uniqueid'],md5(_0x1fc0aa['uniqueid']));}return getConnection(_0x3d29c5)[_0x090d('0x1f')](function(_0x30c06f){_0x2bf298=_0x30c06f;return getUser(_0x3d29c5,_0x1968e6[_0x090d('0x5d')],_0x2bf298);})[_0x090d('0x1f')](function(_0xe5ec8e){_0x1dfc69=_0xe5ec8e;return getEndUser(_0x3d29c5,_0x1dc96d,_0x1fc0aa['destcalleridname'],_0x1fc0aa[_0x090d('0x6f')],_0x2bf298);})[_0x090d('0x1f')](function(_0x48e5bb){_0x2c2391=_0x48e5bb;return getTicket(_0x3d29c5,_0x1dfc69,_0x2c2391,_0x1dc96d,_0x1fc0aa,_0x1dc96d[_0x090d('0x60')],_0x2bf298,_0x090d('0x6b'));})[_0x090d('0x1f')](function(_0x3c1cc3){_0x55e310=_0x3c1cc3;logger['info'](_0x090d('0x70'),_0x55e310['id']);logger[_0x090d('0x16')](_0x090d('0x71'),_0x55e310['id'],_0x1968e6[_0x090d('0x4d')],_0x3d29c5[_0x090d('0x45')]);switch(_0x3d29c5[_0x090d('0x45')]){case _0x090d('0x72'):emit(util[_0x090d('0x3e')](_0x090d('0x62'),_0x1968e6[_0x090d('0x4d')]),'trigger:salesforce:display',{'recordId':_0x55e310['id']});break;case _0x090d('0x64'):emit(util['format'](_0x090d('0x62'),_0x1968e6[_0x090d('0x4d')]),_0x090d('0x65'),{'uri':util[_0x090d('0x3e')](_0x090d('0x66'),_0x2bf298[_0x090d('0x67')],_0x55e310['id'])});break;default:logger['error'](_0x090d('0x6d'),_0x090d('0x73'));}})['catch'](function(_0x468604){logger[_0x090d('0x68')](_0x090d('0x6d'),_0x468604);});};exports[_0x090d('0x74')]=function(_0x2171fa,_0xfe1305,_0x3f14b2,_0x5944ab,_0x1b1906,_0x2ff8b3){var _0x6884c4,_0x3a40de,_0x115ae5,_0x43892f;_0x2ff8b3[_0x090d('0x57')]=intUtil['stripTrailingSlash'](_0x2ff8b3[_0x090d('0x57')]);_0x2ff8b3['remoteUri']=intUtil[_0x090d('0x56')](_0x2ff8b3[_0x090d('0x51')]);if(_0x1b1906&&_0x1b1906['monitor_format']){logger['info']('['+_0xfe1305[_0x090d('0x75')][_0x090d('0x76')]()+']','Recording\x20is\x20enabled!');_0xfe1305[_0x090d('0x5c')]=util[_0x090d('0x3e')](_0x090d('0x5a'),_0x2ff8b3[_0x090d('0x57')],_0xfe1305['uniqueid'],md5(_0xfe1305[_0x090d('0x5b')]));}else{_0xfe1305[_0x090d('0x5c')]='';}return getConnection(_0x2ff8b3)['then'](function(_0x199998){_0x43892f=_0x199998;if(!_[_0x090d('0x1a')](_0x5944ab)){return getUser(_0x2ff8b3,_0x5944ab['name'],_0x43892f);}else{return getUser(_0x2ff8b3,null,_0x43892f);}})[_0x090d('0x1f')](function(_0x1032e1){_0x6884c4=_0x1032e1;return getEndUser(_0x2ff8b3,_0x3f14b2,_0xfe1305['calleridname'],_0xfe1305['calleridnum'],_0x43892f);})[_0x090d('0x1f')](function(_0x55856f){_0x3a40de=_0x55856f;return getTicket(_0x2ff8b3,_0x6884c4,_0x3a40de,_0x3f14b2,_0xfe1305,_0x3f14b2[_0x090d('0x60')],_0x43892f);})['then'](function(_0x4f5811){_0x115ae5=_0x4f5811;logger['info']('['+_0xfe1305['lastevent'][_0x090d('0x76')]()+_0x090d('0x77'),_0x115ae5['id']);logger['info']('['+_0xfe1305[_0x090d('0x75')][_0x090d('0x76')]()+_0x090d('0x78'),_0x2ff8b3['type']);})['catch'](function(_0x29361f){logger[_0x090d('0x68')]('['+_0xfe1305['lastevent']['toUpperCase']()+']',_0x29361f);});}; \ 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 1e51de3..9c30d51 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 _0x9ded=['picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','Variable',']\x20getTicket\x20input\x20crm','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','ticketNumber','forEach','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','email','outbound','destcalleridnum','calleridnum','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','validateEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','userEmail','adminEmail','],\x20getUser\x20crm','catch','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','includes','string'];(function(_0x4221be,_0x4b3d7b){var _0x36a241=function(_0x376e89){while(--_0x376e89){_0x4221be['push'](_0x4221be['shift']());}};_0x36a241(++_0x4b3d7b);}(_0x9ded,0x1ee));var _0xd9de=function(_0x4ffe8c,_0x62bf20){_0x4ffe8c=_0x4ffe8c-0x0;var _0xde829=_0x9ded[_0x4ffe8c];return _0xde829;};'use strict';var _=require(_0xd9de('0x0'));var Promise=require(_0xd9de('0x1'));var rp=require(_0xd9de('0x2'));var util=require(_0xd9de('0x3'));var md5=require(_0xd9de('0x4'));var Redis=require(_0xd9de('0x5'));var intUtil=require(_0xd9de('0x6'));var config=require(_0xd9de('0x7'));var logger=require(_0xd9de('0x8'))(_0xd9de('0x9'));config[_0xd9de('0xa')]=_['defaults'](config[_0xd9de('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd9de('0xa')]));function getAdminUser(_0x322f15,_0xe032b1,_0x1c6872,_0x751c87,_0x150c03,_0x500442){return new Promise(function(_0x229900,_0x251fd7){var _0x30cff0={'method':_0xd9de('0xb'),'uri':_0x751c87+_0xd9de('0xc')+'&'+_0x150c03+'&'+_0x500442,'auth':_0xe032b1,'json':!![]};return rp(_0x30cff0)[_0xd9de('0xd')](function(_0x2b6d5c){if(_0x2b6d5c[_0xd9de('0xe')][_0xd9de('0xf')]>0x0){_0x1c6872[_0xd9de('0x10')]=_0x2b6d5c[_0xd9de('0xe')][0x0][_0xd9de('0x11')];}logger[_0xd9de('0x12')]('['+[_0x322f15[_0xd9de('0x13')]()]+_0xd9de('0x14'),_0x1c6872);_0x229900(_0x1c6872);})['catch'](function(_0x39ab9f){logger[_0xd9de('0x15')]('['+[_0x322f15[_0xd9de('0x13')]()]+']',_0x39ab9f[_0xd9de('0x16')]);_0x251fd7(_0x39ab9f[_0xd9de('0x16')]);});});}function getUser(_0x315efd,_0x5286a0,_0x491276,_0x16d0cb,_0x289f54){return function(_0x5d9671){logger[_0xd9de('0x12')]('['+[_0x315efd[_0xd9de('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x5d9671);return new Promise(function(_0x270eaf,_0x438ba3){if(intUtil[_0xd9de('0x17')](_0x5d9671['userEmail'])){var _0x1e88c5={'method':_0xd9de('0xb'),'uri':_0x491276+'sys_user?sysparm_query=email%3D'+_0x5d9671['userEmail']+'&'+_0x16d0cb+'&'+_0x289f54,'auth':_0x5286a0,'json':!![]};logger[_0xd9de('0x12')]('['+[_0x315efd[_0xd9de('0x13')]()]+_0xd9de('0x18'),_0x1e88c5);return rp(_0x1e88c5)['then'](function(_0x26237a){logger['info']('['+[_0x315efd[_0xd9de('0x13')]()]+_0xd9de('0x19'),_0x26237a);if(_0x26237a[_0xd9de('0xe')]['length']>0x0&&String(_0x26237a[_0xd9de('0xe')][0x0][_0xd9de('0x1a')])===_0xd9de('0x1b')){_0x5d9671[_0xd9de('0x1c')]=_0x26237a[_0xd9de('0xe')][0x0][_0xd9de('0x11')];}else{_0x5d9671[_0xd9de('0x1c')]=_0x5d9671[_0xd9de('0x10')];_0x5d9671[_0xd9de('0x1d')]=_0x5d9671[_0xd9de('0x1e')];}logger[_0xd9de('0x12')]('['+[_0x315efd['toUpperCase']()]+_0xd9de('0x1f'),_0x5d9671);_0x270eaf(_0x5d9671);})[_0xd9de('0x20')](function(_0x43daf6){logger[_0xd9de('0x15')]('['+[_0x315efd['toUpperCase']()]+']',_0x43daf6[_0xd9de('0x16')]);_0x438ba3(_0x43daf6[_0xd9de('0x16')]);});}else{logger[_0xd9de('0x12')]('['+[_0x315efd[_0xd9de('0x13')]()]+']\x20using\x20admin\x20profile');_0x5d9671[_0xd9de('0x1c')]=_0x5d9671[_0xd9de('0x10')];_0x5d9671[_0xd9de('0x1d')]=_0x5d9671[_0xd9de('0x1e')];_0x270eaf(_0x5d9671);}});};}function createEndUser(_0x198b35,_0x5cec8a,_0x476133,_0x1c6cac,_0x290f5a){logger['info']('['+[_0x198b35[_0xd9de('0x13')]()]+_0xd9de('0x21'),_0x476133);return new Promise(function(_0x3071bb,_0xb3f1e7){var _0x478209={'method':_0xd9de('0x22'),'uri':_0x1c6cac+_0xd9de('0x23')+_0x290f5a,'body':{'user_name':_0x476133[_0xd9de('0x24')],'roles':_0xd9de('0x25'),'first_name':_0x476133['endUserNumber'],'active':'true','date_format':_0xd9de('0x26'),'phone':_0x476133[_0xd9de('0x24')]},'auth':_0x5cec8a,'json':!![]};return rp(_0x478209)[_0xd9de('0xd')](function(_0x2dfd4c){logger[_0xd9de('0x12')]('['+[_0x198b35[_0xd9de('0x13')]()]+_0xd9de('0x27'),_0x2dfd4c[_0xd9de('0xe')]);_0x476133[_0xd9de('0x28')]=_0x2dfd4c[_0xd9de('0xe')][_0xd9de('0x11')];_0x3071bb(_0x476133);})[_0xd9de('0x20')](function(_0x36d59c){logger[_0xd9de('0x15')]('['+[_0x198b35[_0xd9de('0x13')]()]+']',_0x36d59c[_0xd9de('0x16')]);_0xb3f1e7(_0x36d59c['message']);});});}function getEndUser(_0x4c4f81,_0x4e9d95,_0x5e4448,_0x4187ae,_0x5c77e0){return function(_0xd93770){logger['info']('['+[_0x4c4f81[_0xd9de('0x13')]()]+_0xd9de('0x29'),_0xd93770);return new Promise(function(_0x210439,_0x3a13b7){var _0x1bafe3={'method':_0xd9de('0xb'),'uri':_0x5e4448+_0xd9de('0x2a')+_0xd93770['endUserNumber']+'&'+_0x4187ae+'&'+_0x5c77e0,'auth':_0x4e9d95,'json':!![]};return rp(_0x1bafe3)['then'](function(_0x18a6d1){if(_0x18a6d1[_0xd9de('0xe')][_0xd9de('0xf')]>0x0){_0xd93770[_0xd9de('0x28')]=_0x18a6d1[_0xd9de('0xe')][0x0]['sys_id'];logger[_0xd9de('0x12')]('['+[_0x4c4f81[_0xd9de('0x13')]()]+'],\x20getEndUser\x20crm',_0xd93770);_0x210439(_0xd93770);}else{return createEndUser(_0x4c4f81,_0x4e9d95,_0xd93770,_0x5e4448,_0x4187ae)['then'](function(_0x5a31a0){logger[_0xd9de('0x12')]('['+[_0x4c4f81[_0xd9de('0x13')]()]+_0xd9de('0x2b'),_0x5a31a0);_0x210439(_0x5a31a0);});}})[_0xd9de('0x20')](function(_0x4452c1){logger['error']('['+[_0x4c4f81['toUpperCase']()]+']',_0x4452c1[_0xd9de('0x16')]);_0x3a13b7(_0x4452c1[_0xd9de('0x16')]);});});};}function getCustomFields(_0x2c4f86,_0x433951){var _0x2ef179={};if(_0x2c4f86[_0xd9de('0xf')]>0x0){_['forEach'](_0x2c4f86,function(_0x25c02a){if(_[_0xd9de('0x2c')]([_0xd9de('0x2d'),_0xd9de('0x2e')],_0x25c02a[_0xd9de('0x2f')])&&_0x25c02a[_0xd9de('0x30')]&&!_0x25c02a[_0xd9de('0x31')]){_0x2ef179[_0x25c02a[_0xd9de('0x30')][_0xd9de('0x32')]()]=_0x25c02a[_0xd9de('0x33')][_0xd9de('0x34')]();}else if(_[_0xd9de('0x2c')]([_0xd9de('0x2d'),_0xd9de('0x2e')],_0x25c02a[_0xd9de('0x2f')])&&_0x25c02a[_0xd9de('0x35')]&&_0x25c02a['customField']){_0x2ef179[_0x25c02a[_0xd9de('0x35')]['toLowerCase']()]=_0x25c02a[_0xd9de('0x33')][_0xd9de('0x34')]();}else if(_0x25c02a['type']===_0xd9de('0x36')&&_0x25c02a[_0xd9de('0x37')]&&_0x25c02a['idField']&&_0x25c02a[_0xd9de('0x31')]){_0x2ef179[_0x25c02a['idField'][_0xd9de('0x32')]()]=_0x433951[_0x25c02a[_0xd9de('0x37')]][_0xd9de('0x34')]();}else if(_0x25c02a[_0xd9de('0x2f')]==='customVariable'&&_0x25c02a['Variable']&&_0x25c02a[_0xd9de('0x38')]['name']&&_0x25c02a[_0xd9de('0x35')]&&_0x25c02a[_0xd9de('0x31')]){_0x2ef179[_0x25c02a['idField'][_0xd9de('0x32')]()]=_0x433951[_0x25c02a[_0xd9de('0x38')]['name'][_0xd9de('0x32')]()][_0xd9de('0x34')]();}});}return _0x2ef179;}function getTicket(_0x28a498,_0x3f3e08,_0x3f45de,_0xb851fe,_0x100b10,_0x11254f){return function(_0xdd4359){logger['info']('['+[_0x28a498[_0xd9de('0x13')]()]+_0xd9de('0x39'),_0xdd4359);return new Promise(function(_0x5ec167,_0x398edc){var _0x4cbe10=_0x28a498['toLowerCase']()==='outbound'?_0xdd4359[_0xd9de('0x1c')]:_0xdd4359[_0xd9de('0x28')];var _0x104178={'method':'POST','uri':_0x3f45de+_0xd9de('0x3a')+'?'+_0x11254f,'body':Object[_0xd9de('0x3b')]({},{'active':_0xd9de('0x1b'),'caller_id':_0x4cbe10,'assigned_to':_0xdd4359[_0xd9de('0x1c')],'short_description':intUtil[_0xd9de('0x3c')](_0xb851fe[_0xd9de('0x3d')],_0x100b10,'\x20'),'description':intUtil[_0xd9de('0x3c')](_0xb851fe[_0xd9de('0x3e')],_0x100b10,'\x0a')},getCustomFields(_0xb851fe[_0xd9de('0x3f')],_0x100b10)),'auth':_0x3f3e08,'json':!![]};return rp(_0x104178)[_0xd9de('0xd')](function(_0x514090){logger[_0xd9de('0x12')]('['+[_0x28a498[_0xd9de('0x13')]()]+_0xd9de('0x40'),_0x514090[_0xd9de('0xe')]);_0xdd4359[_0xd9de('0x41')]=_0x514090[_0xd9de('0xe')][_0xd9de('0x11')];_0xdd4359['ticketNumber']=_0x514090[_0xd9de('0xe')][_0xd9de('0x42')];logger[_0xd9de('0x12')]('['+[_0x28a498[_0xd9de('0x13')]()]+']\x20getTicket\x20crm',_0xdd4359);_0x5ec167(_0xdd4359);})['catch'](function(_0x14645c){logger['error']('['+[_0x28a498[_0xd9de('0x13')]()]+']',_0x14645c[_0xd9de('0x16')]);_0x398edc(_0x14645c['message']);});});};}function createRemoteTag(_0x4a2ddd,_0xb1fa20,_0x5a6707,_0xe7c096){return new Promise(function(_0x387c45,_0x2ad45b){var _0x41d697={'method':_0xd9de('0x22'),'uri':_0x5a6707+_0xd9de('0x43')+'?'+_0xe7c096,'body':{'short_description':_0x4a2ddd,'global':!![],'active':!![],'name':_0x4a2ddd},'auth':_0xb1fa20,'json':!![]};return rp(_0x41d697)['then'](function(_0x1e0000){var _0xf3870d=_0x1e0000[_0xd9de('0xe')][_0xd9de('0x11')];_0x387c45(_0xf3870d);});});}function getRemoteTag(_0xbebbab,_0x101d5a,_0x261be4,_0x48fd81,_0x5b1567){return new Promise(function(_0x10a373,_0x5bc41a){var _0x2c09e0={'method':_0xd9de('0xb'),'uri':_0x261be4+_0xd9de('0x43')+_0xd9de('0x44')+_0xbebbab+'&'+_0x48fd81,'auth':_0x101d5a,'json':!![]};return rp(_0x2c09e0)['then'](function(_0x43ee7a){if(_0x43ee7a[_0xd9de('0xe')][_0xd9de('0xf')]>0x0){var _0x483937=_0x43ee7a[_0xd9de('0xe')][0x0]['sys_id'];_0x10a373(_0x483937);}else{return createRemoteTag(_0xbebbab,_0x101d5a,_0x261be4,_0x48fd81)[_0xd9de('0xd')](function(_0x3973f2){_0x10a373(_0x3973f2);});}});});}function assignTagToIncident(_0x1d4015,_0x269099,_0x205246,_0x5c4a6b,_0x2f3b5a){return new Promise(function(_0x2a8b2e,_0x2ab48d){var _0x5eddf0={'method':_0xd9de('0x22'),'uri':_0x205246+_0xd9de('0x45')+'?'+_0x2f3b5a,'body':{'label':_0x1d4015,'table':_0xd9de('0x3a'),'id_type':_0xd9de('0x46'),'table_key':_0x5c4a6b['ticketId'],'title':_0xd9de('0x47')+_0x5c4a6b[_0xd9de('0x48')],'id_display':_0x5c4a6b[_0xd9de('0x48')]},'auth':_0x269099,'json':!![]};return rp(_0x5eddf0)['then'](function(_0x252768){_0x2a8b2e();})['catch'](function(){_0x2a8b2e();});});}function manageTags(_0x1fa32f,_0x101ced,_0x2a5ee8,_0x515d38,_0x3cffe7,_0xd4d449,_0x688f63){return new Promise(function(_0x4073b9,_0x286e47){var _0x37bc42=[];_0x101ced[_0xd9de('0x49')](function(_0x15889d){_0x37bc42['push'](getRemoteTag(_0x15889d,_0x2a5ee8,_0x515d38,_0xd4d449,_0x688f63));});return Promise[_0xd9de('0x4a')](_0x37bc42)[_0xd9de('0xd')](function(_0x4060aa){if(_0x4060aa[_0xd9de('0xf')]){logger['info']('['+[_0x1fa32f[_0xd9de('0x13')]()]+_0xd9de('0x4b'),_0x4060aa);var _0x211044=[];_0x4060aa['forEach'](function(_0x590d92){_0x211044[_0xd9de('0x4c')](assignTagToIncident(_0x590d92,_0x2a5ee8,_0x515d38,_0x3cffe7,_0xd4d449));});return Promise[_0xd9de('0x4a')](_0x211044)['then'](function(){_0x4073b9();})[_0xd9de('0x20')](function(){_0x4073b9();});}else{_0x4073b9();}});});}function getTags(_0x3e231d,_0x491d4f,_0x2eb976,_0x3aea17,_0x5e8bb5,_0x49bf3b){return function(_0x48c54f){return new Promise(function(_0x1c2bab,_0x77bb8a){var _0x13d379=[];var _0x23ebb9=_0x3aea17['Tags'];if(_0x23ebb9&&_0x23ebb9[_0xd9de('0xf')]>0x0){_0x13d379=_[_0xd9de('0x4d')](_0x23ebb9,'name');}if(_0x13d379['length']>0x0){return manageTags(_0x3e231d,_0x13d379,_0x491d4f,_0x2eb976,_0x48c54f,_0x5e8bb5,_0x49bf3b)[_0xd9de('0xd')](function(){_0x1c2bab(_0x48c54f);});}else{_0x1c2bab(_0x48c54f);}});};}function emit(_0x414513,_0x5ae653,_0x422cd0){var _0x579137=_0xd9de('0x4e')+_0xd9de('0x4f')+_0xd9de('0x50')+'%255EORDERBYDESCnumber';var _0x3807cb={'uri':_0x414513+_0xd9de('0x51')+_0x422cd0+_0x579137};io['to'](util[_0xd9de('0x52')](_0xd9de('0x53'),_0x5ae653))[_0xd9de('0x54')]('trigger:browser:url',_0x3807cb);}exports['cs']=function(_0x57982f,_0x24bfef,_0x3dc82b,_0x3b5e15,_0x16b5d9,_0x191fdc,_0x6dae19,_0x15a598){var _0x31db9b={};var _0x4d5748={'user':_0x191fdc['username'],'pass':_0x191fdc['password']};var _0x39d299=_0xd9de('0x55');var _0x4e6ec7=_0xd9de('0x56');_0x191fdc[_0xd9de('0x57')]=intUtil['stripTrailingSlash'](_0x191fdc['remoteUri']);_0x191fdc[_0xd9de('0x58')]=intUtil[_0xd9de('0x59')](_0x191fdc['serverUrl']);var _0x461d98=util[_0xd9de('0x52')](_0xd9de('0x5a'),_0x191fdc[_0xd9de('0x57')]);_0x31db9b[_0xd9de('0x1d')]=!_['isNil'](_0x3b5e15)?_0x3b5e15['email']:null;_0x31db9b[_0xd9de('0x1e')]=_0x191fdc[_0xd9de('0x5b')];_0x31db9b[_0xd9de('0x24')]=_0x15a598[_0xd9de('0x32')]()===_0xd9de('0x5c')?_0x24bfef[_0xd9de('0x5d')]:_0x24bfef[_0xd9de('0x5e')];_0x31db9b['callDirection']=_0x15a598===_0xd9de('0x5f')||_0x15a598===_0xd9de('0x60')?_0xd9de('0x5f'):_0xd9de('0x5c');var _0x63602=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x191fdc[_0xd9de('0x58')],_0x24bfef[_0xd9de('0x61')],md5(_0x24bfef['uniqueid']));if(_0x16b5d9&&_0x16b5d9[_0xd9de('0x62')]){logger[_0xd9de('0x12')](_0xd9de('0x63'),_0xd9de('0x64'));_0x24bfef[_0xd9de('0x65')]=_0x63602;}else if(_0x6dae19&&_0x6dae19[_0xd9de('0x66')]&&_0x6dae19[_0xd9de('0x66')]!==_0xd9de('0x67')){logger['info']('[OUTBOUND]',_0xd9de('0x64'));_0x24bfef[_0xd9de('0x65')]=_0x63602;}else{_0x24bfef[_0xd9de('0x65')]='';}return getAdminUser(_0x15a598,_0x4d5748,_0x31db9b,_0x461d98,_0x4e6ec7,_0x39d299)['then'](getUser(_0x15a598,_0x4d5748,_0x461d98,_0x4e6ec7,_0x39d299))[_0xd9de('0xd')](getEndUser(_0x15a598,_0x4d5748,_0x461d98,_0x4e6ec7,_0x39d299))[_0xd9de('0xd')](getTicket(_0x15a598,_0x4d5748,_0x461d98,_0x3dc82b,_0x24bfef,_0x4e6ec7))[_0xd9de('0xd')](function(_0x339adc){logger[_0xd9de('0x12')](util[_0xd9de('0x52')]('The\x20ticket\x20ID\x20is:\x20%s',_0x339adc[_0xd9de('0x41')]));logger['info'](util[_0xd9de('0x52')](_0xd9de('0x68'),_0x15a598));if(_0x15a598!==_0xd9de('0x60')){logger[_0xd9de('0x12')]('['+[_0x15a598[_0xd9de('0x13')]()]+']',_0xd9de('0x69'));emit(_0x191fdc[_0xd9de('0x57')],_0x3b5e15['name'],_0x339adc['ticketId']);}})[_0xd9de('0x20')](function(_0x5716a7){logger[_0xd9de('0x15')]('['+[_0x15a598[_0xd9de('0x13')]()]+_0xd9de('0x6a'),util[_0xd9de('0x6b')](_0x5716a7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5df6=['Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','sys_id','info','toUpperCase','catch','error','message','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','string','picklist','nameField','customField','type','toLowerCase','content','toString','variable','variableName','idField','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','endUserId','incident','getString','Subjects',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry'];(function(_0x183261,_0xaad4a4){var _0x336016=function(_0x287ff9){while(--_0x287ff9){_0x183261['push'](_0x183261['shift']());}};_0x336016(++_0xaad4a4);}(_0x5df6,0x1da));var _0x65df=function(_0x40429e,_0x3e4fae){_0x40429e=_0x40429e-0x0;var _0x29a910=_0x5df6[_0x40429e];return _0x29a910;};'use strict';var _=require(_0x65df('0x0'));var Promise=require(_0x65df('0x1'));var rp=require(_0x65df('0x2'));var util=require('util');var md5=require(_0x65df('0x3'));var Redis=require(_0x65df('0x4'));var intUtil=require(_0x65df('0x5'));var config=require(_0x65df('0x6'));var logger=require(_0x65df('0x7'))(_0x65df('0x8'));config[_0x65df('0x9')]=_[_0x65df('0xa')](config[_0x65df('0x9')],{'host':_0x65df('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x1db00a,_0x3509ec,_0x14dad0,_0x4e404a,_0x4f4b0b,_0x264d1e){return new Promise(function(_0x3dd0a4,_0x26f497){var _0x562dbb={'method':_0x65df('0xc'),'uri':_0x4e404a+_0x65df('0xd')+'&'+_0x4f4b0b+'&'+_0x264d1e,'auth':_0x3509ec,'json':!![]};return rp(_0x562dbb)[_0x65df('0xe')](function(_0x3965f2){if(_0x3965f2['result'][_0x65df('0xf')]>0x0){_0x14dad0[_0x65df('0x10')]=_0x3965f2[_0x65df('0x11')][0x0][_0x65df('0x12')];}logger[_0x65df('0x13')]('['+[_0x1db00a[_0x65df('0x14')]()]+'],\x20getAdminUser\x20crm',_0x14dad0);_0x3dd0a4(_0x14dad0);})[_0x65df('0x15')](function(_0xca3943){logger[_0x65df('0x16')]('['+[_0x1db00a['toUpperCase']()]+']',_0xca3943[_0x65df('0x17')]);_0x26f497(_0xca3943[_0x65df('0x17')]);});});}function getUser(_0x12005b,_0x23f785,_0xee08c4,_0x100e56,_0x29895f){return function(_0xf6d65b){logger[_0x65df('0x13')]('['+[_0x12005b[_0x65df('0x14')]()]+'],\x20getUser\x20input\x20crm',_0xf6d65b);return new Promise(function(_0x3e90bf,_0x237a66){if(intUtil[_0x65df('0x18')](_0xf6d65b[_0x65df('0x19')])){var _0x2cb70d={'method':_0x65df('0xc'),'uri':_0xee08c4+'sys_user?sysparm_query=email%3D'+_0xf6d65b[_0x65df('0x19')]+'&'+_0x100e56+'&'+_0x29895f,'auth':_0x23f785,'json':!![]};logger[_0x65df('0x13')]('['+[_0x12005b[_0x65df('0x14')]()]+_0x65df('0x1a'),_0x2cb70d);return rp(_0x2cb70d)[_0x65df('0xe')](function(_0x2328b0){logger['info']('['+[_0x12005b['toUpperCase']()]+_0x65df('0x1b'),_0x2328b0);if(_0x2328b0[_0x65df('0x11')][_0x65df('0xf')]>0x0&&String(_0x2328b0[_0x65df('0x11')][0x0][_0x65df('0x1c')])===_0x65df('0x1d')){_0xf6d65b['userId']=_0x2328b0[_0x65df('0x11')][0x0][_0x65df('0x12')];}else{_0xf6d65b[_0x65df('0x1e')]=_0xf6d65b[_0x65df('0x10')];_0xf6d65b[_0x65df('0x19')]=_0xf6d65b[_0x65df('0x1f')];}logger['info']('['+[_0x12005b[_0x65df('0x14')]()]+_0x65df('0x20'),_0xf6d65b);_0x3e90bf(_0xf6d65b);})[_0x65df('0x15')](function(_0x1410a4){logger[_0x65df('0x16')]('['+[_0x12005b[_0x65df('0x14')]()]+']',_0x1410a4[_0x65df('0x17')]);_0x237a66(_0x1410a4[_0x65df('0x17')]);});}else{logger[_0x65df('0x13')]('['+[_0x12005b[_0x65df('0x14')]()]+_0x65df('0x21'));_0xf6d65b[_0x65df('0x1e')]=_0xf6d65b[_0x65df('0x10')];_0xf6d65b[_0x65df('0x19')]=_0xf6d65b[_0x65df('0x1f')];_0x3e90bf(_0xf6d65b);}});};}function createEndUser(_0x372597,_0x2cac31,_0x637e61,_0x346a19,_0x410e50){logger[_0x65df('0x13')]('['+[_0x372597['toUpperCase']()]+_0x65df('0x22'),_0x637e61);return new Promise(function(_0x306c09,_0x35ad32){var _0x173832={'method':_0x65df('0x23'),'uri':_0x346a19+'sys_user?'+_0x410e50,'body':{'user_name':_0x637e61[_0x65df('0x24')],'roles':_0x65df('0x25'),'first_name':_0x637e61[_0x65df('0x24')],'active':_0x65df('0x1d'),'date_format':_0x65df('0x26'),'phone':_0x637e61[_0x65df('0x24')]},'auth':_0x2cac31,'json':!![]};return rp(_0x173832)[_0x65df('0xe')](function(_0x562863){logger[_0x65df('0x13')]('['+[_0x372597['toUpperCase']()]+_0x65df('0x27'),_0x562863[_0x65df('0x11')]);_0x637e61['endUserId']=_0x562863[_0x65df('0x11')][_0x65df('0x12')];_0x306c09(_0x637e61);})[_0x65df('0x15')](function(_0x40be62){logger[_0x65df('0x16')]('['+[_0x372597[_0x65df('0x14')]()]+']',_0x40be62[_0x65df('0x17')]);_0x35ad32(_0x40be62[_0x65df('0x17')]);});});}function getEndUser(_0x5d7213,_0x553f1c,_0x1b67e0,_0x5c4e2b,_0xb14f8f){return function(_0x594cea){logger[_0x65df('0x13')]('['+[_0x5d7213[_0x65df('0x14')]()]+_0x65df('0x28'),_0x594cea);return new Promise(function(_0x1974cc,_0x2dcf4d){var _0x3bdc92={'method':_0x65df('0xc'),'uri':_0x1b67e0+_0x65df('0x29')+_0x594cea[_0x65df('0x24')]+'&'+_0x5c4e2b+'&'+_0xb14f8f,'auth':_0x553f1c,'json':!![]};return rp(_0x3bdc92)[_0x65df('0xe')](function(_0x374f2a){if(_0x374f2a[_0x65df('0x11')]['length']>0x0){_0x594cea['endUserId']=_0x374f2a['result'][0x0][_0x65df('0x12')];logger[_0x65df('0x13')]('['+[_0x5d7213[_0x65df('0x14')]()]+'],\x20getEndUser\x20crm',_0x594cea);_0x1974cc(_0x594cea);}else{return createEndUser(_0x5d7213,_0x553f1c,_0x594cea,_0x1b67e0,_0x5c4e2b)[_0x65df('0xe')](function(_0x2508ef){logger[_0x65df('0x13')]('['+[_0x5d7213[_0x65df('0x14')]()]+_0x65df('0x2a'),_0x2508ef);_0x1974cc(_0x2508ef);});}})['catch'](function(_0x59d346){logger[_0x65df('0x16')]('['+[_0x5d7213[_0x65df('0x14')]()]+']',_0x59d346[_0x65df('0x17')]);_0x2dcf4d(_0x59d346[_0x65df('0x17')]);});});};}function getCustomFields(_0x1514cd,_0x3d4dbd){var _0x9918e5={};if(_0x1514cd[_0x65df('0xf')]>0x0){_[_0x65df('0x2b')](_0x1514cd,function(_0x4d8441){if(_[_0x65df('0x2c')]([_0x65df('0x2d'),_0x65df('0x2e')],_0x4d8441['type'])&&_0x4d8441[_0x65df('0x2f')]&&!_0x4d8441[_0x65df('0x30')]){_0x9918e5[_0x4d8441[_0x65df('0x2f')]['toLowerCase']()]=_0x4d8441['content']['toString']();}else if(_[_0x65df('0x2c')]([_0x65df('0x2d'),_0x65df('0x2e')],_0x4d8441[_0x65df('0x31')])&&_0x4d8441['idField']&&_0x4d8441[_0x65df('0x30')]){_0x9918e5[_0x4d8441['idField'][_0x65df('0x32')]()]=_0x4d8441[_0x65df('0x33')][_0x65df('0x34')]();}else if(_0x4d8441[_0x65df('0x31')]===_0x65df('0x35')&&_0x4d8441[_0x65df('0x36')]&&_0x4d8441[_0x65df('0x37')]&&_0x4d8441[_0x65df('0x30')]){_0x9918e5[_0x4d8441[_0x65df('0x37')][_0x65df('0x32')]()]=_0x3d4dbd[_0x4d8441[_0x65df('0x36')]][_0x65df('0x34')]();}else if(_0x4d8441['type']===_0x65df('0x38')&&_0x4d8441[_0x65df('0x39')]&&_0x4d8441[_0x65df('0x39')][_0x65df('0x3a')]&&_0x4d8441[_0x65df('0x37')]&&_0x4d8441[_0x65df('0x30')]){_0x9918e5[_0x4d8441[_0x65df('0x37')]['toLowerCase']()]=_0x3d4dbd[_0x4d8441[_0x65df('0x39')][_0x65df('0x3a')]['toLowerCase']()]['toString']();}});}return _0x9918e5;}function getTicket(_0x2cf420,_0x561d34,_0x179788,_0x22e429,_0x31bfbe,_0x5dab96){return function(_0x4373cd){logger[_0x65df('0x13')]('['+[_0x2cf420['toUpperCase']()]+_0x65df('0x3b'),_0x4373cd);return new Promise(function(_0x5020b4,_0x395944){var _0x1e1ecb=_0x2cf420[_0x65df('0x32')]()==='outbound'?_0x4373cd[_0x65df('0x1e')]:_0x4373cd[_0x65df('0x3c')];var _0x420dec={'method':_0x65df('0x23'),'uri':_0x179788+_0x65df('0x3d')+'?'+_0x5dab96,'body':Object['assign']({},{'active':_0x65df('0x1d'),'caller_id':_0x1e1ecb,'assigned_to':_0x4373cd[_0x65df('0x1e')],'short_description':intUtil[_0x65df('0x3e')](_0x22e429[_0x65df('0x3f')],_0x31bfbe,'\x20'),'description':intUtil[_0x65df('0x3e')](_0x22e429['Descriptions'],_0x31bfbe,'\x0a')},getCustomFields(_0x22e429['Fields'],_0x31bfbe)),'auth':_0x561d34,'json':!![]};return rp(_0x420dec)[_0x65df('0xe')](function(_0x2d2c80){logger[_0x65df('0x13')]('['+[_0x2cf420[_0x65df('0x14')]()]+_0x65df('0x40'),_0x2d2c80[_0x65df('0x11')]);_0x4373cd[_0x65df('0x41')]=_0x2d2c80[_0x65df('0x11')]['sys_id'];_0x4373cd[_0x65df('0x42')]=_0x2d2c80[_0x65df('0x11')][_0x65df('0x43')];logger['info']('['+[_0x2cf420[_0x65df('0x14')]()]+']\x20getTicket\x20crm',_0x4373cd);_0x5020b4(_0x4373cd);})['catch'](function(_0x165513){logger[_0x65df('0x16')]('['+[_0x2cf420[_0x65df('0x14')]()]+']',_0x165513[_0x65df('0x17')]);_0x395944(_0x165513[_0x65df('0x17')]);});});};}function createRemoteTag(_0x1390f3,_0x58909a,_0x3a6540,_0x4b190e){return new Promise(function(_0x1e9be4,_0x1f834b){var _0xc28b73={'method':'POST','uri':_0x3a6540+_0x65df('0x44')+'?'+_0x4b190e,'body':{'short_description':_0x1390f3,'global':!![],'active':!![],'name':_0x1390f3},'auth':_0x58909a,'json':!![]};return rp(_0xc28b73)[_0x65df('0xe')](function(_0x25704e){var _0x212e46=_0x25704e[_0x65df('0x11')]['sys_id'];_0x1e9be4(_0x212e46);});});}function getRemoteTag(_0x4f5b9a,_0x58a83b,_0x23003b,_0x28a6bd,_0x3705f4){return new Promise(function(_0x44f749,_0x349c8f){var _0x327b50={'method':_0x65df('0xc'),'uri':_0x23003b+_0x65df('0x44')+_0x65df('0x45')+_0x4f5b9a+'&'+_0x28a6bd,'auth':_0x58a83b,'json':!![]};return rp(_0x327b50)[_0x65df('0xe')](function(_0x2ba2a7){if(_0x2ba2a7['result'][_0x65df('0xf')]>0x0){var _0x3ac685=_0x2ba2a7[_0x65df('0x11')][0x0][_0x65df('0x12')];_0x44f749(_0x3ac685);}else{return createRemoteTag(_0x4f5b9a,_0x58a83b,_0x23003b,_0x28a6bd)[_0x65df('0xe')](function(_0xd3045f){_0x44f749(_0xd3045f);});}});});}function assignTagToIncident(_0x21cb3d,_0x489cf0,_0x1045d4,_0x326a11,_0x165329){return new Promise(function(_0x5ca2f7,_0x39c039){var _0x310d35={'method':_0x65df('0x23'),'uri':_0x1045d4+_0x65df('0x46')+'?'+_0x165329,'body':{'label':_0x21cb3d,'table':_0x65df('0x3d'),'id_type':_0x65df('0x47'),'table_key':_0x326a11[_0x65df('0x41')],'title':_0x65df('0x48')+_0x326a11[_0x65df('0x42')],'id_display':_0x326a11['ticketNumber']},'auth':_0x489cf0,'json':!![]};return rp(_0x310d35)[_0x65df('0xe')](function(_0x3d26bf){_0x5ca2f7();})[_0x65df('0x15')](function(){_0x5ca2f7();});});}function manageTags(_0x56409c,_0x3af90d,_0x45f3d6,_0x2f9872,_0x372169,_0xb4ef65,_0xbaf161){return new Promise(function(_0x26abe2,_0x4c0a71){var _0x1a6608=[];_0x3af90d[_0x65df('0x2b')](function(_0x55eea1){_0x1a6608[_0x65df('0x49')](getRemoteTag(_0x55eea1,_0x45f3d6,_0x2f9872,_0xb4ef65,_0xbaf161));});return Promise[_0x65df('0x4a')](_0x1a6608)[_0x65df('0xe')](function(_0x2a7524){if(_0x2a7524[_0x65df('0xf')]){logger[_0x65df('0x13')]('['+[_0x56409c[_0x65df('0x14')]()]+_0x65df('0x4b'),_0x2a7524);var _0x287294=[];_0x2a7524[_0x65df('0x2b')](function(_0x4e5ef7){_0x287294[_0x65df('0x49')](assignTagToIncident(_0x4e5ef7,_0x45f3d6,_0x2f9872,_0x372169,_0xb4ef65));});return Promise[_0x65df('0x4a')](_0x287294)[_0x65df('0xe')](function(){_0x26abe2();})[_0x65df('0x15')](function(){_0x26abe2();});}else{_0x26abe2();}});});}function getTags(_0x10ecf8,_0x272ecb,_0xd73bba,_0x17fe5c,_0x1516bc,_0x23e974){return function(_0x38ed37){return new Promise(function(_0xb8668e,_0x2f618d){var _0x1d042d=[];var _0x582292=_0x17fe5c[_0x65df('0x4c')];if(_0x582292&&_0x582292[_0x65df('0xf')]>0x0){_0x1d042d=_[_0x65df('0x4d')](_0x582292,_0x65df('0x3a'));}if(_0x1d042d[_0x65df('0xf')]>0x0){return manageTags(_0x10ecf8,_0x1d042d,_0x272ecb,_0xd73bba,_0x38ed37,_0x1516bc,_0x23e974)[_0x65df('0xe')](function(){_0xb8668e(_0x38ed37);});}else{_0xb8668e(_0x38ed37);}});};}function emit(_0x304da8,_0x55ddd0,_0x204c0f){var _0x2ff90a=_0x65df('0x4e')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+'%255EORDERBYDESCnumber';var _0x306de2={'uri':_0x304da8+_0x65df('0x4f')+_0x204c0f+_0x2ff90a};io['to'](util[_0x65df('0x50')]('user:%s',_0x55ddd0))[_0x65df('0x51')](_0x65df('0x52'),_0x306de2);}exports['cs']=function(_0x34a597,_0x333260,_0xc7845f,_0x316b27,_0x45e1f3,_0x114f05,_0x7957df,_0x1150ce){var _0x53ea85={};var _0x415dba={'user':_0x114f05[_0x65df('0x53')],'pass':_0x114f05[_0x65df('0x54')]};var _0x2c3570='sysparm_limit=1';var _0x49d412=_0x65df('0x55');_0x114f05[_0x65df('0x56')]=intUtil['stripTrailingSlash'](_0x114f05['remoteUri']);_0x114f05[_0x65df('0x57')]=intUtil[_0x65df('0x58')](_0x114f05['serverUrl']);var _0x1a3b8b=util['format'](_0x65df('0x59'),_0x114f05[_0x65df('0x56')]);_0x53ea85['userEmail']=!_['isNil'](_0x316b27)?_0x316b27['email']:null;_0x53ea85[_0x65df('0x1f')]=_0x114f05[_0x65df('0x5a')];_0x53ea85['endUserNumber']=_0x1150ce[_0x65df('0x32')]()===_0x65df('0x5b')?_0x333260[_0x65df('0x5c')]:_0x333260[_0x65df('0x5d')];_0x53ea85[_0x65df('0x5e')]=_0x1150ce===_0x65df('0x5f')||_0x1150ce===_0x65df('0x60')?_0x65df('0x5f'):_0x65df('0x5b');var _0xc66d2a=util[_0x65df('0x50')](_0x65df('0x61'),_0x114f05['serverUrl'],_0x333260[_0x65df('0x62')],md5(_0x333260[_0x65df('0x62')]));if(_0x45e1f3&&_0x45e1f3[_0x65df('0x63')]){logger[_0x65df('0x13')]('[QUEUE]',_0x65df('0x64'));_0x333260[_0x65df('0x65')]=_0xc66d2a;}else if(_0x7957df&&_0x7957df[_0x65df('0x66')]&&_0x7957df[_0x65df('0x66')]!==_0x65df('0x67')){logger['info'](_0x65df('0x68'),_0x65df('0x64'));_0x333260[_0x65df('0x65')]=_0xc66d2a;}else{_0x333260[_0x65df('0x65')]='';}return getAdminUser(_0x1150ce,_0x415dba,_0x53ea85,_0x1a3b8b,_0x49d412,_0x2c3570)[_0x65df('0xe')](getUser(_0x1150ce,_0x415dba,_0x1a3b8b,_0x49d412,_0x2c3570))['then'](getEndUser(_0x1150ce,_0x415dba,_0x1a3b8b,_0x49d412,_0x2c3570))[_0x65df('0xe')](getTicket(_0x1150ce,_0x415dba,_0x1a3b8b,_0xc7845f,_0x333260,_0x49d412))[_0x65df('0xe')](function(_0x1bfc68){logger[_0x65df('0x13')](util[_0x65df('0x50')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1bfc68[_0x65df('0x41')]));logger['info'](util[_0x65df('0x50')](_0x65df('0x69'),_0x1150ce));if(_0x1150ce!==_0x65df('0x60')){logger[_0x65df('0x13')]('['+[_0x1150ce['toUpperCase']()]+']',_0x65df('0x6a'));emit(_0x114f05[_0x65df('0x56')],_0x316b27[_0x65df('0x3a')],_0x1bfc68[_0x65df('0x41')]);}})[_0x65df('0x15')](function(_0x5cc66e){logger['error']('['+[_0x1150ce[_0x65df('0x14')]()]+_0x65df('0x6b'),util[_0x65df('0x6c')](_0x5cc66e,{'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 51de884..28de810 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 _0x4aea=['The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString','created_by','description','Descriptions','toISOString','slice','duration_hours','duration_minutes','parent_id','parent_type','parent_name','forEach','variableName','set_entry','JSON','stringify','Calls','format','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','info','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','find','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Enduser\x20created.','debug','[HTTP]','length','map','type','string','nameField','toLowerCase','customField','custom_fields','push','idField','content','customVariable','Variable','username','password','sessionID','set_relationship','remoteUri','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','catch','error','[QUEUE]','serverUrl','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x370fd2,_0x413f1d){var _0x2acc0d=function(_0x54f0c5){while(--_0x54f0c5){_0x370fd2['push'](_0x370fd2['shift']());}};_0x2acc0d(++_0x413f1d);}(_0x4aea,0x1d5));var _0xa4ae=function(_0x39f73e,_0x4dbe89){_0x39f73e=_0x39f73e-0x0;var _0x4891a6=_0x4aea[_0x39f73e];return _0x4891a6;};'use strict';var _=require(_0xa4ae('0x0'));var rp=require(_0xa4ae('0x1'));var BPromise=require(_0xa4ae('0x2'));var md5=require('md5');var util=require(_0xa4ae('0x3'));var Redis=require('ioredis');var intUtil=require(_0xa4ae('0x4'));var config=require(_0xa4ae('0x5'));var logger=require(_0xa4ae('0x6'))('sugarcrm');config[_0xa4ae('0x7')]=_['defaults'](config[_0xa4ae('0x7')],{'host':_0xa4ae('0x8'),'port':0x18eb});var io=require(_0xa4ae('0x9'))(new Redis(config['redis']));var def={'method':_0xa4ae('0xa'),'json':!![]};function emit(_0x7ca5b,_0x5e9379,_0x2c3d2b){io['to'](_0x7ca5b)[_0xa4ae('0xb')](_0x5e9379,_0x2c3d2b);}function getTicket(_0x3cbf08,_0x316065,_0x36dbd9,_0x2f0846,_0x2304bb,_0x115f4f,_0x30cd47,_0x3d6664){logger['info'](_0xa4ae('0xc'));var _0x13f5fd=new Date();var _0x418cab=[{'name':_0xa4ae('0xd'),'value':intUtil[_0xa4ae('0xe')](_0x2f0846['Subjects'],_0x2304bb,'\x20')},{'name':'assigned_user_id','value':_0x316065['id']},{'name':_0xa4ae('0xf'),'value':_0x316065['id']},{'name':_0xa4ae('0x10'),'value':intUtil[_0xa4ae('0xe')](_0x2f0846[_0xa4ae('0x11')],_0x2304bb,'\x0a')},{'name':'date_start','value':_0x13f5fd[_0xa4ae('0x12')]()[_0xa4ae('0x13')](0x0,0x13)['replace']('T','\x20')},{'name':_0xa4ae('0x14'),'value':'0'},{'name':_0xa4ae('0x15'),'value':'15'},{'name':_0xa4ae('0x16'),'value':_0x36dbd9['id']},{'name':_0xa4ae('0x17'),'value':'Contacts'},{'name':_0xa4ae('0x18'),'value':_0x36dbd9['name']},{'name':'direction','value':_0x3d6664}];if(_0x115f4f['length']){_[_0xa4ae('0x19')](_0x115f4f,function(_0x5de7a7){if(_0x2304bb[_0x5de7a7['variableName']]){_0x418cab['push']({'name':_0x5de7a7['idField'],'value':_0x2304bb[_0x5de7a7[_0xa4ae('0x1a')]]});}});}return request({'form':{'method':_0xa4ae('0x1b'),'input_type':'JSON','response_type':_0xa4ae('0x1c'),'rest_data':JSON[_0xa4ae('0x1d')]({'session':_0x30cd47['id'],'module_name':_0xa4ae('0x1e'),'name_value_list':_0x418cab})}});}function getAuth(_0x1ffed1){return util[_0xa4ae('0x1f')]('Basic\x20%s',new Buffer(_0x1ffed1[_0xa4ae('0x20')]+':X')[_0xa4ae('0x21')](_0xa4ae('0x22')));}function getServerInfo(_0x133eec){return request({'form':{'method':_0xa4ae('0x23'),'input_type':_0xa4ae('0x1c'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x133eec['id']})}});}function getUser(_0x4a5dc6,_0xabd9a1,_0x333ee6){if(!_[_0xa4ae('0x24')](_0xabd9a1)){logger['info'](_0xa4ae('0x25'),_0xabd9a1);return request({'form':{'method':_0xa4ae('0x26'),'input_type':_0xa4ae('0x1c'),'response_type':_0xa4ae('0x1c'),'rest_data':JSON[_0xa4ae('0x1d')]({'session':_0x333ee6['id'],'module_name':'Employees','query':util[_0xa4ae('0x1f')](_0xa4ae('0x27'),_0xabd9a1),'order_by':'','offset':'0','select_fields':['id','name',_0xa4ae('0x28')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa4ae('0x29')](function(_0x5bab20){if(_0x5bab20[_0xa4ae('0x2a')]['length']){var _0xc3f038=_['find'](_0x5bab20[_0xa4ae('0x2a')],function(_0x4e264d){return _0x4e264d[_0xa4ae('0x2b')]['user_name']['value']===_0xabd9a1;});if(_0xc3f038){logger[_0xa4ae('0x2c')](_0xa4ae('0x2d'));return BPromise[_0xa4ae('0x2e')]({'id':_0xc3f038[_0xa4ae('0x2b')]['id'][_0xa4ae('0x2f')],'name':_0xc3f038['name_value_list'][_0xa4ae('0xd')][_0xa4ae('0x2f')]});}}logger[_0xa4ae('0x2c')](_0xa4ae('0x30'));return BPromise[_0xa4ae('0x2e')]({'id':_0x333ee6[_0xa4ae('0x2b')][_0xa4ae('0x31')][_0xa4ae('0x2f')],'name':_0x333ee6[_0xa4ae('0x2b')][_0xa4ae('0x28')]['value']});});}else{logger['info'](_0xa4ae('0x32'));return BPromise[_0xa4ae('0x2e')]({'id':_0x333ee6['name_value_list']['user_id'][_0xa4ae('0x2f')],'name':_0x333ee6['name_value_list'][_0xa4ae('0x28')][_0xa4ae('0x2f')]});}}function getEndUser(_0xc3c3f7,_0x413b93,_0x5d5e23,_0x5db3d0){logger[_0xa4ae('0x2c')]('Searching\x20enduser\x20with\x20phone',_0x5d5e23);return request({'form':{'method':_0xa4ae('0x26'),'input_type':_0xa4ae('0x1c'),'response_type':_0xa4ae('0x1c'),'rest_data':JSON[_0xa4ae('0x1d')]({'session':_0x5db3d0['id'],'module_name':_0xa4ae('0x33'),'query':util[_0xa4ae('0x1f')](_0xa4ae('0x34'),_0x5d5e23),'order_by':'','offset':'0','select_fields':['id',_0xa4ae('0xd'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x20bd63){if(_0x20bd63['entry_list']['length']){var _0x277dc3=_[_0xa4ae('0x35')](_0x20bd63[_0xa4ae('0x2a')],function(_0x51a31f){return _0x51a31f[_0xa4ae('0x2b')][_0xa4ae('0x36')][_0xa4ae('0x2f')]===_0x5d5e23;});if(_0x277dc3){logger[_0xa4ae('0x2c')](_0xa4ae('0x37'));return BPromise[_0xa4ae('0x2e')]({'id':_0x277dc3['name_value_list']['id'][_0xa4ae('0x2f')],'name':_0x277dc3[_0xa4ae('0x2b')]['name'][_0xa4ae('0x2f')],'phone':_0x277dc3[_0xa4ae('0x2b')][_0xa4ae('0x36')][_0xa4ae('0x2f')]});}}else{logger['info'](_0xa4ae('0x38'));return request({'form':{'method':_0xa4ae('0x1b'),'input_type':'JSON','response_type':_0xa4ae('0x1c'),'rest_data':JSON['stringify']({'session':_0x5db3d0['id'],'module_name':_0xa4ae('0x33'),'name_value_list':[{'name':_0xa4ae('0x39'),'value':_0x413b93!==_0xa4ae('0x3a')?_0x413b93:util[_0xa4ae('0x1f')]('Caller\x20-\x20%s',_0x5d5e23)},{'name':'phone_home','value':_0x5d5e23}]})}})[_0xa4ae('0x29')](function(_0x451809){logger['info'](_0xa4ae('0x3b'));return BPromise[_0xa4ae('0x2e')]({'id':_0x451809['id'],'name':_0x451809['entry_list'][_0xa4ae('0x39')]['value'],'phone':_0x451809['entry_list'][_0xa4ae('0x36')]['value']});});}});}function request(_0x8ad5cc){logger[_0xa4ae('0x3c')](_0xa4ae('0x3d'),JSON[_0xa4ae('0x1d')](_0x8ad5cc));return rp(_['merge'](def,_0x8ad5cc));}function getTags(_0x3411c8,_0x5a00fb){var _0x23d950=[];if(_0x3411c8&&_0x3411c8[_0xa4ae('0x3e')]>0x0){_0x23d950=_[_0xa4ae('0x3f')](_0x3411c8,_0x5a00fb);}return _0x23d950;}function getCustomFields(_0x2d92de,_0x5d71d9){var _0xc34086=[];var _0x4a78e8={'custom_fields':[]};if(_0x2d92de[_0xa4ae('0x3e')]>0x0){_[_0xa4ae('0x19')](_0x2d92de,function(_0x2535c5){if(_0x2535c5[_0xa4ae('0x40')]===_0xa4ae('0x41')&&_0x2535c5[_0xa4ae('0x42')]&&!_0x2535c5['customField']){_0x4a78e8[_0x2535c5[_0xa4ae('0x42')][_0xa4ae('0x43')]()]=_0x2535c5['content'][_0xa4ae('0x21')]();}else if(_0x2535c5[_0xa4ae('0x40')]==='string'&&_0x2535c5['idField']&&_0x2535c5[_0xa4ae('0x44')]){_0x4a78e8[_0xa4ae('0x45')][_0xa4ae('0x46')]({'id':_0x2535c5[_0xa4ae('0x47')],'value':_0x2535c5[_0xa4ae('0x48')][_0xa4ae('0x21')]()});}else if(_0x2535c5[_0xa4ae('0x40')]==='variable'&&_0x2535c5[_0xa4ae('0x1a')]&&_0x2535c5['idField']&&_0x2535c5[_0xa4ae('0x44')]){_0x5d71d9[_0x2535c5[_0xa4ae('0x1a')]]&&_0x4a78e8[_0xa4ae('0x45')][_0xa4ae('0x46')]({'id':_0x2535c5['idField'],'value':_0x5d71d9[_0x2535c5[_0xa4ae('0x1a')]][_0xa4ae('0x21')]()});}else if(_0x2535c5['type']===_0xa4ae('0x49')&&_0x2535c5['Variable']&&_0x2535c5[_0xa4ae('0x4a')]['name']&&_0x2535c5[_0xa4ae('0x47')]&&_0x2535c5[_0xa4ae('0x44')]){_0x5d71d9[_0x2535c5[_0xa4ae('0x4a')][_0xa4ae('0xd')][_0xa4ae('0x43')]()]&&_0x4a78e8[_0xa4ae('0x45')][_0xa4ae('0x46')]({'id':_0x2535c5[_0xa4ae('0x47')],'value':_0x5d71d9[_0x2535c5[_0xa4ae('0x4a')][_0xa4ae('0xd')][_0xa4ae('0x43')]()]['toString']()});}});}return _0x4a78e8;}function getConnection(_0x3d2f31){return request({'method':_0xa4ae('0xa'),'form':{'method':'login','input_type':_0xa4ae('0x1c'),'response_type':_0xa4ae('0x1c'),'rest_data':JSON[_0xa4ae('0x1d')]({'user_auth':{'user_name':_0x3d2f31[_0xa4ae('0x4b')],'password':_0x3d2f31[_0xa4ae('0x4c')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0xa4ae('0x29')](function(_0xbf7d94){var _0x5bb09b=_0xbf7d94;if(_0x5bb09b['id']){def[_0xa4ae('0x4d')]=_0x5bb09b['id'];return BPromise[_0xa4ae('0x2e')](_0x5bb09b);}else{throw new Error(util[_0xa4ae('0x1f')]('Account\x20%d\x20is\x20not\x20valid',_0x3d2f31['id']));}});}function setRelationship(_0x1d396a,_0x5c44a0,_0x5414f1,_0x538a01){return request({'form':{'method':_0xa4ae('0x4e'),'input_type':'JSON','response_type':_0xa4ae('0x1c'),'rest_data':JSON[_0xa4ae('0x1d')]({'session':_0x1d396a['id'],'module_name':_0xa4ae('0x1e'),'module_id':_0x5414f1['id'],'link_field_name':_0x538a01,'related_ids':[_0x5c44a0['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x54afee,_0x2e7c3d,_0x40ee8d,_0x4bdc74,_0x28c87e,_0x1d39c7){var _0x79d0eb,_0x5b61e4,_0x22a3d0,_0xd5817a;_0x1d39c7[_0xa4ae('0x4f')]=intUtil[_0xa4ae('0x50')](_0x1d39c7[_0xa4ae('0x4f')]);_0x1d39c7['serverUrl']=intUtil[_0xa4ae('0x50')](_0x1d39c7['serverUrl']);def[_0xa4ae('0x51')]=util[_0xa4ae('0x1f')](_0xa4ae('0x52'),_0x1d39c7[_0xa4ae('0x4f')]);if(_0x28c87e&&_0x28c87e[_0xa4ae('0x53')]){logger[_0xa4ae('0x2c')]('[QUEUE]',_0xa4ae('0x54'));_0x2e7c3d[_0xa4ae('0x55')]=util[_0xa4ae('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1d39c7['serverUrl'],_0x2e7c3d['uniqueid'],md5(_0x2e7c3d['uniqueid']));}else{_0x2e7c3d[_0xa4ae('0x55')]='';}return getConnection(_0x1d39c7)[_0xa4ae('0x29')](function(_0x422d95){_0xd5817a=_0x422d95;return getUser(_0x1d39c7,_0x4bdc74[_0xa4ae('0xd')],_0xd5817a);})[_0xa4ae('0x29')](function(_0x2dd312){_0x79d0eb=_0x2dd312;logger[_0xa4ae('0x2c')]('The\x20User\x20ID\x20is:',_0x79d0eb['id']);return getEndUser(_0x1d39c7,_0x2e7c3d[_0xa4ae('0x56')],_0x2e7c3d[_0xa4ae('0x57')],_0xd5817a);})[_0xa4ae('0x29')](function(_0x5312d6){_0x5b61e4=_0x5312d6;logger[_0xa4ae('0x2c')](_0xa4ae('0x58'),_0x5b61e4['id']);return getTicket(_0x1d39c7,_0x79d0eb,_0x5b61e4,_0x40ee8d,_0x2e7c3d,_0x40ee8d[_0xa4ae('0x59')],_0xd5817a,_0xa4ae('0x5a'));})[_0xa4ae('0x29')](function(_0x2e4451){_0x22a3d0=_0x2e4451;logger[_0xa4ae('0x2c')](_0xa4ae('0x5b'));logger[_0xa4ae('0x2c')](_0xa4ae('0x5c'),_0x22a3d0['id']);return setRelationship(_0xd5817a,_0x79d0eb,_0x22a3d0,_0xa4ae('0x5d'));})[_0xa4ae('0x29')](function(){return setRelationship(_0xd5817a,_0x5b61e4,_0x22a3d0,_0xa4ae('0x5e'));})[_0xa4ae('0x29')](function(){return getServerInfo(_0xd5817a);})[_0xa4ae('0x29')](function(_0x187b67){var _0x3256b8=parseInt(_0x187b67[_0xa4ae('0x5f')][_0xa4ae('0x60')](0x0));var _0x446775=util[_0xa4ae('0x1f')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x1d39c7[_0xa4ae('0x4f')],_0x22a3d0['id']);if(_0x3256b8>0x6){_0x446775=util['format'](_0xa4ae('0x61'),_0x1d39c7[_0xa4ae('0x4f')],_0x22a3d0['id']);}logger[_0xa4ae('0x2c')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa4ae('0x1f')]('user:%s',_0x4bdc74[_0xa4ae('0xd')]),_0xa4ae('0x62'),{'uri':_0x446775});})[_0xa4ae('0x63')](function(_0x2bc6fe){logger[_0xa4ae('0x64')](_0xa4ae('0x65'),JSON[_0xa4ae('0x1d')](_0x2bc6fe));});};exports['outbound']=function(_0x1e6dd9,_0x4c1d98,_0x2e21f,_0xc6e4f4,_0x380a5f,_0x4bc12a,_0x262f0a){var _0x4b60f6,_0x1f485c,_0x18ae46,_0x157da7;_0x4bc12a[_0xa4ae('0x4f')]=intUtil[_0xa4ae('0x50')](_0x4bc12a['remoteUri']);_0x4bc12a['serverUrl']=intUtil['stripTrailingSlash'](_0x4bc12a[_0xa4ae('0x66')]);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x4bc12a[_0xa4ae('0x4f')]);if(_0x262f0a&&_0x262f0a['recordingFormat']&&_0x262f0a['recordingFormat']!=='none'){logger['info'](_0xa4ae('0x67'),_0xa4ae('0x54'));_0x4c1d98['recordingURL']=util['format'](_0xa4ae('0x68'),_0x4bc12a[_0xa4ae('0x66')],_0x4c1d98[_0xa4ae('0x69')],md5(_0x4c1d98[_0xa4ae('0x69')]));}return getConnection(_0x4bc12a)[_0xa4ae('0x29')](function(_0x56581f){_0x157da7=_0x56581f;return getUser(_0x4bc12a,_0xc6e4f4[_0xa4ae('0xd')],_0x157da7);})['then'](function(_0x581368){_0x4b60f6=_0x581368;logger['info'](_0xa4ae('0x6a'),_0x4b60f6['id']);return getEndUser(_0x4bc12a,_0x4c1d98[_0xa4ae('0x6b')],_0x4c1d98[_0xa4ae('0x6c')],_0x157da7);})[_0xa4ae('0x29')](function(_0x5802ff){_0x1f485c=_0x5802ff;logger[_0xa4ae('0x2c')](_0xa4ae('0x58'),_0x1f485c['id']);return getTicket(_0x4bc12a,_0x4b60f6,_0x1f485c,_0x2e21f,_0x4c1d98,_0x2e21f[_0xa4ae('0x59')],_0x157da7,_0xa4ae('0x6d'));})['then'](function(_0x5015af){_0x18ae46=_0x5015af;logger[_0xa4ae('0x2c')]('Ticket\x20created!');logger['info'](_0xa4ae('0x5c'),_0x18ae46['id']);return setRelationship(_0x157da7,_0x4b60f6,_0x18ae46,_0xa4ae('0x5d'));})[_0xa4ae('0x29')](function(){return setRelationship(_0x157da7,_0x1f485c,_0x18ae46,_0xa4ae('0x5e'));})['then'](function(){return getServerInfo(_0x157da7);})[_0xa4ae('0x29')](function(_0x1f221c){var _0xc1f695=parseInt(_0x1f221c['version'][_0xa4ae('0x60')](0x0));var _0x510164=util[_0xa4ae('0x1f')](_0xa4ae('0x6e'),_0x4bc12a[_0xa4ae('0x4f')],_0x18ae46['id']);if(_0xc1f695>0x6){_0x510164=util[_0xa4ae('0x1f')](_0xa4ae('0x61'),_0x4bc12a[_0xa4ae('0x4f')],_0x18ae46['id']);}logger['info'](_0xa4ae('0x67'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa4ae('0x1f')](_0xa4ae('0x6f'),_0xc6e4f4['name']),'trigger:browser:url',{'uri':_0x510164});})['catch'](function(_0xf3b923){logger['error'](_0xa4ae('0x67'),JSON[_0xa4ae('0x1d')](_0xf3b923));});};exports[_0xa4ae('0x70')]=function(_0xfb8114,_0x37dd3e,_0x3c5947,_0x596a2b,_0x4e5fea,_0x5e2bf8){var _0x39f201,_0x1ab115,_0x5bbccb,_0x322796;_0x5e2bf8['remoteUri']=intUtil[_0xa4ae('0x50')](_0x5e2bf8[_0xa4ae('0x4f')]);_0x5e2bf8['serverUrl']=intUtil[_0xa4ae('0x50')](_0x5e2bf8['serverUrl']);def[_0xa4ae('0x51')]=util[_0xa4ae('0x1f')](_0xa4ae('0x52'),_0x5e2bf8[_0xa4ae('0x4f')]);if(_0x4e5fea&&_0x4e5fea[_0xa4ae('0x53')]){logger[_0xa4ae('0x2c')]('['+_0x37dd3e['lastevent']['toUpperCase']()+']',_0xa4ae('0x54'));_0x37dd3e[_0xa4ae('0x55')]=util[_0xa4ae('0x1f')](_0xa4ae('0x68'),_0x5e2bf8[_0xa4ae('0x66')],_0x37dd3e[_0xa4ae('0x69')],md5(_0x37dd3e['uniqueid']));}else{_0x37dd3e[_0xa4ae('0x55')]='';}return getConnection(_0x5e2bf8)['then'](function(_0x3dce6b){_0x322796=_0x3dce6b;if(!_[_0xa4ae('0x24')](_0x596a2b)){return getUser(_0x5e2bf8,_0x596a2b[_0xa4ae('0xd')],_0x322796);}else{return getUser(_0x5e2bf8,null,_0x322796);}})[_0xa4ae('0x29')](function(_0x4368ab){_0x39f201=_0x4368ab;logger['info'](_0xa4ae('0x6a'),_0x39f201['id']);return getEndUser(_0x5e2bf8,_0x37dd3e['calleridname'],_0x37dd3e[_0xa4ae('0x57')],_0x322796);})[_0xa4ae('0x29')](function(_0xbad599){_0x1ab115=_0xbad599;logger['info'](_0xa4ae('0x58'),_0x1ab115['id']);return getTicket(_0x5e2bf8,_0x39f201,_0x1ab115,_0x3c5947,_0x37dd3e,_0x3c5947[_0xa4ae('0x59')],_0x322796,_0xa4ae('0x5a'));})[_0xa4ae('0x29')](function(_0x305495){_0x5bbccb=_0x305495;logger[_0xa4ae('0x2c')](_0xa4ae('0x5b'));logger[_0xa4ae('0x2c')]('The\x20Ticket\x20ID\x20is:',_0x5bbccb['id']);return setRelationship(_0x322796,_0x39f201,_0x5bbccb,_0xa4ae('0x5d'));})[_0xa4ae('0x29')](function(){return setRelationship(_0x322796,_0x1ab115,_0x5bbccb,'contacts');})[_0xa4ae('0x29')](function(){return getServerInfo(_0x322796);})[_0xa4ae('0x63')](function(_0x99efe){logger[_0xa4ae('0x64')]('['+_0x37dd3e[_0xa4ae('0x71')][_0xa4ae('0x72')]()+']',JSON[_0xa4ae('0x1d')](_0x99efe));});}; \ No newline at end of file +var _0x7918=['./util','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','getString','assigned_user_id','created_by','description','toISOString','replace','duration_hours','duration_minutes','parent_name','direction','forEach','idField','variableName','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','length','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','first_name','','Caller\x20-\x20%s','debug','map','type','string','customField','toLowerCase','content','push','variable','custom_fields','customVariable','Variable','POST','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','%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','unmanaged','toUpperCase','calleridname','Inbound','lodash','request-promise','bluebird','md5','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7918,0x72));var _0x8791=function(_0x400f29,_0xf3310f){_0x400f29=_0x400f29-0x0;var _0xb7635d=_0x7918[_0x400f29];return _0xb7635d;};'use strict';var _=require(_0x8791('0x0'));var rp=require(_0x8791('0x1'));var BPromise=require(_0x8791('0x2'));var md5=require(_0x8791('0x3'));var util=require(_0x8791('0x4'));var Redis=require('ioredis');var intUtil=require(_0x8791('0x5'));var config=require('../../../../config/environment');var logger=require(_0x8791('0x6'))(_0x8791('0x7'));config[_0x8791('0x8')]=_['defaults'](config[_0x8791('0x8')],{'host':_0x8791('0x9'),'port':0x18eb});var io=require(_0x8791('0xa'))(new Redis(config[_0x8791('0x8')]));var def={'method':'POST','json':!![]};function emit(_0x5340cc,_0x33f12e,_0x29c130){io['to'](_0x5340cc)[_0x8791('0xb')](_0x33f12e,_0x29c130);}function getTicket(_0x255252,_0x41371b,_0x34f0b1,_0x1a060c,_0x3cf862,_0x15db4c,_0x2ad3fd,_0x152eaa){logger[_0x8791('0xc')](_0x8791('0xd'));var _0x3dde35=new Date();var _0x3ae593=[{'name':_0x8791('0xe'),'value':intUtil[_0x8791('0xf')](_0x1a060c['Subjects'],_0x3cf862,'\x20')},{'name':_0x8791('0x10'),'value':_0x41371b['id']},{'name':_0x8791('0x11'),'value':_0x41371b['id']},{'name':_0x8791('0x12'),'value':intUtil[_0x8791('0xf')](_0x1a060c['Descriptions'],_0x3cf862,'\x0a')},{'name':'date_start','value':_0x3dde35[_0x8791('0x13')]()['slice'](0x0,0x13)[_0x8791('0x14')]('T','\x20')},{'name':_0x8791('0x15'),'value':'0'},{'name':_0x8791('0x16'),'value':'15'},{'name':'parent_id','value':_0x34f0b1['id']},{'name':'parent_type','value':'Contacts'},{'name':_0x8791('0x17'),'value':_0x34f0b1[_0x8791('0xe')]},{'name':_0x8791('0x18'),'value':_0x152eaa}];if(_0x15db4c['length']){_[_0x8791('0x19')](_0x15db4c,function(_0x4bfea4){if(_0x3cf862[_0x4bfea4['variableName']]){_0x3ae593['push']({'name':_0x4bfea4[_0x8791('0x1a')],'value':_0x3cf862[_0x4bfea4[_0x8791('0x1b')]]});}});}return request({'form':{'method':_0x8791('0x1c'),'input_type':_0x8791('0x1d'),'response_type':_0x8791('0x1d'),'rest_data':JSON[_0x8791('0x1e')]({'session':_0x2ad3fd['id'],'module_name':_0x8791('0x1f'),'name_value_list':_0x3ae593})}});}function getAuth(_0x5ed15f){return util[_0x8791('0x20')](_0x8791('0x21'),new Buffer(_0x5ed15f[_0x8791('0x22')]+':X')[_0x8791('0x23')](_0x8791('0x24')));}function getServerInfo(_0x303a2d){return request({'form':{'method':'get_server_info','input_type':_0x8791('0x1d'),'response_type':'JSON','rest_data':JSON[_0x8791('0x1e')]({'session':_0x303a2d['id']})}});}function getUser(_0x29d6b6,_0x33bb39,_0x48cfa8){if(!_['isNil'](_0x33bb39)){logger[_0x8791('0xc')](_0x8791('0x25'),_0x33bb39);return request({'form':{'method':_0x8791('0x26'),'input_type':_0x8791('0x1d'),'response_type':_0x8791('0x1d'),'rest_data':JSON['stringify']({'session':_0x48cfa8['id'],'module_name':_0x8791('0x27'),'query':util['format'](_0x8791('0x28'),_0x33bb39),'order_by':'','offset':'0','select_fields':['id',_0x8791('0xe'),_0x8791('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x15ca53){if(_0x15ca53[_0x8791('0x2a')][_0x8791('0x2b')]){var _0x349065=_['find'](_0x15ca53[_0x8791('0x2a')],function(_0x1512ba){return _0x1512ba['name_value_list'][_0x8791('0x29')][_0x8791('0x2c')]===_0x33bb39;});if(_0x349065){logger[_0x8791('0xc')](_0x8791('0x2d'));return BPromise[_0x8791('0x2e')]({'id':_0x349065['name_value_list']['id'][_0x8791('0x2c')],'name':_0x349065[_0x8791('0x2f')][_0x8791('0xe')]['value']});}}logger[_0x8791('0xc')](_0x8791('0x30'));return BPromise[_0x8791('0x2e')]({'id':_0x48cfa8[_0x8791('0x2f')][_0x8791('0x31')][_0x8791('0x2c')],'name':_0x48cfa8['name_value_list']['user_name'][_0x8791('0x2c')]});});}else{logger[_0x8791('0xc')](_0x8791('0x32'));return BPromise[_0x8791('0x2e')]({'id':_0x48cfa8['name_value_list']['user_id'][_0x8791('0x2c')],'name':_0x48cfa8[_0x8791('0x2f')][_0x8791('0x29')][_0x8791('0x2c')]});}}function getEndUser(_0x20843e,_0x2f2d39,_0x344288,_0x36593e){logger[_0x8791('0xc')](_0x8791('0x33'),_0x344288);return request({'form':{'method':_0x8791('0x26'),'input_type':_0x8791('0x1d'),'response_type':_0x8791('0x1d'),'rest_data':JSON[_0x8791('0x1e')]({'session':_0x36593e['id'],'module_name':'Contacts','query':util[_0x8791('0x20')](_0x8791('0x34'),_0x344288),'order_by':'','offset':'0','select_fields':['id',_0x8791('0xe'),_0x8791('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8791('0x36')](function(_0x3ed1cd){if(_0x3ed1cd[_0x8791('0x2a')]['length']){var _0x8f1271=_[_0x8791('0x37')](_0x3ed1cd[_0x8791('0x2a')],function(_0x4f26d9){return _0x4f26d9[_0x8791('0x2f')][_0x8791('0x35')]['value']===_0x344288;});if(_0x8f1271){logger[_0x8791('0xc')](_0x8791('0x38'));return BPromise['resolve']({'id':_0x8f1271[_0x8791('0x2f')]['id'][_0x8791('0x2c')],'name':_0x8f1271[_0x8791('0x2f')]['name'][_0x8791('0x2c')],'phone':_0x8f1271[_0x8791('0x2f')][_0x8791('0x35')][_0x8791('0x2c')]});}}else{logger[_0x8791('0xc')](_0x8791('0x39'));return request({'form':{'method':_0x8791('0x1c'),'input_type':'JSON','response_type':_0x8791('0x1d'),'rest_data':JSON[_0x8791('0x1e')]({'session':_0x36593e['id'],'module_name':_0x8791('0x3a'),'name_value_list':[{'name':_0x8791('0x3b'),'value':_0x2f2d39!==_0x8791('0x3c')?_0x2f2d39:util['format'](_0x8791('0x3d'),_0x344288)},{'name':_0x8791('0x35'),'value':_0x344288}]})}})[_0x8791('0x36')](function(_0x38925f){logger[_0x8791('0xc')]('Enduser\x20created.');return BPromise[_0x8791('0x2e')]({'id':_0x38925f['id'],'name':_0x38925f['entry_list']['first_name']['value'],'phone':_0x38925f[_0x8791('0x2a')][_0x8791('0x35')][_0x8791('0x2c')]});});}});}function request(_0x1119e9){logger[_0x8791('0x3e')]('[HTTP]',JSON['stringify'](_0x1119e9));return rp(_['merge'](def,_0x1119e9));}function getTags(_0xe57df2,_0x50ae8c){var _0x186bbc=[];if(_0xe57df2&&_0xe57df2['length']>0x0){_0x186bbc=_[_0x8791('0x3f')](_0xe57df2,_0x50ae8c);}return _0x186bbc;}function getCustomFields(_0x10fe72,_0x5ef9e9){var _0x595e74=[];var _0x5d1789={'custom_fields':[]};if(_0x10fe72['length']>0x0){_[_0x8791('0x19')](_0x10fe72,function(_0x39bd7d){if(_0x39bd7d[_0x8791('0x40')]===_0x8791('0x41')&&_0x39bd7d['nameField']&&!_0x39bd7d[_0x8791('0x42')]){_0x5d1789[_0x39bd7d['nameField'][_0x8791('0x43')]()]=_0x39bd7d[_0x8791('0x44')][_0x8791('0x23')]();}else if(_0x39bd7d['type']===_0x8791('0x41')&&_0x39bd7d[_0x8791('0x1a')]&&_0x39bd7d[_0x8791('0x42')]){_0x5d1789['custom_fields'][_0x8791('0x45')]({'id':_0x39bd7d[_0x8791('0x1a')],'value':_0x39bd7d[_0x8791('0x44')][_0x8791('0x23')]()});}else if(_0x39bd7d[_0x8791('0x40')]===_0x8791('0x46')&&_0x39bd7d['variableName']&&_0x39bd7d[_0x8791('0x1a')]&&_0x39bd7d[_0x8791('0x42')]){_0x5ef9e9[_0x39bd7d[_0x8791('0x1b')]]&&_0x5d1789[_0x8791('0x47')][_0x8791('0x45')]({'id':_0x39bd7d[_0x8791('0x1a')],'value':_0x5ef9e9[_0x39bd7d['variableName']][_0x8791('0x23')]()});}else if(_0x39bd7d[_0x8791('0x40')]===_0x8791('0x48')&&_0x39bd7d['Variable']&&_0x39bd7d['Variable']['name']&&_0x39bd7d[_0x8791('0x1a')]&&_0x39bd7d[_0x8791('0x42')]){_0x5ef9e9[_0x39bd7d[_0x8791('0x49')]['name'][_0x8791('0x43')]()]&&_0x5d1789[_0x8791('0x47')]['push']({'id':_0x39bd7d[_0x8791('0x1a')],'value':_0x5ef9e9[_0x39bd7d[_0x8791('0x49')]['name'][_0x8791('0x43')]()]['toString']()});}});}return _0x5d1789;}function getConnection(_0x4cfe25){return request({'method':_0x8791('0x4a'),'form':{'method':_0x8791('0x4b'),'input_type':_0x8791('0x1d'),'response_type':_0x8791('0x1d'),'rest_data':JSON[_0x8791('0x1e')]({'user_auth':{'user_name':_0x4cfe25['username'],'password':_0x4cfe25[_0x8791('0x4c')],'encryption':_0x8791('0x4d')},'application':_0x8791('0x4e')})}})[_0x8791('0x36')](function(_0x4f6903){var _0x17b282=_0x4f6903;if(_0x17b282['id']){def[_0x8791('0x4f')]=_0x17b282['id'];return BPromise[_0x8791('0x2e')](_0x17b282);}else{throw new Error(util[_0x8791('0x20')]('Account\x20%d\x20is\x20not\x20valid',_0x4cfe25['id']));}});}function setRelationship(_0x2d5585,_0x2ecee1,_0x3dc74e,_0xc1355f){return request({'form':{'method':_0x8791('0x50'),'input_type':_0x8791('0x1d'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x2d5585['id'],'module_name':'Calls','module_id':_0x3dc74e['id'],'link_field_name':_0xc1355f,'related_ids':[_0x2ecee1['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x2683c1,_0x3ff597,_0x25f5e7,_0x327d03,_0x1543b9,_0x4961aa){var _0x5e772d,_0x3e1d69,_0x1fc5ba,_0x10bdfa;_0x4961aa[_0x8791('0x51')]=intUtil[_0x8791('0x52')](_0x4961aa[_0x8791('0x51')]);_0x4961aa[_0x8791('0x53')]=intUtil[_0x8791('0x52')](_0x4961aa[_0x8791('0x53')]);def[_0x8791('0x54')]=util[_0x8791('0x20')](_0x8791('0x55'),_0x4961aa['remoteUri']);if(_0x1543b9&&_0x1543b9[_0x8791('0x56')]){logger[_0x8791('0xc')](_0x8791('0x57'),_0x8791('0x58'));_0x3ff597[_0x8791('0x59')]=util[_0x8791('0x20')](_0x8791('0x5a'),_0x4961aa['serverUrl'],_0x3ff597[_0x8791('0x5b')],md5(_0x3ff597[_0x8791('0x5b')]));}else{_0x3ff597['recordingURL']='';}return getConnection(_0x4961aa)[_0x8791('0x36')](function(_0x59f86f){_0x10bdfa=_0x59f86f;return getUser(_0x4961aa,_0x327d03[_0x8791('0xe')],_0x10bdfa);})[_0x8791('0x36')](function(_0x138d37){_0x5e772d=_0x138d37;logger[_0x8791('0xc')](_0x8791('0x5c'),_0x5e772d['id']);return getEndUser(_0x4961aa,_0x3ff597['calleridname'],_0x3ff597[_0x8791('0x5d')],_0x10bdfa);})[_0x8791('0x36')](function(_0x11d172){_0x3e1d69=_0x11d172;logger[_0x8791('0xc')](_0x8791('0x5e'),_0x3e1d69['id']);return getTicket(_0x4961aa,_0x5e772d,_0x3e1d69,_0x25f5e7,_0x3ff597,_0x25f5e7[_0x8791('0x5f')],_0x10bdfa,'Inbound');})[_0x8791('0x36')](function(_0x12a54d){_0x1fc5ba=_0x12a54d;logger[_0x8791('0xc')](_0x8791('0x60'));logger[_0x8791('0xc')](_0x8791('0x61'),_0x1fc5ba['id']);return setRelationship(_0x10bdfa,_0x5e772d,_0x1fc5ba,_0x8791('0x62'));})['then'](function(){return setRelationship(_0x10bdfa,_0x3e1d69,_0x1fc5ba,_0x8791('0x63'));})[_0x8791('0x36')](function(){return getServerInfo(_0x10bdfa);})[_0x8791('0x36')](function(_0x5a917b){var _0x5c3668=parseInt(_0x5a917b['version'][_0x8791('0x64')](0x0));var _0x252ccc=util[_0x8791('0x20')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x4961aa[_0x8791('0x51')],_0x1fc5ba['id']);if(_0x5c3668>0x6){_0x252ccc=util[_0x8791('0x20')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x4961aa['remoteUri'],_0x1fc5ba['id']);}logger[_0x8791('0xc')]('[QUEUE]',_0x8791('0x65'));emit(util['format'](_0x8791('0x66'),_0x327d03[_0x8791('0xe')]),_0x8791('0x67'),{'uri':_0x252ccc});})[_0x8791('0x68')](function(_0xd627f9){logger[_0x8791('0x69')](_0x8791('0x57'),JSON[_0x8791('0x1e')](_0xd627f9));});};exports[_0x8791('0x6a')]=function(_0x2cd4ff,_0x5be25c,_0x4cb5bb,_0x3fe721,_0x36348e,_0x583d8b,_0x3126eb){var _0x3422d0,_0x15a53f,_0x484989,_0x5d2f49;_0x583d8b['remoteUri']=intUtil[_0x8791('0x52')](_0x583d8b[_0x8791('0x51')]);_0x583d8b[_0x8791('0x53')]=intUtil[_0x8791('0x52')](_0x583d8b[_0x8791('0x53')]);def[_0x8791('0x54')]=util[_0x8791('0x20')](_0x8791('0x55'),_0x583d8b[_0x8791('0x51')]);if(_0x3126eb&&_0x3126eb['recordingFormat']&&_0x3126eb[_0x8791('0x6b')]!==_0x8791('0x6c')){logger[_0x8791('0xc')](_0x8791('0x6d'),_0x8791('0x58'));_0x5be25c['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x583d8b[_0x8791('0x53')],_0x5be25c[_0x8791('0x5b')],md5(_0x5be25c[_0x8791('0x5b')]));}return getConnection(_0x583d8b)[_0x8791('0x36')](function(_0xfdd1f0){_0x5d2f49=_0xfdd1f0;return getUser(_0x583d8b,_0x3fe721[_0x8791('0xe')],_0x5d2f49);})['then'](function(_0x18d074){_0x3422d0=_0x18d074;logger[_0x8791('0xc')](_0x8791('0x5c'),_0x3422d0['id']);return getEndUser(_0x583d8b,_0x5be25c[_0x8791('0x6e')],_0x5be25c[_0x8791('0x6f')],_0x5d2f49);})[_0x8791('0x36')](function(_0x4ab6d0){_0x15a53f=_0x4ab6d0;logger['info'](_0x8791('0x5e'),_0x15a53f['id']);return getTicket(_0x583d8b,_0x3422d0,_0x15a53f,_0x4cb5bb,_0x5be25c,_0x4cb5bb['Fields'],_0x5d2f49,_0x8791('0x70'));})[_0x8791('0x36')](function(_0x412da4){_0x484989=_0x412da4;logger[_0x8791('0xc')](_0x8791('0x60'));logger[_0x8791('0xc')](_0x8791('0x61'),_0x484989['id']);return setRelationship(_0x5d2f49,_0x3422d0,_0x484989,'users');})[_0x8791('0x36')](function(){return setRelationship(_0x5d2f49,_0x15a53f,_0x484989,_0x8791('0x63'));})[_0x8791('0x36')](function(){return getServerInfo(_0x5d2f49);})[_0x8791('0x36')](function(_0x4e3c64){var _0x22a9be=parseInt(_0x4e3c64['version']['charAt'](0x0));var _0x162234=util[_0x8791('0x20')](_0x8791('0x71'),_0x583d8b[_0x8791('0x51')],_0x484989['id']);if(_0x22a9be>0x6){_0x162234=util[_0x8791('0x20')](_0x8791('0x72'),_0x583d8b[_0x8791('0x51')],_0x484989['id']);}logger['info'](_0x8791('0x6d'),_0x8791('0x65'));emit(util['format'](_0x8791('0x66'),_0x3fe721[_0x8791('0xe')]),'trigger:browser:url',{'uri':_0x162234});})[_0x8791('0x68')](function(_0x44f748){logger[_0x8791('0x69')](_0x8791('0x6d'),JSON[_0x8791('0x1e')](_0x44f748));});};exports[_0x8791('0x73')]=function(_0x1736b0,_0x5cb8ab,_0xc04dbd,_0x5efb6c,_0x4531aa,_0x21eb58){var _0x33b183,_0x4559ad,_0x436438,_0x8d57bd;_0x21eb58[_0x8791('0x51')]=intUtil['stripTrailingSlash'](_0x21eb58['remoteUri']);_0x21eb58[_0x8791('0x53')]=intUtil[_0x8791('0x52')](_0x21eb58[_0x8791('0x53')]);def[_0x8791('0x54')]=util[_0x8791('0x20')](_0x8791('0x55'),_0x21eb58['remoteUri']);if(_0x4531aa&&_0x4531aa['monitor_format']){logger['info']('['+_0x5cb8ab['lastevent'][_0x8791('0x74')]()+']',_0x8791('0x58'));_0x5cb8ab['recordingURL']=util[_0x8791('0x20')](_0x8791('0x5a'),_0x21eb58[_0x8791('0x53')],_0x5cb8ab[_0x8791('0x5b')],md5(_0x5cb8ab[_0x8791('0x5b')]));}else{_0x5cb8ab[_0x8791('0x59')]='';}return getConnection(_0x21eb58)[_0x8791('0x36')](function(_0x53f16f){_0x8d57bd=_0x53f16f;if(!_['isNil'](_0x5efb6c)){return getUser(_0x21eb58,_0x5efb6c['name'],_0x8d57bd);}else{return getUser(_0x21eb58,null,_0x8d57bd);}})[_0x8791('0x36')](function(_0x273a80){_0x33b183=_0x273a80;logger[_0x8791('0xc')](_0x8791('0x5c'),_0x33b183['id']);return getEndUser(_0x21eb58,_0x5cb8ab[_0x8791('0x75')],_0x5cb8ab[_0x8791('0x5d')],_0x8d57bd);})[_0x8791('0x36')](function(_0x41f470){_0x4559ad=_0x41f470;logger['info'](_0x8791('0x5e'),_0x4559ad['id']);return getTicket(_0x21eb58,_0x33b183,_0x4559ad,_0xc04dbd,_0x5cb8ab,_0xc04dbd['Fields'],_0x8d57bd,_0x8791('0x76'));})[_0x8791('0x36')](function(_0xb6deeb){_0x436438=_0xb6deeb;logger[_0x8791('0xc')]('Ticket\x20created!');logger[_0x8791('0xc')]('The\x20Ticket\x20ID\x20is:',_0x436438['id']);return setRelationship(_0x8d57bd,_0x33b183,_0x436438,'users');})[_0x8791('0x36')](function(){return setRelationship(_0x8d57bd,_0x4559ad,_0x436438,'contacts');})[_0x8791('0x36')](function(){return getServerInfo(_0x8d57bd);})['catch'](function(_0x50ec82){logger[_0x8791('0x69')]('['+_0x5cb8ab['lastevent']['toUpperCase']()+']',JSON[_0x8791('0x1e')](_0x50ec82));});}; \ 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 b770304..0b90fba 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 _0xe030=['variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','key','format','%s:\x20%s','keyContent','keyType','join','stripTrailingSlash','slice','substring','validateEmail','isNil','test','lodash','util','getString','length','type','string','push','content','variable'];(function(_0x2b8d94,_0x52cded){var _0x39515e=function(_0x416179){while(--_0x416179){_0x2b8d94['push'](_0x2b8d94['shift']());}};_0x39515e(++_0x52cded);}(_0xe030,0xf3));var _0x0e03=function(_0x2db4d5,_0x2ff676){_0x2db4d5=_0x2db4d5-0x0;var _0x567cb7=_0xe030[_0x2db4d5];return _0x567cb7;};'use strict';var _=require(_0x0e03('0x0'));var util=require(_0x0e03('0x1'));exports[_0x0e03('0x2')]=function(_0x48ac6c,_0x5bad2e,_0xd2687){var _0x3114ac=[];if(_0x48ac6c['length']>0x0){var _0x4cdd48=_['sortBy'](_0x48ac6c,['id']);for(var _0x3aa037=0x0;_0x3aa037<_0x4cdd48[_0x0e03('0x3')];_0x3aa037++){var _0x3167ba=_0x4cdd48[_0x3aa037];if(_0x3167ba[_0x0e03('0x4')]===_0x0e03('0x5')){_0x3114ac[_0x0e03('0x6')](_0x3167ba[_0x0e03('0x7')]);}else if(_0x3167ba[_0x0e03('0x4')]===_0x0e03('0x8')&&_0x3167ba[_0x0e03('0x9')]){_0x5bad2e[_0x3167ba[_0x0e03('0x9')]]&&_0x3114ac[_0x0e03('0x6')](_0x5bad2e[_0x3167ba[_0x0e03('0x9')]]['toString']());}else if(_0x3167ba['type']===_0x0e03('0xa')&&_0x3167ba[_0x0e03('0xb')]&&_0x3167ba[_0x0e03('0xb')]['name']){_0x5bad2e[_0x3167ba[_0x0e03('0xb')][_0x0e03('0xc')]['toLowerCase']()]&&_0x3114ac[_0x0e03('0x6')](_0x5bad2e[_0x3167ba[_0x0e03('0xb')][_0x0e03('0xc')][_0x0e03('0xd')]()][_0x0e03('0xe')]());}else if(_0x3167ba[_0x0e03('0x4')]===_0x0e03('0xf')){if(_0x3167ba['keyType']===_0x0e03('0x5')&&_0x3167ba[_0x0e03('0x10')]){_0x3114ac[_0x0e03('0x6')](util[_0x0e03('0x11')](_0x0e03('0x12'),_0x3167ba[_0x0e03('0x10')],_0x3167ba[_0x0e03('0x13')]));}else if(_0x3167ba['keyType']===_0x0e03('0x8')&&_0x3167ba[_0x0e03('0x9')]&&_0x3167ba[_0x0e03('0x10')]){_0x5bad2e[_0x3167ba[_0x0e03('0x9')]]&&_0x3114ac['push'](util[_0x0e03('0x11')]('%s:\x20%s',_0x3167ba['key'],_0x5bad2e[_0x3167ba['variableName']]));}else if(_0x3167ba[_0x0e03('0x14')]===_0x0e03('0xa')&&_0x3167ba[_0x0e03('0xb')]&&_0x3167ba[_0x0e03('0xb')]['name']&&_0x3167ba[_0x0e03('0x10')]){_0x5bad2e[_0x3167ba['Variable'][_0x0e03('0xc')][_0x0e03('0xd')]()]&&_0x3114ac[_0x0e03('0x6')](util['format'](_0x0e03('0x12'),_0x3167ba['key'],_0x5bad2e[_0x3167ba[_0x0e03('0xb')]['name'][_0x0e03('0xd')]()]));}}}}return _0x3114ac[_0x0e03('0x15')](_0xd2687);};exports[_0x0e03('0x16')]=function(_0x196905){var _0x1cff25=_0x196905[_0x0e03('0x17')](-0x1);if(_0x1cff25==='/'){_0x196905=_0x196905[_0x0e03('0x18')](0x0,_0x196905['lastIndexOf'](_0x1cff25));}return _0x196905;};exports[_0x0e03('0x19')]=function(_0x45f4b6){if(!_[_0x0e03('0x1a')](_0x45f4b6)&&_0x45f4b6!==''){var _0x2f0178=/^(([^<>()\[\]\\.,;:\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 _0x2f0178[_0x0e03('0x1b')](String(_0x45f4b6)[_0x0e03('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x7568=['join','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','lodash','getString','length','sortBy','string','push','variableName','toString','type','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','keyContent','variable','%s:\x20%s'];(function(_0x40c35d,_0x174443){var _0xed74dc=function(_0x155c68){while(--_0x155c68){_0x40c35d['push'](_0x40c35d['shift']());}};_0xed74dc(++_0x174443);}(_0x7568,0x1ed));var _0x8756=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x7568[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0x8756('0x0'));var util=require('util');exports[_0x8756('0x1')]=function(_0xe30ba,_0x2844cf,_0x11b07d){var _0xc83961=[];if(_0xe30ba[_0x8756('0x2')]>0x0){var _0x1a1c7a=_[_0x8756('0x3')](_0xe30ba,['id']);for(var _0x352e4b=0x0;_0x352e4b<_0x1a1c7a[_0x8756('0x2')];_0x352e4b++){var _0x9460ad=_0x1a1c7a[_0x352e4b];if(_0x9460ad['type']===_0x8756('0x4')){_0xc83961[_0x8756('0x5')](_0x9460ad['content']);}else if(_0x9460ad['type']==='variable'&&_0x9460ad[_0x8756('0x6')]){_0x2844cf[_0x9460ad[_0x8756('0x6')]]&&_0xc83961[_0x8756('0x5')](_0x2844cf[_0x9460ad[_0x8756('0x6')]][_0x8756('0x7')]());}else if(_0x9460ad[_0x8756('0x8')]===_0x8756('0x9')&&_0x9460ad[_0x8756('0xa')]&&_0x9460ad[_0x8756('0xa')][_0x8756('0xb')]){_0x2844cf[_0x9460ad[_0x8756('0xa')][_0x8756('0xb')][_0x8756('0xc')]()]&&_0xc83961[_0x8756('0x5')](_0x2844cf[_0x9460ad['Variable'][_0x8756('0xb')]['toLowerCase']()][_0x8756('0x7')]());}else if(_0x9460ad[_0x8756('0x8')]===_0x8756('0xd')){if(_0x9460ad[_0x8756('0xe')]===_0x8756('0x4')&&_0x9460ad[_0x8756('0xf')]){_0xc83961['push'](util[_0x8756('0x10')]('%s:\x20%s',_0x9460ad[_0x8756('0xf')],_0x9460ad[_0x8756('0x11')]));}else if(_0x9460ad[_0x8756('0xe')]===_0x8756('0x12')&&_0x9460ad[_0x8756('0x6')]&&_0x9460ad[_0x8756('0xf')]){_0x2844cf[_0x9460ad['variableName']]&&_0xc83961[_0x8756('0x5')](util[_0x8756('0x10')](_0x8756('0x13'),_0x9460ad[_0x8756('0xf')],_0x2844cf[_0x9460ad[_0x8756('0x6')]]));}else if(_0x9460ad['keyType']===_0x8756('0x9')&&_0x9460ad[_0x8756('0xa')]&&_0x9460ad['Variable'][_0x8756('0xb')]&&_0x9460ad[_0x8756('0xf')]){_0x2844cf[_0x9460ad[_0x8756('0xa')][_0x8756('0xb')]['toLowerCase']()]&&_0xc83961[_0x8756('0x5')](util[_0x8756('0x10')]('%s:\x20%s',_0x9460ad[_0x8756('0xf')],_0x2844cf[_0x9460ad[_0x8756('0xa')][_0x8756('0xb')][_0x8756('0xc')]()]));}}}}return _0xc83961[_0x8756('0x14')](_0x11b07d);};exports[_0x8756('0x15')]=function(_0xaac5f){var _0x875d08=_0xaac5f[_0x8756('0x16')](-0x1);if(_0x875d08==='/'){_0xaac5f=_0xaac5f['substring'](0x0,_0xaac5f[_0x8756('0x17')](_0x875d08));}return _0xaac5f;};exports[_0x8756('0x18')]=function(_0x1028e1){if(!_[_0x8756('0x19')](_0x1028e1)&&_0x1028e1!==''){var _0x352646=/^(([^<>()\[\]\\.,;:\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 _0x352646[_0x8756('0x1a')](String(_0x1028e1)[_0x8756('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 82b2a18..e8c8db8 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x28e3e7,_0x9a1649){var _0x44d59d=function(_0x289e72){while(--_0x289e72){_0x28e3e7['push'](_0x28e3e7['shift']());}};_0x44d59d(++_0x9a1649);}(_0xe706,0xa3));var _0x6e70=function(_0xe1063b,_0x49f6a5){_0xe1063b=_0xe1063b-0x0;var _0x3f79b1=_0xe706[_0xe1063b];return _0x3f79b1;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _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(_0x464b35,_0xc2fd52){var _0x3517d9=function(_0x12414c){while(--_0x12414c){_0x464b35['push'](_0x464b35['shift']());}};_0x3517d9(++_0xc2fd52);}(_0xe706,0xa3));var _0x6e70=function(_0x4191af,_0x5783da){_0x4191af=_0x4191af-0x0;var _0x27bebf=_0xe706[_0x4191af];return _0x27bebf;};'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 2e36031..06d5d07 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 _0x7c2f=['Authorization','email','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','%s/channels/voice/agents/%d/tickets/%d/display.json','replace','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','ioredis','../../../../config/environment','zendesk','defaults','localhost','socket.io-emitter','redis','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20found!','%s/users.json','Enduser\x20created.','authType','password','username','token','%s/token:%s','Basic\x20%s','toString','base64','stringify','GET','map','includes','string','type','nameField','customField','toLowerCase','content','idField','custom_fields','push','variable','variableName','customVariable','Variable','name','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid'];(function(_0x56321f,_0x1c41eb){var _0x5aa129=function(_0x5cab95){while(--_0x5cab95){_0x56321f['push'](_0x56321f['shift']());}};_0x5aa129(++_0x1c41eb);}(_0x7c2f,0x1da));var _0xf7c2=function(_0x310dd9,_0x2d324a){_0x310dd9=_0x310dd9-0x0;var _0x4c4e9e=_0x7c2f[_0x310dd9];return _0x4c4e9e;};'use strict';var _=require('lodash');var rp=require(_0xf7c2('0x0'));var md5=require(_0xf7c2('0x1'));var util=require('util');var Redis=require(_0xf7c2('0x2'));var intUtil=require('./util');var config=require(_0xf7c2('0x3'));var logger=require('../../../../config/logger')(_0xf7c2('0x4'));config['redis']=_[_0xf7c2('0x5')](config['redis'],{'host':_0xf7c2('0x6'),'port':0x18eb});var io=require(_0xf7c2('0x7'))(new Redis(config[_0xf7c2('0x8')]));function emit(_0x141c19,_0x52156c,_0x3f6a97){io['to'](_0x141c19)[_0xf7c2('0x9')](_0x52156c,_0x3f6a97);}var headers={'Content-Type':'application/json','Accept':_0xf7c2('0xa')};function getTicket(_0x66e31c,_0x513bee,_0xd7c044,_0x58ccef,_0x687059){logger[_0xf7c2('0xb')](_0xf7c2('0xc'));return request({'uri':util[_0xf7c2('0xd')](_0xf7c2('0xe'),_0x66e31c['remoteUri']),'method':_0xf7c2('0xf'),'body':{'ticket':_[_0xf7c2('0x10')]({'requester_id':_0xd7c044['id'],'submitter_id':_0x513bee?_0x513bee['id']:undefined,'assignee_id':_0x513bee?_0x513bee['id']:undefined,'tags':getTags(_0x58ccef['Tags'],'name'),'subject':intUtil[_0xf7c2('0x11')](_0x58ccef[_0xf7c2('0x12')],_0x687059,'\x20'),'description':intUtil[_0xf7c2('0x11')](_0x58ccef[_0xf7c2('0x13')],_0x687059,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x58ccef['Descriptions'],_0x687059,'\x0a')}},getCustomFields(_0x58ccef[_0xf7c2('0x14')],_0x687059))}})[_0xf7c2('0x15')](function(_0x3ff9ec){logger[_0xf7c2('0xb')](_0xf7c2('0x16'));return _0x3ff9ec[_0xf7c2('0x17')];});}function getUser(_0x3bf3af,_0x38b733){if(intUtil[_0xf7c2('0x18')](_0x38b733)){logger[_0xf7c2('0xb')](_0xf7c2('0x19'),_0x38b733);return request({'uri':util[_0xf7c2('0xd')](_0xf7c2('0x1a'),_0x3bf3af[_0xf7c2('0x1b')]),'qs':{'query':util[_0xf7c2('0xd')](_0xf7c2('0x1c'),_0x38b733)}})[_0xf7c2('0x15')](function(_0x4c2235){if(_0x4c2235[_0xf7c2('0x1d')]){logger[_0xf7c2('0xb')](_0xf7c2('0x1e'));return _[_0xf7c2('0x1f')](_0x4c2235['results'],{'email':_0x38b733,'role':_0xf7c2('0x20')});}else{logger['info'](_0xf7c2('0x21'));return request({'uri':util['format'](_0xf7c2('0x22'),_0x3bf3af[_0xf7c2('0x1b')])})[_0xf7c2('0x15')](function(_0x50f88e){logger[_0xf7c2('0xb')](_0xf7c2('0x23'));return _0x50f88e['user'];});}});}else{logger['info'](_0xf7c2('0x21'));return request({'uri':util[_0xf7c2('0xd')](_0xf7c2('0x22'),_0x3bf3af[_0xf7c2('0x1b')])})[_0xf7c2('0x15')](function(_0x3175eb){logger[_0xf7c2('0xb')](_0xf7c2('0x23'));return _0x3175eb[_0xf7c2('0x24')];});}}function getEndUser(_0x17cdbf,_0x10e5ba,_0x276526){logger[_0xf7c2('0xb')](_0xf7c2('0x25'),_0x276526);return request({'uri':util[_0xf7c2('0xd')]('%s/search.json',_0x17cdbf[_0xf7c2('0x1b')]),'qs':{'query':util[_0xf7c2('0xd')](_0xf7c2('0x26'),_0x276526)}})[_0xf7c2('0x15')](function(_0x2700bf){var _0x1cc208;if(_0x2700bf[_0xf7c2('0x27')][_0xf7c2('0x28')]){_0x2700bf[_0xf7c2('0x27')]=_[_0xf7c2('0x29')](_0x2700bf['results'],{'suspended':![],'role':_0xf7c2('0x2a')});if(_0x2700bf[_0xf7c2('0x27')][_0xf7c2('0x28')]){_0x1cc208=_[_0xf7c2('0x2b')](_0x2700bf[_0xf7c2('0x27')]);}}if(_0x1cc208){logger[_0xf7c2('0xb')](_0xf7c2('0x2c'));return _0x1cc208;}else{logger[_0xf7c2('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xf7c2('0xd')](_0xf7c2('0x2d'),_0x17cdbf[_0xf7c2('0x1b')]),'method':_0xf7c2('0xf'),'body':{'user':{'role':_0xf7c2('0x2a'),'name':util['format']('Caller\x20-\x20%s',_0x10e5ba||_0x276526),'phone':_0x276526}}})[_0xf7c2('0x15')](function(_0x38dee5){logger[_0xf7c2('0xb')](_0xf7c2('0x2e'));return _0x38dee5[_0xf7c2('0x24')];});}});}function getAuth(_0x4337b8){var _0x4fc1b0;if(_0x4337b8[_0xf7c2('0x2f')]===_0xf7c2('0x30')){_0x4fc1b0=util[_0xf7c2('0xd')]('%s:%s',_0x4337b8[_0xf7c2('0x31')],_0x4337b8[_0xf7c2('0x30')]);}else if(_0x4337b8['authType']===_0xf7c2('0x32')){_0x4fc1b0=util[_0xf7c2('0xd')](_0xf7c2('0x33'),_0x4337b8[_0xf7c2('0x31')],_0x4337b8[_0xf7c2('0x32')]);}return util[_0xf7c2('0xd')](_0xf7c2('0x34'),new Buffer(_0x4fc1b0)[_0xf7c2('0x35')](_0xf7c2('0x36')));}function request(_0x1a6a24){logger['debug']('[HTTP]',JSON[_0xf7c2('0x37')](_0x1a6a24));return rp(_['defaults'](_0x1a6a24,{'method':_0xf7c2('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x8bb92c,_0x43c03b){var _0x19faf4=[];if(_0x8bb92c&&_0x8bb92c[_0xf7c2('0x28')]>0x0){_0x19faf4=_[_0xf7c2('0x39')](_0x8bb92c,_0x43c03b);}return _0x19faf4;}function getCustomFields(_0x157717,_0x1ce7af){var _0x248990=[];var _0x5b6f87={'custom_fields':[]};if(_0x157717[_0xf7c2('0x28')]>0x0){_['forEach'](_0x157717,function(_0x58da41){if(_[_0xf7c2('0x3a')]([_0xf7c2('0x3b'),'picklist'],_0x58da41[_0xf7c2('0x3c')])&&_0x58da41[_0xf7c2('0x3d')]&&!_0x58da41[_0xf7c2('0x3e')]){_0x5b6f87[_0x58da41[_0xf7c2('0x3d')][_0xf7c2('0x3f')]()]=_0x58da41[_0xf7c2('0x40')][_0xf7c2('0x35')]();}else if(_[_0xf7c2('0x3a')]([_0xf7c2('0x3b'),'picklist'],_0x58da41[_0xf7c2('0x3c')])&&_0x58da41[_0xf7c2('0x41')]&&_0x58da41[_0xf7c2('0x3e')]){_0x5b6f87[_0xf7c2('0x42')][_0xf7c2('0x43')]({'id':_0x58da41['idField'],'value':_0x58da41[_0xf7c2('0x40')][_0xf7c2('0x35')]()});}else if(_0x58da41[_0xf7c2('0x3c')]===_0xf7c2('0x44')&&_0x58da41['variableName']&&_0x58da41['idField']&&_0x58da41[_0xf7c2('0x3e')]){_0x1ce7af[_0x58da41[_0xf7c2('0x45')]]&&_0x5b6f87['custom_fields'][_0xf7c2('0x43')]({'id':_0x58da41['idField'],'value':_0x1ce7af[_0x58da41[_0xf7c2('0x45')]]['toString']()});}else if(_0x58da41[_0xf7c2('0x3c')]===_0xf7c2('0x46')&&_0x58da41['Variable']&&_0x58da41[_0xf7c2('0x47')][_0xf7c2('0x48')]&&_0x58da41[_0xf7c2('0x41')]&&_0x58da41[_0xf7c2('0x3e')]){_0x1ce7af[_0x58da41[_0xf7c2('0x47')][_0xf7c2('0x48')]['toLowerCase']()]&&_0x5b6f87['custom_fields'][_0xf7c2('0x43')]({'id':_0x58da41[_0xf7c2('0x41')],'value':_0x1ce7af[_0x58da41[_0xf7c2('0x47')][_0xf7c2('0x48')][_0xf7c2('0x3f')]()][_0xf7c2('0x35')]()});}});}return _0x5b6f87;}exports[_0xf7c2('0x49')]=function(_0x226632,_0xafd6eb,_0x4fdb5e,_0x19322b,_0x363b04,_0x5d80bf){var _0x5f1878,_0x3f15d7;_0x5d80bf[_0xf7c2('0x1b')]=intUtil['stripTrailingSlash'](_0x5d80bf[_0xf7c2('0x1b')]);_0x5d80bf[_0xf7c2('0x4a')]=intUtil[_0xf7c2('0x4b')](_0x5d80bf['serverUrl']);if(_0x363b04&&_0x363b04[_0xf7c2('0x4c')]){logger[_0xf7c2('0xb')](_0xf7c2('0x4d'),_0xf7c2('0x4e'));_0xafd6eb[_0xf7c2('0x4f')]=util[_0xf7c2('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5d80bf['serverUrl'],_0xafd6eb[_0xf7c2('0x50')],md5(_0xafd6eb[_0xf7c2('0x50')]));}else{_0xafd6eb[_0xf7c2('0x4f')]='';}headers[_0xf7c2('0x51')]=getAuth(_0x5d80bf);return getUser(_0x5d80bf,_0x19322b[_0xf7c2('0x52')])['then'](function(_0x5dc9bd){_0x5f1878=_0x5dc9bd;logger['info']('The\x20User\x20ID\x20is:',_0x5f1878['id']);return getEndUser(_0x5d80bf,_0xafd6eb['calleridname'],_0xafd6eb[_0xf7c2('0x53')]);})['then'](function(_0x2b522f){_0x3f15d7=_0x2b522f;logger[_0xf7c2('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3f15d7['id']);return getTicket(_0x5d80bf,_0x5f1878,_0x3f15d7,_0x4fdb5e,_0xafd6eb);})[_0xf7c2('0x15')](function(_0x499e1f){if(_0x499e1f){logger[_0xf7c2('0xb')](_0xf7c2('0x54'),_0x499e1f['id']);switch(_0x5d80bf[_0xf7c2('0x3c')]){case _0xf7c2('0x55'):logger[_0xf7c2('0xb')](_0xf7c2('0x4d'),_0xf7c2('0x56'));return request({'uri':util[_0xf7c2('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5d80bf[_0xf7c2('0x1b')],_0x5f1878['id'],_0x499e1f['id']),'method':_0xf7c2('0xf')});case _0xf7c2('0x57'):logger[_0xf7c2('0xb')](_0xf7c2('0x4d'),_0xf7c2('0x58'));emit(util[_0xf7c2('0xd')](_0xf7c2('0x59'),_0x19322b[_0xf7c2('0x48')]),_0xf7c2('0x5a'),{'uri':util['format'](_0xf7c2('0x5b'),_0x5d80bf[_0xf7c2('0x1b')]['replace'](_0xf7c2('0x5c'),''),_0x499e1f['id'])});break;default:logger[_0xf7c2('0x5d')]('[QUEUE]',_0xf7c2('0x5e'));}}})[_0xf7c2('0x5f')](function(_0x546b6a){logger[_0xf7c2('0x5d')](_0xf7c2('0x60'),util[_0xf7c2('0x61')](_0x546b6a,{'showHidden':!![],'depth':null}));});};exports[_0xf7c2('0x62')]=function(_0xdbe4e4,_0x23e96f,_0x3783ac,_0x4477b,_0xb9cc8d,_0x54325b,_0x1c8c81){var _0x290dd3,_0x369948;_0x54325b[_0xf7c2('0x1b')]=intUtil[_0xf7c2('0x4b')](_0x54325b[_0xf7c2('0x1b')]);_0x54325b[_0xf7c2('0x4a')]=intUtil[_0xf7c2('0x4b')](_0x54325b[_0xf7c2('0x4a')]);if(_0x1c8c81&&_0x1c8c81[_0xf7c2('0x63')]&&_0x1c8c81[_0xf7c2('0x63')]!=='none'){logger[_0xf7c2('0xb')](_0xf7c2('0x64'),_0xf7c2('0x4e'));_0x23e96f[_0xf7c2('0x4f')]=util[_0xf7c2('0xd')](_0xf7c2('0x65'),_0x54325b['serverUrl'],_0x23e96f[_0xf7c2('0x50')],md5(_0x23e96f[_0xf7c2('0x50')]));}headers[_0xf7c2('0x51')]=getAuth(_0x54325b);return getUser(_0x54325b,_0x4477b['email'])[_0xf7c2('0x15')](function(_0x520612){_0x290dd3=_0x520612;logger[_0xf7c2('0xb')](_0xf7c2('0x66'),_0x290dd3['id']);return getEndUser(_0x54325b,_0x23e96f[_0xf7c2('0x67')],_0x23e96f[_0xf7c2('0x68')]);})[_0xf7c2('0x15')](function(_0x103d7b){_0x369948=_0x103d7b;logger['info']('The\x20Enduser\x20ID\x20is:',_0x369948['id']);return getTicket(_0x54325b,_0x290dd3,_0x369948,_0x3783ac,_0x23e96f);})[_0xf7c2('0x15')](function(_0x29e131){if(_0x29e131){logger[_0xf7c2('0xb')](_0xf7c2('0x54'),_0x29e131['id']);switch(_0x54325b[_0xf7c2('0x3c')]){case _0xf7c2('0x55'):logger[_0xf7c2('0xb')](_0xf7c2('0x64'),_0xf7c2('0x56'));return request({'uri':util[_0xf7c2('0xd')](_0xf7c2('0x69'),_0x54325b[_0xf7c2('0x1b')],_0x290dd3['id'],_0x29e131['id']),'method':'POST'});case _0xf7c2('0x57'):logger[_0xf7c2('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf7c2('0xd')](_0xf7c2('0x59'),_0x4477b['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x54325b['remoteUri'][_0xf7c2('0x6a')](_0xf7c2('0x5c'),''),_0x29e131['id'])});break;default:logger[_0xf7c2('0x5d')](_0xf7c2('0x64'),_0xf7c2('0x5e'));}}})['catch'](function(_0x3d80c0){logger[_0xf7c2('0x5d')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x3d80c0,{'showHidden':!![],'depth':null}));});};exports[_0xf7c2('0x6b')]=function(_0x3edf61,_0x2ade08,_0x463bba,_0xf1f686,_0x3c6b1c,_0x11d3e3){var _0x51b860,_0x472ec1;_0x11d3e3[_0xf7c2('0x1b')]=intUtil[_0xf7c2('0x4b')](_0x11d3e3[_0xf7c2('0x1b')]);_0x11d3e3[_0xf7c2('0x4a')]=intUtil[_0xf7c2('0x4b')](_0x11d3e3['serverUrl']);if(_0x3c6b1c&&_0x3c6b1c[_0xf7c2('0x4c')]){logger[_0xf7c2('0xb')]('['+_0x2ade08[_0xf7c2('0x6c')]['toUpperCase']()+']',_0xf7c2('0x4e'));_0x2ade08[_0xf7c2('0x4f')]=util[_0xf7c2('0xd')](_0xf7c2('0x65'),_0x11d3e3[_0xf7c2('0x4a')],_0x2ade08['uniqueid'],md5(_0x2ade08['uniqueid']));}else{_0x2ade08[_0xf7c2('0x4f')]='';}headers['Authorization']=getAuth(_0x11d3e3);return getUser(_0x11d3e3)[_0xf7c2('0x15')](function(_0x3b6b23){_0x51b860=_0x3b6b23;logger[_0xf7c2('0xb')](_0xf7c2('0x66'),_0x51b860['id']);return getEndUser(_0x11d3e3,_0x2ade08['calleridname'],_0x2ade08['calleridnum']);})[_0xf7c2('0x15')](function(_0xb5d408){_0x472ec1=_0xb5d408;logger[_0xf7c2('0xb')]('The\x20Enduser\x20ID\x20is:',_0x472ec1['id']);return getTicket(_0x11d3e3,_0x51b860,_0x472ec1,_0x463bba,_0x2ade08);})[_0xf7c2('0x15')](function(_0x3d8f4d){if(_0x3d8f4d){logger[_0xf7c2('0xb')]('The\x20Ticket\x20ID\x20is:',_0x3d8f4d['id']);}})[_0xf7c2('0x5f')](function(_0x16236b){logger['error']('['+_0x2ade08[_0xf7c2('0x6c')][_0xf7c2('0x6d')]()+']'+_0xf7c2('0x6e'),util[_0xf7c2('0x61')](_0x16236b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x99d3=['socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','password','%s:%s','username','authType','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','picklist','nameField','content','string','idField','custom_fields','push','variable','variableName','customField','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','type','integrationTab','%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','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridname','Displaying\x20ticket\x20to\x20agent...','newTab','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost'];(function(_0x4695be,_0x2b6e8d){var _0x2ce401=function(_0x39d5ef){while(--_0x39d5ef){_0x4695be['push'](_0x4695be['shift']());}};_0x2ce401(++_0x2b6e8d);}(_0x99d3,0x1ca));var _0x399d=function(_0xea41f6,_0x1d2a76){_0xea41f6=_0xea41f6-0x0;var _0x1bf709=_0x99d3[_0xea41f6];return _0x1bf709;};'use strict';var _=require(_0x399d('0x0'));var rp=require(_0x399d('0x1'));var md5=require(_0x399d('0x2'));var util=require(_0x399d('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x399d('0x4'));var logger=require(_0x399d('0x5'))(_0x399d('0x6'));config[_0x399d('0x7')]=_[_0x399d('0x8')](config[_0x399d('0x7')],{'host':_0x399d('0x9'),'port':0x18eb});var io=require(_0x399d('0xa'))(new Redis(config[_0x399d('0x7')]));function emit(_0x4851d4,_0x49b392,_0x4e3995){io['to'](_0x4851d4)[_0x399d('0xb')](_0x49b392,_0x4e3995);}var headers={'Content-Type':_0x399d('0xc'),'Accept':'application/json'};function getTicket(_0x149e08,_0x5d69c7,_0x394148,_0xcbe963,_0x37f896){logger[_0x399d('0xd')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x399d('0xe')](_0x399d('0xf'),_0x149e08[_0x399d('0x10')]),'method':_0x399d('0x11'),'body':{'ticket':_[_0x399d('0x12')]({'requester_id':_0x394148['id'],'submitter_id':_0x5d69c7?_0x5d69c7['id']:undefined,'assignee_id':_0x5d69c7?_0x5d69c7['id']:undefined,'tags':getTags(_0xcbe963[_0x399d('0x13')],_0x399d('0x14')),'subject':intUtil[_0x399d('0x15')](_0xcbe963[_0x399d('0x16')],_0x37f896,'\x20'),'description':intUtil['getString'](_0xcbe963[_0x399d('0x17')],_0x37f896,'\x0a'),'comment':{'public':![],'body':intUtil[_0x399d('0x15')](_0xcbe963[_0x399d('0x17')],_0x37f896,'\x0a')}},getCustomFields(_0xcbe963['Fields'],_0x37f896))}})['then'](function(_0x194480){logger[_0x399d('0xd')]('Ticket\x20created!');return _0x194480[_0x399d('0x18')];});}function getUser(_0x4717f5,_0x307568){if(intUtil[_0x399d('0x19')](_0x307568)){logger[_0x399d('0xd')](_0x399d('0x1a'),_0x307568);return request({'uri':util[_0x399d('0xe')](_0x399d('0x1b'),_0x4717f5['remoteUri']),'qs':{'query':util[_0x399d('0xe')](_0x399d('0x1c'),_0x307568)}})[_0x399d('0x1d')](function(_0x4921d1){if(_0x4921d1[_0x399d('0x1e')]){logger[_0x399d('0xd')](_0x399d('0x1f'));return _[_0x399d('0x20')](_0x4921d1[_0x399d('0x21')],{'email':_0x307568,'role':_0x399d('0x22')});}else{logger[_0x399d('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x399d('0xe')](_0x399d('0x23'),_0x4717f5[_0x399d('0x10')])})[_0x399d('0x1d')](function(_0x6a4491){logger[_0x399d('0xd')](_0x399d('0x24'));return _0x6a4491[_0x399d('0x25')];});}});}else{logger[_0x399d('0xd')](_0x399d('0x26'));return request({'uri':util[_0x399d('0xe')](_0x399d('0x23'),_0x4717f5[_0x399d('0x10')])})[_0x399d('0x1d')](function(_0x169b19){logger[_0x399d('0xd')](_0x399d('0x24'));return _0x169b19[_0x399d('0x25')];});}}function getEndUser(_0x15228b,_0x31ae77,_0x4568c7){logger['info'](_0x399d('0x27'),_0x4568c7);return request({'uri':util[_0x399d('0xe')](_0x399d('0x1b'),_0x15228b[_0x399d('0x10')]),'qs':{'query':util[_0x399d('0xe')](_0x399d('0x28'),_0x4568c7)}})[_0x399d('0x1d')](function(_0x231132){var _0x226f12;if(_0x231132[_0x399d('0x21')][_0x399d('0x29')]){_0x231132[_0x399d('0x21')]=_[_0x399d('0x2a')](_0x231132[_0x399d('0x21')],{'suspended':![],'role':_0x399d('0x2b')});if(_0x231132[_0x399d('0x21')][_0x399d('0x29')]){_0x226f12=_[_0x399d('0x2c')](_0x231132[_0x399d('0x21')]);}}if(_0x226f12){logger[_0x399d('0xd')](_0x399d('0x2d'));return _0x226f12;}else{logger[_0x399d('0xd')](_0x399d('0x2e'));return request({'uri':util['format']('%s/users.json',_0x15228b['remoteUri']),'method':_0x399d('0x11'),'body':{'user':{'role':_0x399d('0x2b'),'name':util[_0x399d('0xe')]('Caller\x20-\x20%s',_0x31ae77||_0x4568c7),'phone':_0x4568c7}}})[_0x399d('0x1d')](function(_0x288e4b){logger['info']('Enduser\x20created.');return _0x288e4b[_0x399d('0x25')];});}});}function getAuth(_0x48a47d){var _0x326d3c;if(_0x48a47d['authType']===_0x399d('0x2f')){_0x326d3c=util[_0x399d('0xe')](_0x399d('0x30'),_0x48a47d[_0x399d('0x31')],_0x48a47d['password']);}else if(_0x48a47d[_0x399d('0x32')]===_0x399d('0x33')){_0x326d3c=util['format'](_0x399d('0x34'),_0x48a47d[_0x399d('0x31')],_0x48a47d[_0x399d('0x33')]);}return util[_0x399d('0xe')](_0x399d('0x35'),new Buffer(_0x326d3c)[_0x399d('0x36')](_0x399d('0x37')));}function request(_0x515a14){logger[_0x399d('0x38')](_0x399d('0x39'),JSON[_0x399d('0x3a')](_0x515a14));return rp(_[_0x399d('0x8')](_0x515a14,{'method':_0x399d('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x5363c5,_0x135766){var _0x3813e7=[];if(_0x5363c5&&_0x5363c5[_0x399d('0x29')]>0x0){_0x3813e7=_[_0x399d('0x3c')](_0x5363c5,_0x135766);}return _0x3813e7;}function getCustomFields(_0x8b8d75,_0x1cf857){var _0x483b15=[];var _0x2454c0={'custom_fields':[]};if(_0x8b8d75[_0x399d('0x29')]>0x0){_[_0x399d('0x3d')](_0x8b8d75,function(_0x6a5f8a){if(_[_0x399d('0x3e')](['string',_0x399d('0x3f')],_0x6a5f8a['type'])&&_0x6a5f8a[_0x399d('0x40')]&&!_0x6a5f8a['customField']){_0x2454c0[_0x6a5f8a['nameField']['toLowerCase']()]=_0x6a5f8a[_0x399d('0x41')][_0x399d('0x36')]();}else if(_[_0x399d('0x3e')]([_0x399d('0x42'),_0x399d('0x3f')],_0x6a5f8a['type'])&&_0x6a5f8a[_0x399d('0x43')]&&_0x6a5f8a['customField']){_0x2454c0[_0x399d('0x44')][_0x399d('0x45')]({'id':_0x6a5f8a['idField'],'value':_0x6a5f8a[_0x399d('0x41')][_0x399d('0x36')]()});}else if(_0x6a5f8a['type']===_0x399d('0x46')&&_0x6a5f8a[_0x399d('0x47')]&&_0x6a5f8a['idField']&&_0x6a5f8a[_0x399d('0x48')]){_0x1cf857[_0x6a5f8a[_0x399d('0x47')]]&&_0x2454c0[_0x399d('0x44')][_0x399d('0x45')]({'id':_0x6a5f8a[_0x399d('0x43')],'value':_0x1cf857[_0x6a5f8a[_0x399d('0x47')]][_0x399d('0x36')]()});}else if(_0x6a5f8a['type']===_0x399d('0x49')&&_0x6a5f8a['Variable']&&_0x6a5f8a[_0x399d('0x4a')][_0x399d('0x14')]&&_0x6a5f8a[_0x399d('0x43')]&&_0x6a5f8a[_0x399d('0x48')]){_0x1cf857[_0x6a5f8a[_0x399d('0x4a')]['name']['toLowerCase']()]&&_0x2454c0[_0x399d('0x44')][_0x399d('0x45')]({'id':_0x6a5f8a[_0x399d('0x43')],'value':_0x1cf857[_0x6a5f8a[_0x399d('0x4a')][_0x399d('0x14')][_0x399d('0x4b')]()]['toString']()});}});}return _0x2454c0;}exports[_0x399d('0x4c')]=function(_0x810a0c,_0x12e943,_0x6dac8a,_0x20dd91,_0x1cd581,_0x11249d){var _0x56efb6,_0x5956ce;_0x11249d['remoteUri']=intUtil[_0x399d('0x4d')](_0x11249d[_0x399d('0x10')]);_0x11249d[_0x399d('0x4e')]=intUtil[_0x399d('0x4d')](_0x11249d[_0x399d('0x4e')]);if(_0x1cd581&&_0x1cd581[_0x399d('0x4f')]){logger[_0x399d('0xd')](_0x399d('0x50'),'Recording\x20is\x20enabled!');_0x12e943[_0x399d('0x51')]=util[_0x399d('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x11249d['serverUrl'],_0x12e943[_0x399d('0x52')],md5(_0x12e943[_0x399d('0x52')]));}else{_0x12e943['recordingURL']='';}headers['Authorization']=getAuth(_0x11249d);return getUser(_0x11249d,_0x20dd91['email'])[_0x399d('0x1d')](function(_0x5101a3){_0x56efb6=_0x5101a3;logger[_0x399d('0xd')](_0x399d('0x53'),_0x56efb6['id']);return getEndUser(_0x11249d,_0x12e943[_0x399d('0x54')],_0x12e943[_0x399d('0x55')]);})[_0x399d('0x1d')](function(_0x3318c9){_0x5956ce=_0x3318c9;logger[_0x399d('0xd')](_0x399d('0x56'),_0x5956ce['id']);return getTicket(_0x11249d,_0x56efb6,_0x5956ce,_0x6dac8a,_0x12e943);})['then'](function(_0x2fb3c5){if(_0x2fb3c5){logger[_0x399d('0xd')](_0x399d('0x57'),_0x2fb3c5['id']);switch(_0x11249d[_0x399d('0x58')]){case _0x399d('0x59'):logger[_0x399d('0xd')](_0x399d('0x50'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x399d('0x5a'),_0x11249d[_0x399d('0x10')],_0x56efb6['id'],_0x2fb3c5['id']),'method':_0x399d('0x11')});case'newTab':logger['info'](_0x399d('0x50'),_0x399d('0x5b'));emit(util['format'](_0x399d('0x5c'),_0x20dd91[_0x399d('0x14')]),_0x399d('0x5d'),{'uri':util[_0x399d('0xe')](_0x399d('0x5e'),_0x11249d[_0x399d('0x10')]['replace'](_0x399d('0x5f'),''),_0x2fb3c5['id'])});break;default:logger[_0x399d('0x60')]('[QUEUE]',_0x399d('0x61'));}}})[_0x399d('0x62')](function(_0x3379ea){logger[_0x399d('0x60')](_0x399d('0x63'),util[_0x399d('0x64')](_0x3379ea,{'showHidden':!![],'depth':null}));});};exports[_0x399d('0x65')]=function(_0x295667,_0x4afc35,_0x420d4c,_0xfd6239,_0x3c45ae,_0x154631,_0x56fe1e){var _0x5d1691,_0x157330;_0x154631[_0x399d('0x10')]=intUtil['stripTrailingSlash'](_0x154631[_0x399d('0x10')]);_0x154631[_0x399d('0x4e')]=intUtil[_0x399d('0x4d')](_0x154631['serverUrl']);if(_0x56fe1e&&_0x56fe1e['recordingFormat']&&_0x56fe1e[_0x399d('0x66')]!==_0x399d('0x67')){logger[_0x399d('0xd')](_0x399d('0x68'),_0x399d('0x69'));_0x4afc35[_0x399d('0x51')]=util[_0x399d('0xe')](_0x399d('0x6a'),_0x154631[_0x399d('0x4e')],_0x4afc35[_0x399d('0x52')],md5(_0x4afc35[_0x399d('0x52')]));}headers[_0x399d('0x6b')]=getAuth(_0x154631);return getUser(_0x154631,_0xfd6239['email'])[_0x399d('0x1d')](function(_0x50127b){_0x5d1691=_0x50127b;logger[_0x399d('0xd')](_0x399d('0x53'),_0x5d1691['id']);return getEndUser(_0x154631,_0x4afc35[_0x399d('0x6c')],_0x4afc35['destcalleridnum']);})[_0x399d('0x1d')](function(_0x30281c){_0x157330=_0x30281c;logger[_0x399d('0xd')](_0x399d('0x56'),_0x157330['id']);return getTicket(_0x154631,_0x5d1691,_0x157330,_0x420d4c,_0x4afc35);})['then'](function(_0x1885e7){if(_0x1885e7){logger[_0x399d('0xd')](_0x399d('0x57'),_0x1885e7['id']);switch(_0x154631[_0x399d('0x58')]){case _0x399d('0x59'):logger[_0x399d('0xd')]('[OUTBOUND]',_0x399d('0x6d'));return request({'uri':util[_0x399d('0xe')](_0x399d('0x5a'),_0x154631[_0x399d('0x10')],_0x5d1691['id'],_0x1885e7['id']),'method':_0x399d('0x11')});case _0x399d('0x6e'):logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x399d('0xe')](_0x399d('0x5c'),_0xfd6239['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x154631['remoteUri'][_0x399d('0x6f')](_0x399d('0x5f'),''),_0x1885e7['id'])});break;default:logger[_0x399d('0x60')](_0x399d('0x68'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x399d('0x62')](function(_0x225e98){logger['error'](_0x399d('0x70'),util[_0x399d('0x64')](_0x225e98,{'showHidden':!![],'depth':null}));});};exports[_0x399d('0x71')]=function(_0x2f22db,_0x24afa7,_0x1de2c2,_0x2886df,_0x5787c0,_0x19f413){var _0x48ba69,_0x2bb6d7;_0x19f413[_0x399d('0x10')]=intUtil[_0x399d('0x4d')](_0x19f413[_0x399d('0x10')]);_0x19f413[_0x399d('0x4e')]=intUtil[_0x399d('0x4d')](_0x19f413[_0x399d('0x4e')]);if(_0x5787c0&&_0x5787c0[_0x399d('0x4f')]){logger[_0x399d('0xd')]('['+_0x24afa7[_0x399d('0x72')][_0x399d('0x73')]()+']',_0x399d('0x69'));_0x24afa7[_0x399d('0x51')]=util[_0x399d('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x19f413[_0x399d('0x4e')],_0x24afa7[_0x399d('0x52')],md5(_0x24afa7['uniqueid']));}else{_0x24afa7[_0x399d('0x51')]='';}headers['Authorization']=getAuth(_0x19f413);return getUser(_0x19f413)['then'](function(_0x59eb07){_0x48ba69=_0x59eb07;logger[_0x399d('0xd')](_0x399d('0x53'),_0x48ba69['id']);return getEndUser(_0x19f413,_0x24afa7[_0x399d('0x54')],_0x24afa7[_0x399d('0x55')]);})['then'](function(_0x3b4124){_0x2bb6d7=_0x3b4124;logger[_0x399d('0xd')]('The\x20Enduser\x20ID\x20is:',_0x2bb6d7['id']);return getTicket(_0x19f413,_0x48ba69,_0x2bb6d7,_0x1de2c2,_0x24afa7);})['then'](function(_0x178e09){if(_0x178e09){logger[_0x399d('0xd')](_0x399d('0x57'),_0x178e09['id']);}})[_0x399d('0x62')](function(_0x512806){logger[_0x399d('0x60')]('['+_0x24afa7[_0x399d('0x72')][_0x399d('0x73')]()+']'+_0x399d('0x74'),util[_0x399d('0x64')](_0x512806,{'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 9cd7357..81a72ff 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 _0xcbfa=['/crm/v2/Calls','Call\x20created!','details','err','log','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','user:%s','https://crm.','[QUEUE]','recordingFormat','none','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','The\x20Call\x20ID\x20is:','[OUTBOUND]','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','./util','moment','bluebird','../../../../config/environment','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','string','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','clientId','clientSecret','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','Error:\x20','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','https://www.zohoapis.','Owner','administrator','Subject','Subjects','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','format','mm:ss','answertime','endtime','diff','YYYY-MM-DDTHH:mm:ss','called','Call_Result','complete','connect','Answered','rejected','Rejected','Abandoned','outbound','agentcalledAt','Inbound','Fields'];(function(_0x9aaf2b,_0x5722be){var _0x5ce474=function(_0x4a2189){while(--_0x4a2189){_0x9aaf2b['push'](_0x9aaf2b['shift']());}};_0x5ce474(++_0x5722be);}(_0xcbfa,0x1f0));var _0xacbf=function(_0x1d5476,_0x2f8795){_0x1d5476=_0x1d5476-0x0;var _0x4ac71f=_0xcbfa[_0x1d5476];return _0x4ac71f;};'use strict';var _=require(_0xacbf('0x0'));var rp=require(_0xacbf('0x1'));var md5=require(_0xacbf('0x2'));var util=require('util');var intUtil=require(_0xacbf('0x3'));var moment=require(_0xacbf('0x4'));var Redis=require('ioredis');var BPromise=require(_0xacbf('0x5'));var config=require(_0xacbf('0x6'));var logger=require('../../../../config/logger')(_0xacbf('0x7'));config[_0xacbf('0x8')]=_[_0xacbf('0x9')](config[_0xacbf('0x8')],{'host':_0xacbf('0xa'),'port':0x18eb});var io=require(_0xacbf('0xb'))(new Redis(config[_0xacbf('0x8')]));function emit(_0x27e538,_0x338e2a,_0x57ed1e){io['to'](_0x27e538)[_0xacbf('0xc')](_0x338e2a,_0x57ed1e);}function request(_0x5d380b){logger[_0xacbf('0xd')](_0xacbf('0xe'),JSON[_0xacbf('0xf')](_0x5d380b));return rp(_0x5d380b);}function getCustomFields(_0x21f52e,_0x184f62){var _0x4c1ea9={};if(_0x21f52e[_0xacbf('0x10')]>0x0){_[_0xacbf('0x11')](_0x21f52e,function(_0x3ad3e2){if(_['includes']([_0xacbf('0x12'),'picklist'],_0x3ad3e2['type'])&&_0x3ad3e2[_0xacbf('0x13')]){_0x4c1ea9[_0x3ad3e2[_0xacbf('0x13')]]=_0x3ad3e2[_0xacbf('0x14')]['toString']();}else if(_0x3ad3e2[_0xacbf('0x15')]===_0xacbf('0x16')&&_0x3ad3e2[_0xacbf('0x17')]&&_0x3ad3e2[_0xacbf('0x13')]&&_0x184f62[_0x3ad3e2[_0xacbf('0x17')]]){_0x4c1ea9[_0x3ad3e2[_0xacbf('0x13')]]=_0x184f62[_0x3ad3e2[_0xacbf('0x17')]][_0xacbf('0x18')]();}else if(_0x3ad3e2[_0xacbf('0x15')]===_0xacbf('0x19')&&_0x3ad3e2['Variable']&&_0x3ad3e2[_0xacbf('0x1a')][_0xacbf('0x1b')]&&_0x3ad3e2['idField']&&_0x184f62[_0x3ad3e2[_0xacbf('0x1a')][_0xacbf('0x1b')]['toLowerCase']()]){_0x4c1ea9[_0x3ad3e2[_0xacbf('0x13')]]=_0x184f62[_0x3ad3e2['Variable'][_0xacbf('0x1b')][_0xacbf('0x1c')]()][_0xacbf('0x18')]();}});}return _0x4c1ea9;}function getName(_0x40836c){if(_0x40836c[_0xacbf('0x1d')]('\x20')>0x0){var _0x22a8c7=_0x40836c[_0xacbf('0x1e')](/ (.+)/);if(_0x22a8c7[0x1]){return _0x22a8c7;}}return[_0x40836c,_0x40836c];}var accountsTokens={};function getAccessToken(_0xf74707){return new Promise(function(_0x26063f,_0xd4a949){if(!_['isNil'](accountsTokens[_0xf74707['id']])&&!_[_0xacbf('0x1f')](accountsTokens[_0xf74707['id']][_0xacbf('0x20')])){if(moment()[_0xacbf('0x21')](accountsTokens[_0xf74707['id']]['expires_in'])){_0x26063f(accountsTokens[_0xf74707['id']][_0xacbf('0x20')]);}}var _0x74ec5c;switch(_0xf74707[_0xacbf('0x22')]){case'US':_0x74ec5c=_0xacbf('0x23');break;case'AU':_0x74ec5c='https://accounts.zoho.com.au';break;case'EU':_0x74ec5c=_0xacbf('0x24');break;case'IN':_0x74ec5c=_0xacbf('0x25');break;case'CN':_0x74ec5c=_0xacbf('0x26');break;default:_0x74ec5c=_0xacbf('0x24');break;}var _0x55cbbd={'method':'POST','uri':_0x74ec5c+_0xacbf('0x27'),'qs':{'refresh_token':_0xf74707['refreshToken'],'client_id':_0xf74707[_0xacbf('0x28')],'client_secret':_0xf74707[_0xacbf('0x29')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x55cbbd)['then'](function(_0x3ab8e8){accountsTokens[_0xf74707['id']]={'access_token':_0x3ab8e8[_0xacbf('0x20')],'expires_in':moment()[_0xacbf('0x2a')](_0x3ab8e8['expires_in'],_0xacbf('0x2b'))};_0x26063f(_0x3ab8e8['access_token']);})[_0xacbf('0x2c')](function(_0x2f2c2c){logger[_0xacbf('0x2d')](_0xacbf('0x2e'),_0x2f2c2c[_0xacbf('0x2f')]);_0xd4a949(_0x2f2c2c);});});}function getUser(_0x229f6e,_0x5d80b3,_0xea7f8d,_0x104788){logger['info'](_0xacbf('0x30'));return request({'method':_0xacbf('0x31'),'uri':util['format'](_0xacbf('0x32'),_0x5d80b3),'qs':{'type':_0xacbf('0x33')},'headers':{'Authorization':_0xacbf('0x34')+_0x229f6e},'json':!![]})[_0xacbf('0x35')](function(_0x3e4d25){if(_0x3e4d25[_0xacbf('0x36')]){var _0x39eecf=-0x1;if(_[_0xacbf('0x37')](_0x3e4d25[_0xacbf('0x36')])){if(!_[_0xacbf('0x1f')](_0x104788)){_0x39eecf=_[_0xacbf('0x38')](_0x3e4d25['users'],function(_0x51053e){return _0x51053e[_0xacbf('0x39')]===_0x104788;});}if(_0x39eecf>=0x0){logger[_0xacbf('0x3a')](_0xacbf('0x3b'));}else{logger['info'](_0xacbf('0x3c'));_0x39eecf=_[_0xacbf('0x38')](_0x3e4d25[_0xacbf('0x36')],function(_0x4092b0){return _0x4092b0[_0xacbf('0x3d')][_0xacbf('0x1b')]===_0xacbf('0x3e');});}return _0x3e4d25[_0xacbf('0x36')][_0x39eecf];}else{if(_0x3e4d25[_0xacbf('0x3f')][_0xacbf('0x3d')]['name']===_0xacbf('0x3e')){logger[_0xacbf('0x3a')]('Using\x20the\x20admin\x20account!');user=_0x3e4d25[_0xacbf('0x3f')];return user;}else{logger[_0xacbf('0x2d')](_0xacbf('0x40'),JSON['stringify'](_0x3e4d25));throw new Error(_0xacbf('0x41')+JSON[_0xacbf('0xf')](_0x3e4d25));}}}else{logger[_0xacbf('0x2d')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x3e4d25));throw new Error(_0xacbf('0x41')+JSON['stringify'](_0x3e4d25));}})[_0xacbf('0x2c')](function(_0x57425f){console[_0xacbf('0x2d')](_0x57425f);});}function getZohoUser(_0x445041,_0x278fa5){return new BPromise(function(_0x13ef86,_0x138507){request(_0x445041)[_0xacbf('0x35')](function(_0x3f4623){var _0x610dac=null;if(_0x3f4623){_0x610dac=_0x3f4623[_0xacbf('0x42')][0x0];_0x610dac[_0xacbf('0x43')]=_0x278fa5;}_0x13ef86(_0x610dac);})[_0xacbf('0x2c')](function(_0x16644b){_0x138507(_0x16644b);});});}function createEndUser(_0xd30105,_0x5608a3,_0x245be8,_0x3becfa,_0x5cc886,_0x2d1864){var _0x245be8=getName(_0x245be8);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x5608a3+'/crm/v2/'+_[_0xacbf('0x44')](_0x2d1864[_0xacbf('0x45')])+'s','body':{'data':[{'Last_Name':_0x245be8[0x1],'First_Name':_0x245be8[0x0],'Phone':_0x3becfa,'Owner':{'name':!_[_0xacbf('0x1f')](_0x5cc886[_0xacbf('0x46')][_0xacbf('0x1b')])?_0x5cc886[_0xacbf('0x46')]['name']:!_[_0xacbf('0x1f')](_0x5cc886[_0xacbf('0x47')])?_0x5cc886['first_name']+'\x20'+_0x5cc886[_0xacbf('0x48')]:_0x5cc886['last_name'],'id':_0x5cc886['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xd30105},'json':!![]})[_0xacbf('0x35')](function(_0x438be3){if(_0x438be3&&_0x438be3[_0xacbf('0x42')][0x0][_0xacbf('0x49')]===_0xacbf('0x4a')){var _0x556e3e=_0x438be3[_0xacbf('0x42')][0x0]['details'];_0x556e3e['enduserType']=_['startCase'](_0x2d1864[_0xacbf('0x45')])+'s';return _0x556e3e;}logger[_0xacbf('0x2d')](_0xacbf('0x40'),JSON[_0xacbf('0xf')](data));throw new Error(_0xacbf('0x4b')+JSON['stringify'](data));})[_0xacbf('0x2c')](function(_0x351778){console['log']('CREATE\x20ERROR',_0x351778);});}function getEndUser(_0x59e2b6,_0x2efab9,_0x3830ee,_0x38b2bb,_0x550b4a,_0x5b0e6d,_0x6318a4){var _0x4c661c={'method':'GET','uri':'','headers':{'Authorization':_0xacbf('0x34')+_0x59e2b6},'json':!![]};switch(_0x6318a4['moduleSearch']){case _0xacbf('0x4c'):_0x4c661c[_0xacbf('0x4d')]='https://www.zohoapis.'+_0x2efab9+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x550b4a+'))';return getZohoUser(_0x4c661c,_0xacbf('0x4e'))[_0xacbf('0x35')](function(_0x5ae91c){if(_0x5ae91c)return _0x5ae91c;_0x4c661c['uri']='https://www.zohoapis.'+_0x2efab9+_0xacbf('0x4f')+_0x550b4a+'))';return getZohoUser(_0x4c661c,_0xacbf('0x50'))[_0xacbf('0x35')](function(_0x39c768){if(_0x39c768)return _0x39c768;if(_0x6318a4['moduleCreate']!=_0xacbf('0x51')){return createEndUser(_0x59e2b6,_0x2efab9,_0x38b2bb,_0x550b4a,_0x5b0e6d,_0x6318a4);}else{return{};}});});break;case _0xacbf('0x52'):_0x4c661c['uri']='https://www.zohoapis.'+_0x2efab9+_0xacbf('0x53')+_0x550b4a+'))';return getZohoUser(_0x4c661c,'Contacts')['then'](function(_0x527ab1){if(_0x527ab1)return _0x527ab1;if(_0x6318a4[_0xacbf('0x45')]!=_0xacbf('0x51')){return createEndUser(_0x59e2b6,_0x2efab9,_0x38b2bb,_0x550b4a,_0x5b0e6d,_0x6318a4);}else{return{};}});break;case _0xacbf('0x54'):_0x4c661c[_0xacbf('0x4d')]=_0xacbf('0x55')+_0x2efab9+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x550b4a+'))';return getZohoUser(_0x4c661c,_0xacbf('0x50'))['then'](function(_0x54a2e8){if(_0x54a2e8)return _0x54a2e8;if(_0x6318a4[_0xacbf('0x45')]!=_0xacbf('0x51')){return createEndUser(_0x59e2b6,_0x2efab9,_0x38b2bb,_0x550b4a,_0x5b0e6d,_0x6318a4);}else{return{};}});break;}}function getCall(_0x228e7e,_0x1d14dd,_0x2c2183,_0x31baba,_0x356abb,_0xda9b5b,_0x839d07,_0x140b21){logger['info']('Creating\x20new\x20call...');var _0x15e139={};_0x15e139[_0xacbf('0x56')]={'name':!_[_0xacbf('0x1f')](_0x31baba[_0xacbf('0x46')][_0xacbf('0x1b')])&&!_[_0xacbf('0x1f')](_0x31baba['profile'][_0xacbf('0x1b')])&&_0x31baba[_0xacbf('0x3d')][_0xacbf('0x1b')]===_0xacbf('0x57')?_0x31baba[_0xacbf('0x46')][_0xacbf('0x1b')]:!_['isNil'](_0x31baba[_0xacbf('0x47')])?_0x31baba['first_name']+'\x20'+_0x31baba[_0xacbf('0x48')]:_0x31baba['last_name'],'id':_0x31baba['id']};_0x15e139[_0xacbf('0x58')]=intUtil['getString'](_0xda9b5b[_0xacbf('0x59')],_0x839d07,'\x20');_0x15e139[_0xacbf('0x5a')]=intUtil[_0xacbf('0x5b')](_0xda9b5b[_0xacbf('0x5c')],_0x839d07,'\x0a');if(_0x356abb['enduserType']===_0xacbf('0x4e')){_0x15e139[_0xacbf('0x5d')]={'name':!_[_0xacbf('0x1f')](_0x356abb[_0xacbf('0x5e')])?_0x356abb['Full_Name']:!_[_0xacbf('0x1f')](_0x356abb[_0xacbf('0x5f')])?_0x356abb[_0xacbf('0x5f')]+'\x20'+_0x356abb[_0xacbf('0x60')]:_0x356abb[_0xacbf('0x60')],'id':_0x356abb['id']};}if(_0x356abb['enduserType']===_0xacbf('0x50')){_0x15e139[_0xacbf('0x61')]={'name':!_[_0xacbf('0x1f')](_0x356abb[_0xacbf('0x5e')])?_0x356abb[_0xacbf('0x5e')]:!_[_0xacbf('0x1f')](_0x356abb[_0xacbf('0x5f')])?_0x356abb[_0xacbf('0x5f')]+'\x20'+_0x356abb[_0xacbf('0x60')]:_0x356abb[_0xacbf('0x60')],'id':_0x356abb['id']};_0x15e139[_0xacbf('0x62')]=_[_0xacbf('0x44')](_0x356abb[_0xacbf('0x43')]);}if(_0x839d07['talktime']){_0x15e139[_0xacbf('0x63')]=moment[_0xacbf('0x64')](parseInt(_0x839d07[_0xacbf('0x65')])*0x3e8)[_0xacbf('0x66')](_0xacbf('0x67'));}else if(_0x839d07[_0xacbf('0x68')]&&_0x839d07[_0xacbf('0x69')]){_0x15e139[_0xacbf('0x63')]=moment[_0xacbf('0x64')](moment(_0x839d07[_0xacbf('0x69')],'YYYY-MM-DDTHH:mm:ss')[_0xacbf('0x6a')](moment(_0x839d07['starttime'],_0xacbf('0x6b'))))[_0xacbf('0x66')](_0xacbf('0x67'));}switch(_0x839d07['lastevent']){case _0xacbf('0x6c'):_0x15e139[_0xacbf('0x6d')]='Called';break;case _0xacbf('0x6e'):case _0xacbf('0x6f'):_0x15e139[_0xacbf('0x6d')]=_0xacbf('0x70');break;case _0xacbf('0x71'):_0x15e139[_0xacbf('0x6d')]=_0xacbf('0x72');break;case'abandoned':_0x15e139['Call_Result']=_0xacbf('0x73');break;case'timeout':_0x15e139['Call_Result']='Timeout';default:}_0x15e139['Call_Start_Time']=(_0x140b21===_0xacbf('0x74')?moment(_0x839d07['starttime'])[_0xacbf('0x66')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x839d07[_0xacbf('0x75')])['format'](_0xacbf('0x6b')))||moment()[_0xacbf('0x66')](_0xacbf('0x6b'));_0x15e139['Call_Type']=_0x140b21||_0xacbf('0x76');_0x15e139=_['merge'](_0x15e139,getCustomFields(_0xda9b5b[_0xacbf('0x77')],_0x839d07));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x1d14dd+_0xacbf('0x78'),'headers':{'Authorization':_0xacbf('0x34')+_0x228e7e},'body':{'data':[_0x15e139]},'json':!![]})['then'](function(_0x5f27ae){if(_0x5f27ae&&_0x5f27ae[_0xacbf('0x42')][0x0][_0xacbf('0x49')]==='SUCCESS'){logger[_0xacbf('0x3a')](_0xacbf('0x79'));return{'id':_0x5f27ae['data'][0x0][_0xacbf('0x7a')]['id']};}})[_0xacbf('0x2c')](function(_0x2abf58){logger[_0xacbf('0x3a')](_0xacbf('0x7b'),_0x2abf58[_0xacbf('0x2f')]);console[_0xacbf('0x7c')](_0xacbf('0x7b'),_0x2abf58);});}exports[_0xacbf('0x7d')]=function(_0x4717b8,_0x517b5f,_0xa04be8,_0x11754f,_0x4358b9,_0x45e2a5){var _0x355f53,_0x5133c0,_0x21080a;_0x45e2a5[_0xacbf('0x7e')]=intUtil[_0xacbf('0x7f')](_0x45e2a5[_0xacbf('0x7e')]);_0x45e2a5[_0xacbf('0x80')]=intUtil['stripTrailingSlash'](_0x45e2a5[_0xacbf('0x80')]);if(_0x4358b9&&_0x4358b9[_0xacbf('0x81')]){logger[_0xacbf('0x3a')]('[QUEUE]',_0xacbf('0x82'));_0x517b5f[_0xacbf('0x83')]=_0x45e2a5[_0xacbf('0x80')]+_0xacbf('0x84')+_0x517b5f[_0xacbf('0x85')]+'/downloads?type=uniqueid&token='+md5(_0x517b5f[_0xacbf('0x85')]);}else{_0x517b5f[_0xacbf('0x83')]='';}var _0x1b0284=_0x45e2a5['host']===_0xacbf('0x86')?'eu':_0xacbf('0x87');return getAccessToken(_0x45e2a5)[_0xacbf('0x35')](function(_0x184b0b){_0x21080a=_0x184b0b;return getUser(_0x21080a,_0x1b0284,_0x45e2a5,_0x11754f[_0xacbf('0x39')]);})[_0xacbf('0x35')](function(_0x1c5c9f){_0x355f53=_0x1c5c9f;logger[_0xacbf('0x3a')](_0xacbf('0x88'),_0x355f53['id']);return getEndUser(_0x21080a,_0x1b0284,_0x45e2a5,_0x517b5f[_0xacbf('0x89')],_0x517b5f[_0xacbf('0x8a')],_0x355f53,_0xa04be8);})[_0xacbf('0x35')](function(_0x2b31c2){_0x5133c0=_0x2b31c2;return getCall(_0x21080a,_0x1b0284,_0x45e2a5,_0x355f53,_0x5133c0,_0xa04be8,_0x517b5f,'Inbound');})['then'](function(_0x452e79){if(_0x452e79){logger['info']('The\x20Call\x20ID\x20is:',_0x452e79['id']);logger[_0xacbf('0x3a')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xacbf('0x8b'),_0x11754f['name']),'trigger:browser:url',{'uri':_0xacbf('0x8c')+_0x45e2a5[_0xacbf('0x7e')]+'/crm/EntityInfo.do?module=Calls&id='+_0x452e79['id']});}})[_0xacbf('0x2c')](function(_0x1f3dad){logger[_0xacbf('0x2d')](_0xacbf('0x8d'),JSON[_0xacbf('0xf')](_0x1f3dad));});};exports[_0xacbf('0x74')]=function(_0x5d0c5e,_0x360d0a,_0x7ab039,_0x50449c,_0x437615,_0x96e6c,_0x263d32){var _0x4a1f0d,_0x884410,_0x4fd94b;_0x96e6c[_0xacbf('0x7e')]=intUtil['stripTrailingSlash'](_0x96e6c[_0xacbf('0x7e')]);_0x96e6c[_0xacbf('0x80')]=intUtil[_0xacbf('0x7f')](_0x96e6c[_0xacbf('0x80')]);if(_0x263d32&&_0x263d32[_0xacbf('0x8e')]&&_0x263d32[_0xacbf('0x8e')]!==_0xacbf('0x8f')){logger[_0xacbf('0x3a')]('[OUTBOUND]',_0xacbf('0x82'));_0x360d0a[_0xacbf('0x83')]=_0x96e6c[_0xacbf('0x80')]+_0xacbf('0x84')+_0x360d0a[_0xacbf('0x85')]+_0xacbf('0x90')+md5(_0x360d0a['uniqueid']);}var _0x37b2b4=_0x96e6c[_0xacbf('0x7e')]==='zoho.eu'?'eu':_0xacbf('0x87');return getAccessToken(_0x96e6c)[_0xacbf('0x35')](function(_0x5966f1){_0x4fd94b=_0x5966f1;return getUser(_0x4fd94b,_0x37b2b4,_0x96e6c,_0x50449c[_0xacbf('0x39')]);})[_0xacbf('0x35')](function(_0x83acd4){_0x4a1f0d=_0x83acd4;logger[_0xacbf('0x3a')](_0xacbf('0x88'),_0x4a1f0d['id']);return getEndUser(_0x4fd94b,_0x37b2b4,_0x96e6c,_0x360d0a[_0xacbf('0x91')],_0x360d0a[_0xacbf('0x92')],_0x4a1f0d,_0x7ab039);})['then'](function(_0x419f3a){_0x884410=_0x419f3a;return getCall(_0x4fd94b,_0x37b2b4,_0x96e6c,_0x4a1f0d,_0x884410,_0x7ab039,_0x360d0a,'Outbound');})[_0xacbf('0x35')](function(_0x5b5ba8){if(_0x5b5ba8){logger[_0xacbf('0x3a')](_0xacbf('0x93'),_0x5b5ba8['id']);logger[_0xacbf('0x3a')](_0xacbf('0x94'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xacbf('0x66')](_0xacbf('0x8b'),_0x50449c[_0xacbf('0x1b')]),_0xacbf('0x95'),{'uri':_0xacbf('0x8c')+_0x96e6c[_0xacbf('0x7e')]+_0xacbf('0x96')+_0x5b5ba8['id']});}})[_0xacbf('0x2c')](function(_0x82d246){logger[_0xacbf('0x2d')]('[OUTBOUND]',JSON['stringify'](_0x82d246));});};exports[_0xacbf('0x97')]=function(_0x50e894,_0x1f7279,_0x1d8198,_0x5003ca,_0x3838fe,_0x13924c){var _0x5b1b14,_0x3dd25b,_0x318c56;_0x13924c[_0xacbf('0x7e')]=intUtil[_0xacbf('0x7f')](_0x13924c[_0xacbf('0x7e')]);_0x13924c[_0xacbf('0x80')]=intUtil[_0xacbf('0x7f')](_0x13924c[_0xacbf('0x80')]);if(_0x3838fe&&_0x3838fe[_0xacbf('0x81')]){logger[_0xacbf('0x3a')]('['+_0x1f7279[_0xacbf('0x98')][_0xacbf('0x99')]()+']',_0xacbf('0x82'));_0x1f7279['recordingURL']=_0x13924c['serverUrl']+_0xacbf('0x84')+_0x1f7279[_0xacbf('0x85')]+_0xacbf('0x90')+md5(_0x1f7279['uniqueid']);}else{_0x1f7279[_0xacbf('0x83')]='';}var _0xe27fdd=_0x13924c[_0xacbf('0x7e')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x13924c)[_0xacbf('0x35')](function(_0x156055){_0x318c56=_0x156055;return getUser(_0x318c56,_0xe27fdd,_0x13924c);})['then'](function(_0x4182f7){_0x5b1b14=_0x4182f7;logger[_0xacbf('0x3a')](_0xacbf('0x88'),_0x5b1b14['id']);return getEndUser(_0x318c56,_0xe27fdd,_0x13924c,_0x1f7279[_0xacbf('0x89')],_0x1f7279[_0xacbf('0x8a')],_0x5b1b14,_0x1d8198);})[_0xacbf('0x35')](function(_0x5977a6){_0x3dd25b=_0x5977a6;return getCall(_0x318c56,_0xe27fdd,_0x13924c,_0x5b1b14,_0x3dd25b,_0x1d8198,_0x1f7279,'Inbound');})['then'](function(_0x413f52){if(_0x413f52){logger[_0xacbf('0x3a')](_0xacbf('0x93'),_0x413f52['id']);}})['catch'](function(_0x251efb){logger[_0xacbf('0x2d')]('['+_0x1f7279[_0xacbf('0x98')][_0xacbf('0x99')]()+']',JSON[_0xacbf('0xf')](_0x251efb));});}; \ No newline at end of file +var _0x2b9a=['mm:ss','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','complete','connect','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','Call\x20created!','stack','queue','host','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','[QUEUE]','stripTrailingSlash','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','https://crm.','unmanaged','toUpperCase','calleridname','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/logger','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','forEach','string','type','content','toString','variable','variableName','idField','customVariable','Variable','name','toLowerCase','isNil','access_token','isBefore','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','expires_in','seconds','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','ActiveUsers','isArrayLikeObject','users','findIndex','email','profile','user','Administrator','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','POST','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','data','code','SUCCESS','details','enduserType','Error:\x20','log','CREATE\x20ERROR','moduleSearch','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','Creating\x20new\x20call...','Owner','administrator','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x2b9a,0x164));var _0xa2b9=function(_0x32b955,_0x523e6d){_0x32b955=_0x32b955-0x0;var _0xccd88a=_0x2b9a[_0x32b955];return _0xccd88a;};'use strict';var _=require(_0xa2b9('0x0'));var rp=require(_0xa2b9('0x1'));var md5=require(_0xa2b9('0x2'));var util=require(_0xa2b9('0x3'));var intUtil=require(_0xa2b9('0x4'));var moment=require(_0xa2b9('0x5'));var Redis=require(_0xa2b9('0x6'));var BPromise=require(_0xa2b9('0x7'));var config=require('../../../../config/environment');var logger=require(_0xa2b9('0x8'))('zoho');config['redis']=_['defaults'](config[_0xa2b9('0x9')],{'host':_0xa2b9('0xa'),'port':0x18eb});var io=require(_0xa2b9('0xb'))(new Redis(config[_0xa2b9('0x9')]));function emit(_0x56dc1d,_0x416c08,_0x5d4370){io['to'](_0x56dc1d)[_0xa2b9('0xc')](_0x416c08,_0x5d4370);}function request(_0x1cfd74){logger[_0xa2b9('0xd')](_0xa2b9('0xe'),JSON['stringify'](_0x1cfd74));return rp(_0x1cfd74);}function getCustomFields(_0x189c62,_0x532e80){var _0x4640f8={};if(_0x189c62['length']>0x0){_[_0xa2b9('0xf')](_0x189c62,function(_0x472c28){if(_['includes']([_0xa2b9('0x10'),'picklist'],_0x472c28[_0xa2b9('0x11')])&&_0x472c28['idField']){_0x4640f8[_0x472c28['idField']]=_0x472c28[_0xa2b9('0x12')][_0xa2b9('0x13')]();}else if(_0x472c28[_0xa2b9('0x11')]===_0xa2b9('0x14')&&_0x472c28[_0xa2b9('0x15')]&&_0x472c28[_0xa2b9('0x16')]&&_0x532e80[_0x472c28[_0xa2b9('0x15')]]){_0x4640f8[_0x472c28[_0xa2b9('0x16')]]=_0x532e80[_0x472c28[_0xa2b9('0x15')]]['toString']();}else if(_0x472c28[_0xa2b9('0x11')]===_0xa2b9('0x17')&&_0x472c28[_0xa2b9('0x18')]&&_0x472c28['Variable'][_0xa2b9('0x19')]&&_0x472c28[_0xa2b9('0x16')]&&_0x532e80[_0x472c28[_0xa2b9('0x18')]['name'][_0xa2b9('0x1a')]()]){_0x4640f8[_0x472c28[_0xa2b9('0x16')]]=_0x532e80[_0x472c28[_0xa2b9('0x18')][_0xa2b9('0x19')]['toLowerCase']()][_0xa2b9('0x13')]();}});}return _0x4640f8;}function getName(_0x4b9e7e){if(_0x4b9e7e['indexOf']('\x20')>0x0){var _0x3edec1=_0x4b9e7e['split'](/ (.+)/);if(_0x3edec1[0x1]){return _0x3edec1;}}return[_0x4b9e7e,_0x4b9e7e];}var accountsTokens={};function getAccessToken(_0x270647){return new Promise(function(_0x2d4b78,_0x4dce87){if(!_[_0xa2b9('0x1b')](accountsTokens[_0x270647['id']])&&!_['isNil'](accountsTokens[_0x270647['id']][_0xa2b9('0x1c')])){if(moment()[_0xa2b9('0x1d')](accountsTokens[_0x270647['id']]['expires_in'])){_0x2d4b78(accountsTokens[_0x270647['id']][_0xa2b9('0x1c')]);}}var _0x42fc18;switch(_0x270647['zone']){case'US':_0x42fc18='https://accounts.zoho.com';break;case'AU':_0x42fc18=_0xa2b9('0x1e');break;case'EU':_0x42fc18=_0xa2b9('0x1f');break;case'IN':_0x42fc18=_0xa2b9('0x20');break;case'CN':_0x42fc18='https://accounts.zoho.com.cn';break;default:_0x42fc18=_0xa2b9('0x1f');break;}var _0x17db07={'method':'POST','uri':_0x42fc18+_0xa2b9('0x21'),'qs':{'refresh_token':_0x270647[_0xa2b9('0x22')],'client_id':_0x270647[_0xa2b9('0x23')],'client_secret':_0x270647[_0xa2b9('0x24')],'grant_type':_0xa2b9('0x25')},'json':!![]};return rp(_0x17db07)[_0xa2b9('0x26')](function(_0x403da8){accountsTokens[_0x270647['id']]={'access_token':_0x403da8[_0xa2b9('0x1c')],'expires_in':moment()[_0xa2b9('0x27')](_0x403da8[_0xa2b9('0x28')],_0xa2b9('0x29'))};_0x2d4b78(_0x403da8['access_token']);})['catch'](function(_0x7f4789){logger[_0xa2b9('0x2a')](_0xa2b9('0x2b'),_0x7f4789['stack']);_0x4dce87(_0x7f4789);});});}function getUser(_0x234498,_0x34f66e,_0x1ef6bd,_0x387a64){logger[_0xa2b9('0x2c')](_0xa2b9('0x2d'));return request({'method':_0xa2b9('0x2e'),'uri':util[_0xa2b9('0x2f')]('https://www.zohoapis.%s/crm/v2/users',_0x34f66e),'qs':{'type':_0xa2b9('0x30')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x234498},'json':!![]})[_0xa2b9('0x26')](function(_0x38a41e){if(_0x38a41e['users']){var _0x25347e=-0x1;if(_[_0xa2b9('0x31')](_0x38a41e[_0xa2b9('0x32')])){if(!_['isNil'](_0x387a64)){_0x25347e=_[_0xa2b9('0x33')](_0x38a41e[_0xa2b9('0x32')],function(_0x1a8d89){return _0x1a8d89[_0xa2b9('0x34')]===_0x387a64;});}if(_0x25347e>=0x0){logger[_0xa2b9('0x2c')]('Agent\x20found!');}else{logger[_0xa2b9('0x2c')]('Using\x20the\x20admin\x20account!');_0x25347e=_[_0xa2b9('0x33')](_0x38a41e['users'],function(_0x2dbe49){return _0x2dbe49[_0xa2b9('0x35')][_0xa2b9('0x19')]==='Administrator';});}return _0x38a41e[_0xa2b9('0x32')][_0x25347e];}else{if(_0x38a41e[_0xa2b9('0x36')][_0xa2b9('0x35')][_0xa2b9('0x19')]===_0xa2b9('0x37')){logger['info'](_0xa2b9('0x38'));user=_0x38a41e[_0xa2b9('0x36')];return user;}else{logger['error'](_0xa2b9('0x39'),JSON[_0xa2b9('0x3a')](_0x38a41e));throw new Error(_0xa2b9('0x3b')+JSON[_0xa2b9('0x3a')](_0x38a41e));}}}else{logger[_0xa2b9('0x2a')](_0xa2b9('0x39'),JSON['stringify'](_0x38a41e));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xa2b9('0x3a')](_0x38a41e));}})[_0xa2b9('0x3c')](function(_0x44f532){console[_0xa2b9('0x2a')](_0x44f532);});}function getZohoUser(_0x2de7d4,_0x1045f0){return new BPromise(function(_0x3079f3,_0xe07a7f){request(_0x2de7d4)[_0xa2b9('0x26')](function(_0x38557a){var _0x58c290=null;if(_0x38557a){_0x58c290=_0x38557a['data'][0x0];_0x58c290['enduserType']=_0x1045f0;}_0x3079f3(_0x58c290);})[_0xa2b9('0x3c')](function(_0x657877){_0xe07a7f(_0x657877);});});}function createEndUser(_0x51f354,_0x50cb79,_0x47a908,_0x72af9c,_0x1ae37b,_0x3b69fd){var _0x47a908=getName(_0x47a908);return request({'method':_0xa2b9('0x3d'),'uri':'https://www.zohoapis.'+_0x50cb79+_0xa2b9('0x3e')+_[_0xa2b9('0x3f')](_0x3b69fd[_0xa2b9('0x40')])+'s','body':{'data':[{'Last_Name':_0x47a908[0x1],'First_Name':_0x47a908[0x0],'Phone':_0x72af9c,'Owner':{'name':!_['isNil'](_0x1ae37b[_0xa2b9('0x41')]['name'])?_0x1ae37b['role'][_0xa2b9('0x19')]:!_[_0xa2b9('0x1b')](_0x1ae37b[_0xa2b9('0x42')])?_0x1ae37b[_0xa2b9('0x42')]+'\x20'+_0x1ae37b[_0xa2b9('0x43')]:_0x1ae37b['last_name'],'id':_0x1ae37b['id']}}]},'headers':{'Authorization':_0xa2b9('0x44')+_0x51f354},'json':!![]})[_0xa2b9('0x26')](function(_0x5ddab1){if(_0x5ddab1&&_0x5ddab1[_0xa2b9('0x45')][0x0][_0xa2b9('0x46')]===_0xa2b9('0x47')){var _0x4d25c7=_0x5ddab1[_0xa2b9('0x45')][0x0][_0xa2b9('0x48')];_0x4d25c7[_0xa2b9('0x49')]=_[_0xa2b9('0x3f')](_0x3b69fd['moduleCreate'])+'s';return _0x4d25c7;}logger[_0xa2b9('0x2a')](_0xa2b9('0x39'),JSON['stringify'](data));throw new Error(_0xa2b9('0x4a')+JSON[_0xa2b9('0x3a')](data));})[_0xa2b9('0x3c')](function(_0x47ad62){console[_0xa2b9('0x4b')](_0xa2b9('0x4c'),_0x47ad62);});}function getEndUser(_0x5d1429,_0x2996c5,_0x3dda8f,_0x15dad1,_0x32c119,_0x4e736d,_0x20d2e4){var _0x31f0c2={'method':_0xa2b9('0x2e'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5d1429},'json':!![]};switch(_0x20d2e4[_0xa2b9('0x4d')]){case'contact_lead':_0x31f0c2[_0xa2b9('0x4e')]=_0xa2b9('0x4f')+_0x2996c5+_0xa2b9('0x50')+_0x32c119+'))';return getZohoUser(_0x31f0c2,_0xa2b9('0x51'))[_0xa2b9('0x26')](function(_0x3d2319){if(_0x3d2319)return _0x3d2319;_0x31f0c2[_0xa2b9('0x4e')]=_0xa2b9('0x4f')+_0x2996c5+_0xa2b9('0x52')+_0x32c119+'))';return getZohoUser(_0x31f0c2,_0xa2b9('0x53'))['then'](function(_0x5f2f96){if(_0x5f2f96)return _0x5f2f96;if(_0x20d2e4[_0xa2b9('0x40')]!=_0xa2b9('0x54')){return createEndUser(_0x5d1429,_0x2996c5,_0x15dad1,_0x32c119,_0x4e736d,_0x20d2e4);}else{return{};}});});break;case'contact':_0x31f0c2[_0xa2b9('0x4e')]='https://www.zohoapis.'+_0x2996c5+_0xa2b9('0x50')+_0x32c119+'))';return getZohoUser(_0x31f0c2,_0xa2b9('0x51'))[_0xa2b9('0x26')](function(_0x3684c1){if(_0x3684c1)return _0x3684c1;if(_0x20d2e4['moduleCreate']!=_0xa2b9('0x54')){return createEndUser(_0x5d1429,_0x2996c5,_0x15dad1,_0x32c119,_0x4e736d,_0x20d2e4);}else{return{};}});break;case _0xa2b9('0x55'):_0x31f0c2[_0xa2b9('0x4e')]='https://www.zohoapis.'+_0x2996c5+_0xa2b9('0x52')+_0x32c119+'))';return getZohoUser(_0x31f0c2,_0xa2b9('0x53'))[_0xa2b9('0x26')](function(_0x442b1d){if(_0x442b1d)return _0x442b1d;if(_0x20d2e4[_0xa2b9('0x40')]!='nothing'){return createEndUser(_0x5d1429,_0x2996c5,_0x15dad1,_0x32c119,_0x4e736d,_0x20d2e4);}else{return{};}});break;}}function getCall(_0x9693d7,_0x399431,_0x1beaaf,_0x34bc96,_0x554a81,_0x263aa2,_0x32d3fb,_0x43ba7a){logger[_0xa2b9('0x2c')](_0xa2b9('0x56'));var _0x128f7d={};_0x128f7d[_0xa2b9('0x57')]={'name':!_[_0xa2b9('0x1b')](_0x34bc96['role']['name'])&&!_[_0xa2b9('0x1b')](_0x34bc96[_0xa2b9('0x35')][_0xa2b9('0x19')])&&_0x34bc96['profile'][_0xa2b9('0x19')]===_0xa2b9('0x58')?_0x34bc96[_0xa2b9('0x41')][_0xa2b9('0x19')]:!_['isNil'](_0x34bc96[_0xa2b9('0x42')])?_0x34bc96[_0xa2b9('0x42')]+'\x20'+_0x34bc96[_0xa2b9('0x43')]:_0x34bc96['last_name'],'id':_0x34bc96['id']};_0x128f7d['Subject']=intUtil[_0xa2b9('0x59')](_0x263aa2['Subjects'],_0x32d3fb,'\x20');_0x128f7d[_0xa2b9('0x5a')]=intUtil[_0xa2b9('0x59')](_0x263aa2[_0xa2b9('0x5b')],_0x32d3fb,'\x0a');if(_0x554a81['enduserType']===_0xa2b9('0x51')){_0x128f7d[_0xa2b9('0x5c')]={'name':!_[_0xa2b9('0x1b')](_0x554a81[_0xa2b9('0x5d')])?_0x554a81[_0xa2b9('0x5d')]:!_[_0xa2b9('0x1b')](_0x554a81[_0xa2b9('0x5e')])?_0x554a81[_0xa2b9('0x5e')]+'\x20'+_0x554a81[_0xa2b9('0x5f')]:_0x554a81[_0xa2b9('0x5f')],'id':_0x554a81['id']};}if(_0x554a81[_0xa2b9('0x49')]==='Leads'){_0x128f7d[_0xa2b9('0x60')]={'name':!_[_0xa2b9('0x1b')](_0x554a81[_0xa2b9('0x5d')])?_0x554a81[_0xa2b9('0x5d')]:!_['isNil'](_0x554a81[_0xa2b9('0x5e')])?_0x554a81[_0xa2b9('0x5e')]+'\x20'+_0x554a81[_0xa2b9('0x5f')]:_0x554a81['Last_Name'],'id':_0x554a81['id']};_0x128f7d[_0xa2b9('0x61')]=_[_0xa2b9('0x3f')](_0x554a81[_0xa2b9('0x49')]);}if(_0x32d3fb[_0xa2b9('0x62')]){_0x128f7d['Call_Duration']=moment[_0xa2b9('0x63')](parseInt(_0x32d3fb[_0xa2b9('0x62')])*0x3e8)['format'](_0xa2b9('0x64'));}else if(_0x32d3fb['answertime']&&_0x32d3fb[_0xa2b9('0x65')]){_0x128f7d[_0xa2b9('0x66')]=moment['utc'](moment(_0x32d3fb[_0xa2b9('0x65')],_0xa2b9('0x67'))[_0xa2b9('0x68')](moment(_0x32d3fb[_0xa2b9('0x69')],_0xa2b9('0x67'))))[_0xa2b9('0x2f')](_0xa2b9('0x64'));}switch(_0x32d3fb[_0xa2b9('0x6a')]){case _0xa2b9('0x6b'):_0x128f7d[_0xa2b9('0x6c')]='Called';break;case _0xa2b9('0x6d'):case _0xa2b9('0x6e'):_0x128f7d[_0xa2b9('0x6c')]='Answered';break;case _0xa2b9('0x6f'):_0x128f7d[_0xa2b9('0x6c')]=_0xa2b9('0x70');break;case'abandoned':_0x128f7d[_0xa2b9('0x6c')]=_0xa2b9('0x71');break;case _0xa2b9('0x72'):_0x128f7d[_0xa2b9('0x6c')]=_0xa2b9('0x73');default:}_0x128f7d[_0xa2b9('0x74')]=(_0x43ba7a===_0xa2b9('0x75')?moment(_0x32d3fb['starttime'])[_0xa2b9('0x2f')](_0xa2b9('0x67')):moment(_0x32d3fb['agentcalledAt'])['format'](_0xa2b9('0x67')))||moment()[_0xa2b9('0x2f')](_0xa2b9('0x67'));_0x128f7d[_0xa2b9('0x76')]=_0x43ba7a||_0xa2b9('0x77');_0x128f7d=_[_0xa2b9('0x78')](_0x128f7d,getCustomFields(_0x263aa2[_0xa2b9('0x79')],_0x32d3fb));return request({'method':_0xa2b9('0x3d'),'uri':_0xa2b9('0x4f')+_0x399431+'/crm/v2/Calls','headers':{'Authorization':_0xa2b9('0x44')+_0x9693d7},'body':{'data':[_0x128f7d]},'json':!![]})[_0xa2b9('0x26')](function(_0x5b4841){if(_0x5b4841&&_0x5b4841[_0xa2b9('0x45')][0x0][_0xa2b9('0x46')]===_0xa2b9('0x47')){logger[_0xa2b9('0x2c')](_0xa2b9('0x7a'));return{'id':_0x5b4841[_0xa2b9('0x45')][0x0][_0xa2b9('0x48')]['id']};}})[_0xa2b9('0x3c')](function(_0x3f6c64){logger[_0xa2b9('0x2c')]('err',_0x3f6c64[_0xa2b9('0x7b')]);console[_0xa2b9('0x4b')]('err',_0x3f6c64);});}exports[_0xa2b9('0x7c')]=function(_0x37aa12,_0x3b8dc4,_0x8a6943,_0x41cbb5,_0x261284,_0x2d70a3){var _0x408626,_0xb64779,_0x57e6d1;_0x2d70a3['host']=intUtil['stripTrailingSlash'](_0x2d70a3[_0xa2b9('0x7d')]);_0x2d70a3['serverUrl']=intUtil['stripTrailingSlash'](_0x2d70a3[_0xa2b9('0x7e')]);if(_0x261284&&_0x261284[_0xa2b9('0x7f')]){logger['info']('[QUEUE]',_0xa2b9('0x80'));_0x3b8dc4[_0xa2b9('0x81')]=_0x2d70a3[_0xa2b9('0x7e')]+_0xa2b9('0x82')+_0x3b8dc4[_0xa2b9('0x83')]+_0xa2b9('0x84')+md5(_0x3b8dc4[_0xa2b9('0x83')]);}else{_0x3b8dc4[_0xa2b9('0x81')]='';}var _0x2b8127=_0x2d70a3[_0xa2b9('0x7d')]===_0xa2b9('0x85')?'eu':_0xa2b9('0x86');return getAccessToken(_0x2d70a3)[_0xa2b9('0x26')](function(_0x9d956b){_0x57e6d1=_0x9d956b;return getUser(_0x57e6d1,_0x2b8127,_0x2d70a3,_0x41cbb5[_0xa2b9('0x34')]);})[_0xa2b9('0x26')](function(_0x4a0e6a){_0x408626=_0x4a0e6a;logger[_0xa2b9('0x2c')]('The\x20User\x20ID\x20is:',_0x408626['id']);return getEndUser(_0x57e6d1,_0x2b8127,_0x2d70a3,_0x3b8dc4['calleridname'],_0x3b8dc4[_0xa2b9('0x87')],_0x408626,_0x8a6943);})['then'](function(_0x4e9827){_0xb64779=_0x4e9827;return getCall(_0x57e6d1,_0x2b8127,_0x2d70a3,_0x408626,_0xb64779,_0x8a6943,_0x3b8dc4,'Inbound');})[_0xa2b9('0x26')](function(_0x548a16){if(_0x548a16){logger[_0xa2b9('0x2c')](_0xa2b9('0x88'),_0x548a16['id']);logger[_0xa2b9('0x2c')]('[QUEUE]',_0xa2b9('0x89'));emit(util[_0xa2b9('0x2f')](_0xa2b9('0x8a'),_0x41cbb5['name']),'trigger:browser:url',{'uri':'https://crm.'+_0x2d70a3['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x548a16['id']});}})[_0xa2b9('0x3c')](function(_0xc034c){logger[_0xa2b9('0x2a')](_0xa2b9('0x8b'),JSON[_0xa2b9('0x3a')](_0xc034c));});};exports[_0xa2b9('0x75')]=function(_0xdc4617,_0x2ed5d8,_0x43e43f,_0x297a74,_0x554e6b,_0x1d311a,_0x5d36bc){var _0xe50628,_0x213d22,_0x261060;_0x1d311a[_0xa2b9('0x7d')]=intUtil[_0xa2b9('0x8c')](_0x1d311a['host']);_0x1d311a[_0xa2b9('0x7e')]=intUtil['stripTrailingSlash'](_0x1d311a[_0xa2b9('0x7e')]);if(_0x5d36bc&&_0x5d36bc['recordingFormat']&&_0x5d36bc[_0xa2b9('0x8d')]!==_0xa2b9('0x8e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2ed5d8[_0xa2b9('0x81')]=_0x1d311a[_0xa2b9('0x7e')]+'/api/voice/recordings/'+_0x2ed5d8['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x2ed5d8['uniqueid']);}var _0x2a52c1=_0x1d311a[_0xa2b9('0x7d')]===_0xa2b9('0x85')?'eu':'com';return getAccessToken(_0x1d311a)[_0xa2b9('0x26')](function(_0x4a5ee4){_0x261060=_0x4a5ee4;return getUser(_0x261060,_0x2a52c1,_0x1d311a,_0x297a74['email']);})[_0xa2b9('0x26')](function(_0x42448a){_0xe50628=_0x42448a;logger['info'](_0xa2b9('0x8f'),_0xe50628['id']);return getEndUser(_0x261060,_0x2a52c1,_0x1d311a,_0x2ed5d8[_0xa2b9('0x90')],_0x2ed5d8[_0xa2b9('0x91')],_0xe50628,_0x43e43f);})[_0xa2b9('0x26')](function(_0x424def){_0x213d22=_0x424def;return getCall(_0x261060,_0x2a52c1,_0x1d311a,_0xe50628,_0x213d22,_0x43e43f,_0x2ed5d8,_0xa2b9('0x92'));})['then'](function(_0x598cc){if(_0x598cc){logger[_0xa2b9('0x2c')]('The\x20Call\x20ID\x20is:',_0x598cc['id']);logger['info'](_0xa2b9('0x93'),_0xa2b9('0x89'));emit(util[_0xa2b9('0x2f')](_0xa2b9('0x8a'),_0x297a74[_0xa2b9('0x19')]),'trigger:browser:url',{'uri':_0xa2b9('0x94')+_0x1d311a['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x598cc['id']});}})[_0xa2b9('0x3c')](function(_0x9cee71){logger['error'](_0xa2b9('0x93'),JSON[_0xa2b9('0x3a')](_0x9cee71));});};exports[_0xa2b9('0x95')]=function(_0xcf4b6a,_0xd51800,_0x4fcd29,_0x114e73,_0x354882,_0x9f496f){var _0x39c0e8,_0x3190a7,_0x2da1d4;_0x9f496f[_0xa2b9('0x7d')]=intUtil[_0xa2b9('0x8c')](_0x9f496f['host']);_0x9f496f[_0xa2b9('0x7e')]=intUtil[_0xa2b9('0x8c')](_0x9f496f[_0xa2b9('0x7e')]);if(_0x354882&&_0x354882[_0xa2b9('0x7f')]){logger[_0xa2b9('0x2c')]('['+_0xd51800['lastevent'][_0xa2b9('0x96')]()+']',_0xa2b9('0x80'));_0xd51800[_0xa2b9('0x81')]=_0x9f496f[_0xa2b9('0x7e')]+'/api/voice/recordings/'+_0xd51800[_0xa2b9('0x83')]+_0xa2b9('0x84')+md5(_0xd51800['uniqueid']);}else{_0xd51800[_0xa2b9('0x81')]='';}var _0x2cbf44=_0x9f496f[_0xa2b9('0x7d')]===_0xa2b9('0x85')?'eu':_0xa2b9('0x86');return getAccessToken(_0x9f496f)[_0xa2b9('0x26')](function(_0x1ce3b5){_0x2da1d4=_0x1ce3b5;return getUser(_0x2da1d4,_0x2cbf44,_0x9f496f);})[_0xa2b9('0x26')](function(_0x112140){_0x39c0e8=_0x112140;logger[_0xa2b9('0x2c')]('The\x20User\x20ID\x20is:',_0x39c0e8['id']);return getEndUser(_0x2da1d4,_0x2cbf44,_0x9f496f,_0xd51800[_0xa2b9('0x97')],_0xd51800[_0xa2b9('0x87')],_0x39c0e8,_0x4fcd29);})[_0xa2b9('0x26')](function(_0x1436d2){_0x3190a7=_0x1436d2;return getCall(_0x2da1d4,_0x2cbf44,_0x9f496f,_0x39c0e8,_0x3190a7,_0x4fcd29,_0xd51800,'Inbound');})['then'](function(_0xb1b91){if(_0xb1b91){logger['info']('The\x20Call\x20ID\x20is:',_0xb1b91['id']);}})['catch'](function(_0x1c00b8){logger[_0xa2b9('0x2a')]('['+_0xd51800['lastevent'][_0xa2b9('0x96')]()+']',JSON[_0xa2b9('0x3a')](_0x1c00b8));});}; \ 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 6c321c4..fd6871e 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 _0x8498=['format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','util','mustache','../../../../config/logger','trigger','data2','Script','data3','render','exec','error'];(function(_0x211a05,_0x3aab49){var _0xfd5fa6=function(_0x297283){while(--_0x297283){_0x211a05['push'](_0x211a05['shift']());}};_0xfd5fa6(++_0x3aab49);}(_0x8498,0x6e));var _0x8849=function(_0x39df26,_0x30c4fa){_0x39df26=_0x39df26-0x0;var _0x2fcdfc=_0x8498[_0x39df26];return _0x2fcdfc;};'use strict';var util=require(_0x8849('0x0'));var sh=require('shelljs');var Mustache=require(_0x8849('0x1'));var logger=require(_0x8849('0x2'))(_0x8849('0x3'));exports['exec']=function(_0x78b908,_0x2776d1){var _0x411c38=_0x78b908[_0x8849('0x4')]?_0x78b908[_0x8849('0x4')]:_0x8849('0x5');var _0xdc42ba=_0x78b908[_0x8849('0x6')]?Mustache[_0x8849('0x7')](_0x78b908[_0x8849('0x6')],_0x2776d1):_0x2776d1;sh[_0x8849('0x8')](_0xdc42ba,function(_0xd612b,_0x4248f6,_0x52b035){if(_0xd612b!==0x0){logger[_0x8849('0x9')](util[_0x8849('0xa')](_0x8849('0xb'),_0x411c38,_0xdc42ba,_0xd612b,_0x52b035));}else{logger['info'](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x411c38,_0xdc42ba,_0x4248f6));}});}; \ No newline at end of file +var _0x9e46=['format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','mustache','../../../../config/logger','trigger','data2','data3','render'];(function(_0x2eceb9,_0x109a9c){var _0x25febc=function(_0x365b2e){while(--_0x365b2e){_0x2eceb9['push'](_0x2eceb9['shift']());}};_0x25febc(++_0x109a9c);}(_0x9e46,0x9b));var _0x69e4=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9e46[_0x618414];return _0x21c19a;};'use strict';var util=require(_0x69e4('0x0'));var sh=require('shelljs');var Mustache=require(_0x69e4('0x1'));var logger=require(_0x69e4('0x2'))(_0x69e4('0x3'));exports['exec']=function(_0x17f256,_0x543d2f){var _0x2bf0df=_0x17f256[_0x69e4('0x4')]?_0x17f256[_0x69e4('0x4')]:'Script';var _0x2b6bc4=_0x17f256[_0x69e4('0x5')]?Mustache[_0x69e4('0x6')](_0x17f256[_0x69e4('0x5')],_0x543d2f):_0x543d2f;sh['exec'](_0x2b6bc4,function(_0x37f461,_0x106651,_0x242475){if(_0x37f461!==0x0){logger['error'](util[_0x69e4('0x7')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x2bf0df,_0x2b6bc4,_0x37f461,_0x242475));}else{logger['info'](util['format'](_0x69e4('0x8'),_0x2bf0df,_0x2b6bc4,_0x106651));}});}; \ 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 6fbb3d7..45b29c0 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 _0x1fa8=['body','error','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','parse','data6','DELETE','PUT','data7'];(function(_0x1360c8,_0xe06c8e){var _0x4f9026=function(_0x439d34){while(--_0x439d34){_0x1360c8['push'](_0x1360c8['shift']());}};_0x4f9026(++_0xe06c8e);}(_0x1fa8,0xce));var _0x81fa=function(_0x22cc92,_0x428489){_0x22cc92=_0x22cc92-0x0;var _0x3ec769=_0x1fa8[_0x22cc92];return _0x3ec769;};'use strict';var rp=require('request-promise');var util=require(_0x81fa('0x0'));var _=require(_0x81fa('0x1'));var Mustache=require(_0x81fa('0x2'));var logger=require(_0x81fa('0x3'))(_0x81fa('0x4'));exports[_0x81fa('0x5')]=function(_0x4188ff,_0x128b1a){var _0x3de5e6,_0x2a30ed;var _0x1ebf3d={'method':_0x4188ff[_0x81fa('0x6')][_0x81fa('0x7')](),'uri':Mustache[_0x81fa('0x8')](_0x4188ff[_0x81fa('0x9')],_0x128b1a),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4188ff['data5'])===_0x81fa('0xa')&&parseInt(_0x4188ff[_0x81fa('0xb')])>=0x1&&parseInt(_0x4188ff['data5'])<=0xa?parseInt(_0x4188ff[_0x81fa('0xb')])*0x3e8:0x5*0x3e8};try{_0x1ebf3d[_0x81fa('0xc')]=_0x4188ff['data6']?JSON[_0x81fa('0xd')](Mustache['render'](_0x4188ff[_0x81fa('0xe')],_0x128b1a)):{};}catch(_0x22a8aa){logger['error'](_0x22a8aa['stack']);}switch(_0x4188ff[_0x81fa('0x6')][_0x81fa('0x7')]()){case'GET':case _0x81fa('0xf'):_0x3de5e6=null;_0x1ebf3d['qs']=_0x128b1a;break;case'POST':case _0x81fa('0x10'):if(_0x4188ff[_0x81fa('0x11')]){try{_0x3de5e6=JSON[_0x81fa('0xd')](Mustache[_0x81fa('0x8')](_0x4188ff[_0x81fa('0x11')],_0x128b1a));_0x1ebf3d[_0x81fa('0x12')]=_0x3de5e6;}catch(_0xbb84f2){logger['error'](_0xbb84f2['stack']);logger[_0x81fa('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x3de5e6=_0x128b1a;_0x1ebf3d[_0x81fa('0x12')]=_0x3de5e6;}break;}logger['info'](util[_0x81fa('0x14')](_0x81fa('0x15'),_0x4188ff[_0x81fa('0x6')],_0x4188ff[_0x81fa('0x9')],JSON[_0x81fa('0x16')](_0x1ebf3d)));rp(_0x1ebf3d)[_0x81fa('0x17')](function(_0x456024){_0x3de5e6=!_[_0x81fa('0x18')](_0x3de5e6)?',\x20request\x20body:\x20'+_0x3de5e6:'';_0x2a30ed=typeof _0x456024[_0x81fa('0x12')]==='object'?JSON['stringify'](_0x456024['body']):_0x456024[_0x81fa('0x12')];logger[_0x81fa('0x19')](util['format'](_0x81fa('0x1a'),_0x4188ff[_0x81fa('0x6')],_0x4188ff['data2'],_0x456024[_0x81fa('0x1b')],_0x2a30ed));})[_0x81fa('0x1c')](function(_0x2159ae){logger[_0x81fa('0x13')](util[_0x81fa('0x14')](_0x81fa('0x1d'),_0x4188ff['data1'],_0x4188ff[_0x81fa('0x9')],_0x2159ae[_0x81fa('0x1b')],_0x2159ae[_0x81fa('0x1e')],_0x2159ae[_0x81fa('0x1f')]));});}; \ No newline at end of file +var _0x73c5=['mustache','trigger','exec','data1','toUpperCase','render','data5','number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','isNil','object','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','request-promise','util','lodash'];(function(_0x3c68ac,_0x38b406){var _0x35d849=function(_0x1fb2e0){while(--_0x1fb2e0){_0x3c68ac['push'](_0x3c68ac['shift']());}};_0x35d849(++_0x38b406);}(_0x73c5,0x195));var _0x573c=function(_0x496195,_0x4552e){_0x496195=_0x496195-0x0;var _0x414b17=_0x73c5[_0x496195];return _0x414b17;};'use strict';var rp=require(_0x573c('0x0'));var util=require(_0x573c('0x1'));var _=require(_0x573c('0x2'));var Mustache=require(_0x573c('0x3'));var logger=require('../../../../config/logger')(_0x573c('0x4'));exports[_0x573c('0x5')]=function(_0x5c8736,_0x463c08){var _0x2e79ad,_0x1d7a67;var _0x31b6f8={'method':_0x5c8736[_0x573c('0x6')][_0x573c('0x7')](),'uri':Mustache[_0x573c('0x8')](_0x5c8736['data2'],_0x463c08),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5c8736[_0x573c('0x9')])===_0x573c('0xa')&&parseInt(_0x5c8736[_0x573c('0x9')])>=0x1&&parseInt(_0x5c8736['data5'])<=0xa?parseInt(_0x5c8736[_0x573c('0x9')])*0x3e8:0x5*0x3e8};try{_0x31b6f8[_0x573c('0xb')]=_0x5c8736[_0x573c('0xc')]?JSON[_0x573c('0xd')](Mustache[_0x573c('0x8')](_0x5c8736['data6'],_0x463c08)):{};}catch(_0x3fae5f){logger[_0x573c('0xe')](_0x3fae5f[_0x573c('0xf')]);}switch(_0x5c8736[_0x573c('0x6')][_0x573c('0x7')]()){case'GET':case _0x573c('0x10'):_0x2e79ad=null;_0x31b6f8['qs']=_0x463c08;break;case _0x573c('0x11'):case _0x573c('0x12'):if(_0x5c8736['data7']){try{_0x2e79ad=JSON[_0x573c('0xd')](Mustache[_0x573c('0x8')](_0x5c8736[_0x573c('0x13')],_0x463c08));_0x31b6f8[_0x573c('0x14')]=_0x2e79ad;}catch(_0x2cc1db){logger['error'](_0x2cc1db[_0x573c('0xf')]);logger[_0x573c('0xe')](_0x573c('0x15'));}}else{_0x2e79ad=_0x463c08;_0x31b6f8['body']=_0x2e79ad;}break;}logger[_0x573c('0x16')](util[_0x573c('0x17')](_0x573c('0x18'),_0x5c8736['data1'],_0x5c8736[_0x573c('0x19')],JSON[_0x573c('0x1a')](_0x31b6f8)));rp(_0x31b6f8)['then'](function(_0x8e38e0){_0x2e79ad=!_[_0x573c('0x1b')](_0x2e79ad)?',\x20request\x20body:\x20'+_0x2e79ad:'';_0x1d7a67=typeof _0x8e38e0['body']===_0x573c('0x1c')?JSON['stringify'](_0x8e38e0[_0x573c('0x14')]):_0x8e38e0[_0x573c('0x14')];logger[_0x573c('0x16')](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x5c8736[_0x573c('0x6')],_0x5c8736[_0x573c('0x19')],_0x8e38e0['statusCode'],_0x1d7a67));})[_0x573c('0x1d')](function(_0x1d15ad){logger[_0x573c('0xe')](util[_0x573c('0x17')](_0x573c('0x1e'),_0x5c8736[_0x573c('0x6')],_0x5c8736[_0x573c('0x19')],_0x1d15ad[_0x573c('0x1f')],_0x1d15ad[_0x573c('0x20')],_0x1d15ad[_0x573c('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index b2d211a..536a0f8 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 _0xa25e=['jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','rpc','routing','error','catch','exports'];(function(_0x45a2c1,_0x2b5897){var _0x1534e3=function(_0x1a11b8){while(--_0x1a11b8){_0x45a2c1['push'](_0x45a2c1['shift']());}};_0x1534e3(++_0x2b5897);}(_0xa25e,0xb6));var _0xea25=function(_0x1caa52,_0x39ce6a){_0x1caa52=_0x1caa52-0x0;var _0x1e4213=_0xa25e[_0x1caa52];return _0x1e4213;};'use strict';var jayson=require(_0xea25('0x0'));var BPromise=require(_0xea25('0x1'));var logger=require(_0xea25('0x2'))('routing');var client=jayson[_0xea25('0x3')][_0xea25('0x4')]({'port':0x2329});client[_0xea25('0x5')]=function(_0x5130ea,_0x542768){return new BPromise(function(_0x3a59c2,_0x4c2a6b){return client[_0xea25('0x6')](_0x5130ea,_0x542768)[_0xea25('0x7')](function(_0x58c4ad){logger['debug'](_0xea25('0x8'),_0xea25('0x9'),_0x5130ea,_0x542768,_0x58c4ad);if(_0x58c4ad[_0xea25('0xa')]){logger['error']('rpc',_0xea25('0x9'),_0x5130ea,_0x58c4ad[_0xea25('0xa')]['message'],_0x542768);return _0x4c2a6b(_0x58c4ad['error']['message']);}else{return _0x3a59c2(_0x58c4ad['result']);}})[_0xea25('0xb')](function(_0x43d3ed){logger[_0xea25('0xa')](_0xea25('0x8'),_0xea25('0x9'),_0x5130ea,_0x43d3ed,_0x542768);return _0x4c2a6b(_0x43d3ed);});});};module[_0xea25('0xc')]=client; \ No newline at end of file +var _0xf25e=['client','http','then','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x564ba0,_0xa05d10){var _0x504929=function(_0x55e603){while(--_0x55e603){_0x564ba0['push'](_0x564ba0['shift']());}};_0x504929(++_0xa05d10);}(_0xf25e,0x1b6));var _0xef25=function(_0x570fac,_0x1a4a5f){_0x570fac=_0x570fac-0x0;var _0x224ade=_0xf25e[_0x570fac];return _0x224ade;};'use strict';var jayson=require(_0xef25('0x0'));var BPromise=require(_0xef25('0x1'));var logger=require(_0xef25('0x2'))(_0xef25('0x3'));var client=jayson[_0xef25('0x4')][_0xef25('0x5')]({'port':0x2329});client['Request']=function(_0x2a0e73,_0x3e656f){return new BPromise(function(_0x133e88,_0x1df915){return client['request'](_0x2a0e73,_0x3e656f)[_0xef25('0x6')](function(_0x503742){logger['debug'](_0xef25('0x7'),_0xef25('0x3'),_0x2a0e73,_0x3e656f,_0x503742);if(_0x503742[_0xef25('0x8')]){logger[_0xef25('0x8')](_0xef25('0x7'),_0xef25('0x3'),_0x2a0e73,_0x503742[_0xef25('0x8')][_0xef25('0x9')],_0x3e656f);return _0x1df915(_0x503742[_0xef25('0x8')][_0xef25('0x9')]);}else{return _0x133e88(_0x503742[_0xef25('0xa')]);}})[_0xef25('0xb')](function(_0x2eba6e){logger[_0xef25('0x8')](_0xef25('0x7'),_0xef25('0x3'),_0x2a0e73,_0x2eba6e,_0x3e656f);return _0x1df915(_0x2eba6e);});});};module[_0xef25('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 72b9e7f..69511c1 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 _0xe173=['resolve','getMailAccounts','then','mailAccounts','listen','getSettings','loginMailFrequency','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger'];(function(_0x304086,_0xccb3ef){var _0x441eaf=function(_0x51bcd7){while(--_0x51bcd7){_0x304086['push'](_0x304086['shift']());}};_0x441eaf(++_0xccb3ef);}(_0xe173,0xf6));var _0x3e17=function(_0x33f3d0,_0x59649d){_0x33f3d0=_0x33f3d0-0x0;var _0x3f6787=_0xe173[_0x33f3d0];return _0x3f6787;};'use strict';var server=require(_0x3e17('0x0'));var Realtime=require(_0x3e17('0x1'));var EmailChannel=require(_0x3e17('0x2'));var mailAccount=require(_0x3e17('0x3'));var setting=require(_0x3e17('0x4'));var logger=require(_0x3e17('0x5'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x3e17('0x6')]()['then'](mailAccount[_0x3e17('0x7')]())[_0x3e17('0x8')](realtime['initMailAccounts']())[_0x3e17('0x8')](function(){email['refresh'](realtime[_0x3e17('0x9')]);return realtime;});}function main(){return server[_0x3e17('0xa')](realtime,email)[_0x3e17('0x8')](function(){return initRealtime();})[_0x3e17('0x8')](function(){return setting[_0x3e17('0xb')]();})[_0x3e17('0x8')](function(_0x4bc6a3){return setInterval(initRealtime,_0x4bc6a3[_0x3e17('0xc')]*0x3e8);})['catch'](function(_0x5bde5b){logger['error'](_0x3e17('0xd'),_0x5bde5b);});}main(); \ No newline at end of file +var _0x15fa=['resolve','then','getMailAccounts','refresh','mailAccounts','listen','getSettings','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','email'];(function(_0x345e4c,_0x3e73ba){var _0x40c41c=function(_0x23dfe0){while(--_0x23dfe0){_0x345e4c['push'](_0x345e4c['shift']());}};_0x40c41c(++_0x3e73ba);}(_0x15fa,0x19e));var _0xa15f=function(_0x1ddd3d,_0x2fce2d){_0x1ddd3d=_0x1ddd3d-0x0;var _0x5be208=_0x15fa[_0x1ddd3d];return _0x5be208;};'use strict';var server=require(_0xa15f('0x0'));var Realtime=require(_0xa15f('0x1'));var EmailChannel=require(_0xa15f('0x2'));var mailAccount=require(_0xa15f('0x3'));var setting=require(_0xa15f('0x4'));var logger=require('../../config/logger')(_0xa15f('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xa15f('0x6')]()[_0xa15f('0x7')](mailAccount[_0xa15f('0x8')]())[_0xa15f('0x7')](realtime['initMailAccounts']())[_0xa15f('0x7')](function(){email[_0xa15f('0x9')](realtime[_0xa15f('0xa')]);return realtime;});}function main(){return server[_0xa15f('0xb')](realtime,email)[_0xa15f('0x7')](function(){return initRealtime();})[_0xa15f('0x7')](function(){return setting[_0xa15f('0xc')]();})['then'](function(_0x5d5b16){return setInterval(initRealtime,_0x5d5b16['loginMailFrequency']*0x3e8);})['catch'](function(_0x10c8c1){logger[_0xa15f('0xd')](_0xa15f('0xe'),_0x10c8c1);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 14509d6..be976f7 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 _0x5b18=['mailAccount:update','refresh','hasOwnProperty','service','provider','custom','box','handleImapEmail','bind','end','error','handleImapError','isNil','disabled','messageStatus','handleImapBox','status','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','handleImapEnd','send','verifySmtp','Smtp','lastSync','verify','exports','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','key','active','Imap','total'];(function(_0x4613bb,_0x450e6e){var _0x3ecd8e=function(_0x18053e){while(--_0x18053e){_0x4613bb['push'](_0x4613bb['shift']());}};_0x3ecd8e(++_0x450e6e);}(_0x5b18,0xd4));var _0x85b1=function(_0x31f85c,_0x13dbef){_0x31f85c=_0x31f85c-0x0;var _0x3d057f=_0x5b18[_0x31f85c];return _0x3d057f;};'use strict';var _=require('lodash');var moment=require(_0x85b1('0x0'));var BPromise=require(_0x85b1('0x1'));var md5=require(_0x85b1('0x2'));var Redis=require('ioredis');var config=require(_0x85b1('0x3'));var logger=require(_0x85b1('0x4'))(_0x85b1('0x5'));config[_0x85b1('0x6')]=_[_0x85b1('0x7')](config[_0x85b1('0x6')],{'host':_0x85b1('0x8'),'port':0x18eb});var io=require(_0x85b1('0x9'))(new Redis(config['redis']));var EmailImap=require(_0x85b1('0xa'));var EmailSmtp=require(_0x85b1('0xb'));var mailAccount=require(_0x85b1('0xc'));var md5Accounts={};function EmailChannel(_0x499206){logger[_0x85b1('0xd')](_0x85b1('0xe'));this[_0x85b1('0xf')]=_0x499206['mailAccounts'];this[_0x85b1('0x10')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x85b1('0x11')][_0x85b1('0x12')]=function(_0x4d9f7b){var _0x4aece4=this[_0x85b1('0xf')][_0x4d9f7b];var _0x2f68f8={'id':_0x4aece4['id'],'name':_0x4aece4[_0x85b1('0x13')],'key':_0x4aece4[_0x85b1('0x14')],'active':_0x4aece4[_0x85b1('0x15')],'Imap':{'status':_0x4aece4[_0x85b1('0x16')]['status'],'messageStatus':_0x4aece4[_0x85b1('0x16')]['messageStatus'],'total':_0x4aece4[_0x85b1('0x16')][_0x85b1('0x17')]}};if(_['isNil'](md5Accounts[_0x4d9f7b])){md5Accounts[_0x4d9f7b]={};}var _0x4518ec=md5(JSON['stringify'](_0x2f68f8));if(md5Accounts[_0x4d9f7b][_0x85b1('0x2')]!==_0x4518ec){md5Accounts[_0x4d9f7b][_0x85b1('0x2')]=_0x4518ec;io[_0x85b1('0x12')](_0x85b1('0x18'),_0x2f68f8);}};EmailChannel[_0x85b1('0x11')][_0x85b1('0x19')]=function(_0x253f7b){for(var _0x3771cc in _0x253f7b){if(_0x253f7b[_0x85b1('0x1a')](_0x3771cc)){if(_0x253f7b[_0x3771cc][_0x85b1('0x16')]&&_0x253f7b[_0x3771cc][_0x85b1('0x15')]){var _0x4d2e3e=_0x253f7b[_0x3771cc]['Imap'];if(!_0x4d2e3e[_0x85b1('0x1b')]&&_0x253f7b[_0x3771cc][_0x85b1('0x1c')]!==_0x85b1('0x1d'))_0x4d2e3e[_0x85b1('0x1b')]=_0x253f7b[_0x3771cc][_0x85b1('0x1c')];if(!this['imapAccounts']['hasOwnProperty'](_0x4d2e3e['id'])){this['imapAccounts'][_0x4d2e3e['id']]=new EmailImap(_0x4d2e3e,_0x253f7b[_0x3771cc][_0x85b1('0x5')]);this['imapAccounts'][_0x4d2e3e['id']]['on'](_0x85b1('0x1e'),this['handleImapBox']['bind'](this,_0x3771cc));this[_0x85b1('0x10')][_0x4d2e3e['id']]['on']('email',this[_0x85b1('0x1f')][_0x85b1('0x20')](this,_0x3771cc));this[_0x85b1('0x10')][_0x4d2e3e['id']]['on'](_0x85b1('0x21'),this['handleImapEnd'][_0x85b1('0x20')](this,_0x3771cc));this['imapAccounts'][_0x4d2e3e['id']]['on'](_0x85b1('0x22'),this[_0x85b1('0x23')][_0x85b1('0x20')](this,_0x3771cc));}}else{if(_[_0x85b1('0x24')](this[_0x85b1('0xf')][_0x3771cc][_0x85b1('0x16')])){this[_0x85b1('0xf')][_0x3771cc]['Imap']={};}this[_0x85b1('0xf')][_0x3771cc][_0x85b1('0x16')]['status']=_0x85b1('0x25');this[_0x85b1('0xf')][_0x3771cc][_0x85b1('0x16')][_0x85b1('0x26')]='';this[_0x85b1('0x12')](_0x3771cc);}}}};EmailChannel['prototype'][_0x85b1('0x27')]=function(_0xaf2744,_0x4eba3d){if(this[_0x85b1('0xf')][_0xaf2744]){this[_0x85b1('0xf')][_0xaf2744][_0x85b1('0x16')][_0x85b1('0x28')]=_0x85b1('0x29');this['mailAccounts'][_0xaf2744][_0x85b1('0x16')][_0x85b1('0x26')]=_0x4eba3d[_0x85b1('0x13')];if(_0x4eba3d[_0x85b1('0x2a')]){this[_0x85b1('0xf')][_0xaf2744][_0x85b1('0x16')]['total']=_0x4eba3d[_0x85b1('0x2a')][_0x85b1('0x17')];}return this['emit'](_0xaf2744);}};EmailChannel[_0x85b1('0x11')][_0x85b1('0x1f')]=function(_0x24cac7,_0x502b83){logger['info'](_0x85b1('0x2b'),_0x502b83['firstName'],_0x502b83[_0x85b1('0x2c')],_0x502b83[_0x85b1('0x2d')],_0x24cac7);if(this['mailAccounts'][_0x24cac7]){return mailAccount[_0x85b1('0x2e')](_0x24cac7,_0x502b83)[_0x85b1('0x2f')](function(_0x499e84){if(_0x499e84){logger[_0x85b1('0xd')](_0x85b1('0x30'));}})[_0x85b1('0x31')](function(_0x318c0d){logger[_0x85b1('0x22')](_0x85b1('0x32'),JSON[_0x85b1('0x33')](_0x318c0d));});}};EmailChannel['prototype'][_0x85b1('0x34')]=function(_0x58a790){if(this['mailAccounts'][_0x58a790]&&this[_0x85b1('0xf')][_0x58a790]['Imap']){if(this[_0x85b1('0x10')][this[_0x85b1('0xf')][_0x58a790][_0x85b1('0x16')]['id']]){delete this[_0x85b1('0x10')][this[_0x85b1('0xf')][_0x58a790][_0x85b1('0x16')]['id']];}this['mailAccounts'][_0x58a790][_0x85b1('0x16')]['lastSync']=moment();this[_0x85b1('0x12')](_0x58a790);}};EmailChannel[_0x85b1('0x11')][_0x85b1('0x23')]=function(_0x2a8ce8,_0x52d129){if(this['mailAccounts'][_0x2a8ce8]){this[_0x85b1('0xf')][_0x2a8ce8]['Imap'][_0x85b1('0x28')]=_0x85b1('0x22');this[_0x85b1('0xf')][_0x2a8ce8][_0x85b1('0x16')][_0x85b1('0x26')]=_0x52d129;return this[_0x85b1('0x12')](_0x2a8ce8);}};EmailChannel[_0x85b1('0x11')]['sendMail']=function(_0x521137,_0x29b049){return this['smtp'][_0x85b1('0x35')](_0x521137,_0x29b049);};EmailChannel[_0x85b1('0x11')][_0x85b1('0x36')]=function(_0x19785e){var _0x5a5cc5=this;if(this['mailAccounts'][_0x19785e['id']]){if(_[_0x85b1('0x24')](this[_0x85b1('0xf')][_0x19785e['id']][_0x85b1('0x37')])){this['mailAccounts'][_0x19785e['id']][_0x85b1('0x37')]={};}this[_0x85b1('0xf')][_0x19785e['id']][_0x85b1('0x37')][_0x85b1('0x38')]=moment();return new BPromise(function(_0x51c6d5,_0xbcdc35){return _0x5a5cc5['smtp'][_0x85b1('0x39')](_0x19785e)['then'](function(_0x2fcda9){_0x5a5cc5[_0x85b1('0xf')][_0x19785e['id']][_0x85b1('0x37')][_0x85b1('0x28')]='verified';_0x5a5cc5[_0x85b1('0xf')][_0x19785e['id']][_0x85b1('0x37')]['messageStatus']='';_0x5a5cc5[_0x85b1('0x12')](_0x19785e['id']);_0x51c6d5(_0x2fcda9);})['catch'](function(_0xe4796b){_0x5a5cc5[_0x85b1('0xf')][_0x19785e['id']][_0x85b1('0x37')][_0x85b1('0x28')]='error';_0x5a5cc5[_0x85b1('0xf')][_0x19785e['id']][_0x85b1('0x37')][_0x85b1('0x26')]=_0xe4796b;_0x5a5cc5['emit'](_0x19785e['id']);_0xbcdc35(_0xe4796b);});});}return this['smtp'][_0x85b1('0x39')](_0x19785e);};module[_0x85b1('0x3a')]=EmailChannel; \ No newline at end of file +var _0xb717=['key','active','Imap','status','total','isNil','stringify','md5','mailAccount:update','refresh','service','custom','provider','hasOwnProperty','email','box','handleImapBox','bind','handleImapEmail','handleImapEnd','error','handleImapError','disabled','messageStatus','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','Smtp','lastSync','verify','exports','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','defaults','localhost','socket.io-emitter','redis','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name'];(function(_0x4f3056,_0xe685f6){var _0x2b8af0=function(_0x3e04c2){while(--_0x3e04c2){_0x4f3056['push'](_0x4f3056['shift']());}};_0x2b8af0(++_0xe685f6);}(_0xb717,0x189));var _0x7b71=function(_0x314969,_0x428ca4){_0x314969=_0x314969-0x0;var _0x391c96=_0xb717[_0x314969];return _0x391c96;};'use strict';var _=require('lodash');var moment=require(_0x7b71('0x0'));var BPromise=require(_0x7b71('0x1'));var md5=require('md5');var Redis=require(_0x7b71('0x2'));var config=require(_0x7b71('0x3'));var logger=require(_0x7b71('0x4'))('email');config['redis']=_[_0x7b71('0x5')](config['redis'],{'host':_0x7b71('0x6'),'port':0x18eb});var io=require(_0x7b71('0x7'))(new Redis(config[_0x7b71('0x8')]));var EmailImap=require(_0x7b71('0x9'));var EmailSmtp=require(_0x7b71('0xa'));var mailAccount=require(_0x7b71('0xb'));var md5Accounts={};function EmailChannel(_0xee5e6e){logger[_0x7b71('0xc')](_0x7b71('0xd'));this[_0x7b71('0xe')]=_0xee5e6e['mailAccounts'];this[_0x7b71('0xf')]={};this[_0x7b71('0x10')]=new EmailSmtp();}EmailChannel[_0x7b71('0x11')][_0x7b71('0x12')]=function(_0x41a245){var _0x56d203=this[_0x7b71('0xe')][_0x41a245];var _0x2de084={'id':_0x56d203['id'],'name':_0x56d203[_0x7b71('0x13')],'key':_0x56d203[_0x7b71('0x14')],'active':_0x56d203[_0x7b71('0x15')],'Imap':{'status':_0x56d203[_0x7b71('0x16')][_0x7b71('0x17')],'messageStatus':_0x56d203[_0x7b71('0x16')]['messageStatus'],'total':_0x56d203[_0x7b71('0x16')][_0x7b71('0x18')]}};if(_[_0x7b71('0x19')](md5Accounts[_0x41a245])){md5Accounts[_0x41a245]={};}var _0x3857d2=md5(JSON[_0x7b71('0x1a')](_0x2de084));if(md5Accounts[_0x41a245][_0x7b71('0x1b')]!==_0x3857d2){md5Accounts[_0x41a245][_0x7b71('0x1b')]=_0x3857d2;io[_0x7b71('0x12')](_0x7b71('0x1c'),_0x2de084);}};EmailChannel[_0x7b71('0x11')][_0x7b71('0x1d')]=function(_0x171453){for(var _0x5d4fcf in _0x171453){if(_0x171453['hasOwnProperty'](_0x5d4fcf)){if(_0x171453[_0x5d4fcf][_0x7b71('0x16')]&&_0x171453[_0x5d4fcf][_0x7b71('0x15')]){var _0x93f22f=_0x171453[_0x5d4fcf][_0x7b71('0x16')];if(!_0x93f22f[_0x7b71('0x1e')]&&_0x171453[_0x5d4fcf]['provider']!==_0x7b71('0x1f'))_0x93f22f[_0x7b71('0x1e')]=_0x171453[_0x5d4fcf][_0x7b71('0x20')];if(!this[_0x7b71('0xf')][_0x7b71('0x21')](_0x93f22f['id'])){this[_0x7b71('0xf')][_0x93f22f['id']]=new EmailImap(_0x93f22f,_0x171453[_0x5d4fcf][_0x7b71('0x22')]);this[_0x7b71('0xf')][_0x93f22f['id']]['on'](_0x7b71('0x23'),this[_0x7b71('0x24')][_0x7b71('0x25')](this,_0x5d4fcf));this[_0x7b71('0xf')][_0x93f22f['id']]['on']('email',this[_0x7b71('0x26')]['bind'](this,_0x5d4fcf));this[_0x7b71('0xf')][_0x93f22f['id']]['on']('end',this[_0x7b71('0x27')]['bind'](this,_0x5d4fcf));this[_0x7b71('0xf')][_0x93f22f['id']]['on'](_0x7b71('0x28'),this[_0x7b71('0x29')][_0x7b71('0x25')](this,_0x5d4fcf));}}else{if(_[_0x7b71('0x19')](this['mailAccounts'][_0x5d4fcf][_0x7b71('0x16')])){this[_0x7b71('0xe')][_0x5d4fcf][_0x7b71('0x16')]={};}this[_0x7b71('0xe')][_0x5d4fcf][_0x7b71('0x16')]['status']=_0x7b71('0x2a');this[_0x7b71('0xe')][_0x5d4fcf]['Imap'][_0x7b71('0x2b')]='';this[_0x7b71('0x12')](_0x5d4fcf);}}}};EmailChannel[_0x7b71('0x11')][_0x7b71('0x24')]=function(_0x214284,_0x4a3f23){if(this[_0x7b71('0xe')][_0x214284]){this['mailAccounts'][_0x214284][_0x7b71('0x16')][_0x7b71('0x17')]=_0x7b71('0x2c');this[_0x7b71('0xe')][_0x214284]['Imap'][_0x7b71('0x2b')]=_0x4a3f23[_0x7b71('0x13')];if(_0x4a3f23['messages']){this[_0x7b71('0xe')][_0x214284][_0x7b71('0x16')][_0x7b71('0x18')]=_0x4a3f23[_0x7b71('0x2d')]['total'];}return this[_0x7b71('0x12')](_0x214284);}};EmailChannel['prototype'][_0x7b71('0x26')]=function(_0x1d370f,_0x321c8e){logger[_0x7b71('0xc')](_0x7b71('0x2e'),_0x321c8e[_0x7b71('0x2f')],_0x321c8e[_0x7b71('0x30')],_0x321c8e['from'],_0x1d370f);if(this[_0x7b71('0xe')][_0x1d370f]){return mailAccount[_0x7b71('0x31')](_0x1d370f,_0x321c8e)[_0x7b71('0x32')](function(_0x419b5d){if(_0x419b5d){logger['info'](_0x7b71('0x33'));}})[_0x7b71('0x34')](function(_0x4c50ae){logger[_0x7b71('0x28')](_0x7b71('0x35'),JSON[_0x7b71('0x1a')](_0x4c50ae));});}};EmailChannel['prototype']['handleImapEnd']=function(_0xcec74a){if(this['mailAccounts'][_0xcec74a]&&this[_0x7b71('0xe')][_0xcec74a][_0x7b71('0x16')]){if(this[_0x7b71('0xf')][this[_0x7b71('0xe')][_0xcec74a][_0x7b71('0x16')]['id']]){delete this[_0x7b71('0xf')][this[_0x7b71('0xe')][_0xcec74a][_0x7b71('0x16')]['id']];}this['mailAccounts'][_0xcec74a][_0x7b71('0x16')]['lastSync']=moment();this[_0x7b71('0x12')](_0xcec74a);}};EmailChannel['prototype'][_0x7b71('0x29')]=function(_0x56c806,_0x10f335){if(this[_0x7b71('0xe')][_0x56c806]){this[_0x7b71('0xe')][_0x56c806]['Imap']['status']=_0x7b71('0x28');this[_0x7b71('0xe')][_0x56c806][_0x7b71('0x16')][_0x7b71('0x2b')]=_0x10f335;return this['emit'](_0x56c806);}};EmailChannel['prototype'][_0x7b71('0x36')]=function(_0x2572fc,_0x4b6bff){return this['smtp']['send'](_0x2572fc,_0x4b6bff);};EmailChannel['prototype']['verifySmtp']=function(_0x57b99a){var _0x37e2a4=this;if(this['mailAccounts'][_0x57b99a['id']]){if(_[_0x7b71('0x19')](this[_0x7b71('0xe')][_0x57b99a['id']]['Smtp'])){this['mailAccounts'][_0x57b99a['id']][_0x7b71('0x37')]={};}this['mailAccounts'][_0x57b99a['id']]['Smtp'][_0x7b71('0x38')]=moment();return new BPromise(function(_0x4fdbf2,_0x35aa38){return _0x37e2a4[_0x7b71('0x10')][_0x7b71('0x39')](_0x57b99a)['then'](function(_0x113ff2){_0x37e2a4[_0x7b71('0xe')][_0x57b99a['id']][_0x7b71('0x37')]['status']='verified';_0x37e2a4[_0x7b71('0xe')][_0x57b99a['id']][_0x7b71('0x37')][_0x7b71('0x2b')]='';_0x37e2a4[_0x7b71('0x12')](_0x57b99a['id']);_0x4fdbf2(_0x113ff2);})['catch'](function(_0x2e8f60){_0x37e2a4[_0x7b71('0xe')][_0x57b99a['id']][_0x7b71('0x37')][_0x7b71('0x17')]=_0x7b71('0x28');_0x37e2a4['mailAccounts'][_0x57b99a['id']]['Smtp']['messageStatus']=_0x2e8f60;_0x37e2a4['emit'](_0x57b99a['id']);_0x35aa38(_0x2e8f60);});});}return this[_0x7b71('0x10')][_0x7b71('0x39')](_0x57b99a);};module[_0x7b71('0x3a')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 5ca1b03..c9c93c3 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 _0x0e49=['handleReadUnseen','length','fetch','message','handleFetchError','handleFetchEnd','handleFetchMessage','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','closeBox','stringify','textCode','hasOwnProperty','exports','lodash','util','imap','mailparser','iconv','Iconv','events','./utils','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleReady','end','handleEnd','bind','error','handleError','connect','inherits','connTimeout','authTimeout','service','user','xoauth2','generateXOAuth2Token','CloudProvider','authentication','password','host','port','tls','autotls','prototype','openBox','handleOpenBox','emit','box','handleCloseBox','readUnseen','search','UNSEEN'];(function(_0x389b61,_0x47deec){var _0x3cb840=function(_0x29072a){while(--_0x29072a){_0x389b61['push'](_0x389b61['shift']());}};_0x3cb840(++_0x47deec);}(_0x0e49,0xd3));var _0x90e4=function(_0x52e94f,_0x22e52d){_0x52e94f=_0x52e94f-0x0;var _0x127d43=_0x0e49[_0x52e94f];return _0x127d43;};'use strict';var _=require(_0x90e4('0x0'));var util=require(_0x90e4('0x1'));var Imap=require(_0x90e4('0x2'));var simpleParser=require(_0x90e4('0x3'))['simpleParser'];var Iconv=require(_0x90e4('0x4'))[_0x90e4('0x5')];var EventEmitter=require(_0x90e4('0x6'))['EventEmitter'];var utils=require(_0x90e4('0x7'));var logger=require(_0x90e4('0x8'))(_0x90e4('0x9'));function EmailImap(_0x1b0f50,_0x3ef4fd){this[_0x90e4('0xa')]=_0x1b0f50['mailbox'];this[_0x90e4('0xb')]=this[_0x90e4('0xc')](_0x1b0f50,_0x3ef4fd);this[_0x90e4('0x2')]=new Imap(this[_0x90e4('0xb')]);this[_0x90e4('0x2')][_0x90e4('0xd')](_0x90e4('0xe'),this[_0x90e4('0xf')]['bind'](this));this[_0x90e4('0x2')][_0x90e4('0xd')](_0x90e4('0x10'),this[_0x90e4('0x11')][_0x90e4('0x12')](this));this[_0x90e4('0x2')]['on'](_0x90e4('0x13'),this[_0x90e4('0x14')][_0x90e4('0x12')](this));this[_0x90e4('0x2')][_0x90e4('0x15')]();}util[_0x90e4('0x16')](EmailImap,EventEmitter);EmailImap['prototype'][_0x90e4('0xc')]=function(_0x504248,_0x14d721){var _0x250ddc={'connTimeout':_0x504248[_0x90e4('0x17')]?_0x504248[_0x90e4('0x17')]*0x3e8:0x2710,'authTimeout':_0x504248[_0x90e4('0x18')]?_0x504248['authTimeout']*0x3e8:0x1388};if(_0x504248[_0x90e4('0x19')]){_0x250ddc[_0x90e4('0x1a')]=_0x504248['user'];if(_0x504248['modernAuthentication']){_0x250ddc[_0x90e4('0x1b')]=utils[_0x90e4('0x1c')](_0x504248[_0x90e4('0x1d')]['data5'],_0x504248['user']);}else{_0x250ddc['password']=_0x504248['password'];}}else{if(_0x504248[_0x90e4('0x1e')]){_0x250ddc[_0x90e4('0x1a')]=_0x504248[_0x90e4('0x1a')];_0x250ddc['password']=_0x504248[_0x90e4('0x1f')];}}_0x250ddc['email']=_0x14d721||_0x504248[_0x90e4('0x1a')]||'anonymous@xcally.com';_0x250ddc[_0x90e4('0x20')]=_0x504248[_0x90e4('0x20')];_0x250ddc[_0x90e4('0x21')]=_0x504248[_0x90e4('0x21')]||0x3e1;if(_0x504248[_0x90e4('0x22')]){_0x250ddc[_0x90e4('0x22')]=!![];}else{_0x250ddc[_0x90e4('0x22')]=![];_0x250ddc[_0x90e4('0x23')]='required';}return _0x250ddc;};EmailImap[_0x90e4('0x24')]['handleReady']=function(){this[_0x90e4('0x2')][_0x90e4('0x25')](this[_0x90e4('0xa')],![],this[_0x90e4('0x26')][_0x90e4('0x12')](this));};EmailImap['prototype'][_0x90e4('0x26')]=function(_0x4df622,_0x34be0d){if(_0x4df622){this['handleError'](_0x4df622,!![]);}else{this[_0x90e4('0x27')](_0x90e4('0x28'),_0x34be0d);this['readUnseen']();}};EmailImap[_0x90e4('0x24')][_0x90e4('0x29')]=function(_0x532a56){if(_0x532a56){this[_0x90e4('0x14')](_0x532a56,!![]);}else{this[_0x90e4('0x2')][_0x90e4('0x10')]();}};EmailImap[_0x90e4('0x24')][_0x90e4('0x2a')]=function(){this[_0x90e4('0x2')][_0x90e4('0x2b')]([_0x90e4('0x2c')],this[_0x90e4('0x2d')][_0x90e4('0x12')](this));};EmailImap[_0x90e4('0x24')][_0x90e4('0x2d')]=function(_0x9cfd83,_0x490682){if(_0x9cfd83){this[_0x90e4('0x14')](_0x9cfd83,!![]);}else{if(_0x490682[_0x90e4('0x2e')]){try{var _0x4065d5=this[_0x90e4('0x2')][_0x90e4('0x2f')](_0x490682,{'bodies':'','markSeen':!![]});_0x4065d5['on'](_0x90e4('0x30'),this['handleFetchMessage'][_0x90e4('0x12')](this));_0x4065d5[_0x90e4('0xd')](_0x90e4('0x13'),this[_0x90e4('0x31')][_0x90e4('0x12')](this));_0x4065d5[_0x90e4('0xd')](_0x90e4('0x10'),this[_0x90e4('0x32')]['bind'](this));}catch(_0x5d26cf){logger[_0x90e4('0x13')](_0x5d26cf);}}else{this[_0x90e4('0x2')]['closeBox'](!![],this['handleCloseBox'][_0x90e4('0x12')](this));}}};EmailImap['prototype'][_0x90e4('0x33')]=function(_0x804b04){_0x804b04['on'](_0x90e4('0x34'),this[_0x90e4('0x35')]['bind'](this));_0x804b04[_0x90e4('0xd')](_0x90e4('0x36'),this[_0x90e4('0x37')][_0x90e4('0x12')](this));_0x804b04[_0x90e4('0xd')](_0x90e4('0x10'),this['handleMessageEnd'][_0x90e4('0x12')](this));};EmailImap[_0x90e4('0x24')]['handleMessageBody']=function(_0x4dba20){simpleParser(_0x4dba20,{'Iconv':Iconv},this[_0x90e4('0x38')]['bind'](this));};EmailImap['prototype']['handleMessageAttributes']=function(){};EmailImap[_0x90e4('0x24')][_0x90e4('0x39')]=function(){};EmailImap['prototype'][_0x90e4('0x38')]=function(_0x5aeacf,_0x5281ec){if(_0x5aeacf){logger[_0x90e4('0x13')](_0x5aeacf);}else{var _0x14c55e=this;utils[_0x90e4('0x3a')](this[_0x90e4('0xb')],_0x5281ec,function(_0x391d75){_0x14c55e['emit']('email',_0x391d75);});}};EmailImap[_0x90e4('0x24')][_0x90e4('0x32')]=function(){this[_0x90e4('0x2')][_0x90e4('0x3b')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x90e4('0x24')][_0x90e4('0x31')]=function(_0x46d49c){this[_0x90e4('0x14')](_0x46d49c);this[_0x90e4('0x2')][_0x90e4('0x3b')](!![],this['handleCloseBox'][_0x90e4('0x12')](this));};EmailImap[_0x90e4('0x24')][_0x90e4('0x11')]=function(){this[_0x90e4('0x27')](_0x90e4('0x10'));};EmailImap[_0x90e4('0x24')][_0x90e4('0x14')]=function(_0x33cab0,_0x1a0d29){logger[_0x90e4('0x13')](_0x90e4('0x14'),this[_0x90e4('0xb')][_0x90e4('0x9')],JSON[_0x90e4('0x3c')](_0x33cab0));var _0x487052='';if(_0x33cab0){if(_0x33cab0['textCode']){_0x487052=_0x33cab0[_0x90e4('0x3d')];}else{for(var _0x1b972b in _0x33cab0){if(_0x33cab0[_0x90e4('0x3e')](_0x1b972b)){_0x487052+=_['upperFirst'](_0x1b972b)+':\x20'+_0x33cab0[_0x1b972b]+'\x0a';}}}}if(_0x1a0d29){this[_0x90e4('0x2')]['end']();}else{this[_0x90e4('0x27')]('error',_0x487052);this[_0x90e4('0x27')]('end');}};module[_0x90e4('0x3f')]=EmailImap; \ No newline at end of file +var _0xa995=['fetch','message','handleFetchMessage','error','handleFetchError','closeBox','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','handleEnd','stringify','textCode','hasOwnProperty','exports','lodash','util','mailparser','iconv','Iconv','events','./utils','../../../config/logger','email','mailbox','getAccount','imap','account','once','ready','handleReady','bind','end','handleError','connect','inherits','connTimeout','authTimeout','service','user','xoauth2','CloudProvider','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','prototype','openBox','handleOpenBox','emit','box','handleCloseBox','readUnseen','search','handleReadUnseen','length'];(function(_0x455482,_0x4c5323){var _0x51d348=function(_0x343f1e){while(--_0x343f1e){_0x455482['push'](_0x455482['shift']());}};_0x51d348(++_0x4c5323);}(_0xa995,0x1cb));var _0x5a99=function(_0x1e7a40,_0x234996){_0x1e7a40=_0x1e7a40-0x0;var _0x51103b=_0xa995[_0x1e7a40];return _0x51103b;};'use strict';var _=require(_0x5a99('0x0'));var util=require(_0x5a99('0x1'));var Imap=require('imap');var simpleParser=require(_0x5a99('0x2'))['simpleParser'];var Iconv=require(_0x5a99('0x3'))[_0x5a99('0x4')];var EventEmitter=require(_0x5a99('0x5'))['EventEmitter'];var utils=require(_0x5a99('0x6'));var logger=require(_0x5a99('0x7'))(_0x5a99('0x8'));function EmailImap(_0x45257c,_0x294276){this[_0x5a99('0x9')]=_0x45257c[_0x5a99('0x9')];this['account']=this[_0x5a99('0xa')](_0x45257c,_0x294276);this[_0x5a99('0xb')]=new Imap(this[_0x5a99('0xc')]);this[_0x5a99('0xb')][_0x5a99('0xd')](_0x5a99('0xe'),this[_0x5a99('0xf')][_0x5a99('0x10')](this));this['imap'][_0x5a99('0xd')](_0x5a99('0x11'),this['handleEnd'][_0x5a99('0x10')](this));this['imap']['on']('error',this[_0x5a99('0x12')][_0x5a99('0x10')](this));this[_0x5a99('0xb')][_0x5a99('0x13')]();}util[_0x5a99('0x14')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x554b09,_0x38153f){var _0xe83013={'connTimeout':_0x554b09[_0x5a99('0x15')]?_0x554b09[_0x5a99('0x15')]*0x3e8:0x2710,'authTimeout':_0x554b09[_0x5a99('0x16')]?_0x554b09[_0x5a99('0x16')]*0x3e8:0x1388};if(_0x554b09[_0x5a99('0x17')]){_0xe83013[_0x5a99('0x18')]=_0x554b09[_0x5a99('0x18')];if(_0x554b09['modernAuthentication']){_0xe83013[_0x5a99('0x19')]=utils['generateXOAuth2Token'](_0x554b09[_0x5a99('0x1a')]['data5'],_0x554b09[_0x5a99('0x18')]);}else{_0xe83013['password']=_0x554b09[_0x5a99('0x1b')];}}else{if(_0x554b09[_0x5a99('0x1c')]){_0xe83013[_0x5a99('0x18')]=_0x554b09[_0x5a99('0x18')];_0xe83013[_0x5a99('0x1b')]=_0x554b09[_0x5a99('0x1b')];}}_0xe83013[_0x5a99('0x8')]=_0x38153f||_0x554b09[_0x5a99('0x18')]||_0x5a99('0x1d');_0xe83013[_0x5a99('0x1e')]=_0x554b09[_0x5a99('0x1e')];_0xe83013[_0x5a99('0x1f')]=_0x554b09['port']||0x3e1;if(_0x554b09[_0x5a99('0x20')]){_0xe83013[_0x5a99('0x20')]=!![];}else{_0xe83013['tls']=![];_0xe83013[_0x5a99('0x21')]=_0x5a99('0x22');}return _0xe83013;};EmailImap[_0x5a99('0x23')][_0x5a99('0xf')]=function(){this['imap'][_0x5a99('0x24')](this[_0x5a99('0x9')],![],this[_0x5a99('0x25')][_0x5a99('0x10')](this));};EmailImap[_0x5a99('0x23')][_0x5a99('0x25')]=function(_0x1c6173,_0x281ac8){if(_0x1c6173){this['handleError'](_0x1c6173,!![]);}else{this[_0x5a99('0x26')](_0x5a99('0x27'),_0x281ac8);this['readUnseen']();}};EmailImap[_0x5a99('0x23')][_0x5a99('0x28')]=function(_0x4c4876){if(_0x4c4876){this[_0x5a99('0x12')](_0x4c4876,!![]);}else{this[_0x5a99('0xb')][_0x5a99('0x11')]();}};EmailImap['prototype'][_0x5a99('0x29')]=function(){this[_0x5a99('0xb')][_0x5a99('0x2a')](['UNSEEN'],this['handleReadUnseen'][_0x5a99('0x10')](this));};EmailImap[_0x5a99('0x23')][_0x5a99('0x2b')]=function(_0x4b6c1c,_0x517e69){if(_0x4b6c1c){this[_0x5a99('0x12')](_0x4b6c1c,!![]);}else{if(_0x517e69[_0x5a99('0x2c')]){try{var _0x4cc6b8=this[_0x5a99('0xb')][_0x5a99('0x2d')](_0x517e69,{'bodies':'','markSeen':!![]});_0x4cc6b8['on'](_0x5a99('0x2e'),this[_0x5a99('0x2f')][_0x5a99('0x10')](this));_0x4cc6b8[_0x5a99('0xd')](_0x5a99('0x30'),this[_0x5a99('0x31')][_0x5a99('0x10')](this));_0x4cc6b8[_0x5a99('0xd')](_0x5a99('0x11'),this['handleFetchEnd'][_0x5a99('0x10')](this));}catch(_0x37c558){logger['error'](_0x37c558);}}else{this[_0x5a99('0xb')][_0x5a99('0x32')](!![],this[_0x5a99('0x28')]['bind'](this));}}};EmailImap['prototype'][_0x5a99('0x2f')]=function(_0x4fa602){_0x4fa602['on']('body',this[_0x5a99('0x33')]['bind'](this));_0x4fa602[_0x5a99('0xd')](_0x5a99('0x34'),this[_0x5a99('0x35')]['bind'](this));_0x4fa602[_0x5a99('0xd')](_0x5a99('0x11'),this[_0x5a99('0x36')][_0x5a99('0x10')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x2886c5){simpleParser(_0x2886c5,{'Iconv':Iconv},this[_0x5a99('0x37')]['bind'](this));};EmailImap['prototype'][_0x5a99('0x35')]=function(){};EmailImap[_0x5a99('0x23')][_0x5a99('0x36')]=function(){};EmailImap[_0x5a99('0x23')]['handleSimpleParser']=function(_0x55b236,_0x573cbf){if(_0x55b236){logger['error'](_0x55b236);}else{var _0x382a23=this;utils[_0x5a99('0x38')](this[_0x5a99('0xc')],_0x573cbf,function(_0x1b35aa){_0x382a23[_0x5a99('0x26')](_0x5a99('0x8'),_0x1b35aa);});}};EmailImap[_0x5a99('0x23')][_0x5a99('0x39')]=function(){this[_0x5a99('0xb')][_0x5a99('0x32')](!![],this['handleCloseBox'][_0x5a99('0x10')](this));};EmailImap[_0x5a99('0x23')][_0x5a99('0x31')]=function(_0x55bed7){this[_0x5a99('0x12')](_0x55bed7);this[_0x5a99('0xb')][_0x5a99('0x32')](!![],this[_0x5a99('0x28')][_0x5a99('0x10')](this));};EmailImap[_0x5a99('0x23')][_0x5a99('0x3a')]=function(){this[_0x5a99('0x26')]('end');};EmailImap[_0x5a99('0x23')][_0x5a99('0x12')]=function(_0x5d87c6,_0x2358fc){logger[_0x5a99('0x30')]('handleError',this[_0x5a99('0xc')]['email'],JSON[_0x5a99('0x3b')](_0x5d87c6));var _0x224b63='';if(_0x5d87c6){if(_0x5d87c6['textCode']){_0x224b63=_0x5d87c6[_0x5a99('0x3c')];}else{for(var _0x177f1c in _0x5d87c6){if(_0x5d87c6[_0x5a99('0x3d')](_0x177f1c)){_0x224b63+=_['upperFirst'](_0x177f1c)+':\x20'+_0x5d87c6[_0x177f1c]+'\x0a';}}}}if(_0x2358fc){this[_0x5a99('0xb')][_0x5a99('0x11')]();}else{this['emit'](_0x5a99('0x30'),_0x224b63);this['emit'](_0x5a99('0x11'));}};module[_0x5a99('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 b84be4c..b2dc156 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 _0x15b3=['send','createTransport','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','prototype'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x15b3,0xf8));var _0x315b=function(_0x5cb519,_0x1da9ce){_0x5cb519=_0x5cb519-0x0;var _0x4ef061=_0x15b3[_0x5cb519];return _0x4ef061;};'use strict';var nodemailer=require(_0x315b('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x315b('0x1')][_0x315b('0x2')]=function(_0xf1e51d,_0x34f01b){return new Promise(function(_0x2c33ee,_0x405659){var _0x53d522=nodemailer[_0x315b('0x3')](_0xf1e51d);_0x53d522['use'](_0x315b('0x4'),inlineBase64());_0x53d522[_0x315b('0x5')](_0x34f01b,function(_0x5cebce,_0x300e59){if(_0x5cebce){_0x405659(_0x5cebce[_0x315b('0x6')]());}else{_0x2c33ee(_0x300e59);}});});};EmailSmtp[_0x315b('0x1')][_0x315b('0x7')]=function(_0x5d36c1){return new Promise(function(_0x47a4ca,_0x248871){var _0x867fcc=nodemailer[_0x315b('0x3')](_0x5d36c1);_0x867fcc[_0x315b('0x7')](function(_0x1debe0,_0x2c3ed2){if(_0x1debe0){_0x248871(_0x1debe0['toString']());}else{if(_0x2c3ed2){_0x47a4ca(_0x2c3ed2);}else{_0x248871(_0x315b('0x8'));}}});});};module[_0x315b('0x9')]=EmailSmtp; \ No newline at end of file +var _0x9124=['use','compile','sendMail','verify','exports','nodemailer','prototype','createTransport'];(function(_0x425caf,_0x755cf2){var _0x4ff889=function(_0x3dfc05){while(--_0x3dfc05){_0x425caf['push'](_0x425caf['shift']());}};_0x4ff889(++_0x755cf2);}(_0x9124,0x1d5));var _0x4912=function(_0x3b3191,_0x3a7d8a){_0x3b3191=_0x3b3191-0x0;var _0x1c2c63=_0x9124[_0x3b3191];return _0x1c2c63;};'use strict';var nodemailer=require(_0x4912('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x4912('0x1')]['send']=function(_0x37bc60,_0x33b4e6){return new Promise(function(_0x4fe096,_0x1384bf){var _0x47d49d=nodemailer[_0x4912('0x2')](_0x37bc60);_0x47d49d[_0x4912('0x3')](_0x4912('0x4'),inlineBase64());_0x47d49d[_0x4912('0x5')](_0x33b4e6,function(_0x5e6aa3,_0x36b84a){if(_0x5e6aa3){_0x1384bf(_0x5e6aa3['toString']());}else{_0x4fe096(_0x36b84a);}});});};EmailSmtp['prototype'][_0x4912('0x6')]=function(_0x4a60eb){return new Promise(function(_0x501732,_0x25d4ef){var _0x564bfd=nodemailer[_0x4912('0x2')](_0x4a60eb);_0x564bfd[_0x4912('0x6')](function(_0x295ac4,_0x13cd39){if(_0x295ac4){_0x25d4ef(_0x295ac4['toString']());}else{if(_0x13cd39){_0x501732(_0x13cd39);}else{_0x25d4ef('Not\x20verifired');}}});});};module[_0x4912('0x7')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 778b7b2..65c142c 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 _0xa440=['message','originCc','originTo','bcc','attachments','attach','type','attachment','attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','content','push','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','indexOf','line','isAutoreply','parser','from','subject','messageId','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','split','length','slice','join','Anonymous','pop','isEmpty','html','test','includes','\x20[Attachment:\x20','body','0x1?_0x2d9450[_0x0a44('0x12')](0x0,-0x1)[_0x0a44('0x13')]('\x20'):_0x52d9a3[_0x0a44('0xe')];}return _0x0a44('0x14');}function getLastName(_0x3514c8){var _0x4d29f3=_[_0x0a44('0x8')](_0x3514c8[_0x0a44('0x9')]);if(_0x4d29f3&&_0x4d29f3['name']){var _0x131350=_0x4d29f3[_0x0a44('0xe')][_0x0a44('0x10')](/\s+/);return _0x131350[_0x0a44('0x11')]>0x1?_0x131350[_0x0a44('0x15')]():'';}return'';}function getMails(_0x2ecb1a,_0x2c631a){var _0x598ebb='';for(var _0x535360=0x0;_0x535360<_0x2c631a[_0x0a44('0x9')]['length'];_0x535360+=0x1){if(_0x2c631a[_0x0a44('0x9')][_0x535360]['address']!==_0x2ecb1a){if(!_[_0x0a44('0x16')](_0x598ebb)){_0x598ebb+=',';}_0x598ebb+=_0x2c631a[_0x0a44('0x9')][_0x535360][_0x0a44('0xe')]||_0x2c631a[_0x0a44('0x9')][_0x535360][_0x0a44('0xa')]||'';_0x598ebb+='\x20<';_0x598ebb+=_0x2c631a['value'][_0x535360][_0x0a44('0xa')]?_0x2c631a['value'][_0x535360][_0x0a44('0xa')]:'anonymous'+random[_0x0a44('0xc')](0x6)+_0x0a44('0xd');_0x598ebb+='>';}}return _0x598ebb;}function parseEmail(_0x18a9ee,_0x476461,_0x44c9b7){if(_0x476461[_0x0a44('0x17')]){var _0x243ae7=/)<[^<]*)*<\/script>/gi;while(_0x243ae7[_0x0a44('0x18')](_0x476461[_0x0a44('0x17')])){_0x476461['html']=_0x476461['html']['replace'](_0x243ae7,'');}if(_0x476461['html'][_0x0a44('0x19')](_0x0a44('0x1a'))){var _0x300141=[];_0x476461['attachments']['forEach'](_0x272f97=>{_0x300141['push'](_0x272f97['filename']);});var _0x42d0f9=/]+>/g;var _0x2c6a44=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5a8cab=_0x476461[_0x0a44('0x17')][_0x0a44('0x1b')](_0x2c6a44,_0x0a44('0x1c'));var _0x3e9bd4=_0x5a8cab[_0x0a44('0x1b')](_0x42d0f9,_0x0a44('0x1d'));for(let _0xdf29f5=0x0;_0xdf29f5<_0x300141[_0x0a44('0x11')];_0xdf29f5++){var _0x305266=_0x3e9bd4[_0x0a44('0x1b')](_0x0a44('0x1d'),_0x0a44('0x1e')+_0x300141[_0xdf29f5]+'\x20]');_0x3e9bd4=_0x305266;}_0x476461[_0x0a44('0x17')]=_0x3e9bd4;}_0x44c9b7[_0x0a44('0x1f')]=_0x476461[_0x0a44('0x17')];}else{_0x44c9b7[_0x0a44('0x1f')]=_0x476461['textAsHtml'];}if(_0x44c9b7[_0x0a44('0x1f')]){_0x44c9b7[_0x0a44('0x1f')]=_0x44c9b7[_0x0a44('0x1f')][_0x0a44('0x1b')](/0x0){var _0x4da90b=[_0x0a44('0x34'),_0x0a44('0x35'),_0x0a44('0x36')];for(var _0x85004=0x0;_0x85004<_0x476461['headerLines']['length'];_0x85004++){var _0x51023a=_[_0x0a44('0x37')](_0x4da90b,_0x476461[_0x0a44('0x33')][_0x85004][_0x0a44('0x38')]);if(_0x51023a>=0x0){_0x44c9b7[_0x0a44('0x39')]=!![];}}}return _0x44c9b7;}exports[_0x0a44('0x3a')]=function(_0x184670,_0x4a2e14,_0x51ceb0){var _0x3032e3={'from':getAddress(_0x4a2e14[_0x0a44('0x3b')]),'firstName':getFirstName(_0x4a2e14['from']),'lastName':getLastName(_0x4a2e14[_0x0a44('0x3b')]),'mapKey':_0x0a44('0x6'),'message':{'from':getMails(_0x184670[_0x0a44('0x6')],_0x4a2e14[_0x0a44('0x3b')]),'to':_0x184670[_0x0a44('0x6')],'cc':'','subject':_0x4a2e14[_0x0a44('0x3c')]||'','messageId':_0x4a2e14[_0x0a44('0x3d')],'inReplyTo':_0x4a2e14['inReplyTo'],'sentAt':moment(_0x4a2e14[_0x0a44('0x3e')])[_0x0a44('0x2a')](_0x0a44('0x3f')),'attach':![],'attachments':[]}};if(!_0x4a2e14[_0x0a44('0x17')]&&!_0x4a2e14[_0x0a44('0x40')]){var _0x2d3fd=_[_0x0a44('0x41')](_0x4a2e14['attachments'],{'contentType':_0x0a44('0x42')});if(_0x2d3fd[_0x0a44('0x11')]){logger['info'](util[_0x0a44('0x2a')](_0x0a44('0x43'),_0x4a2e14[_0x0a44('0x3d')]));tnef['parseBuffer'](_[_0x0a44('0x44')](_0x2d3fd)[_0x0a44('0x30')],function(_0x32a075,_0x2d2bbe){if(_0x2d2bbe){_0x4a2e14[_0x0a44('0x17')]=_0x2d2bbe['BodyHTML']||_0x0a44('0x45');if(_0x2d2bbe[_0x0a44('0x46')]){for(var _0x2a640c=0x0;_0x2a640c<_0x2d2bbe[_0x0a44('0x46')]['length'];_0x2a640c++){var _0x327a55=_0x2d2bbe[_0x0a44('0x46')][_0x2a640c];_0x3032e3[_0x0a44('0x21')][_0x0a44('0x25')][_0x0a44('0x31')]({'filename':_0x327a55[_0x0a44('0x47')],'content':Buffer[_0x0a44('0x3b')](_0x327a55[_0x0a44('0x48')])});}}}_0x51ceb0(parseEmail(_0x184670,_0x4a2e14,_0x3032e3));});}else{_0x4a2e14[_0x0a44('0x17')]=_0x0a44('0x45');_0x51ceb0(parseEmail(_0x184670,_0x4a2e14,_0x3032e3));}}else{_0x51ceb0(parseEmail(_0x184670,_0x4a2e14,_0x3032e3));}};exports[_0x0a44('0x49')]=function(_0x7b16a2,_0x2de91a){var _0x19ccba=['user='+(_0x2de91a||''),_0x0a44('0x4a')+_0x7b16a2,'',''];return Buffer[_0x0a44('0x3b')](_0x19ccba[_0x0a44('0x13')](''),_0x0a44('0x4b'))[_0x0a44('0x4c')](_0x0a44('0x4d'));}; \ No newline at end of file +var _0x5f62=['@xcally.com','html','test','replace','includes','attachments','push','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Title','Data','user=','auth=Bearer\x20','utf-8','toString','lodash','moment','util','node-tnef','../../../config/logger','../../../config/environment','head','address','anonymous','value','name','substring','indexOf','split','slice','join','Anonymous','length','pop','isEmpty','generate'];(function(_0x105d04,_0x228fca){var _0xa52630=function(_0x1f4087){while(--_0x1f4087){_0x105d04['push'](_0x105d04['shift']());}};_0xa52630(++_0x228fca);}(_0x5f62,0x7b));var _0x25f6=function(_0x236c13,_0x50cc9f){_0x236c13=_0x236c13-0x0;var _0x35aa66=_0x5f62[_0x236c13];return _0x35aa66;};'use strict';var _=require(_0x25f6('0x0'));var moment=require(_0x25f6('0x1'));var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require(_0x25f6('0x2'));var tnef=require(_0x25f6('0x3'));var logger=require(_0x25f6('0x4'))('email');var config=require(_0x25f6('0x5'));function getAddress(_0x58d97c){var _0x4201dc=_[_0x25f6('0x6')](_0x58d97c['value']);return _0x4201dc&&_0x4201dc[_0x25f6('0x7')]?_0x4201dc[_0x25f6('0x7')]:_0x25f6('0x8')+random['generate'](0x6)+'@xcally.com';}function getFirstName(_0x37f4f2){var _0x5258ba=_['head'](_0x37f4f2[_0x25f6('0x9')]);if(_0x5258ba&&_0x5258ba[_0x25f6('0xa')]){if(_0x5258ba[_0x25f6('0xa')]==_0x5258ba[_0x25f6('0x7')]){return _0x5258ba[_0x25f6('0xa')][_0x25f6('0xb')](0x0,_0x5258ba['name'][_0x25f6('0xc')]('@'));}var _0x3ebdcb=_0x5258ba[_0x25f6('0xa')][_0x25f6('0xd')](/\s+/);return _0x3ebdcb['length']>0x1?_0x3ebdcb[_0x25f6('0xe')](0x0,-0x1)[_0x25f6('0xf')]('\x20'):_0x5258ba['name'];}return _0x25f6('0x10');}function getLastName(_0x28503d){var _0x5076b9=_[_0x25f6('0x6')](_0x28503d[_0x25f6('0x9')]);if(_0x5076b9&&_0x5076b9[_0x25f6('0xa')]){var _0x30db8e=_0x5076b9[_0x25f6('0xa')][_0x25f6('0xd')](/\s+/);return _0x30db8e[_0x25f6('0x11')]>0x1?_0x30db8e[_0x25f6('0x12')]():'';}return'';}function getMails(_0x25f309,_0x21d580){var _0x2ef820='';for(var _0x485429=0x0;_0x485429<_0x21d580[_0x25f6('0x9')][_0x25f6('0x11')];_0x485429+=0x1){if(_0x21d580['value'][_0x485429][_0x25f6('0x7')]!==_0x25f309){if(!_[_0x25f6('0x13')](_0x2ef820)){_0x2ef820+=',';}_0x2ef820+=_0x21d580[_0x25f6('0x9')][_0x485429]['name']||_0x21d580[_0x25f6('0x9')][_0x485429][_0x25f6('0x7')]||'';_0x2ef820+='\x20<';_0x2ef820+=_0x21d580[_0x25f6('0x9')][_0x485429][_0x25f6('0x7')]?_0x21d580[_0x25f6('0x9')][_0x485429][_0x25f6('0x7')]:_0x25f6('0x8')+random[_0x25f6('0x14')](0x6)+_0x25f6('0x15');_0x2ef820+='>';}}return _0x2ef820;}function parseEmail(_0x262b59,_0x540175,_0xe9a10e){if(_0x540175[_0x25f6('0x16')]){var _0x907826=/)<[^<]*)*<\/script>/gi;while(_0x907826[_0x25f6('0x17')](_0x540175[_0x25f6('0x16')])){_0x540175[_0x25f6('0x16')]=_0x540175[_0x25f6('0x16')][_0x25f6('0x18')](_0x907826,'');}if(_0x540175[_0x25f6('0x16')][_0x25f6('0x19')]('{_0x2c8630[_0x25f6('0x1b')](_0x18ed5d[_0x25f6('0x1c')]);});var _0x1b2105=/]+>/g;var _0x44f8ea=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x296a87=_0x540175['html'][_0x25f6('0x18')](_0x44f8ea,_0x25f6('0x1d'));var _0x43240a=_0x296a87[_0x25f6('0x18')](_0x1b2105,_0x25f6('0x1e'));for(let _0x37da17=0x0;_0x37da17<_0x2c8630[_0x25f6('0x11')];_0x37da17++){var _0x374051=_0x43240a['replace'](_0x25f6('0x1e'),_0x25f6('0x1f')+_0x2c8630[_0x37da17]+_0x25f6('0x20'));_0x43240a=_0x374051;}_0x540175[_0x25f6('0x16')]=_0x43240a;}_0xe9a10e['body']=_0x540175[_0x25f6('0x16')];}else{_0xe9a10e[_0x25f6('0x21')]=_0x540175[_0x25f6('0x22')];}if(_0xe9a10e[_0x25f6('0x21')]){_0xe9a10e[_0x25f6('0x21')]=_0xe9a10e[_0x25f6('0x21')][_0x25f6('0x18')](/0x0){var _0x5a5bb3=[_0x25f6('0x33'),_0x25f6('0x34'),_0x25f6('0x35')];for(var _0x192f70=0x0;_0x192f70<_0x540175[_0x25f6('0x32')]['length'];_0x192f70++){var _0x45e90a=_[_0x25f6('0xc')](_0x5a5bb3,_0x540175[_0x25f6('0x32')][_0x192f70]['line']);if(_0x45e90a>=0x0){_0xe9a10e[_0x25f6('0x36')]=!![];}}}return _0xe9a10e;}exports[_0x25f6('0x37')]=function(_0x2ea40a,_0x5150ca,_0x402c3f){var _0x209a8a={'from':getAddress(_0x5150ca[_0x25f6('0x38')]),'firstName':getFirstName(_0x5150ca[_0x25f6('0x38')]),'lastName':getLastName(_0x5150ca['from']),'mapKey':_0x25f6('0x25'),'message':{'from':getMails(_0x2ea40a[_0x25f6('0x25')],_0x5150ca[_0x25f6('0x38')]),'to':_0x2ea40a[_0x25f6('0x25')],'cc':'','subject':_0x5150ca[_0x25f6('0x39')]||'','messageId':_0x5150ca[_0x25f6('0x3a')],'inReplyTo':_0x5150ca[_0x25f6('0x3b')],'sentAt':moment(_0x5150ca['date'])[_0x25f6('0x3c')](_0x25f6('0x3d')),'attach':![],'attachments':[]}};if(!_0x5150ca['html']&&!_0x5150ca[_0x25f6('0x22')]){var _0x215d5a=_[_0x25f6('0x3e')](_0x5150ca[_0x25f6('0x1a')],{'contentType':'application/ms-tnef'});if(_0x215d5a['length']){logger[_0x25f6('0x3f')](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x5150ca[_0x25f6('0x3a')]));tnef['parseBuffer'](_[_0x25f6('0x40')](_0x215d5a)[_0x25f6('0x30')],function(_0x282beb,_0x4c5363){if(_0x4c5363){_0x5150ca[_0x25f6('0x16')]=_0x4c5363['BodyHTML']||_0x25f6('0x41');if(_0x4c5363['Attachments']){for(var _0x2b1a1c=0x0;_0x2b1a1c<_0x4c5363['Attachments']['length'];_0x2b1a1c++){var _0x38dd12=_0x4c5363['Attachments'][_0x2b1a1c];_0x209a8a[_0x25f6('0x26')][_0x25f6('0x1a')][_0x25f6('0x1b')]({'filename':_0x38dd12[_0x25f6('0x42')],'content':Buffer[_0x25f6('0x38')](_0x38dd12[_0x25f6('0x43')])});}}}_0x402c3f(parseEmail(_0x2ea40a,_0x5150ca,_0x209a8a));});}else{_0x5150ca[_0x25f6('0x16')]=_0x25f6('0x41');_0x402c3f(parseEmail(_0x2ea40a,_0x5150ca,_0x209a8a));}}else{_0x402c3f(parseEmail(_0x2ea40a,_0x5150ca,_0x209a8a));}};exports['generateXOAuth2Token']=function(_0x48f2bb,_0x525238){var _0x32dab3=[_0x25f6('0x44')+(_0x525238||''),_0x25f6('0x45')+_0x48f2bb,'',''];return Buffer[_0x25f6('0x38')](_0x32dab3[_0x25f6('0xf')](''),_0x25f6('0x46'))[_0x25f6('0x47')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index b8506fc..4d2016c 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 _0x0c88=['active','Imap','Smtp','Service','key','SERV'];(function(_0x4ceb3b,_0x5f474c){var _0x513705=function(_0x21bef8){while(--_0x21bef8){_0x4ceb3b['push'](_0x4ceb3b['shift']());}};_0x513705(++_0x5f474c);}(_0x0c88,0x81));var _0x80c8=function(_0x14a513,_0x3239f){_0x14a513=_0x14a513-0x0;var _0x47236c=_0x0c88[_0x14a513];return _0x47236c;};'use strict';var _=require('lodash');function MailAccount(_0x135b94){this['id']=_0x135b94['id']||0x0;this['name']=_0x135b94['name']||_0x80c8('0x0');this[_0x80c8('0x1')]=_0x135b94[_0x80c8('0x1')]||_0x80c8('0x2');this[_0x80c8('0x3')]=_0x135b94[_0x80c8('0x3')]||![];this[_0x80c8('0x4')]=_0x135b94[_0x80c8('0x4')]||[];this['Smtp']=_0x135b94[_0x80c8('0x5')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0xf075=['Service','key','SERV','active','Imap','Smtp','exports','lodash','name'];(function(_0x7ba1c3,_0x3dd545){var _0x82b393=function(_0x1550ce){while(--_0x1550ce){_0x7ba1c3['push'](_0x7ba1c3['shift']());}};_0x82b393(++_0x3dd545);}(_0xf075,0x166));var _0x5f07=function(_0x3d965a,_0x11f928){_0x3d965a=_0x3d965a-0x0;var _0x3ea917=_0xf075[_0x3d965a];return _0x3ea917;};'use strict';var _=require(_0x5f07('0x0'));function MailAccount(_0x13ea71){this['id']=_0x13ea71['id']||0x0;this[_0x5f07('0x1')]=_0x13ea71[_0x5f07('0x1')]||_0x5f07('0x2');this[_0x5f07('0x3')]=_0x13ea71[_0x5f07('0x3')]||_0x5f07('0x4');this[_0x5f07('0x5')]=_0x13ea71[_0x5f07('0x5')]||![];this[_0x5f07('0x6')]=_0x13ea71[_0x5f07('0x6')]||[];this[_0x5f07('0x7')]=_0x13ea71[_0x5f07('0x7')]||[];}module[_0x5f07('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 2ecc410..6cb81e9 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 _0x660c=['lodash','../model/mailAccount','hasOwnProperty','mailAccounts','isUndefined','merge','exports'];(function(_0x310a1b,_0x4c9129){var _0xdea206=function(_0x1f1e8d){while(--_0x1f1e8d){_0x310a1b['push'](_0x310a1b['shift']());}};_0xdea206(++_0x4c9129);}(_0x660c,0x150));var _0xc660=function(_0x424db8,_0x53f4f8){_0x424db8=_0x424db8-0x0;var _0x14e049=_0x660c[_0x424db8];return _0x14e049;};'use strict';var _=require(_0xc660('0x0'));var MailAccount=require(_0xc660('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x504a3c,_0xfeaab5,_0x45905a){var _0x11981d=_['mapKeys'](_0x504a3c,function(_0x4e633d,_0x412792){return _0x4e633d[_0x45905a];});for(var _0x564f35 in _0xfeaab5){if(_0xfeaab5['hasOwnProperty'](_0x564f35)){if(!_0x11981d[_0x564f35]){delete _0xfeaab5[_0x564f35];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x424d61,_0x549c9d){for(var _0x512941 in _0x549c9d){if(_0x424d61[_0xc660('0x2')](_0x512941)){_0x424d61[_0x512941]=_0x549c9d[_0x512941];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x1cc4b2=this;return function(_0xcd2cf9){if(_0xcd2cf9){freeIsNotKey(_0xcd2cf9,_0x1cc4b2[_0xc660('0x3')],'id');for(var _0x40c405=0x0,_0x5273e8={},_0x5b238a={};_0x40c405<_0xcd2cf9['length'];_0x40c405+=0x1){_0x5273e8=_0xcd2cf9[_0x40c405];if(_[_0xc660('0x4')](_0x1cc4b2[_0xc660('0x3')][_0x5273e8['id']])){_0x1cc4b2[_0xc660('0x3')][_0x5273e8['id']]=new MailAccount(_0x5273e8);}else{_[_0xc660('0x5')](_0x1cc4b2[_0xc660('0x3')][_0x5273e8['id']],_0x5273e8);}}}return _0x1cc4b2[_0xc660('0x3')];};};module[_0xc660('0x6')]=Realtime; \ No newline at end of file +var _0x74ed=['prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','mailAccounts','length','isUndefined','../model/mailAccount','mapKeys'];(function(_0x51ea93,_0x394bdb){var _0x1de85b=function(_0x81d557){while(--_0x81d557){_0x51ea93['push'](_0x51ea93['shift']());}};_0x1de85b(++_0x394bdb);}(_0x74ed,0x1db));var _0xd74e=function(_0x3a3c83,_0x1da4b4){_0x3a3c83=_0x3a3c83-0x0;var _0x21cf42=_0x74ed[_0x3a3c83];return _0x21cf42;};'use strict';var _=require('lodash');var MailAccount=require(_0xd74e('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x5f3293,_0x5a0349,_0x5ea127){var _0x52118a=_[_0xd74e('0x1')](_0x5f3293,function(_0x44da18,_0x365262){return _0x44da18[_0x5ea127];});for(var _0xd9b4d9 in _0x5a0349){if(_0x5a0349['hasOwnProperty'](_0xd9b4d9)){if(!_0x52118a[_0xd9b4d9]){delete _0x5a0349[_0xd9b4d9];}}}}Realtime[_0xd74e('0x2')][_0xd74e('0x3')]=function(_0x2b3b3f,_0x36f79c){for(var _0x1a2226 in _0x36f79c){if(_0x2b3b3f[_0xd74e('0x4')](_0x1a2226)){_0x2b3b3f[_0x1a2226]=_0x36f79c[_0x1a2226];}}};Realtime[_0xd74e('0x2')][_0xd74e('0x5')]=function(){var _0xb749d5=this;return function(_0x2b921e){if(_0x2b921e){freeIsNotKey(_0x2b921e,_0xb749d5[_0xd74e('0x6')],'id');for(var _0x24a00d=0x0,_0x3c490a={},_0x1b3218={};_0x24a00d<_0x2b921e[_0xd74e('0x7')];_0x24a00d+=0x1){_0x3c490a=_0x2b921e[_0x24a00d];if(_[_0xd74e('0x8')](_0xb749d5[_0xd74e('0x6')][_0x3c490a['id']])){_0xb749d5[_0xd74e('0x6')][_0x3c490a['id']]=new MailAccount(_0x3c490a);}else{_['merge'](_0xb749d5[_0xd74e('0x6')][_0x3c490a['id']],_0x3c490a);}}}return _0xb749d5['mailAccounts'];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index d394f62..f28507e 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 _0x3914=['name','service','email','active','ListId','TemplateId','Imap','type','data5','Smtp','CloudProvider','getMailAccount','Request','NotifyMailAccount','../client','getMailAccounts','GetMailAccount'];(function(_0x476874,_0x105888){var _0x42c9aa=function(_0x123cbe){while(--_0x123cbe){_0x476874['push'](_0x476874['shift']());}};_0x42c9aa(++_0x105888);}(_0x3914,0xeb));var _0x4391=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0x3914[_0x3e69ae];return _0x3d7f42;};'use strict';var client=require(_0x4391('0x0'));exports[_0x4391('0x1')]=function(){return function(){return client['Request'](_0x4391('0x2'),{'options':{'attributes':['id',_0x4391('0x3'),'provider',_0x4391('0x4'),_0x4391('0x5'),_0x4391('0x6'),'key',_0x4391('0x7'),_0x4391('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':_0x4391('0x9'),'include':[{'model':'CloudProvider','attributes':['id',_0x4391('0x3'),'service',_0x4391('0xa'),_0x4391('0xb')],'as':'CloudProvider'}]},{'model':'MailServerOut','as':_0x4391('0xc'),'include':[{'model':_0x4391('0xd'),'attributes':['id',_0x4391('0x3'),'service',_0x4391('0xa'),_0x4391('0xb')],'as':_0x4391('0xd')}]}]},'log':_0x4391('0xe')});};};exports['notify']=function(_0x144ce3,_0x1e3786){return client[_0x4391('0xf')](_0x4391('0x10'),{'account':{'id':_0x144ce3},'body':_0x1e3786,'log':_0x4391('0x10')});}; \ No newline at end of file +var _0xf06c=['TemplateId','MailServerIn','CloudProvider','Smtp','data5','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','service','email','active','ListId'];(function(_0x3c3ca4,_0x95772a){var _0x3fcd8d=function(_0x1f1224){while(--_0x1f1224){_0x3c3ca4['push'](_0x3c3ca4['shift']());}};_0x3fcd8d(++_0x95772a);}(_0xf06c,0xc7));var _0xcf06=function(_0x3ca784,_0x23816d){_0x3ca784=_0x3ca784-0x0;var _0x6f8e7=_0xf06c[_0x3ca784];return _0x6f8e7;};'use strict';var client=require(_0xcf06('0x0'));exports[_0xcf06('0x1')]=function(){return function(){return client[_0xcf06('0x2')](_0xcf06('0x3'),{'options':{'attributes':['id',_0xcf06('0x4'),'provider',_0xcf06('0x5'),_0xcf06('0x6'),_0xcf06('0x7'),'key',_0xcf06('0x8'),_0xcf06('0x9')],'raw':![],'include':[{'model':_0xcf06('0xa'),'as':'Imap','include':[{'model':_0xcf06('0xb'),'attributes':['id','name',_0xcf06('0x5'),'type','data5'],'as':'CloudProvider'}]},{'model':'MailServerOut','as':_0xcf06('0xc'),'include':[{'model':_0xcf06('0xb'),'attributes':['id',_0xcf06('0x4'),'service','type',_0xcf06('0xd')],'as':'CloudProvider'}]}]},'log':_0xcf06('0xe')});};};exports['notify']=function(_0x3cd30c,_0x56d71f){return client[_0xcf06('0x2')](_0xcf06('0xf'),{'account':{'id':_0x3cd30c},'body':_0x56d71f,'log':_0xcf06('0xf')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index d92fecf..f933437 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 _0x70bb=['../client','getSettings','Request','ShowSetting','GetSettings'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x70bb,0xcd));var _0xb70b=function(_0x2d2498,_0x26426d){_0x2d2498=_0x2d2498-0x0;var _0x447a5b=_0x70bb[_0x2d2498];return _0x447a5b;};'use strict';var client=require(_0xb70b('0x0'));exports[_0xb70b('0x1')]=function(){return client[_0xb70b('0x2')](_0xb70b('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xb70b('0x4')});}; \ No newline at end of file +var _0xb818=['../client','getSettings','GetSettings'];(function(_0x4cb997,_0x3adf4e){var _0x59af8c=function(_0x426ff0){while(--_0x426ff0){_0x4cb997['push'](_0x4cb997['shift']());}};_0x59af8c(++_0x3adf4e);}(_0xb818,0xe7));var _0x8b81=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xb818[_0x263a74];return _0x2aa86c;};'use strict';var client=require(_0x8b81('0x0'));exports[_0x8b81('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x8b81('0x2')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 8e82f63..99c8af4 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(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index c10699f..b8e68d5 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 _0x7739=['polling','redis','defaults','localhost','socket.io-redis','default','../../config/socketio','../../routes','log','lodash','express','sticky-session','ioredis','../../config/environment','createServer','listen','port','socket.io'];(function(_0x2340c9,_0x1b5965){var _0x35e206=function(_0x37f6cf){while(--_0x37f6cf){_0x2340c9['push'](_0x2340c9['shift']());}};_0x35e206(++_0x1b5965);}(_0x7739,0x14d));var _0x9773=function(_0x1bcc54,_0x26f81f){_0x1bcc54=_0x1bcc54-0x0;var _0x4fadf4=_0x7739[_0x1bcc54];return _0x4fadf4;};'use strict';var _=require(_0x9773('0x0'));var http=require('http');var express=require(_0x9773('0x1'));var sticky=require(_0x9773('0x2'));var Redis=require(_0x9773('0x3'));var config=require(_0x9773('0x4'));var app=express();var server=http[_0x9773('0x5')](app);server['timeout']=0xdbba0;if(sticky[_0x9773('0x6')](server,config[_0x9773('0x7')])){var socketio=require(_0x9773('0x8'))(server,{'transports':['websocket',_0x9773('0x9')]});config[_0x9773('0xa')]=_[_0x9773('0xb')](config[_0x9773('0xa')],{'host':_0x9773('0xc'),'port':0x18eb});socketio['adapter'](require(_0x9773('0xd'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require('../../config/triggers')[_0x9773('0xe')]();require(_0x9773('0xf'))['default'](socketio);require('../../config/express')['default'](app);require(_0x9773('0x10'))[_0x9773('0xe')](app);}else{server['once']('listening',function(){console[_0x9773('0x11')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x9773('0x7')]);});}exports=module['exports']=app; \ No newline at end of file +var _0x08c1=['../../config/express','../../routes','log','exports','http','express','sticky-session','ioredis','../../config/environment','timeout','listen','port','socket.io','polling','redis','defaults','localhost','adapter','../../config/triggers','../../config/socketio','default'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x08c1,0x17e));var _0x108c=function(_0x2dab6b,_0x3dbb2b){_0x2dab6b=_0x2dab6b-0x0;var _0x40cc21=_0x08c1[_0x2dab6b];return _0x40cc21;};'use strict';var _=require('lodash');var http=require(_0x108c('0x0'));var express=require(_0x108c('0x1'));var sticky=require(_0x108c('0x2'));var Redis=require(_0x108c('0x3'));var config=require(_0x108c('0x4'));var app=express();var server=http['createServer'](app);server[_0x108c('0x5')]=0xdbba0;if(sticky[_0x108c('0x6')](server,config[_0x108c('0x7')])){var socketio=require(_0x108c('0x8'))(server,{'transports':['websocket',_0x108c('0x9')]});config[_0x108c('0xa')]=_[_0x108c('0xb')](config[_0x108c('0xa')],{'host':_0x108c('0xc'),'port':0x18eb});socketio[_0x108c('0xd')](require('socket.io-redis')({'pubClient':new Redis(config[_0x108c('0xa')]),'subClient':new Redis(config[_0x108c('0xa')])}));require(_0x108c('0xe'))['default']();require(_0x108c('0xf'))[_0x108c('0x10')](socketio);require(_0x108c('0x11'))[_0x108c('0x10')](app);require(_0x108c('0x12'))[_0x108c('0x10')](app);}else{server['once']('listening',function(){console[_0x108c('0x13')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x108c('0x7')]);});}exports=module[_0x108c('0x14')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 4032141..9231664 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 _0x591c=['routing','client','http','Request','request','then','debug','rpc','error','message','result','catch','exports','bluebird'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x591c,0xed));var _0xc591=function(_0x17fe0c,_0x4d5eee){_0x17fe0c=_0x17fe0c-0x0;var _0x487a19=_0x591c[_0x17fe0c];return _0x487a19;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xc591('0x0'));var logger=require('../../config/logger')(_0xc591('0x1'));var client=jayson[_0xc591('0x2')][_0xc591('0x3')]({'port':0x2329});client[_0xc591('0x4')]=function(_0xb38523,_0x180585){return new BPromise(function(_0x4bfafa,_0x3e54e3){return client[_0xc591('0x5')](_0xb38523,_0x180585)[_0xc591('0x6')](function(_0x1fb5c7){logger[_0xc591('0x7')](_0xc591('0x8'),_0xc591('0x1'),_0xb38523,_0x180585,_0x1fb5c7);if(_0x1fb5c7[_0xc591('0x9')]){logger[_0xc591('0x9')](_0xc591('0x8'),_0xc591('0x1'),_0xb38523,_0x1fb5c7[_0xc591('0x9')][_0xc591('0xa')],_0x180585);return _0x3e54e3(_0x1fb5c7[_0xc591('0x9')][_0xc591('0xa')]);}else{return _0x4bfafa(_0x1fb5c7[_0xc591('0xb')]);}})[_0xc591('0xc')](function(_0x5ee2d6){logger[_0xc591('0x9')](_0xc591('0x8'),_0xc591('0x1'),_0xb38523,_0x5ee2d6,_0x180585);return _0x3e54e3(_0x5ee2d6);});});};module[_0xc591('0xd')]=client; \ No newline at end of file +var _0x42c0=['debug','rpc','error','routing','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then'];(function(_0x2c6a90,_0x4276c8){var _0x15e053=function(_0x3b1988){while(--_0x3b1988){_0x2c6a90['push'](_0x2c6a90['shift']());}};_0x15e053(++_0x4276c8);}(_0x42c0,0x68));var _0x042c=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x42c0[_0x25e7cb];return _0x375d92;};'use strict';var jayson=require(_0x042c('0x0'));var BPromise=require(_0x042c('0x1'));var logger=require(_0x042c('0x2'))('routing');var client=jayson[_0x042c('0x3')][_0x042c('0x4')]({'port':0x2329});client[_0x042c('0x5')]=function(_0x52454a,_0x10d9d4){return new BPromise(function(_0x381bfd,_0x5b4796){return client[_0x042c('0x6')](_0x52454a,_0x10d9d4)[_0x042c('0x7')](function(_0x45f91d){logger[_0x042c('0x8')](_0x042c('0x9'),'routing',_0x52454a,_0x10d9d4,_0x45f91d);if(_0x45f91d[_0x042c('0xa')]){logger['error']('rpc',_0x042c('0xb'),_0x52454a,_0x45f91d[_0x042c('0xa')]['message'],_0x10d9d4);return _0x5b4796(_0x45f91d[_0x042c('0xa')][_0x042c('0xc')]);}else{return _0x381bfd(_0x45f91d[_0x042c('0xd')]);}})[_0x042c('0xe')](function(_0x3b6ed6){logger[_0x042c('0xa')](_0x042c('0x9'),'routing',_0x52454a,_0x3b6ed6,_0x10d9d4);return _0x5b4796(_0x3b6ed6);});});};module[_0x042c('0xf')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 914ee15..3c84700 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 _0x5b87=['listen','catch','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','resolve','then','getAgents','initIntervals','getOpenchannelQueues','getChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues'];(function(_0x547b5e,_0x1f8cfb){var _0x19a52f=function(_0x200c84){while(--_0x200c84){_0x547b5e['push'](_0x547b5e['shift']());}};_0x19a52f(++_0x1f8cfb);}(_0x5b87,0x179));var _0x75b8=function(_0x1d2c9a,_0x5d9e0a){_0x1d2c9a=_0x1d2c9a-0x0;var _0x2b1755=_0x5b87[_0x1d2c9a];return _0x2b1755;};'use strict';var BPromise=require('bluebird');var server=require(_0x75b8('0x0'));var Realtime=require(_0x75b8('0x1'));var user=require(_0x75b8('0x2'));var interval=require(_0x75b8('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x75b8('0x4'));var smsQueue=require(_0x75b8('0x5'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x75b8('0x6'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x75b8('0x7')]()[_0x75b8('0x8')](user[_0x75b8('0x9')]())[_0x75b8('0x8')](realtime['initAgents']())[_0x75b8('0x8')](interval['getIntervals']())['then'](realtime[_0x75b8('0xa')]())['then'](openchannelQueue[_0x75b8('0xb')]())['then'](realtime['initOpenchannelQueues']())[_0x75b8('0x8')](chatQueue[_0x75b8('0xc')]())[_0x75b8('0x8')](realtime['initChatQueues']())[_0x75b8('0x8')](smsQueue['getSmsQueues']())[_0x75b8('0x8')](realtime[_0x75b8('0xd')]())['then'](mailQueue[_0x75b8('0xe')]())[_0x75b8('0x8')](realtime[_0x75b8('0xf')]())[_0x75b8('0x8')](faxQueue[_0x75b8('0x10')]())[_0x75b8('0x8')](realtime[_0x75b8('0x11')]())[_0x75b8('0x8')](whatsappQueue['getWhatsappQueues']())[_0x75b8('0x8')](realtime[_0x75b8('0x12')]())['then'](function(){return realtime;});}function main(){return server[_0x75b8('0x13')](realtime)[_0x75b8('0x8')](function(_0x2b933e){return initRealtime();})[_0x75b8('0x8')](function(_0x13ccf6){return setInterval(initRealtime,0x1388);})[_0x75b8('0x14')](function(_0x37b72f){console[_0x75b8('0x15')](_0x37b72f);});}main(); \ No newline at end of file +var _0x6a75=['resolve','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','catch','log','bluebird','./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x6a75,0x1e5));var _0x56a7=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x6a75[_0x1d24eb];return _0x1dc576;};'use strict';var BPromise=require(_0x56a7('0x0'));var server=require(_0x56a7('0x1'));var Realtime=require(_0x56a7('0x2'));var user=require('./rpc/user');var interval=require(_0x56a7('0x3'));var openchannelQueue=require(_0x56a7('0x4'));var chatQueue=require(_0x56a7('0x5'));var smsQueue=require(_0x56a7('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x56a7('0x7'));var whatsappQueue=require(_0x56a7('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x56a7('0x9')]()[_0x56a7('0xa')](user['getAgents']())['then'](realtime[_0x56a7('0xb')]())[_0x56a7('0xa')](interval[_0x56a7('0xc')]())['then'](realtime[_0x56a7('0xd')]())[_0x56a7('0xa')](openchannelQueue[_0x56a7('0xe')]())[_0x56a7('0xa')](realtime[_0x56a7('0xf')]())[_0x56a7('0xa')](chatQueue['getChatQueues']())[_0x56a7('0xa')](realtime[_0x56a7('0x10')]())[_0x56a7('0xa')](smsQueue[_0x56a7('0x11')]())[_0x56a7('0xa')](realtime[_0x56a7('0x12')]())[_0x56a7('0xa')](mailQueue[_0x56a7('0x13')]())[_0x56a7('0xa')](realtime[_0x56a7('0x14')]())[_0x56a7('0xa')](faxQueue[_0x56a7('0x15')]())['then'](realtime[_0x56a7('0x16')]())['then'](whatsappQueue['getWhatsappQueues']())['then'](realtime[_0x56a7('0x17')]())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x56a7('0xa')](function(_0x31600a){return initRealtime();})[_0x56a7('0xa')](function(_0x39f921){return setInterval(initRealtime,0x1388);})[_0x56a7('0x18')](function(_0x697e0f){console[_0x56a7('0x19')](_0x697e0f);});}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 6a2763f..e0e7a66 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 _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x52b0f9,_0x33340f){var _0x14f299=function(_0x14d812){while(--_0x14d812){_0x52b0f9['push'](_0x52b0f9['shift']());}};_0x14f299(++_0x33340f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xc4aa[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x375734,_0x1ac10d){var _0x3a4f81=function(_0x46231e){while(--_0x46231e){_0x375734['push'](_0x375734['shift']());}};_0x3a4f81(++_0x1ac10d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xc4aa[_0x209941];return _0x1e8729;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 5e82be1..e7fedb8 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 _0x0791=['request','then','error','message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','http'];(function(_0x471995,_0x49196a){var _0x363c1c=function(_0x47a62d){while(--_0x47a62d){_0x471995['push'](_0x471995['shift']());}};_0x363c1c(++_0x49196a);}(_0x0791,0x97));var _0x1079=function(_0x3b2369,_0x4c68b9){_0x3b2369=_0x3b2369-0x0;var _0x5a1367=_0x0791[_0x3b2369];return _0x5a1367;};'use strict';var BPromise=require(_0x1079('0x0'));var jayson=require(_0x1079('0x1'));var client=jayson['client'][_0x1079('0x2')]({'port':0x232b});function request(_0x2d9fcc,_0x29bbb0){return new BPromise(function(_0x3e0725,_0x1a0cfa){return client[_0x1079('0x3')](_0x2d9fcc,_0x29bbb0)[_0x1079('0x4')](function(_0x5a667e){if(_0x5a667e['error']){return _0x1a0cfa(_0x5a667e[_0x1079('0x5')][_0x1079('0x6')]);}else{return _0x3e0725(_0x5a667e[_0x1079('0x7')]);}})[_0x1079('0x8')](function(_0x4e24a6){return _0x1a0cfa(_0x4e24a6);});});}exports[_0x1079('0x9')]=function(_0x5d3e20,_0x4f0cd6){return request(_0x1079('0xa'),{'account':_0x5d3e20,'message':_0x4f0cd6});}; \ No newline at end of file +var _0xbd44=['client','http','error','message','catch','sendMailMessage','SendMail'];(function(_0x389c88,_0x46d30a){var _0x32b899=function(_0x2b70f2){while(--_0x2b70f2){_0x389c88['push'](_0x389c88['shift']());}};_0x32b899(++_0x46d30a);}(_0xbd44,0xcb));var _0x4bd4=function(_0x2aac62,_0x3699b2){_0x2aac62=_0x2aac62-0x0;var _0x4f4ffd=_0xbd44[_0x2aac62];return _0x4f4ffd;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0x4bd4('0x0')][_0x4bd4('0x1')]({'port':0x232b});function request(_0x210cb7,_0x45f6d0){return new BPromise(function(_0x4f0378,_0x40083d){return client['request'](_0x210cb7,_0x45f6d0)['then'](function(_0x3e55e4){if(_0x3e55e4[_0x4bd4('0x2')]){return _0x40083d(_0x3e55e4['error'][_0x4bd4('0x3')]);}else{return _0x4f0378(_0x3e55e4['result']);}})[_0x4bd4('0x4')](function(_0x3f01d2){return _0x40083d(_0x3f01d2);});});}exports[_0x4bd4('0x5')]=function(_0x1b559a,_0xf3299b){return request(_0x4bd4('0x6'),{'account':_0x1b559a,'message':_0xf3299b});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 134ee38..42827aa 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x323f=['chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','mail','openchannel','sms','whatsapp','length','Status','StatusTime','format','faxStatusTime','stringify','emit','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause'];(function(_0x1fc1f9,_0x454fb2){var _0x4987ca=function(_0x5e90dd){while(--_0x5e90dd){_0x1fc1f9['push'](_0x1fc1f9['shift']());}};_0x4987ca(++_0x454fb2);}(_0x323f,0x1ee));var _0xf323=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x323f[_0x5c351c];return _0x26f3b3;};'use strict';var _=require('lodash');var md5=require(_0xf323('0x0'));var moment=require('moment');var Redis=require(_0xf323('0x1'));var config=require(_0xf323('0x2'));config[_0xf323('0x3')]=_[_0xf323('0x4')](config[_0xf323('0x3')],{'host':_0xf323('0x5'),'port':0x18eb});var io=require(_0xf323('0x6'))(new Redis(config[_0xf323('0x3')]));function Agent(_0x3cfee3){this['id']=_0x3cfee3['id']||0x0;this[_0xf323('0x7')]=_0x3cfee3['name']||'';this[_0xf323('0x8')]=_0x3cfee3[_0xf323('0x8')]||!![];this[_0xf323('0x9')]=_0x3cfee3[_0xf323('0x9')]||![];this[_0xf323('0xa')]=_0x3cfee3[_0xf323('0xa')]||![];this[_0xf323('0xb')]=_0x3cfee3[_0xf323('0xb')]||![];this[_0xf323('0xc')]=_0x3cfee3[_0xf323('0xc')]||![];this[_0xf323('0xd')]=_0x3cfee3[_0xf323('0xd')]||![];this[_0xf323('0xe')]=_0x3cfee3[_0xf323('0xe')]||![];this[_0xf323('0xf')]=_0xf323('0x10');this[_0xf323('0x11')]=0x0;this['chatCapacity']=_0x3cfee3[_0xf323('0x12')]||0x0;this[_0xf323('0x13')]=0x0;this[_0xf323('0x14')]='unknown';this[_0xf323('0x15')]=0x0;this[_0xf323('0x16')]=_0x3cfee3[_0xf323('0x16')]||0x0;this[_0xf323('0x17')]=0x0;this[_0xf323('0x18')]=_0xf323('0x10');this['faxStatusTime']=0x0;this['faxCapacity']=_0x3cfee3[_0xf323('0x19')]||0x0;this[_0xf323('0x1a')]=0x0;this[_0xf323('0x1b')]=_0xf323('0x10');this[_0xf323('0x1c')]=0x0;this['smsCapacity']=_0x3cfee3[_0xf323('0x1d')]||0x0;this[_0xf323('0x1e')]=0x0;this[_0xf323('0x1f')]=_0xf323('0x10');this['whatsappStatusTime']=0x0;this[_0xf323('0x20')]=_0x3cfee3[_0xf323('0x20')]||0x0;this[_0xf323('0x21')]=0x0;this[_0xf323('0x22')]='unknown';this[_0xf323('0x23')]=0x0;this[_0xf323('0x24')]=_0x3cfee3['openchannelCapacity']||0x0;this[_0xf323('0x25')]=0x0;this[_0xf323('0x26')]=![];this[_0xf323('0x27')]=undefined;this[_0xf323('0x0')]='';this['chatWaitingInteractions']={};this[_0xf323('0x28')]={};this[_0xf323('0x29')]={};this[_0xf323('0x2a')]={};this['smsWaitingInteractions']={};this[_0xf323('0x2b')]={};this[_0xf323('0x2c')]();}Agent[_0xf323('0x2d')][_0xf323('0x2e')]=function(_0x13ec1f){if(this[_0x13ec1f+_0xf323('0x2f')]>0x0){if(this[_0x13ec1f+_0xf323('0x30')]>0x0&&this[_0x13ec1f+_0xf323('0x2f')]>=this[_0x13ec1f+_0xf323('0x30')]){return'maxcapacity';}else{return _0xf323('0x31');}}else{return _0xf323('0x32');}};Agent[_0xf323('0x2d')][_0xf323('0x2c')]=function(){var _0x87ec45=[_0xf323('0x33'),'chat',_0xf323('0x34'),'fax',_0xf323('0x35'),_0xf323('0x36')];for(var _0x56be0c=0x0;_0x56be0c<_0x87ec45[_0xf323('0x37')];_0x56be0c+=0x1){var _0x3c95ce=this[_0xf323('0x2e')](_0x87ec45[_0x56be0c]);if(this[_0x87ec45[_0x56be0c]+_0xf323('0x38')]!==_0x3c95ce){this[_0x87ec45[_0x56be0c]+_0xf323('0x39')]=_['toNumber'](moment()[_0xf323('0x3a')]('x'));}this[_0x87ec45[_0x56be0c]+_0xf323('0x38')]=_0x3c95ce;}var _0x12c7d5={'id':this['id'],'name':this[_0xf323('0x7')],'online':this[_0xf323('0x8')],'voicePause':this[_0xf323('0x9')],'chatPause':this[_0xf323('0xa')],'mailPause':this[_0xf323('0xb')],'smsPause':this[_0xf323('0xd')],'faxPause':this['faxPause'],'openchannelPause':this[_0xf323('0xe')],'chatStatus':this[_0xf323('0xf')],'chatStatusTime':this[_0xf323('0x11')],'chatCapacity':this[_0xf323('0x12')],'chatCurrentCapacity':this[_0xf323('0x13')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xf323('0x15')],'mailCapacity':this[_0xf323('0x16')],'mailCurrentCapacity':this[_0xf323('0x17')],'faxStatus':this[_0xf323('0x18')],'faxStatusTime':this[_0xf323('0x3b')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xf323('0x1a')],'smsStatus':this[_0xf323('0x1b')],'smsStatusTime':this[_0xf323('0x1c')],'smsCapacity':this[_0xf323('0x1d')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xf323('0x1f')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xf323('0x20')],'whatsappCurrentCapacity':this[_0xf323('0x21')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xf323('0x23')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xf323('0x25')],'busy':this['busy'],'busyQueue':this[_0xf323('0x27')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0xf323('0x28')],'mailWaitingInteractions':this[_0xf323('0x29')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x8b24f2=md5(JSON[_0xf323('0x3c')](_0x12c7d5));if(this[_0xf323('0x0')]!==_0x8b24f2){this[_0xf323('0x0')]=_0x8b24f2;io[_0xf323('0x3d')]('user:routing:update',_['omit'](_0x12c7d5,['online']));}};module[_0xf323('0x3e')]=Agent; \ No newline at end of file +var _0x7b84=['openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','idle','prototype','mail','chat','openchannel','sms','whatsapp','length','Status','toNumber','whatsappStatus','whatsappStatusTime','chatWaitingInteractions','emit','user:routing:update','omit','exports','lodash','md5','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause'];(function(_0x504416,_0x55bc40){var _0x5f54fb=function(_0x452e79){while(--_0x452e79){_0x504416['push'](_0x504416['shift']());}};_0x5f54fb(++_0x55bc40);}(_0x7b84,0x17c));var _0x47b8=function(_0x5fd7b5,_0x32c75c){_0x5fd7b5=_0x5fd7b5-0x0;var _0x4d79e7=_0x7b84[_0x5fd7b5];return _0x4d79e7;};'use strict';var _=require(_0x47b8('0x0'));var md5=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var Redis=require(_0x47b8('0x3'));var config=require(_0x47b8('0x4'));config[_0x47b8('0x5')]=_[_0x47b8('0x6')](config['redis'],{'host':_0x47b8('0x7'),'port':0x18eb});var io=require(_0x47b8('0x8'))(new Redis(config[_0x47b8('0x5')]));function Agent(_0x7013d7){this['id']=_0x7013d7['id']||0x0;this[_0x47b8('0x9')]=_0x7013d7[_0x47b8('0x9')]||'';this['online']=_0x7013d7[_0x47b8('0xa')]||!![];this[_0x47b8('0xb')]=_0x7013d7[_0x47b8('0xb')]||![];this[_0x47b8('0xc')]=_0x7013d7[_0x47b8('0xc')]||![];this[_0x47b8('0xd')]=_0x7013d7[_0x47b8('0xd')]||![];this[_0x47b8('0xe')]=_0x7013d7[_0x47b8('0xe')]||![];this[_0x47b8('0xf')]=_0x7013d7[_0x47b8('0xf')]||![];this[_0x47b8('0x10')]=_0x7013d7[_0x47b8('0x10')]||![];this[_0x47b8('0x11')]=_0x47b8('0x12');this[_0x47b8('0x13')]=0x0;this[_0x47b8('0x14')]=_0x7013d7[_0x47b8('0x14')]||0x0;this[_0x47b8('0x15')]=0x0;this[_0x47b8('0x16')]=_0x47b8('0x12');this[_0x47b8('0x17')]=0x0;this[_0x47b8('0x18')]=_0x7013d7[_0x47b8('0x18')]||0x0;this[_0x47b8('0x19')]=0x0;this[_0x47b8('0x1a')]=_0x47b8('0x12');this['faxStatusTime']=0x0;this[_0x47b8('0x1b')]=_0x7013d7[_0x47b8('0x1b')]||0x0;this[_0x47b8('0x1c')]=0x0;this[_0x47b8('0x1d')]=_0x47b8('0x12');this[_0x47b8('0x1e')]=0x0;this[_0x47b8('0x1f')]=_0x7013d7['smsCapacity']||0x0;this[_0x47b8('0x20')]=0x0;this['whatsappStatus']='unknown';this['whatsappStatusTime']=0x0;this[_0x47b8('0x21')]=_0x7013d7[_0x47b8('0x21')]||0x0;this[_0x47b8('0x22')]=0x0;this['openchannelStatus']='unknown';this['openchannelStatusTime']=0x0;this[_0x47b8('0x23')]=_0x7013d7['openchannelCapacity']||0x0;this[_0x47b8('0x24')]=0x0;this[_0x47b8('0x25')]=![];this[_0x47b8('0x26')]=undefined;this[_0x47b8('0x1')]='';this['chatWaitingInteractions']={};this[_0x47b8('0x27')]={};this[_0x47b8('0x28')]={};this[_0x47b8('0x29')]={};this[_0x47b8('0x2a')]={};this[_0x47b8('0x2b')]={};this[_0x47b8('0x2c')]();}Agent['prototype'][_0x47b8('0x2d')]=function(_0x2a22e3){if(this[_0x2a22e3+'CurrentCapacity']>0x0){if(this[_0x2a22e3+_0x47b8('0x2e')]>0x0&&this[_0x2a22e3+_0x47b8('0x2f')]>=this[_0x2a22e3+_0x47b8('0x2e')]){return _0x47b8('0x30');}else{return'working';}}else{return _0x47b8('0x31');}};Agent[_0x47b8('0x32')][_0x47b8('0x2c')]=function(){var _0x3e3de0=[_0x47b8('0x33'),_0x47b8('0x34'),_0x47b8('0x35'),'fax',_0x47b8('0x36'),_0x47b8('0x37')];for(var _0x4bcc98=0x0;_0x4bcc98<_0x3e3de0[_0x47b8('0x38')];_0x4bcc98+=0x1){var _0x6d517a=this[_0x47b8('0x2d')](_0x3e3de0[_0x4bcc98]);if(this[_0x3e3de0[_0x4bcc98]+_0x47b8('0x39')]!==_0x6d517a){this[_0x3e3de0[_0x4bcc98]+'StatusTime']=_[_0x47b8('0x3a')](moment()['format']('x'));}this[_0x3e3de0[_0x4bcc98]+_0x47b8('0x39')]=_0x6d517a;}var _0x2255ab={'id':this['id'],'name':this[_0x47b8('0x9')],'online':this[_0x47b8('0xa')],'voicePause':this['voicePause'],'chatPause':this[_0x47b8('0xc')],'mailPause':this[_0x47b8('0xd')],'smsPause':this[_0x47b8('0xf')],'faxPause':this[_0x47b8('0xe')],'openchannelPause':this[_0x47b8('0x10')],'chatStatus':this[_0x47b8('0x11')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x47b8('0x16')],'mailStatusTime':this[_0x47b8('0x17')],'mailCapacity':this[_0x47b8('0x18')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x47b8('0x1c')],'smsStatus':this[_0x47b8('0x1d')],'smsStatusTime':this[_0x47b8('0x1e')],'smsCapacity':this[_0x47b8('0x1f')],'smsCurrentCapacity':this[_0x47b8('0x20')],'whatsappStatus':this[_0x47b8('0x3b')],'whatsappStatusTime':this[_0x47b8('0x3c')],'whatsappCapacity':this[_0x47b8('0x21')],'whatsappCurrentCapacity':this[_0x47b8('0x22')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x47b8('0x23')],'openchannelCurrentCapacity':this[_0x47b8('0x24')],'busy':this['busy'],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x47b8('0x3d')],'faxWaitingInteractions':this[_0x47b8('0x27')],'mailWaitingInteractions':this[_0x47b8('0x28')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x47b8('0x2a')],'whatsappWaitingInteractions':this[_0x47b8('0x2b')]};var _0x5687c2=md5(JSON['stringify'](_0x2255ab));if(this['md5']!==_0x5687c2){this['md5']=_0x5687c2;io[_0x47b8('0x3e')](_0x47b8('0x3f'),_[_0x47b8('0x40')](_0x2255ab,[_0x47b8('0xa')]));}};module[_0x47b8('0x41')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 0db54de..23b0431 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 _0x3c3a=['name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','online','chatPause','available','stringify','chat:queue:%s','emit','chat_queue:save','lodash','md5','util','../../../config/environment','defaults'];(function(_0x18847a,_0xd6898e){var _0x5b68ca=function(_0xf333b){while(--_0xf333b){_0x18847a['push'](_0x18847a['shift']());}};_0x5b68ca(++_0xd6898e);}(_0x3c3a,0x11b));var _0xa3c3=function(_0x105a6b,_0x7fd8d7){_0x105a6b=_0x105a6b-0x0;var _0x4e50da=_0x3c3a[_0x105a6b];return _0x4e50da;};'use strict';var _=require(_0xa3c3('0x0'));var md5=require(_0xa3c3('0x1'));var util=require(_0xa3c3('0x2'));var Redis=require('ioredis');var config=require(_0xa3c3('0x3'));config['redis']=_[_0xa3c3('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x1be04a){this['id']=_0x1be04a['id']||0x0;this[_0xa3c3('0x5')]=_0x1be04a[_0xa3c3('0x5')]||'';this[_0xa3c3('0x6')]=_0x1be04a['timeout']||0xa;this[_0xa3c3('0x7')]=_0x1be04a['strategy']||_0xa3c3('0x8');this[_0xa3c3('0x9')]=_0x1be04a['Agents'];this[_0xa3c3('0xa')]={};this['waiting']=0x0;this['md5']='';this[_0xa3c3('0xb')]();this[_0xa3c3('0xc')]();}ChatQueue['prototype']['updateRouting']=function(){var _0x33ca37=this[_0xa3c3('0xa')]['_rr'];this[_0xa3c3('0xa')]=_['map'](this[_0xa3c3('0x9')],'id');this[_0xa3c3('0xa')][_0xa3c3('0xd')]=_0x33ca37;};ChatQueue[_0xa3c3('0xe')][_0xa3c3('0xc')]=function(){this[_0xa3c3('0xf')]=0x0;this[_0xa3c3('0x10')]=0x0;for(var _0x106c63=0x0;_0x106c63=0x0?this[_0xa3c3('0x13')]:0x0;var _0x195712={'id':this['id'],'available':this[_0xa3c3('0x13')],'loggedIn':this[_0xa3c3('0xf')],'name':this['name'],'paused':this[_0xa3c3('0x10')],'waiting':this['waiting']};var _0xd452ea=md5(JSON[_0xa3c3('0x14')](_0x195712));if(this[_0xa3c3('0x1')]!==_0xd452ea){this[_0xa3c3('0x1')]=_0xd452ea;io['to'](util['format'](_0xa3c3('0x15'),_0x195712[_0xa3c3('0x5')]))[_0xa3c3('0x16')](_0xa3c3('0x17'),_0x195712);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x7501=['online','chatPause','available','stringify','chat:queue:%s','emit','chat_queue:save','exports','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length'];(function(_0x107c55,_0x4d8aaf){var _0x1f8cb6=function(_0xd59c44){while(--_0xd59c44){_0x107c55['push'](_0x107c55['shift']());}};_0x1f8cb6(++_0x4d8aaf);}(_0x7501,0x7c));var _0x1750=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x7501[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var md5=require(_0x1750('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0x1750('0x1'));config[_0x1750('0x2')]=_[_0x1750('0x3')](config['redis'],{'host':_0x1750('0x4'),'port':0x18eb});var io=require(_0x1750('0x5'))(new Redis(config[_0x1750('0x2')]));function ChatQueue(_0x19dd80){this['id']=_0x19dd80['id']||0x0;this[_0x1750('0x6')]=_0x19dd80['name']||'';this['timeout']=_0x19dd80[_0x1750('0x7')]||0xa;this['strategy']=_0x19dd80[_0x1750('0x8')]||_0x1750('0x9');this[_0x1750('0xa')]=_0x19dd80[_0x1750('0xa')];this['mapAgentsId']={};this[_0x1750('0xb')]=0x0;this[_0x1750('0x0')]='';this[_0x1750('0xc')]();this[_0x1750('0xd')]();}ChatQueue[_0x1750('0xe')][_0x1750('0xc')]=function(){var _0x2d7805=this[_0x1750('0xf')][_0x1750('0x10')];this['mapAgentsId']=_[_0x1750('0x11')](this['Agents'],'id');this['mapAgentsId'][_0x1750('0x10')]=_0x2d7805;};ChatQueue[_0x1750('0xe')][_0x1750('0xd')]=function(){this[_0x1750('0x12')]=0x0;this[_0x1750('0x13')]=0x0;for(var _0x51780d=0x0;_0x51780d=0x0?this['available']:0x0;var _0x3b3de6={'id':this['id'],'available':this[_0x1750('0x17')],'loggedIn':this[_0x1750('0x12')],'name':this['name'],'paused':this[_0x1750('0x13')],'waiting':this[_0x1750('0xb')]};var _0x38d75e=md5(JSON[_0x1750('0x18')](_0x3b3de6));if(this[_0x1750('0x0')]!==_0x38d75e){this[_0x1750('0x0')]=_0x38d75e;io['to'](util['format'](_0x1750('0x19'),_0x3b3de6[_0x1750('0x6')]))[_0x1750('0x1a')](_0x1750('0x1b'),_0x3b3de6);}};module[_0x1750('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index decbe6a..8d0c1ec 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 _0x3bf7=['available','stringify','format','emit','fax_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','faxPause'];(function(_0x1e2583,_0x42669b){var _0x445939=function(_0x2a6431){while(--_0x2a6431){_0x1e2583['push'](_0x1e2583['shift']());}};_0x445939(++_0x42669b);}(_0x3bf7,0x1aa));var _0x73bf=function(_0x319a18,_0x4ba5a6){_0x319a18=_0x319a18-0x0;var _0x761326=_0x3bf7[_0x319a18];return _0x761326;};'use strict';var _=require(_0x73bf('0x0'));var md5=require('md5');var util=require(_0x73bf('0x1'));var Redis=require(_0x73bf('0x2'));var config=require(_0x73bf('0x3'));config[_0x73bf('0x4')]=_[_0x73bf('0x5')](config[_0x73bf('0x4')],{'host':_0x73bf('0x6'),'port':0x18eb});var io=require(_0x73bf('0x7'))(new Redis(config['redis']));function FaxQueue(_0x26fb88){this['id']=_0x26fb88['id']||0x0;this['name']=_0x26fb88[_0x73bf('0x8')]||'';this[_0x73bf('0x9')]=_0x26fb88[_0x73bf('0x9')]||0xa;this[_0x73bf('0xa')]=_0x26fb88[_0x73bf('0xa')]||_0x73bf('0xb');this[_0x73bf('0xc')]=_0x26fb88['Agents'];this[_0x73bf('0xd')]={};this[_0x73bf('0xe')]=0x0;this[_0x73bf('0xf')]='';this[_0x73bf('0x10')]();this[_0x73bf('0x11')]();}FaxQueue[_0x73bf('0x12')][_0x73bf('0x10')]=function(){var _0x2cf3aa=this['mapAgentsId'][_0x73bf('0x13')];this[_0x73bf('0xd')]=_['map'](this[_0x73bf('0xc')],'id');this[_0x73bf('0xd')]['_rr']=_0x2cf3aa;};FaxQueue[_0x73bf('0x12')][_0x73bf('0x11')]=function(){this[_0x73bf('0x14')]=0x0;this[_0x73bf('0x15')]=0x0;for(var _0x29e197=0x0;_0x29e197=0x0?this[_0x73bf('0x18')]:0x0;var _0x53e67f={'id':this['id'],'available':this[_0x73bf('0x18')],'loggedIn':this[_0x73bf('0x14')],'name':this['name'],'paused':this[_0x73bf('0x15')],'waiting':this[_0x73bf('0xe')]};var _0x2cbf0c=md5(JSON[_0x73bf('0x19')](_0x53e67f));if(this['md5']!==_0x2cbf0c){this['md5']=_0x2cbf0c;io['to'](util[_0x73bf('0x1a')]('fax:queue:%s',_0x53e67f[_0x73bf('0x8')]))[_0x73bf('0x1b')](_0x73bf('0x1c'),_0x53e67f);}};module[_0x73bf('0x1d')]=FaxQueue; \ No newline at end of file +var _0x9099=['../../../config/environment','redis','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','_rr','map','paused','length','loggedIn','faxPause','available','name','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0x9099,0x1bd));var _0x9909=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x9099[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0x9909('0x0'));var md5=require(_0x9909('0x1'));var util=require(_0x9909('0x2'));var Redis=require('ioredis');var config=require(_0x9909('0x3'));config[_0x9909('0x4')]=_['defaults'](config['redis'],{'host':_0x9909('0x5'),'port':0x18eb});var io=require(_0x9909('0x6'))(new Redis(config['redis']));function FaxQueue(_0xfab6d0){this['id']=_0xfab6d0['id']||0x0;this['name']=_0xfab6d0['name']||'';this[_0x9909('0x7')]=_0xfab6d0[_0x9909('0x7')]||0xa;this[_0x9909('0x8')]=_0xfab6d0['strategy']||_0x9909('0x9');this[_0x9909('0xa')]=_0xfab6d0['Agents'];this[_0x9909('0xb')]={};this[_0x9909('0xc')]=0x0;this[_0x9909('0x1')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0x9909('0xd')]['updateRouting']=function(){var _0x487b99=this[_0x9909('0xb')][_0x9909('0xe')];this['mapAgentsId']=_[_0x9909('0xf')](this[_0x9909('0xa')],'id');this[_0x9909('0xb')][_0x9909('0xe')]=_0x487b99;};FaxQueue[_0x9909('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x9909('0x10')]=0x0;for(var _0x41de41=0x0;_0x41de41=0x0?this[_0x9909('0x14')]:0x0;var _0x41ac1b={'id':this['id'],'available':this[_0x9909('0x14')],'loggedIn':this[_0x9909('0x12')],'name':this[_0x9909('0x15')],'paused':this[_0x9909('0x10')],'waiting':this[_0x9909('0xc')]};var _0x48d12f=md5(JSON[_0x9909('0x16')](_0x41ac1b));if(this[_0x9909('0x1')]!==_0x48d12f){this[_0x9909('0x1')]=_0x48d12f;io['to'](util[_0x9909('0x17')](_0x9909('0x18'),_0x41ac1b[_0x9909('0x15')]))[_0x9909('0x19')](_0x9909('0x1a'),_0x41ac1b);}};module[_0x9909('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index b29801a..2a11ef4 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 _0xd36e=['name','Intervals','exports'];(function(_0x2b3c36,_0x2692e1){var _0x1c1840=function(_0x559719){while(--_0x559719){_0x2b3c36['push'](_0x2b3c36['shift']());}};_0x1c1840(++_0x2692e1);}(_0xd36e,0x183));var _0xed36=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd36e[_0x27af45];return _0x18df21;};'use strict';function Interval(_0x39d051){this['id']=_0x39d051['id']||0x0;this[_0xed36('0x0')]=_0x39d051[_0xed36('0x0')]||'';this[_0xed36('0x1')]=_0x39d051[_0xed36('0x1')]||{};}module[_0xed36('0x2')]=Interval; \ No newline at end of file +var _0xab02=['exports','name','Intervals'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab02,0x1ea));var _0x2ab0=function(_0x4bf6bc,_0x4b0331){_0x4bf6bc=_0x4bf6bc-0x0;var _0x2fc5a9=_0xab02[_0x4bf6bc];return _0x2fc5a9;};'use strict';function Interval(_0x52ff94){this['id']=_0x52ff94['id']||0x0;this[_0x2ab0('0x0')]=_0x52ff94['name']||'';this[_0x2ab0('0x1')]=_0x52ff94[_0x2ab0('0x1')]||{};}module[_0x2ab0('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 bb35151..71afd66 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 _0xe44b=['defaults','socket.io-emitter','name','timeout','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','length','online','available','paused','format','emit','mail_queue:save','exports','md5','util','ioredis','../../../config/environment','redis'];(function(_0x1e10e2,_0x4148d5){var _0x3176d3=function(_0x4b6216){while(--_0x4b6216){_0x1e10e2['push'](_0x1e10e2['shift']());}};_0x3176d3(++_0x4148d5);}(_0xe44b,0xc3));var _0xbe44=function(_0xcd3fd1,_0x1a2ffc){_0xcd3fd1=_0xcd3fd1-0x0;var _0x29a9d3=_0xe44b[_0xcd3fd1];return _0x29a9d3;};'use strict';var _=require('lodash');var md5=require(_0xbe44('0x0'));var util=require(_0xbe44('0x1'));var Redis=require(_0xbe44('0x2'));var config=require(_0xbe44('0x3'));config[_0xbe44('0x4')]=_[_0xbe44('0x5')](config[_0xbe44('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xbe44('0x6'))(new Redis(config[_0xbe44('0x4')]));function MailQueue(_0x13cf2e){this['id']=_0x13cf2e['id']||0x0;this['name']=_0x13cf2e[_0xbe44('0x7')]||'';this[_0xbe44('0x8')]=_0x13cf2e['timeout']||0xa;this['strategy']=_0x13cf2e['strategy']||'beepall';this['Agents']=_0x13cf2e[_0xbe44('0x9')];this[_0xbe44('0xa')]={};this[_0xbe44('0xb')]=0x0;this['md5']='';this[_0xbe44('0xc')]();this[_0xbe44('0xd')]();}MailQueue['prototype'][_0xbe44('0xc')]=function(){var _0x4a4218=this[_0xbe44('0xa')]['_rr'];this[_0xbe44('0xa')]=_['map'](this[_0xbe44('0x9')],'id');this[_0xbe44('0xa')][_0xbe44('0xe')]=_0x4a4218;};MailQueue[_0xbe44('0xf')]['updateRealtime']=function(){this[_0xbe44('0x10')]=0x0;this['paused']=0x0;for(var _0x24b9d8=0x0;_0x24b9d8=0x0?this[_0xbe44('0x13')]:0x0;var _0xd8742={'id':this['id'],'available':this['available'],'loggedIn':this[_0xbe44('0x10')],'name':this['name'],'paused':this[_0xbe44('0x14')],'waiting':this[_0xbe44('0xb')]};var _0x1a3fd3=md5(JSON['stringify'](_0xd8742));if(this[_0xbe44('0x0')]!==_0x1a3fd3){this[_0xbe44('0x0')]=_0x1a3fd3;io['to'](util[_0xbe44('0x15')]('mail:queue:%s',_0xd8742['name']))[_0xbe44('0x16')](_0xbe44('0x17'),_0xd8742);}};module[_0xbe44('0x18')]=MailQueue; \ No newline at end of file +var _0x2a2b=['md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','paused','online','mailPause','available','format','mail_queue:save','exports','lodash'];(function(_0x1b3b7f,_0x5dfca2){var _0x3b1f84=function(_0x258424){while(--_0x258424){_0x1b3b7f['push'](_0x1b3b7f['shift']());}};_0x3b1f84(++_0x5dfca2);}(_0x2a2b,0x185));var _0xb2a2=function(_0x43b686,_0x30f505){_0x43b686=_0x43b686-0x0;var _0x4a7c3a=_0x2a2b[_0x43b686];return _0x4a7c3a;};'use strict';var _=require(_0xb2a2('0x0'));var md5=require(_0xb2a2('0x1'));var util=require(_0xb2a2('0x2'));var Redis=require('ioredis');var config=require(_0xb2a2('0x3'));config[_0xb2a2('0x4')]=_[_0xb2a2('0x5')](config[_0xb2a2('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xb2a2('0x6'))(new Redis(config[_0xb2a2('0x4')]));function MailQueue(_0x4bcc83){this['id']=_0x4bcc83['id']||0x0;this[_0xb2a2('0x7')]=_0x4bcc83[_0xb2a2('0x7')]||'';this[_0xb2a2('0x8')]=_0x4bcc83[_0xb2a2('0x8')]||0xa;this[_0xb2a2('0x9')]=_0x4bcc83[_0xb2a2('0x9')]||_0xb2a2('0xa');this[_0xb2a2('0xb')]=_0x4bcc83[_0xb2a2('0xb')];this[_0xb2a2('0xc')]={};this[_0xb2a2('0xd')]=0x0;this[_0xb2a2('0x1')]='';this[_0xb2a2('0xe')]();this[_0xb2a2('0xf')]();}MailQueue[_0xb2a2('0x10')][_0xb2a2('0xe')]=function(){var _0x4979c3=this['mapAgentsId']['_rr'];this[_0xb2a2('0xc')]=_[_0xb2a2('0x11')](this[_0xb2a2('0xb')],'id');this[_0xb2a2('0xc')]['_rr']=_0x4979c3;};MailQueue[_0xb2a2('0x10')]['updateRealtime']=function(){this[_0xb2a2('0x12')]=0x0;this[_0xb2a2('0x13')]=0x0;for(var _0x2d6f6e=0x0;_0x2d6f6e=0x0?this[_0xb2a2('0x16')]:0x0;var _0x2cdc9f={'id':this['id'],'available':this[_0xb2a2('0x16')],'loggedIn':this[_0xb2a2('0x12')],'name':this['name'],'paused':this[_0xb2a2('0x13')],'waiting':this[_0xb2a2('0xd')]};var _0x361c39=md5(JSON['stringify'](_0x2cdc9f));if(this['md5']!==_0x361c39){this[_0xb2a2('0x1')]=_0x361c39;io['to'](util[_0xb2a2('0x17')]('mail:queue:%s',_0x2cdc9f[_0xb2a2('0x7')]))['emit'](_0xb2a2('0x18'),_0x2cdc9f);}};module[_0xb2a2('0x19')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 744482c..2af9ecb 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 _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc4aa[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0x1261,0x144));var _0x1126=function(_0x311f44,_0x1d7f5b){_0x311f44=_0x311f44-0x0;var _0x46f1e6=_0x1261[_0x311f44];return _0x46f1e6;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index e4fda88..be762a6 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 _0xbd50=['smsPause','available','waiting','stringify','sms_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xbd50,0x196));var _0x0bd5=function(_0x4092de,_0x24186b){_0x4092de=_0x4092de-0x0;var _0x2e8a39=_0xbd50[_0x4092de];return _0x2e8a39;};'use strict';var _=require(_0x0bd5('0x0'));var md5=require(_0x0bd5('0x1'));var util=require(_0x0bd5('0x2'));var Redis=require('ioredis');var config=require(_0x0bd5('0x3'));config[_0x0bd5('0x4')]=_[_0x0bd5('0x5')](config[_0x0bd5('0x4')],{'host':_0x0bd5('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function SmsQueue(_0x560cf1){this['id']=_0x560cf1['id']||0x0;this[_0x0bd5('0x7')]=_0x560cf1[_0x0bd5('0x7')]||'';this[_0x0bd5('0x8')]=_0x560cf1[_0x0bd5('0x8')]||0xa;this[_0x0bd5('0x9')]=_0x560cf1['strategy']||'beepall';this[_0x0bd5('0xa')]=_0x560cf1[_0x0bd5('0xa')];this[_0x0bd5('0xb')]={};this['waiting']=0x0;this[_0x0bd5('0x1')]='';this[_0x0bd5('0xc')]();this['updateRealtime']();}SmsQueue[_0x0bd5('0xd')][_0x0bd5('0xc')]=function(){var _0x4d7d17=this[_0x0bd5('0xb')][_0x0bd5('0xe')];this[_0x0bd5('0xb')]=_['map'](this[_0x0bd5('0xa')],'id');this[_0x0bd5('0xb')][_0x0bd5('0xe')]=_0x4d7d17;};SmsQueue[_0x0bd5('0xd')][_0x0bd5('0xf')]=function(){this[_0x0bd5('0x10')]=0x0;this[_0x0bd5('0x11')]=0x0;for(var _0x1e961d=0x0;_0x1e961d=0x0?this[_0x0bd5('0x14')]:0x0;var _0x23be38={'id':this['id'],'available':this[_0x0bd5('0x14')],'loggedIn':this[_0x0bd5('0x10')],'name':this[_0x0bd5('0x7')],'paused':this[_0x0bd5('0x11')],'waiting':this[_0x0bd5('0x15')]};var _0x415d8f=md5(JSON[_0x0bd5('0x16')](_0x23be38));if(this[_0x0bd5('0x1')]!==_0x415d8f){this['md5']=_0x415d8f;io['to'](util['format']('sms:queue:%s',_0x23be38['name']))['emit'](_0x0bd5('0x17'),_0x23be38);}};module[_0x0bd5('0x18')]=SmsQueue; \ No newline at end of file +var _0x0e85=['waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','localhost','redis','name','timeout','strategy','beepall','Agents'];(function(_0x138eab,_0x2ec1cc){var _0x15e990=function(_0x41cf97){while(--_0x41cf97){_0x138eab['push'](_0x138eab['shift']());}};_0x15e990(++_0x2ec1cc);}(_0x0e85,0x7c));var _0x50e8=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x0e85[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0x50e8('0x0'));var md5=require(_0x50e8('0x1'));var util=require('util');var Redis=require(_0x50e8('0x2'));var config=require(_0x50e8('0x3'));config['redis']=_['defaults'](config['redis'],{'host':_0x50e8('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x50e8('0x5')]));function SmsQueue(_0x2401b2){this['id']=_0x2401b2['id']||0x0;this[_0x50e8('0x6')]=_0x2401b2[_0x50e8('0x6')]||'';this['timeout']=_0x2401b2[_0x50e8('0x7')]||0xa;this[_0x50e8('0x8')]=_0x2401b2[_0x50e8('0x8')]||_0x50e8('0x9');this[_0x50e8('0xa')]=_0x2401b2[_0x50e8('0xa')];this['mapAgentsId']={};this[_0x50e8('0xb')]=0x0;this[_0x50e8('0x1')]='';this[_0x50e8('0xc')]();this[_0x50e8('0xd')]();}SmsQueue[_0x50e8('0xe')][_0x50e8('0xc')]=function(){var _0x45dc6f=this[_0x50e8('0xf')]['_rr'];this['mapAgentsId']=_[_0x50e8('0x10')](this[_0x50e8('0xa')],'id');this['mapAgentsId']['_rr']=_0x45dc6f;};SmsQueue[_0x50e8('0xe')][_0x50e8('0xd')]=function(){this[_0x50e8('0x11')]=0x0;this[_0x50e8('0x12')]=0x0;for(var _0x54efd3=0x0;_0x54efd3=0x0?this[_0x50e8('0x15')]:0x0;var _0xc97063={'id':this['id'],'available':this[_0x50e8('0x15')],'loggedIn':this[_0x50e8('0x11')],'name':this[_0x50e8('0x6')],'paused':this[_0x50e8('0x12')],'waiting':this[_0x50e8('0xb')]};var _0x53e0a1=md5(JSON[_0x50e8('0x16')](_0xc97063));if(this['md5']!==_0x53e0a1){this[_0x50e8('0x1')]=_0x53e0a1;io['to'](util[_0x50e8('0x17')](_0x50e8('0x18'),_0xc97063[_0x50e8('0x6')]))[_0x50e8('0x19')]('sms_queue:save',_0xc97063);}};module[_0x50e8('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 1e2c5af..781990d 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 _0x9319=['mapAgentsId','waiting','md5','updateRealtime','_rr','prototype','loggedIn','paused','length','available','whatsapp:queue:%s','whatsapp_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents'];(function(_0x16a028,_0x579f68){var _0x3c4d45=function(_0x1faad8){while(--_0x1faad8){_0x16a028['push'](_0x16a028['shift']());}};_0x3c4d45(++_0x579f68);}(_0x9319,0xc5));var _0x9931=function(_0xc041de,_0x20d476){_0xc041de=_0xc041de-0x0;var _0xdfdc01=_0x9319[_0xc041de];return _0xdfdc01;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x9931('0x0'));var Redis=require(_0x9931('0x1'));var config=require(_0x9931('0x2'));config[_0x9931('0x3')]=_[_0x9931('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9931('0x5'))(new Redis(config['redis']));function WhatsappQueue(_0x461095){this['id']=_0x461095['id']||0x0;this['name']=_0x461095['name']||'';this[_0x9931('0x6')]=_0x461095[_0x9931('0x6')]||0xa;this[_0x9931('0x7')]=_0x461095[_0x9931('0x7')]||_0x9931('0x8');this[_0x9931('0x9')]=_0x461095[_0x9931('0x9')];this[_0x9931('0xa')]={};this[_0x9931('0xb')]=0x0;this[_0x9931('0xc')]='';this['updateRouting']();this[_0x9931('0xd')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x27c024=this[_0x9931('0xa')][_0x9931('0xe')];this[_0x9931('0xa')]=_['map'](this['Agents'],'id');this[_0x9931('0xa')][_0x9931('0xe')]=_0x27c024;};WhatsappQueue[_0x9931('0xf')][_0x9931('0xd')]=function(){this[_0x9931('0x10')]=0x0;this[_0x9931('0x11')]=0x0;for(var _0x4273db=0x0;_0x4273db=0x0?this[_0x9931('0x13')]:0x0;var _0x318a20={'id':this['id'],'available':this[_0x9931('0x13')],'loggedIn':this[_0x9931('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x9931('0xb')]};var _0x5e0606=md5(JSON['stringify'](_0x318a20));if(this['md5']!==_0x5e0606){this[_0x9931('0xc')]=_0x5e0606;io['to'](util['format'](_0x9931('0x14'),_0x318a20['name']))['emit'](_0x9931('0x15'),_0x318a20);}};module[_0x9931('0x16')]=WhatsappQueue; \ No newline at end of file +var _0x0147=['prototype','loggedIn','paused','length','online','whatsappPause','available','stringify','whatsapp:queue:%s','emit','lodash','md5','util','ioredis','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','map'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x0147,0x1d5));var _0x7014=function(_0x5403a4,_0xcf9e3e){_0x5403a4=_0x5403a4-0x0;var _0x50086c=_0x0147[_0x5403a4];return _0x50086c;};'use strict';var _=require(_0x7014('0x0'));var md5=require(_0x7014('0x1'));var util=require(_0x7014('0x2'));var Redis=require(_0x7014('0x3'));var config=require('../../../config/environment');config[_0x7014('0x4')]=_[_0x7014('0x5')](config[_0x7014('0x4')],{'host':_0x7014('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7014('0x4')]));function WhatsappQueue(_0x16db4b){this['id']=_0x16db4b['id']||0x0;this[_0x7014('0x7')]=_0x16db4b[_0x7014('0x7')]||'';this[_0x7014('0x8')]=_0x16db4b[_0x7014('0x8')]||0xa;this[_0x7014('0x9')]=_0x16db4b[_0x7014('0x9')]||_0x7014('0xa');this[_0x7014('0xb')]=_0x16db4b['Agents'];this[_0x7014('0xc')]={};this[_0x7014('0xd')]=0x0;this['md5']='';this[_0x7014('0xe')]();this[_0x7014('0xf')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x56bc19=this[_0x7014('0xc')]['_rr'];this[_0x7014('0xc')]=_[_0x7014('0x10')](this[_0x7014('0xb')],'id');this[_0x7014('0xc')]['_rr']=_0x56bc19;};WhatsappQueue[_0x7014('0x11')][_0x7014('0xf')]=function(){this[_0x7014('0x12')]=0x0;this[_0x7014('0x13')]=0x0;for(var _0x3e86ca=0x0;_0x3e86ca=0x0?this['available']:0x0;var _0x41716e={'id':this['id'],'available':this[_0x7014('0x17')],'loggedIn':this[_0x7014('0x12')],'name':this[_0x7014('0x7')],'paused':this[_0x7014('0x13')],'waiting':this[_0x7014('0xd')]};var _0x3c6202=md5(JSON[_0x7014('0x18')](_0x41716e));if(this['md5']!==_0x3c6202){this[_0x7014('0x1')]=_0x3c6202;io['to'](util['format'](_0x7014('0x19'),_0x41716e[_0x7014('0x7')]))[_0x7014('0x1a')]('whatsapp_queue:save',_0x41716e);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 24ff114..95aed2a 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(_0x480fbc,_0x52c4bf){var _0x4883b5=function(_0x497fc5){while(--_0x497fc5){_0x480fbc['push'](_0x480fbc['shift']());}};_0x4883b5(++_0x52c4bf);}(_0xb10b,0x12a));var _0xbb10=function(_0x58999b,_0xea4695){_0x58999b=_0x58999b-0x0;var _0x5efc3a=_0xb10b[_0x58999b];return _0x5efc3a;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x4677fa,_0x151ee1){var _0x2c4417=function(_0x43d5ca){while(--_0x43d5ca){_0x4677fa['push'](_0x4677fa['shift']());}};_0x2c4417(++_0x151ee1);}(_0xb10b,0x12a));var _0xbb10=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0xb10b[_0xe39824];return _0x4bc31e;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 092a267..9a6e75a 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 _0x604a=['../client','update','updateChatInteraction','addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x3a3964,_0xe88edb){var _0x1b74aa=function(_0x3ca00f){while(--_0x3ca00f){_0x3a3964['push'](_0x3a3964['shift']());}};_0x1b74aa(++_0xe88edb);}(_0x604a,0x1e3));var _0xa604=function(_0x22cec6,_0x3b5227){_0x22cec6=_0x22cec6-0x0;var _0x2276fb=_0x604a[_0x22cec6];return _0x2276fb;};'use strict';var client=require(_0xa604('0x0'));exports[_0xa604('0x1')]=function(_0x43094b,_0x90497d){return client['Request']('UpdateChatInteraction',{'body':_0x90497d,'options':{'where':{'id':_0x43094b}},'log':_0xa604('0x2')});};exports[_0xa604('0x3')]=function(_0x55f4b0,_0x1ae016){return client[_0xa604('0x4')](_0xa604('0x5'),{'body':_0x1ae016,'options':{'where':{'id':_0x55f4b0}},'log':_0xa604('0x6')});}; \ No newline at end of file +var _0x6e13=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x399338,_0x11496b){var _0x3c4485=function(_0x17e385){while(--_0x17e385){_0x399338['push'](_0x399338['shift']());}};_0x3c4485(++_0x11496b);}(_0x6e13,0x8c));var _0x36e1=function(_0x559067,_0x4fa41d){_0x559067=_0x559067-0x0;var _0x303dc5=_0x6e13[_0x559067];return _0x303dc5;};'use strict';var client=require(_0x36e1('0x0'));exports['update']=function(_0x477c8d,_0x3b4859){return client[_0x36e1('0x1')](_0x36e1('0x2'),{'body':_0x3b4859,'options':{'where':{'id':_0x477c8d}},'log':_0x36e1('0x3')});};exports['addTags']=function(_0x27fb42,_0xc6411e){return client[_0x36e1('0x1')](_0x36e1('0x4'),{'body':_0xc6411e,'options':{'where':{'id':_0x27fb42}},'log':_0x36e1('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index c45eff1..2bb88b7 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 _0x287c=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x287c,0xe5));var _0xc287=function(_0x32ded5,_0x24c39b){_0x32ded5=_0x32ded5-0x0;var _0xea10d3=_0x287c[_0x32ded5];return _0xea10d3;};'use strict';var client=require(_0xc287('0x0'));exports[_0xc287('0x1')]=function(_0x5c7571){return client[_0xc287('0x2')](_0xc287('0x3'),{'body':_0x5c7571,'log':_0xc287('0x4')});}; \ No newline at end of file +var _0xddc0=['Request','createChatMessage','../client','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xddc0,0xc6));var _0x0ddc=function(_0x1ebe90,_0x5d29fc){_0x1ebe90=_0x1ebe90-0x0;var _0x447c82=_0xddc0[_0x1ebe90];return _0x447c82;};'use strict';var client=require(_0x0ddc('0x0'));exports[_0x0ddc('0x1')]=function(_0x5b1c09){return client[_0x0ddc('0x2')]('CreateChatMessage',{'body':_0x5b1c09,'log':_0x0ddc('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index f4e3343..720019e 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 _0x1cb9=['Agents','online','chatPause','getChatQueues','../client','Request','GetChatQueue','name','timeout','User'];(function(_0x2d77b0,_0x3fa58e){var _0x4955eb=function(_0x159ec5){while(--_0x159ec5){_0x2d77b0['push'](_0x2d77b0['shift']());}};_0x4955eb(++_0x3fa58e);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1d3366,_0x11dca7){_0x1d3366=_0x1d3366-0x0;var _0x4bad5c=_0x1cb9[_0x1d3366];return _0x4bad5c;};'use strict';var client=require(_0x91cb('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x91cb('0x1')](_0x91cb('0x2'),{'options':{'raw':![],'attributes':['id',_0x91cb('0x3'),_0x91cb('0x4'),'strategy'],'include':[{'model':_0x91cb('0x5'),'as':_0x91cb('0x6'),'attributes':['id','name',_0x91cb('0x7'),_0x91cb('0x8')]}]},'log':_0x91cb('0x9')});};}; \ No newline at end of file +var _0x6011=['timeout','strategy','Agents','name','online','chatPause','getChatQueues'];(function(_0x22cb62,_0x3fb431){var _0x597f64=function(_0x43e105){while(--_0x43e105){_0x22cb62['push'](_0x22cb62['shift']());}};_0x597f64(++_0x3fb431);}(_0x6011,0x196));var _0x1601=function(_0x591438,_0x5596d1){_0x591438=_0x591438-0x0;var _0x3a8e61=_0x6011[_0x591438];return _0x3a8e61;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0x1601('0x0'),_0x1601('0x1')],'include':[{'model':'User','as':_0x1601('0x2'),'attributes':['id',_0x1601('0x3'),_0x1601('0x4'),_0x1601('0x5')]}]},'log':_0x1601('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 2ff0dbc..43a7437 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 _0x80c7=['update','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x20ea1f,_0x3c6534){var _0x35422a=function(_0x7327db){while(--_0x7327db){_0x20ea1f['push'](_0x20ea1f['shift']());}};_0x35422a(++_0x3c6534);}(_0x80c7,0x8d));var _0x780c=function(_0x1d8c1a,_0x412982){_0x1d8c1a=_0x1d8c1a-0x0;var _0x4a6fff=_0x80c7[_0x1d8c1a];return _0x4a6fff;};'use strict';var client=require(_0x780c('0x0'));exports[_0x780c('0x1')]=function(_0x2c48bf){return client[_0x780c('0x2')]('CreateChatQueueReport',{'body':_0x2c48bf,'log':'CreateChatQueueReport'});};exports[_0x780c('0x3')]=function(_0x5af044,_0x3a8676){return client[_0x780c('0x2')](_0x780c('0x4'),{'body':_0x3a8676,'options':{'where':{'uniqueid':_0x5af044},'order':[['id',_0x780c('0x5')]],'limit':0x1},'log':_0x780c('0x4')});}; \ No newline at end of file +var _0xe13e=['UpdateChatQueueReport','DESC','Request','CreateChatQueueReport','update'];(function(_0x389cd,_0x229da9){var _0x2e6a14=function(_0x24ce67){while(--_0x24ce67){_0x389cd['push'](_0x389cd['shift']());}};_0x2e6a14(++_0x229da9);}(_0xe13e,0xde));var _0xee13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe13e[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['create']=function(_0x4df8d5){return client[_0xee13('0x0')](_0xee13('0x1'),{'body':_0x4df8d5,'log':_0xee13('0x1')});};exports[_0xee13('0x2')]=function(_0x2513f3,_0x7a275f){return client[_0xee13('0x0')](_0xee13('0x3'),{'body':_0x7a275f,'options':{'where':{'uniqueid':_0x2513f3},'order':[['id',_0xee13('0x4')]],'limit':0x1},'log':_0xee13('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 44abf3a..ed0847b 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x184636,_0x536607){var _0x3b5d62=function(_0x3221f5){while(--_0x3221f5){_0x184636['push'](_0x184636['shift']());}};_0x3b5d62(++_0x536607);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x483822,_0xdb9051){var _0x371f0f=function(_0x13215f){while(--_0x13215f){_0x483822['push'](_0x483822['shift']());}};_0x371f0f(++_0xdb9051);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 634dc91..5720893 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 _0xf58b=['createFaxMessage','../client','Request','CreateFaxMessage'];(function(_0x5e62c1,_0x327ca2){var _0x12fde7=function(_0xc7a435){while(--_0xc7a435){_0x5e62c1['push'](_0x5e62c1['shift']());}};_0x12fde7(++_0x327ca2);}(_0xf58b,0x121));var _0xbf58=function(_0x412b2a,_0x11fb8a){_0x412b2a=_0x412b2a-0x0;var _0x5872e3=_0xf58b[_0x412b2a];return _0x5872e3;};'use strict';var client=require(_0xbf58('0x0'));exports['create']=function(_0x32da83){return client[_0xbf58('0x1')](_0xbf58('0x2'),{'body':_0x32da83,'log':_0xbf58('0x3')});}; \ No newline at end of file +var _0xea6e=['create','Request','CreateFaxMessage','../client'];(function(_0xa2e71f,_0x321600){var _0x459935=function(_0x50722b){while(--_0x50722b){_0xa2e71f['push'](_0xa2e71f['shift']());}};_0x459935(++_0x321600);}(_0xea6e,0x10f));var _0xeea6=function(_0x2b49e2,_0x6a5032){_0x2b49e2=_0x2b49e2-0x0;var _0x569bbb=_0xea6e[_0x2b49e2];return _0x569bbb;};'use strict';var client=require(_0xeea6('0x0'));exports[_0xeea6('0x1')]=function(_0x18988b){return client[_0xeea6('0x2')](_0xeea6('0x3'),{'body':_0x18988b,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 61f8800..5bdce22 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 _0x9cc6=['Agents','online','faxPause','../client','getFaxQueues','name','timeout','strategy'];(function(_0x550244,_0x1bee94){var _0x1d9dcd=function(_0x17409f){while(--_0x17409f){_0x550244['push'](_0x550244['shift']());}};_0x1d9dcd(++_0x1bee94);}(_0x9cc6,0xb3));var _0x69cc=function(_0x3cf4d3,_0x48065e){_0x3cf4d3=_0x3cf4d3-0x0;var _0x4e547b=_0x9cc6[_0x3cf4d3];return _0x4e547b;};'use strict';var client=require(_0x69cc('0x0'));exports[_0x69cc('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x69cc('0x2'),_0x69cc('0x3'),_0x69cc('0x4')],'include':[{'model':'User','as':_0x69cc('0x5'),'attributes':['id','name',_0x69cc('0x6'),_0x69cc('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x80f8=['getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User','Agents','faxPause'];(function(_0xf0928,_0x21f60a){var _0x1b00b0=function(_0x340cb0){while(--_0x340cb0){_0xf0928['push'](_0xf0928['shift']());}};_0x1b00b0(++_0x21f60a);}(_0x80f8,0xa2));var _0x880f=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x80f8[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require('../client');exports[_0x880f('0x0')]=function(){return function(){return client[_0x880f('0x1')](_0x880f('0x2'),{'options':{'raw':![],'attributes':['id',_0x880f('0x3'),_0x880f('0x4'),_0x880f('0x5')],'include':[{'model':_0x880f('0x6'),'as':_0x880f('0x7'),'attributes':['id','name','online',_0x880f('0x8')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index f9bc24e..3da87ad 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 _0xbd03=['../client','CreateFaxQueueReport','update','Request','UpdateFaxQueueReport'];(function(_0x48a0dd,_0x4b736b){var _0x1e4d82=function(_0x28dc0c){while(--_0x28dc0c){_0x48a0dd['push'](_0x48a0dd['shift']());}};_0x1e4d82(++_0x4b736b);}(_0xbd03,0x1bd));var _0x3bd0=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xbd03[_0xf0bcac];return _0x4e4c65;};'use strict';var client=require(_0x3bd0('0x0'));exports['create']=function(_0x185e5d){return client['Request']('CreateFaxQueueReport',{'body':_0x185e5d,'log':_0x3bd0('0x1')});};exports[_0x3bd0('0x2')]=function(_0x33ea28,_0x7b8855){return client[_0x3bd0('0x3')](_0x3bd0('0x4'),{'body':_0x7b8855,'options':{'where':{'uniqueid':_0x33ea28},'order':[['id','DESC']],'limit':0x1},'log':_0x3bd0('0x4')});}; \ No newline at end of file +var _0x35c8=['../client','Request','CreateFaxQueueReport','UpdateFaxQueueReport','DESC'];(function(_0x255e37,_0x620b55){var _0x5ad91d=function(_0x2da02d){while(--_0x2da02d){_0x255e37['push'](_0x255e37['shift']());}};_0x5ad91d(++_0x620b55);}(_0x35c8,0x69));var _0x835c=function(_0x46d777,_0x75644f){_0x46d777=_0x46d777-0x0;var _0x108543=_0x35c8[_0x46d777];return _0x108543;};'use strict';var client=require(_0x835c('0x0'));exports['create']=function(_0x4bcd75){return client[_0x835c('0x1')](_0x835c('0x2'),{'body':_0x4bcd75,'log':_0x835c('0x2')});};exports['update']=function(_0x153d36,_0x1c0bc5){return client[_0x835c('0x1')](_0x835c('0x3'),{'body':_0x1c0bc5,'options':{'where':{'uniqueid':_0x153d36},'order':[['id',_0x835c('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index b111451..8f2e1c6 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 _0x396f=['../client','getIntervals','Request','GetInterval','interval'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x396f,0x12c));var _0xf396=function(_0x475dcb,_0x1b0c5c){_0x475dcb=_0x475dcb-0x0;var _0x533633=_0x396f[_0x475dcb];return _0x533633;};'use strict';var client=require(_0xf396('0x0'));exports[_0xf396('0x1')]=function(){return function(){return client[_0xf396('0x2')](_0xf396('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':'Intervals','attributes':['id','name',_0xf396('0x4')]}]},'log':_0xf396('0x1')});};}; \ No newline at end of file +var _0x9eb7=['name','getIntervals','../client','Request','GetInterval','Intervals'];(function(_0x44932d,_0x169426){var _0x594fc4=function(_0x22eb05){while(--_0x22eb05){_0x44932d['push'](_0x44932d['shift']());}};_0x594fc4(++_0x169426);}(_0x9eb7,0x86));var _0x79eb=function(_0x46a9a3,_0x2f2af5){_0x46a9a3=_0x46a9a3-0x0;var _0x57ea6b=_0x9eb7[_0x46a9a3];return _0x57ea6b;};'use strict';var client=require(_0x79eb('0x0'));exports['getIntervals']=function(){return function(){return client[_0x79eb('0x1')](_0x79eb('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x79eb('0x3'),'attributes':['id',_0x79eb('0x4'),'interval']}]},'log':_0x79eb('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 22890db..3d0e7ad 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(_0x786fc2,_0x4b99c4){var _0x247acf=function(_0x23d795){while(--_0x23d795){_0x786fc2['push'](_0x786fc2['shift']());}};_0x247acf(++_0x4b99c4);}(_0x5b12,0xa3));var _0x25b1=function(_0x9e199e,_0x4c4f1e){_0x9e199e=_0x9e199e-0x0;var _0x194573=_0x5b12[_0x9e199e];return _0x194573;};'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 _0x8e3f=['UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x5d983c,_0x57b322){var _0x45d2f8=function(_0x4fb48d){while(--_0x4fb48d){_0x5d983c['push'](_0x5d983c['shift']());}};_0x45d2f8(++_0x57b322);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8e3f[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0xf8e3('0x0'));exports[_0xf8e3('0x1')]=function(_0x46e6a5,_0x4d334a){return client[_0xf8e3('0x2')](_0xf8e3('0x3'),{'body':_0x4d334a,'options':{'where':{'id':_0x46e6a5}},'log':_0xf8e3('0x4')});};exports['addTags']=function(_0x15d6ea,_0x41bc05){return client['Request'](_0xf8e3('0x5'),{'body':_0x41bc05,'options':{'where':{'id':_0x15d6ea}},'log':_0xf8e3('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 37ad254..4d644c5 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 _0xe3d1=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3d1,0x8f));var _0x1e3d=function(_0x106214,_0x454b8d){_0x106214=_0x106214-0x0;var _0x5f5cea=_0xe3d1[_0x106214];return _0x5f5cea;};'use strict';var client=require(_0x1e3d('0x0'));exports[_0x1e3d('0x1')]=function(_0x8f482c){return client[_0x1e3d('0x2')](_0x1e3d('0x3'),{'body':_0x8f482c,'log':_0x1e3d('0x4')});}; \ No newline at end of file +var _0x4f33=['Request','createMailMessage','../client'];(function(_0x2d42b7,_0x391076){var _0x3ac15a=function(_0x38ec34){while(--_0x38ec34){_0x2d42b7['push'](_0x2d42b7['shift']());}};_0x3ac15a(++_0x391076);}(_0x4f33,0x167));var _0x34f3=function(_0x2920dd,_0x19d049){_0x2920dd=_0x2920dd-0x0;var _0x5d4e52=_0x4f33[_0x2920dd];return _0x5d4e52;};'use strict';var client=require(_0x34f3('0x0'));exports['create']=function(_0x528653){return client[_0x34f3('0x1')]('CreateMailMessage',{'body':_0x528653,'log':_0x34f3('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 4ba2b4f..7eb1cc5 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 _0xddbd=['Request','GetMailQueue','strategy','Agents','name','online','mailPause','getMailQueues'];(function(_0x3ef2d5,_0x423d46){var _0x2fefb2=function(_0x54f82f){while(--_0x54f82f){_0x3ef2d5['push'](_0x3ef2d5['shift']());}};_0x2fefb2(++_0x423d46);}(_0xddbd,0x18f));var _0xdddb=function(_0x2f227c,_0x360c3a){_0x2f227c=_0x2f227c-0x0;var _0x5032bc=_0xddbd[_0x2f227c];return _0x5032bc;};'use strict';var client=require('../client');exports[_0xdddb('0x0')]=function(){return function(){return client[_0xdddb('0x1')](_0xdddb('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xdddb('0x3')],'include':[{'model':'User','as':_0xdddb('0x4'),'attributes':['id',_0xdddb('0x5'),_0xdddb('0x6'),_0xdddb('0x7')]}]},'log':_0xdddb('0x0')});};}; \ No newline at end of file +var _0xf1f7=['timeout','User','Agents','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name'];(function(_0x4b836d,_0x319cd3){var _0x49816f=function(_0x413189){while(--_0x413189){_0x4b836d['push'](_0x4b836d['shift']());}};_0x49816f(++_0x319cd3);}(_0xf1f7,0x113));var _0x7f1f=function(_0x3e573a,_0x5c899f){_0x3e573a=_0x3e573a-0x0;var _0x114143=_0xf1f7[_0x3e573a];return _0x114143;};'use strict';var client=require(_0x7f1f('0x0'));exports[_0x7f1f('0x1')]=function(){return function(){return client[_0x7f1f('0x2')](_0x7f1f('0x3'),{'options':{'raw':![],'attributes':['id',_0x7f1f('0x4'),_0x7f1f('0x5'),'strategy'],'include':[{'model':_0x7f1f('0x6'),'as':_0x7f1f('0x7'),'attributes':['id',_0x7f1f('0x4'),_0x7f1f('0x8'),_0x7f1f('0x9')]}]},'log':_0x7f1f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 3fa6a98..88f6f34 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 _0x8cb0=['UpdateMailQueueReport','create','Request','CreateMailQueueReport','update'];(function(_0x147208,_0x255f74){var _0x9daa52=function(_0x4360a3){while(--_0x4360a3){_0x147208['push'](_0x147208['shift']());}};_0x9daa52(++_0x255f74);}(_0x8cb0,0x14b));var _0x08cb=function(_0xf98a1,_0xcf1426){_0xf98a1=_0xf98a1-0x0;var _0xe81382=_0x8cb0[_0xf98a1];return _0xe81382;};'use strict';var client=require('../client');exports[_0x08cb('0x0')]=function(_0x1597a2){return client[_0x08cb('0x1')]('CreateMailQueueReport',{'body':_0x1597a2,'log':_0x08cb('0x2')});};exports[_0x08cb('0x3')]=function(_0x386f8a,_0x28899c){return client[_0x08cb('0x1')](_0x08cb('0x4'),{'body':_0x28899c,'options':{'where':{'uniqueid':_0x386f8a},'order':[['id','DESC']],'limit':0x1},'log':_0x08cb('0x4')});}; \ No newline at end of file +var _0xf34b=['update','UpdateMailQueueReport','DESC','create','Request','CreateMailQueueReport'];(function(_0x495974,_0x6b4aa4){var _0x1137d0=function(_0x1828a7){while(--_0x1828a7){_0x495974['push'](_0x495974['shift']());}};_0x1137d0(++_0x6b4aa4);}(_0xf34b,0x16b));var _0xbf34=function(_0x21488b,_0x3c62a5){_0x21488b=_0x21488b-0x0;var _0x1c1c59=_0xf34b[_0x21488b];return _0x1c1c59;};'use strict';var client=require('../client');exports[_0xbf34('0x0')]=function(_0x34aec9){return client[_0xbf34('0x1')](_0xbf34('0x2'),{'body':_0x34aec9,'log':_0xbf34('0x2')});};exports[_0xbf34('0x3')]=function(_0x5514a4,_0x34dbec){return client['Request'](_0xbf34('0x4'),{'body':_0x34dbec,'options':{'where':{'uniqueid':_0x5514a4},'order':[['id',_0xbf34('0x5')]],'limit':0x1},'log':_0xbf34('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 7c70850..9edc352 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 _0x663f=['../client','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x1e4e55,_0x537fd5){var _0x23ff83=function(_0x7dbb6c){while(--_0x7dbb6c){_0x1e4e55['push'](_0x1e4e55['shift']());}};_0x23ff83(++_0x537fd5);}(_0x663f,0x85));var _0xf663=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0x663f[_0x5f1cf8];return _0x27d0fa;};'use strict';var client=require(_0xf663('0x0'));exports['update']=function(_0x4b042a,_0x3c7170){return client['Request'](_0xf663('0x1'),{'body':_0x3c7170,'options':{'where':{'id':_0x4b042a}},'log':_0xf663('0x2')});};exports[_0xf663('0x3')]=function(_0x464f83,_0x1ade73){return client[_0xf663('0x4')](_0xf663('0x5'),{'body':_0x1ade73,'options':{'where':{'id':_0x464f83}},'log':_0xf663('0x6')});}; \ No newline at end of file +var _0xd353=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x2a6c69,_0x67b45f){var _0x2fe2a9=function(_0x4b297d){while(--_0x4b297d){_0x2a6c69['push'](_0x2a6c69['shift']());}};_0x2fe2a9(++_0x67b45f);}(_0xd353,0x135));var _0x3d35=function(_0x19c448,_0x25f428){_0x19c448=_0x19c448-0x0;var _0x47bf60=_0xd353[_0x19c448];return _0x47bf60;};'use strict';var client=require(_0x3d35('0x0'));exports[_0x3d35('0x1')]=function(_0xd09bc4,_0x196988){return client[_0x3d35('0x2')](_0x3d35('0x3'),{'body':_0x196988,'options':{'where':{'id':_0xd09bc4}},'log':_0x3d35('0x4')});};exports[_0x3d35('0x5')]=function(_0x180149,_0x4c229b){return client[_0x3d35('0x2')](_0x3d35('0x6'),{'body':_0x4c229b,'options':{'where':{'id':_0x180149}},'log':_0x3d35('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 5f1e8cd..362a0cd 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 _0xc459=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0x3e6d58,_0x187f7b){var _0x35c8d4=function(_0x4ccd7d){while(--_0x4ccd7d){_0x3e6d58['push'](_0x3e6d58['shift']());}};_0x35c8d4(++_0x187f7b);}(_0xc459,0xbf));var _0x9c45=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc459[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x9c45('0x0'));exports[_0x9c45('0x1')]=function(_0x33a734){return client[_0x9c45('0x2')](_0x9c45('0x3'),{'body':_0x33a734,'log':_0x9c45('0x4')});}; \ No newline at end of file +var _0x154d=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x276cd5,_0x3e7d72){var _0xa9c709=function(_0x2ec534){while(--_0x2ec534){_0x276cd5['push'](_0x276cd5['shift']());}};_0xa9c709(++_0x3e7d72);}(_0x154d,0x156));var _0xd154=function(_0xcfbe90,_0x44a83e){_0xcfbe90=_0xcfbe90-0x0;var _0x29ca1c=_0x154d[_0xcfbe90];return _0x29ca1c;};'use strict';var client=require(_0xd154('0x0'));exports[_0xd154('0x1')]=function(_0xc933d9){return client[_0xd154('0x2')](_0xd154('0x3'),{'body':_0xc933d9,'log':_0xd154('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 04ebdd9..9950da7 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 _0x4a97=['getOpenchannelQueues','../client','Request','GetOpenchannelQueue','name','timeout','User'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x4a97,0x1eb));var _0x74a9=function(_0x385c76,_0xb97335){_0x385c76=_0x385c76-0x0;var _0x5c8367=_0x4a97[_0x385c76];return _0x5c8367;};'use strict';var client=require(_0x74a9('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x74a9('0x1')](_0x74a9('0x2'),{'options':{'raw':![],'attributes':['id',_0x74a9('0x3'),_0x74a9('0x4'),'strategy'],'include':[{'model':_0x74a9('0x5'),'as':'Agents','attributes':['id',_0x74a9('0x3'),'online','openchannelPause']}]},'log':_0x74a9('0x6')});};}; \ No newline at end of file +var _0x1519=['online','openchannelPause','../client','getOpenchannelQueues','Request','name','timeout','strategy','User','Agents'];(function(_0x508917,_0x4a8f73){var _0x193f88=function(_0x392c7b){while(--_0x392c7b){_0x508917['push'](_0x508917['shift']());}};_0x193f88(++_0x4a8f73);}(_0x1519,0xd4));var _0x9151=function(_0x46bd68,_0x1daa12){_0x46bd68=_0x46bd68-0x0;var _0x57f173=_0x1519[_0x46bd68];return _0x57f173;};'use strict';var client=require(_0x9151('0x0'));exports[_0x9151('0x1')]=function(){return function(){return client[_0x9151('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x9151('0x3'),_0x9151('0x4'),_0x9151('0x5')],'include':[{'model':_0x9151('0x6'),'as':_0x9151('0x7'),'attributes':['id','name',_0x9151('0x8'),_0x9151('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 1daba29..9c6d385 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 _0xb477=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','create'];(function(_0x178d0c,_0x515a2c){var _0x433802=function(_0x380cba){while(--_0x380cba){_0x178d0c['push'](_0x178d0c['shift']());}};_0x433802(++_0x515a2c);}(_0xb477,0x8f));var _0x7b47=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xb477[_0x13e741];return _0x3f8bb3;};'use strict';var client=require('../client');exports[_0x7b47('0x0')]=function(_0x12a8af){return client[_0x7b47('0x1')]('CreateOpenchannelQueueReport',{'body':_0x12a8af,'log':_0x7b47('0x2')});};exports[_0x7b47('0x3')]=function(_0x178ba9,_0x5ccfb5){return client[_0x7b47('0x1')](_0x7b47('0x4'),{'body':_0x5ccfb5,'options':{'where':{'uniqueid':_0x178ba9},'order':[['id',_0x7b47('0x5')]],'limit':0x1},'log':_0x7b47('0x4')});}; \ No newline at end of file +var _0xbc48=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','create','Request'];(function(_0x4f32c8,_0x13d103){var _0x174107=function(_0x52d6dc){while(--_0x52d6dc){_0x4f32c8['push'](_0x4f32c8['shift']());}};_0x174107(++_0x13d103);}(_0xbc48,0x16b));var _0x8bc4=function(_0xe10c3e,_0x336f40){_0xe10c3e=_0xe10c3e-0x0;var _0x5608e1=_0xbc48[_0xe10c3e];return _0x5608e1;};'use strict';var client=require('../client');exports[_0x8bc4('0x0')]=function(_0x1e32b8){return client[_0x8bc4('0x1')]('CreateOpenchannelQueueReport',{'body':_0x1e32b8,'log':_0x8bc4('0x2')});};exports['update']=function(_0x4043f6,_0xdd2942){return client[_0x8bc4('0x1')](_0x8bc4('0x3'),{'body':_0xdd2942,'options':{'where':{'uniqueid':_0x4043f6},'order':[['id',_0x8bc4('0x4')]],'limit':0x1},'log':_0x8bc4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 70bf01e..dae84d7 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 _0x919e=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x3382e5,_0x4bfaa8){var _0x5efe1a=function(_0x78eb1e){while(--_0x78eb1e){_0x3382e5['push'](_0x3382e5['shift']());}};_0x5efe1a(++_0x4bfaa8);}(_0x919e,0x1d7));var _0xe919=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x919e[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xe919('0x0'));exports[_0xe919('0x1')]=function(_0x24d2f4,_0x5d7d06){return client[_0xe919('0x2')]('UpdateSmsInteraction',{'body':_0x5d7d06,'options':{'where':{'id':_0x24d2f4}},'log':'updateSmsInteraction'});};exports[_0xe919('0x3')]=function(_0x3a1192,_0x2bf552){return client[_0xe919('0x2')](_0xe919('0x4'),{'body':_0x2bf552,'options':{'where':{'id':_0x3a1192}},'log':_0xe919('0x5')});}; \ No newline at end of file +var _0x12cc=['Request','UpdateSmsInteraction','update'];(function(_0x32bfba,_0x1baecb){var _0xed0ac1=function(_0x4532d4){while(--_0x4532d4){_0x32bfba['push'](_0x32bfba['shift']());}};_0xed0ac1(++_0x1baecb);}(_0x12cc,0xc2));var _0xc12c=function(_0x1cadfc,_0xf03dbb){_0x1cadfc=_0x1cadfc-0x0;var _0x50f55c=_0x12cc[_0x1cadfc];return _0x50f55c;};'use strict';var client=require('../client');exports[_0xc12c('0x0')]=function(_0x3183a9,_0x265de9){return client[_0xc12c('0x1')](_0xc12c('0x2'),{'body':_0x265de9,'options':{'where':{'id':_0x3183a9}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x3e773c,_0x914c7e){return client['Request']('AddTagsToSmsInteraction',{'body':_0x914c7e,'options':{'where':{'id':_0x3e773c}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 2f5a61e..e793c25 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 _0x0583=['../client','Request'];(function(_0x51c72f,_0x26ff76){var _0x53fccd=function(_0x3146a1){while(--_0x3146a1){_0x51c72f['push'](_0x51c72f['shift']());}};_0x53fccd(++_0x26ff76);}(_0x0583,0x12c));var _0x3058=function(_0x573a1c,_0x3a475d){_0x573a1c=_0x573a1c-0x0;var _0x1a5aab=_0x0583[_0x573a1c];return _0x1a5aab;};'use strict';var client=require(_0x3058('0x0'));exports['create']=function(_0x57eec4){return client[_0x3058('0x1')]('CreateSmsMessage',{'body':_0x57eec4,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x451b=['create','Request','CreateSmsMessage','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x451b,0x6f));var _0xb451=function(_0x27ca4a,_0x30ab11){_0x27ca4a=_0x27ca4a-0x0;var _0x238030=_0x451b[_0x27ca4a];return _0x238030;};'use strict';var client=require(_0xb451('0x0'));exports[_0xb451('0x1')]=function(_0x3bcae2){return client[_0xb451('0x2')](_0xb451('0x3'),{'body':_0x3bcae2,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index ac11b29..d82356b 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 _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x4e6081,_0x5439c0){var _0x34e766=function(_0x4cabe7){while(--_0x4cabe7){_0x4e6081['push'](_0x4e6081['shift']());}};_0x34e766(++_0x5439c0);}(_0xb7e7,0x121));var _0x7b7e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xb7e7[_0x13ea00];return _0x1f7347;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x219c03,_0x5380e4){var _0x26d40c=function(_0x376fdf){while(--_0x376fdf){_0x219c03['push'](_0x219c03['shift']());}};_0x26d40c(++_0x5380e4);}(_0xe706,0xa3));var _0x6e70=function(_0x44474f,_0x431580){_0x44474f=_0x44474f-0x0;var _0x427d97=_0xe706[_0x44474f];return _0x427d97;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 0914e6b..903deee 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 _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x1e4c55,_0x1415eb){var _0x511ab5=function(_0x2958cb){while(--_0x2958cb){_0x1e4c55['push'](_0x1e4c55['shift']());}};_0x511ab5(++_0x1415eb);}(_0x008c,0x188));var _0xc008=function(_0x1eff1a,_0x5d05a9){_0x1eff1a=_0x1eff1a-0x0;var _0x478b4b=_0x008c[_0x1eff1a];return _0x478b4b;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file +var _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0xe8fa1f,_0x12bba1){var _0x4b3a65=function(_0x3f5161){while(--_0x3f5161){_0xe8fa1f['push'](_0xe8fa1f['shift']());}};_0x4b3a65(++_0x12bba1);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index da92a16..eb32026 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(_0x36eeb5,_0x37a23c){var _0x3be311=function(_0x2af67e){while(--_0x2af67e){_0x36eeb5['push'](_0x36eeb5['shift']());}};_0x3be311(++_0x37a23c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x158ef0,_0x38a170){var _0x44ba51=function(_0x4b718d){while(--_0x4b718d){_0x158ef0['push'](_0x158ef0['shift']());}};_0x44ba51(++_0x38a170);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 cdde9dd..1a3e316 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 _0x9536=['update','UpdateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','../client'];(function(_0x330258,_0x341000){var _0x13e1f3=function(_0x589c63){while(--_0x589c63){_0x330258['push'](_0x330258['shift']());}};_0x13e1f3(++_0x341000);}(_0x9536,0x179));var _0x6953=function(_0x2f6f50,_0x1d21a7){_0x2f6f50=_0x2f6f50-0x0;var _0x2cf365=_0x9536[_0x2f6f50];return _0x2cf365;};'use strict';var client=require(_0x6953('0x0'));exports[_0x6953('0x1')]=function(_0x1a1c4e,_0x40b3c3){return client['Request'](_0x6953('0x2'),{'body':_0x40b3c3,'options':{'where':{'id':_0x1a1c4e}},'log':'updateWhatsappInteraction'});};exports[_0x6953('0x3')]=function(_0x3c32c7,_0x1dee7c){return client[_0x6953('0x4')](_0x6953('0x5'),{'body':_0x1dee7c,'options':{'where':{'id':_0x3c32c7}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x6365=['update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x1e4f8b,_0xfc42fb){var _0x5878cd=function(_0xf849c2){while(--_0xf849c2){_0x1e4f8b['push'](_0x1e4f8b['shift']());}};_0x5878cd(++_0xfc42fb);}(_0x6365,0x148));var _0x5636=function(_0x22328b,_0x36018e){_0x22328b=_0x22328b-0x0;var _0x1a11d4=_0x6365[_0x22328b];return _0x1a11d4;};'use strict';var client=require(_0x5636('0x0'));exports[_0x5636('0x1')]=function(_0x3212a5,_0x1c3ebf){return client['Request'](_0x5636('0x2'),{'body':_0x1c3ebf,'options':{'where':{'id':_0x3212a5}},'log':_0x5636('0x3')});};exports[_0x5636('0x4')]=function(_0x27e6da,_0x34ca1e){return client['Request'](_0x5636('0x5'),{'body':_0x34ca1e,'options':{'where':{'id':_0x27e6da}},'log':_0x5636('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 71da0f1..e59518e 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 _0xfe3c=['CreateWhatsappMessage','createWhatsappMessage','../client','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe3c,0xaa));var _0xcfe3=function(_0x5803b3,_0x442c0f){_0x5803b3=_0x5803b3-0x0;var _0x886163=_0xfe3c[_0x5803b3];return _0x886163;};'use strict';var client=require(_0xcfe3('0x0'));exports['create']=function(_0x415183){return client[_0xcfe3('0x1')](_0xcfe3('0x2'),{'body':_0x415183,'log':_0xcfe3('0x3')});}; \ No newline at end of file +var _0x0539=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x374eff,_0x36bcae){var _0x5f47d5=function(_0x33437a){while(--_0x33437a){_0x374eff['push'](_0x374eff['shift']());}};_0x5f47d5(++_0x36bcae);}(_0x0539,0x151));var _0x9053=function(_0x53c594,_0x368bd5){_0x53c594=_0x53c594-0x0;var _0x311272=_0x0539[_0x53c594];return _0x311272;};'use strict';var client=require(_0x9053('0x0'));exports[_0x9053('0x1')]=function(_0x9004e7){return client[_0x9053('0x2')](_0x9053('0x3'),{'body':_0x9004e7,'log':_0x9053('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index f9dc76c..bf0bbf0 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 _0x8237=['GetWhatsappQueue','name','strategy','User','Agents','online','getWhatsappQueues','../client'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x8237,0x117));var _0x7823=function(_0xbe4273,_0x5694a4){_0xbe4273=_0xbe4273-0x0;var _0x14d8b7=_0x8237[_0xbe4273];return _0x14d8b7;};'use strict';var client=require(_0x7823('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x7823('0x1'),{'options':{'raw':![],'attributes':['id',_0x7823('0x2'),'timeout',_0x7823('0x3')],'include':[{'model':_0x7823('0x4'),'as':_0x7823('0x5'),'attributes':['id','name',_0x7823('0x6'),'whatsappPause']}]},'log':_0x7823('0x7')});};}; \ No newline at end of file +var _0x22cb=['Request','name','timeout','strategy','User','online','whatsappPause','getWhatsappQueues'];(function(_0x25a1ac,_0x113c18){var _0x13ea3a=function(_0x91718d){while(--_0x91718d){_0x25a1ac['push'](_0x25a1ac['shift']());}};_0x13ea3a(++_0x113c18);}(_0x22cb,0x1a7));var _0xb22c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x22cb[_0xfae23b];return _0x200640;};'use strict';var client=require('../client');exports[_0xb22c('0x0')]=function(){return function(){return client[_0xb22c('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xb22c('0x2'),_0xb22c('0x3'),_0xb22c('0x4')],'include':[{'model':_0xb22c('0x5'),'as':'Agents','attributes':['id',_0xb22c('0x2'),_0xb22c('0x6'),_0xb22c('0x7')]}]},'log':_0xb22c('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index ad26f0c..39a30ba 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 _0xa981=['create','CreateWhatsappQueueReport','Request','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x432169,_0x7ffbe9){var _0x28e745=function(_0x810c68){while(--_0x810c68){_0x432169['push'](_0x432169['shift']());}};_0x28e745(++_0x7ffbe9);}(_0xa981,0x1c7));var _0x1a98=function(_0x169e53,_0x46be55){_0x169e53=_0x169e53-0x0;var _0x252bb3=_0xa981[_0x169e53];return _0x252bb3;};'use strict';var client=require(_0x1a98('0x0'));exports[_0x1a98('0x1')]=function(_0x162a00){return client['Request'](_0x1a98('0x2'),{'body':_0x162a00,'log':_0x1a98('0x2')});};exports['update']=function(_0x54a5b5,_0x13e94d){return client[_0x1a98('0x3')](_0x1a98('0x4'),{'body':_0x13e94d,'options':{'where':{'uniqueid':_0x54a5b5},'order':[['id',_0x1a98('0x5')]],'limit':0x1},'log':_0x1a98('0x4')});}; \ No newline at end of file +var _0xb0f8=['DESC','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x3edc2f,_0x253e32){var _0x143fa2=function(_0x2fe97b){while(--_0x2fe97b){_0x3edc2f['push'](_0x3edc2f['shift']());}};_0x143fa2(++_0x253e32);}(_0xb0f8,0xec));var _0x8b0f=function(_0x22f3f0,_0x5f0e1d){_0x22f3f0=_0x22f3f0-0x0;var _0x520c3a=_0xb0f8[_0x22f3f0];return _0x520c3a;};'use strict';var client=require('../client');exports['create']=function(_0x10f91c){return client[_0x8b0f('0x0')](_0x8b0f('0x1'),{'body':_0x10f91c,'log':_0x8b0f('0x1')});};exports[_0x8b0f('0x2')]=function(_0xbb983d,_0x54cb1c){return client[_0x8b0f('0x0')](_0x8b0f('0x3'),{'body':_0x54cb1c,'options':{'where':{'uniqueid':_0xbb983d},'order':[['id',_0x8b0f('0x4')]],'limit':0x1},'log':_0x8b0f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 58a264c..9bbedc3 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 _0x6206=['find','agents','timeout','channel','format','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stop','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','message','join'];(function(_0x3ee76e,_0x3c76da){var _0x389187=function(_0x2bd529){while(--_0x2bd529){_0x3ee76e['push'](_0x3ee76e['shift']());}};_0x389187(++_0x3c76da);}(_0x6206,0x127));var _0x6620=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x6206[_0x3e44fa];return _0x2a0aba;};'use strict';var schema=require(_0x6620('0x0'));var _=require(_0x6620('0x1'));var util=require(_0x6620('0x2'));var seqqueue=require(_0x6620('0x3'));var logger=require('../../../../config/logger')(_0x6620('0x4'));var strategy=require(_0x6620('0x5'));var queue=schema({'name':{'type':_0x6620('0x6'),'required':!![],'message':_0x6620('0x7')},'timeout':{'type':_0x6620('0x8'),'message':_0x6620('0x9')}});function writeLog(_0x5ba920,_0x4bbfcd,_0xa5169){return logger[_0x6620('0xa')](util['format'](_0x6620('0xb'),_0x5ba920,_0x4bbfcd['name'],_0xa5169));}function handleFindAgent(_0x20d97){return function(_0xd30a5e){return _0xd30a5e[_0x6620('0xc')]['toLowerCase']()===_0x20d97[_0x6620('0xd')]();};}exports[_0x6620('0xe')]=function(_0x41a619,_0x942f93,_0x2f15e4,_0x2fb4bc){return function(_0xf283ac){try{var _0x1cd668={'name':_0x942f93[0x0],'timeout':_0x942f93[0x1]};var _0x529807=queue[_0x6620('0x0')](_0x1cd668,{'typecast':!![]});if(_0x529807[_0x6620('0xf')]){logger[_0x6620('0x10')]('[%s][AGENT]\x20%s',_0x41a619,_[_0x6620('0x11')](_0x529807,_0x6620('0x12'))[_0x6620('0x13')](',\x20'));_0xf283ac['stop']();}else{var _0x3c9637=_[_0x6620('0x14')](_0x2f15e4[_0x6620('0x15')],handleFindAgent(_0x1cd668[_0x6620('0xc')]));if(_0x3c9637){var _0x390f62=(_0x1cd668[_0x6620('0x16')]||0xa)*0x3e8;var _0x13dd12,_0x29f5d2;var _0x2f65c9=seqqueue['createQueue'](_0x390f62);_0x2f65c9['id']=_0x41a619;_0x2f65c9['atimeout']=_0x390f62;_0x2f65c9[_0x6620('0x17')]=_0x2fb4bc[_0x6620('0x17')];writeLog(_0x41a619,_0x3c9637,util[_0x6620('0x18')](_0x6620('0x19'),_0x390f62));_0x2f15e4[_0x6620('0x1a')][_0x41a619]['on'](_0x6620('0x1b'),function(){logger[_0x6620('0xa')](_0x6620('0x1c'),_0x41a619);clearTimeout(_0x29f5d2);_0x29f5d2=undefined;_0x2f65c9[_0x6620('0x1d')]();if(_0x2f15e4[_0x6620('0x1a')][_0x41a619]){delete _0x2f15e4['rules'][_0x41a619];}_0xf283ac['stop']();});_0x2f15e4['rules'][_0x41a619]['on'](_0x6620('0x1e'),function(){if(_0x2f15e4[_0x6620('0x1a')][_0x41a619]){delete _0x2f15e4[_0x6620('0x1a')][_0x41a619];}});_0x29f5d2=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x41a619);clearTimeout(_0x29f5d2);_0x2f65c9[_0x6620('0x1d')]();_0xf283ac['next']();},_0x390f62);strategy[_0x6620('0x1f')](_0x2f65c9,_0x3c9637,_0x2f15e4,_0x2fb4bc);}else{logger[_0x6620('0x10')](_0x6620('0x20'),_0x41a619,_0x1cd668['name']);_0xf283ac[_0x6620('0x21')]();}}}catch(_0x63b4dc){console['log'](_0x63b4dc);logger[_0x6620('0x10')](_0x6620('0x22'),_0x41a619,_0x63b4dc['stack']);_0xf283ac[_0x6620('0x21')]();}};}; \ No newline at end of file +var _0x352c=['stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','message','join','stop','find','timeout','createQueue','atimeout','START:%s','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','info','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s'];(function(_0xb795fa,_0x1b0e8c){var _0x10a27a=function(_0x435025){while(--_0x435025){_0xb795fa['push'](_0xb795fa['shift']());}};_0x10a27a(++_0x1b0e8c);}(_0x352c,0xcd));var _0xc352=function(_0xaeff8a,_0x506724){_0xaeff8a=_0xaeff8a-0x0;var _0x8a6ce3=_0x352c[_0xaeff8a];return _0x8a6ce3;};'use strict';var schema=require(_0xc352('0x0'));var _=require(_0xc352('0x1'));var util=require(_0xc352('0x2'));var seqqueue=require(_0xc352('0x3'));var logger=require(_0xc352('0x4'))(_0xc352('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xc352('0x6'),'required':!![],'message':_0xc352('0x7')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x15eccb,_0x845b5,_0x1eaa87){return logger['info'](util[_0xc352('0x8')](_0xc352('0x9'),_0x15eccb,_0x845b5['name'],_0x1eaa87));}function handleFindAgent(_0x42330d){return function(_0x3793c3){return _0x3793c3[_0xc352('0xa')]['toLowerCase']()===_0x42330d[_0xc352('0xb')]();};}exports[_0xc352('0xc')]=function(_0x4b55a6,_0x68f1ab,_0x2061cb,_0x1ef6ed){return function(_0x71d488){try{var _0x428bfa={'name':_0x68f1ab[0x0],'timeout':_0x68f1ab[0x1]};var _0xbd772a=queue['validate'](_0x428bfa,{'typecast':!![]});if(_0xbd772a[_0xc352('0xd')]){logger[_0xc352('0xe')]('[%s][AGENT]\x20%s',_0x4b55a6,_[_0xc352('0xf')](_0xbd772a,_0xc352('0x10'))[_0xc352('0x11')](',\x20'));_0x71d488[_0xc352('0x12')]();}else{var _0x3b4f7d=_[_0xc352('0x13')](_0x2061cb['agents'],handleFindAgent(_0x428bfa[_0xc352('0xa')]));if(_0x3b4f7d){var _0x1ba976=(_0x428bfa[_0xc352('0x14')]||0xa)*0x3e8;var _0x20a1f8,_0x3585b1;var _0x291d0a=seqqueue[_0xc352('0x15')](_0x1ba976);_0x291d0a['id']=_0x4b55a6;_0x291d0a[_0xc352('0x16')]=_0x1ba976;_0x291d0a['channel']=_0x1ef6ed['channel'];writeLog(_0x4b55a6,_0x3b4f7d,util[_0xc352('0x8')](_0xc352('0x17'),_0x1ba976));_0x2061cb['rules'][_0x4b55a6]['on']('end',function(){logger['info'](_0xc352('0x18'),_0x4b55a6);clearTimeout(_0x3585b1);_0x3585b1=undefined;_0x291d0a[_0xc352('0x19')]();if(_0x2061cb[_0xc352('0x1a')][_0x4b55a6]){delete _0x2061cb[_0xc352('0x1a')][_0x4b55a6];}_0x71d488[_0xc352('0x12')]();});_0x2061cb[_0xc352('0x1a')][_0x4b55a6]['on']('complete',function(){if(_0x2061cb[_0xc352('0x1a')][_0x4b55a6]){delete _0x2061cb[_0xc352('0x1a')][_0x4b55a6];}});_0x3585b1=setTimeout(function(){logger[_0xc352('0x1b')](_0xc352('0x1c'),_0x4b55a6);clearTimeout(_0x3585b1);_0x291d0a[_0xc352('0x19')]();_0x71d488[_0xc352('0x1d')]();},_0x1ba976);strategy['agent'](_0x291d0a,_0x3b4f7d,_0x2061cb,_0x1ef6ed);}else{logger[_0xc352('0xe')](_0xc352('0x1e'),_0x4b55a6,_0x428bfa[_0xc352('0xa')]);_0x71d488[_0xc352('0x12')]();}}}catch(_0x528176){console[_0xc352('0x1f')](_0x528176);logger[_0xc352('0xe')](_0xc352('0x20'),_0x4b55a6,_0x528176[_0xc352('0x21')]);_0x71d488['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 5da6df9..e5a6f79 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 _0x0a65=['phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','body','then','info','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','$LATEST','message','toString','postText','next','providerName','amazonlex','providerResponse','stringify','Message','create','dialogState','Failed','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp'];(function(_0x8df31,_0x5e7d99){var _0x244dbf=function(_0x367488){while(--_0x367488){_0x8df31['push'](_0x8df31['shift']());}};_0x244dbf(++_0x5e7d99);}(_0x0a65,0xb0));var _0x50a6=function(_0x1e7b70,_0x6a276b){_0x1e7b70=_0x1e7b70-0x0;var _0x4142d6=_0x0a65[_0x1e7b70];return _0x4142d6;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require(_0x50a6('0x0'));var utils=require(_0x50a6('0x1'));var logger=require(_0x50a6('0x2'))(_0x50a6('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x50a6('0x4')),'mailMessage':require(_0x50a6('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x50a6('0x6')),'whatsappMessage':require(_0x50a6('0x7'))};exports['consequence']=function(_0x4b6b34,_0x441ee2){return function(_0xd9ba9a){try{if(!_[_0x50a6('0x8')](this[_0x50a6('0x9')][_0x50a6('0xa')])){logger['info'](_0x50a6('0xb'),_0x4b6b34,_0x50a6('0xc'));return _0xd9ba9a['next']();}var _0x46ba0a={'ContactId':this[_0x50a6('0xd')]['id'],'sentAt':moment()[_0x50a6('0xe')](_0x50a6('0xf')),'direction':_0x50a6('0x10')};if(this[_0x50a6('0x11')]===_0x50a6('0x12')||this[_0x50a6('0x11')]===_0x50a6('0x13')){_0x46ba0a[_0x50a6('0x14')]=this[_0x50a6('0x9')][_0x50a6('0x14')];}var _0x2b7749=this[_0x50a6('0x11')];if(_0x2b7749===_0x50a6('0x15')){_0x46ba0a[_0x50a6('0x16')]=this[_0x50a6('0x17')]['id'];}else{_0x46ba0a[_[_0x50a6('0x18')](_0x2b7749)+_0x50a6('0x19')]=this[_0x50a6('0x17')]['id'];}_0x46ba0a[_[_0x50a6('0x18')](_0x2b7749)+'InteractionId']=this['interaction']['id'];if(this[_0x50a6('0x9')][_0x50a6('0x1a')]){var _0xebc3e7=_0x441ee2[0x4];if(!_['isEmpty'](_0xebc3e7)){_0x46ba0a[_0x50a6('0x1b')]=utils['getMustacheRender'](_0xebc3e7,this);return rpc[_0x2b7749+'Message']['create'](_0x46ba0a)[_0x50a6('0x1c')](function(_0x38f18c){logger[_0x50a6('0x1d')](_0x50a6('0xb'),_0x4b6b34,_0x46ba0a[_0x50a6('0x1b')]);})[_0x50a6('0x1e')](function(_0x4f525c){logger[_0x50a6('0x1f')](_0x50a6('0xb'),_0x4b6b34,JSON['stringify'](_0x4f525c));})[_0x50a6('0x20')](function(){logger['info'](_0x50a6('0x21'),_0x4b6b34);_0xd9ba9a['stop']();});}else{logger['info'](_0x50a6('0x22'),_0x4b6b34);_0xd9ba9a[_0x50a6('0x23')]();}}else{var _0x5e9e29=this;var _0x5b62c1=new AWS['LexRuntime']({'accessKeyId':_0x441ee2[0x0],'secretAccessKey':_0x441ee2[0x1],'region':_0x441ee2[0x2]});var _0x3db1f1={'botAlias':_0x50a6('0x24'),'botName':_0x441ee2[0x3],'inputText':this[_0x50a6('0x25')][_0x50a6('0x1b')],'userId':this[_0x50a6('0x11')]+':'+this[_0x50a6('0x9')]['id'][_0x50a6('0x26')]()};_0x5b62c1[_0x50a6('0x27')](_0x3db1f1,function(_0x25fbac,_0x4b04d9){if(_0x25fbac){logger[_0x50a6('0x1f')](_0x50a6('0xb'),_0x4b6b34,_0x25fbac[_0x50a6('0x25')]);_0xd9ba9a[_0x50a6('0x28')]();}else if(_0x4b04d9&&_0x4b04d9[_0x50a6('0x25')]){_0x5e9e29[_0x50a6('0x1b')]['amazonlex']=_0x4b04d9;_0x46ba0a['body']=_0x4b04d9['message'];_0x46ba0a[_0x50a6('0x29')]=_0x50a6('0x2a');_0x46ba0a[_0x50a6('0x2b')]=JSON[_0x50a6('0x2c')](_0x4b04d9);return rpc[_0x2b7749+_0x50a6('0x2d')][_0x50a6('0x2e')](_0x46ba0a)[_0x50a6('0x1c')](function(_0x2463c2){logger[_0x50a6('0x1d')](_0x50a6('0xb'),_0x4b6b34,_0x46ba0a[_0x50a6('0x1b')]);if(_0x4b04d9[_0x50a6('0x2f')]==_0x50a6('0x30')){_0xd9ba9a[_0x50a6('0x28')]();}else{_0xd9ba9a['stop']();}})[_0x50a6('0x1e')](function(_0x14a4da){logger[_0x50a6('0x1f')](_0x50a6('0xb'),_0x4b6b34,JSON[_0x50a6('0x2c')](_0x14a4da));_0xd9ba9a[_0x50a6('0x28')]();});}else{_0xd9ba9a[_0x50a6('0x28')]();}});}}catch(_0x479700){logger[_0x50a6('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x4b6b34,JSON[_0x50a6('0x2c')](_0x479700));_0xd9ba9a[_0x50a6('0x23')]();}};}; \ No newline at end of file +var _0xdef5=['contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','account','upperFirst','InteractionId','created','isEmpty','Message','create','then','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','body','toString','postText','providerName','amazonlex','dialogState','Failed','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0xdef5,0x115));var _0x5def=function(_0x5bb91c,_0x41406d){_0x5bb91c=_0x5bb91c-0x0;var _0x41211f=_0xdef5[_0x5bb91c];return _0x41211f;};'use strict';var _=require(_0x5def('0x0'));var moment=require(_0x5def('0x1'));var AWS=require('aws-sdk');var utils=require(_0x5def('0x2'));var logger=require(_0x5def('0x3'))(_0x5def('0x4'));var rpc={'chatMessage':require(_0x5def('0x5')),'openchannelMessage':require(_0x5def('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x5def('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5def('0x8'))};exports[_0x5def('0x9')]=function(_0x558c9b,_0x4c06e2){return function(_0xe89fca){try{if(!_[_0x5def('0xa')](this[_0x5def('0xb')][_0x5def('0xc')])){logger[_0x5def('0xd')](_0x5def('0xe'),_0x558c9b,_0x5def('0xf'));return _0xe89fca[_0x5def('0x10')]();}var _0x2207ff={'ContactId':this[_0x5def('0x11')]['id'],'sentAt':moment()[_0x5def('0x12')](_0x5def('0x13')),'direction':_0x5def('0x14')};if(this[_0x5def('0x15')]===_0x5def('0x16')||this[_0x5def('0x15')]===_0x5def('0x17')){_0x2207ff[_0x5def('0x18')]=this[_0x5def('0xb')]['phone'];}var _0x2dbac2=this[_0x5def('0x15')];if(_0x2dbac2===_0x5def('0x19')){_0x2207ff['ChatWebsiteId']=this[_0x5def('0x1a')]['id'];}else{_0x2207ff[_[_0x5def('0x1b')](_0x2dbac2)+'AccountId']=this[_0x5def('0x1a')]['id'];}_0x2207ff[_[_0x5def('0x1b')](_0x2dbac2)+_0x5def('0x1c')]=this['interaction']['id'];if(this[_0x5def('0xb')][_0x5def('0x1d')]){var _0x11c099=_0x4c06e2[0x4];if(!_[_0x5def('0x1e')](_0x11c099)){_0x2207ff['body']=utils['getMustacheRender'](_0x11c099,this);return rpc[_0x2dbac2+_0x5def('0x1f')][_0x5def('0x20')](_0x2207ff)[_0x5def('0x21')](function(_0x5e52e6){logger[_0x5def('0xd')]('[%s][AMAZONLEX]\x20%s',_0x558c9b,_0x2207ff['body']);})[_0x5def('0x22')](function(_0x189e6d){logger[_0x5def('0x23')](_0x5def('0xe'),_0x558c9b,JSON[_0x5def('0x24')](_0x189e6d));})['finally'](function(){logger['info'](_0x5def('0x25'),_0x558c9b);_0xe89fca[_0x5def('0x26')]();});}else{logger[_0x5def('0xd')](_0x5def('0x27'),_0x558c9b);_0xe89fca[_0x5def('0x26')]();}}else{var _0x4cac58=this;var _0x3ce648=new AWS[(_0x5def('0x28'))]({'accessKeyId':_0x4c06e2[0x0],'secretAccessKey':_0x4c06e2[0x1],'region':_0x4c06e2[0x2]});var _0x5ad380={'botAlias':'$LATEST','botName':_0x4c06e2[0x3],'inputText':this[_0x5def('0x29')][_0x5def('0x2a')],'userId':this[_0x5def('0x15')]+':'+this[_0x5def('0xb')]['id'][_0x5def('0x2b')]()};_0x3ce648[_0x5def('0x2c')](_0x5ad380,function(_0x50c464,_0x4788b9){if(_0x50c464){logger['error'](_0x5def('0xe'),_0x558c9b,_0x50c464[_0x5def('0x29')]);_0xe89fca[_0x5def('0x10')]();}else if(_0x4788b9&&_0x4788b9[_0x5def('0x29')]){_0x4cac58[_0x5def('0x2a')]['amazonlex']=_0x4788b9;_0x2207ff[_0x5def('0x2a')]=_0x4788b9[_0x5def('0x29')];_0x2207ff[_0x5def('0x2d')]=_0x5def('0x2e');_0x2207ff['providerResponse']=JSON['stringify'](_0x4788b9);return rpc[_0x2dbac2+_0x5def('0x1f')]['create'](_0x2207ff)[_0x5def('0x21')](function(_0x27a2f8){logger[_0x5def('0xd')](_0x5def('0xe'),_0x558c9b,_0x2207ff[_0x5def('0x2a')]);if(_0x4788b9[_0x5def('0x2f')]==_0x5def('0x30')){_0xe89fca['next']();}else{_0xe89fca[_0x5def('0x26')]();}})[_0x5def('0x22')](function(_0x7492af){logger[_0x5def('0x23')]('[%s][AMAZONLEX]\x20%s',_0x558c9b,JSON[_0x5def('0x24')](_0x7492af));_0xe89fca[_0x5def('0x10')]();});}else{_0xe89fca[_0x5def('0x10')]();}});}}catch(_0x248bd9){logger[_0x5def('0x23')](_0x5def('0xe'),_0x558c9b,JSON[_0x5def('0x24')](_0x248bd9));_0xe89fca[_0x5def('0x26')]();}};}; \ 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 8cc3e6b..9d174e3 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 _0x7d92=['Re:','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','Message','inReplyTo','messageId','html','','replace','auto-replied','All','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','format','out','getMustacheRender','message','from','phone','subject','startsWith'];(function(_0x2d2258,_0x2ce510){var _0x18e155=function(_0x11949e){while(--_0x11949e){_0x2d2258['push'](_0x2d2258['shift']());}};_0x18e155(++_0x2ce510);}(_0x7d92,0x9f));var _0x27d9=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x7d92[_0x1cd47d];return _0x29d52f;};'use strict';var _=require(_0x27d9('0x0'));var moment=require(_0x27d9('0x1'));var utils=require(_0x27d9('0x2'));var logger=require(_0x27d9('0x3'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x27d9('0x4')),'mailMessage':require(_0x27d9('0x5')),'smsMessage':require(_0x27d9('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x27d9('0x7')),'chatInteraction':require(_0x27d9('0x8')),'openchannelInteraction':require(_0x27d9('0x9')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x27d9('0xa')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x27d9('0xb'))};var mailRpc=require(_0x27d9('0xc'));exports[_0x27d9('0xd')]=function(_0x5205b1,_0x5a9813,_0x383cc8,_0xb7755e){return function(_0x26fe7e){try{var _0x30d631=this[_0x27d9('0xe')];if(_0x30d631===_0x27d9('0xf')&&_0xb7755e[_0x27d9('0x10')][_0x27d9('0x11')]){logger[_0x27d9('0x12')]('[%s][AUTOREPLY]\x20%s',_0x5205b1,_0x27d9('0x13'));return _0x26fe7e[_0x27d9('0x14')]();}if(_0x5a9813[0x0]==='1'&&(_['isNil'](this[_0x27d9('0x15')][_0x27d9('0x16')])||!this[_0x27d9('0x15')][_0x27d9('0x16')])){logger[_0x27d9('0x12')](_0x27d9('0x17'),_0x5205b1,_0x27d9('0x18'));return _0x26fe7e[_0x27d9('0x14')]();}if(_0x5a9813[0x0]==='2'&&this[_0x27d9('0x15')][_0x27d9('0x19')]){logger[_0x27d9('0x12')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x5205b1,_0x27d9('0x1a'));return _0x26fe7e[_0x27d9('0x14')]();}var _0x1126a3={'ContactId':this[_0x27d9('0x1b')]['id'],'sentAt':moment()[_0x27d9('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x27d9('0x1d')};if(this[_0x27d9('0xe')]===_0x27d9('0xf')){_0x1126a3[_0x27d9('0x10')]=utils[_0x27d9('0x1e')](_0x5a9813[0x2],this);}else{_0x1126a3['body']=utils[_0x27d9('0x1e')](_0x5a9813[0x1],this);}if(this[_0x27d9('0x1f')]){_0x1126a3['to']=this[_0x27d9('0x1f')][_0x27d9('0x20')]||'';if(this[_0x27d9('0xe')]===_0x27d9('0xf')&&_0x5a9813[0x1]==='1'){_0x1126a3['cc']=this[_0x27d9('0x1f')]['cc']||'';}_0x1126a3[_0x27d9('0x20')]=this[_0x27d9('0x1f')]['to']||'';_0x1126a3[_0x27d9('0x21')]=this[_0x27d9('0x1f')]['phone']||'';_0x1126a3['read']=!![];if(this['message'][_0x27d9('0x22')]){_0x1126a3[_0x27d9('0x22')]='';_0x1126a3['subject']+=_[_0x27d9('0x23')](this[_0x27d9('0x1f')]['subject'],_0x27d9('0x24'))?'':_0x27d9('0x25');_0x1126a3[_0x27d9('0x22')]+=this[_0x27d9('0x1f')]['subject'];}}if(this[_0x27d9('0xe')]==='chat'){_0x1126a3[_0x27d9('0x26')]=this[_0x27d9('0x27')]['id'];}else{_0x1126a3[_[_0x27d9('0x28')](this['channel'])+_0x27d9('0x29')]=this['account']['id'];}_0x1126a3[_[_0x27d9('0x28')](this[_0x27d9('0xe')])+'InteractionId']=this[_0x27d9('0x15')]['id'];var _0x4aff82=this[_0x27d9('0x15')];if(rpc[this[_0x27d9('0xe')]+_0x27d9('0x2a')]){if(this[_0x27d9('0xe')]===_0x27d9('0xf')){_0x1126a3[_0x27d9('0x2b')]=this[_0x27d9('0x1f')][_0x27d9('0x2c')];_0x1126a3[_0x27d9('0x2d')]=_0x27d9('0x2e')+_[_0x27d9('0x2f')](_0x1126a3[_0x27d9('0x10')],'';_0x1126a3['headers']={'Auto-Submitted':_0x27d9('0x30'),'X-Auto-Response-Suppress':_0x27d9('0x31'),'Precedence':'auto_reply'};return mailRpc[_0x27d9('0x32')](this[_0x27d9('0x27')][_0x27d9('0x33')],_0x1126a3)[_0x27d9('0x34')](function(_0x3d5e7e){logger[_0x27d9('0x12')](_0x27d9('0x35'),_0x5205b1);_0x1126a3[_0x27d9('0x2c')]=_0x3d5e7e['message'][_0x27d9('0x2c')];return rpc[_0x30d631+_0x27d9('0x2a')][_0x27d9('0x36')](_0x1126a3);})['then'](function(_0x592b81){logger[_0x27d9('0x12')](_0x27d9('0x17'),_0x5205b1,JSON[_0x27d9('0x37')](_0x592b81));})[_0x27d9('0x38')](function(_0xcc4c60){logger[_0x27d9('0x39')](_0x27d9('0x3a'),_0x5205b1,JSON[_0x27d9('0x37')](_0xcc4c60));})[_0x27d9('0x3b')](function(){Promise[_0x27d9('0x3c')]()[_0x27d9('0x34')](function(){if(_0x5a9813[0x0]!=='2'||_0x4aff82[_0x27d9('0x19')])return;return rpc[_0x30d631+'Interaction'][_0x27d9('0x3d')](_0x4aff82['id'],{'autoreplyExecuted':!![]})[_0x27d9('0x34')](function(_0x330b0a){logger[_0x27d9('0x12')](_0x27d9('0x3e'),_0x5205b1,JSON['stringify'](_0x330b0a));})[_0x27d9('0x38')](function(_0x2a0e7c){logger[_0x27d9('0x39')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x5205b1,JSON[_0x27d9('0x37')](_0x2a0e7c));});})['then'](function(){_0x26fe7e[_0x27d9('0x14')]();});});}else{return rpc[this['channel']+_0x27d9('0x2a')][_0x27d9('0x36')](_0x1126a3)[_0x27d9('0x34')](function(){logger[_0x27d9('0x12')](_0x27d9('0x17'),_0x5205b1,_0x1126a3['body']);})['catch'](function(_0x2165af){logger[_0x27d9('0x39')](_0x27d9('0x17'),_0x5205b1,JSON[_0x27d9('0x37')](_0x2165af));})[_0x27d9('0x3b')](function(){Promise[_0x27d9('0x3c')]()[_0x27d9('0x34')](function(){if(_0x5a9813[0x0]!=='2'||_0x4aff82['autoreplyExecuted'])return;return rpc[_0x30d631+'Interaction'][_0x27d9('0x3d')](_0x4aff82['id'],{'autoreplyExecuted':!![]})[_0x27d9('0x34')](function(_0x1bc5ed){logger[_0x27d9('0x12')](_0x27d9('0x3e'),_0x5205b1,JSON['stringify'](_0x1bc5ed));})[_0x27d9('0x38')](function(_0x16b8cc){logger[_0x27d9('0x39')](_0x27d9('0x3f'),_0x5205b1,JSON[_0x27d9('0x37')](_0x16b8cc));});})[_0x27d9('0x34')](function(){_0x26fe7e[_0x27d9('0x14')]();});});}}}catch(_0x576527){logger['error'](_0x27d9('0x17'),_0x5205b1,JSON['stringify'](_0x576527));_0x26fe7e[_0x27d9('0x40')]();}};}; \ No newline at end of file +var _0x9dba=['next','isNil','created','interaction','info','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','channel','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','Message','messageId','html','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','then','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','catch','lodash','moment','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0x9dba,0x19d));var _0xa9db=function(_0x2264c4,_0xc3800){_0x2264c4=_0x2264c4-0x0;var _0x4937cf=_0x9dba[_0x2264c4];return _0x4937cf;};'use strict';var _=require(_0xa9db('0x0'));var moment=require(_0xa9db('0x1'));var utils=require('./utils');var logger=require(_0xa9db('0x2'))(_0xa9db('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xa9db('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xa9db('0x5')),'faxMessage':require(_0xa9db('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0xa9db('0x7')),'openchannelInteraction':require(_0xa9db('0x8')),'mailInteraction':require(_0xa9db('0x9')),'smsInteraction':require(_0xa9db('0xa')),'faxInteraction':require(_0xa9db('0xb')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0xa9db('0xc'));exports[_0xa9db('0xd')]=function(_0x33bbff,_0x493d81,_0x3b6735,_0x42239e){return function(_0x3228ab){try{var _0x29651=this['channel'];if(_0x29651===_0xa9db('0xe')&&_0x42239e[_0xa9db('0xf')][_0xa9db('0x10')]){logger['info'](_0xa9db('0x11'),_0x33bbff,_0xa9db('0x12'));return _0x3228ab[_0xa9db('0x13')]();}if(_0x493d81[0x0]==='1'&&(_[_0xa9db('0x14')](this['interaction'][_0xa9db('0x15')])||!this[_0xa9db('0x16')][_0xa9db('0x15')])){logger[_0xa9db('0x17')](_0xa9db('0x11'),_0x33bbff,'Autoreply\x20already\x20sent');return _0x3228ab['next']();}if(_0x493d81[0x0]==='2'&&this[_0xa9db('0x16')][_0xa9db('0x18')]){logger['info'](_0xa9db('0x19'),_0x33bbff,_0xa9db('0x1a'));return _0x3228ab[_0xa9db('0x13')]();}var _0x1e3d0c={'ContactId':this[_0xa9db('0x1b')]['id'],'sentAt':moment()[_0xa9db('0x1c')](_0xa9db('0x1d')),'direction':_0xa9db('0x1e')};if(this['channel']===_0xa9db('0xe')){_0x1e3d0c['body']=utils[_0xa9db('0x1f')](_0x493d81[0x2],this);}else{_0x1e3d0c['body']=utils[_0xa9db('0x1f')](_0x493d81[0x1],this);}if(this[_0xa9db('0x20')]){_0x1e3d0c['to']=this[_0xa9db('0x20')]['from']||'';if(this[_0xa9db('0x21')]===_0xa9db('0xe')&&_0x493d81[0x1]==='1'){_0x1e3d0c['cc']=this[_0xa9db('0x20')]['cc']||'';}_0x1e3d0c[_0xa9db('0x22')]=this[_0xa9db('0x20')]['to']||'';_0x1e3d0c[_0xa9db('0x23')]=this['message'][_0xa9db('0x23')]||'';_0x1e3d0c[_0xa9db('0x24')]=!![];if(this[_0xa9db('0x20')][_0xa9db('0x25')]){_0x1e3d0c[_0xa9db('0x25')]='';_0x1e3d0c['subject']+=_[_0xa9db('0x26')](this[_0xa9db('0x20')][_0xa9db('0x25')],_0xa9db('0x27'))?'':_0xa9db('0x28');_0x1e3d0c[_0xa9db('0x25')]+=this[_0xa9db('0x20')][_0xa9db('0x25')];}}if(this[_0xa9db('0x21')]===_0xa9db('0x29')){_0x1e3d0c[_0xa9db('0x2a')]=this[_0xa9db('0x2b')]['id'];}else{_0x1e3d0c[_['upperFirst'](this[_0xa9db('0x21')])+_0xa9db('0x2c')]=this[_0xa9db('0x2b')]['id'];}_0x1e3d0c[_[_0xa9db('0x2d')](this[_0xa9db('0x21')])+_0xa9db('0x2e')]=this[_0xa9db('0x16')]['id'];var _0x228046=this[_0xa9db('0x16')];if(rpc[this[_0xa9db('0x21')]+_0xa9db('0x2f')]){if(this[_0xa9db('0x21')]==='mail'){_0x1e3d0c['inReplyTo']=this['message'][_0xa9db('0x30')];_0x1e3d0c[_0xa9db('0x31')]=''+_[_0xa9db('0x32')](_0x1e3d0c[_0xa9db('0xf')],_0xa9db('0x33'),_0xa9db('0x34'))+_0xa9db('0x35');_0x1e3d0c[_0xa9db('0x36')]={'Auto-Submitted':_0xa9db('0x37'),'X-Auto-Response-Suppress':_0xa9db('0x38'),'Precedence':_0xa9db('0x39')};return mailRpc[_0xa9db('0x3a')](this[_0xa9db('0x2b')][_0xa9db('0x3b')],_0x1e3d0c)['then'](function(_0x3c44d6){logger[_0xa9db('0x17')](_0xa9db('0x3c'),_0x33bbff);_0x1e3d0c[_0xa9db('0x30')]=_0x3c44d6['message'][_0xa9db('0x30')];return rpc[_0x29651+'Message'][_0xa9db('0x3d')](_0x1e3d0c);})[_0xa9db('0x3e')](function(_0xf5b42){logger['info'](_0xa9db('0x11'),_0x33bbff,JSON[_0xa9db('0x3f')](_0xf5b42));})['catch'](function(_0x138f0a){logger[_0xa9db('0x40')](_0xa9db('0x41'),_0x33bbff,JSON[_0xa9db('0x3f')](_0x138f0a));})[_0xa9db('0x42')](function(){Promise[_0xa9db('0x43')]()['then'](function(){if(_0x493d81[0x0]!=='2'||_0x228046['autoreplyExecuted'])return;return rpc[_0x29651+_0xa9db('0x44')][_0xa9db('0x45')](_0x228046['id'],{'autoreplyExecuted':!![]})['then'](function(_0x2da881){logger['info'](_0xa9db('0x19'),_0x33bbff,JSON[_0xa9db('0x3f')](_0x2da881));})['catch'](function(_0xf93763){logger[_0xa9db('0x40')](_0xa9db('0x46'),_0x33bbff,JSON[_0xa9db('0x3f')](_0xf93763));});})[_0xa9db('0x3e')](function(){_0x3228ab[_0xa9db('0x13')]();});});}else{return rpc[this[_0xa9db('0x21')]+_0xa9db('0x2f')][_0xa9db('0x3d')](_0x1e3d0c)['then'](function(){logger[_0xa9db('0x17')](_0xa9db('0x11'),_0x33bbff,_0x1e3d0c[_0xa9db('0xf')]);})['catch'](function(_0x1b0e59){logger[_0xa9db('0x40')](_0xa9db('0x11'),_0x33bbff,JSON[_0xa9db('0x3f')](_0x1b0e59));})['finally'](function(){Promise[_0xa9db('0x43')]()[_0xa9db('0x3e')](function(){if(_0x493d81[0x0]!=='2'||_0x228046['autoreplyExecuted'])return;return rpc[_0x29651+_0xa9db('0x44')]['update'](_0x228046['id'],{'autoreplyExecuted':!![]})[_0xa9db('0x3e')](function(_0x2d76e3){logger[_0xa9db('0x17')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x33bbff,JSON[_0xa9db('0x3f')](_0x2d76e3));})[_0xa9db('0x47')](function(_0x313b4a){logger[_0xa9db('0x40')](_0xa9db('0x46'),_0x33bbff,JSON['stringify'](_0x313b4a));});})[_0xa9db('0x3e')](function(){_0x3228ab[_0xa9db('0x13')]();});});}}}catch(_0x390dc8){logger[_0xa9db('0x40')]('[%s][AUTOREPLY]\x20%s',_0x33bbff,JSON['stringify'](_0x390dc8));_0x3228ab['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 6109497..70642c8 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe87d=['stringify','finally','stop','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s'];(function(_0x3fc28f,_0x5aba73){var _0x36bd7e=function(_0x5f16f9){while(--_0x5f16f9){_0x3fc28f['push'](_0x3fc28f['shift']());}};_0x36bd7e(++_0x5aba73);}(_0xe87d,0xdb));var _0xde87=function(_0xf3ccda,_0x182c8f){_0xf3ccda=_0xf3ccda-0x0;var _0x35638c=_0xe87d[_0xf3ccda];return _0x35638c;};'use strict';var moment=require(_0xde87('0x0'));var logger=require(_0xde87('0x1'))('routing');var rpc={'chatInteraction':require(_0xde87('0x2')),'openchannelInteraction':require(_0xde87('0x3')),'smsInteraction':require(_0xde87('0x4')),'mailInteraction':require(_0xde87('0x5')),'faxInteraction':require(_0xde87('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xde87('0x7')]=function(_0x41af2e,_0x475fa4,_0x3a4fa9,_0x1fe7bf){return function(_0x5509a3){try{logger[_0xde87('0x8')](_0xde87('0x9'),_0x41af2e,_0x475fa4[0x0]);var _0x418bc5={'closed':0x1,'closedAt':moment()[_0xde87('0xa')](_0xde87('0xb')),'closeReason':_0xde87('0xc'),'disposition':_0x475fa4[0x0]};if(rpc[_0x1fe7bf[_0xde87('0xd')]+'Interaction']){rpc[_0x1fe7bf[_0xde87('0xd')]+_0xde87('0xe')][_0xde87('0xf')](_0x1fe7bf[_0xde87('0x10')]['id'],_0x418bc5)[_0xde87('0x11')](function(_0x12a3ae){logger[_0xde87('0x8')](_0xde87('0x12'),_0x41af2e,_0x1fe7bf[_0xde87('0x10')]['id']);})['catch'](function(_0x178f77){logger[_0xde87('0x13')](_0xde87('0x14'),_0x41af2e,JSON[_0xde87('0x15')](_0x178f77));})[_0xde87('0x16')](function(){_0x5509a3[_0xde87('0x17')]();});}}catch(_0x5cc618){logger['error'](_0xde87('0x14'),_0x41af2e,JSON[_0xde87('0x15')](_0x5cc618));_0x5509a3['stop']();}};}; \ No newline at end of file +var _0x12ff=['error','stringify','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','system','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','[%s][CLOSE]\x20%s','finally','stop'];(function(_0x16cffe,_0x441ea1){var _0x38309d=function(_0x46daa5){while(--_0x46daa5){_0x16cffe['push'](_0x16cffe['shift']());}};_0x38309d(++_0x441ea1);}(_0x12ff,0x19a));var _0xf12f=function(_0x1c31a9,_0x35c105){_0x1c31a9=_0x1c31a9-0x0;var _0x14187a=_0x12ff[_0x1c31a9];return _0x14187a;};'use strict';var moment=require(_0xf12f('0x0'));var logger=require(_0xf12f('0x1'))(_0xf12f('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xf12f('0x3')),'smsInteraction':require(_0xf12f('0x4')),'mailInteraction':require(_0xf12f('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xf12f('0x6'))};exports[_0xf12f('0x7')]=function(_0x1a0f4d,_0x1f87a2,_0x4546fe,_0x520e41){return function(_0x179734){try{logger[_0xf12f('0x8')](_0xf12f('0x9'),_0x1a0f4d,_0x1f87a2[0x0]);var _0x3ffb43={'closed':0x1,'closedAt':moment()[_0xf12f('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xf12f('0xb'),'disposition':_0x1f87a2[0x0]};if(rpc[_0x520e41[_0xf12f('0xc')]+_0xf12f('0xd')]){rpc[_0x520e41['channel']+_0xf12f('0xd')][_0xf12f('0xe')](_0x520e41['interaction']['id'],_0x3ffb43)[_0xf12f('0xf')](function(_0x55b92b){logger['info'](_0xf12f('0x10'),_0x1a0f4d,_0x520e41[_0xf12f('0x11')]['id']);})[_0xf12f('0x12')](function(_0x40dd47){logger['error'](_0xf12f('0x13'),_0x1a0f4d,JSON['stringify'](_0x40dd47));})[_0xf12f('0x14')](function(){_0x179734[_0xf12f('0x15')]();});}}catch(_0x2e1677){logger[_0xf12f('0x16')](_0xf12f('0x13'),_0x1a0f4d,JSON[_0xf12f('0x17')](_0x2e1677));_0x179734['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 1ad3e16..c3a14a9 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5334=['whatsapp','phone','channel','chat','ChatWebsiteId','account','AccountId','InteractionId','created','isEmpty','getMustacheRender','create','then','catch','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','dialogflow','body','result','speech','providerName','providerResponse','Message','metadata','error','message','lodash','moment','apiai-promise','md5','./utils','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms'];(function(_0xd356b2,_0xa37223){var _0x95a555=function(_0x448eac){while(--_0x448eac){_0xd356b2['push'](_0xd356b2['shift']());}};_0x95a555(++_0xa37223);}(_0x5334,0x84));var _0x4533=function(_0xafce33,_0x5d0082){_0xafce33=_0xafce33-0x0;var _0x468acc=_0x5334[_0xafce33];return _0x468acc;};'use strict';var _=require(_0x4533('0x0'));var moment=require(_0x4533('0x1'));var apiai=require(_0x4533('0x2'));var md5=require(_0x4533('0x3'));var utils=require(_0x4533('0x4'));var logger=require('../../../../config/logger')(_0x4533('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x4533('0x6')),'mailMessage':require(_0x4533('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x4533('0x8')]=function(_0x4dea06,_0x4d89e7){return function(_0x487906){try{if(!_[_0x4533('0x9')](this[_0x4533('0xa')][_0x4533('0xb')])){logger[_0x4533('0xc')](_0x4533('0xd'),_0x4dea06,_0x4533('0xe'));return _0x487906[_0x4533('0xf')]();}var _0x4fdbda={'ContactId':this[_0x4533('0x10')]['id'],'sentAt':moment()[_0x4533('0x11')](_0x4533('0x12')),'direction':_0x4533('0x13')};if(this['channel']===_0x4533('0x14')||this['channel']===_0x4533('0x15')){_0x4fdbda[_0x4533('0x16')]=this[_0x4533('0xa')][_0x4533('0x16')];}var _0x57ff74=this[_0x4533('0x17')];if(_0x57ff74===_0x4533('0x18')){_0x4fdbda[_0x4533('0x19')]=this[_0x4533('0x1a')]['id'];}else{_0x4fdbda[_['upperFirst'](_0x57ff74)+_0x4533('0x1b')]=this['account']['id'];}_0x4fdbda[_['upperFirst'](_0x57ff74)+_0x4533('0x1c')]=this[_0x4533('0xa')]['id'];if(this['interaction'][_0x4533('0x1d')]){var _0x1e6a1a=_0x4d89e7[0x2];if(!_[_0x4533('0x1e')](_0x1e6a1a)){_0x4fdbda['body']=utils[_0x4533('0x1f')](_0x1e6a1a,this);return rpc[_0x57ff74+'Message'][_0x4533('0x20')](_0x4fdbda)[_0x4533('0x21')](function(_0x56ab4f){logger[_0x4533('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x4dea06,_0x4fdbda['body']);})[_0x4533('0x22')](function(_0x9740a6){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x4dea06,JSON[_0x4533('0x23')](_0x9740a6));})[_0x4533('0x24')](function(){logger[_0x4533('0xc')](_0x4533('0x25'),_0x4dea06);_0x487906[_0x4533('0x26')]();});}else{logger[_0x4533('0xc')](_0x4533('0x27'),_0x4dea06);_0x487906['stop']();}}else{var _0x231bae=this;var _0xd55c04=apiai(_0x4d89e7[0x0],{'language':_0x4d89e7[0x1]||'en'});return _0xd55c04[_0x4533('0x28')](this['message']['body'],{'sessionId':md5(this[_0x4533('0xa')]['id'])})[_0x4533('0x21')](function(_0x4c640c){_0x231bae['body'][_0x4533('0x29')]=_0x4c640c;_0x4fdbda[_0x4533('0x2a')]=_0x4c640c[_0x4533('0x2b')]['fulfillment'][_0x4533('0x2c')];_0x4fdbda[_0x4533('0x2d')]=_0x4533('0x29');_0x4fdbda[_0x4533('0x2e')]=JSON[_0x4533('0x23')](_0x4c640c);return rpc[_0x57ff74+_0x4533('0x2f')][_0x4533('0x20')](_0x4fdbda)[_0x4533('0x21')](function(_0x45ad98){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x4dea06,_0x4fdbda[_0x4533('0x2a')]);if(_0x4c640c['result'][_0x4533('0x30')]['endConversation']){_0x487906[_0x4533('0xf')]();}else{_0x487906[_0x4533('0x26')]();}})[_0x4533('0x22')](function(_0x4300c1){logger[_0x4533('0x31')](_0x4533('0xd'),_0x4dea06,JSON[_0x4533('0x23')](_0x4300c1));_0x487906[_0x4533('0xf')]();});})[_0x4533('0x22')](function(_0x43682f){logger[_0x4533('0x31')](_0x4533('0xd'),_0x4dea06,_0x43682f[_0x4533('0x32')]);_0x487906['next']();});}}catch(_0x2489ce){logger['error'](_0x4533('0xd'),_0x4dea06,JSON[_0x4533('0x23')](_0x2489ce));_0x487906[_0x4533('0x26')]();}};}; \ No newline at end of file +var _0x770d=['next','contact','format','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','[%s][DIALOGFLOW]\x20%s','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','providerResponse','endConversation','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.'];(function(_0x3e67d2,_0x2d83d1){var _0x79db0=function(_0x4c70c6){while(--_0x4c70c6){_0x3e67d2['push'](_0x3e67d2['shift']());}};_0x79db0(++_0x2d83d1);}(_0x770d,0x122));var _0xd770=function(_0x13df23,_0x5c7e7b){_0x13df23=_0x13df23-0x0;var _0x28319d=_0x770d[_0x13df23];return _0x28319d;};'use strict';var _=require(_0xd770('0x0'));var moment=require(_0xd770('0x1'));var apiai=require(_0xd770('0x2'));var md5=require(_0xd770('0x3'));var utils=require(_0xd770('0x4'));var logger=require(_0xd770('0x5'))(_0xd770('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xd770('0x7')),'mailMessage':require(_0xd770('0x8')),'smsMessage':require(_0xd770('0x9')),'faxMessage':require(_0xd770('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x2d73bd,_0x251860){return function(_0x2224c4){try{if(!_[_0xd770('0xb')](this[_0xd770('0xc')][_0xd770('0xd')])){logger[_0xd770('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x2d73bd,_0xd770('0xf'));return _0x2224c4[_0xd770('0x10')]();}var _0x38da18={'ContactId':this[_0xd770('0x11')]['id'],'sentAt':moment()[_0xd770('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xd770('0x13')};if(this[_0xd770('0x14')]===_0xd770('0x15')||this[_0xd770('0x14')]===_0xd770('0x16')){_0x38da18[_0xd770('0x17')]=this[_0xd770('0xc')][_0xd770('0x17')];}var _0x488f09=this['channel'];if(_0x488f09===_0xd770('0x18')){_0x38da18[_0xd770('0x19')]=this[_0xd770('0x1a')]['id'];}else{_0x38da18[_[_0xd770('0x1b')](_0x488f09)+'AccountId']=this[_0xd770('0x1a')]['id'];}_0x38da18[_[_0xd770('0x1b')](_0x488f09)+_0xd770('0x1c')]=this[_0xd770('0xc')]['id'];if(this['interaction'][_0xd770('0x1d')]){var _0x58017e=_0x251860[0x2];if(!_[_0xd770('0x1e')](_0x58017e)){_0x38da18[_0xd770('0x1f')]=utils[_0xd770('0x20')](_0x58017e,this);return rpc[_0x488f09+_0xd770('0x21')][_0xd770('0x22')](_0x38da18)[_0xd770('0x23')](function(_0x2659a5){logger[_0xd770('0xe')](_0xd770('0x24'),_0x2d73bd,_0x38da18['body']);})[_0xd770('0x25')](function(_0x4f6f0f){logger[_0xd770('0x26')]('[%s][DIALOGFLOW]\x20%s',_0x2d73bd,JSON[_0xd770('0x27')](_0x4f6f0f));})[_0xd770('0x28')](function(){logger[_0xd770('0xe')](_0xd770('0x29'),_0x2d73bd);_0x2224c4[_0xd770('0x2a')]();});}else{logger['info'](_0xd770('0x2b'),_0x2d73bd);_0x2224c4[_0xd770('0x2a')]();}}else{var _0x5a7005=this;var _0x3c0aa8=apiai(_0x251860[0x0],{'language':_0x251860[0x1]||'en'});return _0x3c0aa8[_0xd770('0x2c')](this[_0xd770('0x2d')][_0xd770('0x1f')],{'sessionId':md5(this['interaction']['id'])})[_0xd770('0x23')](function(_0xdfb694){_0x5a7005[_0xd770('0x1f')][_0xd770('0x2e')]=_0xdfb694;_0x38da18['body']=_0xdfb694[_0xd770('0x2f')][_0xd770('0x30')]['speech'];_0x38da18['providerName']=_0xd770('0x2e');_0x38da18[_0xd770('0x31')]=JSON[_0xd770('0x27')](_0xdfb694);return rpc[_0x488f09+_0xd770('0x21')][_0xd770('0x22')](_0x38da18)[_0xd770('0x23')](function(_0x46bf88){logger['info'](_0xd770('0x24'),_0x2d73bd,_0x38da18[_0xd770('0x1f')]);if(_0xdfb694['result']['metadata'][_0xd770('0x32')]){_0x2224c4[_0xd770('0x10')]();}else{_0x2224c4['stop']();}})[_0xd770('0x25')](function(_0x542c54){logger[_0xd770('0x26')](_0xd770('0x24'),_0x2d73bd,JSON['stringify'](_0x542c54));_0x2224c4[_0xd770('0x10')]();});})['catch'](function(_0x4c6c2d){logger[_0xd770('0x26')](_0xd770('0x24'),_0x2d73bd,_0x4c6c2d['message']);_0x2224c4['next']();});}}catch(_0xad26eb){logger[_0xd770('0x26')]('[%s][DIALOGFLOW]\x20%s',_0x2d73bd,JSON[_0xd770('0x27')](_0xad26eb));_0x2224c4[_0xd770('0x2a')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index b0c6ffc..aef7740 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbffb=['next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','interaction','upperFirst','AccountId','account','InteractionId','created','isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','diagnosticInfo','queryResult','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','fields','end_conversation','boolValue','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','dialogflowV2','providerResponse','fulfillmentText','all','stack','lodash','dialogflow','md5','moment','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','UserId'];(function(_0x3aef0d,_0x51ecf6){var _0xd1d7f6=function(_0x5c74ae){while(--_0x5c74ae){_0x3aef0d['push'](_0x3aef0d['shift']());}};_0xd1d7f6(++_0x51ecf6);}(_0xbffb,0x112));var _0xbbff=function(_0x450b00,_0x1cc659){_0x450b00=_0x450b00-0x0;var _0x219b54=_0xbffb[_0x450b00];return _0x219b54;};'use strict';var _=require(_0xbbff('0x0'));var dialogflow=require(_0xbbff('0x1'));var md5=require(_0xbbff('0x2'));var moment=require(_0xbbff('0x3'));var Promise=require('bluebird');var logger=require(_0xbbff('0x4'))(_0xbbff('0x5'));var utils=require(_0xbbff('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xbbff('0x7')),'mailMessage':require(_0xbbff('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xbbff('0x9')),'whatsappMessage':require(_0xbbff('0xa'))};function createMessage(_0x333a5e,_0x53176f,_0x3be074,_0x28c1cc){return new Promise(function(_0x2b1d5d,_0x5ebab5){var _0x11b790=_['clone'](_0x3be074);_0x11b790[_0xbbff('0xb')]=_0x28c1cc;return rpc[_0x53176f+_0xbbff('0xc')][_0xbbff('0xd')](_0x11b790)[_0xbbff('0xe')](function(){logger[_0xbbff('0xf')](_0xbbff('0x10'),_0x333a5e,_0x11b790[_0xbbff('0xb')]);_0x2b1d5d();})[_0xbbff('0x11')](function(_0x4940a7){logger[_0xbbff('0x12')](_0xbbff('0x10'),_0x333a5e,JSON[_0xbbff('0x13')](_0x4940a7));_0x5ebab5(_0x4940a7);});});}exports[_0xbbff('0x14')]=function(_0x3de3a5,_0x192dd7){return function(_0x4be5cf){try{if(!_['isNil'](this['interaction'][_0xbbff('0x15')])){logger[_0xbbff('0xf')](_0xbbff('0x10'),_0x3de3a5,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4be5cf[_0xbbff('0x16')]();}var _0x174f6d={'ContactId':this[_0xbbff('0x17')]['id'],'sentAt':moment()[_0xbbff('0x18')](_0xbbff('0x19')),'direction':_0xbbff('0x1a')};if(this[_0xbbff('0x1b')]==='sms'||this['channel']===_0xbbff('0x1c')){_0x174f6d[_0xbbff('0x1d')]=this[_0xbbff('0x1e')][_0xbbff('0x1d')];}var _0x45d26a=this['channel'];if(_0x45d26a==='chat'){_0x174f6d['ChatWebsiteId']=this['account']['id'];}else{_0x174f6d[_[_0xbbff('0x1f')](_0x45d26a)+_0xbbff('0x20')]=this[_0xbbff('0x21')]['id'];}_0x174f6d[_[_0xbbff('0x1f')](_0x45d26a)+_0xbbff('0x22')]=this[_0xbbff('0x1e')]['id'];if(this['interaction'][_0xbbff('0x23')]){var _0x3cce1c=_0x192dd7[0x4];if(!_[_0xbbff('0x24')](_0x3cce1c)){_0x174f6d[_0xbbff('0xb')]=utils[_0xbbff('0x25')](_0x3cce1c,this);return rpc[_0x45d26a+_0xbbff('0xc')][_0xbbff('0xd')](_0x174f6d)[_0xbbff('0xe')](function(_0x32e9bb){logger[_0xbbff('0xf')](_0xbbff('0x10'),_0x3de3a5,_0x174f6d[_0xbbff('0xb')]);})['catch'](function(_0x3e116f){logger['error'](_0xbbff('0x10'),_0x3de3a5,JSON[_0xbbff('0x13')](_0x3e116f));})[_0xbbff('0x26')](function(){logger[_0xbbff('0xf')](_0xbbff('0x27'),_0x3de3a5);_0x4be5cf[_0xbbff('0x28')]();});}else{logger[_0xbbff('0xf')](_0xbbff('0x29'),_0x3de3a5);_0x4be5cf['stop']();}}else{var _0x25bc49=this;var _0x1cb8d4=_0x192dd7[0x2][_0xbbff('0x2a')](/\\n/g,'\x0a');var _0x2a3881={'credentials':{'private_key':_0x1cb8d4,'client_email':_0x192dd7[0x1]}};var _0x35839a=new dialogflow[(_0xbbff('0x2b'))](_0x2a3881);var _0x48a900=_0x35839a[_0xbbff('0x2c')](_0x192dd7[0x0],md5(_0x25bc49['interaction']['id']));var _0x4c9987={'session':_0x48a900,'queryInput':{'text':{'text':_0x25bc49[_0xbbff('0x2d')]['body'],'languageCode':_0x192dd7[0x3]||'en'}}};return _0x35839a[_0xbbff('0x2e')](_0x4c9987)[_0xbbff('0xe')](function(_0x4863d5){if(_0x4863d5&&_0x4863d5[_0xbbff('0x2f')]){_0x25bc49[_0xbbff('0xb')]['dialogflowV2']=_0x4863d5;var _0x241dc3=_0x4863d5[0x0];var _0x3d138d=_0x241dc3['queryResult'][_0xbbff('0x30')]&&_0x241dc3[_0xbbff('0x31')]['diagnosticInfo']['fields']?_0x241dc3['queryResult'][_0xbbff('0x30')]['fields']['end_conversation']['boolValue']:![];_0x25bc49[_0xbbff('0xb')][_0xbbff('0x32')]=_0x241dc3[_0xbbff('0x31')][_0xbbff('0x33')];_0x25bc49[_0xbbff('0xb')][_0xbbff('0x34')]=_0x241dc3[_0xbbff('0x31')]['allRequiredParamsPresent'];_0x25bc49[_0xbbff('0xb')][_0xbbff('0x35')]=_0x241dc3[_0xbbff('0x31')]['diagnosticInfo']&&_0x241dc3[_0xbbff('0x31')][_0xbbff('0x30')]['fields']?_0x241dc3['queryResult']['diagnosticInfo'][_0xbbff('0x36')][_0xbbff('0x37')][_0xbbff('0x38')]:![];_0x25bc49[_0xbbff('0xb')][_0xbbff('0x39')]=_0x241dc3[_0xbbff('0x31')][_0xbbff('0x3a')][_0xbbff('0x3b')];_0x25bc49[_0xbbff('0xb')][_0xbbff('0x3c')]=_0x241dc3['queryResult']['intent'][_0xbbff('0x3d')];_0x25bc49[_0xbbff('0xb')][_0xbbff('0x3e')]=_0x241dc3[_0xbbff('0x31')][_0xbbff('0x3a')][_0xbbff('0x3f')];_0x25bc49[_0xbbff('0xb')][_0xbbff('0x40')]=_0x241dc3['queryResult'][_0xbbff('0x41')];_0x25bc49[_0xbbff('0xb')][_0xbbff('0x42')]=_0x241dc3['queryResult']['queryText'];_0x25bc49[_0xbbff('0xb')][_0xbbff('0x43')]=_0x241dc3[_0xbbff('0x31')][_0xbbff('0x44')];_0x174f6d['providerName']=_0xbbff('0x45');_0x174f6d[_0xbbff('0x46')]=JSON[_0xbbff('0x13')](_0x4863d5);var _0x498f60=[];for(var _0x48a87f=0x0;_0x48a87f<_0x4863d5[_0xbbff('0x2f')];_0x48a87f++){var _0x4b1c12=_0x4863d5[_0x48a87f];if(_0x4b1c12&&_0x4b1c12['queryResult']&&_0x4b1c12[_0xbbff('0x31')]['fulfillmentText']){_0x498f60['push'](createMessage(_0x3de3a5,_0x45d26a,_0x174f6d,_0x4b1c12[_0xbbff('0x31')][_0xbbff('0x47')]));}}return Promise[_0xbbff('0x48')](_0x498f60)[_0xbbff('0xe')](function(){if(_0x3d138d){_0x4be5cf[_0xbbff('0x16')]();}else{_0x4be5cf['stop']();}})[_0xbbff('0x11')](function(_0x5a5525){logger[_0xbbff('0x12')](_0xbbff('0x10'),_0x3de3a5,JSON['stringify'](_0x5a5525));_0x4be5cf[_0xbbff('0x16')]();});}})['catch'](function(_0x366b96){logger['error'](_0xbbff('0x10'),_0x3de3a5,_0x366b96[_0xbbff('0x2d')],_0x366b96[_0xbbff('0x49')]);_0x4be5cf['next']();});}}catch(_0x35d7f1){logger[_0xbbff('0x12')](_0xbbff('0x10'),_0x3de3a5,JSON['stringify'](_0x35d7f1));_0x4be5cf[_0xbbff('0x28')]();}};}; \ No newline at end of file +var _0x4749=['routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','body','Message','create','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','chat','ChatWebsiteId','account','AccountId','InteractionId','created','isEmpty','getMustacheRender','then','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath','message','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','all','stack','md5','bluebird','../../../../config/logger'];(function(_0x12d98e,_0x2709b9){var _0x3a7fe3=function(_0x30f810){while(--_0x30f810){_0x12d98e['push'](_0x12d98e['shift']());}};_0x3a7fe3(++_0x2709b9);}(_0x4749,0x125));var _0x9474=function(_0x331b71,_0x50dda5){_0x331b71=_0x331b71-0x0;var _0x19c1c4=_0x4749[_0x331b71];return _0x19c1c4;};'use strict';var _=require('lodash');var dialogflow=require('dialogflow');var md5=require(_0x9474('0x0'));var moment=require('moment');var Promise=require(_0x9474('0x1'));var logger=require(_0x9474('0x2'))(_0x9474('0x3'));var utils=require(_0x9474('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x9474('0x5')),'mailMessage':require(_0x9474('0x6')),'smsMessage':require(_0x9474('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x9474('0x8'))};function createMessage(_0x55b27f,_0x54f66f,_0x5b6924,_0xe2318a){return new Promise(function(_0x3f8f9d,_0x68bb6d){var _0x196c91=_[_0x9474('0x9')](_0x5b6924);_0x196c91[_0x9474('0xa')]=_0xe2318a;return rpc[_0x54f66f+_0x9474('0xb')][_0x9474('0xc')](_0x196c91)['then'](function(){logger[_0x9474('0xd')](_0x9474('0xe'),_0x55b27f,_0x196c91[_0x9474('0xa')]);_0x3f8f9d();})[_0x9474('0xf')](function(_0x115e16){logger[_0x9474('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x55b27f,JSON[_0x9474('0x11')](_0x115e16));_0x68bb6d(_0x115e16);});});}exports[_0x9474('0x12')]=function(_0x4ada57,_0x14865c){return function(_0x3ad111){try{if(!_['isNil'](this[_0x9474('0x13')][_0x9474('0x14')])){logger[_0x9474('0xd')](_0x9474('0xe'),_0x4ada57,_0x9474('0x15'));return _0x3ad111[_0x9474('0x16')]();}var _0x1defaf={'ContactId':this['contact']['id'],'sentAt':moment()[_0x9474('0x17')](_0x9474('0x18')),'direction':_0x9474('0x19')};if(this[_0x9474('0x1a')]===_0x9474('0x1b')||this[_0x9474('0x1a')]===_0x9474('0x1c')){_0x1defaf['phone']=this['interaction']['phone'];}var _0x1eb61f=this[_0x9474('0x1a')];if(_0x1eb61f===_0x9474('0x1d')){_0x1defaf[_0x9474('0x1e')]=this[_0x9474('0x1f')]['id'];}else{_0x1defaf[_['upperFirst'](_0x1eb61f)+_0x9474('0x20')]=this['account']['id'];}_0x1defaf[_['upperFirst'](_0x1eb61f)+_0x9474('0x21')]=this['interaction']['id'];if(this[_0x9474('0x13')][_0x9474('0x22')]){var _0x4e4468=_0x14865c[0x4];if(!_[_0x9474('0x23')](_0x4e4468)){_0x1defaf[_0x9474('0xa')]=utils[_0x9474('0x24')](_0x4e4468,this);return rpc[_0x1eb61f+_0x9474('0xb')]['create'](_0x1defaf)[_0x9474('0x25')](function(_0xf1c82b){logger[_0x9474('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x4ada57,_0x1defaf[_0x9474('0xa')]);})['catch'](function(_0x5cdcae){logger['error'](_0x9474('0xe'),_0x4ada57,JSON[_0x9474('0x11')](_0x5cdcae));})[_0x9474('0x26')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4ada57);_0x3ad111[_0x9474('0x27')]();});}else{logger['info'](_0x9474('0x28'),_0x4ada57);_0x3ad111[_0x9474('0x27')]();}}else{var _0xf1b0d5=this;var _0x21a81d=_0x14865c[0x2]['replace'](/\\n/g,'\x0a');var _0x9869d={'credentials':{'private_key':_0x21a81d,'client_email':_0x14865c[0x1]}};var _0x2a9550=new dialogflow[(_0x9474('0x29'))](_0x9869d);var _0x48c770=_0x2a9550[_0x9474('0x2a')](_0x14865c[0x0],md5(_0xf1b0d5[_0x9474('0x13')]['id']));var _0xcfd4a5={'session':_0x48c770,'queryInput':{'text':{'text':_0xf1b0d5[_0x9474('0x2b')]['body'],'languageCode':_0x14865c[0x3]||'en'}}};return _0x2a9550['detectIntent'](_0xcfd4a5)[_0x9474('0x25')](function(_0x26b018){if(_0x26b018&&_0x26b018[_0x9474('0x2c')]){_0xf1b0d5[_0x9474('0xa')][_0x9474('0x2d')]=_0x26b018;var _0x4b2271=_0x26b018[0x0];var _0x55a4c8=_0x4b2271[_0x9474('0x2e')][_0x9474('0x2f')]&&_0x4b2271['queryResult'][_0x9474('0x2f')][_0x9474('0x30')]?_0x4b2271[_0x9474('0x2e')]['diagnosticInfo'][_0x9474('0x30')][_0x9474('0x31')][_0x9474('0x32')]:![];_0xf1b0d5['body'][_0x9474('0x33')]=_0x4b2271[_0x9474('0x2e')][_0x9474('0x34')];_0xf1b0d5[_0x9474('0xa')][_0x9474('0x35')]=_0x4b2271['queryResult'][_0x9474('0x36')];_0xf1b0d5['body']['DIALOGFLOWV2_ENDCONVERSATION']=_0x4b2271[_0x9474('0x2e')][_0x9474('0x2f')]&&_0x4b2271[_0x9474('0x2e')][_0x9474('0x2f')]['fields']?_0x4b2271[_0x9474('0x2e')]['diagnosticInfo']['fields']['end_conversation'][_0x9474('0x32')]:![];_0xf1b0d5[_0x9474('0xa')][_0x9474('0x37')]=_0x4b2271[_0x9474('0x2e')][_0x9474('0x38')][_0x9474('0x39')];_0xf1b0d5[_0x9474('0xa')][_0x9474('0x3a')]=_0x4b2271[_0x9474('0x2e')][_0x9474('0x38')][_0x9474('0x3b')];_0xf1b0d5[_0x9474('0xa')][_0x9474('0x3c')]=_0x4b2271['queryResult'][_0x9474('0x38')][_0x9474('0x3d')];_0xf1b0d5['body'][_0x9474('0x3e')]=_0x4b2271['queryResult'][_0x9474('0x3f')];_0xf1b0d5[_0x9474('0xa')][_0x9474('0x40')]=_0x4b2271[_0x9474('0x2e')][_0x9474('0x41')];_0xf1b0d5[_0x9474('0xa')][_0x9474('0x42')]=_0x4b2271[_0x9474('0x2e')][_0x9474('0x43')];_0x1defaf[_0x9474('0x44')]=_0x9474('0x2d');_0x1defaf[_0x9474('0x45')]=JSON[_0x9474('0x11')](_0x26b018);var _0x4ee9ee=[];for(var _0xdfd974=0x0;_0xdfd974<_0x26b018[_0x9474('0x2c')];_0xdfd974++){var _0x5e1928=_0x26b018[_0xdfd974];if(_0x5e1928&&_0x5e1928[_0x9474('0x2e')]&&_0x5e1928[_0x9474('0x2e')][_0x9474('0x46')]){_0x4ee9ee[_0x9474('0x47')](createMessage(_0x4ada57,_0x1eb61f,_0x1defaf,_0x5e1928[_0x9474('0x2e')][_0x9474('0x46')]));}}return Promise[_0x9474('0x48')](_0x4ee9ee)[_0x9474('0x25')](function(){if(_0x55a4c8){_0x3ad111[_0x9474('0x16')]();}else{_0x3ad111[_0x9474('0x27')]();}})[_0x9474('0xf')](function(_0x58d3c3){logger[_0x9474('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x4ada57,JSON['stringify'](_0x58d3c3));_0x3ad111[_0x9474('0x16')]();});}})[_0x9474('0xf')](function(_0x5397d7){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x4ada57,_0x5397d7[_0x9474('0x2b')],_0x5397d7[_0x9474('0x49')]);_0x3ad111[_0x9474('0x16')]();});}}catch(_0x3dc8fd){logger[_0x9474('0x10')](_0x9474('0xe'),_0x4ada57,JSON[_0x9474('0x11')](_0x3dc8fd));_0x3ad111[_0x9474('0x27')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 3326851..b965108 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5912=['stringify','validate','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','stop','condition','priorityFalse','info','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message'];(function(_0x3ee501,_0x4eee7b){var _0x2bd3b7=function(_0x5413bd){while(--_0x5413bd){_0x3ee501['push'](_0x3ee501['shift']());}};_0x2bd3b7(++_0x4eee7b);}(_0x5912,0x1a1));var _0x2591=function(_0x190a1e,_0x47e4ff){_0x190a1e=_0x190a1e-0x0;var _0x330d38=_0x5912[_0x190a1e];return _0x330d38;};'use strict';var schema=require(_0x2591('0x0'));var _=require(_0x2591('0x1'));var htmlToText=require(_0x2591('0x2'));var utils=require('./utils');var logger=require(_0x2591('0x3'))(_0x2591('0x4'));var gotoif=schema({'condition':{'type':_0x2591('0x5'),'required':!![],'message':_0x2591('0x6')},'priorityTrue':{'type':'number','message':_0x2591('0x7')},'priorityFalse':{'type':_0x2591('0x8'),'message':_0x2591('0x9')}});exports['consequence']=function(_0x1980c4,_0x580b21){return function(_0x1ef885){try{var _0x52c5e1={'condition':htmlToText['fromString'](utils[_0x2591('0xa')](_0x580b21[0x0],this),{'wordwrap':![]})[_0x2591('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x580b21[0x1],'priorityFalse':_0x580b21[0x2]};var _0x38f92b=gotoif[_0x2591('0x0')](_0x52c5e1,{'typecast':!![]});if(_0x38f92b[_0x2591('0xc')]){logger[_0x2591('0xd')](_0x2591('0xe'),_0x1980c4,_[_0x2591('0xf')](_0x38f92b,'message')['join'](',\x20'));_0x1ef885[_0x2591('0x10')]();}else{try{var _0x370639=eval('('+_0x52c5e1[_0x2591('0x11')]+')');var _0x1b5273=_0x370639?_0x52c5e1['priorityTrue']:_0x52c5e1[_0x2591('0x12')];logger[_0x2591('0x13')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x1980c4,_0x52c5e1[_0x2591('0x11')],_0x370639,_0x1b5273||_0x2591('0x14'));if(_0x1b5273){var _0x1c3a11=_['findIndex'](_0x1ef885[_0x2591('0x15')](),{'p':_0x1b5273});if(_0x1c3a11>=0x0){logger[_0x2591('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x1980c4,_0x1b5273||_0x2591('0x14'),_0x1c3a11);_0x1ef885[_0x2591('0x14')](_0x1c3a11);}else{logger['info'](_0x2591('0x16'),_0x1980c4,_0x1b5273||_0x2591('0x14'));_0x1ef885[_0x2591('0x10')]();}}else{_0x1ef885[_0x2591('0x14')]();}}catch(_0xdb8abb){logger['error'](_0x2591('0x17'),_0x1980c4,_0xdb8abb[_0x2591('0x18')]);_0x1ef885[_0x2591('0x10')]();}}}catch(_0x1a6305){logger[_0x2591('0xd')](_0x2591('0xe'),_0x1980c4,JSON[_0x2591('0x19')](_0x1a6305));_0x1ef885[_0x2591('0x10')]();}};}; \ No newline at end of file +var _0x5396=['map','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20%s','stringify','validate','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error'];(function(_0x2ace95,_0x186b37){var _0x35ecfa=function(_0x26ce5a){while(--_0x26ce5a){_0x2ace95['push'](_0x2ace95['shift']());}};_0x35ecfa(++_0x186b37);}(_0x5396,0x15d));var _0x6539=function(_0x93e1c6,_0x1e59bc){_0x93e1c6=_0x93e1c6-0x0;var _0x1252de=_0x5396[_0x93e1c6];return _0x1252de;};'use strict';var schema=require(_0x6539('0x0'));var _=require(_0x6539('0x1'));var htmlToText=require(_0x6539('0x2'));var utils=require('./utils');var logger=require(_0x6539('0x3'))(_0x6539('0x4'));var gotoif=schema({'condition':{'type':_0x6539('0x5'),'required':!![],'message':_0x6539('0x6')},'priorityTrue':{'type':_0x6539('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x6539('0x7'),'message':_0x6539('0x8')}});exports[_0x6539('0x9')]=function(_0x335923,_0x1e3248){return function(_0x3abce7){try{var _0x2fb456={'condition':htmlToText[_0x6539('0xa')](utils[_0x6539('0xb')](_0x1e3248[0x0],this),{'wordwrap':![]})[_0x6539('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1e3248[0x1],'priorityFalse':_0x1e3248[0x2]};var _0x112863=gotoif['validate'](_0x2fb456,{'typecast':!![]});if(_0x112863[_0x6539('0xd')]){logger[_0x6539('0xe')]('[%s][GOTOIF]\x20%s',_0x335923,_[_0x6539('0xf')](_0x112863,'message')[_0x6539('0x10')](',\x20'));_0x3abce7[_0x6539('0x11')]();}else{try{var _0x5580f2=eval('('+_0x2fb456[_0x6539('0x12')]+')');var _0x24e77f=_0x5580f2?_0x2fb456[_0x6539('0x13')]:_0x2fb456['priorityFalse'];logger[_0x6539('0x14')](_0x6539('0x15'),_0x335923,_0x2fb456['condition'],_0x5580f2,_0x24e77f||_0x6539('0x16'));if(_0x24e77f){var _0x32f58d=_[_0x6539('0x17')](_0x3abce7['rules'](),{'p':_0x24e77f});if(_0x32f58d>=0x0){logger[_0x6539('0x14')](_0x6539('0x18'),_0x335923,_0x24e77f||_0x6539('0x16'),_0x32f58d);_0x3abce7[_0x6539('0x16')](_0x32f58d);}else{logger[_0x6539('0x14')](_0x6539('0x19'),_0x335923,_0x24e77f||_0x6539('0x16'));_0x3abce7[_0x6539('0x11')]();}}else{_0x3abce7['next']();}}catch(_0xd59446){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x335923,_0xd59446['message']);_0x3abce7['stop']();}}}catch(_0x60a25a){logger[_0x6539('0xe')](_0x6539('0x1a'),_0x335923,JSON[_0x6539('0x1b')](_0x60a25a));_0x3abce7[_0x6539('0x11')]();}};}; \ 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 f8f3516..d998424 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 _0x3fe1=['routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','stringify','validate','../../../../config/logger'];(function(_0x2b2dd1,_0x2c6ac7){var _0x5d2ef5=function(_0xacc039){while(--_0xacc039){_0x2b2dd1['push'](_0x2b2dd1['shift']());}};_0x5d2ef5(++_0x2c6ac7);}(_0x3fe1,0x142));var _0x13fe=function(_0x274fdb,_0x5919f7){_0x274fdb=_0x274fdb-0x0;var _0x3a21c6=_0x3fe1[_0x274fdb];return _0x3a21c6;};'use strict';var schema=require(_0x13fe('0x0'));var _=require('lodash');var logger=require(_0x13fe('0x1'))(_0x13fe('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x13fe('0x3')}});exports[_0x13fe('0x4')]=function(_0x2c8279,_0x47fedb){return function(_0x237021){try{var _0x545502={'priority':_0x47fedb[0x0]};var _0x45781e=gotop[_0x13fe('0x0')](_0x545502,{'typecast':!![]});if(_0x45781e[_0x13fe('0x5')]){logger[_0x13fe('0x6')](_0x13fe('0x7'),_0x2c8279,_['map'](_0x45781e,_0x13fe('0x8'))['join'](',\x20'));_0x237021[_0x13fe('0x9')]();}else{logger[_0x13fe('0xa')](_0x13fe('0xb'),_0x2c8279,_0x545502[_0x13fe('0xc')]);if(_0x545502[_0x13fe('0xc')]){var _0x4f5315=_['findIndex'](_0x237021[_0x13fe('0xd')](),{'p':_0x545502[_0x13fe('0xc')]});if(_0x4f5315>=0x0){logger[_0x13fe('0xa')](_0x13fe('0xe'),_0x2c8279,_0x545502[_0x13fe('0xc')]||'next',_0x4f5315);_0x237021['next'](_0x4f5315);}else{logger[_0x13fe('0xa')](_0x13fe('0xf'),_0x2c8279,_0x545502[_0x13fe('0xc')]||_0x13fe('0x10'));_0x237021['stop']();}}else{_0x237021['next']();}}}catch(_0x9abc43){logger['error'](_0x13fe('0x7'),_0x2c8279,JSON[_0x13fe('0x11')](_0x9abc43));_0x237021[_0x13fe('0x9')]();}};}; \ No newline at end of file +var _0xb40c=['[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb40c,0x9f));var _0xcb40=function(_0x190513,_0x5038b8){_0x190513=_0x190513-0x0;var _0x4bd740=_0xb40c[_0x190513];return _0x4bd740;};'use strict';var schema=require(_0xcb40('0x0'));var _=require(_0xcb40('0x1'));var logger=require(_0xcb40('0x2'))(_0xcb40('0x3'));var gotop=schema({'priority':{'type':_0xcb40('0x4'),'required':!![],'message':_0xcb40('0x5')}});exports[_0xcb40('0x6')]=function(_0x3eea0e,_0x457786){return function(_0x5daa8d){try{var _0x2f204b={'priority':_0x457786[0x0]};var _0x525797=gotop['validate'](_0x2f204b,{'typecast':!![]});if(_0x525797[_0xcb40('0x7')]){logger[_0xcb40('0x8')](_0xcb40('0x9'),_0x3eea0e,_[_0xcb40('0xa')](_0x525797,_0xcb40('0xb'))[_0xcb40('0xc')](',\x20'));_0x5daa8d['stop']();}else{logger[_0xcb40('0xd')](_0xcb40('0xe'),_0x3eea0e,_0x2f204b['priority']);if(_0x2f204b[_0xcb40('0xf')]){var _0x29ea14=_[_0xcb40('0x10')](_0x5daa8d[_0xcb40('0x11')](),{'p':_0x2f204b[_0xcb40('0xf')]});if(_0x29ea14>=0x0){logger[_0xcb40('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x3eea0e,_0x2f204b[_0xcb40('0xf')]||_0xcb40('0x12'),_0x29ea14);_0x5daa8d[_0xcb40('0x12')](_0x29ea14);}else{logger['info'](_0xcb40('0x13'),_0x3eea0e,_0x2f204b[_0xcb40('0xf')]||_0xcb40('0x12'));_0x5daa8d['stop']();}}else{_0x5daa8d[_0xcb40('0x12')]();}}}catch(_0x1f892d){logger[_0xcb40('0x8')](_0xcb40('0x9'),_0x3eea0e,JSON['stringify'](_0x1f892d));_0x5daa8d[_0xcb40('0x14')]();}};}; \ 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 644e9be..d3ab045 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 _0x23b4=['upperFirst','channel','InteractionId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','account'];(function(_0xd85418,_0x3642c0){var _0x1e6e6e=function(_0x240d60){while(--_0x240d60){_0xd85418['push'](_0xd85418['shift']());}};_0x1e6e6e(++_0x3642c0);}(_0x23b4,0xf3));var _0x423b=function(_0x4d969d,_0x5ba668){_0x4d969d=_0x4d969d-0x0;var _0x57ea9a=_0x23b4[_0x4d969d];return _0x57ea9a;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x423b('0x0'));var rpc={'chatMessage':require(_0x423b('0x1')),'openchannelMessage':require(_0x423b('0x2')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x423b('0x3')),'faxMessage':require(_0x423b('0x4')),'whatsappMessage':require(_0x423b('0x5'))};exports[_0x423b('0x6')]=function(_0x18dbfc,_0xed6337){return function(_0x55ae93){try{var _0x45f269={'body':utils[_0x423b('0x7')](_0xed6337[0x0],this),'ContactId':this[_0x423b('0x8')]['id']};if(this['channel']==='chat'){_0x45f269['ChatWebsiteId']=this[_0x423b('0x9')]['id'];}else{_0x45f269[_[_0x423b('0xa')](this[_0x423b('0xb')])+'AccountId']=this[_0x423b('0x9')]['id'];}_0x45f269[_['upperFirst'](this[_0x423b('0xb')])+_0x423b('0xc')]=this[_0x423b('0xd')]['id'];if(rpc[this[_0x423b('0xb')]+_0x423b('0xe')]){return rpc[this[_0x423b('0xb')]+_0x423b('0xe')]['create'](_0x45f269)[_0x423b('0xf')](function(_0x470670){logger[_0x423b('0x10')](_0x423b('0x11'),_0x18dbfc,_0x45f269[_0x423b('0x12')]);_0x55ae93[_0x423b('0x13')]();})['catch'](function(_0x67c560){logger[_0x423b('0x14')]('[%s][MESSAGE]\x20%s',_0x18dbfc,JSON[_0x423b('0x15')](_0x67c560));_0x55ae93['stop']();});}}catch(_0x12c164){logger[_0x423b('0x14')](_0x423b('0x11'),_0x18dbfc,JSON[_0x423b('0x15')](_0x12c164));_0x55ae93[_0x423b('0x16')]();}};}; \ No newline at end of file +var _0xc648=['chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','contact','channel'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0xc648,0x171));var _0x8c64=function(_0x4b18ba,_0x460521){_0x4b18ba=_0x4b18ba-0x0;var _0xb7adf=_0xc648[_0x4b18ba];return _0xb7adf;};'use strict';var _=require('lodash');var utils=require(_0x8c64('0x0'));var logger=require(_0x8c64('0x1'))(_0x8c64('0x2'));var rpc={'chatMessage':require(_0x8c64('0x3')),'openchannelMessage':require(_0x8c64('0x4')),'mailMessage':require(_0x8c64('0x5')),'smsMessage':require(_0x8c64('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x1c79a9,_0x449786){return function(_0xb31493){try{var _0x1be93f={'body':utils['getMustacheRender'](_0x449786[0x0],this),'ContactId':this[_0x8c64('0x7')]['id']};if(this[_0x8c64('0x8')]===_0x8c64('0x9')){_0x1be93f[_0x8c64('0xa')]=this[_0x8c64('0xb')]['id'];}else{_0x1be93f[_['upperFirst'](this[_0x8c64('0x8')])+_0x8c64('0xc')]=this['account']['id'];}_0x1be93f[_[_0x8c64('0xd')](this[_0x8c64('0x8')])+_0x8c64('0xe')]=this[_0x8c64('0xf')]['id'];if(rpc[this[_0x8c64('0x8')]+_0x8c64('0x10')]){return rpc[this[_0x8c64('0x8')]+_0x8c64('0x10')][_0x8c64('0x11')](_0x1be93f)[_0x8c64('0x12')](function(_0x54e0f0){logger[_0x8c64('0x13')](_0x8c64('0x14'),_0x1c79a9,_0x1be93f[_0x8c64('0x15')]);_0xb31493[_0x8c64('0x16')]();})[_0x8c64('0x17')](function(_0xeb374){logger[_0x8c64('0x18')]('[%s][MESSAGE]\x20%s',_0x1c79a9,JSON[_0x8c64('0x19')](_0xeb374));_0xb31493[_0x8c64('0x1a')]();});}}catch(_0x4dbf8d){logger[_0x8c64('0x18')](_0x8c64('0x14'),_0x1c79a9,JSON['stringify'](_0x4dbf8d));_0xb31493[_0x8c64('0x1a')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 6f822d0..22dd9d6 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 _0xcc0e=['stringify','stop','./utils','../../../../config/logger','info','[%s][NOOP]\x20%s','getMustacheRender','next'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0xcc0e,0x17a));var _0xecc0=function(_0x5cb7d6,_0x578957){_0x5cb7d6=_0x5cb7d6-0x0;var _0x2c8463=_0xcc0e[_0x5cb7d6];return _0x2c8463;};'use strict';var utils=require(_0xecc0('0x0'));var logger=require(_0xecc0('0x1'))('routing');exports['consequence']=function(_0x45046c,_0x189cb7){return function(_0xd13123){try{logger[_0xecc0('0x2')](_0xecc0('0x3'),_0x45046c,utils[_0xecc0('0x4')](_0x189cb7[0x0],this));_0xd13123[_0xecc0('0x5')]();}catch(_0x24e09a){logger['error'](_0xecc0('0x3'),_0x45046c,JSON[_0xecc0('0x6')](_0x24e09a));_0xd13123[_0xecc0('0x7')]();}};}; \ No newline at end of file +var _0x7368=['getMustacheRender','stringify','stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0x7bb55,_0x403227){var _0x311b5b=function(_0x51c011){while(--_0x51c011){_0x7bb55['push'](_0x7bb55['shift']());}};_0x311b5b(++_0x403227);}(_0x7368,0x174));var _0x8736=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7368[_0xfae23b];return _0x200640;};'use strict';var utils=require(_0x8736('0x0'));var logger=require(_0x8736('0x1'))(_0x8736('0x2'));exports[_0x8736('0x3')]=function(_0x30f325,_0x30f18e){return function(_0x4ff17a){try{logger[_0x8736('0x4')](_0x8736('0x5'),_0x30f325,utils[_0x8736('0x6')](_0x30f18e[0x0],this));_0x4ff17a['next']();}catch(_0x2187b3){logger['error'](_0x8736('0x5'),_0x30f325,JSON[_0x8736('0x7')](_0x2187b3));_0x4ff17a[_0x8736('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 f1a3bae..1faaac4 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 _0xb236=['ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','push','capitalize','InteractionId','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','contact','list','upperFirst','interaction','channel','MessageId','message','AccountId','WebsiteId','info','name','QueueReport','create','catch','error','waiting','YYYY-MM-DD\x20HH:mm:ss','accepted','Interaction','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','stop','find','createQueue','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','lodash','util','seq-queue','moment'];(function(_0x3aa088,_0x521aba){var _0x338e3c=function(_0x200a89){while(--_0x200a89){_0x3aa088['push'](_0x3aa088['shift']());}};_0x338e3c(++_0x521aba);}(_0xb236,0x157));var _0x6b23=function(_0x59f1,_0x51766e){_0x59f1=_0x59f1-0x0;var _0x179bd9=_0xb236[_0x59f1];return _0x179bd9;};'use strict';var schema=require(_0x6b23('0x0'));var _=require(_0x6b23('0x1'));var util=require(_0x6b23('0x2'));var seqqueue=require(_0x6b23('0x3'));var moment=require(_0x6b23('0x4'));var Redis=require(_0x6b23('0x5'));var config=require(_0x6b23('0x6'));var logger=require('../../../../config/logger')(_0x6b23('0x7'));var strategy=require(_0x6b23('0x8'));config[_0x6b23('0x9')]=_[_0x6b23('0xa')](config[_0x6b23('0x9')],{'host':_0x6b23('0xb'),'port':0x18eb});var io=require(_0x6b23('0xc'))(new Redis(config['redis']));var attributes=['id',_0x6b23('0xd'),_0x6b23('0xe'),_0x6b23('0xf'),_0x6b23('0x10'),_0x6b23('0x11')];function emit(_0x2f415c,_0x113f2d,_0x57146c){io['to'](_0x2f415c)[_0x6b23('0x12')](_0x113f2d,_0x57146c);}function emitChannelQueueInteraction(_0x34455d,_0x5d25f8,_0xe6f4cf,_0x58ee4f,_0x2f170b,_0x43bffc,_0x2e83fc,_0x4fb759){var _0x4acf71=_['clone'](_0xe6f4cf);_0x4acf71[_0x6b23('0xd')]=_0x4fb759;_0x4acf71[_0x6b23('0xf')]=_0x5d25f8;_0x4acf71['account']=_0x58ee4f;_0x4acf71['id']=_0x2f170b;if(_0x43bffc){attributes[_0x6b23('0x13')](_[_0x6b23('0x14')](_0x34455d)+_0x6b23('0x15'));_0x2e83fc[util['format'](_0x6b23('0x16'),_0x34455d)][_0x2f170b]=_[_0x6b23('0x17')](_0x4acf71,attributes);}else{delete _0x2e83fc[util[_0x6b23('0x18')](_0x6b23('0x16'),_0x34455d)][_0x2f170b];}emit(util[_0x6b23('0x18')](_0x6b23('0x19'),_0x34455d,_0x5d25f8),util[_0x6b23('0x18')](_0x6b23('0x1a'),_0x34455d,_0x43bffc?_0x6b23('0x1b'):_0x6b23('0x1c')),_[_0x6b23('0x17')](_0x4acf71,attributes));}var rpc={'openchannelQueueReport':require(_0x6b23('0x1d')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x6b23('0x1e')),'smsQueueReport':require(_0x6b23('0x1f')),'faxQueueReport':require(_0x6b23('0x20')),'whatsappQueueReport':require(_0x6b23('0x21')),'chatInteraction':require(_0x6b23('0x22')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x6b23('0x23')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x6b23('0x24')),'whatsappInteraction':require(_0x6b23('0x25'))};var queue=schema({'name':{'type':_0x6b23('0x26'),'required':!![],'message':_0x6b23('0x27')},'timeout':{'type':_0x6b23('0x28'),'message':_0x6b23('0x29')}});function startRouting(_0x4b0bbd,_0x3f34bf,_0x2b58da,_0x38e3dc){if(_0x4b0bbd&&_0x3f34bf&&_0x2b58da){_0x3f34bf['waiting']+=0x1;var _0x38bab0={'uniqueid':_0x4b0bbd,'from':_0x2b58da[_0x6b23('0x2a')]?_0x2b58da[_0x6b23('0x2a')][_0x6b23('0x10')]:'','joinAt':moment()[_0x6b23('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2b58da[_0x6b23('0x2b')]?_0x2b58da[_0x6b23('0x2b')]['id']:null,'ListId':_0x2b58da[_0x6b23('0x2c')]?_0x2b58da[_0x6b23('0x2c')]['id']:null};_0x38bab0[_[_0x6b23('0x2d')](_0x2b58da['channel'])+'QueueId']=_0x3f34bf['id']||null;_0x38bab0[_[_0x6b23('0x2d')](_0x2b58da['channel'])+_0x6b23('0x15')]=_0x2b58da[_0x6b23('0x2e')]?_0x2b58da[_0x6b23('0x2e')]['id']:null;_0x38bab0[_[_0x6b23('0x2d')](_0x2b58da[_0x6b23('0x2f')])+_0x6b23('0x30')]=_0x2b58da['message']?_0x2b58da[_0x6b23('0x31')]['id']:null;_0x38bab0[_[_0x6b23('0x2d')](_0x2b58da[_0x6b23('0x2f')])+(_0x2b58da['channel']!=='chat'?_0x6b23('0x32'):_0x6b23('0x33'))]=_0x2b58da['account']?_0x2b58da[_0x6b23('0xe')]['id']:null;logger[_0x6b23('0x34')](util[_0x6b23('0x18')]('[%s][START:QUEUE][NAME:%s]',_0x4b0bbd,_0x3f34bf['name']));emitChannelQueueInteraction(_0x2b58da['channel'],_0x3f34bf[_0x6b23('0x35')],_0x38bab0,_0x2b58da[_0x6b23('0xe')]['name'],_0x2b58da[_0x6b23('0x31')]['id'],!![],_0x38e3dc,_0x3f34bf['id']);if(rpc[_0x2b58da[_0x6b23('0x2f')]+_0x6b23('0x36')]){return rpc[_0x2b58da[_0x6b23('0x2f')]+_0x6b23('0x36')][_0x6b23('0x37')](_0x38bab0)[_0x6b23('0x38')](function(_0x54ff2e){logger[_0x6b23('0x39')]('create\x20queue\x20report',_0x54ff2e);});}}}function stopRouting(_0x5a3f97,_0x4b6ef7,_0x142a30,_0x137249){if(_0x5a3f97&&_0x4b6ef7){_0x4b6ef7[_0x6b23('0x3a')]-=0x1;var _0x336a8c={'leaveAt':moment()[_0x6b23('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x6b23('0x18')](_0x6b23('0x3b')),'reason':_0x6b23('0x3c')};logger[_0x6b23('0x34')](util[_0x6b23('0x18')]('[%s][STOP:QUEUE][NAME:%s]',_0x5a3f97,_0x4b6ef7[_0x6b23('0x35')]));emitChannelQueueInteraction(_0x142a30[_0x6b23('0x2f')],_0x4b6ef7[_0x6b23('0x35')],_0x142a30[_0x6b23('0x2a')],_0x142a30[_0x6b23('0xe')][_0x6b23('0x35')],_0x142a30[_0x6b23('0x31')]['id'],![],_0x137249,_0x4b6ef7['id']);return rpc[_0x142a30[_0x6b23('0x2f')]+_0x6b23('0x3d')][_0x6b23('0x3e')](_0x142a30['interaction']['id'],{'queueId':_0x4b6ef7['id']})[_0x6b23('0x3f')](function(){if(rpc[_0x142a30['channel']+_0x6b23('0x36')]){return rpc[_0x142a30[_0x6b23('0x2f')]+_0x6b23('0x36')]['update'](_0x5a3f97,_0x336a8c)[_0x6b23('0x38')](function(_0x5baa0c){logger['error'](_0x6b23('0x40'),_0x5baa0c);});}});}}function endRouting(_0x4ddfc3,_0x53c316,_0x273b37,_0x29a258){if(_0x4ddfc3&&_0x53c316){_0x53c316['waiting']-=0x1;var _0x4d1a50={'leaveAt':moment()[_0x6b23('0x18')](_0x6b23('0x3b')),'exitAt':moment()[_0x6b23('0x18')](_0x6b23('0x3b')),'reason':_0x6b23('0x41')};logger[_0x6b23('0x34')](util[_0x6b23('0x18')](_0x6b23('0x42'),_0x4ddfc3,_0x53c316[_0x6b23('0x35')]));emitChannelQueueInteraction(_0x273b37[_0x6b23('0x2f')],_0x53c316[_0x6b23('0x35')],_0x273b37[_0x6b23('0x2a')],_0x273b37[_0x6b23('0xe')][_0x6b23('0x35')],_0x273b37[_0x6b23('0x31')]['id'],![],_0x29a258);if(rpc[_0x273b37['channel']+_0x6b23('0x36')]){return rpc[_0x273b37[_0x6b23('0x2f')]+_0x6b23('0x36')][_0x6b23('0x3e')](_0x4ddfc3,_0x4d1a50)['catch'](function(_0x7e0347){logger[_0x6b23('0x39')](_0x6b23('0x40'),_0x7e0347);});}}}function handleFindQueue(_0x1b9e9f){return function(_0x404cfb){return _0x404cfb[_0x6b23('0x35')][_0x6b23('0x43')]()===_0x1b9e9f[_0x6b23('0x43')]();};}exports[_0x6b23('0x44')]=function(_0x5a4bd1,_0x1e7c2c,_0x27136c,_0x2bb70a){return function(_0x204c06){try{var _0x29c64f={'name':_0x1e7c2c[0x0],'timeout':_0x1e7c2c[0x1]};var _0x4e4d2c=queue[_0x6b23('0x0')](_0x29c64f,{'typecast':!![]});if(_0x4e4d2c['length']){logger[_0x6b23('0x39')](_0x6b23('0x45'),_0x5a4bd1,_[_0x6b23('0x46')](_0x4e4d2c,_0x6b23('0x31'))[_0x6b23('0x47')](',\x20'));_0x204c06[_0x6b23('0x48')]();}else{var _0x300ba0=_[_0x6b23('0x49')](_0x27136c[_0x2bb70a[_0x6b23('0x2f')]+'Queues'],handleFindQueue(_0x29c64f[_0x6b23('0x35')]));if(_0x300ba0){startRouting(_0x5a4bd1,_0x300ba0,_0x2bb70a,_0x27136c);var _0x1cf91e=(_0x300ba0[_0x6b23('0x41')]||0xa)*0x3e8;var _0x584b2e=(_0x29c64f[_0x6b23('0x41')]||0x14)*0x3e8;var _0xd529e1;if(_0x1cf91e>_0x584b2e){_0x584b2e=_0x1cf91e;}var _0x287023=seqqueue[_0x6b23('0x4a')](_0x1cf91e);_0x287023['id']=_0x5a4bd1;_0x287023[_0x6b23('0x4b')]=_0x1cf91e;_0x287023[_0x6b23('0x4c')]=_0x584b2e;_0x287023[_0x6b23('0x2f')]=_0x2bb70a[_0x6b23('0x2f')];_0x27136c['rules'][_0x5a4bd1]['on'](_0x6b23('0x4d'),function(){logger[_0x6b23('0x34')](_0x6b23('0x4e'),_0x5a4bd1);stopRouting(_0x5a4bd1,_0x300ba0,_0x2bb70a,_0x27136c);clearTimeout(_0xd529e1);_0xd529e1=undefined;_0x287023[_0x6b23('0x4f')](!![]);if(_0x27136c[_0x6b23('0x50')][_0x5a4bd1]){delete _0x27136c['rules'][_0x5a4bd1];}_0x204c06['stop']();});_0x27136c[_0x6b23('0x50')][_0x5a4bd1]['on'](_0x6b23('0x51'),function(){if(_0x27136c['rules'][_0x5a4bd1]){delete _0x27136c['rules'][_0x5a4bd1];}});_0xd529e1=setTimeout(function(){logger[_0x6b23('0x34')](_0x6b23('0x52'),_0x5a4bd1);endRouting(_0x5a4bd1,_0x300ba0,_0x2bb70a,_0x27136c);clearTimeout(_0xd529e1);_0x287023[_0x6b23('0x4f')](!![]);_0x204c06[_0x6b23('0x53')]();},_0x584b2e);switch(_0x300ba0[_0x6b23('0x54')]){case _0x6b23('0x55'):strategy[_0x6b23('0x55')](_0x287023,_0x300ba0,_0x27136c,_0x2bb70a);break;default:strategy['beepall'](_0x287023,_0x300ba0,_0x27136c,_0x2bb70a);}}else{logger[_0x6b23('0x39')](_0x6b23('0x56'),_0x5a4bd1,_0x29c64f[_0x6b23('0x35')]);_0x204c06[_0x6b23('0x48')]();}}}catch(_0x5cbb2f){logger[_0x6b23('0x39')]('[%s][QUEUE]\x20%s',_0x5a4bd1,_0x5cbb2f['stack']);_0x204c06[_0x6b23('0x48')]();}};}; \ No newline at end of file +var _0xbced=['lodash','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','queue_id','queue','from','joinAt','emit','clone','account','push','InteractionId','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','interaction','message','chat','AccountId','WebsiteId','name','QueueReport','create','catch','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','stack','validate'];(function(_0x13c29b,_0x42e289){var _0x13d72c=function(_0x22ee5a){while(--_0x22ee5a){_0x13c29b['push'](_0x13c29b['shift']());}};_0x13d72c(++_0x42e289);}(_0xbced,0xab));var _0xdbce=function(_0xd08ae8,_0x1e7e2a){_0xd08ae8=_0xd08ae8-0x0;var _0x5e8c45=_0xbced[_0xd08ae8];return _0x5e8c45;};'use strict';var schema=require(_0xdbce('0x0'));var _=require(_0xdbce('0x1'));var util=require('util');var seqqueue=require(_0xdbce('0x2'));var moment=require(_0xdbce('0x3'));var Redis=require(_0xdbce('0x4'));var config=require(_0xdbce('0x5'));var logger=require(_0xdbce('0x6'))(_0xdbce('0x7'));var strategy=require(_0xdbce('0x8'));config[_0xdbce('0x9')]=_['defaults'](config['redis'],{'host':_0xdbce('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id',_0xdbce('0xb'),'account',_0xdbce('0xc'),_0xdbce('0xd'),_0xdbce('0xe')];function emit(_0x12544a,_0x393c50,_0x3878cd){io['to'](_0x12544a)[_0xdbce('0xf')](_0x393c50,_0x3878cd);}function emitChannelQueueInteraction(_0x195fbf,_0x4f1449,_0x461ec6,_0x3a5f9e,_0x2da558,_0xfa93a5,_0x2096d0,_0x85d34f){var _0x277c59=_[_0xdbce('0x10')](_0x461ec6);_0x277c59[_0xdbce('0xb')]=_0x85d34f;_0x277c59['queue']=_0x4f1449;_0x277c59[_0xdbce('0x11')]=_0x3a5f9e;_0x277c59['id']=_0x2da558;if(_0xfa93a5){attributes[_0xdbce('0x12')](_['capitalize'](_0x195fbf)+_0xdbce('0x13'));_0x2096d0[util[_0xdbce('0x14')]('%sQueuesWaitingInteractions',_0x195fbf)][_0x2da558]=_['pick'](_0x277c59,attributes);}else{delete _0x2096d0[util[_0xdbce('0x14')]('%sQueuesWaitingInteractions',_0x195fbf)][_0x2da558];}emit(util[_0xdbce('0x14')](_0xdbce('0x15'),_0x195fbf,_0x4f1449),util[_0xdbce('0x14')](_0xdbce('0x16'),_0x195fbf,_0xfa93a5?'save':_0xdbce('0x17')),_[_0xdbce('0x18')](_0x277c59,attributes));}var rpc={'openchannelQueueReport':require(_0xdbce('0x19')),'mailQueueReport':require(_0xdbce('0x1a')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xdbce('0x1b')),'whatsappQueueReport':require(_0xdbce('0x1c')),'chatInteraction':require(_0xdbce('0x1d')),'faxInteraction':require(_0xdbce('0x1e')),'mailInteraction':require(_0xdbce('0x1f')),'openchannelInteraction':require(_0xdbce('0x20')),'smsInteraction':require(_0xdbce('0x21')),'whatsappInteraction':require(_0xdbce('0x22'))};var queue=schema({'name':{'type':_0xdbce('0x23'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xdbce('0x24')}});function startRouting(_0x486245,_0x2d2766,_0x50fdd4,_0xc1fdd4){if(_0x486245&&_0x2d2766&&_0x50fdd4){_0x2d2766[_0xdbce('0x25')]+=0x1;var _0x453acf={'uniqueid':_0x486245,'from':_0x50fdd4[_0xdbce('0x26')]?_0x50fdd4[_0xdbce('0x26')][_0xdbce('0xd')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x50fdd4['contact']?_0x50fdd4[_0xdbce('0x27')]['id']:null,'ListId':_0x50fdd4[_0xdbce('0x28')]?_0x50fdd4[_0xdbce('0x28')]['id']:null};_0x453acf[_[_0xdbce('0x29')](_0x50fdd4[_0xdbce('0x2a')])+_0xdbce('0x2b')]=_0x2d2766['id']||null;_0x453acf[_['upperFirst'](_0x50fdd4[_0xdbce('0x2a')])+_0xdbce('0x13')]=_0x50fdd4[_0xdbce('0x2c')]?_0x50fdd4[_0xdbce('0x2c')]['id']:null;_0x453acf[_[_0xdbce('0x29')](_0x50fdd4[_0xdbce('0x2a')])+'MessageId']=_0x50fdd4[_0xdbce('0x2d')]?_0x50fdd4[_0xdbce('0x2d')]['id']:null;_0x453acf[_['upperFirst'](_0x50fdd4[_0xdbce('0x2a')])+(_0x50fdd4[_0xdbce('0x2a')]!==_0xdbce('0x2e')?_0xdbce('0x2f'):_0xdbce('0x30'))]=_0x50fdd4[_0xdbce('0x11')]?_0x50fdd4[_0xdbce('0x11')]['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0x486245,_0x2d2766['name']));emitChannelQueueInteraction(_0x50fdd4[_0xdbce('0x2a')],_0x2d2766[_0xdbce('0x31')],_0x453acf,_0x50fdd4[_0xdbce('0x11')][_0xdbce('0x31')],_0x50fdd4[_0xdbce('0x2d')]['id'],!![],_0xc1fdd4,_0x2d2766['id']);if(rpc[_0x50fdd4['channel']+'QueueReport']){return rpc[_0x50fdd4[_0xdbce('0x2a')]+_0xdbce('0x32')][_0xdbce('0x33')](_0x453acf)[_0xdbce('0x34')](function(_0x311feb){logger['error'](_0xdbce('0x35'),_0x311feb);});}}}function stopRouting(_0x552d18,_0x2d13a7,_0x2c5cec,_0x20f8eb){if(_0x552d18&&_0x2d13a7){_0x2d13a7[_0xdbce('0x25')]-=0x1;var _0x2131c0={'leaveAt':moment()[_0xdbce('0x14')](_0xdbce('0x36')),'acceptAt':moment()[_0xdbce('0x14')](_0xdbce('0x36')),'reason':_0xdbce('0x37')};logger[_0xdbce('0x38')](util[_0xdbce('0x14')](_0xdbce('0x39'),_0x552d18,_0x2d13a7['name']));emitChannelQueueInteraction(_0x2c5cec[_0xdbce('0x2a')],_0x2d13a7[_0xdbce('0x31')],_0x2c5cec[_0xdbce('0x26')],_0x2c5cec['account'][_0xdbce('0x31')],_0x2c5cec['message']['id'],![],_0x20f8eb,_0x2d13a7['id']);return rpc[_0x2c5cec[_0xdbce('0x2a')]+_0xdbce('0x3a')][_0xdbce('0x3b')](_0x2c5cec[_0xdbce('0x2c')]['id'],{'queueId':_0x2d13a7['id']})[_0xdbce('0x3c')](function(){if(rpc[_0x2c5cec['channel']+_0xdbce('0x32')]){return rpc[_0x2c5cec['channel']+'QueueReport']['update'](_0x552d18,_0x2131c0)[_0xdbce('0x34')](function(_0x1abf7c){logger[_0xdbce('0x3d')](_0xdbce('0x3e'),_0x1abf7c);});}});}}function endRouting(_0x22a5d6,_0x3ac2fb,_0x2773f4,_0x4c2b4a){if(_0x22a5d6&&_0x3ac2fb){_0x3ac2fb['waiting']-=0x1;var _0x4f02fd={'leaveAt':moment()[_0xdbce('0x14')](_0xdbce('0x36')),'exitAt':moment()['format'](_0xdbce('0x36')),'reason':_0xdbce('0x3f')};logger['info'](util[_0xdbce('0x14')](_0xdbce('0x40'),_0x22a5d6,_0x3ac2fb[_0xdbce('0x31')]));emitChannelQueueInteraction(_0x2773f4[_0xdbce('0x2a')],_0x3ac2fb[_0xdbce('0x31')],_0x2773f4[_0xdbce('0x26')],_0x2773f4['account'][_0xdbce('0x31')],_0x2773f4['message']['id'],![],_0x4c2b4a);if(rpc[_0x2773f4[_0xdbce('0x2a')]+'QueueReport']){return rpc[_0x2773f4['channel']+_0xdbce('0x32')][_0xdbce('0x3b')](_0x22a5d6,_0x4f02fd)[_0xdbce('0x34')](function(_0x4eb0a4){logger['error'](_0xdbce('0x3e'),_0x4eb0a4);});}}}function handleFindQueue(_0x68273e){return function(_0x29b2a0){return _0x29b2a0[_0xdbce('0x31')][_0xdbce('0x41')]()===_0x68273e['toLowerCase']();};}exports[_0xdbce('0x42')]=function(_0x4ffa10,_0x24e236,_0x4756e3,_0x2d26a8){return function(_0x50e1ac){try{var _0xde8a34={'name':_0x24e236[0x0],'timeout':_0x24e236[0x1]};var _0x39e12f=queue[_0xdbce('0x0')](_0xde8a34,{'typecast':!![]});if(_0x39e12f[_0xdbce('0x43')]){logger['error'](_0xdbce('0x44'),_0x4ffa10,_[_0xdbce('0x45')](_0x39e12f,_0xdbce('0x2d'))[_0xdbce('0x46')](',\x20'));_0x50e1ac[_0xdbce('0x47')]();}else{var _0x289503=_[_0xdbce('0x48')](_0x4756e3[_0x2d26a8['channel']+_0xdbce('0x49')],handleFindQueue(_0xde8a34['name']));if(_0x289503){startRouting(_0x4ffa10,_0x289503,_0x2d26a8,_0x4756e3);var _0xd842e0=(_0x289503[_0xdbce('0x3f')]||0xa)*0x3e8;var _0x2430e2=(_0xde8a34[_0xdbce('0x3f')]||0x14)*0x3e8;var _0x626e56;if(_0xd842e0>_0x2430e2){_0x2430e2=_0xd842e0;}var _0x20da80=seqqueue[_0xdbce('0x4a')](_0xd842e0);_0x20da80['id']=_0x4ffa10;_0x20da80[_0xdbce('0x4b')]=_0xd842e0;_0x20da80['qtimeout']=_0x2430e2;_0x20da80[_0xdbce('0x2a')]=_0x2d26a8[_0xdbce('0x2a')];_0x4756e3[_0xdbce('0x4c')][_0x4ffa10]['on']('end',function(){logger[_0xdbce('0x38')](_0xdbce('0x4d'),_0x4ffa10);stopRouting(_0x4ffa10,_0x289503,_0x2d26a8,_0x4756e3);clearTimeout(_0x626e56);_0x626e56=undefined;_0x20da80[_0xdbce('0x4e')](!![]);if(_0x4756e3['rules'][_0x4ffa10]){delete _0x4756e3[_0xdbce('0x4c')][_0x4ffa10];}_0x50e1ac['stop']();});_0x4756e3['rules'][_0x4ffa10]['on'](_0xdbce('0x4f'),function(){if(_0x4756e3[_0xdbce('0x4c')][_0x4ffa10]){delete _0x4756e3[_0xdbce('0x4c')][_0x4ffa10];}});_0x626e56=setTimeout(function(){logger[_0xdbce('0x38')](_0xdbce('0x50'),_0x4ffa10);endRouting(_0x4ffa10,_0x289503,_0x2d26a8,_0x4756e3);clearTimeout(_0x626e56);_0x20da80[_0xdbce('0x4e')](!![]);_0x50e1ac[_0xdbce('0x51')]();},_0x2430e2);switch(_0x289503[_0xdbce('0x52')]){case _0xdbce('0x53'):strategy[_0xdbce('0x53')](_0x20da80,_0x289503,_0x4756e3,_0x2d26a8);break;default:strategy[_0xdbce('0x54')](_0x20da80,_0x289503,_0x4756e3,_0x2d26a8);}}else{logger[_0xdbce('0x3d')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4ffa10,_0xde8a34[_0xdbce('0x31')]);_0x50e1ac['stop']();}}}catch(_0x54f70a){logger['error'](_0xdbce('0x44'),_0x4ffa10,_0x54f70a[_0xdbce('0x55')]);_0x50e1ac[_0xdbce('0x47')]();}};}; \ 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 863cc09..b3e647d 100644 --- a/server/services/routing/server/applications/strategy/agent.js +++ b/server/services/routing/server/applications/strategy/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29d4=['routing','notificationId','squeue','agent','realtime','push','bind','timeout','handleDrained','prototype','handleRun','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','saveWaitingNotification','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger'];(function(_0x521154,_0x1ecaef){var _0x57f638=function(_0x1235b3){while(--_0x1235b3){_0x521154['push'](_0x521154['shift']());}};_0x57f638(++_0x1ecaef);}(_0x29d4,0x1a1));var _0x429d=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x29d4[_0x138f59];return _0x3d114d;};'use strict';var _=require(_0x429d('0x0'));var uuid=require('uuid');var util=require(_0x429d('0x1'));var logger=require(_0x429d('0x2'))(_0x429d('0x3'));var Agent=function(_0x472fc9,_0x45df1c,_0x4e287b,_0xc3989d){this[_0x429d('0x4')]=uuid['v4']();this[_0x429d('0x5')]=_0x472fc9;this[_0x429d('0x6')]=_0x45df1c;this[_0x429d('0x7')]=_0x4e287b;this[_0x429d('0x3')]=_0xc3989d;this[_0x429d('0x5')][_0x429d('0x8')](this['handleRun'][_0x429d('0x9')](this),this['handleTimeout'][_0x429d('0x9')](this));this[_0x429d('0x5')]['on'](_0x429d('0xa'),this['handleTimeout'][_0x429d('0x9')](this));this[_0x429d('0x5')]['on']('drained',this[_0x429d('0xb')][_0x429d('0x9')](this));};Agent[_0x429d('0xc')]['push']=function(){this[_0x429d('0x5')][_0x429d('0x8')](this[_0x429d('0xd')][_0x429d('0x9')](this),this['handleTimeout'][_0x429d('0x9')](this));};Agent[_0x429d('0xc')][_0x429d('0xb')]=function(){this['handleTimeout'](!![]);};Agent[_0x429d('0xc')][_0x429d('0xd')]=function(){logger['debug'](_0x429d('0xe'),this[_0x429d('0x5')]['id'],this[_0x429d('0x6')]['id']);if(_[_0x429d('0xf')](this[_0x429d('0x7')][_0x429d('0x10')][this['agent']['id']])){logger[_0x429d('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x429d('0x5')]['id'],this[_0x429d('0x6')]['id']);setTimeout(this[_0x429d('0x8')][_0x429d('0x9')](this),0x3e8);}else{if(this['routing'][_0x429d('0x12')]||util[_0x429d('0x13')](this[_0x429d('0x5')]['id'],this['realtime'][_0x429d('0x10')][this[_0x429d('0x6')]['id']],this[_0x429d('0x5')][_0x429d('0x14')],![])){this[_0x429d('0x7')][_0x429d('0x10')][this['agent']['id']][_0x429d('0x15')]=!![];this[_0x429d('0x7')][_0x429d('0x10')][this['agent']['id']][_0x429d('0x16')]=undefined;util[_0x429d('0x17')](this[_0x429d('0x7')],this[_0x429d('0x3')],this[_0x429d('0x6')],this[_0x429d('0x5')]['channel']);util[_0x429d('0x18')](this[_0x429d('0x4')],this['squeue']['id'],this[_0x429d('0x7')][_0x429d('0x10')][this[_0x429d('0x6')]['id']],null,this[_0x429d('0x3')]);util['writeLog'](this[_0x429d('0x5')]['id'],this[_0x429d('0x7')][_0x429d('0x10')][this[_0x429d('0x6')]['id']],_0x429d('0x19')+(this['routing'][_0x429d('0x12')]?_0x429d('0x1a'):''));}else{logger[_0x429d('0x11')](_0x429d('0x1b'),this[_0x429d('0x5')]['id'],this[_0x429d('0x6')]['id']);setTimeout(this[_0x429d('0x8')][_0x429d('0x9')](this),0x3e8);}}};Agent[_0x429d('0xc')]['handleTimeout']=function(_0x31cae6){if(_[_0x429d('0xf')](this['realtime'][_0x429d('0x10')][this[_0x429d('0x6')]['id']])){return logger[_0x429d('0x11')](_0x429d('0x1c'),this[_0x429d('0x5')]['id'],this['agent']['id']);}else{logger[_0x429d('0x11')](_0x429d('0x1d'),this[_0x429d('0x5')]['id'],this[_0x429d('0x6')]['id']);util[_0x429d('0x1e')](this[_0x429d('0x4')],this['squeue']['id'],this['realtime'][_0x429d('0x10')][this[_0x429d('0x6')]['id']],null,this['routing']);this['realtime'][_0x429d('0x10')][this['agent']['id']][_0x429d('0x15')]=![];this[_0x429d('0x7')][_0x429d('0x10')][this[_0x429d('0x6')]['id']]['busyQueue']=undefined;util[_0x429d('0x1f')](this[_0x429d('0x7')],this['routing'],this['agent'],this['squeue']['channel']);util['writeLog'](this[_0x429d('0x5')]['id'],this['realtime']['agents'][this[_0x429d('0x6')]['id']],_0x31cae6?_0x429d('0x20'):_0x429d('0x21'));}if(!_0x31cae6){setTimeout(this[_0x429d('0x8')][_0x429d('0x9')](this),0x3e8);}};function agent(_0x1a5d80,_0x4b23ab,_0x423dc8,_0x2c5fa5){return new Agent(_0x1a5d80,_0x4b23ab,_0x423dc8,_0x2c5fa5);}module[_0x429d('0x22')]=agent; \ No newline at end of file +var _0x68fc=['timeout','drained','prototype','push','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','busy','busyQueue','saveWaitingNotification','showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','TIMEOUT','exports','lodash','uuid','./util','squeue','agent','realtime','routing','handleRun','bind','handleTimeout'];(function(_0x4470b6,_0x5f18f7){var _0x2ead58=function(_0x1f6609){while(--_0x1f6609){_0x4470b6['push'](_0x4470b6['shift']());}};_0x2ead58(++_0x5f18f7);}(_0x68fc,0xa5));var _0xc68f=function(_0x42af9d,_0x29a66b){_0x42af9d=_0x42af9d-0x0;var _0x494e23=_0x68fc[_0x42af9d];return _0x494e23;};'use strict';var _=require(_0xc68f('0x0'));var uuid=require(_0xc68f('0x1'));var util=require(_0xc68f('0x2'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x26513f,_0x506fb5,_0xe70787,_0x593648){this['notificationId']=uuid['v4']();this[_0xc68f('0x3')]=_0x26513f;this[_0xc68f('0x4')]=_0x506fb5;this[_0xc68f('0x5')]=_0xe70787;this[_0xc68f('0x6')]=_0x593648;this['squeue']['push'](this[_0xc68f('0x7')][_0xc68f('0x8')](this),this[_0xc68f('0x9')][_0xc68f('0x8')](this));this[_0xc68f('0x3')]['on'](_0xc68f('0xa'),this[_0xc68f('0x9')][_0xc68f('0x8')](this));this[_0xc68f('0x3')]['on'](_0xc68f('0xb'),this['handleDrained'][_0xc68f('0x8')](this));};Agent[_0xc68f('0xc')][_0xc68f('0xd')]=function(){this[_0xc68f('0x3')][_0xc68f('0xd')](this[_0xc68f('0x7')][_0xc68f('0x8')](this),this[_0xc68f('0x9')][_0xc68f('0x8')](this));};Agent[_0xc68f('0xc')][_0xc68f('0xe')]=function(){this['handleTimeout'](!![]);};Agent[_0xc68f('0xc')][_0xc68f('0x7')]=function(){logger[_0xc68f('0xf')](_0xc68f('0x10'),this[_0xc68f('0x3')]['id'],this[_0xc68f('0x4')]['id']);if(_[_0xc68f('0x11')](this[_0xc68f('0x5')][_0xc68f('0x12')][this['agent']['id']])){logger['debug'](_0xc68f('0x13'),this[_0xc68f('0x3')]['id'],this[_0xc68f('0x4')]['id']);setTimeout(this[_0xc68f('0xd')][_0xc68f('0x8')](this),0x3e8);}else{if(this[_0xc68f('0x6')]['forcedOwnership']||util[_0xc68f('0x14')](this[_0xc68f('0x3')]['id'],this[_0xc68f('0x5')][_0xc68f('0x12')][this[_0xc68f('0x4')]['id']],this[_0xc68f('0x3')][_0xc68f('0x15')],![])){this[_0xc68f('0x5')]['agents'][this[_0xc68f('0x4')]['id']][_0xc68f('0x16')]=!![];this[_0xc68f('0x5')]['agents'][this[_0xc68f('0x4')]['id']][_0xc68f('0x17')]=undefined;util[_0xc68f('0x18')](this[_0xc68f('0x5')],this[_0xc68f('0x6')],this[_0xc68f('0x4')],this[_0xc68f('0x3')]['channel']);util[_0xc68f('0x19')](this[_0xc68f('0x1a')],this['squeue']['id'],this[_0xc68f('0x5')][_0xc68f('0x12')][this[_0xc68f('0x4')]['id']],null,this[_0xc68f('0x6')]);util[_0xc68f('0x1b')](this['squeue']['id'],this[_0xc68f('0x5')][_0xc68f('0x12')][this['agent']['id']],_0xc68f('0x1c')+(this[_0xc68f('0x6')]['forcedOwnership']?_0xc68f('0x1d'):''));}else{logger[_0xc68f('0xf')](_0xc68f('0x1e'),this[_0xc68f('0x3')]['id'],this['agent']['id']);setTimeout(this[_0xc68f('0xd')][_0xc68f('0x8')](this),0x3e8);}}};Agent[_0xc68f('0xc')][_0xc68f('0x9')]=function(_0x1ba1ac){if(_[_0xc68f('0x11')](this[_0xc68f('0x5')][_0xc68f('0x12')][this['agent']['id']])){return logger[_0xc68f('0xf')](_0xc68f('0x13'),this['squeue']['id'],this[_0xc68f('0x4')]['id']);}else{logger[_0xc68f('0xf')](_0xc68f('0x1f'),this[_0xc68f('0x3')]['id'],this['agent']['id']);util[_0xc68f('0x20')](this[_0xc68f('0x1a')],this['squeue']['id'],this[_0xc68f('0x5')][_0xc68f('0x12')][this[_0xc68f('0x4')]['id']],null,this[_0xc68f('0x6')]);this[_0xc68f('0x5')]['agents'][this['agent']['id']][_0xc68f('0x16')]=![];this[_0xc68f('0x5')][_0xc68f('0x12')][this[_0xc68f('0x4')]['id']][_0xc68f('0x17')]=undefined;util['removeWaitingNotification'](this['realtime'],this[_0xc68f('0x6')],this['agent'],this[_0xc68f('0x3')][_0xc68f('0x15')]);util[_0xc68f('0x1b')](this[_0xc68f('0x3')]['id'],this[_0xc68f('0x5')][_0xc68f('0x12')][this[_0xc68f('0x4')]['id']],_0x1ba1ac?'STOP':_0xc68f('0x21'));}if(!_0x1ba1ac){setTimeout(this[_0xc68f('0xd')][_0xc68f('0x8')](this),0x3e8);}};function agent(_0x360810,_0xc12ffb,_0x2555c0,_0x3c36f1){return new Agent(_0x360810,_0xc12ffb,_0x2555c0,_0x3c36f1);}module[_0xc68f('0x22')]=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 e315e96..a0ca51e 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 _0x5a81=['STOP','busy','exports','lodash','uuid','routing','squeue','push','handleRun','bind','timeout','handleTimeout','drained','prototype','handleDrained','isNil','queue','Agents','length','realtime','agents','debug','isAgentAvailable','channel','writeLog','RINGING','busyQueue','name','saveWaitingNotification','showNotification','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5a81,0xcf));var _0x15a8=function(_0x1ad85a,_0x885a1b){_0x1ad85a=_0x1ad85a-0x0;var _0x6d7d67=_0x5a81[_0x1ad85a];return _0x6d7d67;};'use strict';var _=require(_0x15a8('0x0'));var uuid=require(_0x15a8('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')(_0x15a8('0x2'));var Beepall=function(_0x46f455,_0x43d639,_0x8a019b,_0x303e0a){this['notificationId']=uuid['v4']();this[_0x15a8('0x3')]=_0x46f455;this['queue']=_0x43d639;this['realtime']=_0x8a019b;this[_0x15a8('0x2')]=_0x303e0a;this['squeue'][_0x15a8('0x4')](this[_0x15a8('0x5')][_0x15a8('0x6')](this),this['handleTimeout']['bind'](this));this[_0x15a8('0x3')]['on'](_0x15a8('0x7'),this[_0x15a8('0x8')][_0x15a8('0x6')](this));this['squeue']['on'](_0x15a8('0x9'),this['handleDrained'][_0x15a8('0x6')](this));};Beepall[_0x15a8('0xa')]['push']=function(){this[_0x15a8('0x3')][_0x15a8('0x4')](this[_0x15a8('0x5')]['bind'](this),this['handleTimeout'][_0x15a8('0x6')](this));};Beepall['prototype'][_0x15a8('0xb')]=function(){this[_0x15a8('0x8')](!![]);};Beepall[_0x15a8('0xa')][_0x15a8('0x5')]=function(){var _0x3da2eb=!![];if(!_[_0x15a8('0xc')](this['queue'])&&!_[_0x15a8('0xc')](this[_0x15a8('0xd')][_0x15a8('0xe')])&&this[_0x15a8('0xd')]['Agents']['length']>0x0){for(var _0x196597=0x0,_0x281370;_0x1965970x0){for(var _0x41ca40=0x0,_0x3225aa;_0x41ca400x0&&_0x21505a[_0x5ca840+_0x6ede('0x23')]>=_0x21505a[_0x5ca840+_0x6ede('0x22')]){writeLog(_0x5330c8,_0x21505a,_0x5ca840['toUpperCase']()+_0x6ede('0x24'));return![];}}return!![];};exports[_0x6ede('0x25')]=function(_0x135174,_0x5e033b,_0xff51d5,_0x2f996d,_0x362e50){return sendNotification(!![],_0x135174,_0x5e033b,_0xff51d5,_0x2f996d,_0x362e50);};exports[_0x6ede('0x26')]=function(_0x44d469,_0x354c21,_0x821bdf,_0x1ecd17,_0x44797e){return sendNotification(![],_0x44d469,_0x354c21,_0x821bdf,_0x1ecd17,_0x44797e);};exports[_0x6ede('0x27')]=function(_0x5a3c31,_0x33fe9b,_0x313640){var _0x50f3c9=_0x33fe9b[_0x6ede('0x28')][_0x6ede('0x29')];if(!_0x50f3c9&&_0x313640){_0x50f3c9=_0x313640['id'];}var _0x4bf329=_['some'](_0x5a3c31[_0x33fe9b[_0x6ede('0x2a')]+'QueuesWaitingInteractions'],function(_0x251c42){var _0xdb984=_['capitalize'](_0x33fe9b['channel'])+'InteractionId';return _0x251c42[_0xdb984]===_0x33fe9b[_0x6ede('0x28')]['id'];});if(!_0x4bf329&&_0x50f3c9&&_0x5a3c31['agents'][_0x50f3c9]){_0x4bf329=_['some'](_0x5a3c31[_0x6ede('0x2b')][_0x50f3c9][_0x33fe9b['channel']+_0x6ede('0x2c')],function(_0x4ee6db){return _0x4ee6db['id']===_0x33fe9b[_0x6ede('0x28')]['id'];});}return _0x4bf329;};exports['saveWaitingNotification']=function(_0x4932cd,_0x469b2a,_0x1b0c1c,_0x27d7b4){if(_0x1b0c1c&&_0x1b0c1c['id']&&_0x4932cd['agents']&&_0x4932cd[_0x6ede('0x2b')][_0x1b0c1c['id']]){_0x4932cd[_0x6ede('0x2b')][_0x1b0c1c['id']][_0x27d7b4+'WaitingInteractions'][_0x469b2a['message']['id']]={'id':_0x469b2a[_0x6ede('0x28')]['id']};}};exports['removeWaitingNotification']=function(_0x52a726,_0x5356ee,_0x354920,_0x380986){if(_0x354920&&_0x354920['id']&&_0x52a726[_0x6ede('0x2b')]&&_0x52a726['agents'][_0x354920['id']]){delete _0x52a726[_0x6ede('0x2b')][_0x354920['id']][_0x380986+_0x6ede('0x2c')][_0x5356ee[_0x6ede('0x16')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file +var _0x9648=['interaction','some','QueuesWaitingInteractions','capitalize','channel','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','message','writeLog','lodash','../utils','../../../../../config/environment','../../../../../config/logger','routing','redis','localhost','socket.io-emitter','split','\x20interaction','name','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','emit','notification:%s','save','remove','isAgentAvailable','busy','BUSY','online','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','hideNotification','checkWaitingNotifications'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0x9648,0xa4));var _0x8964=function(_0x1afb92,_0x54ec35){_0x1afb92=_0x1afb92-0x0;var _0x266e5a=_0x9648[_0x1afb92];return _0x266e5a;};'use strict';var _=require(_0x8964('0x0'));var util=require('util');var utils=require(_0x8964('0x1'));var Redis=require('ioredis');var config=require(_0x8964('0x2'));var logger=require(_0x8964('0x3'))(_0x8964('0x4'));config[_0x8964('0x5')]=_['defaults'](config[_0x8964('0x5')],{'host':_0x8964('0x6'),'port':0x18eb});var io=require(_0x8964('0x7'))(new Redis(config[_0x8964('0x5')]));function sendNotification(_0xcf2dbf,_0x27c139,_0x54fea9,_0x13b24f,_0x11bf9a,_0x4a04b7){var _0x3b625c=_0x4a04b7||{};var _0x47b2ce=_0x54fea9[_0x8964('0x8')]('.');var _0x5ef044={'uniqueid':_0x27c139,'channel':_0x47b2ce[0x0],'id':_0x47b2ce[0x1],'title':_0x47b2ce[0x0]+_0x8964('0x9'),'interactionId':_0x47b2ce[0x2],'queue':_0x11bf9a?_0x11bf9a[_0x8964('0xa')]:null,'sound':_0x3b625c[_0x8964('0xb')][_0x8964('0xc')],'shake':_0x3b625c[_0x8964('0xb')][_0x8964('0xd')]};try{if(!_0x3b625c[_0x8964('0xe')]){_0x3b625c[_0x8964('0xe')]={};}if(_0x11bf9a){_0x3b625c[_0x8964('0xe')][_0x8964('0xf')]=_0x11bf9a;}else if(_0x3b625c[_0x8964('0xe')][_0x8964('0xf')]){delete _0x3b625c[_0x8964('0xe')][_0x8964('0xf')];}_0x5ef044[_0x8964('0x10')]=utils[_0x8964('0x11')](_0x3b625c[_0x8964('0xb')][_0x8964('0x12')],_0x3b625c);}catch(_0x42e564){_0x5ef044['msg']=_0x8964('0x13');logger[_0x8964('0x14')](util[_0x8964('0x15')](_0x8964('0x16'),_0x27c139,_0x42e564['message']));}io['to'](util[_0x8964('0x15')]('user:%s',_0x13b24f['name']))[_0x8964('0x17')](util[_0x8964('0x15')](_0x8964('0x18'),_0xcf2dbf?_0x8964('0x19'):_0x8964('0x1a')),_0x5ef044);}function writeLog(_0x26dc1d,_0xa74de9,_0x3d9679){return logger['debug'](util['format']('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x26dc1d,_0xa74de9[_0x8964('0xa')],_0x3d9679));}exports[_0x8964('0x1b')]=function(_0x6233e8,_0x2679e2,_0x627494,_0x205995){if(_0x2679e2[_0x8964('0x1c')]){writeLog(_0x6233e8,_0x2679e2,_0x8964('0x1d'));return![];}if(!_0x2679e2[_0x8964('0x1e')]){writeLog(_0x6233e8,_0x2679e2,'OFFLINE');return![];}if(_0x2679e2[_0x627494+_0x8964('0x1f')]){writeLog(_0x6233e8,_0x2679e2,_0x8964('0x20'));return![];}if(_0x205995&&_0x2679e2[_0x8964('0x21')](_0x627494+_0x8964('0x22'))&&_0x2679e2[_0x8964('0x21')](_0x627494+_0x8964('0x23'))){if(_0x2679e2[_0x627494+_0x8964('0x22')]>0x0&&_0x2679e2[_0x627494+'CurrentCapacity']>=_0x2679e2[_0x627494+_0x8964('0x22')]){writeLog(_0x6233e8,_0x2679e2,_0x627494[_0x8964('0x24')]()+_0x8964('0x25'));return![];}}return!![];};exports['showNotification']=function(_0x5bfcb6,_0xf82d27,_0x98fb02,_0x81b509,_0x43d594){return sendNotification(!![],_0x5bfcb6,_0xf82d27,_0x98fb02,_0x81b509,_0x43d594);};exports[_0x8964('0x26')]=function(_0x4555ca,_0x402c3a,_0x3d445e,_0x265d42,_0x2a5129){return sendNotification(![],_0x4555ca,_0x402c3a,_0x3d445e,_0x265d42,_0x2a5129);};exports[_0x8964('0x27')]=function(_0x13b58f,_0xd7350d,_0x448d4c){var _0x313d14=_0xd7350d[_0x8964('0x28')]['UserId'];if(!_0x313d14&&_0x448d4c){_0x313d14=_0x448d4c['id'];}var _0x31806b=_[_0x8964('0x29')](_0x13b58f[_0xd7350d['channel']+_0x8964('0x2a')],function(_0x5ebf04){var _0x33822a=_[_0x8964('0x2b')](_0xd7350d[_0x8964('0x2c')])+'InteractionId';return _0x5ebf04[_0x33822a]===_0xd7350d[_0x8964('0x28')]['id'];});if(!_0x31806b&&_0x313d14&&_0x13b58f[_0x8964('0x2d')][_0x313d14]){_0x31806b=_[_0x8964('0x29')](_0x13b58f[_0x8964('0x2d')][_0x313d14][_0xd7350d[_0x8964('0x2c')]+_0x8964('0x2e')],function(_0x1c8624){return _0x1c8624['id']===_0xd7350d['interaction']['id'];});}return _0x31806b;};exports[_0x8964('0x2f')]=function(_0x4085f0,_0x37ce2b,_0x9ca151,_0x4b6804){if(_0x9ca151&&_0x9ca151['id']&&_0x4085f0[_0x8964('0x2d')]&&_0x4085f0[_0x8964('0x2d')][_0x9ca151['id']]){_0x4085f0[_0x8964('0x2d')][_0x9ca151['id']][_0x4b6804+_0x8964('0x2e')][_0x37ce2b['message']['id']]={'id':_0x37ce2b[_0x8964('0x28')]['id']};}};exports[_0x8964('0x30')]=function(_0x2e67d9,_0x54d887,_0x311160,_0x3b6dc0){if(_0x311160&&_0x311160['id']&&_0x2e67d9[_0x8964('0x2d')]&&_0x2e67d9[_0x8964('0x2d')][_0x311160['id']]){delete _0x2e67d9['agents'][_0x311160['id']][_0x3b6dc0+'WaitingInteractions'][_0x54d887[_0x8964('0x31')]['id']];}};exports[_0x8964('0x32')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 9822186..344640e 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 _0x8512=['error','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x8512,0x70));var _0x2851=function(_0x3d00be,_0x44a706){_0x3d00be=_0x3d00be-0x0;var _0x32fef9=_0x8512[_0x3d00be];return _0x32fef9;};'use strict';var schema=require(_0x2851('0x0'));var sh=require(_0x2851('0x1'));var _=require(_0x2851('0x2'));var utils=require(_0x2851('0x3'));var logger=require(_0x2851('0x4'))('routing');var system=schema({'command':{'type':_0x2851('0x5'),'required':!![],'message':_0x2851('0x6')}});exports[_0x2851('0x7')]=function(_0x5c6dff,_0x5b9dd2){return function(_0x4805a7){try{var _0x151165={'command':_0x5b9dd2[0x0]};var _0x206c79=system[_0x2851('0x0')](_0x151165,{'typecast':!![]});if(_0x206c79['length']){logger[_0x2851('0x8')]('[%s][SYSTEM]\x20%s',_0x5c6dff,_[_0x2851('0x9')](_0x206c79,_0x2851('0xa'))[_0x2851('0xb')](',\x20'));logger[_0x2851('0xc')](_0x2851('0xd'),_0x5c6dff);_0x4805a7['next']();}else{var _0x2b2830=this;var _0x1ffb30=utils[_0x2851('0xe')](_0x5b9dd2[0x0],this);logger[_0x2851('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x5c6dff,_0x1ffb30);sh['exec'](_['trim'](_0x1ffb30),function(_0xac535a,_0x57c2f2){logger[_0x2851('0xc')](_0x2851('0xf'),_0x5c6dff,_0xac535a);if(_0xac535a==0x0){var _0x67e7c0=_0x57c2f2['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x2851('0x10')](_0x5b9dd2[0x1])||_[_0x2851('0x11')](_0x5b9dd2[0x1])){logger[_0x2851('0xc')]('[%s][SYSTEM]\x20no\x20variable',_0x5c6dff);_0x2b2830[_0x2851('0x12')][_0x5b9dd2[0x1]]=_0x67e7c0;}else{logger[_0x2851('0xc')](_0x2851('0x13'),_0x5c6dff,_0x5b9dd2[0x1],_0x67e7c0);_0x2b2830[_0x2851('0x12')][_0x5b9dd2[0x1]]=_0x67e7c0;}}_0x4805a7[_0x2851('0x14')]();});}}catch(_0x10d8c6){logger[_0x2851('0x8')](_0x2851('0x15'),_0x5c6dff,_[_0x2851('0x16')](_0x10d8c6)?JSON[_0x2851('0x17')](_0x10d8c6):_0x10d8c6);logger[_0x2851('0xc')](_0x2851('0xd'),_0x5c6dff);_0x4805a7[_0x2851('0x14')]();}};}; \ No newline at end of file +var _0x6b0b=['lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify','shelljs'];(function(_0x228657,_0x4d1486){var _0x2153c4=function(_0x4131a3){while(--_0x4131a3){_0x228657['push'](_0x228657['shift']());}};_0x2153c4(++_0x4d1486);}(_0x6b0b,0x144));var _0xb6b0=function(_0xf25fa5,_0x11c625){_0xf25fa5=_0xf25fa5-0x0;var _0x9eaba=_0x6b0b[_0xf25fa5];return _0x9eaba;};'use strict';var schema=require('validate');var sh=require(_0xb6b0('0x0'));var _=require(_0xb6b0('0x1'));var utils=require(_0xb6b0('0x2'));var logger=require(_0xb6b0('0x3'))(_0xb6b0('0x4'));var system=schema({'command':{'type':_0xb6b0('0x5'),'required':!![],'message':_0xb6b0('0x6')}});exports[_0xb6b0('0x7')]=function(_0x2f5ed3,_0x460569){return function(_0x59783c){try{var _0x2bfe26={'command':_0x460569[0x0]};var _0x26464e=system[_0xb6b0('0x8')](_0x2bfe26,{'typecast':!![]});if(_0x26464e[_0xb6b0('0x9')]){logger['error'](_0xb6b0('0xa'),_0x2f5ed3,_[_0xb6b0('0xb')](_0x26464e,_0xb6b0('0xc'))[_0xb6b0('0xd')](',\x20'));logger[_0xb6b0('0xe')](_0xb6b0('0xf'),_0x2f5ed3);_0x59783c[_0xb6b0('0x10')]();}else{var _0x2dbb1e=this;var _0x5db405=utils[_0xb6b0('0x11')](_0x460569[0x0],this);logger[_0xb6b0('0xe')](_0xb6b0('0x12'),_0x2f5ed3,_0x5db405);sh[_0xb6b0('0x13')](_['trim'](_0x5db405),function(_0x294867,_0x5e708d){logger[_0xb6b0('0xe')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x2f5ed3,_0x294867);if(_0x294867==0x0){var _0x14ef1e=_0x5e708d['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x460569[0x1])||_['isEmpty'](_0x460569[0x1])){logger[_0xb6b0('0xe')]('[%s][SYSTEM]\x20no\x20variable',_0x2f5ed3);_0x2dbb1e[_0xb6b0('0x14')][_0x460569[0x1]]=_0x14ef1e;}else{logger[_0xb6b0('0xe')](_0xb6b0('0x15'),_0x2f5ed3,_0x460569[0x1],_0x14ef1e);_0x2dbb1e[_0xb6b0('0x14')][_0x460569[0x1]]=_0x14ef1e;}}_0x59783c[_0xb6b0('0x10')]();});}}catch(_0x80c930){logger[_0xb6b0('0x16')]('[%s][SYSTEM]\x20%s',_0x2f5ed3,_[_0xb6b0('0x17')](_0x80c930)?JSON[_0xb6b0('0x18')](_0x80c930):_0x80c930);logger['info'](_0xb6b0('0xf'),_0x2f5ed3);_0x59783c[_0xb6b0('0x10')]();}};}; \ 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 762c73f..d4c8e04 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 _0x5e99=['finally','next','stringify','validate','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5e99,0xab));var _0x95e9=function(_0x5aa8a1,_0x3d5f37){_0x5aa8a1=_0x5aa8a1-0x0;var _0x40f142=_0x5e99[_0x5aa8a1];return _0x40f142;};'use strict';var schema=require(_0x95e9('0x0'));var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x95e9('0x1')),'faxInteraction':require(_0x95e9('0x2')),'whatsappInteraction':require(_0x95e9('0x3'))};var logger=require('../../../../config/logger')(_0x95e9('0x4'));var tag=schema({'tag':{'type':_0x95e9('0x5'),'required':!![],'message':_0x95e9('0x6')}});exports[_0x95e9('0x7')]=function(_0x444f2b,_0x4bfc22,_0x1fcf39,_0x478b1c){return function(_0x2d84c3){try{var _0x778941={'tag':_0x4bfc22[0x0]};var _0x350982=tag[_0x95e9('0x0')](_0x778941,{'typecast':!![]});if(_0x350982['length']){logger[_0x95e9('0x8')](_0x95e9('0x9'),_0x444f2b,_[_0x95e9('0xa')](_0x350982,_0x95e9('0xb'))[_0x95e9('0xc')](',\x20'));logger[_0x95e9('0xd')](_0x95e9('0xe'),_0x444f2b);_0x2d84c3['next']();}else{var _0x3c4a92={'ids':[_0x4bfc22[0x0]]};if(rpc[_0x478b1c[_0x95e9('0xf')]+_0x95e9('0x10')]){rpc[_0x478b1c[_0x95e9('0xf')]+_0x95e9('0x10')][_0x95e9('0x11')](_0x478b1c['interaction']['id'],_0x3c4a92)['then'](function(_0x385da6){logger[_0x95e9('0xd')](_0x95e9('0x12'),_0x444f2b,_0x4bfc22[0x1],_0x478b1c[_0x95e9('0xf')],_0x478b1c[_0x95e9('0x13')]['id']);})[_0x95e9('0x14')](function(_0x1d4331){logger[_0x95e9('0x8')]('[%s][TAG]\x20%s',_0x444f2b,JSON['stringify'](_0x1d4331));logger[_0x95e9('0xd')](_0x95e9('0xe'),_0x444f2b);})[_0x95e9('0x15')](function(){_0x2d84c3[_0x95e9('0x16')]();});}}}catch(_0x5d964c){logger[_0x95e9('0x8')](_0x95e9('0x9'),_0x444f2b,_['isObject'](_0x5d964c)?JSON[_0x95e9('0x17')](_0x5d964c):_0x5d964c);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x444f2b);_0x2d84c3[_0x95e9('0x16')]();}};}; \ No newline at end of file +var _0x977b=['catch','next','isObject','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','channel','addTags','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s'];(function(_0x5f1f65,_0x93c3eb){var _0x3a3107=function(_0x4514cc){while(--_0x4514cc){_0x5f1f65['push'](_0x5f1f65['shift']());}};_0x3a3107(++_0x93c3eb);}(_0x977b,0xa7));var _0xb977=function(_0x30601e,_0x111796){_0x30601e=_0x30601e-0x0;var _0x419267=_0x977b[_0x30601e];return _0x419267;};'use strict';var schema=require(_0xb977('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xb977('0x1')),'openchannelInteraction':require(_0xb977('0x2')),'smsInteraction':require(_0xb977('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xb977('0x4')),'whatsappInteraction':require(_0xb977('0x5'))};var logger=require(_0xb977('0x6'))('routing');var tag=schema({'tag':{'type':_0xb977('0x7'),'required':!![],'message':_0xb977('0x8')}});exports[_0xb977('0x9')]=function(_0x58dab1,_0x4b8299,_0x36e64d,_0x59dbae){return function(_0x68209a){try{var _0x447f84={'tag':_0x4b8299[0x0]};var _0x4597cc=tag[_0xb977('0x0')](_0x447f84,{'typecast':!![]});if(_0x4597cc[_0xb977('0xa')]){logger[_0xb977('0xb')](_0xb977('0xc'),_0x58dab1,_[_0xb977('0xd')](_0x4597cc,_0xb977('0xe'))[_0xb977('0xf')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x58dab1);_0x68209a['next']();}else{var _0x453715={'ids':[_0x4b8299[0x0]]};if(rpc[_0x59dbae['channel']+'Interaction']){rpc[_0x59dbae[_0xb977('0x10')]+'Interaction'][_0xb977('0x11')](_0x59dbae[_0xb977('0x12')]['id'],_0x453715)[_0xb977('0x13')](function(_0x1932ba){logger[_0xb977('0x14')](_0xb977('0x15'),_0x58dab1,_0x4b8299[0x1],_0x59dbae[_0xb977('0x10')],_0x59dbae[_0xb977('0x12')]['id']);})[_0xb977('0x16')](function(_0x2cd908){logger['error']('[%s][TAG]\x20%s',_0x58dab1,JSON['stringify'](_0x2cd908));logger[_0xb977('0x14')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x58dab1);})['finally'](function(){_0x68209a[_0xb977('0x17')]();});}}}catch(_0x2256b3){logger[_0xb977('0xb')]('[%s][TAG]\x20%s',_0x58dab1,_[_0xb977('0x18')](_0x2256b3)?JSON[_0xb977('0x19')](_0x2256b3):_0x2256b3);logger[_0xb977('0x14')](_0xb977('0x1a'),_0x58dab1);_0x68209a[_0xb977('0x17')]();}};}; \ 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 402b269..4ddad74 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 _0xc71b=['Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','routing','lodash','consequence','replace','\x20-\x20','includes','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','method','login','push','params','stringify','utf8','POST','then','logged'];(function(_0x72e04a,_0x398f0b){var _0x4e8acf=function(_0x56ea91){while(--_0x56ea91){_0x72e04a['push'](_0x72e04a['shift']());}};_0x4e8acf(++_0x398f0b);}(_0xc71b,0x6c));var _0xbc71=function(_0x3b0a7f,_0x5c5062){_0x3b0a7f=_0x3b0a7f-0x0;var _0x21c86b=_0xc71b[_0x3b0a7f];return _0x21c86b;};'use strict';var rp=require('request-promise');var logger=require('../../../../config/logger')(_0xbc71('0x0'));var _=require(_0xbc71('0x1'));var arr=[];exports[_0xbc71('0x2')]=function(_0x4a0a9c,_0xfd47d1){return function(_0x453158){var _0xb06598=_0xfd47d1[0xa];var _0x165de3=_0xfd47d1[0xb];var _0xaf1d46=_0xfd47d1[0xc];var _0x4660fd=_0xfd47d1[0xd];var _0x58ac5e=_0xfd47d1[0xe];var _0x4461d1=_0xfd47d1[0xf][_0xbc71('0x3')](/\n/g,_0xbc71('0x4'));var _0x484c16=_0xfd47d1[0x10][_0xbc71('0x3')](/\n/g,'\x20');if(!arr[_0xbc71('0x5')](_0x165de3)){arr['push'](_0x165de3);var _0x3cadf4=_0xfd47d1[0x3];var _0x2e9d3b=_0xfd47d1[0x4];var _0x373721=_0xfd47d1[0x1];var _0x50b9aa=_0xfd47d1[0x0];var _0x32b3a={};_0x32b3a[_0xbc71('0x6')]=_0xfd47d1[0x8]+_0xbc71('0x7')+_0xaf1d46+'|'+_0xb06598+'|'+_0x4660fd+'|'+_0x165de3+'|'+_0x58ac5e;_0x32b3a[_0xbc71('0x8')]=_0xfd47d1[0x7]+_0xbc71('0x7')+_0xaf1d46+'|'+_0xb06598+'|'+_0x4660fd+'|'+_0x165de3+'|'+_0x58ac5e+'|'+_0x4461d1+'|'+_0x484c16;_0x32b3a[_0xbc71('0x9')]=_0xfd47d1[0x9];var _0x1ef1d3={};_0x1ef1d3[_0xbc71('0xa')]='2.0';_0x1ef1d3[_0xbc71('0xb')]=_0xbc71('0xc');var _0x1bf576=[];_0x1bf576[_0xbc71('0xd')](_0xfd47d1[0x2]);_0x1bf576[_0xbc71('0xd')](_0xfd47d1[0x5]);_0x1bf576['push'](_0xfd47d1[0x6]);_0x1ef1d3[_0xbc71('0xe')]=_0x1bf576;_0x1ef1d3['id']=0x1;var _0x2d79b0=JSON[_0xbc71('0xf')](_0x1ef1d3);var _0x23c1ef={'encoding':_0xbc71('0x10'),'method':_0xbc71('0x11'),'timeout':0x2710,'url':_0x3cadf4,'headers':{'Content-Type':'application/json-rpc'},'body':_0x2d79b0};return rp(_0x23c1ef)[_0xbc71('0x12')](function(_0x19ea6d){const _0x42d46c=JSON['parse'](_0x19ea6d);if(!_0x42d46c['result'][_0xbc71('0x13')]){throw new Error(_0xbc71('0x14'));}var _0x183856=_0x165de3;var _0x230cbb=_0xbc71('0x15')+_0x373721+_0xbc71('0x16')+_0x50b9aa+_0xbc71('0x17')+_0x183856+'&data='+JSON['stringify'](_0x32b3a);var _0x2cad39=_0x2e9d3b+'?'+_0x230cbb;return rp(_0x2cad39);})['then'](function(_0x48c5ce){logger[_0xbc71('0x18')](_0xbc71('0x19'),_0x4a0a9c,_0x48c5ce);_0x453158['stop']();})[_0xbc71('0x1a')](function(_0x5083ae){logger['error'](_0xbc71('0x1b'),_0x4a0a9c,_[_0xbc71('0x1c')](_0x5083ae)?JSON[_0xbc71('0xf')](_0x5083ae):_0x5083ae);_0x453158[_0xbc71('0x1d')]();});}else{logger['info'](_0xbc71('0x1e'),_0x4a0a9c);_0x453158[_0xbc71('0x1f')]();}};}; \ No newline at end of file +var _0xe8d9=['[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','routing','lodash','replace','\x20-\x20','includes','push','?params=','title','jsonrpc','2.0','method','POST','then','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','&data=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','isObject'];(function(_0x5a55cb,_0x2f88ee){var _0x43126b=function(_0x55bd53){while(--_0x55bd53){_0x5a55cb['push'](_0x5a55cb['shift']());}};_0x43126b(++_0x2f88ee);}(_0xe8d9,0x1b2));var _0x9e8d=function(_0x52d7dd,_0x4095ed){_0x52d7dd=_0x52d7dd-0x0;var _0x32c3a3=_0xe8d9[_0x52d7dd];return _0x32c3a3;};'use strict';var rp=require(_0x9e8d('0x0'));var logger=require('../../../../config/logger')(_0x9e8d('0x1'));var _=require(_0x9e8d('0x2'));var arr=[];exports['consequence']=function(_0xa99641,_0x3077ed){return function(_0x322e2c){var _0x800f53=_0x3077ed[0xa];var _0x1cde47=_0x3077ed[0xb];var _0x4ab7ea=_0x3077ed[0xc];var _0x361829=_0x3077ed[0xd];var _0x8560e4=_0x3077ed[0xe];var _0x3a9cfa=_0x3077ed[0xf][_0x9e8d('0x3')](/\n/g,_0x9e8d('0x4'));var _0x37488c=_0x3077ed[0x10][_0x9e8d('0x3')](/\n/g,'\x20');if(!arr[_0x9e8d('0x5')](_0x1cde47)){arr[_0x9e8d('0x6')](_0x1cde47);var _0x688b86=_0x3077ed[0x3];var _0x417cb9=_0x3077ed[0x4];var _0x727313=_0x3077ed[0x1];var _0x2d224a=_0x3077ed[0x0];var _0x4fefde={};_0x4fefde['urlOnAnswer']=_0x3077ed[0x8]+_0x9e8d('0x7')+_0x4ab7ea+'|'+_0x800f53+'|'+_0x361829+'|'+_0x1cde47+'|'+_0x8560e4;_0x4fefde['urlOnRing']=_0x3077ed[0x7]+_0x9e8d('0x7')+_0x4ab7ea+'|'+_0x800f53+'|'+_0x361829+'|'+_0x1cde47+'|'+_0x8560e4+'|'+_0x3a9cfa+'|'+_0x37488c;_0x4fefde[_0x9e8d('0x8')]=_0x3077ed[0x9];var _0xdfb4c8={};_0xdfb4c8[_0x9e8d('0x9')]=_0x9e8d('0xa');_0xdfb4c8[_0x9e8d('0xb')]='login';var _0x2803ad=[];_0x2803ad[_0x9e8d('0x6')](_0x3077ed[0x2]);_0x2803ad[_0x9e8d('0x6')](_0x3077ed[0x5]);_0x2803ad[_0x9e8d('0x6')](_0x3077ed[0x6]);_0xdfb4c8['params']=_0x2803ad;_0xdfb4c8['id']=0x1;var _0xa9616f=JSON['stringify'](_0xdfb4c8);var _0xda4173={'encoding':'utf8','method':_0x9e8d('0xc'),'timeout':0x2710,'url':_0x688b86,'headers':{'Content-Type':'application/json-rpc'},'body':_0xa9616f};return rp(_0xda4173)[_0x9e8d('0xd')](function(_0x47f276){const _0x1446ee=JSON[_0x9e8d('0xe')](_0x47f276);if(!_0x1446ee[_0x9e8d('0xf')]['logged']){throw new Error(_0x9e8d('0x10'));}var _0x8c870f=_0x1cde47;var _0x2f6ce1='channelId='+_0x727313+'&serviceId='+_0x2d224a+'&sessionId='+_0x8c870f+_0x9e8d('0x11')+JSON[_0x9e8d('0x12')](_0x4fefde);var _0x238f8a=_0x417cb9+'?'+_0x2f6ce1;return rp(_0x238f8a);})[_0x9e8d('0xd')](function(_0x2eac08){logger[_0x9e8d('0x13')](_0x9e8d('0x14'),_0xa99641,_0x2eac08);_0x322e2c[_0x9e8d('0x15')]();})[_0x9e8d('0x16')](function(_0x551af4){logger[_0x9e8d('0x17')]('[%s][TVOX]\x20%s',_0xa99641,_[_0x9e8d('0x18')](_0x551af4)?JSON[_0x9e8d('0x12')](_0x551af4):_0x551af4);_0x322e2c[_0x9e8d('0x15')]();});}else{logger[_0x9e8d('0x13')](_0x9e8d('0x19'),_0xa99641);_0x322e2c[_0x9e8d('0x1a')]();}};}; \ 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 83d082b..a6ababf 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x3d43fe,_0x2ae238){var _0x2278e5=function(_0x3a1aaa){while(--_0x3a1aaa){_0x3d43fe['push'](_0x3d43fe['shift']());}};_0x2278e5(++_0x2ae238);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x1bc39a,_0x50bb8f){var _0x4af6fa=function(_0x1b4292){while(--_0x1b4292){_0x1bc39a['push'](_0x1bc39a['shift']());}};_0x4af6fa(++_0x50bb8f);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index cec7f9d..9f3c656 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 _0x341c=['lodash','path','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','split','mail','push','slice','dialogflow','appdata','dialogflowv2','amazonlex','message','tag','TagId','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','info','Push\x20new\x20rule','\x20|\x20','error','Applications\x20executed','matchPath','emit','complete','stack','agents','agent','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','paused','mailQueues','name','waiting','openchannelQueues','smsQueues','loggedIn','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','stringify','127.0.0.1','log','RPC\x20listening\x20on\x20port:'];(function(_0x17ac5b,_0x1a2d16){var _0x2dcec9=function(_0x4bbe8d){while(--_0x4bbe8d){_0x17ac5b['push'](_0x17ac5b['shift']());}};_0x2dcec9(++_0x1a2d16);}(_0x341c,0xcc));var _0xc341=function(_0x44cca6,_0x5e9271){_0x44cca6=_0x44cca6-0x0;var _0x175d04=_0x341c[_0x44cca6];return _0x175d04;};'use strict';var _=require(_0xc341('0x0'));var util=require('util');var path=require(_0xc341('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xc341('0x2'));var utils=require(_0xc341('0x3'));var sUtils=require(_0xc341('0x4'));var logger=require(_0xc341('0x5'))(_0xc341('0x6'));var rpc={'openchannelQueueReport':require(_0xc341('0x7')),'mailQueueReport':require(_0xc341('0x8')),'chatQueueReport':require(_0xc341('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xc341('0xa')),'whatsappQueueReport':require(_0xc341('0xb'))};var RuleEngine=require(_0xc341('0xc'));function getId(_0x31ce96,_0x3e83c9,_0x53aab7){return util[_0xc341('0xd')](_0xc341('0xe'),_0x31ce96,_0x3e83c9||0x0,_0x53aab7||0x0);}function getIntervals(_0x3f08b0,_0x8d2f4c){var _0x3d5d26=[];if(!_[_0xc341('0xf')](_0x8d2f4c['IntervalId'])&&!_[_0xc341('0xf')](_0x3f08b0[_0x8d2f4c[_0xc341('0x10')]])&&!_[_0xc341('0xf')](_0x3f08b0[_0x8d2f4c[_0xc341('0x10')]][_0xc341('0x11')])){_0x3d5d26=_[_0xc341('0x12')](_0x3f08b0[_0x8d2f4c['IntervalId']]['Intervals'],_0xc341('0x13'));}else if(!_[_0xc341('0xf')](_0x8d2f4c[_0xc341('0x13')])){_0x3d5d26=[_0x8d2f4c[_0xc341('0x13')]];}return _0x3d5d26;}exports[_0xc341('0x14')]=function(_0x483e30){_0x483e30[_0xc341('0x15')]={};return new BPromise(function(_0x12a4eb,_0x1f5220){var _0x158c47={'Start':function(_0x989024){var _0x2bd235=this;return new Promise(function(_0x203a06,_0x26bbce){if(_0x989024){try{var _0x33da6b=[];var _0xdbf615=getId(_0x989024[_0xc341('0x16')],_0x989024['message']?_0x989024['message']['id']:0x0,_0x989024[_0xc341('0x17')]?_0x989024[_0xc341('0x17')]['id']:0x0);var _0x2d9f4e=sUtils[_0xc341('0x18')](_0x483e30,_0x989024);if(_0x989024[_0xc341('0x19')]||!_0x2d9f4e&&_0x989024[_0xc341('0x1a')]&&_[_0xc341('0x1b')](_0x989024[_0xc341('0x1a')])&&_0x989024[_0xc341('0x1a')][_0xc341('0x1c')]){for(var _0x2f94ea=0x0;_0x2f94ea<_0x989024[_0xc341('0x1a')]['length'];_0x2f94ea+=0x1){var _0x556281=_0x989024[_0xc341('0x1a')][_0x2f94ea];if(fs[_0xc341('0x1d')](path[_0xc341('0x1e')](__dirname,_0xc341('0x1a'),_0x556281[_0xc341('0x1f')]+_0xc341('0x20')))){var _0x488d43=[];switch(_0x556281[_0xc341('0x1f')][_0xc341('0x21')]()){case _0xc341('0x22'):var _0x5a4912=_0x556281['appdata'][_0xc341('0x23')](',');if(_0x989024['channel']===_0xc341('0x24')){_0x488d43[_0xc341('0x25')](_0x5a4912[0x0]);_0x488d43[_0xc341('0x25')](_0x5a4912[0x1]);_0x488d43[_0xc341('0x25')](_0x5a4912[_0xc341('0x26')](0x2,_0x5a4912['length'])[_0xc341('0x1e')](','));}else{_0x488d43[_0xc341('0x25')](_0x5a4912[0x0]);_0x488d43[_0xc341('0x25')](_0x5a4912[_0xc341('0x26')](0x1,_0x5a4912[_0xc341('0x1c')])[_0xc341('0x1e')](','));}break;case _0xc341('0x27'):var _0x51af9d=_0x556281[_0xc341('0x28')][_0xc341('0x23')](',');_0x488d43[_0xc341('0x25')](_0x51af9d[0x0]);_0x488d43[_0xc341('0x25')](_0x51af9d[0x1]);_0x488d43[_0xc341('0x25')](_0x51af9d[_0xc341('0x26')](0x2,_0x51af9d[_0xc341('0x1c')])[_0xc341('0x1e')](','));break;case _0xc341('0x29'):var _0x4b838f=_0x556281[_0xc341('0x28')][_0xc341('0x23')](',');_0x488d43[_0xc341('0x25')](_0x4b838f[0x0]);_0x488d43[_0xc341('0x25')](_0x4b838f[0x1]);_0x488d43[_0xc341('0x25')](_0x4b838f[0x2]);_0x488d43[_0xc341('0x25')](_0x4b838f[0x3]);_0x488d43[_0xc341('0x25')](_0x4b838f[_0xc341('0x26')](0x4,_0x4b838f[_0xc341('0x1c')])[_0xc341('0x1e')](','));break;case _0xc341('0x2a'):var _0x551e10=_0x556281['appdata'][_0xc341('0x23')](',');_0x488d43['push'](_0x551e10[0x0]);_0x488d43[_0xc341('0x25')](_0x551e10[0x1]);_0x488d43[_0xc341('0x25')](_0x551e10[0x2]);_0x488d43[_0xc341('0x25')](_0x551e10[0x3]);_0x488d43[_0xc341('0x25')](_0x551e10[_0xc341('0x26')](0x4,_0x551e10[_0xc341('0x1c')])[_0xc341('0x1e')](','));break;case _0xc341('0x2b'):_0x488d43[_0xc341('0x25')](_0x556281['appdata']);break;case _0xc341('0x2c'):_0x488d43[_0xc341('0x25')](_0x556281[_0xc341('0x2d')]);_0x488d43[_0xc341('0x25')](_0x556281[_0xc341('0x28')]);break;case'tvox':var _0x517071=utils['getMustacheRender'](_0x989024[_0xc341('0x2e')][_0xc341('0x2f')],_0x989024);var _0x149690=_0x556281[_0xc341('0x28')]['split'](',');_0x488d43['push'](_0x149690[0x0]);_0x488d43[_0xc341('0x25')](_0x149690[0x1]);_0x488d43[_0xc341('0x25')](_0x149690[0x2]);_0x488d43[_0xc341('0x25')](_0x149690[0x3]);_0x488d43[_0xc341('0x25')](_0x149690[0x4]);_0x488d43['push'](_0x149690[0x5]);_0x488d43[_0xc341('0x25')](_0x149690[0x6]);_0x488d43[_0xc341('0x25')](_0x149690[0x7]);_0x488d43['push'](_0x149690[0x8]);_0x488d43[_0xc341('0x25')](_0x149690[0x9]);_0x488d43['push'](_0x149690[0xa]);_0x488d43[_0xc341('0x25')](_0x989024[_0xc341('0x17')]['id']);_0x488d43[_0xc341('0x25')](_0x989024[_0xc341('0x2b')]['id']);_0x488d43[_0xc341('0x25')](_0x556281[_0xc341('0x30')]);_0x488d43[_0xc341('0x25')](_0x989024[_0xc341('0x17')][_0xc341('0x31')]);_0x488d43[_0xc341('0x25')](_0x989024[_0xc341('0x32')][_0xc341('0x32')]);_0x488d43['push'](_0x517071);break;default:_0x488d43=_[_0xc341('0xf')](_0x556281[_0xc341('0x28')])?[]:_0x556281[_0xc341('0x28')][_0xc341('0x23')](',');}var _0x777512={'id':util[_0xc341('0xd')](_0xc341('0x33'),_0xdbf615,_0x556281['id'],_0x556281[_0xc341('0x1f')]),'condition':require(_0xc341('0x34'))[_0xc341('0x35')](_0xdbf615,getIntervals(_0x483e30[_0xc341('0x36')],_0x556281),_0x483e30),'consequence':require(_0xc341('0x37')+_0x556281[_0xc341('0x1f')])['consequence'](_0xdbf615,_0x488d43,_0x483e30,_0x989024),'p':_0x556281['priority']||0x0};logger[_0xc341('0x38')](_0xc341('0x39'),_0x777512['id'],'on\x20interval',getIntervals(_0x483e30[_0xc341('0x36')],_0x556281)[_0xc341('0x1e')](_0xc341('0x3a')));_0x33da6b['push'](_0x777512);}else{logger[_0xc341('0x3b')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xc341('0x1e')](__dirname,_0xc341('0x1a'),_0x556281[_0xc341('0x1f')]+_0xc341('0x20')));}}_0x483e30[_0xc341('0x15')][_0xdbf615]=new RuleEngine(_0x33da6b);_0x483e30[_0xc341('0x15')][_0xdbf615]['execute'](_0x989024,function(_0x7e702c){logger[_0xc341('0x38')](_0xc341('0x3c'),JSON['stringify'](_0x7e702c[_0xc341('0x3d')]));if(_0x483e30['rules'][_0xdbf615]){_0x483e30[_0xc341('0x15')][_0xdbf615][_0xc341('0x3e')](_0xc341('0x3f'));}});return _0x203a06({'code':0xc8,'message':_0x989024});}else{if(_0x2d9f4e){logger[_0xc341('0x38')](util[_0xc341('0xd')]('Skipped\x20routing\x20for\x20%s',_0xdbf615));}else{logger[_0xc341('0x38')]('No\x20applications\x20to\x20execute');}return _0x203a06({'code':0xc8,'message':_0x989024});}}catch(_0x4bae47){logger[_0xc341('0x3b')](_0x4bae47[_0xc341('0x40')]);return _0x26bbce(_0x2bd235['error'](0x1f4,_0x4bae47));}}return _0x26bbce('routing\x20is\x20empty');});},'AcceptMessage':function(_0x550bcd){var _0x4828f1=this;return new Promise(function(_0xd5824c,_0x896c48){if(_0x550bcd['agent']&&_0x550bcd['agent']['id']){if(_0x483e30[_0xc341('0x41')][_0x550bcd['agent']['id']]){_0x483e30[_0xc341('0x41')][_0x550bcd[_0xc341('0x42')]['id']][_0xc341('0x43')]=![];_0x483e30[_0xc341('0x41')][_0x550bcd[_0xc341('0x42')]['id']][_0xc341('0x44')]=undefined;}}if(_0x550bcd[_0xc341('0x2b')]&&_0x550bcd[_0xc341('0x2b')]['id']){try{var _0x129da7=getId(_0x550bcd[_0xc341('0x16')],_0x550bcd[_0xc341('0x2b')]?_0x550bcd[_0xc341('0x2b')]['id']:0x0,_0x550bcd[_0xc341('0x17')]?_0x550bcd[_0xc341('0x17')]['id']:0x0);if(_0x483e30[_0xc341('0x15')][_0x129da7]){_0x483e30[_0xc341('0x15')][_0x129da7][_0xc341('0x3e')](_0xc341('0x45'));if(rpc[_0x550bcd[_0xc341('0x16')]+_0xc341('0x46')]){rpc[_0x550bcd[_0xc341('0x16')]+'QueueReport'][_0xc341('0x47')](_0x129da7,{'UserId':_0x550bcd[_0xc341('0x2b')][_0xc341('0x48')]})[_0xc341('0x49')](function(){logger[_0xc341('0x3b')](_0xc341('0x4a'));});}}return _0xd5824c({'code':0xc8,'message':_0x550bcd});}catch(_0x1a3ab6){logger[_0xc341('0x3b')](_0x1a3ab6[_0xc341('0x40')]);return _0x896c48(_0x4828f1[_0xc341('0x3b')](0x1f4,_0x1a3ab6));}}logger['error'](_0xc341('0x4b'));return _0x896c48(_0x4828f1[_0xc341('0x3b')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x50a86f){var _0x1fc3a4=this;return new Promise(function(_0x2346ce,_0x3febe3){if(_0x50a86f[_0xc341('0x42')]&&_0x50a86f[_0xc341('0x42')]['id']){try{if(_0x483e30[_0xc341('0x41')][_0x50a86f[_0xc341('0x42')]['id']]){_0x483e30[_0xc341('0x41')][_0x50a86f[_0xc341('0x42')]['id']][_0xc341('0x43')]=![];_0x483e30[_0xc341('0x41')][_0x50a86f[_0xc341('0x42')]['id']][_0xc341('0x44')]=undefined;}return _0x2346ce({'code':0xc8,'message':_0x50a86f});}catch(_0x341699){logger['error'](_0x341699[_0xc341('0x40')]);return _0x3febe3(_0x1fc3a4['error'](0x1f4,_0x341699));}}logger[_0xc341('0x3b')]('message\x20is\x20empty');return _0x3febe3(_0x1fc3a4['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x3241f4){var _0x55faf4=this;return new Promise(function(_0x3d8be0,_0x375e7e){if(_0x3241f4[_0xc341('0x16')]&&_0x3241f4['interaction']&&_0x3241f4[_0xc341('0x17')]['id']){try{var _0x56eaef=getId(_0x3241f4[_0xc341('0x16')],_0x3241f4[_0xc341('0x2b')]?_0x3241f4['message']['id']:0x0,_0x3241f4[_0xc341('0x17')]?_0x3241f4['interaction']['id']:0x0);if(_0x483e30[_0xc341('0x15')][_0x56eaef]){_0x483e30[_0xc341('0x15')][_0x56eaef][_0xc341('0x3e')](_0xc341('0x45'));}return _0x3d8be0({'code':0xc8,'message':_0x3241f4});}catch(_0x31db84){logger['error'](_0x31db84[_0xc341('0x40')]);return _0x375e7e(_0x55faf4['error'](0x1f4,_0x31db84));}}logger[_0xc341('0x3b')]('message\x20is\x20empty');return _0x375e7e(_0x55faf4[_0xc341('0x3b')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x30e8c8){var _0x23caef=this;return new Promise(function(_0x4cbec2,_0x5b5113){if(_0x483e30[_0xc341('0x41')]['hasOwnProperty'](_0x30e8c8['id'])){for(var _0x28bc56 in _0x30e8c8[_0xc341('0x4c')]){if(_0x30e8c8['capacity'][_0xc341('0x4d')](_0x28bc56)){if(_0x483e30[_0xc341('0x41')][_0x30e8c8['id']][_0xc341('0x4d')](_0x28bc56+_0xc341('0x4e'))){_0x483e30[_0xc341('0x41')][_0x30e8c8['id']][_0x28bc56+_0xc341('0x4e')]=parseInt(_0x30e8c8[_0xc341('0x4c')][_0x28bc56],0xa);}}}_0x483e30[_0xc341('0x41')][_0x30e8c8['id']][_0xc341('0x4f')]();return _0x4cbec2({'code':0xc8,'message':_0x483e30[_0xc341('0x41')][_0x30e8c8['id']]});}else{return _0x5b5113(_0x23caef['error'](0x1f4,_0xc341('0x50')));}});},'Agents':function(_0xb9d0ec){return new Promise(function(_0x44e98b){var _0xf7b289=_[_0xc341('0x51')](_0x483e30['agents']);if(_0xb9d0ec&&_0xb9d0ec['id']){var _0xfd84bb=_[_0xc341('0x52')](_0xf7b289,function(_0x1e226d){return _0x1e226d['id']===_0xb9d0ec['id'];});_0x44e98b(_0xfd84bb);}else{_0x44e98b({'count':_0xf7b289[_0xc341('0x1c')],'rows':_0xf7b289});}});},'ChatQueues':function(){return new Promise(function(_0x159c5e){var _0x5827bd=[];for(var _0xc583c in _0x483e30[_0xc341('0x53')]){if(_0x483e30[_0xc341('0x53')][_0xc341('0x4d')](_0xc583c)){var _0x5a6572=_0x483e30[_0xc341('0x53')][_0xc583c];var _0x13acfa={'id':_0x5a6572['id'],'available':_0x5a6572[_0xc341('0x54')],'loggedIn':_0x5a6572['loggedIn'],'name':_0x5a6572['name'],'paused':_0x5a6572[_0xc341('0x55')],'waiting':_0x5a6572['waiting']};_0x5827bd[_0xc341('0x25')](_0x13acfa);}}_0x159c5e({'count':_0x5827bd[_0xc341('0x1c')],'rows':_0x5827bd});});},'MailQueues':function(){return new Promise(function(_0x5f34cb){var _0x16ab5f=[];for(var _0x597259 in _0x483e30[_0xc341('0x56')]){if(_0x483e30[_0xc341('0x56')][_0xc341('0x4d')](_0x597259)){var _0x557e7b=_0x483e30['mailQueues'][_0x597259];var _0x380bef={'id':_0x557e7b['id'],'available':_0x557e7b[_0xc341('0x54')],'loggedIn':_0x557e7b['loggedIn'],'name':_0x557e7b[_0xc341('0x57')],'paused':_0x557e7b['paused'],'waiting':_0x557e7b[_0xc341('0x58')]};_0x16ab5f['push'](_0x380bef);}}_0x5f34cb({'count':_0x16ab5f[_0xc341('0x1c')],'rows':_0x16ab5f});});},'OpenchannelQueues':function(){return new Promise(function(_0x5eba00){var _0x40c961=[];for(var _0x1f7735 in _0x483e30[_0xc341('0x59')]){if(_0x483e30[_0xc341('0x59')][_0xc341('0x4d')](_0x1f7735)){var _0x5ed4cd=_0x483e30['openchannelQueues'][_0x1f7735];var _0x4aa738={'id':_0x5ed4cd['id'],'available':_0x5ed4cd[_0xc341('0x54')],'loggedIn':_0x5ed4cd['loggedIn'],'name':_0x5ed4cd[_0xc341('0x57')],'paused':_0x5ed4cd['paused'],'waiting':_0x5ed4cd[_0xc341('0x58')]};_0x40c961[_0xc341('0x25')](_0x4aa738);}}_0x5eba00({'count':_0x40c961[_0xc341('0x1c')],'rows':_0x40c961});});},'SmsQueues':function(){return new Promise(function(_0x2b4c04){var _0xeece2a=[];for(var _0x2bef15 in _0x483e30[_0xc341('0x5a')]){if(_0x483e30['smsQueues']['hasOwnProperty'](_0x2bef15)){var _0xb9bec5=_0x483e30[_0xc341('0x5a')][_0x2bef15];var _0x3543af={'id':_0xb9bec5['id'],'available':_0xb9bec5[_0xc341('0x54')],'loggedIn':_0xb9bec5[_0xc341('0x5b')],'name':_0xb9bec5[_0xc341('0x57')],'paused':_0xb9bec5[_0xc341('0x55')],'waiting':_0xb9bec5['waiting']};_0xeece2a[_0xc341('0x25')](_0x3543af);}}_0x2b4c04({'count':_0xeece2a[_0xc341('0x1c')],'rows':_0xeece2a});});},'FaxQueues':function(){return new Promise(function(_0x1b6589){var _0x23cc0d=[];for(var _0x7483cf in _0x483e30[_0xc341('0x5c')]){if(_0x483e30[_0xc341('0x5c')]['hasOwnProperty'](_0x7483cf)){var _0x53d4cc=_0x483e30[_0xc341('0x5c')][_0x7483cf];var _0xc74741={'id':_0x53d4cc['id'],'available':_0x53d4cc['available'],'loggedIn':_0x53d4cc['loggedIn'],'name':_0x53d4cc[_0xc341('0x57')],'paused':_0x53d4cc[_0xc341('0x55')],'waiting':_0x53d4cc[_0xc341('0x58')]};_0x23cc0d[_0xc341('0x25')](_0xc74741);}}_0x1b6589({'count':_0x23cc0d[_0xc341('0x1c')],'rows':_0x23cc0d});});},'WhatsappQueues':function(){return new Promise(function(_0x25befd){var _0x4db135=[];for(var _0x4c418c in _0x483e30[_0xc341('0x5d')]){if(_0x483e30[_0xc341('0x5d')][_0xc341('0x4d')](_0x4c418c)){var _0x1e216e=_0x483e30['whatsappQueues'][_0x4c418c];var _0x19c4d2={'id':_0x1e216e['id'],'available':_0x1e216e[_0xc341('0x54')],'loggedIn':_0x1e216e[_0xc341('0x5b')],'name':_0x1e216e['name'],'paused':_0x1e216e[_0xc341('0x55')],'waiting':_0x1e216e['waiting']};_0x4db135[_0xc341('0x25')](_0x19c4d2);}}_0x25befd({'count':_0x4db135[_0xc341('0x1c')],'rows':_0x4db135});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x594e3e){var _0x2ade1c=_[_0xc341('0x51')](_0x483e30['chatQueuesWaitingInteractions']);_0x594e3e({'count':_0x2ade1c[_0xc341('0x1c')],'rows':_0x2ade1c});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0xb650bb){var _0xd0db26=_[_0xc341('0x51')](_0x483e30[_0xc341('0x5e')]);_0xb650bb({'count':_0xd0db26[_0xc341('0x1c')],'rows':_0xd0db26});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x273997){var _0x513733=_[_0xc341('0x51')](_0x483e30[_0xc341('0x5f')]);_0x273997({'count':_0x513733[_0xc341('0x1c')],'rows':_0x513733});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x4edc5b){var _0xcfc613=_['values'](_0x483e30[_0xc341('0x60')]);_0x4edc5b({'count':_0xcfc613[_0xc341('0x1c')],'rows':_0xcfc613});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3e4c62){var _0x4bc622=_[_0xc341('0x51')](_0x483e30[_0xc341('0x61')]);_0x3e4c62({'count':_0x4bc622[_0xc341('0x1c')],'rows':_0x4bc622});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x39ccde){var _0x36c9cc=_[_0xc341('0x51')](_0x483e30['whatsappQueuesWaitingInteractions']);_0x39ccde({'count':_0x36c9cc[_0xc341('0x1c')],'rows':_0x36c9cc});});}};var _0x360994=jayson['server'](_0x158c47)['http']();_0x360994['on'](_0xc341('0x3b'),function(_0x1351d8){logger[_0xc341('0x3b')](JSON[_0xc341('0x62')](_0x1351d8));return _0x1f5220(_0x1351d8);});_0x360994[_0xc341('0x14')](0x232c,_0xc341('0x63'),function(){console[_0xc341('0x64')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x12a4eb(_0xc341('0x65')+0x232c);});});}; \ No newline at end of file +var _0x2905=['mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','listen','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','join','app','.js','autoreply','appdata','split','push','slice','length','dialogflow','dialogflowv2','tag','tvox','account','ChatWebsiteId','ContactId','body','format','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','emit','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','find','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions'];(function(_0x5dd69b,_0x118e05){var _0x1bc678=function(_0x4ff184){while(--_0x4ff184){_0x5dd69b['push'](_0x5dd69b['shift']());}};_0x1bc678(++_0x118e05);}(_0x2905,0x19c));var _0x5290=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2905[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x5290('0x0'));var util=require(_0x5290('0x1'));var path=require(_0x5290('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x5290('0x3'));var utils=require(_0x5290('0x4'));var sUtils=require(_0x5290('0x5'));var logger=require(_0x5290('0x6'))(_0x5290('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x5290('0x8')),'chatQueueReport':require(_0x5290('0x9')),'smsQueueReport':require(_0x5290('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x5290('0xb'));function getId(_0x11ef1b,_0x3bfa1a,_0x4c6f1b){return util['format'](_0x5290('0xc'),_0x11ef1b,_0x3bfa1a||0x0,_0x4c6f1b||0x0);}function getIntervals(_0x22bb06,_0x965777){var _0x569eba=[];if(!_[_0x5290('0xd')](_0x965777['IntervalId'])&&!_['isNil'](_0x22bb06[_0x965777[_0x5290('0xe')]])&&!_['isNil'](_0x22bb06[_0x965777[_0x5290('0xe')]]['Intervals'])){_0x569eba=_[_0x5290('0xf')](_0x22bb06[_0x965777[_0x5290('0xe')]][_0x5290('0x10')],_0x5290('0x11'));}else if(!_[_0x5290('0xd')](_0x965777['interval'])){_0x569eba=[_0x965777[_0x5290('0x11')]];}return _0x569eba;}exports['listen']=function(_0x13246f){_0x13246f[_0x5290('0x12')]={};return new BPromise(function(_0x45f7ce,_0x3616eb){var _0x6e5148={'Start':function(_0x24c090){var _0x33bd74=this;return new Promise(function(_0xf12e41,_0xbdc67e){if(_0x24c090){try{var _0x51fb0b=[];var _0x10da07=getId(_0x24c090[_0x5290('0x13')],_0x24c090['message']?_0x24c090[_0x5290('0x14')]['id']:0x0,_0x24c090[_0x5290('0x15')]?_0x24c090[_0x5290('0x15')]['id']:0x0);var _0x1aae31=sUtils[_0x5290('0x16')](_0x13246f,_0x24c090);if(_0x24c090[_0x5290('0x17')]||!_0x1aae31&&_0x24c090[_0x5290('0x18')]&&_[_0x5290('0x19')](_0x24c090[_0x5290('0x18')])&&_0x24c090[_0x5290('0x18')]['length']){for(var _0x137b4d=0x0;_0x137b4d<_0x24c090[_0x5290('0x18')]['length'];_0x137b4d+=0x1){var _0x41633f=_0x24c090[_0x5290('0x18')][_0x137b4d];if(fs['existsSync'](path[_0x5290('0x1a')](__dirname,_0x5290('0x18'),_0x41633f[_0x5290('0x1b')]+_0x5290('0x1c')))){var _0x4274af=[];switch(_0x41633f['app']['toLowerCase']()){case _0x5290('0x1d'):var _0x53d91a=_0x41633f[_0x5290('0x1e')][_0x5290('0x1f')](',');if(_0x24c090[_0x5290('0x13')]==='mail'){_0x4274af[_0x5290('0x20')](_0x53d91a[0x0]);_0x4274af[_0x5290('0x20')](_0x53d91a[0x1]);_0x4274af[_0x5290('0x20')](_0x53d91a[_0x5290('0x21')](0x2,_0x53d91a[_0x5290('0x22')])[_0x5290('0x1a')](','));}else{_0x4274af[_0x5290('0x20')](_0x53d91a[0x0]);_0x4274af['push'](_0x53d91a[_0x5290('0x21')](0x1,_0x53d91a[_0x5290('0x22')])[_0x5290('0x1a')](','));}break;case _0x5290('0x23'):var _0x5050c1=_0x41633f[_0x5290('0x1e')][_0x5290('0x1f')](',');_0x4274af[_0x5290('0x20')](_0x5050c1[0x0]);_0x4274af[_0x5290('0x20')](_0x5050c1[0x1]);_0x4274af[_0x5290('0x20')](_0x5050c1['slice'](0x2,_0x5050c1[_0x5290('0x22')])['join'](','));break;case _0x5290('0x24'):var _0x561741=_0x41633f[_0x5290('0x1e')][_0x5290('0x1f')](',');_0x4274af[_0x5290('0x20')](_0x561741[0x0]);_0x4274af[_0x5290('0x20')](_0x561741[0x1]);_0x4274af[_0x5290('0x20')](_0x561741[0x2]);_0x4274af[_0x5290('0x20')](_0x561741[0x3]);_0x4274af['push'](_0x561741[_0x5290('0x21')](0x4,_0x561741[_0x5290('0x22')])['join'](','));break;case'amazonlex':var _0x17ef61=_0x41633f[_0x5290('0x1e')][_0x5290('0x1f')](',');_0x4274af['push'](_0x17ef61[0x0]);_0x4274af[_0x5290('0x20')](_0x17ef61[0x1]);_0x4274af[_0x5290('0x20')](_0x17ef61[0x2]);_0x4274af[_0x5290('0x20')](_0x17ef61[0x3]);_0x4274af[_0x5290('0x20')](_0x17ef61['slice'](0x4,_0x17ef61[_0x5290('0x22')])[_0x5290('0x1a')](','));break;case _0x5290('0x14'):_0x4274af['push'](_0x41633f[_0x5290('0x1e')]);break;case _0x5290('0x25'):_0x4274af['push'](_0x41633f['TagId']);_0x4274af[_0x5290('0x20')](_0x41633f[_0x5290('0x1e')]);break;case _0x5290('0x26'):var _0x2a327b=utils['getMustacheRender'](_0x24c090[_0x5290('0x27')]['notificationTemplate'],_0x24c090);var _0x4d5fb9=_0x41633f[_0x5290('0x1e')][_0x5290('0x1f')](',');_0x4274af[_0x5290('0x20')](_0x4d5fb9[0x0]);_0x4274af[_0x5290('0x20')](_0x4d5fb9[0x1]);_0x4274af['push'](_0x4d5fb9[0x2]);_0x4274af[_0x5290('0x20')](_0x4d5fb9[0x3]);_0x4274af['push'](_0x4d5fb9[0x4]);_0x4274af[_0x5290('0x20')](_0x4d5fb9[0x5]);_0x4274af['push'](_0x4d5fb9[0x6]);_0x4274af[_0x5290('0x20')](_0x4d5fb9[0x7]);_0x4274af[_0x5290('0x20')](_0x4d5fb9[0x8]);_0x4274af[_0x5290('0x20')](_0x4d5fb9[0x9]);_0x4274af[_0x5290('0x20')](_0x4d5fb9[0xa]);_0x4274af[_0x5290('0x20')](_0x24c090[_0x5290('0x15')]['id']);_0x4274af[_0x5290('0x20')](_0x24c090[_0x5290('0x14')]['id']);_0x4274af[_0x5290('0x20')](_0x41633f[_0x5290('0x28')]);_0x4274af['push'](_0x24c090[_0x5290('0x15')][_0x5290('0x29')]);_0x4274af[_0x5290('0x20')](_0x24c090['body'][_0x5290('0x2a')]);_0x4274af[_0x5290('0x20')](_0x2a327b);break;default:_0x4274af=_[_0x5290('0xd')](_0x41633f[_0x5290('0x1e')])?[]:_0x41633f[_0x5290('0x1e')][_0x5290('0x1f')](',');}var _0x128192={'id':util[_0x5290('0x2b')](_0x5290('0x2c'),_0x10da07,_0x41633f['id'],_0x41633f[_0x5290('0x1b')]),'condition':require(_0x5290('0x2d'))['condition'](_0x10da07,getIntervals(_0x13246f[_0x5290('0x2e')],_0x41633f),_0x13246f),'consequence':require(_0x5290('0x2f')+_0x41633f[_0x5290('0x1b')])[_0x5290('0x30')](_0x10da07,_0x4274af,_0x13246f,_0x24c090),'p':_0x41633f[_0x5290('0x31')]||0x0};logger[_0x5290('0x32')](_0x5290('0x33'),_0x128192['id'],_0x5290('0x34'),getIntervals(_0x13246f[_0x5290('0x2e')],_0x41633f)[_0x5290('0x1a')](_0x5290('0x35')));_0x51fb0b['push'](_0x128192);}else{logger[_0x5290('0x36')](_0x5290('0x37'),path[_0x5290('0x1a')](__dirname,'applications',_0x41633f[_0x5290('0x1b')]+'.js'));}}_0x13246f[_0x5290('0x12')][_0x10da07]=new RuleEngine(_0x51fb0b);_0x13246f[_0x5290('0x12')][_0x10da07][_0x5290('0x38')](_0x24c090,function(_0x3bc439){logger[_0x5290('0x32')](_0x5290('0x39'),JSON[_0x5290('0x3a')](_0x3bc439['matchPath']));if(_0x13246f[_0x5290('0x12')][_0x10da07]){_0x13246f['rules'][_0x10da07][_0x5290('0x3b')]('complete');}});return _0xf12e41({'code':0xc8,'message':_0x24c090});}else{if(_0x1aae31){logger['info'](util[_0x5290('0x2b')](_0x5290('0x3c'),_0x10da07));}else{logger[_0x5290('0x32')](_0x5290('0x3d'));}return _0xf12e41({'code':0xc8,'message':_0x24c090});}}catch(_0x43b6b7){logger[_0x5290('0x36')](_0x43b6b7[_0x5290('0x3e')]);return _0xbdc67e(_0x33bd74[_0x5290('0x36')](0x1f4,_0x43b6b7));}}return _0xbdc67e(_0x5290('0x3f'));});},'AcceptMessage':function(_0x550db8){var _0x175525=this;return new Promise(function(_0x5929e4,_0x1ae523){if(_0x550db8['agent']&&_0x550db8[_0x5290('0x40')]['id']){if(_0x13246f[_0x5290('0x41')][_0x550db8[_0x5290('0x40')]['id']]){_0x13246f[_0x5290('0x41')][_0x550db8[_0x5290('0x40')]['id']][_0x5290('0x42')]=![];_0x13246f[_0x5290('0x41')][_0x550db8[_0x5290('0x40')]['id']][_0x5290('0x43')]=undefined;}}if(_0x550db8[_0x5290('0x14')]&&_0x550db8[_0x5290('0x14')]['id']){try{var _0x4d8f8d=getId(_0x550db8[_0x5290('0x13')],_0x550db8['message']?_0x550db8[_0x5290('0x14')]['id']:0x0,_0x550db8[_0x5290('0x15')]?_0x550db8[_0x5290('0x15')]['id']:0x0);if(_0x13246f[_0x5290('0x12')][_0x4d8f8d]){_0x13246f['rules'][_0x4d8f8d]['emit']('end');if(rpc[_0x550db8[_0x5290('0x13')]+_0x5290('0x44')]){rpc[_0x550db8[_0x5290('0x13')]+'QueueReport'][_0x5290('0x45')](_0x4d8f8d,{'UserId':_0x550db8['message'][_0x5290('0x46')]})[_0x5290('0x47')](function(){logger['error'](_0x5290('0x48'));});}}return _0x5929e4({'code':0xc8,'message':_0x550db8});}catch(_0x472a44){logger[_0x5290('0x36')](_0x472a44['stack']);return _0x1ae523(_0x175525[_0x5290('0x36')](0x1f4,_0x472a44));}}logger[_0x5290('0x36')](_0x5290('0x49'));return _0x1ae523(_0x175525[_0x5290('0x36')](0x1f4,_0x5290('0x49')));});},'RejectMessage':function(_0x157eda){var _0x35fb08=this;return new Promise(function(_0xe87a2,_0x369d1d){if(_0x157eda['agent']&&_0x157eda[_0x5290('0x40')]['id']){try{if(_0x13246f['agents'][_0x157eda[_0x5290('0x40')]['id']]){_0x13246f[_0x5290('0x41')][_0x157eda[_0x5290('0x40')]['id']][_0x5290('0x42')]=![];_0x13246f[_0x5290('0x41')][_0x157eda[_0x5290('0x40')]['id']][_0x5290('0x43')]=undefined;}return _0xe87a2({'code':0xc8,'message':_0x157eda});}catch(_0x9f22a9){logger[_0x5290('0x36')](_0x9f22a9[_0x5290('0x3e')]);return _0x369d1d(_0x35fb08[_0x5290('0x36')](0x1f4,_0x9f22a9));}}logger['error'](_0x5290('0x49'));return _0x369d1d(_0x35fb08[_0x5290('0x36')](0x1f4,_0x5290('0x49')));});},'AbandonInteraction':function(_0x237072){var _0x51eee1=this;return new Promise(function(_0x2f0020,_0x40b18f){if(_0x237072[_0x5290('0x13')]&&_0x237072['interaction']&&_0x237072[_0x5290('0x15')]['id']){try{var _0x2aeb09=getId(_0x237072[_0x5290('0x13')],_0x237072[_0x5290('0x14')]?_0x237072[_0x5290('0x14')]['id']:0x0,_0x237072['interaction']?_0x237072[_0x5290('0x15')]['id']:0x0);if(_0x13246f[_0x5290('0x12')][_0x2aeb09]){_0x13246f['rules'][_0x2aeb09][_0x5290('0x3b')](_0x5290('0x4a'));}return _0x2f0020({'code':0xc8,'message':_0x237072});}catch(_0x19a454){logger[_0x5290('0x36')](_0x19a454[_0x5290('0x3e')]);return _0x40b18f(_0x51eee1[_0x5290('0x36')](0x1f4,_0x19a454));}}logger[_0x5290('0x36')](_0x5290('0x49'));return _0x40b18f(_0x51eee1[_0x5290('0x36')](0x1f4,_0x5290('0x49')));});},'AgentCapacity':function(_0x310930){var _0x45841e=this;return new Promise(function(_0x103a9c,_0x2506a7){if(_0x13246f[_0x5290('0x41')][_0x5290('0x4b')](_0x310930['id'])){for(var _0x14a6db in _0x310930[_0x5290('0x4c')]){if(_0x310930['capacity'][_0x5290('0x4b')](_0x14a6db)){if(_0x13246f[_0x5290('0x41')][_0x310930['id']][_0x5290('0x4b')](_0x14a6db+_0x5290('0x4d'))){_0x13246f[_0x5290('0x41')][_0x310930['id']][_0x14a6db+_0x5290('0x4d')]=parseInt(_0x310930[_0x5290('0x4c')][_0x14a6db],0xa);}}}_0x13246f[_0x5290('0x41')][_0x310930['id']][_0x5290('0x4e')]();return _0x103a9c({'code':0xc8,'message':_0x13246f[_0x5290('0x41')][_0x310930['id']]});}else{return _0x2506a7(_0x45841e[_0x5290('0x36')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x4e7a58){return new Promise(function(_0x3c8407){var _0x33fca0=_[_0x5290('0x4f')](_0x13246f[_0x5290('0x41')]);if(_0x4e7a58&&_0x4e7a58['id']){var _0x319d22=_[_0x5290('0x50')](_0x33fca0,function(_0x26b704){return _0x26b704['id']===_0x4e7a58['id'];});_0x3c8407(_0x319d22);}else{_0x3c8407({'count':_0x33fca0['length'],'rows':_0x33fca0});}});},'ChatQueues':function(){return new Promise(function(_0x495a8b){var _0x119ab5=[];for(var _0x5ad343 in _0x13246f[_0x5290('0x51')]){if(_0x13246f[_0x5290('0x51')][_0x5290('0x4b')](_0x5ad343)){var _0x3e9bc3=_0x13246f['chatQueues'][_0x5ad343];var _0x4b9067={'id':_0x3e9bc3['id'],'available':_0x3e9bc3[_0x5290('0x52')],'loggedIn':_0x3e9bc3[_0x5290('0x53')],'name':_0x3e9bc3[_0x5290('0x54')],'paused':_0x3e9bc3[_0x5290('0x55')],'waiting':_0x3e9bc3['waiting']};_0x119ab5[_0x5290('0x20')](_0x4b9067);}}_0x495a8b({'count':_0x119ab5[_0x5290('0x22')],'rows':_0x119ab5});});},'MailQueues':function(){return new Promise(function(_0x5d80f3){var _0x4c0bd3=[];for(var _0x281494 in _0x13246f['mailQueues']){if(_0x13246f[_0x5290('0x56')][_0x5290('0x4b')](_0x281494)){var _0x58f3bb=_0x13246f[_0x5290('0x56')][_0x281494];var _0x2b6ef7={'id':_0x58f3bb['id'],'available':_0x58f3bb[_0x5290('0x52')],'loggedIn':_0x58f3bb[_0x5290('0x53')],'name':_0x58f3bb['name'],'paused':_0x58f3bb[_0x5290('0x55')],'waiting':_0x58f3bb[_0x5290('0x57')]};_0x4c0bd3[_0x5290('0x20')](_0x2b6ef7);}}_0x5d80f3({'count':_0x4c0bd3[_0x5290('0x22')],'rows':_0x4c0bd3});});},'OpenchannelQueues':function(){return new Promise(function(_0xd03980){var _0x31a404=[];for(var _0x4686f9 in _0x13246f[_0x5290('0x58')]){if(_0x13246f[_0x5290('0x58')][_0x5290('0x4b')](_0x4686f9)){var _0x5e1dfc=_0x13246f[_0x5290('0x58')][_0x4686f9];var _0x5d3592={'id':_0x5e1dfc['id'],'available':_0x5e1dfc['available'],'loggedIn':_0x5e1dfc[_0x5290('0x53')],'name':_0x5e1dfc[_0x5290('0x54')],'paused':_0x5e1dfc['paused'],'waiting':_0x5e1dfc[_0x5290('0x57')]};_0x31a404[_0x5290('0x20')](_0x5d3592);}}_0xd03980({'count':_0x31a404[_0x5290('0x22')],'rows':_0x31a404});});},'SmsQueues':function(){return new Promise(function(_0x52af5a){var _0x39a9d6=[];for(var _0x157a71 in _0x13246f[_0x5290('0x59')]){if(_0x13246f[_0x5290('0x59')][_0x5290('0x4b')](_0x157a71)){var _0x9e2d37=_0x13246f['smsQueues'][_0x157a71];var _0x486244={'id':_0x9e2d37['id'],'available':_0x9e2d37[_0x5290('0x52')],'loggedIn':_0x9e2d37[_0x5290('0x53')],'name':_0x9e2d37[_0x5290('0x54')],'paused':_0x9e2d37[_0x5290('0x55')],'waiting':_0x9e2d37[_0x5290('0x57')]};_0x39a9d6[_0x5290('0x20')](_0x486244);}}_0x52af5a({'count':_0x39a9d6[_0x5290('0x22')],'rows':_0x39a9d6});});},'FaxQueues':function(){return new Promise(function(_0x2d1902){var _0x54f043=[];for(var _0x51fd7f in _0x13246f[_0x5290('0x5a')]){if(_0x13246f[_0x5290('0x5a')][_0x5290('0x4b')](_0x51fd7f)){var _0x45fced=_0x13246f[_0x5290('0x5a')][_0x51fd7f];var _0x5a4181={'id':_0x45fced['id'],'available':_0x45fced[_0x5290('0x52')],'loggedIn':_0x45fced[_0x5290('0x53')],'name':_0x45fced[_0x5290('0x54')],'paused':_0x45fced[_0x5290('0x55')],'waiting':_0x45fced[_0x5290('0x57')]};_0x54f043[_0x5290('0x20')](_0x5a4181);}}_0x2d1902({'count':_0x54f043[_0x5290('0x22')],'rows':_0x54f043});});},'WhatsappQueues':function(){return new Promise(function(_0x3c74a0){var _0x32c1d4=[];for(var _0x3ae518 in _0x13246f['whatsappQueues']){if(_0x13246f[_0x5290('0x5b')]['hasOwnProperty'](_0x3ae518)){var _0x1a0afb=_0x13246f['whatsappQueues'][_0x3ae518];var _0x10bc8e={'id':_0x1a0afb['id'],'available':_0x1a0afb[_0x5290('0x52')],'loggedIn':_0x1a0afb[_0x5290('0x53')],'name':_0x1a0afb[_0x5290('0x54')],'paused':_0x1a0afb['paused'],'waiting':_0x1a0afb[_0x5290('0x57')]};_0x32c1d4[_0x5290('0x20')](_0x10bc8e);}}_0x3c74a0({'count':_0x32c1d4[_0x5290('0x22')],'rows':_0x32c1d4});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x4aa2d2){var _0x467537=_[_0x5290('0x4f')](_0x13246f[_0x5290('0x5c')]);_0x4aa2d2({'count':_0x467537[_0x5290('0x22')],'rows':_0x467537});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x56ad79){var _0x136fe9=_[_0x5290('0x4f')](_0x13246f[_0x5290('0x5d')]);_0x56ad79({'count':_0x136fe9[_0x5290('0x22')],'rows':_0x136fe9});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x4880a7){var _0x1035e3=_[_0x5290('0x4f')](_0x13246f[_0x5290('0x5e')]);_0x4880a7({'count':_0x1035e3[_0x5290('0x22')],'rows':_0x1035e3});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x1d71b6){var _0x591920=_[_0x5290('0x4f')](_0x13246f['smsQueuesWaitingInteractions']);_0x1d71b6({'count':_0x591920[_0x5290('0x22')],'rows':_0x591920});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0xfd616c){var _0x417a1c=_[_0x5290('0x4f')](_0x13246f[_0x5290('0x5f')]);_0xfd616c({'count':_0x417a1c[_0x5290('0x22')],'rows':_0x417a1c});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x5cd2fd){var _0x36a8a7=_[_0x5290('0x4f')](_0x13246f['whatsappQueuesWaitingInteractions']);_0x5cd2fd({'count':_0x36a8a7[_0x5290('0x22')],'rows':_0x36a8a7});});}};var _0x1d533d=jayson[_0x5290('0x60')](_0x6e5148)[_0x5290('0x61')]();_0x1d533d['on'](_0x5290('0x36'),function(_0x30c04f){logger[_0x5290('0x36')](JSON[_0x5290('0x3a')](_0x30c04f));return _0x3616eb(_0x30c04f);});_0x1d533d[_0x5290('0x62')](0x232c,_0x5290('0x63'),function(){console['log'](_0x5290('0x64'),0x232c);return _0x45f7ce('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index c9f0c80..4b12d46 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 _0x2fbd=['request','then','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','iftime\x20%s','message','true','[%s][INTERVAL]\x20%s','all','some','join','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','routing','client','http'];(function(_0x1f703f,_0x266ba9){var _0x3ad2ec=function(_0x306f81){while(--_0x306f81){_0x1f703f['push'](_0x1f703f['shift']());}};_0x3ad2ec(++_0x266ba9);}(_0x2fbd,0xbd));var _0xd2fb=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x2fbd[_0x199572];return _0x13cfa3;};'use strict';var util=require(_0xd2fb('0x0'));var BPromise=require(_0xd2fb('0x1'));var jayson=require(_0xd2fb('0x2'));var _=require(_0xd2fb('0x3'));var logger=require('../../../config/logger')(_0xd2fb('0x4'));var client=jayson[_0xd2fb('0x5')][_0xd2fb('0x6')]({'port':0x232a});function request(_0x4e64a6,_0x258c7f){return new BPromise(function(_0x17a743,_0x1990e2){return client[_0xd2fb('0x7')](_0x4e64a6,_0x258c7f)[_0xd2fb('0x8')](function(_0x2377eb){if(_0x2377eb[_0xd2fb('0x9')]){return _0x1990e2(_0x2377eb[_0xd2fb('0x9')]['message']);}else{return _0x17a743(_0x2377eb[_0xd2fb('0xa')]);}})[_0xd2fb('0xb')](function(_0x2d6193){return _0x1990e2(_0x2d6193);});});}exports[_0xd2fb('0xc')]=function(_0x3aab91,_0xf98404,_0x5bc8cc){return function(_0x6d6849){if(_0x5bc8cc[_0xd2fb('0xd')]&&!_0x5bc8cc[_0xd2fb('0xd')][_0x3aab91]){logger[_0xd2fb('0xe')](_0xd2fb('0xf'),_0x3aab91);return _0x6d6849[_0xd2fb('0x10')]();}var _0x3002ab=[];for(var _0x33edf2=0x0;_0x33edf2<_0xf98404[_0xd2fb('0x11')];_0x33edf2+=0x1){_0x3002ab[_0xd2fb('0x12')](request('Command',{'command':util['format'](_0xd2fb('0x13'),_0xf98404[_0x33edf2])})[_0xd2fb('0x8')](function(_0x240c84){return _0x240c84&&_0x240c84[_0xd2fb('0x14')]&&_0x240c84[_0xd2fb('0x14')]['indexOf'](_0xd2fb('0x15'))>=0x0?!![]:![];})[_0xd2fb('0xb')](function(){logger[_0xd2fb('0x9')](_0xd2fb('0x16'),_0x3aab91,_0xf98404[_0x33edf2]);}));}BPromise[_0xd2fb('0x17')](_0x3002ab)[_0xd2fb('0x8')](function(_0xa86991){var _0x2f1adc=_[_0xd2fb('0x18')](_0xa86991);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x3aab91,_0xf98404[_0xd2fb('0x19')](_0xd2fb('0x1a')),_0x2f1adc);_0x6d6849['when'](_0x2f1adc);})[_0xd2fb('0xb')](function(_0x2f568e){logger[_0xd2fb('0x9')]('[%s][INTERVAL]\x20%s\x20%s',_0x3aab91,_0xf98404[_0xd2fb('0x19')](_0xd2fb('0x1a')),_0x2f568e[_0xd2fb('0x1b')]);_0x6d6849[_0xd2fb('0x10')]();});};}; \ No newline at end of file +var _0xa455=['all','some','[%s][INTERVAL]\x20%s\x20%s','join','stack','bluebird','jayson/promise','../../../config/logger','routing','client','request','then','error','message','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','indexOf','true','[%s][INTERVAL]\x20%s'];(function(_0x3594e0,_0x1ff4f6){var _0x297de6=function(_0x23db58){while(--_0x23db58){_0x3594e0['push'](_0x3594e0['shift']());}};_0x297de6(++_0x1ff4f6);}(_0xa455,0x1e5));var _0x5a45=function(_0x5f2f57,_0x5d7fb6){_0x5f2f57=_0x5f2f57-0x0;var _0xdba398=_0xa455[_0x5f2f57];return _0xdba398;};'use strict';var util=require('util');var BPromise=require(_0x5a45('0x0'));var jayson=require(_0x5a45('0x1'));var _=require('lodash');var logger=require(_0x5a45('0x2'))(_0x5a45('0x3'));var client=jayson[_0x5a45('0x4')]['http']({'port':0x232a});function request(_0x4301c7,_0x2065bc){return new BPromise(function(_0x2b66f4,_0x16c760){return client[_0x5a45('0x5')](_0x4301c7,_0x2065bc)[_0x5a45('0x6')](function(_0x7cea41){if(_0x7cea41[_0x5a45('0x7')]){return _0x16c760(_0x7cea41[_0x5a45('0x7')][_0x5a45('0x8')]);}else{return _0x2b66f4(_0x7cea41['result']);}})['catch'](function(_0x38926f){return _0x16c760(_0x38926f);});});}exports[_0x5a45('0x9')]=function(_0x3977ae,_0xcf68e3,_0x18ebea){return function(_0x3a8741){if(_0x18ebea[_0x5a45('0xa')]&&!_0x18ebea[_0x5a45('0xa')][_0x3977ae]){logger[_0x5a45('0xb')](_0x5a45('0xc'),_0x3977ae);return _0x3a8741[_0x5a45('0xd')]();}var _0x364e7a=[];for(var _0x230c7f=0x0;_0x230c7f<_0xcf68e3[_0x5a45('0xe')];_0x230c7f+=0x1){_0x364e7a[_0x5a45('0xf')](request('Command',{'command':util['format']('iftime\x20%s',_0xcf68e3[_0x230c7f])})[_0x5a45('0x6')](function(_0x39a3da){return _0x39a3da&&_0x39a3da[_0x5a45('0x8')]&&_0x39a3da[_0x5a45('0x8')][_0x5a45('0x10')](_0x5a45('0x11'))>=0x0?!![]:![];})['catch'](function(){logger[_0x5a45('0x7')](_0x5a45('0x12'),_0x3977ae,_0xcf68e3[_0x230c7f]);}));}BPromise[_0x5a45('0x13')](_0x364e7a)[_0x5a45('0x6')](function(_0x4f3ac0){var _0x5d38c6=_[_0x5a45('0x14')](_0x4f3ac0);logger[_0x5a45('0xb')](_0x5a45('0x15'),_0x3977ae,_0xcf68e3[_0x5a45('0x16')]('\x20|\x20'),_0x5d38c6);_0x3a8741['when'](_0x5d38c6);})['catch'](function(_0x2b2d30){logger['error'](_0x5a45('0x15'),_0x3977ae,_0xcf68e3[_0x5a45('0x16')]('\x20|\x20'),_0x2b2d30[_0x5a45('0x17')]);_0x3a8741['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 98119f9..eeebcfe 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 _0xd8b0=['indexOf','splice','agent','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','interface','calleridnum','connectedlinenum','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','lastevent','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','talktime','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','now','reason','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentconnect]','diffTime','agentcompleteAt','agentconnectAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferuniqueid','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','transferexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s'];(function(_0x34eda0,_0x52dc21){var _0x48f9ea=function(_0x1a2ded){while(--_0x1a2ded){_0x34eda0['push'](_0x34eda0['shift']());}};_0x48f9ea(++_0x52dc21);}(_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 utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x585166,_0x4b72b0){utils[_0x0d8b('0x2')](util[_0x0d8b('0x3')](_0x0d8b('0x4'),_0x585166[_0x0d8b('0x5')],_0x585166[_0x0d8b('0x6')],_0x585166['queue'],_0x585166['membername'],_0x585166[_0x0d8b('0x7')],_0x585166[_0x0d8b('0x8')],_0x585166[_0x0d8b('0x9')],_0x585166['lastevent']));if(_0x585166[_0x0d8b('0xa')]){utils[_0x0d8b('0xb')](_0x585166['queue'])[_0x0d8b('0xc')](function(_0x348e65){if(_0x348e65){_0x585166[_0x0d8b('0xd')]=_0x348e65[_0x0d8b('0xd')];_0x585166[_0x0d8b('0xe')]=_0x585166[_0x0d8b('0xf')]?_0x348e65[_0x0d8b('0x10')]:![];_0x585166[_0x0d8b('0x11')]=_0x585166['agentacw']?_0x348e65[_0x0d8b('0x12')]:0x0;}utils['request'](_0x0d8b('0x13'),_0x585166);});}else{utils[_0x0d8b('0x14')](_0x0d8b('0x13'),_0x585166);}if(_0x4b72b0){delete transfers[_0x585166[_0x0d8b('0x5')]];}else{delete agents[_0x585166[_0x0d8b('0x15')]];}}exports[_0x0d8b('0x16')]=function(_0x15dd0f){try{utils[_0x0d8b('0x17')](util[_0x0d8b('0x3')](_0x0d8b('0x18'),_0x15dd0f[_0x0d8b('0x5')]),_0x15dd0f);agents[_0x15dd0f[_0x0d8b('0x15')]]=_0x15dd0f;agents[_0x15dd0f[_0x0d8b('0x15')]][_0x0d8b('0x19')]=utils['now']();agents[_0x15dd0f[_0x0d8b('0x15')]][_0x0d8b('0x1a')]=_0x0d8b('0x1b');agents[_0x15dd0f[_0x0d8b('0x15')]][_0x0d8b('0x9')]=null;agents[_0x15dd0f['destuniqueid']][_0x0d8b('0x1c')]=null;utils[_0x0d8b('0x2')](util[_0x0d8b('0x3')](_0x0d8b('0x1d'),_0x15dd0f[_0x0d8b('0x5')],agents[_0x15dd0f[_0x0d8b('0x15')]][_0x0d8b('0x1e')],_0x15dd0f[_0x0d8b('0x15')]));}catch(_0x4a15bf){utils[_0x0d8b('0x1f')](util[_0x0d8b('0x3')](_0x0d8b('0x18'),_0x15dd0f[_0x0d8b('0x5')]),_0x4a15bf);}};exports[_0x0d8b('0x20')]=function(_0x5b709c){try{if(!_[_0x0d8b('0x21')](agents[_0x5b709c[_0x0d8b('0x15')]])){utils['debug'](util['format'](_0x0d8b('0x22'),_0x5b709c['uniqueid']),_0x5b709c);utils['info'](util['format'](_0x0d8b('0x23'),_0x5b709c[_0x0d8b('0x5')],agents[_0x5b709c[_0x0d8b('0x15')]][_0x0d8b('0x1e')],_0x5b709c[_0x0d8b('0x15')]));agents[_0x5b709c[_0x0d8b('0x15')]][_0x0d8b('0x20')]=!![];agents[_0x5b709c[_0x0d8b('0x15')]][_0x0d8b('0x24')]=utils['now']();agents[_0x5b709c[_0x0d8b('0x15')]][_0x0d8b('0x1a')]='timeout';agents[_0x5b709c[_0x0d8b('0x15')]]['reason']=_0x0d8b('0x25');agents[_0x5b709c[_0x0d8b('0x15')]][_0x0d8b('0x26')]=_0x5b709c['ringtime']?parseInt(_0x5b709c['ringtime'])/0x3e8:0x0;agents[_0x5b709c[_0x0d8b('0x15')]][_0x0d8b('0x27')]=0x0;unanswered['push'](_0x5b709c[_0x0d8b('0x15')]);}}catch(_0x59aa83){utils[_0x0d8b('0x1f')](util['format'](_0x0d8b('0x22'),_0x5b709c['uniqueid']),_0x59aa83);}};exports[_0x0d8b('0x28')]=function(_0x546bf6){try{_[_0x0d8b('0x29')](agents,function(_0x544735,_0x3c8887){if(_0x544735[_0x0d8b('0x5')]==_0x546bf6[_0x0d8b('0x5')]&&!_['includes'](unanswered,_0x544735['destuniqueid'])){utils['debug'](util[_0x0d8b('0x3')]('[%s][agents][queuecallerabandon]',_0x546bf6[_0x0d8b('0x5')]),_0x546bf6);utils['info'](util['format'](_0x0d8b('0x2a'),_0x546bf6[_0x0d8b('0x5')],_0x544735[_0x0d8b('0x1e')],_0x544735[_0x0d8b('0x15')]));_0x544735[_0x0d8b('0x20')]=!![];_0x544735[_0x0d8b('0x24')]=utils[_0x0d8b('0x2b')]();_0x544735[_0x0d8b('0x1a')]='abandoned';_0x544735[_0x0d8b('0x2c')]=_0x0d8b('0x2d');_0x544735['holdtime']=_0x546bf6[_0x0d8b('0x26')];_0x544735[_0x0d8b('0x27')]=0x0;writeDB(_0x544735);}});}catch(_0x18a905){utils['error'](util[_0x0d8b('0x3')](_0x0d8b('0x2e'),_0x546bf6[_0x0d8b('0x5')]),_0x18a905);}};exports[_0x0d8b('0x2f')]=function(_0x933e01){try{if(agents[_0x933e01['destuniqueid']]){utils[_0x0d8b('0x17')](util[_0x0d8b('0x3')]('[%s][agents][agentconnect]',_0x933e01[_0x0d8b('0x5')]),_0x933e01);utils[_0x0d8b('0x2')](util[_0x0d8b('0x3')](_0x0d8b('0x30'),_0x933e01[_0x0d8b('0x5')],agents[_0x933e01['destuniqueid']]['membername'],_0x933e01[_0x0d8b('0x15')]));agents[_0x933e01['destuniqueid']]['agentconnectAt']=utils[_0x0d8b('0x2b')]();agents[_0x933e01[_0x0d8b('0x15')]][_0x0d8b('0x9')]=_0x933e01[_0x0d8b('0x9')];agents[_0x933e01[_0x0d8b('0x15')]][_0x0d8b('0x1c')]=_0x933e01['connectedlinename'];agents[_0x933e01[_0x0d8b('0x15')]][_0x0d8b('0x26')]=_0x933e01[_0x0d8b('0x31')];agents[_0x933e01[_0x0d8b('0x15')]][_0x0d8b('0x1a')]=_0x0d8b('0x32');_[_0x0d8b('0x29')](agents,function(_0x5c980b,_0x1d06b6){if(_0x5c980b[_0x0d8b('0x15')]!=_0x933e01[_0x0d8b('0x15')]&&_0x5c980b[_0x0d8b('0x5')]==_0x933e01['uniqueid']){_0x5c980b[_0x0d8b('0x27')]=0x0;_0x5c980b['holdtime']=_0x933e01[_0x0d8b('0x31')];_0x5c980b[_0x0d8b('0x20')]=!![];_0x5c980b[_0x0d8b('0x24')]=utils[_0x0d8b('0x2b')]();_0x5c980b[_0x0d8b('0x1a')]=_0x0d8b('0x33');_0x5c980b[_0x0d8b('0x2c')]=_0x0d8b('0x33');_0x5c980b[_0x0d8b('0x34')]=_0x933e01[_0x0d8b('0x15')];_0x5c980b['answeredelsewheremembername']=_0x933e01['membername'];writeDB(_0x5c980b);}});}}catch(_0x576050){utils['error'](util['format'](_0x0d8b('0x35'),_0x933e01[_0x0d8b('0x5')]),_0x576050);}};exports[_0x0d8b('0xf')]=function(_0x5100cf){try{if(!_['isNil'](agents[_0x5100cf[_0x0d8b('0x15')]])){utils[_0x0d8b('0x17')](util[_0x0d8b('0x3')]('[%s][agents][agentcomplete]',_0x5100cf[_0x0d8b('0x5')]),_0x5100cf);utils[_0x0d8b('0x2')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x5100cf[_0x0d8b('0x5')],agents[_0x5100cf['destuniqueid']][_0x0d8b('0x1e')],_0x5100cf['destuniqueid']));agents[_0x5100cf['destuniqueid']][_0x0d8b('0xf')]=!![];agents[_0x5100cf[_0x0d8b('0x15')]]['agentcompleteAt']=utils['now']();agents[_0x5100cf['destuniqueid']]['talktime']=utils[_0x0d8b('0x36')](agents[_0x5100cf[_0x0d8b('0x15')]][_0x0d8b('0x37')],agents[_0x5100cf['destuniqueid']][_0x0d8b('0x38')]);agents[_0x5100cf[_0x0d8b('0x15')]][_0x0d8b('0x2c')]=_0x5100cf[_0x0d8b('0x2c')];agents[_0x5100cf[_0x0d8b('0x15')]][_0x0d8b('0x1a')]=_0x0d8b('0x39');writeDB(agents[_0x5100cf[_0x0d8b('0x15')]]);}}catch(_0x384a5e){utils[_0x0d8b('0x1f')](util[_0x0d8b('0x3')](_0x0d8b('0x3a'),_0x5100cf[_0x0d8b('0x5')]),_0x384a5e);}};exports[_0x0d8b('0x3b')]=function(_0x570af8){try{if(!_[_0x0d8b('0x21')](agents[_0x570af8[_0x0d8b('0x3c')]])){utils[_0x0d8b('0x17')](util[_0x0d8b('0x3')]('[%s][agents][blindtransfer]',_0x570af8[_0x0d8b('0x5')]),_0x570af8);utils['info'](util['format'](_0x0d8b('0x3d'),_0x570af8[_0x0d8b('0x5')],agents[_0x570af8[_0x0d8b('0x3c')]][_0x0d8b('0x1e')],agents[_0x570af8['transfereruniqueid']][_0x0d8b('0x5')]));agents[_0x570af8[_0x0d8b('0x3c')]][_0x0d8b('0x3e')]=!![];agents[_0x570af8[_0x0d8b('0x3c')]][_0x0d8b('0x3f')]='blind';agents[_0x570af8['transfereruniqueid']]['transferexten']=_0x570af8['extension'];agents[_0x570af8[_0x0d8b('0x3c')]][_0x0d8b('0x40')]=agents[_0x570af8['transfereruniqueid']]['uniqueid'];}}catch(_0x44c5c1){utils[_0x0d8b('0x1f')](util['format']('[%s][agents][blindtransfer]',_0x570af8[_0x0d8b('0x5')]),_0x44c5c1);}};exports[_0x0d8b('0x41')]=function(_0x3cd00a){try{utils[_0x0d8b('0x17')](util[_0x0d8b('0x3')]('[%s][agents][attendedtransfer]',_0x3cd00a[_0x0d8b('0x42')]),_0x3cd00a);if(_0x3cd00a[_0x0d8b('0x42')]==_0x3cd00a['origtransfererlinkedid']){if(!_['isNil'](agents[_0x3cd00a[_0x0d8b('0x43')]])){utils[_0x0d8b('0x2')](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x3cd00a[_0x0d8b('0x42')],agents[_0x3cd00a[_0x0d8b('0x43')]][_0x0d8b('0x1e')]));agents[_0x3cd00a[_0x0d8b('0x43')]]['transfer']=!![];agents[_0x3cd00a[_0x0d8b('0x43')]]['transfertype']='ATTENDED';agents[_0x3cd00a[_0x0d8b('0x43')]][_0x0d8b('0x44')]=_0x3cd00a['origtransfererexten'];agents[_0x3cd00a['secondtransfereruniqueid']][_0x0d8b('0x40')]=_0x3cd00a[_0x0d8b('0x42')];}if(_0x3cd00a[_0x0d8b('0x45')]&&agents[_0x3cd00a[_0x0d8b('0x45')]]){agents[_0x3cd00a[_0x0d8b('0x45')]][_0x0d8b('0x46')]=0x1;transfers[_0x3cd00a[_0x0d8b('0x45')]]=_[_0x0d8b('0x47')](agents[_0x3cd00a['transfereeuniqueid']]);transfers[_0x3cd00a[_0x0d8b('0x45')]][_0x0d8b('0x8')]=agents[_0x3cd00a[_0x0d8b('0x43')]][_0x0d8b('0x8')];transfers[_0x3cd00a[_0x0d8b('0x45')]][_0x0d8b('0x48')]=agents[_0x3cd00a[_0x0d8b('0x43')]][_0x0d8b('0x48')];transfers[_0x3cd00a[_0x0d8b('0x45')]]['agentcalledAt']=utils[_0x0d8b('0x2b')]();transfers[_0x3cd00a[_0x0d8b('0x45')]][_0x0d8b('0x38')]=utils[_0x0d8b('0x2b')]();transfers[_0x3cd00a[_0x0d8b('0x45')]]['holdtime']=0x0;transfers[_0x3cd00a[_0x0d8b('0x45')]][_0x0d8b('0x46')]=0x2;}}else if(_0x3cd00a[_0x0d8b('0x43')]==_0x3cd00a[_0x0d8b('0x49')]){if(!_[_0x0d8b('0x21')](agents[_0x3cd00a['origtransfereruniqueid']])){utils['info'](util[_0x0d8b('0x3')](_0x0d8b('0x4a'),_0x3cd00a[_0x0d8b('0x42')],agents[_0x3cd00a[_0x0d8b('0x42')]]['membername']));agents[_0x3cd00a[_0x0d8b('0x42')]][_0x0d8b('0x3e')]=!![];agents[_0x3cd00a[_0x0d8b('0x42')]]['transfertype']=_0x0d8b('0x4b');agents[_0x3cd00a['origtransfereruniqueid']][_0x0d8b('0x44')]=_0x3cd00a[_0x0d8b('0x4c')];agents[_0x3cd00a[_0x0d8b('0x42')]][_0x0d8b('0x40')]=_0x3cd00a[_0x0d8b('0x43')];}if(_0x3cd00a[_0x0d8b('0x4d')]&&agents[_0x3cd00a['transfertargetuniqueid']]){agents[_0x3cd00a[_0x0d8b('0x4d')]]['agententerreason']=0x1;transfers[_0x3cd00a[_0x0d8b('0x4d')]]=_[_0x0d8b('0x47')](agents[_0x3cd00a[_0x0d8b('0x4d')]]);transfers[_0x3cd00a[_0x0d8b('0x4d')]]['calleridnum']=agents[_0x3cd00a[_0x0d8b('0x42')]][_0x0d8b('0x8')];transfers[_0x3cd00a[_0x0d8b('0x4d')]][_0x0d8b('0x48')]=agents[_0x3cd00a[_0x0d8b('0x42')]][_0x0d8b('0x48')];transfers[_0x3cd00a[_0x0d8b('0x4d')]][_0x0d8b('0x19')]=utils[_0x0d8b('0x2b')]();transfers[_0x3cd00a[_0x0d8b('0x4d')]]['agentconnectAt']=utils['now']();transfers[_0x3cd00a[_0x0d8b('0x4d')]][_0x0d8b('0x26')]=0x0;transfers[_0x3cd00a['transfertargetuniqueid']][_0x0d8b('0x46')]=0x2;}}}catch(_0x5ab1f7){utils['error'](util[_0x0d8b('0x3')](_0x0d8b('0x4e'),_0x3cd00a['origtransfereruniqueid']),_0x5ab1f7);}};exports['hangup']=function(_0x1900e3){try{utils[_0x0d8b('0x17')](util[_0x0d8b('0x3')](_0x0d8b('0x4f'),_0x1900e3[_0x0d8b('0x5')]),_0x1900e3);if(agents[_0x1900e3[_0x0d8b('0x5')]]&&agents[_0x1900e3[_0x0d8b('0x5')]]['reason']===_0x0d8b('0x25')){if(_0x1900e3['cause']==='21'){agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x2c')]=_0x0d8b('0x50');agents[_0x1900e3[_0x0d8b('0x5')]]['lastevent']=_0x0d8b('0x50');}utils['info'](util[_0x0d8b('0x3')](_0x0d8b('0x51'),_0x1900e3[_0x0d8b('0x5')],agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x1e')],agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x2c')],agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x1a')]));writeDB(agents[_0x1900e3[_0x0d8b('0x5')]]);var _0x4eb07e=unanswered[_0x0d8b('0x52')](_0x1900e3['uniqueid']);if(_0x4eb07e>-0x1){unanswered[_0x0d8b('0x53')](_0x4eb07e,0x1);}}if(transfers[_0x1900e3[_0x0d8b('0x5')]]){transfers[_0x1900e3['uniqueid']][_0x0d8b('0xf')]=!![];transfers[_0x1900e3['uniqueid']][_0x0d8b('0x37')]=utils[_0x0d8b('0x2b')]();transfers[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x27')]=utils[_0x0d8b('0x36')](transfers[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x37')],transfers[_0x1900e3[_0x0d8b('0x5')]]['agentconnectAt']);transfers[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x2c')]='agent';transfers[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x1a')]=_0x0d8b('0x39');utils[_0x0d8b('0x2')](util[_0x0d8b('0x3')](_0x0d8b('0x51'),_0x1900e3[_0x0d8b('0x5')],transfers[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x1e')],transfers[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x2c')],transfers[_0x1900e3[_0x0d8b('0x5')]]['lastevent']));writeDB(transfers[_0x1900e3[_0x0d8b('0x5')]],!![]);}if(agents[_0x1900e3[_0x0d8b('0x5')]]&&agents[_0x1900e3[_0x0d8b('0x5')]]['agentconnectAt']){agents[_0x1900e3['uniqueid']][_0x0d8b('0xf')]=!![];agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x37')]=utils['now']();agents[_0x1900e3['uniqueid']][_0x0d8b('0x27')]=utils[_0x0d8b('0x36')](agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x37')],agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x38')]);agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x2c')]=agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x3e')]?_0x0d8b('0x3e'):_0x0d8b('0x54');agents[_0x1900e3[_0x0d8b('0x5')]]['lastevent']=_0x0d8b('0x39');utils[_0x0d8b('0x2')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1900e3[_0x0d8b('0x5')],agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x1e')],agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x2c')],agents[_0x1900e3[_0x0d8b('0x5')]]['lastevent']));writeDB(agents[_0x1900e3['uniqueid']]);}}catch(_0x581d8e){utils[_0x0d8b('0x1f')](util[_0x0d8b('0x3')](_0x0d8b('0x4f'),_0x1900e3[_0x0d8b('0x5')]),_0x581d8e);}}; \ No newline at end of file +var _0xc788=['transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','queue','then','type','agentcomplete','acwtime','agentacw','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','timeout','holdtime','ringtime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','reason','talktime','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','isNil','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten'];(function(_0x509e86,_0x261dda){var _0xdac7df=function(_0x2c9b44){while(--_0x2c9b44){_0x509e86['push'](_0x509e86['shift']());}};_0xdac7df(++_0x261dda);}(_0xc788,0xc4));var _0x8c78=function(_0x33f2fa,_0x1411d5){_0x33f2fa=_0x33f2fa-0x0;var _0xe5b3b3=_0xc788[_0x33f2fa];return _0xe5b3b3;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var utils=require(_0x8c78('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4ecb26,_0x4ce125){utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x5'),_0x4ecb26[_0x8c78('0x6')],_0x4ecb26[_0x8c78('0x7')],_0x4ecb26['queue'],_0x4ecb26[_0x8c78('0x8')],_0x4ecb26[_0x8c78('0x9')],_0x4ecb26[_0x8c78('0xa')],_0x4ecb26[_0x8c78('0xb')],_0x4ecb26[_0x8c78('0xc')]));if(_0x4ecb26['queue']){utils[_0x8c78('0xd')](_0x4ecb26[_0x8c78('0xe')])[_0x8c78('0xf')](function(_0x39c0e5){if(_0x39c0e5){_0x4ecb26[_0x8c78('0x10')]=_0x39c0e5[_0x8c78('0x10')];_0x4ecb26['agentacw']=_0x4ecb26[_0x8c78('0x11')]?_0x39c0e5['acw']:![];_0x4ecb26[_0x8c78('0x12')]=_0x4ecb26[_0x8c78('0x13')]?_0x39c0e5['acwTimeout']:0x0;}utils[_0x8c78('0x14')](_0x8c78('0x15'),_0x4ecb26);});}else{utils['request'](_0x8c78('0x15'),_0x4ecb26);}if(_0x4ce125){delete transfers[_0x4ecb26['uniqueid']];}else{delete agents[_0x4ecb26['destuniqueid']];}}exports[_0x8c78('0x16')]=function(_0x1b1d0e){try{utils[_0x8c78('0x17')](util[_0x8c78('0x4')](_0x8c78('0x18'),_0x1b1d0e[_0x8c78('0x6')]),_0x1b1d0e);agents[_0x1b1d0e[_0x8c78('0x19')]]=_0x1b1d0e;agents[_0x1b1d0e[_0x8c78('0x19')]][_0x8c78('0x1a')]=utils[_0x8c78('0x1b')]();agents[_0x1b1d0e['destuniqueid']][_0x8c78('0xc')]=_0x8c78('0x1c');agents[_0x1b1d0e['destuniqueid']][_0x8c78('0xb')]=null;agents[_0x1b1d0e[_0x8c78('0x19')]][_0x8c78('0x1d')]=null;utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x1e'),_0x1b1d0e['uniqueid'],agents[_0x1b1d0e['destuniqueid']][_0x8c78('0x8')],_0x1b1d0e['destuniqueid']));}catch(_0x56801a){utils[_0x8c78('0x1f')](util['format'](_0x8c78('0x18'),_0x1b1d0e[_0x8c78('0x6')]),_0x56801a);}};exports['agentringnoanswer']=function(_0x6c9a12){try{if(!_['isNil'](agents[_0x6c9a12[_0x8c78('0x19')]])){utils[_0x8c78('0x17')](util['format'](_0x8c78('0x20'),_0x6c9a12[_0x8c78('0x6')]),_0x6c9a12);utils['info'](util[_0x8c78('0x4')](_0x8c78('0x21'),_0x6c9a12[_0x8c78('0x6')],agents[_0x6c9a12[_0x8c78('0x19')]][_0x8c78('0x8')],_0x6c9a12[_0x8c78('0x19')]));agents[_0x6c9a12[_0x8c78('0x19')]][_0x8c78('0x22')]=!![];agents[_0x6c9a12[_0x8c78('0x19')]]['agentringnoanswerAt']=utils[_0x8c78('0x1b')]();agents[_0x6c9a12[_0x8c78('0x19')]][_0x8c78('0xc')]='timeout';agents[_0x6c9a12[_0x8c78('0x19')]]['reason']=_0x8c78('0x23');agents[_0x6c9a12[_0x8c78('0x19')]][_0x8c78('0x24')]=_0x6c9a12['ringtime']?parseInt(_0x6c9a12[_0x8c78('0x25')])/0x3e8:0x0;agents[_0x6c9a12[_0x8c78('0x19')]]['talktime']=0x0;unanswered[_0x8c78('0x26')](_0x6c9a12[_0x8c78('0x19')]);}}catch(_0x394c1d){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x20'),_0x6c9a12['uniqueid']),_0x394c1d);}};exports[_0x8c78('0x27')]=function(_0x51add6){try{_[_0x8c78('0x28')](agents,function(_0x17f4c8,_0xb69c52){if(_0x17f4c8['uniqueid']==_0x51add6[_0x8c78('0x6')]&&!_[_0x8c78('0x29')](unanswered,_0x17f4c8['destuniqueid'])){utils[_0x8c78('0x17')](util[_0x8c78('0x4')](_0x8c78('0x2a'),_0x51add6['uniqueid']),_0x51add6);utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x2b'),_0x51add6['uniqueid'],_0x17f4c8[_0x8c78('0x8')],_0x17f4c8[_0x8c78('0x19')]));_0x17f4c8['agentringnoanswer']=!![];_0x17f4c8[_0x8c78('0x2c')]=utils[_0x8c78('0x1b')]();_0x17f4c8[_0x8c78('0xc')]=_0x8c78('0x2d');_0x17f4c8[_0x8c78('0x2e')]=_0x8c78('0x2d');_0x17f4c8[_0x8c78('0x24')]=_0x51add6[_0x8c78('0x24')];_0x17f4c8[_0x8c78('0x2f')]=0x0;writeDB(_0x17f4c8);}});}catch(_0x15a868){utils['error'](util[_0x8c78('0x4')](_0x8c78('0x2a'),_0x51add6[_0x8c78('0x6')]),_0x15a868);}};exports[_0x8c78('0x30')]=function(_0x34481a){try{if(agents[_0x34481a['destuniqueid']]){utils[_0x8c78('0x17')](util[_0x8c78('0x4')](_0x8c78('0x31'),_0x34481a['uniqueid']),_0x34481a);utils[_0x8c78('0x3')](util[_0x8c78('0x4')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x34481a[_0x8c78('0x6')],agents[_0x34481a['destuniqueid']][_0x8c78('0x8')],_0x34481a[_0x8c78('0x19')]));agents[_0x34481a[_0x8c78('0x19')]][_0x8c78('0x32')]=utils['now']();agents[_0x34481a[_0x8c78('0x19')]]['connectedlinenum']=_0x34481a[_0x8c78('0xb')];agents[_0x34481a[_0x8c78('0x19')]][_0x8c78('0x1d')]=_0x34481a['connectedlinename'];agents[_0x34481a['destuniqueid']][_0x8c78('0x24')]=_0x34481a[_0x8c78('0x25')];agents[_0x34481a[_0x8c78('0x19')]][_0x8c78('0xc')]=_0x8c78('0x33');_[_0x8c78('0x28')](agents,function(_0x326b34,_0x314679){if(_0x326b34[_0x8c78('0x19')]!=_0x34481a[_0x8c78('0x19')]&&_0x326b34[_0x8c78('0x6')]==_0x34481a[_0x8c78('0x6')]){_0x326b34[_0x8c78('0x2f')]=0x0;_0x326b34['holdtime']=_0x34481a[_0x8c78('0x25')];_0x326b34[_0x8c78('0x22')]=!![];_0x326b34['agentringnoanswerAt']=utils['now']();_0x326b34[_0x8c78('0xc')]=_0x8c78('0x34');_0x326b34['reason']=_0x8c78('0x34');_0x326b34[_0x8c78('0x35')]=_0x34481a['destuniqueid'];_0x326b34[_0x8c78('0x36')]=_0x34481a[_0x8c78('0x8')];writeDB(_0x326b34);}});}}catch(_0x57e2c7){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x31'),_0x34481a[_0x8c78('0x6')]),_0x57e2c7);}};exports[_0x8c78('0x11')]=function(_0x4e4880){try{if(!_['isNil'](agents[_0x4e4880[_0x8c78('0x19')]])){utils[_0x8c78('0x17')](util[_0x8c78('0x4')](_0x8c78('0x37'),_0x4e4880[_0x8c78('0x6')]),_0x4e4880);utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x38'),_0x4e4880[_0x8c78('0x6')],agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0x8')],_0x4e4880['destuniqueid']));agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0x11')]=!![];agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0x39')]=utils[_0x8c78('0x1b')]();agents[_0x4e4880['destuniqueid']][_0x8c78('0x2f')]=utils[_0x8c78('0x3a')](agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0x39')],agents[_0x4e4880[_0x8c78('0x19')]]['agentconnectAt']);agents[_0x4e4880[_0x8c78('0x19')]]['reason']=_0x4e4880['reason'];agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0xc')]=_0x8c78('0x3b');writeDB(agents[_0x4e4880['destuniqueid']]);}}catch(_0x1d78a0){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x37'),_0x4e4880[_0x8c78('0x6')]),_0x1d78a0);}};exports[_0x8c78('0x3c')]=function(_0x26103c){try{if(!_[_0x8c78('0x3d')](agents[_0x26103c[_0x8c78('0x3e')]])){utils['debug'](util[_0x8c78('0x4')](_0x8c78('0x3f'),_0x26103c[_0x8c78('0x6')]),_0x26103c);utils[_0x8c78('0x3')](util['format'](_0x8c78('0x40'),_0x26103c[_0x8c78('0x6')],agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x8')],agents[_0x26103c['transfereruniqueid']][_0x8c78('0x6')]));agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x41')]=!![];agents[_0x26103c['transfereruniqueid']][_0x8c78('0x42')]='blind';agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x43')]=_0x26103c[_0x8c78('0x44')];agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x45')]=agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x6')];}}catch(_0x38fec1){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x3f'),_0x26103c[_0x8c78('0x6')]),_0x38fec1);}};exports[_0x8c78('0x46')]=function(_0x18d896){try{utils['debug'](util[_0x8c78('0x4')](_0x8c78('0x47'),_0x18d896[_0x8c78('0x48')]),_0x18d896);if(_0x18d896[_0x8c78('0x48')]==_0x18d896['origtransfererlinkedid']){if(!_[_0x8c78('0x3d')](agents[_0x18d896[_0x8c78('0x49')]])){utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x4a'),_0x18d896[_0x8c78('0x48')],agents[_0x18d896['secondtransfereruniqueid']][_0x8c78('0x8')]));agents[_0x18d896[_0x8c78('0x49')]]['transfer']=!![];agents[_0x18d896[_0x8c78('0x49')]]['transfertype']=_0x8c78('0x4b');agents[_0x18d896[_0x8c78('0x49')]][_0x8c78('0x43')]=_0x18d896[_0x8c78('0x4c')];agents[_0x18d896[_0x8c78('0x49')]][_0x8c78('0x45')]=_0x18d896[_0x8c78('0x48')];}if(_0x18d896['transfereeuniqueid']&&agents[_0x18d896[_0x8c78('0x4d')]]){agents[_0x18d896[_0x8c78('0x4d')]]['agententerreason']=0x1;transfers[_0x18d896[_0x8c78('0x4d')]]=_[_0x8c78('0x4e')](agents[_0x18d896['transfereeuniqueid']]);transfers[_0x18d896[_0x8c78('0x4d')]][_0x8c78('0xa')]=agents[_0x18d896[_0x8c78('0x49')]][_0x8c78('0xa')];transfers[_0x18d896[_0x8c78('0x4d')]][_0x8c78('0x4f')]=agents[_0x18d896[_0x8c78('0x49')]][_0x8c78('0x4f')];transfers[_0x18d896[_0x8c78('0x4d')]][_0x8c78('0x1a')]=utils[_0x8c78('0x1b')]();transfers[_0x18d896[_0x8c78('0x4d')]][_0x8c78('0x32')]=utils[_0x8c78('0x1b')]();transfers[_0x18d896['transfereeuniqueid']][_0x8c78('0x24')]=0x0;transfers[_0x18d896['transfereeuniqueid']][_0x8c78('0x50')]=0x2;}}else if(_0x18d896['secondtransfereruniqueid']==_0x18d896['secondtransfererlinkedid']){if(!_['isNil'](agents[_0x18d896[_0x8c78('0x48')]])){utils['info'](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x18d896[_0x8c78('0x48')],agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x8')]));agents[_0x18d896[_0x8c78('0x48')]]['transfer']=!![];agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x42')]=_0x8c78('0x4b');agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x43')]=_0x18d896[_0x8c78('0x51')];agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x45')]=_0x18d896[_0x8c78('0x49')];}if(_0x18d896[_0x8c78('0x52')]&&agents[_0x18d896[_0x8c78('0x52')]]){agents[_0x18d896[_0x8c78('0x52')]][_0x8c78('0x50')]=0x1;transfers[_0x18d896[_0x8c78('0x52')]]=_['clone'](agents[_0x18d896[_0x8c78('0x52')]]);transfers[_0x18d896['transfertargetuniqueid']][_0x8c78('0xa')]=agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0xa')];transfers[_0x18d896['transfertargetuniqueid']][_0x8c78('0x4f')]=agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x4f')];transfers[_0x18d896['transfertargetuniqueid']][_0x8c78('0x1a')]=utils[_0x8c78('0x1b')]();transfers[_0x18d896['transfertargetuniqueid']][_0x8c78('0x32')]=utils[_0x8c78('0x1b')]();transfers[_0x18d896[_0x8c78('0x52')]]['holdtime']=0x0;transfers[_0x18d896[_0x8c78('0x52')]][_0x8c78('0x50')]=0x2;}}}catch(_0x1015e8){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x47'),_0x18d896[_0x8c78('0x48')]),_0x1015e8);}};exports[_0x8c78('0x53')]=function(_0x240f1e){try{utils['debug'](util[_0x8c78('0x4')](_0x8c78('0x54'),_0x240f1e[_0x8c78('0x6')]),_0x240f1e);if(agents[_0x240f1e[_0x8c78('0x6')]]&&agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')]===_0x8c78('0x23')){if(_0x240f1e[_0x8c78('0x55')]==='21'){agents[_0x240f1e[_0x8c78('0x6')]]['reason']=_0x8c78('0x56');agents[_0x240f1e[_0x8c78('0x6')]]['lastevent']='rejected';}utils[_0x8c78('0x3')](util['format'](_0x8c78('0x57'),_0x240f1e[_0x8c78('0x6')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x8')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')],agents[_0x240f1e['uniqueid']]['lastevent']));writeDB(agents[_0x240f1e[_0x8c78('0x6')]]);var _0x2d385f=unanswered[_0x8c78('0x58')](_0x240f1e[_0x8c78('0x6')]);if(_0x2d385f>-0x1){unanswered[_0x8c78('0x59')](_0x2d385f,0x1);}}if(transfers[_0x240f1e['uniqueid']]){transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x11')]=!![];transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x39')]=utils[_0x8c78('0x1b')]();transfers[_0x240f1e[_0x8c78('0x6')]]['talktime']=utils[_0x8c78('0x3a')](transfers[_0x240f1e[_0x8c78('0x6')]]['agentcompleteAt'],transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x32')]);transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')]=_0x8c78('0x5a');transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0xc')]=_0x8c78('0x3b');utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x57'),_0x240f1e[_0x8c78('0x6')],transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x8')],transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')],transfers[_0x240f1e[_0x8c78('0x6')]]['lastevent']));writeDB(transfers[_0x240f1e[_0x8c78('0x6')]],!![]);}if(agents[_0x240f1e['uniqueid']]&&agents[_0x240f1e['uniqueid']][_0x8c78('0x32')]){agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x11')]=!![];agents[_0x240f1e[_0x8c78('0x6')]]['agentcompleteAt']=utils[_0x8c78('0x1b')]();agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2f')]=utils['diffTime'](agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x39')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x32')]);agents[_0x240f1e['uniqueid']][_0x8c78('0x2e')]=agents[_0x240f1e[_0x8c78('0x6')]]['transfer']?'transfer':'agent';agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0xc')]=_0x8c78('0x3b');utils[_0x8c78('0x3')](util['format'](_0x8c78('0x57'),_0x240f1e['uniqueid'],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x8')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0xc')]));writeDB(agents[_0x240f1e['uniqueid']]);}}catch(_0x5c67c9){utils['error'](util[_0x8c78('0x4')](_0x8c78('0x54'),_0x240f1e['uniqueid']),_0x5c67c9);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 4e88731..b46995a 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 _0x80ba=['calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','transfertargetchannel','origtransfererchannel','userfield','_attended','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','lodash','util','./utils','NO\x20ANSWER','ANSWERED','BUSY','FAILED','info','format','uniqueid','queue','membername','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','channel','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','hangup','[%s][calls][hangup]','callerid'];(function(_0x3a58ec,_0x4205bb){var _0x2e0660=function(_0x23d07c){while(--_0x23d07c){_0x3a58ec['push'](_0x3a58ec['shift']());}};_0x2e0660(++_0x4205bb);}(_0x80ba,0xb1));var _0xa80b=function(_0x6192b2,_0x1cfb6d){_0x6192b2=_0x6192b2-0x0;var _0x358ea6=_0x80ba[_0x6192b2];return _0x358ea6;};'use strict';var _=require(_0xa80b('0x0'));var util=require(_0xa80b('0x1'));var utils=require(_0xa80b('0x2'));var dispositions=[_0xa80b('0x3'),'FAILED','FAILED',_0xa80b('0x3'),_0xa80b('0x3'),_0xa80b('0x3'),_0xa80b('0x4'),_0xa80b('0x5'),_0xa80b('0x6'),_0xa80b('0x6'),'FAILED'];var channels={};function writeDB(_0x30dec6){utils[_0xa80b('0x7')](util[_0xa80b('0x8')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x30dec6[_0xa80b('0x9')],_0x30dec6['channel'],_0x30dec6[_0xa80b('0xa')],_0x30dec6[_0xa80b('0xb')],_0x30dec6[_0xa80b('0xc')],_0x30dec6[_0xa80b('0xd')],_0x30dec6[_0xa80b('0xe')],_0x30dec6['lastevent']));if(_0x30dec6[_0xa80b('0xf')]){utils[_0xa80b('0x10')](_0x30dec6[_0xa80b('0xf')])[_0xa80b('0x11')](function(_0xb9cdec){if(_0xb9cdec){_0x30dec6[_0xa80b('0x12')]=_0xb9cdec['id'];}utils[_0xa80b('0x13')](_0xa80b('0x14'),_0x30dec6);});}else{utils[_0xa80b('0x13')]('CreateVoiceCallReport',_0x30dec6);}if(channels[_0x30dec6[_0xa80b('0x9')]]){delete channels[_0x30dec6['uniqueid']];}}exports[_0xa80b('0x15')]=function(_0x195301){try{utils[_0xa80b('0x16')](util[_0xa80b('0x8')](_0xa80b('0x17'),_0x195301[_0xa80b('0x9')]),_0x195301);if(_0x195301[_0xa80b('0x9')]==_0x195301['linkedid']&&_0x195301[_0xa80b('0x18')]!='OutgoingSpoolFailed'){utils[_0xa80b('0x7')](util[_0xa80b('0x8')](_0xa80b('0x19'),_0x195301['uniqueid'],_0x195301['context'],_0x195301['exten']));channels[_0x195301[_0xa80b('0x9')]]={'uniqueid':_0x195301[_0xa80b('0x9')],'accountcode':_0x195301[_0xa80b('0xf')],'source':_0x195301[_0xa80b('0xd')],'destination':_0x195301[_0xa80b('0x1a')],'destinationcontext':_0x195301[_0xa80b('0x1b')],'channel':_0x195301['channel'],'starttime':utils[_0xa80b('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xa80b('0x3'),'amaflags':_0xa80b('0x1d')};}}catch(_0x4c2f77){utils[_0xa80b('0x1e')](util[_0xa80b('0x8')]('[%s][calls][newchannel]',_0x195301['uniqueid']),_0x4c2f77);}};exports[_0xa80b('0x1f')]=function(_0x103ba8){try{utils[_0xa80b('0x16')](util[_0xa80b('0x8')](_0xa80b('0x20'),_0x103ba8[_0xa80b('0x9')]),_0x103ba8);if(!_[_0xa80b('0x21')](channels[_0x103ba8[_0xa80b('0x9')]])&&_0x103ba8[_0xa80b('0x22')]==0x6){utils[_0xa80b('0x7')](util[_0xa80b('0x8')](_0xa80b('0x23'),_0x103ba8['uniqueid'],_0x103ba8[_0xa80b('0x1b')],_0x103ba8['channel']));if(_[_0xa80b('0x21')](channels[_0x103ba8['uniqueid']][_0xa80b('0x24')])){channels[_0x103ba8[_0xa80b('0x9')]]['systemanswertime']=utils[_0xa80b('0x1c')]();}}else if(!_[_0xa80b('0x21')](channels[_0x103ba8[_0xa80b('0x25')]])&&_0x103ba8['channelstate']==0x6&&_0x103ba8[_0xa80b('0x1b')]!='transfer'){utils[_0xa80b('0x7')](util[_0xa80b('0x8')](_0xa80b('0x26'),_0x103ba8[_0xa80b('0x9')],_0x103ba8['linkedid'],_0x103ba8['context'],_0x103ba8[_0xa80b('0x18')]));channels[_0x103ba8[_0xa80b('0x25')]][_0xa80b('0xf')]=_0x103ba8['accountcode'];channels[_0x103ba8[_0xa80b('0x25')]][_0xa80b('0x27')]=_0x103ba8[_0xa80b('0x18')];if(_[_0xa80b('0x21')](channels[_0x103ba8[_0xa80b('0x25')]][_0xa80b('0x28')])){channels[_0x103ba8[_0xa80b('0x25')]][_0xa80b('0x28')]=utils[_0xa80b('0x1c')]();}channels[_0x103ba8[_0xa80b('0x25')]][_0xa80b('0x29')]=dispositions[_['toNumber'](_0x103ba8['channelstate'])]||'ANSWERED';}}catch(_0x1c17af){utils[_0xa80b('0x1e')](util[_0xa80b('0x8')]('[%s][calls][newstate]',_0x103ba8[_0xa80b('0x9')]),_0x1c17af);}};exports[_0xa80b('0x2a')]=function(_0x5df910){try{if(!_[_0xa80b('0x21')](channels[_0x5df910['uniqueid']])){utils[_0xa80b('0x16')](util[_0xa80b('0x8')](_0xa80b('0x2b'),_0x5df910[_0xa80b('0x9')]),_0x5df910);if(_['isNil'](channels[_0x5df910[_0xa80b('0x9')]][_0xa80b('0x2c')])){channels[_0x5df910['uniqueid']][_0xa80b('0x2c')]=_0x5df910[_0xa80b('0x2d')]+'\x20<'+_0x5df910[_0xa80b('0xd')]+'>';}utils[_0xa80b('0x7')](util[_0xa80b('0x8')](_0xa80b('0x2e'),_0x5df910['uniqueid'],channels[_0x5df910[_0xa80b('0x9')]][_0xa80b('0x2c')],_0x5df910[_0xa80b('0x2f')]));channels[_0x5df910[_0xa80b('0x9')]][_0xa80b('0x30')]=utils['now']();channels[_0x5df910['uniqueid']][_0xa80b('0x31')]=utils[_0xa80b('0x32')](channels[_0x5df910['uniqueid']][_0xa80b('0x30')],channels[_0x5df910[_0xa80b('0x9')]][_0xa80b('0x33')]);channels[_0x5df910[_0xa80b('0x9')]][_0xa80b('0x34')]=channels[_0x5df910['uniqueid']][_0xa80b('0x28')]?utils[_0xa80b('0x32')](channels[_0x5df910[_0xa80b('0x9')]][_0xa80b('0x30')],channels[_0x5df910['uniqueid']][_0xa80b('0x28')]):0x0;writeDB(channels[_0x5df910[_0xa80b('0x9')]]);}}catch(_0x96d912){utils[_0xa80b('0x1e')](util[_0xa80b('0x8')]('[%s][calls][hangup]',_0x5df910[_0xa80b('0x9')]),_0x96d912);}};exports[_0xa80b('0x35')]=function(_0x4d599f){try{if(!_[_0xa80b('0x21')](channels[_0x4d599f[_0xa80b('0x36')]])){utils[_0xa80b('0x16')](util[_0xa80b('0x8')](_0xa80b('0x37'),_0x4d599f[_0xa80b('0x38')]),_0x4d599f);if(channels[_0x4d599f[_0xa80b('0x36')]][_0xa80b('0x18')]==_0x4d599f[_0xa80b('0x39')]){utils[_0xa80b('0x7')](util[_0xa80b('0x8')](_0xa80b('0x3a'),_0x4d599f[_0xa80b('0x38')],_0x4d599f[_0xa80b('0x36')],_0x4d599f[_0xa80b('0x3b')]));channels[_0x4d599f[_0xa80b('0x36')]][_0xa80b('0x27')]=_0x4d599f[_0xa80b('0x3b')];channels[_0x4d599f[_0xa80b('0x36')]]['userfield']='_attended';}else if(channels[_0x4d599f['localtwolinkedid']][_0xa80b('0x18')]=_0x4d599f[_0xa80b('0x3c')]){utils[_0xa80b('0x7')](util[_0xa80b('0x8')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x4d599f[_0xa80b('0x38')],_0x4d599f[_0xa80b('0x36')],_0x4d599f[_0xa80b('0x3d')]));channels[_0x4d599f[_0xa80b('0x36')]]['destinationchannel']=_0x4d599f[_0xa80b('0x3d')];channels[_0x4d599f[_0xa80b('0x36')]][_0xa80b('0x3e')]=_0xa80b('0x3f');}}}catch(_0x5c772d){utils[_0xa80b('0x1e')](util[_0xa80b('0x8')](_0xa80b('0x37'),_0x4d599f[_0xa80b('0x38')]),_0x5c772d);}};exports['musiconholdstart']=function(_0x3e9dd1){try{if(!_['isNil'](channels[_0x3e9dd1[_0xa80b('0x9')]])){utils[_0xa80b('0x16')](util[_0xa80b('0x8')](_0xa80b('0x40'),_0x3e9dd1[_0xa80b('0x9')]),_0x3e9dd1);channels[_0x3e9dd1['uniqueid']]['musiconholdstartAt']=utils['now']();utils[_0xa80b('0x7')](util[_0xa80b('0x8')](_0xa80b('0x41'),_0x3e9dd1[_0xa80b('0x9')],channels[_0x3e9dd1[_0xa80b('0x9')]][_0xa80b('0x42')]));}}catch(_0x4d6e3f){utils[_0xa80b('0x1e')](util['format'](_0xa80b('0x40'),_0x3e9dd1['uniqueid']),_0x4d6e3f);}};exports[_0xa80b('0x43')]=function(_0x40156c){try{if(!_[_0xa80b('0x21')](channels[_0x40156c[_0xa80b('0x9')]])){utils['debug'](util[_0xa80b('0x8')]('[%s][calls][musiconholdstop]',_0x40156c[_0xa80b('0x9')]),_0x40156c);if(!_[_0xa80b('0x21')](channels[_0x40156c[_0xa80b('0x9')]][_0xa80b('0x42')])){channels[_0x40156c[_0xa80b('0x9')]][_0xa80b('0x44')]+=utils[_0xa80b('0x32')](utils[_0xa80b('0x1c')](),channels[_0x40156c[_0xa80b('0x9')]][_0xa80b('0x42')]);utils['info'](util[_0xa80b('0x8')](_0xa80b('0x45'),_0x40156c[_0xa80b('0x9')],channels[_0x40156c[_0xa80b('0x9')]][_0xa80b('0x44')]));delete channels[_0x40156c['uniqueid']][_0xa80b('0x42')];}}}catch(_0x4681a6){utils['error'](util[_0xa80b('0x8')](_0xa80b('0x46'),_0x40156c['uniqueid']),_0x4681a6);}};exports[_0xa80b('0x47')]=function(_0x665720){try{if(!_[_0xa80b('0x21')](channels[_0x665720[_0xa80b('0x9')]])){utils['debug'](util[_0xa80b('0x8')]('[%s][calls][varset]',_0x665720[_0xa80b('0x9')]),_0x665720);if(!_[_0xa80b('0x21')](_0x665720['variable']['xmd-originatecalleridnum'])){utils['info'](util[_0xa80b('0x8')](_0xa80b('0x48'),_0x665720['uniqueid'],_0x665720[_0xa80b('0x49')]));channels[_0x665720[_0xa80b('0x9')]][_0xa80b('0x4a')]=_0x665720['value'];}if(!_[_0xa80b('0x21')](_0x665720[_0xa80b('0x4b')][_0xa80b('0x4c')])){utils[_0xa80b('0x7')](util['format'](_0xa80b('0x4d'),_0x665720['uniqueid'],_0x665720[_0xa80b('0x49')]));channels[_0x665720[_0xa80b('0x9')]][_0xa80b('0x4e')]=_0x665720[_0xa80b('0x49')];channels[_0x665720[_0xa80b('0x9')]][_0xa80b('0x2c')]='\x22'+_0x665720[_0xa80b('0x49')]+'\x22\x20<'+_0x665720['value']+'>';}if(!_[_0xa80b('0x21')](_0x665720[_0xa80b('0x4b')]['xmd-callerid-preview'])||!_['isNil'](_0x665720['variable'][_0xa80b('0x4f')])){utils[_0xa80b('0x7')](util[_0xa80b('0x8')](_0xa80b('0x50'),_0x665720[_0xa80b('0x9')],!_[_0xa80b('0x21')](_0x665720[_0xa80b('0x4b')][_0xa80b('0x51')])?_0xa80b('0x51'):_0xa80b('0x4f'),_0x665720['value']));channels[_0x665720[_0xa80b('0x9')]][_0xa80b('0x2c')]=_0x665720[_0xa80b('0x49')];}if(!_['isNil'](_0x665720[_0xa80b('0x4b')][_0xa80b('0x52')])||!_['isNil'](_0x665720['variable'][_0xa80b('0x53')])){utils[_0xa80b('0x7')](util[_0xa80b('0x8')](_0xa80b('0x50'),_0x665720[_0xa80b('0x9')],!_[_0xa80b('0x21')](_0x665720[_0xa80b('0x4b')][_0xa80b('0x52')])?'xmd-queue':_0xa80b('0x53'),_0x665720[_0xa80b('0x49')]));channels[_0x665720['uniqueid']][_0xa80b('0x54')]=_0xa80b('0x55');channels[_0x665720[_0xa80b('0x9')]][_0xa80b('0x56')]=_0x665720[_0xa80b('0x49')];channels[_0x665720[_0xa80b('0x9')]][_0xa80b('0xa')]=!![];}if(!_[_0xa80b('0x21')](_0x665720['variable'][_0xa80b('0x57')])){utils[_0xa80b('0x7')](util['format'](_0xa80b('0x58'),_0x665720[_0xa80b('0x9')],_0x665720['value']));channels[_0x665720['uniqueid']][_0xa80b('0x59')]=_0x665720['value'];}if(!_['isNil'](_0x665720[_0xa80b('0x4b')][_0xa80b('0x5a')])){utils['info'](util[_0xa80b('0x8')](_0xa80b('0x5b'),_0x665720['uniqueid'],_0x665720[_0xa80b('0x49')]));channels[_0x665720[_0xa80b('0x9')]][_0xa80b('0x5c')]=_0x665720[_0xa80b('0x49')];}if(!_[_0xa80b('0x21')](_0x665720[_0xa80b('0x4b')][_0xa80b('0x5d')])){utils[_0xa80b('0x7')](util[_0xa80b('0x8')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x665720[_0xa80b('0x9')],_0x665720[_0xa80b('0x49')]));channels[_0x665720[_0xa80b('0x9')]][_0xa80b('0x5e')]=_0x665720[_0xa80b('0x49')];}if(!_['isNil'](_0x665720[_0xa80b('0x4b')][_0xa80b('0x5f')])){utils[_0xa80b('0x7')](util[_0xa80b('0x8')](_0xa80b('0x60'),_0x665720[_0xa80b('0x9')],_0x665720[_0xa80b('0x49')]));channels[_0x665720['uniqueid']][_0xa80b('0x5f')]=_0x665720[_0xa80b('0x49')];}}}catch(_0x4a6634){utils['error'](util[_0xa80b('0x8')](_0xa80b('0x61'),_0x665720[_0xa80b('0x9')]),_0x4a6634);}};exports[_0xa80b('0x62')]=function(_0x143b65){try{if(!_[_0xa80b('0x21')](channels[_0x143b65[_0xa80b('0x9')]])){utils[_0xa80b('0x16')](util[_0xa80b('0x8')](_0xa80b('0x63'),_0x143b65['uniqueid']),_0x143b65);utils[_0xa80b('0x7')](util[_0xa80b('0x8')](_0xa80b('0x64'),_0x143b65['uniqueid'],_0x143b65[_0xa80b('0x65')],_0x143b65[_0xa80b('0x66')]));if(_0x143b65[_0xa80b('0x65')][_0xa80b('0x67')]()==_0xa80b('0x68')&&_[_0xa80b('0x69')](_0x143b65['appdata'][_0xa80b('0x67')](),_0xa80b('0x6a'))){var _0xb15891=_0x143b65[_0xa80b('0x66')][_0xa80b('0x6b')]('=');var _0x1177b6=_0xb15891[0x0][_0xa80b('0x6c')](_0xb15891[0x0][_0xa80b('0x6d')]('(')+0x1,_0xb15891[0x0]['lastIndexOf'](')'));var _0x1ab2fe=_0xb15891[0x1];channels[_0x143b65['uniqueid']][_0x1177b6]=_0x1ab2fe;}if(!_[_0xa80b('0x6e')](['hangup','noop','execif',_0xa80b('0x68'),'gotoif'],_0x143b65[_0xa80b('0x65')]['toLowerCase']())){channels[_0x143b65[_0xa80b('0x9')]][_0xa80b('0x54')]=_0x143b65['application'];channels[_0x143b65['uniqueid']]['lastdata']=_0x143b65['appdata'];}}}catch(_0x433338){utils[_0xa80b('0x1e')](util[_0xa80b('0x8')](_0xa80b('0x63'),_0x143b65[_0xa80b('0x9')]),_0x433338);}}; \ No newline at end of file +var _0xa650=['accountcode','then','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','destination','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','includes','noop','execif','gotoif','lastapplication','lastdata','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0xa650,0xc6));var _0x0a65=function(_0x545142,_0x2de163){_0x545142=_0x545142-0x0;var _0x4d6321=_0xa650[_0x545142];return _0x4d6321;};'use strict';var _=require('lodash');var util=require(_0x0a65('0x0'));var utils=require(_0x0a65('0x1'));var dispositions=['NO\x20ANSWER',_0x0a65('0x2'),_0x0a65('0x2'),_0x0a65('0x3'),_0x0a65('0x3'),_0x0a65('0x3'),_0x0a65('0x4'),_0x0a65('0x5'),_0x0a65('0x2'),'FAILED','FAILED'];var channels={};function writeDB(_0x1329dc){utils[_0x0a65('0x6')](util[_0x0a65('0x7')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1329dc[_0x0a65('0x8')],_0x1329dc[_0x0a65('0x9')],_0x1329dc[_0x0a65('0xa')],_0x1329dc[_0x0a65('0xb')],_0x1329dc[_0x0a65('0xc')],_0x1329dc[_0x0a65('0xd')],_0x1329dc[_0x0a65('0xe')],_0x1329dc[_0x0a65('0xf')]));if(_0x1329dc['accountcode']){utils['getUserByInternal'](_0x1329dc[_0x0a65('0x10')])[_0x0a65('0x11')](function(_0x3efb57){if(_0x3efb57){_0x1329dc['UserId']=_0x3efb57['id'];}utils[_0x0a65('0x12')](_0x0a65('0x13'),_0x1329dc);});}else{utils[_0x0a65('0x12')]('CreateVoiceCallReport',_0x1329dc);}if(channels[_0x1329dc[_0x0a65('0x8')]]){delete channels[_0x1329dc[_0x0a65('0x8')]];}}exports['newchannel']=function(_0x4d4505){try{utils[_0x0a65('0x14')](util[_0x0a65('0x7')](_0x0a65('0x15'),_0x4d4505[_0x0a65('0x8')]),_0x4d4505);if(_0x4d4505[_0x0a65('0x8')]==_0x4d4505[_0x0a65('0x16')]&&_0x4d4505[_0x0a65('0x9')]!='OutgoingSpoolFailed'){utils['info'](util[_0x0a65('0x7')](_0x0a65('0x17'),_0x4d4505[_0x0a65('0x8')],_0x4d4505[_0x0a65('0x18')],_0x4d4505[_0x0a65('0x19')]));channels[_0x4d4505[_0x0a65('0x8')]]={'uniqueid':_0x4d4505['uniqueid'],'accountcode':_0x4d4505[_0x0a65('0x10')],'source':_0x4d4505[_0x0a65('0xd')],'destination':_0x4d4505[_0x0a65('0x19')],'destinationcontext':_0x4d4505[_0x0a65('0x18')],'channel':_0x4d4505[_0x0a65('0x9')],'starttime':utils[_0x0a65('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x0a65('0x3'),'amaflags':_0x0a65('0x1b')};}}catch(_0xc2c2a4){utils[_0x0a65('0x1c')](util[_0x0a65('0x7')]('[%s][calls][newchannel]',_0x4d4505['uniqueid']),_0xc2c2a4);}};exports['newstate']=function(_0x3642b8){try{utils[_0x0a65('0x14')](util[_0x0a65('0x7')](_0x0a65('0x1d'),_0x3642b8['uniqueid']),_0x3642b8);if(!_['isNil'](channels[_0x3642b8[_0x0a65('0x8')]])&&_0x3642b8[_0x0a65('0x1e')]==0x6){utils[_0x0a65('0x6')](util[_0x0a65('0x7')](_0x0a65('0x1f'),_0x3642b8['uniqueid'],_0x3642b8[_0x0a65('0x18')],_0x3642b8[_0x0a65('0x9')]));if(_[_0x0a65('0x20')](channels[_0x3642b8[_0x0a65('0x8')]]['systemanswertime'])){channels[_0x3642b8['uniqueid']][_0x0a65('0x21')]=utils[_0x0a65('0x1a')]();}}else if(!_['isNil'](channels[_0x3642b8['linkedid']])&&_0x3642b8[_0x0a65('0x1e')]==0x6&&_0x3642b8[_0x0a65('0x18')]!=_0x0a65('0x22')){utils[_0x0a65('0x6')](util[_0x0a65('0x7')](_0x0a65('0x23'),_0x3642b8[_0x0a65('0x8')],_0x3642b8[_0x0a65('0x16')],_0x3642b8[_0x0a65('0x18')],_0x3642b8[_0x0a65('0x9')]));channels[_0x3642b8['linkedid']]['accountcode']=_0x3642b8[_0x0a65('0x10')];channels[_0x3642b8['linkedid']][_0x0a65('0x24')]=_0x3642b8[_0x0a65('0x9')];if(_[_0x0a65('0x20')](channels[_0x3642b8[_0x0a65('0x16')]][_0x0a65('0x25')])){channels[_0x3642b8[_0x0a65('0x16')]][_0x0a65('0x25')]=utils[_0x0a65('0x1a')]();}channels[_0x3642b8[_0x0a65('0x16')]][_0x0a65('0x26')]=dispositions[_[_0x0a65('0x27')](_0x3642b8[_0x0a65('0x1e')])]||_0x0a65('0x4');}}catch(_0x5e7479){utils[_0x0a65('0x1c')](util[_0x0a65('0x7')](_0x0a65('0x1d'),_0x3642b8[_0x0a65('0x8')]),_0x5e7479);}};exports[_0x0a65('0x28')]=function(_0x232406){try{if(!_['isNil'](channels[_0x232406[_0x0a65('0x8')]])){utils[_0x0a65('0x14')](util[_0x0a65('0x7')](_0x0a65('0x29'),_0x232406[_0x0a65('0x8')]),_0x232406);if(_[_0x0a65('0x20')](channels[_0x232406[_0x0a65('0x8')]]['callerid'])){channels[_0x232406[_0x0a65('0x8')]][_0x0a65('0x2a')]=_0x232406['calleridname']+'\x20<'+_0x232406[_0x0a65('0xd')]+'>';}utils[_0x0a65('0x6')](util[_0x0a65('0x7')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x232406['uniqueid'],channels[_0x232406[_0x0a65('0x8')]][_0x0a65('0x2a')],_0x232406[_0x0a65('0x2b')]));channels[_0x232406[_0x0a65('0x8')]][_0x0a65('0x2c')]=utils[_0x0a65('0x1a')]();channels[_0x232406[_0x0a65('0x8')]][_0x0a65('0x2d')]=utils[_0x0a65('0x2e')](channels[_0x232406[_0x0a65('0x8')]][_0x0a65('0x2c')],channels[_0x232406['uniqueid']][_0x0a65('0x2f')]);channels[_0x232406[_0x0a65('0x8')]][_0x0a65('0x30')]=channels[_0x232406['uniqueid']][_0x0a65('0x25')]?utils['diffTime'](channels[_0x232406[_0x0a65('0x8')]][_0x0a65('0x2c')],channels[_0x232406[_0x0a65('0x8')]][_0x0a65('0x25')]):0x0;writeDB(channels[_0x232406['uniqueid']]);}}catch(_0x52a1c5){utils[_0x0a65('0x1c')](util['format'](_0x0a65('0x29'),_0x232406[_0x0a65('0x8')]),_0x52a1c5);}};exports[_0x0a65('0x31')]=function(_0x40ce20){try{if(!_[_0x0a65('0x20')](channels[_0x40ce20[_0x0a65('0x32')]])){utils[_0x0a65('0x14')](util[_0x0a65('0x7')](_0x0a65('0x33'),_0x40ce20[_0x0a65('0x34')]),_0x40ce20);if(channels[_0x40ce20[_0x0a65('0x32')]][_0x0a65('0x9')]==_0x40ce20[_0x0a65('0x35')]){utils['info'](util[_0x0a65('0x7')](_0x0a65('0x36'),_0x40ce20[_0x0a65('0x34')],_0x40ce20[_0x0a65('0x32')],_0x40ce20[_0x0a65('0x37')]));channels[_0x40ce20['localtwolinkedid']][_0x0a65('0x24')]=_0x40ce20[_0x0a65('0x37')];channels[_0x40ce20[_0x0a65('0x32')]]['userfield']=_0x0a65('0x38');}else if(channels[_0x40ce20[_0x0a65('0x32')]][_0x0a65('0x9')]=_0x40ce20[_0x0a65('0x39')]){utils[_0x0a65('0x6')](util[_0x0a65('0x7')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x40ce20[_0x0a65('0x34')],_0x40ce20[_0x0a65('0x32')],_0x40ce20[_0x0a65('0x3a')]));channels[_0x40ce20['localtwolinkedid']][_0x0a65('0x24')]=_0x40ce20[_0x0a65('0x3a')];channels[_0x40ce20['localtwolinkedid']][_0x0a65('0x3b')]='_attended';}}}catch(_0x577367){utils['error'](util[_0x0a65('0x7')](_0x0a65('0x33'),_0x40ce20[_0x0a65('0x34')]),_0x577367);}};exports[_0x0a65('0x3c')]=function(_0x7e2e99){try{if(!_['isNil'](channels[_0x7e2e99['uniqueid']])){utils[_0x0a65('0x14')](util['format']('[%s][calls][musiconholdstart]',_0x7e2e99['uniqueid']),_0x7e2e99);channels[_0x7e2e99['uniqueid']]['musiconholdstartAt']=utils[_0x0a65('0x1a')]();utils[_0x0a65('0x6')](util[_0x0a65('0x7')](_0x0a65('0x3d'),_0x7e2e99[_0x0a65('0x8')],channels[_0x7e2e99[_0x0a65('0x8')]][_0x0a65('0x3e')]));}}catch(_0x450dc0){utils[_0x0a65('0x1c')](util[_0x0a65('0x7')](_0x0a65('0x3f'),_0x7e2e99['uniqueid']),_0x450dc0);}};exports[_0x0a65('0x40')]=function(_0x33e863){try{if(!_[_0x0a65('0x20')](channels[_0x33e863[_0x0a65('0x8')]])){utils[_0x0a65('0x14')](util[_0x0a65('0x7')]('[%s][calls][musiconholdstop]',_0x33e863[_0x0a65('0x8')]),_0x33e863);if(!_[_0x0a65('0x20')](channels[_0x33e863[_0x0a65('0x8')]][_0x0a65('0x3e')])){channels[_0x33e863[_0x0a65('0x8')]]['mohtime']+=utils[_0x0a65('0x2e')](utils[_0x0a65('0x1a')](),channels[_0x33e863[_0x0a65('0x8')]]['musiconholdstartAt']);utils[_0x0a65('0x6')](util[_0x0a65('0x7')](_0x0a65('0x41'),_0x33e863['uniqueid'],channels[_0x33e863['uniqueid']][_0x0a65('0x42')]));delete channels[_0x33e863['uniqueid']]['musiconholdstartAt'];}}}catch(_0x5440d3){utils[_0x0a65('0x1c')](util['format'](_0x0a65('0x43'),_0x33e863[_0x0a65('0x8')]),_0x5440d3);}};exports[_0x0a65('0x44')]=function(_0x211db6){try{if(!_[_0x0a65('0x20')](channels[_0x211db6[_0x0a65('0x8')]])){utils[_0x0a65('0x14')](util[_0x0a65('0x7')](_0x0a65('0x45'),_0x211db6[_0x0a65('0x8')]),_0x211db6);if(!_[_0x0a65('0x20')](_0x211db6[_0x0a65('0x46')][_0x0a65('0x47')])){utils[_0x0a65('0x6')](util['format'](_0x0a65('0x48'),_0x211db6[_0x0a65('0x8')],_0x211db6[_0x0a65('0x49')]));channels[_0x211db6[_0x0a65('0x8')]][_0x0a65('0x4a')]=_0x211db6[_0x0a65('0x49')];}if(!_[_0x0a65('0x20')](_0x211db6['variable'][_0x0a65('0x4b')])){utils[_0x0a65('0x6')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x211db6[_0x0a65('0x8')],_0x211db6['value']));channels[_0x211db6[_0x0a65('0x8')]][_0x0a65('0x4c')]=_0x211db6[_0x0a65('0x49')];channels[_0x211db6[_0x0a65('0x8')]]['callerid']='\x22'+_0x211db6[_0x0a65('0x49')]+'\x22\x20<'+_0x211db6[_0x0a65('0x49')]+'>';}if(!_['isNil'](_0x211db6[_0x0a65('0x46')]['xmd-callerid-preview'])||!_[_0x0a65('0x20')](_0x211db6[_0x0a65('0x46')][_0x0a65('0x4d')])){utils[_0x0a65('0x6')](util[_0x0a65('0x7')](_0x0a65('0x4e'),_0x211db6[_0x0a65('0x8')],!_[_0x0a65('0x20')](_0x211db6[_0x0a65('0x46')][_0x0a65('0x4f')])?_0x0a65('0x4f'):_0x0a65('0x4d'),_0x211db6[_0x0a65('0x49')]));channels[_0x211db6[_0x0a65('0x8')]][_0x0a65('0x2a')]=_0x211db6[_0x0a65('0x49')];}if(!_['isNil'](_0x211db6[_0x0a65('0x46')][_0x0a65('0x50')])||!_[_0x0a65('0x20')](_0x211db6[_0x0a65('0x46')][_0x0a65('0x51')])){utils[_0x0a65('0x6')](util[_0x0a65('0x7')](_0x0a65('0x4e'),_0x211db6[_0x0a65('0x8')],!_['isNil'](_0x211db6[_0x0a65('0x46')][_0x0a65('0x50')])?_0x0a65('0x50'):_0x0a65('0x51'),_0x211db6[_0x0a65('0x49')]));channels[_0x211db6[_0x0a65('0x8')]]['lastapplication']=_0x0a65('0x52');channels[_0x211db6['uniqueid']]['lastdata']=_0x211db6[_0x0a65('0x49')];channels[_0x211db6[_0x0a65('0x8')]][_0x0a65('0xa')]=!![];}if(!_[_0x0a65('0x20')](_0x211db6['variable'][_0x0a65('0x53')])){utils[_0x0a65('0x6')](util[_0x0a65('0x7')](_0x0a65('0x54'),_0x211db6[_0x0a65('0x8')],_0x211db6[_0x0a65('0x49')]));channels[_0x211db6[_0x0a65('0x8')]][_0x0a65('0x55')]=_0x211db6[_0x0a65('0x49')];}if(!_[_0x0a65('0x20')](_0x211db6['variable'][_0x0a65('0x56')])){utils[_0x0a65('0x6')](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x211db6[_0x0a65('0x8')],_0x211db6[_0x0a65('0x49')]));channels[_0x211db6['uniqueid']]['type']=_0x211db6[_0x0a65('0x49')];}if(!_[_0x0a65('0x20')](_0x211db6[_0x0a65('0x46')][_0x0a65('0x57')])){utils[_0x0a65('0x6')](util[_0x0a65('0x7')](_0x0a65('0x58'),_0x211db6[_0x0a65('0x8')],_0x211db6[_0x0a65('0x49')]));channels[_0x211db6[_0x0a65('0x8')]][_0x0a65('0x59')]=_0x211db6[_0x0a65('0x49')];}if(!_[_0x0a65('0x20')](_0x211db6[_0x0a65('0x46')][_0x0a65('0x5a')])){utils[_0x0a65('0x6')](util[_0x0a65('0x7')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x211db6[_0x0a65('0x8')],_0x211db6[_0x0a65('0x49')]));channels[_0x211db6[_0x0a65('0x8')]][_0x0a65('0x5a')]=_0x211db6[_0x0a65('0x49')];}}}catch(_0x3fc638){utils[_0x0a65('0x1c')](util[_0x0a65('0x7')](_0x0a65('0x45'),_0x211db6['uniqueid']),_0x3fc638);}};exports['newexten']=function(_0x447275){try{if(!_['isNil'](channels[_0x447275[_0x0a65('0x8')]])){utils[_0x0a65('0x14')](util['format'](_0x0a65('0x5b'),_0x447275[_0x0a65('0x8')]),_0x447275);utils[_0x0a65('0x6')](util['format'](_0x0a65('0x5c'),_0x447275[_0x0a65('0x8')],_0x447275[_0x0a65('0x5d')],_0x447275[_0x0a65('0x5e')]));if(_0x447275[_0x0a65('0x5d')][_0x0a65('0x5f')]()==_0x0a65('0x60')&&_[_0x0a65('0x61')](_0x447275[_0x0a65('0x5e')]['toLowerCase'](),_0x0a65('0x62'))){var _0x44ebb5=_0x447275[_0x0a65('0x5e')]['split']('=');var _0x55e700=_0x44ebb5[0x0][_0x0a65('0x63')](_0x44ebb5[0x0]['lastIndexOf']('(')+0x1,_0x44ebb5[0x0][_0x0a65('0x64')](')'));var _0xedca3b=_0x44ebb5[0x1];channels[_0x447275['uniqueid']][_0x55e700]=_0xedca3b;}if(!_[_0x0a65('0x65')]([_0x0a65('0x28'),_0x0a65('0x66'),_0x0a65('0x67'),_0x0a65('0x60'),_0x0a65('0x68')],_0x447275['application'][_0x0a65('0x5f')]())){channels[_0x447275[_0x0a65('0x8')]][_0x0a65('0x69')]=_0x447275['application'];channels[_0x447275[_0x0a65('0x8')]][_0x0a65('0x6a')]=_0x447275[_0x0a65('0x5e')];}}}catch(_0x21c56b){utils[_0x0a65('0x1c')](util['format'](_0x0a65('0x5b'),_0x447275[_0x0a65('0x8')]),_0x21c56b);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index c45070a..6d504a1 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 _0x0b0a=['close','[core]\x20close','managerevent','connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','[core]\x20error'];(function(_0x1d007b,_0x2948d8){var _0x12a361=function(_0x574d97){while(--_0x574d97){_0x1d007b['push'](_0x1d007b['shift']());}};_0x12a361(++_0x2948d8);}(_0x0b0a,0xb7));var _0xa0b0=function(_0x49d6ba,_0x3a04d2){_0x49d6ba=_0x49d6ba-0x0;var _0x21202b=_0x0b0a[_0x49d6ba];return _0x21202b;};'use strict';var utils=require('./utils');exports[_0xa0b0('0x0')]=function(){utils[_0xa0b0('0x1')](_0xa0b0('0x2'));};exports['shutdown']=function(){utils['info'](_0xa0b0('0x3'));};exports[_0xa0b0('0x4')]=function(){utils[_0xa0b0('0x1')](_0xa0b0('0x5'));};exports['error']=function(_0x236984){utils['error'](_0xa0b0('0x6'),_0x236984);};exports[_0xa0b0('0x7')]=function(){utils[_0xa0b0('0x1')](_0xa0b0('0x8'));};exports[_0xa0b0('0x9')]=function(_0x1b982d){}; \ No newline at end of file +var _0x01a8=['./utils','connect','info','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close'];(function(_0x1bfa44,_0x12fd98){var _0x3e1704=function(_0x5de5bb){while(--_0x5de5bb){_0x1bfa44['push'](_0x1bfa44['shift']());}};_0x3e1704(++_0x12fd98);}(_0x01a8,0x12c));var _0x801a=function(_0x1e96f0,_0x550bcf){_0x1e96f0=_0x1e96f0-0x0;var _0x53a7e6=_0x01a8[_0x1e96f0];return _0x53a7e6;};'use strict';var utils=require(_0x801a('0x0'));exports[_0x801a('0x1')]=function(){utils[_0x801a('0x2')]('[core]\x20connected');};exports[_0x801a('0x3')]=function(){utils[_0x801a('0x2')](_0x801a('0x4'));};exports[_0x801a('0x5')]=function(){utils[_0x801a('0x2')](_0x801a('0x6'));};exports[_0x801a('0x7')]=function(_0x7e5d05){utils[_0x801a('0x7')](_0x801a('0x8'),_0x7e5d05);};exports[_0x801a('0x9')]=function(){utils[_0x801a('0x2')]('[core]\x20close');};exports['managerevent']=function(_0x2349f5){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index df3313a..cadddd7 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 _0x5c75=['cdr(routeid)','split','error','varset','debug','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','now','lastevent','called','starttime','dialend','[%s][dials][dialend]','ANSWER','assign','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','duration','diffTime','endtime','holdtime','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','format','[%s][dials][newexten]','application','toLowerCase','set','startsWith','appdata'];(function(_0x1ab758,_0x3dbede){var _0x5788a0=function(_0x324d24){while(--_0x324d24){_0x1ab758['push'](_0x1ab758['shift']());}};_0x5788a0(++_0x3dbede);}(_0x5c75,0x1cf));var _0x55c7=function(_0x471d6a,_0x56e87c){_0x471d6a=_0x471d6a-0x0;var _0x5e837e=_0x5c75[_0x471d6a];return _0x5e837e;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x136ef2){utils[_0x55c7('0x0')](util['format'](_0x55c7('0x1'),_0x136ef2['uniqueid'],_0x136ef2[_0x55c7('0x2')],_0x136ef2[_0x55c7('0x3')],_0x136ef2[_0x55c7('0x4')],_0x136ef2[_0x55c7('0x5')],_0x136ef2[_0x55c7('0x6')]));utils[_0x55c7('0x7')](_0x55c7('0x8'),_0x136ef2);delete dials[_0x136ef2[_0x55c7('0x9')]];}exports['newexten']=function(_0x455f58){try{utils['debug'](util[_0x55c7('0xa')](_0x55c7('0xb'),_0x455f58[_0x55c7('0x9')]),_0x455f58);utils[_0x55c7('0x0')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x455f58['uniqueid'],_0x455f58[_0x55c7('0xc')],_0x455f58['appdata']));if(_0x455f58[_0x55c7('0xc')][_0x55c7('0xd')]()==_0x55c7('0xe')&&_[_0x55c7('0xf')](_0x455f58[_0x55c7('0x10')][_0x55c7('0xd')](),_0x55c7('0x11'))){var _0x2aee68=_0x455f58[_0x55c7('0x10')][_0x55c7('0x12')]('=');dials[_0x455f58[_0x55c7('0x9')]]={'routeId':_0x2aee68[0x1]};}}catch(_0x1ad7ee){utils[_0x55c7('0x13')](util[_0x55c7('0xa')]('[%s][dials][newexten]',_0x455f58['uniqueid']),_0x1ad7ee);}};exports[_0x55c7('0x14')]=function(_0x1a32e5){try{utils[_0x55c7('0x15')](util[_0x55c7('0xa')]('[%s][dials][varset]',_0x1a32e5[_0x55c7('0x9')]),_0x1a32e5);if(!_[_0x55c7('0x16')](_0x1a32e5[_0x55c7('0x17')][_0x55c7('0x18')])){utils['info'](util[_0x55c7('0xa')](_0x55c7('0x19'),_0x1a32e5[_0x55c7('0x9')],_0x1a32e5[_0x55c7('0x1a')]));dials[_0x1a32e5['uniqueid']]={'routeId':_0x1a32e5['value']};}}catch(_0x4f1d96){utils[_0x55c7('0x13')](util[_0x55c7('0xa')](_0x55c7('0x1b'),_0x1a32e5[_0x55c7('0x9')]),_0x4f1d96);}};exports[_0x55c7('0x1c')]=function(_0x362833){try{if(!_['isNil'](dials[_0x362833[_0x55c7('0x9')]])){utils[_0x55c7('0x15')](util[_0x55c7('0xa')](_0x55c7('0x1d'),_0x362833['uniqueid']),_0x362833);dials[_0x362833[_0x55c7('0x9')]]=_['assign'](dials[_0x362833[_0x55c7('0x9')]],_0x362833);dials[_0x362833['uniqueid']]['starttime']=utils[_0x55c7('0x1e')]();dials[_0x362833[_0x55c7('0x9')]][_0x55c7('0x1f')]=_0x55c7('0x20');utils[_0x55c7('0x0')](util[_0x55c7('0xa')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x362833['uniqueid'],dials[_0x362833['uniqueid']][_0x55c7('0x21')]));}}catch(_0x1de171){utils[_0x55c7('0x13')](util[_0x55c7('0xa')]('[%s][dials][dialbegin]',_0x362833[_0x55c7('0x9')]),_0x1de171);}};exports[_0x55c7('0x22')]=function(_0x2b24e3){try{if(!_[_0x55c7('0x16')](dials[_0x2b24e3[_0x55c7('0x9')]])){utils[_0x55c7('0x15')](util[_0x55c7('0xa')](_0x55c7('0x23'),_0x2b24e3[_0x55c7('0x9')]),_0x2b24e3);dials[_0x2b24e3[_0x55c7('0x9')]][_0x55c7('0x6')]=_0x2b24e3[_0x55c7('0x6')];if(_0x2b24e3['dialstatus']==_0x55c7('0x24')){dials[_0x2b24e3[_0x55c7('0x9')]]=_[_0x55c7('0x25')](dials[_0x2b24e3['uniqueid']],_0x2b24e3);dials[_0x2b24e3['uniqueid']]['answertime']=utils[_0x55c7('0x1e')]();dials[_0x2b24e3[_0x55c7('0x9')]][_0x55c7('0x1f')]=_0x55c7('0x26');utils['info'](util[_0x55c7('0xa')](_0x55c7('0x27'),_0x2b24e3[_0x55c7('0x9')],_0x2b24e3[_0x55c7('0x6')],dials[_0x2b24e3[_0x55c7('0x9')]][_0x55c7('0x28')]));}else{utils[_0x55c7('0x0')](util[_0x55c7('0xa')]('[%s][dials][dialend]\x20dialstatus:%s',_0x2b24e3[_0x55c7('0x9')],_0x2b24e3[_0x55c7('0x6')]));}}}catch(_0x2988b7){utils['error'](util[_0x55c7('0xa')]('[%s][dials][dialend]',_0x2b24e3[_0x55c7('0x9')]),_0x2988b7);}};exports['hangup']=function(_0x557d61){try{if(!_[_0x55c7('0x16')](dials[_0x557d61[_0x55c7('0x9')]])){utils[_0x55c7('0x15')](util[_0x55c7('0xa')](_0x55c7('0x29'),_0x557d61['uniqueid']),_0x557d61);utils[_0x55c7('0x0')](util[_0x55c7('0xa')](_0x55c7('0x2a'),_0x557d61[_0x55c7('0x9')],_0x557d61[_0x55c7('0x4')],_0x557d61['calleridname'],_0x557d61[_0x55c7('0x2b')]));dials[_0x557d61['uniqueid']]=_[_0x55c7('0x25')](dials[_0x557d61[_0x55c7('0x9')]],{'endtime':utils[_0x55c7('0x1e')](),'lastevent':'complete'});dials[_0x557d61[_0x55c7('0x9')]][_0x55c7('0x2c')]=utils[_0x55c7('0x2d')](dials[_0x557d61[_0x55c7('0x9')]][_0x55c7('0x2e')],dials[_0x557d61[_0x55c7('0x9')]][_0x55c7('0x21')]);dials[_0x557d61['uniqueid']][_0x55c7('0x2f')]=utils['diffTime'](dials[_0x557d61[_0x55c7('0x9')]][_0x55c7('0x28')]||dials[_0x557d61[_0x55c7('0x9')]][_0x55c7('0x2e')],dials[_0x557d61[_0x55c7('0x9')]][_0x55c7('0x21')]);dials[_0x557d61[_0x55c7('0x9')]]['billableseconds']=dials[_0x557d61[_0x55c7('0x9')]]['answertime']?utils[_0x55c7('0x2d')](dials[_0x557d61[_0x55c7('0x9')]][_0x55c7('0x2e')],dials[_0x557d61['uniqueid']][_0x55c7('0x28')]):0x0;writeDB(dials[_0x557d61['uniqueid']]);}}catch(_0x354e40){utils['error'](util[_0x55c7('0xa')](_0x55c7('0x29'),_0x557d61[_0x55c7('0x9')]),_0x354e40);}}; \ No newline at end of file +var _0xc5f7=['calleridnum','dialstatus','request','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','split','error','[%s][dials][varset]','variable','outboundrouteid','info','value','isNil','[%s][dials][dialbegin]','assign','starttime','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','./utils','format','uniqueid','channel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc5f7,0x85));var _0x7c5f=function(_0x8dd92f,_0x4600db){_0x8dd92f=_0x8dd92f-0x0;var _0x5e3347=_0xc5f7[_0x8dd92f];return _0x5e3347;};'use strict';var _=require(_0x7c5f('0x0'));var util=require('util');var utils=require(_0x7c5f('0x1'));var dials={};function writeDB(_0x336e43){utils['info'](util[_0x7c5f('0x2')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x336e43[_0x7c5f('0x3')],_0x336e43[_0x7c5f('0x4')],_0x336e43['dialstring'],_0x336e43[_0x7c5f('0x5')],_0x336e43['connectedlinenum'],_0x336e43[_0x7c5f('0x6')]));utils[_0x7c5f('0x7')]('CreateVoiceDialReport',_0x336e43);delete dials[_0x336e43[_0x7c5f('0x3')]];}exports[_0x7c5f('0x8')]=function(_0x4b8036){try{utils[_0x7c5f('0x9')](util['format'](_0x7c5f('0xa'),_0x4b8036[_0x7c5f('0x3')]),_0x4b8036);utils['info'](util[_0x7c5f('0x2')](_0x7c5f('0xb'),_0x4b8036['uniqueid'],_0x4b8036[_0x7c5f('0xc')],_0x4b8036[_0x7c5f('0xd')]));if(_0x4b8036[_0x7c5f('0xc')][_0x7c5f('0xe')]()==_0x7c5f('0xf')&&_['startsWith'](_0x4b8036[_0x7c5f('0xd')][_0x7c5f('0xe')](),'cdr(routeid)')){var _0x1af875=_0x4b8036['appdata'][_0x7c5f('0x10')]('=');dials[_0x4b8036[_0x7c5f('0x3')]]={'routeId':_0x1af875[0x1]};}}catch(_0x3fd4df){utils[_0x7c5f('0x11')](util[_0x7c5f('0x2')](_0x7c5f('0xa'),_0x4b8036['uniqueid']),_0x3fd4df);}};exports['varset']=function(_0x312748){try{utils[_0x7c5f('0x9')](util[_0x7c5f('0x2')](_0x7c5f('0x12'),_0x312748[_0x7c5f('0x3')]),_0x312748);if(!_['isNil'](_0x312748[_0x7c5f('0x13')][_0x7c5f('0x14')])){utils[_0x7c5f('0x15')](util[_0x7c5f('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x312748[_0x7c5f('0x3')],_0x312748[_0x7c5f('0x16')]));dials[_0x312748[_0x7c5f('0x3')]]={'routeId':_0x312748[_0x7c5f('0x16')]};}}catch(_0x6be2d2){utils['error'](util[_0x7c5f('0x2')](_0x7c5f('0x12'),_0x312748[_0x7c5f('0x3')]),_0x6be2d2);}};exports['dialbegin']=function(_0x30b346){try{if(!_[_0x7c5f('0x17')](dials[_0x30b346[_0x7c5f('0x3')]])){utils[_0x7c5f('0x9')](util[_0x7c5f('0x2')](_0x7c5f('0x18'),_0x30b346[_0x7c5f('0x3')]),_0x30b346);dials[_0x30b346[_0x7c5f('0x3')]]=_[_0x7c5f('0x19')](dials[_0x30b346['uniqueid']],_0x30b346);dials[_0x30b346[_0x7c5f('0x3')]][_0x7c5f('0x1a')]=utils[_0x7c5f('0x1b')]();dials[_0x30b346[_0x7c5f('0x3')]]['lastevent']=_0x7c5f('0x1c');utils[_0x7c5f('0x15')](util[_0x7c5f('0x2')](_0x7c5f('0x1d'),_0x30b346[_0x7c5f('0x3')],dials[_0x30b346['uniqueid']][_0x7c5f('0x1a')]));}}catch(_0x2a9fbf){utils['error'](util['format'](_0x7c5f('0x18'),_0x30b346[_0x7c5f('0x3')]),_0x2a9fbf);}};exports['dialend']=function(_0x4f65e3){try{if(!_['isNil'](dials[_0x4f65e3[_0x7c5f('0x3')]])){utils['debug'](util[_0x7c5f('0x2')]('[%s][dials][dialend]',_0x4f65e3['uniqueid']),_0x4f65e3);dials[_0x4f65e3[_0x7c5f('0x3')]][_0x7c5f('0x6')]=_0x4f65e3[_0x7c5f('0x6')];if(_0x4f65e3[_0x7c5f('0x6')]==_0x7c5f('0x1e')){dials[_0x4f65e3[_0x7c5f('0x3')]]=_['assign'](dials[_0x4f65e3[_0x7c5f('0x3')]],_0x4f65e3);dials[_0x4f65e3[_0x7c5f('0x3')]][_0x7c5f('0x1f')]=utils[_0x7c5f('0x1b')]();dials[_0x4f65e3[_0x7c5f('0x3')]]['lastevent']=_0x7c5f('0x20');utils[_0x7c5f('0x15')](util['format'](_0x7c5f('0x21'),_0x4f65e3[_0x7c5f('0x3')],_0x4f65e3[_0x7c5f('0x6')],dials[_0x4f65e3['uniqueid']][_0x7c5f('0x1f')]));}else{utils[_0x7c5f('0x15')](util[_0x7c5f('0x2')](_0x7c5f('0x22'),_0x4f65e3[_0x7c5f('0x3')],_0x4f65e3[_0x7c5f('0x6')]));}}}catch(_0x1756b2){utils['error'](util[_0x7c5f('0x2')](_0x7c5f('0x23'),_0x4f65e3[_0x7c5f('0x3')]),_0x1756b2);}};exports['hangup']=function(_0x501864){try{if(!_['isNil'](dials[_0x501864['uniqueid']])){utils[_0x7c5f('0x9')](util['format'](_0x7c5f('0x24'),_0x501864[_0x7c5f('0x3')]),_0x501864);utils[_0x7c5f('0x15')](util[_0x7c5f('0x2')](_0x7c5f('0x25'),_0x501864['uniqueid'],_0x501864[_0x7c5f('0x5')],_0x501864[_0x7c5f('0x26')],_0x501864[_0x7c5f('0x27')]));dials[_0x501864['uniqueid']]=_[_0x7c5f('0x19')](dials[_0x501864[_0x7c5f('0x3')]],{'endtime':utils[_0x7c5f('0x1b')](),'lastevent':_0x7c5f('0x28')});dials[_0x501864['uniqueid']][_0x7c5f('0x29')]=utils[_0x7c5f('0x2a')](dials[_0x501864[_0x7c5f('0x3')]][_0x7c5f('0x2b')],dials[_0x501864[_0x7c5f('0x3')]][_0x7c5f('0x1a')]);dials[_0x501864[_0x7c5f('0x3')]][_0x7c5f('0x2c')]=utils[_0x7c5f('0x2a')](dials[_0x501864[_0x7c5f('0x3')]][_0x7c5f('0x1f')]||dials[_0x501864['uniqueid']][_0x7c5f('0x2b')],dials[_0x501864['uniqueid']]['starttime']);dials[_0x501864[_0x7c5f('0x3')]][_0x7c5f('0x2d')]=dials[_0x501864[_0x7c5f('0x3')]][_0x7c5f('0x1f')]?utils[_0x7c5f('0x2a')](dials[_0x501864['uniqueid']]['endtime'],dials[_0x501864['uniqueid']][_0x7c5f('0x1f')]):0x0;writeDB(dials[_0x501864[_0x7c5f('0x3')]]);}}catch(_0x546eb9){utils[_0x7c5f('0x11')](util['format'](_0x7c5f('0x24'),_0x501864[_0x7c5f('0x3')]),_0x546eb9);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 469aeff..270ccb3 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 _0x57ee=['[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%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','xdr','disabled','production','local','port','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./recordings.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','[%s][index][agentcalled]','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x57ee,0xae));var _0xe57e=function(_0xbf6058,_0x15e9e7){_0xbf6058=_0xbf6058-0x0;var _0x558be9=_0x57ee[_0xbf6058];return _0x558be9;};var AsteriskManager=require(_0xe57e('0x0'));var config=require(_0xe57e('0x1'));var utils=require(_0xe57e('0x2'));var util=require('util');var isXDREnabled=config[_0xe57e('0x3')]&&config[_0xe57e('0x3')]['disabled']?!config['xdr'][_0xe57e('0x4')]:!![];var isProduction=config['env']===_0xe57e('0x5')||![];var isLocalAsterisk=config[_0xe57e('0x3')]&&config['xdr'][_0xe57e('0x6')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0xe57e('0x7')],config['asterisk']['ip'],config['asterisk'][_0xe57e('0x8')],config['asterisk'][_0xe57e('0x9')],!![]);ami[_0xe57e('0xa')]();if(!isXDREnabled){utils[_0xe57e('0xb')](_0xe57e('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xe57e('0xb')](_0xe57e('0xd'));}else{var agents=require(_0xe57e('0xe'));var calls=require(_0xe57e('0xf'));var queues=require('./queues.controller');var recordings=require(_0xe57e('0x10'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0xe57e('0x11'));var core=require(_0xe57e('0x12'));ami['on'](_0xe57e('0x13'),core[_0xe57e('0x13')]);ami['on'](_0xe57e('0x14'),core[_0xe57e('0x14')]);ami['on'](_0xe57e('0x15'),core['fullybooted']);ami['on'](_0xe57e('0x16'),core['error']);ami['on'](_0xe57e('0x17'),core[_0xe57e('0x17')]);ami['on'](_0xe57e('0x18'),core['managerevent']);ami['on'](_0xe57e('0x19'),function(_0x267ca4){try{utils[_0xe57e('0x1a')](util['format'](_0xe57e('0x1b'),_0x267ca4[_0xe57e('0x1c')]),_0x267ca4);members[_0xe57e('0x19')](_0x267ca4);}catch(_0x15b75a){utils['error'](util[_0xe57e('0x1d')](_0xe57e('0x1b'),_0x267ca4[_0xe57e('0x1c')]),_0x15b75a);}});ami['on']('agentcalled',function(_0x5426c8){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')](_0xe57e('0x1e'),_0x5426c8['uniqueid']),_0x5426c8);agents[_0xe57e('0x1f')](_0x5426c8);}catch(_0x4f8f3e){utils[_0xe57e('0x16')](util[_0xe57e('0x1d')](_0xe57e('0x1e'),_0x5426c8['uniqueid']),_0x4f8f3e);}});ami['on']('agentringnoanswer',function(_0x29daf7){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')]('[%s][index][agentringnoanswer]',_0x29daf7[_0xe57e('0x20')]),_0x29daf7);agents[_0xe57e('0x21')](_0x29daf7);}catch(_0x527559){utils[_0xe57e('0x16')](util[_0xe57e('0x1d')](_0xe57e('0x22'),_0x29daf7[_0xe57e('0x20')]),_0x527559);}});ami['on'](_0xe57e('0x23'),function(_0x56bdc0){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')](_0xe57e('0x24'),_0x56bdc0[_0xe57e('0x20')]),_0x56bdc0);agents[_0xe57e('0x23')](_0x56bdc0);queues[_0xe57e('0x23')](_0x56bdc0);}catch(_0x390b17){utils['error'](util[_0xe57e('0x1d')](_0xe57e('0x24'),_0x56bdc0[_0xe57e('0x20')]),_0x390b17);}});ami['on'](_0xe57e('0x25'),function(_0x1ca4af){try{utils[_0xe57e('0x1a')](util['format'](_0xe57e('0x26'),_0x1ca4af[_0xe57e('0x20')]),_0x1ca4af);agents[_0xe57e('0x25')](_0x1ca4af);queues[_0xe57e('0x25')](_0x1ca4af);members['agentcomplete'](_0x1ca4af);}catch(_0x383308){utils[_0xe57e('0x16')](util[_0xe57e('0x1d')]('[%s][index][agentcomplete]',_0x1ca4af[_0xe57e('0x20')]),_0x383308);}});ami['on'](_0xe57e('0x27'),function(_0x4cd790){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')](_0xe57e('0x28'),_0x4cd790[_0xe57e('0x20')]),_0x4cd790);agents[_0xe57e('0x27')](_0x4cd790);queues['queuecallerabandon'](_0x4cd790);}catch(_0x101b76){utils[_0xe57e('0x16')](util['format']('[%s][index][queuecallerabandon]',_0x4cd790[_0xe57e('0x20')]),_0x101b76);}});ami['on']('queuecallerjoin',function(_0x1c722a){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')](_0xe57e('0x29'),_0x1c722a[_0xe57e('0x20')]),_0x1c722a);queues[_0xe57e('0x2a')](_0x1c722a);recordings[_0xe57e('0x2a')](_0x1c722a);}catch(_0x3274f4){utils[_0xe57e('0x16')](util[_0xe57e('0x1d')]('[%s][index][queuecallerjoin]',_0x1c722a[_0xe57e('0x20')]),_0x3274f4);}});ami['on'](_0xe57e('0x2b'),function(_0x551f9b){try{utils['debug'](util[_0xe57e('0x1d')]('[%s][index][queuecallerleave]',_0x551f9b[_0xe57e('0x20')]),_0x551f9b);queues['queuecallerleave'](_0x551f9b);}catch(_0x37d11d){utils[_0xe57e('0x16')](util[_0xe57e('0x1d')](_0xe57e('0x2c'),_0x551f9b[_0xe57e('0x20')]),_0x37d11d);}});ami['on'](_0xe57e('0x2d'),function(_0x43f285){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')](_0xe57e('0x2e'),_0x43f285[_0xe57e('0x20')]),_0x43f285);queues[_0xe57e('0x2d')](_0x43f285);calls['musiconholdstart'](_0x43f285);}catch(_0x201e10){utils[_0xe57e('0x16')](util[_0xe57e('0x1d')](_0xe57e('0x2e'),_0x43f285[_0xe57e('0x20')]),_0x201e10);}});ami['on']('musiconholdstop',function(_0x51fbc6){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')](_0xe57e('0x2f'),_0x51fbc6['uniqueid']),_0x51fbc6);queues['musiconholdstop'](_0x51fbc6);calls[_0xe57e('0x30')](_0x51fbc6);}catch(_0x2de4f5){utils[_0xe57e('0x16')](util[_0xe57e('0x1d')](_0xe57e('0x2f'),_0x51fbc6[_0xe57e('0x20')]),_0x2de4f5);}});ami['on'](_0xe57e('0x31'),function(_0x13b3ca){try{utils[_0xe57e('0x1a')](util['format'](_0xe57e('0x32'),_0x13b3ca[_0xe57e('0x20')]),_0x13b3ca);calls[_0xe57e('0x31')](_0x13b3ca);recordings[_0xe57e('0x31')](_0x13b3ca);}catch(_0x574fd1){utils[_0xe57e('0x16')](util[_0xe57e('0x1d')](_0xe57e('0x32'),_0x13b3ca[_0xe57e('0x20')]),_0x574fd1);}});ami['on'](_0xe57e('0x33'),function(_0x12d3be){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')](_0xe57e('0x34'),_0x12d3be['uniqueid']),_0x12d3be);calls['hangup'](_0x12d3be);recordings['hangup'](_0x12d3be);dials['hangup'](_0x12d3be);agents[_0xe57e('0x33')](_0x12d3be);queues['hangup'](_0x12d3be);}catch(_0x1cc9e2){utils[_0xe57e('0x16')](util['format'](_0xe57e('0x34'),_0x12d3be[_0xe57e('0x20')]),_0x1cc9e2);}});ami['on'](_0xe57e('0x35'),function(_0x24fde1){try{utils['debug'](util[_0xe57e('0x1d')](_0xe57e('0x36'),_0x24fde1['uniqueid']),_0x24fde1);members[_0xe57e('0x35')](_0x24fde1);}catch(_0x76438f){utils[_0xe57e('0x16')](util[_0xe57e('0x1d')](_0xe57e('0x36'),_0x24fde1[_0xe57e('0x20')]),_0x76438f);}});ami['on']('blindtransfer',function(_0x58aba9){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')]('[%s][index][blindtransfer]',_0x58aba9[_0xe57e('0x20')]),_0x58aba9);queues['blindtransfer'](_0x58aba9);agents[_0xe57e('0x37')](_0x58aba9);transfers[_0xe57e('0x37')](_0x58aba9);}catch(_0xeea9da){utils[_0xe57e('0x16')](util['format']('[%s][index][blindtransfer]',_0x58aba9['uniqueid']),_0xeea9da);}});ami['on'](_0xe57e('0x38'),function(_0x513f5b){try{utils[_0xe57e('0x1a')](util['format'](_0xe57e('0x39'),_0x513f5b[_0xe57e('0x3a')]),_0x513f5b);queues[_0xe57e('0x38')](_0x513f5b);transfers['attendedtransfer'](_0x513f5b);agents[_0xe57e('0x38')](_0x513f5b);calls[_0xe57e('0x38')](_0x513f5b);}catch(_0x27bb3f){utils['error'](util['format'](_0xe57e('0x39'),_0x513f5b['origtransfereruniqueid']),_0x27bb3f);}});ami['on']('varset',function(_0x1b91a9){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')](_0xe57e('0x3b'),_0x1b91a9[_0xe57e('0x20')]),_0x1b91a9);queues[_0xe57e('0x3c')](_0x1b91a9);recordings['varset'](_0x1b91a9);calls[_0xe57e('0x3c')](_0x1b91a9);dials['varset'](_0x1b91a9);}catch(_0x25c58f){utils[_0xe57e('0x16')](util[_0xe57e('0x1d')](_0xe57e('0x3b'),_0x1b91a9[_0xe57e('0x20')]),_0x25c58f);}});ami['on'](_0xe57e('0x3d'),function(_0x2e952f){try{utils[_0xe57e('0x1a')](util['format'](_0xe57e('0x3e'),_0x2e952f['uniqueid']),_0x2e952f);calls[_0xe57e('0x3d')](_0x2e952f);recordings[_0xe57e('0x3d')](_0x2e952f);dials['newexten'](_0x2e952f);}catch(_0x3b270a){utils['error'](util['format']('[%s][index][newexten]',_0x2e952f[_0xe57e('0x20')]),_0x3b270a);}});ami['on'](_0xe57e('0x3f'),function(_0x505828){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')](_0xe57e('0x40'),_0x505828[_0xe57e('0x20')]),_0x505828);calls[_0xe57e('0x3f')](_0x505828);recordings['newchannel'](_0x505828);}catch(_0x3dbb7e){utils[_0xe57e('0x16')](util[_0xe57e('0x1d')]('[%s][index][newchannel]',_0x505828['uniqueid']),_0x3dbb7e);}});ami['on'](_0xe57e('0x41'),function(_0x25bdb7){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')](_0xe57e('0x42'),_0x25bdb7[_0xe57e('0x20')]),_0x25bdb7);dials['dialbegin'](_0x25bdb7);}catch(_0x787ec3){utils['error'](util[_0xe57e('0x1d')](_0xe57e('0x43'),_0x25bdb7[_0xe57e('0x20')]),_0x787ec3);}});ami['on'](_0xe57e('0x44'),function(_0x5df58d){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')](_0xe57e('0x45'),_0x5df58d[_0xe57e('0x20')]),_0x5df58d);dials[_0xe57e('0x44')](_0x5df58d);}catch(_0x139b8c){utils['error'](util[_0xe57e('0x1d')]('[%s][index][dialend]',_0x5df58d[_0xe57e('0x20')]),_0x139b8c);}});} \ No newline at end of file +var _0x95a6=['agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','disabled','production','local','asterisk','port','username','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./recordings.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x95a6,0xe5));var _0x695a=function(_0x34d1aa,_0x2e1799){_0x34d1aa=_0x34d1aa-0x0;var _0x11e755=_0x95a6[_0x34d1aa];return _0x11e755;};var AsteriskManager=require(_0x695a('0x0'));var config=require(_0x695a('0x1'));var utils=require('./utils');var util=require(_0x695a('0x2'));var isXDREnabled=config[_0x695a('0x3')]&&config[_0x695a('0x3')][_0x695a('0x4')]?!config[_0x695a('0x3')]['disabled']:!![];var isProduction=config['env']===_0x695a('0x5')||![];var isLocalAsterisk=config[_0x695a('0x3')]&&config[_0x695a('0x3')][_0x695a('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x695a('0x7')][_0x695a('0x8')],config[_0x695a('0x7')]['ip'],config[_0x695a('0x7')][_0x695a('0x9')],config['asterisk']['password'],!![]);ami[_0x695a('0xa')]();if(!isXDREnabled){utils[_0x695a('0xb')](_0x695a('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x695a('0xb')](_0x695a('0xd'));}else{var agents=require('./agents.controller');var calls=require(_0x695a('0xe'));var queues=require(_0x695a('0xf'));var recordings=require(_0x695a('0x10'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0x695a('0x11'));var core=require(_0x695a('0x12'));ami['on'](_0x695a('0x13'),core[_0x695a('0x13')]);ami['on'](_0x695a('0x14'),core[_0x695a('0x14')]);ami['on'](_0x695a('0x15'),core[_0x695a('0x15')]);ami['on'](_0x695a('0x16'),core['error']);ami['on'](_0x695a('0x17'),core[_0x695a('0x17')]);ami['on'](_0x695a('0x18'),core[_0x695a('0x18')]);ami['on'](_0x695a('0x19'),function(_0x3cc809){try{utils[_0x695a('0x1a')](util[_0x695a('0x1b')](_0x695a('0x1c'),_0x3cc809[_0x695a('0x1d')]),_0x3cc809);members['devicestatechange'](_0x3cc809);}catch(_0x55e140){utils[_0x695a('0x16')](util[_0x695a('0x1b')](_0x695a('0x1c'),_0x3cc809[_0x695a('0x1d')]),_0x55e140);}});ami['on'](_0x695a('0x1e'),function(_0xbf8745){try{utils[_0x695a('0x1a')](util[_0x695a('0x1b')]('[%s][index][agentcalled]',_0xbf8745['uniqueid']),_0xbf8745);agents['agentcalled'](_0xbf8745);}catch(_0x559ab9){utils['error'](util['format']('[%s][index][agentcalled]',_0xbf8745[_0x695a('0x1f')]),_0x559ab9);}});ami['on'](_0x695a('0x20'),function(_0xadb47c){try{utils[_0x695a('0x1a')](util[_0x695a('0x1b')](_0x695a('0x21'),_0xadb47c['uniqueid']),_0xadb47c);agents[_0x695a('0x20')](_0xadb47c);}catch(_0x360d6e){utils[_0x695a('0x16')](util['format'](_0x695a('0x21'),_0xadb47c[_0x695a('0x1f')]),_0x360d6e);}});ami['on']('agentconnect',function(_0x301b9c){try{utils[_0x695a('0x1a')](util[_0x695a('0x1b')]('[%s][index][agentconnect]',_0x301b9c[_0x695a('0x1f')]),_0x301b9c);agents[_0x695a('0x22')](_0x301b9c);queues[_0x695a('0x22')](_0x301b9c);}catch(_0x12f5a6){utils[_0x695a('0x16')](util['format']('[%s][index][agentconnect]',_0x301b9c['uniqueid']),_0x12f5a6);}});ami['on'](_0x695a('0x23'),function(_0x149dbb){try{utils[_0x695a('0x1a')](util['format'](_0x695a('0x24'),_0x149dbb[_0x695a('0x1f')]),_0x149dbb);agents['agentcomplete'](_0x149dbb);queues[_0x695a('0x23')](_0x149dbb);members[_0x695a('0x23')](_0x149dbb);}catch(_0x3e21d9){utils['error'](util['format'](_0x695a('0x24'),_0x149dbb[_0x695a('0x1f')]),_0x3e21d9);}});ami['on'](_0x695a('0x25'),function(_0x2545ce){try{utils[_0x695a('0x1a')](util[_0x695a('0x1b')](_0x695a('0x26'),_0x2545ce[_0x695a('0x1f')]),_0x2545ce);agents[_0x695a('0x25')](_0x2545ce);queues['queuecallerabandon'](_0x2545ce);}catch(_0x32cb05){utils['error'](util[_0x695a('0x1b')](_0x695a('0x26'),_0x2545ce[_0x695a('0x1f')]),_0x32cb05);}});ami['on'](_0x695a('0x27'),function(_0x3e56f0){try{utils[_0x695a('0x1a')](util['format']('[%s][index][queuecallerjoin]',_0x3e56f0[_0x695a('0x1f')]),_0x3e56f0);queues['queuecallerjoin'](_0x3e56f0);recordings[_0x695a('0x27')](_0x3e56f0);}catch(_0xc0677){utils[_0x695a('0x16')](util[_0x695a('0x1b')]('[%s][index][queuecallerjoin]',_0x3e56f0[_0x695a('0x1f')]),_0xc0677);}});ami['on'](_0x695a('0x28'),function(_0x5c443b){try{utils[_0x695a('0x1a')](util[_0x695a('0x1b')](_0x695a('0x29'),_0x5c443b['uniqueid']),_0x5c443b);queues[_0x695a('0x28')](_0x5c443b);}catch(_0x392dab){utils[_0x695a('0x16')](util[_0x695a('0x1b')](_0x695a('0x29'),_0x5c443b[_0x695a('0x1f')]),_0x392dab);}});ami['on'](_0x695a('0x2a'),function(_0x561043){try{utils[_0x695a('0x1a')](util[_0x695a('0x1b')](_0x695a('0x2b'),_0x561043['uniqueid']),_0x561043);queues[_0x695a('0x2a')](_0x561043);calls[_0x695a('0x2a')](_0x561043);}catch(_0x166360){utils[_0x695a('0x16')](util[_0x695a('0x1b')]('[%s][index][musiconholdstart]',_0x561043[_0x695a('0x1f')]),_0x166360);}});ami['on']('musiconholdstop',function(_0x49994c){try{utils[_0x695a('0x1a')](util[_0x695a('0x1b')](_0x695a('0x2c'),_0x49994c[_0x695a('0x1f')]),_0x49994c);queues[_0x695a('0x2d')](_0x49994c);calls[_0x695a('0x2d')](_0x49994c);}catch(_0xb64e93){utils[_0x695a('0x16')](util[_0x695a('0x1b')]('[%s][index][musiconholdstop]',_0x49994c[_0x695a('0x1f')]),_0xb64e93);}});ami['on'](_0x695a('0x2e'),function(_0x46fe0f){try{utils[_0x695a('0x1a')](util[_0x695a('0x1b')](_0x695a('0x2f'),_0x46fe0f[_0x695a('0x1f')]),_0x46fe0f);calls['newstate'](_0x46fe0f);recordings[_0x695a('0x2e')](_0x46fe0f);}catch(_0x143f00){utils[_0x695a('0x16')](util[_0x695a('0x1b')](_0x695a('0x2f'),_0x46fe0f[_0x695a('0x1f')]),_0x143f00);}});ami['on']('hangup',function(_0x4c05e1){try{utils[_0x695a('0x1a')](util[_0x695a('0x1b')]('[%s][index][hangup]',_0x4c05e1[_0x695a('0x1f')]),_0x4c05e1);calls[_0x695a('0x30')](_0x4c05e1);recordings[_0x695a('0x30')](_0x4c05e1);dials['hangup'](_0x4c05e1);agents[_0x695a('0x30')](_0x4c05e1);queues[_0x695a('0x30')](_0x4c05e1);}catch(_0x333dfc){utils[_0x695a('0x16')](util[_0x695a('0x1b')](_0x695a('0x31'),_0x4c05e1[_0x695a('0x1f')]),_0x333dfc);}});ami['on'](_0x695a('0x32'),function(_0x501899){try{utils[_0x695a('0x1a')](util[_0x695a('0x1b')](_0x695a('0x33'),_0x501899[_0x695a('0x1f')]),_0x501899);members['cdr'](_0x501899);}catch(_0x236974){utils[_0x695a('0x16')](util[_0x695a('0x1b')](_0x695a('0x33'),_0x501899[_0x695a('0x1f')]),_0x236974);}});ami['on'](_0x695a('0x34'),function(_0x13bd57){try{utils[_0x695a('0x1a')](util['format'](_0x695a('0x35'),_0x13bd57[_0x695a('0x1f')]),_0x13bd57);queues[_0x695a('0x34')](_0x13bd57);agents[_0x695a('0x34')](_0x13bd57);transfers[_0x695a('0x34')](_0x13bd57);}catch(_0x189a79){utils[_0x695a('0x16')](util['format'](_0x695a('0x35'),_0x13bd57[_0x695a('0x1f')]),_0x189a79);}});ami['on'](_0x695a('0x36'),function(_0x5d55b6){try{utils['debug'](util[_0x695a('0x1b')](_0x695a('0x37'),_0x5d55b6[_0x695a('0x38')]),_0x5d55b6);queues[_0x695a('0x36')](_0x5d55b6);transfers[_0x695a('0x36')](_0x5d55b6);agents[_0x695a('0x36')](_0x5d55b6);calls[_0x695a('0x36')](_0x5d55b6);}catch(_0x367440){utils[_0x695a('0x16')](util[_0x695a('0x1b')](_0x695a('0x37'),_0x5d55b6[_0x695a('0x38')]),_0x367440);}});ami['on'](_0x695a('0x39'),function(_0x5cd114){try{utils[_0x695a('0x1a')](util['format'](_0x695a('0x3a'),_0x5cd114[_0x695a('0x1f')]),_0x5cd114);queues[_0x695a('0x39')](_0x5cd114);recordings[_0x695a('0x39')](_0x5cd114);calls['varset'](_0x5cd114);dials['varset'](_0x5cd114);}catch(_0x4ffaea){utils[_0x695a('0x16')](util[_0x695a('0x1b')]('[%s][index][varset]',_0x5cd114[_0x695a('0x1f')]),_0x4ffaea);}});ami['on'](_0x695a('0x3b'),function(_0x3ca515){try{utils[_0x695a('0x1a')](util[_0x695a('0x1b')]('[%s][index][newexten]',_0x3ca515[_0x695a('0x1f')]),_0x3ca515);calls[_0x695a('0x3b')](_0x3ca515);recordings[_0x695a('0x3b')](_0x3ca515);dials[_0x695a('0x3b')](_0x3ca515);}catch(_0x448ae0){utils[_0x695a('0x16')](util[_0x695a('0x1b')]('[%s][index][newexten]',_0x3ca515[_0x695a('0x1f')]),_0x448ae0);}});ami['on'](_0x695a('0x3c'),function(_0x40e6c9){try{utils[_0x695a('0x1a')](util[_0x695a('0x1b')](_0x695a('0x3d'),_0x40e6c9['uniqueid']),_0x40e6c9);calls['newchannel'](_0x40e6c9);recordings[_0x695a('0x3c')](_0x40e6c9);}catch(_0x975685){utils['error'](util[_0x695a('0x1b')](_0x695a('0x3d'),_0x40e6c9[_0x695a('0x1f')]),_0x975685);}});ami['on'](_0x695a('0x3e'),function(_0x4643d6){try{utils[_0x695a('0x1a')](util[_0x695a('0x1b')](_0x695a('0x3f'),_0x4643d6[_0x695a('0x1f')]),_0x4643d6);dials['dialbegin'](_0x4643d6);}catch(_0x1ef089){utils[_0x695a('0x16')](util['format']('[%s]dialbegin',_0x4643d6['uniqueid']),_0x1ef089);}});ami['on'](_0x695a('0x40'),function(_0x3bbbca){try{utils[_0x695a('0x1a')](util[_0x695a('0x1b')]('[%s][index][dialend]',_0x3bbbca[_0x695a('0x1f')]),_0x3bbbca);dials[_0x695a('0x40')](_0x3bbbca);}catch(_0xf5fdc3){utils[_0x695a('0x16')](util[_0x695a('0x1b')](_0x695a('0x41'),_0x3bbbca[_0x695a('0x1f')]),_0xf5fdc3);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 7e6233d..ea8888f 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 _0xe74e=['cdr','[%s][members][cdr]','channel','data1','data2','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','split','source','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','membername','type','then','internal','request','CreateMemberReport','getUserByName','name','catch','error','[%s][members][writeDB]','some','startsWith','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','agent','NOT_INUSE','isNil','exitAt','now','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign'];(function(_0x5cf3c0,_0x4363c1){var _0x39a680=function(_0x2a10f1){while(--_0x2a10f1){_0x5cf3c0['push'](_0x5cf3c0['shift']());}};_0x39a680(++_0x4363c1);}(_0xe74e,0x10a));var _0xee74=function(_0x3493bb,_0x142e8f){_0x3493bb=_0x3493bb-0x0;var _0x27633b=_0xe74e[_0x3493bb];return _0x27633b;};'use strict';var _=require('lodash');var util=require(_0xee74('0x0'));var utils=require(_0xee74('0x1'));var members={};var exclude=[_0xee74('0x2'),_0xee74('0x3')];function writeDB(_0x45c54d){utils[_0xee74('0x4')](util[_0xee74('0x5')](_0xee74('0x6'),_0x45c54d[_0xee74('0x7')],_0x45c54d[_0xee74('0x8')],_0x45c54d['channel'],_0x45c54d['data2'],_0x45c54d[_0xee74('0x9')],_0x45c54d[_0xee74('0xa')]));if(_0x45c54d['interface']){utils['getUserByInterface'](_0x45c54d[_0xee74('0x8')])[_0xee74('0xb')](function(_0x42d671){if(_0x42d671){_0x45c54d['membername']=_0x42d671['name'];_0x45c54d[_0xee74('0xc')]=_0x42d671[_0xee74('0xc')];utils[_0xee74('0xd')](_0xee74('0xe'),_0x45c54d);}else{utils[_0xee74('0xf')](_0x45c54d[_0xee74('0x8')]['split']('/')[0x1])[_0xee74('0xb')](function(_0x308b69){if(_0x308b69){_0x45c54d[_0xee74('0x9')]=_0x308b69[_0xee74('0x10')];_0x45c54d['internal']=_0x308b69[_0xee74('0xc')];utils[_0xee74('0xd')](_0xee74('0xe'),_0x45c54d);}});}})[_0xee74('0x11')](function(_0x5ee1b4){utils[_0xee74('0x12')](util[_0xee74('0x5')](_0xee74('0x13'),_0x45c54d[_0xee74('0x7')]),_0x5ee1b4);});}delete members[_0x45c54d[_0xee74('0x8')]];}function startsWith(_0x24184e,_0x489b98){return _[_0xee74('0x14')](_0x24184e,function(_0x456c3f){return _[_0xee74('0x15')](_0x489b98,_0x456c3f);});}exports['devicestatechange']=function(_0x988fb5){try{utils[_0xee74('0x16')](util['format']('[%s][members][devicestatechange]',members[_0x988fb5[_0xee74('0x17')]]?members[_0x988fb5[_0xee74('0x17')]][_0xee74('0x7')]:_0x988fb5[_0xee74('0x17')]),_0x988fb5);utils[_0xee74('0x4')](util['format'](_0xee74('0x18'),members[_0x988fb5[_0xee74('0x17')]]?members[_0x988fb5['device']][_0xee74('0x7')]:_0x988fb5[_0xee74('0x17')],_0x988fb5[_0xee74('0x19')],_0x988fb5[_0xee74('0x17')]));switch(_0x988fb5[_0xee74('0x19')]){case'INUSE':case _0xee74('0x1a'):if(!startsWith(exclude,_0x988fb5[_0xee74('0x17')])){members[_0x988fb5[_0xee74('0x17')]]={'channel':_0xee74('0x1b'),'interface':_0x988fb5['device'],'type':'TALKING','enterAt':utils['now'](),'role':_0xee74('0x1c')};}break;case _0xee74('0x1d'):if(!_[_0xee74('0x1e')](members[_0x988fb5[_0xee74('0x17')]])){members[_0x988fb5[_0xee74('0x17')]][_0xee74('0x1f')]=utils[_0xee74('0x20')]();members[_0x988fb5[_0xee74('0x17')]][_0xee74('0x21')]=utils[_0xee74('0x22')](members[_0x988fb5[_0xee74('0x17')]][_0xee74('0x1f')],members[_0x988fb5[_0xee74('0x17')]][_0xee74('0x23')]);if(members[_0x988fb5[_0xee74('0x17')]][_0xee74('0x7')]){writeDB(members[_0x988fb5[_0xee74('0x17')]]);}}break;default:break;}}catch(_0x353c8f){utils[_0xee74('0x12')](util[_0xee74('0x5')]('[%s][members][devicestatechange]',members[_0x988fb5[_0xee74('0x17')]]?members[_0x988fb5[_0xee74('0x17')]][_0xee74('0x7')]:_0x988fb5[_0xee74('0x17')]),_0x353c8f);}};exports[_0xee74('0x24')]=function(_0x399b50){try{if(!_['isNil'](members[_0x399b50[_0xee74('0x8')]])){utils[_0xee74('0x16')](util[_0xee74('0x5')]('[%s][members][agentcomplete]',_0x399b50[_0xee74('0x7')]),_0x399b50);utils[_0xee74('0x4')](util[_0xee74('0x5')](_0xee74('0x25'),_0x399b50[_0xee74('0x7')],_0x399b50[_0xee74('0x8')],_0x399b50[_0xee74('0x26')]));members[_0x399b50[_0xee74('0x8')]]=_[_0xee74('0x27')](members[_0x399b50[_0xee74('0x8')]],{'data4':_0x399b50['queue'],'uniqueid':_0x399b50[_0xee74('0x7')]});}}catch(_0x4cb876){utils['error'](util[_0xee74('0x5')]('[%s][members][agentcomplete]',_0x399b50['uniqueid']),_0x4cb876);}};exports[_0xee74('0x28')]=function(_0xbfdcf9){try{utils['debug'](util[_0xee74('0x5')](_0xee74('0x29'),_0xbfdcf9[_0xee74('0x7')]),_0xbfdcf9);if(_0xbfdcf9[_0xee74('0x2a')]){var _0x4d543a=_0xbfdcf9[_0xee74('0x2a')]['split']('-')[0x0];if(!_[_0xee74('0x1e')](members[_0x4d543a])){members[_0x4d543a]=_[_0xee74('0x27')](members[_0x4d543a],{'data1':members[_0x4d543a][_0xee74('0x2b')]||_0xbfdcf9['type'],'data2':members[_0x4d543a][_0xee74('0x2c')]||_0xbfdcf9['source'],'data3':members[_0x4d543a]['data3']||_0xbfdcf9[_0xee74('0x2d')],'uniqueid':members[_0x4d543a][_0xee74('0x7')]||_0xbfdcf9[_0xee74('0x7')]});utils['info'](util['format'](_0xee74('0x2e'),_0xbfdcf9[_0xee74('0x7')],members[_0x4d543a][_0xee74('0x2b')],members[_0x4d543a][_0xee74('0x2c')],members[_0x4d543a][_0xee74('0x2f')]));if(members[_0x4d543a][_0xee74('0x1f')]){writeDB(members[_0x4d543a]);}}}if(_0xbfdcf9[_0xee74('0x30')]){var _0x1da6f9=_0xbfdcf9[_0xee74('0x30')][_0xee74('0x31')]('-')[0x0];if(!_['isNil'](members[_0x1da6f9])){members[_0x1da6f9]=_[_0xee74('0x27')](members[_0x1da6f9],{'data1':members[_0x1da6f9][_0xee74('0x2b')]||_0xbfdcf9[_0xee74('0xa')],'data2':members[_0x1da6f9]['data2']||_0xbfdcf9[_0xee74('0x32')],'data3':members[_0x1da6f9][_0xee74('0x2f')]||_0xbfdcf9[_0xee74('0x2d')],'uniqueid':members[_0x1da6f9][_0xee74('0x7')]||_0xbfdcf9['uniqueid']});utils['info'](util[_0xee74('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xbfdcf9[_0xee74('0x7')],members[_0x1da6f9][_0xee74('0x2b')],members[_0x1da6f9][_0xee74('0x2c')],members[_0x1da6f9][_0xee74('0x2f')]));if(members[_0x1da6f9][_0xee74('0x1f')]){writeDB(members[_0x1da6f9]);}}}}catch(_0x3baf27){utils['error'](util[_0xee74('0x5')](_0xee74('0x29'),_0xbfdcf9[_0xee74('0x7')]),_0x3baf27);}}; \ No newline at end of file +var _0x9e6c=['device','state','INUSE','voice','TALKING','now','agent','NOT_INUSE','duration','diffTime','exitAt','enterAt','error','[%s][members][devicestatechange]','agentcomplete','debug','[%s][members][agentcomplete]','queue','assign','cdr','channel','split','isNil','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','Local/_attended@transfer','info','format','uniqueid','interface','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','[%s][members][writeDB]','some','startsWith','devicestatechange'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9e6c,0x1d5));var _0xc9e6=function(_0x41f990,_0x24ac51){_0x41f990=_0x41f990-0x0;var _0x5458ba=_0x9e6c[_0x41f990];return _0x5458ba;};'use strict';var _=require(_0xc9e6('0x0'));var util=require(_0xc9e6('0x1'));var utils=require('./utils');var members={};var exclude=[_0xc9e6('0x2'),'Queue:'];function writeDB(_0x1007d4){utils[_0xc9e6('0x3')](util[_0xc9e6('0x4')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x1007d4[_0xc9e6('0x5')],_0x1007d4[_0xc9e6('0x6')],_0x1007d4['channel'],_0x1007d4[_0xc9e6('0x7')],_0x1007d4[_0xc9e6('0x8')],_0x1007d4[_0xc9e6('0x9')]));if(_0x1007d4[_0xc9e6('0x6')]){utils[_0xc9e6('0xa')](_0x1007d4['interface'])[_0xc9e6('0xb')](function(_0x54023a){if(_0x54023a){_0x1007d4['membername']=_0x54023a[_0xc9e6('0xc')];_0x1007d4[_0xc9e6('0xd')]=_0x54023a[_0xc9e6('0xd')];utils[_0xc9e6('0xe')](_0xc9e6('0xf'),_0x1007d4);}else{utils[_0xc9e6('0x10')](_0x1007d4[_0xc9e6('0x6')]['split']('/')[0x1])[_0xc9e6('0xb')](function(_0x57d458){if(_0x57d458){_0x1007d4[_0xc9e6('0x8')]=_0x57d458[_0xc9e6('0xc')];_0x1007d4['internal']=_0x57d458[_0xc9e6('0xd')];utils[_0xc9e6('0xe')](_0xc9e6('0xf'),_0x1007d4);}});}})['catch'](function(_0x12a002){utils['error'](util[_0xc9e6('0x4')](_0xc9e6('0x11'),_0x1007d4['uniqueid']),_0x12a002);});}delete members[_0x1007d4[_0xc9e6('0x6')]];}function startsWith(_0x558883,_0x83c9a7){return _[_0xc9e6('0x12')](_0x558883,function(_0x829799){return _[_0xc9e6('0x13')](_0x83c9a7,_0x829799);});}exports[_0xc9e6('0x14')]=function(_0x12514a){try{utils['debug'](util[_0xc9e6('0x4')]('[%s][members][devicestatechange]',members[_0x12514a[_0xc9e6('0x15')]]?members[_0x12514a[_0xc9e6('0x15')]]['uniqueid']:_0x12514a[_0xc9e6('0x15')]),_0x12514a);utils[_0xc9e6('0x3')](util[_0xc9e6('0x4')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x12514a[_0xc9e6('0x15')]]?members[_0x12514a[_0xc9e6('0x15')]][_0xc9e6('0x5')]:_0x12514a['device'],_0x12514a[_0xc9e6('0x16')],_0x12514a['device']));switch(_0x12514a[_0xc9e6('0x16')]){case _0xc9e6('0x17'):case'BUSY':if(!startsWith(exclude,_0x12514a[_0xc9e6('0x15')])){members[_0x12514a[_0xc9e6('0x15')]]={'channel':_0xc9e6('0x18'),'interface':_0x12514a[_0xc9e6('0x15')],'type':_0xc9e6('0x19'),'enterAt':utils[_0xc9e6('0x1a')](),'role':_0xc9e6('0x1b')};}break;case _0xc9e6('0x1c'):if(!_['isNil'](members[_0x12514a[_0xc9e6('0x15')]])){members[_0x12514a['device']]['exitAt']=utils['now']();members[_0x12514a[_0xc9e6('0x15')]][_0xc9e6('0x1d')]=utils[_0xc9e6('0x1e')](members[_0x12514a['device']][_0xc9e6('0x1f')],members[_0x12514a[_0xc9e6('0x15')]][_0xc9e6('0x20')]);if(members[_0x12514a[_0xc9e6('0x15')]]['uniqueid']){writeDB(members[_0x12514a[_0xc9e6('0x15')]]);}}break;default:break;}}catch(_0xc06307){utils[_0xc9e6('0x21')](util[_0xc9e6('0x4')](_0xc9e6('0x22'),members[_0x12514a[_0xc9e6('0x15')]]?members[_0x12514a['device']][_0xc9e6('0x5')]:_0x12514a[_0xc9e6('0x15')]),_0xc06307);}};exports[_0xc9e6('0x23')]=function(_0x27c1ca){try{if(!_['isNil'](members[_0x27c1ca[_0xc9e6('0x6')]])){utils[_0xc9e6('0x24')](util[_0xc9e6('0x4')](_0xc9e6('0x25'),_0x27c1ca[_0xc9e6('0x5')]),_0x27c1ca);utils[_0xc9e6('0x3')](util[_0xc9e6('0x4')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x27c1ca['uniqueid'],_0x27c1ca[_0xc9e6('0x6')],_0x27c1ca[_0xc9e6('0x26')]));members[_0x27c1ca[_0xc9e6('0x6')]]=_[_0xc9e6('0x27')](members[_0x27c1ca[_0xc9e6('0x6')]],{'data4':_0x27c1ca['queue'],'uniqueid':_0x27c1ca[_0xc9e6('0x5')]});}}catch(_0x66ec91){utils[_0xc9e6('0x21')](util[_0xc9e6('0x4')](_0xc9e6('0x25'),_0x27c1ca[_0xc9e6('0x5')]),_0x66ec91);}};exports[_0xc9e6('0x28')]=function(_0x223a74){try{utils[_0xc9e6('0x24')](util['format']('[%s][members][cdr]',_0x223a74[_0xc9e6('0x5')]),_0x223a74);if(_0x223a74[_0xc9e6('0x29')]){var _0x394910=_0x223a74[_0xc9e6('0x29')][_0xc9e6('0x2a')]('-')[0x0];if(!_[_0xc9e6('0x2b')](members[_0x394910])){members[_0x394910]=_[_0xc9e6('0x27')](members[_0x394910],{'data1':members[_0x394910][_0xc9e6('0x2c')]||_0x223a74['type'],'data2':members[_0x394910]['data2']||_0x223a74[_0xc9e6('0x2d')],'data3':members[_0x394910][_0xc9e6('0x2e')]||_0x223a74[_0xc9e6('0x2f')],'uniqueid':members[_0x394910][_0xc9e6('0x5')]||_0x223a74[_0xc9e6('0x5')]});utils[_0xc9e6('0x3')](util[_0xc9e6('0x4')](_0xc9e6('0x30'),_0x223a74[_0xc9e6('0x5')],members[_0x394910][_0xc9e6('0x2c')],members[_0x394910]['data2'],members[_0x394910]['data3']));if(members[_0x394910][_0xc9e6('0x1f')]){writeDB(members[_0x394910]);}}}if(_0x223a74['destinationchannel']){var _0x38230b=_0x223a74['destinationchannel'][_0xc9e6('0x2a')]('-')[0x0];if(!_['isNil'](members[_0x38230b])){members[_0x38230b]=_[_0xc9e6('0x27')](members[_0x38230b],{'data1':members[_0x38230b][_0xc9e6('0x2c')]||_0x223a74[_0xc9e6('0x9')],'data2':members[_0x38230b][_0xc9e6('0x7')]||_0x223a74[_0xc9e6('0x2d')],'data3':members[_0x38230b][_0xc9e6('0x2e')]||_0x223a74[_0xc9e6('0x2f')],'uniqueid':members[_0x38230b]['uniqueid']||_0x223a74['uniqueid']});utils[_0xc9e6('0x3')](util[_0xc9e6('0x4')](_0xc9e6('0x30'),_0x223a74[_0xc9e6('0x5')],members[_0x38230b][_0xc9e6('0x2c')],members[_0x38230b]['data2'],members[_0x38230b]['data3']));if(members[_0x38230b][_0xc9e6('0x1f')]){writeDB(members[_0x38230b]);}}}}catch(_0x156835){utils[_0xc9e6('0x21')](util[_0xc9e6('0x4')]('[%s][members][cdr]',_0x223a74[_0xc9e6('0x5')]),_0x156835);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 51d6a30..632a1dc 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 _0x437b=['secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','info','format','uniqueid','channel','lastAssignedTo','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','position','assign','now','error','[%s][queues][queuecallerjoin]','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','transfer','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER'];(function(_0x58c24e,_0x3f7850){var _0x46c7b0=function(_0x364d8f){while(--_0x364d8f){_0x58c24e['push'](_0x58c24e['shift']());}};_0x46c7b0(++_0x3f7850);}(_0x437b,0x125));var _0xb437=function(_0x187718,_0x427383){_0x187718=_0x187718-0x0;var _0x29ddf4=_0x437b[_0x187718];return _0x29ddf4;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x51c25d){utils[_0xb437('0x0')](util[_0xb437('0x1')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x51c25d[_0xb437('0x2')],_0x51c25d[_0xb437('0x3')],_0x51c25d['queue'],_0x51c25d[_0xb437('0x4')],_0x51c25d['calleridnum'],_0x51c25d[_0xb437('0x5')],_0x51c25d[_0xb437('0x6')]));if(_0x51c25d[_0xb437('0x7')]){utils[_0xb437('0x8')](_0x51c25d['queue'])['then'](function(_0x45bee6){if(_0x45bee6){_0x51c25d[_0xb437('0x9')]=_0x45bee6[_0xb437('0x9')];}utils[_0xb437('0xa')](_0xb437('0xb'),_0x51c25d);});}else{utils[_0xb437('0xa')]('CreateVoiceQueueReport',_0x51c25d);}if(_0x51c25d['transfereduniqueid']){delete queues[_0x51c25d[_0xb437('0xc')]];}else{delete queues[_0x51c25d[_0xb437('0x2')]];}}exports[_0xb437('0xd')]=function(_0x17c3bf){try{utils[_0xb437('0xe')](util[_0xb437('0x1')]('[%s][queues][queuecallerjoin]',_0x17c3bf[_0xb437('0x2')]),_0x17c3bf);utils['info'](util[_0xb437('0x1')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x17c3bf[_0xb437('0x2')],_0x17c3bf[_0xb437('0x7')],_0x17c3bf[_0xb437('0xf')]));queues[_0x17c3bf[_0xb437('0x2')]]=_[_0xb437('0x10')](_0x17c3bf,{'originalposition':_0x17c3bf[_0xb437('0xf')],'queuecallerjoinAt':utils[_0xb437('0x11')](),'mohtime':0x0});}catch(_0xb346f2){utils[_0xb437('0x12')](util[_0xb437('0x1')](_0xb437('0x13'),_0x17c3bf['uniqueid']),_0xb346f2);}};exports['hangup']=function(_0x14c4a5){try{if(!_[_0xb437('0x14')](queues[_0x14c4a5[_0xb437('0x2')]])){utils[_0xb437('0xe')](util[_0xb437('0x1')](_0xb437('0x15'),_0x14c4a5[_0xb437('0x2')]),_0x14c4a5);if(queues[_0x14c4a5[_0xb437('0x2')]][_0xb437('0x16')]){if(!queues[_0x14c4a5[_0xb437('0x2')]]['queuecallerabandon']&&!queues[_0x14c4a5['uniqueid']][_0xb437('0x17')]){queues[_0x14c4a5['uniqueid']]['queuecallercomplete']=!![];queues[_0x14c4a5[_0xb437('0x2')]][_0xb437('0x18')]=utils['now']();queues[_0x14c4a5[_0xb437('0x2')]]['queuecallerexitreason']=_0xb437('0x19');}utils[_0xb437('0x0')](util[_0xb437('0x1')](_0xb437('0x1a'),_0x14c4a5['uniqueid'],queues[_0x14c4a5['uniqueid']]['name'],queues[_0x14c4a5['uniqueid']][_0xb437('0x6')]));writeDB(queues[_0x14c4a5[_0xb437('0x2')]]);}else if(queues[_0x14c4a5[_0xb437('0x2')]]['transfereduniqueid']){utils[_0xb437('0x0')](util[_0xb437('0x1')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x14c4a5['uniqueid'],queues[_0x14c4a5['uniqueid']][_0xb437('0x1b')],queues[_0x14c4a5[_0xb437('0x2')]]['transfereduniqueid']));queues[queues[_0x14c4a5[_0xb437('0x2')]]['transfereduniqueid']]=queues[_0x14c4a5['uniqueid']];queues[queues[_0x14c4a5['uniqueid']][_0xb437('0xc')]][_0xb437('0x1c')]=0x2;delete queues[_0x14c4a5[_0xb437('0x2')]];}}}catch(_0x4cccfd){utils['error'](util[_0xb437('0x1')](_0xb437('0x15'),_0x14c4a5[_0xb437('0x2')]),_0x4cccfd);}};exports['varset']=function(_0x2c138b){try{utils[_0xb437('0xe')](util[_0xb437('0x1')](_0xb437('0x1d'),_0x2c138b['uniqueid']),_0x2c138b);if(!_[_0xb437('0x14')](_0x2c138b[_0xb437('0x1e')][_0xb437('0x1f')])&&_0x2c138b[_0xb437('0x20')][_0xb437('0x21')]()!==_0xb437('0x22')){if(!_[_0xb437('0x14')](queues[_0x2c138b[_0xb437('0x2')]])){queues[_0x2c138b[_0xb437('0x2')]][_0xb437('0x23')]=![];queues[_0x2c138b['uniqueid']][_0xb437('0x24')]=null;queues[_0x2c138b['uniqueid']]['queuecallerexit']=!![];queues[_0x2c138b['uniqueid']][_0xb437('0x25')]=utils[_0xb437('0x11')]();queues[_0x2c138b['uniqueid']][_0xb437('0x6')]=_0x2c138b[_0xb437('0x20')]['toUpperCase']();utils['info'](util[_0xb437('0x1')](_0xb437('0x26'),_0x2c138b[_0xb437('0x2')],queues[_0x2c138b[_0xb437('0x2')]][_0xb437('0x1b')],_0x2c138b[_0xb437('0x20')],queues[_0x2c138b[_0xb437('0x2')]]['queuecallerexitreason']));writeDB(queues[_0x2c138b[_0xb437('0x2')]]);}}else if(!_[_0xb437('0x14')](_0x2c138b[_0xb437('0x1e')][_0xb437('0x27')])){if(!_[_0xb437('0x14')](queues[_0x2c138b[_0xb437('0x2')]])&&!queues[_0x2c138b[_0xb437('0x2')]][_0xb437('0x23')]){queues[_0x2c138b['uniqueid']][_0xb437('0x23')]=![];queues[_0x2c138b[_0xb437('0x2')]][_0xb437('0x24')]=null;queues[_0x2c138b[_0xb437('0x2')]][_0xb437('0x17')]=!![];queues[_0x2c138b[_0xb437('0x2')]][_0xb437('0x25')]=utils[_0xb437('0x11')]();queues[_0x2c138b['uniqueid']][_0xb437('0x6')]=_0xb437('0x28');utils[_0xb437('0x0')](util[_0xb437('0x1')](_0xb437('0x29'),_0x2c138b[_0xb437('0x2')],queues[_0x2c138b[_0xb437('0x2')]]['name'],_0x2c138b[_0xb437('0x20')],queues[_0x2c138b[_0xb437('0x2')]][_0xb437('0x6')]));}}}catch(_0x2638dc){utils['error'](util[_0xb437('0x1')](_0xb437('0x1d'),_0x2c138b[_0xb437('0x2')]),_0x2638dc);}};exports[_0xb437('0x23')]=function(_0x249101){try{if(!_[_0xb437('0x14')](queues[_0x249101['uniqueid']])){utils[_0xb437('0xe')](util[_0xb437('0x1')](_0xb437('0x2a'),_0x249101[_0xb437('0x2')]),_0x249101);queues[_0x249101['uniqueid']][_0xb437('0x17')]=![];queues[_0x249101[_0xb437('0x2')]]['queuecallerexitAt']=null;queues[_0x249101[_0xb437('0x2')]]['queuecallerabandon']=!![];queues[_0x249101[_0xb437('0x2')]]['queuecallerabandonAt']=utils['now']();queues[_0x249101[_0xb437('0x2')]][_0xb437('0x6')]='ABANDONED';utils[_0xb437('0x0')](util[_0xb437('0x1')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x249101[_0xb437('0x2')],queues[_0x249101[_0xb437('0x2')]][_0xb437('0x1b')],queues[_0x249101[_0xb437('0x2')]][_0xb437('0x6')]));}}catch(_0x55f037){utils['error'](util[_0xb437('0x1')](_0xb437('0x2a'),_0x249101[_0xb437('0x2')]),_0x55f037);}};exports[_0xb437('0x2b')]=function(_0x2cda7d){try{if(!_['isNil'](queues[_0x2cda7d['uniqueid']])){utils[_0xb437('0xe')](util['format'](_0xb437('0x2c'),_0x2cda7d['uniqueid']),_0x2cda7d);utils[_0xb437('0x0')](util[_0xb437('0x1')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2cda7d['uniqueid'],queues[_0x2cda7d[_0xb437('0x2')]]['name'],_0x2cda7d['connectedlinenum'],_0x2cda7d[_0xb437('0x2d')]));queues[_0x2cda7d['uniqueid']][_0xb437('0x2b')]=!![];queues[_0x2cda7d['uniqueid']][_0xb437('0x16')]=utils[_0xb437('0x11')]();queues[_0x2cda7d[_0xb437('0x2')]][_0xb437('0x2e')]=utils[_0xb437('0x2f')](queues[_0x2cda7d[_0xb437('0x2')]][_0xb437('0x16')],queues[_0x2cda7d[_0xb437('0x2')]][_0xb437('0x30')]);queues[_0x2cda7d[_0xb437('0x2')]]['position']=_0x2cda7d[_0xb437('0xf')];queues[_0x2cda7d['uniqueid']][_0xb437('0x31')]=_0x2cda7d[_0xb437('0x31')];queues[_0x2cda7d['uniqueid']][_0xb437('0x32')]=_0x2cda7d[_0xb437('0x32')];queues[_0x2cda7d[_0xb437('0x2')]][_0xb437('0x2d')]=_0x2cda7d[_0xb437('0x2d')];}}catch(_0x29f02c){utils[_0xb437('0x12')](util[_0xb437('0x1')](_0xb437('0x2c'),_0x2cda7d[_0xb437('0x2')]),_0x29f02c);}};exports[_0xb437('0x33')]=function(_0x3bb229){try{if(!_[_0xb437('0x14')](queues[_0x3bb229[_0xb437('0x2')]])){utils['debug'](util['format']('[%s][queues][agentconnect]',_0x3bb229[_0xb437('0x2')]),_0x3bb229);utils[_0xb437('0x0')](util[_0xb437('0x1')](_0xb437('0x34'),_0x3bb229[_0xb437('0x2')],queues[_0x3bb229[_0xb437('0x2')]][_0xb437('0x1b')],_0x3bb229[_0xb437('0x35')],_0x3bb229[_0xb437('0x36')]));queues[_0x3bb229[_0xb437('0x2')]][_0xb437('0x23')]=![];queues[_0x3bb229[_0xb437('0x2')]][_0xb437('0x23')]=![];queues[_0x3bb229[_0xb437('0x2')]][_0xb437('0x24')]=null;queues[_0x3bb229[_0xb437('0x2')]][_0xb437('0x17')]=![];queues[_0x3bb229[_0xb437('0x2')]][_0xb437('0x6')]=null;queues[_0x3bb229['uniqueid']][_0xb437('0x25')]=null;queues[_0x3bb229[_0xb437('0x2')]][_0xb437('0x37')]=!![];queues[_0x3bb229[_0xb437('0x2')]][_0xb437('0x5')]=_0x3bb229[_0xb437('0x36')];queues[_0x3bb229[_0xb437('0x2')]][_0xb437('0x4')]=_0x3bb229['membername'];}}catch(_0x341002){utils['error'](util[_0xb437('0x1')]('[%s][queues][agentconnect]',_0x3bb229[_0xb437('0x2')]),_0x341002);}};exports[_0xb437('0x38')]=function(_0x27bb6e){try{if(!_[_0xb437('0x14')](queues[_0x27bb6e[_0xb437('0x2')]])){if(queues[_0x27bb6e[_0xb437('0x2')]][_0xb437('0x16')]){utils[_0xb437('0xe')](util[_0xb437('0x1')](_0xb437('0x39'),_0x27bb6e['uniqueid']),_0x27bb6e);queues[_0x27bb6e[_0xb437('0x2')]]['queuecallerabandon']=![];queues[_0x27bb6e[_0xb437('0x2')]][_0xb437('0x23')]=![];queues[_0x27bb6e[_0xb437('0x2')]]['queuecallerabandonAt']=null;queues[_0x27bb6e['uniqueid']]['queuecallerexit']=![];queues[_0x27bb6e[_0xb437('0x2')]][_0xb437('0x25')]=null;queues[_0x27bb6e[_0xb437('0x2')]]['assigned']=!![];queues[_0x27bb6e[_0xb437('0x2')]][_0xb437('0x4')]=_0x27bb6e[_0xb437('0x35')];queues[_0x27bb6e[_0xb437('0x2')]][_0xb437('0x3a')]=!![];queues[_0x27bb6e[_0xb437('0x2')]][_0xb437('0x18')]=utils['now']();if(_0x27bb6e['reason']=='transfer'){if(!queues[_0x27bb6e[_0xb437('0x2')]][_0xb437('0x3b')]){queues[_0x27bb6e[_0xb437('0x2')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x27bb6e[_0xb437('0x2')]][_0xb437('0x6')]=_0xb437('0x3c')+_0x27bb6e[_0xb437('0x3d')][_0xb437('0x21')]();}utils['info'](util[_0xb437('0x1')](_0xb437('0x3e'),_0x27bb6e[_0xb437('0x2')],queues[_0x27bb6e[_0xb437('0x2')]][_0xb437('0x1b')],_0x27bb6e[_0xb437('0x35')],queues[_0x27bb6e[_0xb437('0x2')]][_0xb437('0x6')]));writeDB(queues[_0x27bb6e[_0xb437('0x2')]]);}}}catch(_0x56ede1){utils[_0xb437('0x12')](util[_0xb437('0x1')]('[%s][queues][agentcomplete]',_0x27bb6e['uniqueid']),_0x56ede1);}};exports[_0xb437('0x3f')]=function(_0x17920e){try{if(!_['isNil'](queues[_0x17920e[_0xb437('0x40')]])){utils[_0xb437('0xe')](util[_0xb437('0x1')]('[%s][queues][blindtransfer]',_0x17920e[_0xb437('0x2')]),_0x17920e);queues[_0x17920e[_0xb437('0x40')]][_0xb437('0x3b')]=!![];queues[_0x17920e[_0xb437('0x40')]][_0xb437('0x41')]='BLIND';queues[_0x17920e['transfereeuniqueid']][_0xb437('0x42')]=_0x17920e['extension'];queues[_0x17920e[_0xb437('0x40')]][_0xb437('0x43')]=_0x17920e[_0xb437('0x40')];queues[_0x17920e['transfereeuniqueid']]['queuecallerexitreason']=_0xb437('0x44');utils[_0xb437('0x0')](util[_0xb437('0x1')](_0xb437('0x45'),_0x17920e[_0xb437('0x2')],queues[_0x17920e[_0xb437('0x40')]][_0xb437('0x1b')],_0x17920e[_0xb437('0x40')],_0x17920e[_0xb437('0x46')]));}}catch(_0x3c5751){utils[_0xb437('0x12')](util[_0xb437('0x1')]('[%s][queues][blindtransfer]',_0x17920e[_0xb437('0x2')]),_0x3c5751);}};exports[_0xb437('0x47')]=function(_0x248b27){try{utils['debug'](util[_0xb437('0x1')]('[%s][queues][attendedtransfer]',_0x248b27[_0xb437('0x48')]),_0x248b27);if(_0x248b27[_0xb437('0x48')]==_0x248b27['origtransfererlinkedid']){if(!_[_0xb437('0x14')](queues[_0x248b27[_0xb437('0x49')]])){utils[_0xb437('0x0')](util[_0xb437('0x1')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x248b27[_0xb437('0x48')],queues[_0x248b27[_0xb437('0x49')]]['name'],_0x248b27[_0xb437('0x4a')]));queues[_0x248b27[_0xb437('0x49')]]['transfer']=!![];queues[_0x248b27[_0xb437('0x49')]]['transfertype']=_0xb437('0x4b');queues[_0x248b27['secondtransfererlinkedid']][_0xb437('0x42')]=_0x248b27[_0xb437('0x4a')];queues[_0x248b27['secondtransfererlinkedid']]['transferuniqueid']=_0x248b27[_0xb437('0x48')];queues[_0x248b27[_0xb437('0x49')]][_0xb437('0x6')]=_0xb437('0x4c');}if(!_[_0xb437('0x14')](queues[_0x248b27[_0xb437('0x4d')]])){if(_0x248b27[_0xb437('0x4e')]&&queues[_0x248b27[_0xb437('0x4e')]]){queues[_0x248b27[_0xb437('0x4e')]]['queuecallerenterreason']=0x1;queues[_0x248b27[_0xb437('0x40')]]=_['clone'](queues[_0x248b27[_0xb437('0x4e')]]);queues[_0x248b27[_0xb437('0x40')]][_0xb437('0xc')]=_0x248b27[_0xb437('0x4f')];queues[_0x248b27[_0xb437('0x40')]][_0xb437('0x1c')]=0x2;queues[_0x248b27['transfereeuniqueid']][_0xb437('0x50')]=queues[_0x248b27[_0xb437('0x49')]][_0xb437('0x50')];queues[_0x248b27['transfereeuniqueid']][_0xb437('0x51')]=queues[_0x248b27[_0xb437('0x49')]][_0xb437('0x51')];queues[_0x248b27[_0xb437('0x40')]]['queuecallerjoinAt']=utils[_0xb437('0x11')]();queues[_0x248b27[_0xb437('0x40')]][_0xb437('0x16')]=utils[_0xb437('0x11')]();queues[_0x248b27[_0xb437('0x40')]][_0xb437('0x2e')]=0x0;queues[_0x248b27[_0xb437('0x40')]][_0xb437('0x52')]=0x0;utils['info'](util[_0xb437('0x1')](_0xb437('0x53'),_0x248b27[_0xb437('0x48')],queues[_0x248b27[_0xb437('0x40')]]['name'],queues[_0x248b27[_0xb437('0x40')]][_0xb437('0x50')],queues[_0x248b27[_0xb437('0x40')]][_0xb437('0x51')]));}else{utils[_0xb437('0x0')](util['format'](_0xb437('0x54'),_0x248b27[_0xb437('0x48')],queues[_0x248b27[_0xb437('0x4d')]][_0xb437('0x1b')],_0x248b27[_0xb437('0x49')]));queues[_0x248b27[_0xb437('0x4d')]][_0xb437('0xc')]=_0x248b27[_0xb437('0x49')];}}}else if(_0x248b27[_0xb437('0x55')]==_0x248b27[_0xb437('0x49')]){if(!_[_0xb437('0x14')](queues[_0x248b27['origtransfererlinkedid']])){utils[_0xb437('0x0')](util[_0xb437('0x1')](_0xb437('0x56'),_0x248b27[_0xb437('0x48')],queues[_0x248b27['origtransfererlinkedid']][_0xb437('0x1b')],_0x248b27[_0xb437('0x55')],_0x248b27[_0xb437('0x57')]));queues[_0x248b27[_0xb437('0x4d')]][_0xb437('0x3b')]=!![];queues[_0x248b27['origtransfererlinkedid']]['transfertype']=_0xb437('0x4b');queues[_0x248b27[_0xb437('0x4d')]][_0xb437('0x42')]=_0x248b27['secondtransfererexten'];queues[_0x248b27['origtransfererlinkedid']][_0xb437('0x43')]=_0x248b27[_0xb437('0x55')];queues[_0x248b27[_0xb437('0x4d')]][_0xb437('0x6')]=_0xb437('0x4c');}if(!_[_0xb437('0x14')](queues[_0x248b27[_0xb437('0x49')]])){if(_0x248b27[_0xb437('0x58')]&&queues[_0x248b27[_0xb437('0x58')]]){queues[_0x248b27[_0xb437('0x58')]][_0xb437('0x1c')]=0x1;queues[_0x248b27['transfertargetuniqueid']]=_['clone'](queues[_0x248b27[_0xb437('0x58')]]);queues[_0x248b27[_0xb437('0x4f')]]['transfereduniqueid']=_0x248b27[_0xb437('0x4f')];queues[_0x248b27[_0xb437('0x4f')]]['queuecallerenterreason']=0x2;queues[_0x248b27[_0xb437('0x4f')]][_0xb437('0x50')]=queues[_0x248b27[_0xb437('0x4d')]][_0xb437('0x50')];queues[_0x248b27[_0xb437('0x4f')]][_0xb437('0x51')]=queues[_0x248b27[_0xb437('0x4d')]][_0xb437('0x51')];queues[_0x248b27[_0xb437('0x4f')]][_0xb437('0x30')]=utils[_0xb437('0x11')]();queues[_0x248b27[_0xb437('0x4f')]][_0xb437('0x16')]=utils[_0xb437('0x11')]();queues[_0x248b27[_0xb437('0x4f')]][_0xb437('0x2e')]=0x0;queues[_0x248b27[_0xb437('0x4f')]][_0xb437('0x52')]=0x0;utils['info'](util[_0xb437('0x1')](_0xb437('0x59'),_0x248b27[_0xb437('0x48')],queues[_0x248b27[_0xb437('0x4f')]][_0xb437('0x1b')],queues[_0x248b27[_0xb437('0x4f')]]['transfereduniqueid'],queues[_0x248b27[_0xb437('0x4f')]][_0xb437('0x50')],queues[_0x248b27['transfertargetuniqueid']][_0xb437('0x51')]));}else{utils['info'](util[_0xb437('0x1')](_0xb437('0x54'),_0x248b27[_0xb437('0x48')],queues[_0x248b27['secondtransfererlinkedid']][_0xb437('0x1b')],_0x248b27[_0xb437('0x4d')]));queues[_0x248b27['secondtransfererlinkedid']]['transfereduniqueid']=_0x248b27[_0xb437('0x4d')];}}}}catch(_0x17e9e4){utils['error'](util[_0xb437('0x1')]('[%s][queues][attendedtransfer]',_0x248b27[_0xb437('0x48')]),_0x17e9e4);}};exports[_0xb437('0x5a')]=function(_0x13506b){try{if(!_[_0xb437('0x14')](queues[_0x13506b['uniqueid']])){utils[_0xb437('0xe')](util[_0xb437('0x1')]('[%s][queues][musiconholdstart]',_0x13506b[_0xb437('0x2')]),_0x13506b);queues[_0x13506b['uniqueid']][_0xb437('0x5b')]=utils['now']();utils[_0xb437('0x0')](util[_0xb437('0x1')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x13506b[_0xb437('0x2')],queues[_0x13506b[_0xb437('0x2')]][_0xb437('0x1b')],queues[_0x13506b['uniqueid']][_0xb437('0x5b')]));}}catch(_0x522bbf){utils[_0xb437('0x12')](util['format'](_0xb437('0x5c'),_0x13506b[_0xb437('0x2')]),_0x522bbf);}};exports['musiconholdstop']=function(_0x31fccd){try{if(!_[_0xb437('0x14')](queues[_0x31fccd[_0xb437('0x2')]])){if(!_[_0xb437('0x14')](queues[_0x31fccd[_0xb437('0x2')]][_0xb437('0x5b')])){utils[_0xb437('0xe')](util[_0xb437('0x1')](_0xb437('0x5d'),_0x31fccd['uniqueid']),_0x31fccd);queues[_0x31fccd[_0xb437('0x2')]]['mohtime']+=utils[_0xb437('0x2f')](utils[_0xb437('0x11')](),queues[_0x31fccd[_0xb437('0x2')]][_0xb437('0x5b')]);utils['info'](util[_0xb437('0x1')](_0xb437('0x5e'),_0x31fccd[_0xb437('0x2')],queues[_0x31fccd[_0xb437('0x2')]][_0xb437('0x1b')],queues[_0x31fccd[_0xb437('0x2')]][_0xb437('0x52')]));delete queues[_0x31fccd[_0xb437('0x2')]][_0xb437('0x5b')];}}}catch(_0x54d689){utils['error'](util[_0xb437('0x1')]('[%s][queues][musiconholdstop]',_0x31fccd[_0xb437('0x2')]),_0x54d689);}}; \ No newline at end of file +var _0xe779=['[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','uniqueid','channel','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','[%s][queues][queuecallerjoin]','isNil','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','error','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','queuecallerabandon','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','lastAssignedTo','membername'];(function(_0x7f0b96,_0x437adf){var _0xeb5213=function(_0x4afc2c){while(--_0x4afc2c){_0x7f0b96['push'](_0x7f0b96['shift']());}};_0xeb5213(++_0x437adf);}(_0xe779,0x167));var _0x9e77=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe779[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x9e77('0x0'));var util=require(_0x9e77('0x1'));var utils=require(_0x9e77('0x2'));var queues={};function writeDB(_0x11366f){utils[_0x9e77('0x3')](util[_0x9e77('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x11366f[_0x9e77('0x5')],_0x11366f[_0x9e77('0x6')],_0x11366f[_0x9e77('0x7')],_0x11366f['lastAssignedTo'],_0x11366f[_0x9e77('0x8')],_0x11366f[_0x9e77('0x9')],_0x11366f[_0x9e77('0xa')]));if(_0x11366f['queue']){utils[_0x9e77('0xb')](_0x11366f[_0x9e77('0x7')])['then'](function(_0x2e8073){if(_0x2e8073){_0x11366f[_0x9e77('0xc')]=_0x2e8073[_0x9e77('0xc')];}utils['request']('CreateVoiceQueueReport',_0x11366f);});}else{utils[_0x9e77('0xd')](_0x9e77('0xe'),_0x11366f);}if(_0x11366f[_0x9e77('0xf')]){delete queues[_0x11366f['transfereduniqueid']];}else{delete queues[_0x11366f[_0x9e77('0x5')]];}}exports[_0x9e77('0x10')]=function(_0x2c3989){try{utils[_0x9e77('0x11')](util['format']('[%s][queues][queuecallerjoin]',_0x2c3989[_0x9e77('0x5')]),_0x2c3989);utils[_0x9e77('0x3')](util['format'](_0x9e77('0x12'),_0x2c3989[_0x9e77('0x5')],_0x2c3989[_0x9e77('0x7')],_0x2c3989[_0x9e77('0x13')]));queues[_0x2c3989[_0x9e77('0x5')]]=_[_0x9e77('0x14')](_0x2c3989,{'originalposition':_0x2c3989['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x21f396){utils['error'](util[_0x9e77('0x4')](_0x9e77('0x15'),_0x2c3989[_0x9e77('0x5')]),_0x21f396);}};exports['hangup']=function(_0x2c08b9){try{if(!_[_0x9e77('0x16')](queues[_0x2c08b9[_0x9e77('0x5')]])){utils[_0x9e77('0x11')](util[_0x9e77('0x4')]('[%s][queues][hangup]',_0x2c08b9[_0x9e77('0x5')]),_0x2c08b9);if(queues[_0x2c08b9[_0x9e77('0x5')]][_0x9e77('0x17')]){if(!queues[_0x2c08b9[_0x9e77('0x5')]]['queuecallerabandon']&&!queues[_0x2c08b9['uniqueid']]['queuecallerexit']){queues[_0x2c08b9[_0x9e77('0x5')]][_0x9e77('0x18')]=!![];queues[_0x2c08b9[_0x9e77('0x5')]][_0x9e77('0x19')]=utils[_0x9e77('0x1a')]();queues[_0x2c08b9[_0x9e77('0x5')]]['queuecallerexitreason']=_0x9e77('0x1b');}utils[_0x9e77('0x3')](util[_0x9e77('0x4')](_0x9e77('0x1c'),_0x2c08b9['uniqueid'],queues[_0x2c08b9[_0x9e77('0x5')]]['name'],queues[_0x2c08b9[_0x9e77('0x5')]][_0x9e77('0xa')]));writeDB(queues[_0x2c08b9[_0x9e77('0x5')]]);}else if(queues[_0x2c08b9[_0x9e77('0x5')]][_0x9e77('0xf')]){utils[_0x9e77('0x3')](util[_0x9e77('0x4')](_0x9e77('0x1d'),_0x2c08b9[_0x9e77('0x5')],queues[_0x2c08b9['uniqueid']][_0x9e77('0x1e')],queues[_0x2c08b9[_0x9e77('0x5')]]['transfereduniqueid']));queues[queues[_0x2c08b9[_0x9e77('0x5')]][_0x9e77('0xf')]]=queues[_0x2c08b9[_0x9e77('0x5')]];queues[queues[_0x2c08b9[_0x9e77('0x5')]]['transfereduniqueid']][_0x9e77('0x1f')]=0x2;delete queues[_0x2c08b9[_0x9e77('0x5')]];}}}catch(_0x21b283){utils[_0x9e77('0x20')](util[_0x9e77('0x4')]('[%s][queues][hangup]',_0x2c08b9[_0x9e77('0x5')]),_0x21b283);}};exports[_0x9e77('0x21')]=function(_0x5ae494){try{utils[_0x9e77('0x11')](util['format'](_0x9e77('0x22'),_0x5ae494[_0x9e77('0x5')]),_0x5ae494);if(!_['isNil'](_0x5ae494[_0x9e77('0x23')][_0x9e77('0x24')])&&_0x5ae494[_0x9e77('0x25')][_0x9e77('0x26')]()!=='CONTINUE'){if(!_[_0x9e77('0x16')](queues[_0x5ae494[_0x9e77('0x5')]])){queues[_0x5ae494[_0x9e77('0x5')]][_0x9e77('0x27')]=![];queues[_0x5ae494[_0x9e77('0x5')]][_0x9e77('0x28')]=null;queues[_0x5ae494[_0x9e77('0x5')]][_0x9e77('0x29')]=!![];queues[_0x5ae494[_0x9e77('0x5')]][_0x9e77('0x2a')]=utils['now']();queues[_0x5ae494[_0x9e77('0x5')]][_0x9e77('0xa')]=_0x5ae494[_0x9e77('0x25')][_0x9e77('0x26')]();utils[_0x9e77('0x3')](util[_0x9e77('0x4')](_0x9e77('0x2b'),_0x5ae494[_0x9e77('0x5')],queues[_0x5ae494[_0x9e77('0x5')]][_0x9e77('0x1e')],_0x5ae494[_0x9e77('0x25')],queues[_0x5ae494['uniqueid']][_0x9e77('0xa')]));writeDB(queues[_0x5ae494[_0x9e77('0x5')]]);}}else if(!_[_0x9e77('0x16')](_0x5ae494[_0x9e77('0x23')][_0x9e77('0x2c')])){if(!_['isNil'](queues[_0x5ae494['uniqueid']])&&!queues[_0x5ae494[_0x9e77('0x5')]][_0x9e77('0x27')]){queues[_0x5ae494[_0x9e77('0x5')]][_0x9e77('0x27')]=![];queues[_0x5ae494[_0x9e77('0x5')]][_0x9e77('0x28')]=null;queues[_0x5ae494[_0x9e77('0x5')]][_0x9e77('0x29')]=!![];queues[_0x5ae494[_0x9e77('0x5')]][_0x9e77('0x2a')]=utils[_0x9e77('0x1a')]();queues[_0x5ae494[_0x9e77('0x5')]]['queuecallerexitreason']=_0x9e77('0x2d');utils['info'](util[_0x9e77('0x4')](_0x9e77('0x2e'),_0x5ae494[_0x9e77('0x5')],queues[_0x5ae494[_0x9e77('0x5')]]['name'],_0x5ae494[_0x9e77('0x25')],queues[_0x5ae494[_0x9e77('0x5')]]['queuecallerexitreason']));}}}catch(_0x56d689){utils[_0x9e77('0x20')](util[_0x9e77('0x4')](_0x9e77('0x22'),_0x5ae494['uniqueid']),_0x56d689);}};exports[_0x9e77('0x27')]=function(_0x4bb013){try{if(!_[_0x9e77('0x16')](queues[_0x4bb013['uniqueid']])){utils[_0x9e77('0x11')](util[_0x9e77('0x4')](_0x9e77('0x2f'),_0x4bb013[_0x9e77('0x5')]),_0x4bb013);queues[_0x4bb013[_0x9e77('0x5')]][_0x9e77('0x29')]=![];queues[_0x4bb013[_0x9e77('0x5')]][_0x9e77('0x2a')]=null;queues[_0x4bb013[_0x9e77('0x5')]][_0x9e77('0x27')]=!![];queues[_0x4bb013['uniqueid']][_0x9e77('0x28')]=utils['now']();queues[_0x4bb013['uniqueid']][_0x9e77('0xa')]=_0x9e77('0x30');utils[_0x9e77('0x3')](util['format'](_0x9e77('0x31'),_0x4bb013[_0x9e77('0x5')],queues[_0x4bb013[_0x9e77('0x5')]]['name'],queues[_0x4bb013[_0x9e77('0x5')]][_0x9e77('0xa')]));}}catch(_0x364fcf){utils[_0x9e77('0x20')](util[_0x9e77('0x4')](_0x9e77('0x2f'),_0x4bb013[_0x9e77('0x5')]),_0x364fcf);}};exports[_0x9e77('0x32')]=function(_0x29ee8a){try{if(!_[_0x9e77('0x16')](queues[_0x29ee8a[_0x9e77('0x5')]])){utils[_0x9e77('0x11')](util[_0x9e77('0x4')](_0x9e77('0x33'),_0x29ee8a[_0x9e77('0x5')]),_0x29ee8a);utils[_0x9e77('0x3')](util[_0x9e77('0x4')](_0x9e77('0x34'),_0x29ee8a[_0x9e77('0x5')],queues[_0x29ee8a[_0x9e77('0x5')]][_0x9e77('0x1e')],_0x29ee8a[_0x9e77('0x35')],_0x29ee8a[_0x9e77('0x36')]));queues[_0x29ee8a['uniqueid']][_0x9e77('0x32')]=!![];queues[_0x29ee8a[_0x9e77('0x5')]]['queuecallerleaveAt']=utils[_0x9e77('0x1a')]();queues[_0x29ee8a[_0x9e77('0x5')]]['holdtime']=utils[_0x9e77('0x37')](queues[_0x29ee8a['uniqueid']]['queuecallerleaveAt'],queues[_0x29ee8a[_0x9e77('0x5')]][_0x9e77('0x38')]);queues[_0x29ee8a[_0x9e77('0x5')]]['position']=_0x29ee8a[_0x9e77('0x13')];queues[_0x29ee8a[_0x9e77('0x5')]][_0x9e77('0x39')]=_0x29ee8a[_0x9e77('0x39')];queues[_0x29ee8a[_0x9e77('0x5')]][_0x9e77('0x35')]=_0x29ee8a[_0x9e77('0x35')];queues[_0x29ee8a['uniqueid']]['connectedlinename']=_0x29ee8a[_0x9e77('0x36')];}}catch(_0x33b94b){utils['error'](util[_0x9e77('0x4')](_0x9e77('0x33'),_0x29ee8a[_0x9e77('0x5')]),_0x33b94b);}};exports[_0x9e77('0x3a')]=function(_0x3a360b){try{if(!_['isNil'](queues[_0x3a360b[_0x9e77('0x5')]])){utils[_0x9e77('0x11')](util[_0x9e77('0x4')](_0x9e77('0x3b'),_0x3a360b[_0x9e77('0x5')]),_0x3a360b);utils[_0x9e77('0x3')](util[_0x9e77('0x4')](_0x9e77('0x3c'),_0x3a360b[_0x9e77('0x5')],queues[_0x3a360b[_0x9e77('0x5')]]['name'],_0x3a360b['membername'],_0x3a360b[_0x9e77('0x3d')]));queues[_0x3a360b['uniqueid']][_0x9e77('0x27')]=![];queues[_0x3a360b[_0x9e77('0x5')]]['queuecallerabandon']=![];queues[_0x3a360b['uniqueid']][_0x9e77('0x28')]=null;queues[_0x3a360b[_0x9e77('0x5')]][_0x9e77('0x29')]=![];queues[_0x3a360b[_0x9e77('0x5')]][_0x9e77('0xa')]=null;queues[_0x3a360b['uniqueid']][_0x9e77('0x2a')]=null;queues[_0x3a360b['uniqueid']][_0x9e77('0x3e')]=!![];queues[_0x3a360b['uniqueid']]['accountcode']=_0x3a360b[_0x9e77('0x3d')];queues[_0x3a360b[_0x9e77('0x5')]][_0x9e77('0x3f')]=_0x3a360b[_0x9e77('0x40')];}}catch(_0x2bdf87){utils['error'](util[_0x9e77('0x4')](_0x9e77('0x3b'),_0x3a360b['uniqueid']),_0x2bdf87);}};exports['agentcomplete']=function(_0x474c4a){try{if(!_[_0x9e77('0x16')](queues[_0x474c4a['uniqueid']])){if(queues[_0x474c4a[_0x9e77('0x5')]][_0x9e77('0x17')]){utils[_0x9e77('0x11')](util[_0x9e77('0x4')](_0x9e77('0x41'),_0x474c4a[_0x9e77('0x5')]),_0x474c4a);queues[_0x474c4a[_0x9e77('0x5')]][_0x9e77('0x27')]=![];queues[_0x474c4a[_0x9e77('0x5')]][_0x9e77('0x27')]=![];queues[_0x474c4a[_0x9e77('0x5')]]['queuecallerabandonAt']=null;queues[_0x474c4a[_0x9e77('0x5')]][_0x9e77('0x29')]=![];queues[_0x474c4a['uniqueid']]['queuecallerexitAt']=null;queues[_0x474c4a[_0x9e77('0x5')]][_0x9e77('0x3e')]=!![];queues[_0x474c4a[_0x9e77('0x5')]]['lastAssignedTo']=_0x474c4a[_0x9e77('0x40')];queues[_0x474c4a[_0x9e77('0x5')]][_0x9e77('0x18')]=!![];queues[_0x474c4a['uniqueid']][_0x9e77('0x19')]=utils[_0x9e77('0x1a')]();if(_0x474c4a[_0x9e77('0x42')]==_0x9e77('0x43')){if(!queues[_0x474c4a[_0x9e77('0x5')]][_0x9e77('0x43')]){queues[_0x474c4a[_0x9e77('0x5')]][_0x9e77('0xa')]=_0x9e77('0x44');}}else{queues[_0x474c4a[_0x9e77('0x5')]][_0x9e77('0xa')]=_0x9e77('0x45')+_0x474c4a[_0x9e77('0x42')][_0x9e77('0x26')]();}utils[_0x9e77('0x3')](util[_0x9e77('0x4')](_0x9e77('0x46'),_0x474c4a['uniqueid'],queues[_0x474c4a[_0x9e77('0x5')]][_0x9e77('0x1e')],_0x474c4a['membername'],queues[_0x474c4a[_0x9e77('0x5')]][_0x9e77('0xa')]));writeDB(queues[_0x474c4a['uniqueid']]);}}}catch(_0x34d78d){utils[_0x9e77('0x20')](util[_0x9e77('0x4')](_0x9e77('0x41'),_0x474c4a[_0x9e77('0x5')]),_0x34d78d);}};exports['blindtransfer']=function(_0xdcabb5){try{if(!_[_0x9e77('0x16')](queues[_0xdcabb5[_0x9e77('0x47')]])){utils['debug'](util[_0x9e77('0x4')](_0x9e77('0x48'),_0xdcabb5[_0x9e77('0x5')]),_0xdcabb5);queues[_0xdcabb5[_0x9e77('0x47')]]['transfer']=!![];queues[_0xdcabb5['transfereeuniqueid']][_0x9e77('0x49')]=_0x9e77('0x4a');queues[_0xdcabb5[_0x9e77('0x47')]]['transferexten']=_0xdcabb5[_0x9e77('0x4b')];queues[_0xdcabb5[_0x9e77('0x47')]][_0x9e77('0x4c')]=_0xdcabb5[_0x9e77('0x47')];queues[_0xdcabb5[_0x9e77('0x47')]][_0x9e77('0xa')]=_0x9e77('0x4d');utils[_0x9e77('0x3')](util['format'](_0x9e77('0x4e'),_0xdcabb5[_0x9e77('0x5')],queues[_0xdcabb5['transfereeuniqueid']][_0x9e77('0x1e')],_0xdcabb5['transfereeuniqueid'],_0xdcabb5[_0x9e77('0x4b')]));}}catch(_0x236997){utils[_0x9e77('0x20')](util[_0x9e77('0x4')](_0x9e77('0x48'),_0xdcabb5[_0x9e77('0x5')]),_0x236997);}};exports[_0x9e77('0x4f')]=function(_0x25c412){try{utils[_0x9e77('0x11')](util[_0x9e77('0x4')](_0x9e77('0x50'),_0x25c412['origtransfereruniqueid']),_0x25c412);if(_0x25c412[_0x9e77('0x51')]==_0x25c412[_0x9e77('0x52')]){if(!_['isNil'](queues[_0x25c412[_0x9e77('0x53')]])){utils[_0x9e77('0x3')](util[_0x9e77('0x4')](_0x9e77('0x54'),_0x25c412[_0x9e77('0x51')],queues[_0x25c412[_0x9e77('0x53')]][_0x9e77('0x1e')],_0x25c412[_0x9e77('0x55')]));queues[_0x25c412[_0x9e77('0x53')]][_0x9e77('0x43')]=!![];queues[_0x25c412[_0x9e77('0x53')]][_0x9e77('0x49')]=_0x9e77('0x56');queues[_0x25c412['secondtransfererlinkedid']][_0x9e77('0x57')]=_0x25c412[_0x9e77('0x55')];queues[_0x25c412[_0x9e77('0x53')]][_0x9e77('0x4c')]=_0x25c412[_0x9e77('0x51')];queues[_0x25c412[_0x9e77('0x53')]][_0x9e77('0xa')]=_0x9e77('0x58');}if(!_[_0x9e77('0x16')](queues[_0x25c412[_0x9e77('0x52')]])){if(_0x25c412[_0x9e77('0x59')]&&queues[_0x25c412[_0x9e77('0x59')]]){queues[_0x25c412[_0x9e77('0x59')]][_0x9e77('0x1f')]=0x1;queues[_0x25c412[_0x9e77('0x47')]]=_['clone'](queues[_0x25c412[_0x9e77('0x59')]]);queues[_0x25c412[_0x9e77('0x47')]][_0x9e77('0xf')]=_0x25c412[_0x9e77('0x5a')];queues[_0x25c412[_0x9e77('0x47')]]['queuecallerenterreason']=0x2;queues[_0x25c412[_0x9e77('0x47')]][_0x9e77('0x8')]=queues[_0x25c412[_0x9e77('0x53')]][_0x9e77('0x8')];queues[_0x25c412[_0x9e77('0x47')]][_0x9e77('0x5b')]=queues[_0x25c412[_0x9e77('0x53')]][_0x9e77('0x5b')];queues[_0x25c412[_0x9e77('0x47')]]['queuecallerjoinAt']=utils[_0x9e77('0x1a')]();queues[_0x25c412['transfereeuniqueid']]['queuecallerleaveAt']=utils['now']();queues[_0x25c412[_0x9e77('0x47')]][_0x9e77('0x5c')]=0x0;queues[_0x25c412[_0x9e77('0x47')]][_0x9e77('0x5d')]=0x0;utils[_0x9e77('0x3')](util[_0x9e77('0x4')](_0x9e77('0x5e'),_0x25c412[_0x9e77('0x51')],queues[_0x25c412['transfereeuniqueid']][_0x9e77('0x1e')],queues[_0x25c412[_0x9e77('0x47')]][_0x9e77('0x8')],queues[_0x25c412['transfereeuniqueid']][_0x9e77('0x5b')]));}else{utils[_0x9e77('0x3')](util[_0x9e77('0x4')](_0x9e77('0x5f'),_0x25c412['origtransfereruniqueid'],queues[_0x25c412[_0x9e77('0x52')]]['name'],_0x25c412[_0x9e77('0x53')]));queues[_0x25c412[_0x9e77('0x52')]][_0x9e77('0xf')]=_0x25c412[_0x9e77('0x53')];}}}else if(_0x25c412[_0x9e77('0x60')]==_0x25c412[_0x9e77('0x53')]){if(!_[_0x9e77('0x16')](queues[_0x25c412[_0x9e77('0x52')]])){utils[_0x9e77('0x3')](util[_0x9e77('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x25c412['origtransfereruniqueid'],queues[_0x25c412[_0x9e77('0x52')]]['name'],_0x25c412[_0x9e77('0x60')],_0x25c412['secondtransfererexten']));queues[_0x25c412[_0x9e77('0x52')]][_0x9e77('0x43')]=!![];queues[_0x25c412[_0x9e77('0x52')]][_0x9e77('0x49')]=_0x9e77('0x56');queues[_0x25c412[_0x9e77('0x52')]][_0x9e77('0x57')]=_0x25c412[_0x9e77('0x61')];queues[_0x25c412[_0x9e77('0x52')]]['transferuniqueid']=_0x25c412['secondtransfereruniqueid'];queues[_0x25c412['origtransfererlinkedid']][_0x9e77('0xa')]=_0x9e77('0x58');}if(!_[_0x9e77('0x16')](queues[_0x25c412[_0x9e77('0x53')]])){if(_0x25c412[_0x9e77('0x62')]&&queues[_0x25c412[_0x9e77('0x62')]]){queues[_0x25c412[_0x9e77('0x62')]]['queuecallerenterreason']=0x1;queues[_0x25c412['transfertargetuniqueid']]=_[_0x9e77('0x63')](queues[_0x25c412[_0x9e77('0x62')]]);queues[_0x25c412[_0x9e77('0x5a')]]['transfereduniqueid']=_0x25c412[_0x9e77('0x5a')];queues[_0x25c412['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x25c412[_0x9e77('0x5a')]]['calleridnum']=queues[_0x25c412[_0x9e77('0x52')]][_0x9e77('0x8')];queues[_0x25c412[_0x9e77('0x5a')]][_0x9e77('0x5b')]=queues[_0x25c412['origtransfererlinkedid']]['calleridname'];queues[_0x25c412['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0x9e77('0x1a')]();queues[_0x25c412['transfertargetuniqueid']]['queuecallerleaveAt']=utils['now']();queues[_0x25c412[_0x9e77('0x5a')]]['holdtime']=0x0;queues[_0x25c412[_0x9e77('0x5a')]][_0x9e77('0x5d')]=0x0;utils[_0x9e77('0x3')](util[_0x9e77('0x4')](_0x9e77('0x64'),_0x25c412[_0x9e77('0x51')],queues[_0x25c412[_0x9e77('0x5a')]][_0x9e77('0x1e')],queues[_0x25c412[_0x9e77('0x5a')]][_0x9e77('0xf')],queues[_0x25c412['transfertargetuniqueid']]['calleridnum'],queues[_0x25c412['transfertargetuniqueid']][_0x9e77('0x5b')]));}else{utils['info'](util[_0x9e77('0x4')](_0x9e77('0x5f'),_0x25c412['origtransfereruniqueid'],queues[_0x25c412[_0x9e77('0x53')]][_0x9e77('0x1e')],_0x25c412['origtransfererlinkedid']));queues[_0x25c412['secondtransfererlinkedid']][_0x9e77('0xf')]=_0x25c412[_0x9e77('0x52')];}}}}catch(_0xb46e0b){utils['error'](util['format'](_0x9e77('0x50'),_0x25c412['origtransfereruniqueid']),_0xb46e0b);}};exports['musiconholdstart']=function(_0x5ee9a2){try{if(!_[_0x9e77('0x16')](queues[_0x5ee9a2[_0x9e77('0x5')]])){utils['debug'](util['format'](_0x9e77('0x65'),_0x5ee9a2[_0x9e77('0x5')]),_0x5ee9a2);queues[_0x5ee9a2[_0x9e77('0x5')]][_0x9e77('0x66')]=utils['now']();utils[_0x9e77('0x3')](util[_0x9e77('0x4')](_0x9e77('0x67'),_0x5ee9a2[_0x9e77('0x5')],queues[_0x5ee9a2[_0x9e77('0x5')]][_0x9e77('0x1e')],queues[_0x5ee9a2[_0x9e77('0x5')]]['musiconholdstartAt']));}}catch(_0x260d25){utils['error'](util[_0x9e77('0x4')]('[%s][queues][musiconholdstart]',_0x5ee9a2[_0x9e77('0x5')]),_0x260d25);}};exports[_0x9e77('0x68')]=function(_0x2dd728){try{if(!_[_0x9e77('0x16')](queues[_0x2dd728[_0x9e77('0x5')]])){if(!_[_0x9e77('0x16')](queues[_0x2dd728[_0x9e77('0x5')]][_0x9e77('0x66')])){utils['debug'](util['format']('[%s][queues][musiconholdstop]',_0x2dd728['uniqueid']),_0x2dd728);queues[_0x2dd728[_0x9e77('0x5')]]['mohtime']+=utils[_0x9e77('0x37')](utils['now'](),queues[_0x2dd728[_0x9e77('0x5')]]['musiconholdstartAt']);utils['info'](util[_0x9e77('0x4')](_0x9e77('0x69'),_0x2dd728[_0x9e77('0x5')],queues[_0x2dd728['uniqueid']][_0x9e77('0x1e')],queues[_0x2dd728[_0x9e77('0x5')]][_0x9e77('0x5d')]));delete queues[_0x2dd728[_0x9e77('0x5')]][_0x9e77('0x66')];}}}catch(_0x2a7000){utils[_0x9e77('0x20')](util['format']('[%s][queues][musiconholdstop]',_0x2dd728[_0x9e77('0x5')]),_0x2a7000);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 50437bf..3d25e4c 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 _0x6bd5=['channel','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','startsWith','appdata','toLowerCase','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','format','uniqueid','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','debug','[%s][recordings][newstate]','isNil','channelstate'];(function(_0x19c6f2,_0x565e42){var _0x2813d6=function(_0x3d4c24){while(--_0x3d4c24){_0x19c6f2['push'](_0x19c6f2['shift']());}};_0x2813d6(++_0x565e42);}(_0x6bd5,0x114));var _0x56bd=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x6bd5[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0x56bd('0x0'));var util=require(_0x56bd('0x1'));var utils=require(_0x56bd('0x2'));var recordings={};function writeDB(_0x798903){utils['info'](util[_0x56bd('0x3')]('[%s][recordings][writeDB]',_0x798903[_0x56bd('0x4')]));if(_0x798903[_0x56bd('0x5')]){utils[_0x56bd('0x6')](_0x798903[_0x56bd('0x5')])['then'](function(_0x3249f0){if(_0x3249f0){_0x798903[_0x56bd('0x7')]=_0x3249f0[_0x56bd('0x8')];_0x798903[_0x56bd('0x9')]=_0x3249f0['id'];}utils[_0x56bd('0xa')](_0x56bd('0xb'),_0x798903);});}else{utils[_0x56bd('0xa')](_0x56bd('0xb'),_0x798903);}}exports[_0x56bd('0xc')]=function(_0x21726a){try{utils['debug'](util[_0x56bd('0x3')](_0x56bd('0xd'),_0x21726a[_0x56bd('0x4')]),_0x21726a);if(_0x21726a[_0x56bd('0x4')]==_0x21726a[_0x56bd('0xe')]){utils[_0x56bd('0xf')](util[_0x56bd('0x3')](_0x56bd('0x10'),_0x21726a[_0x56bd('0x4')],_0x21726a[_0x56bd('0x11')],_0x21726a[_0x56bd('0x12')]));recordings[_0x21726a[_0x56bd('0x4')]]={'uniqueid':_0x21726a['uniqueid'],'accountcode':_0x21726a[_0x56bd('0x5')],'exten':_0x21726a[_0x56bd('0x12')],'context':_0x21726a[_0x56bd('0x11')],'channel':_0x21726a['channel'],'monitors':[]};}}catch(_0x2635ed){utils[_0x56bd('0x13')](util[_0x56bd('0x3')]('[%s][recordings][newchannel]',_0x21726a[_0x56bd('0x4')]),_0x2635ed);}};exports['newstate']=function(_0x4f8d18){try{utils[_0x56bd('0x14')](util['format'](_0x56bd('0x15'),_0x4f8d18['uniqueid']),_0x4f8d18);if(!_[_0x56bd('0x16')](recordings[_0x4f8d18[_0x56bd('0x4')]])&&_0x4f8d18[_0x56bd('0x17')]==0x6){utils['info'](util[_0x56bd('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x4f8d18[_0x56bd('0x4')],_0x4f8d18[_0x56bd('0x11')],_0x4f8d18[_0x56bd('0x18')]));}else if(!_['isNil'](recordings[_0x4f8d18[_0x56bd('0xe')]])&&_0x4f8d18[_0x56bd('0x17')]==0x6&&_0x4f8d18[_0x56bd('0x11')]!='transfer'){utils[_0x56bd('0xf')](util[_0x56bd('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x4f8d18['uniqueid'],_0x4f8d18['linkedid'],_0x4f8d18[_0x56bd('0x11')],_0x4f8d18[_0x56bd('0x18')]));recordings[_0x4f8d18['linkedid']][_0x56bd('0x5')]=_0x4f8d18['accountcode'];}}catch(_0x402f1a){utils[_0x56bd('0x13')](util[_0x56bd('0x3')](_0x56bd('0x15'),_0x4f8d18[_0x56bd('0x4')]),_0x402f1a);}};exports[_0x56bd('0x19')]=function(_0x15eba6){try{if(!_[_0x56bd('0x16')](_0x15eba6[_0x56bd('0x1a')])&&!_[_0x56bd('0x16')](_0x15eba6[_0x56bd('0x1a')][_0x56bd('0x1b')])){utils[_0x56bd('0x14')](util[_0x56bd('0x3')]('[%s][recordings][varset]',_0x15eba6['uniqueid']),_0x15eba6);utils[_0x56bd('0xf')](util[_0x56bd('0x3')](_0x56bd('0x1c'),_0x15eba6[_0x56bd('0x4')],_0x15eba6[_0x56bd('0x1a')],_0x15eba6[_0x56bd('0x1d')]));if(_[_0x56bd('0x1e')](_0x15eba6[_0x56bd('0x1d')],_0x56bd('0x1f'))){_0x15eba6['value']=_0x15eba6[_0x56bd('0x1d')][_0x56bd('0x20')](_0x56bd('0x1f'),_0x56bd('0x21'));}if(recordings[_0x15eba6['linkedid']]){var _0xd3c8da=_['find'](recordings[_0x15eba6[_0x56bd('0xe')]][_0x56bd('0x22')],{'value':_0x15eba6[_0x56bd('0x1d')]});if(_[_0x56bd('0x16')](_0xd3c8da)){recordings[_0x15eba6[_0x56bd('0xe')]][_0x56bd('0x22')][_0x56bd('0x23')]({'value':_0x15eba6['value']});}}}}catch(_0x22c977){utils[_0x56bd('0x13')](util[_0x56bd('0x3')]('[%s][recordings][varset]',_0x15eba6[_0x56bd('0x4')]),_0x22c977);}};exports[_0x56bd('0x24')]=function(_0x466a40){try{if(!_['isNil'](recordings[_0x466a40['uniqueid']])){utils[_0x56bd('0x14')](util[_0x56bd('0x3')](_0x56bd('0x25'),_0x466a40[_0x56bd('0x4')]),_0x466a40);utils[_0x56bd('0xf')](util[_0x56bd('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x466a40[_0x56bd('0x4')],_0x466a40[_0x56bd('0x26')],_0x466a40[_0x56bd('0x27')],_0x466a40[_0x56bd('0x28')]));recordings[_0x466a40[_0x56bd('0x4')]][_0x56bd('0x26')]=_0x466a40[_0x56bd('0x26')];recordings[_0x466a40['uniqueid']][_0x56bd('0x27')]=_0x466a40['calleridname'];recordings[_0x466a40[_0x56bd('0x4')]][_0x56bd('0x29')]=_0x466a40[_0x56bd('0x29')];recordings[_0x466a40[_0x56bd('0x4')]][_0x56bd('0x2a')]=_0x466a40[_0x56bd('0x2a')];if(recordings[_0x466a40[_0x56bd('0x4')]]['type']==_0x56bd('0x2b')&&recordings[_0x466a40[_0x56bd('0x4')]][_0x56bd('0x5')]){recordings[_0x466a40[_0x56bd('0x4')]]['connectedlinenum']=recordings[_0x466a40[_0x56bd('0x4')]]['accountcode'];recordings[_0x466a40[_0x56bd('0x4')]]['connectedlinename']='';}recordings[_0x466a40['uniqueid']]['monitors'][_0x56bd('0x2c')](function(_0x43750c){var _0x5f1619=_[_0x56bd('0x2d')](recordings[_0x466a40[_0x56bd('0x4')]]);_0x5f1619[_0x56bd('0x1d')]=_0x43750c[_0x56bd('0x1d')];writeDB(_0x5f1619);});delete recordings[_0x466a40[_0x56bd('0x4')]];}}catch(_0x18f211){utils[_0x56bd('0x13')](util['format'](_0x56bd('0x25'),_0x466a40[_0x56bd('0x4')]),_0x18f211);}};exports[_0x56bd('0x2e')]=function(_0x2ed15c){try{if(!_['isNil'](recordings[_0x2ed15c[_0x56bd('0x4')]])){utils[_0x56bd('0x14')](util['format'](_0x56bd('0x2f'),_0x2ed15c[_0x56bd('0x4')]),_0x2ed15c);utils[_0x56bd('0xf')](util[_0x56bd('0x3')](_0x56bd('0x30'),_0x2ed15c[_0x56bd('0x4')],_0x2ed15c[_0x56bd('0x31')],_0x2ed15c['appdata']));if(_0x2ed15c[_0x56bd('0x31')]['toLowerCase']()=='set'&&_[_0x56bd('0x32')](_0x2ed15c[_0x56bd('0x33')][_0x56bd('0x34')](),_0x56bd('0x35'))){var _0x289284=_0x2ed15c['appdata']['split']('=');var _0x5e3ff3=_0x289284[0x0][_0x56bd('0x36')](_0x289284[0x0][_0x56bd('0x37')]('(')+0x1,_0x289284[0x0]['lastIndexOf'](')'));var _0x2c8128=_0x289284[0x1];recordings[_0x2ed15c[_0x56bd('0x4')]][_0x5e3ff3]=_0x2c8128;}}}catch(_0x1c07c9){utils[_0x56bd('0x13')](util[_0x56bd('0x3')](_0x56bd('0x2f'),_0x2ed15c[_0x56bd('0x4')]),_0x1c07c9);}};exports[_0x56bd('0x38')]=function(_0x3f5b3c){try{if(!_[_0x56bd('0x16')](recordings[_0x3f5b3c[_0x56bd('0x4')]])){utils['debug'](util[_0x56bd('0x3')](_0x56bd('0x39'),_0x3f5b3c['uniqueid']),_0x3f5b3c);utils[_0x56bd('0xf')](util['format'](_0x56bd('0x3a'),_0x3f5b3c[_0x56bd('0x4')],_0x3f5b3c[_0x56bd('0x3b')]));recordings[_0x3f5b3c[_0x56bd('0x4')]]['queue']=_0x3f5b3c[_0x56bd('0x3b')];}}catch(_0x1f7af3){utils[_0x56bd('0x13')](util[_0x56bd('0x3')]('[%s][recordings][queuecallerjoin]',_0x3f5b3c[_0x56bd('0x4')]),_0x1f7af3);}}; \ No newline at end of file +var _0x6da0=['error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','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','find','monitors','push','[%s][recordings][hangup]','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','newexten','application','toLowerCase','set','startsWith','appdata','cdr','split','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','./utils','info','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','CreateVoiceRecording','request','newchannel','debug','format','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel'];(function(_0x382e91,_0x44a504){var _0x3a0b2d=function(_0x49c9d6){while(--_0x49c9d6){_0x382e91['push'](_0x382e91['shift']());}};_0x3a0b2d(++_0x44a504);}(_0x6da0,0x154));var _0x06da=function(_0x1eea6d,_0x553517){_0x1eea6d=_0x1eea6d-0x0;var _0xcde937=_0x6da0[_0x1eea6d];return _0xcde937;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x06da('0x0'));var recordings={};function writeDB(_0x484c84){utils[_0x06da('0x1')](util['format'](_0x06da('0x2'),_0x484c84[_0x06da('0x3')]));if(_0x484c84[_0x06da('0x4')]){utils[_0x06da('0x5')](_0x484c84[_0x06da('0x4')])[_0x06da('0x6')](function(_0x1d4ea9){if(_0x1d4ea9){_0x484c84[_0x06da('0x7')]=_0x1d4ea9[_0x06da('0x8')];_0x484c84['UserId']=_0x1d4ea9['id'];}utils['request'](_0x06da('0x9'),_0x484c84);});}else{utils[_0x06da('0xa')](_0x06da('0x9'),_0x484c84);}}exports[_0x06da('0xb')]=function(_0x341123){try{utils[_0x06da('0xc')](util[_0x06da('0xd')](_0x06da('0xe'),_0x341123['uniqueid']),_0x341123);if(_0x341123['uniqueid']==_0x341123[_0x06da('0xf')]){utils['info'](util[_0x06da('0xd')](_0x06da('0x10'),_0x341123[_0x06da('0x3')],_0x341123[_0x06da('0x11')],_0x341123[_0x06da('0x12')]));recordings[_0x341123[_0x06da('0x3')]]={'uniqueid':_0x341123[_0x06da('0x3')],'accountcode':_0x341123[_0x06da('0x4')],'exten':_0x341123['exten'],'context':_0x341123[_0x06da('0x11')],'channel':_0x341123[_0x06da('0x13')],'monitors':[]};}}catch(_0x2d4f0c){utils[_0x06da('0x14')](util[_0x06da('0xd')](_0x06da('0xe'),_0x341123['uniqueid']),_0x2d4f0c);}};exports[_0x06da('0x15')]=function(_0xb3c692){try{utils[_0x06da('0xc')](util['format'](_0x06da('0x16'),_0xb3c692[_0x06da('0x3')]),_0xb3c692);if(!_[_0x06da('0x17')](recordings[_0xb3c692[_0x06da('0x3')]])&&_0xb3c692[_0x06da('0x18')]==0x6){utils[_0x06da('0x1')](util['format'](_0x06da('0x19'),_0xb3c692[_0x06da('0x3')],_0xb3c692[_0x06da('0x11')],_0xb3c692['channel']));}else if(!_[_0x06da('0x17')](recordings[_0xb3c692['linkedid']])&&_0xb3c692[_0x06da('0x18')]==0x6&&_0xb3c692[_0x06da('0x11')]!=_0x06da('0x1a')){utils[_0x06da('0x1')](util[_0x06da('0xd')](_0x06da('0x1b'),_0xb3c692[_0x06da('0x3')],_0xb3c692['linkedid'],_0xb3c692[_0x06da('0x11')],_0xb3c692['channel']));recordings[_0xb3c692[_0x06da('0xf')]][_0x06da('0x4')]=_0xb3c692[_0x06da('0x4')];}}catch(_0x1eda1e){utils[_0x06da('0x14')](util[_0x06da('0xd')]('[%s][recordings][newstate]',_0xb3c692[_0x06da('0x3')]),_0x1eda1e);}};exports[_0x06da('0x1c')]=function(_0x5577a1){try{if(!_[_0x06da('0x17')](_0x5577a1[_0x06da('0x1d')])&&!_[_0x06da('0x17')](_0x5577a1[_0x06da('0x1d')][_0x06da('0x1e')])){utils[_0x06da('0xc')](util[_0x06da('0xd')](_0x06da('0x1f'),_0x5577a1['uniqueid']),_0x5577a1);utils['info'](util[_0x06da('0xd')](_0x06da('0x20'),_0x5577a1['uniqueid'],_0x5577a1[_0x06da('0x1d')],_0x5577a1[_0x06da('0x21')]));if(_[_0x06da('0x22')](_0x5577a1[_0x06da('0x21')],_0x06da('0x23'))){_0x5577a1[_0x06da('0x21')]=_0x5577a1[_0x06da('0x21')]['replace']('.wav49','.WAV');}if(recordings[_0x5577a1[_0x06da('0xf')]]){var _0xcdfac7=_[_0x06da('0x24')](recordings[_0x5577a1[_0x06da('0xf')]][_0x06da('0x25')],{'value':_0x5577a1[_0x06da('0x21')]});if(_[_0x06da('0x17')](_0xcdfac7)){recordings[_0x5577a1[_0x06da('0xf')]][_0x06da('0x25')][_0x06da('0x26')]({'value':_0x5577a1[_0x06da('0x21')]});}}}}catch(_0x3f9ab3){utils['error'](util[_0x06da('0xd')]('[%s][recordings][varset]',_0x5577a1[_0x06da('0x3')]),_0x3f9ab3);}};exports['hangup']=function(_0x394985){try{if(!_[_0x06da('0x17')](recordings[_0x394985[_0x06da('0x3')]])){utils[_0x06da('0xc')](util[_0x06da('0xd')](_0x06da('0x27'),_0x394985[_0x06da('0x3')]),_0x394985);utils[_0x06da('0x1')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x394985[_0x06da('0x3')],_0x394985[_0x06da('0x28')],_0x394985['calleridname'],_0x394985[_0x06da('0x29')]));recordings[_0x394985[_0x06da('0x3')]][_0x06da('0x28')]=_0x394985['calleridnum'];recordings[_0x394985[_0x06da('0x3')]][_0x06da('0x2a')]=_0x394985[_0x06da('0x2a')];recordings[_0x394985[_0x06da('0x3')]][_0x06da('0x2b')]=_0x394985[_0x06da('0x2b')];recordings[_0x394985[_0x06da('0x3')]][_0x06da('0x2c')]=_0x394985[_0x06da('0x2c')];if(recordings[_0x394985['uniqueid']][_0x06da('0x2d')]==_0x06da('0x2e')&&recordings[_0x394985['uniqueid']]['accountcode']){recordings[_0x394985[_0x06da('0x3')]][_0x06da('0x2b')]=recordings[_0x394985[_0x06da('0x3')]]['accountcode'];recordings[_0x394985[_0x06da('0x3')]][_0x06da('0x2c')]='';}recordings[_0x394985['uniqueid']][_0x06da('0x25')]['forEach'](function(_0x2bc9bc){var _0x44bb4e=_['clone'](recordings[_0x394985[_0x06da('0x3')]]);_0x44bb4e[_0x06da('0x21')]=_0x2bc9bc[_0x06da('0x21')];writeDB(_0x44bb4e);});delete recordings[_0x394985[_0x06da('0x3')]];}}catch(_0x552685){utils[_0x06da('0x14')](util[_0x06da('0xd')](_0x06da('0x27'),_0x394985[_0x06da('0x3')]),_0x552685);}};exports[_0x06da('0x2f')]=function(_0x5598f8){try{if(!_[_0x06da('0x17')](recordings[_0x5598f8[_0x06da('0x3')]])){utils[_0x06da('0xc')](util[_0x06da('0xd')]('[%s][recordings][newexten]',_0x5598f8[_0x06da('0x3')]),_0x5598f8);utils[_0x06da('0x1')](util[_0x06da('0xd')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x5598f8['uniqueid'],_0x5598f8[_0x06da('0x30')],_0x5598f8['appdata']));if(_0x5598f8[_0x06da('0x30')][_0x06da('0x31')]()==_0x06da('0x32')&&_[_0x06da('0x33')](_0x5598f8[_0x06da('0x34')][_0x06da('0x31')](),_0x06da('0x35'))){var _0x2ef4ce=_0x5598f8['appdata'][_0x06da('0x36')]('=');var _0x4d4fd0=_0x2ef4ce[0x0]['substring'](_0x2ef4ce[0x0]['lastIndexOf']('(')+0x1,_0x2ef4ce[0x0]['lastIndexOf'](')'));var _0xad4190=_0x2ef4ce[0x1];recordings[_0x5598f8[_0x06da('0x3')]][_0x4d4fd0]=_0xad4190;}}}catch(_0x3a6cdb){utils[_0x06da('0x14')](util[_0x06da('0xd')](_0x06da('0x37'),_0x5598f8[_0x06da('0x3')]),_0x3a6cdb);}};exports[_0x06da('0x38')]=function(_0x4f9a41){try{if(!_['isNil'](recordings[_0x4f9a41[_0x06da('0x3')]])){utils[_0x06da('0xc')](util[_0x06da('0xd')](_0x06da('0x39'),_0x4f9a41[_0x06da('0x3')]),_0x4f9a41);utils[_0x06da('0x1')](util[_0x06da('0xd')](_0x06da('0x3a'),_0x4f9a41[_0x06da('0x3')],_0x4f9a41[_0x06da('0x3b')]));recordings[_0x4f9a41[_0x06da('0x3')]]['queue']=_0x4f9a41[_0x06da('0x3b')];}}catch(_0x2fd874){utils[_0x06da('0x14')](util[_0x06da('0xd')](_0x06da('0x39'),_0x4f9a41[_0x06da('0x3')]),_0x2fd874);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 9b3d6bb..19f3a30 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 _0xa0b0=['assign','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','error','[%s][transfers][attendedtransfer]','lodash','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','request','CreateVoiceTransferReport','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','uniqueid','transfereecalleridnum','transfereecalleridname','blind','attendedtransfer','debug','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname'];(function(_0x46952f,_0x508142){var _0x5e2b31=function(_0xf94c25){while(--_0xf94c25){_0x46952f['push'](_0x46952f['shift']());}};_0x5e2b31(++_0x508142);}(_0xa0b0,0x122));var _0x0a0b=function(_0x2e9a26,_0x464d38){_0x2e9a26=_0x2e9a26-0x0;var _0x4259c2=_0xa0b0[_0x2e9a26];return _0x4259c2;};'use strict';var _=require(_0x0a0b('0x0'));var util=require('util');var utils=require(_0x0a0b('0x1'));function writeDB(_0x28c21d){utils[_0x0a0b('0x2')](util[_0x0a0b('0x3')](_0x0a0b('0x4'),_0x28c21d[_0x0a0b('0x5')]===_0x0a0b('0x6')?_0x28c21d[_0x0a0b('0x7')]:_0x28c21d['uniqueid'],_0x28c21d['type']));utils[_0x0a0b('0x8')](_0x0a0b('0x9'),_0x28c21d);}exports['blindtransfer']=function(_0x2dcfa9){try{utils['debug'](util['format'](_0x0a0b('0xa'),_0x2dcfa9['uniqueid']),_0x2dcfa9);utils[_0x0a0b('0x2')](util[_0x0a0b('0x3')](_0x0a0b('0xb'),_0x2dcfa9[_0x0a0b('0xc')],_0x2dcfa9['transferercalleridnum'],_0x2dcfa9['transferercalleridname'],_0x2dcfa9[_0x0a0b('0xd')],_0x2dcfa9[_0x0a0b('0xe')]));_0x2dcfa9[_0x0a0b('0x5')]=_0x0a0b('0xf');writeDB(_0x2dcfa9);}catch(_0x49ca05){utils['error'](util['format'](_0x0a0b('0xa'),_0x2dcfa9[_0x0a0b('0xc')]),_0x49ca05);}};exports[_0x0a0b('0x10')]=function(_0x22a2db){try{utils[_0x0a0b('0x11')](util[_0x0a0b('0x3')]('[%s][transfers][attendedtransfer]',_0x22a2db[_0x0a0b('0x7')]),_0x22a2db);utils[_0x0a0b('0x2')](util[_0x0a0b('0x3')](_0x0a0b('0x12'),_0x22a2db[_0x0a0b('0x7')],_0x22a2db['origtransferercalleridnum'],_0x22a2db[_0x0a0b('0x13')],_0x22a2db[_0x0a0b('0x14')],_0x22a2db[_0x0a0b('0x15')]));_0x22a2db=_[_0x0a0b('0x16')](_0x22a2db,{'transfererchannel':_0x22a2db['origtransfererchannel'],'transferercalleridnum':_0x22a2db[_0x0a0b('0x17')],'transferercalleridname':_0x22a2db[_0x0a0b('0x13')],'transfererconnectedlinenum':_0x22a2db[_0x0a0b('0x18')],'transfererconnectedlinename':_0x22a2db[_0x0a0b('0x19')],'transfereraccountcode':_0x22a2db[_0x0a0b('0x1a')],'transferercontext':_0x22a2db['secondtransferercontext'],'transfererexten':_0x22a2db[_0x0a0b('0x1b')],'transfererlinkedid':_0x22a2db[_0x0a0b('0x1c')],'context':_0x22a2db[_0x0a0b('0x1d')],'extension':_0x22a2db[_0x0a0b('0x1e')],'type':'attended'});if(_['isNil'](_0x22a2db[_0x0a0b('0x1f')])){_0x22a2db=_[_0x0a0b('0x16')](_0x22a2db,{'transfereechannel':_0x22a2db[_0x0a0b('0x20')],'transfereecalleridnum':_0x22a2db[_0x0a0b('0x14')],'transfereecalleridname':_0x22a2db[_0x0a0b('0x15')],'transfereeconnectedlinenum':_0x22a2db[_0x0a0b('0x21')],'transfereeconnectedlinename':_0x22a2db['transfertargetconnectedlinename'],'transfereeaccountcode':_0x22a2db[_0x0a0b('0x22')],'transfereecontext':_0x22a2db['transfertargetcontext'],'transfereeexten':_0x22a2db[_0x0a0b('0x23')],'transfereelinkedid':_0x22a2db[_0x0a0b('0x24')]});}writeDB(_0x22a2db);}catch(_0x581357){utils[_0x0a0b('0x25')](util[_0x0a0b('0x3')](_0x0a0b('0x26'),_0x22a2db[_0x0a0b('0x7')]),_0x581357);}}; \ No newline at end of file +var _0x13b6=['error','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','origtransfereruniqueid','type','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','blind'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x13b6,0xf0));var _0x613b=function(_0x23f2aa,_0x2cbe18){_0x23f2aa=_0x23f2aa-0x0;var _0x1850f8=_0x13b6[_0x23f2aa];return _0x1850f8;};'use strict';var _=require(_0x613b('0x0'));var util=require(_0x613b('0x1'));var utils=require(_0x613b('0x2'));function writeDB(_0x3b55f4){utils[_0x613b('0x3')](util[_0x613b('0x4')](_0x613b('0x5'),_0x3b55f4['type']==='attended'?_0x3b55f4[_0x613b('0x6')]:_0x3b55f4['uniqueid'],_0x3b55f4[_0x613b('0x7')]));utils['request'](_0x613b('0x8'),_0x3b55f4);}exports[_0x613b('0x9')]=function(_0x15e0a2){try{utils[_0x613b('0xa')](util[_0x613b('0x4')](_0x613b('0xb'),_0x15e0a2[_0x613b('0xc')]),_0x15e0a2);utils[_0x613b('0x3')](util[_0x613b('0x4')](_0x613b('0xd'),_0x15e0a2['uniqueid'],_0x15e0a2[_0x613b('0xe')],_0x15e0a2[_0x613b('0xf')],_0x15e0a2['transfereecalleridnum'],_0x15e0a2[_0x613b('0x10')]));_0x15e0a2['type']=_0x613b('0x11');writeDB(_0x15e0a2);}catch(_0x5cb9bc){utils[_0x613b('0x12')](util['format'](_0x613b('0xb'),_0x15e0a2[_0x613b('0xc')]),_0x5cb9bc);}};exports[_0x613b('0x13')]=function(_0x27e2ff){try{utils['debug'](util['format']('[%s][transfers][attendedtransfer]',_0x27e2ff[_0x613b('0x6')]),_0x27e2ff);utils[_0x613b('0x3')](util[_0x613b('0x4')](_0x613b('0x14'),_0x27e2ff[_0x613b('0x6')],_0x27e2ff['origtransferercalleridnum'],_0x27e2ff[_0x613b('0x15')],_0x27e2ff[_0x613b('0x16')],_0x27e2ff[_0x613b('0x17')]));_0x27e2ff=_[_0x613b('0x18')](_0x27e2ff,{'transfererchannel':_0x27e2ff[_0x613b('0x19')],'transferercalleridnum':_0x27e2ff[_0x613b('0x1a')],'transferercalleridname':_0x27e2ff[_0x613b('0x15')],'transfererconnectedlinenum':_0x27e2ff[_0x613b('0x1b')],'transfererconnectedlinename':_0x27e2ff[_0x613b('0x1c')],'transfereraccountcode':_0x27e2ff[_0x613b('0x1d')],'transferercontext':_0x27e2ff[_0x613b('0x1e')],'transfererexten':_0x27e2ff['secondtransfererexten'],'transfererlinkedid':_0x27e2ff[_0x613b('0x1f')],'context':_0x27e2ff[_0x613b('0x20')],'extension':_0x27e2ff[_0x613b('0x21')],'type':'attended'});if(_[_0x613b('0x22')](_0x27e2ff['transfereechannel'])){_0x27e2ff=_[_0x613b('0x18')](_0x27e2ff,{'transfereechannel':_0x27e2ff[_0x613b('0x23')],'transfereecalleridnum':_0x27e2ff['transfertargetcalleridnum'],'transfereecalleridname':_0x27e2ff[_0x613b('0x17')],'transfereeconnectedlinenum':_0x27e2ff[_0x613b('0x24')],'transfereeconnectedlinename':_0x27e2ff[_0x613b('0x25')],'transfereeaccountcode':_0x27e2ff[_0x613b('0x26')],'transfereecontext':_0x27e2ff[_0x613b('0x27')],'transfereeexten':_0x27e2ff[_0x613b('0x28')],'transfereelinkedid':_0x27e2ff[_0x613b('0x29')]});}writeDB(_0x27e2ff);}catch(_0x135b58){utils['error'](util[_0x613b('0x4')](_0x613b('0x2a'),_0x27e2ff[_0x613b('0x6')]),_0x135b58);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index dfae02b..4b3e24e 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 _0x9adc=['now','isAfter','isBefore','bluebird','moment','util','client','http','info','inspect','debug','error','request','[utils][request]\x20name:%s','GetUser','internal','name','interface','then','stringify','result','[utils][getUserByInternal]\x20internal:%s\x20%s','found','catch','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','diffTime','sumTime'];(function(_0x8147c4,_0x3e73f5){var _0x47abe9=function(_0x52bdfc){while(--_0x52bdfc){_0x8147c4['push'](_0x8147c4['shift']());}};_0x47abe9(++_0x3e73f5);}(_0x9adc,0xaf));var _0xc9ad=function(_0x2b9678,_0x3509ca){_0x2b9678=_0x2b9678-0x0;var _0x350b95=_0x9adc[_0x2b9678];return _0x350b95;};'use strict';var BPromise=require(_0xc9ad('0x0'));var jayson=require('jayson/promise');var moment=require(_0xc9ad('0x1'));var util=require(_0xc9ad('0x2'));var client=jayson[_0xc9ad('0x3')][_0xc9ad('0x4')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0xc9ad('0x5')]=function(_0x2995cd,_0x1e1093){logger[_0xc9ad('0x5')](_0x2995cd,_0x1e1093?util[_0xc9ad('0x6')](_0x1e1093,{'showHidden':![],'depth':null}):'');};exports[_0xc9ad('0x7')]=function(_0x4a0dd5,_0x46ea17){logger['debug'](_0x4a0dd5,_0x46ea17?util['inspect'](_0x46ea17,{'showHidden':![],'depth':null}):'');};exports[_0xc9ad('0x8')]=function(_0x208221,_0x278c7f){logger[_0xc9ad('0x8')](_0x208221,_0x278c7f?util[_0xc9ad('0x6')](_0x278c7f,{'showHidden':![],'depth':null}):'');};exports[_0xc9ad('0x9')]=function(_0x33b45d,_0x11a33c){return client['request'](_0x33b45d,{'body':_0x11a33c})['then'](function(_0x1ee0cf){logger['debug'](_0xc9ad('0xa'),_0x33b45d,_0x1ee0cf?util[_0xc9ad('0x6')](_0x1ee0cf,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x283375){logger[_0xc9ad('0x8')](_0xc9ad('0xa'),_0x33b45d,_0x283375?util[_0xc9ad('0x6')](_0x283375,{'showHidden':![],'depth':null}):'');});};function getUser(_0x461f26){return client[_0xc9ad('0x9')](_0xc9ad('0xb'),{'options':{'raw':!![],'attributes':['id',_0xc9ad('0xc'),_0xc9ad('0xd'),_0xc9ad('0xe')],'where':_0x461f26,'limit':0x1}})[_0xc9ad('0xf')](function(_0x5f389f){logger[_0xc9ad('0x7')]('[utils][getUser]\x20where:%s',JSON[_0xc9ad('0x10')](_0x461f26),_0x5f389f?util[_0xc9ad('0x6')](_0x5f389f,{'showHidden':![],'depth':null}):'');return _0x5f389f[_0xc9ad('0x11')]['length']?_0x5f389f[_0xc9ad('0x11')][0x0]:null;});}exports['getUserByInternal']=function(_0x1eb070){return new BPromise(function(_0x4b6222,_0xb06375){if(_0x1eb070){return getUser({'internal':_0x1eb070})['then'](function(_0x54df6a){logger[_0xc9ad('0x5')](_0xc9ad('0x12'),_0x1eb070,_0x54df6a?_0xc9ad('0x13'):'notfound');return _0x4b6222(_0x54df6a);})[_0xc9ad('0x14')](function(_0x5bf5ff){logger[_0xc9ad('0x8')]('[utils][getUserByInternal]',_0x5bf5ff?util[_0xc9ad('0x6')](_0x5bf5ff,{'showHidden':![],'depth':null}):'');return _0x4b6222(null);});}return _0x4b6222(null);});};exports[_0xc9ad('0x15')]=function(_0x1ef42e){return new BPromise(function(_0x2e7d53,_0x39a008){if(_0x1ef42e){return getUser({'interface':_0x1ef42e})[_0xc9ad('0xf')](function(_0x45fddc){logger[_0xc9ad('0x5')](_0xc9ad('0x16'),_0x1ef42e,_0x45fddc?_0xc9ad('0x13'):_0xc9ad('0x17'));return _0x2e7d53(_0x45fddc);})[_0xc9ad('0x14')](function(_0x5c2025){logger['error']('[utils][getUserByInterface]',_0x5c2025?util[_0xc9ad('0x6')](_0x5c2025,{'showHidden':![],'depth':null}):'');return _0x2e7d53(null);});}return _0x2e7d53(null);});};exports['getUserByName']=function(_0x189067){return new BPromise(function(_0x32852b,_0x2738f){if(_0x189067){return getUser({'name':_0x189067})[_0xc9ad('0xf')](function(_0x30f5d2){logger['info'](_0xc9ad('0x18'),_0x189067,_0x30f5d2?'found':'notfound');return _0x32852b(_0x30f5d2);})['catch'](function(_0x730617){logger['error']('[utils][getUserByName]',_0x730617?util[_0xc9ad('0x6')](_0x730617,{'showHidden':![],'depth':null}):'');return _0x32852b(null);});}return _0x32852b(null);});};exports[_0xc9ad('0x19')]=function(_0x16a918){return new BPromise(function(_0x1dc8a3,_0x52ca4c){if(_0x16a918){return client['request']('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xc9ad('0xd'),_0xc9ad('0x1a'),_0xc9ad('0x1b'),'acwTimeout'],'where':{'name':_0x16a918},'limit':0x1}})[_0xc9ad('0xf')](function(_0x24092c){logger[_0xc9ad('0x7')](_0xc9ad('0x1c'),_0x16a918,_0x24092c?util[_0xc9ad('0x6')](_0x24092c,{'showHidden':![],'depth':null}):'');logger[_0xc9ad('0x5')](_0xc9ad('0x1d'),_0x16a918,_0x24092c?_0xc9ad('0x13'):_0xc9ad('0x17'));return _0x1dc8a3(_0x24092c[_0xc9ad('0x11')][_0xc9ad('0x1e')]?_0x24092c[_0xc9ad('0x11')][0x0]:null);})[_0xc9ad('0x14')](function(_0xe08901){logger[_0xc9ad('0x8')](_0xc9ad('0x1f'),_0xe08901?util['inspect'](_0xe08901,{'showHidden':![],'depth':null}):'');return _0x1dc8a3(null);});}return _0x1dc8a3(null);});};exports['addTime']=function(_0x4527dd,_0x494e50){return moment(_0x4527dd)[_0xc9ad('0x20')](_0x494e50,_0xc9ad('0x21'))['format'](_0xc9ad('0x22'));};exports[_0xc9ad('0x23')]=function(_0x4dcda5,_0xc2462b){return moment(_0x4dcda5)[_0xc9ad('0x24')](_0xc2462b,_0xc9ad('0x21'))[_0xc9ad('0x25')](_0xc9ad('0x22'));};exports[_0xc9ad('0x26')]=function(_0x3ceb25,_0x375de1){return moment(_0x3ceb25)['diff'](moment(_0x375de1),_0xc9ad('0x21'));};exports[_0xc9ad('0x27')]=function(_0x4e4ab6,_0x580647){return parseInt(_0x4e4ab6,0xa)+parseInt(_0x580647,0xa);};exports[_0xc9ad('0x28')]=function(){return moment()['format'](_0xc9ad('0x22'));};exports[_0xc9ad('0x29')]=function(_0x54d425,_0x11fc1b){if(_0x11fc1b){return moment(_0x54d425)[_0xc9ad('0x29')](_0x11fc1b);}return!![];};exports[_0xc9ad('0x2a')]=function(_0x116dd2,_0x1e0ec){if(_0x1e0ec){return moment(_0x116dd2)[_0xc9ad('0x2a')](_0x1e0ec);}else if(_0x116dd2){return!![];}return![];}; \ No newline at end of file +var _0x08af=['getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','addTime','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','util','http','../../config/logger','xdr','info','inspect','debug','error','[utils][request]\x20name:%s','catch','request','GetUser','name','interface','then','stringify','length','result','getUserByInternal','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]'];(function(_0x50f90a,_0x2b1d96){var _0x20d088=function(_0xf97300){while(--_0xf97300){_0x50f90a['push'](_0x50f90a['shift']());}};_0x20d088(++_0x2b1d96);}(_0x08af,0x1c2));var _0xf08a=function(_0x119769,_0x32865d){_0x119769=_0x119769-0x0;var _0x105c19=_0x08af[_0x119769];return _0x105c19;};'use strict';var BPromise=require(_0xf08a('0x0'));var jayson=require(_0xf08a('0x1'));var moment=require('moment');var util=require(_0xf08a('0x2'));var client=jayson['client'][_0xf08a('0x3')]({'port':0x2329});var logger=require(_0xf08a('0x4'))(_0xf08a('0x5'));exports[_0xf08a('0x6')]=function(_0x5d6f56,_0x48fe49){logger['info'](_0x5d6f56,_0x48fe49?util[_0xf08a('0x7')](_0x48fe49,{'showHidden':![],'depth':null}):'');};exports[_0xf08a('0x8')]=function(_0x25582c,_0x2eda90){logger[_0xf08a('0x8')](_0x25582c,_0x2eda90?util[_0xf08a('0x7')](_0x2eda90,{'showHidden':![],'depth':null}):'');};exports[_0xf08a('0x9')]=function(_0x50d443,_0x7aaf98){logger[_0xf08a('0x9')](_0x50d443,_0x7aaf98?util[_0xf08a('0x7')](_0x7aaf98,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x4757f4,_0x56ac6c){return client['request'](_0x4757f4,{'body':_0x56ac6c})['then'](function(_0x1ccd7c){logger[_0xf08a('0x8')](_0xf08a('0xa'),_0x4757f4,_0x1ccd7c?util[_0xf08a('0x7')](_0x1ccd7c,{'showHidden':![],'depth':null}):'');})[_0xf08a('0xb')](function(_0x1c2a9a){logger['error']('[utils][request]\x20name:%s',_0x4757f4,_0x1c2a9a?util[_0xf08a('0x7')](_0x1c2a9a,{'showHidden':![],'depth':null}):'');});};function getUser(_0xfd6c4){return client[_0xf08a('0xc')](_0xf08a('0xd'),{'options':{'raw':!![],'attributes':['id','internal',_0xf08a('0xe'),_0xf08a('0xf')],'where':_0xfd6c4,'limit':0x1}})[_0xf08a('0x10')](function(_0x398e34){logger['debug']('[utils][getUser]\x20where:%s',JSON[_0xf08a('0x11')](_0xfd6c4),_0x398e34?util[_0xf08a('0x7')](_0x398e34,{'showHidden':![],'depth':null}):'');return _0x398e34['result'][_0xf08a('0x12')]?_0x398e34[_0xf08a('0x13')][0x0]:null;});}exports[_0xf08a('0x14')]=function(_0x4ea043){return new BPromise(function(_0x2dce66,_0x7fe64){if(_0x4ea043){return getUser({'internal':_0x4ea043})['then'](function(_0x3fffc0){logger[_0xf08a('0x6')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x4ea043,_0x3fffc0?_0xf08a('0x15'):_0xf08a('0x16'));return _0x2dce66(_0x3fffc0);})[_0xf08a('0xb')](function(_0x511276){logger[_0xf08a('0x9')](_0xf08a('0x17'),_0x511276?util[_0xf08a('0x7')](_0x511276,{'showHidden':![],'depth':null}):'');return _0x2dce66(null);});}return _0x2dce66(null);});};exports[_0xf08a('0x18')]=function(_0x537080){return new BPromise(function(_0x4fc485,_0x4377f4){if(_0x537080){return getUser({'interface':_0x537080})[_0xf08a('0x10')](function(_0x309fce){logger[_0xf08a('0x6')](_0xf08a('0x19'),_0x537080,_0x309fce?_0xf08a('0x15'):_0xf08a('0x16'));return _0x4fc485(_0x309fce);})[_0xf08a('0xb')](function(_0x1eeb39){logger['error'](_0xf08a('0x1a'),_0x1eeb39?util[_0xf08a('0x7')](_0x1eeb39,{'showHidden':![],'depth':null}):'');return _0x4fc485(null);});}return _0x4fc485(null);});};exports[_0xf08a('0x1b')]=function(_0x5de006){return new BPromise(function(_0x145b95,_0x4ee7fd){if(_0x5de006){return getUser({'name':_0x5de006})[_0xf08a('0x10')](function(_0x539fba){logger[_0xf08a('0x6')](_0xf08a('0x1c'),_0x5de006,_0x539fba?_0xf08a('0x15'):'notfound');return _0x145b95(_0x539fba);})['catch'](function(_0x21d92d){logger['error'](_0xf08a('0x1d'),_0x21d92d?util['inspect'](_0x21d92d,{'showHidden':![],'depth':null}):'');return _0x145b95(null);});}return _0x145b95(null);});};exports[_0xf08a('0x1e')]=function(_0x2e59a3){return new BPromise(function(_0x200bf6,_0x3f4e13){if(_0x2e59a3){return client['request'](_0xf08a('0x1f'),{'options':{'raw':!![],'attributes':['id',_0xf08a('0xe'),'type',_0xf08a('0x20'),_0xf08a('0x21')],'where':{'name':_0x2e59a3},'limit':0x1}})[_0xf08a('0x10')](function(_0x4eb7a3){logger[_0xf08a('0x8')](_0xf08a('0x22'),_0x2e59a3,_0x4eb7a3?util[_0xf08a('0x7')](_0x4eb7a3,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x2e59a3,_0x4eb7a3?'found':_0xf08a('0x16'));return _0x200bf6(_0x4eb7a3[_0xf08a('0x13')][_0xf08a('0x12')]?_0x4eb7a3[_0xf08a('0x13')][0x0]:null);})[_0xf08a('0xb')](function(_0x345c47){logger[_0xf08a('0x9')]('[utils][getVoiceQueueByName]',_0x345c47?util[_0xf08a('0x7')](_0x345c47,{'showHidden':![],'depth':null}):'');return _0x200bf6(null);});}return _0x200bf6(null);});};exports[_0xf08a('0x23')]=function(_0x37f038,_0x35861a){return moment(_0x37f038)[_0xf08a('0x24')](_0x35861a,_0xf08a('0x25'))[_0xf08a('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xf08a('0x27')]=function(_0x4160af,_0x5cdf78){return moment(_0x4160af)[_0xf08a('0x28')](_0x5cdf78,_0xf08a('0x25'))[_0xf08a('0x26')](_0xf08a('0x29'));};exports[_0xf08a('0x2a')]=function(_0x2d308b,_0x4afe5e){return moment(_0x2d308b)[_0xf08a('0x2b')](moment(_0x4afe5e),_0xf08a('0x25'));};exports[_0xf08a('0x2c')]=function(_0x16e654,_0x2842ec){return parseInt(_0x16e654,0xa)+parseInt(_0x2842ec,0xa);};exports[_0xf08a('0x2d')]=function(){return moment()[_0xf08a('0x26')](_0xf08a('0x29'));};exports[_0xf08a('0x2e')]=function(_0x1d5c38,_0x28dd8f){if(_0x28dd8f){return moment(_0x1d5c38)['isAfter'](_0x28dd8f);}return!![];};exports[_0xf08a('0x2f')]=function(_0x23b0ce,_0x50a627){if(_0x50a627){return moment(_0x23b0ce)[_0xf08a('0x2f')](_0x50a627);}else if(_0x23b0ce){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 16a0e6c..86bb3da 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 _0xd832=['setupLoggers','fs-extra','lodash','path','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','role','name','ensureDir','then','user','no-user','data','timestamp','error','api','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','format','method','headers','x-forwarded-for','url','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','remoteAddress','other','agent_name','test'];(function(_0x252e71,_0x54c106){var _0x43545c=function(_0x1c6539){while(--_0x1c6539){_0x252e71['push'](_0x252e71['shift']());}};_0x43545c(++_0x54c106);}(_0xd832,0x184));var _0x2d83=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xd832[_0x166d93];return _0xba708;};var fs=require(_0x2d83('0x0'));var _=require(_0x2d83('0x1'));var ewinston=require('express-winston');var path=require(_0x2d83('0x2'));var util=require('util');var fileLogger=require('./loggers')['fileLogger'];var safeTemplate=require('./safe-template')[_0x2d83('0x3')];var maskSensitiveData=require(_0x2d83('0x4'))[_0x2d83('0x5')];function ClientSideLogger(){function _0x5be1cf(_0xbf6fd2){var _0x3f79fd=path[_0x2d83('0x6')](_0x2d83('0x7'),_0x2d83('0x8'),'xcally');var _0x2e549a=path[_0x2d83('0x6')]('client',_0xbf6fd2[_0x2d83('0x9')]+'-'+_0xbf6fd2[_0x2d83('0xa')]);return fs[_0x2d83('0xb')](path['join'](_0x3f79fd,_0x2e549a))[_0x2d83('0xc')](function(){var _0x2fbe40=fileLogger('client',path[_0x2d83('0x6')](_0x3f79fd,_0x2e549a));return _0x2fbe40;})['catch'](function(_0x4c610a){throw _0x4c610a;});}this[_0x2d83('0x8')]=function(_0x2351db,_0x32e189,_0x38c780,_0x3325d0){return _0x5be1cf(_0x2351db[_0x2d83('0xd')])[_0x2d83('0xc')](function(_0x2edd86){var _0x98dafc=_0x2edd86[_0x32e189];return _0x98dafc;})[_0x2d83('0xc')](function(_0x5e40fe){var _0x499fa6=_0x2351db['user']?_0x2351db[_0x2d83('0xd')]['id']:_0x2d83('0xe');var _0x4b3ed7=_0x3325d0[_0x2d83('0xf')];var _0x55d3e9=_0x3325d0[_0x2d83('0x10')];var _0x2d88a8=new Date(Number(_0x55d3e9));return _0x5e40fe(_0x499fa6,_0x2d88a8,_0x38c780,_0x4b3ed7);})['catch'](function(_0x201185){fileLogger('client')[_0x2d83('0x11')](_0x201185);});};}function setupLoggers(_0x4929dc){return new Promise(function(_0x36aadf){var _0x18e768=new ClientSideLogger();var _0x39714c=fileLogger(_0x2d83('0x12'));var _0x51ddd7=fileLogger('auth');_0x4929dc[_0x2d83('0x13')](_0x2d83('0x14'),_0x18e768);_0x4929dc[_0x2d83('0x15')](ewinston[_0x2d83('0x16')]({'winstonInstance':_0x39714c,'meta':![],'statusLevels':!![],'msg':function(_0x2c88fd,_0x4898fb){var _0x540c50=_0x2d83('0x17');if(!_['isEmpty'](_0x2c88fd[_0x2d83('0x18')])){_0x540c50+='\x20body=%s';var _0x1ae49a=_0x2c88fd[_0x2d83('0x18')];maskSensitiveData(_0x1ae49a);}return safeTemplate(util[_0x2d83('0x19')](_0x540c50,_0x2c88fd[_0x2d83('0x1a')],_0x2c88fd[_0x2d83('0x1b')][_0x2d83('0x1c')]?_0x2c88fd['headers'][_0x2d83('0x1c')]:_0x2c88fd['connection']['remoteAddress']||_0x2c88fd['ip'],_0x2c88fd[_0x2d83('0x1d')],_0x4898fb[_0x2d83('0x1e')],_0x4898fb[_0x2d83('0x1f')],_0x2c88fd['user']?_0x2c88fd['user']['id']:null,_0x2c88fd['user']?_0x2c88fd['user'][_0x2d83('0xa')]:null,_0x2c88fd['user']?_0x2c88fd[_0x2d83('0xd')][_0x2d83('0x9')]:null,_0x1ae49a?util[_0x2d83('0x20')](_0x1ae49a,![],null):''));}}));_0x4929dc['use'](ewinston['logger']({'winstonInstance':_0x51ddd7,'meta':![],'statusLevels':!![],'msg':function(_0x747659,_0x551c9c){var _0x8509eb=_0x2d83('0x21');if(_0x747659[_0x2d83('0x18')]&&_0x747659[_0x2d83('0x18')][_0x2d83('0x22')]&&_0x747659[_0x2d83('0x18')][_0x2d83('0x23')]){_0x8509eb=_0x2d83('0x24');}return util[_0x2d83('0x19')](_0x8509eb,_0x747659[_0x2d83('0x1a')],_0x747659[_0x2d83('0x1b')][_0x2d83('0x1c')]?_0x747659[_0x2d83('0x1b')]['x-forwarded-for']:_0x747659[_0x2d83('0x25')][_0x2d83('0x26')]||_0x747659['ip'],_0x747659[_0x2d83('0x1d')],_0x551c9c['statusCode'],_0x551c9c[_0x2d83('0x1f')],_0x747659[_0x2d83('0xd')]?_0x747659[_0x2d83('0xd')]['id']:null,_0x747659['user']?_0x747659[_0x2d83('0xd')][_0x2d83('0xa')]:null,_0x747659[_0x2d83('0xd')]?_0x747659[_0x2d83('0xd')][_0x2d83('0x9')]:null,_0x747659['body']&&_0x747659[_0x2d83('0x18')]['device']?_0x747659['body'][_0x2d83('0x22')]:_0x2d83('0x27'),_0x747659[_0x2d83('0x18')]&&_0x747659[_0x2d83('0x18')]['agent_id']?_0x747659[_0x2d83('0x18')]['agent_id']:'',_0x747659[_0x2d83('0x18')]&&_0x747659[_0x2d83('0x18')][_0x2d83('0x28')]?_0x747659[_0x2d83('0x18')]['agent_name']:'');},'ignoreRoute':function(_0x28d43c){var _0x37d443=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x37d443[_0x2d83('0x29')](_0x28d43c[_0x2d83('0x1d')]);}}));return _0x36aadf();});}exports[_0x2d83('0x2a')]=setupLoggers; \ No newline at end of file +var _0x5d9e=['client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','\x20body=%s','body','format','x-forwarded-for','headers','remoteAddress','statusCode','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','responseTime','other','agent_name','url','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','safeTemplate','maskSensitiveData','/var','log','xcally','join','client','role','name','ensureDir','then','catch','user','data','error','api','auth','set'];(function(_0x19b3f8,_0x150751){var _0x22c3a1=function(_0x16bf0a){while(--_0x16bf0a){_0x19b3f8['push'](_0x19b3f8['shift']());}};_0x22c3a1(++_0x150751);}(_0x5d9e,0x18e));var _0xe5d9=function(_0x1ddf19,_0x59b774){_0x1ddf19=_0x1ddf19-0x0;var _0x4a3c7b=_0x5d9e[_0x1ddf19];return _0x4a3c7b;};var fs=require(_0xe5d9('0x0'));var _=require(_0xe5d9('0x1'));var ewinston=require(_0xe5d9('0x2'));var path=require(_0xe5d9('0x3'));var util=require(_0xe5d9('0x4'));var fileLogger=require(_0xe5d9('0x5'))[_0xe5d9('0x6')];var safeTemplate=require('./safe-template')[_0xe5d9('0x7')];var maskSensitiveData=require('./mask-sensitive-data')[_0xe5d9('0x8')];function ClientSideLogger(){function _0x143efa(_0x13a16f){var _0x4d5a25=path['join'](_0xe5d9('0x9'),_0xe5d9('0xa'),_0xe5d9('0xb'));var _0x40c543=path[_0xe5d9('0xc')](_0xe5d9('0xd'),_0x13a16f[_0xe5d9('0xe')]+'-'+_0x13a16f[_0xe5d9('0xf')]);return fs[_0xe5d9('0x10')](path[_0xe5d9('0xc')](_0x4d5a25,_0x40c543))[_0xe5d9('0x11')](function(){var _0x53dcb3=fileLogger(_0xe5d9('0xd'),path[_0xe5d9('0xc')](_0x4d5a25,_0x40c543));return _0x53dcb3;})[_0xe5d9('0x12')](function(_0x360d0d){throw _0x360d0d;});}this[_0xe5d9('0xa')]=function(_0x9f5fdc,_0x5bb1f0,_0x1c65c6,_0x44f9e7){return _0x143efa(_0x9f5fdc[_0xe5d9('0x13')])[_0xe5d9('0x11')](function(_0x5bd340){var _0x106e31=_0x5bd340[_0x5bb1f0];return _0x106e31;})[_0xe5d9('0x11')](function(_0x268622){var _0x47d505=_0x9f5fdc['user']?_0x9f5fdc[_0xe5d9('0x13')]['id']:'no-user';var _0x571914=_0x44f9e7[_0xe5d9('0x14')];var _0x16092c=_0x44f9e7['timestamp'];var _0x1db524=new Date(Number(_0x16092c));return _0x268622(_0x47d505,_0x1db524,_0x1c65c6,_0x571914);})[_0xe5d9('0x12')](function(_0x5a6498){fileLogger(_0xe5d9('0xd'))[_0xe5d9('0x15')](_0x5a6498);});};}function setupLoggers(_0x2662c3){return new Promise(function(_0x466c65){var _0x1b239e=new ClientSideLogger();var _0x47b6e6=fileLogger(_0xe5d9('0x16'));var _0x2d1603=fileLogger(_0xe5d9('0x17'));_0x2662c3[_0xe5d9('0x18')](_0xe5d9('0x19'),_0x1b239e);_0x2662c3[_0xe5d9('0x1a')](ewinston[_0xe5d9('0x1b')]({'winstonInstance':_0x47b6e6,'meta':![],'statusLevels':!![],'msg':function(_0x5014fd,_0x49f61a){var _0x505ce9=_0xe5d9('0x1c');if(!_['isEmpty'](_0x5014fd['body'])){_0x505ce9+=_0xe5d9('0x1d');var _0x1952d6=_0x5014fd[_0xe5d9('0x1e')];maskSensitiveData(_0x1952d6);}return safeTemplate(util[_0xe5d9('0x1f')](_0x505ce9,_0x5014fd['method'],_0x5014fd['headers'][_0xe5d9('0x20')]?_0x5014fd[_0xe5d9('0x21')][_0xe5d9('0x20')]:_0x5014fd['connection'][_0xe5d9('0x22')]||_0x5014fd['ip'],_0x5014fd['url'],_0x49f61a[_0xe5d9('0x23')],_0x49f61a['responseTime'],_0x5014fd['user']?_0x5014fd[_0xe5d9('0x13')]['id']:null,_0x5014fd[_0xe5d9('0x13')]?_0x5014fd[_0xe5d9('0x13')][_0xe5d9('0xf')]:null,_0x5014fd[_0xe5d9('0x13')]?_0x5014fd[_0xe5d9('0x13')][_0xe5d9('0xe')]:null,_0x1952d6?util[_0xe5d9('0x24')](_0x1952d6,![],null):''));}}));_0x2662c3[_0xe5d9('0x1a')](ewinston[_0xe5d9('0x1b')]({'winstonInstance':_0x2d1603,'meta':![],'statusLevels':!![],'msg':function(_0x3e86b9,_0x57fb3e){var _0x2eddcc=_0xe5d9('0x25');if(_0x3e86b9[_0xe5d9('0x1e')]&&_0x3e86b9['body'][_0xe5d9('0x26')]&&_0x3e86b9[_0xe5d9('0x1e')][_0xe5d9('0x27')]){_0x2eddcc=_0xe5d9('0x28');}return util['format'](_0x2eddcc,_0x3e86b9[_0xe5d9('0x29')],_0x3e86b9[_0xe5d9('0x21')][_0xe5d9('0x20')]?_0x3e86b9[_0xe5d9('0x21')][_0xe5d9('0x20')]:_0x3e86b9['connection'][_0xe5d9('0x22')]||_0x3e86b9['ip'],_0x3e86b9['url'],_0x57fb3e[_0xe5d9('0x23')],_0x57fb3e[_0xe5d9('0x2a')],_0x3e86b9[_0xe5d9('0x13')]?_0x3e86b9[_0xe5d9('0x13')]['id']:null,_0x3e86b9[_0xe5d9('0x13')]?_0x3e86b9['user']['name']:null,_0x3e86b9[_0xe5d9('0x13')]?_0x3e86b9[_0xe5d9('0x13')][_0xe5d9('0xe')]:null,_0x3e86b9[_0xe5d9('0x1e')]&&_0x3e86b9[_0xe5d9('0x1e')][_0xe5d9('0x26')]?_0x3e86b9[_0xe5d9('0x1e')][_0xe5d9('0x26')]:_0xe5d9('0x2b'),_0x3e86b9[_0xe5d9('0x1e')]&&_0x3e86b9[_0xe5d9('0x1e')][_0xe5d9('0x27')]?_0x3e86b9[_0xe5d9('0x1e')][_0xe5d9('0x27')]:'',_0x3e86b9[_0xe5d9('0x1e')]&&_0x3e86b9['body'][_0xe5d9('0x2c')]?_0x3e86b9[_0xe5d9('0x1e')]['agent_name']:'');},'ignoreRoute':function(_0x146937){var _0x3ea66f=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3ea66f['test'](_0x146937[_0xe5d9('0x2d')]);}}));return _0x466c65();});}exports[_0xe5d9('0x2e')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index eebca09..700b116 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9dc5=['locale','weekdaysShort','toLowerCase','indexOf','slice','circularDoWInterval','monthsShort','concat','exports','clone','hours','minutes','isBefore','startOf','endOf','day','isBetween','timeCompare','format','ddd','includes','date','max','min','domCompare','MMM','isMoment','padStart','length','iftime','lodash','moment-timezone','map','source','isValid','split'];(function(_0x53cff1,_0x2f94be){var _0x177ae6=function(_0x480040){while(--_0x480040){_0x53cff1['push'](_0x53cff1['shift']());}};_0x177ae6(++_0x2f94be);}(_0x9dc5,0x162));var _0x59dc=function(_0x21d6ea,_0x5c79ea){_0x21d6ea=_0x21d6ea-0x0;var _0x3dd45d=_0x9dc5[_0x21d6ea];return _0x3dd45d;};var _=require(_0x59dc('0x0'));var moment=require(_0x59dc('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][_0x59dc('0x2')](function(_0x428306){return _0x428306[_0x59dc('0x3')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x4ffba1){if(!_0x4ffba1[_0x59dc('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x3094c8){var _0x5e091b=_0x3094c8[_0x59dc('0x5')](':')['map'](function(_0x32b832){return parseInt(_0x32b832,0xa);});var _0x672760=_0x5e091b[0x0];var _0x36e2b8=_0x5e091b[0x1];if(_0x672760<0x0||_0x672760>0x17||_0x36e2b8<0x0||_0x36e2b8>0x3b){throw new Error(EINVALID_DATE);}return[_0x672760,_0x36e2b8];}function circularDoWInterval(_0x1ce0b9,_0x3606d8){if(_0x1ce0b9===_0x3606d8){return[_0x1ce0b9];}else{var _0xd622b0=moment[_0x59dc('0x6')]();moment[_0x59dc('0x6')]('en');var _0x455d52=moment[_0x59dc('0x7')]()[_0x59dc('0x2')](function(_0x5a2dea){return _0x5a2dea[_0x59dc('0x8')]();});moment[_0x59dc('0x6')](_0xd622b0);var _0x10ad2c=_0x455d52[_0x59dc('0x9')](_0x1ce0b9);var _0xa90a8c=_0x455d52['indexOf'](_0x3606d8);if(_0xa90a8c>_0x10ad2c){return _0x455d52[_0x59dc('0xa')](_0x10ad2c,_0xa90a8c+0x1);}else{var _0x50427f=_0x455d52[_0x59dc('0xa')](0x0,_0xa90a8c+0x1);var _0x4e7a13=_0x455d52['slice'](_0x10ad2c);return _0x4e7a13['concat'](_0x50427f);}}}module['exports'][_0x59dc('0xb')]=circularDoWInterval;function circularMonthInterval(_0x25e7c9,_0x23a025){if(_0x25e7c9===_0x23a025){return[_0x25e7c9];}else{var _0x5ded7f=moment[_0x59dc('0x6')]();moment[_0x59dc('0x6')]('en');var _0x2f1bee=moment[_0x59dc('0xc')]()[_0x59dc('0x2')](function(_0x3cb4b2){return _0x3cb4b2[_0x59dc('0x8')]();});moment[_0x59dc('0x6')](_0x5ded7f);var _0x2779e9=_0x2f1bee[_0x59dc('0x9')](_0x25e7c9);var _0x558f40=_0x2f1bee[_0x59dc('0x9')](_0x23a025);if(_0x558f40>_0x2779e9){return _0x2f1bee[_0x59dc('0xa')](_0x2779e9,_0x558f40+0x1);}else{var _0x107e2d=_0x2f1bee[_0x59dc('0xa')](0x0,_0x558f40+0x1);var _0x13064f=_0x2f1bee[_0x59dc('0xa')](_0x2779e9);return _0x13064f[_0x59dc('0xd')](_0x107e2d);}}}module[_0x59dc('0xe')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x25e24b){var _0x170f84=parseInt(_0x25e24b,0xa);if(_0x170f84<0x1||_0x170f84>0x1f){throw new Error(EINVALID_DATE);}return _0x170f84;}function timeCompare(_0xfdb5b5,_0x290790,_0xe482dd){var _0x2b9388=_0xfdb5b5[_0x59dc('0xf')]();var _0x5eaa71=extractTime(_0x290790);var _0x23f99e=_0x5eaa71[0x0];var _0x234e0b=_0x5eaa71[0x1];var _0x522bbd=_0xfdb5b5[_0x59dc('0xf')]()[_0x59dc('0x10')](_0x23f99e)['minutes'](_0x234e0b);throwIfDateNotValid(_0x522bbd);var _0x5a585c=extractTime(_0xe482dd);var _0x3baae5=_0x5a585c[0x0];var _0x51ae5e=_0x5a585c[0x1];var _0x8cf8cb=_0xfdb5b5[_0x59dc('0xf')]()['hours'](_0x3baae5)[_0x59dc('0x11')](_0x51ae5e);throwIfDateNotValid(_0x8cf8cb);if(_0x8cf8cb[_0x59dc('0x12')](_0x522bbd)){var _0x5adb4b=_0x2b9388[_0x59dc('0xf')]()[_0x59dc('0x13')]('day');var _0x5c36c1=_0x2b9388[_0x59dc('0xf')]()[_0x59dc('0x14')](_0x59dc('0x15'));return _0x2b9388[_0x59dc('0x16')](_0x522bbd,_0x5c36c1,undefined,'[]')||_0x2b9388['isBetween'](_0x5adb4b,_0x8cf8cb,undefined,'[]');}else{return _0x2b9388[_0x59dc('0x16')](_0x522bbd,_0x8cf8cb,undefined,'[]');}}module[_0x59dc('0xe')][_0x59dc('0x17')]=timeCompare;function dowCompare(_0x5aa30f,_0x38092d,_0x4fb42e){var _0x5f3c0c=_0x5aa30f[_0x59dc('0x6')]('en')[_0x59dc('0x18')](_0x59dc('0x19'))[_0x59dc('0x8')]();return circularDoWInterval(_0x38092d,_0x4fb42e)[_0x59dc('0x1a')](_0x5f3c0c);}module[_0x59dc('0xe')]['dowCompare']=dowCompare;function domCompare(_0x36c44a,_0x344745,_0x26c020){var _0x3510f1=_0x36c44a[_0x59dc('0x1b')]();if(_0x344745===_0x26c020){return _0x3510f1===_0x344745;}else{var _0x1808d5=_0x36c44a['daysInMonth']();var _0x2e7571=_0x344745<_0x26c020;let _0x5e37d7=![];var _0x59b023=0x0;var _0x40cb40=0x0;if(_0x2e7571){_0x59b023=Math[_0x59dc('0x1c')](0x1,_0x344745);_0x40cb40=Math[_0x59dc('0x1d')](_0x26c020,_0x1808d5);_0x5e37d7=_0x3510f1>=_0x59b023&&_0x3510f1<=_0x40cb40;}else{_0x59b023=Math['min'](_0x344745,_0x1808d5);_0x40cb40=Math[_0x59dc('0x1c')](0x1,_0x26c020);_0x5e37d7=_0x3510f1>=_0x59b023||_0x3510f1<=_0x40cb40;}return _0x5e37d7;}}module['exports'][_0x59dc('0x1e')]=domCompare;function monthCompare(_0x6c821c,_0xacd7a8,_0x4cafd1){var _0x1f7cd1=_0x6c821c[_0x59dc('0x6')]('en')[_0x59dc('0x18')](_0x59dc('0x1f'))[_0x59dc('0x8')]();return circularMonthInterval(_0xacd7a8,_0x4cafd1)[_0x59dc('0x1a')](_0x1f7cd1);}module['exports']['monthCompare']=monthCompare;function iftime(_0x5d9544,_0x516288=moment['tz']['guess'](),_0x348514=moment()){if(!validateRx['test'](_0x5d9544)){throw new Error(EINVALID_STRING);}else{var _0x522b96=(moment[_0x59dc('0x20')](_0x348514)?_0x348514[_0x59dc('0xf')]():moment(_0x348514))['tz'](_0x516288)['locale']('en');throwIfDateNotValid(_0x522b96);var _0x3178d8=_0x5d9544[_0x59dc('0x5')](',');var _0xaa8abb=_0x3178d8[0x0];var _0x452e0b=_0x3178d8[0x1];var _0x345b1d=_0x3178d8[0x2];var _0x524139=_0x3178d8[0x3];let _0x5674e2=!![];if(_0xaa8abb!=='*'){var _0x492e7c=_0xaa8abb[_0x59dc('0x5')]('-');var _0x3aa365=_[_0x59dc('0x21')](_0x492e7c[0x0],0x5,'0');var _0x29f174=_0x492e7c[_0x59dc('0x22')]===0x2?_[_0x59dc('0x21')](_0x492e7c[0x1],0x5,'0'):_0x3aa365;_0x5674e2=timeCompare(_0x522b96,_0x3aa365,_0x29f174);}let _0x286dea=!![];if(_0x452e0b!=='*'){var _0x485fcf=_0x452e0b[_0x59dc('0x5')]('-');var _0x5821e7=_0x485fcf[0x0];var _0x51cdae=_0x485fcf['length']===0x2?_0x485fcf[0x1]:_0x5821e7;_0x286dea=dowCompare(_0x522b96,_0x5821e7,_0x51cdae);}let _0x10fb65=!![];if(_0x345b1d!=='*'){var _0x4ac47c=_0x345b1d[_0x59dc('0x5')]('-');var _0x429adf=parseDom(_0x4ac47c[0x0]);var _0x4862cd=_0x4ac47c['length']===0x2?parseDom(_0x4ac47c[0x1]):_0x429adf;_0x10fb65=domCompare(_0x522b96,_0x429adf,_0x4862cd);}let _0x12f49a=!![];if(_0x524139!=='*'){var _0x356f4a=_0x524139[_0x59dc('0x5')]('-');var _0x496b90=_0x356f4a[0x0];var _0x2d3f6c=_0x356f4a[_0x59dc('0x22')]===0x2?_0x356f4a[0x1]:_0x356f4a[0x0];_0x12f49a=monthCompare(_0x522b96,_0x496b90,_0x2d3f6c);}return _0x5674e2&&_0x286dea&&_0x10fb65&&_0x12f49a;}}module[_0x59dc('0xe')][_0x59dc('0x23')]=iftime; \ No newline at end of file +var _0x4e4b=['minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','includes','dowCompare','daysInMonth','max','min','domCompare','MMM','monthCompare','guess','isMoment','padStart','length','iftime','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4e4b,0x66));var _0xb4e4=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4e4b[_0x4a9fb1];return _0x348672;};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][_0xb4e4('0x0')](function(_0x3a85ef){return _0x3a85ef[_0xb4e4('0x1')];})[_0xb4e4('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xb4e4('0x3');var EINVALID_DATE=_0xb4e4('0x4');function throwIfDateNotValid(_0x29a506){if(!_0x29a506[_0xb4e4('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0xab40f3){var _0x56df11=_0xab40f3[_0xb4e4('0x6')](':')['map'](function(_0x13aac6){return parseInt(_0x13aac6,0xa);});var _0x4d4009=_0x56df11[0x0];var _0x2906a8=_0x56df11[0x1];if(_0x4d4009<0x0||_0x4d4009>0x17||_0x2906a8<0x0||_0x2906a8>0x3b){throw new Error(EINVALID_DATE);}return[_0x4d4009,_0x2906a8];}function circularDoWInterval(_0x16ffcd,_0x1b990b){if(_0x16ffcd===_0x1b990b){return[_0x16ffcd];}else{var _0x319731=moment['locale']();moment[_0xb4e4('0x7')]('en');var _0x4a6103=moment['weekdaysShort']()[_0xb4e4('0x0')](function(_0x1ed08c){return _0x1ed08c[_0xb4e4('0x8')]();});moment[_0xb4e4('0x7')](_0x319731);var _0x272af7=_0x4a6103[_0xb4e4('0x9')](_0x16ffcd);var _0x1ab7eb=_0x4a6103[_0xb4e4('0x9')](_0x1b990b);if(_0x1ab7eb>_0x272af7){return _0x4a6103[_0xb4e4('0xa')](_0x272af7,_0x1ab7eb+0x1);}else{var _0x2b4636=_0x4a6103[_0xb4e4('0xa')](0x0,_0x1ab7eb+0x1);var _0x1d1de5=_0x4a6103[_0xb4e4('0xa')](_0x272af7);return _0x1d1de5[_0xb4e4('0xb')](_0x2b4636);}}}module[_0xb4e4('0xc')][_0xb4e4('0xd')]=circularDoWInterval;function circularMonthInterval(_0x3d7cef,_0x25ce2a){if(_0x3d7cef===_0x25ce2a){return[_0x3d7cef];}else{var _0x2e4b7d=moment['locale']();moment[_0xb4e4('0x7')]('en');var _0x536639=moment[_0xb4e4('0xe')]()['map'](function(_0x45208f){return _0x45208f['toLowerCase']();});moment[_0xb4e4('0x7')](_0x2e4b7d);var _0x2c4f82=_0x536639[_0xb4e4('0x9')](_0x3d7cef);var _0x3700fc=_0x536639[_0xb4e4('0x9')](_0x25ce2a);if(_0x3700fc>_0x2c4f82){return _0x536639['slice'](_0x2c4f82,_0x3700fc+0x1);}else{var _0x4a38f4=_0x536639[_0xb4e4('0xa')](0x0,_0x3700fc+0x1);var _0x4b7d3f=_0x536639['slice'](_0x2c4f82);return _0x4b7d3f['concat'](_0x4a38f4);}}}module['exports'][_0xb4e4('0xf')]=circularMonthInterval;function parseDom(_0xedced8){var _0x2f01bd=parseInt(_0xedced8,0xa);if(_0x2f01bd<0x1||_0x2f01bd>0x1f){throw new Error(EINVALID_DATE);}return _0x2f01bd;}function timeCompare(_0x14b84d,_0x1d78bc,_0x5ad430){var _0x1c5054=_0x14b84d[_0xb4e4('0x10')]();var _0x15d59d=extractTime(_0x1d78bc);var _0x1b51b4=_0x15d59d[0x0];var _0x50d87e=_0x15d59d[0x1];var _0x50554c=_0x14b84d[_0xb4e4('0x10')]()[_0xb4e4('0x11')](_0x1b51b4)[_0xb4e4('0x12')](_0x50d87e);throwIfDateNotValid(_0x50554c);var _0x92cd1a=extractTime(_0x5ad430);var _0x5147fc=_0x92cd1a[0x0];var _0x2b0f35=_0x92cd1a[0x1];var _0x596d1d=_0x14b84d[_0xb4e4('0x10')]()[_0xb4e4('0x11')](_0x5147fc)[_0xb4e4('0x12')](_0x2b0f35);throwIfDateNotValid(_0x596d1d);if(_0x596d1d[_0xb4e4('0x13')](_0x50554c)){var _0x4c1d03=_0x1c5054[_0xb4e4('0x10')]()[_0xb4e4('0x14')](_0xb4e4('0x15'));var _0x36b7b2=_0x1c5054[_0xb4e4('0x10')]()[_0xb4e4('0x16')](_0xb4e4('0x15'));return _0x1c5054['isBetween'](_0x50554c,_0x36b7b2,undefined,'[]')||_0x1c5054[_0xb4e4('0x17')](_0x4c1d03,_0x596d1d,undefined,'[]');}else{return _0x1c5054['isBetween'](_0x50554c,_0x596d1d,undefined,'[]');}}module[_0xb4e4('0xc')][_0xb4e4('0x18')]=timeCompare;function dowCompare(_0x451dda,_0x1cca18,_0x17e58a){var _0xc64fc8=_0x451dda[_0xb4e4('0x7')]('en')[_0xb4e4('0x19')](_0xb4e4('0x1a'))[_0xb4e4('0x8')]();return circularDoWInterval(_0x1cca18,_0x17e58a)[_0xb4e4('0x1b')](_0xc64fc8);}module['exports'][_0xb4e4('0x1c')]=dowCompare;function domCompare(_0x95d1e5,_0x4ad252,_0x3077ac){var _0x2060b7=_0x95d1e5['date']();if(_0x4ad252===_0x3077ac){return _0x2060b7===_0x4ad252;}else{var _0x514de4=_0x95d1e5[_0xb4e4('0x1d')]();var _0x2a98cd=_0x4ad252<_0x3077ac;let _0x17ac77=![];var _0x20f329=0x0;var _0xa32b8e=0x0;if(_0x2a98cd){_0x20f329=Math[_0xb4e4('0x1e')](0x1,_0x4ad252);_0xa32b8e=Math[_0xb4e4('0x1f')](_0x3077ac,_0x514de4);_0x17ac77=_0x2060b7>=_0x20f329&&_0x2060b7<=_0xa32b8e;}else{_0x20f329=Math[_0xb4e4('0x1f')](_0x4ad252,_0x514de4);_0xa32b8e=Math[_0xb4e4('0x1e')](0x1,_0x3077ac);_0x17ac77=_0x2060b7>=_0x20f329||_0x2060b7<=_0xa32b8e;}return _0x17ac77;}}module['exports'][_0xb4e4('0x20')]=domCompare;function monthCompare(_0x233faa,_0x2f11a1,_0x123ae2){var _0x4e4e25=_0x233faa['locale']('en')[_0xb4e4('0x19')](_0xb4e4('0x21'))['toLowerCase']();return circularMonthInterval(_0x2f11a1,_0x123ae2)['includes'](_0x4e4e25);}module[_0xb4e4('0xc')][_0xb4e4('0x22')]=monthCompare;function iftime(_0x9542d1,_0x348ea5=moment['tz'][_0xb4e4('0x23')](),_0x2e3af2=moment()){if(!validateRx['test'](_0x9542d1)){throw new Error(EINVALID_STRING);}else{var _0x2323c1=(moment[_0xb4e4('0x24')](_0x2e3af2)?_0x2e3af2[_0xb4e4('0x10')]():moment(_0x2e3af2))['tz'](_0x348ea5)[_0xb4e4('0x7')]('en');throwIfDateNotValid(_0x2323c1);var _0x21161b=_0x9542d1[_0xb4e4('0x6')](',');var _0x4373e9=_0x21161b[0x0];var _0x54bf15=_0x21161b[0x1];var _0x1aa53b=_0x21161b[0x2];var _0x483b5d=_0x21161b[0x3];let _0xee6c6c=!![];if(_0x4373e9!=='*'){var _0x2a865a=_0x4373e9[_0xb4e4('0x6')]('-');var _0xddc935=_[_0xb4e4('0x25')](_0x2a865a[0x0],0x5,'0');var _0x4c69fa=_0x2a865a[_0xb4e4('0x26')]===0x2?_['padStart'](_0x2a865a[0x1],0x5,'0'):_0xddc935;_0xee6c6c=timeCompare(_0x2323c1,_0xddc935,_0x4c69fa);}let _0x321439=!![];if(_0x54bf15!=='*'){var _0x32df5e=_0x54bf15[_0xb4e4('0x6')]('-');var _0x10facf=_0x32df5e[0x0];var _0x3f2128=_0x32df5e[_0xb4e4('0x26')]===0x2?_0x32df5e[0x1]:_0x10facf;_0x321439=dowCompare(_0x2323c1,_0x10facf,_0x3f2128);}let _0x1afede=!![];if(_0x1aa53b!=='*'){var _0x3c1f2c=_0x1aa53b['split']('-');var _0x464c84=parseDom(_0x3c1f2c[0x0]);var _0x38530c=_0x3c1f2c[_0xb4e4('0x26')]===0x2?parseDom(_0x3c1f2c[0x1]):_0x464c84;_0x1afede=domCompare(_0x2323c1,_0x464c84,_0x38530c);}let _0x2ead0c=!![];if(_0x483b5d!=='*'){var _0x491996=_0x483b5d['split']('-');var _0x2c5ff5=_0x491996[0x0];var _0xb29011=_0x491996[_0xb4e4('0x26')]===0x2?_0x491996[0x1]:_0x491996[0x0];_0x2ead0c=monthCompare(_0x2323c1,_0x2c5ff5,_0xb29011);}return _0xee6c6c&&_0x321439&&_0x1afede&&_0x2ead0c;}}module[_0xb4e4('0xc')][_0xb4e4('0x27')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 3cb1b29..0aabc5d 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed37=['bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','join','message','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','path','util','moment','winston','debugLevel','toLowerCase','info','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray'];(function(_0x42e4f9,_0x4087d7){var _0x5ad744=function(_0x1db3fc){while(--_0x1db3fc){_0x42e4f9['push'](_0x42e4f9['shift']());}};_0x5ad744(++_0x4087d7);}(_0xed37,0x152));var _0x7ed3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xed37[_0x2641f9];return _0x585741;};'use strict';var path=require(_0x7ed3('0x0'));var util=require(_0x7ed3('0x1'));var moment=require(_0x7ed3('0x2'));var winston=require(_0x7ed3('0x3'));var config=require('../config/environment');var debugLevel=config['debugLevel']?config[_0x7ed3('0x4')][_0x7ed3('0x5')]():_0x7ed3('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':'redBG\x20white','error':_0x7ed3('0x7'),'warn':_0x7ed3('0x8'),'info':_0x7ed3('0x9'),'print':_0x7ed3('0xa'),'success':_0x7ed3('0xb'),'http':_0x7ed3('0xc'),'verbose':_0x7ed3('0xd'),'debug':_0x7ed3('0xe'),'silly':_0x7ed3('0xf')};winston[_0x7ed3('0x10')](XC_LOG_COLORS);function getLogFileName(_0x56b18c,_0x8742c0,_0x2a2b75){var _0x120851=_0x56b18c||'/var/log/xcally';return path[_0x7ed3('0x11')](_0x120851,util['format']('%s-%s.log',_0x8742c0,_0x2a2b75));}function formatter(_0x3ab614,_0x161bb3){_0x161bb3[_0x7ed3('0x12')]=_0x161bb3[_0x7ed3('0x12')][_0x7ed3('0x13')](/@@{/g,'{{{')['replace'](/}@@/g,_0x7ed3('0x14'))[_0x7ed3('0x13')](/@{/g,'{{')[_0x7ed3('0x13')](/}@/g,'}}');return util[_0x7ed3('0x15')](_0x7ed3('0x16'),moment()[_0x7ed3('0x15')](_0x7ed3('0x17')),_0x161bb3[_0x7ed3('0x18')]['toUpperCase'](),_0x3ab614,_0x161bb3[_0x7ed3('0x12')]);}function fileFormat(_0x1a3e50,_0x106b1b){_0x106b1b[_0x7ed3('0x12')]=_0x106b1b['message'][_0x7ed3('0x13')](/@@{/g,'{{{')[_0x7ed3('0x13')](/}@@/g,_0x7ed3('0x14'))[_0x7ed3('0x13')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x1ecca4=_0x106b1b[_0x7ed3('0x19')]&&Object[_0x7ed3('0x1a')](_0x106b1b['meta'])[_0x7ed3('0x1b')]?'\x0a\x09'+JSON[_0x7ed3('0x1c')](_0x106b1b[_0x7ed3('0x19')]):'';return util[_0x7ed3('0x15')](_0x7ed3('0x1d'),moment()['format'](_0x7ed3('0x17')),_0x106b1b[_0x7ed3('0x18')][_0x7ed3('0x1e')](),_0x1a3e50,_0x106b1b[_0x7ed3('0x12')],_0x1ecca4);}function consoleLogger(){var _0x292289=new winston[(_0x7ed3('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x7ed3('0x20'))][(_0x7ed3('0x21'))]({'level':_0x7ed3('0x22'),'json':![],'formatter':function(_0x47b5b3){return formatter('',_0x47b5b3);}})]});return _0x292289;}function fileLogger(_0x256f73,_0x40c4cc){var _0x210e01=new winston[(_0x7ed3('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x7ed3('0x23'))]({'name':util['format'](_0x7ed3('0x24'),_0x256f73,_0x7ed3('0x25')),'filename':getLogFileName(_0x40c4cc,_0x256f73,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x30615c){return fileFormat(_0x256f73,_0x30615c);}}),new winston[(_0x7ed3('0x20'))][(_0x7ed3('0x23'))]({'name':util['format']('%s-%s',_0x256f73,debugLevel),'filename':getLogFileName(_0x40c4cc,_0x256f73,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x18069d){return fileFormat(_0x256f73,_0x18069d);}}),new winston[(_0x7ed3('0x20'))][(_0x7ed3('0x21'))]({'level':_0x7ed3('0x22'),'json':![],'formatter':function(_0x4838b8){return fileFormat(_0x256f73,_0x4838b8);}})]});return _0x210e01;}exports[_0x7ed3('0x26')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0xe83e=['length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','path','winston','../config/environment','toLowerCase','info','red','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','meta','keys'];(function(_0x34a7ba,_0x3075bd){var _0x5dfdd9=function(_0xc9ae2e){while(--_0xc9ae2e){_0x34a7ba['push'](_0x34a7ba['shift']());}};_0x5dfdd9(++_0x3075bd);}(_0xe83e,0x17c));var _0xee83=function(_0x30f82,_0x102a78){_0x30f82=_0x30f82-0x0;var _0x866934=_0xe83e[_0x30f82];return _0x866934;};'use strict';var path=require(_0xee83('0x0'));var util=require('util');var moment=require('moment');var winston=require(_0xee83('0x1'));var config=require(_0xee83('0x2'));var debugLevel=config['debugLevel']?config['debugLevel'][_0xee83('0x3')]():_0xee83('0x4');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0xee83('0x5'),'warn':_0xee83('0x6'),'info':_0xee83('0x7'),'print':_0xee83('0x8'),'success':_0xee83('0x9'),'http':'gray','verbose':_0xee83('0xa'),'debug':_0xee83('0xb'),'silly':_0xee83('0xc')};winston[_0xee83('0xd')](XC_LOG_COLORS);function getLogFileName(_0x5acbc6,_0x55d7a7,_0x3a2903){var _0x1fe5ae=_0x5acbc6||_0xee83('0xe');return path[_0xee83('0xf')](_0x1fe5ae,util[_0xee83('0x10')](_0xee83('0x11'),_0x55d7a7,_0x3a2903));}function formatter(_0x395485,_0x17acc0){_0x17acc0['message']=_0x17acc0['message'][_0xee83('0x12')](/@@{/g,_0xee83('0x13'))['replace'](/}@@/g,'}}}')[_0xee83('0x12')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xee83('0x10')](_0xee83('0x14'),moment()[_0xee83('0x10')](_0xee83('0x15')),_0x17acc0[_0xee83('0x16')][_0xee83('0x17')](),_0x395485,_0x17acc0[_0xee83('0x18')]);}function fileFormat(_0x1d338f,_0x3fa865){_0x3fa865[_0xee83('0x18')]=_0x3fa865[_0xee83('0x18')][_0xee83('0x12')](/@@{/g,_0xee83('0x13'))[_0xee83('0x12')](/}@@/g,'}}}')[_0xee83('0x12')](/@{/g,'{{')[_0xee83('0x12')](/}@/g,'}}');var _0x8cf42b=_0x3fa865[_0xee83('0x19')]&&Object[_0xee83('0x1a')](_0x3fa865[_0xee83('0x19')])[_0xee83('0x1b')]?'\x0a\x09'+JSON['stringify'](_0x3fa865[_0xee83('0x19')]):'';return util[_0xee83('0x10')](_0xee83('0x1c'),moment()['format'](_0xee83('0x15')),_0x3fa865[_0xee83('0x16')][_0xee83('0x17')](),_0x1d338f,_0x3fa865[_0xee83('0x18')],_0x8cf42b);}function consoleLogger(){var _0x1080e4=new winston[(_0xee83('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xee83('0x1e'))][(_0xee83('0x1f'))]({'level':_0xee83('0x20'),'json':![],'formatter':function(_0x18a954){return formatter('',_0x18a954);}})]});return _0x1080e4;}function fileLogger(_0x2bf7d2,_0x5dfa33){var _0x3a5659=new winston[(_0xee83('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xee83('0x21'))]({'name':util[_0xee83('0x10')](_0xee83('0x22'),_0x2bf7d2,_0xee83('0x23')),'filename':getLogFileName(_0x5dfa33,_0x2bf7d2,_0xee83('0x23')),'level':_0xee83('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4c03c0){return fileFormat(_0x2bf7d2,_0x4c03c0);}}),new winston[(_0xee83('0x1e'))][(_0xee83('0x21'))]({'name':util[_0xee83('0x10')](_0xee83('0x22'),_0x2bf7d2,debugLevel),'filename':getLogFileName(_0x5dfa33,_0x2bf7d2,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1d132d){return fileFormat(_0x2bf7d2,_0x1d132d);}}),new winston['transports'][(_0xee83('0x1f'))]({'level':'warn','json':![],'formatter':function(_0x251896){return fileFormat(_0x2bf7d2,_0x251896);}})]});return _0x3a5659;}exports[_0xee83('0x24')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index ca537f7..4e34772 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 _0x57ca=['accesskeyid','secretaccesskey','key','user','accountSid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','@@{','replace','}@@','includes','exports','username','password','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerSecret','calleridname','calleridnum','vidaooApiKey','privateKey'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x57ca,0x108));var _0xa57c=function(_0x1fd418,_0x4c96dd){_0x1fd418=_0x1fd418-0x0;var _0x4360d1=_0x57ca[_0x1fd418];return _0x4360d1;};var _=require('lodash');var sensitiveFields=[_0xa57c('0x0'),_0xa57c('0x1'),'newPassword',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),_0xa57c('0x6'),'mobile',_0xa57c('0x7'),_0xa57c('0x8'),_0xa57c('0x9'),_0xa57c('0xa'),_0xa57c('0xb'),_0xa57c('0xc'),_0xa57c('0xd'),_0xa57c('0xe'),'token',_0xa57c('0xf'),'accessToken',_0xa57c('0x10'),_0xa57c('0x11'),'consumerKey',_0xa57c('0x12'),'membername',_0xa57c('0x13'),_0xa57c('0x14'),'exten',_0xa57c('0x15'),'clientEmail',_0xa57c('0x16'),_0xa57c('0x17'),_0xa57c('0x18'),_0xa57c('0x19'),_0xa57c('0x1a'),'pass',_0xa57c('0x1b'),'localstationid',_0xa57c('0x1c'),_0xa57c('0x1d'),_0xa57c('0x1e'),_0xa57c('0x1f')];function maskSensitiveData(_0x3238ff){const _0x37a323=/(?!^)[\s\S](?!$)/g;if(_[_0xa57c('0x20')](_0x3238ff)){for(const _0x4b4bdb in _0x3238ff){if(_[_0xa57c('0x21')](_0x3238ff[_0x4b4bdb])){for(let _0xdf7ff6=0x0;_0xdf7ff6<_0x3238ff[_0x4b4bdb][_0xa57c('0x22')];_0xdf7ff6++){maskSensitiveData(_0x3238ff[_0x4b4bdb][_0xdf7ff6]);}}else if(_['isPlainObject'](_0x3238ff[_0x4b4bdb])){maskSensitiveData(_0x3238ff[_0x4b4bdb]);}else if(_[_0xa57c('0x23')](_0x3238ff[_0x4b4bdb])){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb]['replace'](/{{{/g,_0xa57c('0x24'))[_0xa57c('0x25')](/}}}/g,_0xa57c('0x26'))[_0xa57c('0x25')](/{{/g,'@{')[_0xa57c('0x25')](/}}/g,'}@');if(_[_0xa57c('0x27')](sensitiveFields,_0x4b4bdb)){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb][_0xa57c('0x25')](_0x37a323,'*');}}}}}module[_0xa57c('0x28')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x66fa=['calleridnum','vidaooApiKey','privateKey','secretaccesskey','key','user','localstationid','oldPassword','isPlainObject','length','isString','replace','includes','exports','maskSensitiveData','lodash','username','newPassword','apiKey','firstName','lastName','street','phone','mobile','clientId','clientSecret','securityToken','code','accessKey','token','accessToken','authToken','calleridname'];(function(_0x169874,_0x2a35ac){var _0xf0ac8f=function(_0x12b602){while(--_0x12b602){_0x169874['push'](_0x169874['shift']());}};_0xf0ac8f(++_0x2a35ac);}(_0x66fa,0x117));var _0xa66f=function(_0x13a80e,_0xc146b9){_0x13a80e=_0x13a80e-0x0;var _0x3462c0=_0x66fa[_0x13a80e];return _0x3462c0;};var _=require(_0xa66f('0x0'));var sensitiveFields=[_0xa66f('0x1'),'password',_0xa66f('0x2'),_0xa66f('0x3'),_0xa66f('0x4'),_0xa66f('0x5'),_0xa66f('0x6'),_0xa66f('0x7'),_0xa66f('0x8'),'fax','email',_0xa66f('0x9'),_0xa66f('0xa'),_0xa66f('0xb'),_0xa66f('0xc'),_0xa66f('0xd'),'tenantId',_0xa66f('0xe'),'channelSecret',_0xa66f('0xf'),'accessTokenSecret',_0xa66f('0x10'),'consumerKey','consumerSecret','membername',_0xa66f('0x11'),_0xa66f('0x12'),'exten',_0xa66f('0x13'),'clientEmail',_0xa66f('0x14'),'accesskeyid',_0xa66f('0x15'),_0xa66f('0x16'),_0xa66f('0x17'),'pass','accountSid',_0xa66f('0x18'),'dsn','secret','registry',_0xa66f('0x19')];function maskSensitiveData(_0x452c37){const _0x267129=/(?!^)[\s\S](?!$)/g;if(_[_0xa66f('0x1a')](_0x452c37)){for(const _0xd348f9 in _0x452c37){if(_['isArray'](_0x452c37[_0xd348f9])){for(let _0x5510dc=0x0;_0x5510dc<_0x452c37[_0xd348f9][_0xa66f('0x1b')];_0x5510dc++){maskSensitiveData(_0x452c37[_0xd348f9][_0x5510dc]);}}else if(_[_0xa66f('0x1a')](_0x452c37[_0xd348f9])){maskSensitiveData(_0x452c37[_0xd348f9]);}else if(_[_0xa66f('0x1c')](_0x452c37[_0xd348f9])){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](/{{{/g,'@@{')[_0xa66f('0x1d')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xa66f('0x1d')](/}}/g,'}@');if(_[_0xa66f('0x1e')](sensitiveFields,_0xd348f9)){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](_0x267129,'*');}}}}}module[_0xa66f('0x1f')][_0xa66f('0x20')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index d8d8513..1d148b1 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['replace','\x5c$&'];(function(_0x2f6999,_0xe625be){var _0x362ff9=function(_0x281705){while(--_0x281705){_0x2f6999['push'](_0x2f6999['shift']());}};_0x362ff9(++_0xe625be);}(_0x1261,0x144));var _0x1126=function(_0x2962d5,_0x38deda){_0x2962d5=_0x2962d5-0x0;var _0x273406=_0x1261[_0x2962d5];return _0x273406;};module['exports']={'escapeRegExp'(_0x234ea5,_0x26c6a0=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x234ea5[_0x1126('0x0')](_0x26c6a0,_0x1126('0x1'));}}; \ No newline at end of file +var _0x57ca=['\x5c$&'];(function(_0x5856af,_0x6a158d){var _0x22a93a=function(_0x732b60){while(--_0x732b60){_0x5856af['push'](_0x5856af['shift']());}};_0x22a93a(++_0x6a158d);}(_0x57ca,0x108));var _0xa57c=function(_0x3ad94a,_0x342e6a){_0x3ad94a=_0x3ad94a-0x0;var _0x331d9a=_0x57ca[_0x3ad94a];return _0x331d9a;};module['exports']={'escapeRegExp'(_0x29cc65,_0x4ad696=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x29cc65['replace'](_0x4ad696,_0xa57c('0x0'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 1968972..40d726c 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef0f=['lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray','isPlainObject','keys','reduce','safeTemplate'];(function(_0xf9b774,_0x1ad9fa){var _0x2230f5=function(_0x2f3ff0){while(--_0x2f3ff0){_0xf9b774['push'](_0xf9b774['shift']());}};_0x2230f5(++_0x1ad9fa);}(_0xef0f,0x168));var _0xfef0=function(_0x38080f,_0x2b7ce9){_0x38080f=_0x38080f-0x0;var _0x359a64=_0xef0f[_0x38080f];return _0x359a64;};var _=require(_0xfef0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x581303){return _0x581303==='{{'?_0xfef0('0x1'):_0xfef0('0x2');}function safeTemplate(_0x19f865){var _0x4d29e5=_0x19f865;if(typeof _0x19f865===_0xfef0('0x3')){_0x4d29e5=_0x19f865[_0xfef0('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xfef0('0x5')](_0x19f865)){_0x4d29e5=_0x19f865['map'](function(_0x2a6fcf){return safeTemplate(_0x2a6fcf);});}else if(_[_0xfef0('0x6')](_0x19f865)){_0x4d29e5=Object[_0xfef0('0x7')](_0x19f865)[_0xfef0('0x8')](function(_0xad43e,_0x11dfd7){_0xad43e[_0x11dfd7]=safeTemplate(_0x19f865[_0x11dfd7]);return _0xad43e;},{});}return _0x4d29e5;}module['exports'][_0xfef0('0x9')]=safeTemplate; \ No newline at end of file +var _0x1eba=['\x20}\x20}','replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','{\x20{\x20'];(function(_0x4c6a7f,_0x452cf6){var _0x1a5474=function(_0x5531ee){while(--_0x5531ee){_0x4c6a7f['push'](_0x4c6a7f['shift']());}};_0x1a5474(++_0x452cf6);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x45346d,_0xffd56b){_0x45346d=_0x45346d-0x0;var _0x5ce7ca=_0x1eba[_0x45346d];return _0x5ce7ca;};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 5b2980e..f91d6b2 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 _0x8b1c=['legacy-libs','isArray','apps','name','motion2','NODE_PATH','env','pathExists','readJSON','then','updated','info','Updating\x20app.json','writeJSON','exports','path','../config/environment','root','resolve'];(function(_0x104bec,_0x4b869e){var _0x2c5ca2=function(_0x3b8d5d){while(--_0x3b8d5d){_0x104bec['push'](_0x104bec['shift']());}};_0x2c5ca2(++_0x4b869e);}(_0x8b1c,0x12c));var _0xc8b1=function(_0x23c025,_0x4a3cd6){_0x23c025=_0x23c025-0x0;var _0x582e8c=_0x8b1c[_0x23c025];return _0x582e8c;};var fs=require('fs-extra');var path=require(_0xc8b1('0x0'));var config=require(_0xc8b1('0x1'));var root=config[_0xc8b1('0x2')];var APP_JSON_PATH=path[_0xc8b1('0x3')](root,'server/app.json');var NODEPATH=path[_0xc8b1('0x3')](root,_0xc8b1('0x4'));function setLegacyLibsNodeEnvPath(_0x36b540){let _0xbbc825=![];if(Array[_0xc8b1('0x5')](_0x36b540['apps'])){var _0x5822d5=_0x36b540[_0xc8b1('0x6')]['findIndex'](function(_0x5a812d){return _0x5a812d[_0xc8b1('0x7')]===_0xc8b1('0x8');});if(_0x5822d5>-0x1){var _0x85b95d=_0x36b540[_0xc8b1('0x6')][_0x5822d5];if(typeof _0x85b95d['env'][_0xc8b1('0x9')]!=='string'){_0x85b95d[_0xc8b1('0xa')][_0xc8b1('0x9')]=NODEPATH;_0xbbc825=!![];}}return{'appConfig':_0x36b540,'updated':_0xbbc825};}}function updateAppConfig(_0x1be955){return fs[_0xc8b1('0xb')](APP_JSON_PATH)['then'](function(_0x11000f){if(_0x11000f){return fs[_0xc8b1('0xc')](APP_JSON_PATH)[_0xc8b1('0xd')](function(_0x3a86f3){var _0x514b52=setLegacyLibsNodeEnvPath(_0x3a86f3);if(_0x514b52[_0xc8b1('0xe')]){_0x1be955[_0xc8b1('0xf')](_0xc8b1('0x10'));return fs[_0xc8b1('0x11')](APP_JSON_PATH,_0x3a86f3,{'spaces':0x2});}else{return Promise[_0xc8b1('0x3')]();}});}else{return Promise['resolve']();}});}module[_0xc8b1('0x12')]=updateAppConfig; \ No newline at end of file +var _0xd6a9=['env','NODE_PATH','pathExists','then','readJSON','updated','Updating\x20app.json','writeJSON','exports','fs-extra','path','root','resolve','legacy-libs','apps','findIndex','name','motion2'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xd6a9,0x1a7));var _0x9d6a=function(_0x36a5f3,_0xf4d305){_0x36a5f3=_0x36a5f3-0x0;var _0x41d37f=_0xd6a9[_0x36a5f3];return _0x41d37f;};var fs=require(_0x9d6a('0x0'));var path=require(_0x9d6a('0x1'));var config=require('../config/environment');var root=config[_0x9d6a('0x2')];var APP_JSON_PATH=path[_0x9d6a('0x3')](root,'server/app.json');var NODEPATH=path['resolve'](root,_0x9d6a('0x4'));function setLegacyLibsNodeEnvPath(_0x4ad312){let _0x1f4753=![];if(Array['isArray'](_0x4ad312['apps'])){var _0x3115ca=_0x4ad312[_0x9d6a('0x5')][_0x9d6a('0x6')](function(_0x21ae5d){return _0x21ae5d[_0x9d6a('0x7')]===_0x9d6a('0x8');});if(_0x3115ca>-0x1){var _0xf6a05d=_0x4ad312['apps'][_0x3115ca];if(typeof _0xf6a05d[_0x9d6a('0x9')][_0x9d6a('0xa')]!=='string'){_0xf6a05d[_0x9d6a('0x9')][_0x9d6a('0xa')]=NODEPATH;_0x1f4753=!![];}}return{'appConfig':_0x4ad312,'updated':_0x1f4753};}}function updateAppConfig(_0x590c43){return fs[_0x9d6a('0xb')](APP_JSON_PATH)[_0x9d6a('0xc')](function(_0x33b4fe){if(_0x33b4fe){return fs[_0x9d6a('0xd')](APP_JSON_PATH)[_0x9d6a('0xc')](function(_0x505252){var _0x37f60a=setLegacyLibsNodeEnvPath(_0x505252);if(_0x37f60a[_0x9d6a('0xe')]){_0x590c43['info'](_0x9d6a('0xf'));return fs[_0x9d6a('0x10')](APP_JSON_PATH,_0x505252,{'spaces':0x2});}else{return Promise[_0x9d6a('0x3')]();}});}else{return Promise[_0x9d6a('0x3')]();}});}module[_0x9d6a('0x11')]=updateAppConfig; \ No newline at end of file